diff --git a/build/potree/potree.js b/build/potree/potree.js index 1dbfff33..d2ab294c 100644 --- a/build/potree/potree.js +++ b/build/potree/potree.js @@ -6004,8 +6004,10 @@ Potree.Annotation = function(scene, args = {}){ this.title = args.title || "No Title"; this.description = args.description || ""; this.position = args.position || new THREE.Vector3(0,0,0); - this.cameraPosition = args.cameraPosition; - this.cameraTarget = args.cameraTarget; + this.cameraPosition = (args.cameraPosition instanceof Array) ? + new THREE.Vector3().fromArray(args.cameraPosition) : args.cameraPosition; + this.cameraTarget = (args.cameraTarget instanceof Array) ? + new THREE.Vector3().fromArray(args.cameraTarget) : args.cameraTarget; this.view = args.view || null; this.keepOpen = false; this.descriptionVisible = false; @@ -11005,8 +11007,8 @@ Potree.GeoJSONExporter = class GeoJSONExporter{ /** * * @author sigeom sa / http://sigeom.ch - * @author Ioda-Net Sàrl / https://www.ioda-net.ch/ - * @author Markus Schütz / http://potree.org + * @author Ioda-Net S�rl / https://www.ioda-net.ch/ + * @author Markus Sch�tz / http://potree.org * */ @@ -12639,7 +12641,12 @@ Potree.Scene = class extends THREE.EventDispatcher{ } addAnnotation(position, args = {}){ - args.position = position; + if(position instanceof Array){ + args.position = new THREE.Vector3().fromArray(position); + }else if(position instanceof THREE.Vector3){ + args.position = position; + } + if(!args.cameraTarget){ args.cameraTarget = position; diff --git a/examples/lasmap.html b/examples/lasmap.html index ff377963..960b799c 100644 --- a/examples/lasmap.html +++ b/examples/lasmap.html @@ -15,7 +15,7 @@ - +
diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_0.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_0.json deleted file mode 100644 index 06f4ffae..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_0.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":0,"numberOfSamples":1000,"samples":[-0.002403025022753476,-2.5083047211757836e-5,-1.721638967214743e-8,-0.002402558217007106,-2.5020003017226545e-5,-1.7146589882925253e-8,-0.002402152743739069,-2.4908815008776256e-5,-1.7018183343380784e-8,-0.0024018177616850914,-2.4779340864272868e-5,-1.686693112266686e-8,-0.0024015512294922256,-2.4661265859267777e-5,-1.672851429567895e-8,-0.0024013415089134365,-2.4580601237402673e-5,-1.6634308307010567e-8,-0.0024011692853140917,-2.4557354638250633e-5,-1.660856911234815e-8,-0.0024010094083213077,-2.460379520847823e-5,-1.666634004388421e-8,-0.002400832781870665,-2.472274606391698e-5,-1.681138635859172e-8,-0.0024006088674261195,-2.490565851910724e-5,-1.7033840158805374e-8,-0.0024003096414815053,-2.513083477542098e-5,-1.7307985763326293e-8,-0.002399915678730765,-2.5363106308028472e-5,-1.759177707540246e-8,-0.0023994239684226163,-2.5557205638682287e-5,-1.7830822072448312e-8,-0.0023988549431304905,-2.566700881355288e-5,-1.7969488578482e-8,-0.0023982538707374547,-2.5660422954022525e-5,-1.7968844164137065e-8,-0.002397681821948537,-2.553480284678542e-5,-1.7825226886235993e-8,-0.0023971964165357008,-2.53237668313255e-5,-1.7578462540315414e-8,-0.002396830441918346,-2.50885777844268e-5,-1.7301586465142487e-8,-0.0023965800106651434,-2.4896546614298096e-5,-1.7075078798371497e-8,-0.0023964084361551537,-2.4797687943490375e-5,-1.695902560230991e-8,-0.002396262002993096,-2.481096708533641e-5,-1.6976666372280337e-8,-0.0023960882393536166,-2.4923817586803518e-5,-1.7113670694608337e-8,-0.002395849219877066,-2.5101106375207836e-5,-1.732863106912266e-8,-0.002395527525579831,-2.5297461255455714e-5,-1.756761197379987e-8,-0.0023951260596151974,-2.546854998291281e-5,-1.7777564319951067e-8,-0.0023946640036132836,-2.5579325396643004e-5,-1.7916241394922998e-8,-0.0023941708783994835,-2.5608875350224024e-5,-1.7958135357141878e-8,-0.0023936800199459637,-2.5552141704174967e-5,-1.7896681829365477e-8,-0.00239322243029576,-2.5418865388500117e-5,-1.774311016303839e-8,-0.0023928218677541743,-2.5230314934074022e-5,-1.7522587181791123e-8,-0.0023924917832175113,-2.5014690159013176e-5,-1.7268730448048223e-8,-0.0023922342643846748,-2.480218762163173e-5,-1.7017686942652696e-8,-0.0023920407464684762,-2.4620565317509125e-5,-1.6802798466007283e-8,-0.0023918939307276768,-2.4491771693316273e-5,-1.6650542584010726e-8,-0.0023917702332855676,-2.442975015807349e-5,-1.6577888357278284e-8,-0.002391642329452238,-2.443909807420655e-5,-1.6590679729922046e-8,-0.002391481763245852,-2.4514179502452957e-5,-1.6682551340715887e-8,-0.0023912619080620466,-2.4638499724969643e-5,-1.6834129065335303e-8,-0.002390961805205984,-2.478455800610903e-5,-1.701276797456279e-8,-0.00239057134744484,-2.4915132198915024e-5,-1.717399678816932e-8,-0.0023900974268101054,-2.4987729973603072e-5,-1.7266795508165544e-8,-0.0023895689055318833,-2.496391501976109e-5,-1.7244787681999786e-8,-0.002389036165074365,-2.4823284691699932e-5,-1.7083063873624844e-8,-0.002388560578292379,-2.4577378315217863e-5,-1.6794918110509053e-8,-0.0023881937570601162,-2.4274142413621198e-5,-1.643724545979219e-8,-0.0023879553394346147,-2.3985163329236852e-5,-1.6095335313882396e-8,-0.002387823242597225,-2.3778727505381422e-5,-1.5850778179207802e-8,-0.002387743703083488,-2.3693514905278695e-5,-1.575012576846581e-8,-0.002387654469699301,-2.3727803248252375e-5,-1.57919573836453e-8,-0.0023875068224310926,-2.384701163322787e-5,-1.5935693828749185e-8,-0.0023872766838733636,-2.4000872036063545e-5,-1.6121849968027748e-8,-0.0023869645383715133,-2.4139837531397063e-5,-1.6291451853276617e-8,-0.0023865890688437295,-2.4225578577636494e-5,-1.6398545934918142e-8,-0.002386179207668243,-2.4235415814278647e-5,-1.641560182566368e-8,-0.0023857671367677994,-2.4162608465253676e-5,-1.633403013000638e-8,-0.00238538293231372,-2.4014446579879058e-5,-1.6162059832962554e-8,-0.002385050648932289,-2.3809267842749758e-5,-1.5921265822080736e-8,-0.0023847856192039767,-2.357281279621325e-5,-1.564223465313254e-8,-0.002384592973846085,-2.333418942320294e-5,-1.5359717819261274e-8,-0.0023844674152753756,-2.3121781930974167e-5,-1.5107704928910368e-8,-0.0023843942234786524,-2.2959461734624766e-5,-1.491486592392592e-8,-0.002384351361188566,-2.2863520256191973e-5,-1.4800873864748202e-8,-0.0023843123252193354,-2.28406536006252e-5,-1.4773996666932113e-8,-0.0023842493365599203,-2.2887020091128393e-5,-1.4829969279080835e-8,-0.0023841366567967904,-2.2988230871289267e-5,-1.4951960812478233e-8,-0.0023839539952364617,-2.312021069380629e-5,-1.5111546301631272e-8,-0.00238369008534005,-2.3251022890859802e-5,-1.527079819049034e-8,-0.0023833464925758774,-2.3344139544444378e-5,-1.5386101234343148e-8,-0.002382941139623567,-2.336411463944466e-5,-1.5414884137776942e-8,-0.002382509826925251,-2.328539769468119e-5,-1.532618136616557e-8,-0.0023821027927208825,-2.3103440347943915e-5,-1.5114003628255345e-8,-0.002381773349088804,-2.284408291453904e-5,-1.4808671898883374e-8,-0.0023815590512039917,-2.2563826220574735e-5,-1.4477243667166011e-8,-0.002381463086871345,-2.233471929550198e-5,-1.4205559558666824e-8,-0.0023814485095478804,-2.221697578834785e-5,-1.4065641166745777e-8,-0.002381452228381859,-2.2233998994991225e-5,-1.4085907881538568e-8,-0.002381411455037569,-2.2365307161191684e-5,-1.424262147988882e-8,-0.0023812864408547367,-2.2559894107652725e-5,-1.447559680357265e-8,-0.002381068549780454,-2.2758766135733266e-5,-1.4714854003566721e-8,-0.0023807747559344136,-2.291337561706086e-5,-1.4902487127724783e-8,-0.002380436370789755,-2.2994297064707167e-5,-1.5003052078078702e-8,-0.0023800885646524635,-2.299177707261808e-5,-1.5004382649226507e-8,-0.00237976327801646,-2.291211671228343e-5,-1.4913466509235396e-8,-0.0023794853741548514,-2.277298527889861e-5,-1.4750994633350504e-8,-0.0023792708581126575,-2.2599122259547465e-5,-1.4546281765613793e-8,-0.0023791261518308006,-2.241861685502684e-5,-1.4332799297124966e-8,-0.002379048025038435,-2.2259517123002332e-5,-1.4144070736454437e-8,-0.002379024159088545,-2.214660348294054e-5,-1.4009774292460906e-8,-0.0023790344674725033,-2.209831973031592e-5,-1.395206580492697e-8,-0.0023790533562057336,-2.2124111902023713e-5,-1.3982415286808531e-8,-0.002379052917494198,-2.222265873839312e-5,-1.4099513692685225e-8,-0.0023790067355613062,-2.238139064397462e-5,-1.428869841454831e-8,-0.002378893869389061,-2.257747476862916e-5,-1.4523091866730754e-8,-0.002378702581053121,-2.2780337278386994e-5,-1.476653436627111e-8,-0.002378433361551305,-2.2955662245878917e-5,-1.4978254730954575e-8,-0.002378100828725866,-2.3070719458652143e-5,-1.511914018072533e-8,-0.0023777339193535064,-2.310095367991105e-5,-1.515956714522654e-8,-0.0023773732909614727,-2.303748192499462e-5,-1.5088399696609955e-8,-0.0023770645160716658,-2.2893966475516838e-5,-1.492131520640025e-8,-0.002376846389675512,-2.2709585344523315e-5,-1.4704506770614907e-8,-0.0023767362857042957,-2.2543662682762967e-5,-1.4508420483594385e-8,-0.0023767187552697256,-2.2459283627088534e-5,-1.4408307234147157e-8,-0.0023767459611238515,-2.2499820209175073e-5,-1.445625065299755e-8,-0.0023767538670920077,-2.2670163085399482e-5,-1.4658709621930782e-8,-0.0023766872411040843,-2.2934727415897178e-5,-1.4973964372283597e-8,-0.0023765193201164465,-2.323369224805631e-5,-1.5331258141108677e-8,-0.0023762563410213845,-2.350669143427009e-5,-1.5658866089500266e-8,-0.002375928430938125,-2.371079089789632e-5,-1.5905466616878e-8,-0.0023755754730009244,-2.382701217823089e-5,-1.6047996748580552e-8,-0.0023752354105984904,-2.3857755177899014e-5,-1.6088754695381856e-8,-0.002374937643938984,-2.3820288416794153e-5,-1.6047823960984603e-8,-0.002374700710601401,-2.3740166302795695e-5,-1.5955340321399732e-8,-0.0023745323579410426,-2.364615831678585e-5,-1.584546360315411e-8,-0.002374430478790293,-2.356666639934087e-5,-1.575205426032653e-8,-0.002374384221762089,-2.352701024171114e-5,-1.57053729084508e-8,-0.0023743752258978223,-2.3547031862098734e-5,-1.572919102890182e-8,-0.0023743792463522813,-2.3638741087943782e-5,-1.5837991897107692e-8,-0.002374368580960303,-2.380412406762251e-5,-1.60343866710735e-8,-0.002374315566041234,-2.403369636554169e-5,-1.6307405665562255e-8,-0.0023741969508027684,-2.4306554286211768E-05,-1.663253558578559e-8,-0.0023739984897390765,-2.4592488041431972e-5,-1.6974166769903272e-8,-0.0023737187937815855,-2.485635257581502e-5,-1.729069822860392e-8,-0.0023733713634909127,-2.506433547134887e-5,-1.75419012861819e-8,-0.002372983923689407,-2.5191127286277645e-5,-1.769739737193478e-8,-0.002372594652471399,-2.5226659292504724e-5,-1.774469317666995e-8,-0.0023722453489884105,-2.518097690876975e-5,-1.7695084665231785e-8,-0.0023719720500917853,-2.508558541252764e-5,-1.758542950683843e-8,-0.0023717945137316262,-2.4989429346639012e-5,-1.7473550411127092e-8,-0.002371707467356645,-2.494832237534192e-5,-1.7425795584798645e-8,-0.002371677894372136,-2.5008867215187453e-5,-1.7497939205762146e-8,-0.0023716521953735695,-2.519167607485704e-5,-1.7715125311405072e-8,-0.002371573067713854,-2.548183725590846e-5,-1.8060341886620035e-8,-0.0023713996123746663,-2.5833052724984733e-5,-1.8479137373701417e-8,-0.002371120733790304,-2.6184543627960917e-5,-1.8899572452170946e-8,-0.002370755545988175,-2.6481976563885553e-5,-1.925703522704526e-8,-0.0023703426289241364,-2.6692240399045317e-5,-1.951183288718046e-8,-0.002369925545652223,-2.6807480392539526e-5,-1.9654094044252732e-8,-0.0023695414256623836,-2.6840554567015164e-5,-1.969852847864199e-8,-0.0023692152111846727,-2.681698378371743e-5,-1.9675010651785046e-8,-0.0023689586030738027,-2.676742403134865e-5,-1.961971546979294e-8,-0.002368771517557994,-2.672230169153053e-5,-1.9568738474777108e-8,-0.0023686442754798733,-2.6708491821190418e-5,-1.9554090992955217e-8,-0.0023685596467347297,-2.6747237733667733e-5,-1.960116950419851e-8,-0.0023684946354959537,-2.68525198499682e-5,-1.97267938434712e-8,-0.002368422377939945,-2.7029396546161804e-5,-1.9937245693158044e-8,-0.002368314731930507,-2.7272358283705946e-5,-2.0226327583010683e-8,-0.002368145999280894,-2.7564325967266348e-5,-2.0574158419038293e-8,-0.0023678977178564387,-2.7877297359742607e-5,-2.0947880438817348e-8,-0.002367563716932125,-2.8175607003251493e-5,-2.13054362009557e-8,-0.0023671538835179904,-2.842219417818171e-5,-2.1602912348808545e-8,-0.0023666947656918185,-2.8587099112517685e-5,-2.1804557557978034e-8,-0.002366225711058261,-2.865603679897383e-5,-2.1892948933762033e-8,-0.0023657906850576426,-2.8636207775475263e-5,-2.1875955583981355e-8,-0.0023654275601418958,-2.855700316341736e-5,-2.178772414823076e-8,-0.0023651577407058874,-2.8464659629023123e-5,-2.168254086275059e-8,-0.002364979157822262,-2.8411626526095733e-5,-2.162241058543541e-8,-0.0023648650418965824,-2.8442979454826838e-5,-2.166103733977592e-8,-0.0023647696710966484,-2.858341235909699e-5,-2.182833892955203e-8,-0.0023646404647817425,-2.8828964162584613e-5,-2.2120438590644107e-8,-0.002364433315624853,-2.9147094222646294e-5,-2.2499504905555506e-8,-0.0023641258489594833,-2.9486173871872614e-5,-2.2904806040155516e-8,-0.0023637232753826293,-2.979130710829397e-5,-2.3271375506734424e-8,-0.0023632546433513643,-3.0020135017275484e-5,-2.3548762139194928e-8,-0.002362761919778162,-3.0152532930312014e-5,-2.371261331000258e-8,-0.002362287259213515,-3.019176737033716e-5,-2.3766181246292998e-8,-0.002361863354709199,-3.015895406508579e-5,-2.3733906423839642e-8,-0.0023615089325091636,-3.0084812691876054e-5,-2.3651770841389847e-8,-0.00236122863993826,-3.0002168291456246e-5,-2.355846990290136e-8,-0.002361015342081342,-2.9940748794497447e-5,-2.3489231721847384e-8,-0.002360853090462664,-2.99242064708113e-5,-2.347223119682423e-8,-0.0023607198261957722,-2.9968579872684983e-5,-2.352671480071416e-8,-0.0023605896206938806,-3.008134175253829e-5,-2.3661849584525067e-8,-0.002360434817332799,-3.0260449420114613e-5,-2.3875596082544623e-8,-0.002360228724551759,-3.049336232044938e-5,-2.4153533560309604e-8,-0.002359949398259028,-3.0756647438100245e-5,-2.4468344706144205e-8,-0.0023595845450922696,-3.1017291850921676e-5,-2.4781284325725616e-8,-0.0023591366902662777,-3.1236974924948935e-5,-2.5047141991886597e-8,-0.0023586265980894577,-3.1379935910133564e-5,-2.5223485405296768e-8,-0.0023580922330621156,-3.1423318194842274e-5,-2.5282880705071384e-8,-0.002357581446433621,-3.136654245445751e-5,-2.5224014627911062e-8,-0.0023571393504713037,-3.123511772789739e-5,-2.507629936540768e-8,-0.0023567945569627356,-3.107585378526121e-5,-2.4894381030997065e-8,-0.002356549808293787,-3.094425143746427e-5,-2.474345004782824e-8,-0.0023563808398743354,-3.088856588907149e-5,-2.468058353057825e-8,-0.002356243673347264,-3.093631165990455e-5,-2.473883210055294e-8,-0.0023560873309623623,-3.108742146766624e-5,-2.491898425872327e-8,-0.002355867681615853,-3.131543790559243e-5,-2.5190695953120915e-8,-0.0023555585115042363,-3.157564626292947e-5,-2.5501820575724358e-8,-0.0023551570793018816,-3.1817414987353845e-5,-2.5792819079502532e-8,-0.0023546830395721335,-3.199708556138092e-5,-2.601196397786125e-8,-0.0023541715928763573,-3.2087761735616844e-5,-2.612699814404651e-8,-0.0023536634728575476,-3.208356074308803e-5,-2.6130313106072467e-8,-0.002353195112875602,-3.199796079202877e-5,-2.6037164980856268e-8,-0.0023527917127598285,-3.185788963483199e-5,-2.5878832104811108e-8,-0.0023524643421163408,-3.1696231806253835e-5,-2.569384848742031e-8,-0.002352210558042157,-3.15451429795799e-5,-2.5520122001298037e-8,-0.002352017095867703,-3.1431404225224024e-5,-2.5389404645823923e-8,-0.0023518632011028735,-3.137387309610943e-5,-2.532421829510982e-8,-0.0023517237164243985,-3.138241693585632e-5,-2.5336544634470662e-8,-0.0023515716747720653,-3.1457557889187125e-5,-2.542738407693742e-8,-0.002351380666688492,-3.159026777706401e-5,-2.5586503563180176e-8,-0.002351127544409854,-3.1761819323126654e-5,-2.5792232842799336e-8,-0.002350795997438297,-3.194420346482523e-5,-2.601189004377488e-8,-0.00235038109753939,-3.210218902073709e-5,-2.620411988036901e-8,-0.0023498939766626002,-3.2198362784118887e-5,-2.6324761207664516e-8,-0.002349364441336059,-3.2201906185988056e-5,-2.6337171516754927e-8,-0.002348838300113838,-3.2099820884316304e-5,-2.622549250364978e-8,-0.002348367104865175,-3.1906193387378433E-05,-2.6005638953133388e-8,-0.002347991928908947,-3.16632964565759e-5,-2.572670334096174e-8,-0.0023477278385863123,-3.1430895046698076e-5,-2.5458524871709287e-8,-0.0023475573302447783,-3.1266834683295797e-5,-2.526903432937616e-8,-0.0023474365947856223,-3.1207840834265524e-5,-2.5201788974958383e-8,-0.0023473111312674834,-3.125926073193481e-5,-2.5263855985966862e-8,-0.0023471329217680113,-3.139668630853095e-5,-2.5427484190962568e-8,-0.0023468725828316842,-3.157629805487812e-5,-2.564195034641037e-8,-0.00234652400711633,-3.174838223286182e-5,-2.5849203831761563e-8,-0.0023461023891960834,-3.1869477830964374e-5,-2.5998061315297644e-8,-0.0023456379459007243,-3.191071358278629e-5,-2.6054089874945166e-8,-0.002345167714297938,-3.1861618822297345e-5,-2.6004274687434745e-8,-0.0023447273964050676,-3.1729710102991125e-5,-2.5856743363241975e-8,-0.0023443447623778383,-3.15367263237694e-5,-2.5636504725218675e-8,-0.002344035611415732,-3.1312828941514695e-5,-2.5378716588854288e-8,-0.0023438025868741026,-3.1090321324122036e-5,-2.5121307043493483e-8,-0.002343636419494298,-3.0898215687290654e-5,-2.4898533605619872e-8,-0.0023435187346924568,-3.075840762917019e-5,-2.473640851696107e-8,-0.002343425470101371,-3.06836209512552e-5,-2.4650217468068794e-8,-0.002343330156203922,-3.067678824239108e-5,-2.46437581014699e-8,-0.0023432067557343844,-3.0731268964403044e-5,-2.4709591242115973e-8,-0.002343032205144756,-3.083142896996042e-5,-2.482971769728214e-8,-0.0023427890317182145,-3.09534849684997e-5,-2.4976536733214626e-8,-0.002342468429998982,-3.1066960867543575e-5,-2.5114480866863458e-8,-0.0023420738829506476,-3.113759753821509e-5,-2.520334251191813e-8,-0.0023416245655075696,-3.113286617338482e-5,-2.5204692814982757e-8,-0.002341156456037676,-3.1030702451985074e-5,-2.5092155875587517e-8,-0.0023407180452088712,-3.083007768640861e-5,-2.4863906224778936e-8,-0.0023403583393829482,-3.055874873840108e-5,-2.4551880478986413e-8,-0.002340109110049135,-3.027131810595971e-5,-2.421961909495806e-8,-0.0023399695530012623,-3.0033690127916367e-5,-2.394416454197952e-8,-0.0023399035996637175,-2.9898874983898596e-5,-2.378781857784365e-8,-0.0023398534173924984,-2.9886919236503446e-5,-2.3774659522504135e-8,-0.002339761711113448,-2.9979953784273124e-5,-2.388461211409085e-8,-0.0023395905205925225,-3.0132912884441697e-5,-2.4065731184666787e-8,-0.002339328969507674,-3.0291463113513845e-5,-2.4254908440399182e-8,-0.0023389905263682936,-3.0407909014329455e-5,-2.439632805788379e-8,-0.002338604647812188,-3.0450610353352113e-5,-2.4452510933726005e-8,-0.002338207386718835,-3.0406942615971795e-5,-2.4407957962391716e-8,-0.002337833512955816,-3.0281802581374335e-5,-2.4267646192649814e-8,-0.002337510916804099,-3.009374007485284e-5,-2.405271127085375e-8,-0.00233725717872705,-2.9870050109659613e-5,-2.379481298482102e-8,-0.0023370780896862574,-2.96415499392353e-5,-2.3530020163429226e-8,-0.0023369679571642664,-2.943765111817507e-5,-2.3292964938693384e-8,-0.002336911380731853,-2.928228272071026e-5,-2.311196745938867e-8,-0.0023368860519105425,-2.9191004014698512e-5,-2.3005572673000774e-8,-0.0023368660995786595,-2.9169474421886248e-5,-2.2980719814710166e-8,-0.002336825467155114,-2.921325593941368e-5,-2.3032512896595408e-8,-0.0023367409423963475,-2.9308629309781252e-5,-2.3145193486284356e-8,-0.002336594789812839,-2.94340434461076e-5,-2.329383537317645e-8,-0.002336377141683103,-2.9562078747041886e-5,-2.3446595994696407e-8,-0.0023360882937399465,-2.9662099579462933e-5,-2.3567732219797592e-8,-0.0023357408585416017,-2.9704065354320472e-5,-2.36219691020052e-8,-0.0023353611169372288,-2.9664178807460198e-5,-2.3581074777115405e-8,-0.002334987901996926,-2.953256184083392e-5,-2.3432902238347995e-8,-0.002334666656879615,-2.9321444023828176e-5,-2.3191111499019182e-8,-0.002334437144125591,-2.906967526378198e-5,-2.2900614292587276e-8,-0.0023343170286952335,-2.8837540628692366e-5,-2.263164135915559e-8,-0.002334289377364724,-2.868863915936848e-5,-2.245863079739621e-8,-0.0023343042731189534,-2.8664576401788524e-5,-2.243065985991554e-8,-0.002334297427240077,-2.8766728884431434e-5,-2.2550060161150142e-8,-0.00233421602436304,-2.8956937999179782e-5,-2.277304822604038e-8,-0.0023340366493231914,-2.9175695277364925e-5,-2.3030723691705274e-8,-0.0023337675567428337,-2.9365148437702835e-5,-2.325572494540632e-8,-0.002333439019167699,-2.948499872544599e-5,-2.3400714149062195e-8,-0.002333090235900311,-2.9517803647735512e-5,-2.3444668908795366e-8,-0.002332758701346869,-2.9466638538369463e-5,-2.3390385484474364e-8,-0.0023324738052357035,-2.934937562502968e-5,-2.3258055105401835e-8,-0.0023322540424882687,-2.919255582833955e-5,-2.3078281732160556e-8,-0.0023321064600515273,-2.902614663617285e-5,-2.2885999487207492e-8,-0.002332027286009202,-2.8879263050207602e-5,-2.271540058262342e-8,-0.0023320033619865835,-2.877662704188809e-5,-2.259567613496163e-8,-0.002332014289946477,-2.873576097567269e-5,-2.2547631244607782e-8,-0.002332035177135321,-2.8765014379972653e-5,-2.2581326280258576e-8,-0.0023320398449503863,-2.8862571973660708e-5,-2.2694919143851268e-8,-0.0023320042471653172,-2.9016654866027363e-5,-2.287492871831799e-8,-0.0023319096779583115,-2.9206946607571382e-5,-2.3097917898279694e-8,-0.002331745434296553,-2.940702053860624e-5,-2.333330260051453e-8,-0.0023315107913132412,-2.9587554741398894e-5,-2.354703004535643e-8,-0.002331216183994399,-2.9720241445388588e-5,-2.370604059396504e-8,-0.0023308833968589734,-2.9782371874826208e-5,-2.378354402409868e-8,-0.0023305442821816677,-2.976211745161164e-5,-2.376519028712881e-8,-0.002330237019842478,-2.9664138028036154e-5,-2.3655730605611676e-8,-0.002329998741183291,-2.9513937315933643e-5,-2.3484296706424633e-8,-0.0023298543227104943,-2.935776247905231e-5,-2.3304483190610554e-8,-0.0023298039688696283,-2.9254146272590037e-5,-2.3184600111912306e-8,-0.0023298161627486316,-2.9255771124284795e-5,-2.3186513526067538e-8,-0.002329833717182933,-2.9387407680729007e-5,-2.3339799540173714e-8,-0.00232979429485865,-2.963251445919433e-5,-2.3625939095795707e-8,-0.0023296555485235837,-2.993876684354111e-5,-2.3984573422930422e-8,-0.002329410031430962,-3.0240089226068864e-5,-2.433902191722381e-8,-0.002329082684861528,-3.048133910260082e-5,-2.4624941076546366e-8,-0.002328716252266335,-3.063272313348873e-5,-2.4807118980201846e-8,-0.0023283552432151315,-3.0691090518933916e-5,-2.4881121231374615e-8,-0.002328035235814446,-3.067316204035687e-5,-2.486564617259907e-8,-0.002327778453652459,-3.060672619689269e-5,-2.4792504271784795e-8,-0.0023275936390781573,-3.052324005011218e-5,-2.4698123022970693e-8,-0.002327477917828302,-3.0452785078251434e-5,-2.461765146651857e-8,-0.002327419112590265,-3.0420884134364204E-05,-2.458113394257909e-8,-0.0023273980040969685,-3.0446326357327403e-5,-2.4610839446448034e-8,-0.002327390669521878,-3.0539531096370326e-5,-2.4719266183936192e-8,-0.0023273711094918687,-3.070139397965835e-5,-2.4907774784639605e-8,-0.002327314298389271,-3.0922803788878494e-5,-2.5166047977091938e-8,-0.002327199604182002,-3.118523180180453e-5,-2.5472802828543438e-8,-0.0023270141555905726,-3.146275582275373e-5,-2.579813850369303e-8,-0.002326755507257778,-3.1725524753218145e-5,-2.6107509797618743e-8,-0.002326433025242352,-3.194433915074523e-5,-2.636696380227279e-8,-0.00232606757107646,-3.2095816875852493E-05,-2.6549064620552972e-8,-0.0023256892347763903,-3.216744119251998e-5,-2.663874128588696e-8,-0.0023253330548705857,-3.216173673953351e-5,-2.6638224765391106e-8,-0.002325032753407156,-3.209873777588853e-5,-2.6570101510359574e-8,-0.0023248127299698297,-3.201549252585091e-5,-2.6476970450584947e-8,-0.002324679419257254,-3.1960909325668365e-5,-2.641563798078472e-8,-0.002324614738368727,-3.198471760129885e-5,-2.6444333423830437e-8,-0.0023245759518624605,-3.2121629871326e-5,-2.6604171937243653e-8,-0.002324505785473568,-3.237602913514e-5,-2.6901108196581215e-8,-0.0023243518127423596,-3.271591879496891e-5,-2.7298653087985366e-8,-0.00232408675837698,-3.308237216229446e-5,-2.772870037338478e-8,-0.0023237183421038277,-3.341134600686158e-5,-2.8116827565107905e-8,-0.0023232834120907914,-3.365603424276712e-5,-2.8408283829963784e-8,-0.0023228315250686865,-3.379852594585868e-5,-2.8581601521190148e-8,-0.0023224081917482394,-3.384823308876176e-5,-2.8646918820079517e-8,-0.0023220447513682056,-3.3832392487888304e-5,-2.8635163154902712e-8,-0.0023217556857669294,-3.378539642682306e-5,-2.8585851446400122e-8,-0.0023215406467797794,-3.374081042009061e-5,-2.8537897313167375e-8,-0.002321388188291431,-3.3726795999537757e-5,-2.8524238705810844e-8,-0.002321279357326137,-3.376398701175925e-5,-2.8569237172436706e-8,-0.002321190580067218,-3.3864561252015965e-5,-2.8687469509032147e-8,-0.0023210960815719848,-3.403170234189584e-5,-2.8883032294239802e-8,-0.0023209703112198727,-3.425921865422195e-5,-2.9149091545929388e-8,-0.0023207907692627456,-3.453153525414017e-5,-2.9467892708359517e-8,-0.002320541348280485,-3.4824632907782434e-5,-2.9811852888919886e-8,-0.002320215787982576,-3.510859047522046e-5,-3.014647119465895e-8,-0.002319820326628823,-3.5352020534393274e-5,-3.0435397604764066e-8,-0.002319374429235887,-3.5528027890910064e-5,-3.064726176518535e-8,-0.0023189086929537852,-3.562058707993201e-5,-3.0763027321289934e-8,-0.0023184596969337903,-3.562967431567573e-5,-3.078198150000386e-8,-0.0023180625159862473,-3.557348082881343e-5,-3.072444153370548e-8,-0.0023177424037032486,-3.548664144440317e-5,-3.062992075551395e-8,-0.0023175074984734543,-3.5414226963611394e-5,-3.0550393228261676e-8,-0.0023173444808164832,-3.5402047537825155e-5,-3.053919267474974e-8,-0.002317219043515323,-3.548478675955916e-5,-3.063722510387765e-8,-0.0023170825452282313,-3.567474791693208e-5,-3.085971138660794e-8,-0.0023168847150472982,-3.595522696647335e-5,-3.118819869005432e-8,-0.0023165894160324624,-3.628263070896687e-5,-3.157275232013399e-8,-0.0023161874027681608,-3.659879209134966e-5,-3.194610912976707e-8,-0.002315699674318987,-3.6849589557777495e-5,-3.224527727736699e-8,-0.002315169322935829,-3.7001624225642415e-5,-3.2430960432418255e-8,-0.002314646199700832,-3.704960690848625e-5,-3.249625130896201e-8,-0.0023141720768090047,-3.701289220350198e-5,-3.246278529929417e-8,-0.0023137719944856,-3.692533958583261e-5,-3.2369181497699095e-8,-0.002313452787336121,-3.682436937453514e-5,-3.225850415814049e-8,-0.002313206349815514,-3.674303927821273e-5,-3.216911319350878e-8,-0.002313014513893187,-3.6705975238209506e-5,-3.21298653443614e-8,-0.002312853494672486,-3.6728114464930174e-5,-3.215852030546475e-8,-0.0023126972338266515,-3.681481612065799e-5,-3.226175333094992e-8,-0.0023125198655322456,-3.696232465768661e-5,-3.24356389814037e-8,-0.002312297893017724,-3.7158178604489365e-5,-3.266612338087536e-8,-0.0023120126639769563,-3.7381726521067834e-5,-3.292962936131338e-8,-0.002311653424383115,-3.760539504033395e-5,-3.319450237088803e-8,-0.0023112206387045776,-3.7797568417562995e-5,-3.3424282093674193e-8,-0.002310728536788081,-3.7927679776685745e-5,-3.3583518129125895e-8,-0.0023102052694704335,-3.7973269632081315e-5,-3.3645883688399196e-8,-0.002309689114953737,-3.792741024238655e-5,-3.3602769741033175e-8,-0.002309220367796046,-3.780365018678395e-5,-3.34690861984953e-8,-0.0023088306454635615,-3.763560952953059e-5,-3.328295822689161e-8,-0.0023085331437765486,-3.7470095324169245e-5,-3.30979876994702e-8,-0.0023083175552887736,-3.7355299923970754e-5,-3.296981668241202e-8,-0.0023081517291295645,-3.732774019023125e-5,-3.2941121239366296e-8,-0.0023079897002703125,-3.740204716129852e-5,-3.302971182509186e-8,-0.0023077837234663535,-3.7566599907923365e-5,-3.322321468544985e-8,-0.0023074969972720206,-3.778618699150824e-5,-3.348181192736664e-8,-0.002307113642460123,-3.801111136025596e-5,-3.374850764245679e-8,-0.002306642967714749,-3.819047303514916e-5,-3.3964389987148476e-8,-0.0023061164179579287,-3.8285780849737995e-5,-3.40844388236443e-8,-0.0023055780533455137,-3.828042081343265e-5,-3.408864550347391e-8,-0.0023050720265702773,-3.818189606197478e-5,-3.3984813393723e-8,-0.0023046316398957264,-3.801683262139339e-5,-3.3802987367837267e-8,-0.00230427334288954,-3.7821682524135505e-5,-3.358486019035794e-8,-0.0023039963644423222,-3.7633111972824855e-5,-3.337272686138091e-8,-0.002303786336992908,-3.748100255910153e-5,-3.320135317605305e-8,-0.0023036204437704402,-3.738497046118624e-5,-3.3093833427999516e-8,-0.002303472191629436,-3.735370107695463e-5,-3.306068870435814e-8,-0.002303315004370737,-3.738581151208172e-5,-3.310077586295026e-8,-0.0023031247168510474,-3.7471158388023855e-5,-3.32027746012847e-8,-0.002302881512812013,-3.759204402485969e-5,-3.334659244660564e-8,-0.002302571933303701,-3.772437161974421e-5,-3.3504698526810776e-8,-0.0023021913377570913,-3.7839318120416736e-5,-3.364401288936653e-8,-0.0023017466592312736,-3.790639624397905e-5,-3.3729365113627754e-8,-0.002301258499438132,-3.789868982799408e-5,-3.3729469251606456e-8,-0.0023007607416336475,-3.780025860121621e-5,-3.362545368835861e-8,-0.0023002955727393715,-3.761398422436507e-5,-3.341996763976326e-8,-0.002299903135206751,-3.7366095073082776e-5,-3.314251715734096e-8,-0.002299608241321281,-3.7103131944292765e-5,-3.284613208267745e-8,-0.002299409859179875,-3.687991824381861e-5,-3.259369265324991e-8,-0.002299279285932504,-3.674229260682073e-5,-3.243819215569253e-8,-0.002299168823546775,-3.6712133551511284e-5,-3.240551750739637e-8,-0.002299027108588892,-3.678121604662647e-5,-3.248721326687466e-8,-0.0022988143521173038,-3.6915489318077446e-5,-3.2645093229978927e-8,-0.0022985121434507642,-3.706652291671608e-5,-3.282408232012828e-8,-0.0022981259731840605,-3.718510344513982e-5,-3.296765596479805e-8,-0.002297681444338649,-3.723291069296564e-5,-3.3031266622567177e-8,-0.0022972163826716816,-3.7189964304819385e-5,-3.299108395567988e-8,-0.002296771289655474,-3.705699893642229e-5,-3.284699771750507e-8,-0.0022963804162048507,-3.685301926143306e-5,-3.2620069474865724e-8,-0.0022960653412444033,-3.66092080660818e-5,-3.234570517089325e-8,-0.0022958321994601843,-3.6361104881873565e-5,-3.206471491834107e-8,-0.002295672602594345,-3.6141216362085723e-5,-3.181475278986125e-8,-0.002295567237924504,-3.5973699239903435e-5,-3.162406563040041e-8,-0.0022954906243840873,-3.5871742882865936e-5,-3.150833328403298e-8,-0.002295415668514197,-3.583734289021038e-5,-3.1470303577740756e-8,-0.002295317231199662,-3.5862619387422194e-5,-3.15012747362056e-8,-0.002295174587684972,-3.593175025312556e-5,-3.158334026307848e-8,-0.0022949731503511582,-3.6022919077861825e-5,-3.169165951737354e-8,-0.0022947059593891967,-3.6110200777476796e-5,-3.1796616976641045e-8,-0.0022943752972072132,-3.616576445549112e-5,-3.186629056886203e-8,-0.002293994395917849,-3.616308491839482e-5,-3.1870055583428156e-8,-0.0022935884913046806,-3.608188698839053e-5,-3.1784218012190775e-8,-0.002293193570220022,-3.591490428985524e-5,-3.159981966187581e-8,-0.002292850700555697,-3.567488665407547e-5,-3.1330816136700846e-8,-0.0022925949121289655,-3.539799888834784e-5,-3.101814903088958e-8,-0.002292441079759657,-3.5138654460845667e-5,-3.072396888884776e-8,-0.0022923737482313526,-3.495377210004042e-5,-3.051367324612897e-8,-0.0022923487357085484,-3.4881645478195986e-5,-3.043169702193616e-8,-0.0022923082878944408,-3.492651926994169e-5,-3.048374540670587e-8,-0.0022922023645509603,-3.5057777584302726e-5,-3.063565736187704e-8,-0.002292004823110608,-3.522321745129158e-5,-3.0828335408719365e-8,-0.002291718031987991,-3.536782916311345e-5,-3.099901295008251e-8,-0.0022913672330241424,-3.544908418763723e-5,-3.109866179650461e-8,-0.002290990059070643,-3.544468044302114e-5,-3.1100956371175926e-8,-0.0022906260283061795,-3.535334262818601e-5,-3.1003445892457103e-8,-0.0022903084934227853,-3.5191150650947184e-5,-3.082366001102285e-8,-0.002290059645962504,-3.4985740590012e-5,-3.059271116004469e-8,-0.002289888308889336,-3.476990829758171e-5,-3.034806608016834e-8,-0.002289790112933232,-3.457553303386381e-5,-3.0126527996035566e-8,-0.0022897496397346197,-3.442855427528838e-5,-2.995832382862933e-8,-0.002289743927638933,-3.434557978525591e-5,-2.986303752963534e-8,-0.002289746588173612,-3.433235628935457e-5,-2.984772570762622e-8,-0.002289731806192985,-3.438399705495003e-5,-2.9907130752155833e-8,-0.0022896776371395563,-3.448658144544781e-5,-3.0025539997263514e-8,-0.002289568333240068,-3.4619516180843974e-5,-3.0179546880832127e-8,-0.002289395830989697,-3.47581192864351e-5,-3.034104020878307e-8,-0.0022891606980330746,-3.487624615385044e-5,-3.048017863245395e-8,-0.0022888727561433233,-3.494909690242651e-5,-3.0568516096956604e-8,-0.0022885513883073552,-3.4956571873741554e-5,-3.058275352336701e-8,-0.002288225022291335,-3.4887629910986334e-5,-3.050971134872694e-8,-0.0022879285346280604,-3.474558680788467e-5,-3.0352495822772635e-8,-0.002287697014005668,-3.4552914595581084e-5,-3.013619110840197e-8,-0.002287555258528512,-3.4352264826514714e-5,-2.990924381258495e-8,-0.002287505296293813,-3.419939650252042e-5,-2.9735499630763315e-8,-0.0022875185392014596,-3.414608973943245e-5,-2.9674650423240414e-8,-0.002287540654767576,-3.421841512072958e-5,-2.975725826269698e-8,-0.0022875109191809696,-3.44028369555647e-5,-2.9968681291149824e-8,-0.0022873866431173677,-3.4650463730046105e-5,-3.025373403994287e-8,-0.002287158332342123,-3.489747604808045e-5,-3.05398504214709e-8,-0.0022868484445149025,-3.5088852879194874e-5,-3.076405861695239e-8,-0.0022864982748903593,-3.519317267669936e-5,-3.0889870385194194e-8,-0.002286152562989151,-3.520525313625685e-5,-3.091044534452543e-8,-0.002285848351995372,-3.514064936767193e-5,-3.084259232463975e-8,-0.0022856095545583004,-3.5027359972136336e-5,-3.071759518882632e-8,-0.0022854458582351883,-3.4898128170332654e-5,-3.057260162184731e-8,-0.00228535406658743,-3.4784542000901826e-5,-3.0443888195242704e-8,-0.0022853205545476122,-3.471284955278595e-5,-3.0361936066289834e-8,-0.0022853242782383083,-3.4701131164836125e-5,-3.034799776992067e-8,-0.0022853401172956323,-3.475768108400181e-5,-3.0412079618106474e-8,-0.0022853423369857883,-3.488055943683937e-5,-3.055234935450222e-8,-0.0022853079331452636,-3.505829657473036e-5,-3.075595068991225e-8,-0.002285219540357508,-3.5271714452898415e-5,-3.1001145596984345e-8,-0.0022850675526555806,-3.5496617417606936e-5,-3.12604400979373e-8,-0.0022848513167228906,-3.5706935033342264e-5,-3.150417106161792e-8,-0.0022845794630886704,-3.587803665272236e-5,-3.170422273669897e-8,-0.0022842694256383967,-3.599011192601114e-5,-3.183778648177624e-8,-0.00228394612191299,-3.6031573527607656e-5,-3.1891182357691236e-8,-0.002283639559272516,-3.6002497987339216e-5,-3.1863829412209876e-8,-0.0022833807000028155,-3.591781523569677e-5,-3.17720571397393e-8,-0.002283194835117489,-3.580895633737797e-5,-3.1651234007313374e-8,-0.0022830926687873554,-3.572151453512309e-5,-3.155331255203707e-8,-0.0022830615120185546,-3.57062013456485e-5,-3.1536574359696766e-8,-0.002283061910144253,-3.5802515052971905e-5,-3.1646865496677e-8,-0.0022830358716624693,-3.602024681505544e-5,-3.1896238479571526e-8,-0.002282927452508825,-3.6329876875859376e-5,-3.2251745516056244e-8,-0.0022827062816265977,-3.667107036558002e-5,-3.264498114105585e-8,-0.0022823796709535715,-3.697658131461953e-5,-3.299928501542816e-8,-0.0022819864232603475,-3.719735460090399e-5,-3.325834215160285e-8,-0.0022815785791103415,-3.731532145924846e-5,-3.340080377913226e-8,-0.0022812032084957965,-3.734128205682896e-5,-3.3438034270071183e-8,-0.002280891871937716,-3.7304369843453694e-5,-3.3402379181189025e-8,-0.00228065814223643,-3.724061603780327e-5,-3.333439792808469e-8,-0.0022805000038872204,-3.718451764462349e-5,-3.327337443004344e-8,-0.0022804039844390635,-3.7164175330215406e-5,-3.325171023981485e-8,-0.002280349211641098,-3.7198996010101034e-5,-3.3292116454290506e-8,-0.0022803108906574855,-3.729879835377055e-5,-3.3406389414515064e-8,-0.002280263357184188,-3.746369139111816e-5,-3.359514042205903e-8,-0.0022801829142725643,-3.76845561343038e-5,-3.3848312986735143e-8,-0.0022800505440541212,-3.794419075362827e-5,-3.4146529008746734e-8,-0.002279854394613768,-3.821932509749697e-5,-3.446344080378021e-8,-0.002279591667380771,-3.8483592197162534e-5,-3.4769134737453335e-8,-0.0022792694769532365,-3.8711202674219674e-5,-3.503427192200282e-8,-0.002278904453787725,-3.888090559245803e-5,-3.523451107453436e-8,-0.002278520994022731,-3.897981593858639e-5,-3.5354790439935546e-8,-0.0022781481387727765,-3.900661067575245e-5,-3.539296714173588e-8,-0.002277815196272408,-3.897358681368924e-5,-3.536228182941742e-8,-0.0022775462453310945,-3.8907078916294634e-5,-3.5292063500544346e-8,-0.0022773537578315915,-3.88453723888866e-5,-3.5225611058902015e-8,-0.0022772323066882973,-3.88328268780596e-5,-3.5213664861948535e-8,-0.002277154719218136,-3.89093864059176e-5,-3.5302432695555914e-8,-0.002277074301351357,-3.909671606337604e-5,-3.551757119061668e-8,-0.0022769361938568297,-3.93858582620144e-5,-3.584980135264396e-8,-0.0022766965332619883,-3.9734321357865546e-5,-3.625133407898208e-8,-0.002276341115211891,-4.007817531691193e-5,-3.664954907985626e-8,-0.0022758922917568173,-4.035551223226274e-5,-3.697373201351628e-8,-0.0022753992488523085,-4.0528709716748785e-5,-3.7180470529775404e-8,-0.0022749180581077707,-4.059371095721217e-5,-3.726429156698758e-8,-0.0022744933359550488,-4.057442247318822e-5,-3.7251455930854735e-8,-0.0022741491150162865,-4.0509294110553696e-5,-3.718495011122612e-8,-0.0022738888817427747,-4.043836498717976e-5,-3.7109976390399145e-8,-0.0022737006122365193,-4.0394935220934196e-5,-3.706454561541384e-8,-0.0022735628534328385,-4.0401953921682715e-5,-3.7075254422409025e-8,-0.0022734497848497666,-4.047142453162688e-5,-3.7156399239620105e-8,-0.0022733348583905645,-4.060512607912676e-5,-3.731060746631049e-8,-0.0022731934580261463,-4.0795705115488924e-5,-3.752998308750005e-8,-0.00227300512552994,-4.102789765037355e-5,-3.7797496246937914e-8,-0.0022727556876095496,-4.128004247365327e-5,-3.808875005360056e-8,-0.002272439315133133,-4.152626986166031e-5,-3.837450044928072e-8,-0.0022720601389120266,-4.173970137526162e-5,-3.862427282168575e-8,-0.0022716327599983676,-4.1896595491755895e-5,-3.8811002059216745e-8,-0.0022711810539608945,-4.1980908267824755e-5,-3.8916135263443654e-8,-0.00227073496835204,-4.1988409487146426e-5,-3.8934279948754235e-8,-0.002270325441507122,-4.192927899551331e-5,-3.8876227340469446e-8,-0.002269978122215947,-4.1828177158028644e-5,-3.8769219119330844e-8,-0.00226970702629286,-4.172123601459589e-5,-3.865378498185866e-8,-0.0022695094556672577,-4.1649926366732944e-5,-3.857700174244831e-8,-0.002269363629343624,-4.165219466353312e-5,-3.858250738357373e-8,-0.0022692306298698933,-4.175204263636338e-5,-3.869853604806306e-8,-0.0022690619905320303,-4.195007217268219e-5,-3.892687238355782e-8,-0.0022688127656313537,-4.22189359377569e-5,-3.923733305382498e-8,-0.0022684568851602466,-4.2507766167857475e-5,-3.9572560430991624e-8,-0.002267998326091102,-4.275672312180571e-5,-3.986449700076138e-8,-0.0022674714734245843,-4.291695195769548e-5,-4.005713795935709e-8,-0.0022669291597497737,-4.296662160132691e-5,-4.012487438155247e-8,-0.0022664242564903914,-4.2915295188340505e-5,-4.007760659904807e-8,-0.0022659940652150863,-4.279611123618072e-5,-3.995206908990567e-8,-0.002265653503930502,-4.265191244855833e-5,-3.979631362883339e-8,-0.0022653969340296893,-4.252261313043785e-5,-3.965552378432056e-8,-0.0022652046236925952,-4.243769493960012e-5,-3.95634861733223e-8,-0.002265049794477369,-4.241380155046763e-5,-3.9539697044729416e-8,-0.0022649041082798216,-4.245547864330964e-5,-3.9589986428501323e-8,-0.00226474124918325,-4.255711975844435e-5,-3.970856627954339e-8,-0.0022645391613217362,-4.270500455743162e-5,-3.988028806109427e-8,-0.0022642816799547678,-4.287910780361013e-5,-4.008272167427198e-8,-0.002263960087918555,-4.3054900809357125e-5,-4.028824466566982e-8,-0.002263574719130994,-4.320567695985923e-5,-4.0466687322319195e-8,-0.0022631362204558894,-4.330590165289405e-5,-4.058908270551296e-8,-0.0022626656639188536,-4.3335670173572484e-5,-4.063264302083518e-8,-0.0022621925719040524,-4.328569846595285e-5,-4.0586363627982455e-8,-0.0022617502460647106,-4.316153538197371e-5,-4.045582192050501e-8,-0.0022613686905826485,-4.298517863381172e-5,-4.02651379123331e-8,-0.002261066659628733,-4.279254577136207e-5,-4.0054328367112326e-8,-0.002260845254738966,-4.2626492298289355e-5,-3.9871642378719045e-8,-0.002260685452234943,-4.252671070386968e-5,-3.976228848354713e-8,-0.0022605509404802003,-4.251909481418603e-5,-3.9756384567982686e-8,-0.002260396131472639,-4.260760900980759e-5,-3.985954021720435e-8,-0.002260177694963087,-4.277131989594658e-5,-4.004914789052283e-8,-0.002259866766101412,-4.2968166060102e-5,-4.027830918497738e-8,-0.002259458210637815,-4.3145372744970057e-5,-4.048742944540769e-8,-0.0022589733613924707,-4.3254145791464096e-5,-4.062085419440258e-8,-0.002258454294531585,-4.326392054614321e-5,-4.064315339359069e-8,-0.0022579511436190353,-4.3170655978861896e-5,-4.0548734377790825e-8,-0.0022575073922757242,-4.2995916330466316e-5,-4.036104128218041e-8,-0.0022571489718927946,-4.2777865460527206e-5,-4.012258232791228e-8,-0.0022568805697357453,-4.255884861731508e-5,-3.988102778980891e-8,-0.0022566887016491335,-4.2374725671374876e-5,-3.967716426716014e-8,-0.002256548444902981,-4.2248875604791526e-5,-3.953799287615894e-8,-0.002256430457477919,-4.2190877177150564e-5,-3.9475031093020603e-8,-0.0022563063262742698,-4.219814048656945e-5,-3.9485967035225393e-8,-0.0022561518892659908,-4.225864272457631e-5,-3.9557654446514965e-8,-0.0022559490620141626,-4.235363463796422e-5,-3.9669178707093105e-8,-0.0022556869196150115,-4.245992921932744e-5,-3.9794503964805914e-8,-0.002255362650026142,-4.2551960746738174e-5,-3.990484416493067e-8,-0.00225498259128279,-4.260418776905965e-5,-3.9971363026047316e-8,-0.0022545629951551973,-4.259443556510106e-5,-3.996888136177645e-8,-0.002254129647814144,-4.2508371758274345e-5,-3.988086135327218e-8,-0.0022537151993712646,-4.234455193159232e-5,-3.970509132900266e-8,-0.00225335330209883,-4.2118407480589275e-5,-3.9458268320626675e-8,-0.0022530698916637996,-4.186263655252896e-5,-3.917660732834667e-8,-0.0022528740190121094,-4.162180095563857e-5,-3.8909958155369906e-8,-0.002252752217450626,-4.1441201489894646e-5,-3.870944411348118e-8,-0.0022526698614514173,-4.1353325375690816e-5,-3.861225482382609e-8,-0.0022525801000990234,-4.136713774543938e-5,-3.862947201208333e-8,-0.0022524373733573866,-4.146464933767827e-5,-3.8741929345072135e-8,-0.002252210525373519,-4.1605994325611274e-5,-3.89055852814104e-8,-0.0022518911377591767,-4.1740803405337114e-5,-3.906405012373955e-8,-0.0022514949999607,-4.182182996698903e-5,-3.9163825942864726e-8,-0.0022510569958787445,-4.181681135790668e-5,-3.916776403591502e-8,-0.002250621342141275,-4.171557236139564e-5,-3.906331946104076e-8,-0.0022502301294550285,-4.15308425955026e-5,-3.886378396708598e-8,-0.002249913449319389,-4.129306958437996e-5,-3.860271679338941e-8,-0.002249683726453224,-4.104130530740587e-5,-3.832383998911728e-8,-0.002249535283975047,-4.0813295369522146e-5,-3.8069884935159855e-8,-0.0022494483048860476,-4.0637702512655366e-5,-3.787370255806774e-8,-0.002249395075586441,-4.053008747505458e-5,-3.775352485809548e-8,-0.002249346228387429,-4.049258564563083e-5,-3.771239510768213e-8,-0.0022492755010270257,-4.0516052192387256e-5,-3.774046242612261e-8,-0.0022491626277783426,-4.058321264511812e-5,-3.7818520580070174e-8,-0.0022489947436900195,-4.0671780343274614e-5,-3.7921589641568395e-8,-0.002248766957445944,-4.075711343877572e-5,-3.8021986797907276e-8,-0.0022484826632076446,-4.081452585563666e-5,-3.8091951714669235e-8,-0.002248153838048646,-4.0821728247974105e-5,-3.8106341905870566e-8,-0.002247801079960905,-4.076195151424849e-5,-3.804605949402225e-8,-0.002247452593148405,-4.0628012018448585e-5,-3.790257146744856e-8,-0.0022471409301629466,-4.042682459236734e-5,-3.768302732502345e-8,-0.00224689646765886,-4.018263561138499e-5,-3.7414039313886286e-8,-0.0022467379334867687,-3.993603737751534e-5,-3.71407722402369e-8,-0.0022466629330224067,-3.973603731085064e-5,-3.6918205817805125e-8,-0.0022466437937668942,-3.962548372148706e-5,-3.679484541297912e-8,-0.0022466332626418345,-3.962510713746668e-5,-3.679475135912498e-8,-0.0022465795112438054,-3.972433968955547e-5,-3.690704831574807e-8,-0.002246443844399572,-3.988431149987231e-5,-3.7089012125681974e-8,-0.0022462127331009103,-4.005144641550452e-5,-3.728104124941213e-8,-0.002245899726127667,-4.017461828870116e-5,-3.742571513024981e-8,-0.0022455385610210964,-4.021870065905526e-5,-3.7482979092119534e-8,-0.002245171991501091,-4.017101257208119e-5,-3.743755699529912e-8,-0.0022448406857828573,-4.0040872064166135e-5,-3.729877117661851e-8,-0.002244574842630709,-3.985434389103751e-5,-3.709499167218068e-8,-0.00224438953153147,-3.964658315948225e-5,-3.6865281132306804e-8,-0.002244283739282433,-3.9453769098646514e-5,-3.6650395806950313e-8,-0.0022442425786291715,-3.9306138580895836e-5,-3.648483998275852e-8,-0.0022442417262513318,-3.9223235736532204e-5,-3.639130046745756e-8,-0.002244252825270072,-3.921193238763609e-5,-3.637818766334322e-8,-0.002244248580715095,-3.926701981343953e-5,-3.6440147045714485e-8,-0.002244206665010873,-3.9373614587264704e-5,-3.656072898333406e-8,-0.0022441120851505714,-3.9510449394149734e-5,-3.671615220159067e-8,-0.002243958158082218,-3.9653224799783987e-5,-3.687916687487293e-8,-0.002243746569982561,-3.977754481038861e-5,-3.702240992509356e-8,-0.0022434870012997396,-3.986143852984975e-5,-3.7121211995940224e-8,-0.002243196539261886,-3.9887788360821346e-5,-3.715623183345602e-8,-0.002242898748955786,-3.984704324325663e-5,-3.711640914072695e-8,-0.0022426218280860106,-3.974042123909537e-5,-3.7002547544910815e-8,-0.0022423948446182447,-3.9583186860967147e-5,-3.683110598566761e-8,-0.002242241179018976,-3.940641160112801e-5,-3.663638469156625e-8,-0.00224216956598242,-3.925442123747653e-5,-3.646787712775838e-8,-0.002242165743912653,-3.917522022806908e-5,-3.63796461283401e-8,-0.0022421904430927637,-3.92042809462743e-5,-3.641210968875951e-8,-0.0022421888363345576,-3.934800163595166e-5,-3.657333079382851e-8,-0.0022421101287026773,-3.957707112540881e-5,-3.683135600408295e-8,-0.0022419276065207064,-3.983591431005777e-5,-3.712457446970693e-8,-0.0022416477393448642,-4.0063753426798325e-5,-3.73851192566621e-8,-0.0022413045475564155,-4.0215340963561835e-5,-3.7561970560884604e-8,-0.0022409449338205603,-4.0271819274777205e-5,-3.7633148529958066e-8,-0.0022406136872176463,-4.0240309319839884e-5,-3.7605480019251675e-8,-0.002240343470877864,-4.0146522531138636e-5,-3.750668536605433e-8,-0.002240150677565745,-4.002533269708593e-5,-3.7375157741474976e-8,-0.002240035711440105,-3.991240818250783e-5,-3.725076167766338e-8,-0.002239985804253139,-3.9838071993125945e-5,-3.7167903625866e-8,-0.0022399789880449567,-3.9823368021104823e-5,-3.715090319780558e-8,-0.0022399885175577506,-3.9878050065343086e-5,-3.721146830451135e-8,-0.002239987272940578,-4.000036042511323e-5,-3.734824122526935e-8,-0.0022399516443405575,-4.017838712946535e-5,-3.7548239619326853e-8,-0.002239864499431365,-4.0392596449678075e-5,-3.778973496167977e-8,-0.0022397169957782525,-4.061908331716644e-5,-3.804599535317224e-8,-0.002239509163109704,-4.083302738834809e-5,-3.828923970936112e-8,-0.00223924945058436,-4.101186342286681e-5,-3.8494196874711744e-8,-0.002238953599371396,-4.113797301515876e-5,-3.8641048926455915e-8,-0.0022386430618668383,-4.120100796303263e-5,-3.871793082545036e-8,-0.002238342944066297,-4.1200001151770064e-5,-3.872324181388282e-8,-0.0022380791839847307,-4.114530686782865e-5,-3.866788607866194e-8,-0.002237874380510262,-4.1060002066053976e-5,-3.857703907310176e-8,-0.00223774180926945,-4.097948394853225e-5,-3.848995354296783e-8,-0.00223767825635013,-4.094712480839855e-5,-3.845528558322179e-8,-0.002237658399419641,-4.1004061797862145e-5,-3.851967858482813e-8,-0.0022376356888406273,-4.11738325963669e-5,-3.8710382858211906e-8,-0.0022375542283195344,-4.144791944811161e-5,-3.9018797372337954e-8,-0.002237369976256706,-4.178239537910177e-5,-3.939648342269923e-8,-0.0022370705865857117,-4.211192540677199e-5,-3.97707040733493e-8,-0.002236681021205403,-4.237528136520402e-5,-4.0072894403993155e-8,-0.0022362515136581293,-4.2537390808246587e-5,-4.026326754963274e-8,-0.0022358368811051695,-4.2596592517748946e-5,-4.033897314519272e-8,-0.002235479455892738,-4.257760540665977e-5,-4.032647668471118e-8,-0.0022352014732815342,-4.251839568376904e-5,-4.026725325138652e-8,-0.0022350055128588357,-4.245824814262653e-5,-4.0204769494537755e-8,-0.002234879072292001,-4.2429981973685345e-5,-4.017588031994506e-8,-0.002234800143287794,-4.245617891594765e-5,-4.020647152992803e-8,-0.0022347421748675988,-4.254810062132713e-5,-4.030997076660549e-8,-0.002234678089860464,-4.2706022024608e-5,-4.04874490318804e-8,-0.002234583596800719,-4.292040013149177e-5,-4.072877100486095e-8,-0.0022344399196055193,-4.3173776366831664e-5,-4.101470592062815e-8,-0.002234235865992565,-4.344333894544913e-5,-4.13198704377615e-8,-0.002233969089473579,-4.370403283753067e-5,-4.1616299339581775e-8,-0.0022336463289874286,-4.393200590097062e-5,-4.1877337327494744e-8,-0.002233282501130823,-4.410796757286399e-5,-4.2081351239347404e-8,-0.0022328987863395795,-4.422003807868895e-5,-4.2214822045642e-8,-0.0022325199496675764,-4.426587777665794e-5,-4.227465236873269e-8,-0.0022321710530385326,-4.4253972215963034e-5,-4.226962591744968e-8,-0.0022318736432929433,-4.420392191805795e-5,-4.2220888713159193e-8,-0.0022316414113256896,-4.414545555348796e-5,-4.216110347774086e-8,-0.0022314754270215662,-4.4115440270257426e-5,-4.213136166132721e-8,-0.002231359823442391,-4.415175418461966e-5,-4.217445054382591e-8,-0.0022312601532689185,-4.4283382554984865e-5,-4.232367827957026e-8,-0.002231127767120565,-4.4518168017474204e-5,-4.258888372588604e-8,-0.0022309127621388284,-4.483326721123653e-5,-4.2945429863533486e-8,-0.0022305832777618443,-4.5176107345948044e-5,-4.33350641470657e-8,-0.0022301417812274774,-4.548042189951665e-5,-4.3683804639003184e-8,-0.00222962696006888,-4.5691654474732635e-5,-4.3930355472978606e-8,-0.0022290982784922498,-4.578732224176004e-5,-4.404886114752745e-8,-0.0022286126995498105,-4.578096414425489e-5,-4.405337631430236e-8,-0.002228207126679372,-4.571064953482692e-5,-4.39852734699268e-8,-0.002227893056699919,-4.562206961243283e-5,-4.38947320909112e-8,-0.002227660846567752,-4.555526540573994e-5,-4.382620421038141e-8,-0.002227487702103169,-4.55379758899719e-5,-4.381102028222137e-8,-0.0022273451775774154,-4.558426004228901e-5,-4.386564409422788e-8,-0.0022272045720067527,-4.569590592468164e-5,-4.39929402649985e-8,-0.002227040330898362,-4.586469098944103e-5,-4.418444952301841e-8,-0.0022268322499077128,-4.607464729273845e-5,-4.4422813065954085e-8,-0.0022265671012077232,-4.6304319138032545e-5,-4.46843227290974e-8,-0.002226239866699384,-4.65292374402582e-5,-4.4941773047288794e-8,-0.002225854484890745,-4.6724799757426735e-5,-4.51677431041688e-8,-0.0022254237956320375,-4.6869601410910074e-5,-4.5338309138385286e-8,-0.002224968272659459,-4.694890763075256e-5,-4.543684582222292e-8,-0.002224513374267207,-4.695764552052053e-5,-4.545727907051517e-8,-0.0022240857042466885,-4.690227807341315e-5,-4.5406156340506795e-8,-0.0022237084214524207,-4.680103654287797e-5,-4.530300679993751e-8,-0.002223396530534961,-4.668216756519775e-5,-4.517860947561035e-8,-0.002223152787249789,-4.658014304122351e-5,-4.507104168252101e-8,-0.002222964935742375,-4.652995213290346e-5,-4.501951893274435e-8,-0.002222805166025817,-4.655966574712351e-5,-4.505611999008108e-8,-0.0022226330833182246,-4.6682000764129616e-5,-4.519616588800026e-8,-0.002222403496610867,-4.6886909508180545e-5,-4.542958762812166e-8,-0.002222079087811143,-4.7138819175493126e-5,-4.571749442657403e-8,-0.0022216449448798823,-4.738267384694757e-5,-4.59987335824701e-8,-0.002221118171827722,-4.7560111136303446e-5,-4.620795613858712e-8,-0.002220545312392466,-4.763048075773373e-5,-4.629917145710085e-8,-0.002219986393474025,-4.758588464850228e-5,-4.626262271116031e-8,-0.002219493466999461,-4.745169161788492e-5,-4.612549476134362e-8,-0.0022190950899372997,-4.727349057060608e-5,-4.5937616176018814e-8,-0.0022187928437108866,-4.709946526084481e-5,-4.575211981967887e-8,-0.0022185676608473866,-4.6967148258508964e-5,-4.561086581454774e-8,-0.0022183897340214403,-4.6897877865561347e-5,-4.5538205382200175e-8,-0.002218227112864587,-4.689730372738356e-5,-4.55412865670691e-8,-0.0022180511931498754,-4.6958726789225835e-5,-4.5613476972552826e-8,-0.002217839478448058,-4.706684563405332e-5,-4.573834204511953e-8,-0.002217576767892167,-4.720088385532349e-5,-4.5893088802846886e-8,-0.0022172557391592737,-4.7337099909682e-5,-4.605143273264397e-8,-0.0022168773700565656,-4.74510906017821e-5,-4.6186255635813826e-8,-0.0022164511799183666,-4.752034046529439e-5,-4.627248139736567e-8,-0.002215994899699834,-4.7527295848164124e-5,-4.629045712510837e-8,-0.002215532947978386,-4.746279506796771e-5,-4.622968509992351e-8,-0.0022150932151455763,-4.732912349998839e-5,-4.60921625117704e-8,-0.0022147021652644183,-4.714160221841957e-5,-4.589418230010463e-8,-0.002214378969883185,-4.692762570971198e-5,-4.566542228593394e-8,-0.0022141300645164186,-4.672255695780222e-5,-4.544463178449744e-8,-0.0022139458137362612,-4.6562850713633075e-5,-4.52722393117001e-8,-0.00221380060967952,-4.64777591528412e-5,-4.518126383051442e-8,-0.0022136569173281237,-4.648149783906708e-5,-4.518852648490155e-8,-0.0022134729343128413,-4.65678409922886e-5,-4.5288350736913463e-8,-0.002213212730213477,-4.670898079689068e-5,-4.545089717714251e-8,-0.002212856797894262,-4.686004182357243e-5,-4.562684735817594e-8,-0.0022124099074522273,-4.6969555866714336e-5,-4.575890861717408e-8,-0.0022119026018825377,-4.699407898397332e-5,-4.579813949784263e-8,-0.0022113839010346006,-4.691226389953383e-5,-4.5719800103478644e-8,-0.0022109065487812933,-4.673212611187127e-5,-4.553166994833471e-8,-0.0022105106421530336,-4.6487513953655795e-5,-4.52703652159344e-8,-0.002210212924897253,-4.622545023671105e-5,-4.498750033432147e-8,-0.0022100056515220326,-4.599082657138239e-5,-4.4732842639896e-8,-0.0022098634270506174,-4.58151562763414e-5,-4.454182124988341e-8,-0.002209753114187779,-4.5712337116466916e-5,-4.4430643000829475e-8,-0.0022096423610802776,-4.568024895658921e-5,-4.439779129857697e-8,-0.0022095048224221024,-4.570516696428774e-5,-4.4428692789315846e-8,-0.0022093223580628898,-4.576643434562114e-5,-4.45008081941231e-8,-0.0022090854104389146,-4.5840198863217866e-5,-4.458782308690369e-8,-0.002208792684048753,-4.590211841998753e-5,-4.4662757683266604e-8,-0.002208450773065764,-4.592949249699432e-5,-4.470041059236587e-8,-0.0022080738356743857,-4.590342965342051e-5,-4.467976024450722e-8,-0.0022076829208446235,-4.581149511652582e-5,-4.45868263584567e-8,-0.0022073042325302127,-4.565081152181556e-5,-4.441802397944935e-8,-0.002206965605216999,-4.5430915166275075e-5,-4.418331181075295e-8,-0.0022066909305378285,-4.51749843519472e-5,-4.390764665471133e-8,-0.0022064933389565914,-4.49177448738443e-5,-4.3628860219709356e-8,-0.0022063692939843756,-4.469903269899099e-5,-4.339076928750656e-8,-0.002206296459441618,-4.455384182826084e-5,-4.323234070924075e-8,-0.002206237344690818,-4.450182876565845e-5,-4.317610450389361e-8,-0.002206148437110928,-4.454022855258338e-5,-4.322014158498983e-8,-0.0022059920678573607,-4.464314996140854e-5,-4.333696738013364e-8,-0.002205747078655037,-4.47677698551155e-5,-4.3480006469238615e-8,-0.0022054149560458707,-4.4865453971987394e-5,-4.359562672668298e-8,-0.0022050197778874484,-4.4894469310904836e-5,-4.363714563703815e-8,-0.002204602080350687,-4.483081733338681e-5,-4.357698088947024e-8,-0.0022042082496701748,-4.4674256976108435e-5,-4.34136267011671e-8,-0.002203878355963061,-4.444767502332483e-5,-4.317130450908105e-8,-0.002203636131830214,-4.418988337579432e-5,-4.289227455216706e-8,-0.0022034842767954172,-4.3944313012475434e-5,-4.2624468807672645e-8,-0.0022034062225738905,-4.374765150444576e-5,-4.240888990786396e-8,-0.0022033728732570334,-4.362214656382595e-5,-4.22709113039624e-8,-0.0022033511472193176,-4.357325021474196e-5,-4.2217405326860426e-8,-0.002203311259278957,-4.359184072021775e-5,-4.2238963148967383e-8,-0.002203231161403219,-4.365884984553331e-5,-4.2314893940482235e-8,-0.0022030981896355236,-4.37501815219e-5,-4.241868804084055e-8,-0.0022029088590102435,-4.3840715442687394e-5,-4.252255845087228e-8,-0.002202667855443351,-4.390713159132299e-5,-4.2600676139939876e-8,-0.0022023869397814195,-4.392991328620103e-5,-4.263141972686281e-8,-0.002202083971331653,-4.389514078579005e-5,-4.259929970541784e-8,-0.0022017817509400405,-4.3796571313615305e-5,-4.2497155377534966e-8,-0.002201506019114991,-4.363807773550661e-5,-4.232878802184368e-8,-0.002201281829056389,-4.3435865519477696e-5,-4.211145676298463e-8,-0.0022011278651603286,-4.321905966755535e-5,-4.187668985882363e-8,-0.002201049428771376,-4.3026635343832115e-5,-4.166711799444936e-8,-0.0022010326564595945,-4.2899212226683795e-5,-4.1527605488542144e-8,-0.0022010438605880736,-4.2866701401245325e-5,-4.149168981230639e-8,-0.002201036815050561,-4.2936311524374124e-5,-4.156826007306663e-8,-0.0022009668005209242,-4.3087189621691026e-5,-4.1735408849570453e-8,-0.002200805687849186,-4.3275540935940235e-5,-4.194576010041846e-8,-0.0022005511147673534,-4.344845205145683e-5,-4.214141087930924e-8,-0.0022002261579351164,-4.356010243054483e-5,-4.2271627325288035e-8,-0.0021998709471877614,-4.3583870411128616e-5,-4.230621553318354e-8,-0.0021995306329296136,-4.351713167905666e-5,-4.2241049980976345e-8,-0.002199244012936336,-4.337907539302264e-5,-4.209604395428574e-8,-0.0021990354974688524,-4.3203716761038325e-5,-4.190782352683438e-8,-0.0021989114882803953,-4.303068697336216e-5,-4.1719808660383815e-8,-0.0021988611198272934,-4.2896143039547516e-5,-4.157220587465444e-8,-0.002198860529686386,-4.28256834219112e-5,-4.149400848221767e-8,-0.0021988792290551736,-4.283052362484336e-5,-4.149848437908441e-8,-0.0021988868020958604,-4.290728558961128e-5,-4.158266825085552e-8,-0.002198858332636107,-4.30407374421635e-5,-4.1730227888167276e-8,-0.0021987776559889718,-4.320815607531913e-5,-4.191627227789234e-8,-0.0021986383828306827,-4.338394252488224e-5,-4.211255171468341e-8,-0.0021984432617016725,-4.354352417484422e-5,-4.229189520363366e-8,-0.0021982026851288055,-4.366616419637895e-5,-4.243138177200893e-8,-0.002197932987833362,-4.373685585806035e-5,-4.2514400830429825e-8,-0.0021976547873646343,-4.374776948947891e-5,-4.2532145447490745e-8,-0.0021973912163822202,-4.3699666494011446e-5,-4.248507449934088e-8,-0.002197165565964018,-4.360339553726757e-5,-4.238455982416569e-8,-0.0021969976661542537,-4.348102472191013e-5,-4.2254266098886135e-8,-0.0021968986060033643,-4.3365344851824027e-5,-4.212983081364773e-8,-0.002196864488916266,-4.329582521635688e-5,-4.205462845468875e-8,-0.00219687177106506,-4.330950164594914e-5,-4.206983298743024e-8,-0.0021968783763478264,-4.342774012978813e-5,-4.219976819299261e-8,-0.002196833942465688,-4.364410781791684e-5,-4.2438344229764724e-8,-0.0021966974953614438,-4.392134829558463e-5,-4.274547229078794e-8,-0.0021964542822063117,-4.420215324008212e-5,-4.305868573313644e-8,-0.002196122004749595,-4.4429633911088055e-5,-4.3315482134634745e-8,-0.002195743141195934,-4.456667055575025e-5,-4.3474511881865136e-8,-0.0021953688213683063,-4.460502832877005e-5,-4.352567029416044e-8,-0.0021950430896256865,-4.456276883725236e-5,-4.34875261233581e-8,-0.00219479325103675,-4.447456387533459e-5,-4.339707996174946e-8,-0.0021946271302473947,-4.4380500039176534e-5,-4.329781770575668e-8,-0.0021945353071144784,-4.43168589575551e-5,-4.322972528487527e-8,-0.0021944959560133495,-4.4310062852754164e-5,-4.322252177775724e-8,-0.002194480563537203,-4.4373660852183527e-5,-4.32920524953864e-8,-0.0021944595227321863,-4.450786864707432e-5,-4.343945466521452e-8,-0.0021944069506842096,-4.4701191951449525e-5,-4.36527150890374e-8,-0.0021943042180325003,-4.49335617950116e-5,-4.391005375463803e-8,-0.002194141906377647,-4.518027077748843e-5,-4.4184332052663467e-8,-0.0021939201779301136,-4.5416019876788224e-5,-4.444764386522221e-8,-0.002193647790767406,-4.561847347713716e-5,-4.4675332295713537e-8,-0.0021933402416158846,-4.5770915859345256e-5,-4.484892453692752e-8,-0.00219301755709073,-4.586399243241319e-5,-4.495797173896476e-8,-0.0021927019881854267,-4.589680376520009e-5,-4.50011490514789e-8,-0.002192415581968075,-4.587758677189852e-5,-4.498696354861374e-8,-0.002192177416627541,-4.582404354917942e-5,-4.493420418458068e-8,-0.0021920001056428633,-4.576302032079154e-5,-4.487180284605771e-8,-0.0021918853630141493,-4.5728554041258204e-5,-4.483694086387648e-8,-0.0021918193971149852,-4.575678790110061e-5,-4.486962210563871e-8,-0.0021917704552939657,-4.5876737000029106e-5,-4.500249145208053e-8,-0.0021916921793231213,-4.609805171784536e-5,-4.524715951212536e-8,-0.002191535722030832,-4.640085504307758e-5,-4.558273256144663e-8,-0.002191268622527711,-4.673572239421093e-5,-4.5955562378608346e-8,-0.0021908911531643392,-4.703860588774864e-5,-4.6295536372601254e-8,-0.0021904389342049485,-4.725525462149562e-5,-4.654284579454351e-8,-0.0021899688757674282,-4.7361335435271427e-5,-4.667003748796585e-8,-0.002189537217572945,-4.736738240175443e-5,-4.66875152635767e-8,-0.002189182178099598,-4.730905371796731e-5,-4.6633131046491385e-8,-0.0021889175315774733,-4.723144495265606e-5,-4.655539679656418e-8,-0.0021887354256682617,-4.717574835041439e-5,-4.6499184056199204e-8,-0.0021886135162408732,-4.717157179860376e-5,-4.649736314449432e-8,-0.0021885224957076004,-4.723435333698451e-5,-4.656775348526145e-8,-0.002188432196672109,-4.736596568910569e-5,-4.671343301511786e-8,-0.0021883159915355365,-4.755688007918747e-5,-4.69247944722332e-8,-0.002188153797184117,-4.7789060056815985e-5,-4.7182558125506696e-8,-0.0021879339216937933,-4.8039252490120275e-5,-4.7461392605544466e-8,-0.0021876538472704776,-4.828243590852618e-5,-4.773381750934838e-8,-0.002187319992989988,-4.849521912185547e-5,-4.7974061450627616e-8,-0.0021869464613131022,-4.865894024085986e-5,-4.816152081756237e-8,-0.0021865528992877276,-4.87620998684626e-5,-4.828339410490294e-8,-0.0021861618199906937,-4.8801891534619e-5,-4.833627312095251e-8,-0.0021857956854069802,-4.878486309271509e-5,-4.832680892763946e-8,-0.0021854738600616984,-4.8726762987137e-5,-4.8271587194920043e-8,-0.0021852094900030724,-4.86515128943926e-5,-4.8196176656966384e-8,-0.002185006334014698,-4.858914285791343e-5,-4.8133122371377696e-8,-0.0021848556724831675,-4.8572182159752406e-5,-4.8118210423692764e-8,-0.0021847340908449993,-4.862969584851901e-5,-4.818398533821574e-8,-0.0021846040333787834,-4.8778729210677626e-5,-4.835019658202303e-8,-0.0021844197065521583,-4.901477659668526e-5,-4.861300583671992e-8,-0.002184139908137586,-4.9305740268685153e-5,-4.89380239589084e-8,-0.002183745208710712,-4.959578164277363e-5,-4.926436436193073e-8,-0.0021832508778272947,-4.9822400093252296e-5,-4.9523381452495355e-8,-0.0021827054179990426,-4.9940812964766306e-5,-4.9665452368679164e-8,-0.002182172657790118,-4.9941786271621964e-5,-4.967953305482646e-8,-0.0021817074157041024,-4.985220421423567e-5,-4.959386599256073e-8,-0.002181338673865619,-4.9720142395811015e-5,-4.945991919619401e-8,-0.0021810666706533364,-4.9595568980319e-5,-4.933166537295909e-8,-0.0021808703783844,-4.951657478515571e-5,-4.92507832762818e-8,-0.0021807181941960203,-4.950399504420421e-5,-4.924073730655143e-8,-0.0021805769182982548,-4.956218364039945e-5,-4.9307324380953e-8,-0.0021804174795038798,-4.968259370492711e-5,-4.9442212976376634e-8,-0.0021802179110294567,-4.9847836933814006e-5,-4.9627109424267564e-8,-0.002179964670767143,-5.003531159657192e-5,-4.983764252872737e-8,-0.0021796530724134083,-5.0220385609024966e-5,-5.004692161411961e-8,-0.002179287108625143,-5.0379309817940806e-5,-5.0228863268068284e-8,-0.0021788786984716967,-5.049197671212808e-5,-5.0361312329529946e-8,-0.0021784462256297563,-5.054452595703909e-5,-5.04289060225776e-8,-0.0021780122025803136,-5.053151803276535e-5,-5.042538797210063e-8,-0.002177600157916581,-5.045722929573454e-5,-5.035495070136917e-8,-0.0021772310966522526,-5.0335776567875636e-5,-5.023237210708531e-8,-0.002176919902460922,-5.0189932859938544e-5,-5.0081843179902245e-8,-0.00217667207082299,-5.004853269807545e-5,-4.993436120974221e-8,-0.0021764812441906808,-4.994249777622941e-5,-4.982363597059191e-8,-0.0021763280507105863,-4.98996114264398e-5,-4.978052270196503e-8,-0.0021761809437515654,-4.9938185981473035e-5,-4.982603516805561e-8,-0.002176000149806595,-5.006025793450334e-5,-4.9963621703133264e-8,-0.002175745817326205,-5.024622884164902e-5,-5.0172910484799115e-8,-0.002175390157594791,-5.0454365055776456e-5,-5.0408841281164365e-8,-0.002174930337153652,-5.06288459355e-5,-5.061036106903455e-8,-0.002174395353711165,-5.071699644838109e-5,-5.0719362989473973e-8,-0.0021738401034926535,-5.0689679713245726e-5,-5.0703131233504954e-8,-0.0021733265233010663,-5.055363671187018e-5,-5.056794205359903e-8,-0.0021729011128648096,-5.034775070284775e-5,-5.035513085813307e-8,-0.0021725811078602674,-5.012585939427826e-5,-5.012259516349527e-8,-0.0021723547388293137,-4.993700515060601e-5,-4.992354472562844e-8,-0.0021721915116131806,-4.9812811310871116e-5,-4.979285902848771e-8,-0.0021720546749986677,-4.976445626435847e-5,-4.9743630077680485e-8,-0.002171910550591354,-4.978612573658363e-5,-4.977057674929707e-8,-0.0021717334408312126,-4.986073223887547e-5,-4.985593590639394e-8,-0.0021715072056702122,-4.9965197761627746e-5,-4.997503848354697e-8,-0.002171225123681876,-5.007442062639999e-5,-5.010064735726323e-8,-0.0021708891541935235,-5.0164162613396194e-5,-5.020624123144993e-8,-0.002170509011565236,-5.021337352113505e-5,-5.026869269970753e-8,-0.0021701010201165194,-5.020633834079381e-5,-5.027067408474085e-8,-0.002169686481978018,-5.013479660142251e-5,-5.02029350445516e-8,-0.0021692892001323122,-4.999980622314807e-5,-5.006625128102955e-8,-0.002168932022375522,-4.9812758371010945e-5,-4.9872480658075486e-8,-0.002168632724515974,-4.95948957641629e-5,-4.96440934171442e-8,-0.0021683999304833723,-4.9374905475583854e-5,-4.94117279890712e-8,-0.0021682299884622017,-4.9184517024424835e-5,-4.9209644023520306e-8,-0.0021681057683319905,-4.905256550499114e-5,-4.906946354132325e-8,-0.0021679981084059274,-4.899850303697785e-5,-4.901315398366616e-8,-0.0021678702118165865,-4.902660625417457e-5,-4.904654790153962e-8,-0.002167684855459021,-4.912228342329066e-5,-4.915496722137846e-8,-0.002167413675346147,-4.9252117611135175e-5,-4.930287422769272e-8,-0.0021670467328493287,-4.9369236645834006e-5,-4.9439453319941026e-8,-0.0021665991445428225,-4.942457392269512e-5,-4.951084310411176e-8,-0.0021661107109958544,-4.9382031214902844e-5,-4.9476821013151695e-8,-0.0021656359860024264,-4.923205966050717e-5,-4.932584479686643e-8,-0.0021652269664645565,-4.8996524294130615e-5,-4.908058662160895e-8,-0.0021649159058167063,-4.872105249104496e-5,-4.878982557957179e-8,-0.002164706655984438,-4.8458301673946887e-5,-4.8510450968611894e-8,-0.0021645777385677746,-4.825084661063017e-5,-4.8288973195301046e-8,-0.0021644934054848965,-4.812122783466715e-5,-4.81506379139743e-8,-0.0021644159176900527,-4.8071024900689184e-5,-4.809815557247862e-8,-0.0021643141929952214,-4.808594061576428e-5,-4.81168922637752e-8,-0.002164167674411756,-4.814266053659258e-5,-4.818208341414474e-8,-0.0021639667146355628,-4.8214709519840826e-5,-4.8265144796799985e-8,-0.0021637113015193915,-4.8276471408607926e-5,-4.833815104674628e-8,-0.0021634093935051597,-4.8305717497990586e-5,-4.8376751136334334e-8,-0.0021630753860666465,-4.8285336142651836e-5,-4.836216222000512e-8,-0.0021627286667312874,-4.8204863846761885e-5,-4.828283802361071e-8,-0.002162391861482956,-4.8062097732630306e-5,-4.813613888210156e-8,-0.0021620882679398825,-4.786457221389886e-5,-4.792984469758117e-8,-0.0021618381966684985,-4.763020148052184e-5,-4.768283959318655e-8,-0.0021616544721947527,-4.738615688544101e-5,-4.74240049864915e-8,-0.0021615380479013072,-4.716519867376527e-5,-4.718845234479752e-8,-0.002161475302072799,-4.699937039553237e-5,-4.701091284755469e-8,-0.0021614386393250546,-4.6912154688658707e-5,-4.691736184216948e-8,-0.002161391201800069,-4.6911292679655636e-5,-4.691717630397373e-8,-0.002161295075484384,-4.698475296081406e-5,-4.6998506562417824e-8,-0.002161121034202,-4.710162372082691e-5,-4.712886694957854e-8,-0.002160857131367918,-4.7218339997966116e-5,-4.726153824963162e-8,-0.0021605135166616594,-4.728911357216719e-5,-4.734669635449493e-8,-0.002160121614640899,-4.727811102218645e-5,-4.7344670899897986e-8,-0.002159727070259186,-4.71700332472349e-5,-4.72376676723403e-8,-0.002159377681774251,-4.697546153405605e-5,-4.703590761080976e-8,-0.0021591097858532486,-4.672829423936533e-5,-4.677517141941328e-8,-0.002158938074167603,-4.6475408602648845e-5,-4.650582202815821e-8,-0.002158852916009944,-4.626235480050213e-5,-4.627738514230599e-8,-0.002158825801635166,-4.612087538018337e-5,-4.612493766194266e-8,-0.002158819709787541,-4.606270599802699e-5,-4.606214934513943e-8,-0.002158799607308813,-4.608051665422589e-5,-4.6081993496327766e-8,-0.0021587395273344563,-4.615361327504223e-5,-4.616267371658823e-8,-0.002158625286072611,-4.625494118904886e-5,-4.627511694149892e-8,-0.002158453953359905,-4.635691120285143e-5,-4.638936013416345e-8,-0.002158231790057722,-4.643523375110354e-5,-4.647887273854775e-8,-0.002157971911670394,-4.647108233605865e-5,-4.652305041561149e-8,-0.0021576922476335206,-4.6452294121769896e-5,-4.650856384345036e-8,-0.0021574138014324212,-4.637428430326153e-5,-4.6430286990051256e-8,-0.0021571587957101316,-4.624105015071745e-5,-4.629227406134107e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_1.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_1.json deleted file mode 100644 index 8eb0d0e6..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_1.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":1000,"numberOfSamples":1000,"samples":[-0.002156948117797158,-4.6066106188504274e-5,-4.610870837852341e-8,-0.0021567976844821175,-4.587262928957953e-5,-4.590411215695837e-8,-0.002156713908245568,-4.569170874283684e-5,-4.5711626484184725e-8,-0.0021566893595621928,-4.555761003533914e-5,-4.5568113732113295e-8,-0.002156700743371349,-4.549983445555494e-5,-4.5505741530892555e-8,-0.0021567115663395065,-4.5533671389188886e-5,-4.5541790676334716e-8,-0.0021566804178876843,-4.5652915406612466e-5,-4.5670622833809834e-8,-0.002156572912636481,-4.582870678241587e-5,-4.58621255953264e-8,-0.0021563728566239655,-4.601620142754535e-5,-4.6068577295811786e-8,-0.0021560880133587525,-4.616711622705171e-5,-4.623794070121091e-8,-0.002155748222189647,-4.62434863816923e-5,-4.6328641438483505e-8,-0.002155396920669294,-4.622782396424562e-5,-4.632067580425877e-8,-0.00215507933393081,-4.612686483113469e-5,-4.621997607570151e-8,-0.0021548310204559523,-4.596856314722607e-5,-4.605556460572259e-8,-0.0021546697448800787,-4.579380803487395e-5,-4.5870948767990285e-8,-0.0021545925009090403,-4.564545026639773e-5,-4.571243253541094e-8,-0.00215457808447119,-4.555777214888923e-5,-4.561767662258407e-8,-0.002154594019620961,-4.554927142265337e-5,-4.560764640929833e-8,-0.002154605368940617,-4.562040509803385e-5,-4.568383677005805e-8,-0.002154582628502511,-4.575613804937631e-5,-4.583074108471704e-8,-0.0021545067042819666,-4.593156748733217e-5,-4.602179515117175e-8,-0.0021543704349080905,-4.6118291920214145e-5,-4.6226298143065905e-8,-0.002154177429419203,-4.628970757896518e-5,-4.64152905393417e-8,-0.0021539395320203554,-4.642448039496704e-5,-4.656547403677698e-8,-0.0021536740325304696,-4.6508347419083976e-5,-4.6661248300741016e-8,-0.002153401212638439,-4.6534852085000904e-5,-4.669548060691322e-8,-0.0021531422886805827,-4.650565883599465e-5,-4.666974436961425e-8,-0.0021529174221249937,-4.6430830311047396e-5,-4.6594529114611347e-8,-0.002152743281384537,-4.632899782380846e-5,-4.648943285318694e-8,-0.0021526297364554913,-4.622682327908873e-5,-4.6382720029024235e-8,-0.0021525757781952213,-4.615665217809799e-5,-4.6309007987320986e-8,-0.0021525657635618595,-4.615111791560906e-5,-4.630363581540198e-8,-0.0021525683606683156,-4.623433111379003e-5,-4.639321479077921e-8,-0.0021525411131787307,-4.641162808298889e-5,-4.658444896551646e-8,-0.00215244181360915,-4.6662730585749126e-5,-4.685650807739798e-8,-0.002152243559761613,-4.69438336830974e-5,-4.716299443903288e-8,-0.0021519463173773905,-4.720028130623982e-5,-4.744536946490242e-8,-0.0021515783140552483,-4.738487646555355e-5,-4.7652539659263205e-8,-0.0021511863195340735,-4.7473012892754915e-5,-4.775714558013054e-8,-0.002150820158632104,-4.74681988823182e-5,-4.7761682951372046e-8,-0.0021505186509381763,-4.739759003524929e-5,-4.769404722497823e-8,-0.002150301454146949,-4.7301602034095665e-5,-4.75967746928141e-8,-0.002150167504080223,-4.722237577724007e-5,-4.751493736774092e-8,-0.0021500984653760494,-4.7194327180898005e-5,-4.7486029043007825e-8,-0.002150065007643072,-4.7238211715320985e-5,-4.753336591146179e-8,-0.002150034011848315,-4.735890504159874e-5,-4.7663329284699034e-8,-0.0021499752813515308,-4.754650144645341e-5,-4.7866189097583804e-8,-0.0021498666614940885,-4.777999559892799e-5,-4.811985529955003e-8,-0.002149696844734374,-4.8032435641353954e-5,-4.8395408706038154e-8,-0.0021494657462589853,-4.8276239272205825e-5,-4.866295866283441e-8,-0.0021491829316347584,-4.848761715432387e-5,-4.8896590036391526e-8,-0.002148864888882999,-4.864954755615883e-5,-4.9077698538029214e-8,-0.002148531969661492,-4.875324012053347e-5,-4.9196590948451486e-8,-0.00214820559302335,-4.879845385417849e-5,-4.925275811633043e-8,-0.0021479058723801398,-4.8793211725869386e-5,-4.9254476683867235e-8,-0.0021476494691693242,-4.875326148772683e-5,-4.921820529983365e-8,-0.0021474473356039884,-4.8701280224926454e-5,-4.916782927985692e-8,-0.002147302025734625,-4.8665427348109735e-5,-4.913330991550414e-8,-0.0021472046146883317,-4.867636961659977e-5,-4.914769826441347e-8,-0.0021471322071707254,-4.8761685544412094e-5,-4.924121019381598e-8,-0.0021470482597085038,-4.893732048233069e-5,-4.943192954490526e-8,-0.002146908584499707,-4.91979967179343e-5,-4.97152190263401E-08,-0.002146674363316176,-4.9511646656850674e-5,-5.0057427768996096e-8,-0.002146328667920062,-4.982422622000098e-5,-5.0400872447169334e-8,-0.0021458875359486144,-5.007688042712524e-5,-5.0682229364308553e-8,-0.002145397011314185,-5.0228379818507437e-5,-5.0856638807463407e-8,-0.0021449161791735768,-5.0270217445764416e-5,-5.091394422090286e-8,-0.002144495917953705,-5.0226434247242504e-5,-5.087865414824122e-8,-0.002144164522903363,-5.01408709895491e-5,-5.079660476566392e-8,-0.002143924532470479,-5.0060878640441164e-5,-5.0717902245852795e-8,-0.002143757959315198,-5.002483607513269e-5,-5.068379162791456e-8,-0.002143634896737234,-5.005585115815337e-5,-5.071984838493151e-8,-0.002143521842854634,-5.0160650756850324e-5,-5.083446444779818e-8,-0.002143388120717485,-5.0331651201626866e-5,-5.102064773664288e-8,-0.002143210184954386,-5.055054311417113e-5,-5.125954074459971e-8,-0.002142974117514982,-5.079251129394976e-5,-5.152482507010141e-8,-0.0021426765074378826,-5.103064468172294e-5,-5.178753018681961e-8,-0.0021423238391256607,-5.124006797853224e-5,-5.202065134245872e-8,-0.002141930651324379,-5.140134181465216e-5,-5.220297342970296e-8,-0.0021415168281439588,-5.150282446702924e-5,-5.2321688446799315e-8,-0.0021411044645297406,-5.154180999406271e-5,-5.237359158139016e-8,-0.0021407148054202576,-5.152449499997826e-5,-5.236496558245039e-8,-0.0021403655678020684,-5.146510002939213e-5,-5.231059043138093e-8,-0.002140068652238457,-5.138444270295482e-5,-5.2232268635753575e-8,-0.002139828133292629,-5.1308028225241545e-5,-5.2156950212399334e-8,-0.002139638422673149,-5.126350568803761e-5,-5.2114230564000163e-8,-0.00213948268691379,-5.1277018333799685e-5,-5.213259191254482e-8,-0.002139332290822501,-5.1367795817320406e-5,-5.223357239670482e-8,-0.0021391489883805194,-5.154098912009453e-5,-5.242383088390882e-8,-0.002138891970010422,-5.1780522562900146e-5,-5.268710604455327e-8,-0.0021385305995390066,-5.20462253084977e-5,-5.2980835455315765e-8,-0.002138059594008942,-5.2280784568316565e-5,-5.324353111816718e-8,-0.002137508049281609,-5.242840674319948e-5,-5.341489927661907e-8,-0.0021369333564798328,-5.245794992558174e-5,-5.3460757754233854e-8,-0.0021364000567887635,-5.237659280739311e-5,-5.338772944526506e-8,-0.0021359554177806913,-5.222499524366457e-5,-5.323816602452792e-8,-0.0021356157132549174,-5.205829004263862e-5,-5.307010206523827e-8,-0.002135367798385966,-5.1925718630202697e-5,-5.293584770307225e-8,-0.0021351802309842655,-5.185853393324863e-5,-5.2869237987871783e-8,-0.002135015709675917,-5.186747116928778e-5,-5.288277568269625e-8,-0.0021348401734937695,-5.194616985504687e-5,-5.2970891829753475e-8,-0.002134627758060293,-5.2076667370690687e-5,-5.311539888620349e-8,-0.002134362664862016,-5.22346501846903e-5,-5.329085053332862e-8,-0.0021340393185033547,-5.2393733389077045e-5,-5.3469096840437146e-8,-0.002133661644592146,-5.252894430972528e-5,-5.362316413179043e-8,-0.0021332416919183183,-5.2619642849676823e-5,-5.373058405670703e-8,-0.002132797639105352,-5.265187989316952e-5,-5.377605953151373e-8,-0.00213235123299873,-5.262008658853691e-5,-5.3753301407695094e-8,-0.0021319247547086106,-5.252787431710746e-5,-5.366582385721862e-8,-0.002131537812166341,-5.2387711692295135e-5,-5.3526527141880856e-8,-0.002131204386649835,-5.221948578729788e-5,-5.335616249926751e-8,-0.002130930436840616,-5.204813499564776e-5,-5.3180922715721016e-8,-0.0021307122475242276,-5.190051666082856e-5,-5.3029303636494595e-8,-0.002130535691096194,-5.1801663288743484e-5,-5.2928303953712826e-8,-0.002130376577415983,-5.1770519389418736e-5,-5.289893815879023e-8,-0.0021302025383327134,-5.1815158911048855e-5,-5.2950976313991277e-8,-0.002129977378036466,-5.192792796725971e-5,-5.3077407334747964E-08,-0.0021296688087945386,-5.208214555192072e-5,-5.325050928388623e-8,-0.0021292592998348823,-5.2233329336141494e-5,-5.342289782969275e-8,-0.002128757014872047,-5.2328224363975537e-5,-5.353718707965699e-8,-0.0021282003685288873,-5.232211388239153e-5,-5.354471701182651e-8,-0.0021276495587692528,-5.219820202071707e-5,-5.342650421322242e-8,-0.002127165444777017,-5.1977374748586926e-5,-5.32037987462269e-8,-0.002126786408919701,-5.1710339300552144e-5,-5.292980367635397e-8,-0.0021265166937946525,-5.145633618560855e-5,-5.2667177244896215e-8,-0.00212633105580082,-5.126167160748416e-5,-5.246538067689548e-8,-0.002126189328271234,-5.114869660600918e-5,-5.234897812409529e-8,-0.0021260510373621883,-5.111638783278097e-5,-5.231801132895357e-8,-0.002125884513579751,-5.114733030685652e-5,-5.235503053809026e-8,-0.0021256702248682435,-5.121572331910457e-5,-5.243327665430199e-8,-0.002125400455812279,-5.1293642979333694e-5,-5.252321996716058e-8,-0.0021250775059338096,-5.1355096043385815e-5,-5.259696904862907e-8,-0.0021247116610059085,-5.1378537621995244e-5,-5.2631164024147827e-8,-0.0021243192352671083,-5.134861185069034e-5,-5.2609026267915535e-8,-0.002123920533294502,-5.125749504161394e-5,-5.252187717870801e-8,-0.002123537513917045,-5.1105899487825944e-5,-5.237017732952232e-8,-0.0021231909824004935,-5.0903510148269925e-5,-5.21639052525058e-8,-0.002122897386272381,-5.066840160744641e-5,-5.192188374186477e-8,-0.0021226656718111524,-5.042508933637542e-5,-5.166975788992617e-8,-0.002122494839571998,-5.0201204525872756e-5,-5.143662126873064e-8,-0.0021223728064571974,-5.002307532138799e-5,-5.125052539179263e-8,-0.002122277063662247,-4.9910792187481684e-5,-5.1133373559448276e-8,-0.002122177350465051,-4.9873571668336e-5,-5.1095958839310544e-8,-0.002122040271899325,-4.990621895883855e-5,-5.113395766297128e-8,-0.002121835670220407,-4.998749569171908e-5,-5.122580454826739e-8,-0.002121544289358671,-5.008151805352115e-5,-5.133380683137773e-8,-0.0021211653940700756,-5.0143498952941705e-5,-5.141007127166793e-8,-0.0021207216447338448,-5.0130441492102875e-5,-5.1407976149345016e-8,-0.002120257496141451,-5.001520456175847e-5,-5.1297441102601807e-8,-0.002119828397979043,-4.9798850489622e-5,-5.107840402680578e-8,-0.0021194826754195456,-4.9513892869127156e-5,-5.078451782729881e-8,-0.002119244086201465,-4.921409445932999e-5,-5.0472444375840066e-8,-0.0021191046402436534,-4.8954748273117716e-5,-5.0200988226733736e-8,-0.002119031138708923,-4.8773978554723135e-5,-5.001124485406591e-8,-0.002118980101862301,-4.8684026206295004e-5,-4.991720030835334e-8,-0.00211891220827597,-4.867379334879302e-5,-4.990812813538284e-8,-0.0021188006530865576,-4.8717674424215837e-5,-4.9957631878584515e-8,-0.0021186330805224884,-4.878489183979079e-5,-5.003335885442783e-8,-0.002118409606923484,-4.8846210672363946e-5,-5.010414572430475e-8,-0.0021181395569648243,-4.887764161794287e-5,-5.0144131459874775e-8,-0.002117838428140765,-4.8862089859800686e-5,-5.013472762586503e-8,-0.0021175254797301053,-4.87900395563563e-5,-5.006548391793509e-8,-0.0021172217039225403,-4.865995177280172e-5,-4.9934517707598465e-8,-0.0021169477453683006,-4.8478584561881674e-5,-4.9748766630150475e-8,-0.002116721392799632,-4.8261007717598124e-5,-4.952391111144196e-8,-0.00211655455107997,-4.802973321358578e-5,-4.928344153787555e-8,-0.002116450096966629,-4.781233066898358e-5,-4.9056238260434893e-8,-0.0021163995074253497,-4.763723300556185e-5,-4.88723175000772e-8,-0.00211638238176434,-4.752806896211847e-5,-4.8757005535652654e-8,-0.0021163687749273766,-4.749765415455074e-5,-4.872463016284184e-8,-0.0021163245129189124,-4.75433801208055e-5,-4.8773504423959966e-8,-0.0021162186131261293,-4.7645689733550204e-5,-4.888400543678275e-8,-0.0021160311239636605,-4.7770598620135224e-5,-4.902087037517744e-8,-0.0021157594156345004,-4.787624496808221e-5,-4.913984622203423e-8,-0.0021154210653734945,-4.792249771712643e-5,-4.919779498322852e-8,-0.0021150518661444766,-4.788171611098116e-5,-4.916427157162084e-8,-0.0021146983037815758,-4.774784549571525e-5,-4.903151581702451e-8,-0.0021144054214774677,-4.754043449876239e-5,-4.881909664190108e-8,-0.002114203335655032,-4.730071511555959e-5,-4.857004998709531e-8,-0.0021140976257717674,-4.7079605315396366e-5,-4.8338297363515245e-8,-0.002114068243449401,-4.6921741162987395e-5,-4.817168920274723e-8,-0.0021140776517754515,-4.685238849929127e-5,-4.8097948508555413e-8,-0.002114084019446718,-4.6872596236596724e-5,-4.81192411375788e-8,-0.002114053227237637,-4.6963141965845496e-5,-4.821604606694751e-8,-0.002113965448400426,-4.7093502898033734e-5,-4.8356449951288814e-8,-0.0021138158726727416,-4.7231060835115885e-5,-4.8505867927921634e-8,-0.0021136117434029157,-4.73475915439524e-5,-4.863405741638106e-8,-0.002113368243224607,-4.742253450655109e-5,-4.8718797175518944e-8,-0.0021131048107557887,-4.7443958322278066e-5,-4.874708212682086e-8,-0.002112842390293642,-4.740840058984932e-5,-4.87150037508711e-8,-0.002112601402461571,-4.732044050097083e-5,-4.8627229494421786e-8,-0.002112399898104981,-4.71923458598116e-5,-4.84965171325286e-8,-0.0021122513870208202,-4.7043586695278016e-5,-4.834314259144425e-8,-0.002112162155506463,-4.689959768605062e-5,-4.8193650389836864e-8,-0.0021121284044120486,-4.678902511400128e-5,-4.807810872069021e-8,-0.002112134192586928,-4.6738909755118304e-5,-4.802520783954363e-8,-0.002112151736011111,-4.676805674809973e-5,-4.8055358790222776e-8,-0.0021121455008559073,-4.68802207502431e-5,-4.8173435647070684e-8,-0.002112080244306887,-4.705993268071947e-5,-4.8364140938563196e-8,-0.0021119310664213338,-4.727368018370931e-5,-4.8592931302070324e-8,-0.002111691895111901,-4.747730114612249e-5,-4.881352739322071e-8,-0.0021113788749667064,-4.7627699607907756e-5,-4.898012188224292e-8,-0.00211102704677318,-4.7694954771803144e-5,-4.9060201272908396e-8,-0.002110681352249585,-4.767075494556609e-5,-4.90436883734857e-8,-0.002110384874318121,-4.7570663804349934e-5,-4.894570849816082e-8,-0.0021101677401916797,-4.7429813825341904e-5,-4.8802430880724736e-8,-0.002110039696581039,-4.729335730533683e-5,-4.866125590022362e-8,-0.0021099884072854364,-4.7204358850854926e-5,-4.8568084600913465e-8,-0.002109983945387274,-4.7192708949043166e-5,-4.855543459993911e-8,-0.0021099879117350232,-4.726846620998511e-5,-4.863507382826351e-8,-0.0021099639576379094,-4.7421428985429237e-5,-4.879720662545984e-8,-0.0021098861854816123,-4.7626298326830003e-5,-4.901567331796005e-8,-0.002109743186109511,-4.7850789510772105e-5,-4.9256450069474826e-8,-0.002109537586825893,-4.8063526347891254e-5,-4.948609768053289e-8,-0.002109282655958739,-4.8239580975826655e-5,-4.967782243823404e-8,-0.0021089979409871034,-4.8363148343395243e-5,-4.981449771751667e-8,-0.002108705341277884,-4.8427999229028034e-5,-4.988923858233261e-8,-0.002108426170116319,-4.843672757019664e-5,-4.990457813568429e-8,-0.0021081790939703336,-4.8399655340769195e-5,-4.987120855545762e-8,-0.002107978462340765,-4.8333815691984267e-5,-4.98068240380907e-8,-0.0021078325085235445,-4.8261883157006745e-5,-4.973500790876879e-8,-0.002107741182028866,-4.8210487087105704e-5,-4.968358842430621e-8,-0.0021076938773007476,-4.820714020935879e-5,-4.9681591379790985e-8,-0.0021076680383246907,-4.827513281127266e-5,-4.975399170959863e-8,-0.002107630376401887,-4.842654419791798e-5,-4.991432609044488e-8,-0.0021075425159545343,-4.865523284848443e-5,-5.015711147352186e-8,-0.0021073713272879244,-4.893349928726431e-5,-5.045403692151433e-8,-0.002107101054149504,-4.921621165090497e-5,-5.075804312180078e-8,-0.00210674158544731,-4.9453141274911964e-5,-5.1016160495136004e-8,-0.0021063277292051657,-4.960526660686225e-5,-5.1186657637328415e-8,-0.0021059088236712936,-4.965767137535703e-5,-5.1252729209342855e-8,-0.002105533355710234,-4.962333434846008e-5,-5.122672710022117e-8,-0.002105235298687669,-4.953725574759237e-5,-5.114433301511661e-8,-0.0021050267301768173,-4.9444765358431426e-5,-5.105262008384059e-8,-0.0021048975954977385,-4.938895653500951e-5,-5.099704564916817e-8,-0.0021048209457205044,-4.940083264676395e-5,-5.1011036159970786e-8,-0.0021047611320736954,-4.9493878141675046e-5,-5.110997819652719e-8,-0.0021046825545899023,-4.9663315734863536e-5,-5.1290024568352304e-8,-0.002104557033149279,-4.98893453161492e-5,-5.1531150434198844e-8,-0.0021043684802190066,-5.0143026698940785e-5,-5.1803180748147716e-8,-0.002104114312419352,-5.0393089164750924e-5,-5.2073008844431506e-8,-0.0021038039107087792,-5.0611974369170696e-5,-5.2311154609061635e-8,-0.002103455142864527,-5.077997300985246e-5,-5.249634587215205e-8,-0.0021030901973043527,-5.088713159052434e-5,-5.261767665298347e-8,-0.002102731754757487,-5.093327497583167e-5,-5.2674658453290784e-8,-0.002102400038249737,-5.0926853473763044e-5,-5.267593710089334e-8,-0.002102110741705476,-5.088333895282607e-5,-5.2637516149960456e-8,-0.002101873489403106,-5.08235740242651e-5,-5.2580999673824274e-8,-0.0021016904381226816,-5.07720385838116e-5,-5.2531862498246874e-8,-0.0021015548084289933,-5.0754644122074386e-5,-5.2517309070279127e-8,-0.002101449525764805,-5.079541727592946e-5,-5.256294807274047e-8,-0.002101346863688587,-5.091147619245311e-5,-5.268753767417356e-8,-0.0021012107625705593,-5.110647842638639e-5,-5.2895930277749896e-8,-0.0021010036231113496,-5.1364431323432054e-5,-5.317225671965255e-8,-0.0021006978474307205,-5.164780092740599e-5,-5.347763770609452e-8,-0.0021002887607210427,-5.1904283966139336e-5,-5.3757151991875933e-8,-0.0020998017811831972,-5.2082983385010847e-5,-5.3956856249473105e-8,-0.002099287305051419,-5.2153786677272464e-5,-5.404424493360183e-8,-0.002098803714303415,-5.211938886395136e-5,-5.402099729340937e-8,-0.0020983970909576486,-5.201310176200273e-5,-5.392087032373497e-8,-0.0020980879471518285,-5.1884788106360025e-5,-5.379525398388802e-8,-0.0020978694594535633,-5.178355560077695e-5,-5.3695353664609535e-8,-0.0020977146033212875,-5.1744897802943776e-5,-5.3658858151211176e-8,-0.0020975867206337855,-5.17850538647107e-5,-5.370387698001164e-8,-0.002097449252174256,-5.1901448471996434e-5,-5.382901325735156e-8,-0.0020972727165282454,-5.2076755488728516e-5,-5.4017187239652266e-8,-0.002097038679265766,-5.228448053746355e-5,-5.424119501315798e-8,-0.002096741115512614,-5.2494770950254756e-5,-5.446974146690214e-8,-0.0020963856479537316,-5.267968073580639e-5,-5.467310941300608e-8,-0.0020959871806476727,-5.281730553664611e-5,-5.482773870037851e-8,-0.002095566547851664,-5.2894425618154075e-5,-5.49192091763326e-8,-0.0020951467983804607,-5.2907580747666326e-5,-5.494346629557186e-8,-0.0020947496865052926,-5.2862703551995284e-5,-5.490641407062349e-8,-0.00209439283463895,-5.277366064911636e-5,-5.482230500560337e-8,-0.002094087719578533,-5.266022168051224e-5,-5.471156076175677e-8,-0.0020938383034884785,-5.2545818362760925e-5,-5.459846822588298e-8,-0.00209364009071615,-5.245512424241938e-5,-5.4508786421523974e-8,-0.002093479524987209,-5.241128303972207e-5,-5.4467015989831044e-8,-0.002093333866675805,-5.243244496307399e-5,-5.449285675295966e-8,-0.002093172238328941,-5.25272454837531e-5,-5.459637339444828e-8,-0.002092959192295158,-5.2689536740216397e-5,-5.47721861308031e-8,-0.002092662162437497,-5.289419192472436e-5,-5.4994709404817255e-8,-0.002092262731012093,-5.3097515495686634e-5,-5.5218327291160634e-8,-0.0020917682925749906,-5.3246152076680836e-5,-5.5386719323868286e-8,-0.0020912168729252238,-5.32948950916572e-5,-5.5451705931345774e-8,-0.00209066831104737,-5.322638039161152e-5,-5.539407826225248e-8,-0.002090182976448214,-5.306061034027742e-5,-5.523368866112795e-8,-0.0020897991792229852,-5.2847036022818596e-5,-5.502129784760488e-8,-0.0020895220312050072,-5.264403046194828e-5,-5.481735951820511e-8,-0.002089327651578887,-5.2498344531242285e-5,-5.4670817165440435e-8,-0.002089176601984936,-5.243402752975581e-5,-5.46075905285881e-8,-0.002089027832962104,-5.2451886161662154e-5,-5.462976227025945e-8,-0.002088848145979607,-5.253524957931374e-5,-5.4721159636310425e-8,-0.002088616519163286,-5.265749417095675e-5,-5.485481113266398e-8,-0.0020883247601802828,-5.278870213189013e-5,-5.499971074275159e-8,-0.0020879761659435914,-5.290068935685728e-5,-5.512613172786507e-8,-0.002087583221816599,-5.297058683962383e-5,-5.520959628157752e-8,-0.002087164777385674,-5.29832296796577e-5,-5.5233626895864976e-8,-0.002086742950109644,-5.2932455223265686e-5,-5.519126877302781e-8,-0.002086339956581604,-5.282138748957507e-5,-5.508542075950947e-8,-0.0020859750527439137,-5.266171847400609e-5,-5.492801945295256e-8,-0.0020856618891764334,-5.247200185689632e-5,-5.4738177469182e-8,-0.0020854066000901466,-5.227520696881749e-5,-5.453962120190033e-8,-0.0020852067040709943,-5.209587655834655e-5,-5.4357819901512334e-8,-0.002085050761531667,-5.19570440334916e-5,-5.421693100956444e-8,-0.0020849188250382576,-5.187695475340274e-5,-5.4136513752244604e-8,-0.0020847838283227895,-5.1865633386018315e-5,-5.4127943797766366e-8,-0.002084614302700284,-5.192134366393279e-5,-5.4190517439071605e-8,-0.002084379177216386,-5.202743147570318e-5,-5.4307801867957737e-8,-0.0020840552632532838,-5.2151132764179095e-5,-5.444603412637725e-8,-0.0020836367229090016,-5.2246983387897786e-5,-5.4557508305702125e-8,-0.0020831432642481086,-5.226727446908682e-5,-5.45915998704627e-8,-0.00208262110484632,-5.217892051956154e-5,-5.451267651801983e-8,-0.0020821314693878165,-5.1979995231158984e-5,-5.4317639028435655e-8,-0.002081728580818981,-5.170500269403149e-5,-5.404156653193917e-8,-0.0020814384597434145,-5.1412711832119855e-5,-5.374512512192592e-8,-0.0020812512548079114,-5.1162601970100065e-5,-5.349017232141276e-8,-0.0020811301739922143,-5.0993981576040526e-5,-5.331814200443522e-8,-0.0020810288964036128,-5.091778800135395e-5,-5.324144113486929e-8,-0.0020809068797548306,-5.0920708246115815e-5,-5.324742058440525e-8,-0.002080737412895719,-5.0975044648063965e-5,-5.330822538299496e-8,-0.0020805090765344805,-5.104836915559959e-5,-5.339054776415609e-8,-0.0020802235105041346,-5.111032019083676e-5,-5.3462654102947513e-8,-0.0020798920087048986,-5.113645247824958e-5,-5.349856905196274e-8,-0.0020795322310856322,-5.111013067736273e-5,-5.3480319452971573e-8,-0.002079165270330489,-5.102337145825212e-5,-5.339903379738613e-8,-0.002078812929807196,-5.0877027322918444e-5,-5.325522084868336e-8,-0.0020784951021789507,-5.0680399754512935e-5,-5.3058323468374344e-8,-0.0020782272019827155,-5.0450194248135284e-5,-5.2825530483115977E-08,-0.002078017796904138,-5.020860124030872e-5,-5.257971627504764e-8,-0.002077866846658982,-4.998045829403398e-5,-5.234652763334412e-8,-0.002077764949227266,-4.9789769777337244e-5,-5.215090293742938e-8,-0.002077693796213007,-4.96559598259346e-5,-5.201333928555749e-8,-0.002077627945643406,-4.959024266445353e-5,-5.1946199184189877e-8,-0.0020775379573369774,-4.959258117963107e-5,-5.1950458272378425e-8,-0.002077394847759163,-4.964972754567608e-5,-5.20133946027985e-8,-0.0020771757956997636,-4.973494898228385e-5,-5.2107934240242226e-8,-0.0020768707597667575,-4.981047198397003e-5,-5.21948928946358e-8,-0.002076488719453658,-4.9833950263944744e-5,-5.222962698296795e-8,-0.0020760607752435137,-4.976947981592237e-5,-5.217368787144459e-8,-0.0020756363255762,-4.960119521007246e-5,-5.2009327355383566e-8,-0.0020752699804712604,-4.934370262592132e-5,-5.175068444401802e-8,-0.002075002258206543,-4.904167747827994e-5,-5.144355599514386e-8,-0.002074843505137487,-4.875527236421879e-5,-5.115030112001243e-8,-0.002074770885112081,-4.85375576824606e-5,-5.092642497342114e-8,-0.0020747400769557814,-4.841647775431193e-5,-5.080178737543361e-8,-0.00207470360549399,-4.839002227744564e-5,-5.077538800998163e-8,-0.0020746254988324455,-4.843356303392952e-5,-5.082265162308837e-8,-0.002074487411936633,-4.8512066229528486e-5,-5.090778965666528e-8,-0.002074287589063454,-4.8590652566310444e-5,-5.099462507142112e-8,-0.0020740364229402913,-4.864094211986411e-5,-5.105327235216716e-8,-0.0020737516117730406,-4.864364377231825e-5,-5.1063071939584795e-8,-0.0020734542779023923,-4.858893563414716e-5,-5.101324060777878e-8,-0.0020731661303226793,-4.847596434842968e-5,-5.090249495797251e-8,-0.0020729072209830705,-4.831209437291138e-5,-5.073826475982897e-8,-0.002072693884949742,-4.81119863715466e-5,-5.053563043378728e-8,-0.0020725366574624164,-4.789627336170478e-5,-5.031584456326077e-8,-0.002072438244777095,-4.76894406001386e-5,-5.0104114550785046e-8,-0.0020723920062757552,-4.751664405123388e-5,-4.992640119935618e-8,-0.002072381620741844,-4.7399626029792626e-5,-4.980535122260885e-8,-0.002072382493146707,-4.735231857382114e-5,-4.975587690759763e-8,-0.002072365126038206,-4.737703392101369e-5,-4.9781211913094104e-8,-0.0020723002115636837,-4.746229500170882e-5,-4.987048608611002e-8,-0.002072164686144449,-4.758318793891755e-5,-4.9998772052492005e-8,-0.0020719476479477516,-4.7704672733856255e-5,-5.0130175273880784e-8,-0.0020716548762382742,-4.778785681354576e-5,-5.0224127220180263E-08,-0.002071310506859259,-4.779875995902617e-5,-5.0244500497020163e-8,-0.0020709542977483263,-4.7718213318121765e-5,-5.017014103512715e-8,-0.002070633392768585,-4.755018007788747e-5,-5.0003890279004845e-8,-0.0020703892518739446,-4.7324560969728754e-5,-4.9775852540256276e-8,-0.002070243556064142,-4.709095642120351e-5,-4.953713265926498e-8,-0.002070189582318923,-4.690347790577672e-5,-4.93441179578025e-8,-0.002070194443298303,-4.6802416516879245e-5,-4.9239360290252976e-8,-0.002070211781957937,-4.680166452708117e-5,-4.923831183218621e-8,-0.0020701982102484394,-4.688757653287808e-5,-4.9327848095478144e-8,-0.0020701254502533,-4.702784331254064e-5,-4.947517696147768e-8,-0.002069984310820259,-4.718405080239909e-5,-4.9640685225447364e-8,-0.002069781881963152,-4.732196406548829e-5,-4.978861540585559e-8,-0.002069535727065262,-4.741708010271714e-5,-4.989300757237092e-8,-0.0020692682062174064,-4.7456088345065395e-5,-4.993946266170168e-8,-0.0020690022999483347,-4.743604483466135e-5,-4.9924473337753236e-8,-0.0020687589325963695,-4.736278778201662e-5,-4.9853830021207306e-8,-0.0020685552095647745,-4.724938104372905e-5,-4.9740931313843226e-8,-0.0020684029471759965,-4.7114721697835956e-5,-4.9605222607596616e-8,-0.002068307113632894,-4.698198596032385e-5,-4.9470525465095644e-8,-0.002068264210735056,-4.6876359384872586e-5,-4.936274057243991e-8,-0.0020682611085878133,-4.682161851644506e-5,-4.930645763105391e-8,-0.002068275207205279,-4.683559588593652e-5,-4.932042167102954e-8,-0.002068276840995726,-4.692525626768796e-5,-4.941250393336782e-8,-0.0020682343681795467,-4.708286526062035e-5,-4.9575641749325084e-8,-0.002068121336074826,-4.728509807584928e-5,-4.9786665145860586e-8,-0.002067923897843404,-4.7496385865671217e-5,-5.0009436305109905e-8,-0.0020676460373650566,-4.7676378285878495e-5,-5.0202301586995866e-8,-0.0020673105644500745,-4.77898332491647e-5,-5.032822287464823e-8,-0.002066955050994269,-4.781625324925658e-5,-5.036486940750825e-8,-0.0020666233471462645,-4.7756464778773514e-5,-5.0311739548860085e-8,-0.002066354580310086,-4.763398187934115e-5,-5.0191974764700023E-08,-0.0020661724200392493,-4.7490128745401975e-5,-5.004766473653001e-8,-0.0020660778693884388,-4.737345115377653e-5,-4.9929071504630356e-8,-0.002066048524221078,-4.732603099287772e-5,-4.9880421809209325e-8,-0.0020660453797246812,-4.737129330364156e-5,-4.992704483799921e-8,-0.0020660250285791494,-4.7508085193365105e-5,-5.006889477610717e-8,-0.0020659523841825966,-4.7713206060515434e-5,-5.028283650859611e-8,-0.0020658090029066624,-4.795053885650078e-5,-5.053188956294247e-8,-0.002065594771846483,-4.818222569886375e-5,-5.0776768516938594e-8,-0.002065324117375244,-4.837752105633615e-5,-5.0985184294608874e-8,-0.002065019767433622,-4.851728875182688e-5,-5.1136723525022014e-8,-0.0020647068446275245,-4.8594594783670716e-5,-5.1223668798557995e-8,-0.0020644086381638085,-4.861304972472082e-5,-5.124938607964203e-8,-0.002064144097864555,-4.8584434676873395e-5,-5.122584536957933e-8,-0.002063926468637026,-4.852647936788248e-5,-5.1171225339119544e-8,-0.0020637623786124806,-4.846100605905334e-5,-5.11079143446867e-8,-0.0020636508879348973,-4.841213269692522e-5,-5.106066445180714e-8,-0.002063582435238546,-4.8403934845334516e-5,-5.1054290024565175e-8,-0.002063538168965467,-4.8457018960260466e-5,-5.1110281108115146e-8,-0.002063490642966396,-4.858388401565267e-5,-5.12421042751145e-8,-0.002063407082221286,-4.8783799285689586e-5,-5.144985988199522e-8,-0.0020632559577338995,-4.9039126710606216e-5,-5.1716281192541857e-8,-0.0020630160427410785,-4.931581340272001e-5,-5.200696102828744e-8,-0.002062684941410063,-4.95699691789468e-5,-5.2276889335559116e-8,-0.0020622829172062315,-4.9759696099219955e-5,-5.2482526161209284e-8,-0.0020618491854511264,-4.9858113731482825e-5,-5.259526114699326e-8,-0.0020614313126430684,-4.98622055714111e-5,-5.261072103110058e-8,-0.0020610717124268244,-4.979388598943105e-5,-5.255018976438976e-8,-0.00206079622917913,-4.9693307260769264e-5,-5.2454091838812215e-8,-0.002060608259750969,-4.960738794563041e-5,-5.2370482519734586e-8,-0.0020604893759882652,-4.957747244117635e-5,-5.234243575739418e-8,-0.0020604054583355405,-4.962944279368117e-5,-5.239769021503708e-8,-0.00206031622426224,-4.976850689463904e-5,-5.254290844467591e-8,-0.0020601854537221713,-4.997959938080869e-5,-5.276367005121703e-8,-0.002059989171420568,-5.0232827495872717e-5,-5.3029781808228276e-8,-0.0020597197607184654,-5.049196909900188e-5,-5.330394627200139e-8,-0.002059385412596773,-5.0723251719086136e-5,-5.35509256812709e-8,-0.002059005920337264,-5.0901931837912855e-5,-5.374455696877302e-8,-0.0020586068325025636,-5.1015438910330984e-5,-5.387122879648511e-8,-0.0020582139353274493,-5.106332394108202e-5,-5.3929977985066915e-8,-0.0020578492211639973,-5.105516573900859e-5,-5.3930358175955645e-8,-0.002057528552028513,-5.100771436745336e-5,-5.388943054436595e-8,-0.0020572605931187234,-5.094215881551009e-5,-5.382886471043966e-8,-0.0020570463828137086,-5.088182315066045e-5,-5.3772543032440546e-8,-0.0020568790450358394,-5.0850080664488783e-5,-5.3744486331419684e-8,-0.0020567435004348058,-5.086799254343324e-5,-5.376655829843546e-8,-0.0020566165172875277,-5.0951144908211624e-5,-5.38553140117008e-8,-0.002056468009873697,-5.1105440079060466e-5,-5.40176449522486e-8,-0.002056264887091375,-5.13224346701609e-5,-5.4245796040435814e-8,-0.0020559784072281106,-5.157623756835036e-5,-5.451389058844007e-8,-0.0020555942713637253,-5.1825209665744814e-5,-5.4779432398487804e-8,-0.0020551217432332926,-5.202108670480498e-5,-5.4992587084446835e-8,-0.002054595971680873,-5.212442299521637e-5,-5.511211091620739e-8,-0.002054069540827032,-5.212000715115373e-5,-5.51213256728815e-8,-0.0020535954582683582,-5.202381128623128e-5,-5.503543356010499e-8,-0.002053209667556904,-5.187728707364314e-5,-5.48959111155173e-8,-0.002052921320923942,-5.1732422490422854e-5,-5.4755490408141264e-8,-0.0020527136286440546,-5.163540619096735e-5,-5.466165472016251e-8,-0.002052552370246584,-5.16152962902263e-5,-5.464504010682952e-8,-0.002052397089200715,-5.167979779085585e-5,-5.471483931427527e-8,-0.0020522111175157827,-5.1817015362214554e-5,-5.4860156203498216e-8,-0.002051968552414977,-5.200091488002448e-5,-5.505518884494557e-8,-0.002051657757119859,-5.219838699551085e-5,-5.5266251947721564e-8,-0.0020512816489339715,-5.237636228823249e-5,-5.5459107581815276e-8,-0.0020508553095427784,-5.2507832957142995e-5,-5.5605365688318714e-8,-0.0020504017421625635,-5.2575890404729004e-5,-5.568690921630114e-8,-0.002049946887543557,-5.257533993074332e-5,-5.5697769382127575e-8,-0.002049514984834118,-5.251207506856239e-5,-5.5643570315387093e-8,-0.0020491250330573053,-5.240083953067565e-5,-5.553919797775131e-8,-0.0020487886736325817,-5.226219084775036e-5,-5.540559549606092e-8,-0.002048509350314085,-5.211942672300324e-5,-5.526655233827838e-8,-0.0020482822912756475,-5.1995876311308334e-5,-5.514595440180733e-8,-0.0020480948969156336,-5.191250486751777e-5,-5.506543751527602e-8,-0.0020479273660762303,-5.188554270222557e-5,-5.5042078174011434e-8,-0.002047753716271682,-5.19237834715236e-5,-5.5085654827554707e-8,-0.002047543853386551,-5.202532476066097e-5,-5.5195172880639046e-8,-0.0020472677925593256,-5.2174216124140644e-5,-5.535514660858792e-8,-0.002046902870774027,-5.2338771760351975e-5,-5.553355877045675e-8,-0.0020464432837271392,-5.247451873274851e-5,-5.568470840459575e-8,-0.0020459084093877532,-5.253449204712567e-5,-5.575981860047395e-8,-0.002045343640214381,-5.2486027294355265e-5,-5.5724461720487053e-8,-0.002044808785656605,-5.2326853813685626e-5,-5.557525555895152e-8,-0.002044356731611969,-5.208986005362827e-5,-5.534487592771635e-8,-0.002044013525552351,-5.183141847200364e-5,-5.5090255370018856e-8,-0.002043771226817781,-5.160953417781544e-5,-5.48704621303244e-8,-0.0020435956589243583,-5.1464429347744986e-5,-5.472704260792385e-8,-0.0020434418674889353,-5.1410036594933055e-5,-5.4675282541850294e-8,-0.0020432684427998627,-5.14362548539681e-5,-5.470618039648655e-8,-0.0020430462096218717,-5.1516940304592496e-5,-5.4794150517663037e-8,-0.0020427612302023604,-5.161886518563504e-5,-5.490581755587025e-8,-0.002042413976632722,-5.170911019925943e-5,-5.50074620408479e-8,-0.0020420165420526716,-5.1760253982835196e-5,-5.5070471238764245e-8,-0.0020415890123641396,-5.1753638794210315e-5,-5.507496856439569e-8,-0.002041155494939975,-5.168102371657047e-5,-5.501178570621877e-8,-0.0020407401651533347,-5.154474405169965e-5,-5.488278817879703e-8,-0.0020403637204026146,-5.135653343018677e-5,-5.4699684377973364e-8,-0.002040040576882192,-5.113526412477106e-5,-5.448162890443747e-8,-0.002039777091455139,-5.09039490226065e-5,-5.425206240270826e-8,-0.0020395709362431877,-5.068649756636404e-5,-5.4035371776647424e-8,-0.002039411459954195,-5.050467571637247e-5,-5.385385724355181e-8,-0.002039280756574348,-5.037542727193322e-5,-5.372512326084712e-8,-0.0020391552857087123,-5.030852534711591e-5,-5.365977061904039e-8,-0.0020390080427771986,-5.030447590753775e-5,-5.365921376204627e-8,-0.002038811568452725,-5.0352607930303213e-5,-5.3713516384989046e-8,-0.0020385424324039243,-5.042973944197244e-5,-5.379970190700536e-8,-0.0020381875739485158,-5.050077044952324e-5,-5.388206675784495e-8,-0.0020377516616928775,-5.052330199125621e-5,-5.391680200972993e-8,-0.0020372625651711995,-5.045802416725423e-5,-5.386277190055731e-8,-0.0020367698775526524,-5.028392416035833e-5,-5.3697376840582164e-8,-0.0020363321435952564,-5.001196000452072e-5,-5.34308014077663e-8,-0.0020359951521852593,-4.968703486004547e-5,-5.310816086035136e-8,-0.0020357726478473404,-4.937288418461528e-5,-5.279414480895378e-8,-0.0020356419556401216,-4.9126855995544544e-5,-5.2547399322285394e-8,-0.002035556684070434,-4.897959533240644e-5,-5.2399885499866514e-8,-0.0020354668174017705,-4.892970414356411e-5,-5.2351307750795756e-8,-0.0020353344578759418,-4.8951698867931034e-5,-5.237686688565701e-8,-0.0020351402813209166,-4.900893595997211e-5,-5.2440021527677685e-8,-0.0020348825479860966,-4.906468718670452e-5,-5.250353037457378e-8,-0.0020345726105927375,-4.908894182699448e-5,-5.253641005057569e-8,-0.002034229863541913,-4.906144649731033e-5,-5.251727392128725e-8,-0.002033877432711455,-4.897243922319491e-5,-5.2435389666249733e-8,-0.002033538711092817,-4.882223756648143e-5,-5.2290488844127926e-8,-0.002033234470164266,-4.8620156756388854e-5,-5.2091736421230884e-8,-0.0020329804185158853,-4.838285072517303e-5,-5.185597492180308e-8,-0.0020327852353072594,-4.813206614562613e-5,-5.160531630998899e-8,-0.002032649254192641,-4.789178910703803e-5,-5.136415864036497e-8,-0.00203256409568354,-4.7684964149517676e-5,-5.115586867184493e-8,-0.002032513412831578,-4.7530207576543425e-5,-5.099954932398015e-8,-0.0020324746777436327,-4.743890663944881e-5,-5.0907215491822745e-8,-0.002032421864725609,-4.741298395352246e-5,-5.088156196373777e-8,-0.002032328861343699,-4.744359026821503e-5,-5.091451930689139e-8,-0.002032173443614939,-4.7510913626487626e-5,-5.098678990055797e-8,-0.002031941783002499,-4.75853718193778e-5,-5.106873150905396e-8,-0.0020316332829377146,-4.763092567556373e-5,-5.112349305662727e-8,-0.002031264678451989,-4.7611506845454626e-5,-5.111354889776993e-8,-0.0020308711459007655,-4.7500835256465015e-5,-5.101094070015697e-8,-0.002030501384939176,-4.7293891553481265e-5,-5.0809346057054425e-8,-0.0020302046550841244,-4.7015069114082157e-5,-5.053271389164446e-8,-0.002030012417735536,-4.6715860633814e-5,-5.023306514824246e-8,-0.0020299237206302333,-4.645858056483108e-5,-4.997393446583235e-8,-0.002029904534219609,-4.629246101907128e-5,-4.980599835191041e-8,-0.0020299027081861383,-4.6235733219535855e-5,-4.974874457112798e-8,-0.0020298691085456756,-4.6273355836021885e-5,-4.9787942532947575e-8,-0.002029772836986357,-4.6368492929145236e-5,-4.9886997870461254e-8,-0.0020296053518841788,-4.6478270704142267e-5,-5.0002696473796485e-8,-0.0020293762284797076,-4.6565779984025805e-5,-5.009732090515303e-8,-0.0020291058975264805,-4.660586503998099e-5,-5.0144678766039385e-8,-0.0020288190745721122,-4.658611551409667e-5,-5.013139050785385e-8,-0.0020285401833065263,-4.650544482721242e-5,-5.0055709880198454e-8,-0.0020282905163081324,-4.637198758862261e-5,-4.9925521941264115e-8,-0.0020280863812595215,-4.6201017541421475e-5,-4.975620376898143e-8,-0.002027937697407739,-4.6012910954525015e-5,-4.95684364968778e-8,-0.0020278468548150497,-4.5830932166805734e-5,-4.938584335030445e-8,-0.0020278079352926354,-4.5678563130217145e-5,-4.923225233991149e-8,-0.0020278066732735607,-4.5576287146234076e-5,-4.9128512005390405e-8,-0.0020278216052989797,-4.553814792964579e-5,-4.908913495339701e-8,-0.0020278266184087235,-4.5568694544187735e-5,-4.91192941943901e-8,-0.0020277947861438816,-4.566099727855335e-5,-4.921277950752152e-8,-0.0020277030598136164,-4.579640243999685e-5,-4.9351559556919325e-8,-0.0020275370670149273,-4.5946459644631754e-5,-4.950743825762933e-8,-0.0020272951641109476,-4.6077038467505365e-5,-4.964594133297112e-8,-0.0020269909380996286,-4.615441491887575e-5,-4.9732349917762104e-8,-0.002026653192492816,-4.615293081887066e-5,-4.973956903588067e-8,-0.002026322209052732,-4.606314805429271e-5,-4.965671815932576e-8,-0.0020260414134917063,-4.5898197313257225e-5,-4.949598467985722e-8,-0.002025845064816443,-4.569487890022771e-5,-4.929407616837752e-8,-0.0020257453978966516,-4.550622741121225e-5,-4.9104815330766504e-8,-0.0020257254701901042,-4.538541867435896e-5,-4.898274157296879e-8,-0.0020257433889951937,-4.536680350718691e-5,-4.89636608578841e-8,-0.0020257476215753702,-4.5453789008186565e-5,-4.905208248604179e-8,-0.002025695654193513,-4.562012774480506e-5,-4.922225373647776e-8,-0.0020255663701208917,-4.582262170758979e-5,-4.943082479997011e-8,-0.0020253618227586557,-4.6016984020625265e-5,-4.963283638283841e-8,-0.00202510099803616,-4.6169328034816214e-5,-4.979343944742674e-8,-0.002024811017417274,-4.626077683867761e-5,-4.989278000082901e-8,-0.002024519795827304,-4.6286832571634604e-5,-4.992561400738215e-8,-0.0020242514862415977,-4.625433913083903e-5,-4.989840752411386e-8,-0.002024024252686185,-4.617810969109077e-5,-4.982595556164917e-8,-0.0020238493406938953,-4.607808430854788e-5,-4.972841725462505e-8,-0.0020237306112493255,-4.597702408116703e-5,-4.96288581956967e-8,-0.002023664162763472,-4.589834984431947e-5,-4.955099750636145e-8,-0.0020236381094273855,-4.586365827157764e-5,-4.951673189348936e-8,-0.0020236329502209293,-4.5889656355000434e-5,-4.954314934249165e-8,-0.002023623153744319,-4.5984715081919234e-5,-4.963915423232379e-8,-0.0020235804546441657,-4.6145777376813115e-5,-4.980235686787022e-8,-0.002023478863220688,-4.635676148666589e-5,-5.0017332271608656e-8,-0.0020233006158513526,-4.658965624449702e-5,-5.025648223081647e-8,-0.002023041531229927,-4.6808945440860525e-5,-5.048423155390615e-8,-0.0020227139642913913,-4.6978896318268104e-5,-5.066420578545552e-8,-0.002022346013528821,-4.7072161309276584e-5,-5.0767917079637096e-8,-0.002021976583923614,-4.7077557162162256e-5,-5.0782829172766134e-8,-0.002021646938817805,-4.700482993717928e-5,-5.071753209060727e-8,-0.0020213903373314294,-4.688457071627136e-5,-5.060204845365824e-8,-0.00202122225761361,-4.676225438165741e-5,-5.048208770780828e-8,-0.002021134399579563,-4.668682793085823e-5,-5.040757499631068e-8,-0.0020210955157597492,-4.66964938733245e-5,-5.041810897949245e-8,-0.002021060207166187,-4.680660727557303e-5,-5.053039604591645e-8,-0.0020209831787395298,-4.700501284627893e-5,-5.073317426465869e-8,-0.0020208331782008873,-4.7257207541469374e-5,-5.0992163914768974e-8,-0.002020600749527367,-4.751873684499668e-5,-5.126249359928724e-8,-0.002020297495132843,-4.7748817668834114e-5,-5.150253416122725e-8,-0.002019949045350994,-4.791973032907616e-5,-5.168357842505219e-8,-0.002019586148214338,-4.801998291591459e-5,-5.1793273968425187e-8,-0.0020192374342056386,-4.8052601996660434e-5,-5.183409256541799e-8,-0.002018925159106304,-4.8031175323490096e-5,-5.181942050354247e-8,-0.0020186634942643855,-4.797571811880198e-5,-5.1769350061628944e-8,-0.002018458307559683,-4.7909321720409155e-5,-5.17071934570522e-8,-0.0020183074793059634,-4.7855657746552463e-5,-5.1656878184229704e-8,-0.0020182012242393878,-4.783688725574289e-5,-5.164083264519561e-8,-0.0020181224346406887,-4.7871384574551e-5,-5.167777089044754e-8,-0.002018047515893418,-4.797092449356852e-5,-5.177995991815182e-8,-0.0020179484270965854,-4.813745696818201e-5,-5.1950004632217014e-8,-0.0020177966111187182,-4.836022705575067e-5,-5.217785319666721e-8,-0.0020175689778127058,-4.861471743161788e-5,-5.243952149084699e-8,-0.0020172549083493363,-4.886518940475764e-5,-5.2699404555608824e-8,-0.0020168618491771245,-4.9071739379400246e-5,-5.291720278700551e-8,-0.0020164165457899337,-4.920074189090056e-5,-5.305839885690176e-8,-0.0020159601254947663,-4.923537724905972e-5,-5.310497994930823e-8,-0.0020155377782343923,-4.9182101111894395e-5,-5.3062208619770655e-8,-0.0020151863264922898,-4.9070186505180795e-5,-5.2958496549887175e-8,-0.0020149239683831454,-4.894424255995497e-5,-5.28381974040878e-8,-0.002014745466484543,-4.8852234007670655e-5,-5.2749744360003565e-8,-0.002014623980385843,-4.8832737442584404e-5,-5.2732795661562924E-08,-0.0020145187675945538,-4.8905033515197663e-5,-5.2807996323674024e-8,-0.002014386463354211,-4.9064737170752646e-5,-5.297217537397421e-8,-0.0020141926071653754,-4.928613889269881e-5,-5.3200321420099145e-8,-0.002013919923050992,-4.953032530867741e-5,-5.3453543629696204e-8,-0.002013571006866503,-4.975617191211685e-5,-5.369014468097558e-8,-0.0020131652167542056,-4.993046123284049e-5,-5.3875992139383384e-8,-0.002012731692604997,-5.0034158097124634e-5,-5.399109718532883e-8,-0.0020123014742402913,-5.0063845602625036e-5,-5.403129483295887e-8,-0.00201190121087524,-5.002933955111049e-5,-5.4005977959494064e-8,-0.002011549521326985,-4.994945558883987e-5,-5.393385164637899e-8,-0.002011255743455944,-4.984764678639762e-5,-5.383846809376056e-8,-0.0020110201985696686,-4.974843179222414e-5,-5.374453985485008e-8,-0.002010835083772604,-4.9674777295965575e-5,-5.367526613695328e-8,-0.0020106854277154628,-4.964606496865315e-5,-5.365032901804489e-8,-0.0020105500400673802,-4.9676073962541255e-5,-5.3683953076972764e-8,-0.0020104028617102853,-4.9770593190928885e-5,-5.3782559234610896e-8,-0.0020102154280196164,-4.992472116898015e-5,-5.39419945769669e-8,-0.002009961203093299,-5.01205774324166e-5,-5.4145045648848874e-8,-0.0020096220475094026,-5.032702956215601e-5,-5.436091558231032e-8,-0.0020091956873586328,-5.0503577918817376e-5,-5.454893403638213e-8,-0.0020087010935627442,-5.060963041617747e-5,-5.466782814365228e-8,-0.0020081776870822868,-5.06175125618987e-5,-5.468889528583259e-8,-0.0020076760813480246,-5.052404157729019e-5,-5.4607820427235687e-8,-0.0020072426309083852,-5.03543523152836e-5,-5.444874990717472e-8,-0.0020069043511348767,-5.015493124700536e-5,-5.42575575233768e-8,-0.0020066610667815107,-4.997871174697851e-5,-5.40871357697118e-8,-0.0020064875013838,-4.98690470565664e-5,-5.3981449732444325e-8,-0.0020063429428621477,-4.9848723760962696e-5,-5.396442162152271e-8,-0.0020061836818402717,-4.991653940438004e-5,-5.40361687618578e-8,-0.0020059740082301832,-5.005060728795719e-5,-5.4175883241144576e-8,-0.0020056933781890086,-5.021595398427699e-5,-5.434910207886136e-8,-0.0020053390005447076,-5.037374382076034e-5,-5.4516829286568113e-8,-0.0020049242019915922,-5.048986269802197e-5,-5.464425732666e-8,-0.0020044736538592134,-5.054119841472836e-5,-5.470733410760349e-8,-0.0020040170112563204,-5.0518666909647305e-5,-5.469609132681992e-8,-0.002003582651521957,-5.0426916644760484e-5,-5.461455429534083e-8,-0.002003192848389794,-5.028151267800684e-5,-5.4477987905210974e-8,-0.0020028610069787686,-5.010484787898947e-5,-5.430874706071043e-8,-0.0020025908720933084,-4.992194480586509e-5,-5.413196542421391e-8,-0.0020023771463984017,-4.9756918400443195e-5,-5.3971933421660555e-8,-0.002002206808863418,-4.963034306888264e-5,-5.384945799572805e-8,-0.0020020606277349035,-4.955729195151486e-5,-5.3779965287491494e-8,-0.002001914752160842,-4.9545629165052306e-5,-5.377186303277142e-8,-0.0020017426370449094,-4.959424701946217e-5,-5.382477021649585e-8,-0.0020015178700865826,-4.9691252782268014e-5,-5.392756337052816e-8,-0.002001218597218113,-4.981272984636775e-5,-5.4056892268100934e-8,-0.0020008337756181305,-4.9923598500677135e-5,-5.417780009747694e-8,-0.002000370096206164,-4.998267559890689e-5,-5.4248682766537245e-8,-0.0019998563334538166,-4.995319905600739e-5,-5.423191853970226e-8,-0.0019993405058199324,-4.981692900508882e-5,-5.4108211202206056e-8,-0.0019988771595501596,-4.958544642961348e-5,-5.388813032255459e-8,-0.001998508235516319,-4.930060305686856e-5,-5.361273486836377e-8,-0.0019982470792282445,-4.902112276864653e-5,-5.3340329163181614e-8,-0.001998074636703137,-4.880149849864028e-5,-5.31255233957502e-8,-0.0019979490776461596,-4.867431780069525e-5,-5.300163018068865e-8,-0.001997822100817167,-4.864355803151583e-5,-5.2973805172126e-8,-0.0019976535169998273,-4.8688691267618395e-5,-5.3022777123200866e-8,-0.001997419552504148,-4.8774601604832057e-5,-5.311433704727912e-8,-0.001997114744774493,-4.8862226688571974e-5,-5.320970261330998e-8,-0.0019967494607951706,-4.891701856579829e-5,-5.3273961127601174e-8,-0.0019963452028423133,-4.8914377496388965e-5,-5.328171644965104e-8,-0.0019959291743273603,-4.884227819040176e-5,-5.3220032150562435e-8,-0.0019955289872912786,-4.870151669163586e-5,-5.3088954045228216e-8,-0.001995168161878916,-4.850401085939419e-5,-5.289994962557313e-8,-0.0019948628903654394,-4.8269744288963775e-5,-5.267284224427861e-8,-0.0019946202670904343,-4.8023026531601735e-5,-5.2431967802807096e-8,-0.0019944379707342885,-4.7788675113880514e-5,-5.220224766362233e-8,-0.0019943051797844005,-4.7588659781935926e-5,-5.200579146376313e-8,-0.0019942042706509,-4.743954711749449e-5,-5.1859386167826104e-8,-0.001994112859914415,-4.735069680607469e-5,-5.1772781475901097e-8,-0.001994006037341234,-4.732295848864623e-5,-5.1747440313270875e-8,-0.001993858894812306,-4.7347710668200726e-5,-5.177551950964653e-8,-0.0019936496579878314,-4.740627635058635e-5,-5.18390919640976e-8,-0.001993363861819001,-4.7470190253398286e-5,-5.1910146838977426e-8,-0.0019929996205191062,-4.7503541595903896e-5,-5.195272017060764e-8,-0.0019925728195238626,-4.746902878186876e-5,-5.1928915188607375e-8,-0.001992119310680294,-4.7338527946317814e-5,-5.1809644671995214e-8,-0.001991689987214206,-4.710613654808492e-5,-5.1587956392584026e-8,-0.0019913363447532006,-4.6797293437381455e-5,-5.128838764343941e-8,-0.0019910904742861894,-4.6465669201456026e-5,-5.096398901617266e-8,-0.001990950368197197,-4.617513909028325e-5,-5.067840830528089e-8,-0.0019908806466250022,-4.5975167125504204e-5,-5.048140368418561e-8,-0.0019908285309041696,-4.5883747649525306e-5,-5.039181646697579e-8,-0.0019907446103717484,-4.588605349155747e-5,-5.039601315964357e-8,-0.0019905972795608703,-4.59456274268961e-5,-5.045866854053545e-8,-0.0019903769307380295,-4.601920467643337e-5,-5.053718566759492e-8,-0.001990092573971516,-4.60683822052351e-5,-5.059317403618827e-8,-0.0019897653271612717,-4.6066023946311286e-5,-5.059894157366422e-8,-0.0019894219047486518,-4.5998288524238066e-5,-5.0539804388693425e-8,-0.001989089388356069,-4.5864029542767294e-5,-5.041380553085208e-8,-0.001988791342582684,-4.5672889943786124e-5,-5.023002279694939e-8,-0.0019885450270769787,-4.544267119758317e-5,-5.000598811628438e-8,-0.001988359611822744,-4.519623780012269e-5,-4.9764511439258186e-8,-0.001988235373861473,-4.4958196634044265e-5,-4.9530237154278555e-8,-0.001988163874878257,-4.475155292368226e-5,-4.932622435749737e-8,-0.0019881291494703197,-4.4594624487372946e-5,-4.917088069716583e-8,-0.0019881097672433527,-4.449860634103792e-5,-4.907562319610449e-8,-0.0019880814361664893,-4.446599676205845e-5,-4.9043404078743095e-8,-0.001988019896370336,-4.448984902371915e-5,-4.90679788963876e-8,-0.0019879040251158317,-4.455382789815783e-5,-4.9133842968146527e-8,-0.001987719144006088,-4.463316087772778e-5,-4.921694042093964e-8,-0.001987460558236463,-4.46967620556441e-5,-4.9286514917244204e-8,-0.0019871370966062707,-4.471122399257981e-5,-4.9308929889939364e-8,-0.0019867735413332,-4.464753053386993e-5,-4.925440944020967e-8,-0.0019864096922321078,-4.449046879624519e-5,-4.910667619111871e-8,-0.001986093293887148,-4.424847454638656e-5,-4.887310764941467e-8,-0.0019858657165408035,-4.395851101024967e-5,-4.858986252843164e-8,-0.0019857444502105696,-4.36793761172567e-5,-4.831531748591886e-8,-0.0019857123157436644,-4.3471892985409506e-5,-4.811032585031551e-8,-0.001985722442942424,-4.3374678707536145e-5,-4.801403302963816e-8,-0.001985717837909519,-4.3389861516746215e-5,-4.802953349265059e-8,-0.0019856536347009303,-4.348657983914437e-5,-4.812711300883761e-8,-0.001985509793314366,-4.3617293200771854e-5,-4.826016677840372e-8,-0.001985291041141802,-4.373551017512467e-5,-4.8382599589213666e-8,-0.001985018982825112,-4.380710889702349e-5,-4.8460059289153266e-8,-0.00198472269519155,-4.381413163467009e-5,-4.8473904889146595e-8,-0.0019844313817317153,-4.3753602107519224e-5,-4.8420335013601454e-8,-0.0019841698777690116,-4.3634265418978614e-5,-4.830740886578302e-8,-0.00198395631013117,-4.347308097731399e-5,-4.815167459106861e-8,-0.00198380093609794,-4.32920529085931e-5,-4.7974972464015794e-8,-0.0019837056325942176,-4.311530044265703e-5,-4.7801388949448075e-8,-0.0019836639326078916,-4.2966205027643966e-5,-4.765430103584804e-8,-0.0019836616788419274,-4.2864560277764126e-5,-4.755351001687462e-8,-0.0019836784835310212,-4.2823816969524074e-5,-4.75125667742844e-8,-0.0019836901334029686,-4.284880913635948e-5,-4.753661876885519e-8,-0.0019836717844280323,-4.293443985340406e-5,-4.7621167559884083e-8,-0.001983601577361672,-4.306561983656408e-5,-4.775195443764006e-8,-0.00198346427639853,-4.321860830029743e-5,-4.79061064744248e-8,-0.001983254503428399,-4.3363817575379086e-5,-4.805466061004061e-8,-0.001982979128261479,-4.3470011868281195e-5,-4.8166508580713625e-8,-0.0019826583317162807,-4.350982227820718e-5,-4.8213806615591725e-8,-0.0019823245270563744,-4.346642997860529e-5,-4.817876549475533e-8,-0.0019820179079688013,-4.334055689306835e-5,-4.806092503305833e-8,-0.0019817776241884424,-4.315546627647395e-5,-4.788249609663614e-8,-0.001981629243341138,-4.295622121243347e-5,-4.768788218876515e-8,-0.00198157253207564,-4.279964969343516e-5,-4.753376447678903e-8,-0.0019815768110193243,-4.273555993575656e-5,-4.747031671641675e-8,-0.0019815896914275643,-4.2786939561310826e-5,-4.752132323658576e-8,-0.001981556964728314,-4.294065163758243e-5,-4.767470277125102e-8,-0.001981442898715948,-4.315455768342111e-5,-4.788935301045354e-8,-0.001981239994932547,-4.337586664281439e-5,-4.811318043326988e-8,-0.001980965615592369,-4.3559380683812036e-5,-4.830112897720887e-8,-0.001980651104271411,-4.3677669740602314e-5,-4.842535724700544e-8,-0.001980330622165264,-4.37224614567855e-5,-4.8476842035870866e-8,-0.001980033601616317,-4.370082309922366e-5,-4.846185712372692e-8,-0.001979781186553916,-4.362987461869388e-5,-4.8396913373778846e-8,-0.0019795853426471683,-4.35321462310607e-5,-4.8304189751421825e-8,-0.001979449164923876,-4.343211096476673e-5,-4.8208004801788516e-8,-0.001979367516891493,-4.335355049589747e-5,-4.81320762404166e-8,-0.0019793277939190233,-4.331724667908914e-5,-4.8097157631997425e-8,-0.0019793109779484602,-4.333865671006025e-5,-4.811875302716466e-8,-0.00197929334115372,-4.342552864224307e-5,-4.8204839307820454e-8,-0.0019792491585166726,-4.3575840607934675e-5,-4.835390191602501e-8,-0.0019791544719827683,-4.377676979296662e-5,-4.855390559455163e-8,-0.0019789914659854206,-4.400538864917376e-5,-4.878285284376596e-8,-0.001978752618067997,-4.423151487384888e-5,-4.9011380729146134e-8,-0.001978443571552841,-4.442266642057841e-5,-4.920743293376487e-8,-0.0019780837559768326,-4.455044155192306e-5,-4.93424419569069e-8,-0.001977704189216635,-4.459716325964112e-5,-4.9397956177720134e-8,-0.0019773423735596264,-4.4561466986321577e-5,-4.937141684655841e-8,-0.001977034607825835,-4.446140319979623e-5,-4.927959934097138e-8,-0.0019768066566202684,-4.433345001834858e-5,-4.915798984075471e-8,-0.0019766648048065616,-4.422600808807836e-5,-4.905454320636164e-8,-0.001976590642014865,-4.418718038152136e-5,-4.901754862575995e-8,-0.0019765433922679146,-4.424941926591262e-5,-4.908018505043689e-8,-0.0019764714799322142,-4.441704193678446e-5,-4.924782281001948e-8,-0.0019763299672662825,-4.466351711965738e-5,-4.949503779025665e-8,-0.0019760958592488333,-4.494111748014449e-5,-4.9774988214425593e-8,-0.001975773776278894,-4.519821653836421e-5,-5.003649186587927e-8,-0.001975390495162118,-4.539533451112828e-5,-5.0239976118785304e-8,-0.0019749831859174212,-4.551335871876182e-5,-5.0365773681986254e-8,-0.0019745879207018306,-4.555320514137526e-5,-5.041400386812903e-8,-0.0019742323786003236,-4.553037719774458e-5,-5.039938833552872e-8,-0.0019739331147513276,-4.5468406296927464e-5,-5.03448680797245e-8,-0.001973695819172792,-4.539349471122782e-5,-5.0276287499947574e-8,-0.0019735168135767726,-4.533089935511781e-5,-5.0218721062822205e-8,-0.0019733846944876474,-4.5302611923024283e-5,-5.019408501320979e-8,-0.0019732817668098417,-4.532562487218592e-5,-5.021939519624579e-8,-0.0019731854504376916,-4.5410207074392044e-5,-5.0305107394665245e-8,-0.0019730701622044603,-4.5557997564901036e-5,-5.045329830787116e-8,-0.001972910223039121,-4.576026673732602e-5,-5.0655959638034884e-8,-0.001972684031500541,-4.5997198476817514E-05,-5.0894198826261366e-8,-0.001972379090884328,-4.623929153514652e-5,-5.113944114811148e-8,-0.001971996635686588,-4.6451727228890164e-5,-5.135753400078218e-8,-0.0019715539766186102,-4.660160044857538e-5,-5.1515737334611745e-8,-0.0019710828542270687,-4.6666477609024985e-5,-5.159115485388241e-8,-0.001970623298040414,-4.664162896085638e-5,-5.1578016403124346e-8,-0.001970214212090245,-4.65432620191606e-5,-5.1491151948029e-8,-0.001969883242927487,-4.6406229230851866e-5,-5.1364075446337285e-8,-0.001969638857557791,-4.627639846031354e-5,-5.124174919757445e-8,-0.001969467008160238,-4.6199420166105754e-5,-5.116961866658035e-8,-0.0019693336914688433,-4.6208627966382286e-5,-5.1181552597747694e-8,-0.001969193371546135,-4.631535486871011e-5,-5.128996338486575e-8,-0.0019690015104308046,-4.650497733936632e-5,-5.148150977961362e-8,-0.001968727504736385,-4.6740821064600386e-5,-5.172064567922468e-8,-0.001968363316252578,-4.697522012612561e-5,-5.196041523031695e-8,-0.00196792440570595,-4.71636765838571e-5,-5.2156492160433425e-8,-0.001967443051877653,-4.727655930735045e-5,-5.227890703313716e-8,-0.0019669575953292872,-4.730437768201357e-5,-5.2317472555509746e-8,-0.0019665022928231123,-4.7256201646844035e-5,-5.228042290007389e-8,-0.0019661009362071376,-4.715377406937989e-5,-5.218873377314962e-8,-0.0019657647779907092,-4.702464970878444e-5,-5.206938544394163e-8,-0.001965493477560509,-4.689660585321579e-5,-5.194979398067257e-8,-0.001965277377825799,-4.6794002474408414e-5,-5.185413345399812e-8,-0.001965099914950498,-4.67357278760477e-5,-5.1801254050097615e-8,-0.0019649396611614903,-4.673397854378611e-5,-5.180348656861776e-8,-0.0019647721014879383,-4.6793187059781656e-5,-5.186563289514447e-8,-0.0019645716558417217,-4.690878647692816e-5,-5.1983771468773974e-8,-0.0019643145874512157,-4.706604455706395e-5,-5.214404907793817e-8,-0.001963983213520618,-4.7239795327600476e-5,-5.232226406608289e-8,-0.0019635711534783046,-4.7396399391850306e-5,-5.248560550378622e-8,-0.0019630881783210172,-4.749923158841316e-5,-5.2597912011238834e-8,-0.0019625620385825687,-4.7517783547080394e-5,-5.262860028092075e-8,-0.001962034600536159,-4.743810866143697e-5,-5.2563034466538445e-8,-0.001961551663459193,-4.7270187530390955e-5,-5.2409958425237556e-8,-0.0019611493437624405,-4.7047867070956564e-5,-5.2201684891901307e-8,-0.0019608425118726406,-4.682012526184868e-5,-5.198578136085175e-8,-0.001960620223510975,-4.663679110534357e-5,-5.1811253235307756e-8,-0.00196044964691645,-4.65343886842311e-5,-5.1714684022350806e-8,-0.001960286244385532,-4.652696232149927e-5,-5.171103424799668e-8,-0.0019600861987816276,-4.660393314075276e-5,-5.1791161198884274e-8,-0.001959817384072231,-4.673447845393499e-5,-5.192571546679343e-8,-0.0019594663672666632,-4.687647620848606e-5,-5.207366237327364e-8,-0.0019590402013480103,-4.69873681531962e-5,-5.219291849091948e-8,-0.0019585630459199917,-4.7034093216261266e-5,-5.2250281015410575e-8,-0.0019580689434451474,-4.699963912862847e-5,-5.222813797470916e-8,-0.001957593098636109,-4.6884855780413277E-05,-5.212650982795257e-8,-0.0019571642607120374,-4.6705755925512453e-5,-5.196056523166988e-8,-0.001956800031936092,-4.648795164335014e-5,-5.175520387715332e-8,-0.0019565055327110657,-4.626040613743492e-5,-5.1538868280151164e-8,-0.001956274664949442,-4.605019885705157e-5,-5.133830575689433e-8,-0.0019560927255029953,-4.587904903303501e-5,-5.117507505063576e-8,-0.001955939273522816,-4.5761480824035993e-5,-5.106372503209461e-8,-0.00195579066288265,-4.570401845100373e-5,-5.101104052329391e-8,-0.001955622211363207,-4.570476038673568e-5,-5.101566680936453e-8,-0.001955410378080181,-4.575298140689403e-5,-5.1067700552761083e-8,-0.0019551355106216866,-4.5828851541139104e-5,-5.114829612455283e-8,-0.0019547856381423576,-4.590392133545704e-5,-5.122995115968192e-8,-0.001954361197611504,-4.594364275569868e-5,-5.127880370114713e-8,-0.001953879361532978,-4.591336545457481e-5,-5.126044894606853e-8,-0.001953375159198017,-4.5788157126795125e-5,-5.114965466945004e-8,-0.0019528960573228693,-4.556404200060815e-5,-5.094156483201756e-8,-0.0019524888638265663,-4.52650121756844e-5,-5.0658773399677315e-8,-0.0019521829510683111,-4.493969555783338e-5,-5.03482415102804e-8,-0.001951978224705543,-4.4646436883604996e-5,-5.006686001308755e-8,-0.0019518449631389671,-4.4433199757164185e-5,-4.9861909053352045e-8,-0.0019517355290165363,-4.43223575013476e-5,-4.9756164208185047e-8,-0.0019516011374687279,-4.430667685873654e-5,-4.9743737900243164e-8,-0.0019514058087092413,-4.4355660121435736e-5,-4.979589561049797e-8,-0.0019511334488388776,-4.442707829644108e-5,-4.987196748279403e-8,-0.0019507882121724506,-4.4478635729643045e-5,-4.993057447552316e-8,-0.0019503903208332868,-4.447687118184344e-5,-4.9938400968221414e-8,-0.0019499696523796678,-4.440237013879302e-5,-4.9875550740711113e-8,-0.0019495587983859016,-4.425144642123595e-5,-4.973750799595954e-8,-0.0019491867583722598,-4.403481674939329e-5,-4.953408613857425e-8,-0.001948874170726926,-4.3773966244990976e-5,-4.928597425302703e-8,-0.0019486306854478142,-4.3496186610003896e-5,-4.901984567298104e-8,-0.0019484545808215287,-4.322941742227304e-5,-4.876319520040075e-8,-0.0019483342448092852,-4.299784164805793e-5,-4.853991498678627e-8,-0.0019482508367361243,-4.281882578092175e-5,-4.8367249272998264E-08,-0.0019481813406516451,-4.2701332047739913e-5,-4.8254265238426306e-8,-0.001948101431884755,-4.2645465612550796e-5,-4.820147285858156e-8,-0.0019479880023605153,-4.2642663695294445e-5,-4.820104258643957e-8,-0.0019478215084132696,-4.267621983914629e-5,-4.823725928348993e-8,-0.0019475884766814169,-4.2722120831818105e-5,-4.8287176766687065e-8,-0.001947284537476418,-4.2750605376743135e-5,-4.832193112023108e-8,-0.0019469179020162252,-4.272943149953421e-5,-4.830978464674593e-8,-0.001946512130701754,-4.2629987351193034e-5,-4.8222103668448865e-8,-0.0019461057920909896,-4.243645483759409e-5,-4.804249139879382e-8,-0.0019457459924259364,-4.2155871844775294e-5,-4.777688442978733e-8,-0.001945474433914433,-4.182357814670306e-5,-4.745909633402526e-8,-0.0019453099923769398,-4.149726260691403e-5,-4.7145127891331156e-8,-0.0019452376149965635,-4.123797713130104e-5,-4.689469161507122e-8,-0.0019452123501192205,-4.108646923628689e-5,-4.67481344270079e-8,-0.0019451775408544185,-4.104846697515171e-5,-4.671199913017461e-8,-0.001945086305653114,-4.10964890190002e-5,-4.67605464329462e-8,-0.00194491498170104,-4.118420798055841e-5,-4.6849415350206084e-8,-0.0019446649566739968,-4.1263439193324884e-5,-4.693190382853436e-8,-0.0019443564891179575,-4.129638690638195e-5,-4.6970831215838533e-8,-0.001944019871009889,-4.126124977537125e-5,-4.694416268183079e-8,-0.0019436874568431314,-4.115267744009283e-5,-4.6845757576426216e-8,-0.0019433878283089455,-4.097933082895468e-5,-4.668329117893592e-8,-0.0019431420227587768,-4.076018683375537e-5,-4.64748293924473e-8,-0.001942961425049852,-4.052037587530838e-5,-4.624478413720799e-8,-0.001942847090506267,-4.028693694379081e-5,-4.6019666043409794e-8,-0.001942790358890472,-4.008483999357206e-5,-4.5824064376144906e-8,-0.0019427745871054582,-3.9933607897037706e-5,-4.5677259981585586e-8,-0.0019427777616891982,-3.984486508728241e-5,-4.559083113158273e-8,-0.0019427755865315058,-3.982107608163827e-5,-4.556748866183424e-8,-0.0019427445679542873,-3.985544668643988e-5,-4.5601049016244416e-8,-0.0019426648249855798,-3.9932722126588916e-5,-4.5677213148583996e-8,-0.0019425225723483325,-4.003067731752825e-5,-4.577491057145826e-8,-0.00194231231186212,-4.0122223590998573e-5,-4.586815250812175e-8,-0.001942038840723702,-4.017825071467646e-5,-4.592859500544757e-8,-0.0019417189403766162,-4.017172995117602e-5,-4.592943591477745e-8,-0.0019413817963929902,-4.0083668653272205e-5,-4.5851299075569445e-8,-0.0019410663758636533,-3.9910612776753746e-5,-4.5689797651230024e-8,-0.0019408138567119492,-3.9671609827259084e-5,-4.546263553447091e-8,-0.0019406546006421536,-3.941021451110704e-5,-4.52117972507066e-8,-0.001940593319235403,-3.918608994782784e-5,-4.499543804327817e-8,-0.0019406012767298,-3.905498590278002e-5,-4.486832358067523e-8,-0.001940623920404477,-3.904542284858823e-5,-4.4859006867683975e-8,-0.0019406025544464632,-3.914639483061919e-5,-4.495769578301747e-8,-0.001940497520876102,-3.931411884703988e-5,-4.512260307194805e-8,-0.001940299698239888,-3.949212761192832e-5,-4.5299254342045724e-8,-0.0019400271696272137,-3.9631546521015266e-5,-4.5440050246729585e-8,-0.0019397134945464904,-3.970249901148748e-5,-4.55153769119164e-8,-0.0019393955892964717,-3.969592038203203e-5,-4.551557626730208e-8,-0.0019391053846128947,-3.961966037424788e-5,-4.544745102453445e-8,-0.0019388656601532564,-3.9492805816283906e-5,-4.532898685003671e-8,-0.0019386887618311728,-3.9340423201373115e-5,-4.518433473733331e-8,-0.0019385768153243493,-3.9189313030825355e-5,-4.5039624737876385e-8,-0.0019385226755074644,-3.9064588188579694e-5,-4.491950007652083e-8,-0.0019385113945777103,-3.89868350713039e-5,-4.4844233237342264e-8,-0.0019385222021650083,-3.8969763524809525e-5,-4.48273957066787e-8,-0.0019385310528990875,-3.9018436577778017e-5,-4.4874176736247263E-08,-0.001938513684450707,-3.912838732750907e-5,-4.498060099930697e-8,-0.0019384488723173468,-3.928589530112374e-5,-4.51338353807561e-8,-0.001938321483040145,-3.946943857740446e-5,-4.531354277085539e-8,-0.0019381250107120861,-3.965222629013153e-5,-4.5494184057548586e-8,-0.0019378633026130548,-3.9805684583894356e-5,-4.5648196322549064e-8,-0.0019375512317700392,-3.990367219926965e-5,-4.574992768613837e-8,-0.0019372141057675222,-3.9927275177831916e-5,-4.5780279834495175e-8,-0.0019368852732491004,-3.987006414845319e-5,-4.573198875575406e-8,-0.0019366009982821448,-3.9743041431457964e-5,-4.561474398462704e-8,-0.001936392008214114,-3.9577268369624826e-5,-4.545806912288991e-8,-0.0019362725887905185,-3.9421116423997146e-5,-4.530885190760244e-8,-0.0019362308367980837,-3.93293215936308e-5,-4.522070434461868e-8,-0.0019362265448863605,-3.934447117414749e-5,-4.5235796012735197e-8,-0.0019362021567699314,-3.947831204143984e-5,-4.5366449130396565e-8,-0.0019361044622756712,-3.9704499044345756e-5,-4.558787687093552e-8,-0.0019359055467726995,-3.9969038024905696e-5,-4.5848165191453386e-8,-0.001935610918476163,-4.0212436952495197e-5,-4.608967212085328e-8,-0.0019352522767100955,-4.0390248298052926e-5,-4.626892936144965e-8,-0.001934872343550989,-4.04826572347339e-5,-4.636602580928481e-8,-0.0019345110162189247,-4.0492973987788945e-5,-4.6383349171738214e-8,-0.0019341974042064007,-4.0440353373262014e-5,-4.633877244453355e-8,-0.00193394745527741,-4.035183976460438e-5,-4.6258113992407355e-8,-0.0019337648831009675,-4.025623586702828e-5,-4.6169223646382756e-8,-0.001933643297940725,-4.018010690860001e-5,-4.6098017218746215e-8,-0.0019335684391845415,-4.014524819687492e-5,-4.606588963420782e-8,-0.0019335202829593439,-4.016691288990378e-5,-4.608791074426844e-8,-0.001933475196842574,-4.025240778009302e-5,-4.617145854048994e-8,-0.0019334084174011334,-4.039999941699849e-5,-4.6315210257224784e-8,-0.0019332970460884604,-4.0598441631085976e-5,-4.6508730328468455e-8,-0.0019331234337040622,-4.0827636234276635e-5,-4.67330881859333e-8,-0.0019328784570221483,-4.1060782189105156e-5,-4.69628242270068e-8,-0.001932564016748744,-4.126806268614148e-5,-4.716934132885776e-8,-0.0019321940512386387,-4.14215942181376e-5,-4.732552837106896e-8,-0.001931793485630655,-4.1500945427768556e-5,-4.741103326315836e-8,-0.0019313948975945483,-4.149824340283206e-5,-4.741729676503009e-8,-0.0019310330346188518,-4.142188515293687e-5,-4.7351395895912765e-8,-0.0019307375352558293,-4.1297801414388954e-5,-4.723760067108958e-8,-0.0019305246932332914,-4.116693684145903e-5,-4.711522060800814e-8,-0.0019303901558369954,-4.107771840039374e-5,-4.7031429532281454e-8,-0.001930305702440573,-4.1073507327231025e-5,-4.70290097302363e-8,-0.001930223661133537,-4.117772149833033e-5,-4.71316652941459e-8,-0.0019300904151773313,-4.1382707713134946e-5,-4.733292449466249e-8,-0.0019298652063116251,-4.1649473063614e-5,-4.7595646288971316e-8,-0.0019295353407003367,-4.192078311450537e-5,-4.786461098057043e-8,-0.0019291195029987889,-4.214178037375372e-5,-4.8086494979264673e-8,-0.0019286581510240075,-4.227740391874418e-5,-4.822680388860586e-8,-0.0019281977027044515,-4.23190945630982e-5,-4.827648982478889e-8,-0.001927776949794641,-4.228093381957044e-5,-4.8248402386580654e-8,-0.0019274200721663662,-4.219051722902683e-5,-4.8168652620736966e-8,-0.001927135772707496,-4.20798850584923e-5,-4.8067954346620734e-8,-0.0019269198332215003,-4.197912027142969e-5,-4.797542280744417e-8,-0.0019267586318278405,-4.1912777277154615e-5,-4.7915023022203665e-8,-0.0019266323173630316,-4.189820026513446e-5,-4.7903834928403336e-8,-0.0019265173637764677,-4.194471819140883e-5,-4.795122144177823e-8,-0.0019263888011234276,-4.205308385953557e-5,-4.805829680961167e-8,-0.0019262225974915343,-4.221501646557592e-5,-4.821751718558146e-8,-0.0019259985568891125,-4.2413183674726635e-5,-4.8412658231367925e-8,-0.0019257037357562376,-4.262227688328076e-5,-4.861977364178274e-8,-0.0019253358507307667,-4.281183412618318e-5,-4.88097763412886e-8,-0.0019249056464002532,-4.295109158693287e-5,-4.895296804974039e-8,-0.00192443696510101,-4.3015405547280085e-5,-4.9025146674251664e-8,-0.001923963576351099,-4.299286159649854e-5,-4.901401418858055e-8,-0.0019235227456985294,-4.288907110417211e-5,-4.892397352513479e-8,-0.0019231466972611288,-4.2728295806226845e-5,-4.8777489495455956e-8,-0.0019228540148536525,-4.2549887097491935e-5,-4.861195243355361e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_10.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_10.json deleted file mode 100644 index 65406353..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_10.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":10000,"numberOfSamples":1000,"samples":[1.9197471616856318e-4,7.996600532056201e-6,-1.2597360486632112e-8,1.923979354906972e-4,8.059544161443208e-6,-1.2601754449986743e-8,1.9274745963100852e-4,8.18217092448731e-6,-1.2612185701149495e-8,1.9301410614298842e-4,8.328459694631899e-6,-1.2625220207854334e-8,1.9320200661086356e-4,8.46367290461882e-6,-1.263746635903232e-8,1.933256574311564e-4,8.557979990756902e-6,-1.264596926377846e-8,1.9340729897750835e-4,8.588749871695277e-6,-1.2648467217789009e-8,1.9347454382165973e-4,8.54234886551231e-6,-1.2643575641672086e-8,1.9355780445299317e-4,8.41580428718647e-6,-1.2630935191527253e-8,1.9368703586457032e-4,8.218144650907273e-6,-1.2611321617725655e-8,1.9388759494511673e-4,7.970728457914735e-6,-1.2586673932584885e-8,1.9417557384287807e-4,7.70570255454025e-6,-1.2559972916060515e-8,1.9455353413614596e-4,7.461994170668981e-6,-1.2534909842557773e-8,1.950079268750979e-4,7.278838435440244e-6,-1.2515320800328438e-8,1.9550946566497787e-4,7.1877009230743185e-6,-1.250443183656935e-8,1.9601716991058025e-4,7.204296880679899e-6,-1.2504049076168112e-8,1.964858622143666e-4,7.322751895738212e-6,-1.2513893072518937e-8,1.9687601817327312e-4,7.513719443070609e-6,-1.2531293180978063e-8,1.9716418145619786e-4,7.727807131336245e-6,-1.255143733487227e-8,1.9735148270881055e-4,7.904972006017888e-6,-1.256828984627858e-8,1.9746717430474582e-4,7.989189307001313e-6,-1.2576107854737417e-8,1.9756414464783983e-4,7.945391162788686e-6,-1.2571208909452543e-8,1.9770522673983343e-4,7.772936988045046e-6,-1.255336219063038e-8,1.9794335851555265e-4,7.508737590816236e-6,-1.2526112219574885e-8,1.9830340643788719e-4,7.216310774252375e-6,-1.2495704511570225e-8,1.9877444051722307e-4,6.9643475770128966e-6,-1.2468991956480241e-8,1.9931605492441463e-4,6.804754497374457e-6,-1.2451273955690413e-8,1.99874367496323e-4,6.7599548302468994e-6,-1.2444993679265321e-8,2.0039900027274713e-4,6.82270849799812e-6,-1.2449629419202722e-8,2.0085428305204736e-4,6.964723431631095e-6,-1.2462470630692901e-8,2.012230129828281e-4,7.147810040913146e-6,-1.2479705950981818e-8,2.015048844233702e-4,7.3331078822919305e-6,-1.2497376827881843e-8,2.0171260728942556e-4,7.4869143007848404e-6,-1.2512018298014086e-8,2.0186784837753266e-4,7.583663846056725e-6,-1.2521002574264202e-8,2.0199788115223623e-4,7.6072954724533325e-6,-1.252268798054521e-8,2.0213287762151582e-4,7.552075776678594e-6,-1.25164799413586e-8,2.023032713093168e-4,7.423389313956485e-6,-1.250287524528341e-8,2.025365492604393e-4,7.238354929979809e-6,-1.2483501654253962e-8,2.0285312487000682e-4,7.025543178481034e-6,-1.2461102098633864e-8,2.032615548180566e-4,6.822697696785637e-6,-1.2439358398961576e-8,2.037542292355152e-4,6.671464949679808e-6,-1.2422433892723618e-8,2.043054648544205e-4,6.609017340781519e-6,-1.241418367286807e-8,2.0487402079284614e-4,6.658061470286973e-6,-1.2417141084804209e-8,2.0541091916908847e-4,6.8183286453880834e-6,-1.2431576848491557e-8,2.0587131297464264e-4,7.063148440915905e-6,-1.2455025250029365e-8,2.0622704282800456e-4,7.343452105811302e-6,-1.2482583077772363e-8,2.064756840198449e-4,7.598950788494315e-6,-1.2508013979414962e-8,2.0664282168786132e-4,7.773572333271332e-6,-1.2525372054527937e-8,2.0677643799377142e-4,7.830732911241555e-6,-1.2530654293509096e-8,2.069346139971509e-4,7.763969732585166e-6,-1.252297208136234e-8,2.0716968071363143e-4,7.599507240572051e-6,-1.2504868071919612e-8,2.075133831394106e-4,7.389324388835024e-6,-1.2481637303243253e-8,2.079680047158014e-4,7.196295440443784e-6,-1.2459822238997104e-8,2.0850678511286473e-4,7.076223630712314e-6,-1.2445361216516968e-8,2.09083353603553e-4,7.063208010991012e-6,-1.2442027977015235e-8,2.0964607359171694e-4,7.163288146015455e-6,-1.245068068918884e-8,2.1015153998119444e-4,7.357300167494584e-6,-1.2469466055778998e-8,2.105729208467013e-4,7.6098914082299795e-6,-1.2494715588623496e-8,2.1090206952705673e-4,7.880059152858419e-6,-1.2522068534104855e-8,2.1114705135521922e-4,8.129688725332927e-6,-1.2547426277362978e-8,2.11327623932954e-4,8.328785948689606e-6,-1.2567558359396523e-8,2.1147063027153733e-4,8.45781981905388e-6,-1.2580371063842255e-8,2.116062170779773e-4,8.508318739735103e-6,-1.2584953522756101e-8,2.1176489219544155e-4,8.482821664273282e-6,-1.2581533889456395e-8,2.1197487908306462e-4,8.394780190546323e-6,-1.2571439050506965e-8,2.1225908578335732e-4,8.268336110121104e-6,-1.2557075378613995e-8,2.1263125815806694e-4,8.137282943263268e-6,-1.2541867403695375e-8,2.1309149641396343e-4,8.042041677157666e-6,-1.2530015745409708e-8,2.1362232923984473e-4,8.023413973770414e-6,-1.2525906367685887e-8,2.141877185477536e-4,8.112834049185048e-6,-1.2533095524318957e-8,2.1473774581068903e-4,8.3210914871919e-6,-1.2553050116063849e-8,2.1522011129794914e-4,8.630080126066386e-6,-1.2584142235542132e-8,2.1559591766686086e-4,8.992908412392393e-6,-1.2621531987775295e-8,2.1585357677476676e-4,9.344915051726786e-6,-1.2658284937238318e-8,2.1601416666211921e-4,9.622593263837225e-6,-1.2687427039128446e-8,2.1612534488552648e-4,9.78287653756447e-6,-1.2704087855205246e-8,2.1624652249650514e-4,9.81514982519467e-6,-1.2706860844017089e-8,2.1643148366610137e-4,9.742398905621779e-6,-1.2697982257149455e-8,2.1671439125053968e-4,9.612686075077394e-6,-1.2682472194826136e-8,2.1710262618754617e-4,9.484942883597433e-6,-1.2666663487275253e-8,2.1757724992220657e-4,9.413689438536168e-6,-1.2656583095773519e-8,2.180998881122663e-4,9.436636301726828e-6,-1.2656579120301334e-8,2.1862349866680082e-4,9.567821662343242e-6,-1.2668481926430359e-8,2.1910382506955763e-4,9.797254291937394e-6,-1.2691451235088495e-8,2.1950852180187367e-4,1.0096209406878957e-5,-1.2722473686840802e-8,2.1982203208259762e-4,1.0425814221374339e-5,-1.2757289563240955e-8,2.2004593990235762e-4,1.0746017377170483e-5,-1.279141904043139e-8,2.2019594725035345e-4,1.1022697089033848e-5,-1.2821004358988786e-8,2.2029723714439854e-4,1.1231954282858246e-5,-1.284332207805951e-8,2.2037976133546005e-4,1.1361792925413278e-5,-1.285697045584737e-8,2.204743050715671e-4,1.1412058566647195e-5,-1.2861837839761607e-8,2.2060942735678435e-4,1.139360836886871e-5,-1.2858986747465736e-8,2.2080886496210573e-4,1.1327297175898568e-5,-1.2850546480647196e-8,2.2108883199633075e-4,1.1242779422350658e-5,-1.2839626876663463e-8,2.2145479727229533e-4,1.117656313941561e-5,-1.2830179748791994e-8,2.218978524119614e-4,1.1168241380550244e-5,-1.2826654765479383e-8,2.223918274118358e-4,1.125368271022084e-5,-1.2833271066266854e-8,2.2289360923823234e-4,1.1454892795233024e-5,-1.2852838922138324e-8,2.2334970247736352e-4,1.1768728623398749e-5,-1.288537714386462e-8,2.2371036423718345e-4,1.2159917386077626e-5,-1.2927189221052759e-8,2.2394786325905398e-4,1.2565129918165497e-5,-1.2971236046903973e-8,2.2407012789687003e-4,1.2910776320851335e-5,-1.3009149058543156e-8,2.2412080512659326e-4,1.3138423398335554e-5,-1.3034156281509835e-8,2.2416403518024246e-4,1.3225258584550226e-5,-1.3043432270151873e-8,2.242617193073924e-4,1.31895428771349e-5,-1.303873108036752e-8,2.244545122747121e-4,1.3080514119203897e-5,-1.302529805681681e-8,2.247533541484739e-4,1.2960154137190002e-5,-1.3009918312410972e-8,2.2514149681588606e-4,1.288542370013457e-5,-1.2999015386017868e-8,2.2558304221404233e-4,1.2896057941767493e-5,-1.2997297157850649e-8,2.2603369392279116e-4,1.3009117176953077e-5,-1.3007061790201875e-8,2.264507770082446e-4,1.3219243737167519e-5,-1.3028087674737915e-8,2.2680097981678127e-4,1.3502917845584759e-5,-1.3057987443448877e-8,2.2706512925085745e-4,1.3825112165154655e-5,-1.3092899943215674e-8,2.2723980182644377e-4,1.4146844760246526e-5,-1.312835960370297e-8,2.2733606659061404e-4,1.4432176615984899e-5,-1.316015072754668e-8,2.2737613010144923e-4,1.4653552288310205e-5,-1.3184975709050629e-8,2.2738889061095103e-4,1.4794967275872633e-5,-1.3200846957566375e-8,2.2740539458427508e-4,1.485298630857986e-5,-1.3207200828708261e-8,2.2745491914188558e-4,1.48361020505556e-5,-1.3204810600297655e-8,2.2756189301271438e-4,1.4763163136429955e-5,-1.3195611648549548e-8,2.2774342945347363e-4,1.4661392768367974e-5,-1.318251654013457e-8,2.2800711646406744e-4,1.4564073938727435e-5,-1.3169225227622847e-8,2.2834878588194946e-4,1.4507553748530596e-5,-1.3159958692847593e-8,2.287503519544513e-4,1.4526782542924386e-5,-1.3158983635572145e-8,2.2917872878590236e-4,1.4648464790645952e-5,-1.3169782666393387e-8,2.2958798770619958e-4,1.4881779191418465e-5,-1.3193861131791164e-8,2.2992738155013117e-4,1.5208892056563145e-5,-1.3229487616666131e-8,2.3015629354228862e-4,1.5580637661667213e-5,-1.3271075564489491e-8,2.3026234150305317e-4,1.5924292688085457e-5,-1.331008459441756e-8,2.3027280889853033e-4,1.6165999528322054e-5,-1.3337725131374554e-8,2.3024916735463958e-4,1.6259694822258185e-5,-1.3348408049319169e-8,2.3026415545918469e-4,1.6206222473384533e-5,-1.334196191813377e-8,2.303737207873722e-4,1.6050930760160185e-5,-1.3323325049974134e-8,2.3059936656605264e-4,1.586282236461781e-5,-1.3300188674521488e-8,2.309273397309413e-4,1.5709080036263402e-5,-1.328019137069129e-8,2.3131987266427655e-4,1.5637160807724585e-5,-1.3268952807786755e-8,2.3172978464227394e-4,1.5668110115491378e-5,-1.3269276372437528e-8,2.3211253167230013e-4,1.579838872190477e-5,-1.3281222326984168e-8,2.3243381968418038e-4,1.6005968044664794e-5,-1.3302645758738719e-8,2.326732628860945e-4,1.6257565449448583e-5,-1.3329918467555854e-8,2.3282524674238283e-4,1.651551762610959e-5,-1.3358697686405669e-8,2.3289788056306504e-4,1.674381866600482e-5,-1.3384673664069943e-8,2.3291052997145164e-4,1.6913063406322665e-5,-1.3404220672953126e-8,2.3289032072172143e-4,1.700401500413197e-5,-1.3414875180816028e-8,2.3286803858424185e-4,1.7009620439693355e-5,-1.3415595856352999e-8,2.328739025738482e-4,1.6935397883075238e-5,-1.3406804390503862e-8,2.3293373693946084e-4,1.6798289595216762e-5,-1.3390246403408823e-8,2.3306590757557672e-4,1.6624355851294292e-5,-1.3368746419574027e-8,2.3327907598190837e-4,1.6445739810291813e-5,-1.334591547674048e-8,2.3357067709120252e-4,1.6297106752196225e-5,-1.3325815392409889e-8,2.3392604926032666e-4,1.621152078481189e-5,-1.3312532903507163e-8,2.3431832644508823e-4,1.6215461539974096e-5,-1.3309583151627188e-8,2.3470981296471905e-4,1.6322593851986297e-5,-1.3319074542987742e-8,2.350563586266793e-4,1.6526652827706943e-5,-1.3340700335972787e-8,2.3531635632917516e-4,1.6795606538324656e-5,-1.3370882993466678e-8,2.3546449597391608e-4,1.7071515543042718e-5,-1.3402687449686616e-8,2.3550651143611578e-4,1.7281479296035646e-5,-1.3427194538859864e-8,2.354860662292638e-4,1.736119067195648e-5,-1.3436455207389577e-8,2.354745423562714e-4,1.7282664410910297e-5,-1.3426879119078932e-8,2.3554413988636483e-4,1.7069422488256228e-5,-1.340100684306105e-8,2.3573843359821594e-4,1.678735137254538e-5,-1.3366380140959267e-8,2.3605794175604995e-4,1.6516440745440828e-5,-1.333226482032832e-8,2.364666128436858e-4,1.6321330128306323e-5,-1.3306309980540544e-8,2.369106704107837e-4,1.6235316784717564e-5,-1.329272307712745e-8,2.373372411284009e-4,1.6259841608278305e-5,-1.3292124623119489e-8,2.3770594596677692e-4,1.6372931299750227e-5,-1.3302373390412671e-8,2.37993246071328e-4,1.6539681380754335e-5,-1.3319651568231e-8,2.3819211939730327e-4,1.6721074059761234e-5,-1.3339438365960858e-8,2.3830961030271236e-4,1.6880231173799742e-5,-1.335727306140373e-8,2.3836375681855868e-4,1.6986636247061285e-5,-1.3369334013755532e-8,2.3838035533166568e-4,1.701905501777484e-5,-1.33728675782703e-8,2.383895323005555e-4,1.6967478698558967e-5,-1.3366467989198284e-8,2.38422070556946e-4,1.6834089647268072e-5,-1.3350197399653409e-8,2.3850556570700744e-4,1.6633066038275236e-5,-1.3325545739040455e-8,2.3866072662191243e-4,1.6388979589520194e-5,-1.32952356240298e-8,2.3889832942241776e-4,1.613376763873816e-5,-1.3262897145540119e-8,2.3921726251748584e-4,1.5902571416136462e-5,-1.3232645062727092e-8,2.3960391772207974e-4,1.5728837101970084e-5,-1.3208572512056224e-8,2.4003306897066437e-4,1.5639090729009958e-5,-1.3194159292205045e-8,2.4047031694471747e-4,1.5647770280759835e-5,-1.3191601366742145e-8,2.408763192909911e-4,1.5752441997243236e-5,-1.320109658813078e-8,2.4121332685415593e-4,1.593012198481269e-5,-1.3220221033409507e-8,2.414543324312317e-4,1.6136500786482835e-5,-1.3243695130072412e-8,2.4159379503856346e-4,1.631092961927605e-5,-1.3263965868818756e-8,2.416563493402631e-4,1.6389819439386743e-5,-1.327294423034196e-8,2.416971351728686e-4,1.6327839253466488e-5,-1.3264745691624821e-8,2.4178793488179986e-4,1.611933231700696e-5,-1.323839068662466e-8,2.4199092390150611e-4,1.580664719687679e-5,-1.3198809867441091e-8,2.4233282522947923e-4,1.546635588883893e-5,-1.315515486800695e-8,2.42795161206397e-4,1.5179028049018296e-5,-1.3117189496490207e-8,2.4332560646111933e-4,1.5000197877739287e-5,-1.3091844309906427e-8,2.4386095630435782e-4,1.494730909943296e-5,-1.3081612462610715e-8,2.443476230301867e-4,1.5004081626133282e-5,-1.3084945993000656e-8,2.447521154769013e-4,1.513382584235183e-5,-1.3097713318885834e-8,2.4506227529865664e-4,1.529290726155764e-5,-1.3114741963102495e-8,2.4528352222681816e-4,1.5440210476210758e-5,-1.3130971246521739e-8,2.454337577216843e-4,1.554235342838633e-5,-1.3142157207141877e-8,2.4553879145722154e-4,1.5576059836117717e-5,-1.3145250706278301e-8,2.456286535961741e-4,1.5529165859651303e-5,-1.313858102750454e-8,2.4573440156436537e-4,1.5401067537156352e-5,-1.312192399297445e-8,2.4588495016140917e-4,1.5202739157127264e-5,-1.3096479904399723e-8,2.4610367254958987e-4,1.4956012999883382e-5,-1.3064759078539774e-8,2.4640490122437197e-4,1.4691580503364029e-5,-1.3030343464314749e-8,2.467909300514352e-4,1.444531172938255e-5,-1.299749108332309e-8,2.472503716788958e-4,1.4252978327617077e-5,-1.2970574858005676e-8,2.4775861981413225e-4,1.4143991993889015e-5,-1.2953383025503955e-8,2.482808292580495e-4,1.4135196216785739e-5,-1.2948356913590524e-8,2.4877732410946555e-4,1.4225995061342692e-5,-1.295589775406787e-8,2.492108317402965e-4,1.439598151292376e-5,-1.297390984283666e-8,2.495546496005041e-4,1.4605934664835293e-5,-1.2997753852338253e-8,2.4980058126312243e-4,1.4802976706468473e-5,-1.3020791083393111e-8,2.499648122532091e-4,1.4930522578149964e-5,-1.3035648974352602e-8,2.500889719183307e-4,1.4942625206491755e-5,-1.3036141981384923e-8,2.502332948927713e-4,1.4819937637970325e-5,-1.301942657528763e-8,2.5046053996871437e-4,1.458121681939785e-5,-1.2987549154608683e-8,2.508142835955966e-4,1.4282610184457833e-5,-1.294739872783118e-8,2.513011655620707e-4,1.4000896174505066e-5,-1.2908626141535389e-8,2.5188749805877945e-4,1.3806467779425598e-5,-1.288027326783674e-8,2.5251290861910285e-4,1.3739666020847875e-5,-1.286777210466249e-8,2.531129543478528e-4,1.3801980509944972e-5,-1.2871727408598455e-8,2.5363851477171943e-4,1.3963248403024858e-5,-1.288867324663838e-8,2.5406475771490327e-4,1.4177059797621997e-5,-1.2912910633960826e-8,2.543902585935145e-4,1.4395467555977205e-5,-1.2938351134914312e-8,2.5463093937902145e-4,1.457846819591566e-5,-1.295977796036463e-8,2.54813136638039e-4,1.4698160028561238e-5,-1.2973461632588474e-8,2.54967981581639e-4,1.4739503755468211e-5,-1.2977324579518188e-8,2.551274405562864e-4,1.4699654562096109e-5,-1.2970877284779953e-8,2.5532142348084824e-4,1.4587027197628657e-5,-1.2955077061468487e-8,2.5557518672666003e-4,1.4420380583572636e-5,-1.2932175481281603e-8,2.5590650103593743e-4,1.4227567224019883e-5,-1.2905548350362233e-8,2.5632253366152845e-4,1.4043212860365394e-5,-1.287943866108471e-8,2.568170361656435e-4,1.3904585536052271e-5,-1.285851192094646e-8,2.5736901125437294e-4,1.384542362248093e-5,-1.2847155402873307e-8,2.5794421239109947e-4,1.388843946076878e-5,-1.2848556465930347e-8,2.5850035030317047e-4,1.403829277109537e-5,-1.2863749847957166e-8,2.589956924459188e-4,1.4277505943607658e-5,-1.2890953907157057e-8,2.5939924357184515e-4,1.4567459494134127e-5,-1.2925525776831505e-8,2.596996993209261e-4,1.4855178454192225e-5,-1.2960705554380696e-8,2.5991041763439313e-4,1.5084813281586183e-5,-1.2989066766874659e-8,2.6006856585053105e-4,1.5211326349834672e-5,-1.3004361087109885e-8,2.602278725687631e-4,1.5213126500508729e-5,-1.3003294012197764e-8,2.6044583194747623e-4,1.5100107540589441e-5,-1.2986715711409487e-8,2.607678954750293e-4,1.4913817381501574e-5,-1.2959760458590743e-8,2.6121309337834975e-4,1.471789554231206e-5,-1.2930675613196354e-8,2.617666739936158e-4,1.4580147819581488e-5,-1.2908507750034461e-8,2.623838952785086e-4,1.4551998820653167e-5,-1.2900372867353652e-8,2.6300436611455946e-4,1.465364176688067e-5,-1.2909389577639032e-8,2.6357084573760297e-4,1.4871017273617807e-5,-1.293411963262422e-8,2.640443869669923e-4,1.5164543154651873e-5,-1.2969586613798102e-8,2.64410737769705e-4,1.548385098723045e-5,-1.3009177614068972e-8,2.6467821443590807e-4,1.5781554620764703e-5,-1.304650817055167e-8,2.648707916531887e-4,1.602193715049497e-5,-1.3076659266674922e-8,2.650204220774552e-4,1.6184189121099728e-5,-1.309668323525758e-8,0.00026516090400317594,1.626199634794566e-5,-1.3105583832666333e-8,2.653238016446657e-4,1.626157432670227e-5,-1.3104045518856175e-8,2.6553584872296177e-4,1.619953400725645e-5,-1.3094120073806924e-8,2.6581694404772865e-4,1.6101034287601604e-5,-1.3078966785871532e-8,2.6617803512994057e-4,1.599792643257314e-5,-1.3062635061321467e-8,2.666186743112128e-4,1.5926127147520803e-5,-1.3049789195619948e-8,2.671247177812508e-4,1.5921303481340893e-5,-1.3045222202262528e-8,2.6766743265218185e-4,1.6012313493671894e-5,-1.3053032308258361e-8,2.682058449019524e-4,1.6212993883764293e-5,-1.3075494404843321e-8,2.6869381754198406e-4,1.6514662380160417e-5,-1.3111934310112453e-8,2.690915392547794e-4,1.688312459406304e-5,-1.3158158531168263e-8,2.693782808806831e-4,1.726356887424719e-5,-1.3206971608799833e-8,2.695612194819721e-4,1.7593764377538284e-5,-1.3249899145305468e-8,2.696757969225932e-4,1.7821710710339604e-5,-1.3279603194733367e-8,2.697766262792751e-4,1.7921174890309415e-5,-1.3292069257397106e-8,2.699221571586634e-4,1.7899381168918985e-5,-1.3287759748585721e-8,2.701585140051222e-4,1.7794662659770487e-5,-1.3271427248333769e-8,2.7050743193193414e-4,1.7665574219650932e-5,-1.3250774476406711e-8,2.70961263500747e-4,1.7575149467220522e-5,-1.3234415117476824e-8,2.714859046544607e-4,1.7574737909080554e-5,-1.3229680863399421e-8,2.7203052331977687e-4,1.769170100835547e-5,-1.324083414757745e-8,2.7254117585821244e-4,1.7924189075479015e-5,-1.3268167506586092e-8,2.729741997691505e-4,1.8244128847031433e-5,-1.3308232751599827e-8,2.733054105239225e-4,1.860683481743521e-5,-1.335506308671976e-8,2.7353289682521516e-4,1.896345349760831e-5,-1.3401893664246537E-08,2.73673842637392e-4,1.9271996265799993e-5,-1.3442759869942829e-8,2.737578282615282e-4,1.9504213337008058e-5,-1.3473535503050086e-8,2.738194967147241e-4,1.9647848480923535e-5,-1.3492301040760689e-8,2.7389256852830313e-4,1.9705491001702175e-5,-1.3499197079042159e-8,2.740058704701865e-4,1.9691777654711647e-5,-1.3496023246278775e-8,2.741810262902575e-4,1.9630334079578346e-5,-1.3485807494797274e-8,2.744310131178127e-4,1.9551058078948304e-5,-1.347245824705066e-8,2.747588655876082e-4,1.948759434125028e-5,-1.3460484076347776e-8,2.7515620852405575e-4,1.9474357175009086e-5,-1.3454669802832967e-8,2.7560192124283077e-4,1.954221941430565e-5,-1.3459536895858992e-8,2.760620815654129e-4,1.9712188518429024e-5,-1.3478446229307413e-8,2.764931140341487e-4,1.998747860898367e-5,-1.3512381587099931e-8,2.768499825458415e-4,2.0346447047745347e-5,-1.3558791588758346e-8,2.7709934818909317e-4,2.0740975236487897e-5,-1.3611211001438215e-8,2.7723376707050325e-4,2.1104902391710272e-5,-1.3660381144345922e-8,2.7727951721184677e-4,2.1372977512600064e-5,-1.3696942301516698e-8,2.7729156569639065e-4,2.150364337470411e-5,-1.371469511192883e-8,2.7733590146886866e-4,2.1494482605572527e-5,-1.3712813986364758e-8,2.7746730910535865e-4,2.1382407878183956e-5,-1.3695935779833347e-8,2.777129170467314e-4,2.1229571564400812e-5,-1.3672319050985458e-8,2.7806720281447627e-4,2.1102980963536406e-5,-1.3651166775522754e-8,2.7849753778370835e-4,2.105639774177976e-5,-1.3640203101975407e-8,2.7895571606205595e-4,2.1119312740397868e-5,-1.36440855384151e-8,2.7939082054513723e-4,2.129380639205303e-5,-1.3663777942921247e-8,2.797602560487331e-4,2.155785003144518e-5,-1.3696778046641539e-8,2.8003725820557e-4,2.1872858482824725e-5,-1.3738005196123418e-8,2.802142004107094e-4,2.219328394309847e-5,-1.3781099702460829e-8,2.8030175709160225e-4,2.2476143948988695e-5,-1.381982555271776e-8,2.8032472939190016e-4,2.268859947612066e-5,-1.3849251125167231e-8,2.803159812312574e-4,2.2812371570131774e-5,-1.386647093141835e-8,2.803101183459111e-4,2.2844791364820303e-5,-1.387080182051307e-8,2.8033821087907477e-4,2.2797146171930603e-5,-1.3863552789390385e-8,2.8042420340903043e-4,2.2691458727297488e-5,-1.3847561307081722e-8,2.8058292600206835e-4,2.2556824850266946e-5,-1.3826691726476474e-8,2.8081916298474405e-4,2.2425953925453616e-5,-1.3805403994071266e-8,2.8112721903985157e-4,2.2331951025042324e-5,-1.3788383591687185e-8,2.8149066344888076e-4,2.2304951530066296e-5,-1.3780134438421739e-8,2.8188238547674434e-4,2.2367947560152177e-5,-1.3784386060479597e-8,2.822658721965546e-4,2.2531246589409013e-5,-1.380320444288144e-8,2.8259936195518845e-4,2.278597036190299e-5,-1.38358812243578e-8,2.828444569445365e-4,2.3098866508920356e-5,-1.3877999412904191e-8,2.82979105364523e-4,2.341279564136978e-5,-1.3921401485040897e-8,2.8301103748081484e-4,2.3657751771110462e-5,-1.3955814384309308e-8,2.8298340770177647e-4,2.37731328817469e-5,-1.3972176264270338e-8,2.8296484207766603e-4,2.3733029889624773e-5,-1.3966353021702428e-8,2.830249037760498e-4,2.3559828091315065e-5,-1.3941085550751729e-8,2.832073180871705e-4,2.331632681640619e-5,-1.3904875495648811e-8,2.8351576155621184e-4,2.308077284889224e-5,-1.3868553787955135e-8,2.8391769853862014e-4,2.2919547763551398e-5,-1.384157822144315e-8,2.8436019434869387e-4,2.287017449835268e-5,-1.3829694080640847e-8,2.847876469600927e-4,2.2937814065198065e-5,-1.3834319348602738e-8,2.8515485284144533e-4,2.3101223801610495e-5,-1.3853146215244e-8,2.85433793371567e-4,2.332264590269975e-5,-1.3881308460203237e-8,2.856153143340677e-4,2.3557815709961442e-5,-1.3912679492992264e-8,2.857074693224336e-4,2.3764383273789843e-5,-1.3941085356826256e-8,2.8573186713930584e-4,2.390828726211465e-5,-1.3961325891680267e-8,2.857188696819171e-4,2.39679560926046e-5,-1.3969911360196299e-8,2.8570231452007376e-4,2.3936257400670855e-5,-1.3965439487283113e-8,2.857144182944666e-4,2.382028199606721e-5,-1.394860030825303e-8,2.8578147687363805e-4,2.3639260037550102e-5,-1.3921869960500952e-8,2.8592084201393037e-4,2.342114432945347e-5,-1.3889012634409748e-8,2.8613931356911184e-4,2.3198585473751224e-5,-1.3854531958188717e-8,2.864327166543551e-4,2.3004883616430312e-5,-1.3823159470958645e-8,2.867863494363946e-4,2.2870125806672398e-5,-1.3799380523453057e-8,2.8717609388622425e-4,2.2817452101605205e-5,-1.378693317459741e-8,2.8757018441867614e-4,2.2859200077940465e-5,-1.378819562942302e-8,2.8793216925267906e-4,2.2992674449651844e-5,-1.3803413833910311e-8,2.8822619040308e-4,2.3196048522297792e-5,-1.3829891060439484e-8,2.8842548394305867e-4,2.3426397377221117e-5,-1.386152544402009e-8,2.885234854253173e-4,2.362330839766609e-5,-1.3889296541301406e-8,2.885438986592403e-4,2.3721722641275258e-5,-1.3903263102308176e-8,2.885424114376653e-4,2.3674183477913317e-5,-1.3896003696172715e-8,2.885929118709168e-4,2.3474313471584593e-5,-1.3866152311867126e-8,2.8875979009874574e-4,2.316637368653028e-5,-1.3819777847051538e-8,2.890704395776163e-4,2.283074746827438e-5,-1.3768264842029872e-8,2.895049885128943e-4,2.2551813469805068e-5,-1.3723757443181604e-8,2.900082669629545e-4,2.2387357101861408e-5,-1.3694865214262721e-8,2.9051374253208817e-4,2.235489612947439e-5,-1.36846867449533e-8,2.909649021340734e-4,2.2436103025525936e-5,-1.3691271872221072e-8,2.9132650488845045e-4,2.2590621258034392e-5,-1.3709370985045623e-8,2.9158637691061105e-4,2.2770429252790272e-5,-1.3732329579321405e-8,2.917517969683068e-4,2.2930448877807925e-5,-1.3753577653967498e-8,2.9184401188628566e-4,2.303489006955536e-5,-1.3767628184703838e-8,2.918927671925494e-4,2.3060445344766418e-5,-1.3770682898745772e-8,2.919314014291164e-4,2.299749274559909e-5,-1.3760937852867262e-8,2.9199247847638013e-4,2.2849926468667013e-5,-1.3738629102849638e-8,2.921039092862608e-4,2.2633834466347406e-5,-1.370584503210565e-8,2.92285666948327e-4,2.2375057960451114e-5,-1.3666144851793793e-8,2.925473850976914e-4,2.2105676829510934e-5,-1.3624037426111123e-8,2.9288716836903646e-4,2.185972836237773e-5,-1.3584395520403735e-8,2.93291734444017e-4,2.1668667070356885e-5,-1.355186975838904e-8,2.937378250344291e-4,2.1556973898122735e-5,-1.3530315087571015e-8,2.941947974500097e-4,2.1538210800188506e-5,-1.3522214675142932e-8,2.9462828965697827e-4,2.161178421989162e-5,-1.3528102494893166e-8,2.950049836659742e-4,2.176062612107966e-5,-1.3546028771640402e-8,2.9529877895283186e-4,2.1950341406551685e-5,-1.3571220417731373e-8,2.95498425036084e-4,2.2131299035723218e-5,-1.3596256341667975e-8,2.956153580837951e-4,2.22458472466366e-5,-1.361215968484941e-8,2.9568840667843486e-4,2.224225736534045e-5,-1.3610641296881544e-8,2.957800686939963e-4,2.2093977823393965e-5,-1.3587181550703598e-8,2.9595999348482825e-4,2.181678085271199e-5,-1.3543713834794471e-8,2.9627849161117025e-4,2.1471574018712877e-5,-1.3489060449153417e-8,2.9674319322068856e-4,2.1145294614123724e-5,-1.343609251827474e-8,2.9731425733706953e-4,2.09172161107864e-5,-1.3396774613550436e-8,2.9792187015270356e-4,2.082994835974585e-5,-1.3377886272534408e-8,2.984942122206886e-4,2.0880413673918396e-5,-1.3379586077781747e-8,2.989796522647844e-4,2.1030612573302552e-5,-1.3396809617098212e-8,2.993552928593664e-4,2.1226817991504233e-5,-1.3421929704689853e-8,2.9962420917402626e-4,2.141632957853267e-5,-1.3447160232838052e-8,2.998076048709863e-4,2.155742331817498e-5,-1.3466074608348756e-8,2.999366508951447e-4,2.162322261659597e-5,-1.3474303011588651e-8,3.0004605342871587e-4,2.160194083120627e-5,-1.3469704117491014e-8,3.001694758979349e-4,2.1495566477339442e-5,-1.3452259987949643e-8,3.003361714790454e-4,2.131801033581268e-5,-1.34238210598226e-8,3.00568250260884e-4,2.109291783629834e-5,-1.3387751649168571e-8,3.0087835205456256e-4,2.0850953582104578e-5,-1.3348491679679161e-8,3.012678716217725e-4,2.062624812724149e-5,-1.3311032550608233e-8,3.0172620046434173e-4,2.045193589878053e-5,-1.3280308792564854e-8,3.0223147737772435e-4,2.0355180263715515e-5,-1.3260534503027968e-8,3.027530905670879e-4,2.03523675046193e-5,-1.3254528922034592e-8,3.0325589739471393e-4,2.0445234386801097e-5,-1.326309141038214e-8,3.0370584098537583e-4,2.061873537337817e-5,-1.3284535301274032e-8,3.0407635475241393e-4,2.084132023298335e-5,-1.3314523112149486e-8,3.043548220950259e-4,2.106807932262644e-5,-1.334635951759101e-8,3.0454817712909907e-4,2.1247259597402573e-5,-1.337190847136496e-8,3.0468606841306306e-4,2.1330590886984806e-5,-1.338324729373875e-8,3.048190993710789e-4,2.1286814653441683e-5,-1.337492842426596e-8,3.0500947292813136e-4,2.1115405047104646e-5,-1.3346293728374482e-8,3.0531334240780847e-4,2.0854333144826318e-5,-1.330280661991811e-8,3.0575933228971686e-4,2.057446009779354e-5,-1.3255246543245369e-8,3.063336126043048e-4,2.035786012500672e-5,-1.3216390908366007e-8,3.0698195437051866e-4,2.0267933422058764e-5,-1.3196404367399528e-8,3.076297906607286e-4,2.0326989761099988e-5,-1.3199302777510673e-8,3.0820929098613465e-4,2.051301152374637e-5,-1.3222284594361782e-8,3.086790667643346e-4,2.0774250916837253e-5,-1.3257795354211066e-8,3.0902959140693113e-4,2.1050411845724763e-5,-1.3296685507824527e-8,3.0927719251130383e-4,2.1289582840270976e-5,-1.3330825505471842e-8,3.0945357058928e-4,2.145674944124067e-5,-1.33545105445674e-8,3.095961699201846e-4,2.153531284308726e-5,-1.3364818313685573e-8,3.0974146708267824e-4,2.152488868920895e-5,-1.3361368767381744e-8,3.0992097203242546e-4,2.1438017800151246e-5,-1.3345858365688848e-8,3.1015887202686857e-4,2.1297039816659653e-5,-1.3321563576426557e-8,3.1047036154725256e-4,2.1131275414374563e-5,-1.3292871575557973e-8,3.1086020309551777e-4,2.0974113615666323e-5,-1.3264820449894448e-8,0.00031132159469673937,2.0859458460963544e-5,-1.3242589706398116e-8,3.118358892299663e-4,2.08172018406579e-5,-1.3230876462418405e-8,3.123739556176808e-4,2.0867961619606607e-5,-1.3233145002595053e-8,3.1289980273878425e-4,2.1017999708571363e-5,-1.3250835029635484e-8,3.133765322075633e-4,2.1255710514705023e-5,-1.3282711917019378e-8,3.1377389441996034e-4,2.1551170659549085e-5,-1.332461455740315e-8,3.1407592571305155e-4,2.1859774047728385e-5,-1.3369828669154369e-8,3.1428671803730246e-4,2.212997996013805e-5,-1.3410177045357869e-8,3.14432506824964e-4,2.2314131680739853e-5,-1.3437721540724634e-8,3.1455876362506394e-4,2.2380463429616143e-5,-1.3446783871977407e-8,3.1472170043465105e-4,2.2323641852085563e-5,-1.3435813847370838e-8,3.1497476110345693e-4,2.217044112756572e-5,-1.3408494160108003e-8,3.153526234579617e-4,2.1976994096751363e-5,-1.337345682081832e-8,3.1585774444304715e-4,2.1815602165497123e-5,-1.3342262745022897e-8,3.1645594131746787e-4,2.1753230588716412e-5,-1.332596859353312e-8,3.170852855440563e-4,2.1829339986754936e-5,-1.3331486306519194e-8,3.1767609064744373e-4,2.204329336795916e-5,-1.335938578246327e-8,3.1817307131503856e-4,2.2357437282565592e-5,-1.3404182809004631e-8,3.185496252597622e-4,2.2713150253212193e-5,-1.3456770258106373e-8,3.188097318692035e-4,2.305068096859074e-5,-1.350756753269062e-8,3.1898017607109944e-4,2.3324049974074164e-5,-1.3548973772346303e-8,3.1909924742474843e-4,2.3507561072834535e-5,-1.3576520061523686e-8,3.192068961684871e-4,2.359541331330978e-5,-1.3588911123510958e-8,3.1933831976116504e-4,2.3597783076813762e-5,-1.358746123971623e-8,3.1952065880791903e-4,2.3536160980096142e-5,-1.3575362908229614e-8,3.19771579080949e-4,2.3439311888661372e-5,-1.3557025218592592e-8,3.200985885643759e-4,2.3340011786561243e-5,-1.3537543756519094e-8,3.2049846336595103e-4,2.3272031254568778e-5,-1.3522245412330314e-8,3.2095680118528186e-4,2.3266656684082567e-5,-1.3516194501257755e-8,3.214482960990994e-4,2.3348264536126095e-5,-1.3523546070473995e-8,3.219387035953197e-4,2.352905494166589e-5,-1.3546710031825095e-8,3.2238945173181284e-4,2.3803973484541637e-5,-1.3585453917150966e-8,3.2276517284783867e-4,2.414782235178386e-5,-1.3636274656717374e-8,3.2304300787259485e-4,2.4516917684648338e-5,-1.369247871891746e-8,3.2322093588827404e-4,2.4856694790520883e-5,-1.374527463790208e-8,3.2332167991338466e-4,2.5114409674883268e-5,-1.3785796286515207e-8,3.233897052011945e-4,2.525357146846435e-5,-1.3807516666649438e-8,3.2348120921461983e-4,2.5265406266578555e-5,-1.3808261001094046e-8,3.2364963922767976e-4,2.5173284625345988e-5,-1.3791120413398418e-8,3.2393091613960477e-4,2.5028248522414485e-5,-1.3763924450587002e-8,3.243327110819311e-4,2.489645279708152e-5,-1.3737355303383892e-8,3.2483114194985555e-4,2.4841661933600615e-5,-1.3722151158493351e-8,3.253764637315329e-4,2.4907661106982096e-5,-1.3726145974744325e-8,3.2590667505080653e-4,2.5106163518978407e-5,-1.3752074004335538e-8,3.263648743232834e-4,2.5414592771149465e-5,-1.3796943801410434e-8,3.267142644419916e-4,2.5784562274762126e-5,-1.3853232512079237e-8,3.2694560655390203e-4,2.6157379978950974e-5,-1.3911368702242648e-8,3.2707552207375036e-4,2.64802029079398e-5,-1.3962446344578679e-8,3.2713809920406574e-4,2.6717260951139974e-5,-1.4000191368277358e-8,3.2717430412455535e-4,2.685395991046812e-5,-1.4021757723105099e-8,3.272230250199076e-4,2.6895095773412356e-5,-1.4027518182301305e-8,3.273154328546555e-4,2.6859988741622723e-5,-1.4020303863838187e-8,3.27472427946398e-4,2.6777052624059808e-5,-1.4004517409235265e-8,3.2770404819257206e-4,2.667917357422416e-5,-1.3985374637999391e-8,3.2800968800751206e-4,2.6600135622202087e-5,-1.396833964272351e-8,3.283784197698704e-4,2.65715822213231e-5,-1.3958675851617953e-8,3.2878934377281676e-4,2.661975357857392e-5,-1.3960963251046796e-8,3.2921252136175277e-4,2.6761429111553565e-5,-1.397844020247438e-8,3.2961152402647006e-4,2.699907821559547e-5,-1.4012129808211943e-8,3.29948753915105e-4,2.7316263206531952e-5,-1.4059921868231094e-8,3.3019401009220286e-4,2.7675690266479282e-5,-1.4116060189696021e-8,3.303348983515174e-4,2.8023052525526852e-5,-1.417164175112956e-8,3.303851664433875e-4,2.8298564869411255e-5,-1.4216501609523993e-8,3.303858174704456e-4,2.845434313568276e-5,-1.4242167403395092e-8,3.303959416014983e-4,2.847131185450436e-5,-1.424477933710207e-8,3.304753311960585e-4,2.8367701265917583e-5,-1.4226626167552076e-8,3.3066574499633107e-4,2.8194592527739406e-5,-1.4195561924860455e-8,3.3097847333721307e-4,2.8020371048836455e-5,-1.4162617817120332e-8,3.3139229136450047e-4,2.7910733393913838e-5,-1.4138840614943994e-8,3.318610576038761e-4,2.7911418740544573e-5,-1.4132437583694847e-8,3.32327158660616e-4,2.8038257552148033e-5,-1.4146944421067845e-8,3.3273630146328536e-4,2.8275956095937735e-5,-1.4180721826563061e-8,3.3304982043797914e-4,2.8584590280257757e-5,-1.4227750741366778e-8,3.332518772704476e-4,2.8911198090895583e-5,-1.4279413650778645e-8,3.3335044303321585e-4,2.9203016014443303e-5,-1.4326720121414798e-8,3.3337264600420897e-4,2.9418844303718548e-5,-1.4362340255230543e-8,3.333565716870711e-4,2.953593528593423e-5,-1.438192328577023e-8,3.333423100299153e-4,2.955156240787833e-5,-1.4384490907506754e-8,3.333646227280616e-4,2.9480245799448394e-5,-1.4372041376989542e-8,3.3344841055820307e-4,2.9348582447400512e-5,-1.434870041016347e-8,3.3360692534264394e-4,2.9189588504290738e-5,-1.4319770705147037e-8,3.338418939605668e-4,2.903780052882538e-5,-1.429092220642219e-8,3.341445478842576e-4,2.8925502238673784e-5,-1.4267598983776846e-8,3.3449686902692956e-4,2.8879716510260736e-5,-1.4254567192028621e-8,3.34872893630502e-4,2.8919305085978387e-5,-1.4255452413328958e-8,3.3524046998712566e-4,2.905162633610626e-5,-1.4272125495191893e-8,3.3556438983591447e-4,2.926868042533546e-5,-1.4303906971243346e-8,3.358120415655983e-4,2.9543700862908523e-5,-1.4346787820191492e-8,3.359620973953016e-4,2.9830621885824582e-5,-1.4393165436296007e-8,3.3601476557872876e-4,3.0069847654572008e-5,-1.4432765793470925e-8,3.3599911919222826e-4,3.020259394749606e-5,-1.4455159337401374e-8,3.3597110300592314e-4,3.019141034190686e-5,-1.4453385307179457e-8,3.35998526488256e-4,3.00380349093956e-5,-1.4427081304578546e-8,3.3613729850181856e-4,2.9787423935761663e-5,-1.4383225010504009e-8,3.3641053011372276e-4,2.9513350056419022e-5,-1.4333808242876725e-8,3.368014006431015e-4,2.9292449987817804e-5,-1.4291641185111276e-8,3.3726185452744576e-4,2.9179980574871958e-5,-1.4266408426820145e-8,3.377303740186198e-4,2.9197037823386694e-5,-1.4262469364142498e-8,3.3814986945613203e-4,2.9330730888683372e-5,-1.427863436126763e-8,3.3848010158714516e-4,2.9543115154846164e-5,-1.4309336642064932e-8,3.38703273259897e-4,2.9783603206552747e-5,-1.4346471770152776e-8,3.388238715787891e-4,3.0001002317025725e-5,-1.4381352417660723e-8,3.388645512106792e-4,3.015313826145052e-5,-1.4406430035573901e-8,3.388596992978482e-4,3.0213214891368453e-5,-1.441656210821404e-8,3.388480896868653e-4,3.0172579589435465e-5,-1.4409671063513486e-8,3.3886595201610624e-4,3.0040010984943417e-5,-1.4386745775937594e-8,3.389415616773652e-4,2.983826465857231e-5,-1.435129353309962e-8,3.3909197448769624e-4,2.9599024245251944e-5,-1.4308467177209232e-8,3.393219732788287e-4,2.935743690567301e-5,-1.4264115645959442e-8,3.396247872186201e-4,2.9147198599977515e-5,-1.4223960274082391e-8,3.3998384944594585e-4,2.8996680396776103e-5,-1.419298232822601e-8,3.4037497978542483e-4,2.8925994092867653e-5,-1.4174970094013113e-8,3.4076876816749476e-4,2.8944576739562157e-5,-1.4172101451461987e-8,3.4113333363185183e-4,2.9048903134653624e-5,-1.4184452613283302e-8,3.4143806830900614e-4,2.9220259014859665e-5,-1.4209426481068721e-8,3.416592313159679e-4,2.942335957385573e-5,-1.4241300071719586e-8,3.4178768959361645e-4,2.9607879560626548e-5,-1.4271351102299056e-8,3.418373350901813e-4,2.971582378240197e-5,-1.4289150939638257e-8,3.4184996084014505e-4,2.9696727082961728e-5,-1.4285356690807156e-8,3.418902633601011e-4,2.952827110856552e-5,-1.425546855762454e-8,3.420270707706498e-4,2.9232745927517535e-5,-1.4202771104298555e-8,3.4230607491550166e-4,2.8876464783064984e-5,-1.4138250014917669e-8,3.4272891522547444e-4,2.8547270391760742e-5,-1.4076783978948293e-8,3.432521860159393e-4,2.8320914566404532e-5,-1.4031512125887654e-8,3.4380643577638096e-4,2.8235399587572567e-5,-1.4009518407800017e-8,3.4432227839255926e-4,2.8284922903914585e-5,-1.4010681330376893e-8,3.4474989405392577e-4,2.8430706232186193e-5,-1.4029244458375631e-8,3.450667007921132e-4,2.8618389049455682e-5,-1.405649452639386e-8,3.4527564357985356e-4,2.879355388007985e-5,-1.4083250375345564e-8,3.453987654829163e-4,2.8912049121438285e-5,-1.4101646097180218e-8,3.45469585268103e-4,2.894525815503267e-5,-1.4106194425210915e-8,3.4552604642457406e-4,2.8881730901118583e-5,-1.4094281874326899e-8,3.4560455047242703e-4,2.8726431535401165e-5,-1.4066215283106948e-8,3.457351529958053e-4,2.84982490045257e-5,-1.4024875511406945e-8,3.459380666037131e-4,2.8226171437823553e-5,-1.397505116091795e-8,3.462216637718113e-4,2.794459723979762e-5,-1.3922581182171141e-8,3.4658209986642525e-4,2.7688322235778394e-5,-1.3873458405560078e-8,3.4700449561030034e-4,2.748781270498401e-5,-1.3833031101689292e-8,3.474653304988083e-4,2.7365322208472776e-5,-1.3805386540778746e-8,3.479355692431911e-4,2.7332084280176915e-5,-1.3792904236856692e-8,3.483841987506852e-4,2.738651159118678e-5,-1.3795909548384521e-8,3.48782076015223e-4,2.7513276120753096e-5,-1.3812375954175199e-8,3.4910623716508923e-4,2.768327317176719e-5,-1.3837706596348546e-8,3.493450066374296e-4,2.785497909947437e-5,-1.3864767635512509e-8,3.4950380428156456e-4,2.7978582520697178e-5,-1.388452258098352e-8,3.496101796449104e-4,2.800470747307293e-5,-1.3887648902006153e-8,3.4971470295323565e-4,2.7898579782032046e-5,-1.3867255990212172e-8,3.498829672228969e-4,2.7657103890016168e-5,-1.3822133605209417e-8,3.5017591926531956e-4,2.7320571946380355e-5,-1.375894735333673e-8,3.5062370726759924e-4,2.6967510508779796e-5,-1.3691352108885298e-8,3.512076836751679e-4,2.668829415482261e-5,-1.3635359280006073e-8,3.518645594543916e-4,2.6549168451208284e-5,-1.3603044848274974e-8,3.525120860381075e-4,2.6567976763254272e-5,-1.359825241655584e-8,3.530801471377777e-4,2.671440633051558e-5,-1.3616465703002289e-8,3.5353016455276417e-4,2.692942938290615e-5,-1.3647971513994665e-8,3.538577002956241e-4,2.7148881753446637e-5,-1.3681795510084634e-8,3.540840771794443e-4,2.7320151877578618e-5,-1.3708567939664234e-8,3.542449634789241e-4,2.740961864282937e-5,-1.372191839944505e-8,3.543805993034693e-4,2.7403434203548572e-5,-1.3718799059739425e-8,3.545289983413223e-4,2.730498627401825e-5,-1.3699233288566783e-8,3.547216624954893e-4,2.7131303055044464e-5,-1.366581028187246e-8,3.5498087228620824e-4,2.690928730173587e-5,-1.3623050830270064e-8,3.5531797095255416e-4,2.6671814970846222e-5,-1.3576675347345746e-8,3.557325408326314e-4,2.6453572621222732e-5,-1.3532810617513158e-8,3.562126332903402e-4,2.628664184351773e-5,-1.3497191162436568e-8,3.5673629776197384e-4,2.619610347960688e-5,-1.3474416118620455e-8,3.5727449108908464e-4,2.6196233744873596e-5,-1.3467331827186608e-8,3.577951171362706e-4,2.628789151186731e-5,-1.3476583429700484e-8,3.582677504977914e-4,2.6457485603445368e-5,-1.3500355686777276e-8,3.5866856083210973e-4,2.667773719840518e-5,-1.3534335889835297e-8,3.58984983565573e-4,2.691031135287597e-5,-1.3571967951946276e-8,3.592197788921785e-4,2.7110381522096033e-5,-1.3605104433755066e-8,3.5939395836391525e-4,2.723347733466807e-5,-1.3625211838772243e-8,3.5954731475294516e-4,2.7245005640118063e-5,-1.3625233122092842e-8,3.5973439287282456e-4,2.7131819567977223e-5,-1.3601941703224978e-8,3.600135954575884e-4,2.6912915110491107e-5,-1.355814290805302e-8,3.60429073295564e-4,2.664325075241653e-5,-1.3503526756102676e-8,3.60990418920039e-4,2.64034696792908e-5,-1.3452835801158697e-8,3.6166146352094975e-4,2.6273775898966717e-5,-1.3421074493356377e-8,3.623688032765512e-4,2.630225709809558e-5,-1.3417659611230746e-8,3.6302889191182174e-4,2.6485921915614753e-5,-1.3442821004948017e-8,3.635787000997205e-4,2.6775836053406942e-5,-1.3488337737398986e-8,3.6399313254539714e-4,2.7100845265447172e-5,-1.3541675775041822e-8,3.6428387361378935e-4,2.739386253867796e-5,-1.3590675845310196e-8,3.644865074909421e-4,2.7608376878739416e-5,-1.3626575377250361e-8,3.6464576613601913e-4,2.7723005292816395e-5,-1.364495582745406e-8,3.6480461555127395e-4,2.77383404850266e-5,-1.3645341642181487e-8,3.6499818740537e-4,2.76710053685678e-5,-1.3630271402829668e-8,3.6525122259954397e-4,2.754788664050142e-5,-1.360432815008887e-8,3.6557730310316335e-4,2.7401492817728636e-5,-1.357329062063108e-8,3.659787553882458e-4,2.72661665993695e-5,-1.3543394730429565e-8,3.6644689750384423e-4,2.7174555417879994e-5,-1.352065178127914e-8,3.669628241382334e-4,2.7153908983776746e-5,-1.3510179030065285e-8,3.674992016602788e-4,2.7222166045638933e-5,-1.3515526234079713e-8,3.68023539090487e-4,2.73843521332642e-5,-1.3538046023492725e-8,3.685030041719975e-4,2.7630228716345682e-5,-1.357642629855776e-8,3.689102801263324e-4,2.793415315314418e-5,-1.362653567100988e-8,3.692294796808659e-4,2.825781083626839e-5,-1.368173224189925e-8,3.694608523244996e-4,2.8555916027981706e-5,-1.3733727733496358e-8,3.6962307871807993e-4,2.8784249160797294e-5,-1.3773978177336275e-8,3.697522993353289e-4,2.8908903102290343e-5,-1.3795451641862713e-8,3.6989731803456434e-4,2.8915385836666257e-5,-1.3794521381371401e-8,3.701106527110447e-4,2.8815745762559872e-5,-1.3772576532502819e-8,3.704358354453675e-4,2.8651045702873957e-5,-1.3736749819577554e-8,3.7089307273516974e-4,2.8486040803253674e-5,-1.369908367506479e-8,3.714679608227572e-4,2.8394043726751596e-5,-1.3673710854101186e-8,3.7210991213757036e-4,2.843405066778115e-5,-1.3672440108961631e-8,3.7274498490128303e-4,2.8628554579815174e-5,-1.3700371291720451e-8,3.733002400374539e-4,2.8953884905579092e-5,-1.375383654447321e-8,3.737283127161456e-4,2.934966667201483e-5,-1.3821992572909582e-8,3.74019840199307e-4,2.9742318752869464e-5,-1.3891158565206442e-8,3.741996113300426e-4,3.0069483883304552e-5,-1.3949424588473654e-8,3.743121974552402e-4,3.0294519375517385e-5,-1.3989456769194334e-8,3.7440629029591007e-4,3.0408720943630665e-5,-1.4009040575435913e-8,3.745237271452724e-4,3.042555417326966e-5,-1.4010137999684472e-8,3.7469432233555345e-4,3.0372415163084517e-5,-1.399745265579277e-8,3.7493481407911624e-4,3.0283392801809747e-5,-1.3977121315336288e-8,3.7524974009757705e-4,3.0194074963467853e-5,-1.3955729687359219e-8,3.7563276072333213e-4,3.013796030115297e-5,-1.3939607838651707e-8,3.7606789752317216e-4,3.014358067755694e-5,-1.3934276197156442e-8,3.765308715945007e-4,3.0231593508346177e-5,-1.394391327502817e-8,3.769911447976581e-4,3.0411553226949515e-5,-1.3970762499094855e-8,3.774153866080384e-4,3.067874957136116e-5,-1.4014505540693484e-8,3.7777276900158004e-4,3.101223988098575e-5,-1.4071785355970582e-8,3.780416881621932e-4,3.137561973052833e-5,-1.4136185048005719e-8,3.782164562994042e-4,3.1721813892388676e-5,-1.4198962795870701e-8,3.7831168136817563e-4,3.2002044707192615e-5,-1.4250643304019193e-8,3.7836207867593326e-4,3.2177378338159576e-5,-1.4283213281041604e-8,3.784166470845473e-4,3.222972568760059e-5,-1.4292338201740607e-8,3.7852801727424653e-4,3.216882097511682e-5,-1.4278915068388991e-8,3.7873941235653586e-4,3.2032643792585974e-5,-1.4249424676350356e-8,3.7907250187723524e-4,3.1880386191779476e-5,-1.4214835935159804e-8,3.79519524138801e-4,3.1778859253417956e-5,-1.4188143257430748e-8,3.800425591675725e-4,3.1785057707013906e-5,-1.4180988668013144e-8,3.8058155833472476e-4,3.192941802742809e-5,-1.420023019579586e-8,3.810702007095623e-4,3.220552703223705e-5,-1.424564138430845e-8,3.814550608339061e-4,3.257118968284767e-5,-1.4309824655516338e-8,3.8171088610531375e-4,3.2961679962287354e-5,-1.4380610992098202e-8,3.818457030615165e-4,3.3310117296884816e-5,-1.444499449135639e-8,3.8189440825249304e-4,3.356630414228731e-5,-1.4492871054400158e-8,3.8190518456659355e-4,3.3706990005561714e-5,-1.4519156100786139e-8,3.8192545511999565e-4,3.3735939536645784e-5,-1.4523932873023375e-8,0.00038199221663132936,3.36770574780388e-5,-1.4511243699103591e-8,3.8212794959808886e-4,3.356532850735636e-5,-1.44874232515469e-8,3.8234068283503006e-4,3.3438964212912564e-5,-1.445961632653455e-8,3.826260695837975e-4,3.333397058547786e-5,-1.4434725361888601e-8,3.8296985541619517e-4,3.328078604508245e-5,-1.4418750654133305e-8,3.8335002714571484e-4,3.3302014460873146e-5,-1.441635218389012e-8,3.837387391287661e-4,3.341034772114456e-5,-1.4430449062814374e-8,3.841046361875188e-4,3.3606223967194986e-5,-1.4461732780659432e-8,3.844163948873668e-4,3.3875453388444264e-5,-1.4508108409027856e-8,3.846481026697538e-4,3.4187920503036706e-5,-1.4564283527851176e-8,3.8478626988731516e-4,3.449926174844078e-5,-1.4621926226168586e-8,3.8483677916458626e-4,3.475742957885683e-5,-1.4670832194101453e-8,3.8482854708888275e-4,3.491455839733871e-5,-1.4701226812136726e-8,3.8481043392111564e-4,3.4941584971485933e-5,-1.4706695752866484e-8,3.8484010168733006e-4,3.484013825587449e-5,-1.468664371357169e-8,3.8496755452253895e-4,3.464574228765504e-5,-1.4647105606473425e-8,3.852194666708856e-4,3.4419635873436564e-5,-1.4599384135326243e-8,3.8559051584685747e-4,3.4231768838361375e-5,-1.4556966089518085e-8,3.8604470174984556e-4,3.4141257634779535e-5,-1.4531832281699271e-8,3.8652549596401316e-4,3.4180796113487486e-5,-1.4531324827219252e-8,3.8697101818921484e-4,3.434917801281351e-5,-1.4556386882613265e-8,3.8732970092140794e-4,3.461318978913546e-5,-1.4601550234372074e-8,3.875723463890504e-4,3.491766325493246e-5,-1.4656605918405712e-8,3.8769763284319733e-4,3.5200524303996284e-5,-1.4709446876581307e-8,3.8772997811639925e-4,3.540841369879993e-5,-1.474921260370285e-8,3.877109937265693e-4,3.550840337825738e-5,-1.476877406003373e-8,3.8768778169230556e-4,3.5492866851361164e-5,-1.476588786722735e-8,3.877020190388187e-4,3.5377264492801586e-5,-1.4742916279944912e-8,3.8778272420060984e-4,3.519311331097323e-5,-1.4705540490345767e-8,3.8794354267678884e-4,3.497940485725285e-5,-1.4661111679795208e-8,3.88183621815305e-4,3.4775082366194856e-5,-1.4617171125102894e-8,3.8849040862005046e-4,3.4613774624727124e-5,-1.4580401934381552e-8,3.888429039948693e-4,3.452069902788002e-5,-1.4556015515333534e-8,3.8921458948142855e-4,3.45109299576898e-5,-1.4547412738969088e-8,3.8957597873680495e-4,3.4588150401447517e-5,-1.455591709815627e-8,3.8989728274007056e-4,3.474336635341969e-5,-1.4580440622513306e-8,3.9015195396758514e-4,3.495368121352255e-5,-1.4617090694513199e-8,3.9032177735499337e-4,3.5182101792084835e-5,-1.4658947568485471e-8,3.9040340540185385e-4,3.5380277120652675e-5,-1.4696467881042956e-8,3.904146306630224e-4,3.549631641986946e-5,-1.4719008759851094e-8,3.903967427080332e-4,3.548836893154207e-5,-1.4717615696219794e-8,3.9040860609677376e-4,3.534095270614115e-5,-1.468840935651692e-8,3.905107938530057e-4,3.507658782265891e-5,-1.4635025503981219e-8,3.9074435561294203e-4,3.4754301960084933e-5,-1.4568447883446436e-8,3.911142837911334e-4,3.445237060488615e-5,-1.4503769375063293e-8,3.915867065914306e-4,3.4242280516138355e-5,-1.4455241755727162e-8,3.9210098851033884e-4,3.416630020580259e-5,-1.4431921054112957e-8,3.9258978921974933e-4,3.42277415173893e-5,-1.4435583191215956e-8,3.92997891960016e-4,3.43949587943332e-5,-1.446115512515839e-8,3.9329397995157005e-4,3.4614214184008465e-5,-1.4498870429778417e-8,3.934741228294369e-4,3.482529654460197e-5,-1.4537116508416524e-8,3.935585439745504e-4,3.497539271070658e-5,-1.456516089516988e-8,3.935841244453831e-4,3.502882428209544e-5,-1.4575248316469991e-8,3.935950084123615e-4,3.497180118274077e-5,-1.4563798423281858e-8,3.9363335905265697e-4,3.4812268755863353e-5,-1.453161028551469e-8,3.9373196934599825e-4,3.457567997812712e-5,-1.4483168817569692e-8,3.9390985158140024e-4,3.4298244121273065e-5,-1.442534785326174e-8,3.941710735045695e-4,3.401951202215226e-5,-1.4365908871774454e-8,3.945062887672119e-4,3.377587091359689e-5,-1.431215883946541e-8,3.948959058166358e-4,3.3595868201667825e-5,-1.4269990715109863e-8,3.9531378332501087e-4,3.34975018387911e-5,-1.4243345355196083e-8,3.95730734118531e-4,3.348697905005418e-5,-1.4233969882786683e-8,3.9611767962868447e-4,3.3558268125866676e-5,-1.424129255710753e-8,3.964487102877791e-4,3.3693000306870486e-5,-1.4262290516375536e-8,3.9670457560232427e-4,3.386072530925677e-5,-1.429136009013897e-8,3.96877142245794e-4,3.402026478479182e-5,-1.4320404114221407e-8,3.96974675963087e-4,3.412377428846557e-5,-1.433955280018419e-8,3.970263033690597e-4,3.412534347773198e-5,-1.4338948576893425e-8,3.970821930901893e-4,3.3994646882125137E-05,-1.4311677516442803e-8,3.972051269460485e-4,3.373258641401384e-5,-1.4257126814339408e-8,3.9745171697619185e-4,3.3380857036472385e-5,-1.4183048350455968e-8,3.9784887548471545e-4,3.3015677815108926e-5,-1.4104376616313594e-8,3.983784208606685e-4,3.272315572911758e-5,-1.4038376360391643e-8,3.989810077392129e-4,3.2567028222608205e-5,-1.3998275239165507e-8,3.995784033932848e-4,3.256650678484111e-5,-1.3988808427858587e-8,4.001011450991133e-4,3.269479846358877e-5,-1.4005705396679457e-8,4.0050766556828905e-4,3.2894820685850835e-5,-1.4038489709830286e-8,4.0078956955466436e-4,3.310064022337845e-5,-1.407446327281956e-8,4.0096621978551547e-4,3.325505206119748e-5,-1.4102093289319672e-8,4.010745404447036e-4,3.3319672146671645e-5,-1.4113112716440347e-8,4.0115849496576356e-4,3.3278246778498246e-5,-1.4103416685224999e-8,4.0126036221118603e-4,3.3135359116825646e-5,-1.4073080729645138e-8,4.014143685471576e-4,3.291243375807629e-5,-1.4025773677232568e-8,4.0164265136440953e-4,3.264223661405534e-5,-1.3967743564302586e-8,4.019534608500238e-4,3.236272447032621e-5,-1.390655605379301e-8,4.023414451750576e-4,3.211102729665613e-5,-1.3849797898036786e-8,4.0278971307670453e-4,3.191824538468825e-5,-1.3803953237611915e-8,4.032731686233601e-4,3.18056089510052e-5,-1.3773602883065726e-8,4.037624347508987e-4,3.178228329803735e-5,-1.376099772735688e-8,4.0422776760387706e-4,3.184466222614487e-5,-1.3765925422093045e-8,4.0464271102872616e-4,3.1976751617668895e-5,-1.3785736315062855e-8,4.049875078121135e-4,3.2151373504918296e-5,-1.3815449042655647e-8,4.0525242347578963e-4,3.2332175019236376e-5,-1.3847964962952615e-8,4.0544119121250843e-4,3.2476862419152035e-5,-1.3874561986942388e-8,4.05574305140568e-4,3.254270756363941e-5,-1.3885979640020726e-8,4.0569066632959827e-4,3.249544686392352e-5,-1.3874369128060043e-8,4.0584474135106326e-4,3.232141920233108e-5,-1.3836033795223245e-8,4.060959597117366e-4,3.203981711665866e-5,-1.3774198864523915e-8,4.0648944202457856e-4,3.170776499799547e-5,-1.3700205970255192e-8,4.070339380710125e-4,3.14094387988266e-5,-1.3631320248747382e-8,4.076901544592694e-4,3.122757281338524e-5,-1.3584880382566213e-8,4.083808447150242e-4,3.1209812559531696e-5,-1.357136683146307e-8,4.090200221087287e-4,3.1349995147856346e-5,-1.3590446140588086e-8,4.0954443123187515e-4,3.1595103343674464e-5,-1.3632168430282483e-8,4.099303837683666e-4,3.187049880203468e-5,-1.3681872256090355e-8,4.101918277261662e-4,3.210671035463291e-5,-1.3725481876963942e-8,4.103671176469619e-4,3.225608889167277e-5,-1.3752883934071199e-8,4.1050398879131114e-4,3.2297665182539014e-5,-1.3759059927073484e-8,4.106480562172606e-4,3.223425978678608e-5,-1.3743742869076615e-8,4.108359107796797e-4,3.208637535174844e-5,-1.371041895829871e-8,4.1109180515318115e-4,3.188566709771694e-5,-1.366514943234374e-8,4.1142658815250326e-4,3.166901056491771e-5,-1.3615380156688916e-8,4.118380537063425e-4,3.147326545835003e-5,-1.3568790580043022e-8,4.123123872285276e-4,3.1330693322293186e-5,-1.3532246924646132e-8,4.1282660990819755e-4,3.12650855735152e-5,-1.3510937230181173e-8,4.1335194038861985e-4,3.12888232285669e-5,-1.3507759179538763e-8,0.00041385782791872523,3.14012402587035e-5,-1.3523006860697865e-8,4.143162097043059e-4,3.158851800056764e-5,-1.3554343762603742e-8,4.147055736697891e-4,3.182504325345812e-5,-1.3596998591413753e-8,4.150145461827425e-4,3.207610038134238e-5,-1.3644157727172217e-8,4.1524476893370035e-4,3.230183268389632e-5,-1.368759809958973e-8,4.1541284364256985e-4,3.2462481911037404e-5,-1.3718658948585584e-8,4.1555091775811174e-4,3.252513293742975e-5,-1.3729683805619488e-8,4.1570478512098117e-4,3.247211793603926e-5,-1.3715984522395111e-8,4.159276624200048e-4,3.2310116826504505e-5,-1.3678055124053507e-8,4.1626805702971783e-4,3.2076790804311726e-5,-1.3623245822332607e-8,4.167524617387805e-4,3.1839355536118996e-5,-1.3565610929515464e-8,4.173687071937988e-4,3.1679433606488e-5,-1.352271054257597e-8,4.180608672886187e-4,3.166480571656874e-5,-1.3509541984888306e-8,4.187443288713044e-4,3.182021371545731e-5,-1.353221487846181e-8,4.193369682737023e-4,3.211533218369021e-5,-1.3585218588590153e-8,4.1978931227977685e-4,3.247863499575709e-5,-1.3654153761093438e-8,4.2009704087509506e-4,3.282777137229304e-5,-1.3721983897773367e-8,4.202929904690921e-4,3.309778073197644e-5,-1.377490014751364e-8,4.2042859167406205e-4,3.325494568929429e-5,-1.3805267082687721e-8,4.2055631802961126e-4,3.329635406528146e-5,-1.3811685967344244e-8,4.207187075410816e-4,3.324181570289828e-5,-1.3797529601781316e-8,4.209438553744661e-4,3.312430221578908e-5,-1.376914696052265e-8,4.212450114021482e-4,3.29820290127452e-5,-1.3734307231289387e-8,4.2162200611876914e-4,3.285276439909095e-5,-1.3700985550654417e-8,4.220632466273461e-4,3.276974175556986e-5,-1.3676406563612262e-8,4.225479806825113e-4,3.275847057478871e-5,-1.3666274054639809e-8,4.2304896717371235e-4,3.283409778896946e-5,-1.367416405793029e-8,4.23535782825238e-4,3.299935006506142e-5,-1.3701088573561653e-8,4.2397886988324306e-4,3.3243478824476034e-5,-1.374527589841765e-8,4.2435406637511227e-4,3.354279531934157e-5,-1.3802236076034794e-8,4.246470102477941e-4,3.3863147891369016e-5,-1.3865160722445153e-8,4.248566904943515e-4,3.4164346787876715e-5,-1.392568757735148e-8,4.249974307882397e-4,3.4406249583597606e-5,-1.3975043403899051e-8,4.2509869023787635e-4,3.455590008719841e-5,-1.4005525482322397e-8,4.252022353167417e-4,3.4594902384809774e-5,-1.4012200930378964e-8,4.2535628227180944e-4,3.452606191561703e-5,-1.3994602436161527e-8,4.2560627053101944e-4,3.437774195887487e-5,-1.3957997791203556e-8,4.259826655671023e-4,3.42033544248866e-5,-1.3913552496987838e-8,4.2648812302165757e-4,3.407288572264099e-5,-1.3876612700332113e-8,4.2708920644435e-4,3.405490071168592e-5,-1.3862734860228985e-8,4.2771960286236156e-4,3.419246160656786e-5,-1.388224482934693e-8,4.2829858276369735e-4,3.4483331127508464e-5,-1.39356667397566e-8,4.287591800201008e-4,3.487711132752329e-5,-1.401286696741407e-8,4.2907189221625086e-4,3.529375343362766e-5,-1.4096933853643936e-8,4.2925111181198606e-4,3.5653822332007866e-5,-1.4170691079982273e-8,4.293431436633978e-4,3.590386737424457e-5,-1.422220020649449e-8,4.294057069943159e-4,3.602629900089709e-5,-1.4246968028465437e-8,4.2949028887441184e-4,3.603476243390713e-5,-1.4247107509361492e-8,4.296326637699373e-4,3.596258975350247e-5,-1.422906114426545e-8,4.298507830160587e-4,3.585122067538412e-5,-1.4201284229219959e-8,4.30146821619837e-4,3.574178595192985e-5,-1.4172502101488057e-8,4.305105528179752e-4,3.567004669500458e-5,-1.4150577469349977e-8,4.309225690144668e-4,3.566353502127585e-5,-1.4141794633184363e-8,4.3135708115020477e-4,3.5739694174433475e-5,-1.4150368611616155e-8,4.3178466029482305e-4,3.5904363120716595e-5,-1.4178070671429282e-8,4.321754230960808e-4,3.615055457113382e-5,-1.4223940930016515e-8,4.3250300470527235e-4,3.645801938170371e-5,-1.4284152898436964e-8,4.327492141671965e-4,3.6794455062480333e-5,-1.4352180111878265e-8,4.329086361301494e-4,3.711914037777242e-5,-1.441944170755436e-8,4.329919362284678e-4,3.738922622588004e-5,-1.4476525706585657e-8,4.3302648954548616e-4,3.756805202918171e-5,-1.4514923144055002e-8,4.330533235187689e-4,3.763391300210855e-5,-1.4528989528198715e-8,4.331202330514279e-4,3.7587099620632155e-5,-1.4517675625248134e-8,4.33271953934643e-4,3.7453099149815584e-5,-1.4485529520827118e-8,4.335391170749413e-4,3.728040086638992e-5,-1.4442540122095772e-8,4.3392835970523195e-4,3.713209968463934e-5,-1.4402528788363379e-8,4.344165500758634e-4,3.707165347756771e-5,-1.4380064897967802e-8,4.3495230062594813e-4,3.714511840207765e-5,-1.438637838413005e-8,4.3546692736868404e-4,3.7364868229131036e-5,-1.4425430174624792e-8,4.3589372030768185e-4,3.7701867510223756e-5,-1.4491842764582526e-8,4.361893091351183e-4,3.8092289800798756e-5,-1.4572120153155367e-8,4.3634757852403625e-4,3.8457985039809324e-5,-1.464910812938325e-8,4.363991796352178e-4,3.8732147174392066e-5,-1.4707727290935779e-8,4.3639763452364114e-4,3.887826414780291e-5,-1.4739264857224268e-8,4.364001722647106e-4,3.889525252824335e-5,-1.474263969373984e-8,4.364523016838084e-4,3.881021476354108e-5,-1.4722977299200551e-8,4.365804771433114e-4,3.866556340462599e-5,-1.468896039574687e-8,4.367919722871205e-4,3.8506926413442914e-5,-1.4650297668231218e-8,4.370786669043261e-4,3.837491837753309e-5,-1.4615939698352876e-8,4.3742177567648004e-4,3.8300841711920557e-5,-1.4593067497875068e-8,4.377959505900983e-4,3.830495380523125e-5,-1.4586611379527836e-8,4.3817246361271725e-4,3.839583492266989e-5,-1.4599028669935255e-8,4.385219262133009e-4,3.856996202628723e-5,-1.4630154871815322e-8,4.388172474094774e-4,3.881133934777927e-5,-1.4677068982739351e-8,4.3903736753377824e-4,3.909172438758446e-5,-1.4734059655137036e-8,4.39171785700476e-4,3.9372492362129876e-5,-1.4792916472356046e-8,4.392250878709724e-4,3.9609287825052854e-5,-1.48438349018792e-8,4.392197841418492e-4,3.9760010138741e-5,-1.4877110525214467e-8,4.391952872335693e-4,3.9795215836805176e-5,-1.488546114998337e-8,4.392015028478242e-4,3.9708130526000964e-5,-1.4866368508482124e-8,4.392874740657098e-4,3.9520303226885334e-5,-1.4823547388579492e-8,4.3948798661524503e-4,3.927964654825381e-5,-1.4766788554084115e-8,4.3981252877586845e-4,3.905019462021475e-5,-1.4709963203151688e-8,4.4024057367895406e-4,3.889606668889953e-5,-1.4667637174980205e-8,4.407251019923313e-4,3.886426054421898e-5,-1.465121537204819e-8,4.4120371732378895e-4,3.897130268161372e-5,-1.4665702138134793e-8,4.4161456567829924e-4,3.919776198075389e-5,-1.4708062006301217e-8,4.41912806692747e-4,3.949272215218089e-5,-1.4767828043097781e-8,4.4208268554817335e-4,3.978761101197567e-5,-1.4829982902345276e-8,4.421409699762284e-4,4.001548958358082e-5,-1.4879284623686034e-8,4.421303237867017e-4,4.012928886396741e-5,-1.4904509091663218e-8,4.4210531633417574e-4,4.011254468451751e-5,-1.4901064005645254e-8,4.421168168722615e-4,3.997960143327207e-5,-1.487124044964496e-8,4.422004451507053e-4,3.9767094807069e-5,-1.4822485598136494e-8,4.4237183113721076e-4,3.9521669753076244e-5,-1.4764783122292205e-8,4.426279491665109e-4,3.928881642907068e-5,-1.4708204056709783e-8,4.429518454747351e-4,3.91054375635812e-5,-1.4661205248835662e-8,4.433181067887932e-4,3.899632725145631e-5,-1.4629752573422735e-8,4.436975223791884e-4,3.8973357147412855e-5,-1.4617048273316101e-8,4.4406056405082626e-4,3.903590468819179e-5,-1.4623561502714967e-8,4.4438008650014344e-4,3.91715076460056e-5,-1.4647122090138582e-8,4.446339768961001e-4,3.935646602380224e-5,-1.4682981479505956e-8,4.448083963396037e-4,3.955684978592832e-5,-1.4723927049201846e-8,4.4490177030358924e-4,3.973098128986008e-5,-1.4760714274992125e-8,4.4492878725670593e-4,3.9834759260079374e-5,-1.4783179135015065e-8,4.4492247041699046e-4,3.983068781073579e-5,-1.4782276848273152e-8,4.4493150521741963e-4,3.9699639584905065e-5,-1.4752832416571488e-8,4.4501065268293756e-4,3.945150399211428e-5,-1.4696101798232349e-8,4.452051621230111e-4,3.912878232058367e-5,-1.4620773630123115e-8,4.4553450758414917e-4,3.879851843897706e-5,-1.4541367888067542e-8,4.459831270119789e-4,3.853341144760553e-5,-1.4474199279655483e-8,4.4650334228181737e-4,3.83892962100095e-5,-1.4432428557074345e-8,4.470294963479162e-4,3.838843851633301e-5,-1.4422210720894016e-8,4.474971022466872e-4,3.8514644123259556e-5,-1.4441268698217063e-8,4.4785977033990704e-4,3.872025545847296e-5,-1.4480033042680275e-8,4.480991934681107e-4,3.8940889744311725e-5,-1.4524608121518424e-8,4.48226794522255e-4,3.911257774162124e-5,-1.4560498684405491e-8,4.482780588321118e-4,3.918669829382871e-5,-1.457607889926847e-8,4.4830195410043057e-4,3.913954024565277e-5,-1.4565007306195704e-8,4.483485381147606e-4,3.8974954360315984e-5,-1.4527125710483059e-8,4.484579671969714e-4,3.872030337677846e-5,-1.4467791545713628e-8,4.4865345969394e-4,3.841765061935548e-5,-1.4396030200337683e-8,4.489392960449042e-4,3.811327623924533e-5,-1.4322193270630174e-8,4.4930320331229367e-4,3.7848511485026534e-5,-1.4255821744391228e-8,4.497213338957374e-4,3.765366154702086e-5,-1.4204163537672068e-8,4.5016388935185643e-4,3.7545304813913294e-5,-1.4171463776027224e-8,4.5060002058532647e-4,3.752619081927828e-5,-1.415888242467012e-8,4.5100150770761724e-4,3.758652962581753e-5,-1.4164756572674547e-8,4.5134546376081325e-4,3.7705677615177184e-5,-1.4184941935731645e-8,4.5161665818218725e-4,3.785383751499737e-5,-1.4213111016563784e-8,4.518100423627256e-4,3.7994051971822126e-5,-1.4241074681839239e-8,4.5193371514478737e-4,3.8085369823532785e-5,-1.4259379743515523e-8,4.5201173652522936e-4,3.808847352382779e-5,-1.4258553184670598e-8,4.5208492668352473e-4,3.797471001575803e-5,-1.4231251193107125e-8,4.522066971808626e-4,3.77376787180318e-5,-1.4175095272905575e-8,4.5243135935849304e-4,3.7403252871591634e-5,-1.4095172040726785e-8,4.5279582657719995e-4,3.7030874343293475e-5,-1.4004497095542028e-8,4.5330172975054594e-4,3.6700112219684904e-5,-1.3921072538958264e-8,4.539088056613535e-4,3.648437266876659e-5,-1.3861984223206524e-8,4.545461169138244e-4,3.642372882885231e-5,-1.3837216692123784e-8,4.5513658700048617e-4,3.651138922317251e-5,-1.3846408129259836e-8,4.556220323441288e-4,3.66997016694241e-5,-1.3879890283223254e-8,4.559775185965056e-4,3.691969978430192e-5,-1.3922769386842146e-8,4.562122242740801e-4,3.710309854736905e-5,-1.3959682858114987e-8,4.5636084388552884e-4,3.7198647914217366e-5,-1.397848887776796e-8,4.564712492187718e-4,3.7180239677984124e-5,-1.3972296643507357e-8,4.5659257815677795e-4,3.7047788247771294e-5,-1.393998633269255e-8,4.5676585962010804e-4,3.682314037864092e-5,-1.3885605024489333e-8,4.57017899354544e-4,3.65430985371316e-5,-1.3816998895031419e-8,4.573585513254664e-4,3.625115082842816e-5,-1.3743986972765052e-8,4.5778120823241134e-4,3.5989329685002914e-5,-1.367641965358165e-8,4.582659310878471e-4,3.579152347703973e-5,-1.3622494409608255e-8,4.587842300484169e-4,3.567911872805785e-5,-1.3587614246913989e-8,4.5930436312677383e-4,3.565921697959824e-5,-1.357389940117045e-8,4.5979615512869434e-4,3.572510183973148e-5,-1.358027877351196e-8,4.6023475988321376e-4,3.585820060660067e-5,-1.360294284347647e-8,4.6060335832733674e-4,3.6030722091809204e-5,-1.3635911870639802e-8,4.60895139188042e-4,3.6208528902177354e-5,-1.3671590860836431e-8,4.6111494690815154e-4,3.635429757026502e-5,-1.3701352069797334e-8,4.612807925415506e-4,3.6431488839050474e-5,-1.3716346193401218e-8,4.614247987373746e-4,3.6410027954227026e-5,-1.3708835750741679e-8,4.6159205914533125e-4,3.62743262879114e-5,-1.3674231350069227e-8,4.6183498055835207e-4,3.6032773953528615e-5,-1.3613573886357206e-8,4.6220096368370197e-4,3.572504366766511e-5,-1.3535497406452498e-8,4.627142460022724e-4,3.5420516607509466e-5,-1.345601089443765e-8,4.633589570077975e-4,3.520158587923049e-5,-1.339462640412944e-8,4.640754895656249e-4,3.5133781640715624e-5,-1.336732887285183e-8,4.6477797333421513e-4,3.523710146370312e-5,-1.337976511947418e-8,4.653863109243403e-4,3.5476761963375476e-5,-1.3424888861955243e-8,4.658546211216421e-4,3.577942568893229e-5,-1.3486488367131025e-8,4.661813358342299e-4,3.6063351831523195e-5,-1.3545965988268696e-8,4.664004611033069e-4,3.626473218857858e-5,-1.3588320959816941e-8,4.665639958352068e-4,3.6350407228647365e-5,-1.360513303776225e-8,4.6672541684679767e-4,3.631790496298228e-5,-1.3594788762173888e-8,4.6692865416770923e-4,3.618845377576418e-5,-1.3561187150119446e-8,4.672026368560225e-4,3.5997925297469526e-5,-1.3511940939945172e-8,4.6755982834898976e-4,3.5788386314177225e-5,-1.3456575605413407e-8,4.67997179408685e-4,3.5601078032541834e-5,-1.3404875559273567e-8,4.684985923176623e-4,3.5470812389852354e-5,-1.3365423942936016e-8,4.6903849108559164e-4,3.542180047068913e-5,-1.3344439413006975e-8,4.695861596821659e-4,3.546508508953634e-5,-1.3345040436527447e-8,4.7011041192164126e-4,3.559772500847251e-5,-1.3367006714160734e-8,4.705840542170844e-4,3.580375537789526e-5,-1.3407016011675667e-8,4.7098759753275935e-4,3.6056678871433476e-5,-1.3459233547938723e-8,4.7131190949890184e-4,3.632298007574168e-5,-1.3516078049011552e-8,4.71559790690804e-4,3.6566204934469644e-5,-1.3569053058169974e-8,4.717465735754899e-4,3.6751383530202755E-05,-1.3609647477316639e-8,4.718998124130554e-4,3.684981905601746e-5,-1.3630405599256602e-8,4.7205781579265745e-4,3.684452081682734e-5,-1.3626310087204059e-8,4.7226605766033966e-4,3.673637051258554e-5,-1.3596506069195115e-8,4.725699924678846e-4,3.654994787786842e-5,-1.3546025765795578e-8,4.730033180778431e-4,3.6336041112372295e-5,-1.3486667699711668e-8,4.7357300089362716e-4,3.616604739808837e-5,-1.3435763281303896e-8,4.74246972161772e-4,3.611397064008277e-5,-1.3411769997669891e-8,4.7495468950762464e-4,3.6228226616847743e-5,-1.342728801093758e-8,4.756075265498231e-4,3.6506596772157785e-5,-1.3482806498111208e-8,4.761324789643435e-4,3.68921215314555e-5,-1.3565521966204982e-8,4.76500027685036e-4,3.729587464380291e-5,-1.3654665288008376e-8,4.7672987690625123e-4,3.763293743393644e-5,-1.3730017018062513e-8,4.768749775046739e-4,3.7850136442992455e-5,-1.3778472109271951e-8,4.7699763159739244e-4,3.7934345672070496e-5,-1.379606231317544e-8,4.7715085690734735e-4,3.790502947009683e-5,-1.3786386207802384e-8,4.7736947329048336e-4,3.780076670277705e-5,-1.3757715344810296e-8,4.7766881383462853e-4,3.7666865402247315e-5,-1.3720316041747617e-8,4.780473761409701e-4,3.7546640888132714e-5,-1.368447808114495e-8,4.7849069816615584e-4,3.747611264933771e-5,-1.3659170952435136e-8,4.789752246660876e-4,3.748091718942398e-5,-1.3651117518452754e-8,4.7947201707088224e-4,3.757448492495361e-5,-1.3664168314897276e-8,4.799505077512641e-4,3.775714321569889e-5,-1.3698971973992664e-8,4.803824002412184e-4,3.801622409426613e-5,-1.3752971782310215e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_11.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_11.json deleted file mode 100644 index 0dd6dde4..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_11.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":11000,"numberOfSamples":1000,"samples":[4.807455898115237e-4,3.832746570992544e-5,-1.3820749559112586e-8,4.810276804026849e-4,3.8657939483712816e-5,-1.3894708855793208e-8,4.8122851144731977e-4,3.897037866353488e-5,-1.3966029941865335e-8,4.8136122169643126e-4,3.922846753666153e-5,-1.4025813189547578e-8,4.8145158055841605e-4,3.94025277918899e-5,-1.406634943105251e-8,4.815355041583503e-4,3.9474978459853574e-5,-1.408245537787128e-8,4.8165478219839815e-4,3.9445013590506954e-5,-1.4072791780691197e-8,4.8185089652025466e-4,3.933196966399209e-5,-1.4041008026015441e-8,4.8215671196515623e-4,3.9176311765079673e-5,-1.3996340784096513e-8,4.825864763543066e-4,3.9036228711670225e-5,-1.3953028790341758e-8,4.8312623641597524e-4,3.897747212754661e-5,-1.3927849119148707e-8,4.837291888970253e-4,3.9055456474574426e-5,-1.3935510387344442e-8,4.843221611312391e-4,3.929313827217236e-5,-1.3982860442730526e-8,4.848265247112546e-4,3.966499254457847e-5,-1.4064616609993489e-8,4.8518733416020557e-4,4.009980545620315e-5,-1.4163881241573302e-8,4.853950931909375e-4,4.050581912340954e-5,-1.425830655995102e-8,4.854866151667581e-4,4.080574058134305e-5,-1.4328715323638037e-8,4.85525688196407e-4,4.096178493042818e-5,-1.4365239392562207e-8,4.855772001398806e-4,4.0979862819758134e-5,-1.4368394366073396e-8,4.856885804979649e-4,4.089713112766541e-5,-1.4346234987150922e-8,4.8588326125485515e-4,4.076435074414623e-5,-1.4310345248447114e-8,4.8616296080937287e-4,4.063161994000118e-5,-1.4272594843316575e-8,4.865136173432042e-4,4.054008405187016e-5,-1.4243172616081504e-8,4.8691142789272524e-4,4.051847158520118e-5,-1.4229620182921136e-8,4.8732762934217247e-4,4.0582299326150006e-5,-1.4236433463507242e-8,4.8773212709177916e-4,4.07341134689005e-5,-1.4264941962397524e-8,4.880965967034294e-4,4.096407600183585e-5,-1.4313353517338398e-8,4.88397573177068e-4,4.1250927252936434e-5,-1.4376959666340294e-8,4.886197129387349e-4,4.1563798332032156e-5,-1.4448564853229553e-8,4.887589435265532e-4,4.1865488207741994e-5,-1.451924254306548e-8,4.888247307700336e-4,4.211748974787741e-5,-1.4579476522027053e-8,4.888405100767859e-4,4.228641181812268e-5,-1.462064263346648e-8,4.888415356313333e-4,4.235083017747227e-5,-1.463666315611464e-8,4.888699069788087e-4,4.2307124574301165e-5,-1.462554429370797e-8,4.889672434197426e-4,4.2172729191325406e-5,-1.459042628142175e-8,4.89166100944331e-4,4.198561886052198e-5,-1.4539802909504917e-8,4.894815424795779e-4,4.179941029790374e-5,-1.4486638095790344e-8,4.899045597653066e-4,4.16738571918689e-5,-1.4446179472955758e-8,4.903995543457572e-4,4.1661226263416274e-5,-1.4432491631334258e-8,4.909084078410756e-4,4.179064877681403e-5,-1.4454232713012669e-8,4.913629055658968e-4,4.205495921373214e-5,-1.4510927067288458e-8,4.917043498415898e-4,4.2406630471518614e-5,-1.4591584452824552e-8,4.919041260653661e-4,4.2768455240018365e-5,-1.4677226547185713e-8,4.91975143734432e-4,4.30581023135401e-5,-1.4747087713819914e-8,4.919667281492841e-4,4.321634341236769e-5,-1.4785795141156964e-8,4.919450134806429e-4,4.322488299346272e-5,-1.4787918091785175e-8,4.919696544610528e-4,4.310619995991277e-5,-1.4758043194016052e-8,4.920780610928328e-4,4.2909134196637064e-5,-1.4707389424281414e-8,4.922813225790399e-4,4.269033595193827e-5,-1.464944226297227e-8,4.925688425220637e-4,4.249988199139718e-5,-1.4596537842685818e-8,4.92916302217559e-4,4.2373819969799324e-5,-1.4557994767186664e-8,4.932930424762773e-4,4.233227598512297e-5,-1.4539483417289066e-8,4.936673798735039e-4,4.2380499169877454e-5,-1.4543082916464466e-8,4.940100632622315e-4,4.251078828128216e-5,-1.4567604259159937e-8,4.942967406427109e-4,4.27043504794895e-5,-1.4608973846901326e-8,4.945102476677884e-4,4.2933063498730834e-5,-1.4660638792530654e-8,4.946431248320447e-4,4.316170803770033e-5,-1.4714088579726986e-8,4.947001929114915e-4,4.335150966562856e-5,-1.4759675319273507e-8,4.947003518474758e-4,4.3465620460088586e-5,-1.4787908056141978e-8,4.946762700491294e-4,4.3476391218321277e-5,-1.4791230435817252e-8,4.946706632709735e-4,4.337312853241991e-5,-1.4766006598097854e-8,4.947286919062398e-4,4.316792790944356e-5,-1.4714140745679074e-8,4.948875598480194e-4,4.289680338026428e-5,-1.46436248866499e-8,4.951660198459949e-4,4.261431606960693e-5,-1.4567507684274658e-8,4.955572023782361e-4,4.238205390573295e-5,-1.4501266960766878e-8,4.960275056948562e-4,4.225356593077395e-5,-1.4459112508157139e-8,4.965226079965434e-4,4.225970770296015e-5,-1.445012992875491e-8,4.969797348841862e-4,4.239855798309805e-5,-1.4475344797421208e-8,4.973435745501257e-4,4.263333074298414e-5,-1.452672530286383e-8,4.975817616767804e-4,4.290011641573763e-5,-1.4588789841322534e-8,4.976949342797306e-4,4.31246291984686e-5,-1.4642736998874316e-8,4.977169933512843e-4,4.32435191844831e-5,-1.4671952404593025e-8,4.977043744489744e-4,4.3222752491909916e-5,-1.4666876259907704e-8,4.977180995272924e-4,4.30657402384419e-5,-1.4627283126456636e-8,4.978060190996614e-4,4.280844975449757e-5,-1.4561258969220208e-8,4.979920722311104e-4,4.2505071693506214e-5,-1.4481783123106343e-8,4.982749931993637e-4,4.221149461163865e-5,-1.4402704387878677e-8,4.986341351162414e-4,4.1972812399652274e-5,-1.4335614319282961e-8,4.99038023174974e-4,4.181724732728816e-5,-1.4288203371298527e-8,4.994521132236064e-4,4.1755451375511826e-5,-1.4263899128169458e-8,4.998442497099592e-4,4.1782774302784495e-5,-1.4262268021020732e-8,5.001879318353291e-4,4.1882399162322495e-5,-1.4279703860248156e-8,5.004642516735846e-4,4.202823461485221e-5,-1.4310113798395751e-8,5.006634317541689e-4,4.218742398465999e-5,-1.4345522650409268e-8,5.007865154243883e-4,4.232301933686223e-5,-1.4376697915433863e-8,5.008471450808845e-4,4.239771827120947e-5,-1.4394026271468186e-8,5.008726192415792e-4,4.237947661390274e-5,-1.4388889379628621e-8,5.009027064025104e-4,4.224906691188224e-5,-1.4355605708386248e-8,5.009844664141034e-4,4.200814399437556e-5,-1.4293595372097094e-8,5.011622958425812e-4,4.168457799010023e-5,-1.4208933086185455e-8,5.014648490094809e-4,4.133098997158663e-5,-1.4114222164068199e-8,5.018933871908035e-4,4.1014046129932506e-5,-1.4026120755346876e-8,5.024172779489319e-4,4.079629120466331e-5,-1.3960894019653134e-8,5.029800978344093e-4,4.0716851663191706e-5,-1.3929502673170868e-8,5.035149205751237e-4,4.0778803174321974e-5,-1.3934148788121047e-8,5.039631026052139e-4,4.0948067350335475e-5,-1.3967574412809247e-8,5.042898951464934e-4,4.116358529728348e-5,-1.4015214047407058e-8,5.044923433820881e-4,4.1354546447450864e-5,-1.405930760929713e-8,5.045980853346142e-4,4.145904379395495e-5,-1.4083628433054094e-8,5.046562864241187e-4,4.143903113694813e-5,-1.4077491031220824e-8,5.047237703547672e-4,4.128796116298141e-5,-1.4038013428869964e-8,5.048504577142612e-4,4.1029648300892024e-5,-1.3970152894372228e-8,5.050682042868694e-4,4.070946922079784e-5,-1.3884718542673423e-8,5.053857892959258e-4,4.038129871002777e-5,-1.3795175637434057e-8,5.057904773855169e-4,4.0094587167200846e-5,-1.3714342555419928e-8,5.062542972907671e-4,3.988514116215506e-5,-1.3651908298048012e-8,5.067420758582822e-4,3.9771018930213065e-5,-1.36131932106548e-8,5.072186700798977e-4,3.9752847710952766e-5,-1.3599056334601855e-8,5.076541049257842e-4,3.981679039448647e-5,-1.3606552572220539e-8,5.080265636895346e-4,3.993839829792082e-5,-1.3629887915207912e-8,5.083239056768367e-4,4.008625429723009e-5,-1.366134539027628e-8,5.085445405312649e-4,4.02251540015048e-5,-1.3692068130210929e-8,5.086982215653529e-4,4.031923748367069e-5,-1.3712790472901225e-8,5.088067942896942e-4,4.033585746282454e-5,-1.3714758380114217e-8,5.089042016332715e-4,4.0250984480183826e-5,-1.369110873241738e-8,5.090342370463796e-4,4.005630209267127e-5,-1.36387919547938e-8,5.09244162874289e-4,3.976656292219734e-5,-1.3560660497017656e-8,5.095732393487734e-4,3.942360984383623e-5,-1.3466737784983145e-8,5.100381218559963e-4,3.9092145563312785e-5,-1.3373334502326575e-8,5.106211663506831e-4,3.884421714299498e-5,-1.3299185546533904e-8,5.112695708256073e-4,3.873558642398053e-5,-1.325938777322804e-8,5.119093049859852e-4,3.878426446529394e-5,-1.3259745614206067e-8,5.124690770718819e-4,3.896273593345075e-5,-1.3294485083970076e-8,5.129030399538616e-4,3.920805997219822e-5,-1.3348486880023718e-8,5.13202292093832e-4,3.944384781038976e-5,-1.3402621757432825e-8,5.133926118135372e-4,3.9603311868793384e-5,-1.3439524368879208e-8,5.135225876503645e-4,3.964513077729718e-5,-1.344773648237942e-8,5.136484244188965e-4,3.955939833262208e-5,-1.3423498173910979e-8,5.138202846515992e-4,3.936503101320661e-5,-1.337045078206997e-8,5.140727251366115e-4,3.9101620258126494e-5,-1.3297891578819023e-8,5.144200439889327e-4,3.8818723273896924e-5,-1.3218230049065295e-8,5.148563248939854e-4,3.8565076244178615e-5,-1.31442269252279e-8,5.153592942705727e-4,3.8379720577811564e-5,-1.3086552229207539e-8,5.158965586590853e-4,3.8286402743178446e-5,-1.3052102047767048e-8,5.164325300028227e-4,3.829166482457637e-5,-1.3043289492522785e-8,5.169345624266961e-4,3.838611140678518e-5,-1.3058250794240458e-8,5.173773998025525e-4,3.854777091398222e-5,-1.3091694599441699e-8,5.177457469094699e-4,3.8746318140652296E-05,-1.3136024508001314e-8,5.180353753683765e-4,3.894721737733719e-5,-1.3182422098429487e-8,5.182533801875123e-4,3.9115464526579055e-5,-1.322176802538456e-8,5.184180207872244e-4,3.9219155018714586e-5,-1.3245479826195314e-8,5.185582174206982e-4,3.923339887816621e-5,-1.3246473160946539e-8,5.187121920390923e-4,3.9145162676454723e-5,-1.3220474590964729e-8,0.00051892397371530155,3.895909776742693e-5,-1.316773040159988e-8,5.192361363727685e-4,3.8702959631497384e-5,-1.3094695644609137e-8,5.19678041196177e-4,3.8429183553321686e-5,-1.3014701920521112e-8,5.20251698135249e-4,3.820781513346968e-5,-1.2946243125940887e-8,5.209217831712024e-4,3.810779889170091e-5,-1.2908049988956758e-8,5.216188239536118e-4,3.817071047034634e-5,-1.2912046211167408e-8,5.222596846655533e-4,3.8389929217076366e-5,-1.295764933741635e-8,5.227776981227885e-4,3.870942493105218e-5,-1.3031193682067312e-8,5.231462221446176e-4,3.90449333361414e-5,-1.3111251595486714e-8,5.233834624169179e-4,3.9315346546736246e-5,-1.3176687479802485e-8,5.235394281321812e-4,3.946752696132619e-5,-1.3213083897284422e-8,5.236754233317036e-4,3.9485713744511626e-5,-1.3215295714260378e-8,5.238462568216775e-4,3.9387314888452363e-5,-1.3186630329662888e-8,5.240896667697123e-4,3.921173128856953e-5,-1.3136310014778118e-8,5.244226644038686e-4,3.900801174331826e-5,-1.3076572242619164e-8,5.248426426550115e-4,3.882439799199982e-5,-1.3020069826079723e-8,5.253311937372029e-4,3.870065090327242e-5,-1.2977767650741354e-8,5.258593061790778e-4,3.8663123547147846e-5,-1.2957402470289928e-8,5.263931056407179e-4,3.8722437005912813e-5,-1.2962597830659435e-8,5.268994400545242e-4,3.887355383309786e-5,-1.2992693609541672e-8,5.273506944811689e-4,3.909786013135494e-5,-1.304323238147115e-8,5.277283618928682e-4,3.9366737045691754e-5,-1.310693161469982e-8,5.280251104455353e-4,3.964596224958332e-5,-1.3174889451303355e-8,5.282454335082373e-4,3.990022972843365e-5,-1.3237768428264953e-8,5.284052231946588e-4,4.009736888639202e-5,-1.3286836033079106e-8,5.285305494829884e-4,4.021225325537939e-5,-1.3314912562979519e-8,5.286557060394544e-4,4.0230579521206196e-5,-1.3317363974876683e-8,5.288202403339737e-4,4.015271335318547e-5,-1.3293259523465599e-8,5.290641459351538e-4,3.999743645858218e-5,-1.3246644881952389e-8,5.29420183065172e-4,3.980429049478516e-5,-1.3187490243689071e-8,5.299032094367221e-4,3.963165594186321e-5,-1.313141009986588e-8,5.304988417193463e-4,3.9546878333224285e-5,-1.3097054263167734e-8,5.311574317731786e-4,3.96065921173356e-5,-1.3100650126240523e-8,5.318014578119245e-4,3.98319165292681e-5,-1.3149038022273758e-8,5.32349611324718e-4,4.019180005671327e-5,-1.3234910936428494e-8,5.327485204893838e-4,4.0608738174731215e-5,-1.3338177317094923e-8,5.32993774836213e-4,4.098800442554419e-5,-1.3433731281722263e-8,5.331274981533502e-4,4.125409164773492e-5,-1.3501160283562443e-8,5.332164335123858e-4,4.137379163363762e-5,-1.353087213849061e-8,5.333259193608972e-4,4.13576666322837e-5,-1.3524569124303872e-8,5.335024650995162e-4,4.124644008992089e-5,-1.3491904463169542e-8,5.337679129261047e-4,4.109355822924989e-5,-1.3446225415098136e-8,5.341216559001369e-4,4.0951180469202836e-5,-1.340113134321436e-8,5.345463734211426e-4,4.0861572281668134e-5,-1.3368231159593744e-8,5.350143019353962e-4,4.0852955656746325e-5,-1.3355852072504397e-8,5.354928423825327e-4,4.093817556745151e-5,-1.3368381791204466e-8,5.359493976739728e-4,4.111506478866112e-5,-1.3406093750610092e-8,5.363555591240247e-4,4.136805710751307e-5,-1.3465430533373401e-8,5.366906062535734e-4,4.167087291184944e-5,-1.353970510439085e-8,5.369441549435876e-4,4.199017748541348e-5,-1.3620131233801054e-8,5.371176836764395e-4,4.229004758300979e-5,-1.3697055796399448e-8,5.372246939412618e-4,4.2536815840649555e-5,-1.376122922588961e-8,5.372894831724115e-4,4.2703741062777625e-5,-1.3804984921125316e-8,5.373446669618185e-4,4.277512234113474e-5,-1.3823300988072162e-8,0.00053742757544824975,4.27496117961429e-5,-1.3814764582700658e-8,5.375755603610683e-4,4.264248462223457e-5,-1.3782413644499372e-8,5.378200593904353e-4,4.2486472593883745e-5,-1.373430126808111e-8,5.381792508290428e-4,4.233015478549633e-5,-1.368338167500512e-8,5.386499283189473e-4,4.223204705859813e-5,-1.3646059069466792e-8,5.392010226639216e-4,4.224848840771485e-5,-1.3638780125339982e-8,5.397734225659609e-4,4.2415447202705524e-5,-1.3672723821927818e-8,5.402914650870005e-4,4.272937436938092e-5,-1.3748141826012162e-8,5.406870951769552e-4,4.3138228021123006e-5,-1.3851605137995859e-8,5.409276624223462e-4,4.355360016244392e-5,-1.3959259082476329e-8,5.410308634400444e-4,4.388299832113226e-5,-1.404572807505199e-8,5.410560312127462e-4,4.406544519190341e-5,-1.409387560046213e-8,5.410774246421454e-4,4.4090008179269903e-5,-1.4099829500317099e-8,5.411566007764416e-4,4.399025355105983e-5,-1.4071552354515442e-8,5.413273035270495e-4,4.3823916588713976e-5,-1.4023612135435341e-8,5.415945168970027e-4,4.365179453199496e-5,-1.3971835246327046e-8,5.41941678191083e-4,4.3523829968479546e-5,-1.3929763987744986e-8,5.423397870270695e-4,4.3473105445618066e-5,-1.3906988846966135e-8,5.427550475932729e-4,4.3515132910834864e-5,-1.3908697960636151e-8,5.431542404764803e-4,4.364960885200329e-5,-1.393582992804166e-8,5.435083954292767e-4,4.386290135691708e-5,-1.3985503452994463e-8,5.437955680521673e-4,4.413075019834189e-5,-1.4051648813651171e-8,5.440031193610353e-4,4.442130458093591e-5,-1.4125847171957948e-8,5.441294904295869e-4,4.4698775986850106e-5,-1.4198377383350764e-8,5.441851609821107e-4,4.4927902109817414e-5,-1.4259451932272639e-8,5.44192274379237e-4,4.5079042801761985e-5,-1.4300570677415424e-8,5.441825131835359e-4,4.513324877772769e-5,-1.4315854380231034e-8,5.441931678314615e-4,4.508643514283918e-5,-1.4303200161377657e-8,5.442616930190452e-4,4.495182030705989e-5,-1.4265097005812744e-8,5.444193252662113e-4,4.475992062198913e-5,-1.420891194830896e-8,5.446845113517835e-4,4.455563870804244e-5,-1.4146439051286658e-8,5.450570012046475e-4,4.439214140356481e-5,-1.4092482439868092e-8,5.455138259491807e-4,4.432123995689494e-5,-1.4062247519459378e-8,5.460091567979519e-4,4.4380529159655735e-5,-1.4067548181360422e-8,5.464806332929459e-4,4.457933352573298e-5,-1.411246534473196e-8,5.468639351101996e-4,4.488842557502628e-5,-1.41900303462031e-8,5.471137114483806e-4,4.5240836901430264e-5,-1.4282186009332701e-8,5.472228700801882e-4,4.5549104705021665e-5,-1.436459415403402e-8,5.472286408053625e-4,4.573542557700775e-5,-1.4415174862346914e-8,5.471991045330296e-4,4.576046398285103e-5,-1.4422216878027767e-8,5.47206448294467e-4,4.56349055279638e-5,-1.4387623676551349e-8,5.473019740297997e-4,4.5409058585348715e-5,-1.4324164571538933e-8,5.475045890269017e-4,4.5149831126079944e-5,-1.4249406835206891e-8,5.47803705825606e-4,4.4918876045973197e-5,-1.4180002072172085e-8,5.481698176479473e-4,4.4759851057189094e-5,-1.412830013525889e-8,5.48565692247331e-4,4.469494792163449e-5,-1.410125538583461e-8,5.489546078069922e-4,4.4727065395722936e-5,-1.4100722236229494e-8,5.493051789854964e-4,4.484400912140682e-5,-1.4124308082445898e-8,5.495938405083384e-4,4.5022613923846395e-5,-1.4166321890606745e-8,5.498062624304646e-4,4.523222436300298e-5,-1.4218687392005276e-8,5.499384595504489e-4,4.54378852388539e-5,-1.4271863647322725e-8,5.49997724894559e-4,4.560386201037831e-5,-1.4315865288538859e-8,5.500030030438457e-4,4.5697985530979016e-5,-1.434147018981161e-8,5.499839508065228e-4,4.5696843463098964e-5,-1.4341625669559141e-8,5.499779032270899e-4,4.559110119398946e-5,-1.4312908167490931e-8,5.500244181110129e-4,4.5389582007094315e-5,-1.4256724128095877e-8,5.50157883005538e-4,4.512048381923619e-5,-1.417984329569152e-8,5.503995686945172e-4,4.482844257285975e-5,-1.4093882581779136e-8,5.507511242321261e-4,4.456714389146746e-5,-1.4013561269086788e-8,5.511914791808575e-4,4.438847474538031e-5,-1.3953862718354635e-8,5.516785262955729e-4,4.43302010252111e-5,-1.3926532510634918e-8,5.521561635635225e-4,4.4404755979930705e-5,-1.3936611787065186e-8,5.525663239678071e-4,4.459220322119048e-5,-1.3979975801327925e-8,5.528642063231052e-4,4.484065587117192e-5,-1.4043007349154969e-8,5.530328973052125e-4,4.507661529127626e-5,-1.4105288308440919e-8,5.530916519570143e-4,4.522480506594574e-5,-1.4145236907282978e-8,5.530923528858961e-4,4.523202408225343e-5,-1.4147030087645297e-8,5.531031506537776e-4,4.5085084291692684e-5,-1.4105860437065999e-8,5.531855430718504e-4,4.4813819040833696e-5,-1.4028958709191986e-8,5.533755526889687e-4,4.447784879142051e-5,-1.3932084645392354e-8,5.536768815553462e-4,4.41448232435347e-5,-1.3833668292310375e-8,5.540662856310166e-4,4.387093911013423e-5,-1.3749517436350942e-8,5.545054107827476e-4,4.369036706870036e-5,-1.3689826206305373e-8,5.549526056740539e-4,4.3613801028485625e-5,-1.3658542876311258e-8,5.553711420623051e-4,4.363257224331595e-5,-1.3654223719707622e-8,5.55733434845886e-4,4.3724503286497815e-5,-1.3671440617076656e-8,5.560225166865299e-4,4.385919757848827e-5,-1.3702164569045507e-8,5.56232263778228e-4,4.400211587684637e-5,-1.3736921152732457e-8,5.563673733728169e-4,4.4117846392702796e-5,-1.376575922796316e-8,5.564433941300915e-4,4.4173372568585065e-5,-1.3779194966470485e-8,5.564864419333089e-4,4.414206095567587e-5,-1.3769317275568825e-8,5.565317072407061e-4,4.4008603643539826E-05,-1.373115531210439e-8,5.566196665612034e-4,4.377426004116058e-5,-1.3664180386757936e-8,5.567893255742785e-4,4.3460653879901505e-5,-1.3573495648336821e-8,5.5706903259323e-4,4.3109638309396154e-5,-1.3470018373719109e-8,5.574671621600434e-4,4.277713905643178e-5,-1.3369019224232388e-8,5.579663031544923e-4,4.25209069743737e-5,-1.3286905991693288e-8,5.585242506155931e-4,4.2385091814629774e-5,-1.323695369887385e-8,5.590827837639093e-4,4.238670958930531e-5,-1.322532616995296e-8,5.595820943030839e-4,4.2508928121728134e-5,-1.324879527303495e-8,5.599765436803205e-4,4.270375260425213e-5,-1.3295025360336303e-8,5.602470647653046e-4,4.290357624198227e-5,-1.3345467218010926e-8,5.604066433327727e-4,4.3038521618008536e-5,-1.3380135565607916e-8,5.604971361354452e-4,4.305496671614097e-5,-1.3382982052173816e-8,5.605778644400599e-4,4.293002467591174e-5,-1.3346289025681776e-8,5.607089623263255e-4,4.267729978794635e-5,-1.3272636519098559e-8,5.609347399582315e-4,4.234165410834814e-5,-1.3173718674744843e-8,5.61272824224999e-4,4.1984822487049506e-5,-1.3066489427049024e-8,5.617125088503604e-4,4.1667542738988164e-5,-1.2968201743518012e-8,5.622215885905281e-4,4.1434866394617e-5,-1.289219032748799e-8,5.627575830200749e-4,4.130882130901546e-5,-1.2845587660872705e-8,5.632786025023382e-4,4.1288594336048484e-5,-1.2829102735199409e-8,5.637508743402848e-4,4.135555763250854e-5,-1.2838217765699319e-8,5.641523616550949e-4,4.147987966628914e-5,-1.2864954028178306e-8,5.644734987008431e-4,4.1626480056051095e-5,-1.2899567931198906e-8,5.647164882240774e-4,4.1759528984558676e-5,-1.2931887162585448e-8,5.648942535231952e-4,4.184578296212132e-5,-1.2952297818560158e-8,5.650294889116143e-4,4.1857547900959665e-5,-1.2952577895423737e-8,5.651535715361088e-4,4.177605896823371e-5,-1.2926828568155383e-8,5.653044894483615e-4,4.159567182824132e-5,-1.287267633441649e-8,5.655225692094629e-4,4.132839759346974e-5,-1.279266224815386e-8,5.658430328778544e-4,4.100697766475647e-5,-1.2695307297663935e-8,5.662857653330005e-4,4.068344030322492e-5,-1.2594934042639526e-8,5.668451659124272e-4,4.042019197207262e-5,-1.2509327194232984e-8,5.674853336557398e-4,4.027347907363591e-5,-1.2455107328985577e-8,5.681455713211361e-4,4.027408208489247e-5,-1.244214622307206e-8,5.68756746685192e-4,4.0414004798879e-5,-1.2469513131187434e-8,5.692626340933667e-4,4.0646580039138516e-5,-1.2525133623159566e-8,5.696369955166504e-4,4.090066807453131e-5,-1.2589478046435055e-8,5.698896665275624e-4,4.110245921092196e-5,-1.2641551835441664e-8,5.700608716068607e-4,4.1195953729986446e-5,-1.2664715990718236e-8,5.702077505850598e-4,4.1155798139361454e-5,-1.2650540717421748e-8,5.703884759901265e-4,4.099042424392756e-5,-1.2600051493450478e-8,5.706483903579017e-4,4.073662588412746e-5,-1.2522583891047876e-8,5.710109691405875e-4,4.0448332338844876e-5,-1.243290518949643e-8,5.714748841309391e-4,4.0182934684654554E-05,-1.2347452802728689e-8,5.720170435890389e-4,3.9988544477136714e-5,-1.2280615128135358e-8,5.726001321744273e-4,3.9895057969472874e-5,-1.2241921421025485e-8,5.731821206679281e-4,3.991064069654339e-5,-1.2234717623019245e-8,5.737250198595423e-4,4.002343402058786e-5,-1.2256397133360156e-8,5.742009861844149e-4,4.0206784374766535e-5,-1.2299779958393722e-8,5.745952088943357e-4,4.042579305071043e-5,-1.2355009254206567e-8,5.749061274942017e-4,4.064339540438695e-5,-1.2411383146639144e-8,5.751440773201222e-4,4.0825069665894794e-5,-1.2458778726029885e-8,5.753293799587323e-4,4.094221059405223e-5,-1.2488629625521792e-8,5.754904006567578e-4,4.097477176506438e-5,-1.2494646793562146e-8,5.756615125629631e-4,4.0913864151746437e-5,-1.2473547362790684e-8,5.758803459554417e-4,4.076472695839921e-5,-1.24259847650868e-8,5.761832436211499e-4,4.0549772255380785e-5,-1.2357617600292305e-8,5.765979379808243e-4,4.0310124351701156e-5,-1.2279811549458918e-8,5.771336876089873e-4,4.010269549721812e-5,-1.2209012413795871e-8,5.777716895829274e-4,3.9989598090760646e-5,-1.2163757626176808e-8,5.784616465902294e-4,4.001937776225071e-5,-1.2159125570823381e-8,5.791308482835355e-4,4.020580099469462e-5,-1.2200322952745242e-8,5.797065295022585e-4,4.0515899636114696e-5,-1.2278907274980914e-8,5.80142457888133e-4,4.087731150446172e-5,-1.2374661952472232e-8,5.804354401798264e-4,4.120363917341638e-5,-1.2462792256088949e-8,5.806232139856671e-4,4.142456024104346e-5,-1.2522577976320966e-8,5.807671988462954e-4,4.1505812543823224e-5,-1.2543184545504214e-8,5.809309310098887e-4,4.145299058481706e-5,-1.2524943479233836e-8,5.811633911987712e-4,4.130273058000135e-5,-1.2477155055317291e-8,5.814906054594975e-4,4.110843349549538e-5,-1.241437134424403e-8,5.819145513730104e-4,4.092617541810449e-5,-1.2352610977888855e-8,5.824169208822125e-4,4.0803658015597504e-5,-1.2306198503680667e-8,5.829655041898003e-4,4.077300848955851e-5,-1.2285457641107754e-8,5.835216304790936e-4,4.08473506951388e-5,-1.2295353076190144e-8,5.840475044047213e-4,4.1020878040647856e-5,-1.2335168157344423e-8,5.845123946407954e-4,4.1271912795883656e-5,-1.2399194688289209e-8,5.848968676341912e-4,4.1568009920163966e-5,-1.247819580484653e-8,5.851947152164219e-4,4.1871931312817365e-5,-1.2561243079423654e-8,5.854127287371877e-4,4.214737362730478e-5,-1.2637501168654626e-8,5.855689082537816e-4,4.236363657066199e-5,-1.2697641820982583e-8,5.856898580934266e-4,4.2498978178316354e-5,-1.2734800220127118e-8,5.85807889067023e-4,4.254292268264029e-5,-1.2745207957826337e-8,5.859579513795578e-4,4.249795347224145e-5,-1.272871639020561e-8,5.861741086786202e-4,4.2380895742717424e-5,-1.2689360718495551e-8,5.8648484953241e-4,4.2223796026970555e-5,-1.2635890084310931e-8,5.869065735812319e-4,4.2073073991807874e-5,-1.2581801894459312e-8,5.874356319421588e-4,4.19846475120227e-5,-1.2544061137121026e-8,5.880413756125081e-4,4.201259995003142e-5,-1.2539678227518325e-8,5.886653049404993e-4,4.219108683589354e-5,-1.2580052638216501e-8,5.8923238679551e-4,4.2514839582835756e-5,-1.266480189970253e-8,5.896756386652956e-4,4.2930283800824865e-5,-1.2778839288959433e-8,5.89964101552167e-4,4.334851356362142e-5,-1.2896139522771572e-8,5.901171113360668e-4,4.367814905014522e-5,-1.298951948589008e-8,5.901947880698806e-4,4.38602737483596e-5,-1.3040992057450742e-8,5.902714285460607e-4,4.3885736496831144e-5,-1.3046861211874255e-8,5.904086373518427e-4,4.3789236335983746e-5,-1.3016096632518927e-8,5.90640488345573e-4,4.362965960038413e-5,-1.2964884842237333e-8,5.90971946441086e-4,4.34695603945582e-5,-1.2911008855333938e-8,5.913852195337234e-4,4.336092270372908e-5,-1.2869904121306538e-8,5.918485774305888e-4,4.333812126088688e-5,-1.285252461742886e-8,5.923245446952727e-4,4.3416150897318016e-5,-1.2864501648532461e-8,5.927764593066211e-4,4.359190961413261e-5,-1.2906114467297666e-8,5.931734732856898e-4,4.384714236114294e-5,-1.2972841846778543e-8,5.934942150203255e-4,4.4152466088083324e-5,-1.3056421398296158e-8,5.937291030815587e-4,4.447215885443439e-5,-1.3146311817982143e-8,5.938811933955622e-4,4.47693426906656e-5,-1.3231356330999967e-8,5.93965485886057e-4,4.5011077674093984e-5,-1.3301399351245954e-8,5.94006799600864e-4,4.5172770496475155e-5,-1.334862131885749e-8,5.940365840398179e-4,4.5241413682133494e-5,-1.336846818500244e-8,5.940891110207756e-4,4.521750624615486e-5,-1.3360212923084611e-8,5.941973595900601e-4,4.511571456359875e-5,-1.3327250246980502e-8,5.943887128092454e-4,4.4964352725929755e-5,-1.3277177720368145e-8,5.946803298205737e-4,4.480359021479988e-5,-1.3221572693952442E-08,5.950740552025116e-4,4.4681698944798734e-5,-1.3175121289205661e-8,5.955515209880322e-4,4.4648007751150914e-5,-1.3153551831570361e-8,5.960715426732222e-4,4.474149532569575e-5,-1.3169977028198143e-8,5.965733804112413e-4,4.4975795704802126e-5,-1.3229934760324216e-8,5.969897334847129e-4,4.5325368620618036e-5,-1.3326761651752678e-8,5.972695820723137e-4,4.572244176421522e-5,-1.3440440521292401e-8,5.974020923934746e-4,4.607385900358259e-5,-1.3542760448690568e-8,5.974260041454101e-4,4.6295468638069834e-5,-1.3607887991505155e-8,5.974149745012774e-4,4.63461491160932e-5,-1.3622690856111841e-8,5.974464645346873e-4,4.62408255489987e-5,-1.3590608456208522e-8,5.975733330563519e-4,4.603711609863486e-5,-1.3527729382284185e-8,5.978120949073726e-4,4.5808229996933905e-5,-1.3455010772294891e-8,5.981476506938362e-4,4.561887790575258e-5,-1.3391473757723922e-8,5.985457456463102e-4,4.551241536514983e-5,-1.3350535217826406e-8,5.989652880636257e-4,4.550820785410715e-5,-1.3339057205444769e-8,5.993671400674556e-4,4.560473672048171e-5,-1.3357888193002322e-8,5.997192571010954e-4,4.578464443118222e-5,-1.340296607210915e-8,5.999993638835912e-4,4.601975491101805e-5,-1.3466562670281527e-8,6.001963194062474e-4,4.627562551405624e-5,-1.353859250547407e-8,6.003106951839153e-4,4.651585668922163e-5,-1.3607999789540018e-8,6.003545828554706e-4,4.670640694476506e-5,-1.3664190858733449e-8,6.003504102879558e-4,4.681993271445912e-5,-1.3698426655564152e-8,6.003285040062579e-4,4.6839792267256964e-5,-1.3705039077842174e-8,6.003233654665366e-4,4.6763054815347505e-5,-1.3682318721009288e-8,6.00368980029104e-4,4.6601915443853456e-5,-1.3632979669015082e-8,6.004936892972919e-4,4.638313791509782e-5,-1.3564152706925421e-8,6.007152397239569e-4,4.6145339984406526e-5,-1.348684271745055e-8,6.010365913857648e-4,4.5934168128419516e-5,-1.3414767746104295e-8,6.014429942225124e-4,4.5795480210201754e-5,-1.3362464203894209e-8,6.019011057532637e-4,4.576653383496385e-5,-1.334252963495435e-8,6.023615895275835e-4,4.586559553492988e-5,-1.3362105344807452e-8,6.027669935205449e-4,4.608188309838632e-5,-1.3419300705541302e-8,6.030658883371729e-4,4.6370003546858796e-5,-1.350105745458068e-8,6.032312519987232e-4,4.66548633865428e-5,-1.3584497719127712e-8,6.032758091670896e-4,4.685133527899667e-5,-1.3643100300052348e-8,6.032535495762095e-4,4.6894725810143705e-5,-1.365628640799527e-8,6.03241729155245e-4,4.6767362660908595e-5,-1.3617683021674188e-8,6.033108166392385e-4,4.65049510596044e-5,-1.3537085025814027e-8,6.034993182490741e-4,4.617895985207165e-5,-1.3435213551070888e-8,6.038060843341433e-4,4.5867317225684895e-5,-1.3335114749071355e-8,6.041994185155103e-4,4.563018257654167e-5,-1.3255104395874068e-8,6.046332663829588e-4,4.549926714185694e-5,-1.3205572436516151e-8,6.05061438746373e-4,4.5478931464839044e-5,-1.3189054107180226e-8,6.054462336936745e-4,4.555306960662015e-5,-1.3201909329785792e-8,6.05762009514742e-4,4.5692876070382345e-5,-1.3236331295070042e-8,6.059957599659084e-4,4.586321651672058e-5,-1.3282117826334546e-8,6.061465022300673e-4,4.6027351570760987e-5,-1.332813231699191e-8,6.062243702543427e-4,4.615066462844048e-5,-1.3363565264245378e-8,6.062495021200464e-4,4.620409516581872e-5,-1.3379104609315037e-8,6.062503718534889e-4,4.616766157689615e-5,-1.3368067825864579e-8,6.062610395188557e-4,4.6033924576426214e-5,-1.3327457601791911e-8,6.063169469718518e-4,4.581063544655485e-5,-1.3258772884036288e-8,6.064494044595206e-4,4.55215188896636e-5,-1.3168331958415403e-8,6.066795318747286e-4,4.52042881604833e-5,-1.3066866709055663e-8,6.070128998625647e-4,4.490545427349359e-5,-1.2968213330564991e-8,6.074363111856063e-4,4.467226793872749e-5,-1.2887087372606102e-8,6.079179098524724e-4,4.4543009907630994e-5,-1.2836174421477544e-8,6.084112436310817e-4,4.453736700212919e-5,-1.282297992625794e-8,6.08863370461571e-4,4.464886329443632e-5,-1.2847073663286673e-8,6.092264758703546e-4,4.4841679024146196e-5,-1.289860746681526e-8,6.094712937410751e-4,4.505445305432866e-5,-1.2959127922180999e-8,6.095987972448405e-4,4.521292039621171e-5,-1.3005410854173592e-8,6.096448764943399e-4,4.5250510079934645e-5,-1.3016030794821033e-8,6.096730138384927e-4,4.513114561506076e-5,-1.2978711001202054e-8,6.097545631549566e-4,4.486402580498518e-5,-1.2895124516848801e-8,6.099439852908066e-4,4.450134061490781e-5,-1.2780348513948726e-8,6.102610819546051e-4,4.4118743907326676e-5,-1.265702267633818e-8,6.106884949894511e-4,4.378880296374916e-5,-1.2547376438516559e-8,6.111831302385094e-4,4.356052924504412e-5,-1.2467023709897674e-8,6.116930853079845e-4,4.3451843285146805e-5,-1.2422507196552202e-8,6.121718091847651e-4,4.3453283807383274e-5,-1.2412110270198072e-8,6.125859229567852e-4,4.3537061943772174e-5,-1.242828767855344e-8,6.129174051327997e-4,4.3666315988779066e-5,-1.2460290569013057e-8,6.131625421240779e-4,4.380214478201701e-5,-1.249629588729844e-8,6.133297797994605e-4,4.390824915390768e-5,-1.2524935334363993e-8,6.134376059320164e-4,4.395405443660182e-5,-1.2536392208869133e-8,6.135126429920539e-4,4.391729178049016e-5,-1.2523285610369912e-8,6.135875232541355e-4,4.37866565556534e-5,-1.248151062142838e-8,6.136978474050366e-4,4.3564553195397556e-5,-1.2411078877572878e-8,6.138776204707606e-4,4.3269171658970975e-5,-1.2316794930864575e-8,6.141531157431434e-4,4.293451537346142e-5,-1.2208394276352459e-8,6.145360882992824e-4,4.260690395661579e-5,-1.2099680577646451e-8,6.150183068876578e-4,4.233718420343913e-5,-1.2006354865178858e-8,6.155698862543469e-4,4.216944569007125e-5,-1.194266561911202e-8,6.161432780116315e-4,4.212893829735594e-5,-1.191760894514987e-8,6.166829962369822e-4,4.221304211145604e-5,-1.1931838226690434e-8,6.171390028809723e-4,4.2388733189199025e-5,-1.1976435073662864e-8,6.174801786565707e-4,4.2598204728411776e-5,-1.2034228597516467e-8,6.177039713164523e-4,4.2771969148489644e-5,-1.2083631887323418e-8,6.178390324477566e-4,4.284658717591776e-5,-1.2104190944765916e-8,6.179391490155112e-4,4.2782467541547576e-5,-1.2082381407395732e-8,6.180690499519215e-4,4.257622589977647e-5,-1.2015807665370394e-8,6.182856981106309e-4,4.2262641290182364e-5,-1.1914142478848567e-8,6.186214061728539e-4,4.1904306638940616e-5,-1.1796159869780265e-8,6.190753692770967e-4,4.1572254817565175e-5,-1.168386155567887e-8,6.196167242703293e-4,4.1325277041778395e-5,-1.1596058210408694e-8,6.201967488488639e-4,4.119594759437842e-5,-1.1543865254199268e-8,6.20764019662867e-4,4.118716574602068e-5,-1.1529328261415304e-8,6.21276549030351e-4,4.127757978552318e-5,-1.154678533548196e-8,6.217080946567695e-4,4.143120927489927e-5,-1.1585638643255654e-8,6.220491812385284e-4,4.1606888823869886e-5,-1.1633240123016763e-8,6.223049974865838e-4,4.176527688606243e-5,-1.1677161479087305e-8,6.224922388533137e-4,4.1873203335198556e-5,-1.1706688765447071e-8,6.226360955927154e-4,4.1906205539858945e-5,-1.1713717885084007e-8,6.227676718629662e-4,4.185030251602371e-5,-1.1693341505436549E-08,6.229214415278793e-4,4.1703735041523074e-5,-1.1644381723185078e-8,6.231319853664534e-4,4.147878640125714e-5,-1.1569970337746821e-8,6.234292802965761e-4,4.120299476324085e-5,-1.1478018587251494e-8,6.238323413543623e-4,4.0918246606836314e-5,-1.1381111507640178e-8,6.243421835840833e-4,4.067585345858345e-5,-1.1295177991775304e-8,6.249366570621865e-4,4.052646987191822e-5,-1.1236482520549367e-8,6.255707246045346e-4,4.0506051125566727e-5,-1.1217220872998886e-8,6.261847863392266e-4,4.062225481812146e-5,-1.124105993740093e-8,6.267202336075681e-4,4.08475845493812e-5,-1.1300642714626034e-8,6.271371716095217e-4,4.112393555640522e-5,-1.1378640363826194e-8,6.274272002337375e-4,4.137818217173511e-5,-1.1452374173663731e-8,6.276160661029025e-4,4.1543172110683946e-5,-1.1500321761911784e-8,6.277555903893943e-4,4.157642470580568e-5,-1.1508102924530854e-8,6.27908422691926e-4,4.147064598947023e-5,-1.1472061584588963e-8,6.281309101857208e-4,4.125382444025051e-5,-1.1399670417759892e-8,6.284589806615875e-4,4.0979990293322234e-5,-1.1307001676311571e-8,6.289004951050204e-4,4.071397673517665e-5,-1.1214196847662963e-8,6.294355537344494e-4,4.051475934856745e-5,-1.1140281814471427e-8,6.300239373611482e-4,4.0422039237037176e-5,-1.1098767800734435e-8,6.306167817204206e-4,4.044943019418976e-5,-1.1095165829009265e-8,6.311685570877783e-4,4.058515042629986e-5,-1.1126836428171848e-8,6.316459742628735e-4,4.079850842401508e-5,-1.1184776656645354e-8,6.320322305868174e-4,4.104897677346346e-5,-1.1256406714476454e-8,6.323269912046183e-4,4.129481071708473e-5,-1.1328374881368757e-8,6.325436800244089e-4,4.149944694038418e-5,-1.138873428162963e-8,6.327057717418874e-4,4.16353572641571e-5,-1.142829124798009e-8,6.3284320211077e-4,4.168599958414399e-5,-1.144127484924841e-8,6.329892507073682e-4,4.1646813714983565e-5,-1.1425641935138297e-8,6.331776221375067e-4,4.1525972124440285e-5,-1.1383308731724334e-8,6.334390698103364e-4,4.134505386970275e-5,-1.1320431548573354e-8,6.337968406765966e-4,4.1139068109295805e-5,-1.1247577530122925e-8,6.342606793062239e-4,4.0954382499360176e-5,-1.1179279984573037e-8,6.34820349377044e-4,4.084256691331992e-5,-1.1132243894526839e-8,6.354414692002509e-4,4.084884439949683e-5,-1.1121682761778917e-8,6.360679001502076e-4,4.0996568100376256e-5,-1.1156195968997953e-8,6.366339468110234e-4,4.1273455162251384e-5,-1.1233067444498262e-8,6.370847593082296e-4,4.162814226045832e-5,-1.1336844237008164e-8,6.37396720814852e-4,4.1982708229566924e-5,-1.1443112874876232e-8,6.375870858518857e-4,4.225789061658065e-5,-1.1526456467575253e-8,6.377074182492132e-4,4.239935949578947e-5,-1.1568844891267493e-8,6.378247532323368e-4,4.239301187350808e-5,-1.1564617122042744e-8,6.380001550354765e-4,4.226467189936685e-5,-1.1520634437041544e-8,6.382730696351323e-4,4.20678159364482e-5,-1.145275407366425e-8,6.386547983664781e-4,4.186642207611976e-5,-1.1380759726833166e-8,6.391301491825187e-4,4.1718969727590826e-5,-1.1323481608403951e-8,6.396645134501095e-4,4.16669354931265E-05,-1.1295058824572489e-8,6.402135211432802e-4,4.1728883630486846e-5,-1.130272523179324e-8,6.407329313863037e-4,4.189994975384543e-5,-1.1346210158588048e-8,6.411869273337647e-4,4.215579668992807e-5,-1.141864418294653e-8,6.415535317098374e-4,4.245951292741821e-5,-1.1508603446175233e-8,6.418266451670236e-4,4.276953906141313e-5,-1.160268944345754e-8,6.420150711981394e-4,4.3046889911181794e-5,-1.168800792468656e-8,6.42139481568027e-4,4.326056338850396e-5,-1.1754073581974093e-8,6.422284650134046e-4,4.3390762964130205e-5,-1.1793939423120785e-8,6.423145863944254e-4,4.343025232088572e-5,-1.1804643333497793e-8,6.424308611712833e-4,4.3384560725109035e-5,-1.1787259369334247e-8,6.426075271147033e-4,4.327164998942055e-5,-1.1746830998873365e-8,6.428686772623222e-4,4.312121499188235e-5,-1.1692290186969063e-8,6.43228211111064e-4,4.297319789412587e-5,-1.163620160738782e-8,6.436849034127897e-4,4.2874338512484316e-5,-1.1593853762600689e-8,6.442175178239869e-4,4.287106863696716e-5,-1.1581024865378009e-8,6.447826241944376e-4,4.299769946587701e-5,-1.1610003778983072e-8,6.453192106631316e-4,4.326148989808878e-5,-1.1684410461728622e-8,6.457633643151136e-4,4.363072674477005e-5,-1.179495428359945e-8,6.460709780358177e-4,4.403539258500074e-5,-1.1919425251124777e-8,6.46238269440531e-4,4.438654427814625e-5,-1.202896701159812e-8,6.463067360377512e-4,4.460863357575101e-5,-1.2098638955452586e-8,6.463473522053487e-4,4.466782983677177e-5,-1.2116629130642991e-8,6.464328198700985e-4,4.458091988511223e-5,-1.2087172530117929e-8,6.466134080396352e-4,4.440296244483021e-5,-1.2026767218001455e-8,6.469062893985017e-4,4.420432212394621e-5,-1.1957162905655501e-8,6.472980673486538e-4,4.4049415375376975e-5,-1.1898899064049858e-8,6.477545569824074e-4,4.398348465637827e-5,-1.1867178141227173e-8,6.482321283936542e-4,4.402769158632383e-5,-1.1870077472484313e-8,6.486874451684293e-4,4.4180110616365914e-5,-1.190843181001741e-8,6.490845942283705e-4,4.442004791255551e-5,-1.1976767655848106e-8,6.493996674170178e-4,4.471399475420608e-5,-1.2064930829832403e-8,6.496230132730473e-4,4.502224997790057e-5,-1.2160170877601224e-8,6.497593165315699e-4,4.530541463222377e-5,-1.2249376594925378e-8,6.498257985589669e-4,4.5530023897967826e-5,-1.2321106524374785e-8,6.498490150835266e-4,4.5672787320462324e-5,-1.2367125184429808e-8,6.49860849248668e-4,4.5723111388483726e-5,-1.2383285624306336e-8,6.498943459428724e-4,4.56838734642481e-5,-1.2369777794004631e-8,6.499798483583396e-4,4.5570805788698724e-5,-1.2330940194194202e-8,6.50141540921297e-4,4.5410946737608354e-5,-1.2274858062634918e-8,6.50394252361549e-4,4.524034632505981e-5,-1.2212820673742356e-8,6.507402898474811e-4,4.510081644081227e-5,-1.2158498221920027e-8,6.511662941424877e-4,4.503501619399875e-5,-1.2126476181320007e-8,6.516409652377725e-4,4.507883196177047e-5,-1.2129687005367259e-8,6.521158333795178e-4,4.525065636203942e-5,-1.2175577965498676e-8,6.525322031476455e-4,4.553941364164363e-5,-1.2261726884082065e-8,6.528365381010586e-4,4.5896913451435045e-5,-1.2372957541494924e-8,6.53001864278318e-4,4.6243075736359524e-5,-1.2482966177543175e-8,6.530450153429226e-4,4.6489294263523875e-5,-1.2562182212005331e-8,6.530262302326049e-4,4.657300931178719e-5,-1.2589338662501737e-8,6.530266241761063e-4,4.6484341852986244e-5,-1.2560253186849565e-8,6.531153745404709e-4,4.626789168937222e-5,-1.248839206681805e-8,6.533259500794602e-4,4.600025166059354e-5,-1.2397689341809364e-8,6.536518626923442e-4,4.5759473698595974e-5,-1.2312978138197302e-8,6.540578644141293e-4,4.56028117197643e-5,-1.2253084886290816e-8,6.544960449519266e-4,4.555825704891566e-5,-1.222809841334969e-8,6.549192256583115e-4,4.562646405711048e-5,-1.2239671643138295e-8,6.552892641813089e-4,4.578752220519903e-5,-1.2282737836356728e-8,6.555809511761707e-4,4.6008638879196065e-5,-1.23475952409882e-8,6.557831063329746e-4,4.625097547136351e-5,-1.2421941128098137e-8,6.558981448308248e-4,4.647540239116749e-5,-1.2492798538365653e-8,6.559406151232579e-4,4.664739366488725e-5,-1.2548313680324879e-8,6.55934795368779e-4,4.674108669115587e-5,-1.2579299722569738e-8,6.559114262674878e-4,4.674234926529412e-5,-1.258037528172128e-8,6.559037475636952e-4,4.6650576798607184e-5,-1.2550589153337167e-8,6.559431799480559e-4,4.647890047352641e-5,-1.2493483386171588e-8,6.560551490320222e-4,4.625272895401807e-5,-1.241665830734056e-8,6.562554736211841e-4,4.6006843480568736e-5,-1.2330965549949725e-8,6.565475621712678e-4,4.5781298533340715e-5,-1.224938677601268e-8,6.569205673771478e-4,4.561626701972796e-5,-1.2185538559539806e-8,6.573487109405446e-4,4.554580590585966e-5,-1.2151659149246088e-8,6.577924153502072e-4,4.5590415220543125e-5,-1.215594635662814e-8,6.58202593113294e-4,4.574881097857109e-5,-1.2199412084801173e-8,6.585297262397721e-4,4.59909687918636e-5,-1.2273096298199133e-8,6.587382425042407e-4,4.62568085760598e-5,-1.2357324481940705e-8,6.588231495329708e-4,4.646624084061321e-5,-1.2425073606254522e-8,6.588204978599106e-4,4.65431768960108e-5,-1.2450244405357208e-8,6.588012287440477e-4,4.644637290291428e-5,-1.2418191579088436e-8,6.588458419334591e-4,4.61899779128904e-5,-1.2332619928155143e-8,6.590119357198074e-4,4.5838877755827045e-5,-1.2214031205022718e-8,6.593137391720427e-4,4.548068499544168e-5,-1.2090617955505468e-8,6.597236153319567e-4,4.519227164557173e-5,-1.1987544773090963e-8,6.601895628610029e-4,4.5018724180246425e-5,-1.1920237507966108e-8,6.606554423138694e-4,4.49697296954195e-5,-1.189308702067798e-8,6.610749674083071e-4,4.502738150794323e-5,-1.1901620274760557e-8,6.614178803084616e-4,4.515738862713096e-5,-1.1935726383931564e-8,6.616706357616994e-4,4.531887849385159e-5,-1.1982572911828448e-8,6.61834447382716e-4,4.547133072107415e-5,-1.2028824379413137e-8,6.6192264137107e-4,4.5579126378920714e-5,-1.2062283892577649e-8,6.619580115031964e-4,4.561475770029697e-5,-1.2073180904243843e-8,6.619700433900955e-4,4.556135838574398e-5,-1.2055197467963607e-8,6.61991699576438e-4,4.5414661343623503e-5,-1.200620365179172e-8,6.620555712945934e-4,4.51840896179602e-5,-1.1928622796913211e-8,6.621894741458482e-4,4.489240920507422e-5,-1.182931385336294e-8,6.624119923538018e-4,4.457342997377879e-5,-1.1718880084197724e-8,6.627287685916333e-4,4.4267655432898346e-5,-1.1610397059841187e-8,6.631303288208212e-4,4.401622188040044e-5,-1.1517614629584648e-8,6.635920520441031e-4,4.3853814799379214e-5,-1.1452739383809711e-8,6.640766309640293e-4,4.3801500136949246e-5,-1.1423990223408127e-8,6.645391547065707e-4,4.3860465762502585e-5,-1.1433213609765761e-8,6.649348907757294e-4,4.400781803244625e-5,-1.1474022268078109e-8,6.652295738743438e-4,4.4196208170768975e-5,-1.1531237312247409e-8,6.654109062286146e-4,4.435975285734818e-5,-1.1582666541464982e-8,6.654978651706966e-4,4.442827675775156e-5,-1.1603994416442983e-8,6.655421492594667e-4,4.434891282437948e-5,-1.1576365369570233e-8,6.656163939754637e-4,4.410816482066763e-5,-1.1494114352982963e-8,6.657897957674164e-4,4.3742356818358154e-5,-1.136844192019311e-8,6.661014873919342e-4,4.332714263267976e-5,-1.1223980436229123e-8,6.66546435586102e-4,4.294919512763321e-5,-1.1089453851181167e-8,6.670813088959861e-4,4.267547632709114e-5,-1.0987569771282318e-8,6.676444956798761e-4,4.2535713727573955e-5,-1.0929181332560628e-8,6.681774843805674e-4,4.252258156620681e-5,-1.0913107238000703e-8,6.686384044883153e-4,4.260325002735994e-5,-1.0929587800350869e-8,6.690062161390295e-4,4.2733346818073974e-5,-1.0964592948012124e-8,6.692787368457985e-4,4.286787118068754e-5,-1.1003310653399214e-8,6.694682707915127e-4,4.296777011126571e-5,-1.1032406940396475e-8,6.695972389198812e-4,4.300322240539698e-5,-1.1041321064106932e-8,6.696946149272839e-4,4.295523829967347e-5,-1.1023008875669534e-8,6.697929196037282e-4,4.2816698354687566e-5,-1.0974419442589062e-8,6.699251733474295e-4,4.2593196764431914e-5,-1.0896807753560433e-8,6.701212865700194e-4,4.230341044442153e-5,-1.0795842637994127e-8,6.704037174690174e-4,4.1978221761531796e-5,-1.0681328919295532e-8,6.707828559139265e-4,4.1657672615155404e-5,-1.0566288547495148e-8,6.712532690016723e-4,4.138524242901553e-5,-1.0465216530512158e-8,6.717922865944109e-4,4.119981360746378e-5,-1.0391550497627238e-8,6.723621835534646e-4,4.112674104581725e-5,-1.0354712996658229e-8,6.729163674503193e-4,4.117028254115718e-5,-1.0357404924622589e-8,6.734087601805087e-4,4.1309743555585105e-5,-1.0393953428156289e-8,6.738045432664134e-4,4.150094656252346e-5,-1.0450378613876328e-8,6.740899326696811e-4,4.168357203370962e-5,-1.0506544084907395e-8,6.742784623792691e-4,4.1793849405908306e-5,-1.0540362360195925e-8,6.744112537778521e-4,4.178074134045985e-5,-1.053345924363471e-8,6.745493044657425e-4,4.1621948675312874e-5,-1.0476951591107518e-8,6.747577135709221e-4,4.1334207987166106e-5,-1.0375304924468307e-8,6.750854372839487e-4,4.097200972504231e-5,-1.0246168788815136e-8,6.755482329271165e-4,4.0612262569480024e-5,-1.0115334350837037e-8,6.761231653952755e-4,4.032957409188221e-5,-1.0008413784011982e-8,6.767578521833027e-4,4.017301604488647e-5,-9.94290139609733e-9,6.773894310269758e-4,4.015465619698559e-5,-9.924065754328441e-9,6.779636072244319e-4,4.025271194279116e-5,-9.945684323589636e-9,6.784462992592076e-4,4.042426218751692e-5,-9.994032077050076e-9,6.788262531519046e-4,4.0619750895181834e-5,-1.0052621713449427e-8,6.791114670866537e-4,4.0793953317949755e-5,-1.0105937498144301e-8,6.793233103813246e-4,4.091197852871128e-5,-1.0141630257049476e-8,6.794909850969935e-4,4.0951453051865014e-5,-1.01514585939184e-8,6.7964728168145e-4,4.090274064307937e-5,-1.0131510062344522e-8,6.798254076015645e-4,4.076859742149239e-5,-1.0082138915684628e-8,6.800561699820016e-4,4.0563850495158245e-5,-1.0007849266961698e-8,6.8036477449427e-4,4.031492566409186e-5,-9.917132870207206e-9,6.807668440871827e-4,4.0058407100975396e-5,-9.822042726828585e-9,6.812639721347429e-4,3.98374389784475e-5,-9.737104678895134e-9,6.818400995093161e-4,3.9695020030860256e-5,-9.677186556046806e-9,6.824608377364019e-4,3.966437272967973e-5,-9.65429089058683e-9,6.830778514977682e-4,3.975846050622824e-5,-9.673896804332269e-9,6.8363893699842e-4,3.996251016407234e-5,-9.732153955509115e-9,6.841017372567231e-4,4.023361206932423e-5,-9.815394137449953e-9,6.844466228191916e-4,4.05092582535884e-5,-9.902727164968086e-9,6.846838738110617e-4,4.072297495515305e-5,-9.971213593928136e-9,6.848523051199315e-4,4.082220466885166e-5,-1.000201594026922e-8,6.850095982123903e-4,4.07828469698932e-5,-9.98560223372568e-9,6.852171873960667e-4,4.0616222783899834e-5,-9.924483469796086e-9,6.855238737488718e-4,4.036653532224773e-5,-9.832728989987601e-9,6.859526224257744e-4,4.00993290741107e-5,-9.732322816114245e-9,6.86494446675017e-4,3.988386503340198e-5,-9.647264291981038e-9,6.871115650576727e-4,3.977452661168896e-5,-9.597109977300679e-9,6.877489646437295e-4,3.979728759741124e-5,-9.592045225736865e-9,6.883501673843535e-4,3.994563772478752e-5,-9.631095222420986e-9,6.888714062386018e-4,4.018638516815171e-5,-9.70376889018204e-9,6.89289773006254e-4,4.047168422173579e-5,-9.79400284884246e-9,6.896042371432542e-4,4.075196513064055e-5,-9.884614283434994e-9,6.898314601928995e-4,4.0985699460782386e-5,-9.960814485912439e-9,6.899994707481199e-4,4.114457896454388e-5,-1.0012195088317796e-8,6.901416346331935e-4,4.1214864630885974e-5,-1.0033353714839723e-8,6.902920197616812e-4,4.119656099349532e-5,-1.0023683572674945e-8,6.904821165138293e-4,4.1101881144250444e-5,-9.986848350330236e-9,6.907382638650003e-4,4.09537582206849e-5,-9.930264533573738e-9,6.910790024415842e-4,4.0784383529647454e-5,-9.864646068425661e-9,6.915118287645734e-4,4.06330723894299e-5,-9.803388502339166e-9,6.92029478921974e-4,4.054225759251511e-5,-9.761330963984282e-9,6.926069404711696e-4,4.055042383207215e-5,-9.752392841996608e-9,6.93201577440324e-4,4.068187369966381e-5,-9.785963135087253e-9,6.937591702126083e-4,4.0935603885594335e-5,-9.86281521804032e-9,6.942270330740719e-4,4.1278405821690475e-5,-9.972398042232453e-9,6.945712632534799e-4,4.164815702606528e-5,-1.0093706764041374e-8,6.947908016139201e-4,4.196965425274466e-5,-1.0200641875276863e-8,6.949204861200494e-4,4.217816671559534e-5,-1.027018519806173e-8,6.950204845917e-4,4.2240436893643125e-5,-1.0289782773011855e-8,6.951568783835051e-4,4.2163991349505506e-5,-1.0260761389728324e-8,6.953820071952732e-4,4.1992296890793167e-5,-1.0196951522017627e-8,6.957214881833488e-4,4.1789873918597023e-5,-1.0119904592446122e-8,6.961704254910497e-4,4.162399139921554e-5,-1.0052855248199617e-8,6.966977464138914e-4,4.154851515582117e-5,-1.0015196278929336e-8,6.972559483814732e-4,4.159322790104321e-5,-1.0018554243928807e-8,6.977931798100247e-4,4.1759927789965654e-5,-1.006500579411969e-8,6.982647541256812e-4,4.202510292476047e-5,-1.0147554437825793e-8,6.986416504509654e-4,4.2347742945279895e-5,-1.0252547579380231e-8,6.989144432942709e-4,4.267979568978907e-5,-1.0363254734980224e-8,6.990924889111561e-4,4.297633660441667e-5,-1.046354978955787e-8,6.991995765864698e-4,4.3203125469473766e-5,-1.0540778184890215e-8,6.992679525856361e-4,4.334055988722916e-5,-1.0587341630078698e-8,6.993324737511327e-4,4.338433788379723e-5,-1.0601042222300012e-8,6.994259422448656e-4,4.33439373540044e-5,-1.0584573537885036e-8,6.995758178822197e-4,4.324016014019141e-5,-1.0544655239898046e-8,6.998018846283525e-4,4.310255497934784e-5,-1.049116419505745e-8,7.001142366953494e-4,4.296687167505949e-5,-1.0436353487376878e-8,7.00511078834245e-4,4.28720812612912e-5,-1.0393964239501379e-8,7.009763426032131e-4,4.285598693783195e-5,-1.0377799290857615e-8,7.014781075470884e-4,4.294835757893481e-5,-1.0399281482030315e-8,7.01969994354906e-4,4.316142500987284e-5,-1.0463892261942207e-8,7.023982919714376e-4,4.3479848296496525E-05,-1.0567290124078954e-8,7.027162843902773e-4,4.385542505735799e-5,-1.0693127635927223e-8,7.029027821209852e-4,4.42135354664673e-5,-1.0815191406563102e-8,7.029758681401383e-4,4.44744496722845e-5,-1.0904987723913586e-8,7.029914590549362e-4,4.458263269534113e-5,-1.0942205658178163e-8,7.030240973959722e-4,4.4528749813272105e-5,-1.0922540209312683e-8,7.031394395161471e-4,4.435182467687107e-5,-1.0858532246731884e-8,7.033730001998939e-4,4.412187581728143e-5,-1.0773708033050758e-8,7.037236525719877e-4,4.391449186565976e-5,-1.0694038600834027e-8,7.041603691418619e-4,4.378961991431415e-5,-1.0640801646843702e-8,7.046353875274154e-4,4.378031259963003e-5,-1.0626632482199593e-8,7.050976569019387e-4,4.3890906265389334e-5,-1.0654550090175343e-8,7.055033512381783e-4,4.4101463726791514e-5,-1.0719012226212606e-8,7.058225832089542e-4,4.4375368649487437e-5,-1.0808140470310517e-8,7.060425584939559e-4,4.4667972118194066e-5,-1.0906544945457309e-8,7.061676354241381e-4,4.4934992978476056e-5,-1.0998328320161188e-8,7.062167941862384e-4,4.513963638656883e-5,-1.1069817830506132e-8,7.062192461146077e-4,4.525758094198104e-5,-1.1111586225981603e-8,7.062091365135665e-4,4.527941172781372e-5,-1.1119497270185845e-8,7.062203187254132e-4,4.521057587191405e-5,-1.1094762027694266e-8,7.062819845440831e-4,4.5069391812404094e-5,-1.1043233702560278e-8,7.06415505665796e-4,4.488393907460559e-5,-1.0974313413837001e-8,7.066323612634319e-4,4.4688540962570335e-5,-1.089978106738531e-8,7.069327966070445e-4,4.452012245181196e-5,-1.0832652650027417e-8,7.073048809528734e-4,4.4414291049901125e-5,-1.0785940512482935e-8,7.077239303819673e-4,4.4400593182769026e-5,-1.0771010723654536e-8,7.081530282662858e-4,4.449628480384157e-5,-1.0795218004047385e-8,7.08546309372772e-4,4.4698728013663695e-5,-1.0858860998889045e-8,7.088570074624559e-4,4.497837061391854e-5,-1.0952277710884579e-8,7.090511764918637e-4,4.527680031930541e-5,-1.1054882078469456e-8,7.091242875412201e-4,4.551603875633128e-5,-1.1138494306429178e-8,7.091120498076681e-4,4.562208888687946e-5,-1.117598713005094e-8,7.090846177539748e-4,4.5555482629709526e-5,-1.1152408119707443e-8,7.091216217038918e-4,4.533143658656323e-5,-1.1072207380177586e-8,7.092802036001695e-4,4.501504148607371e-5,-1.0957523637321026e-8,7.095747795025035e-4,4.469379194735881e-5,-1.0838617797559788e-8,7.099779924341384e-4,4.4444886939645104e-5,-1.0742641317809363e-8,7.104372322708001e-4,4.431417690490606e-5,-1.0686428868332595e-8,7.108944427121056e-4,4.43116119214771e-5,-1.067478403156329e-8,7.113007184917924e-4,4.441806234799192e-5,-1.0702470480375884e-8,7.116236793675328e-4,4.459632083759559e-5,-1.0757592826290675e-8,7.118492538786992e-4,4.480161570626685e-5,-1.0824953711808661e-8,7.11980233791131e-4,4.4989876558258635e-5,-1.0888886188899312e-8,7.120332870788396e-4,4.512373743613871e-5,-1.093553525218388e-8,7.120351830951165e-4,4.517671189813642e-5,-1.0954618391336977e-8,7.12018506314901e-4,4.513573773315998e-5,-1.094058962873492e-8,7.12017114163592e-4,4.500208629716573e-5,-1.0893112309757543e-8,7.120616914124563e-4,4.47905968840482e-5,-1.0816818974571956e-8,7.121758530794824e-4,4.452730583824109e-5,-1.0720449941183935e-8,7.12373225808455e-4,4.424582850797638e-5,-1.0615582948149321e-8,7.126557056969058e-4,4.3983020894276823E-05,-1.0515185840291802e-8,7.130128748690027e-4,4.377430370445033e-5,-1.0432097453514521e-8,7.134225026408814e-4,4.364884043657226e-5,-1.0377410518766734e-8,7.138521296875519e-4,4.3624612316220915e-5,-1.0358662531311387e-8,7.142621087199356e-4,4.370335181858926e-5,-1.0377769717223068e-8,7.146110340123279e-4,4.386580901383108e-5,-1.0428929632440784e-8,7.148644843579355e-4,4.406916289330847e-5,-1.0497305281474699e-8,7.150068229220568e-4,4.424991700273873e-5,-1.0559887164612516e-8,7.150530524366479e-4,4.4336178298709344e-5,-1.0590042672540263e-8,7.15053734810595e-4,4.42704276374271e-5,-1.056605287956476e-8,7.150846291680763e-4,4.403576931514396e-5,-1.0480847359923442e-8,7.152198511851885e-4,4.3670120179829765e-5,-1.0347183403858284e-8,7.155008744882165e-4,4.325529287265698e-5,-1.019372183871818e-8,7.159202063701489e-4,4.288442453165478e-5,-1.0053486378649688e-8,7.164288382090401e-4,4.262714020159595e-5,-9.95164253828637e-9,7.169595712173114e-4,4.2511112636761016e-5,-9.899008498589871e-9,7.174506599694499e-4,4.2524020942925516e-5,-9.892540841677029e-9,7.178598144621892e-4,4.2627404619268514e-5,-9.91983987587705e-9,7.181678446769699e-4,4.27721963699476e-5,-9.964266310840572e-9,7.183759126586623e-4,4.291045343841636e-5,-1.0008908875743132e-8,7.18500405594647e-4,4.300234497131943e-5,-1.0039122755238085e-8,7.185677828556197e-4,4.30196320106107e-5,-1.0044007543963475e-8,7.186101042079086e-4,4.294717412168661e-5,-1.001723346601736e-8,7.186610533817944e-4,4.278335317154585e-5,-9.957406051808767e-9,7.18752168284341e-4,4.253964376045135e-5,-9.867997924772748e-9,7.189091853091514e-4,4.2239192867652126e-5,-9.756827287293615e-9,7.191486680453425e-4,4.191412441845834e-5,-9.635062646698978e-9,7.194753833185204e-4,4.1601472907260915e-5,-9.515794554155215e-9,7.198809710473828e-4,4.1338056243998875e-5,-9.412302783608438e-9,7.203442861506658e-4,4.115483206636226e-5,-9.33615368049298e-9,7.208335901116579e-4,4.107136650050428e-5,-9.295250483512817e-9,7.21310582686931e-4,4.109113767836152e-5,-9.292009746461441e-9,7.217361374829578e-4,4.1198376722348027e-5,-9.321908690989147e-9,7.220776248483091e-4,4.135721706930838e-5,-9.372781644989014e-9,7.223174798075731e-4,4.151444248885548e-5,-9.42550576306746e-9,7.224616572947125e-4,4.160760778234224e-5,-9.456878589667109e-9,7.225448756233372e-4,4.157965702183735e-5,-9.445137808270311e-9,7.226279081272899e-4,4.139838628719147e-5,-9.377400707335786e-9,7.22782831518834e-4,4.107397411941798e-5,-9.256348015631858e-9,7.230679109607896e-4,4.066348908937088e-5,-9.10200491377539e-9,7.235030324353299e-4,4.025454393631868e-5,-8.94585670514005e-9,7.240604349135902e-4,3.993307278447048e-5,-8.819235976789946e-9,7.246770474161983e-4,3.9752475639384204e-5,-8.74220271896425e-9,7.25280167562206e-4,3.972032945361145e-5,-8.71863631377646e-9,7.258112499168408e-4,3.980545137139982e-5,-8.738490452126625e-9,7.262379795707331e-4,3.995588791311808e-5,-8.783922245220665e-9,7.265545698200255e-4,4.011659749582939e-5,-8.83541706972929e-9,7.267755339873465e-4,4.024105833074878e-5,-8.875936197311278e-9,7.269279845271264e-4,4.029652987094112e-5,-8.892976574019021e-9,7.270451450548466e-4,4.026516750216042e-5,-8.879235354411228e-9,7.271616327638609e-4,4.014326976173892e-5,-8.832575722188413e-9,7.273099551577129e-4,3.993996905439593e-5,-8.755682817923396e-9,7.275175140387404e-4,3.9675705000669275e-5,-8.65552457776656e-9,7.278037036096325e-4,3.938023732409923e-5,-8.542589315450922e-9,7.281770882665271e-4,3.9089662899162196e-5,-8.429786504232964e-9,7.286331360591269e-4,3.884197223268564e-5,-8.330888585721539e-9,7.291533677555678e-4,3.867120217350354e-5,-8.258515599405508e-9,7.297067738756757e-4,3.860090558086704e-5,-8.221844583454592e-9,7.302539666578742e-4,3.8638182704821905e-5,-8.224400957513714e-9,7.307538962269374e-4,3.876983049784128e-5,-8.262452625865695e-9,7.311722092434422e-4,3.896204742743471e-5,-8.324571705863522e-9,7.314897527645678e-4,3.9164524285314036e-5,-8.3927927962959e-9,7.317094414493923e-4,3.931904431090589e-5,-8.445566122962981e-9,7.318594845103638e-4,3.937201425400375e-5,-8.462392890762826e-9,7.319908066651358e-4,3.928917259530832e-5,-8.42948659848983e-9,7.321669790530052e-4,3.906885058053107e-5,-8.345010771919948e-9,7.324469928605998e-4,3.8748281868431985e-5,-8.22172192559327e-9,7.328651675913713e-4,3.839739804730499e-5,-8.084889760603431e-9,7.334166535442571e-4,3.809868218835139e-5,-7.964969302770367e-9,7.340570593855317e-4,3.791967584824037e-5,-7.88746795733556e-9,7.347180158889726e-4,3.789093829132095e-5,-7.864694610367329e-9,7.35330978895752e-4,3.799999059049531e-5,-7.893257941684946e-9,7.358473549973659e-4,3.820188625552753e-5,-7.95762224232136e-9,7.36247320859895e-4,3.8438037090302746e-5,-8.036768609057542e-9,7.365375874964547e-4,3.865343008418449e-5,-8.110432460280896e-9,7.367432165561168e-4,3.880698844533339e-5,-8.163005946748622e-9,7.368986354207467e-4,3.8875061863166875e-5,-8.185035831936871e-9,7.370405983510341e-4,3.885061218849014e-5,-8.173156102939069e-9,7.372035548293182e-4,3.8740714185469477e-5,-8.129326522098361e-9,7.374166923744471e-4,3.8563901864775714e-5,-8.05990590565618e-9,7.377017025310008e-4,3.834777065479802e-5,-7.974743340507008e-9,7.38070622142274e-4,3.8126512150255426e-5,-7.886238130470689e-9,7.385236155784789e-4,3.7937678633434624e-5,-7.80816935910351e-9,7.390471872462534e-4,3.7817479218706066e-5,-7.754041850862354e-9,7.39613896733862e-4,3.779443638936219e-5,-7.734832514708064e-9,7.401848806728716e-4,3.788221163124379e-5,-7.75635096994411e-9,7.407160397257579e-4,3.807351780711525e-5,-7.816863716772319e-9,7.411675017627108e-4,3.83377342940748e-5,-7.905958120875292e-9,7.415142919555773e-4,3.8624442718095306e-5,-8.005552813609206e-9,7.417549191637427e-4,3.887335159084064e-5,-8.093346705012602e-9,7.419146387750976e-4,3.902868594401002e-5,-8.14809060536792e-9,7.420415466924796e-4,3.9054260051663074e-5,-8.155305505607456e-9,7.421957712450767e-4,3.894484020912841e-5,-8.111780096870276e-9,7.424340938914088e-4,3.873006125504485e-5,-8.02737573183699e-9,7.42793899355561e-4,3.846880194086285e-5,-7.923264854219435e-9,7.432812620141698e-4,3.823437454532318e-5,-7.82664187542525e-9,7.438677441412036e-4,3.809405520022208e-5,-7.763143694430137e-9,7.444981839003461e-4,3.808955287654943e-5,-7.749409650064826e-9,7.451073361538792e-4,3.822586805072566e-5,-7.788599612458683e-9,7.456389114710405e-4,3.847282903416642e-5,-7.870587084328902e-9,7.460595325375159e-4,3.8777620572790256e-5,-7.97634017132848e-9,7.463633344203971e-4,3.90818258416466e-5,-8.084164382373755e-9,7.465679154850866e-4,3.9335967587656355e-5,-8.175197120055171e-9,7.467056704916095e-4,3.950769387356267e-5,-8.236653653676395e-9,7.468147802209882e-4,3.958364471163843e-5,-8.262748556136644e-9,7.469323302937862e-4,3.956728801685668e-5,-8.25406326448367e-9,7.470900224543724e-4,3.947522924674709e-5,-8.21625230612436E-09,7.473117786206921e-4,3.9333574246693434e-5,-8.15868872939971e-9,7.476122444451707e-4,3.917483364161524e-5,-8.093285230637837e-9,7.479954258414936e-4,3.9035053263447094e-5,-8.033430521419e-9,7.484532171378763e-4,3.8950407831258895e-5,-7.992775209673987e-9,7.489642810589979e-4,3.895244597740534e-5,-7.983527194781351e-9,7.494944525688141e-4,3.906165830601274e-5,-8.014060469529422e-9,7.500002746529996e-4,3.9280174203610924e-5,-8.086078232861302e-9,7.504369055959056e-4,3.9586013083436254e-5,-8.192238951203957e-9,7.507699029120727e-4,3.993257848288867e-5,-8.31570446363603e-9,7.509875768828624e-4,4.025651618290501e-5,-8.432888245201967e-9,7.511084739632404e-4,4.049377684511111e-5,-8.519412651981377e-9,7.511792950330379e-4,4.059903216808652e-5,-8.557453460506901e-9,7.51262580818493e-4,4.056073182061699e-5,-8.541545996409175e-9,7.514184424281146e-4,4.040549547796316e-5,-8.480474453332119e-9,7.516871944073718e-4,4.019036204144835e-5,-8.394680466844668e-9,7.520786833722089e-4,3.998634873333417e-5,-8.31041577663291e-9,7.525708694622507e-4,3.985920059382761e-5,-8.252707967838128e-9,7.531170338310043e-4,3.985300180192867e-5,-8.239147244363815e-9,7.536588526186752e-4,3.998070036708499e-5,-8.276008258796359e-9,7.541413990265233e-4,4.022342678605548e-5,-8.357544078241255e-9,7.54525863865062e-4,4.05380201242533e-5,-8.468421354961952e-9,7.547967008719969e-4,4.0869815523018587e-5,-8.588335122366214e-9,7.549619635945633e-4,4.116635887970118e-5,-8.697206288555848e-9,7.550480101612701e-4,4.1388047065979665e-5,-8.779387588935774e-9,7.550913554910073e-4,4.151357045899603e-5,-8.825967420826681e-9,7.551305842522161e-4,4.154031612162445e-5,-8.835132581061215e-9,7.552001895864037e-4,4.148139165922518e-5,-8.811164119887681e-9,7.55326828426084e-4,4.1361260126847735e-5,-8.762820923675844e-9,7.555274925687125e-4,4.12114438663705e-5,-8.70170647458801e-9,7.558087203055979e-4,4.1066871518413693e-5,-8.640891785799208e-9,7.561661037027524e-4,4.09626519740274e-5,-8.593743073534889e-9,7.565837873294337e-4,4.0930595848213674e-5,-8.572674913245856e-9,7.570343023719693e-4,4.0994708019895345e-5,-8.58746909968765e-9,7.574798432523166e-4,4.116526167701248e-5,-8.642942450707564e-9,7.578766597453443e-4,4.143219506580418e-5,-8.736227826676889e-9,7.581839700006578e-4,4.1760430647830195e-5,-8.85472089607003e-9,7.583769007372872e-4,4.209143613341075e-5,-8.97646260497755e-9,7.584593350854895e-4,4.235492678888832e-5,-9.074535079715516e-9,7.584693326984003e-4,4.249010700473473e-5,-9.125223368184249e-9,7.58470988460264e-4,4.246860282595259e-5,-9.116849569321388e-9,7.585337351705025e-4,4.230716762507732e-5,-9.054700673282172e-9,7.587083994551931e-4,4.206260627237825e-5,-8.959261900385463e-9,7.590114511903744e-4,4.181169099700161e-5,-8.858889905876627e-9,7.594231618304254e-4,4.162653730197789e-5,-8.780808674797843e-9,7.598974502542237e-4,4.155567159126383e-5,-8.744091746991325e-9,7.603770701441117e-4,4.161547883315085e-5,-8.756261200644959e-9,7.608083072352005e-4,4.1791395294714015e-5,-8.813314074637931e-9,7.611518311466191e-4,4.204568142158321e-5,-8.902175671211233e-9,7.613885521055572e-4,4.232834360337178e-5,-9.004492689727314e-9,7.615206177534766e-4,4.258845489577387e-5,-9.100837967244961e-9,7.61568322961355e-4,4.2783817580922045e-5,-9.174529986143186e-9,7.615641863347267e-4,4.288746563387388e-5,-9.214382010099968e-9,7.615458421224065e-4,4.289030424473849e-5,-9.215981555878051e-9,7.615493776879412e-4,4.280020160465099e-5,-9.181526671744856e-9,7.616042486398303e-4,4.26385797343642e-5,-9.118594656166542e-9,7.61730210455046e-4,4.2435795379432153e-5,-9.03837554219817e-9,7.61936050598561e-4,4.222646210520275e-5,-8.953874020503188e-9,7.622194897874063e-4,4.204535712200338e-5,-8.87837427683221e-9,7.625676250645121e-4,4.1923882039288665e-5,-8.824153587401546e-9,7.629576171601758e-4,4.188660389994002e-5,-8.801211913123232e-9,0.00076335781686778445,4.194730410322629e-5,-8.815719768604965e-9,7.637301806589586e-4,4.210424149540176e-5,-8.868024377405146e-9,7.640353866362429e-4,4.233530176320579e-5,-8.950502771608857e-9,7.642418368971225e-4,4.259542541961727e-5,-9.046295943306457e-9,7.643379706413167e-4,4.282042794217269e-5,-9.130652554192153e-9,7.643436783033333e-4,4.29411494887276e-5,-9.176459932444947e-9,7.643128225427903e-4,4.290719105443412e-5,-9.163573390875584e-9,7.643198908851147e-4,4.27107298651634e-5,-9.088104238947882e-9,7.644329712891078e-4,4.23954390951903e-5,-8.965872528852865e-9,7.646866633436667e-4,4.204199444422708e-5,-8.826934866527333e-9,7.650704200976676e-4,4.17372669333947e-5,-8.704057045239502e-9,7.655369936842672e-4,4.154471093131832e-5,-8.621706108552556e-9,7.660227565342318e-4,4.1489461027239444e-5,-8.590446292021975e-9,7.664679096395077e-4,4.155968867214678e-5,-8.60719762281304e-9,7.668295552510263e-4,4.1717667344140696e-5,-8.65897698447111e-9,7.670867797953163e-4,4.191334217832278e-5,-8.727615499482921e-9,7.672399375245228e-4,4.209611415617943e-5,-8.794011363368658e-9,7.673067113076542e-4,4.2223374435902354e-5,-8.841422117427617e-9,7.673167461421355e-4,4.226589688328241e-5,-8.857772846673981e-9,7.673057770691697e-4,4.221051342646373e-5,-8.837001052988211e-9,7.673098402283448e-4,4.206030802892788e-5,-8.779391079594279e-9,7.673601781277127e-4,4.18326361185597e-5,-8.690943756311483e-9,7.674793660680467e-4,4.1555511526051535e-5,-8.58199870451685e-9,7.676789770593695e-4,4.126301892957958e-5,-8.465429763661297e-9,7.679588364412986e-4,4.0990480338567314e-5,-8.354768907767848e-9,7.683075907368027e-4,4.077001331558171e-5,-8.262536838002104e-9,7.687041577968274e-4,4.062672035544098e-5,-8.198843955832656e-9,7.691197778494181e-4,4.057536670843389e-5,-8.170131786714939e-9,7.69520695114969e-4,4.061730481647757e-5,-8.17788778750396e-9,7.698719236009533e-4,4.073758088267318e-5,-8.217289031700045e-9,7.701429410375053e-4,4.090284202188645e-5,-8.276083307954193e-9,7.703158959245221e-4,4.106194157234824e-5,-8.334583011415699e-9]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_12.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_12.json deleted file mode 100644 index 1edb28bc..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_12.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":12000,"numberOfSamples":1000,"samples":[7.703954280162467e-4,4.1152337826266915e-5,-8.368108119871265e-9,7.704163319665058e-4,4.111507788730868e-5,-8.352989399151336e-9,7.704421464154993e-4,4.091720944904923e-5,-8.275542352848811e-9,7.705485092428724e-4,4.05724562623383e-5,-8.140252864992262e-9,7.707939985966856e-4,4.014524130054576e-5,-7.971353086916377e-9,7.71193504222048e-4,3.972957759547678e-5,-7.80469566907836e-9,7.717115053607008e-4,3.9412072212316335e-5,-7.673655282248528e-9,7.722792203821364e-4,3.924081276169691e-5,-7.597334312683116e-9,7.728228927422465e-4,3.921592014800571e-5,-7.576902082499595e-9,7.732865636479628e-4,3.930044006202883e-5,-7.599469965429773e-9,7.736417360467977e-4,3.9439508716162856e-5,-7.645015059481085e-9,7.738862021781628e-4,3.9577299627356655e-5,-7.692550022805146e-9,7.740375781067476e-4,3.9667776867413035e-5,-7.724156675043192e-9,7.741257583521852e-4,3.9679734947780095e-5,-7.727075835179889e-9,7.741863193020013e-4,3.959810915098842e-5,-7.69451274251175e-9,7.742552430288779e-4,3.9423328672554246e-5,-7.625696494804441e-9,7.743646142276804e-4,3.9169548057952974e-5,-7.525395913350832e-9,7.745390796275454e-4,3.886191912277735e-5,-7.4029175785362335e-9,7.747931611691499e-4,3.853296073940333e-5,-7.2706518736087654e-9,7.751296404933389e-4,3.821816871539602e-5,-7.14230656603222e-9,7.75539277044951e-4,3.795118644851318e-5,-7.03102083378519e-9,7.760019965895818e-4,3.7759097444815016e-5,-6.947589780698099e-9,7.764894114568546e-4,3.7658393030000226e-5,-6.898960011119357e-9,7.769683935525284e-4,3.765194567776308e-5,-6.887041206138857e-9,7.77405468600329e-4,3.7727187339015794e-5,-6.907852463658269e-9,7.777719367210197e-4,3.7855696317654865e-5,-6.951096001721251e-9,7.780497715515111e-4,3.799465132874708e-5,-7.000433114460731e-9,7.782381033839588e-4,3.809125972066116e-5,-7.035036448543083e-9,7.783590131789634e-4,3.809174285674149e-5,-7.033143881376136e-9,7.784595953194529e-4,3.795570392998253e-5,-6.97793131163529e-9,7.786057068107846e-4,3.767368510457848e-5,-6.864708360881282e-9,7.78863996118783e-4,3.728037531656348e-5,-6.706310810691064e-9,7.792756265371022e-4,3.685219468959701e-5,-6.532225465482031e-9,7.798348397283327e-4,3.648330405006227e-5,-6.379231745544197e-9,7.804875774404013e-4,3.624915992465997e-5,-6.277220111165846e-9,7.811532791147602e-4,3.6178446406365796e-5,-6.238248751260801e-9,7.817563618614648e-4,3.624887846641678e-5,-6.254752293779451e-9,7.822492066349364e-4,3.6404572752001926e-5,-6.305999039127454e-9,7.826184621073835e-4,3.658034238992342e-5,-6.367226110433409e-9,7.828786448897808e-4,3.672020080806501e-5,-6.416659701095429e-9,7.830611528872669e-4,3.678622737434062e-5,-6.439002339589363e-9,7.83204269111392e-4,3.6760045223355876e-5,-6.4262288080890655e-9,7.83346116265409e-4,3.6640538094929564e-5,-6.376990645821899e-9,7.835202865150684e-4,3.644047816686522e-5,-6.2955425776532835e-9,7.837530585274323e-4,3.618322636043522e-5,-6.190565289506217e-9,7.840613538345039e-4,3.5899528490766174e-5,-6.073894295370791e-9,7.844511692520874e-4,3.56240404001225e-5,-5.959079652820332e-9,7.849166362486965e-4,3.5391266889247926e-5,-5.859734881539029e-9,7.854401461991078e-4,3.5230870470624936e-5,-5.787703349498604e-9,7.85994077008628e-4,3.516280326863614e-5,-5.751203618221222e-9,7.865443681490566e-4,3.519312942196211e-5,-5.753224515569559e-9,7.870557121649313e-4,3.531147041257569e-5,-5.790462278713693e-9,7.874977374834473e-4,3.549084781661851e-5,-5.8530751899271e-9,7.878512977067683e-4,3.5690381696580056e-5,-5.925483082828172e-9,7.88113902130303e-4,3.586089281430252e-5,-5.9883395159535995e-9,7.883033069918536e-4,3.595324388575569e-5,-6.021732124830117e-9,7.884579960410935e-4,3.5929083510116866e-5,-6.009544248256601e-9,7.886327975757129e-4,3.577280030598468e-5,-5.9444715378693474e-9,7.888879780100181e-4,3.550164046195876e-5,-5.832367391647236e-9,7.8927192870103e-4,3.51687389345516e-5,-5.693704861085736e-9,7.898018205719634e-4,3.4853326117873307e-5,-5.559814012217819e-9,7.904515896948133e-4,3.4636846056963114e-5,-5.463410169207496e-9,7.911567365586743e-4,3.457328365667514e-5,-5.426733674861982e-9,7.91836723351535e-4,3.4669207955395765e-5,-5.453450884163303e-9,7.924237202788972e-4,3.488486649734166e-5,-5.5288267094573905e-9,7.928824548961669e-4,3.515389152880303e-5,-5.627269436403621e-9,7.932136820118008e-4,3.540839736028799e-5,-5.722097489506235e-9,7.934449059141124e-4,3.5597063748403574e-5,-5.792673659357338e-9,7.936168882573704e-4,3.569210775996662e-5,-5.827295173952732e-9,7.937723217445624e-4,3.568791359332356e-5,-5.822884193637893e-9,7.93948800831336e-4,3.559595323883983e-5,-5.783216738249511e-9,7.941754088277288e-4,3.543933477989003e-5,-5.716920600537979e-9,7.944713320113322e-4,3.524834071649752e-5,-5.635744464363097e-9,7.948452117223364e-4,3.505690102972568e-5,-5.5531067119024055e-9,7.952946621025866e-4,3.489936168856889e-5,-5.482741290558481e-9,7.958060134527227e-4,3.4806877971801684e-5,-5.437234302862502e-9,7.963548356244236e-4,3.4803064153757236e-5,-5.4263155715433935e-9,7.969080873912969e-4,3.4899187129560714e-5,-5.454979598662578e-9,7.974285582348853e-4,3.50899868901018e-5,-5.521799771482021e-9,7.978815595783528e-4,3.53517139310461e-5,-5.618028402827992e-9,7.982428279621153e-4,3.5643920541599894e-5,-5.728107579266846e-9,7.985056927078104e-4,3.591576113045357e-5,-5.8319638327390805e-9,7.986852279968585e-4,3.6116131940588234e-5,-5.908914090462572e-9,7.988176580367524e-4,3.620557989303193e-5,-5.942429308719043e-9,7.989544079791842e-4,3.616720864975489e-5,-5.924668401918435e-9,7.991513656849079e-4,3.601375362426653e-5,-5.859607617947738e-9,7.994550428476274e-4,3.5788266373648105e-5,-5.763648882378041e-9,7.99888593020665e-4,3.5556588356057684e-5,-5.662870662485801e-9,8.004419741134302e-4,3.539153188530321e-5,-5.586797190304597e-9,8.010710698253013e-4,3.5351857597047766e-5,-5.559879219657929e-9,8.017086298947224e-4,3.546304659868737e-5,-5.5935163200738305e-9,8.022846671415112e-4,3.5708577068191366e-5,-5.6822096378184195e-9,8.027481145977655e-4,3.603666410112383e-5,-5.805964874906324e-9,8.03080122412991e-4,3.637928126071499e-5,-5.9377647708489825e-9,8.032943410005627e-4,3.66738652272459e-5,-6.0522761139605395e-9,8.034269249007324e-4,3.687843167960255e-5,-6.132033879229968e-9,8.035230519879982e-4,3.697653334579644e-5,-6.1696217748146e-9,8.036257380118303e-4,3.6974206946549126e-5,-6.166656508896828e-9,8.037692352128727e-4,3.689330257374978e-5,-6.131278442552063e-9,8.039764427338145e-4,3.6764723596644845e-5,-6.075520263494496e-9,8.042586457584074e-4,3.662315128777011e-5,-6.013183162784273e-9,8.046160819092535e-4,3.6503272989771094e-5,-5.9582713714511854e-9,8.050385231957502e-4,3.643678976682334e-5,-5.9237473528870625e-9,8.055057955743184e-4,3.644934285412461e-5,-5.920288595123292e-9,8.05988792090945e-4,3.655676717208342e-5,-5.95478706400642e-9,8.064519656770659e-4,3.676075426661275e-5,-6.028574833606665e-9,8.068582848986766e-4,3.7045013088594046e-5,-6.1357749440002495e-9,8.071769237677392e-4,3.737399900933667e-5,-6.26261951082692e-9,8.073924491758243e-4,3.769659412573422e-5,-6.388754892200863e-9,8.075124666197616e-4,3.7955997865778476e-5,-6.491115253060035e-9,8.075698393218493e-4,3.8104352666225344e-5,-6.549812033282912e-9,8.07616918266904e-4,3.811755258854625e-5,-6.5542030392740885e-9,8.077125028108634e-4,3.8004458985452114e-5,-6.506795533466793e-9,8.079056000982033e-4,3.780654452780539e-5,-6.4233624926436094e-9,8.082214227720043e-4,3.758774308343327e-5,-6.3291414262697445e-9,8.086539871520523e-4,3.741775103981728e-5,-6.252328710187585e-9,8.091672759069606e-4,3.7353752588214316e-5,-6.216752306565877e-9,8.097045052884347e-4,3.742558962134468e-5,-6.235686559437506e-9,8.10203012993122e-4,3.7628423384850995e-5,-6.308502277607127e-9,8.106106251449948e-4,3.792510731679957e-5,-6.421212634856097e-9,8.108985322821864e-4,3.8257644162653106e-5,-6.550833196339432e-9,8.11066628774171e-4,3.856383400569566e-5,-6.6720638631456955e-9,8.111401568994287e-4,3.8793232686939005e-5,-6.763879623403471e-9,8.111600098107639e-4,3.89173073971411e-5,-6.813868422693099e-9,8.111711107269196e-4,3.893182181341246e-5,-6.8194280235812216e-9,8.112128636990658e-4,3.8852913529948424e-5,-6.786357912765378e-9,8.1131356935384e-4,3.8710088334482416e-5,-6.726121364291298e-9,8.114885730374386e-4,3.853908980505929e-5,-6.652976845483148e-9,8.117408037071133e-4,3.837625006855202e-5,-6.5816575047402725e-9,8.120622864326276e-4,3.825456404102906e-5,-6.5257403552766695e-9,8.124357145823514e-4,3.82008938099246e-5,-6.496493824519633e-9,8.128358550233297e-4,3.823344877076438e-5,-6.50185004606853e-9,8.132312194083829e-4,3.8358874558908814e-5,-6.54518991660995e-9,8.135869354214777e-4,3.856887726212377e-5,-6.623869747140799e-9,8.138698868858205e-4,3.8837323813125146e-5,-6.727869263055802e-9,8.140566018155787e-4,3.91199837876055e-5,-6.83950023112515e-9,8.141427039935174e-4,3.935979230186433e-5,-6.9354371500791985e-9,8.14150262656473e-4,3.949946847388898e-5,-6.9918722744796985e-9,8.141277285832854e-4,3.949960053306327e-5,-6.991994835378283e-9,8.141388942367572e-4,3.935526219250151e-5,-6.93289197521611e-9,8.142430879224422e-4,3.910207785679162e-5,-6.8281493368907015e-9,8.144749296276758e-4,3.880686864520632e-5,-6.704223833237992e-9,8.1483306083408e-4,3.854646680042599e-5,-6.592073096421126e-9,8.152821053230805e-4,3.838435896231063e-5,-6.5178631025860026e-9,8.157651947313659e-4,3.835428291873892e-5,-6.49629781434836e-9,8.162207450781731e-4,3.845478693315215e-5,-6.528135674230928e-9,8.16597684699937e-4,3.865376270796675e-5,-6.60159629155916e-9,8.168657158061926e-4,3.889947743847334e-5,-6.69644446442954e-9,8.170194049574676e-4,3.913422953807289e-5,-6.7893400986806185e-9,8.17076394641524e-4,3.930728020730456e-5,-6.85914255437804e-9,8.170710316645813e-4,3.938449175604022e-5,-6.891061862959034e-9,8.170454569870298e-4,3.935306732398158e-5,-6.878882809994513e-9,8.170405722878981e-4,3.9221105681444305e-5,-6.825033584806315e-9,8.1708896023377e-4,3.901310215359767e-5,-6.7388979016364186e-9,8.172108407223391e-4,3.87633764776707e-5,-6.634171213681119e-9,8.174130175522054e-4,3.850938229687362e-5,-6.526094414707984e-9,8.176899834395489e-4,3.8286205079792516e-5,-6.4291520891420515e-9,8.180260959470649e-4,3.812267075009407e-5,-6.3554492104173685e-9,8.183979894619872e-4,3.803873780290355e-5,-6.313637763487015e-9,8.187769116206049e-4,3.804351923521837e-5,-6.308093725118056e-9,8.191312129866966e-4,3.813337134793312e-5,-6.338063937256885e-9,8.194296942684052e-4,3.8289922698924704e-5,-6.396704673018225e-9,8.196467238419641e-4,3.847879781237149e-5,-6.470354270719354e-9,8.197695294206804e-4,3.8650968100779566e-5,-6.538921130269099e-9,8.19806513649201e-4,3.874943540462814e-5,-6.5785960033068025e-9,8.197929489727498e-4,3.8723134804595094e-5,-6.5676898771434025e-9,8.197883002079536e-4,3.854613941350416e-5,-6.4947236728071645e-9,8.198609759695765e-4,3.823403064971981e-5,-6.365297279203114e-9,8.200636944477346e-4,3.784594464219167e-5,-6.203000857389413e-9,0.000820411436661712,3.746667085519243e-5,-6.042172936215794e-9,8.208749674671344e-4,3.7176223092774686e-5,-5.915617415305801e-9,8.213932248000017e-4,3.7022992160726405e-5,-5.843759010230899e-9,8.218961027605576e-4,3.701275044446644e-5,-5.830076453078521e-9,8.223254904904929e-4,3.711435819021485e-5,-5.863118056849916e-9,8.226473843906112e-4,3.727482958449793e-5,-5.922239824745653e-9,8.228545590175748e-4,3.7435687186837764e-5,-5.983966399587255e-9,8.229627474394682e-4,3.7545885310616436e-5,-6.027176921838554e-9,8.230036090129152e-4,3.756990148797665e-5,-6.036554527428151e-9,8.230167806825249e-4,3.749138311092206e-5,-6.004372061981051e-9,8.230423185742567e-4,3.731317666393389e-5,-5.930818699795622e-9,8.231143493501816e-4,3.705449505134662e-5,-5.823063768625377e-9,8.23256553209646e-4,3.674606808012696e-5,-5.693352353058202e-9,8.234798189428454e-4,3.642429612693932e-5,-5.556571384393087e-9,8.237820413355269e-4,3.6125418828181186e-5,-5.427765212931279e-9,8.241496751844597e-4,3.588054059534543e-5,-5.320016584338888e-9,8.245603883153199e-4,3.571199342395666e-5,-5.242923452023574e-9,8.249861688108776e-4,3.563099782478505e-5,-5.201638270344065e-9,8.253965549120751e-4,3.563626588694151e-5,-5.1962726434097535e-9,8.257620082869455e-4,3.571323197160154e-5,-5.221486300041849e-9,8.260577695440884e-4,3.583385451251235e-5,-5.266230045559657e-9,8.262687299902825e-4,3.595753207818218e-5,-5.313924512584801e-9,8.263954241197148e-4,3.6034603798458864e-5,-5.343784865943491e-9,8.264598903887887e-4,3.601442540484084e-5,-5.334201311502159e-9,8.265081515702821e-4,3.585914554288692e-5,-5.268642284511385e-9,8.26604385596247e-4,3.556101693181241e-5,-5.143074426032549e-9,8.268132192939278e-4,3.515537353926115e-5,-4.971501142912185e-9,8.271738744510702e-4,3.471782861774951e-5,-4.7848532086355065e-9,8.276795586094963e-4,3.4340322196190036e-5,-4.621118053741745e-9,8.282766891716653e-4,3.4095760039524445e-5,-4.5108069909192165e-9,8.288861464980373e-4,3.401140563924369e-5,-4.465996728964361e-9,8.29433355059079e-4,3.406500941237964e-5,-4.4785874372255114e-9,8.298704729894737e-4,3.420103631857123e-5,-4.526688711410476e-9,8.301833096396713e-4,3.4353709967328716e-5,-4.583790454622501e-9,8.303862100769367e-4,3.446546478614344e-5,-4.626173157513306e-9,8.305118250621173e-4,3.449687603771798e-5,-4.6370194576684565e-9,8.306008664699762e-4,3.442941009341466e-5,-4.607762309491803e-9,8.306940322478887e-4,3.426386875947961e-5,-4.537752547464339e-9,8.308263261536525e-4,3.401682527001027e-5,-4.4330652748613145e-9,8.310232819304966e-4,3.371620106257414e-5,-4.304822699303797e-9,8.312987280593526e-4,3.339641097448233e-5,-4.167187973746248e-9,8.31653979219806e-4,3.309335744578138e-5,-4.0351952674026125e-9,8.32078417238307e-4,3.283958122742209e-5,-3.9226242940869606e-9,8.325514069439921e-4,3.26599656110982e-5,-3.8401496329485945e-9,8.330453353948687e-4,3.256846904668967e-5,-3.793977723288974e-9,8.335293651888821e-4,3.2566169333962955e-5,-3.785049055168084e-9,8.33973516225973e-4,3.264061001145597e-5,-3.808740687729704e-9,8.343528580041156e-4,3.2766396288388346e-5,-3.855005633134729e-9,8.346517248312861e-4,3.290709657118518e-5,-3.9089874063833434e-9,8.348679389439184e-4,3.301872928211123e-5,-3.95230090306051e-9,8.350167359300278e-4,3.305558632640454e-5,-3.965393684369818e-9,8.351331058149185e-4,3.297932755397413e-5,-3.9314416005053e-9,8.352699660831031e-4,3.277126367429032e-5,-3.8417220291605366e-9,8.354889117471341e-4,3.244507340953231e-5,-3.7012047953805833e-9,8.358419691208809e-4,3.205326833172769e-5,-3.531440109697599e-9,8.36348763283404e-4,3.167867290599403e-5,-3.3670502139274996e-9,8.369813197061595e-4,3.140782451156133e-5,-3.244586908337016e-9,8.376693061030729e-4,3.129669563122999e-5,-3.1881493598681102e-9,8.383263658012633e-4,3.134863920078477e-5,-3.200051972071662e-9,8.388826052155265e-4,3.151766556410064e-5,-3.2619908468242225e-9,8.393050072888866e-4,3.173205489277276e-5,-3.344664087646371e-9,8.395988757541516e-4,3.192172100776251e-5,-3.419003963066664e-9,8.397963286098811e-4,3.203621272799185e-5,-3.46362815353071e-9,8.399416326313247e-4,3.205061679819683e-5,-3.4674080518768483e-9,8.400794992423449e-4,3.1963263817541386e-5,-3.4287495907215916e-9,8.402479103687121e-4,3.179002909330446e-5,-3.3534888117140308e-9,8.404745687451004e-4,3.155830071326884e-5,-3.2525737289196144e-9,8.407754646399417e-4,3.130173895136262e-5,-3.1399368209433314e-9,8.41154541388092e-4,3.1055764720891035e-5,-3.0305415711644196e-9,8.416041280544131e-4,3.085345156272672e-5,-2.9385364426828023e-9,8.421061656017975e-4,3.072164283076384e-5,-2.8755213785209154e-9,8.426344113814458e-4,3.067736638925079e-5,-2.8490015368691745e-9,8.431577953645121e-4,3.072498523450466e-5,-2.8612024549307127e-9,8.436447971117692e-4,3.085470440573325e-5,-2.9084547718786858e-9,8.440683720702881e-4,3.1042869672780824e-5,-2.981273689818602e-9,8.444108321936859e-4,3.125426055813509e-5,-3.065198477158535e-9,8.446680629527056e-4,3.144642492558669e-5,-3.142451937358192e-9,8.448524507159502e-4,3.15759057443261e-5,-3.194437005461156e-9,8.449938340091091e-4,3.160610588444374e-5,-3.2050494314965393e-9,8.451374660071655e-4,3.151638576719877e-5,-3.1646699302547115e-9,8.453375715697237e-4,3.1311130994121866e-5,-3.0742611477808833e-9,8.456453986738488e-4,3.1025780835067146e-5,-2.94819557957702e-9,8.46092653379528e-4,3.0725045293271956e-5,-2.81368862948315e-9,8.466753220872281e-4,3.0488818598972834e-5,-2.704879810332908e-9,8.473471109643087e-4,3.038640446510119e-5,-2.6518278127619258e-9,8.480305696476147e-4,3.0449024854662588e-5,-2.668679548466348e-9,8.486441257401572e-4,3.065628903781551e-5,-2.7477040330430985e-9,8.491313375173792e-4,3.094576582096809e-5,-2.8631317709746885e-9,8.494766164139384e-4,3.123946697058364e-5,-2.9822273668107125e-9,8.497020423260754e-4,3.1471127846907625e-5,-3.0767866876898872e-9,8.498521170161459e-4,3.16017891014394e-5,-3.129775126187276e-9,8.499770409409726e-4,3.1621830699592834e-5,-3.1363362066964675e-9,8.501209480543094e-4,3.1544720456021056e-5,-3.1013685836141294e-9,8.503161532077362e-4,3.1398399640952655e-5,-3.036097487468567e-9,8.505816546173871e-4,3.1217759899263695e-5,-2.9550165687006546e-9,8.509236995527479e-4,3.103916188717301e-5,-2.8735662703891047e-9,8.513369862483362e-4,3.0896507607776705e-5,-2.8063743424389867e-9,8.518060495699486e-4,3.081805794501351e-5,-2.7657886014572145e-9,8.523069735798167e-4,3.082345930368575e-5,-2.7605358876292335e-9,8.528098318936862e-4,3.0920864735206294e-5,-2.79447672381635e-9,8.532822991542584e-4,3.110457416848017e-5,-2.8656065993726486e-9,8.536945524033567e-4,3.1354085988535145e-5,-2.965633018689591e-9,8.540249574865114e-4,3.163548969538209e-5,-3.080489694586202e-9,8.542654720972812e-4,3.190574453586719e-5,-3.192028596537508e-9,8.544254041595665e-4,3.211974836915866e-5,-3.28090202256463e-9,8.545322236510779e-4,3.2239278828225266e-5,-3.3303148632010992e-9,8.546285733291039e-4,3.224218246448245e-5,-3.330007151957699e-9,8.547652672831671e-4,3.2129878781118014e-5,-3.279649312494011e-9,8.549907364400541e-4,3.193111420486313e-5,-3.1907193571916717e-9,8.553382926807156e-4,3.1699773222277685e-5,-3.0858345714949625e-9,8.558140144434115e-4,3.150496484434305e-5,-2.9946769942906606e-9,8.563897321781071e-4,3.1413455736156216e-5,-2.9464704670555277e-9,8.570061787799461e-4,3.1468304822318046e-5,-2.960646903904852e-9,8.575886586831152e-4,3.167199701229673e-5,-3.039317862345337e-9,8.580709942206223e-4,3.198346246211776e-5,-3.1656988018487623e-9,8.584171135061124e-4,3.233248147476386e-5,-3.310099393214403e-9,8.586297960336273e-4,3.264478971416768e-5,-3.440645754903185e-9,8.587438963877701e-4,3.286515489171303e-5,-3.5332321749884526e-9,8.58810255130539e-4,3.2968897888927814e-5,-3.5765784450704622e-9,8.588794391843271e-4,3.2960802961293873e-5,-3.5719305847910328e-9,8.589911009932855e-4,3.2866533850223576e-5,-3.529577019202463e-9,8.591697919005255e-4,3.272249454060714e-5,-3.4646650245504987e-9,8.594251730433313e-4,3.256765883619841e-5,-3.393767811079765e-9,8.597541389353542e-4,3.2438210292960187e-5,-3.3325521813766835e-9,8.601432315592983e-4,3.236427582707883e-5,-3.2942803106507433e-9,8.605707893509768e-4,3.236765846754327e-5,-3.2887387933129255e-9,8.610090272757816e-4,3.245976837958149e-5,-3.3212886990489386e-9,8.614266330715411e-4,3.2639496241471747e-5,-3.3919234343927197e-9,8.617925265638105e-4,3.289145361493536e-5,-3.4944824234170423e-9,8.620810773671341e-4,3.318566240946574e-5,-3.616455097562243e-9,8.62278291344594e-4,3.3480062508905175e-5,-3.7399625948591e-9,8.623874686730959e-4,3.372681857367478e-5,-3.844371487446432e-9,8.624320722870976e-4,3.38822001208865e-5,-3.910489310686052e-9,8.624536695365803e-4,3.391801974913249e-5,-3.925509323340507e-9,8.625041693741896e-4,3.3831145103447495e-5,-3.887217720697746e-9,8.626336863724894e-4,3.364749744285424e-5,-3.805912914971897e-9,8.628771728569449e-4,3.34184061309152e-5,-3.703085242205503e-9,8.632436901356097e-4,3.3209472451514874e-5,-3.606852247536402e-9,8.637117164869609e-4,3.30843353744748e-5,-3.5450791305814132e-9,8.64232526978409e-4,3.30874054017447e-5,-3.537852982664476e-9,8.647417259564168e-4,3.32305264787094e-5,-3.591449619924816e-9,8.651764977358669e-4,3.348834402295054e-5,-3.695963620118213e-9,8.654934113410493e-4,3.380514974584113e-5,-3.827962144226022e-9,8.65680227216288e-4,3.411174050293928e-5,-3.957644664897803e-9,8.657570330287688e-4,3.4346041766830635e-5,-4.057808965225653e-9,8.657669387277931e-4,3.446932313815453e-5,-4.11101586076775e-9,8.657613435022625e-4,3.4472588411529344e-5,-4.112539581686109e-9,8.657862135868558e-4,3.4373094380466114e-5,-4.069050533975013e-9,8.658735763707832e-4,3.4205060581144676e-5,-3.99475967321788e-9,8.660388852455758e-4,3.400943296480929e-5,-3.907091687927469e-9,8.66282466493992e-4,3.3825844969993364e-5,-3.823219696797409e-9,8.665927137849105e-4,3.3687619719216236e-5,-3.7578388388344435e-9,8.669494024009601e-4,3.361913423273398e-5,-3.7219299984715987e-9,8.673264891657124e-4,3.363439881774626e-5,-3.7220625465320145e-9,8.676945418145927e-4,3.373592694579208e-5,-3.7598487309122184e-9,8.680234235964354e-4,3.391351714465576e-5,-3.831368929963179e-9,8.682859972296471e-4,3.4143297256214016e-5,-3.926691202132316e-9,8.684632880644983e-4,3.4388163647136244e-5,-4.029972466578756e-9,8.685506814790997e-4,3.460127638371885e-5,-4.120889818604067e-9,8.685633840062911e-4,3.4734023180121915e-5,-4.178058611548191e-9,8.685380720783138e-4,3.4748252417980764e-5,-4.184372534042753e-9,8.685276349437916e-4,3.462966914812959e-5,-4.132901756292709e-9,8.685883291320915e-4,3.439669502663824e-5,-4.030854924441111e-9,8.687628382465881e-4,3.409933619952682e-5,-3.8992420211352555e-9,8.690658895057307e-4,3.3806647123293056e-5,-3.767634596223998e-9,8.694785799556857e-4,3.358696397155016e-5,-3.66578227162126e-9,8.69953568550893e-4,3.348840676249508e-5,-3.6152232829612797e-9,8.704286241585501e-4,3.352635120659295e-5,-3.623705146793659e-9,8.708434233092473e-4,3.36810197345908e-5,-3.6838087593563796e-9,8.711544860856722e-4,3.390464015558857e-5,-3.775680273187482e-9,8.713445725476498e-4,3.4135193673201416e-5,-3.872743220397276e-9,8.714246913321904e-4,3.4312587501143965e-5,-3.948669842514471e-9,8.714288385999942e-4,3.4392832306213484e-5,-3.983673438771948e-9,8.714035709437477e-4,3.4356588349835174e-5,-3.968454991877816e-9,8.713959401397892e-4,3.4210390500048455e-5,-3.904979500162979e-9,8.714434314935408e-4,3.398142071965159e-5,-3.80439632081465e-9,8.715682144280527e-4,3.370866502664886e-5,-3.6833035835006632e-9,8.717760142029626e-4,3.343373250814609e-5,-3.5597712152619653e-9,8.720583485322628e-4,3.3193644320049306e-5,-3.450143545804329e-9,8.723963305223968e-4,3.301640385510928e-5,-3.367013852901416e-9,8.727645877754009e-4,3.2918942751948914e-5,-3.318240190622122e-9,8.731346053164378e-4,3.290646426016532e-5,-3.3065975355143806e-9,8.734775263631105e-4,3.297227361968222e-5,-3.329661479803068e-9,8.737669246598247e-4,3.3097659941762863e-5,-3.3797021541565744e-9,8.739822501713752e-4,3.325204966262417e-5,-3.443668277316694e-9,8.741134429392175e-4,3.339441456133996e-5,-3.5037068763647772e-9,8.741663973729802e-4,3.347758868121113e-5,-3.538992779628764e-9,8.741674829281171e-4,3.3457101736264556e-5,-3.529614543781381e-9,8.741636709228396e-4,3.33044797175946e-5,-3.4624919926690294e-9,8.742144615830622e-4,3.302135267114131e-5,-3.337668517116169e-9,8.743747932608298e-4,3.264687423555464e-5,-3.1716545924770886e-9,8.746743840366114e-4,3.2251051243278426e-5,-2.9946081022665746e-9,8.751039489192597e-4,3.1913364921373566e-5,-2.841130150424048e-9,8.75616678903275e-4,3.169573821909346e-5,-2.738595983860198e-9,8.761445007935473e-4,3.162302292091491e-5,-2.698649906049282e-9,8.766203447195945e-4,3.167892308982781e-5,-2.715236885002451e-9,8.769963987697803e-4,3.18159383463042e-5,-2.7686104110067445e-9,8.772531062745815e-4,3.197221978649029e-5,-2.8323654947714774e-9,8.773990475854998e-4,3.2088299096119665e-5,-2.880564943726866e-9,8.774645762292172e-4,3.211954673233677e-5,-2.893205151464858e-9,8.774924155916585e-4,3.204298846969703e-5,-2.8593905607603026e-9,8.775277330636137e-4,3.185874387139908e-5,-2.778242446816188e-9,8.776094585559394e-4,3.158700840416259e-5,-2.657838435817586e-9,8.777641128132043e-4,3.126183960920271e-5,-2.5126548703569532e-9,8.78002877757191e-4,3.092341017264447e-5,-2.360210638245288e-9,8.78321864386743e-4,3.061051760107952e-5,-2.217716237311034e-9,8.787048132667152e-4,3.0354696413936292e-5,-2.0993733631963004e-9,8.791271129207127e-4,3.0176554948077197e-5,-2.0146576508170057e-9,8.795600526842855e-4,3.0084265265720063e-5,-1.9675904842138486e-9,8.799746005764623e-4,3.0073592700195904e-5,-1.9567272155798592e-9,8.803445685727407e-4,3.0128701933306585e-5,-1.9754931411414064e-9,8.806494724082241e-4,3.0223295863434567e-5,-2.012635250546257e-9,8.808775707256542e-4,3.0322170015652122e-5,-2.052817626545346e-9,8.810294629751855e-4,3.0383874541022066e-5,-2.077700737209661e-9,8.811219817814094e-4,3.0365784932921254e-5,-2.068140259899549e-9,8.811907881742122e-4,3.0232911390513986e-5,-2.0081342888122047e-9,8.812885190182023e-4,2.997035224275941e-5,-1.8904615726488688e-9,8.814748050867232e-4,2.9595882363843328e-5,-1.7223897108962145e-9,8.817972325406356e-4,2.9164896341324755e-5,-1.5279575596742727e-9,8.822694105023639e-4,2.8759323793384683e-5,-1.343146342028477e-9,8.828590048460752e-4,2.846005103322195e-5,-1.203784176843767e-9,8.834961316970444e-4,2.8315408404152892e-5,-1.1317019817736651e-9,8.840994293836644e-4,2.83238474756633e-5,-1.1270381711241277e-9,8.846048503517724e-4,2.8439563876848128e-5,-1.1705107836514342e-9,8.849825261434277e-4,2.859423427913567e-5,-1.2327153363012424e-9,8.852377405673897e-4,2.872082247503333e-5,-1.2843809606697235e-9,8.854014350719654e-4,2.876976020388615e-5,-1.303411303612948e-9,8.855175691600622e-4,2.8715569658327886e-5,-1.277894686911527e-9,8.856319414654461e-4,2.8556383656666185e-5,-1.2061264571813115e-9,8.857841196699158e-4,2.8309570284204513e-5,-1.0949624616496077e-9,8.86002414496257e-4,2.800577749822175e-5,-9.574157297751806e-10,8.863013254260068e-4,2.7682541703841347e-5,-8.099261480403505e-10,8.866810883604368e-4,2.737801278175877e-5,-6.695408320630273e-10,8.871291034948231e-4,2.712535762590261e-5,-5.513048593649785e-10,8.876228817584209e-4,2.6948399119048687e-5,-4.661876242949888e-10,8.881339924077757e-4,2.6858865286951922e-5,-4.197713685400893e-10,8.886323956855838e-4,2.6855412138336997e-5,-4.1179225649502044e-10,8.890905424093482e-4,2.6924258581403914e-5,-4.3643441475982406e-10,8.89486876270744e-4,2.704096977561104e-5,-4.831197421077393e-10,8.898087302066524e-4,2.7172978043164845e-5,-5.375765842824722e-10,8.900547902185537e-4,2.7282747178927522e-5,-5.831513974124379e-10,8.902372653753913e-4,2.733186854749421e-5,-6.02542926548089e-10,8.903834851144673e-4,2.7286782595027556e-5,-5.803341451115104e-10,8.905356820182493e-4,2.712678713758405e-5,-5.066546828876249e-10,8.907466490935431e-4,2.6853822167289743e-5,-3.817222697006188e-10,8.910687379135351e-4,2.650095008026581e-5,-2.1981389275727818e-10,8.915358613141435e-4,2.613316302797963e-5,-4.974968918210426e-11,8.921441557986117e-4,2.583341569558239e-5,9.130127597938247e-11,8.928435576312597e-4,2.5673648601187617e-5,1.7077634639135572e-10,8.935508750856743e-4,2.5683679634147847e-5,1.7468326592194504e-10,8.941811428365587e-4,2.5837610180360195e-5,1.1381510218411522e-10,8.946793739990621e-4,2.6067113585673513e-5,1.8006901262402275e-11,8.950349091826171e-4,2.6291644820413183e-5,-7.717084794839584e-11,8.952750213494531e-4,2.6446389435700407e-5,-1.427663814093566e-10,8.954475970296075e-4,2.64960814946439e-5,-1.625988001066087e-10,8.956041887442954e-4,2.643519673510351e-5,-1.334689640026147e-10,8.957887712051753e-4,2.6280905283114967e-5,-6.224871917615731e-11,8.960323226691599e-4,2.6064317323041538e-5,3.777765165941726e-11,8.963513575114935e-4,2.5822815459411318e-5,1.5017549800954496e-10,8.96748509792149e-4,2.5594124919428984e-5,2.5799083696445723e-10,8.972140957359525e-4,2.5411712108030967e-5,3.459131555119787e-10,8.97728398380985e-4,2.5301088813513795e-5,4.0208667445015245e-10,8.982646818886401e-4,2.5276973108559064e-5,4.19511702332487e-10,8.987928885022273e-4,2.5341491278246515e-5,3.969097854818967e-10,8.992838386101128e-4,2.548373838032777e-5,3.389148700251626e-10,8.997135067687896e-4,2.5680959581705512e-5,2.5551799630259e-10,9.000668011166033e-4,2.590128913974731e-5,1.6084571383571664e-10,9.003404075887244e-4,2.610773225553987e-5,7.143433854803536e-11,9.005444531271067e-4,2.626306035931546e-5,4.124552392039377e-12,9.00702826310028e-4,2.6335350498633444e-5,-2.636373164642357e-11,9.008518990331428e-4,2.6304027478397698e-5,-1.0173572691243057e-11,9.010369750715351e-4,2.616622985452215e-5,5.4685092455799334e-11,9.013053376731691e-4,2.5942528849006335e-5,1.5954350428825642e-10,9.016950534266347e-4,2.5679451672258137e-5,2.8372503804596007e-10,9.022205066966907e-4,2.544470577148632e-5,3.9657633063202955e-10,9.028595081446744e-4,2.5311299328910574e-5,4.6464848630157026e-10,9.035509621163673e-4,2.5331826054565013e-5,4.634519661365919e-10,9.042106403831823e-4,2.5513725417149697e-5,3.8884970955208253e-10,9.047617243836385e-4,2.5811755065389144e-5,2.60664002639359e-10,9.051639505218222e-4,2.614554976562279e-5,1.1486292999309726e-10,9.054243849394402e-4,2.6432431256007105e-5,-1.1230224109221291e-11,9.055864786501333e-4,2.6615750824420068e-5,-9.174245642919217e-11,9.057083348203511e-4,2.6675961252054152e-5,-1.1728835587695205e-10,9.05843511575355e-4,2.6625694545636095e-5,-9.286576972832296e-11,9.06030514980889e-4,2.649764658641052e-5,-3.258481232105302e-11,9.06290090659766e-4,2.6332711316700743e-5,4.5492394804177083e-11,9.066269079166894e-4,2.617147979221003e-5,1.230902666428942e-10,9.07032727485054e-4,2.6049140781842117e-5,1.8405636274430814e-10,9.074895537591257e-4,2.5992565692749985e-5,2.1580884693763228e-10,9.079725233622418e-4,2.601842289978903e-5,2.1034058494702972e-10,9.08452843161885e-4,2.6131794189518346e-5,1.649501949413581e-10,9.089011187176733e-4,2.632531969086917e-5,8.266582317282753e-11,9.092912509323934e-4,2.657930002330282e-5,-2.7811191372744197e-11,9.096046947811349e-4,2.686337600497953e-5,-1.5287896453951608e-10,9.098343835696975e-4,2.7140160235303376e-5,-2.756580777618742e-10,9.099874027396871e-4,2.737067976970732e-5,-3.7839683569915226e-10,9.100856080701482e-4,2.7521019033657425e-5,-4.4541806075215186e-10,9.101636727790192e-4,2.756915427471307e-5,-4.662024595936307e-10,9.102644580498961e-4,2.751076592587584e-5,-4.3810314345020306E-10,9.104319511252228e-4,2.736291054800073e-5,-3.681879685719245e-10,9.107022221916946e-4,2.7164432891512126e-5,-2.736553609265788e-10,9.110933354507029e-4,2.6971680885033756e-5,-1.800824904443576e-10,9.11596330532063e-4,2.6848117080263942e-5,-1.167738231171905e-10,9.121710507471927e-4,2.6847793958635906e-5,-1.0913815308381964e-10,9.12751534970597e-4,2.6996070209376236e-5,-1.6964949395235283e-10,9.132634636288651e-4,2.72756008370633e-5,-2.9115810444199527e-10,9.136492992958313e-4,2.762733566158342e-5,-4.471383736182009e-10,9.138892892803114e-4,2.797002314543524e-5,-6.005507786510418e-10,9.140064810409892e-4,2.8229735821653137e-5,-7.173953360843062e-10,9.140537060586121e-4,2.8363778381520954e-5,-7.777099880424133e-10,9.14091744347561e-4,2.8368259804342512e-5,-7.790964097262822e-10,9.141707165736832e-4,2.8270290432506036e-5,-7.332676996715194e-10,9.143209375298112e-4,2.811333903517838e-5,-6.595294780294835e-10,9.145523676781168e-4,2.7943782175206335e-5,-5.787922436801097e-10,9.148586524660526e-4,2.780218073489562e-5,-5.09645207598181e-10,9.15222213264884e-4,2.771907523928594e-5,-4.663750532641056e-10,9.156186000215372e-4,2.771356286516508e-5,-4.581833019385022e-10,9.160198239972885e-4,2.7793018214471577e-5,-4.889247071998724e-10,9.163971548837643e-4,2.795307226790254e-5,-5.570122799444724e-10,9.167240149473723e-4,2.8177711329907586e-5,-6.554310086134877e-10,9.169794235753807e-4,2.8439962674449603e-5,-7.720472188029496e-10,9.171519825482253e-4,2.870402885777489e-5,-8.905750008556582e-10,9.172436935254598e-4,2.8929649817970348e-5,-9.925419838939779e-10,9.172722940063046e-4,2.9078832692983632e-5,-1.0603291660817625e-9,9.172706400546866e-4,2.912409780548574e-5,-1.080924584550345e-9,9.17282157849279e-4,2.9056323329246427e-5,-1.0495469582952546e-9,9.17352548715972e-4,2.8889652042343435e-5,-9.719977617501207e-10,9.175193386587934e-4,2.8661331040972106e-5,-8.647637143988589e-10,9.178017998224793e-4,2.842566755332037e-5,-7.524533284368034e-10,9.181939299909826e-4,2.824278153652306e-5,-6.627971222401617e-10,9.186627846165465e-4,2.8164133229208014e-5,-6.200278774014088e-10,9.19153691738718e-4,2.8217986087638425e-5,-6.380459293784765e-10,9.196025451004935e-4,2.8398984740483134E-05,-7.153326477966576e-10,9.199531003263491e-4,2.8666337663424036e-5,-8.338087002295918e-10,9.201741950295597e-4,2.8953522843619235e-5,-9.631226655409933e-10,9.202698561839225e-4,2.918802920852016e-5,-1.0697405631849333e-9,9.202770539297086e-4,2.9313951870328424e-5,-1.1274657767908662e-9,9.20251788073042e-4,2.9307694253609973e-5,-1.1248038587933661e-9,9.202503631241845e-4,2.918064509705824e-5,-1.0663142394564279e-9,9.203142811661418e-4,2.897003743896867e-5,-9.68530131895985e-10,9.204634699590332e-4,2.8724513202568727e-5,-8.534492296718607e-10,9.206973132387841e-4,2.849110787091789e-5,-7.426352211365498e-10,9.209999773637789e-4,2.8307067355278376e-5,-6.534492842105844e-10,9.213465790289916e-4,2.8196472237938423e-5,-5.974035621587512e-10,9.21708293335506e-4,2.8169942280115928e-5,-5.798940312517992e-10,9.220560080914304e-4,2.8225631349565033e-5,-6.005462214024394e-10,9.223629986190541e-4,2.8350410654034294e-5,-6.536955210792199e-10,9.226073866112044e-4,2.8520935298446312e-5,-7.28851240962084e-10,9.227750120124014e-4,2.8705005688838147e-5,-8.113094184352923e-10,9.228628541636617e-4,2.886416079327547e-5,-8.833278120249603e-10,9.228823589672353e-4,2.895853283479903e-5,-9.263428574000358e-10,9.228611534120579e-4,2.8954410829763517e-5,-9.244525203760215e-10,9.22841094274703e-4,2.8833597004887607e-5,-8.687589669821464e-10,9.228711087655056e-4,2.860178543460586e-5,-7.612984631604381e-10,9.229952903879357e-4,2.8291928119182712e-5,-6.167002132570091e-10,9.232395355675018e-4,2.7959342967609063e-5,-4.600776629160696e-10,9.236018170315074e-4,2.766851040299726e-5,-3.211006337196332e-10,9.240504121843283e-4,2.7475443382623978e-5,-2.2596816610665073e-10,9.24531262399518e-4,2.741170749626898e-5,-1.8999789985040983e-10,9.249820629694834e-4,2.747542499218661e-5,-2.1326498107148244e-10,9.25348579660942e-4,2.7631811895541113e-5,-2.805432543382063e-10,9.255984900902482e-4,2.7822723222327646e-5,-3.6544697746303546e-10,9.257290496695094e-4,2.798233184373522e-5,-4.3755816439126784e-10,9.25766534088789e-4,2.80545120609564e-5,-4.705154590635174e-10,9.257576987930197e-4,2.800685278340508e-5,-4.4865598588417815e-10,9.257561138535627e-4,2.7837106293070436e-5,-3.701910247767966e-10,9.258080615404461e-4,2.757056376533481e-5,-2.4616627976356377e-10,9.259425348434525e-4,2.7250326470559132e-5,-9.609656809923689e-11,9.261676807511085e-4,2.6924824434891593e-5,5.773311606893498e-11,9.264731188036599e-4,2.663697142690499e-5,1.9528968966108854e-10,9.268356351407438e-4,2.6417432659609167e-5,3.019901995562894e-10,9.272255509647921e-4,2.6282152592361178e-5,3.6997091936557287e-10,9.276120574189009e-4,2.6232846291373425e-5,3.9797540595297546e-10,9.279670116931762e-4,2.6258881085469936e-5,3.9055441141759986e-10,9.282675227858236e-4,2.633942937784366e-5,3.570959163618194e-10,9.284980234511821e-4,2.644547284239765e-5,3.109050504872678e-10,9.286524796636579e-4,2.654193492234242e-5,2.6822927772623276e-10,9.287369625751979e-4,2.6590780100069592e-5,2.468431766251289e-10,9.287720369209947e-4,2.6556135305642376e-5,2.636822102111064e-10,9.287934339306461e-4,2.6412028824363202e-5,3.312264037819188e-10,9.288486997992517e-4,2.6151880961107663e-5,4.530300718778846e-10,9.289878720362526e-4,2.5796515725207018e-5,6.199146734068698e-10,9.292487589067231e-4,2.5395465656098757e-5,8.092647167352129e-10,9.29641666352082e-4,2.5017209649756432e-5,9.894516360464816e-10,9.301413876496481e-4,2.472917795980915e-5,1.1290141747255939e-9,9.306922559167429e-4,2.4575229989538544e-5,1.2070780979559616e-9,9.312251819721861e-4,2.4561109000296633e-5,1.2202059312944135e-9,9.316789667520669e-4,2.465414560968802e-5,1.1827604254879246e-9,9.320169043861123e-4,2.479571175444768e-5,1.1213819953507269e-9,9.322336847376593e-4,2.4919677271373376e-5,1.0666004249723868e-9,9.323526991819391e-4,2.496981318218703e-5,1.044792681412822e-9,9.324168167771345e-4,2.4911728305382368e-5,1.072537792680831e-9,9.324763341556606e-4,2.473779692662344e-5,1.1541348440936524e-9,9.32577287240139e-4,2.446550131433796e-5,1.2821529509168165e-9,9.327524775390439e-4,2.4130741138395573e-5,1.440358563370683e-9,9.330166395630526e-4,2.3778318046824064e-5,1.608044416470438e-9,9.333661039477023e-4,2.345210977652227e-5,1.7646106799430005e-9,9.337821762564567e-4,2.3187164366326925e-5,1.8933448565731633e-9,9.342366534787011e-4,2.3004991867956138e-5,1.983756984261391e-9,9.346977645863617e-4,2.2912152275451638e-5,2.0323646948176415e-9,9.351352665974508e-4,2.2901360219547865e-5,2.0422501912195693e-9,9.355241516458479e-4,2.2953966611580642e-5,2.021915505548688e-9,9.358471024062418e-4,2.3042848220487e-5,1.983917263664366e-9,9.360962029673838e-4,2.313526295966051e-5,1.9435240421953627e-9,9.362744148421519e-4,2.319579877368126e-5,1.9173555450183216e-9,9.363970340869479e-4,2.3190008396632788e-5,1.921714213936969e-9,9.364926985739199e-4,2.3089580081948874e-5,1.970175219873316e-9,9.366025595028989e-4,2.287954350737153e-5,2.070174683549589e-9,9.367754583789063e-4,2.256662486320555e-5,2.219009962619075e-9,9.370572543760401e-4,2.2185503816041416e-5,2.40080151825208e-9,9.374749898088448e-4,2.179746684581724e-5,2.5870254829646286e-9,9.380215496738124e-4,2.1476617739059208e-5,2.7428988022427817e-9,9.386504920238448e-4,2.1285143976963856e-5,2.8389345262250392e-9,9.392879545260637e-4,2.124847926412409e-5,2.8626284858923288e-9,9.398581363504856e-4,2.1344635824425707e-5,2.8236063659948714e-9,9.403092110193681e-4,2.1513973951784947e-5,2.749245885993131e-9,9.406269138130842e-4,2.1682634723939766e-5,2.67386501863676e-9,9.408323763286779e-4,2.178648157968665e-5,2.6275885831474924e-9,9.409696504997068e-4,2.1786146578814432e-5,2.6292808737827737e-9,9.410906514838015e-4,2.1671298131321062e-5,2.6844268786052037e-9,9.41242649635597e-4,2.145702236312698e-5,2.786633456564728e-9,9.414601509848395e-4,2.1176178630965497e-5,2.9210047073092557e-9,9.417610200086401e-4,2.0870608445111807e-5,3.0681179766648086e-9,9.421460370053103e-4,2.0582809873944577e-5,3.207899651127782e-9,9.426010936837508e-4,2.0348968697412414e-5,3.3229824926066307e-9,9.431012540259686e-4,2.0193985304551373e-5,3.401195641488044e-9,9.436158120570794e-4,2.012884842892798e-5,3.436951038320817e-9,9.441134784478598e-4,2.015031500623975e-5,3.4314859276191417e-9,9.44566950904901e-4,2.0242534645964484e-5,3.3921135298370826e-9,9.449563631171996e-4,2.0379982085524475e-5,3.330805785534591e-9,9.45271517348029e-4,2.0530961708450033e-5,3.2625023737391606e-9,9.455131621575188e-4,2.0661233197895548e-5,3.203395247216593e-9,9.456936234191719e-4,2.0737740900431553e-5,3.1692023079153e-9,9.458369007988554e-4,2.073272466669384e-5,3.1732674706314038e-9,9.459779040524844e-4,2.0628653770206123e-5,3.224233945190357e-9,9.461597634391267e-4,2.0424167988906754e-5,3.3231751090821356e-9,9.46427574458297e-4,2.014003684687474e-5,3.4606600272122213e-9,9.468173676227388e-4,1.98221812789624e-5,3.615192303367057e-9,9.473413942934375e-4,1.9537012097558103e-5,3.755318583394564e-9,9.479753457182548e-4,1.9355058402098106e-5,3.847349600926752e-9,9.486571399076209e-4,1.9325058394134616e-5,3.867688552958027e-9,9.493040520760504e-4,1.9450539767815956e-5,3.814066075128484e-9,9.498430651538646e-4,1.9684623094334385e-5,3.7081770948540923e-9,9.502378728614017e-4,1.994861501821484e-5,3.5870008241428506e-9,9.504975307118342e-4,2.01632840220824e-5,3.4880374073031084e-9,9.506654032765242e-4,2.0274709481559317e-5,3.437068799563959e-9,9.507989420812344e-4,2.0264365859063468e-5,3.4433449550727618e-9,9.509516863480496e-4,2.0145143002205663e-5,3.5013586813003237e-9,9.511626032896819e-4,1.9950604861647016e-5,3.595755007819909e-9,9.514523625841899e-4,1.972359867900281e-5,3.7065483148110366e-9,9.518240846294337e-4,1.9507126203245064e-5,3.813351896094841e-9,9.522662841079077e-4,1.933798514493866e-5,3.898421280054506e-9,9.527567177104721e-4,1.9242649321887765e-5,3.94873970416592e-9,9.532666534200279e-4,1.9234898009828817e-5,3.9573083496472175e-9,9.537653046836214e-4,1.931500888982162e-5,3.923656171525834e-9,9.542241491314553e-4,1.9470419469034043e-5,3.853573929853045e-9,9.546208269205008e-4,1.967778168597357e-5,3.758113485784791e-9,9.549422337944906e-4,1.990624356532854e-5,3.6519733720235854e-9,9.551864658672643e-4,2.012153016907811e-5,3.5515235649189295e-9,9.553635348866212e-4,2.029033148993112e-5,3.4727284456947125e-9,9.554949463176509e-4,2.0384734278047446e-5,3.429079651875691e-9,9.55612166139684e-4,2.03866030610309e-5,3.4295402733541126e-9,9.557537872596488e-4,2.029183687422643e-5,3.4764900665650733e-9,9.559608378031081e-4,2.0114246891201803e-5,3.563775485379721e-9,9.562694312086343e-4,1.988802000189864e-5,3.6753836672060575e-9,9.567005353306505e-4,1.9666425812314765e-5,3.785918859393363e-9,9.572485741343938e-4,1.951354653734905e-5,3.864486310112931e-9,9.57873847869679e-4,1.9487015195238054e-5,3.8829949935352816e-9,9.58506375185627e-4,1.961495423927636e-5,3.827353654574862e-9,9.590658554599388e-4,1.9878214338844435e-5,3.706183686441474e-9,9.59491778185771e-4,2.021167822462048e-5,3.5503480856677113e-9,9.597671996149698e-4,2.0528378965229346e-5,3.4014299519401243e-9,9.599217284447296e-4,2.0753552855409916e-5,3.295380207449077e-9,9.600140258223889e-4,2.084893939258985e-5,3.2508500223577976e-9,9.601071466008167e-4,2.081721898662703e-5,3.2670417811981256e-9,9.602500853369318e-4,2.0691028420511654e-5,3.3288768573415605e-9,9.604701387776805e-4,2.051709319339869e-5,3.4144264007709955e-9,9.60773545484276e-4,2.034297332174702e-5,3.501100421052396e-9,9.611500679665309e-4,2.0208786324005668e-5,3.569552864573399e-9,9.615783591656324e-4,2.014318881895291e-5,3.6056735200335207e-9,9.620307130834803e-4,2.0161937110386437e-5,3.6014269400379457e-9,9.62477113531018e-4,2.0267731706648574e-5,3.5550823882264824e-9,9.628889049217328e-4,2.0450864920827385e-5,3.4710012484743916e-9,9.632422415170349e-4,2.069066577730867e-5,3.3589647822421636e-9,9.635212754316284e-4,2.0957906935666852e-5,3.2329849290971195e-9,9.637208099389389e-4,2.1218360815741975e-5,3.1095519476630494e-9,9.638478893925641e-4,2.143740445538196e-5,3.0054061149790872e-9,9.639218361763492e-4,2.158517204251695e-5,2.9350831633136274e-9,9.639725275225862e-4,2.164161332623286e-5,2.9085171189180765e-9,9.64036920303166e-4,2.1600821946777073e-5,2.928960887667208e-9,9.641539462469475e-4,2.1473982466179215e-5,2.991503500896854e-9,9.643579665181983e-4,2.129029021121154e-5,3.0824929931979146e-9,9.646710825382556e-4,2.1095019009386883e-5,3.180304929063653e-9,9.650951414487477e-4,2.0943493593642626e-5,3.2581268817857795e-9,9.656055505064805e-4,2.08898021785074e-5,3.2893920797482204e-9,9.661506527532753e-4,2.0970707862049013e-5,3.2556740154475738e-9,9.666609700686485e-4,2.1188936127107843e-5,3.154989219151684e-9,9.670695157136533e-4,2.1504456001118907e-5,3.0062342252277902e-9,9.673367523603838e-4,2.1842686062608042e-5,2.8453160317467475e-9,9.674669505838162e-4,2.2120216315934066e-5,2.7126670331229932e-9,9.675052672091475e-4,2.227588153984791e-5,2.6381300324599617e-9,9.67517310975436e-4,2.2290098639572074e-5,2.631571812351488e-9,9.675641549386202e-4,2.2184188610723864e-5,2.683192639935835e-9,9.676856175598294e-4,2.20050732406217e-5,2.770831293998539e-9,9.678958345343047e-4,2.1806797104405777e-5,2.8687326779884426e-9,9.681874796128061e-4,2.1636899335670483e-5,2.953998363007588e-9,9.685391645791842e-4,2.152957275673156e-5,3.00987037631748e-9,9.689223645110006e-4,2.150393434528262e-5,3.0266647100820593e-9,9.693065461435913e-4,2.1564905127593073e-5,3.0015027830697376e-9,9.696627464705727e-4,2.170489096403e-5,2.9376390040777005e-9,9.699663713453124e-4,2.190558400417185e-5,2.843664610904784e-9,9.701997585934131e-4,2.213998368625858e-5,2.732536103734538e-9,9.703546573483743e-4,2.2375052452482884e-5,2.6202568912921775e-9,9.704343769114892e-4,2.2575473791547756e-5,2.524023751178972e-9,9.70454924970594e-4,2.2708679506424222e-5,2.4597828841057676e-9,9.704442684490575e-4,2.2750680548228815e-5,2.4394191096140195e-9,9.70439123002729e-4,2.269163919856002e-5,2.4680675742140396e-9,9.704792630519241e-4,2.2539791907013454e-5,2.542185695856593e-9,9.706000419416595e-4,2.2322356320565065e-5,2.6490241837254375e-9,9.708244225247657e-4,2.208254490993235e-5,2.7679330778128663e-9,9.711561348596273e-4,2.1872563135784633e-5,2.8736116004682885e-9,9.715756674472968e-4,2.1743144202396543e-5,2.9411105609226534e-9,9.720408542324096e-4,2.1730926538918943e-5,2.952015717458691e-9,9.724936339510598e-4,2.1846219921065344e-5,2.9005828036571425e-9,9.728734724452532e-4,2.206526684943893e-5,2.797753482524233e-9,9.73135268736305e-4,2.2331915022099625e-5,2.670534930423955e-9,9.732656869873846e-4,2.2571721047228047e-5,2.5551777813643346e-9,9.732896097496811e-4,2.2715649390846857e-5,2.4855509251822116e-9,9.732616414073596e-4,2.272350320648063e-5,2.481624710067114e-9,9.732459633450723e-4,2.2595527734851322e-5,2.5437609524692543e-9,9.732948670608518e-4,2.2367393624596813e-5,2.6551037957679194e-9,9.73435775314028e-4,2.2093662920085047e-5,2.7895237218060307e-9,9.736697513088091e-4,2.18295826774539e-5,2.9203430820786453e-9,9.739779823635234e-4,2.1618463822268142e-5,3.0263986928152343e-9,9.743307630656896e-4,2.14864286442583e-5,3.094632000552376e-9,9.746951934172733e-4,2.1442559653592196e-5,3.120143478228777e-9,9.75040337470858e-4,2.1481561948537084e-5,3.105047155900916e-9,9.753402753088035e-4,2.1586872020260996e-5,3.0570669881734935e-9,9.755760407850127e-4,2.1733399542332765e-5,2.9882432258541283e-9,9.757372606998641e-4,2.1890007987213578e-5,2.913710103700545e-9,9.758238522467932e-4,2.2022308074060718e-5,2.8502981225779335e-9,9.758475695193567e-4,2.2096463822383953e-5,2.814649675643213e-9,9.75832592759985e-4,2.208441265972937e-5,2.8206647589847394e-9,9.758139779570534e-4,2.1970120824932505e-5,2.8764536267483205e-9,9.758329513980938e-4,2.1755459239150598e-5,2.9814657729990575e-9,9.759289405456378e-4,2.146343405290607e-5,3.1248755506446147e-9,9.761297562449015e-4,2.1136469459250627e-5,3.2863308207215907e-9,9.764427844228285e-4,2.0828722875066234e-5,3.4395760619971846e-9,9.768504235625822e-4,2.05936578116549e-5,3.558401665094199e-9,9.773119310828517e-4,2.047011212383905e-5,3.623414500991834e-9,9.777718670258082e-4,2.0470907088346007e-5,3.627703453703138e-9,9.781733258317801e-4,2.057752945621449e-5,3.5796494003707138e-9,9.784727031122457e-4,2.0742968740602736e-5,3.501766797457081e-9,9.786520083386822e-4,2.090280873294008e-5,3.4254174178099575e-9,9.787247391817811e-4,2.099234249163606e-5,3.3824366972435045e-9,9.787325073239532e-4,2.0964978181006943e-5,3.3960258792809006e-9,9.787325574450096e-4,2.080554329966027e-5,3.474116418782361e-9,9.78780386798012e-4,2.053316629811452e-5,3.607853339306525e-9,9.78914283306498e-4,2.0192836373745813e-5,3.7756288344559166e-9,9.79147450149718e-4,1.9840040928541138e-5,3.9505044744465266e-9,9.794691393037586e-4,1.9525344833017023e-5,4.107694790089413e-9,9.798520178516646e-4,1.928413468832371e-5,4.229601723499455e-9,9.802613780058582e-4,1.9132999458968806e-5,4.30768523320254e-9,9.806628425931363e-4,1.9071152761889917e-5,4.341903576740723e-9,9.810273134182267e-4,1.9084239326578834e-5,4.338962357581536e-9,9.81333537072951e-4,1.9148443642578993e-5,4.310353550740631e-9,9.81569296115634e-4,1.9233976343823555e-5,4.2706388260183405e-9,9.817321483998952e-4,1.9307966381521585e-5,4.235993167701627e-9,9.81830219636952e-4,1.933733918927407e-5,4.222757802688705e-9,9.818829501630556e-4,1.9292467400002797e-5,4.245632427234919e-9,9.819209964844942e-4,1.9152168044642423e-5,4.315222825428222e-9,9.8198392831691e-4,1.890983975966044e-5,4.435029642934434e-9,9.821143377150008e-4,1.857919889488635e-5,4.59861659028588e-9,9.823480141006478e-4,1.819663416702158e-5,4.788408783691395e-9,9.827021678395676e-4,1.781681352429813e-5,4.977767747591471e-9,9.8316630954625e-4,1.750019208422675e-5,5.1370239028109335e-9,9.837010460599907e-4,1.729533464359589e-5,5.242087342349132e-9,9.842471758127079e-4,1.722284340206006e-5,5.282365711457081e-9,9.847423799112572e-4,1.7267922501442923e-5,5.2645551112541595e-9,9.851390392167326e-4,1.7384650541422545e-5,5.210737350473865e-9,9.85416712413494e-4,1.7509721680699187e-5,5.151788515618179e-9,9.855858656559924e-4,1.7580163367743918e-5,5.118732221992248e-9,9.856830005405348e-4,1.754937325800318e-5,5.134813103943706e-9,9.857596419803308e-4,1.7397498039928058e-5,5.210281577132254e-9,9.858686370143312e-4,1.7134242430752782e-5,5.340872784086539e-9,9.860514093620037e-4,1.6794137806137563e-5,5.509998145968244e-9,9.863293550422345e-4,1.6426136917274978e-5,5.693759305662125e-9,9.867012674118518e-4,1.6080882897378395e-5,5.867166202605813e-9,9.871466831850105e-4,1.5799461394281728e-5,6.009706321470195e-9,9.876331363464859e-4,1.560644168178504e-5,6.108876220456722e-9,9.881244546795737e-4,1.5508013115131364e-5,6.16123561320287e-9,9.885877203164924e-4,1.5494168132305846e-5,6.1714423956312695e-9,9.889977731607897e-4,1.554301218967708e-5,6.150173958810571e-9,9.89339357154404e-4,1.5625438489487203e-5,6.11180328305642e-9,9.896077069428486e-4,1.5709163928471263e-5,6.072354236231378e-9,9.898084641090051e-4,1.5761986455145772e-5,6.047846128949401e-9,9.89957481892549e-4,1.575472773264608e-5,6.052821432389052e-9,9.900805416390554e-4,1.5664564164811243e-5,6.098708901861965e-9,9.902123484409752e-4,1.5479331179479615e-5,6.191709401312268e-9,9.903935258545628e-4,1.5202748222706768e-5,6.33020714370356e-9,9.906641160678208e-4,1.4859172652645127e-5,6.502381741232603e-9,9.910530106883304e-4,1.4494749524882107e-5,6.685572808518867e-9,9.915653761885476e-4,1.4170939529055735e-5,6.8494023081549725e-9,9.92173804543939e-4,1.3948485846748767e-5,6.963646567409606e-9,9.92820439606734e-4,1.3865800846189006e-5,7.008937764536123e-9,9.934330686488335e-4,1.3922023616282452e-5,6.98524850756154e-9,9.939493480964887e-4,1.4075052891534514e-5,6.91302227434678e-9,9.943372374337234e-4,1.4256527274009431e-5,6.825888020437902e-9,9.946022722861765e-4,1.4395571285888233e-5,6.75895614654633e-9,9.947808856143072e-4,1.4439740434982362e-5,6.738430832136037e-9,9.949257957257986e-4,1.4366093115323758e-5,6.776065172871318e-9,9.950905167510095e-4,1.418186073054903e-5,6.868729017701459e-9,9.953173989064848e-4,1.391790875148587e-5,7.001518418367263e-9,9.95630713119781e-4,1.3618756991412558e-5,7.152573416875709e-9,9.960345799292754e-4,1.3332040182830323e-5,7.29822948174995e-9,9.965148922381106e-4,1.3099245727471433e-5,7.4176277467670906e-9,9.970441941477112e-4,1.294893783688122e-5,7.496180701557594e-9,9.975882397394037e-4,1.2893264734091967e-5,7.527452492986098e-9,9.98112746713271e-4,1.2927881166143136e-5,7.513323955728468e-9,9.985890416039868e-4,1.3034634044303174e-5,7.462717843178684e-9,9.98997826875862e-4,1.3185900947308538e-5,7.389423516943071e-9,9.993309205324102e-4,1.3349405125668461e-5,7.3096360810763596e-9,9.99591375901445e-4,1.3492586365441474e-5,7.2397137309556e-9,9.99792668555754e-4,1.3586170648049899e-5,7.19436794380859e-9,9.999574846180697e-4,1.3607159236305784e-5,7.185183536470915e-9,0.0010001162353076604,1.3541721843540724e-5,7.219205045654568e-9,0.0010003049165363592,1.3388426048463978e-5,7.297338394204071e-9,0.0010005613623854227,1.3161776667357265e-5,7.4125560623676355e-9,0.0010009186855654698,1.2894930291567578e-5,7.548472365832492e-9,0.001001395431805748,1.2638913929780974e-5,7.679645009834532e-9,0.0010019842716833783,1.2454704246940159e-5,7.775465670467849e-9,0.0010026447567112351,1.2396089240531763e-5,7.80872345265965e-9,0.0010033080233894881,1.2487217081785896e-5,7.766920829338294e-9,0.0010038972478855197,1.2706548445498057e-5,7.660458605367358e-9,0.0010043565504526115,1.2989946449421098e-5,7.521224770364038e-9,0.001004672231437384,1.3254551939388285e-5,7.390681026669133e-9,0.0010048741581043606,1.3430195374539308e-5,7.304097230213788e-9,0.001005019125368549,1.3480998017901777e-5,7.27969563649755e-9,0.001005168386359312,1.340941335065461e-5,7.316596454133312e-9,0.0010053704906546521,1.3246930061867809e-5,7.3994046186029145e-9,0.0010056532197300141,1.3040000118914438e-5,7.505138119129774e-9,0.0010060229091539998,1.2837303701281687e-5,7.609490773330097e-9,0.0010064679702872599,1.2680694358525935e-5,7.691325334965295e-9,0.00100696410900686,1.2599802055308625e-5,7.73543576837147e-9,0.0010074799303969257,1.2609453088105831e-5,7.733972018905462e-9,0.0010079824262810555,1.270927137545503e-5,7.68678360040066e-9,0.001008441983199197,1.2885166585695294e-5,7.600766502657164e-9,0.0010088364680810365,1.3112382500046945e-5,7.488348827427479e-9,0.0010091540147537904,1.3359627618872047e-5,7.365366043977686e-9,0.0010093942793346546,1.3593707411098743e-5,7.248659658443538e-9,0.0010095681767792678,1.3783993741249416e-5,7.15377885761242e-9,0.0010096964280629517,1.3906222158150544e-5,7.093063507146875e-9,0.0010098073351207102,1.3945501108580383e-5,7.074156161434548e-9,0.001009933998475673,1.3898670498425644e-5,7.098839141011301e-9,0.0010101108925560731,1.3776156395851466e-5,7.162087545997906e-9,0.0010103693537762879,1.3603229200616472e-5,7.2513716092129284e-9,0.001010731370310706,1.3419833637562037e-5,7.3466457393835305e-9,0.0010112016762827962,1.3277108498864683e-5,7.422018074019115e-9,0.0010117598625822178,1.3228209751310446e-5,7.450356500270065e-9,0.0010123568768607588,1.3312347000828476e-5,7.411421404428368e-9,0.0010129222480500654,1.3535582819181508e-5,7.301724939909382e-9,0.001013385331984101,1.3858804132080293e-5,7.140781390672817e-9,0.001013703707706818,1.4205000113155494e-5,6.967497490960027e-9,0.0010138822454817784,1.448749274687313e-5,6.825833236491937e-9,0.0010139696115598694,1.464433393257325e-5,6.747309515966404e-9,0.001014034960781267,1.4658559233696529e-5,6.740744459985028e-9,0.0010141406929217946,1.4555765436898252e-5,6.793498539548968e-9,0.0010143254890754552,1.4386576477060897e-5,6.880297884166936e-9,0.0010146008251386124,1.420706593101242e-5,6.973012537470857e-9,0.0010149561275081414,1.4065065181815716e-5,7.047465907773897e-9,0.00101536675460542,1.3993570240248546e-5,7.0867457546242325e-9,0.0010158013574818438,1.4009210516690739e-5,7.0820601273590445e-9,0.0010162275161801665,1.4113340727320419e-5,7.032323770553171e-9,0.0010166159146742558,1.429419134817385e-5,6.943198192930504e-9,0.0010169435907143895,1.4529570251940101e-5,6.825790427443894e-9,0.001017196458485237,1.4790107827825064e-5,6.695003258799705e-9,0.0010173710222833715,1.5043063994411697e-5,6.5675509780237646e-9,0.0010174750556951806,1.5256600380969255e-5,6.459732390817189e-9,0.001017526963278131,1.5404159828331004e-5,6.385177403566588e-9,0.0010175537373666459,1.5468376233596634e-5,6.352868110860509e-9,0.001017587717364337,1.544402654131814e-5,6.365661713647204e-9,0.0010176624605994554,1.5339717534360233e-5,6.419435210938414e-9,0.0010178080063839555,1.5178075945731396e-5,6.502944076621323e-9,0.0010180457452669584,1.4994254410299033e-5,6.598491835633543e-9,0.001018383064035031,1.4832381264038678e-5,6.6836353960864175e-9,0.0010188083316972948,1.47391332796154e-5,6.734397667122887e-9,0.0010192878609278002,1.475363974145172e-5,6.730438678602947e-9,0.0010197678046505864,1.4894272655654495e-5,6.661915015952189e-9,0.00102018443463024,1.5145950174105276e-5,6.5361350999692345e-9,0.0010204836747962334,1.5455522234757765e-5,6.380048705078234e-9,0.0010206437243931602,1.5743334912936524e-5,6.2343512371156256e-9,0.0010206877187796243,1.5931055263172206e-5,6.139179160224897e-9,0.0010206758978202743,1.5972669549953236e-5,6.118206896081988e-9,0.0010206802785743953,1.587040614601252e-5,6.170538509004209e-9,0.0010207572457502255,1.5667653115910527e-5,6.274358304487625e-9,0.0010209325449119094,1.5426977239675342e-5,6.398084889086976e-9,0.0010212017498908892,1.520786821074164e-5,6.511580983868921e-9,0.0010215398590799887,1.5053291656116975e-5,6.5929010127443566e-9,0.001021912431934167,1.498569502034724e-5,6.630329259183798e-9,0.0010222841435015692,1.5008880327172054e-5,6.621529648464819e-9,0.0010226239917599095,1.5112068113238198e-5,6.571614831742929e-9,0.0010229080944826484,1.527401144689631e-5,6.491159177179544e-9,0.0010231212780165244,1.5466570242856973e-5,6.394419794620523e-9,0.001023258140679252,1.565799311163615e-5,6.29764201481796e-9,0.001023323723746117,1.581631986787821e-5,6.217269214912676e-9,0.0010233335657502231,1.5913194832607108e-5,6.1679458224003706e-9,0.001023312652942418,1.592801691867029e-5,6.160375068918902e-9,0.0010232928007281963,1.5851837316847298e-5,6.199331981376249e-9,0.0010233083950897286,1.5690131829775294e-5,6.282255337576482e-9,0.0010233908943278179,1.5463603240336597e-5,6.398818557630599e-9,0.0010235628682748299,1.5206365333078503e-5,6.531796793225194e-9,0.001023832615986048,1.4961295414609502e-5,6.659351030318273e-9,0.0010241904386357422,1.4772889164037382e-5,6.75860252344733e-9,0.001024607567166903,1.4678269177210256e-5,6.810218842264442e-9,0.001025038835875019,1.4697338813962965e-5,6.803536849223181e-9,0.0010254302198467145,1.4824014543455562e-5,6.7412161836967475e-9,0.001025731571596928,1.5021882123837198e-5,6.641636326261475e-9,0.0010259126052034333,1.522848767407803e-5,6.536783150416774e-9,0.0010259765363499528,1.5370953906319304e-5,6.464197088487894e-9,0.0010259633245588596,1.5390062552732196e-5,6.454503675266422e-9,0.0010259374918061134,1.5262568774086813e-5,6.519889575291671e-9,0.0010259645518792863,1.5009405517106155e-5,6.649894303135918e-9,0.0010260881771412683,1.4685110812366908e-5,6.816835676346961e-9,0.0010263193576777233,1.4355638624471758e-5,6.98711790063453e-9,0.0010266398889383535,1.4077159844329356e-5,7.1319926882616635e-9,0.001027014226018415,1.388425288732607e-5,7.2335633845970444e-9,0.0010274020414492461,1.3788133610311604e-5,7.285745723386852e-9,0.0010277670997235588,1.378095198171993e-5,7.292187151879546e-9,0.0010280818168414282,1.384189253769118e-5,7.263261955630348e-9,0.0010283288268859772,1.3942614549109414e-5,7.213352520340318e-9,0.0010285011445110084,1.405139140764495e-5,7.158731665697266e-9,0.0010286019408435882,1.413632711989153e-5,7.115870597147311e-9,0.0010286442540053864,1.4168322568558104e-5,7.09986088584424e-9,0.0010286504037499457,1.4124365397943462e-5,7.12268504128625e-9,0.0010286504791455998,1.3991292700524017e-5,7.191271681234185e-9,0.0010286791648484964,1.3769478993510954e-5,7.3056080066068604e-9,0.0010287705469715204,1.3475266008978337e-5,7.457494460578409e-9,0.001028951327632887,1.3140689311306862e-5,7.630660550566689e-9,0.0010292338285229816,1.280935564220711e-5,7.802822009644976e-9,0.0010296108825569928,1.2528353458002378e-5,7.949760843038067e-9,0.0010300546940236487,1.233759347627838e-5,8.050755726164393e-9,0.0010305208273311641,1.2259178009605778e-5,8.094075186049836e-9,0.0010309570900584187,1.2289732755782155e-5,8.08103476461809e-9,0.0010313157392175553,1.239822992254162e-5,8.027273387668908e-9,0.0010315663465513536,1.2530919495367793e-5,7.960336714121893e-9,0.0010317058209335492,1.2623500762804774e-5,7.913435014428099e-9,0.001031761762409121,1.2618455216019864e-5,7.916445804350526e-9,0.0010317863213620134,1.2482715648861428e-5,7.986708154305847e-9,0.0010318409415092163,1.2218875567850196e-5,8.123174915224233e-9,0.0010319770490094284,1.1864341225077265e-5,8.306813126168584e-9,0.00103222073763433,1.1478137897328902e-5,8.507363432120657e-9,0.001032567744181653,1.1121486498340977e-5,8.693293502779717e-9,0.001032989301697024,1.084087419509298e-5,8.840491614529463e-9,0.0010334441429188832,1.065944919603051e-5,8.936740074754993e-9,0.0010338905402688494,1.0577173083741774e-5,8.981736505163395e-9,0.0010342945423151325,1.0576383955421915e-5,8.98433665789792e-9,0.00103463375858786,1.0628837350001691e-5,8.958991422832772e-9,0.0010348979793146607,1.0701777354861157e-5,8.922621233770985e-9,0.0010350882727302663,1.0762337371071754e-5,8.89230185881902e-9,0.0010352157191526022,1.0780632780980312e-5,8.883608858628518e-9,0.0010353002554859072,1.0732303407048932e-5,8.90925860516677e-9,0.0010353694431257166,1.0601227344865006e-5,8.977690201699487e-9,0.0010354564618759658,1.0382697470573208e-5,9.09143350297743e-9,0.0010355964502504992,1.008658752883728e-5,9.245490273873833e-9,0.00103582062126145,9.739174784541215e-6,9.426394426544935e-9,0.001036148531357024,9.381685552026843e-6,9.612933762557046e-9,0.001036580411402926,9.063860868442835e-6,9.779418101910907e-9,0.0010370928511063498,8.832500434599207e-6,9.901545674027221e-9,0.0010376410685493903,8.717740287966906e-6,9.963490318062588e-9,0.001038168776362179,8.722090107823838e-6,9.963639543713632e-9,0.001038623174432724,8.817117820241822e-6,9.916433090139891e-9,0.0010389699638132367,8.949806345046257e-6,9.849185263172341e-9,0.0010392031310252545,9.056681538401306e-6,9.794814136056429e-9,0.0010393464417650642,9.081041880969784e-6,9.7828832107339e-9,0.0010394465445357972,8.98803121924295e-6,9.831716602058708e-9,0.0010395599652596504,8.773379181090786e-6,9.943793307826468e-9,0.0010397377850124105,8.463527638538071e-6,1.010562028455275e-8,0.0010400124740567555,8.107264085356009e-6,1.0292016552047566e-8,0.0010403907983126954,7.761647465210934e-6,1.047336668482392e-8,0.0010408546068110553,7.476975351250501e-6,1.0623406725890964e-8,0.0010413683448417354,7.285608742141655e-6,1.0725068130866081e-8,0.0010418898199738098,7.197436696745734e-6,1.077292879202111e-8,0.0010423802623030689,7.201792582882333e-6,1.0772323696065717e-8,0.0010428110604212102,7.273401012350935e-6,1.0736320365516424e-8,0.0010431666141344895,7.3794054706384364e-6,1.0682066369385867e-8,0.0010434442537033133,7.485424438284342e-6,1.062758834085327e-8,0.001043652630466233,7.559908129853109e-6,1.0589456096467488e-8,0.0010438096899647942,7.577040457584126e-6,1.0581220954317427e-8,0.0010439407598399314,7.518874452397437e-6,1.0612288493742078e-8,0.0010440766580099585,7.3774053804267025e-6,1.0686856280073861e-8,0.0010442511917944904,7.1569232978676465e-6,1.0802719477653824e-8,0.0010444971593526165,6.876269078840813e-6,1.0950114569202205e-8,0.001044840195797599,6.569674575005575e-6,1.1111270660756568e-8,0.0010452907905748228,6.284047442282688e-6,1.1261780001466925e-8,0.0010458366657182785,6.070632446913745e-6,1.1374885918198315e-8,0.0010464397212440041,5.970991705073476e-6,1.1428761032437083e-8,0.0010470419129418023,6.0012650636924906e-6,1.1414752486565529e-8,0.0010475808873286244,6.142246342171787e-6,1.134266195270011e-8,0.0010480101442759484,6.342031857499272e-6,1.1239472124113928e-8,0.0010483145665516262,6.531775462877667e-6,1.1141164514740623e-8,0.0010485141839921832,6.647674109549178e-6,1.1081204358546142e-8,0.0010486555927916323,6.649554437643226e-6,1.1080769771562399e-8,0.0010487962274780228,6.52970014858732e-6,1.1144090607712959e-8,0.001048988161110087,6.311113549640392e-6,1.1259318747852037e-8,0.001049266135585487,6.038217412853158e-6,1.140334069973273e-8,0.0010496417708631659,5.764112342343603e-6,1.1548386965958874e-8,0.001050103884713581,5.538005408647266e-6,1.1668579695155248e-8,0.0010506236688532541,5.395419538643018e-6,1.1745084312143063e-8,0.001051162793625547,5.352737678222033e-6,1.176905039772956e-8,0.0010516822059403249,5.4065291012566944e-6,1.1742069546748452e-8,0.0010521495626468031,5.5369304279269275e-6,1.1674479004989727e-8,0.0010525439851890206,5.7134564555245825e-6,1.1582329111142928e-8,0.0010528578438257308,5.9014015084172195e-6,1.1483979856274418e-8,0.0010530961263485919,6.067417747217445e-6,1.139710095373138e-8,0.0010532743691075914,6.1835874192326255e-6,1.133647354846759e-8,0.0010534160834845703,6.230045791333779e-6,1.1312589735762775e-8,0.001053550198721015,6.1966823130205854e-6,1.1330774854534354e-8,0.0010537085154161126,6.0844906794547615e-6,1.1390513063025623e-8,0.0010539227224054864,5.906847205676181e-6,1.1484802633572627e-8,0.00105422025687308,5.690435278638442e-6,1.1599668036115498e-8,0.0010546184278993171,5.4746708261865515e-6,1.1714426246353476e-8,0.001055117156275193,5.307635025766357e-6,1.1803769941651274e-8,0.001055692545616445,5.236529243510756e-6,1.184274644058134e-8,0.001056295705931545,5.292689648675187e-6,1.1814655608677331e-8,0.0010568617072468647,5.4757403210461624e-6,1.1719477956429268e-8,0.0010573293783666506,5.74604326804144e-6,1.157796966652239e-8,0.0010576645165347547,6.033560344798371e-6,1.1427058221344922e-8,0.0010578737870635731,6.261973517443829e-6,1.1307094518131505e-8,0.0010580009637449824,6.3760497725166996e-6,1.1247346419441141e-8,0.001058108517330219,6.358165356812837e-6,1.1257242872632262e-8,0.0010582556001528874,6.228289144348805e-6,1.1326384333356857e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_13.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_13.json deleted file mode 100644 index 33f96e30..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_13.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":13000,"numberOfSamples":1000,"samples":[0.0010584823083198346,6.031818825503171e-6,1.14309469118811e-8,0.0010588036033781425,5.823520864538709e-6,1.1542103150393909e-8,0.0010592110744742987,5.6537248748726675e-6,1.1633248752700286e-8,0.0010596790894540058,5.559275280564943e-6,1.1684765345343194e-8,0.0010601724727019367,5.559236240846307e-6,1.1686339583847125e-8,0.0010606540091394276,5.654379293057021e-6,1.163732802349451e-8,0.0010610908819856466,5.829497270171977e-6,1.1545624012790231e-8,0.0010614594503400023,6.057715047147503e-6,1.1425423187205381e-8,0.001061747989835144,6.305862037083749e-6,1.1294367431781857e-8,0.0010619573719630783,6.539955951254238e-6,1.1170587469196216e-8,0.0010620999645025674,6.73003410085884e-6,1.107008326599654e-8,0.0010621972572704668,6.85379996171742e-6,1.1004756707165859e-8,0.0010622768540195135,6.898913123430779e-6,1.098119849532928e-8,0.0010623693266318172,6.864185869807982e-6,1.1000078885400938e-8,0.0010625050436689565,6.760079817880366e-6,1.1055907410923635e-8,0.001062710756522555,6.608668374463369e-6,1.1137052470541557e-8,0.0010630055440594903,6.442842455479279e-6,1.122613014857253e-8,0.0010633958133875673,6.303928192637586e-6,1.1301216346173524e-8,0.0010638698300656857,6.236227673998108e-6,1.1338700200742188e-8,0.0010643938207032379,6.277096687541316e-6,1.1318549017049607e-8,0.0010649135018336272,6.443029009602109e-6,1.1231761017071778e-8,0.0010653652534506645,6.716334917457601e-6,1.1087554932954997e-8,0.0010656971998236583,7.041447402084115e-6,1.0915428186536279e-8,0.0010658919742331224,7.338860744797124e-6,1.0757744815379704e-8,0.0010659770288683225,7.534292063466726e-6,1.0654138240953239e-8,0.001066013886508743,7.587831708115414e-6,1.0625935223163422e-8,0.0010660723258305996,7.506181686783977e-6,1.0669662265910576e-8,0.0010662052115061964,7.3335686443663195e-6,1.0761922260944352e-8,0.0010664358470525873,7.130863915281745e-6,1.0870481691937031e-8,0.0010667588393153595,6.955633515934309e-6,1.0964801902708683e-8,0.0010671485918925085,6.8498410434954626e-6,1.1022511941646397e-8,0.0010675694409390784,6.835426550329633e-6,1.1031759374762615e-8,0.0010679841615469535,6.915158645441867e-6,1.0990824083116765e-8,0.0010683599657830244,7.076052103195604e-6,1.0906394119921115e-8,0.0010686723933572796,7.293685466136946e-6,1.0791343615514796e-8,0.00106890765095213,7.536822311352906e-6,1.0662299642942404e-8,0.0010690635977016276,7.77211139688823e-6,1.0537115853861746e-8,0.001069149428980129,7.968577301214409e-6,1.0432429890255657e-8,0.0010691841550370862,8.101601929648258e-6,1.036149374624633e-8,0.0010691940071483454,8.156061538266819e-6,1.0332478423133815e-8,0.001069209055658057,8.128266563717782e-6,1.03474435063982e-8,0.0010692594713290538,8.026593480405271e-6,1.0402013164716527e-8,0.0010693717459872535,7.870945267100574e-6,1.0485664177770738e-8,0.0010695649713014753,7.691125951702836e-6,1.05825672334285e-8,0.0010698471837835711,7.524020444771572e-6,1.0673046459330192e-8,0.0010702118794917663,7.409199319244088e-6,1.073588364535248e-8,0.0010706353190277158,7.382260325524803e-6,1.0751866255570777e-8,0.0010710762838212979,7.465490347225327e-6,1.0708824642405977e-8,0.0010714809682874885,7.65702106935285E-06,1.0607528738465052e-8,0.0010717954666795326,7.92266264450533e-6,1.0466162353522634e-8,0.0010719849482146093,8.197549025520211e-6,1.031948512559187e-8,0.0010720518335533688,8.403355641842077e-6,1.0209555077841326e-8,0.0010720405373210041,8.477632103826806e-6,1.0169920153450947e-8,0.001072021738228369,8.400092320472587e-6,1.021150931330851e-8,0.0010720635198379748,8.199374023477202e-6,1.0319075409549964e-8,0.0010722065788787624,7.937147885028722e-6,1.0459750886515433e-8,0.00107245583521534,7.681893768449438e-6,1.0597036740148054e-8,0.0010727875503866039,7.487659268153709e-6,1.0702071381753594e-8,0.0010731630002383215,7.384581405590331e-6,1.075864496894142e-8,0.0010735409195010803,7.379180450137632e-6,1.0763066178824929e-8,0.001073885642552888,7.459556157906894e-6,1.0721462765445143e-8,0.0010741711464074789,7.60167164073378e-6,1.064650717664984e-8,0.0010743824677307964,7.774854624539591e-6,1.05545292946971e-8,0.0010745158753886549,7.946253107214568e-6,1.0463140800736486e-8,0.0010745783975093434,8.084663970024577e-6,1.0389154063601514e-8,0.0010745867148931046,8.164015707520659e-6,1.0346669113505363e-8,0.0010745652935797434,8.166515928713906e-6,1.0345347414447921e-8,0.0010745436064007652,8.085247843115634e-6,1.0389003625916266e-8,0.001074552414002862,7.925732239563838e-6,1.04747713355022e-8,0.0010746194263179607,7.705947602888145e-6,1.0593098065321354e-8,0.0010747649179418883,7.45457851834404e-6,1.0728675241616273e-8,0.0010749978735612412,7.207509835919612e-6,1.0862287758949862e-8,0.0010753131883688583,7.0027414856204215e-6,1.0973502950806292e-8,0.0010756904320888402,6.874033979996817e-6,1.1044059873554255e-8,0.0010760947834755237,6.8436529769841505e-6,1.1061787085804026e-8,0.001076481049891446,6.914886396186059e-6,1.1024693263841812e-8,0.0010768018290682909,7.066051634150347e-6,1.0944283327208556e-8,0.0010770200321076698,7.249261634913781e-6,1.0846289489249666e-8,0.001077123420982185,7.39804993243476e-6,1.076656197635394e-8,0.0010771348797026668,7.44585714263904e-6,1.0741042838621376e-8,0.0010771101367558554,7.350779981649652e-6,1.0792371226593277e-8,0.0010771194563272597,7.114340819791003e-6,1.091978472227473e-8,0.0010772207158111727,6.781925749825741e-6,1.1098942285178267e-8,0.001077438751988009,6.423598569950669e-6,1.1292263291924475e-8,0.0010777614606054466,6.107174429654953e-6,1.1463350840217734e-8,0.001078150988925822,5.878278442603043e-6,1.1587643347827043e-8,0.0010785602961386523,5.753858224937523e-6,1.1655892460490189e-8,0.0010789465240847547,5.72623912615062e-6,1.167203738632892e-8,0.0010792781883616845,5.7715171050260465e-6,1.1648769383961856e-8,0.0010795372547668179,5.857715055435001e-6,1.1603202812664468e-8,0.001079718408317149,5.950842140755552e-6,1.1553633958985417e-8,0.0010798274054571314,6.018931123532262e-6,1.1517348515355086e-8,0.0010798793764046966,6.034916081994106e-6,1.150903056702829e-8,0.0010798970957694128,5.979082561969348e-6,1.1539400992860876e-8,0.0010799088782759599,5.841386795654391e-6,1.1613943229511664e-8,0.001079945671266815,5.6234999239785664e-6,1.1731800417280663e-8,0.0010800370563297977,5.339960624404898e-6,1.1885168170973472e-8,0.0010802063626677298,5.017558699714286e-6,1.2059638070394361e-8,0.001080465709873069,4.692281975823613e-6,1.2235836282107038e-8,0.0010808121845919524,4.403722523375394e-6,1.239241282362964e-8,0.0010812263927673289,4.1875776377249006e-6,1.2510056790341688e-8,0.0010816742755761358,4.067606126441703e-6,1.2575830541311822e-8,0.0010821124162932766,4.048764490048608e-6,1.2586910279254428e-8,0.001082496394029135,4.1132067224480435e-6,1.2552812557360103e-8,0.0010827911400719823,4.220728194789922e-6,1.2495218049522599e-8,0.0010829814407256138,4.315035608807498e-6,1.2444602628550136e-8,0.0010830795939978,4.336331558319785e-6,1.2433397469308228e-8,0.0010831263014689158,4.238515418925506e-6,1.2486625405764085e-8,0.0010831815716910997,4.005888907583e-6,1.2612831618416838e-8,0.0010833062871192334,3.6615290203470267e-6,1.2799568273597161e-8,0.0010835411795810717,3.261162454656364e-6,1.3016729071965934e-8,0.0010838933778462134,2.8737930394674124e-6,1.3227010267237029e-8,0.001084337034999438,2.5585169726812227e-6,1.3398407369065678e-8,0.0010848260137734957,2.3486087687672093e-6,1.351281176227918e-8,0.0010853104715353803,2.2479370425633493e-6,1.3567994079646327e-8,0.0010857496852788604,2.2371567972056594e-6,1.3574322546551323e-8,0.0010861181451779231,2.2837281191620208e-6,1.3549388239562281e-8,0.0010864060912470594,2.3509882779473265e-6,1.351309848109019e-8,0.001086617167375567,2.4043382300803017e-6,1.348429676688557e-8,0.0010867653789912383,2.414780175748046e-6,1.3478800918996513e-8,0.0010868723951977914,2.36090336349784e-6,1.3508287044674754e-8,0.0010869652859729975,2.230320299619587e-6,1.357949036950374e-8,0.0010870742527047388,2.0210940838380106e-6,1.3693435401754393e-8,0.0010872297036982135,1.7431263470573831e-6,1.3844706627164613e-8,0.0010874581583647045,1.4188304041524766e-6,1.4021110351396713e-8,0.0010877770309646244,1.0819285734700634e-6,1.420434005833336e-8,0.0010881892473587201,7.732394508393998e-7,1.4372250040797893e-8,0.0010886795450963712,5.330813350595426e-7,1.4502949312721697e-8,0.001089214649730255,3.9140243490344096e-7,1.458013766244398e-8,0.0010897487258969283,3.584072521389756e-7,1.459820749252219e-8,0.0010902335819651038,4.191729634013468e-7,1.4565214418600275e-8,0.0010906310187498445,5.348153076480196e-7,1.4502295396028616e-8,0.0010909236281021046,6.506177348026824e-7,1.443926695100913e-8,0.001091120685014961,7.092800663955221e-7,1.4407391615029013e-8,0.001091257136747916,6.658869235087142e-7,1.4431183604022623e-8,0.0010913854479859381,5.005821622148568e-7,1.4521478794650966e-8,0.0010915618860652314,2.251478759511052e-7,1.467185398741576e-8,0.0010918307189155313,-1.1924299742407577e-7,1.4859864732950039e-8,0.0010922113493534546,-4.734372432057817e-7,1.5053255310459487e-8,0.0010926932935980337,-7.775556028587294e-7,1.5219334684945516e-8,0.0010932410472572044,-9.877102401363634e-7,1.533407805988485e-8,0.0010938063797259453,-1.0859165470122615e-6,1.5387566050399254e-8,0.001094342455259391,-1.080589230442882e-6,1.5384321095468852e-8,0.00109481445675083,-9.995980021090122e-7,1.5339569592932147e-8,0.0010952043212414967,-8.803420527904827e-7,1.5273828324478645e-8,0.0010955103354372215,-7.608506842509845e-7,1.520800473466209e-8,0.0010957438947718288,-6.738297010954895e-7,1.516008890171015e-8,0.0010959255739260278,-6.435882030741187e-7,1.514342886133524e-8,0.0010960816844447629,-6.848008439732961e-7,1.516603611113632e-8,0.001096241543978873,-8.02004725041787e-7,1.5230321629549556e-8,0.0010964350536024304,-9.891361497491146e-7,1.5332873831182345e-8,0.0010966898752015986,-1.2290044827439803e-6,1.5464206803068726e-8,0.0010970275583669783,-1.4932930260580311e-6,1.5608784981685757e-8,0.0010974584822657629,-1.7443109645131954e-6,1.574598051452959e-8,0.0010979764965260918,-1.9399561880694465e-6,1.5852762521604583e-8,0.0010985554895813923,-2.0426623918831098e-6,1.590856103716042e-8,0.0010991510076969397,-2.031063016383569e-6,1.590164521848076e-8,0.0010997091337757634,-1.9102678540224635e-6,1.5834788151340182e-8,0.0011001814643931509,-1.7151290714917107e-6,1.5727115299126148e-8,0.0011005408546707206,-1.5028952094650604e-6,1.5610105905041306e-8,0.001100790948640354,-1.3368393448549428e-6,1.5518581808694086e-8,0.001100965184316589,-1.2672952194125447e-6,1.5480237846173764e-8,0.0011011161176956588,-1.3175209969869768e-6,1.5507843040213407e-8,0.0011012998469212088,-1.4787697248972343e-6,1.5596542078759433e-8,0.001101561065014156,-1.7146998910046917e-6,1.5726308035865734e-8,0.0011019226990827457,-1.9724071175410574e-6,1.586801490545639e-8,0.001102382007116548,-2.196363356079692e-6,1.5991084228148263e-8,0.0011029132667145561,-2.3416096021800094e-6,1.6070722292919825e-8,0.0011034757514399483,-2.38310916619068e-6,1.6093077245681256e-8,0.0011040244786115357,-2.31927776315323e-6,1.6057225467888683e-8,0.0011045205794044041,-2.1694385072843676e-6,1.597381802522786e-8,0.0011049385690624493,-1.966838354498544e-6,1.5861252045493124e-8,0.0011052692443645087,-1.750001842086337e-6,1.5740883086523665e-8,0.0011055186380034719,-1.5550353774155559e-6,1.5632734001830676e-8,0.0011057045369247066,-1.4103695910270938e-6,1.5552549745965977e-8,0.0011058522277989002,-1.3341378137981495e-6,1.551032955262108e-8,0.0011059906217503908,-1.3335025490994153e-6,1.5509962936515426e-8,0.001106149150194748,-1.404950501845874e-6,1.5549420079728942e-8,0.0011063551807779252,-1.5348143523852197e-6,1.5621073311654e-8,0.0011066313631327655,-1.6998081049754247e-6,1.5712016164878937e-8,0.0011069922927926747,-1.8679853774396568e-6,1.580459705808824e-8,0.0011074402507398938,-2.0011637405826746e-6,1.5877740607269027e-8,0.0011079607077455421,-2.060248709035317e-6,1.5909858156164228e-8,0.001108519738968454,-2.0144254988523965e-6,1.588390462537339e-8,0.0011090667951459137,-1.8531436940924132e-6,1.5794016241904865e-8,0.0011095457522609323,-1.5962893152773853E-06,1.5651187561937485e-8,0.0011099131036531966,-1.295286315591519e-6,1.548393416264128e-8,0.0011101558729649911,-1.0201697065466408e-6,1.5331133204623056e-8,0.0011102988958696094,-8.358929741676526e-7,1.5228836499800212e-8,0.001110396160826366,-7.792957175517323e-7,1.519745019538023e-8,0.00111051078357651,-8.4832733122868e-7,1.5235767590110828e-8,0.0011106942753399312,-1.0069042485667557e-6,1.5323711725274e-8,0.00111097368196469,-1.1999692577389667e-6,1.5430718007157876e-8,0.0011113487938456635,-1.370515245006706e-6,1.5525164027079777e-8,0.0011117968919402519,-1.472886234678616e-6,1.5581716379428368e-8,0.00111228126468647,-1.4803580618799743e-6,1.5585522069862342e-8,0.0011127605283525728,-1.38735025143936e-6,1.553345118973782e-8,0.0011131969606502966,-1.207467615593322e-6,1.5433042494833323e-8,0.0011135628384484684,-9.68609089136904e-7,1.5299812786382335e-8,0.0011138441430138264,-7.063766770539463e-7,1.515359787677788e-8,0.0011140413969519087,-4.5716749529745555e-7,1.5014692696968984e-8,0.0011141679771116317,-2.5224292949749117e-7,1.4900524553462284e-8,0.0011142467106409985,-1.1360505719006956e-7,1.4823340179212186e-8,0.0011143057375622243,-5.1947099677121166e-8,1.478906414284595e-8,0.0011143745275428235,-6.641623982905153e-8,1.479718055412551e-8,0.0011144805411490116,-1.4554045014367347e-7,1.4841267716474989e-8,0.0011146465039405943,-2.6868186327244643e-7,1.4909818722617364e-8,0.0011148879464543517,-4.077487512787168e-7,1.4987193531681402e-8,0.0011152106069133069,-5.293572049765862e-7,1.5054810350341645e-8,0.001115607505557431,-5.981354506604627e-7,1.5092967998964315e-8,0.0011160562278251995,-5.82238372920153e-7,1.508390498897239e-8,0.0011165181858738054,-4.617774614729789e-7,1.5016501585294573e-8,0.0011169427756374372,-2.3916486858598275e-7,1.489207589936706e-8,0.001117279123695704,5.281074662320559e-8,1.4728931150574154e-8,0.0011174945353303808,3.5238253651923323e-7,1.4561593636104278e-8,0.0011175918891919794,5.85237341776037e-7,1.4431602483043102e-8,0.001117613973298778,6.922600246158575e-7,1.4371955080154304e-8,0.0011176285284481737,6.540692000960255e-7,1.4393394122909386e-8,0.0011177012518909313,4.973859584028976e-7,1.4480914676359373e-8,0.0011178724639969737,2.807665191832271e-7,1.4601797634793543e-8,0.0011181484319527568,7.064887876481905e-8,1.4718987525011862e-8,0.0011185068668504749,-7.890745011779789e-8,1.4802357637019236e-8,0.0011189091709123736,-1.3646153918415363e-7,1.4834384089423755e-8,0.0011193126105248509,-9.43931094899234e-8,1.48108065335213e-8,0.0011196792366973227,3.5164048593491474e-8,1.473837430297344e-8,0.0011199811858316087,2.26369559642981e-7,1.4631494218090753e-8,0.0011202031869314724,4.4589422366034254e-7,1.4508776239873582e-8,0.00112034310520379,6.586854121746841e-7,1.4389816343386903e-8,0.0011204109385747102,8.330417415667043e-7,1.4292352649188305e-8,0.0011204265234972595,9.446967691452359e-7,1.4229970169917528e-8,0.0011204162785695454,9.796302768584618e-7,1.4210520366177409e-8,0.0011204093914756884,9.354136766252925e-7,1.423536740670385e-8,0.0011204339509095645,8.210357617533893e-7,1.4299488573279187e-8,0.0011205135047749502,6.554492436680685e-7,1.4392288214421408e-8,0.0011206642577800594,4.652528434009131e-7,1.4498888367884619e-8,0.001120892869175372,2.817729973787914e-7,1.4601751044198787e-8,0.0011211947550755549,1.3757495990860276e-7,1.4682621069015419e-8,0.0011215528883894927,6.21872975976025e-8,1.4724918735586556e-8,0.001121937523487324,7.657802320904832e-8,1.471684663627745e-8,0.0011223081121608392,1.862337483495964e-7,1.4655293964103262e-8,0.0011226193191337492,3.7406125879550593e-7,1.4549846746055096e-8,0.001122832579558784,5.965725646991329e-7,1.4424943518651694e-8,0.001122931860338344,7.888398809784377e-7,1.4317073347269448e-8,0.0011229368584202211,8.823540066354003e-7,1.42646972284513e-8,0.0011229030163360236,8.31978931560535e-7,1.4293081372632381e-8,0.0011229027871189272,6.377983868581165e-7,1.4402074372500076e-8,0.0011229961745440554,3.466313844851877e-7,1.4565346045514696e-8,0.0011232080312209413,3.131213495657076e-8,1.4742059226319447e-8,0.0011235241667242122,-2.384517151272013e-7,1.4893183747109764e-8,0.0011239038866639104,-4.1705069829968125e-7,1.4993199888376666e-8,0.0011242978045176068,-4.891837396590307e-7,1.5033552385496457e-8,0.0011246618087164136,-4.650533911979487e-7,1.501996092483476e-8,0.0011249644073865193,-3.712956185955165e-7,1.4967350495564534e-8,0.0011251887847238463,-2.4226609099827207e-7,1.489497804254355e-8,0.0011253319323496448,-1.1342860023329529e-7,1.4822732804632492e-8,0.001125402634959825,-1.6748392335343594e-8,1.476855463336166e-8,0.0011254190551908455,2.2583818610430424e-8,1.4746592428163293e-8,0.001125406006350285,-1.147849811646348e-8,1.4765866874794957e-8,0.0011253918703925659,-1.2428284425453638e-7,1.4829389975213278e-8,0.001125405153669,-3.098575433825358e-7,1.4933811618400424e-8,0.001125470825285484,-5.515007109536961e-7,1.5069747750744837e-8,0.0011256068473051415,-8.237402109522106e-7,1.522287862447306e-8,0.0011258213742378021,-1.0955210324600928e-6,1.5375735433027346e-8,0.001126110953640497,-1.33434576076099e-6,1.551002392607651e-8,0.0011264599688784321,-1.5110754595557068e-6,1.5609325258051984e-8,0.0011268415324472347,-1.6050367155868619e-6,1.5661979950811296e-8,0.0011272200850014037,-1.6091063327225863e-6,1.5663968705012574e-8,0.0011275562307977297,-1.5342861631028003e-6,1.5621508044081852e-8,0.0011278144681279808,-1.4124327608801717e-6,1.5552595027563792e-8,0.001127973697196369,-1.2945868803236955e-6,1.548604925928786e-8,0.0011280382587597413,-1.2418556395565706e-6,1.5456333428887506e-8,0.0011280441049613882,-1.3076713541081708e-6,1.5493515389976944e-8,0.0011280530903307478,-1.5159246352740396e-6,1.5610950547436537e-8,0.001128132778175655,-1.8463668689740967e-6,1.579711977668449e-8,0.0011283296134604944,-2.238778351585612e-6,1.601804452302929e-8,0.0011286507402838491,-2.6162893563312223e-6,1.6230430827785135e-8,0.001129064849116733,-2.914505922934018e-6,1.639803217786027e-8,0.0011295188883964043,-3.1003495271215335e-6,1.650223555792818e-8,0.0011299585096496848,-3.1743954370268017e-6,1.6543390761059785e-8,0.0011303422387863712,-3.1616614223987634e-6,1.6535639899295777e-8,0.0011306468543703053,-3.099226465392222e-6,1.649993957729718e-8,0.0011308665355909385,-3.026115926253836e-6,1.6458343678529448e-8,0.0011310092877528594,-2.97696670198988e-6,1.643041637428008e-8,0.0011310930107738839,-2.9787150579821667e-6,1.643135725219101e-8,0.0011311420979546502,-3.048971357365785e-6,1.6471083224590702e-8,0.0011311844863316548,-3.1951543584245246e-6,1.655374177555831e-8,0.0011312487969415517,-3.4140426711787296e-6,1.667746050617603e-8,0.001131361247585663,-3.6918347099299193e-6,1.683438659836271e-8,0.0011315422288500833,-4.005155407124281e-6,1.701126248263884e-8,0.0011318028686057846,-4.323516118603748e-6,1.719082210152812e-8,0.001132142305142021,-4.613386976593811e-6,1.7354095519871995e-8,0.001132546459390808,-4.843583003603475e-6,1.7483454475893005e-8,0.0011329889427781129,-4.991272754047409e-6,1.7566013688537354e-8,0.0011334344413259357,-5.047541910774497e-6,1.7596784618951905e-8,0.001133844458183822,-5.021292733474158e-6,1.7580889129752105e-8,0.0011341848700335095,-4.94040959890774e-6,1.753421475919338e-8,0.0011344344119443499,-4.8491916969188745e-6,1.748193700907113e-8,0.0011345925814498685,-4.801059066100088e-6,1.745434825021528e-8,0.001134684387300292,-4.846227082445247e-6,1.7479841111046328e-8,0.0011347584805635495,-5.0160858158737145e-6,1.7576061597522453e-8,0.0011348759327808268,-5.309263400214288e-6,1.7742064468409605e-8,0.0011350908173706725,-5.6869034120381485e-6,1.7955706489080888e-8,0.0011354299176144932,-6.082800701089851e-6,1.8179418623203863e-8,0.0011358822190113598,-6.426124898603051e-6,1.8373054177066374e-8,0.0011364043809356825,-6.665757949870108e-6,1.8507648393622844e-8,0.0011369384853650538,-6.7840861137196476e-6,1.8573247563186413e-8,0.0011374316455507916,-6.795823634017219e-6,1.8578280026159067e-8,0.001137848673807987,-6.736604005607285e-6,1.85430965640259e-8,0.001138175543947817,-6.649378408098194e-6,1.8492219634553844e-8,0.0011384164599360274,-6.574091986083006e-6,1.8448433493018965e-8,0.0011385884812031334,-6.5420367269707E-06,1.8429543600599157e-8,0.0011387163515221173,-6.573764105960214e-6,1.844718403120001e-8,0.0011388284833158092,-6.678850501571657e-6,1.8506697577031452e-8,0.0011389539421612653,-6.856289459219892e-6,1.8607380918886297e-8,0.0011391198567281403,-7.094990988364993e-6,1.8742791852569966e-8,0.0011393486909906535,-7.374470404067843e-6,1.8901162544082247e-8,0.001139655105173082,-7.666288253826918e-6,1.9066235687773136e-8,0.0011400426757558419,-7.936983461486883e-6,1.921894205864218e-8,0.0011405013577337874,-8.152936837249098e-6,1.9340168556050783e-8,0.0011410069453844265,-8.286904307477137e-6,1.941447163411268e-8,0.001141523687978373,-8.325052062458535e-6,1.943407977800105e-8,0.0011420104921204704,-8.272482966705914e-6,1.940204081740356e-8,0.0011424298885641681,-8.155032071176124e-6,1.9333238629293002e-8,0.0011427577026877223,-8.01590505046847e-6,1.9252449665323856e-8,0.0011429907616206283,-7.907174957399983e-6,1.9189445751876634e-8,0.0011431501649271265,-7.877608061907913e-6,1.917200273740673e-8,0.0011432784491987938,-7.9594886944176e-6,1.9218374972079383e-8,0.0011434302434748492,-8.157983701078854e-6,1.9331275036921774e-8,0.0011436578055424847,-8.446881947193677e-6,1.949552477305666e-8,0.00114399515501405,-8.773659928063834e-6,1.9681008281834052e-8,0.001144446522983574,-9.073972603149053e-6,1.9850948567032337e-8,0.0011449845240813815,-9.291172843971188e-6,1.997301868872744e-8,0.0011455595354737658,-9.393027652032006e-6,2.0028869806567677e-8,0.0011461161009334714,-9.378716130867975e-6,2.001814630971795e-8,0.0011466089029168024,-9.274461172054308e-6,1.9956008806800238e-8,0.0011470122988015584,-9.121833292035425e-6,1.9866427698242803e-8,0.00114732188508422,-8.96496066277439e-6,1.977481168122164e-8,0.001147550426654242,-8.84115873090527e-6,1.970259092640148e-8,0.0011477216937115396,-8.776250220560751e-6,1.966451506584681e-8,0.0011478647584178116,-8.783503033521037e-6,1.966805944170667e-8,0.0011480097210303582,-8.864451422748417e-6,1.971393023358895e-8,0.0011481847339456337,-9.010282799110149e-6,1.9796897029095008e-8,0.0011484137013095736,-9.203162855983934e-6,1.9906583070119853e-8,0.0011487139621447924,-9.417536219790016e-6,2.0028232082651543e-8,0.0011490935669522466,-9.622008265590576e-6,2.0143797216780358e-8,0.0011495483701545808,-9.782674812070154e-6,2.0233850339937727e-8,0.0011500598968202766,-9.868530899457088e-6,2.0280675342107168e-8,0.001150595576793416,-9.858788234789456e-6,2.027245503525575e-8,0.0011511130407411538,-9.750551556433113e-6,2.0207673116114426e-8,0.0011515690958261268,-9.563815939238883e-6,2.0097983923800655e-8,0.0011519316806153635,-9.340392670730376e-6,1.9967584121287674e-8,0.001152190749497022,-9.135185026245966e-6,1.9848156573524196e-8,0.0011523634382926925,-9.001659265593388e-6,1.9770455193964563e-8,0.0011524907957058544,-8.976351650421527e-6,1.975535707782608e-8,0.0011526268209164589,-9.067935946616826e-6,1.9807599727437817e-8,0.0011528235054923113,-9.25449432683755e-6,1.9914294904382524e-8,0.0011531166414686328,-9.489552149459594e-6,2.0048491573720485e-8,0.0011535164504243166,-9.71476019621844e-6,2.0176519619224113e-8,0.0011540055000518578,-9.875454353321969e-6,2.0266935867828633e-8,0.0011545443526542588,-9.934597905884134e-6,2.029851857027083e-8,0.0011550830429836547,-9.881012223473731e-6,2.026498429883669e-8,0.0011555744937682764,-9.729706251418504e-6,2.0175168201088018e-8,0.0011559854772124829,-9.51504938883692e-6,2.0049071556327196e-8,0.0011563021464909625,-9.280042396553756e-6,1.991163982225793e-8,0.0011565296752859802,-9.065727818539686e-6,1.9786613888511836e-8,0.001156687736425848,-8.903688987058367e-6,1.9692182364519e-8,0.0011568044046975123,-8.8125619957311e-6,1.9638981965480233e-8,0.0011569105458751,-8.797789715304598e-6,1.9629991386652268e-8,0.0011570356151798416,-8.853178776230065e-6,1.9661469660227554e-8,0.0011572048275839113,-8.963029002850191e-6,1.9724213131765286e-8,0.0011574371573823965,-9.104180604326605e-6,1.9804750235027096e-8,0.0011577435098976399,-9.247950130788989e-6,1.9886461799431398e-8,0.0011581246406424353,-9.362476184699034e-6,1.9950934601369646e-8,0.001158568958664678,-9.41631267388031e-6,1.9980033554842147e-8,0.001159051135572797,-9.383982662467644e-6,1.9959107105592105e-8,0.0011595332400694842,-9.253407196201551e-6,1.988127948054991e-8,0.0011599704116754437,-9.033473617199929e-6,1.9751830591591057e-8,0.001160321905079089,-8.757962164306107e-6,1.9590469326886845e-8,0.0011605651381540996,-8.481352968156326e-6,1.9428884611557018e-8,0.0011607066977102414,-8.264780100526713e-6,1.9302555692561575e-8,0.0011607835786356816,-8.156211653841857e-6,1.9239208531028127e-8,0.001160852303938451,-8.173672131833849e-6,1.9249082973678126e-8,0.0011609704050213417,-8.299502401002055e-6,1.9321670102197103e-8,0.0011611786600939425,-8.487524842860316e-6,1.942996472795716e-8,0.00116149085756971,-8.678548440956826e-6,1.9539526753642373e-8,0.0011618930476837161,-8.817263786054158e-6,1.961829467481908e-8,0.0011623502480845786,-8.865197369246996e-6,1.9644073624203352e-8,0.0011628170462849206,-8.807345064885849e-6,1.9608343243756524e-8,0.001163248772606246,-8.652436380407108e-6,1.9516370694754277e-8,0.0011636107636861521,-8.42810745764086e-6,1.9384372461534673e-8,0.0011638841503945102,-8.17290291549061e-6,1.9234838808357553e-8,0.0011640675332915647,-7.927309243105636e-6,1.9091306227406572e-8,0.001164174910574985,-7.725934562782125e-6,1.897381570422459e-8,0.0011642310911780206,-7.592301438636944e-6,1.8895911963434465e-8,0.001164266183153776,-7.536686249750781e-6,1.8863426101585725e-8,0.0011643105098843333,-7.556534996681924e-6,1.8874751833990127e-8,0.0011643907219274397,-7.638508383357229e-6,1.892205030520054e-8,0.0011645272144765674,-7.761166811425134e-6,1.8992807601442906e-8,0.0011647324707863098,-7.897651936164617e-6,1.9071379900299287e-8,0.0011650098094900412,-8.018265814666975e-6,1.914048233352255e-8,0.0011653521888236509,-8.093307790327415e-6,1.9182839583695098e-8,0.001165741133615056,-8.096798948189496e-6,1.9183362843101123e-8,0.0011661465394286383,-8.01169930545659e-6,1.913219846759754e-8,0.0011665289267256526,-7.836536321099879e-6,1.9028592765835697e-8,0.0011668460658409007,-7.591725078170206e-6,1.8884569456476698e-8,0.0011670647742319771,-7.321672629410377e-6,1.872613603007408e-8,0.0011671752536712213,-7.087778965397692e-6,1.8589162929747138e-8,0.0011672007945532352,-6.950506281680236e-6,1.8508875117680157e-8,0.0011671946165852476,-6.946270276537636e-6,1.8506350208028936e-8,0.0011672219724961402,-7.071417197234697e-6,1.8579216055933185e-8,0.0011673358746302342,-7.283275108892446e-6,1.8702356985605753e-8,0.0011675594159570796,-7.517413113909867e-6,1.8838061377010595e-8,0.0011678822015231747,-7.710561368063675e-6,1.8949420655493054e-8,0.0011682689261397071,-7.818135372925264e-6,1.9010538692202126e-8,0.0011686730493583339,-7.821696462300443e-6,1.90108499425854e-8,0.0011690494583318888,-7.727720962976632e-6,1.8954353489254236e-8,0.0011693632444199163,-7.56134032774171e-6,1.885590552632025e-8,0.00116959424227111,-7.358324729191973e-6,1.8736493783482777e-8,0.0011697381322427927,-7.157289319737172e-6,1.861866602390422e-8,0.001169805015940991,-6.993028321525914e-6,1.852264983791331e-8,0.0011698161546601542,-6.891491872816817e-6,1.8463458014440653e-8,0.0011697995747586565,-6.866806023143072e-6,1.8449195474681566e-8,0.001169785345145261,-6.9204124414224666e-6,1.8480593608555368e-8,0.0011698012390084927,-7.0420511084665356e-6,1.8551596753815423e-8,0.0011698692959780039,-7.212115770190638e-6,1.865072612237821e-8,0.001170003535115469,-7.40476340602822e-6,1.876287162320732e-8,0.0011702087001298016,-7.591191261412983e-6,1.887118665962335e-8,0.001170479701385697,-7.742851069545861e-6,1.895896527939579e-8,0.0011708015200401624,-7.834746251544546e-6,1.9011588216858993e-8,0.0011711496211634048,-7.849130822009977e-6,1.9018713426567524e-8,0.0011714913924403504,-7.779910197998646e-6,1.8976869060788222e-8,0.0011717897544849946,-7.637523831636095e-6,1.889230519205385e-8,0.001172010309956273,-7.452738502943907e-6,1.8783182601489195e-8,0.0011721323598993924,-7.275994332800178e-6,1.867913794942048e-8,0.0011721611281580594,-7.168155593634209e-6,1.861581265298405e-8,0.0011721343191450696,-7.1813051484193844e-6,1.862357539268324e-8,0.0011721149049607846,-7.335813716215587e-6,1.87141217167984e-8,0.001172168800567516,-7.607145133330706e-6,1.8872833135365767e-8,0.0011723380208572738,-7.933227173421569e-6,1.9063184028057393e-8,0.0011726252496139771,-8.239481077610759e-6,1.924143891636807e-8,0.0011729975280554965,-8.466260519538257e-6,1.9372719916227837e-8,0.0011734031858778484,-8.584501548552111e-6,1.944016181411194e-8,0.001173790302185874,-8.596454295920204e-6,1.944531693494591e-8,0.0011741190787508823,-8.527161410478187e-6,1.9403109104349883e-8,0.0011743669348481497,-8.413502697600549e-6,1.933534155711618e-8,0.0011745284115409797,-8.294793736602777e-6,1.9265131227668844e-8,0.0011746124079364151,-8.206190261184355e-6,1.9213032276832187e-8,0.0011746385065752375,-8.174556373859033e-6,1.9194649111671876e-8,0.0011746330915234392,-8.216052103381338e-6,1.9219279634408336e-8,0.0011746253880197785,-8.335082109550146e-6,1.9289350289034145e-8,0.0011746435809791025,-8.524542340119898e-6,1.9400586230916127e-8,0.0011747112692470335,-8.767280557710057e-6,1.954286430798587e-8,0.0011748445359639791,-9.03865596643075e-6,1.9701692857538592e-8,0.0011750499632298852,-9.309966660718363e-6,1.9860201817912727e-8,0.001175323799399941,-9.552298843262974e-6,2.0001396821218872e-8,0.00117565222379474,-9.740381416028808e-6,2.0110439466007515e-8,0.0011760125740055314,-9.856258828588306e-6,2.0176834214821782e-8,0.001176375524771259,-9.89270749701017e-6,2.0196458357561633e-8,0.0011767084198622795,-9.856295447680713e-6,2.0173355725141192e-8,0.0011769802534832457,-9.769680052766479e-6,2.0121046365166935e-8,0.001177168799588408,-9.671871258832764e-6,2.0062613323586582e-8,0.0011772694476469777,-9.6141384720008e-6,2.002822704058926e-8,0.0011773031276615976,-9.649130357389883e-6,2.004871269724044e-8,0.001177317927990144,-9.813195811093411e-6,2.0145182911243707e-8,0.0011773784774201084,-1.0107742086366462e-5,2.031816622647421e-8,0.0011775429199502576,-1.0491244705205072e-5,2.054301185498362e-8,0.001177837880102486,-1.0891186429975976e-5,2.077695811502661e-8,0.0011782469508336748,-1.1232228758863288e-5,2.0975685618500445e-8,0.0011787199252995327,-1.1464270048217633e-5,2.1109807093236463e-8,0.001179195117857407,-1.1575096317836384e-5,2.1172327792887724e-8,0.0011796204060343677,-1.1585333083324484e-5,2.117567378298927e-8,0.001179964253721622,-1.153426084540048e-5,2.1143276835969646e-8,0.001180216947487361,-1.1465789942356163e-5,2.1101215758474892e-8,0.0011803864077251783,-1.1418915216628996e-5,2.107252293342305e-8,0.0011804924552570766,-1.1422849945557147e-5,2.1074313204903283e-8,0.0011805616351961057,-1.149534972563153e-5,2.111684828473406e-8,0.0011806231296561194,-1.164260838042896e-5,2.1203547272920038e-8,0.001180705405349917,-1.185983590457733e-5,2.133138289587363e-8,0.0011808332022572984,-1.2132380829244001e-5,2.1491566451183692e-8,0.0011810247593277404,-1.2437538534793616e-5,2.1670609888946692e-8,0.00118128939658047,-1.2747235945817167e-5,2.1851893747692842e-8,0.0011816258296817952,-1.3031688632184382e-5,2.2017816721285344e-8,0.0011820217409164156,-1.3263766786722557e-5,2.215238102483769e-8,0.0011824549343442512,-1.3423476824073942e-5,2.224386173036045e-8,0.0011828960923008392,-1.3501908143475178e-5,2.228715845248425e-8,0.0011833129578829248,-1.3504032616951642e-5,2.2285447254115404e-8,0.0011836756314048944,-1.3449812928952117e-5,2.2250794275112108e-8,0.001183962592413837,-1.3373153848677134e-5,2.2203458812617827e-8,0.0011841669322909438,-1.3318065327970467e-5,2.2169537514422055e-8,0.0011843016926503368,-1.3331175884827947e-5,2.2176482373441217e-8,0.0011844020642103072,-1.3450260247773386e-5,2.2246332098472546e-8,0.001184521202676278,-1.3690428025695983e-5,2.2387640451217336e-8,0.0011847171293863903,-1.4032994909381187e-5,2.2589027933433944e-8,0.001185032463777717,-1.4424743371322873e-5,2.281883562996951e-8,0.0011854755677246913,-1.4792794984495582e-5,2.3033918419938312e-8,0.0011860147396502052,-1.507088024578483e-5,2.319513060443558e-8,0.0011865905179456926,-1.5223319477673633e-5,2.328150001628114e-8,0.0011871389466646689,-1.5253718038456167e-5,2.3295410581307743e-8,0.0011876123061146714,-1.519648813755946e-5,2.3257586969311357e-8,0.0011879885113928858,-1.5099845661934605e-5,2.3196940123018956e-8,0.0011882695341677578,-1.501035144178206e-5,2.31412842396481e-8,0.0011884742356245803,-1.4963788315746421e-5,2.3111852364620775e-8,0.001188630530564791,-1.4982034546106686e-5,2.3121452402727265e-8,0.0011887692807419578,-1.507353292827563e-5,2.3174817880824452e-8,0.0011889202463939105,-1.5235106883747588e-5,2.3269772227890994e-8,0.0011891093972103773,-1.5453904219857056e-5,2.3398442893928934e-8,0.001189356787492648,-1.5709243646093957e-5,2.3548380493865156e-8,0.001189674562434833,-1.597465760311393e-5,2.3703767108688843e-8,0.0011900650705906138,-1.622059546320253e-5,2.3847010207390837e-8,0.0011905194959919482,-1.641817450904896e-5,2.396096721453941e-8,0.0011910177895063875,-1.6543919681829082e-5,2.403177226492937e-8,0.0011915306556030559,-1.6584788766736868e-5,2.4051839818261955e-8,0.001192023898945927,-1.6542298384545826e-5,2.4022324070467803e-8,0.001192464757553144,-1.643440146715635e-5,2.3954211093486313e-8,0.001192829119799411,-1.629404609753833e-5,2.3867395750016865e-8,0.001193108027212104,-1.6164104458207515e-5,2.3787569044241983e-8,0.0011933118430555575,-1.608921071912973e-5,2.3741272731391792e-8,0.0011934707320330146,-1.6105658509481013e-5,2.374985781205688e-8,0.0011936303976635173,-1.623111932778949e-5,2.3823425330801796e-8,0.0011938425904213918,-1.6456797947603263e-5,2.3956291913805633e-8,0.0011941512693824246,-1.6745405678767475e-5,2.4125926378533872e-8,0.0011945777513011316,-1.703806116613979e-5,2.4297131106293858e-8,0.0011951108176325653,-1.7270552184130284e-5,2.4431706269672658e-8,0.0011957078826386161,-1.7394145331375484e-5,2.4500786304503858e-8,0.001196308651953773,-1.7391670563142902e-5,2.4494397478295562e-8,0.0011968553574094527,-1.7280885870127336e-5,2.442346637634852e-8,0.0011973097438809756,-1.7104486121415902e-5,2.4313830319614202e-8,0.0011976600271846305,-1.6913544964189015e-5,2.4196263777647027e-8,0.0011979178287977973,-1.6752823815132273e-5,2.4097605696463648e-8,0.0011981097707620147,-1.6652578579863055e-5,2.4035827004151324e-8,0.0011982686801686477,-1.6626751066110573e-5,2.401899572758425e-8,0.0011984270612510747,-1.6674980003615707e-5,2.4046572026728495e-8,0.0011986131998672476,-1.6785856209140574e-5,2.411144126081378e-8,0.00119884907936858,-1.6939967517406705e-5,2.4201781684558578e-8,0.0011991490988296598,-1.7112385016964997e-5,2.430255743190104e-8,0.0011995189044720176,-1.727490968716899e-5,2.4396846663078468e-8,0.0011999541434850292,-1.73987053704685e-5,2.446740213138539e-8,0.0012004395264967585,-1.7457927525291007e-5,2.4498820966803372E-08,0.0012009491082435547,-1.743451264755266e-5,2.4480422287605266e-8,0.001201448900782843,-1.7323465817622007e-5,2.4409425154034857e-8,0.0012019025457898729,-1.713703206787251e-5,2.429344400128628e-8,0.0012022796375072394,-1.6905527800039264e-5,2.415095110327444e-8,0.001202564674709609,-1.66730256383639e-5,2.4008615527302114e-8,0.0012027634568679232,-1.6487847620334767e-5,2.3895505198766226e-8,0.001202904030611828,-1.6390163394670685e-5,2.3835574955575874e-8,0.0012030311028923925,-1.6400516224166192e-5,2.384078723594285e-8,0.0012031951747230444,-1.6513004713512284e-5,2.390712060734509e-8,0.001203439368777117,-1.6695385826531313e-5,2.4014786720648956e-8,0.0012037875416534632,-1.6896357132806125e-5,2.413273573212916e-8,0.0012042369997383238,-1.7058417430140396e-5,2.422642990299439e-8,0.001204758270153749,-1.7133153462624448e-5,2.42669920335499e-8,0.0012053027296240449,-1.7094557087145528e-5,2.4239131779032624e-8,0.001205816243419089,-1.694576087819249e-5,2.414512189749825e-8,0.001206254208107606,-1.671652593603102e-5,2.4003224447649546e-8,0.0012065924774887938,-1.6452686017868706e-5,2.3841274764580573e-8,0.0012068306855210508,-1.6202252980745935e-5,2.3688257288772364e-8,0.0012069882451567506,-1.6003642610002783e-5,2.3567193058502826e-8,0.0012070962548821874,-1.5879317737007825e-5,2.3491350212189728e-8,0.0012071891126864752,-1.5834987172204415e-5,2.3463848234982794e-8,0.0012072982435586271,-1.5862395994595704e-5,2.3479429419473134E-08,0.0012074484919681056,-1.5943390285158226e-5,2.3526960795175952e-8,0.0012076565349967772,-1.6053727644420263e-5,2.3591735054261115e-8,0.0012079303224518817,-1.6166109640853678e-5,2.3657270713232458e-8,0.0012082687433021958,-1.625265566416613e-5,2.370677465035961e-8,0.0012086611896754904,-1.6287448494366172e-5,2.372466631141001e-8,0.0012090872917999832,-1.6249836702848495e-5,2.3698580523446967e-8,0.0012095176855486077,-1.6128815528154758e-5,2.3622028928013453e-8,0.0012099170613362122,-1.592798579392285e-5,2.349739986274672e-8,0.0012102505659388227,-1.566936060894537e-5,2.3338237567455915e-8,0.0012104933479661164,-1.5393153749585413e-5,2.316906420901978e-8,0.0012106406191476266,-1.5150881099106516e-5,2.302113572545944e-8,0.001210713427762985,-1.4991745019339821e-5,2.2924136337323242e-8,0.0012107557250189674,-1.4946543294335746e-5,2.2896419733099684e-8,0.0012108221716802248,-1.5016161651831003e-5,2.293810304377412e-8,0.0012109612315525406,-1.5170264902251345e-5,2.3030401775421017e-8,0.0012112005956738774,-1.535671009607627e-5,2.3141465559964834e-8,0.0012115402123723076,-1.551722648703216e-5,2.3235958218962858e-8,0.0012119541203185218,-1.5603217342101987e-5,2.32846361790215e-8,0.0012123989690091418,-1.558704649773601e-5,2.32711262155396e-8,0.0012128258188160085,-1.546672637976945e-5,2.3194667025593706e-8,0.0012131919055231588,-1.526397476343263e-5,2.306882035076686e-8,0.001213469672752588,-1.5016981076206275e-5,2.2916988632259907e-8,0.0012136512717100716,-1.4770193242323362e-5,2.2766165374691033e-8,0.0012137479589100495,-1.4563974629347552e-5,2.2640665341646183e-8,0.0012137852603573004,-1.4426773355970368e-5,2.255743926778347e-8,0.0012137959093788662,-1.4371343522844578e-5,2.2523883713028728e-8,0.0012138128365966673,-1.439499826481813e-5,2.2538091856692798e-8,0.0012138638400819995,-1.4482668698853964e-5,2.2590762305896745e-8,0.0012139685086682349,-1.4611158244269921e-5,2.2667775734842887e-8,0.0012141370773553156,-1.4753294457875256e-5,2.2752669276880412e-8,0.0012143704447298367,-1.4881339284913565e-5,2.2828655628043122e-8,0.0012146606157735983,-1.4969696583580246e-5,2.2880242761076628e-8,0.0012149911979015464,-1.499739616837105e-5,2.2894754107216863e-8,0.001215338074413792,-1.495094088433912e-5,2.286409075695815e-8,0.0012156709220629822,-1.4827860365214653e-5,2.278691472150337e-8,0.0012159566967008494,-1.4640607873998432e-5,2.2671006872583375e-8,0.0012161661678526474,-1.4419214392042551e-5,2.253482998176492e-8,0.0012162834218881762,-1.4209794962010202e-5,2.2406545421342624e-8,0.001216315642396274,-1.4065845309811994e-5,2.2318651755283653e-8,0.0012162975273846636,-1.4032046896515793e-5,2.229810801795348e-8,0.001216284646636957,-1.412603160851158e-5,2.2355282871068613e-8,0.0012163354726003424,-1.4328040488737538e-5,2.2477767363016963e-8,0.0012164899159747096,-1.4585949126754397e-5,2.263355123417095e-8,0.001216755574130199,-1.4833892797710722e-5,2.278243853374842e-8,0.0012171078245810246,-1.5014490026863692e-5,2.2889603737556964e-8,0.001217501208749591,-1.5094377647005056e-5,2.2935034657986378e-8,0.0012178847630020077,-1.5068934395509631e-5,2.2916347417685273e-8,0.0012182150285436164,-1.4958137548021152e-5,2.2846155074825506e-8,0.0012184640069405344,-1.4797783644600629e-5,2.2746590779909395e-8,0.0012186220505673322,-1.4629683731770791e-5,2.2643235920746163e-8,0.001218696822913379,-1.449297270290909e-5,2.2559801522444672e-8,0.0012187095811834294,-1.4417539138099393e-5,2.2514186857630122e-8,0.0012186898663968694,-1.4420061297596525e-5,2.2516180023635898e-8,0.0012186696633395672,-1.4502833252156467e-5,2.2566860603567102e-8,0.0012186780735641304,-1.4655108434294776e-5,2.2659490899290508e-8,0.0012187372918174148,-1.4856253456001961e-5,2.2781443114298367e-8,0.001218860273629298,-1.5079824490775369e-5,2.2916635639418696e-8,0.0012190500435946263,-1.5297700051893458e-5,2.3047988343221898e-8,0.001219300200263371,-1.548365519236493e-5,2.3159560794279936e-8,0.0012195960618367548,-1.5616237415079354e-5,2.3238309613797606e-8,0.0012199161265676276,-1.568118550987916e-5,2.3275603178996437e-8,0.0012202338545077081,-1.567373100870673e-5,2.326866879195279e-8,0.0012205201561264112,-1.560100091808706e-5,2.3222067337371707e-8,0.001220747382989795,-1.5484226141098953e-5,2.3148995007320677e-8,0.0012208955835540899,-1.535941411892994e-5,2.3071605072069785e-8,0.0012209607427107806,-1.5274050539459638e-5,2.3018902382756045e-8,0.001220962475274646,-1.5277280997782236e-5,2.3020705792687032e-8,0.0012209458731045407,-1.5403436960660497e-5,2.309762894932575e-8,0.0012209717976255354,-1.565448470536381e-5,2.3250476497938733e-8,0.0012210955463632595,-1.5992317511104423e-5,2.345566341649283e-8,0.0012213435678971353,-1.634934524496698e-5,2.367175263118225e-8,0.0012217022640911984,-1.6653999885394203e-5,2.3855040758167472e-8,0.0012221254162641652,-1.685673242853055e-5,2.397543609100118e-8,0.0012225539172616843,-1.694295513018085e-5,2.4024369111537456e-8,0.0012229355612905532,-1.6930207344080828e-5,2.4013018459709848e-8,0.0012232368258948774,-1.6856088422204816e-5,2.3964815471614588e-8,0.001223445818883135,-1.6764870074623695e-5,2.3907108196114857e-8,0.0012235694616662836,-1.66972195773145e-5,2.3864781052871904e-8,0.0012236282176459417,-1.668400111843338e-5,2.3856473140188308e-8,0.0012236504409797394,-1.6743379709783217e-5,2.3892909894168513e-8,0.0012236671763620997,-1.6880175503808295e-5,2.3976645895061022e-8,0.001223707624433692,-1.708683221483701e-5,2.4102766441136323e-8,0.0012237954317209335,-1.734565340062886e-5,2.426029685357651e-8,0.0012239459921608604,-1.7631973134540477e-5,2.4434117926847972e-8,0.0012241649213519893,-1.791791608308859e-5,2.4607207076905056e-8,0.0012244478183697678,-1.817632574317451e-5,2.476299133590999e-8,0.0012247812244358886,-1.838435464330882e-5,2.4887533086232756e-8,0.0012251444556581857,-1.8526399189167512e-5,2.4971356499031972e-8,0.001225512030680893,-1.8596356874691012e-5,2.5010875116620252e-8,0.0012258566090267735,-1.8599249204608337e-5,2.500940666446154e-8,0.0012261525206215848,-1.8552184327634754e-5,2.4977727871947743e-8,0.0012263801754533244,-1.8484389126531722e-5,2.4934001023126065e-8,0.001226531589440995,-1.8435353897332787e-5,2.4902521731442044e-8,0.0012266163824655456,-1.844942436845583e-5,2.4910327037782435e-8,0.0012266658987470957,-1.8565429063659797e-5,2.498085133256966e-8,0.0012267312754294553,-1.880207278591228e-5,2.5125090674904964e-8,0.0012268713258371598,-1.914430998630717e-5,2.533341535608457e-8,0.001227131022819862,-1.954022969406463e-5,2.557377342250434e-8,0.0012275202373195173,-1.991570456003484e-5,2.5800673545950185e-8,0.0012280066605481112,-2.0202550073462475e-5,2.5972399157529153e-8,0.0012285289260753722,-2.036442274620531e-5,2.6066887113834473e-8,0.0012290215337736447,-2.0405843598096857e-5,2.608730247250189e-8,0.0012294364792536673,-2.0362831684957532e-5,2.605626237353159e-8,0.0012297525480403702,-2.0285001528169813e-5,2.600470001447718e-8,0.001229973287643303,-2.0219675206655426e-5,2.596192790923771e-8,0.00123011945294299,-2.0202577079814657e-5,2.5949829286862887e-8,0.0012302208090147814,-2.0254570927893388e-5,2.598089556577197e-8,0.001230309575850642,-2.0382079862008366e-5,2.6058620701201978e-8,0.0012304158345859968,-2.0579100696291248e-5,2.6178889594627654e-8,0.0012305643517482184,-2.0829746668818747e-5,2.6331638580619262e-8,0.0012307723235892732,-2.1111062515209374e-5,2.6502607204116547e-8,0.0012310478548748765,-2.1396114777007075e-5,2.6675202086625746e-8,0.0012313891899758615,-2.1657391046044656e-5,2.6832534064826254e-8,0.0012317848985939483,-2.187044513583133e-5,2.6959629716658373e-8,0.001232215249623264,-2.2017430944470345e-5,2.7045614719736176e-8,0.0012326547447966258,-2.209001773221379e-5,2.7085542859440893e-8,0.0012330755592392312,-2.2091326924775106e-5,2.70816135899996e-8,0.0012334516279752959,-2.203663011034868e-5,2.7043580150642033e-8,0.001233763101802164,-2.1952544155669515e-5,2.6988170698065287e-8,0.001234000846053606,-2.1874499915341305e-5,2.6937404354593894e-8,0.0012341705639102628,-2.184212653370876e-5,2.691563704449534e-8,0.0012342956223987628,-2.1891979650956894e-5,2.6945050302677308e-8,0.001234416688585595,-2.2047557895417835e-5,2.7039585964648845e-8,0.0012345855888722889,-2.23083766412273e-5,2.719839449139654e-8,0.0012348517249173988,-2.2642708147870215e-5,2.7401545144008608e-8,0.0012352433616983397,-2.2990593392258627e-5,2.7611962377998624e-8,0.0012357521897338616,-2.328103233247334e-5,2.778596961972363e-8,0.0012363319390749912,-2.3458241076732956e-5,2.7889391237730747e-8,0.001236914832205126,-2.3503051358274284e-5,2.7910738893106944e-8,0.0012374372602634584,-2.34370143285074e-5,2.7863779646029196e-8,0.0012378600978094599,-2.3308844078715344e-5,2.7779123129400366e-8,0.001238175025995959,-2.3173834169043024e-5,2.7691345091404345e-8,0.0012383987375117022,-2.3077516654817154e-5,2.7628715793488518e-8,0.0012385621901050622,-2.304804267920002e-5,2.7608434146434345e-8,0.001238700730871274,-2.3095701387628564e-5,2.7636418998067664e-8,0.0012388473917175444,-2.321606101218933e-5,2.7709418024290113e-8,0.0012390291726658905,-2.339397590953754e-5,2.781763697063455e-8,0.001239265187271221,-2.3607198404592336e-5,2.7947049692492793e-8,0.0012395656932513142,-2.3829477290720274e-5,2.808131142382676e-8,0.001239931567574002,-2.4033454791804963e-5,2.8203502070202986e-8,0.001240354197034772,-2.419368952870141e-5,2.8297948187087624e-8,0.0012408160639877112,-2.4289979933212816e-5,2.835226322126063e-8,0.0012412924936616241,-2.431076507997636e-5,2.835947104322042e-8,0.001241754847581157,-2.4255949556786933e-5,2.8319783468064274e-8,0.0012421750027906508,-2.413837942889537e-5,2.8241514856497743e-8,0.0012425305735050856,-2.398330917104594e-5,2.8140695039591662e-8,0.001242810041407821,-2.3825431793646963e-5,2.803911624686781e-8,0.0012430167548026835,-2.3703494765039817e-5,2.796086702784852e-8,0.0012431707595330977,-2.3653019187846447e-5,2.792773776976358e-8,0.0012433075282853305,-2.3697965910599013e-5,2.7954078812129726e-8,0.0012434727173970845,-2.3842679769997022e-5,2.8041949740427052e-8,0.001243712463212426,-2.4066405760676784e-5,2.8177927469785303e-8,0.0012440601035040232,-2.432362427984792e-5,2.8333484399655164e-8,0.0012445228361571915,-2.4553159928907133e-5,2.84706844897476e-8,0.001245074558848186,-2.469598742631698e-5,2.8553156726817562e-8,0.0012456608862963842,-2.4715959349908565e-5,2.8558858281151512e-8,0.001246216708050109,-2.4613291013679496e-5,2.8488399775580813e-8,0.001246688489499405,-2.4423038202625592e-5,2.8364074640010765e-8,0.0012470500759516796,-2.4199802086790886e-5,2.8220269933140577e-8,0.0012473056186578205,-2.3997923243581362e-5,2.8091007067191165e-8,0.0012474816718979766,-2.3856832628854112e-5,2.8000725693752732e-8,0.0012476152297567857,-2.3795467178827526e-5,2.796083255759579e-8,0.0012477434727424471,-2.3813936544781482e-5,2.797087896365848e-8,0.0012478974825907967,-2.3898538079999737e-5,2.802185450423327e-8,0.0012480994715242364,-2.4027063105389873e-5,2.8099607177080368e-8,0.0012483620860405254,-2.4173063448967265e-5,2.8187527217003586e-8,0.0012486885425988454,-2.4309038643380227e-5,2.8268487756534477e-8,0.0012490729604937483,-2.4409048929309893e-5,2.832640747738927e-8,0.0012495008229754566,-2.4451320673572244e-5,2.8347832218140762e-8,0.0012499499393055541,-2.442119484453209e-5,2.8323772418069707e-8,0.0012503925365264328,-2.4314275664468087e-5,2.8251695604431464e-8,0.0012507990005257714,-2.4139030867608762e-5,2.8137171704645568e-8,0.001251143262636996,-2.391768914256767e-5,2.7994415164953935e-8,0.0012514090363835088,-2.368426701735876e-5,2.7844976389814205e-8,0.0012515953110546903,-2.3479107716070564e-5,2.771421375274228e-8,0.0012517191350728285,-2.3340474530020665e-5,2.7625933544735366e-8,0.0012518141482856812,-2.3295030625602135e-5,2.7596407518891168e-8,0.00125192444142756,-2.334975383124914e-5,2.7629401271552236e-8,0.0012520946514939732,-2.348776438369355e-5,2.7713746828686006e-8,0.0012523583631477433,-2.3669877510084097e-5,2.7824516476769492e-8,0.0012527277286170939,-2.38425421336231e-5,2.7928118057615044e-8,0.0012531876409788102,-2.3951178423680048e-5,2.7990642199443437e-8,0.0012536974445180235,-2.395580939174183e-5,2.7987543221912417e-8,0.0012542012794675764,-2.3843814405731823e-5,2.7911488512020674e-8,0.0012546444912580575,-2.3634230998913443e-5,2.7774939914552914e-8,0.0012549898708866338,-2.337098949679818e-5,2.760582318235473e-8,0.0012552269467497428,-2.31078977299701e-5,2.7438033142794907e-8,0.0012553712247767674,-2.2892283909759187e-5,2.730112602560997e-8,0.001255455539610628,-2.2753872111695107e-5,2.7213370434487382e-8,0.0012555187275849952,-2.2701515499694785e-5,2.7179817449245153e-8,0.0012555962675502516,-2.2726235663317327e-5,2.719436714414756e-8,0.0012557148843836085,-2.280713457832666e-5,2.724360162183075e-8,0.001255890687072248,-2.2917285638186973e-5,2.7310518757386415e-8,0.001256129398595488,-2.3028282424195017e-5,2.7377340966423323e-8,0.0012564273842037858,-2.3113398094334926e-5,2.742741470506988e-8,0.001256772748129926,-2.3149894992070267e-5,2.7446594516070987e-8,0.0012571463545275083,-2.3121157899020574e-5,2.7424565261140528e-8,0.0012575231640768645,-2.3019131476612913e-5,2.7356401669610725e-8,0.001257874612111306,-2.284700440575688e-5,2.7244296214391676e-8,0.0012581727000068063,-2.2621361371800596e-5,2.7098925268443296e-8,0.0012583959412701018,-2.2372382207858894e-5,2.6939533510837228e-8,0.0012585362273141267,-2.2140433227805133e-5,2.6791698499354605e-8,0.0012586042852673735,-2.196814660205169e-5,2.6682241581275458e-8,0.0012586306549829782,-2.1889126806689826e-5,2.6632055608261722e-8,0.0012586601311620252,-2.1916855981065547e-5,2.664914718129419e-8,0.0012587403517282045,-2.2038399148444123e-5,2.672480002912566e-8,0.0012589081308858302,-2.2216070066749486e-5,2.6834805998698666e-8,0.001259178401966701,-2.2397001174915816e-5,2.6945651229235044e-8,0.0012595395662738137,-2.2527436600423014e-5,2.7023591961309044e-8,0.0012599565073977735,-2.2567114697326255e-5,2.704368259177285e-8,0.0012603800277351954,-2.249955563699239e-5,2.6996141762203254e-8,0.0012607598300570521,-2.2335587057110256e-5,2.6888416016816608e-8,0.0012610573544834757,-2.2109330675960614e-5,2.674249136516303e-8,0.0012612547690560867,-2.186800615213288e-5,2.6588343449294578e-8,0.0012613575758832708,-2.1658922356915117e-5,2.6455686208838244e-8,0.001261390591051946,-2.151793017938794e-5,2.6366737636690552e-8,0.00126138947197204,-2.146269522919313e-5,2.6332111564846554e-8,0.001261391218294045,-2.1491868003257122e-5,2.635046486548411e-8,0.0012614266428808319,-2.15888902989852e-5,2.641103229929555e-8,0.0012615162216082754,-2.1727952954471072e-5,2.6497431575663864e-8,0.0012616690635331466,-2.187983048108349e-5,2.6591299115901463e-8,0.0012618838439774989,-2.2016383972793845e-5,2.6675035116793972e-8,0.0012621505235054361,-2.2113585277586392e-5,2.6733624171416905e-8,0.0012624521180612978,-2.2153524616584108e-5,2.6755867859438524e-8,0.00126276632102878,-2.2126043067001626e-5,2.6735440962205498e-8,0.0012630672801498218,-2.2030481309721585e-5,2.6672051476437688e-8,0.0012633282001385453,-2.1877576094169603e-5,2.6572675677080794e-8,0.0012635254927225803,-2.1690821374928485e-5,2.6452399559931268e-8,0.0012636447200479173,-2.150581193844573e-5,2.6333924961939377e-8,0.0012636873694712005,-2.1365630790647973e-5,2.62445471842398e-8,0.001263675689203714,-2.1311092535360135e-5,2.6209908895091034e-8,0.001263651583389443,-2.1367352542053175e-5,2.624553285893486e-8,0.0012636669236140193,-2.1532112858698217e-5,2.6349454998586358e-8,0.0012637672086514252,-2.1772261625864342e-5,2.6500247615930587e-8,0.0012639754671761418,-2.2032532614826404e-5,2.666264158225693e-8,0.001264284192241647,-2.2253087100624153e-5,2.679874434506354e-8,0.0012646586664950854,-2.238799657886381e-5,2.687976398338216e-8,0.001265048952007261,-2.2417146448438736e-5,2.68935001124463e-8,0.0012654046375396352,-2.2348637976309602e-5,2.6845743928639548e-8,0.001265687166465729,-2.2213199967963506e-5,2.6756558234120423e-8,0.0012658770847539854,-2.205411237295862e-5,2.6653709859809845e-8,0.0012659757694239995,-2.1916095275190147e-5,2.6565519875628988e-8,0.0012660024992930466,-2.1835733466883678e-5,2.6514812194613012e-8,0.0012659883363219941,-2.183504682483079e-5,2.6514975770749016e-8,0.001265968564043513,-2.1918984668542527e-5,2.656857289282304e-8,0.0012659755016867593,-2.2076758125450218e-5,2.666835322071545e-8,0.0012660331867845541,-2.2286013655878877e-5,2.6799978389807436e-8,0.0012661546447266811,-2.2518299270481508e-5,2.6945459630868268e-8,0.0012663416011667139,-2.2744366594706175e-5,2.708642168120064e-8,0.0012665859156780787,-2.2938374403736194e-5,2.720666230998871e-8,0.0012668718340026004,-2.308069895407578e-5,2.729387607334129e-8,0.0012671783608418628,-2.315961813842999e-5,2.7340731279403066e-8,0.0012674815022603028,-2.3172399530941718e-5,2.734561490457562e-8,0.0012677565540440863,-2.3126206424985553e-5,2.7313258391016998e-8,0.0012679809078356128,-2.3038880813856224e-5,2.7255232108115096e-8,0.0012681379667225815,-2.293909764723427e-5,2.718996925380211e-8,0.001268222410981478,-2.2864607647463806e-5,2.714153350665855e-8,0.0012682458991817589,-2.285674137919671e-5,2.7136033101520892e-8,0.0012682404442877298,-2.294997743206441e-5,2.7194986348181077e-8,0.0012682552261359058,-2.3158135615329883e-5,2.732665258099185e-8,0.0012683438357439264,-2.3463184370203866e-5,2.751908579692521e-8,0.0012685445912806244,-2.381508922712379e-5,2.774017528295886e-8,0.0012688635218484556,-2.4146813037913072e-5,2.794723304902699e-8,0.0012692705636366676,-2.439852622614259e-5,2.8102383947438925e-8,0.0012697114811386142,-2.453808374801821e-5,2.818558432617654e-8,0.0012701278926337827,-2.456798692026666e-5,2.8199025785485304E-08,0.0012704747097447653,-2.451874191640579e-5,2.8162796580241977e-8,0.0012707290511519327,-2.4435369716645258e-5,2.8106093111468987e-8,0.00127089082105009,-2.4363968771578763e-5,2.8058468845464867e-8,0.0012709780445711418,-2.4341966719446985e-5,2.804354865594735e-8,0.0012710200656264432,-2.439279816146933e-5,2.8075722588673664e-8,0.001271050641705294,-2.4524258495752033e-5,2.8159296031538897e-8,0.0012711018882705825,-2.4729497552478398e-5,2.8289339641440367e-8,0.0012711994916664129,-2.4989923105568873e-5,2.8453680377103202e-8,0.0012713595362361608,-2.5279401250563086e-5,2.863560229913506e-8,0.0012715871496310693,-2.5568988582094783e-5,2.8816787886148046e-8,0.0012718768697763392,-2.5831442116825033e-5,2.898007870930307e-8,0.0012722144010838205,-2.6044933071783422e-5,2.911175618979125e-8,0.0012725792455093397,-2.619559555621507e-5,2.9203144635270495e-8,0.001272947626786604,-2.627888618297095e-5,2.9251514544716158e-8,0.0012732953571026233,-2.630006763486035e-5,2.9260441855358742e-8,0.0012736006475878774,-2.6274127894061375e-5,2.9239767557704245e-8,0.0012738470763975945,-2.6225193166156763e-5,2.9205161411702542e-8,0.0012740270157430664,-2.6185124088254545e-5,2.9177104177386633e-8,0.0012741455908807501,-2.6190414429344983e-5,2.9178785414269988e-8,0.001274224316427514,-2.62760887589678e-5,2.9232165679184445e-8,0.0012743020615554482,-2.646586880061536e-5,2.935178899471236e-8,0.001274429803943883,-2.6760187731966526e-5,2.9537333686976303e-8,0.0012746566213436674,-2.712756647179489e-5,2.976831346906732e-8,0.0012750096385508432,-2.7507546288788524e-5,3.0006033761210905e-8,0.0012754781610912526,-2.7829406560484464e-5,3.020548189174035e-8,0.001276013858158292,-2.8039650417442057e-5,3.033279425528792e-8,0.0012765492750488386,-2.812244159011328e-5,3.0378310890776146e-8,0.001277023642649741,-2.810137217333263e-5,3.035772861075833e-8,0.0012774012466509133,-2.802473521408781e-5,3.0302589247883327e-8,0.0012776758745853178,-2.7945890596938154e-5,3.024749497268067e-8,0.0012778647758220772,-2.79085430819153e-5,3.022048134829472e-8,0.001277998800793535,-2.793980262467159e-5,3.0238533240266736e-8,0.0012781132813501053,-2.804931557698271e-5,3.0307171318946226e-8,0.0012782413834105137,-2.8231718287190717e-5,3.042226138414893e-8,0.0012784098972853835,-2.8470294804898002e-5,3.0572571320992245e-8,0.0012786367518833218,-2.8740849073584766e-5,3.074235593251752e-8,0.0012789297433653374,-2.9015619036969142e-5,3.091384476109464e-8,0.0012792863683563302,-2.9267159831319898e-5,3.10696300382083e-8,0.0012796947422641365,-2.9471974501639326e-5,3.119488465856777e-8,0.0012801355484260517,-2.9613619515355336e-5,3.127929159311357e-8,0.0012805848824221722,-2.9684936207415627e-5,3.131847898599492e-8,0.001281017638662968,-2.968910490383866e-5,3.131473845451968e-8,0.0012814109964758992,-2.963950002011583e-5,3.1276957457645865e-8,0.0012817477332364437,-2.9558493616968298e-5,3.1219814796159154e-8,0.0012820192456920046,-2.9475284638605605e-5,3.116227933862801e-8,0.001282228197848576,-2.9422701983244574e-5,3.1125420021043346e-8,0.001282390606699797,-2.943268070189973e-5,3.112941115271035e-8,0.0012825366317504978,-2.9529907636028162e-5,3.118948519163852e-8,0.0012827084194776662,-2.9723676059624966e-5,3.131088059813362e-8,0.0012829528288665348,-2.9999700516418604e-5,3.1483844908667825e-8,0.0012833079130263225,-3.0316201547194518e-5,3.168132285335997e-8,0.0012837859765342673,-3.061020073146328e-5,3.1863018658290956e-8,0.0012843618450062628,-3.081684226297564e-5,3.198765635324121e-8,0.0012849765874220782,-3.089521995994752e-5,3.20294184946202e-8,0.0012855586318208988,-3.084588285428632e-5,3.1989175468429604e-8,0.0012860510837547415,-3.0708540178211655e-5,3.189304549666774e-8,0.001286429391721135,-3.054259065273131e-5,3.1779790208841204e-8,0.0012867022080911398,-3.0404062537684042e-5,3.1685762437681995e-8,0.001286900377279203,-3.0330777585708804e-5,3.163518182633183e-8,0.001287063300987379,-3.0338387143386424e-5,3.163759774986754e-8,0.001287228565364857,-3.042354922701865e-5,3.1690131287687944e-8,0.0012874261434639106,-3.056970632894269e-5,3.1781451277475414e-8,0.0012876761011276928,-3.075264889043229e-5,3.189554315979008e-8,0.001287988197340863,-3.094489886686548e-5,3.201458498978887e-8,0.0012883622633117567,-3.111913753711612e-5,3.2121090216733314e-8,0.0012887890246263095,-3.125116421789353e-5,3.219969606469643e-8,0.0012892514436496775,-3.1322610080414284e-5,3.223881626240157e-8,0.0012897267572810904,-3.132337450102907e-5,3.223217751474067e-8,0.0012901893827250341,-3.125348366035541e-5,3.2180042784654345e-8,0.0012906146194111945,-3.1123848609875844e-5,3.208974051574626e-8,0.0012909826969805158,-3.0955505293186115e-5,3.197517438868874e-8,0.0012912825565626971,-3.0777215881050795e-5,3.185520292845642e-8,0.0012915147687625943,-3.0621540642874033e-5,3.175097395022615e-8,0.001291693035842951,-3.0519716537336427E-05,3.168249183610786e-8,0.0012918438362249742,-3.0495841413462402e-5,3.1664819795655e-8,0.0012920037928547566,-3.056087693364674e-5,3.1704304670211076e-8,0.0012922141715474165,-3.0707282053063105e-5,3.17953364867465e-8,0.001292512034520009,-3.090599709338316e-5,3.1918661500173786e-8,0.0012929187002381516,-3.110850773894603e-5,3.2042880122178096e-8,0.0012934285950733568,-3.1256693423193994e-5,3.213078673276235e-8,0.0012940044453168913,-3.1300498297250774e-5,3.215061328521406e-8,0.001294584877820033,-3.12176444133966e-5,3.20885883560331e-8,0.001295104589766634,-3.102462475607171e-5,3.195596529494129e-8,0.0012955179603695564,-3.077085167751126e-5,3.178521309227125e-8,0.0012958131840410975,-3.0518540566581096e-5,3.1616916955709714e-8,0.0012960105999187787,-3.032026641965267e-5,3.148511085415194e-8,0.0012961495978159076,-3.0205433323736027e-5,3.140845109678617e-8,0.0012962734470908504,-3.0178565979806494e-5,3.1389212768773746e-8,0.0012964186126221632,-3.022527856628844e-5,3.141738252834504e-8,0.0012966099467786687,-3.032037295760454e-5,3.1476126820308665e-8,0.0012968600751613467,-3.043465498738407e-5,3.154631955101938e-8,0.0012971707339509185,-3.0539529403013107e-5,3.160949484610287e-8,0.0012975345391934867,-3.0609886172662965e-5,3.164960498486348e-8,0.0012979366525891216,-3.062613758462698e-5,3.1654217987039235e-8,0.0012983564533401342,-3.057599296156603e-5,3.1615600298714555e-8,0.0012987695840761062,-3.0456167864014533e-5,3.1531828857941956e-8,0.0012991507884455799,-3.027379091331488e-5,3.140775068646107e-8,0.0012994777236449333,-3.004683999448522e-5,3.125530194558217e-8,0.0012997353921117309,-2.9802813505353085e-5,3.1092622133109445e-8,0.0012999202861004046,-2.9575139003558806e-5,3.09416264273142e-8,0.0013000430270444395,-2.93974130243819e-5,3.0824133092212875e-8,0.001300128331498118,-2.9296350396882437e-5,3.075718715872455e-8,0.0013002116679433546,-2.928500804947685e-5,3.074866956412388e-8,0.0013003328193243616,-2.935801434543197e-5,3.0794343521651624e-8,0.001300527308605543,-2.9490231267340253e-5,3.0877225135393917e-8,0.0013008171756119307,-2.9639869058835446e-5,3.0969838317194383e-8,0.0013012031591031939,-2.9756515314625574e-5,3.10395465251122e-8,0.0013016609455879465,-2.9793446563434323e-5,3.105650235031395e-8,0.0013021442562541905,-2.972172931898944e-5,3.100263591424007e-8,0.0013025961177511457,-2.9541337275106654e-5,3.087867894617946e-8,0.0013029660006317406,-2.9283509335878423e-5,3.0705543544897195e-8,0.0013032261586196996,-2.9001308736517474e-5,3.051808034793436e-8,0.0013033793833759004,-2.875164122635431e-5,3.035331118242153e-8,0.0013034547749617115,-2.8577237008618275e-5,3.023868954419752e-8,0.0013034950005774671,-2.8496554952853205e-5,3.018561791167246e-8,0.0013035422626375217,-2.8503927091162528e-5,3.018972942257647e-8,0.0013036286487182313,-2.8576659673191224e-5,3.023572044825167e-8,0.0013037723920898197,-2.8683998777921855e-5,3.0303320007544866e-8,0.0013039784710675347,-2.8794434907111588e-5,3.037204952208462e-8,0.0013042411712836108,-2.8880283437659195e-5,3.042410362765577e-8,0.0013045469059940415,-2.8920083977942182e-5,3.044577741719525e-8,0.0013048765892900785,-2.8899827777303695e-5,3.042817208710491e-8,0.0013052076096280716,-2.8813836177220682e-5,3.0367751697282956e-8,0.0013055158699504063,-2.8665686201342626e-5,3.026699500311816e-8,0.0013057784723598796,-2.8469027833693583e-5,3.0134989400730604e-8,0.0013059774012722158,-2.824758312302742e-5,2.998744624708401e-8,0.0013061039917527009,-2.803329661145913e-5,2.984543622349855e-8,0.0013061631500154798,-2.786174715368294e-5,2.973227959525612e-8,0.0013061755169066931,-2.7764752904717206e-5,2.966860348764004e-8,0.0013061756394885842,-2.7761595595907e-5,2.9666567318660748e-8,0.0013062052931786697,-2.785175086959786e-5,2.972518749832201e-8,0.001306303142538855,-2.801230059159129e-5,2.9828826603746476e-8,0.0013064938194895942,-2.820182285028999e-5,2.9949955265754234e-8,0.001306780086361943,-2.8370168467178228e-5,3.005571106771042e-8,0.0013071407644421912,-2.8471378373462444e-5,3.0116392578181026e-8,0.0013075352201250116,-2.8475996159682643e-5,3.011342304590286e-8,0.001307913334487316,-2.8379292346448963e-5,3.0044539506056616e-8,0.0013082284553436203,-2.820295608258615e-5,2.992467194139616e-8,0.001308449795111905,-2.798934380814309e-5,2.9781980996995586e-8,0.0013085703641908598,-2.7789555942438875e-5,2.9649940584985727e-8,0.0013086075992558702,-2.7649081856834136e-5,2.9557946510256037e-8,0.0013085965713823258,-2.7596068441511594e-5,2.9523765739778143e-8,0.001308578775603071,-2.763613069992761e-5,2.9550353019012925e-8,0.0013085910545795772,-2.7754483402330733e-5,2.9627464816654964e-8,0.0013086582864577261,-2.7923038311927625e-5,2.973644409629548e-8,0.00130879097813508,-2.810881146934206e-5,2.985573633256056e-8,0.0013089866559391336,-2.8280794299983097e-5,2.9965288371083946e-8,0.0013092330853364449,-2.841421177594859e-5,3.004918959647898e-8,0.0013095117218239086,-2.849249915857971e-5,3.00968495932514e-8,0.0013098006051115334,-2.8507901829533638e-5,3.010335322333937e-8,0.0013100766331532816,-2.8461574612671678e-5,3.006956699423517e-8,0.00131031764281404,-2.8363692896845595e-5,3.0002285569679514e-8,0.0013105049028917662,-2.823351948220192e-5,2.991431821194102e-8,0.0013106264457913824,-2.809877946612421e-5,2.9824048280105456e-8,0.001310681133427025,-2.7993271777071674e-5,2.9753766780009736e-8,0.0013106824426351005,-2.795161269268233e-5,2.972610709291234e-8,0.0013106598420135267,-2.8000824017845768e-5,2.975846481850516e-8,0.001310655166280242,-2.8150479328616627e-5,2.9856575254154354e-8,0.0013107127876955784,-2.8385509043680695e-5,3.000993471753322e-8,0.0013108657814568222,-2.866643869990418e-5,3.0192141079751784e-8,0.0013111236756196114,-2.8939129152693387e-5,3.036744088323199e-8,0.0013114677764056418,-2.915104009753794e-5,3.0501486920959236e-8,0.001311856492484787,-2.9267251923133067e-5,3.0571854184595145e-8,0.001312238049311916,-2.9279859822208612e-5,3.057411525864111e-8,0.0013125651169096678,-2.9208198159179714e-5,3.0521802359526976e-8,0.0013128064021552001,-2.909142250826646e-5,3.044129361786551e-8,0.0013129525886068233,-2.897698933927629e-5,3.0364030849243177e-8,0.001313016206816826,-2.890865807546817e-5,3.031854722956662e-8,0.001313026461668143,-2.8916887043806896e-5,3.0324238748257375e-8,0.0013130209243820167,-2.901349026915853e-5,3.0388075426164644e-8,0.0013130364508609068,-2.91912467162573e-5,3.050460897562148e-8,0.0013131016267059507,-2.9427863667728573e-5,3.0658773423636455e-8,0.00131323234339437,-2.9692576163541312e-5,3.0830280966021656e-8,0.0013134309224520154,-2.9953194080713292e-5,3.099817761610996e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_14.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_14.json deleted file mode 100644 index d4e8a6f5..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_14.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":14000,"numberOfSamples":1000,"samples":[0.0013136880538731968,-3.0181825300251084e-5,3.1144455018197914e-8,0.0013139862307697747,-3.0358458604268804e-5,3.125626468859012e-8,0.0013143034381558063,-3.0472498704118995e-5,3.1326857923882795e-8,0.001314616342296335,-3.0522889122674205e-5,3.135568412117831e-8,0.0013149028238326915,-3.051757614543907e-5,3.134810730752583e-8,0.0013151441476950397,-3.0472812693602606e-5,3.1315005489895234e-8,0.001315327245423572,-3.041233669157899e-5,3.127221966442859e-8,0.0013154474985632677,-3.0365940022199845e-5,3.1239522569258994e-8,0.0013155119761371786,-3.0366482616605727e-5,3.123852579233063e-8,0.0013155421786821661,-3.044428590458291e-5,3.1288903751562086e-8,0.0013155741637083083,-3.061859253490029e-5,3.140279579367739e-8,0.0013156532826805987,-3.08878545724263e-5,3.15785553459714e-8,0.0013158221093964287,-3.122350814634265e-5,3.179684474210843e-8,0.0013161043666861684,-3.1573152017452694e-5,3.202287220092828e-8,0.001316492562279381,-3.187552478285449e-5,3.221630534507893e-8,0.0013169475071545026,-3.2081986318948946e-5,3.234541530079332e-8,0.0013174114482328236,-3.217362581767834e-5,3.2398333198900105e-8,0.0013178279759007432,-3.216549962188907e-5,3.238578137269618e-8,0.0013181587209702065,-3.209786877058771e-5,3.233512178519737e-8,0.0013183908584672483,-3.202101456924127e-5,3.2280078366949867e-8,0.0013185355723118594,-3.198087692229784e-5,3.22510415181099e-8,0.0013186210256550192,-3.200948903377424e-5,3.226871171627078e-8,0.001318683516304464,-3.212087078817048e-5,3.2341550899422565e-8,0.0013187592325329092,-3.2311333689063695e-5,3.246626921888799e-8,0.0013188777975085585,-3.256278527721231e-5,3.263027897225073e-8,0.0013190580943835157,-3.28478210560236e-5,3.281520552707126e-8,0.001319306537685271,-3.3135522599053245e-5,3.30007052286256e-8,0.0013196176305973269,-3.339691167788335e-5,3.3167938459672674e-8,0.0013199762931723731,-3.360923943949643e-5,3.330224076991175e-8,0.001320361240591444,-3.3758679883073964e-5,3.339478932604852e-8,0.0013207486407314094,-3.3841371491741154e-5,3.3443266039948134e-8,0.0013211154170834028,-3.3863122696377714e-5,3.345170814905867e-8,0.0013214419486963593,-3.3838325595684376e-5,3.342984862739796e-8,0.0013217143059939618,-3.3788485178276064e-5,3.3392152957732015e-8,0.0013219262892678202,-3.374042925569602e-5,3.3356565064026065e-8,0.0013220814837101608,-3.37239298755937e-5,3.334280561542386e-8,0.0013221952658236343,-3.3768093745891034e-5,3.336987271475884e-8,0.0013222959339579021,-3.389572813238187e-5,3.345230413051685e-8,0.0013224231012386285,-3.411559264521433e-5,3.359518483099222e-8,0.001322620987373266,-3.44143314836092e-5,3.378904291433436e-8,0.0013229254974994617,-3.47525377055976e-5,3.4007455453146385e-8,0.0013233481259613213,-3.507078420316715e-5,3.421110391244622e-8,0.0013238651644779758,-3.5307915680853196e-5,3.435980179531848e-8,0.0013244214578083684,-3.5424988893193025e-5,3.4428250117923195e-8,0.0013249498096669955,-3.5421322382391885e-5,3.441665080515855e-8,0.0013253957656545127,-3.533284530570563e-5,3.4349593606930406e-8,0.0013257341054285624,-3.521518782185486e-5,3.4264687362774436e-8,0.0013259708733802966,-3.5122901891955616e-5,3.4198504380576074e-8,0.0013261345823387194,-3.509485421874728e-5,3.4176685340857736e-8,0.0013262639590043055,-3.514877227589115e-5,3.421034115508173e-8,0.0013263974759466818,-3.5282692478288204e-5,3.42972534612874e-8,0.0013265664975942637,-3.547980948220061e-5,3.4425417060696266e-8,0.00132679174008558,-3.5714173837029465e-5,3.457707337361339e-8,0.0013270820868991236,-3.595606011854193e-5,3.473236215303623e-8,0.0013274350277215283,-3.617667618018595e-5,3.487237396855363e-8,0.0013278383205704806,-3.6352045676457e-5,3.4981566469251094e-8,0.0013282725585155749,-3.6465885830951754e-5,3.504952018493835e-8,0.0013287143399232126,-3.651136884131447e-5,3.507202780552796e-8,0.001329139723468503,-3.649166207236073e-5,3.5051459488144146e-8,0.0013295275370495275,-3.6419245769639135e-5,3.499636143139478e-8,0.0013298621741601225,-3.631427873602864e-5,3.492040029054349e-8,0.0013301357987788196,-3.620233676919433e-5,3.484081953074903e-8,0.0013303500182077856,-3.6111625895291846e-5,3.4776475543805855e-8,0.0013305170072328,-3.606960581815073e-5,3.4745462642883064e-8,0.0013306599051258836,-3.609882203418703e-5,3.4762278550856455e-8,0.0013308118536023116,-3.621166286686944e-5,3.483441417239421e-8,0.0013310123518564367,-3.64043217054422e-5,3.495855682409469e-8,0.0013312994223816388,-3.6651762152887505e-5,3.511751481890027e-8,0.0013316973518746693,-3.6907391838432765e-5,3.528018149292224e-8,0.0013322032136629622,-3.711186898684884e-5,3.540737536800615e-8,0.0013327798493111566,-3.721219549322923e-5,3.546437127639159e-8,0.0013333634934342639,-3.718420813249119e-5,3.543571757580381e-8,0.001333886255019829,-3.70450465515009e-5,3.53335093009964e-8,0.0013343019613464686,-3.6846215847581066e-5,3.5192757078025216e-8,0.001334600413137058,-3.6651362298198277e-5,3.505642654975122e-8,0.0013348042208097524,-3.6512872822752915e-5,3.495958564720737e-8,0.0013349544109773996,-3.6458841744971036e-5,3.49205708479965e-8,0.0013350949386154267,-3.649215529746224e-5,3.49404840851344e-8,0.0013352621732775469,-3.659679818886342e-5,3.500770195061645e-8,0.001335480179315456,-3.6746003522191745e-5,3.510363508802379e-8,0.0013357600358690303,-3.6909212409168185e-5,3.520756323936493e-8,0.0013361011544938224,-3.705705068984642e-5,3.52999605336332e-8,0.00133649332519081,-3.7164741980348925e-5,3.536463540591373e-8,0.0013369190829818159,-3.7214510810799346e-5,3.539015342857483e-8,0.0013373563443612583,-3.719721204638616e-5,3.537079341232845e-8,0.0013377813051418917,-3.711323131523201e-5,3.530711046883947e-8,0.0013381715937814552,-3.697254005026054e-5,3.520601101140213e-8,0.0013385094912165925,-3.6793660324817705e-5,3.5080116340020854e-8,0.0013387847813319696,-3.660147627572446e-5,3.494630461274569e-8,0.0013389968351418553,-3.642410292771776e-5,3.482354178926302e-8,0.0013391557003256266,-3.628905404552198e-5,3.473019081800264e-8,0.0013392819820180002,-3.621893946658274e-5,3.468102678374732e-8,0.0013394052631200586,-3.622700347066692e-5,3.468425016446891e-8,0.0013395607383982387,-3.631286700900988e-5,3.473878515860904e-8,0.0013397835600754613,-3.645915330073845e-5,3.483228424044899e-8,0.0013401005623555385,-3.663056453013473e-5,3.494077405219707e-8,0.0013405202232471124,-3.6777887727110934e-5,3.5031461893425745e-8,0.0013410241084409612,-3.684910446392256e-5,3.5070089714356354e-8,0.0013415655317836142,-3.68068037108336e-5,3.503236888286036e-8,0.0013420805713068025,-3.664539114072159e-5,3.491530557749418e-8,0.0013425100358751974,-3.6397470548011556e-5,3.47413920987351e-8,0.00134282186684753,-3.6122771266874264e-5,3.455114282299104e-8,0.0013430210440999052,-3.5884585735838275e-5,3.438718523558038e-8,0.0013431424937006674,-3.5727401868071906e-5,3.427912167202074e-8,0.00134323392387406,-3.5666709476200635e-5,3.423668442759081e-8,0.0013433393957544833,-3.569188452387105e-5,3.425186840423222e-8,0.0013434898472930886,-3.577592172660759e-5,3.430576805004325e-8,0.0013437006458960645,-3.588557734935549e-5,3.4375631883152696e-8,0.0013439733632099559,-3.598872432152733e-5,3.443987682266083e-8,0.0013442990272794215,-3.6058572131738544e-5,3.448082578605249e-8,0.0013446613049089872,-3.6075754726357985e-5,3.44859220020242e-8,0.001345039248616876,-3.6029368037547205e-5,3.444825503332818e-8,0.0013454098213895693,-3.591751673460431e-5,3.436684759254604e-8,0.0013457504724702282,-3.57474829484819e-5,3.424678910825797e-8,0.0013460419605556845,-3.5535332633184876e-5,3.409904369034362e-8,0.0013462713941414768,-3.530453678562293e-5,3.3939575913952353e-8,0.0013464350440412546,-3.5083247688415916e-5,3.3787496601098456e-8,0.001346540218956281,-3.490026072080504e-5,3.366224387151234e-8,0.0013466055506973335,-3.478008498355249e-5,3.358013732940204e-8,0.001346659241019408,-3.4737853074248655e-5,3.355088149022233e-8,0.0013467351263881956,-3.477505002897689e-5,3.3574748237485566e-8,0.0013468668157807983,-3.487707274585662e-5,3.36411293630354e-8,0.0013470805087412794,-3.501350818296307e-5,3.3728992049500143e-8,0.0013473874871725111,-3.5141989537112516e-5,3.3809694862078156e-8,0.0013477779846166242,-3.5216299066590065e-5,3.385250575241212e-8,0.0013482190793279586,-3.5198369687471605e-5,3.3832555330064887e-8,0.001348659613978359,-3.507162618165665e-5,3.3739577083562544e-8,0.001349043468490627,-3.485031268644354e-5,3.358395470384573e-8,0.001349327999366581,-3.4578485620740276e-5,3.3395893343763146e-8,0.0013494994616960665,-3.431622032059404e-5,3.321604676365601e-8,0.001349576900362316,-3.411840812110945e-5,3.3081186820720924e-8,0.0013496024923671088,-3.4016892922365775e-5,3.3012189592066463e-8,0.0013496246279193777,-3.401415154718749e-5,3.300992090644571e-8,0.0013496829179363164,-3.408870967312186e-5,3.305913434321514e-8,0.0013498005419856707,-3.420638364611618e-5,3.313629142245499e-8,0.001349983766265312,-3.433103577998142e-5,3.3216931742549514e-8,0.001350225503188383,-3.443167213616684e-5,3.328041116125517e-8,0.001350509870791549,-3.44857855079198e-5,3.3311987997451824e-8,0.001350816111848709,-3.44802776149318e-5,3.330325655153641e-8,0.0013511215354534733,-3.44113203272646e-5,3.325193674476666e-8,0.0013514038266242718,-3.428394324938091e-5,3.3161588903372553e-8,0.0013516432294084326,-3.41115562702498e-5,3.3041366067246576e-8,0.0013518249947347244,-3.391515061958602e-5,3.29055587983786e-8,0.0013519421489563276,-3.372159161237384e-5,3.277246672853169e-8,0.0013519981162253448,-3.35604192219653e-5,3.2662172488743894e-8,0.0013520082488663807,-3.345899609113347e-5,3.259313778399188e-8,0.0013519991491952143,-3.343655294053388e-5,3.257806735071459e-8,0.0013520049886915973,-3.349849264305731e-5,3.262004101630264e-8,0.0013520609158930905,-3.36328575909331e-5,3.2710241377374956e-8,0.0013521948074782938,-3.3810651240403614e-5,3.2828394204526694e-8,0.0013524194680195325,-3.399070247049815e-5,3.2946301667474426e-8,0.0013527275548078518,-3.412846985252045e-5,3.3033954284171145e-8,0.0013530910516223313,-3.41870260521444e-5,3.306696170857802e-8,0.0013534662186818406,-3.414758958099839e-5,3.303351712767489e-8,0.0013538036921596796,-3.401650121264336e-5,3.293885919569297e-8,0.0013540617630267778,-3.3825695437600704e-5,3.280532715743045e-8,0.0013542189655621978,-3.3625013396523797e-5,3.2666968653528377e-8,0.0013542809896239987,-3.3467679762926974e-5,3.255963827369867e-8,0.0013542783419837156,-3.3394020433318414e-5,3.251003853738814e-8,0.0013542554119995557,-3.342020697923614e-5,3.252828382153754e-8,0.0013542560140103023,-3.3536391035527796e-5,3.2606892142050424e-8,0.0013543116989025482,-3.371353007933651e-5,3.2725642792952345e-8,0.0013544365308802784,-3.391431273365121e-5,3.285910327271554e-8,0.0013546280975285543,-3.410316353858851e-5,3.2983383466057345e-8,0.0013548720539619643,-3.4252552907384106e-5,3.308026489902493e-8,0.001355147353668992,-3.43454908576762e-5,3.313870075252464e-8,0.0013554305468037433,-3.437553330264171e-5,3.315467676927687e-8,0.0013556988011802253,-3.434572357619407e-5,3.313045281129339e-8,0.0013559320038673691,-3.426735815892247e-5,3.30737806614842e-8,0.0013561145343338845,-3.415887769336406e-5,3.299724375590522e-8,0.0013562372346350193,-3.40446430953795e-5,3.291748056072256e-8,0.001356299729968249,-3.395293821719811e-5,3.285379960496967e-8,0.0013563126464800305,-3.39124616274109e-5,3.2825694374099335e-8,0.0013562986345168043,-3.394695718115785e-5,3.284908231937111e-8,0.0013562906901488832,-3.406854808973949e-5,3.2931730931658255e-8,0.0013563265580224901,-3.4271700357362895e-5,3.3069227097465745e-8,0.0013564394803830895,-3.453081024388408e-5,3.3243512234392763e-8,0.001356647830444362,-3.480395690125668e-5,3.342564568063368e-8,0.0013569477158602284,-3.504296952579012e-5,3.358281757335669e-8,0.0013573120584085639,-3.52068525793514e-5,3.368754392194241e-8,0.001357697050412798,-3.5273779767518736e-5,3.3725762172275216e-8,0.0013580538346326509,-3.524742322405932e-5,3.3700952947215904e-8,0.0013583414729187431,-3.515577457801083e-5,3.3633068996217375e-8,0.0013585373183607017,-3.504326814963739e-5,3.3552899090837633e-8,0.0013586421139425234,-3.4958781479045985e-5,3.3493719387707e-8,0.001358678685937704,-3.494290707046618e-5,3.3482624669021657e-8,0.001358684778336174,-3.501803608967189e-5,3.353396129882613e-8,0.001358702322909947,-3.518405715028354e-5,3.36466993389363e-8,0.0013587666406036992,-3.542061521536396e-5,3.380626499920978e-8,0.0013588989123856205,-3.5694495803273485e-5,3.398974496696862e-8,0.001359103663247866,-3.5969025766868755e-5,3.417229612867719e-8,0.0013593708567535968,-3.621226756590788e-5,3.4332592451649465e-8,0.0013596806793210175,-3.640207539916034e-5,3.4456072169122394e-8,0.0013600088338772479,-3.6527817297702786e-5,3.4535941490019846e-8,0.0013603309085686056,-3.6589745925869715e-5,3.4572666368770736e-8,0.0013606253906847028,-3.659727205627579e-5,3.4572817000381455e-8,0.0013608755966453268,-3.656705235731982e-5,3.45478428901892e-8,0.0013610710755603856,-3.652125748003627e-5,3.4512957394544435e-8,0.0013612090115036409,-3.648585481662091e-5,3.448596151433922e-8,0.0013612958461505,-3.648833256815448e-5,3.448560847301663e-8,0.0013613487825353768,-3.655412453139295e-5,3.452905427534737e-8,0.0013613960977975756,-3.6701245140876124e-5,3.4628141465119906e-8,0.0013614745650237811,-3.693358561190437e-5,3.4784884782548805e-8,0.0013616224205170902,-3.7235042204870165e-5,3.4987633233731027e-8,0.001361868091522445,-3.756832421090297e-5,3.521045772248526e-8,0.001362218255945228,-3.788197415238886e-5,3.541808383563176e-8,0.0013626514699812326,-3.812539193249165e-5,3.557619486093644e-8,0.001363122322234058,-3.8266165560665596e-5,3.566324383611881e-8,0.0013635754647547845,-3.830134386399334e-5,3.5678079037798024e-8,0.0013639630780626708,-3.825738313571894e-5,3.563975015298319e-8,0.001364258080357862,-3.817994201829989e-5,3.5580274568062977e-8,0.0013644589434662312,-3.811922202797349e-5,3.5534332460088205e-8,0.0013645865742663128,-3.81166924124298e-5,3.5530027944857735e-8,0.0013646762446455044,-3.819653354824757e-5,3.558310331044814e-8,0.001364767819829093,-3.8362605590993256e-5,3.569514079478911e-8,0.0013648967631197295,-3.8600238344742254e-5,3.585514627803409e-8,0.0013650874946786213,-3.888148752071901e-5,3.60434300221522e-8,0.0013653499642588421,-3.917227000116867e-5,3.62365942886353e-8,0.00136567964200512,-3.943967176457917e-5,3.6412451385441956e-8,0.0013660603709506384,-3.965784039600382e-5,3.65538578644758e-8,0.0013664688889499187,-3.981147629204727e-5,3.665089579529965e-8,0.0013668796761675812,-3.989679821734419e-5,3.6701401260529234e-8,0.0013672690955396569,-3.992052333462929e-5,3.6710241547116054e-8,0.0013676183253096337,-3.9897716306200194e-5,3.668789735721834e-8,0.0013679151464472477,-3.984932666566189e-5,3.664884493646582e-8,0.0013681550099158162,-3.979985343784534e-5,3.660997364210455e-8,0.0013683418187992174,-3.977508572660584e-5,3.658897704031485e-8,0.0013684886345164064,-3.9799531863791056e-5,3.6602481816290366e-8,0.0013686181140462686,-3.989297417404592e-5,3.6663608773571173e-8,0.0013687618136698219,-4.006569078124706e-5,3.677873040014451e-8,0.0013689567976789784,-4.031268759372785e-5,3.6943686509812775e-8,0.0013692379960220952,-4.0608958982055686e-5,3.714077674900414e-8,0.0013696263976024602,-4.0909688045915914e-5,3.733908018595111e-8,0.001370116858706226,-4.115943735403728e-5,3.7500783826076915e-8,0.0013706730192843547,-4.131030892561659e-5,3.759353716751259e-8,0.0013712357655380756,-4.1341651354543865e-5,3.760387092264407e-8,0.001371743681640421,-4.1269733274189294e-5,3.754378869036469e-8,0.0013721549303818486,-4.114093707006044e-5,3.744600118910848e-8,0.0013724590038156602,-4.1013018078885606e-5,3.7350822712677154e-8,0.0013726746583584263,-4.0935524588789915e-5,3.7292433498253575e-8,0.0013728388253621247,-4.093780361015353e-5,3.7290504667023286e-8,0.0013729936653109317,-4.102619609853645e-5,3.7348411588796894e-8,0.001373176359782013,-4.118762655376452e-5,3.745605098886693e-8,0.0013734130133102524,-4.139607981819826e-5,3.759467361926248e-8,0.0013737161837680623,-4.161950138762874e-5,3.7741869452387925e-8,0.0013740850229568907,-4.182594710895547e-5,3.787581954548767e-8,0.0013745072421834012,-4.198858396882682e-5,3.797857502949695e-8,0.0013749623837124778,-4.208926335925624e-5,3.803827857381001e-8,0.0013754258276343432,-4.2120407717748035e-5,3.8050265155743136e-8,0.001375872892622539,-4.2085198307853355e-5,3.801710263943968e-8,0.001376282469925798,-4.199628974034897e-5,3.7947728565110885e-8,0.0013766397572874227,-4.187345120748918e-5,3.7855899666402347e-8,0.0013769379150291574,-4.1740698791756187e-5,3.775826686919178e-8,0.0013771788132807986,-4.162339046388268e-5,3.76723488673647e-8,0.0013773731537905993,-4.154540420571933e-5,3.7614493141915814e-8,0.0013775401104706387,-4.1526264618012495e-5,3.759779228022895e-8,0.0013777064032593797,-4.157796597586423e-5,3.762987031680914e-8,0.001377904267471179,-4.170125910920436e-5,3.771044184184231e-8,0.0013781672206391812,-4.188175848661827e-5,3.78288749397831e-8,0.00137852256618738,-4.2087548328483725e-5,3.7962807628071696e-8,0.0013789809169083302,-4.2271422389212076e-5,3.807982991820045e-8,0.0013795260580142504,-4.238109909941585e-5,3.8144447194615674e-8,0.0013801120459359865,-4.237742637005507e-5,3.813041208095439e-8,0.0013806741263976,-4.225334424947585e-5,3.8033625865393774e-8,0.0013811520519300435,-4.2041187655938626e-5,3.787713159675286e-8,0.0013815136370865081,-4.180098864064637e-5,3.7703002181980215e-8,0.0013817644462791729,-4.159593522969593e-5,3.755522195444356e-8,0.0013819398040921613,-4.146995772891535e-5,3.7463973571636786e-8,0.0013820873195676013,-4.143814444971667e-5,3.74389528223684e-8,0.0013822508297504756,-4.1489856674521627e-5,3.747173694159376e-8,0.0013824612018183504,-4.159808318168086e-5,3.7542636676095634e-8,0.001382733677333939,-4.172918004101423e-5,3.76277743218216e-8,0.0013830692173663335,-4.185025959459586e-5,3.7704340994960595e-8,0.0013834575067367659,-4.193387127219509e-5,3.7753754368892116e-8,0.00138388030970731,-4.196070426809343e-5,3.776329962305264e-8,0.0013843148322871465,-4.1921028124019695e-5,3.7726878625517075e-8,0.0013847370777409624,-4.181512286564115e-5,3.7645150528966244e-8,0.0013851250900450299,-4.165273271465304e-5,3.752512539985943e-8,0.0013854619058602147,-4.145156074913463e-5,3.737919056711855e-8,0.0013857379458243554,-4.123483834305219e-5,3.722351350041851e-8,0.0013859525067954938,-4.1028195536964666e-5,3.707590164867331e-8,0.001386114186987945,-4.08562465832129e-5,3.6953376917189425e-8,0.0013862402914967716,-4.0739217947163935e-5,3.6869727504020365e-8,0.0013863552819137583,-4.068981038566365e-5,3.683325080139284e-8,0.0013864882812566375,-4.071045407698197e-5,3.684488191793497e-8,0.0013866695093654466,-4.0791084850707254e-5,3.689683217641563e-8,0.0013869252570760705,-4.0907845082072896e-5,3.6971967000828836e-8,0.0013872711358115565,-4.102392437415202e-5,3.7044638632372434e-8,0.0013877044103900269,-4.10944872644231e-5,3.708418444800822e-8,0.0013881982022425643,-4.107730918647336e-5,3.70621554354846e-8,0.0013887024507251455,-4.094823201885367e-5,3.696274535980045e-8,0.0013891560996636264,-4.071545369969397e-5,3.6792453536201996e-8,0.0013895088976246747,-4.042264374578624e-5,3.658214577314118e-8,0.0013897421255975183,-4.013475017712353e-5,3.637717862062872e-8,0.0013898751358086116,-3.99123909946508e-5,3.621955119697095e-8,0.0013899539157585976,-3.97898760399196e-5,3.613256495667892e-8,0.0013900305358917047,-3.976825529054825e-5,3.611605869920365e-8,0.0013901459897183817,-3.982280938552323e-5,3.615187595826213e-8,0.001390322583927315,-3.9916483926864295e-5,3.621354110721034e-8,0.0013905644815372748,-4.00116379826972e-5,3.627465691377648e-8,0.001390862196549241,-4.007719389834769e-5,3.6313891042696686e-8,0.0013911977272878053,-4.009168854677753e-5,3.631692015857626e-8,0.001391548803289706,-4.004388985804637e-5,3.627660019245447e-8,0.0013918921108757572,-3.9932383942914886e-5,3.619246897144912e-8,0.001392205925877442,-3.976474847087717e-5,3.607009012040189e-8,0.001392472481833256,-3.9556371616133894e-5,3.592027726302581e-8,0.0013926801795685095,-3.932876436594814e-5,3.5758025153182566e-8,0.0013928255206943443,-3.910712261197275e-5,3.5600891948591315e-8,0.0013929143574365078,-3.891704325009154e-5,3.546670424830646e-8,0.0013929619662561058,-3.878067864465175e-5,3.5370785800753655e-8,0.0013929916634681091,-3.8712865216251155e-5,3.5323145245009847e-8,0.0013930319212074739,-3.871783709874851e-5,3.532613964822986e-8,0.0013931121650108214,-3.878718027241075e-5,3.537313617747967e-8,0.0013932576761824852,-3.889956926863257e-5,3.544855030305457e-8,0.0013934841205019005,-3.902264562679513e-5,3.5529430896809445e-8,0.0013937923389470475,-3.911747336501126e-5,3.558876680690813e-8,0.0013941645951322254,-3.9146037401005566e-5,3.560072677257016e-8,0.0013945643433518572,-3.908149684330105e-5,3.554760976148454e-8,0.0013949419740809537,-3.8919080012482775e-5,3.54271205202408e-8,0.0013952477277678645,-3.868301987054237e-5,3.525691407233159e-8,0.001395448996586115,-3.842366805801884e-5,3.507242835859129e-8,0.0013955441184541493,-3.8202198743737096e-5,3.491619511363628e-8,0.001395563841894682,-3.806835542580855e-5,3.482237329132881e-8,0.0013955584098649994,-3.804297850225461e-5,3.4804676331452736e-8,0.0013955778157443777,-3.8114400232592614e-5,3.4854056156277526e-8,0.0013956561830292,-3.8248114880291454e-5,3.4945709067619815e-8,0.0013958061096767589,-3.840169374270801e-5,3.504970300817749e-8,0.001396021525706078,-3.853707477095065e-5,3.513962678304474e-8,0.0013962843041433993,-3.8627076516026636e-5,3.5197026880596114e-8,0.0013965707576988314,-3.865699570879773e-5,3.521229439063478e-8,0.0013968563725718281,-3.8623536025609064e-5,3.5183688298750485e-8,0.0013971187911648243,-3.8532907044979155e-5,3.511587978476073e-8,0.001397339741657006,-3.8398963032655006e-5,3.501866053362015e-8,0.0013975065707011172,-3.824149273866268e-5,3.490584928664414e-8,0.0013976137214529206,-3.808437691328442e-5,3.47941124837482e-8,0.0013976641337538325,-3.795316224892923e-5,3.470130668547223e-8,0.0013976701313359334,-3.787171824233571e-5,3.4644083108582145e-8,0.0013976530803277948,-3.785809777299285e-5,3.4634877223998395e-8,0.0013976411745630901,-3.792027581554576e-5,3.467883721971932e-8,0.0013976651171231898,-3.8052873706371765e-5,3.477154552196402e-8,0.001397752138213877,-3.8236151892252456e-5,3.489846164729002e-8,0.0013979195447783234,-3.8438219455829296e-5,3.5036710195449224e-8,0.0013981694399458889,-3.862056128580171e-5,3.515918741519236e-8,0.001398486147697437,-3.874608834560939e-5,3.524031957876636e-8,0.0013988374531938928,-3.878827062153085e-5,3.526239348503685e-8,0.001399180229735303,-3.873936055813441e-5,3.52210743179183e-8,0.0013994701906148062,-3.861521125226919e-5,3.5128449985403174e-8,0.0013996740998213511,-3.845410205611195e-5,3.501191367250836e-8,0.0013997808979702491,-3.830798334251088e-5,3.490787420794603e-8,0.0013998068841861602,-3.822734029112152e-5,3.485117466616385e-8,0.0013997912690781416,-3.824484084870901e-5,3.486381492238321e-8,0.001399782875381604,-3.836511152067367e-5,3.494805808686753e-8,0.0013998239209614296,-3.856545057793629e-5,3.508720829151086e-8,0.0013999383452429608,-3.880618248898522e-5,3.5253069111989446e-8,0.001400128687982977,-3.9044513556967366e-5,3.5415721677933286e-8,0.0014003803140351105,-3.924559928935504e-5,3.555119946742358e-8,0.0014006688652410718,-3.938796884383357e-5,3.564509648433299e-8,0.0014009672459019793,-3.946401158692379e-5,3.569268613464028e-8,0.0014012504631784645,-3.9477773714654874e-5,3.5697219627372335e-8,0.0014014983378744935,-3.9442025791079544e-5,3.566783351875651e-8,0.0014016968485090753,-3.937562123845998e-5,3.561776933093947e-8,0.0014018389311078144,-3.930135009856592e-5,3.556297869454529e-8,0.0014019252611881805,-3.924395351028988e-5,3.552079791655267e-8,0.0014019650674987158,-3.922771502573723e-5,3.550823547292913e-8,0.0014019765254487317,-3.927316184126799e-5,3.5539561321083074e-8,0.0014019859072127623,-3.939286678870541e-5,3.562326047613582e-8,0.0014020245683540645,-3.9587049026522654e-5,3.57589225433063e-8,0.0014021232793080098,-3.984050350448809e-5,3.5935183683834784e-8,0.0014023045619820167,-4.0122876368864325e-5,3.613011664758931e-8,0.001402575188517273,-4.0393711578013267e-5,3.631499515737404e-8,0.0014029218430838034,-4.0611873294491905e-5,3.6461068646827724e-8,0.0014033123169753285,-4.074679499372091e-5,3.654749216388009e-8,0.0014037026283073234,-4.078780138232347e-5,3.6567752091281347e-8,0.0014040481592061073,-4.074819558912667e-5,3.653228462529379e-8,0.0014043154629272954,-4.0662606574106574e-5,3.646629348386904e-8,0.0014044912857379814,-4.057825582912705e-5,3.640333363998543e-8,0.001404586199481951,-4.054249152292174e-5,3.6376420565956944E-08,0.0014046315916832204,-4.059001163717845e-5,3.640913312668297e-8,0.0014046706036646942,-4.073363552405963e-5,3.650939734711049e-8,0.0014047457709805932,-4.096173679938644e-5,3.6668033280187714e-8,0.0014048875975041877,-4.1243138982900314e-5,3.686248986601918e-8,0.0014051079231287907,-4.153727189609017e-5,3.706412048229687e-8,0.0014053996891925462,-4.180543919169627e-5,3.724605723962737e-8,0.0014057418851642401,-4.201928520354164e-5,3.7388982979293707e-8,0.0014061067325829505,-4.216459310863377e-5,3.748357386154352e-8,0.0014064662792454632,-4.2240904034702006e-5,3.75300453375767e-8,0.001406796935332708,-4.225873123662221e-5,3.753610982343233e-8,0.0014070818711074016,-4.223609237701761e-5,3.7514565091294765e-8,0.0014073119283782146,-4.219538055815336e-5,3.748118402098386e-8,0.0014074858454996213,-4.216086923191445e-5,3.7453036902211475e-8,0.0014076103837110468,-4.215657537536124e-5,3.744699428145286e-8,0.001407700482867457,-4.2203893189522455e-5,3.7477990165415446e-8,0.0014077790394113716,-4.231848459825597e-5,3.755673767593618e-8,0.0014078754676845311,-4.250633958081457e-5,3.768691664581742e-8,0.0014080219967517041,-4.275967059593405e-5,3.7862358742113034e-8,0.0014082470158322466,-4.305438268393406e-5,3.8065444478173206e-8,0.0014085662107764442,-4.3351709842482535e-5,3.826846229183665e-8,0.0014089744868300872,-4.360598119993927e-5,3.843922404533621e-8,0.0014094431536157055,-4.377765422595991e-5,3.8550288702544655e-8,0.0014099256069116926,-4.384699363489847e-5,3.8588547143931624e-8,0.001410370621965012,-4.3822017616625005e-5,3.8560684416864574e-8,0.0014107379906385569,-4.373660777036701e-5,3.8491618344667396e-8,0.001411009964557524,-4.363969764258664e-5,3.841657689536917e-8,0.0014111946000197385,-4.3580512043394426e-5,3.8370420063415034e-8,0.0014113211867777273,-4.359545857298468e-5,3.837829828573306e-8,0.0014114306461733982,-4.3700232323209964e-5,3.8450239351540594e-8,0.001411564408632792,-4.388818610139138e-5,3.858035161105931e-8,0.0014117547305501578,-4.4134232812283986e-5,3.874997182226532e-8,0.0014120184750084578,-4.440248212920195e-5,3.8933324817321076e-8,0.0014123552829552618,-4.4655279826922307e-5,3.910396017989396e-8,0.0014127498958597165,-4.4861304314633954e-5,3.924032595412258e-8,0.0014131773611926266,-4.500092974261656e-5,3.932930729967511e-8,0.0014136092759243295,-4.5068124233728125e-5,3.9367328715653395e-8,0.001414019350464863,-4.50693223258045e-5,3.9359414083827914e-8,0.001414387280570928,-4.5020436860496765e-5,3.931705416718012e-8,0.0014147007530842784,-4.4943253683445574e-5,3.925572649703533e-8,0.0014149560140847756,-4.486209219785531e-5,3.919262101512192e-8,0.0014151576551419522,-4.4801074437002196e-5,3.914474595500056e-8,0.001415318136201093,-4.478183557739158e-5,3.912726793698288e-8,0.0014154572003696824,-4.482122856836196e-5,3.9151802563573214e-8,0.0014156009001108517,-4.492859041749618e-5,3.9224425325897754e-8,0.0014157795097893533,-4.5102449376290346e-5,3.93433918158505e-8,0.0014160233109937125,-4.532727500167816e-5,3.94970098303655e-8,0.0014163555567608258,-4.557201265798743e-5,3.96628298780135e-8,0.0014167833913719533,-4.579313198730899e-5,3.980996986060289e-8,0.0014172901012929602,-4.594441145983626e-5,3.990606550755613e-8,0.0014178341748209257,-4.599235373069634e-5,3.9928088314464635e-8,0.0014183591944381855,-4.593096157451421e-5,3.987268351609923e-8,0.0014188124373602864,-4.5787093578951006e-5,3.975984439233655e-8,0.001419163393834719,-4.561185313227637e-5,3.9626636645945325e-8,0.0014194126920989531,-4.5462152420401115e-5,3.951386849890556e-8,0.0014195882504336435,-4.5382171232237414e-5,3.945270542300551e-8,0.0014197329253106763,-4.539256577330823e-5,3.9456983564371725e-8,0.0014198906236090039,-4.548923231726588e-5,3.952257759491028e-8,0.001420095771986858,-4.5648857684138e-5,3.963175850856077e-8,0.0014203677362581296,-4.5837385340540104e-5,3.975959325884974e-8,0.0014207096597213865,-4.601850510949015e-5,3.988016811818957e-8,0.0014211104809135435,-4.616063637726872e-5,3.9971495331700885e-8,0.0014215489510336552,-4.624177480943514e-5,4.001871904464167e-8,0.0014219986351035052,-4.6251956591088596e-5,4.0015574979438314e-8,0.0014224329376801295,-4.619339291718908e-5,3.996426457805398e-8,0.001422829353219783,-4.607871301987465e-5,3.9874120697775513e-8,0.0014231724530763103,-4.592798447099774e-5,3.9759530620922137e-8,0.0014234554326269762,-4.57652124151591e-5,3.9637548056577846e-8,0.0014236803642659415,-4.561496504861187e-5,3.952556952558051e-8,0.0014238575838519927,-4.5499512314608026e-5,3.943929979142778e-8,0.0014240046262760098,-4.543644346492547e-5,3.9390987574810174e-8,0.0014241448474782898,-4.543650107068099e-5,3.938780661528568e-8,0.0014243055769598875,-4.55014025622324e-5,3.943030334635427e-8,0.0014245153230789524,-4.562160361393435e-5,3.951093333991738e-8,0.0014247992679477627,-4.5774516750711624e-5,3.9613026810845106e-8,0.0014251725776000539,-4.592471607435623e-5,3.97111673534239e-8,0.0014256324150758487,-4.6028499832087334e-5,3.9774539919194244e-8,0.0014261519278773278,-4.604466942670059e-5,3.97745103455597e-8,0.0014266816106519023,-4.595018557846401e-5,3.9695557904295956e-8,0.0014271621257017225,-4.575388705227969e-5,3.9544859389287236e-8,0.0014275457311608392,-4.549845458283125e-5,3.935358890200528e-8,0.001427815306107102,-4.524605002091276e-5,3.916657774531871e-8,0.0014279894860666584,-4.505443172790813e-5,3.9025101307670685e-8,0.001428111845943068,-4.4957151971777735e-5,3.895259664595886e-8,0.0014282324457039898,-4.4956997998443266e-5,3.8950037799349965e-8,0.0014283921152246375,-4.5031813061035744e-5,3.9000405529012745e-8,0.001428614503799861,-4.514594302658012e-5,3.907728510090153e-8,0.0014289052039444517,-4.526123102336767e-5,3.915303573565249e-8,0.0014292549887714064,-4.5344780633131716e-5,3.9204408290150735e-8,0.0014296445351593818,-4.537328317671618e-5,3.921546485399938e-8,0.0014300491927835234,-4.533479827914965e-5,3.917854634066426e-8,0.0014304433224275918,-4.522881772940035e-5,3.909403114722347e-8,0.001430804033341362,-4.5065037434135e-5,3.896929881664266e-8,0.001431114134170649,-4.486114602985143e-5,3.8817147411994384e-8,0.001431364173594574,-4.463995090524377e-5,3.8653843304944497e-8,0.001431553477665542,-4.4426110315797016e-5,3.8496905092415785e-8,0.0014316900992935974,-4.4242818950062476e-5,3.8362786478080485e-8,0.0014317897941557708,-4.410886020323244e-5,3.8264727869013804e-8,0.0014318743099349634,-4.403620954390451e-5,3.8210949087253464e-8,0.0014319691565770345,-4.402814004867514e-5,3.8203232744223565e-8,0.0014321008288139233,-4.407781633250867e-5,3.823596615193787e-8,0.0014322933132242908,-4.4167493057523215e-5,3.829575167824442e-8,0.0014325635783059797,-4.426874231918825e-5,3.8361828243839776e-8,0.0014329159984174987,-4.4344806916418694e-5,3.8407962919808685e-8,0.0014333367610415697,-4.435666435111393e-5,3.840682171688473e-8,0.0014337910720800594,-4.4273697098380086e-5,3.833742616530986e-8,0.0014342273731959762,-4.408716016137151e-5,3.819450047412489e-8,0.0014345914434781843,-4.382020957560829e-5,3.79954130449742e-8,0.0014348470970175808,-4.352582193219588e-5,3.7778581483576264e-8,0.0014349925697684392,-4.326902649537983e-5,3.759070188014273e-8,0.0014350613489107376,-4.3101343714786775e-5,3.746837044387351e-8,0.0014351064354383872,-4.304237393549526e-5,3.74248666578265e-8,0.0014351786308693037,-4.3077895175319485e-5,3.744893988723652e-8,0.001435311120145527,-4.3171511316731736e-5,3.751349253798805e-8,0.001435514983638263,-4.3280124103506245e-5,3.7587031889058094e-8,0.0014357827442222175,-4.33657644870084e-5,3.764234602726513e-8,0.0014360950176135047,-4.340168328161423e-5,3.766080981694061e-8,0.0014364268982985113,-4.3373918763642415e-5,3.7633249662091946e-8,0.0014367527843651797,-4.328039694830718e-5,3.755898187846603e-8,0.0014370497401466067,-4.312909776010434e-5,3.7444270646673757e-8,0.0014372999251545048,-4.29358844997081e-5,3.730070931627148e-8,0.0014374923724849156,-4.2722063680720855e-5,3.71435536648068e-8,0.0014376241618117747,-4.251167408721932e-5,3.6989920136254e-8,0.0014377009262072043,-4.2328490779715396e-5,3.6856738666764285e-8,0.0014377364788064743,-4.2192837572660376e-5,3.675846863045126e-8,0.0014377513692969844,-4.2118585485798534e-5,3.6704856042820815e-8,0.001437770451447845,-4.2110786884528316e-5,3.669912913273134e-8,0.0014378196981251372,-4.21642244916051e-5,3.6736925449717485e-8,0.0014379224790505686,-4.226308798281828e-5,3.680616377621557e-8,0.0014380955334853483,-4.238200534606743e-5,3.6888012155040675e-8,0.0014383449114242503,-4.2488670304332985e-5,3.6959034935254815e-8,0.0014386623333420816,-4.254848883471872e-5,3.69946922542799e-8,0.001439023053413255,-4.253172746547254e-5,3.6974437223496824e-8,0.00143938722951177,-4.242284653717159e-5,3.688818009449981e-8,0.001439707137154768,-4.222971419566938e-5,3.674257304428873e-8,0.0014399409659193428,-4.198781671588203e-5,3.656376280190634e-8,0.001440069459918548,-4.1753765044836575e-5,3.6392606119182155e-8,0.001440106597622063,-4.158679104094984e-5,3.6271381464065536e-8,0.0014400959148385573,-4.1525832600832144e-5,3.622739349459521e-8,0.0014400927711180566,-4.15752438414865e-5,3.626283531393904e-8,0.0014401429180055368,-4.170699406909172e-5,3.635659541946491e-8,0.0014402691460889587,-4.1875615871244114e-5,3.6475292110604114e-8,0.0014404700687453444,-4.20353985030447e-5,3.658586574851633e-8,0.0014407270427852904,-4.215187194132588e-5,3.666388371140973e-8,0.001441013130719309,-4.220595818615349e-5,3.6696359973947585e-8,0.0014413003263376396,-4.219308157288958e-5,3.6680826446642095e-8,0.001441564033217401,-4.212012924590863e-5,3.662287749152233e-8,0.0014417853809006085,-4.2002181831792545e-5,3.653368462176073e-8,0.0014419523959797523,-4.185969337729201e-5,3.642799751790315e-8,0.0014420606999227586,-4.171600435622608e-5,3.632248964966348e-8,0.0014421139198980406,-4.159487387718513e-5,3.623411674528073e-8,0.0014421237028206181,-4.151777055500738e-5,3.6178218018737015e-8,0.0014421089934266833,-4.150085444996026e-5,3.6166287820635e-8,0.0014420941576250958,-4.155198804294638e-5,3.620370937664565e-8,0.0014421057972856064,-4.166845338362705e-5,3.628802792965738e-8,0.0014421685219863218,-4.183607922736202e-5,3.6408352528175015e-8,0.0014423002757643633,-4.203032172674412e-5,3.65463031098458e-8,0.0014425080608542666,-4.22195472333642e-5,3.667862994977846e-8,0.001442784991572208,-4.237031728117714e-5,3.6781252110025435e-8,0.0014431095090614871,-4.245409762385614e-5,3.6834180674033206e-8,0.0014434474962299161,-4.245454297942441e-5,3.682664986919906e-8,0.0014437579597159325,-4.237398291446551e-5,3.676149381934002e-8,0.0014440024218877274,-4.2236870836770005e-5,3.665727124065034e-8,0.0014441566692500326,-4.208735480065546e-5,3.654623465415403e-8,0.0014442210777839057,-4.197894413823149e-5,3.646678154580181e-8,0.0014442238639085503,-4.1957657259825583e-5,3.6451395741224957e-8,0.001444213177633174,-4.204514955028633e-5,3.6514704020701185e-8,0.0014442400148779796,-4.2230738483301597e-5,3.664799820937176e-8,0.001444340327612597,-4.2477002171248194e-5,3.6823531208232587E-08,0.0014445252831045401,-4.273521305190709e-5,3.700583739358809e-8,0.001444782633063003,-4.296167146369278e-5,3.716358146341754e-8,0.0014450854085491184,-4.312785702347721e-5,3.727679374827056e-8,0.001445401951167018,-4.322288651739154e-5,3.733842340885731e-8,0.001445703365975638,-4.3250813436262515e-5,3.735212787958807e-8,0.0014459674945798882,-4.32260760357198e-5,3.73288004390637e-8,0.001446180300220262,-4.316923443732345e-5,3.728344873718978e-8,0.0014463359582635035,-4.310370309668452e-5,3.723292189167686e-8,0.0014464365687389773,-4.305328850624032e-5,3.719426687269874e-8,0.0014464918465855834,-4.304002473972689e-5,3.718325365119318e-8,0.0014465186728166825,-4.308181819575483e-5,3.721266618215463e-8,0.0014465400355141305,-4.3189687170519945e-5,3.7290221487352145e-8,0.0014465827531187007,-4.336489798552785e-5,3.741640893771544e-8,0.0014466736056468219,-4.3596841039752464e-5,3.758294229173246e-8,0.0014468340922974643,-4.386279199894946e-5,3.77726972029659e-8,0.0014470748301542683,-4.413057535440872e-5,3.7961848327240886e-8,0.0014473912922101449,-4.4364408720834884e-5,3.812432810558878e-8,0.0014477626657607462,-4.453297875666711e-5,3.8237820661230854e-8,0.001448154854433801,-4.461771816489685e-5,3.828974037644961e-8,0.0014485274030723117,-4.461890202134063e-5,3.8281447589952853e-8,0.0014488429638407447,-4.455758179245559e-5,3.822931479912126e-8,0.001449077126957026,-4.447225398864734e-5,3.816195570741389e-8,0.001449226023125882,-4.441032020245069e-5,3.8113794316332475e-8,0.0014493090755652274,-4.441579020404974e-5,3.8116125833806295e-8,0.001449364947092221,-4.451633994090186e-5,3.818794133287042e-8,0.0014494407057380814,-4.471426477041007e-5,3.832972073058778e-8,0.0014495774144823556,-4.498555350055323e-5,3.8523117853081915e-8,0.0014497978450341655,-4.5288121537755064e-5,3.873716648698755e-8,0.001450101396289851,-4.557563857325436e-5,3.89383696430426e-8,0.0014504674700356046,-4.581077178440381e-5,3.9100206897818924e-8,0.001450864329811925,-4.59729347684755e-5,3.920855010190983e-8,0.001451258767715561,-4.605934108050844e-5,3.92621859121156e-8,0.001451623153623208,-4.608136827590191e-5,3.926997648012008e-8,0.0014519388956488832,-4.605924560935e-5,3.9246910208725725e-8,0.0014521971379447417,-4.6017229535460886e-5,3.9210629613232204e-8,0.0014523980389310705,-4.5980057149587095e-5,3.917896492879653e-8,0.0014525496603379358,-4.597051953376308e-5,3.9168276920308264e-8,0.0014526669574361673,-4.600759430739576e-5,3.9192135619664394e-8,0.0014527708281076104,-4.610453020282936e-5,3.9259884840940946e-8,0.0014528867245701964,-4.626654176388048e-5,3.9374895639106777e-8,0.0014530421048613528,-4.648831416903428e-5,3.9532731387203335e-8,0.0014532621468013511,-4.6752190201937326e-5,3.971990995005398e-8,0.0014535637916342824,-4.7028515568426274e-5,3.9914326393312656e-8,0.0014539493947660874,-4.727971460801391e-5,4.008841173852169e-8,0.0014544025921314587,-4.7468597955633217e-5,4.021531201044032e-8,0.0014548892922685616,-4.7569142347220584e-5,4.027675511472258e-8,0.0014553650558184153,-4.7575810436338764e-5,4.026972977663235e-8,0.0014557870851216873,-4.750717265528638e-5,4.020889782847651e-8,0.0014561265502366723,-4.7401772022354576e-5,4.012327246018735e-8,0.0014563767220609832,-4.730757137609055e-5,4.004821937536077e-8,0.00145655435776092,-4.726880621379515e-5,4.001569186801683e-8,0.001456694463586125,-4.73144514864003e-5,4.004587627083997e-8,0.0014568404770532691,-4.7451327393656046e-5,4.0142460997834714e-8,0.0014570327641523222,-4.7663290283813975e-5,4.029246947753112e-8,0.001457298519145466,-4.7916441311999795e-5,4.047043105356473e-8,0.0014576457793189451,-4.816871716330359e-5,4.064555627563837e-8,0.0014580630692166065,-4.8380870254886153e-5,4.07896946312839e-8,0.0014585242916217804,-4.85254475628263e-5,4.0883660976549706e-8,0.0014589966823086494,-4.859135992178545e-5,4.092028278391199e-8,0.0014594488895383127,-4.8583561201735886e-5,4.0903922552317477e-8,0.0014598568660654338,-4.851917902858856e-5,4.084752107398645e-8,0.001460206718017994,-4.8422238333548e-5,4.0768741953613706e-8,0.0014604949812930131,-4.831876578154884e-5,4.068648768877478e-8,0.0014607274013576004,-4.823314160900414e-5,4.0618350180221016e-8,0.0014609172150457537,-4.8185712318530414e-5,4.057893429465176e-8,0.001461083502746424,-4.8191179258434106E-05,4.0578670798416085e-8,0.001461249671904525,-4.82571706133708e-5,4.0622715345642995e-8,0.001461441693727446,-4.838261929000545e-5,4.07097296081658e-8,0.0014616854233344243,-4.8556014057686534e-5,4.083066061163576e-8,0.0014620023267894015,-4.8754249269082786e-5,4.0968058990523775e-8,0.0014624034953483796,-4.894358809285292e-5,4.109698020827211e-8,0.0014628831941533296,-4.908464338861261e-5,4.118875936509696e-8,0.0014634150433660768,-4.914226299762998e-5,4.121824393937142e-8,0.0014639548020531532,-4.9098224861191336e-5,4.117296927439143e-8,0.001464451637979818,-4.8961091183785824e-5,4.106020733296679e-8,0.0014648646915946838,-4.8766820370606e-5,4.090722801199529e-8,0.0014651772883869003,-4.8568009313809076e-5,4.075319349404685e-8,0.0014654017214941388,-4.8416426777365386e-5,4.063612262558724e-8,0.0014655731149098806,-4.834715390556542e-5,4.05811408271586e-8,0.0014657366598345033,-4.8370472978448067e-5,4.0594648027202523e-8,0.0014659342958094506,-4.847253437725393e-5,4.066516335293664e-8,0.0014661950114605521,-4.862215666828612e-5,4.076876008564538e-8,0.0014665301910791108,-4.8780249807602064e-5,4.0876316291687736e-8,0.0014669336173157724,-4.8909088442915184e-5,4.096041061837196e-8,0.0014673849869394323,-4.89797010783182e-5,4.10005813588427e-8,0.0014678556191269404,-4.8976435201010984e-5,4.0986359543432826e-8,0.0014683149714162325,-4.889830880085964e-5,4.091793502517985e-8,0.0014687365529222206,-4.875735290426732e-5,4.080472681276175e-8,0.0014691021142846357,-4.857481423921316e-5,4.0662543710692137e-8,0.0014694036337962362,-4.8376450354823765e-5,4.0510213167388694e-8,0.0014696432745798936,-4.8188046898087444e-5,4.0366429937764576e-8,0.0014698319277800106,-4.803190530328035e-5,4.0247286006004545e-8,0.0014699871102827962,-4.7924526915939426e-5,4.0164595796703556e-8,0.0014701307848855516,-4.787522027490336e-5,4.012482396092963e-8,0.0014702872622128149,-4.788517195205734e-5,4.012834089633514e-8,0.0014704809975428358,-4.794666693736669e-5,4.0168855709075365e-8,0.0014707338344027386,-4.804244009905834e-5,4.0233062784634995e-8,0.0014710611213139102,-4.814566107532364e-5,4.030084085232558e-8,0.0014714665413726273,-4.822181569590968e-5,4.034683134470572e-8,0.001471936732554558,-4.823419676772928e-5,4.0344537351810816e-8,0.0014724385787785134,-4.815393883152968e-5,4.02735824939934e-8,0.0014729232921461939,-4.7972708991935915e-5,4.012881131104992e-8,0.001473339733380658,-4.771194684085152e-5,3.99268721108642e-8,0.0014736534482333627,-4.7420811459529796e-5,3.97045678271898e-8,0.0014738614631978186,-4.716016424666695e-5,3.9506949528936975e-8,0.0014739933492919856,-4.697982067329245e-5,3.937043540172194e-8,0.0014740979744279096,-4.690167112469379e-5,3.931032980142313e-8,0.0014742246024554207,-4.691644256644111e-5,3.9318604552850936e-8,0.0014744082651071803,-4.69922299640802e-5,3.9370563974310175e-8,0.0014746637140043946,-4.708756851895923e-5,3.943489870131204e-8,0.0014749866046875014,-4.7162958123676244e-5,3.948243157993727e-8,0.001475358543065385,-4.71883294842356e-5,3.949159654624633e-8,0.001475753210166725,-4.714652817698946e-5,3.945074236392933e-8,0.001476142078096254,-4.7033888847950614e-5,3.9358189832320374e-8,0.0014764992123982724,-4.685887934392134e-5,3.9220928510260014e-8,0.0014768049713061416,-4.663938791887539e-5,3.905248086942313e-8,0.001477048391317066,-4.639911917690382e-5,3.8870289051615004e-8,0.0014772281442441146,-4.61636413222774e-5,3.86929540003015e-8,0.0014773521218631534,-4.595660324837137e-5,3.8537604231317574e-8,0.0014774358574483667,-4.579659133441228e-5,3.841765492707048e-8,0.0014775001956065402,-4.569496823083304e-5,3.8341186816552856e-8,0.0014775686820781154,-4.565470129067433e-5,3.830999686167372e-8,0.0014776649243166784,-4.566994456347111e-5,3.8319233095593914e-8,0.0014778099359220231,-4.5726192560117234e-5,3.83575570353092e-8,0.0014780193244124584,-4.580097117160524e-5,3.840782891730723e-8,0.0014783000450939625,-4.5865328797617776e-5,3.8448445201550915e-8,0.0014786467079729625,-4.588696439857752e-5,3.845582251437362e-8,0.0014790384080720245,-4.583611242343526e-5,3.840873944588172e-8,0.0014794383527260398,-4.56945594107753e-5,3.82947864626867e-8,0.001479799398450005,-4.5465999161076066e-5,3.811769435150879e-8,0.0014800774121277783,-4.518250806512075e-5,3.790185132520664e-8,0.0014802492942168032,-4.489995809258601e-5,3.768879845012064e-8,0.0014803258879004637,-4.467961171000656e-5,3.7523621216932424e-8,0.0014803496588216847,-4.456364916372832e-5,3.7436882425543227E-08,0.0014803767789849922,-4.455914717389837e-5,3.743285124826617e-8,0.00148045471663273,-4.463944669785187e-5,3.749072374826842e-8,0.0014806079903739232,-4.4759080332929866e-5,3.757599995374444e-8,0.0014808363575325631,-4.4871298219932226e-5,3.7653765328709984e-8,0.0014811213748755097,-4.49400791113898e-5,3.7697698950566665e-8,0.0014814353063795221,-4.494494148911797e-5,3.769349125262831e-8,0.0014817486607833878,-4.488064489949951e-5,3.7638296039217246e-8,0.0014820352591590176,-4.475444899156155e-5,3.75383511170801e-8,0.001482275222988769,-4.458271568201399e-5,3.740624045556785e-8,0.0014824566343186552,-4.438752806725547e-5,3.7258364186440963e-8,0.0014825762933425046,-4.41933973514123e-5,3.711263205430016e-8,0.0014826396781233982,-4.402407385189993e-5,3.698628868785702e-8,0.0014826601038704105,-4.3899537486014864e-5,3.689381745950238e-8,0.0014826570290835308,-4.3833355408042506e-5,3.684500249109746e-8,0.0014826535665252642,-4.383076384824262e-5,3.684342893133268e-8,0.0014826734964349505,-4.388776027353641e-5,3.688571137475423e-8,0.0014827381250709867,-4.3991250197185465e-5,3.696157870415823e-8,0.0014828632277558774,-4.4120225732295084e-5,3.7054853705114773e-8,0.0014830562790585913,-4.424796254416029e-5,3.7145299091021524e-8,0.001483314114902658,-4.4345226853738956e-5,3.721123064884487e-8,0.0014836212427355765,-4.438471351759688e-5,3.723292906691934e-8,0.0014839495880320053,-4.434704884177869e-5,3.719700534277648e-8,0.0014842612053440878,-4.4227969750309367e-5,3.7101437221589655e-8,0.001484515578411819,-4.4044706083483356e-5,3.6959930289161086e-8,0.0014846818321571568,-4.383767436946015e-5,3.6802887599284104e-8,0.001484752665298912,-4.366282494601175e-5,3.6671649941767425e-8,0.0014847523079773632,-4.357345179251354e-5,3.6605110282143873e-8,0.0014847306685902028,-4.3598461730291396e-5,3.662379044416523e-8,0.0014847439416985908,-4.372996532663204e-5,3.672084767057359e-8,0.001484832455576805,-4.392834159757466e-5,3.6866053246575335e-8,0.0014850084524969315,-4.414052139172515e-5,3.701958292803764e-8,0.0014852579225742377,-4.4319394962506785e-5,3.7146574635816525e-8,0.00148555111690797,-4.443521318072178e-5,3.7225576915926685e-8,0.0014858540251273446,-4.447773434048518e-5,3.724992857383376e-8,0.0014861364543161625,-4.445270363925244e-5,3.722482225495067e-8,0.0014863760913723298,-4.437656318307988e-5,3.716309655277369e-8,0.0014865597532513933,-4.427164451826376e-5,3.708154822513582e-8,0.0014866832683675857,-4.4162460074345484e-5,3.699824191460888e-8,0.0014867508559287582,-4.407282323694022e-5,3.693054466535894e-8,0.0014867742340000237,-4.402339782503651e-5,3.68934712540527e-8,0.0014867713714220555,-4.402943420367354e-5,3.689807422058526e-8,0.0014867646564762282,-4.409867285281513e-5,3.6949844467746125e-8,0.0014867782740302412,-4.422973621937711e-5,3.7047415402730984e-8,0.0014868348754921309,-4.441152508594255e-5,3.718204520461165e-8,0.0014869519465962582,-4.462400182095811e-5,3.733824048865543e-8,0.0014871384186216602,-4.484053098879151e-5,3.749566462993671e-8,0.0014873921480441546,-4.5031733174503954e-5,3.7632239067973675e-8,0.0014876988747097991,-4.517047600970056e-5,3.772804673560034e-8,0.0014880330851069787,-4.5237407062414714e-5,3.776948065811721e-8,0.0014883611336936045,-4.522638867386191e-5,3.7753106366925946e-8,0.0014886470419661934,-4.5148829423299135e-5,3.768853679617695e-8,0.0014888610099375744,-4.503511107630251e-5,3.75991142701746e-8,0.0014889893734640611,-4.493078727593386e-5,3.7518833390943256e-8,0.0014890426802024238,-4.4885939658503095e-5,3.74844077895564e-8,0.0014890568559620368,-4.493900359979849e-5,3.752344755667185e-8,0.0014890836459080803,-4.5101175184416406e-5,3.7643181361237684e-8,0.001489172305795643,-4.535029512050693e-5,3.7826206234394064e-8,0.0014893513815948645,-4.5639131365739326e-5,3.803685162170241e-8,0.0014896203853677792,-4.591379586939746e-5,3.8234980089391865e-8,0.0014899543663838013,-4.613185728141613e-5,3.8389462478218916e-8,0.0014903162297077394,-4.6271946349084726e-5,3.848520377485263e-8,0.0014906691385107214,-4.6333741604474694e-5,3.852289537208366e-8,0.0014909844428688587,-4.6332267253878814e-5,3.851449641139075e-8,0.0014912446994979787,-4.629096295265064e-5,3.8477884251820716e-8,0.001491443475023993,-4.623604922293549e-5,3.843262815520471e-8,0.0014915838036451312,-4.61927449105687e-5,3.8397284898482245e-8,0.0014916764513131834,-4.618284796155863e-5,3.838776175182558e-8,0.0014917383357409837,-4.622298504810592e-5,3.8416126988273096e-8,0.0014917909428913134,-4.632303584535767e-5,3.848944739748476e-8,0.0014918583550758398,-4.648458412369112e-5,3.860856466449232e-8,0.0014919645095770773,-4.669969166698596e-5,3.8767106301308565e-8,0.001492129594339425,-4.695065290037247e-5,3.895130296913219e-8,0.0014923659795207224,-4.721144655663761e-5,3.914118664687933e-8,0.0014926745732702724,-4.745133715731877e-5,3.931347861780057e-8,0.0014930428020581202,-4.764050267803905e-5,3.944599080200351e-8,0.0014934453287540244,-4.77567381989998e-5,3.952272977792478e-8,0.0014938479976421455,-4.7791615726440825e-5,3.9538419803086526e-8,0.0014942145959709434,-4.775437268653611e-5,3.950114664854367e-8,0.0014945152548361581,-4.7672147717775885e-5,3.943216537025932e-8,0.0014947347496844735,-4.758571958330954e-5,3.936237614997539e-8,0.0014948784839529095,-4.754071729882442e-5,3.9325587712150906e-8,0.001494973688060228,-4.7575580700830986e-5,3.934960606065222e-8,0.001495063893699758,-4.7709339668887554e-5,3.9447410821275483e-8,0.0014951967819727924,-4.793386974666786e-5,3.961177012530231e-8,0.0014954089548056488,-4.82150113356529e-5,3.9816407071216556e-8,0.001495713972368483,-4.8503439552528306e-5,4.0024278257678855e-8,0.0014960992299929698,-4.875088216767253e-5,4.0199671339311314e-8,0.0014965325627533485,-4.892426755697233e-5,4.031863181757441e-8,0.0014969742965597005,-4.9012244353112056e-5,4.037361715514292e-8,0.0014973887060458133,-4.90234527916337e-5,4.037196030438772e-8,0.0014977509975768778,-4.897987925534544e-5,4.033069659995429e-8,0.0014980493699429142,-4.8909370842569586e-5,4.0270872530960104e-8,0.0014982838272042372,-4.8839785143966184e-5,4.0213214367086265e-8,0.0014984636893112296,-4.879533379597899e-5,4.017552829673121e-8,0.0014986050564438516,-4.879459745805125e-5,4.0171351190536136e-8,0.0014987286878216618,-4.884940264365551e-5,4.020917276631506e-8,0.0014988581486848397,-4.8963892845157507e-5,4.029171690125393e-8,0.0014990177337836207,-4.9133541633318104e-5,4.0415144161886566e-8,0.0014992296650089489,-4.934439725353427e-5,4.056846910653133e-8,0.0014995103608385159,-4.957328780427341e-5,4.073379081419653e-8,0.0014998661313054954,-4.978992849651283e-5,4.0888033317214166E-08,0.001500289438846751,-4.996169395570395e-5,4.100670227701081e-8,0.0015007575640223773,-5.00609271009138e-5,4.1069476582698656e-8,0.0015012354183340914,-5.0073132062903215e-5,4.106633523245191e-8,0.001501682931435136,-5.000313393611321e-5,4.10020124318666e-8,0.0015020653958463235,-4.9876318236111225e-5,4.089664152349184e-8,0.001502363510762478,-4.973362668651773e-5,4.078166708635209e-8,0.0015025796036362987,-4.9621359434477365e-5,4.06919240015438e-8,0.001502737788613337,-4.957881774687852e-5,4.0656280257301776e-8,0.0015028778851812186,-4.9627518948032364e-5,4.0689710099869005e-8,0.001503044775055048,-4.9765138003926926e-5,4.078912007859041e-8,0.001503276131990282,-4.9966042084288354e-5,4.093418214974257e-8,0.0015035921340975534,-5.0188522911167886e-5,4.109307745813918e-8,0.0015039904959644906,-5.038664086853307e-5,4.12314822617478e-8,0.0015044484479765602,-5.052272450607022e-5,4.1321828260849926e-8,0.0015049305867960681,-5.057627006151882e-5,4.1349724488542334e-8,0.0015053992671028003,-5.0546698588028124e-5,4.1315734395285215e-8,0.001505823682333701,-5.0450202162379264e-5,4.123276774522326e-8,0.0015061851264551991,-5.03131376162049e-5,4.1120991139124105e-8,0.00150647810650972,-5.0164985415371416e-5,4.100254562995308e-8,0.0015067085911635734,-5.003289045076868e-5,4.0897557578942296e-8,0.0015068910568689683,-4.9938339881018866e-5,4.0821788084939146e-8,0.0015070455081733843,-4.989557017837055e-5,4.078553560863914e-8,0.0015071949768719031,-4.991095762554463e-5,4.079319265895584e-8,0.0015073634330199596,-4.998270255847455e-5,4.0842964940455486e-8,0.001507573648758257,-5.0100484272582855e-5,4.092657881678172e-8,0.001507844474226869,-5.024531275080717e-5,4.1029213145852094E-08,0.0015081872475477102,-5.039029477878423e-5,4.113020982278904e-8,0.001508601639381369,-5.0503348351200574e-5,4.1205288990591655e-8,0.0015090721800536042,-5.0552825964399286e-5,4.123090271547341e-8,0.0015095677542445187,-5.051598845732162e-5,4.119061726808571e-8,0.0015100464398749296,-5.0388137396494456e-5,4.1081869583940654e-8,0.0015104661524490966,-5.0188150732697904e-5,4.091992886992478e-8,0.0015107980562968522,-4.995626598255443e-5,4.073597315450068e-8,0.0015110369884425087,-4.974323096834382e-5,4.056865503257804e-8,0.0015112037636235288,-4.9594689096187027e-5,4.0452143784550536e-8,0.0015113382538688342,-4.9537390122333774e-5,4.040571885063075e-8,0.001511486651518908,-4.9572491390367476e-5,4.0428949376900265e-8,0.0015116882343063284,-4.9677288522526345e-5,4.0503412055625985e-8,0.001511965832908493,-4.981328246977489e-5,4.0599203239587485e-8,0.0015123218678560742,-4.993712667865752e-5,4.0683458185044255e-8,0.0015127398774388951,-5.001120491259384e-5,4.072833176366586e-8,0.0015131902459503254,-5.0011430442294444e-5,4.0716651632460574e-8,0.0015136381639806527,-4.9930908725903795e-5,4.064433406034829e-8,0.0015140516272895985,-4.977923819466192e-5,4.051953249837382e-8,0.0015144075622012096,-4.9578319631606846e-5,4.035928102066704e-8,0.0015146949683276282,-4.9356355695184494e-5,4.0184938821169755e-8,0.0015149150502128804,-4.9141887980333486e-5,4.0017799643976816e-8,0.0015150791746275875,-4.895917584109024e-5,3.9875772118617474e-8,0.0015152057997848073,-4.8825388632539786e-5,3.977139653273003e-8,0.0015153173317295856,-4.874940504486354e-5,3.971098695425316e-8,0.0015154374095433952,-4.8731643689852686e-5,3.9694467703771245e-8,0.0015155886318726306,-4.876432642304724e-5,3.971551230211538e-8,0.0015157903988936615,-4.8831866635134174e-5,3.976183295261236e-8,0.0015160564336704537,-4.891150797550089e-5,3.9815759747989534e-8,0.001516391691608481,-4.8974788479225625e-5,3.985552106330658e-8,0.0015167888924818176,-4.899079602098747e-5,3.985786664037715e-8,0.0015172258993118245,-4.893217400965164e-5,3.9802659015735863e-8,0.0015176663030841539,-4.878381729040918e-5,3.967934665594565e-8,0.0015180658418397924,-4.855185669703154e-5,3.9493549812086156e-8,0.0015183852145058741,-4.8267882631723335e-5,3.927002879151628e-8,0.001518605245428821,-4.7983227159816684E-05,3.904816418536927e-8,0.0015187364109845078,-4.7752853667001454e-5,3.8869607112691156e-8,0.0015188162107197098,-4.76157007253304e-5,3.876330623471329e-8,0.0015188951081814535,-4.7581646967552716e-5,3.87356971621642e-8,0.0015190187423242043,-4.763095682004308e-5,3.877055536279872e-8,0.0015192148843438057,-4.7724206359166875e-5,3.883693164021174e-8,0.0015194889111096335,-4.7816122036906335e-5,3.890001525702813e-8,0.0015198265573875282,-4.78675190041975e-5,3.893034461914193e-8,0.0015202006147450764,-4.785267690604367e-5,3.8909281403952436e-8,0.0015205786058022936,-4.776206764521024e-5,3.883074987792664e-8,0.001520929655959892,-4.7601511265561416e-5,3.8700210594517606e-8,0.0015212297485279174,-4.73889457227636e-5,3.853192522081979e-8,0.001521464985636384,-4.714978616986874e-5,3.834534142739313e-8,0.001521632714070136,-4.691181862109943e-5,3.8161308626593714e-8,0.0015217407259916819,-4.6700544473304215e-5,3.7998737945680615e-8,0.001521805050737679,-4.653561112622005e-5,3.7872078917049705e-8,0.0015218469609350476,-4.6428620942574455e-5,3.77897496515343e-8,0.0015218898209953303,-4.638232433864213e-5,3.7753505077697286e-8,0.0015219562588472324,-4.63908829784902e-5,3.775855431522331e-8,0.0015220657852472567,-4.644073196168358e-5,3.779415592915643e-8,0.0015222326849345393,-4.6511768353575117e-5,3.78445580321092e-8,0.0015224639302797234,-4.6578917633677744e-5,3.789033821231449e-8,0.0015227569400496383,-4.6614434070743716e-5,3.791035015751786e-8,0.0015230973823843132,-4.659163295010869e-5,3.788469386599491e-8,0.0015234580899453059,-4.6490764418833046e-5,3.779915028577375e-8,0.0015238011301948635,-4.630679101973296e-5,3.765088713532935e-8,0.0015240852672769784,-4.6056717425461094e-5,3.7453737167092474e-8,0.001524279176362041,-4.578158370729293e-5,3.723946842777562e-8,0.0015243761207970313,-4.5537893273890615e-5,3.7051147789336374e-8,0.0015244012465784203,-4.537833811089991e-5,3.692846975976653e-8,0.0015244043069810233,-4.5330485030194646e-5,3.689159982476225e-8,0.001524440051851727,-4.5386093677926136e-5,3.693319329946158e-8,0.0015245475921702796,-4.550706901455292e-5,3.70231970685862e-8,0.001524739631177373,-4.564256280847005e-5,3.712221109997426e-8,0.0015250039821238194,-4.574645320979391e-5,3.719506196713576e-8,0.001525312469978232,-4.57880724817201e-5,3.7219009823727845e-8,0.0015256311465300198,-4.575529177708597e-5,3.71858758629502e-8,0.0015259283156329572,-4.5652460184988825e-5,3.710009588757813e-8,0.001526179490549331,-4.549604863952453e-5,3.697504333756095e-8,0.0015263698298762106,-4.5309863016883735e-5,3.682918922629797e-8,0.0015264948690534665,-4.5120549024834013e-5,3.668269874859717e-8,0.0015265600057452486,-4.495356643058214e-5,3.65545436819091e-8,0.0015265789603062382,-4.4829825029204026e-5,3.646015826369734e-8,0.0015265714591917814,-4.476317621887072e-5,3.640967597256171e-8,0.001526560393019653,-4.47588814097071e-5,3.6406785222506725e-8,0.0015265687425595057,-4.481319012855167e-5,3.6448328955322366e-8,0.001526616673386339,-4.491402171639455e-5,3.6524727155707175e-8,0.001526719088838322,-4.5042478706087005e-5,3.662110821247449e-8,0.001526883671120863,-4.517492388060347e-5,3.671899335520608e-8,0.001527109357997393,-4.528556689050531e-5,3.679846629243785e-8,0.0015273852648541443,-4.5349660451110904e-5,3.684080865883039e-8,0.0015276902649918051,-4.5347572784252786e-5,3.683168213824624e-8,0.0015279940023550515,-4.5269982630066084e-5,3.676496818810432e-8,0.001528260741500139,-4.5123660491407865e-5,3.664687940483986e-8,0.0015284573649040436,-4.493568923535388e-5,3.649883068748661e-8,0.0015285651819203082,-4.475224028990135e-5,3.6356268024786054e-8,0.001528591522529057,-4.462799322930828e-5,3.6260564495138095e-8,0.0015285733068809862,-4.4606708170989893e-5,3.6244339332635135e-8,0.0015285663015500417,-4.4701580903939586e-5,3.631667920617675e-8,0.001528623057978843,-4.4888075568297965e-5,3.645788182105769e-8,0.0015287721301055885,-4.511488889181742e-5,3.662804240559266e-8,0.0015290104785997134,-4.532567197125326e-5,3.678385405657058e-8,0.0015293104382067145,-4.547810886081325e-5,3.689331286542308e-8,0.0015296334898081117,-4.555238252513215e-5,3.6942127930790746e-8,0.0015299425822774475,-4.5549875508693376e-5,3.6932458321921016e-8,0.0015302094618059117,-4.5487012585997464e-5,3.687784149123152e-8,0.0015304173593234294,-4.538838777224406e-5,3.6797650641900755e-8,0.0015305608012845585,-4.5281191160702335e-5,3.6712741731269536e-8,0.0015306441945146152,-4.5191250244956506e-5,3.664253537729438e-8,0.0015306800306723414,-4.514019365633332e-5,3.660306514411148e-8,0.0015306868440561443,-4.5143317412885504e-5,3.660554118454364e-8,0.0015306868688130097,-4.5208046874071456e-5,3.665525950628058e-8,0.001530703372269813,-4.533304361844633e-5,3.675088279926432e-8,0.0015307577071024677,-4.550816475509205e-5,3.6884311766138235e-8,0.0015308663545292767,-4.5715530714938635e-5,3.7041438425744794e-8,0.001531038403461839,-4.5931705831679506e-5,3.7203859056823594e-8,0.0015312738096312358,-4.613076201647923e-5,3.7351380006003594e-8,0.001531562647587085,-4.628797631784266e-5,3.7465058196804165e-8,0.001531885540287841,-4.638388948223532e-5,3.753045447184219e-8,0.0015322154350115606,-4.6408424099129384e-5,3.75407624833672e-8,0.0015325210181051422,-4.636473481435046e-5,3.749952617090675e-8,0.0015327722562987192,-4.62720299113284e-5,3.742243109933671e-8,0.0015329482178092664,-4.616568661040811e-5,3.7337038635539955e-8,0.0015330459667584296,-4.60922941785365e-5,3.7278814888025735e-8,0.001533087023241133,-4.609795126881395e-5,3.728225619249699e-8,0.001533115983708838,-4.621153374983078e-5,3.736837190134323e-8,0.0015331876400693626,-4.643018459294151e-5,3.753391652633899e-8,0.0015333461088477486,-4.6716886718747485e-5,3.7749779963297116e-8,0.001533607077938741,-4.701413330082583e-5,3.797158062251958e-8,0.0015339536898771556,-4.7266463413301e-5,3.8156979046495933e-8,0.0015343469210881689,-4.7438804933053115e-5,3.827972461061156e-8,0.0015347420400233514,-4.7522609577066365e-5,3.833423468532848e-8,0.0015351018922789568,-4.75311913550837e-5,3.833175719045527e-8,0.0015354032268769953,-4.7490536847499134e-5,3.8293014468682244e-8,0.0015356372503282487,-4.7430749661384474e-5,3.8241437080403724e-8,0.0015358072060457936,-4.738020854009638e-5,3.819867181103716e-8,0.0015359252275494756,-4.736231090740194e-5,3.818223813016995e-8,0.0015360095332831896,-4.739380510817324e-5,3.820445815928393e-8,0.0015360820478136717,-4.748383499571379e-5,3.82718722773441e-8,0.001536166141831675,-4.763330834665019e-5,3.838478548063725e-8,0.001536284194639195,-4.783458629340891e-5,3.8536969464764897e-8,0.0015364548174580863,-4.8071792138992605e-5,3.871582755825761e-8,0.001536689888308331,-4.832221693893701e-5,3.890347256035087e-8,0.001536991949021952,-4.8559125680806725e-5,3.907898810591917e-8,0.0015373526882001662,-4.875585201501901e-5,3.9221757056841037E-08,0.0015377531409755225,-4.889068042494506e-5,3.931538272353313e-8,0.0015381659828674545,-4.895167436888976e-5,3.9351451406966635e-8,0.0015385598715198048,-4.894040830492917e-5,3.9332267184161023e-8,0.0015389053503828088,-4.887366805568127e-5,3.927184980018389e-8,0.0015391815674583567,-4.878238533919379e-5,3.919473310592367e-8,0.0015393827610044833,-4.870713902780217e-5,3.913220935194622e-8,0.001539522826925547,-4.868983638924286e-5,3.911586463438951e-8,0.001539635551012186,-4.8762258491063296e-5,3.916897922140672e-8,0.0015397681169518995,-4.893424373568861e-5,3.929783969200081e-8,0.0015399675307219867,-4.9186670824232385e-5,3.9486747633733346e-8,0.0015402639575685848,-4.94746582698892e-5,3.970072063670472e-8,0.001540658896768355,-4.974203898215638e-5,3.989665648604e-8,0.0015411250260262703,-4.9940960584229624e-5,4.0038309783718896e-8,0.0015416177088270302,-5.0046684404287795e-5,4.010752915400204e-8,0.0015420911707916128,-5.006124568783706e-5,4.010688682435594e-8,0.0015425111740769344,-5.000709715400226e-5,4.00545534176231e-8,0.0015428603593231258,-4.9916572907574924e-5,3.9975967592465016e-8,0.001543137348004615,-4.9822560505639655e-5,3.9896549730067413e-8,0.0015433527728847896,-4.9752685894152456e-5,3.983728353617607e-8,0.0015435248853113634,-4.972672630231794e-5,3.981289716560943e-8,0.0015436759860362377,-4.975595477250484e-5,3.9831537088095255e-8,0.0015438297952060482,-4.984325147671539e-5,3.989494979643839e-8,0.0015440093369692496,-4.998334813656624e-5,3.999866380557658e-8,0.0015442348151259754,-5.016309804535865e-5,4.013214246585282e-8,0.0015445211154071746,-5.0362121259628284e-5,4.027925529887606e-8,0.0015448749611662643,-5.055446980018576e-5,4.0419618992163206e-8,0.0015452923005028491,-5.071189862384606e-5,4.053125674762409e-8,0.0015457569800726891,-5.0808855828295383E-05,4.059460327889975e-8,0.0015462418900000286,-5.082850879931722e-5,4.059724221672877e-8,0.0015467132993301472,-5.076823346637892e-5,4.0538094268894254e-8,0.0015471380038922773,-5.064252614673594e-5,4.042945683138028e-8,0.0015474916360774626,-5.048174585710053e-5,4.0295709244955134e-8,0.0015477657624747324,-5.0326348408581844e-5,4.016852598729084e-8,0.0015479715584376128,-5.02176988612463e-5,4.00795759607021e-8,0.001548138675163666,-5.018759931395581e-5,4.0052468864238434e-8,0.001548309019173918,-5.0249167170106635e-5,4.0095999848332944e-8,0.001548526363415651,-5.039173011559901e-5,4.020064552392213e-8,0.001548824072026234,-5.0581979693915296e-5,4.033985817256759e-8,0.0015492146318262102,-5.0772290610955474e-5,4.047669746431854e-8,0.0015496851936439822,-5.091443598787875e-5,4.057438892398452e-8,0.001550201601146154,-5.0973893683465014e-5,4.0607169310144533e-8,0.001550719547427848,-5.093895551994056e-5,4.0567056747315524e-8,0.0015511979549022272,-5.082132789363123e-5,4.0464060310906736e-8,0.001551609085796503,-5.064930767517722e-5,4.032070429909841e-8,0.001551942485882253,-5.045777032215602e-5,4.0164179972009266e-8,0.001552203365741154,-5.027932903282667e-5,4.0019527762343134e-8,0.0015524080338778475,-5.0138911795649996e-5,3.990557662144009e-8,0.0015525789206599471,-5.005169954767954e-5,3.983352487266917e-8,0.0015527405622942454,-5.0023207216840704e-5,3.980713258549693e-8,0.001552916795278977,-5.005024771803662e-5,3.982350168918181e-8,0.0015531287739189376,-5.012197934084325e-5,3.987384769919168e-8,0.0015533932025365111,-5.022080731770897e-5,3.99441559610026e-8,0.0015537202826231122,-5.03234457482546e-5,4.0016025565273536e-8,0.0015541112665716941,-5.0402810390084915e-5,4.0068239562396716e-8,0.0015545561079804125,-5.0431489448755314e-5,4.007959506236113e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json deleted file mode 100644 index dc1eb06c..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":15000,"numberOfSamples":1000,"samples":[0.001555032396790159,-5.038717964716439e-5,4.003321453737454e-8,0.001555507240340409,-5.025945257220019e-5,3.992178064606655e-8,0.0015559433318249748,-5.005568561411016e-5,3.975199831316558e-8,0.0015563086828940746,-4.9802949292686764e-5,3.9545822083813816e-8,0.001556587031841404,-4.9543375923704664e-5,3.9336583092513e-8,0.0015567845028372617,-4.93232976794034e-5,3.9160317297773175e-8,0.0015569291408115862,-4.9179757456819175e-5,3.904518941710335e-8,0.0015570631279621951,-4.912957061070448e-5,3.90031151041951e-8,0.0015572306984882043,-4.916483994647903e-5,3.902661169621281e-8,0.0015574660511056152,-4.9255840502179806e-5,3.9091477245714126e-8,0.0015577847760354089,-4.9359606772293576e-5,3.9163823082464017e-8,0.001558180685115808,-4.943135773630568e-5,3.920908834205859e-8,0.0015586283968716341,-4.943566203060656e-5,3.920059314584998e-8,0.0015590906701226305,-4.9354497209498185e-5,3.9125494924869697e-8,0.001559528261058972,-4.919020584318819e-5,3.8986728207848124e-8,0.0015599093591160292,-4.896289913685733e-5,3.880070214408021e-8,0.0015602159244718476,-4.870367300374791e-5,3.8591890031225615e-8,0.001560445583043622,-4.844627081761637e-5,3.838637217885279e-8,0.0015606095190522666,-4.821988699048854e-5,3.8206389463064e-8,0.001560728059333107,-4.80447105719932e-5,3.8067072967328046e-8,0.0015608258215469178,-4.7930366808124216e-5,3.797538689472998e-8,0.0015609276655558022,-4.787644642721989e-5,3.793059714039383e-8,0.0015610558505919753,-4.7874043041353836e-5,3.792543115973339e-8,0.0015612281647851558,-4.7907464781617856e-5,3.794734148986789e-8,0.0015614564996265033,-4.795579391508165e-5,3.797969902153523e-8,0.0015617453775785114,-4.7994480662788104e-5,3.8003106795686565e-8,0.001562090231917282,-4.799751763502489e-5,3.7997236526191586e-8,0.0015624757732016965,-4.7940913074933274e-5,3.7943666553683704e-8,0.0015628755385377238,-4.780797264952134e-5,3.783002608138753e-8,0.0015632543909054244,-4.759591895225801e-5,3.765503864336205e-8,0.0015635755508337965,-4.7321569326116703e-5,3.743272490582087e-8,0.0015638118247210714,-4.702212301492192e-5,3.719276938020053e-8,0.0015639572183669657,-4.674759666086147e-5,3.697442350326965e-8,0.0015640325431972783,-4.654548661616456e-5,3.681443353406246e-8,0.0015640803149591668,-4.644389332460276e-5,3.673389012822279e-8,0.0015641503210691414,-4.644165242496307e-5,3.673070606589074e-8,0.0015642829369577056,-4.651013021168292e-5,3.678135043023996e-8,0.0015644977495392904,-4.660446073429612e-5,3.685000664095114e-8,0.001564790749643378,-4.6677917336542896e-5,3.6900071652951433e-8,0.001565138707406003,-4.66938238368795e-5,3.690350083708066e-8,0.0015655073435626183,-4.663241657433939e-5,3.6845954665167155e-8,0.0015658602190323327,-4.649255514773499e-5,3.672776169544263e-8,0.0015661663607259592,-4.628936931980565e-5,3.656170224679889e-8,0.0015664055799049252,-4.6049225283354464e-5,3.636883604376693e-8,0.001566571002171141,-4.580336936715299e-5,3.6173502381504967e-8,0.0015666687673390187,-4.558160277952096e-5,3.599852488215996e-8,0.0015667154033415197,-4.5407215387777025e-5,3.586148463513818e-8,0.0015667338355941623,-4.529393320932333e-5,3.577253994149994e-8,0.0015667490993197454,-4.524500274399756e-5,3.573380667359368e-8,0.0015667846174289822,-4.5254024907903564e-5,3.57399848967389e-8,0.001566859497029681,-4.5306834496840176e-5,3.5779734964378544e-8,0.0015669868024443458,-4.5383715412729446e-5,3.583733887760147e-8,0.001567172455798627,-4.546158479647085e-5,3.5894430294282084e-8,0.0015674144103284765,-4.551618411695069e-5,3.593183701499408e-8,0.001567701899164982,-4.5524599621765035e-5,3.593172347162997e-8,0.0015680149455750063,-4.5468646452923546e-5,3.588034316011282e-8,0.001568325023881159,-4.533952995396979e-5,3.577163595791014e-8,0.001568598375261144,-4.514331996072684e-5,3.561129614715066e-8,0.0015688033307539359,-4.490516831986402e-5,3.5419775786897466e-8,0.0015689213635770478,-4.4668520678280764e-5,3.5231422956829793e-8,0.0015689580930293371,-4.448560774152507e-5,3.508694038347068e-8,0.001568947072838441,-4.439966029933874e-5,3.501951652065551e-8,0.0015689406813127415,-4.442653532989222e-5,3.5040594280255434e-8,0.0015689905208410501,-4.454694343553021e-5,3.5134005465375e-8,0.0015691279470960945,-4.471462114836585e-5,3.526264408522862e-8,0.001569355167197491,-4.4874982251366504e-5,3.5383351783517066e-8,0.0015696491590304815,-4.498328840192346e-5,3.5461324901144965e-8,0.0015699730086184231,-4.5014843868502684e-5,3.547806086334234e-8,0.0015702878466824224,-4.496644962533722e-5,3.5432227789964445e-8,0.0015705615045717492,-4.48522455988792e-5,3.5336015448358164e-8,0.0015707731361774711,-4.469737825179658e-5,3.520983386424041e-8,0.0015709146371371892,-4.453167337270511e-5,3.507720338549927e-8,0.0015709899450492496,-4.4384204168804375e-5,3.4960569188722246e-8,0.0015710129446352492,-4.427899769327988e-5,3.487815813513884e-8,0.0015710044338982897,-4.4232035758685976e-5,3.484187409746818e-8,0.0015709885901114629,-4.424966839076787e-5,3.48562113954969e-8,0.0015709893763831153,-4.4328433769242266e-5,3.491813422291662e-8,0.0015710273252120134,-4.4456174728882454e-5,3.501786728147512e-8,0.001571117095259444,-4.4614146603934006e-5,3.514044529398255e-8,0.0015712659471281585,-4.4779625550250765e-5,3.526772890807883e-8,0.0015714729990209998,-4.492865339998087e-5,3.5380643711257126e-8,0.0015717290886569444,-4.503882672267935e-5,3.5461540303863484e-8,0.0015720171486412,-4.509218250304847e-5,3.549662088853352e-8,0.0015723131710548195,-4.507838065681111e-5,3.547847663955526e-8,0.0015725883317389549,-4.499835421555663e-5,3.540880348366659e-8,0.001572813307826608,-4.486786800809496e-5,3.5300892636416496e-8,0.0015729655070056204,-4.47191603474519e-5,3.518058646081875e-8,0.0015730384980441499,-4.459776227937817e-5,3.5083578249073555e-8,0.0015730502214990328,-4.4551776967474605e-5,3.504702004926623e-8,0.0015730436787471955,-4.461436338745037e-5,3.5095992048822466e-8,0.0015730749295945277,-4.478695231412046e-5,3.5230609633398364e-8,0.00157319126570817,-4.5034672737442647e-5,3.542266299781257e-8,0.0015734115792861226,-4.529940702276995e-5,3.562602881073632e-8,0.0015737208148722149,-4.552319788898638e-5,3.5795178558746185e-8,0.0015740799139331147,-4.5667994072365434e-5,3.590075376760617e-8,0.0015744426094396393,-4.572297761098429e-5,3.593523410445762e-8,0.0015747694654922382,-4.570060260613509e-5,3.5909545233455296e-8,0.0015750350883362262,-4.56275210357777e-5,3.584556214181634e-8,0.0015752294134122743,-4.5535604842148e-5,3.576877953266378e-8,0.0015753556604648073,-4.545534529408837e-5,3.5703062165524755e-8,0.0015754271119554817,-4.541175214597163e-5,3.566756900441209e-8,0.0015754637850900197,-4.5422021566715475e-5,3.567516845886349e-8,0.0015754892419881964,-4.549435685857388e-5,3.5731726192643936e-8,0.0015755275323007985,-4.562767745693644e-5,3.5835969133508226e-8,0.0015756002822981585,-4.581213815904196e-5,3.597985887669808e-8,0.0015757240290649212,-4.603051129355547e-5,3.6149580268519345e-8,0.0015759080778055216,-4.626046736804536e-5,3.632726928230143e-8,0.0015761532032229398,-4.6477532670966515e-5,3.6493374497356665e-8,0.0015764513190264005,-4.66583682351069e-5,3.662937540080888e-8,0.0015767861221216862,-4.6784116146357104e-5,3.67205887315865e-8,0.0015771347357232419,-4.6843579857850895e-5,3.6758772560147956e-8,0.0015774703483009739,-4.683599304438294e-5,3.67442426941251e-8,0.0015777659552356682,-4.677317302149219e-5,3.66873186351272e-8,0.0015779995237324785,-4.668049190430199e-5,3.660873387655922e-8,0.0015781605555831091,-4.659528839149842e-5,3.6538079166891776e-8,0.0015782567852510353,-4.656091594072024e-5,3.650901070819981e-8,0.0015783179633283798,-4.6615418475760236e-5,3.655049543919046e-8,0.0015783922903835324,-4.677665068892878e-5,3.667544840847755e-8,0.0015785325756434202,-4.703036852583066e-5,3.687171431896692e-8,0.0015787756427616659,-4.733035159097787e-5,3.7102367094230025e-8,0.0015791259181678027,-4.761430923312568e-5,3.731827295238525e-8,0.0015795538411506713,-4.7828037828527396e-5,3.747709330858676e-8,0.0015800096969891477,-4.7943878769038486E-05,3.7557792145692596e-8,0.0015804431624417705,-4.796481847401571e-5,3.756375094216574e-8,0.0015808178057632656,-4.791635491291735e-5,3.7516101368887467e-8,0.0015811164141571583,-4.783405291768669e-5,3.744360223405161e-8,0.0015813392677104443,-4.775314048922322e-5,3.737423693485045e-8,0.0015814993203580124,-4.7702326404354844e-5,3.733035174588052e-8,0.0015816171643790661,-4.7701193814970105e-5,3.7326791516613286e-8,0.0015817169630395575,-4.775965776778595e-5,3.737071389079256e-8,0.001581823347515752,-4.787832470052812e-5,3.7462041637598934e-8,0.0015819588828547596,-4.8049258257063996e-5,3.7594106726625155e-8,0.0015821417963573898,-4.8257082895207296e-5,3.775446258471748e-8,0.0015823838479101893,-4.848060164321304e-5,3.792608585212836e-8,0.001582688504544025,-4.869520808633535e-5,3.8089269531459865e-8,0.0015830498625370153,-4.887615170356731e-5,3.822428825087552e-8,0.0015834527637300596,-4.9002351733972964e-5,3.8314560752223585e-8,0.0015838743628422021,-4.906026034512833e-5,3.834982706901485e-8,0.001584287221216587,-4.904715037019271e-5,3.832875105474419e-8,0.001584663741938823,-4.897310145628491e-5,3.826032241557493e-8,0.001584981463061841,-4.8861079857009655e-5,3.8163607031293117e-8,0.0015852285820703014,-4.874466991235223e-5,3.8065608345197424e-8,0.0015854088600154176,-4.8662962215500585e-5,3.7997004979177486e-8,0.0015855444217866606,-4.86522846509656e-5,3.798563784368472e-8,0.001585674261819128,-4.8735533803462465e-5,3.804836085608511e-8,0.001585846375312292,-4.891189807186035e-5,3.818334234181005e-8,0.00158610348310477,-4.9151982596995845e-5,3.836657757562266e-8,0.001586466654834368,-4.9403489989380824e-5,3.8556531405909456e-8,0.0015869251102463237,-4.960807810621859e-5,3.870740581132169e-8,0.0015874391429179613,-4.9722343633764594e-5,3.8785587350351096e-8,0.0015879553631793688,-4.973190214442801e-5,3.878064452942808e-8,0.001588425577199708,-4.9652024693980827e-5,3.870567071163837e-8,0.00158881977381429,-4.951725979120483e-5,3.8588846273972866e-8,0.0015891295065786543,-4.936775952074638e-5,3.84623889278333e-8,0.001589364066660281,-4.9238715531157035e-5,3.8354092314337146e-8,0.001589543909685928,-4.9154994199223596e-5,3.8283168581558065e-8,0.0015896945618050432,-4.9129902713118106e-5,3.825948659678869e-8,0.0015898422153512498,-4.916611627099987e-5,3.8284520145138256e-8,0.001590010859028341,-4.925727610695112e-5,3.8352726691160195e-8,0.0015902202966968217,-4.938958761833569e-5,3.845280876708773e-8,0.0015904844846205953,-4.954336749390981e-5,3.8568874325898195e-8,0.0015908099083882816,-4.969485381752708e-5,3.868182932013065e-8,0.0015911941068452644,-4.98187279964764e-5,3.8771413773902485e-8,0.0015916248545581027,-4.989160905264646e-5,3.881908380631811e-8,0.0015920807276100831,-4.9896318601345885e-5,3.881152013111638e-8,0.0015925336582621405,-4.982618528736371e-5,3.874409592893164e-8,0.0015929536328127007,-4.9688213379708714e-5,3.862330576383604e-8,0.0015933149629505758,-4.950379940089145e-5,3.846710078351864e-8,0.001593602808933612,-4.930610263244153e-5,3.830248200720968e-8,0.0015938182399501703,-4.913404445176729e-5,3.8160453318297506e-8,0.0015939802243672306,-4.902380951458289e-5,3.806916042959481e-8,0.0015941233988982489,-4.899946750049259e-5,3.8046581250505863e-8,0.0015942911880484664,-4.906498251129774e-5,3.80945375169188e-8,0.0015945249563040758,-4.920032285756388e-5,3.8196040630227036e-8,0.0015948515164234465,-4.9364207196608636e-5,3.8317796980507725e-8,0.001595273159867582,-4.950449066879408e-5,3.841854809931519e-8,0.0015957650230228916,-4.9573895929635576e-5,3.846143646287539e-8,0.0015962822947114133,-4.954513058246872e-5,3.842577890144347e-8,0.0015967748230214939,-4.941856956430488e-5,3.8312929742037596e-8,0.001597202494943064,-4.921934317902047e-5,3.814375061431865e-8,0.0015975448239908775,-4.898645979137916e-5,3.794978155712491e-8,0.0015978022649466863,-4.876005227964857e-5,3.7762998553756675e-8,0.0015979913135114392,-4.85719625681952e-5,3.76083609760703e-8,0.0015981373497028673,-4.84414879329937e-5,3.750059586381275e-8,0.0015982682896983585,-4.837523496803743e-5,3.744429677813117e-8,0.0015984102235238262,-4.8369073369492696e-5,3.743563223650375e-8,0.0015985848577516198,-4.8410619737028296e-5,3.746436079232389e-8,0.0015988080578801715,-4.848147621960483e-5,3.751556089859576e-8,0.0015990887787054714,-4.8559129023742496e-5,3.7571077107145096e-8,0.0015994279675657184,-4.861890144868653e-5,3.761106919377434e-8,0.0015998175105410416,-4.8636534469734454e-5,3.761614354464905e-8,0.0016002397772522405,-4.859177185400766e-5,3.757032802152641e-8,0.0016006686543139628,-4.84728413566226e-5,3.74647259539885e-8,0.0016010729910405593,-4.828097347843213e-5,3.7301095421887124e-8,0.0016014227983081818,-4.8033231546302496e-5,3.709395135898375e-8,0.0016016972164009232,-4.776158920159305e-5,3.686957478771082e-8,0.001601891799677878,-4.750708267512769e-5,3.6661070725469196e-8,0.0016020220967839574,-4.730984733590426e-5,3.65002268054441e-8,0.0016021214376728508,-4.7197895387483466e-5,3.640855159267248e-8,0.0016022329539292035,-4.7178441191331395e-5,3.6390568883612766e-8,0.001602398098868516,-4.723486700987873e-5,3.64317778525816e-8,0.0016026451775172069,-4.7330459524417435e-5,3.6502037536061675e-8,0.0016029812826023223,-4.741790311922242e-5,3.6563402100527594e-8,0.0016033900211863004,-4.7451924030049034e-5,3.658023478305435e-8,0.0016038359142873748,-4.7401493578198037e-5,3.65287527576269e-8,0.0016042743565764664,-4.725778830099e-5,3.6403069368047857e-8,0.0016046639296792753,-4.703526837810497e-5,3.621574128865795e-8,0.0016049768310006606,-4.676579911472799e-5,3.599284252644777e-8,0.0016052041001474093,-4.6488499312397777e-5,3.576575444073776e-8,0.0016053547788864799,-4.623936983449527e-5,3.556292473478258e-8,0.0016054506685802667,-4.604404725371659e-5,3.540424269592429e-8,0.00160551955904301,-4.591491456251917e-5,3.529894528530359e-8,0.0016055893304846428,-4.585176544402924e-5,3.5246319584402404e-8,0.0016056839738281931,-4.584435487657563e-5,3.523780378361235e-8,0.0016058214226180075,-4.58754099005351e-5,3.525934967930275e-8,0.0016060125662822487,-4.5923316964371105e-5,3.5293484731850514e-8,0.0016062607469574757,-4.5964330399595076e-5,3.5321033008763995e-8,0.0016065612721366269,-4.597465556251913e-5,3.5322825752794e-8,0.001606900939181552,-4.5932990607520925e-5,3.528185027009399e-8,0.0016072580949436541,-4.582396800827508e-5,3.518611857277115e-8,0.0016076041773001588,-4.564246758849356e-5,3.503214741997083e-8,0.001607907835484071,-4.539791130326102e-5,3.482829369055841e-8,0.001608142149154005,-4.511646354493401e-5,3.4596304332457856e-8,0.0016082937279128775,-4.483839603063741e-5,3.4368956580540236e-8,0.001608370164011681,-4.460905850485839e-5,3.418262319337986e-8,0.0016084013367679887,-4.4465215778220584e-5,3.4066244784300986e-8,0.0016084321421592992,-4.442209614898366e-5,3.4031040378216796e-8,0.0016085087032214472,-4.4467328910789975e-5,3.406590890538271e-8,0.001608663854204168,-4.4564751128790306e-5,3.414084287148784e-8,0.0016089078261996121,-4.466603533873435e-5,3.4216585652257157e-8,0.0016092268749752002,-4.472491235101269e-5,3.425621097733665e-8,0.0016095888815234746,-4.470896660568734e-5,3.4234524970492415e-8,0.00160995294459917,-4.46061700180591e-5,3.414304169545714e-8,0.0016102797685153603,-4.442554150736995e-5,3.39901449867369e-8,0.001610540291413511,-4.41928249660299e-5,3.379729090404697e-8,0.001610720877149768,-4.3942959524330366e-5,3.3592785051752095e-8,0.0016108243718107255,-4.3711535533740247e-5,3.340493987008991e-8,0.0016108673896750982,-4.352740556905542e-5,3.325631883018611e-8,0.0016108751528596623,-4.340803798367828e-5,3.31602500419108e-8,0.0016108756639389974,-4.3358117340029234e-5,3.31199083561361e-8,0.00161089471982018,-4.33708154841172e-5,3.312942713946964e-8,0.0016109525410755215,-4.34306101333567e-5,3.317612870807587e-8,0.0016110620470242626,-4.351655218140907e-5,3.3243045504261954e-8,0.001611228317562383,-4.360524372648092e-5,3.331122931252226e-8,0.0016114486396584151,-4.367330914275547e-5,3.336174083792286e-8,0.0016117127150576606,-4.3699607289291936e-5,3.33775293772246e-8,0.0016120029665654158,-4.366764384768521e-5,3.3345510827283086e-8,0.0016122953248352881,-4.35685848202546e-5,3.3259070099345036e-8,0.0016125613483437497,-4.340490324202378e-5,3.312093756709973e-8,0.0016127727551766623,-4.319382193216696e-5,3.294576076085041e-8,0.0016129088996316033,-4.296843215561775e-5,3.276074107332174e-8,0.0016129659137071207,-4.277350269527232e-5,3.260204841704383e-8,0.0016129634518711477,-4.2654123502679954e-5,3.250560511019986e-8,0.0016129434192342419,-4.263951160928507e-5,3.249413087936494e-8,0.0016129578689934336,-4.272950726670111e-5,3.25664702196115e-8,0.001613050232896208,-4.2892278302879625e-5,3.2696007974918103e-8,0.0016132395138366183,-4.307566567224347e-5,3.2840080832235315e-8,0.0016135153781361821,-4.3225967007183096e-5,3.295532521363271e-8,0.0016138447598283675,-4.330446141592195e-5,3.3011068605873004e-8,0.0016141845061787268,-4.329558915141256e-5,3.299579503566333e-8,0.0016144937858859182,-4.320654916003372e-5,3.29165093334752e-8,0.0016147426836319956,-4.3061418898431364e-5,3.2793617549553344e-8,0.0016149162538619413,-4.28932148940195e-5,3.2654235700933185e-8,0.0016150148382885333,-4.273622151749938e-5,3.252591778532962e-8,0.0016150517857130536,-4.261972946654225e-5,3.243173477682972e-8,0.001615049514803641,-4.256367933918242e-5,3.238701919898679e-8,0.0016150347633862986,-4.2576490174574447e-5,3.239787068664833e-8,0.0016150339039934956,-4.265505690214593e-5,3.24613058418649e-8,0.0016150690590622733,-4.278649690659109e-5,3.2566675877575025e-8,0.0016151554483356746,-4.2951022505443604e-5,3.269788817933618e-8,0.0016153001048231429,-4.312527285417708e-5,3.283598386574173e-8,0.0016155017602802555,-4.328548587995333e-5,3.2961656880308e-8,0.0016157514557302796,-4.3410193344149555e-5,3.305749480030836e-8,0.0016160335151886938,-4.348253336100209e-5,3.310998203842222e-8,0.0016163267962227231,-4.3492450229067064e-5,3.311139396130571e-8,0.001616606420595729,-4.343902077762299e-5,3.306167660919614e-8,0.001616846570836147,-4.3332918110579625e-5,3.297027424956425e-8,0.0016170251774682734,-4.319829401359851e-5,3.285736904569684e-8,0.0016171308087405997,-4.307222907662207e-5,3.2753160720529384e-8,0.0016171704476762414,-4.299915965162309e-5,3.2693234113441636e-8,0.0016171742841552047,-4.301865193973153e-5,3.2708769773927315e-8,0.0016171918923307148,-4.314894035091985e-5,3.281350053431754e-8,0.0016172768691222427,-4.337450691395369e-5,3.299396166424684e-8,0.0016174652144145727,-4.364756211844907e-5,3.321089173978478e-8,0.0016177597932134746,-4.390561146011057e-5,3.341354613711286e-8,0.0016181304852361284,-4.4095543629212986e-5,3.3559243265705895e-8,0.0016185284692897027,-4.4190547319258514e-5,3.362705585213057e-8,0.0016189045522376445,-4.4193243891010715e-5,3.362020601659291e-8,0.0016192223969067512,-4.412817824935237e-5,3.355967969498163e-8,0.0016194638193470891,-4.403063195720452e-5,3.34748138358053e-8,0.0016196280163832983,-4.393679585500097e-5,3.339511192107193e-8,0.0016197277267549035,-4.3877154423368346e-5,3.334489133236136e-8,0.0016197845593948158,-4.387287847418416e-5,3.334056960624522e-8,0.0016198245204375643,-4.3934319125600074e-5,3.3389732573910446e-8,0.0016198739737394417,-4.4060948688515964e-5,3.3491313790702704e-8,0.001619956137050907,-4.424248547766236e-5,3.3636593203828094e-8,0.0016200882954145463,-4.4460987523551896e-5,3.381084517949932e-8,0.0016202798937417601,-4.469366279624242e-5,3.399550450501883e-8,0.0016205316675254457,-4.4916122131234496e-5,3.417072218106146e-8,0.0016208358841783572,-4.51056635939364e-5,3.431804144775011e-8,0.0016211775123474187,-4.524417861154815e-5,3.442285758382958e-8,0.0016215360341788234,-4.532053562216261e-5,3.447647579529873e-8,0.0016218877589150979,-4.5332465127465866e-5,3.4477688314315185e-8,0.0016222086413283134,-4.528794941479019e-5,3.4433800071019065e-8,0.0016224777898770169,-4.520602795248432e-5,3.436102856785716e-8,0.0016226820080681198,-4.511649275684907e-5,3.428394416218811e-8,0.0016228212897336288,-4.505716598228851e-5,3.423303906504118e-8,0.0016229139005976808,-4.50670885186496e-5,3.423920259833186e-8,0.0016229978830992289,-4.51749217202737e-5,3.432456868826437e-8,0.0016231246866747196,-4.538503437297744e-5,3.449162408965321e-8,0.0016233428870291516,-4.566853319778398e-5,3.4716252957965794e-8,0.0016236772248806965,-4.596812991238768e-5,3.495178509204106e-8,0.0016241152647686152,-4.621869465816446e-5,3.514559949367053e-8,0.0016246116056889723,-4.637312377459764e-5,3.526003661180751e-8,0.0016251072872445914,-4.6418152194176277e-5,3.5285198490338464e-8,0.0016255516901675028,-4.637296697358738e-5,3.523771443245092e-8,0.0016259155653828902,-4.627592173555477e-5,3.5149685697300395e-8,0.0016261928281600965,-4.616943668607092e-5,3.5056106184870745e-8,0.0016263953747431522,-4.608946050777786e-5,3.4986134383754507e-8,0.00162654592076792,-4.606055522365073e-5,3.4959174040392114e-8,0.0016266717530924076,-4.6094961601108544e-5,3.498436583192719e-8,0.0016268002162611959,-4.619362578856872e-5,3.506170277704274e-8,0.0016269555762756986,-4.6347898809298577e-5,3.5183591772346576e-8,0.0016271567027249208,-4.654151467710764e-5,3.533649211716943e-8,0.0016274153179251607,-4.675286847043376e-5,3.550269075582101e-8,0.0016277348011426761,-4.695766887346226e-5,3.566236234788382e-8,0.0016281097039318963,-4.7132008983412574e-5,3.5796030279421156e-8,0.0016285262644494334,-4.7255678611228e-5,3.5887315314142226e-8,0.001628964073625187,-4.731526564371127e-5,3.5925567937765023E-08,0.0016293987695045343,-4.7306594472402196e-5,3.5907931482636357e-8,0.0016298055166128098,-4.723617482978707e-5,3.5840485560798704e-8,0.0016301629750232944,-4.7121376003895105e-5,3.573820180050115e-8,0.0016304574112304933,-4.698912835410786e-5,3.562359354313474e-8,0.001630686636381212,-4.687296006046646e-5,3.552402309108488e-8,0.001630863266571223,-4.6807921698255846e-5,3.546744809793738e-8,0.001631016074302961,-4.6822961021669483e-5,3.5476346222796364e-8,0.0016311873490471736,-4.6931285427303824e-5,3.556023149782128e-8,0.0016314241196807519,-4.712134705140385e-5,3.570874980570606e-8,0.0016317631244090534,-4.7353656267366736e-5,3.5889370924150126e-8,0.0016322143049490748,-4.756904084464057e-5,3.605411987293246e-8,0.0016327523237028758,-4.770869469055887e-5,3.615570802256036e-8,0.001633323721960312,-4.7737093003807625e-5,3.616600609540491e-8,0.0016338673630050457,-4.7654512699828896e-5,3.608614967055138e-8,0.0016343363161102794,-4.7492623882838964e-5,3.59428498486487e-8,0.0016347097760828822,-4.729839554612501e-5,3.577507367476015e-8,0.0016349924051370127,-4.7117130386448616e-5,3.5619987353530545e-8,0.0016352061343948639,-4.6981902350859326e-5,3.550426387925348e-8,0.0016353807083681227,-4.691028273741784e-5,3.544154910868567e-8,0.0016355464804455415,-4.690570628738172e-5,3.543383998937961e-8,0.001635730112170018,-4.696057989449839e-5,3.5474262687520425e-8,0.0016359523601496132,-4.705941012943231e-5,3.5549738432914185e-8,0.0016362269041772656,-4.718145036852111e-5,3.56431208201011e-8,0.0016365595879771274,-4.730304536267612e-5,3.5735016865504467e-8,0.0016369478987237219,-4.7400035126582016e-5,3.58056778292684e-8,0.0016373808483354118,-4.7450543227840547e-5,3.583728050603426e-8,0.0016378397017732427,-4.7438197284311285e-5,3.581663456998011e-8,0.0016383000265438497,-4.7355354305080354e-5,3.573790790644766e-8,0.001638735210162438,-4.720557229499285e-5,3.5604668453241686e-8,0.0016391211394910926,-4.700451726643738e-5,3.5430520082254106e-8,0.001639441306452008,-4.6778640180967995e-5,3.5237790208829276e-8,0.0016396912690668532,-4.6561377647454084e-5,3.5054142350092676e-8,0.0016398813658379573,-4.63872399230719e-5,3.490753406266736e-8,0.0016400368292994823,-4.628458200577974e-5,3.4820292858860436e-8,0.0016401946504560447,-4.6268117996810935e-5,3.480322538106792e-8,0.0016403967479677747,-4.6332728578918845e-5,3.485095674241419e-8,0.001640679685853359,-4.645083249127904e-5,3.494018708827335e-8,0.0016410627568417529,-4.657595311703952e-5,3.5032828146860476e-8,0.0016415385136823188,-4.665404102506928e-5,3.5085209016852697e-8,0.0016420712361589218,-4.6640593747802424e-5,3.506183028304087e-8,0.0016426066758982037,-4.651680204060536e-5,3.49483030632206e-8,0.0016430902029990438,-4.6296213477060036e-5,3.4756616314912035e-8,0.0016434846325752775,-4.601807762842053e-5,3.451956176891535e-8,0.0016437792010674768,-4.573164001443794e-5,3.4277753576294015e-8,0.0016439873944463735,-4.5480182565328244e-5,3.406648234300473e-8,0.0016441377649539473,-4.5291435015766347e-5,3.390791520498886e-8,0.0016442637177816871,-4.517553440841134e-5,3.38096166616314e-8,0.0016443960339398653,-4.512789702654878e-5,3.376713660815342e-8,0.0016445588953631549,-4.5133752929414504e-5,3.3767884966551584e-8,0.0016447684565497988,-4.517231429766106e-5,3.3794572068923304e-8,0.001645032669366525,-4.521994135279829e-5,3.382772789479797e-8,0.0016453514524502528,-4.5252519765481794e-5,3.3847558228796395e-8,0.0016457168505185967,-4.524759349498278e-5,3.38356608525806e-8,0.001646113327512554,-4.51867851078022e-5,3.3777059144320585e-8,0.0016465187233436285,-4.5058731090684236e-5,3.366270182651552e-8,0.0016469065595708819,-4.4862213010709696e-5,3.349209230451183e-8,0.0016472501485759548,-4.460855757214049e-5,3.327522050357837e-8,0.0016475282892311342,-4.43219688174928e-5,3.303267631530774e-8,0.001647731361928809,-4.40365769207798e-5,3.279298525555044e-8,0.0016478658173717641,-4.378990661504161e-5,3.2587010223876336e-8,0.001647955012278325,-4.361395560197095e-5,3.244050743190803e-8,0.0016480353368982224,-4.352634140384957e-5,3.236693816783387e-8,0.0016481481573200063,-4.352430208745986e-5,3.236282743263174e-8,0.0016483294908475749,-4.358362185466893e-5,3.240727442369534e-8,0.001648600066709863,-4.366323577305269e-5,3.2466074614676396e-8,0.0016489585077819739,-4.371486073861877e-5,3.249977289857885e-8,0.0016493799815096145,-4.369565905864213e-5,3.247396466644824e-8,0.0016498216574363398,-4.35805854427313e-5,3.236916312326058e-8,0.0016502342591044501,-4.337016148742985e-5,3.2186868815840264e-8,0.0016505762173780565,-4.309020706568123e-5,3.194909432152713e-8,0.0016508250968513124,-4.278317246005813e-5,3.1691092721698956e-8,0.0016509819009967624,-4.24946924788503e-5,3.1450271221881416e-8,0.0016510674183862332,-4.226105950962592e-5,3.125597438215787e-8,0.0016511135338679924,-4.210202576888828e-5,3.112374663814163e-8,0.0016511538874274358,-4.201993406387043e-5,3.105483497910188e-8,0.0016512170388640625,-4.200324771532353e-5,3.1039256218679945e-8,0.0016513230147448136,-4.2031673250908966e-5,3.106005739207479e-8,0.0016514824899899535,-4.2080862105879425e-5,3.109711887696447e-8,0.0016516973653265966,-4.212590433392133e-5,3.1129923067476226e-8,0.001651961729402234,-4.214373526750093e-5,3.113947244255304e-8,0.001652262709403183,-4.2115034434587586e-5,3.11098777670916e-8,0.001652581282236162,-4.20262355409554e-5,3.103010807540562e-8,0.001652893563089459,-4.1871968498026697e-5,3.089609413234407e-8,0.0016531733119630543,-4.165773999853627e-5,3.071294747399099e-8,0.001653396304072018,-4.1401950749318465e-5,3.0496512296258735e-8,0.0016535465337220673,-4.113559677284715e-5,3.027291157231968e-8,0.00165362283822673,-4.08978653952933e-5,3.007468972951524e-8,0.001653643051829214,-4.072709688518788e-5,2.993320892854408e-8,0.0016536425379715574,-4.064915069866908e-5,2.986905479463843e-8,0.0016536658656256423,-4.0667642322225216e-5,2.988415848613424e-8,0.0016537538623654171,-4.076077998128367e-5,2.995949305378407e-8,0.0016539310239152949,-4.088682206365838e-5,3.0059909699632935e-8,0.0016541982039326847,-4.099610396545309e-5,3.0144299811144e-8,0.0016545328263749025,-4.1044953793367646e-5,3.0177129842224954e-8,0.0016548957129889686,-4.100692229408898e-5,3.013755445295461e-8,0.0016552417765755723,-4.0878540058739154e-5,3.0023865014476645e-8,0.0016555313813681053,-4.0678744800547455e-5,2.985267628556814e-8,0.0016557394578348126,-4.0442706059349526e-5,2.965356616713717e-8,0.0016558602205119905,-4.0212091256584694e-5,2.9460936650144332e-8,0.0016559066064064827,-4.002467175107929e-5,2.9305507808049016e-8,0.0016559051411805651,-3.990618815504244e-5,2.9207810627581598e-8,0.0016558883208421219,-3.986641734804314e-5,2.9175190181454984e-8,0.0016558871094012825,-3.989970995789232e-5,2.920244204328383e-8,0.0016559255239323612,-3.9988717521732396e-5,2.9274958922300416e-8,0.0016560179934640134,-4.010939295998521e-5,2.9372803922459204e-8,0.0016561690600313398,-4.023567907279301e-5,2.947446435780696e-8,0.0016563744709726966,-4.0343077329543915e-5,2.9559704687070583e-8,0.0016566227473716701,-4.04110569171678e-5,2.9611550177314757e-8,0.0016568967011817656,-4.0424765170366424e-5,2.9617783814663727e-8,0.0016571748725286567,-4.03766005139679e-5,2.9572361572399208e-8,0.001657433277921752,-4.026798280415287e-5,2.9476932544257488e-8,0.0016576481341211992,-4.011122108290574e-5,2.9342315929308953e-8,0.0016578002161897344,-3.993068140079735e-5,2.918927620055278e-8,0.0016578808882250792,-3.97616016784514e-5,2.904730413787855e-8,0.0016578983842147038,-3.964455859766971e-5,2.894986463588264e-8,0.0016578810457861806,-3.961480375790006e-5,2.8925550308629004e-8,0.0016578735047228827,-3.968893422226867e-5,2.8987194852995764e-8,0.0016579242628156493,-3.985510074322592e-5,2.9124022121367424e-8,0.0016580686098759247,-4.007348282468502e-5,2.9302307407495906e-8,0.001658315212483153,-4.028875236110224e-5,2.9475907260284677e-8,0.0016586433615687947,-4.044883713349159e-5,2.9601907087753384e-8,0.0016590113970561915,-4.0520869931719907e-5,2.9653810852602028e-8,0.0016593709065407672,-4.049825768358674e-5,2.9627222749183985e-8,0.0016596801558158162,-4.039855087642855e-5,2.953777937619335e-8,0.0016599128451770951,-4.025546688761349e-5,2.9414208659192474e-8,0.001660061372670357,-4.010894002692455e-5,2.928985879812469e-8,0.0016601355508499426,-3.999598249842553e-5,2.9195098085642385e-8,0.0016601582578794414,-3.994386969418339e-5,2.9151836997324146e-8,0.0016601594601349523,-3.9966285990856224e-5,2.9170608546724392E-08,0.0016601699239930832,-4.006254573710791e-5,2.9250175101477995e-8,0.0016602158041532625,-4.021951416375853e-5,2.9379253301896273e-8,0.0016603149537395255,-4.041536412718664e-5,2.9539614735345927e-8,0.00166047527124585,-4.062408817363606e-5,2.970971399095024e-8,0.0016606948895783432,-4.081978853524619e-5,2.986812443718438e-8,0.0016609636296508186,-4.098007900947471e-5,2.9996308350286483e-8,0.0016612650174455234,-4.108841983012459e-5,3.0080601450579956e-8,0.0016615783991599132,-4.113565076063209e-5,3.01135932639863e-8,0.00166188105966781,-4.11211016170598e-5,3.009513534055636e-8,0.001662150531071203,-4.105352714493535e-5,3.0033097660775586e-8,0.0016623675379770072,-4.095183539624763e-5,2.994381510048298e-8,0.0016625201033940193,-4.0844962473662907e-5,2.98517361833591e-8,0.0016626087554811723,-4.0769446539057265e-5,2.9787188477707118e-8,0.0016626514160071732,-4.0762994359918156e-5,2.9780965991072815e-8,0.0016626848298044925,-4.0853432310140516e-5,2.9855291758414986e-8,0.0016627585180696237,-4.104557297078488e-5,3.001319945286181e-8,0.0016629196343020275,-4.1312810810254054e-5,3.023184378109478e-8,0.0016631936622173485,-4.1601319751516236e-5,3.046615302114082e-8,0.0016635717482644979,-4.1848343784879263e-5,3.0664058183648755e-8,0.0016640132555107746,-4.200576477773202e-5,3.0786057280139574e-8,0.0016644620386205267,-4.205590491481198e-5,3.0818301607812385e-8,0.001664866364125141,-4.201279974388258e-5,3.0773509768777413e-8,0.001665192705554029,-4.1912072651471524e-5,3.068227045198648e-8,0.0016654301308830564,-4.1797159168452974e-5,3.0581274453788686e-8,0.0016655875286445104,-4.170783384293948e-5,3.050359333944092e-8,0.001665687465604892,-4.167319984191924e-5,3.0472896827926416e-8,0.0016657594905155892,-4.170874776273719e-5,3.050124412626773e-8,0.0016658342301060726,-4.181625386895793e-5,3.058929521132896e-8,0.0016659386770511526,-4.1985505643195065e-5,3.0727965256502515e-8,0.0016660927790692734,-4.2197234556937535e-5,3.0900934221248055e-8,0.001666307394327278,-4.242676039351328e-5,3.108761361993264e-8,0.0016665836116936171,-4.2647885737481854e-5,3.1266263776837525e-8,0.0016669133750296294,-4.2836615240290816e-5,3.141699700450582e-8,0.0016672812040082632,-4.29742538784887e-5,3.1524353127941986e-8,0.001667666583854231,-4.3049585079543835e-5,3.157918783389978e-8,0.0016680466219054927,-4.306016694156729e-5,3.1579840829446867e-8,0.0016683988209936053,-4.3012919060955386e-5,3.153264421759085e-8,0.0016687039684606657,-4.2924075892586436e-5,3.145177637443578e-8,0.001668949248977301,-4.281847186208641e-5,3.135844372913255e-8,0.001669131786259909,-4.272775819299064e-5,3.127914542178871e-8,0.0016692623804481766,-4.268653070428464e-5,3.1242302733313314e-8,0.0016693680627836978,-4.272526972232355e-5,3.1272440060728026e-8,0.0016694908319522278,-4.286013130087455e-5,3.138195636848311e-8,0.0016696795079151228,-4.3082236687797025e-5,3.156257050561017e-8,0.0016699738397906113,-4.335263606913009e-5,3.178138863954782e-8,0.0016703860640257925,-4.3610062290433165e-5,3.1987399692878435e-8,0.0016708909850968417,-4.3792311883293744e-5,3.212916881254575e-8,0.0016714333005318656,-4.3861116917503015e-5,3.217546090751692e-8,0.0016719492822700806,-4.3815726814167675e-5,3.2126524444803504e-8,0.0016723897475633752,-4.368843070089595e-5,3.201025739742718e-8,0.0016727324810957033,-4.352796787840965e-5,3.1868119479992646e-8,0.0016729818078562674,-4.338203342372647e-5,3.174024705968066e-8,0.001673160510358554,-4.3286058936851166e-5,3.165596355869807e-8,0.0016733001997954202,-4.325918304672302e-5,3.1630534790235667e-8,0.0016734335563792723,-4.3305040518058526e-5,3.166611119385737e-8,0.0016735892269826305,-4.3414715646800075e-5,3.1754482304429493e-8,0.0016737888324904195,-4.357023755789901e-5,3.188016234879414e-8,0.0016740453537005702,-4.3748057320064645e-5,3.202330368510447e-8,0.0016743624861162748,-4.392241829557162e-5,3.216241408654458e-8,0.0016747348092937828,-4.406860454410632e-5,3.227695616684352e-8,0.0016751487805059524,-4.416603666815915e-5,3.234987839857888e-8,0.001675584637718124,-4.420100590072595e-5,3.236992864406305e-8,0.0016760191120139118,-4.4168658691226686e-5,3.23333885762874e-8,0.0016764286255676625,-4.407397693962139e-5,3.224493873197347e-8,0.0016767926831136699,-4.393169599546051e-5,3.211753662941352e-8,0.001677097237930815,-4.3765093105344423e-5,3.197123217472216e-8,0.00167733777658621,-4.360358105039846e-5,3.183091478114156e-8,0.001677521869398556,-4.347902774846859e-5,3.172303510741116e-8,0.0016776707408900074,-4.342049118287758e-5,3.167116295241453e-8,0.0016778187422698135,-4.3447130391136005e-5,3.1690241873688606e-8,0.0016780089503785252,-4.3560098509420256e-5,3.178016652122048e-8,0.0016782833720448765,-4.373614563117936e-5,3.192080369790514e-8,0.0016786683666438333,-4.3927655024510755e-5,3.207221484054373e-8,0.001679160369115784,-4.407367191046424e-5,3.2183808817329206e-8,0.0016797209875307913,-4.412114009758808e-5,3.221188471697183e-8,0.0016802880403294148,-4.404672142738793e-5,3.213771971384632e-8,0.001680798773740542,-4.386597338792192e-5,3.197519004817064e-8,0.0016812121713359505,-4.362439078443936e-5,3.176318558267004e-8,0.0016815186777889915,-4.337739128303645e-5,3.1548644038694827e-8,0.0016817358173011794,-4.317163234212843e-5,3.137068706839119e-8,0.0016818964774662018,-4.303518866881324e-5,3.125235326029229e-8,0.0016820373053456571,-4.2976515779093504e-5,3.1199916976096325e-8,0.0016821908517579908,-4.298835334932385e-5,3.120645643391533e-8,0.001682381643870257,-4.305295001771544e-5,3.125647495228362e-8,0.0016826248641123465,-4.314669659029766e-5,3.1329875743603594e-8,0.0016829262935964223,-4.3243765750394774e-5,3.1404959032322505e-8,0.0016832827993444842,-4.3319058823132525e-5,3.1460773886099394e-8,0.0016836831808576592,-4.335081474193989e-5,3.147921387142313e-8,0.0016841094761317773,-4.332309858073908e-5,3.144709006843145e-8,0.0016845389965708768,-4.322812581928537e-5,3.1358136502702837e-8,0.0016849472827916928,-4.30680097516396e-5,3.121454317459761e-8,0.001685311817324549,-4.28553785051464e-5,3.102747616737498e-8,0.0016856160259362443,-4.2612465496661675e-5,3.081620600067579e-8,0.0016858529647612876,-4.2368472572295754e-5,3.060568908899294e-8,0.0016860279929869306,-4.2155252212118004e-5,3.042272064814904e-8,0.0016861597397253318,-4.2001707138160697e-5,3.029110352696416e-8,0.001686278802546357,-4.192753075558542e-5,3.0226450956112963e-8,0.0016864236511896307,-4.1937096150845514e-5,3.023131644925384e-8,0.0016866333005143353,-4.20148809990313e-5,3.029172471873377e-8,0.0016869370383114897,-4.212468985170035e-5,3.0376837396555156e-8,0.0016873432300061099,-4.221528826700933e-5,3.0443795692792346e-8,0.0016878316433975797,-4.223370069387507e-5,3.044875659726567e-8,0.0016883549945588567,-4.214339067565662e-5,3.0361907947096335e-8,0.0016888524992501178,-4.193939125212146e-5,3.017996755366323e-8,0.0016892708942925403,-4.165129888299081e-5,2.992858118803242e-8,0.0016895823148465297,-4.1331399559831654e-5,2.9652240492607542e-8,0.0016897900659125485,-4.103474076847829e-5,2.9397395175287495e-8,0.0016899216625505006,-4.080203475990938e-5,2.919799465346154e-8,0.0016900157054978312,-4.0652031392961096e-5,2.906915313908238e-8,0.0016901099208097574,-4.058288462987776e-5,2.900853004866035e-8,0.0016902339270298944,-4.057817378667731e-5,2.900165126974593e-8,0.0016904065626526063,-4.061354355146046e-5,2.9027644312851774e-8,0.0016906360051758417,-4.0661950119559325e-5,2.9063648467584324e-8,0.0016909209995482196,-4.069723028481099e-5,2.9087710885649258e-8,0.0016912522654108416,-4.069653884596306e-5,2.9080721860103752e-8,0.0016916138646757722,-4.064230977992161e-5,2.9028017183053914e-8,0.0016919847467131485,-4.052416230559773e-5,2.8921020015667242e-8,0.0016923408945919195,-4.034078146507427e-5,2.8758904768726176e-8,0.0016926584456100585,-4.0101338254094135e-5,2.854984370404633e-8,0.0016929177886920088,-3.98256830559316e-5,2.8311126828899853e-8,0.001693108077881154,-3.954252987433632e-5,2.8067479641023334e-8,0.0016932310746483276,-3.928519728252996e-5,2.7847258747180767e-8,0.0016933029691601435,-3.908519792267514e-5,2.767686433700739e-8,0.0016933530634665743,-3.896487647791898e-5,2.7574483226122663e-8,0.0016934189419301243,-3.893091195901987e-5,2.7544749748504323e-8,0.0016935386906464923,-3.897054727601237e-5,2.7575867805514548e-8,0.001693741560057379,-3.905203356829756e-5,2.7640332995878002e-8,0.0016940391412425884,-3.9130122676386634e-5,2.7699808677760945e-8,0.0016944196388182435,-3.9156405028759944e-5,2.7713881316001143e-8,0.0016948479443695268,-3.909270277009998e-5,2.7651188701418565e-8,0.0016952732925359264,-3.892369137957591e-5,2.749979593321849e-8,0.0016956435737868081,-3.8663481150373246e-5,2.7272496371780773e-8,0.001695921508217519,-3.835205250275875e-5,2.7003629854952092e-8,0.0016960956761315402,-3.804202367397545e-5,2.67378143191e-8,0.0016961815319577094,-3.778160361537539e-5,2.6515529524935576e-8,0.001696213032473906,-3.7601416121365983e-5,2.6362069074866936e-8,0.0016962301457196613,-3.750973613700963e-5,2.628370233701135e-8,0.0016962680770975457,-3.749551816840239e-5,2.627045669394839e-8,0.0016963512376621233,-3.753538910232288e-5,2.63021853253086e-8,0.0016964917453452192,-3.7600818583413475e-5,2.635465438290942e-8,0.001696690651419292,-3.766350660714986e-5,2.6404007688425848e-8,0.001696940137771745,-3.769874102950349e-5,2.642947829630893e-8,0.0016972256658882062,-3.7687335396604675e-5,2.6414948818137022e-8,0.0016975277902204365,-3.761694740849289e-5,2.635007890531258e-8,0.001697823895555182,-3.7483365373189244e-5,2.6231474474216885e-8,0.0016980904064073249,-3.729186542931282e-5,2.6063916854335785e-8,0.0016983059629982868,-3.705818431813839e-5,2.5861193564983613e-8,0.00169845567523588,-3.6808209557159376e-5,2.5645733638452276e-8,0.0016985358748413822,-3.6575286342219624e-5,2.544614117888997e-8,0.0016985578725676185,-3.6394393189292205e-5,2.5292069524213555e-8,0.0016985486004877865,-3.629367901585675e-5,2.5206946956193076e-8,0.001698546470920179,-3.628561471787852e-5,2.5200532434859682e-8,0.0016985925376170278,-3.6361141746669543e-5,2.5264171502710526e-8,0.0016987192823167937,-3.648970911878939e-5,2.537113473313952e-8,0.0016989407603901555,-3.66260131869023e-5,2.548261022146134e-8,0.0016992475797464068,-3.672165020583402e-5,2.5557724392811732e-8,0.0016996084606618878,-3.673811638230782e-5,2.5564517650592807e-8,0.001699977956475142,-3.6657310285023185e-5,2.5488638588697726e-8,0.0017003082070326627,-3.648654916289649e-5,2.5337305501061796e-8,0.001700561508238771,-3.625653060246809e-5,2.5137301531646965e-8,0.0017007199892369825,-3.601259358681587e-5,2.492738326789755e-8,0.0017007892677775634,-3.580192599678626e-5,2.474739066190967e-8,0.0017007949978842718,-3.566104751616369e-5,2.462773297309177e-8,0.0017007740285271689,-3.560774970729352e-5,2.4582760104628268e-8,0.001700763881614479,-3.5639540723169225e-5,2.4609678123756305e-8,0.0017007942876682992,-3.5737747088271245e-5,2.4692199666377635e-8,0.0017008827935677405,-3.5874468764077714e-5,2.48064931342209e-8,0.0017010342865269056,-3.601946403066804e-5,2.4926953335125145e-8,0.0017012429683338664,-3.614526778038245e-5,2.503041713192252e-8,0.0017014952046849267,-3.623023427960677e-5,2.5098644185563178e-8,0.001701772238022168,-3.626002631665762e-5,2.5119562344499273e-8,0.0017020524196195597,-3.6228338899696296e-5,2.5087946189913077e-8,0.0017023131682198593,-3.613749747676565e-5,2.500601481098576e-8,0.0017025331952084945,-3.599911636755302e-5,2.488403054979358e-8,0.001702695545569224,-3.583443484893609e-5,2.4740519688495516e-8,0.001702791658995604,-3.567341761960704e-5,2.4601345097724025e-8,0.001702825905263925,-3.5551336305842663e-5,2.449660803475595e-8,0.0017028188818827854,-3.550180632355494e-5,2.4454604213756933e-8,0.001702806735149731,-3.5546798682885895e-5,2.4493348244526906e-8,0.0017028341827005904,-3.5686793861779424e-5,2.4612368548798255e-8,0.0017029417119942861,-3.589622192692521e-5,2.4789084250634145e-8,0.001703151464359933,-3.612826882154989e-5,2.4983140816697334e-8,0.0017034584180842351,-3.632857896050061e-5,2.514822835935455e-8,0.0017038313132765339,-3.645226816286234e-5,2.5246595649292e-8,0.0017042226379164888,-3.647699395454146e-5,2.5260079820686068e-8,0.0017045828447247262,-3.640761249596701e-5,2.5193854756660187e-8,0.0017048733046878682,-3.627237682470769e-5,2.5072903100127402e-8,0.0017050744960167964,-3.611354589471979e-5,2.4933747465570844e-8,0.0017051883610562926,-3.597597816658294e-5,2.4814589910546375e-8,0.0017052354342512147,-3.5896752180398834e-5,2.4746512664333185e-8,0.0017052482576193312,-3.589793749996182e-5,2.4747526264296278e-8,0.001705263072666433,-3.598363726072869e-5,2.482032549880074e-8,0.0017053119227668128,-3.614137236019604e-5,2.4953695706256513e-8,0.0017054169711461474,-3.6346798808851755e-5,2.5126630491637535e-8,0.001705587948875609,-3.656997064057401e-5,2.5313627491764613e-8,0.0017058225445119196,-3.678132058142517e-5,2.548965965479151e-8,0.0017061087821257628,-3.69561651974611e-5,2.563388881603951e-8,0.0017064282269366776,-3.70773600928232e-5,2.5731871018470053e-8,0.0017067591018042412,-3.713639521195745e-5,2.5776518819360373e-8,0.0017070789070781516,-3.71335783856623e-5,2.576833424327725e-8,0.001707366647808429,-3.7077896034809675e-5,2.5715344204894712e-8,0.0017076050669122245,-3.6986775316050295e-5,2.563286430776859e-8,0.0017077833482693745,-3.6885519284883346e-5,2.5542879446377526e-8,0.0017079005422884115,-3.6805662765103294e-5,2.547244983570222e-8,0.0017079692563718653,-3.678101653653675e-5,2.545019000338502e-8,0.0017080179220300188,-3.684031594380135e-5,2.549999137370553e-8,0.0017080887479602191,-3.699691368462634e-5,2.5632392147724558e-8,0.001708228641281455,-3.723898589582162e-5,2.583648649016691e-8,0.0017084735851781347,-3.752657719115359e-5,2.607763848747086e-8,0.0017088326289339622,-3.7800822890985845e-5,2.6305464895935834e-8,0.0017092809717665692,-3.800389880699946e-5,2.6470864658603684e-8,0.001709767617820864,-3.810010719756817e-5,2.6543979991628234e-8,0.0017102337850382358,-3.8086965178193554e-5,2.6523588534275293e-8,0.0017106319934249428,-3.799214504651016e-5,2.6434316445958196e-8,0.0017109375331463164,-3.786074079930412e-5,2.6315481437475767e-8,0.0017111503518974585,-3.774050858751181e-5,2.6208213356204093e-8,0.0017112901426587356,-3.767043065840216e-5,2.6145574168089167e-8,0.001711388473927356,-3.767435097338324e-5,2.6147233879245078e-8,0.0017114807478860903,-3.7759148181293965e-5,2.6218181852708225e-8,0.0017115993915441882,-3.791616629237784e-5,2.6350243451075947e-8,0.0017117688340202747,-3.812478479964005e-5,2.6525321161408846e-8,0.0017120025462314225,-3.8357269218783055e-5,2.671957407701288e-8,0.0017123022368902155,-3.858401705662783e-5,2.690781030939024e-8,0.0017126589667248331,-3.8778319536625255e-5,2.706742096037333e-8,0.0017130556713426438,-3.892000575518932e-5,2.718139609955358e-8,0.0017134704463890348,-3.8997637220543705e-5,2.72401837338603e-8,0.0017138799079658143,-3.900926090925543e-5,2.7242381927571813e-8,0.0017142621560916798,-3.896209930041389e-5,2.719452965369347e-8,0.0017145992769997747,-3.887164408049795e-5,2.7110327165076998e-8,0.0017148795732618073,-3.876038090260755e-5,2.7009443934541433e-8,0.0017150997739135154,-3.8656079592503165e-5,2.691587804537622e-8,0.0017152674011576832,-3.858919935674702e-5,2.6855564023675893e-8,0.001715402930080424,-3.858850645778573e-5,2.68525620088811e-8,0.0017155403030105689,-3.867411814540851e-5,2.6923223505940072e-8,0.001715723354598753,-3.884849496986257e-5,2.706875788258036e-8,0.0017159957908326042,-3.9088518326831626e-5,2.7268754434345864e-8,0.0017163851403779347,-3.9344697300168935e-5,2.748066663980295e-8,0.001716886993958065,-3.955318428218216e-5,2.7650053898035193e-8,0.0017174602847125158,-3.965909042471542e-5,2.773040269966326e-8,0.001718040134972025,-3.963938085916244e-5,2.770265841257851e-8,0.0017185625897166842,-3.9511228867599055e-5,2.758236823583223e-8,0.0017189868062355465,-3.932167724591736e-5,2.7410713552494807e-8,0.001719303790073166,-3.912724285345024e-5,2.7236765021706585e-8,0.0017195315916373054,-3.897569321704473e-5,2.710159348901865e-8,0.0017197039490144403,-3.889639604552238e-5,2.7029929542711243e-8,0.001719859026622647,-3.889874932274322e-5,2.7028998797406246e-8,0.0017200313178398767,-3.897534491821806e-5,2.7091549749431207e-8,0.0017202469671751624,-3.910684938799904e-5,2.7200319928931065e-8,0.001720521602018453,-3.926695176135516e-5,2.7332412797781222e-8,0.001720859794259045,-3.942689817955544e-5,2.7463158757262513e-8,0.001721255728863236,-3.955955466122989e-5,2.756947544016638e-8,0.0017216948873827532,-3.9642868900642176e-5,2.7632707506931933e-8,0.001722156569161592,-3.966254350579579e-5,2.764085344336467e-8,0.0017226170439005363,-3.9613697538888915e-5,2.7590003469533287e-8,0.001723052976870324,-3.9501301872358064e-5,2.7484764624405265e-8,0.0017234446600947672,-3.933941901930363e-5,2.733763268972299e-8,0.001723778754377761,-3.914951517199835e-5,2.7167486552635708e-8,0.0017240504576373702,-3.8958063040786535e-5,2.6997386666773607e-8,0.0017242650711087881,-3.8793531002493264e-5,2.6851810256787167e-8,0.0017244389431611393,-3.868270733259092e-5,2.675337383241879e-8,0.0017245995113033862,-3.864602832841346e-5,2.671885005626151e-8,0.0017247834536315045,-3.8691681327300336e-5,2.6754311849929e-8,0.0017250313802367769,-3.880929377612953e-5,2.6850034141866425e-8,0.001725377842565471,-3.896581169015178e-5,2.697723630726428e-8,0.0017258375470063556,-3.910800396460535e-5,2.7090318371162557e-8,0.0017263930836693708,-3.917572346874251e-5,2.7138107085967308e-8,0.0017269933872087041,-3.912436180795919e-5,2.7082925689746156e-8,0.0017275689865215494,-3.8945638522437385e-5,2.691835379492017e-8,0.0017280585048235183,-3.86727214245852e-5,2.6673635556659343e-8,0.001728431073422244,-3.836534884152783e-5,2.6400818438587404e-8,0.0017286923868734853,-3.808504387510162e-5,2.61532106623058e-8,0.0017288748816655678,-3.787530232705404e-5,2.5968120288942417e-8,0.0017290217154868146,-3.7754199534558863E-05,2.5860493154658515e-8,0.0017291734675064128,-3.771726995413944e-5,2.582562501534354e-8,0.0017293607820238672,-3.7744848247661723E-05,2.584579636728525e-8,0.001729602000315515,-3.780948874960963e-5,2.5896883802857644e-8,0.001729903599395464,-3.788165973355425e-5,2.595331727889163e-8,0.0017302617181777903,-3.7933690493989186e-5,2.5991389794231897e-8,0.0017306640141175572,-3.794259510943676e-5,2.5991547940454676e-8,0.001731091755867424,-3.789224556048095e-5,2.594015958103042e-8,0.001731522255539111,-3.7775051882364856e-5,2.5830937167328825e-8,0.0017319317604426708,-3.7593037290670407e-5,2.5665905426726304e-8,0.0017322987686243735,-3.735795299004614e-5,2.545555029736884e-8,0.0017326074067128012,-3.709011144855787e-5,2.5217806685687195e-8,0.0017328503457029842,-3.6815919057722917e-5,2.4975834819967113e-8,0.001733030801250284,-3.6564297546596944e-5,2.4754770932095832e-8,0.001733163245050693,-3.636230112525841e-5,2.4577788776660804e-8,0.0017332725692263016,-3.6230386059595666e-5,2.446195888578073e-8,0.001733391561335409,-3.6177777041230204e-5,2.4414354594100277e-8,0.0017335564073636222,-3.619837183913728e-5,2.4428778625296542e-8,0.001733799814146551,-3.626816379255833e-5,2.4483858210644657e-8,0.0017341419144584454,-3.634606741287226e-5,2.454398795466479e-8,0.0017345806750870597,-3.638048933612316e-5,2.4565021790145197e-8,0.0017350858869240476,-3.632295309658755e-5,2.4505843202086038e-8,0.0017356024788424108,-3.614624025006184e-5,2.4343764994910206e-8,0.0017360663216553012,-3.585874629062718e-5,2.408675934782713e-8,0.0017364275421104804,-3.550486845228883e-5,2.377374351553505e-8,0.001736668888599713,-3.514850340937432e-5,2.34602712311622e-8,0.001736808661045457,-3.4848567953173e-5,2.3197265336036242e-8,0.001736888544939611,-3.464037865199596e-5,2.301485336433552e-8,0.0017369558513605297,-3.4530440416808935e-5,2.29179595201377e-8,0.001737049707092597,-3.4502354376221574e-5,2.289165624475731e-8,0.0017371947516276504,-3.4526982344086895e-5,2.2910199010581445e-8,0.0017374008073448293,-3.4571512886728264e-5,2.2944984052831473e-8,0.001737665467048844,-3.460545560147143e-5,2.2969695297045837e-8,0.001737977290689824,-3.460390307791772e-5,2.296299541437974e-8,0.0017383186141002541,-3.454918032334136e-5,2.290982677063709e-8,0.0017386679295325906,-3.4431804356590167e-5,2.2802188582601254e-8,0.0017390021734525031,-3.42511906097866e-5,2.2639776047910924e-8,0.0017392992945751758,-3.40160914722638e-5,2.243042545250072e-8,0.0017395413117880889,-3.374434814309473e-5,2.2189933916874547e-8,0.0017397176600680104,-3.346135952529788e-5,2.1940688488459516e-8,0.0017398281621878566,-3.319689225605055e-5,2.170877243418754e-8,0.0017398847366847004,-3.2980307378858836e-5,2.1519663391740078e-8,0.00173991100205662,-3.283480466826047e-5,2.1393128136041958e-8,0.0017399392899709579,-3.27718231350248e-5,2.1338379242105724e-8,0.00174000521831946,-3.278698042141254e-5,2.1350723083240454e-8,0.001740140572588363,-3.285870325852261e-5,2.1410652793135758e-8,0.0017403655886877377,-3.295034303669861e-5,2.1485963701877946e-8,0.0017406820927880144,-3.301629939579607e-5,2.153721791335664e-8,0.0017410695269251995,-3.301209684177935e-5,2.152643905078453e-8,0.001741486310794703,-3.290702867540473e-5,2.1427864745405244e-8,0.0017418784545159788,-3.269589869418132e-5,2.1237862433750336e-8,0.0017421948525763043,-3.2404476839655194e-5,2.097945465702013e-8,0.001742404370709457,-3.208389090653782e-5,2.069734831489266e-8,0.001742506671572139,-3.179415040864402e-5,2.0443603476147352e-8,0.0017425307722198473,-3.158389373995162e-5,2.0260073766504838e-8,0.0017425223974869423,-3.147622681133658e-5,2.0166207874633754e-8,0.0017425275508909542,-3.146622368211866e-5,2.0157058325399752e-8,0.0017425801811898768,-3.152827253738807e-5,2.020986020759265e-8,0.0017426972860252556,-3.162719052466486e-5,2.02938080720638e-8,0.001742880085460341,-3.172780363660379e-5,2.0378372619537326e-8,0.001743118076178938,-3.180084546028723e-5,2.0438317988914532e-8,0.0017433934077427334,-3.1825558838409014e-5,2.045583270732787e-8,0.0017436844082488409,-3.179033969714021e-5,2.0421013873564265e-8,0.001743968178512343,-3.169263001235832e-5,2.0331783624667846e-8,0.0017442227209409098,-3.153871728518193e-5,2.0193782525411485e-8,0.0017444291701622036,-3.134350069999404e-5,2.002022746940685e-8,0.0017445744879534223,-3.112978763186553e-5,1.9831294365844262e-8,0.0017446545474839863,-3.092639446856581e-5,1.9652370870985962e-8,0.0017446769299296102,-3.0764373350770444e-5,1.9510621046903156e-8,0.0017446621867443558,-3.067120727891532e-5,1.9429795770389297e-8,0.001744642159515886,-3.066382603124781e-5,1.9424111620866493e-8,0.0017446545782597647,-3.074243219545489e-5,1.9492972810802038e-8,0.0017447345609175441,-3.088764647827402e-5,1.961870511808151e-8,0.0017449051754598907,-3.106281392238331e-5,1.9768826171514667e-8,0.0017451700230479688,-3.122163105108318e-5,1.9902887093021913e-8,0.001745510408947374,-3.1319374667683715e-5,1.9982307573413395e-8,0.001745888357283682,-3.1324766347923475e-5,1.998060209584599e-8,0.0017462551360621196,-3.122919694479231e-5,1.989118907219179e-8,0.0017465634988662125,-3.105046157655002e-5,1.9730384470556232e-8,0.001746780545164631,-3.0829192817083005e-5,1.9534083265630877e-8,0.0017468971763283654,-3.06181089004315e-5,1.9348284579479396e-8,0.0017469304559974707,-3.0466979567041213e-5,1.921600927524104e-8,0.001746917542182514,-3.0408580265584186e-5,1.916519343229281e-8,0.001746903536584843,-3.0450937289348743e-5,1.9202135362128732e-8,0.0017469283478326418,-3.057824727716383e-5,1.931250208156185e-8,0.0017470175401144699,-3.075870969388561e-5,1.9468283092315117e-8,0.0017471793662891689,-3.095489208974001e-5,1.9636835355944387e-8,0.00174740696584924,-3.1132521919019314e-5,1.978845734405289e-8,0.0017476831047323403,-3.126577909856488e-5,1.9900875698021727e-8,0.0017479851225330183,-3.1339285687671686e-5,1.9960887050540934e-8,0.0017482888771933986,-3.134799753916344e-5,1.9964247391127438e-8,0.001748571500534339,-3.1296247023240655e-5,1.9914888607216414e-8,0.0017488134063673208,-3.1196725784627565e-5,1.9824099003596076e-8,0.0017490001909731922,-3.106955308858083e-5,1.970973106837139e-8,0.0017491248720657058,-3.0941022082626086e-5,1.9595042768266226e-8,0.0017491904664698418,-3.084128927975832e-5,1.9506546090950694e-8,0.0017492122725144203,-3.080019758367981e-5,1.9470218613974216e-8,0.0017492184473760612,-3.084086291599031e-5,1.950583763271849e-8,0.0017492470171063378,-3.097194995726486e-5,1.9620297100766168e-8,0.0017493381646387358,-3.1181363894115793e-5,1.980227981843363e-8,0.0017495228601829887,-3.143510381205071e-5,2.0021485851797534e-8,0.0017498116793050868,-3.168386290175472e-5,2.023458425088819e-8,0.0017501889553554505,-3.18764773563137e-5,2.039704390946832e-8,0.001750615655745262,-3.197543249573554e-5,2.0476649055390935e-8,0.0017510402683068693,-3.1968199999134966e-5,2.0463276536587624e-8,0.0017514133531797574,-3.187031880307763e-5,2.037138563020928e-8,0.0017517005273633118,-3.1719998107685436e-5,2.0235063634656074e-8,0.001751890219662361,-3.156694813316782e-5,2.009806183335921e-8,0.0017519948081852045,-3.1459214757831945e-5,2.0002203745109712e-8,0.0017520456413406555,-3.14316280501743e-5,1.99773642676767e-8,0.001752083843670919,-3.149863525213701e-5,2.0035412948970665e-8,0.0017521497040240116,-3.1652918673865666e-5,2.0169255510395947e-8,0.0017522736069611874,-3.186951297035694e-5,2.0356620338662876e-8,0.0017524707370152176,-3.211356229077129e-5,2.056690037038114e-8,0.0017527403103441905,-3.234896981308914e-5,2.076865466262888e-8,0.0017530684808992239,-3.254545176213017e-5,2.0935651692450514e-8,0.0017534331318351181,-3.2682714956734884e-5,2.1050408448247448e-8,0.0017538088119477358,-3.275180452227584e-5,2.110531752462392e-8,0.0017541707526388716,-3.275447431229004e-5,2.1102114748483773e-8,0.0017544976901405082,-3.270162706579011e-5,2.105056824283674e-8,0.0017547738024637697,-3.2611589026689284e-5,2.096699993899653e-8,0.0017549902985381242,-3.250844445279376e-5,2.0872790992964694e-8,0.001755147084288628,-3.242014951493518e-5,2.0792620166438958e-8,0.001755254570490484,-3.2375793594230804e-5,2.0751927960372814e-8,0.001755335063281145,-3.2401220502996406e-5,2.0772996896363735e-8,0.0017554223357314845,-3.251259859283147e-5,2.0869356621329078e-8,0.0017555573977173214,-3.2708863724273736e-5,2.1039332104000612e-8,0.0017557790984082053,-3.29660727723672e-5,2.126132814313656e-8,0.0017561108323753565,-3.3238262436040336e-5,2.1494763264115556e-8,0.0017565485849542516,-3.346811995275699e-5,2.1689479904005575e-8,0.0017570576145160576,-3.360552772869162e-5,2.1801953478252693e-8,0.001757581785070488,-3.362585143779291e-5,2.1811245999041253e-8,0.0017580620722044517,-3.353851148587489e-5,2.1726427797049774e-8,0.001758455202278241,-3.3382035778471196e-5,2.158208310470156e-8,0.0017587444079113072,-3.320959575010596e-5,2.1425399176948597e-8,0.0017589399770165945,-3.307263661221911e-5,2.130160656072588e-8,0.0017590722808459125,-3.3008502295315075e-5,2.1243072677899854e-8,0.001759181556547813,-3.3034286998855964e-5,2.1264051244620618e-8,0.0017593078653479616,-3.314644102862432e-5,2.1360602034657684e-8,0.0017594831921096522,-3.332452486865661e-5,2.1514143545573805e-8,0.0017597265437465275,-3.353738875474003e-5,2.1697021326259336e-8,0.001760042245970357,-3.3750244753001815e-5,2.1878713640531822e-8,0.001760421146334321,-3.393124357669487e-5,2.2031497920959415e-8,0.0017608439638752132,-3.405644801825657e-5,2.2134681640893213e-8,0.0017612857471203435,-3.411264048046515e-5,2.2176972713998292e-8,0.0017617204091223166,-3.409797973084421e-5,2.2157031793999206e-8,0.0017621245438929386,-3.402096746414191e-5,2.208259287114386e-8,0.0017624801775086999,-3.3898450706873454e-5,2.1968740632231774e-8,0.0017627765982876126,-3.3753300304850276e-5,2.183585863215288e-8,0.001763011621842634,-3.3612016549370004e-5,2.1707446371806972e-8,0.0017631925713161728,-3.350214912888116e-5,2.1607729651469524e-8,0.0017633370417948848,-3.344913871513708e-5,2.1558783250075647e-8,0.0017634730174059953,-3.347197967528787e-5,2.1576714714329268e-8,0.0017636371116576798,-3.357742597786236e-5,2.1666704084487572e-8,0.0017638691979690627,-3.3753723774377576e-5,2.181772916999189e-8,0.0017642023031790117,-3.396680513750332e-5,2.1999445627985694e-8,0.0017646491667109299,-3.4163476660183754e-5,2.2165086343053056e-8,0.0017651911849654452,-3.428501454789286e-5,2.226334653764835e-8,0.001765778160698935,-3.428858702670496e-5,2.2257091907866984e-8,0.0017663432093342334,-3.416606996623403e-5,2.213983656780172e-8,0.0017668269543614896,-3.3948415208319496e-5,2.193955489711035e-8,0.001767197842766506,-3.369259112538415e-5,2.17070724834961e-8,0.0017674586193811824,-3.34596154530708e-5,2.1496498412280247e-8,0.001767639060592299,-3.329574652596208e-5,2.1348468166328244e-8,0.0017677821871205088,-3.3223440312985864e-5,2.1282180173486558e-8,0.0017679311822968995,-3.324154570836546e-5,2.129578103953367e-8,0.001768120512436396,-3.333086353608994e-5,2.1371561635770116e-8,0.0017683715270797181,-3.346142626072527e-5,2.148260408851196e-8,0.0017686914318105862,-3.3599409128902524e-5,2.1598953117881766e-8,0.0017690744739801523,-3.371291615094851e-5,2.1692652330809286e-8,0.0017695045695388376,-3.3776430454713476e-5,2.1741529840179073e-8,0.0017699588242402324,-3.3773791444695706e-5,2.1731694812881347e-8,0.0017704114732510778,-3.369964876976124e-5,2.1658752122008647e-8,0.0017708378094016797,-3.355943690940463e-5,2.152778106353521e-8,0.0017712176390383754,-3.336799684118138e-5,2.1352151053456795e-8,0.0017715378651225137,-3.314720089247531e-5,2.1151437607701027e-8,0.0017717941126926234,-3.2923077927578334e-5,2.0948840418387312e-8,0.0017719915599731899,-3.272273093629134e-5,2.0768364307715262e-8,0.0017721450953806894,-3.257108279253322e-5,2.063183815712094e-8,0.001772278789586462,-3.248736044869667e-5,2.0555760321616602e-8,0.0017724243969323124,-3.2481099228891417e-5,2.0547838756955484e-8,0.0017726180377305497,-3.2547672204280884e-5,2.06032360891902e-8,0.001772893902096436,-3.26643881516983e-5,2.070137445010743e-8,0.0017732745145420026,-3.278970120097843e-5,2.0805422495871913e-8,0.0017737592672930375,-3.286910117515717e-5,2.0867510935645095e-8,0.0017743165104114895,-3.285007607212869e-5,2.0841794381781585e-8,0.0017748868641271837,-3.27030730663727e-5,2.0702786663879134e-8,0.0017754014530360297,-3.2437768348831866e-5,2.0459662686927267e-8,0.0017758080743716612,-3.2102608481630945e-5,2.015584789108212e-8,0.0017760903595036206,-3.17656634260758e-5,1.985200104905266e-8,0.0017762693117928238,-3.1488255206219554e-5,1.9602496536206447e-8,0.0017763894591366236,-3.13062590108772e-5,1.9438747273234566e-8,0.001776500414190258,-3.12255836885439e-5,1.9365283650061506e-8,0.0017766430268873303,-3.1228419406428315e-5,1.9365541425495753e-8,0.0017768429247380117,-3.128342719222774e-5,1.9411160162745227e-8,0.0017771097947912773,-3.1355028823638904e-5,1.9470365609482324e-8,0.0017774396800211817,-3.141000926638304e-5,1.9513809181670135e-8,0.0017778182926467716,-3.142162035464175e-5,1.951808140830944e-8,0.0017782244717445747,-3.137198226709649e-5,1.946769186203101e-8,0.0017786336024299082,-3.12533185341731e-5,1.9356066032986675e-8,0.0017790209705546684,-3.1068226775794e-5,1.9185763398043137e-8,0.0017793650121143564,-3.08290205222032e-5,1.8967926769402895e-8,0.001779650296646995,-3.055604937514018e-5,1.8720829744334336e-8,0.0017798698743530228,-3.0274995636721267e-5,1.846747256260845e-8,0.001780026632235612,-3.001344158238894e-5,1.8232467517967285e-8,0.0017801335374979842,-2.9797089846618077e-5,1.8038579085288705e-8,0.0017802127450977066,-2.964590951538579e-5,1.7903218620709243e-8,0.0017802935187865058,-2.9570467972433672e-5,1.783518762572123e-8,0.0017804088777299578,-2.9568714404354944e-5,1.7831942719272197e-8,0.0017805907080136712,-2.9623577448738986e-5,1.7877681205500904e-8,0.0017808630276179797,-2.97023326731302e-5,1.7943009994474517e-8,0.0017812337934054229,-2.97595557883807e-5,1.7987695659313328e-8,0.0017816872967592035,-2.9745687070046982e-5,1.7968220015004007e-8,0.0017821813976015835,-2.962172070135213e-5,1.7850629717166458e-8,0.0017826548299887984,-2.9376324177287026e-5,1.762553130680372e-8,0.0017830461959892749,-2.903634032102028e-5,1.731731488754778e-8,0.0017833176117902473,-2.866124927995671e-5,1.6979208783705445e-8,0.001783469533852475,-2.832122375637814e-5,1.6673724822837606e-8,0.0017835376035968266,-2.80706105762117e-5,1.6448993998207882e-8,0.0017835749164607615,-2.793168172891396e-5,1.6324306949224888e-8,0.0017836317390693452,-2.7894493168831586e-5,1.6290136262871556e-8,0.0017837425116183111,-2.7927737072698468e-5,1.6318029727125984e-8,0.0017839222251040216,-2.7991952248573566e-5,1.6372552649405453e-8,0.0017841690180765415,-2.804960543379875e-5,1.6420305148628225e-8,0.0017844690921453375,-2.8070762770376914e-5,1.6434881896134044e-8,0.001784801494145308,-2.803540319002629e-5,1.6398785045025665e-8,0.0017851419554334824,-2.7933929717305372e-5,1.6303760303012625e-8,0.0017854659718042635,-2.7766907604290468e-5,1.6150522430904983e-8,0.0017857515136427459,-2.7544366750350456e-5,1.5948164497142894e-8,0.0017859816002243757,-2.7284609584283965e-5,1.571315251966609e-8,0.0017861467536977667,-2.7012260273114013e-5,1.5467614316026404e-8,0.0017862470230057806,-2.6755286369400636e-5,1.5236648496569402e-8,0.0017862930134701384,-2.654104265296623e-5,1.504470406978934e-8,0.001786305424195102,-2.6391773125555355e-5,1.491146539228525e-8,0.0017863128449208082,-2.6320220335777346e-5,1.4847885035371189e-8,0.0017863478278571186,-2.632612309632168e-5,1.4853112441925018e-8,0.0017864415524204687,-2.639440009895842e-5,1.491303463720827e-8,0.0017866176433893105,-2.649564870787032e-5,1.500094022968379e-8,0.0017868858723667914,-2.6589505322540724e-5,1.5080702406757717e-8,0.0017872368982414784,-2.66314436018206e-5,1.5112903973863852e-8,0.0017876399981771522,-2.6583121415397484e-5,1.5063969741293373e-8,0.0017880463839678022,-2.6424855833963814e-5,1.4917086903880453e-8,0.0017884001103203367,-2.61662566626825e-5,1.4681479769128718e-8,0.0017886554421320897,-2.5848825556468653e-5,1.439459563665528e-8,0.0017887942451537537,-2.5535601758596886e-5,1.4112816495281188e-8,0.0017888338091817063,-2.5289736988679483e-5,1.3892330893168733e-8,0.0017888195185604239,-2.515213106178181e-5,1.3769205429052592e-8,0.0017888063464290775,-2.5129846263159923e-5,1.3749151498984439e-8,0.0017888398156686227,-2.5199537269306553e-5,1.3810764966794239e-8,0.0017889451574657782,-2.5320670226036306e-5,1.391749936516575e-8,0.0017891262814678304,-2.544988601042015e-5,1.4030567902762325e-8,0.0017893708634015488,-2.5550922719877188e-5,1.4117760285831568e-8,0.0017896570726811836,-2.5599109255723216e-5,1.4157333008626661e-8,0.0017899592671993573,-2.5582042811262578e-5,1.4138489270469296e-8,0.0017902519438446774,-2.5498478260559e-5,1.4060321791036643e-8,0.0017905123629933307,-2.535677868794753e-5,1.3930440496755607e-8,0.0017907225488373376,-2.51734072821892e-5,1.3763682625522863e-8,0.0017908711693659085,-2.4971322438834654e-5,1.3580725771725944e-8,0.0017909554371954345,-2.4777821665357153e-5,1.3406151734326352e-8,0.0017909827283962571,-2.462135499749847e-5,1.3265522508586063e-8,0.001790971202300491,-2.4527148765017287e-5,1.3181360162542386e-8,0.0017909485628708425,-2.4512064252896147e-5,1.316846906372442e-8,0.0017909483769799933,-2.457975629539259e-5,1.3229610662378395e-8,0.0017910040460442844,-2.4717652977466054e-5,1.3352913035006776e-8,0.001791141441592685,-2.4897216452611835e-5,1.3512291120867038e-8,0.0017913719494893788,-2.5078198784446382e-5,1.367144672572904e-8,0.0017916878464235458,-2.5216509648907783e-5,1.3791025050547342e-8,0.0017920615866127356,-2.5274345945545365e-5,1.3837668829362787e-8,0.0017924499408709218,-2.5230505604992228e-5,1.3793113821811035e-8,0.001792803043549295,-2.508822447015411e-5,1.3660997294053245e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_16.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_16.json deleted file mode 100644 index 5dc87294..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_16.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":16000,"numberOfSamples":1000,"samples":[0.0017930770944964171,-2.487756201187732e-5,1.3468791504217692e-8,0.0017932476264231187,-2.464987080068864e-5,1.3262714904077391e-8,0.0017933184724985877,-2.446409956071231e-5,1.3095425337680572e-8,0.0017933216314600794,-2.436869143477916e-5,1.3009865564682467e-8,0.0017933067138776958,-2.438639601001157e-5,1.3025800857085489e-8,0.0017933242278720884,-2.450889654783832e-5,1.3135191695059903e-8,0.0017934104016406212,-2.470298517826634e-5,1.330788790362845e-8,0.0017935796118112995,-2.4923857068963115e-5,1.35036193070344e-8,0.0017938254296263332,-2.512860398380717e-5,1.3684062401894767e-8,0.001794127049257825,-2.5285096932882215e-5,1.3820701756483629e-8,0.0017944568919538132,-2.537530987356056e-5,1.389769075082024e-8,0.0017947867111250417,-2.5394724503292413e-5,1.3911234845185292e-8,0.0017950914943699093,-2.5349982163249467e-5,1.3867468677974076e-8,0.0017953516485814604,-2.5256290869559507e-5,1.3780165902829643e-8,0.0017955543110713956,-2.513520274015715e-5,1.3668792904120013e-8,0.0017956944918898108,-2.501264398241291e-5,1.3556752559378335e-8,0.0017957763330320648,-2.4916631576514276e-5,1.3469287614057573e-8,0.0017958142078399008,-2.487403171878831e-5,1.343048298157746e-8,0.0017958328475770424,-2.4906014603702265e-5,1.3459107884232579e-8,0.001795865353512456,-2.5022541802827092e-5,1.3563657130380593e-8,0.001795948122041468,-2.521726303763574e-5,1.3737855679584164e-8,0.0017961127345561176,-2.546517299188524e-5,1.395871521848886e-8,0.0017963766324439366,-2.572537619201675e-5,1.4189187885469435e-8,0.0017967359302593923,-2.5949711291697144e-5,1.4386024761031048e-8,0.0017971637506210216,-2.6095329969824996e-5,1.451109103127541e-8,0.0017976155937020869,-2.6137143168968956e-5,1.4542469045381444e-8,0.0017980404371389018,-2.607573723966647e-5,1.4481422712615806e-8,0.001798394095120732,-2.5938065908348892e-5,1.4352832525648934e-8,0.0017986508156540284,-2.5770774714917362e-5,1.4199014670934582e-8,0.0017988099091846071,-2.5628118914854457e-5,1.4068743101640252e-8,0.0017988956039585806,-2.555773604555096e-5,1.4004458068040699e-8,0.0017989500158965364,-2.558822796060149e-5,1.4031230788508505e-8,0.0017990211621026053,-2.5722340085414784e-5,1.415084222610123e-8,0.0017991498357205768,-2.593791853046823e-5,1.4342850551324464e-8,0.0017993597382745207,-2.6195968610161597e-5,1.4571956673982097e-8,0.0017996538157950808,-2.645239065855816e-5,1.4798559267271849e-8,0.0018000169294873425,-2.666894130169837e-5,1.498852497549383e-8,0.0018004224996779246,-2.6820193009237008e-5,1.5119328433877708e-8,0.0018008399579285909,-2.6895709367472842e-5,1.5181911626012463e-8,0.0018012407279650508,-2.6898643187987404e-5,1.5179375808053418e-8,0.0018016019580566775,-2.6842624017871885e-5,1.512418529733506e-8,0.0018019083507358257,-2.6748422125539742e-5,1.503519386765796e-8,0.0018021529000758112,-2.664111066735776e-5,1.4935106313335826e-8,0.0018023373010458653,-2.654770620791294e-5,1.4848328300519829e-8,0.0018024724205052492,-2.6494772143160663e-5,1.4798742963175621e-8,0.0018025786668415908,-2.6505317999914305e-5,1.4806850211476605e-8,0.0018026854955645365,-2.659451656531552e-5,1.4885891179718516e-8,0.0018028287921071594,-2.6764406036804033e-5,1.5037147763755564e-8,0.0018030448604636129,-2.6999007434058543e-5,1.5245693907824705e-8,0.0018033608554715635,-2.726276700041339e-5,1.5479157196478573e-8,0.0018037839756043577,-2.750560873314212e-5,1.5692371417557645e-8,0.0018042943907072807,-2.767567790489397e-5,1.583886014992919e-8,0.0018048471164087917,-2.7736268154231167e-5,1.5886025345858665e-8,0.0018053841995643509,-2.7679480289528892e-5,1.582737530167465e-8,0.0018058526507647669,-2.752969711011927e-5,1.5685558185452904e-8,0.001806220217685462,-2.73353380759272e-5,1.550478294473961e-8,0.0018064829196074033,-2.715336860705409e-5,1.533667607943918e-8,0.001806663117932587,-2.7033305913710596e-5,1.5225741546222746e-8,0.001806800801895628,-2.7005730814722615e-5,1.5199028506319084e-8,0.0018069420013151019,-2.7077300335566203e-5,1.5261811538653193e-8,0.0018071276684187964,-2.7232000211422743e-5,1.5398964117004876e-8,0.0018073853085648632,-2.7437165696606414e-5,1.5580585890886757e-8,0.0018077246572371043,-2.7652248535832284e-5,1.576998693661435e-8,0.0018081377800550024,-2.7838089562507862e-5,1.5932006675260243e-8,0.0018086029626342595,-2.7964541054522235e-5,1.603977518121356e-8,0.0018090908374324907,-2.8014926126988497e-5,1.607861859878816e-8,0.00180957084697334,-2.7986978508900445e-5,1.6046829753568754e-8,0.0018100165314672806,-2.7890983536707856e-5,1.5953965389800106e-8,0.0018104089137041853,-2.774636589803873e-5,1.5817776136232783e-8,0.0018107380434183873,-2.7577939639375955e-5,1.5660833269492737e-8,0.0018110032945058872,-2.7412588632335316e-5,1.5507519669488106e-8,0.0018112130984671998,-2.727650820984009e-5,1.5381492498527788e-8,0.0018113845185778008,-2.719266881496396e-5,1.5303331370154355e-8,0.0018115426463610783,-2.7177984586301253e-5,1.5287947407869493e-8,0.0018117192686648675,-2.7239724617485946e-5,1.5341380468993828e-8,0.001811949680932402,-2.7371212382235838e-5,1.545703888127489e-8,0.0018122663836599232,-2.754807176709037e-5,1.561247872864076e-8,0.0018126893601793177,-2.772785807579092e-5,1.57692019263019e-8,0.001813215168157243,-2.7856683016959833e-5,1.5878661656300398e-8,0.001813810503341971,-2.788443523714781e-5,1.589593222254393e-8,0.0018144169960900853,-2.7784424994027194e-5,1.5797369795099836e-8,0.0018149690546354657,-2.7567238609616395e-5,1.5593102180247856e-8,0.0018154173615913274,-2.7279217321055754e-5,1.532562475157829e-8,0.001815745477353155,-2.698524284095293e-5,1.5054105867581623e-8,0.001815971625884253,-2.674564379645672e-5,1.4833294082824518e-8,0.0018161376350310534,-2.6598869981665784e-5,1.4697715161200344e-8,0.0018162930699050063,-2.6555272801256695e-5,1.46561098570472e-8,0.0018164816791041126,-2.6600309925083196e-5,1.4694563048089877e-8,0.001816733162707175,-2.6702680190249542e-5,1.4784125685246063e-8,0.0018170600913158257,-2.682355433898887e-5,1.4889335877885533e-8,0.0018174585911996668,-2.6924764974141972e-5,1.4975656178105195e-8,0.0018179114635388195,-2.697514492077015e-5,1.5015123550887387e-8,0.0018183927840198378,-2.69547379106428e-5,1.499003182489609e-8,0.0018188731580403156,-2.6856711418009936e-5,1.4894556739454665e-8,0.001819324793629755,-2.6687029559253713e-5,1.473440683021408e-8,0.0018197256785068433,-2.6462277654925132e-5,1.4524849413287513e-8,0.001820062373922574,-2.6206258898886165e-5,1.428764312060864e-8,0.001820331254382838,-2.5946127881015275e-5,1.4047536963377575e-8,0.001820538445168254,-2.5708755861324498e-5,1.3828946837314153e-8,0.0018206989383891886,-2.5517624437804906e-5,1.365308557110985e-8,0.0018208352337955717,-2.5390152599451144e-5,1.3535489407026761e-8,0.0018209755912363625,-2.533520724364273e-5,1.34837573147026e-8,0.001821151632775928,-2.5350517985874814e-5,1.3495281869197622e-8,0.0018213945362785741,-2.5420047270152325e-5,1.3555011738893574e-8,0.0018217289276931587,-2.551235675360919e-5,1.363413439824075e-8,0.001822164406689718,-2.5582239942904856e-5,1.3691653129699898e-8,0.001822686655285152,-2.557849948022469e-5,1.3681411343723724e-8,0.0018232531039378613,-2.5459295222371094e-5,1.3565889406493894e-8,0.0018237998026180275,-2.5211254782313133e-5,1.3333435451442727e-8,0.0018242618025331551,-2.48617013791813e-5,1.300934477782622e-8,0.0018245988973076108,-2.4473013353101097e-5,1.2650735273151976e-8,0.0018248114805428112,-2.4119027032174727e-5,1.2325005783849212e-8,0.0018249369229238492,-2.3856916289854328e-5,1.2084104532181132e-8,0.0018250308362240503,-2.371030618670482e-5,1.1949100841989596e-8,0.001825146047330891,-2.366910915234589e-5,1.1910159201163204e-8,0.0018253190675345766,-2.3700474694523012e-5,1.1936747643950821e-8,0.0018255659145471929,-2.3762271034004848e-5,1.1990121606287427e-8,0.0018258842445968248,-2.3813805840709907e-5,1.2033166516185259e-8,0.001826258169929863,-2.382242826521537e-5,1.2036355717542334e-8,0.0018266634773100754,-2.3766769983762126e-5,1.1980573637170289e-8,0.001827072388230482,-2.363782080690576e-5,1.1857967699394822e-8,0.0018274577516185762,-2.343858881848419e-5,1.1671564450583e-8,0.0018277966526101797,-2.318264021823313e-5,1.1433927158541618e-8,0.0018280733241575382,-2.2891668446499556e-5,1.1164967072672481e-8,0.0018282811577905753,-2.259224023359341e-5,1.0889004337993399e-8,0.001828423551827078,-2.231201801919025e-5,1.0631321018346868e-8,0.0018285135003267157,-2.207596922814408e-5,1.0414665395833809e-8,0.0018285721071275558,-2.1903000912757984e-5,1.0256127104231965e-8,0.0018286262706814032,-2.1803209435120533e-5,1.0164594038831645e-8,0.001828705702435555,-2.177583438325039e-5,1.0138909579633824e-8,0.001828839337656277,-2.1807956588344662e-5,1.0166784524005633e-8,0.0018290509329571627,-2.1874064192536067e-5,1.0224554437432966e-8,0.0018293535538177238,-2.1937215282132975e-5,1.027838557907086e-8,0.0018297433561300666,-2.1953289747187514e-5,1.0288214837085777e-8,0.0018301945153309169,-2.1879869760203124e-5,1.0215787794044302e-8,0.001830658946308421,-2.168992779500395e-5,1.0036992338479185e-8,0.0018310753618979378,-2.138679258668782e-5,9.755367998113473e-9,0.0018313889838965569,-2.1011704357252705e-5,9.40893730399691e-9,0.0018315746329431721,-2.063467135717398e-5,9.061841978804914e-9,0.0018316490783180249,-2.0328796754628263e-5,8.780851241439044e-9,0.0018316632653398112,-2.0141677331726018e-5,8.60917634137112e-9,0.001831679395233614,-2.0080681978185537e-5,8.55305072202464e-9,0.0018317476612021335,-2.0117816834583795e-5,8.586332987307337e-9,0.0018318940208144653,-2.0206428881992914e-5,8.665969743081962e-9,0.0018321201082134187,-2.0298263194615822e-5,8.747708166164193e-9,0.001832409908402203,-2.0354458317239478e-5,8.796142458866711e-9,0.00183273774398109,-2.035003732644327e-5,8.788718700893353e-9,0.001833074770107819,-2.027416826766039e-5,8.715846695855356e-9,0.001833393452426999,-2.0128529716534936e-5,8.579316424344743e-9,0.0018336705866361742,-1.992511730302927e-5,8.390268759309309e-9,0.0018338894912187423,-1.968387735533606e-5,8.167058601271752e-9,0.0018340416791292305,-1.943010095958344e-5,7.932910852662894e-9,0.0018341280134618974,-1.9191384559990707e-5,7.713154507289564e-9,0.0018341590816821458,-1.8994066898046752e-5,7.53193522572574e-9,0.0018341544149850127,-1.885940649167221e-5,7.40865932392435e-9,0.0018341403815578727,-1.8800038802715472e-5,7.3546966523347715e-9,0.0018341468535115438,-1.8817250628981883e-5,7.370872897137305e-9,0.0018342029234141627,-1.889956862277312e-5,7.446231414582977e-9,0.0018343321227258867,-1.9023083174690816e-5,7.558447698209529e-9,0.0018345476553118807,-1.9153707945490168e-5,7.676042116963366e-9,0.0018348481083950683,-1.9251549921866032e-5,7.762491329140837e-9,0.0018352144196331546,-1.9277769509678416e-5,7.782530133022137e-9,0.0018356096596253435,-1.920398976117508e-5,7.710681424220857e-9,0.0018359837763515755,-1.9022957466042443e-5,7.540865396769042e-9,0.0018362849741516284,-1.8756908829736255e-5,7.293910761478627e-9,0.0018364766833233455,-1.8457870012827724e-5,7.017737181329629e-9,0.0018365538571077135,-1.8194914639068882e-5,6.775647214996834e-9,0.001836548563460727,-1.803024372589666e-5,6.624410847690285e-9,0.0018365187675594202,-1.7995409567851337e-5,6.592525088216024e-9,0.0018365252877235454,-1.8081331449302935e-5,6.671177914624835e-9,0.0018366101542084223,-1.8246672589318575e-5,6.822077045534804e-9,0.0018367869375824912,-1.8436994200718304e-5,6.995122222991016e-9,0.001837043888830328,-1.8602938875977135e-5,7.145101322978344e-9,0.0018373537387537482,-1.8710583772040503e-5,7.241122599512904e-9,0.0018376837337121634,-1.8743874840279134e-5,7.2687428712580284e-9,0.0018380027530075403,-1.8702372696090056e-5,7.227808403795434e-9,0.0018382852635966235,-1.8597450955179613e-5,7.128926096284541e-9,0.001838513176276471,-1.8448670412689796e-5,6.990149973877557e-9,0.0018386767249291653,-1.8280754164638692e-5,6.8342449477846595e-9,0.0018387750038904136,-1.812090639012062e-5,6.686252226411574e-9,0.0018388162973281307,-1.799601728606697e-5,6.570911706461216e-9,0.0018388179260978472,-1.7929389648419776e-5,6.509607695224068e-9,0.0018388050594228275,-1.7937016075237906e-5,6.516893378261047e-9,0.0018388079846011016,-1.8023966004633595e-5,6.597145459559734e-9,0.001838857713922728,-1.818180313357647e-5,6.742223335637884e-9,0.0018389803552352245,-1.838806035919854e-5,6.9310780933096055e-9,0.0018391912530982262,-1.860858891245793e-5,7.132034188312767e-9,0.0018394902971468079,-1.88029481324306e-5,7.3078518212857724e-9,0.0018398597310770378,-1.8932177661136858e-5,7.422918615431776e-9,0.0018402654168871984,-1.896772954162206e-5,7.451423914551764e-9,0.0018406621235211068,-1.8899934385024923e-5,7.385028293072869e-9,0.0018410028729857332,-1.8743806537061265e-5,7.238049462551088e-9,0.0018412512510457238,-1.8539475868505472e-5,7.047719368366382e-9,0.0018413937282192889,-1.834483799071887e-5,6.86733900839635e-9,0.0018414470718991932,-1.8220140618210308e-5,6.752093172557913e-9,0.0018414557581306575,-1.8208514775956216e-5,6.741217444212319e-9,0.0018414780209857879,-1.8320709364073575e-5,6.844095149750602e-9,0.001841565803992494,-1.8532077021471085e-5,7.037638298125493e-9,0.0018417482230087799,-1.8793447944416692e-5,7.276395121919292e-9,0.001842025845932932,-1.9049480082961622e-5,7.509453930519011e-9,0.001842376034057044,-1.925507263145096e-5,7.69549565376883e-9,0.0018427639401787223,-1.9383990375315344e-5,7.810647629678605e-9,0.0018431531413094465,-1.942958955901095e-5,7.849070713791684e-9,0.0018435127392187048,-1.940088549418417e-5,7.8192866216250315E-09,0.001843820730492911,-1.9317320377072763e-5,7.739348166296656e-9,0.0018440648885501498,-1.9204160908646343e-5,7.632620118984367e-9,0.001844242531542363,-1.9089035068363377e-5,7.524612793811735e-9,0.0018443600647661403,-1.8999259868333292e-5,7.440521812341918e-9,0.001844432549312981,-1.8959307662865297e-5,7.402863667254894e-9,0.0018444829953387927,-1.8987874349045107e-5,7.428729689176291e-9,0.0018445407209490732,-1.9094430440071465e-5,7.52658268876082e-9,0.0018446380463958871,-1.9275761849198014e-5,7.693093256534828e-9,0.001844804951317121,-1.9513700180089063e-5,7.911127592194227e-9,0.0018450622049142106,-1.9775670897407012e-5,8.15036239379623e-9,0.0018454146537959305,-2.0019361155694627e-5,8.37168352380671e-9,0.0018458471645658634,-2.020149491512519e-5,8.53532123115057e-9,0.001846325472916595,-2.0288852030465627e-5,8.610991677718667e-9,0.001846802738334875,-2.0268255874207588e-5,8.587035433849896e-9,0.0018472305526570348,-2.0152106866842266e-5,8.475412368243551e-9,0.0018475714841345342,-1.99772538420524e-5,8.31053358635742e-9,0.0018478096100095864,-1.9796940495792812e-5,8.141712154172403e-9,0.0018479558587613187,-1.9667497884298463e-5,8.020816057287474e-9,0.0018480460497650023,-1.9633092096664974e-5,7.988216118779569e-9,0.0018481313475885142,-1.97130435184807e-5,8.061204673026506e-9,0.0018482635125553158,-1.989628715353263e-5,8.229056332405201e-9,0.0018484798977238869,-2.014547254945726e-5,8.45695909902495e-9,0.0018487937859131421,-2.0409270039150275e-5,8.697434490355547e-9,0.0018491933464550954,-2.0637777460108637e-5,8.904531720257321e-9,0.001849648388562267,-2.0794981895125802e-5,9.04525543618406e-9,0.0018501208603383453,-2.0864590650255843e-5,9.104868950596546e-9,0.0018505745805460858,-2.0849287684095834e-5,9.086145203825255e-9,0.0018509815951685388,-2.0766006244656177e-5,9.004964655845875e-9,0.0018513249009249032,-2.0640121265863943e-5,8.88493947825769e-9,0.0018515986248674762,-2.0500399014916906e-5,8.75275158592604e-9,0.0018518069924697927,-2.037529947986055e-5,8.634737803338043e-9,0.0018519630574627775,-2.029034519449881e-5,8.55444480376467e-9,0.0018520875544509319,-2.0265862670398454e-5,8.530515515536571e-9,0.0018522076118006106,-2.0314479503742223e-5,8.574357895458459e-9,0.001852354640478269,-2.043817792207266e-5,8.68743961998716e-9,0.0018525605725263623,-2.0625343158510295e-5,8.85862825193293e-9,0.0018528519045839407,-2.0849110173348045e-5,9.06276525797922e-9,0.0018532420360760945,-2.1069073571299936e-5,9.262339779435322e-9,0.001853724130935122,-2.123818424609054e-5,9.413907129041965e-9,0.0018542681745039775,-2.13146965067963e-5,9.479118156772436e-9,0.001854825500677946,-2.1275855803305648e-5,9.437327265942164e-9,0.0018553411001434338,-2.1127603421251835e-5,9.294511094167757e-9,0.001855769808091963,-2.0905197786356253e-5,9.083769325899609e-9,0.001856089934500493,-2.066366542445483e-5,8.856377940750694e-9,0.001856309055157489,-2.0461827016597087e-5,8.66688007773098e-9,0.0018564605291198604,-2.0346009610590452e-5,8.557941716365146e-9,0.0018565929794966702,-2.0338609963516525e-5,8.549815123998282e-9,0.0018567566935258077,-2.0434095465034442e-5,8.636794189047838e-9,0.0018569909246059376,-2.0602544164462002e-5,8.790679141975657e-9,0.001857315247217037,-2.079894845221756e-5,8.96952007306406e-9,0.0018577267622189627,-2.097526582003082e-5,9.12880609280628e-9,0.001858203223977554,-2.109175679528336e-5,9.231914666619509e-9,0.0018587104540100233,-2.1124682017155018e-5,9.257156442445109e-9,0.0018592113115679834,-2.106890188932159e-5,9.200104828967708e-9,0.0018596735056705283,-2.0935816127821806e-5,9.07163153057935e-9,0.0018600745996205108,-2.0748452915729757e-5,8.89332379757743e-9,0.0018604039664238258,-2.0535775690622106e-5,8.692194187757801e-9,0.0018606624467996109,-2.032768021272182e-5,8.496037214902576e-9,0.0018608607937328295,-2.0151290741381685e-5,8.329989644194028e-9,0.0018610177895546044,-2.0028404875289557e-5,8.214148845006132e-9,0.0018611584243115355,-1.9973516875703052e-5,8.161728802068476e-9,0.0018613119834204608,-1.999186368250376e-5,8.17725592983337e-9,0.0018615094730483387,-2.0077264157555704e-5,8.254611200906061e-9,0.0018617795921467622,-2.021010824142319e-5,8.375250055651793e-9,0.0018621426777235635,-2.0356759570897997e-5,8.507743574528015e-9,0.0018626030974959807,-2.0472527218197918e-5,8.610594760757943e-9,0.001863142529370494,-2.0510266452106173e-5,8.640213095127023e-9,0.001863718542838287,-2.0434462278556232e-5,8.563932655985352e-9,0.0018642726717816077,-2.0236362154722935e-5,8.374014217097276e-9,0.0018647478436570396,-1.9942109211313427e-5,8.095175761587323e-9,0.001865108368948935,-1.960728289796133e-5,7.779474788722417e-9,0.0018653524017467537,-1.9298711898535704e-5,7.4892916930745e-9,0.0018655107551995035,-1.9072315354648044e-5,7.27659510756275e-9,0.0018656340820196373,-1.895724351204022e-5,7.168151304633016e-9,0.0018657758320747826,-1.895135064135561e-5,7.161416176012306e-9,0.0018659780113648356,-1.9026593337249196e-5,7.229749985625541e-9,0.0018662631207856332,-1.9139791481250695e-5,7.332602529333776e-9,0.0018666323647777408,-1.9244376015289706e-5,7.426524029334083e-9,0.0018670686302071045,-1.93003096381889e-5,7.474374412439072e-9,0.0018675424105708905,-1.9280847880737214e-5,7.451532270409492e-9,0.0018680189994260549,-1.9175704489265866e-5,7.348747503653877e-9,0.0018684654564785955,-1.8990736169104185e-5,7.171778438188237e-9,0.0018688561260398076,-1.8744836865035615e-5,6.938463114669843e-9,0.0018691760026911882,-1.8465188498455326e-5,6.674284503730649e-9,0.001869421833270251,-1.818207784859466e-5,6.407542925266269e-9,0.0018696013388690184,-1.7924257543533537e-5,6.165035437391302e-9,0.0018697312745747144,-1.77154221714517e-5,5.968767927016784e-9,0.0018698350512996898,-1.7571817919185243e-5,5.8337191006715384e-9,0.0018699402886244905,-1.750060390009367e-5,5.76630978226681e-9,0.0018700762544792589,-1.7498573862310598e-5,5.763229760950721e-9,0.0018702708423503566,-1.7551071627329354e-5,5.8104800416812336e-9,0.0018705465025051088,-1.763137263486119e-5,5.882878383752786e-9,0.0018709146903029294,-1.770161615547732e-5,5.945007935726127e-9,0.0018713693790612124,-1.771717503436893e-5,5.955326079857078e-9,0.001871882005628167,-1.7636224585071255e-5,5.875056690709975e-9,0.0018724021730790383,-1.7434179833481032e-5,5.681589270232072e-9,0.0018728684333721528,-1.7118167658035483e-5,5.3819353393236815e-9,0.0018732287172204356,-1.6732355540166632e-5,5.017686966724454e-9,0.0018734616898216,-1.6346704189132433e-5,4.654472798669768e-9,0.0018735862278335242,-1.6031827206181716e-5,4.358367558462995e-9,0.0018736526901350647,-1.583326478782647e-5,4.1717537065880975e-9,0.0018737219046122688,-1.5758804508346698e-5,4.10148922345258e-9,0.0018738443004110933,-1.578241850439683e-5,4.12273758898688e-9,0.0018740479774201498,-1.5858384906640113e-5,4.192354118637595e-9,0.0018743368377812267,-1.5936813363410486e-5,4.2635170100055776e-9,0.0018746952507608576,-1.5975245333576563e-5,4.296582563572818e-9,0.001875095253598817,-1.594505681652756e-5,4.265000879239349e-9,0.0018755037392833745,-1.5833619336192383e-5,4.157239354603041e-9,0.0018758885761289046,-1.5643635440476038e-5,3.976084601740173e-9,0.001876223379869671,-1.539063040568846e-5,3.736258860742264e-9,0.0018764908158095375,-1.5099215718405392e-5,3.460921341786339e-9,0.0018766843555797306,-1.4798700313825205e-5,3.1775739251165955e-9,0.001876808514204054,-1.4518593640800304e-5,2.913862771528727e-9,0.001876877684600156,-1.428449594527703e-5,2.6937304046643276e-9,0.0018769138794313335,-1.4114849713635936e-5,2.534362112040424e-9,0.001876943877891384,-1.4018784813808756e-5,2.444153315210054e-9,0.0018769961556297737,-1.3994930354196748e-5,2.4215928014478305e-9,0.0018770976892354386,-1.4030988542626093e-5,2.454884423634573e-9,0.0018772705481379275,-1.4104015382463982e-5,2.5222631987773908e-9,0.001877528051302119,-1.4181603792678899e-5,2.5931789806121115e-9,0.0018778703569376982,-1.4224713941675174e-5,2.6310160704288327e-9,0.0018782801543122864,-1.4193451439422243e-5,2.598529820729149e-9,0.0018787205590664604,-1.405678212300852e-5,2.4669139600598395e-9,0.0018791386692319275,-1.3805285464980217e-5,2.2276810492311913e-9,0.0018794780123360833,-1.3462303276611882e-5,1.9030504386180313e-9,0.0018796988460152687,-1.3085081939944344e-5,1.5469771882351445e-9,0.001879797376121251,-1.2749246711917046e-5,1.2305366805810725e-9,0.001879810814909188,-1.2520431987685998e-5,1.0152379061173355e-9,0.0018798025069450173,-1.2428480565797385e-5,9.28792039154265e-10,0.0018798356637794984,-1.2459405930458762e-5,9.576569245815327e-10,0.0018799514652937973,-1.2567147881760806e-5,1.058227207885944e-9,0.0018801611228964044,-1.2694459694026742e-5,1.1765668337490139e-9,0.0018804504286041776,-1.2790844470236134e-5,1.2652815802583089e-9,0.0018807898296935043,-1.2822211239622132e-5,1.2925348480468322e-9,0.001881144296639176,-1.2773137375766395e-5,1.244082520275377e-9,0.001881480541304962,-1.2644829708590756e-5,1.1212779543347608e-9,0.0018817714830373492,-1.2451442593087324e-5,9.37573033027889e-10,0.0018819987877392661,-1.2216113471832141e-5,7.147943106851535e-10,0.0018821541835679256,-1.1967040551517974e-5,4.79481554800589e-10,0.001882239823342938,-1.1733614321682521e-5,2.592733145950963e-10,0.0018822677333682823,-1.1542659347071796e-5,7.937878641490489e-11,0.001882258290813125,-1.1414929386642006e-5,-4.073055482831923e-11,0.00188223769665013,-1.1362192719985606e-5,-9.008293919875422e-11,0.001882234648515446,-1.1385337979164145e-5,-6.800108198389007e-11,0.0018822765976668182,-1.147373068275585e-5,1.529829570741141e-11,0.0018823859220090569,-1.1605863972995146e-5,1.3934936610352848e-10,0.0018825762769299201,-1.1751333204930212e-5,2.7535196640362164e-10,0.001882849356696919,-1.1874174668779581e-5,3.8937810798312383e-10,0.0018831923326353601,-1.1937760844475924e-5,4.470257514000792e-10,0.0018835766745060477,-1.1911660763090492e-5,4.198775427362523e-10,0.0018839599006157666,-1.1780441166968134e-5,2.937343558620432e-10,0.0018842923200876947,-1.1552816367157377e-5,7.714292268036392e-11,0.0018845300065070212,-1.1267101431234662e-5,-1.935563353070176e-10,0.001884651848842402,-1.0986979616266467e-5,-4.582805070815646e-10,0.0018846729512961321,-1.0783668473551395e-5,-6.500369715974631e-10,0.001884644026311698,-1.0709107993313308e-5,-7.201687612284614e-10,0.0018846329849430254,-1.0774324376780514e-5,-6.586566194780138e-10,0.0018846977991100334,-1.0946622650667459e-5,-4.966346506891892e-10,0.0018848664449174443,-1.1166459365350037e-5,-2.9038739613313543e-10,0.0018851332005309256,-1.1371807843700045e-5,-9.836030862044166e-11,0.00188546833284025,-1.1516483567944784e-5,3.6072174092010136e-11,0.0018858320534413794,-1.1577196587717038e-5,9.118298144119174e-11,0.0018861858170151932,-1.1551897946543376e-5,6.526251494340663e-11,0.0018864988368209698,-1.1454250824736898e-5,-2.8641386320276168e-11,0.0018867506997908348,-1.130771157982184e-5,-1.683171289939276e-10,0.0018869317981828468,-1.114067253953726e-5,-3.269535468848281e-10,0.00188704288267068,-1.0982683580718171e-5,-4.766790893169354e-10,0.00188709425157458,-1.0861262431198378e-5,-5.915582605683498e-10,0.0018871045582005074,-1.0798915164720963e-5,-6.504092600231872e-10,0.0018870989904794264,-1.0810255077489202e-5,-6.395398827368157e-10,0.0018871065171513206,-1.089946266139451e-5,-5.551558313967678e-10,0.0018871561148395357,-1.1058676341069262e-5,-4.048719775294948e-10,0.0018872723151573511,-1.1267948529405112e-5,-2.077232698081918e-10,0.0018874707273317042,-1.1497174238386989e-5,7.702962172308863e-12,0.0018877543345839755,-1.1710094620244999e-5,2.0709679356946207e-10,0.0018881113731507087,-1.1870079468074387e-5,3.5592247332806187e-10,0.0018885154354453212,-1.1947025394181564e-5,4.2594198011051527e-10,0.0018889282709940963,-1.1924554434572256e-5,4.0198452420754266e-10,0.0018893057509901104,-1.180642796887354e-5,2.8793937793174093e-10,0.0018896072155190882,-1.1620319815144137e-5,1.102325230061882e-10,0.0018898073174633363,-1.141620503858083e-5,-8.378045830706647e-11,0.0018899072882816023,-1.1256680872880053e-5,-2.350144500265779e-10,0.00188994004525897,-1.1199004466727915e-5,-2.8962303888349816e-10,0.0018899634124805416,-1.1274091765243815e-5,-2.187662588737686e-10,0.0018900409279768637,-1.1472911999612212e-5,-3.133758064503063e-11,0.0018902183761997377,-1.1749297526970216e-5,2.2880621691449785e-10,0.0018905085190595347,-1.2038537620544541e-5,5.004579398597872e-10,0.0018908911977333046,-1.2281010673800587e-5,7.273646082903298e-10,0.0018913257026649535,-1.2438746635557551e-5,8.738262880584713e-10,0.001891766418942364,-1.2500025159169855e-5,9.289921702418269e-10,0.0018921745217345054,-1.2474898759061678e-5,9.025856295473614e-10,0.0018925235949496604,-1.2387224374957897e-5,8.173373978207359e-10,0.0018928006012498605,-1.2267242724669224e-5,7.019521780489794e-10,0.001893004532648849,-1.2146219309942353e-5,5.860420989860535e-10,0.0018931444568213974,-1.2052958305120446e-5,4.968374482519974e-10,0.0018932376922635935,-1.201136506885249e-5,4.5688395279176046e-10,0.0018933080932005942,-1.203830971069964e-5,4.820179060546816e-10,0.0018933840198379344,-1.2141431704543413e-5,5.792878687063079e-10,0.0018934954432214392,-1.2317048491958935e-5,7.449904944807481e-10,0.0018936698433884116,-1.2548874791752978e-5,9.63493451044306e-10,0.0018939271289290503,-1.2808571057900438e-5,1.207801973263226e-9,0.0018942745270844783,-1.3059009801183272e-5,1.4426931836520661e-9,0.0018947029628015445,-1.3260512884313262e-5,1.6306445395104082e-9,0.0018951865409454112,-1.3379240786205856e-5,1.739776196090901e-9,0.0018956861193035659,-1.339582085200682e-5,1.7520006276159735e-9,0.001896156784362993,-1.3311821218936873e-5,1.6691149414387627e-9,0.0018965578833635218,-1.315201628144059e-5,1.5148888736049156e-9,0.0018968634955145083,-1.2961201862073039e-5,1.3319718714925833e-9,0.0018970707895216053,-1.27953186054354e-5,1.1734090967998433e-9,0.0018972035254706415,-1.270792499395131e-5,1.0897877058615488e-9,0.0018973082905004745,-1.2734836504746565e-5,1.1147159041982071e-9,0.0018974426469162598,-1.2881765897702211e-5,1.2532161191392723e-9,0.0018976577334179135,-1.3120638566367633e-5,1.4783604413576136e-9,0.0018979817061840188,-1.3397830754750496e-5,1.7391592222003208e-9,0.001898411458923872,-1.3651830597880485e-5,1.9773042111285594e-9,0.0018989162166529016,-1.3832467412215963e-5,2.1453543532283e-9,0.0018994501504002229,-1.3913394698958246e-5,2.218528300226893e-9,0.0018999670934915821,-1.3894285229865015e-5,2.1967560935101533e-9,0.0019004313205916007,-1.3794987368719163e-5,2.0991062793393773e-9,0.0019008222473536457,-1.3646563923406225e-5,1.9552477096692173e-9,0.0019011342862434643,-1.3483210869567092e-5,1.7977502645593472e-9,0.0019013742670453792,-1.3336710126712298e-5,1.656805182705815e-9,0.0019015583445810035,-1.3233251710861967e-5,1.557210441490532e-9,0.0019017093215130678,-1.3191683234416556e-5,1.516718948288368e-9,0.0019018544551819409,-1.322222486221346e-5,1.5448335845441187e-9,0.0019020232614363063,-1.332508798252e-5,1.641518474045382e-9,0.0019022446122891282,-1.3489036976123344e-5,1.7958687511443292e-9,0.0019025425844261994,-1.369058867045455e-5,1.985394636394811e-9,0.0019029310998461496,-1.3895103526272778e-5,2.177098013812628e-9,0.0019034084130146504,-1.4061158291373949e-5,2.3316432829741173e-9,0.0019039536403952983,-1.4148798826174367e-5,2.411188360481643e-9,0.00190452798036301,-1.4130390523376207e-5,2.3896713112052716e-9,0.0019050821403015848,-1.4000599135125858e-5,2.262277159589695e-9,0.0019055688083909521,-1.3781106731241096e-5,2.0499028297317794e-9,0.0019059562148011579,-1.3517137805515713e-5,1.795813482384683e-9,0.0019062378216281627,-1.3266226807941069e-5,1.55488479026225e-9,0.0019064346707243743,-1.3082876840158903e-5,1.3789321851604236e-9,0.0019065897975290977,-1.300402884385789e-5,1.3028645792247607e-9,0.0019067566525288243,-1.3039478647258866e-5,1.335631681489911e-9,0.0019069848668208623,-1.3169664466781716e-5,1.458241594737562e-9,0.0019073072088376596,-1.3351363244590194e-5,1.6292950121476715e-9,0.0019077314104704636,-1.35297729754093e-5,1.7965331398129217e-9,0.0019082393455308658,-1.3653389545506359e-5,1.910981408664566e-9,0.0019087936495511212,-1.368692249063571e-5,1.9391998920108105e-9,0.0019093490888763,-1.36182247050182e-5,1.8698433679372743e-9,0.0019098643504093444,-1.3457815665676977e-5,1.7131785903247102e-9,0.0019103104535418381,-1.3232664882104302e-5,1.49513174647234e-9,0.001910674199703993,-1.2977653683504635e-5,1.2491153226176072e-9,0.001910957383345947,-1.2727836569487273e-5,1.0086216538112337e-9,0.0019111736376836673,-1.2513095263658599e-5,8.021151208985223e-10,0.0019113446910483782,-1.2355262008813369e-5,6.502990133921028e-10,0.0019114970699477254,-1.2266914435896981e-5,5.649887739956633e-10,0.001911659458251913,-1.2250863989869682e-5,5.48651037755953e-10,0.0019118603142655674,-1.2299688915426472e-5,5.939871771107086e-10,0.0019121250704395051,-1.2395224103850199e-5,6.83479516283135e-10,0.001912472298250459,-1.2508553962420433e-5,7.894175597020551e-10,0.0019129086995072113,-1.2601732458062466e-5,8.755614362231623e-10,0.0019134238587510172,-1.2632856875682743e-5,9.019823758839568e-10,0.0019139872139001782,-1.2565475255362356e-5,8.340185275907759e-10,0.0019145507149744756,-1.2380996991705414e-5,6.541016494998854e-10,0.0019150594943169597,-1.208942059331609e-5,3.720012705806915e-10,0.0019154687355826697,-1.1731803189978585e-5,2.7186751351475117e-11,0.0019157599073696201,-1.1370438510631843e-5,-3.2059589419623007e-10,0.0019159480871280882,-1.1069433649940181e-5,-6.099776897920081e-10,0.0019160765242110884,-1.0874351161307604e-5,-7.975067244527357e-10,0.001916201638240862,-1.0799731954230843e-5,-8.695695269755934e-10,0.0019163757206690922,-1.0828066294132719e-5,-8.432736692445251e-10,0.001916633663319116,-1.0918083407511515e-5,-7.583931686950212e-10,0.0019169865545414935,-1.1017681518618213e-5,-6.649208970516302e-10,0.0019174220148160516,-1.1077138327480256e-5,-6.104228457140029e-10,0.001917909652400136,-1.1059628873658679e-5,-6.300141180862712e-10,0.0019184095373273615,-1.0947442807596206e-5,-7.404583107456317e-10,0.0019188815145464583,-1.074336196537258e-5,-9.388858115135974e-10,0.0019192932808213034,-1.0467594123611643e-5,-1.20575358697917e-9,0.0019196256213150462,-1.0151606595075532e-5,-1.5107725145640873e-9,0.0019198741582867806,-9.830831037267878e-6,-1.8199155582087304e-9,0.001920048034328906,-9.53810189496491e-6,-2.101716952530784e-9,0.00192016664884815,-9.298985720095432e-6,-2.3317451423285186e-9,0.0019202557299710247,-9.129284586844093e-6,-2.4949779817672822e-9,0.0019203436982262987,-9.03425635494825e-6,-2.5865276762768656e-9,0.0019204586561453517,-9.008766308266697e-6,-2.6114761398253937e-9,0.0019206257964393613,-9.037767379553837e-6,-2.584400459288261e-9,0.0019208647556760669,-9.096934635335611e-6,-2.528749375572851e-9,0.0019211863918376449,-9.153791617985142e-6,-2.475744453410305e-9,0.0019215887893763244,-9.170318069016814e-6,-2.4618619106144695e-9,0.0019220532680969222,-9.108486698013456e-6,-2.5235177511399977e-9,0.0019225426370994027,-8.93968667282501e-6,-2.6880381102716844e-9,0.0019230051437690364,-8.656881355420935e-6,-2.9620064184294193e-9,0.0019233868768198299,-8.284641843373393e-6,-3.321635583237772e-9,0.0019236508865696793,-7.87924983238811e-6,-3.7126811593957043e-9,0.0019237944180940756,-7.513626152701059e-6,-4.064969808739745e-9,0.0019238530642237287,-7.251346875133989e-6,-4.317442787274023e-9,0.0019238875264319904,-7.123184534446885e-6,-4.440727658128514e-9,0.0019239602849499028,-7.118772335068044e-6,-4.445080751689829e-9,0.0019241150340064711,-7.195410187776e-6,-4.3718032484889515e-9,0.0019243672115235493,-7.296057858543114e-6,-4.275859784550209e-9,0.0019247056490780219,-7.366796576870663e-6,-4.209081160263236e-9,0.001925100638222425,-7.368390575798459e-6,-4.2090899838722325e-9,0.0019255136991263675,-7.28124033598263e-6,-4.29459094897082e-9,0.0019259062934330908,-7.105313322498182e-6,-4.465474633111174e-9,0.001926246455241092,-6.8569503429279765e-6,-4.705904064104801e-9,0.001926513155176582,-6.563908504672785e-6,-4.989086595641599e-9,0.0019266984060524598,-6.259565315487143e-6,-5.28285207654197e-9,0.0019268072181901595,-5.977125716265304e-6,-5.555231795710813e-9,0.0019268557194206991,-5.744607949504135e-6,-5.779286983994542e-9,0.001926867956789526,-5.581192829623622e-6,-5.93661711990306e-9,0.0019268720688889452,-5.495252817643273e-6,-6.019245563941074e-9,0.0019268965365545243,-5.483964670467983e-6,-6.029980211505466e-9,0.0019269669147046517,-5.534047865259946e-6,-5.981698489668393e-9,0.0019271030607710645,-5.623188311924287e-6,-5.895977467639949e-9,0.0019273166863302753,-5.7219540024492885e-6,-5.8012471529754476e-9,0.001927608964943563,-5.7963044626612365e-6,-5.730359732741071e-9,0.001927968073137577,-5.811296023443038e-6,-5.716996716285913e-9,0.001928367327868175,-5.736968151573158e-6,-5.789976737812062e-9,0.0019287657529438592,-5.556881102280313e-6,-5.965023129181158e-9,0.0019291137044280984,-5.2780252562612125e-6,-6.235225744033611e-9,0.0019293656129909568,-4.9378508432014095e-6,-6.564293224012181e-9,0.0019294981647026979,-4.601333003765205e-6,-6.88943201632588e-9,0.001929525485728095,-4.342876353937429e-6,-7.138863176862139e-9,0.0019294994801223031,-4.217696588858802e-6,-7.25946537969358e-9,0.0019294908116161604,-4.238299439230228e-6,-7.239417461315074e-9,0.001929560314582812,-4.371015270438031e-6,-7.111424613284696e-9,0.0019297377118852202,-4.55344246107046e-6,-6.935795233464066e-9,0.001930017314096714,-4.719917590952116e-6,-6.775858205910853e-9,0.001930367658027968,-4.821014209853837e-6,-6.679201920416775e-9,0.0019307459008136353,-4.8316120263198285e-6,-6.669947990797228e-9,0.0019311099639047478,-4.749855588336907e-6,-6.749791325681373e-9,0.001931426078730715,-4.591648798416053e-6,-6.903320619292728e-9,0.0019316723240502833,-4.384152509840636e-6,-7.104284083463843e-9,0.00193183957714851,-4.159855661523347e-6,-7.321298468100921e-9,0.0019319309590358179,-3.951522849872863e-6,-7.522721099309414e-9,0.001931960272729608,-3.7879464393165173e-6,-7.680755766459321e-9,0.0019319496225054618,-3.690498897752296e-6,-7.774788967531755e-9,0.0019319263202685097,-3.6706055523742944e-6,-7.793831867149322e-9,0.001931919267959071,-3.7283927164905087e-6,-7.737819257871908e-9,0.0019319552108667095,-3.852716726614077e-6,-7.617573393096083e-9,0.0019320552988749142,-4.02248969024826e-6,-7.453520879166667e-9,0.0019322322171346693,-4.209066647074804e-6,-7.27339092546293e-9,0.0019324880384187753,-4.379522397329557e-6,-7.109051304871561e-9,0.0019328128907126745,-4.5006846976982455e-6,-6.9926006585541975e-9,0.001933184500922892,-4.543960637217014e-6,-6.951680008281516e-9,0.0019335690805746674,-4.491239132575197e-6,-7.0037418708715674e-9,0.0019339247854987158,-4.3417098714221724e-6,-7.149447726110859e-9,0.0019342092422925217,-4.118009382523817e-6,-7.366743932940767e-9,0.0019343916827004838,-3.868204312684253e-6,-7.608992772716862e-9,0.001934467361572726,-3.658733712507117e-6,-7.811866984567964e-9,0.001934467204138646,-3.5553083996379697e-6,-7.911879053399946e-9,0.0019344532495840499,-3.5966460829545584e-6,-7.871776332288663e-9,0.0019344968195731504,-3.7753114217998696e-6,-7.698978894623498e-9,0.0019346495112623097,-4.03947689724567e-6,-7.443761240396356e-9,0.0019349242390860283,-4.315579736048795e-6,-7.177294842177374e-9,0.0019352959799658958,-4.537209508290387e-6,-6.9637480873944295e-9,0.0019357174371195988,-4.664295527601881e-6,-6.8417869033334726e-9,0.0019361376429321514,-4.687227031264865e-6,-6.820621053087697e-9,0.0019365149604292852,-4.620518272556331e-6,-6.886137513437268e-9,0.001936822735002006,-4.4930784615761195e-6,-7.01030959332819e-9,0.0019370497573068866,-4.3395817761451026e-6,-7.159541983283873e-9,0.0019371982714750445,-4.194332245529059e-6,-7.300606086896117e-9,0.0019372813098119841,-4.0872389658178436e-6,-7.404541171072901e-9,0.0019373200047168263,-4.041081596253815e-6,-7.449311969194115e-9,0.0019373408698219712,-4.06951090543502e-6,-7.421751862826817e-9,0.0019373728401152071,-4.175601163817662e-6,-7.318959872347354e-9,0.0019374438984557292,-4.351140097040351e-6,-7.14897163907601e-9,0.0019375773878386295,-4.577090029110529e-6,-6.930294004143148e-9,0.0019377884492321462,-4.8255307456941e-6,-6.690013847281935e-9,0.0019380811458521296,-5.063086450380342e-6,-6.460482833914179e-9,0.0019384468078961414,-5.2556340897116115e-6,-6.274765644942493e-9,0.001938864070694948,-5.373859826780817e-6,-6.161257575262624e-9,0.0019393008815218134,-5.39900090253849e-6,-6.138107237175963e-9,0.0019397185968336869,-5.328108998262378e-6,-6.208094891699568e-9,0.0019400783924782288,-5.178029968915432e-6,-6.3547673684562564e-9,0.001940350064460665,-4.986568248040517e-6,-6.541330751226949e-9,0.0019405222410656135,-4.808507589956162e-6,-6.714561951692604e-9,0.0019406110279473565,-4.704360703335738e-6,-6.815780527851394e-9,0.0019406619186682263,-4.722099909779016e-6,-6.798592282970913e-9,0.0019407397828170951,-4.877341093394415e-6,-6.6480630164182626e-9,0.0019409070239167167,-5.142645237546104e-6,-6.3909979796592525e-9,0.0019411991246476956,-5.455021750594156e-6,-6.08859132515089e-9,0.0019416113591816284,-5.739907638638507e-6,-5.813170806092759e-9,0.0019421039399188788,-5.938379623146413e-6,-5.621848443746926e-9,0.001942620441220814,-6.023358180511173e-6,-5.540825654139379e-9,0.0019431076064300335,-6.000155352616885e-6,-5.564854280690739e-9,0.0019435278468381142,-5.896618797745685e-6,-5.66679479290207e-9,0.0019438629592743444,-5.750852545969404e-6,-5.809548326748877e-9,0.0019441120808416875,-5.601534475667561e-6,-5.955480832384088e-9,0.001944287443752201,-5.482065741624393e-6,-6.072125549617999e-9,0.0019444101506376872,-5.417660736467644e-6,-6.135020234542866e-9,0.001944506708268009,-5.424015514502002e-6,-6.12900103028505e-9,0.0019446061453395735,-5.5065945921930115e-6,-6.048882321230036e-9,0.0019447372317435117,-5.660164219490716e-6,-5.899883466024544e-9,0.0019449253683826993,-5.8687316263243564E-06,-5.6976552684035205e-9,0.001945189030333371,-6.106463427556881e-6,-5.467362321854533e-9,0.001945536161431122,-6.340235377640483e-6,-5.241200084831334e-9,0.0019459613750219223,-6.534129514976202e-6,-5.0540407206024526E-09,0.0019464450016517627,-6.655627092463941e-6,-4.9374385215283745e-9,0.0019469548828858596,-6.682567740270542e-6,-4.912878296775678e-9,0.001947451269570495,-6.60932933283276e-6,-4.985758640608991e-9,0.0019478943525422965,-6.450513493834239e-6,-5.14178782748562e-9,0.0019482532181079584,-6.2407756398245034e-6,-5.347142200685174e-9,0.0019485145355209999,-6.029956846976695e-6,-5.553227818359947e-9,0.001948688832848761,-5.8732962326046545e-6,-5.706255960069141e-9,0.0019488117889920867,-5.817657136586249e-6,-5.76069054929591e-9,0.001948938125527602,-5.886667676818439e-6,-5.69370500652984e-9,0.0019491274075020232,-6.0699856033129015e-6,-5.515569915679763e-9,0.0019494249289553265,-6.3227915401508744E-06,-5.270071903094241e-9,0.001949845257742566,-6.578590377092514e-6,-5.022021831291358e-9,0.0019503668701211755,-6.771379833246088e-6,-4.8356927104913765e-9,0.001950941025999169,-6.857006618888046e-6,-4.754047856449597e-9,0.0019515098360051739,-6.823912357418047e-6,-4.788264987953578e-9,0.0019520240658229982,-6.690500284410137e-6,-4.920280238133386e-9,0.0019524536244067533,-6.49382548244997e-6,-5.113816259747165e-9,0.0019527895094792508,-6.276752315075202e-6,-5.326941081183438e-9,0.0019530401509459683,-6.078332438438705e-6,-5.521497393189113e-9,0.001953225817980965,-5.928567237035448e-6,-5.668236483345585e-9,0.0019533734478342783,-5.84651286102268e-6,-5.74866469745462e-9,0.0019535127069048035,-5.840135760566559e-6,-5.755159455452236e-9,0.0019536730713173847,-5.906707798229399e-6,-5.690546687804252e-9,0.0019538812761171337,-6.033223898987462e-6,-5.567654612994196e-9,0.0019541585144023286,-6.197000707763707e-6,-5.408699430107965e-9,0.0019545171385095907,-6.367107479822374e-6,-5.243879262195881e-9,0.0019549572076320533,-6.5074833444539475e-6,-5.108346058501838e-9,0.0019554639201165612,-6.582363249082454e-6,-5.03694129358835e-9,0.001956007498430186,-6.563809875728904e-6,-5.0568720809815e-9,0.001956546986261798,-6.4398326830353245e-6,-5.179789317621606e-9,0.001957038319601614,-6.220390777973844e-6,-5.3959025305882386e-9,0.001957445211377807,-5.938406346561329e-6,-5.6729623501463044E-09,0.0019577497434098727,-5.6441961139281294e-6,-5.961701088875459e-9,0.00195795905198493,-5.3940117834603315e-6,-6.207071934832427e-9,0.001958105475933685,-5.235595818058769e-6,-6.362420055449834e-9,0.0019582395183540724,-5.194843437985116e-6,-6.402542072145623e-9,0.001958417079498149,-5.267559275761301e-6,-6.331712684108876e-9,0.0019586841391798864,-5.419208397437096e-6,-6.183867152169376e-9,0.0019590632992368684,-5.5936274617679324e-6,-6.0140407497047866e-9,0.0019595468572287758,-5.728796846682779e-6,-5.882943397267424e-9,0.001960099404208329,-5.774659859002328e-6,-5.8395474337831e-9,0.0019606692273000065,-5.706491547132605e-6,-5.908007246472056e-9,0.001961203875844111,-5.5290734820936245e-6,-6.083550911233866e-9,0.001961663710892444,-5.271294504247528e-6,-6.33775249294814e-9,0.0019620291042840325,-4.974990706173587e-6,-6.62948408349352e-9,0.0019623006544432146,-4.683271223898374e-6,-6.916401377222745e-9,0.001962494734377491,-4.432015613971804e-6,-7.163317469825513e-9,0.00196263744876942,-4.24555166449937e-6,-7.3464495352867865e-9,0.001962759151531451,-4.135625053205161e-6,-7.454405906541533e-9,0.0019628903475563684,-4.102163162853727e-6,-7.487397138171459e-9,0.001963058825873597,-4.134581772027361e-6,-7.45591629508366e-9,0.0019632873735704035,-4.2130275752858015e-6,-7.37949782948698e-9,0.001963591384460584,-4.309670509689841e-6,-7.285447272084761e-9,0.001963976034392938,-4.390698571258319e-6,-7.2069014925367394E-09,0.00196443330876546,-4.419933657794488e-6,-7.1793089036528066e-9,0.0019649399761413515,-4.364865771727716e-6,-7.23453490273262e-9,0.001965458415821613,-4.2050069352158806e-6,-7.392670556572303e-9,0.0019659423021510165,-3.940624693125234e-6,-7.653438357820787e-9,0.001966347619651084,-3.5979703831828426e-6,-7.991020087185636e-9,0.001966646410720784,-3.2268073690315724e-6,-8.35646294373238e-9,0.001966837804951861,-2.88866026076316e-6,-8.6892469084276e-9,0.0019669507350560987,-2.638942552458159e-6,-8.93489923720782e-9,0.001967036219204756,-2.509897091168396e-6,-9.061792188439865e-9,0.0019671521102095036,-2.5011703515333097e-6,-9.070385947269845e-9,0.001967346338386762,-2.5810055380569523e-6,-8.992002968155938e-9,0.0019676443316525953,-2.696486676324743e-6,-8.878723391163976e-9,0.0019680437540308916,-2.788602202893239e-6,-8.788584213578214e-9,0.00196851699192739,-2.8074134547524235e-6,-8.77069512204032e-9,0.0019690198105688102,-2.723406029950918e-6,-8.854087293070188e-9,0.001969503286514971,-2.5325606025790628e-6,-9.042705655591e-9,0.0019699255438227234,-2.2545503651888572e-6,-9.317149614451272e-9,0.0019702602048416143,-1.9254253998824907e-6,-9.64186138287465e-9,0.0019704998243126686,-1.587626778063647e-6,-9.974977396460062e-9,0.001970654436207738,-1.2805361083925496e-6,-1.0277671836369529E-08,0.001970746848452303,-1.0338220010957484e-6,-1.0520734387427998e-8,0.001970806813276138,-8.642671882979529e-7,-1.0687691080751363e-8,0.0019708657346138646,-7.754852094272468e-7,-1.0775054263680461e-8,0.001970952685885467,-7.59358064857489e-7,-1.0790873734095068e-8,0.001971091690133412,-7.980785287859418e-7,-1.075270881326718e-8,0.0019712997330186763,-8.661819417994633e-7,-1.0685635082892515e-8,0.001971584912381313,-9.325958251431366e-7,-1.0620251655417039e-8,0.001971944386893563,-9.632389319096306e-7,-1.0590148555848218e-8,0.0019723623172643737,-9.250101036695197e-7,-1.0627989281767547e-8,0.001972808830631805,-7.919702181976068e-7,-1.0759406320346234e-8,0.0019732419679683944,-5.536462457545765e-7,-1.0994779047683153e-8,0.001973614823661226,-2.2335933302557065e-7,-1.1320973812675675e-8,0.0019738884737286657,1.5799990717252462e-7,-1.1697589927724113e-8,0.0019740473224203847,5.280347963458416e-7,-1.2062959771330483e-8,0.00197410928803649,8.20358883314744e-7,-1.2351497457826083e-8,0.001974123317235958,9.877098265902934e-7,-1.251656570489879e-8,0.001974153255924493,1.0192999814429548e-6,-1.2547588496020676e-8,0.0019742556717545824,9.434428611000109e-7,-1.2472576911245205e-8,0.0019744623865517686,8.154180584666158e-7,-1.2346103517772794e-8,0.001974774135226251,6.982018680757243e-7,-1.2230299564424663e-8,0.001975164866836536,6.44800593857355e-7,-1.2177471453811616e-8,0.001975592187135106,6.871905621175031e-7,-1.221921769330186e-8,0.001976009248334955,8.327104581488337e-7,-1.2362852376014084e-8,0.0019763749925609457,1.0663971388143509e-6,-1.259366276420492e-8,0.001976661273607453,1.3571121056137057e-6,-1.2880913658228117e-8,0.0019768563928079714,1.6655158949823804e-6,-1.3185711559255818e-8,0.001976965150873674,1.9522178827619e-6,-1.3469078659361015e-8,0.0019770060231024044,2.1846215565256827e-6,-1.3698753468466588e-8,0.001977006519814771,2.3414551764659016e-6,-1.3853691582153882E-08,0.0019769979445145433,2.4146980122888094e-6,-1.3925966248255384e-8,0.0019770105929741008,2.409217344158514e-6,-1.3920387497226856e-8,0.0019770700502998715,2.340825972519958e-6,-1.3852563760087515e-8,0.0019771946962903715,2.233613597212906e-6,-1.3746268263541514e-8,0.001977394083641216,2.117137695108602e-6,-1.3630691930216664e-8,0.00197766776849491,2.02355937158754e-6,-1.353764934893884e-8,0.0019780043391657534,1.9844130263776497e-6,-1.3498405475263642e-8,0.001978380746958981,2.0264143260061553e-6,-1.353951384539365e-8,0.001978762774876461,2.1656876800633962e-6,-1.3677055583687163e-8,0.00197910834678161,2.4005955486988004e-6,-1.3909478074330424e-8,0.0019793755690996236,2.7052325640155345e-6,-1.4211108687579435e-8,0.0019795358980323765,3.0280329593492748e-6,-1.4530782563116931e-8,0.0019795888602322726,3.3008762468395384e-6,-1.4800926854883546e-8,0.001979569909580966,3.4602522751505376e-6,-1.4958607317158036e-8,0.0019795428292347273,3.4729664075210322e-6,-1.4971007396679774e-8,0.0019795766858330343,3.3517185374406653e-6,-1.485078131230214e-8,0.001979719097725177,3.150012236996182e-6,-1.4650917551003886e-8,0.0019799807430923235,2.939717703579574e-6,-1.4442508997057445e-8,0.001980337179051505,2.785210747885825e-6,-1.4289220607364234e-8,0.001980742604001265,2.726455749296866e-6,-1.423061560237119e-8,0.0019811460867675897,2.7744247605888214e-6,-1.4277633511904348e-8,0.001981503955526798,2.915383589334282e-6,-1.4416788031389436e-8,0.0019817866606374806,3.119072655949307e-6,-1.4618203584318185e-8,0.0019819810541467733,3.3472878569643014e-6,-1.4844069697144964e-8,0.0019820896686203603,3.5612914305410776e-6,-1.5055977587760283e-8,0.00198212818028609,3.7276910519524167e-6,-1.522077511487346e-8,0.0019821217200457113,3.822702343827983e-6,-1.531483119915164e-8,0.001982100526968717,3.8346574475360094e-6,-1.5326546430867445e-8,0.001982095446197697,3.7647342774013897e-6,-1.525707214555077e-8,0.0019821337647565624,3.626027788928867e-6,-1.511936833404366e-8,0.00198223586051072,3.441229396883561e-6,-1.4935887639064302e-8,0.00198241295750562,3.2394074768603723e-6,-1.4735395171384388e-8,0.001982665941468611,3.0524134698759988e-6,-1.4549442314482317e-8,0.0019829850278711707,2.9111670054398966e-6,-1.4408723058841443e-8,0.0019833501452222605,2.841809897117393e-6,-1.4339272286988301e-8,0.0019837320752173157,2.8615334931783054e-6,-1.4358293854803897e-8,0.001984094861776407,2.9738376767734945e-6,-1.4469388182609625e-8,0.001984400625925791,3.163606036205151e-6,-1.465759406565055e-8,0.001984617903763515,3.39387177161666e-6,-1.4886148324894974e-8,0.001984733239124418,3.6078493427449448e-6,-1.5098540495896356e-8,0.001984762586708769,3.740319866084089e-6,-1.522990885918146e-8,0.001984755051949164,3.739151728899739e-6,-1.5228487094580237e-8,0.0019847812506757346,3.589373742862749e-6,-1.507949371776934e-8,0.0019849070018280613,3.324884794977739e-6,-1.481665653780441e-8,0.0019851657075547475,3.017077739740492e-6,-1.4510837813089766e-8,0.001985546337819205,2.7455641756043497e-6,-1.4240999293311826e-8,0.0019860027126962026,2.5689052542741243e-6,-1.4065234505030063e-8,0.001986474911058454,2.5102785475177926e-6,-1.4006586884914449e-8,0.001986909190146146,2.5597820777408202e-6,-1.4055310223533645e-8,0.001987269141598994,2.685729541695863e-6,-1.4180024373601416e-8,0.001987538415975901,2.8470244196991636e-6,-1.4339955147058143e-8,0.0019877184535379826,3.0026745725009918e-6,-1.4494369758932575e-8,0.001987824315689395,3.1178169485181043e-6,-1.4608579499453113e-8,0.0019878803285720108,3.1671431670578377e-6,-1.4657380747630862e-8,0.001987916017903525,3.1367378731829e-6,-1.4626916752757822e-8,0.00198796225735607,3.0248075252962984e-6,-1.4515412078652403e-8,0.001988047562103157,2.8413753222055076e-6,-1.4332850735856531e-8,0.0019881946131477435,2.60687216740141e-6,-1.4099542829987458e-8,0.001988417298411971,2.349527873938127e-6,-1.3843513258288562e-8,0.0019887187102340417,2.1016769841030624e-6,-1.3596844711551368e-8,0.001989090425727029,1.895388778983732e-6,-1.3391377619170956e-8,0.001989513160461744,1.7578895979745178e-6,-1.3254203612054567e-8,0.001989958770446367,1.7071788559904026e-6,-1.3203316404532476e-8,0.001990393534070427,1.7481911434179824e-6,-1.3243755974189393e-8,0.0019907827350952195,1.8697874359525122e-6,-1.336454230925692e-8,0.00199109681028482,2.0431157285996407e-6,-1.3536978415285554e-8,0.001991319151058384,2.222726763531207e-6,-1.371574429721612e-8,0.0019914544946981836,2.3526243150694117e-6,-1.3844968523515149e-8,0.0019915347809361574,2.379086977407752e-6,-1.3871077631016254e-8,0.001991617224389839,2.269346242030513e-6,-1.376144811926663e-8,0.0019917698902892863,2.0294384279911193e-6,-1.3522157951942242e-8,0.0019920466456429435,1.7095202837346074e-6,-1.3203206351826863e-8,0.001992463423863107,1.3885001624897012e-6,-1.288317749571206e-8,0.0019929908638321907,1.143480512993817e-6,-1.2638853847306288e-8,0.0019935682104733686,1.0214708448982725e-6,-1.2517091776224162e-8,0.0019941285130815195,1.0283869976145581e-6,-1.2523846927649901e-8,0.0019946200002937324,1.1365035316745898e-6,-1.2631538348227922e-8,0.001995015574720192,1.300685938679259e-6,-1.2795181679410482e-8,0.0019953118522825736,1.4734595686959486e-6,-1.2967407715671091e-8,0.0019955231121392253,1.6145721408287418e-6,-1.3108023269665573e-8,0.001995674485554681,1.6953207844439172e-6,-1.3188361405392658e-8,0.001995796372307964,1.6996250991069645e-6,-1.3192379686625797e-8,0.0019959203169879858,1.6236696505985474e-6,-1.3116312565503816e-8,0.0019960757921594096,1.475055708754886e-6,-1.2967807444551166e-8,0.0019962873383381975,1.271613814117125e-6,-1.2764702800757431e-8,0.001996571813660661,1.039617664310189e-6,-1.253321173415832e-8,0.001996935876688311,8.10987734279826e-7,-1.2305124592895642e-8,0.0019973742307001037,6.19237649378676e-7,-1.2113796509748371e-8,0.0019978693382533895,4.943937406260044e-7,-1.198913399233764e-8,0.0019983931254425164,4.575767847518032e-7,-1.1952232495962723e-8,0.0019989108215040154,5.162092500765573e-7,-1.2010593106379118e-8,0.0019993866344011147,6.609218430927506e-7,-1.215498240158599e-8,0.001999790531775251,8.650472468204294e-7,-1.2358850045151053e-8,0.0020001051872744658,1.0872195388065961e-6,-1.258086799786539e-8,0.0020003320300538583,1.2774384887276872e-6,-1.2770987731393865e-8,0.0020004948833237455,1.386820963278251e-6,-1.2880238021882123e-8,0.0020006389899060112,1.380409164658492e-6,-1.2873596607745973e-8,0.0020008230599442827,1.250445294729628e-6,-1.2743295658742569e-8,0.0020011035292148414,1.0248522465183068e-6,-1.2517287786395435e-8,0.0020015145004623476,7.642707366236366e-7,-1.2256256246504428e-8,0.002002052224806011,5.444286659134359e-7,-1.203598958625036e-8,0.0020026739455431216,4.2948544136936147e-7,-1.1920745495741174e-8,0.002003313579512777,4.496948714502562e-7,-1.1940890619262743e-8,0.0020039058326337656,5.94885512572639e-7,-1.208630936784008e-8,0.0020044058510690797,8.245709877731227e-7,-1.2316460457905977e-8,0.002004796841439746,1.0859096843776425e-6,-1.2578353220820108e-8,0.0020050868112686674,1.3296101468781744e-6,-1.2822521486441082e-8,0.0020053001577274294,1.5190539612688328e-6,-1.3012215262669332e-8,0.002005469139021302,1.6331027930982382e-6,-1.3126245137314179e-8,0.0020056275325741548,1.6652065850658668e-6,-1.3158091335992063e-8,0.0020058066106900104,1.6211993428942383e-6,-1.3113673482230696e-8,0.0020060325903481888,1.5170686408574125e-6,-1.3009079439298547e-8,0.002006324650222416,1.3769637497429265e-6,-1.2868534813545612e-8,0.0020066929754689877,1.2310800018681066e-6,-1.2722269046986007e-8,0.002007136798951896,1.1127780991151567e-6,-1.2603647647411476e-8,0.0020076429784578894,1.054378781853201e-6,-1.254500526328362e-8,0.002008186099861188,1.081598763449451e-6,-1.2572118807769247e-8,0.0020087311297168646,1.2074288608481698e-6,-1.2698088673752461e-8,0.002009239103287181,1.4270773152031296e-6,-1.2918234760844035e-8,0.0020096752789058284,1.716007875070945e-6,-1.3208055118895744e-8,0.0020100179652990918,2.0326550064858777e-6,-1.352587734554098e-8,0.0020102654993804938,2.3260539621831587e-6,-1.3820486693134687e-8,0.0020104390771972405,2.547030253336762e-6,-1.4042386690680413e-8,0.002010580106295075,2.6604804750482006e-6,-1.4156191902665433e-8,0.0020107419502173964,2.6557832329077294e-6,-1.4151139319925016e-8,0.0020109771879805558,2.5523069324261464e-6,-1.4046647718123685e-8,0.0020113229426591533,2.397375789826293e-6,-1.3890280276741745e-8,0.0020117884211216064,2.2554114694326285e-6,-1.3746841070905745e-8,0.0020123497341117697,2.1898980519676447e-6,-1.3680257875013628e-8,0.002012955651515441,2.2438213886840194e-6,-1.3733900181722728e-8,0.0020135433728180985,2.4266447610087438e-6,-1.39174182558369e-8,0.0020140579317852875,2.71366437476233e-6,-1.4206014604787913e-8,0.0020144668228012324,3.057204948402956e-6,-1.4551671002974376e-8,0.0020147647475891694,3.403199418756304e-6,-1.4899863316082618e-8,0.0020149692079483423,3.7055522989431925e-6,-1.520408419186706e-8,0.00201511150064555,3.9340846123691215e-6,-1.5433892567141782e-8,0.0020152277251075717,4.076173637410506e-6,-1.5576577887703656e-8,0.002015352239871468,4.134536644454852e-6,-1.563490853663456e-8,0.0020155138461719147,4.123692670047893e-6,-1.5623536213635403e-8,0.002015733840614426,4.0666243269108735e-6,-1.55656072328393e-8,0.0020160248674950276,3.992054942875605e-6,-1.549001455038565e-8,0.002016389829459018,3.93198510839712e-6,-1.542893704410032e-8,0.0020168206820040395,3.918765993757011e-6,-1.541493242521958e-8,0.0020172975756185623,3.980985777701276e-6,-1.5476833726911856E-08,0.0020177894153615887,4.137875398081949e-6,-1.5634127210906082e-8,0.002018257233673766,4.392939175307108e-6,-1.589050240627824e-8,0.0020186613266694954,4.728908346737077e-6,-1.6228694079735292e-8,0.0020189715206215524,5.107091194937329e-6,-1.660975065177038e-8,0.0020191776486713324,5.473615092617835e-6,-1.6979292753435012e-8,0.002019295779758033,5.772429950864491e-6,-1.7280651483171656e-8,0.002019366518176988,5.961349214838775e-6,-1.7471108259171236e-8,0.0020194449006417144,6.025194125173232e-6,-1.7535205282025255e-8,0.0020195851788385455,5.980999551576999e-6,-1.7490022440756466e-8,0.0020198257279237858,5.873603143711555e-6,-1.7380744515888384e-8,0.0020201787279912464,5.763467291729197e-6,-1.7268403150332105e-8,0.002020627231636164,5.710627551405569e-6,-1.7213706810198902e-8,0.002021130054639501,5.7592346508056935e-6,-1.7261429057047976e-8,0.002021632985760314,5.926817997082376e-6,-1.7429501306651574e-8,0.0020220830928120654,6.20118699778434e-6,-1.7705783145695567e-8,0.0020224418380563767,6.54565640069781e-6,-1.8053264624984565e-8,0.002022693062944097,6.910491614078083e-6,-1.842162169656846e-8,0.0020228439203432147,7.246330768272015e-6,-1.876083414523109e-8,0.00202291967499455,7.515105216752511e-6,-1.9032294027402762e-8,0.002022955371584404,7.695808702277565e-6,-1.9214681031198905e-8,0.0020229876289183193,7.785067752112486e-6,-1.9304540519772036e-8,0.002023048591573068,7.794246700981407e-6,-1.931333154928886e-8,0.0020231624980154585,7.745203409912733e-6,-1.926311028183914e-8,0.0020233442466032186,7.666212202219833e-6,-1.918240528759956e-8,0.0020235989734061375,7.588624354679677e-6,-1.9102866270263047e-8,0.002023921859131006,7.544034825291021e-6,-1.9056442936228402e-8,0.0020242978850773183,7.561308638331777e-6,-1.907241483206435e-8,0.0020247018586647472,7.662755338235264e-6,-1.9173526603769192e-8,0.0020250996748987574,7.859045107714878e-6,-1.9370801266084847e-8,0.0020254522736660083,8.143408211325172e-6,-1.9657586738974178e-8,0.0020257235021321623,8.487284167289417e-6,-2.0005064388235096e-8,0.0020258914008579325,8.841089839559924e-6,-2.0362983469746076e-8,0.0020259593522022504,9.143502782538063e-6,-2.0669092452411597e-8,0.002025960886878649,9.339097586877438e-6,-2.0867079499950275e-8,0.0020259529258870486,9.398254944606137e-6,-2.0926796085751366e-8,0.0020259980842913805,9.329515946722925e-6,-2.085676872498728e-8,0.0020261436498098338,9.177436067364245e-6,-2.0702003689784143e-8,0.002026406976788043,9.007145260904893e-6,-2.0528373390696197e-8,0.0020267726311981303,8.883574211806648e-6,-2.0401649057662443e-8,0.002027200045442295,8.85396367750792e-6,-2.0369837232274553e-8,0.00202763668051562,8.938366466169523e-6,-2.0453528387901555e-8,0.002028031669042613,9.128606584898225e-6,-2.0644735364591285e-8,0.0020283466335991557,9.39376249959402e-6,-2.0912327645621907e-8,0.00202856210099846,9.689503075361093e-6,-2.121142268331872e-8,0.002028679138809268,9.968698912730516e-6,-2.1494151041399055e-8,0.0020287166795685033,1.0191047732068404e-5,-2.1719481725996414e-8,0.0020287057358542504,1.0329897581158466e-5,-2.186021727137697e-8,0.0020286822638829623,1.0375287950705e-5,-2.1906123600102078e-8,0.0020286804677956084,1.0333353870444897e-5,-2.186332802988044e-8,0.0020287278066525257,1.022312602899354e-5,-2.175105158087606e-8,0.0020288421647846723,1.0072112218170743e-5,-2.1597111262225863e-8,0.0020290308875681577,9.911875842701016e-6,-2.143344844153332e-8,0.0020292909665944156,9.774243576700235e-6,-2.129232494824514e-8,0.0020296097239808366,9.688113323346603e-6,-2.1203133387480477e-8,0.0020299656877050217,9.67644684934271e-6,-2.11893658424898e-8,0.0020303297882378582,9.752905982662366e-6,-2.1265165055571597e-8,0.0020306676073327287,9.917766980710009e-6,-2.1431087980682735e-8,0.002030943934628873,1.0153584998504719e-5,-2.1669593622508353e-8,0.0020311306708723493,1.0422590466425067e-5,-2.1942323425636325e-8,0.002031217579951732,1.0669289798588603e-5,-2.219275019954811e-8,0.002031222335730858,1.0831796516238949e-5,-2.235778014634001e-8,0.002031193048301995,1.0861890930176747e-5,-2.2388241959551486e-8,0.00203119703859634,1.0746492481003186e-5,-2.2270735146629827e-8,0.002031297195154339,1.0517768776177442e-5,-2.2037844471414716e-8,0.0020315273094421984,1.0243291108028e-5,-2.1758092239078608e-8,0.0020318802493412753,1.0000530434740792e-5,-2.1510081000851584e-8,0.002032314137298937,9.850022664826762e-6,-2.1355340836590286e-8,0.002032770207259545,9.81982278786599e-6,-2.132258299426645e-8,0.0020331917199350323,9.904280503784482e-6,-2.14063888568104e-8,0.002033536949342053,1.0072489993620747e-5,-2.157566092331201e-8,0.0020337847861032054,1.0280151984724976e-5,-2.178555756437125e-8,0.002033934644404204,1.0480633734434917e-5,-2.1988684509594312e-8,0.002034002956023895,1.0633476288885205e-5,-2.2143773497299168e-8,0.0020340179562521273,1.0710065550269308e-5,-2.222152752762457e-8,0.002034013813275749,1.0696609639052564e-5,-2.2207730651406188e-8,0.002034024860105363,1.0594604521297306e-5,-2.2103765848150748e-8,0.002034080587443095,1.0419122419825089e-5,-2.19248717814829e-8,0.0020342019278727854,1.0195455518673118e-5,-2.169670062200928e-8,0.0020343991620295483,9.954802844166271e-6,-2.145091239995425e-8,0.0020346714321390342,9.729785129053017e-6,-2.122063084652677e-8,0.0020350074824118905,9.550386709694598e-6,-2.103636451097717e-8,0.002035387185509016,9.440493583899565e-6,-2.0922533216016104e-8,0.0020357836037984364,9.414912608424384e-6,-2.089444107511516e-8,0.0020361655489376162,9.476655420791237e-6,-2.0955452598258494e-8,0.002036501001353076,9.614310232276557e-6,-2.1094206564680248e-8,0.002036762210872142,9.79994037620005e-6,-2.1282363869390327e-8,0.0020369330481708123,9.989184837192771e-6,-2.1474658477092256e-8,0.002037017771296381,1.012628359366276e-5,-2.1614061269663444e-8,0.002037047915437464,1.015658110540848e-5,-2.164463677168314e-8,0.0020370813026867737,1.0046056108125668e-5,-2.153154985964805e-8,0.0020371875508600258,9.800650799576031e-6,-2.1280773292665346e-8,0.002037421936656467,9.472336381754918e-6,-2.094520101904596e-8,0.0020378005857027153,9.143072453333508e-6,-2.0608270685343048e-8,0.0020382928899801513,8.892876275813154e-6,-2.035149508235166e-8,0.0020388358398022157,8.770499811406708e-6,-2.0224669132370346e-8,0.002039359770557812,8.781941663669052e-6,-2.0234157130035133e-8,0.0020398103504522254,8.897729739466089e-6,-2.0350211586612295e-8,0.0020401588643933475,9.069382952218172e-6,-2.0523629149456965e-8,0.0020404019625274035,9.245293559122839e-6,-2.0701866584475123e-8,0.002040555827693921,9.381504609670853e-6,-2.0840025781472896e-8,0.0020406489259659406,9.447228151930216e-6,-2.0906536788607898e-8,0.0020407154331214734,9.426696770852405e-6,-2.088512838607746e-8,0.00204078985578392,9.318873354513713e-6,-2.077459998128169e-8,0.00204090271395194,9.135845367544504e-6,-2.0587206452044835e-8,0.0020410771407216085,8.900239108317796e-6,-2.034599700431967e-8,0.002041326419699712,8.641807325844239e-6,-2.0081292128129632e-8,0.0020416526435947345,8.393337339943669e-6,-1.982648942593215e-8,0.002042046703171445,8.186237577472187e-6,-1.9613586261310882e-8,0.0020424895896427346,8.046339142518472e-6,-1.9468954219893878e-8,0.0020429547843234747,7.990305000968632e-6,-1.940972395069631e-8,0.0020434115251253306,8.022843551834938e-6,-1.9440936885743926e-8,0.002043828782565443,8.134892448156656e-6,-1.9553616311880043e-8,0.0020441798602190554,8.302917025788585e-6,-1.972393223071845e-8,0.0020444477519546617,8.4896969525292e-6,-1.9913901817449882e-8,0.0020446311903293338,8.647706547103258e-6,-2.0074815114312748e-8,0.0020447501973034107,8.726723226422148e-6,-2.0155077328217368e-8,0.002044848244940901,8.686627904246379e-6,-2.011341515541943e-8,0.0020449867383772256,8.513737749746249e-6,-1.9935671842505055e-8,0.002045228541166259,8.234144633017872e-6,-1.964846070320371e-8,0.0020456134638839763,7.913572361465218e-6,-1.931898185881672e-8,0.0020461377861319533,7.63729312921591e-6,-1.9034476270744172e-8,0.0020467521585061633,7.477202828544634e-6,-1.8868592712503943e-8,0.002047381272856939,7.464688941483806e-6,-1.8853644549237028e-8,0.0020479532062943314,7.58431837206364e-6,-1.8974080315531745e-8,0.0020484215587382487,7.78774400789283e-6,-1.918060677428675e-8,0.0020487722662357426,8.015405362121847e-6,-1.941233147259879e-8,0.002049018198077936,8.214197838192044e-6,-1.9614843383185996e-8,0.0020491889216315115,8.346735295295853e-6,-1.9749735808637718e-8,0.0020493210512069144,8.393632060507522e-6,-1.979700451228811e-8,0.0020494512449664246,8.351957607960816e-6,-1.9753525015406534e-8,0.0020496117250101715,8.23232744734854e-6,-1.963010652990153e-8,0.002049827426776408,8.055769435622714e-6,-1.944827439536342e-8,0.002050114053526486,7.850558869214728e-6,-1.9236989441846953e-8,0.0020504767490431433,7.648847136675355e-6,-1.9029157282885984e-8,0.0020509094756088818,7.482854532348159e-6,-1.8857725613841873e-8,0.002051395453334524,7.380623768682452e-6,-1.8751377321085998e-8,0.0020519090052662243,7.361760387571575e-6,-1.8730230620980626e-8,0.0020524188593675297,7.433818308990292e-6,-1.8802173480598776e-8,0.0020528926844391848,7.589950602549962e-6,-1.8960428834936324e-8,0.0020533024421489844,7.808390524123514e-6,-1.9182928498524213e-8,0.0020536299340462158,8.054192913403938e-6,-1.9433978306497595e-8,0.0020538718361486044,8.283434195619361e-6,-1.9668482974938482e-8,0.0020540434289632683,8.45004521906672e-6,-1.9838956797592828e-8,0.0020541797514216247,8.515402796906978e-6,-1.99054534057615e-8,0.0020543322054149753,8.459930706160225e-6,-1.984759651675978e-8,0.0020545585952090927,8.293944827313858e-6,-1.9675807879402267e-8,0.0020549063810787,8.062431097372e-6,-1.9436246264897823e-8,0.0020553934153247633,7.837497117823304e-6,-1.920304947832446e-8,0.002055995700465939,7.696451661454231e-6,-1.9055809090821722e-8,0.002056651811353018,7.693154521324639e-6,-1.9050112336143213e-8,0.0020572846695030584,7.837818600247798e-6,-1.919671296351236e-8,0.002057829365555983,8.096658859821898e-6,-1.946106441052887e-8,0.002058252145844519,8.409493816274429e-6,-1.978134730901258e-8,0.0020585536030746266,8.712990432294358e-6,-2.0092375696100318e-8,0.002058759808669095,8.957877739096902e-6,-2.0343349339844396e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_17.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_17.json deleted file mode 100644 index 64ee0a0a..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_17.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":17000,"numberOfSamples":1000,"samples":[0.0020589095356776037,9.116105504093818e-6,-2.0505272164235435e-8,0.002059043510293161,9.180255067418492e-6,-2.0570390059257767e-8,0.0020591976431414568,9.159302745262173e-6,-2.054785882824188e-8,0.002059399625909375,9.073759899582225e-6,-2.045874721325323e-8,0.0020596674746746844,8.95148439515232e-6,-2.033170765436402e-8,0.00206000888513569,8.824207938457376e-6,-2.019937465729761e-8,0.002060420904195782,8.724308617167852e-6,-2.0095032184184587e-8,0.0020608899779143205,8.68132520947309e-6,-2.0049049012491025e-8,0.0020613928365786132,8.717972919315283e-6,-2.008482719556681e-8,0.0020618988348358,8.845955809078727e-6,-2.021453482958727e-8,0.002062374125258358,9.062441716260134e-6,-2.0435474508193457e-8,0.0020627874895708226,9.348364762479418e-6,-2.072826871336509e-8,0.0020631169945883126,9.669654112154566e-6,-2.1058015950605946e-8,0.0020633560604633263,9.98198746864013e-6,-2.137908652587735e-8,0.002063517288428266,1.023877017749716e-5,-2.164330411583651e-8,0.002063632645942536,1.0401139220424818e-5,-2.1810299545772995e-8,0.0020637491502467223,1.0448183572471843e-5,-2.185815206205818e-8,0.0020639198525462597,1.0385066085844465e-5,-2.1791885352537092e-8,0.002064190922547863,1.0246206042140799e-5,-2.1646843352671344e-8,0.002064587291919049,1.0090636415679369e-5,-2.1483949591921145e-8,0.0020651014652658243,9.988078798241432e-6,-2.13753442005915e-8,0.002065691367589172,9.998026570269695e-6,-2.1382754626188622e-8,0.002066291012197917,1.0149230388591655e-5,-2.153622147579785e-8,0.002066831501387849,1.0429452683376921e-5,-2.182338975756979e-8,0.002067263169333099,1.0791237145000513e-5,-2.2195367611649683e-8,0.002067568557615017,1.1170401662074308e-5,-2.2585814103541868e-8,0.0020677618994642912,1.1507219742502304e-5,-2.2932879418767003e-8,0.0020678786593962845,1.1760992660056131e-5,-2.319433420100162e-8,0.00206796228678175,1.1914801500387303e-5,-2.3352529680849556e-8,0.0020680536670884195,1.1972789302221374e-5,-2.3411612372762594e-8,0.002068185083895209,1.1954165594086708e-5,-2.339133460421787e-8,0.0020683778972125345,1.1887104070253944e-5,-2.3320744180844544e-8,0.002068642307553408,1.180390121082168e-5,-2.3233173740066774e-8,0.002068977856263579,1.1737393814191125e-5,-2.3162537647244684e-8,0.002069373999389383,1.1717978706675388e-5,-2.3140267827765654e-8,0.0020698107873335274,1.1770514429890422e-5,-2.3192140613020073e-8,0.0020702602014525747,1.1910715973072524e-5,-2.3334573248691355e-8,0.002070688939508567,1.2141252692424613e-5,-2.3570578997251697e-8,0.0020710632916822844,1.2448527390387745e-5,-2.3886375187523575e-8,0.002071356066541742,1.2801803268012288e-5,-2.4250382510760558e-8,0.0020715543319876706,1.3156451701310057e-5,-2.4616491549786515e-8,0.00207166551766087,1.3462116971780244e-5,-2.493246716960177e-8,0.002071719050649512,1.3674624989544023e-5,-2.5152297788431047e-8,0.0020717617377544535,1.3768431742533288e-5,-2.524915847137308e-8,0.0020718472574079074,1.374550081599251e-5,-2.5224700784713937e-8,0.0020720223622184525,1.363727582508806e-5,-2.5111195478472052e-8,0.0020723137031515636,1.3498471162329928e-5,-2.496519243244624e-8,0.002072719191338335,1.339381780152275e-5,-2.485385332221292e-8,0.002073206795757431,1.338096643139214e-5,-2.483723759380846e-8,0.0020737219362692,1.3494245133198445e-5,-2.4951381108780162e-8,0.00207420211020392,1.373455339359368e-5,-2.5197661804572466e-8,0.0020745944143773383,1.4069430089365293e-5,-2.554271199173207e-8,0.002074869746023746,1.4443723774723879e-5,-2.5929405831806994e-8,0.0020750285128816304,1.479667972622433e-5,-2.6294607590510123e-8,0.0020750966176363173,1.5078544268788864e-5,-2.6586483364644268e-8,0.0020751148669499956,1.5260889492796408e-5,-2.677529701011583e-8,0.0020751270004247535,1.5338783722705668e-5,-2.6855711891848633e-8,0.0020751704833224575,1.5326746513909972e-5,-2.684261106263222e-8,0.0020752715762822763,1.5251984116094389e-5,-2.6764080409271047e-8,0.002075444009124103,1.5147762629496005e-5,-2.6654533703698157e-8,0.002075689729548116,1.504827746606285e-5,-2.6549398220846943e-8,0.002076000366210549,1.4985082629739757e-5,-2.6481430881895264e-8,0.002076358657231711,1.498441301720375e-5,-2.6477967033587838e-8,0.0020767397992757677,1.5064587977735741e-5,-2.6558240543651232e-8,0.002077113259954405,1.5233004156103975e-5,-2.6730240753699176e-8,0.0020774459186594374,1.548284453443912e-5,-2.6987226620384064e-8,0.002077707337417931,1.5790500049088474e-5,-2.7304945193864276e-8,0.002077877261826839,1.6115682164498162e-5,-2.764165309505029e-8,0.0020779538822941765,1.6406603632449e-5,-2.7943458192743133e-8,0.0020779594398716464,1.6611353072832964e-5,-2.8156170195329946e-8,0.0020779390055978278,1.6693382219093287e-5,-2.824146792653341e-8,0.0020779502913158923,1.6645409426593984e-5,-2.8191416586278918e-8,0.002078046844161103,1.6494938438233428e-5,-2.803425405045996e-8,0.0020782610782756087,1.6297779276038386e-5,-2.782772424649056e-8,0.0020785941150732565,1.612175588363035e-5,-2.7642241561896423e-8,0.0020790159587568842,1.6027141518751153e-5,-2.754063775278662e-8,0.0020794748756735038,1.6050743503202965e-5,-2.756160492638588e-8,0.0020799118940896845,1.619791239208086e-5,-2.7711253577368164e-8,0.0020802757626315633,1.6443513592555717e-5,-2.7963924844698012e-8,0.0020805345246273253,1.674043522617959e-5,-2.8270877063799093e-8,0.002080681226938013,1.7032634096537527e-5,-2.857380300224129e-8,0.002080732951995497,1.7268943244941685e-5,-2.881925151534997e-8,0.002080724194408864,1.7413982316484317e-5,-2.8970092565580946e-8,0.0020806971435383278,1.745367834708195e-5,-2.901136620869484e-8,0.0020806920260737966,1.7394912621893336e-5,-2.8949975367327408e-8,0.002080739988704213,1.72607815502705e-5,-2.8809768850635676e-8,0.002080859515267317,1.70838985357426e-5,-2.8624560861473263e-8,0.0020810559636607064,1.6899885539921436e-5,-2.8431349761988563e-8,0.0020813230557203376,1.6742274751481572e-5,-2.8265022453786016e-8,0.0020816451171855417,1.6639033795220282e-5,-2.8154767386943654e-8,0.0020819993189068113,1.6610203007369465e-5,-2.812164312243963e-8,0.0020823577851628115,1.6665911699555345e-5,-2.817650914736122e-8,0.0020826899633292987,1.680426930790959e-5,-2.8317770861029884e-8,0.002082966018551884,1.7009150846059025e-5,-2.852896394235378e-8,0.002083162073066397,1.7248756752608075e-5,-2.8777135556946513e-8,0.0020832674579102563,1.7476932878513038e-5,-2.9014151463292816e-8,0.0020832924694833594,1.7639846001218737e-5,-2.9183675584427234e-8,0.0020832727739094805,1.7689422424584678e-5,-2.9235274256026354e-8,0.0020832653064138955,1.7601030960855478e-5,-2.9142946193151746e-8,0.0020833330245630757,1.7387646058308056e-5,-2.8919920603682593e-8,0.002083522753935488,1.7100955802243916e-5,-2.8619808329920083e-8,0.0020838468179513333,1.6815710705222776e-5,-2.8320330725747508e-8,0.002084278439419095,1.6604039049236554e-5,-2.8096659219011013e-8,0.0020847625566020353,1.6512511531122853e-5,-2.799759622144117e-8,0.002085235023267062,1.6551414097566436e-5,-2.8034351982823543e-8,0.0020856408987005555,1.6697366798988196e-5,-2.8183104552679034e-8,0.0020859461245631033,1.690450794263447e-5,-2.8396456266918066e-8,0.0020861415082864985,1.7118421130651345e-5,-2.8617819915088376e-8,0.0020862405867537945,1.7288696492304295e-5,-2.8794501922373435e-8,0.0020862736330299575,1.737809826474195e-5,-2.8887350772104285e-8,0.002086279804006059,1.7367702998098975e-5,-2.8876251011356654e-8,0.0020862990421835854,1.7258011428210435e-5,-2.8761400589556528e-8,0.002086365115922038,1.7066487746353264e-5,-2.8560802190087286e-8,0.0020865008408489875,1.682256943694604e-5,-2.8305053907286174e-8,0.002086715919263949,1.656156014476701e-5,-2.8030941270095572e-8,0.0020870071990390262,1.6318714925791584e-5,-2.7775237638634485e-8,0.0020873606761909773,1.612444436636325e-5,-2.7569706696292268e-8,0.0020877543487093165,1.6001012803300085e-5,-2.7437694306513178e-8,0.0020881612220372825,1.596050578626689e-5,-2.7392040420271822e-8,0.002088552230288847,1.6003549082607828e-5,-2.7433729548710437e-8,0.0020888992435952967,1.611837191802468e-5,-2.7550832366391624e-8,0.0020891786471092483,1.6280160651193357e-5,-2.7717702617435652e-8,0.0020893761169842166,1.6451350603092855e-5,-2.7895164399045403e-8,0.002089492678959948,1.6584503687808136e-5,-2.803347849401429e-8,0.0020895506186168747,1.6629975070205594e-5,-2.8080421596796448e-8,0.0020895956639829702,1.654957839540818e-5,-2.799570583593579e-8,0.002089690395538273,1.6333804471878623e-5,-2.7769090685971695e-8,0.002089896033722322,1.6014373257708863e-5,-2.7433529126734662e-8,0.0020902475806469254,1.5661140369289124e-5,-2.7061908434893643e-8,0.002090735796633609,1.5359270098771867e-5,-2.67432120407e-8,0.00209130859780546,1.5176778132377433e-5,-2.6548672939580005e-8,0.002091891842946931,1.5140754055244766e-5,-2.6506954770801897e-8,0.0020924165245282877,1.5233761825979138e-5,-2.660030176659009e-8,0.002092838108888907,1.5407435049015967e-5,-2.6778581186473033e-8,0.0020931426145603437,1.5602073463539797e-5,-2.697961713028947e-8,0.002093342524197185,1.576303163752042e-5,-2.7146256028244872e-8,0.0020934681224012187,1.5850536534203465e-5,-2.7236664035016808e-8,0.002093558330924372,1.584356238962605e-5,-2.7228488040135843e-8,0.002093652929189025,1.5739702587511593e-5,-2.711885649216876e-8,0.002093786585558144,1.5552692842214613e-5,-2.6921891528832596e-8,0.002093984610700063,1.530847635566744e-5,-2.6664625730728237e-8,0.002094260408522702,1.5040327883243397e-5,-2.6381866829385993e-8,0.0020946146605398033,1.4783590396206654e-5,-2.6110629573656682e-8,0.0020950361908124754,1.4570612940870071e-5,-2.5884801421741135e-8,0.002095504287982403,1.4426464136665532e-5,-2.573066979561237e-8,0.0020959920098880948,1.436589162782448e-5,-2.566378974830331e-8,0.0020964698904481064,1.4391654082877689e-5,-2.568727581986414e-8,0.002096909672107035,1.4494027260271335e-5,-2.5791262682142066e-8,0.002097287955238897,1.4651254484391914e-5,-2.595327902709219e-8,0.0020975898588619776,1.483086589384205e-5,-2.6139490483611765e-8,0.0020978129239909112,1.4992194433574303e-5,-2.6307227096703933e-8,0.002097971126731232,1.5091109530391926e-5,-2.6409931481351222e-8,0.002098097703998993,1.5088284225384236e-5,-2.6405927211233465e-8,0.002098243998954342,1.4961356647547054e-5,-2.6271336291410024e-8,0.002098470643735973,1.4718558663920096e-5,-2.601451060716538e-8,0.002098829142769062,1.4406847413029446e-5,-2.568461021728266e-8,0.002099338584112944,1.4104891981013634e-5,-2.5364227738068856e-8,0.002099970577078888,1.389718581053549e-5,-2.51422113367583e-8,0.0021006554024350413,1.3839945599057747e-5,-2.5077873022135188e-8,0.0021013089162565824,1.3939075366767634e-5,-2.5177804466452004e-8,0.0021018642410454017,1.4152966541286029e-5,-2.5398697748388907e-8,0.002102290544234685,1.4414719463911722e-5,-2.5670555129297722e-8,0.002102593458372229,1.4657717276490355e-5,-2.5923475251490083e-8,0.002102803823419274,1.4832523419603329e-5,-2.610539494337901e-8,0.002102963997051854,1.4912874042482475e-5,-2.6188440763515092e-8,0.00210311701985688,1.489429901720448e-5,-2.6167581509441245e-8,0.00210329981316489,1.4789514144286761e-5,-2.605589711490424e-8,0.0021035395604685125,1.4623216960515582e-5,-2.5879181897882027e-8,0.002103852012857229,1.4427256816148642e-5,-2.5670874573032203e-8,0.0021042409306866908,1.4236166858646234e-5,-2.546731313778813e-8,0.002104698454320543,1.4082882456060734e-5,-2.53031751996881e-8,0.0021052064752133293,1.3994654154339699e-5,-2.5207158431920774e-8,0.0021057391315831625,1.3989407920046565e-5,-2.519818244598461e-8,0.002106266387320575,1.4073050130678136e-5,-2.5282607415599342e-8,0.002106758334830071,1.423820083636465e-5,-2.5452924691916057e-8,0.0021071897012097697,1.4464569256647e-5,-2.568810271807864e-8,0.0021075440763852053,1.4720984983073159e-5,-2.5955605114652786e-8,0.002107817455023985,1.4968991587208612e-5,-2.6215033812032676e-8,0.0021080207898770947,1.5167881763610569e-5,-2.6423345985019315e-8,0.0021081811782254606,1.52812712911579e-5,-2.6541802838830476e-8,0.002108340721814446,1.5285367127017497e-5,-2.6544815228638046e-8,0.002108551393130802,1.5178224387244792e-5,-2.6429882679400344e-8,0.0021088642657054028,1.4987405902763008e-5,-2.6225817522741596e-8,0.0021093131823441873,1.477109413125047e-5,-2.5993980396136906e-8,0.0021098973634679687,1.4606796678395606e-5,-2.5816350529623914e-8,0.0021105729078048107,1.4566334520348138e-5,-2.5769076832392603e-8,0.0021112628777701157,1.4686483996552583e-5,-2.589140375989459e-8,0.002111884963727069,1.49524858304974e-5,-2.616814292368397e-8,0.0021123820416213326,1.530564027223351e-5,-2.653758083888853e-8,0.002112738443062604,1.566943862865359e-5,-2.6919021383359056e-8,0.0021129763380782042,1.597734406587063e-5,-2.7242128079128386e-8,0.002113139906608551,1.6188913189144726e-5,-2.7463982116337144e-8,0.0021132785147635735,1.6292255587917617e-5,-2.7571731956963736e-8,0.002113435244892276,1.6298231436790853e-5,-2.7576542617677282e-8,0.002113641467647694,1.623231108640538e-5,-2.750507948119659e-8,0.0021139155020888497,1.612742596429646e-5,-2.739200662875825e-8,0.002114263195353226,1.601868102419684e-5,-2.7274398004963558e-8,0.002114679097938746,1.5939462619916927e-5,-2.7187584649230205e-8,0.002115147857818045,1.591820498712063e-5,-2.7161697731839154e-8,0.0021156460082405507,1.5975354031712748e-5,-2.7218453269601503e-8,0.0021161445333496127,1.6120489838517026e-5,-2.736813658476198e-8,0.002116612541248858,1.6350066999505276e-5,-2.7607239032229045e-8,0.002117021983644663,1.6646569377117553e-5,-2.791754490148783e-8,0.002117352837098394,1.697979911393296e-5,-2.826741083990463e-8,0.0021175978015787107,1.731065634053247e-5,-2.8615637817191073e-8,0.00211776543378165,1.759725263509948e-5,-2.8917829165943654e-8,0.002117880769420787,1.7802584133189674e-5,-2.9134478291953385e-8,0.002117982886203447,1.7902584529889876e-5,-2.9239569317390042e-8,0.002118119198387002,1.7893289828263934e-5,-2.922832774864068e-8,0.002118336487991736,1.7795584944785858e-5,-2.9122440610658274e-8,0.0021186692843823997,1.7655389538035962e-5,-2.8970402749374115e-8,0.0021191276345471233,1.7536852324466382e-5,-2.8840362727093884e-8,0.0021196884143433207,1.7507199823531867e-5,-2.880401634238384e-8,0.002120295925762307,1.7615411346021366e-5,-2.8913861014445143e-8,0.0021208758106100725,1.787247903713528e-5,-2.9182079529307654e-8,0.002121359406182991,1.8244267405424016e-5,-2.9572807067690778e-8,0.0021217074721560777,1.8663209769622012e-5,-3.0014474124992184e-8,0.0021219209004431955,1.905356541542978e-5,-3.042663828206199e-8,0.0021220343298265485,1.9356536768551152e-5,-3.0746705244532125e-8,0.002122099166839674,1.954377814105041e-5,-3.094431491310143e-8,0.002122166330543905,1.9617217855782224e-5,-3.102119259421685e-8,0.0021222752180405586,1.9600531064406503e-5,-3.100215517299388e-8,0.002122449658514504,1.952878967527067e-5,-3.092419165467688e-8,0.0021226984612435964,1.9440127761138346e-5,-3.082765962692926e-8,0.002123017846957808,1.9370314072744265e-5,-3.075052790344494e-8,0.0021233940681903195,1.934948928989278e-5,-3.0724888774326296e-8,0.0021238056794888474,1.9399952935627528e-5,-3.077458440678296e-8,0.002124225682580438,1.9534193054597844e-5,-3.091310551719368e-8,0.002124624113565031,1.9752886458047202e-5,-3.1141464105636413e-8,0.002124971655833702,2.0043233580223036e-5,-3.144639940286134e-8,0.00212524450155675,2.037859705176521e-5,-3.179992728445566e-8,0.002125429949440885,2.0720660307119964e-5,-3.216153381034379e-8,0.0021255313735390655,2.1024952911718785e-5,-3.2483951488909524e-8,0.0021255706390746042,2.1249553405534983e-5,-3.272236244662322e-8,0.0021255862274255134,2.136531580176944e-5,-3.284530096658392e-8,0.002125626472329969,2.136477599867833e-5,-3.2844230643420137e-8,0.0021257389764561077,2.1266765123494018e-5,-3.273861136499655e-8,0.0021259586471253046,2.1114766388613177e-5,-3.2574325849611996e-8,0.0021262973922635143,2.0968604798671925e-5,-3.241497651320302e-8,0.0021267384416393392,2.0890666115759917e-5,-3.2327268627746654e-8,0.0021272376715695132,2.0929425811587144e-5,-3.236339970670092e-8,0.002127733046172089,2.110460424404699e-5,-3.2545061768599696e-8,0.00212816092546539,2.1399236109442378e-5,-3.2854762929754035e-8,0.0021284746737500223,2.176302809822261e-5,-3.3239236614057686e-8,0.002128658496133636,2.212740460159936e-5,-3.362543623506609e-8,0.0021287304336883744,2.2426834845535454e-5,-3.3943333219980947e-8,0.0021287335646911943,2.2617434207905126e-5,-3.414584047635682e-8,0.0021287204228760234,2.2685679731977404e-5,-3.421817395035784e-8,0.0021287380406940413,2.264602236182866e-5,-3.417535947240264e-8,0.002128818715188701,2.2531501692113913e-5,-3.4052283410800604e-8,0.002128977344015476,2.2382911676892006e-5,-3.3892197642410027e-8,0.002129213263803856,2.2240213464310166e-5,-3.373760006185234e-8,0.0021295139322477768,2.2137245808817076e-5,-3.362460002842891e-8,0.0021298586205894944,2.2099046795842652e-5,-3.358004972356987e-8,0.0021302214146577676,2.2140545104573738e-5,-3.362013028869592e-8,0.0021305737006618716,2.2265607580957118e-5,-3.374931398457121e-8,0.0021308867762918587,2.2466010723704024e-5,-3.39592257518173e-8,0.002131135293920836,2.2720594046935103e-5,-3.4227667717305434e-8,0.0021313019334212695,2.2995565753170124e-5,-3.451884933521096e-8,0.0021313829342262734,2.3247460182788705e-5,-3.4786456209133385e-8,0.0021313929103826883,2.3430080081429465e-5,-3.4981018338903236e-8,0.0021313662623369065,2.35053775592328e-5,-3.506154647311194e-8,0.002131352534668617,2.3455775394926864e-5,-3.500875472352498e-8,0.0021314050619435174,2.3293157757724045e-5,-3.483475480248656e-8,0.0021315656878382726,2.305959461858975e-5,-3.458394904972025e-8,0.002131851148769884,2.2817817875395575e-5,-3.432300884872676e-8,0.002132246675708553,2.2634145895239077e-5,-3.412278123476084e-8,0.0021327093056224787,2.255991732479814e-5,-3.4038512859965103e-8,0.0021331794386085386,2.261762912569421e-5,-3.4094941293936804e-8,0.002133596614516856,2.2795606804280943e-5,-3.4280365800889207e-8,0.0021339148569076657,2.3052078776754165e-5,-3.455073970041519e-8,0.0021341135296762083,2.3327034579694484e-5,-3.484217778475803e-8,0.0021342009716787884,2.355832491670355e-5,-3.508814955727273e-8,0.0021342101969445745,2.3697300658380293e-5,-3.523629751598651e-8,0.0021341884075972216,2.3719450332254015e-5,-3.525994944230765e-8,0.002134184081791398,2.3627331849970435e-5,-3.5161372712859956e-8,0.002134235900463689,2.3446066878692636e-5,-3.4967036409302774e-8,0.0021343663946126897,2.321429430328426e-5,-3.471798296710547e-8,0.0021345807976598918,2.2974350116389325e-5,-3.4459344612988514e-8,0.0021348696549837566,2.2764450779378168e-5,-3.4231980765256686e-8,0.0021352131046345666,2.2613905870942357e-5,-3.4067347153649095e-8,0.0021355851791665065,2.25409643711599e-5,-3.398518306415485e-8,0.002135957353588875,2.255223300982052e-5,-3.3992879723749303e-8,0.0021363013822437923,2.264265540717151e-5,-3.408542886166249e-8,0.0021365919676518924,2.279553658100697e-5,-3.4245382178955386e-8,0.0021368099415358917,2.298274820199354e-5,-3.444296877039347e-8,0.0021369464146205742,2.3165964903851673e-5,-3.463731317033913e-8,0.0021370076236995232,2.3300428516159704e-5,-3.4780406073762714e-8,0.0021370188901841084,2.334275576213467e-5,-3.482548254690987e-8,0.002137024662802771,2.3262920180390915e-5,-3.473993474880969e-8,0.0021370813223880038,2.3057492795026685e-5,-3.451958523389752e-8,0.002137241889275746,2.2757801904735166e-5,-3.41974981982623e-8,0.0021375370262618257,2.2426116340509338e-5,-3.3839966919214845e-8,0.002137961316631726,2.213800200907653e-5,-3.3527737842564464e-8,0.0021384728126343628,2.1957459800264673e-5,-3.332951347872889e-8,0.002139006670366777,2.191643370582827e-5,-3.3280036206354196e-8,0.0021394959229136664,2.2007302232413204e-5,-3.3371904617377737e-8,0.0021398901271324055,2.2189143712365275e-5,-3.3562023526722955e-8,0.002140166006414651,2.2402515162981413e-5,-3.378718549615929e-8,0.002140329077781706,2.2586184572995143e-5,-3.398186921720036e-8,0.0021404083035632985,2.2691063196128188e-5,-3.409319354061641e-8,0.002140446731689183,2.2688976940126358e-5,-3.409045739764433e-8,0.002140490895281052,2.2575699890952926e-5,-3.396857223236857e-8,0.0021405812375513067,2.2368761539972847e-5,-3.374586429282327e-8,0.002140745261299301,2.21013187905107e-5,-3.345758704823717e-8,0.002140994332456639,2.181402372302832e-5,-3.314720913566537e-8,0.002141324077070165,2.15469856889004e-5,-3.285775427864785e-8,0.002141717448243737,2.1333424920190157e-5,-3.262494699138589e-8,0.0021421491254591573,2.1195757227350775e-5,-3.247299004550511e-8,0.0021425900057506363,2.1143998775028036e-5,-3.2412859574264454e-8,0.002143011062769476,2.117578153748411e-5,-3.2442332125159627e-8,0.0021433864887417924,2.1277166088685482e-5,-3.254683206575627e-8,0.0021436964440635616,2.142377656843826e-5,-3.270056832632809e-8,0.0021439298869587705,2.1582271289495213e-5,-3.2867992137633203e-8,0.0021440878674806683,2.1712763255525305e-5,-3.3006289361086e-8,0.002144187054590783,2.1773439803346106e-5,-3.3070310510598916e-8,0.002144262009093983,2.172867744059509e-5,-3.302135431596869e-8,0.002144363336494184,2.156066898233932e-5,-3.2839788635029706e-8,0.0021445484486645283,2.128161554298987e-5,-3.253826914107641e-8,0.0021448640499980975,2.093968006406232e-5,-3.216820242252745e-8,0.0021453256085358927,2.0610778355504582e-5,-3.181096877059883e-8,0.002145905198301666,2.0374493068902587e-5,-3.155211428654284e-8,0.00214653761622983,2.028404497865664e-5,-3.144915450204835e-8,0.002147143609271417,2.0346789600608755e-5,-3.151058660106004e-8,0.0021476575414585346,2.0525272704293914e-5,-3.1696854344447995e-8,0.002148045581613403,2.0755200980876327e-5,-3.193942834876001e-8,0.0021483090662633483,2.0968393190590092e-5,-3.2165288983192186e-8,0.002148476685362016,2.111059951237463e-5,-3.231601401750927e-8,0.002148592188673189,2.115054857145032e-5,-3.235756967674147e-8,0.0021487026050471423,2.108140192452833e-5,-3.2282037014221544e-8,0.002148849218208448,2.091738286919093e-5,-3.2104180012498956e-8,0.0021490617141141114,2.0687943158359667e-5,-3.185531826563116e-8,0.0021493552248900965,2.043093865495207e-5,-3.1576037272193084e-8,0.0021497299103959574,2.018578295980443e-5,-3.1308781112487576e-8,0.0021501726730506327,1.99873898678633e-5,-3.109124846202539e-8,0.0021506604730088547,1.986152543363258e-5,-3.0951322070678607e-8,0.0021511645783630928,1.9821951349432184e-5,-3.0903980935864254e-8,0.0021516549924586936,1.986945352369192e-5,-3.0950285248140185e-8,0.0021521044365688485,1.9992440843010033e-5,-3.107804747030246e-8,0.0021524916686676407,2.016856874486101e-5,-3.126355090492214e-8,0.0021528042317079527,2.0367018571783807e-5,-3.147390414350625e-8,0.002153040804545645,2.0551375958833374e-5,-3.167000555671362e-8,0.002153213305985311,2.0683403675124328e-5,-3.181050955508008e-8,0.002153348503797179,2.0728467991859314e-5,-3.185767901736995e-8,0.002153487865791758,2.06633838486928e-5,-3.178596101433709e-8,0.002153683336498533,2.0486260716953912e-5,-3.159278162166714e-8,0.0021539866168050876,2.022543685029994e-5,-3.130833435668043e-8,0.0021544317139913717,1.9941401323367558e-5,-3.099772567279643e-8,0.0021550161923323133,1.9714632358069782e-5,-3.074786370682314e-8,0.002155692720036186,1.961840203113644e-5,-3.0638105864892124e-8,0.0021563809762338523,1.9688010875520684e-5,-3.070702518398803e-8,0.0021569972223773057,1.990511081944595e-5,-3.0935392402114285e-8,0.002157485124027573,2.0207307545267066e-5,-3.125638734645144e-8,0.002157830955696959,2.0515501898373752e-5,-3.1584963952577884e-8,0.0021580591073866546,2.0761657983135865e-5,-3.1847730058857165e-8,0.0021582161445200332,2.0904745124936695e-5,-3.200013957830926e-8,0.0021583539825240404,2.0933500471754782e-5,-3.20295538061186e-8,0.0021585179343003775,2.0861021855106574e-5,-3.194956386357729e-8,0.0021587404344839763,2.071653038410741e-5,-3.179127525102121e-8,0.0021590389475030915,2.0537441620192218e-5,-3.159486520542445e-8,0.0021594163239126024,2.0362778417702688e-5,-3.140248197378161e-8,0.002159862527034524,2.02278948399552e-5,-3.12524698579826e-8,0.002160357285130327,2.0160345669093216e-5,-3.117480508185589e-8,0.002160873478204498,2.017687657565958e-5,-3.1187780101922056e-8,0.002161381090914999,2.028164028054539e-5,-3.1296077539601465e-8,0.0021618514304895253,2.0465857833124282e-5,-3.1490443368311834e-8,0.0021622611359319007,2.0709012451658273e-5,-3.174899334089471e-8,0.002162595566211041,2.0981352258249935e-5,-3.203986438715612e-8,0.0021628513653473066,2.1247405686018214e-5,-3.232489338007879e-8,0.0021630380775924086,2.1470340095996585e-5,-3.256419591015205e-8,0.0021631786722644116,2.1617083222566323e-5,-3.272164177108625e-8,0.00216330868415945,2.1664275769114177e-5,-3.277135694153426e-8,0.0021634731281762807,2.1605065487863532e-5,-3.2705257492733154e-8,0.0021637197852005,2.1455812436603205e-5,-3.254053477237097e-8,0.0021640877997709013,2.1259948537739125e-5,-3.232400898296171e-8,0.002164592603377122,2.108438739205041e-5,-3.212829934769005e-8,0.0021652124263154904,2.1004045458292953e-5,-3.2034996857797784e-8,0.002165885927123784,2.107545579977581e-5,-3.21059404679378e-8,0.002166528501769656,2.1310646054636276e-5,-3.235474767326647e-8,0.0021670632549307834,2.1668132745757332e-5,-3.273691349900394e-8,0.0021674499574846086,2.2069275229952522e-5,-3.3167461209084994e-8,0.002167695398646148,2.2430414143251984e-5,-3.355576152777364e-8,0.0021678424617177497,2.2691454458900874e-5,-3.383651203996052e-8,0.002167948850623929,2.2828166985303557e-5,-3.398307877885336e-8,0.0021680682294110717,2.2848871903014454e-5,-3.400396925492826e-8,0.002168239621410091,2.2783477264658934e-5,-3.393109259567893e-8,0.0021684843405062296,2.2671975588932204e-5,-3.380744770218485e-8,0.0021688073255370847,2.2555681481195456e-5,-3.367771500329707e-8,0.0021692001470083005,2.247154601714925e-5,-3.358207900819488e-8,0.0021696442585630864,2.2448607182279223e-5,-3.355228837104354e-8,0.0021701141864079454,2.250565226458912e-5,-3.360901884393857e-8,0.0021705808201399487,2.2649663627314837e-5,-3.376013066261044e-8,0.002171014994842116,2.2875029470842755e-5,-3.399981066861581e-8,0.0021713914000250586,2.3163823595123173e-5,-3.430889349840126e-8,0.002171692521788873,2.348758011808522e-5,-3.4656770876542255e-8,0.0021719120261017694,2.381072758144914e-5,-3.500503838425244e-8,0.002172056961163761,2.4095477309522668e-5,-3.531268029929626e-8,0.002172148267756013,2.430773141450824e-5,-3.5542386815216575e-8,0.0021722192183669113,2.4423369339532766e-5,-3.5667380799741086e-8,0.0021723115797911727,2.443412716691192e-5,-3.567793407850738e-8,0.002172469370856416,2.435222243916228e-5,-3.558662383347489e-8,0.002172730141133899,2.4212483806263987e-5,-3.5430893243344456e-8,0.0021731143123856107,2.406994280862633e-5,-3.527059410845282e-8,0.0021736147553494305,2.399049051461565e-5,-3.517783640369402e-8,0.0021741911382967354,2.4033616638707532e-5,-3.5218066388396594e-8,0.0021747750128882433,2.4230582571380168e-5,-3.542607458320517e-8,0.0021752887669595176,2.4567528571206925e-5,-3.5787372573666643e-8,0.002175673052155437,2.49852415759974e-5,-3.623781078312394e-8,0.002175908854725856,2.5399662837313294e-5,-3.668591393596756e-8,0.0021760215228088064,2.5733306593570758e-5,-3.704716213606398e-8,0.002176065901163682,2.5940343519971294e-5,-3.727134201842648e-8,0.0021761034783204496,2.6014370722419524e-5,-3.735101978943853e-8,0.0021761840080405325,2.598057227504093e-5,-3.731306905929495e-8,0.0021763370696546024,2.5881272618678495e-5,-3.7203079961238056e-8,0.002176571964578955,2.5762734966788867e-5,-3.7071131130532555e-8,0.002176881812643163,2.5666444320064544e-5,-3.6962369095902545e-8,0.002177248530362033,2.562462645803108e-5,-3.6912097310867254e-8,0.0021776471185262275,2.56583990067598e-5,-3.694366624460091e-8,0.0021780490847102727,2.577707907708006e-5,-3.706762059466764e-8,0.002178425470464016,2.5977906113517757e-5,-3.7281338682605485e-8,0.002178749995054507,2.6246122306122735e-5,-3.7569099018844795e-8,0.00217900258816672,2.6555835903572176e-5,-3.7903003824289374e-8,0.0021791731432856958,2.687235363923373e-5,-3.8245472427078433e-8,0.002179264774642755,2.715651610226576e-5,-3.8553882093067663e-8,0.0021792954993946666,2.737100012726711e-5,-3.878734993897014e-8,0.0021792972905228126,2.7487801409019163e-5,-3.891485525836279e-8,0.0021793118845096627,2.7495392292255558e-5,-3.8923106738733907e-8,0.0021793835257311045,2.740366279969572e-5,-3.8822101383632065e-8,0.0021795497062576503,2.7244969924330507e-5,-3.864650695887784e-8,0.0021798315902990814,2.70702521421955e-5,-3.845164962605757e-8,0.0021802262299320907,2.693987847972113e-5,-3.8303651911103566e-8,0.0021807030536763806,2.6909868400577606e-5,-3.826434729027413e-8,0.002181207209043901,2.7015773686396604e-5,-3.837346895969279e-8,0.002181671386070132,2.7258810728352984e-5,-3.8633200520179275e-8,0.0021820347882051537,2.7600628586197033e-5,-3.9002200115334744e-8,0.002182263235355336,2.7971926183414146e-5,-3.940491263576584e-8,0.0021823611556105044,2.829417321789066e-5,-3.9755366604696456e-8,0.0021823687183090976,2.8505597620353956e-5,-3.9985695960752894e-8,0.002182345504518596,2.8579166128070304e-5,-4.006587420492795e-8,0.00218234968005574,2.852535965389795e-5,-4.000679786407413e-8,0.0021824224556048176,2.838187447749541e-5,-3.984911376569704e-8,0.0021825822079256305,2.8198197432587352e-5,-3.964648840870845e-8,0.002182826606343748,2.802230424969246e-5,-3.9451180587015695e-8,0.0021831385394179867,2.7892584515013404e-5,-3.930524420287103e-8,0.002183492363313434,2.7834558372804433e-5,-3.9236882225582924e-8,0.00218385884397354,2.7860496490932013e-5,-3.9259933128383583e-8,0.0021842086588251997,2.7970168372585447e-5,-3.937460019364952e-8,0.0021845150758582356,2.815172900254157e-5,-3.956836422313752e-8,0.0021847565668936496,2.838260505830918e-5,-3.9816914283289737e-8,0.002184919839335821,2.8630898322059892e-5,-4.0085638458821643e-8,0.002185003215576358,2.885819450463714e-5,-4.033263381846127e-8,0.00218501956630861,2.9024619642616696e-5,-4.0514173513386934e-8,0.002184997331671042,2.9096343678574037e-5,-4.0592881414629923e-8,0.0021849779434766005,2.9054458176741742e-5,-4.054747138967016e-8,0.0021850086809995705,2.890265974050007e-5,-4.0381253019101765e-8,0.0021851317555203866,2.867039550492026e-5,-4.012573894978999e-8,0.002185372477190764,2.8408972654841787e-5,-3.983659301605007e-8,0.002185730455124099,2.8180528313815657e-5,-3.958174677758403e-8,0.0021861771693066417,2.804251014407566e-5,-3.942450075684918e-8,0.002186661265337064,2.803206489062113e-5,-3.940634962351665e-8,0.0021871205644257144,2.8154906091556042e-5,-3.953453886956924e-8,0.0021874978725242504,2.8382145494403323e-5,-3.977826745766282e-8,0.002187756423815575,2.865671184733779e-5,-4.0075466582978284e-8,0.0021878902551987,2.8908425992492547e-5,-4.0349239996036213E-08,0.0021879255831569328,2.907366219308399e-5,-4.052949755270081e-8,0.002187912085216684,2.9112986253584563e-5,-4.057244739063578e-8,0.0021879072199879612,2.9020292931549317e-5,-4.0470759660277784E-08,0.0021879598630596396,2.8820635503511565e-5,-4.025130399634947e-8,0.0021880992812219192,2.855917509608077e-5,-3.996313733776403e-8,0.002188332056726784,2.8287020621832985e-5,-3.9662060963515264e-8,0.0021886456060208528,2.804939262502735e-5,-3.9397673106991304e-8,0.0021890148819920466,2.7878715380127772e-5,-3.9205757381181164e-8,0.002189409156221178,2.7792378102702624e-5,-3.9105747978824426e-8,0.0021897972687176166,2.7793455583849522e-5,-3.9101439536603146e-8,0.0021901511374968234,2.7872602070577086e-5,-3.9183008468822456e-8,0.0021904481235000325,2.80099950384596e-5,-3.932910624744156e-8,0.002190673074057688,2.8177065500827853e-5,-3.950871255388833e-8,0.0021908206554662854,2.8338483116444323e-5,-3.9683248872783535e-8,0.002190898034144987,2.8455330491275332e-5,-3.980999342254779e-8,0.002190927155960091,2.8490498477234655e-5,-3.9847964078533655e-8,0.0021909449561215767,2.841676049523602e-5,-3.9766800450551744e-8,0.002190999293289918,2.8226395593368268e-5,-3.955740530076425e-8,0.0021911391604951622,2.7938931175521973e-5,-3.924055987672371e-8,0.0021914004248092763,2.7602074739011113e-5,-3.886808440988153e-8,0.00219179202133541,2.7282286475806473e-5,-3.851264350198292e-8,0.002192289357213238,2.704625873866707e-5,-3.82475557684289e-8,0.0021928392696263337,2.6940105864173445e-5,-3.812399760810237e-8,0.0021933752027235077,2.697500409955819e-5,-3.815512007691709e-8,0.002193836370061701,2.712470614302269e-5,-3.8313049345572726e-8,0.0021941837606845793,2.7334592335765326e-5,-3.8538514178115646e-8,0.0021944084668189573,2.753776194502866e-5,-3.875830475133487e-8,0.002194531286417225,2.7672583796492192e-5,-3.890450991618433e-8,0.002194595052600508,2.769704623340426e-5,-3.893040017878978e-8,0.0021946525033668582,2.759686253141467e-5,-3.881953924029014e-8,0.002194753120305771,2.7386090076476726e-5,-3.858667842959779e-8,0.0021949323250686314,2.7100914061041817e-5,-3.82710888669168e-8,0.0021952055424206626,2.678902702000713e-5,-3.792497063521771e-8,0.0021955679291575467,2.6498107213706706e-5,-3.760078207771899e-8,0.0021959986568907772,2.626660204683497e-5,-3.73410335002723e-8,0.0021964674766541165,2.6118501228737073e-5,-3.7172439057852775e-8,0.0021969413113013753,2.60620374695922e-5,-3.7104408935529385e-8,0.0021973894608135576,2.6091132908844254e-5,-3.7130604436828466e-8,0.00219778705276762,2.6188108161646412e-5,-3.7231911539965425e-8,0.0021981171577645352,2.6326541689641457e-5,-3.7379570709525906e-8,0.0021983722862443157,2.647389410124768e-5,-3.753800898406534e-8,0.0021985558494707763,2.6594192238440678e-5,-3.766770585522208e-8,0.0021986837479933113,2.6651537795907375e-5,-3.772898009889921e-8,0.0021987855132714115,2.6615420265459276e-5,-3.76878288712398e-8,0.0021989034252902504,2.646839864760911e-5,-3.752446513210713e-8,0.002199087291365176,2.621516384114665e-5,-3.7243437839789706e-8,0.002199383129417582,2.588937576288623e-5,-3.688130790905145e-8,0.0021998169911259277,2.555241378810931e-5,-3.650538638656394e-8,0.0022003802001003703,2.5279351320183844e-5,-3.619836871761591e-8,0.0022010254563611044,2.513422877506996e-5,-3.603114654032077e-8,0.002201679461595271,2.5145548720641303e-5,-3.603578324988553e-8,0.0022022676262901954,2.5295397762231912e-5,-3.619337702747384e-8,0.0022027384098715387,2.552770043771887e-5,-3.6442911016991864e-8,0.0022030761947726936,2.5769490088737933e-5,-3.6704451465803936e-8,0.0022032999837505608,2.5953710056367697e-5,-3.690413133727294e-8,0.002203452495899009,2.6035101872089713e-5,-3.699166081129466e-8,0.00220358608653898,2.5996726968420892e-5,-3.6947657521712005e-8,0.0022037500668679825,2.584868135819004e-5,-3.678246540474378e-8,0.0022039815599960576,2.562183741456571e-5,-3.6529498934363496e-8,0.0022043004146107474,2.5359154396673204e-5,-3.6235824598435174e-8,0.0022047079845341367,2.510642092784503e-5,-3.595198121736966e-8,0.002205189271399241,2.490392157422305e-5,-3.5722695471243174e-8,0.0022057175485827437,2.4780291065975067e-5,-3.557995202152093e-8,0.002206260229099632,2.4749273402388118E-05,-3.553929040719807e-8,0.0022067847011294868,2.4809362891213233e-5,-3.559935513770356e-8,0.002207263133432532,2.494571788740346e-5,-3.574402276444476e-8,0.0022076757646234684,2.5133391696059046e-5,-3.594599847110066e-8,0.0022080127950028375,2.534094893318031e-5,-3.61707958606488e-8,0.0022082753512539274,2.5533983406702185e-5,-3.6380543421501094e-8,0.0022084759594946783,2.5678586499651885e-5,-3.653770547250637e-8,0.0022086387115195184,2.5745202620986414e-5,-3.6609273231779453e-8,0.002208798772150077,2.5713550443386234e-5,-3.6572240060008746e-8,0.002208999993716592,2.557900040024047e-5,-3.6420802882875486e-8,0.0022092887458073814,2.5359488384672675e-5,-3.6174216899908184e-8,0.0022097025167608603,2.5099812062111692e-5,-3.588172643050776e-8,0.0022102543881308777,2.4867936743048755e-5,-3.56185625830845e-8,0.0022109195242995543,2.4738476511340537e-5,-3.5467648422950415e-8,0.002211634051687777,2.4765337819048855e-5,-3.5489237515539794e-8,0.002212313150289902,2.495636083716276e-5,-3.5692713187243686e-8,0.0022128823429647753,2.526671790565515e-5,-3.602912278257172e-8,0.0022133046472050132,2.5616981016093155e-5,-3.641102991172894e-8,0.0022135888531115686,2.5924578071327065e-5,-3.6747220225829005e-8,0.0022137783155401383,2.6130440340332528e-5,-3.69721280559337e-8,0.0022139309577410685,2.6210438172246873e-5,-3.705850643683236e-8,0.0022141014474845195,2.6172901848814536e-5,-3.7014821330468624e-8,0.0022143303324376486,2.604895373490618e-5,-3.687478915277662e-8,0.002214639802017609,2.5881451700368056e-5,-3.668537821684993e-8,0.0022150338963010646,2.5715502764954452e-5,-3.649643735626844e-8,0.0022155011447347337,2.5591302194405776e-5,-3.6352737563078843e-8,0.0022160184567097205,2.553907975187675e-5,-3.628822151576024e-8,0.0022165557263009628,2.5575938852458807e-5,-3.63223191891732e-8,0.0022170807551756427,2.5704576800506107e-5,-3.6458407892383054e-8,0.002217564030701961,2.591385422119361e-5,-3.668441906146322e-8,0.0022179828448299827,2.6181049859668053e-5,-3.697537858622144e-8,0.0022183242804138395,2.6475407977684876e-5,-3.729737331333177e-8,0.002218586851652362,2.6762362021212276e-5,-3.7612202106384365e-8,0.002218780907528584,2.7007899392426868e-5,-3.7882116402540654e-8,0.00221892800983572,2.718282261799535e-5,-3.807443917791746e-8,0.0022190594291572868,2.7266897794539164e-5,-3.816614008581418e-8,0.002219213643884262,2.7253074171586324e-5,-3.814862701576736e-8,0.0022194321448706397,2.7151812912431053e-5,-3.8032782192625904e-8,0.0022197524438374,2.699457943246866e-5,-3.785310248538782e-8,0.0022201977516507457,2.6834004944931882e-5,-3.7668058896544666e-8,0.0022207647596439554,2.6736960739406968e-5,-3.755241769514929e-8,0.002221414588087056,2.6767401671111417e-5,-3.757801963905858e-8,0.0022220754445295104,2.696116773143545e-5,-3.778551747050506e-8,0.002222662982074354,2.7304481080951647e-5,-3.81602371398771e-8,0.002223112492580615,2.7732335963690483e-5,-3.8630272100101265e-8,0.0022234048892087036,2.815262001038408e-5,-3.9093316095525206e-8,0.002223570353579146,2.8482812379548647e-5,-3.9457507211628694e-8,0.0022236698422765312,2.8677471002609632e-5,-3.9671972494411865e-8,0.002223768955546225,2.8734606819302868e-5,-3.973390147896533e-8,0.002223918561912486,2.8685068606721128e-5,-3.9676852435000445e-8,0.002224146947177898,2.857614254949019e-5,-3.955275079853739e-8,0.002224460584546953,2.8457539680318737e-5,-3.9416539001133896e-8,0.0022248488878112726,2.8372409677147155e-5,-3.931628151961653e-8,0.0022252897394614136,2.8352697862785916e-5,-3.9287926512737694e-8,0.002225754439448891,2.8417200189247082e-5,-3.9352956850409215e-8,0.0022262119752000306,2.8571064147124517e-5,-3.9517646409515605e-8,0.0022266329015272588,2.8806246946617162e-5,-3.977346217838114e-8,0.002226992971723243,2.9102919767945163e-5,-4.009861614536306e-8,0.002227276408541931,2.9431986686848863e-5,-4.046090776146395e-8,0.002227478443459657,2.975881765135786e-5,-4.082189498635584e-8,0.0022276066367046955,3.00479536480172e-5,-4.114208286135804e-8,0.0022276806541805206,3.0268246647568305e-5,-4.1386550741833944e-8,0.0022277304168021564,3.0397850263698415e-5,-4.153044218187168e-8,0.0022277927064168696,3.0428497299104088e-5,-4.1563769098494404e-8,0.0022279064138012593,3.036858246513481e-5,-4.149502940286735e-8,0.002228106506621653,3.0244655302837534e-5,-4.13531517818982e-8,0.0022284166785792644,3.0100550888706932e-5,-4.1186794221321944e-8,0.0022288411897262855,2.9992625796661267e-5,-4.10591614928939e-8,0.0022293578310589434,2.997937361758266e-5,-4.1036340003927136e-8,0.002229915827113162,3.0105006870106393e-5,-4.116870189588894e-8,0.0022304437011137785,3.0380336855881893e-5,-4.146920822621145e-8,0.0022308696821551816,3.0770008843180174e-5,-4.189889481023213e-8,0.0022311489278408515,3.119747911794132e-5,-4.237238494059883e-8,0.002231282975267909,3.157105128869589e-5,-4.278709882978031e-8,0.0022313182697664352,3.181892335039289e-5,-4.3062523712161575e-8,0.0022313244787628863,3.1913280890993805e-5,-4.316712531818715e-8,0.0022313668866389517,3.187208721013959e-5,-4.312031825412391e-8,0.0022314877691962513,3.174329917730292e-5,-4.297493790279011e-8,0.0022317016189136243,3.1584440533183345e-5,-4.2794660080913634e-8,0.0022320000376087473,3.1447193001066374e-5,-4.263700565313382e-8,0.0022323599775302527,3.1369544649942365e-5,-4.2544629399779314e-8,0.0022327512669868426,3.13736485445689e-5,-4.254281430583861e-8,0.0022331420789577098,3.146660704082846e-5,-4.264014632464142e-8,0.002233502662649728,3.164221547907365e-5,-4.283028278424188e-8,0.0022338081602597494,3.188287847991798e-5,-4.309400116155361e-8,0.0022340411058888376,3.216172283638613e-5,-4.340155202858812e-8,0.002234193788318541,3.244531827001491e-5,-4.371572186288535e-8,0.002234270215537642,3.269748772071455e-5,-4.399608728756532e-8,0.0022342870174345488,3.288434625146084e-5,-4.4204595810092806e-8,0.0022342725300309807,3.298010211189754e-5,-4.431198509478476e-8,0.00223426358719864,3.297265366270278e-5,-4.430402838113176e-8,0.002234300042169446,3.28677210223566e-5,-4.4186255163092324e-8,0.0022344176501358816,3.269023712664952e-5,-4.398572890389884e-8,0.0022346404530500393,3.248215526411121e-5,-4.374887676761402e-8,0.0022349739993351363,3.229642695778004e-5,-4.3534981383312984e-8,0.002235400846601725,3.218729338221004e-5,-4.3405375317758714e-8,0.0022358801294424515,3.2197598996961654e-5,-4.3409074494626946e-8,0.0022363531613351687,3.234518444318427e-5,-4.356719715545998e-8,0.0022367562584270713,3.26124404623423e-5,-4.386088239969612e-8,0.002237039364916164,3.2944799036726895e-5,-4.4229360674700297e-8,0.002237184585255663,3.3263008754100455e-5,-4.458371191536925e-8,0.0022372152097443723,3.348808466964168e-5,-4.4835003790813605e-8,0.002237188268790842,3.356890037152168e-5,-4.492538522979582e-8,0.002237172973766367,3.3498373396684425e-5,-4.4846285550617134e-8,0.002237226446062347,3.331063740330506e-5,-4.463527151098567e-8,0.0022373785866876966,3.306356285861056e-5,-4.435657408777556e-8,0.0022376301801785795,3.281796598936418e-5,-4.407798109343235e-8,0.002237960293002327,3.262266212632057e-5,-4.385422435645071e-8,0.0022383364907900727,3.250798890852662e-5,-4.371970523753345e-8,0.002238723456645966,3.2485676809755455e-5,-4.3688197681211816e-8,0.0022390886143439774,3.255173487689696e-5,-4.3755889161178954e-8,0.002239405282078471,3.2689939993701276e-5,-4.390514695537152e-8,0.002239654500276259,3.2874917872497975e-5,-4.410791058122196e-8,0.002239826466603891,3.3074841894149056e-5,-4.43287154816248e-8,0.0022399219825763365,3.325431872964785e-5,-4.452793608909369e-8,0.00223995372724577,3.337818442270938e-5,-4.466602508507044e-8,0.002239946609945796,3.341665474095889e-5,-4.4709250539583116e-8,0.0022399361149010558,3.335152643078121e-5,-4.463662869840457e-8,0.0022399637177205746,3.318214901741799e-5,-4.4446666383878356e-8,0.0022400692719222156,3.292908438196356e-5,-4.4161604326662625e-8,0.0022402815961347503,3.263324461259011e-5,-4.382667142532589e-8,0.0022406097829435986,3.234928937051243e-5,-4.35029200728048e-8,0.0022410381982317313,3.2133989991873885e-5,-4.325433505758617e-8,0.002241527366860039,3.2032192958380706e-5,-4.31320710589e-8,0.002242021338402319,3.206407169227447e-5,-4.315991919307524e-8,0.002242460373611949,3.22173758634287e-5,-4.3325235858678146e-8,0.0022427962572554097,3.244758975145919e-5,-4.3578759913273076e-8,0.002243006285647738,3.268735329396462e-5,-4.384500203668317e-8,0.002243101254106713,3.2863977904254935e-5,-4.4041959824776854e-8,0.002243123492551911,3.292048609982193e-5,-4.410494856355586e-8,0.0022431341784470964,3.283271918257909e-5,-4.400603585822717e-8,0.002243194132145136,3.261533508896748e-5,-4.376093452019552e-8,0.0022433459529788004,3.2314277942817154e-5,-4.342065606321087e-8,0.0022436045440565053,3.198999227156275e-5,-4.305276261895022e-8,0.002243958133515982,3.169947891807182e-5,-4.2721289735892826e-8,0.002244376640907042,3.148388477407264e-5,-4.2472798095789184e-8,0.0022448221512804886,3.136378685678507e-5,-4.233096289601714e-8,0.0022452575632132565,3.134045113321896e-5,-4.2297823602288997e-8,0.002245652005153063,3.139999666608745e-5,-4.2358322241039085e-8,0.002245983472810847,3.151802159817808e-5,-4.248543069195238e-8,0.0022462398578507008,3.166353197668659e-5,-4.2644554056704593e-8,0.002246419446397792,3.180211929402931e-5,-4.2797108244559135e-8,0.0022465314514837314,3.1898991863196846e-5,-4.290391686790522e-8,0.0022465964763423293,3.192267915682146e-5,-4.292934587877446e-8,0.0022466461542808808,3.185001140863545e-5,-4.2846882077462555e-8,0.0022467207138888905,3.1672240851810194e-5,-4.264604611928958e-8,0.0022468631990779767,3.140089843834509e-5,-4.2339079016408486e-8,0.0022471100388813652,3.1070610463486265e-5,-4.196427300171984e-8,0.002247479746499827,3.073566784992554e-5,-4.158230565870342e-8,0.0022479638331529823,3.045874199951375e-5,-4.1263714808448154e-8,0.002248524763253154,3.02937857422682e-5,-4.1069733388505545e-8,0.002249103611883865,3.0268960024283786e-5,-4.1032988729356464e-8,0.0022496357222364597,3.0376558929030593e-5,-4.114590430823665e-8,0.002250068824548509,3.0574158665270486e-5,-4.1361647414439126e-8,0.0022503772247836114,3.07964029825346e-5,-4.160710741763205e-8,0.002250567802057482,3.097301904580212e-5,-4.1803061544443096e-8,0.002250676749711126,3.1047324392743566e-5,-4.188509138902905e-8,0.0022507586723131802,3.099010340839463e-5,-4.1819420951854353e-8,0.002250871480347393,3.080538471041008e-5,-4.1609680129912226e-8,0.0022510615188335178,3.052699532297764e-5,-4.1293253390966694e-8,0.002251353179262093,3.0207520227351978e-5,-4.092900157619033e-8,0.0022517456031207373,2.990365199999711e-5,-4.058081653528731e-8,0.002252216441744965,2.966277801546249e-5,-4.0302454700107246e-8,0.0022527301904458124,2.9514465763670236e-5,-4.012779775956819e-8,0.0022532475943158755,2.9467955847632948e-5,-4.0067851081194045e-8,0.0022537333307623537,2.9514413442723212e-5,-4.0113146302274113E-08,0.0022541607881451917,2.9631644844628163e-5,-4.023900335211374e-8,0.002254514189838657,2.9789237110179563e-5,-4.041133614434692e-8,0.0022547890266936274,2.9952985275678716e-5,-4.059167064094272e-8,0.0022549917913854377,3.0088440765969818e-5,-4.074114160771088e-8,0.0022551396035145384,3.016407696389352e-5,-4.08240201186456e-8,0.0022552597216511264,3.015481429148342e-5,-4.081164539487939e-8,0.0022553882919875423,3.0046508802163843e-5,-4.0687495180085486e-8,0.002255567099077569,2.9841357504034444e-5,-4.045337540522603e-8,0.0022558369388607233,2.9562838755949134e-5,-4.0135156504026914e-8,0.0022562271875581842,2.9257130726269753e-5,-3.978455631529007e-8,0.0022567436326642507,2.898714903281843e-5,-3.947255364662877e-8,0.0022573598823487835,2.8817209579511943e-5,-3.927213390100102e-8,0.002258018966071855,2.8791605493017066e-5,-3.923404737454537e-8,0.002258648117312685,2.891633036493332e-5,-3.936599702943412e-8,0.0022591820275492096,2.9154153382066135e-5,-3.962682189325287e-8,0.0022595839247476135,2.9436595028559185e-5,-3.993977198480979e-8,0.00225985505008105,2.9686790215993037e-5,-4.021816649643196e-8,0.002260030241699472,2.9842461088519565e-5,-4.039130403089442e-8,0.002260164133587199,2.9870701143892955e-5,-4.042125712911031e-8,0.0022603147060398874,2.9772008334002676e-5,-4.0307640364203134e-8,0.002260529356679789,2.957539212424842e-5,-4.008236218492744e-8,0.0022608360709949985,2.9328088618681445e-5,-3.9798262676794195e-8,0.002261240279369694,2.9083351681059975e-5,-3.951545849385412e-8,0.0022617268003365322,2.888909043567816e-5,-3.9288472509905356e-8,0.0022622655482008036,2.8779388123142624e-5,-3.915647214350556e-8,0.002262819189102602,2.8770098261314698e-5,-3.913805732001187e-8,0.002263350798057785,2.88586129564398e-5,-3.92308125522209e-8,0.0022638299762149723,2.9026875547142857e-5,-3.9414639258724473e-8,0.00226423666135669,2.9246199189130553e-5,-3.9657234352431613e-8,0.0022645626786873415,2.9482478245198007e-5,-3.992005306099529e-8,0.0022648116674165116,2.9700822468235492e-5,-4.016358408751382e-8,0.0022649981596772123,2.9869345096513426e-5,-4.0351602493104255e-8,0.00226514630501003,2.9962411033835785e-5,-4.04547762743576e-8,0.002265288298830657,2.9963862391270176e-5,-4.045428268554886e-8,0.0022654620702153745,2.9870664852001304e-5,-4.034600056798178e-8,0.002265707212446325,2.969691295175194e-5,-4.0145217890832345e-8,0.002266057956294179,2.947691133511338e-5,-3.9890345763315734e-8,0.0022665329039003286,2.926444328548644e-5,-3.964227072360827e-8,0.0022671236887107245,2.9124484378898093e-5,-3.9475022511818456E-08,0.002267788240646869,2.9115420126813518e-5,-3.945552451759843e-8,0.0022684561262601086,2.9265821438624493e-5,-3.9617054061131354e-8,0.0022690490903026677,2.955733641213853e-5,-3.993960157280089e-8,0.002269509515122626,2.992626254599793e-5,-4.035147042985752e-8,0.00226982162214845,3.0286068029203308e-5,-4.0754733553186254e-8,0.0022700138757717004,3.055897303667495e-5,-4.1061025649979134e-8,0.0022701436737226793,3.069989577380529e-5,-4.1218699906638504e-8,0.00227027517647685,3.070387520696665e-5,-4.122131101616223e-8,0.002270461042897145,3.059919619723711e-5,-4.1100011651257346e-8,0.002270732689133939,3.0433729733369717e-5,-4.090835113136894e-8,0.002271098337780852,3.026097227227714e-5,-4.070670005595391e-8,0.002271546105525531,3.012906258930677e-5,-4.0549886052690306e-8,0.002272049606456396,3.007354356655947e-5,-4.0478868217575704e-8,0.0022725744638758933,3.011354728086309e-5,-4.051615436512521e-8,0.0022730847790649704,3.0250954443169037e-5,-4.066458322488583e-8,0.002273548838725809,3.047206367789406e-5,-4.0909059104787467e-8,0.0022739434936463994,3.075113090835044e-5,-4.1220551846418976e-8,0.0022742568636345524,3.105504186902545e-5,-4.156147942044127e-8,0.0022744892839467825,3.134835492335001e-5,-4.189151521878511e-8,0.0022746527416301044,3.159798737144839e-5,-4.217292294439811e-8,0.0022747692873981264,3.177714018497166e-5,-4.237495585906838e-8,0.0022748688113758886,3.186850606857967e-5,-4.247743480535395e-8,0.002274986290774487,3.186699225575003e-5,-4.2473855910760004e-8,0.0022751583117732004,3.178213127539921e-5,-4.237427673206388e-8,0.0022754182619907173,3.1640017291713195e-5,-4.2207768491395545e-8,0.0022757894556965316,3.1483670873694755e-5,-4.202308555544977e-8,0.0022762763149492913,3.1369490725813464e-5,-4.188476186116999e-8,0.002276855832823401,3.135697026894548e-5,-4.186133900931318e-8,0.0022774744421386866,3.1490633861351893e-5,-4.200454099581501e-8,0.0022780569340058936,3.177865036092299e-5,-4.232457983909165e-8,0.0022785298502353986,3.217986098398422e-5,-4.277512950721424e-8,0.002278850878859694,3.261186828087253e-5,-4.326249088421801e-8,0.002279027127460274,3.29810254809563e-5,-4.3679853601427606e-8,0.0022791101135152944,3.3218485070021266e-5,-4.3948435338700015e-8,0.0022791716138773816,3.33017751806445e-5,-4.404203618293163e-8,0.0022792763622203156,3.325354630218967e-5,-4.3985619723857855e-8,0.0022794650184009696,3.312474867222378e-5,-4.3836336864797965e-8,0.0022797502493714416,3.297479872131966e-5,-4.3661248003750406e-8,0.00228012142820996,3.285672340462785e-5,-4.35206528604119e-8,0.0022805525144040995,3.2809069538178984e-5,-4.3458910771532503e-8,0.002281009749824412,3.28530678199272e-5,-4.350102367560977e-8,0.002281457946481573,3.299290573495884e-5,-4.3652647942342574e-8,0.0022818653863613037,3.3217663060474e-5,-4.390203862093646e-8,0.0022822076095379298,3.350430854908523e-5,-4.4223341324998374e-8,0.0022824701581385626,3.38215008984268e-5,-4.458094556850484e-8,0.0022826501909389498,3.413398695711384e-5,-4.493459121134231e-8,0.0022827568168762593,3.44073498830337e-5,-4.524485208989148e-8,0.0022828100447377627,3.4612658901913384e-5,-4.547843105508966e-8,0.0022828384740465075,3.4730475087631895e-5,-4.561266796396316e-8,0.002282876011570533,3.475388096679199e-5,-4.5638964500433376e-8,0.002282957848421652,3.469040464851831e-5,-4.5565062411767125e-8,0.0022831158204580496,3.456271833872463e-5,-4.541606069616092e-8,0.0022833731202049406,3.440786048574832e-5,-4.5233819572801423e-8,0.0022837383081319583,3.427425554837967e-5,-4.507378989735375e-8,0.0022841992424606486,3.42151255976047e-5,-4.4997528462908375e-8,0.0022847190630679586,3.427694413898361e-5,-4.505929978605274e-8,0.0022852381039333777,3.448341082476899e-5,-4.528736898920922e-8,0.002285686017006873,3.4819631970934466e-5,-4.566551541864208e-8,0.0022860045965692596,3.522625967483624e-5,-4.6126130449042295e-8,0.0022861729555042707,3.5613274931110104e-5,-4.65660689031637e-8,0.002286219685653516,3.5892392446296056e-5,-4.688394305335418e-8,0.002286211691889868,3.601177133491025e-5,-4.7019944247694604e-8,0.002286225505956513,3.5972626779050686e-5,-4.697479161031815e-8,0.0022863188543598124,3.58205873724714e-5,-4.6799832485411654e-8,0.00228651668635773,3.562198060753e-5,-4.6570120297171264e-8,0.002286812966928041,3.5440632292562546e-5,-4.635820450409294e-8,0.002287180868527256,3.532389707738892e-5,-4.6218365864022434e-8,0.002287583967878681,3.5298098790532246e-5,-4.618136168410986e-8,0.0022879848284268977,3.536980504236021e-5,-4.6255633734096165e-8,0.0022883504197809537,3.552946613083765e-5,-4.643115703668337e-8,0.002288655274879669,3.575541538610793e-5,-4.668378554344655e-8,0.0022888834463104927,3.60176745468646e-5,-4.697952823998258e-8,0.002289029789277668,3.6281738912671874e-5,-4.727893103740416e-8,0.002289100595889158,3.65126058036671e-5,-4.754178038619249e-8,0.0022891133320047745,3.667916372430841e-5,-4.773217946936401e-8,0.0022890950961498148,3.675871799412574e-5,-4.782371311654076e-8,0.0022890795607725576,3.674100774676719e-5,-4.7804003549630296e-8,0.002289102527511509,3.663093644990813e-5,-4.767785241181172e-8,0.002289196541348638,3.644938070154096e-5,-4.746830614559982e-8,0.0022893851939173337,3.6231636872978196e-5,-4.7215134114218746e-8,0.002289677840039512,3.602331407239086e-5,-4.6970406519053876e-8,0.0022900654708520327,3.58736629553553e-5,-4.679101983320465e-8,0.002290518708418688,3.582634915501503e-5,-4.6728061346799346e-8,0.0022909894789891827,3.590809695929047e-5,-4.681348212371508e-8,0.002291418352774001,3.611712058525191e-5,-4.704638370723802e-8,0.002291748752111823,3.641569025232455e-5,-4.7384109668672996e-8,0.0022919460643483626,3.6733133288591057e-5,-4.774556420547209e-8,0.0022920143328060607,3.6983858880081674e-5,-4.803206329891999e-8,0.002291999814615806,3.7096977477987554e-5,-4.8161604641847836e-8,0.002291975474626928,3.704374634491269e-5,-4.8100515063701843e-8,0.0022920128248449328,3.6846970662485426e-5,-4.787422973248501e-8,0.0022921567275596033,3.656759825553701e-5,-4.7551933742153225e-8,0.0022924155206640656,3.627866505605262e-5,-4.721685937218435e-8,0.0022927669894349093,3.6041857596996885e-5,-4.6939648387720506e-8,0.002293172035520522,3.589533984270876e-5,-4.676448884083824e-8,0.002293587774220062,3.585234950794764e-5,-4.670737294106673e-8,0.00229397625599273,3.5905780732209896e-5,-4.676107434656356e-8,0.0022943087935883965,3.603438248915831e-5,-4.690198432790658e-8,0.0022945674627496593,3.6208248273547327e-5,-4.709625363021303e-8,0.0022947453752612396,3.639309951270794e-5,-4.730469355160464e-8,0.002294846618012875,3.655385217382977e-5,-4.748694572871607e-8,0.0022948859966711527,3.6658142221179055e-5,-4.760561192507473e-8,0.0022948882229804706,3.66802485027254e-5,-4.7630789899419904e-8,0.002294885915277481,3.660536515102313e-5,-4.754496057001509e-8,0.0022949158390162044,3.64335141641052e-5,-4.7347464493291285e-8,0.002295013303258485,3.6181877526743895e-5,-4.705723761896796e-8,0.0022952053707549756,3.5884255428738196e-5,-4.6712359540665154e-8,0.0022955042500871392,3.558678939109289e-5,-4.6365392836542746e-8,0.002295902637857623,3.534001900618766e-5,-4.607449202272132e-8,0.002296372603345501,3.518847407688666e-5,-4.5891531629784525e-8,0.002296868936882388,3.515979486113663e-5,-4.584945571699113e-8,0.002297337100875107,3.525571375908133e-5,-4.595154991513938e-8,0.0022977251112613487,3.54474663309797e-5,-4.6165727461002804e-8,0.002297997511006086,3.567828648084553e-5,-4.642708208073091e-8,0.0022981479038201797,3.587486868504097e-5,-4.665101902295781e-8,0.0022982048890346418,3.59670990491837e-5,-4.6756152857442506e-8,0.0022982264993906746,3.591076706084595e-5,-4.66907281238414e-8,0.00229828244392896,3.570370688981107e-5,-4.645139989864305e-8,0.0022984305793150974,3.538654013029307e-5,-4.6084187811529834e-8,0.002298698613153666,3.502687277549902e-5,-4.5666380520174655e-8,0.0022990791902976694,3.4695334694455384e-5,-4.5279093849930466e-8,0.0022995381727997865,3.4445276278051516e-5,-4.49839970221804e-8,0.002300029218953335,3.430321854904224e-5,-4.4812265883725474e-8,0.0023005071520190556,3.426970567379333e-5,-4.4765358220823394e-8,0.0023009363058259054,3.432593949783263e-5,-4.4822399265362546e-8,0.0023012938617268945,3.444159290053393e-5,-4.494899788620879e-8,0.002301570006953491,3.458126436569647e-5,-4.51046246777301e-8,0.002301766800108603,3.470904311234521e-5,-4.524791553057968e-8,0.002301896888738061,3.479179416047871e-5,-4.534053254240823e-8,0.002301982375857608,3.480208071788327e-5,-4.535057802732492e-8,0.0023020534602801847,3.472142304601621e-5,-4.525634915545079e-8,0.0023021460538406057,3.454404162586172e-5,-4.505063369302154e-8,0.002302297520970304,3.4280415377693827e-5,-4.474483116108385e-8,0.00230254017354546,3.395911142067943e-5,-4.4371164167657605e-8,0.0023028932564570586,3.3624877587848964e-5,-4.398066536436923e-8,0.0023033555964254958,3.333152309155398e-5,-4.3635188638132984e-8,0.0023039020503271127,3.312995217770553e-5,-4.339376844190064e-8,0.002304486385520222,3.305425894193706e-5,-4.329658172175806e-8,0.002305051035348368,3.3110519998397165e-5,-4.335181227808648e-8,0.0023055413708626526,3.3272560571329226e-5,-4.353040435431237e-8,0.0023059202737308734,3.348666573581906e-5,-4.3771124818958763e-8,0.0023061786570983014,3.368428524135492e-5,-4.3994995923487775e-8,0.0023063388048928817,3.379947725797813e-5,-4.412542796611055e-8,0.0023064492323863275,3.378653186463361e-5,-4.410875759920423e-8,0.0023065718780325255,3.363277880294064e-5,-4.392931753536871e-8,0.0023067648430645355,3.336223440573916e-5,-4.361391666217241e-8,0.0023070660644278905,3.302816568314063e-5,-4.322345795297547e-8,0.002307483727852774,3.269679339994018e-5,-4.2834243518091083e-8,0.0023079967124393116,3.242829025455311e-5,-4.2516054578377455e-8,0.002308563857239961,3.2262195589673835e-5,-4.2315205384790976e-8,0.0023091372052619127,3.221149782256434e-5,-4.224750159055635e-8,0.002309673844341424,3.2265073740245427e-5,-4.2300823774791806e-8,0.0023101432068525158,3.239501720334835e-5,-4.244342832539441e-8,0.0023105295861446016,3.256496006872504e-5,-4.2633513685632894e-8,0.0023108314009869526,3.2736917316135974e-5,-4.282717939490637e-8,0.002311059046577513,3.287596311964373e-5,-4.298390962236588e-8,0.0023112325956021447,3.2953249680788354e-5,-4.30701110947523e-8,0.00231137979665109,3.294831861010061e-5,-4.306178209267358e-8,0.0023115340997543143,3.285151044406728e-5,-4.2947275355292e-8,0.0023117319317365243,3.2666777386046935e-5,-4.2730561942988145e-8,0.0023120082445560355,3.241439708027806e-5,-4.243445694518821e-8,0.0023123897136956896,3.213200948149292e-5,-4.210197938273945e-8,0.002312886188388601,3.1871514418046985e-5,-4.179294978549619e-8,0.0023134830361791667,3.168968477884489e-5,-4.157326718028376e-8,0.0023141388246951094,3.163282940214068e-5,-4.149718047268907e-8,0.002314792329840861,3.172005820484998e-5,-4.158778555622238e-8,0.002315378896673669,3.193290371843414e-5,-4.182474929661659e-8,0.0023158505127047306,3.2217740072628357e-5,-4.214680612835947e-8,0.0023161909435828218,3.2501262856054346e-5,-4.2469442360932653e-8,0.002316419671183998,3.271254277366566e-5,-4.27103290681903e-8,0.0023165841921237427,3.2802780436011716e-5,-4.2812247472897776e-8,0.0023167450214273137,3.2756541656388914e-5,-4.275628838705075e-8,0.0023169591271539453,3.259272819167442e-5,-4.256326379538918e-8,0.0023172663812004936,3.2356898186037265e-5,-4.228512778642178e-8,0.0023176817453812227,3.2108186977599e-5,-4.199006993769168e-8,0.002318194185054491,3.1904582986137214e-5,-4.174553762547756e-8,0.00231877176791076,3.1790160014621046e-5,-4.1603324561922454e-8,0.002319371007020906,3.1787119353049104e-5,-4.159008391244041e-8,0.0023199475183516252,3.189400454355314e-5,-4.17049622110272e-8,0.0023204650305293554,3.20894591354611e-5,-4.1923747329153166e-8,0.002320900868517307,3.2339315150879754e-5,-4.220702939293869e-8,0.0023212476092142357,3.260440417190498e-5,-4.2509329097549e-8,0.0023215118356965506,3.284715719192341e-5,-4.278686762213579e-8,0.0023217113982006393,3.3036182323788574e-5,-4.300295310375987e-8,0.002321872364162279,3.314903836216729e-5,-4.313120169100703e-8,0.0023220262092654128,3.3173971066507745e-5,-4.315751282036905e-8,0.002322207158400309,3.311135649858902e-5,-4.3081732272613976e-8,0.0023224491028571363,3.297521373884765e-5,-4.291948491394481e-8,0.002322781228382118,3.279447518776715e-5,-4.270382165655561e-8,0.0023232216822924234,3.261266466520483e-5,-4.248505510679363e-8,0.002323769722566849,3.2483621858754785e-5,-4.2325943183644296e-8,0.002324398904211897,3.2460944922610885e-5,-4.228942774440365e-8,0.002325056179267136,3.258120401470381e-5,-4.241896142727533e-8,0.002325671964702718,3.2846122159074696e-5,-4.271751943685757e-8,0.00232618144268266,3.321386581244003e-5,-4.3137207029593565e-8,0.0023265488268709705,3.36082031220369e-5,-4.3589753742231386e-8,0.0023267814240886583,3.394420957442691e-5,-4.397636855767629e-8,0.0023269254239565483,3.415782391829717e-5,-4.422212158225807e-8,0.002327046906947544,3.422452814123435e-5,-4.429770088385412e-8,0.002327209206277997,3.4160981089080925e-5,-4.422143906155781e-8,0.002327456336525311,3.401357864203633e-5,-4.4046282714445835E-08,0.002327805923589105,3.384194337626255e-5,-4.384093488623098e-8,0.002328250166554385,3.37036441574621e-5,-4.3672328614357636e-8,0.002328761740259225,3.364315089403521e-5,-4.3592791245387643e-8,0.002329301915681379,3.36856352720997e-5,-4.3632602011700155e-8,0.002329829055291661,3.383516729126079e-5,-4.379753708045467e-8,0.0023303062390849644,3.407663050535043e-5,-4.407078165874924e-8,0.0023307070359199853,3.438049828740393e-5,-4.441833484198168e-8,0.0023310187619350036,3.470925636680583e-5,-4.4796515547741785e-8,0.0023312431048083324,3.502410718649536e-5,-4.515990686671555e-8,0.002331394528886721,3.5290797443504604e-5,-4.5468276438613356e-8,0.002331497260081565,3.5483844383961805e-5,-4.569154976787356e-8,0.002331581733856791,3.558904226640621e-5,-4.581270005257149e-8,0.0023316810811048884,3.560465423137779e-5,-4.582909582100883e-8,0.002331827771099224,3.5541816076164474e-5,-4.575300867708182e-8,0.0023320501595354027,3.542447396167401e-5,-4.561169901534009e-8,0.0023323683909373285,3.528871876135906e-5,-4.5446880835164095e-8,0.0023327891822946096,3.51805346933835e-5,-4.531231018055253e-8,0.002333299958278486,3.515015003696038e-5,-4.52672578511267e-8,0.0023338645432176663,3.5241270465413334e-5,-4.5363790266725256e-8,0.002334424562220092,3.5475412457926315e-5,-4.562814505895616e-8,0.0023349112408662287,3.583613212030472e-5,-4.6041947983230845e-8,0.002335268146958933,3.626338247097496e-5,-4.6535418255023436e-8,0.0023354760591965088,3.666773954728629e-5,-4.700402689339779e-8,0.0023355644528050535,3.696270836812873e-5,-4.7346394509497067e-8,0.002335600051392683,3.7098371862978543e-5,-4.75036656435806e-8,0.002335658860810056,3.707695140177438e-5,-4.747763880896117e-8,0.0023357987401432536,3.694435600604198e-5,-4.732093922172631e-8,0.002336045463982361,3.6767616798790464e-5,-4.711093689128459e-8,0.002336393449628172,3.661235323283033e-5,-4.6923808409687194e-8,0.00233681482692482,3.6528212315890726e-5,-4.68177625437056e-8,0.002337270388702322,3.6542959451067806e-5,-4.682607312286444e-8,0.0023377189367930666,3.66625719363429e-5,-4.6956871248297825e-8,0.002338124071548144,3.687450363014641e-5,-4.7196561629315964e-8,0.002338458716826444,3.71523445299233e-5,-4.75149713046986e-8,0.0023387078440758034,3.7461115310449495e-5,-4.787144263559505e-8,0.002338869585723431,3.7762817841687184e-5,-4.822140859107426e-8,0.0023389547817296704,3.802184043837775e-5,-4.852287616148231e-8,0.0023389850485431105,3.820974950563554e-5,-4.87421532200505e-8,0.002338989627065774,3.830895059743735e-5,-4.885815585004515e-8,0.0023390014899789605,3.8314840733578865e-5,-4.8864887051675046e-8,0.002339053227796983,3.823643256374001e-5,-4.8772155817743224e-8,0.0023391730470084114,3.809565596331883e-5,-4.860485990028719e-8,0.002339381007965399,3.7925524692509784e-5,-4.840106376674009e-8,0.0023396854228536312,3.776719520424567e-5,-4.82088209371393e-8,0.0023400793116841023,3.76654727255943e-5,-4.808107898018889e-8,0.002340537481346002,3.766178500501879e-5,-4.8067398459253976e-8,0.0023410160318337752,3.778395059438169e-5,-4.820166978989883e-8,0.0023414571514578423,3.8033753723512084e-5,-4.8487112668261064e-8,0.002341802014567862,3.837655741982126e-5,-4.888372230559299e-8,0.0023420114228051465,3.874102641968516e-5,-4.930783648964436e-8,0.0023420863661792065,3.9036695298684036e-5,-4.965293287954776e-8,0.0023420745217566197,3.918717458210972e-5,-4.982885057806455e-8,0.0023420538209714603,3.91622722916344e-5,-4.9799546790811774e-8,0.0023421004046062298,3.8988852688015025e-5,-4.959573407663678e-8,0.0023422602630217295,3.8734768578304047e-5,-4.9296049457022376e-8,0.0023425391360975905,3.847893082192605e-5,-4.899224673303789e-8,0.0023429102765989336,3.828568044273994e-5,-4.8759531463412606e-8,0.0023433299940436355,3.819251167163617e-5,-4.8642341136861975e-8,0.0023437518655280796,3.8209551159922836e-5,-4.865357708177263e-8,0.0023441359775748295,3.8325147109487965e-5,-4.87807783260245e-8,0.002344453495623456,3.8512988018584136e-5,-4.8994075741131246e-8,0.002344688236531956,3.873852777500904e-5,-4.9253489797137967e-8,0.0023448367420634006,3.896429832747165e-5,-4.951513690495988e-8,0.002344907563344286,3.915445172418351e-5,-4.973668851539436e-8,0.002344919846223446,3.927885131661452e-5,-4.9882338277690744e-8,0.0023449010717055798,3.9316757036171124e-5,-4.992722780668246e-8,0.0023448838074805536,3.925979958184939e-5,-4.986094461349622e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_18.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_18.json deleted file mode 100644 index a7e13128..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_18.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":18000,"numberOfSamples":1000,"samples":[0.002344901558802442,3.911368303105064e-5,-4.968948981883951e-8,0.002344984132234963,3.8898163040661456e-5,-4.9435280092255396e-8,0.002345153076453194,3.8645137911801235e-5,-4.913505665071581e-8,0.0023454177649364274,3.8394882701718704e-5,-4.883571430956027e-8,0.0023457726182683734,3.8190636084535106e-5,-4.858818570335279e-8,0.0023461958479369647,3.8071833815956895e-5,-4.8439580759263196E-08,0.0023466502566154754,3.806617270836784e-5,-4.8423700396250246e-8,0.0023470871667342188,3.818099295284342e-5,-4.855052067391149e-8,0.0023474547964515697,3.8395736841710905e-5,-4.8796864492445077e-8,0.002347711548848421,3.865908630266998e-5,-4.9102715263344044e-8,0.0023478420825502667,3.889571950044163e-5,-4.937914952780937e-8,0.00234786961391877,3.902607152063935e-5,-4.9531851099022974e-8,0.0023478548636246925,3.899526350333567e-5,-4.949545923878963e-8,0.002347876570857601,3.8797420616696476e-5,-4.926230021920203e-8,0.0023480009856264934,3.8479554435582394e-5,-4.888691218568922e-8,0.002348257394842648,3.81212678497871e-5,-4.8462214576854004e-8,0.0023486326479069406,3.7803093228172886e-5,-4.8082513592352674e-8,0.0023490835964367573,3.75814623825538e-5,-4.781433129307214e-8,0.002349556312825578,3.747939916176964e-5,-4.768549705089819e-8,0.002350001794120482,3.7490379203984336e-5,-4.768944037993623e-8,0.002350384381521822,3.758800212452211e-5,-4.779618621991062e-8,0.0023506841057128985,3.773572437125139e-5,-4.796348785816809e-8,0.0023508956980960788,3.7894232799687954e-5,-4.814536983155262e-8,0.00235102648099269,3.802641740658273e-5,-4.829803528414698e-8,0.002351094173287532,3.810084978765315e-5,-4.838411531070628e-8,0.0023511246964647748,3.8094608924835005e-5,-4.837614007717066e-8,0.0023511496348331447,3.799585924542727e-5,-4.825963731338258e-8,0.0023512029179003826,3.780605403700456e-5,-4.803571540037979e-8,0.002351316493203054,3.754110540847055e-5,-4.772242618165293e-8,0.002351515254331023,3.723065606146325e-5,-4.7353971759481864e-8,0.0023518120205759476,3.6914840723378074e-5,-4.697706960436158e-8,0.0023522036900594134,3.663842066327486e-5,-4.664428486396447e-8,0.0023526697415857454,3.6442835626573675e-5,-4.6404850464569946E-08,0.0023531739492806607,3.635743472275251e-5,-4.629433098034591e-8,0.0023536695969230293,3.639153741844735e-5,-4.632502065598751e-8,0.002354107963028887,3.65290387843179e-5,-4.64791633358682e-8,0.0023544493334192655,3.672744771866113e-5,-4.670739713326941e-8,0.0023546748244885193,3.692340046714689e-5,-4.693502893752279e-8,0.0023547957604870243,3.704596407123413e-5,-4.707779081016492e-8,0.002354855915443392,3.703656572046711e-5,-4.70656375977696e-8,0.0023549223160394474,3.68699978500431e-5,-4.6867843166706427e-8,0.002355064610704272,3.656683381659626e-5,-4.65078344897485e-8,0.002355330456332751,3.6188645949168455e-5,-4.605762360942627e-8,0.0023557290800031,3.581614088997792e-5,-4.561209830788785e-8,0.0023562313149006323,3.552104851024793e-5,-4.525598622392911e-8,0.002356784170343763,3.534573263514571e-5,-4.503985226093692e-8,0.00235733028458666,3.529761527789713e-5,-4.49733843052568e-8,0.002357823000083982,3.535587514723036e-5,-4.503300722505471e-8,0.0023582334607192713,3.548324139112816e-5,-4.517550230472812e-8,0.0023585511399880337,3.5636946080439145e-5,-4.535076312918837e-8,0.002358780962041987,3.577633956909642e-5,-4.551078335076926e-8,0.0023589395842511522,3.5867314155800855e-5,-4.561499749370089e-8,0.002359052080351249,3.588475773629073e-5,-4.563332272362631e-8,0.002359149147828655,3.58142084645814e-5,-4.554820350082022e-8,0.0023592643626533377,3.565335730415486e-5,-4.5356402142557453E-08,0.002359430841246486,3.541339537933329e-5,-4.507057121932486e-8,0.0023596768567981123,3.511952535451973e-5,-4.471987460114685e-8,0.0023600205188522927,3.480948168500788e-5,-4.4348345490610194e-8,0.0023604644698905536,3.452896471445555e-5,-4.400967986329848e-8,0.002360992350010294,3.432364769813786e-5,-4.375798612579386e-8,0.002361569042366369,3.422878850205881e-5,-4.363559641492016e-8,0.0023621460051594665,3.4259012492440044e-5,-4.3660883375380844e-8,0.0023626713616961515,3.440164922381125e-5,-4.3820080092443e-8,0.002363102567048767,3.4616447316981465e-5,-4.4066547053651594e-8,0.002363418276529288,3.484277697645849e-5,-4.432896661511161e-8,0.002363625904080295,3.501331834422755e-5,-4.452741922922826e-8,0.002363762140673494,3.50713100177352e-5,-4.459391491625094e-8,0.0023638851680286292,3.498694287747205e-5,-4.449207573009896e-8,0.0023640594734086117,3.4767688893707976e-5,-4.422967279774819e-8,0.002364337052724743,3.44579776897352e-5,-4.385849503168624e-8,0.0023647414089119547,3.412668761857231e-5,-4.345970698104098e-8,0.002365260922020612,3.3846152104623893e-5,-4.3119075143364176e-8,0.0023658544426327192,3.367093165302294e-5,-4.290180278936738e-8,0.0023664660490979486,3.362478090509265e-5,-4.2836928949552116e-8,0.002367041894211088,3.3699477499923e-5,-4.29156715149733e-8,0.0023675425813141815,3.3863070665591675e-5,-4.3100929149056666e-8,0.002367948361133545,3.407186155979982e-5,-4.334131276515742e-8,0.0023682583104001854,3.4281125480317074e-5,-4.358383945165417e-8,0.002368486347050624,3.4452289918945094e-5,-4.378254145392837e-8,0.002368656569458454,3.455667745010834e-5,-4.3903037676489125e-8,0.002368799213631667,3.457704329979657e-5,-4.39244496666408e-8,0.0023689474323752143,3.450818698611703e-5,-4.384015205758009e-8,0.0023691344170632556,3.4357416482385305e-5,-4.3658308045106786e-8,0.002369390127550806,3.4144946605107745e-5,-4.340234799568976e-8,0.002369737050180081,3.390358038895181e-5,-4.311066755298774e-8,0.0023701849761484078,3.367640314542406e-5,-4.283404275674573e-8,0.002370725808074802,3.351105695568608e-5,-4.262900855450118e-8,0.0023713306372070224,3.344998149691437e-5,-4.254638292238252e-8,0.0023719519724518553,3.351806525291478e-5,-4.261657041710548e-8,0.0023725329401571575,3.371175366291013e-5,-4.283642668257849e-8,0.0023730222295828053,3.3995002702351264e-5,-4.316414308379054e-8,0.002373389973065274,3.430578520129685e-5,-4.3526671192005085e-8,0.0023736381505010734,3.4572328983584834e-5,-4.38388242013889e-8,0.0023738010098588143,3.473355012811767e-5,-4.402752760022938e-8,0.00237393531167498,3.4756315512409036e-5,-4.40524591922618e-8,0.0023741041518875864,3.4643979531241987e-5,-4.391644020525929e-8,0.0023743597715574142,3.443428581685144e-5,-4.366325823519776e-8,0.002374730275263065,3.418808569592938e-5,-4.336456918047751e-8,0.0023752135991477064,3.397259983293269e-5,-4.3100208376556956e-8,0.002375779941817866,3.384415723124978e-5,-4.293768908589405e-8,0.0023763813960745914,3.383531261076801e-5,-4.2916694132470866e-8,0.0023769653178674142,3.394966546843266e-5,-4.304258701004152e-8,0.0023774870203995034,3.416488144273135e-5,-4.3289677344681276e-8,0.002377918235263097,3.444154087954113e-5,-4.3611544323386645e-8,0.0023782499725694506,3.473394751413563e-5,-4.3953871457543554e-8,0.002378490676997382,3.499948400810439e-5,-4.4265690042450136e-8,0.002378661785361829,3.520478219905836e-5,-4.45068771402646e-8,0.0023787927125148967,3.5328684667322306e-5,-4.465179236135274e-8,0.0023789164661922424,3.5362982250262976e-5,-4.4690190041228925e-8,0.002379066168330197,3.531210837114164e-5,-4.462683919511151e-8,0.0023792721073279486,3.519257964256899e-5,-4.448085699607398e-8,0.0023795586569317585,3.50323249823028e-5,-4.4284979324380445e-8,0.0023799404698155602,3.486935159153574e-5,-4.408411931944888e-8,0.00238041786411957,3.4748539855140206e-5,-4.39317205628605e-8,0.0023809723866902452,3.471506365948844e-5,-4.38820214882267e-8,0.0023815649852208134,3.48036933953732e-5,-4.397726798401748e-8,0.0023821401857936045,3.502563195655052e-5,-4.423182507960411e-8,0.0023826385643343764,3.535804096673262e-5,-4.461940477123716e-8,0.002383015549616911,3.574351081297848e-5,-4.507218244911266e-8,0.0023832590121007622,3.610394768843331e-5,-4.549722500288198e-8,0.0023833960729126107,3.6365403192313095e-5,-4.5806082879119395e-8,0.0023834844707587666,3.6482794911242564e-5,-4.594430660481812e-8,0.0023835926131679144,3.6453070353420245e-5,-4.5907232417809996e-8,0.0023837780068744117,3.6312527567923084e-5,-4.573698815443366e-8,0.002384072504190872,3.612228458903607e-5,-4.550549834835012e-8,0.002384477540262076,3.594951747525463e-5,-4.529245938741677e-8,0.0023849679834993427,3.5850894327466484e-5,-4.516576690664186e-8,0.0023855013057676516,3.586164050491832e-5,-4.5168379713013465e-8,0.0023860287687607305,3.599113018920311e-5,-4.5312724744731254e-8,0.002386506003294634,3.6224400739596276e-5,-4.558208417162952e-8,0.0023869010817420566,3.65281921996621e-5,-4.5937482125035984e-8,0.0023871989250919125,3.685955147899608e-5,-4.632784241705567e-8,0.002387401820865755,3.7174763898084735e-5,-4.6700739768763154e-8,0.002387526785819297,3.7436733765039484e-5,-4.701140163670798e-8,0.0023876010849905364,3.761979915266924e-5,-4.7228628272774645e-8,0.00238765727041805,3.771186667545958e-5,-4.733742080218521e-8,0.002387728725155376,3.7714449644070145e-5,-4.7339022820513065e-8,0.0023878460686218663,3.764152424039279e-5,-4.724953688088123e-8,0.002388034216505095,3.751792399775393e-5,-4.709805432518741e-8,0.0023883096269505005,3.7377464417580596e-5,-4.692455759226862e-8,0.002388677274146209,3.726041803036959e-5,-4.677709598428318e-8,0.0023891272588487315,3.720938268477899e-5,-4.6706986835451093e-8,0.0023896319399229,3.7262272101778856e-5,-4.6760418636059854e-8,0.0023901458647094826,3.7441849520893325e-5,-4.696572132812101e-8,0.002390611746871633,3.774354152197786e-5,-4.731844757029362e-8,0.0023909747687158945,3.81269601588696e-5,-4.777091840959034e-8,0.002391202906290385,3.8519192870702565e-5,-4.823603735908806e-8,0.0023913040660786186,3.883476948556154e-5,-4.8611270833999345e-8,0.002391328128732739,3.9006667440986484e-5,-4.881589018117696e-8,0.00239134943562406,3.90124026913742e-5,-4.882222941094568e-8,0.002391438487576229,3.8880411452464615e-5,-4.866331475848319e-8,0.0023916383708005662,3.867507853522781e-5,-4.841510309828039e-8,0.00239195590432241,3.847153998643774e-5,-4.816669872463936e-8,0.0023923668018147257,3.833341819751815e-5,-4.799408876442468e-8,0.002392828007801345,3.830015839190798e-5,-4.794511807386538e-8,0.0023932907590552147,3.8383856123547755e-5,-4.8035481865629606e-8,0.00239371096036409,3.857245714578611e-5,-4.82521178047072e-8,0.0023940559931876475,3.883616405890264e-5,-4.856042818085454e-8,0.0023943082930363074,3.9134985874419545e-5,-4.891304887908877e-8,0.0023944662220829185,3.9426309839536574e-5,-4.925889576057055e-8,0.0023945426540706474,3.967167832740828e-5,-4.955145041930234e-8,0.0023945617795173573,3.984206233309221e-5,-4.975530429415886e-8,0.002394554803373748,3.992121054124771e-5,-4.985033218746083e-8,0.00239455526447015,3.990695202747839e-5,-4.983330111917577e-8,0.002394594661569528,3.9810623353083994e-5,-4.971716322616409e-8,0.0023946988252229935,3.965513390937551e-5,-4.952874150407233e-8,0.0023948850777624304,3.9472259325648355e-5,-4.9305586614794425e-8,0.00239515997526318,3.9299439114975593e-5,-4.909233045733194e-8,0.0023955174021503037,3.9175945382072434e-5,-4.893628682300761e-8,0.002395937007932476,3.9137890421156826e-5,-4.8881533371822775e-8,0.002396383695909191,3.921131979781866e-5,-4.896047917113908e-8,0.0023968099593563576,3.9403258047878505e-5,-4.918277327372618e-8,0.002397163497613983,3.969252739918278e-5,-4.952387416863947e-8,0.0023974015854493413,4.002518309701328e-5,-4.99193026544001e-8,0.002397509675261247,4.0321678158350774e-5,-5.027326909845036e-8,0.0023975151824612907,4.049998955523513e-5,-5.048669925554299e-8,0.0023974844671535013,4.050819106081807e-5,-5.049657166197553e-8,0.002397499090668801,4.034853438152713e-5,-5.0304833087084466e-8,0.0023976229322382613,4.007667775600651e-5,-4.997738881179162e-8,0.002397879519985696,3.977656534145411e-5,-4.96140773901125E-08,0.0023982502957491016,3.9527801939768744e-5,-4.93098968993077e-8,0.002398689129527083,3.938302665345923e-5,-4.912820157919039e-8,0.002399141121851689,3.936112368628708e-5,-4.9092584839070415e-8,0.002399557122870482,3.945190021821551e-5,-4.919217196871091e-8,0.002399901681190261,3.9625470595205126e-5,-4.939240127952472e-8,0.0024001557140803276,3.9841782493496445e-5,-4.9646053324931454e-8,0.00240031603823306,4.0058414074826275e-5,-4.990243651972935e-8,0.0024003933848322214,4.02365269468108e-5,-5.0114610330648764e-8,0.0024004095942288745,4.034539638022784e-5,-5.0245052214989265e-8,0.0024003941453741816,4.0365693589607254e-5,-5.0269831914895396e-8,0.0024003801497172756,4.0291449589680024e-5,-5.018110199371788e-8,0.0024004000531943383,4.013054961443052e-5,-4.9987707246810776e-8,0.0024004814327914467,3.990360304898532e-5,-4.9713797552627094e-8,0.0024006433784475078,3.96412645683471e-5,-4.9395635374628664e-8,0.002400893829350257,3.938038444905259e-5,-4.907710595026679e-8,0.0024012280072063545,3.9159384872200925e-5,-4.88043653842751e-8,0.002401627983789423,3.901309599496099e-5,-4.861979177381442e-8,0.0024020634684160267,3.896712290496793e-5,-4.8555194568685595e-8,0.0024024942344411503,3.903172416614497e-5,-4.862420076639316e-8,0.0024028751869229125,3.919562945854613e-5,-4.881439962151439e-8,0.0024031652429550516,3.942160059336088e-5,-4.908159561584208e-8,0.0024033401183291706,3.964740296327271e-5,-4.9350792145343485e-8,0.002403406122558092,3.9796826052265784e-5,-4.952959530944614e-8,0.0024034075771528214,3.9802695108078196e-5,-4.953626629721684e-8,0.002403418663533099,3.963531471377749e-5,-4.933424264248788e-8,0.002403517483513351,3.9320414167136537e-5,-4.895377104664041e-8,0.00240375400559779,3.893213949475224e-5,-4.848339885001966e-8,0.0024041310350306584,3.856275056172833e-5,-4.803360539427687e-8,0.002404608522803643,3.8287467657906244e-5,-4.7694797328705657e-8,0.002405124618903588,3.814364277978108e-5,-4.7512463896821273e-8,0.002405618526611032,3.812961405164927e-5,-4.748570334517685e-8,0.0024060450436589023,3.821594093326314e-5,-4.7580367143404314e-8,0.002406379515424713,3.8359386346411104e-5,-4.774544974096198e-8,0.0024066165603803674,3.851416440298249e-5,-4.7926337409967924e-8,0.002406766193043988,3.863916072047892e-5,-4.8073452764022304e-8,0.0024068496190933135,3.870200493814187e-5,-4.814731567974312e-8,0.0024068954751543747,3.8681384728337856e-5,-4.812157280049673e-8,0.0024069363302526986,3.8568469741027326e-5,-4.7984907944708237e-8,0.002407005092363638,3.8367620010703626e-5,-4.774197343294295e-8,0.0024071311642991904,3.8096143001373596e-5,-4.741307791637707e-8,0.00240733648448139,3.7782662926820594e-5,-4.703219316231057e-8,0.0024076319591230843,3.746376601902139e-5,-4.664296180742872e-8,0.0024080150100535243,3.717901842199488e-5,-4.629284851707181e-8,0.0024084688627471237,3.6964873105139e-5,-4.6025986316963574e-8,0.002408963950387803,3.684822663195842e-5,-4.587550926484438e-8,0.002409461535231225,3.6840528070730786e-5,-4.585634918576009e-8,0.0024099194289861434,3.6933325176103526e-5,-4.595954827428758e-8,0.002410299639091284,3.709615129870326e-5,-4.6149286023116704e-8,0.0024105775736920194,3.727809719448076e-5,-4.636443290545415e-8,0.0024107515290991625,3.7414947503234764e-5,-4.652707276927955e-8,0.0024108494422053167,3.744332346904537e-5,-4.6559778833502254e-8,0.0024109280582808607,3.732068196771385e-5,-4.641012552830863e-8,0.0024110599588631028,3.704486401008396e-5,-4.6074593882075726e-8,0.0024113092457543352,3.666207745630117e-5,-4.560832165779338e-8,0.0024117058579894443,3.625440453889971e-5,-4.511002792620606e-8,0.00241223320394758,3.590984658345839e-5,-4.468591059086578e-8,0.0024128367433007784,3.569068786073452e-5,-4.4411566261216975e-8,0.002413447167854588,3.561679042361314e-5,-4.431182379727306e-8,0.002414003943390364,3.566857531655897e-5,-4.4364131508880796e-8,0.002414468917828636,3.5802128924618506e-5,-4.45164528407243e-8,0.0024148287689588913,3.596582802687616e-5,-4.4707042649597976e-8,0.0024150906323866994,3.6112294226174406e-5,-4.487876186163635e-8,0.0024152756199526553,3.620466985756144e-5,-4.4986732147043753e-8,0.002415412983422486,3.621886433437632e-5,-4.5001246595991545e-8,0.002415535705571361,3.614384708305006e-5,-4.490832914512481e-8,0.0024156771163272757,3.59813440871689e-5,-4.470949129805716e-8,0.0024158678193869285,3.5745351613970705e-5,-4.442116416614326e-8,0.002416132416351302,3.546120330008051e-5,-4.4073537242749924e-8,0.0024164859220694446,3.516352548830468e-5,-4.370808294460031e-8,0.00241693034169506,3.4892359785693274e-5,-4.337295078484064e-8,0.0024174524408001833,3.468719086143528e-5,-4.3115900098566585e-8,0.002418023930833043,3.457944258321774e-5,-4.2975364635792224e-8,0.002418604957254082,3.4584872568489474e-5,-4.297126534219297e-8,0.002419150952416655,3.469789771516463e-5,-4.30979643194712e-8,0.0024196218300455495,3.48898251884466e-5,-4.3321783064122653e-8,0.0024199916518604678,3.51121471359681e-5,-4.3584618304832864e-8,0.002420256595170644,3.5304987746849386e-5,-4.381393076419317e-8,0.002420439070447764,3.54098460734516e-5,-4.393818240200917e-8,0.002420585972638163,3.5384692412318615e-5,-4.39053621156832e-8,0.0024207596255476035,3.521796937688811e-5,-4.3700303187940916e-8,0.00242102169533141,3.493649672842064e-5,-4.335458114598203e-8,0.0024214136673983418,3.460203389622349e-5,-4.294254391313394e-8,0.0024219412696859064,3.4294397281599166e-5,-4.2560928350924536e-8,0.002422570997871016,3.40859042454751e-5,-4.2297873198728576e-8,0.002423241774708797,3.401825188013031e-5,-4.220478688725671e-8,0.002423886226246646,3.4092534703597756e-5,-4.2284029344064495e-8,0.002424450990286084,3.4275193790697986e-5,-4.2495842308161056e-8,0.002424907897269756,3.4513860089160096e-5,-4.277731373829174e-8,0.002425254646420478,3.475404717614502e-5,-4.306250514379759e-8,0.0024255087764721997,3.495073098604035e-5,-4.329653600382793e-8,0.0024256997145779124,3.5073628211510956e-5,-4.344214009667556e-8,0.0024258619447215263,3.510795400575972e-5,-4.3480765687463235e-8,0.002426030203565686,3.505305808974759e-5,-4.341105272837135e-8,0.0024262362674914877,3.4920608081784176e-5,-4.3246676601309794e-8,0.0024265064422872465,3.473295174654087e-5,-4.3014350394663596e-8,0.0024268589868617334,3.4521461493677566e-5,-4.275180769052857e-8,0.002427301138503399,3.432410975088323e-5,-4.250490759677728e-8,0.0024278260913050916,3.418129571204661e-5,-4.2322676945393295e-8,0.002428411097108386,3.4129280643721544e-5,-4.2249456747169526e-8,0.002429018449007624,3.4191654643649516e-5,-4.231457750259257e-8,0.002429600921945329,3.4370848029145066e-5,-4.2521942446609057e-8,0.002430111852543173,3.464306742421111e-5,-4.284362752322127e-8,0.0024305177078212167,3.4960014332554184e-5,-4.322166147588011e-8,0.0024308089963019476,3.525864256604065e-5,-4.3579634420191055e-8,0.0024310052103568625,3.54768490791095e-5,-4.3841674275576033e-8,0.0024311514832499894,3.5570331945046896e-5,-4.3953026184890535e-8,0.0024313076209347257,3.552531869349453e-5,-4.389576556823521e-8,0.0024315325810961527,3.5363327353876604e-5,-4.369491031447773e-8,0.0024318686265469066,3.513647254223246e-5,-4.341303915546696e-8,0.0024323294873825944,3.491423748049786e-5,-4.3134445579347336e-8,0.002432896167264619,3.476495141289254e-5,-4.294268271529085e-8,0.0024335222309093078,3.4737272570903575e-5,-4.2897907650809233e-8,0.0024341473034816276,3.484777220801906e-5,-4.3021473228785095e-8,0.0024347141143896403,3.5078911481254485e-5,-4.3293103813853885e-8,0.0024351828565165653,3.5387420696509406e-5,-4.3660807647483854e-8,0.0024355382696882246,3.571869639847352e-5,-4.4058284519528546e-8,0.0024357886769330174,3.602113490945862e-5,-4.442243365076725e-8,0.0024359595899447976,3.6255981177570735e-5,-4.470551282002724e-8,0.002436085616257832,3.64014787157889e-5,-4.4880378715262854e-8,0.002436203431207954,3.645261201880796e-5,-4.49403083766768e-8,0.002436346881699283,3.641860110716656e-5,-4.489600455109322e-8,0.0024365439720128446,3.631989439005647e-5,-4.477193408814986e-8,0.002436814886263786,3.618547757967348e-5,-4.460305079373914e-8,0.0024371701965660787,3.605043991849035e-5,-4.443187709405474e-8,0.0024376087810835056,3.5953118153448417e-5,-4.430512313890507e-8,0.002438115638816738,3.593080766479197e-5,-4.42685612060324e-8,0.0024386606910261066,3.601319060175138e-5,-4.43590417894124e-8,0.0024392005329820178,3.621366124796751e-5,-4.459380937231256e-8,0.0024396852406738875,3.652073535771226e-5,-4.495979153559817e-8,0.002440070792536112,3.689393707336404e-5,-4.540830813754903e-8,0.0024403341938348043,3.7269028978704966e-5,-4.586125501539923e-8,0.0024404847869948067,3.757420212930339e-5,-4.6230801286461525e-8,0.0024405649339235085,3.775253295873212e-5,-4.6446847061845124e-8,0.0024406379971211724,3.778108573313487e-5,-4.6480442904616754e-8,0.0024407684360130493,3.7678040163525975e-5,-4.635265130274541e-8,0.002441002576816896,3.749564568269083e-5,-4.6126207922268527e-8,0.0024413569455008703,3.730344562480743e-5,-4.58853778897302e-8,0.0024418164775716804,3.716885726843634e-5,-4.571251766869334e-8,0.002442341086211704,3.7141004685513786e-5,-4.566838003723965e-8,0.002442877339190302,3.72411338432493e-5,-4.5780171769525656e-8,0.002443371731515466,3.746064251142103e-5,-4.603872319654958e-8,0.002443782406429579,3.7766052234272806e-5,-4.640413953378797e-8,0.002444086872764397,3.810893879139721e-5,-4.681768347059421e-8,0.002444284388309687,3.843785498667255e-5,-4.721633349478445e-8,0.002444393232414692,3.8709012326829734e-5,-4.7546011694557105e-8,0.002444444549161754,3.889334328329184e-5,-4.7770454539860257e-8,0.002444475074792687,3.8979187827749855e-5,-4.787468720267451e-8,0.0024445206944451194,3.8971331473534686e-5,-4.7863936944109584e-8,0.0024446118314487707,3.8887888173957045e-5,-4.775982946018779e-8,0.0024447706911564257,3.8756507830295623e-5,-4.7595742185117445e-8,0.002445009754862674,3.861079858955392e-5,-4.741246632391835e-8,0.002445330792627307,3.848709249206566e-5,-4.7254353116952106e-8,0.0024457239072774276,3.84210898084392e-5,-4.7165331531864033e-8,0.002446166646694304,3.844355610942536e-5,-4.71836986496915e-8,0.002446624062616858,3.857428817952799e-5,-4.733464480752854e-8,0.0024470514934107203,3.88144481598043e-5,-4.762062321108293e-8,0.002447402125327943,3.913928762815128e-5,-4.801212199106996e-8,0.0024476400881559847,3.9495739935443694e-5,-4.8444475535150416e-8,0.0024477561339314394,3.981049166716775e-5,-4.8827712071902615e-8,0.002447778077693695,4.001077266348328e-5,-4.9072160123498955e-8,0.0024477670483197492,4.005148747549024e-5,-4.9121840338880554e-8,0.0024477974812433497,3.993465087268592e-5,-4.897832831402965e-8,0.002447929926440992,3.9709268450711776e-5,-4.870064967828901e-8,0.0024481909223161946,3.9451954414470326e-5,-4.838174394154787e-8,0.0024485684783898502,3.923993501418732e-5,-4.811575988446022e-8,0.0024490213965491316,3.9129377699806304e-5,-4.797180052202577e-8,0.0024494948154261892,3.91451644029732e-5,-4.798138431887394e-8,0.002449935069477873,3.928119976470324e-5,-4.8138482471436045e-8,0.002450300397506881,3.9507323269912974e-5,-4.840749035993413e-8,0.0024505668157711494,3.9779044908857327e-5,-4.8734735279841313E-08,0.0024507297637555462,4.004759573096723e-5,-4.906061161920809e-8,0.002450802394303154,4.02688488745371e-5,-4.9330599704006644e-8,0.0024508113644507706,4.0410128173367605e-5,-4.95038655686505e-8,0.002450791125069385,4.0454212555310635e-5,-4.955844487476108e-8,0.0024507778465312773,4.040035570468197e-5,-4.949267054201453e-8,0.0024508040198822152,4.026270069107783e-5,-4.932327950223557e-8,0.0024508944505534447,4.006688255862525e-5,-4.908122347286046e-8,0.0024510638634689867,3.984580917053899e-5,-4.880648823794057e-8,0.00245131584498336,3.963541528939374e-5,-4.854295462312273e-8,0.002451642653661857,3.9470681141633724e-5,-4.833364518839405e-8,0.002452025536044154,3.938176083843848e-5,-4.8216083300638214e-8,0.002452435488543121,3.938977033584164e-5,-4.8217107227132724e-8,0.002452835048062748,3.950174696583605e-5,-4.8346481745672895e-8,0.0024531824507044967,3.970500384005907e-5,-4.858962496972789e-8,0.0024534396241559695,3.9962702831889606e-5,-4.890182990265696e-8,0.0024535843268946146,4.021443150526203e-5,-4.920880941676828e-8,0.002453623652929858,4.0386636134526066e-5,-4.9419622792017125e-8,0.002453601452891794,4.041499005959166e-5,-4.945444695873122e-8,0.0024535904575645672,4.0272043808040254e-5,-4.9278768855135644e-8,0.002453667088416081,3.9984366591700615e-5,-4.892445528448971e-8,0.0024538804961186404,3.9625472135700606e-5,-4.8481018851177726e-8,0.002454234041076148,3.9286627001372286e-5,-4.8059919577965076e-8,0.002454688758937021,3.90430339964667e-5,-4.7753378723272426e-8,0.002455182859858328,3.893307901809375e-5,-4.760913419343073e-8,0.0024556538362148746,3.895585698194267e-5,-4.762729962876685e-8,0.0024560537286482022,3.908100050787737e-5,-4.777201985779246e-8,0.00245635559786168,3.92623565237223e-5,-4.7987768345426784e-8,0.002456553543520675,3.945013089553443e-5,-4.821391608652092e-8,0.002456659304914327,3.9599666210168044e-5,-4.839543997652059e-8,0.002456697551274787,3.9677063676223765e-5,-4.849000855734107e-8,0.002456700822614684,3.966238759049165e-5,-4.847222180997126e-8,0.0024567044573505052,3.9550907364328136e-5,-4.833540821334541e-8,0.0024567417680072287,3.935256550822404e-5,-4.8091109193474636e-8,0.0024568398052084747,3.9089819952275556e-5,-4.776643242859904e-8,0.002457016102034005,3.879409971555748e-5,-4.739964644423014e-8,0.0024572767266246858,3.850135084065896e-5,-4.7034702557923994e-8,0.002457615714144817,3.8247292949526414e-5,-4.671548886753261e-8,0.002458015719767934,3.806281830374309e-5,-4.648030512056859e-8,0.0024584497093368225,3.7969709899505705e-5,-4.6356668032574766e-8,0.0024588835950892117,3.797672416493626e-5,-4.6356402548602995e-8,0.002459280019112911,3.8076035091713856e-5,-4.647098884390965e-8,0.0024596039507214372,3.8240450757803655e-5,-4.666776031810568e-8,0.0024598307142160007,3.842294852242427e-5,-4.68890281670926e-8,0.002459955918353923,3.8561282527527495e-5,-4.7057687283657186e-8,0.0024600044256263562,3.85906258738798e-5,-4.7093002809037085e-8,0.0024600323640595525,3.846469351560399e-5,-4.693699010582562e-8,0.002460115198327215,3.817888591278212e-5,-4.658318142014719e-8,0.0024603211513315733,3.778139333481038e-5,-4.609033001301854e-8,0.0024606816896058582,3.7360118141523624e-5,-4.5566248750844804e-8,0.0024611773581020993,3.700873869629158e-5,-4.5126111329188663e-8,0.0024617480565587665,3.679136890764092e-5,-4.484915535672109e-8,0.0024623194040428297,3.6725241793431914e-5,-4.4757458521259293e-8,0.002462828313114861,3.6785610286324895e-5,-4.4821776764596e-8,0.0024632368323780508,3.692313753770688e-5,-4.49825480110503e-8,0.002463533911415987,3.7081973038857536e-5,-4.517174974987359e-8,0.002463730207416001,3.72123954530806e-5,-4.5328262829285335e-8,0.0024638508339381053,3.727738907944816e-5,-4.540602228952397e-8,0.0024639287406243806,3.725496815222289e-5,-4.537712390347134e-8,0.002463999440178538,3.7138246844026674e-5,-4.523220853693909e-8,0.002464096769834068,3.693441043162565e-5,-4.4979410248424785e-8,0.002464249278477507,3.6662920271676045e-5,-4.464221452771284e-8,0.0024644771058909905,3.6352892349154964e-5,-4.4256185173269244e-8,0.0024647894963774355,3.60394813223482e-5,-4.3864446992286476e-8,0.00246518333004217,3.575928664507124e-5,-4.3512032388348086e-8,0.00246564308966862,3.5545192829730305e-5,-4.323961698689231e-8,0.002466142462746481,3.54212599682058e-5,-4.30773347216381e-8,0.0024666475561435836,3.539825611996659e-5,-4.303928925890125e-8,0.002467121549800276,3.5470424064565755e-5,-4.311941218583528e-8,0.002467530510301026,3.5614038369783264e-5,-4.328936880925462e-8,0.0024678501018424014,3.578830836147025e-5,-4.3499317664747304e-8,0.00246807277205011,3.5939557401127685e-5,-4.368284640476247e-8,0.0024682141340358534,3.6009986170699735e-5,-4.3767824546787344e-8,0.002468315806348312,3.595167953042106e-5,-4.369398422338407e-8,0.002468440719277613,3.574403825458124e-5,-4.343483114258189e-8,0.0024686576285004418,3.5408406295791984e-5,-4.301598790135291e-8,0.002469016756628685,3.5009868675168896e-5,-4.251749277816247e-8,0.002469527016305481,3.4639085816369505e-5,-4.2051331770138575e-8,0.0024701491272457075,3.437918303108398e-5,-4.172053655964463e-8,0.0024708107727132163,3.4275108324639473e-5,-4.1581346163947136e-8,0.0024714349391305145,3.432221330845508e-5,-4.162900742123513e-8,0.0024719649634269477,3.447673339527891e-5,-4.181047415170179e-8,0.0024723756773897968,3.4677347990773343e-5,-4.2050733510056084e-8,0.0024726711706196352,3.486498141779451e-5,-4.227704642717137e-8,0.002472875776800631,3.499457801076819e-5,-4.243345755026598e-8,0.002473024311147267,3.5039164456257024e-5,-4.248596282344877e-8,0.002473154485424879,3.49892258455584e-5,-4.24219893311207e-8,0.0024733018836487117,3.485023256564978e-5,-4.224757508831041e-8,0.0024734966693373177,3.4639859686924084e-5,-4.198405931463602e-8,0.002473761122223743,3.4385249288497285e-5,-4.166470061647262e-8,0.0024741075410927692,3.412005527399114e-5,-4.1330957835760266e-8,0.0024745365035125336,3.388081280598191e-5,-4.1027956557272016e-8,0.0024750358991933777,3.3702298329276224e-5,-4.0798783384882296e-8,0.002475581446443766,3.361205682415149e-5,-4.0677810154140694e-8,0.0024761393094790735,3.362488283309667e-5,-4.068393655070341e-8,0.00247667099923248,3.3738415010136826e-5,-4.081509111115514e-8,0.0024771401592741794,3.393112591255991e-5,-4.104553604679316e-8,0.0024775202300596727,3.4163782098038836e-5,-4.132736396042357e-8,0.0024778015552186553,3.4384841805604154e-5,-4.15968981141725e-8,0.002477996355230064,3.453957481857277e-5,-4.178587242689799e-8,0.002478139925461257,3.4582095835946386e-5,-4.183646089222978e-8,0.0024782863608294597,3.448855008036613e-5,-4.171792894077942e-8,0.002478497599215119,3.426810101996982e-5,-4.1440616533293496e-8,0.002478826423475806,3.3966768621773196e-5,-4.106097101147728e-8,0.002479297655651806,3.365920201414745e-5,-4.067146491268234e-8,0.0024798956470742607,3.3427359889743966e-5,-4.0374142208359564e-8,0.002480566263107198,3.333281657692773e-5,-4.0246164098665086e-8,0.0024812348815230548,3.339569240715765e-5,-4.031349099874403e-8,0.002481832069138389,3.359098154088289e-5,-4.054608293176884e-8,0.0024823140828337882,3.3862509899205475e-5,-4.087496962472572e-8,0.0024826701499891905,3.4144843169478624e-5,-4.121926049669797e-8,0.0024829174589391183,3.438196398751778e-5,-4.150927531351717e-8,0.002483090231395934,3.453716218275256e-5,-4.169890994247633e-8,0.0024832289273681676,3.459479555529096e-5,-4.1768010969739914e-8,0.0024833725099405357,3.455739202683464e-5,-4.171898971311369e-8,0.002483553953461178,3.444130953944551e-5,-4.1571586234288615e-8,0.002483797896582137,3.42726872143246e-5,-4.135789466565913e-8,0.002484119250717028,3.408404982664835e-5,-4.111811949072816e-8,0.0024845220544084173,3.3911157045767064e-5,-4.08966177191401e-8,0.0024849984608592214,3.378942234513219e-5,-4.073744810316272e-8,0.002485528319030998,3.37493393541924e-5,-4.0678740705520224e-8,0.0024860802611576817,3.381090099062003e-5,-4.07458217081001e-8,0.002486615292822404,3.3977887022200906e-5,-4.094410565553709e-8,0.0024870933615432594,3.4233776242617746e-5,-4.1253884823212716e-8,0.0024874822433588704,3.454145160287273e-5,-4.162972775740252e-8,0.0024877666980437367,3.4848325612800404e-5,-4.200659476353093e-8,0.002487954948091704,3.5096872718110185e-5,-4.2312767159825944e-8,0.0024880797904155523,3.523845842873798e-5,-4.248704298833028e-8,0.002488193043039279,3.5246843277377304e-5,-4.249570636640487e-8,0.0024883539592743067,3.512738494103619e-5,-4.234426909230887e-8,0.0024886140602875923,3.49187025600563e-5,-4.207987071532803e-8,0.002489002194927896,3.468515900952789e-5,-4.178219564842183e-8,0.0024895143834379584,3.450085337149065e-5,-4.1543686661381805e-8,0.002490112692358687,3.4428839747837344e-5,-4.144362746866002e-8,0.002490735095733774,3.4502254176917696e-5,-4.152441444489307e-8,0.002491313820334456,3.47148501990305e-5,-4.177943206499539e-8,0.0024917952057646542,3.5025110867509906e-5,-4.21578484386859e-8,0.002492153108185882,3.537166319265242e-5,-4.2583614770799746e-8,0.0024923915653697563,3.569250545655623e-5,-4.297938359576452e-8,0.0024925381077774505,3.594019773552308e-5,-4.328553882965522e-8,0.0024926327298874706,3.608907519420701e-5,-4.346936640882342e-8,0.0024927174854313663,3.6135139860801745e-5,-4.352511605516019e-8,0.0024928293045150462,3.6091731116077385e-5,-4.3468759712982866e-8,0.0024929962078651933,3.598404077227055e-5,-4.3331234070503576e-8,0.002493235828937878,3.584424198247867e-5,-4.315237723752643e-8,0.002493554988497319,3.5707654226319e-5,-4.297612739315671e-8,0.002493949475402431,3.560950550536974e-5,-4.284648196073154e-8,0.002494403814902926,3.558150409860973e-5,-4.2803251027824265e-8,0.0024948914829334063,3.5647523756435825e-5,-4.287670742727347e-8,0.0024953765911673344,3.581825773142045e-5,-4.308089582356996e-8,0.0024958182908375675,3.608573040867354e-5,-4.340666705533066e-8,0.0024961786512342457,3.641986140806195e-5,-4.381718846972339e-8,0.0024964332001036105,3.677013333856981e-5,-4.424981283072611e-8,0.002496580985875428,3.707466125980302e-5,-4.4627260595163124e-8,0.00249664942189288,3.7275972463325826e-5,-4.487730097257107e-8,0.002496690103679088,3.733875515066651e-5,-4.4954995613220536e-8,0.0024967655193018647,3.726250067358835e-5,-4.485864320894178e-8,0.002496931013734003,3.7083456871196986e-5,-4.46324458229267e-8,0.0024972186148263043,3.686490845186074e-5,-4.435466169172905e-8,0.002497628180291189,3.6679510733870065e-5,-4.411582351619956e-8,0.002498128079111284,3.658972340409257e-5,-4.3994441199673844e-8,0.0024986644042137227,3.663208106121771e-5,-4.4037246854020054e-8,0.0024991755753180833,3.680926861936187e-5,-4.4248953740883185e-8,0.002499608064555356,3.709163133072151e-5,-4.459370765840227e-8,0.0024999288144117358,3.742710477725366e-5,-4.500715060851872e-8,0.0025001310412585205,3.775603780312682e-5,-4.5414811573711545e-8,0.0025002324917523817,3.8025992028683344e-5,-4.57506862741052e-8,0.002500267909808244,3.82021913744237e-5,-4.5970516699009e-8,0.0025002791334092648,3.827161818741498e-5,-4.6057156152074936e-8,0.002500306150636883,3.824142696912959e-5,-4.601877616789812e-8,0.002500381023813219,3.813396254515294e-5,-4.588273798227383e-8,0.002500524917925695,3.7980819109320463e-5,-4.5688184530668866e-8,0.002500747387946368,3.781755623906785e-5,-4.547941847511398e-8,0.0025010467943652028,3.7679593748579237e-5,-4.530076608806616e-8,0.002501411000812327,3.759894473403009e-5,-4.5192519652786e-8,0.002501818061535664,3.76010451065458e-5,-4.518700349120371e-8,0.002502237249305373,3.7700983349453346e-5,-4.530383549196263e-8,0.002502631391630373,3.789891117462528e-5,-4.5544060670952407e-8,0.0025029618245448393,3.817544639615828e-5,-4.588418136956523e-8,0.0025031968555852867,3.8489391629367015e-5,-4.6273070203581374e-8,0.002503322900130418,3.878132383082006e-5,-4.6636329847159344e-8,0.0025033544659702643,3.898595666221756e-5,-4.689179674409995e-8,0.0025033366866835474,3.9052160624291637e-5,-4.6974744631872444e-8,0.002503335424761968,3.8963286204251026e-5,-4.686346369928086e-8,0.002503416415545243,3.874697513072474e-5,-4.659163332249408e-8,0.002503622458507168,3.846773122092755e-5,-4.623914977805023e-8,0.0025039595976610314,3.820530008492874e-5,-4.590530882256746e-8,0.002504397631776516,3.802946606966512e-5,-4.5677537488936655e-8,0.002504882299547712,3.798169372682445e-5,-4.560852435839345e-8,0.002505352221421315,3.806826004220745e-5,-4.570743517294879e-8,0.00250575432324309,3.8263797822131395e-5,-4.59439244261933e-8,0.0025060542893460607,3.852145546614233e-5,-4.6260390338084265e-8,0.002506241100184328,3.878568465963214e-5,-4.658768272125083e-8,0.0025063261680084966,3.900454144029845e-5,-4.686046599932783e-8,0.0025063382859264074,3.913932359754488e-5,-4.702948014495108e-8,0.0025063160483484925,3.917014569025023e-5,-4.706882713849625e-8,0.002506299694580531,3.9097007570934184e-5,-4.697758835500036e-8,0.0025063241642786917,3.893705066219002e-5,-4.677655197485161e-8,0.002506414458106024,3.8719469291395064e-5,-4.650187612960767e-8,0.002506583529031959,3.847966713294664e-5,-4.6197729527279165e-8,0.0025068322231723375,3.825390939784268e-5,-4.5909552105830005e-8,0.00250715042643049,3.8075081039815325e-5,-4.5678747389959236e-8,0.002507518671035578,3.79694315028609e-5,-4.553864588391083e-8,0.002507909881434134,3.7953757863868274e-5,-4.551099211154035e-8,0.0025082914429322,3.8032479762118567e-5,-4.560219705504129e-8,0.0025086283062298424,3.819441369790588e-5,-4.5799089344806656e-8,0.002508888222288745,3.8409920504514224e-5,-4.6065065644875405e-8,0.002509049867274366,3.863051042059274e-5,-4.633938175836797e-8,0.002509113004638694,3.879425510226927e-5,-4.654391267553016e-8,0.0025091068429147767,3.883993594289078e-5,-4.6601084959132783e-8,0.0025090898042000585,3.872875934821506e-5,-4.6461387254399373e-8,0.002509134996273683,3.846495952331999e-5,-4.6129379088556667e-8,0.002509303823785431,3.810176136963081e-5,-4.567118163005868e-8,0.0025096206611317003,3.77249340788089e-5,-4.519386918014874e-8,0.0025100635025889603,3.742094334698776e-5,-4.480570179737146e-8,0.0025105750725739227,3.7247279761174246e-5,-4.4579149479260436e-8,0.0025110856597778002,3.721891833235642e-5,-4.4533963341258614e-8,0.0025115347336513087,3.7312355209207396e-5,-4.464198908935113e-8,0.0025118837717088426,3.7479672497395944e-5,-4.4844363555259744e-8,0.0025121197805155586,3.766434463552293e-5,-4.507092241835546e-8,0.0025122524606316582,3.781403239390384e-5,-4.5256039989766344e-8,0.002512308218517646,3.788897265948401e-5,-4.534921710684068e-8,0.002512323198993744,3.7866377431753216e-5,-4.532087455967344e-8,0.0025123364352792246,3.774164049515155e-5,-4.5164209733579505e-8,0.002512383722153255,3.752690440451212e-5,-4.4893662222274306e-8,0.0025124927690744884,3.724752495244522e-5,-4.454058376296237e-8,0.0025126800686300593,3.6937187041074546e-5,-4.4147073781900625e-8,0.002512949640805612,3.663249847498581e-5,-4.3759102263850506e-8,0.0025132935154346414,3.636784559588725e-5,-4.3419995601533096e-8,0.0025136935134270817,3.6171127440481755e-5,-4.3165098457630535e-8,0.002514123766723244,3.606055777639336e-5,-4.301781026749884e-8,0.002514553618955688,3.604231707921164e-5,-4.298663815376317e-8,0.0025149508839445193,3.610876316223164e-5,-4.306282715704458e-8,0.0025152857940081257,3.6237122105096005e-5,-4.321846926867821e-8,0.0025155362609611655,3.6389174493579715e-5,-4.3405830751730746e-8,0.002515694790395706,3.651350376824656e-5,-4.356001367114698e-8,0.002515776049335391,3.6552764092910476e-5,-4.360815615449484e-8,0.0025158217306482694,3.64579617376964e-5,-4.348766977365181e-8,0.002515896936537497,3.620833883698536e-5,-4.317158041654697e-8,0.002516073071847446,3.5828669318152446e-5,-4.269046581534293e-8,0.002516399987719169,3.539060604592482e-5,-4.213413246847748e-8,0.0025168814606322987,3.499021840014745e-5,-4.162331415721513e-8,0.0025174707936113064,3.4710531005774946e-5,-4.126263149227772e-8,0.002518090589616577,3.459078644678115e-5,-4.1102057661954364e-8,0.002518663524727177,3.4618912918017596e-5,-4.112741399925282e-8,0.0025191361740298083,3.474582741761788e-5,-4.1278096176040484e-8,0.0025194875406559848,3.490802432070915e-5,-4.147510457868247e-8,0.002519725292742549,3.504638962014763e-5,-4.16444050552658e-8,0.0025198766141857846,3.5116951628882e-5,-4.173036446018124e-8,0.002519978706172601,3.509468993429849e-5,-4.1700694202266914e-8,0.002520071130482626,3.497310385097045e-5,-4.154621540106111e-8,0.002520190252699242,3.4761794687652565e-5,-4.1278135639874127e-8,0.0025203652372844786,3.448316626617987e-5,-4.092409555262571e-8,0.002520615191656812,3.416849468288395e-5,-4.05232510677893e-8,0.002520947440465501,3.385345763496335e-5,-4.0120551152513905e-8,0.002521357059662189,3.3573332103171066e-5,-3.976057689732734e-8,0.0025218278023055253,3.335822588172072e-5,-3.9481488035551096e-8,0.0025223344083919984,3.3228896480038676e-5,-3.930979257938309e-8,0.0025228460215779803,3.319367073788616e-5,-3.925652251261835e-8,0.0025233303087924958,3.324669892834196e-5,-3.9315015622613785e-8,0.0025237579626117535,3.336760095667987e-5,-3.946031753109398e-8,0.0025241074151963775,3.352256518500154e-5,-3.9650309128366536e-8,0.0025243697315655363,3.366716014331096e-5,-3.982900185191263e-8,0.002524553460207322,3.375163915239177e-5,-3.9933128485974816e-8,0.002524688300114605,3.37298851909107e-5,-3.9903559505638475e-8,0.002524824998114826,3.357240651657453e-5,-3.970202211903166e-8,0.0025250277665400896,3.328120777325597e-5,-3.933021967054159e-8,0.002525356611076024,3.289990453199541e-5,-3.8842803606554595e-8,0.0025258428381231134,3.250914558990305e-5,-3.834160036262284e-8,0.0025264698957574395,3.220189906693548e-5,-3.794432342774024e-8,0.0025271741566565867,3.2047197639093385e-5,-3.773873488953271e-8,0.002527868930050737,3.206296769477658e-5,-3.7748283537389005e-8,0.002528477957775852,3.2214078628227146e-5,-3.792951338789108e-8,0.0025289589671146006,3.243333093220877e-5,-3.8198347470684486e-8,0.002529308244893737,3.2649160481611736e-5,-3.8464834618929027e-8,0.002529551044230285,3.280554245702909e-5,-3.8658136766423037e-8,0.0025297276422903844,3.286996887218826e-5,-3.873662679239773e-8,0.0025298816375502052,3.283279972249427e-5,-3.8687266747971134e-8,0.002530052440279624,3.2702708511500886e-5,-3.852013964263886e-8,0.0025302712732322313,3.250144171865661e-5,-3.8262077101730963E-08,0.002530559210242333,3.22591991158146e-5,-3.7950935413685944e-8,0.002530926148178654,3.2010602838034795e-5,-3.7630466201304596e-8,0.002531370351391248,3.1790798148834993e-5,-3.7345270529438355e-8,0.0025318786907376338,3.1631370951251876e-5,-3.713553615551818e-8,0.0025324279262051433,3.155608559611767e-5,-3.703162366365894e-8,0.0025329874164920214,3.1576901848478516e-5,-3.704907123537745e-8,0.0025335233363896095,3.1691081346079224e-5,-3.71849683887019e-8,0.002534004013295205,3.1880164541897305e-5,-3.741660475396124e-8,0.0025344056658638974,3.211134266810114e-5,-3.770302889521404e-8,0.0025347176716889862,3.234141683476799e-5,-3.798981805268735e-8,0.0025349464931195965,3.25231453918205e-5,-3.821692596727692e-8,0.002535117468766687,3.261356425395861e-5,-3.832919965284332e-8,0.002535273522037362,3.25837585549067e-5,-3.828894828785741e-8,0.0025354694854592633,3.242890013057747e-5,-3.808899818124254e-8,0.0025357608919522735,3.217582413424165e-5,-3.776263794934066e-8,0.002536187666940124,3.1883621764644e-5,-3.738458087106923e-8,0.0025367568259437178,3.1632385404099197e-5,-3.7056717765237276e-8,0.0025374327525164407,3.1499190159307474e-5,-3.687752844703763e-8,0.0025381439662942977,3.152925181564535e-5,-3.690529396896161e-8,0.00253880714969785,3.1717495544648184e-5,-3.7134493175846014e-8,0.002539357012067217,3.201212311537006e-5,-3.7500132915228656e-8,0.002539765928854451,3.233760649167408e-5,-3.79067823651572e-8,0.0025400453147970577,3.2622583246552875e-5,-3.82638918563021e-8,0.0025402331112333227,3.281872156862578e-5,-3.850972952935261e-8,0.002540377487382661,3.290621872055572e-5,-3.8618458257282727e-8,0.002540524155092487,3.288979390474908e-5,-3.8595246105451726e-8,0.0025407093934606078,3.279105867884921e-5,-3.846681028316092e-8,0.002540957537634892,3.2641231271875194e-5,-3.827233474111451e-8,0.002541280815381751,3.247562338960235e-5,-3.805651702208651e-8,0.0025416799467947535,3.232966235413645e-5,-3.786445609457888e-8,0.002542144857740274,3.223562798311164e-5,-3.7737407372711096e-8,0.002542655579590631,3.221938662051105e-5,-3.7708565661377785e-8,0.0025431838362320446,3.229680174430522e-5,-3.779849423590047e-8,0.0025436960054889923,3.247013233511464e-5,-3.8010564296692125e-8,0.00254415790798978,3.272542643389036e-5,-3.8327620226833e-8,0.002544541182956549,3.303226997284184e-5,-3.871155421654684e-8,0.0025448301444755037,3.334704611861932e-5,-3.9107270584671315e-8,0.0025450273211040327,3.3620069672829226e-5,-3.9451574837501164e-8,0.002545155729501141,3.380568399136757e-5,-3.968592063249876e-8,0.002545256556630443,3.387319471601984e-5,-3.977037692107729e-8,0.0025453820443540687,3.3816009067509984e-5,-3.969547432241733e-8,0.002545584452323269,3.365650342624907e-5,-3.948871602576002e-8,0.0025459029162299583,3.344455147949948e-5,-3.9213016496428415e-8,0.0025463510522096334,3.324840420752361e-5,-3.895529090102889e-8,0.002546909232956193,3.3138246514345544e-5,-3.8805530645937213e-8,0.002547525817875957,3.31656565561402e-5,-3.883045961997576e-8,0.002548129745697608,3.334578366524815e-5,-3.9050513834874766e-8,0.002548651901131051,3.3650693689135876e-5,-3.9431034299941284e-8,0.00254904685669721,3.4018656743914485e-5,-3.989388291545174e-8,0.002549305056062235,3.4375770534290136e-5,-4.034493649891447e-8,0.002549450755241978,3.465939649203068e-5,-4.070401123079711e-8,0.0025495291586907494,3.4833241697630345e-5,-4.092420182378461e-8,0.002549590687379239,3.4890489219274215e-5,-4.099602575860678e-8,0.0025496789205144556,3.4848031855415884e-5,-4.0940251920067316e-8,0.0025498244612649898,3.473730209237217e-5,-4.079637327911076e-8,0.0025500436032672657,3.459585033605535e-5,-4.061196445682029e-8,0.002550339547154352,3.4461308211710806e-5,-4.0434988555481746e-8,0.0025507043433619027,3.4367523260307965e-5,-4.030880973480197e-8,0.0025511206731693597,3.4341897944161364e-5,-4.0268729945377805e-8,0.002551563424104876,3.4402972367080165e-5,-4.03388608138628e-8,0.002552001606617659,3.4557690980306746e-5,-4.0528610973922175e-8,0.002552401461273141,3.479848664498499e-5,-4.082892216673804e-8,0.0025527314827823774,3.510120673609544e-5,-4.120952912256527e-8,0.002552969364218686,3.542565410114826e-5,-4.161951137566323e-8,0.0025531095580215266,3.572058968524942e-5,-4.19935413975739e-8,0.002553168729760865,3.59339104478195e-5,-4.226480110017664e-8,0.0025531858573809097,3.602631744383978e-5,-4.238244913932361e-8,0.0025532150611217693,3.598419299693054e-5,-4.232817322961466e-8,0.002553312233386756,3.582648549097322e-5,-4.212517282076237e-8,0.0025535195183206613,3.560220174300033e-5,-4.1835212060668614e-8,0.002553852830502855,3.537869695525301e-5,-4.15439349344679e-8,0.0025542964378125308,3.5224255096316406e-5,-4.133880357556166e-8,0.002554806195557747,3.519005643611671e-5,-4.1286055750094206e-8,0.002555320571266334,3.5296537354939525e-5,-4.141303722830442e-8,0.0025557766128750385,3.552799805828805e-5,-4.170091750744843e-8,0.002556126465171574,3.583732608559857e-5,-4.209034923582469e-8,0.002556349360987087,3.615973932622834e-5,-4.249882289419115e-8,0.0025564551410904254,3.6431100822784126e-5,-4.284408179364047e-8,0.0025564785276809823,3.6604393384032696e-5,-4.306534222497807e-8,0.002556467160589559,3.6658984478097046e-5,-4.3135357610844236e-8,0.002556468510402671,3.660096821231846e-5,-4.306106582894111e-8,0.0025565200544311623,3.645675748916501e-5,-4.28755593884766e-8,0.0025566445046864778,3.626394236750845e-5,-4.262649174123844e-8,0.0025568493925952245,3.606285126280341e-5,-4.236530656389189e-8,0.002557129168848333,3.589047078361781e-5,-4.213942711868888e-8,0.0025574680949682657,3.5776750212926264e-5,-4.1987475893609535e-8,0.0025578429268030643,3.574244515459497e-5,-4.193647233080398e-8,0.002558225197975276,3.579750560221392e-5,-4.1999734310573656e-8,0.0025585835602312756,3.593934241195524e-5,-4.217460204810126e-8,0.002558887016647417,3.61509584570488e-5,-4.2439939751589254e-8,0.0025591098618594843,3.639984373749989e-5,-4.2754572922321514e-8,0.002559238497448476,3.663948624180955e-5,-4.305908526809104e-8,0.002559278835866122,3.6815737799850185e-5,-4.3283910146574906e-8,0.002559261046831353,3.68791601038681e-5,-4.336518833602966e-8,0.0025592372774527606,3.680125222475687e-5,-4.3265665007869605e-8,0.0025592697003744484,3.658826729490232e-5,-4.299250430234186e-8,0.0025594113266689754,3.6284623802832374e-5,-4.260177686092147e-8,0.0025596874257284618,3.596177093402923e-5,-4.218437109225698e-8,0.0025600863540812774,3.569620677368294e-5,-4.183807532178788e-8,0.002560563687246403,3.554623400075656e-5,-4.1637989758230514e-8,0.002561056690233244,3.553661609585996e-5,-4.161684553067492e-8,0.0025615023865055877,3.565507989845713e-5,-4.176023644906828e-8,0.002561853048804872,3.585927599621287e-5,-4.20151041647804e-8,0.0025620856129585094,3.6090108860365954e-5,-4.230643641429664e-8,0.0025622040446008454,3.628699041834416e-5,-4.255663518033421e-8,0.0025622353918832905,3.6401300490328786e-5,-4.270283147309331e-8,0.0025622213473997326,3.6405401558346106e-5,-4.2708678956345274e-8,0.0025622078408738705,3.6295813489391095e-5,-4.256872173084837e-8,0.0025622353848293975,3.609068615788058e-5,-4.230540259760305e-8,0.00256233232102081,3.582322550250386e-5,-4.1960772840867707e-8,0.002562511863801732,3.553353735483984e-5,-4.158605612885912e-8,0.0025627725248878294,3.526111693837438e-5,-4.123196242121757e-8,0.00256310070883618,3.503928727808233e-5,-4.0941482037820396e-8,0.0025634741471409566,3.4891828381175004e-5,-4.074551346356165e-8,0.002563865248603042,3.483125361276283e-5,-4.066063228427299e-8,0.002564244075042713,3.4857926898380974e-5,-4.068793102758481e-8,0.002564581202623444,3.495942454822687e-5,-4.0812119542659516e-8,0.00256485109943431,3.5110048036088305e-5,-4.100075191629571e-8,0.0025650367242128005,3.527118210779312e-5,-4.120451556732618e-8,0.002565135498337338,3.539413055019303e-5,-4.136076151439963e-8,0.0025651654120114266,3.5427525351978796e-5,-4.1403038721833427e-8,0.0025651680412939974,3.533045146974794e-5,-4.127809559426407e-8,0.0025652038004362098,3.508913423679075e-5,-4.096749224333056e-8,0.0025653363340437958,3.472992631684516e-5,-4.050439181559414e-8,0.0025656093621240807,3.431861032240273e-5,-3.997271395936973e-8,0.0025660270415399614,3.394124366569468e-5,-3.9482630402027894e-8,0.0025665499166005316,3.367374522340637e-5,-3.913169321930131e-8,0.0025671094737676993,3.3555941288687166e-5,-3.8971649823626466e-8,0.0025676326398133926,3.358238507761676e-5,-3.899658257921173e-8,0.00256806353887396,3.3710715096302974e-5,-3.915332696323073e-8,0.0025683748955028416,3.387946611070678e-5,-3.936392740831083e-8,0.0025685688159335627,3.402630843529469e-5,-3.954873741392243e-8,0.0025686706264498697,3.410151913115822e-5,-3.96436201055269e-8,0.002568719735740128,3.4075375284090386e-5,-3.9609586863852165e-8,0.0025687602388208127,3.3940249039981586e-5,-3.9435794394587893e-8,0.002568832735617296,3.370870760914346e-5,-3.913743671001868e-8,0.0025689681542897694,3.340879250968684e-5,-3.874991257803349e-8,0.0025691840551694215,3.307763210742136e-5,-3.832068947589197e-8,0.002569483538443005,3.275462578485857e-5,-3.790047634512565e-8,0.00256985645494049,3.2475309573827486e-5,-3.753521316052912e-8,0.0025702822795653883,3.226668899010827e-5,-3.725997236190257e-8,0.002570733820216625,3.214437650152126e-5,-3.70952464417701e-8,0.002571181033117111,3.211133565934368e-5,-3.70453424363933e-8,0.0025715946013054125,3.215772517602418e-5,-3.7098167201791944e-8,0.002571949318347555,3.226144137496881e-5,-3.722583343084536e-8,0.002572227570996682,3.2389277195387017e-5,-3.738598474604562e-8,0.0025724233208959243,3.249913626791757e-5,-3.752447594345222e-8,0.002572546572517723,3.2544481248383096e-5,-3.7581027423136185e-8,0.002572627105263867,3.248253008845186e-5,-3.7499865346558056e-8,0.0025727146254667485,3.2286766565557764e-5,-3.7246045798024494e-8,0.0025728713746888203,3.196144702345607e-5,-3.6824362906102526e-8,0.0025731546573224077,3.1551122395760685e-5,-3.6291732875808416e-8,0.0025735930611439093,3.113531128318894e-5,-3.5750349486020505e-8,0.0025741686669498156,3.080383281342957e-5,-3.5315932671875985e-8,0.002574818793527538,3.0622158898999846e-5,-3.5073179334983326e-8,0.002575459250901792,3.0606384083367444e-5,-3.5043561582390667e-8,0.0025760157713347175,3.072183306088944e-5,-3.518340880366333e-8,0.0025764462366678763,3.0902486165110045e-5,-3.5408643786040035e-8,0.0025767458975593516,3.107681621716422e-5,-3.562773879707096e-8,0.0025769394739584782,3.118739906047621e-5,-3.5766760816977004e-8,0.0025770682803444704,3.12001551469743e-5,-3.5781267605868635e-8,0.0025771782767451306,3.110525759781823e-5,-3.565767914468704e-8,0.0025773113662062915,3.091339865537416e-5,-3.540879179965687e-8,0.0025774999609862632,3.065026064735654e-5,-3.5066958787603745e-8,0.0025777640357551542,3.035060945700293e-5,-3.4676643389330934e-8,0.002578110043284982,3.0052507451921462e-5,-3.428694627394564e-8,0.002578531397055513,2.979192628154181e-5,-3.3944523195161236e-8,0.0025790103290381297,2.9598057935518227e-5,-3.368738209113566e-8,0.0025795209096909134,2.948965519446499e-5,-3.354007538112134e-8,0.002580032896739608,2.94727630782897e-5,-3.351077440578792e-8,0.0025805159234916397,2.954000878094914e-5,-3.3590389005577315e-8,0.002580943592558336,2.9671294779383406e-5,-3.375345201478358e-8,0.0025812972568394475,2.983567962877638e-5,-3.3960441519085414e-8,0.002581569412426488,2.9994385199715056e-5,-3.416148972868799e-8,0.002581766674986788,3.0105076417356167e-5,-3.430175679860849e-8,0.0025819120683374308,3.0127919994288804e-5,-3.4329229444587715e-8,0.002582045519993052,3.0034048227300084e-5,-3.420579656011638e-8,0.0025822203949664234,2.9816100977510195e-5,-3.392112802616561e-8,0.002582493526172687,2.9498181435378302e-5,-3.3505790908997055e-8,0.0025829078467866826,2.913934269067586e-5,-3.3035889417979293e-8,0.002583471922975573,2.8823154006253027e-5,-3.261957918279001e-8,0.0025841475821974037,2.8630944686295138e-5,-3.236241863773583e-8,0.0025848575009842015,2.860875020177161e-5,-3.23245690882075e-8,0.0025855132051104206,2.8747336224273945e-5,-3.249487409873808e-8,0.0025860483870083825,2.898840096044825e-5,-3.279872884323055e-8,0.0025864386289602428,2.925160284354101e-5,-3.31328354281292e-8,0.0025867003344974215,2.9464434140691195e-5,-3.340364643567008e-8,0.0025868758817611977,2.9580498213838604e-5,-3.355089908895895e-8,0.0025870163518221215,2.958356532888121e-5,-3.3552916689574256e-8,0.00258716874146591,2.948254760991543e-5,-3.342033057128494e-8,0.0025873690254704456,2.930331685653275e-5,-3.31857940505852e-8,0.0025876396104315717,2.908092911135896e-5,-3.289416461028243e-8,0.0025879892061104566,2.88534249664018e-5,-3.259456856612757e-8,0.0025884138089266786,2.8656989162023898e-5,-3.2334059412977954e-8,0.002588898359017111,2.8521979692271508e-5,-3.215231454490244e-8,0.002589419062272378,2.8469586189780088e-5,-3.2077164254932806e-8,0.002589946473323683,2.8509159090307877e-5,-3.212107523599057e-8,0.002590449393316276,2.8636563050092073e-5,-3.227904091415366e-8,0.002590899361197364,2.8834057391279875e-5,-3.2528461699677137e-8,0.00259127520629838,2.9071975778584452e-5,-3.2831291645010475e-8,0.0025915670649930126,2.9312176621478835e-5,-3.313838678718475e-8,0.0025917793326626975,2.951309804139549e-5,-3.33958896106978e-8,0.0025919320721802777,2.96361235160836e-5,-3.355336698452127e-8,0.002592060388232209,2.9652876016196784e-5,-3.357329612354791e-8,0.0025922110409532205,2.9552949250428954e-5,-3.344128213388367e-8,0.0025924352611730508,2.9350891816452204e-5,-3.3175402893513874e-8,0.0025927770732672843,2.908978789339379e-5,-3.2831114881942346e-8,0.0025932582302109035,2.8837351096213648e-5,-3.2496316807290324e-8,0.0025938644424488276,2.8670845449783314e-5,-3.2271752176790486e-8,0.00259454130569729,2.8651787572331885e-5,-3.223802204062918e-8,0.0025952073153012044,2.880006435961552e-5,-3.242178048536644e-8,0.0025957820237779284,2.9082752023308125e-5,-3.2781025144444316e-8,0.002596215451355888,2.942669394122801e-5,-3.3221292787055197e-8,0.0025965024447693404,2.9748129367640864e-5,-3.3634051131772567e-8,0.0025966765282158253,2.998185229157122e-5,-3.3934507817174133e-8,0.002596791242167228,3.009622528063916e-5,-3.408109516064842e-8,0.0025969011572768027,3.0092558261656323e-5,-3.4074756512656124e-8,0.002597049688176753,2.9995632087270322e-5,-3.3946851949197073e-8,0.0025972643186138377,2.9842572236855614e-5,-3.3744958806311066e-8,0.002597556681278304,2.9673938276303314e-5,-3.3521470462183287e-8,0.002597924726275709,2.9527819877394803e-5,-3.332595043754231e-8,0.0025983552864050196,2.9436122490796813e-5,-3.320019805897644e-8,0.002598826556628034,2.9421965307062316e-5,-3.3174709416024415e-8,0.0025993106853013,2.949756098639174e-5,-3.32658027069346e-8,0.002599776848353735,2.9662467082486734e-5,-3.347330412600232e-8,0.0026001951252648077,2.99025861685836e-5,-3.377926073172787e-8,0.0026005411717937273,3.019067108816419e-5,-3.414860105393843e-8,0.002600801115884702,3.048904747005782e-5,-3.453261736501532e-8,0.0026009756449572323,3.075479964565841e-5,-3.487558988314453e-8,0.0026010821201373643,3.094704699047445e-5,-3.512412559281178e-8,0.0026011537374556978,3.103526998712179e-5,-3.523794137373505e-8,0.0026012352359606815,3.100711111394474e-5,-3.52001023446636e-8,0.0026013752640351045,3.08739211784446e-5,-3.5024463414013454e-8,0.0026016160874248713,3.0672358090410115e-5,-3.475804093991398e-8,0.0026019820559800674,3.0460335902351476e-5,-3.447598865451195e-8,0.0026024694362678106,3.0306029731080202e-5,-3.4267389520307465e-8,0.0026030416290290835,3.0270338541856285e-5,-3.421233572704718e-8,0.0026036342474958208,3.0386657894908002e-5,-3.435533680675956e-8,0.0026041720030882468,3.064594194570206e-5,-3.4685549028801975e-8,0.0026045930310347977,3.09961293659131e-5,-3.513578419828963e-8,0.0026048698621258057,3.1359222083486464e-5,-3.560466452625087e-8,0.002605016277847952,3.165875436058266e-5,-3.5992435719287957e-8,0.0026050775582436726,3.1843809880593544e-5,-3.623231983185307e-8,0.0026051114117463955,3.1899280024474e-5,-3.630395313793583e-8,0.0026051700508598736,3.184180085895025e-5,-3.622821835659225e-8,0.0026052897100294578,3.1707923332180516e-5,-3.605202198717156e-8,0.0026054879335475844,3.154166996092474e-5,-3.5832271992857454e-8,0.0026057657097087847,3.138536625159791e-5,-3.5624031184444675e-8,0.0026061113393798714,3.1274330301516524e-5,-3.5473569113068227e-8,0.0026065041725679677,3.123426843754492e-5,-3.5414846395313414e-8,0.0026069176827509784,3.127995084377525e-5,-3.54676479866181e-8,0.0026073221793504135,3.141424395457776e-5,-3.563622226078849e-8,0.002607687760832499,3.162725534231478e-5,-3.590812143263662e-8,0.002607988052610515,3.189600175406857e-5,-3.6253749808592313e-8,0.0026082048747776295,3.218555030603266e-5,-3.662781876104157e-8,0.0026083332526672066,3.2452725750126513e-5,-3.697411627683993e-8,0.0026083853531278017,3.265297934002162e-5,-3.72343878712858e-8,0.0026083914259650088,3.2749867670578894e-5,-3.736065308576354e-8,0.002608396133617845,3.272507890931113e-5,-3.732831038939484e-8,0.0026084499787289036,3.258582024132688e-5,-3.714589715717855e-8,0.0026085974212649975,3.236651424287259e-5,-3.6857515677651e-8,0.0026088647679620098,3.2123260707560836e-5,-3.65358635683691e-8,0.002609251366434725,3.1921661831404596e-5,-3.6266559361749115e-8,0.0026097270315835943,3.182058662536569e-5,-3.612701970627575e-8,0.002610237284691165,3.185588171012813e-5,-3.6165054551592994e-8,0.002610716126815699,3.202876234196642e-5,-3.6383392719986345e-8,0.0026111037028992033,3.23033372673764e-5,-3.6736088564341154e-8,0.0026113636304113436,3.261570097552551e-5,-3.714014721843922e-8,0.002611493434829786,3.2892780986458314e-5,-3.750008482171149e-8,0.002611523495367077,3.307418573417459e-5,-3.7736560791061144E-08,0.002611505142783382,3.312826382278772e-5,-3.780750968567028e-8,0.002611493763715752,3.3056708359165294e-5,-3.771431792722278e-8,0.0026115341933477952,3.2888214172239555e-5,-3.749370515848177e-8,0.0026116528511147953,3.266635873779777e-5,-3.7202054725746606e-8,0.0026118568135878677,3.2437504850753895e-5,-3.6899719726700316e-8,0.0026121372770168093,3.22421675305727e-5,-3.663975855845446e-8,0.0026124744813415092,3.2110441667230555e-5,-3.646188211570326e-8,0.002612842227916604,3.206036322123708e-5,-3.639018811094762e-8,0.00261321139785924,3.2097696128144984e-5,-3.64327692480781e-8,0.00261355274464152,3.2216066114155835e-5,-3.658181139714531e-8,0.0026138396427348816,3.2397063044748426e-5,-3.681367790345908e-8,0.0026140514872013475,3.261067171343822e-5,-3.708942654441659e-8,0.0026141780311365196,3.2817050683532635e-5,-3.7357080590710184e-8,0.002614224114800926,3.297101014117252e-5,-3.7557436147006555e-8,0.002614213119889088,3.303013696291152e-5,-3.7634673802280204e-8,0.002614186549965068,3.296599359632987e-5,-3.755103806085695e-8,0.0026141973753741167,3.277534783937561e-5,-3.7301599143301795e-8,0.002614297046902401,3.248635183237581e-5,-3.69224435741917e-8,0.0026145197475576695,3.215508644569542e-5,-3.648630993783964e-8,0.002614870090159904,3.185171140863245e-5,-3.608467312200419e-8,0.0026153197674543857,3.164059402548646e-5,-3.5801927989370486e-8,0.0026158147703580206,3.156177686629293e-5,-3.569118447274441e-8,0.0026162903077401106,3.1620210993565046e-5,-3.5760006489734524e-8,0.0026166880991987354,3.1785560398102544e-5,-3.5969814749259693e-8,0.002616970841721617,3.200160523740788e-5,-3.624783231824479e-8,0.002617130261397801,3.220181753315225e-5,-3.65072435138508e-8,0.0026171871606737534,3.232655585316976e-5,-3.6669675925902054e-8,0.00261718397046602,3.233719347395405e-5,-3.6683842036219965e-8,0.0026171724016019787,3.222347506708292e-5,-3.6535405177033614e-8,0.0026172002283405987,3.200264024737339e-5,-3.624607593524087e-8,0.0026173011810684,3.171173130676567e-5,-3.586373455846947e-8,0.0026174902392406083,3.139662825485608e-5,-3.544818102047367e-8,0.0026177642440258567,3.110164755113335e-5,-3.5057518398642445e-8,0.0026181060091383474,3.086218416322592e-5,-3.4738433135395185e-8,0.0026184896650506663,3.070099873181416e-5,-3.452121062024481e-8,0.0026188855768160607,3.062736487635263e-5,-3.441851050195791e-8,0.0026192641644238587,3.063776642104189e-5,-3.44262138034998e-8,0.0026195987827379364,3.071705603650061e-5,-3.452490184616867e-8,0.0026198682621240295,3.083960982102611e-5,-3.4681327174304134e-8,0.0026200597799300902,3.0970713580179304e-5,-3.485016751422272e-8,0.0026201724252346513,3.106906901777973e-5,-3.497724556731821e-8,0.002620221032692184,3.1091763777759243e-5,-3.500601824118333e-8,0.0026202386178564006,3.10028288611161e-5,-3.4888839501679675e-8,0.0026202745150329704,3.0784947027866455e-5,-3.4602410900141006e-8,0.0026203852922867623,3.0450819216758257e-5,-3.416279062923851e-8,0.002620618265425924,3.0047622079189514e-5,-3.363132109745287e-8,0.002620992870319827,2.9648323815135033e-5,-3.31033303947174e-8,0.0026214894619416536,2.932979763141325e-5,-3.267956343422445e-8,0.0026220531242507274,2.9146566799369495e-5,-3.2431878766493014e-8,0.002622611657445149,2.9112958080091928e-5,-3.237984681690709e-8,0.0026230987533740094,2.9201352737337322e-5,-3.248826516711856e-8,0.0026234720422993033,2.935474709537481e-5,-3.268331002587069e-8,0.002623720696604966,2.950580934218716e-5,-3.28772184813543e-8,0.002623863141320352,2.9594733190630928e-5,-3.2991532941629956e-8,0.002623938403472255,2.9581523567624585e-5,-3.2973239176112444e-8,0.0026239948751797743,2.945153944445875e-5,-3.280223748832211e-8,0.002624079352158989,2.9214975075539966e-5,-3.249095709508292e-8,0.0026242282334253994,2.8901697565596798e-5,-3.207786296841002e-8,0.0026244620668671175,2.855315053807396e-5,-3.161700102240202e-8,0.0026247839524003213,2.821331655109691e-5,-3.116615430893701e-8,0.0026251814438661785,2.7920728883389294e-5,-3.077624804492969e-8,0.002625630821426735,2.770290261143587e-5,-3.048387523980967e-8,0.0026261023194173497,2.7573621615054672e-5,-3.030759911853844e-8,0.0026265650867071107,2.753272069170523e-5,-3.024760371638935e-8,0.0026269911754542366,2.7567495629662442e-5,-3.0287542037181364e-8,0.0026273585031503107,2.7654808956776647e-5,-3.0397305793839284e-8,0.0026276531846827346,2.776337289842733e-5,-3.0535989704684127e-8,0.0026278717322375995,2.785627661607388e-5,-3.0655133830369624e-8,0.0026280234298139303,2.7894361322732897e-5,-3.0703083939648824e-8,0.0026281325803872136,2.7841478039741167e-5,-3.063189326845691e-8,0.0026282392000712505,2.7672557297109677e-5,-3.040802070948686e-8,0.0026283955437060506,2.7384085700415085e-5,-3.002625965469175e-8,0.00262865565196701,2.700371371201096e-5,-2.9522515841626875e-8,0.002629057605315128,2.6592301817640855e-5,-2.897657699704715e-8,0.0026296042239974493,2.623136467768682e-5,-2.8495630917078668e-8,0.0026302538309996223,2.599585843503772e-5,-2.8178505464655922e-8,0.002630930614107705,2.5924188462011436e-5,-2.807623809106079e-8,0.0026315519205043305,2.6002942441934412e-5,-2.8171931342658712e-8,0.002632057542513618,2.6175113742488016e-5,-2.8391396121084223e-8,0.0026324258329257447,2.6364726212698507e-5,-2.8635308308118833e-8,0.002632672462723894,2.6502714775448774e-5,-2.881304110057633e-8,0.0026328380412312087,2.6543357889184606e-5,-2.8864178132588297e-8,0.0026329731241864014,2.6469411774491017e-5,-2.8765333495100423e-8,0.0026331258609140727,2.6289281768524357e-5,-2.852665947748336e-8,0.0026333338989213834,2.6030282261764095e-5,-2.8183285436663457e-8,0.002633620171689503,2.573080090149753e-5,-2.7785262712895203e-8,0.002633991642655656,2.5432731091922993e-5,-2.7387706234444074e-8,0.0026344403222787766,2.517473880061446e-5,-2.7041855038120544e-8,0.002634946113457011,2.498684705051351e-5,-2.6787753182580472e-8,0.0026354809501950237,2.4886802821856877e-5,-2.6649271729928865e-8,0.0026360135612485953,2.487845151655501e-5,-2.66318567861711e-8,0.0026365141657436557,2.4952076373098923e-5,-2.672296922722169e-8,0.002636958487571637,2.508635806998142e-5,-2.6894714182866534e-8,0.002637330770592852,2.5251345857424093e-5,-2.7107782135658014e-8,0.0026376258574601534,2.541191401004594e-5,-2.731596108184508e-8,0.002637850566159729,2.5531539580490765e-5,-2.747102088376633e-8,0.002638024527826738,2.557660264320669e-5,-2.7528304916922454e-8,0.0026381802741849004,2.552172015255805e-5,-2.7453780860784707e-8,0.0026383615500640014,2.535654692073106e-5,-2.7233147342018143e-8,0.0026386179885873363,2.5093413410281484e-5,-2.6882116638732477e-8,0.002638994289794082,2.4773009859853065e-5,-2.6454097522886618e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_19.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_19.json deleted file mode 100644 index 55ee759e..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_19.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":19000,"numberOfSamples":1000,"samples":[0.00263951402096563,2.446275040491078e-5,-2.6038117688221015e-8,0.0026401631724560673,2.4241976200195275e-5,-2.5739261712150362e-8,0.002640884349598046,2.417407411008679e-5,-2.5641764129475454e-8,0.0026415912918163185,2.4277459627606698e-5,-2.577057311285661e-8,0.0026422007751247287,2.4514250198517228e-5,-2.6076268743377622e-8,0.002642664329828072,2.4806135401016956e-5,-2.6455914313675208e-8,0.002642981408758501,2.5067420523334124e-5,-2.6796599674782414e-8,0.0026431902581784475,2.523476738670862e-5,-2.701462116287926e-8,0.0026433473077564114,2.5280434293348607e-5,-2.707291191164421e-8,0.0026435080278592402,2.5209814035850336e-5,-2.6977864625794997e-8,0.0026437153058168224,2.5051197769627946e-5,-2.6766036632474325e-8,0.002643995008250455,2.4844553414124373e-5,-2.6489610125027892e-8,0.002644356096346505,2.4632482174508258e-5,-2.6204648569688263e-8,0.002644792866933108,2.4453878979516923e-5,-2.5962750928942762e-8,0.002645287958825506,2.433962413644026e-5,-2.580522022561437e-8,0.0026458157625529125,2.4309628109960647e-5,-2.5758941317575327e-8,0.00264634623063722,2.4371028134717308e-5,-2.5833817493889664e-8,0.0026468490048528843,2.4517626043978552e-5,-2.6021955503015233e-8,0.002647297629221693,2.473075415894809e-5,-2.629884122598041e-8,0.002647673419069512,2.498168300232041e-5,-2.6626587976528904e-8,0.0026479684516871804,2.5235364563765828e-5,-2.6958906132239313e-8,0.0026481873145099825,2.54550480044092e-5,-2.724714977923732e-8,0.0026483474854581976,2.5607329200806667e-5,-2.744689859121178e-8,0.002648478321749667,2.5667306663201197e-5,-2.7524725198145248e-8,0.002648618565417001,2.562364143904652e-5,-2.746495256788262e-8,0.002648811933829168,2.548331398325493e-5,-2.7276137128600436e-8,0.002649099993304903,2.5275225022656478e-5,-2.6996080239347117e-8,0.0026495118344468096,2.5050470037239995e-5,-2.6692385337925312e-8,0.0026500516782408433,2.4875937156110125e-5,-2.6454031394300517e-8,0.0026506887377273874,2.481830242231187e-5,-2.637005584696817e-8,0.0026513571570154788,2.4919878684211346e-5,-2.649732055333089e-8,0.0026519727576500727,2.5176293414199947e-5,-2.6830682803784936e-8,0.00265246347865712,2.553137242424813e-5,-2.7296067819030845e-8,0.0026527977885291948,2.5897092428559638e-5,-2.777691417282513e-8,0.0026529937872264786,2.6188736914085377e-5,-2.8160834927125474e-8,0.0026531053400488365,2.6354405340763377e-5,-2.8378742435525895e-8,0.002653197143730883,2.6384803835271885e-5,-2.8417798104530085e-8,0.0026533237489522734,2.630496073324375e-5,-2.8310488620170042e-8,0.002653519415667135,2.61584941720321e-5,-2.8113966146280626e-8,0.0026537972075638358,2.5993391727317396e-5,-2.7891437296909137e-8,0.0026541528220946162,2.5852711656499893e-5,-2.7699980495729533e-8,0.002654569583467504,2.576980469437125e-5,-2.758418502662082e-8,0.002655022888269817,2.5766321279371505e-5,-2.7573341150534074e-8,0.0026554838903719694,2.5851487346184455e-5,-2.7680269328933923e-8,0.0026559228543872925,2.6021962722230312e-5,-2.7900982114737346e-8,0.0026563125592436493,2.6262270927647677e-5,-2.8215210320601784e-8,0.0026566318822620954,2.6546159408893735e-5,-2.8588246183577963e-8,0.0026568693325829773,2.683937297731775e-5,-2.8974675169938895e-8,0.00265702588046726,2.7104047119859548e-5,-2.9324209301872344e-8,0.0026571162804157502,2.730439944298196e-5,-2.9589182861804454e-8,0.002657168287578267,2.741298625135473e-5,-2.973278593466467e-8,0.002657219506910407,2.7416528074622072e-5,-2.9736788701860016e-8,0.002657312004454739,2.7320200846281446e-5,-2.9607346163960382e-8,0.0026574851280428084,2.714945498836805e-5,-2.9377627673142143e-8,0.0026577671410715864,2.6948550466389847e-5,-2.9106116594645743e-8,0.0026581666337407396,2.677480114515534e-5,-2.8869130261933987e-8,0.002658665644369953,2.668759153112913e-5,-2.874622335182529e-8,0.0026592177642860556,2.673249924766369e-5,-2.8798893801029236e-8,0.0026597551845333914,2.6923863313585407e-5,-2.9047096880029876e-8,0.0026602066278280773,2.7233239467283458e-5,-2.945360447347533e-8,0.0026605218701161496,2.759279450344971e-5,-2.992839322576825e-8,0.002660691339317348,2.791687831695263e-5,-3.0357403494703774e-8,0.0026607489650131524,2.813307297178182e-5,-3.064397603742436e-8,0.002660756316410744,2.820629128228656e-5,-3.0740975280116455e-8,0.00266077813131762,2.814444053347429e-5,-3.0658329382785926e-8,0.0026608626181401033,2.7987094517445165e-5,-3.044802835863527e-8,0.002661033282093157,2.7787369099427664e-5,-3.018018911351549e-8,0.002661290670229049,2.759646253123286e-5,-2.992268275086257e-8,0.002661618847227499,2.745466279524221e-5,-2.9729256636510297e-8,0.002661992324996788,2.7388048564438633e-5,-2.9635075082451442e-8,0.0026623814914065623,2.740846380825369e-5,-2.9656508743774662e-8,0.0026627564064791672,2.751469021981976e-5,-2.9792508338229933e-8,0.002663089657287003,2.769378081550649e-5,-3.002626101217006e-8,0.0026633589993581537,2.7922422231694105e-5,-3.032697532756177e-8,0.0026635502049094915,2.816877186333765e-5,-3.065235507227498e-8,0.002663660058606214,2.8395509491539593e-5,-3.095269273591784e-8,0.0026636988226479592,2.8564683516255168e-5,-3.1177317725720975e-8,0.0026636910185861354,2.8644267020628355e-5,-3.128328931824663e-8,0.002663673368164203,2.8615444636392442e-5,-3.124507257083623e-8,0.0026636892999802016,2.847882357726595e-5,-3.106284172552677e-8,0.0026637804953454328,2.8257367087954442e-5,-3.076651119240239e-8,0.0026639771539304236,2.7994347029093748e-5,-3.041320967031577e-8,0.002664289390944928,2.7745919962196963e-5,-3.0077603120369135e-8,0.0026647021583839263,2.7569343911087362e-5,-2.983632036881539e-8,0.002665175574611234,2.7508966541401323e-5,-2.9749234062979572e-8,0.002665651753105894,2.758308150002246e-5,-2.9841711448467954e-8,0.0026660679387967637,2.777557445101302e-5,-3.009314804079612e-8,0.002666373652606828,2.8036422130212083e-5,-3.043735504000154e-8,0.0026665467921051737,2.8293485634668975e-5,-3.0778184924067085e-8,0.002666601852555459,2.8473726055012245e-5,-3.1017907545195027e-8,0.0026665852853927806,2.8526301970881325e-5,-3.1088172804032435e-8,0.002666559122253182,2.843738526897907e-5,-3.0969895282801916e-8,0.0026665805053176046,2.823043592843639e-5,-3.069370740064932e-8,0.0026666863526158286,2.795380188020402e-5,-3.032352927191644e-8,0.002666888030781808,2.7663438827002143e-5,-2.993366290807507e-8,0.0026671748130789254,2.7408493516036183e-5,-2.958966680282094e-8,0.0026675216046985984,2.722333376093842e-5,-2.933771824724552e-8,0.0026678967932506742,2.7125467417972392e-5,-2.920171724683057e-8,0.002668268174343812,2.7116928055334394e-5,-2.918496557666993e-8,0.0026686067536675503,2.718687142750966e-5,-2.9273488870256556e-8,0.002668889153521843,2.7314125916714938e-5,-2.9439367095546293e-8,0.0026690995240611494,2.7469415229723713e-5,-2.9643692403226327e-8,0.002669231588881734,2.761768401200625e-5,-2.983969287822529e-8,0.0026692909045567758,2.772137604439484e-5,-2.9977123836592665e-8,0.002669296689582548,2.7745483589062654e-5,-3.0009007656812204e-8,0.0026692818814056923,2.76645400450632e-5,-2.9900964988722216e-8,0.002669289786419154,2.7470487600255673e-5,-2.9641735210395685e-8,0.0026693663135547675,2.7178855682651955e-5,-2.9251483856010147e-8,0.002669548600717101,2.6829814064937723e-5,-2.8783321052296953e-8,0.002669853232704221,2.6481571864986507e-5,-2.8314646721668814e-8,0.0026702686612265127,2.6196540227162797e-5,-2.792883344868289e-8,0.0026707555410017745,2.6024208042934442e-5,-2.769243626155642e-8,0.0026712556999075863,2.5986573478360687e-5,-2.7635653186376986e-8,0.002671707089748267,2.6071129511972674e-5,-2.7742712797765785e-8,0.0026720600901569886,2.6233603318288687e-5,-2.795522462078366e-8,0.002672290443135009,2.640954156364561e-5,-2.818742186699068e-8,0.0026724052428170825,2.653145786869803e-5,-2.8349002218997386e-8,0.002672440220313686,2.6546752821712073e-5,-2.8369163632258638e-8,0.0026724489957256573,2.6431102842522592e-5,-2.8214673922745004e-8,0.002672487698917711,2.6193125149463324e-5,-2.789629736013679e-8,0.0026726001820109838,2.586916578069951e-5,-2.746199942230688e-8,0.002672808644915501,2.551090053887501e-5,-2.6980507296689357e-8,0.0026731118372536797,2.5170934360175597e-5,-2.6522128760281473e-8,0.0026734896589889912,2.4891330726868854e-5,-2.6143393330707435e-8,0.0026739109227287,2.4697549447807037e-5,-2.5878832880513e-8,0.0026743410670043246,2.4597486622909633e-5,-2.5739543146492245e-8,0.002674747998989801,2.458373190904632e-5,-2.5716071958711425e-8,0.0026751057440529678,2.463704675194214e-5,-2.57830039780471e-8,0.0026753964831346907,2.47297865751725e-5,-2.5903529531835557e-8,0.00267561183646005,2.4828867315808e-5,-2.6033429491443315e-8,0.0026757540793394046,2.489859900654912e-5,-2.6124877326598502e-8,0.00267583747024861,2.4904174485618595e-5,-2.6131104709850983e-8,0.0026758891320712635,2.4816671777239062e-5,-2.6013096260213478e-8,0.0026759481268225807,2.4619877273035702e-5,-2.5748745104085175e-8,0.002676060878740094,2.4317891637757816e-5,-2.534308690420903e-8,0.002676271641860672,2.3940547910458253e-5,-2.4835628594163594e-8,0.0026766089922976954,2.3542240639262514e-5,-2.429887410844018e-8,0.002677072911743146,2.3190810939116947e-5,-2.3823549830955104e-8,0.002677629384711697,2.2947801471423495e-5,-2.349226195279842e-8,0.0026782174373540597,2.284747447523584e-5,-2.3351420427147178e-8,0.002678767190753552,2.2884450527373708e-5,-2.3394574904936935e-8,0.002679221246387928,2.3015772470718473e-5,-2.3564955982734086e-8,0.0026795504594499405,2.31755695605357e-5,-2.3774871289120044e-8,0.002679759170591716,2.3295137206169125e-5,-2.393243272963582e-8,0.0026798803135628544,2.3320917185443094e-5,-2.3965602905995443e-8,0.0026799640145154023,2.322577558520088e-5,-2.3837397612610006e-8,0.0026800639314745046,2.3012215146842673e-5,-2.3550384713622862E-08,0.0026802248899573116,2.2708392050599457e-5,-2.3141585163499967e-8,0.0026804742934984,2.235906805897442e-5,-2.2670554977751216e-8,0.0026808185968568944,2.2014267511493717e-5,-2.220428842578894e-8,0.0026812448336239396,2.171854636264718e-5,-2.180280461715125e-8,0.0026817259374465234,2.150323880680172e-5,-2.1508611094251824e-8,0.00268222781652349,2.1382809836528223e-5,-2.1341628366433782e-8,0.0026827161726339327,2.1355034347562173e-5,-2.1299284836488415e-8,0.0026831617535715744,2.140378470911418e-5,-2.1360196730420277e-8,0.0026835436457758872,2.1502965966267144e-5,-2.1489465414133864e-8,0.0026838509543692596,2.16204854567272e-5,-2.1644050147128995e-8,0.002684083542702058,2.1721810919128004e-5,-2.1777567204648777e-8,0.0026842524063363047,2.1773296218550722e-5,-2.184473901283113e-8,0.0026843798793523676,2.174584592951199e-5,-2.1806283785570994e-8,0.002684499254751002,2.1619604754520625e-5,-2.1635208600026604e-8,0.002684652615539522,2.1389936125771377e-5,-2.132488556836351e-8,0.0026848851553524585,2.1073684595338914e-5,-2.0897551736655894e-8,0.002685234761333537,2.071276203290809e-5,-2.040922349572789e-8,0.0026857179492677428,2.0370460882582813e-5,-1.9944823185549678e-8,0.002686317392056504,2.0116807827503108e-5,-1.9598553255649772e-8,0.002686979523907763,2.0004912349695077e-5,-1.9442129284992614e-8,0.0026876280837219843,2.0048512671163523e-5,-1.949455243073783e-8,0.0026881899249303247,2.0214024293583018e-5,-1.9711294931862544e-8,0.002688620249435145,2.043285656095454e-5,-2.000069039920413e-8,0.002688914623014258,2.0626936406510176e-5,-2.0258093448061607e-8,0.002689104448499188,2.073370425998305e-5,-2.0399378529749706e-8,0.0026892419298627126,2.0720641518941455e-5,-2.038044359813892e-8,0.00268938312888527,2.0587598019377475e-5,-2.0200427284762034e-8,0.002689574768650333,2.0360579482662567e-5,-1.989355990805515e-8,0.0026898465947728313,2.0081670543145843e-5,-1.9515867700560127e-8,0.0026902088053080623,1.9798500950558975e-5,-1.913120086648592e-8,0.002690653320029833,1.9555086732382298e-5,-1.8798959747669437e-8,0.0026911577108349486,1.9384918317815483e-5,-1.856468027518342e-8,0.0026916907283687213,1.9306783846534458e-5,-1.8454204375709315e-8,0.0026922183440946422,1.932346249716126e-5,-1.8471725008849565e-8,0.0026927093194704355,1.9422959535281348e-5,-1.8601349303398246e-8,0.002693139577075912,1.9581620030571056e-5,-1.8811304655394267e-8,0.0026934949979082095,1.9768275469618075e-5,-1.905959980051295e-8,0.0026937727037630865,1.9948579211282313e-5,-1.9299928293298172e-8,0.002693981227014739,2.008903816565814e-5,-1.9487102008012012e-8,0.0026941399761876384,2.0160743594175506e-5,-1.958202828436642e-8,0.002694278150304583,2.014308771745926e-5,-1.9556669135148625e-8,0.002694432839134833,2.0027814972522264e-5,-1.939951202924289e-8,0.0026946454407021474,1.9823465164879817e-5,-1.912164795226923e-8,0.002694955118743798,1.9559228013221924e-5,-1.876210188452582e-8,0.0026953885604227568,1.9285588555638527e-5,-1.8388822887488567e-8,0.002695947389646158,1.906784792733087e-5,-1.8090003030037158e-8,0.002696598361371597,1.8969529356223275e-5,-1.7951673808881418e-8,0.0026972747172651123,1.9028183067974308e-5,-1.8024976958726027e-8,0.002697894448259002,1.923482567582152e-5,-1.82982964892157e-8,0.0026983903263144058,1.953167385178543e-5,-1.8694084270395405e-8,0.0026987355972708806,1.9833273175935162e-5,-1.9097304148343785e-8,0.002698950451980689,2.005962260427181e-5,-1.9400090848296767e-8,0.0026990880859063043,2.016241265792062e-5,-1.9537100067242948e-8,0.0026992117922432905,2.013345355569334e-5,-1.949684506615443e-8,0.002699375647089422,1.999759245364751e-5,-1.9312213181089278e-8,0.002699614261285006,1.9798830819145078e-5,-1.9041939056218857e-8,0.0026999406340535597,1.9586801508834097e-5,-1.8752604336031518e-8,0.0027003488738597202,1.9406767550178475e-5,-1.850529554434705e-8,0.002700818970481651,1.9293437948365567e-5,-1.8347238284879605e-8,0.0027013220497049467,1.9267719508964687e-5,-1.8307237617048195e-8,0.002701825549465035,1.9335593552310834e-5,-1.839393020569358e-8,0.0027022980757690288,1.9488723621636194e-5,-1.8596431789749385e-8,0.002702713662607276,1.970654001153539e-5,-1.8887103092774177e-8,0.002703055157533248,1.9959543955443707e-5,-1.9226073522447195e-8,0.002703316448267429,2.0213520540267606e-5,-1.9567030088327615e-8,0.0027035033133196956,2.0434152409261692e-5,-1.986350378693203e-8,0.0027036329373279133,2.059147843487134e-5,-2.0074871352699753e-8,0.002703732317100221,2.0663912104588616e-5,-2.017172044859481e-8,0.002703835708462897,2.064176391337209e-5,-2.0140576017720335e-8,0.002703981045779454,2.0530222225002636e-5,-1.9987983238696774e-8,0.002704204955540068,2.0351562676141675e-5,-1.9743638549377247e-8,0.0027045358067139627,2.014570325430151e-5,-1.9461313750205066e-8,0.002704984805772576,1.996714707688034e-5,-1.92148397591981e-8,0.0027055368649279493,1.987574577050617e-5,-1.9085611169575944e-8,0.002706145685078051,1.9919963553539275e-5,-1.913981275734757e-8,0.0027067395839023285,2.0115935619329194e-5,-1.9399872245807953e-8,0.002707241964949466,2.0432627984345386e-5,-1.9824189275903496e-8,0.002707600561978769,2.079591363745013e-5,-2.031258854203578e-8,0.0027078094546453073,2.1114943868623784e-5,-2.0742078873478338e-8,0.0027079095029694275,2.1317626509160715e-5,-2.101494646065448e-8,0.002707967740739984,2.1374638784031844e-5,-2.1091231796414332e-8,0.0027080501916891273,2.1301291919555723e-5,-2.0991196408044287e-8,0.002708202805321296,2.1142645928582355e-5,-2.0775234408464792e-8,0.0027084452776870867,2.0954316120813476E-05,-2.0518098346501502e-8,0.002708774162575712,2.078764131629634e-5,-2.028905117718749e-8,0.002709169810830763,2.0681479161499233e-5,-2.014086685744763e-8,0.0027096034430987557,2.065925821172407e-5,-2.0105765910602988e-8,0.0027100428652535534,2.0729021182110605e-5,-2.0195268624788187e-8,0.0027104568599029244,2.088478077558925e-5,-2.0401806622108805e-8,0.0027108187654351296,2.1108546115977512e-5,-2.0701327617105837e-8,0.002711109496587725,2.1372986326076458e-5,-2.10568899223502e-8,0.002711319970232938,2.1644827851250796e-5,-2.142334211249965e-8,0.002711452708090201,2.1889050652350722e-5,-2.1753098561200446e-8,0.002711522206080725,2.207368852602839e-5,-2.2002679141313222e-8,0.002711553726110139,2.2174663760722812e-5,-2.2139227350930035e-8,0.0027115804817427185,2.2179989492678676E-05,-2.214615199321869e-8,0.0027116394229722046,2.2092790600064617e-5,-2.2027220749220564e-8,0.002711765902353902,2.1932661136871404e-5,-2.1808497541801675e-8,0.0027119875265561675,2.17349102139576e-5,-2.153749682666738e-8,0.0027123175594141167,2.154714321577371e-5,-2.1278725972971384e-8,0.002712748677090166,2.1422310197924048e-5,-2.1104340382649643e-8,0.0027132489457220156,2.1407462817094904e-5,-2.107881988743877e-8,0.002713763222707799,2.1528939153101463e-5,-2.12386510801654e-8,0.002714223539826301,2.17779711508261e-5,-2.1572526893751845e-8,0.0027145692235508168,2.210462782438041e-5,-2.201294395593925e-8,0.0027147705289971287,2.242831272043591e-5,-2.245045363896241e-8,0.002714842961370987,2.26651374401677e-5,-2.2770961975807826e-8,0.0027148417371246187,2.2759728481484883e-5,-2.2899019449501894e-8,0.0027148384646546696,2.270361220246182e-5,-2.2822761360270927e-8,0.002714894133814566,2.253147752919397e-5,-2.2588785865962968e-8,0.002715042481976411,2.230178058034443e-5,-2.227589996373742e-8,0.0027152877602880654,2.2075146022270574e-5,-2.196600255000497e-8,0.0027156119658795414,2.189977200438472e-5,-2.1724460810982776e-8,0.0027159847379479274,2.180547085498409e-5,-2.1592064109398672e-8,0.0027163717326484887,2.18037059038195e-5,-2.158495102003217e-8,0.0027167402462662167,2.189035707386248e-5,-2.169814943921391e-8,0.0027170626329077376,2.204902136902486e-5,-2.1909862774099005e-8,0.002717318577686348,2.225407880034124e-5,-2.2185536220454567e-8,0.002717496917322223,2.247368848952755e-5,-2.2481941172479003e-8,0.0027175971570509785,2.2673148098990517e-5,-2.2751819980273843e-8,0.002717630437619656,2.2818986025088118e-5,-2.2949521472554347e-8,0.002717619374232879,2.2883830547347417e-5,-2.3037639752791775e-8,0.0027175960863589687,2.2851508344780233e-5,-2.29939131948583e-8,0.002717598071460584,2.27213176952526e-5,-2.281699857396905e-8,0.0027176621709201596,2.2510260056520727e-5,-2.2529529271382513e-8,0.0027178174751903974,2.22521853070832e-5,-2.2177067543554316e-8,0.0027180784671276526,2.1993333213934358e-5,-2.1822217623532972e-8,0.0027184398641318065,2.178448760758116e-5,-2.153411268172913e-8,0.0027188745594770346,2.1670561409178468e-5,-2.137429317301222e-8,0.0027193360025531545,2.1679009178246315e-5,-2.1380826619141587e-8,0.002719766138446254,2.1809462677510583e-5,-2.1553961002315126e-8,0.00272010902935972,2.2028302823201387e-5,-2.184847600516649e-8,0.0027203278821346134,2.2272524858974438e-5,-2.2178797892063562e-8,0.0027204196799707763,2.24654419229855e-5,-2.2440404566424472e-8,0.002720419476537429,2.2541182151501676e-5,-2.2543308403420168e-8,0.002720389514355453,2.246792006086709e-5,-2.2443785172222848e-8,0.0027203968580779593,2.2257868624423312e-5,-2.2157995797522724e-8,0.0027204907531003454,2.1959156500183422e-5,-2.17509487518943e-8,0.0027206903780250197,2.1635680043467534e-5,-2.1309184877300774e-8,0.0027209858546815508,2.1346417556349277e-5,-2.0912787442917073e-8,0.002721347808163526,2.1132433058736414e-5,-2.06177932502233e-8,0.002721738732659261,2.101302770424033e-5,-2.045091160605777e-8,0.002722121842089695,2.0988064107378192e-5,-2.0412526919188236e-8,0.0027224663072612032,2.104272221321373e-5,-2.0482980964473065e-8,0.0027227497312666536,2.1152219247249398e-5,-2.0628864697851955e-8,0.0027229592187699085,2.1285646420264224e-5,-2.0808205423364215e-8,0.002723092024279769,2.140915534170127e-5,-2.0974851448080727e-8,0.002723156140984944,2.14891410191427e-5,-2.108288393508341e-8,0.002723170606461795,2.149605797679514e-5,-2.1091870780846034e-8,0.0027231647986974373,2.140913982897247e-5,-2.0973305086363463e-8,0.002723175747615389,2.122154123906254e-5,-2.0717585989345948e-8,0.0027232427667478894,2.094452464224403e-5,-2.0339705819586754e-8,0.0027233996145755853,2.0608713479640643e-5,-1.9880992713257535e-8,0.002723665721382843,2.026060892275378e-5,-1.9404470170278227e-8,0.0027240391567136266,1.9953854594028393e-5,-1.898310231028625e-8,0.002724494146855511,1.9736789731948312e-5,-1.8682948875842208e-8,0.002724984781134481,1.9639562245665583e-5,-1.8545605329381536e-8,0.002725454640230336,1.9664591180140306e-5,-1.8575060281540082e-8,0.0027258502841296267,1.978346436416098e-5,-1.8733227690675876e-8,0.0027261353236396123,1.9941877016394326e-5,-1.894645849238284e-8,0.002726301248658682,2.007230249813052e-5,-1.912271463933041e-8,0.0027263713289722514,2.011187104949174e-5,-1.9175991154117115e-8,0.002726395138448426,2.002057957804487e-5,-1.905127428909273e-8,0.002726434196991114,1.9793401183908815e-5,-1.8741182852925098e-8,0.0027265433420372793,1.946100805656228e-5,-1.828705235095383e-8,0.0027267551469351914,1.9078518607560066e-5,-1.7763682989189432e-8,0.002727073366580046,1.870747687105405e-5,-1.7254861286109985e-8,0.0027274765293817524,1.8398952985918913e-5,-1.683037011094019e-8,0.002727927993060576,1.818353027833995e-5,-1.6532295654523488e-8,0.0027283871266923043,1.8069347217504134e-5,-1.637222675764901e-8,0.0027288178204516824,1.804577514014172e-5,-1.633611041703065e-8,0.0027291931918580247,1.8089300870504294e-5,-1.6392157254153952e-8,0.0027294972768002954,1.816913014448269e-5,-1.649844892067187e-8,0.0027297251046408027,1.8251552466542002e-5,-1.660892918346911e-8,0.0027298822811575333,1.830324285422369e-5,-1.6677976929709144e-8,0.0027299846109979653,1.8294199006395545e-5,-1.6664471571957215e-8,0.0027300576392803658,1.8201084382144078e-5,-1.6536379482566312e-8,0.002730135367558795,1.801142871411346e-5,-1.6276481194654895e-8,0.0027302569950561194,1.772835840690819e-5,-1.5888815400112085e-8,0.002730460675000141,1.7374367034465673e-5,-1.540383280991605e-8,0.002730774317388617,1.6991538671805468e-5,-1.487874681986958e-8,0.002731205492992096,1.663554986253649e-5,-1.4389430286252634e-8,0.0027317346225685167,1.6362736100393333e-5,-1.401285392592605e-8,0.0027323159732417688,1.6213321694122396e-5,-1.3804237823242727e-8,0.0027328882043883593,1.6197272773221976e-5,-1.377768292956184e-8,0.002733391477933123,1.628923403372551e-5,-1.3899104903846669e-8,0.0027337846859482747,1.6435087027299024e-5,-1.4095004537599963e-8,0.002734056500043612,1.656745755001094e-5,-1.4273511480543449e-8,0.0027342271115420556,1.6624323330041047e-5,-1.4349761230979106e-8,0.002734341218625606,1.6564849873113524e-5,-1.4267579057934553e-8,0.0027344551943848145,1.6378505391622318e-5,-1.4012046808109738e-8,0.002734622289801755,1.608581588143182e-5,-1.3610682506044439e-8,0.0027348797656559553,1.5731229116967588e-5,-1.312384293400565e-8,0.0027352411979116873,1.5370487927067927e-5,-1.262758861964929e-8,0.0027356956705479342,1.5056407177672457e-5,-1.2194285616455754e-8,0.002736213318040265,1.4827270079832405e-5,-1.1876677483532097e-8,0.0027367546090290257,1.4700733657187753e-5,-1.169940036745348e-8,0.002737279962922846,1.4673731384326293e-5,-1.16586767454608e-8,0.0027377570640155654,1.4726736350655366e-5,-1.1728029197099415e-8,0.0027381648557289963,1.482989457646782e-5,-1.1866648191392354e-8,0.0027384946423735903,1.4948942426058718e-5,-1.2027544616739114e-8,0.002738749434445084,1.504985821963847e-5,-1.216399804528127e-8,0.0027389426406392242,1.5102225647928979e-5,-1.2234218749741384e-8,0.0027390967313658887,1.508190848938774e-5,-1.2205022203274869e-8,0.0027392418828776502,1.497377683520103e-5,-1.2055543818857391e-8,0.0027394140032673863,1.4774979914795335e-5,-1.1781703210623261e-8,0.0027396510558396095,1.449859754939216e-5,-1.1401214646296961e-8,0.0027399865631337478,1.4176337452192784e-5,-1.0957324233453986e-8,0.0027404401157403325,1.3857589419184968e-5,-1.0517579850249122e-8,0.002741006988407936,1.3601649709835046e-5,-1.016324470539438e-8,0.002741651946643131,1.3461932237357087e-5,-9.967701894510386e-9,0.0027423134297618586,1.3466164991872435e-5,-9.969292325791265e-9,0.0027429204127412043,1.3602045380436758e-5,-1.0151559338201335e-8,0.0027434161980657615,1.381781057785335e-5,-1.0443902181835858e-8,0.0027437775903663983,1.403930043979941e-5,-1.0744867582233018e-8,0.00274402026056172,1.4195086586668818e-5,-1.0956551973741348e-8,0.002744189707180539,1.4237647948831023e-5,-1.101361813162918e-8,0.0027443444308235623,1.4153214739371446e-5,-1.0896808965594635e-8,0.0027445391212823013,1.3960083614703103e-5,-1.063071839494125e-8,0.0027448126229584063,1.369940353501182e-5,-1.0271311517205686e-8,0.0027451820491002014,1.342296064314159e-5,-9.889353385649206e-9,0.0027456424369939375,1.3181296837245952e-5,-9.554228595057486e-9,0.0027461706266553357,1.301415215625418e-5,-9.320814951324564e-9,0.0027467319065318033,1.2944348784452829e-5,-9.220945708603037e-9,0.0027472878430236675,1.297566686114043e-5,-9.26028974478475e-9,0.0027478036209455806,1.3094521161716708e-5,-9.420488426281658e-9,0.0027482535395967965,1.3274409109423844e-5,-9.665206228210173e-9,0.002748624017387072,1.3481665911821765e-5,-9.94808846615289e-9,0.002748914201993835,1.3681151040180056e-5,-1.0220678594459335e-8,0.002749134840466332,1.3840922486020028e-5,-1.0438925666362003e-8,0.0027493062755827883,1.3935617636275572e-5,-1.0567851392877573e-8,0.0027494561978375956,1.3948871850020234e-5,-1.0584841736813426e-8,0.002749617298368145,1.3875330877006017e-5,-1.0482372438320108e-8,0.002749824478571436,1.3722661790345272e-5,-1.0270772986168708e-8,0.002750110830763187,1.3513482353169196e-5,-9.98093410823438e-9,0.00275050148863685,1.3286167853943228e-5,-9.665504146217214e-9,0.0027510052007713166,1.3092282740735443e-5,-9.395433012835077e-9,0.0027516054627253683,1.2987797311630384e-5,-9.247916863310523e-9,0.0027522560077975567,1.3016795714357577e-5,-9.283940992366734e-9,0.002752887270832192,1.3191513005764179e-5,-9.520705716744854e-9,0.0027534268750110877,1.3479307947422266e-5,-9.913575792228905e-9,0.002753827252818105,1.380820104122874e-5,-1.0363635022831688e-8,0.002754085066367869,1.4092408000508905e-5,-1.0752843979321471e-8,0.002754240423604777,1.4264671631161601e-5,-1.0988570669126968e-8,0.0027543577158397454,1.4297504261183262e-5,-1.1032801675695634e-8,0.0027545010082918016,1.4205075789953122e-5,-1.0904699986993847e-8,0.0027547161998007054,1.4030591799180186e-5,-1.0663283329901377e-8,0.0027550240194078655,1.3829185117178249e-5,-1.0384043206256625e-8,0.002755421453020712,1.3653474454465471e-5,-1.0139258403077382e-8,0.0027558875196220835,1.3544259564344984e-5,-9.985280220478687e-9,0.0027563903321073395,1.3525955479519786e-5,-9.956181654857124e-9,0.0027568938904163395,1.3605460183974092e-5,-1.0062009063794016e-8,0.002757364073561223,1.3773418082126131e-5,-1.029030898978133e-8,0.0027577735523741467,1.4007312606634619e-5,-1.0610254942756665e-8,0.002758105281049702,1.4275878871466236e-5,-1.0978721485269755e-8,0.0027583543129910426,1.4544196144378514e-5,-1.1347397176404875e-8,0.002758527884760369,1.4778781498711986e-5,-1.1669921998794136e-8,0.0027586439565762334,1.495202207329257e-5,-1.1908062139585563e-8,0.0027587286752269713,1.5045486741457556e-5,-1.2036263263573345e-8,0.002758813283168323,1.5052079543374385e-5,-1.2044567346228864e-8,0.0027589307562035483,1.497726783006875e-5,-1.1940277717807085e-8,0.0027591121400170103,1.4839587044545021e-5,-1.1748696271030066e-8,0.002759382258301141,1.4670374331164395e-5,-1.1512860934478634e-8,0.0027597543590631487,1.4512060743916354e-5,-1.1291303651724086e-8,0.002760223851724849,1.4413504572653444e-5,-1.1151667518328181e-8,0.002760762772812467,1.4420577561528979e-5,-1.1157671499436408e-8,0.002761318710750578,1.4561512390203414e-5,-1.1348746558323507e-8,0.00276182335825203,1.483046758444795e-5,-1.171717072812087e-8,0.002762213232767044,1.5178600777388183e-5,-1.2195628938203373e-8,0.0027624561618459875,1.5523579998102924e-5,-1.2670370954457433e-8,0.002762568055471419,1.577896645887847e-5,-1.3021911778698365e-8,0.002762607053442844,1.588892345218556e-5,-1.3173036202525945e-8,0.0027626477535367317,1.5847494556313896e-5,-1.3115353264673006e-8,0.002762752148698717,1.5693341116187472e-5,-1.290193227055894e-8,0.002762952717258098,1.5488291251018845e-5,-1.2617722370350503e-8,0.0027632510418019677,1.5294686690858635e-5,-1.2348462136331391e-8,0.0027636259344087917,1.5160707656321381e-5,-1.2160612203495138e-8,0.002764043924793039,1.511465428428553e-5,-1.2093523880228672e-8,0.002764468105360931,1.5165219435121325e-5,-1.2159711904489318e-8,0.0027648642771565795,1.5304554776486206e-5,-1.2348881160795975e-8,0.00276520491193756,1.551214917612753e-5,-1.2633083740317827e-8,0.0027654717421526196,1.5758859205074683e-5,-1.2972187445271782e-8,0.0027656573615933593,1.601108180866163e-5,-1.331966747011974e-8,0.0027657658412326984,1.623508143758839e-5,-1.3628693916074076e-8,0.0027658122315612965,1.6401336192405455e-5,-1.385824500072823e-8,0.0027658208032614435,1.64885423505343e-5,-1.397868551819702e-8,0.0027658220656359834,1.6486733828388484e-5,-1.397605157394892e-8,0.002765848891824904,1.639909794692674e-5,-1.3854513826157042e-8,0.0027659321674139512,1.6242317878778517e-5,-1.3636849548780435e-8,0.002766096303503263,1.6045369593808686e-5,-1.3362857387789591e-8,0.0027663548615603564,1.5846730676314847e-5,-1.308562701077851e-8,0.0027667064826740096,1.5689835021215877e-5,-1.2865361853446855e-8,0.002767131628491153,1.5616253392744474e-5,-1.2759959238257351e-8,0.002767591541465577,1.565613932350352e-5,-1.2811680422273687e-8,0.0027680318643640033,1.581672526418174e-5,-1.3031031172521404e-8,0.0027683935757452003,1.607229328191158e-5,-1.3382687188492964e-8,0.0027686315906423767,1.6362317419807093e-5,-1.3782849249591848e-8,0.0027687352106116232,1.660487394222258e-5,-1.4117902190796029e-8,0.002768738239820442,1.6725105080637398e-5,-1.4283993588661351e-8,0.0027687087079556953,1.6685822510540136e-5,-1.422947633870195e-8,0.0027687213527381837,1.650176304721841e-5,-1.3974559220475729e-8,0.0027688289978741332,1.622925799770131e-5,-1.3596908755438644e-8,0.002769048363398059,1.594031700512789e-5,-1.3195832869032236e-8,0.00276936337344147,1.569769408859385e-5,-1.2857958409166736e-8,0.002769738192543268,1.5541237964123733e-5,-1.2638499739393606e-8,0.002770130857577132,1.5485700596560033e-5,-1.2558236264973412e-8,0.0027705028435936804,1.5525121557837643e-5,-1.2609441752677153e-8,0.002770824104016123,1.5639139817898094e-5,-1.2764417778794309e-8,0.0027710750382562957,1.579871667179225e-5,-1.298325399628226e-8,0.002771246995946245,1.5970684935818387e-5,-1.322007185623983e-8,0.0027713422068845884,1.6121524757386047e-5,-1.3428307331702114e-8,0.0027713733059165882,1.622087961293736e-5,-1.3565689517813172e-8,0.0027713622519797507,1.6245092710609566e-5,-1.3599228831309594e-8,0.002771338258376431,1.6180665568763176e-5,-1.3510033682923686e-8,0.0027713344138243505,1.6027070557930125e-5,-1.3297175460530656e-8,0.0027713830768532144,1.579813080854103e-5,-1.2979564370243544e-8,0.0027715105782646693,1.5521323628688927e-5,-1.2595002061998987e-8,0.002771732045267941,1.5234636665673235e-5,-1.2195915802458485e-8,0.002772047301432447,1.4981007805899022e-5,-1.1841777298032802e-8,0.002772438752589332,1.4800880562158318e-5,-1.1588867502371844e-8,0.0027728720133379584,1.4723695349422957e-5,-1.1478455258934069e-8,0.0027733000270757664,1.475936384689405e-5,-1.1524829287417343e-8,0.0027736714038943994,1.4891518683271445e-5,-1.1705728640433002e-8,0.002773942949580787,1.5075513691583893e-5,-1.1959405556781578e-8,0.002774094298536084,1.5244784160866828e-5,-1.2193420369479077e-8,0.00277413935771806,1.5327642621168224e-5,-1.2308056164262575e-8,0.002774127095241945,1.5271382737278492e-5,-1.222991079233378e-8,0.002774127125267959,1.5063483024427677e-5,-1.1941373736095969e-8,0.002774204509579759,1.4737530909312808e-5,-1.1488800019336111e-8,0.0027743965548067697,1.43593324733346e-5,-1.0963210259393599e-8,0.0027747034985702353,1.4001351538615448e-5,-1.0464911437262635e-8,0.0027750951364715324,1.3719672259939094e-5,-1.007167416389651e-8,0.002775526051367617,1.3542754928601997e-5,-9.823200461899074e-9,0.0027759503581378433,1.3472044653032601e-5,-9.721903248961207e-9,0.0027763311030684443,1.3489110782461308e-5,-9.742655844025204e-9,0.0027766441055164853,1.356402503429683e-5,-9.84425800476849e-9,0.002776878237542247,1.3662175145885656e-5,-9.978801364369811e-9,0.00277703421910064,1.3749001999510627e-5,-1.0098250340897997e-8,0.002777123145672282,1.3793304300500613e-5,-1.0159108468992627e-8,0.002777165069365021,1.3769948799978488e-5,-1.012627712891473e-8,0.002777187380425079,1.366257139239754e-5,-9.976865115490197e-9,0.002777222427192686,1.3466379006569386e-5,-9.704079704233e-9,0.002777303795784524,1.3190508945819256e-5,-9.32046418862628e-9,0.0027774610887294536,1.285887005615791e-5,-8.859037531642524e-9,0.00277771379236086,1.250829794191475e-5,-8.370757335750319e-9,0.0027780656045215007,1.2183280121571277e-5,-7.917278908180143e-9,0.00277850108054271,1.1927476784055753e-5,-7.559280656595044e-9,0.002778986285044394,1.1773582658743977e-5,-7.3424319327927995e-9,0.0027794741941447932,1.1734065609188585e-5,-7.284473669250357e-9,0.0027799142794985264,1.1795451333347614e-5,-7.367127372081157e-9,0.00278026452821218,1.1918270864807826e-5,-7.535846169209884e-9,0.0027805032458643373,1.204384768123753e-5,-7.709138116829781e-9,0.0027806373209791524,1.2107676158375936e-5,-7.797171506191644e-9,0.002780703452468078,1.2057033090757864e-5,-7.726358310931846e-9,0.002780759925646668,1.186787561236933e-5,-7.46295792291357e-9,0.002780869728653987,1.155427127221588e-5,-7.026249491461181e-9,0.002781080498337681,1.1164946271353642e-5,-6.483757041896363e-9,0.002781409786732128,1.0767143875816982e-5,-5.928845847483083e-9,0.0027818421004138097,1.04248448157659e-5,-5.450501229246064e-9,0.0027823377629871307,1.0181105245430409e-5,-5.10879819574084e-9,0.002782847735319512,1.0050699713777196e-5,-4.924616944992279e-9,0.002783327243787241,1.0022856728953502e-5,-4.883325460734916e-9,0.0027837440651562097,1.0069594711575953e-5,-4.94624874966697e-9,0.0027840812269027786,1.015483206039899e-5,-5.063271670053514e-9,0.0027843360787357524,1.024152532104462e-5,-5.1827770304128115e-9,0.002784517883012557,1.0296305457586499e-5,-5.258162067166841e-9,0.0027846452783812006,1.0292292461840592e-5,-5.251838399917288e-9,0.002784744078074569,1.0211053940810853e-5,-5.138017383006263e-9,0.0027848451722726508,1.004447040455388e-5,-4.905319130341186e-9,0.002784981869337182,9.796760182050914e-6,-4.559563393831464e-9,0.0027851859388087303,9.486172936094592e-6,-4.1260871182282976e-9,0.0027854820195520776,9.145128566965864e-6,-3.649923337373014e-9,0.0027858809685050146,8.817212839408479e-6,-3.1916519447886542e-9,0.002786374004344479,8.549858663854469e-6,-2.8172810988601715e-9,0.002786930516713693,8.38311526590999e-6,-2.5826759770245543e-9,0.0027875021251903167,8.337323332657525e-6,-2.5164033042951878e-9,0.002788033442730153,8.404341144331321e-6,-2.6074358965324996e-9,0.0027884768663511967,8.546587963184419e-6,-2.8036922561923524e-9,0.002788806444515096,8.705359435428541e-6,-3.023511191011914e-9,0.002789025898946628,8.816155454370437e-6,-3.1769693624562517e-9,0.00278916808580964,8.826174280013064e-6,-3.1902919454504053e-9,0.0027892861494492062,8.708654066453408e-6,-3.0259083522581603e-9,0.002789439024007953,8.46996585135858e-6,-2.6924102085292982e-9,0.0027896754169786063,8.14743898998842e-6,-2.2415918566646356e-9,0.002790020989298804,7.798481749683577e-6,-1.7533598997337004e-9,0.0027904727105389194,7.484380983397801e-6,-1.3132102122914294e-9,0.0027910019465777094,7.254182931369871e-6,-9.89761674395551e-10,0.0027915644996498075,7.133899378245067e-6,-8.196308089392246e-10,0.002792113334641582,7.123723332179867e-6,-8.034153427098901e-10,0.0027926094573086616,7.202432983697204e-6,-9.117101623954198e-10,0.002793028233302452,7.335726174669705e-6,-1.0966748720526548e-9,0.0027933609484635524,7.4849003149403414e-6,-1.3041707157630382e-9,0.002793613109513304,7.61360949860106e-6,-1.4832721372423023e-9,0.002793801331699417,7.692125726622039e-6,-1.5923023708007069e-9,0.0027939501157332436,7.699650544928369e-6,-1.602113739190793e-9,0.0027940890449749374,7.62559574208575e-6,-1.4978805430814948e-9,0.0027942502546082484,7.47061613566804e-6,-1.2805101597583769e-9,0.002794465545354246,7.247708832349798e-6,-9.681400023267961e-10,0.0027947623730721393,6.982972729165114e-6,-5.97180208495864e-10,0.002795158293619206,6.714815163187818e-6,-2.2122179168722028e-10,0.0027956544044971682,6.489842552957791e-6,9.465788350054435e-11,0.0027962298905296608,6.353985618709735e-6,2.862426270105938e-10,0.0027968413003591638,6.339329590931643e-6,3.085594249353236e-10,0.002797430023565606,6.450574770211097e-6,1.5483829055035215e-10,0.0027979381407812233,6.657939065789282e-6,-1.33481326751483e-10,0.0027983274370340884,6.9023050870562255e-6,-4.73865860969561e-10,0.0027985929487883057,7.112534229482264e-6,-7.668664513252449e-10,0.0027987644712778367,7.227889781129287e-6,-9.274873085756629e-10,0.002798895846497114,7.215922522318092e-6,-9.102130577481535e-10,0.0027990476214502418,7.07954168609196e-6,-7.189055791823305e-10,0.002799270159329704,6.8528184660678055e-6,-4.0097058487487015e-10,0.0027995921098042825,6.589150394962895e-6,-3.089155205840986e-11,0.0028000160559371254,6.346543838175632e-6,3.10246237176008e-10,0.0028005208861621384,6.174077528739478e-6,5.536306075559972e-10,0.002801069138807742,6.102332622183427e-6,6.561508599671992e-10,0.002801616887775129,6.139228531226112e-6,6.063570042587458e-10,0.0028021235424224794,6.271340195284573e-6,4.227738196672006e-10,0.0028025593261495505,6.469448209654452e-6,1.462323628969768e-10,0.002802909202716053,6.696171451931554e-6,-1.7081556781815749e-10,0.0028031732715659992,6.913472533175175e-6,-4.748902722777455e-10,0.002803364595060627,7.088522312131387e-6,-7.198047146353163e-10,0.002803505761944061,7.197381055746142e-6,-8.718919784335805e-10,0.002803625279954858,7.226791581760613e-6,-9.125259098952547e-10,0.0028037543398572442,7.1748236665111314e-6,-8.389867042693141e-10,0.0028039239008144736,7.051055423278122e-6,-6.646711695244907e-10,0.0028041616337651505,6.8765748079719594e-6,-4.190817695600791e-10,0.0028044880974484863,6.6835013555270844e-6,-1.471822583423747e-10,0.0028049117634366405,6.5130028002482435e-6,9.333211200818222e-11,0.002805423407949294,6.410183518830969e-6,2.391581525590211e-10,0.0028059919682429956,6.414458134729057e-6,2.348761811647254e-10,0.0028065656354558507,6.545964496883274e-6,5.204916047160679e-11,0.0028070820322286597,6.792467980851788e-6,-2.923256812302114e-10,0.0028074875111325586,7.1049452709561795e-6,-7.295484999982558e-10,0.002807758398439204,7.408801568743201e-6,-1.1549479735996095e-9,0.002807912309953183,7.629016879277494e-6,-1.4632184010996237e-9,0.0028080018600268285,7.717209899264664e-6,-1.5864308892715257e-9,0.00280809416469148,7.666574793887121e-6,-1.5149558263742769e-9,0.0028082476851966315,7.509156810078956e-6,-1.293585924107478e-9,0.0028084967768828226,7.30058864751775e-6,-1.0001414868267381e-9,0.002808847262739549,7.101610708252468e-6,-7.196587372359342e-10,0.0028092805508106752,6.9632211202788204e-6,-5.236849754708002e-10,0.0028097620700029556,6.9179843415002716e-6,-4.5813084509820613e-10,0.0028102506436204987,6.977109497128568e-6,-5.3909443895529e-10,0.002810706875116468,7.1318269763759485e-6,-7.546337294862254e-10,0.002811099653827845,7.357649721019065e-6,-1.0705937383009498e-9,0.0028114103186717213,7.620360090645017e-6,-1.4389400470211245e-9,0.0028116342841793644,7.882562522965005e-6,-1.8069960493090511e-9,0.002811780336556491,8.109700436176797e-6,-2.1259981185286337e-9,0.0028118681577567702,8.274759500587497e-6,-2.3578054290919355e-9,0.002811924804212133,8.361260065829955e-6,-2.479149299892737e-9,0.002811980892546883,8.36454527445245e-6,-2.4834224476780367e-9,0.0028120670235339054,8.291786877210306e-6,-2.380638941437992e-9,0.002812210545938763,8.161235186498023e-6,-2.196355734372293e-9,0.0028124324269317093,8.000947582996757e-6,-1.9699141477060387e-9,0.0028127438794841287,7.846806856187975e-6,-1.7517213264542863e-9,0.002813142552806622,7.739137129470781e-6,-1.5985536553676695e-9,0.002813608808015108,7.716755992795095e-6,-1.5652027889490953e-9,0.002814103934259319,7.807540942446503e-6,-1.6911479779159391e-9,0.0028145735374341036,8.016337002635303e-6,-1.9834359406417603e-9,0.0028149593679730016,8.31455967856922e-6,-2.4019489267911616e-9,0.0028152192752681693,8.639495206008205e-6,-2.858393347499628e-9,0.002815347491924279,8.910155826623826e-6,-3.238690313459153e-9,0.0028153820992645705,9.056877288906372e-6,-3.444739279219633e-9,0.0028153917225959865,9.049565373279847e-6,-3.434183721829044e-9,0.0028154478006963196,8.907688181128402e-6,-3.234368005566589e-9,0.0028155987912163055,8.687766600877536e-6,-2.924641731063571e-9,0.002815858796138938,8.458997654451106e-6,-2.6021037702235526e-9,0.0028162112125574854,8.281283974367032e-6,-2.3508457347741356e-9,0.002816620244870729,8.193045999255578e-6,-2.2249439851131193e-9,0.002817043196425516,8.208464494140208e-6,-2.2446042949535775e-9,0.0028174399451113383,8.320583317078408e-6,-2.4004250119473305e-9,0.0028177788955663485,8.506869283546043e-6,-2.661052702041974e-9,0.0028180401266746525,8.735196722855205e-6,-2.9814634943747566e-9,0.002818216618208338,8.969546300902432e-6,-3.3109360361838935e-9,0.0028183139820533165,9.175233421802618e-6,-3.600466281728827e-9,0.0028183488727125663,9.323413400084446e-6,-3.809217986798757e-9,0.0028183463049050498,9.39458305470024e-6,-3.90954465122841e-9,0.0028183361606477814,9.380837778898787e-6,-3.890194719106599e-9,0.002818349263122649,9.286671155840795e-6,-3.757406772881838e-9,0.002818413492033781,9.128333531433483e-6,-3.53396419516556e-9,0.0028185502773691137,8.932029054209705e-6,-3.2566550844126667e-9,0.0028187715560268277,8.731181934898563e-6,-2.972477812164968e-9,0.0028190771735186674,8.562773878565448e-6,-2.7335615331514525e-9,0.002819452811212173,8.462515809163019e-6,-2.5904087552382515e-9,0.0028198689659859892,8.458399189389392e-6,-2.5827732791303527e-9,0.0028202823760493027,8.562461789260582e-6,-2.7279409911836136e-9,0.0028206420530898016,8.76203294867925e-6,-3.0082465413739715e-9,0.0028209016970371353,9.01428419331315e-6,-3.3633026041725225e-9,0.0028210372630595158,9.250300643214355e-6,-3.695772409602383e-9,0.0028210625026776777,9.393515552182452e-6,-3.897503770163006e-9,0.0028210309762700552,9.388841811821506e-6,-3.890735771174717e-9,0.0028210180397079793,9.227581680220804e-6,-3.6632088806019304e-9,0.002821090430482207,8.951597895319539e-6,-3.273910330543877e-9,0.002821281364602508,8.633748034245999e-6,-2.8253997402826636e-9,0.0028215841712364,8.34816387734706e-6,-2.4219756103304343e-9,0.0028219629940235817,8.147536600047868e-6,-2.1378075495426764e-9,0.0028223698510740254,8.054819543764938e-6,-2.0053439921519466e-9,0.002822758897752516,8.06627654451556e-6,-2.0195926662397562e-9,0.0028230947143213737,8.159510301354147e-6,-2.149322407764077e-9,0.0028233554406812823,8.301852148391436e-6,-2.348744115947894e-9,0.00282353282593384,8.45708600749022e-6,-2.5668892800147934e-9,0.002823630975521782,8.590367413029983e-6,-2.754534233626674e-9,0.002823664602469181,8.671985233133684e-6,-2.869577271902303e-9,0.0028236568220320374,8.680413957217215e-6,-2.881448031847007e-9,0.002823636368151626,8.604700974308771e-6,-2.77454826352887e-9,0.00282363417253053,8.446003171394267e-6,-2.55042869198829e-9,0.0028236793809163405,8.217892940976991e-6,-2.2281801649158934e-9,0.0028237951897224314,7.945063459574405e-6,-1.8425677017566835e-9,0.0028239951055245996,7.660380146708828e-6,-1.4398777251617586e-9,0.0028242801645024245,7.40050743300998e-6,-1.0718072754261351e-9,0.0028246375107151937,7.200455492493439e-6,-7.878393942073073e-10,0.002825040666646605,7.087470503711195e-6,-6.266431600801484e-10,0.002825451877475943,7.074723084324243e-6,-6.071044899922806e-10,0.00282582713879414,7.155466286875476e-6,-7.199525343266866e-10,0.0028261246005233435,7.299190176080726e-6,-9.222045847808211e-10,0.00282631625064073,7.452589468357933e-6,-1.138486076576167e-9,0.002826400528199012,7.5487591099507736e-6,-1.2740885116638722e-9,0.002826410104662908,7.52604944408374e-6,-1.2417419852670848e-9,0.0028264072933222306,7.3519489307029926e-6,-9.95445629992879e-10,0.002826464019776748,7.0400481913062265e-6,-5.543990372405558e-10,0.0028266339859106117,6.6478080126638315e-6,2.5428477574195166e-13,0.002826932486316038,6.254009951919073e-6,5.573195548555597e-10,0.002827334926475173,5.928910433440534e-6,1.017639188279871e-9,0.0028277917797869642,5.7135131054699254E-06,1.3232757200131534e-9,0.002828248468891538,5.614983691413445e-6,1.4639603114758254e-9,0.0028286601533812237,5.614073569452187e-6,1.4666632447107474e-9,0.0028289983913868215,5.676607424183315e-6,1.379463686399024e-9,0.002829251626940915,5.763552361016194e-6,1.257411163440545e-9,0.0028294226533315623,5.8378051497912814e-6,1.1529709034080448e-9,0.002829525391442807,5.868127420486881e-6,1.1104318965864509e-9,0.002829581983388046,5.831461400637911e-6,1.162556397104102e-9,0.0028296201636700017,5.714584370675174e-6,1.3281613329217984e-9,0.0028296704970861516,5.515438234757098e-6,1.610201352537694e-9,0.0028297631021037386,5.243980536622576e-6,1.9945855887171813e-9,0.0028299236827314406,4.922012339098648e-6,2.4504737826893106e-9,0.0028301691569658544,4.581263003820374e-6,2.933023335426697e-9,0.0028305037217332307,4.259296600010102e-6,3.3891673170969797e-9,0.002830916459461489,3.993408191619676e-6,3.766190530193445e-9,0.0028313814792820546,3.8133369601973606e-6,4.021977064794002e-9,0.0028318611572783646,3.7341893056990802e-6,4.135010647324168e-9,0.0028323123871055148,3.7511839643312496e-6,4.1118687449955575e-9,0.002832695135207755,3.837639289960757e-6,3.990171251095755e-9,0.0028329821184355144,3.947374265896908e-6,3.835263147375323e-9,0.0028331678013638183,4.02244680576321e-6,3.7292680413861366e-9,0.002833273994081028,4.0063226672806816e-6,3.752376733977591e-9,0.0028333486086335536,3.8605677828823e-6,3.959124752584863e-9,0.0028334548656437477,3.5800588386143807e-6,4.356815088093346e-9,0.0028336519146150165,3.199196575199989e-6,4.896744085319297e-9,0.002833973775156948,2.7832242943678695e-6,5.486528461109836e-9,0.002834417043797699,2.4062456980927005e-6,6.021220646396547e-9,0.002834944056387233,2.1262318186002894e-6,6.418661302859258e-9,0.0028354988875670265,1.969203084860813e-6,6.641874660667108e-9,0.0028360266300474844,1.927913656213458e-6,6.70098348403756e-9,0.0028364871221820765,1.971420933258333e-6,6.639725869469694e-9,0.0028368601012207684,2.0580493155069e-6,6.517137481949485e-9,0.002837143798391918,2.146084523307919e-6,6.392404569592256e-9,0.0028373505649315713,2.200262702481213e-6,6.315634711039505e-9,0.0028375022225614853,2.194747581939334e-6,6.323580516384682e-9,0.002837626278744532,2.1141632193792574e-6,6.438118184879123e-9,0.002837752983195648,1.9539503821470446e-6,6.665710573780227e-9,0.002837912672316925,1.720635357079953e-6,6.997035491702147e-9,0.0028381327625960472,1.4319563558805509e-6,7.406851308263388e-9,0.0028384339774149996,1.1162175023410766e-6,7.85496469067567e-9,0.0028388259645027686,8.098741102245192e-7,8.289678744088075e-9,0.0028393032769971362,5.525056854996284e-7,8.654901931555912e-9,0.002839843390194472,3.791424868007549e-7,8.900980702450035e-9,0.0028404085467517684,3.1124743347196077e-7,8.997452128487504e-9,0.002840952357445899,3.4901622113740223e-7,8.943973785765355e-9,0.002841430295633725,4.68119085106208e-7,8.775000509935415e-9,0.0028418113735728568,6.229385663401742e-7,8.555251582211405e-9,0.0028420874546643236,7.562180083845292e-7,8.366042862071104e-9,0.002842277186103206,8.12928826496597e-7,8.28557717186452e-9,0.0028424229792514757,7.548341939316745e-7,8.368220742089385e-9,0.0028425812098529235,5.718152359385369e-7,8.628388634888865e-9,0.002842807562695609,2.864119988032696e-7,9.034090564959052e-9,0.0028431411958904427,-5.075784686922267e-8,9.513435790152513e-9,0.002843592795816794,-3.745954342178899e-7,9.973922781259542e-9,0.00284414136383234,-6.243541079214667e-7,1.0329162879331443e-8,0.0028447415293055118,-7.608178796241404e-7,1.0523290713005752e-8,0.0028453383289325533,-7.7516339165713e-7,1.0543619193061516e-8,0.0028458829874018483,-6.870431643594794e-7,1.0418002465363624e-8,0.002846343745861855,-5.347045473568402e-7,1.0200845400060194e-8,0.002846709393672464,-3.626758819940621e-7,9.955588339874181e-9,0.0028469868913886353,-2.1168976993434465e-7,9.740321417669294e-9,0.0028471961486281772,-1.1277953739782726e-7,9.5993194186896e-9,0.002847364587199702,-8.507667609072321e-8,9.559858106078426e-9,0.0028475227795878447,-1.357926730672906e-7,9.63217247842041e-9,0.0028477012760148397,-2.6098770439544055e-7,9.810568108142715e-9,0.0028479280799226956,-4.4634904759132186e-7,1.0074568307647262e-8,0.002848226026012085,-6.678989044547163e-7,1.038996413878128e-8,0.002848609485491815,-8.932110104100397e-7,1.0710570698878495e-8,0.0028490803883028048,-1.08421348997412e-6,1.0982211998329638e-8,0.0028496244808374053,-1.2027066912850638e-6,1.1150545368581883e-8,0.0028502098087099434,-1.2189535497820264e-6,1.117325646547346e-8,0.0028507899812964224,-1.1218694346857707e-6,1.1034558640475975e-8,0.0028513137786630493,-9.269848437980516e-7,1.0756559639854864e-8,0.0028517396184371633,-6.772541783626091e-7,1.040045521595228e-8,0.002852049745857075,-4.3383629160081065e-7,1.0053410747715433e-8,0.002852257667938162,-2.588555502582333e-7,9.80397507841194e-9,0.0028524050176591494,-1.966808876808624e-7,9.715373390453078e-9,0.002852549088431962,-2.610733914805113e-7,9.807193562515353e-9,0.002852746181827145,-4.3236107396414083e-7,1.0051389365553414e-8,0.002853036583500799,-6.643300296990387e-7,1.0382115635541902e-8,0.0028534351813685878,-8.975086395893872e-7,1.0714629219647167e-8,0.002853929365115319,-1.0745790729053187e-6,1.096719853065988e-8,0.0028544839144717562,-1.1539281212368752e-6,1.1080391616891132e-8,0.002855051068247713,-1.1181731669905117e-6,1.1029268499031812e-8,0.002855582768565016,-9.75875355579879e-7,1.0825912624788529e-8,0.0028560415652221956,-7.566392276976092e-7,1.051252610395587e-8,0.0028564073406055135,-5.018534207721013e-7,1.0148247915315251e-8,0.002856678785926064,-2.5444286344771827e-7,9.794490668368394e-9,0.002856870524742683,-5.058886026101649e-8,9.503046426891806e-9,0.002857007914873242,8.512852095070961e-8,9.30908662963937e-9,0.0028571215454132087,1.412895044493818e-7,9.22891211852966e-9,0.002857242681589101,1.1896856287060092e-7,9.260923881079643e-9,0.0028573999738171854,3.009713316077348e-8,9.38800232202608e-9,0.0028576170512156747,-1.0428600410014353e-7,9.580041432918065e-9,0.002857910332403342,-2.5568229132032263e-7,9.796312889070212e-9,0.002858286478980994,-3.900984786692505e-7,9.988259642955946e-9,0.002858739364701392,-4.712582429285285e-7,1.0104059717794627e-8,0.00285924729195101,-4.661759280679692e-7,1.0096572400747676e-8,0.002859772355326098,-3.5361998523694726e-7,9.935435750221926e-9,0.0028602647405304277,-1.3415193562808552e-7,9.621442048735044e-9,0.0028606740590430527,1.6248167838119398e-7,9.197139078236257e-9,0.0028609662384943444,4.78853899398024e-7,8.74468806781909e-9,0.002861139063409164,7.44255750862787e-7,8.365236229068475e-9,0.0028612269346888057,8.984655386532225e-7,8.144871394043985e-9,0.002861290126468282,9.137233591571715e-7,8.123196247026203e-9,0.0028613933351704225,8.035260371148903e-7,8.280824203979028e-9,0.002861584483698411,6.150660520729815e-7,8.55027050948895e-9,0.0028618827041504077,4.113854839993796e-7,8.841474477305177e-9,0.0028622775767180642,2.524378755512151e-7,9.068802254899132e-9,0.0028627363987564036,1.8135003911035153e-7,9.17060221962431e-9,0.0028632149243848224,2.1781405590917407e-7,9.118624569170666e-9,0.002863668101326738,3.577669060595684e-7,8.918529212376947e-9,0.0028640588395250108,5.775725882547501e-7,8.603998240368662e-9,0.002864363874395403,8.409557603452859e-7,8.226895323903023e-9,0.002864576317683268,1.1070964706719793e-6,7.845700967819764e-9,0.0028647049562361203,1.3383042800297684e-6,7.514484405755572e-9,0.0028647709664122996,1.505912805444349e-6,7.274393180785887e-9,0.0028648031644739605,1.5936658590036488e-6,7.148753085068565e-9,0.0028648329825001757,1.5985844872876452e-6,7.141820831205116e-9,0.0028648901078107145,1.5298597346848266e-6,7.240401923975936e-9,0.0028649992237887115,1.40662889791498e-6,7.417073022953166e-9,0.002865177723667968,1.255395999935133e-6,7.63388684017037e-9,0.002865433962330402,1.1074017364182093e-6,7.84611558047985e-9,0.0028657656359532793,9.9575507730559e-7,8.006322067477023e-9,0.002866158158739561,9.517297115380463e-7,8.069644697438206e-9,0.0028665835690910722,9.99411061201828e-7,8.001485323787432e-9,0.0028670015032235038,1.1483302317519537e-6,7.788115041184415e-9,0.002867364559705957,1.3852827350377053e-6,7.448455109494122e-9,0.0028676299233594852,1.6691386030128764e-6,7.041536345565719e-9,0.0028677759678411305,1.9347439744128324e-6,6.660862146080923e-9,0.0028678167309223023,2.1103546939003207e-6,6.409323306547407e-9,0.0028678034788689843,2.144698261273195e-6,6.3603400593137696e-9,0.0028678078376921227,2.029720577821034e-6,6.525302617003996e-9,0.0028678938191672595,1.8044434865642015e-6,6.8481776203151215e-9,0.002868094666236441,1.5376263800915127e-6,7.230454856236507e-9,0.002868405913933894,1.3009574329347206e-6,7.569539411050057e-9,0.0028687938676968555,1.1474463535309566e-6,7.789602788927635e-9,0.002869210861589051,1.1019524188615657e-6,7.855057338570128e-9,0.002869609334325944,1.1622461307956396e-6,7.769013139741857e-9,0.002869951231852881,1.3057241037395412e-6,7.563711223382599e-9,0.002870212677215331,1.4976923875705954e-6,7.288744102079043e-9,0.002870385194690064,1.699062535904297e-6,7.000097817318875e-9,0.002870474725317542,1.8727935944983242e-6,6.75093165594071e-9,0.002870499135165648,1.988954290042755e-6,6.584275013804583e-9,0.00287048464138741,2.0282382639665136e-6,6.527917653518532e-9,0.0028704616140799583,1.9837809533528225e-6,6.5917562221991524E-09,0.0028704602549171655,1.8612665906276216e-6,6.767640226165102e-9,0.002870506668811975,1.6774673462495774e-6,7.031500508441279e-9,0.0028706197689758587,1.457604560662817e-6,7.34716419913411e-9,0.0028708091655566463,1.2320673332684813e-6,7.671058717135242e-9,0.0028710739127016565,1.0328358362055718e-6,7.957305852913069e-9,0.0028714019528153388,8.896734068155328e-7,8.163146833604354e-9,0.0028717702214416355,8.259448522978371e-7,8.254940922690583e-9,0.0028721457505871515,8.537612288983449e-7,8.215181934479207e-9,0.0028724887943640687,9.684630238408015e-7,8.050494120702066e-9,0.0028727594429303256,1.1436800035455436e-6,7.798780069504199e-9,0.0028729285817180555,1.3300651297795598e-6,7.531028042365649e-9,0.0028729915695690435,1.462263368762386e-6,7.341218977444032e-9,0.002872978448805743,1.4772429274966988e-6,7.3198920236120235e-9,0.002872951252863827,1.339998687991839e-6,7.517195289934864e-9,0.0028729836176172785,1.0630678713911078e-6,7.914951705548082e-9,0.0028731308183241877,7.051695488262558e-7,8.42876029911416e-9,0.0028734078884947605,3.473260311513201e-7,8.942348496380804e-9,0.0028737882087745852,6.114666054513867e-8,9.353047158655345e-9,0.002874219668384876,-1.1272126322969022e-7,9.602619303010073e-9,0.0028746456433421104,-1.6888577001482716e-7,9.683354937474298e-9,0.002875020314855133,-1.291094150016922e-7,9.626438926383505e-9,0.00287531548780091,-3.018828501717634e-8,9.484597230108128e-9,0.0028755210579180877,8.668647485398011e-8,9.31689120875924e-9,0.0028756422882183752,1.8328829012502568e-7,9.178200849892443e-9,0.002875696134402279,2.288312141503027e-7,9.112800066087184e-9,0.002875707547399061,2.025805089596482e-7,9.150562494597015e-9,0.002875705846174958,9.52630333672185e-8,9.304873938120105e-9,0.0028757210926035038,-9.052120703341189e-8,9.57200496741452e-9,0.0028757804866157105,-3.4091383411167794e-7,9.932003851136088e-9,0.002875904942563708,-6.325855214179894e-7,1.035130470799866e-8,0.0028761062305016523,-9.357358663929467e-7,1.0787070613173603e-8,0.002876385114451254,-1.2180331505464313e-6,1.1192851470911072e-8,0.002876730724811969,-1.4490859095561661e-6,1.1524975361779462e-8,0.002877121258656621,-1.6050876840491572e-6,1.174919121731711e-8,0.002877526072604426,-1.6732673197605107e-6,1.1847070930135468e-8,0.0028779092664162932,-1.6557908710847165e-6,1.1821668584018685e-8,0.0028782350578963945,-1.5726563757144414e-6,1.1701746720225946e-8,0.002878475324870978,-1.4624372605699738e-6,1.1542873713258664e-8,0.0028786189483200725,-1.3787231489666856e-6,1.1422265207849368e-8,0.002878680701003052,-1.3798468481290254e-6,1.1423915368175761e-8,0.002878704787159146,-1.5113471987390404e-6,1.1613291349036044e-8,0.002878756903957089,-1.785757177929549e-6,1.2008265758302951e-8,0.002878902862502164,-2.1705939820080316e-6,1.2561939708202041e-8,0.0028791817969540797,-2.5954920375929927e-6,1.3173007501556022e-8,0.002879589402551466,-2.9784185508799e-6,1.3723483959784089e-8,0.0028800817252932734,-3.2567032182663314e-6,1.4123284543802338e-8,0.0028805956227206074,-3.4055518723271702e-6,1.4336808076009957e-8,0.00288107208392016,-3.4376003397330977e-6,1.4382284035630344e-8,0.0028814710783001875,-3.3898579305011365e-6,1.43129954824349e-8,0.0028817755563885373,-3.3082580675083343e-6,1.4195060433588716e-8,0.002881988308033612,-3.2361154678533363e-6,1.4090836012607044e-8,0.0028821262129773463,-3.207791533507497e-6,1.4049812193983022e-8,0.0028822147082530657,-3.246215519180097e-6,1.4105033781258338e-8,0.0028822834027905776,-3.36241780936278e-6,1.4272395487930903e-8,0.002882362616150177,-3.5558741422002764e-6,1.4551103140709693e-8,0.0028824803465096684,-3.815258525621979e-6,1.4924750790070064e-8,0.002882659335415783,-4.119686711663455e-6,1.5363142882474208e-8,0.0028829141547347752,-4.440809412356523e-6,1.5825359058537653e-8,0.0028832486380844327,-4.746136382797398e-6,1.626457640078978e-8,0.0028836543274357697,-5.003595714935634e-6,1.6634632356475022e-8,0.0028841105948802857,-5.186858658952929e-6,1.6897660746955784e-8,0.0028845868380229104,-5.280659678729527e-6,1.703172244416492e-8,0.0028850468268388713,-5.285119178421869e-6,1.703703042675255e-8,0.0028854548808014517,-5.2180136555174015e-6,1.693924927655556e-8,0.00288578318588404,-5.1141539701945615e-6,1.678862920440044e-8,0.0028860192930803964,-5.021207939658294e-6,1.6653980349342108e-8,0.0028861723562649236,-4.991365507388845e-6,1.6610608238690897e-8,0.0028862757956466495,-5.06888921218822e-6,1.6722303008240677e-8,0.0028863833910300974,-5.2754810860775145e-6,1.7020219754766915e-8,0.002886556622110814,-5.598336802918629e-6,1.7485702072118628e-8,0.0028868448006271175,-5.988001271290007e-6,1.804727106737048e-8,0.0028872654738177545,-6.371171534302883e-6,1.8599132347397268e-8,0.002887795844354059,-6.675623117016277e-6,1.903710691825924e-8,0.0028883812762736244,-6.855447025490349e-6,1.9295003604406827e-8,0.0028889563468819752,-6.903610854021034e-6,1.9362747686658358e-8,0.0028894665800328696,-6.847559620219423e-6,1.9280059028761153e-8,0.0028898810668172878,-6.734011844686922e-6,1.911450684067196e-8,0.0028901940052642504,-6.612662324206851e-6,1.893795127279494e-8,0.0028904191547270935,-6.524988204859821e-6,1.881034874825922e-8,0.002890582222841485,-6.4992181867616665e-6,1.8772471855239283e-8,0.0028907142743236822,-6.549601240706169e-6,1.8844849350322546e-8,0.0028908470537224477,-6.677663335062472e-6,1.9029580088897277e-8,0.0028910098168515577,-6.87394958687946e-6,1.9312855656179486e-8,0.0028912269035187145,-7.1197167658875545e-6,1.966742957177217e-8,0.0028915154465618195,-7.388703555439692e-6,2.0055217248474415e-8,0.002891882983346302,-7.649501334948221e-6,2.0430764834169687e-8,0.002892325261621495,-7.869140909601243e-6,2.0746451553512368e-8,0.002892825069667161,-8.018140622490618e-6,2.095977025193972e-8,0.0028933531569161294,-8.0765493987099e-6,2.1042023401707183e-8,0.0028938720607829473,-8.039749741569616e-6,2.0986676926427616e-8,0.002894342905333149,-7.92219781746215e-6,2.081475472290096e-8,0.0028947341280570267,-7.757261613370963e-6,2.0574609101836252e-8,0.0028950300744023127,-7.592178937176516e-6,2.033462657209387e-8,0.0028952370056188714,-7.47855706718128e-6,2.0169463592427875e-8,0.0028953844081573035,-7.460137255342665e-6,2.0142316838205095e-8,0.00289552034348127,-7.560525475110968e-6,2.0287169809216575e-8,0.0028957008077851775,-7.774273461944861e-6,2.0595931401456922e-8,0.0028959747760086865,-8.06484752748952e-6,2.1015565228355683e-8,0.0028963687909720668,-8.37202856618837e-6,2.1458840848969644e-8,0.002896876822197008,-8.628384556733143e-6,2.1828161536226112e-8,0.002897460687328443,-8.779917072525279e-6,2.2045408873836965e-8,0.0028980621551318326,-8.802502597728348e-6,2.207573173944743e-8,0.002898621746734977,-8.706920074860234e-6,2.1934852495291796e-8,0.0028990957821008693,-8.531279911183452e-6,2.1678125082780306e-8,0.002899465167343782,-8.326114196731398e-6,2.137891611386844e-8,0.0028997348041497496,-8.13959047569529e-6,2.110712912790612e-8,0.002899926963249216,-8.007836040779991e-6,2.091513975889782e-8,0.002900073067994656,-7.951291908204955e-6,2.0832502054918495e-8,0.002900206831484279,-7.975306429587075e-6,2.0866828269500727e-8,0.002900359629928538,-8.072622529241776e-6,2.1007425546019428e-8,0.0029005576921144888,-8.226159990315293e-6,2.1229360644075667e-8,0.0029008202589749987,-8.411462892954981e-6,2.1497037476612273e-8,0.0029011579526491515,-8.59892006014462e-6,2.176744153154923e-8,0.0029015709907129882,-8.756361710375036e-6,2.1993920303424827e-8,0.002902047505571332,-8.85279154909494e-6,2.2131593765595492e-8,0.0029025628872768883,-8.863671727157463e-6,2.2145000075912374e-8,0.0029030815052825793,-8.777345014016352e-6,2.2017385091665053e-8,0.0029035620496829224,-8.600986341434939e-6,2.175931513310784e-8,0.002903966637114285,-8.363362576374002e-6,2.141266869690318e-8,0.0029042717781266334,-8.111634884846253e-6,2.1045980547935134e-8,0.002904477372654277,-7.901280532790563e-6,2.073978444425112e-8,0.002904609628244343,-7.781372369153714e-6,2.0565217145761693e-8,0.002904715791276944,-7.780057503835996e-6,2.056294239996993e-8,0.0029048518634546975,-7.895457374774159e-6,2.0729997122619613e-8,0.0029050672122561154,-8.095212921731798e-6,2.1019213111936452e-8,0.0029053908949938285,-8.324795261790677e-6,2.1351336711916632e-8,0.002905823673533291,-8.52201545814966e-6,2.1636089845854755e-8,0.0029063379482547036,-8.63355664871243e-6,2.1796127132877224e-8,0.00290688567731947,-8.628754999473182e-6,2.178700899956975e-8,0.002907411886688896,-8.506448804640417e-6,2.1607149038605026e-8,0.002907869313118284,-8.29292031099503e-6,2.1294847433827952e-8,0.002908229337953015,-8.032291094367549e-6,2.0914343210019756e-8,0.002908486197412823,-7.773494661513888e-6,2.0536855496935417e-8,0.0029086544808403334,-7.5585686559262325e-6,2.0223523711567358e-8,0.0029087623904295403,-7.415402414785589e-6,2.001484051067057e-8,0.002908843981353781,-7.35553482324306e-6,1.9927459583560743e-8,0.002908932726752054,-7.375649943051864e-6,1.9956406208574644e-8,0.0029090572536835126,-7.460809532075294e-6,2.0079817615799907e-8,0.002909238952715364,-7.5879228762615555e-6,2.0264014865399943e-8,0.0029094906884145105,-7.728775534689363e-6,2.0467914700593435e-8,0.0029098158523242937,-7.852662044244406e-6,2.064685157630933e-8,0.002910207338650096,-7.929175550194102e-6,2.0756624253538985e-8,0.0029106466203267355,-7.931911576665453e-6,2.0758877958416994e-8,0.002911103814377557,-7.843588459108618e-6,2.062855490190973e-8,0.0029115402023730556,-7.66224497593975e-6,2.0362916420013977e-8,0.002911914696322001,-7.406730952055019e-6,1.998953139422466e-8,0.0029121945161994208,-7.118129171687856e-6,1.9568325801371748e-8,0.0029123675377467186,-6.853478439441242e-6,1.918239985768633e-8,0.002912450734123804,-6.670885447814342e-6,1.8916298524169225e-8,0.002912488859188778,-6.610394269086291e-6,1.88281387438807e-8,0.0029125417695362995,-6.679120462312963e-6,1.8928018749465943e-8,0.0029126652147423104,-6.848070988212437e-6,1.9173497757355166e-8,0.0029128935517388484,-7.061935206702308e-6,1.9483944368025575e-8,0.002913231037578079,-7.256695642236208e-6,1.9766193972595816e-8,0.0029136533209005457,-7.377571585707302e-6,1.9940619511564884e-8,0.0029141165252539614,-7.391701575272796e-6,1.9959524190801965e-8,0.0029145697689046887,-7.293322714917477e-6,1.981463990082668e-8,0.0029149673788549375,-7.1018310443380406e-6,1.953430007430907e-8,0.002915278149714961,-6.8545563898393026e-6,1.9172935518929185e-8,0.002915490151865234,-6.596725101954491e-6,1.8796465187354656e-8,0.0029156107375936115,-6.371248850546456e-6,1.846741356078346e-8,0.002915662539790091,-6.210673245514143e-6,1.8233164243708407e-8,0.0029156771594396804,-6.1327104522359935e-6,1.8119444504375368e-8,0.002915688499493966,-6.139498762978267e-6,1.812926086634637e-8,0.0029157272510905927,-6.219687203803143e-6,1.824596696099231e-8,0.0029158172217261446,-6.3520114728173305e-6,1.843850247261238e-8,0.002915973412501954,-6.5091582694995025e-6,1.8667034188020637e-8,0.0029162012640837876,-6.6612268782975755e-6,1.888798608393158e-8,0.0029164964235661433,-6.778735787311186e-6,1.9058396783844645e-8,0.002916844658644618,-6.835584702079287e-6,1.91402221340199e-8,0.0029172220097263466,-6.812552966048134e-6,1.910544630322981e-8,0.002917595884444303,-6.7017614420562816e-6,1.8942618913472558e-8,0.002917928412307093,-6.511815863831633e-6,1.8664385893287575e-8,0.00291818347875855,-6.2719153866716e-6,1.8313480562819844e-8,0.002918337682433519,-6.031490122748525e-6,1.7962147335797165e-8,0.002918392453911434,-5.8514246809711895e-6,1.7699255420367632e-8,0.0029183808220965175,-5.785913109725185e-6,1.760375851831056e-8,0.002918361694896576,-5.860827931022856e-6,1.7713146738291097e-8,0.0029184005478205227,-6.060277614749884e-6,1.8003943123245615e-8,0.0029185450818061424,-6.330635628385983e-6,1.8397723097046376e-8,0.002918808813042895,-6.6005652769916755e-6,1.8790403319492904e-8,0.002919169951357401,-6.805733183674234e-6,1.908827114831872e-8,0.0029195829508730235,-6.906435273516535e-6,1.92336174657321e-8,0.002919994648581057,-6.893430674434389e-6,1.9213166424777753e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_2.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_2.json deleted file mode 100644 index 480e1a0a..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_2.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":2000,"numberOfSamples":1000,"samples":[-0.0019226433452019043,-4.2400202047522655e-5,-4.847209139509104e-8,-0.0019224915279308452,-4.232138293995991e-5,-4.839917575682174e-8,-0.0019223575599970867,-4.2339533342532786e-5,-4.841941987929699e-8,-0.0019221925201880694,-4.2455757141232014e-5,-4.853500256368106e-8,-0.0019219535221161883,-4.264378690983704e-5,-4.87214377132331e-8,-0.0019216173050324704,-4.285653639574512e-5,-4.893368444013015e-8,-0.0019211878632388768,-4.304035090341533e-5,-4.911986351109583e-8,-0.0019206944269591652,-4.3151566455827686e-5,-4.923733483565604e-8,-0.001920180782153211,-4.316840557061996e-5,-4.9264336921476375e-8,-0.0019196912154135558,-4.3093903838697776e-5,-4.920299044056076e-8,-0.001919259170950511,-4.2950548434361e-5,-4.9074301884897993e-8,-0.0019189019210674083,-4.277089886837732e-5,-4.8909249976046343e-8,-0.0019186208521778832,-4.258868047478004e-5,-4.8740241599705884e-8,-0.001918404926768647,-4.243272605567538e-5,-4.859521792579728e-8,-0.0019182349450095773,-4.2323928794774185e-5,-4.849461482060666e-8,-0.0019180872700253946,-4.2274266862589164E-05,-4.8450338629402915e-8,-0.001917936666180632,-4.228680533004299e-5,-4.846574052979398e-8,-0.00191775854316843,-4.2355896173164964e-5,-4.8535824807684226e-8,-0.0019175311877270766,-4.246735024004276e-5,-4.864742159638906e-8,-0.0019172384671460499,-4.25989290061144e-5,-4.877961167038227e-8,-0.0019168730864799963,-4.2721876682799584e-5,-4.890508625070886e-8,-0.0019164398837302117,-4.280432151427329e-5,-4.8993279677066866e-8,-0.0019159579014177714,-4.281706315274191e-5,-4.901583883335078e-8,-0.0019154594243000278,-4.27412144250086e-5,-4.8953968414289994e-8,-0.001914984557283099,-4.2575562469439085e-5,-4.880561552483321e-8,-0.0019145716125768752,-4.234039279521026e-5,-4.858934382627422e-8,-0.0019142459086730812,-4.207501807745824e-5,-4.834220694952108e-8,-0.0019140111182697102,-4.1828569489815494e-5,-4.811113500434928e-8,-0.0019138468399848853,-4.1646650455964184e-5,-4.794024685992306e-8,-0.0019137136475314569,-4.155842585264431e-5,-4.785840090516636e-8,-0.0019135639168575628,-4.156847538008292e-5,-4.787112479174571e-8,-0.001913354878178476,-4.165575436672902e-5,-4.795925785880041e-8,-0.001913060039736298,-4.1779660100407035e-5,-4.808445425303678e-8,-0.0019126758326174886,-4.189128905126362e-5,-4.8199834042895305e-8,-0.0019122216639617473,-4.194655693717889e-5,-4.8262624541360104e-8,-0.0019117335388331718,-4.191721880810053e-5,-4.8244930247959284e-8,-0.0019112535774869718,-4.17965282482666e-5,-4.8139407883790543e-8,-0.0019108191058004997,-4.159831661316574e-5,-4.795859671838348e-8,-0.001910454761111615,-4.13507805095086e-5,-4.7729094163578805e-8,-0.0019101693588310655,-4.108797784158734e-5,-4.74834365018481e-8,-0.0019099571113809235,-4.084210928294797e-5,-4.725264424568893e-8,-0.0019098014051956349,-4.06383521782112e-5,-4.706116300989979e-8,-0.001909679232807439,-4.049244367589526e-5,-4.6924445600308274e-8,-0.0019095650792493577,-4.041027304587661e-5,-4.684851156054176e-8,-0.0019094338706790138,-4.038850509596943e-5,-4.6830551880131895e-8,-0.0019092631960406178,-4.041545998091156e-5,-4.685979719885473e-8,-0.0019090353342274217,-4.0471961726856714e-5,-4.691831881589462e-8,-0.0019087395911655302,-4.053242839868951e-5,-4.698199191766588e-8,-0.0019083750969175394,-4.0566889485238066e-5,-4.7022295836454817e-8,-0.0019079535950202848,-4.05448090409642e-5,-4.7009857068801336e-8,-0.0019075008929219535,-4.0441352326518995e-5,-4.692041592595363e-8,-0.0019070548602137859,-4.024557340002766e-5,-4.674274417153859e-8,-0.0019066581194424014,-3.996789525520936e-5,-4.648596905336088e-8,-0.0019063458229643833,-3.964246667720178e-5,-4.618202616974119e-8,-0.001906132593687367,-3.932066250072738e-5,-4.5879631296205274e-8,-0.001906005112413036,-3.9056140911694693e-5,-4.563013841888741e-8,-0.0019059250849624966,-3.888725831245831e-5,-4.547077730150599e-8,-0.0019058418160187416,-3.882488208844757e-5,-4.541289156609024e-8,-0.0019057084893034362,-3.885058262649113e-5,-4.5439933455113804e-8,-0.0019054953071705263,-3.892448678948119e-5,-4.551462448108332e-8,-0.0019051956015066044,-3.899818092129441e-5,-4.559102248754266e-8,-0.001904824751066378,-3.902764552633575e-5,-4.562680789434229e-8,-0.0019044139453100216,-3.898286178877979e-5,-4.5592592314242095e-8,-0.0019040014133682513,-3.8852641286461894e-5,-4.547679044559279e-8,-0.0019036234930003598,-3.864464423892581e-5,-4.5285911009026024e-8,-0.0019033074182967,-3.838144973804248e-5,-4.504099501526467e-8,-0.0019030670807785748,-3.809414814477403e-5,-4.477156044224583e-8,-0.0019029021776647626,-3.7815292683842436e-5,-4.4508817510060506e-8,-0.001902800227035411,-3.757290803529455e-5,-4.427982585191298e-8,-0.0019027403062597105,-3.738655521525043e-5,-4.410361508352597e-8,-0.0019026972766109718,-3.726562021454014e-5,-4.3989482282936625e-8,-0.0019026455605967178,-3.720939282853564e-5,-4.393706825168861e-8,-0.001902562049494492,-3.720819681311018e-5,-4.393747898583925e-8,-0.0019024282429587474,-3.7244887169539354e-5,-4.397474157144386e-8,-0.0019022320167928473,-3.7296417780327447e-5,-4.402726172840666e-8,-0.0019019694121183246,-3.733563521997301e-5,-4.406942025345132e-8,-0.0019016466101295054,-3.7333817380047615e-5,-4.4073850286943826e-8,-0.001901281721675244,-3.72647279533573e-5,-4.401521158739995e-8,-0.0019009051492186858,-3.7110772537172744e-5,-4.387608872624823e-8,-0.0019005564761927897,-3.687070357499274e-5,-4.365449081610721e-8,-0.0019002760006965934,-3.656614621766662e-5,-4.3370288285066725e-8,-0.0019000913323042824,-3.624205466668279e-5,-4.306583828633659e-8,-0.0019000039601944792,-3.5956706816941076e-5,-4.279656932567122e-8,-0.0018999840816792122,-3.576226105855051e-5,-4.261250079410351e-8,-0.0018999792883793371,-3.568461104514584e-5,-4.253901137884262e-8,-0.001899933981398471,-3.5713853399087564e-5,-4.2567602344540055e-8,-0.0018998090711157681,-3.581022732657273e-5,-4.266128735242672e-8,-0.0018995924498515157,-3.5920529128532807E-05,-4.27699363285063e-8,-0.0018992979805863262,-3.599552540735251e-5,-4.284667515898346e-8,-0.001898956996465333,-3.60016505232314e-5,-4.2859033641491364e-8,-0.0018986077115788766,-3.5925404995038095e-5,-4.2793327231141533e-8,-0.0018982861274868695,-3.5772115322624845e-5,-4.2653762704726326e-8,-0.0018980197803509253,-3.556151123416992e-5,-4.245848237196928e-8,-0.0018978243192027849,-3.532201505409536e-5,-4.2234258129154944e-8,-0.0018977025183165013,-3.5084842908056075e-5,-4.201085903922587e-8,-0.001897645338891351,-3.487865622253372e-5,-4.181584089370757e-8,-0.001897634548299051,-3.472539749417785e-5,-4.1670438822720854e-8,-0.0018976462592206278,-3.4637684651986404E-05,-4.158699002545304e-8,-0.0018976547528813345,-3.461783260192269e-5,-4.156798431104482e-8,-0.0018976360025567379,-3.465835456450116e-5,-4.160658512785339e-8,-0.0018975704668702292,-3.474353699435762e-5,-4.168818028849286e-8,-0.0018974450856599756,-3.485154582856132e-5,-4.179238643199875e-8,-0.0018972547032642363,-3.4956750270050015e-5,-4.189517808310863e-8,-0.0018970031462578617,-3.5032293373468896e-5,-4.1971187462921197e-8,-0.001896704041121835,-3.5053177068163955e-5,-4.199649895495414e-8,-0.0018963811064912409,-3.500033872352196e-5,-4.195247884233675e-8,-0.0018960669388229457,-3.486606242620335e-5,-4.183101890714069e-8,-0.0018957986732221059,-3.466005594878666e-5,-4.1640536726904226e-8,-0.0018956091571617987,-3.441367338006517e-5,-4.141024300465335e-8,-0.0018955143084655717,-3.417789714991304e-5,-4.11883959487616e-8,-0.0018955015199407235,-3.401103934461799e-5,-4.103064766105313e-8,-0.0018955276091062383,-3.395751831846302e-5,-4.097979506922786e-8,-0.0018955320612609062,-3.4027724788744977e-5,-4.104650552871127e-8,-0.001895460925824634,-3.419213691026499e-5,-4.120354608540807e-8,-0.0018952876637236959,-3.439431347479264e-5,-4.139792350116541e-8,-0.0018950194973305701,-3.4574094187676726e-5,-4.157273141268476e-8,-0.00189468901820827,-3.468727701743215e-5,-4.168573954249668e-8,-0.0018943393648524587,-3.471417304124221e-5,-4.171758103848185e-8,-0.001894011175966523,-3.4658126432902484e-5,-4.1670568510380554e-8,-0.0018937347654549707,-3.4538913747532676e-5,-4.156270803527193e-8,-0.0018935271586108895,-3.438520384909261e-5,-4.1420753571334326e-8,-0.0018933922404869188,-3.4228171385826936e-5,-4.127420869753851e-8,-0.0018933224519850319,-3.409667569558539e-5,-4.115067186901395e-8,-0.001893301244193991,-3.40137190510597e-5,-4.10723266568858e-8,-0.0018933060255165923,-3.399399788202456e-5,-4.105348708812609e-8,-0.0018933114133081418,-3.404253904550354e-5,-4.109924608197351e-8,-0.0018932925837213562,-3.415443233452324e-5,-4.120524021833533e-8,-0.0018932284621856921,-3.431570348176952e-5,-4.135853030487643e-8,-0.001893104383091029,-3.4505267334039883e-5,-4.1539480078514925e-8,-0.00189291393259836,-3.469764551964496e-5,-4.172428673891212e-8,-0.0018926599383916741,-3.486610463956082e-5,-4.188783776156979e-8,-0.0018923546511316431,-3.498605241766292e-5,-4.2006785198344876e-8,-0.001892019101621626,-3.5038631408074926e-5,-4.206286015466167e-8,-0.0018916814855736094,-3.5014534367428806e-5,-4.204652314564249e-8,-0.001891374040852943,-3.491799599962725e-5,-4.196092987201902e-8,-0.0018911275262606326,-3.477018738663742e-5,-4.182542386637248e-8,-0.0018909628356181614,-3.460994197225293e-5,-4.167647877700423e-8,-0.0018908809794151223,-3.448870510773402e-5,-4.1563025636714426e-8,-0.001890855680381783,-3.4457266426274074e-5,-4.1533801407386716e-8,-0.0018908353879217353,-3.454621539121781e-5,-4.1618610494880996e-8,-0.0018907590601062614,-3.474930510512576e-5,-4.1812322746267864e-8,-0.0018905806559135173,-3.502183484605819e-5,-4.2073175486873276e-8,-0.0018902883688857062,-3.529801938551741e-5,-4.233914044230188e-8,-0.0018899068551920142,-3.551742428610809e-5,-4.255290749642152e-8,-0.001889483249018912,-3.564481602849056e-5,-4.268065997382881e-8,-0.0018890679245541686,-3.567523527632135e-5,-4.2716955210695495e-8,-0.00188870032072965,-3.562727788606181e-5,-4.267856906938492e-8,-0.0018884030745074487,-3.5532202829357725e-5,-4.2594437460528625e-8,-0.0018881823723488097,-3.54243921208098e-5,-4.2496795451858114e-8,-0.0018880312102406572,-3.533504994855418e-5,-4.2415230301185514e-8,-0.0018879332139387782,-3.5288747014991394e-5,-4.237330143238159e-8,-0.0018878660597741292,-3.5301680267534746e-5,-4.23867434249854e-8,-0.001887804493950075,-3.5380813257388804e-5,-4.246254511061698e-8,-0.0018877231921547025,-3.552361030820859e-5,-4.259866804167272e-8,-0.0018875996014664324,-3.5718391160070784e-5,-4.278440830777563e-8,-0.0018874167566322304,-3.594551788242534e-5,-4.300154835611885e-8,-0.0018871657927251448,-3.617965687985636e-5,-4.322647911791066e-8,-0.0018868476636197298,-3.639308212496223e-5,-4.3433238917490384e-8,-0.0018864736576865142,-3.655967876258171e-5,-4.359717299143751e-8,-0.0018860644895497603,-3.66591992046944e-5,-4.369885112248462e-8,-0.0018856478855353213,-3.668124668546799e-5,-4.37278181581545e-8,-0.0018852547440176993,-3.6628421846668554e-5,-4.3685686879638724e-8,-0.0018849140165977931,-3.651813115392309e-5,-4.358808695279573e-8,-0.0018846464338938206,-3.638236555382138e-5,-4.346473580791103e-8,-0.0018844576056432885,-3.6264235942699986e-5,-4.3356365793623564e-8,-0.0018843321784880178,-3.6209913884206997e-5,-4.3307130103906174e-8,-0.0018842322632395324,-3.625576306513159e-5,-4.335226126403655e-8,-0.0018841040436168481,-3.641349949400654e-5,-4.350374571050373e-8,-0.0018838940566287233,-3.6660400894427665e-5,-4.374080127460915e-8,-0.001883570085252579,-3.694276386559895e-5,-4.401301964778491e-8,-0.001883135475562002,-3.7194520085842316e-5,-4.425796870583932e-8,-0.001882627578444282,-3.73621475032825e-5,-4.442477583414205e-8,-0.0018821014403124572,-3.742201299485457e-5,-4.4490542846202025e-8,-0.001881609313986513,-3.7382507458315104e-5,-4.4462439215216833e-8,-0.0018811865907120172,-3.7274116019286886e-5,-4.436849914685254e-8,-0.001880847632416261,-3.713591350573811e-5,-4.424508395808057e-8,-0.00188058871037337,-3.7004918805228556e-5,-4.4126962304448526e-8,-0.0018803936614843618,-3.691021781204701e-5,-4.4041748300567786e-8,-0.0018802392951189633,-3.6870851790922326e-5,-4.400778710220607e-8,-0.0018800994849178696,-3.68957089255605e-5,-4.40339130327419e-8,-0.0018799481169941405,-3.698411204251374e-5,-4.411991825255021e-8,-0.0018797614670353787,-3.7126553405316096e-5,-4.425722892864331e-8,-0.0018795204776576248,-3.730559347706619e-5,-4.442976975442706e-8,-0.0018792131464299988,-3.749729428555327e-5,-4.46153152223929e-8,-0.0018788368365865878,-3.7673694011914794e-5,-4.4787772369335294e-8,-0.0018783998781203336,-3.780658890837698e-5,-4.492065092723705e-8,-0.0018779216417479986,-3.787236867220032e-5,-4.4991520603290696e-8,-0.0018774304478634798,-3.785712894848209e-5,-4.4986782858554793e-8,-0.001876959132956837,-3.776087580238688e-5,-4.490568783170876e-8,-0.001876538772816988,-3.759950843431476e-5,-4.476237298058196e-8,-0.0018761917084975216,-3.740363503756282e-5,-4.458499652618009e-8,-0.0018759253154816227,-3.721393836510612e-5,-4.441161416080866e-8,-0.0018757279816746558,-3.7073377257336396e-5,-4.4282962063134714e-8,-0.0018755687920489152,-3.701708377818567e-5,-4.4232881827984826e-8,-0.0018754023218197238,-3.706175871807319e-5,-4.427809041286009e-8,-0.0018751791516401983,-3.71976903316632e-5,-4.4410338519050925e-8,-0.0018748606150037481,-3.738752598197328e-5,-4.4594994984169714e-8,-0.0018744330348925565,-3.7574982787928245E-05,-4.47791613026569e-8,-0.0018739145177022712,-3.770239276914684e-5,-4.490826020461936e-8,-0.0018733495373167643,-3.773009490362128e-5,-4.4944415378813574e-8,-0.0018727931908080317,-3.764831441568e-5,-4.487773977743384e-8,-0.0018722931442570632,-3.7476441825173546e-5,-4.472576455407728e-8,-0.0018718776143170825,-3.72522449686114e-5,-4.452343076403651e-8,-0.0018715526178116695,-3.701813258333055e-5,-4.431030817274317e-8,-0.0018713062231411261,-3.681055615655657e-5,-4.4120686585272034e-8,-0.001871115468151383,-3.665468354723957e-5,-4.397851191896047e-8,-0.001870952694577932,-3.6563328602725056e-5,-4.389625440586987e-8,-0.0018707900517583916,-3.653811265418476e-5,-4.3875885637797216e-8,-0.0018706023334060244,-3.6571255822349916e-5,-4.391050608580251e-8,-0.0018703688700737859,-3.664722159578986e-5,-4.398588937722728e-8,-0.0018700751930006965,-3.6744157938658e-5,-4.408184554328447e-8,-0.0018697148769254426,-3.683557666976917e-5,-4.4173775089313205e-8,-0.0018692914772034106,-3.6892936200826666e-5,-4.423502611041501e-8,-0.0018688199023591616,-3.688965083963331e-5,-4.424057092448585e-8,-0.0018683261082645549,-3.680648604854699e-5,-4.4172010900809014e-8,-0.0018678439684996118,-3.663736658049673e-5,-4.4023038613393244e-8,-0.0018674088734324848,-3.639364723333976e-5,-4.3803546879327065e-8,-0.0018670490319146785,-3.610454803253589e-5,-4.354021989210011e-8,-0.001866776960604691,-3.581233195531623e-5,-4.327223113044107e-8,-0.0018665842545617494,-3.556274227869284e-5,-4.304246095848443e-8,-0.0018664419014308188,-3.539322985208859e-5,-4.2886518844144926e-8,-0.001866306540510951,-3.532250177755452e-5,-4.282282625286369e-8,-0.0018661311596336301,-3.5344543323723834e-5,-4.284673828172474e-8,-0.0018658774885188531,-3.542898898557433e-5,-4.293057236042494e-8,-0.0018655268253949977,-3.55281941668765e-5,-4.303001094315354e-8,-0.0018650860333417425,-3.55896847358241e-5,-4.309572055327366e-8,-0.0018645862558132557,-3.557072469934887e-5,-4.3087114771064386e-8,-0.001864074064290464,-3.54502290003869e-5,-4.298370377047688e-8,-0.0018635978679334747,-3.523359331224885e-5,-4.278980205390345e-8,-0.0018631947076426666,-3.494883476042089e-5,-4.2531058883068645e-8,-0.0018628822307316867,-3.4636347734627516E-05,-4.224496475448857e-8,-0.0018626577466252,-3.433705755884229e-5,-4.196979779298566e-8,-0.0018625028468491243,-3.408334448344101e-5,-4.173608792809358e-8,-0.0018623903292806535,-3.389462368841906e-5,-4.1562378749819724e-8,-0.001862290600784725,-3.377697613200107e-5,-4.145477037782527e-8,-0.0018621762300559555,-3.3725088096835355e-5,-4.14086669723388e-8,-0.0018620246347852986,-3.372488473601601e-5,-4.141123207304418e-8,-0.0018618195632346566,-3.375593156589706e-5,-4.1443656121148575e-8,-0.0018615521548540242,-3.3793432453618705e-5,-4.148302730689643e-8,-0.001861222100187459,-3.3810221048498295E-05,-4.15041470998425e-8,-0.0018608389284970092,-3.377941053241642e-5,-4.148192086511341e-8,-0.0018604228570434176,-3.367833230390359e-5,-4.139496124109246e-8,-0.0018600040268228783,-3.3493942425028966e-5,-4.123062094176194e-8,-0.001859618642548962,-3.322877352067173e-5,-4.0990619843655576e-8,-0.0018593011806838898,-3.290498445207031e-5,-4.0694967467908326e-8,-0.001859073836432133,-3.256319848003421e-5,-4.038105550600808e-8,-0.0018589370096645738,-3.225400787141628e-5,-4.0095898376829484e-8,-0.0018588658572420299,-3.202355089014602e-5,-3.988278237900221e-8,-0.001858815953690681,-3.1898535195761845e-5,-3.9767279252543205e-8,-0.0018587365322608792,-3.187731481624273e-5,-3.974875641256137e-8,-0.001858585847420525,-3.193072891426777e-5,-3.9800881931187754e-8,-0.0018583427276889898,-3.201157846011818e-5,-3.988018363222736e-8,-0.001858011024484624,-3.206838339685549e-5,-3.993871620605644e-8,-0.0018576168661056972,-3.2058722129593e-5,-3.993651170976707e-8,-0.001857200628294303,-3.1958785793748546e-5,-3.98506487342928e-8,-0.0018568063178679155,-3.1767390735336565e-5,-3.9679225404044e-8,-0.0018564711830394505,-3.150417991339459e-5,-3.943989843936122e-8,-0.0018562180244630548,-3.120309508365586e-5,-3.916393604405171e-8,-0.001856051832860989,-3.0903287984785486e-5,-3.888777991719524e-8,-0.0018559610387409902,-3.0640165715613776e-5,-3.864464037772421e-8,-0.0018559222165318323,-3.043888182499085e-5,-3.845831450517588e-8,-0.0018559062367179708,-3.031135180046263e-5,-3.8340287099323454e-8,-0.0018558839785556914,-3.025648674119293e-5,-3.828987583339211e-8,-0.0018558305005729916,-3.0262498510445098e-5,-3.829637141557298e-8,-0.0018557274688207667,-3.030998413607464e-5,-3.8341946180221575e-8,-0.0018555642923261315,-3.0374874455143256e-5,-3.8404431294548646e-8,-0.0018553386335638984,-3.043096245585696e-5,-3.8459652833342595e-8,-0.0018550567897867762,-3.0452262426219995e-5,-3.8483550463237314e-8,-0.0018547340635318174,-3.041572528206477e-5,-3.8454603062521525e-8,-0.0018543947164707576,-3.03048875961989e-5,-3.835716288178646e-8,-0.0018540704590361671,-3.0114692323656852e-5,-3.81859702743685e-8,-0.0018537960249984855,-2.985666954648834e-5,-3.79511015108531e-8,-0.0018536008786521339,-2.9562027461414482e-5,-3.768102528692731e-8,-0.0018534981424192035,-2.927893614320846e-5,-3.742024332911934e-8,-0.0018534751696137296,-2.9061233360087007e-5,-3.72188887172703e-8,-0.0018534923481789171,-2.8950357584252507e-5,-3.711593484750272e-8,-0.0018534940550578869,-2.8958436077817732e-5,-3.7123378482837e-8,-0.0018534282008300274,-2.9062277323979435e-5,-3.722046668883958e-8,-0.0018532645332598092,-2.921211788923309e-5,-3.736159207290112e-8,-0.0018530028720135114,-2.934986972526837e-5,-3.7493050320642694e-8,-0.0018526694542170326,-2.942727873570747e-5,-3.756982425163037e-8,-0.0018523058642196187,-2.9417150023504876e-5,-3.7566073539067835e-8,-0.0018519564866905035,-2.9316192868627697e-5,-3.7477965536880444e-8,-0.0018516584089416203,-2.9141557732680905e-5,-3.7320700414486564e-8,-0.001851435208412855,-2.8923992161479002e-5,-3.712235494419344e-8,-0.001851294541339165,-2.869997092993335e-5,-3.691666372244825e-8,-0.0018512288972952473,-2.850431556199019e-5,-3.673612972502268e-8,-0.0018512187605911334,-2.8364293030248146e-5,-3.6606422818222735e-8,-0.0018512372743969517,-2.8295880091963878e-5,-3.6542771387623024e-8,-0.001851255373367241,-2.830245486957463e-5,-3.654865101402205e-8,-0.0018512464347500161,-2.837567990696616e-5,-3.661658029509977e-8,-0.0018511897654824728,-2.849797616767571e-5,-3.6730452314410044e-8,-0.0018510726455833026,-2.864577894127868e-5,-3.6868605111867225e-8,-0.0018508911239511774,-2.879283048085962e-5,-3.700688885749968e-8,-0.0018506500169525825,-2.891316386992196e-5,-3.712138235946777e-8,-0.0018503624659893852,-2.8983841434482034e-5,-3.719083313132091e-8,-0.001850049192722774,-2.8987717253845237e-5,-3.719912582085492e-8,-0.00184973724683297,-2.8916604783197052e-5,-3.7138199915807674e-8,-0.0018494574590516221,-2.877500685094965e-5,-3.7011601488886906e-8,-0.001849239457271444,-2.8583618727700412e-5,-3.6837917133073514e-8,-0.001849103637120204,-2.8380420558935783e-5,-3.665199142573758e-8,-0.0018490512556514666,-2.8216113176951286e-5,-3.650082802289004e-8,-0.0018490568923369543,-2.814133170477168e-5,-3.643173901900574e-8,-0.001849070044366471,-2.8187498919253204e-5,-3.6474479853762786e-8,-0.0018490301023305032,-2.835027238269989e-5,-3.662573037762882e-8,-0.0018488899067574623,-2.8587217166636767e-5,-3.6846766146306595e-8,-0.0018486348257891318,-2.883361606393152e-5,-3.707797543919425e-8,-0.0018482863056600417,-2.902755950667316e-5,-3.726201459105288e-8,-0.0018478899852914469,-2.9130064005063796e-5,-3.736241363816512e-8,-0.0018474976562760789,-2.91321131307372e-5,-3.737016828147584e-8,-0.0018471524750899352,-2.905016180405401e-5,-3.729976063286029e-8,-0.0018468812786227445,-2.8916268553225196e-5,-3.718025357565311e-8,-0.0018466931172711491,-2.876806315238052e-5,-3.7046173746412294e-8,-0.0018465815057894385,-2.8640983775258864e-5,-3.6930365429741035e-8,-0.00184652829693714,-2.8563136245366806e-5,-3.685914654239289e-8,-0.0018465080445311866,-2.8552306292304803e-5,-3.6849396405970724e-8,-0.0018464923711327586,-2.8614698711177184e-5,-3.69072585309602e-8,-0.0018464540475209713,-2.874515858709884e-5,-3.702828145510411e-8,-0.001846370522506678,-2.8928669467886978e-5,-3.7198811661589566e-8,-0.001846226627091265,-2.9142919199792575e-5,-3.739840984195331e-8,-0.0018460161773210895,-2.936159596526058e-5,-3.7602928735736206e-8,-0.0018457424092981416,-2.9557907441157696e-5,-3.7787745528739335e-8,-0.0018454174436069045,-2.9707932709951874e-5,-3.793078679950588e-8,-0.001845060979936064,-2.9793682517744152e-5,-3.8015266553066575e-8,-0.0018446983139210466,-2.9805837685586976e-5,-3.803216933965162e-8,-0.001844357663506958,-2.974619611849742e-5,-3.7982560537325245e-8,-0.0018440664544479193,-2.9629797711193566e-5,-3.7879707314877856e-8,-0.001843845950446449,-2.948601531108566e-5,-3.775030341662861e-8,-0.0018437041818345754,-2.9356851092842417e-5,-3.763307774716062e-8,-0.0018436286704259478,-2.929018395984869e-5,-3.7572610524337075e-8,-0.0018435826591715672,-2.9326650546160026e-5,-3.7607099199983846e-8,-0.001843510243611047,-2.9482479522100277e-5,-3.7752270839027916e-8,-0.0018433534878047207,-2.9736569576451163e-5,-3.798922207122916e-8,-0.001843076228620517,-3.003258999787417e-5,-3.826624809927366e-8,-0.0018426810050820315,-3.0299279226205748e-5,-3.851758748645876e-8,-0.0018422077376924746,-3.0478508169391107e-5,-3.8689353289091895e-8,-0.0018417156239789582,-3.054470317700498e-5,-3.875746335719129e-8,-0.0018412606553196052,-3.050710730095082e-5,-3.872977574482587e-8,-0.001840880483325183,-3.0398882257686496e-5,-3.8636192256924036e-8,-0.001840590004125507,-3.026250677128237e-5,-3.851540126764517e-8,-0.0018403844397698059,-3.013820957242196e-5,-3.840435285169504e-8,-0.001840245361005513,-3.0057347763451893e-5,-3.8332152701456324e-8,-0.0018401466765782936,-3.0039751280580974e-5,-3.831749547487945e-8,-0.0018400595016326148,-3.0093363332831677e-5,-3.836817784862127e-8,-0.0018399559497764423,-3.0215015910877106e-5,-3.848169905675189e-8,-0.001839812170196447,-3.039186553279613e-5,-3.864654273812751e-8,-0.0018396108283989022,-3.060338054950594e-5,-3.884402378562721e-8,-0.0018393430417674114,-3.082394307346604e-5,-3.905071575977295e-8,-0.001839009544828154,-3.1026114366856945e-5,-3.924146216346563e-8,-0.0018386207708631277,-3.1184328723264915e-5,-3.939273712194119e-8,-0.0018381957305413437,-3.127857148136643e-5,-3.948596451419425e-8,-0.0018377597459139795,-3.1297656724416976e-5,-3.95104860508152e-8,-0.001837341137178437,-3.1241751125251476e-5,-3.946590292406994e-8,-0.0018369670512292443,-3.112376810976386e-5,-3.9363472022820164e-8,-0.0018366586561733092,-3.096932899220622e-5,-3.922626209101001e-8,-0.0018364258708403016,-3.0814812173559905e-5,-3.9087559514838445e-8,-0.0018362621920370473,-3.070252357614279e-5,-3.8986539372919337e-8,-0.0018361412688580824,-3.067203929167175e-5,-3.896025500527251e-8,-0.0018360180816703487,-3.0748042684471684e-5,-3.903223795898209e-8,-0.0018358378502917804,-3.092774827382751e-5,-3.920064225747588e-8,-0.0018355532968053283,-3.1174550168373766e-5,-3.9432189756387474e-8,-0.0018351446756584952,-3.142525945238052e-5,-3.966879216514516e-8,-0.001834631257077125,-3.161182618802566e-5,-3.9847630332795574e-8,-0.001834065391188641,-3.168747068911088e-5,-3.992527940095902e-8,-0.0018335116541834382,-3.164236364109196e-5,-3.989214970654177e-8,-0.0018330236496004874,-3.1501495858562004e-5,-3.977056585296882e-8,-0.0018326302885483708,-3.130976247069251e-5,-3.960119517536447e-8,-0.0018323344622033428,-3.111494455177007e-5,-3.94275962437217e-8,-0.0018321196002908996,-3.095597209536023e-5,-3.928554181120305e-8,-0.0018319582888422555,-3.085789845493625e-5,-3.919836392406287e-8,-0.0018318194757880513,-3.083157342368737e-5,-3.9176511626126014e-8,-0.0018316733480543946,-3.0875483927058214e-5,-3.9219089175635253e-8,-0.0018314943794796696,-3.097812687524317e-5,-3.931593991989682e-8,-0.0018312633560748676,-3.1120334429811935e-5,-3.9449760179892773e-8,-0.001830968913688379,-3.1277592120351454e-5,-3.9598246635518696e-8,-0.0018306087634235733,-3.14226374107931e-5,-3.9736499110668715e-8,-0.0018301904168349817,-3.152864766531905e-5,-3.9839932121797345e-8,-0.0018297309265778968,-3.1573033171681355e-5,-3.988771007373838e-8,-0.0018292551760944991,-3.154139489645285e-5,-3.986633134180522e-8,-0.0018287925523648566,-3.1430926466745534e-5,-3.977274223006469e-8,-0.0018283721888019805,-3.125244172846256e-5,-3.961626454205167e-8,-0.0018280173510476312,-3.1030241019074e-5,-3.941861928815817e-8,-0.0018277399014371466,-3.079933897322065e-5,-3.921157228495376e-8,-0.0018275359237807758,-3.060002936908609e-5,-3.9032106768399976e-8,-0.0018273836315456557,-3.0470075984707517e-5,-3.891530628053033e-8,-0.0018272448509398856,-3.0435259419920423e-5,-3.8885571590877783e-8,-0.0018270713806662069,-3.0500042234658058e-5,-3.8947817158765014e-8,-0.0018268166773114957,-3.064158208297821e-5,-3.908171343754616e-8,-0.0018264509824322654,-3.081128525962225e-5,-3.924294928095106e-8,-0.0018259745066705093,-3.0946791653507584e-5,-3.937422858396294e-8,-0.001825421200068397,-3.0992294321174295e-5,-3.942401662190722e-8,-0.001824848707194268,-3.091859675203208e-5,-3.936503312287334e-8,-0.0018243181665254498,-3.0732388589482095e-5,-3.920280801715213e-8,-0.0018238741939498265,-3.047033281073113e-5,-3.897033103345112e-8,-0.0018235344222076416,-3.0182968256406758e-5,-3.871343791162342e-8,-0.0018232907112232296,-2.9917962061241705e-5,-3.8475612220985564e-8,-0.0018231175915879915,-2.9709470223528575e-5,-3.8288287874661005e-8,-0.0018229820547856707,-2.9574767415543407e-5,-3.8167680241916334e-8,-0.0018228511227224586,-2.951575072500136e-5,-3.811601209651671e-8,-0.0018226963993247997,-2.9522399260808083e-5,-3.812455102291935e-8,-0.001822496346012939,-2.9576313361484465e-5,-3.817679071516764e-8,-0.00182223736569908,-2.9653667368211555e-5,-3.82511596794088e-8,-0.001821914484007764,-2.9727713244422272e-5,-3.8323339418991535e-8,-0.0018215319226575477,-2.9771325860086927e-5,-3.836859871537784e-8,-0.0018211033649289739,-2.9760077349048065e-5,-3.8364575828414726e-8,-0.0018206513209798074,-2.967600860452736e-5,-3.82946771372016e-8,-0.001820204868578569,-2.95117106918752e-5,-3.815177651088395e-8,-0.001819795308698592,-2.9273717903851084e-5,-3.7941337848129227e-8,-0.0018194499553985499,-2.8983792765006212e-5,-3.768268339819807e-8,-0.001819185216669178,-2.867678407238349e-5,-3.74071910297524e-8,-0.0018190008974349288,-2.83945853396037e-5,-3.715294339073842e-8,-0.001818877777254797,-2.8177048843502435e-5,-3.69565401325332e-8,-0.001818779842287521,-2.8051892787703585e-5,-3.684386725138177e-8,-0.0018186613648890997,-2.8026242318695985e-5,-3.682221547238342e-8,-0.0018184777104345217,-2.8082404782524753e-5,-3.687617397457534e-8,-0.0018181975534309522,-2.8179856821560048e-5,-3.6969212144048666e-8,-0.001817813196202531,-2.8264185854983048e-5,-3.705172966271644e-8,-0.001817345167041442,-2.8281685470529075e-5,-3.707441588866618e-8,-0.0018168381018592475,-2.8195553966210703e-5,-3.7003162870434875e-8,-0.0018163479603249767,-2.799754849487948e-5,-3.6829836985857307e-8,-0.0018159250008670967,-2.770979157575244e-5,-3.657403648862273e-8,-0.0018155995956956029,-2.7375894624095573e-5,-3.6275093682421794e-8,-0.0018153764219808644,-2.704596699485922e-5,-3.5978494998850386e-8,-0.0018152377869368145,-2.6762455524996808e-5,-3.572301447864534e-8,-0.001815152477201721,-2.6551760020655958e-5,-3.553302574177351e-8,-0.0018150853173970892,-2.6422470662984083e-5,-3.541677798998169e-8,-0.0018150042988686545,-2.6368080187245047e-5,-3.5368740905128105e-8,-0.001814884542944513,-2.637140326946383e-5,-3.5373559468304656e-8,-0.0018147098501943748,-2.640883213452553e-5,-3.540992975432918e-8,-0.001814472968339351,-2.6453705314678775e-5,-3.5453704890593495e-8,-0.0018141754822484056,-2.6478914642215583e-5,-3.548029701796509e-8,-0.0018138277280354835,-2.645933668573588e-5,-3.54668779570484e-8,-0.0018134485433922909,-2.63746995002284e-5,-3.539493771542412e-8,-0.0018130641999637516,-2.6213143484268603e-5,-3.525347116797519e-8,-0.0018127056529817164,-2.5975139443379584e-5,-3.504252776569707e-8,-0.0018124034131899443,-2.5676611824827752e-5,-3.477610412804476e-8,-0.0018121801872194175,-2.534931109205454e-5,-3.448259855575883e-8,-0.0018120429840718477,-2.503646524431114e-5,-3.420100849172037e-8,-0.0018119778375527472,-2.4783230392470123e-5,-3.3972382770939356e-8,-0.001811950347330866,-2.462408751833058e-5,-3.3828419190625865e-8,-0.0018119132838824324,-2.4571574822020067e-5,-3.3781151941416513e-8,-0.0018118193692635378,-2.461097139426063e-5,-3.381793208892705e-8,-0.0018116348830005524,-2.470333459138878e-5,-3.390395510139745e-8,-0.0018113494195414132,-2.479592830408992e-5,-3.399155855798691e-8,-0.0018109788397635016,-2.483652227449304e-5,-3.403315775348767e-8,-0.0018105608775236578,-2.4787225178468724e-5,-3.399388280325552e-8,-0.001810144903993606,-2.4634019749026035e-5,-3.386038668968676e-8,-0.0018097788424705386,-2.438943653685379e-5,-3.364343809426621e-8,-0.0018094970976968308,-2.408776623021186e-5,-3.3373712923926915e-8,-0.0018093131065530167,-2.3774611485516244e-5,-3.3092397700764274e-8,-0.0018092184234519324,-2.3494490111001275e-5,-3.283995827133673e-8,-0.0018091877331322158,-2.3280593294754563e-5,-3.2646790853564697e-8,-0.0018091871161683125,-2.314939866682767e-5,-3.252822506211939e-8,-0.0018091823293289193,-2.31004611501778e-5,-3.248421726376951e-8,-0.0018091448540584615,-2.311978262620908e-5,-3.250233499343941e-8,-0.0018090550794540737,-2.3184591180723153e-5,-3.2562086291900066e-8,-0.0018089031861997175,-2.3267897328885993e-5,-3.2639095018153503e-8,-0.0018086887334329814,-2.3342085624690892e-5,-3.2708403157821664e-8,-0.0018084198247745962,-2.338158487023955e-5,-3.2746898333729124e-8,-0.0018081122968712463,-2.3365150542970265e-5,-3.273533916353727e-8,-0.001807788822855228,-2.3278370617031e-5,-3.2660558495518114e-8,-0.0018074773359588981,-2.3116713555088714e-5,-3.251818044986732e-8,-0.0018072078836895496,-2.2888860456224638e-5,-3.231565942478291e-8,-0.0018070071067168634,-2.2619145607374683e-5,-3.2074584949186564e-8,-0.0018068904090166695,-2.2346867579039005e-5,-3.18301977417072e-8,-0.001806853807850492,-2.2119984734449717e-5,-3.162581546841964e-8,-0.0018068696241016469,-2.198255341150245e-5,-3.150153125112428e-8,-0.0018068904530553504,-2.195926967130759e-5,-3.1480191546692454e-8,-0.0018068624614854115,-2.2044177423088666e-5,-3.155704270849953e-8,-0.0018067433270976935,-2.2200245280886165e-5,-3.1699156433731375e-8,-0.0018065165630427827,-2.2371032429944445e-5,-3.1855811466588946e-8,-0.0018061958896326482,-2.2498959032548624e-5,-3.197492592167717e-8,-0.0018058190557784669,-2.2542034459431462e-5,-3.201819263383411e-8,-0.0018054353226003737,-2.2483393859611878e-5,-3.196979945333175e-8,-0.001805091981515879,-2.2332389766442987e-5,-3.183757466667896e-8,-0.0018048237525921153,-2.211905907663405e-5,-3.1648156894879373e-8,-0.0018046468284378982,-2.1884874969180767e-5,-3.1438765962970895e-8,-0.0018045577965828564,-2.167257080863706e-5,-3.124804952076372e-8,-0.0018045367469031802,-2.1517256483314775e-5,-3.1108003719807276e-8,-0.0018045532547471112,-2.1440415901790588e-5,-3.103843208390343e-8,-0.0018045734964459543,-2.1447606975861767e-5,-3.1044738831155513e-8,-0.0018045667264467702,-2.1529672691860464e-5,-3.111893588046535e-8,-0.0018045098804961046,-2.1666384245823865e-5,-3.1242914374253404e-8,-0.0018043898839023068,-2.183112130503548e-5,-3.1392708760228225e-8,-0.001804203954475141,-2.1995397908962797e-5,-3.1542638797071024e-8,-0.0018039586205425583,-2.2132522471774145e-5,-3.166864148494045e-8,-0.0018036682150897336,-2.222029327998615e-5,-3.1750683255942955e-8,-0.0018033532774611,-2.2243105107731316e-5,-3.1774601732825967e-8,-0.0018030388535303287,-2.2193945397383773e-5,-3.173385130063672e-8,-0.0018027522942073136,-2.2076575061598045e-5,-3.1631467135425805e-8,-0.0018025198123736337,-2.1907738260673892e-5,-3.148213395270582e-8,-0.0018023610503111382,-2.171835234695091e-5,-3.131339673265721e-8,-0.0018022817446064101,-2.155153029171974e-5,-3.1164020013668663e-8,-0.0018022664981731129,-2.145492195250491e-5,-3.107715875834362e-8,-0.0018022761116299893,-2.1466616576633423e-5,-3.1087611729159285e-8,-0.001802254637597213,-2.1598488185100718e-5,-3.1206666940015674e-8,-0.0018021472428660756,-2.182595909351053e-5,-3.1412695010306495e-8,-0.0018019218634438376,-2.2092822584774562e-5,-3.1655360838329714e-8,-0.0018015825756897933,-2.2331161258804622e-5,-3.187351846210822e-8,-0.0018011669858702807,-2.2485932648024347e-5,-3.2017362632812046e-8,-0.0018007305205330378,-2.2531424552391003e-5,-3.20632837968358e-8,-0.0018003274466781097,-2.247396849454174e-5,-3.201639378115172e-8,-0.001799997044701253,-2.2344006761817026e-5,-3.190352915618942e-8,-0.0017997576968600084,-2.2183994777753875e-5,-3.1762527108728355e-8,-0.0017996074214415598,-2.2037129804367622e-5,-3.163218737463046e-8,-0.0017995281388526994,-2.1939134700851098e-5,-3.1544874466880096e-8,-0.001799491474118722,-2.191336925847295e-5,-3.1522014871558e-8,-0.0017994648236848451,-2.196879034163294e-5,-3.157211653547259e-8,-0.0017994169612412726,-2.210030852102367e-5,-3.1690969385098476e-8,-0.0017993225970557186,-2.2291116208268445e-5,-3.1863685374065217e-8,-0.0017991654559053219,-2.2516364846537557e-5,-3.2068017711543623e-8,-0.0017989396964144166,-2.2747470340719118e-5,-3.2278281986817246e-8,-0.001798649733945888,-2.2956364822787877e-5,-3.246922246142647e-8,-0.0017983088087218547,-2.3119105042172602e-5,-3.2619262744900355e-8,-0.0017979368481374199,-2.3218557224021916e-5,-3.271288686018867e-8,-0.001797558043108042,-2.3246284945411038e-5,-3.274229168261259e-8,-0.0017971982454755217,-2.3203905608775542e-5,-3.2708591798824984e-8,-0.0017968820442133351,-2.3104089519329166e-5,-3.2622768771998037e-8,-0.0017966291126735867,-2.297111342990777e-5,-3.250628913382254e-8,-0.0017964493540700971,-2.2840186859440642e-5,-3.239064633254201e-8,-0.001796337092370337,-2.2753871040159905e-5,-3.231424590201427e-8,-0.001796266176874397,-2.2753701692947285e-5,-3.2314867821004395e-8,-0.0017961898758915664,-2.2866622884127602e-5,-3.241733430757836e-8,-0.0017960501969663332,-2.3089920943539757e-5,-3.261975895170297e-8,-0.0017957976108034395,-2.3383568322421448e-5,-3.288650179068292e-8,-0.0017954135250510931,-2.3679171476829465e-5,-3.315617804332179e-8,-0.0017949215447578652,-2.390518557869303e-5,-3.336437672142568e-8,-0.0017943787200954949,-2.401500851776904e-5,-3.3468942402757484e-8,-0.0017938521133034476,-2.400161061140643e-5,-3.346310636110839e-8,-0.0017933953283730748,-2.3893135268437862e-5,-3.3371567284018426e-8,-0.0017930360672664986,-2.3736813868647664e-5,-3.323619106299432e-8,-0.0017927757839283627,-2.3582117106361543e-5,-3.310107169625848e-8,-0.0017925963117210405,-2.3469363688785598e-5,-3.300241303329868e-8,-0.0017924682328384592,-2.342451096539411e-5,-3.296382113706184e-8,-0.0017923581550719071,-2.345828625550179e-5,-3.299539036168371e-8,-0.001792234150133278,-2.356759742598324e-5,-3.309481410911366e-8,-0.0017920696405059335,-2.3737980155055785e-5,-3.324947345493431e-8,-0.0017918461088012336,-2.3946656287756952e-5,-3.343914759620848e-8,-0.0017915547494891267,-2.416604836192296e-5,-3.363918826601897e-8,-0.0017911970460121622,-2.4367571375549456e-5,-3.382396166819764e-8,-0.0017907841940512808,-2.4525457139788785e-5,-3.3970302096064133e-8,-0.0017903353488858134,-2.4620205356925683e-5,-3.4060599419872674e-8,-0.001789874928831574,-2.464121873006898e-5,-3.408513361013069e-8,-0.0017894293545302076,-2.458842006514815e-5,-3.404350871950484e-8,-0.001789023505241213,-2.4472837169482275e-5,-3.394520600674971e-8,-0.0017886770648342907,-2.431614883409421e-5,-3.3809267595780996e-8,-0.0017884008200234735,-2.4149141187628658e-5,-3.366304609271047e-8,-0.001788192903348495,-2.4008712245158947e-5,-3.353964297579916e-8,-0.0017880354372265181,-2.393253545893989e-5,-3.347316905691076e-8,-0.0017878931539800256,-2.3950554353910987e-5,-3.34910405981934e-8,-0.0017877167144701928,-2.4073806065351983e-5,-3.360377068735919e-8,-0.001787453569690734,-2.428392045087678e-5,-3.379534491041236e-8,-0.0017870663495322726,-2.4530220442592966e-5,-3.402051298850108e-8,-0.0017865519910194932,-2.4741563720019448e-5,-3.4215448424805376e-8,-0.0017859491906381667,-2.4852189071213217e-5,-3.4321023197333045e-8,-0.001785325958533287,-2.482869995671932e-5,-3.4307016493753474e-8,-0.0017847528767015353,-2.4681669420333632e-5,-3.418245486606978e-8,-0.0017842781208460322,-2.4456188730650273e-5,-3.3987154219619505e-8,-0.0017839168488831807,-2.4210443635923462e-5,-3.3772695142451446e-8,-0.0017836554356915608,-2.3996010205156732e-5,-3.358499104157047e-8,-0.0017834629055072672,-2.384722325415727e-5,-3.345487005540549e-8,-0.0017833022278605421,-2.377911957973221e-5,-3.33961693481918e-8,-0.0017831382257718895,-2.3790191594592873e-5,-3.340803787799357e-8,-0.0017829420119458068,-2.386664304225821e-5,-3.347858835271957e-8,-0.0017826931337199766,-2.3986439556649512e-5,-3.35884337520014e-8,-0.001782380554182279,-2.4122805007119548e-5,-3.37138034186474e-8,-0.0017820030107513522,-2.424741808773985e-5,-3.382943346932811e-8,-0.0017815688268330704,-2.4333593880854584e-5,-3.391144581214018e-8,-0.0017810949919451016,-2.435957061890063e-5,-3.3940296734933424e-8,-0.0017806052023764001,-2.4311695591746605e-5,-3.3903609380761455e-8,-0.001780126733231539,-2.4186960953258744e-5,-3.3798419210927013e-8,-0.001779686389109376,-2.3994309151659606e-5,-3.363234575116789e-8,-0.0017793060255654567,-2.3754312161234117e-5,-3.3423362014270186e-8,-0.0017789982504817423,-2.3497003448101446e-5,-3.319796437690346e-8,-0.0017787629677499328,-2.325789658218794e-5,-3.2987743056121986e-8,-0.0017785853328477087,-2.307245026259536e-5,-3.2824528494159e-8,-0.001778435693719291,-2.29692203202828e-5,-3.2734270343295896e-8,-0.0017782724447692514,-2.2962114363640616e-5,-3.2729999425653523e-8,-0.0017780489744251891,-2.304310446279494e-5,-3.2805121499466924e-8,-0.0017777252482119056,-2.3178271529330762e-5,-3.292970232577239e-8,-0.0017772823647096638,-2.331129259651724e-5,-3.305351428606098e-8,-0.0017767346083272459,-2.3377529158287416e-5,-3.311868318348257e-8,-0.001776130764697321,-2.3326480780226323e-5,-3.3079844371637935e-8,-0.0017755397912121303,-2.3142506066602418e-5,-3.292267378791187e-8,-0.001775025923089456,-2.285130228165791e-5,-3.2669641431352325e-8,-0.001774626618706956,-2.2507845107702927e-5,-3.2369284423643596e-8,-0.0017743445685003865,-2.217390512592298e-5,-3.207630409849978e-8,-0.0017741544806826274,-2.1898231682136928e-5,-3.1834061464338805e-8,-0.0017740169436090173,-2.1707118952548065e-5,-3.166620956255327e-8,-0.001773891219541728,-2.1604779152879516e-5,-3.157692307526984e-8,-0.0017737432310165142,-2.157882930216389e-5,-3.155562491937049e-8,-0.0017735489504333692,-2.1606679331330368e-5,-3.1582552828697624e-8,-0.0017732949817235678,-2.1660754250425577e-5,-3.163336707176071e-8,-0.0017729779982578978,-2.1712249139899234e-5,-3.1682516270717386e-8,-0.0017726039251191308,-2.1733947237802756e-5,-3.170578892729579e-8,-0.0017721870422029683,-2.170274238348413e-5,-3.168258293259854e-8,-0.001771748742021881,-2.160228540957275e-5,-3.1598253034946674e-8,-0.001771315436498432,-2.142574791419228e-5,-3.144654198656495e-8,-0.0017709151725227585,-2.1178148251122183e-5,-3.123163082063926e-8,-0.0017705729667818262,-2.0877318554922502e-5,-3.096901728522543e-8,-0.00177030549185305,-2.055260685325797e-5,-3.0684433448224743e-8,-0.0017701162882080364,-2.0240789383713746e-5,-3.041032430169265e-8,-0.0017699929466398218,-1.99794218315807e-5,-3.018005089313501e-8,-0.0017699074633654773,-1.9798779288104986e-5,-3.002078373264498e-8,-0.0017698202590316055,-1.971411094245867e-5,-2.994657558110185e-8,-0.0017696875886955075,-1.9720002942223983e-5,-2.9953206911113435e-8,-0.0017694714315701055,-1.9788544043428927e-5,-3.0016365819494506e-8,-0.001769150179508032,-1.9872824099373976e-5,-3.009460999645151e-8,-0.0017687273917546744,-1.9916635597634004e-5,-3.013794933369788e-8,-0.0017682349328222557,-1.986951675134688e-5,-3.0101278511672435e-8,-0.00176772710105645,-1.970328034493384e-5,-2.995916376833186e-8,-0.0017672653670454336,-1.942323674398719e-5,-2.9715881402750377e-8,-0.0017668987135009146,-1.906762066737871e-5,-2.9404951820690843e-8,-0.0017666484557888058,-1.8694185914153163e-5,-2.9077305426574343e-8,-0.0017665045683398996,-1.836037649987278e-5,-2.8783779540595175e-8,-0.0017664336822339468,-1.810670803004512e-5,-2.85604298531802e-8,-0.0017663927590512497,-1.7949525459591675e-5,-2.8422063980110166e-8,-0.0017663414629926905,-1.7882936783559632e-5,-2.8363836548011972e-8,-0.001766249541876796,-1.7885707909765793e-5,-2.8367242121714928e-8,-0.001766099266242993,-1.7928819727490756e-5,-2.8406756909275128e-8,-0.0017658847993394775,-1.798137782732972e-5,-2.8455090069843767e-8,-0.001765610393070421,-1.8014480188581894e-5,-2.8486659197502897e-8,-0.0017652885448722823,-1.800366604960887e-5,-2.8479796999216368e-8,-0.0017649384258213695,-1.7930802219111313e-5,-2.8418420896184835e-8,-0.0017645842871166185,-1.778602853787445e-5,-2.829372109660203e-8,-0.0017642532352409623,-1.7569903288050705e-5,-2.81060198076404e-8,-0.001763971759473834,-1.7295278259522374e-5,-2.786641950500421e-8,-0.0017637607807011494,-1.698782162266873e-5,-2.7597305393828584e-8,-0.0017636298282722234,-1.668378910785923e-5,-2.7330463361969477e-8,-0.0017635720325075125,-1.6424062245120354e-5,-2.7101919283812356e-8,-0.0017635623160880396,-1.624485381333525e-5,-2.6943804573923697e-8,-0.0017635607308321933,-1.6167370096356146e-5,-2.6875224575923194e-8,-0.0017635211289864948,-1.6190012162179073e-5,-2.68952735608918e-8,-0.0017634030561349838,-1.6286391210993562e-5,-2.6981120973846906e-8,-0.0017631832067511017,-1.6410496829813158e-5,-2.7092420717209323e-8,-0.001762862804611093,-1.650784066444652e-5,-2.7181070789573557e-8,-0.001762468592752757,-1.6529538541808296e-5,-2.720366625840219e-8,-0.001762046894151369,-1.6445530812446836e-5,-2.713326263374019e-8,-0.0017616519554521687,-1.6253198861825676e-5,-2.696709599279156e-8,-0.0017613315225252794,-1.5978453405918325e-5,-2.672764292807032e-8,-0.0017611140058775958,-1.5668350101802668e-5,-2.645617877953825e-8,-0.0017610016624053787,-1.5377341425857762e-5,-2.6200694380823762e-8,-0.001760972152477191,-1.5152050261090025e-5,-2.6002466768736517e-8,-0.0017609872896826445,-1.5020078162915458e-5,-2.5886132235295784e-8,-0.0017610048499390252,-1.4986153105280482e-5,-2.585618781524479e-8,-0.0017609887967856529,-1.5035267740803247e-5,-2.5899659894477047e-8,-0.0017609151979063953,-1.5139768158020223e-5,-2.5992305073980463e-8,-0.001760773716567572,-1.5266958060346903e-5,-2.610532992986437e-8,-0.0017605661687073292,-1.5385079455718696e-5,-2.6210718388494383e-8,-0.0017603038826338377,-1.5467116653328303e-5,-2.6284636330568005e-8,-0.0017600050563999715,-1.5492918931559058e-5,-2.630931543163531e-8,-0.00175969254649456,-1.5450515709074643e-5,-2.6274181953792665e-8,-0.0017593918639489119,-1.5337330423786408e-5,-2.617687582404043e-8,-0.0017591287810466108,-1.516152233340109e-5,-2.6024399594225813e-8,-0.0017589258943309788,-1.4943092225619993e-5,-2.5834108333616962e-8,-0.0017587977883399433,-1.4713698844311321e-5,-2.563361964748376e-8,-0.001758745306123578,-1.4513557060983797e-5,-2.5458186180871662e-8,-0.0017587508567577885,-1.4384033445413648e-5,-2.534426611652559e-8,-0.0017587779139626098,-1.4356303112866524e-5,-2.5319563744401592e-8,-0.0017587774818432792,-1.4439371548397277e-5,-2.5392423095802513e-8,-0.0017587014180465244,-1.461308765223457e-5,-2.5545545630735418e-8,-0.0017585182143315644,-1.4831017637906244e-5,-2.573837988454579e-8,-0.001758224300036135,-1.5033522952700285e-5,-2.5918544356983626e-8,-0.0017578456814572269,-1.5165890121277228e-5,-2.6037769834404815e-8,-0.0017574296827317477,-1.5194062164951215e-5,-2.6065783871821737e-8,-0.0017570309130902051,-1.5112670663097581e-5,-2.5997452534758276e-8,-0.001756696813994369,-1.4944139321311835e-5,-2.5852086776316284e-8,-0.0017564568402563836,-1.473071652369088e-5,-2.566653582995585e-8,-0.0017563173354597894,-1.4522642160396031e-5,-2.548486082353178e-8,-0.0017562624354948073,-1.4365851015030895e-5,-2.5347546705261553e-8,-0.0017562599735600776,-1.4292151664489295e-5,-2.5282821848690496e-8,-0.001756270345717931,-1.4313890299943314e-5,-2.5301868529854778e-8,-0.0017562557588578422,-1.4423796145213121e-5,-2.5398581829437754e-8,-0.0017561874812613571,-1.4599191257972496e-5,-2.5553204717269587e-8,-0.0017560497205785389,-1.4808590783445874e-5,-2.573812424229174e-8,-0.0017558401001670073,-1.501849889141526e-5,-2.5923886858305346e-8,-0.0017555677036126833,-1.5198851791683837e-5,-2.6084035700955837e-8,-0.0017552499882569114,-1.5326523211685818e-5,-2.6198219746351277e-8,-0.0017549096171388453,-1.5387143092883683e-5,-2.625378099409158e-8,-0.0017545716844747704,-1.5375917958639373e-5,-2.624643446693762e-8,-0.0017542612485054693,-1.5298085448759974e-5,-2.618062930004095e-8,-0.0017540007404882867,-1.5169273450952789e-5,-2.6069861979063126e-8,-0.0017538066861335557,-1.5015531634949477e-5,-2.593675647987724e-8,-0.0017536853789179659,-1.4872118319182157e-5,-2.5812093138283254e-8,-0.0017536279768385933,-1.4779491480665109e-5,-2.5731383005018647e-8,-0.001753606952723239,-1.477510058162383e-5,-2.5727704626657337e-8,-0.0017535772625469973,-1.4881293853944655e-5,-2.5821044107833472e-8,-0.0017534854838303832,-1.5093084239007569e-5,-2.600743669074431e-8,-0.001753286710863749,-1.5372854528035302e-5,-2.6254185280220255e-8,-0.0017529628465813953,-1.5658309245887e-5,-2.650676375421154e-8,-0.0017525321779777868,-1.5882916451512282e-5,-2.6706754294287406e-8,-0.0017520438774256833,-1.599931632431093e-5,-2.6812413521358316e-8,-0.0017515603547515798,-1.599389242849295e-5,-2.6811474485739375e-8,-0.0017511370747768787,-1.58870721613282e-5,-2.6721446136561115e-8,-0.0017508085426400448,-1.5722498178991464e-5,-2.6580205900138525e-8,-0.001750583522276346,-1.5552126055896935e-5,-2.6433054088095324e-8,-0.0017504477988545496,-1.5423007708300132e-5,-2.6321212129111954e-8,-0.001750371174214469,-1.5368439711583733e-5,-2.62740633198849e-8,-0.001750315851837096,-1.5403810993203438e-5,-2.630543047416448e-8,-0.0017502443819633047,-1.552642617773328e-5,-2.641330452405617e-8,-0.0017501260881107377,-1.5718366270618406e-5,-2.6582255837826362e-8,-0.001749941315168841,-1.595138996435713e-5,-2.6787687878177625e-8,-0.0017496832210316077,-1.6192740022060927e-5,-2.7000937830024997e-8,-0.0017493572693855985,-1.6410744434680557e-5,-2.719422519070173e-8,-0.001748978948913387,-1.6579358203906588e-5,-2.7344668887639668e-8,-0.0017485704968312657,-1.6681163415333903e-5,-2.74369274282324e-8,-0.0017481574240992264,-1.670883282721197e-5,-2.7464466784574147e-8,-0.0017477653066889829,-1.666547427544194e-5,-2.742983935525184e-8,-0.0017474168841164288,-1.6564305460559376e-5,-2.7344394725503e-8,-0.001747129279233854,-1.6427879931202274e-5,-2.722763656186771e-8,-0.0017469110243550452,-1.6286771476204226e-5,-2.7106146180372478e-8,-0.0017467586534195868,-1.6177063093025705e-5,-2.7011472007132247e-8,-0.0017466533463252492,-1.6135412490742596e-5,-2.6975864478472212e-8,-0.0017465594178202246,-1.6190686058868135e-5,-2.7024931986323628e-8,-0.0017464276261986936,-1.6352739951425828e-5,-2.7167717614836124e-8,-0.0017462061719448097,-1.6602042086509395e-5,-2.7387475511613235e-8,-0.0017458589390846183,-1.688727509586495e-5,-2.7639480984314817e-8,-0.001745383793112345,-1.7137548063945405e-5,-2.7861723308800773e-8,-0.001744819115139456,-1.7287659579105718e-5,-2.7997065592867195e-8,-0.0017442316274042247,-1.7303833560797986e-5,-2.8015768007836517e-8,-0.0017436912573285538,-1.7194973975304273e-5,-2.7925287860788828e-8,-0.001743247452036388,-1.7004614184730193e-5,-2.7763247275154654e-8,-0.0017429180130239536,-1.6791404372740664e-5,-2.758049651565357e-8,-0.0017426913839497045,-1.6609904370917028e-5,-2.7424492345162885e-8,-0.001742536475141356,-1.649859690995107e-5,-2.7328913073261393e-8,-0.0017424137905466815,-1.6475754777084468e-5,-2.731001280582881e-8,-0.0017422844622990985,-1.6540670952381766e-5,-2.7367575703814308e-8,-0.001742116355369948,-1.6677544114767887e-5,-2.7488179361086792e-8,-0.0017418876343611228,-1.686031928037145e-5,-2.764933739189588e-8,-0.0017415883616594284,-1.70577248174131e-5,-2.782387438953023e-8,-0.0017412205022093819,-1.7238115114124338e-5,-2.7984175560639326e-8,-0.0017407965855088022,-1.737379930727008e-5,-2.8106002984605667e-8,-0.0017403372333003285,-1.744456666693547e-5,-2.81716008451723e-8,-0.0017398678463401798,-1.7440083829039737e-5,-2.817179627356715e-8,-0.0017394149398974874,-1.7360942313155324e-5,-2.8106908907450188e-8,-0.0017390025998627163,-1.7218462503755394e-5,-2.7986581351569095e-8,-0.0017386492629266872,-1.7033516940844868e-5,-2.78287765345854e-8,-0.0017383648667583472,-1.6834511621145167e-5,-2.7658071698212013e-8,-0.0017381483860776027,-1.6654526309760896e-5,-2.750323777098479e-8,-0.0017379857880764208,-1.6527352718845074e-5,-2.7393844848311547e-8,-0.0017378488996451671,-1.6481799532138352e-5,-2.735530264547702e-8,-0.0017376966372265247,-1.653390656976417e-5,-2.7402002468754002e-8,-0.0017374807521994074,-1.6678137811977933e-5,-2.752950967892001e-8,-0.0017371577619254865,-1.6881003467352378e-5,-2.7708880462880502e-8,-0.0017367058418978965,-1.7082956805723142e-5,-2.7888277038928824e-8,-0.0017361397871615877,-1.7213636041267133e-5,-2.8006313607759834e-8,-0.0017355130919502622,-1.7217983517437767e-5,-2.8014887489228886e-8,-0.0017349010873700975,-1.7080148864802256e-5,-2.789998107144859e-8,-0.0017343723348015217,-1.6829898005292252e-5,-2.7687166142917287e-8,-0.0017339647832955254,-1.6527764114669422e-5,-2.742869117101087e-8,-0.0017336786370508808,-1.6239846977128967e-5,-2.718170516827529e-8,-0.0017334849605685624,-1.6017009429821272e-5,-2.6990333500378085e-8,-0.0017333407869161536,-1.588567181395312e-5,-2.6877727087182345e-8,-0.0017332024740586718,-1.5848606242811324e-5,-2.6846667644146168e-8,-0.0017330340615586818,-1.5890746362680283e-5,-2.68844715727071e-8,-0.0017328110493750382,-1.598598400945783e-5,-2.696877596915934e-8,-0.00173252127473545,-1.6103053832416733e-5,-2.7072598915931684e-8,-0.0017321643150833425,-1.6210210138051937e-5,-2.716841036510506e-8,-0.0017317501140170313,-1.6278998147010685e-5,-2.723144593688566e-8,-0.0017312970188940173,-1.6287366080985484e-5,-2.7242447571344237e-8,-0.0017308292084595779,-1.6222185622260528e-5,-2.7189872388028625e-8,-0.001730373452436675,-1.6081006942388617e-5,-2.7071418830950497e-8,-0.0017299553582569695,-1.5872667604661172e-5,-2.6894553273205772e-8,-0.0017295955423252537,-1.5616500957420817e-5,-2.6675832877706237e-8,-0.0017293061873740823,-1.5340170469505593e-5,-2.6439061947713e-8,-0.0017290883470865532,-1.507625010199129e-5,-2.6212382075122478e-8,-0.0017289303472872032,-1.485771739629063e-5,-2.6024423253133448e-8,-0.0017288076171489378,-1.4712600788592941e-5,-2.5899692716363257e-8,-0.0017286843786890062,-1.4657982104751628e-5,-2.5853345982890227e-8,-0.0017285179920752429,-1.469378801204321e-5,-2.5885710544355952e-8,-0.0017282669016267444,-1.4797809692912494e-5,-2.597784298491023e-8,-0.0017279022709099565,-1.4924826606494031e-5,-2.6090678957383975e-8,-0.0017274210330882648,-1.5013539408658058e-5,-2.6171041964052904e-8,-0.0017268544886931924,-1.500339980186787e-5,-2.6166307322124555e-8,-0.0017262646488298942,-1.4857541654773406e-5,-2.6044338623451537e-8,-0.0017257250829835684,-1.4580494467278208e-5,-2.5808814537283378e-8,-0.0017252937794389228,-1.4218526667931194e-5,-2.5499476937908507e-8,-0.0017249930231404602,-1.3840794807331261e-5,-2.517585149150039e-8,-0.0017248067699141875,-1.351270711306445e-5,-2.4894335555473773e-8,-0.0017246934534974646,-1.3276295708485894e-5,-2.4691333401292228e-8,-0.0017246038274408126,-1.314433765536367e-5,-2.4578159853052325e-8,-0.0017244948196652298,-1.3105269854769773e-5,-2.454517288778279e-8,-0.0017243364526524838,-1.3132362073222714e-5,-2.456957312402072e-8,-0.0017241132667976712,-1.3192342565411862e-5,-2.4622786661510245e-8,-0.0017238228661482834,-1.325163183139236e-5,-2.4675851118792835e-8,-0.0017234735662261548,-1.3280343921097598e-5,-2.470291409721152e-8,-0.0017230820075737141,-1.3254924222723466e-5,-2.4683557620105018e-8,-0.0017226707950760843,-1.3160121817767504e-5,-2.4604525475472103e-8,-0.001722265910630456,-1.2990581890931382e-5,-2.4461095384133306e-8,-0.001721893605087852,-1.275194862461917e-5,-2.4258014835579526e-8,-0.0017215766694778005,-1.2461004044485085e-5,-2.400961012256891e-8,-0.0017213304202050618,-1.2144266502687791e-5,-2.373858904526001e-8,-0.0017211591144521662,-1.1834740035222872e-5,-2.3473278345894057e-8,-0.0017210536379387664,-1.15669121811399e-5,-2.3243368159746304e-8,-0.0017209912434660293,-1.137053703664978e-5,-2.3074600444917153e-8,-0.00172093786428734,-1.126418106526938e-5,-2.2983213066028008e-8,-0.0017208531150557185,-1.1249725559581083e-5,-2.2971150222902847e-8,-0.0017206977257007766,-1.1309037278010377e-5,-2.3023095245395752e-8,-0.0017204427559582552,-1.1404176889886242e-5,-2.3106548502949438e-8,-0.0017200791234227555,-1.1482681882738014e-5,-2.3176327687590162e-8,-0.0017196246541953794,-1.148889330573019e-5,-2.3184350335903796e-8,-0.001719124641958263,-1.1380227657635337e-5,-2.3093722950941158e-8,-0.0017186423638384035,-1.114361781624759e-5,-2.289295661201278e-8,-0.0017182400231541156,-1.0804036814357762e-5,-2.2603315828948557e-8,-0.0017179572397719124,-1.0418304686722344e-5,-2.2273489276189473e-8,-0.0017177979779009823,-1.0055136813138216e-5,-2.1962468500676522e-8,-0.0017177326568771723,-9.771363476111051e-6,-2.171915971274942e-8,-0.0017177126940655086,-9.59618259083335e-6,-2.1568855933039855e-8,-0.0017176882158911563,-9.528664202440341e-6,-2.151102115154199e-8,-0.0017176207842986657,-9.54532916023194e-6,-2.152570092195504e-8,-0.001717488539588401,-9.61114215968148e-6,-2.1582903167043163e-8,-0.0017172856020235222,-9.688935408136953e-6,-2.1650695633700068e-8,-0.0017170188075453885,-9.745503388018222e-6,-2.1700489974222203e-8,-0.001716704030343493,-9.75481187740589e-6,-2.1709853665659155e-8,-0.001716363051667733,-9.699527683861308e-6,-2.1663854398151375e-8,-0.0017160209740540878,-9.571902058244573e-6,-2.155581284513286e-8,-0.0017157037275235207,-9.374493289871258e-6,-2.1387892099804606e-8,-0.0017154351582843574,-9.12063251889091e-6,-2.1171465309349033e-8,-0.0017152334371241793,-8.834059379219236e-6,-2.0926792740536966e-8,-0.0017151070380174468,-8.54691461997685e-6,-2.0681324010697784e-8,-0.0017150511747853247,-8.295434661355793e-6,-2.0466057621787945e-8,-0.0017150460711992154,-8.113332137404114e-6,-2.030992124260642e-8,-0.0017150584488687581,-8.023886119027629e-6,-2.0233017236108107e-8,-0.0017150469068009022,-8.032794681682757e-6,-2.0240470470753276E-08,-0.0017149705846409252,-8.124212126971078e-6,-2.031895666669989e-8,-0.0017147992299687779,-8.261786867259084e-6,-2.043750161115691e-8,-0.0017145220766764634,-8.39524066367176e-6,-2.0553060054856926e-8,-0.001714152932724592,-8.471588872493842e-6,-2.062012893709478e-8,-0.0017137294505731322,-8.448766698921679e-6,-2.0602470471424994e-8,-0.0017133056268037235,-8.30827935977141e-6,-2.0484010951138584e-8,-0.0017129382965746429,-8.062726137621993e-6,-2.0275329834940626e-8,-0.0017126708829768335,-7.754388283059394e-6,-2.0012476947012425e-8,-0.0017125200757254853,-7.443621313326269e-6,-1.9747060849152198e-8,-0.0017124712795059404,-7.190431363037621e-6,-1.9530504080148718e-8,-0.001712485108463056,-7.0366396458408515e-6,-1.9398773754969298e-8,-0.0017125116285125956,-6.995979960543143e-6,-1.9363850589301513e-8,-0.0017125055152946264,-7.054904126090996e-6,-1.941433171688431e-8,-0.0017124362267456486,-7.181290036679982e-6,-1.9522819783303132e-8,-0.0017122912356786113,-7.33559115667751e-6,-1.9655458212988638e-8,-0.0017120739679193392,-7.480041670713854e-6,-1.9779851901213196e-8,-0.0017117993662422982,-7.584250733816216e-6,-1.9869913460128613e-8,-0.0017114893374762983,-7.627641340691138e-6,-1.9907989660052855e-8,-0.0017111690927208221,-7.6000125055850025e-6,-1.9885345225042433e-8,-0.0017108644073861132,-7.501412760528949e-6,-1.9802025000362843e-8,-0.0017105992780522003,-7.341978719606794e-6,-1.966667578346078e-8,-0.0017103933189507282,-7.1417111820099305e-6,-1.949632951528594e-8,-0.0017102585004460788,-6.929573781906971e-6,-1.9315642219774395e-8,-0.0017101954017993111,-6.7409497837180035e-6,-1.9154764556717096e-8,-0.0017101899463117245,-6.612514274616833e-6,-1.904501927146042e-8,-0.0017102124219094009,-6.574302226505446e-6,-1.9012164611844463e-8,-0.0017102208546907933,-6.640381461484933e-6,-1.906841604034119e-8,-0.0017101696872487946,-6.801430426475136e-6,-1.920604126355059e-8,-0.0017100221870999638,-7.023203351349197e-6,-1.939596217498844e-8,-0.0017097624173563275,-7.2532026779098715e-6,-1.959339512897098e-8,-0.0017094018542985613,-7.4343348959541015e-6,-1.9749511339903364e-8,-0.0017089776595243197,-7.520980981562084e-6,-1.982519953065219e-8,-0.0017085430785728673,-7.491875094526717e-6,-1.98021064005799e-8,-0.0017081533169143335,-7.355782261528479e-6,-1.968751486928549e-8,-0.0017078512816734047,-7.148736530329722e-6,-1.9512013140907094e-8,-0.0017076570788535014,-6.924050653939927e-6,-1.9321004792382517e-8,-0.0017075639301940206,-6.73805286028801e-6,-1.9162573935492407e-8,-0.0017075414744693901,-6.635623404704152e-6,-1.9075152574921577e-8,-0.0017075452538536885,-6.6397481673598866e-6,-1.907856769945405e-8,-0.0017075291279762277,-6.74799680854229e-6,-1.917095975773456e-8,-0.001707456464753147,-6.936270654025548e-6,-1.9331909124735297e-8,-0.001707306873839935,-7.167486224038338e-6,-1.9529815014463757e-8,-0.0017070774940020905,-7.40150152130711e-6,-1.9730384470556232e-8,-0.001706780055599116,-7.603160648750164e-6,-1.9903542367193303e-8,-0.0017064359548183703,-7.747073464223104e-6,-2.0027552034501053e-8,-0.0017060712869391593,-7.819370843360752e-6,-2.009053088308096e-8,-0.0017057128647851082,-7.81750689300007e-6,-2.0090272816758505e-8,-0.0017053853475831233,-7.749258787440385e-6,-2.0033369653230264e-8,-0.0017051090246987348,-7.63165252439743e-6,-1.9934273203516424e-8,-0.0017048976130836205,-7.48990374053086e-6,-1.9814391821666054e-8,-0.0017047556071532683,-7.355870167993619e-6,-1.9700800557958514e-8,-0.0017046752314598494,-7.265069438578037e-6,-1.962374814999241e-8,-0.001704633907873945,-7.251176602605976e-6,-1.9612010035070857e-8,-0.0017045942123405239,-7.337574074837141e-6,-1.968569133958673e-8,-0.0017045088636094908,-7.527447475358424e-6,-1.984773628854404e-8,-0.0017043321125059295,-7.796609969145614e-6,-2.0077728553648004e-8,-0.0017040352892301902,-8.094628881719389e-6,-2.033278529821439e-8,-0.0017036199174814714,-8.357321757473915e-6,-2.0558199710134475e-8,-0.0017031207453830734,-8.527279641554265e-6,-2.07049674527795e-8,-0.0017025957211632837,-8.573251713438601e-6,-2.0746330786424403e-8,-0.0017021073995130097,-8.499347348814524e-6,-2.0685612575558143e-8,-0.0017017044497118188,-8.341162243397592e-6,-2.0552915628861326e-8,-0.0017014101770728533,-8.152663137236833e-6,-2.0393996128262026e-8,-0.001701220123087332,-7.99029114266652e-6,-2.0256802195303342e-8,-0.0017011069963663247,-7.899440803721392e-6,-2.0180015465234488e-8,-0.0017010298088642021,-7.905934485141747e-6,-2.0185786978182623e-8,-0.0017009442845075707,-8.013087611659719e-6,-2.0277176829621546e-8,-0.001700812271449088,-8.203778005991368e-6,-2.043983579510598e-8,-0.001700608518360257,-8.446292559298515e-6,-2.0646923134808663e-8,-0.0017003238336688721,-8.702227743979316e-6,-2.086581340902206e-8,-0.0016999645473487364,-8.934420936028888e-6,-2.106486263485468e-8,-0.00169954913513485,-9.113190354238928e-6,-2.1218747636263865e-8,-0.0016991033874861217,-9.22001102864717e-6,-2.1311618593498575e-8,-0.0016986554807616981,-9.248647435155238e-6,-2.13380740034121e-8,-0.0016982318855080062,-9.204399731118582e-6,-2.1302519561850147e-8,-0.0016978543995590132,-9.10238542444722e-6,-2.121770451114759e-8,-0.0016975380294125626,-8.965565187764711e-6,-2.1103046899748445e-8,-0.0016972892355614753,-8.822716746064468e-6,-2.0982928734896224e-8,-0.001697104147393287,-8.706075816679848e-6,-2.0884721675880377e-8,-0.0016969666972081788,-8.647926619789557e-6,-2.0835920379221263e-8,-0.00169684740011825,-8.675181170249637e-6,-2.0859546028640884e-8,-0.0016967045804855362,-8.801519162920972e-6,-2.0967436610679105e-8,-0.0016964905065300056,-9.01844333619171e-6,-2.1152579343920042e-8,-0.0016961639731149969,-9.289415793960601e-6,-2.138406153842879e-8,-0.001695707106127775,-9.553311743058151e-6,-2.160998864081665e-8,-0.0016951385176591758,-9.741104001052941e-6,-2.1771702413548394e-8,-0.0016945128063564176,-9.801298769835388e-6,-2.1825425829586347e-8,-0.001693902985101117,-9.720976758235634e-6,-2.176009941619977e-8,-0.0016933741666031645,-9.529958261736527e-6,-2.1600847624303437e-8,-0.0016929627649807358,-9.286767509844959e-6,-2.1397063223247418e-8,-0.0016926700984223038,-9.056285660978077e-6,-2.1203544267075215e-8,-0.0016924690855679811,-8.890755742029625e-6,-2.1064502321326876e-8,-0.0016923170302585921,-8.819805710338477e-6,-2.1005150945671767e-8,-0.0016921682214408472,-8.8489478525651e-6,-2.1030391509463162e-8,-0.0016919833229793798,-8.963433333096914e-6,-2.1127991678712995e-8,-0.0016917350451069605,-9.1345146397534e-6,-2.1273812337831973e-8,-0.0016914106590955637,-9.326304850307346e-6,-2.1437577987506275e-8,-0.0016910119930584138,-9.50234733555081e-6,-2.158843896357954e-8,-0.0016905533915853798,-9.631291450467526e-6,-2.1699798048136526e-8,-0.0016900581754099764,-9.69110899668149e-6,-2.1752905508392625e-8,-0.0016895542586885487,-9.671493446052107e-6,-2.1738910779710982e-8,-0.0016890696305639124,-9.574362283327237e-6,-2.1659302094648493e-8,-0.0016886283866275086,-9.412685663855614e-6,-2.1524925607916213e-8,-0.001688247743667381,-9.208192002297713e-6,-2.1354054577412935e-8,-0.0016879360364431592,-8.98854909081757e-6,-2.1170017704178606e-8,-0.0016876914563649197,-8.784322466768402e-6,-2.0998642806816554e-8,-0.0016875013089274406,-8.625690463057586e-6,-2.086549585606093e-8,-0.0016873417279686287,-8.53858560005698e-6,-2.0792626469016813e-8,-0.001687178325547085,-8.539692110101775e-6,-2.079432297753112e-8,-0.0016869691166023061,-8.630151987089456e-6,-2.0871746461888742e-8,-0.0016866715029369072,-8.789267347131455e-6,-2.100754636158876e-8,-0.001686254318023176,-8.97163165767185e-6,-2.1163398058176738e-8,-0.0016857129301765929,-9.112940780203801e-6,-2.1284938230037018e-8,-0.0016850801573558933,-9.148161471228022e-6,-2.1317184884815498e-8,-0.001684422796496244,-9.037763226930734e-6,-2.122672379094548e-8,-0.0016838198027999708,-8.787797426035769e-6,-2.1018591580797273e-8,-0.0016833318949512636,-8.44940531154977e-6,-2.0735764854021037e-8,-0.0016829803888256231,-8.096954946202853e-6,-2.0440726785689123e-8,-0.0016827459755191082,-7.799047296914452e-6,-2.0191141842253217e-8,-0.001682583454796451,-7.598483392665845e-6,-2.0023083749209106e-8,-0.0016824406087873034,-7.507046345778621e-6,-1.9946647297024858e-8,-0.00168227233893414,-7.511005682637191e-6,-1.995050767444206e-8,-0.0016820477635596358,-7.580629314178077e-6,-2.0009840918065495e-8,-0.0016817519149339769,-7.679226904576688e-6,-2.0093885939198342e-8,-0.0016813844563981313,-7.770076038468931e-6,-2.017176810577966e-8,-0.00168095711875254,-7.821310599237092e-6,-2.02166337334569e-8,-0.0016804905773571324,-7.809332280904686e-6,-2.020854689581189e-8,-0.001680010953275545,-7.72105576611143e-6,-2.013639837823021e-8,-0.001679546036692029,-7.555014866778501e-6,-1.999884849506686e-8,-0.0016791214090587767,-7.3212178391739496e-6,-1.9804212819061585e-8,-0.0016787568208649483,-7.0396326381076e-6,-1.956919439356282e-8,-0.0016784633058374865,-6.737431280764423e-6,-1.9316573595337173e-8,-0.0016782413530992905,-6.445394475960026e-6,-1.907219462969039e-8,-0.001678080222805157,-6.193862700986028e-6,-1.8861571689255484e-8,-0.0016779584103784654,-6.008506027515523e-6,-1.8706342929766363e-8,-0.001677845249146384,-5.906093833141004e-6,-1.8620715185890165e-8,-0.0016777038192801804,-5.890290612856807e-6,-1.8607914310898255e-8,-0.0016774958004093384,-5.947719194763358e-6,-1.8656841222782147e-8,-0.0016771890493794792,-6.04551842846217e-6,-1.873997969081269e-8,-0.001676767832841618,-6.132885965309012e-6,-1.8814675758844495e-8,-0.0016762435242489034,-6.149771262434435e-6,-1.8830466334363702e-8,-0.0016756602448421592,-6.044400624246342e-6,-1.8743841862040513e-8,-0.001675087945535953,-5.795520152856072e-6,-1.8536922752685177e-8,-0.001674600133436057,-5.427392994706577e-6,-1.8229981102522346e-8,-0.0016742451149479186,-5.004926323171685e-6,-1.7877295972549893e-8,-0.0016740276746855878,-4.608399079730942e-6,-1.7546004506771972e-8,-0.0016739119980301556,-4.302510944871832e-6,-1.729026756861099e-8,-0.0016738412334485694,-4.117301795986611e-6,-1.7135338860309113e-8,-0.0016737597260480786,-4.047201977927108e-6,-1.7076725758927597e-8,-0.0016736272940627243,-4.062129813392705e-6,-1.708939796436854e-8,-0.0016734236526182423,-4.121225593287399e-6,-1.7139232302019368e-8,-0.0016731464204356393,-4.183527382690121e-6,-1.719194905092986e-8,-0.001672806667024793,-4.214324596648135e-6,-1.721846074771176e-8,-0.0016724243936852225,-4.1882372375009135e-6,-1.7197481453770475e-8,-0.0016720247121886067,-4.090499672781078e-6,-1.71166177315317e-8,-0.001671634560924054,-3.9173958791691575e-6,-1.697273167292582e-8,-0.0016712796064216253,-3.676148262014399e-6,-1.677183719774153e-8,-0.0016709811132979546,-3.3841381804794744e-6,-1.6528438089025636e-8,-0.001670752839878428,-3.067097445950772e-6,-1.626401154436992e-8,-0.0016705983902454557,-2.755995668689129e-6,-1.6004410253319553e-8,-0.0016705096420609104,-2.4827410471397807e-6,-1.5776279333381472e-8,-0.0016704667555038147,-2.2751486697532836e-6,-1.5602864533974782e-8,-0.001670440054529566,-2.151829226592785e-6,-1.5499751063543376e-8,-0.001670393800312215,-2.117817669325008e-6,-1.5471212409242127e-8,-0.001670291584102462,-2.1617204405963794e-6,-1.5507814775575798e-8,-0.0016701029794063543,-2.2550054075283997e-6,-1.5585801952800447e-8,-0.0016698110099757678,-2.354258371242796e-6,-1.5668961170856538e-8,-0.0016694193436379667,-2.4075797922360825e-6,-1.5713962061550806e-8,-0.0016689568880535386,-2.3659216383981152e-6,-1.5679837674904023e-8,-0.001668476255894404,-2.198389705642687e-6,-1.5540770761251108e-8,-0.0016680427111036224,-1.9070635849955495e-6,-1.5298448763090533e-8,-0.0016677138985701416,-1.5331708742942751e-6,-1.49871845626283e-8,-0.001667517861434114,-1.147223731015582e-6,-1.4665690841976024e-8,-0.0016674416245268775,-8.243545513833562e-7,-1.4396566986045408e-8,-0.0016674379465091208,-6.170824570407865e-7,-1.4223645290633774e-8,-0.0016674458929825874,-5.401446955353702e-7,-1.415932767755485e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_20.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_20.json deleted file mode 100644 index 1de0a547..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_20.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":20000,"numberOfSamples":1000,"samples":[0.002920358133904192,-6.784113942412794e-6,1.9052440314477163e-8,0.0029206413912713745,-6.613636446664559e-6,1.880279195741177e-8,0.0029208307139081857,-6.4248857259363685e-6,1.8526799455172666e-8,0.002920930147853429,-6.259580496894272e-6,1.8285299846459358e-8,0.002920958301557765,-6.151401288497133e-6,1.8127384394993633e-8,0.002920943527534336,-6.121517965926748e-6,1.8083876197142136e-8,0.002920918375602291,-6.176714362040785e-6,1.816459054828576e-8,0.0029209142523147777,-6.309966452545619e-6,1.8359183512205728e-8,0.0029209570493570875,-6.502919273456435e-6,1.864078390277559e-8,0.0029210641805222245,-6.729529878146821e-6,1.8971329337261025e-8,0.0029212431239192664,-6.960111764971586e-6,1.9307474224319167e-8,0.0029214911994797127,-7.165144308668532e-6,1.960613535377138e-8,0.002921796120285953,-7.318617634903727e-6,1.982935162046132e-8,0.002922137007124233,-7.4010933087209115e-6,1.994874542519259e-8,0.0029224858842140738,-7.402792330024526e-6,1.9950053694911065e-8,0.0029228100891597296,-7.3269133160290385e-6,1.9838013786501703e-8,0.0029230765056806078,-7.192875581754198e-6,1.9641124744988003e-8,0.002923258593947595,-7.038021661925838e-6,1.941411030247615e-8,0.0029233461420444737,-6.914897975233613e-6,1.9233867338703342e-8,0.0029233550561071457,-6.88082642372724e-6,1.9184132872670825e-8,0.002923331035256764,-6.979157664713172e-6,1.9328047777690732e-8,0.002923340142385916,-7.2183869507838524e-6,1.9677702094935728e-8,0.002923445583922481,-7.561828631160178e-6,2.0179192009197127e-8,0.002923681317946548,-7.937980661899995e-6,2.072789220706034e-8,0.0029240384097172193,-8.268180631197756e-6,2.1208898937220332e-8,0.0029244717828463846,-8.495446917109097e-6,2.1539128515592525e-8,0.0029249206337382287,-8.5993447870362e-6,2.168897594018406e-8,0.0029253292642615033,-8.593866031641322e-6,2.1679150221309016e-8,0.002925659785723746,-8.515407336314436e-6,2.1563040883823154e-8,0.0029258958667452545,-8.409144036535884e-6,2.140676187245665e-8,0.0029260405842169023,-8.318330424117874e-6,2.1273515340970926e-8,0.0029261116369550147,-8.277597083016847e-6,2.1213831819462888e-8,0.0029261360482877165,-8.309529221173803e-6,2.1260608728115165e-8,0.0029261452014683505,-8.42340926017503e-6,2.142729184107828e-8,0.002926170313882796,-8.615486024606374e-6,2.1708269585437497e-8,0.00292623844165663,-8.870566448345604e-6,2.2081201504360447e-8,0.00292636924853009,-9.164729529600066e-6,2.2511001728707966e-8,0.0029265727710682966,-9.46889441648262e-6,2.295507952203869e-8,0.0029268483980316373,-9.752900430721535e-6,2.336931848773817e-8,0.0029271851539575938,-9.989600330613871e-6,2.371405611551756e-8,0.0029275631112714875,-1.0158516530347245e-5,2.3959412562508196e-8,0.002927955664309901,-1.0248883948905652e-5,2.408973052847181e-8,0.002928332543885939,-1.0262052169211477e-5,2.4107097524156514e-8,0.002928663659626732,-1.0213176614852856e-5,2.4033835922844377e-8,0.002928924086482032,-1.0131859571605514e-5,2.391343414198871e-8,0.002929100469893201,-1.006068720901442e-5,2.380835533385682e-8,0.00292919825272032,-1.0049779074946679e-5,2.3791978424671676e-8,0.0029292472514429032,-1.0145544621233506e-5,2.3932078427797663e-8,0.0029293008561212352,-1.0374107175155202e-5,2.4266580620660107e-8,0.0029294238469290295,-1.0725024417737487e-5,2.4779841229322424e-8,0.002929669111734987,-1.114611883277768e-5,2.539521780426727e-8,0.0029300535325597157,-1.1558053316444333e-5,2.599647534430263e-8,0.0029305485124082784,-1.1884615009568598e-5,2.647210161222967e-8,0.0029310923955805034,-1.2081611605397568e-5,2.675757842754958e-8,0.002931616304399638,-1.2148069338781219e-5,2.6851763811636517e-8,0.002932067285150511,-1.2117575796211164e-5,2.6804177118692685e-8,0.002932418917621506,-1.2040100109443465e-5,2.6688285414068273e-8,0.002932670230039864,-1.1965464765100921e-5,2.657720810322275e-8,0.0029328387680504554,-1.1933289258766363e-5,2.6528961772784398e-8,0.00293295270881014,-1.196897681852962e-5,2.658062017342903e-8,0.002933044376699607,-1.2083490982675024e-5,2.67480469420976e-8,0.0029331455921541476,-1.2274805413081184e-5,2.7028061070784242e-8,0.002933284292138651,-1.2529877406152909e-5,2.7401345594697467e-8,0.00293348183921598,-1.2826952297089921e-5,2.7835835906596038e-8,0.0029337508490475143,-1.3138354603080276e-5,2.829083170402535e-8,0.002934093645838865,-1.3433894030281315e-5,2.872201713802254e-8,0.0029345016544849406,-1.3684880135773215e-5,2.908736254701938e-8,0.0029349561406361926,-1.386840837531521e-5,2.935340201831078e-8,0.002935430486740117,-1.3971275110489517e-5,2.95009506018706e-8,0.002935893835760189,-1.3992889279387817e-5,2.9529348563241594e-8,0.002936315747796631,-1.3946693107954746e-5,2.9458526641335536e-8,0.0029366714399644074,-1.3859725730502529e-5,2.9328347332084718e-8,0.0029369471463227275,-1.3770076163005065e-5,2.919483182596872e-8,0.0029371450608840764,-1.3721886782902614e-5,2.912277265954847e-8,0.002937286864066753,-1.3757394229001907e-5,2.917400350300773e-8,0.0029374138979444495,-1.3905986529102212e-5,2.9391340967481903e-8,0.002937581299334286,-1.4172039349156543e-5,2.9780814874648412e-8,0.002937844163109093,-1.45262281968288e-5,3.029905020497397e-8,0.0029382377175291947,-1.4907319198974039e-5,3.085599616240686e-8,0.0029387598782889463,-1.5239082205155629e-5,3.13397558100923e-8,0.0029393676298225253,-1.5457827043506526e-5,3.165695446938089e-8,0.002939992216838139,-1.5536378976067384e-5,3.1767915909756623e-8,0.0029405653190518453,-1.5490797301223943e-5,3.169654522724492e-8,0.002941041254771594,-1.536815347138079e-5,3.151235350452084e-8,0.00294140542344543,-1.5225670745632641e-5,3.129971116966001e-8,0.0029416699353257774,-1.511314588614597e-5,3.113191036723647e-8,0.002941863403875871,-1.5063955018859357e-5,3.105791466104839e-8,0.002942020994539501,-1.5093505935668198e-5,3.110013611490886e-8,0.002942177366646585,-1.520170158147927e-5,3.125814014183412e-8,0.0029423625508156873,-1.537654151057894e-5,3.1514004634474597e-8,0.002942599690849947,-1.559743059921687e-5,3.183721614696178e-8,0.00294290359336924,-1.5838011990550073e-5,3.2188849522134435e-8,0.00294327957060671,-1.606891948600009e-5,3.252562907878252e-8,0.002943722566359027,-1.626091105834113e-5,3.2804552667574874e-8,0.0029442169460562008,-1.6388674978272435e-5,3.2988495583917805e-8,0.002944737613991192,-1.643514977217652e-5,3.3052553288382284e-8,0.002945253028492552,-1.6395599116742716e-5,3.299000825108424e-8,0.0029457301748656087,-1.6280316984019043e-5,3.2816276383530096e-8,0.0029461409054937337,-1.6114844458962526e-5,3.2569189442586106e-8,0.002946468467779173,-1.59369584836108e-5,3.230452078197805e-8,0.0029467127007430827,-1.5790452065963385e-5,3.20867790313752e-8,0.002946892484190752,-1.571653783339316e-5,3.19765091292342e-8,0.0029470444074099875,-1.574421226294738e-5,3.201610119609517e-8,0.00294721700040216,-1.5881334913556607e-5,3.2216717921521556e-8,0.002947460426363542,-1.6108825234197094e-5,3.2549869520431156e-8,0.002947812788728661,-1.6380947123874963e-5,3.294795449427606e-8,0.002948286406491707,-1.663423983095662e-5,3.3317466246604255e-8,0.0029488597757889802,-1.6805051579412595e-5,3.356478318315856e-8,0.0029494809972528905,-1.6850594771345913e-5,3.362711592054566e-8,0.0029500837834087173,-1.6764027436157334e-5,3.3494691584581735e-8,0.002950609547099543,-1.65754022846451e-5,3.321214488618771e-8,0.0029510248489415226,-1.6338277873894157e-5,3.285874310463184e-8,0.002951326908519711,-1.6110067758768604e-5,3.251932528889389e-8,0.002951537740617979,-1.5935923031543694e-5,3.226045946019777e-8,0.002951692897861342,-1.5841154803625142e-5,3.2119268917177497e-8,0.0029518308167177263,-1.5831373922113136e-5,3.210371527010424e-8,0.002951985680243071,-1.5896753371837802e-5,3.219898309769699e-8,0.0029521838394617654,-1.6017149276703177e-5,3.237510141211502e-8,0.0029524425171660266,-1.6166416508957604e-5,3.259333287301716e-8,0.002952769476479237,-1.631566760743691e-5,3.281097659429368e-8,0.0029531628666808734,-1.6435949662826805e-5,3.298530817637135e-8,0.002953611072809355,-1.6501010877409013e-5,3.307765926789581e-8,0.0029540929521073237,-1.6490693620487103e-5,3.305842467294873e-8,0.002954579264429746,-1.639499922671663e-5,3.291305556929234e-8,0.00295503617946976,-1.6218085914775832e-5,3.264794315872196e-8,0.0029554312636725514,-1.598068794654785e-5,3.2293958485677294e-8,0.002955741283648492,-1.5719093070127868e-5,3.1904895652031e-8,0.002955959806034109,-1.547937573783238e-5,3.154889715991773e-8,0.0029561017019983917,-1.5307268455907255e-5,3.129343797151466e-8,0.002956202124345455,-1.5236171399037398e-5,3.118759456372629e-8,0.002956309344895545,-1.5277053681785616e-5,3.124717312307237e-8,0.002956473061121083,-1.5413664099591182e-5,3.144774573045378e-8,0.002956731321048645,-1.56048785559379e-5,3.1728248939181924e-8,0.00295709965139376,-1.5793981380019647e-5,3.20047831722283e-8,0.002957565526219128,-1.592284518104132e-5,3.2191570296512827e-8,0.002958090281759539,-1.5947524626471783e-5,3.2223937815342005e-8,0.0029586188407144266,-1.5850738642942996e-5,3.2076690446522256e-8,0.002959094945026436,-1.5646720190761735e-5,3.177121976954928e-8,0.002959476848073268,-1.5376083073574004e-5,3.136786811924238e-8,0.0029597476091094625,-1.5092533249955837e-5,3.094622473963542e-8,0.0029599165389014807,-1.4847001851064014e-5,3.058161120537158e-8,0.0029600126576895124,-1.4675368085643121e-5,3.032691574396036e-8,0.0029600742944759875,-1.4593152680899354e-5,3.020479859533819e-8,0.0029601393336397405,-1.4596748310243467e-5,3.020960605628144e-8,0.002960238698290419,-1.4668406120361078e-5,3.031483113270092e-8,0.002960393348094185,-1.4782054688900286e-5,3.048176038556993e-8,0.0029606137208240614,-1.4908213038661743e-5,3.0666732803764704e-8,0.002960900307724539,-1.5017561814104221e-5,3.082638893027108e-8,0.002961244434757364,-1.50835587775595e-5,3.092151102287129e-8,0.0029616289196745093,-1.508481954343969e-5,3.092053838966425e-8,0.0029620288994349014,-1.5007922270276185e-5,3.080373072655211e-8,0.002962413625758523,-1.485083932757977e-5,3.056826258788275e-8,0.0029627502369207145,-1.4626387490437281e-5,3.023332794121676e-8,0.002963010182597418,-1.4364071234967201e-5,2.9842834228472034E-08,0.002963177767764606,-1.4107920694885702e-5,2.9462135061082662e-8,0.002963258245024794,-1.390835698351417e-5,2.9165907356940043e-8,0.002963281197327158,-1.3808595017261191e-5,2.9017964910745684e-8,0.0029632955592347656,-1.3829869002871433e-5,2.9049396981577167e-8,0.0029633562901483323,-1.396211303207011e-5,2.9244867118890364e-8,0.002963507429295757,-1.4165122782118485e-5,2.9544476640865564e-8,0.0029637685076608447,-1.4380196230406393e-5,2.986111941278739e-8,0.0029641293995320965,-1.4547336536681909e-5,3.010599812437667e-8,0.0029645544477331213,-1.462147944059388e-5,3.021262159737794e-8,0.002964993199433165,-1.4582947790407866e-5,3.015220993420224e-8,0.002965393786237881,-1.4440252912374524e-5,2.993775541428279e-8,0.002965715263846332,-1.4225700000439636e-5,2.9617431791449873e-8,0.002965936105661564,-1.3985740295725363e-5,2.926023813664994e-8,0.0029660572013795127,-1.3768956215185547e-5,2.893816297894991e-8,0.0029660991821764673,-1.361495218959358e-5,2.8709729777681658e-8,0.0029660954822132313,-1.3546940317984253e-5,2.8609061319606824e-8,0.0029660836753954115,-1.3569374678669404e-5,2.86424548981107e-8,0.002966097715672726,-1.3670152439685494e-5,2.8791723939980673e-8,0.002966162758787371,-1.382559151959131e-5,2.9021622975413763e-8,0.002966292909415142,-1.4006141463460001e-5,2.9288313696922994e-8,0.0029664912327432187,-1.4181368889154244e-5,2.9546719679842586e-8,0.00296675098439865,-1.432364071392131e-5,2.975594063607446e-8,0.0029670571768570203,-1.441068763053631e-5,2.988302426452729e-8,0.0029673880824924595,-1.4427641005829092e-5,2.990599124607975e-8,0.0029677168251591012,-1.4369146872198044e-5,2.9817001755657374e-8,0.002968013691011178,-1.4241810907193253e-5,2.962601250879183e-8,0.0029682500709710805,-1.4066513065220714e-5,2.93642059457502e-8,0.002968404731954602,-1.387910107568484e-5,2.9084963591962518e-8,0.002968471978193223,-1.3727039399383037e-5,2.88588007731629e-8,0.002968469059433979,-1.3659767445614165e-5,2.875897632722551e-8,0.0029684378958154877,-1.3713145157645224e-5,2.8838395498620046e-8,0.00296843646941631,-1.3893353069001035e-5,2.9105800690051132e-8,0.0029685202671800416,-1.4169383669450605e-5,2.9514779524273305e-8,0.0029687215722676882,-1.4480741544933563e-5,2.997532983204709e-8,0.0029690374925616814,-1.4758063993347154e-5,3.038452227517716e-8,0.002969432550313911,-1.494625005415047e-5,3.0660807023103234e-8,0.0029698527534371528,-1.501941615613648e-5,3.076614564288683e-8,0.002970242975131316,-1.4983590593674082e-5,3.070991787329774e-8,0.002970560707010411,-1.486978332026129e-5,3.053852833456252e-8,0.002970783380041674,-1.4722598896256202e-5,3.031840881526067e-8,0.0029709096528671933,-1.4588664344004444e-5,3.01187930361603e-8,0.0029709563531596737,-1.4507263299708571e-5,2.999782950169233e-8,0.0029709528196634203,-1.450412607323851e-5,2.9993430059943106e-8,0.0029709340930672533,-1.4588613765477793e-5,3.011917526326649e-8,0.0029709342235076834,-1.4754157039491757e-5,3.036503994043903e-8,0.0029709808089967682,-1.4981337496558506e-5,3.070201327711546e-8,0.0029710914938153535,-1.524256500555707e-5,3.1089054340748793e-8,0.0029712726180356206,-1.5507206205397086e-5,3.1480689014010646e-8,0.0029715197167699482,-1.5746211713835314e-5,3.1833846061620287e-8,0.002971819217195222,-1.5935676545529305e-5,3.211310994113541e-8,0.0029721506391493777,-1.6059298169857467e-5,3.2294356226821274e-8,0.002972488915422919,-1.6110085669579795e-5,3.236730284468479e-8,0.0029728068475521232,-1.609171171330991e-5,3.233754856855953e-8,0.0029730780491342918,-1.6019684593364873e-5,3.2228331099957483e-8,0.002973280996517472,-1.5922014544477006e-5,3.2081488017266414e-8,0.002973404663571169,-1.5838170077771026e-5,3.195582334149546e-8,0.0029734552005521004,-1.581431674792034e-5,3.1919928221359786e-8,0.002973461188362297,-1.589302000644207e-5,3.2036819078499595e-8,0.0029734728689441363,-1.609792381140514e-5,3.234121094806937e-8,0.0029735507610109523,-1.6418860094304986e-5,3.281753040259766e-8,0.002973744280704623,-1.6807320664665265e-5,3.3393348896120576e-8,0.0029740698756861514,-1.7189700640362698e-5,3.395915574472174e-8,0.002974502213153519,-1.7494403406110863e-5,3.4408643234550394e-8,0.002974984560957685,-1.767802825408724e-5,3.4677597890506306e-8,0.0029754513730213712,-1.773672456282881e-5,3.476073805538473e-8,0.002975849730807777,-1.7700253301847003e-5,3.470280180238341e-8,0.0029761508530331345,-1.7616516953682456e-5,3.4575409590022556e-8,0.0029763511916333146,-1.7535807952942615e-5,3.445351817065031e-8,0.0029764671850589274,-1.7499734982786542e-5,3.439891544803893e-8,0.002976527814731713,-1.753553605886131e-5,3.445182277720747e-8,0.0029765674333753333,-1.7654482487030005e-5,3.462863214504655e-8,0.0029766197783471023,-1.785285028144174e-5,3.4923452338110174e-8,0.002976713303471049,-1.8114495901758313e-5,3.531200044507124e-8,0.00297686786306883,-1.841450460826479e-5,3.575704849602197e-8,0.002977092820345906,-1.8723439945705067e-5,3.6214741069552453E-08,0.0029773865940886136,-1.9011730919729806e-5,3.6641106825301627e-8,0.00297773758195352,-1.9253744086145604e-5,3.6998098021908325e-8,0.002978126225410339,-1.9431077092030192e-5,3.725847234837322e-8,0.002978527778364898,-1.953481608938666e-5,3.740914085341509e-8,0.0029789154040244796,-1.9566826718393777e-5,3.7453087807647996e-8,0.002979263474936315,-1.9540223734977267e-5,3.741007038668588e-8,0.002979551126528603,-1.9479037319080024e-5,3.731610210216535e-8,0.002979766242014358,-1.9416859969519788e-5,3.722137847792964e-8,0.0029799099497124348,-1.9393715173435276e-5,3.7185523694292244e-8,0.002980000915971834,-1.94498533312271e-5,3.7268276541520824e-8,0.0029800772524500073,-1.9615566721707554e-5,3.7514326950814606e-8,0.002980192469529219,-1.9898167604817833e-5,3.7934040287157073e-8,0.0029804022602219083,-2.0271164712515565e-5,3.8487521814506124e-8,0.0029807434701728474,-2.067424132501533e-5,3.9084720785291444e-8,0.0029812147089178787,-2.1030261025836366e-5,3.961077233026522e-8,0.0029817719928732045,-2.127449949752043e-5,3.99694784583061e-8,0.0029823449666828935,-2.1379992430783766e-5,4.0121037663042906e-8,0.0029828645165091085,-2.136410513008704e-5,4.009182899623436e-8,0.0029832854451143304,-2.127531976246566e-5,3.995464665032265e-8,0.002983594498668351,-2.1171712511966522e-5,3.97964527218785e-8,0.0029838054954291746,-2.1103248487216302e-5,3.9691834147374094e-8,0.002983948836829765,-2.110276132606735e-5,3.968953147631429e-8,0.002984061290257191,-2.1184288397485705e-5,3.981006008442894e-8,0.002984178513731084,-2.1345484561751207E-05,4.004945855912969e-8,0.00298433040769511,-2.157146104983014e-5,4.0385128619668554e-8,0.002984538433971821,-2.183875045296736e-5,4.078179890719198e-8,0.002984814157245484,-2.2119128743535838e-5,4.1197228817699106e-8,0.0029851587068223267,-2.2383338100873876e-5,4.158774803164346e-8,0.0029855631058775885,-2.260472386163859e-5,4.191366897386889e-8,0.002986009558291577,-2.2762699849510053e-5,4.214444460091879e-8,0.002986473810408079,-2.2845709776562213e-5,4.226307152736928e-8,0.0029869284555065143,-2.285321248440732e-5,4.226903134195116e-8,0.0029873468009023675,-2.279640960153469e-5,4.217934987696174e-8,0.0029877069362470323,-2.2697618488155953e-5,4.202762496290873e-8,0.002987995706883981,-2.2588196005956238e-5,4.186087368514205e-8,0.0029882122724941918,-2.250493424394035e-5,4.173407992678916e-8,0.002988370845250907,-2.2484777608857293e-5,4.170223881865493e-8,0.0029885017936435655,-2.255756728162393e-5,4.180950622118746e-8,0.002988649508545319,-2.2737002269993502e-5,4.20757789848222e-8,0.002988864944534272,-2.3011660125789477e-5,4.248345478531366e-8,0.0029891917531914853,-2.3340375925996207e-5,4.2970713042447454e-8,0.0029896486141179545,-2.3657833305475466e-5,4.3439950290240724e-8,0.002990215930999584,-2.3893473135528555e-5,4.378597223794274e-8,0.0029908371871804683,-2.399812996226874e-5,4.393568517521914e-8,0.0029914382467285117,-2.396417191820179e-5,4.3878147729951906e-8,0.0029919551613743003,-2.38265851199188e-5,4.3666186218943454e-8,0.0029923547556799392,-2.364535922564181e-5,4.33899815622375e-8,0.0029926388924618567,-2.34815530183942e-5,4.314111317342226e-8,0.0029928352743501543,-2.3379858232251807e-5,4.298635560434982e-8,0.002992983643000855,-2.3362211966869825e-5,4.2958145653724355e-8,0.002993124239325345,-2.3429729514789833e-5,4.305762336091702e-8,0.0029932908205783236,-2.3568260581625195e-5,4.3263117748307686e-8,0.0029935075467194595,-2.3754218892099406e-5,4.353897939933425e-8,0.002993788115402275,-2.3959322132927218e-5,4.3842700238288005e-8,0.002994135865131543,-2.415427368613513e-5,4.413039745178603e-8,0.002994544317604473,-2.431187474329782e-5,4.436143642962751e-8,0.0029949981369148688,-2.4409940834154676e-5,4.4502773677267694e-8,0.002995474733920963,-2.4434159363146072e-5,4.453322269139798e-8,0.002995946867852737,-2.438065412063379e-5,4.444727962470359e-8,0.0029963863997792425,-2.4257633800533217e-5,4.425756592263305e-8,0.0029967688850502656,-2.4085455016201706e-5,4.399488097416399e-8,0.002997078338300538,-2.3894673268282683e-5,4.370522458009922e-8,0.002997311349129843,-2.3721945852451404e-5,4.344359182276227e-8,0.002997479656226587,-2.360404297666528e-5,4.32649398235654e-8,0.0029976103593761477,-2.357065305448074e-5,4.3213385803306306e-8,0.002997743110787153,-2.3636926496027646e-5,4.3311086910764544e-8,0.002997923748088096,-2.379704664473801e-5,4.354874311053949e-8,0.0029981942175954005,-2.4020889171051923e-5,4.388077348084879e-8,0.0029985799058661606,-2.4256592745038067e-5,4.422930981774514e-8,0.0029990778745615423,-2.444143335305884e-5,4.450051619084297e-8,0.002999651934402648,-2.4520419116148653e-5,4.461236561595702e-8,0.003000240119555401,-2.4466536425871935e-5,4.452486712152954e-8,0.0030007744382348467,-2.4292342453891288e-5,4.4257372821343864e-8,0.0030012043836071256,-2.4045254021272564e-5,4.388146492212079e-8,0.003001512146798215,-2.3788596603881732E-05,4.3492440534199405e-8,0.003001713011004348,-2.3579216292932016e-5,4.3175608587979206e-8,0.0030018440201570076,-2.345253767991309e-5,4.298382851303703e-8,0.0030019492490419297,-2.3418849803166555e-5,4.293202980731309e-8,0.0030020683571267115,-2.3467794115789163e-5,4.300412504387121e-8,0.003002230577040951,-2.3575924418412295e-5,4.3164515275253525e-8,0.0030024530481396073,-2.371369072928725e-5,4.336864156691746e-8,0.0030027414546316424,-2.3850507219765965e-5,4.357057053753451e-8,0.0030030914014577796,-2.395813305179184e-5,4.3728004665977624e-8,0.003003489836964812,-2.4013129247926298e-5,4.3805913400348664e-8,0.003003916505986112,-2.3999045197511412e-5,4.3779791639210484e-8,0.0030043458018004154,-2.3908648392456543e-5,4.3639009503235175e-8,0.003004749546491452,-2.3746015567883387e-5,4.338995688522113e-8,0.0030051010544452283,-2.3527756377723387e-5,4.305786620408989e-8,0.003005380278727441,-2.3282359290256304e-5,4.268578367873625e-8,0.0030055791218540325,-2.3046814799346892e-5,4.232942511550203e-8,0.003005705403471987,-2.2860300990568903e-5,4.2047613637055405e-8,0.0030057838269298923,-2.2755768795899834e-5,4.188959157506121e-8,0.0030058528292368726,-2.275134395340437e-5,4.188212374752424e-8,0.003005957307061821,-2.2843946110056914e-5,4.2020014794074984E-08,0.003006138413427418,-2.300724171618979e-5,4.226319699714995e-8,0.0030064225790959894,-2.319527741556905e-5,4.254234844837243e-8,0.003006812562702178,-2.335201743558618e-5,4.277330694714285e-8,0.0030072836012702583,-2.3425444976355578e-5,4.2878234687331705e-8,0.003007787264335132,-2.3382901257872224e-5,4.280856410095554e-8,0.003008263689228249,-2.3222450315454287e-5,4.2561953877304193e-8,0.0030086592071474436,-2.2974830200955383e-5,4.218511547518296e-8,0.0030089426676550976,-2.26937486182808e-5,4.17591305405803e-8,0.00300911333844383,-2.2438134195979213e-5,4.137267939823414e-8,0.003009197487585295,-2.225432969879038e-5,4.1095226879594374e-8,0.003009236757661162,-2.216547948200621e-5,4.0961121500672567e-8,0.003009274709149118,-2.217043771176245e-5,4.09681037873079e-8,0.0030093468102407217,-2.224960297551781e-5,4.108625065125137e-8,0.003009475717436156,-2.2373205783984607e-5,4.1270546851323725e-8,0.003009670815179887,-2.250862585044295e-5,4.147189797251425e-8,0.0030099299700386954,-2.2625428795493783e-5,4.164463699013084e-8,0.00301024187402901,-2.269838136100306e-5,4.1750971465696804e-8,0.003010588197802463,-2.2709282253166442e-5,4.17636812926794e-8,0.0030109454772800953,-2.2648401738654642e-5,4.1668279995880246e-8,0.0030112871514783373,-2.2515993789587058e-5,4.1465320020488957e-8,0.003011586410402015,-2.2323777967550487e-5,4.1172650945728414e-8,0.003011820354517727,-2.2095615453953176e-5,4.082642765490463e-8,0.0030119753682766987,-2.1866121724890676e-5,4.0478962804724885e-8,0.0030120526329220835,-2.167596603147096e-5,4.019155827324615e-8,0.003012071619005174,-2.1563470526289128e-5,4.002177521312465e-8,0.0030120689879420764,-2.1553983387326334e-5,4.0007412510859045e-8,0.0030120914835277484,-2.1650539471334874e-5,4.015251477306536e-8,0.003012183981443884,-2.1829957093484467e-5,4.0421644155871945e-8,0.003012376436940448,-2.2046872823385574e-5,4.074612539538994e-8,0.003012674385510726,-2.2245060636632923e-5,4.104120937557746e-8,0.003013056385483303,-2.237249037808146e-5,4.122877520759659e-8,0.003013479206572159,-2.2395363336080645e-5,4.125840285038834e-8,0.00301388907552939,-2.2307009988112173e-5,4.112064949092303e-8,0.003014235716569667,-2.21292539477236e-5,4.0848957479960844e-8,0.0030144852458368573,-2.1905904722336058e-5,4.0509715506145036e-8,0.003014628140393211,-2.1690273931464643e-5,4.0183354013727575e-8,0.0030146798861370155,-2.1530670765035162e-5,3.9942465173289727e-8,0.003014674513909391,-2.1458647516230403e-5,3.9834154839566405e-8,0.0030146539150070514,-2.1483480978725524e-5,3.9871866653527925e-8,0.003014657045850174,-2.159355446238517e-5,4.003762590554032e-8,0.0030147123189946208,-2.1762610361229233e-5,4.029158028075859e-8,0.0030148344079461886,-2.1957660138997936e-5,4.0583952504102195e-8,0.003015024723893025,-2.214588593896058e-5,4.0865392615269084e-8,0.0030152739036193445,-2.22993320272481e-5,4.109395623141755e-8,0.0030155648211872598,-2.2397503358356043e-5,4.123893927793968e-8,0.0030158753159103555,-2.242862410171888e-5,4.1282740545661414e-8,0.0030161804959735242,-2.239035571976067e-5,4.122196425411615e-8,0.0030164549748184135,-2.2290484655788065e-5,4.106850249505057e-8,0.0030166756785176938,-2.2147566876471484e-5,4.085053467582822e-8,0.0030168257902463656,-2.1990840651876128e-5,4.0612367627877493e-8,0.0030168998356597245,-2.185809576971141e-5,4.041113557692705e-8,0.003016908801918456,-2.1790004412026398e-5,4.030814374624823e-8,0.0030168827390098687,-2.1820318277313286e-5,4.035402021045058e-8,0.0030168675107474373,-2.19637983748077e-5,4.057054444845606e-8,0.003016913871536386,-2.220687703617631e-5,4.09366942603126e-8,0.003017061280745224,-2.2507121073764624e-5,4.138801109760418e-8,0.0030173232653145413,-2.28042122748035e-5,4.1833304318833444e-8,0.0030176816547766365,-2.3038752114974032e-5,4.218308051823787e-8,0.003018092461901088,-2.317060860472061e-5,4.2377204037070425e-8,0.0030185000617629827,-2.3189358211647577e-5,4.240056434796237e-8,0.0030188531890023565,-2.3114278349446322e-5,4.2282916648184983e-8,0.0030191172695145925,-2.298608274263823e-5,4.2086230161827244e-8,0.003019280521670172,-2.2854616393563075e-5,4.188596434454325e-8,0.00301935377876645,-2.27664496809722e-5,4.1752283274555145e-8,0.0030193653932179577,-2.2755137035095014e-5,4.173540981919782e-8,0.0030193531828910203,-2.2835689436507088e-5,4.185743087774839e-8,0.003019355569264338,-2.3003756094996915e-5,4.211123646364793e-8,0.003019403958407845,-2.323899690414335e-5,4.246574371735947e-8,0.003019517875462904,-2.3511172447957385e-5,4.2875145551518413e-8,0.003019703373553423,-2.3786991097561844e-5,4.328922423781491e-8,0.003019954219332213,-2.4036029761377636e-5,4.3662218358333147e-8,0.003020254766068992,-2.423482031971884e-5,4.395891153209101e-8,0.003020583367897793,-2.4369010761043288e-5,4.415784033020523e-8,0.0030209155492026242,-2.4434102956819604e-5,4.425239523927991e-8,0.0030212267021837735,-2.443546844269732e-5,4.4250868318591255e-8,0.0030214945520319145,-2.438812313993975e-5,4.417614262844354e-8,0.0030217018620748537,-2.4316298536123176e-5,4.406504030121207e-8,0.0030218398456035413,-2.4252307744576375e-5,4.396654725060574e-8,0.003021912331535931,-2.4233602777596313e-5,4.39372627104561e-8,0.0030219396761021347,-2.429662036167427e-5,4.4032012805518794e-8,0.0030219599100410016,-2.4466782499552282e-5,4.4288740896769435e-8,0.00302202361177359,-2.4746531459929342e-5,4.47105455738881e-8,0.003022180395983599,-2.5107010582484676e-5,4.525329764117915e-8,0.003022460057180725,-2.5490814286278737e-5,4.5829951905006934e-8,0.003022857627761485,-2.5828964736561783e-5,4.633626256410645e-8,0.003023332267934383,-2.6065721301283244e-5,4.668826880948124e-8,0.003023821927221237,-2.6178133626157623e-5,4.685181828073514e-8,0.0030242654527104103,-2.618060722133502e-5,4.6849397702988095e-8,0.00302462064736006,-2.6115003315723564e-5,4.674500325784846e-8,0.003024872054652819,-2.6034210741007566e-5,4.661907867346306e-8,0.003025029247398639,-2.5987096868666402e-5,4.654559337911846e-8,0.003025119674183166,-2.600869221520683e-5,4.657718713531259e-8,0.0030251798618585422,-2.6115962524536738e-5,4.6738915646380234e-8,0.003025247304514287,-2.6307892425086884e-5,4.702858653637406e-8,0.0030253540345252404,-2.6568373656992416e-5,4.742130825887169e-8,0.003025522180290973,-2.6870812112854194e-5,4.7876552038498893e-8,0.0030257616742353777,-2.718362842899639e-5,4.834647617031556e-8,0.0030260701248843638,-2.7475754898200334e-5,4.878418797216237e-8,0.003026434531440565,-2.7721296131052857e-5,4.915072369570908e-8,0.003026834267375794,-2.790282528074767e-5,4.941997646359749e-8,0.003027244652317317,-2.801310467185596e-5,4.958126578195143e-8,0.00302764045789911,-2.8055375984440208e-5,4.963976761859313e-8,0.0030279989828120874,-2.8042678247256376e-5,4.961548465878466e-8,0.003028302732030385,-2.7996614735003015e-5,4.9541371336797554e-8,0.0030285419382640503,-2.7945668380696642e-5,4.946074008271887e-8,0.0030287171664962805,-2.7922799028450726e-5,4.9423540183523226e-8,0.003028841979820805,-2.796162115926255e-5,4.948048077466765e-8,0.0030289448272879803,-2.8090202994150213e-5,4.967360897101288e-8,0.00302906808799766,-2.832216698757468e-5,5.002291747065914e-8,0.003029261393516597,-2.8646859820436187e-5,5.051165188848918e-8,0.0030295674732655794,-2.9023648863821986e-5,5.107788139765754e-8,0.0030300035036457318,-2.9387468552092513e-5,5.1622994265168756e-8,0.003030547654439084,-2.966892547984612e-5,5.204210187529804e-8,0.0030311419708281494,-2.9821700123341288e-5,5.226546402242462e-8,0.003031713429022907,-2.9841451121119933e-5,5.228710697781398e-8,0.0030322015269454838,-2.9764614366811912e-5,5.216297581619774e-8,0.003032576700297681,-2.964992539693665e-5,5.1982771928407634e-8,0.0030328427049061664,-2.95558177823456e-5,5.18354400080819e-8,0.0030330273738204275,-2.952483864326578e-5,5.178537523848844e-8,0.0030331699517057442,-2.9577898541893805e-5,5.1863748181959154e-8,0.0030333104138618784,-2.9715604944099784e-5,5.207074030425486e-8,0.003033482465717576,-2.9922976396352082e-5,5.238294189196952e-8,0.0030337098242709487,-3.017493755703473e-5,5.276185486031358e-8,0.0030340047066781646,-3.0441434203506502e-5,5.316170038656006e-8,0.0030343677318868385,-3.069201162682167e-5,5.353632168723621e-8,0.0030347889661070187,-3.089987345211356e-5,5.384526338775909e-8,0.0030352499978571756,-3.104524236184448e-5,5.405880170678398e-8,0.0030357268634388502,-3.111778908424594e-5,5.416158516454266e-8,0.0030361935715449567,-3.1117887001919675e-5,5.415451590233293e-8,0.003036625814699871,-3.105651407747209e-5,5.4054586154864e-8,0.003037004388893214,-3.095390233892545e-5,5.3892806738359834e-8,0.003037318044491069,-3.083722670992275e-5,5.3710656905416486e-8,0.0030375656938618433,-3.073753439132445e-5,5.355535566628204e-8,0.0030377579336559293,-3.068595891553895e-5,5.347403607373892e-8,0.0030379177300265737,-3.0709070813912385e-5,5.350663829087113e-8,0.00303807966723912,-3.0823076928323533e-5,5.367713979638666e-8,0.0030382864205653216,-3.102708512509555e-5,5.3983480616954495e-8,0.003038580787609243,-3.1297162733261364e-5,5.438876948576837e-8,0.0030389926926067358,-3.158502205672186e-5,5.481947606929273e-8,0.003039524072818,-3.1826340398447944e-5,5.517809779127173e-8,0.0030401396754807146,-3.196074975273588e-5,5.5373393880473416e-8,0.0030407732402690456,-3.1956872342941396e-5,5.5358273365942866e-8,0.0030413506216760183,-3.1827784431995975e-5,5.515324561172027e-8,0.0030418182463314066,-3.1625541651179424e-5,5.4838080988230775e-8,0.003042160215499455,-3.141800758364335e-5,5.4516451859117366e-8,0.003042396527409552,-3.126315753054347e-5,5.4276642795710085e-8,0.003042568426483442,-3.119410063882663e-5,5.416865946881467e-8,0.0030427219468042673,-3.121729790939866e-5,5.4201628447496637e-8,0.0030428965072263536,-3.131876817788899e-5,5.435349924198628e-8,0.0030431195875498325,-3.1472417249374476e-5,5.4583966139684054e-8,0.003043405671120528,-3.164719823662061e-5,5.48454888443154e-8,0.003043757278206,-3.181220441401584e-5,5.509103044165085e-8,0.0030441666670632966,-3.194016210578213e-5,5.527928024881129e-8,0.0030446177728978936,-3.2010055857858906e-5,5.537854846801234e-8,0.0030450884814295937,-3.200922767702134e-5,5.5369895852801475e-8,0.003045553386619406,-3.193493319092446e-5,5.524947681257876e-8,0.003045987115545042,-3.179510076572901e-5,5.502968803317016e-8,0.0030463680745412454,-3.1607871380829794e-5,5.473845618856727e-8,0.0030466821164058687,-3.139963516825679e-5,5.441621391559135e-8,0.0030469255028017037,-3.120163298944072e-5,5.4110664553357935e-8,0.003047106649642553,-3.1045429760949075e-5,5.3869815322197836e-8,0.003047246264489913,-3.0957724333207185e-5,5.373401644060654e-8,0.0030473756148905722,-3.0955076276420677e-5,5.372793333790556e-8,0.0030475327337165107,-3.10391075449408e-5,5.385333611732599e-8,0.0030477562593878016,-3.119291882112134e-5,5.408383161903094e-8,0.0030480767420623433,-3.138019112187306e-5,5.436371344206401e-8,0.003048506271394186,-3.154923496407961e-5,5.461427067933738e-8,0.003049029398017934,-3.164403612417949e-5,5.4750595244403097E-08,0.003049600741217892,-3.162181473782961e-5,5.470817249590223e-8,0.0030501546590933596,-3.147129459702184e-5,5.447053534930495e-8,0.0030506267199089275,-3.122124129326912e-5,5.408216609011085e-8,0.003050977543809847,-3.0931489493301834e-5,5.363475132421305e-8,0.0030512056349143645,-3.066970206362606e-5,5.323164358366911e-8,0.0030513427951945633,-3.048709541508865e-5,5.2950735410073135e-8,0.0030514375272195533,-3.0405493613713788e-5,5.2824725934812176e-8,0.0030515374213706445,-3.0418359774685625e-5,5.284287745599565e-8,0.003051677995809869,-3.050014466075965e-5,5.296553808075435e-8,0.0030518790092155215,-3.061696562449272e-5,5.314062781446654e-8,0.003052145625853913,-3.073469977610028e-5,5.3316031028704927e-8,0.0030524714707749288,-3.082377392153637e-5,5.344682144560079e-8,0.0030528417493476028,-3.086160174564249e-5,5.34988474804598e-8,0.0030532358836312897,-3.0833881042707114e-5,5.345060667689741e-8,0.003053629879526026,-3.0735485986035706e-5,5.3294565854492434e-8,0.0030539988364117142,-3.0571146292916206e-5,5.30382059792326e-8,0.0030543199507090837,-3.0355674406952507e-5,5.270438907050841e-8,0.0030545760956502454,-3.0113150877368533e-5,5.233010961195881e-8,0.00305475954547292,-2.9874438142143042e-5,5.1962653663563995e-8,0.003054874940487383,-2.967277780668974e-5,5.165280031939516e-8,0.0030549404324154324,-2.9537825570307475e-5,5.144563962738253e-8,0.0030549861390338404,-2.9489134143288323e-5,5.137059250576423e-8,0.0030550495976808005,-2.953061394193003e-5,5.143300630399881e-8,0.003055168710759939,-2.9647526534915528e-5,5.160970828560753e-8,0.0030553733364540553,-2.9807121158297693e-5,5.1850176986509324e-8,0.0030556770688369554,-2.9963521348213533e-5,5.208418350889287e-8,0.0030560711382057876,-3.0066914121891328e-5,5.223590149011024e-8,0.003056522783852153,-3.007606385331831e-5,5.224295582005858e-8,0.0030569803906741184,-2.9971466768568165e-5,5.207634125974998e-8,0.0030573862107332603,-2.9764480348069197e-5,5.1754164969916074e-8,0.0030576939719519337,-2.9497043921062268e-5,5.134105271121149e-8,0.0030578844960596806,-2.9229485363525857e-5,5.092940536552576e-8,0.0030579714726823846,-2.9020378842860718e-5,5.060856308901679e-8,0.00305799430929109,-2.890783769790072e-5,5.0436246780448754e-8,0.0030580024833647516,-2.8900743931462217e-5,5.042530128741445e-8,0.0030580398139917744,-2.8981793723107103e-5,5.0548579370877406e-8,0.0030581349144192635,-2.9117796452997896e-5,5.075489270553819e-8,0.0030582989710085853,-2.927092112731661e-5,5.0986296117823764e-8,0.00305852838098303,-2.9406906130383003e-5,5.1190589621726315e-8,0.00305880913029923,-2.9499417804318987e-5,5.132784410791377e-8,0.0030591209014314944,-2.9531615236497716e-5,5.1372652866946216e-8,0.003059440241717404,-2.949633831159525e-5,5.131434068941656e-8,0.00305974298908132,-2.9395907947313022e-5,5.1156659354477445e-8,0.0030600065090859636,-2.9241933794825013e-5,5.091753916282965e-8,0.00306021229511157,-2.9054948323373344e-5,5.062856693783168e-8,0.003060349177847135,-2.8863199511689882e-5,5.033312632870034e-8,0.003060416814008068,-2.8699745555567035e-5,5.008188395273282e-8,0.0030604284223485962,-2.8597283966096064e-5,4.992478512143156e-8,0.0030604111977471983,-2.858098323762389e-5,4.990002248696701e-8,0.0030604029204521956,-2.8660871126497475e-5,5.002240613766968e-8,0.0030604443802250266,-2.8826475438747818e-5,5.027527520898142e-8,0.0030605691021830185,-2.9046441406551585e-5,5.061009175503469e-8,0.00306079346737266,-2.927436144349517e-5,5.0955543464884993e-8,0.0030611106463299936,-2.945974872572592e-5,5.123445153963956e-8,0.003061490627398194,-2.9561147187201426e-5,5.1383839021491824e-8,0.0030618866932196325,-2.9557585511589545e-5,5.137235223398255e-8,0.0030622468460100747,-2.9455021239405097e-5,5.1209933881528055e-8,0.0030625273270125427,-2.9285654512983767e-5,5.0946554534423536e-8,0.0030627045011972953,-2.909970499319971e-5,5.065943900038011e-8,0.003062781223049597,-2.8951506243513924e-5,5.043168206571564e-8,0.0030627851170516554,-2.8884214842026012e-5,5.032886811317642e-8,0.003062759221135395,-2.8918582214671775e-5,5.038203695084455e-8,0.0030627487734678108,-2.9049687038960627e-5,5.0582911500186546e-8,0.0030627893702877065,-2.9251814457828465e-5,5.0891584468485985e-8,0.0030629003148716434,-2.9488179827505706e-5,5.1251525998749074e-8,0.0030630839037973016,-2.972103318011528e-5,5.160504457192073e-8,0.0030633288315558426,-2.9918997653759335e-5,5.190441062046527e-8,0.003063615124797014,-3.0060785653816723e-5,5.211739828811116e-8,0.003063918729338474,-3.013609360645597e-5,5.222854366679751e-8,0.003064214995878956,-3.014497667576545e-5,5.223815136496016e-8,0.0030644811540353513,-3.0096760320048008e-5,5.2160662139867385e-8,0.003064698316991432,-3.0009023509637796e-5,5.202315302953461e-8,0.0030648536429064674,-2.990656924730143e-5,5.186378488235481e-8,0.0030649429933266646,-2.9819741475536308e-5,5.1729180727117875e-8,0.0030649738454125133,-2.9781167475517766e-5,5.166933721709507e-8,0.0030649674206902153,-2.98201748061254e-5,5.172897531156119e-8,0.0030649581828044383,-2.9955006804012056e-5,5.19355879701887e-8,0.0030649887015580467,-3.0184701153387606e-5,5.2287079973691934e-8,0.0030650993228122743,-3.048438554024296e-5,5.274472973817438e-8,0.0030653151426291397,-3.080799959377198e-5,5.3237545317571995e-8,0.0030656356436287177,-3.109971429626911e-5,5.36798936350581e-8,0.003066032397083313,-3.131062399609393e-5,5.3997123564829124e-8,0.0030664566457068772,-3.141392264624986e-5,5.414878191396371e-8,0.003066853673243906,-3.141241782904111e-5,5.414000445922996e-8,0.003067178107954643,-3.1336255718859404e-5,5.401782535141934e-8,0.003067405017322031,-3.123297452844401e-5,5.385569119674471e-8,0.0030675342967685115,-3.115406523908855e-5,5.3732673458228506e-8,0.0030675883450696387,-3.1142126616185284e-5,5.3713731593782084e-8,0.003067604598905477,-3.122165258980363e-5,5.3835712946092174e-8,0.0030676253853558076,-3.139518885501176e-5,5.41016984091395e-8,0.0030676878955794595,-3.164514859820826e-5,5.448403678006608e-8,0.0030678167760080873,-3.1940102956282886e-5,5.4934156079083943e-8,0.00306802082106185,-3.22432379520567e-5,5.539556794925043e-8,0.0030682938008947383,-3.252038055262967e-5,5.581610023286302e-8,0.003068618188348601,-3.2745712319185725e-5,5.6156527333722295e-8,0.0030689700372110436,-3.290455445210272e-5,5.63947158589191e-8,0.0030693235621584002,-3.299368835276426e-5,5.652604281911584e-8,0.0030696546829265168,-3.302018003318915e-5,5.656158441311524e-8,0.003069943501781531,-3.299964329710182e-5,5.652548727111865e-8,0.0030701761356594238,-3.295448884467991e-5,5.6452316329964884e-8,0.0030703464351241215,-3.2912168983386934e-5,5.6384348797087725e-8,0.0030704579205523843,-3.290292724600728e-5,5.6368046064395786e-8,0.0030705257705411666,-3.2956240209135014e-5,5.6448491101539555e-8,0.003070577902929506,-3.3095212754677564e-5,5.666072725949836e-8,0.003070653303256023,-3.332901887976236e-5,5.7018206275630994e-8,0.0030707954675129484,-3.3645317050531466e-5,5.750131258839977e-8,0.003071040281409215,-3.4006866132882734e-5,5.805237688321617e-8,0.003071401442066699,-3.435724590922433e-5,5.858460257890024e-8,0.003071860664240823,-3.463707718078335e-5,5.900700173455468e-8,0.003072369948294953,-3.4805077484133635e-5,5.9256687131385314e-8,0.0030728668933984586,-3.4853323968064e-5,5.932224867940723e-8,0.00307329574470014,-3.4808729472292477e-5,5.9245906426521214e-8,0.0030736238628414326,-3.472127382584356e-5,5.910521892617646e-8,0.0030738476136962186,-3.4646440956723325e-5,5.898583976281836e-8,0.0030739883560582247,-3.462984017376718e-5,5.895772090868357e-8,0.0030740829181741033,-3.46981445897087e-5,5.906122528438606e-8,0.0030741729261370603,-3.485661305223858e-5,5.930354340403719e-8,0.0030742957031104122,-3.509154811261891e-5,5.966276668283171e-8,0.0030744779277463736,-3.537572740023708e-5,6.00964697542749e-8,0.0030747323559975367,-3.5675189893930766e-5,6.055223916889516e-8,0.003075057487670119,-3.5956061174078274e-5,6.097812908001633e-8,0.0030754397046584866,-3.619027550379833e-5,6.133134047523962e-8,0.0030758570531433604,-3.6359408441814945e-5,6.158398173260262e-8,0.0030762836935755364,-3.645637499575067e-5,6.17255797130405e-8,0.0030766941332692503,-3.6485215974385064e-5,6.176270393282051e-8,0.00307706662715048,-3.645952970605651e-5,6.17165520944473e-8,0.0030773855806581914,-3.64002479832436e-5,6.161954383422073e-8,0.0030776432027652626,-3.63332416409525e-5,6.151163570192726e-8,0.003077840759611733,-3.628682113866609e-5,6.143643256726638e-8,0.003077989627912044,-3.628885788142236e-5,6.143667890109774e-8,0.0030781120193623807,-3.6363006241524466e-5,6.154837667649236e-8,0.0030782405956229293,-3.652349964920907e-5,6.179278977302228e-8,0.0030784153961581056,-3.6768720995789186e-5,6.216668724687254e-8,0.003078676287039924,-3.707542807113103e-5,6.263368664319519e-8,0.0030790504999446576,-3.739763323181358e-5,6.312273725650803e-8,0.0030795385416962856,-3.767491089624212e-5,6.354097060212617e-8,0.0030801063485889927,-3.7851372011602716E-05,6.380282181650783e-8,0.003080691860843348,-3.789839797156401e-5,6.3864909335135015E-08,0.0030812263089583505,-3.782804205247127e-5,6.374660437345014e-8,0.0030816595018051856,-3.768799022595951e-5,6.352218567186832e-8,0.003081975175275685,-3.754141745986299e-5,6.328960513196501e-8,0.0030821904003572086,-3.7444257862379394e-5,6.313520651894206e-8,0.003082343638281676,-3.743069219176931e-5,6.311124043335557e-8,0.0030824800552818033,-3.7509564541134194e-5,6.323047245576145e-8,0.0030826400072475326,-3.7668452785068254e-5,6.347276711043042e-8,0.003082852413765722,-3.788093848520992e-5,6.379661295313797e-8,0.003083132266538477,-3.811403698482697e-5,6.415076333549884e-8,0.0030834808667202927,-3.833449478651092e-5,6.448396137955909e-8,0.0030838877341181153,-3.8513714836371074e-5,6.475242681002939e-8,0.0030843336004778847,-3.8631288755844996e-5,6.49251538042667e-8,0.003084794042322366,-3.867707285475078e-5,6.49869875714132e-8,0.0030852433321181686,-3.865183435490819e-5,6.49395475346079e-8,0.0030856581339217173,-3.856655888053119e-5,6.48001336398034e-8,0.0030860206460516367,-3.844058492853828e-5,6.459884806542256e-8,0.0030863208771382037,-3.8298947069799535e-5,6.437449277747022e-8,0.0030865580404335806,-3.816935596666206e-5,6.416988298112212e-8,0.0030867412223701774,-3.807898089265322e-5,6.402682842646071e-8,0.0030868893766480983,-3.8050984731237867e-5,6.398072676630348e-8,0.0030870304944824955,-3.810068561233592e-5,6.405462439468387e-8,0.003087199430753806,-3.823122572618231e-5,6.425261522376926e-8,0.0030874333446925814,-3.842914766591009e-5,6.455320872359164e-8,0.0030877636895722525,-3.866159342862816e-5,6.490525234810125e-8,0.0030882049718960573,-3.887836166676586e-5,6.523127311346362e-8,0.003088743561312213,-3.9022341755227606e-5,6.544356507347711e-8,0.003089333590640843,-3.904860755320145e-5,6.547348840413299e-8,0.0030899071036917716,-3.894510170953161e-5,6.530322358465656e-8,0.0030903979050176593,-3.8742004346281896e-5,6.498015271661827e-8,0.003090767228006569,-3.8501181533249536e-5,6.460049051721142e-8,0.0030910160608724553,-3.8290854101103754e-5,6.426997931057188e-8,0.0030911786470456865,-3.816087723268984e-5,6.406549047523721e-8,0.003091304636594572,-3.81308943961482e-5,6.401668515462453e-8,0.0030914415331645385,-3.819243835001492e-5,6.410948319588161e-8,0.003091624053373996,-3.831851468248846e-5,6.430123035197483e-8,0.0030918706623143453,-3.8474104361764894e-5,6.453722136219927e-8,0.0030921846709144477,-3.8624255014770126e-5,6.476330985906157e-8,0.0030925572633731823,-3.8739191826344275e-5,6.493373044917373e-8,0.0030929709124494467,-3.879722444333691e-5,6.501542077873879e-8,0.003093402731555433,-3.8786312162609277e-5,6.499027635350036e-8,0.0030938277663450082,-3.870467412242986e-5,6.485599547202599e-8,0.0030942222139669767,-3.856054410640383e-5,6.462566902485165e-8,0.003094566519648795,-3.8371053174280506e-5,6.432606100579885e-8,0.0030948481721392368,-3.816012347433993e-5,6.399436069664364e-8,0.003095063804553022,-3.795541247827492e-5,6.36734419165358e-8,0.003095220250846101,-3.778464042825393e-5,6.34061366452044e-8,0.003095334440344874,-3.76716671513097e-5,6.322910755980504e-8,0.00309543208101415,-3.76325912073004e-5,6.316677889485286e-8,0.0030955450293822886,-3.767217508425234e-5,6.32258396731875e-8,0.003095707183071852,-3.778095740397159e-5,6.339090801722296e-8,0.00309594862334514,-3.793365750566644e-5,6.36222778804018e-8,0.003096287931628474,-3.80901905074783e-5,6.385770713701393e-8,0.0030967236941520254,-3.8201303672671125e-5,6.402124536059043e-8,0.003097228280907147,-3.822036947682624e-5,6.404140759803494e-8,0.0030977490184312755,-3.8120022723220564e-5,6.387670810024808e-8,0.0030982210755350135,-3.7907147081520453e-5,6.353864073301886e-8,0.0030985900761617553,-3.762610731223205e-5,6.309655120907573e-8,0.0030988336384995293,-3.734434007536094e-5,6.265523738702239e-8,0.003098968816215725,-3.7126254709522466e-5,6.231441792645098e-8,0.003099041425769494,-3.7010331236075636e-5,6.213318613669418e-8,0.0030991055833493103,-3.7000963291756114e-5,6.211747094970239e-8,0.0030992057850765756,-3.707503307238412e-5,6.223050579274813e-8,0.0030993681475792695,-3.719515769679686e-5,6.241367766141261e-8,0.0030996000182369945,-3.7321886461173106e-5,6.260562024590069e-8,0.0030998940056717068,-3.742152940130405e-5,6.275433238229519e-8,0.003100233021590866,-3.7469791909199243e-5,6.282264287237035e-8,0.0031005946146256498,-3.74527865541713e-5,6.278957087078115e-8,0.0031009543309571943,-3.7366892039579344e-5,6.264995951136436e-8,0.003101288498980592,-3.721816385706405e-5,6.241351573364313e-8,0.0031015767979117176,-3.702139137135275e-5,6.210337620395833e-8,0.0031018047687390517,-3.679862687950359e-5,6.175387343947005e-8,0.0031019661991720264,-3.657686241831285e-5,6.140695022313485e-8,0.0031020649564957345,-3.638462538015085e-5,6.110684934249384e-8,0.0031021156285978737,-3.624768225270253e-5,6.089338495755532e-8,0.003102142484188417,-3.6184428286903e-5,6.079473351831937e-8,0.0031021765631752685,-3.620172937410701e-5,6.082097958568538e-8,0.0031022510076930674,-3.629208197157182e-5,6.095979473559371e-8,0.0031023950750430954,-3.643289906673445e-5,6.117550104443778e-8,0.0031026275545373554,-3.658852828809345e-5,6.141241349154455e-8,0.0031029505897565103,-3.6715498961018746e-5,6.160314515690131e-8,0.0031033454561945222,-3.677128760644678e-5,6.168223979401771e-8,0.0031037725875075316,-3.672594194239396e-5,6.160407633853862e-8,0.0031041783170027994,-3.6573890333345214e-5,6.13609507617016e-8,0.0031045091130757767,-3.634081561194844e-5,6.099349544356457e-8,0.0031047297909969312,-3.607980110758601e-5,6.058452494813771e-8,0.0031048374201034855,-3.585494963702326e-5,6.023352619407363e-8,0.003104862516995215,-3.5718644691785436e-5,6.002135737673514e-8,0.003104856093193385,-3.569405931092349e-5,5.998319444364333e-8,0.0031048700872880267,-3.577137790618058e-5,6.010288490586609e-8,0.003104941604094109,-3.5916960865466545e-5,6.032745899023271e-8,0.00310508658575867,-3.608784938858073e-5,6.058987181278256e-8,0.003105301813939656,-3.6244129061960325e-5,6.082825896614451e-8,0.0031055709169320175,-3.6355939860998774e-5,6.099670423139435e-8,0.003105870647986892,-3.6405690275413666e-5,6.106846533436347e-8,0.0031061756914431407,-3.638750956805874e-5,6.103492926911871e-8,0.0031064618740461935,-3.630572623697611e-5,6.090315332297189e-8,0.0031067083897661323,-3.617327510332381e-5,6.069340518034317e-8,0.0031068996748370463,-3.6010179052804656e-5,6.043687697777326e-8,0.0031070273067826453,-3.5841809895788134e-5,6.017304374810048e-8,0.003107091924907097,-3.569640763286369e-5,5.994580924865879e-8,0.003107104690948129,-3.5601421586642455e-5,5.979775912534584e-8,0.0031070874280543044,-3.557871974140187e-5,5.976263364692894e-8,0.0031070705639987084,-3.563939705212548e-5,5.985721638430891e-8,0.00310708845076731,-3.577953751271076e-5,6.007479140748683e-8,0.0031071724854550274,-3.597857902840596e-5,6.0382741421625e-8,0.003107343449944664,-3.620155104969642e-5,6.072622362437715e-8,0.0031076051132779385,-3.640540195274204e-5,6.10381901744192e-8,0.0031079410880545904,-3.6548419234103456e-5,6.125412657583635e-8,0.0031083163328670636,-3.6600797795219e-5,6.132843658673388e-8,0.003108683776045806,-3.655377779638129e-5,6.12484672972554e-8,0.0031089953478281146,-3.642449473760269e-5,6.104178540723422e-8,0.0031092151923365167,-3.6254006005909544e-5,6.077284786520125e-8,0.003109331132111241,-3.6097367552710236e-5,6.052739707346827e-8,0.00310935954808475,-3.6007610042852635e-5,6.038750927329051e-8,0.0031093404361101393,-3.601917120844064e-5,6.04059490162074e-8,0.0031093239113226005,-3.6137917913298556e-5,6.059089030936383e-8,0.003109354124427072,-3.6341991680345246e-5,6.090751315544337e-8,0.0031094576079410963,-3.6591899919457295e-5,6.12939239128099e-8,0.003109639723574992,-3.684400498898479e-5,6.168222747975021e-8,0.003109888172433052,-3.706155993675539e-5,6.201562972733295e-8,0.003110179865335902,-3.7220522609188814e-5,6.225730522644977e-8,0.0031104876813696455,-3.731061864999249e-5,6.239184703464731e-8,0.00311078539719096,-3.733367074941028e-5,6.242252235980394e-8,0.0031110506840359895,-3.730106234421321e-5,6.236728729470829e-8,0.003111266829818254,-3.723134017143124e-5,6.225510727514509e-8,0.0031114239398752712,-3.7148181411718e-5,6.212287206499815e-8,0.0031115201531575613,-3.7078419428024274e-5,6.201236188919679e-8,0.003111562975299694,-3.7049500972479054e-5,6.196625586571644e-8,0.003111570240611829,-3.7085775629295866e-5,6.20222732746493e-8,0.0031115696907623807,-3.720350361712773e-5,6.220533256957703e-8,0.003111595961660061,-3.740535774526301e-5,6.251900193071125e-8,0.0031116842348012787,-3.7676298720104116e-5,6.293919212979045e-8,0.0031118612256879658,-3.798340020650173e-5,6.341407163920447e-8,0.003112136139777003,-3.828150901245256e-5,6.387306782824209e-8,0.003112495379209596,-3.852427301854293e-5,6.424415997620797e-8,0.003112903926884855,-3.867726198381603e-5,6.447432367142958e-8,0.0031133136874417224,-3.872848224078679e-5,6.454579824951314e-8,0.0031136761793375063,-3.8692456923064396E-05,6.448222652228261e-8,0.0031139554371912236,-3.860656882561176e-5,6.434267804320025e-8,0.0031141372703484766,-3.8521032659985596e-5,6.420576709598722e-8,0.0031142324513703736,-3.848555621137015e-5,6.414873497201981e-8,0.003114273122112332,-3.85363882869955e-5,6.422732768153216e-8,0.0031143034616922818,-3.868736365238427e-5,6.446208120483557e-8,0.0031143674207793413,-3.892758353008189e-5,6.483503018920008e-8,0.003114497459059395,-3.9226240381586666e-5,6.529750515880651e-8,0.0031147078121036174,-3.954245370409532e-5,6.578559894383833e-8,0.00311499378960663,-3.983627974908429e-5,6.623730004445356e-8,0.0031153360888836355,-4.007726426013293e-5,6.660567612073376e-8,0.0031157075151952004,-4.024868825724295e-5,6.686529743458914e-8,0.00311607947574405,-4.034776414925683e-5,6.701237492469503e-8,0.0031164267230209515,-4.038331710088937e-5,6.706105409678788e-8,0.0031167301083817336,-4.037260325837689e-5,6.703845169512361e-8,0.003116977890976981,-4.033831580823609e-5,6.698004129434217e-8,0.0031171663505323325,-4.030610095786534e-5,6.692583316158584e-8,0.0031173002857739405,-4.030233658179883e-5,6.691691302618574e-8,0.0031173935830516013,-4.035158745219613e-5,6.699141672014888e-8,0.003117469472534857,-4.047311163717984e-5,6.71790093138832e-8,0.0031175594775110223,-4.067616621474953e-5,6.749354678239481e-8,0.0031176996760878236,-4.095478103045957e-5,6.792501578391407e-8,0.003117923245200117,-4.1284097202451735e-5,6.843400804444655e-8,0.003118249965451604,-4.162156390749211e-5,6.895378532468487e-8,0.0031186762577232225,-4.1915651713568604e-5,6.940399276282996e-8,0.0031191714040973333,-4.212116830683181e-5,6.971456663709166e-8,0.0031196840741649716,-4.2215346438736336e-5,6.985077033810668e-8,0.003120157847027817,-4.220674667049533e-5,6.98269624957057e-8,0.0031205489414833265,-4.2132362620646234e-5,6.97018734876997e-8,0.0031208383916512266,-4.20448327662397e-5,6.955836204462521e-8,0.003121034785095203,-4.199616018547974e-5,6.947774286240719e-8,0.003121168632125931,-4.202421267565137e-5,6.951862361251391e-8,0.0031212820770698153,-4.214528318978495e-5,6.970544612819716e-8,0.0031214177248149594,-4.235306877230772e-5,7.002722768273191e-8,0.0031216092731973467,-4.2622792035729374e-5,7.044435725304227e-8,0.0031218754919343627,-4.2918580516760454e-5,7.090035608149642e-8,0.0031222181803268524,-4.320209457310386e-5,7.133539946884241e-8,0.003122623947005099,-4.344044848734895e-5,7.169857291254788e-8,0.00312306884485219,-4.361179467816571e-5,7.195639886437939e-8,0.003123524289638139,-4.370774340490241e-5,7.209642624241596e-8,0.0031239626656890764,-4.373282262997294e-5,7.21262580887302e-8,0.0031243615440335547,-4.3701909396077086e-5,7.206948965492392e-8,0.0031247061538028763,-4.3636780471882876e-5,7.196033443639855e-8,0.0031249903765416783,-4.356272900897019e-5,7.183837800351165e-8,0.0031252168682957006,-4.3505688790359626e-5,7.174410685588453e-8,0.0031253968441908885,-4.348975073626395e-5,7.17150048965672e-8,0.0031255497310814042,-4.35346390742139e-5,7.178155313739291e-8,0.00312570246406995,-4.3652662272077505e-5,7.196242839516862e-8,0.0031258876523310264,-4.384487979547073e-5,7.225856364534224e-8,0.003126139361453899,-4.409699636109416e-5,7.26468964950289e-8,0.003126485461480311,-4.437689592985936e-5,7.307674195249288e-8,0.003126937079372063,-4.4637120813428204e-5,7.347383911846252e-8,0.003127478854765807,-4.482535361453673e-5,7.375675854161458e-8,0.0031280666690904416,-4.490213927602775e-5,7.386449999496449e-8,0.0031286382404406153,-4.4858518891369295e-5,7.37839353542856e-8,0.0031291344460409416,-4.472272685316552e-5,7.356017852034121e-8,0.0031295207052957296,-4.455029894921475e-5,7.328095575302624e-8,0.0031297969026368396,-4.440289276125083e-5,7.304320913549977e-8,0.0031299925059136854,-4.4327735522592144e-5,7.292069128837017e-8,0.0031301525953489643,-4.4346566926362245e-5,7.294663172919162e-8,0.003130323040755186,-4.44552245163689e-5,7.311334170083266e-8,0.0031305398839340287,-4.463002091424208e-5,7.338260528006618e-8,0.00313082404631057,-4.483652215332876e-5,7.369977824422968e-8,0.0031311803606072124,-4.503787355813529e-5,7.400698484506922e-8,0.0031315994383132096,-4.5201450522542784e-5,7.425347439859536e-8,0.0031320612381614877,-4.530356848674249e-5,7.440279963037097e-8,0.0031325396046175753,-4.533218545978504e-5,7.443682235158883e-8,0.003133007088926917,-4.528754210138793e-5,7.435654510846008e-8,0.003133439334571156,-4.51809403698077e-5,7.41801159799911e-8,0.003133818472273233,-4.503213230381495e-5,7.393873233871031e-8,0.003134135205289634,-4.486591093923118e-5,7.367133504974223e-8,0.0031343895555660316,-4.470855447784281e-5,7.34190699593144e-8,0.003134590575431148,-4.4584622562577654e-5,7.322027017012072e-8,0.0031347554245567386,-4.451420562905288e-5,7.310611312884732e-8,0.0031349080100163845,-4.451044644791041e-5,7.309669605942408e-8,0.0031350771198854635,-4.457710742852157e-5,7.319723119373661e-8,0.0031352936217133444,-4.47060605212665e-5,7.339422020383135e-8,0.0031355858958112227,-4.487510826442938e-5,7.365224958348347e-8,0.003135972822388433,-4.5047645339306655e-5,7.391369496033267e-8,0.0031364549294214225,-4.517674188187485e-5,7.410524949995039e-8,0.003137006880828943,-4.521608014150156e-5,7.415499865583744e-8,0.0031375773084138556,-4.513707215275879e-5,7.401903658596108e-8,0.003138101428611319,-4.494515854131807e-5,7.370680978793502e-8,0.0031385245037932065,-4.468383466731007e-5,7.328731665396651e-8,0.0031388241332245405,-4.441996388809048e-5,7.286597138629206e-8,0.003139017499846824,-4.421722026618582e-5,7.254276438257211e-8,0.003139150157383647,-4.411342074013215e-5,7.237653893372397e-8,0.0031392756212672386,-4.411288523762928e-5,7.237306272266767e-8,0.003139437968769991,-4.4192948719133804e-5,7.249557334607343e-8,0.0031396632755686426,-4.431658177299298e-5,7.268500837724008e-8,0.0031399588406845693,-4.444412071309936e-5,7.287870894461722e-8,0.0031403166737552367,-4.454122642373622e-5,7.302295817715162e-8,0.0031407183126958165,-4.4583109623867075e-5,7.307944575839242e-8,0.0031411394477191415,-4.4556196731207386e-5,7.302762227868937e-8,0.0031415539994911366,-4.445830099035177e-5,7.28647417048713e-8,0.003141937728993228,-4.429775179132686e-5,7.260437295376374e-8,0.0031422713373744243,-4.4091609934731785e-5,7.227358181570472e-8,0.0031425429027575314,-4.386309308749254e-5,7.190893225978437e-8,0.0031427494576673834,-4.363836426557965e-5,7.155149576181157e-8,0.0031428974772572276,-4.3442976873453624e-5,7.124128957024562e-8,0.003143002214192302,-4.329843267004607e-5,7.101185038058907e-8,0.003143086052266109,-4.321920239699395e-5,7.088551186228275e-8,0.0031431760678829164,-4.3210361139567735e-5,7.086966698763124e-8,0.0031433008971223707,-4.3265945431617366e-5,7.09542336198036e-8,0.003143486895319873,-4.336813785078726e-5,7.111052058211447e-8,0.0031437533847702066,-4.348759147027911e-5,7.12919612296051e-8,0.0031441069213620117,-4.358585463469756e-5,7.143813366953108e-8,0.003144535476545944,-4.362139298757207e-5,7.148429942205696e-8,0.003145005091611609,-4.3560203673701036e-5,7.137795505629189e-8,0.003145463126681861,-4.3389675112285365e-5,7.11003324650128e-8,0.003145851574927433,-4.3129979926205826e-5,7.068402441148508e-8,0.0031461283507413433,-4.2833959953962696e-5,7.021264040871186e-8,0.003146286100171612,-4.257032356693477e-5,6.979432110562806e-8,0.0031463558591178996,-4.239669820392884e-5,6.951932082306872e-8,0.003146392327049763,-4.233819904869464e-5,6.942631862677053e-8,0.0031464507043553205,-4.2383168839997224e-5,6.94958958380317e-8,0.0031465688651928546,-4.249459392815535e-5,6.966883115670779e-8,0.0031467612849682977,-4.262689345829094e-5,6.987285185595196e-8,0.0031470222789782287,-4.273918499304871e-5,7.004366315740973e-8,0.0031473330289561153,-4.2802158807808166e-5,7.013567759431403e-8,0.003147668417268007,-4.279983806022786e-5,7.01245308551207e-8,0.0031480021049310764,-4.272860133319068e-5,7.000526722286279e-8,0.0031483099313495784,-4.259528124034335e-5,6.978916831189976e-8,0.0031485723125253334,-4.241509647530167e-5,6.950045735299453e-8,0.0031487761173877083,-4.2209454417396814e-5,6.917289890407978e-8,0.0031489161538580373,-4.2003459881328945e-5,6.884596295593158e-8,0.003148996162170557,-4.1822953882087386e-5,6.856021556609623e-8,0.003149028978654053,-4.169106752864223e-5,6.835188836388549e-8,0.003149035482429731,-4.162464544196019e-5,6.824720046102467e-8,0.003149042199251593,-4.163112014627014e-5,6.825739085675065e-8,0.00314907771956232,-4.170639233813112e-5,6.837538674971382e-8,0.0031491682653819867,-4.18342132313785e-5,6.857492364962827e-8,0.0031493329122884942,-4.198742613049102e-5,6.881267918772647e-8,0.003149579039836493,-4.213120402571019e-5,6.903358555963276e-8,0.0031498986271138838,-4.2228420130555436e-5,6.91794432100356e-8,0.0031502664228729867,-4.2247298350746497e-5,6.920097199180307e-8,0.003150641701734798,-4.217078712182122e-5,6.907238815589541e-8,0.0031509754961388586,-4.200545381164349e-5,6.880509810771359e-8,0.0031512238608324395,-4.1785638196682574e-5,6.845392811745735e-8,0.0031513640821730364,-4.1567794289340616e-5,6.810802378555436e-8,0.003151406157010707,-4.141327484247085e-5,6.786370323995615e-8,0.0031513912510576945,-4.136560918026271e-5,6.778876311671728e-8,0.003151375804577231,-4.1434395174820625e-5,6.789730029476199e-8,0.0031514098642566202,-4.159482257943738e-5,6.81492342574456e-8,0.0031515215625475173,-4.18012216288661e-5,6.847194098192803e-8,0.0031517136174996478,-4.200494130433833e-5,6.878861599395965e-8,0.0031519692707481077,-4.216756787951769e-5,6.903911030241721e-8,0.003152261517243071,-4.2266490087485424e-5,6.918851693440988e-8,0.0031525610670786637,-4.229461685062819e-5,6.922644943555905e-8,0.0031528414655990046,-4.22573706176436e-5,6.9162068457332e-8,0.003153081775375267,-4.216923255662013e-5,6.901853417953314e-8,0.0031532678798198805,-4.205077312180638e-5,6.882835975902144e-8,0.0031533932546355388,-4.192616457967239e-5,6.862959482793142e-8,0.0031534595708972847,-4.1820803001536924e-5,6.84621653927876e-8,0.0031534770784778826,-4.175861379115542e-5,6.836364650161207e-8,0.0031534643622982412,-4.17588032667655e-5,6.836409543908077e-8,0.0031534468701465957,-4.183228856251606e-5,6.848035579602831e-8,0.003153453782052926,-4.197854007215975e-5,6.871105220452271e-8,0.003153513263736754,-4.218384148552481e-5,6.903390427614672e-8,0.0031536467429532566,-4.242196322172231e-5,6.940693592124387e-8,0.003153863430347162,-4.265783483101526e-5,6.977446531891138e-8,0.003154156585993926,-4.285397543340932e-5,7.007742427316526e-8,0.00315450279718283,-4.2978622186424466e-5,7.026625449926472e-8,0.0031548650041122103,-4.301400854080456e-5,7.031388230440871e-8,0.00315519943918034,-4.296289169347691e-5,7.022577473855363e-8,0.003155465859320983,-4.285109888117147e-5,7.00436294628589e-8,0.0031556391659936065,-4.272394847220358e-5,6.983943122484468e-8,0.0031557188612724523,-4.263555517927237e-5,6.969842457165365e-8,0.0031557317728420436,-4.263280101975123e-5,6.969387032889604e-8,0.0031557249027450757,-4.2739520543408744e-5,6.98623192302485e-8,0.0031557498994496218,-4.294833096833603e-5,7.019104128047928e-8,0.00315584589866597,-4.322452786249621e-5,7.062447804376743e-8,0.0031560287243041687,-4.3519737897634517e-5,7.108598411323216e-8,0.003156290210848438,-4.378791545601902e-5,7.150311106554863e-8,0.0031566054069980037,-4.3996660675542415e-5,7.182534984786604e-8,0.0031569423808284628,-4.4131253208340974e-5,7.203026754938302e-8,0.003157270337523358,-4.4192994871844845e-5,7.212064457656072e-8,0.003157564470837877,-4.419496903596624e-5,7.211761487890475e-8,0.003157808015852627,-4.415761251223253e-5,7.205364259861087e-8,0.0031579926823708912,-4.4105138784809375e-5,7.196695049477917e-8,0.0031581184957774153,-4.406285452731199e-5,7.189738913692536e-8,0.003158193599416625,-4.4054911516432865e-5,7.188294750699247e-8,0.003158234031798483,-4.4101897275740684e-5,7.195593087373301e-8,0.003158263018098467,-4.421788006294162e-5,7.213822712040806e-8,0.003158309054218505,-4.440704337455989e-5,7.243594276621938e-8,0.0031584021289597524,-4.466069514352587e-5,7.283470938809992e-8,0.0031585679463628875,-4.495603322513259e-5,7.329786169090022e-8,0.003158821045759386,-4.5258255933040026e-5,7.37699600181512e-8,0.003159158924190263,-4.5526890236963015e-5,7.418696615489833e-8,0.0031595597943583466,-4.572549126524957e-5,7.44916678688917e-8,0.003159985788919604,-4.5832004494916494e-5,7.465002833083531e-8,0.003160391467505701,-4.5846244908167024e-5,7.466284408960723e-8,0.003160735390904223,-4.5791651761595475e-5,7.456824370500927e-8,0.003160991329864051,-4.5710340506587154e-5,7.443354724124745e-8,0.0031611557652805296,-4.56525958579643e-5,7.433840211999739e-8,0.0031612493653574466,-4.566356507695597e-5,7.43536688058528e-8,0.0031613116320375638,-4.577082683019708e-5,7.452191859422641e-8,0.00316138983687732,-4.5976704493927694e-5,7.484561016922063e-8,0.0031615255351170207,-4.625816721714404e-5,7.52873081576349e-8,0.00316174330606514,-4.6574539940815696e-5,7.578215147025375e-8,0.0031620456464795553,-4.687999059605023e-5,7.625769376845123e-8,0.003162415165519021,-4.713588347181678e-5,7.665335200741533e-8,0.003162822036835446,-4.731880660958561e-5,7.693289460631574e-8,0.0031632329785881486,-4.7422738256966696e-5,7.708762391075058e-8,0.0031636185498555743,-4.7456548574135615e-5,7.713222429686289e-8,0.003163957394531511,-4.743930170684533e-5,7.709723112409955e-8,0.003164237749092535,-4.7395460395258866e-5,7.702145770310557e-8,0.0031644572629982944,-4.735103026805132e-5,7.694598016390119e-8,0.0031646221440750945,-4.733077694987257e-5,7.690981863864776e-8,0.003164746262745098,-4.735610332844896e-5,7.694660644621445e-8,0.003164850315648308,-4.744295341822404e-5,7.708123668442743e-8,0.003164960615211108,-4.7599282087552986e-5,7.732580598792541e-8,0.00316510674443353,-4.7822150507262595e-5,7.767502077308712e-8,0.0031653173075884386,-4.809522158373371e-5,7.810233831505504e-8,0.003165613500816317,-4.8388234367153477e-5,7.855932068502407e-8,0.003166001527547761,-4.8660505245747866e-5,7.898136490858256e-8,0.0031664667240323473,-4.886967395690606e-5,7.930165483686465e-8,0.0031669732473650035,-4.898427913808119e-5,7.947106008168446e-8,0.0031674717018881997,-4.899555012818512e-5,7.94766938590658e-8,0.0031679131839261526,-4.892263568963575e-5,7.934999749978144e-8,0.0031682643359964833,-4.8808002238974886e-5,7.91591853553536e-8,0.0031685171259444567,-4.8704610129976645e-5,7.898863798646383e-8,0.003168689888016564,-4.866027347872532e-5,7.891391738685978e-8,0.0031688203554882553,-4.870497925930795e-5,7.898168134647224e-8,0.0031689541483683986,-4.884458925824059e-5,7.919995944645049e-8,0.003169132666912061,-4.90615415154104e-5,7.953967154409288e-8,0.0031693835370994743,-4.932123743816433e-5,7.994513150365482e-8,0.0031697155633991425,-4.958174182690445e-5,8.034963065946353e-8,0.0031701188096189092,-4.9803993111668386e-5,8.069160780662406e-8,0.0031705690690595756,-4.995993501816825e-5,8.092735112553882e-8,0.0031710349046023332,-5.003685841512912e-5,8.103761860361142e-8,0.003171484997353245,-5.003758483585365e-5,8.10276899103105e-8,0.0031718939250299756,-4.997743721292307e-5,8.092241368604767e-8,0.0031722454763997874,-4.98796363572316e-5,8.075886678430627e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_21.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_21.json deleted file mode 100644 index 600fe28d..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_21.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":21000,"numberOfSamples":1000,"samples":[0.0031725336341924394,-4.9770637985046546e-5,8.057900832626396e-8,0.0031727619720193665,-4.967631255249218e-5,8.042370582661394e-8,0.0031729423213677447,-4.961918610821703e-5,8.032842301827844e-8,0.003173093301004051,-4.9616439750269165e-5,8.032005503717977e-8,0.0031732388512125246,-4.9678142521825614e-5,8.04140915834666e-8,0.003173406461172115,-4.980531114277095e-5,8.061152056197695e-8,0.003173624434517486,-4.998780080363393e-5,8.089554409980637e-8,0.0031739174410596086,-5.02027153676187e-5,8.122921958837977e-8,0.0031743000569504428,-5.0414905317985565e-5,8.155645946622467e-8,0.0031747693572844707,-5.058170552271261e-5,8.1809696462639e-8,0.003175299754099858,-5.066328166614758e-5,8.192630588543693e-8,0.003175844728509721,-5.06368615606572e-5,8.187106223913913e-8,0.003176348378152092,-5.0508762136083794e-5,8.16550486069026e-8,0.0031767639923363524,-5.0316402748498936e-5,8.133866443459827e-8,0.0031770709661550177,-5.011689791600365e-5,8.101329428919594e-8,0.0031772811274633317,-4.9967147620633346e-5,8.076944687326912e-8,0.003177432030673561,-4.9905479367471625e-5,8.066745206192551e-8,0.003177572270523811,-4.994259580574966e-5,8.072317955227706e-8,0.003177746439699948,-5.0063033684474547e-5,8.091070950808379e-8,0.0031779848344744835,-5.0233470557248106e-5,8.117598151931799e-8,0.0031782992076989803,-5.0413262606724425e-5,8.145387798184555e-8,0.003178683508504494,-5.056397454491497e-5,8.168346678500409e-8,0.0031791178624765563,-5.0656360805938936e-5,8.181895509495128e-8,0.003179574229733301,-5.067436252240991e-5,8.183576329438713e-8,0.003180022490647086,-5.0616168724939576e-5,8.173192449420742e-8,0.0031804358927458322,-5.049270511433461e-5,8.152548156884965e-8,0.0031807950553075313,-5.0324297904340744e-5,8.124910490024964e-8,0.0031810901697997096,-5.013646650496189e-5,8.094342997127281e-8,0.003181321456190578,-4.995570801310683e-5,8.065043893174666e-8,0.0031814982527144423,-4.9805917795511555e-5,8.040785329190629e-8,0.0031816373210504898,-4.970574993088201e-5,8.024497887522197e-8,0.0031817608717426495,-4.9666782981278536e-5,8.017978161620004e-8,0.0031818944706078238,-4.969213348437762e-5,8.021665586604609e-8,0.003182064656150664,-4.977526990474911e-5,8.034455083019423e-8,0.0031822958582123618,-4.9899054210053294e-5,8.053555151866265e-8,0.0031826060765792474,-5.00355420814562e-5,8.074475516704612e-8,0.0031830011463665404,-5.014786026254351e-5,8.091345990457809e-8,0.0031834686693217383,-5.0195995982255704e-5,8.097846711663703e-8,0.0031839746468371897,-5.01475748419181e-5,8.088913626890179e-8,0.0031844673261262986,-4.999173257679851e-5,8.062922765445895e-8,0.003184891172592454,-4.974957666882377e-5,8.023331134917238e-8,0.0031852075073160895,-4.9472597723993216e-5,7.978406694492346e-8,0.0031854111053174357,-4.922574084934537e-5,7.938518959159813e-8,0.0031855320833315435,-4.9062718900561163e-5,7.912193983519057e-8,0.003185621952271365,-4.9007423813544054e-5,7.903149987919705e-8,0.003185733140730741,-4.905026352546958e-5,7.909733195325303e-8,0.003185903073154297,-4.915750209942922e-5,7.926446313102022e-8,0.0031861477150601954,-4.9285511618747645e-5,7.946261622724468e-8,0.0031864630412842053,-4.9393086955828754e-5,7.962606325736776e-8,0.0031868305582437354,-4.944910682330027e-5,7.970578335261417e-8,0.0031872237417380285,-4.9435815064372105e-5,7.967442526435043e-8,0.003187613799646374,-4.934910556784959e-5,7.952642648280632e-8,0.0031879743406409483,-4.919701658863508e-5,7.927535204629794e-8,0.0031882849181979036,-4.899707191619981e-5,7.894954072044581e-8,0.0031885333705692622,-4.8772886247731465e-5,7.85867133852273e-8,0.0031887169235430774,-4.8550472591157195e-5,7.82281831475899e-8,0.0031888421191353347,-4.8354611885566905e-5,7.791317453714298e-8,0.0031889236591736768,-4.820561826479776e-5,7.767373204135999e-8,0.003188982392912168,-4.811685191685343e-5,7.753076281390647e-8,0.0031890428229633568,-4.80931088914721e-5,7.749144001256398e-8,0.003189130371339149,-4.8129751866914776e-5,7.754779717892457e-8,0.0031892684093893045,-4.821248076042052e-5,7.767640704932689e-8,0.003189474936144377,-4.8317827589117846e-5,7.78393091488724e-8,0.003189758740824415,-4.841472688601514e-5,7.798671830001753e-8,0.0031901151496382964,-4.846801130205281e-5,7.806277470675716e-8,0.0031905224205677797,-4.844497532884705e-5,7.801604196463123e-8,0.003190941284990858,-4.8325353983456495e-5,7.781525298490396e-8,0.0031913210506145494,-4.811258839800113e-5,7.746697340533311e-8,0.0031916141519961177,-4.784055752540146e-5,7.702604990677442e-8,0.003191795418319783,-4.7568255887754585e-5,7.658695371946121e-8,0.0031918755740832448,-4.73600221174305e-5,7.625217949764229e-8,0.003191898603829455,-4.725988960279658e-5,7.609132297246147e-8,0.0031919229650166662,-4.7275184045738147e-5,7.611500607230232e-8,0.003191998333085281,-4.737827479416436e-5,7.62779363395227e-8,0.0031921508881996145,-4.752216804202383e-5,7.65041794434679e-8,0.003192381393929433,-4.765854984268982e-5,7.671628736820805e-8,0.0031926718219546014,-4.7750056416319196e-5,7.685497758163076e-8,0.003192994371773742,-4.7775167613736925e-5,7.688676322707986e-8,0.0031933191121518447,-4.7727892633397725e-5,7.680310882032987e-8,0.0031936191057208192,-4.761498877639121e-5,7.661565929511285e-8,0.0031938734231599622,-4.74525826505499e-5,7.635065824624502e-8,0.0031940688710230926,-4.7262880918771545e-5,7.60436847923047e-8,0.0031942008964133926,-4.707097737875328e-5,7.573466367930087e-8,0.0031942737606263116,-4.6901719035824056e-5,7.546299629687368e-8,0.003194299972841271,-4.6776661718682426e-5,7.526278957837741e-8,0.003194298887206334,-4.6711226468842323e-5,7.51583342891208e-8,0.003194294386829285,-4.671240074914931e-5,7.516039741374076e-8,0.0031943118407074603,-4.6777394668392805e-5,7.526403312546946e-8,0.0031943746893159835,-4.6893437644436546e-5,7.544826377873212e-8,0.0031945009495270385,-4.7038759907479775e-5,7.567773903852656e-8,0.0031946998830175675,-4.7184820903478814e-5,7.590646855791671e-8,0.0031949691011137634,-4.729986237129749e-5,7.608369607755573e-8,0.0031952925157211496,-4.735397448743149e-5,7.616211706606225e-8,0.003195640046002511,-4.7325873413935426e-5,7.610866131565764e-8,0.0031959707011487326,-4.721084275969199e-5,7.591694218179518e-8,0.0031962407678702612,-4.7027544120006907e-5,7.561778712416466e-8,0.0031964172220154555,-4.68193172139658e-5,7.528100427078354e-8,0.003196492459990767,-4.664522204584982e-5,7.500092425591764e-8,0.003196492024360513,-4.6560407478603466e-5,7.486507180241458e-8,0.0031964677331033607,-4.6593856889802264e-5,7.491877034751068e-8,0.003196477403032644,-4.673659702635629e-5,7.514654134177191e-8,0.0031965625176653793,-4.694773588519694e-5,7.548204705047288e-8,0.0031967362693748544,-4.717322873987367e-5,7.583837429474331e-8,0.003196985533609338,-4.73651776342118e-5,7.613905990916508e-8,0.0031972812138878572,-4.74929888958597e-5,7.633588427653374e-8,0.003197589462630078,-4.7545490933105095e-5,7.64119965822908e-8,0.0031978796496195555,-4.752757942989125e-5,7.637620017022061e-8,0.00319812848863574,-4.745512493931714e-5,7.625453549820702e-8,0.00319832144886984,-4.73503257355979e-5,7.608275219379998e-8,0.003198452856742482,-4.723812082730018e-5,7.590064580016247e-8,0.0031985255501511783,-4.7143356527051194e-5,7.57476813144896e-8,0.0031985502819583764,-4.708825806567633e-5,7.565908112945316e-8,0.003198544736531598,-4.708995351933302e-5,7.566191375034777e-8,0.0031985318797554075,-4.7158036203798245e-5,7.577116598009077e-8,0.0031985373474858482,-4.729251335254058e-5,7.598640463765804e-8,0.003198585869566576,-4.7482775567525455e-5,7.629010685976644e-8,0.003198697155597323,-4.77081476564717e-5,7.664860219081877e-8,0.0031988819238857836,-4.794029858008897e-5,7.701607636820799e-8,0.003199138852327985,-4.8147471043280815e-5,7.734153154992998e-8,0.003199453210956632,-4.830010600773658e-5,7.757794512375888e-8,0.003199797758983186,-4.8377126251611665e-5,7.769236057072432e-8,0.0032001363178023106,-4.8371976704389703e-5,7.767540881795748e-8,0.0032004303140051693,-4.829716076321788e-5,7.754825940028813e-8,0.0032006480922657813,-4.818534649742223e-5,7.736402060215561e-8,0.0032007754503471137,-4.8084736666072045e-5,7.720004750070717e-8,0.0032008237523528764,-4.804734673697885e-5,7.713910918442968e-8,0.0032008304786310298,-4.811209016681051e-5,7.724247975155619e-8,0.0032008488052868407,-4.828932206014769e-5,7.75255161602495e-8,0.0032009288771208118,-4.8555592301733185e-5,7.794960329169746e-8,0.0032010998408043487,-4.886272668875077e-5,7.843695977208304e-8,0.003201361960637265,-4.915635461273817e-5,7.89004476629134e-8,0.0032016912406135044,-4.939361188750261e-5,7.927192014721211e-8,0.0032020513707647475,-4.955240233850549e-5,7.951689650027676e-8,0.003202405716929175,-4.963141986809062e-5,7.963431614369855e-8,0.003202725094131901,-4.964474472975755e-5,7.96475824883057e-8,0.0032029909049170156,-4.961523348656123e-5,7.959378125967193e-8,0.0032031952157390927,-4.9569099471490336e-5,7.951497736532009e-8,0.003203339535741044,-4.9532218017991734e-5,7.945241230521701e-8,0.003203433394698867,-4.9527674213515084e-5,7.944273135170713e-8,0.003203493051170196,-4.9573859322178696e-5,7.951503476725994e-8,0.0032035401504446515,-4.968261143955701e-5,7.968790885396807e-8,0.003203599881864006,-4.9857248372708116e-5,7.996622623173358e-8,0.0032036981474841027,-5.009083623491609e-5,8.033833401588e-8,0.003203857560932273,-5.036549668524096e-5,8.077497791863144e-8,0.003204092697562571,-5.0653692877754714e-5,8.123148677107812e-8,0.003204405679190628,-5.092213317310819e-5,8.165420910353239e-8,0.0032047836194003913,-5.1138171334250516e-5,8.199093925766638e-8,0.0032051993388942314,-5.1277508026645685e-5,8.220333981594443e-8,0.0032056159214573134,-5.1331152612609345e-5,8.227803147217174e-8,0.003205994476325643,-5.130950962968257e-5,8.223291039616594e-8,0.0032063034747539243,-5.124205747668012e-5,8.211628608958799e-8,0.0032065274675029567,-5.117202959915313e-5,8.199800522314307e-8,0.0032066727907678195,-5.114661833837934e-5,8.195353656090792e-8,0.003206768020942503,-5.120449980278048e-5,8.204400434520673e-8,0.003206857735831905,-5.1363916576045276e-5,8.229736031489842e-8,0.0032069901253816147,-5.161569359479557e-5,8.269759795845019e-8,0.0032072020803685336,-5.192501441612641e-5,8.318797642795423e-8,0.0032075077397297554,-5.2242393867866604e-5,8.368882847285539e-8,0.0032078955532431,-5.251946367429561e-5,8.412289258504691e-8,0.0032083345384939406,-5.272262269658563e-5,8.443706503733802e-8,0.0032087857334492185,-5.2839458337762004e-5,8.461246000974382e-8,0.0032092132683576424,-5.287735806351859e-5,8.466190722367029e-8,0.003209591378752329,-5.285732676741347e-5,8.461980304623928e-8,0.0032099067777057117,-5.28068081968459e-5,8.45304822826286e-8,0.0032101578456377655,-5.275393921740916e-5,8.443903221733049e-8,0.0032103524731652163,-5.272386017376191e-5,8.438550073902889e-8,0.003210505786562472,-5.273660287213019e-5,8.440164096217491e-8,0.0032106382225371155,-5.280577247081059e-5,8.450886182259405e-8,0.0032107738321281018,-5.293736316606222e-5,8.471631689347386e-8,0.0032109383060951215,-5.312841217033488e-5,8.501870672494748e-8,0.0032111560978738906,-5.3365752533195204e-5,8.53942849508674e-8,0.0032114462795934918,-5.362571089155793e-5,8.580446840164302e-8,0.003211817437324192,-5.3875979778961625e-5,8.619700739786424e-8,0.003212262941595191,-5.408075100149098e-5,8.651439387397291e-8,0.0032127589082548043,-5.42090965214644e-5,8.670741201761251e-8,0.003213267160170133,-5.4244595572723914e-5,8.675057308886833e-8,0.0032137438024166646,-5.419248668805494e-5,8.665344939450431e-8,0.003214151231767454,-5.4080711291759844e-5,8.646208359285265e-8,0.0032144693035585834,-5.395352361443707e-5,8.624839037585663e-8,0.003214701461565474,-5.385958237500533e-5,8.609072790016972e-8,0.003214873783886847,-5.383864063516811e-5,8.605238679805011e-8,0.0032150276171485034,-5.391105610832501e-5,8.616487457733809e-8,0.003215208326315366,-5.4072889410851724e-5,8.642041535988369e-8,0.0032154533705997484,-5.429755486548332e-5,8.677506471248515e-8,0.0032157828754069747,-5.4543390211428154e-5,8.716123185097693e-8,0.0032161952720170784,-5.47649828140714e-5,8.750601063943785e-8,0.0032166691643119804,-5.492483570390711e-5,8.7749822276115e-8,0.003217170484883344,-5.500177601999277e-5,8.785966932376333e-8,0.0032176621369899984,-5.499386164298536e-5,8.783350388091249e-8,0.0032181127441866936,-5.491583634520034e-5,8.76958803060696e-8,0.003218502126948113,-5.479314994168618e-5,8.748819344576886e-8,0.0032188229483265337,-5.465521433334049e-5,8.72578166749344e-8,0.0032190794757014783,-5.452988429357098e-5,8.704931644272088e-8,0.0032192849457666393,-5.443991014971355e-5,8.689888287838887e-8,0.003219458734952503,-5.440110974291796e-5,8.683149639470852e-8,0.003219623918717538,-5.442154904813298e-5,8.685964506488469e-8,0.0032198052118412182,-5.45010330062948e-5,8.698248405259667e-8,0.0032200268668433098,-5.463053766414709e-5,8.718490554543236e-8,0.0032203099278025797,-5.479171920972871e-5,8.743680309860852e-8,0.0032206683696555803,-5.4957218224956276e-5,8.769370344416006e-8,0.003221104252445989,-5.509302127948437e-5,8.790074530833945e-8,0.0032216031987040658,-5.516423932315975e-5,8.800209652952139e-8,0.003222132914621037,-5.514457142603367e-5,8.795617458979574e-8,0.003222647901010924,-5.502711200558859e-5,8.775290593353369e-8,0.0032231013851103294,-5.483131338436564e-5,8.74247239172623e-8,0.003223460966712298,-5.4600702849415643e-5,8.704264763661174e-8,0.003223720696988658,-5.43901749473945e-5,8.66955543476372e-8,0.0032239032022557705,-5.4248004296358326e-5,8.646099319840247e-8,0.003224051050262102,-5.4200944786757004e-5,8.638114273675721e-8,0.003224212268778945,-5.424827912428962e-5,8.645345453958669e-8,0.0032244265358801734,-5.4365234327404105e-5,8.663660081008881e-8,0.003224716276502034,-5.451231450454134e-5,8.686597920410975e-8,0.003225083737911467,-5.4646403659949004e-5,8.707189019189658e-8,0.0032255131188312245,-5.473059972318432e-5,8.719538813836393e-8,0.0032259761006378034,-5.4741087113638165e-5,8.719911679190398e-8,0.0032264390598020325,-5.467034723233956e-5,8.707212789604444e-8,0.003226870334335864,-5.452668660564738e-5,8.682879510984012e-8,0.0032272460710804887,-5.4330699940323715e-5,8.65029138253738e-8,0.0032275536298945894,-5.4109915442819836e-5,8.613902532997006e-8,0.003227792304669776,-5.389313593906661e-5,8.5783374691673e-8,0.0032279718677233277,-5.370570458175747e-5,8.547642058179856e-8,0.003228109845550558,-5.356634066004432e-5,8.524786544988952e-8,0.003228228456413095,-5.348557339633553e-5,8.511420042723426e-8,0.0032283518197443535,-5.346531342893715e-5,8.507801310989298e-8,0.0032285035568127823,-5.349896832429377e-5,8.512814037196994e-8,0.003228704536722173,-5.357174984312455e-5,8.524016481482288e-8,0.0032289703539402797,-5.366119984972382e-5,8.537735462686527e-8,0.00322930813206437,-5.373842092470895e-5,8.549282323459017e-8,0.003229712689921856,-5.377103839587337e-5,8.553448506801853e-8,0.0032301631836865975,-5.3729107718665944e-5,8.545465152637074e-8,0.0032306227277087924,-5.359428799950994e-5,8.522472059019744e-8,0.0032310441986026,-5.337012969281068e-5,8.48515280839209e-8,0.0032313836582013745,-5.30879790841398e-5,8.438660592029636e-8,0.0032316176061930268,-5.280197806460897e-5,8.391790250084734e-8,0.0032317548261706127,-5.2571609399665335e-5,8.354146004605948e-8,0.0032318343808087915,-5.243934120871027e-5,8.332524114371036e-8,0.00323190997001867,-5.24157284474321e-5,8.328513968311465e-8,0.003232029903870015,-5.247922773889295e-5,8.33849749888785e-8,0.0032322230037252673,-5.2587959715898925e-5,8.355594128527012e-8,0.0032324945300250224,-5.269508974157829e-5,8.372185756843382e-8,0.0032328299476484103,-5.2761097382812485e-5,8.381914925073835e-8,0.0032332022647684135,-5.2760565068347416e-5,8.380767128683809e-8,0.0032335796804347913,-5.268412304439345e-5,8.367349551296979e-8,0.003233931955256522,-5.2537170491451925e-5,8.342645104170425e-8,0.00323423510297691,-5.2336755010051395e-5,8.309480474079313e-8,0.003234474406802793,-5.210743061617814e-5,8.271847665355266e-8,0.0032346457437325534,-5.187668488346703e-5,8.234172294838152e-8,0.003234755280902423,-5.167055575138879e-5,8.200621219761825e-8,0.003234817807050895,-5.150997501251897e-5,8.174527616602243e-8,0.00323485410132211,-5.140821394599531e-5,8.157988013641992e-8,0.0032348878601373273,-5.1369622605597356e-5,8.15166024002056e-8,0.003234942697918216,-5.138953284328997e-5,8.154743911983669e-8,0.00323503947037617,-5.1454958354580704e-5,8.16508993774942e-8,0.0032351938886941546,-5.154582187779148e-5,8.179401797604287e-8,0.0032354142832091816,-5.16366609641141e-5,8.193524012891515e-8,0.003235699333554656,-5.1699018157927345e-5,8.202847891428973e-8,0.0032360358332845078,-5.170513116825102e-5,8.202923924758582e-8,0.003236397395298634,-5.163367599192616e-5,8.190391001440081e-8,0.0032367460274376706,-5.147751296830587e-5,8.164208997353886e-8,0.003237038911014802,-5.125146075858404e-5,8.126881868503913e-8,0.0032372413519731985,-5.099546813545693e-5,8.084938120768122e-8,0.0032373424767896393,-5.076735769152771e-5,8.04773994266105e-8,0.003237364737593232,-5.0623575968753e-5,8.024369261604461e-8,0.0032373583817348877,-5.0595930934664296e-5,8.01987556722749e-8,0.0032373814263608053,-5.067835383782129e-5,8.033154293976049e-8,0.0032374767927001143,-5.0831888417986464e-5,8.05778502518239e-8,0.0032376595358681605,-5.100299476696643e-5,8.08503013355666e-8,0.0032379179830066707,-5.1142929781694154e-5,8.106998345596535e-8,0.0032382234578475634,-5.121949714913483e-5,8.118548183125027e-8,0.0032385413765336594,-5.1220034229706235e-5,8.117745244402647e-8,0.0032388396301233986,-5.1148784000511076e-5,8.105395968506553e-8,0.00323909343633175,-5.1022080757357263e-5,8.084232217504016e-8,0.003239287476598087,-5.086344596635564e-5,8.058099601387515e-8,0.003239416418574005,-5.06993062299847e-5,8.031267394281034e-8,0.0032394844711164405,-5.055531403368913e-5,8.007849327535253e-8,0.0032395041778899027,-5.0453203864372276e-5,7.991313554603084e-8,0.003239494528968082,-5.0408228290502986e-5,7.98408045445796e-8,0.0032394784475627734,-5.0427301336513986e-5,7.987225828658261e-8,0.003239479791896909,-5.050810067219918e-5,8.000332058699083e-8,0.0032395202194974377,-5.063931236648878e-5,8.021522493846629e-8,0.003239616293252338,-5.080193546123921e-5,8.047671952390412e-8,0.003239777049036872,-5.097147176821398e-5,8.074769163503124e-8,0.003240002171167665,-5.112088531384368e-5,8.098412232278307e-8,0.0032402808961741075,-5.122423243494423e-5,8.114415044682696e-8,0.0032405918090109447,-5.126100829262938e-5,8.119521335082708e-8,0.003240904131438615,-5.122133435508816e-5,8.112236888320618e-8,0.003241181684719136,-5.111146117220087e-5,8.093692711688671e-8,0.003241390622446391,-5.095766931217798e-5,8.068237971757372e-8,0.0032415106650658305,-5.080520775946731e-5,8.04323546602781e-8,0.003241546514068598,-5.070868740467566e-5,8.027494782684523e-8,0.0032415324844812794,-5.071373081832885e-5,8.028313812372978e-8,0.003241523709398545,-5.083705921425271e-5,8.048281634683229e-8,0.0032415751240446157,-5.1057319994444045e-5,8.083823631077988e-8,0.003241719537245258,-5.132391935969942e-5,8.126660197144499e-8,0.0032419576140943988,-5.157842278878715e-5,8.167296421774885e-8,0.0032422632301883753,-5.177516910115313e-5,8.198373070848606e-8,0.0032425973491017465,-5.189151237656024e-5,8.216316480911329e-8,0.003242921385633165,-5.192728220314501e-5,8.221219939811576e-8,0.003243205429064354,-5.1898436692860174e-5,8.215775773060924e-8,0.0032434313058024543,-5.182970678799692e-5,8.204054311489319e-8,0.0032435923938506023,-5.1748673330064326e-5,8.190536290404036e-8,0.0032436920809447035,-5.1681708633171465e-5,8.179466859600291e-8,0.0032437419250657485,-5.165123951677518e-5,8.17443236041018e-8,0.0032437597611700603,-5.167373948957442e-5,8.178051974505204e-8,0.0032437676397874047,-5.1758154968282606e-5,8.191729901686929e-8,0.003243789408658554,-5.190473825027876e-5,8.215464440259327e-8,0.0032438478099100776,-5.2104555505873134e-5,8.247762756783664e-8,0.0032439612563935362,-5.234009583257239e-5,8.28573715553115e-8,0.0032441407595725984,-5.258721229750601e-5,8.325425050664329e-8,0.0032443875424479525,-5.281834024054875e-5,8.36232428780749e-8,0.0032446918276209393,-5.300675228469284e-5,8.392100559929466e-8,0.0032450332255609038,-5.3131371114476176e-5,8.411381289746435e-8,0.00324538295404514,-5.318148371486626e-5,8.418520437848297e-8,0.003245707983573782,-5.316071079859441e-5,8.414223757206918e-8,0.0032459772192329835,-5.3089364431137183e-5,8.401896535485175e-8,0.0032461694781570896,-5.300370532228837e-5,8.387484551908885e-8,0.003246281847351533,-5.2950284714670026e-5,8.37853066862844e-8,0.0032463352544695014,-5.297443793121066e-5,8.382308719834454e-8,0.0032463728424833803,-5.310479309421307e-5,8.403337508404443e-8,0.003246448216996769,-5.333992759564566e-5,8.441256609303461e-8,0.0032466062921121183,-5.364552457477591e-5,8.49040114435253e-8,0.0032468659901151594,-5.396605828032138e-5,8.541718992475005e-8,0.003247214553528512,-5.424562065011762e-5,8.586156956307863e-8,0.003247615679936334,-5.444642162568678e-5,8.617657458590432e-8,0.003248024912597425,-5.455655514944839e-5,8.634399975468773e-8,0.003248403432332568,-5.458687626580262e-5,8.638262859372707e-8,0.0032487255353343303,-5.4562352771310106e-5,8.633386467620277e-8,0.00324898008935198,-5.451326661190067e-5,8.624724859115626e-8,0.0032491685238771285,-5.4468896133598934e-5,8.617020704301661e-8,0.0032493017385686698,-5.44538837415368e-5,8.614231992982142e-8,0.0032493972235823195,-5.448639212370825e-5,8.619253072529561e-8,0.0032494766715691,-5.4577106999117414e-5,8.633766110669544e-8,0.003249563821635595,-5.4728537878472483e-5,8.658130339795376e-8,0.0032496821379050258,-5.4934496846960336e-5,8.691293350608795e-8,0.0032498520196944476,-5.5180047124981716e-5,8.730779131766455e-8,0.0032500875683692987,-5.544249647615775e-5,8.772852392629017e-8,0.0032503934051933206,-5.569395062737085e-5,8.812944569042736e-8,0.0032507623946056432,-5.5905572624570456e-5,8.846361811302392e-8,0.0032511752416808635,-5.60531534073218e-5,8.869203900002466e-8,0.0032516027189509527,-5.6122949655416366e-5,8.879316740083876e-8,0.003252010653866079,-5.6116271961945236e-5,8.87702629117698e-8,0.0032523669850277413,-5.605136928982403e-5,8.865417136694602e-8,0.0032526495630223616,-5.596163996267052e-5,8.850004846746351e-8,0.003252852996146235,-5.588978132512746e-5,8.837752315420322e-8,0.0032529925562878982,-5.58782471815996e-5,8.83550511189378e-8,0.003253103082055259,-5.595758026448335e-5,8.848108953757554e-8,0.0032532314776745693,-5.613576384150119e-5,8.876716640678854e-8,0.0032534234568621025,-5.6393001850667115e-5,8.917985280515563e-8,0.0032537084871765787,-5.668575826548498e-5,8.964767779069584e-8,0.0032540894242032077,-5.696017640428366e-5,9.008307761306017e-8,0.00325454214619616,-5.716962075359378e-5,9.041084937999461e-8,0.0032550252674333844,-5.728830620990315e-5,9.059011621990187e-8,0.003255494511827089,-5.731556283163272e-5,9.06209904156305e-8,0.003255914883576044,-5.7271048375594106e-5,9.0536487245569e-8,0.003256266746644497,-5.71854418674298e-5,9.03871423788393e-8,0.003256546050101389,-5.709145577327869e-5,9.022629331978918e-8,0.003256761198809244,-5.701770488175832e-5,9.010018411835402e-8,0.0032569290319573213,-5.6985589687069876e-5,9.004308407198988e-8,0.0032570712782715805,-5.700820517414628e-5,9.007569729439265e-8,0.003257211829634789,-5.709019855395602e-5,9.02050273070369e-8,0.003257374555642879,-5.722785472994945e-5,9.042451477474267e-8,0.0032575811280771455,-5.740918789972536e-5,9.07141464433097e-8,0.0032578484112563417,-5.761434937787547e-5,9.104111671626653e-8,0.003258185352705804,-5.781702102123823e-5,9.136217618930464e-8,0.0032585898547709312,-5.7987501554828986e-5,9.162880083070914e-8,0.003259046711760422,-5.8097856157750106e-5,9.179571951463989e-8,0.0032595281106661137,-5.812865707175766e-5,9.183195308320635e-8,0.003259997899742414,-5.807559874358659e-5,9.173151942039728e-8,0.003260419534272522,-5.7953377600878414e-5,9.151954278320197e-8,0.003260765818064894,-5.7794560130481856e-5,9.125009531413922e-8,0.0032610273094332534,-5.7642803315349266e-5,9.099481763997835e-8,0.0032612163205118245,-5.754195090058938e-5,9.082492438170712e-8,0.0032613648222029144,-5.752416949150301e-5,9.07918667306029e-8,0.0032615165714595593,-5.7600716096652344e-5,9.09125486368035e-8,0.003261715522120589,-5.7758163232549566e-5,9.116362370356967e-8,0.003261993680028687,-5.796146329096944e-5,9.148694570509478e-8,0.0032623620293660872,-5.8163394938097374e-5,9.180524978805767e-8,0.003262807665272582,-5.8317766793719975e-5,9.20437012761951e-8,0.0032632983134054426,-5.839199548958222e-5,9.215020451540345e-8,0.0032637924706452283,-5.8374669624859956e-5,9.210741718701442e-8,0.0032642511156409566,-5.827592207902026e-5,9.193302480930112e-8,0.0032646467560847373,-5.8121634092867766e-5,9.167002565308534e-8,0.003264967464613854,-5.794476140729533e-5,9.137245205768258e-8,0.0032652161360441057,-5.777729029325265e-5,9.109227604970783e-8,0.0032654068966987506,-5.764485386744147e-5,9.087078295628466e-8,0.003265560763456718,-5.756421591411039e-5,9.073466938213295e-8,0.0032657018358711034,-5.754278131830879e-5,9.069539608026732e-8,0.0032658544101094944,-5.757911789189286e-5,9.075008999633211e-8,0.0032660408074434333,-5.766372839766714e-5,9.088277448331733e-8,0.003266279396647697,-5.777976701135738e-5,9.106550153542938e-8,0.003266582301739539,-5.790395532285883e-5,9.12598753635655e-8,0.0032669526451217174,-5.80083795326496e-5,9.142009964322477e-8,0.003267381767555401,-5.8063972041273024e-5,9.149881185930952e-8,0.0032678476163183977,-5.804619770493952e-5,9.145646309337639e-8,0.003268316164476314,-5.79424713012002e-5,9.12733988533491e-8,0.0032687475221006164,-5.7759070899220414e-5,9.096097972973574e-8,0.003269106529960257,-5.7523825509117984e-5,9.056570793575683e-8,0.0032693746058921917,-5.7281393394498796e-5,9.01612217244734e-8,0.0032695575700859222,-5.7081169177186004e-5,8.982829299441299e-8,0.003269685200835826,-5.696205583363011e-5,8.962983858648573e-8,0.003269802214385346,-5.69404396125155e-5,8.959138558936853e-8,0.0032699545344188102,-5.700604476264368e-5,8.969464615227079e-8,0.0032701763009091883,-5.7126338282034846e-5,8.988518777066455e-8,0.003270481677542585,-5.725676162404585e-5,9.008956185060092e-8,0.0032708629470038705,-5.735286992395743e-5,9.023531943545998e-8,0.00327129431081459,-5.73809369580062e-5,9.026823726629858e-8,0.003271739599354458,-5.7324683909892404e-5,9.0162995318363e-8,0.0032721614993477402,-5.7187059246788255e-5,8.992569167509696e-8,0.0032725298445275717,-5.698731841848309e-5,8.958873870059514e-8,0.0032728270521627735,-5.675482647236528e-5,8.920055536744774e-8,0.003273049851570274,-5.652171851946322e-5,8.881356947561132e-8,0.0032732076970815966,-5.6316492523811355e-5,8.847388481842329e-8,0.003273319145670565,-5.615979289425225e-5,8.821459453534936e-8,0.0032734076545255755,-5.6062581528121386e-5,8.80529729256984e-8,0.003273497839452653,-5.602614665502433e-5,8.799058220459504e-8,0.003273612612866018,-5.604313201827532e-5,8.801494830994981e-8,0.0032737710867281598,-5.609888691693807e-5,8.81017115844299e-8,0.0032739868282610452,-5.617282175496241e-5,8.821681580619211e-8,0.0032742660365082388,-5.6239927611709573e-5,8.831905491514963e-8,0.003274605453936708,-5.627300819139812e-5,8.836386764965425e-8,0.0032749903608651097,-5.624637481283029e-5,8.830953041101465e-8,0.0032753938061936853,-5.614154823740327e-5,8.812653176627841e-8,0.0032757789936782864,-5.595449360495289e-5,8.78092919463083e-8,0.003276106647287594,-5.5701960526054305e-5,8.738628367074491e-8,0.0032763471421135533,-5.5422576587764e-5,8.692152997987455e-8,0.003276493258995722,-5.516877259292599e-5,8.650115186701256e-8,0.0032765664014518425,-5.499014654352684e-5,8.6206007430559e-8,0.003276610999942624,-5.491529491512299e-5,8.608196484440229e-8,0.00327667876464851,-5.494164014254628e-5,8.612345199946136e-8,0.0032768108494707626,-5.5038149965003114e-5,8.627829358674474e-8,0.0032770262708863127,-5.5157998227194705e-5,8.646888984364038e-8,0.0032773198064892668,-5.525387498988542e-5,8.661760852501955e-8,0.003277667339223204,-5.528988528837087e-5,8.666631731922832e-8,0.0032780346135977243,-5.5247658906088445e-5,8.658614562003795e-8,0.0032783860663120725,-5.512713483912658e-5,8.637835326428021e-8,0.0032786918994025917,-5.494363190933129e-5,8.606912261480339e-8,0.0032789327276445193,-5.472280951801439e-5,8.570104945011115e-8,0.003279101674465376,-5.449476059083265e-5,8.532342409842275e-8,0.0032792040453030104,-5.4288301754132294e-5,8.498301212375031e-8,0.0032792550494914192,-5.4126402494692005e-5,8.471678473867611e-8,0.00327927635003745,-5.402331015253779e-5,8.454741469132955e-8,0.003279292261048445,-5.398344931011103e-5,8.448159405887646e-8,0.0032793262697919023,-5.4001841681931624e-5,8.451073771217038e-8,0.0032793983038223334,-5.406554644950239e-5,8.461328637466328e-8,0.003279522775013503,-5.4155543035676e-5,8.475773055077884e-8,0.0032797071337421773,-5.4248736184423704e-5,8.490590178054932e-8,0.0032799506498463736,-5.432014534373688e-5,8.501666483516674e-8,0.003280243299674806,-5.434560660615751e-5,8.505051210231342e-8,0.003280565004985942,-5.430549748269372e-5,8.497579494488648e-8,0.003280886168989561,-5.4189871664097075e-5,8.47771184438119e-8,0.003281171139090372,-5.4004474659509736e-5,8.446499011144445e-8,0.003281386101154559,-5.377533480404946e-5,8.408301336304262e-8,0.0032815110470657827,-5.354778435894943e-5,8.370597725390225e-8,0.003281551525320081,-5.3376005048922325e-5,8.342256462979238e-8,0.0032815423544261006,-5.3303997698127796e-5,8.330417977081286e-8,0.0032815375199139597,-5.334662167257096e-5,8.337402779899631e-8,0.003281589425999078,-5.3482477388724635e-5,8.359571772677401e-8,0.003281729077837722,-5.366347603158219e-5,8.388931201996357e-8,0.0032819577992785165,-5.383448660629819e-5,8.416390530143764e-8,0.003282252028816867,-5.3951461208844274e-5,8.434755805679241e-8,0.003282575064733863,-5.399087527054447e-5,8.440270284958065e-8,0.0032828888308288045,-5.395041499415586e-5,8.432692167156779e-8,0.0032831620823933123,-5.384442525035143e-5,8.414501783308623e-8,0.003283374577592845,-5.369758720472906e-5,8.389827797025655e-8,0.0032835182149421297,-5.3538900495709054e-5,8.363445972132653e-8,0.003283596317507677,-5.3396677990892325e-5,8.339967143688218e-8,0.0032836217594359217,-5.3294597136367996e-5,8.323212142857587e-8,0.0032836142689651616,-5.3248868881598726e-5,8.31577096068053e-8,0.0032835972456282487,-5.326663219322064e-5,8.318754756177193e-8,0.003283594445314077,-5.33455619881586e-5,8.331735797629278e-8,0.003283626858166137,-5.34746355750414e-5,8.35286872417797e-8,0.0032837101355881193,-5.363590835227975e-5,8.379175121758466e-8,0.0032838527983820075,-5.3806929427041975e-5,8.406937560267436e-8,0.003284055181100754,-5.396343946274494e-5,8.432148778286718e-8,0.0032843089773761463,-5.40822511951771e-5,8.450998775388706e-8,0.003284597358913076,-5.414438100313206e-5,8.460404446842303e-8,0.003284895834787221,-5.413857912979374e-5,8.458595257932233e-8,0.003285174445296768,-5.406532947278778e-5,8.445757818292492e-8,0.0032854023338345904,-5.3940697089698616e-5,8.424636958756322e-8,0.0032855554831677934,-5.379806390910282e-5,8.400782714837921e-8,0.003285626815766494,-5.3684562539693467e-5,8.38193737194727e-8,0.0032856347701112503,-5.3649414340871245e-5,8.376117760633833e-8,0.0032856235616832005,-5.3725485877918647e-5,8.38860837426238e-8,0.003285650142636974,-5.391249164401037e-5,8.419236027689752e-8,0.0032857616382241683,-5.4173556173630084e-5,8.461836300416228e-8,0.003285976011289329,-5.444965808100916e-5,8.50665090145353e-8,0.003286277545198635,-5.468347961861177e-5,8.544264341871019e-8,0.0032866275363075573,-5.483838580460321e-5,8.568728752895917e-8,0.0032869809330381304,-5.490461627338049e-5,8.578565026164803e-8,0.0032872996339806037,-5.489474335285152e-5,8.575977711296552e-8,0.003287559053510933,-5.48347345844862e-5,8.565341922089876e-8,0.0032877491677817746,-5.475543920672599e-5,8.551775502054806e-8,0.0032878725457978937,-5.4686451467669074e-5,8.540127833973602e-8,0.0032879413934742783,-5.465235422268597e-5,8.534381381044643e-8,0.003287974597188788,-5.4670536130827427e-5,8.53731992403231e-8,0.003287994886136215,-5.474993658443841e-5,8.550343585455102e-8,0.003288026004617243,-5.489052942074253e-5,8.573393033814724e-8,0.0032880898877680324,-5.508355309891816e-5,8.604985500404462e-8,0.003288203921857211,-5.5312587539400495e-5,8.642385409484243e-8,0.0032883785505384453,-5.5555608027442216E-05,8.681938148259401e-8,0.0032886156357365445,-5.578790705412445e-5,8.719554080619211e-8,0.0032889078436774757,-5.5985521987479445e-5,8.751283667062376e-8,0.003289239125545009,-5.612881998939157e-5,8.77392146012537e-8,0.003289586318797038,-5.620594849831879e-5,8.78558281449679e-8,0.0032899218910641607,-5.621585137160659e-5,8.786195042061433e-8,0.0032902179191576634,-5.617054021271309e-5,8.77784760736655e-8,0.0032904515278464005,-5.609599525829377e-5,8.764903319639631e-8,0.003290611690989794,-5.603034994237022e-5,8.753663675600585e-8,0.0032907060886177963,-5.601757230920074e-5,8.751312401969255e-8,0.0032907648315062244,-5.60957001758165e-5,8.763993271030684e-8,0.00329083651219213,-5.628175714456582e-5,8.794367269940098e-8,0.003290973902945432,-5.656023599277606e-5,8.839762192953688e-8,0.003291213321631433,-5.6884077700507716e-5,8.892363541663668e-8,0.003291558763057707,-5.7191191598862794e-5,8.941943124269481e-8,0.0032919809643103797,-5.742839856654776e-5,8.979798297636507e-8,0.0032924313677109907,-5.756902600419823e-5,9.001640079964623e-8,0.0032928611324823196,-5.7616237434723784e-5,9.008120657162066e-8,0.003293234884122227,-5.759476981903807e-5,9.003437623650073e-8,0.003293535602904595,-5.753893290328132e-5,8.993321103832823e-8,0.003293762927268325,-5.7482792094576774e-5,8.983397854989548e-8,0.003293928650397064,-5.745439610101603e-5,8.978246898705095e-8,0.003294052074754002,-5.7473344437337244e-5,8.981023130920463e-8,0.003294156313027807,-5.755021904012821e-5,8.993390698836747e-8,0.0032942654733313977,-5.768674160814335e-5,9.01556607176256e-8,0.0032944022662521263,-5.787621616364838e-5,9.046394738638393e-8,0.003294585697181951,-5.810428412374258e-5,9.083470767938509e-8,0.003294828730883638,-5.835025192829971e-5,9.123350329312376e-8,0.0032951361110117538,-5.858935210068161e-5,9.161924961334033e-8,0.003295502862145243,-5.879608733804884e-5,9.194981099819587e-8,0.0032959140922813155,-5.894836427269165e-5,9.218894166181916e-8,0.003296346501630117,-5.903178845858687e-5,9.2313465377073e-8,0.0032967716942378903,-5.904330752969372e-5,9.231927451156279e-8,0.003297161013652729,-5.8993325195830865e-5,9.222465017716898e-8,0.0032974912528637187,-5.8905595820280855e-5,9.206977518622295e-8,0.0032977504065195102,-5.881449638135142e-5,9.191186754025751e-8,0.003297942473857903,-5.875940209359208e-5,9.181563871498607e-8,0.0032980898714052753,-5.877616173854993e-5,9.183921908280787e-8,0.0032982314957932714,-5.88866346272826e-5,9.201718962789459e-8,0.0032984146833885644,-5.908904162486795e-5,9.23451566292984e-8,0.0032986812779857745,-5.935379884542151e-5,9.277334751463147e-8,0.003299051997951586,-5.962945134656554e-5,9.321663709787946e-8,0.003299516827886728,-5.985901363351853e-5,9.358146928311346e-8,0.0033000378122319263,-5.999998453310655e-5,9.379868554416737e-8,0.003300563468977945,-6.003775679601342e-5,9.384541959529023e-8,0.003301046759699778,-5.9986342425414024e-5,9.374604054768167e-8,0.0033014576765286454,-5.987863396959832e-5,9.355579500500295e-8,0.003301786809054379,-5.975339670750789e-5,9.33390980278829e-8,0.0033020419823445663,-5.964508164161518e-5,9.315264867329e-8,0.0033022421362587082,-5.9578548895871055e-5,9.303685979764736e-8,0.003302411561432909,-5.9567748630520254e-5,9.301394192772079e-8,0.0033025757102160976,-5.961647141519134e-5,9.308938092423752e-8,0.003302758454813665,-5.971971311326604e-5,9.32543085753427e-8,0.003302980149123383,-5.986499809573707e-5,9.348767984635991e-8,0.0033032558966772426,-6.003362496588928e-5,9.375826851834662e-8,0.003303593705146403,-6.0202192353766145e-5,9.402715772445558e-8,0.0033039926166897105,-6.034495084095433e-5,9.425167222522078e-8,0.003304441386900897,-6.043737478577002e-5,9.439138689843304e-8,0.003304918618617791,-6.046082993353868e-5,9.441594479608006e-8,0.0033053952081656575,-6.040751190609572e-5,9.431324511412548e-8,0.0033058394190006372,-6.028418972979809e-5,9.409552551950787e-8,0.0033062239072710452,-6.011307792870043e-5,9.380056022170947e-8,0.0033065329819612454,-5.99287475949815e-5,9.348622559924204e-8,0.003306767914704313,-5.977122717532698e-5,9.321879190076651e-8,0.003306948486177933,-5.9676703637333575e-5,9.305741226162379e-8,0.0033071098761496675,-5.966803032891732e-5,9.303855751819586e-8,0.003307295078633383,-5.974750722150152e-5,9.316446634613662e-8,0.003307544114132092,-5.9894223093106617E-05,9.339925812123948e-8,0.0033078824817017226,-6.006764076265878e-5,9.367527554290179e-8,0.003308312428674662,-6.021771715946743e-5,9.390997219756039e-8,0.003308810868846452,-6.02993136284251e-5,9.402960860305769e-8,0.003309335890088662,-6.028585030600706e-5,9.39915224159716e-8,0.003309839846317023,-6.017646168426142e-5,9.379561381316522e-8,0.003310283495942255,-5.999380790271972e-5,9.348042402784567e-8,0.0033106453888089448,-5.977450811021991e-5,9.310709708273535e-8,0.0033109239015205183,-5.955734946844783e-5,9.273979011758474e-8,0.003311133299984977,-5.937407692846487e-5,9.243051520461885e-8,0.0033112972340637236,-5.924481776115903e-5,9.221178385233012e-8,0.0033114426199441147,-5.917750316763905e-5,9.209590179549796e-8,0.0033115952609545363,-5.9169497804775444e-5,9.207784107991695e-8,0.003311777204723194,-5.920987375766593e-5,9.213904652853273e-8,0.0033120052080999,-5.92814938356559e-5,9.225082851606375e-8,0.003312289594904694,-5.936274846059623e-5,9.237717028262174e-8,0.003312633024578902,-5.942929679557276e-5,9.247760893901174e-8,0.003313029137070735,-5.945642637260442e-5,9.251122688928723e-8,0.0033134615879803833,-5.942257807852542e-5,9.244260873645003e-8,0.0033139044987459776,-5.931413137224047e-5,9.22498336783901e-8,0.0033143255654085853,-5.913063940039792e-5,9.193309185903323e-8,0.003314692523404364,-5.888852657791199e-5,9.152061902109267e-8,0.003314982071759978,-5.862063074863608e-5,9.106765658072329e-8,0.0033151883441194956,-5.836990960235362e-5,9.064573525743296e-8,0.003315327061036844,-5.817820907612507e-5,9.032387007253822e-8,0.003315432756404787,-5.807381239007963e-5,9.014792415786519e-8,0.003315549502730872,-5.80625870862475e-5,9.012617527068651e-8,0.0033157184572218204,-5.8126053541180765e-5,9.022654455023874e-8,0.003315966551858763,-5.8226689676969886e-5,9.038585941639497e-8,0.0033162996332138915,-5.831825523870404e-5,9.052728727571216e-8,0.0033167015288640424,-5.835787971070538e-5,9.058041563143791e-8,0.0033171388754599613,-5.8316694902620264e-5,9.049864230177064e-8,0.003317570199537387,-5.818631498100734e-5,9.026951683504713e-8,0.0033179566224040904,-5.7979533462259516e-5,8.99154851350754e-8,0.0033182710352989515,-5.772533753434543e-5,8.94853309482593e-8,0.003318503156852944,-5.746022504077495e-5,8.903967082003617e-8,0.003318659520612165,-5.721893166409305e-5,8.863565691424088e-8,0.0033187593907932924,-5.7027409664830245e-5,8.831554830627552e-8,0.0033188288152567313,-5.6899447070337116e-5,8.810136402150192e-8,0.0033188949683195744,-5.683663868685322e-5,8.799503967854189e-8,0.0033189820031886176,-5.683044444173091e-5,8.79819251290983e-8,0.0033191086079180677,-5.686498657172212e-5,8.80353851458633e-8,0.0033192868090701146,-5.6919687627007744e-5,8.812108202417043e-8,0.0033195213608058194,-5.6971468212093134e-5,8.820056393045532e-8,0.003319809205334997,-5.6996756676009524e-5,8.823463939940167e-8,0.0033201388682853913,-5.6973850769248384e-5,8.818741927408212e-8,0.0033204901645404743,-5.688617916715095e-5,8.803185327819643e-8,0.0033208351653437364,-5.672667481568836e-5,8.775700668157399e-8,0.0033211417606726764,-5.650258196722333e-5,8.737589343481958e-8,0.0033213807589085697,-5.623860290952227e-5,8.693042466255639e-8,0.003321535704580842,-5.5975194089382036e-5,8.64882803546673e-8,0.003321611779853912,-5.575964063734652e-5,8.612788421461543e-8,0.0033216383488875716,-5.563121550563371e-5,8.591372038897917e-8,0.00332166160133251,-5.560648771923718e-5,8.587208299016034e-8,0.003321729332346463,-5.567246407025703e-5,8.597999999454416e-8,0.0033218749696411454,-5.5791288194139026e-5,8.617344710132884e-8,0.003322108078793622,-5.591357362818337e-5,8.636987047930183e-8,0.003322414074917141,-5.599359775464645e-5,8.649361999558831e-8,0.0033227610657908736,-5.600062818328033e-5,8.649468343439781e-8,0.0033231098129842453,-5.592409172339057e-5,8.635693899550423e-8,0.003323423401229845,-5.577304858807897e-5,8.60968278743868e-8,0.0033236746106560327,-5.5571625019046895e-5,8.57553706414179e-8,0.0033238501378285963,-5.535223551652658e-5,8.538670353148495e-8,0.003323951512978097,-5.5148243821503265e-5,8.504591708672522e-8,0.0033239930515267515,-5.4987516475655016e-5,8.477855814651931e-8,0.003323997693098464,-5.4888022929405465e-5,8.461360179444422e-8,0.0033239919654675055,-5.485601986581888e-5,8.456067453943338e-8,0.0033240012834951657,-5.4886614374086276e-5,8.461111130656435e-8,0.00332404640453801,-5.496599005265156e-5,8.474164448132102e-8,0.003324141328817078,-5.507438956499113e-5,8.491926542726227e-8,0.003324292421254159,-5.5189074106772154e-5,8.510604823670503e-8,0.0033244982624229583,-5.528690636714247e-5,8.526342573891019e-8,0.0033247498139609742,-5.534665974060568e-5,8.5356116539381e-8,0.003325030738318475,-5.535139742517621e-5,8.535622814349039e-8,0.003325318078773487,-5.529132808874682e-5,8.524810407518335e-8,0.0033255840434287193,-5.516732559483926e-5,8.503412127897562e-8,0.003325800025884042,-5.4994500283684165e-5,8.474038755337137e-8,0.003325943636647162,-5.4803921202816106e-5,8.441925947919739e-8,0.003326007954119694,-5.463949661780294e-5,8.414386557641033e-8,0.0033260093929748016,-5.454751850488496e-5,8.39906316797749e-8,0.0033259881913321188,-5.4560143825206843e-5,8.401195873056964e-8,0.0033259972865628765,-5.4680122236649234e-5,8.421112518435034e-8,0.003326082679984568,-5.4876669269890736e-5,8.453576539427439e-8,0.0033262656698723574,-5.509660108184346e-5,8.489670021080734e-8,0.0033265367421952,-5.528454025680654e-5,8.520177547374201e-8,0.0033268625692368203,-5.540089651290604e-5,8.53858406600953e-8,0.0033271997836301316,-5.5430263445104554e-5,8.542454745717457e-8,0.00332750801243725,-5.538020410605459e-5,8.533193941439912e-8,0.0033277582273325535,-5.527451512296222e-5,8.514878834424156e-8,0.0033279360985943923,-5.514504454421498e-5,8.492865234127454e-8,0.0033280417206101223,-5.502443713341801e-5,8.47257264967664e-8,0.0033280872119350394,-5.494062573953781e-5,8.458583816329359e-8,0.0033280931856418602,-5.4913121909954754e-5,8.454056432249686e-8,0.003328084687829209,-5.49510529651956e-5,8.460424445406648e-8,0.003328087119786794,-5.505287514330795e-5,8.477367296994299e-8,0.003328122619004344,-5.520754438276987e-5,8.503008040542494e-8,0.0033282072794208633,-5.539681605654844e-5,8.534289014342119e-8,0.0033283494784650124,-5.559823205385741e-5,8.567459021016955e-8,0.0033285493241682613,-5.5788247308437714e-5,8.5985886311372e-8,0.0033287989546007955,-5.594511202878772e-5,8.624053969095568e-8,0.0033290834152926,-5.605145404558202e-5,8.640978601385084e-8,0.0033293820025522038,-5.609665354800625e-5,8.647641681844645e-8,0.00332967012765513,-5.607914249037254e-5,8.64386360154981e-8,0.003329922108265471,-5.600868372770514e-5,8.63137014691309e-8,0.003330115618151409,-5.590807269377462e-5,8.614043768918587e-8,0.0033302381328333365,-5.58126677029861e-5,8.597808953775239e-8,0.0033302943335076583,-5.5765475825965935e-5,8.589791861426393e-8,0.0033303112431023363,-5.580611329656748e-5,8.596488539474054e-8,0.003330335893358347,-5.595512706192685e-5,8.621187561535514e-8,0.0033304217950196257,-5.620076748901601e-5,8.661809726569148e-8,0.0033306077541668403,-5.649824615334275e-5,8.710815973363818e-8,0.003330900673735715,-5.678551821777345e-5,8.757850948338549e-8,0.0033312733708816735,-5.7007580014031255e-5,8.793794593475561e-8,0.003331677827847687,-5.713506396332166e-5,8.81385544183494e-8,0.0033320641462310304,-5.7168762976044525e-5,8.818303689777447e-8,0.003332394888741356,-5.713232454494835e-5,8.81121521924967e-8,0.003332650948899174,-5.706056072566515e-5,8.79848172366316e-8,0.0033328307387244707,-5.69892054818512e-5,8.786079588531413e-8,0.003332946103134148,-5.6948270940260595e-5,8.7789662082767e-8,0.003333017524013881,-5.695869565914077e-5,8.780546633003202e-8,0.003333069785980845,-5.7031151550971855e-5,8.79250644837299e-8,0.003333128293176569,-5.7166122827538784e-5,8.814848616597651e-8,0.003333215942814037,-5.735486447701515e-5,8.846062555209589e-8,0.003333350526081416,-5.758107712399529e-5,8.883400189972032e-8,0.003333542711568079,-5.782323256543382e-5,8.923255045240708e-8,0.0033337948024626724,-5.805748921759443e-5,8.961641831353482e-8,0.0033341004955474854,-5.826092281925177e-5,8.994735848331943e-8,0.0033344456574180216,-5.8414663420069585e-5,9.019404254409442e-8,0.0033348099763535065,-5.850667539814434e-5,9.033680470762473e-8,0.0033351693972139954,-5.8534013007029704e-5,9.037145788055351e-8,0.0033354992652454255,-5.850435337312846e-5,9.031176994724097e-8,0.003335778150817505,-5.8436628216984924e-5,9.019026948162117e-8,0.0033359924676545083,-5.836033415719681e-5,9.005674088553579e-8,0.003336141696475799,-5.831247259530645e-5,8.99728131408324e-8,0.003336242937122228,-5.833081796090152e-5,9.000064726389226e-8,0.003336332072852576,-5.844314497737879e-5,9.018519988192054e-8,0.003336457993721301,-5.8654611621949015e-5,9.053364701309959e-8,0.003336668034416213,-5.8939341334053395e-5,9.100181248328803e-8,0.0033369886308538366,-5.9243988034202145e-5,9.15003563787348e-8,0.0033374117211466396,-5.950577741976175e-5,9.192485569877443e-8,0.0033378966406314506,-5.9676814334938345e-5,9.219623025373824e-8,0.003338387060585492,-5.974061238822445e-5,9.228818050131115e-8,0.003338832161640395,-5.9712769824558396e-5,9.222809662066525e-8,0.003339200660884803,-5.9629238348668325e-5,9.207713490030904e-8,0.0033394839946629365,-5.9531508527586526e-5,9.19051435138701e-8,0.00333969194933606,-5.9455615021928336e-5,9.177216062406416e-8,0.0033398456958361393,-5.9426735296063406e-5,9.171952556625893e-8,0.0033399714625476887,-5.94580076063395e-5,9.176821138029921e-8,0.0033400959454044452,-5.9551503177061825e-5,9.19207583444299e-8,0.003340243216604815,-5.969991931487511e-5,9.21642828744451e-8,0.003340432528612182,-5.988845372977386e-5,9.247363390315894e-8,0.00334067661964073,-6.009682747560091e-5,9.281470236403697e-8,0.003340980391006287,-6.0301603901974886e-5,9.314821825194654e-8,0.0033413400860247433,-6.047899922745841e-5,9.34344253905957e-8,0.0033417433406987395,-6.0608161718892285e-5,9.363861218700703e-8,0.0033421704338331562,-6.0674530868574566e-5,9.373681434940468e-8,0.003342596793867571,-6.067274472862805e-5,9.372073186756808e-8,0.003342996619504433,-6.060857747387037e-5,9.360092417739725e-8,0.0033433472973181913,-6.049938316515723e-5,9.340736779360886e-8,0.003343634076313921,-6.037265637678459e-5,9.318674843140178e-8,0.003343854352958671,-6.026253039672385e-5,9.29962869527095e-8,0.0033440207974379525,-6.02040503597778e-5,9.289398103642671e-8,0.00334416209570793,-6.0225227664861864e-5,9.292540486542561e-8,0.0033443195738953684,-6.033783862182839e-5,9.310869759814082e-8,0.0033445382535737425,-6.052967926745262e-5,9.342213643036966e-8,0.0033448528768625176,-6.076271261213488e-5,9.380146725962548e-8,0.0033452733341006566,-6.098129519580642e-5,9.415379750598335e-8,0.0033457773304763423,-6.11302103754188e-5,9.43875995339562e-8,0.003346316441695281,-6.117498982465232e-5,9.444642575943193e-8,0.0033468338086486238,-6.111354333006799e-5,9.432810795018451e-8,0.0033472838692474196,-6.097324927755117e-5,9.4079645301939e-8,0.0033476441985163447,-6.0797240704200516e-5,9.377398884436344e-8,0.0033479163084475117,-6.062888070521747e-5,9.348385258171712e-8,0.003348119017326552,-6.050124738963157e-5,9.326410433273226e-8,0.0033482798563691583,-6.043317112036643e-5,9.314535120928058e-8,0.0033484280459571253,-6.0429873261064216e-5,9.313533471622201e-8,0.0033485900303240564,-6.0485597297215256e-5,9.322360188274091e-8,0.0033487870427821647,-6.058650061285441e-5,9.338645264051759e-8,0.003349033779148276,-6.071317745669125e-5,9.359112405668456e-8,0.003349337512154647,-6.084287930407258e-5,9.379941019517652e-8,0.0033496973868342426,-6.0951778738148076e-5,9.39713912066027e-8,0.0033501040189214903,-6.1017654657638296e-5,9.406994902831682e-8,0.003350539852327468,-6.102313701204754e-5,9.406628005534092e-8,0.0033509808424563464,-6.0959184102096446e-5,9.394579478956938e-8,0.0033513997985662727,-6.0828035243102085e-5,9.371305998195274e-8,0.003351771242630648,-6.064464806465786e-5,9.339407682046672e-8,0.0033520770502697586,-6.043567280060645e-5,9.303431185934628e-8,0.0033523115992083793,-6.023549059632611e-5,9.269175686275925e-8,0.0033524849538567095,-6.0079656147178764e-5,9.242570667708549e-8,0.003352622868607595,-5.999683644913714e-5,9.228321247007672e-8,0.0033527629108964156,-6.0000858451751614e-5,9.228598308330152e-8,0.0033529466888537886,-6.0084899028015664e-5,9.242109352946563e-8,0.003353209163212818,-6.0220101719581925e-5,9.263915942649568e-8,0.003353567452423346,-6.036056292024498e-5,9.286301996208644e-8,0.003354013074553909,-6.045506176241125e-5,9.300742375322236e-8,0.003354511938151932,-6.0462793179074204e-5,9.300515855826013e-8,0.003355013937094379,-6.036701837740332e-5,9.282957547814603e-8,0.0033554690078815767,-6.018006277425595e-5,9.250263119120252e-8,0.0033558424476254254,-5.9937221757790955e-5,9.208440293612802e-8,0.0033561228412348943,-5.9683282240027307e-5,9.165030735952862e-8,0.003356320744440452,-5.9458664926667036e-5,9.126781835699132e-8,0.003356461215846782,-5.929059997108527e-5,9.09818074709203e-8,0.0033565749791113304,-5.919060979973586e-5,9.081060603989335e-8,0.0033566915189816907,-5.915640839670276e-5,9.07494897969949e-8,0.0033568350305881473,-5.91755770416691e-5,9.077702401431161e-8,0.003357022613830941,-5.9229226963443656e-5,9.086121990946202e-8,0.003357263701159578,-5.929496452229679e-5,9.096440629587108e-8,0.003357559911226247,-5.934921839576949e-5,9.104702421945221e-8,0.0033579049385909485,-5.9369383956175455e-5,9.1071192375381e-8,0.0033582845835001054,-5.9336313704812116e-5,9.100494733703145e-8,0.00335867744667257,-5.923739982099832e-5,9.082751861971475e-8,0.003359057001605932,-5.906997363720898e-5,9.053508695821385e-8,0.003359395616398978,-5.884413276926084e-5,9.014546329210125e-8,0.003359670484111321,-5.858354614172143e-5,8.96992412648217e-8,0.003359870306372325,-5.83227294745991e-5,8.925494292974744e-8,0.003360000476205311,-5.8100244081356475e-5,8.887733886137964e-8,0.0033600842939887445,-5.794905158876692e-5,8.862112733910623e-8,0.0033601588394004405,-5.7886876867381644e-5,8.851484939281549e-8,0.0033602660797591934,-5.790993390908707e-5,8.85506789176601e-8,0.003360441674025316,-5.799244505104898e-5,8.868407215376571e-8,0.003360704848971143,-5.809247460735285e-5,8.884397868653839e-8,0.003361052408555661,-5.8162610399993446e-5,8.895098477449679e-8,0.0033614587985430038,-5.816263041067814e-5,8.893850581578914e-8,0.003361882595100984,-5.807055435201572e-5,8.877103313526498e-8,0.0033622778382321966,-5.788851232418176e-5,8.845357733079992e-8,0.003362606646946412,-5.764123357960088e-5,8.802875740347297e-8,0.003362848722009863,-5.736772166360094e-5,8.756257923304475e-8,0.003363004624307182,-5.710951428610873e-5,8.712465566458204e-8,0.0033630925651310676,-5.690004657624532e-5,8.677046271557997e-8,0.0033631411170110623,-5.6758424875231495e-5,8.653114040510852e-8,0.003363181256001812,-5.668835779717318e-5,8.641199419472419e-8,0.0033632402740149748,-5.6680785627308535e-5,8.639713164955336e-8,0.0033633383786634027,-5.67180183840242e-5,8.64564805526587e-8,0.0033634874868962595,-5.6777755378881375e-5,8.65524655651299e-8,0.0033636912810481303,-5.683628445550697e-5,8.66452477529796e-8,0.003363945718484768,-5.687086249094485e-5,8.669663650025481e-8,0.0033642395389277832,-5.686171426360383e-5,8.667346696354637e-8,0.0033645548029027344,-5.6794222114151424e-5,8.655138743646585e-8,0.0033648679728196743,-5.6661634264931834e-5,8.631952160889124e-8,0.003365152316192434,-5.646808727765676e-5,8.598556119531746e-8,0.0033653823440695273,-5.6231009443925796e-5,8.557966538825618e-8,0.003365540348867742,-5.598115619209057e-5,8.515425825459867e-8,0.0033656236291926926,-5.5758262063050816e-5,8.477643543829795e-8,0.003365649237974656,-5.5601580627967396e-5,8.451187493962213e-8,0.003365652653538818,-5.5537505781072915e-5,8.440402629396734e-8,0.0033656789459104476,-5.5569291146105796e-5,8.445703766415184e-8,0.003365769023611574,-5.5674099565599833e-5,8.463116901817921e-8,0.003365946605285959,-5.580935658495085e-5,8.485389455646114e-8,0.003366211262409989,-5.592573091926771e-5,8.504204720695987e-8,0.0033665395943343838,-5.598132333980049e-5,8.512577176624952e-8,0.003366892961472996,-5.59521898282755e-5,8.506604596898847e-8,0.003367228357217615,-5.583677491599288e-5,8.486175343471328e-8,0.0033675090217883843,-5.565418314517531e-5,8.454632832083293e-8,0.0033677122812087027,-5.543770395775392e-5,8.417651191158752e-8,0.0033678331653782018,-5.522579913828783e-5,8.381704806824443e-8,0.0033678834944036373,-5.50530389308712e-5,8.352552276592036e-8,0.0033678872697589877,-5.494321345418341e-5,8.334103225252462e-8,0.003367874119813055,-5.490600237086945e-5,8.327889130742978e-8,0.0033678728417263332,-5.493731937946403e-5,8.333146207894089e-8,0.003367906582298691,-5.50223028120182e-5,8.347329601819736e-8,0.003367990240931756,-5.5139459330814e-5,8.36680693328067e-8,0.003368129820921837,-5.5264706650024884e-5,8.387526013174893e-8,0.0033683230141878383,-5.53746278372721e-5,8.405550425907457e-8,0.0033685602874602904,-5.544884667401181e-5,8.417455801548991e-8,0.0033688260245799536,-5.5471875403664845e-5,8.420648096017351e-8,0.0033690996964164,-5.54349217648513e-5,8.41368044105891e-8,0.0033693574390171246,-5.533796983745346e-5,8.396611154911362e-8,0.003369574738556079,-5.51920190230235e-5,8.371373979967595e-8,0.0033697309471166486,-5.502062543221554e-5,8.342014676700197e-8,0.0033698157191195807,-5.4858963662490004e-5,8.314502135403152e-8,0.00336983588693757,-5.4748211466438515e-5,8.295758836096101e-8,0.003369819180796456,-5.472435396786891e-5,8.291770942984493e-8,0.0033698103447281362,-5.4804144817696605e-5,8.305241791698605e-8,0.0033698580327925177,-5.497509215486744e-5,8.333937840761425e-8,0.00336999704671909,-5.519660736781785e-5,8.370918090270701e-8,0.003370235023755808,-5.541355414664154e-5,8.406846696487325e-8,0.0033705505910493,-5.557548077177791e-5,8.43325066766928e-8,0.0033709027002781183,-5.565191209448797e-5,8.445094442884492e-8,0.0033712449573918956,-5.563811944371171e-5,8.441726573141519e-8,0.0033715383281370122,-5.5551947479558465e-5,8.426301455023264e-8,0.0033717588003342688,-5.5425603682988634e-5,8.404350744757277e-8,0.0033718997534319347,-5.529628730757146e-5,8.382176259040501e-8,0.0033719703516509663,-5.519808521396885e-5,8.365483265879684e-8,0.0033719915125817105,-5.515616301581334e-5,8.358424368986457e-8,0.003371990670460589,-5.5183508520810655e-5,8.363084262341449e-8,0.003371996312094328,-5.5280222125438397e-5,8.37938999603007e-8,0.0033720332014755966,-5.543506986883743e-5,8.405389123547616e-8,0.0033721189855487107,-5.56286157858378e-5,8.437778720791833e-8,0.003372262458821144,-5.5837078683713314e-5,8.472545698884107e-8,0.0033724633940253805,-5.603614789623234e-5,8.505597653427594e-8,0.003372713546608454,-5.620417709122976e-5,8.533294234846123e-8,0.0033729982668022603,-5.632452546423462e-5,8.552844070193068e-8,0.00337329829570848,-5.6387235045065904e-5,8.562597120345452e-8,0.003373591662554191,-5.639037939243083e-5,8.56228158420924e-8,0.0033738558827816345,-5.634128823507716e-5,8.553209949381927e-8,0.0033740709065428706,-5.625757728164715e-5,8.538435984518772e-8,0.0033742233614416587,-5.6167318041165296e-5,8.522753464272809e-8,0.0033743120850930324,-5.6106839883563096e-5,8.512295286558207e-8,0.0033743535182657845,-5.6114284681771475e-5,8.51343302306435e-8,0.003374383584560917,-5.621816091412462e-5,8.530860378052354e-8,0.003374451653711905,-5.642363033026548e-5,8.565316246357324e-8,0.003374604874548048,-5.670392651341919e-5,8.612176775673318e-8,0.003374868363272367,-5.700515151316815e-5,8.662290807184912e-8,0.0033752327666612806,-5.726543902108981e-5,8.705223569982031e-8,0.003375657734454065,-5.743861941957818e-5,8.733251492462779e-8,0.00337608883276525,-5.7508964679654286e-5,8.743842547911098e-8,0.0033764770314720334,-5.749109053497066e-5,8.739613430904317e-8,0.003376791288154108,-5.741928432963936e-5,8.726484516431357e-8,0.003377021873463669,-5.733428391425587e-5,8.711405749206888e-8,0.003377177244553692,-5.727289468373037e-5,8.700584615729924e-8,0.0033772782065038614,-5.7261975296652276e-5,8.698482352101486e-8,0.003377351897211726,-5.731608876134401e-5,8.707450164078988e-8,0.0033774266600864046,-5.743750053577925e-5,8.727765185706965e-8,0.0033775279397840904,-5.761758344607225e-5,8.757892428997106e-8,0.0033776751676794963,-5.783921764291742e-5,8.794897670651642e-8,0.0033778797227997696,-5.807988352583364e-5,8.834963725304223e-8,0.0033781440270615184,-5.831509017006301e-5,8.873957895692964e-8,0.0033784617768650477,-5.8521803894550365e-5,8.908001953560924e-8,0.003378819238634322,-5.868149381761238e-5,8.933984781642511e-8,0.003379197323670683,-5.8782439093002966e-5,8.949957584080041e-8,0.003379574066231394,-5.882122050843463e-5,8.955393397490966e-8,0.003379927308581292,-5.880351542948081e-5,8.951323372093641e-8,0.0033802375736910525,-5.8744255904977356e-5,8.940353066295135e-8,0.003380491220639322,-5.86670851430349e-5,8.92654614473728e-8,0.003380684061250688,-5.8602724717853605e-5,8.915117457299559e-8,0.003380825238790617,-5.8585283278155506e-5,8.911787039413452e-8,0.0033809400725077258,-5.8645366370736766e-5,8.921617853680288e-8,0.0033810692089788217,-5.8799874204040243e-5,8.947323513780382e-8,0.003381260821250198,-5.904106722336901e-5,8.987469296042821e-8,0.0033815547925915685,-5.933123263112307e-5,9.0356110182332e-8,0.003381964109575867,-5.961028832185029e-5,9.081592148861166e-8,0.0033824647851254143,-5.981713959083937e-5,9.1151422106769e-8,0.003383003169851391,-5.9914358833980524e-5,9.130033548932249e-8,0.0033835175357943767,-5.9901254032734106e-5,9.126278647579509e-8,0.0033839605590798446,-5.980890433849116e-5,9.10926902260356e-8,0.00338431099616989,-5.968366488858203e-5,9.086948355865654e-8,0.0033845727837585357,-5.9570442762593056e-5,9.066948346775116e-8,0.0033847670858004075,-5.950243521857609e-5,9.05484296124944e-8,0.0033849232362922243,-5.9497727807565615e-5,9.053594275132374e-8,0.0033850716583332255,-5.956024397003957e-5,9.063751388399143e-8,0.0033852393421935963,-5.9682490187505253e-5,9.083949487511646e-8,0.0033854472176725985,-5.984859127500225e-5,9.111441080009529e-8,0.0033857086133339863,-6.003720459463659e-5,9.142588647628522e-8,0.0033860284271986017,-6.022439650227471e-5,9.173340583043047e-8,0.003386402955846923,-6.038656005091193e-5,9.199713865518988e-8,0.003386820462731965,-6.0503374088305864e-5,9.218289744117541e-8,0.003387262658810295,-6.05606230682693e-5,9.226693315388558e-8,0.0033877071395750856,-6.0552452997181255e-5,9.223981379163578e-8,0.0033881305330445235,-6.048266726105932e-5,9.210864890465263e-8,0.0033885120041810286,-6.036487174837796e-5,9.189727295160823e-8,0.003388836782278121,-6.022136221100909e-5,9.164417689053099e-8,0.003389099364723984,-6.008071140194549e-5,9.139814912203612e-8,0.003389306087909998,-5.9974056769629564e-5,9.121173103792565e-8,0.0033894766507592314,-5.992991778520634e-5,9.113234376727132e-8,0.0033896436217253243,-5.9967392439029444e-5,9.119094033650632e-8,0.003389848331184142,-6.00884494472235e-5,9.138938243016609e-8,0.003390131696696725,-6.027176738671097e-5,9.169052134537972e-8,0.003390520408645742,-6.0472489173007385e-5,9.20181223124543e-8,0.003391013048776062,-6.0632291852483944e-5,9.227391611926006e-8,0.003391574685345615,-6.069936708195099e-5,9.237117323434914e-8,0.0033921465752053356,-6.0649508463182645e-5,9.227013011226155e-8,0.003392668019375996,-6.049561955058757e-5,9.199390213601754e-8,0.003393098109249708,-6.027985582758634e-5,9.161498325294656e-8,0.003393425788317697,-6.005472021645174e-5,9.12229510324662e-8,0.00339366621882231,-5.986502345047448e-5,9.089367784604274e-8,0.003393849764889761,-5.973824800765525e-5,9.067301795341194e-8,0.0033940108887349028,-5.9683418753718195e-5,9.057517474706375e-8,0.0033941806177451347,-5.969475502631139e-5,9.058927390461232e-8,0.0033943828082887316,-5.9756555264083074e-5,9.068792616803152e-8,0.0033946329021984417,-5.984744069403636e-5,9.083450585144963e-8,0.003394937808251754,-5.994358255246006e-5,9.098854172687638e-8,0.003395296161910116,-6.002127117598997e-5,9.110993548500498e-8,0.003395698804414143,-6.0059267214638514e-5,9.116285658288206e-8,0.0033961296425301405,-6.004122350292775e-5,9.111984405853812e-8,0.0033965672449549665,-5.995817702591761e-5,9.096608893871411e-8,0.0033969875056327195,-5.9810681332088226e-5,9.070310529653611e-8,0.0033973673472186662,-5.960989551896998e-5,9.035055940505286e-8,0.0033976890073721226,-5.937702862808381e-5,8.994519524467432e-8,0.00339794414966279,-5.914078600227383e-5,8.953626954603158e-8,0.00339813686265762,-5.893285864413488e-5,8.91776383701858e-8,0.0033982846760873316,-5.8782022201718587e-5,8.891757350029357e-8,0.0033984170426695744,-5.8707756459061303e-5,8.878796990728907e-8,0.0033985710041651773,-5.8714419523522015e-5,8.879474808736464e-8,0.003398783964213327,-5.8787308590801815e-5,8.891163690828701e-8,0.003399084097724401,-5.889244323337396e-5,8.908026373626042e-8,0.003399480270250761,-5.898203293481756e-5,8.921967011645284e-8,0.0033999551699554283,-5.900646431000797e-5,8.924656326463904e-8,0.003400466358786225,-5.893049216975236e-5,8.91024588459512e-8,0.003400957801068039,-5.8747104648884236e-5,8.877683281588798e-8,0.003401378527359106,-5.848118000125292e-5,8.831304298309702e-8,0.0034016995373273343,-5.817987411373497e-5,8.779181892187154e-8,0.0034019205448226966,-5.789489120259509e-5,8.730103063936285e-8,0.0034020649231812825,-5.7666180030203005e-5,8.690798801868969e-8,0.003402168049287801,-5.751375176227864e-5,8.664571506488682e-8,0.003402265858276145,-5.743804869788241e-5,8.651389470980682e-8,0.00340238747932283,-5.742519852330234e-5,8.64881096032888e-8,0.0034025522455255973,-5.7453234933997976e-5,8.653057385184077e-8,0.0034027695489980392,-5.7497130460310654e-5,8.659865614011625e-8,0.003403039886903058,-5.753221388492227e-5,8.665054230622828e-8,0.0034033560870460524,-5.753644074444263e-5,8.664895352331391e-8,0.0034037044047870047,-5.7492186034072585e-5,8.656414307834132e-8,0.003404065680014834,-5.738807359108861e-5,8.637705347880114e-8,0.0034044170305128105,-5.722099116240365e-5,8.60828262613509e-8,0.003404734597935735,-5.6997926909140374e-5,8.569395943787588e-8,0.003404997558905359,-5.6736793275923886e-5,8.524163215191012e-8,0.0034051929890715296,-5.646520876211743e-5,8.477344074418974e-8,0.003405320408160798,-5.621648018227168e-5,8.434631513995815e-8,0.003405394300451476,-5.6022900264124296e-5,8.40149123124777e-8,0.0034054430646795236,-5.590772696450894e-5,8.381791884209707e-8,0.0034055038606741876,-5.587815564824331e-5,8.376626228374444e-8,0.0034056142384550816,-5.59216390476811e-5,8.383721738396868e-8,0.003405802567121793,-5.600706841995555e-5,8.397686437719106e-8,0.003406079762115114,-5.609104831024885e-5,8.411111539414267e-8,0.0034064347003346877,-5.6128202268790945e-5,8.416335082003054e-8,0.0034068351738956544,-5.6083285215666045e-5,8.407483916197228e-8,0.003407235151776666,-5.594181500695267e-5,8.382243623901492e-8,0.0034075871596243503,-5.5715353849958e-5,8.342714398589868e-8,0.0034078560389337632,-5.543856994368361e-5,8.294878555047174e-8,0.0034080288015259303,-5.5158405656903775e-5,8.246741739171249e-8,0.003408116556022004,-5.491960304745137e-5,8.20587213493105e-8,0.0034081483496585887,-5.475262430635319e-5,8.17736335484883e-8,0.0034081606287834965,-5.466819510979342e-5,8.162935251217643e-8,0.003408187213574958,-5.465879991060622e-5,8.161218884734959e-8,0.0034082529479952245,-5.470438823302094e-5,8.168747464274309e-8,0.0034083714747449156,-5.477893708194855e-5,8.181075694408507e-8,0.0034085458513296286,-5.4855751000708015e-5,8.193669718795236e-8,0.003408770414545297,-5.4910925975911326e-5,8.202480039048432e-8,0.003409032781106392,-5.4925363401297566e-5,8.204274072682829e-8,0.0034093155318804143,-5.488606600123461e-5,8.196858076576507e-8,0.0034095977133735593,-5.478735913882586e-5,8.179294852554372e-8,0.0034098566636729913,-5.463228818846857e-5,8.1521508229844755E-08,0.003410070752139286,-5.443391476149148e-5,8.117715796819658e-8,0.0034102233957102024,-5.4215684339399623e-5,8.0800505879973e-8,0.003410308068531649,-5.400958289018258e-5,8.044648266424068e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_22.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_22.json deleted file mode 100644 index d5f65138..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_22.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":22000,"numberOfSamples":1000,"samples":[0.003410332914201753,-5.3850894022675106e-5,8.017517098961131e-8,0.003410322528879365,-5.376958194615e-5,8.003701237438996e-8,0.0034103145652221627,-5.3780481135696216e-5,8.005617875605212e-8,0.0034103506775372276,-5.3876274061593275e-5,8.021888857849169e-8,0.003410464307410866,-5.402707135418975e-5,8.047308167596654e-8,0.003410669971601388,-5.4187778507499705e-5,8.074133887896081e-8,0.003410958362427396,-5.431078402439631e-5,8.094271511350002e-8,0.0034112988966924413,-5.435925986441926e-5,8.101538020005893e-8,0.0034116483046836123,-5.431671386401488e-5,8.093263501288651e-8,0.0034119621492173344,-5.41904204198061e-5,8.070834304160092e-8,0.0034122059256284677,-5.400841636122217e-5,8.039138838903804e-8,0.0034123629141804617,-5.38113276447821e-5,8.005145827068325e-8,0.003412436926427523,-5.3641509849942013e-5,7.976047048128742e-8,0.0034124495366027988,-5.3532666321671336e-5,7.957504010808949e-8,0.0034124330661485227,-5.350283981451321e-5,7.952484351765614e-8,0.0034124218722404974,-5.3552370565715433e-5,7.960947036368768e-8,0.0034124447457084236,-5.3666539079328896e-5,7.980316491937519e-8,0.0034125202858526367,-5.382106091332426e-5,8.00642647210325e-8,0.0034126555868305777,-5.398815305369993e-5,8.034545908014444e-8,0.0034128473776592204,-5.414152490629849e-5,8.06021342297411e-8,0.0034130843642180496,-5.425966542015235e-5,8.079783644736344e-8,0.0034133497512128354,-5.4327618445658844e-5,8.090725685897239e-8,0.003413623435855102,-5.4337869912637006e-5,8.091781018622006e-8,0.003413883907454681,-5.429097539492461e-5,8.083081580105819e-8,0.0034141102665403125,-5.419622361028624e-5,8.066268207707981e-8,0.0034142849136512055,-5.407215162017978e-5,8.044570051432896e-8,0.00341439730488426,-5.394617096384391e-5,8.022718223765307e-8,0.003414448551881033,-5.385201336379878e-5,8.006482802604857e-8,0.0034144554442633347,-5.382365677022172e-5,8.001619006311863e-8,0.003414451133210198,-5.388562472720168e-5,8.012215438343905e-8,0.0034144795115925615,-5.4042269894100845e-5,8.038890648236031e-8,0.003414582717752921,-5.427144088560471e-5,8.077748959286917e-8,0.0034147858366957128,-5.452785635760065e-5,8.120990068433355e-8,0.003415086335408109,-5.475685197042185e-5,8.159276299340531e-8,0.0034154541675420077,-5.491264135361651e-5,8.184854560101504e-8,0.003415842328369328,-5.497241133679643e-5,8.19395012048398e-8,0.0034162020648540446,-5.494079694397467e-5,8.187500799224558e-8,0.0034164960597480513,-5.484509224563486e-5,8.170297816008171e-8,0.003416705855690934,-5.472520370648011e-5,8.14923147861858e-8,0.0034168331491478627,-5.462263220717812e-5,8.131389578844407e-8,0.003416896425673255,-5.457135459703978e-5,8.122506662590603e-8,0.003416924864737033,-5.459196701501527e-5,8.125992201462119e-8,0.0034169512624180483,-5.468942093895768e-5,8.142580537893595e-8,0.0034170054267853647,-5.485407812356393e-5,8.17054100824689e-8,0.0034171092005408077,-5.506533196508355e-5,8.206310391954363e-8,0.0034172737893538854,-5.529662285957986e-5,8.24534661992994e-8,0.0034174994368857004,-5.552057481406241e-5,8.282992315001632e-8,0.0034177769459542693,-5.5713266654435735e-5,8.315188937008223e-8,0.0034180902481047706,-5.58571185539423e-5,8.338960767448971e-8,0.0034184192209990544,-5.594239734507513e-5,8.352672714006698e-8,0.0034187422744122974,-5.5967759795049916e-5,8.356130894842189e-8,0.0034190386613258106,-5.5940313585960716e-5,8.350600300356605e-8,0.0034192907451060053,-5.5875438829459745e-5,8.338772029482915e-8,0.0034194865853197334,-5.5796286755981725e-5,8.324661178228372e-8,0.0034196231618546383,-5.573239332743332e-5,8.313343416160889e-8,0.0034197100026956712,-5.571629566234729e-5,8.310353167794132e-8,0.0034197718373557965,-5.5777017730924494e-5,8.320565011677361e-8,0.0034198476546487924,-5.593045265235306e-5,8.346570742357244e-8,0.0034199832418701356,-5.6169307155583144e-5,8.387000547866622e-8,0.0034202166393619616,-5.64584557493018e-5,8.435767926960611e-8,0.0034205614639800535,-5.67418663020452e-5,8.483274082655738e-8,0.003420997727034218,-5.696140593963007e-5,8.51962311929662e-8,0.0034214773558268368,-5.707879301142648e-5,8.538365211417604e-8,0.0034219421419332224,-5.708851047552745e-5,8.538688805157197e-8,0.0034223438059788605,-5.701585691614104e-5,8.525060072019697e-8,0.0034226564954146083,-5.690413699843295e-5,8.504993386503595e-8,0.003422878920363075,-5.679944106094893e-5,8.486413227000239e-8,0.0034230291674335464,-5.6739176541925223e-5,8.475681081074442e-8,0.003423136660697731,-5.6746178962097036e-5,8.476606168603778e-8,0.0034232343831674863,-5.682746769406769e-5,8.490269488349289e-8,0.0034233527024106186,-5.697594757338996e-5,8.515352124084064e-8,0.003423515048462373,-5.717372366496969e-5,8.548725451920484e-8,0.003423735360724929,-5.739623453008071e-5,8.586162778920173e-8,0.0034240171921175824,-5.761661689063496e-5,8.623076555625632e-8,0.003424354282394761,-5.7809781532945634e-5,8.655200921001188e-8,0.003424732337212298,-5.795580012171021e-5,8.679159414405439e-8,0.0034251316600929604,-5.804228112995662e-5,8.692867283680107e-8,0.0034255301389273553,-5.8065571370678764e-5,8.695739993818016e-8,0.0034259061435299876,-5.8030942708281336e-5,8.68873016976559e-8,0.003426241192945239,-5.7952061490074354e-5,8.674237096252997e-8,0.003426522442310002,-5.784987818084441e-5,8.655906513984539e-8,0.0034267450710929025,-5.775090698206635e-5,8.638314938058331e-8,0.0034269146613510586,-5.768461436478088e-5,8.626498016672915e-8,0.0034270492888037753,-5.7679206341423455e-5,8.625215296635437e-8,0.0034271801115048016,-5.775513150463932e-5,8.637847340111039e-8,0.003427348318837799,-5.791673040416302e-5,8.66500111928406e-8,0.003427596290732135,-5.814466196255829e-5,8.703260278195282e-8,0.0034279529627239238,-5.8394327194921334e-5,8.744949479355945e-8,0.003428418470586544,-5.860576263431353e-5,8.77983298726461e-8,0.00342895785967562,-5.872474275422114e-5,8.79870966366347e-8,0.0034295111225311516,-5.872520138069127e-5,8.797231646130829e-8,0.0034300159367414112,-5.8619276575255356e-5,8.777608739665868e-8,0.003430429936364875,-5.8449346719175054e-5,8.747221956219683e-8,0.0034307409539403753,-5.8269005362368705e-5,8.715330218992734e-8,0.0034309636874953423,-5.812488879415304e-5,8.689927969838687e-8,0.0034311290547955646,-5.804651663753494e-5,8.676002574361577e-8,0.0034312730856115364,-5.804431513186724e-5,8.675224016919222e-8,0.003431428842749821,-5.811258599710215e-5,8.686495556850346e-8,0.003431621833748501,-5.823424073945281e-5,8.706799112634763e-8,0.0034318679871170456,-5.838549788451625e-5,8.732014432177786e-8,0.0034321731793053077,-5.854001187955921e-5,8.757621999925782e-8,0.0034325337535511193,-5.8672442465983527E-05,8.779300375802679e-8,0.0034329377969641297,-5.876149483775846e-5,8.79343338304245e-8,0.0034333670820067457,-5.8792422402358875e-5,8.7975316488367e-8,0.0034337996533433854,-5.875886549720411e-5,8.790547650809066e-8,0.0034342129023982814,-5.8663743295375374e-5,8.773032040338553e-8,0.0034345867528595554,-5.8519040728693963E-05,8.747098149349937e-8,0.00343490662495616,-5.834457618854895e-5,8.716204139286165e-8,0.003435165997133961,-5.816584043444344e-5,8.684766473704805e-8,0.003435368377604481,-5.8010940498476064e-5,8.657614158669101e-8,0.003435528469312809,-5.79066894188021e-5,8.639300030976978e-8,0.0034356721817477088,-5.787374966119817e-5,8.633265875065238e-8,0.0034358346431882215,-5.7920805816179714e-5,8.640865043476558e-8,0.00343605489737805,-5.8038637339463834e-5,8.660388209222903e-8,0.0034363663675272185,-5.8196543664505935e-5,8.686495377469283e-8,0.003436784132872785,-5.834498191690136e-5,8.710692888866458e-8,0.003437293776835478,-5.8427735873480615e-5,8.72341254787051e-8,0.0034378497110881335,-5.8402092841660325e-5,8.717442687949159e-8,0.0034383882973978448,-5.8257765502926945e-5,8.691145603639477e-8,0.003438851408713721,-5.802240303565348e-5,8.649384664598423e-8,0.0034392073380863355,-5.774932951993929e-5,8.601401185593557e-8,0.0034394577744100104,-5.749559608304214e-5,8.557022184800596e-8,0.003439630233895451,-5.7303386349150334e-5,8.523451882013677e-8,0.0034397639148655676,-5.71921018810065e-5,8.503923334835471e-8,0.003439897152082377,-5.716002300749245e-5,8.498019404726612e-8,0.0034400599773055985,-5.719061355114749e-5,8.502796230293353e-8,0.0034402713672934656,-5.725932344600479e-5,8.513976877355545e-8,0.0034405393098027363,-5.7338962376120295e-5,8.52687687250456e-8,0.0034408620305790096,-5.7403458295962594e-5,8.5370360365332e-8,0.0034412295639111826,-5.74305399376233e-5,8.540661686558558e-8,0.0034416255077720182,-5.7403819017073256e-5,8.534975049941572e-8,0.0034420290593737894,-5.7314494475115625e-5,8.518502074925517e-8,0.0034424175204084556,-5.7162649725107814e-5,8.491300299198063e-8,0.0034427693744096327,-5.695780291358059e-5,8.45505703435799e-8,0.003443067694390436,-5.671827027498391e-5,8.412977141244271e-8,0.0034433033585062117,-5.6469137408961e-5,8.369422260683416e-8,0.003443477522363603,-5.6238888006486065e-5,8.329312068593308e-8,0.0034436028265143223,-5.6054927768332085e-5,8.297335687745774e-8,0.0034437028776761053,-5.593849466785818e-5,8.277067663956046e-8,0.0034438096971042514,-5.589961405993521e-5,8.270110737924363e-8,0.0034439589152577502,-5.593284157050621e-5,8.275395289466784e-8,0.0034441825909026142,-5.601493075148707e-5,8.288821797121621e-8,0.0034445001635288017,-5.610621465702858e-5,8.303535737202917e-8,0.0034449095226591654,-5.615762951966539e-5,8.311147869532069e-8,0.0034453821233687756,-5.612393855092263e-5,8.303989847633601e-8,0.003445866927768903,-5.598013860657117e-5,8.277898571579688e-8,0.003446305117155568,-5.573359851034611e-5,8.234268399454156e-8,0.003446650688170405,-5.54237541297035e-5,8.179975395214818e-8,0.003446886420895123,-5.5107576665760024e-5,8.124862318937609e-8,0.0034470267259821934,-5.483846667724602e-5,8.078097385183255e-8,0.00344710766051307,-5.464993566767857e-5,8.04536936374894e-8,0.003447171789706657,-5.455038535028025e-5,8.028012646114274e-8,0.0034472558389312216,-5.452741901483898e-5,8.02378602589795e-8,0.003447384454009153,-5.455622510521429e-5,8.028347230580017e-8,0.003447569166450617,-5.460748845901849e-5,8.036626359875367e-8,0.003447810144196527,-5.465292154467429e-5,8.043768722291936e-8,0.0034480987268725206,-5.466849659176279e-5,8.045671557812648e-8,0.003448419783191651,-5.46362499989435e-5,8.039277888315682e-8,0.003448753772593059,-5.45454637568273e-5,8.022774113086465e-8,0.0034490787902391605,-5.439364106836301e-5,7.995762374625734e-8,0.003449372967644381,-5.41872734508112e-5,7.959400330433788e-8,0.0034496174799257423,-5.394199608711304e-5,7.916430464845655e-8,0.003449800033082265,-5.368150494101013e-5,7.870985989025718e-8,0.0034499182123150364,-5.343472982432336e-5,7.828086678372597e-8,0.003449981722370573,-5.323117506956941e-5,7.792815673433031e-8,0.0034500124919465153,-5.30949612652312e-5,7.769278778854012e-8,0.0034500419488425822,-5.303878495366926e-5,7.759565134357626e-8,0.003450105483013042,-5.305939695552917e-5,7.762989261880157e-8,0.0034502349108771345,-5.3136052000312036E-05,7.775860628781301e-8,0.00345045036327994,-5.3232896856317525e-5,7.791934553656435e-8,0.0034507534559009615,-5.330563477313901e-5,7.803586216602371e-8,0.0034511239123253042,-5.331189940292976e-5,7.80359816725961e-8,0.0034515217741313154,-5.3223411868618484e-5,7.787229296285301e-8,0.0034518963778732035,-5.303630985682997e-5,7.753954870439826e-8,0.003452200772443476,-5.277494601652743e-5,7.708083438603485e-8,0.0034524067233620208,-5.24857622131667e-5,7.657676351766069e-8,0.003452513539318852,-5.222238745671445e-5,7.611970105647155e-8,0.003452546358006263,-5.202834487641089e-5,7.578401494859984e-8,0.003452545316805372,-5.1925238857953614e-5,7.56059228122419e-8,0.0034525517079226162,-5.1910531969244896e-5,7.55799748568084e-8,0.0034525973425899702,-5.1963341595560646e-5,7.566935879164173e-8,0.003452699860306806,-5.2053492925631584e-5,7.582168477769657e-8,0.003452863075258511,-5.2149607426261665e-5,7.598291155508565e-8,0.0034530799060755258,-5.222439818684115e-5,7.61063070119408e-8,0.003453335818338361,-5.2257343532068194e-5,7.615685892232103e-8,0.003453611766785339,-5.223571891965294e-5,7.61129377116946e-8,0.0034538864899658996,-5.215494408708145e-5,7.596690383151867e-8,0.003454138506384482,-5.201882998128307e-5,7.572562427973521e-8,0.003454348337076918,-5.183978826068164e-5,7.541091271463072e-8,0.0034545013314538756,-5.1638552963418784e-5,7.505903324803353e-8,0.003454591043269122,-5.144265642680074e-5,7.47179322561575e-8,0.0034546224963198295,-5.128290588661151e-5,7.444094709790633e-8,0.003454614029832736,-5.118756231866206e-5,7.427657654620211e-8,0.0034545960964780477,-5.117499667449252e-5,7.425575471974446e-8,0.0034546059759224725,-5.124696696840789e-5,7.438038383349255e-8,0.003454678971542103,-5.13853618139435e-5,7.46180167622108e-8,0.003454838496800186,-5.155451806553497e-5,7.490622976898416e-8,0.003455088410098183,-5.170923490366474e-5,7.516676020545438e-8,0.0034554104312331923,-5.18063784397559e-5,7.53256558047392e-8,0.0034557677626890567,-5.181660232781692e-5,7.533338722547459e-8,0.003456114043853787,-5.173270086815992e-5,7.517894604581043e-8,0.0034564052677747885,-5.157212308820495e-5,7.48937718027089e-8,0.003456611436614271,-5.1372648185342906e-5,7.454392055414663e-8,0.0034567244663298784,-5.118206849108857e-5,7.421205085109125e-8,0.0034567595924578005,-5.104487112438851e-5,7.397444303572169e-8,0.0034567496932292933,-5.0990411029647274e-5,7.388079046187029e-8,0.0034567348219838017,-5.1026634462844346E-05,7.394368941315555e-8,0.0034567511208470503,-5.1140910162072285e-5,7.41404001886787e-8,0.003456822969488365,-5.130640701071599e-5,7.442407063670418e-8,0.0034569600809666373,-5.149059048477161e-5,7.473844540174441e-8,0.003457158836079232,-5.166263101478568e-5,7.503054191154755e-8,0.0034574058624226842,-5.179814342816616e-5,7.525864485773623e-8,0.0034576819982162126,-5.188131487414444e-5,7.53958236160267e-8,0.003457965624434055,-5.190529764163641e-5,7.543055726802653e-8,0.003458235153642075,-5.187182989119657e-5,7.536613158997809e-8,0.003458470988800748,-5.179074706531707e-5,7.52198852644471e-8,0.0034586575036994354,-5.1679536585510255e-5,7.502247538759579e-8,0.0034587855033521653,-5.156254212189298e-5,7.481641900418598e-8,0.0034588552057932243,-5.1469030724573484e-5,7.465256143383775e-8,0.0034588791061978532,-5.142920657003421e-5,7.458297859873786e-8,0.003458883218149259,-5.1467660711166246e-5,7.464955268013278e-8,0.0034589045776179444,-5.159510836468649e-5,7.48697763858947e-8,0.0034589835250980615,-5.180135000044591e-5,7.522485150187091e-8,0.0034591517840109193,-5.205370320062124e-5,7.56573232920082e-8,0.0034594206555359705,-5.2303828254811026e-5,7.608317761780516e-8,0.0034597750906966754,-5.250174966429808e-5,7.641623908985145e-8,0.0034601771049745287,-5.2611539439694236e-5,7.659526793472266e-8,0.003460577222136936,-5.262200185778321e-5,7.660223703442587e-8,0.003460928903507887,-5.254861496345348e-5,7.646534203758294e-8,0.003461200559315436,-5.2427345790902366e-5,7.624789704143432e-8,0.0034613819623500147,-5.230371513415596e-5,7.602909490634815e-8,0.00346148446467581,-5.2220931733726785e-5,7.58833715008536e-8,0.003461536103359664,-5.2210117968981436e-5,7.586364467457609e-8,0.003461573517811942,-5.2284544913011865e-5,7.599167543503633e-8,0.0034616329485504336,-5.243864613206289e-5,7.625673698865155e-8,0.003461742549106104,-5.265142211148723e-5,7.662177846795173e-8,0.003461917703165235,-5.2892782274308036e-5,7.703449448843473e-8,0.0034621599737674246,-5.313072477304534e-5,7.74396760194996e-8,0.0034624591084389793,-5.33374098966768e-5,7.778955053911857e-8,0.003462796779292467,-5.349304510582412e-5,7.805033191515012e-8,0.003463150686187144,-5.3587487694671127e-5,7.820488911072816e-8,0.0034634980867577683,-5.362014291759816e-5,7.825256020973388e-8,0.0034638184347490337,-5.35989854743125e-5,7.820751398896041e-8,0.0034640953366142095,-5.353936163065365e-5,7.809672470592285e-8,0.0034643182806015373,-5.3462782486652334e-5,7.795785220255605e-8,0.0034644845501561154,-5.339545627403919e-5,7.783656035226323e-8,0.0034646014413177184,-5.336592005983549e-5,7.778221516267927e-8,0.0034646882637985664,-5.3400881599815127e-5,7.78405393635882e-8,0.003464776653159077,-5.351867683920702e-5,7.804231285445772e-8,0.003464906957150965,-5.372111733504216e-5,7.838949782169935e-8,0.0034651189235659127,-5.398689725856593e-5,7.884418711991946e-8,0.0034654377510551313,-5.427171287388532e-5,7.932912268318844e-8,0.003465861181889111,-5.45189747063227e-5,7.974637922620187e-8,0.0034663557995089868,-5.4679006723517416e-5,8.001057810235294e-8,0.003466866832075317,-5.4727667638690595e-5,8.008101605182355e-8,0.003467337213583027,-5.467430917764118e-5,7.997525515932372e-8,0.0034677259185634294,-5.45558137956383e-5,7.975848386026634e-8,0.0034680175758430914,-5.4421850197762574e-5,7.951758779610465e-8,0.003468221945391668,-5.431943863471243e-5,7.93341221303494e-8,0.003468366749984431,-5.4282189894998705e-5,7.926564782173139e-8,0.003468488253575451,-5.432554626942201e-5,7.933775100923389e-8,0.003468622577673265,-5.4446940976185534e-5,7.954473091422483e-8,0.00346879910386759,-5.4629139136083834e-5,7.985575566520995e-8,0.003469036315266957,-5.484531500646757e-5,8.022385234336574e-8,0.0034693400970225562,-5.506482644748267e-5,8.05959068464886e-8,0.003469704347103154,-5.525874833196587e-5,8.09221138287859e-8,0.003470113426848338,-5.54043045866477e-5,8.116348069551332e-8,0.003470545719066106,-5.548767615842907e-5,8.129655797854296e-8,0.0034709775149081618,-5.550506450046016e-5,8.131522490515083e-8,0.0034713865350294564,-5.546223505877917e-5,8.122990831469518e-8,0.00347175466700389,-5.537307165347207e-5,8.10651077332558e-8,0.003472069935483391,-5.5257707024367603e-5,8.085614780070984e-8,0.0034723279767847086,-5.514048489525153e-5,8.064555763367976e-8,0.0034725332728849033,-5.504767565387728e-5,8.047894670947377e-8,0.0034727002510506733,-5.5004592720721175e-5,8.039983781883514e-8,0.003472853897452726,-5.5031486682279284e-5,8.044249502323219e-8,0.0034730286883273595,-5.513778809238864e-5,8.062209526950794e-8,0.003473263973229728,-5.531544130156531e-5,8.092351809161323e-8,0.0034735943076693245,-5.553413717659481e-5,8.129347436960563e-8,0.003474035665897499,-5.574326882078972e-5,8.16441259001113e-8,0.0034745731955609315,-5.5884742086398796e-5,8.18752580591423e-8,0.0034751596486798657,-5.5914583892773785e-5,8.19115493205368e-8,0.003475729749079442,-5.5822556153648676e-5,8.173640984494093e-8,0.0034762246796353497,-5.563705319293436e-5,8.140033666182622e-8,0.003476612701492186,-5.541203574155975e-5,8.099801039245487e-8,0.003476895422108325,-5.52051656998577e-5,8.063001150121857e-8,0.0034771002354880218,-5.50597528893753e-5,8.037124816213464e-8,0.003477266808137206,-5.499678333889154e-5,8.025718895626209e-8,0.003477434878777277,-5.501575513956466e-5,8.028567476587208e-8,0.0034776364077081026,-5.510010155564282e-5,8.042677847876208e-8,0.0034778919129647623,-5.522370891534653e-5,8.063443431098723e-8,0.003478209655577147,-5.53567664624354e-5,8.085668027157581e-8,0.003478586484780268,-5.547053781197861e-5,8.104383769654996e-8,0.003479009745324267,-5.5541137233202974e-5,8.115488223399064e-8,0.0034794599661624203,-5.55522999409954e-5,8.116209039532e-8,0.00347991406310937,-5.5497055559913984e-5,8.105385714697197e-8,0.00348034877409459,-5.5378226962704636e-5,8.083554656447708e-8,0.003480743967899695,-5.5207701396177e-5,8.052824678244802e-8,0.003481085399356866,-5.500462615502403e-5,8.016563989201027e-8,0.003481366669257658,-5.4792906661938594e-5,7.978960191727658e-8,0.0034815903954937507,-5.459831114198394e-5,7.944505128213398e-8,0.003481768645435652,-5.444530524158718e-5,7.917429462220676e-8,0.003481922641158277,-5.435363020679066e-5,7.901097650404148e-8,0.003482081557943241,-5.43344611388244e-5,7.897344901624152e-8,0.0034822796949849086,-5.438607219406785e-5,7.90574880741661e-8,0.0034825508886991334,-5.4489814677525574e-5,7.922969966297901e-8,0.003482919510198329,-5.460863179618924e-5,7.942530879637457e-8,0.00348338922468968,-5.4691530175031036e-5,7.955606784582527e-8,0.0034839341482262006,-5.468684887826709e-5,7.953314250976801e-8,0.003484500044929782,-5.456236411226566e-5,7.930171563250027e-8,0.003485020395764967,-5.432242661163013e-5,7.887051211495277e-8,0.003485441830665722,-5.4009666442778456e-5,7.831463037203127e-8,0.003485744308334187,-5.3687830051453043e-5,7.774555423085291e-8,0.003485944356059249,-5.341619454208322e-5,7.726643890430705e-8,0.0034860824605426953,-5.323068031905013e-5,7.69391413336341e-8,0.003486205192699337,-5.313887848336849e-5,7.677573716104043e-8,0.003486351616487765,-5.312585818689202e-5,7.674902644824243e-8,0.003486546989851855,-5.3163832246076e-5,7.680975614919294e-8,0.003486802071512451,-5.322081037736187e-5,7.690188262653895e-8,0.003487115234474545,-5.326655085161755e-5,7.697289095930539e-8,0.003487475361305784,-5.3276107450321254e-5,7.697977967690026e-8,0.00348786468748232,-5.323188756023941e-5,7.689243976502786e-8,0.003488261541112851,-5.3124867656400085e-5,7.669564695902987e-8,0.0034886431118577687,-5.2955187271283527e-5,7.639006967152842e-8,0.0034889883345022694,-5.273207584356439e-5,7.599217164183895e-8,0.00348928082718179,-5.247287143335613e-5,7.553253065060545e-8,0.0034895115406157772,-5.220092938007728e-5,7.505217138911657e-8,0.0034896806403166163,-5.194253721386278e-5,7.45970984578306e-8,0.003489798281891112,-5.17231700616895e-5,7.421163449310192e-8,0.003489884081885023,-5.156346255637453e-5,7.393127924950925e-8,0.0034899651917605482,-5.1475349070217194e-5,7.37759579390884e-8,0.0034900730046242873,-5.145880727187514e-5,7.374448490150087e-8,0.0034902384487222934,-5.149957504391051e-5,7.38108940008001e-8,0.003490485713360978,-5.1568581097192085e-5,7.392383226896056e-8,0.0034908247516596694,-5.162452953725788e-5,7.401135645851316e-8,0.0034912442178913756,-5.162129070334261e-5,7.399384833356589e-8,0.0034917082870866084,-5.152067046187914e-5,7.380600775763368e-8,0.003492161919526589,-5.1307906470345714e-5,7.342344472404727e-8,0.0034925468003312904,-5.100251708159784e-5,7.28812436475048e-8,0.0034928230231711763,-5.065567102917774e-5,7.22692085054129e-8,0.00349298480607223,-5.0332008284307815e-5,7.170010948102879e-8,0.003493060486880091,-5.008509810197167e-5,7.126687367301145e-8,0.0034930978108644877,-4.994040408769448e-5,7.10129659368693e-8,0.003493144812116986,-4.989292212429899e-5,7.092852991350264e-8,0.003493236329890927,-4.991616821749949e-5,7.09664233386691e-8,0.003493389382240401,-4.997451260323819e-5,7.106400377600212e-8,0.0034936049670886314,-5.003303046878982e-5,7.116036558566628e-8,0.0034938724850190725,-5.006315699024087e-5,7.120605641471014e-8,0.003494174181710002,-5.004500801825621e-5,7.116689888635155e-8,0.003494488647240114,-4.9967898958017656e-5,7.10247226686362e-8,0.003494793491455296,-4.983017838931351e-5,7.077701977191036e-8,0.0034950676495118685,-4.963883343406836e-5,7.043629688622425e-8,0.0034952936893218015,-4.940884123717768e-5,7.00290073852739e-8,0.0034954602703394025,-4.91619116469257e-5,6.959337044053813e-8,0.003495564525333123,-4.8924164351532744e-5,6.917524860206665e-8,0.0034956137545527114,-4.872255946766232e-5,6.882178267966077e-8,0.003495625715726868,-4.858035828766625e-5,6.857332667336269e-8,0.003495626962793271,-4.8512296531638016e-5,6.845495049254806e-8,0.003495649053141319,-4.852049680516395e-5,6.846936904534974e-8,0.00349572299679345,-4.859225484338337e-5,6.859329915473242e-8,0.0034958728136478237,-4.870052145709375e-5,6.877863372874697e-8,0.003496109274904872,-4.8807474643686194e-5,6.895900381066696e-8,0.0034964250870034323,-4.887130098211752e-5,6.906179269833887e-8,0.0034967931639454048,-4.885581409325789e-5,6.902485348345956e-8,0.0034971698712657363,-4.874139651093061e-5,6.881530246607359e-8,0.0034975044920154213,-4.853405294472491e-5,6.84449092255104e-8,0.0034977539089692195,-4.82679369446728e-5,6.797415829244196e-8,0.0034978977356623906,-4.799750824878962e-5,6.749837862946622e-8,0.003497946438249529,-4.778016802970108e-5,6.71174247409688e-8,0.003497937170337883,-4.765667743097292e-5,6.690162413586374e-8,0.0034979190953097782,-4.763908471093491e-5,6.687094352623798e-8,0.003497936251514583,-4.771117288133363e-5,6.699607854306233e-8,0.0034980160892215074,-4.783863709240464e-5,6.72164958349271e-8,0.0034981665960245093,-4.798196106874302e-5,6.746304065721289e-8,0.0034983797653029723,-4.810632101892896e-5,6.7675162011292e-8,0.003498637465113023,-4.818668505636025e-5,6.780961989824135e-8,0.003498916867361659,-4.820909523255125e-5,6.784251930616007e-8,0.0034991943722301896,-4.816994545602405e-5,6.77679407084832e-8,0.003499448182358842,-4.8074658565751284e-5,6.759564195017042e-8,0.003499660159392372,-4.793641707463699e-5,6.734892080114882e-8,0.003499817561197899,-4.777495464323169e-5,6.70625616249293e-8,0.0034999149556601225,-4.761498368904733e-5,6.678005875369204e-8,0.0034999561644388504,-4.7483672003196496e-5,6.654908362581237e-8,0.003499955598723389,-4.7406752130685654e-5,6.64145242188782e-8,0.003499937981419274,-4.7403373506660164e-5,6.64093764187308e-8,0.0034999354725625304,-4.748062569635709e-5,6.654518620862992e-8,0.0034999818663642855,-4.762947778629249e-5,6.680512211808298e-8,0.003500104737353191,-4.782411608126126e-5,6.714310459443665e-8,0.0035003176166506283,-4.802589279357225e-5,6.749101949715656e-8,0.0035006147541124916,-4.819155958831892e-5,6.777333062458293e-8,0.0035009704717046735,-4.8283900302600454e-5,6.79257035406021e-8,0.0035013438418472647,-4.828195062171539e-5,6.791269545624289e-8,0.0035016879794580935,-4.818789700989003e-5,6.77394776851162e-8,0.00350196195728518,-4.8028314713332036e-5,6.7453611515929e-8,0.0035021422800556846,-4.784851634702435e-5,6.713486096804716e-8,0.0035022301857497284,-4.770064526201016e-5,6.687425034339409e-8,0.0035022515726871335,-4.762872570098612e-5,6.674801281177754e-8,0.003502248809025409,-4.76559744371242e-5,6.6795665439382e-8,0.0035022673478896467,-4.777938593190681e-5,6.701087743219682e-8,0.003502342631637575,-4.7973344665574994e-5,6.734808187955503e-8,0.0035024922414820824,-4.819969702053791e-5,6.774024524213613e-8,0.003502715017307082,-4.841926028605082e-5,6.811897897486228e-8,0.0035029954034810603,-4.8600480484494276e-5,6.842952899629088e-8,0.003503309784163736,-4.872362633221379e-5,6.863790981889476e-8,0.0035036322351094896,-4.878127146575032e-5,6.873159448741184e-8,0.0035039386022962613,-4.877672372667128e-5,6.871671928860393e-8,0.003504208970165578,-4.87218399559206e-5,6.861430714964363e-8,0.003504429141433504,-4.863501729753385e-5,6.845682584882933e-8,0.00350459182981821,-4.853945290340068e-5,6.828516088744188e-8,0.0035046979735865453,-4.846124060565817e-5,6.814520400131455e-8,0.00350475808642424,-4.842667362547513e-5,6.808297903800876e-8,0.00350479302443529,-4.845822639406622e-5,6.813746753851686e-8,0.003504833027239744,-4.8569169986268695e-5,6.833115419174137e-8,0.003504913702238319,-4.8757838383985466e-5,6.866012446657687e-8,0.0035050683853181447,-4.900391199350466e-5,6.908782646579392e-8,0.0035053182256271995,-4.926964452673352e-5,6.954751938057267e-8,0.003505663509814919,-4.950767016413277e-5,6.995616209346973e-8,0.003506080502214955,-4.967398233611283e-5,7.023720489982495e-8,0.0035065262851390663,-4.974153435641874e-5,7.034430756266863e-8,0.003506950416802348,-4.970896615211756e-5,7.027638385694825e-8,0.003507309058355678,-4.960110682063593e-5,7.0078148342398e-8,0.003507576569966767,-4.9461571981689524e-5,6.982680430100155e-8,0.003507751260505524,-4.9340525835212706e-5,6.961036660223815e-8,0.0035078543380118467,-4.928155435713404e-5,6.950463542881697e-8,0.003507923017411245,-4.931120710474176e-5,6.955507505634865e-8,0.003508000088817847,-4.943373386134086e-5,6.976794205386932e-8,0.0035081230318595195,-4.9631997266688886e-5,7.011223942234489e-8,0.003508315707408989,-4.987372010955851e-5,7.053089174394624e-8,0.003508584634184765,-5.012067906449034e-5,7.095689951327328e-8,0.003508920154172877,-5.033779131119303e-5,7.13291488630146e-8,0.0035093011174319503,-5.0499608977751295e-5,7.16036029544808e-8,0.0035097008909079027,-5.059322819724562e-5,7.175822123658268e-8,0.003510092795370233,-5.0618099620991336e-5,7.179252228933486e-8,0.0035104540074803628,-5.058396686418179e-5,7.172395576915468e-8,0.0035107678630634256,-5.050815563358695e-5,7.15831936559844e-8,0.0035110250474179707,-5.041300190160958e-5,7.140965978633763e-8,0.003511224303772449,-5.0323602655051194e-5,7.124755864747469e-8,0.003511373081760116,-5.026556563032649e-5,7.114182180173342e-8,0.0035114881227789486,-5.026219499321855e-5,7.113303314780363e-8,0.003511595434404246,-5.0330578468163386e-5,7.125049337013055e-8,0.003511728512620591,-5.047647794780582e-5,7.15033405278639e-8,0.0035119233836461974,-5.0689046876978714e-5,7.187153222950117e-8,0.003512209769178392,-5.093800093324406e-5,7.230120436607415e-8,0.003512599955153083,-5.1176799888461815e-5,7.271049692322936e-8,0.003513080034794742,-5.135392592457402e-5,7.300940477436388e-8,0.003513609502076132,-5.14298349934786e-5,7.312941724983363e-8,0.0035141320281950124,-5.139216413429823e-5,7.305001548325024e-8,0.0035145936629104664,-5.1261041454466944e-5,7.28077595651944e-8,0.003514959887450534,-5.108168091747994e-5,7.248300624823855e-8,0.0035152241266274524,-5.090867675710344e-5,7.217204520177112e-8,0.0035154059396990682,-5.078968882418096e-5,7.195828527441259e-8,0.0035155420813633245,-5.075426745699315e-5,7.189270617613542e-8,0.0035156751083582306,-5.0809654038145116e-5,7.198679130075311e-8,0.003515843117254807,-5.094257374417173e-5,7.221607476825528e-8,0.0035160725094786714,-5.112494538587068e-5,7.253048594280297e-8,0.0035163744088703465,-5.132142690619098e-5,7.286773029032713e-8,0.0035167446049327736,-5.1497064920155425e-5,7.316666417595633e-8,0.003517166385541075,-5.1623642515698906e-5,7.337826896105822e-8,0.0035176151934762446,-5.168374224689177e-5,7.347259275945112e-8,0.0035180638474490854,-5.167220679053694e-5,7.344117159692746e-8,0.003518487230567752,-5.159533656149261e-5,7.329555446259182e-8,0.0035188657466365884,-5.146856119474064e-5,7.306321274190783e-8,0.0035191873567905307,-5.13134535075297e-5,7.278232032475649e-8,0.0035194484899109596,-5.1154771029381724e-5,7.249655785721567e-8,0.0035196543025420254,-5.101775638284942e-5,7.225031546170417e-8,0.0035198186084428556,-5.0925530397301455e-5,7.208400788541844e-8,0.0035199635105888586,-5.089622436322815e-5,7.202894163244655e-8,0.003520118343208592,-5.093945103045378e-5,7.210112224469392e-8,0.0035203169511922577,-5.105206016209678e-5,7.229397007328736e-8,0.003520592065648051,-5.1214188069510806e-5,7.2571689142489e-8,0.00352096625240208,-5.138810927673326e-5,7.286756429012272e-8,0.0035214411001403445,-5.1523353653888815e-5,7.309310451119305e-8,0.0035219896591436894,-5.15702050538723e-5,7.316168179423694e-8,0.0035225589618442157,-5.149859927706176e-5,7.302152157725176e-8,0.003523085668432638,-5.1313067895405906e-5,7.268175566529078e-8,0.003523518917940908,-5.105359802726036e-5,7.221375246224139e-8,0.003523838095962248,-5.0780520742168284e-5,7.17243210762634e-8,0.0035240564761216146,-5.0552185506667285e-5,7.13161973079306e-8,0.003524211505779421,-5.040730619616483e-5,7.105688273569124e-8,0.003524349502340482,-5.035813602950126e-5,7.096680808680643e-8,0.0035245122820342207,-5.039321453053906e-5,7.102455458373297e-8,0.003524729076631242,-5.0485092313253465e-5,7.1180850127246e-8,0.003525013583176288,-5.059899047337806e-5,7.137404304621766e-8,0.003525364590777378,-5.070022815478351e-5,7.154318300099117e-8,0.0035257686958330417,-5.075977742115368e-5,7.163764186847562e-8,0.003526204144558562,-5.075793251795897e-5,7.16233638631601e-8,0.003526645154897335,-5.06861406598159e-5,7.148591957241648e-8,0.003527066167471657,-5.0547118838004726e-5,7.123062042100954e-8,0.0035274455836368955,-5.03535175473795e-5,7.088014482938875e-8,0.003527768623758874,-5.012545639882056e-5,7.047021401502236e-8,0.0035280290362206864,-4.988738877980477e-5,7.004408058198917e-8,0.0035282296839363246,-4.966483945398808e-5,6.964675729891865e-8,0.003528382291270085,-4.9481325891113706e-5,6.931952735975422e-8,0.003528506567199636,-4.935546278755109e-5,6.909476075587484e-8,0.003528628724271695,-4.929815291741338e-5,6.899092748257108e-8,0.0035287791842859104,-4.9309749713025403e-5,6.900767973450815e-8,0.0035289888641371506,-4.9377284113068966e-5,6.912119895490268e-8,0.003529283256307753,-4.947268367777429e-5,6.92813827041382e-8,0.0035296742313782816,-4.955407009659888e-5,6.941439827038625e-8,0.003530151349516904,-4.957278427309963e-5,6.943511266213218e-8,0.0035306772094212354,-4.948747198735312e-5,6.92717079077621e-8,0.003531192964839601,-4.928195652942658e-5,6.889685346018671e-8,0.0035316365215482056,-4.89774365236009e-5,6.834895029601523e-8,0.003531966575744259,-4.862874958980648e-5,6.772540073203424e-8,0.0035321786442322665,-4.830377164926679e-5,6.714615431489767e-8,0.003532303511122255,-4.805750770984733e-5,6.670788672264682e-8,0.0035323910644271955,-4.7915439884981005e-5,6.645464473265158e-8,0.003532490905278016,-4.787198094158151e-5,6.637538089556046e-8,0.0035326391070453276,-4.7899603242805185e-5,6.6420465804465665E-08,0.003532853457600977,-4.79609329089279e-5,6.652335567882734e-8,0.003533134764875135,-4.801870810507902e-5,6.661826425948239e-8,0.0035334709225311187,-4.80420607780708e-5,6.6651124930788e-8,0.0035338414892082007,-4.800969554135657e-5,6.658497123133597e-8,0.003534221883309781,-4.791109649069916e-5,6.640185991590025e-8,0.0035345870911481937,-4.774650430734176e-5,6.610271983901248e-8,0.003534914922415681,-4.7525956167852065e-5,6.570564041722356e-8,0.003535188784668761,-4.726751897573049e-5,6.524278234784632e-8,0.003535399869757837,-4.699475689773158e-5,6.475593288560843e-8,0.003535548488616758,-4.673352273796198e-5,6.429082959559262e-8,0.0035356443027719678,-4.6508419457597334e-5,6.389085743601263e-8,0.003535705452163371,-4.633936348530399e-5,6.359090277517784e-8,0.0035357567090917945,-4.623851257366044e-5,6.341187165168234e-8,0.003535826730715225,-4.6207747236638295e-5,6.335626221346214e-8,0.0035359444328626815,-4.62369186224868e-5,6.340521229944e-8,0.0035361343987252193,-4.6303140463713727e-5,6.351750974087675e-8,0.0035364112077063,-4.637182901460024e-5,6.363172583245652e-8,0.0035367731674912405,-4.640084478194753e-5,6.367372155706706e-8,0.003537197303637594,-4.634911429135081e-5,6.357183762261232e-8,0.0035376391122535576,-4.618966433176537e-5,6.327964211385549e-8,0.003538041119459337,-4.592349949638268e-5,6.280007246840904e-8,0.0035383510638224264,-4.558644822183458e-5,6.219724757422401e-8,0.0035385429814836127,-4.524104977366377e-5,6.158200500178063e-8,0.0035386287865788782,-4.495389988038994e-5,6.107183348045023e-8,0.003538652157842681,-4.477026159769317e-5,6.074602879654554e-8,0.0035386688439036844,-4.47004078804151e-5,6.062170724859673e-8,0.003538726003163398,-4.4722809906257866e-5,6.065974926915645e-8,0.0035388505435425223,-4.4797903515981296e-5,6.078947944701308e-8,0.003539047874416657,-4.488281287540454e-5,6.093489620785433e-8,0.0035393068814284787,-4.4941391084842396e-5,6.103238884542969e-8,0.003539606554146499,-4.494882794965666e-5,6.103867464873075e-8,0.003539921676724328,-4.4892499760318906e-5,6.093205597538492e-8,0.003540226919719803,-4.477102781459113e-5,6.07105950251088e-8,0.0035404997394379314,-4.4592754938286915e-5,6.03893845810904e-8,0.0035407226338242614,-4.437398906963968e-5,5.999749164758063e-8,0.003540885022134315,-4.413694086471505e-5,5.957436958624628e-8,0.0035409847601478635,-4.3907158055120185e-5,5.91653320895687e-8,0.003541029039603609,-4.371029443432704e-5,5.881578782502931e-8,0.003541034222876167,-4.3568356911767184e-5,5.856451374224705e-8,0.0035410242820919035,-4.34959360356527e-5,5.843690932693798e-8,0.0035410278165807162,-4.349704460319828e-5,5.8439391136652944e-8,0.003541073866467474,-4.35631774348635e-5,5.8556051173999174e-8,0.003541186954993939,-4.367314619920436e-5,5.874856491748497e-8,0.0035413819586960823,-4.379504612211161e-5,5.895993621631804e-8,0.003541659481115643,-4.389056974908652e-5,5.9122364071120686e-8,0.0035420026717852874,-4.392188556736655e-5,5.9169501196338025e-8,0.0035423770266627625,-4.386091460591744e-5,5.9052739202674654e-8,0.003542735137307152,-4.369954534362978e-5,5.8758966934382756e-8,0.003543027709928473,-4.345726115647605e-5,5.8323693696870554e-8,0.003543219432923343,-4.318096116450492e-5,5.783045574779396e-8,0.0035433037039722254,-4.293306375151269e-5,5.7389662664115485e-8,0.003543307510625984,-4.2770211481893025e-5,5.710096925546551e-8,0.003543281657416864,-4.2722564889928e-5,5.7016803661170176e-8,0.0035432808969128654,-4.2784998811324036e-5,5.7127048886294805e-8,0.003543345083182791,-4.29237431526913e-5,5.7371094348610354e-8,0.0035434901225729534,-4.309218173774192e-5,5.766603094543882e-8,0.0035437096200434323,-4.324625449648452e-5,5.793397699501254e-8,0.003543982437111229,-4.335377416740421e-5,5.811844457672117e-8,0.003544280963361055,-4.339731616568985e-5,5.81892230593214e-8,0.003544577345674607,-4.337307492070495e-5,5.814014309175838e-8,0.0035448472547188253,-4.328818788598209e-5,5.798423922921832e-8,0.003545071945356522,-4.315800457900615e-5,5.774893393946444e-8,0.0035452395202854154,-4.300371531604833e-5,5.7471914844255585e-8,0.0035453459408502194,-4.285012265748278e-5,5.719723861116069e-8,0.0035453958923160433,-4.2723120313231096e-5,5.697084279090594e-8,0.0035454032149012556,-4.264651128545993e-5,5.683482254338785e-8,0.0035453903011499546,-4.2638151061864956e-5,5.682050114724788e-8,0.003545385835098054,-4.270593783651835e-5,5.6941284815840156e-8,0.0035454206037119564,-4.2844639289619016e-5,5.718710304786205e-8,0.003545521737679013,-4.3034763683612925e-5,5.7522579910149e-8,0.0035457064554863466,-4.3244478586494526e-5,5.7890672855239426e-8,0.0035459768841103315,-4.343484771283477e-5,5.822218243869248e-8,0.0035463175130871715,-4.35676865911608e-5,5.8449803092231185e-8,0.003546696374372438,-4.361459001005239e-5,5.852408386886376e-8,0.003547070408275864,-4.3565227278255075e-5,5.842791123349795e-8,0.0035473947092906958,-4.343266116837182e-5,5.8185596798430805e-8,0.003547634245769986,-4.3253317404532224e-5,5.786248016398101e-8,0.003547775128552845,-4.307980993012999e-5,5.755198880500784e-8,0.0035478310759871168,-4.296686019185961e-5,5.7350653828112885e-8,0.003547840931561206,-4.295416001320256e-5,5.732790326738767e-8,0.003547856465191098,-4.305323561587963e-5,5.7503072995357236e-8,0.0035479251065484753,-4.3244764513410865e-5,5.7840967381065036e-8,0.0035480755467052556,-4.3487437490787506e-5,5.82678059755974e-8,0.003548312159234838,-4.3733132149183526e-5,5.869821561074207e-8,0.003548618609759482,-4.394085957403888e-5,5.9059893258797215e-8,0.0035489665155445534,-4.4084657379925696e-5,5.930742385274079e-8,0.0035493243155301293,-4.4155064485646884e-5,5.94246850590516e-8,0.0035496635912923074,-4.415657349882108e-5,5.942017343141657e-8,0.003549962454933137,-4.4103723515838815e-5,5.932002348157367e-8,0.0035502068853032385,-4.401745537774121e-5,5.91615814739689e-8,0.0035503910919313167,-4.392223541541534e-5,5.898836758135166e-8,0.0035505176599334156,-4.3843716170544275e-5,5.884594653272736e-8,0.0035505977261718136,-4.3806355923926305e-5,5.877765373835154e-8,0.0035506509029348764,-4.38304481117814e-5,5.881923373523053e-8,0.0035507042417583052,-4.392838644885185e-5,5.8992150582505356e-8,0.003550789375607358,-4.4100629561268414e-5,5.9296460179193444e-8,0.0035509372747178996,-4.4332623510118206e-5,5.970549942120029e-8,0.0035511709877155606,-4.459455929913146e-5,6.016568287046157e-8,0.0035514981633926815,-4.4845618151110135e-5,6.060425933750863e-8,0.0035519062473257645,-4.504285818124529e-5,6.094521953949166e-8,0.003552363010141798,-4.515265199572119e-5,6.112959670344877e-8,0.0035528232538145662,-4.516091931665212e-5,6.113348597576136e-8,0.0035532400588138987,-4.5078419810363994e-5,6.097717700290937e-8,0.0035535771481694945,-4.4939099071296303e-5,6.07218955472018e-8,0.0035538186514130496,-4.479186991256323e-5,6.045492489427308e-8,0.0035539735035672354,-4.4688098423139305e-5,6.02672442098929e-8,0.0035540731748337205,-4.466810631879039e-5,6.022963420680442e-8,0.0035541630731403067,-4.475043551216551e-5,6.037388305148787e-8,0.003554289865126375,-4.4927280773815736e-5,6.068503341769779e-8,0.0035544886846951913,-4.516779476639947e-5,6.110755581298996e-8,0.0035547745839082123,-4.542805241964009e-5,6.156319330980759e-8,0.0035551408759050616,-4.5663759910920776e-5,6.197350799964669e-8,0.003555563963135248,-4.5841008864221135e-5,6.227883337795943e-8,0.0035560116876657694,-4.5941979139417047e-5,6.24482093400329e-8,0.0035564516280192447,-4.596527201117455e-5,6.24798008660841e-8,0.003556857010155012,-4.592266312849646e-5,6.239502440655055e-8,0.003557209714814007,-4.5834565631833704e-5,6.223046308066282e-8,0.003557501080364987,-4.572581403912075e-5,6.203040815733011e-8,0.0035577315537230697,-4.562240269450946e-5,6.184110140786349e-8,0.003557910036471095,-4.554903608560832e-5,6.170637764909142e-8,0.0035580533024840793,-4.552692161730423e-5,6.166368747736406e-8,0.0035581853049642667,-4.557119728743023e-5,6.173946177102266e-8,0.0035583356940717664,-4.568768485662425e-5,6.194333838364082e-8,0.0035585365708927026,-4.586927857225371e-5,6.226185510588425e-8,0.0035588166627198116,-4.609326999183041e-5,6.265390851272246e-8,0.003559193137323904,-4.632193829336071e-5,6.30520372167614e-8,0.003559663281878733,-4.650876999059089e-5,6.337362542760012e-8,0.003560200245713937,-4.661063021140253e-5,6.354254648899662e-8,0.0035607569317794813,-4.6602396654738655e-5,6.351506594055439e-8,0.003561278648384015,-4.6487494514614917e-5,6.32983887923139e-8,0.0035617199935504846,-4.6298558243764545e-5,6.29516014692535e-8,0.003562058627582537,-4.608741314362649e-5,6.256758166751812e-8,0.0035623004672044175,-4.5909078533960046e-5,6.224430829280521e-8,0.003562475581175662,-4.5806486601264316e-5,6.205760310203278e-8,0.0035626279001984354,-4.580067735294027e-5,6.204384806523509e-8,0.003562802954124633,-4.5888015756848204e-5,6.219537779330008e-8,0.003563037055132452,-4.6043654273636875e-5,6.246701201447148e-8,0.003563350070700666,-4.622932203076322e-5,6.27901620525839e-8,0.0035637427913076075,-4.6403085941301916e-5,6.309025042503193e-8,0.003564198880158738,-4.6528682381631946e-5,6.330320173165173e-8,0.0035646903766327347,-4.658232632749611e-5,6.338736538669235e-8,0.0035651848849890845,-4.6555732749513495e-5,6.332870370697999e-8,0.0035656523705938485,-4.645535269046844e-5,6.313929883122431e-8,0.0035660700713561725,-4.6298937321714985e-5,6.285117367268997e-8,0.003566425004528302,-4.611096934697695e-5,6.250815533966789e-8,0.0035667143995241142,-4.591827694533483e-5,6.215809174271331e-8,0.0035669448573334944,-4.574655007561588e-5,6.184666832943819e-8,0.0035671310343054594,-4.561778706202556e-5,6.161284724828767e-8,0.0035672942787601126,-4.554824175451044e-5,6.148516952915002e-8,0.0035674611803288114,-4.5546361387194964e-5,6.147805454901015e-8,0.003567661543033928,-4.5610385548273515e-5,6.158757512312564e-8,0.003567924912442449,-4.5725767445714075e-5,6.178702994408387e-8,0.0035682748142848095,-4.5863544983274e-5,6.202428486357496e-8,0.0035687207877180566,-4.598192357438832e-5,6.222480065079293e-8,0.0035692503506583244,-4.603366023380281e-5,6.230484445613422e-8,0.0035698255742100237,-4.597995195287227e-5,6.219611092854864e-8,0.0035703895352063105,-4.580682740172019e-5,6.187471998839677e-8,0.003570883632004423,-4.553525834522834e-5,6.137904502638934e-8,0.003571268864222055,-4.521699225352601e-5,6.080211684283172e-8,0.0035715396695708015,-4.4916408899932836e-5,6.025908338968015e-8,0.003571723198393817,-4.468799023289393e-5,5.984686372144387e-8,0.003571866379697392,-4.456067955242553e-5,5.961625196141818e-8,0.0035720191409290983,-4.453406964456066e-5,5.956536150564443e-8,0.0035722211083410766,-4.458410992868764e-5,5.965019352482582e-8,0.003572494625911943,-4.4673173061435514e-5,5.980293252365561e-8,0.0035728434568544545,-4.476028636567257e-5,5.995034390494367e-8,0.0035732552997467812,-4.480936493091201e-5,6.002839604720158e-8,0.003573706429317807,-4.479480285769821e-5,5.99920413721776e-8,0.0035741673042217212,-4.4704415364411226e-5,5.982025244393188e-8,0.0035746082437256763,-4.45398457623661e-5,5.951659167339322e-8,0.003575004335958261,-4.43147481520429e-5,5.9105889956792483e-8,0.003575338940318722,-4.405137481478573e-5,5.862814161090186e-8,0.0035756054724064797,-4.3776367002100296e-5,5.81310100746709e-8,0.0035758075061845546,-4.3516565870462726e-5,5.766237414128631e-8,0.0035759576042431298,-4.32955011747464e-5,5.726406668644314e-8,0.003576075473322457,-4.313078064462699e-5,5.696719548910158e-8,0.0035761858511276887,-4.3032185858342236e-5,5.678871564724287e-8,0.0035763162079560256,-4.300017921430965e-5,5.672876610846801e-8,0.0035764940524594456,-4.3024605140873026e-5,5.6768438605918676e-8,0.0035767432881861085,-4.30836704446525e-5,5.686814868430869e-8,0.0035770790275487753,-4.314407216803266e-5,5.6968106744896594e-8,0.0035775010573515023,-4.3164050813275044e-5,5.699394484154996e-8,0.003577987803146952,-4.310136895375068e-5,5.6870952361826546e-8,0.0035784948165471183,-4.292678335936257e-5,5.65479221696561e-8,0.003578962840272767,-4.2639405852658924e-5,5.602429479005061e-8,0.003579336851006414,-4.227498438897039e-5,5.536473452635238e-8,0.003579588685688661,-4.18979968512765e-5,5.468488805835137e-8,0.0035797296080622783,-4.1578011198993515e-5,5.4109049105691114e-8,0.0035798042114301037,-4.1363105981440804e-5,5.372259413331688e-8,0.0035798702564199783,-4.126542984896543e-5,5.354626012529212e-8,0.0035799774382410184,-4.126391236459329e-5,5.354128307652321e-8,0.003580154993927935,-4.1317791469285e-5,5.363395239974795e-8,0.003580409608935486,-4.1381581597515776e-5,5.374262013811699e-8,0.003580729783643385,-4.1415934670145685e-5,5.3797139133405634e-8,0.003581092408746188,-4.139336320909661e-5,5.3748926352074026e-8,0.003581469034566333,-4.130007224972205e-5,5.357400193982709e-8,0.0035818310034735766,-4.1135487314135264e-5,5.3271956810880735e-8,0.0035821534692491988,-4.0910476824976e-5,5.286268340386592e-8,0.003582418418358619,-4.06446935945381e-5,5.238161243589318e-8,0.0035826166797022483,-4.0363280171443215e-5,5.187384845082181e-8,0.00358274884529989,-4.009317462540421e-5,5.1387588037206476e-8,0.003582824995614943,-3.985933882274082e-5,5.096737917280055e-8,0.0035828632611508504,-3.9681384105172434e-5,5.064806914993073e-8,0.0035828875139954875,-3.957098298811167e-5,5.045014818249678e-8,0.003582924529544475,-3.953016479695639e-5,5.0376688098463605e-8,0.00358300081862799,-3.955047708564117e-5,5.0411877426842314e-8,0.0035831392261010796,-3.961300640930363e-5,5.052117648958689e-8,0.003583355214352302,-3.968931328155379e-5,5.065319072165797e-8,0.0035836526718863154,-3.974377438611344e-5,5.074407946967609e-8,0.003584019676710392,-3.973841845099247e-5,5.072633320424865e-8,0.0035844258489106545,-3.9641235948389545e-5,5.0543575221023724e-8,0.003584824176308066,-3.943762986883524e-5,5.0170788891649215e-8,0.0035851605988330357,-3.914173842671066e-5,4.963424297277142e-8,0.0035853918960880448,-3.880043670747472e-5,4.9018405921792256e-8,0.003585505322328108,-3.848249328671764e-5,4.844644654517097e-8,0.003585527515563994,-3.8253569503164206e-5,4.803549689485371e-8,0.0035855144146158527,-3.8149888897543195e-5,4.784960245800021e-8,0.0035855273906091824,-3.8166487904675314e-5,4.787887836846632e-8,0.0035856104495281117,-3.8265157169492204e-5,4.805402080142565e-8,0.0035857798816200707,-3.8393560363288984e-5,4.828082047147677e-8,0.0035860268763078557,-3.8503227747035004e-5,4.847250586230702e-8,0.003586326680961035,-3.855986372475001e-5,4.8568113786697065e-8,0.003586648121636525,-3.8546152355993225e-5,4.853728942981486e-8,0.0035869605978639182,-3.846010828728895e-5,4.837710529272839e-8,0.003587238303345829,-3.8311783073421156e-5,4.810602981932446e-8,0.0035874625495865785,-3.811982896336047e-5,4.775775329407981e-8,0.00358762304655042,-3.790829412712801e-5,4.7375493462969575e-8,0.003587718543212155,-3.7703539314087314e-5,4.700651815697953e-8,0.0035877568854504843,-3.753109690746856e-5,4.669652828927809e-8,0.0035877543189045003,-3.741240911193318e-5,4.648378792509094e-8,0.0035877337821993926,-3.736170012036886e-5,4.639348279578213e-8,0.003587722146397466,-3.738348798138e-5,4.643324183247487e-8,0.003587746637258956,-3.747117499085622e-5,4.659063494568057e-8,0.0035878308010265218,-3.760702188597041e-5,4.683321176191194e-8,0.0035879904688035855,-3.776372946249842e-5,4.7111485215557924e-8,0.0035882302134709367,-3.790765307608103e-5,4.736488113389693e-8,0.0035885407027646038,-3.800358818517712e-5,4.753047496748133e-8,0.0035888975265631912,-3.802122612155703e-5,4.755460390198331e-8,0.003589262683625903,-3.7943134492679234e-5,4.740703403510289e-8,0.003589590313060849,-3.777295305645327e-5,4.709535929441549e-8,0.0035898376636516174,-3.754070148435225e-5,4.6674180657203245e-8,0.003589979939820703,-3.730052104784748e-5,4.6240824276023414e-8,0.003590023371945228,-3.711708048632642e-5,4.5910925049693536e-8,0.0035900077501635065,-3.7042871910765236e-5,4.577784781514526e-8,0.0035899933020088546,-3.709707415007798e-5,4.587502096050476e-8,0.003590037208575344,-3.725873614994456e-5,4.6163979998570615e-8,0.0035901730111987757,-3.747812082032692e-5,4.655494611376622e-8,0.0035904033060219416,-3.769784537258867e-5,4.6944876133643913e-8,0.003590705852666982,-3.787137405914086e-5,4.725061888805473e-8,0.0035910458330059257,-3.7972004750569304e-5,4.7424881917477886e-8,0.0035913870901548824,-3.799305368319623e-5,4.7456342834723396e-8,0.003591699210907479,-3.794340612840332e-5,4.736148608065085e-8,0.0035919606768198722,-3.7842095199116786e-5,4.7174801397497153e-8,0.0035921596171359957,-3.7713708795726786e-5,4.6940568127754947e-8,0.003592293558379161,-3.758490512066759e-5,4.6706667488679346e-8,0.0035923688823323,-3.7481625279828046e-5,4.651961895285797e-8,0.0035924001126666325,-3.742650014676788e-5,4.641991343171655e-8,0.003592408782381076,-3.743612894819133e-5,4.643708427178588e-8,0.0035924214411165024,-3.751830128528744e-5,4.6584688608919025e-8,0.0035924664696293106,-3.7669705308534085e-5,4.685621045027915e-8,0.003592569774155505,-3.7874901547291835e-5,4.7223301285490726e-8,0.003592749902450613,-3.810728859606727e-5,4.763765035237718e-8,0.0035930135281971444,-3.833251364146036e-5,4.8037268016193544e-8,0.003593352477999401,-3.85142094254474e-5,4.835692293551611e-8,0.003593743318325711,-3.862124028617287e-5,4.8541211620976406e-8,0.0035941500803349773,-3.8635219635304036e-5,4.855799005285224e-8,0.0035945303054739485,-3.8556856029829644e-5,4.8409563859566875e-8,0.0035948441441678958,-3.84093266238022e-5,4.8138450958546775e-8,0.0035950652932258955,-3.823653707192244e-5,4.7823971958565097E-08,0.003595191000352243,-3.809453371200407e-5,4.7566669363102354e-8,0.003595246796889517,-3.803631027123147e-5,4.7461060314247433E-08,0.0035952816700368603,-3.809404780623166e-5,4.756396298769029e-8,0.0035953529476908017,-3.826654280703843e-5,4.7872228760978966e-8,0.0035955064360887307,-3.851914359448242e-5,4.832290540180464e-8,0.0035957614102684605,-3.8797097685212365e-5,4.8817364790469434e-8,0.0035961074408753227,-3.904519065318432e-5,4.925659081088645e-8,0.0035965125426542463,-3.922380619036841e-5,4.9569925989950274e-8,0.0035969362675940465,-3.9315732962972006e-5,4.972712682605005e-8,0.003597341109482439,-3.932441886961113e-5,4.9735041797245097e-8,0.0035976991308152764,-3.9267828750470704e-5,4.962644042986901e-8,0.0035979941492756103,-3.917176770050048e-5,4.944797265987095e-8,0.0035982212646163817,-3.906461231436291e-5,4.925073309806581e-8,0.0035983853864858173,-3.8973731332623625e-5,4.9083882869826816e-8,0.003598499705108412,-3.8923037020490345e-5,4.899027237780294e-8,0.003598584313547959,-3.893093107139329e-5,4.900272753215885e-8,0.003598664665047769,-3.900814200916675e-5,4.914012707459969e-8,0.003598769295912446,-3.91554181102269e-5,4.940325446403414e-8,0.003598926296552057,-3.936159589408526e-5,4.9771395938974046e-8,0.0035991584178781378,-3.9603052569638225e-5,5.020149262688757e-8,0.0035994774570306106,-3.9845742495034574e-5,5.063196470603437e-8,0.003599879456446016,-4.0050595060088164e-5,5.099254875986903e-8,0.0036003427551529487,-4.018188155414745e-5,5.121939647495595e-8,0.0036008305267239238,-4.021666105614067e-5,5.127201267350899e-8,0.003601298082359539,-4.015241628723848e-5,5.114683795044416e-8,0.0036017034785005065,-4.001010080325409e-5,5.0882498429844205e-8,0.0036020186446318633,-3.983102151691306e-5,5.055393791953197e-8,0.00360223784043595,-3.966773922720605e-5,5.025583994965174e-8,0.0036023807275160397,-3.957088011118183e-5,5.0078834765566855e-8,0.0036024884440489483,-3.957514576006304e-5,5.008445593779248e-8,0.003602612836630004,-3.9688759093846825e-5,5.028643421396089e-8,0.003602801507346342,-3.9890448396384285e-5,5.064559582445518e-8,0.0036030837132397233,-4.013591224250133e-5,5.1081729897139555e-8,0.0036034625787910108,-4.037175117016467e-5,5.149873123423126e-8,0.0036039164745840613,-4.0551277524241955e-5,5.181297742668326e-8,0.0036044080529050305,-4.0646004294966926e-5,5.197384946590186e-8,0.00360489619893693,-4.064945869958866e-5,5.197041780922286e-8,0.0036053460251226866,-4.0574082061552914e-5,5.182570742191499e-8,0.0036057344318386826,-4.044453999591332e-5,5.158455566701788e-8,0.0036060514579108944,-4.029075668722807e-5,5.130104481965624e-8,0.003606299011004411,-4.01424970484346e-5,5.1028778692332877e-8,0.0036064885833287518,-4.0025849226308426e-5,5.081459498933569e-8,0.003606638973317254,-3.9961099891688534e-5,5.069476213733481e-8,0.003606774332411993,-3.9961203232245695e-5,5.069221405358963e-8,0.0036069222452277806,-4.003023028212907e-5,5.081374865009258e-8,0.0036071112182922568,-4.016168303508934e-5,5.1047028727656355e-8,0.003607366963232316,-4.033714988858951e-5,5.135826999643147e-8,0.0036077072303672525,-4.0526398781894345e-5,5.169257162187404e-8,0.0036081358410376746,-4.069044856608033e-5,5.19795998409735e-8,0.00360863791472181,-4.0788768684664725e-5,5.214662964419998e-8,0.0036091792602710175,-4.079000858969095e-5,5.2137837160242114e-8,0.003609712280943959,-4.068309768113012e-5,5.1934170132578293e-8,0.0036101880918484254,-4.04838562463079e-5,5.1565076095717744e-8,0.0036105710604826644,-4.0233135214053623e-5,5.11049366675387e-8,0.0036108500263461432,-3.998610781681087e-5,5.065355467128838e-8,0.003611041677968052,-3.9796540409886596e-5,5.0307660035659015e-8,0.0036111851665100313,-3.970186618515915e-5,5.0134017422303575e-8,0.0036113304864999287,-3.971382372907988e-5,5.0152753919674675e-8,0.0036115247250119607,-3.98167918000583e-5,5.033467938084641e-8,0.0036118001491949494,-3.997345877334354e-5,5.061180843179813e-8,0.003612167114637999,-4.013564216404726e-5,5.089703004119631e-8,0.0036126132814578962,-4.025692196720492e-5,5.110687626163271e-8,0.0036131087640671185,-4.0303479742982214e-5,5.118093281193777e-8,0.0036136150876857724,-4.026034802700086e-5,5.109292725088119e-8,0.003614094856008835,-4.0132016043704154e-5,5.085165351686192e-8,0.0036145193074628326,-3.993836208888382e-5,5.0493512681573206e-8,0.003614872292763547,-3.9708210576448246e-5,5.0070825982924494e-8,0.003615150815762236,-3.947285164647236e-5,4.9640137095099506e-8,0.0036153632808230353,-3.926096931140428e-5,4.9253097195019005e-8,0.0036155267616432177,-3.909538048400595e-5,4.89506275147321e-8,0.0036156642392711075,-3.8991230807476714e-5,4.8759693003331155e-8,0.0036158021749105296,-3.895495080175904e-5,4.86914245950835e-8,0.0036159682275933073,-3.8983383111791493e-5,4.873955389149923e-8,0.003616188577386115,-3.9062911493915725e-5,4.887889729439448e-8,0.0036164842465590077,-3.9168981167351876e-5,4.906461395007111e-8,0.003616866127419069,-3.926707099410478e-5,4.9234122993500053E-08,0.003617329348913702,-3.931673398289274e-5,4.9314522167269587e-8,0.003617849150796829,-3.928001916208648e-5,4.923780665633049e-8,0.003618381798653043,-3.913360777112033e-5,4.896267227430695e-8,0.0036188735440883186,-3.888055553865431e-5,4.849554188132768e-8,0.003619276853702225,-3.855491658006466e-5,4.789873129478229e-8,0.0036195676184713646,-3.821416389457841e-5,4.7276580612196774e-8,0.0036197545025373444,-3.792090095161403e-5,4.6742254073388355e-8,0.0036198753513412853,-3.772222272857822e-5,4.6380371688515686e-8,0.0036199830801991757,-3.763623905030227e-5,4.6222755173165736e-8,0.00362012849213772,-3.7650144684676776e-5,4.624521707582522e-8,0.003620346940104583,-3.77278873639625e-5,4.6381754134727366e-8,0.0036206519317770578,-3.7822429509832206e-5,4.654694600928876e-8,0.0036210353347296935,-3.788800232657244e-5,4.6658156643896576e-8,0.0036214722356083732,-3.7889552847069945e-5,4.665250017723497e-8,0.0036219282737146377,-3.7808250334028e-5,4.6496606350338104e-8,0.003622367558528604,-3.764294604213074e-5,4.618907856043481e-8,0.003622759613618764,-3.740807222574171e-5,4.5756568470016735e-8,0.003623084197594277,-3.7129000539556704e-5,4.524531717165578e-8,0.0036233334897944123,-3.6836271033352585e-5,4.471070197478162e-8,0.003623511822352105,-3.656004150987419e-5,4.42072171491852e-8,0.003623633625770037,-3.632568696345636e-5,4.378055463898182e-8,0.0036237204746564565,-3.615095303416537e-5,4.3462496938331666e-8,0.0036237980238943072,-3.604451542869379e-5,4.326833725239851e-8,0.0036238932087061873,-3.600542881626248e-5,4.3195891834918523e-8,0.0036240316260941043,-3.6022998605292114e-5,4.322528366433578e-8,0.003624234754252283,-3.6076927455552074E-05,4.331926852948421e-8,0.0036245165668879796,-3.613800749232242e-5,4.34246123367742e-8,0.003624879311897084,-3.617023187311202e-5,4.3476066000601294e-8,0.0036253090835464646,-3.6135726391495956e-5,4.3405390637871034e-8,0.0036257732585274127,-3.6003592967351125e-5,4.315733397260209e-8,0.0036262232058954036,-3.576186980901324e-5,4.271111422394686e-8,0.003626605331546473,-3.542823247726426e-5,4.209956869519151e-8,0.003626879436036661,-3.50518579454549e-5,4.1412337399755736e-8,0.0036270365079126123,-3.470071004044956e-5,4.0772704917605835e-8,0.0036271047904969573,-3.443736111457935e-5,4.029373159298715e-8,0.0036271389316380864,-3.429581521273013e-5,4.003629528591115e-8,0.0036271983746661196,-3.427189565117347e-5,3.999186380888534e-8,0.0036273272627723543,-3.433001504928174e-5,4.009507060595036e-8,0.0036275443605000503,-3.441929039714666e-5,4.02532013146905e-8,0.003627843559349204,-3.448978456372097e-5,4.037574941419381e-8,0.0036282007307444626,-3.450355291645972e-5,4.039436204166938e-8,0.0036285824334346232,-3.443962968437811e-5,4.027168052144104e-8,0.003628953774846586,-3.4294406238919776e-5,4.000181674287031e-8,0.003629284453436167,-3.4079224683629005e-5,3.960585055025596e-8,0.00362955288864694,-3.381643465683662e-5,3.912462715686188e-8,0.0036297485036715003,-3.353465476085004e-5,3.8610171191587416e-8,0.0036298722480067286,-3.3263883330298314e-5,3.811684927278125e-8,0.003629935574821214,-3.303104643643447e-5,3.769332757952957e-8,0.003629958188257625,-3.285642390889165e-5,3.737611903004188e-8,0.003629964993502037,-3.275128511796277e-5,3.7185320702803963e-8,0.0036299828010852926,-3.271683137367501e-5,3.712271268820873e-8,0.003630037189355566,-3.274419552984249e-5,3.7171770693712e-8,0.003630149597490292,-3.281517977483511e-5,3.729903127915843e-8,0.0036303345419651353,-3.290362286671258e-5,3.7456641443449155e-8,0.0036305967997701106,-3.297753462876925e-5,3.758635247116539e-8,0.003630928513207681,-3.300252642506156e-5,3.762587782766384e-8,0.0036313068265694214,-3.294744940956532e-5,3.7519188323039196e-8,0.00363169380297549,-3.2792780456482834e-5,3.7231652891866554e-8,0.0036320412779389313,-3.254062980327011e-5,3.676798183842747e-8,0.0036323028298620714,-3.222229600651305e-5,3.618566999286661e-8,0.00363245144150968,-3.1896535693968474e-5,3.559165692670533e-8,0.003632494924818845,-3.163343128727202e-5,3.5112974053962996e-8,0.003632477752238004,-3.148784739433187e-5,3.4848610971418145e-8,0.0036324645616411712,-3.147677766139223e-5,3.4828549478256566e-8,0.003632513929295136,-3.1574620316264846e-5,3.5005434477029905e-8,0.0036326579319382944,-3.1727711619258e-5,3.528122902984301e-8,0.0036328967617592234,-3.187682011716218e-5,3.554823526809591e-8,0.0036332061434049393,-3.197502524181992e-5,3.572156454636925e-8,0.0036335495974229026,-3.1995847248725226e-5,3.575374279393732e-8,0.003633889293870905,-3.19333227910892e-5,3.563461873953822e-8,0.003634193172744235,-3.17978842240923e-5,3.538369154094479e-8,0.003634438615965457,-3.161109030916799e-5,3.504045625380042e-8,0.003634613855985011,-3.1400671454106465e-5,3.465541572534082e-8,0.003634718071699902,-3.11961575856113e-5,3.428219175465637e-8,0.003634760562279025,-3.102500639946222e-5,3.3970535921702535e-8,0.0036347591134491177,-3.0909251987672765e-5,3.376025962304962e-8,0.003634737607805422,-3.086278268132625e-5,3.367629517795057e-8,0.0036347229490649663,-3.088948453492992e-5,3.372533325761154e-8,0.003634741563228235,-3.0982560065987805e-5,3.389460784514429e-8,0.003634815901229414,-3.112512713113596e-5,3.4153020033679004e-8,0.0036349612766972193,-3.129198170965659e-5,3.4454394956192596e-8,0.003635183245992869,-3.145240784677646e-5,3.4742669582784826e-8,0.0036354757079425717,-3.1573956992053166e-5,3.495886526255861e-8,0.0036358199160614058,-3.1627212256825974e-5,3.504983415027823e-8,0.0036361849045063073,-3.159171660721317e-5,3.4979039620345153e-8,0.003636530479561921,-3.1462895172653124e-5,3.473901011215707e-8,0.0036368142578559253,-3.1258495477149596e-5,3.436280051338025e-8,0.003637003387374721,-3.102115681331883e-5,3.3928392231956515e-8,0.003637088755021439,-3.081237158304347e-5,3.35475459720963e-8,0.003637094946225761,-3.069500019812094e-5,3.333402234292594e-8,0.0036370770559699434,-3.0708848592774254e-5,3.335935424561485e-8,0.0036371013292986853,-3.085231309250355e-5,3.361973574732224e-8,0.0036372186076369544,-3.108268917674487e-5,3.4036836713625407e-8,0.0036374461301725914,-3.133543760619602e-5,3.449300493597974e-8,0.0036377666800752285,-3.154966294649507e-5,3.4877648547478624e-8,0.003638141297749838,-3.1685759118405125e-5,3.511925103365506e-8,0.0036385252843173046,-3.173024090401332e-5,3.5193980505349496e-8,0.0036388799750885084,-3.1691380373824776e-5,3.5117541386689996e-8,0.003639178463924923,-3.1591479016366276e-5,3.493096321710203e-8,0.003639406831918024,-3.145964120367891e-5,3.4687408289269027e-8,0.0036395631103395176,-3.132641488984484e-5,3.444246310972407e-8,0.003639655535314708,-3.122008096808154e-5,3.4247456211883176e-8,0.0036397006665107633,-3.1163893875378406e-5,3.414448139816457e-8,0.003639721329488939,-3.1173806420359784e-5,3.416226804857164e-8,0.0036397441644748767,-3.125655767899938e-5,3.431270209771732e-8,0.003639796568166988,-3.140832386339877e-5,3.458839076722247e-8,0.0036399030331303018,-3.161441580614675e-5,3.49621599593727e-8,0.0036400812861970703,-3.1850493516183555e-5,3.538933414193512e-8,0.0036403388783366928,-3.2085469069802425e-5,3.581309683606768e-8,0.003640670899708472,-3.228595888933305e-5,3.617266898678714e-8,0.003641059410890908,-3.242184074945234e-5,3.6413480741849684e-8,0.003641474976614793,-3.2472192397990765e-5,3.6497992784001544e-8,0.0036418804736073327,-3.243081777099901e-5,3.6415684316993066e-8,0.0036422373048892133,-3.231046066567557e-5,3.619054998193656e-8,0.003642513965287651,-3.2144261682321465e-5,3.588351146600024e-8,0.0036426959856221573,-3.198235682061668e-5,3.5586005065773693e-8,0.0036427944977556605,-3.1881697208743154e-5,3.5401356745524745e-8,0.0036428486849075714,-3.188933045907144e-5,3.5414444145402196e-8,0.0036429173685921887,-3.202403752604784e-5,3.565852233264122e-8,0.0036430596414088368,-3.226577445343364e-5,3.609629779052436e-8,0.0036433124954249867,-3.2561078847616284e-5,3.66299793816928e-8,0.0036436776177795477,-3.284337212027593e-5,3.713830880496045e-8,0.0036441242313400286,-3.3057030277970586e-5,3.7520345040000954e-8,0.0036446041810241324,-3.317277180321848e-5,3.772337507096917e-8,0.0036450692490085615,-3.3189738563198884e-5,3.7746545722749065e-8,0.003645482899676809,-3.3128175256394194e-5,3.7627357042686266e-8,0.0036458246434632187,-3.301933774306142e-5,3.7423151774873677e-8,0.003646089234413236,-3.289707990184836e-5,3.71957515176344e-8,0.003646283665094115,-3.279244336538491e-5,3.7001641525103554e-8,0.0036464239349174375,-3.273067656021924e-5,3.6886607019548715e-8,0.0036465323149864697,-3.272957018214073e-5,3.6882747854165715e-8,0.0036466349961541663,-3.279825429446103e-5,3.700630533575309e-8,0.0036467596710251142,-3.2936106766617314e-5,3.725568811188398e-8,0.0036469325807821826,-3.313193807407561e-5,3.7610026698915855e-8,0.0036471748124150484,-3.3364069240662704e-5,3.802938859382088e-8,0.003647498169133209,-3.360210126412473e-5,3.845809149088258e-8,0.0036479015316435363,-3.38109253939106e-5,3.883209072712449e-8,0.003648368986541947,-3.395689666898082e-5,3.909027582893097e-8,0.003648870921029724,-3.401521748118757e-5,3.9187927000580045e-8,0.0036493686380024244,-3.397675991479839e-5,3.91090927084104e-8,0.0036498219897588453,-3.385230235314705e-5,3.887418894134722e-8,0.0036501985693956885,-3.367263505175776e-5,3.854000701640252e-8,0.0036504824684245895,-3.348382883038354e-5,3.819088250354824e-8,0.003650680396759058,-3.333785800459016e-5,3.792145205144569e-8,0.003650822939161007,-3.3279840876376515e-5,3.781338373671198e-8,0.003650959134371577,-3.3334613467666114e-5,3.791106516073476e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_23.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_23.json deleted file mode 100644 index c83a531d..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_23.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":23000,"numberOfSamples":1000,"samples":[0.003651144035305788,-3.3496975736922465e-5,3.820410327566936e-8,0.0036514219143992843,-3.3730554777606135e-5,3.862552436820353e-8,0.0036518112676496577,-3.397791609056264e-5,3.907035721036122e-8,0.00365229870095008,-3.417907449598782e-5,3.9429383363913e-8,0.00365284489977173,-3.4290356787269744e-5,3.962343833009104e-8,0.0036533992613388363,-3.429527055965991e-5,3.962310443890886e-8,0.003653915601993734,-3.4204210437811016e-5,3.9448034728001705e-8,0.0036543625588809866,-3.404606217387052e-5,3.915149562803171e-8,0.003654726821743164,-3.385745548023324e-5,3.880065521411588e-8,0.003655011114586897,-3.367402646076845e-5,3.846060844958942e-8,0.003655229952491537,-3.352516388562213e-5,3.818482941081412e-8,0.0036554053665251193,-3.343165583497147e-5,3.8010946814686524e-8,0.0036555634966590643,-3.3404964167691095e-5,3.7959478606448984e-8,0.0036557319972541605,-3.3447035834001456e-5,3.803352192134055e-8,0.0036559377077366316,-3.355009646938942e-5,3.821840523078073e-8,0.003656203941986329,-3.3696494348695236e-5,3.848145228658821e-8,0.0036565469978612378,-3.3859223781751256e-5,3.877301569526761e-8,0.0036569720596978405,-3.4004124438745524e-5,3.9030579556823116e-8,0.003657469498455847,-3.40947073072433e-5,3.918763315500793e-8,0.003658013393850613,-3.409978236972752e-5,3.918760770228968e-8,0.0036585642841328063,-3.400250012732713e-5,3.9000338042948336e-8,0.003659077039174998,-3.380774452480385e-5,3.8635466490843415e-8,0.0036595124517896076,-3.354428513728769e-5,3.8146233975437406e-8,0.0036598488695074555,-3.325957393919969e-5,3.761980345160911e-8,0.0036600895177045143,-3.30080589998171e-5,3.7155744789631976e-8,0.0036602626699706706,-3.2836659874036776e-5,3.6839414480127626e-8,0.0036604145345912036,-3.277203283919482e-5,3.671875744486885e-8,0.003660597076071134,-3.281332359526204e-5,3.679128814107534e-8,0.0036608541980586175,-3.293230507705976e-5,3.700462952878297e-8,0.003661210012998719,-3.308093000187256e-5,3.7270537712529526e-8,0.003661662575751951,-3.320440094368456e-5,3.74888633727299e-8,0.003662185161327315,-3.325597408349231e-5,3.7574542846225874e-8,0.003662734729255613,-3.320874898829924e-5,3.747900861351535e-8,0.0036632644530644296,-3.3060666580031256e-5,3.719917570818271e-8,0.003663735688217234,-3.283177311008349e-5,3.677230797634811e-8,0.003664125550367317,-3.255600900274537e-5,3.6260899113540797e-8,0.0036644288159946347,-3.227144312843095e-5,3.573475239964142e-8,0.003664655379067319,-3.20122786606644e-5,3.525635740926294e-8,0.0036648256060508692,-3.180406776074698e-5,3.487218993328028e-8,0.0036649655917790954,-3.166186058055134e-5,3.460940215582945e-8,0.003665103342555086,-3.15901849968733e-5,3.4475849367541365e-8,0.003665265988254904,-3.158372346364206e-5,3.4461364201339914e-8,0.003665477540567749,-3.162801003528849e-5,3.4539055157405407e-8,0.0036657565338192736,-3.17000936026722e-5,3.466655892539428e-8,0.0036661130590637785,-3.176968248208968e-5,3.478820502904388e-8,0.003666545202793297,-3.180174937323968e-5,3.483986629008923e-8,0.003667035788941662,-3.1761745550580205e-5,3.475855435760227e-8,0.0036675514497473767,-3.162389916152661e-5,3.449759311569503e-8,0.003668046654744528,-3.138114071038292e-5,3.404470126419763e-8,0.0036684741721542814,-3.105261032794423e-5,3.343560777759723e-8,0.003668799974560434,-3.068345735179965e-5,3.2753539214570226e-8,0.0036690165364966303,-3.0334013759936222e-5,3.2109244036842246e-8,0.0036691474276989216,-3.0061206934846583e-5,3.160683200695938e-8,0.0036692401145173264,-2.9900241087574385e-5,3.131020806459518e-8,0.0036693503292834495,-2.9854613982101406e-5,3.122493185911916e-8,0.003669525187357138,-2.989751080207272e-5,3.1301037813817e-8,0.0036697912282753556,-2.9982013376298203e-5,3.1452001909760237e-8,0.003670149929656101,-3.0055069990531985e-5,3.15804774867729e-8,0.00367058012275416,-3.007069224005011e-5,3.160245845426072e-8,0.003671045233915078,-2.9999480736268876e-5,3.14646043020311e-8,0.00367150289146305,-2.9833136999524488e-5,3.1152343179196404e-8,0.0036719145236925356,-2.9583830819543413e-5,3.068856987855197e-8,0.0036722528819754623,-2.9279274289988172e-5,3.012451965536157e-8,0.0036725060723375516,-2.8955216659429878e-5,2.9525956515840337e-8,0.003672677754130943,-2.864755268356975e-5,2.895869275364607e-8,0.003672784291843022,-2.838594682136872e-5,2.8476927435519246e-8,0.0036728502871910297,-2.8189969093245898e-5,2.8116221838894727e-8,0.0036729039195573616,-2.8067750927584617e-5,2.7891105878276732e-8,0.0036729730472076353,-2.8016458620949784e-5,2.7795998669456532e-8,0.0036730823256591566,-2.8023639314141942e-5,2.7807699502206006e-8,0.0036732510393670506,-2.806876922500443e-5,2.7888233842029837e-8,0.0036734911388206174,-2.8124848250507907e-5,2.7987802985082756e-8,0.003673805048096844,-2.8160365318995213e-5,2.8048454388623762e-8,0.0036741831643614118,-2.8142417714421486e-5,2.800989211450284e-8,0.0036746017845311393,-2.8042014596425726e-5,2.781926303572099e-8,0.003675023305396148,-2.7842042600133794e-5,2.7445742165138232e-8,0.003675401277467576,-2.7546573380207877e-5,2.6897486202051013e-8,0.0036756920590245525,-2.718737099853137e-5,2.623340000871415e-8,0.0036758711240840844,-2.682142732552505e-5,2.555844943167183e-8,0.0036759465937811365,-2.6515692647237495e-5,2.499551903112205e-8,0.0036759605227197774,-2.6323182982489206e-5,2.464151777744949e-8,0.0036759744983032644,-2.6262593443452535e-5,2.4530039671133795e-8,0.0036760466285700347,-2.6312844659637143e-5,2.462156779143457e-8,0.0036762123044454384,-2.6424126112870143e-5,2.4824015221802194e-8,0.003676476786014314,-2.6537239075107872e-5,2.5028430559382807e-8,0.0036768192350094923,-2.6601221243758545e-5,2.5141395201407517e-8,0.0036772028513650874,-2.658386925131194e-5,2.5104237965815816e-8,0.0036775858883604795,-2.6474864491415744e-5,2.4898599976612817e-8,0.0036779306440379686,-2.6283647779182486e-5,2.4542371246482394e-8,0.003678209538973982,-2.603439997978615e-5,2.408037372138913e-8,0.003678408358108114,-2.5759783494692988e-5,2.357282896906436e-8,0.003678526948850447,-2.5494493653466036e-5,2.308351403533256e-8,0.0036785777355817883,-2.5269467883076505e-5,2.2669143006386352e-8,0.003678582593628918,-2.5107461818455048e-5,2.2371273529194018e-8,0.003678568782474355,-2.5020417507422695e-5,2.2211520779320994e-8,0.0036785647042003374,-2.500871973525351e-5,2.21902445854814e-8,0.0036785961805071692,-2.5062054156622615e-5,2.228816628316454e-8,0.003678683593958781,-2.5161266743696174e-5,2.24697994986493e-8,0.003678839813725382,-2.528068865976697e-5,2.268772363615898e-8,0.0036790686589521994,-2.5390721102639514e-5,2.28873548323344e-8,0.0036793636633603534,-2.5460766843175067e-5,2.301239734670839e-8,0.0036797070625050198,-2.5462938404665122e-5,2.3011746096490555e-8,0.0036800695540226,-2.5377224112577794e-5,2.2849032250097418e-8,0.0036804123072578534,-2.5198284596178738e-5,2.251506689142407e-8,0.003680693157902537,-2.4942526484895308E-05,2.2040681988927512e-8,0.003680878158399637,-2.4651854910035483e-5,2.150341156448466e-8,0.0036809565821238504,-2.4388619881055524e-5,2.101802531841774e-8,0.003680952179938686,-2.4218042502926116e-5,2.0704157135192892e-8,0.003680920788736872,-2.418258152607271e-5,2.063924897056901e-8,0.0036809307429876595,-2.428216159309294e-5,2.082238656290625e-8,0.0036810354111426534,-2.4473729304710523e-5,2.1173726237950885e-8,0.003681253971997315,-2.4690578711906134e-5,2.1570233191745147e-8,0.0036815697161010955,-2.4868511669727512e-5,2.1893875946001677e-8,0.00368194233743989,-2.4964629040890916e-5,2.2066135288962184e-8,0.003682324212490332,-2.496342898745231e-5,2.2059068741709067e-8,0.0036826731166814996,-2.4873277705717296e-5,2.1888636709994033e-8,0.0036829591588462465,-2.4718729832185195e-5,2.1600441398920033e-8,0.003683167023967205,-2.4532594782350245e-5,2.1255080252265367e-8,0.0036832954099022645,-2.4349370543578626e-5,2.0916081024659693e-8,0.0036833550335923348,-2.4200218198591833e-5,2.0640692551785886e-8,0.0036833658565634006,-2.410924176009306e-5,2.047307011231562e-8,0.00368335380237866,-2.4090944865297163e-5,2.0439619325797367e-8,0.0036833471475006176,-2.4148859135246296e-5,2.054650508300012e-8,0.003683372810946003,-2.4275435196936255e-5,2.07794955328708e-8,0.003683452919780664,-2.445325289733475e-5,2.110623168930102e-8,0.003683602046501696,-2.465734339942249e-5,2.1480525304410102e-8,0.003683825298735307,-2.4858264023953814e-5,2.184802813428788e-8,0.0036841172991974114,-2.5025683730293013e-5,2.2152849985111426e-8,0.0036844620856947494,-2.5132324086251992e-5,2.234486049199623e-8,0.003684833943600737,-2.5158192450841574e-5,2.2387540094785343e-8,0.0036851994497372497,-2.5095227283073492e-5,2.226654684123872e-8,0.003685521611166236,-2.495214102688181e-5,2.199854944989616e-8,0.0036857671361551635,-2.4758044853092278e-5,2.1637716007903936e-8,0.0036859169029455434,-2.4561976529873086E-05,2.127462522493109e-8,0.0036859772914223593,-2.44246555966739e-5,2.102094321803886e-8,0.0036859863765741317,-2.4400569866343113e-5,2.0976459090247287e-8,0.0036860072100742725,-2.451503865503077e-5,2.1187033549314085e-8,0.0036861059724534228,-2.4748908547852973e-5,2.1616674172997784e-8,0.003686324629094954,-2.504318975211854e-5,2.2156284356747038e-8,0.003686664486266351,-2.5323155005089623e-5,2.2668137696737203e-8,0.0036870898114569946,-2.5527244493044108e-5,2.303909962374833e-8,0.003687546149128421,-2.5624766795011134e-5,2.3213143420424893e-8,0.00368798044731879,-2.5617338941137874e-5,2.3193859568407812e-8,0.0036883539373483384,-2.5529670793774248e-5,2.3027315403045705e-8,0.0036886463867155743,-2.5397760191839542e-5,2.2780188658898496e-8,0.003688854693802478,-2.5259351496340612e-5,2.2522155643143783e-8,0.0036889891708466456,-2.5147850491353615e-5,2.231471497123031e-8,0.0036890695533378795,-2.5088946206269493e-5,2.2205016955307542e-8,0.0036891214131626097,-2.5098827308126288e-5,2.222261384963983e-8,0.0036891729137179556,-2.518329063537529e-5,2.2377841591020216e-8,0.0036892516769625227,-2.5337494371236543e-5,2.2661397865423784e-8,0.0036893816097385863,-2.554645169281843e-5,2.3045303929869593e-8,0.0036895797925711486,-2.578657672893664e-5,2.3485809567516533e-8,0.0036898538468566012,-2.6028463573269312e-5,2.392855402626147e-8,0.003690200266554174,-2.624073990187162e-5,2.431568410168666e-8,0.0036906040827712275,-2.6394652975592825e-5,2.4594312535909952e-8,0.0036910401320671615,-2.646892578198544e-5,2.4725481010514338e-8,0.0036914760290490357,-2.6454258869800837e-5,2.469246723504824e-8,0.0036918767628710283,-2.6356872170899155e-5,2.450728188668473e-8,0.003692210885339878,-2.6200462392483775e-5,2.4214168577148188e-8,0.0036924581686777775,-2.602543095805307e-5,2.388800430693621e-8,0.003692617733382483,-2.5883626505455566e-5,2.362443103435925e-8,0.0036927139953002153,-2.58271594885082e-5,2.3519158494680385e-8,0.0036927961075991973,-2.5891978747853797e-5,2.3637775773338626e-8,0.0036929267649546634,-2.6081277797364088e-5,2.398538810384016e-8,0.0036931609455419815,-2.6358161739026842e-5,2.4493348826303326e-8,0.0036935234174346435,-2.665549718890737e-5,2.5037572254635175e-8,0.003693998101314756,-2.6900775812927172e-5,2.5484402286752192e-8,0.0036945360219985063,-2.7042710855034788e-5,2.5739608547857825e-8,0.0036950760446270714,-2.7065371302568437e-5,2.57743737612283e-8,0.003695565661023816,-2.6985691375977797e-5,2.5620578062499176e-8,0.00369597274607554,-2.684069713273219e-5,2.5347080120574853e-8,0.003696287324292012,-2.667345195030066e-5,2.5033662232297028e-8,0.0036965173262114045,-2.6523010525635966e-5,2.4752456189175374e-8,0.0036966825886261623,-2.6419227346433036e-5,2.455840471365584e-8,0.003696809522700842,-2.6380986372349695e-5,2.4486064306819182e-8,0.0036969270936339123,-2.6416117172469423e-5,2.454950799475654e-8,0.0036970637745599656,-2.6521893503182198e-5,2.4743286277766767e-8,0.0036972449046433265,-2.6685737210574117e-5,2.504376987032764e-8,0.0036974900334030988,-2.6886274245188e-5,2.541115595707101e-8,0.003697810176347896,-2.7095219934198905e-5,2.5793006605434385e-8,0.0036982053804941253,-2.728057365079077e-5,2.613018555159297e-8,0.003698663356525077,-2.7411217452902692e-5,2.6365357275177697e-8,0.0036991599725369096,-2.7462484334453646e-5,2.6453253365305067e-8,0.0036996621606698965,-2.7421763096580724e-5,2.6370997112730044e-8,0.00370013328491362,-2.729281033021235e-5,2.6126029195423446e-8,0.0037005403211717563,-2.7097411250876837e-5,2.5759105766375958e-8,0.0037008616198824073,-2.6873458549975153e-5,2.534063229254157e-8,0.0037010937154705065,-2.6669054268328128e-5,2.4959623377691335e-8,0.0037012553893138378,-2.6532771677849146e-5,2.470560529795536e-8,0.003701386925754609,-2.6501162935385394e-5,2.464554459140342e-8,0.0037015427319560873,-2.65862451416973e-5,2.4800881221936585e-8,0.0037017770840136652,-2.6767600671031702e-5,2.5133175185444305e-8,0.003702126226889177,-2.6994365678892358e-5,2.5547991564237983e-8,0.003702594034496086,-2.7199503702774686e-5,2.5921361512321817e-8,0.003703149146929241,-2.7322124217394617e-5,2.6140992193989e-8,0.0037037362260185593,-2.732763109091641e-5,2.6143421934714618e-8,0.003704295665546802,-2.721607872496196e-5,2.5929372282700263e-8,0.0037047816795343263,-2.7016566312550213e-5,2.5553267597604028e-8,0.003705171555362991,-2.6773370862474705e-5,2.509745527697299e-8,0.003705465407158616,-2.6531809403462105e-5,2.4645955131628586e-8,0.0037056802842188206,-2.6328749558537203e-5,2.4266888380384873e-8,0.003705842962671197,-2.6188473724591307e-5,2.4004889346311846e-8,0.0037059839388316924,-2.6122241314280676e-5,2.3880388417301026e-8,0.0037061332623507665,-2.6129556128220352e-5,2.3892034999399584e-8,0.003706317770909461,-2.6199800840217618e-5,2.4019772205175913e-8,0.0037065589557418377,-2.6313745875571078e-5,2.4227665838511646e-8,0.003706870840343872,-2.644512355745995e-5,2.4466855843329514e-8,0.003707257688373799,-2.6562856852741105e-5,2.4679720562225874e-8,0.003707711915905993,-2.6634592082949376e-5,2.4806441695489335e-8,0.003708213120455237,-2.663186058357122e-5,2.479455939697902e-8,0.0037087294412449907,-2.6536451255494063e-5,2.4610743259413702e-8,0.003709222214515911,-2.6346543661015368e-5,2.4252099963225886e-8,0.0037096538724641567,-2.6080329046030495e-5,2.3752812169666824e-8,0.003709997524539029,-2.577492734907529e-5,2.3182040780489726e-8,0.0037102454227998637,-2.5479672505274922e-5,2.263137359655951e-8,0.0037104132986381126,-2.524481178501241e-5,2.219379012489409e-8,0.0037105385684950997,-2.5108446768208215e-5,2.1939440481081604e-8,0.003710672201591465,-2.5085405601484373e-5,2.1895121723236657e-8,0.0037108659074224157,-2.5161493732589e-5,2.2033822651041703e-8,0.0037111577917986476,-2.5295461489293446e-5,2.2278586025456243e-8,0.0037115606470070174,-2.542917933201141e-5,2.2521498478199035e-8,0.0037120571654388006,-2.5503837048517596e-5,2.2653719725711947e-8,0.003712604656330799,-2.5477070966070233e-5,2.259714366597435e-8,0.0037131481138471807,-2.5334611035146297e-5,2.232587717598007e-8,0.0037136365417578987,-2.509202414715311e-5,2.1869364929837613e-8,0.0037140360486028587,-2.4786787143587042e-5,2.1297584304020552e-8,0.0037143354755474435,-2.4465255139622436e-5,2.069678054959071e-8,0.003714544467024974,-2.4170306202152613e-5,2.0146497047207724e-8,0.003714687020580643,-2.393338515246342e-5,1.9704838425664365e-8,0.0037147941125955726,-2.3771532108372094e-5,1.9403042636394202e-8,0.0037148976705766875,-2.3687944947412868e-5,1.924662719845783e-8,0.0037150265340877417,-2.367419895466894e-5,1.9219583030809972e-8,0.003715204015883382,-2.37127525260934e-5,1.928905809182854e-8,0.0037154462776015544,-2.377915294824585e-5,1.9409457545578542e-8,0.0037157608120527794,-2.384409788521174e-5,1.9526274662557453e-8,0.0037161447586631148,-2.387597552240848e-5,1.9580823667812967e-8,0.003716583383528966,-2.384460787773986e-5,1.9517213785745727e-8,0.0037170496879362957,-2.372665990986959e-5,1.929240272445178e-8,0.003717506623292282,-2.3512366057301022e-5,1.8888665065491976e-8,0.003717913280569818,-2.3211764390501293e-5,1.832510925529357e-8,0.0037182350231976446,-2.2857213753819283e-5,1.766226069432184e-8,0.0037184549931704456,-2.2499015996168416e-5,1.69938183046161e-8,0.0037185822522199053,-2.2193400184984013e-5,1.642422937600723e-8,0.0037186520125712316,-2.1986125984029035e-5,1.6038180871423233e-8,0.0037187166025020217,-2.1897980951190913e-5,1.5873715102312037e-8,0.0037188302313518797,-2.1918094714878887e-5,1.5909975868926e-8,0.0037190333250862505,-2.200738683831528e-5,1.6073822676410523e-8,0.003719341736464505,-2.211021106517147e-5,1.6261616807192078e-8,0.003719743573072058,-2.216979978548509e-5,1.636795341593824e-8,0.0037202036700935363,-2.214280148765948e-5,1.631260873446929e-8,0.0037206737661205037,-2.2009147434640982e-5,1.6058763393847896e-8,0.0037211051970497504,-2.1775071201819367e-5,1.5618506174731158e-8,0.003721460458739193,-2.1469112666244478e-5,1.5045318183279198e-8,0.0037217205729197273,-2.113297412457324e-5,1.4417004888548999e-8,0.0037218868002361744,-2.081050254733132e-5,1.3815164650950308e-8,0.0037219772900882707,-2.0538209327698315e-5,1.3307554545741322e-8,0.003722020789722907,-2.033950176989565e-5,1.2937408851043707e-8,0.00372204987109083,-2.022296133826621e-5,1.2720322617019088e-8,0.0037220953992123298,-2.018363795951063e-5,1.2646747001885697e-8,0.0037221828649194387,-2.0205878245740093e-5,1.26873047206367e-8,0.0037223303313133104,-2.02664502220618e-5,1.2798609312135926e-8,0.003722547317866394,-2.0337344535813425e-5,1.292845264550573e-8,0.0037228339677174557,-2.0388317730423293e-5,1.3020518278734751e-8,0.003723180190839855,-2.0389705420379754e-5,1.3019629712220013e-8,0.0037235650128087322,-2.0316187736311858e-5,1.2878799919059847e-8,0.003723957027956693,-2.0152005616268402e-5,1.256897561523051e-8,0.003724317479797812,-1.9897320189773163e-5,1.2090860847159705e-8,0.0037246074892309214,-1.9573777293026863e-5,1.1485194896322013e-8,0.0037247994563825186,-1.922551672634567e-5,1.0834500081040653e-8,0.003724889413287953,-1.8911635022200557e-5,1.024891375539621e-8,0.003724903860006442,-1.8689419208005423e-5,9.834890386340725e-9,0.0037248950039658825,-1.8593936835862856e-5,9.657227552497414e-9,0.0037249241617011717,-1.8624070004157957e-5,9.713213497022367e-9,0.0037250406734058938,-1.874272347827841e-5,9.933231932671707e-9,0.003725266442256563,-1.889068343187049e-5,1.0206743013046786e-8,0.003725591957814072,-1.900639132302381e-5,1.0419161121580107e-8,0.0037259828367480837,-1.9042941445738243e-5,1.0483445088589561e-8,0.0037263919105630754,-1.8977532859680972e-5,1.0357575288150131e-8,0.0037267718541946424,-1.8812970780198845e-5,1.004722544629047e-8,0.0037270852122032435,-1.857321752592454e-5,9.597390829866145e-9,0.0037273105106150057,-1.829556589372417e-5,9.077766944676528e-9,0.0037274442822466383,-1.8021665816886436e-5,8.566019197106112e-9,0.003727499446205275,-1.7789180452793088e-5,8.132238797880786e-9,0.0037275009651962054,-1.762549477405663e-5,7.827238632585327e-9,0.003727480107433613,-1.7544324987777415e-5,7.676278027300595e-9,0.003727468693735596,-1.7545252223564655e-5,7.678260381961283e-9,0.0037274943796830745,-1.7615546114334517e-5,7.809198521585769e-9,0.0037275775048591624,-1.773333185341448e-5,8.028155894012631e-9,0.003727729461688348,-1.7871140037744037e-5,8.283855986333845e-9,0.0037279521045785026,-1.7999224672154963e-5,8.520831022886832e-9,0.0037282376812551145,-1.80885880022614e-5,8.685033780576021e-9,0.0037285690243083164,-1.8114038809190196e-5,8.729555432946514e-9,0.003728920113641478,-1.8057767593507887e-5,8.621345067804234e-9,0.0037292576952676747,-1.7913835381609194e-5,8.349624258909386e-9,0.0037295452618239825,-1.769325645659619e-5,7.935342096310923e-9,0.003729750685610381,-1.742782377238727e-5,7.438195143004906e-9,0.0037298573864923707,-1.7169070621178025e-5,6.954523489002591e-9,0.0037298756982351187,-1.6978346810287705e-5,6.598664526266755e-9,0.003729847357057938,-1.690734999300974e-5,6.466620041821976e-9,0.0037298361456615196,-1.6976011363689884e-5,6.594939654273422e-9,0.0037299052651525726,-1.716065001020904e-5,6.938856540972064e-9,0.003730092529452638,-1.7401587629302746e-5,7.386701385086378e-9,0.0037303974273488636,-1.7626624987369516e-5,7.803782958842304e-9,0.0037307856005640463,-1.7776600142330956e-5,8.080023637204767e-9,0.0037312048557727917,-1.782075236454326e-5,8.158500185359126e-9,0.0037316025984929033,-1.7758874434021704e-5,8.039315141398938e-9,0.003731938096263313,-1.7614499874872118e-5,7.76676690099454e-9,0.0037321881752387263,-1.7424800949631686e-5,7.410439462798648e-9,0.003732347832913049,-1.7230987288991442e-5,7.047285654047261e-9,0.003732427807332729,-1.7070752855394434e-5,6.747564430999931e-9,0.0037324505819447216,-1.6972951318685194e-5,6.564937105062063e-9,0.0037324456392299724,-1.695435236964585e-5,6.530439072511247e-9,0.003732444524964121,-1.701842445824136e-5,6.650238763256346e-9,0.0037324762624747466,-1.7155994000405556e-5,6.906918712508451e-9,0.003732563584080442,-1.734745000939961e-5,7.263649467205659e-9,0.003732720347862681,-1.7566052220995436e-5,7.670403442963853e-9,0.003732950305259306,-1.7781762662003478e-5,8.071102483695934e-9,0.003733247046701793,-1.796503766997897e-5,8.410658713739836e-9,0.003733594793483443,-1.8090329320746774e-5,8.641476568061361e-9,0.003733969829689655,-1.8139333953936072e-5,8.729522514097567e-9,0.0037343425695851745,-1.8104141430392796e-5,8.660245887318678e-9,0.003734680606263795,-1.7990430125363365e-5,8.444572497323546e-9,0.003734953553838489,-1.782034694147802e-5,8.124239420623847e-9,0.003735140403146867,-1.7633507226156773e-5,7.77352976095781e-9,0.003735238848109435,-1.748329459267977e-5,7.4921953391734e-9,0.003735273477531778,-1.742550583944127e-5,7.384151459049214e-9,0.0037352966592492363,-1.749922907883764e-5,7.52182191537506e-9,0.0037353759026406193,-1.7706708770883272e-5,7.908742842178216e-9,0.003735568740471046,-1.8005201420696946e-5,8.464598259716825e-9,0.003735897522340255,-1.8320262806021934e-5,9.050180658370451e-9,0.0037363400742964556,-1.8575326378219387e-5,9.522633384422312e-9,0.0037368415776035976,-1.8720037863678725e-5,9.788290822532997e-9,0.0037373380712256233,-1.874245668787921e-5,9.825363797506921e-9,0.0037377771555825133,-1.8663787364666786e-5,9.673974471483982e-9,0.0037381282616453346,-1.852433494079792e-5,9.409797508911304e-9,0.0037383834002827367,-1.8369540890756483e-5,9.117901324121186e-9,0.003738552757404369,-1.824019873721411e-5,8.874473223547163e-9,0.003738658809558917,-1.8167100505264942e-5,8.736870253285727e-9,0.003738730844138739,-1.8168783218842287e-5,8.739462794445459e-9,0.0037388003329487827,-1.8251037280980622e-5,8.892751862877826e-9,0.00373889698628947,-1.8407514500518183e-5,9.18453775255549e-9,0.0037390453516148825,-1.8621272393550024e-5,9.582855243041857e-9,0.0037392620029640536,-1.886722395403692e-5,1.0040612490717398e-8,0.0037395535311001136,-1.9115464924135617e-5,1.0501851379362463e-8,0.0037399156645016815,-1.9335279841595094e-5,1.0909231443508442e-8,0.003740333727271666,-1.949936503986908e-5,1.1211879486748627e-8,0.0037407843754003085,-1.9587781487259298e-5,1.1372730485053469e-8,0.00374123843967038,-1.9591286559904284e-5,1.1374739407503882e-8,0.003741664694071747,-1.951376722599113e-5,1.1225445494692067e-8,0.003742034426709988,-1.9373566096839915e-5,1.0959456056172562e-8,0.0037423268826330203,-1.9203348136011737e-5,1.0638143074060602e-8,0.0037425355319994974,-1.9047512251718933e-5,1.0344682395521544e-8,0.003742674153842459,-1.8955552707843683e-5,1.0171510875620036e-8,0.003742780075672932,-1.897020365172007e-5,1.0198117014107015e-8,0.003742910352084255,-1.91115247419747e-5,1.0461391980825988e-8,0.003743127236642866,-1.936274082819314e-5,1.0929372494595087e-8,0.0037434748877366456,-1.966787992300605e-5,1.1497025901544866e-8,0.0037439582292228346,-1.994830716850865e-5,1.2017239417133448e-8,0.0037445380916303205,-2.0132874757777342e-5,1.235715857869903e-8,0.003745147304945264,-2.018475709919423e-5,1.24483095139559e-8,0.003745717536123864,-2.0110039024257403e-5,1.2302602979977455e-8,0.0037462009957385913,-1.994718213155144e-5,1.1992528512288664e-8,0.003746578533952196,-1.9748112336383324e-5,1.1615631205305184e-8,0.0037468562058775336,-1.9561943110626034e-5,1.1263957057301948e-8,0.0037470568320752493,-1.942580720910747e-5,1.1006894832462288e-8,0.003747211591296955,-1.936188801722068e-5,1.0885690830408487e-8,0.0037473537091404366,-1.937798694893093e-5,1.0914592901045096e-8,0.00374751426169476,-1.9469411529319156e-5,1.1084443738119213e-8,0.003747719306811906,-1.9621107982094123e-5,1.1366715498674678e-8,0.003747987653823677,-1.98098865025236e-5,1.171772196127629e-8,0.0037483289877986337,-2.00069900657524e-5,1.2083476553019989e-8,0.0037487424409848157,-2.018133651430223e-5,1.2405790481457967e-8,0.003749216049729212,-2.0303576953806943e-5,1.262985740223278e-8,0.0037497276616432853,-2.0350656359240593e-5,1.2712744009555985e-8,0.0037502476097356495,-2.0310161881186038e-5,1.263147987969798e-8,0.0037507430698388022,-2.01836052339569e-5,1.238917732256602e-8,0.003751183640813286,-1.9987806416820744e-5,1.201762072309364e-8,0.003751547358372743,-1.975377558398845e-5,1.1575159589463945e-8,0.0037518262278624856,-1.9522888966651756e-5,1.1139487350292194e-8,0.003752030366449994,-1.9340357022812065e-5,1.0795307888503861e-8,0.003752189575101569,-1.9246075080711368e-5,1.0617115929008991e-8,0.00375235065514588,-1.926362082860626e-5,1.0648597353873207e-8,0.00375256874733072,-1.9389760757096198e-5,1.0883103913087454e-8,0.0037528923589819,-1.95889336244771e-5,1.1253515334163685e-8,0.003753345377221318,-1.9798233653190108e-5,1.1641722277737352e-8,0.003753914085684261,-1.9945444226348306e-5,1.1912441558529761e-8,0.0037545482183929373,-1.997468342657704e-5,1.1961217063101045e-8,0.003755178268860511,-1.9866841003214947e-5,1.1752664664935419e-8,0.003755740498054235,-1.9643572837075e-5,1.132790926630942e-8,0.003756196287862252,-1.9354386897528227e-5,1.078027677361611e-8,0.0037565380292510645,-1.9056473937833167e-5,1.02173374524946e-8,0.003756783287516352,-1.879808625982981e-5,9.729641408606765e-9,0.003756964059188642,-1.8610299848009276e-5,9.375278483928095e-9,0.0037571168822495586,-1.850601029274588e-5,9.178087064121487e-9,0.0037572761536310796,-1.8482743679660896e-5,9.133032553034088e-9,0.003757470458105261,-1.8526444575679007e-5,9.213386299761704e-9,0.003757720726876309,-1.8614862202039136e-5,9.377117285257808e-9,0.0037580391353763576,-1.8720347719301517e-5,9.572164083264661e-9,0.0037584281701537876,-1.88124868526117e-5,9.741392613497707e-9,0.003758879845331222,-1.886115999095588e-5,9.828343171502811e-9,0.003759375547369298,-1.884045521805883e-5,9.784556157303305e-9,0.0037598873171901443,-1.8733336140393533e-5,9.578297218737537e-9,0.0037603812993048536,-1.8536245409891986e-5,9.20316322759362e-9,0.003760823522734917,-1.826223272290799e-5,8.683933253519903e-9,0.0037611872682305502,-1.794102306496649e-5,8.07668074991078e-9,0.003761460322951104,-1.761495849043393e-5,7.461118830695648e-9,0.003761649939215854,-1.7330967802997768e-5,6.925453527388214e-9,0.003761783669047966,-1.7130080930370736e-5,6.546618226195867e-9,0.0037619052215471355,-1.7036850169632218e-5,6.370380696093653e-9,0.0037620655927134623,-1.7051287457088965e-5,6.396265383341771e-9,0.0037623107889809214,-1.7145824206739997e-5,6.571987750426438e-9,0.0037626686506996173,-1.7269316797664524e-5,6.8011328521040325e-9,0.0037631385620556235,-1.7358826009662052e-5,6.965369983083214e-9,0.003763688525936491,-1.735727517214488e-5,6.957620478797519e-9,0.0037642627046168722,-1.7231514285195872e-5,6.7159383377332736e-9,0.003764798192409383,-1.6983144070799588e-5,6.243784790204022e-9,0.003765244475384821,-1.6646684177942917e-5,5.606514320308481e-9,0.003765577041731878,-1.6276113749033035e-5,4.905976489211403e-9,0.0037658001496303955,-1.5926872483978327e-5,4.246574565661419e-9,0.003765940043113608,-1.5641428521669665e-5,3.7080826046676444e-9,0.0037660339883212393,-1.5442580188857785e-5,3.3330932819261697e-9,0.0037661202972565054,-1.533378212849883e-5,3.1277370664346276e-9,0.0037662317987403426,-1.530331931720143e-5,3.0696368494463564e-9,0.00376639269783391,-1.5329353706236113e-5,3.117459743615627e-9,0.0037666175999535394,-1.5384239766858776e-5,3.2190461479142756e-9,0.003766911424015544,-1.5437798596845338e-5,3.3175546155956647e-9,0.0037672694199051165,-1.5460010735471215e-5,3.3565118674225895e-9,0.003767677144880793,-1.5423844881946676e-5,3.285127707090549e-9,0.0037681108405431198,-1.5308808573030386e-5,3.0649759961602738e-9,0.00376853909328297,-1.5105335091860154e-5,2.678249819012819e-9,0.0037689267978603287,-1.4819271966290807e-5,2.1362017496681052e-9,0.0037692419464796334,-1.4474679157593949e-5,1.4843891964449467e-9,0.003769464408607395,-1.4112525842013234e-5,8.001758661740843e-10,0.0037695940570376656,-1.3783562552421724e-5,1.7924187200268179e-10,0.003769654513644912,-1.3535943066435279e-5,-2.877953882684514e-10,0.003769689655352273,-1.3401132828683478e-5,-5.419454827697908e-10,0.0037697528877103145,-1.3383352936094304e-5,-5.756719343471206e-10,0.0037698924838657317,-1.3456848768446041e-5,-4.379133873754168e-10,0.0037701379529232566,-1.3572133855236433e-5,-2.2219011005250034e-10,0.0037704917152187136,-1.36690613658659e-5,-4.190341608565942e-11,0.003770928286669406,-1.3692704936665648e-5,-4.184426881656405e-13,0.003771400984222682,-1.360764722503169e-5,-1.6419689144365008e-10,0.0037718542846100875,-1.3406801484918508e-5,-5.462400593197952e-10,0.0037722383742051645,-1.3112239502991186e-5,-1.1045888736203505e-9,0.0037725215280944423,-1.2767820548965187e-5,-1.756277314541145e-9,0.003772696517123917,-1.2426225277517897e-5,-2.4018373226817705e-9,0.003772779492258509,-1.2135018031827889e-5,-2.9516198186066968e-9,0.0037728027992608884,-1.1926333275018554e-5,-3.345233937647147e-9,0.003772805248437262,-1.1812618336310583e-5,-3.559509949169215e-9,0.0037728234022769208,-1.1787985186950563e-5,-3.605855082757096e-9,0.003772885871274732,-1.1832888997680663e-5,-3.5213519611769673e-9,0.0037730107830056705,-1.1919671821302818e-5,-3.3582733409701644e-9,0.0037732054834411486,-1.201738319949041e-5,-3.1750111515168823e-9,0.0037734672788120238,-1.2095393134790393e-5,-3.029308059715573e-9,0.0037737843623683997,-1.2126141515841897e-5,-2.9731078275435696e-9,0.0037741366633792803,-1.2087713479066177e-5,-3.0477005332985616e-9,0.0037744969434948855,-1.1966854684521575e-5,-3.2780044851181107e-9,0.0037748329505799573,-1.1762652811277419e-5,-3.665584516120736e-9,0.0037751117090649177,-1.1490296257088035e-5,-4.1815534879312055e-9,0.003775306671071242,-1.1183066734645489e-5,-4.762857357367671e-9,0.0037754069823609203,-1.0889694911885241e-5,-5.3173572358538974e-9,0.0037754256798606545,-1.0664706834353456e-5,-5.742147928915882e-9,0.003775401726689244,-1.0552455653838138e-5,-5.953742048116789e-9,0.003775391866454253,-1.0570337492320954e-5,-5.9196954740658214E-09,0.0037754533346908404,-1.069965404964022e-5,-5.6757115830877735e-9,0.0037756245234761812,-1.0889973474384802e-5,-5.3172574611983255e-9,0.0037759125769722722,-1.1075505491388981e-5,-4.9685789284492975e-9,0.0037762927653174714,-1.119569145297422e-5,-4.743856103245313e-9,0.0037767180710236953,-1.1211551456236634e-5,-4.716422581730153e-9,0.0037771336262513635,-1.1113289439129748e-5,-4.904484620551893e-9,0.0037774906920141566,-1.0919093669290008e-5,-5.273435637376515e-9,0.0037777568305629415,-1.0667562119560446e-5,-5.750186818487831e-9,0.0037779208867569462,-1.0406866195721732e-5,-6.243650787702565e-9,0.003777992767016646,-1.018352746019933e-5,-6.665958168127169e-9,0.0037779989182269913,-1.0033140590648544e-5,-6.949989656900959e-9,0.0037779751011073896,-9.97469904417571e-6,-7.060078675057539e-9,0.0037779584786724603,-1.0009194292538516e-5,-6.994608417451776e-9,0.0037779809048557934,-1.0121958368840203e-5,-6.781516708789922e-9,0.0037780645720082466,-1.0287344353781977e-5,-6.469394097223917e-9,0.003778220234630747,-1.047413085648688e-5,-6.1172540917545026e-9,0.003778447456985994,-1.0650388607779883e-5,-5.785368244403539e-9,0.003778735979536752,-1.078723859059365e-5,-5.528224279977244e-9,0.0037790674522738318,-1.086163687447547e-5,-5.3893085312301e-9,0.0037794172242492487,-1.0858682366088469e-5,-5.396741791551607e-9,0.003779756331525049,-1.0773944571270184e-5,-5.55883105247937e-9,0.0037800542820276006,-1.0616049404699768e-5,-5.859127603922072e-9,0.0037802835715694304,-1.0409041615552987e-5,-6.251958361016585e-9,0.0037804265587483227,-1.019284428731572e-5,-6.661632999833887e-9,0.0037804839392265306,-1.0019107510829138e-5,-6.990419724209726e-9,0.003780481632655872,-9.940027335123063e-6,-7.139785874260027e-9,0.003780470551458204,-9.990760852975178e-6,-7.043636122099973e-9,0.0037805145003715693,-1.0171924492472818e-5,-6.701260118724001e-9,0.0037806679024364473,-1.0443026877787217e-5,-6.189548974586507e-9,0.003780953749669685,-1.0734040814978671e-5,-5.640990002948598e-9,0.003781354446672115,-1.0970848138577473e-5,-5.195569712053512e-9,0.0037818202123343133,-1.1100878236964057e-5,-4.952398320323635e-9,0.0037822885451625726,-1.1106690075405191e-5,-4.9441331682067115e-9,0.0037827037918562686,-1.1004732221553931e-5,-5.139393429677356e-9,0.003783029580921028,-1.083450210581651e-5,-5.463297256101165e-9,0.0037832528926456414,-1.0645014240624529e-5,-5.8230619263333884E-09,0.003783382008619057,-1.0483107839539345e-5,-6.130107278142606e-9,0.0037834411521074293,-1.0385293670330903e-5,-6.315462602182711e-9,0.003783463866855065,-1.0373167422302901e-5,-6.338434431871988e-9,0.003783486346677699,-1.0451924135314523e-5,-6.1894075059543604e-9,0.0037835415059761126,-1.0611498941792025e-5,-5.887657773983901e-9,0.0037836543994592214,-1.0829747870240204e-5,-5.475280541301254e-9,0.0037838393893894684,-1.1076912436351042e-5,-5.00868499477498e-9,0.0037840991940355684,-1.1320547095963303e-5,-4.549244861849569e-9,0.0037844256115939245,-1.1530111692398709e-5,-4.154636535393267e-9,0.003784801380528869,-1.168067724546158e-5,-3.871892905681978e-9,0.0037852026131201958,-1.1755664641185652e-5,-3.732277813199833e-9,0.0037856015155439153,-1.1748839795853997e-5,-3.747515652641209e-9,0.003785969367532291,-1.166580442859177e-5,-3.906921033511718e-9,0.00378628001510182,-1.1525110745466617e-5,-4.175235589964458e-9,0.003786514449205436,-1.1358637205725354e-5,-4.491921267897067e-9,0.0037866667919770496,-1.1209875032777431e-5,-4.774493370527981e-9,0.0037867507548969247,-1.1128029735137191e-5,-4.929817589830909e-9,0.0037868036489551913,-1.1156279232741838e-5,-4.8764159931144795e-9,0.0037868831215570773,-1.1315159538627571e-5,-4.575860551166065e-9,0.0037870524179700496,-1.1587432273622035e-5,-4.061235434398263e-9,0.0037873563096598654,-1.1915434657407038e-5,-3.441960618087722e-9,0.0037877994416602927,-1.2218268853877623e-5,-2.871179678081107e-9,0.00378834159065941,-1.2422814649923206e-5,-2.4871089224278254e-9,0.0037889140278449785,-1.249102829822317e-5,-2.361451809750297e-9,0.0037894464319104034,-1.2428832387716597e-5,-2.4826372919214795e-9,0.003789888854569995,-1.2276000741283246e-5,-2.775033513542293e-9,0.003790220598166225,-1.2087372015433666e-5,-3.13458685349092e-9,0.003790447689810322,-1.1915907774812648e-5,-3.4609407828149515e-9,0.0037905948035725874,-1.1802236082212254e-5,-3.6772233896817644e-9,0.003790696401172688,-1.1770385986698964e-5,-3.73808626895047e-9,0.003790789335206898,-1.1827575732369238e-5,-3.6300747743801807e-9,0.003790907337032187,-1.1966138926110403e-5,-3.3679632150517645e-9,0.0037910770946163676,-1.2166553303929558e-5,-2.9889909055131355e-9,0.0037913156361942314,-1.2401135693384962e-5,-2.545809144827838e-9,0.0037916289168516333,-1.263815898674036e-5,-2.0986190900712304e-9,0.0037920116463947694,-1.2846175399722612e-5,-1.7069510131467538e-9,0.0037924484233062025,-1.299819527970367e-5,-1.4217770124520617e-9,0.0037929160329965078,-1.3075228465631499e-5,-1.2788768709480869e-9,0.0037933865555892653,-1.3068858631174979e-5,-1.294030013439374e-9,0.0037938309814365434,-1.2982776331081918e-5,-1.4601266957738199e-9,0.0037942231481280977,-1.283322743822306e-5,-1.7462770627408988e-9,0.003794543866539171,-1.2648304256008901e-5,-2.0991058430070644e-9,0.003794785242433129,-1.2465858940810928e-5,-2.4467144889246194e-9,0.0037949550625008244,-1.232927438422763e-5,-2.7067816859225326e-9,0.003795080187817642,-1.2279927284374798e-5,-2.8009626097236014e-9,0.0037952065161867134,-1.2345871523227187e-5,-2.6763892980301933e-9,0.0037953921373555235,-1.2528542983790664e-5,-2.3307936469979733e-9,0.0037956913857025054,-1.2793157015980988e-5,-1.8305356927816436e-9,0.003796132776286854,-1.3071563213552118e-5,-1.3050406169510527e-9,0.0037967017325761278,-1.328280143626571e-5,-9.077926254452141e-10,0.0037973411548898497,-1.3364516232244082e-5,-7.568234874396928e-10,0.0037979727650269374,-1.3297561018064426e-5,-8.881042448926196e-10,0.003798527090663047,-1.3109356495992466e-5,-1.2492122368724608e-9,0.003798964917021712,-1.28570520619648e-5,-1.7313517826797332e-9,0.0037992820034057637,-1.2603783737617608e-5,-2.2145093402545987e-9,0.003799500926082306,-1.240063635168012e-5,-2.6017407417391375e-9,0.0037996585584883936,-1.2278587025970907e-5,-2.8344302677579545e-9,0.0037997952173949366,-1.2248205620853774e-5,-2.892780987975255e-9,0.0037999474748775944,-1.2303191954665917e-5,-2.789037696090718e-9,0.003800144171209063,-1.2424890429828608e-5,-2.5588855394347242e-9,0.0038004044225855666,-1.2586549203308632e-5,-2.2533402981175947e-9,0.003800736709459013,-1.2757180681021012e-5,-1.9313801867040904e-9,0.0038011386726849684,-1.2905234943333781e-5,-1.6529274004774604e-9,0.0038015976307220777,-1.300228941643676e-5,-1.4718298071475957e-9,0.0038020920655212837,-1.3026745702081325e-5,-1.4288825387251392e-9,0.0038025942999659027,-1.2967137471847075e-5,-1.5456250913598982e-9,0.0038030742779153713,-1.2824453504739554e-5,-1.8199956009474816e-9,0.0038035040835843223,-1.2613005619355985e-5,-2.224696148359336e-9,0.003803862725819495,-1.2359515273662385e-5,-2.7088896073266286e-9,0.0038041406058219682,-1.210021971862752e-5,-3.203654961905564e-9,0.003804343039903815,-1.187601536262798e-5,-3.6312222314006306e-9,0.0038044921992625045,-1.172572264151848e-5,-3.9178384073525195e-9,0.00380462650870891,-1.1677577510893996e-5,-4.010014190249887e-9,0.0038047960105914956,-1.1739750231113836e-5,-3.892553967922982e-9,0.0038050522524015824,-1.1892359741202971e-5,-3.603641811340095e-9,0.0038054328722651374,-1.2085474055587181e-5,-3.238495369877979e-9,0.003805944893983198,-1.224821847258572e-5,-2.931950879082715e-9,0.003806555314129275,-1.2310374852742212e-5,-2.8173999266934114e-9,0.003807197680863527,-1.2229146407934576e-5,-2.9759540232212596e-9,0.0038077950074467274,-1.2006673466743497e-5,-3.4031768325958983e-9,0.003808287639007238,-1.1687444632760447e-5,-4.014049779331443e-9,0.003808650970431554,-1.1338022030420527e-5,-4.681632012604156e-9,0.003808896131037573,-1.1022265614456972e-5,-5.284306129734353e-9,0.0038090582406506883,-1.0784417102233183e-5,-5.738002868905132e-9,0.0038091815513970188,-1.0643809594594406e-5,-6.006202185145872e-9,0.003809307974440942,-1.0597903969188504e-5,-6.094047127429888e-9,0.0038094707196667066,-1.062865600428072e-5,-6.036147477861492e-9,0.0038096919065528753,-1.070881560223071e-5,-5.8845641294033734e-9,0.003809982306819115,-1.0806887438420577e-5,-5.699365884995947e-9,0.003810341878982876,-1.0890883083801036e-5,-5.541482188826337e-9,0.003810760558410313,-1.0931470433055232e-5,-5.466698369518253e-9,0.003811219360612792,-1.0905036479831683e-5,-5.5198308461602985e-9,0.003811692191355198,-1.0796853778255012e-5,-5.728734249431048e-9,0.0038121488378866334,-1.0604042188757008e-5,-6.098714331775193e-9,0.0038125593293713445,-1.0337543772812268e-5,-6.608803289335694e-9,0.003812899313522184,-1.0022178567600895e-5,-7.211652084835195e-9,0.003813155569947561,-9.694053505107579e-6,-7.838435889364233e-9,0.003813330410478557,-9.395101236701062e-6,-8.409236512806301e-9,0.0038134436413059824,-9.165292526420089e-6,-8.847896464769259e-9,0.0038135310890633975,-9.033789295919845e-6,-9.098924795496566e-9,0.0038136392405932478,-9.010703935907942e-6,-9.143237881021444e-9,0.0038138161247166904,-9.081404582108e-6,-9.008993457535895e-9,0.003814099382214336,-9.205645720023213e-6,-8.773169562587337e-9,0.0038145038512597245,-9.323767143029389e-6,-8.549656250554983e-9,0.003815012795942145,-9.370894020933878e-6,-8.462137200027408e-9,0.0038155779477628124,-9.29673571143693E-06,-8.606350895718982e-9,0.0038161315938342274,-9.08397255339519e-6,-9.015063906599803e-9,0.0038166080185463146,-8.755923206484596e-6,-9.64348405426532e-9,0.003816965037754244,-8.368207760136484e-6,-1.0385219024877421e-8,0.003817195248806939,-7.988222530295059e-6,-1.1111520776134655e-8,0.0038173229340541176,-7.673167559394442e-6,-1.1713278449963451e-8,0.0038173910001939285,-7.456361956860252e-6,-1.212711923818663e-8,0.0038174460930694254,-7.344703089557365e-6,-1.234016488954878e-8,0.0038175278039535875,-7.323953104584782e-6,-1.2379836417372083e-8,0.00381766349450458,-7.3667834734719346E-06,-1.2298441630227018e-8,0.003817867345920316,-7.44006181186134e-6,-1.2159268639340678e-8,0.003818141527292887,-7.510114938000029e-6,-1.2026573341010378e-8,0.003818477933177015,-7.546220680736763e-6,-1.1958946292781465e-8,0.003818859819405176,-7.523169308927341e-6,-1.2004439996582582e-8,0.0038192634063506886,-7.4236603910782554e-6,-1.2196000644852678e-8,0.0038196599709800997,-7.2408663983656445e-6,-1.254657877456703e-8,0.003820019070571289,-6.980898470168708e-6,-1.3044426574530458e-8,0.0038203132898458427,-6.664287919255013e-6,-1.3650268900585339e-8,0.0038205242460868597,-6.325154432293589e-6,-1.4298887743684189e-8,0.0038206486164603457,-6.006817141678243e-6,-1.4907506500728048e-8,0.0038207020750147184,-5.75354803338733e-6,-1.5391558345619086e-8,0.0038207189146382747,-5.599839594091006e-6,-1.568521212544733e-8,0.0038207461938191602,-5.560151445206347e-6,-1.5760970711142652e-8,0.00382083315281559,-5.622636517693993e-6,-1.5641635859755003e-8,0.003821018492077559,-5.749455228146534e-6,-1.5399662200224305e-8,0.0038213190875863523,-5.884391306755396e-6,-1.5142562499287096e-8,0.0038217235693960125,-5.966361142703782e-6,-1.4987076158289204e-8,0.0038221931563597426,-5.9456270845393625e-6,-1.502819170366169e-8,0.0038226704818977797,-5.798272337779563e-6,-1.531149257821805e-8,0.0038230947974088572,-5.5340664292121286e-6,-1.581812655956149e-8,0.0038234191450172406,-5.194116998158923e-6,-1.6469310260958883e-8,0.003823623312951976,-4.838285790666961e-6,-1.7150435861376128e-8,0.0038237175482825378,-4.526986941152714e-6,-1.7745939341755873e-8,0.0038237362016777052,-4.3046651521168036e-6,-1.8170927741837015e-8,0.003823725137708133,-4.1908453164058315e-6,-1.8388262055022257e-8,0.003823728754133948,-4.180212251173304e-6,-1.8408322336149633e-8,0.0038237809830387044,-4.2490079943162265e-6,-1.8276693046141356e-8,0.0038239015028385787,-4.363551982793333e-6,-1.8057833412152605e-8,0.003824095946593768,-4.487740674388706e-6,-1.7820751134813358e-8,0.003824358126063857,-4.588281903972761e-6,-1.7629039709488436e-8,0.0038246727136478013,-4.637862217435199e-6,-1.753487003336477e-8,0.003825017627068585,-4.61711276381841e-6,-1.7575256806811815e-8,0.003825366118825118,-4.516259894351772e-6,-1.7768895996776932e-8,0.0038256891088083935,-4.336919177129825e-6,-1.8112701958105336e-8,0.0038259584950023394,-4.093846046758095e-6,-1.8578421203903003e-8,0.00382615197722384,-3.815735474025295e-6,-1.9111084395452904e-8,0.0038262592364493595,-3.543489200549398e-6,-1.963234108463913e-8,0.0038262880282502877,-3.3242349858685718e-6,-2.005195595532296e-8,0.0038262672917729517,-3.200584377536259e-6,-2.0288421016364784e-8,0.0038262439982333636,-3.197318624244381e-6,-2.029444817156697e-8,0.003826272400189211,-3.3105522427901474e-6,-2.0077656752741834e-8,0.0038263982363601133,-3.505059768382942e-6,-1.9705603558615896e-8,0.003826643866615569,-3.7224637285441357e-6,-1.929005491723827e-8,0.003827000550067141,-3.897808129259171e-6,-1.8955276671465806e-8,0.0038274307773840765,-3.9781801362031975e-6,-1.8802446818552187e-8,0.0038278791501668245,-3.936838386802747e-6,-1.8882656721060616e-8,0.003828287511464482,-3.7789936758587133e-6,-1.91858484343628e-8,0.003828609599833306,-3.538639788532877e-6,-1.9646859993872794e-8,0.0038288214789188135,-3.2682591437941436e-6,-2.01651251887211e-8,0.0038289254924217973,-3.0247269062595245e-6,-2.0631684713590868e-8,0.0038289472814131997,-2.855414110560565e-6,-2.0955834728401942e-8,0.0038289273259179074,-2.788188187669053e-6,-2.108429624581785e-8,0.0038289100096469695,-2.827593307999e-6,-2.100851341943847e-8,0.0038289336504991763,-2.957270847791984e-6,-2.0759969177050435e-8,0.0038290239989857604,-3.1466075062872564e-6,-2.0397397678011425e-8,0.0038291919363631554,-3.358735621529485e-6,-1.9991428033826533e-8,0.0038294345412146105,-3.5575484015966483e-6,-1.9611153660184545e-8,0.0038297379974115684,-3.7126062375014595e-6,-1.931477643950267e-8,0.0038300809546290265,-3.8019422327944494e-6,-1.9144289526878937e-8,0.003830437556664625,-3.813471476213471e-6,-1.9122815383613343e-8,0.0038307800423785735,-3.7458453013279217e-6,-1.925296167705247e-8,0.0038310813355700818,-3.6092600087004904e-6,-1.951522260747604e-8,0.003831318289772106,-3.4261620143933223e-6,-1.9866570427390518e-8,0.0038314761727888578,-3.2310651372663914e-6,-2.024078705408704e-8,0.003831554328173983,-3.067891478985199e-6,-2.0553606536838275e-8,0.00383157155253598,-2.9829338185445362e-6,-2.071629056719002e-8,0.0038315679388297268,-3.0127134004410304e-6,-2.0658964500687748e-8,0.0038315991481782685,-3.1692879484097765e-6,-2.0358751628086406e-8,0.0038317214021556132,-3.429727904878386e-6,-1.9859827008455862e-8,0.0038319713636641617,-3.7377031114383478e-6,-1.9270251199510938e-8,0.003832350581616624,-4.0199454376947184e-6,-1.8730381252591345e-8,0.003832823444733821,-4.211063811726861e-6,-1.8365375552540856e-8,0.0038333298168283644,-4.2746105018214276e-6,-1.82449115700899e-8,0.0038338051698647065,-4.211439514210527e-6,-1.8367216874901712e-8,0.003834198761806769,-4.0546278942909735e-6,-1.8668806860764246e-8,0.003834484151940069,-3.856273197654131e-6,-1.9049773936193798e-8,0.0038346613147808603,-3.6724518049993973e-6,-1.940260611015573e-8,0.0038347524550533677,-3.550605899014387e-6,-1.9636361789940677e-8,0.0038347942577808274,-3.52127028068912e-6,-1.969253972068335e-8,0.0038348288874075678,-3.5944825007219915e-6,-1.9551978029488838e-8,0.0038348954913967792,-3.7604912766397788e-6,-1.9233502467926943e-8,0.0038350235792819626,-3.9939514459539405e-6,-1.8785861778853742e-8,0.0038352291926199416,-4.260277158951203e-6,-1.8275496622939114e-8,0.003835514073341714,-4.522523088560736e-6,-1.7773291753942183e-8,0.0038358673369616493,-4.7473979554075516E-06,-1.7343025332758908e-8,0.0038362687210526454,-4.9095732722181525e-6,-1.7033139263666595e-8,0.00383669236799276,-4.99408908331157e-6,-1.6872194841765404e-8,0.003837110381916312,-4.997253315309627e-6,-1.6867206012024054e-8,0.0038374959397268127,-4.926686817006647e-6,-1.7003556999435392e-8,0.003837826168240292,-4.800973729438346e-6,-1.724561889505605e-8,0.0038380852198412027,-4.64897087800454e-6,-1.7538006826362915e-8,0.0038382680055769084,-4.508244405378731e-6,-1.780856000998818e-8,0.0038383845372422826,-4.4213473667315845e-6,-1.7975542156029803e-8,0.0038384635487548452,-4.428331072852901e-6,-1.7962111992879813e-8,0.003838552412999034,-4.554891468079644e-6,-1.7719129920892407e-8,0.003838709449637709,-4.79857611780019e-6,-1.7251579776228027e-8,0.003838986727658379,-5.120008018211622e-6,-1.6635275122453434e-8,0.0038394080255532118,-5.448208410521412e-6,-1.6006525398447498e-8,0.0038399539523913803,-5.703228860578149e-6,-1.5518689679738132e-8,0.003840565607656355,-5.826728491288216e-6,-1.5283563189269852e-8,0.0038411666084649057,-5.803303992373885e-6,-1.5330502316579828e-8,0.003841690669226006,-5.6615015185918996e-6,-1.5604511736937722e-8,0.0038421002535852433,-5.457713918832178e-6,-1.5997183329700725e-8,0.0038423907809453407,-5.254822630049416e-6,-1.6387728287251544e-8,0.003842584084612968,-5.1054363205735894e-6,-1.6675159725889587e-8,0.0038427176193724898,-5.043044755021766e-6,-1.6795248365588627e-8,0.003842834018332966,-5.07989312250766e-6,-1.6724578044920652e-8,0.003842972942410085,-5.209054269116863e-6,-1.6476567824802356e-8,0.0038431654789848045,-5.4086399567047076e-6,-1.60933997922233e-8,0.00384343077449617,-5.647036470412883e-6,-1.563595510392797e-8,0.00384377466746861,-5.888566057774086e-6,-1.5172890552403953e-8,0.003844190175581018,-6.098988812967744e-6,-1.477000694122479e-8,0.0038446595948861905,-6.250255466342545e-6,-1.4481091439427506e-8,0.003845157818995818,-6.324023724179862e-6,-1.4341201409106802e-8,0.0038456562996112983,-6.313615647304992e-6,-1.4362989566193652e-8,0.003846127011783707,-6.224437602563978e-6,-1.4535971378501742e-8,0.003846546039512686,-6.073206328661482e-6,-1.4828020425045514e-8,0.0038468967151338742,-5.886318244836747e-6,-1.518844046641186e-8,0.0038471724104394123,-5.6974965543184785e-6,-1.5552409101517088e-8,0.0038473791476006172,-5.544524492413738e-6,-1.5847232591313744e-8,0.0038475379016441485,-5.464345014145458e-6,-1.6001824499551356e-8,0.0038476855030219305,-5.485613097100651e-6,-1.596112434254084e-8,0.003847871879727775,-5.6186931393504005e-6,-1.5705383768277254e-8,0.0038481508803807564,-5.845389848453475e-6,-1.526986177286528e-8,0.003848563503714657,-6.114171536753636e-6,-1.4753886498476955e-8,0.0038491178160156275,-6.348715588209728e-6,-1.4304328128888127e-8,0.0038497770085141143,-6.472740813382431e-6,-1.4067840281603289e-8,0.0038504673064347367,-6.441502007513236e-6,-1.4130328256331074e-8,0.0038511053849232322,-6.261082594443713e-6,-1.4479857491646347e-8,0.003851629844832358,-5.983091492067725e-6,-1.5016874116127136e-8,0.003852018859395578,-5.680152288202065e-6,-1.5601434430578248e-8,0.0038522882875718684,-5.418923444947771e-6,-1.6105201466218447e-8,0.0038524776393092323,-5.243503092060938e-6,-1.644339124890214e-8,0.0038526343526436983,-5.171293042120779e-6,-1.658266798991624e-8,0.0038528022610099396,-5.196803821713961e-6,-1.6533754071038998e-8,0.003853015203081441,-5.2983925912731155e-6,-1.6338444310091512e-8,0.003853294442269686,-5.444945618229092e-6,-1.6056762373860484e-8,0.0038536482567425854,-5.601504835855946e-6,-1.5756133822008962e-8,0.0038540726814287585,-5.7339517789242305e-6,-1.550233250246981e-8,0.0038545530770026947,-5.813032433141409e-6,-1.535167747524828e-8,0.003855066511348219,-5.817774971569551e-6,-1.5344433001374196e-8,0.0038555849763886965,-5.738119863076067e-6,-1.5499788248752717e-8,0.0038560793166990247,-5.576384824864866e-6,-1.5813120373490353e-8,0.0038565234608473496,-5.347216994734051e-6,-1.6256150387493468e-8,0.0038568984147355433,-5.075979025649893e-6,-1.678004601450871e-8,0.00385719557764678,-4.795731754718215e-6,-1.7321162029551486e-8,0.0038574190570229696,-4.543041028615571e-6,-1.780903983008837e-8,0.003857586762326891,-4.352859428110214e-6,-1.817625138390654e-8,0.003857730049101876,-4.252572787910336e-6,-1.8369938134093778e-8,0.0038578912513364937,-4.255213948707043e-6,-1.8364992404288677e-8,0.003858117874957074,-4.3525404651654585e-6,-1.8177456727680517e-8,0.003858452354547486,-4.510210597999658e-6,-1.7873784612501723e-8,0.003858917791777117,-4.669051428707108e-6,-1.756829129472984e-8,0.003859503672194377,-4.756979406824098e-6,-1.7400082133742694e-8,0.003860160107605068,-4.712384004790362e-6,-1.7487936966225806e-8,0.0038608091664962376,-4.510570068775836e-6,-1.7879323414882926e-8,0.003861372398538454,-4.177424357879907e-6,-1.8524047943606895e-8,0.003861800506333025,-3.7795425476321384e-6,-1.9293349565570984e-8,0.0038620880164654562,-3.396288792625095e-6,-2.0033913711143205e-8,0.003862267166860147,-3.0911799396654256e-6,-2.062317555474824e-8,0.0038623893494130436,-2.8966628210158406e-6,-2.099867596807234e-8,0.003862506563495998,-2.8140990119499413e-6,-2.115798768293966e-8,0.0038626598321244918,-2.822389550608056e-6,-2.114198102596278e-8,0.003862874873005275,-2.8882527356427605e-6,-2.1014973901108832e-8,0.003863162336153394,-2.9744902195046028e-6,-2.0848814677809523e-8,0.0038635199304515298,-3.045533830271848e-6,-2.0712205478631623e-8,0.0038639348992436243,-3.0710234770790767e-6,-2.066378398501029e-8,0.0038643864355204357,-3.028367117469868e-6,-2.0747147455070232e-8,0.00386484822728367,-2.904831494192115e-6,-2.0986801911394604e-8,0.0038652914752601592,-2.699236644680084e-6,-2.1384920240420773e-8,0.003865688624510196,-2.4228755743300013e-6,-2.191962018272638e-8,0.00386601767419727,-2.0990064949875313e-6,-2.2545976090700474e-8,0.003866266452299767,-1.760409030734062e-6,-2.3200715561079226e-8,0.0038664359843247702,-1.4449098341719433e-6,-2.3810796904036255e-8,0.0038665420780329414,-1.1892409375748905e-6,-2.4305217895457498e-8,0.003866614450261009,-1.0220808697119544e-6,-2.4628464023641513e-8,0.0038666931331427633,-9.574329517630934e-7,-2.4753373068809092e-8,0.00386682224894407,-9.894664267422647e-7,-2.469119648990868e-8,0.0038670414158975728,-1.0900193002419434e-6,-2.449647640784153e-8,0.0038673755149895308,-1.2103925169421118e-6,-2.4263553007702945e-8,0.0038678247276590877,-1.2892296045959293e-6,-2.4111252377403624e-8,0.003868358444959499,-1.267252656795297e-6,-2.4154311249935473e-8,0.0038689178723244452,-1.106609395965305e-6,-2.446591385034712e-8,0.0038694306364283385,-8.077989637281885e-7,-2.504494355576824e-8,0.0038698345342124824,-4.141703486132289e-7,-2.5807311711834674e-8,0.003870099809101716,1.7314109784301966e-9,-2.661245619101961e-8,0.0038702378083155316,3.6458720020279093e-7,-2.7314567339474627e-8,0.0038702920854368386,6.214663267685033e-7,-2.7811317375819918e-8,0.0038703190910244194,7.53858335647063e-7,-2.8067074676155508e-8,0.00387036974897286,7.748010931081934e-7,-2.8107228302703305e-8,0.0038704788581488724,7.175311052953002e-7,-2.7996153658333026e-8,0.0038706626331334653,6.232083040671878e-7,-2.781347285744613e-8,0.0038709211656908133,5.318687125353667e-7,-2.7636609917695287e-8,0.003871242513436442,4.772284502188831e-7,-2.753078648423058e-8,0.003871606525933271,4.841804967947889e-7,-2.754418615260003e-8,0.0038719879135084533,5.675785755217659e-7,-2.7705577960566147e-8,0.003872358880346966,7.314004543716178e-7,-2.8022675148351287e-8,0.0038726919022138077,9.680249185641712e-7,-2.8480732932027746e-8,0.003872963138652044,1.2579586782204766e-6,-2.9042030043767234e-8,0.00387315657601737,1.5708285211382788e-6,-2.9647789466682646e-8,0.0038732683373289547,1.86855923238929e-6,-3.0224309921934445e-8,0.0038733099271485473,2.1112153111972303e-6,-3.069424612561177e-8,0.003873308852725411,2.2650543922665764e-6,-3.0992188082449424e-8,0.0038733053736022243,2.3111642765606837e-6,-3.108140596859698e-8,0.003873345192169577,2.2521788410355123e-6,-3.0966904370240415e-8,0.0038734693367986866,2.1146262125177263e-6,-3.0700024716839653e-8,0.003873703593536369,1.9454980220390796e-6,-3.037183659191588e-8,0.0038740502205765353,1.8030645268901052e-6,-3.009534652539585e-8,0.003874484463380578,1.7433559304306285e-6,-2.997927136727451e-8,0.003874957745425761,1.805067475563303e-6,-3.009872427079351e-8,0.0038754081819814224,1.9969121911983876e-6,-3.0470633717663e-8,0.0038757768904046563,2.2921729176794824e-6,-3.104314330933098e-8,0.0038760255596562514,2.6342273406501153e-6,-3.1706344087442033e-8,0.003876148467003275,2.953007064522305e-6,-3.232426651598912e-8,0.003876173208269964,3.1867247516892045e-6,-3.2777089184574225e-8,0.0038761496228379723,3.299682974732298e-6,-3.2995681880150156e-8,0.0038761325461103228,3.2890272755367357e-6,-3.297463097922817e-8,0.003876166403606068,3.179714693762658e-6,-3.276239593634084e-8,0.003876276896591104,3.0126859225590633e-6,-3.243833774524097e-8,0.0038764701624275557,2.8325579269208208e-6,-3.208888404389721e-8,0.0038767365992111737,2.6787515873070964e-6,-3.1790385133102694e-8,0.003877056148306675,2.580816495240054e-6,-3.160009687833867e-8,0.003877403029010765,2.556826343211539e-6,-3.1553084495681475e-8,0.0038777493008821016,2.613289973686861e-6,-3.166203618942354e-8,0.0038780675614554605,2.745446505360736e-6,-3.191780672517262e-8,0.003878333476381656,2.937524412643369e-6,-3.2289889347489e-8,0.0038785287779384415,3.1632353044676755e-6,-3.2727348319001116e-8,0.0038786449743421613,3.38733667833281e-6,-3.3161835770498974e-8,0.0038786873128192818,3.569409484611795e-6,-3.351491898098499e-8,0.003878677591593657,3.6707118908738144e-6,-3.371139093728882e-8,0.003878653651155005,3.663736005572876e-6,-3.369782934114989e-8,0.003878663611183559,3.5420997935283253e-6,-3.346179770353897e-8,0.003878754731082063,3.3267106762652564e-6,-3.304380167421774e-8,0.003878959662882301,3.0642480397399228e-6,-3.2534349810315585e-8,0.0038792851193151815,2.8166766000497898e-6,-3.2053637071171815e-8,0.003879707781335941,2.644580007151263e-6,-3.171924924585675e-8,0.003880179414535661,2.590044261113597e-6,-3.161296170025512e-8,0.003880639462395093,2.664856929841553e-6,-3.175779169109812e-8,0.003881030963909623,2.847441295081661e-6,-3.211196330829822e-8,0.003881315132026455,3.088989773401876e-6,-3.258074793403881e-8,0.003881480673019954,3.3267950065992406e-6,-3.304234350010906e-8,0.0038815453906210946,3.500934082932849e-6,-3.33803219040278e-8,0.0038815497710628015,3.5694288741531944e-6,-3.3513127109619604e-8,0.003881544796778198,3.5173837589184617e-6,-3.341184114435914e-8,0.003881578212321525,3.3577257039687044e-6,-3.310159999772678e-8,0.0038816837406748395,3.1243817248589497e-6,-3.264830861127478e-8,0.0038818760151617553,2.8614164265762064e-6,-3.213752525507882e-8,0.0038821512694009203,2.612341272483004e-6,-3.165370238768937e-8,0.0038824917692874394,2.4124461107722537e-6,-3.1265314802538124e-8,0.003882871480346175,2.2849072067360234e-6,-3.1017329356398934e-8,0.0038832611824149987,2.2398928027330586e-6,-3.0929494207351274e-8,0.0038836323245214632,2.275318774487282e-6,-3.099781618751069e-8,0.0038839597921307414,2.378108423025778e-6,-3.119699030134757e-8,0.0038842242152507703,2.5254286212354412e-6,-3.148275781095068e-8,0.0038844144663355965,2.686059250390416e-6,-3.179451894543604e-8,0.0038845306688387576,2.822639547206788e-6,-3.2059675183163195e-8,0.003884587357003466,2.8959475224504465e-6,-3.220196455639171e-8,0.0038846153737523,2.8722310269464106e-6,-3.21557550736718e-8,0.003884660056959134,2.7333387608771316e-6,-3.18857668919105e-8,0.0038847732762158013,2.4869046599035173e-6,-3.1406851357082614e-8,0.0038849991252745794,2.1712642698410145e-6,-3.0793495921892944e-8,0.0038853574442500984,1.8496451423368823e-6,-3.016850650976043e-8,0.0038858330515733975,1.5925789224385644e-6,-2.9668865383990577e-8,0.003886377556622482,1.4547566015723252e-6,-2.940082528056271e-8,0.0038869241473787107,1.4569552475180457e-6,-2.9404819127186324e-8,0.0038874085176017156,1.5809669809562609e-6,-2.9645564220367717e-8,0.003887786800305342,1.7780034980890623e-6,-3.002832302171855e-8,0.0038880447159318995,1.9850173646662214e-6,-3.0430573951043864e-8,0.0038881971924163384,2.1420596256770285e-6,-3.073574438290413e-8,0.003888280961175994,2.205781072292864e-6,-3.085948449380518e-8,0.0038883435694981065,2.1568374784550173e-6,-3.076410840731744e-8,0.0038884319296096136,2.0009593416802778e-6,-3.0460718017368735e-8,0.00388858281744708,1.7646673454508626e-6,-3.000089846925649e-8,0.003888816937092785,1.487387634284406e-6,-2.9461380448588014e-8,0.003889137213009564,1.2122368285186793e-6,-2.8926083312790018e-8,0.0038895308769200843,9.77741933194379e-7,-2.8469964105098837e-8,0.0038899740437511265,8.120453633245923e-7,-2.81477220260484e-8,0.003890437171818333,7.300902557734322e-7,-2.7988343358411724e-8,0.0038908900772970704,7.333723847624609e-7,-2.7994672649499975e-8,0.0038913058202770783,8.11313345377628e-7,-2.8146131740211625e-8,0.003891663485624368,9.432958331578632e-7,-2.8402680159512044e-8,0.0038919502946732623,1.1008399990349611e-6,-2.8708996787877187e-8,0.0038921635340459903,1.2499486900889057e-6,-2.8998973546822423e-8,0.0038923125934744473,1.3541502616078596e-6,-2.9201603267134142e-8,0.0038924208408559866,1.379197734291158e-6,-2.9250157793629576e-8,0.0038925260361622285,1.3003034856014153e-6,-2.909634192665132e-8,0.0038926769630940033,1.1115916402400212e-6,-2.8728743103664676e-8,0.0038929238963934186,8.34996763450161e-7,-2.819013439953649e-8,0.003893302729372596,5.229491681716229e-7,-2.7582633768285374e-8,0.0038938176635446077,2.486270920040773e-7,-2.704868519022275e-8,0.0038944323474479204,8.290889866841129e-8,-2.6726217478885122e-8,0.0038950779585628413,6.71542862886964e-8,-2.6695708784190685e-8,0.0038956768103849595,1.9679611586948285e-7,-2.694825472718397e-8,0.003896169311776245,4.2495370109331924e-7,-2.73925766726845e-8,0.003896530677936019,6.822594553111313e-7,-2.7893606935094835e-8,0.0038967721729981984,9.007324311420936e-7,-2.8318972956552194e-8,0.003896930972109137,1.0312737312306008e-6,-2.8573056292209646e-8,0.0038970560356940956,1.0512333616440805e-6,-2.8611714898809007e-8,0.0038971954492596143,9.637576168076825e-7,-2.84410251401411e-8,0.0038973875128366286,7.922909732076531e-7,-2.8106623400673385e-8,0.003897655773663217,5.73039745366953e-7,-2.7679078820458593e-8,0.0038980074203048315,3.470975623162463e-7,-2.723855936562174e-8,0.003898434383602654,1.532557749678879e-7,-2.686076811069166e-8,0.003898916483642837,2.2273778031217942e-8,-2.6605698033749048e-8,0.003899425869944706,-2.6879705272445377e-8,-2.651026260606674e-8,0.003899931946443452,1.135752503116599e-8,-2.658517606455315e-8,0.003900405988380751,1.2952483923987927e-7,-2.6815784333920333e-8,0.0039008248607193337,3.0902597073996624e-7,-2.7165815642283763e-8,0.0039011736945926885,5.228355224148576e-7,-2.7582659172522265e-8,0.003901447733469793,7.385703341824681e-7,-2.800327930437387e-8,0.0039016535931530446,9.218576909926763e-7,-2.8360689234556944e-8,0.003901810063641041,1.0402342282423203e-6,-2.8591513682344532e-8,0.0039019482346590566,1.068114437545263e-6,-2.8645727584383664e-8,0.0039021099156309434,9.933162871447647e-7,-2.8499486010026745e-8,0.0039023425147539973,8.245733393134014e-7,-2.816985246159411e-8,0.0039026886667243655,5.973876226969504e-7,-2.7726207946250197e-8,0.0039031709184319144,3.732053312467776e-7,-2.728856993304565e-8,0.003903776436955178,2.2643689124575264e-7,-2.7002203145251322e-8,0.0039044517336320776,2.1908852626009318e-7,-2.6988107235954432e-8,0.0039051160269753435,3.7343990320735743e-7,-2.728970832405026e-8,0.0039056904602020087,6.597257455398579e-7,-2.7848816986833218e-8,0.0039061274952976715,1.008182754458275e-6,-2.8529159419230002e-8,0.003906424029832539,1.337864454440272e-6,-2.917267690733211e-8,0.0039066143239121455,1.584673185538172e-6,-2.9654276855512307e-8,0.003906751629333246,1.7160417124478927e-6,-2.991045051383723e-8,0.003906889981347287,1.7312807173328777e-6,-2.993987957694521e-8,0.003907072257425082,1.6535639424178371e-6,-2.978777180552823e-8,0.003907324953080964,1.5196860399174986e-6,-2.9525923596991393e-8,0.003907657617907691,1.3710174126904936e-6,-2.9235136326534077e-8,0.003908064791635279,1.246627938272527e-6,-2.8991808582392042e-8,0.003908529121213566,1.178355331974727e-6,-2.8858246582644022e-8,0.0039090251008069895,1.1874723538953122e-6,-2.8876064406570793e-8,0.0039095231741027164,1.2828026766380307e-6,-2.9062457134925734e-8,0.003909993971965604,1.4602429723720258e-6,-2.940930205385144e-8,0.003910412376088683,1.7037257014122688e-6,-2.9885126077279e-8,0.003910760972899444,1.9875614267849495e-6,-3.043974711070414e-8,0.003911032543742426,2.279815827653438e-6,-3.1010855542352346e-8,0.003911231493909528,2.5463069029857515e-6,-3.153173238001942e-8,0.003911374222650876,2.7549910335127733e-6,-3.193972170951845e-8,0.003911488384327841,2.880624085469085e-6,-3.218531726661661e-8,0.003911610864352182,2.909667982481857e-6,-3.224183476086153e-8,0.003911783886839922,2.84536194505679e-6,-3.211546429333361e-8,0.003912048236733935,2.7121190655270843e-6,-3.1853969077637996e-8,0.003912432956737331,2.5569177610852085e-6,-3.1549408250500364e-8,0.003912942711842446,2.4439948046497946e-6,-3.13276712957956e-8,0.003913547494005578,2.439525781374463e-6,-3.1318405148871284e-8,0.003914182801008766,2.587612510786791e-6,-3.160796365905382e-8,0.00391476670682019,2.8876813198392386e-6,-3.219515496038958e-8,0.003915229878465214,3.288612511808708e-6,-3.297977441605243e-8,0.00391554262842195,3.707168304776008e-6,-3.3798756641249064e-8,0.003915722816780819,4.061134667377567e-6,-3.449114586943816e-8,0.0039158221519932715,4.297554871760769e-6,-3.495337435976911e-8,0.003915902612886247,4.403020028690837e-6,-3.5159304982510026e-8,0.003916016771863963,4.3972762305046315e-6,-3.51476057496457e-8,0.003916198069716032,4.319425094326008e-6,-3.499472431255641e-8,0.003916459596845121,4.214738888555488e-6,-3.4789167335719515e-8,0.003916797401300606,4.125457418511884e-6,-3.46135897824814e-8,0.003917195121291198,4.085545626385126e-6,-3.453456558879286e-8,0.003917628376812855,4.118078743411213e-6,-3.459741276197698e-8,0.00391806864547818,4.234057023541767e-6,-3.4823781820516536e-8,0.0039184868549933145,4.432100524385358e-6,-3.521100643460954e-8,0.003918856894454718,4.698942282664103e-6,-3.5733089149345645e-8,0.003919159062997544,5.010909292212568e-6,-3.634366398414867e-8,0.003919383180819294,5.336673361384431e-6,-3.698142096457321e-8,0.003919530829987342,5.641296545403175e-6,-3.757799607711368e-8,0.0039196162213828035,5.891218249778886e-6,-3.8067651883344666e-8,0.0039196653747344806,6.059652716046391e-6,-3.8397777275256786E-08,0.003919713456096689,6.131770978781817e-6,-3.853905013964011e-8,0.003919800276775679,6.108967573413839e-6,-3.849390802272054e-8,0.003919964045053333,6.011521522845613e-6,-3.830191792649171e-8,0.003920233494230299,5.878730153642338e-6,-3.804014811232711e-8,0.003920618992780859,5.764983763374026e-6,-3.781547454419313e-8,0.00392110459247313,5.730010496430183e-6,-3.7745352062984805e-8,0.0039216448866342514,5.822802882578071e-6,-3.792614771435408e-8,0.00392217165582521,6.062441369382195e-6,-3.839540769990899e-8,0.003922612784897084,6.424343781374744e-6,-3.910483982583697e-8,0.003922918279510956,6.842549813656679e-6,-3.9924854655693004e-8,0.0039230801956615,7.231684285990491e-6,-4.068779460101494e-8,0.003923134148926395,7.5187772284920845e-6,-4.125047503163074e-8,0.003923141833425455,7.667435752105012e-6,-4.1541586012182924e-8,0.003923166269325025,7.683166138878378e-6,-4.1571999586433136e-8,0.003923253198934327,7.602234341381125e-6,-4.1412808153840096e-8,0.00392342418128479,7.474463541507354e-6,-4.1161593315289665e-8,0.003923678875818511,7.348774715809465e-6,-4.091417238620076e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_24.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_24.json deleted file mode 100644 index 2a81d6b3..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_24.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":24000,"numberOfSamples":1000,"samples":[0.003924001349468574,7.264665173102422e-6,-4.0747989552475184e-8,0.003924366586169156,7.248790607297544e-6,-4.0715438046854016e-8,0.0039247455983737215,7.31449699975775e-6,-4.084288354023843e-8,0.003925109134008881,7.462510402409807e-6,-4.1131928535769936e-8,0.003925430619334403,7.681943579661476e-6,-4.156132990390201e-8,0.003925688916221978,7.9515663056217e-6,-4.208949033990723e-8,0.003925871139610513,8.241724001493012e-6,-4.26582543580377e-8,0.003925975343160025,8.517452558510482e-6,-4.319903585164052e-8,0.003926012408625573,8.743124708146312e-6,-4.364190844664137e-8,0.0039260062351111815,8.888393011087458e-6,-4.392721436513869e-8,0.0039259914819518545,8.934553769547599e-6,-4.401802379763859e-8,0.003926008601681654,8.87995541059872e-6,-4.391078722925618e-8,0.003926096603853184,8.742886424791559e-6,-4.364111335220435e-8,0.003926284700461693,8.560700555841224e-6,-4.328218871863738e-8,0.003926584419799495,8.38460458304358e-6,-4.293463839580567e-8,0.003926983982520055,8.27018419490559e-6,-4.270791978660203e-8,0.003927446933578442,8.26450952654458e-6,-4.269489056436631e-8,0.003927917035426422,8.392007583137403e-6,-4.294388907717355e-8,0.003928330548152765,8.643213090672838e-6,-4.343648270886796e-8,0.003928634404239271,8.97202431142347e-6,-4.4082022548759444e-8,0.003928804571353034,9.306016764539644e-6,-4.473798796749362e-8,0.003928855847415065,9.568840746130847e-6,-4.525415343428905e-8,0.0039288366735898165,9.705875342600683e-6,-4.552310678124801e-8,0.003928810708523999,9.70075387287824e-6,-4.5512697637589113e-8,0.003928834802404048,9.575566014901797e-6,-4.526632710582171e-8,0.003928943827175889,9.377534807333275e-6,-4.487669985208786e-8,0.003929146690245219,9.161289638700064e-6,-4.445102369531869e-8,0.003929431010766044,8.97479258527682e-6,-4.408344678591044e-8,0.003929771249439363,8.851942834798086e-6,-4.3840594450064106e-8,0.003930136299987928,8.810775413828423e-6,-4.375803213461219e-8,0.0039304949376361325,8.854733935909684e-6,-4.3842713182813283e-8,0.003930819251349883,8.97490756364095e-6,-4.4077307493303816e-8,0.003931086911330102,9.152169769274805e-6,-4.442436000944777e-8,0.0039312831240633185,9.359120650070548e-6,-4.4830096409770687e-8,0.003931402736278697,9.562353565431697e-6,-4.522888479978551e-8,0.0039314523679986994,9.725809891954073e-6,-4.554983213541918e-8,0.003931451821677968,9.81581544058732e-6,-4.572667330703574e-8,0.0039314335373014,9.807739373223678e-6,-4.5710846370490446e-8,0.003931438847422937,9.693139686684408e-6,-4.5485541526462294e-8,0.003931510540598468,9.485126741041124e-6,-4.507628154878644e-8,0.0039316827752822045,9.21922505098598e-6,-4.455269004539336e-8,0.003931971055312627,8.947933809120098e-6,-4.401789076476449e-8,0.0039323657307728825,8.729358784614993e-6,-4.358622919525109e-8,0.003932831731699162,8.612643855888081e-6,-4.335462841531593e-8,0.003933315344617792,8.62429738570606e-6,-4.337560654570439e-8,0.003933756715300976,8.759463349484685e-6,-4.363994931455601e-8,0.003934105106059232,8.981053856326873e-6,-4.407485811762412e-8,0.003934332913929343,9.227877438043526e-6,-4.4559891225405716e-8,0.0039344440871193175,9.430525068002884e-6,-4.4958286576969273e-8,0.003934473402796723,9.530858688927084e-6,-4.5155432327327116e-8,0.003934475863914978,9.498545685117723e-6,-4.509149078422063e-8,0.003934509718222492,9.33827824991407e-6,-4.47756142603218e-8,0.003934619792227327,9.085158588882537e-6,-4.427682786107174e-8,0.003934827415641757,8.791280140237335e-6,-4.369760258181166e-8,0.00393512933343696,8.510038014808986e-6,-4.31429928445453e-8,0.0039355035636141015,8.284081649552148e-6,-4.269695029529051e-8,0.003935918018543304,8.139406686077033e-6,-4.241070000822375e-8,0.003936338353846052,8.084775818140693e-6,-4.2301584302013366e-8,0.003936733445406277,8.114176353890525e-6,-4.235787766689351e-8,0.0039370785461212525,8.210197709692123e-6,-4.254541828860122e-8,0.003937356971767464,8.347130480599071e-6,-4.281369430236631e-8,0.003937561263758311,8.493567783692922e-6,-4.310094762045791e-8,0.003937694438031615,8.615002843389891e-6,-4.333926631812809e-8,0.003937771330134241,8.67725650150846e-6,-4.346131796842194e-8,0.003937819322870859,8.651508326884634e-6,-4.3410256470381495e-8,0.003937877058427044,8.521099894445721e-6,-4.3153137231452934e-8,0.003937989463885939,8.288931327634417e-6,-4.269550841092151e-8,0.003938198228981029,7.982475866423666e-6,-4.209131265757179e-8,0.003938529202136906,7.652421272823026e-6,-4.144024574779018e-8,0.003938981172624146,7.362348631112524e-6,-4.086748201679056e-8,0.003939521858698951,7.171057158621901e-6,-4.048891544782165e-8,0.003940094615197016,7.113880374154503e-6,-4.0374365707466556e-8,0.0039406342007793785,7.190918645244552e-6,-4.052432522098116e-8,0.003941085456845227,7.366953288287352e-6,-4.086966435709471e-8,0.003941417979926735,7.582297213206803e-6,-4.1292902967637985e-8,0.003941632550878733,7.769811582108233e-6,-4.1661704613367465e-8,0.0039417586573959,7.872367731094012e-6,-4.186332403044912e-8,0.00394184498935138,7.856147459827803e-6,-4.183089280710224e-8,0.003941946090056001,7.716963831159671e-6,-4.155595404739903e-8,0.003942108844751583,7.478721284531861e-6,-4.1085488184775086e-8,0.003942362280649743,7.1851264448118275e-6,-4.0505610055412035e-8,0.003942713056297738,6.887545188092401e-6,-3.9917635489093076e-8,0.003943147094181412,6.63285056822077e-6,-3.9414089140640513e-8,0.00394363576055283,6.45458746493619e-6,-3.906122521138246e-8,0.003944143851940386,6.3689698481875325e-6,-3.889108334065558e-8,0.003944636869159611,6.375238897636767e-6,-3.89021835862169e-8,0.003945086178514301,6.458758785510235e-6,-3.906566285644976e-8,0.003945471885644119,6.595087712929455e-6,-3.9333345409787816e-8,0.003945784062145488,6.75381682031183e-6,-3.96453240801719e-8,0.0039460231949269235,6.9018086924852714e-6,-3.993631138475404e-8,0.003946200484182494,7.0061699834473986e-6,-4.0141443325436696e-8,0.003946338123548155,7.037663514739489e-6,-4.020297398706976e-8,0.003946469030517169,6.975321308310946e-6,-4.007939202239149e-8,0.0039466347171631935,6.8125615268396335e-6,-3.9757548945000605e-8,0.003946879526314831,6.563781000662389e-6,-3.926572917290399e-8,0.003947240113576192,6.26832771088985e-6,-3.8681519815076635e-8,0.00394773162032693,5.987155767768718e-6,-3.8125213666258697e-8,0.00394833606959585,5.788678511154436e-6,-3.7731893344309e-8,0.0039490010315956,5.726070108611301e-6,-3.760663760887806e-8,0.003949653254363835,5.815841448021564e-6,-3.778221021701663e-8,0.003950222933085804,6.029784395114221e-6,-3.8203094717768544e-8,0.003950666763769117,6.305251283013329e-6,-3.874572335149639e-8,0.003950978997636163,6.567633107643007e-6,-3.926282625402561e-8,0.003951187946508848,6.753390037519353e-6,-3.9628897768472654e-8,0.003951342970045106,6.82499234587586e-6,-3.9769697357740485e-8,0.00395149899125544,6.775528812781524e-6,-3.9671369919487616e-8,0.003951703461040263,6.625121099539185e-6,-3.9373432374454456e-8,0.003951987858015527,6.412572497682793e-6,-3.8952382552237284e-8,0.003952363959429004,6.185216687773946e-6,-3.8501729618800614e-8,0.003952824318389738,5.9890392604355895e-6,-3.811248119847719e-8,0.003953346084383744,5.8605580191022866e-6,-3.7857015174201214e-8,0.003953896995412957,5.821583390244034e-6,-3.777860582122305e-8,0.003954442092751837,5.877359468380301e-6,-3.7887672658214384e-8,0.003954949781935346,6.017769412892624e-6,-3.816417373000497e-8,0.003955396289717578,6.220694202785564e-6,-3.856432318594815e-8,0.003955768174884203,6.456367672750993e-6,-3.902927598979735e-8,0.003956063179994125,6.691705169501888e-6,-3.949369249275251e-8,0.003956290051901221,6.894111093467348e-6,-3.989319559509603e-8,0.003956467854520423,7.034854759428582e-6,-4.017095218887658e-8,0.0039566249669400816,7.092436622888951e-6,-4.0284290088954386e-8,0.003956797478346305,7.056481487425291e-6,-4.021245059161304e-8,0.003957025994777186,6.932388600346256e-6,-3.996590300588929e-8,0.003957349414623954,6.7458410699163445e-6,-3.959537173887109e-8,0.003957794778545756,6.544498614818847e-6,-3.9195220973930975e-8,0.003958364489074411,6.392651543668574e-6,-3.889283923884582e-8,0.003959026190955713,6.355295837039837e-6,-3.881705762450065e-8,0.003959713978117959,6.473712946892012e-6,-3.904975388942963e-8,0.003960346658841707,6.743821961530491e-6,-3.958294960032686e-8,0.003960857575990237,7.112323350996538e-6,-4.031115186969541e-8,0.0039612197932018854,7.496174919039376e-6,-4.10699402100219e-8,0.003961452306299503,7.814588012843276e-6,-4.169936348567501e-8,0.003961606574536528,8.01530911676443e-6,-4.209596468724888e-8,0.003961744529834369,8.08439052342442e-6,-4.223205431160473e-8,0.003961919898203691,8.041055608842375e-6,-4.2145503385516964e-8,0.003962167934107929,7.92540646416268e-6,-4.1915471608097986e-8,0.003962502766954194,7.785608877629877e-6,-4.1637175222764884e-8,0.003962919504652272,7.667738377555936e-6,-4.140189174962666e-8,0.00396339860412415,7.6088866362392024e-6,-4.128330394764023e-8,0.003963911081389532,7.633028280277278e-6,-4.132919427751386e-8,0.003964423927548092,7.749152914604407e-6,-4.1557593105492124e-8,0.003964905318504584,7.951432583245587e-6,-4.1957026443146924e-8,0.003965329172806784,8.221199670866641e-6,-4.249046155503989e-8,0.0039656786145144665,8.530378408627668e-6,-4.310220299700377e-8,0.003965947990889918,8.845841392371245e-6,-4.37266017606286e-8,0.003966143368775138,9.134007815143316e-6,-4.429715430491004e-8,0.003966281763390242,9.365126081644348e-6,-4.475489492347632e-8,0.003966389432433808,9.517028569907252e-6,-4.50557398961551e-8,0.0039664994413490615,9.578380169243303e-6,-4.517691762130738e-8,0.003966648478154706,9.551562333274848e-6,-4.512279719134597e-8,0.003966872442131501,9.455213790585541e-6,-4.493010285476397e-8,0.003967200009096507,9.325645135291122e-6,-4.4670856835179115e-8,0.003967643942139405,9.215087087823338e-6,-4.4448923046119814e-8,0.0039681916280942,9.183905742556441e-6,-4.438445858297688e-8,0.003968799131557344,9.284666046934797e-6,-4.4582129386551373e-8,0.003969395714603861,9.540259293398974e-6,-4.508756258136944e-8,0.0039699037202130414,9.926237027984614e-6,-4.585222439096121e-8,0.003970268552470416,1.0371684773005795e-5,-4.673521137896835e-8,0.003970482142169558,1.078412203468818e-5,-4.755282003004367e-8,0.0039705843561092195,1.10860283048514e-5,-4.815115477383973e-8,0.003970642360386332,1.1241376583518066e-5,-4.845874452293147e-8,0.003970722821708415,1.125981504453911e-5,-4.8494689966727235e-8,0.0039708723071808566,1.11829441885822e-5,-4.834134805360363e-8,0.003971110919069601,1.1065211622363857e-5,-4.810650188240576e-8,0.003971435431608885,1.0958632735931508e-5,-4.7893216781566505e-8,0.003971826265812919,1.0903990546723049e-5,-4.778250186894762e-8,0.003972254586729742,1.0927283245886881e-5,-4.782624238951511e-8,0.003972688105211575,1.1039249843146977e-5,-4.8046116883982526e-8,0.0039730955939297884,1.1236386675066273e-5,-4.843545087392066e-8,0.00397345054557075,1.1502799362280447e-5,-4.8962807876693554e-8,0.003973734208169738,1.1812792318729848e-5,-4.9577158828296015e-8,0.003973937950405579,1.2134265111817801e-5,-5.021471558067026e-8,0.003974064679006379,1.2432918992578263e-5,-5.080734411592102e-8,0.003974128944467808,1.2676973960732623e-5,-5.129190491821449e-8,0.003974155556457899,1.2841827542246017e-5,-5.1619414061577866e-8,0.0039741767870729505,1.2914097734147498e-5,-5.1763003268766806e-8,0.003974228381508199,1.2894585117898373e-5,-5.1723840310494984e-8,0.0039743446740342315,1.2799778794775203e-5,-5.1534278839920305e-8,0.003974553031218095,1.2661651645222267e-5,-5.1257656952560386e-8,0.00397486770830553,1.252526192551265e-5,-5.0983665712715536e-8,0.003975283624309093,1.244306855380536e-5,-5.081702986908633e-8,0.003975771762776541,1.2464764616558008e-5,-5.085712444532777e-8,0.003976279358595454,1.2622668128129355e-5,-5.1168686224427466e-8,0.003976738806949802,1.2915806066879637e-5,-5.174997205879499e-8,0.00397708712480231,1.3300494013523065e-5,-5.251398213335525e-8,0.003977290708495544,1.3697307875515348e-5,-5.3302462984544026e-8,0.003977362035950759,1.4017395454687275e-5,-5.393846232144907e-8,0.003977355858695399,1.4196719691249908e-5,-5.429455632185751e-8,0.003977345605575303,1.4218583669657343e-5,-5.433755885903962e-8,0.003977394646971235,1.4112859234273654e-5,-5.412679978292305e-8,0.003977538120767945,1.3937040535825622e-5,-5.377637606636613e-8,0.003977780313015663,1.3753373811437281e-5,-5.3409789340420174E-08,0.0039781024005110955,1.361276026355333e-5,-5.312812805725196e-8,0.003978473023124186,1.3547849219766439e-5,-5.299644136530384e-8,0.003978857094370713,1.3572654477401475e-5,-5.304293291262342e-8,0.00397922161367756,1.3685187261991948e-5,-5.326404503945597e-8,0.0039795391090315735,1.387078103509612e-5,-5.363091484811033e-8,0.003979789799970764,1.4105237357237993e-5,-5.4095556401576257e-8,0.0039799632178153825,1.4357845076354077e-5,-5.45968922420498e-8,0.003980059500806607,1.4594673222991368e-5,-5.506737604277994e-8,0.003980090142970023,1.4782539911570218e-5,-5.5440930753357645e-8,0.003980077642195864,1.4893710156689642e-5,-5.566226817310781e-8,0.003980053468419345,1.4910803096605801e-5,-5.56965853216742e-8,0.0039800541106269635,1.4830983623911673e-5,-5.553787293347947e-8,0.0039801154418540406,1.466838142817004e-5,-5.5213797919344863e-8,0.003980266139921954,1.4453775388946017e-5,-5.478524269653043e-8,0.003980521287767714,1.4231023369268172e-5,-5.4339391697161045e-8,0.003980877353979621,1.4050315119139707e-5,-5.397640762167942e-8,0.003981309717837675,1.395868469966156e-5,-5.3790488944141864e-8,0.003981774090037387,1.3988628469092594e-5,-5.3846999457069773e-8,0.003982213281677193,1.4146764402475845e-5,-5.415961657859051e-8,0.003982570011449755,1.4406143821260008e-5,-5.467482526558627e-8,0.003982804131697453,1.47071498764841e-5,-5.527369286809923e-8,0.003982908778352366,1.4970992193698437e-5,-5.579891732093303e-8,0.003982916824397885,1.5124448073961797e-5,-5.6104337480320424e-8,0.003982891263406429,1.5126160410236833e-5,-5.610742482232311e-8,0.00398290215454356,1.4980743595872157e-5,-5.581730514030468e-8,0.0039830019202654705,1.4733222541316497e-5,-5.532354528930037e-8,0.003983211326857249,1.4448727937037265e-5,-5.4755680309660146e-8,0.003983520104257227,1.4189885389384998e-5,-5.423828496751849e-8,0.003983897259054235,1.4001826693159665e-5,-5.386125283385029e-8,0.003984303459136277,1.3907216352427944e-5,-5.366993275012876e-8,0.003984700579759181,1.3908279420985249e-5,-5.3669095525382856e-8,0.003985057207973846,1.399170223752423e-5,-5.3832563887307894e-8,0.00398535107067196,1.4133635001783242e-5,-5.411306762933109e-8,0.003985569881970607,1.4303771905497005e-5,-5.445033306625039e-8,0.0039857117052029475,1.4468652878353123e-5,-5.4777689929636526e-8,0.003985785248092382,1.4594817843348775e-5,-5.502840613731594e-8,0.003985809897015252,1.4652472383143383e-5,-5.514301337657362e-8,0.003985814826438397,1.4619974837042523e-5,-5.5078226609295487e-8,0.0039858363205629195,1.4488750116827408e-5,-5.481669944437828e-8,0.003985912714645442,1.426742833517886e-5,-5.4375274115178266e-8,0.003986077146685968,1.3983468945714063e-5,-5.380829619913038e-8,0.003986349418788184,1.3680607655818763e-5,-5.320267121504874e-8,0.003986729243878734,1.3411429492368585e-5,-5.266321054783875e-8,0.003987193368925278,1.3226052188088213e-5,-5.229014065094215e-8,0.0039876982347206835,1.3159498917999302e-5,-5.2153854337675876E-08,0.00398818833657533,1.3221106579292605e-5,-5.227358445765773e-8,0.003988608901007278,1.338916970518754e-5,-5.260647556617648e-8,0.003988920183252699,1.3613194193081244e-5,-5.3051916801022585e-8,0.003989109646982799,1.3824650626505712e-5,-5.347299765131535e-8,0.003989197746223967,1.3954767944424933e-5,-5.373215558025435e-8,0.003989233827788415,1.3954763566654355e-5,-5.373171638754063e-8,0.003989281800794039,1.3811236850979288e-5,-5.3444699852450874e-8,0.003989400134260441,1.3549823535973889e-5,-5.292209959911019e-8,0.003989624365284392,1.3225093106393183e-5,-5.227268643727621e-8,0.003989959279866753,1.290162083662521e-5,-5.1625249279043706e-8,0.0039903824814073756,1.2635093520500604e-5,-5.109093995112096e-8,0.00399085532254792,1.2460509228031144e-5,-5.0739748289693165e-8,0.003991335096141489,1.2389290014694273e-5,-5.0594703090057124e-8,0.003991784193685639,1.2412788238110021e-5,-5.063879306432595e-8,0.0039921750376531425,1.2508400657934924e-5,-5.082710027342623e-8,0.0039924916979013365,1.264552801312763e-5,-5.109866380876292e-8,0.003992729733420645,1.2790244411010073e-5,-5.138580639540977e-8,0.003992895505481774,1.2908774182592685e-5,-5.162109554086806e-8,0.003993005539841018,1.2970483448082949e-5,-5.1743325651077926e-8,0.003993085805853583,1.2951169554634605e-5,-5.170407528089941e-8,0.0039931702182065525,1.2837098930575677e-5,-5.1475750096119304e-8,0.003993297356816803,1.2629535465925717e-5,-5.106062222453551e-8,0.003993504537036869,1.2348458326471559e-5,-5.04982889205154e-8,0.00399381928261621,1.2033164964636035e-5,-4.9866956012253766e-8,0.003994250001187529,1.1737322154317254e-5,-4.9273662215669775e-8,0.0039947794474397376,1.1517572315967707e-5,-4.883161802180583e-8,0.003995364932969854,1.1417909076784898e-5,-4.8629022529340004e-8,0.0039959471867255245,1.145512467560501e-5,-4.8699907040692296e-8,0.003996465923696541,1.1611411554188564e-5,-4.9009176717670445e-8,0.003996876828671035,1.1837637422183225e-5,-4.9458966925161574e-8,0.003997163971009506,1.2066380201857806e-5,-4.991458667779847e-8,0.003997343759283495,1.2230228260355551e-5,-5.024110820721207e-8,0.003997459714537061,1.227962356731739e-5,-5.033913205513782e-8,0.0039975700174394516,1.2195246540345806e-5,-5.016966528746188e-8,0.0039977315793668896,1.199171433994848e-5,-4.9761614483588085e-8,0.003997985303974457,1.1711837911922054e-5,-4.920037428897476e-8,0.003998346858193554,1.1413566865496914e-5,-4.8601769213070115e-8,0.0039988053495900785,1.1154143067304714e-5,-4.808037527313077e-8,0.0039993293627035445,1.0976671983429418e-5,-4.7722620398013583e-8,0.003999877225762814,1.0902767894712806e-5,-4.7571985490559816e-8,0.004000407493370264,1.0931979187466173e-5,-4.762776490445662e-8,0.00400088668699902,1.1046120607170104e-5,-4.785368769200271e-8,0.0040012933178902805,1.1215681826101956e-5,-4.8190753288722657e-8,0.004001618824597613,1.140602944436198e-5,-4.856968419517292e-8,0.004001866716617343,1.1582292382143262e-5,-4.8920729394387654e-8,0.004002051089467816,1.1712900988527266e-5,-4.9180732644461024e-8,0.004002195134543225,1.1772393926335084e-5,-4.9298705411811596e-8,0.0040023296147842545,1.1744241358596293e-5,-4.9241438831947997e-8,0.004002490702025333,1.1624164492064202e-5,-4.9000150214148706e-8,0.004002716177242634,1.1423787492992013e-5,-4.859784391910101e-8,0.0040030390227214704,1.1173356864132723e-5,-4.8094833920023865e-8,0.004003478361347815,1.0920997712239193e-5,-4.7587334303852796e-8,0.004004029802038545,1.0725563863908767e-5,-4.719320099784125e-8,0.004004659792221574,1.0641953511935584e-5,-4.7022548424382676e-8,0.004005309358395405,1.0702231547952575e-5,-4.713991105371558e-8,0.004005909305357476,1.0900742430031743e-5,-4.7534332339053704e-8,0.004006402231050277,1.1192022790909333e-5,-4.8115061170983004e-8,0.004006761493609258,1.1504328555145381e-5,-4.8738556290387605e-8,0.004006998416788491,1.1762810600434922e-5,-4.925487801263246e-8,0.0040071557972175655,1.1911802199676452e-5,-4.955234189469917e-8,0.004007292492485376,1.1928068755813912e-5,-4.9584090451901684e-8,0.004007466154921649,1.182270536529946e-5,-4.9371962164986925e-8,0.004007719484345561,1.1633960677447274e-5,-4.8992235679285965e-8,0.004008072516982853,1.1415035698476774e-5,-4.855132546462214e-8,0.004008521247009628,1.1220739757355388e-5,-4.81591306861145e-8,0.004009041556486812,1.1095986552782165e-5,-4.790595409748483e-8,0.004009596684482728,1.1068126254001404e-5,-4.784699794194256e-8,0.004010146061004549,1.1144061978931795e-5,-4.799641499742937e-8,0.0040106533603855915,1.1311869844993711e-5,-4.833044905420133e-8,0.004011092236707525,1.1545566812726804e-5,-4.8796997573800546e-8,0.004011449171177877,1.1811239466230054e-5,-4.9327987188523245e-8,0.004011723764818403,1.2072971677857698e-5,-4.985134835693644e-8,0.00401192736389657,1.2297623888833959e-5,-5.0300619813788786e-8,0.004012080963416897,1.2458294160137046e-5,-5.06218316152855e-8,0.004012212952149902,1.2536886563441079e-5,-5.077857415701251e-8,0.004012356748830488,1.2526361690877996e-5,-5.075648134300845e-8,0.004012547921684051,1.2433048238960548e-5,-5.0567928963629637e-8,0.0040128199805693305,1.2278886932150372e-5,-5.025666471468604e-8,0.004013197985529161,1.2102470950470938e-5,-4.990002190519058e-8,0.00401369000353784,1.1956510006150005e-5,-4.960388878819715e-8,0.004014278532066863,1.1898883530667995e-5,-4.948472066423443e-8,0.0040149167491389135,1.197622246061075e-5,-4.963648586630433e-8,0.004015535619726837,1.2203997061740317e-5,-5.0090569001978953e-8,0.004016064005360639,1.2553240036393509e-5,-5.0789018255737813e-8,0.0040164548830214815,1.2954750430225737e-5,-5.1592962190804215e-8,0.004016703733644348,1.3322431746732769e-5,-5.232951731508461e-8,0.004016848431434354,1.3584310465564186e-5,-5.2854110685949694e-8,0.004016951977140229,1.3704978067918915e-5,-5.309550581731473e-8,0.00401707918422125,1.3690726517722423e-5,-5.3066050186417026e-8,0.004017278464444657,1.3580022117076173e-5,-5.284257367174307e-8,0.004017573349390648,1.3427603643939568e-5,-5.253461517336548e-8,0.004017962524787026,1.3289293461804937e-5,-5.2254123260796106e-8,0.004018424992325505,1.3210932934703492e-5,-5.2093339215260626e-8,0.0040189273729024705,1.3221997414880813e-5,-5.211190437947683e-8,0.0040194315062708425,1.3333214209773679e-5,-5.2331872879317006e-8,0.004019901334926071,1.3537385768781908e-5,-5.273915282943784e-8,0.00402030839443015,1.3812681913253474e-5,-5.3290015781132485e-8,0.004020635440219238,1.4127527132908653e-5,-5.392095666905157e-8,0.004020878035146411,1.4446146519830484e-5,-5.455996088115213e-8,0.004021044226821732,1.473392798977689e-5,-5.513737746601209e-8,0.00402115275112109,1.496191131793451e-5,-5.559493860655362e-8,0.004021230393628464,1.5110074592057919e-5,-5.589227823087387e-8,0.004021308993990323,1.5169566143298608e-5,-5.601133518705951e-8,0.004021422225284333,1.5144214158221058e-5,-5.595940175161358e-8,0.0040216019835709,1.505150937068162e-5,-5.57712373201424e-8,0.004021873939755527,1.4922916833095616e-5,-5.550989215428107e-8,0.0040222517467002885,1.4802621499919506e-5,-5.5264327043482085e-8,0.004022730175355548,1.4742845077977562e-5,-5.513999395696767e-8,0.00402327924617558,1.4793651408929851e-5,-5.5238179247849234e-8,0.004023843665981839,1.498685836194858e-5,-5.562340967782772e-8,0.004024352851506316,1.5318263529964064e-5,-5.62874975195311e-8,0.004024743118745088,1.573836892528872e-5,-5.7130821512435726e-8,0.004024984194842726,1.6162535861771282e-5,-5.7982877436069443E-08,0.004025094377176705,1.6501026274800637e-5,-5.866291758713605e-8,0.004025133037057492,1.6693810177365013e-5,-5.9050065212816505e-8,0.0040251747474465615,1.6730082192383597e-5,-5.912247029379822e-8,0.004025281332087344,1.6644195416193686e-5,-5.894897656672424e-8,0.004025485746450353,1.6495866969054968e-5,-5.864930998217878e-8,0.004025790429201538,1.634835179138792e-5,-5.8350370181822665e-8,0.0040261746462862255,1.6253223052331517e-5,-5.815584387978385e-8,0.0040266044641294775,1.624327250382378e-5,-5.813200951807451e-8,0.004027041638836209,1.633135361213576e-5,-5.8305293951082345e-8,0.00402745025711566,1.6512469372403883e-5,-5.866622925242898e-8,0.00402780134494779,1.6767326438795646e-5,-5.917637987828972e-8,0.004028075926393701,1.7066612366788847e-5,-5.977686171643531e-8,0.004028266748303052,1.7375686093179322e-5,-6.039784671300595e-8,0.004028378700267617,1.7659404592882538e-5,-6.096841423803015e-8,0.004028427921096438,1.7886793273255926e-5,-6.142604364033798e-8,0.00402843964084909,1.8035151508268353e-5,-6.172486403108444e-8,0.004028445012514573,1.809312331270539e-5,-6.184175008856881e-8,0.0040284773268235005,1.8062494703952662e-5,-6.177988665082503e-8,0.004028567910222432,1.7958723498241694e-5,-6.156990468255793e-8,0.004028741861400401,1.781021131030546e-5,-6.12686094634135e-8,0.0040290136622913525,1.765619786846825e-5,-6.095496322789188e-8,0.0040293826809504,1.754280016104753e-5,-6.07222216328837e-8,0.004029829124215082,1.751619084809753e-5,-6.066410876225836e-8,0.004030312256108125,1.7612020509539247e-5,-6.085324393616324e-8,0.004030774031389632,1.7841815454699297e-5,-6.131341293797681e-8,0.00403115142107213,1.8180564860966387e-5,-6.199433879515745e-8,0.0040313974300052735,1.8563852856182064e-5,-6.27659191383855e-8,0.004031503203472192,1.8902856758312773e-5,-6.344869780801121e-8,0.004031507215610012,1.9116091643266002e-5,-6.387812802255732e-8,0.004031481930153734,1.916242569246173e-5,-6.397118926916185e-8,0.004031503768949901,1.9055383830683572e-5,-6.375504333127174e-8,0.004031624504421274,1.885153534554923e-5,-6.334344369125224e-8,0.00403185885677837,1.8623798019755862e-5,-6.288296518438462e-8,0.004032189274944319,1.8436620157024645e-5,-6.250321630029159e-8,0.004032579178971542,1.83324637336343e-5,-6.228981683190497e-8,0.004032986090714059,1.8329161981569122e-5,-6.227911243671427e-8,0.0040333708125981456,1.8423493871162983e-5,-6.246522183995398e-8,0.004033702484811329,1.8596808258675e-5,-6.281112340841897e-8,0.0040339608469825575,1.882045266602357e-5,-6.325939983367222e-8,0.004034137070431829,1.906045203237547e-5,-6.374161530130195e-8,0.004034233855241526,1.928170635220029e-5,-6.41868612531973e-8,0.004034264876079334,1.9452018078757834e-5,-6.453000617107153e-8,0.004034253391531761,1.9546047063260236e-5,-6.47197441623075e-8,0.004034229755724816,1.9548977882390267e-5,-6.472596597020264e-8,0.004034227730682795,1.9459320969577683e-5,-6.454533452522716e-8,0.004034279865723162,1.9290186380915923e-5,-6.420383235003002e-8,0.004034412486171448,1.9068594732676885e-5,-6.375547510633614e-8,0.00403464093034948,1.8832637893526655e-5,-6.327679436677401e-8,0.004034965687074627,1.8626536313167505e-5,-6.285707244922939e-8,0.004035370034247165,1.8493819644007736e-5,-6.258465123000945e-8,0.004035819874790727,1.846886648562048e-5,-6.252971679787746e-8,0.004036266904185114,1.856732169763407e-5,-6.272465029492704e-8,0.0040366565598250765,1.8777113738250836e-5,-6.31455681508602e-8,0.0040369414612311345,1.9053783781087113e-5,-6.370271942688705e-8,0.004037098344333292,1.932539834606959e-5,-6.42504851948613e-8,0.004037141902942749,1.951083270094533e-5,-6.462457097034529e-8,0.004037125865169994,1.954813798447868e-5,-6.46995458547251e-8,0.004037125861820998,1.9419995141300983e-5,-6.444028053955575e-8,0.00403721048480607,1.9160768124473176e-5,-6.391602935018678e-8,0.004037416430514758,1.88403649270376e-5,-6.326771012194285e-8,0.0040377405727112705,1.853563684839144e-5,-6.265022145619625e-8,0.004038149143064464,1.8305856043064805e-5,-6.218312567891382e-8,0.004038594479970898,1.8181596820678142e-5,-6.192833669694351e-8,0.004039029805036155,1.8165835433560526e-5,-6.189230839848963e-8,0.004039418015136255,1.8241197474729e-5,-6.204049708155263e-8,0.0040397350446880215,1.837815198734788e-5,-6.231370568667206e-8,0.004039969999138671,1.8541650006683282e-5,-6.264136381327966e-8,0.004040124041563737,1.8695860404660215e-5,-6.295108921511804e-8,0.004040209074777056,1.8807706049100226e-5,-6.317591860236914e-8,0.004040246363654397,1.88500021655281e-5,-6.32607471793734e-8,0.004040264737547788,1.8804636954320954e-5,-6.316879237455187e-8,0.004040297831687618,1.866571824947087e-5,-6.288791561688243e-8,0.004040379958326903,1.844201983765977e-5,-6.243550964565625e-8,0.004040540705219954,1.8157672301950075e-5,-6.185990253089828e-8,0.004040799030115895,1.7850119174229367e-5,-6.123634554926798e-8,0.0040411581509778,1.7564868093298403e-5,-6.065660011340943e-8,0.004041602732207329,1.734741098407994e-5,-6.021277355052825e-8,0.0040420995762303815,1.7233639004230466e-5,-5.997796689164541e-8,0.004042602323436688,1.724067110935005e-5,-5.998756494201581e-8,0.00404305992163886,1.736012884995211e-5,-6.022533875758978e-8,0.004043427966196684,1.7555910433464828e-5,-6.061865961283453e-8,0.0040436810936756275,1.7768500926616962e-5,-6.104709566844615e-8,0.004043823230883101,1.7927149455153616e-5,-6.1367140862782e-8,0.004043891164479845,1.7968977540453174e-5,-6.145110341710769e-8,0.004043947176700689,1.7860007267002482e-5,-6.122984744605595e-8,0.0040440603521150744,1.760913353792817e-5,-6.072111082777755e-8,0.004044282997667049,1.726658843338252e-5,-6.002633777071843e-8,0.004044633306112802,1.6905912165610116e-5,-5.929416783466505e-8,0.0040450925842591984,1.6598297213721576e-5,-5.866858772554347e-8,0.004045616463144047,1.6391968202125593e-5,-5.824729428445154e-8,0.004046152091763345,1.630410509649094e-5,-5.80653572847142e-8,0.004046652760383014,1.6324348036651065e-5,-5.8102214711525505e-8,0.004047085929565268,1.6424100266681775e-5,-5.830035937199191e-8,0.004047435228495953,1.6566189179488793e-5,-5.8584786032397173e-8,0.004047698959744002,1.671216642566975e-5,-5.8877737365682856e-8,0.004047887444712365,1.6826943646276348e-5,-5.9108127517374904e-8,0.00404802049508203,1.6881670483517197e-5,-5.9217433706880595e-8,0.004048125273323472,1.6855947238255258e-5,-5.9164217502915826e-8,0.004048234127401434,1.674008799311883e-5,-5.8928701076803824e-8,0.004048381670060571,1.6537530470193916e-5,-5.851761039418674e-8,0.004048600436416601,1.6266746291805815e-5,-5.796802584768781e-8,0.004048914984056892,1.5961326425245878e-5,-5.734760338043135e-8,0.004049335282066074,1.566668088020222e-5,-5.674801447212363e-8,0.0040498513719114376,1.5432414454828066e-5,-5.626965875165331e-8,0.004050431921230339,1.5301075079280176e-5,-5.5998974280483204e-8,0.004051028668995067,1.5296083993458358e-5,-5.598395649797168e-8,0.004051586738790464,1.5412983005455173e-5,-5.62162478465142e-8,0.004052058328986434,1.5617600591062285e-5,-5.6627167195976384e-8,0.004052415758160085,1.5852514347711364e-5,-5.7100596870077054e-8,0.004052659913064241,1.6050494133565283e-5,-5.7500160816537554e-8,0.0040528214440387015,1.6151570852562244e-5,-5.7703907353645075e-8,0.004052953861013157,1.611931020329749e-5,-5.763746552942237e-8,0.004053119682835466,1.595162622613579e-5,-5.729612717276807e-8,0.004053373025435257,1.5682212292362576e-5,-5.6747852350428666e-8,0.004053744027610918,1.537106055446932e-5,-5.611410681536437e-8,0.004054230846152612,1.5086637935810276e-5,-5.553375453822118e-8,0.004054802304411898,1.488624806595296e-5,-5.5123232299645195e-8,0.0040554095026198176,1.4802029857689209e-5,-5.494808734565473e-8,0.004056000829014219,1.4836834906018199e-5,-5.501449222707493e-8,0.0040565344012080526,1.496913360261363e-5,-5.527907211829798e-8,0.004056984713435475,1.5162646600086324e-5,-5.5668377746635783e-8,0.004057343673139978,1.537616244421555e-5,-5.609881419197702e-8,0.004057618154709957,1.5570907870645105e-5,-5.6491651348612124e-8,0.004057826336088842,1.571498161585009e-5,-5.678207302107251e-8,0.004057994236563965,1.5785663812756403e-5,-5.692387796847087e-8,0.004058152876449292,1.5770755436499932e-5,-5.6892175274642595e-8,0.004058335730497766,1.56698047725992e-5,-5.6685842838322767e-8,0.004058575736492297,1.5495479753201927e-5,-5.6330312045967666e-8,0.004058901067412491,1.5274593050186677e-5,-5.587969998232432e-8,0.0040593292989023755,1.504744016568601e-5,-5.541556302293769e-8,0.004059860688647646,1.4863522530534258e-5,-5.5038323485976716e-8,0.004060472924789321,1.4772178278052189e-5,-5.484831991380623e-8,0.004061121016256655,1.4808824187926628e-5,-5.491786333355384e-8,0.004061745398388068,1.4980995070619321e-5,-5.526278213620586e-8,0.0040622878335508355,1.5260905424743596e-5,-5.58271445794069e-8,0.00406270977840194,1.5589957864201896e-5,-5.6492254117461846e-8,0.004063005280007226,1.5895053516072876e-5,-5.71096919262533e-8,0.004063202722944347,1.611033761314179e-5,-5.7545486920249105e-8,0.004063355322523949,1.6195737978189514e-5,-5.7717829505718655e-8,0.004063524982892078,1.614629397440836e-5,-5.761611433490631e-8,0.0040637654881181635,1.5990874718776372e-5,-5.729846921069878e-8,0.0040641096822484745,1.5782374878243806e-5,-5.687200018963553e-8,0.004064563196214051,1.558309622417832e-5,-5.646323142518138e-8,0.004065105372946402,1.5449401160722053e-5,-5.6186965778914343e-8,0.004065696400389077,1.5419375479983378e-5,-5.612111731815594e-8,0.004066288252635861,1.5506240841777267e-5,-5.6293121212787874e-8,0.004066836155862962,1.5698542971993716e-5,-5.668010909236039e-8,0.004067307459695976,1.5966009975132922e-5,-5.7220705532581126e-8,0.00406768613309999,1.6268363193234948e-5,-5.783296271933897e-8,0.004067972917711898,1.6564106468153707e-5,-5.8432340733695405e-8,0.004068182486831887,1.681727652571284e-5,-5.894554234053274e-8,0.00406833933892352,1.7001503611134662e-5,-5.931880776278692e-8,0.004068473756113949,1.7101841750667816e-5,-5.952159722920657e-8,0.004068618388467829,1.7115337876791556e-5,-5.9547687041123166e-8,0.004068805319711415,1.7051183194416186e-5,-5.941546370891142e-8,0.004069063045413328,1.693080237181354e-5,-5.9168176976249445e-8,0.004069412642286213,1.6787584460103433e-5,-5.887352588619779e-8,0.004069862675046376,1.6665125654505054e-5,-5.862021049541122e-8,0.0040704033862420915,1.6612132979317868e-5,-5.8507611354420696e-8,0.004071002433343476,1.6672362317351996e-5,-5.8625252169843815e-8,0.004071606146962371,1.6870078458229394e-5,-5.90230533337598e-8,0.004072150180031084,1.7195707718266797e-5,-5.968194828764344e-8,0.004072579327330133,1.7600304654934825e-5,-6.050250155157372e-8,0.004072869038903364,1.800622384140864e-5,-6.132663264350784e-8,0.004073036765467772,1.8332569931295446e-5,-6.1989505493645e-8,0.004073135737926338,1.852349328887892e-5,-6.237718185712606e-8,0.004073234663677566,1.85650892687075e-5,-6.246099877342193e-8,0.004073394556097025,1.848476914851136e-5,-6.229627231999442e-8,0.004073652726352091,1.833737723399551e-5,-6.199414171839608e-8,0.004074017372470005,1.818678426452505e-5,-6.168431508746106e-8,0.0040744707750797445,1.808984214398682e-5,-6.148259812586677e-8,0.004074977337424825,1.8085790232343694e-5,-6.14693541796517e-8,0.004075493263269258,1.8191439776279438e-5,-6.167952512829171e-8,0.004075975798354961,1.840124607827241e-5,-6.210249277646861e-8,0.004076390776901895,1.8691144047334405e-5,-6.268964660170682e-8,0.004076717622217568,1.902494399145827e-5,-6.336732629192284e-8,0.004076951353972912,1.9361837440099986e-5,-6.405219775676581e-8,0.004077101746210127,1.96635091438295e-5,-6.46659095300111e-8,0.0040771903314508785,1.989970237527024e-5,-6.514655672234517e-8,0.004077246262806788,2.005165635670929e-5,-6.545569860243698e-8,0.004077302032084395,2.0113486301099913e-5,-6.558109876386352e-8,0.0040773896466789,2.0092092019349717e-5,-6.553647593087778e-8,0.004077537342209875,2.0006253451383885e-5,-6.535969647604283e-8,0.004077766555167821,1.988527789663943e-5,-6.511016738314298e-8,0.004078088689458051,1.976710784085783e-5,-6.486516989220184e-8,0.004078501328342447,1.96951136887764e-5,-6.471343334262049e-8,0.004078984379126887,1.971216651307541e-5,-6.474300004433253e-8,0.004079498090171917,1.985082590723176e-5,-6.502100525056876e-8,0.004079986278779378,2.0120252289371937e-5,-6.55667052274478e-8,0.004080388235941525,2.0494122797303468e-5,-6.632662153528476e-8,0.004080659282108669,2.0908086133771597e-5,-6.716933519624624e-8,0.0040807921628955995,2.1274886377819846e-5,-6.791652262392293e-8,0.004080825530396653,2.151542116556529e-5,-6.840653341073122e-8,0.00408083076942298,2.1590301346052778e-5,-6.855881484240877e-8,0.00408088328291802,2.1513241158620907e-5,-6.84010788689678e-8,0.004081035155949392,2.134019848115492e-5,-6.804703209129059e-8,0.004081302546732209,2.1144355238359504e-5,-6.764545015636383e-8,0.004081668918553097,2.0992072249557375e-5,-6.733141248227607e-8,0.00408209685499066,2.092848134334002e-5,-6.719713964870882e-8,0.004082540990125184,2.09731231952271e-5,-6.72830951751148e-8,0.004082958197133572,2.112218615191573e-5,-6.758231956110174e-8,0.00408331422869279,2.1353847294547875e-5,-6.805099975797541e-8,0.0040835874057665485,2.1634567155020024e-5,-6.862106700376206e-8,0.004083770116681637,2.1925434668298697e-5,-6.921309213990532e-8,0.004083868551366543,2.218816882099307e-5,-6.974866033503243e-8,0.0040839008942840345,2.239039499761978e-5,-7.016132947403248e-8,0.004083894232067077,2.250978778831476e-5,-7.0405207142333e-8,0.004083880571241067,2.25366960163881e-5,-7.046030306590217e-8,0.00408389252947929,2.2475031488631666e-5,-7.033426314434203e-8,0.004083959249418965,2.2341562177163083e-5,-7.00608865512821e-8,0.004084102836943754,2.2163971654346905e-5,-6.969625158825354e-8,0.004084335399848269,2.1977972812721735e-5,-6.931302372966625e-8,0.004084656614019778,2.1823582213426522e-5,-6.899305140282665e-8,0.004085051725131036,2.1740298666453316e-5,-6.881758196303943e-8,0.00408549043013785,2.1760499615591525e-5,-6.88536205880247e-8,0.004085928134416261,2.1900671848150498e-5,-6.913569532030017e-8,0.0040863118371121795,2.215161693360532e-5,-6.964550832191338e-8,0.004086592559838579,2.2471365259167905e-5,-7.029728262333709e-8,0.004086743511323791,2.278742626781085e-5,-7.094245749548945e-8,0.004086777069432108,2.3014650869490377e-5,-7.140649996468963e-8,0.004086748324489586,2.3086554162397423e-5,-7.155319319147187e-8,0.004086737210606845,2.298478523801362e-5,-7.134486880118048e-8,0.0040868162246094596,2.274751838270059e-5,-7.085933294161156e-8,0.004087022774633262,2.245098166859568e-5,-7.025197183973786e-8,0.004087351063401967,2.21773293531232e-5,-6.969023534135919e-8,0.004087762942117613,2.1988078250473938e-5,-6.929965848306815e-8,0.004088206426731321,2.1912888693068682e-5,-6.914113536613453e-8,0.0040886315320029145,2.1951514131721826e-5,-6.921484527465759e-8,0.004088999563181579,2.2082048330308014e-5,-6.947683655171173e-8,0.004089286694209541,2.227007195705091e-5,-6.985740065000953e-8,0.0040894840997412005,2.2476260228544262e-5,-7.027641992708612e-8,0.004089596524746182,2.2662126678655353e-5,-7.065510425729817e-8,0.004089640201779963,2.2794420332461283e-5,-7.092513321189004e-8,0.0040896402838893646,2.284862699133553e-5,-7.103599943485881e-8,0.004089627705490863,2.2811697616913437e-5,-7.096068474456991e-8,0.004089635411507748,2.2683801109797253e-5,-7.069921973276663e-8,0.004089694115390104,2.2478677051700234e-5,-7.027932793650815e-8,0.004089828036207196,2.2222286505042233e-5,-6.975365444924291e-8,0.004090051161470819,2.1949786269337134e-5,-6.919369964114232e-8,0.004090364511991667,2.170103932630054e-5,-6.86808528694382e-8,0.004090754790796106,2.151498959955255e-5,-6.829506592183514e-8,0.004091194666195651,2.142330844766789e-5,-6.810185855541579e-8,0.004091644993372157,2.1443624281504225e-5,-6.813824314344391e-8,0.0040920596967446154,2.1572833523424404e-5,-6.83986719144852e-8,0.004092394222561333,2.1782031162445324e-5,-6.88243378416857e-8,0.00409261763274889,2.2016102025325163e-5,-6.93022303226837e-8,0.0040927261558925485,2.2201941671687712e-5,-6.968213454108016e-8,0.004092752390399775,2.226781056753669e-5,-6.98165868041908e-8,0.004092761828782771,2.217010941896625e-5,-6.961594162020133e-8,0.004092832347522563,2.191489742469643e-5,-6.90924145000651e-8,0.004093023916310563,2.1559197363135236e-5,-6.836256507621499e-8,0.004093355382863215,2.1188443825140062e-5,-6.760103065423595e-8,0.004093801442773309,2.0883140487863215e-5,-6.697239893387999e-8,0.004094308353665391,2.0693642127327703e-5,-6.657980636574702e-8,0.004094815962852751,2.0632674505226746e-5,-6.644971858931919e-8,0.0040952745320277885,2.068224872375703e-5,-6.654596569206641e-8,0.0040956524926629954,2.0806194730034872e-5,-6.67951505187713e-8,0.004095937126088291,2.0961685991746184e-5,-6.711000602505771e-8,0.004096131713874594,2.1107263596701378e-5,-6.740571701477901e-8,0.004096251810518326,2.1207630473032185e-5,-6.760979080112129e-8,0.004096321810660583,2.123646163530461e-5,-6.766796655208107e-8,0.004096371868974252,2.117828020698269e-5,-6.754820351325027e-8,0.004096434786498749,2.102987222746858e-5,-6.724363080817744e-8,0.0040965424713340064,2.0801158863912584e-5,-6.677428971329367e-8,0.004096721827951759,2.0514974467630822e-5,-6.618661611930796e-8,0.004096990403276643,2.0205057223031076e-5,-6.554934138305202e-8,0.004097352573177603,1.9911884762201487e-5,-6.494509874821933e-8,0.0040977972420050135,1.9676507214749987e-5,-6.445798705026133e-8,0.00409829795293573,1.953307645034436e-5,-6.415839226662203e-8,0.00409881595753222,1.950131413892924e-5,-6.408749767114518e-8,0.0040993062317397294,1.958041987144307e-5,-6.424454113672405e-8,0.004099725949858662,1.9745840788228674e-5,-6.457984351456717e-8,0.004100044534043069,1.9950335607570126e-5,-6.499672432697775e-8,0.004100253632198516,2.013084019847643e-5,-6.536554032319219e-8,0.004100374104936217,2.0221969791798727e-5,-6.555157283498206e-8,0.004100455954183344,2.017477740412432e-5,-6.545379905395303e-8,0.0041005675891791,1.9975516702515512e-5,-6.504358355699308e-8,0.004100774805833544,1.965545542492212e-5,-6.438482789008002e-8,0.004101116885460426,1.928372582152993e-5,-6.361922074229146e-8,0.004101591870619371,1.894360567216253e-5,-6.291755062884213e-8,0.004102159238000308,1.8703470116557066e-5,-6.242018269746027e-8,0.00410275747591571,1.859703517591237e-5,-6.219659152435074e-8,0.0041033257619690735,1.8620141853715126e-5,-6.223872071816769e-8,0.004103819526959297,1.874065523208672e-5,-6.248114525442182e-8,0.004104216341986781,1.8912959818053868e-5,-6.283064370406833e-8,0.004104514378076207,1.909031638156852e-5,-6.319144791179558e-8,0.004104727475774354,1.9232607115184218e-5,-6.348113509152911e-8,0.004104879851426564,1.931006277488053e-5,-6.363836365897142e-8,0.004105001750774871,1.9304641429037065e-5,-6.362581755356893e-8,0.004105126061105588,1.9210481227772614e-5,-6.343120965738759e-8,0.004105285298052878,1.903412670485694e-5,-6.306774716776545e-8,0.004105508333763851,1.879451414608241e-5,-6.257405625726658e-8,0.004105816518487927,1.8522105372562953e-5,-6.201237977882163e-8,0.004106219408261088,1.8256224455901378e-5,-6.146316659960243e-8,0.004106711031782206,1.8039834534071813e-5,-6.101448588822051e-8,0.00410726820104739,1.7911758794004197e-5,-6.074620274769431e-8,0.00410785241819564,1.7897526858302653e-5,-6.071123337928272e-8,0.004108416180285091,1.8001212401072268e-5,-6.091866896065255e-8,0.0041089130241994485,1.820113748087769e-5,-6.132469615222139e-8,0.004109309104207408,1.8451646262672002e-5,-6.183595690444913e-8,0.0041095931983087045,1.869153552715818e-5,-6.232669811154938e-8,0.004109782084836411,1.8857869433917337e-5,-6.266717936609684e-8,0.004109919049387194,1.890226775739589e-5,-6.275732940350907e-8,0.004110064678761718,1.8805497319272342e-5,-6.255697025959145e-8,0.004110281124285083,1.858555641793577e-5,-6.210261238000375e-8,0.004110613703963449,1.829511610327427e-5,-6.150227952510236e-8,0.004111076186029953,1.8007169267841526e-5,-6.090602884987728e-8,0.004111646199815092,1.779292050803584e-5,-6.046048759796877e-8,0.0041122733354077975,1.770055011084275e-5,-6.026514317284309e-8,0.0041128962379817155,1.774357289428051e-5,-6.034829633072815e-8,0.004113460777981091,1.790224628658376e-5,-6.06698069713779e-8,0.004113932211375858,1.8134726118468195e-5,-6.114390913053563e-8,0.004114298813701848,1.8391239948785017e-5,-6.166830949707429e-8,0.004114568894174971,1.862570592744579e-5,-6.214811466500701e-8,0.004114764817887481,1.8802594772439982e-5,-6.251002429640857e-8,0.004114916941016438,1.8899611324047082e-5,-6.270792853777051e-8,0.004115058788903396,1.8907892822336005e-5,-6.272336282371548e-8,0.004115223529956793,1.883126597625609e-5,-6.256398245923092e-8,0.00411544112890223,1.8685396522870248e-5,-6.226179188618023e-8,0.004115735426728429,1.8496880076378558e-5,-6.187126850283822e-8,0.004116120670135077,1.830166124887891e-5,-6.146615285795259e-8,0.0041165976094830435,1.8141735245261587e-5,-6.113275473128614e-8,0.0041171501459813615,1.8059102673713814e-5,-6.095761535265301e-8,0.0041177444298378775,1.808677278934742e-5,-6.100903876410642e-8,0.0041183326482072515,1.8238377845822922e-5,-6.131565461947553e-8,0.004118862644895194,1.8500025366803055e-5,-6.184947666116739e-8,0.004119291845670744,1.882888305936909e-5,-6.252277761117837e-8,0.004119600995524518,1.916129270179671e-5,-6.320463576506777e-8,0.004119802051454148,1.9429176950619105e-5,-6.375467477591138e-8,0.004119936452241972,1.9579389208801835e-5,-6.406297574667329e-8,0.004120063979010977,1.958911524116044e-5,-6.408192449547398e-8,0.004120246088908799,1.9472222424355246e-5,-6.383944294513096e-8,0.00412052913259154,1.927501773422856e-5,-6.343041897475507e-8,0.004120932292519319,1.906320686341203e-5,-6.299000026420115e-8,0.0041214433902594435,1.890409343719484e-5,-6.265701578056743e-8,0.004122023468462977,1.884920647966687e-5,-6.253815085908088e-8,0.004122618451191795,1.8922390072082127e-5,-6.268323571647604e-8,0.004123173897075194,1.911656377839061e-5,-6.307832429936484e-8,0.0041236480036418895,1.939920158835302e-5,-6.365677983994343e-8,0.004124019202185466,1.9723461236942205e-5,-6.432213367561228e-8,0.004124287288244285,2.0040448516884058e-5,-6.49734234542431e-8,0.004124469567213898,2.0308896945277934e-5,-6.552527867409888e-8,0.004124594685466592,2.050066336393985e-5,-6.591937018917111e-8,0.004124696486907284,2.0602417835979338e-5,-6.61279466825767e-8,0.004124809121272801,2.0614914334906605e-5,-6.615231627858997e-8,0.00412496354787499,2.055127128513555e-5,-6.601926590271963e-8,0.004125184918062037,2.0435134717556e-5,-6.57772755655983e-8,0.004125490124622406,2.029885113054249e-5,-6.549281651963915e-8,0.004125884999648892,2.0181120072676474e-5,-6.524562199853932e-8,0.004126361187835996,2.012312227810521e-5,-6.512079755335909e-8,0.004126893637683346,2.016202160381174e-5,-6.519543374690128e-8,0.0041274407643772945,2.0321520249793008e-5,-6.551902559572129e-8,0.0041279499280898095,2.0601210358685798e-5,-6.609131944530118e-8,0.00412836969991199,2.0969274287628928e-5,-6.684706034379096e-8,0.004128666706476001,2.1364544730577544e-5,-6.766013860494177e-8,0.0041288402130868545,2.1711284432474734e-5,-6.837410979895914e-8,0.0041289260941142205,2.1943052421982018e-5,-6.88515335136089e-8,0.0041289863790102055,2.2025323150899638e-5,-6.902071138081227e-8,0.004129088666642758,2.1966206179071726e-5,-6.889782614187511e-8,0.0041292849632450085,2.1811418243791324e-5,-6.857662713945957e-8,0.0041295982485091585,2.1627811881081866e-5,-6.819461136355642e-8,0.004130019713586947,2.1483464269815928e-5,-6.789215710034456e-8,0.004130514847826705,2.1431037977969292e-5,-6.777831067919666e-8,0.004131034556120914,2.1497848193685356e-5,-6.79102050168444e-8,0.0041315275855180284,2.1683260008845836e-5,-6.828741599827955e-8,0.0041319514162801475,2.196236627165169e-5,-6.885922779761631e-8,0.0041322797208666745,2.2294052841138688e-5,-6.95410620986726e-8,0.004132505435793167,2.2631076927335552e-5,-7.023526137874012e-8,0.004132639559466678,2.2929656701609897e-5,-7.085103297987233e-8,0.0041327068073958445,2.3156619956378226e-5,-7.131941152567361e-8,0.004132739789933165,2.329325563893979e-5,-7.160135080100659e-8,0.0041327732697304005,2.3336073204430915e-5,-7.168931655885992e-8,0.004132839498526474,2.3295362222597494e-5,-7.160425905283545e-8,0.00413296489491445,2.319267720853539e-5,-7.139037898864675e-8,0.004133167727447015,2.3058081690060263e-5,-7.110948143247038e-8,0.004133456251584568,2.2927368246838634e-5,-7.083536734083875e-8,0.004133826864680379,2.2838893766911416e-5,-7.064744138921729e-8,0.004134262246139552,2.2829234263837425e-5,-7.062178621276581e-8,0.004134730285875639,2.2926717969593375e-5,-7.081769093706275e-8,0.004135185707911027,2.31425991815179e-5,-7.125916402041035e-8,0.0041355769071945506,2.346164589422353e-5,-7.191520269449173e-8,0.004135859441965122,2.383687117408675e-5,-7.268874415754124e-8,0.00413601369908566,2.4195039750171892e-5,-7.342810252300716e-8,0.004136058529573073,2.4456681249135846e-5,-7.396855759155849e-8,0.004136050487278654,2.456513384479195e-5,-7.419258398190955e-8,0.004136065019007573,2.4509860369459744e-5,-7.407805053129414e-8,0.004136168231272512,2.4330162569653813e-5,-7.370577611668552e-8,0.004136394459822497,2.409789030051738e-5,-7.322376999160329e-8,0.0041367395368764786,2.389056192725738e-5,-7.279186780905995e-8,0.0041371686481556655,2.3768649735412706e-5,-7.253505860848046e-8,0.004137631091783037,2.3763952092816136e-5,-7.251957894397494e-8,0.0041380747660009765,2.3878490225956004e-5,-7.275049880309497e-8,0.004138456791204421,2.4090059448810835e-5,-7.318286374029693e-8,0.004138749601503419,2.4360668956780575e-5,-7.37387885346733e-8,0.004138943194899096,2.4645468588374668e-5,-7.4325712073413e-8,0.004139044422775969,2.49009409295305e-5,-7.485336553975188e-8,0.0041390740178470385,2.509158954761269e-5,-7.52478055388981e-8,0.004139062078858488,2.519450532721772e-5,-7.546109277291754e-8,0.004139042857680081,2.5201537323836e-5,-7.547591881161818e-8,0.004139049681730755,2.5119185084212284e-5,-7.530538123596477e-8,0.004139110696144454,2.4966623708413148e-5,-7.498882514872912e-8,0.004139245793706889,2.4772544989273615e-5,-7.458527889421062e-8,0.004139464664095014,2.4571523457755883e-5,-7.416602259172535e-8,0.0041397656452513715,2.4400247311316832e-5,-7.380696250121588e-8,0.004140135103394312,2.4293510720908743e-5,-7.358048043260725e-8,0.004140547313718007,2.427954414351527e-5,-7.354575599206736e-8,0.004140965413628404,2.4374141223041407e-5,-7.373639326420042e-8,0.004141344873455721,2.457362346913388e-5,-7.414551482757032e-8,0.004141641326420783,2.48483642172095e-5,-7.471205791422762e-8,0.0041418235765014145,2.5141002654557318e-5,-7.53169965475809e-8,0.004141889215372904,2.537511100337642e-5,-7.58014858398564e-8,0.004141874921065243,2.5477517766043897e-5,-7.601342829768719e-8,0.004141851043315424,2.5408217951499304e-5,-7.58696248028512e-8,0.004141897199717203,2.5181416417097176e-5,-7.539927233814727e-8,0.004142070032062376,2.4862233791190885e-5,-7.473692425033855e-8,0.004142382136416294,2.4539521848464896e-5,-7.406615519129582e-8,0.004142802962387187,2.4291862821753357e-5,-7.354938496791458e-8,0.004143276515293847,2.4165133492908547e-5,-7.328171206236878e-8,0.004143742610608551,2.416776805253065e-5,-7.328119646301892e-8,0.004144152149564842,2.427840550811608e-5,-7.350451056510971e-8,0.004144474270556827,2.4457891470911152e-5,-7.387144252687797e-8,0.004144697408744952,2.4660435604785124e-5,-7.428767698568889e-8,0.004144827026181618,2.484202674459949e-5,-7.466207837487929e-8,0.004144881994566124,2.4966196964502726e-5,-7.491871231531306e-8,0.0041448905048311665,2.500781452275799e-5,-7.500493400442998e-8,0.004144885711446158,2.4955282841337656e-5,-7.489617429690564e-8,0.004144901261135358,2.481120187725696e-5,-7.459741678649363e-8,0.004144966982912023,2.4591489692204364e-5,-7.41413441693972e-8,0.004145105121592094,2.4322991873659133e-5,-7.358329870301691e-8,0.004145327544473218,2.403980237268326e-5,-7.299364256044502e-8,0.004145634190738719,2.377879003345024e-5,-7.24485997969921e-8,0.0041460127758167105,2.3574818073592004e-5,-7.202053283003591e-8,0.00414643966336036,2.3455929817344242e-5,-7.17680808924154e-8,0.004146881876040019,2.343860803994068e-5,-7.172625974921142e-8,0.0041473004753961136,2.3523144481116746e-5,-7.189658153429537e-8,0.004147656007247302,2.3689506623327728e-5,-7.223811648289735e-8,0.004147916808771172,2.3895221603221915e-5,-7.266284458651311e-8,0.0041480699650081705,2.4078275121643128e-5,-7.304167053080141e-8,0.004148132195104441,2.4168654642653938e-5,-7.322864004199276e-8,0.004148154320381181,2.4109831376965727e-5,-7.310586674653458e-8,0.004148211444887462,2.388423375298592e-5,-7.263656875158706e-8,0.004148377033934869,2.3528252738308904e-5,-7.189610084153054e-8,0.004148691963497075,2.3123109596003326e-5,-7.105280147716092e-8,0.0041491473031022115,2.27629923552026e-5,-7.030185625864194e-8,0.004149691355374006,2.251899382813585e-5,-6.979067613092937e-8,0.004150253959921051,2.2418989460666156e-5,-6.957735617198645e-8,0.0041507716459602394,2.2449203170718728e-5,-6.963393426794152e-8,0.0041512023452277315,2.2568972898863263e-5,-6.987681903782312e-8,0.004151528686471275,2.2727414027209948e-5,-7.020106669410957e-8,0.004151754402958528,2.287579296648152e-5,-7.050582576156142e-8,0.004151898371708361,2.2974592076086222e-5,-7.070894000466604e-8,0.004151988885126911,2.2996670531363484e-5,-7.075363347500511e-8,0.004152058955955876,2.2928322974470473e-5,-7.061092750138042e-8,0.004152142382845093,2.2769356506527704e-5,-7.02799821925708e-8,0.0041522701226427315,2.253246200945357e-5,-6.978684571499767e-8,0.004152466791086021,2.2241707192617996e-5,-6.91812637823709e-8,0.004152747431065876,2.192983419561754e-5,-6.853098876725601e-8,0.004153115009949348,2.163416853510276e-5,-6.791329347391853e-8,0.004153559267504416,2.1391372281000134e-5,-6.740420502635174e-8,0.004154057371060857,2.1231670864169294e-5,-6.706668724391143e-8,0.004154576533781043,2.1173336928637963e-5,-6.693925978559595e-8,0.004155078480972005,2.121824985076246e-5,-6.702665399660066e-8,0.00415552544495053,2.1349266802329204e-5,-6.729405133405011e-8,0.004155887326128362,2.153005321203464e-5,-6.76663910045802e-8,0.004156149549489265,2.1708297200182368e-5,-6.803485371706521e-8,0.004156320429207047,2.18236504091612e-5,-6.827342868724723e-8,0.004156435436193511,2.1821325191162423e-5,-6.826745995209362e-8,0.004156554325266331,2.1670061717922965e-5,-6.795132318021076e-8,0.004156747395736589,2.137880483492358e-5,-6.734326680703699e-8,0.004157071827894007,2.100211751024774e-5,-6.655662407843876e-8,0.004157547507220719,2.0626045399976664e-5,-6.577030263586701e-8,0.004158146618620178,2.033725265562143e-5,-6.516458127082557e-8,0.0041588047435924405,2.0191197783449442e-5,-6.485500848833399e-8,0.00415944679960301,2.0196654226797564e-5,-6.486025586921148e-8,0.004160012347865569,2.0321627878139327e-5,-6.51143438105989e-8,0.004160468885463152,2.0512010737360385e-5,-6.550526134746365e-8,0.004160812154099564,2.071068901280456e-5,-6.591452917912113e-8,0.004161059067630895,2.087014425419266e-5,-6.624331294613351e-8,0.004161239040043181,2.095792204410952e-5,-6.642382604808944e-8,0.004161386829742425,2.095738077188751e-5,-6.642102047979822e-8,0.0041615375835493676,2.0866361049708102e-5,-6.622998144256762e-8,0.004161723445766619,2.069540030448162e-5,-6.587231810027344e-8,0.004161970833005958,2.0465957657424777e-5,-6.53924752623177e-8,0.004162297807662163,2.0208374532718804e-5,-6.485342857751e-8,0.004162711465524075,1.9958972538912966e-5,-6.433060157681065e-8,0.004163205788963567,1.9755721872438256e-5,-6.390289279020207e-8,0.004163760874885751,1.9632401292486634e-5,-6.364064398012052e-8,0.0041643445126078645,1.9611945515193513e-5,-6.359191191485507e-8,0.004164916661599382,1.9700370056451175e-5,-6.376982675484982e-8,0.004165436593260296,1.9883038081479463e-5,-6.414465536185601e-8,0.004165871533002719,2.0124840290481865e-5,-6.464389273479223e-8,0.004166204973161034,2.03750141868381e-5,-6.516203187808346e-8,0.0041664427071129,2.0576291719662896e-5,-6.557950750839939e-8,0.004166614831251215,2.067725739446178e-5,-6.578854573835485e-8,0.004166772201513261,2.064596860090837e-5,-6.572180046924913e-8,0.004166976394844767,2.0481684872547044e-5,-6.537706967734264e-8,0.004167283762105637,2.0220289969068403e-5,-6.482876722062341e-8,0.0041677270966903575,1.9928853053708316e-5,-6.42166276496646e-8,0.004168301889621721,1.9687639520167372e-5,-6.370817178698891e-8,0.004168964945397345,1.9564346141463034e-5,-6.344493463573707e-8,0.0041696482095524585,1.9591663234778752e-5,-6.349560115607152e-8,0.004170281928490304,1.975909669494271e-5,-6.383883261318782e-8,0.004170815776114936,2.002177562328637e-5,-6.438149484450375e-8,0.004171229165072177,2.0319307693815556e-5,-6.499787658365365e-8,0.004171529641595815,2.0594371506068787e-5,-6.556842529790701e-8,0.004171744205095692,2.08044574697309e-5,-6.600426377969002e-8,0.004171909319060356,2.0925909999591906e-5,-6.625570255367975e-8,0.004172063035543002,2.095283945319605e-5,-6.631007474738575e-8,0.004172240006446445,2.0893942567726186e-5,-6.618518936112582e-8,0.004172468631381149,2.0769185793469826e-5,-6.592244924085984e-8,0.00417276921141435,2.0606998287037323e-5,-6.558098507505531e-8,0.004173152263607924,2.044171213681954e-5,-6.523229587640529e-8,0.004173616699217774,2.0310521591751063e-5,-6.49539193513707e-8,0.004174148228173609,2.0249146804649307e-5,-6.482044670278411e-8,0.0041747190205534725,2.0285797724636808e-5,-6.489100076513135e-8,0.004175290038969232,2.043401685070224e-5,-6.519431780277011e-8,0.004175817138082009,2.0686286120805764e-5,-6.571531492271147e-8,0.004176260742955059,2.1011275247548487e-5,-6.638915896100802e-8,0.004176596947866172,2.135738903704526e-5,-6.710846106930013e-8,0.004176826283818876,2.1663316572518304e-5,-6.774516430718877e-8,0.004176976440504031,2.187329985370935e-5,-6.818241888125293e-8,0.004177097171342621,2.1952541600749897e-5,-6.834687461472092e-8,0.004177248393652027,2.1897850265493772e-5,-6.823110493770005e-8,0.004177484698447774,2.1740143881249863e-5,-6.789904756326871e-8,0.004177840456289382,2.153777152476557e-5,-6.74722389787032e-8,0.004178319648003268,2.1361956093379974e-5,-6.709951969906079e-8,0.004178893720907776,2.1277850737766288e-5,-6.69174602353876e-8,0.004179508920172153,2.1326593435868438e-5,-6.701273548062968e-8,0.00418010143870764,2.1514398644594126e-5,-6.739909921106913e-8,0.004180615325979776,2.181278040040501e-5,-6.801760816720763e-8,0.004181016588925626,2.2169477458321236e-5,-6.875930338309788e-8,0.004181298828271539,2.2524986894682156e-5,-6.949975199756988e-8,0.004181480040607371,2.282791399696808e-5,-7.013122390191389e-8,0.0041815939531634075,2.304443453220907e-5,-7.058260201965475e-8,0.004181680312312281,2.3160968578745368e-5,-7.082508197011263e-8,0.0041817771738139765,2.31820016723154e-5,-7.086767934850143e-8,0.004181916138040746,2.3125777208913207e-5,-7.074824050457918e-8,0.004182119981389813,2.301988109644779e-5,-7.052420786013162e-8,0.004182401587912403,2.2897560902910874e-5,-7.026493333350233e-8,0.004182763226082177,2.279464572132352e-5,-7.004528039888718e-8,0.004183195714757309,2.27463722411251e-5,-6.993905040066949e-8,0.0041836776903782045,2.2783245722880823e-5,-7.001037080800247e-8,0.004184175936522711,2.2925337371297516e-5,-7.030174363642383e-8,0.004184648351533992,2.3175376573468616e-5,-7.081948145094982e-8,0.00418505106926234,2.351265779926658e-5,-7.152078397866612e-8,0.00418534981740814,2.3891456557676195e-5,-7.231026107348822e-8,0.004185532699444083,2.4247798955379997e-5,-7.305402455302344e-8,0.0041856186975773695,2.4515523630203316e-5,-7.361333203789702e-8,0.004185656116733408,2.4647127383329684e-5,-7.388829334143641e-8,0.004185709463990267,2.4630561585255983e-5,-7.385309068068146e-8,0.004185839553237669,2.4494045601495442e-5,-7.356612233607162e-8,0.004186085175026919,2.4297013898756418e-5,-7.315119149276783e-8,0.004186453058714402,2.4111865678345753e-5,-7.275951997366621e-8,0.00418691819641979,2.4003918546233812e-5,-7.252797509274851e-8,0.004187432570247736,2.4015686123816057e-5,-7.254618294928173e-8,0.004187938527366445,2.4158751006996613e-5,-7.283932258420115e-8,0.00418838289655064,2.4413937365967342e-5,-7.336815666881627e-8,0.004188728513422404,2.4738606360928003e-5,-7.404399556996649e-8,0.00418896077263449,2.5078536869024493e-5,-7.475342352649681e-8,0.004189088187108331,2.5380979408035573e-5,-7.538568393181177e-8,0.004189137637378765,2.560542386655624e-5,-7.585541248978948e-8,0.004189146482758514,2.5729746333905715e-5,-7.611571356090715e-8,0.004189154226481784,2.5751295531856018e-5,-7.616056328669566e-8,0.004189195811872894,2.5684118435083626e-5,-7.601902615037475e-8,0.004189297432699497,2.55542284301067e-5,-7.574531169066045e-8,0.004189474640743976,2.539461358412779e-5,-7.54082984053367e-8,0.004189731923761839,2.5240920754474522e-5,-7.508253449426259e-8,0.004190062893369365,2.5127892543049684e-5,-7.484086743090381e-8,0.004190450577587119,2.508605327542561e-5,-7.474758404267058e-8,0.004190867863493793,2.5137902888573805e-5,-7.48504270355493e-8,0.004191278851066964,2.5293029167128904e-5,-7.517021445445091e-8,0.004191642553303303,2.55423836176811e-5,-7.568861108228818e-8,0.004191920429727899,2.585359199989586e-5,-7.633807975528864e-8,0.004192087961726734,2.6171043691637975e-5,-7.700197953776512e-8,0.0041921473996541884,2.6425138639552714e-5,-7.753404214212685e-8,0.004192134962329874,2.655208648022618e-5,-7.780007245043969e-8,0.004192114992464122,2.6518357750800253e-5,-7.772933711625707e-8,0.004192159595389882,2.6337159580545134e-5,-7.734907825665287e-8,0.0041923223662205,2.6066037508450072e-5,-7.677941655751047e-8,0.004192619875803577,2.578592305862587e-5,-7.618950486964727e-8,0.0041930293080447165,2.557321200031067e-5,-7.57392457018824e-8,0.004193500258489232,2.5478197525003033e-5,-7.553431849801728e-8,0.004193972401104941,2.5516253407646417e-5,-7.560771560475328e-8,0.004194391412284077,2.5670481527066318e-5,-7.592504671513956e-8,0.004194719476384159,2.5901118869691845e-5,-7.640387556528128e-8,0.004194939943894964,2.6157253045760205e-5,-7.693795310378307e-8,0.004195057196908215,2.6387965736528168e-5,-7.742045708403442e-8,0.004195093049339342,2.655137914482246e-5,-7.776307074307687e-8,0.0041950809049979216,2.662075619193178e-5,-7.790902792572845e-8,0.0041950589164355375,2.6587196549228087e-5,-7.783901651533447e-8,0.004195063418449753,2.6459035460426867e-5,-7.75700484300396e-8,0.004195123687424457,2.6258649342688074e-5,-7.714875237095379e-8,0.004195258624765763,2.6017731648806405e-5,-7.664139315682479e-8,0.0041954753979068695,2.5772178721423704e-5,-7.612311259338277e-8,0.004195769575099257,2.5557431308106203e-5,-7.566822001278618e-8,0.004196126138573454,2.540453466231477e-5,-7.534204817948078e-8,0.004196520954855405,2.53367037714102e-5,-7.51938225051339e-8,0.004196922622790946,2.5365966871741377e-5,-7.524954946219042e-8,0.004197295156724912,2.5489504985313087e-5,-7.550410520029874e-8,0.004197602564194241,2.5685951525308174e-5,-7.591317047680027e-8,0.004197816369561635,2.5913292788382522e-5,-7.638861304882352e-8,0.004197925960352721,2.6111518336327034e-5,-7.68040568734833e-8,0.004197949030411529,2.6213720596972247e-5,-7.701841069760118e-8,0.004197935777056729,2.6166841984154432e-5,-7.691972134593537e-8,0.004197959246279704,2.5955973534895593e-5,-7.647632694596954e-8,0.004198090449018128,2.561816100677808e-5,-7.576574198158926e-8,0.0041983690577137925,2.523320397695459e-5,-7.495518310321368e-8,0.00419878704502883,2.4893403872054307e-5,-7.423809664192561e-8,0.004199294657828197,2.466944744060831e-5,-7.37627848726335e-8,0.004199822567905109,2.4590529631573546e-5,-7.35909004360926e-8,0.004200305861270729,2.4644214422214637e-5,-7.369713717322046e-8,0.0042006995521685,2.478930388189759e-5,-7.399597656866322e-8,0.0042009837510207735,2.497203494463084e-5,-7.437531825774549e-8,0.004201161612568837,2.5139530804678885e-5,-7.472443695283559e-8,0.0042012538478359,2.524867550071118e-5,-7.495254886807737e-8,0.004201292331705662,2.527094607106964e-5,-7.49991216701699e-8,0.00420131393742547,2.5194311755950153e-5,-7.483814941996342e-8,0.004201354951284227,2.502295376661067e-5,-7.447781373617757e-8,0.0042014462866753815,2.4775206437341213e-5,-7.395626000164893e-8,0.004201609778427287,2.448005996210069e-5,-7.333420007618452e-8,0.004201855844869758,2.4172631007671907e-5,-7.268529378705414e-8,0.004202182698645817,2.3889171851144942e-5,-7.208562808425933e-8,0.004202577017310062,2.3662279170995062e-5,-7.160372968477706e-8,0.004203015758641201,2.351672818202007e-5,-7.129194406720078e-8,0.004203468829726377,2.3466037764782944e-5,-7.11792747736706e-8,0.004203902457944527,2.3509754658052647e-5,-7.126556074908164e-8,0.004204283346550584,2.3631449505063676e-5,-7.151698648158335e-8,0.004204584061959764,2.3797752657327603e-5,-7.186374646115213e-8,0.0042047900364866496,2.3959694992948275e-5,-7.22027000677904e-8,0.0042049075001769935,2.4058568751254713e-5,-7.240978381987185e-8,0.004204969667533672,2.4038460412971196e-5,-7.23666645880367e-8,0.004205036113172845,2.386531479855544e-5,-7.200115046387884e-8,0.004205179685910332,2.3546624248548318e-5,-7.132872503889457e-8,0.0042054607744250174,2.313929579412769e-5,-7.046897812798647e-8,0.00420589989798239,2.27347232082449e-5,-6.961404483515537e-8,0.004206466015888612,2.242427014344388e-5,-6.895601774624227e-8,0.004207089445384607,2.2264274521212205e-5,-6.861351443079364e-8,0.004207690765000283,2.2260358548173973e-5,-6.859880736537034e-8,0.004208207794816714,2.2375384589948536e-5,-6.883449347627073e-8,0.004208608832725967,2.2550256047354552e-5,-6.919700655526116e-8,0.004208892174623421,2.2724239908018644e-5,-6.955907850228315e-8,0.0042090782601795,2.284808125073127e-5,-6.981713891001085e-8,0.004209200296160906,2.2889691428958756e-5,-6.990328564693268e-8,0.004209296350094005,2.283492007234416e-5,-6.97870980120373e-8,0.004209403565906254,2.268592751806816e-5,-6.947247890090181e-8,0.004209554005893156,2.2458595057271006e-5,-6.899240475833879e-8,0.004209771538720962,2.2179411033598958e-5,-6.840241608206303e-8,0.00421006954601963,2.1881833085248087e-5,-6.777287276654248e-8,0.0042104495193963105,2.1602047665670182e-5,-6.717991814560981e-8,0.0042109008189892645,2.137421177667367e-5,-6.669544160393412e-8,0.004211401868604031,2.1225620883696596e-5,-6.637699983388579e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_25.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_25.json deleted file mode 100644 index 56ed583d..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_25.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":25000,"numberOfSamples":1000,"samples":[0.0042119228229227776,2.117242668988509e-5,-6.625892772821196e-8,0.00421242951621424,2.1216421815835606e-5,-6.634559593072919e-8,0.004212888396602669,2.1343324948057996e-5,-6.660764965178544e-8,0.004213272077688695,2.1522955697259163e-5,-6.698208934125665e-8,0.004213565153061029,2.171164617537871e-5,-6.737707330135306e-8,0.004213769823711238,2.1857483451438128e-5,-6.768286051317844e-8,0.004213910198871436,2.190927122349849e-5,-6.779084064030356e-8,0.004214032922657624,2.1829493537962127e-5,-6.762116816618272e-8,0.004214200852587069,2.160938196621095e-5,-6.71548148810529e-8,0.004214477322022827,2.1280462370500936e-5,-6.645802296286292e-8,0.004214903100503305,2.091373094832423e-5,-6.568048925307495e-8,0.004215475880773675,2.0600151223130995e-5,-6.501412598684065e-8,0.004216145898744334,2.0417442948628495e-5,-6.462301093688222e-8,0.004216833579580056,2.0400376819345232e-5,-6.458079850055622e-8,0.004217459970123071,2.053157579362677e-5,-6.485132807375522e-8,0.004217972502130171,2.0755398012646987e-5,-6.531780445307867e-8,0.004218354775674382,2.100283844312381e-5,-6.583514699901046e-8,0.004218621473875984,2.1213061032032433e-5,-6.627523661803764e-8,0.004218806437975746,2.1344829856945014e-5,-6.655094448616457e-8,0.0042189509605779895,2.1378863630848206e-5,-6.662115374902181e-8,0.004219095409105211,2.1315105530184897e-5,-6.648517553484988e-8,0.004219274283414654,2.1168357298914947e-5,-6.617374421911176e-8,0.0042195135261831026,2.0964046864058137e-5,-6.574021509881736e-8,0.0042198289277669875,2.0734467344645254e-5,-6.52526270229363e-8,0.004220225061155502,2.0515161357874974e-5,-6.478598265567233e-8,0.004220694716869642,2.0341013243499278e-5,-6.441392136515793e-8,0.004221219187507694,2.024179213121955e-5,-6.419932023758131e-8,0.004221769966808666,2.0237378693578086e-5,-6.418431147260425e-8,0.0042223122778394,2.033346797221274e-5,-6.438129961003437e-8,0.004222810379006872,2.051879431947242e-5,-6.47670814186124e-8,0.0042232340746766765,2.0764877854194254e-5,-6.528213506219293e-8,0.004223565395287756,2.1029006330211313e-5,-6.583665389689409e-8,0.004223804128873946,2.1260585340412296e-5,-6.632374566900979e-8,0.004223970876957566,2.1410361180324564e-5,-6.663887945834917e-8,0.004224106369310762,2.14415465441151e-5,-6.670356203916723e-8,0.0042242657983087495,2.134115638552841e-5,-6.648957977625455e-8,0.004224507399419219,2.112855412696634e-5,-6.603731852191216e-8,0.004224876159364572,2.085686994094544e-5,-6.545888489491197e-8,0.004225386732174476,2.0603067839644234e-5,-6.491709513429656e-8,0.004226013160943935,2.0446027498544085e-5,-6.457905743766462e-8,0.004226693128151923,2.043932475634994e-5,-6.45585312505897e-8,0.004227347974683707,2.059163946791718e-5,-6.487440472016235e-8,0.004227909703767054,2.086563813515611e-5,-6.544822544194953e-8,0.004228341362829596,2.1195202646072075e-5,-6.614053530613902e-8,0.004228642402086946,2.1510125092377255e-5,-6.680302045077538e-8,0.004228840647210552,2.1755805619472572e-5,-6.732012834688552e-8,0.004228978598476052,2.190213346099413e-5,-6.762786101905045e-8,0.0042291010496863166,2.194302357527711e-5,-6.771287814009528e-8,0.0042292470592518745,2.1891133200885374e-5,-6.760145956889963e-8,0.004229446049571827,2.1771621167792976e-5,-6.73464393792848e-8,0.004229716468222322,2.1616855272094037e-5,-6.701607817399818e-8,0.004230065522044785,2.146232151279719e-5,-6.668539495546459e-8,0.004230489183412082,2.134317016838142e-5,-6.642880367863476e-8,0.004230972374903851,2.12906866823376e-5,-6.631261090471438e-8,0.004231489771832401,2.132821216102119e-5,-6.638640134078987e-8,0.00423200798906628,2.1466603019303647e-5,-6.667347585959588e-8,0.004232489876042049,2.1700112891328544e-5,-6.716214332465655e-8,0.004232901078212662,2.2004253231900497e-5,-6.780110661848243e-8,0.0042332180115707534,2.233735468493118e-5,-6.850259405413669e-8,0.004233435294041164,2.264690582136456e-5,-6.915558955274176e-8,0.004233570081750011,2.288024682846949e-5,-6.964836523197342e-8,0.004233661175459219,2.299740945877807e-5,-6.989570010663392e-8,0.00423376212210765,2.298272324126421e-5,-6.986362270031153e-8,0.004233929261141872,2.2851697779811398e-5,-6.958422181245012e-8,0.004234207211841524,2.2650495622957343e-5,-6.915475814576002e-8,0.004234615425259081,2.2446809897144912e-5,-6.871849564593151e-8,0.004235140014210337,2.231313047848069e-5,-6.842929415254376e-8,0.004235734703969059,2.230620625541042e-5,-6.840801170460767e-8,0.004236332511029088,2.2449320169543877e-5,-6.870475534746973e-8,0.004236865352914913,2.2724777630289437e-5,-6.928273029224622e-8,0.004237284245080581,2.3080599212484498e-5,-7.003223837757029e-8,0.004237571736415137,2.3448608166368112E-05,-7.080893495957507e-8,0.004237742342841121,2.3765484141766943e-5,-7.147847424023432e-8,0.004237833085799702,2.3988137660734125e-5,-7.194917126202141e-8,0.004237890189882673,2.4099447950975766e-5,-7.218425790080511e-8,0.004237957595590428,2.4105773514283147e-5,-7.219670738284095e-8,0.004238069919582637,2.4030269658422523e-5,-7.203516533111505e-8,0.004238249618365501,2.39056679238968e-5,-7.176871236223504e-8,0.004238506777009503,2.376842054507791e-5,-7.14744782604305e-8,0.004238839960336995,2.3654485763485328e-5,-7.122870298290076e-8,0.004239237195182148,2.359612316887198e-5,-7.109993006965748e-8,0.00423967689584437,2.3618836515735366e-5,-7.114251881836275e-8,0.00424012919339875,2.3737839999153642e-5,-7.138914208350213e-8,0.004240558555859129,2.3954028829091893e-5,-7.184219988672258e-8,0.004240928632216016,2.425035359666654e-5,-7.246603747851151e-8,0.004241209686151803,2.4590515496345863e-5,-7.31840475098621e-8,0.004241387602314709,2.4922420371615704e-5,-7.388587732093796e-8,0.00424147157146284,2.5187961743731242e-5,-7.44481247159738e-8,0.004241496426214619,2.5338027012562994e-5,-7.476619148263978e-8,0.004241516665120159,2.53481927416961e-5,-7.478765248745461e-8,0.004241592614544567,2.5228750538790737e-5,-7.453362965654456e-8,0.004241773093309497,2.5024267468472517e-5,-7.409800415341168e-8,0.004242080828456248,2.480219962828495e-5,-7.362345063271682e-8,0.004242505642303187,2.463448176734963e-5,-7.326256531566072e-8,0.004243007230734643,2.4578174120876555e-5,-7.313688342900408e-8,0.004243526169055569,2.4660842178798045e-5,-7.330574786416262e-8,0.004243999680967984,2.4874463362710607e-5,-7.375310120416703e-8,0.0042443776570801894,2.5179193207145155e-5,-7.439515440950807e-8,0.004244634361830328,2.551555261019759e-5,-7.510602778954726e-8,0.0042447725833558445,2.5820973313206575e-5,-7.575282082432305e-8,0.004244819645713096,2.6045265557054406e-5,-7.622855268466984e-8,0.004244817657500771,2.6160427534331055e-5,-7.647316726976563e-8,0.004244812063322777,2.6162998914343238e-5,-7.647870316326475e-8,0.004244842201737484,2.6070232563465724e-5,-7.628128320228887e-8,0.004244935733735506,2.5913058455968382e-5,-7.594622609168704e-8,0.004245106822619801,2.572872050475992e-5,-7.555241538069889e-8,0.004245356804103788,2.5554802441117856e-5,-7.517960510152853e-8,0.004245675934005867,2.5425040582432493e-5,-7.48995353162313e-8,0.004246045266184226,2.53664067068817e-5,-7.47697603900719e-8,0.004246438382144604,2.5396616745149382e-5,-7.482836234073875e-8,0.004246823330043397,2.552139706651534e-5,-7.508808847131201e-8,0.004247165619004974,2.5731389115804212e-5,-7.55296442638736e-8,0.004247433275937945,2.5999499171301278e-5,-7.609589214748047e-8,0.0042476044631466715,2.6280705900143398e-5,-7.669131102787287e-8,0.004247676613223559,2.6517177808645175e-5,-7.719284879324458e-8,0.004247673609435171,2.6650746595202952e-5,-7.747651982304646e-8,0.004247645708001549,2.66412350943042e-5,-7.74564776254694e-8,0.004247658309913079,2.6483856580341366e-5,-7.712204781528955e-8,0.004247771456591539,2.6216061034290582e-5,-7.655226898516179e-8,0.004248018640476505,2.590800755606473e-5,-7.589568494417051e-8,0.004248395212570714,2.563994069145496e-5,-7.532244221725396e-8,0.004248861259489376,2.5477021622606432e-5,-7.497104067998361e-8,0.00424935590167607,2.5452038700586148e-5,-7.491170753332291e-8,0.004249815624233812,2.5560514080836893e-5,-7.513587325912593e-8,0.0042501900081495896,2.5766672608186727e-5,-7.556853344785969e-8,0.004250451383611506,2.6015861961209102e-5,-7.609427999654669e-8,0.0042505977356969114,2.6248914551540066e-5,-7.658758795271883e-8,0.0042506498090625795,2.6415031884901112e-5,-7.694017883491166e-8,0.004250644097952955,2.648096828203765e-5,-7.708071584908982e-8,0.0042506237812728765,2.6435303290169302e-5,-7.698415129034421e-8,0.004250629816343292,2.6287691938557887e-5,-7.667036324682085e-8,0.0042506940711203485,2.6064200669597658e-5,-7.619435383064163e-8,0.00425083548128867,2.5800616341765846e-5,-7.563201480582007e-8,0.004251059186062351,2.5535598231431913e-5,-7.506549954746807e-8,0.004251357853991461,2.5304981396812947e-5,-7.457106386619228e-8,0.004251714123475805,2.5137752884505912e-5,-7.421052674232194e-8,0.004252103288002902,2.5053445751813735e-5,-7.402578044122805e-8,0.0042524958808914486,2.5060282096586535e-5,-7.403485203242214e-8,0.004252860347046862,2.5153483119387155e-5,-7.422821487858902e-8,0.004253166420302202,2.5313592833064807e-5,-7.4565027741937e-8,0.004253390056795452,2.5505445065978426e-5,-7.497072826604751e-8,0.004253520373611728,2.567954717105097e-5,-7.533987563241299e-8,0.004253567583483577,2.5778553226866115e-5,-7.555000192971296e-8,0.004253568477479618,2.57508981459835e-5,-7.549083696491824e-8,0.004253583802551681,2.5570092233629636e-5,-7.51055603806773e-8,0.004253683035294351,2.5251865633977112e-5,-7.44273175308893e-8,0.0042539191944363595,2.4857202588394434e-5,-7.35855734003273e-8,0.004254305764216735,2.447438286380503e-5,-7.276784994537231e-8,0.004254809815918776,2.4186839495990022e-5,-7.215147164839955e-8,0.004255365549942023,2.40441206534225e-5,-7.184200794898621e-8,0.004255899200387112,2.4050089820884473e-5,-7.184826829956902e-8,0.0042563516080044266,2.416972185021108e-5,-7.209662433728606e-8,0.004256690396141003,2.434605252160264e-5,-7.246675786316027e-8,0.0042569115892744334,2.4517943449023026e-5,-7.282912443145628e-8,0.0042570344588616455,2.463347637775471e-5,-7.30732558512375e-8,0.0042570934805204125,2.465775417313392e-5,-7.312438614433928e-8,0.004257129932313604,2.4575925834567138e-5,-7.295011734563332e-8,0.0042571843494951115,2.4392667825468296e-5,-7.255962537821784e-8,0.00425729039774817,2.4129023933815476e-5,-7.199717208281165e-8,0.004257470606229811,2.3817370327804808e-5,-7.133146006679518e-8,0.004257734255741909,2.349544247400287e-5,-7.064283667735547e-8,0.004258077393204028,2.3200390137071024e-5,-7.001050679824002e-8,0.004258484618862725,2.2963666553012255e-5,-6.950158216921607e-8,0.004258932027056634,2.2807293789006354e-5,-6.916316297269846e-8,0.0042593906153518026,2.2741586385370254e-5,-6.901757022449099e-8,0.0042598297434363165,2.276399055898611e-5,-6.905989169541386e-8,0.004260220606168873,2.2858651267932304e-5,-6.925694232532747e-8,0.004260539991874552,2.2996585299082128e-5,-6.954740578872719e-8,0.004260774793749827,2.3136869567961894e-5,-6.984415171021355e-8,0.004260927452055153,2.3230106921002925e-5,-7.004155848425731e-8,0.004261021309681241,2.3226075701983406e-5,-7.003196358517582e-8,0.004261102938290243,2.308688722779646e-5,-6.9733984200722e-8,0.004261236712509181,2.2804045770392858e-5,-6.912910597515336e-8,0.004261487734137989,2.2412204909363093e-5,-6.829103484152083e-8,0.004261895857940792,2.1987951130290533e-5,-6.738297115674651e-8,0.004262453748847359,2.1626559517556065e-5,-6.660796308383029e-8,0.004263104835077354,2.14049565306401e-5,-6.613002381831203e-8,0.004263765230072934,2.1352073118542486e-5,-6.601108302348439e-8,0.004264356348996169,2.14434400684497e-5,-6.619951822339648e-8,0.00426482929740014,2.1618744627758198e-5,-6.656745990661841e-8,0.004265171943391067,2.1807560186110623e-5,-6.696539410340849e-8,0.004265402331610535,2.194966411597293e-5,-6.726522140368924e-8,0.004265556764276095,2.2005321336605362e-5,-6.738204521109695e-8,0.004265678484351986,2.1957407300082035e-5,-6.727876331639272e-8,0.004265809259589074,2.1808924150594526e-5,-6.696101507231523e-8,0.004265983904005325,2.1578682448027443e-5,-6.646826954849454e-8,0.004266226920993157,2.1296504146896058e-5,-6.586379168206377e-8,0.004266550629286272,2.0998265292050864e-5,-6.522408289024045e-8,0.004266954602654954,2.072086530767614e-5,-6.46280184319503e-8,0.0042674264408546,2.0497353315112702e-5,-6.414629674705478e-8,0.004267943861511287,2.0352576012947905e-5,-6.383209365453901e-8,0.004268477960877023,2.0299833661802612e-5,-6.371398436365584e-8,0.004268997253092252,2.0338959047789847e-5,-6.379193925228933e-8,0.004269472004022922,2.0455923406950072e-5,-6.403649435074647e-8,0.004269878504480831,2.0623872099556896e-5,-6.439082513227808e-8,0.004270203091943123,2.0805512560485156e-5,-6.477560803074754e-8,0.004270445852852126,2.0956944805511876e-5,-6.509700275244613e-8,0.004270623800199121,2.10334314266037e-5,-6.525895403540025e-8,0.004270772558072353,2.0997890319405713e-5,-6.518152289098647e-8,0.00427094441011345,2.083220432249813e-5,-6.482534637528951e-8,0.004271199798210908,2.05492416329248e-5,-6.421755267416815e-8,0.00427159041645784,2.0199863007888447e-5,-6.346677840095314e-8,0.004272137010630017,1.986641311092636e-5,-6.274914812415897e-8,0.004272812866192905,1.9637907019181664e-5,-6.225512618287865e-8,0.004273546661830289,1.957484111226967e-5,-6.211428300886088e-8,0.004274248084309201,1.9683554754882735e-5,-6.234052528862284e-8,0.004274842584556,1.9916585609271047e-5,-6.283284863669002e-8,0.004275294989396107,2.0196932839426866e-5,-6.34271221447608e-8,0.004275612111248886,2.044876157713103e-5,-6.396157774097112e-8,0.004275829854443942,2.0618302854561106e-5,-6.432132893338302e-8,0.004275996344867708,2.068048102350494e-5,-6.445246254988373e-8,0.004276158761153353,2.0635703336763096e-5,-6.435525871581819e-8,0.00427635575964747,2.050278681984088e-5,-6.406929194779216e-8,0.004276614264766545,2.03118344130943e-5,-6.365844604760266e-8,0.004276948681532183,2.0098462742130343e-5,-6.319870838452115e-8,0.00427736112987467,1.9899240304877655e-5,-6.276838480380487e-8,0.004277842211255956,1.974773290141609e-5,-6.243949971073313e-8,0.004278372391904025,1.967077619426468e-5,-6.226968673760751e-8,0.004278924276628769,1.9684968915617704e-5,-6.229464867897638e-8,0.00427946603046503,1.9793798937027695e-5,-6.252207128612635e-8,0.004279965907331355,1.9986115124125946e-5,-6.292842834492383e-8,0.004280397398965965,2.0236567080278434e-5,-6.345990398536185e-8,0.004280744247696593,2.0508303055502708e-5,-6.403801521126411e-8,0.004281004505802116,2.075787626038736e-5,-6.45698971255669e-8,0.004281192901995228,2.0941958152062637e-5,-6.496252518206134e-8,0.004281340930710332,2.1025255578912166e-5,-6.513969573609285e-8,0.004281494037741554,2.0988991621400003e-5,-6.506040387677097e-8,0.004281705020143845,2.083884172795236e-5,-6.473613988226346e-8,0.004282022932066112,2.0609966237029076e-5,-6.424190093837948e-8,0.004282478182800925,2.0365345667199266e-5,-6.371269223823294e-8,0.004283067616495902,2.018344302717714e-5,-6.331700549222439e-8,0.004283747241477742,2.0134651144824004e-5,-6.320619458649664e-8,0.0042844407554519515,2.0253973496551404e-5,-6.345578723847007e-8,0.004285064598384449,2.0524555265033713e-5,-6.403009214368057e-8,0.004285558228008341,2.0883667246896797e-5,-6.479498002189184e-8,0.004285903068305841,2.1248575485531713e-5,-6.557331881327865e-8,0.004286121591209917,2.1546759971092086e-5,-6.620971443688664e-8,0.004286261550244254,2.173512138139228e-5,-6.661161891835543e-8,0.004286377010822107,2.1803562222643158e-5,-6.675698118613891e-8,0.004286514639174886,2.1767962224157696e-5,-6.667927461907289e-8,0.004286707249844844,2.1659831340824737e-5,-6.644549978914754e-8,0.004286972651294204,2.1517288514130502e-5,-6.613702981233638e-8,0.004287315036407035,2.137879459328305e-5,-6.583625969488997e-8,0.004287726996196279,2.1279125575024203e-5,-6.561792724729806e-8,0.00428819142343141,2.1246497524740444e-5,-6.554282703858169e-8,0.004288683412819257,2.1300005175710134e-5,-6.56522121072733e-8,0.004289172646002349,2.144705325197606e-5,-6.596225331674356e-8,0.004289626831671317,2.1681083267848825e-5,-6.64591918001667e-8,0.004290016489747565,2.1980505883871905e-5,-6.709706780234995e-8,0.0042903207017423875,2.2309974166205005e-5,-6.780039689973465e-8,0.004290532704681695,2.2624802256956494e-5,-6.847351420232322e-8,0.004290663720481053,2.2878545281189634e-5,-6.901668815447957e-8,0.004290743428588021,2.3032647343331645e-5,-6.934675430215987e-8,0.004290816160740989,2.3066060527652307e-5,-6.941783186631997e-8,0.004290932973482719,2.298241860165485e-5,-6.923692897416443e-8,0.004291140720082246,2.281268438762679e-5,-6.886989001401675e-8,0.004291469988513568,2.261171092999127e-5,-6.843422945885471e-8,0.0042919245712092595,2.244789438370406e-5,-6.807700264279899e-8,0.004292475971297328,2.238658804783379e-5,-6.793912075922681e-8,0.004293066649609138,2.2470558774809148e-5,-6.811318501504072e-8,0.004293623937526895,2.2703998892035536e-5,-6.860890598586648e-8,0.0042940818493636184,2.304812006375384e-5,-6.934344898792616e-8,0.004294402362672422,2.3432831436448893e-5,-7.016645002765099e-8,0.004294586104386337,2.378055743966283e-5,-7.091121590795328e-8,0.004294667795317409,2.4030920659155234e-5,-7.144780929009046e-8,0.004294700566059802,2.4155324165777983e-5,-7.171440891510901e-8,0.004294738209100082,2.4157840931771394e-5,-7.171925710040148e-8,0.0042948226573763385,2.4066452881318333e-5,-7.152192906009953e-8,0.004294978812281802,2.3921337639631674e-5,-7.120830502904449e-8,0.004295214901080934,2.3765000948817973e-5,-7.08694876550506e-8,0.004295525436407369,2.363587044291823e-5,-7.058807624485363e-8,0.004295894601684546,2.3564786623837452E-05,-7.04305813207749e-8,0.004296299122201778,2.357308522950433e-5,-7.044321503200956e-8,0.004296710657229467,2.367115187319423e-5,-7.064870539544668e-8,0.004297098295590391,2.38568917503796e-5,-7.104295898373251e-8,0.004297431906932636,2.4114275885103977e-5,-7.159190498213205e-8,0.004297686870625992,2.4412901902798002e-5,-7.223050607165677e-8,0.004297849991681794,2.4710049162891303e-5,-7.286710575334312e-8,0.004297925302316519,2.4956591162591826e-5,-7.339606327152146e-8,0.004297937372396556,2.5107015043400802e-5,-7.371925088269417e-8,0.004297929510021779,2.5131737805527713e-5,-7.377254984435431e-8,0.004297955548234345,2.5027789983162344e-5,-7.354890403274291e-8,0.004298066575615005,2.4823310836198834e-5,-7.310812995376074e-8,0.004298296552607654,2.4573070322224938e-5,-7.256747872959403e-8,0.004298651648983001,2.434559188780995e-5,-7.207413756368472e-8,0.004299106911661393,2.4205518413300738e-5,-7.176741926718479e-8,0.004299611453430702,2.4196312655059432e-5,-7.174150839999789e-8,0.0043001009376553104,2.4328171010078167e-5,-7.201924724959771e-8,0.004300514215980978,2.45747458074727e-5,-7.254478183774332e-8,0.00430080955408668,2.4880164403869278e-5,-7.319841098782959e-8,0.00430097535914321,2.5174795560467062e-5,-7.383040760602065e-8,0.004301031639911904,2.5394822709818133e-5,-7.430318462394381e-8,0.004301021854896047,2.549876742515806e-5,-7.452698087324046e-8,0.004300998826632299,2.5475424898201563e-5,-7.447707677090092e-8,0.0043010105133326326,2.5341837209243172e-5,-7.418955573869462e-8,0.00430109035070397,2.513426620792213e-5,-7.374198268112992e-8,0.004301253742716078,2.48970164755011e-5,-7.32294267491531e-8,0.004301499427306543,2.467299592201586e-5,-7.274417707510015e-8,0.0043018132999952385,2.4497627550464064e-5,-7.236262240548909e-8,0.004302172657874503,2.4395814589290057e-5,-7.213867310051331e-8,0.004302549817683467,2.4380785913499932e-5,-7.210122313442096e-8,0.0043029149958991805,2.44536492446394e-5,-7.225313252007961e-8,0.004303238964457443,2.460296377691644e-5,-7.2570238773880585E-08,0.00430349625434463,2.4804348391217722e-5,-7.300042578258291e-8,0.0043036695281246816,2.50209511462533e-5,-7.34645445614565e-8,0.0043037550770795956,2.5206324498041653e-5,-7.386254745634518e-8,0.004303768148276709,2.5311391686062272e-5,-7.408849797523384e-8,0.004303745290754547,2.5296058710614142e-5,-7.405564302472968e-8,0.0043037402219377715,2.5143263129179642e-5,-7.372674513257676e-8,0.004303811401843918,2.486984655474745e-5,-7.31375476237472e-8,0.004304003924871586,2.452738717704159e-5,-7.239861410051003e-8,0.004304332998053507,2.4189634346796077e-5,-7.166837537127397e-8,0.004304777053220583,2.3930305794275484e-5,-7.110548942813876e-8,0.0043052839373079,2.380055815885997e-5,-7.082046368346776e-8,0.004305786979287081,2.381512406074437e-5,-7.084577599968396e-8,0.004306223908680077,2.3950918898359302e-5,-7.113265222969439e-8,0.0043065521824008435,2.4156359154944985e-5,-7.157081214482665e-8,0.00430675720105395,2.4366745878058644e-5,-7.202132826384251e-8,0.00430685272341944,2.452074994873828e-5,-7.235202054839195e-8,0.0043068746876313785,2.457397362237289e-5,-7.246674040986775e-8,0.004306870807432403,2.450692094765032e-5,-7.232274420159353e-8,0.0043068889333198876,2.4326274108967804e-5,-7.193368553734489e-8,0.004306967157178836,2.4060115372153373e-5,-7.135951482856131e-8,0.004307127792060001,2.3749312473508598e-5,-7.068800846487233e-8,0.004307375847549257,2.3437998378882705e-5,-7.001424126954424e-8,0.0043077011487614265,2.316559033074148e-5,-6.942331161839482e-8,0.004308082476774727,2.296156998550824e-5,-6.897901648309085e-8,0.004308492160407662,2.2843008936849732e-5,-6.871848008341235e-8,0.00430890014225028,2.2814028032551207e-5,-6.865098180169714e-8,0.004309277281921247,2.2866200020617407e-5,-6.875880227967708e-8,0.004309598220494261,2.2979234337591817e-5,-6.899862356038913e-8,0.004309844408536244,2.3121853538730567e-5,-6.930329429478826e-8,0.0043100078615668095,2.3253479651415424e-5,-6.95853524949172e-8,0.004310095640386761,2.3328083445441076e-5,-6.974529757037752e-8,0.0043101338257101485,2.3301787131791224e-5,-6.968807200575135e-8,0.004310168187241177,2.3144787924465443e-5,-6.934892854607553e-8,0.004310257826444425,2.285531683637069e-5,-6.872365125157918e-8,0.004310459684221365,2.2469228310805165e-5,-6.788925321183882e-8,0.0043108073193948325,2.2056750050369026e-5,-6.699692997284909e-8,0.004311294032439131,2.170255209789584e-5,-6.622910378436072e-8,0.004311871307369093,2.1476062378587954e-5,-6.573553756794064e-8,0.004312465198993063,2.1407057452158824e-5,-6.558081946270183e-8,0.004313001977162613,2.147859710794636e-5,-6.572910476913147e-8,0.00431343005920553,2.1637960989153616e-5,-6.606750631843108e-8,0.004313730316577628,2.181691089414023e-5,-6.644950764688654e-8,0.004313914738250244,2.1951418489715036e-5,-6.673726332891451e-8,0.004314017860593639,2.1995240270097538e-5,-6.6830778021755e-8,0.00431408563427076,2.1926188546349096e-5,-6.668152880876458e-8,0.004314164844430976,2.1746350005664837e-5,-6.62931915957548e-8,0.00431429466372932,2.1478088191753095e-5,-6.571331506627689e-8,0.004314501024681896,2.1157447735519515e-5,-6.501929657323107e-8,0.004314794068269408,2.0826407239506826e-5,-6.430170217264929e-8,0.004315168523400873,2.0525388218328684e-5,-6.364798919827755e-8,0.00431560642180513,2.0287173353931803e-5,-6.31292183912412e-8,0.0043160812455876356,2.0132909454777427e-5,-6.279132138753954e-8,0.004316562520177888,2.007033177327738e-5,-6.265126152698634e-8,0.00431702006617794,2.00938082788825e-5,-6.269717769742918e-8,0.004317427588706235,2.018551638500187e-5,-6.28909388180351e-8,0.004317765712734754,2.0317234227004703e-5,-6.317193328846631e-8,0.004318024775138963,2.0452628316515763e-5,-6.34618604024906e-8,0.00431820770093002,2.0550394730606987e-5,-6.367139110618334e-8,0.004318332893899484,2.0569188001987255e-5,-6.371081436092053e-8,0.004318436011644906,2.04754635624101e-5,-6.350712260775898e-8,0.0043185681789404615,2.0254385622796044e-5,-6.302778494565895e-8,0.004318787523787666,1.9921423273137004e-5,-6.230594134708772e-8,0.004319142414166795,1.9528518015015e-5,-6.145372829533996e-8,0.004319650180655444,1.9156534321257355e-5,-6.064588141621515e-8,0.004320282432594846,1.8890460254098007e-5,-6.006610839445816e-8,0.00432096924731175,1.8786257539194468e-5,-5.983551079099197e-8,0.004321623889974825,1.8848028753740572e-5,-5.99633110710282e-8,0.004322174856199251,1.9029232241916958e-5,-6.03494594472305e-8,0.004322587553187694,1.9254995930678356e-5,-6.083272565155132e-8,0.004322867520357473,1.9450265918529555e-5,-6.125132934634046e-8,0.004323049667978551,1.956007946768571e-5,-6.148655784160723e-8,0.004323182862961931,1.9557648041747735e-5,-6.148015369528662e-8,0.004323316556168647,1.9443050480583164e-5,-6.123159791433297e-8,0.004323491840940722,1.9237131005163212e-5,-6.0785188942898e-8,0.004323736659978244,1.8974013586600857e-5,-6.021415798447603e-8,0.00432406401637427,1.8693883726101143e-5,-5.960523413418266e-8,0.004324472264424686,1.8436553474490432e-5,-5.904470094336049e-8,0.004324946983099295,1.8236033860153257e-5,-5.860648003866715e-8,0.004325464084859797,1.811635649105119e-5,-5.8342897748555724e-8,0.004325993794135984,1.8088868183602328e-5,-5.8278740560323874e-8,0.004326505053826906,1.8151193617222837e-5,-5.84090469392405e-8,0.004326969827564337,1.8287871460248693e-5,-5.870057233852731e-8,0.004327366867667058,1.8472348280178974e-5,-5.909613070587311e-8,0.004327684784604043,1.8669955227489085e-5,-5.952094345795759e-8,0.004327924409123366,1.8841706401499647e-5,-5.989069354469142e-8,0.004328100446453682,1.8948978694444737e-5,-6.012153384588638e-8,0.004328242207755195,1.8959396499784854e-5,-6.014285604854431e-8,0.00432839251061342,1.8854306712077532e-5,-5.991366270790545e-8,0.004328602976287375,1.8637363771232864e-5,-5.9441399495521534e-8,0.004328923808193235,1.834172061702968e-5,-5.879768517306489e-8,0.0043293877420519525,1.803074398317214e-5,-5.8119858923673065e-8,0.004329992303019424,1.7786082973530267e-5,-5.7585025996974733e-8,0.0043306904239555155,1.768141014178147e-5,-5.735306902442807e-8,0.004331400140317573,1.7751344357086818e-5,-5.749928204325917e-8,0.00433203358321681,1.797402614272783e-5,-5.79766211094402e-8,0.004332530332663138,1.828016466901793e-5,-5.8635303908857e-8,0.004332875915402321,1.858298602165903e-5,-5.928765562337491e-8,0.00433309804217549,1.8810034258350935e-5,-5.977689798049865e-8,0.004333248483983109,1.8921204984793378e-5,-6.001607106531904e-8,0.00433338344031064,1.891050947589809e-5,-5.999178553599807e-8,0.004333550076056095,1.879802272931174e-5,-5.974688447449809e-8,0.00433378028617974,1.8619161178224815e-5,-5.935746777534596e-8,0.004334089547866698,1.841532739235039e-5,-5.891288378805079e-8,0.004334478361386218,1.8227051919153682e-5,-5.8500987248132956e-8,0.004334934676237755,1.8089192813388756e-5,-5.819765687811798e-8,0.004335436753461419,1.8027479513569926e-5,-5.805910095808496e-8,0.0043359564346629785,1.805604332199269e-5,-5.8116315662884676e-8,0.004336462854060841,1.8175905259323786e-5,-5.837173979925861e-8,0.0043369265589401195,1.8374650843245116e-5,-5.8798606028170783e-8,0.0043373237749320314,1.8627644789034814e-5,-5.9343665372251605e-8,0.004337640287689868,1.8900903887741546e-5,-5.993342885257249e-8,0.004337874393414731,1.915541028175581e-5,-6.0483416036833585E-08,0.004338038508031595,1.935252810257927e-5,-6.090974291052553e-8,0.004338159117798005,1.9460134108828392e-5,-6.114232980148806e-8,0.004338274774933433,1.9459013263327866e-5,-6.113884811203717e-8,0.004338431681466829,1.9348999136279857e-5,-6.089826911602292e-8,0.004338676165081497,1.9153806772625883e-5,-6.047161761109011e-8,0.004339043688685932,1.8922294391678095e-5,-5.996487910391701e-8,0.004339545635601907,1.872276095381814e-5,-5.952661815361361e-8,0.004340158161930944,1.8627380820978457e-5,-5.9314042383671195e-8,0.004340820587457169,1.8688023122385006e-5,-5.944030774359304e-8,0.0043414499059315215,1.8912570225124942e-5,-5.992294543545765e-8,0.004341969354982378,1.9256317958197064e-5,-6.066513104038634e-8,0.00434233727438235,1.963727956575248e-5,-6.148895689362684e-8,0.004342559700425284,1.9968375421524345e-5,-6.22053917653275e-8,0.004342681194553419,2.0187890581981525e-5,-6.268039485374884e-8,0.004342762928135588,2.0273446998614515e-5,-6.286515201466919e-8,0.004342861762115175,2.0238340874590014e-5,-6.278807051788223e-8,0.0043430181177510525,2.0118621313219873e-5,-6.25268278416331e-8,0.004343252686041884,1.9959504096147545e-5,-6.217910056180777e-8,0.004343568466291725,1.9805367104343365e-5,-6.184105171446118e-8,0.004343954731686096,1.9693836953182042e-5,-6.159455561595036e-8,0.004344390973704534,1.9652723436851773e-5,-6.150043408182522e-8,0.004344850331140559,1.969838524407601e-5,-6.159471002910778e-8,0.004345302792489047,1.9834740731576415e-5,-6.188629404236862e-8,0.004345718569954192,2.0052786388798823e-5,-6.235588467085406e-8,0.004346071890108299,2.0330942481172956e-5,-6.295676357140448e-8,0.004346345120939216,2.0636843362656404e-5,-6.361874562488397e-8,0.004346532649407227,2.0931092520010435e-5,-6.425633112670948e-8,0.004346643556812209,2.1172987348254808e-5,-6.478105282775598e-8,0.004346702139067369,2.1327622981692872e-5,-6.511679997367014e-8,0.004346745608778673,2.137326837845882e-5,-6.521581332631904e-8,0.004346818808370958,2.130755124320618e-5,-6.507223672428581e-8,0.004346966320702236,2.1150975510158874e-5,-6.472999399619078e-8,0.004347222824520035,2.0946473775532036e-5,-6.428207114555517e-8,0.004347603087958219,2.0753784072168932e-5,-6.385844812624413e-8,0.004348093942432825,2.0637814013072452e-5,-6.36007815326696e-8,0.004348651739160019,2.0651659508830847e-5,-6.36252925003523e-8,0.0043492091234758985,2.0818025289423062e-5,-6.398208836552688e-8,0.004349692649033529,2.1116545144798856e-5,-6.462735152225057e-8,0.004350046851532632,2.148558579412229e-5,-6.542717677117046e-8,0.004350254077818288,2.1841590704683874e-5,-6.619972247540033e-8,0.004350339218690546,2.2108334127427978e-5,-6.677897296497183e-8,0.0043503570289232605,2.2241363549602545e-5,-6.706795464383658e-8,0.004350370300956235,2.2236598604831392e-5,-6.705740408002692e-8,0.004350430646805905,2.2122994339245096e-5,-6.680980212150948e-8,0.004350568672542956,2.1947338186704e-5,-6.642641374111236e-8,0.004350793241612556,2.1759652050497017e-5,-6.601571687264844e-8,0.0043510958731244245,2.1603418432720286e-5,-6.567227801223937e-8,0.004351456464205779,2.1510811396030194e-5,-6.546638399293138e-8,0.004351848247956533,2.1501213936502228e-5,-6.544069492800358e-8,0.004352241536665431,2.1581184167779784e-5,-6.560999904068952e-8,0.00435260671995346,2.174478040527643e-5,-6.596178678053824e-8,0.004352917203110646,2.1974004373243897e-5,-6.645716600620018e-8,0.004353152776554337,2.2239771173006768e-5,-6.70329889115276e-8,0.0043533034557195595,2.250423557099356e-5,-6.760694213289382e-8,0.004353373159793762,2.2725320394767957e-5,-6.808739588456914e-8,0.004353381934028024,2.2863721397970617e-5,-6.838860655220757e-8,0.004353365144473504,2.2891593869259356e-5,-6.844958399294913e-8,0.004353368520464555,2.2800891768739177e-5,-6.825225963723115e-8,0.004353439178980252,2.2608536352457108e-5,-6.783284315230564e-8,0.004353614398994551,2.235592337679717e-5,-6.728093363331758e-8,0.004353911091254241,2.210179351953395e-5,-6.672420060605343e-8,0.004354319093981324,2.1909457854221882e-5,-6.63007028625976e-8,0.00435480070535855,2.183105798865961e-5,-6.612459579585697e-8,0.004355297564439238,2.1892701313526038e-5,-6.62535720399581e-8,0.004355744274261172,2.208486894760374e-5,-6.666768156040473e-8,0.004356085988373349,2.2362140804206785e-5,-6.72684784304803e-8,0.004356294790867451,2.265429960519879e-5,-6.790310472655907e-8,0.004356378446729466,2.2886711643210605e-5,-6.840875002736263e-8,0.004356377083974059,2.300287959510685e-5,-6.866191818023424e-8,0.004356348835649946,2.2979906602058662e-5,-6.861222380829316e-8,0.004356351070803769,2.283100298627068e-5,-6.828791603511024e-8,0.0043564253033482265,2.2596103437619816e-5,-6.777550831067574e-8,0.004356590438485916,2.232692894571213e-5,-6.71873398673657e-8,0.004356843977258533,2.207328036231141e-5,-6.663181407464889e-8,0.00435716773989199,2.1874255200302816e-5,-6.619429149558181e-8,0.0043575345277402245,2.17545974438534e-5,-6.592907552880914e-8,0.00435791364940389,2.1724473774609717e-5,-6.585880479157714e-8,0.004358274835255978,2.1780736857639492e-5,-6.597708420358102e-8,0.00435859102021611,2.190842428008057e-5,-6.625166759485598e-8,0.004358840788105637,2.2082124326210005e-5,-6.66273960160543e-8,0.004359011140673432,2.2267590761594875e-5,-6.702970759557112e-8,0.004359100770459174,2.2424521416654e-5,-6.737069654700543e-8,0.0043591232349589806,2.2511572931629804e-5,-6.756005138998922e-8,0.004359108521787183,2.2494178942973776e-5,-6.752211476792377e-8,0.004359100878157092,2.235434252364082e-5,-6.721725820444066e-8,0.004359151203790916,2.209952344550378e-5,-6.666129656422452e-8,0.004359304391648528,2.1766202486049173e-5,-6.59333189575158e-8,0.004359585156155929,2.141440124607869e-5,-6.516384241477555e-8,0.004359988028082468,2.1112991988769316e-5,-6.450292098818624e-8,0.004360476321122433,2.0920264451710092e-5,-6.407788779132097e-8,0.004360991139310915,2.0866833130000284e-5,-6.395608344448584e-8,0.0043614672632936585,2.094691373648151e-5,-6.412567446990825e-8,0.00436185047259702,2.1120373710730043e-5,-6.449986452881506e-8,0.004362111124733698,2.1324180464702604e-5,-6.4941620161576e-8,0.004362250570187353,2.1489435250093217e-5,-6.53007002748905e-8,0.004362299121386524,2.155913544719217e-5,-6.54524253343876e-8,0.004362306490900004,2.1501808725852057e-5,-6.532755100187959e-8,0.004362327761153033,2.131732881203479e-5,-6.492513324816661e-8,0.0043624093738372635,2.103373524474476e-5,-6.430576510522246e-8,0.0043625793884881775,2.0697054625575986e-5,-6.356950528095524e-8,0.004362844207020741,2.0358383999011046e-5,-6.282776240788013e-8,0.004363191208127825,2.006260880711081e-5,-6.217865603614356e-8,0.004363594835992581,1.984133466131531e-5,-6.169150041406605e-8,0.004364023394089613,1.971031936272081e-5,-6.140108548051583e-8,0.004364444713893855,1.9670147056786693e-5,-6.130906149278202e-8,0.004364830116595006,1.9708457183723877e-5,-6.13887614197793e-8,0.004365157008842049,1.9802456355045293e-5,-6.159066614971228e-8,0.0043654108447642925,1.9921222630134676e-5,-6.184741174273681e-8,0.004365587133171469,2.002805687530203e-5,-6.207888714985402e-8,0.004365693773882021,2.0083687956816993e-5,-6.219920719112305e-8,0.004365753261816067,2.0051413982690625e-5,-6.21279557727769e-8,0.004365803266929434,1.990492580654581e-5,-6.18073352015643e-8,0.004365893211815998,1.963812772857377e-5,-6.122369196067238e-8,0.00436607468587738,1.9273718051626967e-5,-6.042630561545666e-8,0.004366386030933518,1.8864892817626648e-5,-5.953112197574838e-8,0.004366836077417156,1.8485075349996475e-5,-5.869834534688314e-8,0.004367395636384049,1.8206114824510273e-5,-5.808489610024617e-8,0.0043680034475078715,1.807342018736887e-5,-5.779018629925774e-8,0.004368585429190273,1.8090183319349116e-5,-5.7821670584522674e-8,0.004369078205338029,1.8218018646954217e-5,-5.8096130493753056e-8,0.004369446485515545,1.8391914972714372e-5,-5.8472137246485704e-8,0.00436968898915749,1.854111673960781e-5,-5.879546235081837e-8,0.004369833869388169,1.8607666783746486e-5,-5.893945230499611e-8,0.004369927829734204,1.8558083076927652e-5,-5.883053071818364e-8,0.0043700232722843815,1.8387261432697222e-5,-5.845686139765173e-8,0.004370166642890487,1.8115771799109823e-5,-5.78626810222891e-8,0.004370389908592708,1.778250420799372e-5,-5.7132479090411445e-8,0.004370706190176643,1.7434832951346612e-5,-5.63696521066772e-8,0.004371109765100231,1.7118586178875612e-5,-5.5674571774707e-8,0.00437157972214823,1.6869939219546253e-5,-5.5126719806860253e-8,0.004372085769119738,1.671054970042191e-5,-5.477386649502183e-8,0.004372594495239376,1.6646123535862942e-5,-5.462880762363998e-8,0.004373074761423813,1.6667710334556395e-5,-5.467217352867607e-8,0.004373501568673639,1.675457816700928e-5,-5.485876153998176e-8,0.004373858478157565,1.687756120804058e-5,-5.5124896858937915e-8,0.004374139111879542,1.7002287531392034e-5,-5.5395470307775045e-8,0.0043743482958161295,1.7092346989803696e-5,-5.559079621301812e-8,0.004374503133939031,1.7112951246571128e-5,-5.5634563689226273e-8,0.004374633720251839,1.7035925052044434e-5,-5.546478116239983e-8,0.00437478225005965,1.6846665517467146e-5,-5.504911354774486e-8,0.0043749983953135655,1.6552475631203626e-5,-5.440324873724291e-8,0.004375328872488854,1.618927976830758e-5,-5.360566541222857e-8,0.0043758013925030695,1.5821068508656155e-5,-5.2796405543630164e-8,0.004376408267399701,1.552634116046679e-5,-5.214735730105396e-8,0.004377099954417064,1.5371900421595234E-05,-5.180488666204743e-8,0.004377797060914417,1.5385036173928835e-5,-5.182897065432117e-8,0.004378418187720637,1.5540645773084347e-5,-5.2165003016123936e-8,0.004378909008357041,1.5771884933839974e-5,-5.266706122898232e-8,0.0043792572209281865,1.599719360222389e-5,-5.315697219265368e-8,0.004379488986244382,1.6147744983164754e-5,-5.34842622002332e-8,0.004379653735493992,1.6183696763184442e-5,-5.356159676976171e-8,0.004379807029548539,1.6097454183882332e-5,-5.337188796430934e-8,0.004379997377027852,1.5908215829117925e-5,-5.2956489809098333e-8,0.004380258535441446,1.5652790384862128e-5,-5.239536296392365e-8,0.004380606499311609,1.5376010872551103e-5,-5.178635373794103e-8,0.00438103981704955,1.5122274389860483e-5,-5.122678455064238e-8,0.0043815422062817,1.4928716380928159e-5,-5.079841505994918e-8,0.0043820867949589636,1.4820349015323273e-5,-5.055656434916802e-8,0.004382641303252554,1.4807475268811135e-5,-5.052422039228374e-8,0.004383173380248949,1.4885420145896664e-5,-5.0691348370280644e-8,0.004383655356796422,1.5036302184118528e-5,-5.1018815625741976e-8,0.004384067847834171,1.5232293344004387e-5,-5.144564428159387e-8,0.0043844019828522774,1.543961315370945e-5,-5.1897827868784535e-8,0.004384660446837142,1.5622634657119858e-5,-5.229728990740927e-8,0.0043848576711448175,1.5747902572815793e-5,-5.257058563354719e-8,0.0043850193932531934,1.5788236658408824e-5,-5.2657827564574646e-8,0.0043851814481957125,1.572732220635757e-5,-5.252279948825495e-8,0.004385386970873339,1.5565072314536914e-5,-5.216487783723147e-8,0.004385680534183977,1.532309143986357e-5,-5.163119876709418e-8,0.004386097920633204,1.5047759637200314e-5,-5.102352030618483e-8,0.004386652021040343,1.4806503360449029e-5,-5.0490006751438264e-8,0.004387319473877426,1.4672634763753373e-5,-5.019184730718326e-8,0.004388037475553013,1.4699180145777687e-5,-5.024571194944651e-8,0.004388719358254085,1.4892581471994294e-5,-5.066597535539156e-8,0.004389286252243407,1.5203884862031068e-5,-5.1345376667470573e-8,0.00438969797548042,1.5546829342512437e-5,-5.209476228885879e-8,0.004389964650890107,1.583302129175502e-5,-5.272030351592314e-8,0.004390134913807563,1.6002864742013964e-5,-5.309129370757188e-8,0.004390272271287374,1.6037840528340582e-5,-5.3166940446750974e-8,0.004390434097429688,1.595511112825302e-5,-5.298445643173724e-8,0.004390660057645578,1.579392903294117e-5,-5.262936255347156e-8,0.004390969109008046,1.5602006407262715e-5,-5.220585215637865e-8,0.0043913615412258964,1.542537772061049e-5,-5.1814795817357e-8,0.004391823037389939,1.5302039558842245e-5,-5.153985439117854e-8,0.004392329121287766,1.5258332624760626e-5,-5.143939304550827e-8,0.004392849551497714,1.5307073316800725e-5,-5.1542117695367437e-8,0.004393352682154456,1.54470359086033e-5,-5.18457185429351e-8,0.00439380971458905,1.566375392426153e-5,-5.23185628529972e-8,0.004394198597306122,1.5931683059558592e-5,-5.2904527284831545e-8,0.004394507186734965,1.621768345692803e-5,-5.353077333402549e-8,0.004394735227108045,1.6485492657756142e-5,-5.411762647781867e-8,0.004394894902223298,1.6700626893534787e-5,-5.45892803278868e-8,0.004395009971871057,1.6835218512750443e-5,-5.48843068576531e-8,0.004395113603586854,1.687246367982367e-5,-5.496537371682426e-8,0.004395244949411491,1.6810475067017456e-5,-5.482779901120044e-8,0.0043954442427448425,1.6665347947444088e-5,-5.450649984627839e-8,0.004395745883391455,1.6472740140844224e-5,-5.407968384406357e-8,0.0043961693024316155,1.6286178870649144e-5,-5.366522773031633e-8,0.0043967088244268844,1.616943709032258e-5,-5.340384348847231e-8,0.00439732633496883,1.6180870696195093e-5,-5.342443633742838e-8,0.004397953375547895,1.635135413255929e-5,-5.379535836427356e-8,0.0043985084347460835,1.6664842817597192e-5,-5.448152340898046e-8,0.004398926535594353,1.7055762545965226e-5,-5.533868602056141e-8,0.004399186184162931,1.7430878674003617e-5,-5.616169045398201e-8,0.004399316502889809,1.7706012639717648e-5,-5.676535310620799e-8,0.004399380619391071,1.7836085828877507e-5,-5.7050496127308454e-8,0.0043994479138703985,1.782330059445976e-5,-5.70217692683362e-8,0.004399571685962228,1.7705329205192075e-5,-5.676158687960766e-8,0.004399779842592975,1.7535919356775476e-5,-5.6387604272475e-8,0.004400076250313624,1.736849329520766e-5,-5.601691660456328e-8,0.0044004470021380936,1.7246443601718784e-5,-5.574493496590799e-8,0.0044008672958289925,1.7199144884804796e-5,-5.5636639903815625e-8,0.004401307044890794,1.724130099925887e-5,-5.572497188992369e-8,0.00440173510197177,1.737368836590099e-5,-5.6012208288017816e-8,0.004402122691783258,1.7584415933249197e-5,-5.6472543144591716e-8,0.004402446537357039,1.785064042267672e-5,-5.705582151470724e-8,0.004402691816659508,1.8141037663291022e-5,-5.7693066337959046e-8,0.004402854735432183,1.841939830699297e-5,-5.8304506128850546e-8,0.0044029441466111215,1.86494319283523e-5,-5.88101859483882e-8,0.004402981550175842,1.8800342453498846e-5,-5.914217622460607e-8,0.004402999067764595,1.8852377164001726e-5,-5.925669183407802e-8,0.004403035359985339,1.8801411674438728e-5,-5.914416507577008e-8,0.0044031298139103415,1.866162281600663e-5,-5.883524829467042e-8,0.004403315601073636,1.8465518632622366e-5,-5.8401102927705954e-8,0.004403612303337892,1.8260820798133723e-5,-5.794674902359043e-8,0.00440401903455858,1.810360352195355e-5,-5.7596036212635465e-8,0.004404509752154576,1.8047165882872968e-5,-5.746702598309528e-8,0.004405033516436402,1.812725114889848e-5,-5.763917890945277e-8,0.004405522902615492,1.834684093381671e-5,-5.8119578846809494e-8,0.0044059119457882465,1.866727755270758e-5,-5.8823215461512124e-8,0.004406159440016461,1.9013925428711905e-5,-5.958550245976834e-8,0.004406266628248096,1.9299284542711648e-5,-6.021339687547807e-8,0.004406277737108989,1.945484969608813e-5,-6.055575571644973e-8,0.004406261496645234,1.9454837423611572e-5,-6.055559500071444e-8,0.004406284449775708,1.9319660877416878e-5,-6.025761062267969e-8,0.00440639062788073,1.910099176720538e-5,-5.977521664665257e-8,0.004406594829344743,1.886022453602534e-5,-5.924323335780905e-8,0.004406887078573716,1.8651292088100253e-5,-5.878025539400848e-8,0.004407241761031286,1.8511880264080445e-5,-5.846944211875105e-8,0.0044076263524043535,1.8461551898719056e-5,-5.835435137480919e-8,0.0044080076754981524,1.8503530268696664e-5,-5.8442683603324096e-8,0.00440835579500999,1.862755742929406e-5,-5.871235534719573e-8,0.004408646532290339,1.881262321625275e-5,-5.911736690258402e-8,0.004408863496128932,1.9029458207028737e-5,-5.959328119831901e-8,0.004409000066919958,1.924325840921723e-5,-6.006330961355848e-8,0.004409061253908856,1.9417302526743488e-5,-6.044637646552229e-8,0.004409064800155661,1.9517894893698925e-5,-6.066804549783033e-8,0.00440904055014602,1.9520391771617026e-5,-6.067376479634501e-8,0.004409027212339246,1.9415263477098266e-5,-6.044217579738232e-8,0.004409066265143777,1.9212538136596372e-5,-5.99949182565613e-8,0.004409193715141178,1.8942795303234154e-5,-5.939893403493536e-8,0.0044094314113227616,1.865344497733075e-5,-5.875845298339941e-8,0.004409780143242562,1.8400286623901103e-5,-5.8196555817766816e-8,0.004410216569539457,1.8235638567657733e-5,-5.782905216370578e-8,0.004410695422717016,1.8195238170461436e-5,-5.773546974239403e-8,0.004411157650944433,1.8286844900537162e-5,-5.7933659296607315e-8,0.004411543971861461,1.8484117436023682e-5,-5.836601541020027e-8,0.004411811395675748,1.8729348317482946e-5,-5.890535923731313e-8,0.004411947793992804,1.89470109132833e-5,-5.938486561457419e-8,0.0044119780011767805,1.906592214848751e-5,-5.964712702981143e-8,0.004411956808968038,1.9042277832868503e-5,-5.9595124411453214e-8,0.004411950401682743,1.8873156757466962e-5,-5.92220569871064e-8,0.004412014554899769,1.8594182067809693e-5,-5.8606156280090905e-8,0.004412179536671111,1.8263848967560027e-5,-5.7876134214088945e-8,0.0044124466739733125,1.7943581917926447e-5,-5.716729690606632e-8,0.004412794575472388,1.7682304086576782e-5,-5.6587619247160394e-8,0.004413189368832398,1.7509204078874898e-5,-5.6201810628385806e-8,0.004413594086340192,1.743345530047553e-5,-5.603059765879325e-8,0.004413975065031127,1.7447630029714103e-5,-5.605809066694707e-8,0.004414305472350097,1.7532025516451413e-5,-5.6241179923360305e-8,0.004414567041261399,1.7658503065552773e-5,-5.651793566777759e-8,0.004414751115520992,1.779363418722658e-5,-5.681456751260478e-8,0.004414859663338807,1.7901658854669397e-5,-5.7052019121006296e-8,0.0044149062993784445,1.794805755027884e-5,-5.7153915757579485e-8,0.004414916691840586,1.7904389601374315e-5,-5.7057269944060924e-8,0.004414927200000021,1.77543682378513e-5,-5.672588204884182e-8,0.0044149804922138025,1.750003314877578e-5,-5.616395099473292e-8,0.00441511759337999,1.7165714561544804e-5,-5.542484487782527e-8,0.004415367428776234,1.679696126662312e-5,-5.460881274387819e-8,0.0044157368984729635,1.64525946058128e-5,-5.3845568238601775e-8,0.0044162055472075626,1.6190716787134946e-5,-5.3263516737987664e-8,0.004416727899593218,1.6052589799655223e-5,-5.295419024084609e-8,0.0044172437234548155,1.6049869174066154e-5,-5.294395078197559e-8,0.004417693384688244,1.615974344870538e-5,-5.3183040430361466e-8,0.004418033663467096,1.6329784446188893e-5,-5.355607037861073e-8,0.004418249405605174,1.6491255741248804e-5,-5.391129234465096e-8,0.004418357633513688,1.657727659886784e-5,-5.41007360539825e-8,0.004418402673640693,1.6540796109409133e-5,-5.4020027084270734e-8,0.004418443391223361,1.636694373579072e-5,-5.3635805163711675e-8,0.004418536429934856,1.6075637077552477e-5,-5.2991599870440183e-8,0.004418721153570862,1.5713686813819345e-5,-5.219048380509432e-8,0.004419011327149181,1.5339827180016276e-5,-5.136208116526004e-8,0.004419395436149071,1.5008693642004086e-5,-5.062720950800594e-8,0.004419843763828487,1.475917925423041e-5,-5.0072119853676645e-8,0.004420318190940414,1.4609543041482485e-5,-4.973758066953034e-8,0.004420781006999231,1.455837640529271e-5,-4.9620879180614367e-8,0.004421200875707693,1.4588855571197866e-5,-4.9685116993361385e-8,0.004421555921818236,1.4673832615992423e-5,-4.9870423302738325e-8,0.004421834861138942,1.4780363310829798e-5,-5.0103979045361175e-8,0.004422037237442245,1.4873349197413976e-5,-5.030810679146616e-8,0.0044221735003303324,1.4918708687383351e-5,-5.0407314602882546e-8,0.004422265076734925,1.488684665139391e-5,-5.0335987892971714e-8,0.004422343894139628,1.4757129675741033e-5,-5.004829930915722e-8,0.004422450182798508,1.4523472760162985e-5,-4.953057889944237e-8,0.004422627129488367,1.4199935359410018e-5,-4.8813710361903955e-8,0.004422911606825086,1.382367526534905e-5,-4.7979688149729203e-8,0.004423322237828266,1.3451651182103001e-5,-4.715436315562399e-8,0.00442384901396835,1.3148639319550321e-5,-4.6480995689175956e-8,0.004424450465700748,1.2968277830758903e-5,-4.6078384882655163e-8,0.004425062411682258,1.2934115116972632e-5,-4.599895383332543e-8,0.004425616532075163,1.3029713949506274e-5,-4.620678002907812e-8,0.00442606125460747,1.3203026493029452e-5,-4.658713648167632e-8,0.004426376247492937,1.3382921571667098e-5,-4.698291956016331e-8,0.0044265757656095205,1.3500398155340669e-5,-4.7241493967355725e-8,0.0044267015746751685,1.3506656906523134e-5,-4.7254652877251136e-8,0.004426809564985756,1.3383317501207797e-5,-4.698127400556689e-8,0.004426954798878417,1.3143641854113754e-5,-4.645015416988944e-8,0.004427178862902963,1.282611238434304e-5,-4.574598280569655e-8,0.004427502065621027,1.248309395401886e-5,-4.498442593684408e-8,0.004427921557662274,1.2167909243147152e-5,-4.4283605507852286e-8,0.0044284149290582065,1.1923590626574095e-5,-4.373914849628887e-8,0.004428947492553156,1.1775726251332769e-5,-4.340818287378602e-8,0.0044294807498054785,1.1730276245194692e-5,-4.330431159108967e-8,0.00442997978210213,1.1775616157272551e-5,-4.3402016286169154e-8,0.004430418284203898,1.1887104697408922e-5,-4.3646763807176316e-8,0.004430781078167451,1.2032394059880673e-5,-4.396683813881441e-8,0.004431064723837474,1.2176260557030221e-5,-4.428411771350637e-8,0.0044312770935376515,1.228454666456542e-5,-4.452283720664672e-8,0.004431436570445023,1.2327479539015128e-5,-4.4616919616307796e-8,0.004431571073044788,1.2282959424570596e-5,-4.451723465126646e-8,0.004431716519505703,1.2140402085948442e-5,-4.420012359781004e-8,0.004431913708413011,1.190525144918933e-5,-4.367745401611296e-8,0.004432202271488714,1.1603137979985335e-5,-4.3005902031456583e-8,0.00443261096494701,1.128105558813796e-5,-4.228959825337529e-8,0.004433145658560025,1.1001798769206879e-5,-4.166779716993523e-8,0.004433779801368679,1.082900401217352e-5,-4.12817006687968e-8,0.004434454646972603,1.0805123199301839e-5,-4.122560821070611e-8,0.004435094025680583,1.093179184586048e-5,-4.1503363883340675e-8,0.004435629850168535,1.1164738583475233e-5,-4.20170322203088e-8,0.004436026030782993,1.1428372850655338e-5,-4.259921088755147e-8,0.004436288544140871,1.1642827137621819e-5,-4.30729574358741e-8,0.00443645852333741,1.1749408550127374e-5,-4.33081550485094e-8,0.004436594888881352,1.1724150687214207e-5,-4.3251474414460785e-8,0.004436755874140951,1.1577909422798677e-5,-4.292656969019233e-8,0.00443698556045168,1.134743368171151e-5,-4.241440383930332e-8,0.004437307141160754,1.1082923092713402e-5,-4.1825890935872864e-8,0.004437722000943753,1.0835997728485317e-5,-4.1275427325207346e-8,0.004438212894918262,1.0650076781292515e-5,-4.0859608303239765e-8,0.004438749638289341,1.055393982394728e-5,-4.0642808497137944e-8,0.004439295959152751,1.0558721353467244e-5,-4.065026502851615e-8,0.004439816265453436,1.065819146280534e-5,-4.0868482817672476e-8,0.004440281272009354,1.0831676496297347e-5,-4.1251640135869176e-8,0.004440671831938921,1.1048643543678123e-5,-4.173183848769729e-8,0.004440980777783971,1.1273898329578631e-5,-4.2230779881881195e-8,0.00444121303269828,1.1472474912977608e-5,-4.267071508775094e-8,0.004441384565236301,1.1613723431763203e-5,-4.298351149337096e-8,0.004441520716355006,1.1674659260946504e-5,-4.311801611635916e-8,0.004441654103827259,1.1642927188475744e-5,-4.304658575328331e-8,0.004441821893723169,1.151970903380154e-5,-4.277157863485106e-8,0.004442061733825511,1.1322569755221519e-5,-4.2331789891194374e-8,0.004442405367359218,1.1087324544257746e-5,-4.1806717475930976e-8,0.004442869542993695,1.0866655575333044e-5,-4.1313536007648224e-8,0.004443445735403163,1.0722317764963522e-5,-4.0989728756109695e-8,0.004444093284368835,1.0708865030730829e-5,-4.0956817567218523e-8,0.0044447430760904995,1.085167507562386e-5,-4.127142029165161e-8,0.004445316435740319,1.1129602124610225e-5,-4.1886642259513546e-8,0.004445754128237322,1.1475626607160576e-5,-4.2653546623268654e-8,0.004446040101964218,1.180003031512926e-5,-4.3372752883896014e-8,0.004446205530673317,1.2024629257590159e-5,-4.387057130415036e-8,0.004446312162708855,1.2108771182796773e-5,-4.405669777283164e-8,0.004446427135514646,1.2055740045207085e-5,-4.3938284164400834e-8,0.004446602819718554,1.1902415131929761e-5,-4.3596893302424874e-8,0.004446867462772274,1.1702280581489064e-5,-4.3150880569211476e-8,0.00444722502652385,1.1510013581017392e-5,-4.272141346034424e-8,0.004447660112373166,1.1371009258943887e-5,-4.240940734950581e-8,0.004448144592351008,1.1315808141326373e-5,-4.228315760058449e-8,0.00444864413440166,1.1358103698667109e-5,-4.237371725707588e-8,0.004449124029971733,1.1495141539025288e-5,-4.2675501313854964e-8,0.004449554153193063,1.1709878328814522e-5,-4.315087896932633e-8,0.004449912835517964,1.1974488478859295e-5,-4.373794004970734e-8,0.004450189440411732,1.2254789064169708e-5,-4.4360459045246395e-8,0.004450385488268202,1.2515133469631053e-5,-4.493894052335691e-8,0.004450514285615522,1.2723218588808307e-5,-4.540139076746559e-8,0.004450599251519201,1.285424788009527e-5,-4.569253626675187e-8,0.0044506713012207,1.2894201090678989e-5,-4.578100104332719e-8,0.004450765540459394,1.2842246866083047e-5,-4.5664633203186566e-8,0.004450917284953617,1.2712332911019386e-5,-4.537412450667041e-8,0.004451157155322636,1.2533780867555994e-5,-4.497450577626395e-8,0.004451504873237557,1.2350163721766086e-5,-4.45628020467471e-8,0.004451961919675364,1.2214876307893983e-5,-4.425820466465791e-8,0.004452504731610211,1.218142064773772e-5,-4.418032467973815e-8,0.004453082319776596,1.2287689702351628e-5,-4.441399178406356e-8,0.0044536237576869794,1.2537566429059222e-5,-4.496809227303929e-8,0.004454058600129623,1.2889221277017663e-5,-4.5749448011482285e-8,0.004454344557171657,1.3261764007055407e-5,-4.657774011379726e-8,0.004454487209756872,1.356321056345686e-5,-4.724799032523849e-8,0.004454537817108847,1.3726577222573843e-5,-4.761103975360433e-8,0.004454569953530231,1.3733042945322505e-5,-4.762500825386583e-8,0.0044546503114754445,1.3611019367534598e-5,-4.7353008192290663e-8,0.004454819540444871,1.3417353161617989e-5,-4.692121901981639e-8,0.004455088006355839,1.3214963151419203e-5,-4.6469264458608674e-8,0.0044554417320164475,1.3056798315819873e-5,-4.6114776888332594e-8,0.00445585181070049,1.2978205618864193e-5,-4.5936593073707565e-8,0.004456283063848414,1.2995515360089378e-5,-4.597157388372203e-8,0.004456700455403941,1.3107894323916252e-5,-4.621850553884396e-8,0.0044570734879752745,1.3300386432833933e-5,-4.664459015113946e-8,0.004457379329847273,1.354733210799182e-5,-4.719288460843296e-8,0.004457605083715164,1.381611653844664e-5,-4.779065425340231e-8,0.004457749208594007,1.4071308351959136e-5,-4.835873390854053e-8,0.004457821935847933,1.4279162754995978e-5,-4.882171487818592e-8,0.004457844413589892,1.4412244841220207e-5,-4.9118304592704225e-8,0.004457846392811299,1.4453606997495086e-5,-4.9210578647334747e-8,0.004457862579541846,1.4399892313824196e-5,-4.909080557286075e-8,0.004457928006711199,1.4262935015950712e-5,-4.878499921089497e-8,0.0044580728160356475,1.406956442522464e-5,-4.835259699152093e-8,0.004458316817654614,1.385936585539174e-5,-4.7881662798881046e-8,0.004458664213340158,1.3680097018682372e-5,-4.7478820736234354e-8,0.004459099197509258,1.3580228791160693e-5,-4.725262339870064e-8,0.004459584026033035,1.3598195514992196e-5,-4.728940689142557e-8,0.004460062199621417,1.3749252092781208e-5,-4.762371409222547e-8,0.0044604695823886415,1.4013664681784223e-5,-4.8211740969940616e-8,0.004460753777901616,1.4333327715772738e-5,-4.8923755358978294e-8,0.004460895857321044,1.4624178301927179e-5,-4.957195585635171e-8,0.00446092230560696,1.4804495669279922e-5,-4.997383459421404e-8,0.004460896977374359,1.4826692738442146e-5,-5.002318300311229e-8,0.004460895349738283,1.4694329378561483e-5,-4.972790533985917e-8,0.004460976016780967,1.4455254987504552e-5,-4.919452719357374e-8,0.0044611646111219405,1.4178234027314433e-5,-4.857603680579923e-8,0.004461454185855782,1.3928460573193122e-5,-4.801746458935442e-8,0.0044618157539403095,1.3752419469232318e-5,-4.7622364855750946e-8,0.0044622107137216325,1.3673354803297678e-5,-4.7442825841443116e-8,0.00446260043945746,1.369354382664959e-5,-4.7484455725649896e-8,0.004462952022908023,1.3799219006272274e-5,-4.7717131725367e-8,0.004463241121058138,1.3965553328710682e-5,-4.8085882901992276e-8,0.004463453324834858,1.4160873361938923e-5,-4.852016867099879e-8,0.0044635849469705675,1.435036495631774e-5,-4.894218569650978e-8,0.004463643417515637,1.4499782775240661e-5,-4.9275285274911396e-8,0.004463647051016639,1.4579493829923948e-5,-4.945312739285398e-8,0.004463623708041326,1.456882906403381e-5,-4.9429429021382195e-8,0.004463607842406662,1.4460176219189537e-5,-4.918704040982184e-8,0.0044636357910401445,1.4261818394534823e-5,-4.874420470914212e-8,0.0044637397511841466,1.3998495202235436e-5,-4.815581116683994e-8,0.004463941391235043,1.3708962880863763e-5,-4.7508063679370155e-8,0.004464246337336341,1.3440376771153735e-5,-4.6906117413019404e-8,0.0044646407956383674,1.3240001878015215e-5,-4.645569825673976e-8,0.004465091381001237,1.3145269848031426e-5,-4.624087973870854e-8,0.004465549066273715,1.3173598219246631e-5,-4.6301165592733985e-8,0.004465957939694511,1.3314136875100861e-5,-4.661280004540448e-8,0.004466268576327031,1.352468763662037e-5,-4.708169932958065e-8,0.00446645372428031,1.3737541360524216e-5,-4.7556478385599956e-8,0.004466520878302181,1.3876287526487771e-5,-4.786615773013864e-8,0.004466514326078782,1.3880445157377903e-5,-4.7875375783545784e-8,0.004466502142877897,1.3727918531229615e-5,-4.753461483998569e-8,0.004466552086217613,1.344312403337607e-5,-4.689826847344771e-8,0.0044667082651349286,1.3085819784721498e-5,-4.609959388131855e-8,0.004466980019477852,1.2727550786706039e-5,-4.529813388914731e-8,0.004467345755137234,1.2428783962732317e-5,-4.4628795806165725e-8,0.004467765779943532,1.2225982089979055e-5,-4.4173112494455235e-8,0.004468196005854024,1.2129693991677846e-5,-4.395498255353792e-8,0.004468597642816224,1.2129490543834448e-5,-4.395156917433471e-8,0.00446894206410521,1.2201011417455164e-5,-4.410885737385981e-8,0.00446921225500677,1.2312244640502023e-5,-4.43555394468987e-8,0.004469402654481283,1.2428213420078234e-5,-4.46134499502362e-8,0.0044695185950805304,1.2514503621319245e-5,-4.48055188286882e-8,0.004469575723049835,1.2540430548831996e-5,-4.486296672886854e-8,0.004469599148903078,1.2482479511679878e-5,-4.473308223481721e-8,0.004469621667375493,1.2328204497541601e-5,-4.4387945702341005e-8,0.004469680258111596,1.2080054076724377e-5,-4.38329250854799e-8,0.004469810440791369,1.1757832861630705e-5,-4.3112118745779403e-8,0.004470038938882233,1.139812552580378e-5,-4.2307071423256166e-8,0.004470376233823944,1.1049363336854192e-5,-4.1525836645826615e-8,0.004470811437085582,1.0762470256707936e-5,-4.088220096014905e-8,0.004471311827050345,1.057885493987764e-5,-4.046892914926202e-8,0.004471828174441778,1.0518954079644614e-5,-4.0332120643179816e-8,0.00447230517930829,1.057478045414597e-5,-4.045439322306815e-8,0.004472694773246646,1.0709058764895794e-5,-4.075274930775221e-8,0.004472969079340785,1.0862056909000877e-5,-4.1093716830421817e-8,0.004473129460972397,1.096542999972803e-5,-4.1324306385980915e-8,0.004473208349376754,1.0960344314636686e-5,-4.131265117419883e-8,0.004473261801176122,1.0814980769902441e-5,-4.098727821687716e-8,0.004473353611162491,1.0535090952922028e-5,-4.036078520359405e-8,0.004473535890618031,1.0162456216834655e-5,-3.952640941680167e-8,0.004473833792415958,9.760956408521302e-6,-3.862688960352953e-8,0.004474240602953426,9.396173414810474e-6,-3.7808898628385294e-8,0.004474724001444978,9.11738920258227e-6,-3.718281945206038e-8,0.004475238859403357,8.948272943174389e-6,-3.6801887768029544e-8,0.0044757402350894555,8.887048525787006e-6,-3.6662466891908055e-8,0.004476192324498001,8.912754115928486e-6,-3.6717928510436886e-8,0.004476572466872101,8.99328366656885e-6,-3.689655835364853e-8,0.004476871540255352,9.092325994737656e-6,-3.711706737226179e-8,0.0044770926280973825,9.174281950373387e-6,-3.7299643889725875e-8,0.004477249315061717,9.207572991317009e-6,-3.737343689531388e-8,0.0044773641629216165,9.167232096321902e-6,-3.7282422144220036e-8,0.004477467204936426,9.037578898248145e-6,-3.699141801660316e-8,0.004477593756950581,8.815347168589488e-6,-3.649307148880597e-8,0.00447778058690321,8.512872182307729e-6,-3.5814955514758316e-8,0.004478059745215661,8.159958224253264e-6,-3.502372164908136e-8,0.004478450365817333,7.802247766408065e-6,-3.4221459193305144e-8,0.004478950468601355,7.494062159631074e-6,-3.3529720730520204e-8,0.004479532465119492,7.285542176108168e-6,-3.3060801908352687e-8,0.004480146136971822,7.2072554470058906e-6,-3.288331103792207e-8,0.004480730224220354,7.258279349781589e-6,-3.2995444030558204e-8,0.004481229449583244,7.4035582392112385e-6,-3.331896233314279e-8,0.004481610689525678,7.582522644393277e-6,-3.371838931973838e-8,0.004481872292063173,7.725939025928392e-6,-3.403868938062639e-8,0.00448204374844317,7.774910697168804e-6,-3.414782399457034e-8,0.004482176671298304,7.696059172490782e-6,-3.397078855811176e-8,0.004482330435030019,7.4890430319435334e-6,-3.350650916046562e-8,0.004482556672721601,7.1850969128227755e-6,-3.282465246101726e-8,0.0044828866992572885,6.837522641746615e-6,-3.2044432737991846e-8,0.0044833250857910616,6.507056498926579e-6,-3.130192899832561e-8,0.004483850858172803,6.24650987263678e-6,-3.071570165203201e-8,0.004484425307959444,6.08924159396039e-6,-3.036088489326645e-8,0.004485003194359061,6.044356934728174e-6,-3.025827024763154e-8,0.004485543401858622,6.098712850233066e-6,-3.0378643182073185e-8,0.004486016219005494,6.2234233182378906e-6,-3.0657287324259747e-8,0.0044864064166258944,6.3817652026060565e-6,-3.1011736157922704e-8,0.004486712974298434,6.536100940869929e-6,-3.135738930785751e-8,0.004486946987567679,6.652794334948827e-6,-3.16186317416998e-8,0.0044871290855611435,6.705289352964788e-6,-3.173578594963119e-8,0.004487287039748156,6.676139966458214e-6,-3.1669660514816774e-8,0.004487453549021817,6.558809591876483e-6,-3.1405558068106883e-8,0.004487663626245549,6.359694715241642e-6,-3.095779699979666e-8,0.004487950667436226,6.100153211559874e-6,-3.0374268126452117e-8,0.004488340386805238,5.817319379742182e-6,-2.973828357636435e-8,0.004488842722498734,5.561454687988725e-6,-2.9162651978515495e-8,0.004489443758855133,5.387386078451001e-6,-2.87704753805209e-8,0.00449010207955269,5.339481305214199e-6,-2.866142686948672e-8,0.004490754688042762,5.434077367358827e-6,-2.887228736862537e-8,0.004491334130057058,5.647948607453723e-6,-2.9351019643881805e-8,0.004491791249757919,5.921297869142392e-6,-2.99634549511861e-8,0.004492112629279643,6.17644552752166e-6,-3.0535254824106297e-8,0.00449232388491216,6.343735825162951e-6,-3.0910079891972617e-8,0.004492478423788278,6.3824291151391336e-6,-3.0996454297399085e-8,0.0044926387333911215,6.288994539844147e-6,-3.078631234061721e-8,0.004492858636300761,6.092913739653983e-6,-3.0345562453837724e-8,0.004493171588724417,5.844789364045817e-6,-2.9787493231587065e-8,0.00449358619792652,5.60206433789655e-6,-2.9240893731404095e-8,0.004494087869175982,5.4161245069199806e-6,-2.882123891207294e-8,0.004494644740160421,5.322864554289205e-6,-2.8609503663609465e-8,0.004495216006784931,5.337654872160231e-6,-2.864069875751362e-8,0.004495760772876803,5.45491845871229e-6,-2.8902689986086383e-8,0.00449624562807949,5.6517357057193595e-6,-2.9344127629553888e-8,0.004496649625176552,5.894052353282223e-6,-2.988837234120634e-8,0.004496966197981279,6.14368973988668e-6,-3.044936038422412e-8,0.004497202413708704,6.364618307242032e-6,-3.094585642668188e-8,0.004497376491928267,6.527582409948589e-6,-3.131194447327545e-8,0.004497514640436966,6.6129278100694005e-6,-3.150337999113445e-8,0.004497647925917268,6.612117621637158e-6,-3.150093270015358e-8,0.004497809336845073,6.528610724443239e-6,-3.131231070153016e-8,0.004498030707089667,6.3785361876222695e-6,-3.09736925859592e-8,0.004498338829174895,6.191080665260008e-6,-3.055066942661581e-8,0.004498750077775436,6.0076683654676744e-6,-3.013646953689903e-8,0.004499263612814337,5.8780642609847445e-6,-2.9843203850422515e-8,0.004499854940636369,5.851244450515609e-6,-2.9781269629881294E-08,0.004500473936466841,5.960397636023314e-6,-3.002551100540538e-8,0.004501052719345036,6.205775394502228e-6,-3.057655086561226e-8,0.00450152565398311,6.544818406940442e-6,-3.133855594471292e-8,0.004501855052718436,6.89991925988118e-6,-3.213677936923044e-8,0.004502048299394567,7.184984577129539e-6,-3.277745584916125e-8,0.00450215485481849,7.337928245096862e-6,-3.312096524996092e-8,0.004502244939964075,7.34104622514252e-6,-3.31275673941889e-8,0.0045023832883471036,7.220589179745083e-6,-3.285626158580508e-8,0.0045026110823796145,7.030850470500054e-6,-3.2428926008768215e-8,0.0045029404092560505,6.834169236371335e-6,-3.198546698313869e-8,0.004503358106314494,6.685082210089396e-6,-3.1648403907449894e-8,0.004503833931529304,6.621199922123047e-6,-3.150250475699595e-8,0.004504329393182454,6.659916022098113e-6,-3.158735035096041e-8,0.004504805490228415,6.79906815339101e-6,-3.18986098972113e-8,0.0045052288712172945,7.020052500014815e-6,-3.239479081077634e-8,0.004505576291020284,7.292536290791366e-6,-3.300768877577651e-8,0.004505837190189702,7.580099251624076e-6,-3.3655110613896705e-8,0.0045060143045280365,7.846042790020471e-6,-3.42541110553583e-8,0.004506122446663604,8.058625318459529e-6,-3.473295260761845e-8,0.0045061858442556986,8.195104654863028e-6,-3.504028264202122e-8,0.004506234642510104,8.244233774000591e-6,-3.515070923594395e-8,0.004506301185498216,8.20730170658394e-6,-3.506705303538336e-8,0.004506416396345633,8.098093426558627e-6,-3.482021907021817e-8,0.004506606235169193,7.94206498498607e-6,-3.446740371929097e-8,0.004506887964378976,7.774744655900673e-6,-3.4088620681013444e-8,0.004507265898608951,7.63883680811971e-6,-3.378026681707891e-8,0.004507726866888514,7.578827637892328e-6,-3.364294154809401e-8,0.0045082369085281135,7.631796357853752e-6,-3.376059550196789e-8,0.0045087423408103665,7.81442404265071e-6,-3.4171064362557586e-8,0.004509179270358261,8.109527450340536e-6,-3.48355963905556e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_26.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_26.json deleted file mode 100644 index 78aa7c42..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_26.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":26000,"numberOfSamples":1000,"samples":[0.004509493310776733,8.460255546355793e-6,-3.5625800851343465e-8,0.004509663584584268,8.78152154032578e-6,-3.634960149730122e-8,0.004509716789810693,8.989819707723907e-6,-3.681866430913203e-8,0.004509719059465651,9.037418772725032e-6,-3.692552117143939e-8,0.004509748243703133,8.930185223519827e-6,-3.668355434778159e-8,0.004509863647122957,8.719470842231082e-6,-3.620846132642241e-8,0.004510089653785742,8.476972036399517e-6,-3.5661533171045015e-8,0.004510416800722429,8.269299770251092e-6,-3.51925282944491e-8,0.004510813094911667,8.1427235238956e-6,-3.4905561743649874e-8,0.004511237012805131,8.118815983827459e-6,-3.4849442039030304e-8,0.004511647598100416,8.19695215375018e-6,-3.5023237901990346e-8,0.004512010754110658,8.359585736620415e-6,-3.538793530902102e-8,0.004512302608721269,8.577895407180773e-6,-3.5878908014654e-8,0.004512511101780664,8.817020399356672e-6,-3.6417590410461715e-8,0.004512636407156604,9.040913865577355e-6,-3.692247406897225e-8,0.004512690307657771,9.216869444768706e-6,-3.7319489010541575e-8,0.004512694498577715,9.319590010896785e-6,-3.755134208751638e-8,0.004512677812454461,9.33448051439994e-6,-3.758499305360356e-8,0.004512672525088187,9.259714461186162e-6,-3.74162487552752e-8,0.004512710155956202,9.106773676260358e-6,-3.7070886445067697e-8,0.004512817232229619,8.899452134994748e-6,-3.660239062283695e-8,0.004513011361703757,8.671416905011533e-6,-3.6086549932726506e-8,0.0045132978459024205,8.462410007400726e-6,-3.561303803422552e-8,0.00451366700674806,8.313087368408677e-6,-3.5273853268424084e-8,0.004514092641922462,8.258223307030978e-6,-3.5147920393724736e-8,0.004514532771288454,8.318077690988317e-6,-3.5281410931936163e-8,0.004514934630932754,8.4888481118899e-6,-3.566597134940736e-8,0.004515245854344678,8.735374126556136e-6,-3.622214330179837e-8,0.0045154316998782295,8.991891199064452e-6,-3.6801147360575755e-8,0.004515492902915043,9.176856590224277e-6,-3.7218586920753816e-8,0.004515473030595792,9.22132948769478e-6,-3.731873347690093e-8,0.004515445973338222,9.09843419372188e-6,-3.704104339955742e-8,0.00451548682469044,8.835578371895206e-6,-3.644751863773576e-8,0.00451564268107663,8.500985857177386e-6,-3.5692080359945736e-8,0.0045159197183348996,8.174205711565663e-6,-3.495399269113799e-8,0.004516289609363855,7.91891452501725e-6,-3.437668106843999e-8,0.004516706111846334,7.769533914623208e-6,-3.403776290168179e-8,0.004517121078763411,7.73134067417984e-6,-3.3949388348932536e-8,0.0045174946878258695,7.787734155315276e-6,-3.4074540770568025e-8,0.004517799867137044,7.908923469211388e-6,-3.434642142253354e-8,0.004518023021591153,8.059160327422076e-6,-3.468456742654183e-8,0.004518163140214663,8.202005982025426e-6,-3.50066650311153e-8,0.004518230411948181,8.30424890030949e-6,-3.523747823122548e-8,0.004518244570725208,8.33915192550796e-6,-3.531634932075353e-8,0.004518232782286238,8.28935594403696e-6,-3.5203891163581475e-8,0.004518226774465987,8.149365170645358e-6,-3.488762043767852e-8,0.004518259006711036,7.927116613346235e-6,-3.438542274392408e-8,0.004518358060544222,7.643963370228097e-6,-3.3745425584923236e-8,0.004518543856405558,7.332621283429884e-6,-3.3041356370972954e-8,0.004518823498710852,7.0329632269025115e-6,-3.236314547040654e-8,0.004519188579967757,6.785903929501321e-6,-3.180325247605029e-8,0.004519614661144808,6.626048418181081e-6,-3.14401232958339e-8,0.0045200634304379044,6.5740276672578925e-6,-3.132079397132222e-8,0.004520487966458727,6.62956304606739e-6,-3.144502131997278e-8,0.00452084147546764,6.766843341505083e-6,-3.175463526314589e-8,0.004521089187148414,6.934764185105069e-6,-3.2134004538126606e-8,0.004521221269959029,7.065025688552307e-6,-3.2428442843453624e-8,0.004521261859102045,7.089574850293132e-6,-3.248384715700535e-8,0.0045212674299407694,6.964089990219654e-6,-3.2199939344201606e-8,0.004521310513078177,6.687544084459722e-6,-3.1574464342686096e-8,0.004521453447203763,6.305670157088708e-6,-3.071085821791362e-8,0.0045217253573987225,5.893958647960642e-6,-2.9779688167653515e-8,0.004522114733755025,5.529133856038296e-6,-2.8954214723599135e-8,0.004522579377927455,5.264744210794258e-6,-2.8355366465152043e-8,0.004523065009217748,5.120982847527676e-6,-2.802885167464862e-8,0.004523521972907846,5.088150002782038e-6,-2.7952986672350293e-8,0.004523914736487703,5.136932989628306e-6,-2.8061821235107004e-8,0.004524224518460753,5.229079919518181e-6,-2.8269112293518485e-8,0.004524447866784532,5.325356167857952e-6,-2.8486202260608446e-8,0.004524593830297251,5.390497834119252e-6,-2.8633216627973057e-8,0.004524681160259874,5.396171432205578e-6,-2.864585654482284e-8,0.004524735849207278,5.323027317101781e-6,-2.8480176026552257e-8,0.0045247886943237964,5.16249823096028e-6,-2.8116730602371682e-8,0.004524872353940403,4.918444281738836e-6,-2.7564280225240977e-8,0.0045250174349796965,4.608134848323794e-6,-2.68619228883987e-8,0.004525247591606092,4.261615509273891e-6,-2.6077583364155316e-8,0.004525574321292053,3.918549452938378e-6,-2.530086898948843e-8,0.00452599277311532,3.622150479587777e-6,-2.462943302074595e-8,0.0045264801545203655,3.4107258886289212e-6,-2.4149954956603862e-8,0.004526998018263306,3.308450392319929e-6,-2.3917312554474847e-8,0.004527498775693957,3.317760005942039e-6,-2.3937301228621522e-8,0.00452793558120547,3.415707219466181e-6,-2.415823276235786e-8,0.00452827373820132,3.555942963102195e-6,-2.4475281614218993e-8,0.004528501076735233,3.677053577969154e-6,-2.4749321189987848e-8,0.004528634255226658,3.7166708540264696e-6,-2.4838951555615288e-8,0.00452871788049019,3.6288209284880697e-6,-2.4639908971730102e-8,0.004528814461392247,3.399578871249497e-6,-2.4120586107355082e-8,0.004528986348915549,3.0544546974012395e-6,-2.3338735228699577e-8,0.004529275447593868,2.652362755159554e-6,-2.2427751850493508e-8,0.0045296894826229355,2.266809562799965e-6,-2.1554061940523532e-8,0.004530201357681512,1.962172998408435e-6,-2.0863453384503786e-8,0.004530761107800889,1.7757792179593227e-6,-2.044053421769499e-8,0.004531313427122603,1.7122786235617054e-6,-2.0295983770420518e-8,0.0045318125655776954,1.749367675975404e-6,-2.037944352447753e-8,0.004532230187937357,1.8490802478591477e-6,-2.0605011670815894e-8,0.00453255650096998,1.968861091375431e-6,-2.08762767548505e-8,0.004532797413529103,2.069429992863889e-6,-2.1104137100273155e-8,0.004532970455627508,2.1191957801873115e-6,-2.121685754164669e-8,0.004533101006844266,2.0963386322046738e-6,-2.1164869031366592e-8,0.004533219236241922,1.9898190337828303e-6,-2.09231193072752e-8,0.004533357423629913,1.8001513809640854e-6,-2.0492836790277707e-8,0.004533546992225019,1.540165048997408e-6,-1.9903207651827864e-8,0.004533814625910253,1.2352637227640804e-6,-1.9211889086172134e-8,0.0045341773121543635,9.220902568912064e-7,-1.8501932634248034e-8,0.004534637007950439,6.443360771918933e-7,-1.7872295458798828e-8,0.004535176664792075,4.4499167138597644e-7,-1.7420339103780497e-8,0.004535760035304328,3.557925328380303e-7,-1.7217978115692215e-8,0.004536337215533742,3.866412902473646e-7,-1.728772350881937e-8,0.004536855876733859,5.191842687487436e-7,-1.7588072274695526e-8,0.004537275385870752,7.081369882607212e-7,-1.8016430469229954e-8,0.004537579125593926,8.912435030713721e-7,-1.8431639886474907e-8,0.004537780530744449,1.005317578228007e-6,-1.8690357071296403e-8,0.004537920538034231,1.0034699039837472e-6,-1.868616129977461e-8,0.0045380570398233745,8.682810605385142e-7,-1.837946472292758e-8,0.004538249294644987,6.169983072998986e-7,-1.780931248930263e-8,0.004538541670781989,2.970358272201004e-7,-1.708319176747392e-8,0.004538951579800054,-2.7231731686069303e-8,-1.634711520277816e-8,0.004539465565272268,-2.9245638234442717e-7,-1.5744867236873657e-8,0.004540044817016876,-4.530987714794202e-7,-1.537993968878856e-8,0.004540637691521912,-4.913904592554641e-7,-1.5292863661002783e-8,0.0045411941681401885,-4.179588426089708e-7,-1.545968048557915e-8,0.0045416771529875445,-2.646725790176748e-7,-1.580808820140591e-8,0.004542067915028178,-7.389589463817978e-8,-1.624181308946475e-8,0.004542365941693601,1.1161571806108388e-7,-1.6663601282918254e-8,0.004542585366851695,2.557719936323004e-7,-1.6991327574329404e-8,0.004542750301596352,3.328556897280507e-7,-1.7166487509062615e-8,0.004542890539772055,3.288339048433999e-7,-1.7157205799619142e-8,0.004543038110357333,2.4148307307612337e-7,-1.6958505979006495e-8,0.00454322442352209,8.020747945813414e-8,-1.659185787564851e-8,0.004543477357567356,-1.341554185295706e-7,-1.6104693284517906e-8,0.0045438176089469635,-3.6995599015852086e-7,-1.5568968349127696e-8,0.004544254057927853,-5.868612278189073e-7,-1.507632289085078e-8,0.004544778812882803,-7.409000787411416e-7,-1.4726631776247386e-8,0.0045453638821404034,-7.933529756111925e-7,-1.4607830316871693e-8,0.004545962512626217,-7.226259496806341e-7,-1.4768947865738407e-8,0.004546517831531095,-5.353354038386974e-7,-1.5194914668309396e-8,0.004546978401910495,-2.705801777601392e-7,-1.5796839796783648e-8,0.004547315606031961,7.426064280520287e-9,-1.6428760347708144e-8,0.00454753489003374,2.2771495362971647e-7,-1.6929398929145512e-8,0.004547674975302893,3.348200634734904e-7,-1.7172762210130373e-8,0.004547795269270398,3.0546407671952013e-7,-1.7106022758788838e-8,0.004547957342816333,1.5361082419481356e-7,-1.6760923023671023e-8,0.004548207818776337,-7.620926519655014e-8,-1.623857269178295e-8,0.004548567688113334,-3.2310178950335675e-7,-1.5677235728358874e-8,0.004549029689400049,-5.261904517049809e-7,-1.5215224434557068e-8,0.004549562879332015,-6.387181991297879e-7,-1.4958938590346338e-8,0.004550122119909111,-6.369676213818445e-7,-1.4962560924246113e-8,0.004550659547407562,-5.227487180281773e-7,-1.522226203843342e-8,0.00455113503524916,-3.198295674394947e-7,-1.568415057741117e-8,0.004551523306381531,-6.614611648123595e-8,-1.6261898726347644e-8,0.004551816641272785,1.9551328796095916e-7,-1.685796274830549e-8,0.004552023601182218,4.2580724108011224e-7,-1.7382583753550408e-8,0.004552165189758773,5.945892816202448e-7,-1.7766991018379748e-8,0.004552270093790798,6.837932410099917e-7,-1.7970026091410244e-8,0.004552370226282839,6.880617875256065e-7,-1.797954851084639e-8,0.004552497089156715,6.141061808103928e-7,-1.781091130786019e-8,0.004552678823971549,4.796156243032983e-7,-1.7504429067141582e-8,0.004552937441607541,3.1202357072442164e-7,-1.7122570952647516e-8,0.004553285657210565,1.4683488458868566e-7,-1.6746191281231358e-8,0.004553723072438308,2.461230159602889e-8,-1.6467701649164962e-8,0.004554232297584862,-1.4673606685835707e-8,-1.6378198838017022e-8,0.004554776931368462,5.916408340345163e-8,-1.654648595704409e-8,0.004555304544316013,2.5471410996338887e-7,-1.699210890005788e-8,0.004555757580182239,5.487508779098537e-7,-1.766206390844868e-8,0.00455609163018589,8.847980560550384e-7,-1.8427567403072217e-8,0.004556294266149341,1.1862585904106192e-6,-1.9114066338961307e-8,0.00455639356224145,1.3819276275300728e-6,-1.955944643880223e-8,0.004556449423840962,1.4320994076717743e-6,-1.967347844662727e-8,0.00455653146260646,1.3415196289400694e-6,-1.9467164239301853e-8,0.004556695250636879,1.1538974614742377e-6,-1.9040064669564954e-8,0.00455696762660136,9.337292242152009e-7,-1.8538868697838413e-8,0.004557344253094815,7.457228920368247e-7,-1.8110674855141883e-8,0.004557796262614695,6.393184058846508e-7,-1.7867944352973605e-8,0.004558280964655819,6.408021303045762e-7,-1.7870661006435703e-8,0.004558752717751708,7.521507776956689e-7,-1.812364701480733e-8,0.004559171865542613,9.545520907436515e-7,-1.8584396920373626e-8,0.004559510918417762,1.214685417394258e-6,-1.9177186559210626e-8,0.0045597577345257365,1.492268065989241e-6,-1.9810175736451022e-8,0.004559915758252532,1.747525782261627e-6,-2.0392490975707653e-8,0.004560001790681829,1.947399946982737e-6,-2.084852456530275e-8,0.004560042130719432,2.069755428846989e-6,-2.112766147211479e-8,0.004560068031127442,2.105379942421046e-6,-2.1208875035905857e-8,0.004560111313149676,2.0580137470542224e-6,-2.110073390215724e-8,0.004560200668904181,1.943025512553438e-6,-2.083829693588606e-8,0.004560358702285993,1.785412603296129e-6,-2.0478523102675264e-8,0.004560599413535639,1.6174458646150957e-6,-2.009495393525646e-8,0.004560925771429382,1.4758038902445344e-6,-1.977126696599221e-8,0.004561327227637577,1.3976103681723366e-6,-1.9592281027131787e-8,0.004561777687863393,1.414475222692563e-6,-1.963031184849548e-8,0.004562235579990404,1.5439760444566057e-6,-1.9925614673578647e-8,0.004562648675447503,1.7796412722016043e-6,-2.046341689014831e-8,0.004562966076598825,2.0834817290894464e-6,-2.1156859279096877e-8,0.004563156563769151,2.3880171788488707e-6,-2.1851733662215338e-8,0.004563226026995868,2.6134961406077906e-6,-2.236596297709388e-8,0.004563222002259049,2.697182257226839e-6,-2.255654425324677e-8,0.004563218140920344,2.6200473503104345e-6,-2.2380369070183947e-8,0.004563285177328307,2.4142697533356353e-6,-2.1911080480621846e-8,0.00456346510562536,2.1474700508499156e-6,-2.1302898831592876e-8,0.0045637614855055355,1.8952029862123072e-6,-2.0727876983910757e-8,0.004564146109374209,1.717390042126911e-6,-2.0322347502066937e-8,0.004564573586655692,1.6467160412382832e-6,-2.0160696512706902e-8,0.004564995621143562,1.6879982482464885e-6,-2.025403919365333e-8,0.004565371098880404,1.823849272809698e-6,-2.0563061761098215e-8,0.004565671575998424,2.0224636955771143e-6,-2.1015577494141815e-8,0.004565883304822525,2.2451570701558744e-6,-2.1523520714831093e-8,0.004566007062175339,2.4528861969496664e-6,-2.1997743592595424e-8,0.004566056469157245,2.6116666971517507e-6,-2.23604574329312e-8,0.004566055109573586,2.6967378051573467e-6,-2.2554903643749895e-8,0.004566032787591015,2.6952576374760298e-6,-2.2551638035756678e-8,0.004566021340058094,2.6074130943391173e-6,-2.2351082445335482e-8,0.004566050456020915,2.445916611802514e-6,-2.198229461679592e-8,0.004566143978834918,2.234071638222029e-6,-2.1498460356284963e-8,0.004566316991076654,2.002834908710053e-6,-2.0970174692905903e-8,0.004566573698773829,1.7872369419549948e-6,-2.047735188978444e-8,0.004566906025496633,1.6222415688750605e-6,-2.009987915744285e-8,0.004567292941820179,1.5378947751270364e-6,-1.9906572258774763e-8,0.0045677009482845456,1.5534732761251689e-6,-1.9941722705096247e-8,0.004568086845586504,1.6706423254153708e-6,-2.0209304708076832e-8,0.004568404479915657,1.8669001932336232e-6,-2.065787129431821e-8,0.004568616641222311,2.0927296815380814e-6,-2.1174057753546027e-8,0.004568710628782926,2.277737563029436e-6,-2.159677431671749e-8,0.004568710906383361,2.3496980887248315e-6,-2.1760931647364762e-8,0.004568678450507578,2.2627328227331568e-6,-2.1561913449607736e-8,0.004568690934995052,2.0202730399911163e-6,-2.100789416692359e-8,0.004568811461316786,1.6765736725135978e-6,-2.0223021008261412e-8,0.004569064102334118,1.3138502582226867e-6,-1.939501198865483e-8,0.00456942983638702,1.0095623883627573e-6,-1.870048308376553e-8,0.0045698609228537225,8.126805895776015e-7,-1.8250956905805127e-8,0.004570301299600792,7.370286449055343e-7,-1.8077863586350383e-8,0.004570702395164331,7.675146472653699e-7,-1.8146849034032396e-8,0.004571031105591736,8.712119800734532e-7,-1.838299920858834e-8,0.004571271553897738,1.0077872223193491e-6,-1.8694474593890068e-8,0.004571423431715869,1.1371794672960694e-6,-1.898988427190855e-8,0.00457149912894306,1.224623094486609e-6,-1.9189713805360918e-8,0.004571520661368493,1.2439529482437433e-6,-1.9233970167685107e-8,0.004571516461258664,1.1798659800376192e-6,-1.90875063062554e-8,0.004571517887299565,1.0292685411183112e-6,-1.874320617434184e-8,0.00457155544903053,8.015811947188519e-7,-1.822266996676711e-8,0.004571654890494846,5.177527012148897e-7,-1.757386049492885e-8,0.0045718335249696285,2.0776980474633583e-7,-1.686531683855287e-8,0.004572097388308316,-9.323396016944465e-8,-1.6177255542095043e-8,0.004572439665645757,-3.4987692521596087e-7,-1.5590463436344316e-8,0.004572840644505964,-5.31972816140779e-7,-1.5173961796713732e-8,0.004573269348815289,-6.200415053200593e-7,-1.4972436045635267e-8,0.004573687024026574,-6.10406095595246e-7,-1.4994491965318193e-8,0.004574052809641157,-5.192579563073559e-7,-1.520320779417572e-8,0.00457433198222599,-3.843987328357727e-7,-1.5512049283710714e-8,0.004574506433080039,-2.6231970700412053e-7,-1.57915871799184e-8,0.004574585098804139,-2.1787955603130257e-7,-1.5893271807468845e-8,0.0045746091849351205,-3.056827632750247e-7,-1.569220003592137e-8,0.004574645498676162,-5.476968892825376e-7,-1.513834525051923e-8,0.004574765267068838,-9.184797312588896e-7,-1.4290196294897466e-8,0.00457501606601899,-1.3499749934384158e-6,-1.3303575679860455e-8,0.004575402559457306,-1.7569182650377685e-6,-1.2373436343486388e-8,0.00457588755670308,-2.0690376161348062e-6,-1.1660288023729968e-8,0.0045764106752221,-2.2521266223356963e-6,-1.1242149216779647e-8,0.004576911396180024,-2.3103385627944873e-6,-1.1109414454615705e-8,0.004577344958268909,-2.275047092560445e-6,-1.119036156480763e-8,0.004577688009744958,-2.190125367673378e-6,-1.1384764724171442e-8,0.00457793703023403,-2.1001362793857524e-6,-1.1590799048558753e-8,0.004578103680851678,-2.0432033769984585e-6,-1.1721260373927869e-8,0.004578209903486739,-2.0476287663152695e-6,-1.1711299731405369e-8,0.00457828387494594,-2.1305649056463137e-6,-1.1521549135013692e-8,0.004578356691217041,-2.2974938653969773e-6,-1.113942510021554e-8,0.004578459254883159,-2.5420904405371936e-6,-1.0579494532798996e-8,0.004578618975408969,-2.8466169571197294e-6,-9.882523233547e-9,0.004578856169100808,-3.183321162571054e-6,-9.112167432714705e-9,0.004579180478803452,-3.5174083811508843e-6,-8.34808453913955e-9,0.004579588120477424,-3.8118316727193404e-6,-7.674971745318212e-9,0.004580060934558044,-4.03352156185739e-6,-7.168392305513895e-9,0.0045805679854873955,-4.1600968235078126e-6,-6.87951141941344e-9,0.0045810699651512255,-4.185692981165825e-6,-6.821782230335321e-9,0.00458152603375295,-4.124467505914989e-6,-6.962856854404446e-9,0.004581902189684743,-4.010657797913334e-6,-7.224349646031663e-9,0.004582179915574498,-3.894438306832133e-6,-7.491268811747432e-9,0.004582363424246814,-3.833098119282915e-6,-7.632267271587255e-9,0.004582483126184382,-3.8777855317296025e-6,-7.53011848341852e-9,0.004582592398102796,-4.057840675385612e-6,-7.117693448106915e-9,0.004582755475052093,-4.367487092300224e-6,-6.408428922268497e-9,0.004583027684494128,-4.761913130848646e-6,-5.505193981758026e-9,0.004583434904318093,-5.1682652158940795e-6,-4.575001218916299e-9,0.004583962740856525,-5.509717091332434e-6,-3.793847647778333e-9,0.004584562235224711,-5.731726984261732e-6,-3.286608037184449e-9,0.0045851690079899594,-5.8173444046123675e-6,-3.092013230972495e-9,0.004585724984926677,-5.785936446522613e-6,-3.1655856948169594e-9,0.004586192672434863,-5.680003803249362e-6,-3.4098510201368928e-9,0.004586558909587067,-5.549240041603622e-6,-3.710862720240599e-9,0.004586831090544941,-5.438473165345392e-6,-3.965824489806852e-9,0.004587030516411275,-5.381337431846182e-6,-4.097587491428378e-9,0.004587186126494469,-5.398361853965937e-6,-4.059053627389166e-9,0.0045873298103882906,-5.49731379182367e-6,-3.8324359563939324e-9,0.004587493095288864,-5.6741958005571095e-6,-3.427014054705955e-9,0.0045877044693880785,-5.914235263036652e-6,-2.876857912876998e-9,0.004587986651218072,-6.192958116809043e-6,-2.238299632400325e-9,0.004588353448843592,-6.477950803344133e-6,-1.5858038797377467e-9,0.004588806428404769,-6.73216177730537e-6,-1.0043412823020856e-9,0.00458933233628059,-6.919340188748711e-6,-5.769299288868636e-10,0.004589902743292579,-7.011376771941958e-6,-3.6786881572565e-10,0.004590477310455618,-6.996130497857601e-6,-4.0485922692968167e-10,0.004591011167147137,-6.883260760486553e-6,-6.656513658249578e-10,0.0045914652682251846,-6.705371049354524e-6,-1.075393733113511e-9,0.004591817010039603,-6.512924106794449e-6,-1.5182606557942965e-9,0.004592067796621043,-6.363468442006583e-6,-1.8621675068497396e-9,0.004592244944227824,-6.307637731525589e-6,-1.9909320328163395e-9,0.004592396800370081,-6.375463343972728e-6,-1.835720290287429e-9,0.004592581636072272,-6.566741952320174e-6,-1.397147556305703e-9,0.004592852503308843,-6.848670800862258e-6,-7.506592754098574e-10,0.0045932418347822595,-7.16265852740837e-6,-3.085310633349787e-11,0.004593750787773998,-7.439775464126724e-6,6.039907256439864e-10,0.004594348004365676,-7.620693551409611e-6,1.0176568839792315e-9,0.004594979307958952,-7.67285027729872e-6,1.1353900564086016e-9,0.004595584733360852,-7.597882344516838e-6,9.60993606260401e-10,0.004596115629330661,-7.427042036220201e-6,5.663444100107817e-10,0.004596545284004681,-7.208277314545172e-6,6.172570217697634e-11,0.004596870828408168,-6.9916428475073475e-6,-4.377209163440163e-10,0.004597108555701069,-6.818392915343977e-6,-8.371051908542961e-10,0.004597286586221487,-6.715617670183615e-6,-1.0741512526115635e-9,0.004597438018468549,-6.6953943241077795e-6,-1.1211643140079087e-9,0.004597595917342151,-6.7563461785649045e-6,-9.814428534041288e-10,0.0045977900559172604,-6.8858632210796456e-6,-6.841521467843064e-10,0.004598044659033155,-7.062128212677125e-6,-2.796287018101613e-10,0.004598376318128057,-7.255916920005681e-6,1.6480339335871812e-10,0.004598791545151504,-7.4327601793754e-6,5.698408862789437e-10,0.004599284036273952,-7.55641510487658e-6,8.521963256757693e-10,0.004599832545317101,-7.59449169585154e-6,9.37519703522967e-10,0.004600401089893143,-7.526267837569374e-6,7.783330705853753e-10,0.0046009435048163455,-7.351117380604259e-6,3.7337668699399923e-10,0.004601413323426574,-7.094082392306315e-6,-2.1959916877791475e-10,0.004601777276461345,-6.804398311453375e-6,-8.872456883447427e-10,0.004602027574734469,-6.544807205465784e-6,-1.4852269544859042e-9,0.004602187108824936,-6.373998484428838e-6,-1.878640796994688e-9,0.004602304305622246,-6.328662725555859e-6,-1.983290254130587e-9,0.004602439234285484,-6.4122851305789306e-6,-1.7913894121004542e-9,0.004602646341656962,-6.59454075292182e-6,-1.372856112257814e-9,0.004602959791749618,-6.820555679744346e-6,-8.539567811146143e-10,0.004603385401025903,-7.026168406663905e-6,-3.8223413598513426e-10,0.004603900535041509,-7.154432726648315e-6,-8.862971018962839e-11,0.004604461221360877,-7.16909923779504e-6,-5.6530923583887666e-11,0.004605014161836207,-7.061911347469658e-6,-3.0496913721986693e-10,0.004605510173710997,-6.852198505821913e-6,-7.894778705239851e-10,0.004605915231864156,-6.579480498016876e-6,-1.4190378636351609e-9,0.004606216233404941,-6.291994615044852e-6,-2.0824711583876744e-9,0.00460642071017142,-6.035108556079831e-6,-2.675171494544614e-9,0.00460655193149057,-5.842863718623184e-6,-3.1186589302558516e-9,0.004606641995139615,-5.733972110264688e-6,-3.369853455113043e-9,0.004606725264452894,-5.711711571864843e-6,-3.4213163304000836e-9,0.0046068334424430035,-5.7661813773756325e-6,-3.2960088168680032e-9,0.004606992447073734,-5.877366283212291e-6,-3.0401786490361465e-9,0.004607220525040382,-6.01804827384349e-6,-2.7166204947669695e-9,0.004607526828035787,-6.156368380259616e-6,-2.3987754818787228e-9,0.004607909878637184,-6.2584771004198995e-6,-2.1646433927517645e-9,0.004608355861891447,-6.292108699703443e-6,-2.0885544550141327e-9,0.004608837460403657,-6.231941022115572e-6,-2.2288041686048496e-9,0.004609314869247811,-6.066944432541149e-6,-2.610692390028512e-9,0.004609741181179981,-5.808287594175388e-6,-3.208296374163034e-9,0.004610073532643847,-5.494016982094601e-6,-3.9337217762102935e-9,0.004610288280096579,-5.185259144008995e-6,-4.645941435360547e-9,0.004610393895995997,-4.950873931477467e-6,-5.186269288801948e-9,0.004610433184336685,-4.844246198175972e-6,-5.431895389162019e-9,0.004610470758879338,-4.8829096485003395e-6,-5.342766223918112e-9,0.0046105707030473,-5.0419564476459976e-6,-4.976589310976798e-9,0.004610775446429694,-5.26417400954597e-6,-4.465310329754646e-9,0.004611094963682681,-5.480348310975678e-6,-3.968302033161426e-9,0.00461150823724263,-5.62972692844612e-6,-3.625329611994953e-9,0.004611973094222571,-5.673786679284628e-6,-3.524987578971608e-9,0.0046124390559712505,-5.60146915226002e-6,-3.692726761576285e-9,0.004612859222188488,-5.427288532920816e-6,-4.095184948750271e-9,0.004613199097686521,-5.184761096077944e-6,-4.655216115005645e-9,0.00461344157660515,-4.917463952163088e-6,-5.272388730713527e-9,0.004613587996069912,-4.669665926120923e-6,-5.844552407820035e-9,0.004613655691602776,-4.478251084401866e-6,-6.28652082530562e-9,0.004613673077859672,-4.367267921755222e-6,-6.542744128551488e-9,0.00461367367651798,-4.345651474038695e-6,-6.592631310893555e-9,0.0046136904516331,-4.407814373872608e-6,-6.449178045460803e-9,0.004613751389181142,-4.536239263420983e-6,-6.152919507168062e-9,0.004613876649815567,-4.704994955452618e-6,-5.763751856803909e-9,0.004614077028175075,-4.883303608630905e-6,-5.352690069082215e-9,0.004614353162834188,-5.038827337005442e-6,-4.994329710158694e-9,0.004614695036423012,-5.140875843306533e-6,-4.759499974144619e-9,0.004615081647533657,-5.164078436357073e-6,-4.706796509128987e-9,0.004615481345908867,-5.093156815280933e-6,-4.871507157630509e-9,0.004615854140456318,-4.928932317867542e-6,-5.251665030544923e-9,0.004616157793161933,-4.694284295014727e-6,-5.794263848231378e-9,0.004616358878782183,-4.436656622864292e-6,-6.389541647842568e-9,0.004616447225878722,-4.222062557520083e-6,-6.884973524270293e-9,0.004616447316459371,-4.117217975337249e-6,-7.126660174101772e-9,0.0046164171712829195,-4.163817419832329e-6,-7.018720722844495e-9,0.004616430002982171,-4.358091358751388e-6,-6.5703061256921416e-9,0.004616545920780777,-4.64955458388336e-6,-5.898225015384205e-9,0.004616789519416018,-4.961068379082266e-6,-5.180477898492885e-9,0.004617144952363664,-5.21797868115541e-6,-4.5890532040936815e-9,0.004617567428571435,-5.370589400078979e-6,-4.238257150629672e-9,0.004618001377383055,-5.4024523567296e-6,-4.165786813726474e-9,0.00461839617858386,-5.326689531338634e-6,-4.341319230810882e-9,0.004618715659086564,-5.176427103811998e-6,-4.688546619249612e-9,0.004618941704013463,-4.994299138923035e-6,-5.1092602716603065e-9,0.0046190738457956015,-4.823500218588578e-6,-5.503860695653606e-9,0.004619126539673815,-4.701021915286869e-6,-5.786919842108562e-9,0.00461912513350184,-4.6530002781485684e-6,-5.897985711351209e-9,0.004619101113456684,-4.692128922859444e-6,-5.8076723886911916e-9,0.004619087174435325,-4.817110070681227e-6,-5.5190059356818914e-9,0.004619112672785507,-5.013950645613634e-6,-5.064416509080086e-9,0.004619199956383798,-5.258745206492392e-6,-4.499227652478228e-9,0.004619361925076508,-5.521396310506229e-6,-3.892989039720409e-9,0.004619600861690062,-5.769630238686212e-6,-3.3201995651143257e-9,0.0046199082837785595,-5.972903127371703e-6,-2.851352592334347e-9,0.004620265553426885,-6.106140175320044e-6,-2.5443702178223045e-9,0.004620645157437597,-6.15344235394916e-6,-2.4360418005486742e-9,0.004621012910332626,-6.111969284666793e-6,-2.5329705998129033e-9,0.004621331889116244,-5.995896088586415e-6,-2.8023280874564467e-9,0.004621569196957076,-5.839257062531263e-6,-3.16525563366286e-9,0.004621705946598681,-5.6949592448301445e-6,-3.499245426945735e-9,0.0046217486369424686,-5.626269776579186e-6,-3.6579976183436843e-9,0.004621736346891752,-5.688589628394338e-6,-3.5136773121236357e-9,0.004621735560203208,-5.9056093086997374e-6,-3.011976455429588e-9,0.004621818663207311,-6.252544277839716e-6,-2.2106262735571202e-9,0.004622034186749106,-6.660327133482274e-6,-1.269447535738715e-9,0.004622386277920894,-7.0421296244785226e-6,-3.8895869566759596e-10,0.004622835921998608,-7.326987257096725e-6,2.672247922603419e-10,0.004623320597655784,-7.481387241366695e-6,6.22078154458821e-10,0.004623778166074979,-7.511256501722334e-6,6.895832720469361e-10,0.0046241631750252934,-7.4503005879202574e-6,5.476957123973267e-10,0.0046244526906444455,-7.344777280885875e-6,3.031921981158643e-10,0.004624644751104253,-7.241142852555951e-6,6.324918068849496e-11,0.0046247535293354415,-7.178329664083658e-6,-8.227089394819571e-11,0.004624803929537004,-7.1838293799132266e-6,-6.982495105222414e-11,0.004624826696230001,-7.272134715425384e-6,1.3414464882997706e-10,0.004624854095060916,-7.444583539571314e-6,5.327371256362688e-10,0.004624916026302616,-7.690267618702546e-6,1.1006291093985203e-9,0.004625036574007785,-7.98793405485864e-6,1.7885067099525766e-9,0.004625231133799637,-8.30888821439031e-6,2.5298802519654072e-9,0.004625504428824734,-8.620815020618825e-6,3.2500039740028935e-9,0.004625849747329165,-8.892151827359156e-6,3.875986187591585e-9,0.0046262495157665465,-9.09652545200698e-6,4.346970267559263e-9,0.004626677147753625,-9.216883627944467e-6,4.623605244888573e-9,0.004627100098948487,-9.249002221467704e-6,4.6961442314090165e-9,0.004627484100502901,-9.204044867914665e-6,4.590434874603475e-9,0.004627798689161824,-9.109776567161958e-6,4.3708109803278244e-9,0.004628024187515499,-9.0095003276215e-6,4.1376398888795614e-9,0.004628159602392367,-8.956974239448121e-6,4.015455545081188e-9,0.004628229255540625,-9.005485803645908e-6,4.127521100134283e-9,0.004628283803510658,-9.1910726190435e-6,4.556926589182645e-9,0.004628390435834369,-9.514454774165462e-6,5.304877259037512e-9,0.004628610918423801,-9.931843970056032e-6,6.269651296939101e-9,0.004628975503068454,-1.03648245865506e-5,7.2696549997176675e-9,0.004629467998225569,-1.0728850454589621e-5,8.10939549229837e-9,0.004630032512152586,-1.0965482676576773e-5,8.65397700401509e-9,0.004630597398772655,-1.1060056137677217e-5,8.86984853736169e-9,0.004631101082919748,-1.1038122203419039e-5,8.816457412620772e-9,0.004631507147841215,-1.0948389067229884e-5,8.606690701628071e-9,0.004631806481354592,-1.0844288661248472e-5,8.364204739480547e-9,0.004632011465302068,-1.0771358781577292e-5,8.194291991699351e-9,0.004632147892557216,-1.0761401585255883e-5,8.170455351365712e-9,0.004632247893263616,-1.0831308542105932e-5,8.331728476942694e-9,0.00463234477781505,-1.0984114505098195e-5,8.685073680741978e-9,0.004632469369290628,-1.1210771926742844e-5,9.209415190899736e-9,0.004632647141513031,-1.1492171204089592e-5,9.860291714348777e-9,0.004632895765556187,-1.1801489544677315e-5,1.0575356211698413e-8,0.004633222987185644,-1.2107161747595294e-5,1.1281365019742708e-8,0.004633625109689717,-1.2376748980879223e-5,1.1903214390625413e-8,0.004634086659004174,-1.2581610090192167e-5,1.2374746891829162e-8,0.004634581752502566,-1.2701806877036646e-5,1.2650024924146413e-8,0.004635077356706937,-1.273044813037253e-5,1.2713298103112125e-8,0.004635538281190807,-1.2676599340062202e-5,1.2585709492729057e-8,0.004635933426539173,-1.2565907068775515e-5,1.2326775887080312e-8,0.0046362425090470906,-1.2438342120984666e-5,1.202920592778017e-8,0.004636462294497865,-1.234271921279755e-5,1.1806193185873564e-8,0.004636611028747824,-1.232775517799123e-5,1.1770617073140064e-8,0.004636729067608224,-1.2429993538057063e-5,1.2006973681361427e-8,0.004636873204322435,-1.2660614669240317e-5,1.2540806146547426e-8,0.004637103047741207,-1.2995764214321633e-5,1.3316407776853431e-8,0.004637461294852211,-1.3376967540621544e-5,1.4197950262497705e-8,0.00463795534065098,-1.3726217412767458e-5,1.5004554273269622e-8,0.004638550845381015,-1.3972478316380603e-5,1.5571711376454045e-8,0.004639183148953752,-1.4077211752893863e-5,1.5810383357853653e-8,0.0046397812865391925,-1.4045280259926954e-5,1.5732214181573113e-8,0.0046402914283477465,-1.3917086868911308e-5,1.5431235497281092e-8,0.004640688992994678,-1.3749519789539588e-5,1.50396004361683e-8,0.004640977811977925,-1.3597154104758875e-5,1.4683939035007512e-8,0.0046411816590931215,-1.3500634643284917e-5,1.4458435271925997e-8,0.004641334337283517,-1.3482814716284878e-5,1.4415936504639937e-8,0.004641471841569615,-1.3549864644392499e-5,1.45705737914381e-8,0.004641627345314647,-1.36943373473814e-5,1.4904873429144573e-8,0.004641828265389255,-1.3898382253809021e-5,1.5377192152694978e-8,0.004642094369945667,-1.4136568493739574e-5,1.592827642183505e-8,0.004642436229981527,-1.4378530825307724e-5,1.648746362443435e-8,0.004642853793025203,-1.4591962398589605e-5,1.6979710468902657e-8,0.00464333536372152,-1.4746476784586312e-5,1.7334602810121096e-8,0.004643857739129038,-1.481845010519349e-5,1.749756817785199e-8,0.00464438837763796,-1.479624509342569e-5,1.7441917675913e-8,0.0046448901141322415,-1.4684572553892183e-5,1.7178880316379137e-8,0.00464532817306209,-1.4506395760338885e-5,1.676197448758261e-8,0.0046456782783954416,-1.4300948688484878e-5,1.628240091514535e-8,0.004645933875498211,-1.4117326680498562e-5,1.5854168093428857e-8,0.004646110289799332,-1.4004423473821114e-5,1.5590715394014384e-8,0.004646244116896511,-1.399911276381716e-5,1.5577449679665026e-8,0.004646387005593405,-1.41153100211975e-5,1.5846355805771457e-8,0.004646594141764705,-1.4337032558028205e-5,1.6359950354097322e-8,0.004646909305258094,-1.4618613247030586e-5,1.701188561366317e-8,0.0046473503812339495,-1.4894178333601433e-5,1.7649042879564176e-8,0.004647900916773948,-1.5095625610264924e-5,1.811329983033688e-8,0.004648512809389593,-1.5173842404411922e-5,1.829077431406508e-8,0.004649120903019922,-1.5114403601433032e-5,1.8148248545685655e-8,0.004649663817187577,-1.4940331193331636e-5,1.7739550224659373e-8,0.004650101646361556,-1.4701189768492982e-5,1.7180166575556488e-8,0.004650423559198932,-1.4455016176381626e-5,1.6605176919502795e-8,0.004650644665764515,-1.4251827770794912e-5,1.613086614501808e-8,0.004650796624019296,-1.4124141025250696e-5,1.583268895658235e-8,0.004650917415804542,-1.4084914955533756e-5,1.5740543813909623e-8,0.004651043598431591,-1.4130241265291127e-5,1.5845089278510927e-8,0.0046512057278376125,-1.4243729279101672e-5,1.6107974164142077e-8,0.0046514261340793615,-1.4400690454054686e-5,1.6471579916206996e-8,0.00465171789456136,-1.4571531090473221e-5,1.6866922638427443e-8,0.004652084137226091,-1.4724599130893931e-5,1.7220302263998086e-8,0.00465251732741125,-1.4829134893015994e-5,1.746020024223448e-8,0.004652998819609395,-1.4859005735948932e-5,1.7525983107701823e-8,0.004653499526234626,-1.4797478165342453e-5,1.7378984205893643e-8,0.004653982822792938,-1.4642447874902636e-5,1.701461884775316e-8,0.004654410522758944,-1.4410540357957179e-5,1.6471859896107837e-8,0.004654751676673082,-1.4137726039344877e-5,1.5834608479389963e-8,0.0046549921899199246,-1.3874312315314267e-5,1.5219993013443092e-8,0.004655141733859297,-1.3673984905797297e-5,1.4752835810267254e-8,0.004655234441725839,-1.3579420898515158e-5,1.4532174851046341e-8,0.00465532189043984,-1.3609191262358246e-5,1.460084197006534e-8,0.00465545992364021,-1.3750758727023153e-5,1.4929278998332993e-8,0.004655693328327301,-1.3962304090208998e-5,1.5419907146882814e-8,0.004656043110456753,-1.4183068768481111e-5,1.5931259431933548e-8,0.0046565001678516875,-1.434927671056179e-5,1.631501554350779e-8,0.004657027305155954,-1.4411158052329369e-5,1.6455548921583325e-8,0.004657569281103155,-1.434612452943196e-5,1.630052615942731e-8,0.004658068049326739,-1.41639120076071e-5,1.5872851697627348e-8,0.0046584782426453645,-1.3901969676808915e-5,1.525993191601153e-8,0.0046587776708922075,-1.3613082255371558e-5,1.458484088844579e-8,0.004658969832612916,-1.3350233172794423e-5,1.397103491590227e-8,0.004659079003760188,-1.3154157206487545e-5,1.3513330900768914e-8,0.004659141208384155,-1.3046837117797856e-5,1.3262761688597618e-8,0.004659194957403009,-1.3031068730407019e-5,1.3225604937819598e-8,0.004659274330167408,-1.3094026415269862e-5,1.3371747416260096e-8,0.0046594050651191455,-1.3212282800757067e-5,1.3646426315830232e-8,0.004659602999671059,-1.3356523513515203e-5,1.3981232874721674e-8,0.004659873789227049,-1.3495310852038219E-05,1.430287645128278e-8,0.004660213024776066,-1.359808005239616e-5,1.4540151248134795e-8,0.00466060633304002,-1.3637992835869933e-5,1.4630579714044076e-8,0.00466102965981684,-1.3595349253137439e-5,1.4528372069494455e-8,0.004661450563042212,-1.3461902340691184e-5,1.421449651710166e-8,0.004661831730217652,-1.3245578696188559e-5,1.3707678548966238e-8,0.004662137755511344,-1.2973872164911173e-5,1.307227092715899e-8,0.004662344999202101,-1.2693012432152884e-5,1.2416231574338447e-8,0.0046624519407560735,-1.2460082818593683E-05,1.1872648439435237e-8,0.004662485004202495,-1.2327880026386206e-5,1.1564379854227212e-8,0.004662494901102442,-1.2327021407297365e-5,1.1562375295099926e-8,0.004662542595555069,-1.24533420275431e-5,1.185644126351985e-8,0.0046626799506357805,-1.2667322066857839e-5,1.2354101779958266e-8,0.004662933402383711,-1.2906251170550697e-5,1.2909087247827492e-8,0.004663297073919368,-1.3103506845817271e-5,1.3366273288023952e-8,0.004663736575308624,-1.3207064274389993e-5,1.360471420722314e-8,0.00466420034455511,-1.3191474217760806e-5,1.3565421464328888e-8,0.004664633821846689,-1.3061257113502004e-5,1.3259181775894936e-8,0.0046649923454657955,-1.284657142486857e-5,1.2756441236261749e-8,0.0046652500093320995,-1.2593575575264028e-5,1.2164869400910327e-8,0.004665403125135055,-1.2352518526780268e-5,1.160163133759852e-8,0.004665468293837048,-1.2166612359423423e-5,1.1167452954822372e-8,0.004665476372929213,-1.2064179756235221e-5,1.092829431744967e-8,0.004665464527011558,-1.205536188602705e-5,1.090765701107904e-8,0.00466546866248559,-1.2133139463074206e-5,1.1088976843000324e-8,0.004665517840456056,-1.2277264814901737e-5,1.1424838647350068e-8,0.00466563119751025,-1.245936221956031e-5,1.1848924275875613e-8,0.004665817006354218,-1.2647802841822536e-5,1.2287410809984839e-8,0.004666073053110041,-1.281166414378168e-5,1.2668190698852117e-8,0.004666387542373383,-1.292381306206243e-5,1.2928022906658796e-8,0.004666740117300406,-1.2963606556451226e-5,1.3018805625924864e-8,0.004667103089208761,-1.2919782368290056e-5,1.2914336858847914e-8,0.004667443516313451,-1.2793855787151033e-5,1.261828935995056e-8,0.004667727216102982,-1.2603634007130076e-5,1.2172443742013038e-8,0.004667925717887047,-1.2385223968453717e-5,1.1661335221281164e-8,0.004668025982969037,-1.2190587373047782e-5,1.1206425769168459e-8,0.004668040124918859,-1.2077562615726495e-5,1.0942668267392677e-8,0.004668009332740903,-1.2092131257680859e-5,1.0977046211594681e-8,0.004667995963365245,-1.2248776168792324e-5,1.1342816317376177e-8,0.004668063394253834,-1.2519839245074089e-5,1.1974895693262607e-8,0.004668252213447853,-1.2842352538933383e-5,1.272604191553377e-8,0.004668565476656956,-1.3140346753934688e-5,1.3419026252516424e-8,0.004668970137839872,-1.3350798188378615e-5,1.390712963685913e-8,0.00466941145688206,-1.3440881943664238e-5,1.4114239617360718e-8,0.004669831352637258,-1.3411820715628956e-5,1.4043647933471819e-8,0.004670183125758375,-1.3292231840828618e-5,1.3762398499525709e-8,0.004670439551567326,-1.3126587614643615e-5,1.3374333363953765e-8,0.0046705947835942166,-1.2963357965618242e-5,1.2992486691062576e-8,0.004670661871582767,-1.2845325839862214e-5,1.2716578643366719e-8,0.004670667699865216,-1.2802931475699457e-5,1.2617538625965364e-8,0.004670646681376949,-1.2850763728081769e-5,1.2729307862896565e-8,0.00467063427678483,-1.2987111806417097e-5,1.304775137827414e-8,0.004670661343090428,-1.3196164916613432e-5,1.353577457443399e-8,0.004670750064167247,-1.3452020070287972e-5,1.4132715042564545e-8,0.004670911777831962,-1.3723508501828329e-5,1.4765677409608379e-8,0.004671146597861861,-1.397894625705489e-5,1.5360669460035923e-8,0.004671444375319671,-1.4190158848444865e-5,1.5851986140975655e-8,0.004671786392194452,-1.4335593144657587e-5,1.6189419371909977e-8,0.004672147385320302,-1.440277455442945e-5,1.634395024210514e-8,0.004672497882915822,-1.439047323877524e-5,1.63128171558708e-8,0.004672807221955093,-1.4310754474099981e-5,1.6124358297051074e-8,0.004673047967062916,-1.4190585450886653e-5,1.5841798023873977e-8,0.004673202402940901,-1.4071681804180103e-5,1.556283414706472e-8,0.004673270739720579,-1.4006175424222032e-5,1.5409373309145138e-8,0.004673278417874302,-1.4045585886180635e-5,1.5501616287218707e-8,0.0046732771097705355,-1.4223112429589761e-5,1.5916656213600744e-8,0.0046733335426375954,-1.4535231411889031e-5,1.6645637433110732e-8,0.0046735060396706435,-1.4934337773744007e-5,1.7576826633511244e-8,0.004673819189801707,-1.5341741234222534e-5,1.852618723245616e-8,0.004674252268579398,-1.5677278964770178e-5,1.9306615085994873e-8,0.004674748944885229,-1.5888924620635015e-5,1.9797027686382072e-8,0.004675240882951573,-1.5966460031890974e-5,1.997414641383107e-8,0.004675670613593522,-1.593625842060622e-5,1.9900119679567408e-8,0.0046760041793818975,-1.5845643844857367e-5,1.9685820881802324e-8,0.00467623309851158,-1.5746690960885734e-5,1.945294625392006e-8,0.004676369818220206,-1.568457041001168e-5,1.930686205008403e-8,0.004676440772138309,-1.5691203227189234e-5,1.932191376955323e-8,0.004676479528732202,-1.5782987495501686e-5,1.9536206216259085e-8,0.004676520954653062,-1.5961033347667108e-5,1.995215400474037e-8,0.004676596422060922,-1.6212951573783454e-5,2.0540610281932875e-8,0.004676730027189161,-1.6515837372076925e-5,2.1247813816331533e-8,0.004676935979999788,-1.6840152095742693e-5,2.2004505046599017e-8,0.004677217318990602,-1.7154102391278926e-5,2.2736247570911134e-8,0.00467756602649892,-1.7428077777037665e-5,2.3373860561672378e-8,0.004677964479425937,-1.763863379374355e-5,2.3862716425329537e-8,0.0046783879238457065,-1.7771596392012232e-5,2.4169923607945506e-8,0.004678807583239352,-1.782417897198473e-5,2.4289203675387195e-8,0.004679194192743565,-1.780618647288843e-5,2.4243687912563586e-8,0.004679521978008149,-1.7740311713799754e-5,2.4086639550366526e-8,0.0046797732769125674,-1.7661270247751158e-5,2.3899445231071237e-8,0.004679943926326737,-1.7612934963310745e-5,2.378485408762777e-8,0.00468004874105327,-1.76419904879494e-5,2.38520116422879e-8,0.0046801248137174605,-1.7786845602176726e-5,2.4190427202702886e-8,0.004680228593309382,-1.806263404032576e-5,2.4834927068767032e-8,0.004680422650323219,-1.844760764224442e-5,2.5734020536887993e-8,0.0046807527992763975,-1.8880759513499523e-5,2.674458018490809e-8,0.0046812254701966765,-1.9278549072575866e-5,2.7671099756894892e-8,0.004681800427430815,-1.9566523632612258e-5,2.8339657629219468e-8,0.004682406079741662,-1.9708395147643984e-5,2.8665861411746463e-8,0.004682968366748158,-1.9715465849410977e-5,2.867679352392317e-8,0.004683435608529261,-1.9634266355882566e-5,2.8481924313167707e-8,0.0046837883337889595,-1.952439154406978e-5,2.822106187628867e-8,0.004684035487230924,-1.9439673756009193e-5,2.8020203083391307e-8,0.004684204485088165,-1.941806770279495e-5,2.7967929163297136e-8,0.00468433116167156,-1.9479029937500837e-5,2.8109428435669545e-8,0.004684452186456466,-1.9625176187452407e-5,2.845049597540157e-8,0.004684600168465979,-1.984553498761316e-5,2.896517248241957e-8,0.0046848006032723915,-2.0118998764571928e-5,2.9603786467988204e-8,0.0046850698397548065,-2.041773635670475e-5,3.0300926191513015e-8,0.004685413783371999,-2.0710763850050337e-5,3.098384943257845e-8,0.00468582740770953,-2.096777642395736e-5,3.1581541361914726e-8,0.004686295292293071,-2.1163165376747107e-5,3.203417446835051e-8,0.004686793459251504,-2.127986172954694e-5,3.230208207219933e-8,0.004687292561605285,-2.1312386356273433e-5,3.2372809600881676e-8,0.0046877621105637915,-2.126854613740853e-5,3.2264991110637834e-8,0.004688175258111988,-2.1169442043346494e-5,3.202831932504239e-8,0.004688513640797768,-2.104761290672734e-5,3.173919627450822e-8,0.004688771804655766,-2.0943260277204035e-5,3.149188772523059e-8,0.004688960704666771,-2.089847309766487e-5,3.138494951118754e-8,0.004689109427812848,-2.0949239557927876e-5,3.150244410680444e-8,0.0046892635417487075,-2.111546408427255e-5,3.189053130139887e-8,0.004689477922148566,-2.139077308886334e-5,3.253367882818093e-8,0.004689802698454854,-2.1736387602686895e-5,3.3340499356742825e-8,0.004690264446209853,-2.2085256460148676e-5,3.415361339714332e-8,0.004690850572478942,-2.2360461861946586e-5,3.4792836260214054e-8,0.004691507905376526,-2.2503277074614084e-5,3.512087981369812e-8,0.0046921603699025816,-2.2496547289027997e-5,3.5098078105129547e-8,0.004692737515622717,-2.2369205648309436e-5,3.4792895698371355e-8,0.0046931977430484575,-2.218033828194287e-5,3.434443116540985e-8,0.004693535450245421,-2.19946049648199e-5,3.390460552743203e-8,0.004693773572452373,-2.1862829343110403e-5,3.359254933534034e-8,0.0046939501630360635,-2.181362607661693e-5,3.3475032195887265e-8,0.004694106408800557,-2.1853986931876104e-5,3.356800326714713e-8,0.004694278929507639,-2.1974145041739544e-5,3.384814078091561e-8,0.004694495986966662,-2.2153135943492177e-5,3.4265942399950725e-8,0.00469477605708682,-2.236343686777121e-5,3.475658838964401e-8,0.004695127385027143,-2.25745849279392e-5,3.5248415385464474e-8,0.004695547882976639,-2.2756322352379375e-5,3.567032900021728e-8,0.004696025355911659,-2.2881787560675736e-5,3.595935203368904e-8,0.004696538399017729,-2.2930998865573962e-5,3.6068830865346576e-8,0.0046970585118214685,-2.2894428695522926e-5,3.597678695177047e-8,0.0046975538398428066,-2.277591695522771e-5,3.569266368776685e-8,0.004697994417085737,-2.2593897361128732e-5,3.52601055038316e-8,0.004698358163045725,-2.238005741037552e-5,3.475374675121492e-8,0.0046986364344812365,-2.2175013783692378e-5,3.4269031535764016e-8,0.0046988377483364,-2.2021316841364653e-5,3.3905777612987485e-8,0.004698988505350433,-2.1954843872662592E-05,3.3747957039559153e-8,0.00469913001615439,-2.199603289469974e-5,3.384312019587815e-8,0.004699311555481439,-2.2142626039551497e-5,3.418542095617081e-8,0.004699579681160445,-2.2366028659942287e-5,3.470720003209844e-8,0.004699965159038889,-2.261379023439517e-5,3.528496641002932e-8,0.0047004707613474824,-2.2820209470544427e-5,3.576439822294622e-8,0.004701065275270101,-2.29245915141501e-5,3.600321104272019e-8,0.0047016890656927665,-2.2891951736126434e-5,3.591970431021748e-8,0.004702272011748362,-2.2726666777386748e-5,3.5524736397453896e-8,0.004702756920507253,-2.2470877734699576e-5,3.491788013206634e-8,0.004703116987165939,-2.2187808782063738e-5,3.4248104068405246e-8,0.004703359534640568,-2.193925935774467e-5,3.3660754039070295e-8,0.004703517130520162,-2.176842696306175e-5,3.325714330433221e-8,0.004703633418269326,-2.1693450292192006e-5,3.3079469125848756e-8,0.004703750784664788,-2.1710014565138826e-5,3.311710181821752e-8,0.004703902999268972,-2.1798210735348334e-5,3.332284229703271e-8,0.00470411241473192,-2.1929606093883388e-5,3.362958798550564e-8,0.004704389870876045,-2.207267688476105e-5,3.396308166894864e-8,0.0047047356012256255,-2.2196523423997598e-5,3.425061394883235e-8,0.004705140226676658,-2.2273583221930157e-5,3.4427402906015455e-8,0.004705585684179088,-2.2282131344618075e-5,3.444250019797068e-8,0.004706046484988976,-2.2209080754436687e-5,3.426539393023329e-8,0.004706492021561705,-2.205305499960459e-5,3.389321201807501e-8,0.004706890608130669,-2.182697129221664e-5,3.3356730967267744e-8,0.00470721539646339,-2.1558758464267093e-5,3.2721977504560417e-8,0.004707451321018943,-2.12887104727388e-5,3.208392178194558e-8,0.004707601124258925,-2.1062650368795808e-5,3.1550339335174934e-8,0.004707687923092548,-2.092164673284272e-5,3.1217597646232705e-8,0.004707752373939844,-2.0890881213821516e-5,3.1144495257733445e-8,0.004707844271649323,-2.097124597532204e-5,3.1332583670419434e-8,0.004708010475613604,-2.113670162270532e-5,3.172008981581706e-8,0.004708282385389394,-2.1338748014371744e-5,3.219257613945702e-8,0.0047086664359290925,-2.15173693706775e-5,3.2608780636782456e-8,0.0047091404880734164,-2.161606952423453e-5,3.283599569519555e-8,0.004709657840613588,-2.159728736032355e-5,3.278626927707014e-8,0.0047101587972046815,-2.14536381865304e-5,3.244275536750323e-8,0.004710587092019814,-2.1210639927389882e-5,3.1866026733256766e-8,0.004710905784652387,-2.0918934500008726e-5,3.11756702803512e-8,0.004711106530119068,-2.0638435018091832e-5,3.051288304831013e-8,0.004711208865517889,-2.0420804081158147e-5,2.999917704131898e-8,0.004711250995690448,-2.029710843358638e-5,2.9707348003223693e-8,0.004711277151420492,-2.0274053881011356e-5,2.9652724627549498e-8,0.00471132674977426,-2.033766978305856e-5,2.9801983439850805e-8,0.00471142806619857,-2.046071242907155e-5,3.009067825446045e-8,0.004711596296366146,-2.061020016312087e-5,3.044100612335261e-8,0.004711834389857875,-2.0753171954947886e-5,3.077533281366249e-8,0.004712134965726818,-2.086041685204148e-5,3.1024925417154556e-8,0.004712482251510385,-2.090882235568343e-5,3.1135456149055995e-8,0.004712853737906606,-2.0883211847782863e-5,3.107133595210802e-8,0.004713221881139335,-2.0778334625325025e-5,3.082042383122008e-8,0.004713556597760101,-2.0601134262572815e-5,3.0399376917884984e-8,0.004713829354068818,-2.037263915355485e-5,2.9858068237885336e-8,0.004714019207495355,-2.0127999853239356e-5,2.9279591365504785e-8,0.004714120040236812,-1.9912737159773322e-5,2.8771311538676714e-8,0.00471414655809,-1.9773869991005393e-5,2.8443873226592142e-8,0.004714135386249772,-1.9746861801332327e-5,2.83804276963628e-8,0.004714138370032906,-1.984258160661189e-5,2.8606000254505665e-8,0.004714208596707071,-2.004036454826956e-5,2.9071316232283385e-8,0.004714383927031075,-2.029154199139544e-5,2.966130936884501e-8,0.00471467478824134,-2.0532945180363846e-5,3.022705867006223e-8,0.004715061013315357,-2.070513244011117e-5,3.0628741349271914e-8,0.00471549819391272,-2.0768559539906018e-5,3.0773644450018024e-8,0.004715930398805945,-2.0712828599232458e-5,3.06378229761092e-8,0.00471630479798327,-2.0557372487725065e-5,3.02675794944921e-8,0.00471658419168978,-2.0344538606421003e-5,2.9763064924636998e-8,0.004716754587575241,-2.012762846230072e-5,2.9250034311585e-8,0.004716826391143379,-1.9957347775696705e-5,2.8847903519089865e-8,0.004716829482927148,-1.9870328926400146e-5,2.8642734974974278e-8,0.004716804183631088,-1.9882591570309303e-5,2.8671899620700577e-8,0.004716791192796836,-1.9989005281011388e-5,2.8922902741116466e-8,0.004716823437325514,-2.016770532199581e-5,2.934387756265717e-8,0.004716921469150951,-2.0387043502867066e-5,2.986002387931219e-8,0.0047170924226144694,-2.0612596164450385e-5,3.0390138793191444e-8,0.004717331446500595,-2.081266616228881e-5,3.085955828244744e-8,0.00471762425529221,-2.0961852660023846e-5,3.120852397033979e-8,0.004717949786709429,-2.104309008518074e-5,3.139695112234478e-8,0.004718282560551554,-2.104890203008696e-5,3.1407378398035346e-8,0.00471859492533725,-2.0982516486430054e-5,3.1247623321056654e-8,0.004718859796079545,-2.0859052414961204e-5,3.0953605446153896e-8,0.004719054624823485,-2.0706285041295662e-5,3.059112867970817e-8,0.004719167008269947,-2.0563643657749342e-5,3.025342322589191e-8,0.0047192012609654915,-2.0477478018717793e-5,3.00498426889888e-8,0.00471918345441392,-2.0491050133859172e-5,3.0082155472353386e-8,0.004719160711673773,-2.0630138351970563e-5,3.041060704503147e-8,0.004719191097019601,-2.0889406258420564e-5,3.1021931692673706e-8,0.004719325043469325,-2.1227769789697886e-5,3.181866698159706e-8,0.0047195859260143365,-2.1578468896618452e-5,3.264310559084911e-8,0.004719960156972756,-2.187111814865657e-5,3.3329373513019146e-8,0.004720402230039262,-2.2055137896671795e-5,3.375863627291979e-8,0.004720851199728154,-2.211368644516015e-5,3.3891818178741824e-8,0.004721249742534635,-2.2064084478755165e-5,3.3770422384395773e-8,0.004721558271420089,-2.194802371751545e-5,3.349326327499581e-8,0.004721761248337392,-2.181765833721016e-5,3.318355542341268e-8,0.004721866556401599,-2.1722520963282726e-5,3.295805030285286e-8,0.004721900238871268,-2.169987115382176e-5,3.29043510790176e-8,0.004721898892204645,-2.176929055241197e-5,3.306826983285239e-8,0.004721901529417458,-2.193141803818353e-5,3.345092527192641e-8,0.004721942348745987,-2.2170269412426117e-5,3.401426136456454e-8,0.004722045516212493,-2.2458138717909424e-5,3.4692640398515564e-8,0.004722222546618573,-2.2761699487966296e-5,3.540726851507083e-8,0.0047224722135377,-2.3047940802877143e-5,3.6080226653327896e-8,0.004722782394577666,-2.3288951948910685e-5,3.6645758612571877e-8,0.004723132980101565,-2.3465103100195668e-5,3.7057739558551584e-8,0.004723499026608934,-2.3566743782828097e-5,3.729363200615465e-8,0.004723853726366984,-2.3594919509001365e-5,3.7356145869933e-8,0.004724171226410891,-2.356158846622636e-5,3.727375668144662e-8,0.00472442964344223,-2.3489522051841577e-5,3.710048713221879e-8,0.004724614776565834,-2.3411574874169688e-5,3.691415587823861e-8,0.004724724794459883,-2.3368277341243487e-5,3.6810591870453345e-8,0.0047247752100325596,-2.340213360934399e-5,3.6890033197833116e-8,0.004724801818033701,-2.354741153860014e-5,3.723294414462482e-8,0.00472485768521177,-2.3816423663497148e-5,3.786770260091306e-8,0.004725000635390749,-2.418751526032683e-5,3.8742466858000376e-8,0.004725272431033011,-2.4603620051597823e-5,3.972202334985268e-8,0.0047256788219663705,-2.4987702204493527e-5,4.062439541897351e-8,0.004726183285667441,-2.5270759185625143e-5,4.128696584233639e-8,0.004726720126803429,-2.541754230471784e-5,4.162712542300643e-8,0.004727219448344189,-2.5435941739691993e-5,4.166429361538732e-8,0.004727629770664268,-2.536784151980682e-5,4.149811650246318e-8,0.00472792886355938,-2.5270329894455154e-5,4.126387077300937e-8,0.00472812265068321,-2.5197835046972124e-5,4.109015364379114e-8,0.0047282373150355555,-2.5190669974525258e-5,4.1071880240448236e-8,0.004728309665470908,-2.5270343003186838e-5,4.125937504726307e-8,0.004728378624615121,-2.543968430350618e-5,4.165883422548709e-8,0.004728478767596398,-2.5685707126707573e-5,4.223916565564198e-8,0.004728635885651726,-2.5983880913205705e-5,4.294209090323031e-8,0.004728864409439411,-2.6303109090072288e-5,4.369389967187808e-8,0.00472916659618418,-2.6610845597161917e-5,4.44175634064523e-8,0.004729533321857145,-2.687781278328495e-5,4.5043926732075706e-8,0.00472994622235607,-2.708187235910797e-5,4.55208730022123e-8,0.004730380793270376,-2.721067737099242e-5,4.5819553184842186e-8,0.004730809906752847,-2.7262961196945158e-5,4.593735403726144e-8,0.004731207297948036,-2.724866569169805e-5,4.589813042879811e-8,0.004731550882303068,-2.7188193463415645e-5,4.5750407942570875e-8,0.004731825972564864,-2.7110878798737e-5,4.5563763450471336e-8,0.004732028530653421,-2.7052515132200603e-5,4.54229491228676e-8,0.004732168446389242,-2.7051350258781955e-5,4.541834024160813e-8,0.004732272116670077,-2.714157631827611e-5,4.563044734216501e-8,0.004732382358303023,-2.734381236381859e-5,4.610740117539504e-8,0.004732552676207028,-2.765400554259749e-5,4.6838853150868065e-8,0.004732833512182073,-2.803550331529912e-5,4.773748847006038e-8,0.004733252285295634,-2.842190019560124e-5,4.864598097253564e-8,0.004733796293531172,-2.8735835655547945e-5,4.9381511830951945e-8,0.004734411109839088,-2.891853713979851e-5,4.980557132802008e-8,0.004735019503554785,-2.895397730306729e-5,4.9880998252676156e-8,0.004735551138537044,-2.887270533546891e-5,4.9680920882470014e-8,0.00473596575267552,-2.873482839748109e-5,4.9348284107208375e-8,0.004736259519104328,-2.8605104853960317e-5,4.903667122874668e-8,0.004736457060975534,-2.8533821667809858e-5,4.886493863585071e-8,0.0047365979415711565,-2.85485921602435e-5,4.88979128990018e-8,0.004736724583238949,-2.8654807118183317e-5,4.914769787656253e-8,0.0047368742116397,-2.8840382877356432e-5,4.958511728727826e-8,0.004737074552126241,-2.9081541619000465e-5,5.015347478913712e-8,0.004737342012367782,-2.934812648323624e-5,5.078111482310837e-8,0.004737681309886265,-2.960821833601568e-5,5.139231870366264e-8,0.004738086098954303,-2.9832193363411564e-5,5.191692419486976e-8,0.004738540469209245,-2.9996259595434974e-5,5.229874245767923e-8,0.0047390212881655396,-3.0085394338945098e-5,5.2502529913061444e-8,0.004739501377336211,-3.0095423581682325e-5,5.251886124976056e-8,0.004739953305782397,-3.0033870472254683e-5,5.236603682676017e-8,0.004740353348319325,-2.9919407976351642e-5,5.208868447062693e-8,0.004740685200385828,-2.9779991128983356e-5,5.175327771239827e-8,0.004740943182403257,-2.9649741613378564e-5,5.1440738209547884e-8,0.004741134674185391,-2.9564621576085497e-5,5.1236171222247815e-8,0.004741281429687509,-2.955689735080932e-5,5.121571324845782e-8,0.004741419089674041,-2.9648317114137292e-5,5.1430346955513816e-8,0.004741593583568248,-2.984236535396184e-5,5.18876132323745e-8,0.0047418528064249385,-3.0117417530783683e-5,5.2535574522677666e-8,0.004742232999460031,-3.0424697664623252e-5,5.325821214909581e-8,0.004742742611363063,-3.069609207813721e-5,5.3894094209571386e-8,0.004743351393757184,-3.086414788615748e-5,5.4283751424790724e-8,0.004743994368040548,-3.088836563852584e-5,5.433186801908802e-8,0.004744593460110826,-3.0773559410401626e-5,5.4050676811265004e-8,0.004745086788273111,-3.0567784478253706e-5,5.3554919237006306e-8,0.004745448989905369,-3.034083898991905e-5,5.301067418598428e-8,0.0047456930853903715,-3.015732469647893e-5,5.257126350003612e-8,0.004745857698513026,-3.00585998089884e-5,5.233439298931279e-8,0.004745990240669041,-3.0058200221043662e-5,5.233146185427817e-8,0.004746133999600095,-3.01466801907586e-5,5.2539325380684306e-8,0.004746321325199566,-3.0299826522431672e-5,5.289999214373297e-8,0.004746571565708012,-3.048628868783824e-5,5.333878061980279e-8,0.004746891547053987,-3.067323831866283e-5,5.377769034777425e-8,0.004747276976592629,-3.083031101807034e-5,5.414468688672485e-8,0.0047477141402886116,-3.09325591886319E-05,5.4380693556431183e-8,0.004748181886555148,-3.096289364885244e-5,5.444541244979396e-8,0.004748654088097438,-3.09141513535335e-5,5.432224087989675e-8,0.004749102826477359,-3.079058892868887e-5,5.4021765189798875e-8,0.0047495023578297945,-3.060826542501298e-5,5.358256772490767e-8,0.004749833466407175,-3.0393770407297746e-5,5.306810148158317e-8,0.0047500874842839194,-3.018108231591561e-5,5.2559163277776153e-8,0.004750269208928283,-3.000667785776047e-5,5.214226026089898e-8,0.004750398005292498,-2.990333609399654e-5,5.1894905169507964e-8,0.004750506508683392,-2.9893424852776115e-5,5.186969825178604e-8,0.004750636541043871,-2.9982645840082855e-5,5.2079533030619567e-8,0.0047508320083346,-3.0155421919572188e-5,5.248676449937229e-8,0.004751128908639331,-3.037369192805859e-5,5.300052553271625e-8,0.0047515437134295745,-3.058146946640733e-5,5.348771766126394e-8,0.004752063484848125,-3.071700733657849e-5,5.380196084787112e-8,0.0047526432287152715,-3.073156493559227e-5,5.382809002665862e-8,0.004753215530274019,-3.060859876345908e-5,5.352758456900073e-8,0.004753711939495655,-3.0373149193153703e-5,5.2960713748294996e-8,0.004754087100048578,-3.0083973403278307e-5,5.226769683183297e-8,0.00475433293603724,-2.98112136590755e-5,5.1615475629158006e-8,0.004754476264544549,-2.9611822552670604e-5,5.113920082596975e-8,0.004754563953700199,-2.9514823359041654e-5,5.0907249040929476e-8,0.0047546455613278705,-2.9520016886330627e-5,5.0918372072733805e-8,0.004754761071596459,-2.9605722627759065e-5,5.112036823852704e-8,0.004754935662167024,-2.9739033755819657e-5,5.143462572713782e-8,0.0047551796096890735,-2.988434036747737e-5,5.1776389895648226e-8,0.004755490589258526,-3.0008869624587908e-5,5.206783588245407e-8,0.004755856442393838,-3.008584029224015e-5,5.224546763974042e-8,0.004756257668350731,-3.0096339668500227e-5,5.2264540791731686e-8,0.004756669706745484,-3.0030731792701057e-5,5.210242554479061e-8,0.004757065414585785,-2.9889908539192638e-5,5.176159886049536e-8,0.004757418195542284,-2.968619040159789e-5,5.1271759843174285e-8,0.00475770601363651,-2.9443203318333868e-5,5.0689459342253564e-8,0.004757915965546911,-2.9193873541743718e-5,5.009323271378707e-8,0.004758048438176281,-2.8975983699953833e-5,4.957295059706262e-8,0.0047581194741599594,-2.882542250153593e-5,4.921372935448555e-8,0.004758160019778779,-2.876818870394926e-5,4.9076934374705044e-8,0.004758211358591651,-2.8813062505827567e-5,4.9182827912228046e-8,0.004758317093348088,-2.894711954955259e-5,4.950002836532726e-8,0.004758513086696229,-2.913579719092093e-5,4.994582695633771e-8,0.004758817511140333,-2.932837760191171e-5,5.03993731608605e-8,0.004759223605850981,-2.9468701036464705e-5,5.072723219425754e-8,0.004759697867909933,-2.9509504216527897e-5,5.0817464553032814e-8,0.004760185864983653,-2.942696235017769e-5,5.061410130962157e-8,0.0047606259543624555,-2.9230317643366145e-5,5.0139889000795495e-8,0.004760967607467908,-2.896139174117637e-5,4.9494965504536796e-8,0.004761187350905263,-2.8682116608214554e-5,4.882704196243258e-8,0.004761294966547717,-2.8454389880011927e-5,4.828336259201367e-8,0.004761327275387122,-2.8321230768383856e-5,4.796585845162461e-8,0.004761333553681048,-2.829714704173953e-5,4.790836114893017e-8,0.0047613601652829966,-2.8369688621673795e-5,4.808053312846534e-8,0.004761440321646852,-2.8508399895063426e-5,4.8409387338905586e-8,0.004761590551451071,-2.8675522491192136e-5,4.880485640357133e-8,0.004761812082991868,-2.883449707617644e-5,4.917998782520274e-8,0.004762094385548418,-2.8955069947828657e-5,4.946298307321452e-8,0.004762418882065095,-2.9015693696433737e-5,4.960280392062293e-8,0.0047627620311700624,-2.9004461174501594e-5,4.95713500331758e-8,0.004763097828331392,-2.8919547543918302e-5,4.936452599578333e-8,0.004763400221147088,-2.8769621484632385e-5,4.90032528762637e-8,0.004763646058855578,-2.8574085268911304e-5,4.8534040160042696e-8,0.004763818946533213,-2.8362398774863e-5,4.802731915464349e-8,0.004763913739565946,-2.8171404920085826e-5,4.757097276326134e-8,0.004763940543520972,-2.8039773963918373e-5,4.725700354486537e-8,0.004763926283878361,-2.7999613583819032e-5,4.7161505527736824e-8,0.004763911790083301,-2.806694015820014e-5,4.732201788368541e-8,0.004763943561668426,-2.8234348316907707e-5,4.772020956502153e-8,0.004764061768513518,-2.846950262937871e-5,4.827848357257109e-8,0.004764288248044224,-2.8721294087771193e-5,4.8874818169044365e-8,0.004764618840848933,-2.893247019251986e-5,4.93729414401414e-8,0.004765022978940383,-2.905493603698263e-5,4.965875709174304e-8,0.004765450868508584,-2.9062967578863874e-5,4.967170122917772e-8,0.004765846191254104,-2.8960399760946087e-5,4.942169071629253e-8,0.00476616076776282,-2.8779715550303997e-5,4.8986766544630736e-8,0.004766367084636814,-2.8573141543301774e-5,4.849172329484978e-8,0.004766464911858467,-2.839814847115955e-5,4.807347695622499e-8,0.00476647980983421,-2.8301831799976193e-5,4.784386143983262e-8,0.004766454199070231,-2.830937480805551e-5,4.7862255367856655e-8,0.004766434603844106,-2.8420157629011527e-5,4.8126495550133353e-8,0.004766459867818386,-2.861169104607286e-5,4.8582435764613466e-8,0.004766553900979995,-2.8848469249434867e-5,4.9145161379864336e-8,0.004766723895020026,-2.9091731049801776e-5,4.9722271610959204e-8,0.004766962652236033,-2.9307102792118214e-5,5.023203099217928e-8,0.004767252783211253,-2.946903329270971e-5,5.061383669831442e-8,0.004767570966247876,-2.956252059197733e-5,5.083224211036534e-8,0.00476789143265435,-2.9583263200849124e-5,5.0877272768619633e-8,0.004768188657904238,-2.9537233992896767e-5,5.076341708753041e-8,0.004768439713838026,-2.9440208044921784e-5,5.0528530531352904e-8,0.004768626910754468,-2.9317193423369705e-5,5.0232483468787865e-8,0.004768741178477299,-2.9201099070795987e-5,4.9953931538163455e-8,0.004768786027644776,-2.9129513499080413e-5,4.978252629146496e-8,0.004768780936853772,-2.9138496012208616e-5,4.980400285879896e-8,0.0047687618966803106,-2.9253256552848995e-5,5.007792821246455e-8,0.004768776430770757,-2.94777909524039e-5,5.0613091054872876e-8,0.004768871988096792,-2.9788111750287958e-5,5.13515752527904e-8,0.004769080444607102,-3.013432954967566e-5,5.2173957718739495e-8,0.004769405284770623,-3.0453486715106665e-5,5.293006343952431e-8,0.004769818220406904,-3.0688999004594416e-5,5.3485350267577706e-8,0.00477026743433048,-3.080834002271513e-5,5.376298803352503e-8,0.004770693577738604,-3.081168201237658e-5,5.3764285152528835e-8,0.004771046589895863,-3.072935915638893e-5,5.3562407814568835e-8,0.004771297631526678,-3.0610999818195513e-5,5.3276237909610404e-8,0.004771443711692161,-3.051122681918304e-5,5.303613422492912e-8,0.004771505396973143,-3.047631542556714e-5,5.295212013490912e-8,0.004771519499267242,-3.0534710642808274e-5,5.3091406911566415e-8,0.004771529205577235,-3.0692816320908944e-5,5.346855026149306e-8,0.00477157418650815,-3.0936189653487376e-5,5.404847750248202e-8,0.004771682921045021,-3.123511651048176e-5,5.4759893534474465e-8,0.004771868687189363,-3.1552574400663744e-5,5.551430977654335e-8,0.004772129449714966,-3.1852223337845775e-5,5.622508871487745e-8,0.004772450721118148,-3.210457768014518e-5,5.682212037646142e-8,0.0047728099065585915,-3.2290564110685556e-5,5.726024480323222e-8,0.004773180754965365,-3.240266257319448e-5,5.752190311025016e-8,0.004773537085899212,-3.244442374528547e-5,5.761592957241243e-8,0.004773855633711976,-3.242925814099788e-5,5.757463774878549e-8,0.004774118342142201,-3.237905496994603e-5,5.7450525834272396e-8,0.004774314614586185,-3.23226647010406e-5,5.731264700502641e-8,0.004774443914942631,-3.2293765111534964e-5,5.724146147285952e-8,0.004774518652136438,-3.232717786829844e-5,5.731994509929363e-8,0.0047745663374796085,-3.245259117379958e-5,5.761852250142311e-8,0.004774628801644312,-3.268548015279706e-5,5.817341730913397e-8,0.004774755642402249,-3.301726301171104e-5,5.896332753649877e-8,0.004774990554962329,-3.340982109567715e-5,5.989660608993938e-8,0.004775353818295921,-3.3800784181514464e-5,6.082409330155231e-8,0.004775829687604098,-3.412186477507274e-5,6.158296115132251e-8,0.004776367868533359,-3.4323594773016025e-5,6.205572173406188e-8,0.004776900497853547,-3.439347655809735e-5,6.22134491263007e-8,0.004777365818310518,-3.435798439395554e-5,6.21203712505869e-8,0.004777726423271264,-3.426947678704886e-5,6.190234646575702e-8,0.004777975587727213,-3.418704078505039e-5,6.170085067616404e-8,0.004778133031878161,-3.416016772550692e-5,6.163388088984261e-8,0.004778235183303571,-3.42193194337018e-5,6.177353927618648e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_27.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_27.json deleted file mode 100644 index 2b68f8a1..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_27.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":27000,"numberOfSamples":426,"samples":[0.004778324486778677,-3.437325503603603e-5,6.213990841775234e-8,0.0047784403655323285,-3.4611193149972956e-5,6.270647293317436e-8,0.004778612794687001,-3.490776213298559e-5,6.34120907874662e-8,0.004778858592736182,-3.52292773450405e-5,6.41760174740733e-8,0.004779180332297561,-3.554033000747647e-5,6.491361305699471e-8,0.0047795676373042825,-3.580972313910667e-5,6.555048782196374e-8,0.004780000304382801,-3.601491695515349e-5,6.603309632804475e-8,0.00478045244087296,-3.61445559073166e-5,6.63347373647879e-8,0.004780896788498023,-3.619907152539314e-5,6.64569282050896e-8,0.004781308537182374,-3.6189716300693844e-5,6.642701476463283e-8,0.004781668287402928,-3.613665338138569e-5,6.62935418736394e-8,0.004781964263597514,-3.606664631235279e-5,6.612070094818705e-8,0.004782194088007322,-3.6010502207012165e-5,6.598220199376154e-8,0.004782366358377176,-3.600003307813221e-5,6.595397202033107e-8,0.004782501973157172,-3.6063967015481664e-5,6.610431957871602e-8,0.004782634428155468,-3.622211612037997e-5,6.647996630880908e-8,0.004782807312744113,-3.647777437681964e-5,6.708796154697767e-8,0.004783066725500625,-3.681018070253991e-5,6.787788985789277e-8,0.004783447527929692,-3.717158351927006e-5,6.873512189479286e-8,0.004783956543699519,-3.749495769285591e-5,6.949941757309266e-8,0.004784561694818515,-3.7714824470447004e-5,7.001467512930746e-8,0.00478519734376055,-3.779386901530488e-5,7.019245393058328e-8,0.004785787298279908,-3.773988586048272e-5,7.005238005891471e-8,0.004786273540716633,-3.760159745695435e-5,6.971198893123057e-8,0.004786634261718939,-3.7446681679021194e-5,6.93338948131939e-8,0.004786883955125812,-3.7336538281738074e-5,6.90651418882107e-8,0.004787060855944783,-3.731025026111713e-5,6.89987545085644e-8,0.004787211498019626,-3.738052485901743e-5,6.916423518663561e-8,0.004787378723491085,-3.753768633517913e-5,6.953747098677388e-8,0.004787594743852002,-3.775688736390837e-5,7.005827277528313e-8,0.004787878341866488,-3.8005421267547694e-5,7.064797754466723e-8,0.004788234677867704,-3.824887091042978e-5,7.122411974828502e-8,0.004788656578890198,-3.845602832364749e-5,7.171211724931977e-8,0.004789126866304347,-3.8602762874008655e-5,7.205447458736902e-8,0.004789621527438917,-3.867476505188969e-5,7.221733392634786e-8,0.004790113453092092,-3.866900598852055e-5,7.219394452663505e-8,0.004790576389242894,-3.859380569021363e-5,7.200475975629059e-8,0.004790988658217021,-3.846749668906106e-5,7.169414035802423e-8,0.004791336185455692,-3.831592746623132e-5,7.132428928460062e-8,0.004791614602286293,-3.8169236193829984e-5,7.096748066882624e-8,0.004791830442019499,-3.8058199395276177E-05,7.069730505809583e-8,0.00479200147328233,-3.8010251494226334e-5,7.057912997799612e-8,0.00479215608282581,-3.8045112493544786e-5,7.065962097547686e-8,0.004792331243570715,-3.816988109148568e-5,7.095502401154791e-8,0.00479256801539422,-3.837391090721481e-5,7.143902873254914e-8,0.004792903356231363,-3.8625101009650084e-5,7.203412021826269e-8,0.00479335809982377,-3.887092912081732e-5,7.261428947824125e-8,0.004793923998139211,-3.904832069801235e-5,7.302876037880577e-8,0.004794557121329183,-3.910366330394545e-5,7.314982344552248e-8,0.004795186187943556,-3.901641098772414e-5,7.292918982979318e-8,0.004795737032643518,-3.881216157437762e-5,7.242916797983955e-8,0.004796161501972789,-3.855411099464743e-5,7.180203477009054e-8,0.004796453566145229,-3.831658356890081e-5,7.122636889591443e-8,0.004796644767523727,-3.815714860499036e-5,7.084000022037542e-8,0.004796785949434881,-3.8101951194646106e-5,7.070485098911682e-8,0.004796928139441377,-3.8146598603855446e-5,7.080934608157665e-8,0.004797110480654036,-3.8265789851055167e-5,7.109188904690533e-8,0.004797355877127002,-3.8424311612934556e-5,7.146748579270787e-8,0.004797671612426517,-3.8585616852327366e-5,7.184835086333892e-8,0.004798052093481322,-3.8717282547673696e-5,7.215687639979793e-8,0.004798481982683185,-3.879416904832568e-5,7.233306811500727e-8,0.0047989392109531745,-3.880032466659669e-5,7.233903786826962e-8,0.004799398014519919,-3.873014716490181e-5,7.216177815700216e-8,0.004799832156249859,-3.858883316916818e-5,7.181423253686315e-8,0.004800218353251468,-3.839193072968296e-5,7.133417138730679e-8,0.004800539728226463,-3.816370201797726e-5,7.07801739212383e-8,0.004800788798428815,-3.7934150450836535e-5,7.022440790334248e-8,0.004800969422381577,-3.773493298607536e-5,6.97427737273164e-8,0.004801097307136082,-3.7594608437565975e-5,6.940350057998089e-8,0.004801198860837516,-3.753375575082618e-5,6.925545753494772e-8,0.004801308307002621,-3.7560557353341817e-5,6.931760143740602e-8,0.004801463061629263,-3.766739513003747e-5,6.957089748412672e-8,0.0048016973159992595,-3.7829085241195104e-5,6.995424232825527e-8,0.004802033897188718,-3.800393663211438e-5,7.036721161540528e-8,0.004802475381486049,-3.8139426649914707e-5,7.068384881196978e-8,0.004802997237534293,-3.8183940325160886e-5,7.078086051437349e-8,0.0048035477616877155,-3.810365748834886e-5,7.057799420498539e-8,0.004804059432364746,-3.789890582121566e-5,7.007704800926735e-8,0.004804471058177286,-3.76100617891968e-5,6.93758159734603e-8,0.004804751226949466,-3.730566920695092e-5,6.863938578566553e-8,0.0048049094711126545,-3.705654492532993e-5,6.803781398940207e-8,0.004804988697932718,-3.691017647857788e-5,6.768458911635844e-8,0.004805045208603211,-3.687881976068849e-5,6.760819207952647e-8,0.004805128912216125,-3.6943695478478026e-5,6.776250536534154e-8,0.004805272128763522,-3.706800766501402e-5,6.805842303113509e-8,0.0048054875443432725,-3.72102043926267e-5,6.839587172762585e-8,0.004805771578807736,-3.733305531184578e-5,6.868556225257375e-8,0.004806109373196501,-3.740819210339049e-5,6.885971585954908e-8,0.004806479267214914,-3.741763766075652e-5,6.887556737614801e-8,0.00480685624919262,-3.7353970688048305e-5,6.871568343569287e-8,0.00480721474503835,-3.722005965565962e-5,6.838732853486281e-8,0.004807531254878627,-3.70285788369557e-5,6.792132402469517e-8,0.004807787168840347,-3.680107359176237e-5,6.736978068548045e-8,0.0048079717908961535,-3.656606685754552e-5,6.680147748275388e-8,0.004808085124176199,-3.635572067784862e-5,6.629375291303479e-8,0.0048081395655390005,-3.6201003683608846e-5,6.59208353445968e-8,0.004808159619935799,-3.61259119702826e-5,6.573995300854134e-8,0.004808179052187587,-3.614182096799145e-5,6.577781399967254e-8,0.0048082354644977225,-3.624339663861216e-5,6.602088125342372e-8,0.004808363016906486,-3.640739698014146e-5,6.641263422122376e-8,0.004808584568140996,-3.659514206004428e-5,6.685967165663355e-8,0.004808904762436531,-3.6758854267688404e-5,6.724710168628325e-8,0.00480930579650223,-3.685155258136531e-5,6.746239580653564e-8,0.0048097478566896616,-3.683927126708737e-5,6.742470100953433e-8,0.004810176029910032,-3.6712847565078014e-5,6.711298772615927e-8,0.0048105340254307105,-3.649482817530326e-5,6.658239512536003e-8,0.004810781727205723,-3.62365842449442e-5,6.595705126594526e-8,0.004810909644980501,-3.6003671889103674e-5,6.539470778083783e-8,0.004810942478516832,-3.5853999525254e-5,6.503419712779448e-8,0.004810929054258762,-3.581891665158464e-5,6.495006857326439e-8,0.0048109239580987374,-3.589619723046781e-5,6.513597488805307e-8,0.0048109704482596355,-3.605632765339819e-5,6.552011162684835e-8,0.004811091479469972,-3.625616637154878e-5,6.599830095926331e-8,0.0048112894999106535,-3.645235261818129e-5,6.646628961790225e-8,0.004811551496979631,-3.661003899809157e-5,6.684062633294758e-8,0.004811855326073649,-3.6706519877171644e-5,6.706718834733222e-8,0.004812175008010524,-3.673147922115121e-5,6.71216166824625e-8,0.00481248442724685,-3.668578285980148e-5,6.70063528600365e-8,0.004812759857408077,-3.6580011791983614e-5,6.67471364140862e-8,0.004812982021847438,-3.643312892218514e-5,6.638984182107787e-8,0.004813138260380984,-3.627105788419161e-5,6.599705939990736e-8,0.004813224984539436,-3.612453739463318e-5,6.56428706687843e-8,0.004813250027706149,-3.6025539008764395e-5,6.540413556464342e-8,0.004813233901618618,-3.600194055235022e-5,6.53476083256435e-8,0.004813208641342787,-3.6070981482546236e-5,6.55141956879046e-8,0.004813213185891162,-3.623309956685937e-5,6.590422431888505e-8,0.0048132853329533815,-3.6468577247922494e-5,6.646953796652841e-8,0.00481345196089862,-3.6739232782648675e-5,6.711775543238068e-8,0.004813720524850067,-3.699585543676539e-5,6.773031548224511e-8,0.004814074915372328,-3.718990777229592e-5,6.819070851646075e-8,0.004814477519636433,-3.7286327454266165e-5,6.841524919716474e-8,0.004814877412507499,-3.727371265226798e-5,6.837744468682739e-8,0.004815222824200392,-3.71687674239285e-5,6.811846623591315e-8,0.004815474776181273,-3.70132472069625e-5,6.773954080785747e-8,0.0048156180606356,-3.686348225678969e-5,6.737652512252384e-8,0.004815665783668138,-3.677486127562191e-5,6.716247159200004e-8,0.004815655222405848,-3.678604759224073e-5,6.718971555136587e-8,0.004815636005506843,-3.690868613654817e-5,6.74853269118757e-8,0.004815655154643246,-3.712641741469069e-5,6.800902880734398e-8,0.0048157448657402905,-3.740272786418989e-5,6.86723392503097e-8,0.004815916982414414,-3.769330697538445e-5,6.936842915828944e-8,0.004816164398472773,-3.79575991566434e-5,6.999989097850887e-8,0.004816466732888395,-3.8166161444911164e-5,7.049630552378684e-8,0.004816796998892661,-3.830332545250297e-5,7.082047667647441e-8,0.004817127128752034,-3.8366574426466915e-5,7.096680517792435e-8,0.004817431716377734,-3.8364425072400815e-5,7.095614538559232e-8,0.00481769031494261,-3.831406952629976e-5,7.0830151666776e-8,0.004817889007363463,-3.823930287395324e-5,7.064632660863894e-8,0.004818021924002364,-3.81685964240486e-5,7.047337979987863e-8,0.004818092995005395,-3.8132677946559405e-5,7.038533637487357e-8,0.004818117609598462,-3.8160829347254704e-5,7.045252292139183e-8,0.0048181231757472446,-3.8275439457385075e-5,7.072838433001155e-8,0.004818147032808319,-3.848524220234855e-5,7.123323584537503e-8,0.004818230263552585,-3.877913888410908e-5,7.193954194116859e-8,0.004818407376247594,-3.9123929426344404e-5,7.276667979907158e-8,0.004818694517905241,-3.946919365675648e-5,7.359290131063591e-8,0.004819081226702352,-3.975987623674142e-5,7.428575222689352e-8,0.004819530473516512,-3.99528372131395e-5,7.474192447320143e-8,0.004819988207444505,-4.003071053802827e-5,7.492052207630327e-8,0.0048203989246250615,-4.000728896884301e-5,7.485582965376748e-8,0.004820721175466344,-3.99227597487728e-5,7.464556945092878e-8,0.004820937782280773,-3.9831445677784674e-5,7.442110541926777e-8,0.004821058434419171,-3.978679151255124e-5,7.431111753324506e-8,0.004821115078288102,-3.982808284365596e-5,7.44096350669423e-8,0.0048211522270188,-3.9972043873461636e-5,7.475600152324611e-8,0.004821215190839854,-4.021085655268812e-5,7.533039650683856e-8,0.004821339447086454,-4.051642323333889e-5,7.606436621672032e-8,0.004821543793180569,-4.084903826994292e-5,7.686186217830935e-8,0.004821828560137223,-4.11675330397259e-5,7.762370019061549e-8,0.00482217843219588,-4.143791773110746e-5,7.826830249781045e-8,0.004822568060222116,-4.163862375087511e-5,7.874420409142698e-8,0.004822968276370532,-4.176204785493435e-5,7.903364411314588e-8,0.0048233512962861805,-4.1813332547424874e-5,7.914952587908982e-8,0.004823694268337095,-4.180773689787612e-5,7.912902718095061e-8,0.004823981341733217,-4.176770959006623e-5,7.902653839294732e-8,0.004824204843306262,-4.172022434438517e-5,7.890725119874452e-8,0.004824366170721857,-4.169434217802275e-5,7.884127164436675e-8,0.0048244767088938545,-4.1718500655906905e-5,7.889702962949885e-8,0.004824558542278362,-4.1816828861910714e-5,7.9132317175072e-8,0.004824644046356498,-4.2004005130913916e-5,7.958186192139638e-8,0.004824772810595939,-4.227902970506275e-5,8.02424031086156e-8,0.004824984330163837,-4.261986981161869e-5,8.105999852427741e-8,0.0048253063789773926,-4.2982701249766916e-5,8.192845535537351e-8,0.004825742302472369,-4.330968240475467e-5,8.2708249557431e-8,0.004826263889668254,-4.354578668059347e-5,8.326714000557609e-8,0.004826816164327769,-4.365883275531775e-5,8.352838122738419e-8,0.004827334389224904,-4.3652515189787744e-5,8.350199407923697e-8,0.0048277656748831246,-4.356505406150206e-5,8.328128245698638e-8,0.00482808475136242,-4.3454640222978786e-5,8.300742298950006e-8,0.0048282979694060126,-4.337986978855226e-5,8.282198985286413e-8,0.004828436715004647,-4.3383781338829196e-5,8.28283556019412e-8,0.004828545452468338,-4.3485739353153795e-5,8.307227830943268e-8,0.004828669442671055,-4.368097256269977e-5,8.354112596095182e-8,0.004828845131978453,-4.394543747541324e-5,8.417594361299053e-8,0.004829094332003,-4.42434357404026e-5,8.489003053203357e-8,0.004829422222056958,-4.453594609792681e-5,8.558908046994333e-8,0.004829818689134246,-4.4788154520325726e-5,8.618928271603903e-8,0.004830262162433468,-4.497503014521456e-5,8.663067376891177e-8,0.004830724791376845,-4.508429236527066e-5,8.688419593273334e-8,0.004831177763389958,-4.5116784857431304e-5,8.695250414418422e-8,0.0048315958105310045,-4.50848066644472e-5,8.686584714086303e-8,0.004831960372320328,-4.50092207251216e-5,8.667501419792826e-8,0.004832261385448886,-4.4916181410082026e-5,8.644339426785272e-8,0.004832498085672877,-4.4834021165063305e-5,8.623945104183476e-8,0.004832679280731162,-4.479034989518507e-5,8.612971656792317e-8,0.004832823322580668,-4.480906858922817e-5,8.61715560370843e-8,0.004832957631610085,-4.490685000713927e-5,8.640463908636807e-8,0.0048331170643941285,-4.508874878499018e-5,8.684036295819687e-8,0.004833339822081472,-4.5343323574385394e-5,8.745021561454051e-8,0.004833659599911437,-4.5639123415037367e-5,8.815754137046817e-8,0.004834094074838598,-4.592604139982e-5,8.884105976880853e-8,0.004834633097564738,-4.6145321609871045e-5,8.935914049205118e-8,0.004835233759482804,-4.624855257649796e-5,8.959560230484134e-8,0.004835829415303181,-4.621862951064732e-5,8.951018080070509e-8,0.004836352230776127,-4.6080232054244594e-5,8.916366565204528e-8,0.0048367583349983355,-4.589150422661235e-5,8.869757625100208e-8,0.004837041591904654,-4.572106996194247e-5,8.827831621545146e-8,0.004837230223456968,-4.562385027524527e-5,8.803847379686291e-8,0.004837371762779652,-4.562714338453696e-5,8.804318221037112e-8,0.004837516153686477,-4.572936473719342e-5,8.828738354028514e-8,0.004837703559825233,-4.590705729913291e-5,8.871321255880796e-8,0.00483795842100459,-4.6124666861455577e-5,8.923395641208231e-8,0.0048382884248457615,-4.634354743735913e-5,8.975592732878355e-8,0.004838686449812278,-4.652885932931713e-5,9.019505444720963e-8,0.004839134059291325,-4.6654302346770156e-5,9.048817401084265e-8,0.00483960577414928,-4.670490119196287e-5,9.059963781515475e-8,0.004840073592346507,-4.6677962776577816e-5,9.052354945919353e-8,0.004840511260350432,-4.6582397345525144e-5,9.028205993460479e-8,0.004840897899231785,-4.643670396318439e-5,8.992042145949509e-8,0.004841220660300779,-4.626596989787898e-5,8.949965282921296e-8,0.004841476202205037,-4.6098371678003375e-5,8.908802385796573e-8,0.004841671077489782,-4.596168029442229e-5,8.875259106524241e-8,0.004841821307091204,-4.587997080031785e-5,8.855125453694367e-8,0.004841951292609372,-4.587045888723051e-5,8.852512147964674e-8,0.004842091964053706,-4.5940344193465115e-5,8.869088863412212e-8,0.004842277739297711,-4.6083631809650075e-5,8.903322182845005e-8,0.004842541493972926,-4.627838807084122e-5,8.949828371537751e-8,0.004842906839177331,-4.648600438823033e-5,8.999219477976895e-8,0.004843378264295116,-4.665522221668618e-5,9.039097681872455e-8,0.004843932381435793,-4.6733606371812626e-5,9.056834871587784e-8,0.004844516593310677,-4.6686017948423326e-5,9.044026966797496e-8,0.004845061297440305,-4.651301745333522e-5,9.000924058638993e-8,0.004845504427784852,-4.6256995746914114e-5,8.93789350952813e-8,0.004845816313409309,-4.598827316210438e-5,8.872033893206934e-8,0.004846009719910427,-4.5777184591241536e-5,8.820391758061302e-8,0.004846129972474116,-4.566860671556084e-5,8.793778061329034e-8,0.0048462338316596935,-4.567181248329228e-5,8.794324136066889e-8,0.004846370227429732,-4.576600567215227e-5,8.816863162886767e-8,0.0048465699861102345,-4.591338738919411e-5,8.852141023091782e-8,0.004846844129874208,-4.6071908146491065e-5,8.889930925992923e-8,0.004847187112262369,-4.6204138643279386e-5,8.921179902089594e-8,0.004847581703514996,-4.6282067896565305e-5,8.939150694429025e-8,0.004848003735402131,-4.6289076937789076e-5,8.939877769506586e-8,0.004848426256645651,-4.6220321509909585e-5,8.922246700657916e-8,0.004848823209408606,-4.608209856359733e-5,8.887836627853265e-8,0.004849172664527739,-4.58903562975773e-5,8.840557932192903e-8,0.0048494595475039315,-4.5668426291373705e-5,8.786099087737668e-8,0.0048496777143903665,-4.544400174802944e-5,8.731188333905859e-8,0.004849831083297237,-4.524549703219852e-5,8.682706510070045e-8,0.0048499335706496585,-4.5098191704872816e-5,8.646751496052212e-8,0.004850007839811998,-4.502058698290767e-5,8.627758023189437e-8,0.004850082971399407,-4.502123491055191e-5,8.627733894012528e-8,0.00485019108473835,-4.509627653317102e-5,8.645669590689583e-8,0.004850362866722029,-4.522799803925022e-5,8.677198648497969e-8,0.004850621906510939,-4.5384910987798636e-5,8.71463393443206e-8,0.004850977946640694,-4.552441540774088e-5,8.747633199424684e-8,0.00485142013660625,-4.5599608404899196e-5,8.764862963748815e-8,0.0048519131380055204,-4.557121093968653e-5,8.756886324253519e-8,0.004852400538216197,-4.5422915883702246e-5,8.719862480298039e-8,0.004852819081156075,-4.517383633579113e-5,8.658536065820687e-8,0.004853121273694221,-4.4878623615075926e-5,8.586240756352643e-8,0.004853295526580276,-4.461012521329985e-5,8.52067471895604e-8,0.004853370910340709,-4.443133874108983e-5,8.477085726904584e-8,0.004853402989489355,-4.437253239360528e-5,8.462723494908248e-8,0.004853450340338429,-4.4425573958519136e-5,8.475489986913897e-8,0.004853555566747505,-4.4554520782041413e-5,8.506551757055743e-8,0.004853737798332979,-4.471246662007726e-5,8.54446544743408e-8,0.00485399486389547,-4.485554721718429e-5,8.57858896141624e-8,0.004854309864890948,-4.495075979662197e-5,8.600964247263456e-8,0.00485465803028982,-4.497849770452831e-5,8.6069040778254e-8,0.00485501203358417,-4.493206747983682e-5,8.594850455856457e-8,0.00485534568228858,-4.481608527441229e-5,8.565974574854902e-8,0.004855636618776108,-4.464461889212684e-5,8.523726941055656e-8,0.004855868536584048,-4.4439150233652795e-5,8.473347207406128e-8,0.0048560330722339125,-4.422617519806977e-5,8.421282174134603e-8,0.004856131296365982,-4.4034205116743515e-5,8.374453608584602e-8,0.004856174444895931,-4.389004599187381e-5,8.339349699528367e-8,0.004856183359155293,-4.381463425405478e-5,8.321012126246628e-8,0.004856186304500604,-4.381908244061987e-5,8.322079181766202e-8,0.0048562152009108475,-4.3901681750652377e-5,8.342065742125228e-8,0.004856300584346492,-4.4046572784289005e-5,8.37705159905011e-8,0.004856465867596215,-4.422466583704176e-5,8.419918887759595e-8,0.004856721671702306,-4.439714167069116e-5,8.46121777512187e-8,0.004857061176355107,-4.452169624559631e-5,8.490696041970339e-8,0.004857457829840346,-4.456149265628484e-5,8.499476400738042e-8,0.00485786732258919,-4.4495941699599566e-5,8.482662558070934e-8,0.0048582357611451545,-4.433064375541632e-5,8.44172762033907e-8,0.004858514335168011,-4.4101716857274364e-5,8.385533918607352e-8,0.004858676764439197,-4.386931833014717e-5,8.32873433067394e-8,0.004858731337204977,-4.369916734671689e-5,8.287271910808891e-8,0.004858719353578516,-4.363884359422422e-5,8.272626402178683e-8,0.004858699079100403,-4.370113971203409e-5,8.287790899006382e-8,0.004858723862983524,-4.3863152455982114e-5,8.32708541147057e-8,0.004858826040038608,-4.4079389942548624e-5,8.379377681762571e-8,0.00485901243298159,-4.429951477497208e-5,8.432416681478761e-8,0.004859269289883763,-4.448198863401187e-5,8.476146671893096e-8,0.004859570954995191,-4.460045524794661e-5,8.504236029963514e-8,0.004859887795941977,-4.464428204949593e-5,8.514179476144743e-8,0.004860191622124641,-4.461614115330714e-5,8.506688634502332e-8,0.004860458789785439,-4.452889224023546e-5,8.48492775788132e-8,0.004860671945597038,-4.440278682495274e-5,8.453839235720549e-8,0.004860821241729715,-4.426305156165498e-5,8.419563819915824e-8,0.004860905419245433,-4.4137473414217795e-5,8.388856225560573e-8,0.004860932724572903,-4.405349915154474e-5,8.368376120026044e-8,0.004860921196088654,-4.403452027360999e-5,8.363778704610134e-8,0.004860897562807879,-4.4095524083173727e-5,8.378654746993848e-8,0.004860894101884112,-4.4238943389541296e-5,8.413526183041853e-8,0.0048609433408634845,-4.4451997534014956e-5,8.465211854456047e-8,0.004861071294856948,-4.470688491827875e-5,8.526891053304732e-8,0.004861290736213975,-4.4964675805282034e-5,8.589067031036176e-8,0.004861596402411748,-4.518269904195639e-5,8.641375721967553e-8,0.00486196380325942,-4.5324110154403064e-5,8.674916232953769e-8,0.0048623525742310615,-4.536760086172835e-5,8.684603658726279e-8,0.004862714420798966,-4.531482706925229e-5,8.670954354944289e-8,0.004863004623796651,-4.519303097661249e-5,8.640693812132527e-8,0.004863194723425296,-4.505076964306804e-5,8.605688184505726e-8,0.0048632825102846704,-4.494612337857568e-5,8.58005774809639e-8,0.004863294732214557,-4.492967036023607e-5,8.576036145889535e-8,0.004863279646140609,-4.50281209417457e-5,8.600009804265731e-8,0.004863291238192513,-4.5235972657266385e-5,8.650521261792416e-8,0.004863371875000471,-4.5519265521149334e-5,8.719217023603693e-8,0.004863541092600532,-4.5828989880735264e-5,8.794132978880563e-8,0.0048637941431590335,-4.611699389480268e-5,8.863570335939151e-8,0.004864108348633099,-4.6347665140982225e-5,8.918925654220265e-8,0.00486445241548828,-4.650270904600831e-5,8.95582979767788e-8,0.0048647945683711405,-4.658026758675538e-5,8.973908538631549e-8,0.004865107760312099,-4.659122884457311e-5,8.975868058567857e-8,0.004865372216069882,-4.655509521210519e-5,8.966485595145175e-8,0.004865576369720018,-4.649651590121914e-5,8.95177115085765e-8,0.004865717179949249,-4.644257685804242e-5,8.938315205316097e-8,0.004865800395588709,-4.642041241650156e-5,8.932709842864613e-8,0.004865840829426269,-4.6454505120622764e-5,8.940887781848442e-8,0.004865862139653059,-4.656317873149144e-5,8.967262906616372e-8,0.00486589520436499,-4.675433988431925e-5,9.013692766243163e-8,0.00486597415698355,-4.7021367342236717e-5,9.07848659725663e-8,0.004866129742279287,-4.7340909048838094e-5,9.15588685419079e-8,0.004866380968437412,-4.7674714425056845e-5,9.236536298478788e-8,0.004866727661902241,-4.797676853483728e-5,9.309231162293983e-8,0.004867147324684734,-4.8204752728047944e-5,9.363717379329655e-8,0.004867598631309231,-4.833237436364809e-5,9.393686151571851e-8,0.00486803127888161,-4.835807099496604e-5,9.398874966956663e-8,0.004868399226752945,-4.8306738611208255e-5,9.385460419655338e-8,0.0048686730911499205,-4.8223736532853264e-5,9.364566598366033e-8,0.004868847969216985,-4.816304071077976e-5,9.349354754634237e-8,0.0048689445715649204,-4.817300077705271e-5,9.351546946352385e-8,0.004869003383995121,-4.8283613222312364e-5,9.378341924616291e-8,0.004869073380924081,-4.849890638879081e-5,9.43059380023238e-8,0.0048691985524858695,-4.8796843985408144e-5,9.50282614209952e-8,0.004869406558763143,-4.9136789945777165e-5,9.585077822881535e-8,0.0048697031730176215,-4.947169627205198e-5,9.665881714263925e-8,0.004870073718317038,-4.9760441298475204e-5,9.735263346838005e-8,0.004870489786100687,-4.9976304469416066e-5,9.786787764373727e-8,0.004870917867218918,-5.010990840288102e-5,9.818254906626896e-8,0.004871326805083185,-5.016747905294032e-5,9.831256717497081e-8,0.004871692531052498,-5.016661596207553e-5,9.830134495028733e-8,0.004872000142688164,-5.0131652452055496e-5,9.820844897666668e-8,0.004872244237261572,-5.008976155652556e-5,9.810014547881626e-8,0.004872428488982316,-5.0068019068499616e-5,9.804229692860984e-8,0.004872565118915182,-5.0091037618228904e-5,9.809461966944169e-8,0.0048726744092658725,-5.017854275436142e-5,9.830475483883204e-8,0.004872783856378547,-5.034234927557437e-5,9.870086948139556e-8,0.00487292606572329,-5.058265619676878e-5,9.928265588588883e-8,0.0048731343054660824,-5.0884445663438285e-5,1.0001269113882292e-7,0.004873435129492483,-5.1215919899950034e-5,1.0081284930929764e-7,0.0048738390660209,-5.153170034332811e-5,1.015723136253397e-7,0.004874332805219763,-5.178266204412348e-5,1.0217165527867006e-7,0.004874877889632444,-5.1930947916088274e-5,1.0251939608479708e-7,0.004875419222669628,-5.196437324983978e-5,1.0258697726965176e-7,0.004875901546822159,-5.190279042143044e-5,1.0242405238386324e-7,0.004876286929160504,-5.179247995187442e-5,1.0214451691172397e-7,0.004876565554442809,-5.1691121210262656e-5,1.0188954108256096e-7,0.004876756238178176,-5.165032541885692e-5,1.0178476106510073e-7,0.004876898311797196,-5.170234825273362e-5,1.0190790776405611e-7,0.004877039291090606,-5.185415619525043e-5,1.0227463542533915e-7,0.004877222603926023,-5.20886997024062e-5,1.0284205932149231e-7,0.004877478233490123,-5.237148471881915e-5,1.0352515418660084e-7,0.004877817707882309,-5.2659998699574115e-5,1.0421992098956346e-7,0.004878233764547773,-5.291357147653802e-5,1.0482740644614637e-7,0.004878704103850562,-5.310151400306657e-5,1.0527339067231532e-7,0.0048791978095219886,-5.3207947753445196e-5,1.0551996632875121e-7,0.004879682486508378,-5.323275948828798e-5,1.055676880907866e-7,0.0048801303140343175,-5.318929968967715e-5,1.0544982140066945e-7,0.004880521970866183,-5.3100190207577814e-5,1.0522202640813102e-7,0.004880848294653186,-5.299267897057388e-5,1.0495098947741473e-7,0.0048811102117961675,-5.289457264711433e-5,1.0470451475918726e-7,0.004881317747189281,-5.2831136722353006e-5,1.045440020638691e-7,0.004881488756100408,-5.282274765893747e-5,1.0451875219165502e-7,0.004881647595748994,-5.2882791831743e-5,1.0466084584560046e-7,0.004881823499265498,-5.301535663747745e-5,1.0497951455693293e-7,0.004882047968987757,-5.321257874700818e-5,1.0545473459947656e-7,0.004882350207115018,-5.34522364381064e-5,1.0603152097503244e-7,0.004882749931583773,-5.3697319596594616e-5,1.0661911602920183e-7,0.004883248411975124,-5.390029444311228e-5,1.0710159048430002e-7,0.004883821223283848,-5.40142565780382e-5,1.0736509452548331e-7,0.004884418535029374,-5.400964585550486e-5,1.07338516263783e-7,0.004884977331862179,-5.388945231346987e-5,1.0703038492932809e-7,0.004885442982784979,-5.369291520334631e-5,1.0653767571805211e-7,0.0048857896031786405,-5.348285896525935e-5,1.060146273029446e-7,0.004886027899428079,-5.33225701704739e-5,1.0561598542362421e-7,0.004886197488183362,-5.3254761974328e-5,1.0544546399226637e-7,0.004886350220054461,-5.329186339414478e-5,1.0553216327134056e-7,0.00488653376420074,-5.341832436145469e-5,1.058366269418165e-7,0.004886780973520583,-5.3599972431194304e-5,1.0627419538425782e-7,0.004887105836022719,-5.379505921217329e-5,1.0674231474866518e-7,0.00488750437159898,-5.3963749688183614e-5,1.071437647657893e-7,0.004887958428542934,-5.4074868096297026e-5,1.074029666188478e-7,0.004888440866556042,-5.410987220354813e-5,1.0747544257958971e-7,0.004888921197063378,-5.406429862465683e-5,1.0735113586693954e-7,0.004889370931079509,-5.3946902121682926e-5,1.0705217492870693e-7,0.004889767913025726,-5.377692855867965e-5,1.0662613496775146e-7,0.004890099148351,-5.3580229669963764e-5,1.0613649899040003e-7,0.0048903619623596834,-5.3384985707783635e-5,1.0565218481282615e-7,0.004890563646224889,-5.321774155887791e-5,1.0523787065252472e-7,0.004890720050330306,-5.310023848256073e-5,1.0494629332969267e-7,0.00489085365033552,-5.304708763981897e-5,1.0481260896297154e-7,0.004890991351657461,-5.306401912048959e-5,1.0485014474108545e-7]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_3.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_3.json deleted file mode 100644 index 568a5959..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_3.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":3000,"numberOfSamples":1000,"samples":[-0.0016674126654346861,-5.729007527752374e-7,-1.4186514962201376e-8,-0.0016673064653587321,-6.734015165127343e-7,-1.4270276706700349e-8,-0.0016671184978181936,-7.942288639572809e-7,-1.4371055120518062e-8,-0.0016668581653082658,-8.937549802808163e-7,-1.4454094104781238e-8,-0.0016665462863460693,-9.416288807763305e-7,-1.4494058993362982e-8,-0.0016662092022260732,-9.201664606449159e-7,-1.4476216298494372e-8,-0.0016658745541862263,-8.237755484396502e-7,-1.4395945891238539e-8,-0.0016655683268689287,-6.578186550518726e-7,-1.4257765362438796e-8,-0.0016653124526036561,-4.3741842925891825e-7,-1.4074304544820363e-8,-0.0016651224530400707,-1.8607276082775895e-7,-1.3865132894139859e-8,-0.0016650049642489826,6.643303169026634e-8,-1.3655018765663274e-8,-0.0016649554928538104,2.8739437967418395e-7,-1.347113935991257e-8,-0.0016649572160637774,4.4604795424859426e-7,-1.3339056817593825e-8,-0.0016649817855313575,5.194876808583452e-7,-1.3277813795917761e-8,-0.0016649928181043465,4.985157505581373e-7,-1.329507262967021e-8,-0.00166495207648607,3.9179414860133283e-7,-1.3383654246342673e-8,-0.0016648274069321705,2.26664827416035e-7,-1.352084347660865e-8,-0.001664600739494372,4.5708357821865315e-8,-1.367124421905444e-8,-0.001664274219706894,-1.0088239670451744e-7,-1.3793127784445051e-8,-0.0016638726869829803,-1.6616023108150796e-7,-1.3847473701249546e-8,-0.0016634410124484337,-1.1869904209770958e-7,-1.3808176255662588e-8,-0.0016630354517974334,4.659577780072841e-8,-1.3671009811639623e-8,-0.001662709627560605,3.030262655914423e-7,-1.3458136463059741e-8,-0.0016624982880314673,5.958730436677693e-7,-1.3214963229037875e-8,-0.001662404794976831,8.568537842964569e-7,-1.2998163907749735e-8,-0.0016623988702162175,1.0254972177202318e-6,-1.2857973826241794e-8,-0.0016624271346917532,1.0685455003698803e-6,-1.2822084766277138e-8,-0.0016624319248438782,9.883600460942418e-7,-1.2888614390257493e-8,-0.001662369242835807,8.174787260993229e-7,-1.3030565315055226e-8,-0.0016622183938909184,6.041843871353809e-7,-1.3207794337616674e-8,-0.0016619818565370786,3.9717316279278375e-7,-1.3379782718210806e-8,-0.0016616789185444716,2.3502260822879676e-7,-1.3514435597222689e-8,-0.0016613377123989804,1.417265131744283e-7,-1.3591822041815075e-8,-0.0016609886089808544,1.2662367606576446e-7,-1.360423147824086e-8,-0.0016606598282278315,1.863922842656112e-7,-1.3554490273298172e-8,-0.0016603748199426104,3.0744517886406376e-7,-1.3453938412913645e-8,-0.0016601505255394024,4.680421085231016e-7,-1.3320649411749458e-8,-0.0016599957713533597,6.402384067973255e-7,-1.3177803860265977e-8,-0.0016599094977454972,7.922656339357963e-7,-1.3051723165875262e-8,-0.0016598791098382528,8.920717595398815e-7,-1.296895475612751e-8,-0.0016598798337515695,9.124839151887528e-7,-1.2952012505708826e-8,-0.001659876379622952,8.376861160842476e-7,-1.3014014454721298e-8,-0.0016598280484381447,6.695105801256583e-7,-1.3153456420237919e-8,-0.0016596973256014155,4.309782162426044e-7,-1.3351256087288848e-8,-0.001659460185844518,1.644717783767708e-7,-1.3572258355341262e-8,-0.0016591147270322442,-7.656124715275952e-8,-1.3772130406953462e-8,-0.0016586845140589572,-2.408327142852044e-7,-1.3908356700286018e-8,-0.0016582146152118225,-2.934361433791715e-7,-1.3952042824758485e-8,-0.0016577609941446497,-2.2641155822799227e-7,-1.3896646268225657e-8,-0.0016573762399432718,-6.21980795145008e-8,-1.3760786009222337e-8,-0.0016570956693766155,1.5125835864904947e-7,-1.3584155440668849e-8,-0.0016569277304044742,3.526938844470182e-7,-1.3417439166449944e-8,-0.0016568517179810498,4.838995413033776e-7,-1.3308801583491872e-8,-0.0016568239567060939,5.055051370474298e-7,-1.329085416886814e-8,-0.0016567907846579653,4.069873023778711e-7,-1.3372361772156796e-8,-0.0016567038867919353,2.0748592272561992e-7,-1.3537525963856996e-8,-0.001656532487673912,-5.231661404744325e-8,-1.375267653077842e-8,-0.0016562685745488837,-3.2332365832738283e-7,-1.3977143471321514e-8,-0.0016559247754694372,-5.607837026808751e-7,-1.4173848477561865e-8,-0.0016555275418913935,-7.327632792039998e-7,-1.4316343411791168e-8,-0.0016551092006448183,-8.233258722118555e-7,-1.4391445802169112e-8,-0.0016547013993568505,-8.316848376668471e-7,-1.439852456672699e-8,-0.0016543308264849162,-7.693391900307951e-7,-1.4347111821174578e-8,-0.0016540168884855639,-6.568154472154755e-7,-1.4254194224863743e-8,-0.00165377050241833,-5.208100635030763e-7,-1.4141844859881727e-8,-0.001653593196269087,-3.917048152325665e-7,-1.4035172614624135e-8,-0.001653476129350162,-3.0088888763530243e-7,-1.3960118899539777e-8,-0.0016533992421155022,-2.7714172882948965e-7,-1.3940479436687606e-8,-0.0016533313967630901,-3.4151069511884616e-7,-1.3993675666328718e-8,-0.001653232946576946,-5.008677652271779e-7,-1.4125420729844042e-8,-0.001653062183142646,-7.418000865678651e-7,-1.4324648124704472e-8,-0.0016527858361718897,-1.0281008249946432e-6,-1.456142157572885e-8,-0.0016523911376223348,-1.305464686483764e-6,-1.4790826634502255e-8,-0.0016518942603108112,-1.5146795210217696e-6,-1.4963914427081036e-8,-0.001651339688429203,-1.609920243457309e-6,-1.5042853245080335e-8,-0.0016507887609035258,-1.5746267527137686e-6,-1.501402985970417e-8,-0.0016503014049699613,-1.4275884845194972e-6,-1.4893009020259092e-8,-0.0016499186673924447,-1.2167625516751627e-6,-1.4719368976416159e-8,-0.0016496525262988243,-1.0042695210536724e-6,-1.4544312694847968e-8,-0.0016494852722868205,-8.488903215522008e-7,-1.4416272286595473e-8,-0.0016493768933366411,-7.916520763817829e-7,-1.4369068693422452e-8,-0.0016492770441696662,-8.477319335831267e-7,-1.441525088113211e-8,-0.0016491379089976894,-1.005586142802875e-6,-1.454535921366001e-8,-0.0016489247906258263,-1.2324077723442385e-6,-1.4732398295614608e-8,-0.0016486222435663186,-1.483745124523919e-6,-1.4939753931208416e-8,-0.0016482349077829455,-1.714387062746813e-6,-1.5130169934377415e-8,-0.0016477837047942081,-1.8876251196414704e-6,-1.5273388453025773e-8,-0.0016472992687706423,-1.9809318567924716e-6,-1.53508288088995e-8,-0.0016468148667739665,-1.987610693939075e-6,-1.5356941194346824e-8,-0.0016463605427636564,-1.915263460295526e-6,-1.529794271457019e-8,-0.0016459592556230336,-1.7824940981911972e-6,-1.5189110139549575e-8,-0.0016456248820582223,-1.6151699815473968e-6,-1.5051713360546717e-8,-0.0016453614347904178,-1.4430148462818047e-6,-1.4910218742385646e-8,-0.0016451628120618224,-1.2966201405178637e-6,-1.4789829372760213e-8,-0.0016450127057533186,-1.2044728826030512e-6,-1.4714032583746818e-8,-0.0016448847709624051,-1.1893868953393184e-6,-1.4701653351213367e-8,-0.0016447437874436506,-1.2638103881750775e-6,-1.4762980827432679e-8,-0.0016445491773054968,-1.4241708565546202e-6,-1.48951005064794e-8,-0.0016442623193067107,-1.645902905672155e-6,-1.5077791633897704e-8,-0.0016438578535539828,-1.8825890625995552e-6,-1.5272828105373147e-8,-0.0016433361724119703,-2.073293524915233e-6,-1.5430051194420875e-8,-0.0016427306855190664,-2.1595591992381907e-6,-1.5501400836018825e-8,-0.0016421028587470339,-2.107131410238427e-6,-1.545878784662949e-8,-0.0016415236596336047,-1.921503495197351e-6,-1.5306805835881395e-8,-0.0016410491716874508,-1.6475995048951014e-6,-1.508237666232406e-8,-0.0016407026930217476,-1.3532595827599134e-6,-1.4841150585489634e-8,-0.0016404710798181709,-1.1058220927750292e-6,-1.4638324030823384e-8,-0.0016403140434198668,-9.529880693486804e-7,-1.4513000663883932e-8,-0.0016401794241349037,-9.138189075949228e-7,-1.4480834585139251e-8,-0.001640017698453548,-9.79444485492997e-7,-1.4534599598191043e-8,-0.0016397921504842823,-1.1199629554508742e-6,-1.46498259445195e-8,-0.001639483962540219,-1.2938873374757163e-6,-1.4792536911725107e-8,-0.0016390929025693608,-1.4576102121358978e-6,-1.492701055511908e-8,-0.0016386346780947172,-1.5734220969873702e-6,-1.5022352898574618e-8,-0.0016381360741017184,-1.615194314249089e-6,-1.50571474431728e-8,-0.0016376290513289884,-1.5712506992188948e-6,-1.502179647791281e-8,-0.0016371449438908516,-1.4444928408342774e-6,-1.4918620999811586e-8,-0.0016367096648583616,-1.25031555175269e-6,-1.4760165902237422e-8,-0.0016363404739891797,-1.0131188796195411e-6,-1.4566365366279228e-8,-0.0016360443826047542,-7.623240043753878e-7,-1.4361298196704363e-8,-0.0016358178081207191,-5.285826195157557e-7,-1.4170084868955413e-8,-0.0016356469788772767,-3.4036970890659786e-7,-1.4016082203265821e-8,-0.001635508814606122,-2.207663722595964e-7,-1.3918227118982464e-8,-0.0016353723164385856,-1.840892669518823e-7,-1.3888261221685396e-8,-0.0016352009622329746,-2.3204470491520787e-7,-1.3927578205263703e-8,-0.0016349571713373055,-3.4963943026521634e-7,-1.4023883873503605e-8,-0.0016346099310555375,-5.023932688054426e-7,-1.4148931817790818e-8,-0.0016341454885156152,-6.3792299560969e-7,-1.4259849140121573e-8,-0.0016335782650784292,-6.955174267981529e-7,-1.4307009536395608e-8,-0.0016329555381133835,-6.248455078933967e-7,-1.4249353069369657e-8,-0.001632348566823429,-4.0811994916454653e-7,-1.4072462495238987e-8,-0.0016318292392897165,-7.307325909948915e-8,-1.3799065103672127e-8,-0.0016314426223732346,3.1411804635436726e-7,-1.348317422928833e-8,-0.0016311911484804568,6.740899862647185e-7,-1.3189486706427881e-8,-0.0016310385568320672,9.431757478148973e-7,-1.2969887537649966e-8,-0.0016309281956906096,1.0909595365989285e-6,-1.284917620325891e-8,-0.0016308035869936743,1.1218851358131656e-6,-1.2823744428951683e-8,-0.001630622539391083,1.0659851233981184e-6,-1.286910999649688e-8,-0.0016303628898681499,9.662126791094569e-7,-1.2950244535657924e-8,-0.0016300220532569065,8.673019924964457e-7,-1.303067628890683e-8,-0.0016296132995635643,8.078877149326865e-7,-1.3078931636879651e-8,-0.001629160810966706,8.157006448712503e-7,-1.3072446478192921e-8,-0.0016286945140845575,9.051596921306019e-7,-1.2999506114425888e-8,-0.001628245126395128,1.0769022975441644e-6,-1.285960415768863e-8,-0.0016278397306271277,1.3189544201936767e-6,-1.266248230864526e-8,-0.001627498165347806,1.6092434451098838e-6,-1.2426094284497363e-8,-0.0016272305284777825,1.919140067868813e-6,-1.2173739988352222e-8,-0.0016270360259148394,2.2175661941671596e-6,-1.1930728972988056e-8,-0.0016269031154630333,2.475096567993343e-6,-1.1721030329836182e-8,-0.0016268106690123906,2.6677037698851066e-6,-1.1564201830643506e-8,-0.0016267299509751117,2.7800877693262435e-6,-1.1472661493037969e-8,-0.0016266273869119789,2.808609891480967e-6,-1.1449301618478332e-8,-0.0016264683188791577,2.7638226285538478e-6,-1.148545475645509e-8,-0.001626222281076474,2.6722456015579204e-6,-1.1559486532781036e-8,-0.0016258702666007566,2.576093825543154e-6,-1.1637054006801947e-8,-0.001625413368763386,2.528652681956703e-6,-1.1674892793466553e-8,-0.0016248800163113045,2.5829769218688514e-6,-1.163000825805575e-8,-0.0016243264182511817,2.7739410660516134e-6,-1.147422855629942e-8,-0.001623824448257784,3.0994362029174313e-6,-1.1209399713251122e-8,-0.0016234371005962335,3.5125193005639037e-6,-1.0873674286989874e-8,-0.0016231924460283597,3.934280626806754e-6,-1.0531046713794774e-8,-0.0016230722116879442,4.2839261521980505e-6,-1.0247004462157263e-8,-0.0016230223920017024,4.509022315061528e-6,-1.0064052989792204e-8,-0.001622977701628644,4.599308318664541e-6,-9.990503166746648e-9,-0.0016228844735368534,4.580979504172208e-6,-1.0005062897292258e-8,-0.0016227124043607017,4.500425340947215e-6,-1.007001881606373e-8,-0.0016224552660553113,4.4079367639713336E-06,-1.0144494972609784e-8,-0.001622125516269599,4.346659224530802e-6,-1.0193467505461069e-8,-0.001621747326018003,4.347159211571133e-6,-1.0192193851439426e-8,-0.001621350394160166,4.425844840376646e-6,-1.0127472727933714e-8,-0.0016209651093993971,4.585398795260131e-6,-9.99724721593909e-9,-0.001620618755614523,4.816205832030953e-6,-9.809405621898151e-9,-0.0016203324293711152,5.0984795936064065e-6,-9.580037457445881e-9,-0.0016201185778446112,5.4050620808012625e-6,-9.331168050521922e-9,-0.0016199792751218015,5.7049341968223675e-6,-9.087925536625024e-9,-0.0016199055449921847,5.967355112173079e-6,-8.875191668941198e-9,-0.0016198780222882233,6.166231880713312e-6,-8.714053321567563e-9,-0.0016198689897785872,6.284171358720325e-6,-8.618507598772804e-9,-0.0016198456428020592,6.315766071306402e-6,-8.59280112903386e-9,-0.001619774385405621,6.26973000154361e-6,-8.629727496350617e-9,-0.0016196259296935819,6.169525357590731e-6,-8.710169915500509e-9,-0.0016193810015156772,6.052090182629365e-6,-8.804188184311565e-9,-0.0016190363271137104,5.963922429773775e-6,-8.87422587160706e-9,-0.0016186098081281857,5.953407381087274e-6,-8.88131796854117e-9,-0.0016181424573248472,6.058817784323751e-6,-8.794748910421731e-9,-0.0016176935536342239,6.293589642068541e-6,-8.60386918296675e-9,-0.001617326219104022,6.634329004002173e-6,-8.327694536227654e-9,-0.0016170853930605306,7.020289243504353e-6,-8.015286175478002e-9,-0.0016169778930223832,7.370415677596483e-6,-7.732028934152944e-9,-0.0016169675000937544,7.6131522800298654E-06,-7.535643904942126e-9,-0.0016169901136538418,7.713155380487486e-6,-7.454642010804234e-9,-0.0016169800837689205,7.679978347262525e-6,-7.481256003272846e-9,-0.0016168922572558102,7.556948303108508e-6,-7.580374851378752e-9,-0.0016167104555515727,7.400752728903742e-6,-7.706059646917471e-9,-0.0016164437683271215,7.26360821746386e-6,-7.816027752541982e-9,-0.0016161173530747812,7.183346466944154e-6,-7.879724076888564e-9,-0.0016157633104902577,7.180632707092512e-6,-7.880570755501255e-9,-0.0016154140207041772,7.260286490250837e-6,-7.814851788477083e-9,-0.001615098001463881,7.414069548772224e-6,-7.689396067402687e-9,-0.001614837378113596,7.623584166153096e-6,-7.519187049980965e-9,-0.0016146461104334338,7.863038966555796e-6,-7.325110558075486e-9,-0.0016145285922477045,8.102151822196889e-6,-7.13161729702838e-9,-0.0016144786655525626,8.30954750461279e-6,-6.963995681741373e-9,-0.0016144794389958994,8.456851025280304e-6,-6.8450772368244266e-9,-0.0016145044863076245,8.523247037034214e-6,-6.791555454796449e-9,-0.0016145208238440725,8.499790759989043e-6,-6.810504300559879e-9,-0.0016144936330299336,8.392510891781708e-6,-6.896885929710203e-9,-0.001614392228170857,8.223343280763281e-6,-7.032834909617165e-9,-0.0016141963521061268,8.028183732838383e-6,-7.189288356946133e-9,-0.0016139016436967962,7.851860839942969e-6,-7.330101133146092e-9,-0.0016135231106711163,7.740313336524296e-6,-7.4183830864822594e-9,-0.0016130954016894184,7.730606125699386e-6,-7.424519615650904e-9,-0.0016126685428214326,7.840105042654435e-6,-7.334806831697677e-9,-0.0016122981087462733,8.057474208610399e-6,-7.1585873366644e-9,-0.0016120303080747725,8.339676729142519e-6,-6.930579850289531e-9,-0.001611885615787256,8.619402313112867e-6,-6.704899178695777e-9,-0.0016118481928508355,8.824139607217275e-6,-6.539785116730204e-9,-0.001611868604140801,8.90107812285037e-6,-6.477642765675682e-9,-0.001611881154272387,8.835912981377337e-6,-6.529915716142489e-9,-0.0016118277460059921,8.655388821984905e-6,-6.674986610903632e-9,-0.001611675919713035,8.41338736769802e-6,-6.869352972909047e-9,-0.0016114237381993468,8.169993921702883e-6,-7.06452679210035e-9,-0.001611093177231819,7.974354515474472e-6,-7.220908293079042e-9,-0.0016107187721478148,7.856385780125358e-6,-7.3144902295771e-9,-0.0016103373933631776,7.826230747315016e-6,-7.33726541883732e-9,-0.0016099815773490676,7.877830737849756e-6,-7.294288237410739e-9,-0.0016096761674665666,7.993507370107692e-6,-7.199928950656389e-9,-0.0016094369744081014,8.147984768505116e-6,-7.074608444117655e-9,-0.0016092702451640983,8.311598200694667e-6,-6.942216930039938e-9,-0.00160917228355665,8.453152537768642e-6,-6.827830668858108e-9,-0.001609129179254943,8.543077992903146e-6,-6.755189047281374e-9,-0.0016091171262881026,8.557333011262786e-6,-6.743558851885236e-9,-0.0016091041391435737,8.481979668330493e-6,-6.804049103358642e-9,-0.0016090539129368906,8.317618601666572e-6,-6.9360391917084e-9,-0.0016089320065604345,8.082194724983374e-6,-7.1249350615802805e-9,-0.0016087135318696238,7.810443188597418e-6,-7.342654995567478e-9,-0.0016083904469439763,7.548814847622212e-6,-7.551773316743061e-9,-0.0016079759933311404,7.346151109873746e-6,-7.71307892483668e-9,-0.0016075042761180575,7.242056143792723e-6,-7.794939036152872e-9,-0.00160702430711951,7.255973870729432e-6,-7.782022387653911e-9,-0.0016065893832426634,7.380066935880531e-6,-7.680904798184895e-9,-0.0016062439692449664,7.578337494266571e-6,-7.520654677956422e-9,-0.0016060111996290365,7.793284040925081e-6,-7.347429731587253e-9,-0.001605884722251656,7.959699219668078e-6,-7.2134347447406345e-9,-0.0016058284903456366,8.02276170190471e-6,-7.162490523129645e-9,-0.001605786300256652,7.954794950983538e-6,-7.216659725347376e-9,-0.0016056989183379042,7.763856680531235e-6,-7.3693711382787e-9,-0.0016055223349501092,7.489910937153623e-6,-7.5884774454684e-9,-0.0016052394922760655,7.190282869697641e-6,-7.827929734487749e-9,-0.0016048613732839356,6.9214213509586415e-6,-8.042440056461898e-9,-0.0016044191014809085,6.724717813606781e-6,-8.19887721405118e-9,-0.0016039523942876091,6.620315668122966e-6,-8.281210552001504e-9,-0.0016034994404368291,6.608103489245576e-6,-8.289661775609236e-9,-0.00160309058100955,6.672612775449543e-6,-8.236730302719379e-9,-0.0016027456251598608,6.788717605477168e-6,-8.142605180973005e-9,-0.0016024734564696638,6.92643298585074e-6,-8.031328805630021e-9,-0.001602272562723833,7.054461000471735e-6,-7.927975303945096e-9,-0.0016021316395473646,7.1429733909865235e-6,-7.85643420942448e-9,-0.001602030096147785,7.166416618010949e-6,-7.837159326460504e-9,-0.0016019389325304322,7.106967943498292e-6,-7.884384590805072e-9,-0.001601822909317285,6.958748005321464e-6,-8.002733282683978e-9,-0.001601645025670833,6.732028706082511e-6,-8.183846196126166e-9,-0.0016013737843991493,6.455595568760507e-6,-8.404514185145453e-9,-0.0016009923060795966,6.174736476004758e-6,-8.628343547216521e-9,-0.0016005063926833,5.943025935706647e-6,-8.81240660038963e-9,-0.001599947436018963,5.80863970378304e-6,-8.918249717289788e-9,-0.0015993671346443959,5.799343297164342e-6,-8.923895711975885e-9,-0.001598824450917896,5.912206177088279e-6,-8.831981049727163e-9,-0.0015983691261643967,6.112691262219383e-6,-8.670353040535608e-9,-0.001598027750726865,6.34370842368762e-6,-8.484735141405814e-9,-0.001597796970333321,6.541210365541908e-6,-8.32624668865039e-9,-0.0015976453400901444,6.6511270032490696e-6,-8.237927113772566e-9,-0.0015975225826418882,6.642865882163979e-6,-8.244027233433758e-9,-0.0015973733172837778,6.5160674645092064e-6,-8.344671256899067e-9,-0.0015971514460371861,6.299134854850162e-6,-8.517063826659138e-9,-0.0015968312197721644,6.040236787256278e-6,-8.722695998097968e-9,-0.0015964119337554,5.793741677183589e-6,-8.918192024461737e-9,-0.0015959153524303371,5.606512708157547e-6,-9.066246268690955e-9,-0.0015953776009036073,5.508240931702783e-6,-9.143302312759663e-9,-0.0015948390145066778,5.5079279870896205e-6,-9.142302190616902e-9,-0.0015943353730508711,5.595937570596819e-6,-9.0710022424212708E-09,-0.0015938924112206762,5.749295724445448e-6,-8.947734194601513e-9,-0.0015935237022038362,5.937745603497693e-6,-8.796600268425784e-9,-0.0015932308952599915,6.128923308494835e-6,-8.643381449495809e-9,-0.0015930050349990598,6.292138592490837e-6,-8.512542405787741e-9,-0.0015928280496299403,6.401112560124816e-6,-8.425039499555748e-9,-0.001592674118163697,6.436402325511549e-6,-8.396358552439093e-9,-0.001592511242825915,6.388162226916735e-6,-8.434284847973138e-9,-0.0015923038548076277,6.259479463662382e-6,-8.536238644079333e-9,-0.0015920175360308354,6.069704190545227e-6,-8.686647143544019e-9,-0.0015916265581974022,5.855945053772369e-6,-8.855809836079169e-9,-0.0015911234432686942,5.66982094337028e-6,-9.002557749844637e-9,-0.0015905271902137126,5.566980643098267e-6,-9.082660120678599e-9,-0.0015898846649755427,5.5901058549402035e-6,-9.062364074658102e-9,-0.0015892607401442954,5.751420421663427e-6,-8.932240034166934e-9,-0.0015887185141690312,6.0241142294602755e-6,-8.713870498328418e-9,-0.0015882979764191441,6.3490168297115175e-6,-8.454426383873467e-9,-0.0015880035039804617,6.654182728757788e-6,-8.211064945180594e-9,-0.0015878052699886624,6.877775058584288e-6,-8.032786882775957e-9,-0.0015876517590710897,6.984489838970192e-6,-7.947450754328946e-9,-0.0015874863779336544,6.971221701182685e-6,-7.957325293941682e-9,-0.0015872619917445506,6.863185748489404e-6,-8.042215733171648e-9,-0.0015869502414554443,6.704200258300083e-6,-8.167230467721707e-9,-0.0015865450265327885,6.544861833301743e-6,-8.292209810873044e-9,-0.001586060881771174,6.431419708027262e-6,-8.380562643969391e-9,-0.0015855275390838218,6.397223103243651e-6,-8.4060105625722e-9,-0.001584982293378186,6.457920516330214e-6,-8.356321717507075e-9,-0.0015844620349776742,6.61081898948137e-6,-8.233749425801078e-9,-0.0015839966677754043,6.837813403661317e-6,-8.052680242552925e-9,-0.0015836049744388627,7.110512974486875e-6,-7.83558877254055e-9,-0.00158329313272495,7.39599782801762e-6,-7.60852007937778e-9,-0.0015830553572955281,7.661943418484884e-6,-7.397063210929995e-9,-0.0015828757453601038,7.88048537908479e-6,-7.223288825216026e-9,-0.0015827305073950087,8.030921094971425e-6,-7.103576255489422e-9,-0.0015825902239223386,8.10175707948008e-6,-7.046953362750228e-9,-0.0015824222470464458,8.09261347207407e-6,-7.0535751904136625e-9,-0.0015821938020142208,8.016239439311893e-6,-7.1131587433406575e-9,-0.001581876678930113,7.90023529461386e-6,-7.203688583790658e-9,-0.0015814541506088944,7.786937005316729e-6,-7.291589958387156e-9,-0.001580929437716428,7.72886735500687e-6,-7.33539011103742e-9,-0.001580332627237802,7.777305469592599e-6,-7.294769075619663e-9,-0.0015797203731629178,7.964409090283794e-6,-7.144630568893987e-9,-0.0015791630814620142,8.285391603077017e-6,-6.889058321940481e-9,-0.001578720878001717,8.692298812053108e-6,-6.566101724486824e-9,-0.001578419502984907,9.10747486170557e-6,-6.2370916464480965e-9,-0.0015782405062512823,9.452091527792786e-6,-5.9641611304561455e-9,-0.0015781312909732138,9.674079549613374e-6,-5.7882606428250385e-9,-0.001578027360075597,9.761402781761969e-6,-5.718703551331627e-9,-0.0015778737449317608,9.738155742011253e-6,-5.736256424581671e-9,-0.0015776373992268053,9.650582774239132e-6,-5.804222309092312e-9,-0.0015773098917586672,9.551555633876995e-6,-5.88077278945436e-9,-0.0015769037319662415,9.488450878456881e-6,-5.928572703455147e-9,-0.001576445875891479,9.49569390768316e-6,-5.920653078048749e-9,-0.001575970674530697,9.591327497139855e-6,-5.84304192231517e-9,-0.0015755133171369835,9.77658865659438e-6,-5.694997471322311e-9,-0.0015751042615903047,1.003778163139329e-5,-5.487458624638412e-9,-0.001574765041689377,1.0349895109118027e-5,-5.240176643150512e-9,-0.0015745057554236149,1.0681318357532525e-5,-4.978030419643896e-9,-0.001574324361526077,1.0998934195309128e-5,-4.727059345412328e-9,-0.0015742076584801335,1.1272847997949395e-5,-4.510760254880358e-9,-0.0015741334933916324,1.148015300643822e-5,-4.347106597166391e-9,-0.0015740736145208995,1.1607546540740536e-5,-4.2464524410951475e-9,-0.0015739967905234456,1.165297766004052e-5,-4.210215818202505e-9,-0.0015738721019847755,1.1626573124438477e-5,-4.230176567081147e-9,-0.0015736725816667494,1.1550994953670337e-5,-4.288272760115865e-9,-0.0015733796828682138,1.1460984868635478e-5,-4.357060355334619e-9,-0.0015729888863822469,1.1400977627530216e-5,-4.401668546947189e-9,-0.001572515654131937,1.1418948321355508e-5,-4.38465144129614e-9,-0.0015719991378984194,1.155499016771094e-5,-4.27489553861985e-9,-0.0015714991590845522,1.1825387317786e-5,-4.059992614526739e-9,-0.0015710820407434478,1.2207971645261938e-5,-3.757587705347629e-9,-0.00157079647604091,1.2639630181296142e-5,-3.4172617851035963e-9,-0.0015706506457699233,1.3034205729014649e-5,-3.106531606911105e-9,-0.0015706061696304065,1.3315507185698884e-5,-2.885049906609442e-9,-0.0015705947849098492,1.3446774868260129e-5,-2.7815199812259615e-9,-0.0015705471798354855,1.3439686701807493e-5,-2.7865797392088607e-9,-0.0015704165589056223,1.3341690442592115e-5,-2.8627232184856177e-9,-0.0015701872847721412,1.3213818456770147e-5,-2.9617956699222407e-9,-0.0015698706765883304,1.3111683729022345e-5,-3.0400379076245207e-9,-0.0015694951802119525,1.3074916344619818e-5,-3.0664473087197053e-9,-0.0015690965559719964,1.3124045477720016e-5,-3.02518922812497E-09,-0.0015687104237655423,1.3261776187223445e-5,-2.914483963298332e-9,-0.0015683672849147719,1.3476135614623932e-5,-2.744017121960997e-9,-0.001568089331561201,1.3744221248213585e-5,-2.531925583923272e-9,-0.001567888481635352,1.4036199389495978e-5,-2.301652902586154e-9,-0.0015677654444036897,1.431949385617295e-5,-2.0787019259425203e-9,-0.001567709854690696,1.4563082634763757e-5,-1.8873090716874538e-9,-0.0015677016010537767,1.474164561397543e-5,-1.7472081474154697e-9,-0.0015677133377832947,1.4839081201440235e-5,-1.6708576042155112e-9,-0.0015677139033290711,1.4850945784761677e-5,-1.6615071481920558e-9,-0.001567672273456403,1.4785614343760266e-5,-1.712298071717079e-9,-0.001567561728035762,1.4664077909571058e-5,-1.8064872373507266e-9,-0.001567363964362006,1.4518342278869283e-5,-1.9188087740274477e-9,-0.0015670730416101715,1.4388371092908044e-5,-2.017975036911366e-9,-0.001566699009351379,1.4317124795163991e-5,-2.0706086887569183e-9,-0.001566270342050259,1.434288706438812e-5,-2.0471994116831762e-9,-0.0015658331609196012,1.4488670512990482e-5,-1.9302484376469083e-9,-0.0015654445000836176,1.4750408147840926e-5,-1.72331580198987e-9,-0.0015651576376926135,1.5088818242514955e-5,-1.4572399696723894e-9,-0.0015650016611725502,1.543273520838367e-5,-1.1875289074112136e-9,-0.0015649646525930018,1.5699315031914638e-5,-9.786981777112633e-10,-0.0015649932080395524,1.5825615668091956e-5,-8.797288461446118e-10,-0.0015650127561441629,1.5794360168681763e-5,-9.039460652179229e-10,-0.0015649578766231919,1.5637909598140213e-5,-1.0258340424130335e-9,-0.0015647946888691952,1.5419919015121727e-5,-1.1953572908828253e-9,-0.001564525408102832,1.5208671664966406e-5,-1.3589165068917122e-9,-0.0015641786040441487,1.5056893076463547e-5,-1.4752664574075088e-9,-0.00156379486909857,1.4993534545273575e-5,-1.521981552315444e-9,-0.0015634150399108117,1.5024788854757072e-5,-1.4945831313107964e-9,-0.0015630731490801214,1.5139317110787819e-5,-1.4023153307767539e-9,-0.0015627932503844573,1.5314097884522007e-5,-1.2634546568637839e-9,-0.0015625884467632353,1.5519419283943223e-5,-1.1013546330723007e-9,-0.001562460875346721,1.5722949233932406e-5,-9.412785609553453e-10,-0.0015624021479970563,1.5893311969822037e-5,-8.076525173200512e-10,-0.0015623942663999986,1.600355815982286e-5,-7.213957276926135e-10,-0.0015624113087739449,1.603464562664121e-5,-6.972120092446669e-10,-0.0015624222244725121,1.5978599480086515e-5,-7.411073308205331e-10,-0.0015623947894483653,1.5840685366149302e-5,-8.486840929629714e-10,-0.0015623003825704094,1.563995164582476e-5,-1.0047498832725248e-9,-0.00156211896716867,1.5407677934949402e-5,-1.1846143530044873e-9,-0.0015618434715127026,1.5183522199556461e-5,-1.3572122413585078e-9,-0.001561482731818114,1.5009579708722523e-5,-1.4898312300154014e-9,-0.0015610623229379093,1.492287455651844e-5,-1.553978673492256e-9,-0.0015606225925568506,1.4946887881331915e-5,-1.5318866836714567e-9,-0.001560212971251659,1.5083203136375069e-5,-1.422837639342225e-9,-0.0015598818401117295,1.530556706953706e-5,-1.2475983890907835e-9,-0.0015596626235708532,1.5560011265301256e-5,-1.0482226412439358e-9,-0.001559559627593272,1.577486934926789e-5,-8.802955933378288e-10,-0.0015595405570984476,1.5881538273988095e-5,-7.9692043926817e-10,-0.0015595430360532403,1.5839771966023374e-5,-8.291538101517867e-10,-0.0015594959955338393,1.5654660779172335e-5,-9.72801001056983e-10,-0.0015593463001946208,1.5374391353418983e-5,-1.190114515735307e-9,-0.0015590762116928854,1.5069709060576866e-5,-1.4258030022227316e-9,-0.001558703847788798,1.4807611900845037e-5,-1.6276153266680996e-9,-0.0015582703547364113,1.4632787290015397e-5,-1.7608768873779355e-9,-0.00155782354477752,1.4561962806159921e-5,-1.812864234105201e-9,-0.0015574055106049006,1.4587994709651823e-5,-1.7895075593158592e-9,-0.0015570463687551211,1.4687835068240819e-5,-1.7090593224017948e-9,-0.0015567627265973315,1.4830172836249719e-5,-1.5960694700656643e-9,-0.0015565585721585488,1.4981143223910987e-5,-1.4769346528028385e-9,-0.0015564268779924705,1.5108248878273527e-5,-1.3768878228299211e-9,-0.001556351184307716,1.5183283689987646e-5,-1.3177718726983572e-9,-0.0015563071846080817,1.518499355836712e-5,-1.3159931882651027e-9,-0.001556264759061091,1.5101840586844419e-5,-1.3803631127402186e-9,-0.0015561910289953722,1.493467497760959e-5,-1.5099983155967233e-9,-0.001556054769142461,1.4698525876528096e-5,-1.692928407678446e-9,-0.0015558319325716652,1.4422419435365395e-5,-1.9062865699394374e-9,-0.00155551134062967,1.4146276673803998e-5,-2.118820791349384e-9,-0.0015550990200105716,1.3914554215767493e-5,-2.2959501362179986e-9,-0.0015546195256492723,1.376733680242155e-5,-2.406755127218841e-9,-0.001554113115567492,1.3730683214261952e-5,-2.4314473667369036e-9,-0.001553628664032215,1.3808584379673326e-5,-2.367474165297039e-9,-0.0015532132442453931,1.3978822784027847e-5,-2.232532482775318e-9,-0.0015529002123789554,1.4194626461009348e-5,-2.063117347756414e-9,-0.0015526985302697924,1.439325938164884e-5,-1.907804521574992e-9,-0.0015525869004329388,1.4511149461068737e-5,-1.8155962076796212e-9,-0.0015525163561113226,1.4502518791870292e-5,-1.821618126894051e-9,-0.0015524229966605255,1.4355340596169604e-5,-1.934861536785402e-9,-0.0015522480046320417,1.4097085782131253e-5,-2.1337720574238567e-9,-0.0015519570630758844,1.3785964147240603e-5,-2.373056019133126e-9,-0.0015515502090884452,1.3490805690072358e-5,-2.5993134735632945e-9,-0.0015510581583219735,1.3269136012428824e-5,-2.7680732374480753e-9,-0.0015505287216183647,1.3153018247135854e-5,-2.8547493909096727e-9,-0.0015500111337097319,1.3146302784594268e-5,-2.8566824400189927e-9,-0.0015495446374244918,1.3230505435768768e-5,-2.788469542937826e-9,-0.001549153320614908,1.3373991814169866e-5,-2.6747740927702085e-9,-0.0015488458317407083,1.3540368315253085e-5,-2.543818936185515e-9,-0.0015486175736199625,1.3694424215569561e-5,-2.422826603784886e-9,-0.0015484534953238353,1.3805782453544893e-5,-2.335244042665086e-9,-0.0015483305799586244,1.3851194736815257e-5,-2.2989915178837034e-9,-0.0015482199989999771,1.3816427644258473e-5,-2.3249912029369815e-9,-0.001548089463216438,1.369826171317471e-5,-2.41558809311908e-9,-0.0015479064843226234,1.3506495043573231e-5,-2.5629790637511724e-9,-0.0015476430650823826,1.3265142070830212e-5,-2.748308110889761e-9,-0.0015472817047777522,1.3011433188873347e-5,-2.9425170054115522e-9,-0.0015468215378123499,1.2791153939947237e-5,-3.1100615838046316e-9,-0.0015462823008519895,1.264978126784404e-5,-3.2158634430605283e-9,-0.0015457034820694632,1.2620793299373853e-5,-3.23437207800151e-9,-0.0015451371557708795,1.271461979911524e-5,-3.1580199349164043e-9,-0.0015446354809309358,1.2912598720449401e-5,-3.001718234269623e-9,-0.0015442364302565255,1.3169086681883902e-5,-2.801040276875315e-9,-0.0015439524938185769,1.342193894043896e-5,-2.604019123633512e-9,-0.0015437662068975597,1.3608488064402962e-5,-2.4588197532468753e-9,-0.0015436340713854192,1.3682357584886e-5,-2.4008622169249547e-9,-0.001543497962354699,1.3626252232787606e-5,-2.4430807619033354e-9,-0.00154330101649021,1.3456844397511336e-5,-2.572263294225788e-9,-0.0015430034083978895,1.3219882326718478e-5,-2.7529027871083723e-9,-0.0015425929181858147,1.2976711436722279e-5,-2.937645646025132e-9,-0.0015420866882192013,1.278670592403656e-5,-3.080856310691857e-9,-0.00154152398796979,1.2691851204048305e-5,-3.1504613502583297e-9,-0.001540953480044075,1.2708519035282108e-5,-3.1341863973903237e-9,-0.0015404202334010281,1.2827867903263539e-5,-3.039126457904035e-9,-0.0015399566733843208,1.302256759212801e-5,-2.886485245993735e-9,-0.0015395788942260255,1.325586308652444e-5,-2.7045866919813093e-9,-0.0015392872954454852,1.3489692472678766e-5,-2.5226746116671805e-9,-0.0015390695180788213,1.3690362719305401e-5,-2.3666060094382767e-9,-0.0015389039426561332,1.3831829101966165e-5,-2.2563601055744896e-9,-0.0015387628159656927,1.3897428531583792e-5,-2.20469239650718e-9,-0.0015386148936828994,1.388103058929039e-5,-2.2162086122068876e-9,-0.0015384280799308537,1.3788188762037226e-5,-2.28644706084773e-9,-0.0015381727896268602,1.3637252599749298e-5,-2.4010335015984904e-9,-0.00153782662638598,1.3459685165893791e-5,-2.5355047694054314e-9,-0.0015373803606947806,1.3298103454663454e-5,-2.6569224773298658e-9,-0.0015368439449366434,1.3200271754010526e-5,-2.7285944715443808e-9,-0.0015362497069414172,1.3208268582747388e-5,-2.7184455758695063e-9,-0.0015356491281297727,1.3344727868614513e-5,-2.609535624585385e-9,-0.0015351012857119798,1.3601376685119754e-5,-2.4087144532296773e-9,-0.001534655333305587,1.3936432395579682e-5,-2.1484399499017215e-9,-0.0015343338675460306,1.4284442308400234e-5,-1.8790986065537597e-9,-0.001534124900712501,1.4575769360907748e-5,-1.6540268609434805e-9,-0.001533986063403117,1.4757650849527079e-5,-1.5134089313619608e-9,-0.0015338585577077514,1.4808523097929115e-5,-1.4733758294952858e-9,-0.001533684646016743,1.4741520547899112e-5,-1.5234227094639102e-9,-0.001533422629589494,1.4597945041350879e-5,-1.6315309243635806e-9,-0.0015330556633583313,1.4434363097761433e-5,-1.7541719141681908e-9,-0.0015325932941699795,1.43077142414427e-5,-1.8477863331828831e-9,-0.0015320665277323265,1.426230754346835e-5,-1.878725396982042e-9,-0.0015315185461519663,1.4321473573738102e-5,-1.8295328556822685e-9,-0.001530993934766879,1.4485180350014558e-5,-1.7006180859558923e-9,-0.001530529287402824,1.4733246178698408e-5,-1.5076755247691595e-9,-0.0015301472235543963,1.5032273750256648e-5,-1.2763383865137975e-9,-0.001529854434526647,1.5343751423442615e-5,-1.0360201232972493e-9,-0.0015296430494533845,1.5631173065596047e-5,-8.145421075795626e-10,-0.0015294939224596445,1.5865044960165455e-5,-6.343581941131169e-10,-0.0015293804665335667,1.6025681201232713e-5,-5.104211518947967e-10,-0.0015292721800424954,1.6104406698012555e-5,-4.492264661427397e-10,-0.0015291376898846022,1.610398838942385e-5,-4.484456737093128e-10,-0.0015289476443276155,1.6038826092304203e-5,-4.967851368558057e-10,-0.0015286780300962212,1.5934920116292352e-5,-5.7407767303816e-10,-0.0015283144581671828,1.5828995706173513e-5,-6.520649957069123e-10,-0.001527857433495814,1.5765420962771622e-5,-6.968641554284709e-10,-0.0015273273599870595,1.578919190086431e-5,-6.74377333345776e-10,-0.001526766307082904,1.5934197950098757e-5,-5.592021348606761e-10,-0.0015262325434225242,1.6208917896855537e-5,-3.454009983392546e-10,-0.0015257856016340661,1.6585900155219326e-5,-5.434009904032178e-11,-0.001525465322369261,1.7003376453317625e-5,2.6667254099619e-10,-0.0015252747715500247,1.738282006332563e-5,5.577945753003107e-10,-0.0015251774516648478,1.765614484759572e-5,7.673293029466002e-10,-0.0015251111941016761,1.778888314628154e-5,8.693422948032573e-10,-0.0015250108675460873,1.7788373699605145e-5,8.698678813149482e-10,-0.0015248284104435656,1.769597096092772e-5,8.008933904221264e-10,-0.001524543138352943,1.7570342537972436e-5,7.074837082249667e-10,-0.001524161958697962,1.747014596631279e-5,6.344307222398109e-10,-0.00152371290844506,1.7441141511317046e-5,6.163780060845438e-10,-0.001523235851785127,1.7509215448337496e-5,6.72585413499027e-10,-0.0015227730669315363,1.7678694633934106e-5,8.058200670495614e-10,-0.0015223612736943114,1.7934688640477055e-5,1.0043203383510617e-9,-0.0015220259505717274,1.82482101335355e-5,1.2458005545171251e-9,-0.0015217783771147274,1.858278154644696e-5,1.502482588468059e-9,-0.0015216153779278,1.8901176203271382e-5,1.7461563926156706e-9,-0.001521521286606779,1.9171184850908933e-5,1.9524855806838318e-9,-0.0015214713531420381,1.936973086375099e-5,2.1040967574472464e-9,-0.0015214357043695024,1.9485117407839795e-5,2.1923000740043392e-9,-0.001521383137404215,1.9517692447771478e-5,2.217627952739704e-9,-0.0015212844821984616,1.9479511468266107e-5,2.1895835175049778e-9,-0.0015211156742934025,1.939342867657197e-5,2.1258913140746853e-9,-0.0015208608563400331,1.9291673965034527e-5,2.0512979780619082e-9,-0.001520515854495682,1.9213505125941906e-5,1.995657851135691e-9,-0.0015200919884612346,1.9200901897949216e-5,1.9905876211772794e-9,-0.0015196190517206686,1.9290978781291798e-5,2.0637415938522103e-9,-0.001519144803733725,1.9504713196396947e-5,2.2304122471037216e-9,-0.001518727462232059,1.9834280591372538e-5,2.484141135478913e-9,-0.0015184192950395239,2.0235367514319987e-5,2.7910634415758664e-9,-0.0015182452262433325,2.0633099952696904e-5,3.0944338572009063e-9,-0.0015181877354138221,2.094520859440517e-5,3.3320858875781925e-9,-0.0015181899043198905,2.1113683302729238e-5,3.4603240998125803e-9,-0.0015181776587180065,2.1127106051478163e-5,3.4708520228233463e-9,-0.0015180885131474918,2.1021030404410242e-5,3.391091106264991e-9,-0.0015178909438639508,2.0859213783789e-5,3.2698730446144373e-9,-0.0015175877233646422,2.0709171992738493e-5,3.1587082248994756e-9,-0.0015172073558787026,2.0623842481949752e-5,3.0977101310951086e-9,-0.0015167914191089214,2.063317965218757e-5,3.1092048210673748e-9,-0.0015163832619076432,2.0743705953134367e-5,3.1975368071754336e-9,-0.0015160200669873704,2.0942485608743105e-5,3.3523023756736195e-9,-0.0015157281682930876,2.1202788343014117e-5,3.5528268410564887e-9,-0.0015155208240000008,2.1490072546112796e-5,3.7727761422749006e-9,-0.0015153978329193042,2.1767775800983042e-5,3.984512020996164e-9,-0.0015153466823297202,2.2002561279956053e-5,4.162975427671088e-9,-0.0015153449752000046,2.2168662578104594e-5,4.2888951154383054e-9,-0.0015153638372301824,2.225102728825126e-5,4.351136659371982e-9,-0.001515371889179471,2.2246993016359994e-5,4.3479874066622305e-9,-0.0015153392563930425,2.216641597337143e-5,4.287271959233951e-9,-0.001515241213541778,2.2030490914074532e-5,4.1854284582402095e-9,-0.0015150613338686283,2.1869574703626888e-5,4.065761994294679e-9,-0.0015147941551076818,2.1720147110229897e-5,3.956004055400928e-9,-0.0015144474064621842,2.1620798118500058e-5,3.885163322724043e-9,-0.0015140436280418352,2.160676344805545e-5,3.879380610579873e-9,-0.0015136202312386242,2.1702388771875214e-5,3.956357484574458e-9,-0.001513226034844196,2.191177437422689e-5,4.1185205826258535e-9,-0.0015129120080209172,2.221001677650227e-5,4.346649078495528e-9,-0.001512715541928629,2.254041791686142e-5,4.597890678761155e-9,-0.001512642323751254,2.282451516198137e-5,4.8132638236435735e-9,-0.001512656112032841,2.2987226657755368e-5,4.936448725917021e-9,-0.0015126871339836351,2.2987814401065566e-5,4.937036368579893e-9,-0.0015126589666124984,2.283832816494508e-5,4.824488181507253e-9,-0.0015125191642603442,2.2596939508072832e-5,4.643164810446097e-9,-0.001512255771697461,2.234135481963672e-5,4.452159952580022e-9,-0.0015118937115124553,2.2139907404171068e-5,4.303255975411923e-9,-0.00151147883232571,2.203443093930126e-5,4.227845582902372e-9,-0.001511060993239207,2.2037202305538674e-5,4.234671953457867e-9,-0.0015106824975225093,2.213657085421608e-5,4.314282868663287e-9,-0.0015103725536317254,2.2305348342064856e-5,4.4455958177446396e-9,-0.001510145935250769,2.2508543748264166e-5,4.601885979825811e-9,-0.0015100037941396729,2.27093975733727e-5,4.75536669510632e-9,-0.0015099353530227085,2.2873996336669858e-5,4.880600371514767e-9,-0.0015099200916151164,2.2974973370313923e-5,4.957188134048892e-9,-0.0015099304637137257,2.2994496007904244e-5,4.971952359005194e-9,-0.0015099352286913673,2.2926461766264454e-5,4.920579998432417e-9,-0.0015099033645110472,2.277759522000927e-5,4.808472749402745e-9,-0.0015098082535331882,2.256704567886276e-5,4.650450638927179e-9,-0.0015096316019525189,2.2324318804894625e-5,4.469136915658275e-9,-0.0015093665766133704,2.208567924099814e-5,4.2921241199986e-9,-0.0015090197629728298,2.1889299652124044e-5,4.148176635499323e-9,-0.0015086116448405531,2.1769507934527783e-5,4.062815296740895e-9,-0.0015081753500045245,2.1750466832938717e-5,4.05360291565382e-9,-0.0015077531763032308,2.183960388547096e-5,4.125383508132904e-9,-0.0015073900399322092,2.202167990402843e-5,4.2660809956394935e-9,-0.0015071232263286609,2.225573764208077e-5,4.44462415416496e-9,-0.0015069693776782423,2.2478572667533146e-5,4.6136193435732875e-9,-0.0015069127900212765,2.261830809440704e-5,4.719430802140069e-9,-0.0015069025568193628,2.2617773461514468e-5,4.719545121206075e-9,-0.0015068654430890603,2.2459193836491986e-5,4.601005606662283e-9,-0.001506732732291867,2.2175454413684737e-5,4.388897633440769e-9,-0.0015064676102254564,2.1838262916960467e-5,4.1374773793336535e-9,-0.0015060770908259737,2.152899176668202e-5,3.9081543995164606e-9,-0.0015056034531821725,2.130964096087466e-5,3.747499605308365e-9,-0.0015051039831142801,2.120817745888039e-5,3.67616765940978e-9,-0.0015046318558587788,2.121994692951462e-5,3.6900798243215312e-9,-0.0015042251268647423,2.1317953608248667e-5,3.768369282876351e-9,-0.0015039036630436163,2.1464388035088392e-5,3.88222893943776e-9,-0.0015036707819547192,2.1619516091843104e-5,4.001665844105285e-9,-0.0015035165886605325,2.1747302655433718e-5,4.099689013291884e-9,-0.00150342132600212,2.1818716266063703e-5,4.154695925069204e-9,-0.001503358325448771,2.1813879500024203e-5,4.1519986156729824e-9,-0.0015032968462424501,2.1723736492507323e-5,4.08503905892022e-9,-0.0015032052341075262,2.155133538091197e-5,3.956368101994074e-9,-0.0015030546872407823,2.1312355770057032e-5,3.778071180337243e-9,-0.0015028235326783174,2.103420332333634e-5,3.5710789610787957e-9,-0.0015025013887804367,2.075307806093682e-5,3.362886440108658e-9,-0.0015020922453497882,2.0508886287330707e-5,3.183598559287639e-9,-0.0015016154742786625,2.0338452391119222e-5,3.0607104114683997e-9,-0.0015011040515861569,2.0268076034948164e-5,3.0134867470089806e-9,-0.001500599804274013,2.030688168146457e-5,3.04807733049152e-9,-0.0015001460726057133,2.044239395900025e-5,3.154424023362247e-9,-0.00149977856352969,2.0639604039527855e-5,3.305819021705255e-9,-0.0014995156172464786,2.0844817059723325e-5,3.461959279396227e-9,-0.0014993500137638414,2.0995399978085027e-5,3.576249789876038e-9,-0.0014992456432738306,2.1035335583678028e-5,3.60729449457631e-9,-0.0014991428844553212,2.0933644184201608e-5,3.532476786791916e-9,-0.0014989745730104767,2.0698804268457708e-5,3.3586078624101303e-9,-0.0014986888360896111,2.0380406021878866e-5,3.1231135922833585e-9,-0.0014982686733544998,2.0053717417477414e-5,2.88245886837212e-9,-0.001497737525690711,1.979300837962255e-5,2.692135997911263e-9,-0.001497148017881539,1.9647196210900128e-5,2.588415637713842e-9,-0.0014965613991866607,1.9629093705834248e-5,2.5803785904338805e-9,-0.0014960289411646245,1.971968706434261e-5,2.653283174951249e-9,-0.0014955820412908304,1.9880736800477454e-5,2.778157555940626e-9,-0.0014952309905867504,2.006787897714019e-5,2.9216817011335566e-9,-0.0014949687552116315,2.0239968863611068e-5,3.053154202397362e-9,-0.001494776174475137,2.0364131096063462e-5,3.1481831138080597e-9,-0.0014946265704327824,2.0417849223123522e-5,3.1901577490234746e-9,-0.0014944892845262566,2.038968095963877e-5,3.170735822070018e-9,-0.001494332545660484,2.0279629489477603e-5,3.090127645122555e-9,-0.0014941263545837618,2.009946410020862e-5,2.957370145196969e-9,-0.0014938459444002585,1.9872625600314708e-5,2.7902699955053625e-9,-0.0014934759328347927,1.9632856641228426e-5,2.614335134584265e-9,-0.0014930145655336932,1.9420569813598002e-5,2.4599538294097267e-9,-0.001492476702076429,1.9276431553751654e-5,2.3574741074222654e-9,-0.001491893815555032,1.923270705234934e-5,2.3306640563010123e-9,-0.0014913096645020614,1.930428755097455e-5,2.3900526656468323e-9,-0.0014907716135890666,1.9482318555866433e-5,2.5283426168944e-9,-0.0014903193643921373,1.973316438958572e-5,2.7198781518158167e-9,-0.0014899741448074898,2.0003956799043533e-5,2.9249937542774248e-9,-0.0014897315523588778,2.023395845028581e-5,3.098573729705269e-9,-0.0014895604078392077,2.036929696434408e-5,3.200967785115278e-9,-0.0014894086578894246,2.0377579597678796e-5,3.2087039570247428e-9,-0.0014892158047863976,2.0258385868426954e-5,3.122098731804692e-9,-0.001488929416536435,2.00457625312811e-5,2.9669485121319134e-9,-0.0014885210657221955,1.9800292408669174e-5,2.7885218058526498e-9,-0.0014879957071757151,1.9591794282292342e-5,2.6386436925550972e-9,-0.0014873899746012964,1.9478359809753334e-5,2.5601312681883347e-9,-0.0014867596618360918,1.949011570768919e-5,2.5748323704033555e-9,-0.0014861620498762876,1.96239922223134e-5,2.6799132147527057e-9,-0.0014856407320978139,1.9849868774778618e-5,2.8525944425785092e-9,-0.0014852179082245765,2.0123138972227992e-5,3.0595746869390322e-9,-0.001484894404555705,2.0397436089605455e-5,3.266468246613373e-9,-0.0014846544662120268,2.063358248057847e-5,3.444366312054756e-9,-0.0014844719149976677,2.080401172999627e-5,3.573026893968126e-9,-0.0014843155256631664,2.089389600951698e-5,3.6416569247405195e-9,-0.0014841529717873015,2.0900677734307805e-5,3.6485643076621275e-9,-0.0014839536957402732,2.083324538196875e-5,3.6005774495059056e-9,-0.0014836914694317035,2.0711220588510544e-5,3.5125354304605184e-9,-0.0014833473561297718,2.0564086382282243e-5,3.406608295349423e-9,-0.0014829133688975399,2.0429297886048457e-5,3.3108019367196984e-9,-0.0014823963710327067,2.0348185310062236e-5,3.2557973035666802E-09,-0.0014818207428450856,2.0358734524199104e-5,3.269510016130022e-9,-0.0014812274772494347,2.048563738802864e-5,3.369725367338494e-9,-0.0014806675693328044,2.0730221397913308e-5,3.556767697544755e-9,-0.0014801896123771137,2.106481501301274e-5,3.809538836492915e-9,-0.0014798249253679303,2.143590416769047e-5,4.088059593597637e-9,-0.0014795761455542354,2.177709692752412e-5,4.3431788306475135e-9,-0.0014794146511569793,2.202796158292254e-5,4.530508461441201e-9,-0.0014792883061481331,2.21516328538685e-5,4.623353141774396e-9,-0.0014791364524373138,2.2144870224967428e-5,4.620002061129199e-9,-0.001478906684187595,2.203791530288745e-5,4.543444647931511e-9,-0.0014785683235115793,2.1885258092804413e-5,4.434360357647662e-9,-0.0014781193401062422,2.1750689691606835e-5,4.339933827235743e-9,-0.0014775854795386373,2.169092982823376e-5,4.3017291032046366e-9,-0.001477012299802205,2.1742145708306606e-5,4.345842348530162e-9,-0.0014764526498468376,2.191281179061359e-5,4.477843345187745e-9,-0.0014759534363243591,2.2184454181331846e-5,4.683549499194312e-9,-0.0014755455960484022,2.2519217855883682e-5,4.93475027814799e-9,-0.0014752396898019221,2.2870962823821085e-5,5.1974073013490225e-9,-0.0014750271342094889,2.3195958122338928e-5,5.439457561441334e-9,-0.0014748851544931095,2.3460421517391652e-5,5.636259530417908e-9,-0.0014747829673421675,2.3644120169039524e-5,5.773169265596725e-9,-0.001474687320693333,2.374080291527646e-5,5.845840169919798e-9,-0.0014745666070528286,2.3756880234768512e-5,5.859274017653767e-9,-0.0014743937130802754,2.370958754850038e-5,5.826487086509059e-9,-0.0014741482569230124,2.3625217663658505e-5,5.767179828898929e-9,-0.001473818894785108,2.353730629244631e-5,5.7063097259063755e-9,-0.0014734060778071696,2.3484074946004946e-5,5.672082995091509e-9,-0.001472924981874492,2.3504008874457454e-5,5.692603170476783e-9,-0.0014724072644037177,2.3628534088270373e-5,5.790480507708103e-9,-0.0014718991918354172,2.387197597384268e-5,5.975569281186334e-9,-0.0014714535304005726,2.422153315886059e-5,6.2378093646216116e-9,-0.0014711147480171334,2.463284924493281e-5,6.5441791770475725e-9,-0.0014709018005976526,2.5037149761910478e-5,6.844044438239558e-9,-0.0014707971735682401,2.5361087416693702e-5,7.08371765685339e-9,-0.0014707499231823534,2.5551998946229314e-5,7.224937628064112e-9,-0.0014706928556039132,2.559617122586235e-5,7.2582251778159335e-9,-0.0014705654035565266,2.5521412187611647e-5,7.204692681405604e-9,-0.0014703314954858874,2.5384704814681434e-5,7.106814374546921e-9,-0.001469986538679709,2.5252782134341083e-5,7.013936096625625e-9,-0.0014695540981764408,2.5183955143550453e-5,6.968766442288963e-9,-0.0014690762900327096,2.5215950258180403e-5,6.998456432120111e-9,-0.0014686020708823385,2.5360870206104967e-5,7.1110940673169154e-9,-0.001468176386598783,2.5606318665205407e-5,7.296811789583651e-9,-0.001467831922902369,2.592100301791191e-5,7.532134484148677e-9,-0.0014675843884544473,2.6263002803544234e-5,7.786145194716698e-9,-0.0014674316308986469,2.6588795756606222e-5,8.027060457500164e-9,-0.0014673561469447757,2.6861167542429433e-5,8.22790296065784e-9,-0.001467329858105644,2.7054651629686617e-5,8.370365121482301e-9,-0.0014673197245071011,2.7158013293985568e-5,8.446566196624374e-9,-0.0014672929285562525,2.717410966689769e-5,8.458950180331899e-9,-0.0014672208834997042,2.7118011201820044e-5,8.4189307986924e-9,-0.0014670820001531884,2.7014370775278294e-5,8.34495143072538e-9,-0.0014668636033767842,2.6894642929169563e-5,8.260369284515231e-9,-0.0014665634811135814,2.6794222102966245e-5,8.19123024785904e-9,-0.0014661914098972825,2.674909228562432e-5,8.163696466874626e-9,-0.001465770520724381,2.679114846664634e-5,8.200590836488431e-9,-0.001465337400999473,2.6941364730020337e-5,8.316505230393117e-9,-0.0014649388274165344,2.720105595585084e-5,8.511638713086152e-9,-0.0014646228477321868,2.7543744071366404e-5,8.766111014759959e-9,-0.0014644237187200332,2.791300341092992e-5,9.03854416039646e-9,-0.001464344966501293,2.8232690622237343e-5,9.273507511061049e-9,-0.00146435037296069,2.8431059296295023e-5,9.418980704214775e-9,-0.0014643722903750673,2.8469546292426055e-5,9.447272055057291e-9,-0.0014643365365555757,2.835968319109381e-5,9.367378735882624e-9,-0.0014641906956874835,2.8157374663821298e-5,9.220801767421116e-9,-0.0014639203699168175,2.793907130398366e-5,9.063972153156974e-9,-0.001463547743641747,2.777469392086682e-5,8.94819704622287e-9,-0.0014631181589848093,2.770971394278009e-5,8.906400483072525e-9,-0.0014626840013922983,2.7759615661242276e-5,8.949152904876544e-9,-0.0014622919778576426,2.7913376841285792e-5,9.067487925009645e-9,-0.0014619755187329977,2.8141209895819113e-5,9.238874894232356e-9,-0.0014617515941158011,2.840319839203045e-5,9.43374255358404e-9,-0.0014616206414562979,2.8657228590944903e-5,9.621316724398479e-9,-0.0014615686117483452,2.88656511750599e-5,9.77438646312151e-9,-0.0014615705063021332,2.9000359578134314e-5,9.872855466969257e-9,-0.0014615948598680729,2.9046009835060456e-5,9.905967029354836e-9,-0.001461608579480747,2.900124632155569e-5,9.873148682283592e-9,-0.0014615815016667387,2.8877991973552452e-5,9.783504838835818e-9,-0.001461490094774729,2.86991569091944e-5,9.65415693656674e-9,-0.0014613200429391873,2.8495379357004293e-5,9.507823393054517e-9,-0.0014610677949529376,2.8301325099769305e-5,9.370010304543687e-9,-0.0014607412749224225,2.8151769243240655e-5,9.266016170060544e-9,-0.001460359934266054,2.807741831222614e-5,9.217802419101563e-9,-0.001459954104262802,2.810012125881796e-5,9.240548810429125e-9,-0.0014595629027557774,2.8227079611997363e-5,9.338632920695437e-9,-0.001459229207373408,2.8444570378339046e-5,9.501348366973721e-9,-0.0014589903312328463,2.8713478214577256e-5,9.699906185659169e-9,-0.0014588646330113623,2.8970928160528702e-5,9.888704607981145e-9,-0.0014588380390138703,2.9143000527045176e-5,1.0014441084658272e-8,-0.0014588592510678298,2.916941323267889e-5,1.0033827086917958e-8,-0.0014588523821274818,2.9030953044343186e-5,9.933409035109415e-9,-0.0014587456644553276,2.8762477106263568e-5,9.739062259576716e-9,-0.001458501091057045,2.844024437257861e-5,9.506799999855063e-9,-0.001458127143420008,2.8150315430128008e-5,9.299622484807696e-9,-0.001457669435461303,2.7957472722960843e-5,9.164649386359438e-9,-0.0014571891196582215,2.788982620398424e-5,9.12181556433836e-9,-0.001456742655817562,2.7940470402478702e-5,9.1652351867303225E-09,-0.0014563700347164715,2.807848674258035e-5,9.271524962474886e-9,-0.0014560912588836175,2.826144010513699e-5,9.409190716108027e-9,-0.0014559078903742333,2.8445360201978687e-5,9.546033498517481e-9,-0.0014558067229891146,2.859145029300421e-5,9.65399985693406e-9,-0.0014557639343839687,2.867025540336573e-5,9.712068997365372e-9,-0.0014557492065120391,2.8664138594720785e-5,9.707890097359682e-9,-0.0014557298001960863,2.8568493551007577e-5,9.638560286519974e-9,-0.0014556745936851589,2.839177608483774e-5,9.510625422205857e-9,-0.0014555579370875656,2.815423714782051e-5,9.339183329667601e-9,-0.0014553629537277198,2.788526924195518e-5,9.14595894628804e-9,-0.0014550838573302906,2.7619586166606147e-5,8.95646433151999e-9,-0.0014547270310782067,2.7392671032165182e-5,8.796565507284847e-9,-0.0014543107698863327,2.7235881381529104e-5,8.688803061502544e-9,-0.0014538636547068316,2.7171559156514596e-5,8.648806078255112e-9,-0.0014534215710303232,2.7208440099601352e-5,8.68207399305285e-9,-0.001453023162629078,2.7337595874378007e-5,8.781285876904159e-9,-0.0014527031545351094,2.7529636906441165e-5,8.924571639210088e-9,-0.0014524833008458392,2.7735059993107925e-5,9.075970709988018e-9,-0.0014523621957538728,2.7890571544417234e-5,9.190018425776328e-9,-0.0014523077282724134,2.793379091660291e-5,9.22219677030714e-9,-0.0014522585937687897,2.7825223830983982e-5,9.144582317840528e-9,-0.0014521403795198652,2.7569149189017554e-5,8.960821255109384e-9,-0.001451893505617349,2.7219493141957345e-5,8.71038541518176e-9,-0.0014514989868257015,2.6862149989671336e-5,8.455773632611902e-9,-0.0014509858377754307,2.6581283086955036e-5,8.257991564297597e-9,-0.0014504161415827162,2.642918854125528e-5,8.154588223766253e-9,-0.0014498591074915373,2.6414918608475404e-5,8.151437565096828e-9,-0.0014493694267968629,2.6511849721997745e-5,8.228438049517682e-9,-0.001448977429522189,2.667403387196817e-5,8.351639483937653e-9,-0.0014486894408670674,2.6851542282472955e-5,8.484552463610772e-9,-0.0014484932417684118,2.700055872143433e-5,8.595494996252945e-9,-0.0014483645278005612,2.7088384874182358e-5,8.661115546099852e-9,-0.0014482724252906584,2.709519725146361e-5,8.667505390416874e-9,-0.0014481837922433506,2.7014246607076915e-5,8.610209915657879e-9,-0.0014480667630384213,2.6851367625677863e-5,8.493819386236972e-9,-0.0014478939985973695,2.6623968239600285e-5,8.331252341426477e-9,-0.0014476458307236476,2.635924813759418e-5,8.142498231074953e-9,-0.00144731311061095,2.6091231865376743e-5,7.952456649511876e-9,-0.0014468992107673786,2.5856444834127285e-5,7.787722099695875e-9,-0.0014464205463444633,2.5688537660867144e-5,7.672567457310853e-9,-0.0014459051593164764,2.5612502082256553e-5,7.624669465502379e-9,-0.0014453891705153014,2.5639343311066898e-5,7.651283894303304e-9,-0.0014449112632642608,2.5762226244715e-5,7.746636370364774e-9,-0.0014445057152640856,2.595501245227754e-5,7.891145026699935e-9,-0.0014441946694093064,2.6173960497131583e-5,8.052917461887092e-9,-0.0014439806475695987,2.636349963132186e-5,8.192048807278225e-9,-0.0014438411873451745,2.646690890427581e-5,8.268250609640819e-9,-0.0014437286296687954,2.6441511003512633e-5,8.251567637578792e-9,-0.001443578444853297,2.6275165731848128e-5,8.1339948899965e-9,-0.0014433273202660133,2.5997083928831833e-5,7.937096006765073e-9,-0.001442936409115405,2.567444219779277e-5,7.709508223593939e-9,-0.0014424086701659907,2.5391506100637698e-5,7.511889392046065e-9,-0.0014417892862947695,2.5219227646515815e-5,7.3950023164529674e-9,-0.001441147821285167,2.5191187270965408e-5,7.382424698161206e-9,-0.0014405525671188652,2.5297654232244746e-5,7.46642211059057e-9,-0.0014400506984845914,2.549697136888099e-5,7.616367322101587e-9,-0.0014396609875323325,2.573422047511667e-5,7.792362299919142e-9,-0.0014393770763216152,2.595731091946943e-5,7.956884889193762e-9,-0.0014391755390315833,2.6126299063856226e-5,8.081435414644157e-9,-0.0014390240648945822,2.621661961154909e-5,8.14872862017226e-9,-0.0014388876944924675,2.6218749094750767e-5,8.152319004850451e-9,-0.0014387330155882449,2.6136521805769236e-5,8.095315097039274e-9,-0.0014385310964584244,2.5985249879172986e-5,7.98902323659588e-9,-0.0014382599562942464,2.578984727441783e-5,7.851630723953415e-9,-0.001437907000473791,2.558258430097201e-5,7.706602007982529e-9,-0.0014374713475980292,2.539984818095332e-5,7.580298299298504e-9,-0.0014369654370357835,2.5277430919184726E-05,7.498481675769508e-9,-0.0014364149450387434,2.524445155724815e-5,7.481837634246073e-9,-0.0014358560907401488,2.531680732424275e-5,7.541239382042651e-9,-0.0014353299421923447,2.549174348391302e-5,7.67395063074306e-9,-0.0014348742608147498,2.5745447771436074e-5,7.862124322155557e-9,-0.0014345144552345818,2.6035180886781052e-5,8.074600559849243e-9,-0.0014342558619612528,2.6306381027453562e-5,8.272200047331242e-9,-0.001434079589311781,2.6503932782313694e-5,8.415841468953633e-9,-0.0014339437223416472,2.658569469617018e-5,8.476099349229682e-9,-0.0014337909162949274,2.653533090809111e-5,8.442148816768944e-9,-0.0014335620776601706,2.6370518693983798e-5,8.32738512813637e-9,-0.0014332136074441035,2.614232716045764e-5,8.16878953155742e-9,-0.0014327328436069065,2.592319956427502e-5,8.01823403658462e-9,-0.0014321447131647473,2.5785451237951414e-5,7.927095900408931e-9,-0.0014315049081303302,2.5778022969174607e-5,7.92972291182139e-9,-0.001430881462440153,2.591187567232032e-5,8.0331743458699e-9,-0.0014303331772278684,2.616035797685171e-5,8.217711692267238e-9,-0.0014298944934438224,2.6472481447071226e-5,8.446469961108673e-9,-0.0014295714210435305,2.6790920056085873e-5,8.67839265732808e-9,-0.0014293466416022695,2.706669905365202e-5,8.878682424407924e-9,-0.0014291886521796292,2.726698482237647e-5,9.024249768378522e-9,-0.0014290605250002484,2.7376714200605378e-5,9.104750656058354e-9,-0.0014289262535661926,2.7396668664601868e-5,9.121125674470142e-9,-0.0014287546376585928,2.734037378186705e-5,9.083361209742851e-9,-0.0014285215854872378,2.7231132652078738e-5,9.008387004102195e-9,-0.0014282118094740023,2.7099446056366132e-5,8.91824477219024e-9,-0.0014278205169719102,2.6980369162120895e-5,8.838165817857077e-9,-0.0014273551041353886,2.6910052790540644e-5,8.794014126806641e-9,-0.001426836217410468,2.692081607168585e-5,8.808668492982802e-9,-0.0014262969989791532,2.703467650249471e-5,8.897360695655925e-9,-0.0014257791653392638,2.7256366225002294e-5,9.062761040100194e-9,-0.0014253252294257476,2.7568169951920956e-5,9.291482753990074e-9,-0.0014249678412150235,2.7929586139618507e-5,9.554082763102208e-9,-0.001424719247272349,2.8283922152095817e-5,9.8099633515569e-9,-0.0014245649540888968,2.857138997614607e-5,1.0016784431585915e-8,-0.001424464819701088,2.874523105273305e-5,1.0141889729331605e-8,-0.0014243621807249333,2.8785614912595313e-5,1.0172034668321106e-8,-0.001424198594399113,2.8706550061364885e-5,1.0118076747905602e-8,-0.0014239298298215845,2.855338333973738e-5,1.0012952173362216e-8,-0.0014235384273948743,2.8391359153604704e-5,9.903332600293055e-9,-0.001423039068963574,2.8288237213866135e-5,9.837163726172813e-9,-0.0014224748046457894,2.8295862255426144e-5,9.850620457112531e-9,-0.0014219048911750486,2.8436423102220665e-5,9.95855573897215e-9,-0.0014213881167722824,2.8698019217145672e-5,1.0151643259449534e-8,-0.001420967450066756,2.9040746996965335e-5,1.0400951762124473e-8,-0.0014206611416994707,2.941022918094345e-5,1.066766982712532e-8,-0.001420462210050991,2.9752840746124096e-5,1.0913884054961945e-8,-0.0014203445464611544,3.0027360180390388e-5,1.111072374244291e-8,-0.0014202718523974758,3.0210625033603962e-5,1.1242230035220288e-8,-0.0014202059478694213,3.0297793467362173e-5,1.130543514634517e-8,-0.0014201126851082163,3.0299379741317255e-5,1.1308212546961511e-8,-0.001419965354967399,3.023722740125861e-5,1.126641797154726e-8,-0.0014197463754245395,3.0140745523510838e-5,1.1201222166966375e-8,-0.0014194482287997765,3.004374201377961e-5,1.1136832656018542e-8,-0.0014190743137684472,2.9981438465230445e-5,1.1098298258684281e-8,-0.001418639809555389,2.9986901963587264e-5,1.1108885328964141e-8,-0.001418171968272546,3.008617815680982e-5,1.1186579824169502e-8,-0.0014177085861886171,3.0291942135319834e-5,1.133964646008498e-8,-0.001417293059956346,3.05967206924271e-5,1.1562003200599675e-8,-0.0014169650708668305,3.0968510049347896e-5,1.1830355814926381e-8,-0.0014167481369272308,3.135278601208798e-5,1.210581797947972e-8,-0.0014166384270926171,3.168371673086619e-5,1.2341922339142801e-8,-0.001416601011852032,3.1903068064781095e-5,1.2497950944243014e-8,-0.001416577597530908,3.197990561297152e-5,1.2552765821321245e-8,-0.001416504023895075,3.192205189348772e-5,1.2512782170450044e-8,-0.0014163303334027324,3.177388113563488e-5,1.241023118085146e-8,-0.0014160352058320256,3.160197306166359e-5,1.2292773285630224e-8,-0.00141563020412267,3.147525183817631e-5,1.2209223647116733e-8,-0.001415154182806351,3.144686499940079e-5,1.219665427065755e-8,-0.0014146612944608804,3.1542588220823e-5,1.2272337128455885e-8,-0.0014142068212377667,3.17574992652059e-5,1.2431711044918489e-8,-0.0014138345495532411,3.206030619328251e-5,1.2651790954942593e-8,-0.0014135683760217552,3.240316711893786e-5,1.2898338055852669e-8,-0.0014134095167311366,3.273394154711765e-5,1.3134557510283644e-8,-0.0014133391618895421,3.300757270905415e-5,1.3329020931988017e-8,-0.0014133249690354472,3.31939594183018e-5,1.34610409333419e-8,-0.0014133289896605121,3.328119077205221e-5,1.3522794560786908e-8,-0.001413314822460721,3.3274656159752014e-5,1.3518607273504532e-8,-0.0014132527079583823,3.3193518643689525e-5,1.3462443644765452e-8,-0.0014131223461608018,3.3066195373724894e-5,1.3374722960227905e-8,-0.001412913992766144,3.292604615376844e-5,1.3279258055873786e-8,-0.0014126286522506636,3.2807704536436217e-5,1.3200599557144906e-8,-0.0014122779793304208,3.274378481004234e-5,1.3161617579820244e-8,-0.0014118840527596287,3.276134215889836e-5,1.318093997452497e-8,-0.0014114785988180107,3.287744387268909e-5,1.3269863918137662e-8,-0.0014111005438624472,3.309364278437632e-5,1.3428626290622916e-8,-0.0014107903444190032,3.339035361538781e-5,1.3642698341029341e-8,-0.0014105801213301545,3.372401496582465e-5,1.388102605623399e-8,-0.0014104809172316352,3.403140528598448e-5,1.4099169038639324e-8,-0.0014104721889999377,3.4244418459823575e-5,1.4249623837810556e-8,-0.0014105012730983308,3.431313016865975e-5,1.4297897851110098e-8,-0.0014104976530675871,3.4227232153276674e-5,1.4237483279052317e-8,-0.0014103978203613941,3.4023102917727105e-5,1.409478258989675e-8,-0.0014101683041605874,3.37710788967813e-5,1.3920030577394821e-8,-0.0014098152448564095,3.3549879175073367e-5,1.3769043937615413e-8,-0.0014093780596700428,3.342166325020871e-5,1.3685419104499984e-8,-0.0014089135400348065,3.341756238018929e-5,1.3690309226175862e-8,-0.0014084788334548454,3.3535493238112093e-5,1.37811189010826e-8,-0.0014081186845767038,3.374669781848928e-5,1.3936497322555077e-8,-0.0014078585339577186,3.400633332696204e-5,1.4124144409347155e-8,-0.0014077028508541673,3.42645878758073e-5,1.4308805334751806e-8,-0.0014076373664685578,3.4476340111075574e-5,1.4459025629545484e-8,-0.0014076339312917433,3.4608360343685586e-5,1.4552028310657353e-8,-0.0014076568208633863,3.464345854701809e-5,1.457641017245677e-8,-0.001407669277186434,3.458141606859998e-5,1.4532638817739162e-8,-0.0014076391876356137,3.443714237304597e-5,1.4431695615751243e-8,-0.0014075431589499628,3.42369134134312e-5,1.4292440206539112e-8,-0.0014073687088618709,3.401369363319955e-5,1.4138337135936162e-8,-0.0014071148025871514,3.380247774740365e-5,1.3994150056515684e-8,-0.0014067912957618034,3.363619137526845e-5,1.3882976655598566e-8,-0.001406417785833611,3.3542132876375727e-5,1.3823657520053249e-8,-0.0014060220696082155,3.3538605100390865e-5,1.3828389059174037e-8,-0.0014056380007306819,3.363132267047934e-5,1.3900311168766636e-8,-0.0014053019647113963,3.3809476163547754e-5,1.403098639393186e-8,-0.0014050467952829435,3.404235090138576e-5,1.4198316878603361e-8,-0.0014048925106380783,3.427900969237467e-5,1.4366522015636952e-8,-0.0014048352740607154,3.4454830578689884e-5,1.4490717899879615e-8,-0.0014048394576729162,3.450785686877302e-5,1.452817586539771e-8,-0.0014048405652307403,3.4402642110255266e-5,1.4454790297227312e-8,-0.001404764049178016,3.415061768516878e-5,1.4279243287251102e-8,-0.0014045544794032856,3.381223147440442e-5,1.4044512501709342e-8,-0.001404199019517501,3.34753415760048e-5,1.3812662721467575e-8,-0.0014037308928993113,3.322120032523223e-5,1.3640780805957817e-8,-0.0014032126628860826,3.309751484531842e-5,1.3561886833224022e-8,-0.0014027118105852483,3.311012467826726e-5,1.3579138976547671e-8,-0.0014022815504324637,3.3230920394382554e-5,1.3671690150678322e-8,-0.0014019518800177807,3.341272421638346e-5,1.3805518700988216e-8,-0.0014017290980962978,3.360354473780993e-5,1.3943711301648619e-8,-0.0014016000243125806,3.375694744860536e-5,1.4053807349603574e-8,-0.001401537920759662,3.383830386691697e-5,1.4112051071441454e-8,-0.001401508516602354,3.38278961316903e-5,1.4105333153706423e-8,-0.0014014756088146735,3.372177220527613e-5,1.4031568509718768e-8,-0.0014014060660440912,3.353076489929489e-5,1.3898885331730495e-8,-0.0014012739860668733,3.327793091957308e-5,1.3723815329935129e-8,-0.0014010636973225197,3.2994742987017955e-5,1.3528667448275764e-8,-0.0014007713279077503,3.271646976821572e-5,1.3338315101143095e-8,-0.0014004048383781237,3.247734073521475e-5,1.3176767910392181e-8,-0.001399982720160362,3.230609707347399e-5,1.3063963984102755e-8,-0.0013995317115542282,3.222223618554686e-5,1.3013065431940527e-8,-0.0013990837824146862,3.223298100013896e-5,1.3028362806501945e-8,-0.0013986724408224693,3.2330914871978444e-5,1.310378977963939e-8,-0.0013983280897938944,3.249234472603756e-5,1.3222059543851011e-8,-0.0013980719157413676,3.26771022098923e-5,1.3354806377875613e-8,-0.001397908301055983,3.2831582187595467E-05,1.3464847011626819e-8,-0.001397817347062273,3.289747667782527e-5,1.3512189019105797e-8,-0.001397751512132713,3.28277047548693e-5,1.3464871106866769e-8,-0.0013976423203658295,3.260691801970788e-5,1.3312974762696126e-8,-0.0013974208313565252,3.2266892279175194e-5,1.3079220779759064e-8,-0.0013970462170215551,3.188350281420138e-5,1.2816866134850941e-8,-0.001396526429072313,3.15504266134185e-5,1.2591347003175733e-8,-0.0013959162362914407,3.134208482490942e-5,1.2454319312828303e-8,-0.0013952934212709952,3.12876940613365e-5,1.2425488800691024e-8,-0.0013947290248052181,3.1368994960239776e-5,1.2491155941132685e-8,-0.0013942677926455445,3.153656609401135e-5,1.2615901943459306e-8,-0.001393923604268954,3.173094679442987e-5,1.2757639356311874e-8,-0.0013936850245932673,3.189863660685751e-5,1.287894027262053e-8,-0.0013935243292366379,3.20005016684368e-5,1.295286703830315e-8,-0.0013934059148908537,3.2014351751696166e-5,1.2964583482053157e-8,-0.0013932926868055352,3.193431439306784e-5,1.29106853876459e-8,-0.0013931506171936453,3.176890244780789e-5,1.279767711238989e-8,-0.0013929521622677431,3.153852371658084e-5,1.2640170940633758e-8,-0.0013926789463034916,3.1272453315631026e-5,1.2458806214965603e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_4.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_4.json deleted file mode 100644 index 7170bac9..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_4.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":4000,"numberOfSamples":1000,"samples":[-0.0013923237156324762,3.10051313115372e-5,1.227772476593132e-8,-0.0013918913030339685,3.0771749723490945e-5,1.2121506307793586e-8,-0.0013913982265213998,3.060338976954708e-5,1.2011722091998317e-8,-0.0013908707040811456,3.052231698115309e-5,1.1963565646016446e-8,-0.001390341194667023,3.053811122326968e-5,1.198311590315129e-8,-0.0013898437960375297,3.064516965374932e-5,1.206567850949141e-8,-0.0013894089283486013,3.0821985171837794e-5,1.219550046257788e-8,-0.0013890577325521491,3.103246124664618e-5,1.234697235237071e-8,-0.001388796542557306,3.12295787680487e-5,1.2487412403812631e-8,-0.0013886120720738905,3.136210718279558e-5,1.2581786671309725e-8,-0.0013884688947041909,3.1385084006792996e-5,1.2599819994917749e-8,-0.0013883119458332274,3.127360474065753e-5,1.2525244839418013e-8,-0.0013880771300425396,3.103666131759266e-5,1.2365079707027838e-8,-0.0013877108551321243,3.072388276790292e-5,1.2154123117817592e-8,-0.0013871929430152989,3.0416606360292832e-5,1.1948741207200948e-8,-0.001386550391714903,3.0201205713724095e-5,1.1808429582903155e-8,-0.0013858506737383077,3.01357997768827e-5,1.1772803776767341e-8,-0.0013851759104291312,3.0229273883448915e-5,1.1847175892297428e-8,-0.001384592881220668,3.0443874540562336e-5,1.2004550146250928e-8,-0.0013841349373795028,3.0716035009628255e-5,1.2200281016361826e-8,-0.0013838008265632472,3.098058540822912e-5,1.2389009867920565e-8,-0.0013835645353088798,3.118712181259742e-5,1.2536034707260684e-8,-0.0013833877106148682,3.130621279611001e-5,1.2621499602221395e-8,-0.0013832296076505604,3.132862793970199e-5,1.2639667607070031e-8,-0.0013830533398082588,3.12615629520694e-5,1.2596119024238894e-8,-0.0013828292717648978,3.1124447793189026e-5,1.2504739208443173e-8,-0.001382536894290198,3.094526718665489e-5,1.238515875044467e-8,-0.001382166093661862,3.0757242436986546e-5,1.2260502826500002e-8,-0.0013817180828804721,3.059536687843876e-5,1.2155030689028627e-8,-0.0013812057662645032,3.0492356610198686e-5,1.2091316281131741e-8,-0.001380652965115511,3.0473944416237442e-5,1.2086924984252354e-8,-0.0013800918794172976,3.055405387965315e-5,1.2151015510603047e-8,-0.0013795585330693598,3.073089776278415e-5,1.2281664264941277e-8,-0.0013790865545975047,3.098519781713838e-5,1.2464780864846123e-8,-0.0013787002512115332,3.128152698517288e-5,1.2675280274755086e-8,-0.0013784083744284533,3.1573186320784075e-5,1.2880703491497357e-8,-0.0013782000273174174,3.181021399913377e-5,1.3046891803617532e-8,-0.0013780438976636682,3.19495350745652e-5,1.3144947940134446E-08,-0.0013778917807731484,3.1965865743675875e-5,1.3158522917130986e-8,-0.0013776871187557247,3.186125601721507e-5,1.3090054814128084e-8,-0.0013773784345414448,3.167005542915762e-5,1.2963872114938864e-8,-0.0013769355296510653,3.145540027821075e-5,1.2823586040322064e-8,-0.0013763632310821636,3.129451925350386e-5,1.2721957602677264e-8,-0.0013757051938257864,3.12548297658547e-5,1.2704580862237566e-8,-0.0013750325167593762,3.136980980661643e-5,1.2793513871866098e-8,-0.0013744200205683455,3.162705495398507e-5,1.297932656913296e-8,-0.001373921486003332,3.197529339541822e-5,1.3226141868971426e-8,-0.0013735559011152846,3.2345581764334165e-5,1.348632479099502e-8,-0.001373308834962327,3.267443076739067e-5,1.371638565723486e-8,-0.0013731440063741707,3.2918760928589506e-5,1.3887174851188765e-8,-0.0013730169969555664,3.306017025212218e-5,1.3986670884338575e-8,-0.001372885707505598,3.310177282032628e-5,1.4017645484980559e-8,-0.0013727161916267327,3.3062157152929236e-5,1.3993385650784678e-8,-0.0013724849650755444,3.2969528124314865e-5,1.3933613214447525e-8,-0.0013721795043743403,3.2857132549704686e-5,1.3861350571725312e-8,-0.001371798199420233,3.275975393211377e-5,1.3800541749182052e-8,-0.001371350267391638,3.2710546394120883e-5,1.3773879566233536e-8,-0.0013708554660210265,3.273748651144435e-5,1.3800332746004124e-8,-0.0013703429392595617,3.285908614832062e-5,1.3892159705457934e-8,-0.0013698482842253537,3.3079732505826116e-5,1.4051723281032588e-8,-0.0013694081789119867,3.33859216188847e-5,1.4269017354682299e-8,-0.0013690527752354515,3.3745292715916165e-5,1.4521206280880815e-8,-0.0013687973523058758,3.411026251376824e-5,1.4775341685527618e-8,-0.001368635864809167,3.442685430142285e-5,1.4994571911094206e-8,-0.001368539190809793,3.464725058126877e-5,1.5146764379461272e-8,-0.0013684596653155585,3.474271507765218e-5,1.5213225547749854e-8,-0.001368341412275528,3.471292842213015e-5,1.519483961915156e-8,-0.0013681340963783179,3.458864103148684e-5,1.5113572919781048e-8,-0.001367806641243441,3.442624486265195e-5,1.50084742827696e-8,-0.0013673571913396174,3.429481060775766e-5,1.492663952720893e-8,-0.0013668159712882611,3.425816744323766e-5,1.4910976651613327e-8,-0.0013662389537410337,3.4356679623137404e-5,1.4987969233571176e-8,-0.0013656929127156684,3.45948313307106e-5,1.5159539607809455e-8,-0.0013652362239514341,3.493996318255312e-5,1.540252269790559e-8,-0.0013649025854399397,3.533339206451559e-5,1.5676457844807535e-8,-0.001364694017006319,3.5709311516460834e-5,1.5936510012581336e-8,-0.0013645848390629765,3.6013317990182196e-5,1.6146000719145376e-8,-0.001364533006244744,3.6213785847992433e-5,1.6284003030435945e-8,-0.0013644928514191061,3.630413358810897e-5,1.6346724249025713e-8,-0.0013644247321696538,3.629841553527456e-5,1.6344369702902035e-8,-0.0013643001276189908,3.622421100892573e-5,1.6296216699097295e-8,-0.0013641030557909385,3.611585301733881e-5,1.6225972675099123e-8,-0.001363829489218644,3.6009284510185593e-5,1.6158272516967093e-8,-0.0013634861732545276,3.59384398039273e-5,1.6116209694143087e-8,-0.0013630895393642458,3.593237657339973e-5,1.6119355456194334e-8,-0.0013626646638417342,3.601230966247092e-5,1.618170797397962e-8,-0.001362243629102119,3.61880268938273e-5,1.6309266089582144e-8,-0.0013618622841067652,3.64538655276576e-5,1.6497393820657673e-8,-0.0013615544772974737,3.6785502430891855e-5,1.6728827194428735e-8,-0.0013613437161679772,3.713991173468955e-5,1.697386187057922e-8,-0.001361234021080087,3.746108911824493e-5,1.719439828116546e-8,-0.0013612037638524796,3.7692536866159856e-5,1.7352457140518053e-8,-0.001361206847971344,3.779396838960132e-5,1.742144636974678e-8,-0.0013611832374142226,3.7756031020244054e-5,1.7396011201743785e-8,-0.001361076191644119,3.7606086154550635e-5,1.7295762883204998e-8,-0.0013608496577971183,3.7401677631123275e-5,1.716059227166306e-8,-0.0013604990488915285,3.721408821670011e-5,1.7039232838343093e-8,-0.0013600520125571307,3.710835900255645e-5,1.697551683056106e-8,-0.0013595600099726545,3.712640498271043e-5,1.699695432191236e-8,-0.0013590841935409244,3.727760024130748e-5,1.71086275657347e-8,-0.001358679890204125,3.7538440708709115e-5,1.7293378278633092e-8,-0.00135838372132039,3.7860514706880266e-5,1.7517577456580113e-8,-0.0013582064390924846,3.818407848658802e-5,1.7740504047095585e-8,-0.0013581329272131877,3.845318903981301e-5,1.7924558906917483e-8,-0.0013581286541984837,3.862806850028087e-5,1.804345582610699e-8,-0.0013581498661130592,3.869159882723496e-5,1.8086397228283904e-8,-0.0013581539476281528,3.8649261142348775e-5,1.8057850041261867e-8,-0.0013581071226586598,3.8524189345567815e-5,1.7974088393725628e-8,-0.0013579883897526658,3.835008509330396e-5,1.7858356144320932e-8,-0.00135779018044884,3.8164384929534315e-5,1.7736239335068338e-8,-0.001357517027048097,3.800295694389865e-5,1.7632074255281237e-8,-0.0013571835099064594,3.789645286761099e-5,1.7566453802397066e-8,-0.0013568122323385436,3.786770844912354e-5,1.7554432313878906e-8,-0.0013564319146861178,3.792940545542113e-5,1.760394100218013e-8,-0.0013560751230173448,3.808144637277682e-5,1.771409396726125e-8,-0.001355774723096159,3.830809315615486e-5,1.7873437098055103e-8,-0.0013555581129589143,3.85759738967685e-5,1.805883775217439e-8,-0.0013554390847187276,3.883530834118127e-5,1.8236503204011578e-8,-0.001355409076240439,3.9027250633763036e-5,1.836699003058032e-8,-0.0013554321238842734,3.909874292882928e-5,1.8415131641263553e-8,-0.0013554490528045462,3.90218298649933e-5,1.836291168093209e-8,-0.0013553934777036426,3.88088274293409e-5,1.8219570358978306e-8,-0.0013552148739573212,3.8513364752411945e-5,1.8022193158569097e-8,-0.0013548976458011926,3.821394753241361e-5,1.7824422483376295e-8,-0.0013544662886432806,3.7987376502045904e-5,1.767824374087245e-8,-0.001353975167144596,3.788495877740173e-5,1.7617747380746665e-8,-0.0013534897169433626,3.792082265498023e-5,1.765132964873523e-8,-0.0013530679623867672,3.807359000944715e-5,1.776318309780284e-8,-0.0013527479846985185,3.82970266342332e-5,1.7920945154219862e-8,-0.0013525427737545379,3.8534126622979775e-5,1.8085549434599747e-8,-0.0013524413684721215,3.8730475725509086e-5,1.8220348872787433e-8,-0.0013524143580498815,3.8844550459139665e-5,1.829793515757917e-8,-0.0013524218120327396,3.885388259987187e-5,1.830403299861606e-8,-0.0013524218425320289,3.8756778190668846e-5,1.8238389323156565e-8,-0.0013523781464381873,3.857000249417001e-5,1.8113029207340084e-8,-0.0013522652859119853,3.832360437107422e-5,1.7948697828581297e-8,-0.0013520711816035556,3.805446144349454e-5,1.7770522740602527e-8,-0.0013517970474576544,3.7800026057570636e-5,1.760383303417335e-8,-0.0013514555502732262,3.759328234789039e-5,1.7470765883749638e-8,-0.0013510681406707162,3.745922197053802e-5,1.7387859156658665e-8,-0.0013506622145259056,3.741251692416933e-5,1.7364450412879974e-8,-0.0013502682953014952,3.7455843878886433e-5,1.7401577299135237e-8,-0.0013499170098815133,3.757843888576176e-5,1.749114206947162e-8,-0.0013496352319221148,3.775487577483726e-5,1.7615323797154796e-8,-0.001349440649488639,3.794495617766193e-5,1.7746750386563e-8,-0.0013493347424008647,3.809671819615431e-5,1.7850659872577422e-8,-0.001349295890582923,3.8155046902679206e-5,1.7890635669466993e-8,-0.0013492766959825838,3.807708327935155e-5,1.783874654599152e-8,-0.0013492110735612106,3.785133903622449e-5,1.768815260529381e-8,-0.001349033855976422,3.751108479626499e-5,1.7461969909133265e-8,-0.0013487069795288752,3.71303580506857e-5,1.7210535401503925e-8,-0.0013482379377772538,3.67993136705882e-5,1.6994726215196717e-8,-0.001347678208637462,3.659042766946213e-5,1.6863046213677397e-8,-0.0013471024913643088,3.6534216931232214e-5,1.6835204236635903e-8,-0.0013465817610538201,3.661531138061667e-5,1.6899639174625656e-8,-0.0013461637307948591,3.67855921967629e-5,1.702274689456107e-8,-0.0013458659040266978,3.698362593147122e-5,1.716236688366139e-8,-0.0013456786096961092,3.715150481672573e-5,1.7279353443021854e-8,-0.0013455729607305563,3.7245547989349e-5,1.7344764650321256e-8,-0.0013455098437546319,3.724113849988471e-5,1.7342896275356996e-8,-0.0013454479816408654,3.713333537401668e-5,1.7271384802952297e-8,-0.0013453504339775678,3.693472237791048e-5,1.7139497446621565e-8,-0.0013451893773290563,3.66714125531848e-5,1.69653115025737e-8,-0.001344949053305138,3.6377906041960216e-5,1.677225728879621e-8,-0.0013446268270830342,3.6091487557028635e-5,1.658542561013439e-8,-0.0013442324429496473,3.584683872566402e-5,1.642801203779135e-8,-0.0013437858000863968,3.567151610583387e-5,1.6318286339007397e-8,-0.0013433138090793446,3.5582718952246464e-5,1.6267381969080993e-8,-0.0013428468552322854,3.5585336135370534e-5,1.6277959343087233e-8,-0.0013424151246411572,3.567102736278635e-5,1.6343650045473796e-8,-0.0013420448217986622,3.581815905326798e-5,1.6449191850671144e-8,-0.0013417540843769415,3.5992621037087415e-5,1.6571231526067074e-8,-0.0013415482762467888,3.6150103914661236e-5,1.6680073457991738e-8,-0.0013414149103668283,3.624123041516313e-5,1.6743183400191018e-8,-0.0013413198868642417,3.622112481074397e-5,1.6731446982117347e-8,-0.00134120845189209,3.606369069563323e-5,1.662842184473864e-8,-0.0013410151654745213,3.577732086480887e-5,1.644054815603201e-8,-0.0013406846000409867,3.5413460407537786e-5,1.6202722853245097e-8,-0.0013401964609990825,3.505743910760731e-5,1.597215167212452e-8,-0.001339580425708274,3.479926151774641e-5,1.5808809507200667e-8,-0.0013389081886428587,3.4697739505285814e-5,1.5751417893888703e-8,-0.0013382653066040724,3.475913717423584e-5,1.5803205836748927e-8,-0.0013377198411129057,3.494136132320177e-5,1.593492656261746e-8,-0.0013373043650111932,3.517656334298736e-5,1.610030358752367e-8,-0.001337015439682562,3.5396327466275055e-5,1.6253166407767607e-8,-0.0013368239990238355,3.5548502293726705e-5,1.6358821610884963e-8,-0.0013366882809558854,3.560374914900627e-5,1.639832805964985e-8,-0.001336564467218173,3.55549452941308e-5,1.636783817572624e-8,-0.001336413776905145,3.541320348266067e-5,1.627564290331889e-8,-0.0013362066349266496,3.520293709170862e-5,1.6138666700184393e-8,-0.0013359249232274644,3.4956909941254224e-5,1.5979096337218204e-8,-0.001335562924155841,3.4711420854670354e-5,1.582122151313896e-8,-0.0013351271377057652,3.4501629448674695e-5,1.568840971408109e-8,-0.0013346349529169633,3.435711455278746e-5,1.5600199028356044e-8,-0.0013341121333342526,3.429797828590833e-5,1.5569686455152157e-8,-0.0013335892705868344,3.433199575848479e-5,1.5601580165570786e-8,-0.0013330975858291425,3.4453164621146024e-5,1.5691228226897585e-8,-0.0013326644706178011,3.464175000353744e-5,1.5824749599259128e-8,-0.0013323090899715643,3.4865868704546576e-5,1.5980301002253026e-8,-0.001332038338966892,3.508467362609938e-5,1.6130447896255385e-8,-0.0013318434113794785,3.525330077002587e-5,1.6245627748951825e-8,-0.0013316975322695253,3.5330051294305984e-5,1.629891139049964e-8,-0.001331556286785722,3.528619312938393e-5,1.6272293810409786e-8,-0.0013313628892067757,3.5117465072944155e-5,1.6163989779264318e-8,-0.0013310606240185723,3.485372509921916e-5,1.5994525193249938e-8,-0.001330612092239529,3.4560074860567006e-5,1.5807325007709106e-8,-0.0013300188819388664,3.432251695865668e-5,1.5659203035008636e-8,-0.0013293294672254824,3.4218415257834896e-5,1.5600856484188996e-8,-0.0013286258106659328,3.4284781738908746e-5,1.565595284409048e-8,-0.0013279927272366466,3.45034557497139e-5,1.5811466092247673e-8,-0.001327487245815521,3.481218305757908e-5,1.6025241776050835e-8,-0.0013271243297834456,3.5132573390047304e-5,1.6244759544611692e-8,-0.0013268819281744182,3.539726971412401e-5,1.6425301589944376e-8,-0.0013267165573191055,3.556482846968116e-5,1.6539830337867083e-8,-0.0013265791200544272,3.5621827657685704e-5,1.65802341767557e-8,-0.0013264257556151145,3.5577571686315266e-5,1.6553560503722946e-8,-0.0013262233226004878,3.5456646993180176e-5,1.6476832678516347e-8,-0.0013259512363842734,3.529220284957108e-5,1.637245418374682e-8,-0.001325601512184336,3.512067149730725e-5,1.626470172512635e-8,-0.0013251780734556981,3.497753493359976e-5,1.6177001160356565e-8,-0.0013246955832461917,3.4893601735033355e-5,1.6129548566876927e-8,-0.0013241776457557696,3.48914999010468e-5,1.6137021291032074e-8,-0.001323654076904617,3.4982458503977466e-5,1.6206426975212878e-8,-0.001323157041794967,3.5163901163299414e-5,1.633548781930137e-8,-0.0013227162371304468,3.5418581049974166e-5,1.651211397605036e-8,-0.001322353687199993,3.571581068946272e-5,1.6715367990939248e-8,-0.0013220789387146789,3.601504810064792e-5,1.6918061706656873e-8,-0.0013218855424575772,3.627176280866538e-5,1.7090842854582353e-8,-0.0013217496703317407,3.644508967537851e-5,1.720733490398808e-8,-0.0013216315923340778,3.65064979819164e-5,1.7249749168249524e-8,-0.0013214807524120568,3.644842841848515e-5,1.7214291107647377e-8,-0.0013212451222116156,3.6291038759722376e-5,1.711523751546295e-8,-0.0013208846495029996,3.60839095678969e-5,1.6985751198887913e-8,-0.0013203863550454039,3.5898854230369885e-5,1.6873006904681262e-8,-0.0013197752519399667,3.581166273538234e-5,1.682623169287687e-8,-0.0013191132255276836,3.587626651540886e-5,1.6879911863534467e-8,-0.0013184815790603076,3.610241659999537e-5,1.7039381967031404e-8,-0.0013179528033887597,3.645020189165614e-5,1.7277474450637978e-8,-0.0013175658344386403,3.684610326885073e-5,1.7545256584706124e-8,-0.0013173174371027003,3.721139594219093e-5,1.7790800848516823e-8,-0.0013171711591591722,3.7487162393554715e-5,1.797564920289059e-8,-0.0013170751083556422,3.764583818573417e-5,1.8082333520008842e-8,-0.0013169783809209286,3.768958704883004e-5,1.8113134460390254e-8,-0.001316841058972772,3.764169488899078e-5,1.8084193168326844e-8,-0.001316637900558923,3.7536910324560003e-5,1.8018963620713753e-8,-0.0013163581227781179,3.74137736701684e-5,1.7943079177386814e-8,-0.0013160036253867771,3.730942928907114e-5,1.7880963442603383e-8,-0.0013155869869080489,3.725613444561233e-5,1.7853614375631473e-8,-0.0013151295414577234,3.7278505354125304e-5,1.787686235519351e-8,-0.0013146592408699255,3.7390914042800114e-5,1.7959684433815758e-8,-0.0013142077768859126,3.759497729467439e-5,1.8102557862085905e-8,-0.0013138065061219567,3.787768395385184e-5,1.829626511989185e-8,-0.0013134811566555547,3.821118959139425e-5,1.852186865762894e-8,-0.0013132460042088404,3.855535190871637e-5,1.8752556581883928e-8,-0.0013130988888896927,3.886358760935178e-5,1.895768052314085e-8,-0.0013130187880983333,3.9091668685304416e-5,1.9108648012779857e-8,-0.0013129673945528086,3.920788927157972e-5,1.9185567048502283e-8,-0.001312895240496861,3.920217618512819e-5,1.918302681873874e-8,-0.001312751730863596,3.9091588709663886e-5,1.911338071545348e-8,-0.0013124973851131767,3.892009752658912e-5,1.9006243630838438e-8,-0.0013121156803837925,3.875132474201483e-5,1.8903462645629538e-8,-0.0013116210944716046,3.865427657691962e-5,1.884969011796569e-8,-0.0013110596023093825,3.868436788208665e-5,1.8880112079492577e-8,-0.0013104989534392041,3.8865074759319735e-5,1.9008779400316116e-8,-0.0013100096397849926,3.917783531577995e-5,1.9222392671536106e-8,-0.001309642829716195,3.9566441267412706e-5,1.9483464693369486e-8,-0.0013094148936341004,3.995569860122959e-5,1.974262974906959e-8,-0.0013093055437344233,4.027611457180882e-5,1.9954738594955732e-8,-0.001309269039156997,4.048329051082387e-5,2.0091415425642147e-8,-0.0013092512762208149,4.0565121305456764e-5,2.0145608286767512e-8,-0.001309204630257768,4.053753924890765e-5,2.012862157893427e-8,-0.0013090962818779034,4.043433842048082e-5,2.0063277178960123e-8,-0.0013089102465701447,4.029664197237238e-5,1.997689758602726e-8,-0.0013086455823332675,4.0164989376255385e-5,1.9896096938048397e-8,-0.0013083132488531785,4.0074480065967925e-5,1.984365052124649e-8,-0.0013079330725531747,4.005204604799757e-5,1.9836785608003348e-8,-0.0013075312073712847,4.011466197911539e-5,1.9886069633644747e-8,-0.001307137746835643,4.026767679567208e-5,1.9994358344677895e-8,-0.0013067837953618638,4.0503094151805196e-5,2.01557240211866e-8,-0.001306497350497541,4.079836018355392e-5,2.0354765247593485e-8,-0.0013062978171497592,4.111688713507512e-5,2.0567103458832157e-8,-0.0013061898867567608,4.141184316071489e-5,2.076202115095573e-8,-0.0013061586859034154,4.163420723263055e-5,2.0907824211338083e-8,-0.001306168888940125,4.174442656977121e-5,2.097944515467198e-8,-0.0013061699709006594,4.1724685296821706e-5,2.0966324787464215e-8,-0.0013061076049721034,4.1587191985985025e-5,2.0877595932876798e-8,-0.0013059383156452651,4.137443165518275e-5,2.0741958445759947e-8,-0.0013056425938951044,4.115010375057371e-5,2.060146632532868e-8,-0.0013052319085176942,4.098302152604378e-5,2.0500810520890916e-8,-0.001304747148248314,4.092874780265062e-5,2.0475326047336553e-8,-0.0013042487662768554,4.101434730128175e-5,2.0541288681716853e-8,-0.0013038012226081626,4.1230688242288156e-5,2.0691321547541416e-8,-0.0013034559571685768,4.153480564579156e-5,2.0896370294196396e-8,-0.0013032379646765557,4.186207205593781e-5,2.111390047210881e-8,-0.0013031404096450596,4.214456168589532e-5,2.1299885763046148e-8,-0.0013031290193728036,4.232935992827865e-5,2.1420571741681682e-8,-0.0013031540596875038,4.23905340975399e-5,2.1460031357444974e-8,-0.0013031647722243158,4.233156537247573e-5,2.1421513055924925e-8,-0.0013031210288061141,4.217942322107834e-5,2.132339132411696e-8,-0.0013029993698451085,4.19743987627646e-5,2.1192421768565933e-8,-0.0013027936105723457,4.175999540557228e-5,2.1057114924379603e-8,-0.0013025120277159838,4.157542941681899e-5,2.094288448231488e-8,-0.0013021733414850117,4.145125605159004e-5,2.0869268627645957e-8,-0.001301802931785606,4.1407329810052036e-5,2.08486684580033e-8,-0.0013014297605223135,4.1451908374797514e-5,2.0885812894513818e-8,-0.001301083724057496,4.158098532303902e-5,2.097737756976615e-8,-0.0013007927456693646,4.177756479690925e-5,2.1111607157953057e-8,-0.0013005788777021498,4.201134797256275e-5,2.126826146359011e-8,-0.0013004531008736547,4.224008178027535e-5,2.1419659516259312e-8,-0.0013004095063849311,4.241435176037529e-5,2.1533904163364884e-8,-0.001300421059288809,4.248719684661846e-5,2.1581120022324038e-8,-0.0013004404355749176,4.2427837091928494e-5,2.154224223145945e-8,-0.0013004089398097013,4.223528221728633e-5,2.1417667998620045e-8,-0.001300273032166463,4.194483810430357e-5,2.1231287584532605e-8,-0.0013000028044365167,4.162178844603964e-5,2.1026176296912758e-8,-0.0012996038559836165,4.13426408192214e-5,2.0852193780685487e-8,-0.0012991166051237216,4.117141562699113e-5,2.075042537733095e-8,-0.0012986036072820868,4.11409724530234e-5,2.0741091404972655e-8,-0.00129813093698426,4.1245817779201306e-5,2.0819172199719124e-8,-0.0012977508063343123,4.144686388868798e-5,2.095795336418839e-8,-0.001297490230837804,4.168441992169005e-5,2.1117875653405696e-8,-0.0012973474395914163,4.1894427134593377e-5,2.1257279803455193e-8,-0.001297295439153459,4.2023506126082147e-5,2.1342116234441085e-8,-0.001297290782074011,4.2039616230905444e-5,2.135260920238544e-8,-0.0012972848326498105,4.193654440887813e-5,2.1285844007437435e-8,-0.0012972345579685953,4.173200901824314e-5,2.1154255926592056e-8,-0.0012971103085002236,4.146082617494708e-5,2.0981029477300475e-8,-0.0012968992859630204,4.116578087591e-5,2.0794135694006106e-8,-0.0012966049398672192,4.0888917956883526e-5,2.062073980233298e-8,-0.0012962436295018886,4.066503581169255e-5,2.048307865442981e-8,-0.0012958401889284622,4.051793533458231e-5,2.039611146731544e-8,-0.0012954236654983476,4.045897416475759e-5,2.036662737785466e-8,-0.001295023782419015,4.0486965044612695e-5,2.039320583348045e-8,-0.0012946679941183582,4.058855472756083e-5,2.04665171281949e-8,-0.001294378612670228,4.0738730472340536e-5,2.056977240662803e-8,-0.0012941693814056939,4.0901748941956324e-5,2.0679500965812705e-8,-0.0012940411451917645,4.1033526442706687e-5,2.0767257575044023e-8,-0.0012939771911233996,4.108715604463087e-5,2.0803239961642293e-8,-0.0012939403977219072,4.102298074380838e-5,2.0762689854466084e-8,-0.0012938758566673656,4.082263405184535e-5,2.0634736809638925e-8,-0.0012937224662835883,4.050242606522025e-5,2.04308134609819e-8,-0.0012934330065076513,4.0117530900919203e-5,2.0187204767311665e-8,-0.00129299496709262,3.974958987689844e-5,1.995693470396842e-8,-0.0012924399284722028,3.947942732467301e-5,1.97920270271869e-8,-0.0012918341252307118,3.935776650460108e-5,1.9724509449887175e-8,-0.0012912547182092019,3.938930857514804e-5,1.97562193674393e-8,-0.001290764690673244,3.9536318616132314E-05,1.9861433777957795e-8,-0.0012903973760540492,3.973598386964465e-5,1.999850762256767e-8,-0.001290153512484858,3.992107605315687e-5,2.0123564778314824e-8,-0.0012900074223779303,4.003630507822636e-5,2.0201177921784495e-8,-0.0012899173653183767,4.0047651738485965e-5,2.0210256251888748e-8,-0.001289836338458807,3.9945200597234635e-5,2.0145554957262593e-8,-0.0012897212998023743,3.9741174964429464E-05,2.0016045030261284e-8,-0.0012895399514628268,3.946480109359224e-5,1.984132894245313e-8,-0.001289274703109967,3.915530609271689e-5,1.9647018285539673e-8,-0.0012889236983102278,3.885435148165427e-5,1.9459904493796818e-8,-0.0012884992067051736,3.8599204907948656e-5,1.9303690980758627e-8,-0.0012880241094008248,3.841760919532316e-5,1.919581678542283e-8,-0.0012875274288492854,3.832480054634275e-5,1.9145604099175267e-8,-0.0012870398381923532,3.8322598965528926e-5,1.9153682307136752e-8,-0.001286589752637628,3.840001624621069e-5,1.921238243257403e-8,-0.001286200095515784,3.853470660398659e-5,1.9306731004946026e-8,-0.0012858854886256378,3.86948874374072e-5,1.9415831342562718e-8,-0.001285649499877651,3.8841815281819475e-5,1.9514646939711093e-8,-0.0012854817125208561,3.893347048250045e-5,1.9576511347082232e-8,-0.0012853550995704204,3.893063802338816e-5,1.957702413451274e-8,-0.0012852255062502298,3.880636244566652e-5,1.9499927026725242e-8,-0.0012850362965845573,3.855807120421911e-5,1.9344575221523857e-8,-0.0012847311762881526,3.821819412132976e-5,1.9132471126811794e-8,-0.0012842747415224602,3.785512960173213e-5,1.8907745295762985e-8,-0.0012836727720354248,3.755682902569352e-5,1.8726620068053298e-8,-0.0012829784848701268,3.739895052372073e-5,1.863702330001396e-8,-0.0012822761530718633,3.7413406126274804e-5,1.86584821716486e-8,-0.0012816490975353263,3.7576622715437714e-5,1.8774747376732938e-8,-0.0012811506382189232,3.782352818577273e-5,1.8943030423325083e-8,-0.001280792436308164,3.8075703038799706e-5,1.9112370169816575e-8,-0.0012805506354879592,3.8266803390174146e-5,1.924016463208864e-8,-0.001280380738437669,3.835616719714332e-5,1.9300925603521577e-8,-0.0012802324630361284,3.833113206068958e-5,1.9287565495948508e-8,-0.0012800605197691444,3.820264194508425e-5,1.920823586964087e-8,-0.0012798308757682997,3.799830026151315e-5,1.9081529959526996e-8,-0.001279523586304221,3.775524645033635e-5,1.8931707405877297e-8,-0.0012791333774328948,3.751366233471992e-5,1.8784512978711527e-8,-0.0012786686262423056,3.731102412992637e-5,1.866362274807214e-8,-0.001278148993439162,3.717726455085912e-5,1.858772206348688e-8,-0.001277601942460214,3.7131143654458575e-5,1.8568311190285354e-8,-0.001277058498171101,3.717813474632904e-5,1.860839408251708e-8,-0.0012765487555219646,3.7310038774287194e-5,1.8702216632045073e-8,-0.0012760977084929888,3.750624505138479e-5,1.8836075192321827e-8,-0.0012757217769639956,3.773626898786361e-5,1.8990020553034313e-8,-0.0012754261510291623,3.796321117292025e-5,1.9140234836138346e-8,-0.0012752029370164196,3.814797161205375e-5,1.92619071682081e-8,-0.0012750300928311285,3.825433491231409e-5,1.9332571089335484e-8,-0.0012748715426223701,3.825537269909844e-5,1.933609650898041e-8,-0.0012746797344262949,3.814138317428424e-5,1.926746861138821e-8,-0.0012744025805871105,3.7928235466975745e-5,1.9137729803848053e-8,-0.0012739963106319753,3.76626292022581e-5,1.897701998328715e-8,-0.0012734431088101711,3.741827327675125e-5,1.8832033009774208e-8,-0.0012727667106644165,3.7277449564075795e-5,1.875439150470419e-8,-0.0012720341118107905,3.730026444876515e-5,1.8781318347441222e-8,-0.0012713356167803904,3.749648014380484e-5,1.8917966913490027e-8,-0.0012707503868975216,3.7818967997163176e-5,1.913345694695096e-8,-0.0012703173742792029,3.818460780063819e-5,1.937431495323869e-8,-0.0012700276843224567,3.850870965846999e-5,1.958648929745315e-8,-0.0012698377681131297,3.873234768920965e-5,1.9732821725893906e-8,-0.0012696906468235986,3.883226562099348e-5,1.9799315570624595e-8,-0.0012695333572401244,3.881646913695297e-5,1.9792123553590806e-8,-0.0012693264687479164,3.8713735516634753e-5,1.9730552119127156e-8,-0.0012690470332673868,3.856312435152506e-5,1.9640099461015192e-8,-0.0012686878191508922,3.840594630060172e-5,1.9547213377593628E-08,-0.0012682550883168057,3.8280251328920796e-5,1.9475836828836382e-8,-0.0012677659821863632,3.8216972883763434e-5,1.9445125675948716e-8,-0.0012672456478990807,3.823702573972687e-5,1.9467782522189376e-8,-0.0012667239315270157,3.834915450270301e-5,1.954879813655444e-8,-0.0012662315252516165,3.8548712365379255e-5,1.9684700622829385e-8,-0.0012657956741872701,3.881779556352557e-5,1.9863631777743846E-08,-0.0012654358895180374,3.9127111421915734e-5,2.0066562567351532e-8,-0.0012651603219259492,3.943960149495701e-5,2.0269701099621573e-8,-0.0012649633922718845,3.97155188282893e-5,2.044787773900412e-8,-0.0012648251191054683,3.991847051986315e-5,2.0578512385264233e-8,-0.0012647124020133814,4.002181530954318e-5,2.0645672703362345e-8,-0.0012645824423290432,4.0014854271467307e-5,2.0643806946391964e-8,-0.001264388687972703,3.99081829052254e-5,2.0580779083148893e-8,-0.001264089784429187,3.973682895821391e-5,2.0479457047750557e-8,-0.0012636612589438738,3.955863316563664e-5,2.0376410433125773e-8,-0.001263107692385635,3.944474943991824e-5,2.031587286383709e-8,-0.0012624700916807313,3.9460627398303827e-5,2.0337965483915675e-8,-0.0012618210646095807,3.9641206055020366e-5,2.0463436185732815e-8,-0.0012612438544760331,3.997186027742948e-5,2.0682014530823786e-8,-0.0012608019231333165,4.03889145758586e-5,2.095293879084057e-8,-0.001260515403514942,4.080331509500292e-5,2.1219900523197546e-8,-0.0012603580066779792,4.1134769690694334e-5,2.143251915066937e-8,-0.0012602736669382706,4.133709908764442e-5,2.156229199212994e-8,-0.0012602001674625438,4.140455790552599e-5,2.1606510199617428e-8,-0.0012600871138250655,4.13627425982667e-5,2.1582334626039323e-8,-0.0012599037723692542,4.125395520943257e-5,2.1517286350261602e-8,-0.001259639059405887,4.112448324373034e-5,2.1440993984703374e-8,-0.0012592978126801822,4.1016374406620794e-5,2.1379934028673295e-8,-0.0012588963729254486,4.096310517242658e-5,2.1354792900167895e-8,-0.0012584587728795547,4.0987516848376617e-5,2.13793433801656e-8,-0.0012580135545439072,4.110070043061135e-5,2.145990419081642e-8,-0.001257590729174874,4.130124851631068e-5,2.1594960240885516e-8,-0.0012572184068382751,4.1574933436424366e-5,2.1774990856265992e-8,-0.0012569188758809874,4.1895365866185666e-5,2.198290829395347e-8,-0.0012567044061644376,4.2226400284913416e-5,2.2195638913385633e-8,-0.0012565736154616957,4.252676325544257e-5,2.2387154231576545e-8,-0.0012565095347204847,4.275674007069808e-5,2.2532803702984725e-8,-0.001256480413149145,4.2886024148070224e-5,2.261430451888185e-8,-0.0012564438185601924,4.290116127527485e-5,2.262433259898739e-8,-0.0012563537977570908,4.2810748157597085e-5,2.256953566001536e-8,-0.0012561701266762151,4.264685474788228e-5,2.2471059965738813e-8,-0.001255868216795208,4.246161786198218e-5,2.2362052663867524e-8,-0.00125544775922725,4.2318356345838705e-5,2.2281882031267264e-8,-0.0012549374800614776,4.22774052795677e-5,2.226731056823057e-8,-0.0012543928884045982,4.237873413357958e-5,2.2341924508824796e-8,-0.0012538846382849707,4.262624486160383e-5,2.2506767656905367e-8,-0.0012534783871114205,4.2981135163356555e-5,2.2736596297391955e-8,-0.0012532126561929605,4.3370682260662835e-5,2.2985558206766268e-8,-0.0012530852538086268,4.3711798272939364e-5,2.3201876301994538e-8,-0.0012530559769681426,4.393918260812166e-5,2.3345305957001018e-8,-0.0012530638749481211,4.4024288239515566e-5,2.3398863033464984e-8,-0.0012530490271740113,4.3977672971138264e-5,2.3370162208987406e-8,-0.0012529684380834512,4.383778762251783e-5,2.3284209882351702e-8,-0.0012528018888721966,4.365500575092296e-5,2.317318439808869e-8,-0.001252549834499636,4.34782797526141e-5,2.3067930135885604e-8,-0.0012522276998212633,4.334721846604825e-5,2.2992993745712078e-8,-0.0012518599576908918,4.3288848879161106e-5,2.2964722563118695e-8,-0.0012514754687159037,4.331706400168195e-5,2.299109201556656e-8,-0.0012511041057524219,4.343305080609753e-5,2.3072114029472213e-8,-0.0012507740089569535,4.362583037811218e-5,2.3200256491004583e-8,-0.001250508740600051,4.387284960062057e-5,2.336086149484763e-8,-0.0012503238892904954,4.414121645053139e-5,2.353297738143989e-8,-0.0012502232383400124,4.439057639247119e-5,2.3691245534858623e-8,-0.0012501953913701654,4.4578519987771495e-5,2.380937649691334e-8,-0.0012502124466062187,4.466862199857083e-5,2.386522426953918e-8,-0.0012502324655709908,4.463985453790723e-5,2.38466230351851e-8,-0.0012502066668911443,4.449465916127025e-5,2.3756267679178933e-8,-0.0012500904907569506,4.4262301368479445e-5,2.3613540810084584e-8,-0.0012498556988007213,4.3995081325114545e-5,2.3451824758728542e-8,-0.0012494996714732477,4.375734202677175e-5,2.3311357072906797e-8,-0.0012490486343557058,4.360978994232384e-5,2.3229326501100328e-8,-0.0012485532799728183,4.359328030608507e-5,2.3229896399582473e-8,-0.001248077323762565,4.3716595091107244e-5,2.331696995481848e-8,-0.0012476814413027032,4.395208150458591e-5,2.3471965518926978e-8,-0.0012474066926813987,4.424143994728845e-5,2.3657815110514976e-8,-0.001247262641945451,4.4511219507711075e-5,2.3828756487483382e-8,-0.0012472248755787513,4.469382181566311e-5,2.3943301525145774e-8,-0.0012472435198697964,4.474664503382738e-5,2.3975912178036033e-8,-0.001247259506344416,4.466205719091103e-5,2.3922954185837815e-8,-0.0012472217473297215,4.446513739596869e-5,2.3801066644975018e-8,-0.0012470987187946957,4.420202198632878e-5,2.3639715221988536e-8,-0.0012468817729012385,4.392519162060175e-5,2.3471897838937096e-8,-0.0012465817445801888,4.368137901444268e-5,2.3326586331146017e-8,-0.0012462224178688196,4.3504603084736476e-5,2.3224476425034505e-8,-0.0012458339394664786,4.3413868956406416e-5,2.317671064191687e-8,-0.0012454477067935401,4.341371210977519e-5,2.318536732956266e-8,-0.001245092875503066,4.349582099726864e-5,2.3244572533892913e-8,-0.001244793861427751,4.364070138997217e-5,2.334159650208275e-8,-0.0012445680145702208,4.381919330597018e-5,2.3457855646996076e-8,-0.0012444228840729505,4.399437802864513e-5,2.35701808197754e-8,-0.0012443530695937283,4.4124913953168016e-5,2.3652983748257247e-8,-0.0012443375127046577,4.4170905959475854e-5,2.36819578137255e-8,-0.001244339050323051,4.410267397222573e-5,2.3639490947179656e-8,-0.0012443085409083597,4.391102098493597e-5,2.352090842966235e-8,-0.0012441949428326805,4.361529559426061e-5,2.3339274923289387e-8,-0.0012439599109511782,4.3264248999509696e-5,2.3125688607710063e-8,-0.0012435919172900148,4.292632418466513e-5,2.2923014333021052e-8,-0.0012431132807987672,4.2670863701421686e-5,2.2774032688701237e-8,-0.0012425758812366372,4.2547004754978845e-5,2.2708303443627026e-8,-0.001242046681417017,4.256875652229016e-5,2.273310098467663e-8,-0.0012415887940260054,4.2711639999148036e-5,2.2831736522023835e-8,-0.0012412448848635037,4.292095325018456e-5,2.2969151481539737e-8,-0.0012410276081992223,4.312771971755229e-5,2.310214052847942e-8,-0.0012409187405165644,4.3266945611404475e-5,2.3190749585606232e-8,-0.001240876179833917,4.329319757536537e-5,2.3207763152117412e-8,-0.0012408462077011405,4.3189822733976015e-5,2.314410023143346e-8,-0.001240777320283415,4.297005585476495e-5,2.3009154427995445e-8,-0.0012406317702474867,4.267059575677806e-5,2.2826536022629307e-8,-0.0012403919863629748,4.234042689642282e-5,2.26269926746929e-8,-0.0012400610415698615,4.2028799199970334e-5,2.2440951581700866e-8,-0.0012396584394359302,4.1775753442481906e-5,2.229275950494211e-8,-0.001239213642370792,4.160681735016447e-5,2.2197568374873713e-8,-0.001238759622997134,4.153164993599383e-5,2.21606545642313e-8,-0.0012383277669794706,4.154532626799311e-5,2.217831390256571e-8,-0.0012379443945620973,4.163077699858882e-5,2.223941511624005e-8,-0.0012376284470835346,4.17613701854737e-5,2.2327028899360917e-8,-0.0012373896362990083,4.190335157601163e-5,2.2420000164546246e-8,-0.001237226498897373,4.201852746249583e-5,2.2494706995441768e-8,-0.0012371242703294284,4.2068080603654364e-5,2.2527507113518604e-8,-0.0012370533291036505,4.201858038815096e-5,2.249845761104157e-8,-0.001236970018387961,4.18506164139745e-5,2.239652980094868e-8,-0.0012368223070618539,4.1568658962976625e-5,2.2225481522563593e-8,-0.0012365619116138991,4.120801712255095e-5,2.2007914498811416e-8,-0.0012361611416612153,4.083280694899721e-5,2.1783828379414836e-8,-0.001235627714205694,4.052073423663693e-5,2.1601104914924004e-8,-0.0012350082702082678,4.0337708897671565e-5,2.149979267276202e-8,-0.0012343757042772982,4.031356310619789e-5,2.1497194944095898e-8,-0.0012338050721628741,4.043155020851939e-5,2.1581628688838263e-8,-0.001233349834870539,4.063630930677973e-5,2.1717708568439122e-8,-0.0012330286624901638,4.0854394434720134e-5,2.1859385815913868e-8,-0.001232825543872876,4.1016780529853954e-5,2.1964061307544442e-8,-0.0012326994687433222,4.1075328421856106e-5,2.20027389188401e-8,-0.001232597984556413,4.1010377237678075e-5,2.196447509602127e-8,-0.0012324701701386766,4.083038763729262e-5,2.1855784862297425e-8,-0.0012322765508626758,4.0566046838917725e-5,2.1696628675659008e-8,-0.0012319949600370919,4.026131873137667e-5,2.151464212796346e-8,-0.0012316222127142264,3.996359807215556e-5,2.1339009160521587e-8,-0.0012311720726316338,3.971485937041825e-5,2.1195127901571155e-8,-0.001230670573013148,3.954524762662862e-5,2.1100877649413684e-8,-0.0012301501032358588,3.946977464651513e-5,2.1064790494578928e-8,-0.0012296436170803153,3.9487963552311815e-5,2.108595595697376e-8,-0.0012291799191749856,3.958568949318732e-5,2.1155185653788322e-8,-0.0012287803742935324,3.973818698101526e-5,2.1256853700710867e-8,-0.001228456809047748,3.991337515449703e-5,2.1370956879184295e-8,-0.0012282101383242943,4.007518264093764e-5,2.1475236423481508e-8,-0.0012280293349605576,4.0187061533075706e-5,2.1547450730279715e-8,-0.0012278906587169442,4.0216265386799466e-5,2.1568075140606426e-8,-0.001227757733952711,4.0139660658889306e-5,2.152381649965794e-8,-0.001227584040852701,3.995131561109933e-5,2.141206714008766e-8,-0.0012273199557392438,3.9670437193476325e-5,2.1245481814044025e-8,-0.0012269256617048919,3.934568255249432e-5,2.1054357934419238e-8,-0.001226387988600605,3.9049849819512705e-5,2.088324803621528e-8,-0.0012257337792927004,3.886073981427376e-5,2.077925099285005e-8,-0.001225029176986983,3.8832259555441034e-5,2.0774438780732722e-8,-0.0012243597146831978,3.897014608672804e-5,2.087118383561181e-8,-0.001223799174185458,3.922790438935534e-5,2.1039910874573118e-8,-0.0012233842237546633,3.952612757691313e-5,2.123118242844517e-8,-0.001223107335217403,3.9782946538246464e-5,2.139456934167179e-8,-0.0012229273220081428,3.993907780657064e-5,2.1494114292522025e-8,-0.001222787747765819,3.996887325239496e-5,2.1515041468992588e-8,-0.0012226337779387417,3.987869845089384e-5,2.1462498186417195e-8,-0.0012224231672501788,3.9698352797038394e-5,2.135591073507243e-8,-0.001222131287192134,3.94706075535104e-5,2.1222223071618265e-8,-0.0012217517999359017,3.924165377627985e-5,2.1089871554669243e-8,-0.0012212945943425393,3.905340977839935e-5,2.0984126176207197e-8,-0.0012207820344604945,3.8937868022761935e-5,2.0923847255017387e-8,-0.0012202442110411317,3.891356765329418e-5,2.0919587003276005e-8,-0.0012197138193019857,3.898419985757117e-5,2.0972925719657997e-8,-0.0012192212575737466,3.913919956043711e-5,2.1076902982625034e-8,-0.0012187904880345962,3.9356035455342134e-5,2.1217396945348294e-8,-0.001218436045934365,3.960367962125383e-5,2.1375213106972125e-8,-0.00121816125440768,3.9846620466140236e-5,2.1528562534707792e-8,-0.0012179574526165029,4.004903399140244e-5,2.165570613461297e-8,-0.0012178040605647724,4.0179078031285165e-5,2.1737684879836926e-8,-0.001217669467291421,4.021348370120589e-5,2.1761144819940345e-8,-0.0012175131332450237,4.014272182328031e-5,2.1721351070588032e-8,-0.001217289990042325,3.997662689165655e-5,2.162532349147562e-8,-0.0012169585457825218,3.9749007528304005e-5,2.1494297600574853e-8,-0.0012164931847068905,3.9517836703297245e-5,2.136358703249228e-8,-0.0012158983378917096,3.9356329110915773e-5,2.1277115324960004e-8,-0.0012152176438466392,3.9332104759699913E-05,2.127493647531436e-8,-0.001214528479586985,3.947928991470707e-5,2.1376600643727462e-8,-0.0012139177363669367,3.9778311663362115e-5,2.1569180758206194e-8,-0.0012134484162272517,4.015900048914238e-5,2.180933946924029e-8,-0.0012131363021741985,4.052837642935356e-5,2.2040280902569133e-8,-0.0012129497831343294,4.080665261167639e-5,2.2213672818770073e-8,-0.0012128291159121656,4.095125233841926e-5,2.230428148992462e-8,-0.001212710628911282,4.096082546243361e-5,2.2312340353820234e-8,-0.0012125440419645064,4.0864936103992574e-5,2.2257017392004202e-8,-0.0012122998065612566,4.070927702557695e-5,2.2167052698862267e-8,-0.001211969092054254,4.054291261138361e-5,2.207270204179144e-8,-0.0012115601294701622,4.04096307802744e-5,2.2000393390250897e-8,-0.0012110935055385707,4.034290695442932e-5,2.1969806882960636e-8,-0.001210597514896922,4.0363263803066746e-5,2.1992540281281542e-8,-0.001210103734529621,4.047720018381726e-5,2.2071717239761007e-8,-0.0012096427900898502,4.0677387217859966e-5,2.22022573473533e-8,-0.0012092403935229314,4.094407090176532e-5,2.237175494917936e-8,-0.0012089138646246408,4.124773087837309e-5,2.2562054742508997e-8,-0.001208669509931094,4.155294488543246e-5,2.2751575294808985e-8,-0.0012085012343950414,4.1823087158483395e-5,2.2918206290301382e-8,-0.0012083905541689021,4.20253509279023e-5,2.304245225579731e-8,-0.0012083080279941285,4.213570362400274e-5,2.3110503419034456e-8,-0.0012082161114372763,4.2143459888724324e-5,2.3116949841108062e-8,-0.0012080735324706796,4.2055159230597596e-5,2.3066900585552403e-8,-0.001207841533426535,4.189723091537656e-5,2.297724001603263e-8,-0.0012074923383279116,4.171613868549196e-5,2.2876363669851336e-8,-0.001207019283053891,4.157362669411139e-5,2.2801120538061767e-8,-0.0012064459189305014,4.1534493783767346e-5,2.2789521758592166e-8,-0.0012058286024298984,4.164656524482071e-5,2.2869009240234377e-8,-0.0012052460554162017,4.19184087749905e-5,2.3043477200400544e-8,-0.0012047743940046401,4.2307229374438395e-5,2.3286316882609802e-8,-0.0012044572585227797,4.272895499439604e-5,2.3546579750409415e-8,-0.001204288381331058,4.308962693418823e-5,2.376779519103741e-8,-0.0012042176630236775,4.332107815521141e-5,2.390938507508682e-8,-0.0012041753802073372,4.340093341660907e-5,2.3958706867713977e-8,-0.00120409843142815,4.335014281596996e-5,2.3929491995290315e-8,-0.0012039461046134032,4.3216266495513626e-5,2.3851510393422998e-8,-0.0012037033879847602,4.305483536435831e-5,2.3758982441867673e-8,-0.001203376539335363,4.291599030590616e-5,2.368228317218689e-8,-0.00120298613557427,4.283755592078561e-5,2.364376268900528e-8,-0.00120256066507784,4.2842730196850536e-5,2.365655954004364e-8,-0.0012021315896690958,4.29401323049733e-5,2.3724918753893763e-8,-0.0012017295357681474,4.3124764351869256e-5,2.384500705422323e-8,-0.0012013810188355309,4.3379445958178134e-5,2.400589014719376e-8,-0.0012011053959982453,4.367684303151363e-5,2.4190760318183176e-8,-0.0012009120711434845,4.3982426851927915e-5,2.4378686124360526e-8,-0.001200798320179096,4.4258666524398955e-5,2.4547135559008024e-8,-0.0012007483813156155,4.447035815567847e-5,2.4675237441635286e-8,-0.0012007344048218429,4.45904789956841e-5,2.4747373111654414e-8,-0.0012007195396916456,4.4605667043112055E-05,2.475647427648304e-8,-0.0012006630679124704,4.4520319606676825e-5,2.4706349244549025e-8,-0.0012005271433299393,4.435834252862902e-5,2.4612444809990292e-8,-0.0012002844344340745,4.416178423355356e-5,2.450065938028214e-8,-0.0011999257549066937,4.39856842762662e-5,2.4403951995426074e-8,-0.0011994662184232547,4.3888471317910234e-5,2.435650342589999e-8,-0.001198947460842372,4.3917923813857226e-5,2.43855173915342e-8,-0.001198432684587654,4.409482178445086e-5,2.4501884310528832e-8,-0.0011979921332492878,4.43998509534339e-5,2.469284335350204e-8,-0.00119768078598594,4.4772044938470945e-5,2.492136091235081e-8,-0.0011975168459692923,4.512476493318901e-5,2.5135693210741254e-8,-0.00119747326559844,4.53756385533257e-5,2.528710231716238e-8,-0.0011974888649364393,4.547604253094459e-5,2.5347319618533324e-8,-0.0011974930862349044,4.542451975687877e-5,2.5316491092253453e-8,-0.0011974302262546881,4.525952548655604e-5,2.5218719541367353e-8,-0.0011972721728209824,4.5039793706352555e-5,2.509006550443868e-8,-0.0011970183063790395,4.48245155389913e-5,2.4966396418741908e-8,-0.001196687932279745,4.4660550904328974e-5,2.487559033145641e-8,-0.0011963111623788396,4.457738285834904e-5,2.4834604037411308e-8,-0.0011959215436754737,4.45871920184613e-5,2.4849769736576936e-8,-0.0011955511692190652,4.468712727908596e-5,2.4918432734679642e-8,-0.0011952275920148667,4.486193679281758e-5,2.5030717037665653e-8,-0.001194971551310585,4.508639373150898e-5,2.5171047327290172e-8,-0.001194794863314542,4.5327777567539424e-5,2.5319623085596163e-8,-0.001194698341899172,4.554901617532855e-5,2.5454274898017947e-8,-0.0011946701458042791,4.5713081220382614e-5,2.555310251854561e-8,-0.0011946854231435274,4.5788787339589856e-5,2.5597980508971714e-8,-0.0011947082714650892,4.575734391539159e-5,2.5578493326096783e-8,-0.0011946966519119835,4.561819225984636e-5,2.5495358009355167e-8,-0.0011946100335258174,4.539218001394653e-5,2.536213072497259e-8,-0.0011944184455051122,4.512031317912244e-5,2.5204163446924352e-8,-0.0011941107653257608,4.485734384224478e-5,2.5054453515492776e-8,-0.0011936999083235803,4.466088478508766e-5,2.4946937452023213e-8,-0.0011932230592092813,4.457796164782929e-5,2.4908499047797812e-8,-0.001192735881163747,4.463180004644925e-5,2.4951402925395812e-8,-0.0011923007264965835,4.481237616870531e-5,2.506816181625162e-8,-0.001191970530689217,4.507461064861558e-5,2.523093820360962e-8,-0.0011917724140860335,4.5347229185161454e-5,2.5397066980609755e-8,-0.0011916972032087528,4.5552150560644986e-5,2.552053976524705e-8,-0.0011917008223672682,4.5628853227269786e-5,2.55662585680403e-8,-0.001191718836140086,4.55536438037028e-5,2.5521241678494558e-8,-0.0011916882079971906,4.534483429463704e-5,2.5397506076360736e-8,-0.0011915661764232738,4.50523352358896e-5,2.52256885925892e-8,-0.0011913387387294007,4.47385355732246e-5,2.504346293478613e-8,-0.0011910180546011024,4.446011631860293e-5,2.4884567965759092e-8,-0.0011906333941084394,4.425692301702829e-5,2.4772196056940904e-8,-0.0011902211184680275,4.414860982271032e-5,2.4717178867113547e-8,-0.0011898169790774708,4.4136455261757274e-5,2.4719329452121577e-8,-0.0011894514485054754,4.4207250005153805e-5,2.4769977404092045e-8,-0.0011891472970888017,4.43372203473938e-5,2.4854416724191735e-8,-0.0011889182539292847,4.449528806773453e-5,2.4953861754942293e-8,-0.0011887678749798924,4.464592966057503e-5,2.504712463555681e-8,-0.0011886883030289687,4.4752380198887884e-5,2.5112510632544797e-8,-0.0011886592771498138,4.478098874931083e-5,2.5130424449580425e-8,-0.0011886483992062577,4.4707117457076194e-5,2.5086889829383304e-8,-0.0011886140329250244,4.4522010180780784e-5,2.4977592415005244e-8,-0.0011885119078034235,4.4238713784012066e-5,2.4811273251672534e-8,-0.0011883051844906306,4.3894051675223444e-5,2.461069041472246e-8,-0.0011879756183442926,4.354386275480496e-5,2.4409531085824178e-8,-0.0011875317045031677,4.3250911754683235e-5,2.4244998266980886e-8,-0.001187009814984017,4.306830808202916e-5,2.4147865942933328e-8,-0.0011864667588603476,4.302388062774488e-5,2.4133330210664937e-8,-0.0011859656180111609,4.3111034611001064e-5,2.4195943412766552e-8,-0.0011855592107146609,4.328925296709795e-5,2.4310387221332328e-8,-0.0011852761111206852,4.349413359054941e-5,2.443782423047731e-8,-0.0011851131455521931,4.3654131747047644e-5,2.4535986395746288e-8,-0.0011850365116463047,4.370946428713365e-5,2.4570271546609728e-8,-0.0011849914632903148,4.362784368851426e-5,2.4522773768495008e-8,-0.001184917896100419,4.341215487751708e-5,2.43964861556252e-8,-0.0011847668283073867,4.3097519747167916e-5,2.4213256739576758e-8,-0.001184512183165127,4.273915270154866e-5,2.400637699709233e-8,-0.001184154359433377,4.239606712181469e-5,2.381082880477647e-8,-0.001183715829325232,4.211673537541401e-5,2.3654834718410355e-8,-0.001183232091457753,4.193072848064575e-5,2.355508585492585e-8,-0.001182742076052658,4.184692919527811e-5,2.351593181722576e-8,-0.001182280783554334,4.185637277082278e-5,2.3531280291149167e-8,-0.0011818749650736491,4.193705913158789e-5,2.3587563717348847e-8,-0.0011815412371566454,4.20587459208501e-5,2.3666591547139997e-8,-0.001181285518418681,4.218688550045602e-5,2.374784651401943e-8,-0.0011811028444095974,4.2285853886151184e-5,2.381037385561812e-8,-0.001180977123076948,4.232217251513254e-5,2.3834703066651765e-8,-0.0011808810539391222,4.2268560697046846e-5,2.3805269882627502e-8,-0.0011807771612472478,4.2109361969074505e-5,2.3713602572318883e-8,-0.0011806214602274067,4.1846957049957275e-5,2.356200196449372e-8,-0.0011803711677501327,4.150714518977967e-5,2.3366529209186637e-8,-0.0011799963986054275,4.113978509884284e-5,2.3157162420999488e-8,-0.0011794927933482826,4.08108363408142e-5,2.2972909369344754e-8,-0.0011788890049142986,4.058504354233647e-5,2.2851491515976213e-8,-0.0011782430294203484,4.050438512482597e-5,2.2816671906510717e-8,-0.0011776263052778516,4.0571991173592686e-5,2.2868981508891815e-8,-0.0011771016155169122,4.074982996867079e-5,2.2984703383283737e-8,-0.0011767044632477951,4.097122380197114e-5,2.3123630234264177e-8,-0.0011764349839248737,4.1161829736862925e-5,2.3241707139593455e-8,-0.0011762614801303043,4.1260299791107996e-5,2.330328303434297e-8,-0.0011761320404088328,4.1232336783918625e-5,2.328924297558214e-8,-0.0011759893133244327,4.1075838938516295e-5,2.3199711124094704e-8,-0.0011757842580515552,4.081779203779472e-5,2.3051819147004552e-8,-0.001175486057786376,4.050513963720658e-5,2.2873984543674025e-8,-0.0011750866908770193,4.0192525827399625e-5,2.2698514425147638e-8,-0.0011745998913217442,3.9930000443378806e-5,2.2554401861589946e-8,-0.0011740555181366963,3.975350915748105e-5,2.2461942074838184e-8,-0.0011734914447389271,3.967996159531561e-5,2.2430123462058758e-8,-0.001172945410878914,3.970705295686038e-5,2.245677720924922e-8,-0.0011724486794790487,3.981662159239835e-5,2.2530685939862905e-8,-0.0011720222605774908,3.997974255206267e-5,2.263458529327139e-8,-0.0011716754580197422,4.0161947727554296e-5,2.274816904236688e-8,-0.0011714059108263474,4.032766224367516e-5,2.285064391621753e-8,-0.0011712002787532773,4.044378850159482e-5,2.2922839703133115e-8,-0.001171035100466492,4.048293650443117e-5,2.2949153547451752e-8,-0.0011708778846540614,4.042697766162125e-5,2.2919658210313572e-8,-0.0011706891457959967,4.0271429475899425e-5,2.2832600750891778e-8,-0.001170426728995793,4.0030416719605716e-5,2.269711830719015e-8,-0.0011700538042031948,3.9740414742010276e-5,2.253517245414926e-8,-0.0011695506069301434,3.945916078722506e-5,2.2380689483545792e-8,-0.0011689268944945577,3.9255517922141815e-5,2.227353935744273e-8,-0.001168228173677312,3.918909798715985e-5,2.224769728531718e-8,-0.0011675279781217165,3.9285907063139966e-5,2.2317220439852915e-8,-0.0011669049542857158,3.952322670802093e-5,2.24676871654407e-8,-0.0011664145207980038,3.9834885125080155e-5,2.265953681114611e-8,-0.001166070295452867,4.013563731944959e-5,2.2842517129925196e-8,-0.0011658440641923867,4.035108613749354e-5,2.2973299450432576e-8,-0.0011656808972777184,4.043846993678506e-5,2.302764914878378e-8,-0.0011655191438936243,4.039246802510346e-5,2.300366653105076e-8,-0.0011653067613803536,4.023909875147127e-5,2.291788321046429e-8,-0.001165010689103841,4.002390781978695e-5,2.2797942341975254e-8,-0.0011646197556137458,3.979940906101893e-5,2.2674938420648966e-8,-0.0011641429633779334,3.961443280877213e-5,2.2577103601577477e-8,-0.0011636049134929856,3.950632417993853e-5,2.252541402741315e-8,-0.0011630396411959254,3.9496218494349576e-5,2.253115281543781e-8,-0.001162483900516477,3.95874667786907e-5,2.2595320378682432e-8,-0.0011619709327954436,3.976699600781008e-5,2.2709638135691125e-8,-0.0011615255979191684,4.000893838449559e-5,2.2858712233979922e-8,-0.0011611613858706039,4.0279582776409567e-5,2.3022849008527116e-8,-0.001160879376169587,4.054263299169933e-5,2.3181024514051384e-8,-0.0011606687592218374,4.076394687408465e-5,2.3313608208272293e-8,-0.0011605083240079387,4.09154288041749e-5,2.3404666156265128e-8,-0.00116036847554564,4.097823517679709e-5,2.34438834621506e-8,-0.0011602136824594566,4.0945659648512586e-5,2.3428227761797474e-8,-0.0011600057215318002,4.0826012397539306e-5,2.3363471925632195e-8,-0.0011597086232655231,4.0645264473458956e-5,2.326545539839303e-8,-0.0011592962457193116,4.0447999006798314e-5,2.3160337368834338e-8,-0.00115876229853727,4.0293821820255384e-5,2.3082332980724006e-8,-0.0011581301558147067,4.0245920350732926e-5,2.3067127381392428e-8,-0.0011574563121098651,4.035081622828792e-5,2.3140425634618856e-8,-0.0011568199270357543,4.061526212816023e-5,2.3304961265381497e-8,-0.0011562968471505665,4.099409631845051e-5,2.353376588241085e-8,-0.0011559290458727804,4.140161770840252e-5,2.3776854904296303e-8,-0.0011557078806939019,4.1744238983237644e-5,2.3980097768470524e-8,-0.0011555814912751524,4.195588110422897e-5,2.4105697188319998E-08,-0.001155479481195814,4.201658493401853e-5,2.4142985129680127e-8,-0.00115533863075793,4.194919447273282e-5,2.4106395513946268e-8,-0.0011551182129401877,4.1802901903976074e-5,2.4025610864818883e-8,-0.0011548035981328402,4.163510488935334e-5,2.3934641492285587e-8,-0.0011544024679921467,4.149790402491649e-5,2.3863731188845464e-8,-0.0011539381598193543,4.143037373269924e-5,2.3834886083816383e-8,-0.0011534428504190312,4.145529592249755e-5,2.3860242372633465e-8,-0.0011529515734318722,4.157867605802834e-5,2.3942156152824156e-8,-0.001152497126030711,4.17910018793201e-5,2.407424330087287e-8,-0.00115210581430915,4.2069853360416185e-5,2.4243037050196697e-8,-0.001151794185245135,4.238365328686831e-5,2.4430139497299415e-8,-0.0011515669930675036,4.269628302794372e-5,2.461478437537122e-8,-0.0011514166348674099,4.2972125399724006e-5,2.4776661433350763e-8,-0.0011513241096236361,4.318091082678523e-5,2.4898702175336794e-8,-0.0011512612721551612,4.330181717597658e-5,2.496949457208967e-8,-0.001151194039557355,4.332656629776271e-5,2.4985098203453446e-8,-0.0011510862887999457,4.326145348232724e-5,2.4950132422663092e-8,-0.0011509043845628019,4.312830423117919e-5,2.4878096818187747e-8,-0.0011506225888506414,4.296414251839801e-5,2.4790856099194497e-8,-0.0011502295873348479,4.281860836006933e-5,2.4716871495239724e-8,-0.0011497354598191344,4.27473669523015e-5,2.4687324428481763e-8,-0.0011491767132249047,4.27998987093043e-5,2.4729297172923822e-8,-0.0011486149745644995,4.300208635109734e-5,2.4856210146960896e-8,-0.0011481242788471762,4.333890754543513e-5,2.505836780419132e-8,-0.0011477663805973333,4.37484335258334e-5,2.529978271595454e-8,-0.0011475638693054652,4.413754488074797e-5,2.552713565537854e-8,-0.0011474880690233208,4.441675095791563e-5,2.5689536506059154e-8,-0.0011474716437174161,4.4535329714636256e-5,2.5758576446798924e-8,-0.0011474381423005444,4.4496153607781065e-5,2.573686319342581e-8,-0.0011473298248947472,4.434525522139947e-5,2.5651963688180006e-8,-0.0011471206519927625,4.4148021131686344e-5,2.5542431090685233e-8,-0.0011468143867924144,4.396712744434881e-5,2.5444745012451112e-8,-0.001146435178096694,4.384958556407789e-5,2.538566338712817e-8,-0.0011460173053052653,4.382244135856911e-5,2.537984964690841e-8,-0.0011455972066733823,4.389369052636168e-5,2.543072424927479e-8,-0.001145208205189756,4.4055310810386594e-5,2.553258147049571e-8,-0.0011448771116926027,4.4286732802865605e-5,2.5672846892049696e-8,-0.001144621838537778,4.455834866317327e-5,2.5834176207532318e-8,-0.0011444496596464482,4.483524010238264e-5,2.5996533958276677e-8,-0.0011443561757723407,4.508136367107901e-5,2.6139484084071172e-8,-0.001144325302176957,4.526422796836885e-5,2.624479996609313e-8,-0.0011443306796744088,4.5359678801102835e-5,2.629920696942144e-8,-0.001144338684074093,4.535607232962796e-5,2.6296805202445227e-8,-0.0011443128443530714,4.525711697688811e-5,2.6240674007741413e-8,-0.0011442192204715602,4.5082805045375516e-5,2.6143256225398415e-8,-0.0011440321422607781,4.4868033997148654e-5,2.6025290536327584e-8,-0.0011437397009143968,4.465876200865301e-5,2.5913293776335838e-8,-0.0011433483936894827,4.450556201387472e-5,2.5835666573269417e-8,-0.0011428859132346458,4.4454301330230345e-5,2.5817407374967364e-8,-0.0011424002463549068,4.4534205124580296e-5,2.587362598157788e-8,-0.0011419527122034946,4.474530750720313e-5,2.600289980431649e-8,-0.0011416033368196802,4.505002810376823e-5,2.618294554588382e-8,-0.001141390428908636,4.5375931822066494e-5,2.6372385764556846e-8,-0.0011413123883100827,4.5634818511907473e-5,2.6521473534591453e-8,-0.001141323589395823,4.5754058078499044e-5,2.6589641295518906e-8,-0.0011413505127724332,4.570482861131677e-5,2.65614039044391e-8,-0.0011413207093381398,4.5510745451041515e-5,2.6451239643199213e-8,-0.001141188094617734,4.523323032317512e-5,2.6295158823665544e-8,-0.0011409425267060696,4.494512245552072e-5,2.613539055975473e-8,-0.0011406039242835295,4.470782444666231e-5,2.6007055239340012e-8,-0.001140209199720666,4.455976514490526e-5,2.5931497221064563e-8,-0.0011397998215520568,4.451513360626569e-5,2.591575701768682e-8,-0.001139413450043509,4.456814837601221e-5,2.595536246540539e-8,-0.0011390795966643849,4.469876670368622e-5,2.60379203690528e-8,-0.0011388178217883774,4.487777100093782e-5,2.614620234117578e-8,-0.001138637029323737,4.507087406977781e-5,2.6260499784491232e-8,-0.0011385351171898522,4.524231213375679e-5,2.636058011508952e-8,-0.001138498908997064,4.5358536475447353e-5,2.6427687830903223e-8,-0.001138504742717813,4.539239795883406e-5,2.6446876610957435e-8,-0.0011385203577618363,4.5327686077719404e-5,2.6409596426616204e-8,-0.001138508626476679,4.5163215308385346e-5,2.6316020938140107e-8,-0.001138433164520453,4.491524922861346e-5,2.617635271007851e-8,-0.0011382651611644248,4.461705208805853e-5,2.60103768433134e-8,-0.0011379901212315725,4.431475914112068e-5,2.5844832363761734e-8,-0.0011376128472153897,4.405962607495448e-5,2.5708742448517676e-8,-0.0011371591432191399,4.38977377850055e-5,2.5627459120037902e-8,-0.0011366732292220137,4.385892899825392e-5,2.561652405049774e-8,-0.0011362103950232623,4.394710877414942e-5,2.5676581411835278e-8,-0.0011358251542952108,4.413475261191414e-5,2.5790765942044402e-8,-0.0011355565320898134,4.436471443508226e-5,2.5926126309661128e-8,-0.0011354142388612493,4.456177182242592e-5,2.6040272006294392e-8,-0.0011353715564004837,4.4653360616528623e-5,2.6092925147649926e-8,-0.0011353705510015804,4.459362909579968e-5,2.605922322764486e-8,-0.0011353404038372476,4.4380227560943225e-5,2.5938971302698022e-8,-0.0011352217466509087,4.405454262243014e-5,2.5756616732937143e-8,-0.0011349852948189293,4.368490247039827e-5,2.5551578991552723e-8,-0.0011346366674042077,4.334216194977203e-5,2.5364227495662016e-8,-0.001134208126523297,4.307971922662928e-5,2.5224447033233243e-8,-0.0011337443916172296,4.292448780803408e-5,2.5146609857361533e-8,-0.0011332897864486306,4.287791196077834e-5,2.5130427988720302e-8,-0.0011328801743606684,4.292232941936807e-5,2.5164886702881576e-8,-0.0011325395437544183,4.302832693352377e-5,2.5232645329543546e-8,-0.0011322795036267984,4.316082969546979e-5,2.5313558114926845e-8,-0.0011320999644248192,4.328354167402069e-5,2.538712994851353e-8,-0.0011319900022255828,4.336233306022805e-5,2.5434328063291953e-8,-0.0011319286947636842,4.336840808418778e-5,2.5439298179225213e-8,-0.0011318863330729578,4.328188187579225e-5,2.5391365668682646e-8,-0.001131826798984989,4.309582777844892e-5,2.5287327028303578e-8,-0.0011317119237820342,4.282000536402383e-5,2.513352362103692e-8,-0.0011315081184450266,4.248267021715128e-5,2.4946745756693704e-8,-0.0011311944679122136,4.212855215251888e-5,2.47528810798855e-8,-0.001130770145740669,4.181171313272162e-5,2.458263730132284e-8,-0.0011302581872849279,4.158375073838242e-5,2.446470685820663e-8,-0.0011297031604086858,4.1480108144529596e-5,2.4418045723061402e-8,-0.001129162188693781,4.15087736209508e-5,2.4445738038119535e-8,-0.001128691235841923,4.164541695493883e-5,2.453267453652789e-8,-0.0011283303644603515,4.1837167858544846e-5,2.464812593336712e-8,-0.0011280922029762194,4.201470996660632e-5,2.4752841228200912e-8,-0.0011279572033331556,4.2109977185660934e-5,2.480903447905591e-8,-0.0011278777807429035,4.2074869072542864e-5,2.4790706388729773e-8,-0.0011277911058960631,4.189530837193729e-5,2.4691226160505966e-8,-0.0011276372138476932,4.15954194176583e-5,2.4525357679971217e-8,-0.0011273763094417542,4.1229584247699144e-5,2.4324526909304625e-8,-0.0011269987883137111,4.0865150594873515e-5,2.4126913313744505e-8,-0.0011265246487921932,4.056282496645149e-5,2.396636013648397e-8,-0.0011259939870450367,4.0362229990203176e-5,2.3864352719984643e-8,-0.0011254538280006646,4.027651035222083e-5,2.3827236887481313e-8,-0.0011249466443459084,4.029509964658356e-5,2.3848081936514294e-8,-0.0011245033782163948,4.0390924133027086e-5,2.3910968573532058e-8,-0.0011241409403492657,4.052829514471608e-5,2.3995517170635476e-8,-0.00112386263638038,4.066934213518109e-5,2.4080458369857855e-8,-0.001123659844043524,4.077852227744454e-5,2.4146059818045725e-8,-0.0011235138537491161,4.082575535334954e-5,2.417579891950277e-8,-0.0011233975399612892,4.078906093563617e-5,2.4157813543967808e-8,-0.0011232772130354719,4.065741806846923e-5,2.4086515680471002e-8,-0.0011231154772805123,4.043402590037051e-5,2.3964410167377178e-8,-0.0011228760409062776,4.0139252991621545e-5,2.380366568263808e-8,-0.0011225309508780508,3.9811507466245704e-5,2.362643573893063e-8,-0.0011220694021852218,3.9503593998477884e-5,2.3462607402847364e-8,-0.0011215052868612503,3.927276808058977e-5,2.334405693151438e-8,-0.0011208791815421717,3.916532907922445e-5,2.32959719470691e-8,-0.0011202512996662164,3.9200465609938846e-5,2.332793726446843e-8,-0.001119685750452599,3.936055511280073e-5,2.3428801926640012e-8,-0.0011192313624241938,3.959351310628623e-5,2.3568365483427852e-8,-0.0011189067970222813,3.982728786145331e-5,2.370580293829856e-8,-0.0011186957125675833,3.9990849821071303e-5,2.380156013682102e-8,-0.0011185529359586416,4.003380335406222e-5,2.382827657042045e-8,-0.0011184183604654927,3.9938559297950844e-5,2.3777363910180102e-8,-0.0011182335261142832,3.972257873820071e-5,2.365991178424167e-8,-0.0011179561348970367,3.943138742499119e-5,2.3502406776038373e-8,-0.0011175690250342211,3.9125231705559594e-5,2.333898219278873e-8,-0.0011170818909624026,3.8863484851492184e-5,2.3202592856615218e-8,-0.0011165261146400343,3.869113689297805e-5,2.3117576365828163e-8,-0.0011159450191786187,3.863070018781825e-5,2.309541688994295e-8,-0.001115382950846316,3.8680782729081375e-5,2.3134291481037248e-8,-0.0011148763323054643,3.88202433349568e-5,2.3221657136516122e-8,-0.0011144484116093652,3.9015366788503146e-5,2.333836405534532e-8,-0.0011141077300649053,3.922741200952648e-5,2.3462821981382622e-8,-0.0011138492060015412,3.941880989590515e-5,2.357433208540127e-8,-0.0011136564631223104,3.955748183796071e-5,2.3655382121537695e-8,-0.001113504398766395,3.961966181875024e-5,2.3693174947865333e-8,-0.0011133616119702572,3.9591985478981636e-5,2.3680806672121074e-8,-0.0011131929173312004,3.9473502927766754e-5,2.3618399758240768e-8,-0.001112962646214551,3.927781992830418e-5,2.3514237054040706e-8,-0.0011126396430199091,3.903476453581059e-5,2.338553477815076e-8,-0.0011122044622860591,3.878987372235069e-5,2.325794563447264e-8,-0.0011116579050496058,3.859916050478475e-5,2.3162471082326266e-8,-0.0011110277638066819,3.8517161490373446e-5,2.3128770665243614e-8,-0.0011103686318442126,3.857932217863279e-5,2.317550345585091e-8,-0.0011097504345893342,3.878498007287958e-5,2.3301147042226735e-8,-0.0011092368658773112,3.909083067031221e-5,2.348067606937274e-8,-0.001108862561025627,3.9421677057301995e-5,2.3671766690779e-8,-0.0011086207894536008,3.969541345367182e-5,2.3828789988108746e-8,-0.001108467784835197,3.9850203582443234e-5,2.3917930158623212e-8,-0.0011083400223898265,3.986149013467848e-5,2.3926558339224554e-8,-0.0011081749835332257,3.9744019406875444e-5,2.3864144977322292e-8,-0.0011079272311021648,3.954206227866765e-5,2.3756473773474773e-8,-0.0011075764036130426,3.9314276041815806e-5,2.3636846724881514e-8,-0.0011071276513506274,3.911872082508301e-5,2.353751460723729e-8,-0.001106606712234522,3.9001210256697606e-5,2.3483218868648787e-8,-0.0011060519911277476,3.8988244203939216e-5,2.3487531140898155e-8,-0.001105505670300844,3.908468395961993e-5,2.3551953376769463e-8,-0.001105005565791467,3.927568764132802e-5,2.3667339954019526e-8,-0.0011045790708096976,3.9531788880221474e-5,2.3816896490402398e-8,-0.0011042398847317478,3.9815546406795756e-5,2.397985579796228e-8,-0.0011039874767033147,4.008822786866677e-5,2.413504494817365e-8,-0.0011038086569949937,4.031539899273079e-5,2.4263827315283715e-8,-0.0011036803427045844,4.047087645509333e-5,2.4352204679952328e-8,-0.0011035726966564098,4.053916604625667e-5,2.4392162684179795e-8,-0.0011034522434320714,4.051692930416066e-5,2.438250815301555e-8,-0.0011032850399023103,4.041397991610771e-5,2.4329393420554233e-8,-0.0011030403485004744,4.0253960514007384e-5,2.424655679752155e-8,-0.001102695483905325,4.0074227905403326e-5,2.415503580398189e-8,-0.001102242193580227,3.992352368685253e-5,2.4081660659305638e-8,-0.0011016936673696796,3.985525563697915e-5,2.4055253488353385e-8,-0.0011010891641663526,3.991473667135059e-5,2.409971221190807e-8,-0.0011004912378463276,4.012168328025906e-5,2.422468321626409e-8,-0.0010999711538006204,4.045477360482803e-5,2.4417430252093232e-8,-0.0010995842055226655,4.084938248726866e-5,2.4641830821643385e-8,-0.0010993460929871167,4.121581701041971e-5,2.484844677700392e-8,-0.0010992250658169746,4.1472215284716905e-5,2.4992557013455944e-8,-0.0010991556460179283,4.1574464276116506e-5,2.505058969589844e-8,-0.0010990652089385281,4.1527398961356164e-5,2.5026265284520233e-8,-0.001098898156768374,4.1375312448001e-5,2.4945200752454744e-8,-0.0010986280334354423,4.118167475058328e-5,2.484337320183111e-8,-0.0010982574815838655,4.100937470290851e-5,2.4755843824772127e-8,-0.0010978110406426043,4.090738485072404e-5,2.4709226856153248e-8,-0.0010973257121964122,4.0904499228446404e-5,2.471836767874099e-8,-0.0010968421791160742,4.10083665738254e-5,2.4786177550209052e-8,-0.0010963977347210852,4.120779805968306e-5,2.4905329142025246e-8,-0.0010960210677344888,4.147702335351955e-5,2.506090255556026e-8,-0.0010957289251758702,4.178110279291195e-5,2.5233456325869303e-8,-0.001095524697387541,4.2081778366454555e-5,2.540215364575196e-8,-0.0010953988246681838,4.2343079153780506e-5,2.5547670181248777e-8,-0.0010953307583887954,4.253610901231246e-5,2.5654681311269465e-8,-0.0010952920447938042,4.264254236325311e-5,2.571372890267199e-8,-0.0010952499739452775,4.2656633559821643e-5,2.5722338660353446e-8,-0.0010951713587064734,4.2585944785351156e-5,2.5685421940828945e-8,-0.0010950263137780906,4.245110365085979e-5,2.5615053368196092e-8,-0.001094792159453469,4.2284683294743016e-5,2.5529653777638224e-8,-0.0010944577225138132,4.212890345796607e-5,2.5452477208888395e-8,-0.0010940280855575993,4.2031223829935575e-5,2.5409021613321293e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_5.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_5.json deleted file mode 100644 index 7f82b459..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_5.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":5000,"numberOfSamples":1000,"samples":[-0.001093528836966317,4.203642676149489e-5,2.5422725793163846e-8,-0.0010930072646208094,4.217440867148639e-5,2.5508574660559997e-8,-0.0010925265640548522,4.2445448281040656e-5,2.566549440168746e-8,-0.0010921498584701538,4.280927315836898e-5,2.5870776828536737e-8,-0.0010919163003251823,4.318794211770871e-5,2.6081780444674054e-8,-0.001091820523294629,4.348883154959585e-5,2.624831762871915e-8,-0.00109181029138295,4.364045659227296e-5,2.6331989440280285e-8,-0.0010918072934319603,4.362110831307491e-5,2.6321766949888615e-8,-0.0010917391971531742,4.346321105608486e-5,2.6236404835428295e-8,-0.0010915640090047574,4.323393624900339e-5,2.611370862534541e-8,-0.0010912766199280236,4.3007345034387695e-5,2.599493426705449e-8,-0.0010909009016498547,4.284299979150903e-5,2.5912727223068096e-8,-0.001090476431342811,4.277625215835485e-5,2.5885719367964947e-8,-0.0010900465218413144,4.2817753215300766e-5,2.5918503099339365e-8,-0.0010896499951765957,4.2957752709860237e-5,2.6004412180594708e-8,-0.0010893164869373976,4.3171842376795946e-5,2.612906955898042e-8,-0.0010890641035068592,4.34265580743787e-5,2.6273675178051805e-8,-0.0010888984776027527,4.3684563677071033e-5,2.6417842719480934e-8,-0.0010888129019089097,4.3909513777838174e-5,2.65421057988998e-8,-0.0010887895341848287,4.407054827337014e-5,2.663018859077577e-8,-0.0010888016920848876,4.4146217427231046e-5,2.667102788931276e-8,-0.001088817192482838,4.4127450376416946e-5,2.6660363442769395e-8,-0.0010888024752733671,4.401909753500576e-5,2.6601590837686793e-8,-0.0010887270459753056,4.383981898364833e-5,2.65056658451493e-8,-0.0010885677996571497,4.362036647066958e-5,2.639002532249307e-8,-0.0010883129235325867,4.3400346577718806e-5,2.627658759927833e-8,-0.0010879651578661836,4.322346930498476e-5,2.6188934255361087e-8,-0.001087544097987234,4.313109216854214e-5,2.6148709458164907e-8,-0.001087086674855694,4.315374123594729e-5,2.617116796712862e-8,-0.001086644066498112,4.330094126455337e-5,2.6260046435218025e-8,-0.0010862728381159504,4.3551620609182124e-5,2.640284239026193e-8,-0.00108601928226965,4.38502022017017e-5,2.656903579292576e-8,-0.0010859001135970722,4.411523709589743e-5,2.6714781887700585e-8,-0.0010858889754997796,4.426383145393484e-5,2.6795876138844725e-8,-0.0010859203351680025,4.424423453619814e-5,2.6785128110422738e-8,-0.001085913618912209,4.4058578601592776e-5,2.668460538734044e-8,-0.001085805393800295,4.376072785978275e-5,2.6524487039470494e-8,-0.0010855708545136362,4.343117507166159e-5,2.6349304657863846e-8,-0.0010852250584937636,4.314592290426317e-5,2.620071963961655e-8,-0.0010848090868554553,4.295570916633156e-5,2.6105975798650347e-8,-0.001084372654611788,4.2880291469861494e-5,2.6074830737518084e-8,-0.0010839610398885847,4.291308032542563e-5,2.6102403255115617e-8,-0.0010836081790852113,4.302959653013973e-5,2.6174200961517643e-8,-0.0010833344520610171,4.3195574161869046e-5,2.6270850944433867e-8,-0.001083146945167361,4.3373198164366636e-5,2.637160337223827e-8,-0.0010830405767407777,4.352569954505452e-5,2.645674242392391e-8,-0.0010829995124754573,4.3621083270509026e-5,2.6509425138913995e-8,-0.001082998991414148,4.363548696163819e-5,2.6517334874121295e-8,-0.0010830078695757855,4.3556232067080865e-5,2.6474252100274967e-8,-0.0010829921546684827,4.338421730365343e-5,2.638134536379059e-8,-0.0010829195457739626,4.313495597945831e-5,2.6247737743075178e-8,-0.0010827645199852117,4.2837568459182473e-5,2.6089894868217516e-8,-0.0010825131481838203,4.2531405839397756e-5,2.5929625306960433e-8,-0.0010821667257754604,4.2260415291339646e-5,2.5790800121408916e-8,-0.001081743391863589,4.2065789758412284e-5,2.5695202717475755e-8,-0.0010812771260442285,4.197779093233889e-5,2.5658116797976546e-8,-0.00108081368235774,4.2007788209395396e-5,2.5684279138019833e-8,-0.0010804030553122393,4.214188129809646e-5,2.5764875776401685e-8,-0.0010800884167244415,4.2338329128859495e-5,2.5876603076949472e-8,-0.001079892778156456,4.2531881372048156e-5,2.598424858567189e-8,-0.001079807154698478,4.264767562282009e-5,2.6048107274120274e-8,-0.0010797867060579334,4.262394191909685e-5,2.6035904077434437e-8,-0.001079760973783162,4.243610779021697e-5,2.593546226975552e-8,-0.0010796577282035234,4.210950720238184e-5,2.5761387251077892e-8,-0.00107942993302375,4.171117273294466e-5,2.555057096694696e-8,-0.001079071274203828,4.132383281774707e-5,2.5348037433669575e-8,-0.001078613065447523,4.101676275871758e-5,2.5191031444188244e-8,-0.0010781076445001167,4.082789625905243e-5,2.509930154443339e-8,-0.0010776094725232313,4.076147500814069e-5,2.507401361434535e-8,-0.0010771620659250866,4.079616385676292e-5,2.5102488709573008e-8,-0.001076792527426751,4.089624684549766e-5,2.5164595184415124e-8,-0.001076511483357941,4.102115014348993e-5,2.523807558214155e-8,-0.001076315486299618,4.1131846253385905e-5,2.530198861820359e-8,-0.00107618985214185,4.1194730844247526e-5,2.533864785318205e-8,-0.0010761111699562399,4.118418519494565e-5,2.5334821170315685e-8,-0.0010760496321073894,4.1084740905426734e-5,2.5282775112651636e-8,-0.0010759717151872302,4.089317638698599e-5,2.5181368331821842e-8,-0.0010758437806077928,4.062025720268964e-5,2.5037000465379675e-8,-0.001075636874965737,4.029124488214523e-5,2.4863872287821255e-8,-0.001075332344175619,3.994403311673042e-5,2.4682887122784044e-8,-0.0010749270772761371,3.962409533524119e-5,2.4518755050929554e-8,-0.0010744366625150808,3.937631781230898e-5,2.439541151761965e-8,-0.0010738948032005251,3.92350369958662e-5,2.433057466908826e-8,-0.0010733481764564313,3.9214698025557454e-5,2.433083409288902e-8,-0.0010728472503692334,3.930384295442124e-5,2.4388737863373705e-8,-0.0010724347731497891,3.94645175457536e-5,2.44828950313044e-8,-0.0010721343835682733,3.9638151634969455e-5,2.458148402653822e-8,-0.001071942205574794,3.9757775235519326e-5,2.4648932372444277e-8,-0.001071824440490328,3.976485588304506e-5,2.4654800605721794e-8,-0.0010717234455627444,3.962693202706781e-5,2.4582909766611626e-8,-0.0010715727554048086,3.935008138551149e-5,2.4437676459267312e-8,-0.0010713175244551965,3.8979848282591754e-5,2.4244352737564492e-8,-0.0010709326265880106,3.858785169979547e-5,2.4041693976913273e-8,-0.0010704300073954966,3.8248525783302696e-5,2.386941805332488e-8,-0.0010698520086136918,3.801636200014798e-5,2.375603419291011e-8,-0.0010692550526086402,3.791333074165718e-5,2.371227592816189e-8,-0.0010686922574283954,3.792939556885814e-5,2.3731673323543086e-8,-0.0010682017404291997,3.80320722103819e-5,2.379598347049132e-8,-0.0010678024504110503,3.8178531959137147e-5,2.3881867002065674e-8,-0.001067495548138812,3.832556322890049e-5,2.3966240581430207e-8,-0.001067268273277274,3.843582509864842e-5,2.4029501058277472e-8,-0.0010670980487706369,3.848102746680633e-5,2.4057051807740725e-8,-0.0010669558863532884,3.844342728250387e-5,2.403996707058116e-8,-0.001066809160826231,3.8316803241082525e-5,2.3975457859135465e-8,-0.0010666243579828204,3.810746586828673e-5,2.386741669396789e-8,-0.0010663705574710293,3.7835149903862285e-5,2.3726898442079206e-8,-0.0010660241691441985,3.753288897009294e-5,2.3571997852970833e-8,-0.0010655747063436035,3.724442359481839e-5,2.3426335194630528e-8,-0.0010650302250668731,3.701779702157739e-5,2.331547794071486e-8,-0.0010644199291991467,3.68949742785659e-5,2.3261297539301097e-8,-0.001063791223981958,3.6899545236002384e-5,2.327544760228617e-8,-0.0010632000453968727,3.7026820203446666e-5,2.335429289972638e-8,-0.0010626963599818942,3.7241111127013385e-5,2.3477789197827204e-8,-0.0010623095681190381,3.748268981872828e-5,2.3613519575245354e-8,-0.0010620391726174265,3.768289862153553e-5,2.3724946388273585e-8,-0.0010618540779868658,3.7782581455481364e-5,2.3781234371721873e-8,-0.0010617006609737272,3.7748061352030124e-5,2.3765573920194672e-8,-0.0010615170480434892,3.758012724746697e-5,2.367965267011593e-8,-0.0010612495768359004,3.731371428715724e-5,2.3543130785882002e-8,-0.0010608669746345562,3.700835235428079e-5,2.3388256328231037e-8,-0.001060368182069979,3.6731912216637085e-5,2.325105313533104e-8,-0.0010597813426304625,3.654245594481344e-5,2.316169727120985e-8,-0.0010591544075762823,3.647402066316346e-5,2.313718174627855e-8,-0.0010585410167500333,3.653074230958909e-5,2.317853751683003e-8,-0.001057986920975386,3.669012758790272e-5,2.327290785733631e-8,-0.0010575211579176061,3.691257472653399e-5,2.339881300069309e-8,-0.001057153350837812,3.715260399430297e-5,2.3532138314401993e-8,-0.0010568758374386459,3.736812754225494e-5,2.365093104713143e-8,-0.0010566681914793606,3.752620921432137e-5,2.3738273286109503e-8,-0.0010565020401735535,3.760563844652094e-5,2.378349597906288e-8,-0.0010563451015339039,3.759754719033252e-5,2.3782437194464704e-8,-0.0010561643423562313,3.750528822528541e-5,2.3737377447389552e-8,-0.001055928777775758,3.734426906295574e-5,2.365696343832137e-8,-0.0010556126783150875,3.714173971895337e-5,2.3556054900511646e-8,-0.0010551998123746519,3.693577609363618e-5,2.3455071168099988e-8,-0.0010546886977346502,3.677200754758798e-5,2.3378106802298378e-8,-0.001054097575413405,3.66964742503015e-5,2.33490503669857e-8,-0.001053466266416154,3.674410830929957e-5,2.338552532428398e-8,-0.0010528513171096396,3.6925144473778674e-5,2.3491902560416617e-8,-0.0010523125721679219,3.721530665965493e-5,2.365441113669717e-8,-0.0010518941136466624,3.7556866487537555e-5,2.384196911473466e-8,-0.001051607652331739,3.787365765176419e-5,2.4014260649323585e-8,-0.0010514271013640408,3.809514403546298e-5,2.4134458275138142e-8,-0.001051297410707953,3.8178799703989044e-5,2.4180962088243847e-8,-0.001051153003686843,3.812136015142763e-5,2.415318391268279e-8,-0.00105093733776516,3.795628189484318e-5,2.4069945427589834e-8,-0.001050616809646753,3.7741095264425834e-5,2.396246019827039e-8,-0.0010501863481547247,3.754067586859115e-5,2.3865199592522806e-8,-0.0010496673073456411,3.7411575394765774e-5,2.380750812194908e-8,-0.0010490998191358019,3.739064048823195e-5,2.380774834712807e-8,-0.0010485322021737509,3.748944550858809e-5,2.38707245777141e-8,-0.0010480100257824426,3.769477583367159e-5,2.398835336975793e-8,-0.0010475672083879396,3.797425178348991e-5,2.4142928600404912e-8,-0.0010472208647171518,3.8285082197056416e-5,2.4311824887822292e-8,-0.0010469704046910332,3.858335909600687e-5,2.4472287017073512e-8,-0.0010468001087383734,3.883168894481607e-5,2.4605240478689e-8,-0.0010466836675630368,3.900401645641016e-5,2.469763622155349e-8,-0.0010465891449321784,3.9087623690885925e-5,2.4743396088065535e-8,-0.00104648333056439,3.908308679776768e-5,2.4743374271449885e-8,-0.0010463351903678341,3.900321589613522e-5,2.4704818833201865e-8,-0.0010461187174899236,3.887169112109677e-5,2.4640634398441143e-8,-0.0010458157657489216,3.872153411276594e-5,2.456847676636226e-8,-0.0010454194198092652,3.8592904649491364e-5,2.4509434847279802e-8,-0.0010449379598351336,3.85290470767447e-5,2.4485769249212857e-8,-0.0010443983417922637,3.8568960460999586e-5,2.4517067123617403e-8,-0.0010438466104127784,3.8736263817727636e-5,2.4614598497805885e-8,-0.0010433416549984493,3.902636136480175e-5,2.477493404220497e-8,-0.0010429399987465788,3.9398027050649106e-5,2.4975871277955936e-8,-0.0010426746362297934,3.9777843434769186e-5,2.5178904654138547e-8,-0.0010425380922074639,4.0081503788804406e-5,2.5340291710930592e-8,-0.0010424814444555638,4.0244644241275436e-5,2.5427023133151833e-8,-0.0010424322947735387,4.024690202392131e-5,2.5429321392407133e-8,-0.0010423219582340482,4.01162830340403e-5,2.5362869290134385e-8,-0.0010421073140257824,3.9914219183457514e-5,2.526080398688154e-8,-0.0010417790504298643,3.9712303792083824e-5,2.5161204349048078e-8,-0.001041357514815806,3.957206053756882e-5,2.509620077309175e-8,-0.0010408820867983744,3.953305791576254e-5,2.5085701841939114e-8,-0.0010403994183290342,3.960922925354849e-5,2.5135719972456448e-8,-0.001039953473752625,3.979097235888994e-5,2.5239903766051643e-8,-0.0010395783534878653,4.005056096735985e-5,2.538278306056733e-8,-0.0010392939602767437,4.034918264408066e-5,2.5543680164653243e-8,-0.001039104389012981,4.0644480901831106e-5,2.5700644896490313e-8,-0.0010389988421567525,4.089757785496551e-5,2.5833941072896978e-8,-0.0010389545970551956,4.107865514075927e-5,2.5928726316951552e-8,-0.0010389412824983889,4.11705030871186e-5,2.5976731161695342e-8,-0.001038925600905446,4.116986580467381e-5,2.5976894786312716e-8,-0.0010388757116827172,4.108687415422475e-5,2.5935077860987764e-8,-0.0010387648487817887,4.094320887370908e-5,2.586310945168862e-8,-0.0010385741873378635,4.0769583233729096e-5,2.5777407288912374e-8,-0.0010382952268426782,4.0602784133407614e-5,2.569728649515853e-8,-0.0010379320091739295,4.04820837611387e-5,2.564292327050562e-8,-0.0010375031926033312,4.0444330838904017e-5,2.56327270085341e-8,-0.0010370431136598767,4.0516825192555824e-5,2.5679750881275533e-8,-0.0010365998252919112,4.07078727032145e-5,2.5787103029239512e-8,-0.0010362274507746704,4.0997023108730364e-5,2.59432896351184e-8,-0.0010359711779905647,4.133023718538513e-5,2.6120005918730713e-8,-0.0010358476721283505,4.1627586877103866e-5,2.6276137158887212e-8,-0.0010358308191826967,4.180745449119192e-5,2.6370052259346927e-8,-0.0010358552027499252,4.18193769451226e-5,2.6376375102413223e-8,-0.0010358403135057738,4.166678727036104e-5,2.6297719124715485e-8,-0.0010357228189093813,4.140456572009227e-5,2.6163449539399887e-8,-0.0010354780401623975,4.111391003936417e-5,2.6016503918615263e-8,-0.0010351214402610947,4.0871490524131414e-5,2.5897043112633257e-8,-0.0010346952781462417,4.0728626709958974e-5,2.5831362930703574e-8,-0.0010342513894169626,4.070496768499591e-5,2.582864079884688e-8,-0.0010338376130666347,4.0792468598692156e-5,2.588333975697396e-8,-0.001033489928572441,4.09637112677769e-5,2.5979990127741127e-8,-0.0010332292836012598,4.118057987218832e-5,2.6098059615421084e-8,-0.0010330613284611158,4.140165888760393e-5,2.6215931638488723e-8,-0.0010329777530100068,4.158819846524718e-5,2.631390656871405e-8,-0.0010329586810779521,4.170886241656704e-5,2.6376437158564403e-8,-0.001032975936317296,4.1743274993385874e-5,2.6393736765147437e-8,-0.0010329969885598913,4.168421213030391e-5,2.636277559384442e-8,-0.0010329892783965391,4.153821954893292e-5,2.62875676595281e-8,-0.0010329244588995863,4.132454750884092e-5,2.6178635261370543e-8,-0.001032782060381272,4.10726094101633e-5,2.6051674387741775e-8,-0.0010325522769319654,4.0818357819433007e-5,2.5925576579428118e-8,-0.0010322377709549141,4.0599882712942876e-5,2.5819988038191913e-8,-0.0010318544785740738,4.045240035953763e-5,2.575258468299546e-8,-0.001031431325710975,4.0402610592020545e-5,2.5736166079833738e-8,-0.0010310082903914864,4.04622844238969e-5,2.577556155474702e-8,-0.0010306315696239265,4.062155526853457e-5,2.586455506912295e-8,-0.0010303445107737654,4.084394736602622e-5,2.5983723580936618e-8,-0.00103017415051348,4.106712011714914e-5,2.6101034286724267e-8,-0.00103011645990442,4.121429379152592e-5,2.617762452180817e-8,-0.0010301283373702107,4.1218183604357294e-5,2.617978519094077e-8,-0.0010301360479824519,4.1049891214193474e-5,2.6093535091742128e-8,-0.0010300617418679534,4.073592787552085e-5,2.5933314593629573e-8,-0.0010298552834028627,4.0349707833675383e-5,2.5737635695545288e-8,-0.0010295123624857808,3.9981058901976845e-5,2.555325702866578e-8,-0.0010290699371210256,3.970266737753418e-5,2.541762182017323e-8,-0.0010285862799355606,3.95510226577242e-5,2.5348871652570656e-8,-0.001028119665030133,3.952567217658717e-5,2.5345604153804084e-8,-0.0010277146398166707,3.9599592103778894e-5,2.5392608827923747e-8,-0.0010273969445857086,3.9732019239784237e-5,2.54679029136312e-8,-0.0010271741439923543,3.987889635605635e-5,2.554837330653049e-8,-0.0010270387420002831,3.999979218338487e-5,2.5613362144150908e-8,-0.0010269717730998133,4.006209216467498e-5,2.564665439659544e-8,-0.0010269462335600545,4.004361181148552e-5,2.563758062373979e-8,-0.001026930475247916,3.993429582593155e-5,2.5581696150718296e-8,-0.0010268917955752411,3.9737131056284514e-5,2.54811632465487e-8,-0.0010268003254188763,3.946803547779058e-5,2.5344696049297998e-8,-0.001026633045285693,3.9154302349015926e-5,2.51867793373167e-8,-0.001026377413673644,3.883136780108241e-5,2.502596843310329e-8,-0.0010260339595217747,3.8538067531633994e-5,2.4882331374804033e-8,-0.00102561729797183,3.8310807330376756e-5,2.477430480252826e-8,-0.0010251551932449294,3.8177261675103885e-5,2.471538175976041e-8,-0.001024685487708184,3.8150384280356484e-5,2.4711128828705612e-8,-0.0010242508292970316,3.822352571453758e-5,2.475696413222644e-8,-0.0010238910923221203,3.836763523516221e-5,2.4837113045173785e-8,-0.0010236336767047106,3.853222377882937e-5,2.492543131105467e-8,-0.0010234830537858264,3.865239008611646e-5,2.49891058187856e-8,-0.0010234129983969168,3.8663590948988006e-5,2.4996031285257513e-8,-0.0010233670245726736,3.852273512816904e-5,2.492524814844594e-8,-0.001023271959887443,3.822833359285693e-5,2.4776942964655382e-8,-0.0010230632432314934,3.782769524653137e-5,2.4575998844550145e-8,-0.0010227107525744934,3.740279961889332e-5,2.436473371991324e-8,-0.0010222302402959167,3.703969137491942e-5,2.418716232193019e-8,-0.0010216740030515826,3.6798124988745376e-5,2.4073362152007457e-8,-0.001021108290579188,3.669683896443461e-5,2.4031974626159863e-8,-0.0010205912572348655,3.6717350983459955e-5,2.4052398420585333e-8,-0.0010201604372997207,3.681830406381751e-5,2.411249122180296e-8,-0.0010198303307530497,3.6950727918991715e-5,2.418666800590093e-8,-0.0010195960756659162,3.706898533184759e-5,2.4251597017513103e-8,-0.001019439056359185,3.713670445797552e-5,2.4289132019925126e-8,-0.001019332059571601,3.7129221763336125e-5,2.428734485125245e-8,-0.0010192433493335681,3.70343141516297e-5,2.4240686043212892e-8,-0.0010191400194511332,3.685229866278754e-5,2.4149908608415946e-8,-0.0010189911883879065,3.659580376531763e-5,2.402192783224623e-8,-0.0010187714343872375,3.628895436908966e-5,2.3869435845986977e-8,-0.0010184645132939021,3.596533710163379e-5,2.3709873676371996e-8,-0.001018066855839815,3.566412672527142e-5,2.3563393719128077e-8,-0.0010175898667280023,3.542425031334137e-5,2.3449761052332165e-8,-0.0010170599390659412,3.5277162817117435e-5,2.3384558945173422e-8,-0.001016515394012989,3.523949770501541e-5,2.3375440811865953e-8,-0.0010160002224420199,3.530738001007149e-5,2.3419397704779323e-8,-0.0010155553831384591,3.545419198619564e-5,2.3501928264935122e-8,-0.001015209142874551,3.563302488615149e-5,2.3598624983890202e-8,-0.0010149684067089226,3.5784346527384886e-5,2.3679292211144022e-8,-0.0010148133891465872,3.584860072421633e-5,2.3714344288769612e-8,-0.0010146982630651578,3.5782055660811007E-05,2.3682629377636572e-8,-0.0010145599654888093,3.557207326886522e-5,2.3578848270284908e-8,-0.0010143351722388912,3.5245823371830506e-5,2.3417678410022003e-8,-0.0010139811800521554,3.486632047924191e-5,2.3231576085062046e-8,-0.001013492050599654,3.4513974439642034e-5,2.3061330561170134e-8,-0.0010129013184621315,3.4259974954934804e-5,2.2942555475658693e-8,-0.0010122691652813616,3.4143842428325755e-5,2.289440024171102e-8,-0.001011660964001645,3.416527319904436e-5,2.291564249859294e-8,-0.0010111280235503381,3.429134318278579e-5,2.2988645742694414e-8,-0.0010106976785511353,3.447205752042876e-5,2.3087503664077148e-8,-0.0010103730798261847,3.465571175252602e-5,2.3185940039964153e-8,-0.0010101387428839818,3.479919616418346e-5,2.3262469964226124e-8,-0.0010099675794849883,3.487271276682596e-5,2.3302608900919384e-8,-0.0010098269209837737,3.4860699206272e-5,2.3299134968487392e-8,-0.0010096829020666328,3.476102080226269e-5,2.3251535621906485e-8,-0.0010095036482449427,3.4583741581220033e-5,2.316533851284319e-8,-0.00100926202814437,3.434990375649573e-5,2.3051517011118484e-8,-0.0010089385902406682,3.409004467856952e-5,2.2925769286763956e-8,-0.0010085248696185096,3.384168830235557e-5,2.2807227493595864e-8,-0.0010080265806791115,3.3644931550302674e-5,2.2716140262856692e-8,-0.0010074654828322916,3.353571640167953e-5,2.26703687608163e-8,-0.0010068782778092742,3.353743271134205e-5,2.268110345686206e-8,-0.0010063112194841138,3.36528689313314e-5,2.274888894220196e-8,-0.0010058104572475534,3.3859569732431347e-5,2.286150383963712e-8,-0.0010054101212326877,3.411145176628525e-5,2.2995062591133473e-8,-0.0010051217418514823,3.434769733360527e-5,2.3118734876600543e-8,-0.0010049287823506632,3.450726125747007e-5,2.3202145373587556e-8,-0.0010047886815621875,3.454511779650876e-5,2.3223469127649264e-8,-0.001004642523791172,3.444551550645358e-5,2.317587375654054e-8,-0.0010044301777682276,3.4228082912857005e-5,2.307029016040388e-8,-0.0010041070053985303,3.394428660482434e-5,2.293333606477324e-8,-0.0010036572007801948,3.366424530591849e-5,2.280046957873214e-8,-0.0010030989670374397,3.3457142010512746e-5,2.2706067870780697e-8,-0.001002478977520436,3.3371580578821594e-5,2.2673661179006083e-8,-0.0010018578283530568,3.342312200493025e-5,2.2709939398912565e-8,-0.0010012922882052613,3.359334378293894e-5,2.2804621910948108e-8,-0.0010008212275209021,3.3839363188058443e-5,2.2935524319804295e-8,-0.0010004594328713067,3.410840614322706e-5,2.3076001992787873e-8,-0.0010001992187818722,3.4351274842747164e-5,2.320166356575127e-8,-0.0010000167281470184,3.453101661995363e-5,2.3294552412610813e-8,-9.998793317252265e-4,3.462633409658824e-5,2.3344654270450874e-8,-9.997518470452732e-4,3.4631318428131296e-5,2.3349607127017085e-8,-9.996009199043014e-4,3.455348552109253e-5,2.3313647478180466e-8,-9.9939795849614e-4,3.44114906802232e-5,2.3246470434010358e-8,-9.99121407187035e-4,3.4233040893128126e-5,2.3162210737379513e-8,-9.987590833800812e-4,3.405276743515656e-5,2.3078368950141786e-8,-9.983108679056524e-4,3.390926822320403e-5,2.3014265042933495e-8,-9.97791306534957e-4,3.384032770146051e-5,2.2988554306834156e-8,-9.972307991430098e-4,3.3875718713881964e-5,2.3015580148524872e-8,-9.966733564831009e-4,3.4028221102158114e-5,2.310094837163757e-8,-9.961691020362934e-4,3.428546408696686e-5,2.3237638825588425e-8,-9.957615865134595e-4,3.46069401339788e-5,2.3404762682669036e-8,-9.954733186501152e-4,3.493021100327155e-5,2.357086532821176e-8,-9.952956330342465e-4,3.5186762200118035e-5,2.370192787102682e-8,-9.95188477807128e-4,3.532262383638006e-5,2.377162507367407e-8,-9.950913872963697e-4,3.5315508210565336e-5,2.376975873492727e-8,-9.94941500795456e-4,3.518154860532421e-5,2.3705430116577784e-8,-9.946916452042978e-4,3.496972133573339e-5,2.3603993034892922e-8,-9.943224955306555e-4,3.4747072949003844e-5,2.3499389344168517e-8,-9.938459958236127e-4,3.458033160070616e-5,2.3424766870853507e-8,-9.933002965673123e-4,3.451936283405707e-5,2.3404222600228282e-8,-9.92738532106868e-4,3.4586492210376424e-5,2.34477123751599e-8,-9.922149570488884e-4,3.47737697346077e-5,2.35500702634693e-8,-9.917723365169562e-4,3.504802300243e-5,2.369389615669735e-8,-9.91433801696836e-4,3.536137626092322e-5,2.385500900287136e-8,-9.912006576782077e-4,3.566352992413874e-5,2.4008564476421496e-8,-9.910555099664157e-4,3.591217265700787e-5,2.4134077453991628e-8,-9.909685467225334e-4,3.607935109184319e-5,2.4218367354514807e-8,-9.90904493799253e-4,3.615353059249766e-5,2.4256393376223053e-8,-9.90828480212809e-4,3.613845925610944e-5,2.4250587005171246e-8,-9.90710154736621e-4,3.605041340979941e-5,2.420946428455628e-8,-9.905262925749175e-4,3.5915102415850375e-5,2.4146106990416895e-8,-9.902625674466235e-4,3.576480559520487e-5,2.407673810359449e-8,-9.899151595612757e-4,3.563558997580312e-5,2.4019285840091026e-8,-9.894925239248037e-4,3.556393259086711e-5,2.399161892926978e-8,-9.890169789091286e-4,3.558183032668142e-5,2.400906596769323e-8,-9.885248529442735e-4,3.570977187754583e-5,2.4080982598891237e-8,-9.880631022206629e-4,3.594816942793109e-5,2.4206693186517794e-8,-9.876803749587692e-4,3.6270078383065484e-5,2.4372152484305683e-8,-9.874125517596248e-4,3.662032117452578e-5,2.4549731590826265e-8,-9.872671120179847e-4,3.6926008414473374e-5,2.470348797116585e-8,-9.872146960178598e-4,3.7118461255131244e-5,2.4799926090503432e-8,-9.871951531337715e-4,3.715829143129886e-5,2.482028574407889e-8,-9.871375620403313e-4,3.705077677427379e-5,2.476806781996489e-8,-9.869847448893906e-4,3.684329236067619e-5,2.466765451933042e-8,-9.867105450566658e-4,3.660725536650436e-5,2.4555140657066402e-8,-9.86323904247596e-4,3.641469724773145e-5,2.4466432455541804e-8,-9.858615016007492e-4,3.631928880259697e-5,2.442766534764061e-8,-9.85374633250025e-4,3.634645237112784e-5,2.4450388419430107e-8,-9.849156337300748e-4,3.649235218034662e-5,2.453139904021426e-8,-9.845270231932197e-4,3.672923823051199e-5,2.465582036281864e-8,-9.842346708626541e-4,3.7014300862134964e-5,2.4801822245291615e-8,-9.840451716688692e-4,3.729969081586018e-5,2.4945700886248175e-8,-9.839470708571595e-4,3.754181375466232e-5,2.5066377411016933e-8,-9.839150653915634e-4,3.770836043790428e-5,2.514864253568232e-8,-9.83915845150665e-4,3.778218739727299e-5,2.5184832131647895e-8,-9.839141440703577e-4,3.776204586365129e-5,2.5175023720621267e-8,-9.838778946578378e-4,3.7660825559131726e-5,2.5126110722890017e-8,-9.837819111355383e-4,3.750231363693385e-5,2.5050212268447694e-8,-9.83610120160167e-4,3.731747931219535e-5,2.4962853060990782e-8,-9.833567922937184e-4,3.714089212336408e-5,2.4881163070795294e-8,-9.830272886633775e-4,3.700727412351498e-5,2.4822096717103307e-8,-9.826385911278707e-4,3.69477424015823e-5,2.4800505830703303e-8,-9.82219396284537e-4,3.698509836147771e-5,2.4826830050034716e-8,-9.818087670899545e-4,3.712771767756578e-5,2.4904243886600084e-8,-9.814515702841564e-4,3.7362648046258683e-5,2.5025539421476875e-8,-9.811889802018954e-4,3.7650571338024e-5,2.5170939795615703e-8,-9.810442154511204e-4,3.792755371116602e-5,2.5309102919604293e-8,-9.810080333830023e-4,3.811864493199592e-5,2.5403711739960307e-8,-9.81033207624282e-4,3.8163102204115404e-5,2.5425633123846726e-8,-9.810462359989666e-4,3.804100654306584e-5,2.5365828059548833e-8,-9.809743731534347e-4,3.778505688611488e-5,2.524112956896296e-8,-9.807739041156364e-4,3.746843502401319e-5,2.508825210734586e-8,-9.804438663459916e-4,3.717577379911337e-5,2.4949313572355698e-8,-9.800204118408863e-4,3.697428727925494e-5,2.485733884169189e-8,-9.795593431768212e-4,3.6897909348930136e-5,2.4828320900585492e-8,-9.791176972697106e-4,3.694613487266822e-5,2.4860822858248447e-8,-9.78740821256568e-4,3.709208601691692e-5,2.4940346749398108e-8,-9.784561041063255e-4,3.7293678129001164e-5,2.5045249521682385e-8,-9.782718489133458e-4,3.7504071244625615e-5,2.5152145120602866e-8,-9.781792758595254e-4,3.7679941882763186e-5,2.5239992535436655e-8,-9.781562333794412e-4,3.778745647138105e-5,2.5292850462091087e-8,-9.781718882523143e-4,3.780606999115621e-5,2.530147602469855e-8,-9.781918620216884e-4,3.773013883351006e-5,2.5263886480747403e-8,-9.781832167389938e-4,3.7568458080856365e-5,2.518501010675023e-8,-9.78118742072559e-4,3.7342042791065954e-5,2.507558218052921e-8,-9.779801236071979e-4,3.708061130398327e-5,2.4950452157285786e-8,-9.777597868775496e-4,3.681839353569755e-5,2.4826535622686178e-8,-9.774615375963498e-4,3.6589861622145944e-5,2.47206704952449e-8,-9.771002958644923e-4,3.642562803302159e-5,2.464752335844287e-8,-9.767011177636903e-4,3.6348412775412787e-5,2.461757103592887e-8,-9.762974059618317e-4,3.636884684333104e-5,2.463512177599872e-8,-9.759277035517238e-4,3.648101405343806e-5,2.4696356361916733e-8,-9.75629951246629e-4,3.665840901177218e-5,2.4787660934629145e-8,-9.754322748465593e-4,3.685252659570957e-5,2.4885193908702775e-8,-9.75340987613693e-4,3.699788916582287e-5,2.495739454375517e-8,-9.753299684090048e-4,3.702722840929396e-5,2.4972198717358794e-8,-9.753395265608093e-4,3.689599167738356e-5,2.490869287630752e-8,-9.752920720559031e-4,3.6606102877796636e-5,2.4768523544825133e-8,-9.751219280535475e-4,3.62127126348543e-5,2.457919604533296e-8,-9.748035378869218e-4,3.580501071706199e-5,2.4384716721739845e-8,-9.743604317943561e-4,3.5470563709328834E-05,2.4228018734390125e-8,-9.738510761405169e-4,3.526450154078282e-5,2.4135686744524703e-8,-9.733435765106256e-4,3.519840608946445e-5,2.411249078547065e-8,-9.728943634004211e-4,3.5247780682422384e-5,2.4145284649450995e-8,-9.725377477092212e-4,3.536768335651393e-5,2.4211049479849402e-8,-9.722848444423038e-4,3.550754893515966e-5,2.428448154165182e-8,-9.72127563371285e-4,3.562150854076412e-5,2.4343174928178926e-8,-9.720441769973178e-4,3.567417242302132e-5,2.437035998268252e-8,-9.720046367152485e-4,3.56432887461309e-5,2.4355963585866076e-8,-9.719752390974952e-4,3.552063301357858e-5,2.4296779131561367e-8,-9.719228596586245e-4,3.531171554305102e-5,2.4196141313711178e-8,-9.718188423673552e-4,3.503437202507118e-5,2.406317927089353e-8,-9.716423998941957e-4,3.471621408885309e-5,2.3911605715671775e-8,-9.713832408989576e-4,3.439096166140005e-5,2.3757978780585042e-8,-9.710430366130846e-4,3.409389102193965e-5,2.361948593481193e-8,-9.70635446133547e-4,3.3856923351839665e-5,2.3511491505683215e-8,-9.701846919981149e-4,3.370390574741038e-5,2.3445165212560717e-8,-9.697228228770885e-4,3.364647614797688e-5,2.342546325722505e-8,-9.692857745624962e-4,3.368081166293388e-5,2.3449670440655165e-8,-9.689081926968012e-4,3.378557365972413e-5,2.3506650641077334e-8,-9.686168099705691e-4,3.392170644199995e-5,2.357703705485365e-8,-9.684224658620934e-4,3.4035563171401795e-5,2.3634937383161203e-8,-9.68312113340623e-4,3.406746818840269e-5,2.3652061632635778e-8,-9.682443258694862e-4,3.396706662113197e-5,2.3604922859051918e-8,-9.681538286062369e-4,3.371329935534211e-5,2.348419799835916e-8,-9.679692761326831e-4,3.333058404686902e-5,2.330235800983941e-8,-9.676407409410866e-4,3.2888734991917684e-5,2.3093584924486144e-8,-9.671629996624705e-4,3.2480309923178234e-5,2.2902797651000153e-8,-9.665791080763037e-4,3.2184835146996645e-5,2.276825671546724e-8,-9.659613244934983e-4,3.204046428493923e-5,2.270778086296016e-8,-9.653822640887052e-4,3.203767611505963e-5,2.2715798323767404e-8,-9.648929276683705e-4,3.213287335072607e-5,2.2770213229558723e-8,-9.645149837962753e-4,3.226903530996189e-5,2.2842729866168465e-8,-9.642442355567376e-4,3.239247708087407e-5,2.2907171397624284e-8,-9.640587530216115e-4,3.24620993246358e-5,2.2943963859402317e-8,-9.639270001539048e-4,3.245248074250296e-5,2.2941464499432092e-8,-9.638140578411377e-4,3.235353569481727e-5,2.2895550510650823e-8,-9.6368595444148e-4,3.2168912493880215e-5,2.28086319018673e-8,-9.635128997527551e-4,3.191410788621952e-5,2.2688634455621677e-8,-9.632720633656184e-4,3.161432337084309e-5,2.2547969983926774e-8,-9.629500908473864e-4,3.1301728190777524e-5,2.2402276055104036e-8,-9.625451789726969e-4,3.101176374193039e-5,2.226867575507521e-8,-9.620681774777247e-4,3.077836455776551e-5,2.216345368450055e-8,-9.615420329416084e-4,3.0628500411465295e-5,2.209935540113096e-8,-9.609991467969121e-4,3.057690888665009e-5,2.2082994490797295e-8,-9.604766797714861e-4,3.062205911343596e-5,2.2112942498469528e-8,-9.600102747775835e-4,3.074434601472043e-5,2.2179018433807102e-8,-9.596270214263777e-4,3.090724439259373e-5,2.2263089974248304e-8,-9.593386562986945e-4,3.1061771792007744e-5,2.2341454918293274e-8,-9.591361349101454e-4,3.1154428547892235e-5,2.2388764734143828e-8,-9.589871735461636e-4,3.113854434292479e-5,2.2383389507898628e-8,-9.588390052667267e-4,3.0987899671081076e-5,2.23137088373979e-8,-9.586285812047179e-4,3.0709291166627064e-5,2.2183841699676357e-8,-9.583004549904042e-4,3.034807980718291e-5,2.20160808943815e-8,-9.578277490469907e-4,2.9980170319710332e-5,2.1846942684937246e-8,-9.572262091683876e-4,2.968886340238766e-5,2.1716059377740093e-8,-9.565515092747311e-4,2.953507814969651e-5,2.1651963566920276e-8,-9.558790138711099e-4,2.9536365304518656e-5,2.166217296734255e-8,-9.552767930981623e-4,2.9665583334704913e-5,2.173278583758932e-8,-9.547860467171304e-4,2.9867061406297094e-5,2.1836474927304304e-8,-9.544158266696612e-4,3.0078540975903094e-5,2.1943173400982044e-8,-9.541492278461368e-4,3.024805141205629e-5,2.20281932369835e-8,-9.539540335951516e-4,3.034185193150517e-5,2.2075920768301698e-8,-9.537924048895253e-4,3.0345247140230987e-5,2.208000983233228e-8,-9.536275311546465e-4,3.025982229495277e-5,2.204185499562896e-8,-9.534275077413425e-4,3.0099841725022342e-5,2.1968736705240954e-8,-9.531675967845711e-4,2.9889041402266785e-5,2.187225621318765e-8,-9.528318988517542e-4,2.9657867759765324e-5,2.1767059789256722e-8,-9.524149404686213e-4,2.9440645440285744e-5,2.1669541941369942e-8,-9.519231274636026e-4,2.9272003957849185e-5,2.1596154336982085e-8,-9.513754532627277e-4,2.9182105324352853e-5,2.156109047838405e-8,-9.508024505321581e-4,2.9190878090889825e-5,2.1573483188737836e-8,-9.502424663511357e-4,2.9302351813132366e-5,2.1634700321363326e-8,-9.49735030418587e-4,2.9500882232911995e-5,2.1736638845838566e-8,-9.493122042363756e-4,2.975120128025421e-5,2.1861931766478845e-8,-9.489899450602254e-4,3.0003488125871785e-5,2.19865714491652e-8,-9.487620601966599e-4,3.020311750055373e-5,2.2084695992892515e-8,-9.485988957950232e-4,3.030316317880326e-5,2.2134553407674564e-8,-9.484518091654521e-4,3.0276810472256283e-5,2.2124270364054122e-8,-9.482632222856166e-4,3.0126538386465414e-5,2.205597301242971e-8,-9.479807554179524e-4,2.9887047408005317e-5,2.194689841841948e-8,-9.475724436270446e-4,2.961960692398054e-5,2.1826477535904775e-8,-9.470384606933393e-4,2.9397309036501518e-5,2.1729216202936675e-8,-9.464140919087501e-4,2.9284117233135745e-5,2.168479093152599e-8,-9.457607135250013e-4,2.931474722874649e-5,2.1708699518209903e-8,-9.451468703045619e-4,2.948415363474355e-5,2.179756824154432e-8,-9.446272642077682e-4,2.975166154093429e-5,2.19313942223417e-8,-9.442287741878977e-4,3.005706659105484e-5,2.2081348790756766e-8,-9.439480612138644e-4,3.0340177706433605e-5,2.2219059244211306e-8,-9.437587330039747e-4,3.05555047742844e-5,2.232346391891961e-8,-9.436224123828684e-4,3.0678595514250895e-5,2.2383640253534496e-8,-9.434987028230832e-4,3.0705355294702186e-5,2.2398300631400305e-8,-9.433518093842979e-4,3.0647746413302585e-5,2.2373619930447855e-8,-9.431539596951896e-4,3.052879162175852e-5,2.2320812424416252e-8,-9.42886827941632e-4,3.0378337056025078e-5,2.2254139731918605e-8,-9.425421763466582e-4,3.0229750427711546e-5,2.2189391361884014e-8,-9.421224563862095e-4,3.011700715597695e-5,2.2142531937943215e-8,-9.416414774327706e-4,3.0071346469157127e-5,2.212810620989906e-8,-9.411245660268458e-4,3.0116816661240038e-5,2.215710354642401e-8,-9.406070615964384e-4,3.026467552618603e-5,2.2234316233793085e-8,-9.40129838692488e-4,3.050774422637882e-5,2.2355753528190237e-8,-9.397312194328286e-4,3.0817081031483444e-5,2.2507225708871276e-8,-9.394363651629871e-4,3.1143952690525606e-5,2.266544635054926e-8,-9.39247469629382e-4,3.14289902634384e-5,2.2802467253505157e-8,-9.391392811567771e-4,3.161734154321736e-5,2.28928419535772e-8,-9.390631834203985e-4,3.1675072753920046e-5,2.292128485717643e-8,-9.389595011470184e-4,3.160054917881444e-5,2.2887892684632222e-8,-9.38774017044829e-4,3.142629938669554e-5,2.2808821851867562E-08,-9.384731170441491e-4,3.121073248180759e-5,2.2712144428496986e-8,-9.380529653295315e-4,3.102263562512172e-5,2.2630329259409035e-8,-9.37540421932073e-4,3.0923179639618185e-5,2.2591680785415607e-8,-9.369857583175107e-4,3.095034383443137e-5,2.261312414301245e-8,-9.364492385837592e-4,3.1109898640259824e-5,2.269626110812058e-8,-9.359853619300495e-4,3.137546064701527e-5,2.2827755619925506e-8,-9.356295240548179e-4,3.16974681512932e-5,2.2983821119346855e-8,-9.353911527823038e-4,3.2017802198202046e-5,2.313717510433112e-8,-9.35254811672147e-4,3.228479107023496e-5,2.326399499414142e-8,-9.351875597689146e-4,3.2463820357644084e-5,2.3348709349042408e-8,-9.351488611202442e-4,3.2541398176328435e-5,2.338570291153537e-8,-9.350994833205346e-4,3.25234996917194e-5,2.3378386345866902e-8,-9.350074661012362e-4,3.2430678404906835e-5,2.333682380228043e-8,-9.348510276335349e-4,3.229243028857118e-5,2.3275080016553152e-8,-9.346193314669444e-4,3.214231620297721e-5,2.3208959235950077e-8,-9.34312262797197e-4,3.2014221186669155e-5,2.3154273367792384e-8,-9.339400414025882e-4,3.193933185076618e-5,2.3125418905859264e-8,-9.33522913696338e-4,3.194305448645945e-5,2.3133910756853474e-8,-9.330904862493931e-4,3.204115275895757e-5,2.3186578394138074e-8,-9.326796244283101e-4,3.223492294630654e-5,2.3283386135426127e-8,-9.323295184334296e-4,3.250635238251842e-5,2.3415326287966734e-8,-9.320730236673442e-4,3.281574833663746e-5,2.356349553000111e-8,-9.319252711366798e-4,3.310543782936856e-5,2.3700943505328696e-8,-9.318736216132645e-4,3.331219177128394e-5,2.3798471243414568e-8,-9.318752640651988e-4,3.338676318697942e-5,2.3833655432768257e-8,-9.31866963948998e-4,3.331301147491189e-5,2.3799668733206908e-8,-9.317849968972861e-4,3.311655040946259e-5,2.3709231637614105e-8,-9.315865645433877e-4,3.2857438239323513e-5,2.3591073380549135e-8,-9.312628626536916e-4,3.2610345594110236e-5,2.3480457903216238e-8,-9.308393005661033e-4,3.24417200448329e-5,2.3408301483171562e-8,-9.303651936824847e-4,3.239281090859414e-5,2.339318150193606e-8,-9.298986864069065e-4,3.24725338782039e-5,2.343818307136948e-8,-9.29492219127464e-4,3.265959531263871e-5,2.3532245846076462e-8,-9.291818021359038e-4,3.2911055999915944e-5,2.3654527540462002e-8,-9.289814804693926e-4,3.317408157338681e-5,2.3780107907133812e-8,-9.28883102878134e-4,3.339795710135585e-5,2.3885603751994195e-8,-9.288606081706539e-4,3.3543937048918637e-5,2.3953598676844333e-8,-9.288772589118661e-4,3.3591181371482934e-5,2.3975172255395918e-8,-9.288937419745458e-4,3.353814016920971e-5,2.395033272948154e-8,-9.288751893623011e-4,3.340004673214571e-5,2.3886721538417358e-8,-9.287959268978146e-4,3.320403594462646e-5,2.3797303763589087e-8,-9.286417064222096e-4,3.298355112980294e-5,2.369778683496962e-8,-9.284099392258089e-4,3.277328729013441e-5,2.3604298515993387e-8,-9.281087947963245e-4,3.260518664063019e-5,2.3531530406527254e-8,-9.277558922978596e-4,3.25053020042501e-5,2.3491259018736307e-8,-9.27376881127838e-4,3.2490978444289704E-05,2.349102519309791e-8,-9.270036743482587e-4,3.2567791005183e-5,2.3532761106056747e-8,-9.266715169341242e-4,3.2726055504754945e-5,2.361130945511728e-8,-9.264137151151058e-4,3.293770276831043e-5,2.3713172494102367e-8,-9.262532777753961e-4,3.315574465668824e-5,2.3816439311101114e-8,-9.261924253535585e-4,3.331972423030237e-5,2.389335984974595e-8,-9.262040127993932e-4,3.336992217268715e-5,2.3916815814377182e-8,-9.262317722939682e-4,3.326872605091641e-5,2.3870037451283865e-8,-9.26204733848964e-4,3.3020183443077696e-5,2.3755545743126395e-8,-9.260627882338456e-4,3.267485106444268e-5,2.3597373291928313e-8,-9.257806549268176e-4,3.2313603001887904e-5,2.343349628055146e-8,-9.253766285983505e-4,3.201794497161325e-5,2.3301884783205278e-8,-9.249026226141552e-4,3.1842977355389055e-5,2.3227766419155888e-8,-9.244236141866019e-4,3.1804942562237756e-5,2.321783898637054e-8,-9.239978305283136e-4,3.188429203691447e-5,2.3261932645223352e-8,-9.236643245273065e-4,3.203781785436325e-5,2.3339012154274225e-8,-9.234386977616611e-4,3.221281488408803e-5,2.3424069805742805e-8,-9.233147289125141e-4,3.235906739356297e-5,2.3493825767808208e-8,-9.232692914346888e-4,3.243722377144107e-5,2.3530540271546322e-8,-9.232686902572398e-4,3.242362191865267e-5,2.3524031114582375e-8,-9.232753070314963e-4,3.231198064538372e-5,2.347219924760264e-8,-9.232537561991422e-4,3.211234823824068e-5,2.3380345332508162e-8,-9.231758558037119e-4,3.1847866001873865e-5,2.3259584838009844e-8,-9.230239270817444e-4,3.155012781518374e-5,2.3124710835478002e-8,-9.227922362546493e-4,3.1253999746506684e-5,2.299185234886264e-8,-9.224867387452752e-4,3.0992724464646724e-5,2.2876250708263638e-8,-9.221236055597706e-4,3.079385597163362e-5,2.27903811393233e-8,-9.217270560533948e-4,3.067609570471294e-5,2.2742468990955336e-8,-9.213267796337176e-4,3.064680318714811e-5,2.2735346156833847e-8,-9.20954912564315e-4,3.0699934328855683e-5,2.2765581416612138e-8,-9.206421478418023e-4,3.08143607477365e-5,2.2822873109824424e-8,-9.204122660196305e-4,3.095320827010874e-5,2.2889943688910157e-8,-9.202747886912586e-4,3.106597764009101e-5,2.2943650815208422e-8,-9.20216936947342e-4,3.1095988189358365e-5,2.2958395502173376e-8,-9.201985234595585e-4,3.099497926622176e-5,2.2912665548665453e-8,-9.201557642877907e-4,3.074296687634402e-5,2.2797948208220792e-8,-9.200186966514138e-4,3.0364621739963786e-5,2.2626137511840795e-8,-9.197385636888824e-4,2.9929213138156976e-5,2.242949417390068e-8,-9.193108394574188e-4,2.9527970187913423e-5,2.225019669376877e-8,-9.187785340875029e-4,2.9238845703639758e-5,2.2123997801802605e-8,-9.182134225021054e-4,2.9098989670442113e-5,2.2067447146301895e-8,-9.176879830111815e-4,2.9098589555165532e-5,2.2075132170368005e-8,-9.17253784391652e-4,2.9193712335522423e-5,2.212586268610836e-8,-9.169332050515159e-4,2.932621852597383e-5,2.2192168520093514e-8,-9.167219505579218e-4,2.944065181810668e-5,2.224829932694638e-8,-9.165966656263807e-4,2.949439756587482e-5,2.2274934020959177e-8,-9.165233093736817e-4,2.9461840863147958e-5,2.226094758259148e-8,-9.164642868928159e-4,2.9334685108527463e-5,2.220331133229603e-8,-9.163839913645998e-4,2.9120232422900573e-5,2.2106066579955823e-8,-9.162530317647461e-4,2.883851348103519e-5,2.1978863978225656e-8,-9.160513185398048e-4,2.8518597058158136e-5,2.1835244906513958e-8,-9.15769988624412e-4,2.8194298243653313e-5,2.1690730238489156e-8,-9.154120664548803e-4,2.7899535170271005e-5,2.1560765750180442e-8,-9.149917488095805e-4,2.7663738874698725e-5,2.1458654195702416e-8,-9.145323801553542e-4,2.7507851429598272e-5,2.1393709233720136e-8,-9.140634112563936e-4,2.744128142921948e-5,2.136983448703116e-8,-9.136166435043148e-4,2.745994641856036e-5,2.1384644526880326e-8,-9.13221944692427e-4,2.754549808736449e-5,2.1429208794373388e-8,-9.129024910120398e-4,2.7665888640565562e-5,2.148847949703196e-8,-9.126694819496386e-4,2.7777706431344518e-5,2.154253176218981e-8,-9.125166098566058e-4,2.7831321553144563e-5,2.156899691685832e-8,-9.124157000485842e-4,2.7780165658292776e-5,2.1547232079309533e-8,-9.123165267733067e-4,2.759442992476146e-5,2.1464373542698462e-8,-9.121548623777333e-4,2.7276427140508372e-5,2.1322119221499095e-8,-9.118711019526034e-4,2.6870144591949852e-5,2.114094313683426e-8,-9.114350063079968e-4,2.6455006129514234e-5,2.0957209029743784e-8,-9.108634742462995e-4,2.6120092101343845e-5,2.081139801841706e-8,-9.102178200814272e-4,2.5929424367736944e-5,2.0732255869559906e-8,-9.095797117160946e-4,2.5898353086471822e-5,2.0726067368364644e-8,-9.090202329768966e-4,2.5993933266429337e-5,2.077699539719869e-8,-9.085793014011967e-4,2.615479802733407e-5,2.0856387709915296e-8,-9.082619863653898e-4,2.6315579246745158e-5,2.09341239475786e-8,-9.080467696016204e-4,2.6424152758084614e-5,2.098656643738969e-8,-9.078974977973308e-4,2.6448875948786817e-5,2.0999792057647626e-8,-9.077736775849799e-4,2.6378608518081082e-5,2.0969414117202983e-8,-9.076374388060467e-4,2.621931034153885e-5,2.089880711320176e-8,-9.074576563940846e-4,2.598981028468818e-5,2.0797007293920687e-8,-9.072123555606045e-4,2.5717763310892864e-5,2.067680801973962e-8,-9.068901702931364e-4,2.543581375595846e-5,2.055305287961445e-8,-9.064910919600087e-4,2.51777245706118e-5,2.044096225969404e-8,-9.060264239903059e-4,2.497429600456872e-5,2.0354350101638346e-8,-9.055176396903595e-4,2.4849147035049042e-5,2.0303725663131417e-8,-9.049938331462582e-4,2.48148520431951e-5,2.0294513960783498e-8,-9.044877759473634e-4,2.487013629166907e-5,2.0325761996341625e-8,-9.040309431041147e-4,2.4998716181532725e-5,2.0389648367651206e-8,-9.036480496186143e-4,2.5170219741609872e-5,2.0472012539751645e-8,-9.033517513971097e-4,2.534346091236584e-5,2.0553994872596846e-8,-9.031382345469437e-4,2.5472113323665762e-5,2.0614734900078757e-8,-9.029845516590252e-4,2.5512741628428336e-5,2.0635033273204925e-8,-9.028490149929373e-4,2.5434954827073677e-5,2.0601836238167363e-8,-9.026764902106563e-4,2.5232408447057923e-5,2.0513003051675774e-8,-9.02410173775587e-4,2.4931333305205534e-5,2.03809375747986e-8,-9.020092509206674e-4,2.459113424824214e-5,2.0232703367730958e-8,-9.014671775780341e-4,2.4291763948560345e-5,2.0104263036672917e-8,-9.008206650653747e-4,2.4108119510329703e-5,2.0028949316011377e-8,-9.001407652157997e-4,2.40815816794724e-5,2.002473027343289e-8,-8.995076036470077e-4,2.4204454860463047e-5,2.0087372224985797e-8,-8.989819618378563e-4,2.4426402095344975e-5,2.0193550978397385e-8,-8.985886426926948e-4,2.4677367529835956e-5,2.0311351442965695e-8,-8.983168875609791e-4,2.489249041554455e-5,2.0411570672683616e-8,-8.981321994515865e-4,2.5027742305275945e-5,2.0474734817052442e-8,-8.979905680705888e-4,2.506411353886881e-5,2.0492861273368607e-8,-8.978493659111419e-4,2.50042478933684e-5,2.0467761838839778e-8,-8.976735626310779e-4,2.486629512223054e-5,2.040810250953443e-8,-8.974383807300419e-4,2.46779904367794e-5,2.0326637181998767e-8,-8.971300793370073e-4,2.447195277178342e-5,2.0238087853917463e-8,-8.967460299014721e-4,2.4281946492655756e-5,2.0157529321890946e-8,-8.962944874862408e-4,2.41394984040332e-5,2.009894778188007e-8,-8.957939342688571e-4,2.4070383811391924e-5,2.0073707412014148e-8,-8.952715333108823e-4,2.4090842783267837e-5,2.0088849549234874e-8,-8.94760107898572e-4,2.420397021695154e-5,2.014545178891125e-8,-8.942933680114259e-4,2.4397265038716906e-5,2.0237535845060154e-8,-8.938997498069575e-4,2.4642474151023778e-5,2.0352064205131918e-8,-8.935958998883974e-4,2.4898610660257977E-05,2.047041270308535e-8,-8.933813137979958e-4,2.5118392150347438e-5,2.057138082449648e-8,-8.932357382837027e-4,2.525738915614616e-5,2.0635360425476936e-8,-8.931205738507962e-4,2.5284299096435977e-5,2.0648906749984923e-8,-8.929848689198422e-4,2.5190265415252555e-5,2.0608774843090036e-8,-8.927757350545704e-4,2.4994824362930195e-5,2.052437537467493e-8,-8.924519189134882e-4,2.4745797708676503e-5,2.0417514294488545e-8,-8.919975931406865e-4,2.4510848006438183e-5,2.031846414448125e-8,-8.914314961573257e-4,2.436039906856739e-5,2.0258291785338553e-8,-8.908058509117407e-4,2.4345690900774747e-5,2.0259156353576073e-8,-8.901923458736179e-4,2.4480408023514104e-5,2.032632704668696e-8,-8.896591855754514e-4,2.473538117757218e-5,2.0446077286436584e-8,-8.892494467896753e-4,2.505003874490458e-5,2.0590986107984132e-8,-8.889707658958967e-4,2.5354671159387962e-5,2.0729934824061592e-8,-8.887992171195747e-4,2.5592069573353648e-5,2.0837712880844427e-8,-8.886922966930062e-4,2.572983863637043e-5,2.0900398514110002e-8,-8.886031916452067e-4,2.576187327548421e-5,2.0915874009217856e-8,-8.884910916697882e-4,2.5702806387382103e-5,2.0891201501616617e-8,-8.883263469942507e-4,2.5580247122862124e-5,2.0839048300129043e-8,-8.880918126579759e-4,2.5427917810549098e-5,2.0774582188619598e-8,-8.877822930623571e-4,2.528066113611859e-5,2.071327182632323e-8,-8.874034503409459e-4,2.51709375729389e-5,2.0669390176493168e-8,-8.869707261418254e-4,2.5125989723721748e-5,2.0654810035291582e-8,-8.865081500699982e-4,2.5164954314173364e-5,2.067774642510077e-8,-8.86046435520712e-4,2.5295625909005256e-5,2.074132329135633e-8,-8.856195799846079e-4,2.5511276908268373e-5,2.0842176511925037e-8,-8.852594627043434e-4,2.578871501824554e-5,2.0969645761179816e-8,-8.849887434082308e-4,2.6089236359805585e-5,2.1106290594163275e-8,-8.848135668142814e-4,2.6363915683878577e-5,2.12303363316089e-8,-8.847186517320325e-4,2.6563437790964064e-5,2.132009779085571e-8,-8.846674515235134e-4,2.6650601378864086e-5,2.1359523275735847e-8,-8.846087189309281e-4,2.66117823350549e-5,2.1343206192558952e-8,-8.844884826177575e-4,2.6463259603390726e-5,2.1279054822091283e-8,-8.84264302201615e-4,2.6249677950410016e-5,2.1187425909026206e-8,-8.839176546726403e-4,2.6034332006823362e-5,2.109662263366006e-8,-8.83460649868888e-4,2.588342561020468e-5,2.1035784916221402e-8,-8.82934630955511e-4,2.584833167410523e-5,2.102703848956324e-8,-8.824002202963414e-4,2.595091364572211e-5,2.1079174189276926e-8,-8.81920975885244e-4,2.61768927835987e-5,2.1185003004173495e-8,-8.815456299885851e-4,2.648030419312936e-5,2.132360042425762e-8,-8.812952960849518e-4,2.6797977084991984e-5,2.146685384949102e-8,-8.811602994497689e-4,2.7068443874576867e-5,2.1587808754275467e-8,-8.811068251980501e-4,2.7247856141716944e-5,2.1667584069800153e-8,-8.81089260979772e-4,2.7317788146902162e-5,2.169866440830599e-8,-8.810626671495409e-4,2.7284359038585255e-5,2.168436095027221e-8,-8.809914703339173e-4,2.7171697969967655e-5,2.1635803660338795e-8,-8.80853375306616e-4,2.7013728986054004e-5,2.1568241334736312e-8,-8.806396376131523e-4,2.6847076911299085e-5,2.14978976330453e-8,-8.803534902028214e-4,2.670608170906783e-5,2.1439805851815076e-8,-8.800081064751453e-4,2.661959400830792e-5,2.140644761622855e-8,-8.796247407013677e-4,2.6608697363742646e-5,2.1406789555317838e-8,-8.792309875330124e-4,2.668453948521081e-5,2.1445354689839482e-8,-8.788585456571649e-4,2.684586308158884e-5,2.152116684744657e-8,-8.78539601693883e-4,2.7076554888474195e-5,2.162673250547703e-8,-8.783011687268403e-4,2.7344451028370228e-5,2.1747606543339466e-8,-8.781575952511767e-4,2.760340690883203e-5,2.1863392752506867e-8,-8.781030584565838e-4,2.780060405021578e-5,2.1951002414711444e-8,-8.781075985026394e-4,2.7889387640801088e-5,2.1990279643567898e-8,-8.781205807905475e-4,2.7844561840664714e-5,2.197066505165757e-8,-8.780829418086908e-4,2.767387999018061e-5,2.1896173090185512e-8,-8.779448870805086e-4,2.74194206923248e-5,2.178590013371832e-8,-8.776820355245091e-4,2.7146767973214645e-5,2.166911671129024e-8,-8.773032995196551e-4,2.692589193920319e-5,2.157667830482182e-8,-8.768478522267831e-4,2.6811226903755186e-5,2.153215088316852e-8,-8.763733034865937e-4,2.6827771709541934e-5,2.1545755773169187e-8,-8.759398672705631e-4,2.6966612293309254e-5,2.1612637371882027e-8,-8.75595423955086e-4,2.718972268856917e-5,2.171528609991872e-8,-8.753651397527334e-4,2.744156484383133e-5,2.182888124213572e-8,-8.75247681912975e-4,2.766380317219204e-5,2.1927841507686533e-8,-8.752182834583848e-4,2.7809084316441637e-5,2.1991802394858896e-8,-8.752370705991506e-4,2.78503969031841e-5,2.2009553750829985e-8,-8.752596751637627e-4,2.7784140827711733e-5,2.1980196488628183e-8,-8.752468743315799e-4,2.7627256123099378e-5,2.1911727125109708e-8,-8.751709906385506e-4,2.741056684869909e-5,2.181802519722558e-8,-8.750184292407893e-4,2.717106230583093e-5,2.1715442258405405e-8,-8.747891179445456e-4,2.6945211256019782e-5,2.161989799005169e-8,-8.744942264117304e-4,2.6764246324536103e-5,2.1544865267399724e-8,-8.741534012510591e-4,2.6651298588158375e-5,2.1500162537119337e-8,-8.73792188217311e-4,2.6619664630001775e-5,2.1491228293641114e-8,-8.734396730616577e-4,2.6671435073366737e-5,2.1518551762450664e-8,-8.731258580016011e-4,2.679606382670435e-5,2.1577100432093963e-8,-8.7287798682881e-4,2.696908317973565e-5,2.165584590639723e-8,-8.727151324958717e-4,2.7152056798777518e-5,2.1737843898724333e-8,-8.726411876491597e-4,2.7295776371153268e-5,2.180169400597056e-8,-8.72638123277193e-4,2.7348884643569248e-5,2.1825288578833227e-8,-8.726635290724197e-4,2.7272385770363037e-5,2.1792059497611342e-8,-8.726572026318421e-4,2.7056308642078688e-5,2.16981558387545e-8,-8.725583379939474e-4,2.673014546177635e-5,2.1556946339519295e-8,-8.723277672615219e-4,2.6358529275551267e-5,2.1397083391496553e-8,-8.719640776249092e-4,2.6020955368897574e-5,2.1253534423843147e-8,-8.715045501738401e-4,2.5784651947306544e-5,2.1155571953329428e-8,-8.71011034255676e-4,2.5683903518439307e-5,2.1117663450457478e-8,-8.705491307552995e-4,2.5713812934991007e-5,2.113685431521052e-8,-8.701702166525884e-4,2.5837496324388218e-5,2.119617587482424e-8,-8.699014006819977e-4,2.6000426627921144e-5,2.1271201276789622e-8,-8.697436570127698e-4,2.6145631661998167e-5,2.1336868320268546e-8,-8.696759171271625e-4,2.6225891752515828E-05,2.137282593288771e-8,-8.696624900426764e-4,2.621144415050257e-5,2.136666972028361e-8,-8.696616766384265e-4,2.609309797451578e-5,2.1315093592520665e-8,-8.696339802855976e-4,2.58812240139253e-5,2.1223246173929514e-8,-8.695486258957221e-4,2.560145694153938e-5,2.1102720086846007e-8,-8.693875014404906e-4,2.5288439658636282e-5,2.096877998090809e-8,-8.691463110554454e-4,2.4979158898865863e-5,2.083749001199522e-8,-8.688333814216199e-4,2.4707133641329762e-5,2.0723252879501703e-8,-8.684669509396333e-4,2.449818770419122e-5,2.0637035505226535e-8,-8.680718625220174e-4,2.4367943926356345e-5,2.0585317375536392e-8,-8.676763190924599e-4,2.432063005736646e-5,2.0569587886541e-8,-8.673088635246923e-4,2.4348592526606557e-5,2.0586157121313442e-8,-8.669953180759233e-4,2.4432155464044134e-5,2.0626149014017224e-8,-8.667551694766482e-4,2.4539935083866278e-5,2.0675728630559995e-8,-8.665969051568935e-4,2.4630410220170644e-5,2.0716875446414914e-8,-8.665124727648299e-4,2.4656354944466406e-5,2.0729342915038327e-8,-8.664725697134575e-4,2.4573949994687252e-5,2.0694555012387574e-8,-8.664264664054185e-4,2.43569138231536e-5,2.0601608133330403e-8,-8.663110139622543e-4,2.401199304406164e-5,2.0453867175701917e-8,-8.660704693962533e-4,2.3586965902470763e-5,2.0272378725582345e-8,-8.656806366986982e-4,2.316147155005631e-5,2.0091868871878088e-8,-8.651633988921566e-4,2.281978312873848e-5,1.9948869925345905e-8,-8.645805810525198e-4,2.2618527290404762e-5,1.9867633866200034e-8,-8.640097643843145e-4,2.256770525095591e-5,1.9851904328723277e-8,-8.635166675543678e-4,2.2633614094821955e-5,1.9886336038762515e-8,-8.63137948012429e-4,2.2757311910044172e-5,1.9944743482180508e-8,-8.628781813717942e-4,2.2875933655872637e-5,1.9999555353413913e-8,-8.62716501594731e-4,2.2938215554097242e-5,2.0028639520069148e-8,-8.626167844185233e-4,2.291219190087368e-5,2.0018587878018706e-8,-8.625373867297079e-4,2.2786717609544522e-5,1.9965210231098124e-8,-8.624388179572647e-4,2.256927580919071e-5,1.987237287145151e-8,-8.62289189850553e-4,2.2281913356921493e-5,1.975006320331657e-8,-8.620677332013985e-4,2.195621272300181e-5,1.9612130462789248e-8,-8.617664966194991e-4,2.16277997444501e-5,1.9473928068892485e-8,-8.613902656342819e-4,2.1330954467429593e-5,1.935006757875441e-8,-8.609548908336364e-4,2.109389378252815e-5,1.9252475069560743e-8,-8.60484364617139e-4,2.0935189055747062e-5,1.9188905233103563e-8,-8.600071436128826e-4,2.086164348674763e-5,1.91620410767755e-8,-8.595522857630777e-4,2.086763182325774e-5,1.916920143547591e-8,-8.591457649603986e-4,2.0935595960451394e-5,1.9202563113239573e-8,-8.588070106868445e-4,2.103741778004402e-5,1.9249802291736785e-8,-8.585455278490724e-4,2.1136657572340328e-5,1.9295144248855717e-8,-8.583574459539792e-4,2.119206027325631e-5,1.9320951414396224e-8,-8.582223041875423e-4,2.1163256231024873e-5,1.9310193204886934e-8,-8.581015046639913e-4,2.1019633830437e-5,1.9250187621650533e-8,-8.579412331421961e-4,2.0752106826417253e-5,1.913751847356446e-8,-8.576831677947019e-4,2.0384459053393114e-5,1.898276909784322e-8,-8.572838524692297e-4,1.997686961930766e-5,1.8811952221028124e-8,-8.567366035007616e-4,1.9613260947646273e-5,1.8661045623987466e-8,-8.560824766647061e-4,1.9371935268362093e-5,1.8563376708157653e-8,-8.553990379155328e-4,1.9293084341216936e-5,1.8535706064271064e-8,-8.547703530167884e-4,1.936321412352537e-5,1.8571651992880513e-8,-8.542559556665059e-4,1.952555465174852e-5,1.864632532315067e-8,-8.538756727449201e-4,1.970687106733324e-5,1.8727989569739696e-8,-8.536133022643489e-4,1.9843141688829028e-5,1.8789169711081318e-8,-8.534305325201742e-4,1.989357508587466e-5,1.8812667709058706e-8,-8.532814843157356e-4,1.984307509264013e-5,1.879252452479186e-8,-8.531232008002682e-4,1.969807749884717e-5,1.8732068113313398e-8,-8.529215833508998e-4,1.9480194465247334e-5,1.864101205609392e-8,-8.526540395091069e-4,1.9220106769211913e-5,1.8532719999846374e-8,-8.523103008730304e-4,1.8952387630912345e-5,1.8421969114052342e-8,-8.518922166171214e-4,1.8711017815063302e-5,1.83230973754797e-8,-8.514126718644334e-4,1.8525339647629737e-5,1.8248378472723516e-8,-8.508935758492765e-4,1.8416482805648164e-5,1.820658103690855e-8,-8.503628746581636e-4,1.839451037204468e-5,1.8201787199229734e-8,-8.498506739728784e-4,1.8456726342008194e-5,1.823266217066025e-8,-8.493848597949864e-4,1.858755364818312e-5,1.8292382925859e-8,-8.489867877928165e-4,1.8760075533750793e-5,1.8369304773500778e-8,-8.486675197616957e-4,1.8939094885436825e-5,1.8448317961918758e-8,-8.484249414374999e-4,1.908551666785093e-5,1.8512794690847823e-8,-8.482420318448436e-4,1.9161892414962764e-5,1.854700959220887e-8,-8.480866947760388e-4,1.9139120485201888e-5,1.853898427741999e-8,-8.47914089849887e-4,1.9004229019293404e-5,1.8483705191242097e-8,-8.476729841454053e-4,1.8768219337488148e-5,1.8386304668266145e-8,-8.473174336537129e-4,1.847105600233066e-5,1.8264025543393118e-8,-8.46823043761053e-4,1.8178888378359918e-5,1.814493877116609e-8,-8.462024594710862e-4,1.7968779622830955e-5,1.8061442704564362e-8,-8.455100213327113e-4,1.790201857047041e-5,1.8039011781499097e-8,-8.44827387250912e-4,1.7997506299222376e-5,1.8085063263440332e-8,-8.442336473553949e-4,1.82219741246474e-5,1.8184995677384506e-8,-8.437761660142642e-4,1.8504766407932626e-5,1.8308588065556925e-8,-8.434584576481965e-4,1.8767662195956877e-5,1.842267679658266e-8,-8.4324815382798e-4,1.895151458304113e-5,1.8502419193258396e-8,-8.430953104809079e-4,1.9028223922689918e-5,1.853631028756183e-8,-8.429494942284543e-4,1.8998849917980934e-5,1.852528741826402e-8,-8.427701821877676e-4,1.8884905878580218e-5,1.8478909462789928E-08,-8.425307640973115e-4,1.8718917804788393e-5,1.8411232187863652e-8,-8.4221863676526e-4,1.853706175763964e-5,1.8337626368837928e-8,-8.418337179676496e-4,1.837420046907955e-5,1.827269721178165e-8,-8.413866423383756e-4,1.8260484347668602e-5,1.822893007494307e-8,-8.408968704231464e-4,1.8218648925198794e-5,1.821564458019552e-8,-8.403904546985228e-4,1.8261602613572497e-5,1.8238040596675744e-8,-8.398971047784783e-4,1.8390365569227584e-5,1.8296347683661744e-8,-8.394462933471349e-4,1.859286581010708e-5,1.8385307406524103e-8,-8.390625554693548e-4,1.8844349042141637e-5,1.849434016111365e-8,-8.387606740926772e-4,1.9109956838288736e-5,1.86086555425353e-8,-8.38541735765671e-4,1.934955354341349e-5,1.871133966197072e-8,-8.383910411803681e-4,1.9524369896896514e-5,1.8786212347626552e-8,-8.382786396254357e-4,1.9604517498810704e-5,1.882101552190826e-8,-8.381628606157513e-4,1.957613104080785e-5,1.8810378176449664e-8,-8.379968680478822e-4,1.9446885164135782e-5,1.8758024552986323e-8,-8.377380159940519e-4,1.924845999124919e-5,1.8677651607636933e-8,-8.373591718549969e-4,1.9034058927322546e-5,1.8591733411884385e-8,-8.368597531357094e-4,1.886904423475679e-5,1.8527502435010273e-8,-8.362722099438048e-4,1.881422597460021e-5,1.8509963766801086e-8,-8.356585036787218e-4,1.890516421021724e-5,1.8553367099453363e-8,-8.350935969910999e-4,1.913599743885326e-5,1.865465529485676e-8,-8.346403242080155e-4,1.945802313397077e-5,1.8793064946602195e-8,-8.34327545916489e-4,1.979670869488179e-5,1.893732043323308e-8,-8.341432058884843e-4,2.0079064624085877e-5,1.905704488089487e-8,-8.340443957116498e-4,2.0256813697895776e-5,1.9132370964305275e-8,-8.339762461212966e-4,2.0315496394862994e-5,1.915767659009268e-8,-8.338890176634837e-4,2.0269954024688864e-5,1.9139616310843984e-8,-8.337477088005211e-4,2.015310994528189e-5,1.9092327487425826e-8,-8.335344195487556e-4,2.0004740360878148e-5,1.9032641784256222e-8,-8.332464619472108e-4,1.9863456916696745e-5,1.897669433393755e-8,-8.328930721117551e-4,1.9762094713418337e-5,1.8938027533986976e-8,-8.32492297882966e-4,1.9725314418621403e-5,1.8926665101186917e-8,-8.32068415293489e-4,1.97681582273195e-5,1.8948588036477114e-8,-8.316495311428089e-4,1.9894810847537727e-5,1.900526818571205e-8,-8.312647852018803e-4,2.0097427747145573e-5,1.909320121864192e-8,-8.309406311115315e-4,2.0355522535096095e-5,1.9203660731413604e-8,-8.306961138447342e-4,2.0636898921431595e-5,1.9323105247655924e-8,-8.305378232200559e-4,2.0901137965268803e-5,1.9434664802670044e-8,-8.304559556956476e-4,2.1106081507306507e-5,1.9520878928693548e-8,-8.304232734093543e-4,2.121667553013109e-5,1.9567400873830927e-8,-8.303983658234531e-4,2.121422167099143e-5,1.9566836162855173e-8,-8.303333870477527e-4,2.1103220227911646e-5,1.952153119702011e-8,-8.301848490250651e-4,2.0913258553630374e-5,1.9444248405592745e-8,-8.299248979192241e-4,2.069466744819484e-5,1.935621254368111e-8,-8.295501421522738e-4,2.0508232040964325e-5,1.928269583340997e-8,-8.290853574454966e-4,2.0410715377186484e-5,1.9246942812164235e-8,-8.285801055587781e-4,2.0439332177392955e-5,1.9263794111536346e-8,-8.2809766077195e-4,2.059951905236773e-5,1.9334808940806114e-8,-8.276980402284858e-4,2.086083916102179e-5,1.944680759157122e-8,-8.274201421640853e-4,2.1164367562493242e-5,1.957510063623294e-8,-8.272700826664273e-4,2.1440488239337026e-5,1.9690891838981256e-8,-8.272211164209307e-4,2.163042771909038e-5,1.9770119508971764e-8,-8.272248984694739e-4,2.1702369405362463e-5,1.980002378644996e-8,-8.27228099796603e-4,2.1656229173428763e-5,1.9781034701150995e-8,-8.271868289199328e-4,2.151765544352276e-5,1.9724204114230814e-8,-8.270743741962598e-4,2.1326531390819485e-5,1.9646358599563786e-8,-8.26882219952542e-4,2.1125677324855516e-5,1.9565355735798533e-8,-8.266169368517766e-4,2.095292185174144e-5,1.94967870339568e-8,-8.262957480189584e-4,2.0836914464318622e-5,1.9452286083130493e-8,-8.25942474644233e-4,2.0795532754586838e-5,1.9438941053262905e-8,-8.255843718992038e-4,2.083550384946244e-5,1.9459206265133282e-8,-8.252495647333255e-4,2.095228065573517e-5,1.9510899184512012e-8,-8.249644062349847e-4,2.112985311313308e-5,1.958715392852858e-8,-8.247500865889223e-4,2.1340896571258705e-5,1.96765117319045e-8,-8.24618243855376e-4,2.1548299489712724e-5,1.9763583444848516e-8,-8.245661579256653e-4,2.1709369314150928e-5,1.983081139445514e-8,-8.245731982415894e-4,2.1783542272099323e-5,1.9861656355918796e-8,-8.246010337711906e-4,2.174293624505869e-5,1.9844932417100713e-8,-8.24599762693081e-4,2.1582829143363222e-5,1.9779092489063103e-8,-8.245199320168276e-4,2.1327443144663598e-5,1.9674559193285197e-8,-8.243271463267552e-4,2.1027056964939968e-5,1.9552443886955017e-8,-8.240137478913354e-4,2.0745880537874062E-05,1.9439417625111437e-8,-8.236027048837928e-4,2.054443207807126e-5,1.9360323569771445e-8,-8.231420981185931e-4,2.046260583006955e-5,1.9331166390175837e-8,-8.226923062309316e-4,2.050897293837082e-5,1.9354816716611825e-8,-8.223101620532402e-4,2.065914064149752e-5,1.9420558033546697e-8,-8.220346412416486e-4,2.0863033376546166e-5,1.9507310836051278e-8,-8.218778118280972e-4,2.1058697312165184e-5,1.958944171580837e-8,-8.218233231961076e-4,2.1188662210092975e-5,1.964349015093813e-8,-8.218326197553458e-4,2.1214125651217814e-5,1.9653903415513317e-8,-8.21856605729153e-4,2.112285109501725e-5,1.9616154125454246e-8,-8.218486723198633e-4,2.092896166987658e-5,1.9536534435121197e-8,-8.21774900682099e-4,2.0665900016862456e-5,1.9429164058162805e-8,-8.216189955439171e-4,2.0376078120981753e-5,1.9311669317101807e-8,-8.213819939742871e-4,2.010103213726683e-5,1.9201115798957357e-8,-8.210785719648872e-4,1.987447711399243e-5,1.911118281263017e-8,-8.20732153301422e-4,1.9718757169934105e-5,1.905076891931154e-8,-8.203703758138432e-4,1.964388881521585e-5,1.9023668998090353e-8,-8.200215277640998e-4,1.9647991667492965e-5,1.9028805308153496e-8,-8.197118007420141e-4,1.971813517172542e-5,1.906061049159396e-8,-8.194627667111748e-4,1.983118207998987e-5,1.910940136475893e-8,-8.192884188063901e-4,1.99548908795387e-5,1.9161861647232118e-8,-8.191914615513263e-4,2.005020377589606e-5,1.920200887423933e-8,-8.191593400069361e-4,2.0076033762683125e-5,1.92131658914827e-8,-8.191616964490206e-4,1.999753215727303e-5,1.9181325413606254e-8,-8.191520734989105e-4,1.9797250015148836e-5,1.909967483876304e-8,-8.190765586708921e-4,1.948575838000759e-5,1.8972896885336155e-8,-8.188893026085382e-4,1.9105659284594878e-5,1.881876618035338e-8,-8.185698549347501e-4,1.8723588649551148e-5,1.8664805935860888e-8,-8.181336800547649e-4,1.8410527065246534e-5,1.8540121068539456e-8,-8.176292682317155e-4,1.8218322499468568e-5,1.8465698823274743e-8,-8.171225750854558e-4,1.816336880244077e-5,1.844774602721915e-8,-8.166763753560664e-4,1.8224017124166648e-5,1.8476781130729858e-8,-8.163333375780404e-4,1.8350561857245017e-5,1.853193523194076e-8,-8.16107745214289e-4,1.8481632209535812e-5,1.8587831243527868e-8,-8.159860616604793e-4,1.8560533642340127e-5,1.8621333711184525e-8,-8.159338548044192e-4,1.8547406867931718e-5,1.8616474714546974e-8,-8.159059685028022e-4,1.8425544094309115e-5,1.856691337547998e-8,-8.158571772717478e-4,1.8201877478809365e-5,1.8475986230218312e-8,-8.157511568267292e-4,1.790263037304738e-5,1.8354797984609146e-8,-8.155662647845826e-4,1.756578402681822e-5,1.8219061692464088e-8,-8.152974777324008e-4,1.7232463817564305e-5,1.80855624276064e-8,-8.149548380423059e-4,1.6939285910434784e-5,1.79690735294896e-8,-8.14559552341495e-4,1.6713010048744217e-5,1.7880250136234366e-8,-8.141391520903434e-4,1.6567887899189816e-5,1.7824625038532265e-8,-8.13722894907782e-4,1.65052911686815e-5,1.7802510165505718e-8,-8.133380240113629e-4,1.6514764792978118e-5,1.7809448528021547e-8,-8.130068823177181e-4,1.6575692411162992e-5,1.7836899066496914e-8,-8.127444898746023e-4,1.6659173301351172e-5,1.787301036505299e-8,-8.12556110967037e-4,1.6730231029844328e-5,1.79035428156178e-8,-8.1243455505061e-4,1.6751012160459823e-5,1.7913194389418595e-8,-8.123576337801389e-4,1.6686038010803166e-5,1.7887740556088877e-8,-8.122873281432063e-4,1.6510317217035855e-5,1.7817300812807638e-8,-8.12173296759821e-4,1.6219656866485414e-5,1.7700472205744483e-8,-8.119633169768517e-4,1.5839706948872637e-5,1.754794502201198e-8,-8.116204935794114e-4,1.5427302108426434e-5,1.7382995748216617e-8,-8.111412381260521e-4,1.5058049525129414e-5,1.723638629723847e-8,-8.105632272728717e-4,1.4801145884299286e-5,1.713607209252042e-8,-8.099554919138893e-4,1.4692744717581516e-5,1.7096374287795603e-8,-8.093939263332287e-4,1.4722847634811913e-5,1.7112747706322244e-8,-8.089353936498745e-4,1.484233801753127e-5,1.7164799969601408e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_6.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_6.json deleted file mode 100644 index de223822..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_6.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":6000,"numberOfSamples":1000,"samples":[-8.086030009769924e-4,1.4983810405869992e-5,1.7224897231104907e-8,-8.083859978917138e-4,1.5083891420443416e-5,1.7267300877946733e-8,-8.082495498012613e-4,1.5098334698112563e-5,1.727428602498279e-8,-8.08147627922185e-4,1.5007880436382382e-5,1.72384405012867e-8,-8.080344588306433e-4,1.4817024022017442e-5,1.716203842239244e-8,-8.078727223656254e-4,1.4548770451198794e-5,1.705477562558989e-8,-8.076383715174149e-4,1.4237727414253643e-5,1.6930867623711068e-8,-8.07322519250199e-4,1.3922902257012772e-5,1.6806096847405343e-8,-8.069308512481781e-4,1.3641062334595963e-5,1.6695163186853533e-8,-8.064810674365431e-4,1.3421371907981373e-5,1.6609600165603765e-8,-8.059989962711845e-4,1.3281793410593358e-5,1.65564122262766e-8,-8.055140919096513e-4,1.3227437282497666e-5,1.6537470119423336e-8,-8.050550211507427e-4,1.3250758311506548e-5,1.654960752689265e-8,-8.046459011976815e-4,1.3333167640947059e-5,1.658525704041747e-8,-8.04303377210941e-4,1.3447472960351647e-5,1.6633415280209964e-8,-8.040343930544604e-4,1.3560785131852206e-5,1.6680814883554258e-8,-8.038344371049681e-4,1.3637887698738715e-5,1.6713305884428016e-8,-8.036861808400415e-4,1.3645376246194308e-5,1.6717552173535383e-8,-8.035588881624019e-4,1.355715046434086e-5,1.668324932697258e-8,-8.034098545481887e-4,1.3361633179672876e-5,1.660599824235996e-8,-8.031899161995416e-4,1.3069806636622722e-5,1.6490473396248044e-8,-8.028548171317579e-4,1.2720836118968e-5,1.635260915989386e-8,-8.023817298130074e-4,1.2379672673151174e-5,1.6218567533971117e-8,-8.017848916609258e-4,1.21214866090865e-5,1.6118432225501397e-8,-8.011195394685814e-4,1.2004672862047483e-5,1.6075358566152277e-8,-8.004664161243661e-4,1.2045064498369676e-5,1.6095295025865495e-8,-7.999018683719954e-4,1.2207888551202842e-5,1.6163899894807838e-8,-7.994702224832471e-4,1.242340488168506e-5,1.625294935668257e-8,-7.991732540075557e-4,1.2615665237930678e-5,1.6331930886767175e-8,-7.989782632286061e-4,1.2727385321542004e-5,1.6378010390939176e-8,-7.988353176257354e-4,1.2731278778766297e-5,1.6380533700705246e-8,-7.98693545654588e-4,1.262891363153558e-5,1.6340492793338305e-8,-7.985117563218257e-4,1.2443008649451221e-5,1.6267331548458157e-8,-7.982633092416262e-4,1.2208291416633506e-5,1.617517573988445e-8,-7.97937024226046e-4,1.1963551111059878e-5,1.6079587401967125e-8,-7.975359220318068e-4,1.1745517867734186e-5,1.5995123017000115e-8,-7.970748169146011e-4,1.1584298423249006e-5,1.5933578635139873e-8,-7.96577147084504e-4,1.1500116000004205e-5,1.59027823489698e-8,-7.960712612774264e-4,1.1501312858278244e-5,1.5905873133149612e-8,-7.955863788122124e-4,1.1583659586297626e-5,1.5941057128577827e-8,-7.951485028139105e-4,1.1731083070377464e-5,1.6001886167851592e-8,-7.947767272267163e-4,1.191780985300591e-5,1.607808021319529e-8,-7.944803671342594e-4,1.2111620389700717e-5,1.615680382240154e-8,-7.942570988685387e-4,1.2277833661532118e-5,1.622426162217438e-8,-7.940921495251726e-4,1.2383811890041994e-5,1.6267523534675877e-8,-7.939586304605242e-4,1.2403888228974189e-5,1.627651653757225e-8,-7.938193280601158e-4,1.2324675476991541e-5,1.6246136706354253e-8,-7.936307142675456e-4,1.2150538325271284e-5,1.6178380649204796e-8,-7.933502814410618e-4,1.1908091876990174e-5,1.608405253597014e-8,-7.929477558193591e-4,1.164701184564693e-5,1.5982993948326116e-8,-7.924185834346178e-4,1.1433225812865484e-5,1.5901308272972388e-8,-7.91794201526995e-4,1.1331683271163489e-5,1.5864503448445484e-8,-7.911404620961953e-4,1.1381697803054312e-5,1.5887775959579784e-8,-7.905387505296019e-4,1.1576581858174432e-5,1.5968081661271605e-8,-7.900557579253249e-4,1.1862063556780149e-5,1.6083659449037498e-8,-7.897185238722374e-4,1.2157584885353175e-5,1.6202533533502623e-8,-7.895090488599649e-4,1.238821600505574e-5,1.629512295943271e-8,-7.893784662655317e-4,1.2508703453700893e-5,1.6343711956180873e-8,-7.892687928634058e-4,1.2510154891614356e-5,1.6345059350363414e-8,-7.891303130012338e-4,1.2412762325594466e-5,1.630746636423513e-8,-7.889301607306106e-4,1.22532563576661e-5,1.6245726990312346e-8,-7.886537075923972e-4,1.207350096757021e-5,1.6176528951831164e-8,-7.883021088407754e-4,1.1912612868365128e-5,1.611529698390703e-8,-7.878886554381245e-4,1.1802366938175958e-5,1.6074404646753326e-8,-7.874351827903575e-4,1.1764678405500699e-5,1.606225725212218e-8,-7.869686785579548e-4,1.1810193745663737e-5,1.6082821884922013e-8,-7.865178808041266e-4,1.1937644143326378e-5,1.613543027797478e-8,-7.861097334099989e-4,1.2134002375285157e-5,1.621485643068633e-8,-7.857657050956631e-4,1.2375715139896458e-5,1.631178566628287e-8,-7.854982761710509e-4,1.2631342722271491e-5,1.6413830995212057e-8,-7.853082129742637e-4,1.2865627763957707e-5,1.650712800670973e-8,-7.851832404152557e-4,1.3044611801087987e-5,1.6578365268496393e-8,-7.850984979333072e-4,1.3141234772513003e-5,1.661701655440917e-8,-7.850189859904393e-4,1.314074642924285e-5,1.6617484545055545e-8,-7.849040783473408e-4,1.3045167089176555e-5,1.658083277620777e-8,-7.847140887854131e-4,1.2875989940709468e-5,1.6515781106734278e-8,-7.84418739673568e-4,1.2674020385660439e-5,1.643854403323704e-8,-7.840067264380274e-4,1.2494690124657561e-5,1.637089555624342e-8,-7.834940629310338e-4,1.2397202649814611e-5,1.633586078646625e-8,-7.829269123445694e-4,1.242762480633356e-5,1.6351121218225165e-8,-7.823738580167101e-4,1.2600199243328678e-5,1.6421819173272966e-8,-7.819059640317111e-4,1.2886068491034284e-5,1.6536310251172648e-8,-7.815711190078477e-4,1.3218908359013295e-5,1.6668481029581357e-8,-7.813760467322517e-4,1.3518369457025356e-5,1.678692018769316e-8,-7.812866097556989e-4,1.3719738169680302e-5,1.6866455278038853e-8,-7.81245043675736e-4,1.3793772038801468e-5,1.689586528796916e-8,-7.811924892995569e-4,1.3748855436262393e-5,1.6878708749903426e-8,-7.810853126995724e-4,1.3619700644445478e-5,1.6828864667497608e-8,-7.809012145161698e-4,1.3452099763330615e-5,1.6764485192192976e-8,-7.806376216935296e-4,1.3290653946538645e-5,1.6703112676782687e-8,-7.803066615377375e-4,1.31716120529323e-5,1.6658847878700447e-8,-7.799298430182615e-4,1.311988593603372e-5,1.6641219568441624e-8,-7.795337437080761e-4,1.3148379669826384e-5,1.665500141543589e-8,-7.791466519745774e-4,1.3258192670318894e-5,1.6700371540229692e-8,-7.787956166079658e-4,1.3439123013885566e-5,1.6773161126941902e-8,-7.785034521569552e-4,1.3670540636302536e-5,1.6865211246133127e-8,-7.782855194761558e-4,1.3923070098588027e-5,1.6965022456657025e-8,-7.781465158733033e-4,1.4161671472159447e-5,1.705894395665733e-8,-7.780780274644127e-4,1.4350439747166847e-5,1.713304166764391e-8,-7.780578724819625e-4,1.4458808126371696e-5,1.717552433911576e-8,-7.780520945693767e-4,1.4468165316748068e-5,1.7179332308174036e-8,-7.780199264883032e-4,1.4377381074197417e-5,1.7144283672725583e-8,-7.779212697790456e-4,1.42055818063788e-5,1.707811591367681e-8,-7.777254715128031e-4,1.399092160934568e-5,1.6995928407681764e-8,-7.774196852037493e-4,1.37848241088391e-5,1.691784077706239e-8,-7.770148281025337e-4,1.3641905255902624e-5,1.68649932739021e-8,-7.7654695118254e-4,1.3606723344494496e-5,1.6854386908037733e-8,-7.760719733956719e-4,1.3699981752654324e-5,1.6893614104122298e-8,-7.756528920660803e-4,1.3908611710779359e-5,1.6977171984468366e-8,-7.753414973715193e-4,1.4185135339496087e-5,1.708636928482128e-8,-7.751607783545031e-4,1.4459758828692502e-5,1.7194078255654558e-8,-7.750965022472446e-4,1.4662655192892729e-5,1.7273331572288793e-8,-7.751031768498831e-4,1.4747011345581016e-5,1.730618293517172e-8,-7.751215862559233e-4,1.4701900854900151e-5,1.7288656969080978e-8,-7.750986283316115e-4,1.45502732264208e-5,1.7229950783472687e-8,-7.750005720993924e-4,1.4336090541435382e-5,1.714739884303355e-8,-7.748166257563864e-4,1.4108830030091316e-5,1.7060381671628664e-8,-7.74555246270904e-4,1.3911680743308552e-5,1.6985680755460048e-8,-7.742375216046733e-4,1.3775437312394145e-5,1.6935101840957774e-8,-7.738908672395347e-4,1.3716934985120997e-5,1.691492118059338e-8,-7.735443296708602e-4,1.373987657547806e-5,1.6926288994825302e-8,-7.732253688257358e-4,1.3836379992091725e-5,1.6965903557041073e-8,-7.729574201870145e-4,1.398850143961783e-5,1.702664562074045e-8,-7.727575479089458e-4,1.41697546103367e-5,1.7098179346093112e-8,-7.726338127068317e-4,1.4347167415583573e-5,1.7167741915981117e-8,-7.72582526013079e-4,1.4484672906976143e-5,1.7221441721592798e-8,-7.725862452751478e-4,1.4548420666369706e-5,1.724630156120042e-8,-7.726138958417847e-4,1.4513823225779425e-5,1.723297684502607e-8,-7.726244080267737e-4,1.4372974279860863e-5,1.717861929269323e-8,-7.725743889406402e-4,1.4139927504773041e-5,1.708890500581759e-8,-7.724286327675101e-4,1.3851021527237483e-5,1.6978122122320604e-8,-7.721705055599232e-4,1.3558663671444288e-5,1.6866694872960056e-8,-7.718085762849863e-4,1.3319387181004731e-5,1.6776479385700888e-8,-7.713767987397502e-4,1.3179295367351444e-5,1.6725086614472134e-8,-7.709275714331829e-4,1.3161122848693512e-5,1.6720920077215314e-8,-7.705191844169844e-4,1.3256827859980563e-5,1.6760442718757147e-8,-7.702008063045723e-4,1.3428227793557443e-5,1.6828582942267516e-8,-7.699990644679152e-4,1.361618554202354e-5,1.6902388068197547e-8,-7.699104039245936e-4,1.3756467861176603e-5,1.6957151603506948e-8,-7.699023224946573e-4,1.3797806695198463e-5,1.697331252819716e-8,-7.69923693570122e-4,1.3715970518988264e-5,1.6941802014512077e-8,-7.699204730517889e-4,1.3518607018056203e-5,1.686585566047806e-8,-7.698506029324883e-4,1.3239647040700348e-5,1.675881321149357e-8,-7.696928309426752e-4,1.292679553392078e-5,1.663924458294889e-8,-7.694477547487295e-4,1.2627916951666916e-5,1.6525649634657365e-8,-7.691330174202381e-4,1.2380977939982187e-5,1.6432564147368763e-8,-7.687761526504343e-4,1.2209237379755138e-5,1.6368739832210366e-8,-7.684079653894965e-4,1.2120781661778011e-5,1.633703602331063e-8,-7.680577369530784e-4,1.2110432408898472e-5,1.6335228492463344e-8,-7.677501944254693e-4,1.21623329271923e-5,1.6357054465017322e-8,-7.675035516029946e-4,1.2252353588631538e-5,1.6393155437041988e-8,-7.673278510063229e-4,1.2350244031443248e-5,1.6431898304259127e-8,-7.672231013092557e-4,1.2422047112441263e-5,1.6460286860244704e-8,-7.671772688900853e-4,1.243363156115782e-5,1.6465302548663993e-8,-7.671649640707796e-4,1.2356108383738767e-5,1.6435971563363704e-8,-7.671484101972802e-4,1.2173134658280302e-5,1.6366160768870968e-8,-7.670825263514741e-4,1.188858814480631e-5,1.6257519307403445e-8,-7.669249561884815e-4,1.153125860759139e-5,1.6121270567197454e-8,-7.666492306156377e-4,1.115245465159126e-5,1.5977261511360678e-8,-7.662560978121537e-4,1.0814456656206232e-5,1.5849466079461248e-8,-7.657770512027595e-4,1.05724402594284e-5,1.5758977593618244e-8,-7.65267023298901e-4,1.0456872508954073e-5,1.571723833544501e-8,-7.647885985095952e-4,1.0463873633946137e-5,1.5722417018223885e-8,-7.643941100002343e-4,1.0557097979145212e-5,1.5760262592280024e-8,-7.641121194876584e-4,1.0679365871370066e-5,1.580868049828012e-8,-7.639418824019487e-4,1.0769014504534602e-5,1.5844044262621295e-8,-7.63856040874777e-4,1.0775642632836637e-5,1.5847200884499e-8,-7.638095816807227e-4,1.067134664327151e-5,1.5807708446849496e-8,-7.637520719001363e-4,1.0455341968064698e-5,1.5725533933861105e-8,-7.636398633410946e-4,1.015159717703648e-5,1.5610082730947348e-8,-7.634452271731003e-4,9.80080001717917e-6,1.547706895850993e-8,-7.63160419406769e-4,9.449412193445568e-6,1.5344290126782374e-8,-7.627963935193374e-4,9.13916163473737e-6,1.522760366709052e-8,-7.623775983584871e-4,8.899634906261868e-6,1.5138131787055436e-8,-7.619351862275943e-4,8.745021320744058e-6,1.5081084100568852e-8,-7.615007251523846e-4,8.674467790722235e-6,1.50559612980206E-08,-7.611015754607918e-4,8.674636046522299e-6,1.5057573206547553e-8,-7.607580727699104e-4,8.723012138457471e-6,1.507730793528806e-8,-7.604819845856674e-4,8.79104729455283e-6,1.5104310215033872e-8,-7.602755220059144e-4,8.84693302571431e-6,1.512651308174354e-8,-7.60130395955743e-4,8.858401879917029e-6,1.5131688225382546e-8,-7.600268787531797e-4,8.796280560370882e-6,1.5108794499177295e-8,-7.599335469922736e-4,8.639531259323042e-6,1.5049899963453894e-8,-0.000759809210702789,8.381910431287344e-6,1.495271925500096e-8,-7.596089689111743e-4,8.038852722231386e-6,1.4823230368913413e-8,-7.592954714676379e-4,7.651012523481406e-6,1.4677004696445236e-8,-7.588534536653339e-4,7.279557888325591e-6,1.4537373653592984e-8,-7.583012167940397e-4,6.990438849818558e-6,1.4429384557414762e-8,-7.576907836367265e-4,6.831496399448591e-6,1.4371061617021388e-8,-7.570930731261787e-4,6.813281142864784e-6,1.4366159181078007e-8,-7.56573893838745e-4,6.904553518906711e-6,1.440256548875904e-8,-7.561728030269616e-4,7.044803405478948e-6,1.445716559337654e-8,-7.55894167206311e-4,7.166043359666975e-6,1.450415417168199e-8,-7.55711412564325e-4,7.212993883249746e-6,1.4522671727194704e-8,-7.555791656848098e-4,7.1549930276133835e-6,1.4501273602714309e-8,-7.554470640511585e-4,6.988776194001312e-6,1.443893097512812e-8,-7.552712370159999e-4,6.734529749762169e-6,1.4343479112262025e-8,-7.550218631592772e-4,6.428246653777687e-6,1.422866437274883e-8,-7.546866678361489e-4,6.112788824185316e-6,1.4110719482184918e-8,-7.542707923333388e-4,5.8292867079302145e-6,1.400510243390426e-8,-7.537936783321645e-4,5.610111184424559e-6,1.392387568318107e-8,-7.532839358400108e-4,5.474383321977379e-6,1.3874075234006555e-8,-7.527734587962739e-4,5.42640635004478e-6,1.3857186797906472e-8,-7.522919859404003e-4,5.45669894844625e-6,1.386957766596827e-8,-7.518629339501932e-4,5.544851652733658e-6,1.3903575419281547e-8,-7.515008253699221e-4,5.66324214311497e-6,1.3948838400251825e-8,-7.51210094786353e-4,5.780767390543559e-6,1.3993723032625362e-8,-7.509847483529711e-4,5.866229168685598e-6,1.4026532943938554e-8,-7.508084438557491e-4,5.891537175053618e-6,1.4036723339664531e-8,-7.506548991499108e-4,5.835186884660035e-6,1.4016225902040902e-8,-7.504890649576297e-4,5.6865153995048614e-6,1.3961069522205696e-8,-7.502702069824309e-4,5.450810519333698e-6,1.3873309470797243e-8,-7.499584705215199e-4,5.154093641144201e-6,1.376281194863296e-8,-7.495258303846799e-4,4.844492327076601e-6,1.3647730610076522e-8,-7.489697010459084e-4,4.585680212391129e-6,1.3551982235163058e-8,-7.483229773845283e-4,4.439424944083938e-6,1.3498642646116442e-8,-7.47651384167147e-4,4.441135789993236e-6,1.3500781498633393e-8,-7.47033630108719e-4,4.5810783550153105e-6,1.3554518828823992e-8,-7.465319640685318e-4,4.8048662841334895e-6,1.3639340521473976e-8,-7.461696806020518e-4,5.035072310667735e-6,1.3726250888424918e-8,-7.45927649234082e-4,5.200984456189078e-6,1.3788876550238137e-8,-7.457581262680648e-4,5.260058265685222e-6,1.3811432021938078e-8,-7.456046602651826e-4,5.203880705388684e-6,1.3790914319102578e-8,-7.454181631269655e-4,5.052110434397819e-6,1.373481274651468e-8,-7.451656280700271e-4,4.841472760620587e-6,1.3656958068869079e-8,-7.448325507537849e-4,4.61494382342504e-6,1.357343640410499e-8,-7.444214445461733e-4,4.413322175715639e-6,1.3499417669267064e-8,-7.439484346229335e-4,4.2694368736615086e-6,1.3447009746671435e-8,-7.434389857049532e-4,4.204518303627032e-6,1.3423957631836567e-8,-7.429232000552066e-4,4.22642353337615e-6,1.3433047936838739e-8,-7.424310713391792e-4,4.3296407656193255e-6,1.3472159698785832e-8,-7.419881612882491e-4,4.496920195240808e-6,1.3534885426142835e-8,-7.416121363128246e-4,4.702242436589464e-6,1.3611614172495427e-8,-7.413105280088105e-4,4.9146848337064315e-6,1.369092983616905e-8,-7.410798564648585e-4,5.102579289552534e-6,1.3761123342581654e-8,-7.409059284613239e-4,5.2374620959614515e-6,1.3811649751762265e-8,-7.40765021747722e-4,5.2976581500819286e-6,1.3834473325427858e-8,-7.406258251361314e-4,5.271569720175211e-6,1.3825313013330133e-8,-7.404522940607082e-4,5.16079816624066e-6,1.3784817350730312e-8,-7.402080188256512e-4,4.982998369865964e-6,1.3719616164717567e-8,-7.398629579022926e-4,4.773502162654375e-6,1.3642888630399176e-8,-7.394027814983437e-4,4.583451075155526e-6,1.3573616754794363e-8,-7.388391120671625e-4,4.471358391383276e-6,1.3533406453527241e-8,-7.382156353710173e-4,4.486293417993243e-6,1.3540246689754017e-8,-7.376025584177996e-4,4.646263952038066e-6,1.360057244394542e-8,-7.370753966750942e-4,4.923220958661702e-6,1.3703844593894654e-8,-7.366853493943496e-4,5.247831278658755e-6,1.3824412277992002e-8,-7.364384127765779e-4,5.535851078356583e-6,1.3931243008841947e-8,-7.362964904189415e-4,5.721421847439438e-6,1.400013251189647e-8,-7.361977969831083e-4,5.777834083495166e-6,1.4021317172913075e-8,-7.360817614101209e-4,5.717840477241389e-6,1.3999596259483795e-8,-7.359055977095308e-4,5.580085272187351e-6,1.3949330970951832e-8,-7.356494891230436e-4,5.412741838724204e-6,1.3888375540751401e-8,-7.353140711726487e-4,5.2611317114854454e-6,1.3833462198014537e-8,-7.349148352444343e-4,5.160747629068616e-6,1.3797605620566516e-8,-7.34476381499244e-4,5.134402307300587e-6,1.378907362699951e-8,-7.340275945238301e-4,5.1916865952263e-6,1.3811240956866352e-8,-7.335976379390709e-4,5.3295409738639065e-6,1.386285790594125e-8,-7.332124264851362e-4,5.533583318487555e-6,1.393857552488052e-8,-7.328914883847182e-4,5.780224195792896e-6,1.4029729175094004e-8,-7.326453464977734e-4,6.039657534633526e-6,1.412541622107681e-8,-7.324737353478441e-4,6.279722160979335e-6,1.4213885118568412e-8,-7.323650721376349e-4,6.470322863277057e-6,1.4284138014656952e-8,-7.322974036581984e-4,6.587844288483066e-6,1.4327549734585913e-8,-7.322407659586676e-4,6.619032470350085e-6,1.4339305787613665e-8,-7.321607813179032e-4,6.563928060747684e-6,1.4319492082724502e-8,-7.320233046863541e-4,6.4374966021072834e-6,1.4273690279829042e-8,-7.317999978283977e-4,6.269641412024475e-6,1.4212954276300681e-8,-7.314747508146167e-4,6.103003158628865e-6,1.415295567438129e-8,-7.310503956340962e-4,5.987372946262786e-6,1.4111888222525968e-8,-7.30553886574779e-4,5.969501086118192e-6,1.4106716472582734e-8,-7.300364338939657e-4,6.078516230287104e-6,1.4147877299553037e-8,-7.295642924788504e-4,6.3107236580662384e-6,1.4233817360402606e-8,-7.29198788762624e-4,6.622175486804494e-6,1.4348383535941494e-8,-7.289720333664855e-4,6.9380135239147e-6,1.4464270004578152e-8,-7.288720132220635e-4,7.178968146684719e-6,1.4552629285696456e-8,-7.288478475491566e-4,7.292033122646066e-6,1.4594189017363577e-8,-7.288324425920637e-4,7.267653302542506e-6,1.4585519239748402e-8,-7.287681356467766e-4,7.1358561174840265e-6,1.4537665753835853e-8,-7.286220514824529e-4,6.9483598487620115e-6,1.4469630977301123e-8,-7.28388085845522e-4,6.7592678922152605e-6,1.4401275496516345e-8,-7.280804913481166e-4,6.612273121504457e-6,1.4348581630811597e-8,-7.277252407959589e-4,6.5354231757555416e-6,1.4321716844225746e-8,-7.273527660572583e-4,6.540950211029966e-6,1.4324997142073501e-8,-7.269930114233965e-4,6.6273182842564705e-6,1.4357691570767854e-8,-7.26672240266485e-4,6.781718300136292e-6,1.4414990002890305e-8,-7.264107154812758e-4,6.982473886382033e-6,1.4488915944389668e-8,-7.262207318281119e-4,7.201524453767113e-6,1.4569238469116222e-8,-7.261048945983162e-4,7.407366857871365e-6,1.464452799757507e-8,-7.260549073749619e-4,7.568797659062485e-6,1.4703494431167381e-8,-7.26051465526772e-4,7.659436861891897e-6,1.4736614332348274e-8,-7.260658689683676e-4,7.662469338693832e-6,1.4737849783051846e-8,-7.260636091525101e-4,7.574690894230019e-6,1.4706123818166879e-8,-7.260097162467727e-4,7.408843381596091e-6,1.4646170303919831e-8,-7.258751869359084e-4,7.193327753172565e-6,1.4568414770672015e-8,-7.256434329193616e-4,6.968816351578809e-6,1.4487705994885722e-8,-7.253155606930208e-4,6.781829885047062e-6,1.4420936000282275e-8,-7.249132562182546e-4,6.6756763505280914e-6,1.4383719471977372e-8,-7.244778292372096e-4,6.679612946037396e-6,1.438647617104953e-8,-7.240638597492315e-4,6.798235959896041e-6,1.443065370266917e-8,-7.237266826504071e-4,7.004766318589259e-6,1.4506391489857573e-8,-7.235054613225411e-4,7.243025516191428e-6,1.4593301323513466e-8,-7.2340765660686e-4,7.441405783647142e-6,1.4665511557876749e-8,-7.234034010785615e-4,7.53631382926181e-6,1.4700082991218885e-8,-7.234351925205399e-4,7.495034347391305e-6,1.468523799630331e-8,-7.234393429224217e-4,7.325932982914151e-6,1.462407472647779e-8,-7.233679091640017e-4,7.071240070168453e-6,1.4531993918580552e-8,-7.2320061796834e-4,6.7884821942071435e-6,1.4429962503804012e-8,-7.229442000740695e-4,6.531515408382787e-6,1.4337580335722595e-8,-7.226237824510028e-4,6.338676971745417e-6,1.4268730878278133e-8,-7.222726609371696e-4,6.229186086844068e-6,1.4230270463511608e-8,-7.219243370456767e-4,6.204979076589403e-6,1.4222735101428858e-8,-7.216077209136364e-4,6.254637305234233e-6,1.424182454315981e-8,-7.213447052154808e-4,6.357313551246988e-6,1.427987548429127e-8,-7.211489353260135e-4,6.485977719230195e-6,1.432706196354135e-8,-7.210249390732579e-4,6.610178726644471e-6,1.4372391800318248e-8,-7.209673047686168e-4,6.69888928465445e-6,1.440471413451235e-8,-7.209601280974389e-4,6.7240278150433335e-6,1.4413965009805703e-8,-7.20977427897608e-4,6.664882671759e-6,1.4392744472576701e-8,-7.209854343714221e-4,6.51295128433434e-6,1.4338056762127022e-8,-7.209473640933031e-4,6.27595967171071e-6,1.4252764848687728e-8,-7.20830498270342e-4,5.979351536502665e-6,1.4146129546232638e-8,-7.206142541252474e-4,5.663667819126294e-6,1.4032848951131945e-8,-7.202969652261338e-4,5.377288241995543e-6,1.3930404038766788e-8,-7.198989165010806e-4,5.1656853148451214e-6,1.3855144520274798e-8,-7.194600346572165e-4,5.059761967389392e-6,1.381807600558674e-8,-7.190320840484526e-4,5.066413372274996e-6,1.3821501796020195e-8,-7.186667008859963e-4,5.164217116728777e-6,1.3857550892980985e-8,-7.184018625214499e-4,5.306290101127747e-6,1.3909277458429183e-8,-7.182503872805278e-4,5.430848543585556e-6,1.3954476928807232e-8,-7.181945402363831e-4,5.477745639924967e-6,1.3971593615188382e-8,-7.181899363308149e-4,5.406401461740874e-6,1.3946114620028615e-8,-7.181787956068019e-4,5.208432912413644e-6,1.3875092760960466e-8,-7.181080232052682e-4,4.909307597908525e-6,1.3767756999698908e-8,-7.179446434546303e-4,4.558250395919083e-6,1.3641890350548404e-8,-7.176825410055812e-4,4.2115104900122955e-6,1.3517783575060329e-8,-7.173394303115774e-4,3.9166207270580965e-6,1.3412530864261023e-8,-7.169476918402883e-4,3.7030604472824477e-6,1.3336657086835069e-8,-7.165441754546074e-4,3.5802790936875876e-6,1.3293434686648582e-8,-7.161624370313028e-4,3.540740334466443e-6,1.3280030267105057e-8,-7.158283342384227e-4,3.5648889198243974e-6,1.3289336702046267e-8,-7.155582446948228e-4,3.6259309695520506e-6,1.3311712356351884e-8,-7.153587035969551e-4,3.6936410852722728e-6,1.3336343509346127e-8,-7.152264834437153e-4,3.7373251672731826e-6,1.3352284086218272e-8,-7.151486443905965e-4,3.7285507918335262e-6,1.3349406474614047e-8,-7.151027106872547e-4,3.6443643170977546e-6,1.3319531867733131e-8,-7.150577088567976e-4,3.471371309569102e-6,1.3257885044742072e-8,-7.149771233861474e-4,3.2102934517910352e-6,1.3164734543938834e-8,-7.148246566289133e-4,2.879607352494538e-6,1.304671174381637e-8,-7.145727155168279e-4,2.5159715205526265e-6,1.2916970172838227e-8,-7.14211741474117e-4,2.1691340011926946e-6,1.2793345447593278e-8,-7.13756704294834e-4,1.8907340958244058e-6,1.2694309938959155e-8,-7.13246867286023e-4,1.7195895090076379e-6,1.263368292154631e-8,-7.127372110269032e-4,1.6687917986243744e-6,1.2616035558109819e-8,-7.122837106314069e-4,1.7200599947476228e-6,1.2634736954970411e-8,-7.11927625851379e-4,1.8279231828251246e-6,1.2673513419775649e-8,-7.116842639270483e-4,1.9322272870562014e-6,1.2710931582090524e-8,-7.115395372739504e-4,1.9745795969288553e-6,1.2726232447310445e-8,-7.114547557725002e-4,1.9136654302389338e-6,1.270474472926178e-8,-7.113777961538001e-4,1.735292690655213e-6,1.2641441637291946e-8,-7.112572859060644e-4,1.4546876493828617e-6,1.2541763992937194e-8,-7.110556761496227e-4,1.1107338000528394e-6,1.2419577806846834e-8,-7.107574398631749e-4,7.542984399074633e-7,1.2293006190122626e-8,-7.103703854584871e-4,4.3467766591549663e-7,1.2179579666103922e-8,-7.099206413352514e-4,1.8848792044254664e-7,1.209227121863942e-8,-7.094440058956009e-4,3.38112439872334e-8,1.2037433652280913e-8,-7.089770272256449e-4,-3.005946575574514e-8,1.2014751159396523e-8,-7.085502677011695e-4,-1.8942666134325098e-8,1.2018584823579895e-8,-7.081845728037587e-4,4.1504324056836106e-8,1.2039859175127503e-8,-7.078898530136206e-4,1.2085396250360532e-7,1.2067846450829226e-8,-7.07665357590904e-4,1.8796389173417595e-7,1.2091574008084617e-8,-7.075005062641622e-4,2.1404627281451953e-7,1.2100880394544461e-8,-7.073757642706145e-4,1.7527949313218791e-7,1.2087321949694448e-8,-7.072636271028598e-4,5.563556618695607e-8,1.2045175593473184e-8,-7.07130371455471e-4,-1.496666377152965e-7,1.1972682276401499e-8,-7.069396260706627e-4,-4.3038263800395507e-7,1.1873415802529695e-8,-7.06658736467273e-4,-7.585342773530107e-7,1.1757266370952408e-8,-7.062679103912365e-4,-1.0893111587869973e-6,1.164011958067034e-8,-7.057699493448573e-4,-1.3683565279279107e-6,1.1541242460665835e-8,-7.051958014848092e-4,-1.546143275736306e-6,1.1478149826314971e-8,-7.046006461074884e-4,-1.5955509000684547e-6,1.1460378253613378e-8,-7.040489785775769e-4,-1.5244730508863847e-6,1.1485082661954835e-8,-7.035938487042454e-4,-1.3758182686775965e-6,1.1537113738876136e-8,-7.032597812034259e-4,-1.2137575651664247e-6,1.1593901613711014e-8,-7.030369079407669e-4,-1.1027795845962554e-6,1.1632801609042198e-8,-7.028872532957906e-4,-1.0889580682558247e-6,1.1637630789638363e-8,-7.027584678100196e-4,-1.1897271998792792e-6,1.1602238033439061e-8,-7.025988796732991e-4,-1.3932883666335377e-6,1.1530725736851102e-8,-7.02369467900341e-4,-1.6652872066721532e-6,1.1435125811886794e-8,-7.020507465969052e-4,-1.959328698109832e-6,1.1331711320640786e-8,-7.016442939978633e-4,-2.2282184952551496e-6,1.1237034626369414e-8,-7.011697035243303e-4,-2.4335618600813347e-6,1.1164544945400339e-8,-7.006583801112918e-4,-2.5521150452073807e-6,1.1122365961218336e-8,-7.001460060304543e-4,-2.5781375982917395e-6,1.1112496075816941e-8,-6.996655112290227e-4,-2.5220161431554106e-6,1.1131319063948755e-8,-6.992418776281199e-4,-2.4062965783673872e-6,1.1171004748331547e-8,-6.988893060139256e-4,-2.260591788360715e-6,1.1221277939326513e-8,-6.986105278643894e-4,-2.1166353920163535e-6,1.1271116834225942e-8,-6.983975667488254e-4,-2.0042272969958953e-6,1.1310137596645092e-8,-6.982331775114807e-4,-1.948167868728002e-6,1.1329646935505253e-8,-6.980924984224593e-4,-1.9658036073505293e-6,1.1323502940205919e-8,-6.979449169280985e-4,-2.064692866216944e-6,1.128895545665963e-8,-6.977566158534427e-4,-2.240091878769088e-6,1.1227562045779688e-8,-6.974946560896657e-4,-2.4725062008836e-6,1.1146078731656455e-8,-6.971334322778307e-4,-2.7265579611108132e-6,1.1056870056968845e-8,-6.966634001809645e-4,-2.9535495920723803e-6,1.0976992639682918e-8,-6.960998225694706e-4,-3.1003923112501523e-6,1.0925024976391107e-8,-6.954864809875409e-4,-3.125514095301827e-6,1.0915470365326537e-8,-6.94888405730523e-4,-3.0171655312078273e-6,1.0952385872816837e-8,-6.943721615170897e-4,-2.8040956720319907e-6,1.1025740558355747e-8,-6.939812476892919e-4,-2.5493950355256136e-6,1.111363121856989e-8,-6.937199582600355e-4,-2.328052856844355e-6,1.119007794880418e-8,-6.935545525919977e-4,-2.199995786806156e-6,1.123431816683279e-8,-6.93429179173718e-4,-2.1924546956316556e-6,1.1236874298485071e-8,-6.932862200777068e-4,-2.2974342328778687e-6,1.1200440938200634e-8,-6.930818299262455e-4,-2.4806963116481874e-6,1.1136809772812793e-8,-6.927932877982263e-4,-2.69515791678022e-6,1.1062250907052743e-8,-6.924193527516066e-4,-2.8932872464684024e-6,1.0993214408490107e-8,-6.919763333906085e-4,-3.036081365862266e-6,1.0943205101581768e-8,-6.91492215226939e-4,-3.098326934476717e-6,1.0920952638432522e-8,-6.910002904512773e-4,-3.070683044984637e-6,1.0929697707612377e-8,-6.905331356871504e-4,-2.959140124946023e-6,1.0967394783237994e-8,-6.90117596465121e-4,-2.7823877442401985e-6,1.1027633804261848e-8,-6.897712626577218e-4,-2.567793687719598e-6,1.1101026790081565e-8,-6.895006358475275e-4,-2.3467550008997916e-6,1.1176795508382824e-8,-6.89300944615274e-4,-2.150115599113473e-6,1.1244329229978124e-8,-6.891573100006782e-4,-2.00424231133623e-6,1.1294520632905088e-8,-6.890467540316551e-4,-1.9280356409594636e-6,1.1320793607430406e-8,-6.889406381638624e-4,-1.930734024848246e-6,1.1319874885504703e-8,-6.888074504279619e-4,-2.0102414136189414e-6,1.1292397488351405e-8,-6.886161724085662e-4,-2.1518695593095066e-6,1.1243363432643985e-8,-6.883407101463712e-4,-2.327739840236361e-6,1.1182368829498123e-8,-6.879658514959947e-4,-2.497813089077346e-6,1.1123245267791766e-8,-6.874944007746656e-4,-2.6143891697839814e-6,1.108247815801189e-8,-6.869533275424424e-4,-2.6320148015926607e-6,1.1075749525894508e-8,-6.863944546199724e-4,-2.522826202578732e-6,1.1112635168862051e-8,-6.858844538666012e-4,-2.2926275030821306e-6,1.1191109583836215e-8,-6.854832279089802e-4,-1.9877298379677976e-6,1.1295269233710088e-8,-6.852191743942243e-4,-1.6834486218362717e-6,1.1399318636952878e-8,-6.850762207670568e-4,-1.4561494259965552e-6,1.1477115718733162e-8,-6.850017506227822e-4,-1.353885669014518e-6,1.1512169978020316e-8,-6.849299395502611e-4,-1.382232489232581e-6,1.1502489363880025e-8,-6.848057305429362e-4,-1.5099055715152289e-6,1.1458706325152704e-8,-6.845983153559325e-4,-1.6859188037799119e-6,1.1398245647313847e-8,-6.843027428170722e-4,-1.8571846721204412e-6,1.1339299333489303e-8,-6.839342878524915e-4,-1.9804742909492373e-6,1.1296704524613013e-8,-6.83520537940993e-4,-2.0280142608472192e-6,1.1280001238857747e-8,-6.830941226507634e-4,-1.9884992920636643e-6,1.1293074773063915e-8,-6.826870433621648e-4,-1.8656132505174621e-6,1.13346680053564e-8,-6.823264387413217e-4,-1.6753696630438363e-6,1.1399305110651174e-8,-6.82031487121087e-4,-1.4427423697938251e-6,1.1478456664893744e-8,-6.818114056550049e-4,-1.1978017957364357e-6,1.1561864398442774e-8,-6.816645845240956e-4,-9.716026242010502e-7,1.1638940368353777e-8,-6.81578901101889e-4,-7.920793248862827e-7,1.1700156773758746e-8,-6.815332503350359e-4,-6.803319074311323e-7,1.173830361103633e-8,-6.815001275355418e-4,-6.477490111422285e-7,1.1749467706559448e-8,-6.814489184104265e-4,-6.941843501332436e-7,1.1733661035226025e-8,-6.813496403718091e-4,-8.071935459534741e-7,1.1695093476635976e-8,-6.81177053403738e-4,-9.623862476189849e-7,1.164206416834527e-8,-6.809151476327394e-4,-1.1251098518570805e-6,1.158639073471916e-8,-6.80561933977751e-4,-1.254012468855875e-6,1.154218474453644e-8,-6.801338767888566e-4,-1.307464024167702e-6,1.1523643336190613e-8,-6.79668066854345e-4,-1.2535982747354408e-6,1.1541612761355467e-8,-6.792188902309273e-4,-1.0830088825351644e-6,1.1599275967291585e-8,-6.78845970446115e-4,-8.196398734036575e-7,1.1688487599342648e-8,-6.785938804680131e-4,-5.21865523976247e-7,1.1789443842818592e-8,-6.784716853381285e-4,-2.670917135713526e-7,1.1875898145539714e-8,-6.784454801674145e-4,-1.229862560247459e-7,1.1924869708763637e-8,-6.78451422731065e-4,-1.2039502744957288e-7,1.1925808501975738e-8,-6.784224136183189e-4,-2.4413852327126643e-7,1.188376744728601e-8,-6.783122474568518e-4,-4.450160638167141e-7,1.1815400961230667e-8,-6.781056774875232e-4,-6.622121589485789e-7,1.1741382274874111e-8,-6.778146379208505e-4,-8.426921141446391e-7,1.1679787181502826e-8,-6.774678679897052e-4,-9.513665380458594e-7,1.1642596348323024e-8,-6.771004646386013e-4,-9.730261227384026e-7,1.163500954750871e-8,-6.767463032638174e-4,-9.096388229470013e-7,1.165635793010542e-8,-6.764335621130428e-4,-7.761178639860844e-7,1.170155308564171e-8,-6.761823408651586e-4,-5.962181208590508e-7,1.1762500661860506e-8,-6.76003339470729e-4,-3.9886548663780184e-7,1.1829366116277767e-8,-6.758971746004418e-4,-2.1465214616865e-7,1.189177429067364e-8,-6.75854349008327e-4,-7.229850977163453e-8,1.1940006997847552e-8,-6.758560464209218e-4,4.947983413017979e-9,1.1966210837941946e-8,-6.75876029123182e-4,2.7488136745964224e-9,1.196554475242547e-8,-6.758837935815457e-4,-8.161918553295126e-8,1.1937085753012027e-8,-6.758487615666738e-4,-2.3790708629766936e-7,1.1884286585775744e-8,-6.757450114730958e-4,-4.432901815565406e-7,1.1814847546413683e-8,-6.75555981832124e-4,-6.647221873892998e-7,1.1739927591423942e-8,-6.752785440219556e-4,-8.632714013106472e-7,1.1672680443195546e-8,-6.749257989924772e-4,-1.0003070529774613e-6,1.1626159710092367e-8,-6.745277736728225e-4,-1.04533785405786e-6,1.1610666373841045e-8,-6.74128768082691e-4,-9.849061499935828e-7,1.1630749295767326e-8,-6.737798662443241e-4,-8.306924641557072e-7,1.1682486866486084e-8,-6.735259935027122e-4,-6.231378273326227e-7,1.1752281613645974e-8,-6.733897881249691e-4,-4.257941722485988e-7,1.1818755484053001e-8,-6.733589931298577e-4,-3.0779861157673254e-7,1.185861347121806e-8,-6.733862647382449e-4,-3.189045445843042e-7,1.1855019353474524e-8,-6.734052719418553e-4,-4.6933352922082787e-7,1.1804407956455615e-8,-6.73356095178138e-4,-7.26669545411652e-7,1.1717608951207223e-8,-6.732058920007578e-4,-1.03135768079192e-6,1.1614681309859787e-8,-6.729549688437168e-4,-1.3203085634674708e-6,1.1516948301661333e-8,-6.726292231984343e-4,-1.5456410863813466e-6,1.1440629950089799e-8,-6.722669138054278e-4,-1.6825813512472906e-6,1.1394139323916218e-8,-6.719069745690607e-4,-1.728292691642922e-6,1.1378462534167964e-8,-6.715817867987357e-4,-1.6963310651301452e-6,1.1389032635968985e-8,-6.713140269531039e-4,-1.6104898771342205e-6,1.1417818254359392e-8,-6.711159576172181e-4,-1.4997911391117643e-6,1.1455027849828653e-8,-6.7098967808978e-4,-1.3947627025395655e-6,1.1490377166722129e-8,-6.709276170943395e-4,-1.3244157649111584e-6,1.1514110299334853e-8,-6.709132260466664e-4,-1.3133527174552276e-6,1.1517964713543777e-8,-6.709221924822578e-4,-1.3787160274900425e-6,1.1496180968261428e-8,-6.709246793383498e-4,-1.5271024239717297e-6,1.144652479963841e-8,-6.708890101922466e-4,-1.7521057789037506e-6,1.1371108056069637e-8,-6.707867329827515e-4,-2.03349427394575e-6,1.1276673671676083e-8,-6.705983390374779e-4,-2.3389296906621046e-6,1.1174033427878806e-8,-6.703183942720542e-4,-2.6286525837106187e-6,1.1076507144233978e-8,-6.699586275639561e-4,-2.862764821608109e-6,1.0997482902064068e-8,-6.695477636789244e-4,-3.009877260332382e-6,1.0947514998244096e-8,-6.691275106414471e-4,-3.0553669347500317e-6,1.093155672567259e-8,-6.687448110835039e-4,-3.0073333148598256e-6,1.0946969098039167e-8,-6.684411914721439e-4,-2.8982694801256994e-6,1.09829603567278e-8,-6.682410506419115e-4,-2.7805932569171573e-6,1.1022061743662119e-8,-6.681420923177971e-4,-2.7151112480580224e-6,1.1043947687668447e-8,-6.681122430425281e-4,-2.7538322953627776e-6,1.103115103055556e-8,-6.680967532338296e-4,-2.922229780866871e-6,1.0975005824736362e-8,-6.680351768836946e-4,-3.208938989025025e-6,1.0879155445024393e-8,-6.678818198079746e-4,-3.569206800689314e-6,1.07584697087957e-8,-6.676199799142348e-4,-3.941264216912157e-6,1.0633592515886972e-8,-6.672637124200508e-4,-4.26723863883779e-6,1.0523919613312888e-8,-6.668484745365341e-4,-4.508722102625259e-6,1.0442353880863865e-8,-6.664173881818245e-4,-4.652194081672177e-6,1.0393476953270497e-8,-6.660096559372878e-4,-4.705856726945458e-6,1.0374609216835914e-8,-6.6565400917304e-4,-4.692450116383464e-6,1.0378215067070535e-8,-6.65366691378365e-4,-4.641992506869934e-6,1.0394325668100645e-8,-6.651520724436302e-4,-4.586289293999795e-6,1.0412367136578511e-8,-6.650041770194664e-4,-4.555288303349263e-6,1.0422370733593156e-8,-6.649082145975189e-4,-4.574557922642622e-6,1.0415807035090087e-8,-6.648419516531094e-4,-4.663098319825658e-6,1.0386306849815094e-8,-6.647772977923628e-4,-4.830967209773467e-6,1.0330446811403125e-8,-6.64682793482468e-4,-5.0767082913095886e-6,1.0248610310513204e-8,-6.645276535009935e-4,-5.385272368662441e-6,1.014569716509483e-8,-6.642874935506787e-4,-5.727739295789978e-6,1.0031241672519338e-8,-6.639508926581502e-4,-6.064303841982294e-6,9.918438764338643e-9,-6.635248175263377e-4,-6.351327713612035e-6,9.821803180388749e-9,-6.630363208422775e-4,-6.551644593751551e-6,9.753736842483382e-9,-6.625286011154107e-4,-6.6453412099685115e-6,9.720943269391243e-9,-6.620515220562129e-4,-6.637210765563028e-6,9.721958663164957e-9,-6.616490030515382e-4,-6.557815458928014e-6,9.746799934408593e-9,-6.613470434299081e-4,-6.457206611119339e-6,9.779019488102298e-9,-6.611460182660693e-4,-6.3927400851426745e-6,9.799687434697574e-9,-6.610196289517972e-4,-6.414181155194645e-6,9.79227361540468e-9,-6.609211623926225e-4,-6.550090663171576e-6,9.747151909141079e-9,-6.607958578615187e-4,-6.799453044112043e-6,9.664428684028409e-9,-6.605961968829965e-4,-7.131600161094896e-6,9.554052462247139e-9,-6.602952658559864e-4,-7.495192731900008e-6,9.432897717263338e-9,-6.59893337291204e-4,-7.833471097170003e-6,9.319721647992294e-9,-6.594154199307799e-4,-8.10003951822256e-6,9.229912967892944e-9,-6.589015974741606e-4,-8.26940720505979e-6,9.171982193286219e-9,-6.583948475325114e-4,-8.339570999084169e-6,9.146702941363071e-9,-6.579310057521284e-4,-8.32782653290947e-6,9.1484953460235e-9,-6.575332522116057e-4,-8.26326332931551e-6,9.167892353553748e-9,-6.572109057110091e-4,-8.179301464685762e-6,9.193979644439203e-9,-6.569608894446945e-4,-8.108097437895046e-6,9.21621770862212e-9,-6.56770170806039e-4,-8.077049399664383e-6,9.225578151807406e-9,-6.566181353193237e-4,-8.106736580969876e-6,9.2152178288862e-9,-6.56478602741209e-4,-8.209430423295186e-6,9.18097422655523e-9,-6.563217982510564e-4,-8.387533414582957e-6,9.121895607077113e-9,-6.561169927829369e-4,-8.631800308226666e-6,9.04085550962115e-9,-6.558365936151278e-4,-8.91992576094595e-6,8.945052981019506e-9,-6.55462020900297e-4,-9.216878126763627e-6,8.845932484547084e-9,-6.549905970801155e-4,-9.47883318251498e-6,8.757896962005024e-9,-6.544410174747893e-4,-9.66200422791736e-6,8.695387849400742e-9,-6.538536905887626e-4,-9.73541782277881e-6,8.668667779698704e-9,-6.532830284212719e-4,-9.693338183562016e-6,8.679746644976681e-9,-6.527824423394355e-4,-9.561069012846983e-6,8.72050444633388e-9,-6.523874598641779e-4,-9.389804754378765e-6,8.77438033627454e-9,-6.521043283306284e-4,-9.24162630277522e-6,8.821227300503736e-9,-6.519088365606864e-4,-9.170835057503315e-6,8.843328210896267e-9,-6.517549256998489e-4,-9.20896440435165e-6,8.83024338053133e-9,-6.515887679402991e-4,-9.35797527614904e-6,8.781065819974303e-9,-6.513631828401716e-4,-9.592194273994584e-6,8.703882366870197e-9,-6.510485784423071e-4,-9.866901365965093e-6,8.613066195460134e-9,-6.506383852720353e-4,-1.0130449155765347e-5,8.525370284901691e-9,-6.501484713535216e-4,-1.0336665778532513e-5,8.455876704000505e-9,-6.496113485493177e-4,-1.0454609877589606e-5,8.414782975243667e-9,-6.490671674646127e-4,-1.0473577830441985e-5,8.405737418544261e-9,-6.485542315122563e-4,-1.0402716045749107e-5,8.42594207718587e-9,-6.48101570190052e-4,-1.0266290315339773e-5,8.467673384414735e-9,-6.477249772667448e-4,-1.0096801161149698e-5,8.520499798179897e-9,-6.474264817325805e-4,-9.928189624151298e-6,8.573469231980985e-9,-6.471962142913522e-4,-9.790591753984345e-6,8.616798727509629e-9,-6.470153398393853e-4,-9.707072173579713e-6,8.642931881769316e-9,-6.4685902944632e-4,-9.691946903899617e-6,8.647090904414083e-9,-6.466990567131604e-4,-9.749935634588221e-6,8.627569008879582e-9,-6.465061945891082e-4,-9.875497327061216e-6,8.585973740369635e-9,-6.462529770962636e-4,-1.005213254042066e-5,8.527489357020453e-9,-6.459175297868126e-4,-1.0252057697941712e-5,8.46101921967877e-9,-6.454888874271263e-4,-1.0437434177263124e-5,8.398808897746156e-9,-6.449732096697071e-4,-1.0564966265109888e-5,8.354946495019238e-9,-6.4439852831923e-4,-1.0595381812212404e-5,8.34225639995346e-9,-6.438138844513587e-4,-1.0507072144502154e-5,8.367854756241516e-9,-6.432790367365826e-4,-1.0308974899831868e-5,8.428993979308454e-9,-6.428454586197086e-4,-1.0044472629606271e-5,8.511840347096126e-9,-6.425364546618369e-4,-9.780404242463435e-6,8.595019151624936e-9,-6.423374992473061e-4,-9.584105091257316e-6,8.656940621566346e-9,-6.422025862017104e-4,-9.499924509528801e-6,8.683268961814048e-9,-6.420723318815535e-4,-9.536788226021915e-6,8.6709032555823e-9,-6.418937058551346e-4,-9.670339340684684e-6,8.62736165406817e-9,-6.416333150807353e-4,-9.854985606826542e-6,8.567021549391805e-9,-6.412819489618678e-4,-1.0038675384978085e-5,8.506456394204669e-9,-6.40852233208935e-4,-1.0175358821881159e-5,8.460459308358457e-9,-6.403723843214741e-4,-1.0233119886925515e-5,8.439407583253215e-9,-6.398785177155639e-4,-1.0197922583846564e-5,8.44800812947473e-9,-6.394070755339369e-4,-1.0073651943128085e-5,8.485229457435074e-9,-6.389883923031362e-4,-9.879211991447938e-6,8.545190825663756e-9,-6.386421940044092e-4,-9.643564938301254e-6,8.61872891621823e-9,-6.383754932638375e-4,-9.399866438278023e-6,8.695270282083074e-9,-6.381828126059341e-4,-9.179868626602678e-6,8.764629424150486e-9,-6.380482197594612e-4,-9.009455497870036e-6,8.818449463555083e-9,-6.379484020972791e-4,-8.905757191846968e-6,8.851137444227476e-9,-6.378559844764216e-4,-8.875794396678722e-6,8.860308373744816e-9,-6.37742611576723e-4,-8.916182840260416e-6,8.846890961194638e-9,-6.375817826161573e-4,-9.013389503892508e-6,8.815063136955268e-9,-6.373517365413405e-4,-9.144324590548281e-6,8.772088767448038e-9,-6.37038822435467e-4,-9.277480646007872e-6,8.727983133697308e-9,-6.366416476230471e-4,-9.375433709051482e-6,8.69473010267958e-9,-6.361755073060954e-4,-9.400076070259292e-6,8.68460137525384e-9,-6.356751215483993e-4,-9.321725715954837e-6,8.70721463674457e-9,-6.351921226563311e-4,-9.131431137281154e-6,8.765577089452952e-9,-6.34783668220924e-4,-8.851983055038034e-6,8.852573074499977e-9,-6.34492590110691e-4,-8.53933103808297e-6,8.950528563696693e-9,-6.343273922649219e-4,-8.26772377613986e-6,9.035920785086607e-9,-6.342551582389573e-4,-8.102013804904856e-6,9.088118007656425e-9,-6.342142013915741e-4,-8.071933386762328e-6,9.097504097485443e-9,-6.341394360266019e-4,-8.163387841999844e-6,9.06827899549311e-9,-6.339853162802021e-4,-8.329403778276332e-6,9.01508325066568e-9,-6.337359214736137e-4,-8.510810762680521e-6,8.956528860220945e-9,-6.334023030696212e-4,-8.65473815155575e-6,8.909374863487501e-9,-6.330132471509208e-4,-8.725202991217194e-6,8.885158614041552e-9,-6.326051717095914e-4,-8.706169178413972e-6,8.889176992237429e-9,-6.32214019748295e-4,-8.599843727994052e-6,8.920959050065301e-9,-6.318697327111989e-4,-8.422780448879686e-6,8.975440229886825e-9,-6.315928418750007e-4,-8.20125617049522e-6,9.044392176943476e-9,-6.313926873838825e-4,-7.966459175451952e-6,9.117945199759327e-9,-6.31267082506243e-4,-7.749777386235528e-6,9.186104282521891e-9,-6.312033160743475e-4,-7.5785372180136775e-6,9.240130028371382e-9,-6.311803126735913e-4,-7.472534294452365e-6,9.273661681811642e-9,-6.311716770969148e-4,-7.441681249593242e-6,9.283469414099118e-9,-6.311491861629334e-4,-7.484987837433047e-6,9.269772409499044e-9,-6.310862639818491e-4,-7.590780571477355e-6,9.236162458649285e-9,-6.309612058273856e-4,-7.737892241529536e-6,9.189230845951367e-9,-6.307601275839634e-4,-7.897660405035442e-6,9.137956611667645e-9,-6.304796987183105e-4,-8.036756534142556e-6,9.09284140190737e-9,-6.301296693209371e-4,-8.121168651637492e-6,9.064674114885852e-9,-6.297347052073675e-4,-8.122014010732786e-6,9.062695008476826e-9,-6.293340333682221e-4,-8.02357893613418e-6,9.092032490280441e-9,-6.289764922907992e-4,-7.832498886235678e-6,9.150771158405365e-9,-6.287088356458074e-4,-7.584313389584958e-6,9.227855564074418e-9,-6.285582300395714e-4,-7.340955663643736e-6,9.303857526237659e-9,-6.285162181702288e-4,-7.173981894358338e-6,9.35622506385365e-9,-6.28535844534191e-4,-7.137050918742098e-6,9.367918818323381e-9,-6.285482266619833e-4,-7.242236086511384e-6,9.334891322630107e-9,-6.284908233474023e-4,-7.4556587282647425e-6,9.267547066221383e-9,-6.28330425274692e-4,-7.714648020679488e-6,9.185435045716488e-9,-6.28069302206002e-4,-7.95377724697567e-6,9.109102634548203e-9,-6.277362671666278e-4,-8.124785819023314e-6,9.053825972438715e-9,-6.273721375619873e-4,-8.204270724462586e-6,9.02715680817319e-9,-6.27017398081553e-4,-8.191793049541557e-6,9.029461806338658e-9,-6.267047725449272e-4,-8.103665827061228e-6,9.055810702686439e-9,-6.26456043916988e-4,-7.966249400547607e-6,9.098033223137005e-9,-6.26281416479543e-4,-7.810389877515416e-6,9.146451274581206e-9,-6.261800463441795e-4,-7.667092566462788e-6,9.191260130576387e-9,-6.261411718711373e-4,-7.564004290537873e-6,9.223675064183579e-9,-6.261457836463466e-4,-7.522438367703082e-6,9.23690378724907e-9,-6.261689058554466e-4,-7.554911651594159e-6,9.226935824039986e-9,-6.26182575765119e-4,-7.663394769762143e-6,9.193084339014298e-9,-6.261594321595429e-4,-7.83867655737204e-6,9.138166390547462e-9,-6.26076519398364e-4,-8.061135092227624e-6,9.068247870454783e-9,-6.259188201018052e-4,-8.302926480673475e-6,8.991964522431026e-9,-6.256821123187454e-4,-8.531474630101965e-6,8.919455933728389e-9,-6.253747887567023e-4,-8.714062415411706e-6,8.860964423618094e-9,-6.250183114255093e-4,-8.823240323023451e-6,8.825167866103795e-9,-6.246458882436894e-4,-8.842823215536685e-6,8.817300503612222e-9,-6.242985755887415e-4,-8.774026346559433e-6,8.837199099376945e-9,-6.240177934968095e-4,-8.640273119230142e-6,8.87774343727035e-9,-6.238340168367981e-4,-8.487734929015043e-6,8.924628410892147e-9,-6.237537835039231e-4,-8.37786762163323e-6,8.958649435262117e-9,-6.237508622334895e-4,-8.370050553809897e-6,8.961109428361436e-9,-6.237694285501078e-4,-8.498608243715725e-6,8.921029687418638e-9,-6.237425116459058e-4,-8.75592709653261e-6,8.840509552635665e-9,-6.236182223750581e-4,-9.0935440897417e-6,8.734482255018053e-9,-6.233789176946422e-4,-9.44210315649724e-6,8.62453087546554e-9,-6.230431618178639e-4,-9.738006393072087e-6,8.530559779025655e-9,-6.226528415322329e-4,-9.942072412796151e-6,8.464944949980187e-9,-6.222558156538971e-4,-1.0044216892862036e-5,8.431044644216811e-9,-6.218928123420268e-4,-1.0057759649626142e-5,8.424931676993069e-9,-6.215911924046659e-4,-1.0010051523072495e-5,8.438260126232764e-9,-6.213639804945358e-4,-9.934048776771606e-6,8.460847692598394e-9,-6.212115296909202e-4,-9.862436775050359e-6,8.482499035264433e-9,-6.211238864357817e-4,-9.823973462843352e-6,8.494171700339035e-9,-6.210830596535341e-4,-9.841115150435778e-6,8.488757155704299e-9,-6.210651942122257e-4,-9.928215073960674e-6,8.461672312188594e-9,-6.210429443543682e-4,-1.0090001829574346e-5,8.411340895070526e-9,-6.209883936927952e-4,-1.032045635967511e-5,8.339532086435201e-9,-6.208766895726924e-4,-1.0602611237518307e-5,8.251410557946112e-9,-6.206901011511374e-4,-1.0909904384581257e-5,8.155117882712867e-9,-6.204217801816662e-4,-1.1209428967393452e-5,8.060785794006027e-9,-6.200783346355796e-4,-1.1467000570356854e-5,7.978999665257574e-9,-6.196803527606607e-4,-1.1653487857353938e-5,7.918867885019981e-9,-6.192602675084233e-4,-1.1751341629004252e-5,7.886009589301413e-9,-6.18857430993645e-4,-1.1760013081941588e-5,7.880853644284182e-9,-6.185107199373036e-4,-1.1698990162283051e-5,7.897639687734814e-9,-6.182494033759342e-4,-1.1607106693188978e-5,7.924550386176266e-9,-6.180837782626559e-4,-1.1536704553317361e-5,7.945441153139379e-9,-6.17998354061986e-4,-1.1541930108901036e-5,7.943422534415343e-9,-6.179514865732182e-4,-1.1662608663681637e-5,7.905878369024749e-9,-6.178847530264709e-4,-1.1908666705688085e-5,7.829382187794986e-9,-6.177413716940561e-4,-1.225291771545529e-5,7.722050838337925e-9,-6.174866683392963e-4,-1.2638281908291842e-5,7.601388082277714e-9,-6.171202061499132e-4,-1.2997807711744528e-5,7.488094639614473e-9,-6.166733164451345e-4,-1.3277552122048224e-5,7.398956214429256e-9,-6.161948260617495e-4,-1.3451111439177265e-5,7.342324255674225e-9,-6.157338992816079e-4,-1.3521276834735159e-5,7.317585667968248e-9,-6.153277910312762e-4,-1.351221220619276e-5,7.3175400954822244e-9,-6.149969832299286e-4,-1.345864223227892e-5,7.331678474457581e-9,-6.147459001310118e-4,-1.3396792379450818e-5,7.3489284361196675e-9,-6.14566195981989e-4,-1.335865891362545e-5,7.3594093806847335e-9,-6.144404163975216e-4,-1.3369061432935648e-5,7.3553652588823905e-9,-6.143451013492217e-4,-1.3444276092296466e-5,7.331624223806665e-9,-6.142533201726146e-4,-1.3591271145411236e-5,7.285864502738724e-9,-6.141370824533147e-4,-1.3807054893883965e-5,7.2188286363125555e-9,-6.139701752177742e-4,-1.4078197634895255e-5,7.134475176715785e-9,-6.137317622253945e-4,-1.4381127354302388e-5,7.03989660873347e-9,-6.13410548401449e-4,-1.4684067691371548e-5,6.944744457685035e-9,-6.130086364730966e-4,-1.4951295234998012e-5,6.8599511266353936e-9,-6.125436581487522e-4,-1.5149749237378634e-5,6.795727421966501e-9,-6.120476639627279e-4,-1.5256983677622905e-5,6.759136642679807e-9,-6.115619176413706e-4,-1.5268340231572266e-5,6.751886205597447e-9,-6.111281095430912e-4,-1.520077746265615e-5,6.769114447606619e-9,-6.107779587857513e-4,-1.5091461683002552e-5,6.799746818271109e-9,-6.10524015294988e-4,-1.4990666324170982e-5,6.828571027830531e-9,-6.103544553284269e-4,-1.4950126437351983e-5,6.839718154874809e-9,-6.10233932630094e-4,-1.5009403395997819e-5,6.820816675408024e-9,-6.101112797303565e-4,-1.5183860384006196e-5,6.7667449207401965e-9,-6.099330136988942e-4,-1.5458296216177136e-5,6.6817180549403645e-9,-6.096591780398321e-4,-1.5789545255279567e-5,6.578625916310926e-9,-6.092759401267423e-4,-1.611861496564348e-5,6.475384794437283e-9,-6.087995316766636e-4,-1.638857118742033e-5,6.389456320634693e-9,-6.082696917744599e-4,-1.656102986792536e-5,6.332762451172584e-9,-6.07735931357823e-4,-1.6624724248411486e-5,6.309028251969762e-9,-6.07243028636269e-4,-1.659408062376702e-5,6.314176973263146e-9,-6.068212130456064e-4,-1.6500688633924005e-5,6.3388763395423195e-9,-6.064828882107512e-4,-1.6382732655089433e-5,6.3716957047222936e-9,-6.062244250029457e-4,-1.6276375396916556e-5,6.401688363734559e-9,-6.060303124501623e-4,-1.6210566121514825e-5,6.41997117246288e-9,-6.058775295989655e-4,-1.6204774019256874e-5,6.420448907864246e-9,-6.057391575612956e-4,-1.6268443228459086e-5,6.400024095330046e-9,-6.055871563899351e-4,-1.640110876257458e-5,6.358597590462493e-9,-6.053947651586242e-4,-1.6592563064539658e-5,6.299040120511544e-9,-6.051391799853258e-4,-1.6823062293831563e-5,6.2271479239230684e-9,-6.04804958969757e-4,-1.7064185629920318e-5,6.15140407656365e-9,-6.043880305658054e-4,-1.7281339145854306e-5,6.082244629251485e-9,-6.038993664978827e-4,-1.743882255386278e-5,6.03054138334135e-9,-6.033664982363028e-4,-1.7507647128342022e-5,6.005236775662678e-9,-6.028306776843586e-4,-1.747471621344875e-5,6.0105545030052955e-9,-6.02338498179153e-4,-1.7350074414647643e-5,6.043785475000533e-9,-6.019293636463869e-4,-1.7168208077473955e-5,6.094852354472843e-9,-6.016229799273229e-4,-1.6981102965108023e-5,6.148328418570691e-9,-6.014120043088848e-4,-1.6844415703121967e-5,6.1875079574704055e-9,-6.012631542790681e-4,-1.6801491798937394e-5,6.199152357907398e-9,-6.011264926259588e-4,-1.687094638850435e-5,6.177250027198649e-9,-6.009494858060641e-4,-1.7041783355707502e-5,6.124605564008008e-9,-6.006912495843881e-4,-1.7277030403387907e-5,6.051910031149934e-9,-6.003329547922971e-4,-1.7524265175610315e-5,5.974701125327572e-9,-5.998817609412311e-4,-1.7729749635034893e-5,5.909152133979997e-9,-5.993674834698096e-4,-1.7852060415235455e-5,5.8679359897686786e-9,-5.98833377167506e-4,-1.7871308208750187e-5,5.857377281089162e-9,-5.983242961249349e-4,-1.77916038049349e-5,5.876628602108236e-9,-5.978761089750183e-4,-1.763692721889734e-5,5.9188348328191164e-9,-5.97509246371083e-4,-1.744281060909608e-5,5.973566370425565e-9,-5.972272340443155e-4,-1.724717783696112e-5,6.029530158965291e-9,-5.970191412732754e-4,-1.708303930127975e-5,6.076760853223087e-9,-5.968639601907031e-4,-1.6974182393121108e-5,6.107949062772968e-9,-5.967351618909186e-4,-1.6933562355692315e-5,6.1189757620988596e-9,-5.966044914543551e-4,-1.6963408114122988e-5,6.108924653343465e-9,-5.964448552706594e-4,-1.7056054741231575e-5,6.079858424794432e-9,-5.962326779452772e-4,-1.719488339402509e-5,6.036551327657856e-9,-5.959503269411983e-4,-1.7355296242159556e-5,5.9862122504836265e-9,-5.955890709894159e-4,-1.7506243438176608e-5,5.9380510048463094e-9,-5.951525234145372e-4,-1.7613258416163484e-5,5.902393637339857e-9,-5.946596553230791e-4,-1.764400034962936e-5,5.889033529766786e-9,-5.941454005656148e-4,-1.757658081028564e-5,5.9047300999132285e-9,-5.936562505153676e-4,-1.740909145309199e-5,5.9503386560754e-9,-5.932393300043767e-4,-1.7166185049999746e-5,6.018820818675055e-9,-5.929270253618056e-4,-1.6897363809678338e-5,6.095715953083003e-9,-5.927235829331455e-4,-1.6664334583585255e-5,6.162832492505709e-9,-5.926012168281408e-4,-1.6521086061127168e-5,6.204080876826821e-9,-5.925088318791681e-4,-1.6495650783895652e-5,6.2108462578212325e-9,-5.923893296595289e-4,-1.6581983910685432e-5,6.18445634623603e-9,-5.921973240230338e-4,-1.6744373968298434e-5,6.135018198325406e-9,-5.919105305805832e-4,-1.6930486544110382e-5,6.077709827522491e-9,-5.915325837551485e-4,-1.708674963487434e-5,6.028320742756395e-9,-5.910887401414671e-4,-1.7171114333858196e-5,5.999481940305171e-9,-5.906173977802621e-4,-1.7160751663905477e-5,5.998318193545036e-9,-5.901602907269286e-4,-1.7054266849847147e-5,6.025679671747184e-9,-5.897536026274595e-4,-1.6869186278252847e-5,6.076768658723353e-9,-5.894215706944987e-4,-1.6636088071657184e-5,6.142787676934763e-9,-5.891734417193177e-4,-1.639112845867565e-5,6.21311247089221e-9,-5.890037891503861e-4,-1.616881901687457e-5,6.277444531418832e-9,-5.888953870874903e-4,-1.599649526801642e-5,6.32750261058349e-9,-5.888234156540204e-4,-1.5891120266408232e-5,6.358035497480615e-9,-5.887598278097893e-4,-1.585830828911002e-5,6.36716114540014e-9,-5.886770911880141e-4,-1.5892951435849457e-5,6.356201350362242e-9,-5.88551067772663e-4,-1.598065881617845e-5,6.329251478975357e-9,-5.883632730491481e-4,-1.609944079656462e-5,6.292675486505938e-9,-5.881029486085081e-4,-1.622153632414498e-5,6.254574948934901e-9,-5.877692932525501e-4,-1.6315735016464423e-5,6.224131558643309e-9,-5.873738337045345e-4,-1.6350916709415508e-5,6.2105932820424296e-9,-5.869421485315761e-4,-1.630165097021894e-5,6.221632150191717e-9,-5.865131121598357e-4,-1.6156063475258574e-5,6.261002414793579e-9,-5.861331744440621e-4,-1.592434760802166e-5,6.325989749491587e-9,-5.858441940187316e-4,-1.5643598634390996e-5,6.405942312898085e-9,-5.856671951075539e-4,-1.5373106219251778e-5,6.483607719282582e-9,-5.855897763285556e-4,-1.517729276675414e-5,6.540086767802591e-9,-5.855664407766135e-4,-1.5101743305100796e-5,6.561819413722951e-9,-5.855345304499817e-4,-1.5154956209859986e-5,6.545946710766161e-9,-5.854378007236991e-4,-1.5306366023333386e-5,6.500984799091855e-9,-5.852448952227367e-4,-1.550045098503084e-5,6.442830961710452e-9,-5.849551516575722e-4,-1.567734639813534e-5,6.388848412759949e-9,-5.845930082893017e-4,-1.5789777542943528e-5,6.352965558410412e-9,-5.841969678310368e-4,-1.5811729052473348e-5,6.343113417189745e-9,-5.838084552194186e-4,-1.5739511632880423e-5,6.360814546463471e-9,-5.834633032295308e-4,-1.5588003820527e-5,6.402145833924053e-9,-5.831864760835484e-4,-1.538472081382847e-5,6.4593502606737386e-9,-5.829896181558738e-4,-1.5163375096637597e-5,6.5226561160815544e-9,-5.828708999533577e-4,-1.4957769589611858e-5,6.582074977801076e-9,-5.828167555766546e-4,-1.479662672105976e-5,6.628984531476504e-9,-5.828049993600993e-4,-1.46998740108272e-5,6.657304486326205e-9,-5.828086784632086e-4,-1.4676619073704028e-5,6.664156600488167e-9,-5.828000486403008e-4,-1.472477456925716e-5,6.649997471487258e-9,-5.827541399829672e-4,-1.4832100153552331e-5,6.618295601842242e-9,-5.826515746817173e-4,-1.4978198357449995e-5,6.574915976578972e-9,-5.824806499688132e-4,-1.5136975222470618e-5,6.5273858129103555e-9,-0.00058223891266244855,-1.5279382997478107e-5,6.484113573877451e-9,-5.819343932522649e-4,-1.537659130322262e-5,6.453510098108357e-9,-5.815864337643335e-4,-1.540395190071223e-5,6.442875322162274e-9,-5.812255138914551e-4,-1.5346207013270155e-5,6.456887019322757e-9,-5.808906783087563e-4,-1.5203879326331496e-5,6.495696015125998e-9,-5.806227398257667e-4,-1.4999252917115385e-5,6.553106536171523e-9,-5.804523980144355e-4,-1.4778150938693695E-05,6.6159779015583296e-9,-5.803857787226134e-4,-1.460244790593015e-5,6.666344613112382e-9,-5.803949019080188e-4,-1.453107430828226e-5,6.68691651811743e-9,-5.804222577193308e-4,-1.4595598468279076e-5,6.6681996557004115e-9,-5.804015691477434e-4,-1.4784365571006996e-5,6.613182223466211e-9,-5.802844416075218e-4,-1.504659664064087e-5,6.536251455252701e-9,-5.800572407115345e-4,-1.5314205201811868e-5,6.456956105272316e-9,-5.79740462121484e-4,-1.5527257460748158e-5,6.392682319350163e-9,-5.793754455308698e-4,-1.564997575685766e-5,6.354031421288331e-9,-5.79008526869674e-4,-1.5673984575231004E-05,6.3438332685434564e-9,-5.786793595545836e-4,-1.561305703577987e-5,6.358555023821292e-9,-5.78414926698478e-4,-1.5494822966848187e-5,6.390561211013941e-9,-5.782279782895778e-4,-1.535291284406682e-5,6.430282529202295e-9,-5.781179986625985e-4,-1.5220866757312826e-5,6.467953037038186e-9,-5.780733038593612e-4,-1.5127728821522725e-5,6.494942808591026e-9,-5.780737214613339e-4,-1.5094878202343984e-5,6.5047765753731806e-9,-5.780937304323509e-4,-1.5133945325895573e-5,6.493829724860568e-9,-5.781059012122124e-4,-1.5245845768728994e-5,6.461654192249107e-9,-5.780844231366714e-4,-1.5420967008494582E-05,6.410916404303534e-9,-5.780084375089962e-4,-1.5640566187065733e-5,6.346952753693187e-9,-5.778647777628711e-4,-1.5879285361295647e-5,6.277008199105833e-9,-5.776498175490725e-4,-1.6108436934896513e-5,6.209288793870668e-9,-5.773703656839252e-4,-1.6299721111280603e-5,6.151931069035016e-9,-5.770436111533959e-4,-1.6429208290678547e-5,6.111913238799296e-9,-5.766960225533119e-4,-1.6481506020845262e-5,6.093889659946264e-9,-5.763608734161528e-4,-1.6454038016908552e-5,6.098936037071565e-9,-5.760736744361726e-4,-1.6361021724264736e-5,6.123317511020036e-9,-5.758647102549619e-4,-1.6235696451862072e-5,6.157725998483951e-9,-5.757488547335339e-4,-1.612803540234014e-5,6.1878352067051535e-9,-5.757153315080947e-4,-1.609480237938911e-5,6.197125012537102e-9,-5.757234435926061e-4,-1.6181340271018654e-5,6.17217305833007e-9,-5.757111211388329e-4,-1.6400971995423106e-5,6.108703432860775e-9,-5.756170143529824e-4,-1.6724228696811727e-5,6.014819069588441e-9,-5.754058752564376e-4,-1.7087730422599016e-5,5.908527015219574e-9,-5.750819117894468e-4,-1.7419566737748216e-5,5.810457691770534e-9,-5.746829127406637e-4,-1.7665934924859706e-5,5.736209930949652e-9,-5.742617293776332e-4,-1.7804887133825812e-5,5.692403621165638e-9,-5.738676244788915e-4,-1.7844643668928444e-5,5.677123312045796e-9,-5.735352118200017e-4,-1.781324586487339e-5,5.682774688163753e-9,-5.732813705044003e-4,-1.774712544477777e-5,5.699224028512855e-9,-5.731070706253558e-4,-1.7682465513048927e-5,5.716183635261324e-9,-5.730010810481334e-4,-1.7650014543434743e-5,5.7246996299768535e-9,-5.729437243720952e-4,-1.7672436560521165e-5,5.717992329661441e-9,-5.729101327422091e-4,-1.77629912703616e-5,5.691943387538161e-9,-5.728732254490138e-4,-1.7924881686606425e-5,5.645364913125561e-9,-5.728066872098459e-4,-1.8151183111504288e-5,5.580046983978404e-9,-5.726880446715707e-4,-1.8425518479711568e-5,5.500544376149344e-9,-5.725017360320156e-4,-1.8723776519021976e-5,5.4136497171616706e-9,-5.722417478110209e-4,-1.901709758465021e-5,5.327525281669176e-9,-5.719132058612187e-4,-1.9275973453983113e-5,5.250556794951275e-9,-5.715324599224961e-4,-1.9474966424702655e-5,5.190061549896955e-9,-5.711254487065863e-4,-1.9597425970417595e-5,5.150993130292952e-9,-5.707243215314012e-4,-1.963951786184574e-5,5.134796911166756e-9,-5.703624645452386e-4,-1.961289496480425e-5,5.138582384870229e-9,-5.700681701023597e-4,-1.9545349551733103e-5,5.154808129149603e-9,-5.698573617980196e-4,-1.947850234148492e-5,5.171796776237571e-9,-5.697265168248463e-4,-1.946126166119291e-5,5.175504776714801e-9,-5.696483046445741e-4,-1.9538307489946467e-5,5.152814866181088e-9,-5.695737447050487e-4,-1.9735023712205888e-5,5.095954657144991e-9,-5.694440581573207e-4,-2.0044122435153433e-5,5.006492424902162e-9,-5.692107976121244e-4,-2.0422259733411498e-5,4.896447185420986e-9,-5.688556702159739e-4,-2.080239735784011e-5,4.784807248298537e-9,-5.683984430252771e-4,-2.1118146298752406e-5,4.69055903235853e-9,-5.678877874524411e-4,-2.1327200844530532e-5,4.6259837892894646e-9,-5.673813072802742e-4,-2.1421699487486857e-5,4.593705379214873e-9,-5.669266461901139e-4,-2.1423333992840117e-5,4.588040913127525e-9,-5.665515251973581e-4,-2.1370168449335505e-5,4.598631280140418e-9,-5.66262954244887e-4,-2.1303510202976556e-5,4.614029495947506e-9,-5.660516519242294e-4,-2.1259150169743164e-5,4.624106881604416e-9,-5.658977760906469e-4,-2.1263246516499423e-5,4.621241923637268e-9,-5.657758344743934e-4,-2.1331262909287216e-5,4.600715978969188e-9,-5.656582879656547e-4,-2.146824690958318e-5,4.560744399958647e-9,-5.655182799852074e-4,-2.166944979816653e-5,4.502372881234427e-9,-5.653320939464026e-4,-2.19210611198664e-5,4.429288721729575e-9,-5.650817267772786e-4,-2.2201302733604196e-5,4.347494108741701e-9,-5.647576281566446e-4,-2.248238891148829e-5,4.2647329227178e-9,-5.64361175875774e-4,-2.273385814627313e-5,4.1895539317782425e-9,-5.639060211063388e-4,-2.2927360460003696e-5,4.129994037758887e-9,-5.634173669126164e-4,-2.3042324624474837e-5,4.092025805841426e-9,-5.629285951340259e-4,-2.3071330028784256e-5,4.078067292741761e-9,-5.624753358397186e-4,-2.3023652525244365e-5,4.085953126634584e-9,-5.620879235594856e-4,-2.2925599059856908e-5,4.1087412604200885e-9,-5.617838311213657e-4,-2.2816948292584702e-5,4.13556726191145e-9,-5.615618506350042e-4,-2.274366245931516e-5,4.1535543827756625e-9,-5.613996862607292e-4,-2.2747751693369897e-5,4.150602400752755e-9,-5.61256426475516e-4,-2.2855979724977274e-5,4.1186293748158945e-9,-5.61080812039059e-4,-2.307016575944345e-5,4.056477812301431e-9,-5.608247544560862e-4,-2.3362823347901296e-5,3.971353014138016e-9,-5.6045888275338e-4,-2.3681771753724775e-5,3.877666551810311e-9,-5.599840255643514e-4,-2.3964648029816697e-5,3.7929726560466655e-9,-5.594323224548366e-4,-2.4158896301923775e-5,3.732284697554104e-9,-5.588562140180068e-4,-2.4238382403495358e-5,3.7033386543166194e-9,-5.583104935056323e-4,-2.4208922097151482e-5,3.7049913841555217e-9,-5.578362118896362e-4,-2.4101634993633252e-5,3.729013562684922e-9,-5.574526700823866e-4,-2.395959922159319e-5,3.763717738012945e-9,-5.571580150477938e-4,-2.3824918225424018e-5,3.7974724057465164e-9,-5.56934945270612e-4,-2.3730431642789787e-5,3.820986693463586e-9,-5.567575402096818e-4,-2.369650431855389e-5,3.828264474037562e-9,-5.565968561839238e-4,-2.3731175634325677e-5,3.81667238499676e-9,-5.564247258473144e-4,-2.383170766272784e-5,3.786608603817477e-9,-5.562162343773809e-4,-2.3986308687498875e-5,3.741076017959136e-9,-5.559516320965893e-4,-2.41756410521933e-5,3.6852669334650524e-9,-5.556182989939095e-4,-2.4374329729557413e-5,3.626126257835752e-9,-5.552129829469255e-4,-2.455308708972398e-5,3.5717509128408136e-9,-5.547439478003086e-4,-2.4682169708976556e-5,3.5304410056635687e-9,-5.542320441001034e-4,-2.4736519034990855e-5,3.509299202176376e-9,-5.537093394875636e-4,-2.470209240070845e-5,3.5124945121858324e-9,-5.532141884717492e-4,-2.4581739735308707e-5,3.539625413001244e-9,-5.527827987017785e-4,-2.4398065123244182e-5,3.584874043486559e-9,-5.524392207026548e-4,-2.419093064879187e-5,3.6375935558350362E-09,-5.521871673866484e-4,-2.400904254983496e-5,3.6845003460724823e-9,-5.52006996859421e-4,-2.3897600320895216e-5,3.7129769442225496e-9,-5.518594417411545e-4,-2.3885806156130697e-5,3.714505319352247e-9,-5.516952472542898e-4,-2.3978206075858976e-5,3.6871706513466653e-9,-5.514680023266997e-4,-2.415252676916681e-5,3.636467576060659e-9,-5.511466570996784e-4,-2.436472997812125e-5,3.5741160763841065e-9,-5.507243054631822e-4,-2.456016575596165e-5,3.5151030037156743e-9,-5.502204943898792e-4,-2.4688078368491355e-5,3.4736716022299434e-9,-5.49675845316952e-4,-2.4715297420699776e-5,3.4594450841273604e-9,-5.491403496431156e-4,-2.4634524609268043e-5,3.475010754579904e-9,-5.486594079579832e-4,-2.4464309834586896e-5,3.5158016687115214e-9,-5.482626949453814e-4,-2.424130364105868e-5,3.572121989232335e-9,-5.479593003710058e-4,-2.400859263852101e-5,3.6322781071167195e-9,-5.477393924139225e-4,-2.380483572567349e-5,3.685543859039702e-9,-5.475800136344878e-4,-2.365734300350956e-5,3.7241138416981567e-9,-5.47451900115605e-4,-2.3579686113701558e-5,3.743864278401933e-9,-5.473251545092862e-4,-2.3572576485177517e-5,3.744220422532077e-9,-5.471730460260657e-4,-2.3626248739021626e-5,3.727569108803425e-9,-5.469742478632765e-4,-2.3723043848052887e-5,3.6985616396725427e-9,-5.467142469598954e-4,-2.3839630731377964e-5,3.6634824609621807e-9,-5.463866264206015e-4,-2.3948973655604125e-5,3.6296880385067596e-9,-5.4599456793534e-4,-2.4022629138410048e-5,3.604980769764583e-9,-5.455523444943196e-4,-2.4034135649642785e-5,3.5967054365603564e-9,-5.450858818683846e-4,-2.396401744104895e-5,3.6104037986387385e-9,-5.446308564687652e-4,-2.380610222496027e-5,3.648086038965713e-9,-5.442267710418497e-4,-2.3573376044700058e-5,3.7065940327411654e-9,-5.43906780201333e-4,-2.3300037015731352e-5,3.776970362392915e-9,-5.436858585814063e-4,-2.303631065445945e-5,3.8457757017923984e-9,-5.43552613478327e-4,-2.28353475000358e-5,3.898554409891338e-9,-5.434699258623914e-4,-2.2736277504907688e-5,3.924381501274142e-9,-5.433855832143338e-4,-2.275078970747129e-5,3.919540539705527e-9,-5.43248646299094e-4,-2.285936214945721e-5,3.888688548443496e-9,-5.430245801652687e-4,-2.3018194797770242e-5,3.8431759853901846e-9,-5.427037893107168e-4,-2.3172944399802506e-5,3.7974973736510936e-9,-5.423020260258028e-4,-2.3273629234107787e-5,3.765329016282113e-9,-5.418542195221602e-4,-2.328631805513169e-5,3.756319626683319e-9,-5.414045400541133e-4,-2.3199382210688513e-5,3.774257587440266e-9,-5.409955890221134e-4,-2.302384304625818e-5,3.8167930066406206e-9,-5.406592269132189e-4,-2.2788582348018324e-5,3.876564618794517e-9,-5.404109156371855e-4,-2.253214165155441e-5,3.943315026925249e-9,-5.402484736817223e-4,-2.2293496058127136e-5,4.00637464546443e-9,-5.401548723226671e-4,-2.210423231623976e-5,4.056855142789439e-9]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_7.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_7.json deleted file mode 100644 index 00cb5c9c..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_7.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":7000,"numberOfSamples":1000,"samples":[-5.401035826582183e-4,-2.1983771746004456e-5,4.089071108861903e-9,-5.400645679375473e-4,-2.1937995914044596e-5,4.1010390739496695e-9,-5.400093979365809e-4,-2.1960549237341188e-5,4.094200825458988e-9,-5.399147607226752e-4,-2.203560775605646e-5,4.072680770337793e-9,-5.397644338651072e-4,-2.2140989396072942e-5,4.0424039620270295e-9,-5.395502643031555e-4,-2.2250959079911428e-5,4.010291455194114e-9,-5.392727708698771e-4,-2.233868896010399e-5,3.983582390762636e-9,-5.389417235021638e-4,-2.2378792834005243e-5,3.969178139964558e-9,-5.385766058145648e-4,-2.235055698671764e-5,3.972815745495291e-9,-5.382062428829531e-4,-2.2242365349685453e-5,3.9978965146973945e-9,-5.378662132655593e-4,-2.205712418011711e-5,4.043993326717811e-9,-5.375924932704364e-4,-2.181705877637256e-5,4.105479870305896e-9,-5.374109340395555e-4,-2.1564488189815053e-5,4.171221914461289e-9,-5.373252109046606e-4,-2.13546121672999e-5,4.226432351021938e-9,-5.373095626709229e-4,-2.123923851906108e-5,4.256999417283581e-9,-5.373130817418842e-4,-2.1246850964482913e-5,4.25485673473855e-9,-5.372765380678705e-4,-2.136960735856047e-5,4.221561718856039e-9,-5.371540300970259e-4,-2.156549994879516e-5,4.167859343731849e-9,-5.36928145915775e-4,-2.177449463181616e-5,4.109507993256763e-9,-5.36612298142394e-4,-2.193926959851254e-5,4.061836554881471e-9,-5.362421974391817e-4,-2.202084762893932e-5,4.035594559950374e-9,-5.358628658080441e-4,-2.200502185841941e-5,4.035163172736923e-9,-5.355167351147426e-4,-2.1900830823744038e-5,4.058798324504693e-9,-5.35235449411885e-4,-2.173439788390032e-5,4.100071676730384e-9,-5.350357193602122e-4,-2.15410881740401e-5,4.14980207032798e-9,-5.349185757880749e-4,-2.135782693181579e-5,4.198050291539687e-9,-5.348712290073628e-4,-2.121657442592248e-5,4.2359280087428855e-9,-5.348708000481933e-4,-2.1139615342117445e-5,4.257004944159546e-9,-5.348890826615417e-4,-2.113709309176623e-5,4.258128208977309e-9,-5.348974104172614e-4,-2.1206799246401138e-5,4.239584522007182e-9,-5.348708384321045e-4,-2.1335822917691524e-5,4.204678615706449e-9,-5.347911231697716e-4,-2.1503424398811796e-5,4.158913513206647e-9,-5.346483663470459e-4,-2.1684383203511062e-5,4.109023325019758e-9,-5.344415971986584e-4,-2.185222293312799e-5,4.062070768370815e-9,-5.341787121227865e-4,-2.198213649495927e-5,4.024683100836483e-9,-5.338760303296781e-4,-2.2053786749643512e-5,4.002365575691231e-9,-5.335574557412858e-4,-2.2054309116071213e-5,3.998758028608726e-9,-5.332528017860458e-4,-2.198181627770456e-5,4.014702338546216e-9,-5.32994271803446e-4,-2.1849184863030615e-5,4.047158626760407e-9,-5.328099775273082e-4,-2.1686695872980368E-05,4.088373074123842e-9,-5.327143982259301e-4,-2.1540670747909262e-5,4.1261167888255816e-9,-5.326982547305342e-4,-2.146472539588816e-5,4.145954976805639e-9,-5.327237676269208e-4,-2.150269819024173e-5,4.135827219007261e-9,-5.32732172820136e-4,-2.166880035547954e-5,4.091442962833996e-9,-5.32664363807273e-4,-2.193675634261866e-5,4.019307535221708e-9,-5.324850262715923e-4,-2.2247356034033065e-5,3.93482109123221e-9,-5.321959712692641e-4,-2.253169043764306e-5,3.856170494966331e-9,-5.318318024819819e-4,-2.2736299986202895e-5,3.797697407775919e-9,-5.314434001136979e-4,-2.283727543038531e-5,3.7661716224598815e-9,-5.310801862783224e-4,-2.2840328090950416e-5,3.760701663621395e-9,-5.307784695622606e-4,-2.277209911293882e-5,3.774865010501329e-9,-5.305570300482153e-4,-2.2669296597542187e-5,3.799377675031908e-9,-5.304177923198672e-4,-2.2569563199808032e-5,3.824373068544768e-9,-5.303490345079164e-4,-2.2505211219014473e-5,3.841055895162692e-9,-5.303294436667859e-4,-2.2499458669989806e-5,3.842819986704146e-9,-5.303323047521583e-4,-2.2564506861846283e-5,3.825934653411622e-9,-5.303295770130921e-4,-2.2701095439328812e-5,3.78981094362531e-9,-5.302956400451363e-4,-2.2899349303107257e-5,3.736840685640963e-9,-5.30210473665667e-4,-2.314073527658426e-5,3.6718507329490764e-9,-5.300620142371433e-4,-2.340093393614476e-5,3.601265981895817e-9,-5.298474349228372e-4,-2.3653284469214588e-5,3.532132956929273e-9,-5.29573308984056e-4,-2.3872320401723e-5,3.4711768964710575e-9,-5.292548431176042e-4,-2.403707365259649e-5,3.4239812057610383e-9,-5.289143407918906e-4,-2.4134058857944783e-5,3.3942741989696835e-9,-5.285789266630395e-4,-2.4159906281443744e-5,3.3832709646259577e-9,-5.282773952237134e-4,-2.4123609199085298e-5,3.389033411558258e-9,-5.280357364388392e-4,-2.404808982327215e-5,3.4059246595776906e-9,-5.278708810726782e-4,-2.3969949940549298e-5,3.4245089739342943e-9,-5.277831391864141e-4,-2.3935357712190903e-5,3.4325187746853774e-9,-5.277497546540487e-4,-2.3990053843999665e-5,3.417490568679712e-9,-5.277243373408124e-4,-2.416362760309801e-5,3.371043381811958e-9,-5.276472969010053e-4,-2.4453303594010498e-5,3.2933522318209953e-9,-5.274672038760931e-4,-2.4817592116745615e-5,3.1949762152372857e-9,-5.271634422555336e-4,-2.5188059386224728e-5,3.0937979755767632e-9,-5.267559068389037e-4,-2.549567899523349e-5,3.008057415556971e-9,-5.262952781608044e-4,-2.569664316277229e-5,2.9495561606916857e-9,-5.258412694183832e-4,-2.5783493066863733e-5,2.9207489680924703e-9,-5.254425066389419e-4,-2.5779503885456728e-5,2.9161612247094987e-9,-5.251263833011977e-4,-2.5724489785007588e-5,2.925940256027055e-9,-5.248986095698239e-4,-2.566102959629115e-5,2.9392604634341714e-9,-5.247480432907525e-4,-2.5625368004893986e-5,2.946595015690205e-9,-5.246528338231885e-4,-2.5643091786020372e-5,2.940887498147975e-9,-5.245858121778989e-4,-2.572797628618578e-5,2.918009092055048e-9,-5.245186697908287e-4,-2.5882406676612352e-5,2.8768303754599108e-9,-5.244252403009383e-4,-2.6098529986454154e-5,2.8190430572214277e-9,-5.242842104460674e-4,-2.6359918036558112e-5,2.748752781998075e-9,-5.240813809095547e-4,-2.664376012583758e-5,2.6718566779627634e-9,-5.23811405473642e-4,-2.6923697743507696e-5,2.5952305181850944e-9,-5.234786998958045e-4,-2.7173303690041893e-5,2.5257824612885647e-9,-5.230971720563157e-4,-2.7369871435687406e-5,2.4694878843742183e-9,-5.226886747385083e-4,-2.749801736194075e-5,2.4305157487672832e-9,-5.222802740203602e-4,-2.7552679878417226e-5,2.410501767346455e-9,-5.219004721067165e-4,-2.7541114744677728e-5,2.4080150610133087e-9,-5.215746064004773e-4,-2.748348611429587e-5,2.4182963593044943e-9,-5.213196916609409e-4,-2.741169261001642e-5,2.433387542607336e-9,-5.211390633776294e-4,-2.7365830864708946e-5,2.442883976030173e-9,-5.210177939670833e-4,-2.7387386588784694e-5,2.4356382416405185e-9,-5.2092103264559e-4,-2.7508753633437043e-5,2.4025749182162106e-9,-5.207983793056417e-4,-2.7740648686792387e-5,2.3401865242185253e-9,-5.205966266482828e-4,-2.806223642295004e-5,2.253350576167634e-9,-5.202789824851698e-4,-2.8421269302758358e-5,2.1554312055901617e-9,-5.198423209709797e-4,-2.8748981292602243e-5,2.064380772209385e-9,-5.193213569961983e-4,-2.8985277857182498e-5,1.996093068377223e-9,-5.187754286828383e-4,-2.9100856801229018e-5,1.95860814721846e-9,-5.182654734879904e-4,-2.910408008464851e-5,1.950328402209735e-9,-5.17834468885133e-4,-2.903146570281326e-5,1.9624204795998646e-9,-5.174994717055985e-4,-2.8930642345991606e-5,1.9830589980046977e-9,-5.172543344144145e-4,-2.8845521813800735e-5,2.0010793286060667e-9,-5.170775031307184e-4,-2.8808046397317225e-5,2.0080420772500573e-9,-5.169400421587481e-4,-2.883586587420426e-5,1.998918998843043e-9,-5.168116638617822e-4,-2.8933416322078027e-5,1.9719933681402133e-9,-5.166645952694133e-4,-2.9094191480639365e-5,1.928446821526537e-9,-5.16476024252827e-4,-2.930309443473024e-5,1.8718459878098334e-9,-5.162298604848831e-4,-2.9538674218475745e-5,1.8075644448687839e-9,-5.15918183163581e-4,-2.9775463189840496e-5,1.7421226458261029e-9,-5.155423951219354e-4,-2.9986754143992856e-5,1.682415416929058e-9,-5.151137407302886e-4,-3.0148054298078004e-5,1.6348102041026057e-9,-5.14652612618079e-4,-3.024103796625174e-5,1.6041685250154395e-9,-5.141862173715009e-4,-3.025736743569097e-5,1.5929194416540232e-9,-5.137445594032925e-4,-3.0201544061071227e-5,1.6003442662174793e-9,-5.133551073665073e-4,-3.0091913298744713e-5,1.6222546448333353e-9,-5.130369284461957e-4,-2.9959105712960137e-5,1.651244127376648e-9,-5.127954099507898e-4,-2.9841663506552026e-5,1.6776263789056898e-9,-5.126187743607301e-4,-2.977911818282605e-5,1.6910763709352394e-9,-5.124775920139699e-4,-2.980317215645477e-5,1.6828919402962205e-9,-5.123285291058596e-4,-2.992827896807966e-5,1.6485704768880652e-9,-5.121232184702717e-4,-3.0144080674584436e-5,1.5900146804836555e-9,-5.118216874803194e-4,-3.041333535976552e-5,1.5163090868023582e-9,-5.114069216089788e-4,-3.06788578426189e-5,1.4420450362417905e-9,-5.108941341159282e-4,-3.087997193374652e-5,1.383045829244638e-9,-5.103283884814538e-4,-3.097314754523197e-5,1.350950290890561e-9,-5.097696659935665e-4,-3.0946985077149386e-5,1.3492802047218747e-9,-5.092722871601308e-4,-3.0823751756630565e-5,1.3729826486285837e-9,-5.088689790088103e-4,-3.064783528784369e-5,1.4112787115572115e-9,-5.085657929059659e-4,-3.046880866802487e-5,1.4518356546063253e-9,-5.08346811352875e-4,-3.032757248561428e-5,1.4841879987672864e-9,-5.081833205273989e-4,-3.024951848205968e-5,1.5014927928567059e-9,-5.080425577921641e-4,-3.024389232124672e-5,1.5008319918093534e-9,-5.078937898414977e-4,-3.0306504584070308e-5,1.4827093655212703e-9,-5.077117106050379e-4,-3.042331137863873e-5,1.4502784815439696e-9,-5.074781087294359e-4,-3.0573627604291196e-5,1.4085697181512755e-9,-5.071827632231985e-4,-3.0732762305829554e-5,1.363783212066794e-9,-5.068241386956512e-4,-3.087440447664662e-5,1.322616276444108e-9,-5.064099743494193e-4,-3.097328317084115e-5,1.2915471371343079e-9,-5.059573813360568e-4,-3.100850766576199e-5,1.2759963019804067e-9,-5.054917280931815e-4,-3.09675266499804e-5,1.2793674539120017e-9,-5.050436028710859e-4,-3.085000943630236e-5,1.3021016279347987e-9,-5.046435847782699e-4,-3.067039629349787e-5,1.3410151010863194e-9,-5.043154041700915e-4,-3.0457621016956392e-5,1.3892739397176436e-9,-5.040690924503929e-4,-3.025093383015183e-5,1.4372920683562972e-9,-5.038963498673596e-4,-3.0091976510982597e-5,1.4745708467378526e-9,-5.037701041335682e-4,-3.001474285367648e-5,1.4921523724764496e-9,-5.036491510419384e-4,-3.0036038672483e-5,1.4850891219563646e-9,-5.034873278369172e-4,-3.0149240525066758e-5,1.4542250103523055e-9,-5.032453132593057e-4,-3.032361586041559e-5,1.4066373962624775e-9,-5.029021178492986e-4,-3.0510322165871625e-5,1.3543382658568904e-9,-5.024627404979756e-4,-3.06545113386691e-5,1.3112907864465489e-9,-5.01958677253733e-4,-3.0710749963624354e-5,1.2894420761309303e-9,-5.014397693770699e-4,-3.065674386674007e-5,1.2951067361437504e-9,-5.009594637119274e-4,-3.0499774007028698e-5,1.327181960804589e-9,-5.005591265624038e-4,-3.027289359707675e-5,1.3779593095465411e-9,-5.002577464773517e-4,-3.002286754188913e-5,1.4360302437884732e-9,-5.000502980916162e-4,-2.9795642680252517e-5,1.4898545010720947e-9,-4.999135018056022e-4,-2.96252177016554e-5,1.530564984614016e-9,-4.998148703059288e-4,-2.9528734833433275e-5,1.5533180663703762e-9,-4.997210391324866e-4,-2.9507108813167577e-5,1.557313949211449e-9,-4.996033580441727e-4,-2.95486805281199e-5,1.5450349761472517e-9,-4.994407134467235e-4,-2.963354086042027e-5,1.5212284427432084e-9,-4.99220513807549e-4,-2.9737275227078863e-5,1.4919412361183264e-9,-4.989388300780407e-4,-2.9833867578447486e-5,1.4637165471569636e-9,-4.986003615032496e-4,-2.989808300652266e-5,1.442933990607473e-9,-4.982184149831263e-4,-2.9907927865987277e-5,1.4351810441446417e-9,-4.978145252172193e-4,-2.9847712851288548e-5,1.4445248582206659e-9,-4.974169169914042e-4,-2.971176155615385e-5,1.4726359068551763e-9,-4.970569165391165e-4,-2.9508056286774713e-5,1.517893845763169e-9,-4.967628303390822e-4,-2.926026998042455e-5,1.574829976621728e-9,-4.96551978398408e-4,-2.900608455871382e-5,1.634431128285346e-9,-4.96423302209712e-4,-2.879027553840682e-5,1.6857146709917446e-9,-4.963541060645736e-4,-2.865323310167557e-5,1.7184681499924557e-9,-4.963036761354488e-4,-2.861842652841363e-5,1.7263462753477494e-9,-4.962236841992082e-4,-2.8683800491744274e-5,1.7091218148852898e-9,-4.960720233794146e-4,-2.8820919804120417e-5,1.673117417745899e-9,-4.958250916601518e-4,-2.898244031513813e-5,1.6295915726764063e-9,-4.954843911405692e-4,-2.911516518981793e-5,1.591663143962164e-9,-4.950757567029083e-4,-2.9174289607850693e-5,1.5708062654753593e-9,-4.946419883627445e-4,-2.9134683182893188e-5,1.5739443674704452e-9,-4.942313197632331e-4,-2.899634780038582e-5,1.601897900139963e-9,-4.938850760519116e-4,-2.8782878175581034e-5,1.6495407345080696e-9,-4.936280480341194e-4,-2.8533738897703263e-5,1.707525662802973e-9,-4.934641902772148e-4,-2.8293088750190768e-5,1.7649546067683797e-9,-4.933783032088761e-4,-2.80988640410467e-5,1.8121051613246878e-9,-4.933422254005704e-4,-2.7975289802310766e-5,1.842421094099516e-9,-4.933227875226166e-4,-2.793022331205908e-5,1.853363241919422e-9,-4.932888738289174e-4,-2.7956735636432285e-5,1.8461872237371115e-9,-4.932160962554518e-4,-2.8037116641906087e-5,1.8250326211687373e-9,-4.930889594766327e-4,-2.8147435486230603e-5,1.7957702854856959e-9,-4.929012427190119e-4,-2.8261502965497104e-5,1.7649326447086253e-9,-4.926554961798312e-4,-2.835390391705434e-5,1.7388763334173934e-9,-4.923623095573031e-4,-2.8402349479687208e-5,1.7231683216680764e-9,-4.920395867133475e-4,-2.8389889647024718e-5,1.722073563894763e-9,-4.917115540492151e-4,-2.8307497965287012e-5,1.7379836944677346e-9,-4.914067695061618e-4,-2.815714883271202e-5,1.7707008124423624e-9,-4.911541935152892e-4,-2.7954758530073625e-5,1.8166878141640076e-9,-4.9097673506944e-4,-2.773135265619518e-5,1.868683014872907e-9,-4.908829819257416e-4,-2.753002578310636e-5,1.9163130986412e-9,-4.908600342594571e-4,-2.7396792960745575e-5,1.9482274136412787e-9,-4.908721173909682e-4,-2.736633164669827e-5,1.9555585722015448e-9,-4.908685218729858e-4,-2.7447945016454782e-5,1.935427847646306e-9,-4.907995565142859e-4,-2.7619289411182313e-5,1.8926347984558103e-9,-4.906336832509187e-4,-2.7832348344015255e-5,1.8383867655335314e-9,-4.903676923646972e-4,-2.802925951189207e-5,1.7865984348223615e-9,-4.900260027571856e-4,-2.81603898676814e-5,1.7495716625922467e-9,-4.89651135545775e-4,-2.8197278587712897e-5,1.7348223698973235e-9,-4.892906052692192e-4,-2.8137212384925217e-5,1.7438257478064728e-9,-4.889850187707911e-4,-2.800028120231637e-5,1.7725003438639047e-9,-4.887600631930353e-4,-2.782169608840279e-5,1.8128296668897378e-9,-4.886231415493295e-4,-2.764229676123075e-5,1.8550063239660704e-9,-4.885642484701803e-4,-2.7499550273375093e-5,1.8896080581632753e-9,-4.88560103003217e-4,-2.7420633789239168e-5,1.9094190965771907e-9,-4.885802098906471e-4,-2.741859369588705e-5,1.9105887095828677e-9,-4.885932963466409e-4,-2.749186494528233e-5,1.892958847920264e-9,-4.885727070221833e-4,-2.7626586385723848e-5,1.8596151082628022e-9,-4.884999125827284e-4,-2.780056601507957e-5,1.815912403162441e-9,-4.883659918181414e-4,-2.7987688626019622e-5,1.7683031663824352e-9,-4.881714965792303e-4,-2.8161857991136438e-5,1.7232621331153711e-9,-4.879253817230721e-4,-2.8300053385778088e-5,1.6864793191295907e-9,-4.876435954604153e-4,-2.838460913858599e-5,1.6623231380987314e-9,-4.87347570898538e-4,-2.8405127125376862e-5,1.6534487206287574e-9,-4.870624676766653e-4,-2.8360400428380635e-5,1.660397458157364e-9,-4.8681464921107224e-4,-2.8260451760282097e-5,1.6810999234867354e-9,-4.8662762504571956e-4,-2.8128194590838857e-5,1.710378936760407e-9,-4.865159493111669e-4,-2.7999259061439134e-5,1.7398402884595435e-9,-4.864778001628795e-4,-2.7917688216241995e-5,1.758782346831438e-9,-4.864891773662556e-4,-2.7925623648319725e-5,1.7566564873211407e-9,-4.8650469881442816e-4,-2.8048055389582203e-5,1.7268436941845679e-9,-4.8646900022718986e-4,-2.8278862045047066e-5,1.6701987909042514e-9,-4.863366661408441e-4,-2.8577505119019685e-5,1.596014686119699e-9,-4.8609095859314307e-4,-2.888149066944309e-5,1.5191180487893385e-9,-4.8575031131327785e-4,-2.9129303897496962e-5,1.4543917377772392e-9,-4.853594628443761e-4,-2.928127077721007e-5,1.4117786999065398e-9,-4.8497195747729835e-4,-2.932864068445588e-5,1.394071849831376e-9,-4.846337505125269e-4,-2.92901557766113e-5,1.397598481510503e-9,-4.8437354423659196e-4,-2.9201624636557654e-5,1.4144787727407432e-9,-4.842002284292061e-4,-2.9104393029698005e-5,1.4351477859261177e-9,-4.841052181270292e-4,-2.903609161431683e-5,1.4504558263885193e-9,-4.84067228217977e-4,-2.9024670479161186e-5,1.4531643834621424e-9,-4.840577748119623e-4,-2.90853939257728e-5,1.438879930124667e-9,-4.8404655015113853e-4,-2.9220176531956694e-5,1.4064663055144139e-9,-4.840061936266715e-4,-2.9418854952069273e-5,1.3579222509944927e-9,-4.839159970403585e-4,-2.9661986241126522e-5,1.2977592972372048e-9,-4.8376421255598803e-4,-2.99245694584744e-5,1.2320364517035848e-9,-4.8354887698368103e-4,-3.0180063885511402e-5,1.1672683012708056e-9,-4.832772700501507e-4,-3.0404142004948953e-5,1.1094257627540442e-9,-4.829643557323166e-4,-3.0577722626730395e-5,1.06319106972272e-9,-4.826306810340864e-4,-3.068915192762852e-5,1.0314937573263063e-9,-4.823000236618913e-4,-3.073572511170575e-5,1.0152261736262526e-9,-4.819967854440488e-4,-3.07247596187981e-5,1.0130129991719876e-9,-4.8174290438235536e-4,-3.067424662353938e-5,1.0209817846856487e-9,-4.8155387647187757e-4,-3.061273027346073e-5,1.032629336411569e-9,-4.814336608023644e-4,-3.057734555154527e-5,1.0391143981355627e-9,-4.813692597631775e-4,-3.060832201910778e-5,1.0304832601707698e-9,-4.813275459614071e-4,-3.073869463472397e-5,9.981998565152625e-10,-4.812585659790297e-4,-3.09804507134622e-5,9.386721541243323e-10,-4.811087866201458e-4,-3.1312961751180574e-5,8.56262021686922e-10,-4.8084200197442165e-4,-3.168291882514008e-5,7.634346976835111e-10,-4.804573453938174e-4,-3.202098523525012e-5,6.767668830172286e-10,-4.799919742448245e-4,-3.226863232885468e-5,6.104833504614054e-10,-4.7950561722214457e-4,-3.239963129412474e-5,5.713324640502453e-10,-4.7905711130771735e-4,-3.2424683834516966e-5,5.57489239643948e-10,-4.7868648919253005e-4,-3.2380572165611614e-5,5.61014998658449e-10,-4.78408756745913e-4,-3.231372536823076e-5,5.715060758294507e-10,-0.00047821695541208484,-3.226672810540936e-5,5.790543339561175e-10,-4.780892929635116e-4,-3.2270696159169436e-5,5.759797425532569e-10,-4.7799654019284706e-4,-3.2342694027153804e-5,5.575709307492149e-10,-4.7790798337904856e-4,-3.2486240286347094e-5,5.222191413059654e-10,-4.7779572256916394e-4,-3.269322339193252e-5,4.712137846897875e-10,-4.776377532430203e-4,-3.294643314889626e-5,4.0828191455557877e-10,-4.7742011900052996e-4,-3.322255415686779e-5,3.3887550315425643e-10,-4.7713813362436103e-4,-3.3495522236272236e-5,2.692723543611399e-10,-4.767966058786844e-4,-3.374005506219493e-5,2.0561845121165476e-10,-4.764089810761079e-4,-3.3935100660724256e-5,1.5304719488686107e-10,-4.759953978571277e-4,-3.4066794130658526e-5,1.150012473363178e-10,-4.75579914293648e-4,-3.4130529894258694e-5,9.281539758685568e-11,-4.7518726401693057e-4,-3.4132012358599385e-5,8.552166664277137e-11,-4.7483937947707337e-4,-3.4087283256587925e-5,8.9808001360197e-11,-4.745518134530909e-4,-3.402168289331611e-5,1.0012352749726892e-10,-4.743301302744044e-4,-3.396758918434555e-5,1.0901384685598315e-10,-4.7416643965561046e-4,-3.3960444197777966e-5,1.0790405985855532e-10,-4.740368979791793e-4,-3.4032281179469596e-5,8.86169595898152e-11,-4.739021227586955e-4,-3.420250408423377e-5,4.5725881072999446e-11,-4.7371326042227083e-4,-3.446757033559661e-5,-2.0710561717845824e-11,-4.734254927457585e-4,-3.479429725681101e-5,-1.0330249928567228e-10,-4.7301639236006836e-4,-3.5123672220509924e-5,-1.881476569178234e-10,-4.725000431178112e-4,-3.5388839961071916e-5,-2.591876480176443e-10,-4.7192604541348076e-4,-3.554105374407855e-5,-3.044707002743182e-10,-4.7136099969806975e-4,-3.556883779945993e-5,-3.206993534357789e-10,-4.7086294225468346e-4,-3.549888047725581e-5,-3.1342792392102554e-10,-4.7046352272326177e-4,-3.538050951555742e-5,-2.935213287305637e-10,-4.7016473226171217e-4,-3.5265590743997314e-5,-2.726806915020762e-10,-4.699464136836216e-4,-3.5194260656001715e-5,-2.6030955535709985e-10,-4.697770469616606e-4,-3.518932915329649e-5,-2.622205939252974e-10,-4.696228012465099e-4,-3.5256920462369833e-5,-2.8060094716625834e-10,-4.6945333703288087e-4,-3.538992906669341e-5,-3.145484253008059e-10,-4.69244867902677e-4,-3.5571919634512485e-5,-3.607624652693146e-10,-4.6898164086817774e-4,-3.5780529452895425e-5,-4.1425452821863957e-10,-4.686566863176195e-4,-3.5990449974228233e-5,-4.690962154934373e-10,-4.6827208786035787e-4,-3.617631589754077e-5,-5.192139267408718e-10,-4.678386863652773e-4,-3.631568320727738e-5,-5.591870571551936e-10,-4.6737497335989225e-4,-3.6392083291211825e-5,-5.849904896303589e-10,-4.6690488301707415e-4,-3.639782201853782e-5,-5.94602599597509e-10,-4.6645445102384944e-4,-3.633592139146378e-5,-5.883906819014525e-10,-4.660476945176547e-4,-3.6220661871468307e-5,-5.692228942796334e-10,-4.657022695838701e-4,-3.6076407131886816e-5,-5.422815071321678e-10,-4.6542554666657507e-4,-3.5934607127357874e-5,-5.145430862929582e-10,-4.6521176990474016e-4,-3.582914597600692e-5,-4.93889587145379e-10,-4.650408921003716e-4,-3.579037660247443e-5,-4.878228226654467e-10,-4.6487973809540686e-4,-3.583822677071e-5,-5.017887049330647e-10,-4.646864289969452e-4,-3.5975183793548686e-5,-5.37296846788472e-10,-4.64418929535433e-4,-3.618107017587765e-5,-5.903807450996709e-10,-4.640473748557744e-4,-3.641280549063968e-5,-6.513004445318026e-10,-4.6356706963375163e-4,-3.6612571972860786e-5,-7.064066461510136e-10,-4.6300573393137634e-4,-3.672503075757567e-5,-7.42296675743031e-10,-4.624182914159778e-4,-3.671797163766815e-5,-7.508047679955584e-10,-4.6186855565977626e-4,-3.659550128472903e-5,-7.321670756526646e-10,-4.614064225580401e-4,-3.6395389241618036e-5,-6.944563282812404e-10,-4.610528332327597e-4,-3.6172385710832e-5,-6.498299076742612e-10,-4.607987283925611e-4,-3.597801715887471e-5,-6.100320374056605e-10,-4.6061468507508637e-4,-3.5846959612404006e-5,-5.833503649471653e-10,-4.6046349004600013e-4,-3.579313229929127e-5,-5.736387227312834e-10,-4.6030994274539054e-4,-3.5812705095171745e-5,-5.807834219497946e-10,-4.601262422144594e-4,-3.588972134772124e-5,-6.017486078129592e-10,-4.5989390505752053e-4,-3.600142119002202e-5,-6.316505581854882e-10,-4.596038614192552e-4,-3.61222398339944e-5,-6.646706362294414e-10,-4.592559568531993e-4,-3.6226694452753686e-5,-6.948193567656552e-10,-4.5885834703375316e-4,-3.629175808199892e-5,-7.166060109300918e-10,-4.584267277797475e-4,-3.629920933167143e-5,-7.25651034334448e-10,-4.5798303120869814e-4,-3.623817319516776e-5,-7.192617233124736e-10,-4.575530806030977e-4,-3.610762730040304e-5,-6.969458465337379e-10,-4.571628892970559e-4,-3.591815255208761e-5,-6.607620683323364e-10,-4.56833823604343e-4,-3.569198142091502e-5,-6.153534493322551e-10,-4.5657747279228704e-4,-3.54605678450924e-5,-5.675121322431022e-10,-4.5639155317605325e-4,-3.525945503013983e-5,-5.251872676244543e-10,-4.562582877399368e-4,-3.5121101489857186e-5,-4.960025021303906e-10,-4.561462404911574e-4,-3.5067166813251846e-5,-4.855281510313871e-10,-4.560157354184803e-4,-3.510209657136758e-5,-4.956760285975314e-10,-4.558271844438492e-4,-3.520973052125918e-5,-5.23642942124648e-10,-4.555509722539143e-4,-3.5354377231198915e-5,-5.618485388203806e-10,-4.551767900011865e-4,-3.5487271728465515e-5,-5.99216862288837e-10,-4.547194931700101e-4,-3.555821241925147e-5,-6.238372524193589e-10,-4.5421824807652514e-4,-3.553016757808225e-5,-6.264728450339745e-10,-4.537270827198009e-4,-3.539206308847836e-5,-6.037125880351339e-10,-4.532987076358123e-4,-3.5163679660655164e-5,-5.592847955933052e-10,-4.5296792741134556e-4,-3.488912728160238e-5,-5.027086388929701e-10,-4.527422313081323e-4,-3.462138798450755e-5,-4.458766460131134e-10,-4.5260323410913533e-4,-3.4405453702598874e-5,-3.9926413768010085e-10,-4.5251644486876176e-4,-3.426740951649623e-5,-3.6938487658784766e-10,-4.5244332300902997e-4,-3.421213627964388e-5,-3.5808595438001316e-10,-4.523505626185003e-4,-3.4227480505678286e-5,-3.632636675315268e-10,-4.5221482312207624e-4,-3.4290899461766846e-5,-3.8020116677613763e-10,-4.5202375557595886e-4,-3.437554371425792e-5,-4.029081427514244e-10,-4.5177505774483904e-4,-3.445460262322402e-5,-4.251869797649234e-10,-4.514749547370295e-4,-3.4504079311446706e-5,-4.4139362238526164e-10,-4.5113679020358777e-4,-3.450468018923218e-5,-4.469651496899405e-10,-4.507797731939009e-4,-3.444350711070474e-5,-4.388225099902334e-10,-4.504274678763231e-4,-3.431595710739258e-5,-4.1574789980056126e-10,-4.501053968208255e-4,-3.412772239306382e-5,-3.7876689398194317e-10,-4.49837245052929e-4,-3.3896171321560205e-5,-3.3143923698792594e-10,-4.4963967883302245e-4,-3.364990241377015e-5,-2.7982500286964254e-10,-4.495167350280108e-4,-3.342519780636138e-5,-2.3182893325347959e-10,-4.494557916595384e-4,-3.32588698365336e-5,-1.9575098987866422e-10,-4.494275238613324e-4,-3.317868246084438e-5,-1.7822526619476317e-10,-4.493912544321645e-4,-3.319433112785999e-5,-1.8215182067943742e-10,-4.4930491559363935e-4,-3.329257874488547e-5,-2.0541584757431906e-10,-4.491366544886963e-4,-3.343893518934762e-5,-2.409915239755049e-10,-4.4887423428689434e-4,-3.358582747083409e-5,-2.785249749837473e-10,-4.4852918924545023e-4,-3.3684857564196356e-5,-3.069592004180854e-10,-4.481345025764483e-4,-3.3699547562141865E-05,-3.174400965017838e-10,-4.477364173205387e-4,-3.36150453685436e-5,-3.056899582009406e-10,-4.473824653024104e-4,-3.3442075559446554e-5,-2.731645840371916e-10,-4.471089794236686e-4,-3.3213746559910004e-5,-2.2659609678642381e-10,-4.4693193476726584e-4,-3.2975892326254515e-5,-1.7600234698550785e-10,-4.4684415933761597e-4,-3.2774072581832724e-5,-1.318180279743324e-10,-4.468195596048631e-4,-3.264180812728822e-5,-1.0215906621877542e-10,-4.468221350963377e-4,-3.259390394722096e-5,-9.111564082088563e-11,-4.468159270102211e-4,-3.262613831507543e-5,-9.843768488394674e-11,-4.4677253154619184e-4,-3.271981887431175e-5,-1.2037327381122013e-10,-4.466747593938944e-4,-3.2848326037323585e-5,-1.5107991793165482e-10,-4.465169535590928e-4,-3.298315215165685e-5,-1.8405170853296948e-10,-4.4630337571044507e-4,-3.309824656748056e-5,-2.1323351666357844e-10,-4.4604597579605345e-4,-3.317263929462189e-5,-2.337308573244723e-10,-4.45762317539977e-4,-3.3191928530204014e-5,-2.421841171496663e-10,-4.454738218877487e-4,-3.314935956184844e-5,-2.369644191333686e-10,-4.4520398080873634e-4,-3.304699535971351e-5,-2.1835135532547503e-10,-4.449759188950929e-4,-3.289697404544757e-5,-1.887628854791514e-10,-4.448087241116615e-4,-3.2722220146874976e-5,-1.529489231537002e-10,-4.4471242614531716e-4,-3.2555363695373645e-5,-1.1787226547448037e-10,-4.446825403539786e-4,-3.2434324371631275e-5,-9.188130706746193e-11,-4.4469655992664646e-4,-3.2393735943472714e-5,-8.291075104452407e-11,-4.4471563063769776e-4,-3.245364245052461e-5,-9.596818943647909e-11,-4.446933654754844e-4,-3.2609831845342675e-5,-1.3086158754423952e-10,-4.445900359888028e-4,-3.2831347836709934e-5,-1.814400172328324e-10,-4.4438642125605143e-4,-3.306811219248421e-5,-2.370680722983898e-10,-4.4409080264432883e-4,-3.326622792760892e-5,-2.858581212801058e-10,-4.437360837083105e-4,-3.33843518504114e-5,-3.1823887552277983e-10,-4.433690949210459e-4,-3.340463330407339e-5,-3.294487374573945e-10,-4.430370755530498e-4,-3.3335321031998855e-5,-3.203184353265311e-10,-4.427759960089928e-4,-3.320596713714179e-5,-2.9650278742528307e-10,-4.4260339341241914e-4,-3.305809413124731e-5,-2.666935334285821e-10,-4.425164934095727e-4,-3.293443729480453e-5,-2.403889490512539e-10,-4.424951037855245e-4,-3.286939195932481e-5,-2.2573681301802528e-10,-4.4250792553513906e-4,-3.2882577323854434e-5,-2.2789539745179735e-10,-4.425203905633074e-4,-3.297653466831185e-5,-2.4823497974085815e-10,-4.425019734590562e-4,-3.313848660280707e-5,-2.8448803781729026e-10,-4.424313311491289e-4,-3.334499881923905e-5,-3.3168004394333305e-10,-4.422985572981347e-4,-3.3567784931305844e-5,-3.834657566606249e-10,-4.4210484891880924e-4,-3.377905354369237e-5,-4.3346022827032136e-10,-4.4186050614891556e-4,-3.3955460677570604e-5,-4.762630706971752e-10,-0.00044158229376506733,-3.408047587119074e-5,-5.080560853142402e-10,-4.4129088951131405e-4,-3.4145537682724034e-5,-5.268328707022444e-10,-4.4100864451780675e-4,-3.415060214756904e-5,-5.324321778308508e-10,-4.4075744431709034e-4,-3.4104538515809105e-5,-5.265509515466792e-10,-4.405562048159596e-4,-3.402543308853396e-5,-5.128193797311413e-10,-4.4041749799388676e-4,-3.394031824044413e-5,-4.968520411437988e-10,-4.4034317371603764e-4,-3.388321666420194e-5,-4.859836819661576e-10,-4.4031985380117906e-4,-3.389003663385937e-5,-4.882781596747447e-10,-4.4031667309458187e-4,-3.398947734201114e-5,-5.105417250572887e-10,-4.40288726603928e-4,-3.419139460117802e-5,-5.556392875995702e-10,-4.4018852720764694e-4,-3.447763007612022e-5,-6.202734840122589e-10,-4.3998312776834925e-4,-3.4802253044518366e-5,-6.948530997978604e-10,-4.396688525708522e-4,-3.510470657110431e-5,-7.662719727894685e-10,-4.3927463938373874e-4,-3.533108692677226e-5,-8.225278615720626e-10,-4.388514849831018e-4,-3.545261924397217e-5,-8.567545923869293e-10,-4.384542114569926e-4,-3.5472467064472854e-5,-8.687704570663886e-10,-4.381250309194333e-4,-3.542007387575285e-5,-8.640367362840351e-10,-4.3788477725332484e-4,-3.533865244353876e-5,-8.512299465652137e-10,-4.377321566231613e-4,-3.52722511840646e-5,-8.396926899517458e-10,-4.3764830456916964e-4,-3.525614476523123e-5,-8.374333127536711e-10,-4.376036478383992e-4,-3.531151963905395e-5,-8.498330044244647e-10,-4.3756499698159503e-4,-3.544392307484552e-5,-8.790159276265403e-10,-4.3750174764789934e-4,-3.56445680225368e-5,-9.238259471745557e-10,-4.3739057794072914e-4,-3.5893675770702265e-5,-9.803621067461992e-10,-4.372182577922428e-4,-3.6165025749781834e-5,-1.042950971201023e-9,-4.369824734841252e-4,-3.6430802734025703e-5,-1.1053246753441703e-9,-4.36690901264442e-4,-3.6665949804834746e-5,-1.1617407465670032e-9,-4.3635900542241446e-4,-3.685147801086402e-5,-1.2078249534317108e-9,-4.360071976804138e-4,-3.697647114841903e-5,-1.2410262063482944e-9,-4.356579555231565e-4,-3.7038915732516285e-5,-1.260728985867218e-9,-4.353331667358742e-4,-3.704575670653252e-5,-1.2681800873321904e-9,-4.350516275750907e-4,-3.701249208677096e-5,-1.2663789075441324e-9,-4.348264748497907e-4,-3.696235632581322e-5,-1.2599873663792249e-9,-4.3466228069439307e-4,-3.692480626009468e-5,-1.2551736513394884e-9,-4.3455177288540366e-4,-3.6932510170417106e-5,-1.25912798564809e-9,-4.3447301468774706e-4,-3.701572674939781e-5,-1.278902275184977e-9,-4.3438916026796164e-4,-3.71935894381788e-5,-1.3194060826546412e-9,-4.3425376802956616e-4,-3.74638561498117e-5,-1.3809346111075104e-9,-4.340236163024067e-4,-3.779593543622154e-5,-1.4574024307369292e-9,-4.3367640876553675e-4,-3.8134118564692025e-5,-1.5369256916288049e-9,-4.332244241737091e-4,-3.8414502041651824e-5,-1.6055222702572017e-9,-4.3271386018431076e-4,-3.858948430017033e-5,-1.652481129483999e-9,-4.3220787923143326e-4,-3.864607462666557e-5,-1.6743270763616353e-9,-4.317629656468537e-4,-3.860761863456337e-5,-1.6752156913577408e-9,-4.3141176547786695e-4,-3.8520414864384305e-5,-1.6642240440609935e-9,-4.3115868222643985e-4,-3.8435327419660585e-5,-1.651702421749401e-9,-4.3098557996193025e-4,-3.8393580822086956e-5,-1.6464759363415677e-9,-4.3086147835504085e-4,-3.841992287116871e-5,-1.65440671246263e-9,-4.307516674336233e-4,-3.8521823132790755e-5,-1.6780078303099869e-9,-4.306243804306794e-4,-3.8692067403099935e-5,-1.716664885505569e-9,-4.3045497513185133e-4,-3.891267180424769e-5,-1.7671843133691706e-9,-4.302282105989142e-4,-3.9159095494623204e-5,-1.824566327370246e-9,-4.299390751286171e-4,-3.940438880534627e-5,-1.8829431790449586e-9,-4.295924025130069e-4,-3.9623034498814555e-5,-1.936562263178734e-9,-4.292014630930585e-4,-3.9794261037469396e-5,-1.9806593157273097e-9,-4.287856876623859e-4,-3.9904630596068394e-5,-2.0120950226613972e-9,-4.28367754503315e-4,-3.994964610903417e-5,-2.0296763544745215e-9,-4.279704452993792e-4,-3.9934237516808346e-5,-2.0341813886434956e-9,-4.276136265667553e-4,-3.987227137249826e-5,-2.0282039753249915e-9,-4.273114688402678e-4,-3.978527077197651e-5,-2.0159259234067885e-9,-4.2706992488113834e-4,-3.9700366198973295e-5,-2.002829069662559e-9,-4.268845197863682e-4,-3.964737840173896e-5,-1.9952647642030475e-9,-4.267386265969893e-4,-3.965471131576109e-5,-1.999700373052887e-9,-4.266029510717304e-4,-3.9743544324180614e-5,-2.0214358793739664e-9,-4.26437834568534e-4,-3.992039295746758e-5,-2.0627867533072652e-9,-4.2620038657907274e-4,-4.016980373449743e-5,-2.1212012265236316e-9,-4.2585728334790284e-4,-4.0451299582123726e-5,-2.1883606719571155e-9,-4.25400265363133e-4,-4.070596598753596e-5,-2.25155109322746e-9,-4.248561337280175e-4,-4.0874859811857436e-5,-2.2977411834001216e-9,-4.242820619720334e-4,-4.092274432793028e-5,-2.3187965446079723e-9,-4.237451316903482e-4,-4.085341822572131e-5,-2.3147791360394584e-9,-4.2329694415442286e-4,-4.070654441064251e-5,-2.2932869092235596e-9,-4.229578411734412e-4,-4.0538947222353454e-5,-2.2656447239000503e-9,-4.2271688421275413e-4,-4.040304127911455e-5,-2.2426165588610284e-9,-4.225427433080427e-4,-4.0333144803596924e-5,-2.231704275563879e-9,-4.223968689264773e-4,-4.0342043136537935e-5,-2.2363639652971267e-9,-4.222434398179648e-4,-4.042433106460874e-5,-2.256430112670042e-9,-4.220548334090586e-4,-4.056222883882198e-5,-2.2890006714688703e-9,-4.218136677594013e-4,-4.073117018433807e-5,-2.3293788637137593e-9,-4.21512946299068e-4,-4.0904258616967875e-5,-2.3719643641673716e-9,-4.2115531676598317e-4,-4.105575217512033e-5,-2.4111025484600863e-9,-4.207517952197999e-4,-4.1163907229954436e-5,-2.441863734119646e-9,-4.203200113401336e-4,-4.121333480514526e-5,-2.460678044086568e-9,-4.198819221794372e-4,-4.119688223171917e-5,-2.4657691210332674e-9,-4.194609188969578e-4,-4.111682572964086e-5,-2.4573520283086842e-9,-4.1907848888926417e-4,-4.0985005162454883e-5,-2.4375869987131062e-9,-4.1875086145044143e-4,-4.082171835588424e-5,-2.4103369791762464e-9,-4.1848604840921634e-4,-4.065342570658751e-5,-2.3807851127628465e-9,-4.182816061708275e-4,-4.050935427302264e-5,-2.3549026071762925e-9,-4.1812347686722286e-4,-4.041715861848515e-5,-2.3387103150409148e-9,-4.1798629068454416e-4,-4.039789505126642e-5,-2.337275945283984e-9,-4.178356307985684e-4,-4.046059638808345e-5,-2.353438615303446e-9,-4.1763304542852736e-4,-4.0597133531294696e-5,-2.3864309135234715e-9,-4.17344485054109e-4,-4.07791348421971e-5,-2.4308988000567276e-9,-4.1695157842682465e-4,-4.095991780817399e-5,-2.477108670627579e-9,-4.16462448119742e-4,-4.108433698392642e-5,-2.5130503328766345e-9,-4.15915771968092e-4,-4.1106404871525956e-5,-2.528346010590168e-9,-4.153721159190534e-4,-4.100833523430551e-5,-2.5184530965389194e-9,-4.1489323356661917e-4,-4.0810007275967356e-5,-2.4867440031700544e-9,-4.1451934265011636e-4,-4.056149998336314e-5,-2.443004015897615e-9,-4.14257057163492e-4,-4.032253315069391e-5,-2.399280027476654e-9,-4.140829643037679e-4,-4.014115402159914e-5,-2.365624213252662e-9,-4.139573594589503e-4,-4.004203540654317e-5,-2.347719850083814e-9,-4.1383883902764264e-4,-4.0026135838993726e-5,-2.346648557292666e-9,-4.1369395521428763e-4,-4.007714518494776e-5,-2.359918634965156e-9,-4.1350116283010187e-4,-4.0169438678037385e-5,-2.3828275358386247e-9,-4.132509204849382e-4,-4.02745458009851e-5,-2.409672202656709e-9,-4.12944098431814e-4,-4.036544899383293e-5,-2.434693727626981e-9,-4.1259003312596384e-4,-4.0419283786942026e-5,-2.4528076757501718e-9,-4.1220463180241106e-4,-4.041920894315126e-5,-2.460165886913844e-9,-4.118084241146482e-4,-4.035589750016881e-5,-2.4545551866637317e-9,-4.114243079808707e-4,-4.0228769440772255e-5,-2.4356339267987566e-9,-4.1107472547243434e-4,-4.004674770704506e-5,-2.4050065497151834e-9,-4.107782411517076e-4,-3.982801465533893e-5,-2.3661110631512318e-9,-4.1054594259781567e-4,-3.959827057314572e-5,-2.3238887851075064e-9,-4.10378395758591e-4,-3.938732383127705e-5,-2.2842171118400988e-9,-4.1026395191599125e-4,-3.922422342717951e-5,-2.2530908614786637e-9,-4.101791123460307e-4,-3.9131562701737556e-5,-2.23557803383868e-9,-4.100913745510124e-4,-3.911997116984464e-5,-2.2346619299068557e-9,-4.099645570075549e-4,-3.9183950507037974e-5,-2.250178149363926e-9,-4.097661972198411e-4,-3.930021397784681e-5,-2.278150153434694e-9,-4.0947612025577423e-4,-3.9429780090729804e-5,-2.310922006873919e-9,-4.090943862753506e-4,-3.952493336780649e-5,-2.338459230035468e-9,-4.086456517799025e-4,-3.954111611657848e-5,-2.3508883014153373e-9,-4.081763984351799e-4,-3.945141594102922e-5,-2.34172318966217e-9,-4.0774310491620253e-4,-3.9258165010706924e-5,-2.3105104000586573e-9,-4.0739410414728915e-4,-3.899487440782558e-5,-2.2634068239480487e-9,-4.071530517716821e-4,-3.8715380711305496e-5,-2.2110648360130516e-9,-4.07012517735472e-4,-3.8474663908117465e-5,-2.1647814676881445e-9,-4.0694031503661626e-4,-3.83111097332982e-5,-2.132885090794267e-9,-4.0689355328915437e-4,-3.823811500140989e-5,-2.118905391336737e-9,-4.0683245131795863e-4,-3.824611552137267e-5,-2.121744169365106e-9,-4.0672875066320724e-4,-3.83106584547127e-5,-2.137053712749919e-9,-4.065681541205749e-4,-3.8401284561318635e-5,-2.1588842425524963e-9,-4.063489170280104e-4,-3.848820200325258e-5,-2.181051087605659e-9,-4.0607899542711783e-4,-3.854620981262006e-5,-2.198080022710527e-9,-4.0577321760118843e-4,-3.855665233157998e-5,-2.2057933114142437e-9,-4.054509336224549e-4,-3.850839314776131e-5,-2.2016348705458945e-9,-4.051339790749997e-4,-3.839848304650612e-5,-2.1848218714545927e-9,-4.0484452728607707e-4,-3.8232763492249975e-5,-2.1563917184551757e-9,-4.046024009615301e-4,-3.8026166396044666e-5,-2.1191704389762e-9,-4.0442170184689123e-4,-3.780206287518215e-5,-2.0776109012345515e-9,-4.043071522932379e-4,-3.7589916539575194e-5,-2.037394588277785e-9,-4.0425112417486777e-4,-3.7420805564781884e-5,-2.0046841607319565e-9,-4.0423270413599097e-4,-3.732108474951415e-5,-1.9850017433876396e-9,-4.042199941499895e-4,-3.7305461211264305e-5,-1.9818909364028005e-9,-4.041759729458141e-4,-3.7371576180890595e-5,-1.995722476799383e-9,-4.040669367934563e-4,-3.749819781395151e-5,-2.023080949156707e-9,-4.038714430168704e-4,-3.764824543910441e-5,-2.0570719150784504e-9,-4.0358723837979936e-4,-3.777652245214125e-5,-2.088652532821821e-9,-4.0323392522940814e-4,-3.784066890271968e-5,-2.108786263221883e-9,-4.028499668827034e-4,-3.7812733764463005e-5,-2.110917795052249e-9,-4.024839213955273e-4,-3.768809159565209e-5,-2.0930452841422504e-9,-4.0218154105103323e-4,-3.748838143603014e-5,-2.0586134771402745e-9,-4.0197245691300375e-4,-3.7256296497542606e-5,-2.0156987881971886e-9,-4.0186148165965595e-4,-3.7042976733979594e-5,-1.974586200188155e-9,-4.018283808339541e-4,-3.6892494178303976e-5,-1.944623987475064e-9,-4.0183608868270894e-4,-3.6829760565161567e-5,-1.9316327261505804e-9,-4.0184323029191903e-4,-3.685629057238657e-5,-1.9367984159228025e-9,-4.0181540972463755e-4,-3.6953941902521246e-5,-1.9571606390107712e-9,-4.0173160962337696e-4,-3.7093205760581396e-5,-1.9871078224997477e-9,-4.015852743493223e-4,-3.724183204408453e-5,-2.0200937211791826e-9,-4.013819118193629e-4,-3.737112093517171e-5,-2.0500268935527753e-9,-4.0113546642722405e-4,-3.745934046666174e-5,-2.072145790532876e-9,-4.008649162475529e-4,-3.749303145455463e-5,-2.0834320591036338e-9,-4.005915876567197e-4,-3.746722429672266e-5,-2.0827005722215756e-9,-4.00337051736825e-4,-3.7385338843855984e-5,-2.0705219071079996e-9,-4.0012112723467486e-4,-3.725911600757237e-5,-2.0491068141487655e-9,-3.9995945006566694e-4,-3.710838880148392e-5,-2.02219878218256e-9,-3.9986036290861937e-4,-3.696000071532959e-5,-1.9948926212214277e-9,-3.9982147601925637e-4,-3.684496081292581e-5,-1.9731958999948373e-9,-3.998270224104261e-4,-3.6793151712941985e-5,-1.9631309255681626e-9,-3.9984782850540707e-4,-3.6825820017548094e-5,-1.9693326621769157e-9,-3.9984567314217234e-4,-3.6947721487253395e-5,-1.9934475370821446e-9,-3.997823060669654e-4,-3.714229558595796e-5,-2.0329994613703186e-9,-3.996308094008664e-4,-3.7373115060623765e-5,-2.0814266273117242e-9,-3.99384988712439e-4,-3.759249203934011e-5,-2.1295566994293455e-9,-3.9906271036433164e-4,-3.775472405457742e-5,-2.1681019565900638e-9,-3.987016202917927e-4,-3.7829193936713294e-5,-2.190272534708571e-9,-3.9834887836798216e-4,-3.780875269054671e-5,-2.193608295241445e-9,-3.980485538263064e-4,-3.7711034648837475e-5,-2.1805271009791155e-9,-3.978305141809676e-4,-3.75729460791574e-5,-2.157555028882998e-9,-3.9770366530245046e-4,-3.744037328616604e-5,-2.1335311050243456e-9,-3.9765504299890545e-4,-3.735613027207092e-5,-2.1172878104897155e-9,-3.976546923721489e-4,-3.7349520461290274e-5,-2.1154458093897077e-9,-3.976645841027215e-4,-3.7430385886824955e-5,-2.1309453027747796e-9,-3.9764857481630915e-4,-3.7588969553787584e-5,-2.16269710822895e-9,-3.975803240688057e-4,-3.78008285196242e-5,-2.206328545718188e-9,-3.9744725472712117e-4,-3.8034406317778884e-5,-2.2556260006985536e-9,-3.972504331599879e-4,-3.825848207709496e-5,-2.304116143937135e-9,-3.970016678082849e-4,-3.8447576129588216e-5,-2.346328968114079e-9,-3.967195597523896e-4,-3.85847761019194e-5,-2.378535140950185e-9,-3.9642580202908984e-4,-3.8662499543895226e-5,-2.3989805580658325e-9,-3.9614227617272086e-4,-3.8682093918056946e-5,-2.407778956750608e-9,-3.9588887819566896e-4,-3.865305185717903e-5,-2.406662527805749e-9,-3.9568165300506234e-4,-3.8592229765188354e-5,-2.3987512411946675e-9,-3.9553072846361295e-4,-3.852295871827556e-5,-2.3883867003944353e-9,-3.9543774790634314e-4,-3.847345808670505e-5,-2.3809297326839213e-9,-3.9539305003282924e-4,-3.847364136251777e-5,-2.382287114028292e-9,-3.9537371824626544e-4,-3.854948972135635e-5,-2.397910865159832e-9,-3.9534454501332527e-4,-3.8715107497318946e-5,-2.4312142198376576e-9,-3.952641095528031e-4,-3.896460770802551e-5,-2.4818178598376683e-9,-3.9509636929992376e-4,-3.9268210077471814e-5,-2.5445577437541576e-9,-3.9482433024793544e-4,-3.957704143478872e-5,-2.6102337078048142e-9,-3.944590437311957e-4,-3.983728465279895e-5,-2.66827632892777e-9,-3.9403811672779804e-4,-4.000826568398732e-5,-2.7102607573795425e-9,-3.936136334447647e-4,-4.007582516475161e-5,-2.732568246881595e-9,-3.932354489171214e-4,-4.005509986930359e-5,-2.7370829288428234e-9,-3.9293735005261444e-4,-3.9983124149450465e-5,-2.730028550413103e-9,-3.927304162113228e-4,-3.990616554842289e-5,-2.7198283129693987e-9,-3.926037104670152e-4,-3.986712394333029e-5,-2.7148744382944538e-9,-3.925300340245018e-4,-3.989630581245046e-5,-2.721726552456415e-9,-3.924740322961887e-4,-4.000673567964125e-5,-2.7439566656949624e-9,-3.9240044960224226e-4,-4.0193797020507027e-5,-2.781711773518208e-9,-3.9228100027058804e-4,-4.043835453992976e-5,-2.8319939335662753e-9,-3.920988397429943e-4,-4.071220949346134e-5,-2.8895632795737313e-9,-3.918501286346216e-4,-4.098447018044798e-5,-2.9482215655903276e-9,-3.915428759247042e-4,-4.1227354423628e-5,-3.002126932202798e-9,-3.911938860598323e-4,-4.142035578932055e-5,-3.0468184632871506e-9,-3.908248865257149e-4,-4.1552391217979064e-5,-3.079773043002786e-9,-3.904587877773441e-4,-4.162213920665322e-5,-3.100490246668063e-9,-3.901166540589265e-4,-4.163716629526032e-5,-3.1102498369570066e-9,-3.898154596295406e-4,-4.1612528206521545e-5,-3.1117545046976984e-9,-3.895663343014008e-4,-4.15692477287104e-5,-3.108816873159751e-9,-3.893729274795302e-4,-4.1532643167673676e-5,-3.106122424164249e-9,-3.8922964958095066e-4,-4.1530120920376783e-5,-3.108959796232942e-9,-3.8911993547672825e-4,-4.158773400879558e-5,-3.1226873440949273e-9,-3.890154780111431e-4,-4.172477613316137e-5,-3.1516937951170783e-9,-3.8887832398421657e-4,-4.1946490302301866e-5,-3.1978260954989524e-9,-3.8866798799491536e-4,-4.2236923527193535e-5,-3.2587392014650204e-9,-3.883541075724722e-4,-4.255643026767475e-5,-3.3271796700881e-9,-3.879309179981178e-4,-4.2848970224092304e-5,-3.3923178303223024e-9,-3.874252936797595e-4,-4.3060086306725585e-5,-3.4432808142227515e-9,-3.8689085406422015e-4,-4.315822428367038e-5,-3.473343383367832e-9,-3.863889877673784e-4,-4.3147231358598694e-5,-3.4823712443678767e-9,-3.859670303418556e-4,-4.306282988945449e-5,-3.476235200012914e-9,-3.856450179732965e-4,-4.29567332020061e-5,-3.4640108169692097e-9,-3.8541502948697586e-4,-4.287851646215824e-5,-3.4548315486565543e-9,-3.852493149355605e-4,-4.2863147399264384e-5,-3.4556957290431317e-9,-3.851111325842977e-4,-4.2926194690833945e-5,-3.4704676625369628e-9,-3.849641750666217e-4,-4.306488479653104e-5,-3.4997555963823663e-9,-3.8477904449105344e-4,-4.326230537360815e-5,-3.541315667419064e-9,-3.845368505256895e-4,-4.349269606106779e-5,-3.5907716079917845e-9,-3.842305470775176e-4,-4.372677264988809e-5,-3.6425556238611925e-9,-3.838644713396162e-4,-4.393662457551494e-5,-3.690971057311515e-9,-3.834524001017426e-4,-4.4099766813166904e-5,-3.731195660582228e-9,-3.8301455462920074e-4,-4.4201952462350065e-5,-3.760022682061001e-9,-3.8257407697839317e-4,-4.42385677285092e-5,-3.776219192075404e-9,-3.821534971407641e-4,-4.42146190699868e-5,-3.78049345493217e-9,-3.8177167811354886e-4,-4.414353188785048e-5,-3.775176115440497e-9,-3.814415037458072e-4,-4.404520966037506e-5,-3.763795599090132e-9,-3.811682438952999e-4,-4.3943745048884684e-5,-3.750686091708826e-9,-3.8094841874788385e-4,-4.3864881721126706e-5,-3.740645067077998e-9,-3.807690606418496e-4,-4.383310219135978e-5,-3.738542478624394e-9,-3.8060747113549404e-4,-4.3868015094879415e-5,-3.7487069852998005e-9,-3.8043212896826716e-4,-4.397964230952124e-5,-3.77392849591353e-9,-3.8020614214202126e-4,-4.416283549922484e-5,-3.814126337469046e-9,-3.7989477348660916e-4,-4.43925934432593e-5,-3.8651369785543476e-9,-3.7947723172862823e-4,-4.462397219530305e-5,-3.918497560033356e-9,-3.789593875598948e-4,-4.4800964639163135e-5,-3.96317158934382e-9,-3.783796554624242e-4,-4.487522211492297e-5,-3.989310173516736e-9,-3.7780028171270733e-4,-4.482731494297352e-5,-3.992457390009027e-9,-3.772848187336151e-4,-4.4677289049787794e-5,-3.975587279866091e-9,-3.768738589342568e-4,-4.4476302813578715e-5,-3.947557776892742e-9,-3.765731596693725e-4,-4.4284647088400656e-5,-3.919157973229763e-9,-3.763583684669076e-4,-4.415011216339383e-5,-3.8993178944763496e-9,-3.7618935482083637e-4,-4.409689236608701e-5,-3.893153730927883e-9,-3.760245905568384e-4,-4.412564418670974e-5,-3.901816527226052e-9,-3.758305281239963e-4,-4.4219737409461237e-5,-3.923290331122069e-9,-3.755856622553639e-4,-4.435289044370741e-5,-3.953443754350989e-9,-3.752809867131644e-4,-4.449563849145108e-5,-3.987032034029203e-9,-3.749186681115099e-4,-4.462002058569582e-5,-4.018598786101294e-9,-3.745100126286204e-4,-4.4702883418774216e-5,-4.043293546650498e-9,-3.740730272909859e-4,-4.472824114947566e-5,-4.057558558959361e-9,-3.736296275242296e-4,-4.4688796131403827e-5,-4.059581153155581e-9,-3.732025909944763e-4,-4.4586579231906474e-5,-4.049448013925343e-9,-3.7281240901532864e-4,-4.4432606619089756e-5,-4.029008414573869e-9,-3.724743361521061e-4,-4.4245446122239154e-5,-4.001513612609417e-9,-3.7219604683176886e-4,-4.404881315412431e-5,-3.971147889469539e-9,-3.719761559946201e-4,-4.386851506422404e-5,-3.942550572712875e-9,-3.718036869016746e-4,-4.3729011292962504e-5,-3.920339561133363e-9,-3.716585476438696e-4,-4.364979112255484e-5,-3.908574248164302e-9,-3.715130942800803e-4,-4.364173138022532e-5,-3.910078188684471e-9,-3.713350457921283e-4,-4.370352841575415e-5,-3.925586069346227e-9,-3.7109238380513845e-4,-4.3818651024463044e-5,-3.9528488394828995e-9,-3.707607845405598e-4,-4.395425389302266e-5,-3.986112633364346e-9,-3.7033298488081413e-4,-4.406449097933762e-5,-4.01659369367896e-9,-3.698271408886742e-4,-4.4100617660546984e-5,-4.034478858226037e-9,-3.6928850300559833e-4,-4.402761136944001e-5,-4.032309510928544e-9,-3.6877886950402043e-4,-4.3841161627626426e-5,-4.008397336623387e-9,-3.68354844176475e-4,-4.3574127073054776e-5,-3.9681227490621515e-9,-3.680456442399449e-4,-4.328536888044946e-5,-3.921896540270247e-9,-3.678438514995482e-4,-4.303605390842075e-5,-3.88088052714649e-9,-3.6771344272492777e-4,-4.286765668321312e-5,-3.853066475373028e-9,-3.6760744211130974e-4,-4.279271827029995e-5,-3.841571155142976e-9,-3.6748400287878505e-4,-4.279868404809011e-5,-3.845110101089603e-9,-3.6731503805980255e-4,-4.2858040425471004e-5,-3.859505188909107e-9,-3.670878782353395e-4,-4.293828963274571e-5,-3.879232548481663e-9,-3.668030259099282e-4,-4.300887457302174e-5,-3.8986149146387406e-9,-3.664707239972699e-4,-4.304497730933188e-5,-3.912649349560868e-9,-3.6610775839668016e-4,-4.302929792015812e-5,-3.917575783781463e-9,-3.657347454762509e-4,-4.295287241734541e-5,-3.911245377621743e-9,-3.653736412651876e-4,-4.2815417391808795e-5,-3.893281236926014e-9,-3.650452228879931e-4,-4.2625259277326516e-5,-3.865029786249455e-9,-3.6476641984123815e-4,-4.239866016669585e-5,-3.8293301914713776e-9,-3.645476115673927e-4,-4.215819173345968e-5,-3.790137077788593e-9,-3.643903517009124e-4,-4.192994909126311e-5,-3.752032661708107e-9,-3.642861036996599e-4,-4.173977362622034e-5,-3.71966635491313e-9,-3.642164327955368e-4,-4.160892942215545e-5,-3.697132215015159e-9,-3.641549093482707e-4,-4.1549858066543754e-5,-3.6872863278909777e-9,-3.6407072313266787e-4,-4.1562773802817286e-5,-3.6910546876715064e-9,-3.639337297548633e-4,-4.1633785245227165e-5,-3.706842402789998e-9,-3.637205402382895e-4,-4.17351263688552e-5,-3.730239026226662e-9,-3.634210733541716e-4,-4.182826882524199e-5,-3.7543125950062615e-9,-3.6304426985984744e-4,-4.187077889867399e-5,-3.770791848359487e-9,-3.626205679360432e-4,-4.1827023967553126e-5,-3.772195287003563e-9,-3.621980590998262e-4,-4.168082324199709e-5,-3.754465893092228e-9,-3.6183040236259707e-4,-4.144515737090433e-5,-3.719051514202747e-9,-3.615588707716338e-4,-4.1162290906568653e-5,-3.6731031521314867e-9,-3.61396538504054e-4,-4.089083947416614e-5,-3.627175685529882e-9,-3.6132387086853867e-4,-4.0684523717909506e-5,-3.5913642442355727e-9,-3.612984871112935e-4,-4.057381858184938e-5,-3.57191628278744e-9,-3.6127263538453984e-4,-4.0559572504084276e-5,-3.5699106570700582e-9,-3.6120844626298833e-4,-4.061897653845609e-5,-3.5820719173724824e-9,-3.610852118619653e-4,-4.0717434213808e-5,-3.6026558942381903e-9,-3.608991626924136e-4,-4.0819528038116416e-5,-3.625305177385425e-9,-3.6065929725962267e-4,-4.0895889554540754e-5,-3.644354040211268e-9,-3.6038248887045136e-4,-4.092611299111932e-5,-3.6555594903413846e-9,-3.6008948797461456e-4,-4.089924983103489e-5,-3.6564197922185135e-9,-3.598020583044798e-4,-4.0813324951301555e-5,-3.6462285238279096e-9,-3.5954081132138837e-4,-4.06746448702424e-5,-3.625955167087689e-9,-3.593232203764928e-4,-4.049706401005377e-5,-3.5980159849031315e-9,-3.591614767911618e-4,-4.030096233320472e-5,-3.5659792059672047e-9,-3.5906017581369425e-4,-4.011143008152642e-5,-3.5342021902016163e-9,-3.590142746293756e-4,-3.9955202075565014e-5,-3.5073577657903728e-9,-3.5900813493897933e-4,-3.9856294031816824e-5,-3.4898049410216977e-9,-3.590165228657977e-4,-3.9830885148132995e-5,-3.484809323888809e-9,-3.5900811619758537e-4,-3.988259608517585e-5,-3.4937187933879266e-9,-3.589513508368191e-4,-3.9999692692636196e-5,-3.515316951993148e-9,-3.588215300116031e-4,-4.015553409221791e-5,-3.5456245459726613e-9,-3.586074994236263e-4,-4.031277515563591e-5,-3.578347724118303e-9,-3.5831611404968134e-4,-4.0430887172238557e-5,-3.6060328154525907e-9,-3.5797300106842354e-4,-4.0475752013014714e-5,-3.621798180660383e-9,-3.5761860209188446e-4,-4.0429328523306393E-05,-3.6212892232579545e-9,-3.572993273213688e-4,-4.029669010026284e-5,-3.604282007806e-9,-3.5705516107877836e-4,-4.01074134564653e-5,-3.575261109336151e-9,-3.56907171864305e-4,-3.990910227757714e-5,-3.542466178765705e-9,-3.5685000952815797e-4,-3.975360446642084e-5,-3.51546370509442e-9,-3.568535768631939e-4,-3.968060851260814e-5,-3.502095452651505e-9,-3.568738387353768e-4,-3.9705767185260144e-5,-3.506123139270059e-9,-3.568676969066613e-4,-3.981847075560239e-5,-3.526548679024781e-9,-3.568050583051709e-4,-3.9988930782059254e-5,-3.558632436406407e-9,-3.56673931076042e-4,-4.017965642244248e-5,-3.595815124716367e-9,-3.564788653472729e-4,-4.035578451744323e-5,-3.631596410599711e-9,-3.562358193015023e-4,-4.049130472750036e-5,-3.6608170038248088e-9,-3.5596655047241536e-4,-4.057119598922274e-5,-3.6802591959901357e-9,-3.556941971200325e-4,-4.059099060777297e-5,-3.688733399766354e-9,-3.554403466676326e-4,-4.055530827745248e-5,-3.6868596918516015e-9,-3.552231502274103e-4,-4.047630480756108e-5,-3.6767210257453985e-9,-3.550558309426621e-4,-4.0372330118324426e-5,-3.6615103358701634e-9,-3.549450842029947e-4,-4.0266541812810685e-5,-3.6452166207126978e-9,-3.5488926874896996e-4,-4.018488717008979e-5,-3.6323023478007748e-9,-3.5487679855453013e-4,-4.0152863925988295e-5,-3.6272565039705226e-9,-3.5488564634128154e-4,-4.019082120417089e-5,-3.6339063053833576e-9,-3.548851821818268e-4,-4.030831790087331e-5,-3.6544836887830023e-9,-3.548412788564619e-4,-4.049915486044093e-5,-3.6886696467672877e-9,-3.547243771613122e-4,-4.073952000048624e-5,-3.733057102710848e-9,-3.5451840841679887e-4,-4.0991294984085655e-5,-3.781467494098887e-9,-3.5422725173712733e-4,-4.121070540757682e-5,-3.826258266543762e-9,-3.538757710829669e-4,-4.136004087638724e-5,-3.8603033376723175e-9,-3.53504443877645e-4,-4.1418554823238366e-5,-3.879000807542093e-9,-3.5315908496719346e-4,-4.1388813578662445e-5,-3.881636157749867e-9,-3.528788443462086e-4,-4.1296476166252965e-5,-3.871679975513234e-9,-3.5268596813342254e-4,-4.118364620333568e-5,-3.855939529728651e-9,-3.525801622010045e-4,-4.109766926615156e-5,-3.84277572321506e-9,-3.5253922633776333e-4,-4.107846753507557e-5,-3.839853266345332e-9,-3.5252589900936437e-4,-4.1148172477191464e-5,-3.852089139473279e-9,-3.5249873593641004e-4,-4.130635182893659e-5,-3.880468677924388e-9,-3.524232758040045e-4,-4.153215835850133e-5,-3.922098707575269e-9,-3.5227977421103506e-4,-4.179200475176239e-5,-3.971370515911904e-9,-3.5206553777650213e-4,-4.2049383308559924e-5,-4.02168889154195e-9,-3.517923456022032e-4,-4.22732706596802e-5,-4.067108127961648e-9,-3.5148116482799436e-4,-4.2443054420599876e-5,-4.103423630040207e-9,-3.5115656427665365e-4,-4.254990072284108e-5,-4.128602719456839e-9,-3.508422977149487e-4,-4.259571927212223e-5,-4.1426852963775e-9,-3.505584283820493e-4,-4.2591075740938084e-5,-4.1473814440995675e-9,-3.503196597354921e-4,-4.2553010117369735e-5,-4.145588069811775e-9,-3.5013425081355416e-4,-4.250315194947812e-5,-4.140977734111264e-9,-3.5000296732766683e-4,-4.246594915992028e-5,-4.1376949637137355e-9,-3.4991789475969336e-4,-4.2466442610266224e-5,-4.140069290235601e-9,-3.4986146693382345e-4,-4.252696515740907e-5,-4.152177172551735e-9,-3.498066307483597e-4,-4.266243723623054e-5,-4.177099698568324e-9,-3.497195305195477e-4,-4.287472041112924e-5,-4.215884841538455e-9,-3.495659175480646e-4,-4.31478811621325e-5,-4.266536865943841e-9,-3.4932096349046604e-4,-4.3447520413318964e-5,-4.323660910585198e-9,-3.4897946134101256e-4,-4.372699512012349e-5,-4.379354851830018e-9,-3.4856132871286715e-4,-4.394038767390347e-5,-4.425380590164783e-9,-3.481082489458901e-4,-4.4057719624662955e-5,-4.455829749739181e-9,-3.4767160295073125e-4,-4.407548988414973e-5,-4.469069235668393e-9,-3.4729671592580966e-4,-4.401761276765464e-5,-4.468122927844235e-9,-3.470101043459885e-4,-4.392694681445468e-5,-4.459514042827404e-9,-3.4681399513372885e-4,-4.3851866775344917e-5,-4.4512484058967996e-9,-3.466884675872167e-4,-4.383320048423082e-5,-4.450711814114548e-9,-3.465989335162038e-4,-4.3895141685846634e-5,-4.463003731704032e-9,-3.4650592936654275e-4,-4.404155435899953e-5,-4.4899789588464385e-9,-3.4637451628011674e-4,-4.425746261242522e-5,-4.53010146035591e-9,-3.46181278482088e-4,-4.451449326164072e-5,-4.579071229769213e-9,-3.459177599712526e-4,-4.477844122387709e-5,-4.631023039653653e-9,-3.4559013570456575e-4,-4.501691233562397e-5,-4.679952084717743e-9,-3.452158716119919e-4,-4.520525913805162e-5,-4.720973867124305e-9,-3.4481879495999203e-4,-4.532981541959789e-5,-4.7511223937350465e-9,-3.4442408015957925e-4,-4.538843813449534e-5,-4.769589480143558e-9,-3.440542089166945e-4,-4.5389084894805184e-5,-4.7774936884748956e-9,-3.437263070319252e-4,-4.534740102436488e-5,-4.77738576894948e-9,-3.4345067735983324e-4,-4.5284143124787143e-5,-4.772713716467364e-9,-3.4323003778487113e-4,-4.5222842054429787e-5,-4.76739691027074e-9,-3.4305901194424496e-4,-4.518761784714889e-5,-4.765524511352927e-9,-3.429236989818069e-4,-4.52007347246193e-5,-4.771068404277782e-9,-3.428015696217947e-4,-4.5279382227483e-5,-4.787430575127021e-9,-3.426625060919474e-4,-4.543136538951815e-5,-4.8166784633623644E-09,-3.424723163020663e-4,-4.565015092623224e-5,-4.858517932523486e-9,-3.4219991287895055e-4,-4.591113849483137e-5,-4.9093917591879784e-9,-3.418278103507178e-4,-4.6172490727433865e-5,-4.962406765475092e-9,-3.413624942079579e-4,-4.6383736833411844e-5,-5.008742784565768e-9,-3.408383536332906e-4,-4.650185695871724e-5,-5.040476506469633e-9,-3.4030994982600497e-4,-4.650853684917004e-5,-5.053640312983224e-9,-3.398339484712107e-4,-4.641889431496161e-5,-5.0498114969366615e-9,-3.394494690556336e-4,-4.627597601679743e-5,-5.03533340901495e-9,-3.3916682212753793e-4,-4.6134299214963423e-5,-5.018789578479401e-9,-3.389684970747851e-4,-4.60416761329767e-5,-5.0082068715226695e-9,-3.388189563580666e-4,-4.602714616208865e-5,-5.009119290870518e-9,-3.386770001401216e-4,-4.609734320211425e-5,-5.023773996416256e-9,-3.385060967047203e-4,-4.623938128036451e-5,-5.051224680335727e-9,-3.382808819877009e-4,-4.642712042057251e-5,-5.0879722483668916e-9,-3.3798991630609986e-4,-4.662831095629719e-5,-5.128915587919849e-9,-3.3763548039858775e-4,-4.6811176467318076e-5,-5.16845422831316e-9,-3.3723121913479214e-4,-4.694969103565298e-5,-5.201576989894772e-9,-3.367983998553216e-4,-4.7027084779648636e-5,-5.224733145745607e-9,-3.3636159656376993e-4,-4.703738149569362e-5,-5.236319126134027e-9,-3.359445418555763e-4,-4.698513068870385e-5,-5.236724866703748e-9,-3.3556670577894265e-4,-4.688372871358966e-5,-5.228009274195705e-9,-3.3524095168534554e-4,-4.675286146676685e-5,-5.213367901026198e-9,-3.3497229454820115e-4,-4.661567260074138e-5,-5.196589566113095e-9,-3.3475746495397114e-4,-4.6496053972731513e-5,-5.181629379466889e-9,-3.3458496403935856e-4,-4.6416067332450106e-5,-5.172290074158099e-9,-3.3443550989848553e-4,-4.639329367171046e-5,-5.171902756508261e-9,-3.3428303229029717e-4,-4.64378573046309e-5,-5.182859497219969e-9,-3.3409679136510515e-4,-4.654895942300463e-5,-5.205901867299847e-9,-3.3384565314112754e-4,-4.671137333713532e-5,-5.2392644177281354e-9,-3.3350538321036714e-4,-4.689360879171389e-5,-5.278078891925973e-9,-3.330683964243518e-4,-4.705068211910057e-5,-5.314688239576653e-9,-3.3255256023083976e-4,-4.713428191609814e-5,-5.340419822664278e-9,-3.3200274383931173e-4,-4.71097541805525e-5,-5.3486420687704235e-9,-3.314797357602177e-4,-4.6972927801329136e-5,-5.337761831657595e-9,-3.3103860655846234e-4,-4.67558263411006e-5,-5.312260680512601e-9,-3.307076685003807e-4,-4.651535747158061e-5,-5.28090259224886e-9,-3.30480214378984e-4,-4.6310845214460665e-5,-5.2532057684234896e-9,-3.303220348953695e-4,-4.618357322333606e-5,-5.236272390095169e-9,-3.301874844254908e-4,-4.61477186883596e-5,-5.233313814606197e-9,-3.3003452239918076e-4,-4.619282888887948e-5,-5.243799607308075e-9,-3.2983367667361197e-4,-4.6292393090905275e-5,-5.264447531098321e-9,-3.2957087722242947e-4,-4.6413211027825386e-5,-5.2904004316313725e-9,-3.2924630863698787e-4,-4.652281087401979e-5,-5.316302669134748e-9,-3.288714144932077e-4,-4.659436358753661e-5,-5.337217434375077e-9,-3.284653025069503e-4,-4.6609576179093505e-5,-5.349376028202255e-9,-3.2805103471112654e-4,-4.656006986482792e-5,-5.35069069746132e-9,-3.2765205016821133e-4,-4.6447489372098676E-05,-5.340948027169847e-9,-3.2728894386480116e-4,-4.628254233746377e-5,-5.321669265696422e-9,-3.2697676918230653e-4,-4.608314579988514e-5,-5.295709141439522e-9,-3.2672307735294367e-4,-4.5871826451843845e-5,-5.266715731905392e-9,-3.265269163253492e-4,-4.567268490866273e-5,-5.238595811180517e-9,-3.263787833299249e-4,-4.5508326939279494e-5,-5.2150856928611045e-9,-3.262613612892449e-4,-4.5396953226487785e-5,-5.199410066665686e-9,-3.26150973687626e-4,-4.5349627530952965e-5,-5.193932690177878e-9,-3.2601983786595027e-4,-4.5367769831319596e-5,-5.1997081785981995e-9,-3.2583937029624085e-4,-4.544098475670977e-5,-5.215918457321146e-9,-3.2558503734766617e-4,-4.554569690961154e-5,-5.2393381578890325e-9,-3.252430307869566e-4,-4.5645933134909383e-5,-5.264196058241929e-9,-3.248178384294444e-4,-4.56983335628188e-5,-5.282923877448141e-9,-3.2433764411315686e-4,-4.566298738150629e-5,-5.288101154267343e-9,-3.238524934028116e-4,-4.55187894312056e-5,-5.275271384380036e-9,-3.2342122598822694e-4,-4.527677794176033e-5,-5.245365700942163e-9,-3.230898582700321e-4,-4.498163827286755e-5,-5.205044425823437e-9,-3.228725935037573e-4,-4.469651453348592e-5,-5.164266989512154e-9,-3.2274750094473347e-4,-4.4478159074842894e-5,-5.13235180184745e-9,-3.226689152698676e-4,-4.435700005748701e-5,-5.114830829337623e-9,-3.225871774071815e-4,-4.433186738587753e-5,-5.112508862693316e-9,-3.2246425807672813e-4,-4.437776497525427e-5,-5.1224162241922625e-9,-3.2228031504722966e-4,-4.445858657848031e-5,-5.139485592758135e-9,-3.2203286741891803e-4,-4.4538062588412724E-05,-5.1580709737048375e-9,-3.217324318411406e-4,-4.4586481028774453E-05,-5.173027330322962e-9,-3.213975733128406e-4,-4.458364652752997e-5,-5.180397855754135e-9,-3.210507152123642e-4,-4.451955192695055e-5,-5.177821168001773e-9,-3.20714821071863e-4,-4.43939735421001e-5,-5.164703758157465e-9,-3.2041064399458284e-4,-4.421548906702248e-5,-5.1421458139077516e-9,-3.2015437220027257e-4,-4.400000934734236e-5,-5.112638550353013e-9,-3.199556359923085e-4,-4.3768795235697604e-5,-5.079609309330488e-9,-3.1981598750983545e-4,-4.354585021416585e-5,-5.046904699548832e-9,-3.197281840014739e-4,-4.3354726543107915e-5,-5.018289250760496e-9,-3.196765829420705e-4,-4.321510531744181e-5,-4.997015044656991e-9,-3.1963870183165634e-4,-4.313959806056474e-5,-4.985452141399794e-9,-3.195878597550035e-4,-4.313112514042971e-5,-4.984725308729074e-9,-3.1949679113388595e-4,-4.318123126172128e-5,-4.994338339842217e-9,-3.1934206103072054e-4,-4.326970683766678e-5,-5.0118522340722995e-9,-3.191090769027233e-4,-4.336592775766331e-5,-5.032784985900198e-9,-3.1879727330728615e-4,-4.3432619842126424e-5,-5.0510003085641095e-9,-3.184242585414621e-4,-4.3432905625344e-5,-5.059844813029959e-9,-3.180265341602522e-4,-4.3340679734383175e-5,-5.054050804727019e-9,-3.1765375634226675e-4,-4.315212077889462e-5,-5.031931810784182e-9,-3.173550483018549e-4,-4.289299386726835e-5,-4.996837554368338e-9,-3.1716080997909414e-4,-4.261505262909454e-5,-4.9567039021442e-9,-3.170692069796597e-4,-4.237923706416617e-5,-4.921374850462595e-9,-3.170465026363197e-4,-4.223264659485568e-5,-4.898891858407981e-9,-3.170418960140496e-4,-4.21921256965402e-5,-4.892790866082162e-9,-3.1700761388347835e-4,-4.224278875220216e-5,-4.901672313350512e-9,-3.169131831034806e-4,-4.234911923149743e-5,-4.920678900423363e-9,-3.16749371627084e-4,-4.246978287171236e-5,-4.943593716023741e-9,-3.165243898644444e-4,-4.2568904032282556e-5,-4.964541739482594e-9,-3.1625720934575716e-4,-4.262161789567898e-5,-4.9789925323940574e-9,-3.159714090148497e-4,-4.2615163483100204e-5,-4.984192983307216e-9,-3.1569080936814757e-4,-4.254769010175503e-5,-4.979239205595006e-9,-3.154366980394452e-4,-4.242640923152246e-5,-4.964927408765917e-9,-3.1522594108550356e-4,-4.226576420878259e-5,-4.9434488536958256e-9,-3.150694594909588e-4,-4.2085617046374826e-5,-4.9179780034059015e-9,-3.1497088780468846e-4,-4.190919872197873e-5,-4.892216555795521e-9,-3.1492551795328115e-4,-4.1760510317359374e-5,-4.869937621819285e-9,-3.1491993926755705e-4,-4.166103135750512e-5,-4.85453930904946e-9,-3.1493292291119807e-4,-4.162602317937051e-5,-4.8486082924002386e-9,-3.149378852148921e-4,-4.166109759027768e-5,-4.853496717228234e-9,-3.149068763252208e-4,-4.1759869297922245e-5,-4.8689420569251265e-9,-3.1481563886056355e-4,-4.1903492821241635e-5,-4.892817724760096e-9,-3.146489018901334e-4,-4.206263788736928e-5,-4.921152563389806e-9,-3.1440486675449474e-4,-4.220199291018188e-5,-4.948556753677259e-9,-3.1409782736031844e-4,-4.2286972882281444e-5,-4.969141215356648e-9,-3.1375783301927705e-4,-4.229193221838251e-5,-4.9779020409811375e-9,-3.1342629281164673e-4,-4.2208473219180394e-5,-4.972322659694826e-9,-3.131469410284784e-4,-4.205134100763301e-5,-4.953675901336095e-9,-3.129532228356514e-4,-4.185850783786602e-5,-4.927339367737182e-9,-3.128559402293983e-4,-4.168268583803075e-5,-4.901590331357037e-9,-3.128372712174129e-4,-4.157504774094596e-5,-4.884996661975068e-9,-3.1285591758021213e-4,-4.1567376446027606e-5,-4.883435028626847e-9,-3.1286216261514294e-4,-4.166161325502891e-5,-4.898203035129861e-9,-3.128152510161355e-4,-4.1832011412133305e-5,-4.926093299613993e-9,-3.1269456478840265e-4,-4.2037319835952676e-5,-4.96108661782143e-9,-3.1250114325379443e-4,-4.2235381879465134e-5,-4.996540702951394e-9,-3.1225205877241923e-4,-4.239361488219513e-5,-5.026892948270938e-9,-3.119724750885652e-4,-4.249330688871886e-5,-5.048533140222312e-9,-3.116889276893549e-4,-4.252921835778996e-5,-5.059987008882629e-9,-3.1142503078342897e-4,-4.25069961860904e-5,-5.0616921955618265e-9,-3.111992283429283e-4,-4.244023805497469e-5,-5.055583300773006e-9,-3.1102368764590496e-4,-4.234797844643438e-5,-5.044617784933671e-9,-3.1090358734081304e-4,-4.22526006575234e-5,-5.032321067688745e-9,-3.108364399804756e-4,-4.217778740604939e-5,-5.022387283844178e-9,-3.108115257297438e-4,-4.214600986581236e-5,-5.018313830814128e-9,-3.1080993296466673e-4,-4.2175257475328325e-5,-5.023008475613783e-9,-3.1080593916080375e-4,-4.227521362395652e-5,-5.038322479284464e-9,-3.1077034837130563e-4,-4.244369565068855e-5,-5.06453984568056e-9,-3.1067585579162317e-4,-4.266468404943358e-5,-5.099969884051941e-9,-3.105035849258535e-4,-4.290936505875487e-5,-5.140877929168914e-9,-3.1024899896644803e-4,-4.314094465863473e-5,-5.181956628701638e-9,-3.0992505626402714e-4,-4.332264950955875e-5,-5.217361941575282e-9,-3.095610883380589e-4,-4.342700451466909e-5,-5.2421145403966415e-9,-3.091971222357173e-4,-4.3443817524911114e-5,-5.253502474396329e-9,-3.088746927985775e-4,-4.338445254519018e-5,-5.252067765269822e-9,-3.086262289687441e-4,-4.328075377912741e-5,-5.241813665026146e-9,-3.084657459880443e-4,-4.317815751980895e-5,-5.229427402694319e-9,-3.083838136062314e-4,-4.312402180818095e-5,-5.222569664693657e-9,-3.083492587428513e-4,-4.315408297432371e-5,-5.227650075739371e-9,-3.083181203766566e-4,-4.328165458806027e-5,-5.247856867561176e-9,-3.082471429138195e-4,-4.349411061585933e-5,-5.2822613795529054e-9,-3.081064848257633e-4,-4.375827146070421e-5,-5.3263709887758225e-9,-3.0788661043989416e-4,-4.403198008161343e-5,-5.373792020884821e-9,-3.0759759139367557e-4,-4.4276497491867025e-5,-5.418190385136207e-9,-3.072628362842785e-4,-4.4465056129220834e-5,-5.454790327401472e-9,-3.0691106900856074e-4,-4.458588788817899e-5,-5.481074258715986e-9,-3.0656967318466223e-4,-4.4640878311394534e-5,-5.496772186340735e-9,-3.0626062010192915e-4,-4.464213768265969e-5,-5.5034243148592386e-9,-3.0599865177202766e-4,-4.460833959835805e-5,-5.503787246380918e-9,-3.057908013060658e-4,-4.4561687503291136e-5,-5.501265100167681e-9,-3.0563641143263365e-4,-4.4525580714277986e-5,-5.4994619326435316e-9,-3.0552715792361276e-4,-4.4522582031122806e-5,-5.501861033144501e-9,-3.0544706109613843e-4,-4.457210286773981e-5,-5.511548919490009e-9,-0.00030537297561927964,-4.4687381552856436e-5,-5.5308628299553145e-9]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_8.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_8.json deleted file mode 100644 index 777c0568..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_8.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":8000,"numberOfSamples":1000,"samples":[-3.0527640252829807e-4,-4.487182696660493e-5,-5.56088448082571e-9,-3.051274863200565e-4,-4.511556230951057e-5,-5.6008437940501195e-9,-3.049014822200931e-4,-4.5393887171247894e-5,-5.647698563779582e-9,-3.045865825423837e-4,-4.566978863347711e-5,-5.696284894052496e-9,-3.041902526794886e-4,-4.590165294193654e-5,-5.7403050551512475e-9,-3.0374053440293064e-4,-4.605480630272924e-5,-5.774008768966934e-9,-3.032803042778928e-4,-4.6112832816305496e-5,-5.793973590280497e-9,-3.028557483245855e-4,-4.608383761616052e-5,-5.800251345674449e-9,-3.025032355259023e-4,-4.599882516164128e-5,-5.796427523208801e-9,-3.022393949447573e-4,-4.5902896545994185e-5,-5.788631331365615e-9,-3.020574267495867e-4,-4.5842714571687194e-5,-5.7838921806700334e-9,-3.019300694661608e-4,-4.585434504667538e-5,-5.7883384069394884e-9,-3.0181769376023336e-4,-4.595468543172006e-5,-5.805682519418446e-9,-3.0167899235319e-4,-4.613834629665025e-5,-5.83635658405951e-9,-3.014813398322303e-4,-4.638044052124705e-5,-5.877534282545917e-9,-3.0120806044062887e-4,-4.664417952898078e-5,-5.924029708374941e-9,-3.008608032921932e-4,-4.689076983299546e-5,-5.969769115749644e-9,-3.004568895018775e-4,-4.70885065576558e-5,-6.009334760264992e-9,-3.000232042040917e-4,-4.7218579979817117e-5,-6.039104695872155e-9,-2.995891071912802e-4,-4.72766796425179e-5,-6.057736521969508e-9,-2.9918053358217385e-4,-4.7271135672653113e-5,-6.066024169441235e-9,-2.9881634126882297e-4,-4.721922325858296e-5,-6.066350982343671e-9,-2.9850682571005375e-4,-4.714317647578276e-5,-6.0620073426491385e-9,-2.982536857147729e-4,-4.706682514849363e-5,-6.056588919504954e-9,-2.9805063249734796e-4,-4.7013055973122464e-5,-6.053577596287479e-9,-2.978841024009395e-4,-4.700177778028711e-5,-6.0560846647952315e-9,-2.97733963612634e-4,-4.7047861809806975e-5,-6.066639640409404e-9,-2.975745746966664e-4,-4.715862391952254e-5,-6.086875521052076e-9,-2.9737697702912646e-4,-4.733079302488828e-5,-6.117026762619431e-9,-2.9711318240313096e-4,-4.754766231303244e-5,-6.1553289826818086e-9,-2.967630328757633e-4,-4.777820603997843e-5,-6.1976547684464505e-9,-2.963225516133362e-4,-4.7980702799556336e-5,-6.237878353608434e-9,-2.9581034269964766e-4,-4.8112531767448336e-5,-6.26929277722192e-9,-2.952671701271256e-4,-4.8144449769795835e-5,-6.286810452998715e-9,-2.9474584957997816e-4,-4.807330163392616e-5,-6.28897999422168e-9,-2.942942146728656e-4,-4.7925741507049555e-5,-6.278697823265868e-9,-2.939390776646052e-4,-4.774982986598883e-5,-6.2621933111198565e-9,-2.9367888471910724e-4,-4.759858957460034e-5,-6.246887112949443e-9,-2.9348722961036977e-4,-4.751366495959348e-5,-6.239195834786848e-9,-2.933236015115482e-4,-4.7515401306169104e-5,-6.243051945843658e-9,-2.9314581436119905e-4,-4.760093779409941e-5,-6.2593279168203955e-9,-2.9292007500896937e-4,-4.774844549298213e-5,-6.286013467788338e-9,-2.926269983387905e-4,-4.792463505513392e-5,-6.318926256564662e-9,-2.9226350769051096e-4,-4.80930810595307e-5,-6.352759512595941e-9,-2.918412941194005e-4,-4.822168516898902e-5,-6.382264012712696e-9,-2.9138274761924426e-4,-4.8288192173938596e-5,-6.4033284884177525e-9,-2.9091546827443674e-4,-4.828307144331461e-5,-6.4137142155758484e-9,-2.904666459630382e-4,-4.820960531850297e-5,-6.413290100567614e-9,-2.9005845372039675e-4,-4.808169188193544e-5,-6.403779607548024e-9,-2.897051121066428e-4,-4.7920298339887756e-5,-6.388175539851937e-9,-2.894117280467004e-4,-4.77495594070045e-5,-6.3700487926475646e-9,-2.891745460224369e-4,-4.7593309240161246e-5,-6.352958916462981e-9,-2.889819981834109e-4,-4.7472392700331755e-5,-6.340071065896678e-9,-2.8881605249833365e-4,-4.740260960082055e-5,-6.333942633116508e-9,-2.886536932128631e-4,-4.739292957383811e-5,-6.336355114475078e-9,-2.884687014832789e-4,-4.7443667570689896e-5,-6.348050662755428e-9,-2.8823427250380447e-4,-4.754452904089668e-5,-6.368308311532382e-9,-2.879272735231633e-4,-4.767303651414079e-5,-6.394467888137689e-9,-2.875345818250315e-4,-4.7794856179294424e-5,-6.4217381728864196e-9,-2.8706055734247936e-4,-4.786832012302628e-5,-6.443756519509059e-9,-2.865324198422822e-4,-4.785486234755549e-5,-6.4542037210419195e-9,-2.859983895327293e-4,-4.773390713864742e-5,-6.449179015088165e-9,-2.8551497623516194e-4,-4.7515537099475336e-5,-6.429222290163076e-9,-2.8512656698742036e-4,-4.724172825041583e-5,-6.399602792241161e-9,-2.8484791237568235e-4,-4.697228518879425e-5,-6.368414825098121e-9,-2.846599731981497e-4,-4.676227057336778e-5,-6.343524830079535e-9,-2.845204990113826e-4,-4.664360730421715e-5,-6.330077698450703e-9,-2.8438137789211793e-4,-4.661903031892221e-5,-6.32954910609419e-9,-2.842033332610527e-4,-4.666740117899054e-5,-6.340163616828402e-9,-2.8396352830062366e-4,-4.6754274987887116e-5,-6.357961127061933e-9,-2.836566692220362e-4,-4.684229725179311e-5,-6.377959739889069e-9,-2.8329216427076527e-4,-4.689886773239183e-5,-6.395189096969708e-9,-2.828896488527907e-4,-4.6900720390375284e-5,-6.405540596281919e-9,-2.824742018907562e-4,-4.6836037546351875e-5,-6.4064023526000905e-9,-2.8207178859335354e-4,-4.670471097933904e-5,-6.397002591025266e-9,-2.817052464373959e-4,-4.6517083949337426e-5,-6.378389721142845e-9,-2.8139115347079264e-4,-4.629149712487325e-5,-6.3530658178796655e-9,-2.811378256204399e-4,-4.605106192105769e-5,-6.324396845660935e-9,-2.8094456582733565e-4,-4.582011369839805e-5,-6.295969795469077e-9,-2.8080213121061873e-4,-4.562084808863251e-5,-6.271061910825657e-9,-2.806941282722342e-4,-4.547056083835451e-5,-6.252305778500468e-9,-2.805989529923734e-4,-4.537959014034061e-5,-6.241511789741509e-9,-2.80492067241958e-4,-4.5349843601162954e-5,-6.239532828776588e-9,-2.803485913613245e-4,-4.5373805665704785e-5,-6.246068068716576e-9,-2.8014639891832464e-4,-4.543399639996473e-5,-6.259380228216586e-9,-2.7987013346108646e-4,-4.550321157816095e-5,-6.276047783203556e-9,-2.795162996405821e-4,-4.5546626057891795e-5,-6.291045688354151e-9,-2.790984739623287e-4,-4.5527321372703615e-5,-6.298505516465384e-9,-2.7865004000894166e-4,-4.541620148794469e-5,-6.2933199008508685e-9,-2.7822043288384707e-4,-4.520484869900707e-5,-6.273276588202333e-9,-2.7786184532760936e-4,-4.4915535087074116e-5,-6.240723143326448e-9,-2.776091852793529e-4,-4.459975553570474e-5,-6.202458787212566e-9,-2.774638632702066e-4,-4.432123225548417e-5,-6.167368360824802e-9,-2.7739275622409024e-4,-4.41307893297388e-5,-6.142942429461774e-9,-2.7734363791847937e-4,-4.404793703195258e-5,-6.132712569902154e-9,-2.772666481119829e-4,-4.405873879426259e-5,-6.135803693451539e-9,-2.7712954630060494e-4,-4.41272344392883e-5,-6.148198003690473e-9,-2.769220926915838e-4,-4.421078330515423e-5,-6.164515668643785e-9,-2.7665243775120893e-4,-4.4271847046803456e-5,-6.179465722684056e-9,-2.7634044414996943e-4,-4.42840858576599e-5,-6.188763867311319e-9,-2.760112787880964e-4,-4.4233969441495255e-5,-6.1896325079837635e-9,-2.7569053678467995e-4,-4.4119908832911274e-5,-6.1810143630256235e-9,-2.7540081443001705e-4,-4.395037973603709e-5,-6.1635500652351195e-9,-2.7515925763830574e-4,-4.374163186724933e-5,-6.13931893200916e-9,-2.7497583229343773e-4,-4.351509382685275e-5,-6.1113765985356755e-9,-2.7485228599034487e-4,-4.3294504323835476e-5,-6.083191373407955e-9,-2.747818899337699e-4,-4.3102814240736015e-5,-6.0580978536060394e-9,-2.7475014030275356e-4,-4.2959058861573174e-5,-6.038863549547172e-9,-2.747364727847155e-4,-4.287561578709453e-5,-6.027414092691353e-9,-2.7471679197166814e-4,-4.2856211898555225e-5,-6.024680664675889e-9,-2.74666552518033e-4,-4.2894856634732136e-5,-6.0304870842090665e-9,-2.745641634544586e-4,-4.297583426922976e-5,-6.043429961128174e-9,-2.7439449831047824e-4,-4.307484329777695e-5,-6.060781782144661e-9,-2.7415239183585174e-4,-4.316139154284506e-5,-6.078538519547611e-9,-2.738458939963984e-4,-4.320289628151456e-5,-6.0918223659286445e-9,-2.7349833665268886e-4,-4.317111271140737e-5,-6.095829254040278e-9,-2.731473286401864e-4,-4.305077016877184e-5,-6.087300751131777e-9,-2.728384066406977e-4,-4.284850797286421e-5,-6.0661306830069746e-9,-2.726122464122091e-4,-4.2597682445614436e-5,-6.036317211131248e-9,-2.724883882208636e-4,-4.2353186226421395e-5,-6.005346149629137e-9,-2.724538993112942e-4,-4.21739660621937e-5,-5.981721324392774e-9,-2.7246601864680027e-4,-4.209994110375406e-5,-5.971667694606237e-9,-2.724694960632973e-4,-4.2136627145050584e-5,-5.976871636177898e-9,-2.724184831524113e-4,-4.225643997788255e-5,-5.9944559253544774e-9,-2.7229051896981396e-4,-4.241362759713718e-5,-6.018773549341146e-9,-2.720878961454436e-4,-4.2562043557314734e-5,-6.043635716054438e-9,-2.718303929497391e-4,-4.266714123706157e-5,-6.063913242192316e-9,-2.715458512132313e-4,-4.271024379125761e-5,-6.076285881259704e-9,-2.712626659453091e-4,-4.268748746246162e-5,-6.07938776767281e-9,-2.710052329722968e-4,-4.260653559518088e-5,-6.073631332430156e-9,-2.707916949070718e-4,-4.248307887576607e-5,-6.060863861100873e-9,-2.7063291676093104e-4,-4.233782096456377e-5,-6.043919283576518e-9,-2.70531999054325e-4,-4.2193858972839276e-5,-6.026112658845783e-9,-2.7048412159524855e-4,-4.207417276834723e-5,-6.010749252660998e-9,-2.704768085276078e-4,-4.199898085891688e-5,-6.0007083249929064e-9,-2.7049091718653486e-4,-4.198292846456885e-5,-5.998122765150181e-9,-2.705026716692996e-4,-4.203245930769175e-5,-6.0041500657964715e-9,-2.704867786001442e-4,-4.2143960157053555e-5,-6.018813110137525e-9,-2.7042033326989443e-4,-4.2303217237346e-5,-6.0408918160634616e-9,-2.702869966792254e-4,-4.248659500899885e-5,-6.067897441023674e-9,-2.7008072908028737e-4,-4.26641123975258e-5,-6.096212887106141e-9,-2.698083301299173e-4,-4.2804202514864496e-5,-6.121495193355481e-9,-2.6949017078992116e-4,-4.287971029548579e-5,-6.139410707238995e-9,-2.6915846953213103e-4,-4.287457712691834e-5,-6.146692366322419e-9,-2.688523188530164e-4,-4.2790136468926805e-5,-6.142330933965789e-9,-2.6860905054935876e-4,-4.2648942394378234e-5,-6.128480097984698e-9,-2.684529386021688e-4,-4.249325511328419e-5,-6.110525799006696e-9,-2.683846561272461e-4,-4.237577162193681e-5,-6.0958916495610374e-9,-2.6837713845480256e-4,-4.2343242447415576e-5,-6.091676533973367e-9,-2.6838259865424467e-4,-4.241897119821026e-5,-6.1020278393601044e-9,-2.6834954243159544e-4,-4.259356052706968e-5,-6.126618946744287e-9,-2.682414538672124e-4,-4.282968580925502e-5,-6.161071746178656e-9,-2.680473788683876e-4,-4.307777590451198e-5,-6.198928228542621e-9,-2.6778068952418554e-4,-4.329323584064263e-5,-6.233932842908828e-9,-2.6746984498891765e-4,-4.3447294758245534e-5,-6.261585257801009e-9,-2.6714767994234935e-4,-4.3529579126087075e-5,-6.279696539448954e-9,-2.6684354540698494e-4,-4.3545106782298875e-5,-6.288235271926127e-9,-2.6657927046700944e-4,-4.3509317188260445e-5,-6.288838671033637e-9,-2.6636794026195363e-4,-4.3443465401146905e-5,-6.284232359286678e-9,-2.662140688653375e-4,-4.33711394559145e-5,-6.277670357631493e-9,-2.661141777281877e-4,-4.331570058397092e-5,-6.272450417208355e-9,-2.660574130223562e-4,-4.329813146063895e-5,-6.271533343649169e-9,-2.6602631028516745e-4,-4.3334832510506525e-5,-6.277259574999488e-9,-2.6599810856047266e-4,-4.3435186752350394e-5,-6.291119283070944e-9,-2.6594709819864e-4,-4.35991710667151e-5,-6.313534449691571e-9,-2.6584826187483416e-4,-4.3815728146144786e-5,-6.3436577175095264e-9,-2.6568197080015167e-4,-4.406282185693006e-5,-6.379260979809167e-9,-2.654388737832523e-4,-4.4309976961368614e-5,-6.416844899921613e-9,-2.651235904796523e-4,-4.452352360454744e-5,-6.45208973946681e-9,-2.6475574490715504e-4,-4.467379291793127e-5,-6.480660100582804e-9,-2.643674413816663e-4,-4.474263772198858e-5,-6.499235785255884e-9,-2.639972203386808e-4,-4.472932230357101e-5,-6.506524425656316e-9,-2.636814333534693e-4,-4.4652981742684745e-5,-6.50394943475184e-9,-2.6344474410546685e-4,-4.455031096217054e-5,-6.4957052750673075e-9,-2.6329215242018296e-4,-4.446797824163044e-5,-6.487971527226249e-9,-2.6320539661309406e-4,-4.445066132419316e-5,-6.487318143828218e-9,-2.63146231141766e-4,-4.452761326611089e-5,-6.498693327228091e-9,-2.630670795117471e-4,-4.4702593314460794e-5,-6.523735117410233e-9,-2.629259962418986e-4,-4.495205403355389e-5,-6.560195481816707e-9,-2.626998326199566e-4,-4.523322969000845e-5,-6.6028055138425835e-9,-2.6238984542081514e-4,-4.5498615964264204e-5,-6.645151128486782e-9,-2.620181139265042e-4,-4.57101034480172e-5,-6.681643636040315e-9,-2.6161796896905014e-4,-4.584720776675456e-5,-6.7088001834994565e-9,-2.6122365300701173e-4,-4.590801043953323e-5,-6.725594759670876e-9,-2.608629732320002e-4,-4.590508421570969e-5,-6.733110680725014e-9,-2.605538971319134e-4,-4.585973386898697e-5,-6.733869753505527e-9,-2.6030410219870376e-4,-4.5796853823059685e-5,-6.731122265893311e-9,-2.601120119629486e-4,-4.574121346938611e-5,-6.728248726724007e-9,-2.5996821459528486e-4,-4.571499884470834e-5,-6.728333811525041e-9,-2.5985675252670267e-4,-4.573601546615178e-5,-6.733900781581118e-9,-2.597563470776258e-4,-4.581593891770877e-5,-6.7467347208660815e-9,-2.596420276961034e-4,-4.5958327928148174e-5,-6.76770494879153e-9,-2.594877524327709e-4,-4.6156630892450285e-5,-6.796534200413236e-9,-2.5927042693107434e-4,-4.6392942692009576e-5,-6.8315565589601714e-9,-2.589751849875842e-4,-4.663871238482509e-5,-6.86962752289666e-9,-2.586008062635789e-4,-4.685864046342157e-5,-6.906416881867135e-9,-2.5816311466290005e-4,-4.7018104873896896e-5,-6.937219567577798e-9,-2.5769402554871504e-4,-4.70926588010539e-5,-6.9581636155644655e-9,-2.5723517884218273e-4,-4.707644773329669e-5,-6.967428938305518e-9,-2.568273908815006e-4,-4.6986025040791123e-5,-6.966001210496018e-9,-2.564992393431867e-4,-4.685748280218821e-5,-6.957630999254399e-9,-2.5625871902160277e-4,-4.6737400412949545e-5,-6.947966529409689e-9,-2.5609074998136574e-4,-4.667043573132832e-5,-6.943105351110571e-9,-2.5596122517727485e-4,-4.6687347367702306e-5,-6.947967062704738e-9,-2.5582634783583117e-4,-4.6796866950713174e-5,-6.964938644351132e-9,-2.5564461158371896e-4,-4.698373076282578e-5,-6.993209196686726e-9,-2.553879109156633e-4,-4.7213518226825917E-05,-7.029044733220987e-9,-2.5504832832596024e-4,-4.744277599023395e-5,-7.066933407213379e-9,-2.5463858429774843e-4,-4.7630969964505535e-5,-7.1011838454172516e-9,-2.541865650862485e-4,-4.775023325017012e-5,-7.127396703046114e-9,-2.537265402404863e-4,-4.7790107831489385e-5,-7.143345909601783e-9,-2.532904918374822e-4,-4.775683549761495e-5,-7.1491178104008635e-9,-2.529021042786563e-4,-4.766889086299671e-5,-7.146663004807935e-9,-2.525741732148423e-4,-4.7551249353078e-5,-7.139062192878236e-9,-2.5230871169483677e-4,-4.743029000875771e-5,-7.129782907503167e-9,-2.5209851175530824e-4,-4.733012368995658e-5,-7.12209759254885e-9,-2.519291245187472e-4,-4.7270279788107355e-5,-7.1187265860613594e-9,-2.517806968882801e-4,-4.726422556842384e-5,-7.12166746585097e-9,-2.5162963986732293e-4,-4.731809415808857e-5,-7.132097650423624e-9,-2.514505510713131e-4,-4.742927313984141e-5,-7.1502341423829864e-9,-2.512190030433243e-4,-4.758501628393123e-5,-7.175103678264232e-9,-2.5091568236328035e-4,-4.7761815907209246e-5,-7.204305121348925e-9,-2.5053181294401e-4,-4.7926849500478765e-5,-7.233991717484305e-9,-2.500746237911642e-4,-4.804301276238442e-5,-7.259360514494356e-9,-2.495701519604955e-4,-4.8078046570921506e-5,-7.275783141609628e-9,-2.490601882212913e-4,-4.8015746621047336e-5,-7.280321967292176e-9,-2.4859206990471175e-4,-4.786450499113676e-5,-7.272987851368456e-9,-2.4820404096295365e-4,-4.7657974491023386e-5,-7.2570490683069305e-9,-2.479123719305355e-4,-4.744593983612639e-5,-7.238137844085153e-9,-2.477062542180496e-4,-4.7278801363755583e-5,-7.2225323219480234e-9,-2.475523859045091e-4,-4.719243023421515e-5,-7.2153509223338515e-9,-2.4740634073176207e-4,-4.7199163254914456e-5,-7.21928276128765e-9,-2.472256149075255e-4,-4.728689651818537e-5,-7.234113502680999e-9,-2.469800996566623e-4,-4.742481447800407e-5,-7.2570090226968695e-9,-2.4665781472638505e-4,-4.757279635380423e-5,-7.283374548153914e-9,-2.462655369996502e-4,-4.769151536169288e-5,-7.308038135183422e-9,-2.458251322065457e-4,-4.775085456159175e-5,-7.326465854721028e-9,-2.4536711100036463e-4,-4.77350886691006e-5,-7.3357152755733405e-9,-2.4492329122390537e-4,-4.764420066221715e-5,-7.334911212083219e-9,-2.4452039783219196e-4,-4.749169496663902e-5,-7.3251748443696005e-9,-2.441758732145271e-4,-4.7300134577938174e-5,-7.309112821670338e-9,-2.4389627170717684e-4,-4.7095968591426874e-5,-7.2900891206745445e-9,-2.4367780651202367e-4,-4.6904922721911e-5,-7.2715143086660904e-9,-2.4350820404063506e-4,-4.674862028056588e-5,-7.2563236900772534e-9,-2.4336901910568495e-4,-4.6642494199979074e-5,-7.246701350541432e-9,-2.4323787902715116e-4,-4.6594604978692496e-5,-7.243991435989502e-9,-2.4309057272598025e-4,-4.6604855006113405e-5,-7.248666445835073e-9,-2.4290326713360635e-4,-4.666429753503088e-5,-7.260234391154556e-9,-2.4265533867043101e-4,-4.67546250155109e-5,-7.2770527231963495e-9,-2.4233328045250883e-4,-4.684845105661854e-5,-7.29615811529741e-9,-2.4193563237893614e-4,-4.6911622727816726e-5,-7.313363425619466e-9,-2.4147769061437337e-4,-4.690904210391057e-5,-7.323911274472526e-9,-2.409931846698145e-4,-4.68145030450435e-5,-7.3237831866979765e-9,-2.405293638181594e-4,-4.6622304985804496e-5,-7.311327256640174e-9,-2.4013397134164407e-4,-4.6354911420302454e-5,-7.288398575368516e-9,-2.3983792521253927e-4,-4.606009583001144e-5,-7.260171753226957e-9,-2.396424964711392e-4,-4.579591722183568e-5,-7.233460507133913e-9,-2.3951876787466002e-4,-4.561007369104896e-5,-7.21434469153871e-9,-2.394196251219914e-4,-4.552433842374012e-5,-7.206304347525716e-9,-2.3929702425245816e-4,-4.553082614515197e-5,-7.209572961363757e-9,-2.3911604156302504e-4,-4.559902693265397e-5,-7.221607636814043e-9,-2.3886148969033618e-4,-4.56878141259867e-5,-7.238141334743658e-9,-2.385376124584638e-4,-4.57569458542221e-5,-7.25434375948497e-9,-2.381635151221613e-4,-4.5775227331894453e-5,-7.265844606590987e-9,-2.3776689984276165e-4,-4.57248113055291e-5,-7.26951760352044e-9,-2.3737775512568452e-4,-4.560224089873021e-5,-7.26396202658587e-9,-2.3702288262502966e-4,-4.541701560695537e-5,-7.249620171308552e-9,-2.3672182048234104e-4,-4.518837706556744e-5,-7.228512886555455e-9,-2.3648451210419064e-4,-4.494110071809932e-5,-7.203679129923876e-9,-2.3631073766417756e-4,-4.470112417759971e-5,-7.1784915077864556e-9,-2.3619104748406788e-4,-4.449166637344944e-5,-7.156032804897266e-9,-2.361087730659606e-4,-4.433028327220373e-5,-7.138674148007875e-9,-2.3604256281260482e-4,-4.422705852302139e-5,-7.1278965459513375e-9,-2.3596896071219697e-4,-4.41837594790764e-5,-7.124282211477298e-9,-2.358648734407393e-4,-4.419359846967748e-5,-7.127541904743606e-9,-2.3571005457793368e-4,-4.424139308519803e-5,-7.136477505700135e-9,-2.3548986076137152e-4,-4.4304182265018096e-5,-7.148875985336727e-9,-2.3519855436410849e-4,-4.435271161882365e-5,-7.16145714276836e-9,-2.348430390860336e-4,-4.4354724701945077e-5,-7.170110582162483e-9,-2.3444587375598763e-4,-4.428117792866847e-5,-7.170657306550671e-9,-2.3404509111068765e-4,-4.411557127942225e-5,-7.1601656476032516e-9,-2.3368771973065835e-4,-4.386412570504797e-5,-7.138447255205115e-9,-2.334157329157928e-4,-4.356117057573164e-5,-7.108920211252188e-9,-2.3324859251575434e-4,-4.326304457334257e-5,-7.077986722810363e-9,-2.3317225159038513e-4,-4.3029164658112595e-5,-7.0528241170588876e-9,-2.3314325821755143e-4,-4.289880884221161e-5,-7.038651316312173e-9,-2.3310674475310233e-4,-4.287707539508815e-5,-7.037006731343113e-9,-2.330173793949718e-4,-4.2937138101060195e-5,-7.045793591462278e-9,-2.3285221519255721e-4,-4.303448249497462e-5,-7.060613085178226e-9,-2.3261221161084732e-4,-4.312326355963217e-5,-7.076380098752534e-9,-2.3231616237874106e-4,-4.3167782922615494e-5,-7.0885642907420745e-9,-2.3199226213489643e-4,-4.3147504709399666e-5,-7.093925360427784e-9,-2.3167066135599025e-4,-4.305722178644823e-5,-7.090854405127532e-9,-2.3137815592412457e-4,-4.290464072813479e-5,-7.079431225173229e-9,-2.3113482317374794e-4,-4.2706990561187926e-5,-7.061239222047379e-9,-2.3095210624270325e-4,-4.248733394858226e-5,-7.0389514644621475e-9,-2.3083209319112942e-4,-4.22708356697799e-5,-7.0157556508521975e-9,-2.3076787058155768e-4,-4.208124244565444e-5,-6.994754152444318e-9,-2.3074481404720975e-4,-4.193779429781794e-5,-6.978475418029599e-9,-2.3074269629111773e-4,-4.185278131262165e-5,-6.9685812919441475e-9,-2.3073838954341724e-4,-4.183002690679065e-5,-6.9657828504140465e-9,-2.307087773182823e-4,-4.1864416184094224e-5,-6.969890191920407e-9,-2.3063358371772487e-4,-4.19423194920427e-5,-6.979881232260712e-9,-2.304980447362638e-4,-4.204276810737836e-5,-6.993919691136392e-9,-2.3029541532778425e-4,-4.2139396145542684e-5,-7.00935383163725e-9,-2.3002929420596648e-4,-4.220331442258605e-5,-7.022821179996584e-9,-2.297155277725766e-4,-4.220735882242904e-5,-7.0306406913778314e-9,-2.2938274641947577e-4,-4.2132214476566026e-5,-7.029632424365228e-9,-2.2906972807424893e-4,-4.197407643695822e-5,-7.018296801761733e-9,-2.2881761972917472e-4,-4.175160042946605e-5,-6.997961873684011e-9,-2.286567093282979e-4,-4.15075256296687e-5,-6.9732029722847966e-9,-2.2859182172845228e-4,-4.129977684881916e-5,-6.9508561159118375e-9,-2.2859518852719337e-4,-4.118158264999498e-5,-6.937623078004585e-9,-2.2861445669427582e-4,-4.1179317366699686e-5,-6.937368890191579e-9,-2.2859373178187907e-4,-4.128165726085842e-5,-6.949709434593278e-9,-2.2849535207625107e-4,-4.144683429672747e-5,-6.970641653126126e-9,-2.283102601143957e-4,-4.162180946726997e-5,-6.994513297007544e-9,-2.280546314648973e-4,-4.1760936140705576e-5,-7.015996457807604e-9,-2.2775905137933017e-4,-4.1836162324814815e-5,-7.0312662464705675e-9,-2.2745750303615093e-4,-4.183854159207291e-5,-7.038384862713035e-9,-2.2717978153226345e-4,-4.1774688473891304e-5,-7.037214328561364e-9,-2.269476550317656e-4,-4.166168283592476e-5,-7.029107904443636e-9,-2.2677360769187676e-4,-4.152239765949198e-5,-7.016489998134974e-9,-2.2666086428735168e-4,-4.13817553708349e-5,-7.002360297324509e-9,-2.2660400530891817e-4,-4.126365474609324e-5,-6.989766583218536e-9,-2.2659004542151717e-4,-4.1188304668478054e-5,-6.981333927974789e-9,-2.266000219235072e-4,-4.116989011754661e-5,-6.978931288333946e-9,-2.266111881676761e-4,-4.12146495166316e-5,-6.9835033237536505e-9,-2.2659985001449061e-4,-4.131967774449151e-5,-6.9950455254666655e-9,-2.2654460748588225e-4,-4.147283960401956e-5,-7.012666563520272e-9,-2.264295628693442e-4,-4.165394006870694e-5,-7.034672741319516e-9,-2.2624709886908756e-4,-4.183709352380845e-5,-7.058654437906543e-9,-2.259998866238783e-4,-4.1994173550205136e-5,-7.081632424729571e-9,-2.2570180047419192e-4,-4.20991362790095e-5,-7.100361989265034e-9,-2.2537742095192945e-4,-4.213298776272619e-5,-7.111886301353217e-9,-2.2505959382885995e-4,-4.208912506154797e-5,-7.114348718520941e-9,-2.2478421898691062e-4,-4.197821401236689e-5,-7.107904138739319e-9,-2.2458174592226204e-4,-4.1830607186345735e-5,-7.0953504217620375e-9,-2.244663606137209e-4,-4.169327376221295e-5,-7.081979987657558e-9,-2.2442665203386655e-4,-4.1618683723854355e-5,-7.074284006802257e-9,-2.2442408061700852e-4,-4.1646821969372816e-5,-7.077692877238242e-9,-2.2440397415766895e-4,-4.178786877968106e-5,-7.0943342038050634e-9,-2.2431615173148974e-4,-4.201628734466668e-5,-7.122132208245681e-9,-2.2413418489370047e-4,-4.2281316841771065e-5,-7.155838491573877e-9,-2.238625036955378e-4,-4.252762716447894e-5,-7.189267752364687e-9,-2.2352958981585374e-4,-4.271389191467571e-5,-7.217364886846549e-9,-2.231742512295794e-4,-4.2821232086966055e-5,-7.2372470959088515e-9,-2.2283320562756947e-4,-4.285179730744506e-5,-7.2482661351785805e-9,-2.2253387205703278e-4,-4.282232746248896e-5,-7.2515555960049095e-9,-2.2229206566917885e-4,-4.275713751688142e-5,-7.2494356512215224e-9,-2.2211260756237194e-4,-4.2682685880708425e-5,-7.244838453971768e-9,-2.2199099538278396e-4,-4.262399641811782e-5,-7.240796077498677e-9,-2.2191514949620428e-4,-4.260230497054901e-5,-7.240011891369483e-9,-2.2186707232957353e-4,-4.26332616889838e-5,-7.244543832697758e-9,-2.2182464125580366e-4,-4.2725338241283515e-5,-7.255615619695993e-9,-2.217638453501513e-4,-4.287842690194515e-5,-7.273534478793906e-9,-2.2166170729793913e-4,-4.308298693357485e-5,-7.2976765517466445e-9,-2.2149980429336165e-4,-4.332033803452491e-5,-7.326522432477613e-9,-2.2126785688274673e-4,-4.3564584276414805e-5,-7.357751075488498e-9,-2.20966584781167e-4,-4.3786290015324124e-5,-7.388436436288333e-9,-2.2060898292754956e-4,-4.395759483340187e-5,-7.415404439706891e-9,-2.202193504707468e-4,-4.405796910551689e-5,-7.435775583366592e-9,-2.1982983813928416e-4,-4.407947682940211e-5,-7.4476444040565705e-9,-2.1947474914701923e-4,-4.403040203489803e-5,-7.450766846569757e-9,-2.1918316392070605e-4,-4.393615767618415e-5,-7.447040423172644e-9,-2.1897091886597989e-4,-4.3836355658260945e-5,-7.440501159279104e-9,-2.188338255077648e-4,-4.3777167322247025e-5,-7.4366017543605706e-9,-2.187450180632313e-4,-4.379926707359548e-5,-7.440747299185002e-9,-2.1865951766138927e-4,-4.3924079338995526e-5,-7.456451577868975e-9,-2.1852701523895825e-4,-4.414394644131482e-5,-7.48388495394003e-9,-2.1830915181893224e-4,-4.442241000664643e-5,-7.51964660486929e-9,-2.1799327092026865e-4,-4.47064341649404e-5,-7.558021886353412e-9,-2.1759542948186208e-4,-4.4945093539923776e-5,-7.593080121112747e-9,-2.1715190572061313e-4,-4.510525927973701e-5,-7.62051102463403e-9,-2.1670511352975532e-4,-4.5177775919498044e-5,-7.63846614779529e-9,-2.1629130702600425e-4,-4.5174263035486545e-5,-7.647414111500688e-9,-2.1593400226015044e-4,-4.511913434864514e-5,-7.649461867526958e-9,-2.1564283671687278e-4,-4.504151932089862e-5,-7.647573809127245e-9,-2.1541555700511315e-4,-4.496945565191675e-5,-7.644907915657562e-9,-2.152409460728591e-4,-4.4926547873120016E-05,-7.644326527091175e-9,-2.1510150205944102e-4,-4.493027145003056e-5,-7.648080390942638e-9,-2.1497560662559327e-4,-4.499101379307958e-5,-7.65764086825275e-9,-2.1483945926710325e-4,-4.511125926355644e-5,-7.673632641449619e-9,-2.1466926637521481e-4,-4.528477274004901e-5,-7.695803268049495e-9,-2.144441173207301e-4,-4.549613641988964e-5,-7.722992976764426e-9,-2.1414962209211983e-4,-4.572138551931352e-5,-7.753133503949428e-9,-2.137817825713578e-4,-4.5930557875204e-5,-7.783365806364265e-9,-2.1334992695909555e-4,-4.609259275443571e-5,-7.810385927253544e-9,-2.1287718132165904e-4,-4.6182138061975344e-5,-7.831058043246478e-9,-2.123972901802133e-4,-4.618667111745394e-5,-7.843194529569795e-9,-2.1194776550871445e-4,-4.611156504767954e-5,-7.846275859882824e-9,-2.1156084382754122e-4,-4.598097245517623e-5,-7.841849026160612e-9,-2.1125475027746477e-4,-4.5833615902049135e-5,-7.833415837621815e-9,-2.1102786191385352e-4,-4.57141563789811e-5,-7.825754714870187e-9,-2.1085766176323766e-4,-4.5662121102797614e-5,-7.823773717687805e-9,-2.1070526783781765e-4,-4.570112440445812e-5,-7.831148800367581e-9,-2.1052503260910168e-4,-4.5831388471697066e-5,-7.84914193292144e-9,-2.1027715631769618e-4,-4.602835716858338e-5,-7.876058836978009e-9,-2.0993957436240816e-4,-4.6248926026246374e-5,-7.90766713758257e-9,-2.095146194759454e-4,-4.644402823389973e-5,-7.938509723459188e-9,-2.0902749841148404e-4,-4.6573103373786205e-5,-7.963593692431587e-9,-2.085173003005473e-4,-4.6614726939852604e-5,-7.979751223426029e-9,-2.080247685004384e-4,-4.656971988276465e-5,-7.986202202748241e-9,-2.0758195037667867e-4,-4.645702153575651e-5,-7.984303236040702e-9,-2.0720680107128868e-4,-4.630568678322192e-5,-7.976805592462343e-9,-2.069027746736158e-4,-4.6146864470554793E-05,-7.967006829227965e-9,-2.0666149949068237e-4,-4.6008053738656595e-5,-7.958051544835984e-9,-2.0646643337144435e-4,-4.591001322147901e-5,-7.952478950941206e-9,-2.0629619473845173e-4,-4.586558575032321e-5,-7.952010523962518e-9,-2.0612715730170046e-4,-4.587946155808738e-5,-7.957511462395227e-9,-2.0593551752786214e-4,-4.594814009737746e-5,-7.969025447952002e-9,-2.0569936999224403e-4,-4.6059814191126656e-5,-7.985789917193825e-9,-2.054013396767555e-4,-4.619444426954505e-5,-8.006201300389058e-9,-2.0503200586908336e-4,-4.632476440606799e-5,-8.027795774410303e-9,-2.0459370977526643e-4,-4.6419232557928356e-5,-8.04739911864323e-9,-2.0410341514187733e-4,-4.644771828424737e-5,-8.061606874456355e-9,-2.0359249297940358e-4,-4.6389591386022976e-5,-8.06761967917358e-9,-2.0310152417526018e-4,-4.6241943470151586e-5,-8.064208675557398e-9,-2.026701314330422e-4,-4.602412220191169e-5,-8.05238930586289e-9,-2.0232482212882342e-4,-4.5775201703916056e-5,-8.035415203185357e-9,-2.0206981769589567e-4,-4.5543952383211005e-5,-8.017995799141722e-9,-2.0188503857131567e-4,-4.5374719563007136e-5,-8.005002937932091e-9,-2.0173208974531864e-4,-4.5294685661682146e-5,-8.000132839061242e-9,-2.0156558865288865e-4,-4.530694102432007e-5,-8.004940251523124e-9,-2.0134563404935994e-4,-4.5390862347908655e-5,-8.018476540387911e-9,-2.010477628284383e-4,-4.5508700213428396e-5,-8.037583629336856e-9,-2.0066816008643582e-4,-4.56159424839469e-5,-8.05775420557668e-9,-2.002233040454102e-4,-4.5672547498502866e-5,-8.074324603901956e-9,-1.9974456130923202e-4,-4.5652156194690424e-5,-8.083656540042794e-9,-1.992695170896543e-4,-4.554701856445397e-5,-8.083957366931921e-9,-1.9883270591920156e-4,-4.5367698049175715e-5,-8.075522287619769e-9,-1.9845841745310465e-4,-4.513832170771045e-5,-8.060398815725766e-9,-1.981572124953109e-4,-4.488951139782889e-5,-8.041672208553757e-9,-1.9792619199168255e-4,-4.46514605035761e-5,-8.022654713173082e-9,-1.97751818665741e-4,-4.444885607769098e-5,-8.006221420156825e-9,-1.9761372928278598e-4,-4.429815409582809e-5,-7.994418534127477e-9,-1.9748834183331958e-4,-4.4206787770554826e-5,-7.988349103172298e-9,-1.9735172150645567e-4,-4.417347840913245e-5,-7.988243219864344e-9,-1.9718177685405577e-4,-4.4188897515318655e-5,-7.993577576316224e-9,-1.969602185929472e-4,-4.423633228093872e-5,-8.003137811219496e-9,-1.96674791367231e-4,-4.429249144944042e-5,-8.01500158984719e-9,-1.9632209229852586e-4,-4.43290434847933e-5,-8.026530943997656e-9,-1.9591072087203853e-4,-4.4315855466975366e-5,-8.03455558004738e-9,-1.9546352222861362e-4,-4.422685189198833e-5,-8.035926730100295e-9,-1.9501665604001342e-4,-4.404835137258371e-5,-8.028456381532183e-9,-1.9461311284592976e-4,-4.3787482447394696e-5,-8.011956426634773e-9,-1.9429036612252486e-4,-4.3475903590539156e-5,-7.988819905738023e-9,-1.9406609579109184e-4,-4.31641133352837e-5,-7.963631507898714e-9,-1.939293801808378e-4,-4.290607476846081e-5,-7.941776010191559e-9,-1.9384326424020214e-4,-4.274050836180446e-5,-7.927647618378034e-9,-1.9375801371840964e-4,-4.267820492195053e-5,-7.923311832665135e-9,-1.9362806935360174e-4,-4.270088509049269e-5,-7.928124868965717e-9,-1.934249241067107e-4,-4.277008015595093e-5,-7.93923136862352e-9,-1.931422172148227e-4,-4.284026359050476e-5,-7.952533831849908e-9,-1.9279378906395382e-4,-4.287086605432226e-5,-7.963753390058145e-9,-1.9240746774724533e-4,-4.283438753175265e-5,-7.96935681810304e-9,-1.9201729184363728e-4,-4.272004332166115e-5,-7.967224995384466e-9,-1.9165604145344355e-4,-4.253352928312996e-5,-7.956980058119363e-9,-1.9134921912310286e-4,-4.229384282667856e-5,-7.939923003820991e-9,-1.9111121492372828e-4,-4.202818834980984e-5,-7.91860535841166e-9,-1.9094402083634387e-4,-4.176615800307559e-5,-7.896162848299419e-9,-1.9083831639714896e-4,-4.1534410208336746e-5,-7.87561120850624e-9,-1.9077625422079947e-4,-4.1352743879738196e-5,-7.859295143438076e-9,-1.9073505303328413e-4,-4.123196142628293e-5,-7.848605195695082e-9,-1.9069054410135802e-4,-4.1173414159399545e-5,-7.843964753064974e-9,-1.906201224278099e-4,-4.116971136664543e-5,-7.844982280018888e-9,-1.905050256123524e-4,-4.1205978856558556e-5,-7.850625899117948e-9,-1.9033218543530693e-4,-4.126132493487268e-5,-7.859318656901609e-9,-1.9009597946679268e-4,-4.131052250053904e-5,-7.868951080561997e-9,-1.8980014139863044e-4,-4.1326260782891054e-5,-7.876912836277283e-9,-1.8945967012305145e-4,-4.128269700216912e-5,-7.880323549005257e-9,-1.8910169760086778e-4,-4.116102678475968e-5,-7.876614821307504e-9,-0.00018876338867391296,-4.0956863108143176e-5,-7.864445949430287e-9,-1.884847853602136e-4,-4.0687258733253435e-5,-7.844654109638144e-9,-1.8829616966925856e-4,-4.039278804799636e-5,-7.820672655457958e-9,-1.88203845813791e-4,-4.012954778719805e-5,-7.797856014628003e-9,-1.8818277508791647e-4,-3.995054240701812e-5,-7.781684520999545e-9,-1.881832875362198e-4,-3.988448188439229e-5,-7.77566376533795e-9,-1.8815018874959586e-4,-3.992443525486756e-5,-7.780096416824334e-9,-1.880434791354815e-4,-4.003285000490112e-5,-7.792321866458137e-9,-1.8784973035415947e-4,-4.015822215563545e-5,-7.808013539986401e-9,-1.8758115050261835e-4,-4.025292234742e-5,-7.822655543413694e-9,-1.872668184883031e-4,-4.02846843903453e-5,-7.832609350063291e-9,-1.869421745375567e-4,-4.024036343886389e-5,-7.835668960723405e-9,-1.866405011096358e-4,-4.012421563344865e-5,-7.831233109466725e-9,-1.8638746606769327e-4,-3.9953517066443375e-5,-7.820209997762073e-9,-1.8619833336478678e-4,-3.9753447846682424E-05,-7.804705559277455e-9,-1.8607713456172942e-4,-3.955211791223761e-5,-7.787528077260694e-9,-1.8601733956143633e-4,-3.937609305312275e-5,-7.771594675631029e-9,-1.8600372362801028e-4,-3.924671808006975e-5,-7.759377516311174e-9,-1.860151033940145e-4,-3.9177490549839045e-5,-7.752521038826082e-9,-1.86027579535179e-4,-3.917265795237302e-5,-7.751697825195558e-9,-1.8601784500762417e-4,-3.922712275877602e-5,-7.756683939980297e-9,-1.859660991240961e-4,-3.932748873083235e-5,-7.76655338904938e-9,-1.858583415306685e-4,-3.945386020008228e-5,-7.779863803220138e-9,-1.856880765199331e-4,-3.9582104032858643e-5,-7.794764745634513e-9,-1.8545751111847034e-4,-3.968648336286518e-5,-7.80905273811186e-9,-1.8517832726768282e-4,-3.974272194646584e-5,-7.820277095975539e-9,-1.8487191715710737e-4,-3.973182286832981e-5,-7.826043324454552e-9,-1.84568326062585e-4,-3.964498003485806e-5,-7.824607063924266e-9,-1.8430252736954805e-4,-3.948909619720772e-5,-7.81567723225054e-9,-1.841068015813026e-4,-3.9290916557531185e-5,-7.801120265142914e-9,-1.8399941650295114e-4,-3.9096168023688346e-5,-7.785080204503404e-9,-1.8397315757144196e-4,-3.8959732030985414e-5,-7.773061430941858e-9,-1.8399121969710352e-4,-3.892667494260442e-5,-7.769999153806498e-9,-1.8399720413110593e-4,-3.9012062532908605e-5,-7.778165646339316e-9,-1.8393709799280938e-4,-3.919247414624714e-5,-7.796192327999907e-9,-1.837809253347292e-4,-3.94159913142451e-5,-7.81983562463752e-9,-1.835314504140859e-4,-3.9624174692404916e-5,-7.843866044999501e-9,-1.832175926465497e-4,-3.9772376929694886e-5,-7.863852973816922e-9,-0.00018288007799367867,-3.983939802399363e-5,-7.877101234873762e-9,-1.825581525567214e-4,-3.9826609012344015e-5,-7.88278698428171e-9,-1.8228153953364634e-4,-3.975151493070294e-5,-7.881673076367993e-9,-1.8206747389102235e-4,-3.96403257759107e-5,-7.87567869457065e-9,-1.8192093438847728e-4,-3.952183195728649e-5,-7.867403264403688e-9,-1.818363144226791e-4,-3.94230088792691e-5,-7.859627774104685e-9,-1.8179960057993597e-4,-3.9365938879669173e-5,-7.854836651382487e-9,-1.817908037429815e-4,-3.9365650403408574e-5,-7.85483970570868e-9,-1.817866154295425e-4,-3.9428705477013426e-5,-7.860566324909944e-9,-1.81763290141203e-4,-3.955254076382139e-5,-7.872043997922005e-9,-1.8169966125836646e-4,-3.9725745338659054e-5,-7.888521312020506e-9,-1.8157997375724025e-4,-3.992943179925509e-5,-7.908654800013727e-9,-1.8139615201193202e-4,-4.01395859443014e-5,-7.930677800847704e-9,-1.8114926843234067e-4,-4.0330149429537525e-5,-7.952524911278175e-9,-1.808500494869329e-4,-4.047662276442048e-5,-7.971962158343955e-9,-1.8051827933978514e-4,-4.055992560857808e-5,-7.986810256067089e-9,-1.8018101316444614e-4,-4.0570277674346596e-5,-7.995336625795394e-9,-1.7986930754112723e-4,-4.0510916503467394e-5,-7.996822725172099e-9,-1.796128754203871e-4,-4.0400967753350356e-5,-7.992167447243349e-9,-1.7943243126465743e-4,-4.027577035424067e-5,-7.984224841668468e-9,-1.793308527151646e-4,-4.0182267013651894e-5,-7.97751603843064e-9,-1.7928650189256697e-4,-4.016762654034507e-5,-7.977085620844553e-9,-1.7925412028238575e-4,-4.026237728195528e-5,-7.986681974367066e-9,-1.791774416147169e-4,-4.046502137035069e-5,-8.007050548514257e-9,-1.79010578141659e-4,-4.07384889308924e-5,-8.03541534862946e-9,-1.7873692411944845e-4,-4.102346717380981e-5,-8.066621496285543e-9,-1.783741420058078e-4,-4.1261830836882335e-5,-8.095249938080533e-9,-1.7796361074475225e-4,-4.1416463164230464e-5,-8.117421582789139e-9,-1.7755290410782594e-4,-4.1478368578888085e-5,-8.131520449449486e-9,-1.7718135033389617e-4,-4.146198733197798e-5,-8.13797055610707e-9,-1.768730990346715e-4,-4.139529321745453e-5,-8.138602365296292e-9,-1.766365818208645e-4,-4.131042648440153e-5,-8.135996394797593e-9,-1.7646729539195152e-4,-4.123728457209718e-5,-8.132931548149722e-9,-1.7635140912427015e-4,-4.119998363428822e-5,-8.131940782911007e-9,-1.7626901592075078e-4,-4.1215139264067615e-5,-8.13497319552361e-9,-1.7619688175239353e-4,-4.129104627639256e-5,-8.143187102834443e-9,-1.7611095329391106e-4,-4.142731358893801e-5,-8.156888519239014e-9,-1.7598889716912629e-4,-4.1614887437690714e-5,-8.17558928584182e-9,-1.7581281192462515e-4,-4.183670829192403e-5,-8.198133122013413e-9,-1.7557194116890116e-4,-4.206939570725801e-5,-8.222846596370708e-9,-1.7526489185315834e-4,-4.2286145337228534e-5,-8.247693685378518e-9,-1.749007892130791e-4,-4.246067239676419e-5,-8.27045287578726e-9,-1.7449889291473196e-4,-4.257177890837406e-5,-8.288966601271894e-9,-1.7408636134491067e-4,-4.260785569445014e-5,-8.301502622549816e-9,-1.7369417612683185e-4,-4.257044116629862e-5,-8.307207425135431e-9,-1.733515749373912e-4,-4.247603925671317e-5,-8.306560538240727e-9,-1.7307951561946385e-4,-4.235546258407321e-5,-8.301660768772593e-9,-1.7288404300892215e-4,-4.224980670333177e-5,-8.296116391034056e-9,-1.7275126742316764e-4,-4.220232082429011e-5,-8.29435675977847e-9,-1.7264662508130276e-4,-4.2246603872407674e-5,-8.300377709365537e-9,-1.7252121501086634e-4,-4.239390927424923e-5,-8.316260399484159e-9,-1.723259194563172e-4,-4.262512746453453e-5,-8.341125038747223e-9,-1.7202921853819408e-4,-4.289359303196469e-5,-8.371205255110296e-9,-1.7163005621497463e-4,-4.314027956941037e-5,-8.401196120311941e-9,-1.7115808212438073e-4,-4.3314891182245837e-5,-8.426208336859534e-9,-1.706611339045414e-4,-4.3391899781138715e-5,-8.4432830383759e-9,-1.701876762651756e-4,-4.3374419715413495e-5,-8.4518562411058e-9,-1.6977323193821857e-4,-4.328714577136297e-5,-8.4533209117178e-9,-1.6943492968409378e-4,-4.316484300779904e-5,-8.450215049832509e-9,-1.691728141266524e-4,-4.304229490465962e-5,-8.445454567334958e-9,-1.689743734967421e-4,-4.294814563749508e-5,-8.441762371783732e-9,-1.6881942342299218e-4,-4.2902261156559144e-5,-8.441296223429344e-9,-1.6868404487941965e-4,-4.291519214458628e-5,-8.445444774098598e-9,-1.6854347563705814e-4,-4.2988495594045744e-5,-8.454766529152133e-9,-1.6837439851704656e-4,-4.3115257163194266e-5,-8.469036389597806e-9,-1.681571293442517e-4,-4.3280710287122344e-5,-8.487346444855007e-9,-1.6787800682957013e-4,-4.3463272785180736e-5,-8.508217625345404e-9,-1.675319055511752e-4,-4.363653952219832e-5,-8.529718093993882e-9,-1.6712433065999726e-4,-4.3772654109465174e-5,-8.549625270960761e-9,-1.6667221550076703e-4,-4.3847053130506195e-5,-8.565688893545171e-9,-1.6620251090174813e-4,-4.384394863589244e-5,-8.576022891083493e-9,-1.6574805161057994e-4,-4.3761243185843136e-5,-8.57958137502147e-9,-1.653410166729793e-4,-4.361321227414499e-5,-8.57659196538238e-9,-1.6500526069332353e-4,-4.3429595920686075e-5,-8.568780938240553e-9,-1.6474941938175833e-4,-4.325061380526027e-5,-8.559242374508827e-9,-1.6456278474184848e-4,-4.311845658282386e-5,-8.551872091484495e-9,-1.6441558827007797e-4,-4.306679435913246e-5,-8.55041163875152e-9,-1.6426459590353389e-4,-4.31107428021797e-5,-8.55731514316368e-9,-1.6406370565747632e-4,-4.324040567689213e-5,-8.572814975918328e-9,-1.6377738091422734e-4,-4.3421136814201817e-5,-8.594619277300757e-9,-1.6339259528422065e-4,-4.360218549923664e-5,-8.618509053213847e-9,-1.6292403742707357e-4,-4.3731933663244515e-5,-8.639692356752142e-9,-1.6240945516230828e-4,-4.3773994492029846e-5,-8.654343911008955e-9,-1.618968607756375e-4,-4.371721460881521e-5,-8.660647603934844e-9,-1.614295836691662e-4,-4.357579691594396e-5,-8.658990171403235e-9,-1.6103554540079272e-4,-4.338116258064244e-5,-8.65143750147207e-9,-1.6072371734170566e-4,-4.317072694826411e-5,-8.640899300411265e-9,-1.60486597377181e-4,-4.2978486922922624e-5,-8.630346264051817e-9,-1.6030553083480994e-4,-4.28295955015562e-5,-8.622255741822829e-9,-1.6015613527411944e-4,-4.2738546072660895e-5,-8.618310231123223e-9,-1.6001252941236853e-4,-4.270953342717434e-5,-8.619310983523769e-9,-1.5985023392522713e-4,-4.27376696865566e-5,-8.62524258194941e-9,-1.5964820616548375e-4,-4.281026269130828e-5,-8.635407427994393e-9,-1.5939063606626693e-4,-4.290797545834162e-5,-8.648555381100611e-9,-1.5906893911632526e-4,-4.300622619989431e-5,-8.662980381924239e-9,-1.586839320425307e-4,-4.307745905419132e-5,-8.6766176574788e-9,-1.5824763893893554e-4,-4.309485149551601e-5,-8.687224944489166e-9,-1.577836553301402e-4,-4.303761508032331e-5,-8.692728743322592e-9,-1.5732473003351639e-4,-4.2897150815443866e-5,-8.691735505534104e-9,-1.5690673041701025e-4,-4.2682099455994495e-5,-8.684069583127032e-9,-1.5655967783061677e-4,-4.241963218334136e-5,-8.671100768675983e-9,-1.5629842252569848e-4,-4.215106331379977e-5,-8.65564776892293e-9,-1.5611654367897435e-4,-4.1922027222526855e-5,-8.641393519477788e-9,-1.5598634365727104e-4,-4.1769990723229766e-5,-8.631943434242865e-9,-1.558655337576891e-4,-4.171332468953909e-5,-8.62980875112357e-9,-1.55708599326998e-4,-4.1745676230751626e-5,-8.635639653747643e-9,-1.5547926756793228e-4,-4.183738871643539e-5,-8.64796410233513e-9,-1.5516040876164026e-4,-4.194344529267842e-5,-8.663544317198107e-9,-1.5475857077794318e-4,-4.2015642345345564e-5,-8.678275332417251e-9,-1.5430178219828054e-4,-4.2015487508945786e-5,-8.688346657903147e-9,-1.538312653883322e-4,-4.1923888974596855e-5,-8.691272266061803e-9,-1.5338985144061818e-4,-4.174464729428951e-5,-8.686443715723425e-9,-1.5301108912570144e-4,-4.150107912857046e-5,-8.675074640975934e-9,-1.5271247020407983e-4,-4.1227745509928506e-5,-8.659650972450587e-9,-1.5249412865362623e-4,-4.096082102643691e-5,-8.643154944543995e-9,-1.5234202142190386e-4,-4.0730361657362306e-5,-8.628341074666747e-9,-1.522332666590427e-4,-4.0556036818412694e-5,-8.617240877586801e-9,-1.5214146355814283e-4,-4.044607832465574e-5,-8.610948820189256e-9,-1.5204082770238207e-4,-4.0398276306418136e-5,-8.609649713449356e-9,-1.5190894966737008e-4,-4.040182404940597e-5,-8.612791693953891e-9,-1.5172855998777816e-4,-4.04392073340307e-5,-8.619289651721801e-9,-1.5148890221367985e-4,-4.048788673301634e-5,-8.627671304566296e-9,-1.511871960678653e-4,-4.052207249406931e-5,-8.636154913727928e-9,-1.5083025434630082e-4,-4.051521495503619e-5,-8.642725787473477e-9,-1.5043574158394175e-4,-4.044383852156764e-5,-8.645327734018624e-9,-1.500319353466808e-4,-4.029297377626192e-5,-8.642261093560134e-9,-1.496544166579292e-4,-4.006242686937451e-5,-8.632759521112276e-9,-1.4933857066749907e-4,-3.9771500609913104e-5,-8.61753525645397e-9,-1.4910878327908136e-4,-3.9458613965874134e-5,-8.598961074703302e-9,-1.4896817540041468e-4,-3.9173255620837376e-5,-8.580634729706417e-9,-1.4889434793359147e-4,-3.896143953895252e-5,-8.566369717397555e-9,-1.488446779231985e-4,-3.885027635490195e-5,-8.558992598500318e-9,-1.4876971971684565e-4,-3.883878985692342e-5,-8.559461170923111e-9,-1.4862882605840358e-4,-3.889897430693147e-5,-8.566637964807312e-9,-1.484015496846831e-4,-3.8985699273179814e-5,-8.577719545041904e-9,-1.4809146958670756e-4,-3.9050500471712874e-5,-8.589075917670951e-9,-1.4772283139077166e-4,-3.90541832810773e-5,-8.597200861671296e-9,-1.4733252302452735e-4,-3.8975093804996464e-5,-8.599531021666814e-9,-1.46960319709348e-4,-3.8811988524448995e-5,-8.594969943036304e-9,-1.4663989849332713e-4,-3.8581911562734315e-5,-8.58402541962936e-9,-1.4639243737691714e-4,-3.831439622032589e-5,-8.568556760394407e-9,-1.4622381432699978e-4,-3.8043832331238845e-5,-8.551221326080342e-9,-1.4612546696149864e-4,-3.780203085357788e-5,-8.534793996272362e-9,-1.4607800835754142e-4,-3.761267871861787e-5,-8.521560570514165e-9,-1.46056126596556e-4,-3.748848840769632e-5,-8.512936995642796e-9,-1.4603336462438332e-4,-3.743087337648366e-5,-8.509368863912567e-9,-1.4598588657925202e-4,-3.743138625583485e-5,-8.510465027645555e-9,-1.4589496353338089e-4,-3.747399290628529e-5,-8.515247763091069e-9,-1.4574843347403674e-4,-3.753744263121957e-5,-8.522385868843517e-9,-1.4554162934537264e-4,-3.759745129656199e-5,-8.530332304446479e-9,-1.4527818133022795e-4,-3.7628889350479104e-5,-8.537375532161534e-9,-1.4497079464529807e-4,-3.76084521534279e-5,-8.541699439939246e-9,-1.446416124057033e-4,-3.751836753687077e-5,-8.541581339326527e-9,-1.4432111704455668e-4,-3.7351398285757994e-5,-8.535812444372269e-9,-1.4404404714688575e-4,-3.711638518574359e-5,-8.524282605408122e-9,-1.438412079624837e-4,-3.684187866182322e-5,-8.508477097627533e-9,-1.4372811461076546e-4,-3.657397293866363e-5,-8.491503673689153e-9,-1.436949746655447e-4,-3.636532952138359e-5,-8.477371791217123e-9,-1.437049148338037e-4,-3.625715011489158e-5,-8.469647157873269e-9,-1.4370460041685984e-4,-3.626225419817731e-5,-8.470096677118393e-9,-1.436435657655829e-4,-3.6359182629031623e-5,-8.478059693349249e-9,-1.4349217679652826e-4,-3.650097828056397e-5,-8.49083875172551e-9,-1.4324944734727836e-4,-3.663301747612782e-5,-8.50476357027434e-9,-1.4293924274250757e-4,-3.6710244446883646e-5,-8.516318183217591e-9,-1.42599606440927e-4,-3.670734481993864e-5,-8.522934387042323e-9,-1.4227107692698355e-4,-3.66208983276144e-5,-8.523380609554418e-9,-1.4198762087161575e-4,-3.646586091026803e-5,-8.517827359725516e-9,-1.4177127123896665e-4,-3.626931158012475e-5,-8.507668428407443e-9,-1.4163010445375599e-4,-3.606360234221836e-5,-8.495144285064709e-9,-1.4155881398565556e-4,-3.588006957388633e-5,-8.482821921176052e-9,-1.4154122929864088e-4,-3.574396664003745e-5,-8.473039059830415e-9,-1.4155410250967632e-4,-3.5671120527783085e-5,-8.467454781925923e-9,-1.4157137341078065e-4,-3.5666522461359366e-5,-8.46681890030178e-9,-1.4156819516112225e-4,-3.572468450852716e-5,-8.4709875707388e-9,-1.4152418460917606e-4,-3.58313730753767e-5,-8.47912807725831e-9,-1.4142558873947818e-4,-3.59661705458511e-5,-8.489992557926502e-9,-1.412664184643966e-4,-3.6105261696455e-5,-8.502137383045136e-9,-1.4104888166358994e-4,-3.6224110895191465e-5,-8.514032189748423e-9,-1.4078340386514088e-4,-3.630008132933925e-5,-8.524097794432883e-9,-1.4048831120426743e-4,-3.6315244359799485e-5,-8.530777751256682e-9,-1.4018893987105985e-4,-3.6259700669489686e-5,-8.532761075544734e-9,-1.399154045802046e-4,-3.613554770648095e-5,-8.529406358796928e-9,-1.396978493880879e-4,-3.5960758369385744e-5,-8.5212719609298e-9,-1.395584274220083e-4,-3.5770777754258144e-5,-8.510484614118273e-9,-1.395010799090941e-4,-3.5614419533547606e-5,-8.500584815712752e-9,-1.3950347955379841e-4,-3.554134224026499e-5,-8.495600252331792e-9,-1.395181326667312e-4,-3.5583057711782186e-5,-8.49852886633527e-9,-1.3948692048425989e-4,-3.573661667274257e-5,-8.509976577861838e-9,-1.3936409233349114e-4,-3.596248146847602e-5,-8.52783178092342e-9,-1.3913464178440764e-4,-3.6200002121230084e-5,-8.548219699136488e-9,-1.3881747770678196e-4,-3.6391341144876804e-5,-8.567072309384218e-9,-1.384540237025143e-4,-3.650005380239695e-5,-8.581375137160207e-9,-1.380914704582618e-4,-3.6517145395985524e-5,-8.589669620504838e-9,-1.3776939627770373e-4,-3.645667302158028e-5,-8.591982763540148e-9,-1.375129529417687e-4,-3.634680402050186e-5,-8.589508759325445e-9,-1.373315794560991e-4,-3.622095854655851e-5,-8.584220023840957e-9,-1.3722091216789167e-4,-3.61110737959683e-5,-8.578448656336925e-9,-1.3716598999432205e-4,-3.6043161150447865e-5,-8.574449379800085e-9,-1.37144819913883e-4,-3.6034601772228566e-5,-8.573995788120039e-9,-1.3713202193536196e-4,-3.60927847497726e-5,-8.578098184526851e-9,-1.3710237308793484e-4,-3.621495858814332e-5,-8.586914569799196e-9,-1.3703402980724396e-4,-3.6389181641333254e-5,-8.5998516774355e-9,-1.36911205202354e-4,-3.65962542961265e-5,-8.615789199981454e-9,-1.3672602214730465e-4,-3.68124573584491e-5,-8.633327431858329e-9,-1.36479349089764e-4,-3.701271677512592e-5,-8.650970819822634e-9,-1.3618068653054776e-4,-3.717379627140313e-5,-8.667222550115315e-9,-1.358472662707308e-4,-3.7277344343605105e-5,-8.680647089426607e-9,-1.3550242612119607e-4,-3.731274903926245e-5,-8.68999424871703e-9,-1.3517320152061808e-4,-3.727978006702851e-5,-8.694459140313209e-9,-1.3488680793789882e-4,-3.719092897384664e-5,-8.694073713436727e-9,-1.3466544021457864e-4,-3.707279073129639e-5,-8.69010051987593e-9,-1.3451925275556113e-4,-3.696481485133304e-5,-8.685177236944263e-9,-1.344388658671642e-4,-3.69131046298267e-5,-8.682934876706395e-9,-1.3439108416693466e-4,-3.695778715724225e-5,-8.68695839392729e-9,-1.3432331140892352e-4,-3.7116200157038535e-5,-8.699334814541392e-9,-1.3417981211901297e-4,-3.737010340084863e-5,-8.71951455375979e-9,-1.339246580951755e-4,-3.7667420214442775e-5,-8.744316749020727e-9,-1.3355816900488716e-4,-3.7941435370631326e-5,-8.769244026211392e-9,-1.3311593340372153e-4,-3.813725721253883e-5,-8.79029609068621e-9,-1.3265197371800877e-4,-3.8229929052285945e-5,-8.80518898519348e-9,-1.3221793913426716e-4,-3.822643977336777e-5,-8.813555366407018e-9,-1.318492290963614e-4,-3.8155740932226004e-5,-8.816480101901048e-9,-1.3156091565529496e-4,-3.8055615871408505e-5,-8.815891247203971e-9,-1.3135036452187486e-4,-3.796239043644523e-5,-8.814051427765528e-9,-1.31202438800492e-4,-3.7905049072083586e-5,-8.813160873514698e-9,-1.3109463784149872e-4,-3.79028210263575e-5,-8.81503385420893e-9,-1.3100122611687848e-4,-3.796469387651649e-5,-8.820852830416448e-9,-1.3089648863076503e-4,-3.80897908046812e-5,-8.83104051118581e-9,-1.3075748536931842e-4,-3.826825886682798e-5,-8.84527997381368e-9,-1.3056648321026467e-4,-3.848267424904795e-5,-8.862659526172724e-9,-1.3031305885508222e-4,-3.871009371470224e-5,-8.881878607082005e-9,-1.2999564462678402e-4,-3.8924886973358905e-5,-8.90144922639146e-9,-1.296221126551315e-4,-3.9102224081252054e-5,-8.919852317394064e-9,-1.292091137554164e-4,-3.9221787764163894e-5,-8.935653170963314e-9,-1.287801342980387e-4,-3.9271231345139034e-5,-8.947626178113364e-9,-1.2836237102655372e-4,-3.924893370147562e-5,-8.954946573809908e-9,-1.2798264289840097e-4,-3.916561004732102e-5,-8.957459750970044e-9,-1.2766262594780724e-4,-3.9044431207776e-5,-8.955969094344736e-9,-1.2741366297480022e-4,-3.891923161696911e-5,-8.952404162384802e-9,-1.2723168997357461e-4,-3.883000967390067e-5,-8.949679509496966e-9,-1.27093748029005e-4,-3.881487829910734e-5,-8.951097831921052e-9,-1.2695870357679422e-4,-3.8898685950468335e-5,-8.959323326278861e-9,-1.267751555869125e-4,-3.908106724078372e-5,-8.975233990146882e-9,-1.2649729890266872e-4,-3.933002315131596e-5,-8.997238422616873e-9,-1.2610380646318407e-4,-3.958793924368254e-5,-9.021623338742478e-9,-1.2560933231630603e-4,-3.979117636916569e-5,-9.043949542052622e-9,-1.250601064281325e-4,-3.989428803618717e-5,-9.060747657363913e-9,-1.2451535807132656e-4,-3.988519479442612e-5,-9.070550347589108e-9,-1.2402584828578883e-4,-3.978414776435241e-5,-9.073886011159246e-9,-1.236205981940215e-4,-3.963065544738354e-5,-9.07260038223968e-9,-1.2330492479386814e-4,-3.946804731107443e-5,-9.06907791995821e-9,-1.2306592379153069e-4,-3.9332584341514184e-5,-9.065663183276685e-9,-1.228800828847495e-4,-3.9248605036294036e-5,-9.064298093394783e-9,-1.2271974809462355e-4,-3.9227959023930204e-5,-9.066308761174449e-9,-1.2255751932836511e-4,-3.9271422800291845e-5,-9.07230522767062e-9,-1.2236902385258616e-4,-3.937056825807537e-5,-9.082190481665708e-9,-1.2213485314795255e-4,-3.950953825587356e-5,-9.0952670217167e-9,-1.2184219766310128e-4,-3.966680598205627e-5,-9.110401741288104e-9,-1.2148636162885278e-4,-3.981726696521993e-5,-9.12619905571748e-9,-1.2107197250418744e-4,-3.9935062083796264e-5,-9.141156188037495e-9,-1.2061333772280514e-4,-3.9997258003077964e-5,-9.153805898123638e-9,-1.2013331124746263e-4,-3.998800386203117e-5,-9.162873756252375e-9,-1.1966030668005657e-4,-3.990236796499482e-5,-9.167476141008514e-9,-1.1922355711720542e-4,-3.9748848224879454e-5,-9.16735668291749e-9,-1.1884727409519039e-4,-3.9549573910041856e-5,-9.163106709226148e-9,-1.1854484500946807e-4,-3.9337626281964046e-5,-9.156273357353645e-9,-1.1831435745928925e-4,-3.9151554868869843e-5,-9.149247534449742e-9,-1.1813661119487769e-4,-3.9027669333984225e-5,-9.144851147026704e-9,-1.1797667960421902e-4,-3.899110483450793e-5,-9.145628060950681e-9,-1.1778991790734548e-4,-3.904737063700308e-5,-9.15299150810211e-9,-1.175325624741728e-4,-3.9177091689939015e-5,-9.166537396277783e-9,-1.1717523308225653e-4,-3.933731131848976e-5,-9.183898816605155e-9,-1.1671489921126038e-4,-3.947171279421601e-5,-9.20137620436505e-9,-1.1617906373001206e-4,-3.952820645458404e-5,-9.215188158288917e-9,-1.1561807446250038e-4,-3.947694802803824e-5,-9.222771080593783e-9,-1.1508795403832579e-4,-3.931977427169145e-5,-9.223487247363517e-9,-1.1463218392673738e-4,-3.9086539305895255e-5,-9.21849929028679e-9,-1.142709592978943e-4,-3.8821745934336895e-5,-9.210076040428456e-9,-1.1400074179654687e-4,-3.856946273893001e-5,-9.20078618611514e-9,-1.1380094799943816e-4,-3.836294492571193e-5,-9.192886631995141e-9,-1.1364261812623197e-4,-3.822069459714716e-5,-9.1879765359956e-9,-1.1349551541127026e-4,-3.814719957123449e-5,-9.186871306246775e-9,-1.1333258761490281e-4,-3.8135736535814055e-5,-9.189633338269424e-9,-1.1313230069867286e-4,-3.817141008984336e-5,-9.195706259883106e-9,-1.1287982382393343e-4,-3.823369291997683e-5,-9.204097657482591e-9,-1.1256786310513337e-4,-3.829851605574717e-5,-9.213553802888529e-9,-1.1219751803139118e-4,-3.8340376762559447e-5,-9.22269414066259e-9,-1.1177904223869293e-4,-3.833503671167999e-5,-9.230116686601745e-9,-1.1133191698447232e-4,-3.826315103578705e-5,-9.234523255112086e-9,-1.1088335748373442e-4,-3.811461096830071e-5,-9.234910233392347e-9,-1.1046449079987319e-4,-3.789262697562118e-5,-9.230826308386785e-9,-1.1010413601670693e-4,-3.7615910350771354e-5,-9.222627139411862e-9,-1.0982130517158393e-4,-3.731722308065027e-5,-9.21160402770721e-9,-1.0961868889767661e-4,-3.703748088216355e-5,-9.199872312326249e-9,-1.0947969429209346e-4,-3.681630820680492e-5,-9.189976537874282e-9,-1.0937067838856088e-4,-3.668157414423921e-5,-9.184272074658242e-9,-1.0924829447019257e-4,-3.664109554625678e-5,-9.18424056176897e-9,-1.0907020550257687e-4,-3.667913877536005e-5,-9.189954915184103e-9,-1.0880642515705916e-4,-3.6759033088402764e-5,-9.199907267392656e-9,-1.0844824947981108e-4,-3.683171835853091e-5,-9.211326762762983e-9,-1.0801195079731945e-4,-3.684853152381634e-5,-9.220949393187014e-9,-1.0753533107081977e-4,-3.6774884340293415e-5,-9.225997564122934e-9,-1.0706735543311275e-4,-3.6600269285523224e-5,-9.22499909034669e-9,-1.0665405844386353e-4,-3.634060345263345e-5,-9.218128116932532e-9,-1.0632599695639417e-4,-3.6031911809698865e-5,-9.206981038369621e-9,-1.0609189824736788e-4,-3.5718319405997615e-5,-9.19395506438557e-9,-1.0593992002165717e-4,-3.543962353913638e-5,-9.181522987160879e-9,-1.0584432970216088e-4,-3.5222894444418944e-5,-9.171654265312317e-9,-1.0577377509585269e-4,-3.5079615353876484e-5,-9.165501882736301e-9,-1.0569811427307857e-4,-3.500714701067259e-5,-9.163352800650679e-9,-1.0559264518508524e-4,-3.499226206662488e-5,-9.164771801813917e-9,-1.0544004786505433e-4,-3.5014920510423576e-5,-9.16883982493074e-9,-1.0523095671395252e-4,-3.5051391464275926e-5,-9.174389778026609e-9,-1.0496405295401565e-4,-3.507665669286638e-5,-9.180172150801203e-9,-1.0464618835727268e-4,-3.506655725701059e-5,-9.184939032839345e-9,-1.0429252092118758e-4,-3.500030193581135e-5,-9.187495988674884e-9,-1.039261276946598e-4,-3.48637823947789e-5,-9.186800523449334e-9,-1.0357615793353864e-4,-3.46536541858101e-5,-9.182170455832e-9,-1.0327350441689744e-4,-3.4381246691956354e-5,-9.173580720955574e-9,-1.0304364939716516e-4,-3.4074253186413085e-5,-9.161923230549191e-9,-1.0289802766204464e-4,-3.3773697803369534e-5,-9.149039646343281e-9,-1.0282725778280255e-4,-3.3524929232600696e-5,-9.137394421723031e-9,-1.0280029662432293e-4,-3.336441855594974e-5,-9.129418606410994e-9,-1.0277162008556858e-4,-3.3307298589755e-5,-9.126750143428798e-9,-1.0269452672034878e-4,-3.334132380659976e-5,-9.129679824022376e-9,-1.0253530901109662e-4,-3.3430128766657056e-5,-9.137028969170211e-9,-1.0228281327026914e-4,-3.352418168582912e-5,-9.146483951023313e-9,-1.0195058478501845e-4,-3.357486167811767e-5,-9.155243273725392e-9,-1.0157200536431759e-4,-3.354696552794696e-5,-9.160762004820197e-9,-1.0119077576295845e-4,-3.3426523116505044e-5,-9.161389983981338e-9,-1.0084972538708518e-4,-3.322258471680729e-5,-9.1567428994038e-9,-1.0058085340582454e-4,-3.296319855077416e-5,-9.1477233287177e-9,-1.0039895151362752e-4,-3.268715204906611e-5,-9.13620386476633e-9,-1.0030009479870362e-4,-3.243403248359135e-5,-9.124482475916777e-9,-1.0026481761500761e-4,-3.2235448634192776e-5,-9.114685797381227e-9,-1.002643617789796e-4,-3.210959204158094e-5,-9.108299298278605e-9,-1.0026767382911762e-4,-3.205986487873324e-5,-9.105941746310106e-9,-1.0024717983614368e-4,-3.207681406252085e-5,-9.107401083971613e-9,-1.0018239318013028e-4,-3.214184576455504e-5,-9.111860642617299e-9,-1.0006142614792553e-4,-3.223125875718116e-5,-9.118191582072067e-9,-9.988108258667136e-5,-3.2319691729833556e-5,-9.1251948611398e-9,-9.964632646321523e-5,-3.238278403756544e-5,-9.131729422340635e-9,-9.936964829441685e-5,-3.239938756272473e-5,-9.136742201877834e-9,-9.907040628933112e-5,-3.235385780725714e-5,-9.139278262243717e-9,-9.877374852922494e-5,-3.22388541842853e-5,-9.138569270716463e-9,-9.850827687016545e-5,-3.2058685656720396e-5,-9.13425646517205e-9,-9.830143939364078e-5,-3.1832365719454527e-5,-9.126703455871307e-9,-9.817223068137955e-5,-3.159432274657247e-5,-9.117234559865558e-9,-9.812252419680496e-5,-3.138997708142053e-5,-9.108071823699427e-9,-9.813089016549055e-5,-3.126452109365012e-5,-9.10182146027846e-9,-9.815412222958905e-5,-3.124710157480261e-5,-9.100604093125194e-9,-9.813914491830552e-5,-3.1337456387429606e-5,-9.105211374499513e-9,-9.804153498796248e-5,-3.150322611607172e-5,-9.11475449547984e-9,-9.784154686536156e-5,-3.1690737195221436e-5,-9.127000792101932e-9,-9.754967528636868e-5,-3.1843765894223964e-5,-9.139172281973027e-9,-9.720055366819144e-5,-3.192085559051927e-5,-9.148776150107598e-9,-9.684015327249356e-5,-3.1904655488520306e-5,-9.154172659673398e-9,-9.651257696551535e-5,-3.180236177111936e-5,-9.154822358487452e-9,-9.62504127431069e-5,-3.163996841124646e-5,-9.151274976782774e-9,-9.60698168291565e-5,-3.145374077091899e-5,-9.144961054288212e-9,-9.596984265486474e-5,-3.128151423757891e-5,-9.137828523893096e-9,-9.593497386265119e-5,-3.115537334164327e-5,-9.131885483864583e-9,-9.593976606922285e-5,-3.109656681303233e-5,-9.128751308860314e-9,-9.595447136657913e-5,-3.111310201829616e-5,-9.129337933414458e-9,-9.595049936624177e-5,-3.119999178987712e-5,-9.133745810921736e-9,-9.590477548725535e-5,-3.134160856925637e-5,-9.141380171958168e-9,-9.580246226255177e-5,-3.151529116825042e-5,-9.151211708597388e-9,-9.563797539391283e-5,-3.16952830703858e-5,-9.162060481302314e-9,-9.541467373049275e-5,-3.185625961327806e-5,-9.172796825714589e-9,-9.514380915860319e-5,-3.197615493895167e-5,-9.182419310694514e-9,-9.48431552537596e-5,-3.2038443093745316e-5,-9.190051974883061e-9,-9.453543133902659e-5,-3.2034182987011704e-5,-9.194952520053085e-9,-9.424633486772374e-5,-3.1964113362905855e-5,-9.19662086089252e-9,-9.400158823504068e-5,-3.18408340759899e-5,-9.195038235111904e-9,-9.382220633420554e-5,-3.169033305608827e-5,-9.19095818861579e-9,-9.371778135278529e-5,-3.155104568024974e-5,-9.186065400464665e-9,-9.367914980804929e-5,-3.1468046822899884e-5,-9.182785199579648e-9,-9.367412170350315e-5,-3.1480918711509026e-5,-9.183626205872267e-9,-9.365156347345576e-5,-3.160755715402989e-5,-9.19020294586336e-9,-9.355668865963729e-5,-3.183175941432533e-5,-9.202419571888166e-9,-9.335267713728581e-5,-3.210430056471749e-5,-9.218371347956345e-9,-9.303667906521569e-5,-3.236020861117679e-5,-9.235103819495216e-9,-9.264032211325917e-5,-3.2543385860012626e-5,-9.249755228307922e-9,-9.221548591093086e-5,-3.262483810785695e-5,-9.26041652356236e-9,-9.181507378196565e-5,-3.260698117914955e-5,-9.266413523353581e-9,-9.147845491400025e-5,-3.251632942914815e-5,-9.268166415699002e-9,-9.122520847559706e-5,-3.239154168921172e-5,-9.266889513425695e-9,-9.105564635912965e-5,-3.227244723700269e-5,-9.2642646836748e-9,-9.095498913811478e-5,-3.219240887699171e-5,-9.262101784399266e-9,-9.08987318910297e-5,-3.217406213098664e-5,-9.261994204243429e-9,-9.085793054099272e-5,-3.222762121230062e-5,-9.265019829464496e-9,-9.080392835417925e-5,-3.2351052738033134e-5,-9.271567916967034e-9,-9.071228168806134e-5,-3.253168391369461e-5,-9.28134185774094e-9,-9.056569168800201e-5,-3.2748874236925676e-5,-9.293522462109239e-9,-9.035578936575062e-5,-3.297739074658915e-5,-9.307015941925984e-9,-9.008365802729651e-5,-3.319108369388331e-5,-9.32068773621464e-9,-8.975916266917992e-5,-3.336636099032471e-5,-9.33350717957054e-9,-8.939940883763627e-5,-3.348509546284864e-5,-9.344592008056796e-9,-8.902663953210632e-5,-3.353691102753202e-5,-9.353211946825554e-9,-8.866569313938621e-5,-3.352090126483869e-5,-9.35883336145802e-9,-8.834103551839693e-5,-3.3446806313605515e-5,-9.361261938630803e-9,-8.807317448099914e-5,-3.333560303798455e-5,-9.360872293875294e-9,-8.787408489854848e-5,-3.321895898344246e-5,-9.35881896249169e-9,-8.774178162211213e-5,-3.313618048205553e-5,-9.357051719661311e-9,-8.765551941425548e-5,-3.312704407820512e-5,-9.357971217288903e-9,-8.75747733839315e-5,-3.3219976944643985e-5,-9.363691049098633e-9,-8.74461410016907e-5,-3.341812218722618e-5,-9.375114762347986e-9,-8.7220065678816e-5,-3.3690479945789706e-5,-9.391311854138805e-9,-8.687212463896635e-5,-3.397702246395055e-5,-9.409699673510456e-9,-8.641654285989432e-5,-3.420979174434094e-5,-9.427069578077248e-9,-8.590181922728967e-5,-3.433967242416912e-5,-9.440848661633535e-9,-8.539061620032401e-5,-3.435314501297649e-5,-9.44984340985916e-9,-8.493672097339013e-5,-3.4271269582614564e-5,-9.454233252297501e-9,-8.45709727893319e-5,-3.413584988272384e-5,-9.45513539359531e-9,-8.429907159057472e-5,-3.399315338192215e-5,-9.454135610822126e-9,-8.410710066635141e-5,-3.388222278476255e-5,-9.452932691116559e-9,-8.39694300761685e-5,-3.382927951155617e-5,-9.453065287658341e-9,-8.385576288840835e-5,-3.384661045247159e-5,-9.455682021020762e-9,-8.373632656338405e-5,-3.39337961074905e-5,-9.461372860972362e-9,-8.358545827544782e-5,-3.407987563331084e-5,-9.470111676055729e-9,-8.338408132706894e-5,-3.426590539557689e-5,-9.481331913003121e-9,-8.312136430352067e-5,-3.446778153328366e-5,-9.494105686910258e-9,-8.279564587432089e-5,-3.465932720987703e-5,-9.507355644814983e-9,-8.241450667287213e-5,-3.481564090403858e-5,-9.520030613693909e-9,-8.19937854235765e-5,-3.491646452503521e-5,-9.531207314372736e-9,-8.155553782746594e-5,-3.494912799250977e-5,-9.540129776878508e-9,-8.112514759519504e-5,-3.491073158250606e-5,-9.546243568285508e-9,-8.072780222779476e-5,-3.480934834136822e-5,-9.549283156140592e-9,-8.038456389393579e-5,-3.466401475530754e-5,-9.549426224657887e-9,-8.010831362600719e-5,-3.450333338545574e-5,-9.54746360191402e-9,-7.989980971585162e-5,-3.4362440274271346e-5,-9.544875278633311e-9,-7.974437782718713e-5,-3.427773727254322e-5,-9.543676237437192e-9,-7.961061805952735e-5,-3.427884237468908e-5,-9.545950110564333e-9,-7.945341861300056e-5,-3.437837958684637e-5,-9.553132576768602e-9,-7.922353858236074e-5,-3.456254513569184e-5,-9.56529984876067e-9,-7.888371631202135e-5,-3.478810345141471e-5,-9.580865713138687e-9,-7.842594949679023e-5,-3.499174125974583e-5,-9.597013547859506e-9,-7.787972052612896e-5,-3.5111823238104886e-5,-9.61077091176288e-9,-7.730339317992335e-5,-3.5112654366270275e-5,-9.620133730535203e-9,-7.676190727235558e-5,-3.4997103078953485e-5,-9.624598331243174e-9,-7.630368913524509e-5,-3.480106932702219e-5,-9.62496228087358e-9,-7.594864786183333e-5,-3.457584341541249e-5,-9.622755990773589e-9,-7.568955618661085e-5,-3.4369955647098174e-5,-9.619710536672963e-9,-7.550120699012476e-5,-3.4218070735318946e-5,-9.617407235355379e-9,-7.53506844299028e-5,-3.4137703834965904e-5,-9.617061902570326e-9,-7.520512620818642e-5,-3.4130887726558557e-5,-9.619389347609227e-9,-7.503635353608889e-5,-3.4187713250424024e-5,-9.624544759331411e-9,-7.482323554456231e-5,-3.4289930549698735e-5,-9.63216195796353e-9,-7.455284746952063e-5,-3.441408243113663e-5,-9.641484197830746e-9,-7.422104933606681e-5,-3.4534311144901265e-5,-9.651545196785234e-9,-7.383266982034839e-5,-3.4625139821498456e-5,-9.661340808730684e-9,-7.340115252227199e-5,-3.466447763315732e-5,-9.669951148188559e-9,-7.29472860281118e-5,-3.4636811794840895e-5,-9.676610258024069e-9,-7.249670181575391e-5,-3.453612755069931e-5,-9.680751536488109e-9,-7.207617225320659e-5,-3.436789907206864e-5,-9.682071150846721e-9,-7.170907254595313e-5,-3.414954611457939e-5,-9.680633872207702e-9,-7.141062395474628e-5,-3.39088790257861e-5,-9.676997430229804e-9,-7.118375946617258e-5,-3.3680346460547944e-5,-9.672282908069223e-9,-7.101650731517465e-5,-3.349931488623629e-5,-9.668098481187566e-9,-7.088172523947388e-5,-3.33948756399492e-5,-9.666247026220778e-9,-7.074007291564022e-5,-3.3381977619494795e-5,-9.668224096412342e-9,-7.054706001923604e-5,-3.345448175111133e-5,-9.674640120668145e-9,-7.026421186175586e-5,-3.358188659485631e-5,-9.68481262676929e-9,-6.987236648803186e-5,-3.371310919852034e-5,-9.69679586348801e-9,-6.938216497629712e-5,-3.3789366876241454e-5,-9.707962916374584e-9,-6.883511643281062e-5,-3.376368965928737e-5,-9.715940864866819e-9,-6.829161852117123e-5,-3.3618736578177726e-5,-9.719434092883315e-9,-6.781005922500603e-5,-3.337302815858778e-5,-9.718519685799377e-9,-6.742756648217968e-5,-3.307197650765509e-5,-9.714369050431293e-9,-6.715167109481134e-5,-3.276964162612763e-5,-9.70868572509175e-9,-6.696431540140377e-5,-3.251149483555875e-5,-9.703181489926008e-9,-6.683272014943683e-5,-3.23249804831107e-5,-9.699229967536756e-9,-6.672046595425307e-5,-3.221830593712131e-5,-9.69768646622021e-9,-6.659514882482948e-5,-3.218413792480631e-5,-9.69883261424372e-9,-6.643222102070501e-5,-3.2204715407059465e-5,-9.702422223220024e-9,-6.621623206383647e-5,-3.225639014403438e-5,-9.707811412099236e-9,-6.594084229704343e-5,-3.231307689206832e-5,-9.714134303646899e-9,-6.560847130759857e-5,-3.234892257240772e-5,-9.720473000120565e-9,-6.522984548096849e-5,-3.2340745725612146e-5,-9.725978398839142e-9,-6.482324202400488e-5,-3.227068092840828e-5,-9.72993539962299e-9,-6.441292964570893e-5,-3.212909927557402e-5,-9.731798587080863e-9,-6.402628163536215e-5,-3.1917364877182857e-5,-9.731239839313383e-9,-6.368937200887575e-5,-3.164953586182567e-5,-9.728232443086724e-9,-6.342148728367543e-5,-3.135192586641782e-5,-9.723155862069091e-9,-6.3229704409613e-5,-3.105968506127635e-5,-9.716864968224381e-9,-6.310518395759158e-5,-3.081035792541784e-5,-9.710646408580894e-9,-6.302274843342547e-5,-3.0635492967811876e-5,-9.706009068758345e-9,-6.294459210654977e-5,-3.055226083848084e-5,-9.704313675315504e-9,-6.282790628516361e-5,-3.0557342633427204e-5,-9.706329094269245e-9,-6.263513206345579e-5,-3.062513212686725e-5,-9.711875217337033e-9]} \ No newline at end of file diff --git a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_9.json b/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_9.json deleted file mode 100644 index 745c2501..00000000 --- a/libs/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_9.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","updated":"2008 Dec 02 20:00:00 UTC","interpolationOrder":9,"xysAlgorithm":"SOFA_DEL_PSI_EPS","sampleZeroJulianEphemerisDate":2442396.5,"stepSizeDays":1.0,"startIndex":9000,"numberOfSamples":1000,"samples":[-6.23446137633139e-5,-3.071164556992463e-5,-9.719731332151204e-9,-6.19586809157847e-5,-3.076438157665265e-5,-9.727914890125598e-9,-6.150587794551883e-5,-3.073654937098242e-5,-9.734280833128142e-9,-6.1034943329782044e-5,-3.060168191808949e-5,-9.737216476929997e-9,-6.0601038606681665e-5,-3.036287029042388e-5,-9.736134809126074e-9,-6.024888746053323e-5,-3.0051869736974383e-5,-9.731565682588457e-9,-5.999994090928063e-5,-2.971789522758825e-5,-9.724862066857019e-9,-5.9848834314815545e-5,-2.9411354882677176e-5,-9.71770907732456e-9,-5.976923198886018e-5,-2.916989718887004e-5,-9.711648469978378e-9,-5.972462316432335e-5,-2.9011586735457638e-5,-9.707751149758674e-9,-5.967870819510338e-5,-2.8935387308633597e-5,-9.70647628370283e-9,-5.9602228253192676e-5,-2.89259970676844e-5,-9.707695687073557e-9,-5.947591112549622e-5,-2.8959747148304846e-5,-9.710838540242717e-9,-5.929077173354268e-5,-2.9009608654381066e-5,-9.715094525623705e-9,-5.904719567985657e-5,-2.9048773862964067e-5,-9.71960852884578e-9,-5.8753773367436014e-5,-2.9053136374370507e-5,-9.72361187781754e-9,-5.842624685184096e-5,-2.9003338061866847e-5,-9.726475623750488e-9,-5.8086360356536405e-5,-2.8886966009567993e-5,-9.727714468149827e-9,-5.776002754298137e-5,-2.870105742876016e-5,-9.726995392498005e-9,-5.74741651198525e-5,-2.845449366073143e-5,-9.72419549652686e-9,-5.725183467800746e-5,-2.8169256139263426e-5,-9.71951151762819e-9,-5.7106100541113594e-5,-2.7879041181757347e-5,-9.713564114276547e-9,-5.7034227249689176e-5,-2.7623923778951554e-5,-9.707405962417725e-9,-5.7014849044397024e-5,-2.744114170465607e-5,-9.702361282140308e-9,-5.701050918052841e-5,-2.735425399096375e-5,-9.699698830847758e-9,-5.697609718243167e-5,-2.7364576162975244e-5,-9.700232368303819e-9,-5.6871038817050416e-5,-2.7448633497066595e-5,-9.704002376450864e-9,-5.667116781282969e-5,-2.7563221973356075e-5,-9.710182005555758e-9,-5.637617678776307e-5,-2.765667320675218e-5,-9.717264987992663e-9,-5.601027591624169e-5,-2.7682736375781414e-5,-9.723480590272698e-9,-5.561600483675091e-5,-2.7612936285683867e-5,-9.727297528384073e-9,-5.524303937361784e-5,-2.7443956618506687e-5,-9.727850312943274e-9,-5.493513840003189e-5,-2.7197955922928915e-5,-9.725154651913568e-9,-5.471906725691787e-5,-2.6915691607899557e-5,-9.72005407261872e-9,-5.4598911019501836e-5,-2.6644703453075705e-5,-9.713934027115233e-9,-5.455730383150816e-5,-2.64266189741069e-5,-9.708311206523093e-9,-5.4562420129529145e-5,-2.6287768574123053e-5,-9.704433569738843e-9,-5.457752704343605e-5,-2.623553492658023e-5,-9.703008653848694e-9,-5.456957532646678e-5,-2.6260220049275858e-5,-9.704121931504624e-9,-5.451464446828428e-5,-2.6340246599419492e-5,-9.707335422027123e-9,-5.439995050230707e-5,-2.6448131932234545e-5,-9.711898924726039e-9,-5.422339633670513e-5,-2.6555532499365036e-5,-9.716981565914689e-9,-5.399194066121386e-5,-2.663678226094542e-5,-9.721842938139277e-9,-5.37197431734721e-5,-2.667116151947731e-5,-9.725902670942154e-9,-5.342650643560834e-5,-2.6644534881516494e-5,-9.728727486336505e-9,-5.313587618209729e-5,-2.655097739679037e-5,-9.729995225631237e-9,-5.287334596399925e-5,-2.639462790136861e-5,-9.72950469114869e-9,-5.266297173036476e-5,-2.619143036945524e-5,-9.727266597271218e-9,-5.252243553464907e-5,-2.596971389861331e-5,-9.723645863256587e-9,-5.245681707745194e-5,-2.5767877042401753e-5,-9.719459836489783e-9,-5.245295661436816e-5,-2.562748717562385e-5,-9.715914975816248e-9,-5.247784135201871e-5,-2.558182145120203e-5,-9.714321344765071e-9,-5.248433005910525e-5,-2.5643167778965002e-5,-9.71565414605581e-9,-5.242443255043768e-5,-2.5794981125069657e-5,-9.720157774265109e-9,-5.2265507859568556e-5,-2.599424952537427e-5,-9.727205074415084e-9,-5.200192042456586e-5,-2.6184413784918434e-5,-9.735490249337039e-9,-5.165673914621095e-5,-2.6313264574752945e-5,-9.743443035999223e-9,-5.127351919687404e-5,-2.6348054742647138e-5,-9.749667801257827e-9,-5.0902725125982576e-5,-2.6282713166082426e-5,-9.75326720347049e-9,-5.0588284184408174e-5,-2.6136491038281e-5,-9.754009356253531e-9,-5.0357993370069754e-5,-2.5946393683606597e-5,-9.752342082004198e-9,-5.0219232993974796e-5,-2.5756667981670227e-5,-9.749262933352734e-9,-5.015982106504244e-5,-2.5608303159542794e-5,-9.746061951023208e-9,-5.0152906269271166e-5,-2.5530759317958693e-5,-9.743991748123502e-9,-5.016424167598713e-5,-2.5537314473559887e-5,-9.743957229389409e-9,-5.015987799753719e-5,-2.5624510658344092e-5,-9.746324283706057e-9,-5.011244865581866e-5,-2.5775123374663638e-5,-9.750904754883811e-9,-5.000492623338741e-5,-2.596321755352963e-5,-9.757101352467545e-9,-4.9831698223674514e-5,-2.6159651038122543e-5,-9.764134932390347e-9,-4.959756293540752e-5,-2.6336794409959954e-5,-9.77125471218565e-9,-4.9315586018946434e-5,-2.6471880876366733e-5,-9.777857341227311e-9,-4.900467765247903e-5,-2.6549048296052148e-5,-9.78350042703132e-9,-4.868733505302663e-5,-2.6560573645593127e-5,-9.787854781108205e-9,-4.8387507995782974e-5,-2.6507830841147043e-5,-9.790671063781774e-9,-4.812820015775109e-5,-2.640221991296037e-5,-9.791823659827242e-9,-4.792822925558667e-5,-2.626586053182433e-5,-9.791440657019166e-9,-4.7797688235235664e-5,-2.6131146731513124e-5,-9.790058210807481e-9,-4.7732434736905576e-5,-2.603750245204811e-5,-9.788680030956192e-9,-4.770949127982192e-5,-2.602362103765612e-5,-9.788622629016349e-9,-4.768699088683465e-5,-2.6115132800391774e-5,-9.791115783371455e-9,-4.7612514838547504e-5,-2.6311416798164514e-5,-9.796791594098938e-9,-4.744004786748611e-5,-2.6579162837951064e-5,-9.805340798551625e-9,-4.714894275327642e-5,-2.68596183979786e-5,-9.81558384504337e-9,-4.675409408145582e-5,-2.7088789244523173e-5,-9.82593563524379e-9,-4.63007016373858e-5,-2.7220538865820394e-5,-9.834966162719081e-9,-4.584698755933853e-5,-2.7240537539346205e-5,-9.841756608580806e-9,-4.544489497457328e-5,-2.716612358051693e-5,-9.845989371386469e-9,-4.512720869220526e-5,-2.7035870592725035e-5,-9.847894204339548e-9,-4.490350340869352e-5,-2.6895966227287968e-5,-9.848150476851382e-9,-4.4762813526265216e-5,-2.6788619054627426e-5,-9.847749002642056e-9,-4.467974944751262e-5,-2.6744535726717833e-5,-9.847788854326644e-9,-4.4621551529998665e-5,-2.67793858092927e-5,-9.849227199555758e-9,-4.4554711427458415e-5,-2.6893402551401513e-5,-9.852654250504786e-9,-4.445048423814215e-5,-2.7073346152810357e-5,-9.858177344922723e-9,-4.428881976659844e-5,-2.7296183901073322e-5,-9.865455416384905e-9,-4.406041691263042e-5,-2.753370714423536e-5,-9.873857188997167e-9,-4.376691930956634e-5,-2.7757247847319554e-5,-9.882664459772306e-9,-4.3419538053046194e-5,-2.7941805347373132e-5,-9.891234414250543e-9,-4.303660454191013e-5,-2.8069095603610774e-5,-9.899069051818642e-9,-4.264069174434751e-5,-2.8129368229640377e-5,-9.90579879900749e-9,-4.2255769073996823e-5,-2.8122238695490774e-5,-9.911139409555858e-9,-4.1904486407320275e-5,-2.8056896725693683e-5,-9.914892497705433e-9,-4.160543814119917e-5,-2.7951878164291356e-5,-9.9170275201943e-9,-4.137010911506443e-5,-2.783431847991674e-5,-9.917825281106567e-9,-4.119921521788755e-5,-2.7738086497587085e-5,-9.917998408072091e-9,-4.107878264055179e-5,-2.769954625238172e-5,-9.91867215364473e-9,-4.097763615938715e-5,-2.7749689768273665e-5,-9.921139370467895e-9,-4.0849404904229084e-5,-2.7902797854934692e-5,-9.926407792259145e-9,-4.0642441010064514e-5,-2.8145057541786642e-5,-9.934713814169385e-9,-4.031787237599612e-5,-2.8430538779043658e-5,-9.945298702787681e-9,-3.9868810330146976e-5,-2.8691908882654146e-5,-9.9566665170196e-9,-3.932833565054289e-5,-2.8864961803409028e-5,-9.967212572062042e-9,-3.875854394725441e-5,-2.891437192128338e-5,-9.975808367109482e-9,-3.822616913640833e-5,-2.8845330760606945e-5,-9.98201180056612e-9,-3.777943806979286e-5,-2.869613572190929e-5,-9.98594693625295e-9,-3.743725664498184e-5,-2.8519754654329504e-5,-9.98810862349428e-9,-3.719134397363045e-5,-2.8366020937962917e-5,-9.989234069973608e-9,-3.701525587842487e-5,-2.8270836040562245e-5,-9.99020103086058e-9,-3.6874340673262915e-5,-2.8252557552493446E-05,-9.991881928374356e-9,-3.6733633947777075e-5,-2.831302992680173e-5,-9.994958846882884e-9,-3.656313374093195e-5,-2.844073037686516e-5,-9.999766501751608e-9,-3.634100881655143e-5,-2.8614561011922926e-5,-1.000623541918002e-8,-3.605533964519792e-5,-2.8807801587885512e-5,-1.0013957531492734e-8,-3.570465334841229e-5,-2.8992079074828512e-5,-1.0022338457116705e-8,-3.529734816247884e-5,-2.914116709250595e-5,-1.0030762046344616e-8,-3.485006993645185e-5,-2.92343805861204e-5,-1.0038702615702036e-8,-3.4385142229079815e-5,-2.9259238226273796e-5,-1.0045757091094494e-8,-3.3927359255493513e-5,-2.9213049460563632e-5,-1.0051621058011619e-8,-3.350058407226353e-5,-2.9103332940466208e-5,-1.0056066702504657e-8,-3.3124457063630464e-5,-2.8947189972084985e-5,-1.0058976990550987e-8,-3.2811366323358286e-5,-2.8769735723801098e-5,-1.0060445345746964e-8,-3.256375787328263e-5,-2.8601623226662544e-5,-1.0060897143616392e-8,-3.2371816097269846e-5,-2.8475488693954947e-5,-1.0061145174295647e-8,-3.221189052935458e-5,-2.842075314931494e-5,-1.0062287880142022e-8,-3.204694100578321e-5,-2.8456309260332803e-5,-1.0065415316236122e-8,-3.183109485034811e-5,-2.8581804503757855e-5,-1.007118993199182e-8,-3.152026648812525e-5,-2.877048997646703e-5,-1.0079484318373714e-8,-3.108835216793204e-5,-2.8969238348406404e-5,-1.0089312218910324e-8,-3.0542974461299724e-5,-2.911131486583659e-5,-1.0099182540644034e-8,-2.992994780628945e-5,-2.9140766616140142e-5,-1.0107715115987456e-8,-2.9319253695152042e-5,-2.9036541761832005e-5,-1.0114124886146775e-8,-2.877809393386789e-5,-2.8820960229194144e-5,-1.0118307228329601e-8,-2.8346852894650365e-5,-2.8547443251060635e-5,-1.0120625267983092e-8,-2.803055359693186e-5,-2.8277133796314353e-5,-1.0121677071264258e-8,-2.7805852942645365e-5,-2.8058810315545394e-5,-1.0122171969069935e-8,-2.7634885870697304e-5,-2.7919586021142028e-5,-1.0122851241518537e-8,-2.7477784344898564e-5,-2.7865136011979794e-5,-1.0124374041290903e-8,-2.73005681768325e-5,-2.788470342701019e-5,-1.0127178785398857e-8,-2.707876938176712e-5,-2.7957027015369363e-5,-1.0131386580299943e-8,-2.6798428484780897e-5,-2.8055381987984983e-5,-1.0136799525049531e-8,-2.6455880523470634e-5,-2.8151496961065997e-5,-1.0142993650083491e-8,-2.6056989964450905e-5,-2.8218751221123247e-5,-1.0149458252670142e-8,-2.5615936366383297e-5,-2.82350089513246e-5,-1.0155717100330529e-8,-2.5153423477268736e-5,-2.8185218808561722e-5,-1.0161389371918144e-8,-2.469410784372093e-5,-2.80636100261117e-5,-1.0166188348621973e-8,-2.426321414819864e-5,-2.787501653366006e-5,-1.0169893731105325e-8,-2.3882668480529245e-5,-2.763487038497263e-5,-1.01723489245492e-8,-2.3567286234310905e-5,-2.7367666919278267e-5,-1.017351616196784e-8,-2.332156842397692e-5,-2.7103905438103306e-5,-1.017357593949472e-8,-2.3137641969046203e-5,-2.6875705732266855e-5,-1.0173013410180529e-8,-2.299476051584912e-5,-2.6711500845227496E-05,-1.017261329344951e-8,-2.2860705750699917e-5,-2.663018704620786e-5,-1.0173308322342749e-8,-2.2695665047880168e-5,-2.663518611623227e-5,-1.017589092482202e-8,-2.2459337873909423e-5,-2.6709603552242226e-5,-1.0180685150351775e-8,-2.212140867809451e-5,-2.6814846177850375e-5,-1.0187337375833014e-8,-2.1673671732367735e-5,-2.6895869468464378e-5,-1.0194873028803975e-8,-2.1139047774474032e-5,-2.68952440266726e-5,-1.0202044877588625e-8,-2.0570501852735378e-5,-2.6773653165214853e-5,-1.0207808391111026e-8,-2.0035779945461135e-5,-2.6527596262472074e-5,-1.0211650200164242e-8,-1.95929968856085e-5,-2.6192859779762135e-5,-1.0213616507492086e-8,-1.9270119523824262e-5,-2.5830075681245798e-5,-1.021413380368983e-8,-1.905933904298975e-5,-2.5500927912146165e-5,-1.021381348729072e-8,-1.892657043021345e-5,-2.5248592103061754e-5,-1.0213321886218076e-8,-1.8827443033921196e-5,-2.5090146839981592e-5,-1.0213277816654462e-8,-1.8720869387209668e-5,-2.5019585350191788e-5,-1.0214142627298827e-8,-1.8576464284264876e-5,-2.5015668692887527e-5,-1.0216127260583814e-8,-1.8376611843414558e-5,-2.504980617624261e-5,-1.0219166169699748e-8,-1.8115567499788158e-5,-2.5091878000311348e-5,-1.022297593256864e-8,-1.77975879404375e-5,-2.511396168920078e-5,-1.0227169183059294e-8,-1.743505293856026e-5,-2.5092754555130803e-5,-1.0231368833090536e-8,-1.7046707371919865e-5,-2.5011456803880348e-5,-1.0235274298180084e-8,-1.6655740859370975e-5,-2.4861532084328557e-5,-1.023866489114029e-8,-1.6287282974612118e-5,-2.464432330060455e-5,-1.0241365206381334e-8,-1.596501252310151e-5,-2.4372025169081737e-5,-1.024321801882643e-8,-1.570702113141324e-5,-2.406725812436014e-5,-1.0244103967347291e-8,-1.552160951313559e-5,-2.376063009939192e-5,-1.0244017040254267e-8,-1.5404061827608693e-5,-2.3486101581026236e-5,-1.0243161489551215e-8,-1.5335535519959935e-5,-2.327460877469775e-5,-1.0242006517918706e-8,-1.5284891552236783e-5,-2.314712391361825e-5,-1.0241237021644048e-8,-1.5213603604440276e-5,-2.3108728191468194e-5,-1.0241580512137116e-8,-1.5083201808082548e-5,-2.3145172717351075e-5,-1.0243555303704379e-8,-1.4864218209902013e-5,-2.32231622645874e-5,-1.0247243960115732e-8,-1.4545036900022462e-5,-2.3295366098052616e-5,-1.0252208937023976e-8,-1.4138251105215157e-5,-2.3310524416851092e-5,-1.0257614027791928e-8,-1.368146422366092e-5,-2.322748601135849e-5,-1.0262512342819018e-8,-1.322989051622768e-5,-2.3029486169829173e-5,-1.0266164007946504e-8,-1.2840855736179594e-5,-2.2732545405069593e-5,-1.0268236392507776e-8,-1.2555169579427251e-5,-2.238231187733215e-5,-1.0268825150242116e-8,-1.2383914527037539e-5,-2.2038912589209548e-5,-1.0268347802691693e-8,-1.2307249887307113e-5,-2.1756613087809175e-5,-1.0267393640885903e-8,-1.2284812012886326e-5,-2.156813016555327e-5,-1.0266572608916944e-8,-1.2270971936084373e-5,-2.1479552451146128e-5,-1.0266376938115249e-8,-1.2227457536302338e-5,-2.1474911265539056e-5,-1.0267077590847187e-8,-1.2129749205895953e-5,-2.1525263563921737e-5,-1.0268689111523196e-8,-1.1967892292312714e-5,-2.1597450054922837e-5,-1.0271017429226725e-8,-1.174422548889918e-5,-2.166023896731968e-5,-1.0273764819876203e-8,-1.1470257655664928e-5,-2.1687790859828148e-5,-1.0276640831595281e-8,-1.1163872918540682e-5,-2.16613873970703e-5,-1.0279429528370393e-8,-1.0847087574647729e-5,-2.1570437594962387e-5,-1.0281991235380007e-8,-1.0544002989509588e-5,-2.141339145539365e-5,-1.0284216045362617e-8,-1.0278390240021108e-5,-2.1198652865103365e-5,-1.0285974464584003e-8,-1.0070447996162899e-5,-2.0945037086426453e-5,-1.028711043152021e-8,-9.932690801530476e-6,-2.068088652200719e-5,-1.028749799157689e-8,-9.86563644678306e-6,-2.0440844298465255e-5,-1.0287141168707594e-8,-9.854764583517574e-6,-2.0259766952748523e-5,-1.028626273479879e-8,-9.870619619233569e-6,-2.01644508838674e-5,-1.0285319481300823e-8,-9.8733786193769e-6,-2.0165339281957866e-5,-1.0284908068411034e-8,-9.821625784056985e-6,-2.0251252759600633e-5,-1.0285579389915266e-8,-9.683168074476673e-6,-2.0389683901633625e-5,-1.0287635145367275e-8,-9.444561568473699e-6,-2.053338593781372e-5,-1.0290997813059452e-8,-9.116224347150207e-6,-2.063177957102368e-5,-1.0295216467786993e-8,-8.731339354531077e-6,-2.0644132770129046e-5,-1.0299605534523448e-8,-8.338457137712565e-6,-2.055092931652111e-5,-1.030345694288755e-8,-7.98933323349338e-6,-2.0360097137701205e-5,-1.0306242488373733e-8,-7.72506620945875e-6,-2.0105711184980106e-5,-1.0307743277604975e-8,-7.564775484823967e-6,-1.983876173135379e-5,-1.0308080804889762e-8,-7.500921681843046e-6,-1.9612526930376168e-5,-1.0307656350511951e-8,-7.503139782780013e-6,-1.946768074753192e-5,-1.0307019062928134e-8,-7.528820005869814e-6,-1.9422601531502887e-5,-1.0306699910081859e-8,-7.535794278292598e-6,-1.947177763761887e-5,-1.0307063665786794e-8,-7.492269894596984e-6,-1.959128917115925e-5,-1.0308233957531626e-8,-7.381486721375345e-6,-1.974765598713154e-5,-1.0310113143840973e-8,-7.201498312177095e-6,-1.990624677978869e-5,-1.031247670749912e-8,-6.962107167616799e-6,-2.0037161470478344e-5,-1.031508699283958e-8,-6.680993863389137e-6,-2.011834907841151e-5,-1.0317770097194946e-8,-6.380273436048308e-6,-2.0136768138740442e-5,-1.032042648831648e-8,-6.0838277247680745e-6,-2.0088636779103125e-5,-1.0322983928965702e-8,-5.815108860030673e-6,-1.9979521669310532e-5,-1.0325335032912242e-8,-5.594817165694961e-6,-1.9824453315227466e-5,-1.0327309582072665e-8,-5.437930590768389e-6,-1.9647685779100526e-5,-1.0328712972235372e-8,-5.349939383493514e-6,-1.948122710398913e-5,-1.0329423078834094e-8,-5.3228826376455855e-6,-1.936095973346019e-5,-1.0329498903693821e-8,-5.332864110333339e-6,-1.9319532507723174e-5,-1.0329235310495402e-8,-5.341522628441661e-6,-1.9376734531154476e-5,-1.0329117209882681e-8,-5.303353476159965e-6,-1.953039383977173e-5,-1.0329676054612896e-8,-5.17823507516099e-6,-1.9752454282041895e-5,-1.0331308373795825e-8,-4.945019491343102e-6,-1.9993909540435985e-5,-1.0334140752283602e-8,-4.610138350751177e-6,-2.019829297048899e-5,-1.0337995748268947e-8,-4.206914461260477e-6,-2.0318725218684748e-5,-1.0342450652703292e-8,-3.7858145479968068e-6,-2.033162353691172e-5,-1.0346947057188743e-8,-3.3999204340748854e-6,-2.0242322080569558e-5,-1.0350921705190584e-8,-3.090978422107698e-6,-2.0081863583639396e-5,-1.035394277316305e-8,-2.879939472361453e-6,-1.9897267305424163e-5,-1.0355827001534681e-8,-2.7637461044958318e-6,-1.9738805558921248e-5,-1.035669501194934e-8,-2.7182918430026305e-6,-1.9647845328083208e-5,-1.0356930437472887e-8,-2.706078182001334e-6,-1.964815539595743e-5,-1.0357046501868146e-8,-2.6861280184476436e-6,-1.9742416449230415e-5,-1.035751449251452e-8,-2.623356484294166e-6,-1.9914165200530054e-5,-1.0358627867133187e-8,-2.495051690997066e-6,-2.0133848461016657e-5,-1.0360457505484327e-8,-2.2933525948354025e-6,-2.0366613404506264e-5,-1.0362901596694904e-8,-2.024101506874866e-6,-2.057945330065126e-5,-1.036578541391425e-8,-1.703438490176005e-6,-2.0746243231691587e-5,-1.0368950180661795e-8,-1.353670649395772e-6,-2.085034603832491e-5,-1.0372285844231933e-8,-9.995092065925437e-7,-2.0885306200609506e-5,-1.0375703780683756e-8,-6.650892091385618e-7,-2.085449651147433e-5,-1.0379079635308058e-8,-3.715968940342627e-7,-2.0770428531116953e-5,-1.0382217349452199e-8,-1.3503446063713592e-7,-2.065397945826239e-5,-1.0384871607393536e-8,3.635039213145238e-8,-2.053328258334241e-5,-1.0386834569506982e-8,1.451554926153161e-7,-2.0441523455916053e-5,-1.038805057918194e-8,2.0789280435282035e-7,-2.041250688557186e-5,-1.0388697272151172e-8,2.56355366977416e-7,-2.047315309918241e-5,-1.0389176849844525e-8,3.3464806040304173e-7,-2.0633626967615144e-5,-1.039000389350313e-8,4.896682666698106e-7,-2.0878520990299207e-5,-1.0391635630909641e-8,7.558554175414243e-7,-2.1164864508976094e-5,-1.0394332164603972e-8,1.1400137473200676e-6,-2.143168146622313e-5,-1.039811235383832e-8,1.6149011662753742e-6,-2.161972150492724e-5,-1.040278944838272e-8,2.1267889603254867e-6,-2.169252145724684e-5,-1.0408016370122865e-8,2.613791080986166e-6,-2.1648099623553002e-5,-1.0413314414030032e-8,3.0255611796536674e-6,-2.1516600834236966e-5,-1.0418136661790554e-8,3.335896657502066e-6,-2.1347475609993867e-5,-1.0422008383847894e-8,3.5455028334495375e-6,-2.1193595706788387e-5,-1.0424695027343131e-8,3.6771057866818085e-6,-2.1098205117584193e-5,-1.0426297045670991e-8,3.766730983759074e-6,-2.1087212163472165e-5,-1.0427207186394536e-8,3.8543118584060025e-6,-2.116678673670468e-5,-1.0427955059979016e-8,3.97556153049034e-6,-2.1325112935168602e-5,-1.0429021553114722e-8,4.156112148298531e-6,-2.1536968915716497e-5,-1.043071137120023e-8,4.4083884967787636e-6,-2.1769858276116903e-5,-1.0433124870667529e-8,4.731238299426264e-6,-2.199039967092715e-5,-1.0436213182297564e-8,5.111871251593329e-6,-2.216982148981789e-5,-1.0439862617282118e-8,5.5293180610449155e-6,-2.228781360239789e-5,-1.0443951826756803e-8,5.958483105439134e-6,-2.2334471279948907e-5,-1.0448355486385057e-8,6.3739591557127685e-6,-2.2310548005592115e-5,-1.0452908274701619e-8,6.753167656295747e-6,-2.2226596306971968e-5,-1.0457371227043073e-8,7.0788641774440105e-6,-2.2101555638768476e-5,-1.0461442256004719e-8,7.341270437022586e-6,-2.19610250197676e-5,-1.0464828194753588e-8,7.540107011405848e-6,-2.18351220744106e-5,-1.0467357564690674e-8,7.686656069240698e-6,-2.1755428418429816e-5,-1.0469080980364281e-8,7.805377469636384e-6,-2.175014455624397e-5,-1.047029980195859e-8,7.933563002743403e-6,-2.1836872868918745e-5,-1.0471493607166954e-8,8.116719413656968e-6,-2.2013889674084526e-5,-1.0473170238320335e-8,8.397782946960609e-6,-2.2253242470900754e-5,-1.0475713376965965e-8,8.801167458084262e-6,-2.2501424654771112e-5,-1.0479313312473675e-8,9.31809147430383e-6,-2.2692544610459407e-5,-1.0483994091602052e-8,9.903277804372193e-6,-2.2771894060168208e-5,-1.0489651043077342e-8,1.0488693236733184e-5,-2.2718401944810526e-5,-1.0496011071352977e-8,1.1008517592282977e-5,-2.2552507598399298e-5,-1.0502567400688094e-8,1.14214527653244e-5,-2.2325484053898436e-5,-1.0508639692043991e-8,1.1719729539192924e-5,-2.2098427892878435e-5,-1.051360321451119e-8,1.192434757606461e-5,-2.192293983959106e-5,-1.0517149141774825e-8,1.2073148493867486e-5,-2.1830348879371115e-5,-1.0519399549919799e-8,1.2208507379845121e-5,-2.1829582167914723e-5,-1.0520823108331641e-8,1.2368142087573956e-5,-2.1910517424363665e-5,-1.0522026852220468e-8,1.2579647860001937e-5,-2.204963465047748e-5,-1.0523548294514526e-8,1.2858046046948135e-5,-2.2216044306126058e-5,-1.052573427092128e-8,1.3205504635807662e-5,-2.2377097194277054e-5,-1.0528728383253077e-8,1.3612660353343853e-5,-2.2503232700248113e-5,-1.0532528837699294e-8,1.4061128311368573e-5,-2.257179941745656e-5,-1.053705767622001e-8,1.4526835423976653e-5,-2.2569659248670465e-5,-1.0542194374134102e-8,1.4983796312142356e-5,-2.2494425657141477e-5,-1.0547763574333112e-8,1.5407831934948618e-5,-2.2354282969079747e-5,-1.0553504640982075e-8,1.5779770461427512e-5,-2.2166624359187616e-5,-1.0559067684047334e-8,1.608797482690634e-5,-2.195590135189993e-5,-1.0564065337397685e-8,1.6330245854374478e-5,-2.1750905552668204e-5,-1.0568177866410433e-8,1.6515130621988764e-5,-2.1581513602797013e-5,-1.0571271898841906e-8,1.6662595891771928e-5,-2.1474755707688038e-5,-1.0573475716392125e-8,1.680367989659793e-5,-2.144982680559584e-5,-1.0575164031555221e-8,1.6977991855744892e-5,-2.15119081550659e-5,-1.0576851619497795e-8,1.7227451460833117e-5,-2.164590037929872e-5,-1.0579043607594197e-8,1.758528349482335e-5,-2.1813063305720084e-5,-1.0582122319913347e-8,1.8061786594786307e-5,-2.1955189701945334e-5,-1.058632473338257e-8,1.8632948981106676e-5,-2.200995658499017e-5,-1.0591773118012249e-8,1.9241195983456193e-5,-2.193466323120593e-5,-1.0598445172373046e-8,1.981317133003406e-5,-2.1726452282952587e-5,-1.0606040069575834e-8,2.0287448616256157e-5,-2.1425281858291863e-5,-1.061388459734303e-8,2.0636332778655594e-5,-2.109672690297479e-5,-1.0621077002227759e-8,2.087033260256244e-5,-2.0805852875933422e-5,-1.0626847060734854e-8,2.1026869693195923e-5,-2.0597119217422514e-5,-1.0630882019558624e-8,2.115329294074093e-5,-2.0487273010198692e-5,-1.0633405474768798e-8,2.129300028400665e-5,-2.0468775249628576e-5,-1.0635008899056331e-8,2.1477766769687902e-5,-2.0517857674518222e-5,-1.0636384654839218e-8,2.172530639983127e-5,-2.0602735888928814e-5,-1.0638109815842078e-8,2.203989369531137e-5,-2.0690072956350867e-5,-1.0640550610319622e-8,2.2414327228279076e-5,-2.0749586688981025e-5,-1.0643876480653403e-8,2.2832428864176618e-5,-2.075731437602081e-5,-1.0648123545462657e-8,2.327186373709147e-5,-2.06979052512023e-5,-1.065324691100052e-8,2.370725263408254e-5,-2.056607264478361e-5,-1.065912813728469e-8,2.4113571523498897e-5,-2.0367140342581537e-5,-1.0665546197757955e-8,2.4469666599175597e-5,-2.011644324456059e-5,-1.067215081453571e-8,2.4761457155718238e-5,-1.9837455761494462e-5,-1.0678483547801098e-8,2.4984396740016067e-5,-1.9558825643028435e-5,-1.0684064625935296e-8,2.5144939672969598e-5,-1.9310587473940774e-5,-1.0688525639022025e-8,2.5260818881569855e-5,-1.9119802585786575e-5,-1.06917361236997e-8,2.535994562171527e-5,-1.9005914717674657e-5,-1.069386581323808e-8,2.5477696466233576e-5,-1.897609088271257e-5,-1.0695349149176802e-8,2.5652094341733997e-5,-1.902096367210599e-5,-1.0696767956414568e-8,2.5916298087693046e-5,-1.9111975005796678e-5,-1.0698709732170148e-8,2.628859728374691e-5,-1.9202643001807574e-5,-1.0701666562329869e-8,2.6762094197675117e-5,-1.9236556751696734e-5,-1.0705996336353121e-8,2.729911355674748e-5,-1.9163344524585584e-5,-1.0711891767678148e-8,2.783684602254258e-5,-1.895885387153898e-5,-1.0719277613221644e-8,2.8306670586864564e-5,-1.8639334239086277e-5,-1.072766183557865e-8,2.8659855505782475e-5,-1.8258763113995928e-5,-1.073612159190717e-8,2.8885279659063856e-5,-1.7888184927921706e-5,-1.0743575505291491e-8,2.9009231738796605e-5,-1.7588764782654586e-5,-1.0749225136080199e-8,2.908000233439939e-5,-1.7393518711195572e-5,-1.0752864147570606e-8,2.914855079008243e-5,-1.7304111401313012e-5,-1.0754868997586099e-8,2.9254770735155143e-5,-1.7298721919266967e-5,-1.0755947029287413e-8,2.9421960148790195e-5,-1.73433769434448e-5,-1.0756840443938963e-8,2.9657262395368594e-5,-1.7401543433202763e-5,-1.075813349050785e-8,2.9954830790562838e-5,-1.7440335048629465e-5,-1.0760197584755174e-8,3.0299471035757358e-5,-1.7433879737981824e-5,-1.0763229561035464e-8,3.066988743140981e-5,-1.7365039408173015e-5,-1.0767308977273792e-8,3.104156445903691e-5,-1.7226340848682806e-5,-1.0772421289059723e-8,3.138958150404849e-5,-1.7020431608455362e-5,-1.0778433463519163e-8,3.169160978062888e-5,-1.67599800034654e-5,-1.0785050830896731e-8,3.193113385062856e-5,-1.6466649719056538e-5,-1.0791801522036606e-8,3.2100549457274216e-5,-1.6168735086317945e-5,-1.0798090040294278e-8,3.2203473041458363e-5,-1.5897357896149383e-5,-1.080332573716205e-8,3.225558795119785e-5,-1.568153341658853e-5,-1.0807089151843031e-8,3.2283527758016355e-5,-1.5542734995758057e-5,-1.0809272801144117e-8,3.232156973954858e-5,-1.548986537631878e-5,-1.0810136690642487e-8,3.24062788787755e-5,-1.551564386066977e-5,-1.0810253821627844E-08,3.256954672694955e-5,-1.5595319915829232e-5,-1.0810370807169095e-8,3.2830743045217534e-5,-1.5688646392023816e-5,-1.0811243374832355e-8,3.318930936264058e-5,-1.5746136030541182e-5,-1.0813499406816032e-8,3.362016828548337e-5,-1.572010074949781e-5,-1.0817540474292183e-8,3.4075238666891787e-5,-1.5579179787124913e-5,-1.0823450353064908e-8,3.449382518613816e-5,-1.532196370613026e-5,-1.0830892582439516e-8,3.482107455406541e-5,-1.498254328611866e-5,-1.0839063244369992e-8,3.502767239053273e-5,-1.4622079522363778e-5,-1.0846829814097262e-8,3.5120439857015004e-5,-1.4307820231652071e-5,-1.085309302508078e-8,3.51375862864246e-5,-1.4089687106817873e-5,-1.085719959088525e-8,3.513199200269295e-5,-1.3986345854532377e-5,-1.085914650566585e-8,3.51525500412995e-5,-1.3985560988209588e-5,-1.085947705163363e-8,3.523209339490654e-5,-1.4054646803086456e-5,-1.0858988747294016e-8,3.5384088933798624e-5,-1.4153334684894148e-5,-1.0858452300955869e-8,3.560538153213612e-5,-1.4243709791482467e-5,-1.0858457682387729e-8,3.5881218350812025e-5,-1.4295764431560704e-5,-1.0859389106431877e-8,3.619005612992247e-5,-1.4289538747822578e-5,-1.0861464399875234e-8,3.650727263331189e-5,-1.4215445163763979e-5,-1.0864770150441248e-8,3.680795793798622e-5,-1.4073968871802461e-5,-1.0869255064842456e-8,3.7069338849790505e-5,-1.3875233842953704e-5,-1.0874690311021376e-8,3.7273324238066565e-5,-1.3638322204225281e-5,-1.0880636211450608e-8,3.740935211446729e-5,-1.338984019635138e-5,-1.0886460859978193e-8,3.747723555199965e-5,-1.3161108246832657e-5,-1.0891439508632244e-8,3.748918890039127e-5,-1.2983612439641286e-5,-1.0894923864558378e-8,3.746992648426565e-5,-1.2882969889767162e-5,-1.0896531846094513e-8,3.745388166964016e-5,-1.2872486930655807e-5,-1.089628939077259e-8,3.7479301400060466e-5,-1.2948111531254483e-5,-1.089466332568615e-8,3.758006931596514e-5,-1.3086710784613064e-5,-1.0892467653005773e-8,3.7777099336497654e-5,-1.3248905734680901e-5,-1.0890674230236611e-8,3.807156828641263e-5,-1.3386503835473725e-5,-1.0890190192257392e-8,3.844207700891592e-5,-1.3453370708504295e-5,-1.0891659080748418e-8,3.8847217212184006e-5,-1.341755372714709e-5,-1.0895313751720727e-8,3.9234030267991595e-5,-1.3271607631699584e-5,-1.090089279363746e-8,3.955132226947631e-5,-1.3037539781839813e-5,-1.0907643242370493e-8,3.976462669241938e-5,-1.2763223288738137e-5,-1.0914452499003047e-8,3.9867493531828635e-5,-1.250952451713426e-5,-1.0920130006578416e-8,3.988372523989806e-5,-1.2331758085782543e-5,-1.0923768775661982e-8,3.9858740281902724e-5,-1.226291312067013e-5,-1.0925025267279314e-8,3.98438771345933e-5,-1.2305852412647015e-5,-1.0924174807119913e-8,3.988096864166715e-5,-1.2436775734862486e-5,-1.092193559817097e-8,3.9993234799773925e-5,-1.2616327199137168e-5,-1.0919186656117713e-8,4.0184029323987886e-5,-1.2802124998079611e-5,-1.0916728214422174e-8,4.0441034122307655e-5,-1.295806215039957e-5,-1.0915158387722742e-8,4.07423430323965e-5,-1.3059008181614689e-5,-1.0914851840032176e-8,4.106194258997215e-5,-1.309190696252388e-5,-1.0915982377055156e-8,4.137369026554492e-5,-1.305496471159586e-5,-1.0918538217819229e-8,4.165397699143815e-5,-1.295627528662622e-5,-1.0922312589289403e-8,4.188372567499801e-5,-1.281253335343146e-5,-1.0926886273075621e-8,4.205038798547874e-5,-1.2647779157268254e-5,-1.0931637253225023e-8,4.2150263329725885e-5,-1.2491600175957169e-5,-1.0935808929506866e-8,4.219089514943613e-5,-1.2376014975777942e-5,-1.0938645719799141e-8,4.219264556971658e-5,-1.2330443038611213e-5,-1.0939574041035733e-8,4.2187994684927e-5,-1.2374868917154073e-5,-1.0938381011529256e-8,4.221708942536862e-5,-1.251262722220375e-5,-1.0935330563847715e-8,4.2319148750577894e-5,-1.272563608677644e-5,-1.0931164753811414e-8,4.252146931834362e-5,-1.2975210570017808e-5,-1.0926967333923104e-8,4.282981205890698e-5,-1.3209939979367455e-5,-1.0923913734952636e-8,4.3224317253663856e-5,-1.3379021269503886e-5,-1.092296888156952e-8,4.3663191015489984e-5,-1.3446687017306154e-5,-1.0924616375420668e-8,4.40932553261884e-5,-1.3402692615521834e-5,-1.0928699864093918e-8,4.446391154055205e-5,-1.3265486287865059e-5,-1.0934436131087437e-8,4.4740262897078254e-5,-1.3077370375528966e-5,-1.0940609312170373e-8,4.491180449520049e-5,-1.2893262674070154e-5,-1.0945898968800855e-8,4.49944176700801e-5,-1.2766207079580588e-5,-1.0949239480507803e-8,4.502512200115446e-5,-1.273370298418019e-5,-1.0950092267772875e-8,4.505116850684658e-5,-1.2808910095088956e-5,-1.0948539845884595e-8,4.511705275984765e-5,-1.2979305349759284e-5,-1.0945188231944347e-8,4.5253768849291526e-5,-1.3212635289537497e-5,-1.0940942427650663e-8,4.547343858202198e-5,-1.3467274984818715e-5,-1.093675586758881e-8,4.576991139681106e-5,-1.370288962080165e-5,-1.0933437996680767e-8,4.6123562686564354e-5,-1.3888173614010929e-5,-1.0931552459312198e-8,4.6507586318521756e-5,-1.4004532581867268e-5,-1.0931388495325245e-8,4.689364295154041e-5,-1.404638935558007e-5,-1.0932970781736282e-8,4.725592017948633e-5,-1.401955872819049e-5,-1.0936077710211673e-8,4.7573669880768315e-5,-1.3939013934426217e-5,-1.0940262282537435e-8,4.783282623871706e-5,-1.3826794886489019e-5,-1.0944887017204275e-8,4.8027394648472436e-5,-1.3710116999369636e-5,-1.0949190756732851e-8,4.816102679731794e-5,-1.361918978051325e-5,-1.095239527820225e-8,4.824866180786038e-5,-1.3583965343721564e-5,-1.0953844774146032e-8,4.8317389669767263E-05,-1.3629077500997938e-5,-1.0953156144793383e-8,4.8404937665998705e-5,-1.3766894228811147e-5,-1.0950352515756894e-8,4.85539270343216e-5,-1.3990186698127629e-5,-1.094594628661613e-8,4.880120852726276e-5,-1.4267952993854126e-5,-1.0940929580088114e-8,4.9164604434804093e-5,-1.4548760923785778e-5,-1.0936627198037842e-8,4.963284107903462e-5,-1.4773613411439147e-5,-1.0934389782899522e-8,5.016508945338154e-5,-1.4894876338232566e-5,-1.0935178671721424e-8,5.070227547728938e-5,-1.4892932210451892e-5,-1.0939190020118924e-8,5.118560276541905e-5,-1.4782534477633037e-5,-1.0945713139716886e-8,5.157392379064546e-5,-1.4606625431828425e-5,-1.095332893238933e-8,5.185338963389235e-5,-1.4421810233716862e-5,-1.0960371481365232e-8,5.203770610741841e-5,-1.4282157086463557e-5,-1.0965440644733544e-8,5.216122418436789e-5,-1.422646572966351e-5,-1.0967760623641757e-8,5.226841451573015e-5,-1.4271353392898255e-5,-1.0967288706004566e-8,5.2402901302713924e-5,-1.4410350265664105e-5,-1.0964601820102489e-8,5.2598368352539667e-5,-1.4617978010402564e-5,-1.0960658830434025e-8,5.2872840342696726e-5,-1.4857176091440661e-5,-1.0956540629101209e-8,5.322704970841118e-5,-1.5088075305254894e-5,-1.0953236332976238e-8,5.364663492512684e-5,-1.5275993367745722e-5,-1.0951500603035131e-8,5.410696514106418e-5,-1.539698624027727e-5,-1.095178087382418e-8,5.457893133346143e-5,-1.5440298921740233e-5,-1.0954194761142424e-8,5.50342383558213e-5,-1.540806131983914e-5,-1.0958542424790509e-8,5.544932692850507e-5,-1.5313173657149106e-5,-1.096434545062792e-8,5.580777697902618e-5,-1.5176465955951547e-5,-1.0970910845978872e-8,5.610161114139606e-5,-1.502389729946295e-5,-1.0977420875607443e-8,5.633207828382777e-5,-1.4883981469539802e-5,-1.0983045974823884e-8,5.651030827952544e-5,-1.4785143953867945e-5,-1.0987069782932988e-8,5.6657843445042456E-05,-1.475241870537396e-5,-1.098900869828785e-8,5.68064043339674e-5,-1.480281230944594e-5,-1.0988713689162896e-8,5.6995445257911e-5,-1.493919710310919e-5,-1.0986451645489575e-8,5.726569833881333e-5,-1.5144085304198487e-5,-1.0982961665724738e-8,5.7647873217573626e-5,-1.537676462498628e-5,-1.097945336000276e-8,5.8148783022304093e-5,-1.5578618482013747e-5,-1.0977468969124607e-8,5.8741629395056166e-5,-1.5689303712884644e-5,-1.0978518978595156e-8,5.936880170599819e-5,-1.5669452550320848e-5,-1.0983516728908241e-8,5.995982222233368e-5,-1.5518212400740367e-5,-1.0992265385709335e-8,6.045655109961612e-5,-1.5274524989521094e-5,-1.100336461316192e-8,6.083213388443301e-5,-1.500128721893175e-5,-1.1014687824535179e-8,6.109517706905173e-5,-1.476232162248893e-5,-1.1024177858417426e-8,6.128078642644321e-5,-1.4603933293794295e-5,-1.1030515003487311e-8,6.14360565632286e-5,-1.4546623392676997e-5,-1.1033379525122147e-8,6.160676979381152e-5,-1.4585862441534919e-5,-1.1033325129027129e-8,6.182836446050053e-5,-1.4698115916188576e-5,-1.103144492460905e-8,6.212137962144658e-5,-1.4848716247797194e-5,-1.1029016395917635e-8,6.249043218855688e-5,-1.499957486442772e-5,-1.1027231651313366e-8,6.292575713367833e-5,-1.5115848315998846e-5,-1.1027035010884309e-8,6.340659244996193e-5,-1.5171078050374148e-5,-1.1029042575856415e-8,6.39057084276371e-5,-1.5150397168465046e-5,-1.1033511588368882e-8,6.439430170432664e-5,-1.5051632264841132e-5,-1.1040338007405747e-8,6.484651366485014e-5,-1.4884453987230887e-5,-1.1049078955669309e-8,6.524295871579131e-5,-1.4668006957840344e-5,-1.1059009733669053e-8,6.557293822920603e-5,-1.4427696477046931e-5,-1.106922243082436e-8,6.583546021894932e-5,-1.4191801641639522e-5,-1.1078757988711264e-8,6.603942429151922e-5,-1.3988227254888844e-5,-1.1086754263160646e-8,6.620324712438544e-5,-1.3841351539194972e-5,-1.1092584244638724e-8,6.635399675116738e-5,-1.376871069724712e-5,-1.1095960923446284e-8,6.652567539394843e-5,-1.377713360613599e-5,-1.1097002545640146e-8,6.675562941069513e-5,-1.3858317394900903e-5,-1.109626926494747e-8,6.707780774668518e-5,-1.3985038180359028e-5,-1.1094780789983727e-8,6.751241829499467e-5,-1.4110813964274978e-5,-1.1093985695546706e-8,6.805398404589733e-5,-1.4176969697956724e-5,-1.1095592658974113e-8,6.866384590550756e-5,-1.4129570457204582e-5,-1.1101140430408416e-8,6.927548828970987e-5,-1.3942193950697216e-5,-1.1111323602410547e-8,6.981586375490909e-5,-1.3632135932979031e-5,-1.1125409233657399e-8,7.023376113526364e-5,-1.3257268294156674e-5,-1.1141255562749935e-8,7.051856313032443e-5,-1.2893039413830864e-5,-1.1156102060587921e-8,7.06990864524921e-5,-1.2603544775620664e-5,-1.1167680283957444e-8,7.082667807448929e-5,-1.2422764469719474e-5,-1.1174960488599823e-8,7.095499623308146e-5,-1.2351727669469376e-5,-1.1178226969257668e-8,7.112590319904138e-5,-1.2366745927631601e-5,-1.1178667858819269e-8,7.136360199813396e-5,-1.2431038164156497e-5,-1.117783577309838e-8,7.167471562637514e-5,-1.2504825814492575e-5,-1.1177222677717251e-8,7.20513073116622e-5,-1.2552337068439892e-5,-1.1178022183958767e-8,7.247483939519828e-5,-1.2546082636510993e-5,-1.1181041603564716e-8,7.292025057925622e-5,-1.2469246626440453e-5,-1.1186692155499417e-8,7.335996924164086e-5,-1.2316707228409032e-5,-1.1195001134773114e-8,7.376777185043507e-5,-1.2094851223874839e-5,-1.1205627668886617e-8,7.41223204444516e-5,-1.1820215935622424e-5,-1.1217891224875756e-8,7.441008632046292e-5,-1.1516986111407657e-5,-1.1230839822596301e-8,7.462727595584035e-5,-1.121357421653002e-5,-1.1243374292470443e-8,7.478054238337684e-5,-1.0938760084437633e-5,-1.1254418929902535e-8,7.48865297826223e-5,-1.0717820966566956e-5,-1.1263107130437595e-8,7.497036903850236e-5,-1.0568904309436396e-5,-1.1268942299422062e-8,7.506321783824891e-5,-1.0499811842188604e-5,-1.1271900341615984e-8,7.519881869817697e-5,-1.0505257389349248e-5,-1.1272463646632064e-8,7.540869080999105e-5,-1.056479190521469e-5,-1.1271600290428743e-8,7.571546174872404e-5,-1.0642370424357846e-5,-1.1270700670162078e-8,7.61246291272292e-5,-1.0689513165947758e-5,-1.1271446895380041e-8,7.661678435223831e-5,-1.0654320433158899e-5,-1.1275546237460665e-8,7.71448147730922e-5,-1.0497201563490087e-5,-1.1284249952033519e-8,7.764205458950148e-5,-1.0209521680141907e-5,-1.1297711821998253e-8,7.804347387462571e-5,-9.824875614952504e-6,-1.1314530735816466e-8,7.831185681715099e-5,-9.411967862924406e-6,-1.133196933848187e-8,7.84533388443129e-5,-9.048847109690942e-6,-1.134696307423481e-8,7.851205357156255e-5,-8.792740654590127e-6,-1.1357361358067248e-8,7.854866512846068e-5,-8.662856311024963e-6,-1.1362623719687482e-8,7.861729582289454e-5,-8.642245361453145e-6,-1.1363680031735883e-8,7.875197622822127e-5,-8.691794929389404e-6,-1.1362277223349593e-8,7.896418283479847e-5,-8.765841602924702e-6,-1.1360297098831838e-8,7.924709191886245e-5,-8.823284793479496e-6,-1.1359315593534433e-8,7.95818503140842e-5,-8.833269852576455e-6,-1.1360426738010168e-8,7.994322616848324e-5,-8.777041367256928e-6,-1.1364233495034238e-8,8.030394161526125e-5,-8.647855079034407e-6,-1.1370898907447606e-8,8.063800618353983e-5,-8.450099063104403e-6,-1.13801913797548e-8,8.092351739561471e-5,-8.197986994855086e-6,-1.139151507594174e-8,8.114517708580553e-5,-7.913748681025796e-6,-1.1403947928868321e-8,8.129649091610874e-5,-7.625053643838189e-6,-1.1416325803923466e-8,8.13812925714093e-5,-7.361498470228608e-6,-1.1427396960663914e-8,8.141408671042445e-5,-7.150374877007221e-6,-1.143603391639288e-8,8.141887617018724e-5,-7.012246466696308e-6,-1.1441458496670813e-8,8.142639354204631e-5,-6.9569547070524565e-6,-1.1443423882852663e-8,8.146989071188947e-5,-6.980733178277085e-6,-1.1442305223764873e-8,8.157988588747373e-5,-7.0650386142183395e-6,-1.1439079612900346e-8,8.177834068751832e-5,-7.177494714956207e-6,-1.1435206339439226e-8,8.207274310460953e-5,-7.275416748518267e-6,-1.1432431508335396e-8,8.24510452990543e-5,-7.312655501458012e-6,-1.1432513684254343e-8,8.287939415777408e-5,-7.250137973215447e-6,-1.14368513607406e-8,8.330545375814392e-5,-7.068926237825051e-6,-1.1446018896562171e-8,8.366980628525399e-5,-6.781801504635946e-6,-1.1459328098698728e-8,8.392475651610919e-5,-6.436424280153653e-6,-1.147469615909485e-8,8.405365240588183e-5,-6.103856380286995e-6,-1.1489120917511639e-8,8.407948845031888e-5,-5.853970011362507e-6,-1.1499731792143241e-8,8.405583920133282e-5,-5.729599983451548e-6,-1.1504887252346792e-8,8.404479026302159e-5,-5.733734864168806e-6,-1.1504668019600196e-8,8.409487550610288e-5,-5.8348805222652595e-6,-1.1500567610929476e-8,8.422953279231353e-5,-5.983832090974439e-6,-1.1494726575699467e-8,8.44475135877195e-5,-6.130958240035688e-6,-1.1489203384318796e-8,8.473016954110671e-5,-6.237308506807428e-6,-1.1485549198160168e-8,8.504997460131159e-5,-6.278822698858891e-6,-1.1484684339034437e-8,8.537722202659041e-5,-6.24604350020151e-6,-1.1486947837148801e-8,8.56843216611937e-5,-6.141962433049987e-6,-1.149219497561945e-8,8.594839135529726e-5,-5.979584647913548e-6,-1.1499878642207251e-8,8.615303700245352e-5,-5.7797022876110846e-6,-1.1509108282661373e-8,8.628989016331793e-5,-5.568700527437504e-6,-1.1518717192858226e-8,8.636003840534361e-5,-5.3759285752394796e-6,-1.1527377565087991e-8,8.637502793286532e-5,-5.230188533993722e-6,-1.1533784620290696e-8,8.635675385529202e-5,-5.155286769746592e-6,-1.1536897415011626e-8,8.63355224875678e-5,-5.165182714998419e-6,-1.1536184302568082e-8,8.634591892159362e-5,-5.259775561616308e-6,-1.1531803962477889e-8,8.642073115040163e-5,-5.4226586174864975e-6,-1.152465872996433e-8,8.65839351077441e-5,-5.622046886179956e-6,-1.1516287597576716e-8,8.684430755827092e-5,-5.8153923203604484e-6,-1.1508609070013934e-8,8.719130249188195e-5,-5.95728092691672e-6,-1.1503558232602766e-8,8.759455242721197e-5,-6.009491974966764e-6,-1.150267039330855e-8,8.800800850055604e-5,-5.95147211987009e-6,-1.1506668360848453e-8,8.837913286366379e-5,-5.7886627769627485e-6,-1.1515138637633855e-8,8.866225574551908e-5,-5.555373933240397e-6,-1.1526431984484355e-8,8.883301404506053e-5,-5.309063543337344e-6,-1.1537937388838975e-8,8.889840023466499e-5,-5.115164449411993e-6,-1.1546777723907165e-8,8.889656623832367e-5,-5.026383401286591e-6,-1.1550737585091733e-8,8.888441107440784e-5,-5.065123260574208e-6,-1.154900893343037e-8,8.891787950494431e-5,-5.21765631045529e-6,-1.1542374452129857e-8,8.903443511633252e-5,-5.442337151279303e-6,-1.1532775965427147e-8,8.924516874443352e-5,-5.686194762207577e-6,-1.1522563607641413e-8,8.953744138069596e-5,-5.90108623252899e-6,-1.1513813593362013e-8,8.988360538093972e-5,-6.053558073616242e-6,-1.1507938669655695e-8,9.025045498071756e-5,-6.127657333921901e-6,-1.1505594789433005e-8,9.06062942791196e-5,-6.123105910016481e-6,-1.1506768232466762e-8,9.092503624012695e-5,-6.051676523403866e-6,-1.1510921388865986e-8,9.118813404710323e-5,-5.933591903961702e-6,-1.1517128603869335e-8,9.138545565664259e-5,-5.794575433039127e-6,-1.1524189430321015e-8,9.151591271894805e-5,-5.66334449111308e-6,-1.1530742462923101e-8,9.158811085003475e-5,-5.568946066028995e-6,-1.1535410442970295e-8,9.162072310193748e-5,-5.537335450390624e-6,-1.1536995250412474e-8,9.164182458652515e-5,-5.58694690455087e-6,-1.1534711584048976e-8,9.168620213239225e-5,-5.723696108466005e-6,-1.152841879943091e-8,9.178992959661302e-5,-5.936777568263604e-6,-1.1518779345972147e-8,9.198249027190544e-5,-6.197337314678204e-6,-1.1507263760530225e-8,9.227820821065515e-5,-6.461935833751877e-6,-1.1495944136778205e-8,9.266993147833276e-5,-6.6812950165578724e-6,-1.1487076652143873e-8,9.31278874804674e-5,-6.8125918600802576e-6,-1.1482550916430714e-8,9.360510332344588e-5,-6.831677883244499e-6,-1.1483350519634967e-8,9.404841563306238e-5,-6.741163582188049e-6,-1.1489195433374426e-8,9.441208477567966e-5,-6.57151688468949e-6,-1.1498505989231926e-8,9.467017588287623e-5,-6.374429642810231e-6,-1.1508741618074349e-8,9.482411049793587e-5,-6.20983930092064e-6,-1.1517053215341923e-8,9.490280063124226e-5,-6.12986333255191e-6,-1.1521069363394867e-8,9.49546446025167e-5,-6.164351503798526e-6,-1.1519561592846616e-8,9.503343971679581e-5,-6.312991752990002e-6,-1.1512751366586703e-8,9.518296893644879e-5,-6.546957614728857e-6,-1.1502154648514587e-8,9.54258618892581e-5,-6.819249442704191e-6,-1.1490053068776307e-8,9.576033063758811e-5,-7.079181183195936e-6,-1.147882172959562e-8,9.616458460450145e-5,-7.285251177458946e-6,-1.1470361003639736e-8,9.660557779129375e-5,-7.412533789784719e-6,-1.1465779950685564e-8,9.70480253349657e-5,-7.454061673847203e-6,-1.1465342600263835e-8,9.746107955264904e-5,-7.418094434670623e-6,-1.1468592015480105e-8,9.782204348641294e-5,-7.323724614127018e-6,-1.1474549309030842e-8,9.811778004559563e-5,-7.196576837891347e-6,-1.1481914889362466e-8,9.834488254743438e-5,-7.065336659585935e-6,-1.1489242896633806e-8,9.85094970832235e-5,-6.958985648334306e-6,-1.1495095179541215e-8,9.862717385640469e-5,-6.90413645241066e-6,-1.1498196338733799e-8,9.8722513616579e-5,-6.921815594705209e-6,-1.1497607920369037e-8,9.882784972662761e-5,-7.023345607949021e-6,-1.1492923262731212e-8,9.897986411696639e-5,-7.205665995436498e-6,-1.148446098537155e-8,9.921318771121227e-5,-7.447586546246423e-6,-1.1473395307025696e-8,9.955120060763667e-5,-7.709619295232465e-6,-1.146172404791077e-8,9.999642762624879e-5,-7.940035443749168e-6,-1.1451968869426325e-8,1.0052494732063333e-4,-8.087647613726074e-6,-1.1446579632065744e-8,1.0108913471724907e-4,-8.117933472199266e-6,-1.1447169892722494e-8,1.016297505105532e-4,-8.025879558080473e-6,-1.1453875399227287e-8,1.0209339869072522e-4,-7.839290063002508e-6,-1.1465163461608666e-8,1.0244827762320929e-4,-7.610760831100816e-6,-1.1478236898852096e-8,1.0269227243374284e-4,-7.4019405703705335e-6,-1.1489879553959839e-8,1.0285149371859283e-4,-7.266368505272329e-6,-1.1497391887392736e-8,1.0297118136782965e-4,-7.236336161787715e-6,-1.1499280042755185e-8,1.0310270675950262e-4,-7.316726316035047e-6,-1.1495523318503002e-8,1.0329056362595021e-4,-7.486349598341804e-6,-1.148742159707798e-8,1.0356255453322497e-4,-7.705430672579288e-6,-1.1477144225777614e-8,1.0392519544575366e-4,-7.926623660176716e-6,-1.1467147125266295e-8,1.0436481553339658e-4,-8.106347722194308e-6,-1.1459615835618466e-8,1.048532139215313e-4,-8.213492770649762e-6,-1.1456056721422704e-8,1.0535556460250918e-4,-8.23373787288498e-6,-1.1457100913129077e-8,1.0583805546501133e-4,-8.169439622731186e-6,-1.1462518463608636e-8,1.0627352735391126e-4,-8.036400609196678e-6,-1.1471385560392026e-8,1.066445607363988e-4,-7.859266130393587e-6,-1.1482325768957206e-8,1.0694441306334356e-4,-7.666977342055716e-6,-1.1493758257334187e-8,1.0717666268625118e-4,-7.489017281889044e-6,-1.1504111986789331e-8,1.0735435490295485e-4,-7.35244966639261e-6,-1.1511999323604564e-8,1.0749903983642938e-4,-7.2792806829164845e-6,-1.1516363131548234e-8,1.0763957831135115e-4,-7.283580274524651e-6,-1.151661702847303e-8,1.0781007680501017e-4,-7.368012685883945e-6,-1.1512793302970118e-8,1.0804590054700001e-4,-7.520061810504988e-6,-1.1505692043057436e-8,1.0837680611466255e-4,-7.709425069854278e-6,-1.1496977420176755e-8,1.0881740161785823e-4,-7.889347522041987e-6,-1.1489103221812277e-8,1.0935759791410143e-4,-8.004876957400208e-6,-1.1484917776821892e-8,1.099584343313986e-4,-8.008601428695032e-6,-1.1486882532745956e-8,1.1055881062444225e-4,-7.879155597116695e-6,-1.1496092004950944e-8,1.1109371258594231e-4,-7.633039843956237e-6,-1.1511581608136923E-08,1.1151663459051103e-4,-7.321605202687162e-6,-1.1530431309502565e-8,1.1181492903404441e-4,-7.013454241810893e-6,-1.1548741122352925e-8,1.1201106022014476e-4,-6.771340174468865e-6,-1.1562985724005811e-8,1.1215140197415839e-4,-6.634405209780007e-6,-1.1571068149846324e-8,1.1228984212495073e-4,-6.611278102413541e-6,-1.1572697123814852e-8,1.1247315925664164e-4,-6.6831267112462406e-6,-1.1569144942454731e-8,1.127316993096942e-4,-6.812598750203812e-6,-1.156266778319374e-8,1.1307579932787652e-4,-6.954602663343077e-6,-1.1555859496188551e-8,1.1349688400417341e-4,-7.066217820959545e-6,-1.1551101049908461e-8,1.139717903089487e-4,-7.114299397794903e-6,-1.1550167056351804e-8,1.1446891416054345e-4,-7.080077937874377e-6,-1.1554002562827165e-8,1.149548174283551e-4,-6.960537575809596e-6,-1.1562667346861427e-8,1.1540007923220339e-4,-6.766933444370123e-6,-1.1575426285469924e-8,1.1578354861211906e-4,-6.521295786051894e-6,-1.1590947546989276e-8,1.1609463410885247e-4,-6.2519478086589645e-6,-1.160756007562344e-8,1.1633376296363593e-4,-5.989012039941205e-6,-1.1623518348194946e-8,1.1651156393922294e-4,-5.760573051355079e-6,-1.1637234212047214e-8,1.1664740182339614e-4,-5.589622358594828e-6,-1.1647459659802337e-8,1.1676759334021895e-4,-5.4915067272458905e-6,-1.1653428976732367e-8,1.1690326783015823e-4,-5.471531648050538e-6,-1.1654974611229112e-8,1.1708746557034123e-4,-5.5225030012895636e-6,-1.1652632718742514e-8,1.1735068033667883e-4,-5.622479874781477e-6,-1.1647735276380047e-8,1.1771412944112854e-4,-5.734062550996382e-6,-1.1642435438662262e-8,1.1818113725851937e-4,-5.8076621481172495e-6,-1.163954187668793e-8,1.1872926880585935e-4,-5.791344442245663e-6,-1.1642004245374285e-8,1.1930855430309953e-4,-5.647553044674574e-6,-1.1651984086518556e-8,1.1985155215788543e-4,-5.371443175151925e-6,-1.1669760410394222e-8,1.2029547121095116e-4,-4.99995084485974e-6,-1.1693115291372944e-8,1.2060678781026997e-4,-4.6024408688642385e-6,-1.1717833613867049e-8,1.2079400904598451e-4,-4.255199093046226e-6,-1.173926368756903e-8,1.2090126966665237e-4,-4.0137842781003e-6,-1.1754062382778059e-8,1.2098843584166365e-4,-3.897678566972292e-6,-1.176115704922468e-8,1.2111008984554611e-4,-3.891400665164609e-6,-1.1761637208694449e-8,1.213022496940009e-4,-3.95630760713687e-6,-1.1757971241563372e-8,1.2157839399120963e-4,-4.044896229076136e-6,-1.1753097167220337e-8,1.2193195516922581e-4,-4.112420305157807e-6,-1.1749718015863004e-8,1.2234182152848596e-4,-4.124267718560327e-6,-1.174987984666976e-8,1.227785275255919e-4,-4.059624660286843e-6,-1.1754780294877045e-8,1.2321007408265877e-4,-3.9124489345179326e-6,-1.1764728817057517e-8,1.2360698042256985e-4,-3.6904598768444323e-6,-1.1779212189448352e-8,1.2394631226203136e-4,-3.4126109266878824e-6,-1.1797041115608418e-8,1.242144823774108e-4,-3.1055077065965403e-6,-1.1816559520484416e-8,1.2440867826661164e-4,-2.799226073876711e-6,-1.1835897138338729e-8,1.2453685337986063e-4,-2.523031477587932e-6,-1.1853238148010125e-8,1.2461646512564885e-4,-2.301547896694e-6,-1.186706784611472e-8,1.2467235994619418e-4,-2.1516861724259745e-6,-1.1876371614580685e-8,1.2473410454800834e-4,-2.0803083645591164e-6,-1.1880779589050701e-8,1.2483283115915695e-4,-2.0825349597226646e-6,-1.1880660082478308e-8,1.2499748069359724e-4,-2.14069314709482e-6,-1.1877165836353078e-8,1.2525010295091812e-4,-2.2241823656063393e-6,-1.1872226457607199e-8,1.2559995192754653e-4,-2.2912602137460035e-6,-1.1868437590207958e-8,1.2603705811992328e-4,-2.2945068883105327e-6,-1.1868742828901586e-8,1.2652772420829495e-4,-2.191539426597471e-6,-1.1875794007561012e-8,1.2701630641300356e-4,-1.9604423994929207e-6,-1.1890987874401511e-8,1.2743771444703272e-4,-1.6147035257241735e-6,-1.1913481241468902e-8,1.2774003479321577e-4,-1.2075860053489198e-6,-1.1939854087612531e-8,1.2790733523272295e-4,-8.17705683285339e-7,-1.1965019553764724e-8,1.279679628288094e-4,-5.194673008425952e-7,-1.1984174542305361e-8,1.279816584662349e-4,-3.5470155045429583e-7,-1.1994671485721905e-8,1.280138942373341e-4,-3.2155917529888203e-7,-1.1996712018024326e-8,1.2811314916667707e-4,-3.832848611376374e-7,-1.1992721904466058e-8,1.2830082617175774e-4,-4.869902782138533e-7,-1.198611016092719e-8,1.2857305116365837e-4,-5.810461096132203e-7,-1.1980164163535222E-08,1.289084172136336e-4,-6.257202090277428e-7,-1.197740043466469e-8,1.2927653296285668e-4,-5.972525154990381e-7,-1.1979329944634138e-8,1.2964491995966202e-4,-4.877474608997493e-7,-1.1986472365228349e-8,1.2998387075651414e-4,-3.031311612369654e-7,-1.1998477370081351e-8,1.3026979244258862e-4,-6.038288953220458e-8,-1.2014282732417834e-8,1.3048752957989842e-4,2.1562191863560383e-7,-1.2032296857404085e-8,1.3063183983413705e-4,4.956069602951913e-7,-1.2050612633462722e-8,1.3070798712429174e-4,7.49696777087375e-7,-1.2067254493324593e-8,1.3073127127371782e-4,9.513984761652111e-7,-1.2080450782354818e-8,1.3072533232997706e-4,1.0813761032640532e-6,-1.2088898078971734e-8,1.3071932425519906e-4,1.1305045965556356e-6,-1.2091976791290884e-8,1.3074424349902703e-4,1.1018477731859764e-6,-1.2089887050399828e-8,1.3082870101893535e-4,1.0113362985932872e-6,-1.2083690937629776e-8,1.3099441618179766e-4,8.869501908669666e-7,-1.2075251931326807e-8,1.3125168068481923e-4,7.662116754938402e-7,-1.2067066918911372e-8,1.3159510738595574e-4,6.915586905267705e-7,-1.2061965515433264e-8,1.3200056820097142e-4,7.028841658829567e-7,-1.2062624571151364e-8,1.3242528918228636e-4,8.270198550287169e-7,-1.2070869118686841e-8,1.3281385380364976e-4,1.0657937989025924e-6,-1.2086852795495238e-8,1.3311208615874337e-4,1.3873940278361398e-6,-1.2108442324416934e-8,1.3328674475046086e-4,1.728378788589479e-6,-1.2131335420364398e-8,1.333423026531807e-4,2.011359960326922e-6,-1.2150284217646462e-8,1.333230859574093e-4,2.173641367897251e-6,-1.2161076558038903e-8,1.3329628509418603e-4,2.1916886718834704e-6,-1.2162183678561086e-8,1.3332488742110422e-4,2.0869799011873835e-6,-1.2155091872515184e-8,1.3344631607287334e-4,1.9118834458728775e-6,-1.214330168860428e-8,1.3366614959370036e-4,1.7270017762180142e-6,-1.213081977253317e-8,1.339647660819936e-4,1.5827822630531564e-6,-1.2120978054806648e-8,1.3430900171919165e-4,1.5107505188582636e-6,-1.2115885232530696e-8,1.346625507586368e-4,1.5227555156633589e-6,-1.2116379839448163e-8,1.3499278908367805e-4,1.6143357752029857e-6,-1.2122232655650623e-8,1.352743630890875e-4,1.7691319425712106e-6,-1.2132411706736463e-8,1.3549082147805045e-4,1.9628976716705375e-6,-1.214532559179744e-8,1.3563536205606977e-4,2.1669414090184472e-6,-1.2159041601093816e-8,1.3571114539193986e-4,2.3513531864422336e-6,-1.2171504657912729e-8,1.3573115122892719e-4,2.488365757099318e-6,-1.218077928907646e-8,1.3571726302195615e-4,2.555989521491244e-6,-1.2185316078541546e-8,1.3569814446294577e-4,2.5416602671032738e-6,-1.2184217684665625e-8,1.3570568585111713e-4,2.4452206623935392e-6,-1.2177449976565543e-8,1.3577024230789847e-4,2.280427964073108e-6,-1.216594442676682e-8,1.3591527737192273e-4,2.0743135607314645e-6,-1.2151550454018783e-8,1.361522991152803e-4,1.8640121265254014e-6,-1.213681987513195e-8,1.3647708727637718e-4,1.6911483786144465e-6,-1.2124630980449703e-8,1.3686810998498884e-4,1.5943000966245994e-6,-1.211767957644585e-8,1.3728794824521178e-4,1.6002951590033876e-6,-1.2117875538135754e-8,1.376885995265603e-4,1.715563961241601e-6,-1.2125719871977474e-8,1.380212492054774e-4,1.9198116421548985e-6,-1.2139827416802713e-8,1.3824979653251647e-4,2.16545754172393e-6,-1.2156862702966804e-8,1.3836476748777283e-4,2.3863798766054845e-6,-1.2172165361997345e-8,1.3839118089512586e-4,2.516681597723158e-6,-1.2181109204786456e-8,1.383836958661086e-4,2.5139173425388923e-6,-1.2180756018019766e-8,1.3840809682379775e-4,2.3754960365028225e-6,-1.2170971847677191e-8,1.3851731397930713e-4,2.1385549249810985e-6,-1.2154358737266609e-8,1.387345180742526e-4,1.8635150257748393e-6,-1.2135089041809021e-8,0.00013905061657867654,1.6115027181214983e-6,-1.21173713319074e-8,1.3943376606727773e-4,1.4271981388203693e-6,-1.2104305360794658e-8,1.3984300364040437e-4,1.3321511005655048e-6,-1.2097427842395805e-8,1.4023941764179271e-4,1.3266107575433846e-6,-1.2096814698533307e-8,1.4059252722173118e-4,1.3952876797859035e-6,-1.2101447432625885e-8,1.4088264636512158e-4,1.5134604515907064e-6,-1.2109616882522158e-8,1.4110100645417162e-4,1.651840139911393e-6,-1.211925900245617e-8,1.4124909369002032e-4,1.780117071596497e-6,-1.212821380203447e-8,1.41337902381737e-4,1.8698047521882043e-6,-1.2134441476175163e-8,1.413871243968482e-4,1.897057213198281e-6,-1.2136236886680415e-8,1.4142383018431504e-4,1.845841427761066e-6,-1.2132461012287831e-8,1.4147997719204125e-4,1.7113175489430788e-6,-1.2122777537746821e-8,1.4158823504138685e-4,1.502646517645388e-6,-1.2107840476713205e-8,1.4177619737628733e-4,1.2439767012537168e-6,-1.2089354094720186e-8,1.420599003828967e-4,9.723315462248096e-7,-1.206992596215161e-8,1.4243837480090518e-4,7.317359454874271e-7,-1.205266945550483e-8,1.428912639706557e-4,5.641719353741576e-7,-1.2040586686537376e-8,1.4338097885540922e-4,4.993306811954009e-7,-1.2035847099509482e-8,1.4385960277296563e-4,5.458783176763343e-7,-1.2039139663143369e-8,1.4427940471458366e-4,6.868122641353136e-7,-1.2049291370737595e-8,1.4460478846783334e-4,8.807411239238364e-7,-1.2063317321420302e-8,1.4482281559751307e-4,1.069839105541091e-6,-1.2076991054963683e-8,0.00014494904837242869,1.1937309248725323e-6,-1.2085887289049307e-8,1.4502568900064648e-4,1.2064426101944527e-6,-1.208665562177113e-8,1.4511070047506638e-4,1.0911379333922037e-6,-1.2078100163221958e-8,1.4526028585175462e-4,8.663198283372468e-7,-1.2061600256805915e-8,1.4551122674497707e-4,5.797058648325919e-7,-1.204063541031233e-8,1.45870714182893e-4,2.919007977922922e-7,-1.2019605889673682e-8,1.4631756661427476e-4,5.7383281304037876e-8,-1.2002481688680475e-8,1.4681257082234934e-4,-8.908235910099019e-8,-1.199182771411262e-8,1.4731178048653533e-4,-1.3681974382092278e-7,-1.1988462719314775e-8,1.4777718123388823e-4,-9.589928020150776e-8,-1.1991666707489123e-8,1.4818241807458256e-4,9.827970495226143e-9,-1.1999669866292774e-8,1.4851424057603252e-4,1.4975826284681487e-7,-1.2010174857616424e-8,1.4877150780700368e-4,2.9190903564939884e-7,-1.2020776035974408e-8,1.4896338718739874e-4,4.064988238931833e-7,-1.2029249027716422e-8,1.491076446423247e-4,4.6841038637613003e-7,-1.2033745868534184e-8,1.4922916257107874e-4,4.5938546572257956e-7,-1.2032953779941988e-8,1.493582247095228e-4,3.705242197180493e-7,-1.2026262139108474e-8,1.4952777954767635e-4,2.051005400277564e-7,-1.2013946805018194e-8,1.4976894050346446e-4,-1.904479417246828e-8,-1.19973299130609e-8,1.5010454947427974e-4,-2.6906541765304796e-7,-1.1978814248321542e-8,1.5054183504320976e-4,-5.005400438808663e-7,-1.1961656886072548e-8,1.510667193509588e-4,-6.659267765992611e-7,-1.1949384554955782e-8,1.5164312623254563e-4,-7.269820831206918e-7,-1.1944897119523432e-8,1.5221953156980696e-4,-6.673181911368249e-7,-1.1949511382214759e-8,1.5274192731700445e-4,-4.998737686083151e-7,-1.1962335916114308e-8,1.5316902981055573e-4,-2.655106490847173e-7,-1.198030645635063e-8,1.5348421088217352e-4,-2.266891378647792e-8,-1.1998944827432675e-8,1.537000877768807e-4,1.6834438575237464e-7,-1.2013585861232607e-8,1.538547110431581e-4,2.613132906223005e-7,-1.2020649305678164e-8,1.5400096519828458e-4,2.3581112219275996e-7,-1.2018566303697278e-8,1.5419235863208593e-4,1.0173672189554832e-7,-1.2008120314198619e-8,1.5446908544374386e-4,-1.043344103221339e-7,-1.1992147545698048e-8,1.548482390991489e-4,-3.2985719788034745e-7,-1.1974709621771796e-8,1.5532098094650596e-4,-5.207662508907146e-7,-1.1959996690102956e-8,1.5585716932915963e-4,-6.350241871756243e-7,-1.1951293605787887e-8,1.5641522266013897e-4,-6.511187991959759e-7,-1.1950307300835039e-8,1.569532769257661e-4,-5.697016549164902e-7,-1.1957005001839564e-8,1.5743798528095797e-4,-4.09469379855435e-7,-1.1969906863521253e-8,1.5784917981561064e-4,-2.0015710169451744e-7,-1.1986632887038163e-8,1.5818066995231428e-4,2.4528128874972442e-8,-1.2004482272335572e-8,1.584385964221662e-4,2.3238212408654543e-7,-1.2020894960770384e-8,1.5863886107822444e-4,3.9624199560292434e-7,-1.2033748244121223e-8,1.588046247824748e-4,4.961257588820515e-7,-1.2041519855910776e-8,1.5896414577085214e-4,5.208075434900433e-7,-1.2043387212766305e-8,1.5914861628490783e-4,4.6946391491526275e-7,-1.2039325589190074e-8,1.5938926955830503e-4,3.53541008361074e-7,-1.2030232908600866e-8,1.5971294009466412e-4,1.982741610365036e-7,-1.2018050074089633e-8,1.601357000258253e-4,4.2346553631336995e-8,-1.2005764507559371e-8,1.6065547610377416e-4,-6.653262914643824e-8,-1.199711354071502e-8,1.6124655500583345e-4,-8.178371801242496e-8,-1.1995829366236498e-8,1.618604147678731e-4,2.7237558855628032e-8,-1.200446695222325e-8,1.624361983654284e-4,2.6113543526894443e-7,-1.2023214939678597e-8,1.6291924082183584e-4,5.850389636777833e-7,-1.2049358081100115e-8,1.6328002909722807e-4,9.37029053897171e-7,-1.2077889657121621e-8,1.6352419934365228e-4,1.2479123374621913e-6,-1.2103126439366304e-8,1.6368904604779273e-4,1.4631281062483648e-6,-1.2120552485357369e-8,1.6382956183236765e-4,1.557395384432055e-6,-1.2128060940280816e-8,1.6400122926582002e-4,1.5381144862877748e-6,-1.2126239058948575e-8,1.6424588726093894e-4,1.439208355081074e-6,-1.2117853915445577e-8,1.6458370748174056e-4,1.3096328102448778e-6,-1.2106913755361764e-8,1.6501154402339606e-4,1.200644338827852e-6,-1.2097641160415495e-8,1.6550648589063686e-4,1.1547586852730628e-6,-1.2093577694547275e-8,1.6603290776267415e-4,1.198176070928625e-6,-1.209694831318382e-8,1.665511035023388e-4,1.3375614745420673e-6,-1.2108362039271342e-8,1.6702550418416318e-4,1.5612138983333382e-6,-1.2126873437650308e-8,1.674307780932752e-4,1.8436692523999273e-6,-1.2150349328123835e-8,1.677549195800197e-4,2.152050182706575e-6,-1.2176009110305286e-8,1.6799940801179606e-4,2.4524165413076667e-6,-1.2200981766056503e-8,1.6817724583540448e-4,2.7148658232038214e-6,-1.2222754118217347e-8,1.683099873280913e-4,2.9168866968960664e-6,-1.2239454785978735e-8,1.6842467146592558e-4,3.0452180407235236e-6,-1.224999322944638e-8,1.6855102695086848e-4,3.0968539557096263e-6,-1.2254119042353992e-8,1.6871880126855085e-4,3.079744230574199e-6,-1.2252464324778996e-8,1.6895472067160068e-4,3.0133940896606534e-6,-1.2246598903420829e-8,1.6927840464195295e-4,2.9289893043908684e-6,-1.2239070910506032e-8,1.6969685867088022e-4,2.8677904600524987e-6,-1.2233319274918822e-8,1.7019831718506845e-4,2.875824828445984e-6,-1.2233272151029017e-8,1.7074810284391787e-4,2.993272269193482e-6,-1.224246480019927e-8,1.7129098425295404e-4,3.2394101336393448e-6,-1.2262719249205929e-8,1.7176398102373194e-4,3.5987654038797006e-6,-1.2292867630372567e-8,1.7211809981800891e-4,4.018086806079489e-6,-1.2328398800877828e-8,1.723391427347796e-4,4.420818917734477e-6,-1.2362681188303285e-8,1.7245473153053103e-4,4.734662467285292e-6,-1.2389396409868513e-8,1.7252252726735316e-4,4.917578549027333e-6,-1.2404843785782865e-8,1.726071540897258e-4,4.968749604148368e-6,-1.2408893192054333e-8,1.727589046978858e-4,4.9221724964740185e-6,-1.2404411962237101e-8,1.7300260344177033e-4,4.83048076677902e-6,-1.2395876284086118e-8,1.7333699122422784e-4,4.748210739532242e-6,-1.2387966354953343e-8,1.7374060169450008e-4,4.719717242328655e-6,-1.2384556320964524e-8,1.7417998643729247e-4,4.77276442662093e-6,-1.2388155529251713e-8,1.7461775716833916e-4,4.916710446013261e-6,-1.2399710045232228e-8,1.7501937203030822e-4,5.1438468128633355e-6,-1.24186647572412e-8,1.7535828951289732e-4,5.432860035887848e-6,-1.2443225854658522e-8,1.756192629618798e-4,5.753664444472852e-6,-1.247077258016822e-8,1.7579965373443565e-4,6.07283129609336e-6,-1.249834752183416e-8,1.7590884946030766e-4,6.358829228718526e-6,-1.2523139875377372e-8,1.759661130968674e-4,6.586381943570775e-6,-1.2542883039875933e-8,1.759974500115724e-4,6.739459298134962e-6,-1.2556116611078232e-8,1.760321637278397e-4,6.812845618154416e-6,-1.2562313354106072e-8,1.7609950601134763e-4,6.812603660833107e-6,-1.2561914546371991e-8,1.7622548831381987e-4,6.755770295736606e-6,-1.2556315384687489e-8,1.7642970412317874e-4,6.669448359319251e-6,-1.2547819558221092e-8,1.7672181959903853e-4,6.589129298634931e-6,-1.2539538164845853e-8,1.7709754531837021e-4,6.555409184978373e-6,-1.253513882005936e-8,1.7753484841258758e-4,6.6077367992058346e-6,-1.2538298544744623e-8,1.7799261074736457e-4,6.774298835042637e-6,-1.2551762208519981e-8,1.7841520147040621e-4,7.059131678797954e-6,-1.2576102085454612e-8,1.7874610453487877e-4,7.431432411420299e-6,-1.2608660039097732e-8,1.7894917443968755e-4,7.825953175386766e-6,-1.264353962001558e-8,1.7902774380033063e-4,8.161207083206408e-6,-1.2673296174765145e-8,1.790278108183074e-4,8.37057801926549e-6,-1.2691829535203863e-8,1.7902000252517539e-4,8.429111940731165e-6,-1.2696822098010562e-8,1.7907052731275117e-4,8.359865779353108e-6,-1.2690259514578959e-8,1.792184376056174e-4,8.218710920752939e-6,-1.2677033409507345e-8,1.7946899122588982e-4,8.070217272528202e-6,-1.2662824877992331e-8,1.798005516314884e-4,7.968098174834111e-6,-1.2652431102927129e-8,1.8017678902342154e-4,7.945639373964074e-6,-1.2648941656457344e-8,1.8055783018827178e-4,8.014489469180937e-6,-1.2653594995131369e-8,1.809079743025977e-4,8.167991049630246e-6,-1.2666002492302427e-8,1.8120015594670137e-4,8.386055770599257e-6,-1.2684515636010646e-8,1.81418169137406e-4,8.640136272423779e-6,-1.2706635648062213e-8,1.8155745362714864e-4,8.897929471115659e-6,-1.2729437938407207e-8,1.816247890930127e-4,9.127778918254038e-6,-1.2749994232411722e-8,1.8163698371062952e-4,9.302709168045539e-6,-1.2765766433492419e-8,1.8161856182727902e-4,9.403888438419948e-6,-1.2774938041748913e-8,1.815985642893323e-4,9.423138551089404e-6,-1.2776645313126941e-8,1.8160681506560852e-4,9.36415692920561e-6,-1.2771087603012172e-8,1.8167007529985502e-4,9.242389932513445e-6,-1.2759527269267482e-8,1.8180839374719023e-4,9.083630182385395e-6,-1.2744194260900506e-8,1.8203189191582484e-4,8.921407254932055e-6,-1.272809684680252e-8,1.8233811686921964e-4,8.793234923543979e-6,-1.271472568547752e-8,1.8271007573164471e-4,8.735513832696627e-6,-1.2707603433132443e-8,1.831156226205783e-4,8.776587215035303e-6,-1.2709611967731912e-8,1.835098044135818e-4,8.927979072561361e-6,-1.2722097762312471e-8,1.8384221630675696e-4,9.175500192615347e-6,-1.27439367278731e-8,1.840705475552472e-4,9.474371020128938e-6,-1.2771002906062082e-8,1.841780628060236e-4,9.754616948466088e-6,-1.279667951127827e-8,1.8418683651227492e-4,9.940934290960093e-6,-1.281380356682737e-8,1.8415563603335129e-4,9.98187460304554e-6,-1.281747050358581e-8,1.8415861263877017e-4,9.872544364405676e-6,-1.2807136409084753e-8,1.842552921475183e-4,9.65575714304891e-6,-1.278665574601449e-8,1.8446960989311107e-4,9.401323160175794e-6,-1.2762350921109002e-8,1.847878917819339e-4,9.177921705907351e-6,-1.274048999348862e-8,1.851716145817177e-4,9.033077144764868e-6,-1.2725517880425859e-8,1.8557404333119885e-4,8.98674862545095e-6,-1.2719465951244568e-8,1.8595285565285299e-4,9.03489153155634e-6,-1.2722206457539776e-8,1.8627673471227903e-4,9.156961441484826e-6,-1.2732052732514901e-8,1.8652737698281774e-4,9.323291635298407e-6,-1.2746379558568107e-8,1.8669908398996258e-4,9.500851281252383e-6,-1.276214259667023e-8,1.867974540649122e-4,9.657494220093313e-6,-1.2776296198795173e-8,1.868377674238962e-4,9.765290802188679e-6,-1.2786140679959678e-8,1.8684306967336814e-4,9.803397871508996e-6,-1.2789619363565743e-8,1.868417147083351e-4,9.760610094037025e-6,-1.2785567727151342e-8,1.8686412458466885e-4,9.637324414561794e-6,-1.2773894189412115e-8,1.8693880886411663e-4,9.44635537749392e-6,-1.2755655110877828e-8,1.8708806034181723e-4,9.212124471751703e-6,-1.2732996276901077e-8,1.873239407935784e-4,8.968006164774606e-6,-1.2708946706398693e-8,1.8764524855502274e-4,8.751851247504868e-6,-1.2687053344743047e-8,1.8803613506589658e-4,8.600047003777075e-6,-1.267086308882513e-8,1.884668350213392e-4,8.540750156571121e-6,-1.266327943929974e-8,1.8889688401037388e-4,8.586957156317759e-6,-1.2665841049346619e-8,1.892813662336039e-4,8.7303677532984365E-06,-1.2678028004774141e-8,1.8958055151708885e-4,8.937957777496288e-6,-1.269682650981506e-8,1.8977205698003573e-4,9.154221964303619e-6,-1.2716894887330907e-8,1.8986226816951858e-4,9.312023948278568e-6,-1.2731645634466873e-8,1.8989097282145473e-4,9.3523306591095e-6,-1.2735235873700964e-8,1.899229344963519e-4,9.246977657328054e-6,-1.2724818924541804e-8,1.9002600500419477e-4,9.012639158824845e-6,-1.2701873808086355e-8,1.90245267253111e-4,8.705899735453676e-6,-1.267169944090641e-8,1.9058743747324758e-4,8.400731767561984e-6,-1.2641284800066107e-8,1.9102317062649488e-4,8.161375525659737e-6,-1.261678823134974e-8,1.915028135995743e-4,8.024638131175617e-6,-1.2601877107848063e-8]} \ No newline at end of file diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/0/0/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/0/0/0.jpg deleted file mode 100644 index 0cad6466..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/0/0/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/0/1/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/0/1/0.jpg deleted file mode 100644 index 7e63bd63..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/0/1/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/1/0/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/1/0/0.jpg deleted file mode 100644 index e65f1c78..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/1/0/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/1/0/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/1/0/1.jpg deleted file mode 100644 index 605f63f1..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/1/0/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/1/1/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/1/1/0.jpg deleted file mode 100644 index 319458e1..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/1/1/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/1/1/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/1/1/1.jpg deleted file mode 100644 index a6a3859d..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/1/1/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/1/2/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/1/2/0.jpg deleted file mode 100644 index 6913a2b0..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/1/2/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/1/2/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/1/2/1.jpg deleted file mode 100644 index df89ed22..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/1/2/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/1/3/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/1/3/0.jpg deleted file mode 100644 index 8f27415e..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/1/3/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/1/3/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/1/3/1.jpg deleted file mode 100644 index ce2b06ec..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/1/3/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/0.jpg deleted file mode 100644 index e3c03120..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/1.jpg deleted file mode 100644 index f3ec3215..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/2.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/2.jpg deleted file mode 100644 index b59816c0..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/2.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/3.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/3.jpg deleted file mode 100644 index 795f2122..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/0/3.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/0.jpg deleted file mode 100644 index 822b0651..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/1.jpg deleted file mode 100644 index 4dd18ea4..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/2.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/2.jpg deleted file mode 100644 index 4540c7c9..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/2.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/3.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/3.jpg deleted file mode 100644 index 32c6e5ae..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/1/3.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/0.jpg deleted file mode 100644 index 7c390948..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/1.jpg deleted file mode 100644 index 3e7abe71..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/2.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/2.jpg deleted file mode 100644 index 0e0f1e9b..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/2.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/3.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/3.jpg deleted file mode 100644 index 732c32f9..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/2/3.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/0.jpg deleted file mode 100644 index 576ec70e..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/1.jpg deleted file mode 100644 index 6347041f..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/2.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/2.jpg deleted file mode 100644 index 300aa580..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/2.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/3.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/3.jpg deleted file mode 100644 index cd70fcad..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/3/3.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/0.jpg deleted file mode 100644 index eabb83c7..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/1.jpg deleted file mode 100644 index 54e6b007..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/2.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/2.jpg deleted file mode 100644 index 311241c8..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/2.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/3.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/3.jpg deleted file mode 100644 index 5ba398c5..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/4/3.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/0.jpg deleted file mode 100644 index e03c0c07..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/1.jpg deleted file mode 100644 index 01a1caf8..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/2.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/2.jpg deleted file mode 100644 index 372e3ef5..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/2.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/3.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/3.jpg deleted file mode 100644 index fbcfa628..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/5/3.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/0.jpg deleted file mode 100644 index 334ab258..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/1.jpg deleted file mode 100644 index ebbc3a09..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/2.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/2.jpg deleted file mode 100644 index c3a8e97c..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/2.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/3.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/3.jpg deleted file mode 100644 index 8f730f36..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/6/3.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/0.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/0.jpg deleted file mode 100644 index 75235d6f..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/0.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/1.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/1.jpg deleted file mode 100644 index 036d682e..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/1.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/2.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/2.jpg deleted file mode 100644 index dfd21446..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/2.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/3.jpg b/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/3.jpg deleted file mode 100644 index 82c2a34a..00000000 Binary files a/libs/Cesium/Assets/Textures/NaturalEarthII/2/7/3.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml b/libs/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml deleted file mode 100644 index eb7b3f37..00000000 --- a/libs/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - NE2_HR_LC_SR_W_DR_recolored.tif - - EPSG:4326 - - - - - - - - - - \ No newline at end of file diff --git a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg b/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg deleted file mode 100644 index 2f298755..00000000 Binary files a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg b/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg deleted file mode 100644 index 80362287..00000000 Binary files a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg b/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg deleted file mode 100644 index 476ca2c1..00000000 Binary files a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg b/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg deleted file mode 100644 index 82bd54a7..00000000 Binary files a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg b/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg deleted file mode 100644 index 251e07cd..00000000 Binary files a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg b/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg deleted file mode 100644 index d6d86c2a..00000000 Binary files a/libs/Cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/airfield.png b/libs/Cesium/Assets/Textures/maki/airfield.png deleted file mode 100644 index b7746842..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/airfield.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/airport.png b/libs/Cesium/Assets/Textures/maki/airport.png deleted file mode 100644 index 44a8413a..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/airport.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/alcohol-shop.png b/libs/Cesium/Assets/Textures/maki/alcohol-shop.png deleted file mode 100644 index b75a5d9e..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/alcohol-shop.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/america-football.png b/libs/Cesium/Assets/Textures/maki/america-football.png deleted file mode 100644 index 5a2c6ba6..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/america-football.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/art-gallery.png b/libs/Cesium/Assets/Textures/maki/art-gallery.png deleted file mode 100644 index a663512e..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/art-gallery.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/bakery.png b/libs/Cesium/Assets/Textures/maki/bakery.png deleted file mode 100644 index 9735d5e5..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/bakery.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/bank.png b/libs/Cesium/Assets/Textures/maki/bank.png deleted file mode 100644 index a67cee06..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/bank.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/bar.png b/libs/Cesium/Assets/Textures/maki/bar.png deleted file mode 100644 index 8c2812fb..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/bar.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/baseball.png b/libs/Cesium/Assets/Textures/maki/baseball.png deleted file mode 100644 index 23f344bb..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/baseball.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/basketball.png b/libs/Cesium/Assets/Textures/maki/basketball.png deleted file mode 100644 index 7ed3bfce..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/basketball.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/beer.png b/libs/Cesium/Assets/Textures/maki/beer.png deleted file mode 100644 index a15cf991..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/beer.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/bicycle.png b/libs/Cesium/Assets/Textures/maki/bicycle.png deleted file mode 100644 index fb871be4..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/bicycle.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/building.png b/libs/Cesium/Assets/Textures/maki/building.png deleted file mode 100644 index 885f1128..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/building.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/bus.png b/libs/Cesium/Assets/Textures/maki/bus.png deleted file mode 100644 index 78305023..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/bus.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/cafe.png b/libs/Cesium/Assets/Textures/maki/cafe.png deleted file mode 100644 index 2050cba3..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/cafe.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/camera.png b/libs/Cesium/Assets/Textures/maki/camera.png deleted file mode 100644 index ec54e12a..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/camera.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/campsite.png b/libs/Cesium/Assets/Textures/maki/campsite.png deleted file mode 100644 index 36e0a92d..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/campsite.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/car.png b/libs/Cesium/Assets/Textures/maki/car.png deleted file mode 100644 index 2075afa5..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/car.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/cemetery.png b/libs/Cesium/Assets/Textures/maki/cemetery.png deleted file mode 100644 index df244fda..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/cemetery.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/cesium.png b/libs/Cesium/Assets/Textures/maki/cesium.png deleted file mode 100644 index ce2755de..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/cesium.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/chemist.png b/libs/Cesium/Assets/Textures/maki/chemist.png deleted file mode 100644 index eb1ea357..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/chemist.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/cinema.png b/libs/Cesium/Assets/Textures/maki/cinema.png deleted file mode 100644 index 56b69256..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/cinema.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/circle-stroked.png b/libs/Cesium/Assets/Textures/maki/circle-stroked.png deleted file mode 100644 index 88689e47..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/circle-stroked.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/circle.png b/libs/Cesium/Assets/Textures/maki/circle.png deleted file mode 100644 index fbbd5822..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/circle.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/city.png b/libs/Cesium/Assets/Textures/maki/city.png deleted file mode 100644 index 37d8fad8..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/city.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/clothing-store.png b/libs/Cesium/Assets/Textures/maki/clothing-store.png deleted file mode 100644 index ff5f8a2b..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/clothing-store.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/college.png b/libs/Cesium/Assets/Textures/maki/college.png deleted file mode 100644 index 10263870..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/college.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/commercial.png b/libs/Cesium/Assets/Textures/maki/commercial.png deleted file mode 100644 index fdf3b63c..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/commercial.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/cricket.png b/libs/Cesium/Assets/Textures/maki/cricket.png deleted file mode 100644 index 6642a3af..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/cricket.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/cross.png b/libs/Cesium/Assets/Textures/maki/cross.png deleted file mode 100644 index 8945b3b4..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/cross.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/dam.png b/libs/Cesium/Assets/Textures/maki/dam.png deleted file mode 100644 index aed88a88..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/dam.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/danger.png b/libs/Cesium/Assets/Textures/maki/danger.png deleted file mode 100644 index 9479572c..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/danger.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/disability.png b/libs/Cesium/Assets/Textures/maki/disability.png deleted file mode 100644 index 1cc35509..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/disability.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/dog-park.png b/libs/Cesium/Assets/Textures/maki/dog-park.png deleted file mode 100644 index 3483e35b..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/dog-park.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/embassy.png b/libs/Cesium/Assets/Textures/maki/embassy.png deleted file mode 100644 index 46b7e1e1..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/embassy.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/emergency-telephone.png b/libs/Cesium/Assets/Textures/maki/emergency-telephone.png deleted file mode 100644 index fac62396..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/emergency-telephone.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/entrance.png b/libs/Cesium/Assets/Textures/maki/entrance.png deleted file mode 100644 index b0ba8c5d..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/entrance.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/farm.png b/libs/Cesium/Assets/Textures/maki/farm.png deleted file mode 100644 index 7b03e825..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/farm.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/fast-food.png b/libs/Cesium/Assets/Textures/maki/fast-food.png deleted file mode 100644 index 9488c263..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/fast-food.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/ferry.png b/libs/Cesium/Assets/Textures/maki/ferry.png deleted file mode 100644 index 58c2f27a..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/ferry.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/fire-station.png b/libs/Cesium/Assets/Textures/maki/fire-station.png deleted file mode 100644 index 427512f1..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/fire-station.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/fuel.png b/libs/Cesium/Assets/Textures/maki/fuel.png deleted file mode 100644 index dc6059b9..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/fuel.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/garden.png b/libs/Cesium/Assets/Textures/maki/garden.png deleted file mode 100644 index 265edb8d..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/garden.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/gift.png b/libs/Cesium/Assets/Textures/maki/gift.png deleted file mode 100644 index 866263e1..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/gift.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/golf.png b/libs/Cesium/Assets/Textures/maki/golf.png deleted file mode 100644 index 2169d915..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/golf.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/grocery.png b/libs/Cesium/Assets/Textures/maki/grocery.png deleted file mode 100644 index 05b09d4a..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/grocery.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/hairdresser.png b/libs/Cesium/Assets/Textures/maki/hairdresser.png deleted file mode 100644 index 68fbe1e8..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/hairdresser.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/harbor.png b/libs/Cesium/Assets/Textures/maki/harbor.png deleted file mode 100644 index 2814f3cd..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/harbor.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/heart.png b/libs/Cesium/Assets/Textures/maki/heart.png deleted file mode 100644 index 82e98082..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/heart.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/heliport.png b/libs/Cesium/Assets/Textures/maki/heliport.png deleted file mode 100644 index 953828d9..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/heliport.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/hospital.png b/libs/Cesium/Assets/Textures/maki/hospital.png deleted file mode 100644 index faf294e8..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/hospital.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/ice-cream.png b/libs/Cesium/Assets/Textures/maki/ice-cream.png deleted file mode 100644 index 323c9649..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/ice-cream.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/industrial.png b/libs/Cesium/Assets/Textures/maki/industrial.png deleted file mode 100644 index 9b3b525d..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/industrial.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/land-use.png b/libs/Cesium/Assets/Textures/maki/land-use.png deleted file mode 100644 index f86b21bc..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/land-use.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/laundry.png b/libs/Cesium/Assets/Textures/maki/laundry.png deleted file mode 100644 index 53fd20de..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/laundry.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/library.png b/libs/Cesium/Assets/Textures/maki/library.png deleted file mode 100644 index 8564e84a..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/library.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/lighthouse.png b/libs/Cesium/Assets/Textures/maki/lighthouse.png deleted file mode 100644 index a78e21a5..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/lighthouse.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/lodging.png b/libs/Cesium/Assets/Textures/maki/lodging.png deleted file mode 100644 index 4e41ea6f..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/lodging.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/logging.png b/libs/Cesium/Assets/Textures/maki/logging.png deleted file mode 100644 index 4aeef0b7..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/logging.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/london-underground.png b/libs/Cesium/Assets/Textures/maki/london-underground.png deleted file mode 100644 index 94972f7d..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/london-underground.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/marker-stroked.png b/libs/Cesium/Assets/Textures/maki/marker-stroked.png deleted file mode 100644 index f00d1123..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/marker-stroked.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/marker.png b/libs/Cesium/Assets/Textures/maki/marker.png deleted file mode 100644 index 825eeca6..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/marker.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/minefield.png b/libs/Cesium/Assets/Textures/maki/minefield.png deleted file mode 100644 index 60e174ab..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/minefield.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/mobilephone.png b/libs/Cesium/Assets/Textures/maki/mobilephone.png deleted file mode 100644 index a40ef9c1..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/mobilephone.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/monument.png b/libs/Cesium/Assets/Textures/maki/monument.png deleted file mode 100644 index 5b8b7deb..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/monument.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/museum.png b/libs/Cesium/Assets/Textures/maki/museum.png deleted file mode 100644 index 23c17900..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/museum.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/music.png b/libs/Cesium/Assets/Textures/maki/music.png deleted file mode 100644 index dbef56f2..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/music.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/oil-well.png b/libs/Cesium/Assets/Textures/maki/oil-well.png deleted file mode 100644 index a421f5aa..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/oil-well.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/park.png b/libs/Cesium/Assets/Textures/maki/park.png deleted file mode 100644 index 741110e3..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/park.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/park2.png b/libs/Cesium/Assets/Textures/maki/park2.png deleted file mode 100644 index 5f60dcc4..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/park2.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/parking-garage.png b/libs/Cesium/Assets/Textures/maki/parking-garage.png deleted file mode 100644 index b91a811a..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/parking-garage.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/parking.png b/libs/Cesium/Assets/Textures/maki/parking.png deleted file mode 100644 index 6a843d93..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/parking.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/pharmacy.png b/libs/Cesium/Assets/Textures/maki/pharmacy.png deleted file mode 100644 index d82e4716..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/pharmacy.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/pitch.png b/libs/Cesium/Assets/Textures/maki/pitch.png deleted file mode 100644 index a8205e80..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/pitch.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/place-of-worship.png b/libs/Cesium/Assets/Textures/maki/place-of-worship.png deleted file mode 100644 index 29f7c317..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/place-of-worship.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/playground.png b/libs/Cesium/Assets/Textures/maki/playground.png deleted file mode 100644 index 5270d3c4..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/playground.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/police.png b/libs/Cesium/Assets/Textures/maki/police.png deleted file mode 100644 index 9787a05e..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/police.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/polling-place.png b/libs/Cesium/Assets/Textures/maki/polling-place.png deleted file mode 100644 index b2d02a90..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/polling-place.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/post.png b/libs/Cesium/Assets/Textures/maki/post.png deleted file mode 100644 index ee7aaca7..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/post.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/prison.png b/libs/Cesium/Assets/Textures/maki/prison.png deleted file mode 100644 index 355cba44..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/prison.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/rail-above.png b/libs/Cesium/Assets/Textures/maki/rail-above.png deleted file mode 100644 index e48d7eac..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/rail-above.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/rail-light.png b/libs/Cesium/Assets/Textures/maki/rail-light.png deleted file mode 100644 index 895565e0..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/rail-light.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/rail-metro.png b/libs/Cesium/Assets/Textures/maki/rail-metro.png deleted file mode 100644 index 86078c91..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/rail-metro.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/rail-underground.png b/libs/Cesium/Assets/Textures/maki/rail-underground.png deleted file mode 100644 index 42cfeb7e..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/rail-underground.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/rail.png b/libs/Cesium/Assets/Textures/maki/rail.png deleted file mode 100644 index 8af055dd..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/rail.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/religious-christian.png b/libs/Cesium/Assets/Textures/maki/religious-christian.png deleted file mode 100644 index 201bc81c..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/religious-christian.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/religious-jewish.png b/libs/Cesium/Assets/Textures/maki/religious-jewish.png deleted file mode 100644 index e3c75f6b..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/religious-jewish.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/religious-muslim.png b/libs/Cesium/Assets/Textures/maki/religious-muslim.png deleted file mode 100644 index 25cbf08a..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/religious-muslim.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/restaurant.png b/libs/Cesium/Assets/Textures/maki/restaurant.png deleted file mode 100644 index 816282a6..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/restaurant.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/roadblock.png b/libs/Cesium/Assets/Textures/maki/roadblock.png deleted file mode 100644 index 539f0ed8..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/roadblock.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/rocket.png b/libs/Cesium/Assets/Textures/maki/rocket.png deleted file mode 100644 index e6ed7187..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/rocket.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/school.png b/libs/Cesium/Assets/Textures/maki/school.png deleted file mode 100644 index fb20bf4e..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/school.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/scooter.png b/libs/Cesium/Assets/Textures/maki/scooter.png deleted file mode 100644 index 41f74164..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/scooter.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/shop.png b/libs/Cesium/Assets/Textures/maki/shop.png deleted file mode 100644 index 11a6b755..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/shop.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/skiing.png b/libs/Cesium/Assets/Textures/maki/skiing.png deleted file mode 100644 index 4fc11e2e..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/skiing.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/slaughterhouse.png b/libs/Cesium/Assets/Textures/maki/slaughterhouse.png deleted file mode 100644 index 9b094cab..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/slaughterhouse.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/soccer.png b/libs/Cesium/Assets/Textures/maki/soccer.png deleted file mode 100644 index 2385daf9..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/soccer.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/square-stroked.png b/libs/Cesium/Assets/Textures/maki/square-stroked.png deleted file mode 100644 index fce75b0d..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/square-stroked.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/square.png b/libs/Cesium/Assets/Textures/maki/square.png deleted file mode 100644 index babc9c53..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/square.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/star-stroked.png b/libs/Cesium/Assets/Textures/maki/star-stroked.png deleted file mode 100644 index 242e42e2..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/star-stroked.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/star.png b/libs/Cesium/Assets/Textures/maki/star.png deleted file mode 100644 index 447dd384..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/star.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/suitcase.png b/libs/Cesium/Assets/Textures/maki/suitcase.png deleted file mode 100644 index a94f562e..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/suitcase.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/swimming.png b/libs/Cesium/Assets/Textures/maki/swimming.png deleted file mode 100644 index b9fbdcc5..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/swimming.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/telephone.png b/libs/Cesium/Assets/Textures/maki/telephone.png deleted file mode 100644 index 6d57dc61..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/telephone.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/tennis.png b/libs/Cesium/Assets/Textures/maki/tennis.png deleted file mode 100644 index 6cb63205..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/tennis.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/theatre.png b/libs/Cesium/Assets/Textures/maki/theatre.png deleted file mode 100644 index 772c96e4..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/theatre.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/toilets.png b/libs/Cesium/Assets/Textures/maki/toilets.png deleted file mode 100644 index e87cf19c..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/toilets.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/town-hall.png b/libs/Cesium/Assets/Textures/maki/town-hall.png deleted file mode 100644 index 1af5c7ce..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/town-hall.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/town.png b/libs/Cesium/Assets/Textures/maki/town.png deleted file mode 100644 index 41661695..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/town.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/triangle-stroked.png b/libs/Cesium/Assets/Textures/maki/triangle-stroked.png deleted file mode 100644 index 131c7d94..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/triangle-stroked.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/triangle.png b/libs/Cesium/Assets/Textures/maki/triangle.png deleted file mode 100644 index d9c47f42..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/triangle.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/village.png b/libs/Cesium/Assets/Textures/maki/village.png deleted file mode 100644 index 2650af50..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/village.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/warehouse.png b/libs/Cesium/Assets/Textures/maki/warehouse.png deleted file mode 100644 index 910f1e4c..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/warehouse.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/waste-basket.png b/libs/Cesium/Assets/Textures/maki/waste-basket.png deleted file mode 100644 index a71f9e4d..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/waste-basket.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/water.png b/libs/Cesium/Assets/Textures/maki/water.png deleted file mode 100644 index 159a557d..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/water.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/wetland.png b/libs/Cesium/Assets/Textures/maki/wetland.png deleted file mode 100644 index 1e8dec83..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/wetland.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/maki/zoo.png b/libs/Cesium/Assets/Textures/maki/zoo.png deleted file mode 100644 index 48022999..00000000 Binary files a/libs/Cesium/Assets/Textures/maki/zoo.png and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/moonSmall.jpg b/libs/Cesium/Assets/Textures/moonSmall.jpg deleted file mode 100644 index 47f52522..00000000 Binary files a/libs/Cesium/Assets/Textures/moonSmall.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/pin.svg b/libs/Cesium/Assets/Textures/pin.svg deleted file mode 100644 index 7892c368..00000000 --- a/libs/Cesium/Assets/Textures/pin.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libs/Cesium/Assets/Textures/waterNormals.jpg b/libs/Cesium/Assets/Textures/waterNormals.jpg deleted file mode 100644 index eb1baa2d..00000000 Binary files a/libs/Cesium/Assets/Textures/waterNormals.jpg and /dev/null differ diff --git a/libs/Cesium/Assets/Textures/waterNormalsSmall.jpg b/libs/Cesium/Assets/Textures/waterNormalsSmall.jpg deleted file mode 100644 index 57b19d8f..00000000 Binary files a/libs/Cesium/Assets/Textures/waterNormalsSmall.jpg and /dev/null differ diff --git a/libs/Cesium/Cesium.js b/libs/Cesium/Cesium.js deleted file mode 100644 index 5e9cb384..00000000 --- a/libs/Cesium/Cesium.js +++ /dev/null @@ -1,467 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** - * almond 0.2.6 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/jrburke/almond for details - */ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -// Copyright 2012 Google Inc., Apache 2.0 license. - -/** -@license -tween.js - https://github.com/sole/tween.js - -Copyright (c) 2010-2012 Tween.js authors. - -Easing equations Copyright (c) 2001 Robert Penner http://robertpenner.com/easing/ - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -/** - @license - fontmetrics.js - https://github.com/Pomax/fontmetrics.js - - Copyright (C) 2011 by Mike "Pomax" Kamermans - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -**/ - -/** -@license -topojson - https://github.com/mbostock/topojson - -Copyright (c) 2012, Michael Bostock -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* The name Michael Bostock may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/*! - * Autolinker.js - * 0.17.1 - * - * Copyright(c) 2015 Gregory Jacobs - * MIT Licensed. http://www.opensource.org/licenses/mit-license.php - * - * https://github.com/gregjacobs/Autolinker.js - */ - -/** -@license - Copyright (c) 2013 Gildas Lormeau. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the distribution. - - 3. The names of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, - INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**/ - -/** - * @license - * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED - * *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS - * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT,IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA - * OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT, OR - * CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS - * OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY - * OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ - -/** - * @license - * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the project nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Modifications made by Analytical Graphics, Inc. - */ - -/** - * @license - * Knockout JavaScript library v3.2.0 - * (c) Steven Sanderson - http://knockoutjs.com/ - * License: MIT (http://www.opensource.org/licenses/mit-license.php) - */ - -/** - * @license - * Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5 - * Copyright (c) Steve Sanderson - * MIT license - */ - -!function(){var e,t,i;!function(r){function n(e,t){return C.call(e,t)}function o(e,t){var i,r,n,o,a,s,l,u,c,h,d=t&&t.split("/"),p=_.map,m=p&&p["*"]||{};if(e&&"."===e.charAt(0))if(t){for(d=d.slice(0,d.length-1),e=d.concat(e.split("/")),u=0;u0&&(e.splice(u-1,2),u-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((d||m)&&p){for(i=e.split("/"),u=i.length;u>0;u-=1){if(r=i.slice(0,u).join("/"),d)for(c=d.length;c>0;c-=1)if(n=p[d.slice(0,c).join("/")],n&&(n=n[r])){o=n,a=u;break}if(o)break;!s&&m&&m[r]&&(s=m[r],l=u)}!o&&s&&(o=s,a=l),o&&(i.splice(0,a,o),e=i.join("/"))}return e}function a(e,t){return function(){return p.apply(r,w.call(arguments,0).concat([e,t]))}}function s(e){return function(t){return o(t,e)}}function l(e){return function(t){v[e]=t}}function u(e){if(n(g,e)){var t=g[e];delete g[e],y[e]=!0,d.apply(r,t)}if(!n(v,e)&&!n(y,e))throw new Error("No "+e);return v[e]}function c(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function h(e){return function(){return _&&_.config&&_.config[e]||{}}}var d,p,m,f,v={},g={},_={},y={},C=Object.prototype.hasOwnProperty,w=[].slice;m=function(e,t){var i,r=c(e),n=r[0];return e=r[1],n&&(n=o(n,t),i=u(n)),n?e=i&&i.normalize?i.normalize(e,s(t)):o(e,t):(e=o(e,t),r=c(e),n=r[0],e=r[1],n&&(i=u(n))),{f:n?n+"!"+e:e,n:e,pr:n,p:i}},f={require:function(e){return a(e)},exports:function(e){var t=v[e];return"undefined"!=typeof t?t:v[e]={}},module:function(e){return{id:e,uri:"",exports:v[e],config:h(e)}}},d=function(e,t,i,o){var s,c,h,d,p,_,C=[];if(o=o||e,"function"==typeof i){for(t=!t.length&&i.length?["require","exports","module"]:t,p=0;p>>0,u=Math.max(0,Math.min(i,_)),h=[],c=_-u+1,d=[],p=a(),u)for(v=p.progress,f=function(e){d.push(e),--c||(m=f=g,p.reject(d))},m=function(e){h.push(e),--u||(m=f=g,p.resolve(h))},y=0;_>y;++y)y in t&&e(t[y],l,s,v);else p.resolve(h);return p.then(r,n,o)})}function u(e,t,i,r){function n(e){return t?t(e[0]):e[0]}return l(e,1,n,i,r)}function c(e,t,i,r){return v(1,arguments),d(e,_).then(t,i,r)}function h(){return d(arguments,_)}function d(t,i){return e(t,function(t){var r,n,o,s,l,u;if(o=n=t.length>>>0,r=[],u=a(),o)for(s=function(t,n){e(t,i).then(function(e){r[n]=e,--o||u.resolve(r)},u.reject)},l=0;n>l;l++)l in t?s(t[l],l):--o;else u.resolve(r);return u.promise})}function p(t,i){var r=C.call(arguments,1);return e(t,function(t){var n;return n=t.length,r[0]=function(t,r,o){return e(t,function(t){return e(r,function(e){return i(t,e,o,n)})})},y.apply(t,r)})}function m(t,i,r){var n=arguments.length>2;return e(t,function(e){return e=n?r:e,i.resolve(e),e},function(e){return i.reject(e),o(e)},i.progress)}function f(e,t){for(var i,r=0;i=e[r++];)i(t)}function v(e,t){for(var i,r=t.length;r>e;)if(i=t[--r],null!=i&&"function"!=typeof i)throw new Error("arg "+r+" must be a function")}function g(){}function _(e){return e}var y,C,w;return e.defer=a,e.resolve=t,e.reject=i,e.join=h,e.all=c,e.map=d,e.reduce=p,e.any=u,e.some=l,e.chain=m,e.isPromise=s,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(w,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return c(t,function(t){return e.apply(w,t)})})}},C=[].slice,y=[].reduce||function(e){var t,i,r,n,o;if(o=0,t=Object(this),n=t.length>>>0,i=arguments,i.length<=1)for(;;){if(o in t){r=t[o++];break}if(++o>=n)throw new TypeError}else r=i[1];for(;n>o;++o)o in t&&(r=e(r,t[o],o,t));return r},e})}("function"==typeof i&&i.amd?i:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),i("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),i("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),i=Object.defineProperties;return t&&e(i)||(i=function(e){return e}),i}),i("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(i){t=i.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),i("Core/Credit",["./defined","./defineProperties","./DeveloperError"],function(e,t){"use strict";var i=0,r={},n=function(t,n,o){var a=e(o),s=e(n),l=e(t);l||s||(t=o),this._text=t,this._imageUrl=n,this._link=o,this._hasLink=a,this._hasImage=s;var u,c=JSON.stringify([t,n,o]);e(r[c])?u=r[c]:(u=i++,r[c]=u),this._id=u};return t(n.prototype,{text:{get:function(){return this._text}},imageUrl:{get:function(){return this._imageUrl}},link:{get:function(){return this._link}},id:{get:function(){return this._id}}}),n.prototype.hasImage=function(){return this._hasImage},n.prototype.hasLink=function(){return this._hasLink},n.equals=function(t,i){return t===i||e(t)&&e(i)&&t._id===i._id},n.prototype.equals=function(e){return n.equals(this,e)},n}),i("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),i("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),i("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var i;for(this.mti==this.N+1&&this.init_genrand(5489),i=0;i>>1^t[1&e];for(;i>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),i("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var i={};i.EPSILON1=.1,i.EPSILON2=.01,i.EPSILON3=.001,i.EPSILON4=1e-4,i.EPSILON5=1e-5,i.EPSILON6=1e-6,i.EPSILON7=1e-7,i.EPSILON8=1e-8,i.EPSILON9=1e-9,i.EPSILON10=1e-10,i.EPSILON11=1e-11,i.EPSILON12=1e-12,i.EPSILON13=1e-13,i.EPSILON14=1e-14,i.EPSILON15=1e-15,i.EPSILON16=1e-16,i.EPSILON17=1e-17,i.EPSILON18=1e-18,i.EPSILON19=1e-19,i.EPSILON20=1e-20,i.GRAVITATIONALPARAMETER=3986004418e5,i.SOLAR_RADIUS=6955e5,i.LUNAR_RADIUS=1737400,i.SIXTY_FOUR_KILOBYTES=65536,i.sign=function(e){return e>0?1:0>e?-1:0},i.signNotZero=function(e){return 0>e?-1:1},i.toSNorm=function(e){return Math.round(255*(.5*i.clamp(e,-1,1)+.5))},i.fromSNorm=function(e){return 2*(i.clamp(e,0,255)/255)-1},i.sinh=function(e){var t=Math.pow(Math.E,e),i=Math.pow(Math.E,-1*e);return.5*(t-i)},i.cosh=function(e){var t=Math.pow(Math.E,e),i=Math.pow(Math.E,-1*e);return.5*(t+i)},i.lerp=function(e,t,i){return(1-i)*e+i*t},i.PI=Math.PI,i.ONE_OVER_PI=1/Math.PI,i.PI_OVER_TWO=.5*Math.PI,i.PI_OVER_THREE=Math.PI/3,i.PI_OVER_FOUR=Math.PI/4,i.PI_OVER_SIX=Math.PI/6,i.THREE_PI_OVER_TWO=.5*3*Math.PI,i.TWO_PI=2*Math.PI,i.ONE_OVER_TWO_PI=1/(2*Math.PI),i.RADIANS_PER_DEGREE=Math.PI/180,i.DEGREES_PER_RADIAN=180/Math.PI,i.RADIANS_PER_ARCSECOND=i.RADIANS_PER_DEGREE/3600,i.toRadians=function(e){return e*i.RADIANS_PER_DEGREE},i.toDegrees=function(e){return e*i.DEGREES_PER_RADIAN},i.convertLongitudeRange=function(e){var t=i.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},i.negativePiToPi=function(e){return i.zeroToTwoPi(e+i.PI)-i.PI},i.zeroToTwoPi=function(e){var t=i.mod(e,i.TWO_PI);return Math.abs(t)i.EPSILON14?i.TWO_PI:t},i.mod=function(e,t){return(e%t+t)%t},i.equalsEpsilon=function(e,i,r,n){n=t(n,r);var o=Math.abs(e-i);return n>=o||o<=r*Math.max(Math.abs(e),Math.abs(i))};var r=[1];i.factorial=function(e){var t=r.length;if(e>=t)for(var i=r[t-1],n=t;e>=n;n++)r.push(i*n);return r[e]},i.incrementWrap=function(e,i,r){return r=t(r,0),++e,e>i&&(e=r),e},i.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},i.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},i.clamp=function(e,t,i){return t>e?t:e>i?i:e};var n=new e;return i.setRandomNumberSeed=function(t){n=new e(t)},i.nextRandomNumber=function(){return n.random()},i.acosClamped=function(e){return Math.acos(i.clamp(e,-1,1))},i.asinClamped=function(e){return Math.asin(i.clamp(e,-1,1))},i.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},i}),i("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,i,r,n){"use strict";var o=function(t,i,r){this.x=e(t,0),this.y=e(i,0),this.z=e(r,0)};o.fromSpherical=function(i,r){t(r)||(r=new o);var n=i.clock,a=i.cone,s=e(i.magnitude,1),l=s*Math.sin(a);return r.x=l*Math.cos(n),r.y=l*Math.sin(n),r.z=s*Math.cos(a),r},o.fromElements=function(e,i,r,n){return t(n)?(n.x=e,n.y=i,n.z=r,n):new o(e,i,r)},o.clone=function(e,i){return t(e)?t(i)?(i.x=e.x,i.y=e.y,i.z=e.z,i):new o(e.x,e.y,e.z):void 0},o.fromCartesian4=o.clone,o.packedLength=3,o.pack=function(t,i,r){r=e(r,0),i[r++]=t.x,i[r++]=t.y,i[r]=t.z},o.unpack=function(i,r,n){return r=e(r,0),t(n)||(n=new o),n.x=i[r++],n.y=i[r++],n.z=i[r],n},o.fromArray=o.unpack,o.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},o.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},o.minimumByComponent=function(e,t,i){return i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i.z=Math.min(e.z,t.z),i},o.maximumByComponent=function(e,t,i){return i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i.z=Math.max(e.z,t.z),i},o.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,t){return o.subtract(e,t,a),o.magnitude(a)},o.distanceSquared=function(e,t){return o.subtract(e,t,a),o.magnitudeSquared(a)},o.normalize=function(e,t){var i=o.magnitude(e);return t.x=e.x/i,t.y=e.y/i,t.z=e.z/i,t},o.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},o.multiplyComponents=function(e,t,i){return i.x=e.x*t.x,i.y=e.y*t.y,i.z=e.z*t.z,i},o.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i},o.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i},o.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i},o.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i},o.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},o.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var s=new o;o.lerp=function(e,t,i,r){return o.multiplyByScalar(t,i,s),r=o.multiplyByScalar(e,1-i,r),o.add(s,r,r)};var l=new o,u=new o;o.angleBetween=function(e,t){o.normalize(e,l),o.normalize(t,u);var i=o.dot(l,u),r=o.magnitude(o.cross(l,u,l));return Math.atan2(r,i)};var c=new o;o.mostOrthogonalAxis=function(e,t){var i=o.normalize(e,c);return o.abs(i,i),t=i.x<=i.y?i.x<=i.z?o.clone(o.UNIT_X,t):o.clone(o.UNIT_Z,t):i.y<=i.z?o.clone(o.UNIT_Y,t):o.clone(o.UNIT_Z,t)},o.equals=function(e,i){return e===i||t(e)&&t(i)&&e.x===i.x&&e.y===i.y&&e.z===i.z},o.equalsArray=function(e,t,i){return e.x===t[i]&&e.y===t[i+1]&&e.z===t[i+2]},o.equalsEpsilon=function(e,i,r,o){return e===i||t(e)&&t(i)&&n.equalsEpsilon(e.x,i.x,r,o)&&n.equalsEpsilon(e.y,i.y,r,o)&&n.equalsEpsilon(e.z,i.z,r,o)},o.cross=function(e,t,i){var r=e.x,n=e.y,o=e.z,a=t.x,s=t.y,l=t.z,u=n*l-o*s,c=o*a-r*l,h=r*s-n*a;return i.x=u,i.y=c,i.z=h,i},o.fromDegrees=function(e,t,i,r,a){var s=n.toRadians(e),l=n.toRadians(t);return o.fromRadians(s,l,i,r,a)};var h=new o,d=new o,p=new o(40680631590769,40680631590769,40408299984661.445);return o.fromRadians=function(i,r,n,a,s){n=e(n,0);var l=t(a)?a.radiiSquared:p,u=Math.cos(r);h.x=u*Math.cos(i),h.y=u*Math.sin(i),h.z=Math.sin(r),h=o.normalize(h,h),o.multiplyComponents(l,h,d);var c=Math.sqrt(o.dot(h,d));return d=o.divideByScalar(d,c,d),h=o.multiplyByScalar(h,n,h),t(s)||(s=new o),o.add(d,h,s)},o.fromDegreesArray=function(e,t,i){for(var r=new Array(e.length),a=0;aa;a+=2){var s=e[a],l=e[a+1];r[a/2]=o.fromRadians(s,l,0,i,r[a/2])}return r},o.fromDegreesArrayHeights=function(e,t,i){for(var r=new Array(e.length),a=0;aa;a+=3){var s=e[a],l=e[a+1],u=e[a+2];r[a/3]=o.fromRadians(s,l,u,i,r[a/3])}return r},o.ZERO=r(new o(0,0,0)),o.UNIT_X=r(new o(1,0,0)),o.UNIT_Y=r(new o(0,1,0)),o.UNIT_Z=r(new o(0,0,1)),o.prototype.clone=function(e){return o.clone(this,e)},o.prototype.equals=function(e){return o.equals(this,e)},o.prototype.equalsEpsilon=function(e,t,i){return o.equalsEpsilon(this,e,t,i)},o.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},o}),i("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,i,r,n){"use strict";var o=function(t,i,r){this.longitude=e(t,0),this.latitude=e(i,0),this.height=e(r,0)};return o.fromRadians=function(i,r,n,a){return n=e(n,0),t(a)?(a.longitude=i,a.latitude=r,a.height=n,a):new o(i,r,n)},o.fromDegrees=function(e,t,i,r){return e=n.toRadians(e),t=n.toRadians(t),o.fromRadians(e,t,i,r)},o.clone=function(e,i){return t(e)?t(i)?(i.longitude=e.longitude,i.latitude=e.latitude,i.height=e.height,i):new o(e.longitude,e.latitude,e.height):void 0},o.equals=function(e,i){return e===i||t(e)&&t(i)&&e.longitude===i.longitude&&e.latitude===i.latitude&&e.height===i.height},o.equalsEpsilon=function(e,i,r){return e===i||t(e)&&t(i)&&Math.abs(e.longitude-i.longitude)<=r&&Math.abs(e.latitude-i.latitude)<=r&&Math.abs(e.height-i.height)<=r},o.ZERO=r(new o(0,0,0)),o.prototype.clone=function(e){return o.clone(this,e)},o.prototype.equals=function(e){return o.equals(this,e)},o.prototype.equalsEpsilon=function(e,t){return o.equalsEpsilon(this,e,t)},o.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},o}),i("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,i,r,n,o,a,s){"use strict";function l(t,r,n,o){r=i(r,0),n=i(n,0),o=i(o,0),t._radii=new e(r,n,o),t._radiiSquared=new e(r*r,n*n,o*o),t._radiiToTheFourth=new e(r*r*r*r,n*n*n*n,o*o*o*o),t._oneOverRadii=new e(0===r?0:1/r,0===n?0:1/n,0===o?0:1/o),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===n?0:1/(n*n),0===o?0:1/(o*o)),t._minimumRadius=Math.min(r,n,o),t._maximumRadius=Math.max(r,n,o),t._centerToleranceSquared=s.EPSILON1}var u=function(e,t,i){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,l(this,e,t,i)};n(u.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),u.clone=function(t,i){if(!r(t))return void 0;var n=t._radii;return r(i)?(e.clone(n,i._radii),e.clone(t._radiiSquared,i._radiiSquared),e.clone(t._radiiToTheFourth,i._radiiToTheFourth),e.clone(t._oneOverRadii,i._oneOverRadii),e.clone(t._oneOverRadiiSquared,i._oneOverRadiiSquared),i._minimumRadius=t._minimumRadius,i._maximumRadius=t._maximumRadius,i._centerToleranceSquared=t._centerToleranceSquared,i):new u(n.x,n.y,n.z)},u.fromCartesian3=function(e,t){return r(t)||(t=new u),r(e)?(l(t,e.x,e.y,e.z),t):t},u.WGS84=a(new u(6378137,6378137,6356752.314245179)),u.UNIT_SPHERE=a(new u(1,1,1)),u.MOON=a(new u(s.LUNAR_RADIUS,s.LUNAR_RADIUS,s.LUNAR_RADIUS)),u.prototype.clone=function(e){return u.clone(this,e)},u.packedLength=e.packedLength,u.pack=function(t,r,n){n=i(n,0),e.pack(t._radii,r,n)},u.unpack=function(t,r,n){r=i(r,0);var o=e.unpack(t,r);return u.fromCartesian3(o,n)},u.prototype.geocentricSurfaceNormal=e.normalize,u.prototype.geodeticSurfaceNormalCartographic=function(t,i){var n=t.longitude,o=t.latitude,a=Math.cos(o),s=a*Math.cos(n),l=a*Math.sin(n),u=Math.sin(o);return r(i)||(i=new e),i.x=s,i.y=l,i.z=u,e.normalize(i,i)},u.prototype.geodeticSurfaceNormal=function(t,i){return r(i)||(i=new e),i=e.multiplyComponents(t,this._oneOverRadiiSquared,i),e.normalize(i,i)};var c=new e,h=new e;u.prototype.cartographicToCartesian=function(t,i){var n=c,o=h;this.geodeticSurfaceNormalCartographic(t,n),e.multiplyComponents(this._radiiSquared,n,o);var a=Math.sqrt(e.dot(n,o));return e.divideByScalar(o,a,o),e.multiplyByScalar(n,t.height,n),r(i)||(i=new e),e.add(o,n,i)},u.prototype.cartographicArrayToCartesianArray=function(e,t){var i=e.length;r(t)?t.length=i:t=new Array(i);for(var n=0;i>n;n++)t[n]=this.cartographicToCartesian(e[n],t[n]);return t};var d=new e,p=new e,m=new e;u.prototype.cartesianToCartographic=function(i,n){var o=this.scaleToGeodeticSurface(i,p);if(!r(o))return void 0;var a=this.geodeticSurfaceNormal(o,d),l=e.subtract(i,o,m),u=Math.atan2(a.y,a.x),c=Math.asin(a.z),h=s.sign(e.dot(l,i))*e.magnitude(l);return r(n)?(n.longitude=u,n.latitude=c,n.height=h,n):new t(u,c,h)},u.prototype.cartesianArrayToCartographicArray=function(e,t){var i=e.length;r(t)?t.length=i:t=new Array(i);for(var n=0;i>n;++n)t[n]=this.cartesianToCartographic(e[n],t[n]);return t};var f=new e,v=new e;return u.prototype.scaleToGeodeticSurface=function(t,i){var n=t.x,o=t.y,a=t.z,l=this._oneOverRadii,u=l.x,c=l.y,h=l.z,d=n*n*u*u,p=o*o*c*c,m=a*a*h*h,g=d+p+m,_=Math.sqrt(1/g),y=e.multiplyByScalar(t,_,f);if(gs.EPSILON12);return r(i)?(i.x=n*P,i.y=o*A,i.z=a*D,i):new e(n*P,o*A,a*D)},u.prototype.scaleToGeocentricSurface=function(t,i){r(i)||(i=new e);var n=t.x,o=t.y,a=t.z,s=this._oneOverRadiiSquared,l=1/Math.sqrt(n*n*s.x+o*o*s.y+a*a*s.z);return e.multiplyByScalar(t,l,i)},u.prototype.transformPositionToScaledSpace=function(t,i){return r(i)||(i=new e),e.multiplyComponents(t,this._oneOverRadii,i)},u.prototype.transformPositionFromScaledSpace=function(t,i){return r(i)||(i=new e),e.multiplyComponents(t,this._radii,i)},u.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},u.prototype.toString=function(){return this._radii.toString()},u}),i("Core/Event",["./defined","./defineProperties","./DeveloperError"],function(e,t){"use strict";var i=function(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1};return t(i.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}}),i.prototype.addEventListener=function(e,t){this._listeners.push(e),this._scopes.push(t);var i=this;return function(){i.removeEventListener(e,t)}},i.prototype.removeEventListener=function(e,t){for(var i=this._listeners,r=this._scopes,n=-1,o=0;ot;t++){var o=i[t];e(o)&&i[t].apply(r[t],arguments)}var a=this._toRemove;for(n=a.length,t=0;n>t;t++){var s=a[t];i.splice(s,1),r.splice(s,1)}a.length=0,this._insideRaiseEvent=!1},i}),i("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,i,r,n){"use strict";var o=function(t,i){this.x=e(t,0),this.y=e(i,0)};o.fromElements=function(e,i,r){return t(r)?(r.x=e,r.y=i,r):new o(e,i)},o.clone=function(e,i){return t(e)?t(i)?(i.x=e.x,i.y=e.y,i):new o(e.x,e.y):void 0},o.fromCartesian3=o.clone,o.fromCartesian4=o.clone,o.packedLength=2,o.pack=function(t,i,r){r=e(r,0),i[r++]=t.x,i[r]=t.y},o.unpack=function(i,r,n){return r=e(r,0),t(n)||(n=new o),n.x=i[r++],n.y=i[r],n},o.fromArray=o.unpack,o.maximumComponent=function(e){return Math.max(e.x,e.y)},o.minimumComponent=function(e){return Math.min(e.x,e.y)},o.minimumByComponent=function(e,t,i){return i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i},o.maximumByComponent=function(e,t,i){return i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i},o.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,t){return o.subtract(e,t,a),o.magnitude(a)},o.distanceSquared=function(e,t){return o.subtract(e,t,a),o.magnitudeSquared(a)},o.normalize=function(e,t){var i=o.magnitude(e);return t.x=e.x/i,t.y=e.y/i,t},o.dot=function(e,t){return e.x*t.x+e.y*t.y},o.multiplyComponents=function(e,t,i){return i.x=e.x*t.x,i.y=e.y*t.y,i},o.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i},o.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i},o.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i},o.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i},o.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},o.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var s=new o;o.lerp=function(e,t,i,r){return o.multiplyByScalar(t,i,s),r=o.multiplyByScalar(e,1-i,r),o.add(s,r,r)};var l=new o,u=new o;o.angleBetween=function(e,t){return o.normalize(e,l),o.normalize(t,u),n.acosClamped(o.dot(l,u))};var c=new o;return o.mostOrthogonalAxis=function(e,t){var i=o.normalize(e,c);return o.abs(i,i),t=i.x<=i.y?o.clone(o.UNIT_X,t):o.clone(o.UNIT_Y,t)},o.equals=function(e,i){return e===i||t(e)&&t(i)&&e.x===i.x&&e.y===i.y},o.equalsArray=function(e,t,i){return e.x===t[i]&&e.y===t[i+1]},o.equalsEpsilon=function(e,i,r,o){return e===i||t(e)&&t(i)&&n.equalsEpsilon(e.x,i.x,r,o)&&n.equalsEpsilon(e.y,i.y,r,o)},o.ZERO=r(new o(0,0)),o.UNIT_X=r(new o(1,0)),o.UNIT_Y=r(new o(0,1)),o.prototype.clone=function(e){return o.clone(this,e)},o.prototype.equals=function(e){return o.equals(this,e)},o.prototype.equalsEpsilon=function(e,t,i){return o.equalsEpsilon(this,e,t,i)},o.prototype.toString=function(){return"("+this.x+", "+this.y+")"},o}),i("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,i,r,n,o,a){"use strict";var s=function(e){this._ellipsoid=i(e,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return n(s.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),s.prototype.project=function(t,i){var n=this._semimajorAxis,o=t.longitude*n,a=t.latitude*n,s=t.height;return r(i)?(i.x=o,i.y=a,i.z=s,i):new e(o,a,s)},s.prototype.unproject=function(e,i){var n=this._oneOverSemimajorAxis,o=e.x*n,a=e.y*n,s=e.z;return r(i)?(i.longitude=o,i.latitude=a,i.height=s,i):new t(o,a,s)},s}),i("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(e,i,r,n){this.west=t(e,0),this.south=t(i,0),this.east=t(r,0),this.north=t(n,0)};r(l.prototype,{width:{get:function(){return l.computeWidth(this)}},height:{get:function(){return l.computeHeight(this)}}}),l.packedLength=4,l.pack=function(e,i,r){r=t(r,0),i[r++]=e.west,i[r++]=e.south,i[r++]=e.east,i[r]=e.north},l.unpack=function(e,r,n){return r=t(r,0),i(n)||(n=new l),n.west=e[r++],n.south=e[r++],n.east=e[r++],n.north=e[r],n},l.computeWidth=function(e){var t=e.east,i=e.west;return i>t&&(t+=s.TWO_PI),t-i},l.computeHeight=function(e){return e.north-e.south},l.fromDegrees=function(e,r,n,o,a){return e=s.toRadians(t(e,0)),r=s.toRadians(t(r,0)),n=s.toRadians(t(n,0)),o=s.toRadians(t(o,0)),i(a)?(a.west=e,a.south=r,a.east=n,a.north=o,a):new l(e,r,n,o)},l.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,n=-Number.MAX_VALUE,o=Number.MAX_VALUE,a=-Number.MAX_VALUE,s=0,u=e.length;u>s;s++){var c=e[s];r=Math.min(r,c.longitude),n=Math.max(n,c.longitude),o=Math.min(o,c.latitude),a=Math.max(a,c.latitude)}return i(t)?(t.west=r,t.south=o,t.east=n,t.north=a,t):new l(r,o,n,a)},l.clone=function(e,t){return i(e)?i(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new l(e.west,e.south,e.east,e.north):void 0},l.prototype.clone=function(e){return l.clone(this,e)},l.prototype.equals=function(e){return l.equals(this,e)},l.equals=function(e,t){return e===t||i(e)&&i(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},l.prototype.equalsEpsilon=function(e,t){return i(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},l.validate=function(){},l.southwest=function(t,r){return i(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},l.northwest=function(t,r){return i(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},l.northeast=function(t,r){return i(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},l.southeast=function(t,r){return i(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},l.center=function(t,r){var n=t.east,o=t.west;o>n&&(n+=s.TWO_PI);var a=s.negativePiToPi(.5*(o+n)),l=.5*(t.south+t.north);return i(r)?(r.longitude=a,r.latitude=l,r.height=0,r):new e(a,l)},l.intersection=function(e,t,r){var n=e.east,o=e.west,a=t.east,u=t.west;o>n&&a>0?n+=s.TWO_PI:u>a&&n>0&&(a+=s.TWO_PI),o>n&&0>u?u+=s.TWO_PI:u>a&&0>o&&(o+=s.TWO_PI);var c=s.negativePiToPi(Math.max(o,u)),h=s.negativePiToPi(Math.min(n,a));if((e.west=h)return void 0;var d=Math.max(e.south,t.south),p=Math.min(e.north,t.north);return d>=p?void 0:i(r)?(r.west=c,r.south=d,r.east=h,r.north=p,r):new l(c,d,h,p)},l.contains=function(e,t){var i=t.longitude,r=t.latitude,n=e.west,o=e.east;return n>o&&(o+=s.TWO_PI,0>i&&(i+=s.TWO_PI)),(i>n||s.equalsEpsilon(i,n,s.EPSILON14))&&(o>i||s.equalsEpsilon(i,o,s.EPSILON14))&&r>=e.south&&r<=e.north};var u=new e;return l.subsample=function(e,r,n,a){r=t(r,o.WGS84),n=t(n,0),i(a)||(a=[]);var c=0,h=e.north,d=e.south,p=e.east,m=e.west,f=u;f.height=n,f.longitude=m,f.latitude=h,a[c]=r.cartographicToCartesian(f,a[c]),c++,f.longitude=p,a[c]=r.cartographicToCartesian(f,a[c]),c++,f.latitude=d,a[c]=r.cartographicToCartesian(f,a[c]),c++,f.longitude=m,a[c]=r.cartographicToCartesian(f,a[c]),c++,f.latitude=0>h?h:d>0?d:0;for(var v=1;8>v;++v)f.longitude=-Math.PI+v*s.PI_OVER_TWO,l.contains(e,f)&&(a[c]=r.cartographicToCartesian(f,a[c]),c++);return 0===f.latitude&&(f.longitude=m,a[c]=r.cartographicToCartesian(f,a[c]),c++,f.longitude=p,a[c]=r.cartographicToCartesian(f,a[c]),c++),a.length=c,a},l.MAX_VALUE=a(new l(-Math.PI,-s.PI_OVER_TWO,Math.PI,s.PI_OVER_TWO)),l}),i("Core/GeographicTilingScheme",["./Cartesian2","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./GeographicProjection","./Math","./Rectangle"],function(e,t,i,r,n,o,a,s,l){"use strict";var u=function(e){e=t(e,{}),this._ellipsoid=t(e.ellipsoid,o.WGS84),this._rectangle=t(e.rectangle,l.MAX_VALUE),this._projection=new a(this._ellipsoid),this._numberOfLevelZeroTilesX=t(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=t(e.numberOfLevelZeroTilesY,1)};return r(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),u.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<=a&&(p=a-1);var m=0|(o.north-t.latitude)/h; -return m>=u&&(m=u-1),i(n)?(n.x=p,n.y=m,n):new e(p,m)},u}),i("Core/getImagePixels",["./defined"],function(e){"use strict";var t={},i=function(i,r,n){e(r)||(r=i.width),e(n)||(n=i.height);var o=t[r];e(o)||(o={},t[r]=o);var a=o[n];if(!e(a)){var s=document.createElement("canvas");s.width=r,s.height=n,a=s.getContext("2d"),a.globalCompositeOperation="copy",o[n]=a}return a.drawImage(i,0,0,r,n),a.getImageData(0,0,r,n).data};return i}),i("Core/HeightmapTessellator",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./freezeObject","./Math","./Rectangle"],function(e,t,i,r,n,o,a,s){"use strict";var l={};return l.DEFAULT_STRUCTURE=o({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1}),l.computeVertices=function(r){var o,u,c,h,d=Math.cos,p=Math.sin,m=Math.sqrt,f=Math.atan,v=Math.exp,g=a.PI_OVER_TWO,_=a.toRadians,y=r.vertices,C=r.heightmap,w=r.width,S=r.height,E=r.skirtHeight,b=t(r.isGeographic,!0),x=t(r.ellipsoid,n.WGS84),T=1/x.maximumRadius,P=r.nativeRectangle,A=r.rectangle;i(A)?(o=A.west,u=A.south,c=A.east,h=A.north):b?(o=_(P.west),u=_(P.south),c=_(P.east),h=_(P.north)):(o=P.west*T,u=g-2*f(v(-P.south*T)),c=P.east*T,h=g-2*f(v(-P.north*T)));var D=t(r.relativeToCenter,e.ZERO),M=t(r.structure,l.DEFAULT_STRUCTURE),I=t(M.heightScale,l.DEFAULT_STRUCTURE.heightScale),O=t(M.heightOffset,l.DEFAULT_STRUCTURE.heightOffset),R=t(M.elementsPerHeight,l.DEFAULT_STRUCTURE.elementsPerHeight),L=t(M.stride,l.DEFAULT_STRUCTURE.stride),N=t(M.elementMultiplier,l.DEFAULT_STRUCTURE.elementMultiplier),F=t(M.isBigEndian,l.DEFAULT_STRUCTURE.isBigEndian),B=s.computeWidth(P)/(w-1),z=s.computeHeight(P)/(S-1),k=x.radiiSquared,V=k.x,U=k.y,W=k.z,G=0,H=65536,q=-65536,j=0,Y=S,X=0,Z=w;E>0&&(--j,++Y,--X,++Z);for(var J=j;Y>J;++J){var Q=J;0>Q&&(Q=0),Q>=S&&(Q=S-1);var K=P.north-z*Q;K=b?_(K):g-2*f(v(-K*T));for(var $=d(K),et=p(K),tt=W*et,it=(K-u)/(h-u),rt=X;Z>rt;++rt){var nt=rt;0>nt&&(nt=0),nt>=w&&(nt=w-1);var ot=P.west+B*nt;b?ot=_(ot):ot*=T;var at,st=Q*w*L+nt*L;if(1===R)at=C[st];else{at=0;var lt;if(F)for(lt=0;R>lt;++lt)at=at*N+C[st+lt];else for(lt=R-1;lt>=0;--lt)at=at*N+C[st+lt]}at=at*I+O,q=Math.max(q,at),H=Math.min(H,at),(rt!==nt||J!==Q)&&(at-=E);var ut=$*d(ot),ct=$*p(ot),ht=V*ut,dt=U*ct,pt=m(ht*ut+dt*ct+tt*et),mt=1/pt,ft=ht*mt,vt=dt*mt,gt=tt*mt;y[G++]=ft+ut*at-D.x,y[G++]=vt+ct*at-D.y,y[G++]=gt+et*at-D.z,y[G++]=at;var _t=(ot-o)/(c-o);y[G++]=_t,y[G++]=it}}return{maximumHeight:q,minimumHeight:H}},l}),i("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var i=r.exec(t);this.scheme=i[1],this.authority=i[2],this.path=i[3],this.query=i[4],this.fragment=i[5]}}function t(e){var t=unescape(e);return o.test(t)?t:e.toUpperCase()}function i(e,t,i,r){return(t||"")+i.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(a,i).replace(n,t)),this.path&&(this.path=this.path.replace(n,t)),this.query&&(this.query=this.query.replace(n,t)),this.fragment&&(this.fragment=this.fragment.replace(n,t))};var n=/%[0-9a-z]{2}/gi,o=/[a-zA-Z0-9\-\._~]/,a=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var i=new e;return this.scheme?(i.scheme=this.scheme,i.authority=this.authority,i.path=this.path,i.query=this.query):(i.scheme=t.scheme,this.authority?(i.authority=this.authority,i.path=this.path,i.query=this.query):(i.authority=t.authority,""==this.path?(i.path=t.path,i.query=this.query||t.query):("/"==this.path.charAt(0)?(i.path=this.path,i.removeDotSegments()):(i.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,i.removeDotSegments()),i.query=this.query))),i.fragment=this.fragment,i},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),i=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?i.pop():"."!=e&&i.push(e);("."==e||".."==e)&&i.push(""),r&&i.unshift(""),this.path=i.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),i("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,i,r){"use strict";function n(){for(var e=document.getElementsByTagName("script"),t=0,i=e.length;i>t;++t){var r=e[t].getAttribute("src"),n=h.exec(r);if(null!==n)return n[1]}return void 0}function o(){if(t(l))return l;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:n(),!t(r))throw new i("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return l=new e(r).resolve(new e(document.location.href))}function a(e){return r.toUrl("../"+e)}function s(t){return new e(t).resolve(o()).toString()}var l,u,c,h=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,d=function(e){t(u)||(u=t(r.toUrl)?a:s),t(c)||(c=document.createElement("a"));var i=u(e);return c.href=i,c.href=c.href,c.href};return d._cesiumScriptRegex=h,d.setBaseUrl=function(t){l=new e(t).resolve(new e(document.location.href))},d}),i("Core/destroyObject",["./defaultValue","./DeveloperError"],function(e,t){"use strict";function i(){return!0}var r=function(r,n){function o(){throw new t(n)}n=e(n,"This object was destroyed, i.e., destroy() was called.");for(var a in r)"function"==typeof r[a]&&(r[a]=o);return r.isDestroyed=i,void 0};return r}),i("Core/isCrossOriginUrl",["./defined"],function(e){"use strict";var t,i=function(i){e(t)||(t=document.createElement("a")),t.href=window.location.href;var r=t.host,n=t.protocol;return t.href=i,t.href=t.href,n!==t.protocol||r!==t.host};return i}),i("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(i){t=i.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),i("Core/TaskProcessor",["../ThirdParty/Uri","../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./destroyObject","./DeveloperError","./isCrossOriginUrl","./RuntimeError","require"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(){if(!n(v._canTransferArrayBuffer)){var e=new Worker(d("Workers/transferTypedArrayTest.js"));e.postMessage=r(e.webkitPostMessage,e.postMessage);var i=99,o=new Int8Array([i]);try{e.postMessage({array:o},[o.buffer])}catch(a){return v._canTransferArrayBuffer=!1,v._canTransferArrayBuffer}var s=t.defer();e.onmessage=function(t){var r=t.data.array,o=n(r)&&r[0]===i;s.resolve(o),e.terminate(),v._canTransferArrayBuffer=o},v._canTransferArrayBuffer=s.promise}return v._canTransferArrayBuffer}function h(e,t){--e._activeTasks;var i=t.id;if(n(i)){var r=e._deferreds,o=r[i];if(n(t.error)){var s=t.error;"RuntimeError"===s.name?(s=new l(t.error.message),s.stack=t.error.stack):"DeveloperError"===s.name&&(s=new a(t.error.message),s.stack=t.error.stack),o.reject(s)}else o.resolve(t.result);delete r[i]}}function d(e){var t=i(e);if(s(t)){var r,n='importScripts("'+t+'");';try{r=new Blob([n],{type:"application/javascript"})}catch(o){var a=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,l=new a;l.append(n),r=l.getBlob("application/javascript")}var u=window.URL||window.webkitURL;t=u.createObjectURL(r)}return t}function p(){return n(f)||(f=d("Workers/cesiumWorkerBootstrapper.js")),f}function m(t){var o=new Worker(p());o.postMessage=r(o.webkitPostMessage,o.postMessage);var a={loaderConfig:{},workerModule:v._workerModulePrefix+t._workerName};if(n(v._loaderConfig))a.loaderConfig=v._loaderConfig;else if(n(u.toUrl)){var s=new e("..").resolve(new e(i("Workers/cesiumWorkerBootstrapper.js"))).toString();a.loaderConfig.baseUrl=s}else a.loaderConfig.paths={Workers:i("Workers")};return o.postMessage(a),o.onmessage=function(e){h(t,e.data)},o}var f,v=function(e,t){this._workerName=e,this._maximumActiveTasks=r(t,5),this._activeTasks=0,this._deferreds={},this._nextID=0},g=[];return v.prototype.scheduleTask=function(e,i){if(n(this._worker)||(this._worker=m(this)),this._activeTasks>=this._maximumActiveTasks)return void 0;++this._activeTasks;var r=this;return t(c(),function(o){n(i)?o||(i.length=0):i=g;var a=r._nextID++,s=t.defer();return r._deferreds[a]=s,r._worker.postMessage({id:a,parameters:e,canTransferArrayBuffer:o},i),s.promise})},v.prototype.isDestroyed=function(){return!1},v.prototype.destroy=function(){return n(this._worker)&&this._worker.terminate(),o(this)},v._defaultWorkerModulePrefix="Workers/",v._workerModulePrefix=v._defaultWorkerModulePrefix,v._loaderConfig=void 0,v._canTransferArrayBuffer=void 0,v}),i("Core/TerrainMesh",["../Core/defaultValue"],function(e){"use strict";var t=function(t,i,r,n,o,a,s,l,u){this.center=t,this.vertices=i,this.stride=e(l,6),this.indices=r,this.minimumHeight=n,this.maximumHeight=o,this.boundingSphere3D=a,this.occludeePointInScaledSpace=s,this.orientedBoundingBox=u};return t}),i("Core/TerrainProvider",["./defined","./defineProperties","./DeveloperError"],function(e,t,i){"use strict";var r=function(){i.throwInstantiationError()};t(r.prototype,{errorEvent:{get:i.throwInstantiationError},credit:{get:i.throwInstantiationError},tilingScheme:{get:i.throwInstantiationError},ready:{get:i.throwInstantiationError},hasWaterMask:{get:i.throwInstantiationError},hasVertexNormals:{get:i.throwInstantiationError}});var n=[];return r.getRegularGridIndices=function(t,i){var r=n[t];e(r)||(n[t]=r=[]);var o=r[i];if(!e(o)){o=r[i]=new Uint16Array(6*(t-1)*(i-1));for(var a=0,s=0,l=0;i-1>l;++l){for(var u=0;t-1>u;++u){var c=a,h=c+t,d=h+1,p=c+1;o[s++]=c,o[s++]=h,o[s++]=p,o[s++]=p,o[s++]=h,o[s++]=d,++a}++a}}return o},r.heightmapTerrainQuality=.25,r.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,i){return 2*e.maximumRadius*Math.PI*r.heightmapTerrainQuality/(t*i)},r.prototype.requestTileGeometry=i.throwInstantiationError,r.prototype.getLevelMaximumGeometricError=i.throwInstantiationError,r.prototype.getTileDataAvailable=i.throwInstantiationError,r}),i("Core/HeightmapTerrainData",["../ThirdParty/when","./defaultValue","./defined","./defineProperties","./DeveloperError","./GeographicTilingScheme","./HeightmapTessellator","./Math","./Rectangle","./TaskProcessor","./TerrainMesh","./TerrainProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,t,i,r,n,o,a){var s=1,l=e._width,u=e._height,c=o*(l-1),h=c+l-1,d=a*(u-1),p=d+u-1,m=1<1)for(_=S;E>=_;++_)for(g=C;w>=g;++g)for(var R=(_*l+g)*O,L=0;O>L;++L)M[I++]=T[R+L];else for(_=S;E>=_;++_)for(g=C;w>=g;++g)M[I++]=T[_*l+g];return new y({buffer:M,width:b,height:x,childTileMask:0,structure:e._structure,createdByUpsampling:!0})}function p(e,t,i,r,n,o,a,l){var u,c,h,d,p=e._width,v=e._height,g=e._structure,C=g.stride,w=e._buffer,S=new w.constructor(p*v*C),E=t.tileXYToRectangle(i,r,n),b=t.tileXYToRectangle(o,a,l);if(C>1){var x=g.elementsPerHeight,T=g.elementMultiplier,P=g.isBigEndian,A=Math.pow(T,x-1);for(c=0;v>c;++c)for(h=s.lerp(b.north,b.south,c/(v-1)),u=0;p>u;++u){d=s.lerp(b.west,b.east,u/(p-1));var D=f(w,x,T,C,P,E,p,v,d,h);_(S,x,T,A,C,P,c*p+u,D)}}else for(c=0;v>c;++c)for(h=s.lerp(b.north,b.south,c/(v-1)),u=0;p>u;++u)d=s.lerp(b.west,b.east,u/(p-1)),S[c*p+u]=m(w,E,p,v,d,h);return new y({buffer:S,width:p,height:v,childTileMask:0,structure:e._structure,createdByUpsampling:!0})}function m(e,t,i,r,n,o){var a=(n-t.west)*(i-1)/(t.east-t.west),s=(o-t.south)*(r-1)/(t.north-t.south),l=0|a,u=l+1;u>=i&&(u=i-1,l=i-2);var c=0|s,h=c+1;h>=r&&(h=r-1,c=r-2);var d=a-l,p=s-c;c=r-1-c,h=r-1-h;var m=e[c*i+l],f=e[c*i+u],g=e[h*i+l],_=e[h*i+u];return v(d,p,m,f,g,_)}function f(e,t,i,r,n,o,a,s,l,u){var c=(l-o.west)*(a-1)/(o.east-o.west),h=(u-o.south)*(s-1)/(o.north-o.south),d=0|c,p=d+1;p>=a&&(p=a-1,d=a-2);var m=0|h,f=m+1;f>=s&&(f=s-1,m=s-2);var _=c-d,y=h-m;m=s-1-m,f=s-1-f;var C=g(e,t,i,r,n,m*a+d),w=g(e,t,i,r,n,m*a+p),S=g(e,t,i,r,n,f*a+d),E=g(e,t,i,r,n,f*a+p);return v(_,y,C,w,S,E)}function v(e,t,i,r,n,o){return e>t?i+e*(r-i)+t*(o-r):i+e*(o-n)+t*(n-i)}function g(e,t,i,r,n,o){o*=r;var a,s=0;if(n)for(a=0;t>a;++a)s=s*i+e[o+a];else for(a=t-1;a>=0;--a)s=s*i+e[o+a];return s}function _(e,t,i,r,n,o,a,s){a*=n;var l;if(o)for(l=0;t>l;++l)e[a+l]=0|s/r,s-=e[a+l]*r,r/=i;else for(l=t-1;l>=0;--l)e[a+l]=0|s/r,s-=e[a+l]*r,r/=i}var y=function(e){this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=t(e.childTileMask,15);var r=a.DEFAULT_STRUCTURE,n=e.structure;i(n)?n!==r&&(n.heightScale=t(n.heightScale,r.heightScale),n.heightOffset=t(n.heightOffset,r.heightOffset),n.elementsPerHeight=t(n.elementsPerHeight,r.elementsPerHeight),n.stride=t(n.stride,r.stride),n.elementMultiplier=t(n.elementMultiplier,r.elementMultiplier),n.isBigEndian=t(n.isBigEndian,r.isBigEndian)):n=r,this._structure=n,this._createdByUpsampling=t(e.createdByUpsampling,!1),this._waterMask=e.waterMask};r(y.prototype,{waterMask:{get:function(){return this._waterMask}}});var C=new u("createVerticesFromHeightmap");return y.prototype.createMesh=function(t,r,n,a){var s=t.ellipsoid,u=t.tileXYToNativeRectangle(r,n,a),d=t.tileXYToRectangle(r,n,a),p=s.cartographicToCartesian(l.center(d)),m=this._structure,f=h.getEstimatedLevelZeroGeometricErrorForAHeightmap(s,this._width,t.getNumberOfXTilesAtLevel(0)),v=f/(1<1){var l=a.elementsPerHeight,u=a.elementMultiplier,c=a.isBigEndian;r=f(this._buffer,l,u,s,c,e,n,o,t,i)}else r=m(this._buffer,e,n,o,t,i);return r*a.heightScale+a.heightOffset},y.prototype.upsample=function(e,t,i,r,n,o,a){var s;return s=1===this._width%2&&1===this._height%2?d(this,e,t,i,r,n,o,a):p(this,e,t,i,r,n,o,a)},y.prototype.isChildAvailable=function(e,t,i,r){var n=2;return i!==2*e&&++n,r!==2*t&&(n-=2),0!==(this._childTileMask&1<=a.maximumRequestsPerServer?void 0:(n[s]=l+1,t(o(e),function(e){return n[s]--,e}).otherwise(function(e){return n[s]--,t.reject(e)}))};return a.maximumRequestsPerServer=6,a}),i("Core/ArcGisImageServerTerrainProvider",["../ThirdParty/when","./Credit","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Event","./GeographicTilingScheme","./getImagePixels","./HeightmapTerrainData","./loadImage","./Math","./TerrainProvider","./throttleRequestByServer"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";var f=function(e){this._url=e.url,this._token=e.token,this._tilingScheme=e.tilingScheme,r(this._tilingScheme)||(this._tilingScheme=new l({ellipsoid:i(e.ellipsoid,a.WGS84)})),this._heightmapWidth=65,this._levelZeroMaximumGeometricError=p.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,this._heightmapWidth,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._proxy=e.proxy,this._terrainDataStructure={heightScale:.001,heightOffset:-1e3,elementsPerHeight:3,stride:4,elementMultiplier:256,isBigEndian:!0},this._errorEvent=new s;var n=e.credit;"string"==typeof n&&(n=new t(n)),this._credit=n};return n(f.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}}}),f.prototype.requestTileGeometry=function(t,i,n){var o=this._tilingScheme.tileXYToRectangle(t,i,n),a=(o.east-o.west)/(this._heightmapWidth-1),s=(o.north-o.south)/(this._heightmapWidth-1);o.west-=.5*a,o.east+=.5*a,o.south-=.5*s,o.north+=.5*s;var l=d.toDegrees(o.west)+"%2C"+d.toDegrees(o.south)+"%2C"+d.toDegrees(o.east)+"%2C"+d.toDegrees(o.north),p=this._url+"/exportImage?interpolation=RSP_BilinearInterpolation&format=tiff&f=image&size="+this._heightmapWidth+"%2C"+this._heightmapWidth+"&bboxSR=4326&imageSR=4326&bbox="+l;this._token&&(p+="&token="+this._token);var f=this._proxy;r(f)&&(p=f.getURL(p));var v=m(p,h);if(!r(v))return void 0;var g=this;return e(v,function(e){return new c({buffer:u(e),width:g._heightmapWidth,height:g._heightmapWidth,childTileMask:15,structure:g._terrainDataStructure})})},f.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<0&&(this._hash={},e.length=0)},i}),i("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,i,r,n){"use strict";var o={};o.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var i=t.x,r=t.y;t.x=(1-Math.abs(r))*n.signNotZero(i),t.y=(1-Math.abs(i))*n.signNotZero(r)}return t.x=n.toSNorm(t.x),t.y=n.toSNorm(t.y),t},o.octDecode=function(e,i,r){if(r.x=n.fromSNorm(e),r.y=n.fromSNorm(i),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){var o=r.x;r.x=(1-Math.abs(r.y))*n.signNotZero(o),r.y=(1-Math.abs(o))*n.signNotZero(r.y)}return t.normalize(r,r)},o.octPackFloat=function(e){return 256*e.x+e.y};var a=new e;return o.octEncodeFloat=function(e){return o.octEncode(e,a),o.octPackFloat(a)},o.octDecodeFloat=function(e,t){var i=e/256,r=Math.floor(i),n=256*(i-r);return o.octDecode(r,n,t)},o.octPack=function(e,t,i,r){var n=o.octEncodeFloat(e),s=o.octEncodeFloat(t),l=o.octEncode(i,a);return r.x=65536*l.x+n,r.y=65536*l.y+s,r},o.octUnpack=function(e,t,i,r){var n=e.x/65536,a=Math.floor(n),s=65536*(n-a);n=e.y/65536;var l=Math.floor(n),u=65536*(n-l);o.octDecodeFloat(s,t),o.octDecodeFloat(u,i),o.octDecode(a,l,r)},o.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,i=1===e.y?4095:0|4096*e.y;return 4096*t+i},o.decompressTextureCoordinates=function(e,t){var i=e/4096;return t.x=Math.floor(i)/4096,t.y=i-Math.floor(i),t},o}),i("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},i=function(i,r){e(t[i])||(t[i]=!0,console.log(r))};return i}),i("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),i("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,i,r){"use strict";var n=function(t,i){this.normal=e.clone(t),this.distance=i};n.fromPointNormal=function(i,r,o){var a=-e.dot(r,i);return t(o)?(e.clone(r,o.normal),o.distance=a,o):new n(r,a)};var o=new e;return n.fromCartesian4=function(i,r){var a=e.fromCartesian4(i,o),s=i.w;return t(r)?(e.clone(a,r.normal),r.distance=s,r):new n(a,s)},n.getPointDistance=function(t,i){return e.dot(t.normal,i)+t.distance},n.ORIGIN_XY_PLANE=r(new n(e.UNIT_Z,0)),n.ORIGIN_YZ_PLANE=r(new n(e.UNIT_X,0)),n.ORIGIN_ZX_PLANE=r(new n(e.UNIT_Y,0)),n}),i("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,i,r,n,o,a){"use strict";var s=function(r,n,o){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(n,e.ZERO)),i(o)?o=e.clone(o):(o=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(o,.5,o)),this.center=o};s.fromPoints=function(t,r){if(i(r)||(r=new s),!i(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var n=t[0].x,o=t[0].y,a=t[0].z,l=t[0].x,u=t[0].y,c=t[0].z,h=t.length,d=1;h>d;d++){var p=t[d],m=p.x,f=p.y,v=p.z;n=Math.min(m,n),l=Math.max(m,l),o=Math.min(f,o),u=Math.max(f,u),a=Math.min(v,a),c=Math.max(v,c)}var g=r.minimum;g.x=n,g.y=o,g.z=a;var _=r.maximum;_.x=l,_.y=u,_.z=c;var y=e.add(g,_,r.center);return e.multiplyByScalar(y,.5,y),r},s.clone=function(t,r){return i(t)?i(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new s(t.minimum,t.maximum):void 0},s.equals=function(t,r){return t===r||i(t)&&i(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var l=new e;s.intersectPlane=function(t,i){l=e.subtract(t.maximum,t.minimum,l);var r=e.multiplyByScalar(l,.5,l),n=i.normal,a=r.x*Math.abs(n.x)+r.y*Math.abs(n.y)+r.z*Math.abs(n.z),s=e.dot(t.center,n)+i.distance;return s-a>0?o.INSIDE:0>s+a?o.OUTSIDE:o.INTERSECTING};var u=new a(new e,0);return s.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var i=a.fromCartesian4(t,u);return s.intersectPlane(e,i)},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.intersectPlane=function(e){return s.intersectPlane(this,e)},s.prototype.intersect=function(e){return s.intersect(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s}),i("Core/BingMapsApi",["./defined"],function(e){"use strict";var t={};t.defaultKey=void 0;var i=!1;return t.getKey=function(r){return e(r)?r:e(t.defaultKey)?t.defaultKey:(i||(console.log("This application is using Cesium's default Bing Maps key. Please create a new key for the application as soon as possible and prior to deployment by visiting https://www.bingmapsportal.com/, and provide your key to Cesium by setting the Cesium.BingMapsApi.defaultKey property before constructing the CesiumWidget or any other object that uses the Bing Maps API."),i=!0),"Aj1ony_-Typ-KjG9SJWiKSHY23U1KmK7yAmZa9lDmuF2osXWkcZ22VPsqmCt0TCt")},t}),i("Core/BoundingRectangle",["./Cartesian2","./Cartographic","./defaultValue","./defined","./DeveloperError","./GeographicProjection","./Intersect","./Rectangle"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(e,t,r,n){this.x=i(e,0),this.y=i(t,0),this.width=i(r,0),this.height=i(n,0)};l.fromPoints=function(e,t){if(r(t)||(t=new l),!r(e)||0===e.length)return t.x=0,t.y=0,t.width=0,t.height=0,t;for(var i=e.length,n=e[0].x,o=e[0].y,a=e[0].x,s=e[0].y,u=1;i>u;u++){var c=e[u],h=c.x,d=c.y;n=Math.min(h,n),a=Math.max(h,a),o=Math.min(d,o),s=Math.max(d,s)}return t.x=n,t.y=o,t.width=a-n,t.height=s-o,t};var u=new o,c=new t,h=new t;return l.fromRectangle=function(t,n,o){if(r(o)||(o=new l),!r(t))return o.x=0,o.y=0,o.width=0,o.height=0,o;n=i(n,u);var a=n.project(s.southwest(t,c)),d=n.project(s.northeast(t,h));return e.subtract(d,a,d),o.x=a.x,o.y=a.y,o.width=d.x,o.height=d.y,o},l.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new l(e.x,e.y,e.width,e.height):void 0},l.union=function(e,t,i){r(i)||(i=new l);var n=Math.min(e.x,t.x),o=Math.min(e.y,t.y),a=Math.max(e.x+e.width,t.x+t.width),s=Math.max(e.y+e.height,t.y+t.height);return i.x=n,i.y=o,i.width=a-n,i.height=s-o,i},l.expand=function(e,t,i){i=l.clone(e,i);var r=t.x-i.x,n=t.y-i.y;return r>i.width?i.width=r:0>r&&(i.width-=r,i.x=t.x),n>i.height?i.height=n:0>n&&(i.height-=n,i.y=t.y),i},l.intersect=function(e,t){var i=e.x,r=e.y,n=t.x,o=t.y;return i>n+t.width||i+e.widtho+t.height?a.OUTSIDE:a.INTERSECTING},l.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},l.prototype.clone=function(e){return l.clone(this,e)},l.prototype.intersect=function(e){return l.intersect(this,e)},l.prototype.equals=function(e){return l.equals(this,e)},l}),i("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,i){this.start=e(t,0),this.stop=e(i,0)};return t}),i("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,i,r,n){"use strict";var o=function(t,i,r,n){this.x=e(t,0),this.y=e(i,0),this.z=e(r,0),this.w=e(n,0)};o.fromElements=function(e,i,r,n,a){return t(a)?(a.x=e,a.y=i,a.z=r,a.w=n,a):new o(e,i,r,n)},o.fromColor=function(e,i){return t(i)?(i.x=e.red,i.y=e.green,i.z=e.blue,i.w=e.alpha,i):new o(e.red,e.green,e.blue,e.alpha)},o.clone=function(e,i){return t(e)?t(i)?(i.x=e.x,i.y=e.y,i.z=e.z,i.w=e.w,i):new o(e.x,e.y,e.z,e.w):void 0},o.packedLength=4,o.pack=function(t,i,r){r=e(r,0),i[r++]=t.x,i[r++]=t.y,i[r++]=t.z,i[r]=t.w},o.unpack=function(i,r,n){return r=e(r,0),t(n)||(n=new o),n.x=i[r++],n.y=i[r++],n.z=i[r++],n.w=i[r],n},o.fromArray=o.unpack,o.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},o.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},o.minimumByComponent=function(e,t,i){return i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i.z=Math.min(e.z,t.z),i.w=Math.min(e.w,t.w),i},o.maximumByComponent=function(e,t,i){return i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i.z=Math.max(e.z,t.z),i.w=Math.max(e.w,t.w),i},o.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,t){return o.subtract(e,t,a),o.magnitude(a)},o.distanceSquared=function(e,t){return o.subtract(e,t,a),o.magnitudeSquared(a)},o.normalize=function(e,t){var i=o.magnitude(e);return t.x=e.x/i,t.y=e.y/i,t.z=e.z/i,t.w=e.w/i,t},o.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},o.multiplyComponents=function(e,t,i){return i.x=e.x*t.x,i.y=e.y*t.y,i.z=e.z*t.z,i.w=e.w*t.w,i},o.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i.w=e.w+t.w,i},o.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i.w=e.w-t.w,i},o.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i.w=e.w*t,i},o.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i.w=e.w/t,i},o.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},o.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var s=new o;o.lerp=function(e,t,i,r){return o.multiplyByScalar(t,i,s),r=o.multiplyByScalar(e,1-i,r),o.add(s,r,r)};var l=new o;return o.mostOrthogonalAxis=function(e,t){var i=o.normalize(e,l);return o.abs(i,i),t=i.x<=i.y?i.x<=i.z?i.x<=i.w?o.clone(o.UNIT_X,t):o.clone(o.UNIT_W,t):i.z<=i.w?o.clone(o.UNIT_Z,t):o.clone(o.UNIT_W,t):i.y<=i.z?i.y<=i.w?o.clone(o.UNIT_Y,t):o.clone(o.UNIT_W,t):i.z<=i.w?o.clone(o.UNIT_Z,t):o.clone(o.UNIT_W,t)},o.equals=function(e,i){return e===i||t(e)&&t(i)&&e.x===i.x&&e.y===i.y&&e.z===i.z&&e.w===i.w},o.equalsArray=function(e,t,i){return e.x===t[i]&&e.y===t[i+1]&&e.z===t[i+2]&&e.w===t[i+3]},o.equalsEpsilon=function(e,i,r,o){return e===i||t(e)&&t(i)&&n.equalsEpsilon(e.x,i.x,r,o)&&n.equalsEpsilon(e.y,i.y,r,o)&&n.equalsEpsilon(e.z,i.z,r,o)&&n.equalsEpsilon(e.w,i.w,r,o)},o.ZERO=r(new o(0,0,0,0)),o.UNIT_X=r(new o(1,0,0,0)),o.UNIT_Y=r(new o(0,1,0,0)),o.UNIT_Z=r(new o(0,0,1,0)),o.UNIT_W=r(new o(0,0,0,1)),o.prototype.clone=function(e){return o.clone(this,e)},o.prototype.equals=function(e){return o.equals(this,e)},o.prototype.equalsEpsilon=function(e,t,i){return o.equalsEpsilon(this,e,t,i)},o.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},o}),i("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,i,r,n,o){"use strict";function a(e){for(var t=0,i=0;9>i;++i){var r=e[i];t+=r*r}return Math.sqrt(t)}function s(e){for(var t=0,i=0;3>i;++i){var r=e[u.getElementIndex(p[i],d[i])];t+=2*r*r}return Math.sqrt(t)}function l(e,t){for(var i=o.EPSILON15,r=0,n=1,a=0;3>a;++a){var s=Math.abs(e[u.getElementIndex(p[a],d[a])]);s>r&&(n=a,r=s)}var l=1,c=0,h=d[n],m=p[n];if(Math.abs(e[u.getElementIndex(m,h)])>i){var f,v=e[u.getElementIndex(m,m)],g=e[u.getElementIndex(h,h)],_=e[u.getElementIndex(m,h)],y=(v-g)/2/_;f=0>y?-1/(-y+Math.sqrt(1+y*y)):1/(y+Math.sqrt(1+y*y)),l=1/Math.sqrt(1+f*f),c=f*l}return t=u.clone(u.IDENTITY,t),t[u.getElementIndex(h,h)]=t[u.getElementIndex(m,m)]=l,t[u.getElementIndex(m,h)]=c,t[u.getElementIndex(h,m)]=-c,t}var u=function(e,i,r,n,o,a,s,l,u){this[0]=t(e,0),this[1]=t(n,0),this[2]=t(s,0),this[3]=t(i,0),this[4]=t(o,0),this[5]=t(l,0),this[6]=t(r,0),this[7]=t(a,0),this[8]=t(u,0)};u.packedLength=9,u.pack=function(e,i,r){r=t(r,0),i[r++]=e[0],i[r++]=e[1],i[r++]=e[2],i[r++]=e[3],i[r++]=e[4],i[r++]=e[5],i[r++]=e[6],i[r++]=e[7],i[r++]=e[8]},u.unpack=function(e,r,n){return r=t(r,0),i(n)||(n=new u),n[0]=e[r++],n[1]=e[r++],n[2]=e[r++],n[3]=e[r++],n[4]=e[r++],n[5]=e[r++],n[6]=e[r++],n[7]=e[r++],n[8]=e[r++],n},u.clone=function(e,t){return i(e)?i(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new u(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},u.fromArray=function(e,r,n){return r=t(r,0),i(n)||(n=new u),n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],n[8]=e[r+8],n},u.fromColumnMajorArray=function(e,t){return u.clone(e,t)},u.fromRowMajorArray=function(e,t){return i(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new u(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},u.fromQuaternion=function(e,t){var r=e.x*e.x,n=e.x*e.y,o=e.x*e.z,a=e.x*e.w,s=e.y*e.y,l=e.y*e.z,c=e.y*e.w,h=e.z*e.z,d=e.z*e.w,p=e.w*e.w,m=r-s-h+p,f=2*(n-d),v=2*(o+c),g=2*(n+d),_=-r+s-h+p,y=2*(l-a),C=2*(o-c),w=2*(l+a),S=-r-s+h+p; -return i(t)?(t[0]=m,t[1]=g,t[2]=C,t[3]=f,t[4]=_,t[5]=w,t[6]=v,t[7]=y,t[8]=S,t):new u(m,f,v,g,_,y,C,w,S)},u.fromScale=function(e,t){return i(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new u(e.x,0,0,0,e.y,0,0,0,e.z)},u.fromUniformScale=function(e,t){return i(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new u(e,0,0,0,e,0,0,0,e)},u.fromCrossProduct=function(e,t){return i(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new u(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},u.fromRotationX=function(e,t){var r=Math.cos(e),n=Math.sin(e);return i(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=n,t[6]=0,t[7]=-n,t[8]=r,t):new u(1,0,0,0,r,-n,0,n,r)},u.fromRotationY=function(e,t){var r=Math.cos(e),n=Math.sin(e);return i(t)?(t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=1,t[5]=0,t[6]=n,t[7]=0,t[8]=r,t):new u(r,0,n,0,1,0,-n,0,r)},u.fromRotationZ=function(e,t){var r=Math.cos(e),n=Math.sin(e);return i(t)?(t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new u(r,-n,0,n,r,0,0,0,1)},u.toArray=function(e,t){return i(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},u.getElementIndex=function(e,t){return 3*e+t},u.getColumn=function(e,t,i){var r=3*t,n=e[r],o=e[r+1],a=e[r+2];return i.x=n,i.y=o,i.z=a,i},u.setColumn=function(e,t,i,r){r=u.clone(e,r);var n=3*t;return r[n]=i.x,r[n+1]=i.y,r[n+2]=i.z,r},u.getRow=function(e,t,i){var r=e[t],n=e[t+3],o=e[t+6];return i.x=r,i.y=n,i.z=o,i},u.setRow=function(e,t,i,r){return r=u.clone(e,r),r[t]=i.x,r[t+3]=i.y,r[t+6]=i.z,r};var c=new e;u.getScale=function(t,i){return i.x=e.magnitude(e.fromElements(t[0],t[1],t[2],c)),i.y=e.magnitude(e.fromElements(t[3],t[4],t[5],c)),i.z=e.magnitude(e.fromElements(t[6],t[7],t[8],c)),i};var h=new e;u.getMaximumScale=function(t){return u.getScale(t,h),e.maximumComponent(h)},u.multiply=function(e,t,i){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],n=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],o=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],a=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],s=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],l=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],u=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],c=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],h=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return i[0]=r,i[1]=n,i[2]=o,i[3]=a,i[4]=s,i[5]=l,i[6]=u,i[7]=c,i[8]=h,i},u.add=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i},u.subtract=function(e,t,i){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i},u.multiplyByVector=function(e,t,i){var r=t.x,n=t.y,o=t.z,a=e[0]*r+e[3]*n+e[6]*o,s=e[1]*r+e[4]*n+e[7]*o,l=e[2]*r+e[5]*n+e[8]*o;return i.x=a,i.y=s,i.z=l,i},u.multiplyByScalar=function(e,t,i){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i},u.multiplyByScale=function(e,t,i){return i[0]=e[0]*t.x,i[1]=e[1]*t.x,i[2]=e[2]*t.x,i[3]=e[3]*t.y,i[4]=e[4]*t.y,i[5]=e[5]*t.y,i[6]=e[6]*t.z,i[7]=e[7]*t.z,i[8]=e[8]*t.z,i},u.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},u.transpose=function(e,t){var i=e[0],r=e[3],n=e[6],o=e[1],a=e[4],s=e[7],l=e[2],u=e[5],c=e[8];return t[0]=i,t[1]=r,t[2]=n,t[3]=o,t[4]=a,t[5]=s,t[6]=l,t[7]=u,t[8]=c,t};var d=[1,0,0],p=[2,2,1],m=new u,f=new u;return u.computeEigenDecomposition=function(e,t){var r=o.EPSILON20,n=10,c=0,h=0;i(t)||(t={});for(var d=t.unitary=u.clone(u.IDENTITY,t.unitary),p=t.diagonal=u.clone(e,t.diagonal),v=r*a(p);n>h&&s(p)>v;)l(p,m),u.transpose(m,f),u.multiply(p,m,p),u.multiply(f,p,p),u.multiply(d,m,d),++c>2&&(++h,c=0);return t},u.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},u.determinant=function(e){var t=e[0],i=e[3],r=e[6],n=e[1],o=e[4],a=e[7],s=e[2],l=e[5],u=e[8];return t*(o*u-l*a)+n*(l*r-i*u)+s*(i*a-o*r)},u.inverse=function(e,t){var i=e[0],n=e[1],a=e[2],s=e[3],l=e[4],c=e[5],h=e[6],d=e[7],p=e[8],m=u.determinant(e);if(Math.abs(m)<=o.EPSILON15)throw new r("matrix is not invertible");t[0]=l*p-d*c,t[1]=d*a-n*p,t[2]=n*c-l*a,t[3]=h*c-s*p,t[4]=i*p-h*a,t[5]=s*a-i*c,t[6]=s*d-h*l,t[7]=h*n-i*d,t[8]=i*l-s*n;var f=1/m;return u.multiplyByScalar(t,f,t)},u.equals=function(e,t){return e===t||i(e)&&i(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},u.equalsEpsilon=function(e,t,r){return e===t||i(e)&&i(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},u.IDENTITY=n(new u(1,0,0,0,1,0,0,0,1)),u.ZERO=n(new u(0,0,0,0,0,0,0,0,0)),u.COLUMN0ROW0=0,u.COLUMN0ROW1=1,u.COLUMN0ROW2=2,u.COLUMN1ROW0=3,u.COLUMN1ROW1=4,u.COLUMN1ROW2=5,u.COLUMN2ROW0=6,u.COLUMN2ROW1=7,u.COLUMN2ROW2=8,u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u.equalsArray=function(e,t,i){return e[0]===t[i]&&e[1]===t[i+1]&&e[2]===t[i+2]&&e[3]===t[i+3]&&e[4]===t[i+4]&&e[5]===t[i+5]&&e[6]===t[i+6]&&e[7]===t[i+7]&&e[8]===t[i+8]},u.prototype.equalsEpsilon=function(e,t){return u.equalsEpsilon(this,e,t)},u.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},u}),i("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,i,r,n,o,a,s,l){"use strict";var u=function(e,t,r,n,o,a,s,l,u,c,h,d,p,m,f,v){this[0]=i(e,0),this[1]=i(o,0),this[2]=i(u,0),this[3]=i(p,0),this[4]=i(t,0),this[5]=i(a,0),this[6]=i(c,0),this[7]=i(m,0),this[8]=i(r,0),this[9]=i(s,0),this[10]=i(h,0),this[11]=i(f,0),this[12]=i(n,0),this[13]=i(l,0),this[14]=i(d,0),this[15]=i(v,0)};u.packedLength=16,u.pack=function(e,t,r){r=i(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},u.unpack=function(e,t,n){return t=i(t,0),r(n)||(n=new u),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n},u.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new u(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},u.fromArray=u.unpack,u.fromColumnMajorArray=function(e,t){return u.clone(e,t)},u.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new u(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},u.fromRotationTranslation=function(t,n,o){return n=i(n,e.ZERO),r(o)?(o[0]=t[0],o[1]=t[1],o[2]=t[2],o[3]=0,o[4]=t[3],o[5]=t[4],o[6]=t[5],o[7]=0,o[8]=t[6],o[9]=t[7],o[10]=t[8],o[11]=0,o[12]=n.x,o[13]=n.y,o[14]=n.z,o[15]=1,o):new u(t[0],t[3],t[6],n.x,t[1],t[4],t[7],n.y,t[2],t[5],t[8],n.z,0,0,0,1)},u.fromTranslationQuaternionRotationScale=function(e,t,i,n){r(n)||(n=new u);var o=i.x,a=i.y,s=i.z,l=t.x*t.x,c=t.x*t.y,h=t.x*t.z,d=t.x*t.w,p=t.y*t.y,m=t.y*t.z,f=t.y*t.w,v=t.z*t.z,g=t.z*t.w,_=t.w*t.w,y=l-p-v+_,C=2*(c-g),w=2*(h+f),S=2*(c+g),E=-l+p-v+_,b=2*(m-d),x=2*(h-f),T=2*(m+d),P=-l-p+v+_;return n[0]=y*o,n[1]=S*o,n[2]=x*o,n[3]=0,n[4]=C*a,n[5]=E*a,n[6]=T*a,n[7]=0,n[8]=w*s,n[9]=b*s,n[10]=P*s,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n},u.fromTranslation=function(e,t){return u.fromRotationTranslation(s.IDENTITY,e,t)},u.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new u(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},u.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new u(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var c=new e,h=new e,d=new e;u.fromCamera=function(t,i){var n=t.eye,o=t.target,a=t.up;e.normalize(e.subtract(o,n,c),c),e.normalize(e.cross(c,a,h),h),e.normalize(e.cross(h,c,d),d);var s=h.x,l=h.y,p=h.z,m=c.x,f=c.y,v=c.z,g=d.x,_=d.y,y=d.z,C=n.x,w=n.y,S=n.z,E=s*-C+l*-w+p*-S,b=g*-C+_*-w+y*-S,x=m*C+f*w+v*S;return r(i)?(i[0]=s,i[1]=g,i[2]=-m,i[3]=0,i[4]=l,i[5]=_,i[6]=-f,i[7]=0,i[8]=p,i[9]=y,i[10]=-v,i[11]=0,i[12]=E,i[13]=b,i[14]=x,i[15]=1,i):new u(s,l,p,E,g,_,y,b,-m,-f,-v,x,0,0,0,1)},u.computePerspectiveFieldOfView=function(e,t,i,r,n){var o=Math.tan(.5*e),a=1/o,s=a/t,l=(r+i)/(i-r),u=2*r*i/(i-r);return n[0]=s,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=a,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=l,n[11]=-1,n[12]=0,n[13]=0,n[14]=u,n[15]=0,n},u.computeOrthographicOffCenter=function(e,t,i,r,n,o,a){var s=1/(t-e),l=1/(r-i),u=1/(o-n),c=-(t+e)*s,h=-(r+i)*l,d=-(o+n)*u;return s*=2,l*=2,u*=-2,a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=l,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=u,a[11]=0,a[12]=c,a[13]=h,a[14]=d,a[15]=1,a},u.computePerspectiveOffCenter=function(e,t,i,r,n,o,a){var s=2*n/(t-e),l=2*n/(r-i),u=(t+e)/(t-e),c=(r+i)/(r-i),h=-(o+n)/(o-n),d=-1,p=-2*o*n/(o-n);return a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=l,a[6]=0,a[7]=0,a[8]=u,a[9]=c,a[10]=h,a[11]=d,a[12]=0,a[13]=0,a[14]=p,a[15]=0,a},u.computeInfinitePerspectiveOffCenter=function(e,t,i,r,n,o){var a=2*n/(t-e),s=2*n/(r-i),l=(t+e)/(t-e),u=(r+i)/(r-i),c=-1,h=-1,d=-2*n;return o[0]=a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=l,o[9]=u,o[10]=c,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},u.computeViewportTransformation=function(e,t,r,n){e=i(e,i.EMPTY_OBJECT);var o=i(e.x,0),a=i(e.y,0),s=i(e.width,0),l=i(e.height,0);t=i(t,0),r=i(r,1);var u=.5*s,c=.5*l,h=.5*(r-t),d=u,p=c,m=h,f=o+u,v=a+c,g=t+h,_=1;return n[0]=d,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=p,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=m,n[11]=0,n[12]=f,n[13]=v,n[14]=g,n[15]=_,n},u.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},u.getElementIndex=function(e,t){return 4*e+t},u.getColumn=function(e,t,i){var r=4*t,n=e[r],o=e[r+1],a=e[r+2],s=e[r+3];return i.x=n,i.y=o,i.z=a,i.w=s,i},u.setColumn=function(e,t,i,r){r=u.clone(e,r);var n=4*t;return r[n]=i.x,r[n+1]=i.y,r[n+2]=i.z,r[n+3]=i.w,r},u.setTranslation=function(e,t,i){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=e[15],i},u.getRow=function(e,t,i){var r=e[t],n=e[t+4],o=e[t+8],a=e[t+12];return i.x=r,i.y=n,i.z=o,i.w=a,i},u.setRow=function(e,t,i,r){return r=u.clone(e,r),r[t]=i.x,r[t+4]=i.y,r[t+8]=i.z,r[t+12]=i.w,r};var p=new e;u.getScale=function(t,i){return i.x=e.magnitude(e.fromElements(t[0],t[1],t[2],p)),i.y=e.magnitude(e.fromElements(t[4],t[5],t[6],p)),i.z=e.magnitude(e.fromElements(t[8],t[9],t[10],p)),i};var m=new e;u.getMaximumScale=function(t){return u.getScale(t,m),e.maximumComponent(m)},u.multiply=function(e,t,i){var r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],d=e[9],p=e[10],m=e[11],f=e[12],v=e[13],g=e[14],_=e[15],y=t[0],C=t[1],w=t[2],S=t[3],E=t[4],b=t[5],x=t[6],T=t[7],P=t[8],A=t[9],D=t[10],M=t[11],I=t[12],O=t[13],R=t[14],L=t[15],N=r*y+s*C+h*w+f*S,F=n*y+l*C+d*w+v*S,B=o*y+u*C+p*w+g*S,z=a*y+c*C+m*w+_*S,k=r*E+s*b+h*x+f*T,V=n*E+l*b+d*x+v*T,U=o*E+u*b+p*x+g*T,W=a*E+c*b+m*x+_*T,G=r*P+s*A+h*D+f*M,H=n*P+l*A+d*D+v*M,q=o*P+u*A+p*D+g*M,j=a*P+c*A+m*D+_*M,Y=r*I+s*O+h*R+f*L,X=n*I+l*O+d*R+v*L,Z=o*I+u*O+p*R+g*L,J=a*I+c*O+m*R+_*L;return i[0]=N,i[1]=F,i[2]=B,i[3]=z,i[4]=k,i[5]=V,i[6]=U,i[7]=W,i[8]=G,i[9]=H,i[10]=q,i[11]=j,i[12]=Y,i[13]=X,i[14]=Z,i[15]=J,i},u.add=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i},u.subtract=function(e,t,i){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i},u.multiplyTransformation=function(e,t,i){var r=e[0],n=e[1],o=e[2],a=e[4],s=e[5],l=e[6],u=e[8],c=e[9],h=e[10],d=e[12],p=e[13],m=e[14],f=t[0],v=t[1],g=t[2],_=t[4],y=t[5],C=t[6],w=t[8],S=t[9],E=t[10],b=t[12],x=t[13],T=t[14],P=r*f+a*v+u*g,A=n*f+s*v+c*g,D=o*f+l*v+h*g,M=r*_+a*y+u*C,I=n*_+s*y+c*C,O=o*_+l*y+h*C,R=r*w+a*S+u*E,L=n*w+s*S+c*E,N=o*w+l*S+h*E,F=r*b+a*x+u*T+d,B=n*b+s*x+c*T+p,z=o*b+l*x+h*T+m;return i[0]=P,i[1]=A,i[2]=D,i[3]=0,i[4]=M,i[5]=I,i[6]=O,i[7]=0,i[8]=R,i[9]=L,i[10]=N,i[11]=0,i[12]=F,i[13]=B,i[14]=z,i[15]=1,i},u.multiplyByMatrix3=function(e,t,i){var r=e[0],n=e[1],o=e[2],a=e[4],s=e[5],l=e[6],u=e[8],c=e[9],h=e[10],d=t[0],p=t[1],m=t[2],f=t[3],v=t[4],g=t[5],_=t[6],y=t[7],C=t[8],w=r*d+a*p+u*m,S=n*d+s*p+c*m,E=o*d+l*p+h*m,b=r*f+a*v+u*g,x=n*f+s*v+c*g,T=o*f+l*v+h*g,P=r*_+a*y+u*C,A=n*_+s*y+c*C,D=o*_+l*y+h*C;return i[0]=w,i[1]=S,i[2]=E,i[3]=0,i[4]=b,i[5]=x,i[6]=T,i[7]=0,i[8]=P,i[9]=A,i[10]=D,i[11]=0,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},u.multiplyByTranslation=function(e,t,i){var r=t.x,n=t.y,o=t.z,a=r*e[0]+n*e[4]+o*e[8]+e[12],s=r*e[1]+n*e[5]+o*e[9]+e[13],l=r*e[2]+n*e[6]+o*e[10]+e[14];return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=a,i[13]=s,i[14]=l,i[15]=e[15],i};var f=new e;u.multiplyByUniformScale=function(e,t,i){return f.x=t,f.y=t,f.z=t,u.multiplyByScale(e,f,i)},u.multiplyByScale=function(e,t,i){var r=t.x,n=t.y,o=t.z;return 1===r&&1===n&&1===o?u.clone(e,i):(i[0]=r*e[0],i[1]=r*e[1],i[2]=r*e[2],i[3]=0,i[4]=n*e[4],i[5]=n*e[5],i[6]=n*e[6],i[7]=0,i[8]=o*e[8],i[9]=o*e[9],i[10]=o*e[10],i[11]=0,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=1,i)},u.multiplyByVector=function(e,t,i){var r=t.x,n=t.y,o=t.z,a=t.w,s=e[0]*r+e[4]*n+e[8]*o+e[12]*a,l=e[1]*r+e[5]*n+e[9]*o+e[13]*a,u=e[2]*r+e[6]*n+e[10]*o+e[14]*a,c=e[3]*r+e[7]*n+e[11]*o+e[15]*a;return i.x=s,i.y=l,i.z=u,i.w=c,i},u.multiplyByPointAsVector=function(e,t,i){var r=t.x,n=t.y,o=t.z,a=e[0]*r+e[4]*n+e[8]*o,s=e[1]*r+e[5]*n+e[9]*o,l=e[2]*r+e[6]*n+e[10]*o;return i.x=a,i.y=s,i.z=l,i},u.multiplyByPoint=function(e,t,i){var r=t.x,n=t.y,o=t.z,a=e[0]*r+e[4]*n+e[8]*o+e[12],s=e[1]*r+e[5]*n+e[9]*o+e[13],l=e[2]*r+e[6]*n+e[10]*o+e[14];return i.x=a,i.y=s,i.z=l,i},u.multiplyByScalar=function(e,t,i){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i},u.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},u.transpose=function(e,t){var i=e[1],r=e[2],n=e[3],o=e[6],a=e[7],s=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[10]=e[10],t[11]=e[14],t[12]=n,t[13]=a,t[14]=s,t[15]=e[15],t},u.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},u.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},u.equalsEpsilon=function(e,t,i){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=i&&Math.abs(e[1]-t[1])<=i&&Math.abs(e[2]-t[2])<=i&&Math.abs(e[3]-t[3])<=i&&Math.abs(e[4]-t[4])<=i&&Math.abs(e[5]-t[5])<=i&&Math.abs(e[6]-t[6])<=i&&Math.abs(e[7]-t[7])<=i&&Math.abs(e[8]-t[8])<=i&&Math.abs(e[9]-t[9])<=i&&Math.abs(e[10]-t[10])<=i&&Math.abs(e[11]-t[11])<=i&&Math.abs(e[12]-t[12])<=i&&Math.abs(e[13]-t[13])<=i&&Math.abs(e[14]-t[14])<=i&&Math.abs(e[15]-t[15])<=i},u.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},u.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var v=new s,g=new s,_=new t,y=new t(0,0,0,1);return u.inverse=function(e,i){if(s.equalsEpsilon(u.getRotation(e,v),g,a.EPSILON7)&&t.equals(u.getRow(e,3,_),y))return i[0]=0,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=0,i[11]=0,i[12]=-e[12],i[13]=-e[13],i[14]=-e[14],i[15]=1,i;var r=e[0],n=e[4],o=e[8],c=e[12],h=e[1],d=e[5],p=e[9],m=e[13],f=e[2],C=e[6],w=e[10],S=e[14],E=e[3],b=e[7],x=e[11],T=e[15],P=w*T,A=S*x,D=C*T,M=S*b,I=C*x,O=w*b,R=f*T,L=S*E,N=f*x,F=w*E,B=f*b,z=C*E,k=P*d+M*p+I*m-(A*d+D*p+O*m),V=A*h+R*p+F*m-(P*h+L*p+N*m),U=D*h+L*d+B*m-(M*h+R*d+z*m),W=O*h+N*d+z*p-(I*h+F*d+B*p),G=A*n+D*o+O*c-(P*n+M*o+I*c),H=P*r+L*o+N*c-(A*r+R*o+F*c),q=M*r+R*n+z*c-(D*r+L*n+B*c),j=I*r+F*n+B*o-(O*r+N*n+z*o);P=o*m,A=c*p,D=n*m,M=c*d,I=n*p,O=o*d,R=r*m,L=c*h,N=r*p,F=o*h,B=r*d,z=n*h;var Y=P*b+M*x+I*T-(A*b+D*x+O*T),X=A*E+R*x+F*T-(P*E+L*x+N*T),Z=D*E+L*b+B*T-(M*E+R*b+z*T),J=O*E+N*b+z*x-(I*E+F*b+B*x),Q=D*w+O*S+A*C-(I*S+P*C+M*w),K=N*S+P*f+L*w-(R*w+F*S+A*f),$=R*C+z*S+M*f-(B*S+D*f+L*C),et=B*w+I*f+F*C-(N*C+z*w+O*f),tt=r*k+n*V+o*U+c*W;if(Math.abs(tt)d;d++){e.clone(t[d],n);var T=n.x,P=n.y,A=n.z;Tl.x&&e.clone(n,l),Pu.y&&e.clone(n,u),Ac.z&&e.clone(n,c)}var D=e.magnitudeSquared(e.subtract(l,o,w)),M=e.magnitudeSquared(e.subtract(u,a,w)),I=e.magnitudeSquared(e.subtract(c,s,w)),O=o,R=l,L=D;M>L&&(L=M,O=a,R=u),I>L&&(L=I,O=s,R=c);var N=S;N.x=.5*(O.x+R.x),N.y=.5*(O.y+R.y),N.z=.5*(O.z+R.z);var F=e.magnitudeSquared(e.subtract(R,N,w)),B=Math.sqrt(F),z=E;z.x=o.x,z.y=a.y,z.z=s.z;var k=b;k.x=l.x,k.y=u.y,k.z=c.z;var V=e.multiplyByScalar(e.add(z,k,w),.5,x),U=0;for(d=0;h>d;d++){e.clone(t[d],n);var W=e.magnitude(e.subtract(n,V,w));W>U&&(U=W);var G=e.magnitudeSquared(e.subtract(n,N,w));if(G>F){var H=Math.sqrt(G);B=.5*(B+H),F=B*B;var q=H-B;N.x=(B*N.x+q*n.x)/H,N.y=(B*N.y+q*n.y)/H,N.z=(B*N.z+q*n.z)/H}}return U>B?(e.clone(N,i.center),i.radius=B):(e.clone(V,i.center),i.radius=U),i};var T=new s,P=new e,A=new e,D=new t,M=new t;p.fromRectangle2D=function(e,t,i){return p.fromRectangleWithHeights2D(e,t,0,0,i)},p.fromRectangleWithHeights2D=function(t,n,o,a,s){if(r(s)||(s=new p),!r(t))return s.center=e.clone(e.ZERO,s.center),s.radius=0,s;n=i(n,T),d.southwest(t,D),D.height=o,d.northeast(t,M),M.height=a;var l=n.project(D,P),u=n.project(M,A),c=u.x-l.x,h=u.y-l.y,m=u.z-l.z;s.radius=.5*Math.sqrt(c*c+h*h+m*m);var f=s.center;return f.x=l.x+.5*c,f.y=l.y+.5*h,f.z=l.z+.5*m,s};var I=[];p.fromRectangle3D=function(e,t,n,o){t=i(t,a.WGS84),n=i(n,0);var s;return r(e)&&(s=d.subsample(e,t,n,I)),p.fromPoints(s,o)},p.fromVertices=function(t,n,o,a){if(r(a)||(a=new p),!r(t)||0===t.length)return a.center=e.clone(e.ZERO,a.center),a.radius=0,a;n=i(n,e.ZERO),o=i(o,3);var s=C;s.x=t[0]+n.x,s.y=t[1]+n.y,s.z=t[2]+n.z;for(var l=e.clone(s,m),u=e.clone(s,f),c=e.clone(s,v),h=e.clone(s,g),d=e.clone(s,_),T=e.clone(s,y),P=t.length,A=0;P>A;A+=o){var D=t[A]+n.x,M=t[A+1]+n.y,I=t[A+2]+n.z;s.x=D,s.y=M,s.z=I,Dh.x&&e.clone(s,h),Md.y&&e.clone(s,d),IT.z&&e.clone(s,T)}var O=e.magnitudeSquared(e.subtract(h,l,w)),R=e.magnitudeSquared(e.subtract(d,u,w)),L=e.magnitudeSquared(e.subtract(T,c,w)),N=l,F=h,B=O;R>B&&(B=R,N=u,F=d),L>B&&(B=L,N=c,F=T);var z=S;z.x=.5*(N.x+F.x),z.y=.5*(N.y+F.y),z.z=.5*(N.z+F.z);var k=e.magnitudeSquared(e.subtract(F,z,w)),V=Math.sqrt(k),U=E;U.x=l.x,U.y=u.y,U.z=c.z;var W=b;W.x=h.x,W.y=d.y,W.z=T.z;var G=e.multiplyByScalar(e.add(U,W,w),.5,x),H=0;for(A=0;P>A;A+=o){s.x=t[A]+n.x,s.y=t[A+1]+n.y,s.z=t[A+2]+n.z;var q=e.magnitude(e.subtract(s,G,w));q>H&&(H=q);var j=e.magnitudeSquared(e.subtract(s,z,w));if(j>k){var Y=Math.sqrt(j);V=.5*(V+Y),k=V*V;var X=Y-V;z.x=(V*z.x+X*s.x)/Y,z.y=(V*z.y+X*s.y)/Y,z.z=(V*z.z+X*s.z)/Y}}return H>V?(e.clone(z,a.center),a.radius=V):(e.clone(G,a.center),a.radius=H),a},p.fromCornerPoints=function(t,i,n){r(n)||(n=new p);var o=n.center;return e.add(t,i,o),e.multiplyByScalar(o,.5,o),n.radius=e.distance(o,i),n},p.fromEllipsoid=function(t,i){return r(i)||(i=new p),e.clone(e.ZERO,i.center),i.radius=t.maximumRadius,i};var O=new e;p.fromBoundingSpheres=function(t,i){if(r(i)||(i=new p),!r(t)||0===t.length)return i.center=e.clone(e.ZERO,i.center),i.radius=0,i;var n=t.length;if(1===n)return p.clone(t[0],i);if(2===n)return p.union(t[0],t[1],i);for(var o=[],a=0;n>a;a++)o.push(t[a].center);i=p.fromPoints(o,i);var s=i.center,l=i.radius;for(a=0;n>a;a++){var u=t[a];l=Math.max(l,e.distance(s,u.center,O)+u.radius)}return i.radius=l,i},p.clone=function(t,i){return r(t)?r(i)?(i.center=e.clone(t.center,i.center),i.radius=t.radius,i):new p(t.center,t.radius):void 0},p.packedLength=4,p.pack=function(e,t,r){r=i(r,0);var n=e.center;t[r++]=n.x,t[r++]=n.y,t[r++]=n.z,t[r]=e.radius},p.unpack=function(e,t,n){t=i(t,0),r(n)||(n=new p);var o=n.center;return o.x=e[t++],o.y=e[t++],o.z=e[t++],n.radius=e[t],n};var R=new e,L=new e;p.union=function(t,i,n){r(n)||(n=new p);var o=t.center,a=t.radius,s=i.center,l=i.radius,u=e.subtract(s,o,R),c=e.magnitude(u);if(a>=c+l)return t.clone(n),n;if(l>=c+a)return i.clone(n),n;var h=.5*(a+c+l),d=e.multiplyByScalar(u,(-a+h)/c,L);return e.add(d,o,d),e.clone(d,n.center),n.radius=h,n};var N=new e;p.expand=function(t,i,r){r=p.clone(t,r);var n=e.magnitude(e.subtract(i,r.center,N));return n>r.radius&&(r.radius=n),r},p.intersectPlane=function(t,i){var r=t.center,n=t.radius,o=i.normal,a=e.dot(o,r)+i.distance;return-n>a?l.OUTSIDE:n>a?l.INTERSECTING:l.INSIDE};var F=new h(new e,0);p.intersect=function(e,t){n("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var i=h.fromCartesian4(t,F);return p.intersectPlane(e,i)},p.transform=function(e,t,i){return r(i)||(i=new p),i.center=c.multiplyByPoint(t,e.center,i.center),i.radius=c.getMaximumScale(t)*e.radius,i};var B=new e;p.distanceSquaredTo=function(t,i){var r=e.subtract(t.center,i,B);return e.magnitudeSquared(r)-t.radius*t.radius},p.transformWithoutScale=function(e,t,i){return r(i)||(i=new p),i.center=c.multiplyByPoint(t,e.center,i.center),i.radius=e.radius,i};var z=new e;p.computePlaneDistances=function(t,i,n,o){r(o)||(o=new u);var a=e.subtract(t.center,i,z),s=e.multiplyByScalar(n,e.dot(n,a),z),l=e.magnitude(s);return o.start=l-t.radius,o.stop=l+t.radius,o};for(var k=new e,V=new e,U=new e,W=new e,G=new e,H=new t,q=new Array(8),j=0;8>j;++j)q[j]=new e;var Y=new s;return p.projectTo2D=function(t,r,n){r=i(r,Y);var o=r.ellipsoid,a=t.center,s=t.radius,l=o.geodeticSurfaceNormal(a,k),u=e.cross(e.UNIT_Z,l,V);e.normalize(u,u);var c=e.cross(l,u,U);e.normalize(c,c),e.multiplyByScalar(l,s,l),e.multiplyByScalar(c,s,c),e.multiplyByScalar(u,s,u);var h=e.negate(c,G),d=e.negate(u,W),m=q,f=m[0];e.add(l,c,f),e.add(f,u,f),f=m[1],e.add(l,c,f),e.add(f,d,f),f=m[2],e.add(l,h,f),e.add(f,d,f),f=m[3],e.add(l,h,f),e.add(f,u,f),e.negate(l,l),f=m[4],e.add(l,c,f),e.add(f,u,f),f=m[5],e.add(l,c,f),e.add(f,d,f),f=m[6],e.add(l,h,f),e.add(f,d,f),f=m[7],e.add(l,h,f),e.add(f,u,f);for(var v=m.length,g=0;v>g;++g){var _=m[g];e.add(a,_,_);var y=o.cartesianToCartographic(_,H);r.project(y,_)}n=p.fromPoints(m,n),a=n.center;var C=a.x,w=a.y,S=a.z;return a.x=S,a.y=C,a.z=w,n},p.equals=function(t,i){return t===i||r(t)&&r(i)&&e.equals(t.center,i.center)&&t.radius===i.radius},p.prototype.intersectPlane=function(e){return p.intersectPlane(this,e)},p.prototype.intersect=function(e){return p.intersect(this,e)},p.prototype.equals=function(e){return p.equals(this,e)},p.prototype.clone=function(e){return p.clone(this,e)},p}),i("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var i,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},n={};return t(n,{element:{get:function(){return n.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return n.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return n.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return n.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return n.supportsFullscreen()?null!==n.element:void 0}}}),n.supportsFullscreen=function(){if(e(i))return i;i=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",i=!0;for(var n,o=["webkit","moz","o","ms","khtml"],a=0,s=o.length;s>a;++a){var l=o[a];n=l+"RequestFullscreen","function"==typeof t[n]?(r.requestFullscreen=n,i=!0):(n=l+"RequestFullScreen","function"==typeof t[n]&&(r.requestFullscreen=n,i=!0)),n=l+"ExitFullscreen","function"==typeof document[n]?r.exitFullscreen=n:(n=l+"CancelFullScreen","function"==typeof document[n]&&(r.exitFullscreen=n)),n=l+"FullscreenEnabled",e(document[n])?r.fullscreenEnabled=n:(n=l+"FullScreenEnabled",e(document[n])&&(r.fullscreenEnabled=n)),n=l+"FullscreenElement",e(document[n])?r.fullscreenElement=n:(n=l+"FullScreenElement",e(document[n])&&(r.fullscreenElement=n)),n=l+"fullscreenchange",e(document["on"+n])&&("ms"===l&&(n="MSFullscreenChange"),r.fullscreenchange=n),n=l+"fullscreenerror",e(document["on"+n])&&("ms"===l&&(n="MSFullscreenError"),r.fullscreenerror=n)}return i},n.requestFullscreen=function(e){n.supportsFullscreen()&&e[r.requestFullscreen]()},n.exitFullscreen=function(){n.supportsFullscreen()&&document[r.exitFullscreen]()},n}),i("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,i){"use strict";function r(e){for(var t=e.split("."),i=0,r=t.length;r>i;++i)t[i]=parseInt(t[i],10);return t}function n(){if(!t(v)){v=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(v=!0,g=r(e[1]))}return v}function o(){return n()&&g}function a(){if(!t(_)&&(_=!1,!n()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(_=!0,y=r(e[1]))}return _}function s(){return a()&&y}function l(){if(!t(C)){C=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(C=!0,w=r(e[1]),w.isNightly=!!e[2])}return C}function u(){return l()&&w}function c(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,E=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,E=r(e[1])))}return S}function h(){return c()&&E}function d(){if(!t(b)){b=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(b=!0,x=r(e[1]))}return b}function p(){return t(T)||(T=/Windows/i.test(navigator.appVersion)),T}function m(){return d()&&x}function f(){return t(P)||(P=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),P}var v,g,_,y,C,w,S,E,b,x,T,P,A={isChrome:n,chromeVersion:o,isSafari:a,safariVersion:s,isWebkit:l,webkitVersion:u,isInternetExplorer:c,internetExplorerVersion:h,isFirefox:d,firefoxVersion:m,isWindows:p,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:f};return A.supportsFullscreen=function(){return i.supportsFullscreen()},A.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},A.supportsWebWorkers=function(){return"undefined"!=typeof Worker},A}),i("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,i,r,n){"use strict";if(!r.supportsTypedArrays())return{};var o={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return o.getSizeInBytes=function(e){switch(e){case o.BYTE:return Int8Array.BYTES_PER_ELEMENT;case o.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case o.SHORT:return Int16Array.BYTES_PER_ELEMENT;case o.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case o.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case o.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new i("componentDatatype is not a valid value.")}},o.fromTypedArray=function(e){return e instanceof Int8Array?o.BYTE:e instanceof Uint8Array?o.UNSIGNED_BYTE:e instanceof Int16Array?o.SHORT:e instanceof Uint16Array?o.UNSIGNED_SHORT:e instanceof Float32Array?o.FLOAT:e instanceof Float64Array?o.DOUBLE:void 0},o.validate=function(e){return t(e)&&(e===o.BYTE||e===o.UNSIGNED_BYTE||e===o.SHORT||e===o.UNSIGNED_SHORT||e===o.FLOAT||e===o.DOUBLE) -},o.createTypedArray=function(e,t){switch(e){case o.BYTE:return new Int8Array(t);case o.UNSIGNED_BYTE:return new Uint8Array(t);case o.SHORT:return new Int16Array(t);case o.UNSIGNED_SHORT:return new Uint16Array(t);case o.FLOAT:return new Float32Array(t);case o.DOUBLE:return new Float64Array(t);default:throw new i("componentDatatype is not a valid value.")}},o.createArrayBufferView=function(t,r,n,a){switch(n=e(n,0),a=e(a,(r.byteLength-n)/o.getSizeInBytes(t)),t){case o.BYTE:return new Int8Array(r,n,a);case o.UNSIGNED_BYTE:return new Uint8Array(r,n,a);case o.SHORT:return new Int16Array(r,n,a);case o.UNSIGNED_SHORT:return new Uint16Array(r,n,a);case o.FLOAT:return new Float32Array(r,n,a);case o.DOUBLE:return new Float64Array(r,n,a);default:throw new i("componentDatatype is not a valid value.")}},n(o)}),i("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),i("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),i("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,i,r,n){"use strict";var o=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,n.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return o.computeNumberOfVertices=function(e){var r=-1;for(var n in e.attributes)if(e.attributes.hasOwnProperty(n)&&t(e.attributes[n])&&t(e.attributes[n].values)){var o=e.attributes[n],a=o.values.length/o.componentsPerAttribute;if(r!==a&&-1!==r)throw new i("All attribute lists must have the same number of attributes.");r=a}return r},o}),i("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),i("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),i("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,i,r){"use strict";var n=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return n.POSITION_ONLY=r(new n({position:!0})),n.POSITION_AND_NORMAL=r(new n({position:!0,normal:!0})),n.POSITION_NORMAL_AND_ST=r(new n({position:!0,normal:!0,st:!0})),n.POSITION_AND_ST=r(new n({position:!0,st:!0})),n.POSITION_AND_COLOR=r(new n({position:!0,color:!0})),n.ALL=r(new n({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),n.DEFAULT=n.POSITION_NORMAL_AND_ST,n.packedLength=6,n.pack=function(t,i,r){r=e(r,0),i[r++]=t.position?1:0,i[r++]=t.normal?1:0,i[r++]=t.st?1:0,i[r++]=t.binormal?1:0,i[r++]=t.tangent?1:0,i[r++]=t.color?1:0},n.unpack=function(i,r,o){return r=e(r,0),t(o)||(o=new n),o.position=1===i[r++],o.normal=1===i[r++],o.st=1===i[r++],o.binormal=1===i[r++],o.tangent=1===i[r++],o.color=1===i[r++],o},n.clone=function(e,i){return t(e)?(t(i)||(i=new n),i.position=e.position,i.normal=e.normal,i.st=e.st,i.binormal=e.binormal,i.tangent=e.tangent,i.color=e.color,i):void 0},n}),i("Core/BoxGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Geometry","./GeometryAttribute","./GeometryAttributes","./PrimitiveType","./VertexFormat"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";var h=new t,d=function(e){e=r(e,r.EMPTY_OBJECT);var i=e.minimumCorner,n=e.maximumCorner,o=r(e.vertexFormat,c.DEFAULT);this._minimumCorner=t.clone(i),this._maximumCorner=t.clone(n),this._vertexFormat=o,this._workerName="createBoxGeometry"};d.fromDimensions=function(e){e=r(e,r.EMPTY_OBJECT);var i=e.dimensions,n=t.multiplyByScalar(i,.5,new t),o=t.negate(n,new t),a=n,s={minimumCorner:o,maximumCorner:a,vertexFormat:e.vertexFormat};return new d(s)},d.packedLength=2*t.packedLength+c.packedLength,d.pack=function(e,i,n){n=r(n,0),t.pack(e._minimumCorner,i,n),t.pack(e._maximumCorner,i,n+t.packedLength),c.pack(e._vertexFormat,i,n+2*t.packedLength)};var p=new t,m=new t,f=new c,v={minimumCorner:p,maximumCorner:m,vertexFormat:f};return d.unpack=function(e,i,o){i=r(i,0);var a=t.unpack(e,i,p),s=t.unpack(e,i+t.packedLength,m),l=c.unpack(e,i+2*t.packedLength,f);return n(o)?(o._minimumCorner=t.clone(a,o._minimumCorner),o._maximumCorner=t.clone(s,o._maximumCorner),o._vertexFormat=c.clone(l,o._vertexFormat),o):new d(v)},d.createGeometry=function(r){var n,o,c=r._minimumCorner,d=r._maximumCorner,p=r._vertexFormat,m=new l;if(p.position&&(p.st||p.normal||p.binormal||p.tangent)){if(p.position&&(o=new Float64Array(72),o[0]=c.x,o[1]=c.y,o[2]=d.z,o[3]=d.x,o[4]=c.y,o[5]=d.z,o[6]=d.x,o[7]=d.y,o[8]=d.z,o[9]=c.x,o[10]=d.y,o[11]=d.z,o[12]=c.x,o[13]=c.y,o[14]=c.z,o[15]=d.x,o[16]=c.y,o[17]=c.z,o[18]=d.x,o[19]=d.y,o[20]=c.z,o[21]=c.x,o[22]=d.y,o[23]=c.z,o[24]=d.x,o[25]=c.y,o[26]=c.z,o[27]=d.x,o[28]=d.y,o[29]=c.z,o[30]=d.x,o[31]=d.y,o[32]=d.z,o[33]=d.x,o[34]=c.y,o[35]=d.z,o[36]=c.x,o[37]=c.y,o[38]=c.z,o[39]=c.x,o[40]=d.y,o[41]=c.z,o[42]=c.x,o[43]=d.y,o[44]=d.z,o[45]=c.x,o[46]=c.y,o[47]=d.z,o[48]=c.x,o[49]=d.y,o[50]=c.z,o[51]=d.x,o[52]=d.y,o[53]=c.z,o[54]=d.x,o[55]=d.y,o[56]=d.z,o[57]=c.x,o[58]=d.y,o[59]=d.z,o[60]=c.x,o[61]=c.y,o[62]=c.z,o[63]=d.x,o[64]=c.y,o[65]=c.z,o[66]=d.x,o[67]=c.y,o[68]=d.z,o[69]=c.x,o[70]=c.y,o[71]=d.z,m.position=new s({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:o})),p.normal){var f=new Float32Array(72);f[0]=0,f[1]=0,f[2]=1,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=1,f[9]=0,f[10]=0,f[11]=1,f[12]=0,f[13]=0,f[14]=-1,f[15]=0,f[16]=0,f[17]=-1,f[18]=0,f[19]=0,f[20]=-1,f[21]=0,f[22]=0,f[23]=-1,f[24]=1,f[25]=0,f[26]=0,f[27]=1,f[28]=0,f[29]=0,f[30]=1,f[31]=0,f[32]=0,f[33]=1,f[34]=0,f[35]=0,f[36]=-1,f[37]=0,f[38]=0,f[39]=-1,f[40]=0,f[41]=0,f[42]=-1,f[43]=0,f[44]=0,f[45]=-1,f[46]=0,f[47]=0,f[48]=0,f[49]=1,f[50]=0,f[51]=0,f[52]=1,f[53]=0,f[54]=0,f[55]=1,f[56]=0,f[57]=0,f[58]=1,f[59]=0,f[60]=0,f[61]=-1,f[62]=0,f[63]=0,f[64]=-1,f[65]=0,f[66]=0,f[67]=-1,f[68]=0,f[69]=0,f[70]=-1,f[71]=0,m.normal=new s({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:f})}if(p.st){var v=new Float32Array(48);v[0]=0,v[1]=0,v[2]=1,v[3]=0,v[4]=1,v[5]=1,v[6]=0,v[7]=1,v[8]=1,v[9]=0,v[10]=0,v[11]=0,v[12]=0,v[13]=1,v[14]=1,v[15]=1,v[16]=0,v[17]=0,v[18]=1,v[19]=0,v[20]=1,v[21]=1,v[22]=0,v[23]=1,v[24]=1,v[25]=0,v[26]=0,v[27]=0,v[28]=0,v[29]=1,v[30]=1,v[31]=1,v[32]=1,v[33]=0,v[34]=0,v[35]=0,v[36]=0,v[37]=1,v[38]=1,v[39]=1,v[40]=0,v[41]=0,v[42]=1,v[43]=0,v[44]=1,v[45]=1,v[46]=0,v[47]=1,m.st=new s({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:v})}if(p.tangent){var g=new Float32Array(72);g[0]=1,g[1]=0,g[2]=0,g[3]=1,g[4]=0,g[5]=0,g[6]=1,g[7]=0,g[8]=0,g[9]=1,g[10]=0,g[11]=0,g[12]=-1,g[13]=0,g[14]=0,g[15]=-1,g[16]=0,g[17]=0,g[18]=-1,g[19]=0,g[20]=0,g[21]=-1,g[22]=0,g[23]=0,g[24]=0,g[25]=1,g[26]=0,g[27]=0,g[28]=1,g[29]=0,g[30]=0,g[31]=1,g[32]=0,g[33]=0,g[34]=1,g[35]=0,g[36]=0,g[37]=-1,g[38]=0,g[39]=0,g[40]=-1,g[41]=0,g[42]=0,g[43]=-1,g[44]=0,g[45]=0,g[46]=-1,g[47]=0,g[48]=-1,g[49]=0,g[50]=0,g[51]=-1,g[52]=0,g[53]=0,g[54]=-1,g[55]=0,g[56]=0,g[57]=-1,g[58]=0,g[59]=0,g[60]=1,g[61]=0,g[62]=0,g[63]=1,g[64]=0,g[65]=0,g[66]=1,g[67]=0,g[68]=0,g[69]=1,g[70]=0,g[71]=0,m.tangent=new s({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:g})}if(p.binormal){var _=new Float32Array(72);_[0]=0,_[1]=1,_[2]=0,_[3]=0,_[4]=1,_[5]=0,_[6]=0,_[7]=1,_[8]=0,_[9]=0,_[10]=1,_[11]=0,_[12]=0,_[13]=1,_[14]=0,_[15]=0,_[16]=1,_[17]=0,_[18]=0,_[19]=1,_[20]=0,_[21]=0,_[22]=1,_[23]=0,_[24]=0,_[25]=0,_[26]=1,_[27]=0,_[28]=0,_[29]=1,_[30]=0,_[31]=0,_[32]=1,_[33]=0,_[34]=0,_[35]=1,_[36]=0,_[37]=0,_[38]=1,_[39]=0,_[40]=0,_[41]=1,_[42]=0,_[43]=0,_[44]=1,_[45]=0,_[46]=0,_[47]=1,_[48]=0,_[49]=0,_[50]=1,_[51]=0,_[52]=0,_[53]=1,_[54]=0,_[55]=0,_[56]=1,_[57]=0,_[58]=0,_[59]=1,_[60]=0,_[61]=0,_[62]=1,_[63]=0,_[64]=0,_[65]=1,_[66]=0,_[67]=0,_[68]=1,_[69]=0,_[70]=0,_[71]=1,m.binormal=new s({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:_})}n=new Uint16Array(36),n[0]=0,n[1]=1,n[2]=2,n[3]=0,n[4]=2,n[5]=3,n[6]=6,n[7]=5,n[8]=4,n[9]=7,n[10]=6,n[11]=4,n[12]=8,n[13]=9,n[14]=10,n[15]=8,n[16]=10,n[17]=11,n[18]=14,n[19]=13,n[20]=12,n[21]=15,n[22]=14,n[23]=12,n[24]=18,n[25]=17,n[26]=16,n[27]=19,n[28]=18,n[29]=16,n[30]=20,n[31]=21,n[32]=22,n[33]=20,n[34]=22,n[35]=23}else o=new Float64Array(24),o[0]=c.x,o[1]=c.y,o[2]=c.z,o[3]=d.x,o[4]=c.y,o[5]=c.z,o[6]=d.x,o[7]=d.y,o[8]=c.z,o[9]=c.x,o[10]=d.y,o[11]=c.z,o[12]=c.x,o[13]=c.y,o[14]=d.z,o[15]=d.x,o[16]=c.y,o[17]=d.z,o[18]=d.x,o[19]=d.y,o[20]=d.z,o[21]=c.x,o[22]=d.y,o[23]=d.z,m.position=new s({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:o}),n=new Uint16Array(36),n[0]=4,n[1]=5,n[2]=6,n[3]=4,n[4]=6,n[5]=7,n[6]=1,n[7]=0,n[8]=3,n[9]=1,n[10]=3,n[11]=2,n[12]=1,n[13]=6,n[14]=5,n[15]=1,n[16]=2,n[17]=6,n[18]=2,n[19]=3,n[20]=7,n[21]=2,n[22]=7,n[23]=6,n[24]=3,n[25]=0,n[26]=4,n[27]=3,n[28]=4,n[29]=7,n[30]=0,n[31]=1,n[32]=5,n[33]=0,n[34]=5,n[35]=4;var y=t.subtract(d,c,h),C=.5*t.magnitude(y);return new a({attributes:m,indices:n,primitiveType:u.TRIANGLES,boundingSphere:new e(t.ZERO,C)})},d}),i("Core/BoxOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Geometry","./GeometryAttribute","./GeometryAttributes","./PrimitiveType"],function(e,t,i,r,n,o,a,s,l,u){"use strict";var c=new t,h=function(e){e=r(e,r.EMPTY_OBJECT);var i=e.minimumCorner,n=e.maximumCorner;this._min=t.clone(i),this._max=t.clone(n),this._workerName="createBoxOutlineGeometry"};h.fromDimensions=function(e){e=r(e,r.EMPTY_OBJECT);var i=e.dimensions,n=t.multiplyByScalar(i,.5,new t),o=t.negate(n,new t),a=n,s={minimumCorner:o,maximumCorner:a};return new h(s)},h.packedLength=2*t.packedLength,h.pack=function(e,i,n){n=r(n,0),t.pack(e._min,i,n),t.pack(e._max,i,n+t.packedLength)};var d=new t,p=new t,m={minimumCorner:d,maximumCorner:p};return h.unpack=function(e,i,o){i=r(i,0);var a=t.unpack(e,i,d),s=t.unpack(e,i+t.packedLength,p);return n(o)?(o._min=t.clone(a,o._min),o._max=t.clone(s,o._max),o):new h(m)},h.createGeometry=function(r){var n=r._min,o=r._max,h=new l,d=new Uint16Array(24),p=new Float64Array(24);p[0]=n.x,p[1]=n.y,p[2]=n.z,p[3]=o.x,p[4]=n.y,p[5]=n.z,p[6]=o.x,p[7]=o.y,p[8]=n.z,p[9]=n.x,p[10]=o.y,p[11]=n.z,p[12]=n.x,p[13]=n.y,p[14]=o.z,p[15]=o.x,p[16]=n.y,p[17]=o.z,p[18]=o.x,p[19]=o.y,p[20]=o.z,p[21]=n.x,p[22]=o.y,p[23]=o.z,h.position=new s({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:p}),d[0]=4,d[1]=5,d[2]=5,d[3]=6,d[4]=6,d[5]=7,d[6]=7,d[7]=4,d[8]=0,d[9]=1,d[10]=1,d[11]=2,d[12]=2,d[13]=3,d[14]=3,d[15]=0,d[16]=0,d[17]=4,d[18]=1,d[19]=5,d[20]=2,d[21]=6,d[22]=3,d[23]=7;var m=t.subtract(o,n,c),f=.5*t.magnitude(m);return new a({attributes:h,indices:d,primitiveType:u.LINES,boundingSphere:new e(t.ZERO,f)})},h}),i("Core/Spline",["./defaultValue","./defined","./DeveloperError"],function(e,t,i){"use strict";var r=function(){this.times=void 0,this.points=void 0,i.throwInstantiationError()};return r.prototype.evaluate=i.throwInstantiationError,r.prototype.findTimeInterval=function(t,i){var r=this.times,n=r.length;if(i=e(i,0),t>=r[i]){if(n>i+1&&ti+2&&t=0&&t>=r[i-1])return i-1;var o;if(t>r[i])for(o=i;n-1>o&&!(t>=r[o]&&t=0&&!(t>=r[o]&&t=0;--o)l[o]=e.subtract(s[o],e.multiplyByScalar(l[o+1],a[o],l[o]),l[o]);return l},t}),i("Core/HermiteSpline",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./LinearSpline","./Matrix4","./Spline","./TridiagonalSystemSolver"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t,i,n){var o=d,a=m,s=p,l=f;o.length=a.length=t.length-1,s.length=l.length=t.length;var c;o[0]=s[0]=1,a[0]=0;var h=l[0];for(r(h)||(h=l[0]=new e),e.clone(i,h),c=1;c2&&(r(a)||(a=p,e.multiplyByScalar(n[1],2,a),e.subtract(a,n[2],a),e.subtract(a,n[0],a),e.multiplyByScalar(a,.5,a)),!r(s))){var l=n.length-1;s=m,e.multiplyByScalar(n[l-1],2,s),e.subtract(n[l],s,s),e.add(s,n[l-2],s),e.multiplyByScalar(s,.5,s)}this._times=o,this._points=n,this._firstTangent=e.clone(a),this._lastTangent=e.clone(s),this._evaluateFunction=u(this),this._lastTimeIndex=0};return n(f.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},firstTangent:{get:function(){return this._firstTangent}},lastTangent:{get:function(){return this._lastTangent}}}),f.catmullRomCoefficientMatrix=new s(-.5,1,-.5,0,1.5,-2.5,0,1,-1.5,2,.5,0,.5,-.5,0,0),f.prototype.findTimeInterval=l.prototype.findTimeInterval,f.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)},f}),i("Core/appendForwardSlash",[],function(){"use strict";var e=function(e){return(0===e.length||"/"!==e[e.length-1])&&(e+="/"),e};return e}),i("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,i,r){"use strict";var n={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return n.getSizeInBytes=function(e){switch(e){case n.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case n.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case n.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},n.validate=function(t){return e(t)&&(t===n.UNSIGNED_BYTE||t===n.UNSIGNED_SHORT||t===n.UNSIGNED_INT)},n.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},n.createTypedArrayFromArrayBuffer=function(e,t,i,n){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,i,n):new Uint16Array(t,i,n)},i(n)}),i("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var i=e.split("\r\n"),r=0;r0){var a=n.substring(0,o),s=n.substring(o+2);t[a]=s}}return t};return e}),i("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var i=function(e,i,r){this.statusCode=e,this.response=i,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return i.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},i}),i("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,i,r,n,o){"use strict";function a(e,t){var i=decodeURIComponent(t);return e?atob(i):i}function s(e,t){for(var i=a(e,t),r=new ArrayBuffer(i.length),n=new Uint8Array(r),o=0;oa&&a/ss&&s/ao)return[];var l=Math.sqrt(o);return[-l,l]}if(0===n)return o=-r/e,0>o?[o,0]:[0,o];var u=r*r,c=4*e*n,h=i(u,-c,t.EPSILON14);if(0>h)return[];var d=-.5*i(r,t.sign(r)*Math.sqrt(h),t.EPSILON14);return r>0?[d/e,n/d]:[n/d,d/e]},r}),i("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function i(e,t,i,r){var n,o,a=e,s=t/3,l=i/3,u=r,c=a*l,h=s*u,d=s*s,p=l*l,m=a*l-d,f=a*u-s*l,v=s*u-p,g=4*m*v-f*f;if(0>g){var _,y,C;d*h>=c*p?(_=a,y=m,C=-2*s*m+a*f):(_=u,y=v,C=-u*f+2*l*v);var w=0>C?-1:1,S=-w*Math.abs(_)*Math.sqrt(-g);o=-C+S;var E=o/2,b=0>E?-Math.pow(-E,1/3):Math.pow(E,1/3),x=o===S?-b:-y/b;return n=0>=y?b+x:-C/(b*b+x*x+y),d*h>=c*p?[(n-s)/a]:[-u/(n+l)]}var T=m,P=-2*s*m+a*f,A=v,D=-u*f+2*l*v,M=Math.sqrt(g),I=Math.sqrt(3)/2,O=Math.abs(Math.atan2(a*M,-P)/3);n=2*Math.sqrt(-T);var R=Math.cos(O);o=n*R;var L=n*(-R/2-I*Math.sin(O)),N=o+L>2*s?o-s:L-s,F=a,B=N/F;O=Math.abs(Math.atan2(u*M,-D)/3),n=2*Math.sqrt(-A),R=Math.cos(O),o=n*R,L=n*(-R/2-I*Math.sin(O));var z=-u,k=2*l>o+L?o+l:L+l,V=z/k,U=F*k,W=-N*k-F*z,G=N*z,H=(l*W-s*G)/(-s*W+l*U);return H>=B?V>=B?V>=H?[B,H,V]:[B,V,H]:[V,B,H]:V>=B?[H,B,V]:V>=H?[H,V,B]:[V,H,B]}var r={};return r.computeDiscriminant=function(e,t,i,r){var n=e*e,o=t*t,a=i*i,s=r*r,l=18*e*t*i*r+o*a-27*n*s-4*(e*a*i+o*t*r);return l},r.computeRealRoots=function(e,r,n,o){var a,s;if(0===e)return t.computeRealRoots(r,n,o);if(0===r){if(0===n){if(0===o)return[0,0,0];s=-o/e;var l=0>s?-Math.pow(-s,1/3):Math.pow(s,1/3);return[l,l,l]}return 0===o?(a=t.computeRealRoots(e,0,n),0===a.Length?[0]:[a[0],0,a[1]]):i(e,0,n,o)}return 0===n?0===o?(s=-r/e,0>s?[s,0,0]:[0,0,s]):i(e,r,0,o):0===o?(a=t.computeRealRoots(e,r,n),0===a.length?[0]:a[1]<=0?[a[0],a[1],0]:a[0]>=0?[0,a[0],a[1]]:[a[0],0,a[1]]):i(e,r,n,o)},r}),i("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,i,r){"use strict";function n(t,n,o,a){var s=t*t,l=n-3*s/8,u=o-n*t/2+s*t/8,c=a-o*t/4+n*s/16-3*s*s/256,h=e.computeRealRoots(1,2*l,l*l-4*c,-u*u);if(h.length>0){var d=-t/4,p=h[h.length-1];if(Math.abs(p)=0&&g>=0){var _=Math.sqrt(v),y=Math.sqrt(g);return[d-y,d-_,d+_,d+y]}if(v>=0&&0>g)return f=Math.sqrt(v),[d-f,d+f];if(0>v&&g>=0)return f=Math.sqrt(g),[d-f,d+f]}return[]}if(p>0){var C=Math.sqrt(p),w=(l+p-u/C)/2,S=(l+p+u/C)/2,E=r.computeRealRoots(1,C,w),b=r.computeRealRoots(1,-C,S);return 0!==E.length?(E[0]+=d,E[1]+=d,0!==b.length?(b[0]+=d,b[1]+=d,E[1]<=b[0]?[E[0],E[1],b[0],b[1]]:b[1]<=E[0]?[b[0],b[1],E[0],E[1]]:E[0]>=b[0]&&E[1]<=b[1]?[b[0],E[0],E[1],b[1]]:b[0]>=E[0]&&b[1]<=E[1]?[E[0],b[0],b[1],E[1]]:E[0]>b[0]&&E[0]0){var m,f,v=p[0],g=n-v,_=g*g,y=t/2,C=g/2,w=_-4*a,S=_+4*Math.abs(a),E=u-4*v,b=u+4*Math.abs(v);if(0>v||E*S>w*b){var x=Math.sqrt(E);m=x/2,f=0===x?0:(t*C-o)/x}else{var T=Math.sqrt(w);m=0===T?0:(t*C-o)/T,f=T/2}var P,A;0===y&&0===m?(P=0,A=0):i.sign(y)===i.sign(m)?(P=y+m,A=v/P):(A=y-m,P=v/A);var D,M;0===C&&0===f?(D=0,M=0):i.sign(C)===i.sign(f)?(D=C+f,M=a/D):(M=C-f,D=a/M);var I=r.computeRealRoots(1,P,D),O=r.computeRealRoots(1,A,M);if(0!==I.length)return 0!==O.length?I[1]<=O[0]?[I[0],I[1],O[0],O[1]]:O[1]<=I[0]?[O[0],O[1],I[0],I[1]]:I[0]>=O[0]&&I[1]<=O[1]?[O[0],I[0],I[1],O[1]]:O[0]>=I[0]&&O[1]<=I[1]?[I[0],O[0],O[1],I[1]]:I[0]>O[0]&&I[0]u?1:0;switch(p+=0>c?p+1:p,p+=0>h?p+1:p,p+=0>d?p+1:p){case 0:return n(u,c,h,d);case 1:return o(u,c,h,d);case 2:return o(u,c,h,d);case 3:return n(u,c,h,d);case 4:return n(u,c,h,d);case 5:return o(u,c,h,d);case 6:return n(u,c,h,d);case 7:return n(u,c,h,d);case 8:return o(u,c,h,d);case 9:return n(u,c,h,d);case 10:return n(u,c,h,d);case 11:return o(u,c,h,d);case 12:return n(u,c,h,d);case 13:return n(u,c,h,d);case 14:return n(u,c,h,d);case 15:return n(u,c,h,d);default:return void 0}},a}),i("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,i){"use strict";var r=function(i,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(i,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,n){return i(n)||(n=new e),n=e.multiplyByScalar(t.direction,r,n),e.add(t.origin,n,n)},r}),i("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t,r,n,a,s){s=i(s,!1);var l,u,c,h,d,p=t.origin,m=t.direction,f=e.subtract(n,r,v),w=e.subtract(a,r,g),S=e.cross(m,w,_),E=e.dot(f,S);if(s){if(Ec||c>E)return void 0;if(u=e.cross(l,f,C),h=e.dot(m,u),0>h||c+h>E)return void 0;d=e.dot(w,u)/E}else{if(Math.abs(E)c||c>1)return void 0;if(u=e.cross(l,f,C),h=e.dot(m,u)*b,0>h||c+h>1)return void 0;d=e.dot(w,u)*b}return d}function h(e,t,i,r){var n=t*t-4*e*i;if(0>n)return void 0;if(n>0){var o=1/(2*e),a=Math.sqrt(n),s=(-t+a)*o,l=(-t-a)*o;return l>s?(r.root0=s,r.root1=l):(r.root0=l,r.root1=s),r}var u=-t/(2*e);return 0===u?void 0:(r.root0=r.root1=u,r)}function d(t,i,n){r(n)||(n={});var o=t.origin,a=t.direction,s=i.center,l=i.radius*i.radius,u=e.subtract(o,s,_),c=e.dot(a,a),d=2*e.dot(a,u),p=e.magnitudeSquared(u)-l,m=h(c,d,p,S);return r(m)?(n.start=m.root0,n.stop=m.root1,n):void 0}function p(e,t,i){var r=e+t;return o.sign(e)!==o.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))L;++L){var N,F=c[L],B=F*F,z=Math.max(1-B,0),k=Math.sqrt(z);N=o.sign(m)===o.sign(v)?p(m*B+v,f*F,o.EPSILON12):o.sign(v)===o.sign(f*F)?p(m*B,f*F+v,o.EPSILON12):p(m*B+f*F,v,o.EPSILON12);var V=p(g*F,_,o.EPSILON15),U=N*V;0>U?y.push(new e(n,u*F,u*k)):U>0?y.push(new e(n,u*F,u*-k)):0!==k?(y.push(new e(n,u*F,u*-k)),y.push(new e(n,u*F,u*k)),++L):y.push(new e(n,u*F,u*k))}return y}var f={};f.rayPlane=function(t,i,n){r(n)||(n=new e);var a=t.origin,s=t.direction,l=i.normal,u=e.dot(l,s);if(Math.abs(u)c?void 0:(n=e.multiplyByScalar(s,c,n),e.add(a,n,n))};var v=new e,g=new e,_=new e,y=new e,C=new e;f.rayTriangle=function(t,i,n,o,a,s){var l=c(t,i,n,o,a);return!r(l)||0>l?void 0:(r(s)||(s=new e),e.multiplyByScalar(t.direction,l,s),e.add(t.origin,s,s))};var w=new u;f.lineSegmentTriangle=function(t,i,n,o,a,s,l){var u=w;e.clone(t,u.origin),e.subtract(i,t,u.direction),e.normalize(u.direction,u.direction);var h=c(u,n,o,a,s);return!r(h)||0>h||h>e.distance(t,i)?void 0:(r(l)||(l=new e),e.multiplyByScalar(u.direction,h,l),e.add(u.origin,l,l))};var S={root0:0,root1:0};f.raySphere=function(e,t,i){return i=d(e,t,i),!r(i)||i.stop<0?void 0:(i.start=Math.max(i.start,0),i)};var E=new u;f.lineSegmentSphere=function(t,i,n,o){var a=E;e.clone(t,a.origin);var s=e.subtract(i,t,a.direction),l=e.magnitude(s);return e.normalize(s,s),o=d(a,n,o),!r(o)||o.stop<0||o.start>l?void 0:(o.start=Math.max(o.start,0),o.stop=Math.min(o.stop,l),o)};var b=new e,x=new e;f.rayEllipsoid=function(t,i){var r,n,o,a,s,l=i.oneOverRadii,u=e.multiplyComponents(l,t.origin,b),c=e.multiplyComponents(l,t.direction,x),h=e.magnitudeSquared(u),d=e.dot(u,c);if(h>1){if(d>=0)return void 0;var p=d*d;if(r=h-1,n=e.magnitudeSquared(c),o=n*r,o>p)return void 0;if(p>o){a=d*d-o,s=-d+Math.sqrt(a);var m=s/n,f=r/s;return f>m?{start:m,stop:f}:{start:f,stop:m}}var v=Math.sqrt(r/n);return{start:v,stop:v}}return 1>h?(r=h-1,n=e.magnitudeSquared(c),o=n*r,a=d*d-o,s=-d+Math.sqrt(a),{start:0,stop:s/n}):0>d?(n=e.magnitudeSquared(c),{start:0,stop:-d/n}):void 0};var T=new e,P=new e,A=new e,D=new e,M=new e,I=new a,O=new a,R=new a,L=new a,N=new a,F=new a,B=new a,z=new e,k=new e,V=new t;f.grazingAltitudeLocation=function(t,i){var n=t.origin,s=t.direction,l=i.geodeticSurfaceNormal(n,T); -if(e.dot(s,l)>=0)return n;var u=r(this.rayEllipsoid(t,i)),c=i.transformPositionToScaledSpace(s,T),h=e.normalize(c,c),d=e.mostOrthogonalAxis(c,D),p=e.normalize(e.cross(d,h,P),P),f=e.normalize(e.cross(h,p,A),A),v=I;v[0]=h.x,v[1]=h.y,v[2]=h.z,v[3]=p.x,v[4]=p.y,v[5]=p.z,v[6]=f.x,v[7]=f.y,v[8]=f.z;var g=a.transpose(v,O),_=a.fromScale(i.radii,R),y=a.fromScale(i.oneOverRadii,L),C=N;C[0]=0,C[1]=-s.z,C[2]=s.y,C[3]=s.z,C[4]=0,C[5]=-s.x,C[6]=-s.y,C[7]=s.x,C[8]=0;var w,S,E=a.multiply(a.multiply(g,y,F),C,F),b=a.multiply(a.multiply(E,_,B),v,B),x=a.multiplyByVector(E,n,M),U=m(b,e.negate(x,T),0,0,1),W=U.length;if(W>0){for(var G=e.clone(e.ZERO,k),H=Number.NEGATIVE_INFINITY,q=0;W>q;++q){w=a.multiplyByVector(_,a.multiplyByVector(v,U[q],z),z);var j=e.normalize(e.subtract(w,n,D),D),Y=e.dot(j,s);Y>H&&(H=Y,G=e.clone(w,G))}var X=i.cartesianToCartographic(G,V);return H=o.clamp(H,0,1),S=e.magnitude(e.subtract(G,n,D))*Math.sqrt(1-H*H),S=u?-S:S,X.height=S,i.cartographicToCartesian(X,new e)}return void 0};var U=new e;return f.lineSegmentPlane=function(t,i,n,a){r(a)||(a=new e);var s=e.subtract(i,t,U),l=n.normal,u=e.dot(l,s);if(Math.abs(u)h||h>1?void 0:(e.multiplyByScalar(s,h,a),e.add(t,a,a),a)},f.trianglePlaneIntersection=function(t,i,r,n){var o=n.normal,a=n.distance,s=e.dot(o,t)+a<0,l=e.dot(o,i)+a<0,u=e.dot(o,r)+a<0,c=0;c+=s?1:0,c+=l?1:0,c+=u?1:0;var h,d;if((1===c||2===c)&&(h=new e,d=new e),1===c){if(s)return f.lineSegmentPlane(t,i,n,h),f.lineSegmentPlane(t,r,n,d),{positions:[t,i,r,h,d],indices:[0,3,4,1,2,4,1,4,3]};if(l)return f.lineSegmentPlane(i,r,n,h),f.lineSegmentPlane(i,t,n,d),{positions:[t,i,r,h,d],indices:[1,3,4,2,0,4,2,4,3]};if(u)return f.lineSegmentPlane(r,t,n,h),f.lineSegmentPlane(r,i,n,d),{positions:[t,i,r,h,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===c){if(!s)return f.lineSegmentPlane(i,t,n,h),f.lineSegmentPlane(r,t,n,d),{positions:[t,i,r,h,d],indices:[1,2,4,1,4,3,0,3,4]};if(!l)return f.lineSegmentPlane(r,i,n,h),f.lineSegmentPlane(t,i,n,d),{positions:[t,i,r,h,d],indices:[2,0,4,2,4,3,1,3,4]};if(!u)return f.lineSegmentPlane(t,r,n,h),f.lineSegmentPlane(i,r,n,d),{positions:[t,i,r,h,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},f}),i("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,i){for(var r,n,o=0,a=e.length-1;a>=o;)if(r=~~((o+a)/2),n=i(e[r],t),0>n)o=r+1;else{if(!(n>0))return r;a=r-1}return~(a+1)};return e}),i("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,i,r,n){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=i,this.yPoleOffset=r,this.ut1MinusUtc=n};return e}),i("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,i=0,r=t[i++],n=function(e,t,i,r){i||(i=" ");var n=e.length>=t?"":Array(1+t-e.length>>>0).join(i);return r?e+n:n+e},o=function(e,t,i,r,o,a){var s=r-e.length;return s>0&&(e=i||!o?n(e,r,a,i):e.slice(0,t.length)+n("",s,"0",!0)+e.slice(t.length)),e},a=function(e,t,i,r,a,s,l){var u=e>>>0;return i=i&&u&&{2:"0b",8:"0",16:"0x"}[t]||"",e=i+n(u.toString(t),s||0,"0",!1),o(e,i,r,a,l)},s=function(e,t,i,r,n,a){return null!=r&&(e=e.slice(0,r)),o(e,"",t,i,n,a)},l=function(e,r,l,u,c,h,d){var p,m,f,v,g;if("%%"==e)return"%";for(var _=!1,y="",C=!1,w=!1,S=" ",E=l.length,b=0;l&&E>b;b++)switch(l.charAt(b)){case" ":y=" ";break;case"+":y="+";break;case"-":_=!0;break;case"'":S=l.charAt(b+1);break;case"0":C=!0;break;case"#":w=!0}if(u=u?"*"==u?+t[i++]:"*"==u.charAt(0)?+t[u.slice(1,-1)]:+u:0,0>u&&(u=-u,_=!0),!isFinite(u))throw new Error("sprintf: (minimum-)width must be finite");switch(h=h?"*"==h?+t[i++]:"*"==h.charAt(0)?+t[h.slice(1,-1)]:+h:"fFeE".indexOf(d)>-1?6:"d"==d?0:void 0,g=r?t[r.slice(0,-1)]:t[i++],d){case"s":return s(String(g),_,u,h,C,S);case"c":return s(String.fromCharCode(+g),_,u,h,C);case"b":return a(g,2,w,_,u,h,C);case"o":return a(g,8,w,_,u,h,C);case"x":return a(g,16,w,_,u,h,C);case"X":return a(g,16,w,_,u,h,C).toUpperCase();case"u":return a(g,10,w,_,u,h,C);case"i":case"d":return p=+g||0,p=Math.round(p-p%1),m=0>p?"-":y,g=m+n(String(Math.abs(p)),h,"0",!1),o(g,m,_,u,C);case"e":case"E":case"f":case"F":case"g":case"G":return p=+g,m=0>p?"-":y,f=["toExponential","toFixed","toPrecision"]["efg".indexOf(d.toLowerCase())],v=["toString","toUpperCase"]["eEfFgG".indexOf(d)%2],g=m+Math.abs(p)[f](h),o(g,m,_,u,C)[v]();default:return e}};return r.replace(e,l)}return e}),i("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,i,r,n,o,a,s){this.year=e,this.month=t,this.day=i,this.hour=r,this.minute=n,this.second=o,this.millisecond=a,this.isLeapSecond=s};return e}),i("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),i("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),i("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),i("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),i("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e,t){return D.compare(e.julianDate,t.julianDate)}function h(e){_.julianDate=e;var i=D.leapSeconds,r=t(i,_,c);0>r&&(r=~r),r>=i.length&&(r=i.length-1);var n=i[r].offset;if(r>0){var o=D.secondsDifference(i[r].julianDate,e);o>n&&(r--,n=i[r].offset)}D.addSeconds(e,n,e)}function d(e,i){_.julianDate=e;var r=D.leapSeconds,n=t(r,_,c);if(0>n&&(n=~n),0===n)return D.addSeconds(e,-r[0].offset,i);if(n>=r.length)return D.addSeconds(e,-r[n-1].offset,i);var o=D.secondsDifference(r[n].julianDate,e);return 0===o?D.addSeconds(e,-r[n].offset,i):1>=o?void 0:D.addSeconds(e,-r[--n].offset,i)}function p(e,t,i){var r=0|t/l.SECONDS_PER_DAY;return e+=r,t-=l.SECONDS_PER_DAY*r,0>t&&(e--,t+=l.SECONDS_PER_DAY),i.dayNumber=e,i.secondsOfDay=t,i}function m(e,t,i,r,n,o,a){var s=0|(t-14)/12,u=e+4800+s,c=(0|1461*u/4)+(0|367*(t-2-12*s)/12)-(0|3*((u+100)/100)/4)+i-32075;r-=12,0>r&&(r+=24);var h=o+(r*l.SECONDS_PER_HOUR+n*l.SECONDS_PER_MINUTE+a*l.SECONDS_PER_MILLISECOND);return h>=43200&&(c-=1),[c,h]}var f=new o,v=[31,28,31,30,31,30,31,31,30,31,30,31],g=29,_=new s,y=/^(\d{4})$/,C=/^(\d{4})-(\d{2})$/,w=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,E=/^(\d{4})-?(\d{2})-?(\d{2})$/,b=/([Z+\-])?(\d{2})?:?(\d{2})?$/,x=/^(\d{2})(\.\d+)?/.source+b.source,T=/^(\d{2}):?(\d{2})(\.\d+)?/.source+b.source,P=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+b.source,A="Invalid ISO 8601 date.",D=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=i(e,0),t=i(t,0),r=i(r,u.UTC);var n=0|e;t+=(e-n)*l.SECONDS_PER_DAY,p(n,t,this),r===u.UTC&&h(this)};D.fromDate=function(e,t){var i=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(p(i[0],i[1],t),h(t),t):new D(i[0],i[1],u.UTC)},D.fromIso8601=function(e,t){e=e.replace(",",".");var i,o,s,l=e.split("T"),c=1,d=1,f=0,_=0,b=0,M=0,I=l[0],O=l[1];if(!r(I))throw new n(A);var R;if(l=I.match(E),null!==l){if(R=I.split("-").length-1,R>0&&2!==R)throw new n(A);i=+l[1],c=+l[2],d=+l[3]}else if(l=I.match(C),null!==l)i=+l[1],c=+l[2];else if(l=I.match(y),null!==l)i=+l[1];else{var L;if(l=I.match(w),null!==l){if(i=+l[1],L=+l[2],s=a(i),1>L||s&&L>366||!s&&L>365)throw new n(A)}else{if(l=I.match(S),null===l)throw new n(A);i=+l[1];var N=+l[2],F=+l[3]||0;if(R=I.split("-").length-1,R>0&&(!r(l[3])&&1!==R||r(l[3])&&2!==R))throw new n(A);var B=new Date(Date.UTC(i,0,4));L=7*N+F-B.getUTCDay()-3}o=new Date(Date.UTC(i,0,1)),o.setUTCDate(L),c=o.getUTCMonth()+1,d=o.getUTCDate()}if(s=a(i),1>c||c>12||1>d||(2!==c||!s)&&d>v[c-1]||s&&2===c&&d>g)throw new n(A);var z;if(r(O)){if(l=O.match(P),null!==l){if(R=O.split(":").length-1,R>0&&2!==R&&3!==R)throw new n(A);f=+l[1],_=+l[2],b=+l[3],M=1e3*+(l[4]||0),z=5}else if(l=O.match(T),null!==l){if(R=O.split(":").length-1,R>0&&1!==R)throw new n(A);f=+l[1],_=+l[2],b=60*+(l[3]||0),z=4}else{if(l=O.match(x),null===l)throw new n(A);f=+l[1],_=60*+(l[2]||0),z=3}if(_>=60||b>=61||f>24||24===f&&(_>0||b>0||M>0))throw new n(A);var k=l[z],V=+l[z+1],U=+(l[z+2]||0);switch(k){case"+":f-=V,_-=U;break;case"-":f+=V,_+=U;break;case"Z":break;default:_+=new Date(Date.UTC(i,c-1,d,f,_)).getTimezoneOffset()}}else _+=new Date(i,c-1,d).getTimezoneOffset();var W=60===b;for(W&&b--;_>=60;)_-=60,f++;for(;f>=24;)f-=24,d++;for(o=s&&2===c?g:v[c-1];d>o;)d-=o,c++,c>12&&(c-=12,i++),o=s&&2===c?g:v[c-1];for(;0>_;)_+=60,f--;for(;0>f;)f+=24,d--;for(;1>d;)c--,1>c&&(c+=12,i--),o=s&&2===c?g:v[c-1],d+=o;var G=m(i,c,d,f,_,b,M);return r(t)?(p(G[0],G[1],t),h(t)):t=new D(G[0],G[1],u.UTC),W&&D.addSeconds(t,1,t),t},D.now=function(e){return D.fromDate(new Date,e)};var M=new D(0,0,u.TAI);return D.toGregorianDate=function(e,t){var i=!1,n=d(e,M);r(n)||(D.addSeconds(e,-1,M),n=d(M,M),i=!0);var a=n.dayNumber,s=n.secondsOfDay;s>=43200&&(a+=1);var u=0|a+68569,c=0|4*u/146097;u=0|u-(0|(146097*c+3)/4);var h=0|4e3*(u+1)/1461001;u=0|u-(0|1461*h/4)+31;var p=0|80*u/2447,m=0|u-(0|2447*p/80);u=0|p/11;var f=0|p+2-12*u,v=0|100*(c-49)+h+u,g=0|s/l.SECONDS_PER_HOUR,_=s-g*l.SECONDS_PER_HOUR,y=0|_/l.SECONDS_PER_MINUTE;_-=y*l.SECONDS_PER_MINUTE;var C=0|_,w=(_-C)/l.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),i&&(C+=1),r(t)?(t.year=v,t.month=f,t.day=m,t.hour=g,t.minute=y,t.second=C,t.millisecond=w,t.isLeapSecond=i,t):new o(v,f,m,g,y,C,w,i)},D.toDate=function(e){var t=D.toGregorianDate(e,f),i=t.second;return t.isLeapSecond&&(i-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,i,t.millisecond))},D.toIso8601=function(t,i){var n,o=D.toGregorianDate(t,o);return r(i)||0===o.millisecond?r(i)&&0!==i?(n=(.01*o.millisecond).toFixed(i).replace(".","").slice(0,i),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",o.year,o.month,o.day,o.hour,o.minute,o.second,n)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",o.year,o.month,o.day,o.hour,o.minute,o.second):(n=(.01*o.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",o.year,o.month,o.day,o.hour,o.minute,o.second,n))},D.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new D(e.dayNumber,e.secondsOfDay,u.TAI):void 0},D.compare=function(e,t){var i=e.dayNumber-t.dayNumber;return 0!==i?i:e.secondsOfDay-t.secondsOfDay},D.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},D.equalsEpsilon=function(e,t,i){return e===t||r(e)&&r(t)&&Math.abs(D.secondsDifference(e,t))<=i},D.totalDays=function(e){return e.dayNumber+e.secondsOfDay/l.SECONDS_PER_DAY},D.secondsDifference=function(e,t){var i=(e.dayNumber-t.dayNumber)*l.SECONDS_PER_DAY;return i+(e.secondsOfDay-t.secondsOfDay)},D.daysDifference=function(e,t){var i=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/l.SECONDS_PER_DAY;return i+r},D.computeTaiMinusUtc=function(e){_.julianDate=e;var i=D.leapSeconds,r=t(i,_,c);return 0>r&&(r=~r,--r,0>r&&(r=0)),i[r].offset},D.addSeconds=function(e,t,i){return p(e.dayNumber,e.secondsOfDay+t,i)},D.addMinutes=function(e,t,i){var r=e.secondsOfDay+t*l.SECONDS_PER_MINUTE;return p(e.dayNumber,r,i)},D.addHours=function(e,t,i){var r=e.secondsOfDay+t*l.SECONDS_PER_HOUR;return p(e.dayNumber,r,i)},D.addDays=function(e,t,i){var r=e.dayNumber+t;return p(r,e.secondsOfDay,i)},D.lessThan=function(e,t){return D.compare(e,t)<0},D.lessThanOrEquals=function(e,t){return D.compare(e,t)<=0},D.greaterThan=function(e,t){return D.compare(e,t)>0},D.greaterThanOrEquals=function(e,t){return D.compare(e,t)>=0},D.prototype.clone=function(e){return D.clone(this,e)},D.prototype.equals=function(e){return D.equals(this,e)},D.prototype.equalsEpsilon=function(e,t){return D.equalsEpsilon(this,e,t)},D.prototype.toString=function(){return D.toIso8601(this)},D.leapSeconds=[new s(new D(2441317,43210,u.TAI),10),new s(new D(2441499,43211,u.TAI),11),new s(new D(2441683,43212,u.TAI),12),new s(new D(2442048,43213,u.TAI),13),new s(new D(2442413,43214,u.TAI),14),new s(new D(2442778,43215,u.TAI),15),new s(new D(2443144,43216,u.TAI),16),new s(new D(2443509,43217,u.TAI),17),new s(new D(2443874,43218,u.TAI),18),new s(new D(2444239,43219,u.TAI),19),new s(new D(2444786,43220,u.TAI),20),new s(new D(2445151,43221,u.TAI),21),new s(new D(2445516,43222,u.TAI),22),new s(new D(2446247,43223,u.TAI),23),new s(new D(2447161,43224,u.TAI),24),new s(new D(2447892,43225,u.TAI),25),new s(new D(2448257,43226,u.TAI),26),new s(new D(2448804,43227,u.TAI),27),new s(new D(2449169,43228,u.TAI),28),new s(new D(2449534,43229,u.TAI),29),new s(new D(2450083,43230,u.TAI),30),new s(new D(2450630,43231,u.TAI),31),new s(new D(2451179,43232,u.TAI),32),new s(new D(2453736,43233,u.TAI),33),new s(new D(2454832,43234,u.TAI),34),new s(new D(2456109,43235,u.TAI),35),new s(new D(2457204,43236,u.TAI),36)],D}),i("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,t){return a.compare(e.julianDate,t)}function p(e,i){if(!r(i.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(i.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var n=i.columnNames.indexOf("modifiedJulianDateUtc"),o=i.columnNames.indexOf("xPoleWanderRadians"),l=i.columnNames.indexOf("yPoleWanderRadians"),u=i.columnNames.indexOf("ut1MinusUtcSeconds"),p=i.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=i.columnNames.indexOf("yCelestialPoleOffsetRadians"),f=i.columnNames.indexOf("taiMinusUtcSeconds");if(0>n||0>o||0>l||0>u||0>p||0>m||0>f)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var v=e._samples=i.samples,g=e._dates=[];e._dateColumn=n,e._xPoleWanderRadiansColumn=o,e._yPoleWanderRadiansColumn=l,e._ut1MinusUtcSecondsColumn=u,e._xCelestialPoleOffsetRadiansColumn=p,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=f,e._columnCount=i.columnNames.length,e._lastIndex=void 0;for(var _,y=e._addNewLeapSeconds,C=0,w=v.length;w>C;C+=e._columnCount){var S=v[C+n],E=v[C+f],b=S+c.MODIFIED_JULIAN_DATE_DIFFERENCE,x=new a(b,E,h.TAI);if(g.push(x),y){if(E!==_&&r(_)){var T=a.leapSeconds,P=t(T,x,d);if(0>P){var A=new s(x,E);T.splice(~P,0,A)}}_=E}}}function m(e,t,i,r,n){var o=i*r;n.xPoleWander=t[o+e._xPoleWanderRadiansColumn],n.yPoleWander=t[o+e._yPoleWanderRadiansColumn],n.xPoleOffset=t[o+e._xCelestialPoleOffsetRadiansColumn],n.yPoleOffset=t[o+e._yCelestialPoleOffsetRadiansColumn],n.ut1MinusUtc=t[o+e._ut1MinusUtcSecondsColumn]}function f(e,t,i){return t+e*(i-t)}function v(e,t,i,r,n,o,s){var l=e._columnCount;if(o>t.length-1)return s.xPoleWander=0,s.yPoleWander=0,s.xPoleOffset=0,s.yPoleOffset=0,s.ut1MinusUtc=0,s;var u=t[n],c=t[o];if(u.equals(c)||r.equals(u))return m(e,i,n,l,s),s;if(r.equals(c))return m(e,i,o,l,s),s;var h=a.secondsDifference(r,u)/a.secondsDifference(c,u),d=n*l,p=o*l,v=i[d+e._ut1MinusUtcSecondsColumn],g=i[p+e._ut1MinusUtcSecondsColumn],_=g-v;if(_>.5||-.5>_){var y=i[d+e._taiMinusUtcSecondsColumn],C=i[p+e._taiMinusUtcSecondsColumn];y!==C&&(c.equals(r)?v=g:g-=C-y)}return s.xPoleWander=f(h,i[d+e._xPoleWanderRadiansColumn],i[p+e._xPoleWanderRadiansColumn]),s.yPoleWander=f(h,i[d+e._yPoleWanderRadiansColumn],i[p+e._yPoleWanderRadiansColumn]),s.xPoleOffset=f(h,i[d+e._xCelestialPoleOffsetRadiansColumn],i[p+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=f(h,i[d+e._yCelestialPoleOffsetRadiansColumn],i[p+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=f(h,v,g),s}var g=function(t){if(t=i(t,i.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=i(t.addNewLeapSeconds,!0),r(t.data))p(this,t.data);else if(r(t.url)){var n=this;this._downloadPromise=e(l(t.url),function(e){p(n,e)},function(){n._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else p(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return g.NONE=o({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new n(0,0,0,0,0),t}}),g.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},g.prototype.compute=function(e,i){if(!r(this._samples)){if(r(this._dataError))throw new u(this._dataError);return void 0}if(r(i)||(i=new n(0,0,0,0,0)),0===this._samples.length)return i.xPoleWander=0,i.yPoleWander=0,i.xPoleOffset=0,i.yPoleOffset=0,i.ut1MinusUtc=0,i;var o=this._dates,s=this._lastIndex,l=0,c=0;if(r(s)){var h=o[s],d=o[s+1],p=a.lessThanOrEquals(h,e),m=!r(d),f=m||a.greaterThanOrEquals(d,e);if(p&&f)return l=s,!m&&d.equals(e)&&++l,c=l+1,v(this,o,this._samples,e,l,c,i),i}var g=t(o,e,a.compare,this._dateColumn);return g>=0?(gl&&(l=0)),this._lastIndex=l,v(this,o,this._samples,e,l,c,i),i},g}),i("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,i){this.x=e,this.y=t,this.s=i};return e}),i("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,i,r,n,o,a,s){"use strict";function l(e,t,i){var r=h;return r.dayNumber=t,r.secondsOfDay=i,o.daysDifference(r,e._sampleZeroDateTT)}function u(i,n){if(i._chunkDownloadsInProgress[n])return i._chunkDownloadsInProgress[n];var o=e.defer();i._chunkDownloadsInProgress[n]=o;var s,l=i._xysFileUrlTemplate;return s=r(l)?l.replace("{0}",n):t("Assets/IAU2006_XYS/IAU2006_XYS_"+n+".json"),e(a(s),function(e){i._chunkDownloadsInProgress[n]=!1;for(var t=i._samples,r=e.samples,a=3*n*i._samplesPerXysFile,s=0,l=r.length;l>s;++s)t[a+s]=r[s];o.resolve()}),o.promise}var c=function(e){e=i(e,i.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=i(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=i(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new o(this._sampleZeroJulianEphemerisDate,0,s.TAI),this._stepSizeDays=i(e.stepSizeDays,1),this._samplesPerXysFile=i(e.samplesPerXysFile,1e3),this._totalSamples=i(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),n=this._xTable=new Array(t+1),a=Math.pow(this._stepSizeDays,t),l=0;t>=l;++l){r[l]=a,n[l]=l*this._stepSizeDays;for(var u=0;t>=u;++u)u!==l&&(r[l]*=l-u);r[l]=1/r[l]}this._work=new Array(t+1),this._coef=new Array(t+1)},h=new o(0,0,s.TAI);return c.prototype.preload=function(t,i,r,n){var o=l(this,t,i),a=l(this,r,n),s=0|o/this._stepSizeDays-this._interpolationOrder/2;0>s&&(s=0);var c=a/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;c>=this._totalSamples&&(c=this._totalSamples-1);for(var h=0|s/this._samplesPerXysFile,d=0|c/this._samplesPerXysFile,p=[],m=h;d>=m;++m)p.push(u(this,m));return e.all(p)},c.prototype.computeXysRadians=function(e,t,i){var o=l(this,e,t);if(0>o)return void 0;var a=0|o/this._stepSizeDays;if(a>=this._totalSamples)return void 0;var s=this._interpolationOrder,c=a-(0|s/2);0>c&&(c=0);var h=c+s;h>=this._totalSamples&&(h=this._totalSamples-1,c=h-s,0>c&&(c=0));var d=!1,p=this._samples;if(r(p[3*c])||(u(this,0|c/this._samplesPerXysFile),d=!0),r(p[3*h])||(u(this,0|h/this._samplesPerXysFile),d=!0),d)return void 0;r(i)?(i.x=0,i.y=0,i.s=0):i=new n(0,0,0);var m,f,v=o-c*this._stepSizeDays,g=this._work,_=this._denominators,y=this._coef,C=this._xTable;for(m=0;s>=m;++m)g[m]=v-C[m];for(m=0;s>=m;++m){for(y[m]=1,f=0;s>=f;++f)f!==m&&(y[m]*=g[f]);y[m]*=_[m];var w=3*(c+m);i.x+=y[m]*p[w++],i.y+=y[m]*p[w++],i.s+=y[m]*p[w]}return i},c}),i("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(e,i,r,n){this.x=t(e,0),this.y=t(i,0),this.z=t(r,0),this.w=t(n,0)},u=new e;l.fromAxisAngle=function(t,r,n){var o=r/2,a=Math.sin(o);u=e.normalize(t,u);var s=u.x*a,c=u.y*a,h=u.z*a,d=Math.cos(o);return i(n)?(n.x=s,n.y=c,n.z=h,n.w=d,n):new l(s,c,h,d)};var c=[1,2,0],h=new Array(3);l.fromRotationMatrix=function(e,t){var r,n,o,a,u,d=e[s.COLUMN0ROW0],p=e[s.COLUMN1ROW1],m=e[s.COLUMN2ROW2],f=d+p+m;if(f>0)r=Math.sqrt(f+1),u=.5*r,r=.5/r,n=(e[s.COLUMN1ROW2]-e[s.COLUMN2ROW1])*r,o=(e[s.COLUMN2ROW0]-e[s.COLUMN0ROW2])*r,a=(e[s.COLUMN0ROW1]-e[s.COLUMN1ROW0])*r;else{var v=c,g=0;p>d&&(g=1),m>d&&m>p&&(g=2);var _=v[g],y=v[_];r=Math.sqrt(e[s.getElementIndex(g,g)]-e[s.getElementIndex(_,_)]-e[s.getElementIndex(y,y)]+1);var C=h;C[g]=.5*r,r=.5/r,u=(e[s.getElementIndex(y,_)]-e[s.getElementIndex(_,y)])*r,C[_]=(e[s.getElementIndex(_,g)]+e[s.getElementIndex(g,_)])*r,C[y]=(e[s.getElementIndex(y,g)]+e[s.getElementIndex(g,y)])*r,n=-C[0],o=-C[1],a=-C[2]}return i(t)?(t.x=n,t.y=o,t.z=a,t.w=u,t):new l(n,o,a,u)};var d=new l;l.fromHeadingPitchRoll=function(t,i,r,n){var o=l.fromAxisAngle(e.UNIT_X,r,d),a=l.fromAxisAngle(e.UNIT_Y,-i,n);n=l.multiply(a,o,a);var s=l.fromAxisAngle(e.UNIT_Z,-t,d);return l.multiply(s,n,n)};var p=new e,m=new e,f=new l,v=new l,g=new l;l.packedLength=4,l.pack=function(e,i,r){r=t(r,0),i[r++]=e.x,i[r++]=e.y,i[r++]=e.z,i[r]=e.w},l.unpack=function(e,r,n){return r=t(r,0),i(n)||(n=new l),n.x=e[r],n.y=e[r+1],n.z=e[r+2],n.w=e[r+3],n},l.packedInterpolationLength=3,l.convertPackedArrayForInterpolation=function(e,t,i,r){l.unpack(e,4*i,g),l.conjugate(g,g);for(var n=0,o=i-t+1;o>n;n++){var a=3*n;l.unpack(e,4*(t+n),f),l.multiply(f,g,f),f.w<0&&l.negate(f,f),l.computeAxis(f,p);var s=l.computeAngle(f);r[a]=p.x*s,r[a+1]=p.y*s,r[a+2]=p.z*s}},l.unpackInterpolationResult=function(t,r,n,o,a){i(a)||(a=new l),e.fromArray(t,0,m);var s=e.magnitude(m);return l.unpack(r,4*o,v),0===s?l.clone(l.IDENTITY,f):l.fromAxisAngle(m,s,f),l.multiply(f,v,a)},l.clone=function(e,t){return i(e)?i(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new l(e.x,e.y,e.z,e.w):void 0},l.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},l.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},l.magnitude=function(e){return Math.sqrt(l.magnitudeSquared(e))},l.normalize=function(e,t){var i=1/l.magnitude(e),r=e.x*i,n=e.y*i,o=e.z*i,a=e.w*i;return t.x=r,t.y=n,t.z=o,t.w=a,t},l.inverse=function(e,t){var i=l.magnitudeSquared(e);return t=l.conjugate(e,t),l.multiplyByScalar(t,1/i,t)},l.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i.w=e.w+t.w,i},l.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i.w=e.w-t.w,i},l.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},l.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},l.multiply=function(e,t,i){var r=e.x,n=e.y,o=e.z,a=e.w,s=t.x,l=t.y,u=t.z,c=t.w,h=a*s+r*c+n*u-o*l,d=a*l-r*u+n*c+o*s,p=a*u+r*l-n*s+o*c,m=a*c-r*s-n*l-o*u;return i.x=h,i.y=d,i.z=p,i.w=m,i},l.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i.w=e.w*t,i},l.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i.w=e.w/t,i},l.computeAxis=function(e,t){var i=e.w;if(Math.abs(i-1)n&&(n=-n,o=y=l.negate(t,y)),1-nO;++O){var R=O+1,L=2*R+1;A[O]=1/(R*L),D[O]=R/L}return A[7]=P/136,D[7]=8*P/17,l.fastSlerp=function(e,t,i,r){var n,o=l.dot(e,t);o>=0?n=1:(n=-1,o=-o);for(var a=o-1,s=1-i,u=i*i,c=s*s,h=7;h>=0;--h)M[h]=(A[h]*u-D[h])*a,I[h]=(A[h]*c-D[h])*a;var d=n*i*(1+M[0]*(1+M[1]*(1+M[2]*(1+M[3]*(1+M[4]*(1+M[5]*(1+M[6]*(1+M[7])))))))),p=s*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=l.multiplyByScalar(e,p,T);return l.multiplyByScalar(t,d,r),l.add(m,r,r)},l.fastSquad=function(e,t,i,r,n,o){var a=l.fastSlerp(e,t,n,b),s=l.fastSlerp(i,r,n,x);return l.fastSlerp(a,s,2*n*(1-n),o)},l.equals=function(e,t){return e===t||i(e)&&i(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},l.equalsEpsilon=function(e,t,r){return e===t||i(e)&&i(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},l.ZERO=o(new l(0,0,0,0)),l.IDENTITY=o(new l(0,0,0,1)),l.prototype.clone=function(e){return l.clone(this,e)},l.prototype.equals=function(e){return l.equals(this,e)},l.prototype.equalsEpsilon=function(e,t){return l.equalsEpsilon(this,e,t)},l.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},l}),i("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";var _={},y=new i,C=new i,w=new i;_.eastNorthUpToFixedFrame=function(e,t,r){if(p.equalsEpsilon(e.x,0,p.EPSILON14)&&p.equalsEpsilon(e.y,0,p.EPSILON14)){var a=p.sign(e.z);return o(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-a,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=a,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new f(0,-a,0,e.x,1,0,0,e.y,0,0,a,e.z,0,0,0,1)}var s=y,l=C,c=w;return t=n(t,u.WGS84),t.geodeticSurfaceNormal(e,s),l.x=-e.y,l.y=e.x,l.z=0,i.normalize(l,l),i.cross(s,l,c),o(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=c.x,r[5]=c.y,r[6]=c.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new f(l.x,c.x,s.x,e.x,l.y,c.y,s.y,e.y,l.z,c.z,s.z,e.z,0,0,0,1)};var S=new i,E=new i,b=new i;_.northEastDownToFixedFrame=function(e,t,r){if(p.equalsEpsilon(e.x,0,p.EPSILON14)&&p.equalsEpsilon(e.y,0,p.EPSILON14)){var a=p.sign(e.z);return o(r)?(r[0]=-a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-a,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new f(-a,0,0,e.x,0,1,0,e.y,0,0,-a,e.z,0,0,0,1)}var s=S,l=E,c=b;return t=n(t,u.WGS84),t.geodeticSurfaceNormal(e,s),l.x=-e.y,l.y=e.x,l.z=0,i.normalize(l,l),i.cross(s,l,c),o(r)?(r[0]=c.x,r[1]=c.y,r[2]=c.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=-s.x,r[9]=-s.y,r[10]=-s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new f(c.x,l.x,-s.x,e.x,c.y,l.y,-s.y,e.y,c.z,l.z,-s.z,e.z,0,0,0,1)},_.northUpEastToFixedFrame=function(e,t,r){if(p.equalsEpsilon(e.x,0,p.EPSILON14)&&p.equalsEpsilon(e.y,0,p.EPSILON14)){var a=p.sign(e.z);return o(r)?(r[0]=-a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=a,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new f(-a,0,0,e.x,0,0,1,e.y,0,a,0,e.z,0,0,0,1)}var s=y,l=C,c=w;return t=n(t,u.WGS84),t.geodeticSurfaceNormal(e,s),l.x=-e.y,l.y=e.x,l.z=0,i.normalize(l,l),i.cross(s,l,c),o(r)?(r[0]=c.x,r[1]=c.y,r[2]=c.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=l.x,r[9]=l.y,r[10]=l.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new f(c.x,s.x,l.x,e.x,c.y,s.y,l.y,e.y,c.z,s.z,l.z,e.z,0,0,0,1)};var x=new v,T=new i(1,1,1),P=new f;_.headingPitchRollToFixedFrame=function(e,t,r,n,o,a){var s=v.fromHeadingPitchRoll(t,r,n,x),l=f.fromTranslationQuaternionRotationScale(i.ZERO,s,T,P);return a=_.eastNorthUpToFixedFrame(e,o,a),f.multiply(a,l,a)};var A=new f,D=new m;_.headingPitchRollQuaternion=function(e,t,i,r,n,o){var a=_.headingPitchRollToFixedFrame(e,t,i,r,n,A),s=f.getRotation(a,D);return v.fromRotationMatrix(s,o)};var M=24110.54841,I=8640184.812866,O=.093104,R=-62e-7,L=1.1772758384668e-19,N=72921158553e-15,F=p.TWO_PI/86400,B=new d;_.computeTemeToPseudoFixedMatrix=function(e,t){B=d.addSeconds(e,-d.computeTaiMinusUtc(e),B);var i,r=B.dayNumber,n=B.secondsOfDay,a=r-2451545;i=n>=43200?(a+.5)/g.DAYS_PER_JULIAN_CENTURY:(a-.5)/g.DAYS_PER_JULIAN_CENTURY;var s=M+i*(I+i*(O+i*R)),l=s*F%p.TWO_PI,u=N+L*(r-2451545.5),c=(n+.5*g.SECONDS_PER_DAY)%g.SECONDS_PER_DAY,h=l+u*c,f=Math.cos(h),v=Math.sin(h);return o(t)?(t[0]=f,t[1]=-v,t[2]=0,t[3]=v,t[4]=f,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(f,v,0,-v,f,0,0,0,1)},_.iau2006XysData=new c,_.earthOrientationParameters=s.NONE;var z=32.184,k=2451545;_.preloadIcrfFixed=function(t){var i=t.start.dayNumber,r=t.start.secondsOfDay+z,n=t.stop.dayNumber,o=t.stop.secondsOfDay+z,a=_.iau2006XysData.preload(i,r,n,o),s=_.earthOrientationParameters.getPromiseToLoad();return e.all([a,s])},_.computeIcrfToFixedMatrix=function(e,t){o(t)||(t=new m);var i=_.computeFixedToIcrfMatrix(e,t);return o(i)?m.transpose(i,t):void 0};var V=new h(0,0,0),U=new l(0,0,0,0,0,0),W=new m,G=new m;_.computeFixedToIcrfMatrix=function(e,t){o(t)||(t=new m);var i=_.earthOrientationParameters.compute(e,U);if(!o(i))return void 0;var r=e.dayNumber,n=e.secondsOfDay+z,a=_.iau2006XysData.computeXysRadians(r,n,V);if(!o(a))return void 0;var s=a.x+i.xPoleOffset,l=a.y+i.yPoleOffset,u=1/(1+Math.sqrt(1-s*s-l*l)),c=W;c[0]=1-u*s*s,c[3]=-u*s*l,c[6]=s,c[1]=-u*s*l,c[4]=1-u*l*l,c[7]=l,c[2]=-s,c[5]=-l,c[8]=1-u*(s*s+l*l);var h=m.fromRotationZ(-a.s,G),f=m.multiply(c,h,W),v=e.dayNumber,y=e.secondsOfDay-d.computeTaiMinusUtc(e)+i.ut1MinusUtc,C=v-2451545,w=y/g.SECONDS_PER_DAY,S=.779057273264+w+.00273781191135448*(C+w);S=S%1*p.TWO_PI;var E=m.fromRotationZ(S,G),b=m.multiply(f,E,W),x=Math.cos(i.xPoleWander),T=Math.cos(i.yPoleWander),P=Math.sin(i.xPoleWander),A=Math.sin(i.yPoleWander),D=r-k+n/g.SECONDS_PER_DAY;D/=36525;var M=-47e-6*D*p.RADIANS_PER_DEGREE/3600,I=Math.cos(M),O=Math.sin(M),R=G;return R[0]=x*I,R[1]=x*O,R[2]=P,R[3]=-T*O+A*P*I,R[4]=T*I+A*P*O,R[5]=-A*x,R[6]=-A*O-T*P*I,R[7]=A*I-T*P*O,R[8]=T*x,m.multiply(b,R,t)};var H=new r;_.pointToWindowCoordinates=function(e,t,i,r){return r=_.pointToGLWindowCoordinates(e,t,i,r),r.y=2*t[5]-r.y,r},_.pointToGLWindowCoordinates=function(e,i,n,a){o(a)||(a=new t); -var s=H;return f.multiplyByVector(e,r.fromElements(n.x,n.y,n.z,1,s),s),r.multiplyByScalar(s,1/s.w,s),f.multiplyByVector(i,s,s),t.fromCartesian4(s,a)};var q=new i,j=new i,Y=new i;return _.rotationMatrixFromPositionVelocity=function(e,t,r,a){var s=n(r,u.WGS84).geodeticSurfaceNormal(e,q),l=i.cross(t,s,j);i.equalsEpsilon(l,i.ZERO,p.EPSILON6)&&(l=i.clone(i.UNIT_X,l));var c=i.cross(l,t,Y);return i.cross(t,c,l),i.negate(l,l),o(a)||(a=new m),a[0]=t.x,a[1]=t.y,a[2]=t.z,a[3]=l.x,a[4]=l.y,a[5]=l.z,a[6]=c.x,a[7]=c.y,a[8]=c.z,a},_}),i("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";var f=new r,v=function(e,t){t=n(t,l.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=i.fromCartesian4(h.getColumn(r,0,f)),this._yAxis=i.fromCartesian4(h.getColumn(r,1,f));var o=i.fromCartesian4(h.getColumn(r,2,f));this._plane=d.fromPointNormal(e,o)};a(v.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var g=new e;v.fromPoints=function(t,i){var r=e.fromPoints(t,g);return new v(r.center,i)};var _=new p,y=new i;v.prototype.projectPointOntoPlane=function(e,r){var n=_;n.origin=e,i.normalize(e,n.direction);var a=u.rayPlane(n,this._plane,y);if(o(a)||(i.negate(n.direction,n.direction),a=u.rayPlane(n,this._plane,y)),o(a)){var s=i.subtract(a,this._origin,a),l=i.dot(this._xAxis,s),c=i.dot(this._yAxis,s);return o(r)?(r.x=l,r.y=c,r):new t(l,c)}return void 0},v.prototype.projectPointsOntoPlane=function(e,t){o(t)||(t=[]);for(var i=0,r=e.length,n=0;r>n;n++){var a=this.projectPointOntoPlane(e[n],t[i]);o(a)&&(t[i]=a,i++)}return t.length=i,t},v.prototype.projectPointToNearestOnPlane=function(e,r){o(r)||(r=new t);var n=_;n.origin=e,i.clone(this._plane.normal,n.direction);var a=u.rayPlane(n,this._plane,y);o(a)||(i.negate(n.direction,n.direction),a=u.rayPlane(n,this._plane,y));var s=i.subtract(a,this._origin,a),l=i.dot(this._xAxis,s),c=i.dot(this._yAxis,s);return r.x=l,r.y=c,r},v.prototype.projectPointsToNearestOnPlane=function(e,t){o(t)||(t=[]);var i=e.length;t.length=i;for(var r=0;i>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var C=new i;return v.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;o(t)?t.length=r:t=new Array(r);for(var n=this._ellipsoid,a=this._origin,s=this._xAxis,l=this._yAxis,u=C,c=0;r>c;++c){var h=e[c];i.multiplyByScalar(s,h.x,u),o(t[c])||(t[c]=new i);var d=i.add(a,u,t[c]);i.multiplyByScalar(l,h.y,u),i.add(d,u,d),n.scaleToGeocentricSurface(d,d)}return t},v}),i("Core/OrientedBoundingBox",["./Cartesian2","./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Intersect","./Plane","./Rectangle","./Math","./Matrix3"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";var p=function(e,i){this.center=t.clone(r(e,t.ZERO)),this.halfAxes=d.clone(r(i,d.ZERO))},m=new t,f=new t,v=function(e,i,r,o,a,s,l,u){n(u)||(u=new p);var c=u.halfAxes;d.setColumn(c,0,e.xAxis,c),d.setColumn(c,1,e.yAxis,c),d.setColumn(c,2,e.zAxis,c);var h=m;h.x=(i+r)/2,h.y=(o+a)/2,h.z=(s+l)/2;var v=f;v.x=(r-i)/2,v.y=(a-o)/2,v.z=(l-s)/2;var g=u.center;return h=d.multiplyByVector(c,h,h),t.add(e.origin,h,g),d.multiplyByScale(c,v,c),u},g=new i,_=new t,y=[new i,new i,new i,new i,new i,new i,new i,new i],C=[new t,new t,new t,new t,new t,new t,new t,new t],w=[new e,new e,new e,new e,new e,new e,new e,new e];return p.fromRectangle=function(e,t,i,n,o){t=r(t,0),i=r(i,0),n=r(n,a.WGS84);var l=c.center(e,g),h=n.cartographicToCartesian(l,_),d=new s(h,n),p=d.plane,m=y[0],f=y[1],S=y[2],E=y[3],b=y[4],x=y[5],T=y[6],P=y[7],A=l.longitude,D=e.south<0&&e.north>0?0:l.latitude;T.latitude=x.latitude=b.latitude=e.south,P.latitude=E.latitude=D,m.latitude=f.latitude=S.latitude=e.north,T.longitude=P.longitude=m.longitude=e.west,x.longitude=f.longitude=A,b.longitude=E.longitude=S.longitude=e.east,S.height=f.height=m.height=P.height=T.height=x.height=b.height=E.height=i,n.cartographicArrayToCartesianArray(y,C),d.projectPointsToNearestOnPlane(C,w);var M=Math.min(w[6].x,w[7].x,w[0].x),I=Math.max(w[2].x,w[3].x,w[4].x),O=Math.min(w[4].y,w[5].y,w[6].y),R=Math.max(w[0].y,w[1].y,w[2].y);S.height=m.height=b.height=T.height=t,n.cartographicArrayToCartesianArray(y,C);var L=Math.min(u.getPointDistance(p,C[0]),u.getPointDistance(p,C[2]),u.getPointDistance(p,C[4]),u.getPointDistance(p,C[6])),N=i;return v(d,M,I,O,R,L,N,o)},p.clone=function(e,i){return n(e)?n(i)?(t.clone(e.center,i.center),d.clone(e.halfAxes,i.halfAxes),i):new p(e.center,e.halfAxes):void 0},p.intersectPlane=function(e,i){var r=e.center,n=i.normal,o=e.halfAxes,a=n.x,s=n.y,u=n.z,c=Math.abs(a*o[d.COLUMN0ROW0]+s*o[d.COLUMN0ROW1]+u*o[d.COLUMN0ROW2])+Math.abs(a*o[d.COLUMN1ROW0]+s*o[d.COLUMN1ROW1]+u*o[d.COLUMN1ROW2])+Math.abs(a*o[d.COLUMN2ROW0]+s*o[d.COLUMN2ROW1]+u*o[d.COLUMN2ROW2]),h=t.dot(n,r)+i.distance;return-c>=h?l.OUTSIDE:h>=c?l.INSIDE:l.INTERSECTING},p.prototype.intersectPlane=function(e){return p.intersectPlane(this,e)},p.equals=function(e,i){return e===i||n(e)&&n(i)&&t.equals(e.center,i.center)&&d.equals(e.halfAxes,i.halfAxes)},p.prototype.clone=function(e){return p.clone(this,e)},p.prototype.equals=function(e){return p.equals(this,e)},p}),i("Core/Intersections2D",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var i={};return i.clipTriangleAtAxisAlignedThreshold=function(e,i,r,n,o,a){t(a)?a.length=0:a=[];var s,l,u;i?(s=e>r,l=e>n,u=e>o):(s=r>e,l=n>e,u=o>e);var c,h,d,p,m,f,v=s+l+u;return 1===v?s?(c=(e-r)/(n-r),h=(e-r)/(o-r),a.push(1),a.push(2),1!==h&&(a.push(-1),a.push(0),a.push(2),a.push(h)),1!==c&&(a.push(-1),a.push(0),a.push(1),a.push(c))):l?(d=(e-n)/(o-n),p=(e-n)/(r-n),a.push(2),a.push(0),1!==p&&(a.push(-1),a.push(1),a.push(0),a.push(p)),1!==d&&(a.push(-1),a.push(1),a.push(2),a.push(d))):u&&(m=(e-o)/(r-o),f=(e-o)/(n-o),a.push(0),a.push(1),1!==f&&(a.push(-1),a.push(2),a.push(1),a.push(f)),1!==m&&(a.push(-1),a.push(2),a.push(0),a.push(m))):2===v?s||r===e?l||n===e?u||o===e||(h=(e-r)/(o-r),d=(e-n)/(o-n),a.push(2),a.push(-1),a.push(0),a.push(2),a.push(h),a.push(-1),a.push(1),a.push(2),a.push(d)):(f=(e-o)/(n-o),c=(e-r)/(n-r),a.push(1),a.push(-1),a.push(2),a.push(1),a.push(f),a.push(-1),a.push(0),a.push(1),a.push(c)):(p=(e-n)/(r-n),m=(e-o)/(r-o),a.push(0),a.push(-1),a.push(1),a.push(0),a.push(p),a.push(-1),a.push(2),a.push(0),a.push(m)):3===v||(a.push(0),a.push(1),a.push(2)),a},i.computeBarycentricCoordinates=function(i,r,n,o,a,s,l,u,c){var h=n-l,d=l-a,p=s-u,m=o-u,f=1/(p*h+d*m),v=r-u,g=i-l,_=(p*g+d*v)*f,y=(-m*g+h*v)*f,C=1-_-y;return t(c)?(c.x=_,c.y=y,c.z=C,c):new e(_,y,C)},i}),i("Core/QuantizedMeshTerrainData",["../ThirdParty/when","./BoundingSphere","./Cartesian3","./defaultValue","./defined","./defineProperties","./DeveloperError","./IndexDatatype","./Intersections2D","./Math","./OrientedBoundingBox","./TaskProcessor","./TerrainMesh"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";function p(e,t,i){f.length=e.length;for(var r=!1,n=0,o=e.length;o>n;++n)f[n]=e[n],r=r||n>0&&t(e[n-1],e[n])>0;return r?(f.sort(t),s.createTypedArray(i,f)):e}var m=function(e){function t(e,t){return a[e]-a[t]}function i(e,t){return o[e]-o[t]}this._quantizedVertices=e.quantizedVertices,this._encodedNormals=e.encodedNormals,this._indices=e.indices,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._boundingSphere=e.boundingSphere,this._orientedBoundingBox=e.orientedBoundingBox,this._horizonOcclusionPoint=e.horizonOcclusionPoint;var n=this._quantizedVertices.length/3,o=this._uValues=this._quantizedVertices.subarray(0,n),a=this._vValues=this._quantizedVertices.subarray(n,2*n);this._heightValues=this._quantizedVertices.subarray(2*n,3*n),this._westIndices=p(e.westIndices,t,n),this._southIndices=p(e.southIndices,i,n),this._eastIndices=p(e.eastIndices,t,n),this._northIndices=p(e.northIndices,i,n),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=r(e.childTileMask,15),this._createdByUpsampling=r(e.createdByUpsampling,!1),this._waterMask=e.waterMask};o(m.prototype,{waterMask:{get:function(){return this._waterMask}}});var f=[],v=new h("createVerticesFromQuantizedTerrainMesh");m.prototype.createMesh=function(t,i,r,o){var a=t.ellipsoid,l=t.tileXYToRectangle(i,r,o),u=v.scheduleTask({minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,quantizedVertices:this._quantizedVertices,octEncodedNormals:this._encodedNormals,indices:this._indices,westIndices:this._westIndices,southIndices:this._southIndices,eastIndices:this._eastIndices,northIndices:this._northIndices,westSkirtHeight:this._westSkirtHeight,southSkirtHeight:this._southSkirtHeight,eastSkirtHeight:this._eastSkirtHeight,northSkirtHeight:this._northSkirtHeight,rectangle:l,relativeToCenter:this._boundingSphere.center,ellipsoid:a});if(!n(u))return void 0;var c=this;return e(u,function(e){var t=c._quantizedVertices.length/3;t+=c._westIndices.length+c._southIndices.length+c._eastIndices.length+c._northIndices.length;var i=s.createTypedArray(t,e.indices);return new d(c._boundingSphere.center,new Float32Array(e.vertices),i,c._minimumHeight,c._maximumHeight,c._boundingSphere,c._horizonOcclusionPoint,n(c._encodedNormals)?7:6,c._orientedBoundingBox)})};var g=new h("upsampleQuantizedTerrainMesh");m.prototype.upsample=function(r,o,a,l,u,h,d){var p=2*o!==u,f=2*a===h,v=r.ellipsoid,_=r.tileXYToRectangle(u,h,d),y=g.scheduleTask({vertices:this._quantizedVertices,indices:this._indices,encodedNormals:this._encodedNormals,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:p,isNorthChild:f,childRectangle:_,ellipsoid:v});if(!n(y))return void 0;var C=Math.min(this._westSkirtHeight,this._eastSkirtHeight);C=Math.min(C,this._southSkirtHeight),C=Math.min(C,this._northSkirtHeight);var w=p?.5*C:this._westSkirtHeight,S=f?.5*C:this._southSkirtHeight,E=p?this._eastSkirtHeight:.5*C,b=f?this._northSkirtHeight:.5*C;return e(y,function(e){var r,o=new Uint16Array(e.vertices),a=s.createTypedArray(o.length/3,e.indices);return n(e.encodedNormals)&&(r=new Uint8Array(e.encodedNormals)),new m({quantizedVertices:o,indices:a,encodedNormals:r,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:t.clone(e.boundingSphere),orientedBoundingBox:c.clone(e.orientedBoundingBox),horizonOcclusionPoint:i.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:w,southSkirtHeight:S,eastSkirtHeight:E,northSkirtHeight:b,childTileMask:0,createdByUpsampling:!0})})};var _=32767,y=new i;return m.prototype.interpolateHeight=function(e,t,i){var r=u.clamp((t-e.west)/e.width,0,1);r*=_;var n=u.clamp((i-e.south)/e.height,0,1);n*=_;for(var o=this._uValues,a=this._vValues,s=this._heightValues,c=this._indices,h=0,d=c.length;d>h;h+=3){var p=c[h],m=c[h+1],f=c[h+2],v=o[p],g=o[m],C=o[f],w=a[p],S=a[m],E=a[f],b=l.computeBarycentricCoordinates(r,n,v,w,g,S,C,E,y);if(b.x>=-1e-15&&b.y>=-1e-15&&b.z>=-1e-15){var x=b.x*s[p]+b.y*s[m]+b.z*s[f];return u.lerp(this._minimumHeight,this._maximumHeight,x/_)}}return void 0},m.prototype.isChildAvailable=function(e,t,i,r){var n=2;return i!==2*e&&++n,r!==2*t&&(n-=2),0!==(this._childTileMask&1<0?o.raiseEvent(d):console.log('An error occurred in "'+n.constructor.name+'": '+i(a)),d.retry&&t(c)&&c(),d},r.handleSuccess=function(e){t(e)&&(e.timesRetried=-1)},r}),i("Core/CesiumTerrainProvider",["../ThirdParty/Uri","../ThirdParty/when","./appendForwardSlash","./BoundingSphere","./Cartesian3","./Credit","./defaultValue","./defined","./defineProperties","./DeveloperError","./Event","./GeographicTilingScheme","./HeightmapTerrainData","./IndexDatatype","./loadArrayBuffer","./loadJson","./Math","./Matrix3","./OrientedBoundingBox","./QuantizedMeshTerrainData","./RuntimeError","./TerrainProvider","./throttleRequestByServer","./TileProviderError"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E){"use strict";function b(e){if(s(e)&&0!==e.length){var t=e.join("-");return{Accept:"application/vnd.quantized-mesh;extensions="+t+",application/octet-stream;q=0.9,*/*;q=0.01"}}return{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"}}function x(e,t){var i=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new d({buffer:i,childTileMask:new Uint8Array(t,i.byteLength,1)[0],waterMask:new Uint8Array(t,i.byteLength+1,t.byteLength-i.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure})}function T(e,t,i,o,a,s){function l(e){return e>>1^-(1&e)}var u=0,c=3,h=c+1,d=Float64Array.BYTES_PER_ELEMENT*c,m=Float64Array.BYTES_PER_ELEMENT*h,f=3,g=Uint16Array.BYTES_PER_ELEMENT*f,C=3,w=Uint16Array.BYTES_PER_ELEMENT,S=w*C,E=new DataView(t),b=new n(E.getFloat64(u,!0),E.getFloat64(u+8,!0),E.getFloat64(u+16,!0));u+=d;var x=E.getFloat32(u,!0);u+=Float32Array.BYTES_PER_ELEMENT;var T=E.getFloat32(u,!0);u+=Float32Array.BYTES_PER_ELEMENT;var A=new r(new n(E.getFloat64(u,!0),E.getFloat64(u+8,!0),E.getFloat64(u+16,!0)),E.getFloat64(u+d,!0));u+=m;var D=new n(E.getFloat64(u,!0),E.getFloat64(u+8,!0),E.getFloat64(u+16,!0));u+=d;var I=E.getUint32(u,!0);u+=Uint32Array.BYTES_PER_ELEMENT;var O=new Uint16Array(t,u,3*I);u+=I*g,I>65536&&(w=Uint32Array.BYTES_PER_ELEMENT,S=w*C);var R,L=O.subarray(0,I),N=O.subarray(I,2*I),F=O.subarray(2*I,3*I),B=0,z=0,k=0;for(R=0;I>R;++R)B+=l(L[R]),z+=l(N[R]),k+=l(F[R]),L[R]=B,N[R]=z,F[R]=k;0!==u%w&&(u+=w-u%w);var V=E.getUint32(u,!0);u+=Uint32Array.BYTES_PER_ELEMENT;var U=p.createTypedArrayFromArrayBuffer(I,t,u,V*C);u+=V*S;var W=0;for(R=0;R=n.length)return 0;var a=n[o],s=0;return s|=A(a,2*i,2*r)?1:0,s|=A(a,2*i+1,2*r)?2:0,s|=A(a,2*i,2*r+1)?4:0,s|=A(a,2*i+1,2*r+1)?8:0}function A(e,t,i){for(var r=0,n=e.length;n>r;++r){var o=e[r];if(t>=o.startX&&t<=o.endX&&i>=o.startY&&i<=o.endY)return!0}return!1}var D=function(r){function n(t){var i;if(!t.format)return i="The tile format is not specified in the layer.json file.",m=E.handleError(m,v,v._errorEvent,i,void 0,void 0,void 0,u),void 0;if(!t.tiles||0===t.tiles.length)return i="The layer.json file does not specify any tile URL templates.",m=E.handleError(m,v,v._errorEvent,i,void 0,void 0,void 0,u),void 0;if("heightmap-1.0"===t.format)v._heightmapStructure={heightScale:.2,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1},v._hasWaterMask=!0,v._requestWaterMask=!0;else if(0!==t.format.indexOf("quantized-mesh-1."))return i='The tile format "'+t.format+'" is invalid or not supported.',m=E.handleError(m,v,v._errorEvent,i,void 0,void 0,void 0,u),void 0;var r=new e(p);v._tileUrlTemplates=t.tiles;for(var n=0;n=r.length)return!1;var n=r[i],o=this._tilingScheme.getNumberOfYTilesAtLevel(i),a=o-t-1;return A(n,e,a)}return void 0},D}),i("Core/EllipseGeometryLibrary",["./Cartesian3","./Math","./Matrix3","./Quaternion"],function(e,t,i,r){"use strict";function n(t,n,o,c,h,d,p,m,f,v){var g=t+n;e.multiplyByScalar(c,Math.cos(g),a),e.multiplyByScalar(o,Math.sin(g),s),e.add(a,s,a);var _=Math.cos(t);_*=_;var y=Math.sin(t);y*=y;var C=d/Math.sqrt(p*_+h*y),w=C/m;return r.fromAxisAngle(a,w,l),i.fromQuaternion(l,u),i.multiplyByVector(u,f,v),e.normalize(v,v),e.multiplyByScalar(v,m,v),v}var o={},a=new e,s=new e,l=new r,u=new i,c=new e,h=new e,d=new e,p=new e;o.raisePositionsToHeight=function(t,i,r){for(var n=i.ellipsoid,o=i.height,a=i.extrudedHeight,s=r?2*(t.length/3):t.length/3,l=new Float64Array(3*s),u=t.length,m=r?u:0,f=0;u>f;f+=3){var v=f+1,g=f+2,_=e.fromArray(t,f,c);n.scaleToGeodeticSurface(_,_);var y=e.clone(_,h),C=n.geodeticSurfaceNormal(_,p),w=e.multiplyByScalar(C,o,d);e.add(_,w,_),r&&(e.multiplyByScalar(C,a,w),e.add(y,w,y),l[f+m]=y.x,l[v+m]=y.y,l[g+m]=y.z),l[f]=_.x,l[v]=_.y,l[g]=_.z}return l};var m=new e,f=new e,v=new e;return o.computeEllipsePositions=function(i,r,o){var a=i.semiMinorAxis,s=i.semiMajorAxis,l=i.rotation,u=i.center,p=8*i.granularity,g=a*a,_=s*s,y=s*a,C=e.magnitude(u),w=e.normalize(u,m),S=e.cross(e.UNIT_Z,u,f);S=e.normalize(S,S);var E=e.cross(w,S,v),b=1+Math.ceil(t.PI_OVER_TWO/p),x=t.PI_OVER_TWO/(b-1),T=t.PI_OVER_TWO-b*x;0>T&&(b-=Math.ceil(Math.abs(T)/x));var P,A,D,M,I,O=2*b*(b+1),R=r?new Array(3*O):void 0,L=0,N=c,F=h,B=3*(2*b+2*(b-1)),z=B-1,k=0,V=o?new Array(B):void 0;for(T=t.PI_OVER_TWO,P=0;b>P;++P){if(N=n(T,l,E,S,g,y,_,C,w,N),F=n(Math.PI-T,l,E,S,g,y,_,C,w,F),r){for(R[L++]=N.x,R[L++]=N.y,R[L++]=N.z,D=2*P+2,A=1;D-1>A;++A)M=A/(D-1),I=e.lerp(N,F,M,d),R[L++]=I.x,R[L++]=I.y,R[L++]=I.z;R[L++]=F.x,R[L++]=F.y,R[L++]=F.z}o&&(V[z--]=N.z,V[z--]=N.y,V[z--]=N.x,0!==P&&(V[k++]=F.x,V[k++]=F.y,V[k++]=F.z)),T=t.PI_OVER_TWO-(P+1)*x}for(P=b;P>0;--P){if(T=t.PI_OVER_TWO-(P-1)*x,N=n(-T,l,E,S,g,y,_,C,w,N),F=n(T+Math.PI,l,E,S,g,y,_,C,w,F),r){for(R[L++]=N.x,R[L++]=N.y,R[L++]=N.z,D=2*(P-1)+2,A=1;D-1>A;++A)M=A/(D-1),I=e.lerp(N,F,M,d),R[L++]=I.x,R[L++]=I.y,R[L++]=I.z;R[L++]=F.x,R[L++]=F.y,R[L++]=F.z}o&&(V[z--]=N.z,V[z--]=N.y,V[z--]=N.x,1!==P&&(V[k++]=F.x,V[k++]=F.y,V[k++]=F.z))}var U={};return r&&(U.positions=R,U.numPts=b),o&&(U.outerPositions=V),U},o}),i("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,i,r){"use strict";var n=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=r.clone(e(t.modelMatrix,r.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return n}),i("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,i){"use strict";var r=new t,n=new t,o=new t,a=function(a,s,l,u,c){i(c)||(c=new t);var h,d,p,m,f,v,g,_;i(s.z)?(h=t.subtract(l,s,r),d=t.subtract(u,s,n),p=t.subtract(a,s,o),m=t.dot(h,h),f=t.dot(h,d),v=t.dot(h,p),g=t.dot(d,d),_=t.dot(d,p)):(h=e.subtract(l,s,r),d=e.subtract(u,s,n),p=e.subtract(a,s,o),m=e.dot(h,h),f=e.dot(h,d),v=e.dot(h,p),g=e.dot(d,d),_=e.dot(d,p));var y=1/(m*g-f*f);return c.y=(g*v-f*_)*y,c.z=(m*_-f*v)*y,c.x=1-c.y-c.z,c};return a}),i("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var i=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};i.encode=function(e,i){t(i)||(i={high:0,low:0});var r;return e>=0?(r=65536*Math.floor(e/65536),i.high=r,i.low=e-r):(r=65536*Math.floor(-e/65536),i.high=-r,i.low=e+r),i};var r={high:0,low:0};i.fromCartesian=function(e,n){t(n)||(n=new i);var o=n.high,a=n.low;return i.encode(e.x,r),o.x=r.high,a.x=r.low,i.encode(e.y,r),o.y=r.high,a.y=r.low,i.encode(e.z,r),o.z=r.high,a.z=r.low,n};var n=new i;return i.writeElements=function(e,t,r){i.fromCartesian(e,n);var o=n.high,a=n.low;t[r]=o.x,t[r+1]=o.y,t[r+2]=o.z,t[r+3]=a.x,t[r+4]=a.y,t[r+5]=a.z},i}),i("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var i={};return i.calculateACMR=function(i){i=e(i,e.EMPTY_OBJECT);var r=i.indices,n=i.maximumIndex,o=e(i.cacheSize,24),a=r.length;if(!t(n)){n=0;for(var s=0,l=r[s];a>s;)l>n&&(n=l),++s,l=r[s]}for(var u=[],c=0;n+1>c;c++)u[c]=0;for(var h=o+1,d=0;a>d;++d)h-u[r[d]]>o&&(u[r[d]]=h,++h);return(h-o+1)/(a/3)},i.tipsify=function(i){function r(e,t,i,r){for(;t.length>=1;){var n=t[t.length-1];if(t.splice(t.length-1,1),e[n].numLiveTriangles>0)return n}for(;r>o;){if(e[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function n(e,t,i,n,o,a,s){for(var l,u=-1,c=-1,h=0;hc||-1===c)&&(c=l,u=d)),++h}return-1===u?r(n,a,e,s):u}i=e(i,e.EMPTY_OBJECT);var o,a=i.indices,s=i.maximumIndex,l=e(i.cacheSize,24),u=a.length,c=0,h=0,d=a[h],p=u;if(t(s))c=s+1;else{for(;p>h;)d>c&&(c=d),++h,d=a[h];if(-1===c)return 0;++c}for(var m=[],f=0;c>f;f++)m[f]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};h=0;for(var v=0;p>h;)m[a[h]].vertexTriangles.push(v),++m[a[h]].numLiveTriangles,m[a[h+1]].vertexTriangles.push(v),++m[a[h+1]].numLiveTriangles,m[a[h+2]].vertexTriangles.push(v),++m[a[h+2]].numLiveTriangles,++v,h+=3;var g=0,_=l+1;o=1;var y,C,w=[],S=[],E=0,b=[],x=u/3,T=[];for(f=0;x>f;f++)T[f]=!1;for(var P,A;-1!==g;){w=[],C=m[g],A=C.vertexTriangles.length;for(var D=0;A>D;++D)if(v=C.vertexTriangles[D],!T[v]){T[v]=!0,h=v+v+v;for(var M=0;3>M;++M)P=a[h],w.push(P),S.push(P),b[E]=P,++E,y=m[P],--y.numLiveTriangles,_-y.timeStamp>l&&(y.timeStamp=_,++_),++h}g=n(a,l,w,m,_,S,c)}return b},i}),i("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x){"use strict";function T(e,t,i,r,n){e[t++]=i,e[t++]=r,e[t++]=r,e[t++]=n,e[t++]=n,e[t]=i}function P(e){for(var t=e.length,i=6*(t/3),r=g.createTypedArray(t,i),n=0,o=0;t>o;o+=3,n+=6)T(r,n,e[o],e[o+1],e[o+2]);return r}function A(e){var t=e.length;if(t>=3){var i=6*(t-2),r=g.createTypedArray(t,i);T(r,0,e[0],e[1],e[2]);for(var n=6,o=3;t>o;++o,n+=6)T(r,n,e[o-1],e[o],e[o-2]);return r}return new Uint16Array}function D(e){if(e.length>0){for(var t=e.length-1,i=6*(t-1),r=g.createTypedArray(t,i),n=e[0],o=0,a=1;t>a;++a,o+=6)T(r,o,n,e[a],e[a+1]);return r}return new Uint16Array}function M(e){var t={};for(var i in e)if(e.hasOwnProperty(i)&&u(e[i])&&u(e[i].values)){var r=e[i];t[i]=new m({componentDatatype:r.componentDatatype,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize,values:[]})}return t}function I(e,t,i){for(var r in t)if(t.hasOwnProperty(r)&&u(t[r])&&u(t[r].values))for(var n=t[r],o=0;oo;o+=3)n.unpack(i,o,ot),S.multiplyByPoint(e,ot,ot),n.pack(ot,i,o)}function R(e,t){if(u(t))for(var i=t.values,r=i.length,o=0;r>o;o+=3)n.unpack(i,o,ot),w.multiplyByVector(e,ot,ot),ot=n.normalize(ot,ot),n.pack(ot,i,o)}function L(e,t){var i,r=e.length,n={},o=e[0][t].attributes;for(i in o)if(o.hasOwnProperty(i)&&u(o[i])&&u(o[i].values)){for(var a=o[i],l=a.values.length,c=!0,h=1;r>h;++h){var d=e[h][t].attributes[i];if(!u(d)||a.componentDatatype!==d.componentDatatype||a.componentsPerAttribute!==d.componentsPerAttribute||a.normalize!==d.normalize){c=!1;break}l+=d.values.length}c&&(n[i]=new m({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:s.createTypedArray(a.componentDatatype,l)}))}return n}function N(e,t){var r,o,a,s,l=e.length;e[0].modelMatrix;var c,h,d,m=u(e[0][t].indices),f=e[0][t].primitiveType,v=L(e,t);for(r in v)if(v.hasOwnProperty(r))for(c=v[r].values,s=0,o=0;l>o;++o)for(h=e[o][t].attributes[r].values,d=h.length,a=0;d>a;++a)c[s++]=h[a];var _;if(m){var y=0;for(o=0;l>o;++o)y+=e[o][t].indices.length;var C=p.computeNumberOfVertices(new p({attributes:v,primitiveType:b.POINTS})),w=g.createTypedArray(C,y),S=0,E=0;for(o=0;l>o;++o){var x=e[o][t].indices,T=x.length;for(s=0;T>s;++s)w[S++]=E+x[s];E+=p.computeNumberOfVertices(e[o][t])}_=w}var P,A=new n,D=0;for(o=0;l>o;++o){if(P=e[o][t].boundingSphere,!u(P)){A=void 0;break}n.add(P.center,A,A)}if(u(A))for(n.divideByScalar(A,l,A),o=0;l>o;++o){P=e[o][t].boundingSphere;var M=n.magnitude(n.subtract(P.center,A,lt))+P.radius;M>D&&(D=M)}return new p({attributes:v,indices:_,primitiveType:f,boundingSphere:u(A)?new i(A,D):void 0})}function F(e){if(u(e.indices))return e;for(var t=p.computeNumberOfVertices(e),i=g.createTypedArray(t,t),r=0;t>r;++r)i[r]=r;return e.indices=i,e}function B(e){var t=p.computeNumberOfVertices(e),i=g.createTypedArray(t,3*(t-2));i[0]=1,i[1]=0,i[2]=2;for(var r=3,n=3;t>n;++n)i[r++]=n-1,i[r++]=0,i[r++]=n;return e.indices=i,e.primitiveType=b.TRIANGLES,e}function z(e){var t=p.computeNumberOfVertices(e),i=g.createTypedArray(t,3*(t-2));i[0]=0,i[1]=1,i[2]=2,t>3&&(i[3]=0,i[4]=2,i[5]=3);for(var r=6,n=3;t-1>n;n+=2)i[r++]=n,i[r++]=n-1,i[r++]=n+1,t>n+2&&(i[r++]=n,i[r++]=n+1,i[r++]=n+2);return e.indices=i,e.primitiveType=b.TRIANGLES,e}function k(e){if(u(e.indices))return e;for(var t=p.computeNumberOfVertices(e),i=g.createTypedArray(t,t),r=0;t>r;++r)i[r]=r;return e.indices=i,e}function V(e){var t=p.computeNumberOfVertices(e),i=g.createTypedArray(t,2*(t-1));i[0]=0,i[1]=1;for(var r=2,n=2;t>n;++n)i[r++]=n-1,i[r++]=n;return e.indices=i,e.primitiveType=b.LINES,e}function U(e){var t=p.computeNumberOfVertices(e),i=g.createTypedArray(t,2*t);i[0]=0,i[1]=1;for(var r=2,n=2;t>n;++n)i[r++]=n-1,i[r++]=n;return i[r++]=t-1,i[r]=0,e.indices=i,e.primitiveType=b.LINES,e}function W(e){switch(e.primitiveType){case b.TRIANGLE_FAN:return B(e);case b.TRIANGLE_STRIP:return z(e);case b.TRIANGLES:return F(e);case b.LINE_STRIP:return V(e);case b.LINE_LOOP:return U(e);case b.LINES:return k(e)}return e}function G(e,t){Math.abs(e.y)o?n>a?C.sign(e.y):C.sign(i.y):o>a?C.sign(t.y):C.sign(i.y);var s=0>r;G(e,s),G(t,s),G(i,s)}function q(e,t,i,r){n.add(e,n.multiplyByScalar(n.subtract(t,e,Ct),e.y/(e.y-t.y),Ct),i),n.clone(i,r),G(i,!0),G(r,!1)}function j(e,t,i){if(e.x>=0||t.x>=0||i.x>=0)return void 0;H(e,t,i);var r=e.y<0,n=t.y<0,o=i.y<0,a=0;a+=r?1:0,a+=n?1:0,a+=o?1:0;var s=xt.indices;1===a?(s[1]=3,s[2]=4,s[5]=6,s[7]=6,s[8]=5,r?(q(e,t,wt,Et),q(e,i,St,bt),s[0]=0,s[3]=1,s[4]=2,s[6]=1):n?(q(t,i,wt,Et),q(t,e,St,bt),s[0]=1,s[3]=2,s[4]=0,s[6]=2):o&&(q(i,e,wt,Et),q(i,t,St,bt),s[0]=2,s[3]=0,s[4]=1,s[6]=0)):2===a&&(s[2]=4,s[4]=4,s[5]=3,s[7]=5,s[8]=6,r?n?o||(q(i,e,wt,Et),q(i,t,St,bt),s[0]=0,s[1]=1,s[3]=0,s[6]=2):(q(t,i,wt,Et),q(t,e,St,bt),s[0]=2,s[1]=0,s[3]=2,s[6]=1):(q(e,t,wt,Et),q(e,i,St,bt),s[0]=1,s[1]=2,s[3]=1,s[6]=0));var l=xt.positions;return l[0]=e,l[1]=t,l[2]=i,l.length=3,(1===a||2===a)&&(l[3]=wt,l[4]=St,l[5]=Et,l[6]=bt,l.length=7),xt}function Y(e,t){var r=e.attributes;if(0===r.position.values.length)return void 0;for(var n in r)if(r.hasOwnProperty(n)&&u(r[n])&&u(r[n].values)){var o=r[n];o.values=s.createTypedArray(o.componentDatatype,o.values) -}var a=p.computeNumberOfVertices(e);return e.indices=g.createTypedArray(a,e.indices),t&&(e.boundingSphere=i.fromVertices(r.position.values)),e}function X(e){var t=e.attributes,i={};for(var r in t)if(t.hasOwnProperty(r)&&u(t[r])&&u(t[r].values)){var n=t[r];i[r]=new m({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return new p({attributes:i,indices:[],primitiveType:e.primitiveType})}function Z(e,t,i){var r=u(e.geometry.boundingSphere);t=Y(t,r),i=Y(i,r),u(i)&&!u(t)?e.geometry=i:!u(i)&&u(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=i,e.geometry=void 0)}function J(e,i,o,a,s,l,c,h,d,p,m){if(u(l)||u(c)||u(h)||u(d)){var f=n.fromArray(s,3*e,Tt),v=n.fromArray(s,3*i,Pt),g=n.fromArray(s,3*o,At),_=t(a,f,v,g,Dt);if(u(l)){var y=n.fromArray(l,3*e,Tt),C=n.fromArray(l,3*i,Pt),w=n.fromArray(l,3*o,At);n.multiplyByScalar(y,_.x,y),n.multiplyByScalar(C,_.y,C),n.multiplyByScalar(w,_.z,w);var S=n.add(y,C,y);n.add(S,w,S),n.normalize(S,S),n.pack(S,p.normal.values,3*m)}if(u(c)){var E=n.fromArray(c,3*e,Tt),b=n.fromArray(c,3*i,Pt),x=n.fromArray(c,3*o,At);n.multiplyByScalar(E,_.x,E),n.multiplyByScalar(b,_.y,b),n.multiplyByScalar(x,_.z,x);var T=n.add(E,b,E);n.add(T,x,T),n.normalize(T,T),n.pack(T,p.binormal.values,3*m)}if(u(h)){var P=n.fromArray(h,3*e,Tt),A=n.fromArray(h,3*i,Pt),D=n.fromArray(h,3*o,At);n.multiplyByScalar(P,_.x,P),n.multiplyByScalar(A,_.y,A),n.multiplyByScalar(D,_.z,D);var M=n.add(P,A,P);n.add(M,D,M),n.normalize(M,M),n.pack(M,p.tangent.values,3*m)}if(u(d)){var I=r.fromArray(d,2*e,Mt),O=r.fromArray(d,2*i,It),R=r.fromArray(d,2*o,Ot);r.multiplyByScalar(I,_.x,I),r.multiplyByScalar(O,_.y,O),r.multiplyByScalar(R,_.z,R);var L=r.add(I,O,I);r.add(L,R,L),r.pack(L,p.st.values,2*m)}}}function Q(e,t,i,r,n,o){var a=e.position.values.length/3;if(-1!==n){var s=r[n],l=i[s];return-1===l?(i[s]=a,e.position.values.push(o.x,o.y,o.z),t.push(a),a):(t.push(l),l)}return e.position.values.push(o.x,o.y,o.z),t.push(a),a}function K(e){var t,i,r,o,a,s=e.geometry,l=s.attributes,c=l.position.values,h=u(l.normal)?l.normal.values:void 0,d=u(l.binormal)?l.binormal.values:void 0,p=u(l.tangent)?l.tangent.values:void 0,m=u(l.st)?l.st.values:void 0,f=s.indices,v=X(s),g=X(s),_=[];_.length=c.length/3;var y=[];for(y.length=c.length/3,a=0;a<_.length;++a)_[a]=-1,y[a]=-1;var C=f.length;for(a=0;C>a;a+=3){var w=f[a],S=f[a+1],E=f[a+2],b=n.fromArray(c,3*w),x=n.fromArray(c,3*S),T=n.fromArray(c,3*E),P=j(b,x,T);if(u(P)&&P.positions.length>3)for(var A=P.positions,D=P.indices,M=D.length,I=0;M>I;++I){var O=D[I],R=A[O];R.y<0?(t=g.attributes,i=g.indices,r=_):(t=v.attributes,i=v.indices,r=y),o=Q(t,i,r,f,3>O?a+O:-1,R),J(w,S,E,R,c,h,d,p,m,t,o)}else u(P)&&(b=P.positions[0],x=P.positions[1],T=P.positions[2]),b.y<0?(t=g.attributes,i=g.indices,r=_):(t=v.attributes,i=v.indices,r=y),o=Q(t,i,r,f,a,b),J(w,S,E,b,c,h,d,p,m,t,o),o=Q(t,i,r,f,a+1,x),J(w,S,E,x,c,h,d,p,m,t,o),o=Q(t,i,r,f,a+2,T),J(w,S,E,T,c,h,d,p,m,t,o)}Z(e,g,v)}function $(e){var t,i=e.geometry,r=i.attributes,o=r.position.values,a=i.indices,s=X(i),l=X(i),c=a.length,h=[];h.length=o.length/3;var d=[];for(d.length=o.length/3,t=0;tt;t+=2){var p=a[t],m=a[t+1],f=n.fromArray(o,3*p,Tt),v=n.fromArray(o,3*m,Pt);Math.abs(f.y)h;h+=4){var w=h,S=h+1,E=h+2,b=h+3,x=n.fromArray(a,3*w,zt),T=n.fromArray(a,3*S,kt),P=n.fromArray(a,3*E,Vt),A=n.fromArray(a,3*b,Ut);Math.abs(x.y)d;++d)D.prevPosition.values.push(s[d]);for(D.prevPosition.values.push(x.x,x.y,x.z,x.x,x.y,x.z),I.prevPosition.values.push(x.x,x.y,x.z,x.x,x.y,x.z),d=3*E;3*E+6>d;++d)I.prevPosition.values.push(s[d]);for(d=3*w;3*w+6>d;++d)D.nextPosition.values.push(l[d]);for(D.nextPosition.values.push(P.x,P.y,P.z,P.x,P.y,P.z),I.nextPosition.values.push(P.x,P.y,P.z,P.x,P.y,P.z),d=3*E;3*E+6>d;++d)I.nextPosition.values.push(l[d]);var F=r.fromArray(c,2*w,Ft),B=Math.abs(F.y);D.expandAndWidth.values.push(-1,B,1,B),D.expandAndWidth.values.push(-1,-B,1,-B),I.expandAndWidth.values.push(-1,B,1,B),I.expandAndWidth.values.push(-1,-B,1,-B);var z=n.magnitudeSquared(n.subtract(R,x,Ut));if(z/=n.magnitudeSquared(n.subtract(P,x,Ut)),u(f)){var k=o.fromArray(f,4*w,qt),V=o.fromArray(f,4*E,qt),U=C.lerp(k.x,V.x,z),W=C.lerp(k.y,V.y,z),G=C.lerp(k.z,V.z,z),H=C.lerp(k.w,V.w,z);for(d=4*w;4*w+8>d;++d)D.color.values.push(f[d]);for(D.color.values.push(U,W,G,H),D.color.values.push(U,W,G,H),I.color.values.push(U,W,G,H),I.color.values.push(U,W,G,H),d=4*E;4*E+8>d;++d)I.color.values.push(f[d])}if(u(m)){var q=r.fromArray(m,2*w,Ft),j=r.fromArray(m,2*(h+3),Bt),Y=C.lerp(q.x,j.x,z);for(d=2*w;2*w+4>d;++d)D.st.values.push(m[d]);for(D.st.values.push(Y,q.y),D.st.values.push(Y,j.y),I.st.values.push(Y,q.y),I.st.values.push(Y,j.y),d=2*E;2*E+4>d;++d)I.st.values.push(m[d])}p=D.position.values.length/3-4,M.push(p,p+2,p+1),M.push(p+1,p+2,p+3),p=I.position.values.length/3-4,O.push(p,p+2,p+1),O.push(p+1,p+2,p+3)}else{var J,Q;for(x.y<0?(J=g.attributes,Q=g.indices):(J=v.attributes,Q=v.indices),J.position.values.push(x.x,x.y,x.z),J.position.values.push(T.x,T.y,T.z),J.position.values.push(P.x,P.y,P.z),J.position.values.push(A.x,A.y,A.z),d=3*h;3*h+12>d;++d)J.prevPosition.values.push(s[d]),J.nextPosition.values.push(l[d]);for(d=2*h;2*h+8>d;++d)J.expandAndWidth.values.push(c[d]),u(m)&&J.st.values.push(m[d]);if(u(f))for(d=4*h;4*h+16>d;++d)J.color.values.push(f[d]);p=J.position.values.length/3-4,Q.push(p,p+2,p+1),Q.push(p+1,p+2,p+3)}}Z(e,g,v)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(u(t)){switch(e.primitiveType){case b.TRIANGLES:e.indices=P(t);break;case b.TRIANGLE_STRIP:e.indices=A(t);break;case b.TRIANGLE_FAN:e.indices=D(t);break;default:throw new c("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=b.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,r){t=l(t,"normal"),r=l(r,1e4);for(var n=e.attributes.position.values,o=e.attributes[t].values,a=n.length,c=new Float64Array(2*a),h=0,d=0;a>d;d+=3)c[h++]=n[d],c[h++]=n[d+1],c[h++]=n[d+2],c[h++]=n[d]+o[d]*r,c[h++]=n[d+1]+o[d+1]*r,c[h++]=n[d+2]+o[d+2]*r;var f,v=e.boundingSphere;return u(v)&&(f=new i(v.center,v.radius+r)),new p({attributes:{position:new m({componentDatatype:s.DOUBLE,componentsPerAttribute:3,values:c})},primitiveType:b.LINES,boundingSphere:f})},tt.createAttributeLocations=function(e){var t,i=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],r=e.attributes,n={},o=0,a=i.length;for(t=0;a>t;++t){var s=i[t];u(r[s])&&(n[s]=o++)}for(var l in r)r.hasOwnProperty(l)&&!u(n[l])&&(n[l]=o++);return n},tt.reorderForPreVertexCache=function(e){var t=p.computeNumberOfVertices(e),i=e.indices;if(u(i)){for(var r=new Int32Array(t),n=0;t>n;n++)r[n]=-1;for(var o,a=i,l=a.length,c=g.createTypedArray(t,l),h=0,d=0,m=0;l>h;)o=r[a[h]],-1!==o?c[d]=o:(o=a[h],r[o]=m,c[d]=m,++m),++h,++d;e.indices=c;var f=e.attributes;for(var v in f)if(f.hasOwnProperty(v)&&u(f[v])&&u(f[v].values)){for(var _=f[v],y=_.values,C=0,w=_.componentsPerAttribute,S=s.createTypedArray(_.componentDatatype,m*w);t>C;){var E=r[C];if(-1!==E)for(n=0;w>n;n++)S[w*E+n]=y[w*C+n];++C}_.values=S}}return e},tt.reorderForPostVertexCache=function(e,t){var i=e.indices;if(e.primitiveType===b.TRIANGLES&&u(i)){for(var r=i.length,n=0,o=0;r>o;o++)i[o]>n&&(n=i[o]);e.indices=x.tipsify({indices:i,maximumIndex:n,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],i=p.computeNumberOfVertices(e);if(u(e.indices)&&i>C.SIXTY_FOUR_KILOBYTES){var r,n=[],o=[],a=0,s=M(e.attributes),l=e.indices,c=l.length;e.primitiveType===b.TRIANGLES?r=3:e.primitiveType===b.LINES?r=2:e.primitiveType===b.POINTS&&(r=1);for(var h=0;c>h;h+=r){for(var d=0;r>d;++d){var m=l[h+d],f=n[m];u(f)||(f=a++,n[m]=f,I(s,e.attributes,m)),o.push(f)}a+r>C.SIXTY_FOUR_KILOBYTES&&(t.push(new p({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),n=[],o=[],a=0,s=M(e.attributes))}0!==o.length&&t.push(new p({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var it=new n,rt=new a;tt.projectTo2D=function(e,t,i,r,o){var a=e.attributes[t];o=u(o)?o:new d;for(var l=o.ellipsoid,h=a.values,p=new Float64Array(h.length),f=0,v=0;vc;++c)h.encode(o[c],nt),l[c]=nt.high,u[c]=nt.low;var d=n.componentsPerAttribute;return e.attributes[i]=new m({componentDatatype:s.FLOAT,componentsPerAttribute:d,values:l}),e.attributes[r]=new m({componentDatatype:s.FLOAT,componentsPerAttribute:d,values:u}),delete e.attributes[t],e};var ot=new n,at=new S,st=new w;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(S.equals(t,S.IDENTITY))return e;var r=e.geometry.attributes;O(t,r.position),O(t,r.prevPosition),O(t,r.nextPosition),(u(r.normal)||u(r.binormal)||u(r.tangent))&&(S.inverse(t,at),S.transpose(at,at),S.getRotation(at,st),R(st,r.normal),R(st,r.binormal),R(st,r.tangent));var n=e.geometry.boundingSphere;return u(n)&&(e.geometry.boundingSphere=i.transform(n,t,n)),e.modelMatrix=S.clone(S.IDENTITY),e};var lt=new n;tt.combineInstances=function(e){for(var t=[],i=[],r=e.length,n=0;r>n;++n){var o=e[n];u(o.geometry)?t.push(o):i.push(o)}var a=[];return t.length>0&&a.push(N(t,"geometry")),i.length>0&&(a.push(N(i,"westHemisphereGeometry")),a.push(N(i,"eastHemisphereGeometry"))),a};var ut=new n,ct=new n,ht=new n,dt=new n;tt.computeNormal=function(e){for(var t=e.indices,i=e.attributes,r=i.position.values,o=i.position.values.length/3,a=t.length,l=new Array(o),u=new Array(a/3),c=new Array(a),h=0;o>h;h++)l[h]={indexOffset:0,count:0,currentCount:0};var d=0;for(h=0;a>h;h+=3){var p=t[h],f=t[h+1],v=t[h+2],g=3*p,_=3*f,y=3*v;ct.x=r[g],ct.y=r[g+1],ct.z=r[g+2],ht.x=r[_],ht.y=r[_+1],ht.z=r[_+2],dt.x=r[y],dt.y=r[y+1],dt.z=r[y+2],l[p].count++,l[f].count++,l[v].count++,n.subtract(ht,ct,ht),n.subtract(dt,ct,dt),u[d]=n.cross(ht,dt,new n),d++}var C=0;for(h=0;o>h;h++)l[h].indexOffset+=C,C+=l[h].count;d=0;var w;for(h=0;a>h;h+=3){w=l[t[h]];var S=w.indexOffset+w.currentCount;c[S]=d,w.currentCount++,w=l[t[h+1]],S=w.indexOffset+w.currentCount,c[S]=d,w.currentCount++,w=l[t[h+2]],S=w.indexOffset+w.currentCount,c[S]=d,w.currentCount++,d++}var E=new Float32Array(3*o);for(h=0;o>h;h++){var b=3*h;if(w=l[h],w.count>0){for(n.clone(n.ZERO,ut),d=0;dc;c+=3){var f=t[c],v=t[c+1],g=t[c+2];h=3*f,d=3*v,p=3*g;var _=2*f,y=2*v,C=2*g,w=i[h],S=i[h+1],E=i[h+2],b=o[_],x=o[_+1],T=o[y+1]-x,P=o[C+1]-x,A=1/((o[y]-b)*P-(o[C]-b)*T),D=(P*(i[d]-w)-T*(i[p]-w))*A,M=(P*(i[d+1]-S)-T*(i[p+1]-S))*A,I=(P*(i[d+2]-E)-T*(i[p+2]-E))*A;u[h]+=D,u[h+1]+=M,u[h+2]+=I,u[d]+=D,u[d+1]+=M,u[d+2]+=I,u[p]+=D,u[p+1]+=M,u[p+2]+=I}var O=new Float32Array(3*a),R=new Float32Array(3*a);for(c=0;a>c;c++){h=3*c,d=h+1,p=h+2;var L=n.fromArray(r,h,pt),N=n.fromArray(u,h,ft),F=n.dot(L,N);n.multiplyByScalar(L,F,mt),n.normalize(n.subtract(N,mt,N),N),R[h]=N.x,R[d]=N.y,R[p]=N.z,n.normalize(n.cross(L,N,N),N),O[h]=N.x,O[d]=N.y,O[p]=N.z}return e.attributes.tangent=new m({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:R}),e.attributes.binormal=new m({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:O}),e};var vt=new r,gt=new n,_t=new n,yt=new n;tt.compressVertices=function(t){var i=t.attributes.normal,o=t.attributes.st;if(!u(i)&&!u(o))return t;var a,l,c,h,d=t.attributes.tangent,p=t.attributes.binormal;u(i)&&(a=i.values),u(o)&&(l=o.values),u(d)&&(c=d.values),p&&(h=p.values);var f=u(a)?a.length:l.length,v=u(a)?3:2,g=f/v,_=g,y=u(l)&&u(a)?2:1;y+=u(c)||u(h)?1:0,_*=y;for(var C=new Float32Array(_),w=0,S=0;g>S;++S){u(l)&&(r.fromArray(l,2*S,vt),C[w++]=e.compressTextureCoordinates(vt));var E=3*S;u(a)&&u(c)&&u(h)?(n.fromArray(a,E,gt),n.fromArray(c,E,_t),n.fromArray(h,E,yt),e.octPack(gt,_t,yt,vt),C[w++]=vt.x,C[w++]=vt.y):(u(a)&&(n.fromArray(a,E,gt),C[w++]=e.octEncodeFloat(gt)),u(c)&&(n.fromArray(c,E,gt),C[w++]=e.octEncodeFloat(gt)),u(h)&&(n.fromArray(h,E,gt),C[w++]=e.octEncodeFloat(gt)))}return t.attributes.compressedAttributes=new m({componentDatatype:s.FLOAT,componentsPerAttribute:y,values:C}),u(a)&&delete t.attributes.normal,u(l)&&delete t.attributes.st,u(c)&&delete t.attributes.tangent,u(h)&&delete t.attributes.binormal,t};var Ct=new n,wt=new n,St=new n,Et=new n,bt=new n,xt={positions:new Array(7),indices:new Array(9)},Tt=new n,Pt=new n,At=new n,Dt=new n,Mt=new r,It=new r,Ot=new r,Rt=E.fromPointNormal(n.ZERO,n.UNIT_Y),Lt=new n,Nt=new n,Ft=new r,Bt=new r,zt=new n,kt=new n,Vt=new n,Ut=new n,Wt=new n,Gt=new n,Ht=new n,qt=new o;return new o,tt.splitLongitude=function(e){var t=e.geometry,r=t.boundingSphere;if(u(r)){var n=r.center.x-r.radius;if(n>0||i.intersectPlane(r,E.ORIGIN_ZX_PLANE)!==_.INTERSECTING)return e}if(t.geometryType!==v.NONE)switch(t.geometryType){case v.POLYLINES:et(e);break;case v.TRIANGLES:K(e);break;case v.LINES:$(e)}else W(t),t.primitiveType===b.TRIANGLES?K(e):t.primitiveType===b.LINES&&$(e);return e},tt}),i("Core/EllipseGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EllipseGeometryLibrary","./Ellipsoid","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix3","./PrimitiveType","./Quaternion","./VertexFormat"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w){"use strict";function S(e,r,o){var a=r.vertexFormat,s=r.center,u=r.semiMajorAxis,h=r.semiMinorAxis,m=r.ellipsoid,f=r.stRotation,v=o?2*(e.length/3):e.length/3,g=a.st?new Float32Array(2*v):void 0,y=a.normal?new Float32Array(3*v):void 0,w=a.tangent?new Float32Array(3*v):void 0,S=a.binormal?new Float32Array(3*v):void 0,E=0,b=N,x=F,T=B,P=new c(m),I=P.project(m.cartesianToCartographic(s,z),k),W=m.scaleToGeodeticSurface(s,A);m.geodeticSurfaceNormal(W,W);for(var G=C.fromAxisAngle(W,f,L),H=_.fromQuaternion(G,R),q=t.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,V),j=t.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,U),Y=e.length,X=o?Y:0,Z=2*(X/3),J=0;Y>J;J+=3){var Q=J+1,K=J+2,$=i.fromArray(e,J,A);if(a.st){var et=_.multiplyByVector(H,$,D),tt=P.project(m.cartesianToCartographic(et,z),M);i.subtract(tt,I,tt),O.x=(tt.x+u)/(2*u),O.y=(tt.y+h)/(2*h),q.x=Math.min(O.x,q.x),q.y=Math.min(O.y,q.y),j.x=Math.max(O.x,j.x),j.y=Math.max(O.y,j.y),o&&(g[E+Z]=O.x,g[E+1+Z]=O.y),g[E++]=O.x,g[E++]=O.y}b=m.geodeticSurfaceNormal($,b),(a.normal||a.tangent||a.binormal)&&((a.tangent||a.binormal)&&(x=i.cross(i.UNIT_Z,b,x),_.multiplyByVector(H,x,x)),a.normal&&(y[J]=b.x,y[Q]=b.y,y[K]=b.z,o&&(y[J+X]=-b.x,y[Q+X]=-b.y,y[K+X]=-b.z)),a.tangent&&(w[J]=x.x,w[Q]=x.y,w[K]=x.z,o&&(w[J+X]=-x.x,w[Q+X]=-x.y,w[K+X]=-x.z)),a.binormal&&(T=i.cross(b,x,T),S[J]=T.x,S[Q]=T.y,S[K]=T.z,o&&(S[J+X]=T.x,S[Q+X]=T.y,S[K+X]=T.z)))}if(a.st){Y=g.length;for(var it=0;Y>it;it+=2)g[it]=(g[it]-q.x)/(j.x-q.x),g[it+1]=(g[it+1]-q.y)/(j.y-q.y)}var rt=new p;if(a.position){var nt=l.raisePositionsToHeight(e,r,o);rt.position=new d({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:nt})}return a.st&&(rt.st=new d({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:g})),a.normal&&(rt.normal=new d({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:y})),a.tangent&&(rt.tangent=new d({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:w})),a.binormal&&(rt.binormal=new d({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:S})),rt}function E(e){var t,i,r,n,o,a=new Array(2*e*(e+1)),s=0;for(n=1;e>n;++n){for(r=n*(n+1),t=(n-1)*n,a[s++]=r++,a[s++]=t,a[s++]=r,i=2*n,o=0;i-1>o;++o)a[s++]=r,a[s++]=t++,a[s++]=t,a[s++]=r++,a[s++]=t,a[s++]=r;a[s++]=r++,a[s++]=t,a[s++]=r}for(i=2*e,++r,++t,n=0;i-1>n;++n)a[s++]=r,a[s++]=t++,a[s++]=t,a[s++]=r++,a[s++]=t,a[s++]=r;for(++t,++r,n=e-1;n>0;--n){for(a[s++]=t++,a[s++]=t,a[s++]=r,i=2*n,o=0;i-1>o;++o)a[s++]=r,a[s++]=t++,a[s++]=t,a[s++]=r++,a[s++]=t,a[s++]=r;a[s++]=t++,a[s++]=t++,a[s++]=r++}return a}function b(t){var r=t.center;W=i.multiplyByScalar(t.ellipsoid.geodeticSurfaceNormal(r,W),t.height,W),W=i.add(r,W,W);var n=new e(W,t.semiMajorAxis),o=l.computeEllipsePositions(t,!0,!1),a=o.positions,s=o.numPts,u=S(a,t,!1),c=E(s);return c=v.createTypedArray(a.length/3,c),{boundingSphere:n,attributes:u,indices:c}}function x(e,r){var o=r.vertexFormat,a=r.center,s=r.semiMajorAxis,l=r.semiMinorAxis,u=r.ellipsoid,h=r.height,m=r.extrudedHeight,f=r.stRotation,v=2*(e.length/3),g=new Float64Array(3*v),y=o.st?new Float32Array(2*v):void 0,w=o.normal?new Float32Array(3*v):void 0,S=o.tangent?new Float32Array(3*v):void 0,E=o.binormal?new Float32Array(3*v):void 0,b=0,x=N,T=F,P=B,W=new c(u),G=W.project(u.cartesianToCartographic(a,z),k),H=u.scaleToGeodeticSurface(a,A);u.geodeticSurfaceNormal(H,H);for(var q=C.fromAxisAngle(H,f,L),j=_.fromQuaternion(q,R),Y=t.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,V),X=t.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,U),Z=e.length,J=2*(Z/3),Q=0;Z>Q;Q+=3){var K,$=Q+1,et=Q+2,tt=i.fromArray(e,Q,A);if(o.st){var it=_.multiplyByVector(j,tt,D),rt=W.project(u.cartesianToCartographic(it,z),M);i.subtract(rt,G,rt),O.x=(rt.x+s)/(2*s),O.y=(rt.y+l)/(2*l),Y.x=Math.min(O.x,Y.x),Y.y=Math.min(O.y,Y.y),X.x=Math.max(O.x,X.x),X.y=Math.max(O.y,X.y),y[b+J]=O.x,y[b+1+J]=O.y,y[b++]=O.x,y[b++]=O.y}tt=u.scaleToGeodeticSurface(tt,tt),K=i.clone(tt,D),x=u.geodeticSurfaceNormal(tt,x);var nt=i.multiplyByScalar(x,h,I);if(tt=i.add(tt,nt,tt),nt=i.multiplyByScalar(x,m,nt),K=i.add(K,nt,K),o.position&&(g[Q+Z]=K.x,g[$+Z]=K.y,g[et+Z]=K.z,g[Q]=tt.x,g[$]=tt.y,g[et]=tt.z),o.normal||o.tangent||o.binormal){P=i.clone(x,P);var ot=i.fromArray(e,(Q+3)%Z,I);i.subtract(ot,tt,ot);var at=i.subtract(K,tt,M);x=i.normalize(i.cross(at,ot,x),x),o.normal&&(w[Q]=x.x,w[$]=x.y,w[et]=x.z,w[Q+Z]=x.x,w[$+Z]=x.y,w[et+Z]=x.z),o.tangent&&(T=i.normalize(i.cross(P,x,T),T),S[Q]=T.x,S[$]=T.y,S[et]=T.z,S[Q+Z]=T.x,S[Q+1+Z]=T.y,S[Q+2+Z]=T.z),o.binormal&&(E[Q]=P.x,E[$]=P.y,E[et]=P.z,E[Q+Z]=P.x,E[$+Z]=P.y,E[et+Z]=P.z)}}if(o.st){Z=y.length;for(var st=0;Z>st;st+=2)y[st]=(y[st]-Y.x)/(X.x-Y.x),y[st+1]=(y[st+1]-Y.y)/(X.y-Y.y)}var lt=new p;return o.position&&(lt.position=new d({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:g})),o.st&&(lt.st=new d({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:y})),o.normal&&(lt.normal=new d({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:w})),o.tangent&&(lt.tangent=new d({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:S})),o.binormal&&(lt.binormal=new d({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:E})),lt}function T(e){for(var t=e.length/3,i=v.createTypedArray(t,6*t),r=0,n=0;t>n;n++){var o=n,a=n+t,s=(o+1)%t,l=s+t;i[r++]=o,i[r++]=a,i[r++]=s,i[r++]=s,i[r++]=a,i[r++]=l}return i}function P(t){var r=t.center,n=t.ellipsoid,o=t.semiMajorAxis,a=i.multiplyByScalar(n.geodeticSurfaceNormal(r,A),t.height,A);G.center=i.add(r,a,G.center),G.radius=o,a=i.multiplyByScalar(n.geodeticSurfaceNormal(r,a),t.extrudedHeight,a),H.center=i.add(r,a,H.center),H.radius=o;var s=l.computeEllipsePositions(t,!0,!0),u=s.positions,c=s.numPts,d=s.outerPositions,p=e.union(G,H),g=S(u,t,!0),_=E(c),C=_.length;_.length=2*C;for(var w=u.length/3,b=0;C>b;b+=3)_[b+C]=_[b+2]+w,_[b+1+C]=_[b+1]+w,_[b+2+C]=_[b]+w;var P=v.createTypedArray(2*w/3,_),D=new h({attributes:g,indices:P,primitiveType:y.TRIANGLES}),M=x(d,t);_=T(d);var I=v.createTypedArray(2*d.length/3,_),O=new h({attributes:M,indices:I,primitiveType:y.TRIANGLES}),R=f.combineInstances([new m({geometry:D}),new m({geometry:O})]);return{boundingSphere:p,attributes:R[0].attributes,indices:R[0].indices}}var A=new i,D=new i,M=new i,I=new i,O=new t,R=new _,L=new C,N=new i,F=new i,B=new i,z=new r,k=new i,V=new t,U=new t,W=new i,G=new e,H=new e,q=function(e){e=o(e,o.EMPTY_OBJECT);var t=e.center,r=o(e.ellipsoid,u.WGS84),n=e.semiMajorAxis,s=e.semiMinorAxis,l=o(e.granularity,g.RADIANS_PER_DEGREE),c=o(e.height,0),h=e.extrudedHeight,d=a(h)&&Math.abs(c-h)>1,p=o(e.vertexFormat,w.DEFAULT);this._center=i.clone(t),this._semiMajorAxis=n,this._semiMinorAxis=s,this._ellipsoid=u.clone(r),this._rotation=o(e.rotation,0),this._stRotation=o(e.stRotation,0),this._height=c,this._granularity=l,this._vertexFormat=w.clone(p),this._extrudedHeight=o(h,c),this._extrude=d,this._workerName="createEllipseGeometry"};q.packedLength=i.packedLength+u.packedLength+w.packedLength+8,q.pack=function(e,t,r){r=o(r,0),i.pack(e._center,t,r),r+=i.packedLength,u.pack(e._ellipsoid,t,r),r+=u.packedLength,w.pack(e._vertexFormat,t,r),r+=w.packedLength,t[r++]=e._semiMajorAxis,t[r++]=e._semiMinorAxis,t[r++]=e._rotation,t[r++]=e._stRotation,t[r++]=e._height,t[r++]=e._granularity,t[r++]=e._extrudedHeight,t[r]=e._extrude?1:0};var j=new i,Y=new u,X=new w,Z={center:j,ellipsoid:Y,vertexFormat:X,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0};return q.unpack=function(e,t,r){t=o(t,0);var n=i.unpack(e,t,j);t+=i.packedLength;var s=u.unpack(e,t,Y);t+=u.packedLength;var l=w.unpack(e,t,X);t+=w.packedLength;var c=e[t++],h=e[t++],d=e[t++],p=e[t++],m=e[t++],f=e[t++],v=e[t++],g=1===e[t];return a(r)?(r._center=i.clone(n,r._center),r._ellipsoid=u.clone(s,r._ellipsoid),r._vertexFormat=w.clone(l,r._vertexFormat),r._semiMajorAxis=c,r._semiMinorAxis=h,r._rotation=d,r._stRotation=p,r._height=m,r._granularity=f,r._extrudedHeight=v,r._extrude=g,r):(Z.height=m,Z.extrudedHeight=v,Z.granularity=f,Z.stRotation=p,Z.rotation=d,Z.semiMajorAxis=c,Z.semiMinorAxis=h,new q(Z))},q.createGeometry=function(e){e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var t,i={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:e._height,extrudedHeight:e._extrudedHeight,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};return e._extrude?(i.extrudedHeight=Math.min(e._extrudedHeight,e._height),i.height=Math.max(e._extrudedHeight,e._height),t=P(i)):t=b(i),new h({attributes:t.attributes,indices:t.indices,primitiveType:y.TRIANGLES,boundingSphere:t.boundingSphere})},q}),i("Core/CircleGeometry",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./EllipseGeometry","./Ellipsoid","./VertexFormat"],function(e,t,i,r,n,o,a){"use strict";var s=function(e){e=t(e,t.EMPTY_OBJECT);var i=e.radius,r={center:e.center,semiMajorAxis:i,semiMinorAxis:i,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,vertexFormat:e.vertexFormat,stRotation:e.stRotation};this._ellipseGeometry=new n(r),this._workerName="createCircleGeometry"};s.packedLength=n.packedLength,s.pack=function(e,t,i){n.pack(e._ellipseGeometry,t,i)};var l=new n({center:new e,semiMajorAxis:1,semiMinorAxis:1}),u={center:new e,radius:void 0,ellipsoid:o.clone(o.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,vertexFormat:new a,stRotation:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0};return s.unpack=function(t,r,c){var h=n.unpack(t,r,l);return u.center=e.clone(h._center,u.center),u.ellipsoid=o.clone(h._ellipsoid,u.ellipsoid),u.height=h._height,u.extrudedHeight=h._extrudedHeight,u.granularity=h._granularity,u.vertexFormat=a.clone(h._vertexFormat,u.vertexFormat),u.stRotation=h._stRotation,i(c)?(u.semiMajorAxis=h._semiMajorAxis,u.semiMinorAxis=h._semiMinorAxis,c._ellipseGeometry=new n(u),c):(u.radius=h._semiMajorAxis,new s(u))},s.createGeometry=function(e){return n.createGeometry(e._ellipseGeometry)},s}),i("Core/EllipseOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EllipseGeometryLibrary","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(r){var n=r.center;g=t.multiplyByScalar(r.ellipsoid.geodeticSurfaceNormal(n,g),r.height,g),g=t.add(n,g,g);for(var o=new e(g,r.semiMajorAxis),s=a.computeEllipsePositions(r,!1,!0).outerPositions,l=new c({position:new u({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:a.raisePositionsToHeight(s,r,!1)})}),d=s.length/3,p=h.createTypedArray(d,2*d),m=0,f=0;d>f;++f)p[m++]=f,p[m++]=(f+1)%d;return{boundingSphere:o,attributes:l,indices:p}}function f(n){var o=r(n.numberOfVerticalLines,16);o=Math.max(o,0);var s=n.center,l=n.ellipsoid,d=n.semiMajorAxis,p=t.multiplyByScalar(l.geodeticSurfaceNormal(s,v),n.height,v);_.center=t.add(s,p,_.center),_.radius=d,p=t.multiplyByScalar(l.geodeticSurfaceNormal(s,p),n.extrudedHeight,p),y.center=t.add(s,p,y.center),y.radius=d;var m=a.computeEllipsePositions(n,!1,!0).outerPositions,f=new c({position:new u({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:a.raisePositionsToHeight(m,n,!0)})});m=f.position.values;var g=e.union(_,y),C=m.length/3,w=h.createTypedArray(C,2*C+2*o);C/=2;var S,E=0;for(S=0;C>S;++S)w[E++]=S,w[E++]=(S+1)%C,w[E++]=S+C,w[E++]=(S+1)%C+C;var b;if(o>0){var x=Math.min(o,C);b=Math.round(C/x)}var T=Math.min(b*o,C);if(o>0)for(S=0;T>S;S+=b)w[E++]=S,w[E++]=S+C;return{boundingSphere:g,attributes:f,indices:w}}var v=new t,g=new t,_=new e,y=new e,C=function(e){e=r(e,r.EMPTY_OBJECT);var i=e.center,o=r(e.ellipsoid,s.WGS84),a=e.semiMajorAxis,l=e.semiMinorAxis,u=r(e.granularity,d.RADIANS_PER_DEGREE),c=r(e.height,0),h=e.extrudedHeight,p=n(h)&&Math.abs(c-h)>1;this._center=t.clone(i),this._semiMajorAxis=a,this._semiMinorAxis=l,this._ellipsoid=s.clone(o),this._rotation=r(e.rotation,0),this._height=c,this._granularity=u,this._extrudedHeight=h,this._extrude=p,this._numberOfVerticalLines=Math.max(r(e.numberOfVerticalLines,16),0),this._workerName="createEllipseOutlineGeometry"};C.packedLength=t.packedLength+s.packedLength+9,C.pack=function(e,i,o){o=r(o,0),t.pack(e._center,i,o),o+=t.packedLength,s.pack(e._ellipsoid,i,o),o+=s.packedLength,i[o++]=e._semiMajorAxis,i[o++]=e._semiMinorAxis,i[o++]=e._rotation,i[o++]=e._height,i[o++]=e._granularity,i[o++]=n(e._extrudedHeight)?1:0,i[o++]=r(e._extrudedHeight,0),i[o++]=e._extrude?1:0,i[o]=e._numberOfVerticalLines};var w=new t,S=new s,E={center:w,ellipsoid:S,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0};return C.unpack=function(e,i,o){i=r(i,0);var a=t.unpack(e,i,w);i+=t.packedLength;var l=s.unpack(e,i,S);i+=s.packedLength;var u=e[i++],c=e[i++],h=e[i++],d=e[i++],p=e[i++],m=e[i++],f=e[i++],v=1===e[i++],g=e[i];return n(o)?(o._center=t.clone(a,o._center),o._ellipsoid=s.clone(l,o._ellipsoid),o._semiMajorAxis=u,o._semiMinorAxis=c,o._rotation=h,o._height=d,o._granularity=p,o._extrudedHeight=m?f:void 0,o._extrude=v,o._numberOfVerticalLines=g,o):(E.height=d,E.extrudedHeight=m?f:void 0,E.granularity=p,E.rotation=h,E.semiMajorAxis=u,E.semiMinorAxis=c,E.numberOfVerticalLines=g,new C(E))},C.createGeometry=function(e){e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var t,i={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:e._height,extrudedHeight:e._extrudedHeight,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};return e._extrude?(i.extrudedHeight=Math.min(e._extrudedHeight,e._height),i.height=Math.max(e._extrudedHeight,e._height),t=f(i)):t=m(i),new l({attributes:t.attributes,indices:t.indices,primitiveType:p.LINES,boundingSphere:t.boundingSphere})},C}),i("Core/CircleOutlineGeometry",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./EllipseOutlineGeometry","./Ellipsoid"],function(e,t,i,r,n,o){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT);var i=e.radius,r={center:e.center,semiMajorAxis:i,semiMinorAxis:i,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,numberOfVerticalLines:e.numberOfVerticalLines};this._ellipseGeometry=new n(r),this._workerName="createCircleOutlineGeometry"};a.packedLength=n.packedLength,a.pack=function(e,t,i){n.pack(e._ellipseGeometry,t,i)};var s=new n({center:new e,semiMajorAxis:1,semiMinorAxis:1}),l={center:new e,radius:void 0,ellipsoid:o.clone(o.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,numberOfVerticalLines:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0};return a.unpack=function(t,r,u){var c=n.unpack(t,r,s);return l.center=e.clone(c._center,l.center),l.ellipsoid=o.clone(c._ellipsoid,l.ellipsoid),l.height=c._height,l.extrudedHeight=c._extrudedHeight,l.granularity=c._granularity,l.numberOfVerticalLines=c._numberOfVerticalLines,i(u)?(l.semiMajorAxis=c._semiMajorAxis,l.semiMinorAxis=c._semiMinorAxis,u._ellipseGeometry=new n(l),u):(l.radius=c._semiMajorAxis,new a(l))},a.createGeometry=function(e){return n.createGeometry(e._ellipseGeometry)},a}),i("Core/ClockRange",["./freezeObject"],function(e){"use strict";var t={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2};return e(t)}),i("Core/ClockStep",["./freezeObject"],function(e){"use strict";var t={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2};return e(t)}),i("Core/getTimestamp",["./defined"],function(e){"use strict";var t;return t="undefined"!=typeof performance&&e(performance.now)?function(){return performance.now()}:function(){return Date.now()}}),i("Core/Clock",["./ClockRange","./ClockStep","./defaultValue","./defined","./DeveloperError","./Event","./getTimestamp","./JulianDate"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(n){n=i(n,i.EMPTY_OBJECT);var l=n.startTime,u=!r(l),c=n.stopTime,h=!r(c),d=n.currentTime,p=!r(d); -u&&h&&p?(d=s.now(),l=s.clone(d),c=s.addDays(d,1,new s)):u&&h?(l=s.clone(d),c=s.addDays(d,1,new s)):u&&p?(l=s.addDays(c,-1,new s),d=s.clone(l)):p&&h?(d=s.clone(l),c=s.addDays(l,1,new s)):p?d=s.clone(l):h?c=s.addDays(d,1,new s):u&&(l=s.clone(d)),this.startTime=l,this.stopTime=c,this.currentTime=d,this.multiplier=i(n.multiplier,1),this.clockStep=i(n.clockStep,t.SYSTEM_CLOCK_MULTIPLIER),this.clockRange=i(n.clockRange,e.UNBOUNDED),this.canAnimate=i(n.canAnimate,!0),this.shouldAnimate=i(n.shouldAnimate,!0),this.onTick=new o,this._lastSystemTime=a()};return l.prototype.tick=function(){var i=a(),r=s.clone(this.currentTime),n=this.startTime,o=this.stopTime,l=this.multiplier;if(this.canAnimate&&this.shouldAnimate)if(this.clockStep===t.SYSTEM_CLOCK)r=s.now(r);else{if(this.clockStep===t.TICK_DEPENDENT)r=s.addSeconds(r,l,r);else{var u=i-this._lastSystemTime;r=s.addSeconds(r,l*(u/1e3),r)}if(this.clockRange===e.CLAMPED)s.lessThan(r,n)?r=s.clone(n,r):s.greaterThan(r,o)&&(r=s.clone(o,r));else if(this.clockRange===e.LOOP_STOP)for(s.lessThan(r,n)&&(r=s.clone(n,r));s.greaterThan(r,o);)r=s.addSeconds(n,s.secondsDifference(r,o),r)}return this.currentTime=r,this._lastSystemTime=i,this.onTick.raiseEvent(this),r},l}),i("Core/Color",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math"],function(e,t,i,r,n,o){"use strict";function a(e,t,i){return 0>i&&(i+=1),i>1&&(i-=1),1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var s=function(t,i,r,n){this.red=e(t,1),this.green=e(i,1),this.blue=e(r,1),this.alpha=e(n,1)};s.fromCartesian4=function(e,i){return t(i)?(i.red=e.x,i.green=e.y,i.blue=e.z,i.alpha=e.w,i):new s(e.x,e.y,e.z,e.w)},s.fromBytes=function(i,r,n,o,a){return i=s.byteToFloat(e(i,255)),r=s.byteToFloat(e(r,255)),n=s.byteToFloat(e(n,255)),o=s.byteToFloat(e(o,255)),t(a)?(a.red=i,a.green=r,a.blue=n,a.alpha=o,a):new s(i,r,n,o)},s.fromAlpha=function(e,i,r){return t(r)?(r.red=e.red,r.green=e.green,r.blue=e.blue,r.alpha=i,r):new s(e.red,e.green,e.blue,i)};var l,u,c;r.supportsTypedArrays()&&(l=new ArrayBuffer(4),u=new Uint32Array(l),c=new Uint8Array(l)),s.fromRgba=function(e){return u[0]=e,s.fromBytes(c[0],c[1],c[2],c[3])},s.fromHsl=function(t,i,r,n){t=e(t,0)%1,i=e(i,0),r=e(r,0),n=e(n,1);var o=r,l=r,u=r;if(0!==i){var c;c=.5>r?r*(1+i):r+i-r*i;var h=2*r-c;o=a(h,c,t+1/3),l=a(h,c,t),u=a(h,c,t-1/3)}return new s(o,l,u,n)},s.fromRandom=function(i,r){i=e(i,e.EMPTY_OBJECT);var n=i.red;if(!t(n)){var a=e(i.minimumRed,0),l=e(i.maximumRed,1);n=a+o.nextRandomNumber()*(l-a)}var u=i.green;if(!t(u)){var c=e(i.minimumGreen,0),h=e(i.maximumGreen,1);u=c+o.nextRandomNumber()*(h-c)}var d=i.blue;if(!t(d)){var p=e(i.minimumBlue,0),m=e(i.maximumBlue,1);d=p+o.nextRandomNumber()*(m-p)}var f=i.alpha;if(!t(f)){var v=e(i.minimumAlpha,0),g=e(i.maximumAlpha,1);f=v+o.nextRandomNumber()*(g-v)}return t(r)?(r.red=n,r.green=u,r.blue=d,r.alpha=f,r):new s(n,u,d,f)};var h=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,d=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,p=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,m=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;return s.fromCssColorString=function(i){var r=s[i.toUpperCase()];if(t(r))return s.clone(r);var n=h.exec(i);return null!==n?new s(parseInt(n[1],16)/15,parseInt(n[2],16)/15,parseInt(n[3],16)/15):(n=d.exec(i),null!==n?new s(parseInt(n[1],16)/255,parseInt(n[2],16)/255,parseInt(n[3],16)/255):(n=p.exec(i),null!==n?new s(parseFloat(n[1])/("%"===n[1].substr(-1)?100:255),parseFloat(n[2])/("%"===n[2].substr(-1)?100:255),parseFloat(n[3])/("%"===n[3].substr(-1)?100:255),parseFloat(e(n[4],"1.0"))):(n=m.exec(i),null!==n?s.fromHsl(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,parseFloat(e(n[4],"1.0"))):void 0)))},s.packedLength=4,s.pack=function(t,i,r){r=e(r,0),i[r++]=t.red,i[r++]=t.green,i[r++]=t.blue,i[r]=t.alpha},s.unpack=function(i,r,n){return r=e(r,0),t(n)||(n=new s),n.red=i[r++],n.green=i[r++],n.blue=i[r++],n.alpha=i[r],n},s.byteToFloat=function(e){return e/255},s.floatToByte=function(e){return 1===e?255:0|256*e},s.clone=function(e,i){return t(e)?t(i)?(i.red=e.red,i.green=e.green,i.blue=e.blue,i.alpha=e.alpha,i):new s(e.red,e.green,e.blue,e.alpha):void 0},s.equals=function(e,i){return e===i||t(e)&&t(i)&&e.red===i.red&&e.green===i.green&&e.blue===i.blue&&e.alpha===i.alpha},s.equalsArray=function(e,t,i){return e.red===t[i]&&e.green===t[i+1]&&e.blue===t[i+2]&&e.alpha===t[i+3]},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,i){return this===e||t(e)&&Math.abs(this.red-e.red)<=i&&Math.abs(this.green-e.green)<=i&&Math.abs(this.blue-e.blue)<=i&&Math.abs(this.alpha-e.alpha)<=i},s.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},s.prototype.toCssColorString=function(){var e=s.floatToByte(this.red),t=s.floatToByte(this.green),i=s.floatToByte(this.blue);return 1===this.alpha?"rgb("+e+","+t+","+i+")":"rgba("+e+","+t+","+i+","+this.alpha+")"},s.prototype.toBytes=function(e){var i=s.floatToByte(this.red),r=s.floatToByte(this.green),n=s.floatToByte(this.blue),o=s.floatToByte(this.alpha);return t(e)?(e[0]=i,e[1]=r,e[2]=n,e[3]=o,e):[i,r,n,o]},s.prototype.toRgba=function(){return c[0]=s.floatToByte(this.red),c[1]=s.floatToByte(this.green),c[2]=s.floatToByte(this.blue),c[3]=s.floatToByte(this.alpha),u[0]},s.prototype.brighten=function(e,t){return e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t},s.prototype.darken=function(e,t){return e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t},s.prototype.withAlpha=function(e,t){return s.fromAlpha(this,e,t)},s.ALICEBLUE=n(s.fromCssColorString("#F0F8FF")),s.ANTIQUEWHITE=n(s.fromCssColorString("#FAEBD7")),s.AQUA=n(s.fromCssColorString("#00FFFF")),s.AQUAMARINE=n(s.fromCssColorString("#7FFFD4")),s.AZURE=n(s.fromCssColorString("#F0FFFF")),s.BEIGE=n(s.fromCssColorString("#F5F5DC")),s.BISQUE=n(s.fromCssColorString("#FFE4C4")),s.BLACK=n(s.fromCssColorString("#000000")),s.BLANCHEDALMOND=n(s.fromCssColorString("#FFEBCD")),s.BLUE=n(s.fromCssColorString("#0000FF")),s.BLUEVIOLET=n(s.fromCssColorString("#8A2BE2")),s.BROWN=n(s.fromCssColorString("#A52A2A")),s.BURLYWOOD=n(s.fromCssColorString("#DEB887")),s.CADETBLUE=n(s.fromCssColorString("#5F9EA0")),s.CHARTREUSE=n(s.fromCssColorString("#7FFF00")),s.CHOCOLATE=n(s.fromCssColorString("#D2691E")),s.CORAL=n(s.fromCssColorString("#FF7F50")),s.CORNFLOWERBLUE=n(s.fromCssColorString("#6495ED")),s.CORNSILK=n(s.fromCssColorString("#FFF8DC")),s.CRIMSON=n(s.fromCssColorString("#DC143C")),s.CYAN=n(s.fromCssColorString("#00FFFF")),s.DARKBLUE=n(s.fromCssColorString("#00008B")),s.DARKCYAN=n(s.fromCssColorString("#008B8B")),s.DARKGOLDENROD=n(s.fromCssColorString("#B8860B")),s.DARKGRAY=n(s.fromCssColorString("#A9A9A9")),s.DARKGREEN=n(s.fromCssColorString("#006400")),s.DARKGREY=s.DARKGRAY,s.DARKKHAKI=n(s.fromCssColorString("#BDB76B")),s.DARKMAGENTA=n(s.fromCssColorString("#8B008B")),s.DARKOLIVEGREEN=n(s.fromCssColorString("#556B2F")),s.DARKORANGE=n(s.fromCssColorString("#FF8C00")),s.DARKORCHID=n(s.fromCssColorString("#9932CC")),s.DARKRED=n(s.fromCssColorString("#8B0000")),s.DARKSALMON=n(s.fromCssColorString("#E9967A")),s.DARKSEAGREEN=n(s.fromCssColorString("#8FBC8F")),s.DARKSLATEBLUE=n(s.fromCssColorString("#483D8B")),s.DARKSLATEGRAY=n(s.fromCssColorString("#2F4F4F")),s.DARKSLATEGREY=s.DARKSLATEGRAY,s.DARKTURQUOISE=n(s.fromCssColorString("#00CED1")),s.DARKVIOLET=n(s.fromCssColorString("#9400D3")),s.DEEPPINK=n(s.fromCssColorString("#FF1493")),s.DEEPSKYBLUE=n(s.fromCssColorString("#00BFFF")),s.DIMGRAY=n(s.fromCssColorString("#696969")),s.DIMGREY=s.DIMGRAY,s.DODGERBLUE=n(s.fromCssColorString("#1E90FF")),s.FIREBRICK=n(s.fromCssColorString("#B22222")),s.FLORALWHITE=n(s.fromCssColorString("#FFFAF0")),s.FORESTGREEN=n(s.fromCssColorString("#228B22")),s.FUSCHIA=n(s.fromCssColorString("#FF00FF")),s.GAINSBORO=n(s.fromCssColorString("#DCDCDC")),s.GHOSTWHITE=n(s.fromCssColorString("#F8F8FF")),s.GOLD=n(s.fromCssColorString("#FFD700")),s.GOLDENROD=n(s.fromCssColorString("#DAA520")),s.GRAY=n(s.fromCssColorString("#808080")),s.GREEN=n(s.fromCssColorString("#008000")),s.GREENYELLOW=n(s.fromCssColorString("#ADFF2F")),s.GREY=s.GRAY,s.HONEYDEW=n(s.fromCssColorString("#F0FFF0")),s.HOTPINK=n(s.fromCssColorString("#FF69B4")),s.INDIANRED=n(s.fromCssColorString("#CD5C5C")),s.INDIGO=n(s.fromCssColorString("#4B0082")),s.IVORY=n(s.fromCssColorString("#FFFFF0")),s.KHAKI=n(s.fromCssColorString("#F0E68C")),s.LAVENDER=n(s.fromCssColorString("#E6E6FA")),s.LAVENDAR_BLUSH=n(s.fromCssColorString("#FFF0F5")),s.LAWNGREEN=n(s.fromCssColorString("#7CFC00")),s.LEMONCHIFFON=n(s.fromCssColorString("#FFFACD")),s.LIGHTBLUE=n(s.fromCssColorString("#ADD8E6")),s.LIGHTCORAL=n(s.fromCssColorString("#F08080")),s.LIGHTCYAN=n(s.fromCssColorString("#E0FFFF")),s.LIGHTGOLDENRODYELLOW=n(s.fromCssColorString("#FAFAD2")),s.LIGHTGRAY=n(s.fromCssColorString("#D3D3D3")),s.LIGHTGREEN=n(s.fromCssColorString("#90EE90")),s.LIGHTGREY=s.LIGHTGRAY,s.LIGHTPINK=n(s.fromCssColorString("#FFB6C1")),s.LIGHTSEAGREEN=n(s.fromCssColorString("#20B2AA")),s.LIGHTSKYBLUE=n(s.fromCssColorString("#87CEFA")),s.LIGHTSLATEGRAY=n(s.fromCssColorString("#778899")),s.LIGHTSLATEGREY=s.LIGHTSLATEGRAY,s.LIGHTSTEELBLUE=n(s.fromCssColorString("#B0C4DE")),s.LIGHTYELLOW=n(s.fromCssColorString("#FFFFE0")),s.LIME=n(s.fromCssColorString("#00FF00")),s.LIMEGREEN=n(s.fromCssColorString("#32CD32")),s.LINEN=n(s.fromCssColorString("#FAF0E6")),s.MAGENTA=n(s.fromCssColorString("#FF00FF")),s.MAROON=n(s.fromCssColorString("#800000")),s.MEDIUMAQUAMARINE=n(s.fromCssColorString("#66CDAA")),s.MEDIUMBLUE=n(s.fromCssColorString("#0000CD")),s.MEDIUMORCHID=n(s.fromCssColorString("#BA55D3")),s.MEDIUMPURPLE=n(s.fromCssColorString("#9370DB")),s.MEDIUMSEAGREEN=n(s.fromCssColorString("#3CB371")),s.MEDIUMSLATEBLUE=n(s.fromCssColorString("#7B68EE")),s.MEDIUMSPRINGGREEN=n(s.fromCssColorString("#00FA9A")),s.MEDIUMTURQUOISE=n(s.fromCssColorString("#48D1CC")),s.MEDIUMVIOLETRED=n(s.fromCssColorString("#C71585")),s.MIDNIGHTBLUE=n(s.fromCssColorString("#191970")),s.MINTCREAM=n(s.fromCssColorString("#F5FFFA")),s.MISTYROSE=n(s.fromCssColorString("#FFE4E1")),s.MOCCASIN=n(s.fromCssColorString("#FFE4B5")),s.NAVAJOWHITE=n(s.fromCssColorString("#FFDEAD")),s.NAVY=n(s.fromCssColorString("#000080")),s.OLDLACE=n(s.fromCssColorString("#FDF5E6")),s.OLIVE=n(s.fromCssColorString("#808000")),s.OLIVEDRAB=n(s.fromCssColorString("#6B8E23")),s.ORANGE=n(s.fromCssColorString("#FFA500")),s.ORANGERED=n(s.fromCssColorString("#FF4500")),s.ORCHID=n(s.fromCssColorString("#DA70D6")),s.PALEGOLDENROD=n(s.fromCssColorString("#EEE8AA")),s.PALEGREEN=n(s.fromCssColorString("#98FB98")),s.PALETURQUOISE=n(s.fromCssColorString("#AFEEEE")),s.PALEVIOLETRED=n(s.fromCssColorString("#DB7093")),s.PAPAYAWHIP=n(s.fromCssColorString("#FFEFD5")),s.PEACHPUFF=n(s.fromCssColorString("#FFDAB9")),s.PERU=n(s.fromCssColorString("#CD853F")),s.PINK=n(s.fromCssColorString("#FFC0CB")),s.PLUM=n(s.fromCssColorString("#DDA0DD")),s.POWDERBLUE=n(s.fromCssColorString("#B0E0E6")),s.PURPLE=n(s.fromCssColorString("#800080")),s.RED=n(s.fromCssColorString("#FF0000")),s.ROSYBROWN=n(s.fromCssColorString("#BC8F8F")),s.ROYALBLUE=n(s.fromCssColorString("#4169E1")),s.SADDLEBROWN=n(s.fromCssColorString("#8B4513")),s.SALMON=n(s.fromCssColorString("#FA8072")),s.SANDYBROWN=n(s.fromCssColorString("#F4A460")),s.SEAGREEN=n(s.fromCssColorString("#2E8B57")),s.SEASHELL=n(s.fromCssColorString("#FFF5EE")),s.SIENNA=n(s.fromCssColorString("#A0522D")),s.SILVER=n(s.fromCssColorString("#C0C0C0")),s.SKYBLUE=n(s.fromCssColorString("#87CEEB")),s.SLATEBLUE=n(s.fromCssColorString("#6A5ACD")),s.SLATEGRAY=n(s.fromCssColorString("#708090")),s.SLATEGREY=s.SLATEGRAY,s.SNOW=n(s.fromCssColorString("#FFFAFA")),s.SPRINGGREEN=n(s.fromCssColorString("#00FF7F")),s.STEELBLUE=n(s.fromCssColorString("#4682B4")),s.TAN=n(s.fromCssColorString("#D2B48C")),s.TEAL=n(s.fromCssColorString("#008080")),s.THISTLE=n(s.fromCssColorString("#D8BFD8")),s.TOMATO=n(s.fromCssColorString("#FF6347")),s.TURQUOISE=n(s.fromCssColorString("#40E0D0")),s.VIOLET=n(s.fromCssColorString("#EE82EE")),s.WHEAT=n(s.fromCssColorString("#F5DEB3")),s.WHITE=n(s.fromCssColorString("#FFFFFF")),s.WHITESMOKE=n(s.fromCssColorString("#F5F5F5")),s.YELLOW=n(s.fromCssColorString("#FFFF00")),s.YELLOWGREEN=n(s.fromCssColorString("#9ACD32")),s.TRANSPARENT=n(new s(0,0,0,0)),s}),i("Core/ColorGeometryInstanceAttribute",["./Color","./ComponentDatatype","./defaultValue","./defined","./defineProperties","./DeveloperError"],function(e,t,i,r,n){"use strict";var o=function(t,r,n,o){t=i(t,1),r=i(r,1),n=i(n,1),o=i(o,1),this.value=new Uint8Array([e.floatToByte(t),e.floatToByte(r),e.floatToByte(n),e.floatToByte(o)])};return n(o.prototype,{componentDatatype:{get:function(){return t.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}}),o.fromColor=function(e){return new o(e.red,e.green,e.blue,e.alpha)},o.toValue=function(e,t){return r(t)?e.toBytes(t):new Uint8Array(e.toBytes())},o}),i("Core/CornerType",["./freezeObject"],function(e){"use strict";var t={ROUNDED:0,MITERED:1,BEVELED:2};return e(t)}),i("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),i("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,i,r,n,o,a,s){"use strict";function l(e){var t=e._uSquared,i=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,n=(i-r)/i,o=Math.cos(e._startHeading),a=Math.sin(e._startHeading),s=(1-n)*Math.tan(e._start.latitude),l=1/Math.sqrt(1+s*s),u=l*s,c=Math.atan2(s,o),h=l*a,d=h*h,p=1-d,m=Math.sqrt(p),f=t/4,v=f*f,g=v*f,_=v*v,y=1+f-3*v/4+5*g/4-175*_/64,C=1-f+15*v/8-35*g/8,w=1-3*f+35*v/4,S=1-5*f,E=y*c-C*Math.sin(2*c)*f/2-w*Math.sin(4*c)*v/16-S*Math.sin(6*c)*g/48-5*Math.sin(8*c)*_/512,b=e._constants;b.a=i,b.b=r,b.f=n,b.cosineHeading=o,b.sineHeading=a,b.tanU=s,b.cosineU=l,b.sineU=u,b.sigma=c,b.sineAlpha=h,b.sineSquaredAlpha=d,b.cosineSquaredAlpha=p,b.cosineAlpha=m,b.u2Over4=f,b.u4Over16=v,b.u6Over64=g,b.u8Over256=_,b.a0=y,b.a1=C,b.a2=w,b.a3=S,b.distanceRatio=E}function u(e,t){return e*t*(4+e*(4-3*t))/16}function c(e,t,i,r,n,o,a){var s=u(e,i);return(1-s)*e*t*(r+s*n*(a+s*o*(2*a*a-1)))}function h(e,t,i,r,n,o,a){var l,u,h,d,p,m=(t-i)/t,f=o-r,v=Math.atan((1-m)*Math.tan(n)),g=Math.atan((1-m)*Math.tan(a)),_=Math.cos(v),y=Math.sin(v),C=Math.cos(g),w=Math.sin(g),S=_*C,E=_*w,b=y*w,x=y*C,T=f,P=s.TWO_PI,A=Math.cos(T),D=Math.sin(T);do{A=Math.cos(T),D=Math.sin(T);var M=E-x*A;h=Math.sqrt(C*C*D*D+M*M),u=b+S*A,l=Math.atan2(h,u);var I;0===h?(I=0,d=1):(I=S*D/h,d=1-I*I),P=T,p=u-2*b/d,isNaN(p)&&(p=0),T=f+c(m,I,d,l,h,u,p)}while(Math.abs(T-P)>s.EPSILON12);var O=d*(t*t-i*i)/(i*i),R=1+O*(4096+O*(O*(320-175*O)-768))/16384,L=O*(256+O*(O*(74-47*O)-128))/1024,N=p*p,F=L*h*(p+L*(u*(2*N-1)-L*p*(4*h*h-3)*(4*N-3)/6)/4),B=i*R*(l-F),z=Math.atan2(C*D,E-x*A),k=Math.atan2(_*D,E*A-x);e._distance=B,e._startHeading=z,e._endHeading=k,e._uSquared=O}function d(i,r,n,o){e.normalize(o.cartographicToCartesian(r,m),p),e.normalize(o.cartographicToCartesian(n,m),m),h(i,o.maximumRadius,o.minimumRadius,r.longitude,r.latitude,n.longitude,n.latitude),i._start=t.clone(r,i._start),i._end=t.clone(n,i._end),i._start.height=0,i._end.height=0,l(i)}var p=new e,m=new e,f=function(e,n,o){var s=i(o,a.WGS84);this._ellipsoid=s,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,r(e)&&r(n)&&d(this,e,n,s)};return n(f.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),f.prototype.setEndPoints=function(e,t){d(this,e,t,this._ellipsoid)},f.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},f.prototype.interpolateUsingSurfaceDistance=function(e,i){var n=this._constants,o=n.distanceRatio+e/n.b,a=Math.cos(2*o),s=Math.cos(4*o),l=Math.cos(6*o),u=Math.sin(2*o),h=Math.sin(4*o),d=Math.sin(6*o),p=Math.sin(8*o),m=o*o,f=o*m,v=n.u8Over256,g=n.u2Over4,_=n.u6Over64,y=n.u4Over16,C=2*f*v*a/3+o*(1-g+7*y/4-15*_/4+579*v/64-(y-15*_/4+187*v/16)*a-(5*_/4-115*v/16)*s-29*v*l/16)+(g/2-y+71*_/32-85*v/16)*u+(5*y/16-5*_/4+383*v/96)*h-m*((_-11*v/2)*u+5*v*h/2)+(29*_/96-29*v/16)*d+539*v*p/1536,w=Math.asin(Math.sin(C)*n.cosineAlpha),S=Math.atan(n.a/n.b*Math.tan(w));C-=n.sigma;var E=Math.cos(2*n.sigma+C),b=Math.sin(C),x=Math.cos(C),T=n.cosineU*x,P=n.sineU*b,A=Math.atan2(b*n.sineHeading,T-P*n.cosineHeading),D=A-c(n.f,n.sineAlpha,n.cosineSquaredAlpha,C,b,x,E);return r(i)?(i.longitude=this._start.longitude+D,i.latitude=S,i.height=0,i):new t(this._start.longitude+D,S,0)},f}),i("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,t,i){var r=b;r.length=e;var n;if(t===i){for(n=0;e>n;n++)r[n]=t;return r}var o=i-t,a=o/e;for(n=0;e>n;n++){var s=t+n*a;r[n]=s}return r}function p(t,i,r,n,o,a,s,l){var u=n.scaleToGeodeticSurface(t,A),c=n.scaleToGeodeticSurface(i,D),h=m.numberOfPoints(t,i,r),p=n.cartesianToCartographic(u,x),f=n.cartesianToCartographic(c,T),v=d(h,o,a);M.setEndPoints(p,f);var g=M.surfaceDistance/h,_=l;p.height=o;var y=n.cartographicToCartesian(p,P);e.pack(y,s,_),_+=3;for(var C=1;h>C;C++){var w=M.interpolateUsingSurfaceDistance(C*g,T);w.height=v[C],y=n.cartographicToCartesian(w,P),e.pack(y,s,_),_+=3}return _}var m={};m.numberOfPoints=function(t,i,r){var n=e.distance(t,i);return Math.ceil(n/r)};var f=new t;m.extractHeights=function(e,t){for(var i=e.length,r=new Array(i),n=0;i>n;n++){var o=e[n];r[n]=t.cartesianToCartographic(o,f).height}return r};var v=new c,g=new e,_=new e,y=new h(e.ZERO,0),C=new e,w=new h(e.ZERO,0),S=new e,E=new e,b=[],x=new t,T=new t,P=new e,A=new e,D=new e,M=new a;m.wrapLongitude=function(t,n){var o=[],a=[];if(r(t)&&t.length>0){n=i(n,c.IDENTITY);var l=c.inverseTransformation(n,v),u=c.multiplyByPoint(l,e.ZERO,g),d=c.multiplyByPointAsVector(l,e.UNIT_Y,_),p=h.fromPointNormal(u,d,y),m=c.multiplyByPointAsVector(l,e.UNIT_X,C),f=h.fromPointNormal(u,m,w),b=1;o.push(e.clone(t[0]));for(var x=o[0],T=t.length,P=1;T>P;++P){var A=t[P];if(h.getPointDistance(f,x)<0||h.getPointDistance(f,A)<0){var D=s.lineSegmentPlane(x,A,p,S);if(r(D)){var M=e.multiplyByScalar(d,5e-9,E);h.getPointDistance(p,x)<0&&e.negate(M,M),o.push(e.add(D,M,new e)),a.push(b+1),e.negate(M,M),o.push(e.add(D,M,new e)),b=1}}o.push(e.clone(t[P])),b++,x=A}a.push(b)}return{positions:o,lengths:a}};var I=u.EPSILON7;return m.removeDuplicates=function(t){var i=t.length;if(2>i)return t;var r,n,o;for(r=1;i>r&&(n=t[r-1],o=t[r],!e.equalsEpsilon(n,o,I));++r);if(r===i)return t;for(var a=t.slice(0,r);i>r;++r)o=t[r],e.equalsEpsilon(n,o,I)||(a.push(e.clone(o)),n=o);return a},m.generateArc=function(t){r(t)||(t={});var n=t.positions,a=n.length,s=i(t.ellipsoid,o.WGS84),c=i(t.height,0);if(1>a)return[];if(1===a){var h=s.scaleToGeodeticSurface(n[0],A);if(0!==c){var d=s.geodeticSurfaceNormal(h,P);e.multiplyByScalar(d,c,d),e.add(h,d,h)}return[h.x,h.y,h.z]}var f=t.minDistance;if(!r(f)){var v=i(t.granularity,u.RADIANS_PER_DEGREE);f=u.chordLength(v,s.maximumRadius)}var g,_=0;for(g=0;a-1>g;g++)_+=m.numberOfPoints(n[g],n[g+1],f);var y=3*(_+1),C=new Array(y),w=0,S=l(c);for(g=0;a-1>g;g++){var E=n[g],T=n[g+1],D=S?c[g]:c,M=S?c[g+1]:c;w=p(E,T,f,s,D,M,C,w)}b.length=0;var I=n[a-1],O=s.cartesianToCartographic(I,x);O.height=S?c[a-1]:c;var R=s.cartographicToCartesian(O,P);return e.pack(R,C,y-3),C},m.generateCartesianArc=function(t){for(var i=m.generateArc(t),r=i.length/3,n=new Array(r),o=0;r>o;o++)n[o]=e.unpack(i,3*o);return n},m}),i("Core/PolylineVolumeGeometryLibrary",["./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./CornerType","./EllipsoidTangentPlane","./Math","./Matrix3","./Matrix4","./PolylinePipeline","./Quaternion","./Transforms"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,t){for(var i=new Array(e.length),r=0;ro;o++)c[o]=i;return c.push(r),c}var h=r-i,d=h/u;for(o=1;u>o;o++){var p=i+o*d;c[o]=p}return c[0]=i,c.push(r),c}function m(i,r,n,a){var s=new o(n,a),l=s.projectPointOntoPlane(t.add(n,i,Y),Y),u=s.projectPointOntoPlane(t.add(n,r,X),X),c=e.angleBetween(l,u);return u.x*l.y-u.y*l.x>=0?-c:c}function f(e,i,r,n,o,a,u,c){var d=V,p=U;F=h.eastNorthUpToFixedFrame(e,o,F),d=l.multiplyByPointAsVector(F,N,d),d=t.normalize(d,d);var f=m(d,i,e,o);z=s.fromRotationZ(f,z),W.z=a,F=l.multiplyTransformation(F,l.fromRotationTranslation(z,W,B),F);var v=k;v[0]=u;for(var g=0;c>g;g++)for(var _=0;_l;l++){s=e[l];var u=s.x-o,c=s.y-a;r[n++]=u,r[n++]=0,r[n++]=c,r[n++]=u,r[n++]=0,r[n++]=c}return s=e[0],r[n++]=s.x-o,r[n++]=0,r[n++]=s.y-a,r}function _(e,t){for(var i=e.length,r=new Array(3*i),n=0,o=t.x+t.width/2,a=t.y+t.height/2,s=0;i>s;s++)r[n++]=e[s].x-o,r[n++]=0,r[n++]=e[s].y-a;return r}function y(e,i,r,o,l,u,h,d,p,m){var v,g=t.angleBetween(t.subtract(i,e,I),t.subtract(r,e,O)),_=o===n.BEVELED?0:Math.ceil(g/a.toRadians(5));v=l?s.fromQuaternion(c.fromAxisAngle(t.negate(e,I),g/(_+1),H),j):s.fromQuaternion(c.fromAxisAngle(e,g/(_+1),H),j);var y,C;if(i=t.clone(i,q),_>0)for(var w=m?2:1,S=0;_>S;S++)i=s.multiplyByVector(v,i,i),y=t.subtract(i,e,I),y=t.normalize(y,y),l||(y=t.negate(y,y)),C=u.scaleToGeodeticSurface(i,O),h=f(C,y,d,h,u,p,1,w);else y=t.subtract(i,e,I),y=t.normalize(y,y),l||(y=t.negate(y,y)),C=u.scaleToGeodeticSurface(i,O),h=f(C,y,d,h,u,p,1,1),r=t.clone(r,q),y=t.subtract(r,e,I),y=t.normalize(y,y),l||(y=t.negate(y,y)),C=u.scaleToGeodeticSurface(r,O),h=f(C,y,d,h,u,p,1,1);return h}function C(e,t){return a.equalsEpsilon(e.latitude,t.latitude,a.EPSILON6)&&a.equalsEpsilon(e.longitude,t.longitude,a.EPSILON6)}var w=[new t,new t],S=new t,E=new t,b=new t,x=new t,T=new t,P=new t,A=new t,D=new t,M=new t,I=new t,O=new t,R={},L=new r,N=new t(-1,0,0),F=new l,B=new l,z=new s,k=s.IDENTITY.clone(),V=new t,U=new i,W=new t,G=new t,H=new c,q=new t,j=new s;R.removeDuplicatesFromShape=function(t){for(var i=t.length,r=[],n=i-1,o=0;i>o;n=o++){var a=t[n],s=t[o];e.equals(a,s)||r.push(s)}return r};var Y=new t,X=new t;R.angleIsGreaterThanPi=function(e,i,r,n){var a=new o(r,n),s=a.projectPointOntoPlane(t.add(r,e,Y),Y),l=a.projectPointOntoPlane(t.add(r,i,X),X);return l.x*s.y-l.y*s.x>=0};var Z=new r,J=new r;R.removeDuplicatesFromPositions=function(e,t){var i=e.length;if(2>i)return e.slice(0);var r=[];r.push(e[0]);for(var n=1;i>n;++n){var o=e[n-1],a=e[n],s=t.cartesianToCartographic(o,Z),l=t.cartesianToCartographic(a,J);C(s,l)||r.push(a)}return r};var Q=new t,K=new t;return R.computePositions=function(e,i,r,o,s){var l=o._ellipsoid,c=d(e,l),h=o._granularity,m=o._cornerType,C=s?g(i,r):_(i,r),O=s?_(i,r):void 0,L=r.height/2,N=r.width/2,F=e.length,B=[],z=s?[]:void 0,k=S,V=E,U=b,W=x,G=T,H=P,q=A,j=D,Y=M,X=e[0],Z=e[1];W=l.geodeticSurfaceNormal(X,W),k=t.subtract(Z,X,k),k=t.normalize(k,k),j=t.cross(W,k,j),j=t.normalize(j,j);var J=c[0],$=c[1];s&&(z=f(X,j,O,z,l,J+L,1,1)),Y=t.clone(X,Y),X=Z,V=t.negate(k,V);for(var et,tt,it=1;F-1>it;it++){var rt=s?2:1;Z=e[it+1],k=t.subtract(Z,X,k),k=t.normalize(k,k),U=t.add(k,V,U),U=t.normalize(U,U),W=l.geodeticSurfaceNormal(X,W);var nt=t.multiplyByScalar(W,t.dot(k,W),Q);t.subtract(k,nt,nt),t.normalize(nt,nt);var ot=t.multiplyByScalar(W,t.dot(V,W),K);t.subtract(V,ot,ot),t.normalize(ot,ot);var at=!a.equalsEpsilon(Math.abs(t.dot(nt,ot)),1,a.EPSILON7);if(at){U=t.cross(U,W,U),U=t.cross(W,U,U),U=t.normalize(U,U);var st=1/Math.max(.25,t.magnitude(t.cross(U,V,I))),lt=R.angleIsGreaterThanPi(k,V,X,l);lt?(G=t.add(X,t.multiplyByScalar(U,st*N,U),G),H=t.add(G,t.multiplyByScalar(j,N,H),H),w[0]=t.clone(Y,w[0]),w[1]=t.clone(H,w[1]),et=p(w,J+L,$+L,h),tt=u.generateArc({positions:w,granularity:h,ellipsoid:l}),B=v(tt,j,C,B,l,et,1),j=t.cross(W,k,j),j=t.normalize(j,j),q=t.add(G,t.multiplyByScalar(j,N,q),q),m===n.ROUNDED||m===n.BEVELED?y(G,H,q,m,lt,l,B,C,$+L,s):(U=t.negate(U,U),B=f(X,U,C,B,l,$+L,st,rt)),Y=t.clone(q,Y)):(G=t.add(X,t.multiplyByScalar(U,st*N,U),G),H=t.add(G,t.multiplyByScalar(j,-N,H),H),w[0]=t.clone(Y,w[0]),w[1]=t.clone(H,w[1]),et=p(w,J+L,$+L,h),tt=u.generateArc({positions:w,granularity:h,ellipsoid:l}),B=v(tt,j,C,B,l,et,1),j=t.cross(W,k,j),j=t.normalize(j,j),q=t.add(G,t.multiplyByScalar(j,-N,q),q),m===n.ROUNDED||m===n.BEVELED?y(G,H,q,m,lt,l,B,C,$+L,s):B=f(X,U,C,B,l,$+L,st,rt),Y=t.clone(q,Y)),V=t.negate(k,V)}else B=f(Y,j,C,B,l,J+L,1,1),Y=X;J=$,$=c[it+1],X=Z}w[0]=t.clone(Y,w[0]),w[1]=t.clone(X,w[1]),et=p(w,J+L,$+L,h),tt=u.generateArc({positions:w,granularity:h,ellipsoid:l}),B=v(tt,j,C,B,l,et,1),s&&(z=f(X,j,O,z,l,$+L,1,1)),F=B.length;var ut=s?F+z.length:F,ct=new Float64Array(ut);return ct.set(B),s&&ct.set(z,F),ct},R}),i("Core/CorridorGeometryLibrary",["./Cartesian3","./CornerType","./defined","./isArray","./Math","./Matrix3","./PolylinePipeline","./PolylineVolumeGeometryLibrary","./Quaternion"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(i,r,a,s,u){var c=e.angleBetween(e.subtract(r,i,f),e.subtract(a,i,v)),h=s===t.BEVELED?1:Math.ceil(c/n.toRadians(5))+1,d=3*h,p=new Array(d);p[d-3]=a.x,p[d-2]=a.y,p[d-1]=a.z;var m;m=u?o.fromQuaternion(l.fromAxisAngle(e.negate(i,f),c/h,M),I):o.fromQuaternion(l.fromAxisAngle(i,c/h,M),I);var g=0;r=e.clone(r,f);for(var _=0;h>_;_++)r=o.multiplyByVector(m,r,r),p[g++]=r.x,p[g++]=r.y,p[g++]=r.z;return p}function c(i){var r=C,n=w,o=S,a=i[1];n=e.fromArray(i[1],a.length-3,n),o=e.fromArray(i[0],0,o),r=e.multiplyByScalar(e.add(n,o,r),.5,r);var s=u(r,n,o,t.ROUNDED,!1),l=i.length-1,c=i[l-1];a=i[l],n=e.fromArray(c,c.length-3,n),o=e.fromArray(a,0,o),r=e.multiplyByScalar(e.add(n,o,r),.5,r);var h=u(r,n,o,t.ROUNDED,!1);return[s,h]}function h(t,i,r,n){var o=f;return n?o=e.add(t,i,o):(i=e.negate(i,i),o=e.add(t,i,o)),[o.x,o.y,o.z,r.x,r.y,r.z]}function d(t,i,r,n){for(var o=new Array(t.length),a=new Array(t.length),s=e.multiplyByScalar(i,r,f),l=e.negate(s,v),u=0,c=t.length-1,h=0;hY;Y++){_=l.geodeticSurfaceNormal(H,_),q=o[Y+1],M=e.normalize(e.subtract(q,H,M),M),N=e.normalize(e.add(M,I,N),N);var J=e.multiplyByScalar(_,e.dot(M,_),O);e.subtract(M,J,J),e.normalize(J,J);var Q=e.multiplyByScalar(_,e.dot(I,_),R);e.subtract(I,Q,Q),e.normalize(Q,Q);var K=!n.equalsEpsilon(Math.abs(e.dot(J,Q)),1,n.EPSILON7);if(K){N=e.cross(N,_,N),N=e.cross(_,N,N);var $=m/Math.max(.25,e.magnitude(e.cross(N,I,f))),et=s.angleIsGreaterThanPi(M,I,H,l);N=e.multiplyByScalar(N,$,N),et?(z=e.add(H,N,z),V=e.add(z,e.multiplyByScalar(L,m,V),V),k=e.add(z,e.multiplyByScalar(L,2*m,k),k),y[0]=e.clone(B,y[0]),y[1]=e.clone(V,y[1]),j=a.generateArc({positions:y,granularity:r,ellipsoid:l}),U=d(j,L,m,U),g&&(W.push(L.x,L.y,L.z),G.push(_.x,_.y,_.z)),F=e.clone(k,F),L=e.normalize(e.cross(_,M,L),L),k=e.add(z,e.multiplyByScalar(L,2*m,k),k),B=e.add(z,e.multiplyByScalar(L,m,B),B),v===t.ROUNDED||v===t.BEVELED?X.push({leftPositions:u(z,F,k,v,et)}):X.push({leftPositions:h(H,e.negate(N,N),k,et)})):(k=e.add(H,N,k),V=e.add(k,e.negate(e.multiplyByScalar(L,m,V),V),V),z=e.add(k,e.negate(e.multiplyByScalar(L,2*m,z),z),z),y[0]=e.clone(B,y[0]),y[1]=e.clone(V,y[1]),j=a.generateArc({positions:y,granularity:r,ellipsoid:l}),U=d(j,L,m,U),g&&(W.push(L.x,L.y,L.z),G.push(_.x,_.y,_.z)),F=e.clone(z,F),L=e.normalize(e.cross(_,M,L),L),z=e.add(k,e.negate(e.multiplyByScalar(L,2*m,z),z),z),B=e.add(k,e.negate(e.multiplyByScalar(L,m,B),B),B),v===t.ROUNDED||v===t.BEVELED?X.push({rightPositions:u(k,F,z,v,et)}):X.push({rightPositions:h(H,N,z,et)})),I=e.negate(M,I)}H=q}_=l.geodeticSurfaceNormal(H,_),y[0]=e.clone(B,y[0]),y[1]=e.clone(H,y[1]),j=a.generateArc({positions:y,granularity:r,ellipsoid:l}),U=d(j,L,m,U),g&&(W.push(L.x,L.y,L.z),G.push(_.x,_.y,_.z));var tt;return v===t.ROUNDED&&(tt=c(U)),{positions:U,corners:X,lefts:W,normals:G,endPositions:tt}};var L=new e,N=new e;return m.scaleToGeodeticHeight=function(t,i,n,o){var a=t.length,s=r(o)?o:new Array(t.length);s.length=t.length;for(var l=i,u=0;a>u;u+=3){var c=n.scaleToGeodeticSurface(e.fromArray(t,u,N),N),h=L;0!==i&&(h=n.geodeticSurfaceNormal(c,h),h=e.multiplyByScalar(h,l,h),c=e.add(c,h,c)),s[u]=c.x,s[u+1]=c.y,s[u+2]=c.z}return s},m}),i("Core/CorridorGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./CornerType","./CorridorGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolylinePipeline","./PrimitiveType","./VertexFormat"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";function g(e,i,r,o,a,s){var l=e.normals,u=e.tangents,c=e.binormals,h=t.normalize(t.cross(r,i,A),A);s.normal&&n.addAttribute(l,i,o,a),s.binormal&&n.addAttribute(c,r,o,a),s.tangent&&n.addAttribute(u,h,o,a)}function _(e,r,o){var s,l,u,m=e.positions,f=e.corners,v=e.endPositions,_=e.lefts,y=e.normals,C=new h,w=0,T=0,M=0;for(l=0;ll;l++)k=t.fromArray($,3*(J-1-l),k),z=t.fromArray($,3*(J+l),z),n.addAttribute(U,z,j),n.addAttribute(U,k,void 0,Y),g(q,X,Z,j,Y,r),N=j/3,B=N+1,L=(Y-2)/3,F=L-1,Q[K++]=L,Q[K++]=N,Q[K++]=F,Q[K++]=F,Q[K++]=N,Q[K++]=B,j+=3,Y-=3}var et=0,tt=0,it=m[et++],rt=m[et++];U.set(it,j),U.set(rt,Y-rt.length+1),Z=t.fromArray(_,tt,Z);var nt,ot;for(u=rt.length-3,l=0;u>l;l+=3)nt=o.geodeticSurfaceNormal(t.fromArray(it,l,A),A),ot=o.geodeticSurfaceNormal(t.fromArray(rt,u-l,D),D),X=t.normalize(t.add(nt,ot,X),X),g(q,X,Z,j,Y,r),N=j/3,B=N+1,L=(Y-2)/3,F=L-1,Q[K++]=L,Q[K++]=N,Q[K++]=F,Q[K++]=F,Q[K++]=N,Q[K++]=B,j+=3,Y-=3; -for(nt=o.geodeticSurfaceNormal(t.fromArray(it,u,A),A),ot=o.geodeticSurfaceNormal(t.fromArray(rt,u,D),D),X=t.normalize(t.add(nt,ot,X),X),tt+=3,l=0;ll;l++)k=t.fromArray(mt,3*(O-l-1),k),z=t.fromArray(mt,3*l,z),n.addAttribute(U,k,void 0,Y),n.addAttribute(U,z,j),g(q,X,Z,j,Y,r),B=j/3,N=B-1,F=(Y-2)/3,L=F+1,Q[K++]=L,Q[K++]=N,Q[K++]=F,Q[K++]=F,Q[K++]=N,Q[K++]=B,j+=3,Y-=3}if(C.position=new c({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:U}),r.st){var ft,vt,gt=new Float32Array(2*(V/3)),_t=0;if(R){w/=3,T/=3;var yt=Math.PI/(O+1);vt=1/(w-O+1),ft=1/(T-O+1);var Ct,wt=O/2;for(l=wt+1;O+1>l;l++)Ct=p.PI_OVER_TWO+yt*l,gt[_t++]=ft*(1+Math.cos(Ct)),gt[_t++]=.5*(1+Math.sin(Ct));for(l=1;T-O+1>l;l++)gt[_t++]=l*ft,gt[_t++]=0;for(l=O;l>wt;l--)Ct=p.PI_OVER_TWO-l*yt,gt[_t++]=1-ft*(1+Math.cos(Ct)),gt[_t++]=.5*(1+Math.sin(Ct));for(l=wt;l>0;l--)Ct=p.PI_OVER_TWO-yt*l,gt[_t++]=1-vt*(1+Math.cos(Ct)),gt[_t++]=.5*(1+Math.sin(Ct));for(l=w-O;l>0;l--)gt[_t++]=l*vt,gt[_t++]=1;for(l=1;wt+1>l;l++)Ct=p.PI_OVER_TWO+yt*l,gt[_t++]=vt*(1+Math.cos(Ct)),gt[_t++]=.5*(1+Math.sin(Ct))}else{for(w/=3,T/=3,vt=1/(w-1),ft=1/(T-1),l=0;T>l;l++)gt[_t++]=l*ft,gt[_t++]=0;for(l=w;l>0;l--)gt[_t++]=(l-1)*vt,gt[_t++]=1}C.st=new c({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:gt})}return r.normal&&(C.normal=new c({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:q.normals})),r.tangent&&(C.tangent=new c({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:q.tangents})),r.binormal&&(C.binormal=new c({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:q.binormals})),{attributes:C,indices:Q}}function y(e,i){if(!(i.normal||i.binormal||i.tangent||i.st))return e;var r,o,a=e.position.values;(i.normal||i.binormal)&&(r=e.normal.values,o=e.binormal.values);var s,l=e.position.values.length/18,u=3*l,c=2*l,h=2*u;if(i.normal||i.binormal||i.tangent){var d=i.normal?new Float32Array(6*u):void 0,p=i.binormal?new Float32Array(6*u):void 0,m=i.tangent?new Float32Array(6*u):void 0,f=S,v=E,g=b,_=x,y=T,C=P,w=h;for(s=0;u>s;s+=3){var A=w+h;f=t.fromArray(a,s,f),v=t.fromArray(a,s+u,v),g=t.fromArray(a,(s+3)%u,g),v=t.subtract(v,f,v),g=t.subtract(g,f,g),_=t.normalize(t.cross(v,g,_),_),i.normal&&(n.addAttribute(d,_,A),n.addAttribute(d,_,A+3),n.addAttribute(d,_,w),n.addAttribute(d,_,w+3)),(i.tangent||i.binormal)&&(C=t.fromArray(r,s,C),i.binormal&&(n.addAttribute(p,C,A),n.addAttribute(p,C,A+3),n.addAttribute(p,C,w),n.addAttribute(p,C,w+3)),i.tangent&&(y=t.normalize(t.cross(C,_,y),y),n.addAttribute(m,y,A),n.addAttribute(m,y,A+3),n.addAttribute(m,y,w),n.addAttribute(m,y,w+3))),w+=6}if(i.normal){for(d.set(r),s=0;u>s;s+=3)d[s+u]=-r[s],d[s+u+1]=-r[s+1],d[s+u+2]=-r[s+2];e.normal.values=d}else e.normal=void 0;if(i.binormal?(p.set(o),p.set(o,u),e.binormal.values=p):e.binormal=void 0,i.tangent){var D=e.tangent.values;m.set(D),m.set(D,u),e.tangent.values=m}}if(i.st){var M=e.st.values,I=new Float32Array(6*c);I.set(M),I.set(M,c);for(var O=2*c,R=0;2>R;R++){for(I[O++]=M[0],I[O++]=M[1],s=2;c>s;s+=2){var L=M[s],N=M[s+1];I[O++]=L,I[O++]=N,I[O++]=L,I[O++]=N}I[O++]=M[0],I[O++]=M[1]}e.st.values=I}return e}function C(e,t,i){i[t++]=e[0],i[t++]=e[1],i[t++]=e[2];for(var r=3;rw;w+=3){var T=c[w],P=c[w+1],A=c[w+2];b[x++]=A+p,b[x++]=P+p,b[x++]=T+p}u=y(u,t);var D,M,I,O;for(w=0;E>w;w+=2)D=w+E,M=D+E,I=D+1,O=M+1,b[x++]=D,b[x++]=M,b[x++]=I,b[x++]=I,b[x++]=M,b[x++]=O;return{attributes:u,indices:b}}var S=new t,E=new t,b=new t,x=new t,T=new t,P=new t,A=new t,D=new t,M=function(e){e=o(e,o.EMPTY_OBJECT);var i=e.positions,n=e.width;this._positions=i,this._ellipsoid=l.clone(o(e.ellipsoid,l.WGS84)),this._vertexFormat=v.clone(o(e.vertexFormat,v.DEFAULT)),this._width=n,this._height=o(e.height,0),this._extrudedHeight=o(e.extrudedHeight,this._height),this._cornerType=o(e.cornerType,r.ROUNDED),this._granularity=o(e.granularity,p.RADIANS_PER_DEGREE),this._workerName="createCorridorGeometry",this.packedLength=1+i.length*t.packedLength+l.packedLength+v.packedLength+5};M.pack=function(e,i,r){r=o(r,0);var n=e._positions,a=n.length;i[r++]=a;for(var s=0;a>s;++s,r+=t.packedLength)t.pack(n[s],i,r);l.pack(e._ellipsoid,i,r),r+=l.packedLength,v.pack(e._vertexFormat,i,r),r+=v.packedLength,i[r++]=e._width,i[r++]=e._height,i[r++]=e._extrudedHeight,i[r++]=e._cornerType,i[r]=e._granularity};var I=l.clone(l.UNIT_SPHERE),O=new v,R={positions:void 0,ellipsoid:I,vertexFormat:O,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0};return M.unpack=function(e,i,r){i=o(i,0);for(var n=e[i++],s=new Array(n),u=0;n>u;++u,i+=t.packedLength)s[u]=t.unpack(e,i);var c=l.unpack(e,i,I);i+=l.packedLength;var h=v.unpack(e,i,O);i+=v.packedLength;var d=e[i++],p=e[i++],m=e[i++],f=e[i++],g=e[i];return a(r)?(r._positions=s,r._ellipsoid=l.clone(c,r._ellipsoid),r._vertexFormat=v.clone(h,r._vertexFormat),r._width=d,r._height=p,r._extrudedHeight=m,r._cornerType=f,r._granularity=g,r):(R.positions=s,R.width=d,R.height=p,R.extrudedHeight=m,R.cornerType=f,R.granularity=g,new M(R))},M.createGeometry=function(t){var i=t._positions,r=t._height,o=t._extrudedHeight,a=r!==o,s=m.removeDuplicates(i);if(s.length<2)return void 0;var l,c=t._ellipsoid,h=t._vertexFormat,d={ellipsoid:c,positions:s,width:t._width,cornerType:t._cornerType,granularity:t._granularity,saveAttributes:!0};if(a){var p=Math.max(r,o);o=Math.min(r,o),r=p,d.height=r,d.extrudedHeight=o,l=w(d,h)}else{var v=n.computePositions(d);l=_(v,h,c),l.attributes.position.values=n.scaleToGeodeticHeight(l.attributes.position.values,r,c,l.attributes.position.values)}var g=l.attributes,y=e.fromVertices(g.position.values,void 0,3);return h.position||(l.attributes.position.values=void 0),new u({attributes:g,indices:l.indices,primitiveType:f.TRIANGLES,boundingSphere:y})},M}),i("Core/CorridorOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./CornerType","./CorridorGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolylinePipeline","./PrimitiveType"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f){"use strict";function v(e,o){var s,l,u,p=[],m=e.positions,f=e.corners,v=e.endPositions,g=new h,w=0,S=0,E=0;for(l=0;ll;l++)O=t.fromArray(V,3*(B-1-l),O),I=t.fromArray(V,3*(B+l),I),n.addAttribute(L,I,N),n.addAttribute(L,O,void 0,F),A=N/3,M=A+1,P=(F-2)/3,D=P-1,z[k++]=P,z[k++]=D,z[k++]=A,z[k++]=M,N+=3,F-=3}var U=0,W=m[U++],G=m[U++];for(L.set(W,N),L.set(G,F-G.length+1),u=G.length-3,p.push(N/3,(F-2)/3),l=0;u>l;l+=3)A=N/3,M=A+1,P=(F-2)/3,D=P-1,z[k++]=P,z[k++]=D,z[k++]=A,z[k++]=M,N+=3,F-=3;for(l=0;ll;l++)O=t.fromArray(Z,3*(x-l-1),O),I=t.fromArray(Z,3*l,I),n.addAttribute(L,O,void 0,F),n.addAttribute(L,I,N),M=N/3,A=M-1,D=(F-2)/3,P=D+1,z[k++]=P,z[k++]=D,z[k++]=A,z[k++]=M,N+=3,F-=3;p.push(N/3)}else p.push(N/3,(F-2)/3);return z[k++]=N/3,z[k++]=(F-2)/3,g.position=new c({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:L}),{attributes:g,indices:z,wallIndices:p}}function g(e){var t=e.ellipsoid,i=n.computePositions(e),r=v(i,e.cornerType),o=r.wallIndices,a=e.height,s=e.extrudedHeight,l=r.attributes,u=r.indices,c=l.position.values,h=c.length,p=new Float64Array(h);p.set(c);var m=new Float64Array(2*h);c=n.scaleToGeodeticHeight(c,a,t,c),p=n.scaleToGeodeticHeight(p,s,t,p),m.set(c),m.set(p,h),l.position.values=m,h/=3;var f,g=u.length,_=d.createTypedArray(m.length/3,2*(g+o.length));_.set(u);var y=g;for(f=0;g>f;f+=2){var C=u[f],w=u[f+1];_[y++]=C+h,_[y++]=w+h}var S,E;for(f=0;fs;++s,r+=t.packedLength)t.pack(n[s],i,r);l.pack(e._ellipsoid,i,r),r+=l.packedLength,i[r++]=e._width,i[r++]=e._height,i[r++]=e._extrudedHeight,i[r++]=e._cornerType,i[r]=e._granularity};var S=l.clone(l.UNIT_SPHERE),E={positions:void 0,ellipsoid:S,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0};return w.unpack=function(e,i,r){i=o(i,0);for(var n=e[i++],s=new Array(n),u=0;n>u;++u,i+=t.packedLength)s[u]=t.unpack(e,i);var c=l.unpack(e,i,S);i+=l.packedLength;var h=e[i++],d=e[i++],p=e[i++],m=e[i++],f=e[i];return a(r)?(r._positions=s,r._ellipsoid=l.clone(c,r._ellipsoid),r._width=h,r._height=d,r._extrudedHeight=p,r._cornerType=m,r._granularity=f,r):(E.positions=s,E.width=h,E.height=d,E.extrudedHeight=p,E.cornerType=m,E.granularity=f,new w(E))},w.createGeometry=function(t){var i=t._positions,r=t._height,o=t._extrudedHeight,a=r!==o,s=m.removeDuplicates(i);if(s.length<2)return void 0;var l,c=t._ellipsoid,h={ellipsoid:c,positions:s,width:t._width,cornerType:t._cornerType,granularity:t._granularity,saveAttributes:!1};if(a){var d=Math.max(r,o);o=Math.min(r,o),r=d,h.height=r,h.extrudedHeight=o,l=g(h)}else{var p=n.computePositions(h);l=v(p,h.cornerType),l.attributes.position.values=n.scaleToGeodeticHeight(l.attributes.position.values,r,c,l.attributes.position.values)}var _=l.attributes,y=e.fromVertices(_.position.values,void 0,3);return new u({attributes:_,indices:l.indices,primitiveType:f.LINES,boundingSphere:y})},w}),i("Core/CylinderGeometryLibrary",["./Math"],function(e){"use strict";var t={};return t.computePositions=function(t,i,r,n,o){var a,s=.5*t,l=-s,u=n+n,c=o?2*u:u,h=new Float64Array(3*c),d=0,p=0,m=o?3*u:0,f=o?3*(u+n):3*n;for(a=0;n>a;a++){var v=a/n*e.TWO_PI,g=Math.cos(v),_=Math.sin(v),y=g*r,C=_*r,w=g*i,S=_*i;h[p+m]=y,h[p+m+1]=C,h[p+m+2]=l,h[p+f]=w,h[p+f+1]=S,h[p+f+2]=s,p+=3,o&&(h[d++]=y,h[d++]=C,h[d++]=l,h[d++]=w,h[d++]=S,h[d++]=s)}return h},t}),i("Core/CylinderGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./CylinderGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./VertexFormat"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";var f=new t,v=new i,g=new i,_=new i,y=new i,C=function(e){e=o(e,o.EMPTY_OBJECT);var t=e.length,i=e.topRadius,r=e.bottomRadius,n=o(e.vertexFormat,m.DEFAULT),a=o(e.slices,128);this._length=t,this._topRadius=i,this._bottomRadius=r,this._vertexFormat=m.clone(n),this._slices=a,this._workerName="createCylinderGeometry"};C.packedLength=m.packedLength+4,C.pack=function(e,t,i){i=o(i,0),m.pack(e._vertexFormat,t,i),i+=m.packedLength,t[i++]=e._length,t[i++]=e._topRadius,t[i++]=e._bottomRadius,t[i]=e._slices};var w=new m,S={vertexFormat:w,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0};return C.unpack=function(e,t,i){t=o(t,0);var r=m.unpack(e,t,w);t+=m.packedLength;var n=e[t++],s=e[t++],l=e[t++],u=e[t];return a(i)?(i._vertexFormat=m.clone(r,i._vertexFormat),i._length=n,i._topRadius=s,i._bottomRadius=l,i._slices=u,i):(S.length=n,S.topRadius=s,S.bottomRadius=l,S.slices=u,new C(S))},C.createGeometry=function(o){var a,s=o._length,m=o._topRadius,C=o._bottomRadius,w=o._vertexFormat,S=o._slices,E=S+S,b=S+E,x=E+E,T=n.computePositions(s,m,C,S,!0),P=w.st?new Float32Array(2*x):void 0,A=w.normal?new Float32Array(3*x):void 0,D=w.tangent?new Float32Array(3*x):void 0,M=w.binormal?new Float32Array(3*x):void 0,I=w.normal||w.tangent||w.binormal;if(I){var O=w.tangent||w.binormal,R=0,L=0,N=0,F=v;F.z=0;var B=_,z=g;for(a=0;S>a;a++){var k=a/S*d.TWO_PI,V=Math.cos(k),U=Math.sin(k);I&&(F.x=V,F.y=U,O&&(B=i.normalize(i.cross(i.UNIT_Z,F,B),B)),w.normal&&(A[R++]=V,A[R++]=U,A[R++]=0,A[R++]=V,A[R++]=U,A[R++]=0),w.tangent&&(D[L++]=B.x,D[L++]=B.y,D[L++]=B.z,D[L++]=B.x,D[L++]=B.y,D[L++]=B.z),w.binormal&&(z=i.normalize(i.cross(F,B,z),z),M[N++]=z.x,M[N++]=z.y,M[N++]=z.z,M[N++]=z.x,M[N++]=z.y,M[N++]=z.z))}for(a=0;S>a;a++)w.normal&&(A[R++]=0,A[R++]=0,A[R++]=-1),w.tangent&&(D[L++]=1,D[L++]=0,D[L++]=0),w.binormal&&(M[N++]=0,M[N++]=-1,M[N++]=0);for(a=0;S>a;a++)w.normal&&(A[R++]=0,A[R++]=0,A[R++]=1),w.tangent&&(D[L++]=1,D[L++]=0,D[L++]=0),w.binormal&&(M[N++]=0,M[N++]=1,M[N++]=0)}var W=12*S-12,G=h.createTypedArray(x,W),H=0,q=0;for(a=0;S-1>a;a++)G[H++]=q,G[H++]=q+2,G[H++]=q+3,G[H++]=q,G[H++]=q+3,G[H++]=q+1,q+=2;for(G[H++]=E-2,G[H++]=0,G[H++]=1,G[H++]=E-2,G[H++]=1,G[H++]=E-1,a=1;S-1>a;a++)G[H++]=E+a+1,G[H++]=E+a,G[H++]=E;for(a=1;S-1>a;a++)G[H++]=b,G[H++]=b+a,G[H++]=b+a+1;var j=0;if(w.st){var Y=Math.max(m,C);for(a=0;x>a;a++){var X=i.fromArray(T,3*a,y);P[j++]=(X.x+Y)/(2*Y),P[j++]=(X.y+Y)/(2*Y)}}var Z=new c;w.position&&(Z.position=new u({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:T})),w.normal&&(Z.normal=new u({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:A})),w.tangent&&(Z.tangent=new u({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:D})),w.binormal&&(Z.binormal=new u({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:M})),w.st&&(Z.st=new u({componentDatatype:r.FLOAT,componentsPerAttribute:2,values:P})),f.x=.5*s,f.y=Math.max(C,m);var J=new e(i.ZERO,t.magnitude(f));return new l({attributes:Z,indices:G,primitiveType:p.TRIANGLES,boundingSphere:J})},C}),i("Core/CylinderOutlineGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./CylinderGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./PrimitiveType"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";var p=new t,m=function(e){e=o(e,o.EMPTY_OBJECT);var t=e.length,i=e.topRadius,r=e.bottomRadius,n=o(e.slices,128),a=Math.max(o(e.numberOfVerticalLines,16),0);this._length=t,this._topRadius=i,this._bottomRadius=r,this._slices=n,this._numberOfVerticalLines=a,this._workerName="createCylinderOutlineGeometry"};m.packedLength=5,m.pack=function(e,t,i){i=o(i,0),t[i++]=e._length,t[i++]=e._topRadius,t[i++]=e._bottomRadius,t[i++]=e._slices,t[i]=e._numberOfVerticalLines};var f={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0};return m.unpack=function(e,t,i){t=o(t,0);var r=e[t++],n=e[t++],s=e[t++],l=e[t++],u=e[t];return a(i)?(i._length=r,i._topRadius=n,i._bottomRadius=s,i._slices=l,i._numberOfVerticalLines=u,i):(f.length=r,f.topRadius=n,f.bottomRadius=s,f.slices=l,f.numberOfVerticalLines=u,new m(f))},m.createGeometry=function(o){var a,s=o._length,m=o._topRadius,f=o._bottomRadius,v=o._slices,g=o._numberOfVerticalLines,_=2*v,y=n.computePositions(s,m,f,v,!1),C=2*v;if(g>0){var w=Math.min(g,v);a=Math.round(v/w),C+=w}for(var S=h.createTypedArray(_,2*C),E=0,b=0;v-1>b;b++)S[E++]=b,S[E++]=b+1,S[E++]=b+v,S[E++]=b+1+v;if(S[E++]=v-1,S[E++]=0,S[E++]=v+v-1,S[E++]=v,g>0)for(b=0;v>b;b+=a)S[E++]=b,S[E++]=b+v;var x=new c;x.position=new u({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:y}),p.x=.5*s,p.y=Math.max(f,m);var T=new e(i.ZERO,t.magnitude(p));return new l({attributes:x,indices:S,primitiveType:d.LINES,boundingSphere:T})},m}),i("Core/DefaultProxy",[],function(){"use strict";var e=function(e){this.proxy=e};return e.prototype.getURL=function(e){return this.proxy+"?"+encodeURIComponent(e)},e}),i("ThirdParty/Tween",[],function(){void 0===Date.now&&(Date.now=function(){return(new Date).valueOf()});var e=e||function(){var e=[];return{REVISION:"13",getAll:function(){return e},removeAll:function(){e=[]},add:function(t){e.push(t)},remove:function(t){var i=e.indexOf(t);-1!==i&&e.splice(i,1)},update:function(t){if(0===e.length)return!1;var i=0;for(t=void 0!==t?t:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();ie;e++)f[e].stop()},this.delay=function(e){return h=e,this},this.repeat=function(e){return s=e,this},this.yoyo=function(e){return l=e,this},this.easing=function(e){return p=e,this},this.interpolation=function(e){return m=e,this},this.chain=function(){return f=arguments,this},this.onStart=function(e){return v=e,this},this.onUpdate=function(e){return _=e,this},this.onComplete=function(e){return y=e,this},this.onStop=function(e){return C=e,this},this.update=function(e){var t;if(d>e)return!0;g===!1&&(null!==v&&v.call(i),g=!0);var u=(e-d)/a;u=u>1?1:u;var C=p(u);for(t in n){var w=r[t]||0,S=n[t];S instanceof Array?i[t]=m(S,C):("string"==typeof S&&(S=w+parseFloat(S,10)),"number"==typeof S&&(i[t]=w+(S-w)*C))}if(null!==_&&_.call(i,C),1==u){if(s>0){isFinite(s)&&s--;for(t in o){if("string"==typeof n[t]&&(o[t]=o[t]+parseFloat(n[t],10)),l){var E=o[t];o[t]=n[t],n[t]=E}r[t]=o[t]}return l&&(c=!c),d=e+h,!0}null!==y&&y.call(i);for(var b=0,x=f.length;x>b;b++)f[b].start(e);return!1}return!0}},e.Easing={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){var t,i=.1,r=.4;return 0===e?0:1===e?1:(!i||1>i?(i=1,t=r/4):t=r*Math.asin(1/i)/(2*Math.PI),-(i*Math.pow(2,10*(e-=1))*Math.sin((e-t)*2*Math.PI/r)))},Out:function(e){var t,i=.1,r=.4;return 0===e?0:1===e?1:(!i||1>i?(i=1,t=r/4):t=r*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*e)*Math.sin((e-t)*2*Math.PI/r)+1)},InOut:function(e){var t,i=.1,r=.4;return 0===e?0:1===e?1:(!i||1>i?(i=1,t=r/4):t=r*Math.asin(1/i)/(2*Math.PI),(e*=2)<1?-.5*i*Math.pow(2,10*(e-=1))*Math.sin((e-t)*2*Math.PI/r):.5*i*Math.pow(2,-10*(e-=1))*Math.sin((e-t)*2*Math.PI/r)+1)}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*e*e*((t+1)*e-t):.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(t){return 1-e.Easing.Bounce.Out(1-t)},Out:function(e){return 1/2.75>e?7.5625*e*e:2/2.75>e?7.5625*(e-=1.5/2.75)*e+.75:2.5/2.75>e?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(t){return.5>t?.5*e.Easing.Bounce.In(2*t):.5*e.Easing.Bounce.Out(2*t-1)+.5}}},e.Interpolation={Linear:function(t,i){var r=t.length-1,n=r*i,o=Math.floor(n),a=e.Interpolation.Utils.Linear;return 0>i?a(t[0],t[1],n):i>1?a(t[r],t[r-1],r-n):a(t[o],t[o+1>r?r:o+1],n-o)},Bezier:function(t,i){var r,n=0,o=t.length-1,a=Math.pow,s=e.Interpolation.Utils.Bernstein;for(r=0;o>=r;r++)n+=a(1-i,o-r)*a(i,r)*t[r]*s(o,r);return n},CatmullRom:function(t,i){var r=t.length-1,n=r*i,o=Math.floor(n),a=e.Interpolation.Utils.CatmullRom;return t[0]===t[r]?(0>i&&(o=Math.floor(n=r*(1+i))),a(t[(o-1+r)%r],t[o],t[(o+1)%r],t[(o+2)%r],n-o)):0>i?t[0]-(a(t[0],t[0],t[1],t[1],-n)-t[0]):i>1?t[r]-(a(t[r],t[r],t[r-1],t[r-1],n-r)-t[r]):a(t[o?o-1:0],t[o],t[o+1>r?r:o+1],t[o+2>r?r:o+2],n-o)},Utils:{Linear:function(e,t,i){return(t-e)*i+e},Bernstein:function(t,i){var r=e.Interpolation.Utils.Factorial;return r(t)/r(i)/r(t-i)},Factorial:function(){var e=[1];return function(t){var i,r=1;if(e[t])return e[t];for(i=t;i>1;i--)r*=i;return e[t]=r}}(),CatmullRom:function(e,t,i,r,n){var o=.5*(i-e),a=.5*(r-t),s=n*n,l=n*s;return(2*t-2*i+o+a)*l+(-3*t+3*i-2*o-a)*s+o*n+t}}},e}),i("Core/EasingFunction",["../ThirdParty/Tween","./freezeObject"],function(e,t){"use strict";var i={LINEAR_NONE:e.Easing.Linear.None,QUADRACTIC_IN:e.Easing.Quadratic.In,QUADRACTIC_OUT:e.Easing.Quadratic.Out,QUADRACTIC_IN_OUT:e.Easing.Quadratic.InOut,CUBIC_IN:e.Easing.Cubic.In,CUBIC_OUT:e.Easing.Cubic.Out,CUBIC_IN_OUT:e.Easing.Cubic.InOut,QUARTIC_IN:e.Easing.Quartic.In,QUARTIC_OUT:e.Easing.Quartic.Out,QUARTIC_IN_OUT:e.Easing.Quartic.InOut,QUINTIC_IN:e.Easing.Quintic.In,QUINTIC_OUT:e.Easing.Quintic.Out,QUINTIC_IN_OUT:e.Easing.Quintic.InOut,SINUSOIDAL_IN:e.Easing.Sinusoidal.In,SINUSOIDAL_OUT:e.Easing.Sinusoidal.Out,SINUSOIDAL_IN_OUT:e.Easing.Sinusoidal.InOut,EXPONENTIAL_IN:e.Easing.Exponential.In,EXPONENTIAL_OUT:e.Easing.Exponential.Out,EXPONENTIAL_IN_OUT:e.Easing.Exponential.InOut,CIRCULAR_IN:e.Easing.Circular.In,CIRCULAR_OUT:e.Easing.Circular.Out,CIRCULAR_IN_OUT:e.Easing.Circular.InOut,ELASTIC_IN:e.Easing.Elastic.In,ELASTIC_OUT:e.Easing.Elastic.Out,ELASTIC_IN_OUT:e.Easing.Elastic.InOut,BACK_IN:e.Easing.Back.In,BACK_OUT:e.Easing.Back.Out,BACK_IN_OUT:e.Easing.Back.InOut,BOUNCE_IN:e.Easing.Bounce.In,BOUNCE_OUT:e.Easing.Bounce.Out,BOUNCE_IN_OUT:e.Easing.Bounce.InOut};return t(i)}),i("Core/EllipsoidGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./VertexFormat"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";var f=new i,v=new i,g=new i,_=new i,y=new i,C=new i(1,1,1),w=Math.cos,S=Math.sin,E=function(e){e=n(e,n.EMPTY_OBJECT);var t=n(e.radii,C),r=n(e.stackPartitions,64),o=n(e.slicePartitions,64),a=n(e.vertexFormat,m.DEFAULT);this._radii=i.clone(t),this._stackPartitions=r,this._slicePartitions=o,this._vertexFormat=m.clone(a),this._workerName="createEllipsoidGeometry"};E.packedLength=i.packedLength+m.packedLength+2,E.pack=function(e,t,r){r=n(r,0),i.pack(e._radii,t,r),r+=i.packedLength,m.pack(e._vertexFormat,t,r),r+=m.packedLength,t[r++]=e._stackPartitions,t[r]=e._slicePartitions};var b=new i,x=new m,T={radii:b,vertexFormat:x,stackPartitions:void 0,slicePartitions:void 0};return E.unpack=function(e,t,r){t=n(t,0);var a=i.unpack(e,t,b);t+=i.packedLength;var s=m.unpack(e,t,x);t+=m.packedLength;var l=e[t++],u=e[t];return o(r)?(r._radii=i.clone(a,r._radii),r._vertexFormat=m.clone(s,r._vertexFormat),r._stackPartitions=l,r._slicePartitions=u,r):(T.stackPartitions=l,T.slicePartitions=u,new E(T))},E.createGeometry=function(n){var o,a,m=n._radii,C=s.fromCartesian3(m),E=n._vertexFormat,b=n._slicePartitions+1,x=n._stackPartitions+1,T=x*b,P=new Float64Array(3*T),A=6*(b-1)*(x-1),D=h.createTypedArray(T,A),M=E.normal?new Float32Array(3*T):void 0,I=E.tangent?new Float32Array(3*T):void 0,O=E.binormal?new Float32Array(3*T):void 0,R=E.st?new Float32Array(2*T):void 0,L=new Array(b),N=new Array(b),F=0;for(o=0;b>o;o++){var B=d.TWO_PI*o/(b-1);L[o]=w(B),N[o]=S(B),P[F++]=0,P[F++]=0,P[F++]=m.z}for(o=1;x-1>o;o++){var z=Math.PI*o/(x-1),k=S(z),V=m.x*k,U=m.y*k,W=m.z*w(z);for(a=0;b>a;a++)P[F++]=L[a]*V,P[F++]=N[a]*U,P[F++]=W}for(o=0;b>o;o++)P[F++]=0,P[F++]=0,P[F++]=-m.z;var G=new c;E.position&&(G.position=new u({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:P}));var H=0,q=0,j=0,Y=0;if(E.st||E.normal||E.tangent||E.binormal){for(o=0;T>o;o++){var X=i.fromArray(P,3*o,f),Z=C.geodeticSurfaceNormal(X,v);if(E.st){var J=t.negate(Z,y);t.magnitude(J)P.length&&(F=3*(o-b*Math.floor(.5*x))),i.fromArray(P,F,J),C.geodeticSurfaceNormal(J,J),t.negate(J,J)),R[H++]=Math.atan2(J.y,J.x)/d.TWO_PI+.5,R[H++]=Math.asin(Z.z)/Math.PI+.5}if(E.normal&&(M[q++]=Z.x,M[q++]=Z.y,M[q++]=Z.z),E.tangent||E.binormal){var Q=g;if(b>o||o>T-b-1?(i.cross(i.UNIT_X,Z,Q),i.normalize(Q,Q)):(i.cross(i.UNIT_Z,Z,Q),i.normalize(Q,Q)),E.tangent&&(I[j++]=Q.x,I[j++]=Q.y,I[j++]=Q.z),E.binormal){var K=i.cross(Z,Q,_);i.normalize(K,K),O[Y++]=K.x,O[Y++]=K.y,O[Y++]=K.z}}}E.st&&(G.st=new u({componentDatatype:r.FLOAT,componentsPerAttribute:2,values:R})),E.normal&&(G.normal=new u({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:M})),E.tangent&&(G.tangent=new u({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:I})),E.binormal&&(G.binormal=new u({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:O}))}for(F=0,o=0;x>o;o++){var $=o*b,et=(o+1)*b;for(a=0;b-1>a;a++)D[F++]=et+a,D[F++]=et+a+1,D[F++]=$+a+1,D[F++]=et+a,D[F++]=$+a+1,D[F++]=$+a}return new l({attributes:G,indices:D,primitiveType:p.TRIANGLES,boundingSphere:e.fromEllipsoid(C)})},E}),i("Core/EllipsoidOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";var p=new t(1,1,1),m=Math.cos,f=Math.sin,v=function(e){e=r(e,r.EMPTY_OBJECT);var i=r(e.radii,p),n=r(e.stackPartitions,10),o=r(e.slicePartitions,8),a=r(e.subdivisions,128);this._radii=t.clone(i),this._stackPartitions=n,this._slicePartitions=o,this._subdivisions=a,this._workerName="createEllipsoidOutlineGeometry"};v.packedLength=t.packedLength+3,v.pack=function(e,i,n){n=r(n,0),t.pack(e._radii,i,n),n+=t.packedLength,i[n++]=e._stackPartitions,i[n++]=e._slicePartitions,i[n]=e._subdivisions};var g=new t,_={radii:g,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};return v.unpack=function(e,i,o){i=r(i,0);var a=t.unpack(e,i,g);i+=t.packedLength;var s=e[i++],l=e[i++],u=e[i++];return n(o)?(o._radii=t.clone(a,o._radii),o._stackPartitions=s,o._slicePartitions=l,o._subdivisions=u,o):(_.stackPartitions=s,_.slicePartitions=l,_.subdivisions=u,new v(_))},v.createGeometry=function(t){var r,n,o,p,v,g,_=t._radii,y=a.fromCartesian3(_),C=t._stackPartitions,w=t._slicePartitions,S=t._subdivisions,E=S*(C+w-1),b=E-w+2,x=new Float64Array(3*b),T=c.createTypedArray(b,2*E),P=0,A=new Array(S),D=new Array(S);for(r=0;S>r;r++)o=h.TWO_PI*r/S,A[r]=m(o),D[r]=f(o);for(r=1;C>r;r++)for(p=Math.PI*r/C,v=m(p),g=f(p),n=0;S>n;n++)x[P++]=_.x*A[n]*g,x[P++]=_.y*D[n]*g,x[P++]=_.z*v;for(A.length=w,D.length=w,r=0;w>r;r++)o=h.TWO_PI*r/w,A[r]=m(o),D[r]=f(o);for(x[P++]=0,x[P++]=0,x[P++]=_.z,r=1;S>r;r++)for(p=Math.PI*r/S,v=m(p),g=f(p),n=0;w>n;n++)x[P++]=_.x*A[n]*g,x[P++]=_.y*D[n]*g,x[P++]=_.z*v;for(x[P++]=0,x[P++]=0,x[P++]=-_.z,P=0,r=0;C-1>r;++r){var M=r*S;for(n=0;S-1>n;++n)T[P++]=M+n,T[P++]=M+n+1;T[P++]=M+S-1,T[P++]=M}var I=S*(C-1);for(n=1;w+1>n;++n)T[P++]=I,T[P++]=I+n;for(r=0;S-2>r;++r){var O=r*w+1+I,R=(r+1)*w+1+I;for(n=0;w-1>n;++n)T[P++]=R+n,T[P++]=O+n;T[P++]=R+w-1,T[P++]=O+w-1}var L=x.length/3-1;for(n=L-1;n>L-w-1;--n)T[P++]=L,T[P++]=n;var N=new u({position:new l({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:x})});return new s({attributes:N,indices:T,primitiveType:d.LINES,boundingSphere:e.fromEllipsoid(y)})},v}),i("Core/EllipsoidTerrainProvider",["./defaultValue","./defined","./defineProperties","./Ellipsoid","./Event","./GeographicTilingScheme","./HeightmapTerrainData","./TerrainProvider"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(i){i=e(i,{}),this._tilingScheme=i.tilingScheme,t(this._tilingScheme)||(this._tilingScheme=new o({ellipsoid:e(i.ellipsoid,r.WGS84)})),this._levelZeroMaximumGeometricError=s.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0));var l=16,u=16;this._terrainData=new a({buffer:new Uint8Array(l*u),width:16,height:16}),this._errorEvent=new n};return i(l.prototype,{errorEvent:{get:function(){return this._errorEvent -}},credit:{get:function(){return void 0}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}}}),l.prototype.requestTileGeometry=function(){return this._terrainData},l.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<=i||i===1/0||i!==i?void 0:t.multiplyByScalar(e,i,r)}function u(e,i){return e.transformPositionToScaledSpace(i,v),t.normalize(v,v)}var c=function(e,i){this._ellipsoid=e,this._cameraPosition=new t,this._cameraPositionInScaledSpace=new t,this._distanceToLimbInScaledSpaceSquared=0,r(i)&&(this.cameraPosition=i)};n(c.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){var i=this._ellipsoid,r=i.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),n=t.magnitudeSquared(r)-1;t.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=r,this._distanceToLimbInScaledSpaceSquared=n}}});var h=new t;c.prototype.isPointVisible=function(e){var t=this._ellipsoid,i=t.transformPositionToScaledSpace(e,h);return this.isScaledSpacePointVisible(i)},c.prototype.isScaledSpacePointVisible=function(e){var i=this._cameraPositionInScaledSpace,r=this._distanceToLimbInScaledSpaceSquared,n=t.subtract(e,i,h),o=-t.dot(n,i),a=o>r&&o*o/t.magnitudeSquared(n)>r;return!a},c.prototype.computeHorizonCullingPoint=function(e,i,n){r(n)||(n=new t);for(var o=this._ellipsoid,a=u(o,e),c=0,h=0,d=i.length;d>h;++h){var p=i[h],m=s(o,p,a);c=Math.max(c,m)}return l(a,c,n)};var d=new t;c.prototype.computeHorizonCullingPointFromVertices=function(e,n,o,a,c){r(c)||(c=new t),a=i(a,t.ZERO);for(var h=this._ellipsoid,p=u(h,e),m=0,f=0,v=n.length;v>f;f+=o){d.x=n[f]+a.x,d.y=n[f+1]+a.y,d.z=n[f+2]+a.z;var g=s(h,d,p);m=Math.max(m,g)}return l(p,m,c)};var p=[];c.prototype.computeHorizonCullingPointFromRectangle=function(i,r,n){var o=a.subsample(i,r,0,p),s=e.fromPoints(o);return t.magnitude(s.center)<.1*r.minimumRadius?void 0:this.computeHorizonCullingPoint(s.center,o,n)};var m=new t,f=new t,v=new t;return c}),i("Core/EventHelper",["./defined","./DeveloperError"],function(){"use strict";var e=function(){this._removalFunctions=[]};return e.prototype.add=function(e,t,i){var r=e.addEventListener(t,i);this._removalFunctions.push(r);var n=this;return function(){r();var e=n._removalFunctions;e.splice(e.indexOf(r),1)}},e.prototype.removeAll=function(){for(var e=this._removalFunctions,t=0,i=e.length;i>t;++t)e[t]();e.length=0},e}),i("Core/ExtrapolationType",["./freezeObject"],function(e){"use strict";var t={NONE:0,HOLD:1,EXTRAPOLATE:2};return e(t)}),i("Core/GeometryInstanceAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.value=t.value};return t}),i("Core/HermitePolynomialApproximation",["./defaultValue","./defined","./DeveloperError","./Math"],function(e,t,i,r){"use strict";function n(e,t,i,r,o,a){var s,l,u,c=0;if(r>0){for(l=0;o>l;l++){for(s=!1,u=0;ul;l++){for(s=!1,u=0;ud;d++){var p=Math.floor(d*h);for(s=0;c>s;s++)l=t[s]*o*(a+1)+d,e[p+s]=n[l];for(var m=1;c>m;m++){var f=0,v=Math.floor(m*(1-m)/2)+c*m,g=!1;for(s=0;c-m>s;s++){var _,y,C=i[t[s]],w=i[t[s+m]];if(0>=w-C)l=t[s]*o*(a+1)+o*m+d,_=n[l],y=_/r.factorial(m),e[p+v+f]=y,f++;else{var S=Math.floor((m-1)*(2-m)/2)+c*(m-1);_=e[p+S+s+1]-e[p+S+s],y=_/(w-C),e[p+v+f]=y,f++}g=g||0!==_}g&&(u=Math.max(u,m))}}return u}var a=r.factorial,s={type:"Hermite"};s.getRequiredDataPoints=function(t,i){return i=e(i,0),Math.max(Math.floor((t+1)/(i+1)),2)},s.interpolateOrderZero=function(e,i,r,o,s){t(s)||(s=new Array(o));var l,u,c,h,d,p,m=i.length,f=new Array(o);for(l=0;o>l;l++){s[l]=0;var v=new Array(m);for(f[l]=v,u=0;m>u;u++)v[u]=[]}var g=m,_=new Array(g);for(l=0;g>l;l++)_[l]=l;var y=m-1;for(h=0;o>h;h++){for(u=0;g>u;u++)p=_[u]*o+h,f[h][0].push(r[p]);for(l=1;g>l;l++){var C=!1;for(u=0;g-l>u;u++){var w,S=i[_[u]],E=i[_[u+l]];0>=E-S?(p=_[u]*o+o*l+h,w=r[p],f[h][l].push(w/a(l))):(w=f[h][l-1][u+1]-f[h][l-1][u],f[h][l].push(w/(E-S))),C=C||0!==w}C||(y=l-1)}}for(c=0,d=0;d>=c;c++)for(l=c;y>=l;l++){var b=n(e,_,i,c,l,[]);for(h=0;o>h;h++){var x=f[h][l][0];s[h+c*o]+=x*b}}return s};var l=[];return s.interpolate=function(e,i,r,a,s,u,c){var h=a*(u+1);t(c)||(c=new Array(h));for(var d=0;h>d;d++)c[d]=0;for(var p=i.length,m=new Array(p*(s+1)),f=0;p>f;f++)for(var v=0;s+1>v;v++)m[f*(s+1)+v]=f;for(var g=m.length,_=l,y=o(_,m,i,r,a,s),C=[],w=g*(g+1)/2,S=Math.min(y,u),E=0;S>=E;E++)for(f=E;y>=f;f++){C.length=0;for(var b=n(e,m,i,E,f,C),x=Math.floor(f*(1-f)/2)+g*f,T=0;a>T;T++){var P=Math.floor(T*w),A=_[P+x];c[T+E*a]+=A*b}}return c},s}),i("Core/IauOrientationParameters",[],function(){"use strict";var e=function(e,t,i,r){this.rightAscension=e,this.declination=t,this.rotation=i,this.rotationRate=r};return e}),i("Core/Iau2000Orientation",["./defined","./IauOrientationParameters","./JulianDate","./Math","./TimeConstants"],function(e,t,i,r,n){"use strict";var o={},a=32.184,s=2451545,l=-.0529921,u=-.1059842,c=13.0120009,h=13.3407154,d=.9856003,p=26.4057084,m=13.064993,f=.3287146,v=1.7484877,g=-.1589763,_=.0036096,y=.1643573,C=12.9590088,w=new i;return o.ComputeMoon=function(o,S){e(o)||(o=i.now()),w=i.addSeconds(o,a,w);var E=i.totalDays(w)-s,b=E/n.DAYS_PER_JULIAN_CENTURY,x=(125.045+l*E)*r.RADIANS_PER_DEGREE,T=(250.089+u*E)*r.RADIANS_PER_DEGREE,P=(260.008+c*E)*r.RADIANS_PER_DEGREE,A=(176.625+h*E)*r.RADIANS_PER_DEGREE,D=(357.529+d*E)*r.RADIANS_PER_DEGREE,M=(311.589+p*E)*r.RADIANS_PER_DEGREE,I=(134.963+m*E)*r.RADIANS_PER_DEGREE,O=(276.617+f*E)*r.RADIANS_PER_DEGREE,R=(34.226+v*E)*r.RADIANS_PER_DEGREE,L=(15.134+g*E)*r.RADIANS_PER_DEGREE,N=(119.743+_*E)*r.RADIANS_PER_DEGREE,F=(239.961+y*E)*r.RADIANS_PER_DEGREE,B=(25.053+C*E)*r.RADIANS_PER_DEGREE,z=Math.sin(x),k=Math.sin(T),V=Math.sin(P),U=Math.sin(A),W=Math.sin(D),G=Math.sin(M),H=Math.sin(I),q=Math.sin(O),j=Math.sin(R),Y=Math.sin(L),X=Math.sin(N),Z=Math.sin(F),J=Math.sin(B),Q=Math.cos(x),K=Math.cos(T),$=Math.cos(P),et=Math.cos(A),tt=Math.cos(D),it=Math.cos(M),rt=Math.cos(I),nt=Math.cos(O),ot=Math.cos(R),at=Math.cos(L),st=Math.cos(N),lt=Math.cos(F),ut=Math.cos(B),ct=(269.9949+.0031*b-3.8787*z-.1204*k+.07*V-.0172*U+.0072*G-.0052*Y+.0043*J)*r.RADIANS_PER_DEGREE,ht=(66.5392+.013*b+1.5419*Q+.0239*K-.0278*$+.0068*et-.0029*it+9e-4*rt+8e-4*at-9e-4*ut)*r.RADIANS_PER_DEGREE,dt=(38.3213+13.17635815*E-1.4e-12*E*E+3.561*z+.1208*k-.0642*V+.0158*U+.0252*W-.0066*G-.0047*H-.0046*q+.0028*j+.0052*Y+.004*X+.0019*Z-.0044*J)*r.RADIANS_PER_DEGREE,pt=(13.17635815-1.4e-12*2*E+3.561*Q*l+.1208*K*u-.0642*$*c+.0158*et*h+.0252*tt*d-.0066*it*p-.0047*rt*m-.0046*nt*f+.0028*ot*v+.0052*at*g+.004*st*_+.0019*lt*y-.0044*ut*C)/86400*r.RADIANS_PER_DEGREE;return e(S)||(S=new t),S.rightAscension=ct,S.declination=ht,S.rotation=dt,S.rotationRate=pt,S},o}),i("Core/IauOrientationAxes",["./Cartesian3","./defined","./Iau2000Orientation","./JulianDate","./Math","./Matrix3","./Quaternion"],function(e,t,i,r,n,o,a){"use strict";function s(i,r,a){var s=u;s.x=Math.cos(i+n.PI_OVER_TWO),s.y=Math.sin(i+n.PI_OVER_TWO),s.z=0;var l=Math.cos(r),d=h;d.x=l*Math.cos(i),d.y=l*Math.sin(i),d.z=Math.sin(r);var p=e.cross(d,s,c);return t(a)||(a=new o),a[0]=s.x,a[1]=p.x,a[2]=d.x,a[3]=s.y,a[4]=p.y,a[5]=d.y,a[6]=s.z,a[7]=p.z,a[8]=d.z,a}var l=function(e){t(e)&&"function"==typeof e||(e=i.ComputeMoon),this._computeFunction=e},u=new e,c=new e,h=new e,d=new o,p=new a;return l.prototype.evaluate=function(i,l){t(i)||(i=r.now());var u=this._computeFunction(i),c=s(u.rightAscension,u.declination,l),h=n.zeroToTwoPi(u.rotation),m=a.fromAxisAngle(e.UNIT_Z,h,p),f=o.fromQuaternion(a.conjugate(m,m),d),v=o.multiply(f,c,c);return v},l}),i("Core/InterpolationAlgorithm",["./DeveloperError"],function(e){"use strict";var t={};return t.type=void 0,t.getRequiredDataPoints=e.throwInstantiationError,t.interpolateOrderZero=e.throwInstantiationError,t.interpolate=e.throwInstantiationError,t}),i("Core/TimeInterval",["./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./JulianDate"],function(e,t,i,r,n,o){"use strict";var a=function(i){i=e(i,e.EMPTY_OBJECT),this.start=t(i.start)?o.clone(i.start):new o,this.stop=t(i.stop)?o.clone(i.stop):new o,this.data=i.data,this.isStartIncluded=e(i.isStartIncluded,!0),this.isStopIncluded=e(i.isStopIncluded,!0)};i(a.prototype,{isEmpty:{get:function(){var e=o.compare(this.stop,this.start);return 0>e||0===e&&(!this.isStartIncluded||!this.isStopIncluded)}}});var s={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};return a.fromIso8601=function(i,r){var n=i.iso8601.split("/"),l=o.fromIso8601(n[0]),u=o.fromIso8601(n[1]),c=e(i.isStartIncluded,!0),h=e(i.isStopIncluded,!0),d=i.data;return t(r)?(r.start=l,r.stop=u,r.isStartIncluded=c,r.isStopIncluded=h,r.data=d,r):(s.start=l,s.stop=u,s.isStartIncluded=c,s.isStopIncluded=h,s.data=d,new a(s))},a.toIso8601=function(e,t){return o.toIso8601(e.start,t)+"/"+o.toIso8601(e.stop,t)},a.clone=function(e,i){return t(e)?t(i)?(i.start=e.start,i.stop=e.stop,i.isStartIncluded=e.isStartIncluded,i.isStopIncluded=e.isStopIncluded,i.data=e.data,i):new a(e):void 0},a.equals=function(e,i,r){return e===i||t(e)&&t(i)&&(e.isEmpty&&i.isEmpty||e.isStartIncluded===i.isStartIncluded&&e.isStopIncluded===i.isStopIncluded&&o.equals(e.start,i.start)&&o.equals(e.stop,i.stop)&&(e.data===i.data||t(r)&&r(e.data,i.data)))},a.equalsEpsilon=function(e,i,r,n){return e===i||t(e)&&t(i)&&(e.isEmpty&&i.isEmpty||e.isStartIncluded===i.isStartIncluded&&e.isStopIncluded===i.isStopIncluded&&o.equalsEpsilon(e.start,i.start,r)&&o.equalsEpsilon(e.stop,i.stop,r)&&(e.data===i.data||t(n)&&n(e.data,i.data)))},a.intersect=function(e,i,r,n){if(!t(i))return a.clone(a.EMPTY,r);var s=e.start,l=e.stop,u=i.start,c=i.stop,h=o.greaterThanOrEquals(u,s)&&o.greaterThanOrEquals(l,u),d=!h&&o.lessThanOrEquals(u,s)&&o.lessThanOrEquals(s,c);if(!h&&!d)return a.clone(a.EMPTY,r);var p=e.isStartIncluded,m=e.isStopIncluded,f=i.isStartIncluded,v=i.isStopIncluded,g=o.lessThan(l,c);return r.start=h?u:s,r.isStartIncluded=p&&f||!o.equals(u,s)&&(h&&f||d&&p),r.stop=g?l:c,r.isStopIncluded=g?m:m&&v||!o.equals(c,l)&&v,r.data=t(n)?n(e.data,i.data):e.data,r},a.contains=function(e,t){if(e.isEmpty)return!1;var i=o.compare(e.start,t);if(0===i)return e.isStartIncluded;var r=o.compare(t,e.stop);return 0===r?e.isStopIncluded:0>i&&0>r},a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e,t){return a.equals(this,e,t)},a.prototype.equalsEpsilon=function(e,t,i){return a.equalsEpsilon(this,e,t,i)},a.prototype.toString=function(){return a.toIso8601(this)},a.EMPTY=n(new a({start:new o,stop:new o,isStartIncluded:!1,isStopIncluded:!1})),a}),i("Core/Iso8601",["./freezeObject","./JulianDate","./TimeInterval"],function(e,t,i){"use strict";var r=e(t.fromIso8601("0000-01-01T00:00:00Z")),n=e(t.fromIso8601("9999-12-31T24:00:00Z")),o=e(new i({start:r,stop:n})),a={MINIMUM_VALUE:r,MAXIMUM_VALUE:n,MAXIMUM_INTERVAL:o};return a}),i("Core/KeyboardEventModifier",["./freezeObject"],function(e){"use strict";var t={SHIFT:0,CTRL:1,ALT:2};return e(t)}),i("Core/LagrangePolynomialApproximation",["./defined"],function(e){"use strict";var t={type:"Lagrange"};return t.getRequiredDataPoints=function(e){return Math.max(e+1,2)},t.interpolateOrderZero=function(t,i,r,n,o){e(o)||(o=new Array(n));var a,s,l=i.length;for(a=0;n>a;a++)o[a]=0;for(a=0;l>a;a++){var u=1;for(s=0;l>s;s++)if(s!==a){var c=i[a]-i[s];u*=(t-i[s])/c}for(s=0;n>s;s++)o[s]+=u*r[a*n+s]}return o},t}),i("Core/LinearApproximation",["./defined","./DeveloperError"],function(e){"use strict";var t={type:"Linear"};return t.getRequiredDataPoints=function(){return 2},t.interpolateOrderZero=function(t,i,r,n,o){e(o)||(o=new Array(n));var a,s,l,u=i[0],c=i[1];for(a=0;n>a;a++)s=r[a],l=r[a+n],o[a]=((l-s)*t+c*s-u*l)/(c-u);return o},t}),i("Core/MapProjection",["./defineProperties","./DeveloperError"],function(e,t){"use strict";var i=function(){t.throwInstantiationError()};return e(i.prototype,{ellipsoid:{get:t.throwInstantiationError}}),i.prototype.project=t.throwInstantiationError,i.prototype.unproject=t.throwInstantiationError,i}),i("Core/Matrix2",["./Cartesian2","./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,i,r,n){"use strict";var o=function(e,i,r,n){this[0]=t(e,0),this[1]=t(r,0),this[2]=t(i,0),this[3]=t(n,0)};o.packedLength=4,o.pack=function(e,i,r){r=t(r,0),i[r++]=e[0],i[r++]=e[1],i[r++]=e[2],i[r++]=e[3]},o.unpack=function(e,r,n){return r=t(r,0),i(n)||(n=new o),n[0]=e[r++],n[1]=e[r++],n[2]=e[r++],n[3]=e[r++],n},o.clone=function(e,t){return i(e)?i(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new o(e[0],e[2],e[1],e[3]):void 0},o.fromArray=function(e,r,n){return r=t(r,0),i(n)||(n=new o),n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n},o.fromColumnMajorArray=function(e,t){return o.clone(e,t)},o.fromRowMajorArray=function(e,t){return i(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new o(e[0],e[1],e[2],e[3])},o.fromScale=function(e,t){return i(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new o(e.x,0,0,e.y)},o.fromUniformScale=function(e,t){return i(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new o(e,0,0,e)},o.fromRotation=function(e,t){var r=Math.cos(e),n=Math.sin(e);return i(t)?(t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t):new o(r,-n,n,r)},o.toArray=function(e,t){return i(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]},o.getElementIndex=function(e,t){return 2*e+t},o.getColumn=function(e,t,i){var r=2*t,n=e[r],o=e[r+1];return i.x=n,i.y=o,i},o.setColumn=function(e,t,i,r){r=o.clone(e,r);var n=2*t;return r[n]=i.x,r[n+1]=i.y,r},o.getRow=function(e,t,i){var r=e[t],n=e[t+2];return i.x=r,i.y=n,i},o.setRow=function(e,t,i,r){return r=o.clone(e,r),r[t]=i.x,r[t+2]=i.y,r};var a=new e;o.getScale=function(t,i){return i.x=e.magnitude(e.fromElements(t[0],t[1],a)),i.y=e.magnitude(e.fromElements(t[2],t[3],a)),i};var s=new e;return o.getMaximumScale=function(t){return o.getScale(t,s),e.maximumComponent(s)},o.multiply=function(e,t,i){var r=e[0]*t[0]+e[2]*t[1],n=e[0]*t[2]+e[2]*t[3],o=e[1]*t[0]+e[3]*t[1],a=e[1]*t[2]+e[3]*t[3];return i[0]=r,i[1]=o,i[2]=n,i[3]=a,i},o.add=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i},o.subtract=function(e,t,i){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i},o.multiplyByVector=function(e,t,i){var r=e[0]*t.x+e[2]*t.y,n=e[1]*t.x+e[3]*t.y;return i.x=r,i.y=n,i},o.multiplyByScalar=function(e,t,i){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i},o.multiplyByScale=function(e,t,i){return i[0]=e[0]*t.x,i[1]=e[1]*t.x,i[2]=e[2]*t.y,i[3]=e[3]*t.y,i},o.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},o.transpose=function(e,t){var i=e[0],r=e[2],n=e[1],o=e[3];return t[0]=i,t[1]=r,t[2]=n,t[3]=o,t},o.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},o.equals=function(e,t){return e===t||i(e)&&i(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},o.equalsArray=function(e,t,i){return e[0]===t[i]&&e[1]===t[i+1]&&e[2]===t[i+2]&&e[3]===t[i+3]},o.equalsEpsilon=function(e,t,r){return e===t||i(e)&&i(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r},o.IDENTITY=n(new o(1,0,0,1)),o.ZERO=n(new o(0,0,0,0)),o.COLUMN0ROW0=0,o.COLUMN0ROW1=1,o.COLUMN1ROW0=2,o.COLUMN1ROW1=3,o.prototype.clone=function(e){return o.clone(this,e)},o.prototype.equals=function(e){return o.equals(this,e)},o.prototype.equalsEpsilon=function(e,t){return o.equalsEpsilon(this,e,t)},o.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n"+"("+this[1]+", "+this[3]+")"},o}),i("Core/NearFarScalar",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var i=function(t,i,r,n){this.near=e(t,0),this.nearValue=e(i,0),this.far=e(r,1),this.farValue=e(n,0)};return i.clone=function(e,r){return t(e)?t(r)?(r.near=e.near,r.nearValue=e.nearValue,r.far=e.far,r.farValue=e.farValue,r):new i(e.near,e.nearValue,e.far,e.farValue):void 0},i.packedLength=4,i.pack=function(t,i,r){r=e(r,0),i[r++]=t.near,i[r++]=t.nearValue,i[r++]=t.far,i[r]=t.farValue},i.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new i),o.near=r[n++],o.nearValue=r[n++],o.far=r[n++],o.farValue=r[n],o},i.equals=function(e,i){return e===i||t(e)&&t(i)&&e.near===i.near&&e.nearValue===i.nearValue&&e.far===i.far&&e.farValue===i.farValue},i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i}),i("Core/ObjectOrientedBoundingBox",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./deprecationWarning","./Matrix3"],function(e,t,i,r,n,o){"use strict";function a(e,t,i,r,n){var a=t[e]+i[0]*r[o.getElementIndex(0,e)]+i[1]*r[o.getElementIndex(1,e)]+i[2]*r[o.getElementIndex(2,e)];return Math.abs(n[e])>a?!0:!1}function s(e,t,i,r,n){var a=n[0]*r[o.getElementIndex(0,e)]+n[1]*r[o.getElementIndex(1,e)]+n[2]*r[o.getElementIndex(2,e)],s=i[e]+t[0]*r[o.getElementIndex(0,e)]+t[1]*r[o.getElementIndex(1,e)]+t[2]*r[o.getElementIndex(2,e)];return Math.abs(a)>s?!0:!1}function l(e,t,i,r,n,a){var s=a[(e+2)%3]*n[o.getElementIndex((e+1)%3,t)]-a[(e+1)%3]*n[o.getElementIndex((e+2)%3,t)],l=i[(e+1)%3]*n[o.getElementIndex((e+2)%3,t)]+i[(e+2)%3]*n[o.getElementIndex((e+1)%3,t)];return l+=r[(t+1)%3]*n[o.getElementIndex(e,(t+2)%3)]+r[(t+2)%3]*n[o.getElementIndex(e,(t+1)%3)],Math.abs(s)>l?!0:!1}var u=function(i,r,a){n("ObjectOrientedBoundingBox","ObjectOrientedBoundingBox was deprecated in Cesium 1.11. It will be removed in 1.12. Use OrientedBoundingBox instead."),this.rotation=o.clone(t(i,o.IDENTITY)),this.translation=e.clone(t(r,e.ZERO)),this.scale=e.clone(t(a,e.ZERO))},c=new e,h=new e,d=new e,p=new e,m=new e,f=new o,v={unitary:new o,diagonal:new o};u.fromPoints=function(t,r){if(i(r)||(r=new u),!i(t)||0===t.length)return r.tranformMatrix=o.IDENTITY,r.translation=e.ZERO,r.scale=e.ZERO,r;var n,a=t.length,s=e.clone(t[0],c);for(n=1;a>n;n++)e.add(s,t[n],s);var l=1/a;e.multiplyByScalar(s,l,s);var g,_=0,y=0,C=0,w=0,S=0,E=0;for(n=0;a>n;n++)g=e.subtract(t[n],s,h),_+=g.x*g.x,y+=g.x*g.y,C+=g.x*g.z,w+=g.y*g.y,S+=g.y*g.z,E+=g.z*g.z;_*=l,y*=l,C*=l,w*=l,S*=l,E*=l;var b=f;b[0]=_,b[1]=y,b[2]=C,b[3]=y,b[4]=w,b[5]=S,b[6]=C,b[7]=S,b[8]=E;var x=o.computeEigenDecomposition(b,v),T=o.transpose(x.unitary,r.rotation);g=e.subtract(t[0],s,h);var P=o.multiplyByVector(T,g,d),A=e.clone(P,p),D=e.clone(P,m);for(n=1;a>n;n++)g=e.subtract(t[n],s,g),o.multiplyByVector(T,g,P),e.minimumByComponent(D,P,D),e.maximumByComponent(A,P,A);var M=e.add(D,A,d);e.multiplyByScalar(M,.5,M),o.multiplyByVector(T,M,M),e.add(s,M,r.translation);var I=e.subtract(A,D,d);return e.multiplyByScalar(I,.5,r.scale),r},u.fromBoundingRectangle=function(e,t,r){i(r)||(r=new u),i(t)?o.fromRotationZ(t,r.rotation):o.clone(o.IDENTITY,r.rotation);var n=r.scale;n.x=.5*e.width,n.y=.5*e.height,n.z=0;var a=o.multiplyByVector(r.rotation,n,r.translation);return a.x+=e.x,a.y+=e.y,r},u.clone=function(t,r){return i(t)?i(r)?(o.clone(t.rotation,r.rotation),e.clone(t.translation,r.translation),e.clone(t.scale,r.scale),r):new u(t.rotation,t.translation,t.scale):void 0};var g=new o,_=new o,y=new e,C=new Array(3),w=new Array(3),S=new Array(3);return u.intersect=function(t,i){var r=o.transpose(t.rotation,g),n=o.multiply(r,i.rotation,_);o.abs(n,n);var u=C,c=w,h=S;return e.subtract(t.translation,i.translation,y),o.multiplyByVector(r,y,y),e.pack(y,u),e.pack(t.scale,c),e.pack(i.scale,h),a(0,c,h,n,u)?!1:a(1,c,h,n,u)?!1:a(2,c,h,n,u)?!1:s(0,c,h,n,u)?!1:s(1,c,h,n,u)?!1:s(2,c,h,n,u)?!1:l(0,0,c,h,n,u)?!1:l(1,0,c,h,n,u)?!1:l(2,0,c,h,n,u)?!1:l(0,1,c,h,n,u)?!1:l(1,1,c,h,n,u)?!1:l(2,1,c,h,n,u)?!1:l(0,2,c,h,n,u)?!1:l(1,2,c,h,n,u)?!1:l(2,2,c,h,n,u)?!1:!0},u.equals=function(t,r){return t===r||i(t)&&i(r)&&e.equals(t.translation,r.translation)&&o.equals(t.rotation,r.rotation)&&e.equals(t.scale,r.scale)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),i("Core/Visibility",["./freezeObject"],function(e){"use strict";var t={NONE:-1,PARTIAL:0,FULL:1};return e(t)}),i("Core/Occluder",["./BoundingSphere","./Cartesian3","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math","./Rectangle","./Visibility"],function(e,t,i,r,n,o,a,s,l,u){"use strict";var c=function(e,i){this._occluderPosition=t.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=i},h=new t;n(c.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){e=t.clone(e,this._cameraPosition);var i,r,n,o=t.subtract(this._occluderPosition,e,h),a=t.magnitudeSquared(o),s=this._occluderRadius*this._occluderRadius;if(a>s){i=Math.sqrt(a-s),a=1/Math.sqrt(a),r=t.multiplyByScalar(o,a,h);var l=i*i*a;n=t.add(e,t.multiplyByScalar(r,l,h),h)}else i=Number.MAX_VALUE;this._horizonDistance=i,this._horizonPlaneNormal=r,this._horizonPlanePosition=n,this._cameraPosition=e}}}),c.fromBoundingSphere=function(e,i,n){if(!r(e))throw new o("occluderBoundingSphere is required.");if(!r(i))throw new o("camera position is required.");return r(n)?(t.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=i,n):new c(e,i)};var d=new t;c.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){var i=t.subtract(e,this._occluderPosition,d),r=this._occluderRadius;if(r=t.magnitudeSquared(i)-r*r,r>0)return r=Math.sqrt(r)+this._horizonDistance,i=t.subtract(e,this._cameraPosition,i),r*r>t.magnitudeSquared(i)}return!1};var p=new t;c.prototype.isBoundingSphereVisible=function(e){var i=t.clone(e.center,p),r=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){var n=t.subtract(i,this._occluderPosition,d),o=this._occluderRadius-r;if(o=t.magnitudeSquared(n)-o*o,r0?(o=Math.sqrt(o)+this._horizonDistance,n=t.subtract(i,this._cameraPosition,n),o*o+r*r>t.magnitudeSquared(n)):!1;if(o>0){n=t.subtract(i,this._cameraPosition,n);var a=t.magnitudeSquared(n),s=this._occluderRadius*this._occluderRadius,l=r*r;return(this._horizonDistance*this._horizonDistance+s)*l>a*s?!0:(o=Math.sqrt(o)+this._horizonDistance,o*o+l>a)}return!0}return!1};var m=new t;c.prototype.computeVisibility=function(e){if(!r(e))throw new o("occludeeBS is required.");var i=t.clone(e.center),n=e.radius;if(n>this._occluderRadius)return u.FULL;if(this._horizonDistance!==Number.MAX_VALUE){var a=t.subtract(i,this._occluderPosition,m),s=this._occluderRadius-n,l=t.magnitudeSquared(a);if(s=l-s*s,s>0){s=Math.sqrt(s)+this._horizonDistance,a=t.subtract(i,this._cameraPosition,a);var c=t.magnitudeSquared(a);return c>s*s+n*n?u.NONE:(s=this._occluderRadius+n,s=l-s*s,s>0?(s=Math.sqrt(s)+this._horizonDistance,s*s+n*n>c?u.FULL:u.PARTIAL):(a=t.subtract(i,this._horizonPlanePosition,a),t.dot(a,this._horizonPlaneNormal)>-n?u.PARTIAL:u.FULL))}}return u.NONE};var f=new t;c.computeOccludeePoint=function(e,i,r){var n=t.clone(i),a=t.clone(e.center),s=e.radius,l=r.length;if(t.equals(a,i))throw new o("occludeePosition must be different than occluderBoundingSphere.center");var u=t.normalize(t.subtract(n,a,f),f),h=-t.dot(u,a),d=c._anyRotationVector(a,u,h),p=c._horizonToPlaneNormalDotProduct(e,u,h,d,r[0]);if(!p)return void 0;for(var m,v=1;l>v;++v){if(m=c._horizonToPlaneNormalDotProduct(e,u,h,d,r[v]),!m)return void 0;p>m&&(p=m)}if(.0017453283658983088>p)return void 0;var g=s/p;return t.add(a,t.multiplyByScalar(u,g,f),f)};var v=[];c.computeOccludeePointFromRectangle=function(r,n){n=i(n,a.WGS84);var o=l.subsample(r,n,0,v),s=e.fromPoints(o),u=t.ZERO;return t.equals(u,s.center)?void 0:c.computeOccludeePoint(new e(u,n.minimumRadius),s.center,o)};var g=new t;c._anyRotationVector=function(e,i,r){var n=t.abs(i,g),o=n.x>n.y?0:1;(0===o&&n.z>n.x||1===o&&n.z>n.y)&&(o=2);var a,s=new t;0===o?(n.x=e.x,n.y=e.y+1,n.z=e.z+1,a=t.UNIT_X):1===o?(n.x=e.x+1,n.y=e.y,n.z=e.z+1,a=t.UNIT_Y):(n.x=e.x+1,n.y=e.y+1,n.z=e.z,a=t.UNIT_Z);var l=(t.dot(i,n)+r)/-t.dot(i,a);return t.normalize(t.subtract(t.add(n,t.multiplyByScalar(a,l,s),n),e,n),n)};var _=new t;c._rotationVector=function(e,i,r,n,o){var a=t.subtract(n,e,_);if(a=t.normalize(a,a),t.dot(i,a)<.9999999847691291){var l=t.cross(i,a,a),u=t.magnitude(l);if(u>s.EPSILON13)return t.normalize(l,new t)}return o};var y=new t,C=new t,w=new t,S=new t;return c._horizonToPlaneNormalDotProduct=function(e,i,r,n,o){var a=t.clone(o,y),s=t.clone(e.center,C),l=e.radius,u=t.subtract(s,a,w),c=t.magnitudeSquared(u),h=l*l;if(h>c)return!1;var d=c-h,p=Math.sqrt(d),m=Math.sqrt(c),f=1/m,v=p*f,g=v*p;u=t.normalize(u,u);var _=t.add(a,t.multiplyByScalar(u,g,S),S),E=Math.sqrt(d-g*g),b=this._rotationVector(s,i,r,a,n),x=t.fromElements(b.x*b.x*u.x+(b.x*b.y-b.z)*u.y+(b.x*b.z+b.y)*u.z,(b.x*b.y+b.z)*u.x+b.y*b.y*u.y+(b.y*b.z-b.x)*u.z,(b.x*b.z-b.y)*u.x+(b.y*b.z+b.x)*u.y+b.z*b.z*u.z,y);x=t.normalize(x,x);var T=t.multiplyByScalar(x,E,y);b=t.normalize(t.subtract(t.add(_,T,w),s,w),w);var P=t.dot(i,b);b=t.normalize(t.subtract(t.subtract(_,T,b),s,b),b);var A=t.dot(i,b);return A>P?P:A},c}),i("Core/Packable",["./DeveloperError"],function(e){"use strict";var t={packedLength:void 0,pack:e.throwInstantiationError,unpack:e.throwInstantiationError};return t}),i("Core/PackableForInterpolation",["./DeveloperError"],function(e){"use strict";var t={packedInterpolationLength:void 0,convertPackedArrayForInterpolation:e.throwInstantiationError,unpackInterpolationResult:e.throwInstantiationError};return t}),i("ThirdParty/measureText",[],function(){var e=function(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)},t=function(t,i,r,n){var o=t.measureText(i),a=e(t.canvas,"font-family"),s=e(t.canvas,"font-size").replace("px",""),l=!/\S/.test(i);o.fontsize=s;var u=document.createElement("div");u.style.position="absolute",u.style.opacity=0,u.style.font=s+"px "+a,u.innerHTML=i+"
"+i,document.body.appendChild(u),o.leading=1.2*s;var c=e(u,"height");if(c=c.replace("px",""),c>=2*s&&(o.leading=0|c/2),document.body.removeChild(u),l)o.ascent=0,o.descent=0,o.bounds={minx:0,maxx:o.width,miny:0,maxy:0},o.height=0;else{var h=document.createElement("canvas"),d=100;h.width=o.width+d,h.height=3*s,h.style.opacity=1,h.style.fontFamily=a,h.style.fontSize=s;var p=h.getContext("2d");p.font=s+"px "+a;var m=h.width,f=h.height,v=f/2;p.fillStyle="white",p.fillRect(-1,-1,m+2,f+2),r&&(p.strokeStyle="black",p.lineWidth=t.lineWidth,p.strokeText(i,d/2,v)),n&&(p.fillStyle="black",p.fillText(i,d/2,v));for(var g=p.getImageData(0,0,m,f).data,_=0,y=4*m,C=g.length;++_0&&255===g[_];);var S=0|_/y;for(_=0;C>_&&255===g[_];)_+=y,_>=C&&(_=_-C+4);var E=0|_%y/4,b=1;for(_=C-3;_>=0&&255===g[_];)_-=y,0>_&&(_=C-3-4*b++);var x=0|_%y/4+1;o.ascent=v-w,o.descent=S-v,o.bounds={minx:E-d/2,maxx:x-d/2,miny:0,maxy:S-w},o.height=1+(S-w)}return o};return t}),i("Core/writeTextToCanvas",["../ThirdParty/measureText","./Color","./defaultValue","./defined","./DeveloperError"],function(e,t,i,r){"use strict";var n,o=function(o,a){if(""===o)return void 0;a=i(a,i.EMPTY_OBJECT);var s=i(a.font,"10px sans-serif"),l=i(a.stroke,!1),u=i(a.fill,!0),c=i(a.strokeWidth,1),h=document.createElement("canvas");h.width=1,h.height=1,h.style.font=s;var d=h.getContext("2d");r(n)||(r(d.imageSmoothingEnabled)?n="imageSmoothingEnabled":r(d.mozImageSmoothingEnabled)?n="mozImageSmoothingEnabled":r(d.webkitImageSmoothingEnabled)?n="webkitImageSmoothingEnabled":r(d.msImageSmoothingEnabled)&&(n="msImageSmoothingEnabled")),d.font=s,d.lineJoin="round",d.lineWidth=c,d[n]=!1,d.textBaseline=i(a.textBaseline,"bottom"),h.style.visibility="hidden",document.body.appendChild(h);var p=e(d,o,l,u);p.computedWidth=Math.max(p.width,p.bounds.maxx-p.bounds.minx),h.dimensions=p,document.body.removeChild(h),h.style.visibility="";var m=p.height-p.ascent;h.width=p.computedWidth,h.height=p.height;var f=h.height-m;if(d.font=s,d.lineJoin="round",d.lineWidth=c,d[n]=!1,l){var v=i(a.strokeColor,t.BLACK);d.strokeStyle=v.toCssColorString(),d.strokeText(o,0,f)}if(u){var g=i(a.fillColor,t.WHITE);d.fillStyle=g.toCssColorString(),d.fillText(o,0,f)}return h};return o}),i("Core/PinBuilder",["./buildModuleUrl","./Color","./defined","./DeveloperError","./loadImage","./writeTextToCanvas"],function(e,t,i,r,n,o){"use strict";function a(e,t,i){e.save(),e.scale(i/24,i/24),e.fillStyle=t.toCssColorString(),e.strokeStyle=t.brighten(.6,c).toCssColorString(),e.lineWidth=.846,e.beginPath(),e.moveTo(6.72,.422),e.lineTo(17.28,.422),e.bezierCurveTo(18.553,.422,19.577,1.758,19.577,3.415),e.lineTo(19.577,10.973),e.bezierCurveTo(19.577,12.63,18.553,13.966,17.282,13.966),e.lineTo(14.386,14.008),e.lineTo(11.826,23.578),e.lineTo(9.614,14.008),e.lineTo(6.719,13.965),e.bezierCurveTo(5.446,13.983,4.422,12.629,4.422,10.972),e.lineTo(4.422,3.416),e.bezierCurveTo(4.423,1.76,5.447,.423,6.718,.423),e.closePath(),e.fill(),e.stroke(),e.restore()}function s(e,i,r){var n=r/2.5,o=n,a=n;i.width>i.height?a=n*(i.height/i.width):i.width0;){var o=n.pop(); -if(i(o)){r+=2;var a=o.positions,s=o.holes;if(i(a)&&(r+=a.length*e.packedLength),i(s))for(var l=s.length,u=0;l>u;++u)n.push(s[u])}}return r},o.packPolygonHierarchy=function(t,r,n){for(var o=[t];o.length>0;){var a=o.pop();if(i(a)){var s=a.positions,l=a.holes;if(r[n++]=i(s)?s.length:0,r[n++]=i(l)?l.length:0,i(s))for(var u=s.length,c=0;u>c;++c,n+=3)e.pack(s[c],r,n);if(i(l))for(var h=l.length,d=0;h>d;++d)o.push(l[d])}}return n},o.unpackPolygonHierarchy=function(t,i){for(var r=t[i++],n=t[i++],a=new Array(r),s=n>0?new Array(n):void 0,l=0;r>l;++l,i+=e.packedLength)a[l]=e.unpack(t,i);for(var u=0;n>u;++u)s[u]=o.unpackPolygonHierarchy(t,i),i=s[u].startingIndex,delete s[u].startingIndex;return{positions:a,holes:s,startingIndex:i}};var a=new e;o.subdivideLineCount=function(t,i,r){var n=e.distance(t,i),o=n/r,a=Math.max(0,Math.ceil(Math.log(o)/Math.log(2)));return Math.pow(2,a)},o.subdivideLine=function(t,r,a,s){var l=o.subdivideLineCount(t,r,a),u=e.distance(t,r),c=u/l;i(s)||(s=[]);var h=s;h.length=3*l;for(var d=0,p=0;l>p;p++){var m=n(t,r,p*c,u);h[d++]=m[0],h[d++]=m[1],h[d++]=m[2]}return h};var s=new e,l=new e,u=new e,c=new e;return o.scaleToGeodeticHeightExtruded=function(n,o,a,h,d){h=t(h,r.WGS84);var p=s,m=l,f=u,v=c;if(i(n)&&i(n.attributes)&&i(n.attributes.position))for(var g=n.attributes.position.values,_=g.length/2,y=0;_>y;y+=3)e.fromArray(g,y,f),h.geodeticSurfaceNormal(f,p),v=h.scaleToGeodeticSurface(f,v),m=e.multiplyByScalar(p,a,m),m=e.add(v,m,m),g[y+_]=m.x,g[y+1+_]=m.y,g[y+2+_]=m.z,d&&(v=e.clone(f,v)),m=e.multiplyByScalar(p,o,m),m=e.add(v,m,m),g[y]=m.x,g[y+1]=m.y,g[y+2]=m.z;return n},o}),i("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var i=new t,r=function(t,r,n,o){return e(t,r,n,o,i),i.x>0&&i.y>0&&i.z>0};return r}),i("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,i=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,i},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),i("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),i("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f){"use strict";function v(t,i,r){var n=e.subtract(i,t,F),o=e.subtract(r,i,B);return n.x*o.y-n.y*o.x>=0}function g(e){for(var t=e[0].x,i=0,r=0;rt&&(t=e[r].x,i=r);return i}function _(e){for(var t=e[0][0].x,i=0,r=0;rt&&(t=n,i=r)}return i}function y(e){for(var t=[],i=0;ic&&(c=n[h].x);c+=c-u;var d=new t(c,i.y,0);for(h=0;h=i.x||m.x>=i.x)&&(p.y>=i.y&&m.y<=i.y||p.y<=i.y&&m.y>=i.y)){var f=(m.y-p.y)*(d.x-i.x)-(m.x-p.x)*(d.y-i.y);if(0!==f){f=1/f;var v=((m.x-p.x)*(i.y-p.y)-(m.y-p.y)*(i.x-p.x))*f,_=((d.x-i.x)*(i.y-p.y)-(d.y-i.y)*(i.x-p.x))*f;if(v>=0&&1>=v&&_>=0&&1>=_){var y=new e(i.x+v*(d.x-i.x),i.y+v*(d.y-i.y)),C=e.subtract(y,i,z);f=e.magnitudeSquared(C),a>f&&(l=y,a=f,o[0]=h,o[1]=(h+1)%n.length)}}}}return l}function S(t,i){var r=_(i),n=i[r],o=g(n),a=n[o],s=[],l=w(a,t,s),u=C(t,l);if(-1!==u)return u;var d=e.magnitudeSquared(e.subtract(t[s[0]],a,k)),p=e.magnitudeSquared(e.subtract(t[s[1]],a,k)),m=p>d?t[s[0]]:t[s[1]],f=y(t),v=f.indexOf(m);-1!==v&&f.splice(v,1);for(var S=[],E=0;E0){var T=e.fromElements(1,0,k);for(E=0;ED&&(x=D,m=S[E])}}}return t.indexOf(m)}function E(e,i,r){for(var n=et.computeWindingOrder2D(e),o=0;of?0>p&&m>0?U:W:f>0?p>0&&0>m?W:U:void 0}function M(e,t,i){return(e>t||e>i)&&(t>e||i>e)||t===i&&t===e}function I(t,i,r,n){var o=e.subtract(r,t,Y),a=i.x*n.y-i.y*n.x,s=a*a,l=e.magnitudeSquared(i),u=e.magnitudeSquared(n);if(s>j*l*u){var c=(o.x*n.y-o.y*n.x)/a;return e.add(t,e.multiplyByScalar(i,c,Y),Y)}return void 0}function O(t,i,r){for(var o=e.subtract(i,t,X),a=r.length,s=0;a>s;s++){var l=r[s].position,u=r[c.mod(s+1,a)].position;if(!(e.equals(t,l)||e.equals(i,u)||e.equals(t,u)||e.equals(i,l))){var h=e.subtract(u,l,Z),d=I(t,o,l,h);if(n(d)&&!(e.equals(d,t)||e.equals(d,i)||e.equals(d,l)||e.equals(d,u))){var p=d.x,m=d.y,f=M(p,t.x,i.x)&&M(m,t.y,i.y)&&M(p,l.x,u.x)&&M(m,l.y,u.y);if(f)return!0}}}return!1}function R(t,i,r){var n=D(t,i,r);if(n>=0)return n;var o=D(i,t,r);return o>=0?o:n!==U||o!==U||O(r[t].position,r[i].position,r)||e.equals(r[t].position,r[i].position)?Q:J}function L(e){return 0===x(1,2,0,e)}function N(e){var t=e.length;if(3===t)return L(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new o("Invalid polygon: must have at least three vertices.");for(var i,r,n=0,a=10*e.length,s=Q;J>s&&n++e.length-2;)r=b(e.length);if(i>r){var l=i;i=r,r=l}s=R(i,r,e)}if(s===J){var u=e.splice(i,r-i+1,e[i],e[r]);return N(e).concat(N(u))}return s>=0?(e.splice(s,1),N(e)):[]}var F=new e,B=new e,z=new e,k=new e(1,0),V=new e,U=-1,W=-2,G=new t,H=new t,q=new t,j=c.EPSILON14,Y=new e;new e;var X=new e,Z=new e,J=-1,Q=-2,K=new t,$=new t,et={};et.removeDuplicates=function(e){var i=d.removeDuplicates(e);return t.equals(i[0],i[i.length-1])?i.slice(1):i},et.computeArea2D=function(e){for(var t=e.length,i=0,r=t-1,n=0;t>n;r=n++){var o=e[r],a=e[n];i+=o.x*a.y-a.x*o.y}return.5*i},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?f.COUNTER_CLOCKWISE:f.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,i=[],r=0;t>r;++r)i[r]={position:e[r],index:r};return N(i)};var tt=new t,it=new t,rt=new t,nt=new t,ot=new t,at=new t,st=new t;return et.computeSubdivision=function(e,o,a,s){s=r(s,c.RADIANS_PER_DEGREE);var h,d=a.slice(0),m=o.length,f=new Array(3*m),v=0;for(h=0;m>h;h++){var g=o[h];f[v++]=g.x,f[v++]=g.y,f[v++]=g.z}for(var _=[],y={},C=e.maximumRadius,w=c.chordLength(s,C),S=w*w;d.length>0;){var E,b,x=d.pop(),T=d.pop(),P=d.pop(),A=t.fromArray(f,3*P,tt),D=t.fromArray(f,3*T,it),M=t.fromArray(f,3*x,rt),I=t.multiplyByScalar(t.normalize(A,nt),C,nt),O=t.multiplyByScalar(t.normalize(D,ot),C,ot),R=t.multiplyByScalar(t.normalize(M,at),C,at),L=t.magnitudeSquared(t.subtract(I,O,st)),N=t.magnitudeSquared(t.subtract(O,R,st)),F=t.magnitudeSquared(t.subtract(R,I,st)),B=Math.max(L,N,F);B>S?L===B?(E=Math.min(P,T)+" "+Math.max(P,T),h=y[E],n(h)||(b=t.add(A,D,st),t.multiplyByScalar(b,.5,b),f.push(b.x,b.y,b.z),h=f.length/3-1,y[E]=h),d.push(P,h,x),d.push(h,T,x)):N===B?(E=Math.min(T,x)+" "+Math.max(T,x),h=y[E],n(h)||(b=t.add(D,M,st),t.multiplyByScalar(b,.5,b),f.push(b.x,b.y,b.z),h=f.length/3-1,y[E]=h),d.push(T,h,P),d.push(h,x,P)):F===B&&(E=Math.min(x,P)+" "+Math.max(x,P),h=y[E],n(h)||(b=t.add(M,A,st),t.multiplyByScalar(b,.5,b),f.push(b.x,b.y,b.z),h=f.length/3-1,y[E]=h),d.push(x,h,T),d.push(h,P,T)):(_.push(P),_.push(T),_.push(x))}return new l({attributes:{position:new u({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:f})},indices:_,primitiveType:p.TRIANGLES})},et.scaleToGeodeticHeight=function(e,i,o,s){o=r(o,a.WGS84);var l=K,u=$;if(i=r(i,0),s=r(s,!0),n(e)&&n(e.attributes)&&n(e.attributes.position))for(var c=e.attributes.position.values,h=c.length,d=0;h>d;d+=3)t.fromArray(c,d,u),s&&(u=o.scaleToGeodeticSurface(u,u)),l=o.geodeticSurfaceNormal(u,l),t.multiplyByScalar(l,i,l),t.add(u,l,u),c[d]=u.x,c[d+1]=u.y,c[d+2]=u.z;return e},et.eliminateHoles=function(e,i,n){n=r(n,a.WGS84);for(var o=[],s=0;s0;)c=E(c,o,n);return c},et}),i("Core/PolygonGeometry",["./BoundingRectangle","./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix3","./PolygonGeometryLibrary","./PolygonPipeline","./PrimitiveType","./Quaternion","./Queue","./VertexFormat","./WindingOrder"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b){"use strict";function x(e,t,i,n){for(var o=w.fromAxisAngle(e._plane.normal,i,O),s=g.fromQuaternion(o,R),l=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,d=t.length,p=0;d>p;++p){var m=r.clone(t[p],I);g.multiplyByVector(s,m,m);var f=e.projectPointOntoPlane(m,M);a(f)&&(l=Math.min(l,f.x),u=Math.max(u,f.x),c=Math.min(c,f.y),h=Math.max(h,f.y))}return n.x=l,n.y=c,n.width=u-l,n.height=h-c,n}function T(e,t,i,r){var o=u.fromPoints(t,e),a=o.projectPointsOntoPlane(t,L),s=y.computeWindingOrder2D(a);s===b.CLOCKWISE&&(a.reverse(),t.reverse());var l=y.triangulate(a);l.length<3&&(l=[0,1,2]);var d;if(r){for(var m=t.length,f=new Array(3*m),v=0,g=0;m>g;g++){var _=t[g];f[v++]=_.x,f[v++]=_.y,f[v++]=_.z}d=new c({attributes:{position:new h({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:f})},indices:l,primitiveType:C.TRIANGLES})}else d=y.computeSubdivision(e,t,l,i);return new p({geometry:d})}function P(e,t,o,a,s,l,c){if(e.st||e.normal||e.tangent||e.binormal){var d=u.fromPoints(o,a),p=x(d,o,s,N),m=W;m.x=p.x,m.y=p.y;var f=t.attributes.position.values,_=f.length,y=e.st?new Float32Array(2*(_/3)):void 0,C=e.normal?new Float32Array(_):void 0,S=e.tangent?new Float32Array(_):void 0,E=e.binormal?new Float32Array(_):void 0,b=0,T=0,P=B,A=z,D=k,M=!0,I=w.fromAxisAngle(d._plane.normal,s,q),O=g.fromQuaternion(I,j),R=_/2,L=_/3;l&&(_/=2);for(var Y=0;_>Y;Y+=3){var X=r.fromArray(f,Y,H);if(e.st){var Z=g.multiplyByVector(O,X,F),J=d.projectPointOntoPlane(Z,G);i.subtract(J,m,J),l&&(y[b+L]=J.x/p.width,y[b+1+L]=J.y/p.height),y[b]=J.x/p.width,y[b+1]=J.y/p.height,b+=2}if(e.normal||e.tangent||e.binormal){var Q=T+1,K=T+2;if(c){if(_>Y+3){var $=r.fromArray(f,Y+3,V);if(M){var et=r.fromArray(f,Y+_,U);r.subtract($,X,$),r.subtract(et,X,et),P=r.normalize(r.cross(et,$,P),P),M=!1}r.equalsEpsilon($,X,v.EPSILON10)&&(M=!0)}(e.tangent||e.binormal)&&(D=a.geodeticSurfaceNormal(X,D),e.tangent&&(A=r.normalize(r.cross(D,P,A),A)))}else P=a.geodeticSurfaceNormal(X,P),(e.tangent||e.binormal)&&(A=r.cross(r.UNIT_Z,P,A),A=r.normalize(g.multiplyByVector(O,A,A),A),e.binormal&&(D=r.normalize(r.cross(P,A,D),D)));e.normal&&(l&&!c?(C[T+R]=-P.x,C[Q+R]=-P.y,C[K+R]=-P.z):(C[T+R]=P.x,C[Q+R]=P.y,C[K+R]=P.z),C[T]=P.x,C[Q]=P.y,C[K]=P.z),e.tangent&&(l&&!c?(S[T+R]=-A.x,S[Q+R]=-A.y,S[K+R]=-A.z):(S[T+R]=A.x,S[Q+R]=A.y,S[K+R]=A.z),S[T]=A.x,S[Q]=A.y,S[K]=A.z),e.binormal&&(l&&(E[T+R]=D.x,E[Q+R]=D.y,E[K+R]=D.z),E[T]=D.x,E[Q]=D.y,E[K]=D.z),T+=3}}e.st&&(t.attributes.st=new h({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:y})),e.normal&&(t.attributes.normal=new h({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:C})),e.tangent&&(t.attributes.tangent=new h({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:S})),e.binormal&&(t.attributes.binormal=new h({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:E}))}return t}function A(e,t,i,o){var a,s,l,u,p,m=e.length,g=0;if(o)for(s=2*3*m,a=new Array(2*s),l=0;m>l;l++)u=e[l],p=e[(l+1)%m],a[g]=a[g+s]=u.x,++g,a[g]=a[g+s]=u.y,++g,a[g]=a[g+s]=u.z,++g,a[g]=a[g+s]=p.x,++g,a[g]=a[g+s]=p.y,++g,a[g]=a[g+s]=p.z,++g;else{var y=v.chordLength(i,t.maximumRadius),w=0;for(l=0;m>l;l++)w+=_.subdivideLineCount(e[l],e[(l+1)%m],y);for(s=3*(w+m),a=new Array(2*s),l=0;m>l;l++){u=e[l],p=e[(l+1)%m];for(var S=_.subdivideLine(u,p,y,Y),E=S.length,b=0;E>b;++b,++g)a[g]=S[b],a[g+s]=S[b];a[g]=p.x,a[g+s]=p.x,++g,a[g]=p.y,a[g+s]=p.y,++g,a[g]=p.z,a[g+s]=p.z,++g}}m=a.length;var x=f.createTypedArray(m/3,m-6*e.length),T=0;for(m/=6,l=0;m>l;l++){var P=l,A=P+1,D=P+m,M=D+1;u=r.fromArray(a,3*P,V),p=r.fromArray(a,3*A,U),r.equalsEpsilon(u,p,v.EPSILON14)||(x[T++]=P,x[T++]=D,x[T++]=A,x[T++]=A,x[T++]=D,x[T++]=M)}return new c({attributes:new d({position:new h({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:a})}),indices:x,primitiveType:C.TRIANGLES})}function D(e,t,i,r,o){var a=T(e,t,i,o).geometry,s=a.attributes.position.values,l=a.indices,m=s.concat(s),v=m.length/3,g=f.createTypedArray(v,2*l.length);g.set(l);var _,C=l.length,w=v/2;for(_=0;C>_;_+=3){var S=g[_]+w,E=g[_+1]+w,x=g[_+2]+w;g[_+C]=x,g[_+1+C]=E,g[_+2+C]=S}var P=new c({attributes:new d({position:new h({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:m})}),indices:g,primitiveType:a.primitiveType}),D={topAndBottom:new p({geometry:P}),walls:[]},M=r.outerRing,I=u.fromPoints(M,e),O=I.projectPointsOntoPlane(M,X),R=y.computeWindingOrder2D(O);R===b.CLOCKWISE&&M.reverse();var L=A(M,e,i,o);D.walls.push(new p({geometry:L}));var N=r.holes;for(_=0;_E;E++){var O=A[E];if(O.positions=y.removeDuplicates(O.positions),!(O.positions.length<3)){I.push(O.positions);var R=0;a(O.holes)&&(R=O.holes.length);for(var L=0;R>L;L++)w.enqueue(O.holes[L])}}v.push({outerRing:x,holes:I});var N=I.length>0?y.eliminateHoles(x,I):x;C.push(N)}}if(0===C.length)return void 0;n=C[0];var F,B=[];if(p)for(E=0;Ey;y++){var b=i[y],x=i[(y+1)%C];g[E++]=b.x,g[E++]=b.y,g[E++]=b.z,g[E++]=x.x,g[E++]=x.y,g[E++]=x.z}else{var T=0;for(y=0;C>y;y++)T+=m.subdivideLineCount(i[y],i[(y+1)%C],r);for(g=new Float64Array(3*T),y=0;C>y;y++)for(var P=m.subdivideLine(i[y],i[(y+1)%C],r,S),A=P.length,D=0;A>D;++D)g[E++]=P[D]}C=g.length/3;var M=2*C,I=d.createTypedArray(C,M);for(E=0,y=0;C-1>y;y++)I[E++]=y,I[E++]=y+1;return I[E++]=C-1,I[E++]=0,new c({geometry:new s({attributes:new u({position:new l({componentDatatype:t.DOUBLE,componentsPerAttribute:3,values:g})}),indices:I,primitiveType:v.LINES})})}function C(e,i,r,n){var o=a.fromPoints(i,e),h=o.projectPointsOntoPlane(i,w),p=f.computeWindingOrder2D(h);p===_.CLOCKWISE&&(h.reverse(),i.reverse());var g,y,C=i.length,E=new Array(C),b=0;if(n)for(g=new Float64Array(2*3*2*C),y=0;C>y;++y){E[y]=b/3;var x=i[y],T=i[(y+1)%C];g[b++]=x.x,g[b++]=x.y,g[b++]=x.z,g[b++]=T.x,g[b++]=T.y,g[b++]=T.z}else{var P=0;for(y=0;C>y;y++)P+=m.subdivideLineCount(i[y],i[(y+1)%C],r);for(g=new Float64Array(2*3*P),y=0;C>y;++y){E[y]=b/3;for(var A=m.subdivideLine(i[y],i[(y+1)%C],r,S),D=A.length,M=0;D>M;++M)g[b++]=A[M]}}C=g.length/6;var I=E.length,O=2*(2*C+I),R=d.createTypedArray(C,O);for(b=0,y=0;C>y;++y)R[b++]=y,R[b++]=(y+1)%C,R[b++]=y+C,R[b++]=(y+1)%C+C;for(y=0;I>y;y++){var L=E[y];R[b++]=L,R[b++]=L+C}return new c({geometry:new s({attributes:new u({position:new l({componentDatatype:t.DOUBLE,componentsPerAttribute:3,values:g})}),indices:R,primitiveType:v.LINES})})}var w=[],S=[],E=function(e){var t=e.polygonHierarchy,n=i(e.ellipsoid,o.WGS84),a=i(e.granularity,p.RADIANS_PER_DEGREE),s=i(e.height,0),l=i(e.perPositionHeight,!1),u=e.extrudedHeight,c=r(u)&&(!p.equalsEpsilon(s,u,p.EPSILON6)||l);if(c){var h=u;u=Math.min(h,s),s=Math.max(h,s)}this._ellipsoid=o.clone(n),this._granularity=a,this._height=s,this._extrudedHeight=i(u,0),this._extrude=c,this._polygonHierarchy=t,this._perPositionHeight=l,this._workerName="createPolygonOutlineGeometry",this.packedLength=m.computeHierarchyPackedLength(t)+o.packedLength+6};E.pack=function(e,t,r){r=i(r,0),r=m.packPolygonHierarchy(e._polygonHierarchy,t,r),o.pack(e._ellipsoid,t,r),r+=o.packedLength,t[r++]=e._height,t[r++]=e._extrudedHeight,t[r++]=e._granularity,t[r++]=e._extrude?1:0,t[r++]=e._perPositionHeight?1:0,t[r++]=e.packedLength};var b=o.clone(o.UNIT_SPHERE),x={polygonHierarchy:{}};return E.unpack=function(e,t,n){t=i(t,0);var a=m.unpackPolygonHierarchy(e,t);t=a.startingIndex,delete a.startingIndex;var s=o.unpack(e,t,b);t+=o.packedLength;var l=e[t++],u=e[t++],c=e[t++],h=1===e[t++],d=1===e[t++],p=e[t++];return r(n)||(n=new E(x)),n._polygonHierarchy=a,n._ellipsoid=o.clone(s,n._ellipsoid),n._height=l,n._extrudedHeight=u,n._granularity=c,n._extrude=h,n._perPositionHeight=d,n.packedLength=p,n},E.fromPositions=function(e){e=i(e,i.EMPTY_OBJECT);var t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight};return new E(t)},E.createGeometry=function(t){var i=t._ellipsoid,n=t._granularity,o=t._height,a=t._extrudedHeight,l=t._extrude,u=t._polygonHierarchy,c=t._perPositionHeight,d=[],v=new g;v.enqueue(u);for(var _;0!==v.length;){var w=v.dequeue(),S=w.positions;if(S=f.removeDuplicates(S),!(S.length<3)){var E=w.holes?w.holes.length:0;for(_=0;E>_;_++){var b=w.holes[_];if(b.positions=f.removeDuplicates(b.positions),!(b.positions.length<3)){d.push(b.positions);var x=0;r(b.holes)&&(x=b.holes.length);for(var T=0;x>T;T++)v.enqueue(b.holes[T])}}d.push(S)}}if(0===d.length)return void 0;var P,A=[],D=p.chordLength(n,i.maximumRadius);if(l)for(_=0;_s;s++)a[s]=i.clone(r);return a}var v=(d-l)/o,g=(p-u)/o,y=(m-c)/o,C=(f-h)/o;for(s=0;o>s;s++)a[s]=new i(l+s*v,u+s*g,c+s*y,h+s*C);return a}var _=[],y=function(e){e=n(e,n.EMPTY_OBJECT);var r=e.positions,a=e.colors,l=n(e.width,1),u=n(e.colorsPerVertex,!1);this._positions=r,this._colors=a,this._width=l,this._colorsPerVertex=u,this._vertexFormat=v.clone(n(e.vertexFormat,v.DEFAULT)),this._followSurface=n(e.followSurface,!0),this._granularity=n(e.granularity,p.RADIANS_PER_DEGREE),this._ellipsoid=s.clone(n(e.ellipsoid,s.WGS84)),this._workerName="createPolylineGeometry";var c=1+r.length*t.packedLength;c+=o(a)?1+a.length*i.packedLength:1,this.packedLength=c+s.packedLength+v.packedLength+4};y.pack=function(e,r,a){a=n(a,0);var l,u=e._positions,c=u.length;for(r[a++]=c,l=0;c>l;++l,a+=t.packedLength)t.pack(u[l],r,a);var h=e._colors;for(c=o(h)?h.length:0,r[a++]=c,l=0;c>l;++l,a+=i.packedLength)i.pack(h[l],r,a);s.pack(e._ellipsoid,r,a),a+=s.packedLength,v.pack(e._vertexFormat,r,a),a+=v.packedLength,r[a++]=e._width,r[a++]=e._colorsPerVertex?1:0,r[a++]=e._followSurface?1:0,r[a]=e._granularity};var C=s.clone(s.UNIT_SPHERE),w=new v,S={positions:void 0,colors:void 0,ellipsoid:C,vertexFormat:w,width:void 0,colorsPerVertex:void 0,followSurface:void 0,granularity:void 0};y.unpack=function(e,r,a){r=n(r,0);var l,u=e[r++],c=new Array(u);for(l=0;u>l;++l,r+=t.packedLength)c[l]=t.unpack(e,r);u=e[r++];var h=u>0?new Array(u):void 0;for(l=0;u>l;++l,r+=i.packedLength)h[l]=i.unpack(e,r);var d=s.unpack(e,r,C);r+=s.packedLength;var p=v.unpack(e,r,w);r+=v.packedLength;var m=e[r++],f=1===e[r++],g=1===e[r++],_=e[r];return o(a)?(a._positions=c,a._colors=h,a._ellipsoid=s.clone(d,a._ellipsoid),a._vertexFormat=v.clone(p,a._vertexFormat),a._width=m,a._colorsPerVertex=f,a._followSurface=g,a._granularity=_,a):(S.positions=c,S.colors=h,S.width=m,S.colorsPerVertex=f,S.followSurface=g,S.granularity=_,new y(S))};var E=new t,b=new t,x=new t,T=new t;return y.createGeometry=function(n){var a,s,v,y=n._width,C=n._vertexFormat,w=n._colors,S=n._colorsPerVertex,P=n._followSurface,A=n._granularity,D=n._ellipsoid,M=p.chordLength(A,D.maximumRadius),I=m.removeDuplicates(n._positions),O=I.length;if(2>O)return void 0;if(P){var R=m.extractHeights(I,D);if(o(w)){var L=1;for(a=0;O-1>a;++a)L+=m.numberOfPoints(I[a],I[a+1],M);var N=new Array(L),F=0;for(a=0;O-1>a;++a){var B=I[a],z=I[a+1],k=w[a],V=m.numberOfPoints(B,z,M);if(S&&L>a){var U=w[a+1],W=g(B,z,k,U,V),G=W.length;for(s=0;G>s;++s)N[F++]=W[s]}else for(s=0;V>s;++s)N[F++]=i.clone(k)}N[F]=i.clone(w[w.length-1]),w=N,_.length=0}I=m.generateCartesianArc({positions:I,minDistance:M,ellipsoid:D,height:R})}O=I.length;var H,q=4*O-4,j=new Float64Array(3*q),Y=new Float64Array(3*q),X=new Float64Array(3*q),Z=new Float32Array(2*q),J=C.st?new Float32Array(2*q):void 0,Q=o(w)?new Uint8Array(4*q):void 0,K=0,$=0,et=0,tt=0;for(s=0;O>s;++s){0===s?(H=E,t.subtract(I[0],I[1],H),t.add(I[0],H,H)):H=I[s-1],t.clone(H,x),t.clone(I[s],b),s===O-1?(H=E,t.subtract(I[O-1],I[O-2],H),t.add(I[O-1],H,H)):H=I[s+1],t.clone(H,T);var it,rt;o(Q)&&(it=0===s||S?w[s]:w[s-1],s!==O-1&&(rt=w[s]));var nt=0===s?2:0,ot=s===O-1?2:4;for(v=nt;ot>v;++v){t.pack(b,j,K),t.pack(x,Y,K),t.pack(T,X,K),K+=3;var at=0>v-2?-1:1;if(Z[$++]=2*(v%2)-1,Z[$++]=at*y,C.st&&(J[et++]=s/(O-1),J[et++]=Math.max(Z[$-2],0)),o(Q)){var st=2>v?it:rt;Q[tt++]=i.floatToByte(st.red),Q[tt++]=i.floatToByte(st.green),Q[tt++]=i.floatToByte(st.blue),Q[tt++]=i.floatToByte(st.alpha)}}}var lt=new c;lt.position=new u({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:j}),lt.prevPosition=new u({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:Y}),lt.nextPosition=new u({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:X}),lt.expandAndWidth=new u({componentDatatype:r.FLOAT,componentsPerAttribute:2,values:Z}),C.st&&(lt.st=new u({componentDatatype:r.FLOAT,componentsPerAttribute:2,values:J})),o(Q)&&(lt.color=new u({componentDatatype:r.UNSIGNED_BYTE,componentsPerAttribute:4,values:Q,normalize:!0}));var ut=d.createTypedArray(q,6*O-6),ct=0,ht=0,dt=O-1;for(s=0;dt>s;++s)ut[ht++]=ct,ut[ht++]=ct+2,ut[ht++]=ct+1,ut[ht++]=ct+1,ut[ht++]=ct+2,ut[ht++]=ct+3,ct+=4;return new l({attributes:lt,indices:ut,primitiveType:f.TRIANGLES,boundingSphere:e.fromPoints(I),geometryType:h.POLYLINES})},y}),i("Core/PolylineVolumeGeometry",["./BoundingRectangle","./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./CornerType","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryPipeline","./IndexDatatype","./Math","./PolygonPipeline","./PolylineVolumeGeometryLibrary","./PrimitiveType","./VertexFormat","./WindingOrder"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function w(e,i,r,o){var a=new d;o.position&&(a.position=new h({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:e}));var s,l,u,f,g,y,C=i.length,w=e.length/3,S=(w-2*C)/(2*C),E=v.triangulate(i),b=6*(S-1)*C+2*E.length,x=m.createTypedArray(w,b),T=2*C,P=0;for(s=0;S-1>s;s++){for(l=0;C-1>l;l++)u=2*l+2*s*C,y=u+T,f=u+1,g=f+T,x[P++]=f,x[P++]=u,x[P++]=g,x[P++]=g,x[P++]=u,x[P++]=y;u=2*C-2+2*s*C,f=u+1,g=f+T,y=u+T,x[P++]=f,x[P++]=u,x[P++]=g,x[P++]=g,x[P++]=u,x[P++]=y}if(o.st||o.tangent||o.binormal){var A,D,M=new Float32Array(2*w),I=1/(S-1),O=1/r.height,R=r.height/2,L=0;for(s=0;S>s;s++){for(A=s*I,D=O*(i[0].y+R),M[L++]=A,M[L++]=D,l=1;C>l;l++)D=O*(i[l].y+R),M[L++]=A,M[L++]=D,M[L++]=A,M[L++]=D;D=O*(i[0].y+R),M[L++]=A,M[L++]=D}for(l=0;C>l;l++)A=0,D=O*(i[l].y+R),M[L++]=A,M[L++]=D;for(l=0;C>l;l++)A=(S-1)*I,D=O*(i[l].y+R),M[L++]=A,M[L++]=D;a.st=new h({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:new Float32Array(M)})}var N=w-2*C;for(s=0;so;++o,n+=r.packedLength)r.pack(s[o],t,n);var c=e._shape;for(l=c.length,t[n++]=l,o=0;l>o;++o,n+=i.packedLength)i.pack(c[o],t,n);u.pack(e._ellipsoid,t,n),n+=u.packedLength,y.pack(e._vertexFormat,t,n),n+=y.packedLength,t[n++]=e._cornerType,t[n]=e._granularity};var E=u.clone(u.UNIT_SPHERE),b=new y,x={polylinePositions:void 0,shapePositions:void 0,ellipsoid:E,vertexFormat:b,cornerType:void 0,granularity:void 0};S.unpack=function(e,t,n){t=a(t,0);var o,l=e[t++],c=new Array(l);for(o=0;l>o;++o,t+=r.packedLength)c[o]=r.unpack(e,t);l=e[t++];var h=new Array(l);for(o=0;l>o;++o,t+=i.packedLength)h[o]=i.unpack(e,t);var d=u.unpack(e,t,E);t+=u.packedLength;var p=y.unpack(e,t,b);t+=y.packedLength;var m=e[t++],f=e[t];return s(n)?(n._positions=c,n._shape=h,n._ellipsoid=u.clone(d,n._ellipsoid),n._vertexFormat=y.clone(p,n._vertexFormat),n._cornerType=m,n._granularity=f,n):(x.polylinePositions=c,x.shapePositions=h,x.cornerType=m,x.granularity=f,new S(x))};var T=new e;return S.createGeometry=function(t){var i=t._positions,r=g.removeDuplicatesFromPositions(i,t._ellipsoid),n=t._shape;if(n=g.removeDuplicatesFromShape(n),r.length<2||n.length<3)return void 0;v.computeWindingOrder2D(n)===C.CLOCKWISE&&n.reverse(); -var o=e.fromPoints(n,T),a=g.computePositions(r,n,o,t,!0);return w(a,n,o,t._vertexFormat)},S}),i("Core/PolylineVolumeOutlineGeometry",["./BoundingRectangle","./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./CornerType","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolygonPipeline","./PolylineVolumeGeometryLibrary","./PrimitiveType","./WindingOrder"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_){"use strict";function y(e,i){var r=new d;r.position=new h({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:e});var o,a,s=i.length,l=r.position.values.length/3,u=e.length/3,m=u/s,f=p.createTypedArray(l,2*s*(m+1)),v=0;o=0;var _=o*s;for(a=0;s-1>a;a++)f[v++]=a+_,f[v++]=a+_+1;for(f[v++]=s-1+_,f[v++]=_,o=m-1,_=o*s,a=0;s-1>a;a++)f[v++]=a+_,f[v++]=a+_+1;for(f[v++]=s-1+_,f[v++]=_,o=0;m-1>o;o++){var y=s*o,C=y+s;for(a=0;s>a;a++)f[v++]=a+y,f[v++]=a+C}var w=new c({attributes:r,indices:p.createTypedArray(l,f),boundingSphere:t.fromVertices(e),primitiveType:g.LINES});return w}var C=function(e){e=a(e,a.EMPTY_OBJECT);var t=e.polylinePositions,n=e.shapePositions;this._positions=t,this._shape=n,this._ellipsoid=u.clone(a(e.ellipsoid,u.WGS84)),this._cornerType=a(e.cornerType,o.ROUNDED),this._granularity=a(e.granularity,m.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";var s=1+t.length*r.packedLength;s+=1+n.length*i.packedLength,this.packedLength=s+u.packedLength+2};C.pack=function(e,t,n){n=a(n,0);var o,s=e._positions,l=s.length;for(t[n++]=l,o=0;l>o;++o,n+=r.packedLength)r.pack(s[o],t,n);var c=e._shape;for(l=c.length,t[n++]=l,o=0;l>o;++o,n+=i.packedLength)i.pack(c[o],t,n);u.pack(e._ellipsoid,t,n),n+=u.packedLength,t[n++]=e._cornerType,t[n]=e._granularity};var w=u.clone(u.UNIT_SPHERE),S={polylinePositions:void 0,shapePositions:void 0,ellipsoid:w,height:void 0,cornerType:void 0,granularity:void 0};C.unpack=function(e,t,n){t=a(t,0);var o,l=e[t++],c=new Array(l);for(o=0;l>o;++o,t+=r.packedLength)c[o]=r.unpack(e,t);l=e[t++];var h=new Array(l);for(o=0;l>o;++o,t+=i.packedLength)h[o]=i.unpack(e,t);var d=u.unpack(e,t,w);t+=u.packedLength;var p=e[t++],m=e[t];return s(n)?(n._positions=c,n._shape=h,n._ellipsoid=u.clone(d,n._ellipsoid),n._cornerType=p,n._granularity=m,n):(S.polylinePositions=c,S.shapePositions=h,S.cornerType=p,S.granularity=m,new C(S))};var E=new e;return C.createGeometry=function(t){var i=t._positions,r=v.removeDuplicatesFromPositions(i,t._ellipsoid),n=t._shape;if(n=v.removeDuplicatesFromShape(n),r.length<2||n.length<3)return void 0;f.computeWindingOrder2D(n)===_.CLOCKWISE&&n.reverse();var o=e.fromPoints(n,E),a=v.computePositions(r,n,o,t,!1);return y(a,n)},C}),i("Core/QuaternionSpline",["./defaultValue","./defined","./defineProperties","./DeveloperError","./Quaternion","./Spline"],function(e,t,i,r,n,o){"use strict";function a(e,i,r){var o=e.length,a=new Array(o);a[0]=t(i)?i:e[0],a[o-1]=t(r)?r:e[o-1];for(var s=1;o-1>s;++s)a[s]=n.computeInnerQuadrangle(e[s-1],e[s],e[s+1],new n);return a}function s(e){var i=e.points,r=e.innerQuadrangles,o=e.times;if(i.length<3){var a=o[0],s=1/(o[1]-a),l=i[0],u=i[1];return function(e,i){t(i)||(i=new n);var r=(e-a)*s;return n.fastSlerp(l,u,r,i)}}return function(a,s){t(s)||(s=new n);var l=e._lastTimeIndex=e.findTimeInterval(a,e._lastTimeIndex),u=(a-o[l])/(o[l+1]-o[l]),c=i[l],h=i[l+1],d=r[l],p=r[l+1];return n.fastSquad(c,h,d,p,u,s)}}var l=function(t){t=e(t,e.EMPTY_OBJECT);var i=t.points,r=t.times,n=t.firstInnerQuadrangle,o=t.lastInnerQuadrangle,l=a(i,n,o);this._times=r,this._points=i,this._innerQuadrangles=l,this._evaluateFunction=s(this),this._lastTimeIndex=0};return i(l.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},innerQuadrangles:{get:function(){return this._innerQuadrangles}}}),l.prototype.findTimeInterval=o.prototype.findTimeInterval,l.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)},l}),i("Core/RectangleGeometryLibrary",["./Cartesian3","./Cartographic","./defined","./DeveloperError","./GeographicProjection","./Math","./Matrix2","./Rectangle"],function(e,t,i,r,n,o,a,s){"use strict";var l=Math.cos,u=Math.sin,c=Math.sqrt,h={};h.computePosition=function(e,t,r,n,o){var s=e.ellipsoid.radiiSquared,h=e.nwCorner,d=e.rectangle,p=h.latitude-e.granYCos*t+r*e.granXSin,m=l(p),f=u(p),v=s.z*f,g=h.longitude+t*e.granYSin+r*e.granXCos,_=m*l(g),y=m*u(g),C=s.x*_,w=s.y*y,S=c(C*_+w*y+v*f);n.x=C/S,n.y=w/S,n.z=v/S,i(e.vertexFormat)&&e.vertexFormat.st&&(o.x=(g-d.west)*e.lonScalar-.5,o.y=(p-d.south)*e.latScalar-.5,a.multiplyByVector(e.textureMatrix,o,o),o.x+=.5,o.y+=.5)};var d=new a,p=new e,m=new t,f=new e,v=new n;return h.computeOptions=function(t,n,l){var u,c,h,g,_,y=t._granularity,C=t._ellipsoid,w=t._surfaceHeight,S=t._rotation,E=t._extrudedHeight,b=n.east,x=n.west,T=n.north,P=n.south,A=T-P;x>b?(_=o.TWO_PI-x+b,u=Math.ceil(_/y)+1,c=Math.ceil(A/y)+1,h=_/(u-1),g=A/(c-1)):(_=b-x,u=Math.ceil(_/y)+1,c=Math.ceil(A/y)+1,h=_/(u-1),g=A/(c-1)),l=s.northwest(n,l);var D=s.center(n,m),M=g,I=h,O=0,R=0;if(i(S)){var L=Math.cos(S);M*=L,I*=L;var N=Math.sin(S);O=g*N,R=h*N,p=v.project(l,p),f=v.project(D,f),p=e.subtract(p,f,p);var F=a.fromRotation(S,d);p=a.multiplyByVector(F,p,p),p=e.add(p,f,p),l=v.unproject(p,l);var B=l.latitude,z=B+(u-1)*R,k=B-M*(c-1),V=B-M*(c-1)+(u-1)*R;T=Math.max(B,z,k,V),P=Math.min(B,z,k,V);var U=l.longitude,W=U+(u-1)*I,G=U+(c-1)*O,H=U+(c-1)*O+(u-1)*I;if(b=Math.max(U,W,G,H),x=Math.min(U,W,G,H),T<-o.PI_OVER_TWO||T>o.PI_OVER_TWO||P<-o.PI_OVER_TWO||P>o.PI_OVER_TWO)throw new r("Rotated extent is invalid.");n.north=T,n.south=P,n.east=b,n.west=x}return{granYCos:M,granYSin:O,granXCos:I,granXSin:R,ellipsoid:C,width:u,height:c,surfaceHeight:w,extrudedHeight:E,nwCorner:l,rectangle:n}},h}),i("Core/RectangleGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix2","./Matrix3","./PolygonPipeline","./PrimitiveType","./Quaternion","./Rectangle","./RectangleGeometryLibrary","./VertexFormat"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E){"use strict";function b(e,t){var i=new u({attributes:new h,primitiveType:y.TRIANGLES});return i.attributes.position=new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(i.attributes.normal=new c({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(i.attributes.tangent=new c({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.binormal&&(i.attributes.binormal=new c({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:t.binormals})),i}function x(e,t,r,n){for(var o=e.length,a=t.normal?new Float32Array(o):void 0,s=t.tangent?new Float32Array(o):void 0,l=t.binormal?new Float32Array(o):void 0,u=0,c=L,h=R,d=O,p=0;o>p;p+=3){var m=i.fromArray(e,p,I),f=u+1,v=u+2;(t.normal||t.tangent||t.binormal)&&(d=r.geodeticSurfaceNormal(m,d),(t.tangent||t.binormal)&&(i.cross(i.UNIT_Z,d,h),g.multiplyByVector(n,h,h),i.normalize(h,h),t.binormal&&i.normalize(i.cross(d,h,c),c)),t.normal&&(a[u]=d.x,a[f]=d.y,a[v]=d.z),t.tangent&&(s[u]=h.x,s[f]=h.y,s[v]=h.z),t.binormal&&(l[u]=c.x,l[f]=c.y,l[v]=c.z)),u+=3}return b(t,{positions:e,normals:a,tangents:s,binormals:l})}function T(e,t,r){for(var n=e.length,o=t.normal?new Float32Array(n):void 0,a=t.tangent?new Float32Array(n):void 0,s=t.binormal?new Float32Array(n):void 0,l=0,u=0,c=0,h=!0,d=L,p=R,m=O,v=0;n>v;v+=6){var g=i.fromArray(e,v,I);if(t.normal||t.tangent||t.binormal){var _=i.fromArray(e,(v+6)%n,k);if(h){var y=i.fromArray(e,(v+3)%n,V);i.subtract(_,g,_),i.subtract(y,g,y),m=i.normalize(i.cross(y,_,m),m),h=!1}i.equalsEpsilon(_,g,f.EPSILON10)&&(h=!0),(t.tangent||t.binormal)&&(d=r.geodeticSurfaceNormal(g,d),t.tangent&&(p=i.normalize(i.cross(d,m,p),p))),t.normal&&(o[l++]=m.x,o[l++]=m.y,o[l++]=m.z,o[l++]=m.x,o[l++]=m.y,o[l++]=m.z),t.tangent&&(a[u++]=p.x,a[u++]=p.y,a[u++]=p.z,a[u++]=p.x,a[u++]=p.y,a[u++]=p.z),t.binormal&&(s[c++]=d.x,s[c++]=d.y,s[c++]=d.z,s[c++]=d.x,s[c++]=d.y,s[c++]=d.z)}}return b(t,{positions:e,normals:o,tangents:a,binormals:s})}function P(e){for(var t=e.vertexFormat,i=e.ellipsoid,r=e.size,o=e.height,a=e.width,s=t.position?new Float64Array(3*r):void 0,l=t.st?new Float32Array(2*r):void 0,u=0,h=0,d=I,p=F,f=Number.MAX_VALUE,v=Number.MAX_VALUE,g=Number.MIN_VALUE,_=Number.MIN_VALUE,y=0;o>y;++y)for(var C=0;a>C;++C)S.computePosition(e,y,C,d,p),s[u++]=d.x,s[u++]=d.y,s[u++]=d.z,t.st&&(l[h++]=p.x,l[h++]=p.y,f=Math.min(f,p.x),v=Math.min(v,p.y),g=Math.max(g,p.x),_=Math.max(_,p.y));if(t.st&&(0>f||0>v||g>1||_>1))for(var w=0;wD;++D){for(var M=0;a-1>M;++M){var O=P,R=O+a,L=R+1,N=O+1;T[A++]=O,T[A++]=R,T[A++]=N,T[A++]=N,T[A++]=R,T[A++]=L,++P}++P}return E.indices=T,t.st&&(E.attributes.st=new c({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:l})),E}function A(e,t,i,r,n){return e[t++]=r[i],e[t++]=r[i+1],e[t++]=r[i+2],e[t++]=n[i],e[t++]=n[i+1],e[t++]=n[i+2],e}function D(e,t,i,r){return e[t++]=r[i],e[t++]=r[i+1],e[t++]=r[i],e[t++]=r[i+1],e}function M(e){var t,r=e.vertexFormat,o=e.surfaceHeight,a=e.extrudedHeight,s=Math.min(a,o),l=Math.max(a,o),u=e.height,h=e.width,v=e.ellipsoid,g=P(e);if(f.equalsEpsilon(s,l,.1))return g;g=_.scaleToGeodeticHeight(g,l,v,!1);var y=new Float64Array(g.attributes.position.values),C=y.length,w=2*C,S=new Float64Array(w);S.set(y),g=_.scaleToGeodeticHeight(g,s,v);var E=g.attributes.position.values;S.set(E,C),g.attributes.position.values=S;var b,x=r.normal?new Float32Array(w):void 0,M=r.tangent?new Float32Array(w):void 0,I=r.binormal?new Float32Array(w):void 0,O=r.st?new Float32Array(2*(w/3)):void 0;if(r.normal){var R=g.attributes.normal.values;for(x.set(R),t=0;C>t;t++)R[t]=-R[t];x.set(R,C),g.attributes.normal.values=x}if(r.tangent){var L=g.attributes.tangent.values;for(M.set(L),t=0;C>t;t++)L[t]=-L[t];M.set(L,C),g.attributes.tangent.values=M}if(r.binormal){var N=g.attributes.binormal.values;I.set(N),I.set(N,C),g.attributes.binormal.values=I}r.st&&(b=g.attributes.st.values,O.set(b),O.set(b,2*(C/3)),g.attributes.st.values=O);var F=g.indices,B=F.length,z=C/3,U=m.createTypedArray(w/3,2*B);for(U.set(F),t=0;B>t;t+=3)U[t+B]=F[t+2]+z,U[t+1+B]=F[t+1]+z,U[t+2+B]=F[t]+z;g.indices=U;var W=2*h+2*u-4,G=2*(W+4),H=new Float64Array(3*G),q=r.st?new Float32Array(2*G):void 0,j=0,Y=0,X=h*u;for(t=0;X>t;t+=h)H=A(H,j,3*t,y,E),j+=6,r.st&&(q=D(q,Y,2*t,b),Y+=4);for(t=X-h;X>t;t++)H=A(H,j,3*t,y,E),j+=6,r.st&&(q=D(q,Y,2*t,b),Y+=4);for(t=X-1;t>0;t-=h)H=A(H,j,3*t,y,E),j+=6,r.st&&(q=D(q,Y,2*t,b),Y+=4);for(t=h-1;t>=0;t--)H=A(H,j,3*t,y,E),j+=6,r.st&&(q=D(q,Y,2*t,b),Y+=4);var Z=T(H,r,v);r.st&&(Z.attributes.st=new c({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:q}));var J,Q,K,$,et=m.createTypedArray(G,6*W);C=H.length/3;var tt=0;for(t=0;C-1>t;t+=2){J=t,$=(J+2)%C;var it=i.fromArray(H,3*J,k),rt=i.fromArray(H,3*$,V);i.equalsEpsilon(it,rt,f.EPSILON10)||(Q=(J+1)%C,K=(Q+2)%C,et[tt++]=J,et[tt++]=Q,et[tt++]=$,et[tt++]=$,et[tt++]=Q,et[tt++]=K)}return Z.indices=et,Z=p.combineInstances([new d({geometry:g}),new d({geometry:Z})]),Z[0]}var I=new i,O=new i,R=new i,L=new i,N=new w,F=new t,B=new e,z=new e,k=new i,V=new i,U=function(e){e=o(e,o.EMPTY_OBJECT);var t=e.rectangle,i=o(e.granularity,f.RADIANS_PER_DEGREE),r=o(e.ellipsoid,l.WGS84),n=o(e.height,0),s=o(e.rotation,0),u=o(e.stRotation,0),c=o(e.vertexFormat,E.DEFAULT),h=e.extrudedHeight,d=a(h)&&Math.abs(n-h)>1,p=o(e.closeTop,!0),m=o(e.closeBottom,!0);this._rectangle=t,this._granularity=i,this._ellipsoid=l.clone(r),this._surfaceHeight=n,this._rotation=s,this._stRotation=u,this._vertexFormat=E.clone(c),this._extrudedHeight=o(h,0),this._extrude=d,this._closeTop=p,this._closeBottom=m,this._workerName="createRectangleGeometry"};U.packedLength=w.packedLength+l.packedLength+E.packedLength+8,U.pack=function(e,t,i){i=o(i,0),w.pack(e._rectangle,t,i),i+=w.packedLength,l.pack(e._ellipsoid,t,i),i+=l.packedLength,E.pack(e._vertexFormat,t,i),i+=E.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._stRotation,t[i++]=e._extrudedHeight,t[i++]=e._extrude?1:0,t[i++]=e._closeTop?1:0,t[i]=e._closeBottom?1:0};var W=new w,G=l.clone(l.UNIT_SPHERE),H=new E,q={rectangle:W,ellipsoid:G,vertexFormat:H,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,closeTop:void 0,closeBottom:void 0};U.unpack=function(e,t,i){t=o(t,0);var r=w.unpack(e,t,W);t+=w.packedLength;var n=l.unpack(e,t,G);t+=l.packedLength;var s=E.unpack(e,t,H);t+=E.packedLength;var u=e[t++],c=e[t++],h=e[t++],d=e[t++],p=e[t++],m=1===e[t++],f=1===e[t++],v=1===e[t];return a(i)?(i._rectangle=w.clone(r,i._rectangle),i._ellipsoid=l.clone(n,i._ellipsoid),i._vertexFormat=E.clone(s,i._vertexFormat),i._granularity=u,i._surfaceHeight=c,i._rotation=h,i._stRotation=d,i._extrudedHeight=m?p:void 0,i._extrude=m,i._closeTop=f,i._closeBottom=v,i):(q.granularity=u,q.height=c,q.rotation=h,q.stRotation=d,q.extrudedHeight=m?p:void 0,q.closeTop=f,q.closeBottom=v,new U(q))};var j=new v,Y=new g,X=new r,Z=new C,J=new r;return U.createGeometry=function(t){var r=w.clone(t._rectangle,N),n=t._ellipsoid,o=t._surfaceHeight,s=t._extrude,l=t._extrudedHeight,c=t._stRotation,d=t._vertexFormat,p=S.computeOptions(t,r,X),m=j,f=Y;if(a(c)){v.fromRotation(-c,m);var y=w.center(r,J),E=n.cartographicToCartesian(y,k);i.normalize(E,E),C.fromAxisAngle(E,-c,Z),g.fromQuaternion(Z,f)}else v.clone(v.IDENTITY,m),g.clone(g.IDENTITY,f);p.lonScalar=1/r.width,p.latScalar=1/r.height,p.vertexFormat=d,p.textureMatrix=m,p.tangentRotationMatrix=f,p.size=p.width*p.height;var b,x;if(r=t._rectangle,s){b=M(p);var T=e.fromRectangle3D(r,n,o,z),A=e.fromRectangle3D(r,n,l,B);x=e.union(T,A)}else b=P(p),b=_.scaleToGeodeticHeight(b,o,n,!1),x=e.fromRectangle3D(r,n,o);return d.position||delete b.attributes.position,new u({attributes:new h(b.attributes),indices:b.indices,primitiveType:b.primitiveType,boundingSphere:x})},U}),i("Core/RectangleOutlineGeometry",["./BoundingSphere","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolygonPipeline","./PrimitiveType","./Rectangle","./RectangleGeometryLibrary"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";function g(e){var t,i=e.size,n=e.height,o=e.width,a=new Float64Array(3*i),s=0,d=0,p=w;for(t=0;o>t;t++)v.computePosition(e,d,t,p),a[s++]=p.x,a[s++]=p.y,a[s++]=p.z;for(t=o-1,d=1;n>d;d++)v.computePosition(e,d,t,p),a[s++]=p.x,a[s++]=p.y,a[s++]=p.z;for(d=n-1,t=o-2;t>=0;t--)v.computePosition(e,d,t,p),a[s++]=p.x,a[s++]=p.y,a[s++]=p.z;for(t=0,d=n-2;d>0;d--)v.computePosition(e,d,t,p),a[s++]=p.x,a[s++]=p.y,a[s++]=p.z;for(var f=2*(a.length/3),g=h.createTypedArray(a.length/3,f),_=0,y=0;yC;C++)_[y++]=C,_[y++]=C+1,_[y++]=C+c,_[y++]=C+c+1;return _[y++]=c-1,_[y++]=0,_[y++]=c+c-1,_[y++]=c,_[y++]=0,_[y++]=c,_[y++]=l-1,_[y++]=c+l-1,_[y++]=l+s-2,_[y++]=l+s-2+c,_[y++]=2*l+s-3,_[y++]=2*l+s-3+c,a.indices=_,a}var y=new e,C=new e,w=new t,S=new f,E=function(e){e=n(e,n.EMPTY_OBJECT);var t=e.rectangle,i=n(e.granularity,d.RADIANS_PER_DEGREE),r=n(e.ellipsoid,s.WGS84),o=n(e.height,0),a=n(e.rotation,0),l=e.extrudedHeight;this._rectangle=t,this._granularity=i,this._ellipsoid=r,this._surfaceHeight=o,this._rotation=a,this._extrudedHeight=l,this._workerName="createRectangleOutlineGeometry"};E.packedLength=f.packedLength+s.packedLength+5,E.pack=function(e,t,i){i=n(i,0),f.pack(e._rectangle,t,i),i+=f.packedLength,s.pack(e._ellipsoid,t,i),i+=s.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=o(e._extrudedHeight)?1:0,t[i]=n(e._extrudedHeight,0)};var b=new f,x=s.clone(s.UNIT_SPHERE),T={rectangle:b,ellipsoid:x,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0};E.unpack=function(e,t,i){t=n(t,0);var r=f.unpack(e,t,b);t+=f.packedLength;var a=s.unpack(e,t,x);t+=s.packedLength;var l=e[t++],u=e[t++],c=e[t++],h=e[t++],d=e[t];return o(i)?(i._rectangle=f.clone(r,i._rectangle),i._ellipsoid=s.clone(a,i._ellipsoid),i._surfaceHeight=u,i._rotation=c,i._extrudedHeight=h?d:void 0,i):(T.granularity=l,T.height=u,T.rotation=c,T.extrudedHeight=h?d:void 0,new E(T))};var P=new i;return E.createGeometry=function(t){var i=f.clone(t._rectangle,S),r=t._ellipsoid,n=t._surfaceHeight,a=t._extrudedHeight,s=v.computeOptions(t,i,P);s.size=2*s.width+2*s.height-4;var u,c;if(i=t._rectangle,o(a)){u=_(s);var h=e.fromRectangle3D(i,r,n,C),d=e.fromRectangle3D(i,r,a,y);c=e.union(h,d)}else u=g(s),u=p.scaleToGeodeticHeight(u,n,r,!1),c=e.fromRectangle3D(i,r,n);return new l({attributes:u.attributes,indices:u.indices,primitiveType:m.LINES,boundingSphere:c})},E}),i("Core/ReferenceFrame",["./freezeObject"],function(e){"use strict";var t={FIXED:0,INERTIAL:1};return e(t)}),i("Core/ScreenSpaceEventType",["./freezeObject"],function(e){"use strict";var t={LEFT_DOWN:0,LEFT_UP:1,LEFT_CLICK:2,LEFT_DOUBLE_CLICK:3,RIGHT_DOWN:5,RIGHT_UP:6,RIGHT_CLICK:7,RIGHT_DOUBLE_CLICK:8,MIDDLE_DOWN:10,MIDDLE_UP:11,MIDDLE_CLICK:12,MIDDLE_DOUBLE_CLICK:13,MOUSE_MOVE:15,WHEEL:16,PINCH_START:17,PINCH_END:18,PINCH_MOVE:19};return e(t)}),i("Core/ScreenSpaceEventHandler",["./AssociativeArray","./Cartesian2","./defaultValue","./defined","./destroyObject","./DeveloperError","./FeatureDetection","./KeyboardEventModifier","./ScreenSpaceEventType"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(e,t,i){var r=e._element;if(r===document)return i.x=t.clientX,i.y=t.clientY,i;var n=r.getBoundingClientRect();return i.x=t.clientX-n.left,i.y=t.clientY-n.top,i}function c(e,t){var i=e;return r(t)&&(i+="+"+t),i}function h(e){return e.shiftKey?s.SHIFT:e.ctrlKey?s.CTRL:e.altKey?s.ALT:void 0}function d(e,t,i,r){var n=function(t){r(e,t)};i.addEventListener(t,n,!1),e._removalFunctions.push(function(){i.removeEventListener(t,n,!1)})}function p(e){var t=e._element,i=r(t.disableRootEvents)?t:document;a.supportsPointerEvents()?(d(e,"pointerdown",t,x),d(e,"pointerup",t,T),d(e,"pointermove",t,P)):(d(e,"mousedown",t,f),d(e,"mouseup",i,v),d(e,"mousemove",i,g),d(e,"touchstart",t,C),d(e,"touchend",i,w),d(e,"touchmove",i,E)),d(e,"dblclick",t,_);var n;n="onwheel"in t?"wheel":r(document.onmousewheel)?"mousewheel":"DOMMouseScroll",d(e,n,t,y)}function m(e){for(var t=e._removalFunctions,i=0;i0?-120*t.detail:t.wheelDelta;if(r(i)){var o=h(t),a=e.getInputAction(l.WHEEL,o);r(a)&&(a(i),t.preventDefault())}}function C(e,i){e._seenAnyTouchEvents=!0;var r,n,o,a=i.changedTouches,s=a.length,l=e._positions;for(r=0;s>r;++r)n=a[r],o=n.identifier,l.set(o,u(e,n,new t));S(e,i);var c=e._previousPositions;for(r=0;s>r;++r)n=a[r],o=n.identifier,c.set(o,t.clone(l.get(o)))}function w(e,t){e._seenAnyTouchEvents=!0;var i,r,n,o=t.changedTouches,a=o.length,s=e._positions;for(i=0;a>i;++i)r=o[i],n=r.identifier,s.remove(n);S(e,t);var l=e._previousPositions;for(i=0;a>i;++i)r=o[i],n=r.identifier,l.remove(n)}function S(e,i){var n,o,a=h(i),s=e._positions,u=e._previousPositions,c=s.length;if(1!==c&&e._buttonDown===A.LEFT&&(e._buttonDown=void 0,n=e.getInputAction(l.LEFT_UP,a),r(n)&&(t.clone(e._primaryPosition,F.position),n(F)),0===c&&(o=e.getInputAction(l.LEFT_CLICK,a),r(o)))){var d=e._primaryStartPosition,p=u.values[0],m=d.x-p.x,f=d.y-p.y,v=Math.sqrt(m*m+f*f);vn;++n){o=s[n],a=o.identifier;var h=c.get(a);r(h)&&u(e,o,h)}b(e,i);var d=e._previousPositions;for(n=0;l>n;++n)o=s[n],a=o.identifier,t.clone(c.get(a),d.get(a))}function b(e,i){var n,o=h(i),a=e._positions,s=e._previousPositions,u=a.length;if(1===u&&e._buttonDown===A.LEFT){var c=a.values[0];t.clone(c,e._primaryPosition);var d=e._primaryPreviousPosition;n=e.getInputAction(l.MOUSE_MOVE,o),r(n)&&(t.clone(d,z.startPosition),t.clone(c,z.endPosition),n(z)),t.clone(c,d),i.preventDefault()}else if(2===u&&e._isPinching&&(n=e.getInputAction(l.PINCH_MOVE,o),r(n))){var p=a.values[0],m=a.values[1],f=s.values[0],v=s.values[1],g=m.x-p.x,_=m.y-p.y,y=.25*Math.sqrt(g*g+_*_),C=v.x-f.x,w=v.y-f.y,S=.25*Math.sqrt(C*C+w*w),E=.125*(m.y+p.y),b=.125*(v.y+f.y),x=Math.atan2(_,g),T=Math.atan2(w,C);t.fromElements(0,S,k.distance.startPosition),t.fromElements(0,y,k.distance.endPosition),t.fromElements(T,b,k.angleAndHeight.startPosition),t.fromElements(x,E,k.angleAndHeight.endPosition),n(k)}}function x(e,i){if(i.target.setPointerCapture(i.pointerId),"touch"===i.pointerType){var r=e._positions,n=i.pointerId;r.set(n,u(e,i,new t)),S(e,i);var o=e._previousPositions;o.set(n,t.clone(r.get(n)))}else f(e,i)}function T(e,t){if("touch"===t.pointerType){var i=e._positions,r=t.pointerId;i.remove(r),S(e,t);var n=e._previousPositions;n.remove(r)}else v(e,t)}function P(e,i){if("touch"===i.pointerType){var r=e._positions,n=i.pointerId;u(e,i,r.get(n)),b(e,i);var o=e._previousPositions;t.clone(r.get(n),o.get(n))}else g(e,i)}var A={LEFT:0,MIDDLE:1,RIGHT:2},D={position:new t},M={position:new t},I={position:new t},O={startPosition:new t,endPosition:new t},R={position:new t},L={position:new t},N={position1:new t,position2:new t},F={position:new t},B={position:new t},z={startPosition:new t,endPosition:new t},k={distance:{startPosition:new t,endPosition:new t},angleAndHeight:{startPosition:new t,endPosition:new t}},V=function(r){this._inputEvents={},this._buttonDown=void 0,this._isPinching=!1,this._seenAnyTouchEvents=!1,this._primaryStartPosition=new t,this._primaryPosition=new t,this._primaryPreviousPosition=new t,this._positions=new e,this._previousPositions=new e,this._removalFunctions=[],this._clickPixelTolerance=5,this._element=i(r,document),p(this)};return V.prototype.setInputAction=function(e,t,i){var r=c(t,i);this._inputEvents[r]=e},V.prototype.getInputAction=function(e,t){var i=c(e,t);return this._inputEvents[i]},V.prototype.removeInputAction=function(e,t){var i=c(e,t);delete this._inputEvents[i]},V.prototype.isDestroyed=function(){return!1},V.prototype.destroy=function(){return m(this),n(this)},V}),i("Core/ShowGeometryInstanceAttribute",["./ComponentDatatype","./defaultValue","./defined","./defineProperties","./DeveloperError"],function(e,t,i,r){"use strict";var n=function(e){e=t(e,!0),this.value=n.toValue(e)};return r(n.prototype,{componentDatatype:{get:function(){return e.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!0}}}),n.toValue=function(e,t){return i(t)?(t[0]=e,t):new Uint8Array([e])},n}),i("Core/Simon1994PlanetaryPositions",["./Cartesian3","./defined","./DeveloperError","./JulianDate","./Math","./Matrix3","./TimeConstants","./TimeStandard"],function(e,t,i,r,n,o,a,s){"use strict";function l(e){var t=6.239996+.0172019696544*e;return.001657*Math.sin(t+.01671*Math.sin(t))}function u(e,t){t=r.addSeconds(e,C,t);var i=r.totalDays(t)-w;return t=r.addSeconds(t,l(i),t)}function c(r,a,s,l,u,c,p,m){if(0>s&&(s=-s,u+=n.PI),0>s||s>n.PI)throw new i("The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians.");var v=r*(1-a),g=l-u,_=u,y=d(c-l,a),C=h(a,0);if("Hyperbolic"===C&&Math.abs(n.negativePiToPi(y))>=Math.acos(-1/a))throw new i("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");f(g,s,_,D);var w=v*(1+a),S=Math.cos(y),E=Math.sin(y),b=1+a*S;if(b<=n.Epsilon10)throw new i("elements cannot be converted to cartesian");var x=w/b;return t(m)?(m.x=x*S,m.y=x*E,m.z=0):m=new e(x*S,x*E,0),o.multiplyByVector(D,m,m)}function h(e,t){if(0>e)throw new i("eccentricity cannot be negative.");return t>=e?"Circular":1-t>e?"Elliptical":1+t>=e?"Parabolic":"Hyperbolic"}function d(e,t){if(0>t||t>=1)throw new i("eccentricity out of range.");var r=p(e,t);return m(r,t)}function p(e,t){if(0>t||t>=1)throw new i("eccentricity out of range.");var r=Math.floor(e/n.TWO_PI);e-=r*n.TWO_PI;var o,a=e+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),s=Number.MAX_VALUE;for(o=0;M>o&&Math.abs(s-a)>I;++o){s=a;var l=s-t*Math.sin(s)-e,u=1-t*Math.cos(s);a=s-l/u}if(o>=M)throw new i("Kepler equation did not converge");return s=a+r*n.TWO_PI}function m(e,t){if(0>t||t>=1)throw new i("eccentricity out of range.");var r=Math.floor(e/n.TWO_PI);e-=r*n.TWO_PI;var o=Math.cos(e)-t,a=Math.sin(e)*Math.sqrt(1-t*t),s=Math.atan2(a,o);return s=n.zeroToTwoPi(s),0>e&&(s-=n.TWO_PI),s+=r*n.TWO_PI}function f(e,r,a,s){if(0>r||r>n.PI)throw new i("inclination out of range");var l=Math.cos(e),u=Math.sin(e),c=Math.cos(r),h=Math.sin(r),d=Math.cos(a),p=Math.sin(a);return t(s)?(s[0]=d*l-p*u*c,s[1]=p*l+d*u*c,s[2]=u*h,s[3]=-d*u-p*l*c,s[4]=-p*u+d*l*c,s[5]=l*h,s[6]=p*h,s[7]=-d*h,s[8]=c):s=new o(d*l-p*u*c,-d*u-p*l*c,p*h,p*l+d*u*c,-p*u+d*l*c,-d*h,u*h,l*h,c),s}function v(e,t){u(e,Dt);var i=Dt.dayNumber-S.dayNumber+(Dt.secondsOfDay-S.secondsOfDay)/a.SECONDS_PER_DAY,r=i/(10*a.DAYS_PER_JULIAN_CENTURY),n=.3595362*r,o=O+G*Math.cos(N*n)+Q*Math.sin(N*n)+H*Math.cos(F*n)+K*Math.sin(F*n)+q*Math.cos(B*n)+$*Math.sin(B*n)+j*Math.cos(z*n)+et*Math.sin(z*n)+Y*Math.cos(k*n)+tt*Math.sin(k*n)+X*Math.cos(V*n)+it*Math.sin(V*n)+Z*Math.cos(U*n)+rt*Math.sin(U*n)+J*Math.cos(W*n)+nt*Math.sin(W*n),s=R+L*r+pt*Math.cos(ot*n)+wt*Math.sin(ot*n)+mt*Math.cos(at*n)+St*Math.sin(at*n)+ft*Math.cos(st*n)+Et*Math.sin(st*n)+vt*Math.cos(lt*n)+bt*Math.sin(lt*n)+gt*Math.cos(ut*n)+xt*Math.sin(ut*n)+_t*Math.cos(ct*n)+Tt*Math.sin(ct*n)+yt*Math.cos(ht*n)+Pt*Math.sin(ht*n)+Ct*Math.cos(dt*n)+At*Math.sin(dt*n),l=.0167086342-.0004203654*r,h=102.93734808*T+11612.3529*P*r,d=469.97289*P*r,p=174.87317577*T-8679.27034*P*r;return c(o,l,d,h,p,s,b,t)}function g(e,t){u(e,Dt);var i=Dt.dayNumber-S.dayNumber+(Dt.secondsOfDay-S.secondsOfDay)/a.SECONDS_PER_DAY,r=i/a.DAYS_PER_JULIAN_CENTURY,n=r*r,o=n*r,s=o*r,l=383397.7725+.004*r,h=.055545526-1.6e-8*r,d=5.15668983*T,p=-8e-5*r+.02966*n-42e-6*o-1.3e-7*s,m=83.35324312*T,f=14643420.2669*r-38.2702*n-.045047*o+21301e-8*s,v=125.04455501*T,g=-6967919.3631*r+6.3602*n+.007625*o-3586e-8*s,_=218.31664563*T,y=1732559343.4847*r-6.391*n+.006588*o-3169e-8*s,C=297.85019547*T+P*(1602961601.209*r-6.3706*n+.006593*o-3169e-8*s),w=93.27209062*T+P*(1739527262.8478*r-12.7512*n-.001037*o+417e-8*s),b=134.96340251*T+P*(1717915923.2178*r+31.8792*n+.051635*o-2447e-7*s),A=357.52910918*T+P*(129596581.0481*r-.5532*n+136e-6*o-1149e-8*s),D=310.17137918*T-P*(6967051.436*r+6.2068*n+.007618*o-3219e-8*s),M=2*C,I=4*C,O=6*C,R=2*b,L=3*b,N=4*b,F=2*w;l+=3400.4*Math.cos(M)-635.6*Math.cos(M-b)-235.6*Math.cos(b)+218.1*Math.cos(M-A)+181*Math.cos(M+b),h+=.014216*Math.cos(M-b)+.008551*Math.cos(M-R)-.001383*Math.cos(b)+.001356*Math.cos(M+b)-.001147*Math.cos(I-L)-914e-6*Math.cos(I-R)+869e-6*Math.cos(M-A-b)-627e-6*Math.cos(M)-394e-6*Math.cos(I-N)+282e-6*Math.cos(M-A-R)-279e-6*Math.cos(C-b)-236e-6*Math.cos(R)+231e-6*Math.cos(I)+229e-6*Math.cos(O-N)-201e-6*Math.cos(R-F),p+=486.26*Math.cos(M-F)-40.13*Math.cos(M)+37.51*Math.cos(F)+25.73*Math.cos(R-F)+19.97*Math.cos(M-A-F),f+=-55609*Math.sin(M-b)-34711*Math.sin(M-R)-9792*Math.sin(b)+9385*Math.sin(I-L)+7505*Math.sin(I-R)+5318*Math.sin(M+b)+3484*Math.sin(I-N)-3417*Math.sin(M-A-b)-2530*Math.sin(O-N)-2376*Math.sin(M)-2075*Math.sin(M-L)-1883*Math.sin(R)-1736*Math.sin(O-5*b)+1626*Math.sin(A)-1370*Math.sin(O-L),g+=-5392*Math.sin(M-F)-540*Math.sin(A)-441*Math.sin(M)+423*Math.sin(F)-288*Math.sin(R-F),y+=-3332.9*Math.sin(M)+1197.4*Math.sin(M-b)-662.5*Math.sin(A)+396.3*Math.sin(b)-218*Math.sin(M-A);var B=2*D,z=3*D;p+=46.997*Math.cos(D)*r-.614*Math.cos(M-F+D)*r+.614*Math.cos(M-F-D)*r-.0297*Math.cos(B)*n-.0335*Math.cos(D)*n+.0012*Math.cos(M-F+B)*n-16e-5*Math.cos(D)*o+4e-5*Math.cos(z)*o+4e-5*Math.cos(B)*o;var k=2.116*Math.sin(D)*r-.111*Math.sin(M-F-D)*r-.0015*Math.sin(D)*n;f+=k,y+=k,g+=-520.77*Math.sin(D)*r+13.66*Math.sin(M-F+D)*r+1.12*Math.sin(M-D)*r-1.06*Math.sin(F-D)*r+.66*Math.sin(B)*n+.371*Math.sin(D)*n-.035*Math.sin(M-F+B)*n-.015*Math.sin(M-F+D)*n+.0014*Math.sin(D)*o-.0011*Math.sin(z)*o-9e-4*Math.sin(B)*o,l*=x;var V=d+p*P,U=m+f*P,W=_+y*P,G=v+g*P;return c(l,h,V,U,G,W,E,t)}function _(t,i){return i=g(t,i),e.multiplyByScalar(i,It,i)}var y={},C=32.184,w=2451545,S=new r(2451545,0,s.TAI),E=398600435e6,b=328900.56*1.012300034*E,x=1e3,T=n.RADIANS_PER_DEGREE,P=n.RADIANS_PER_ARCSECOND,A=14959787e4,D=new o,M=50,I=n.EPSILON8,O=1.0000010178*A,R=100.46645683*T,L=1295977422.83429*P,N=16002,F=21863,B=32004,z=10931,k=14529,V=16368,U=15318,W=32794,G=64e-7*A,H=-152*1e-7*A,q=62e-7*A,j=-8e-7*A,Y=32e-7*A,X=-41*1e-7*A,Z=19e-7*A,J=-11*1e-7*A,Q=-150*1e-7*A,K=-46*1e-7*A,$=68*1e-7*A,et=54e-7*A,tt=14e-7*A,it=24e-7*A,rt=-28*1e-7*A,nt=22e-7*A,ot=10,at=16002,st=21863,lt=10931,ut=1473,ct=32004,ht=4387,dt=73,pt=-325*1e-7,mt=-322*1e-7,ft=-79*1e-7,vt=232*1e-7,gt=-52*1e-7,_t=97e-7,yt=55e-7,Ct=-41*1e-7,wt=-105*1e-7,St=-137*1e-7,Et=258e-7,bt=35e-7,xt=-116*1e-7,Tt=-88*1e-7,Pt=-112*1e-7,At=-80*1e-7,Dt=new r(0,0,s.TAI),Mt=.012300034,It=-1*(Mt/(Mt+1)),Ot=new o(1.0000000000000002,5.619723173785822e-16,4.690511510146299e-19,-5.154129427414611e-16,.9174820620691819,-.39777715593191376,-2.23970096136568e-16,.39777715593191376,.9174820620691819),Rt=new e; -return y.computeSunPositionInEarthInertialFrame=function(i,n){return t(i)||(i=r.now()),t(n)||(n=new e),Rt=v(i,Rt),n=e.negate(Rt,n),_(i,Rt),e.subtract(n,Rt,n),o.multiplyByVector(Ot,n,n),n},y.computeMoonPositionInEarthInertialFrame=function(e,i){return t(e)||(e=r.now()),i=g(e,i),o.multiplyByVector(Ot,i,i),i},y}),i("Core/SimplePolylineGeometry",["./BoundingSphere","./Cartesian3","./Color","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolylinePipeline","./PrimitiveType"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";function f(e,t,r,n,o,a,s){var l,u=p.numberOfPoints(e,t,o),c=r.red,h=r.green,d=r.blue,m=r.alpha,f=n.red,v=n.green,g=n.blue,_=n.alpha;if(i.equals(r,n)){for(l=0;u>l;l++)a[s++]=i.floatToByte(c),a[s++]=i.floatToByte(h),a[s++]=i.floatToByte(d),a[s++]=i.floatToByte(m);return s}var y=(f-c)/u,C=(v-h)/u,w=(g-d)/u,S=(_-m)/u,E=s;for(l=0;u>l;l++)a[E++]=i.floatToByte(c+l*y),a[E++]=i.floatToByte(h+l*C),a[E++]=i.floatToByte(d+l*w),a[E++]=i.floatToByte(m+l*S);return E}var v=function(e){e=n(e,n.EMPTY_OBJECT);var r=e.positions,a=e.colors,l=n(e.colorsPerVertex,!1);this._positions=r,this._colors=a,this._colorsPerVertex=l,this._followSurface=n(e.followSurface,!0),this._granularity=n(e.granularity,d.RADIANS_PER_DEGREE),this._ellipsoid=n(e.ellipsoid,s.WGS84),this._workerName="createSimplePolylineGeometry";var u=1+r.length*t.packedLength;u+=o(a)?1+a.length*i.packedLength:1,this.packedLength=u+s.packedLength+3};v.pack=function(e,r,a){a=n(a,0);var l,u=e._positions,c=u.length;for(r[a++]=c,l=0;c>l;++l,a+=t.packedLength)t.pack(u[l],r,a);var h=e._colors;for(c=o(h)?h.length:0,r[a++]=c,l=0;c>l;++l,a+=i.packedLength)i.pack(h[l],r,a);s.pack(e._ellipsoid,r,a),a+=s.packedLength,r[a++]=e._colorsPerVertex?1:0,r[a++]=e._followSurface?1:0,r[a]=e._granularity},v.unpack=function(e,r,a){r=n(r,0);var l,u=e[r++],c=new Array(u);for(l=0;u>l;++l,r+=t.packedLength)c[l]=t.unpack(e,r);u=e[r++];var h=u>0?new Array(u):void 0;for(l=0;u>l;++l,r+=i.packedLength)h[l]=i.unpack(e,r);var d=s.unpack(e,r);r+=s.packedLength;var p=1===e[r++],m=1===e[r++],f=e[r];return o(a)?(a._positions=c,a._colors=h,a._ellipsoid=d,a._colorsPerVertex=p,a._followSurface=m,a._granularity=f,a):new v({positions:c,colors:h,ellipsoid:d,colorsPerVertex:p,followSurface:m,granularity:f})};var g=new Array(2),_=new Array(2),y={positions:g,height:_,ellipsoid:void 0,minDistance:void 0};return v.createGeometry=function(n){var a,s,v,C,w,S=n._positions,E=n._colors,b=n._colorsPerVertex,x=n._followSurface,T=n._granularity,P=n._ellipsoid,A=d.chordLength(T,P.maximumRadius),D=o(E)&&!b,M=S.length,I=0;if(x){var O=p.extractHeights(S,P),R=y;if(R.minDistance=A,R.ellipsoid=P,D){var L=0;for(a=0;M-1>a;a++)L+=p.numberOfPoints(S[a],S[a+1],A)+1;s=new Float64Array(3*L),C=new Uint8Array(4*L),R.positions=g,R.height=_;var N=0;for(a=0;M-1>a;++a){g[0]=S[a],g[1]=S[a+1],_[0]=O[a],_[1]=O[a+1];var F=p.generateArc(R);if(o(E)){var B=F.length/3;w=E[a];for(var z=0;B>z;++z)C[N++]=i.floatToByte(w.red),C[N++]=i.floatToByte(w.green),C[N++]=i.floatToByte(w.blue),C[N++]=i.floatToByte(w.alpha)}s.set(F,I),I+=F.length}}else if(R.positions=S,R.height=O,s=new Float64Array(p.generateArc(R)),o(E)){for(C=new Uint8Array(4*(s.length/3)),a=0;M-1>a;++a){var k=S[a],V=S[a+1],U=E[a],W=E[a+1];I=f(k,V,U,W,A,C,I)}var G=E[M-1];C[I++]=i.floatToByte(G.red),C[I++]=i.floatToByte(G.green),C[I++]=i.floatToByte(G.blue),C[I++]=i.floatToByte(G.alpha)}}else{v=D?2*M-2:M,s=new Float64Array(3*v),C=o(E)?new Uint8Array(4*v):void 0;var H=0,q=0;for(a=0;M>a;++a){var j=S[a];if(D&&a>0&&(t.pack(j,s,H),H+=3,w=E[a-1],C[q++]=i.floatToByte(w.red),C[q++]=i.floatToByte(w.green),C[q++]=i.floatToByte(w.blue),C[q++]=i.floatToByte(w.alpha)),D&&a===M-1)break;t.pack(j,s,H),H+=3,o(E)&&(w=E[a],C[q++]=i.floatToByte(w.red),C[q++]=i.floatToByte(w.green),C[q++]=i.floatToByte(w.blue),C[q++]=i.floatToByte(w.alpha))}}var Y=new c;Y.position=new u({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:s}),o(E)&&(Y.color=new u({componentDatatype:r.UNSIGNED_BYTE,componentsPerAttribute:4,values:C,normalize:!0})),v=s.length/3;var X=2*(v-1),Z=h.createTypedArray(v,X),J=0;for(a=0;v-1>a;++a)Z[J++]=a,Z[J++]=a+1;return new l({attributes:Y,indices:Z,primitiveType:m.LINES,boundingSphere:e.fromPoints(S)})},v}),i("Core/SphereGeometry",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./EllipsoidGeometry","./VertexFormat"],function(e,t,i,r,n,o){"use strict";var a=function(i){var r=t(i.radius,1),o=new e(r,r,r),a={radii:o,stackPartitions:i.stackPartitions,slicePartitions:i.slicePartitions,vertexFormat:i.vertexFormat};this._ellipsoidGeometry=new n(a),this._workerName="createSphereGeometry"};a.packedLength=n.packedLength,a.pack=function(e,t,i){n.pack(e._ellipsoidGeometry,t,i)};var s=new n,l={radius:void 0,radii:new e,vertexFormat:new o,stackPartitions:void 0,slicePartitions:void 0};return a.unpack=function(t,r,u){var c=n.unpack(t,r,s);return l.vertexFormat=o.clone(c._vertexFormat,l.vertexFormat),l.stackPartitions=c._stackPartitions,l.slicePartitions=c._slicePartitions,i(u)?(e.clone(c._radii,l.radii),u._ellipsoidGeometry=new n(l),u):(l.radius=c._radii.x,new a(l))},a.createGeometry=function(e){return n.createGeometry(e._ellipsoidGeometry)},a}),i("Core/SphereOutlineGeometry",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./EllipsoidOutlineGeometry"],function(e,t,i,r,n){"use strict";var o=function(i){var r=t(i.radius,1),o=new e(r,r,r),a={radii:o,stackPartitions:i.stackPartitions,slicePartitions:i.slicePartitions,subdivisions:i.subdivisions};this._ellipsoidGeometry=new n(a),this._workerName="createSphereOutlineGeometry"};o.packedLength=n.packedLength,o.pack=function(e,t,i){n.pack(e._ellipsoidGeometry,t,i)};var a=new n,s={radius:void 0,radii:new e,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};return o.unpack=function(t,r,l){var u=n.unpack(t,r,a);return s.stackPartitions=u._stackPartitions,s.slicePartitions=u._slicePartitions,s.subdivisions=u._subdivisions,i(l)?(e.clone(u._radii,s.radii),l._ellipsoidGeometry=new n(s),l):(s.radius=u._radii.x,new o(s))},o.createGeometry=function(e){return n.createGeometry(e._ellipsoidGeometry)},o}),i("Core/Spherical",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var i=function(t,i,r){this.clock=e(t,0),this.cone=e(i,0),this.magnitude=e(r,1)};return i.fromCartesian3=function(e,r){var n=e.x,o=e.y,a=e.z,s=n*n+o*o;return t(r)||(r=new i),r.clock=Math.atan2(o,n),r.cone=Math.atan2(Math.sqrt(s),a),r.magnitude=Math.sqrt(s+a*a),r},i.clone=function(e,r){return t(e)?t(r)?(r.clock=e.clock,r.cone=e.cone,r.magnitude=e.magnitude,r):new i(e.clock,e.cone,e.magnitude):void 0},i.normalize=function(e,r){return t(r)?(r.clock=e.clock,r.cone=e.cone,r.magnitude=1,r):new i(e.clock,e.cone,1)},i.equals=function(e,i){return e===i||t(e)&&t(i)&&e.clock===i.clock&&e.cone===i.cone&&e.magnitude===i.magnitude},i.equalsEpsilon=function(i,r,n){return n=e(n,0),i===r||t(i)&&t(r)&&Math.abs(i.clock-r.clock)<=n&&Math.abs(i.cone-r.cone)<=n&&Math.abs(i.magnitude-r.magnitude)<=n},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.clock+", "+this.cone+", "+this.magnitude+")"},i}),i("Core/TerrainData",["./defineProperties","./DeveloperError"],function(e,t){"use strict";var i=function(){t.throwInstantiationError()};return e(i.prototype,{waterMask:{get:t.throwInstantiationError}}),i.prototype.interpolateHeight=t.throwInstantiationError,i.prototype.isChildAvailable=t.throwInstantiationError,i.prototype.createMesh=t.throwInstantiationError,i.prototype.upsample=t.throwInstantiationError,i.prototype.wasCreatedByUpsampling=t.throwInstantiationError,i}),i("Core/TilingScheme",["./defineProperties","./DeveloperError"],function(e,t){"use strict";var i=function(){throw new t("This type should not be instantiated directly. Instead, use WebMercatorTilingScheme or GeographicTilingScheme.")};return e(i.prototype,{ellipsoid:{get:t.throwInstantiationError},rectangle:{get:t.throwInstantiationError},projection:{get:t.throwInstantiationError}}),i.prototype.getNumberOfXTilesAtLevel=t.throwInstantiationError,i.prototype.getNumberOfYTilesAtLevel=t.throwInstantiationError,i.prototype.rectangleToNativeRectangle=t.throwInstantiationError,i.prototype.tileXYToNativeRectangle=t.throwInstantiationError,i.prototype.tileXYToRectangle=t.throwInstantiationError,i.prototype.positionToTileXY=t.throwInstantiationError,i}),i("Core/TimeIntervalCollection",["./binarySearch","./defaultValue","./defined","./defineProperties","./DeveloperError","./Event","./JulianDate","./TimeInterval"],function(e,t,i,r,n,o,a,s){"use strict";function l(e,t){return a.compare(e.start,t.start)}var u=function(e){if(this._intervals=[],this._changedEvent=new o,i(e))for(var t=e.length,r=0;t>r;r++)this.addInterval(e[r])};r(u.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){var e=this._intervals;return 0===e.length?void 0:e[0].start}},isStartIncluded:{get:function(){var e=this._intervals;return 0===e.length?!1:e[0].isStartIncluded}},stop:{get:function(){var e=this._intervals,t=e.length;return 0===t?void 0:e[t-1].stop}},isStopIncluded:{get:function(){var e=this._intervals,t=e.length;return 0===t?!1:e[t-1].isStopIncluded}},length:{get:function(){return this._intervals.length}},isEmpty:{get:function(){return 0===this._intervals.length}}}),u.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof u))return!1;var i=this._intervals,r=e._intervals,n=i.length;if(n!==r.length)return!1;for(var o=0;n>o;o++)if(!s.equals(i[o],r[o],t))return!1;return!0},u.prototype.get=function(e){return this._intervals[e]},u.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))},u.prototype.findIntervalContainingDate=function(e){var t=this.indexOf(e);return t>=0?this._intervals[t]:void 0},u.prototype.findDataForIntervalContainingDate=function(e){var t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0},u.prototype.contains=function(e){return this.indexOf(e)>=0};var c=new s;return u.prototype.indexOf=function(t){var i=this._intervals;c.start=t,c.stop=t;var r=e(i,c,l);return r>=0?i[r].isStartIncluded?r:r>0&&i[r-1].stop.equals(t)&&i[r-1].isStopIncluded?r-1:~r:(r=~r,r>0&&r-1l;l++){var c=s[l];if(!(i(r)&&!c.start.equals(r)||i(n)&&!c.stop.equals(n)||i(o)&&c.isStartIncluded!==o||i(a)&&c.isStopIncluded!==a))return s[l]}return void 0},u.prototype.addInterval=function(t,r){if(!t.isEmpty){var n,o,u=this._intervals;if(0===u.length||a.greaterThan(t.start,u[u.length-1].stop))return u.push(t),this._changedEvent.raiseEvent(this),void 0;for(o=e(u,t,l),0>o?o=~o:o>0&&t.isStartIncluded&&u[o-1].isStartIncluded&&u[o-1].start.equals(t.start)?--o:o0&&(n=a.compare(u[o-1].stop,t.start),(n>0||0===n&&(u[o-1].isStopIncluded||t.isStartIncluded))&&((i(r)?r(u[o-1].data,t.data):u[o-1].data===t.data)?(t=a.greaterThan(t.stop,u[o-1].stop)?new s({start:u[o-1].start,stop:t.stop,isStartIncluded:u[o-1].isStartIncluded,isStopIncluded:t.isStopIncluded,data:t.data}):new s({start:u[o-1].start,stop:u[o-1].stop,isStartIncluded:u[o-1].isStartIncluded,isStopIncluded:u[o-1].isStopIncluded||t.stop.equals(u[o-1].stop)&&t.isStopIncluded,data:t.data}),u.splice(o-1,1),--o):(n=a.compare(u[o-1].stop,t.stop),n>0||0===n&&u[o-1].isStopIncluded&&!t.isStopIncluded?u.splice(o-1,1,new s({start:u[o-1].start,stop:t.start,isStartIncluded:u[o-1].isStartIncluded,isStopIncluded:!t.isStartIncluded,data:u[o-1].data}),new s({start:t.stop,stop:u[o-1].stop,isStartIncluded:!t.isStopIncluded,isStopIncluded:u[o-1].isStopIncluded,data:u[o-1].data})):u[o-1]=new s({start:u[o-1].start,stop:t.start,isStartIncluded:u[o-1].isStartIncluded,isStopIncluded:!t.isStartIncluded,data:u[o-1].data}))));o0||0===n&&(t.isStopIncluded||u[o].isStartIncluded));)if(i(r)?r(u[o].data,t.data):u[o].data===t.data)t=new s({start:t.start,stop:a.greaterThan(u[o].stop,t.stop)?u[o].stop:t.stop,isStartIncluded:t.isStartIncluded,isStopIncluded:a.greaterThan(u[o].stop,t.stop)?u[o].isStopIncluded:t.isStopIncluded,data:t.data}),u.splice(o,1);else{if(u[o]=new s({start:t.stop,stop:u[o].stop,isStartIncluded:!t.isStopIncluded,isStopIncluded:u[o].isStopIncluded,data:u[o].data}),!u[o].isEmpty)break;u.splice(o,1)}u.splice(o,0,t),this._changedEvent.raiseEvent(this)}},u.prototype.removeInterval=function(t){if(t.isEmpty)return!1;var i=!1,r=this._intervals,n=e(r,t,l);0>n&&(n=~n);var o=t.start,u=t.stop,c=t.isStartIncluded,h=t.isStopIncluded;if(n>0){var d=r[n-1],p=d.stop;(a.greaterThan(p,o)||s.equals(p,o)&&d.isStopIncluded&&c)&&(i=!0,(a.greaterThan(p,u)||d.isStopIncluded&&!h&&s.equals(p,u))&&r.splice(n,0,new s({start:u,stop:p,isStartIncluded:!h,isStopIncluded:d.isStopIncluded,data:d.data})),r[n-1]=new s({start:d.start,stop:o,isStartIncluded:d.isStartIncluded,isStopIncluded:!c,data:d.data}))}var m=r[n];for(n0&&"/"!==this._url[this._url.length-1]&&(this._url+="/"),this._errorEvent=new s,this._ready=!1,this._proxy=n.proxy,this._terrainDataStructure={heightScale:.001,heightOffset:-1e3,elementsPerHeight:3,stride:4,elementMultiplier:256,isBigEndian:!0};var v=n.credit;"string"==typeof v&&(v=new t(v)),this._credit=v,this._tilingScheme=void 0,this._rectangles=[];var y,C=this,w=i(n.ellipsoid,a.WGS84);h()};n(w.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){if(!this.ready)throw new o("requestTileGeometry must not be called before ready returns true.");return this._tilingScheme}},ready:{get:function(){return this._ready}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}}}),w.prototype.requestTileGeometry=function(t,n,a,s){if(!this.ready)throw new o("requestTileGeometry must not be called before ready returns true.");var l=this._tilingScheme.getNumberOfYTilesAtLevel(a),d=this._url+a+"/"+t+"/"+(l-n-1)+".tif?cesium=true",p=this._proxy;r(p)&&(d=p.getURL(d));var m;if(s=i(s,!0)){if(m=v(d,h),!r(m))return void 0}else m=h(d);var f=this;return e(m,function(e){return new c({buffer:u(e),width:f._heightmapWidth,height:f._heightmapHeight,childTileMask:y(f,t,n,a),structure:f._terrainDataStructure})})},w.prototype.getLevelMaximumGeometricError=function(e){if(!this.ready)throw new o("requestTileGeometry must not be called before ready returns true.");return this._levelZeroMaximumGeometricError/(1<a)return{positions:r};var s=t(o),u=t(n),c=new Array(a),p=new Array(a),m=new Array(a),f=r[0];c[0]=f;var v=i.cartesianToCartographic(f,h);u&&(v.height=n[0]),p[0]=v.height,m[0]=s?o[0]:0;for(var g=1,_=1;a>_;++_){var y=r[_],C=i.cartesianToCartographic(y,d);u&&(C.height=n[_]),l(v,C)?v.height=3){var v=r.fromPoints(t,e),g=v.projectPointsOntoPlane(t);o.computeWindingOrder2D(g)===s.CLOCKWISE&&(t.reverse(),i.reverse(),l.reverse())}var _,y,C=t.length,w=n.chordLength(c,e.maximumRadius),S=f;if(S.minDistance=w,S.ellipsoid=e,h){var E,b=0;for(E=0;C-1>E;E++)b+=a.numberOfPoints(t[E],t[E+1],w)+1;_=new Float64Array(3*b),y=new Float64Array(3*b);var x=p,T=m;S.positions=x,S.height=T;var P=0;for(E=0;C-1>E;E++){x[0]=t[E],x[1]=t[E+1],T[0]=i[E],T[1]=i[E+1];var A=a.generateArc(S);_.set(A,P),T[0]=l[E],T[1]=l[E+1],y.set(a.generateArc(S),P),P+=A.length}}else S.positions=t,S.height=i,_=new Float64Array(a.generateArc(S)),S.height=l,y=new Float64Array(a.generateArc(S));return{bottomPositions:y,topPositions:_}},c}),i("Core/WallGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./VertexFormat","./WallGeometryLibrary"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";var f=new t,v=new t,g=new t,_=new t,y=new t,C=new t,w=new t,S=new t,E=function(e){e=r(e,r.EMPTY_OBJECT);var i=e.positions,o=e.maximumHeights,s=e.minimumHeights,l=r(e.vertexFormat,p.DEFAULT),u=r(e.granularity,h.RADIANS_PER_DEGREE),c=r(e.ellipsoid,a.WGS84);this._positions=i,this._minimumHeights=s,this._maximumHeights=o,this._vertexFormat=p.clone(l),this._granularity=u,this._ellipsoid=a.clone(c),this._workerName="createWallGeometry";var d=1+i.length*t.packedLength+2;n(s)&&(d+=s.length),n(o)&&(d+=o.length),this.packedLength=d+a.packedLength+p.packedLength+1};E.pack=function(e,i,o){o=r(o,0);var s,l=e._positions,u=l.length;for(i[o++]=u,s=0;u>s;++s,o+=t.packedLength)t.pack(l[s],i,o);var c=e._minimumHeights;if(u=n(c)?c.length:0,i[o++]=u,n(c))for(s=0;u>s;++s)i[o++]=c[s];var h=e._maximumHeights;if(u=n(h)?h.length:0,i[o++]=u,n(h))for(s=0;u>s;++s)i[o++]=h[s];a.pack(e._ellipsoid,i,o),o+=a.packedLength,p.pack(e._vertexFormat,i,o),o+=p.packedLength,i[o]=e._granularity};var b=a.clone(a.UNIT_SPHERE),x=new p,T={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:b,vertexFormat:x,granularity:void 0};return E.unpack=function(e,i,o){i=r(i,0);var s,l=e[i++],u=new Array(l);for(s=0;l>s;++s,i+=t.packedLength)u[s]=t.unpack(e,i);l=e[i++];var c;if(l>0)for(c=new Array(l),s=0;l>s;++s)c[s]=e[i++];l=e[i++];var h;if(l>0)for(h=new Array(l),s=0;l>s;++s)h[s]=e[i++];var d=a.unpack(e,i,b);i+=a.packedLength;var m=p.unpack(e,i,x);i+=p.packedLength;var f=e[i];return n(o)?(o._positions=u,o._minimumHeights=c,o._maximumHeights=h,o._ellipsoid=a.clone(d,o._ellipsoid),o._vertexFormat=p.clone(m,o._vertexFormat),o._granularity=f,o):(T.positions=u,T.minimumHeights=c,T.maximumHeights=h,T.granularity=f,new E(T))},E.fromConstantHeights=function(e){e=r(e,r.EMPTY_OBJECT);var t,i,o=e.positions,a=e.minimumHeight,s=e.maximumHeight,l=n(a),u=n(s);if(l||u){var c=o.length;t=l?new Array(c):void 0,i=u?new Array(c):void 0;for(var h=0;c>h;++h)l&&(t[h]=a),u&&(i[h]=s)}var d={positions:o,maximumHeights:i,minimumHeights:t,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat};return new E(d)},E.createGeometry=function(r){var o=r._positions,a=r._minimumHeights,p=r._maximumHeights,E=r._vertexFormat,b=r._granularity,x=r._ellipsoid,T=m.computePositions(x,o,p,a,b,!0);if(!n(T))return void 0;var P=T.bottomPositions,A=T.topPositions,D=A.length,M=2*D,I=E.position?new Float64Array(M):void 0,O=E.normal?new Float32Array(M):void 0,R=E.tangent?new Float32Array(M):void 0,L=E.binormal?new Float32Array(M):void 0,N=E.st?new Float32Array(2*(M/3)):void 0,F=0,B=0,z=0,k=0,V=0,U=S,W=w,G=C,H=!0;D/=3;var q;for(q=0;D>q;++q){var j=3*q,Y=t.fromArray(A,j,f),X=t.fromArray(P,j,v);if(E.position&&(I[F++]=X.x,I[F++]=X.y,I[F++]=X.z,I[F++]=Y.x,I[F++]=Y.y,I[F++]=Y.z),E.normal||E.tangent||E.binormal){var Z,J=t.clone(t.ZERO,y),Q=x.scaleToGeodeticSurface(t.fromArray(A,j,v),v);if(D>q+1&&(Z=x.scaleToGeodeticSurface(t.fromArray(A,j+3,g),g),J=t.fromArray(A,j+3,y)),H){var K=t.subtract(J,Y,_),$=t.subtract(Q,Y,f);U=t.normalize(t.cross($,K,U),U),H=!1}t.equalsEpsilon(Z,Q,h.EPSILON6)?H=!0:(E.tangent&&(W=t.normalize(t.subtract(Z,Q,W),W)),E.binormal&&(G=t.normalize(t.cross(U,W,G),G))),E.normal&&(O[B++]=U.x,O[B++]=U.y,O[B++]=U.z,O[B++]=U.x,O[B++]=U.y,O[B++]=U.z),E.tangent&&(R[k++]=W.x,R[k++]=W.y,R[k++]=W.z,R[k++]=W.x,R[k++]=W.y,R[k++]=W.z),E.binormal&&(L[z++]=G.x,L[z++]=G.y,L[z++]=G.z,L[z++]=G.x,L[z++]=G.y,L[z++]=G.z)}if(E.st){var et=q/(D-1);N[V++]=et,N[V++]=0,N[V++]=et,N[V++]=1}}var tt=new u;E.position&&(tt.position=new l({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:I})),E.normal&&(tt.normal=new l({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:O})),E.tangent&&(tt.tangent=new l({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:R})),E.binormal&&(tt.binormal=new l({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:L})),E.st&&(tt.st=new l({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:N}));var it=M/3;M-=6;var rt=c.createTypedArray(it,M),nt=0;for(q=0;it-2>q;q+=2){var ot=q,at=q+2,st=t.fromArray(I,3*ot,f),lt=t.fromArray(I,3*at,v);if(!t.equalsEpsilon(st,lt,h.EPSILON6)){var ut=q+1,ct=q+3;rt[nt++]=ut,rt[nt++]=ot,rt[nt++]=ct,rt[nt++]=ct,rt[nt++]=ot,rt[nt++]=at}}return new s({attributes:tt,indices:rt,primitiveType:d.TRIANGLES,boundingSphere:new e.fromVertices(I)})},E}),i("Core/WallOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./WallGeometryLibrary"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";var m=new t,f=new t,v=function(e){e=r(e,r.EMPTY_OBJECT);var i=e.positions,o=e.maximumHeights,s=e.minimumHeights,l=r(e.granularity,h.RADIANS_PER_DEGREE),u=r(e.ellipsoid,a.WGS84);this._positions=i,this._minimumHeights=s,this._maximumHeights=o,this._granularity=l,this._ellipsoid=a.clone(u),this._workerName="createWallOutlineGeometry";var c=1+i.length*t.packedLength+2;n(s)&&(c+=s.length),n(o)&&(c+=o.length),this.packedLength=c+a.packedLength+1};v.pack=function(e,i,o){o=r(o,0);var s,l=e._positions,u=l.length;for(i[o++]=u,s=0;u>s;++s,o+=t.packedLength)t.pack(l[s],i,o);var c=e._minimumHeights;if(u=n(c)?c.length:0,i[o++]=u,n(c))for(s=0;u>s;++s)i[o++]=c[s];var h=e._maximumHeights;if(u=n(h)?h.length:0,i[o++]=u,n(h))for(s=0;u>s;++s)i[o++]=h[s];a.pack(e._ellipsoid,i,o),o+=a.packedLength,i[o]=e._granularity};var g=a.clone(a.UNIT_SPHERE),_={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:g,granularity:void 0};return v.unpack=function(e,i,o){i=r(i,0);var s,l=e[i++],u=new Array(l);for(s=0;l>s;++s,i+=t.packedLength)u[s]=t.unpack(e,i);l=e[i++];var c;if(l>0)for(c=new Array(l),s=0;l>s;++s)c[s]=e[i++];l=e[i++];var h;if(l>0)for(h=new Array(l),s=0;l>s;++s)h[s]=e[i++];var d=a.unpack(e,i,g);i+=a.packedLength;var p=e[i];return n(o)?(o._positions=u,o._minimumHeights=c,o._maximumHeights=h,o._ellipsoid=a.clone(d,o._ellipsoid),o._granularity=p,o):(_.positions=u,_.minimumHeights=c,_.maximumHeights=h,_.granularity=p,new v(_))},v.fromConstantHeights=function(e){e=r(e,r.EMPTY_OBJECT);var t,i,o=e.positions,a=e.minimumHeight,s=e.maximumHeight,l=n(a),u=n(s);if(l||u){var c=o.length;t=l?new Array(c):void 0,i=u?new Array(c):void 0;for(var h=0;c>h;++h)l&&(t[h]=a),u&&(i[h]=s)}var d={positions:o,maximumHeights:i,minimumHeights:t,ellipsoid:e.ellipsoid};return new v(d)},v.createGeometry=function(r){var o=r._positions,a=r._minimumHeights,v=r._maximumHeights,g=r._granularity,_=r._ellipsoid,y=p.computePositions(_,o,v,a,g,!1);if(!n(y))return void 0;var C=y.bottomPositions,w=y.topPositions,S=w.length,E=2*S,b=new Float64Array(E),x=0;S/=3;var T;for(T=0;S>T;++T){var P=3*T,A=t.fromArray(w,P,m),D=t.fromArray(C,P,f);b[x++]=D.x,b[x++]=D.y,b[x++]=D.z,b[x++]=A.x,b[x++]=A.y,b[x++]=A.z}var M=new u({position:new l({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:b})}),I=E/3;E=2*I-4+I;var O=c.createTypedArray(I,E),R=0;for(T=0;I-2>T;T+=2){var L=T,N=T+2,F=t.fromArray(b,3*L,m),B=t.fromArray(b,3*N,f);if(!t.equalsEpsilon(F,B,h.EPSILON6)){var z=T+1,k=T+3;O[R++]=z,O[R++]=L,O[R++]=z,O[R++]=k,O[R++]=L,O[R++]=N}}return O[R++]=I-2,O[R++]=I-1,new s({attributes:M,indices:O,primitiveType:d.LINES,boundingSphere:new e.fromVertices(b)})},v}),i("Core/WebMercatorProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(e){this._ellipsoid=i(e,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return n(l.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),l.mercatorAngleToGeodeticLatitude=function(e){return s.PI_OVER_TWO-2*Math.atan(Math.exp(-e))},l.geodeticLatitudeToMercatorAngle=function(e){e>l.MaximumLatitude?e=l.MaximumLatitude:e<-l.MaximumLatitude&&(e=-l.MaximumLatitude);var t=Math.sin(e);return.5*Math.log((1+t)/(1-t))},l.MaximumLatitude=l.mercatorAngleToGeodeticLatitude(Math.PI),l.prototype.project=function(t,i){var n=this._semimajorAxis,o=t.longitude*n,a=l.geodeticLatitudeToMercatorAngle(t.latitude)*n,s=t.height;return r(i)?(i.x=o,i.y=a,i.z=s,i):new e(o,a,s)},l.prototype.unproject=function(e,i){var n=this._oneOverSemimajorAxis,o=e.x*n,a=l.mercatorAngleToGeodeticLatitude(e.y*n),s=e.z;return r(i)?(i.longitude=o,i.latitude=a,i.height=s,i):new t(o,a,s)},l}),i("Core/WebMercatorTilingScheme",["./Cartesian2","./defaultValue","./defined","./defineProperties","./Ellipsoid","./Rectangle","./WebMercatorProjection"],function(e,t,i,r,n,o,a){"use strict";var s=function(r){if(r=t(r,{}),this._ellipsoid=t(r.ellipsoid,n.WGS84),this._numberOfLevelZeroTilesX=t(r.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=t(r.numberOfLevelZeroTilesY,1),this._projection=new a(this._ellipsoid),i(r.rectangleSouthwestInMeters)&&i(r.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=r.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=r.rectangleNortheastInMeters;else{var s=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new e(-s,-s),this._rectangleNortheastInMeters=new e(s,s)}var l=this._projection.unproject(this._rectangleSouthwestInMeters),u=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new o(l.longitude,l.latitude,u.longitude,u.latitude)};return r(s.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),s.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<=s&&(g=s-1);var _=0|v/d;return _>=l&&(_=l-1),i(n)?(n.x=g,n.y=_,n):new e(g,_)},s}),i("Core/cancelAnimationFrame",["./defined"],function(e){"use strict";var t=window.cancelAnimationFrame;!function(){if(!e(t))for(var i=["webkit","moz","ms","o"],r=0,n=i.length;n>r&&!e(t);)t=window[i[r]+"CancelAnimationFrame"],e(t)||(t=window[i[r]+"CancelRequestAnimationFrame"]),++r; -e(t)||(t=clearTimeout)}();var i=function(e){t(e)};return i}),i("Core/combine",["./defaultValue","./defined"],function(e,t){"use strict";var i=function(r,n,o){o=e(o,!1);var a,s,l,u={},c=t(r),h=t(n);if(c)for(a in r)r.hasOwnProperty(a)&&(s=r[a],h&&o&&"object"==typeof s&&n.hasOwnProperty(a)?(l=n[a],u[a]="object"==typeof l?i(s,l,o):s):u[a]=s);if(h)for(a in n)n.hasOwnProperty(a)&&!u.hasOwnProperty(a)&&(l=n[a],u[a]=l);return u};return i}),i("Core/createGuid",[],function(){"use strict";var e=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=0|16*Math.random(),i="x"===e?t:8|3&t;return i.toString(16)})};return e}),i("Core/definedNotNull",[],function(){"use strict";var e=function(e){return void 0!==e&&null!==e};return e}),i("Core/getFilenameFromUri",["../ThirdParty/Uri","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){var i=new e(t);i.normalize();var r=i.path,n=r.lastIndexOf("/");return-1!==n&&(r=r.substr(n+1)),r};return t}),i("Core/getStringFromTypedArray",["./defined","./DeveloperError"],function(){"use strict";var e=function(t){return e.decode(t)};return e.decodeWithTextDecoder=function(e){var t=new TextDecoder("utf-8");return t.decode(e)},e.decodeWithFromCharCode=function(e){for(var t="",i=e.length,r=0;i>r;++r)t+=String.fromCharCode(e[r]);return t},e.decode="undefined"!=typeof TextDecoder?e.decodeWithTextDecoder:e.decodeWithFromCharCode,e}),i("Core/objectToQuery",["./defined","./DeveloperError","./isArray"],function(e,t,i){"use strict";var r=function(e){var t="";for(var r in e)if(e.hasOwnProperty(r)){var n=e[r],o=encodeURIComponent(r)+"=";if(i(n))for(var a=0,s=n.length;s>a;++a)t+=o+encodeURIComponent(n[a])+"&";else t+=o+encodeURIComponent(n)+"&"}return t=t.slice(0,-1)};return r}),i("Core/queryToObject",["./defined","./DeveloperError","./isArray"],function(e,t,i){"use strict";var r=function(t){var r={};if(""===t)return r;for(var n=t.replace(/\+/g,"%20").split("&"),o=0,a=n.length;a>o;++o){var s=n[o].split("="),l=decodeURIComponent(s[0]),u=s[1];u=e(u)?decodeURIComponent(u):"";var c=r[l];"string"==typeof c?r[l]=[c,u]:i(c)?c.push(u):r[l]=u}return r};return r}),i("Core/jsonp",["../ThirdParty/Uri","../ThirdParty/when","./combine","./defaultValue","./defined","./DeveloperError","./objectToQuery","./queryToObject"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(o,u){u=r(u,r.EMPTY_OBJECT);var c;do c="jsonp"+Math.random().toString().substring(2,8);while(n(window[c]));var h=t.defer();window[c]=function(e){h.resolve(e);try{delete window[c]}catch(t){window[c]=void 0}};var d=new e(o),p=s(r(d.query,""));n(u.parameters)&&(p=i(u.parameters,p));var m=r(u.callbackParameterName,"callback");p[m]=c,d.query=a(p),o=d.toString();var f=u.proxy;return n(f)&&(o=f.getURL(o)),l.loadAndExecuteScript(o,c,h),h.promise};return l.loadAndExecuteScript=function(e,t,i){var r=document.createElement("script");r.async=!0,r.src=e;var n=document.getElementsByTagName("head")[0];r.onload=function(){r.onload=void 0,n.removeChild(r)},r.onerror=function(e){i.reject(e)},n.appendChild(r)},l.defaultLoadAndExecuteScript=l.loadAndExecuteScript,l}),i("Core/loadBlob",["./loadWithXhr"],function(e){"use strict";var t=function(t,i){return e({url:t,responseType:"blob",headers:i})};return t}),i("Core/loadImageFromTypedArray",["../ThirdParty/when","./defined","./DeveloperError","./loadImage"],function(e,t,i,r){"use strict";var n=function(t,i){var n=new Blob([t],{type:i}),o=window.URL.createObjectURL(n);return r(o,!1).then(function(e){return window.URL.revokeObjectURL(o),e},function(t){return window.URL.revokeObjectURL(o),e.reject(t)})};return n}),i("Core/loadImageViaBlob",["../ThirdParty/when","./loadBlob","./loadImage"],function(e,t,i){"use strict";var r=/^data:/,n=function(n){return r.test(n)?i(n):t(n).then(function(t){var r=window.URL.createObjectURL(t);return i(r,!1).then(function(e){return e.blob=t,window.URL.revokeObjectURL(r),e},function(t){return window.URL.revokeObjectURL(r),e.reject(t)})})},o=function(){try{var e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob","blob"===e.responseType}catch(t){return!1}}();return o?n:i}),i("Core/mergeSort",["./defined","./DeveloperError"],function(){"use strict";function e(e,t,n,o,a,s){var l,u,c=a-o+1,h=s-a,d=i,p=r;for(l=0;c>l;++l)d[l]=e[o+l];for(u=0;h>u;++u)p[u]=e[a+u+1];l=0,u=0;for(var m=o;s>=m;++m){var f=d[l],v=p[u];c>l&&(u>=h||t(f,v,n)<=0)?(e[m]=f,++l):h>u&&(e[m]=v,++u)}}function t(i,r,n,o,a){if(!(o>=a)){var s=Math.floor(.5*(o+a));t(i,r,n,o,s),t(i,r,n,s+1,a),e(i,r,n,o,s,a)}}var i=[],r=[],n=function(e,n,o){var a=e.length,s=Math.ceil(.5*a);i.length=s,r.length=s,t(e,n,o,0,a-1),i.length=0,r.length=0};return n}),i("Core/requestAnimationFrame",["./defined","./getTimestamp"],function(e,t){"use strict";var i=window.requestAnimationFrame;!function(){if(!e(i))for(var r=["webkit","moz","ms","o"],n=0,o=r.length;o>n&&!e(i);)i=window[r[n]+"RequestAnimationFrame"],++n;if(!e(i)){var a=1e3/60,s=0;i=function(e){var i=t(),r=Math.max(a-(i-s),0);return s=i+r,setTimeout(function(){e(s)},r)}}}();var r=function(e){return i(e)};return r}),i("Core/sampleTerrain",["../ThirdParty/when","./defined","./DeveloperError"],function(e){"use strict";function t(t,n,o){var a,s=t.tilingScheme,l=[],u={};for(a=0;an;){var o=Math.ceil((r-n)/t--);i.push(e.slice(n,n+o)),n+=o}return i};return e}),i("Core/wrapFunction",["./DeveloperError"],function(){"use strict";var e=function(e,t,i){return function(){i.apply(e,arguments),t.apply(e,arguments)}};return e}),i("DataSources/ConstantProperty",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event"],function(e,t,i,r,n){"use strict";var o=function(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new n,this.setValue(e)};return i(o.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}}),o.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value},o.prototype.setValue=function(e){var i=this._value;if(i!==e){var r=t(e),n=r&&"function"==typeof e.clone,o=r&&"function"==typeof e.equals;this._hasClone=n,this._hasEquals=o;var a=!o||!e.equals(i);a&&(this._value=n?e.clone():e,this._definitionChanged.raiseEvent(this))}},o.prototype.equals=function(e){return this===e||e instanceof o&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))},o}),i("DataSources/createPropertyDescriptor",["../Core/defaultValue","../Core/defined","./ConstantProperty"],function(e,t,i){"use strict";function r(e,i,r,n,o){return{configurable:n,get:function(){return this[i]},set:function(n){var a=this[i],s=this[r];t(s)&&(s(),this[r]=void 0);var l=t(n);l&&!t(n.getValue)&&t(o)&&(n=o(n)),a!==n&&(this[i]=n,this._definitionChanged.raiseEvent(this,e,n,a)),t(n)&&t(n.definitionChanged)&&(this[r]=n.definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this,e,n,n)},this))}}}function n(e){return new i(e)}function o(t,i,o){return r(t,"_"+t.toString(),"_"+t.toString()+"Subscription",e(i,!1),e(o,n))}return o}),i("DataSources/BillboardGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createPropertyDescriptor"],function(e,t,i,r,n,o){"use strict";var a=function(t){this._image=void 0,this._imageSubscription=void 0,this._imageSubRegion=void 0,this._imageSubRegionSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._alignedAxis=void 0,this._alignedAxisSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._show=void 0,this._showSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(a.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},image:o("image"),imageSubRegion:o("imageSubRegion"),scale:o("scale"),rotation:o("rotation"),alignedAxis:o("alignedAxis"),horizontalOrigin:o("horizontalOrigin"),verticalOrigin:o("verticalOrigin"),color:o("color"),eyeOffset:o("eyeOffset"),pixelOffset:o("pixelOffset"),show:o("show"),width:o("width"),height:o("height"),scaleByDistance:o("scaleByDistance"),translucencyByDistance:o("translucencyByDistance"),pixelOffsetScaleByDistance:o("pixelOffsetScaleByDistance")}),a.prototype.clone=function(e){return t(e)?(e.color=this._color,e.eyeOffset=this._eyeOffset,e.horizontalOrigin=this._horizontalOrigin,e.image=this._image,e.imageSubRegion=this._imageSubRegion,e.pixelOffset=this._pixelOffset,e.scale=this._scale,e.rotation=this._rotation,e.alignedAxis=this._alignedAxis,e.show=this._show,e.verticalOrigin=this._verticalOrigin,e.width=this._width,e.height=this._height,e.scaleByDistance=this._scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance,e):new a(this)},a.prototype.merge=function(t){this.color=e(this._color,t.color),this.eyeOffset=e(this._eyeOffset,t.eyeOffset),this.horizontalOrigin=e(this._horizontalOrigin,t.horizontalOrigin),this.image=e(this._image,t.image),this.imageSubRegion=e(this._imageSubRegion,t.imageSubRegion),this.pixelOffset=e(this._pixelOffset,t.pixelOffset),this.scale=e(this._scale,t.scale),this.rotation=e(this._rotation,t.rotation),this.alignedAxis=e(this._alignedAxis,t.alignedAxis),this.show=e(this._show,t.show),this.verticalOrigin=e(this._verticalOrigin,t.verticalOrigin),this.width=e(this._width,t.width),this.height=e(this._height,t.height),this.scaleByDistance=e(this._scaleByDistance,t.scaleByDistance),this.translucencyByDistance=e(this._translucencyByDistance,t.translucencyByDistance),this.pixelOffsetScaleByDistance=e(this._pixelOffsetScaleByDistance,t.pixelOffsetScaleByDistance)},a}),i("Renderer/BufferUsage",["../Core/freezeObject"],function(e){"use strict";var t={STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,validate:function(e){return e===t.STREAM_DRAW||e===t.STATIC_DRAW||e===t.DYNAMIC_DRAW}};return e(t)}),i("Renderer/DrawCommand",["../Core/defaultValue","../Core/PrimitiveType"],function(e,t){"use strict";var i=function(i){i=e(i,e.EMPTY_OBJECT),this.boundingVolume=i.boundingVolume,this.orientedBoundingBox=i.orientedBoundingBox,this.cull=e(i.cull,!0),this.modelMatrix=i.modelMatrix,this.primitiveType=e(i.primitiveType,t.TRIANGLES),this.vertexArray=i.vertexArray,this.count=i.count,this.offset=e(i.offset,0),this.shaderProgram=i.shaderProgram,this.uniformMap=i.uniformMap,this.renderState=i.renderState,this.framebuffer=i.framebuffer,this.pass=i.pass,this.executeInClosestFrustum=e(i.executeInClosestFrustum,!1),this.owner=i.owner,this.debugShowBoundingVolume=e(i.debugShowBoundingVolume,!1),this.debugOverlappingFrustums=0,this.oit=void 0};return i.prototype.execute=function(e,t,i,r){e.draw(this,t,i,r)},i}),i("Shaders/Builtin/Constants/degreesPerRadian",[],function(){"use strict";return"const float czm_degreesPerRadian = 57.29577951308232;\n"}),i("Shaders/Builtin/Constants/depthRange",[],function(){"use strict";return"const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);\n"}),i("Shaders/Builtin/Constants/epsilon1",[],function(){"use strict";return"const float czm_epsilon1 = 0.1;\n"}),i("Shaders/Builtin/Constants/epsilon2",[],function(){"use strict";return"const float czm_epsilon2 = 0.01;\n"}),i("Shaders/Builtin/Constants/epsilon3",[],function(){"use strict";return"const float czm_epsilon3 = 0.001;\n"}),i("Shaders/Builtin/Constants/epsilon4",[],function(){"use strict";return"const float czm_epsilon4 = 0.0001;\n"}),i("Shaders/Builtin/Constants/epsilon5",[],function(){"use strict";return"const float czm_epsilon5 = 0.00001;\n"}),i("Shaders/Builtin/Constants/epsilon6",[],function(){"use strict";return"const float czm_epsilon6 = 0.000001;\n"}),i("Shaders/Builtin/Constants/epsilon7",[],function(){"use strict";return"const float czm_epsilon7 = 0.0000001;\n"}),i("Shaders/Builtin/Constants/infinity",[],function(){"use strict";return"const float czm_infinity = 5906376272000.0;\n"}),i("Shaders/Builtin/Constants/oneOverPi",[],function(){"use strict";return"const float czm_oneOverPi = 0.3183098861837907;\n"}),i("Shaders/Builtin/Constants/oneOverTwoPi",[],function(){"use strict";return"const float czm_oneOverTwoPi = 0.15915494309189535;\n"}),i("Shaders/Builtin/Constants/pi",[],function(){"use strict";return"const float czm_pi = 3.141592653589793;\n"}),i("Shaders/Builtin/Constants/piOverFour",[],function(){"use strict";return"const float czm_piOverFour = 0.7853981633974483;\n"}),i("Shaders/Builtin/Constants/piOverSix",[],function(){"use strict";return"const float czm_piOverSix = 0.5235987755982988;\n"}),i("Shaders/Builtin/Constants/piOverThree",[],function(){"use strict";return"const float czm_piOverThree = 1.0471975511965976;\n"}),i("Shaders/Builtin/Constants/piOverTwo",[],function(){"use strict";return"const float czm_piOverTwo = 1.5707963267948966;\n"}),i("Shaders/Builtin/Constants/radiansPerDegree",[],function(){"use strict";return"const float czm_radiansPerDegree = 0.017453292519943295;\n"}),i("Shaders/Builtin/Constants/sceneMode2D",[],function(){"use strict";return"const float czm_sceneMode2D = 2.0;\n"}),i("Shaders/Builtin/Constants/sceneMode3D",[],function(){"use strict";return"const float czm_sceneMode3D = 3.0;\n"}),i("Shaders/Builtin/Constants/sceneModeColumbusView",[],function(){"use strict";return"const float czm_sceneModeColumbusView = 1.0;\n"}),i("Shaders/Builtin/Constants/sceneModeMorphing",[],function(){"use strict";return"const float czm_sceneModeMorphing = 0.0;\n"}),i("Shaders/Builtin/Constants/solarRadius",[],function(){"use strict";return"const float czm_solarRadius = 695500000.0;\n"}),i("Shaders/Builtin/Constants/threePiOver2",[],function(){"use strict";return"const float czm_threePiOver2 = 4.71238898038469;\n"}),i("Shaders/Builtin/Constants/twoPi",[],function(){"use strict";return"const float czm_twoPi = 6.283185307179586;\n"}),i("Shaders/Builtin/Constants/webMercatorMaxLatitude",[],function(){"use strict";return"const float czm_webMercatorMaxLatitude = 1.4844222297453324;\n"}),i("Shaders/Builtin/Structs/depthRangeStruct",[],function(){"use strict";return"struct czm_depthRangeStruct\n{\nfloat near;\nfloat far;\n};\n"}),i("Shaders/Builtin/Structs/ellipsoid",[],function(){"use strict";return"struct czm_ellipsoid\n{\nvec3 center;\nvec3 radii;\nvec3 inverseRadii;\nvec3 inverseRadiiSquared;\n};\n"}),i("Shaders/Builtin/Structs/material",[],function(){"use strict";return"struct czm_material\n{\nvec3 diffuse;\nfloat specular;\nfloat shininess;\nvec3 normal;\nvec3 emission;\nfloat alpha;\n};\n"}),i("Shaders/Builtin/Structs/materialInput",[],function(){"use strict";return"struct czm_materialInput\n{\nfloat s;\nvec2 st;\nvec3 str;\nvec3 normalEC;\nmat3 tangentToEyeMatrix;\nvec3 positionToEyeEC;\n};\n"}),i("Shaders/Builtin/Structs/ray",[],function(){"use strict";return"struct czm_ray\n{\nvec3 origin;\nvec3 direction;\n};\n"}),i("Shaders/Builtin/Structs/raySegment",[],function(){"use strict";return"struct czm_raySegment\n{\nfloat start;\nfloat stop;\n};\nconst czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\nconst czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n"}),i("Shaders/Builtin/Functions/RGBToXYZ",[],function(){"use strict";return"vec3 czm_RGBToXYZ(vec3 rgb)\n{\nconst mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n0.3576, 0.7152, 0.1192,\n0.1805, 0.0722, 0.9505);\nvec3 xyz = RGB2XYZ * rgb;\nvec3 Yxy;\nYxy.r = xyz.g;\nfloat temp = dot(vec3(1.0), xyz);\nYxy.gb = xyz.rg / temp;\nreturn Yxy;\n}\n"}),i("Shaders/Builtin/Functions/XYZToRGB",[],function(){"use strict";return"vec3 czm_XYZToRGB(vec3 Yxy)\n{\nconst mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n-1.5371, 1.8760, -0.2040,\n-0.4985, 0.0416, 1.0572);\nvec3 xyz;\nxyz.r = Yxy.r * Yxy.g / Yxy.b;\nxyz.g = Yxy.r;\nxyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\nreturn XYZ2RGB * xyz;\n}\n"}),i("Shaders/Builtin/Functions/alphaWeight",[],function(){"use strict";return"float czm_alphaWeight(float a)\n{\nfloat z;\nif (czm_sceneMode != czm_sceneMode2D)\n{\nfloat x = 2.0 * (gl_FragCoord.x - czm_viewport.x) / czm_viewport.z - 1.0;\nfloat y = 2.0 * (gl_FragCoord.y - czm_viewport.y) / czm_viewport.w - 1.0;\nz = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nvec4 q = vec4(x, y, z, 0.0);\nq /= gl_FragCoord.w;\nz = (czm_inverseProjectionOIT * q).z;\n}\nelse\n{\nz = gl_FragCoord.z * (czm_currentFrustum.y - czm_currentFrustum.x) + czm_currentFrustum.x;\n}\nreturn pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 100.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0))));\n}\n"}),i("Shaders/Builtin/Functions/antialias",[],function(){"use strict";return"vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n{\nfloat val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\nfloat val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\nval1 = val1 * (1.0 - val2);\nval1 = val1 * val1 * (3.0 - (2.0 * val1));\nval1 = pow(val1, 0.5);\nvec4 midColor = (color1 + color2) * 0.5;\nreturn mix(midColor, currentColor, val1);\n}\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n{\nreturn czm_antialias(color1, color2, currentColor, dist, 0.1);\n}\n"}),i("Shaders/Builtin/Functions/columbusViewMorph",[],function(){"use strict";return"vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n{\nvec3 p = mix(position2D.xyz, position3D.xyz, time);\nreturn vec4(p, 1.0);\n}\n"}),i("Shaders/Builtin/Functions/computePosition",[],function(){"use strict";return"vec4 czm_computePosition();\n"}),i("Shaders/Builtin/Functions/cosineAndSine",[],function(){"use strict";return"vec2 cordic(float angle)\n{\nvec2 vector = vec2(6.0725293500888267e-1, 0.0);\nfloat sense = (angle < 0.0) ? -1.0 : 1.0;\nmat2 rotation = mat2(1.0, sense, -sense, 1.0);\nvector = rotation * vector;\nangle -= sense * 7.8539816339744828e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfloat factor = sense * 5.0e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.6364760900080609e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.5e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4497866312686414e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.25e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2435499454676144e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.25e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.2418809995957350e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.125e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.1239833430268277e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.5625e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5623728620476831e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.8125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.8123410601011111e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.90625e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.9062301319669718e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.953125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9531225164788188e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.765625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.7656218955931946e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.8828125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.8828121119489829e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.44140625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4414062014936177e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.220703125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2207031189367021e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.103515625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.1035156174208773e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.0517578125e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.0517578115526096e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.52587890625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5258789061315762e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.62939453125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.6293945311019700e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.814697265625e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.8146972656064961e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.9073486328125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9073486328101870e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.5367431640625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.5367431640596084e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.76837158203125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.7683715820308884e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.384185791015625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.3841857910155797e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.1920928955078125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nreturn vector;\n}\nvec2 czm_cosineAndSine(float angle)\n{\nif (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n{\nif (angle < 0.0)\n{\nreturn -cordic(angle + czm_pi);\n}\nelse\n{\nreturn -cordic(angle - czm_pi);\n}\n}\nelse\n{\nreturn cordic(angle);\n}\n}\n"}),i("Shaders/Builtin/Functions/decompressTextureCoordinates",[],function(){"use strict";return"vec2 czm_decompressTextureCoordinates(float encoded)\n{\nfloat temp = encoded / 4096.0;\nfloat stx = floor(temp) / 4096.0;\nfloat sty = temp - floor(temp);\nreturn vec2(stx, sty);\n}\n"}),i("Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates",[],function(){"use strict";return"mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n{\nvec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));\nvec3 tangentEC = normalize(czm_normal3D * tangentMC);\nvec3 bitangentEC = normalize(cross(normalEC, tangentEC));\nreturn mat3(\ntangentEC.x, tangentEC.y, tangentEC.z,\nbitangentEC.x, bitangentEC.y, bitangentEC.z,\nnormalEC.x, normalEC.y, normalEC.z);\n}\n"}),i("Shaders/Builtin/Functions/ellipsoidContainsPoint",[],function(){"use strict";return"bool czm_ellipsoidContainsPoint(czm_ellipsoid ellipsoid, vec3 point)\n{\nvec3 scaled = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\nreturn (dot(scaled, scaled) <= 1.0);\n}\n"}),i("Shaders/Builtin/Functions/ellipsoidNew",[],function(){"use strict";return"czm_ellipsoid czm_ellipsoidNew(vec3 center, vec3 radii)\n{\nvec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\nvec3 inverseRadiiSquared = inverseRadii * inverseRadii;\nczm_ellipsoid temp = czm_ellipsoid(center, radii, inverseRadii, inverseRadiiSquared);\nreturn temp;\n}\n"}),i("Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates",[],function(){"use strict";return"vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n{\nreturn vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n}\n"}),i("Shaders/Builtin/Functions/equalsEpsilon",[],function(){"use strict";return"bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec4(epsilon)));\n}\nbool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec3(epsilon)));\n}\nbool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec2(epsilon)));\n}\nbool czm_equalsEpsilon(float left, float right, float epsilon) {\nreturn (abs(left - right) <= epsilon);\n}\n"}),i("Shaders/Builtin/Functions/eyeOffset",[],function(){"use strict";return"vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n{\nvec4 p = positionEC;\nvec4 zEyeOffset = normalize(p) * eyeOffset.z;\np.xy += eyeOffset.xy + zEyeOffset.xy;\np.z += zEyeOffset.z;\nreturn p;\n}\n"}),i("Shaders/Builtin/Functions/eyeToWindowCoordinates",[],function(){"use strict";return"vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n{\nvec4 q = czm_projection * positionEC;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n"}),i("Shaders/Builtin/Functions/geodeticSurfaceNormal",[],function(){"use strict";return"vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n{\nreturn normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n}\n"}),i("Shaders/Builtin/Functions/getDefaultMaterial",[],function(){"use strict";return"czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n{\nczm_material material;\nmaterial.diffuse = vec3(0.0);\nmaterial.specular = 0.0;\nmaterial.shininess = 1.0;\nmaterial.normal = materialInput.normalEC;\nmaterial.emission = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\n"}),i("Shaders/Builtin/Functions/getLambertDiffuse",[],function(){"use strict";return"float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\nreturn max(dot(lightDirectionEC, normalEC), 0.0);\n}\n"}),i("Shaders/Builtin/Functions/getSpecular",[],function(){"use strict";return"float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\nvec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\nfloat specular = max(dot(toReflectedLight, toEyeEC), 0.0);\nreturn pow(specular, shininess);\n}\n"}),i("Shaders/Builtin/Functions/getWaterNoise",[],function(){"use strict";return"vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n{\nfloat cosAngle = cos(angleInRadians);\nfloat sinAngle = sin(angleInRadians);\nvec2 s0 = vec2(1.0/17.0, 0.0);\nvec2 s1 = vec2(-1.0/29.0, 0.0);\nvec2 s2 = vec2(1.0/101.0, 1.0/59.0);\nvec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\ns0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\ns1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\ns2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\ns3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\nvec2 uv0 = (uv/103.0) + (time * s0);\nvec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\nvec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\nvec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\nuv0 = fract(uv0);\nuv1 = fract(uv1);\nuv2 = fract(uv2);\nuv3 = fract(uv3);\nvec4 noise = (texture2D(normalMap, uv0)) +\n(texture2D(normalMap, uv1)) +\n(texture2D(normalMap, uv2)) +\n(texture2D(normalMap, uv3));\nreturn ((noise / 4.0) - 0.5) * 2.0;\n}\n"}),i("Shaders/Builtin/Functions/getWgs84EllipsoidEC",[],function(){"use strict";return"czm_ellipsoid czm_getWgs84EllipsoidEC()\n{\nvec3 radii = vec3(6378137.0, 6378137.0, 6356752.314245);\nvec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\nvec3 inverseRadiiSquared = inverseRadii * inverseRadii;\nczm_ellipsoid temp = czm_ellipsoid(czm_view[3].xyz, radii, inverseRadii, inverseRadiiSquared);\nreturn temp;\n}\n"}),i("Shaders/Builtin/Functions/hue",[],function(){"use strict";return"vec3 czm_hue(vec3 rgb, float adjustment)\n{\nconst mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n0.595716, -0.274453, -0.321263,\n0.211456, -0.522591, 0.311135);\nconst mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n1.0, -0.2721, -0.6474,\n1.0, -1.107, 1.7046);\nvec3 yiq = toYIQ * rgb;\nfloat hue = atan(yiq.z, yiq.y) + adjustment;\nfloat chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\nvec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\nreturn toRGB * color;\n}\n"}),i("Shaders/Builtin/Functions/isEmpty",[],function(){"use strict";return"bool czm_isEmpty(czm_raySegment interval)\n{\nreturn (interval.stop < 0.0);\n}\n"}),i("Shaders/Builtin/Functions/isFull",[],function(){"use strict";return"bool czm_isFull(czm_raySegment interval)\n{\nreturn (interval.start == 0.0 && interval.stop == czm_infinity);\n}\n"}),i("Shaders/Builtin/Functions/latitudeToWebMercatorFraction",[],function(){"use strict";return"float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorYLow, float southMercatorYHigh, float oneOverMercatorHeight)\n{\nfloat sinLatitude = sin(latitude);\nfloat mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\nfloat t1 = 0.0 - southMercatorYLow;\nfloat e = t1 - 0.0;\nfloat t2 = ((-southMercatorYLow - e) + (0.0 - (t1 - e))) + mercatorY - southMercatorYHigh;\nfloat highDifference = t1 + t2;\nfloat lowDifference = t2 - (highDifference - t1);\nreturn highDifference * oneOverMercatorHeight + lowDifference * oneOverMercatorHeight;\n}\n"}),i("Shaders/Builtin/Functions/luminance",[],function(){"use strict";return"float czm_luminance(vec3 rgb)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nreturn dot(rgb, W);\n}\n"}),i("Shaders/Builtin/Functions/modelToWindowCoordinates",[],function(){"use strict";return"vec4 czm_modelToWindowCoordinates(vec4 position)\n{\nvec4 q = czm_modelViewProjection * position;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n"}),i("Shaders/Builtin/Functions/multiplyWithColorBalance",[],function(){"use strict";return"vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 target = left * right;\nfloat leftLuminance = dot(left, W);\nfloat rightLuminance = dot(right, W);\nfloat targetLuminance = dot(target, W);\nreturn ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n}\n" -}),i("Shaders/Builtin/Functions/nearFarScalar",[],function(){"use strict";return"float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n{\nfloat valueAtMin = nearFarScalar.y;\nfloat valueAtMax = nearFarScalar.w;\nfloat nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\nfloat farDistanceSq = nearFarScalar.z * nearFarScalar.z;\nfloat t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\nt = pow(clamp(t, 0.0, 1.0), 0.2);\nreturn mix(valueAtMin, valueAtMax, t);\n}\n"}),i("Shaders/Builtin/Functions/octDecode",[],function(){"use strict";return"vec3 czm_octDecode(vec2 encoded)\n{\nencoded = encoded / 255.0 * 2.0 - 1.0;\nvec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\nif (v.z < 0.0)\n{\nv.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n}\nreturn normalize(v);\n}\nvec3 czm_octDecode(float encoded)\n{\nfloat temp = encoded / 256.0;\nfloat x = floor(temp);\nfloat y = (temp - x) * 256.0;\nreturn czm_octDecode(vec2(x, y));\n}\nvoid czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)\n{\nfloat temp = encoded.x / 65536.0;\nfloat x = floor(temp);\nfloat encodedFloat1 = (temp - x) * 65536.0;\ntemp = encoded.y / 65536.0;\nfloat y = floor(temp);\nfloat encodedFloat2 = (temp - y) * 65536.0;\nvector1 = czm_octDecode(encodedFloat1);\nvector2 = czm_octDecode(encodedFloat2);\nvector3 = czm_octDecode(vec2(x, y));\n}\n"}),i("Shaders/Builtin/Functions/packDepth",[],function(){"use strict";return"vec4 czm_packDepth(float depth)\n{\nvec4 enc = vec4(1.0, 255.0, 65025.0, 160581375.0) * depth;\nenc = fract(enc);\nenc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\nreturn enc;\n}\n"}),i("Shaders/Builtin/Functions/phong",[],function(){"use strict";return"float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n{\nreturn czm_getLambertDiffuse(lightDirectionEC, material.normal);\n}\nfloat czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n{\nreturn czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n}\nvec4 czm_phong(vec3 toEye, czm_material material)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n}\nfloat specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material) + czm_private_getSpecularOfMaterial(czm_moonDirectionEC, toEye, material);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse;\ncolor += material.specular * specular;\nreturn vec4(color, material.alpha);\n}\nvec4 czm_private_phong(vec3 toEye, czm_material material)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(czm_sunDirectionEC, material);\nfloat specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material);\nvec3 ambient = vec3(0.0);\nvec3 color = ambient + material.emission;\ncolor += material.diffuse * diffuse;\ncolor += material.specular * specular;\nreturn vec4(color, material.alpha);\n}\n"}),i("Shaders/Builtin/Functions/pointAlongRay",[],function(){"use strict";return"vec3 czm_pointAlongRay(czm_ray ray, float time)\n{\nreturn ray.origin + (time * ray.direction);\n}\n"}),i("Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval",[],function(){"use strict";return"czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, czm_ellipsoid ellipsoid)\n{\nvec3 q = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\nvec3 w = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\nq = q - ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ellipsoid.center, 1.0)).xyz;\nfloat q2 = dot(q, q);\nfloat qw = dot(q, w);\nif (q2 > 1.0)\n{\nif (qw >= 0.0)\n{\nreturn czm_emptyRaySegment;\n}\nelse\n{\nfloat qw2 = qw * qw;\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nif (qw2 < product)\n{\nreturn czm_emptyRaySegment;\n}\nelse if (qw2 > product)\n{\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nfloat root0 = temp / w2;\nfloat root1 = difference / temp;\nif (root0 < root1)\n{\nczm_raySegment i = czm_raySegment(root0, root1);\nreturn i;\n}\nelse\n{\nczm_raySegment i = czm_raySegment(root1, root0);\nreturn i;\n}\n}\nelse\n{\nfloat root = sqrt(difference / w2);\nczm_raySegment i = czm_raySegment(root, root);\nreturn i;\n}\n}\n}\nelse if (q2 < 1.0)\n{\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nczm_raySegment i = czm_raySegment(0.0, temp / w2);\nreturn i;\n}\nelse\n{\nif (qw < 0.0)\n{\nfloat w2 = dot(w, w);\nczm_raySegment i = czm_raySegment(0.0, -qw / w2);\nreturn i;\n}\nelse\n{\nreturn czm_emptyRaySegment;\n}\n}\n}\n"}),i("Shaders/Builtin/Functions/saturation",[],function(){"use strict";return"vec3 czm_saturation(vec3 rgb, float adjustment)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 intensity = vec3(dot(rgb, W));\nreturn mix(intensity, rgb, adjustment);\n}\n"}),i("Shaders/Builtin/Functions/signNotZero",[],function(){"use strict";return"float czm_signNotZero(float value)\n{\nreturn value >= 0.0 ? 1.0 : -1.0;\n}\nvec2 czm_signNotZero(vec2 value)\n{\nreturn vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n}\nvec3 czm_signNotZero(vec3 value)\n{\nreturn vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n}\nvec4 czm_signNotZero(vec4 value)\n{\nreturn vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n}\n"}),i("Shaders/Builtin/Functions/tangentToEyeSpaceMatrix",[],function(){"use strict";return"mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 binormalEC)\n{\nvec3 normal = normalize(normalEC);\nvec3 tangent = normalize(tangentEC);\nvec3 binormal = normalize(binormalEC);\nreturn mat3(tangent.x, tangent.y, tangent.z,\nbinormal.x, binormal.y, binormal.z,\nnormal.x, normal.y, normal.z);\n}\n"}),i("Shaders/Builtin/Functions/translateRelativeToEye",[],function(){"use strict";return"vec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n{\nvec3 highDifference = high - czm_encodedCameraPositionMCHigh;\nvec3 lowDifference = low - czm_encodedCameraPositionMCLow;\nreturn vec4(highDifference + lowDifference, 1.0);\n}\n"}),i("Shaders/Builtin/Functions/translucentPhong",[],function(){"use strict";return"vec4 czm_translucentPhong(vec3 toEye, czm_material material)\n{\nfloat diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n}\ndiffuse = clamp(diffuse, 0.0, 1.0);\nfloat specular = czm_getSpecular(czm_sunDirectionEC, toEye, material.normal, material.shininess);\nspecular += czm_getSpecular(czm_moonDirectionEC, toEye, material.normal, material.shininess);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse;\ncolor += material.specular * specular;\nreturn vec4(color, material.alpha);\n}\n"}),i("Shaders/Builtin/Functions/transpose",[],function(){"use strict";return"mat2 czm_transpose(mat2 matrix)\n{\nreturn mat2(\nmatrix[0][0], matrix[1][0],\nmatrix[0][1], matrix[1][1]);\n}\nmat3 czm_transpose(mat3 matrix)\n{\nreturn mat3(\nmatrix[0][0], matrix[1][0], matrix[2][0],\nmatrix[0][1], matrix[1][1], matrix[2][1],\nmatrix[0][2], matrix[1][2], matrix[2][2]);\n}\nmat4 czm_transpose(mat4 matrix)\n{\nreturn mat4(\nmatrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\nmatrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\nmatrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\nmatrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n}\n"}),i("Shaders/Builtin/Functions/unpackDepth",[],function(){"use strict";return"float czm_unpackDepth(vec4 packedDepth)\n{\nreturn dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0));\n}\n"}),i("Shaders/Builtin/Functions/windowToEyeCoordinates",[],function(){"use strict";return"vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n{\nfloat x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\nfloat y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\nfloat z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nvec4 q = vec4(x, y, z, 1.0);\nq /= fragmentCoordinate.w;\nq = czm_inverseProjection * q;\nreturn q;\n}\n"}),i("Shaders/Builtin/CzmBuiltins",["./Constants/degreesPerRadian","./Constants/depthRange","./Constants/epsilon1","./Constants/epsilon2","./Constants/epsilon3","./Constants/epsilon4","./Constants/epsilon5","./Constants/epsilon6","./Constants/epsilon7","./Constants/infinity","./Constants/oneOverPi","./Constants/oneOverTwoPi","./Constants/pi","./Constants/piOverFour","./Constants/piOverSix","./Constants/piOverThree","./Constants/piOverTwo","./Constants/radiansPerDegree","./Constants/sceneMode2D","./Constants/sceneMode3D","./Constants/sceneModeColumbusView","./Constants/sceneModeMorphing","./Constants/solarRadius","./Constants/threePiOver2","./Constants/twoPi","./Constants/webMercatorMaxLatitude","./Structs/depthRangeStruct","./Structs/ellipsoid","./Structs/material","./Structs/materialInput","./Structs/ray","./Structs/raySegment","./Functions/RGBToXYZ","./Functions/XYZToRGB","./Functions/alphaWeight","./Functions/antialias","./Functions/columbusViewMorph","./Functions/computePosition","./Functions/cosineAndSine","./Functions/decompressTextureCoordinates","./Functions/eastNorthUpToEyeCoordinates","./Functions/ellipsoidContainsPoint","./Functions/ellipsoidNew","./Functions/ellipsoidWgs84TextureCoordinates","./Functions/equalsEpsilon","./Functions/eyeOffset","./Functions/eyeToWindowCoordinates","./Functions/geodeticSurfaceNormal","./Functions/getDefaultMaterial","./Functions/getLambertDiffuse","./Functions/getSpecular","./Functions/getWaterNoise","./Functions/getWgs84EllipsoidEC","./Functions/hue","./Functions/isEmpty","./Functions/isFull","./Functions/latitudeToWebMercatorFraction","./Functions/luminance","./Functions/modelToWindowCoordinates","./Functions/multiplyWithColorBalance","./Functions/nearFarScalar","./Functions/octDecode","./Functions/packDepth","./Functions/phong","./Functions/pointAlongRay","./Functions/rayEllipsoidIntersectionInterval","./Functions/saturation","./Functions/signNotZero","./Functions/tangentToEyeSpaceMatrix","./Functions/translateRelativeToEye","./Functions/translucentPhong","./Functions/transpose","./Functions/unpackDepth","./Functions/windowToEyeCoordinates"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B,z,k,V,U,W,G,H,q,j,Y,X,Z,J,Q,K,$,et,tt,it,rt,nt,ot,at,st,lt,ut,ct,ht,dt,pt,mt,ft,vt,gt,_t,yt){"use strict";return{czm_degreesPerRadian:e,czm_depthRange:t,czm_epsilon1:i,czm_epsilon2:r,czm_epsilon3:n,czm_epsilon4:o,czm_epsilon5:a,czm_epsilon6:s,czm_epsilon7:l,czm_infinity:u,czm_oneOverPi:c,czm_oneOverTwoPi:h,czm_pi:d,czm_piOverFour:p,czm_piOverSix:m,czm_piOverThree:f,czm_piOverTwo:v,czm_radiansPerDegree:g,czm_sceneMode2D:_,czm_sceneMode3D:y,czm_sceneModeColumbusView:C,czm_sceneModeMorphing:w,czm_solarRadius:S,czm_threePiOver2:E,czm_twoPi:b,czm_webMercatorMaxLatitude:x,czm_depthRangeStruct:T,czm_ellipsoid:P,czm_material:A,czm_materialInput:D,czm_ray:M,czm_raySegment:I,czm_RGBToXYZ:O,czm_XYZToRGB:R,czm_alphaWeight:L,czm_antialias:N,czm_columbusViewMorph:F,czm_computePosition:B,czm_cosineAndSine:z,czm_decompressTextureCoordinates:k,czm_eastNorthUpToEyeCoordinates:V,czm_ellipsoidContainsPoint:U,czm_ellipsoidNew:W,czm_ellipsoidWgs84TextureCoordinates:G,czm_equalsEpsilon:H,czm_eyeOffset:q,czm_eyeToWindowCoordinates:j,czm_geodeticSurfaceNormal:Y,czm_getDefaultMaterial:X,czm_getLambertDiffuse:Z,czm_getSpecular:J,czm_getWaterNoise:Q,czm_getWgs84EllipsoidEC:K,czm_hue:$,czm_isEmpty:et,czm_isFull:tt,czm_latitudeToWebMercatorFraction:it,czm_luminance:rt,czm_modelToWindowCoordinates:nt,czm_multiplyWithColorBalance:ot,czm_nearFarScalar:at,czm_octDecode:st,czm_packDepth:lt,czm_phong:ut,czm_pointAlongRay:ct,czm_rayEllipsoidIntersectionInterval:ht,czm_saturation:dt,czm_signNotZero:pt,czm_tangentToEyeSpaceMatrix:mt,czm_translateRelativeToEye:ft,czm_translucentPhong:vt,czm_transpose:gt,czm_unpackDepth:_t,czm_windowToEyeCoordinates:yt}}),i("Renderer/AutomaticUniforms",["../Core/Cartesian3","../Core/Matrix4"],function(e,t){"use strict";var i=new e,r=function(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue};if("undefined"==typeof WebGLRenderingContext)return{};var n={};n[WebGLRenderingContext.FLOAT]="float",n[WebGLRenderingContext.FLOAT_VEC2]="vec2",n[WebGLRenderingContext.FLOAT_VEC3]="vec3",n[WebGLRenderingContext.FLOAT_VEC4]="vec4",n[WebGLRenderingContext.INT]="int",n[WebGLRenderingContext.INT_VEC2]="ivec2",n[WebGLRenderingContext.INT_VEC3]="ivec3",n[WebGLRenderingContext.INT_VEC4]="ivec4",n[WebGLRenderingContext.BOOL]="bool",n[WebGLRenderingContext.BOOL_VEC2]="bvec2",n[WebGLRenderingContext.BOOL_VEC3]="bvec3",n[WebGLRenderingContext.BOOL_VEC4]="bvec4",n[WebGLRenderingContext.FLOAT_MAT2]="mat2",n[WebGLRenderingContext.FLOAT_MAT3]="mat3",n[WebGLRenderingContext.FLOAT_MAT4]="mat4",n[WebGLRenderingContext.SAMPLER_2D]="sampler2D",n[WebGLRenderingContext.SAMPLER_CUBE]="samplerCube",r.prototype.getDeclaration=function(e){var t="uniform "+n[this._datatype]+" "+e,i=this._size;return t+=1===i?";":"["+i.toString()+"];"};var o={czm_viewport:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new r({size:1,datatype:WebGLRenderingContext.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_inverseProjectionOIT:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseProjectionOIT}}),czm_infiniteProjection:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_normal:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight2D:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_sunPositionWC:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_encodedCameraPositionMCHigh:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new r({size:1,datatype:WebGLRenderingContext.FLOAT_VEC3,getValue:function(e){return t.getTranslation(e.inverseView,i)}}),czm_frameNumber:new r({size:1,datatype:WebGLRenderingContext.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new r({size:1,datatype:WebGLRenderingContext.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new r({size:1,datatype:WebGLRenderingContext.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_temeToPseudoFixed:new r({size:1,datatype:WebGLRenderingContext.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_resolutionScale:new r({size:1,datatype:WebGLRenderingContext.FLOAT,getValue:function(e){return e.resolutionScale}})};return o}),i("Renderer/ShaderSource",["../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Shaders/Builtin/CzmBuiltins","./AutomaticUniforms"],function(e,t,i,r,n){"use strict";function o(e){return e.replace(/\/\*\*[\s\S]*?\*\//gm,function(e){for(var t=e.match(/\n/gm).length,i="",r=0;t>r;++r)i+="\n";return i})}function a(e,i,r){for(var n,a=0;a0;){var n=e.pop();r.push(n),0===n.requiredBy.length&&t.push(n)}for(;t.length>0;){var o=t.shift();e.push(o);for(var a=0;a=0;--n)r=r+t[n].glslSource+"\n";return r.replace(i.glslSource,"")}function c(e,r){var n,a,s="",l=e.sources;if(t(l))for(n=0,a=l.length;a>n;++n)s+="\n#line 0\n"+l[n];s=o(s);var c;s=s.replace(/#version\s+(.*?)\n/gm,function(e,r){if(t(c)&&c!==r)throw new i("inconsistent versions found: "+c+" and "+r);return c=r,"\n"});var h=e.pickColorQualifier;t(h)&&(s=s.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,"void czm_old_main()"),s+="\n"+h+" vec4 czm_pickColor;\nvoid main()\n{\n czm_old_main();\n if (gl_FragColor.a == 0.0) {\n discard;\n }\n gl_FragColor = czm_pickColor;\n}");var d="";t(c)&&(d="#version "+c),r&&(d+="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n\n");var p=e.defines;if(t(p))for(n=0,a=p.length;a>n;++n){var m=p[n];0!==m.length&&(d+="#define "+m+"\n")}return e.includeBuiltIns&&(d+=u(s)),d+="\n#line 0\n",d+=s}var h=function(i){i=e(i,e.EMPTY_OBJECT);var r=i.pickColorQualifier;this.defines=t(i.defines)?i.defines.slice(0):[],this.sources=t(i.sources)?i.sources.slice(0):[],this.pickColorQualifier=r,this.includeBuiltIns=e(i.includeBuiltIns,!0)};h.prototype.clone=function(){return new h({sources:this.sources,defines:this.defines,pickColorQuantifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})},h.prototype.createCombinedVertexShader=function(){return c(this,!1)},h.prototype.createCombinedFragmentShader=function(){return c(this,!0)},h._czmBuiltinsAndUniforms={};for(var d in r)r.hasOwnProperty(d)&&(h._czmBuiltinsAndUniforms[d]=r[d]);for(var p in n)if(n.hasOwnProperty(p)){var m=n[p];"function"==typeof m.getDeclaration&&(h._czmBuiltinsAndUniforms[p]=m.getDeclaration(p))}return h}),i("Renderer/VertexArrayFacade",["../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Math","./BufferUsage"],function(e,t,i,r,n,o,a){"use strict";function s(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;var r=t.vertexBuffer,n=e._size*t.vertexSizeInBytes,o=i(r);if(!o||r.sizeInBytes0){var r=e.vertexSizeInBytes*t,n=e.vertexSizeInBytes*i;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,r,n),r)}}function u(e){var t=e.va;if(i(t)){for(var r=t.length,n=0;r>n;++n)t[n].va.destroy();e.va=void 0}}var c=function(t,r,n){function o(t,i){return e.getSizeInBytes(i.componentDatatype)-e.getSizeInBytes(t.componentDatatype)}var s=c._verifyAttributes(r);n=n||0;for(var l,u,h=[],d={},p=s.length,m=0;p>m;++m){var f=s[m];f.vertexBuffer?h.push(f):(u=f.usage,l=d[u],i(l)||(l=d[u]=[]),l.push(f))}this._buffersByUsage={},this._allBuffers=[];for(u in d)if(d.hasOwnProperty(u)){l=d[u],l.sort(o);var v,g=c._vertexSizeInBytes(l);switch(Number(u)){case a.STATIC_DRAW:v=a.STATIC_DRAW;break;case a.STREAM_DRAW:v=a.STREAM_DRAW;break;case a.DYNAMIC_DRAW:v=a.DYNAMIC_DRAW}var _={vertexSizeInBytes:g,vertexBuffer:void 0,usage:v,needsCommit:!1,arrayBuffer:void 0,arrayViews:c._createArrayViews(l,g)};this._buffersByUsage[u]=_,this._allBuffers.push(_)}this._size=0,this._precreated=h,this._context=t,this.writers=void 0,this.va=void 0,this.resize(n)};c._verifyAttributes=function(i){for(var r=[],o=0;on;++n){var o=t[n];i+=o.componentsPerAttribute*e.getSizeInBytes(o.componentDatatype)}var a=r>0?e.getSizeInBytes(t[0].componentDatatype):0,s=a>0?i%a:0,l=0===s?0:a-s;return i+=l},c._createArrayViews=function(t,i){for(var r=[],n=0,o=t.length,a=0;o>a;++a){var s=t[a],l=s.componentDatatype;r.push({index:s.index,enabled:s.enabled,componentsPerAttribute:s.componentsPerAttribute,componentDatatype:l,normalize:s.normalize,offsetInBytes:n,vertexSizeInComponentType:i/e.getSizeInBytes(l),view:void 0}),n+=s.componentsPerAttribute*e.getSizeInBytes(l)}return r},c.prototype.resize=function(e){this._size=e;var t=this._allBuffers;this.writers=[];for(var i=0,r=t.length;r>i;++i){var n=t[i];c._resize(n,this._size),c._appendWriters(this.writers,n)}u(this)},c._resize=function(t,r){if(t.vertexSizeInBytes>0){var n=new ArrayBuffer(r*t.vertexSizeInBytes);if(i(t.arrayBuffer))for(var o=new Uint8Array(n),a=new Uint8Array(t.arrayBuffer),s=a.length,l=0;s>l;++l)o[l]=a[l];for(var u=t.arrayViews,c=u.length,h=0;c>h;++h){var d=u[h];d.view=e.createArrayBufferView(d.componentDatatype,n,d.offsetInBytes)}t.arrayBuffer=n}};var h=[function(e,t,i){return function(r,n){t[r*i]=n,e.needsCommit=!0}},function(e,t,i){return function(r,n,o){var a=r*i;t[a]=n,t[a+1]=o,e.needsCommit=!0}},function(e,t,i){return function(r,n,o,a){var s=r*i;t[s]=n,t[s+1]=o,t[s+2]=a,e.needsCommit=!0}},function(e,t,i){return function(r,n,o,a,s){var l=r*i;t[l]=n,t[l+1]=o,t[l+2]=a,t[l+3]=s,e.needsCommit=!0}}];return c._appendWriters=function(e,t){for(var i=t.arrayViews,r=i.length,n=0;r>n;++n){var o=i[n];e[o.index]=h[o.componentsPerAttribute-1](t,o.view,o.vertexSizeInComponentType)}},c.prototype.commit=function(e){for(var t,r=!1,n=this._allBuffers,a=0,l=n.length;l>a;++a)t=n[a],r=s(this,t)||r;if(r||!i(this.va)){var h=this._buffersByUsage;u(this);for(var d=this.va=[],p=i(e)?Math.ceil(this._size/o.SIXTY_FOUR_KILOBYTES):1,m=0;p>m;++m){var f=[];for(var v in h)h.hasOwnProperty(v)&&(t=h[v],c._appendAttributes(f,t,m*t.vertexSizeInBytes*o.SIXTY_FOUR_KILOBYTES));f=f.concat(this._precreated),d.push({va:this._context.createVertexArray(f,e),indicesCount:1.5*(m!==p-1?o.SIXTY_FOUR_KILOBYTES:this._size%o.SIXTY_FOUR_KILOBYTES)})}}},c._appendAttributes=function(e,t,i){for(var r=t.arrayViews,n=r.length,o=0;n>o;++o){var a=r[o];e.push({index:a.index,enabled:a.enabled,componentsPerAttribute:a.componentsPerAttribute,componentDatatype:a.componentDatatype,normalize:a.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:i+a.offsetInBytes,strideInBytes:t.vertexSizeInBytes})}},c.prototype.subCommit=function(e,t){for(var i=this._allBuffers,r=0,n=i.length;n>r;++r)l(i[r],e,t)},c.prototype.endSubCommits=function(){for(var e=this._allBuffers,t=0,i=e.length;i>t;++t)e[t].needsCommit=!1},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){for(var e=this._allBuffers,t=0,i=e.length;i>t;++t){var n=e[t];n.vertexBuffer=n.vertexBuffer&&n.vertexBuffer.destroy()}return u(this),r(this)},c}),i("Shaders/BillboardCollectionFS",[],function(){"use strict";return"uniform sampler2D u_atlas;\nvarying vec2 v_textureCoordinates;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#else\nvarying vec4 v_color;\n#endif\nvoid main()\n{\n#ifdef RENDER_FOR_PICK\nvec4 vertexColor = vec4(1.0, 1.0, 1.0, 1.0);\n#else\nvec4 vertexColor = v_color;\n#endif\nvec4 color = texture2D(u_atlas, v_textureCoordinates) * vertexColor;\nif (color.a == 0.0)\n{\ndiscard;\n}\n#ifdef RENDER_FOR_PICK\ngl_FragColor = v_pickColor;\n#else\ngl_FragColor = color;\n#endif\n}\n"}),i("Shaders/BillboardCollectionVS",[],function(){"use strict";return"attribute vec4 positionHighAndScale;\nattribute vec4 positionLowAndRotation;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 compressedAttribute2;\nattribute vec3 eyeOffset;\nattribute vec4 scaleByDistance;\nattribute vec4 pixelOffsetScaleByDistance;\nvarying vec2 v_textureCoordinates;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#else\nvarying vec4 v_color;\n#endif\nconst float UPPER_BOUND = 32768.0;\nconst float SHIFT_LEFT16 = 65536.0;\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_LEFT7 = 128.0;\nconst float SHIFT_LEFT5 = 32.0;\nconst float SHIFT_LEFT3 = 8.0;\nconst float SHIFT_LEFT2 = 4.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nconst float SHIFT_RIGHT7 = 1.0 / 128.0;\nconst float SHIFT_RIGHT5 = 1.0 / 32.0;\nconst float SHIFT_RIGHT3 = 1.0 / 8.0;\nconst float SHIFT_RIGHT2 = 1.0 / 4.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nvec4 computePositionWindowCoordinates(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, float rotation)\n{\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nvec2 halfSize = imageSize * scale * czm_resolutionScale;\nhalfSize *= ((direction * 2.0) - 1.0);\npositionWC.xy += (origin * abs(halfSize));\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nif (!all(equal(alignedAxis, vec3(0.0))) || rotation != 0.0)\n{\nfloat angle = rotation;\nif (!all(equal(alignedAxis, vec3(0.0))))\n{\nvec3 pos = positionEC.xyz + czm_encodedCameraPositionMCHigh + czm_encodedCameraPositionMCLow;\nvec3 normal = normalize(cross(alignedAxis, pos));\nvec4 tangent = vec4(normalize(cross(pos, normal)), 0.0);\ntangent = czm_modelViewProjection * tangent;\nangle += sign(-tangent.x) * acos(tangent.y / length(tangent.xy));\n}\nfloat cosTheta = cos(angle);\nfloat sinTheta = sin(angle);\nmat2 rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\nhalfSize = rotationMatrix * halfSize;\n}\n#endif\npositionWC.xy += halfSize;\npositionWC.xy += translate;\npositionWC.xy += (pixelOffset * czm_resolutionScale);\nreturn positionWC;\n}\nvoid main()\n{\nvec3 positionHigh = positionHighAndScale.xyz;\nvec3 positionLow = positionLowAndRotation.xyz;\nfloat scale = positionHighAndScale.w;\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nfloat rotation = positionLowAndRotation.w;\n#else\nfloat rotation = 0.0;\n#endif\nfloat compressed = compressedAttribute0.x;\nvec2 pixelOffset;\npixelOffset.x = floor(compressed * SHIFT_RIGHT7);\ncompressed -= pixelOffset.x * SHIFT_LEFT7;\npixelOffset.x -= UPPER_BOUND;\nvec2 origin;\norigin.x = floor(compressed * SHIFT_RIGHT5);\ncompressed -= origin.x * SHIFT_LEFT5;\norigin.y = floor(compressed * SHIFT_RIGHT3);\ncompressed -= origin.y * SHIFT_LEFT3;\norigin -= vec2(1.0);\nfloat show = floor(compressed * SHIFT_RIGHT2);\ncompressed -= show * SHIFT_LEFT2;\nvec2 direction;\ndirection.x = floor(compressed * SHIFT_RIGHT1);\ndirection.y = compressed - direction.x * SHIFT_LEFT1;\nfloat temp = compressedAttribute0.y * SHIFT_RIGHT8;\npixelOffset.y = -(floor(temp) - UPPER_BOUND);\nvec2 translate;\ntranslate.y = (temp - floor(temp)) * SHIFT_LEFT16;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\ntranslate.x = floor(temp) - UPPER_BOUND;\ntranslate.y += (temp - floor(temp)) * SHIFT_LEFT8;\ntranslate.y -= UPPER_BOUND;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);\ntemp = compressedAttribute1.x * SHIFT_RIGHT8;\nvec2 imageSize = vec2(floor(temp), compressedAttribute2.w);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\n#ifdef ALIGNED_AXIS\nvec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));\n#else\nvec3 alignedAxis = vec3(0.0);\n#endif\n#ifdef RENDER_FOR_PICK\ntemp = compressedAttribute2.y;\n#else\ntemp = compressedAttribute2.x;\n#endif\nvec4 color;\ntemp = temp * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute2.z * SHIFT_RIGHT8;\n#ifdef RENDER_FOR_PICK\ncolor.a = (temp - floor(temp)) * SHIFT_LEFT8;\nvec4 pickColor = color / 255.0;\n#else\ncolor.a = floor(temp);\ncolor /= 255.0;\n#endif\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC = czm_eyeOffset(positionEC, eyeOffset);\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\nscale *= czm_nearFarScalar(scaleByDistance, lengthSq);\nif (scale == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\n#ifdef EYE_DISTANCE_PIXEL_OFFSET\nfloat pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);\npixelOffset *= pixelOffsetScale;\n#endif\n#ifdef CLAMPED_TO_GROUND\npositionEC.z *= 0.995;\norigin.y = 1.0;\n#endif\nvec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, rotation);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\nv_textureCoordinates = textureCoordinates;\n#ifdef RENDER_FOR_PICK\nv_pickColor = pickColor;\n#else\nv_color = color;\nv_color.a *= translucency;\n#endif\n}\n" -}),i("Scene/HeightReference",["../Core/freezeObject"],function(e){"use strict";var t={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2};return e(t)}),i("Scene/HorizontalOrigin",["../Core/freezeObject"],function(e){"use strict";var t={CENTER:0,LEFT:1,RIGHT:-1};return e(t)}),i("Scene/SceneMode",["../Core/freezeObject"],function(e){"use strict";var t={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3};return t.getMorphTime=function(e){return e===t.SCENE3D?1:e===t.MORPHING?void 0:0},e(t)}),i("Scene/SceneTransforms",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defined","../Core/DeveloperError","../Core/Math","../Core/Matrix4","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u){"use strict";var c={},h=new r(0,0,0,1),d=new r,p=new l;c.wgs84ToWindowCoordinates=function(e,t,i){var n=c.computeActualWgs84Position(e.frameState,t,h);if(!o(n))return void 0;var a=e.camera,s=l.multiply(a.frustum.projectionMatrix,a.viewMatrix,p);return l.multiplyByVector(s,r.fromElements(n.x,n.y,n.z,1,d),d),d.z<0&&e.mode!==u.SCENE2D?void 0:(i=c.clipToGLWindowCoordinates(e,d,i),i.y=e.canvas.clientHeight-i.y,i)},c.wgs84ToDrawingBufferCoordinates=function(e,t,i){var n=c.computeActualWgs84Position(e.frameState,t,h);if(!o(n))return void 0;var a=e.camera,s=l.multiply(a.frustum.projectionMatrix,a.viewMatrix,p);return l.multiplyByVector(s,r.fromElements(n.x,n.y,n.z,1,d),d),d.z<0&&e.mode!==u.SCENE2D?void 0:c.clipToDrawingBufferCoordinates(e,d,i)};var m=new i,f=new n;c.computeActualWgs84Position=function(e,t,r){var n=e.mode;if(n===u.SCENE3D)return i.clone(t,r);var a=e.mapProjection,l=a.ellipsoid.cartesianToCartographic(t,f);if(!o(l))return void 0;if(a.project(l,m),n===u.COLUMBUS_VIEW)return i.fromElements(m.z,m.x,m.y,r);if(n===u.SCENE2D)return i.fromElements(0,m.x,m.y,r);var c=e.morphTime;return i.fromElements(s.lerp(m.z,t.x,c),s.lerp(m.x,t.y,c),s.lerp(m.y,t.z,c),r)};var v=new i,g=new i,_=new e,y=new l;c.clipToGLWindowCoordinates=function(e,r,n){var o=e.canvas;return i.divideByScalar(r,r.w,v),_.width=o.clientWidth,_.height=o.clientHeight,l.computeViewportTransformation(_,0,1,y),l.multiplyByPoint(y,v,g),t.fromCartesian3(g,n)},c.clipToDrawingBufferCoordinates=function(e,r,n){return i.divideByScalar(r,r.w,v),_.width=e.drawingBufferWidth,_.height=e.drawingBufferHeight,l.computeViewportTransformation(_,0,1,y),l.multiplyByPoint(y,v,g),t.fromCartesian3(g,n)},c.transformWindowToDrawingBuffer=function(e,i,r){var n=e.canvas,o=e.drawingBufferWidth/n.clientWidth,a=e.drawingBufferHeight/n.clientHeight;return t.fromElements(i.x*o,i.y*a,r)};var C=new r,w=new r;return c.drawingBufferToWgs84Coordinates=function(e,t,n,o){var a=e.context,s=a.uniformState,u=s.viewport;s.viewportTransformation;var c=r.clone(r.UNIT_W,C);c.x=2*((t.x-u.x)/u.width)-1,c.y=2*((t.y-u.y)/u.height)-1,c.z=2*n-1,c.w=1;var h=l.multiplyByVector(s.inverseViewProjection,c,w),d=1/h.w;return i.multiplyByScalar(h,d,h),i.fromCartesian4(h,o)},c}),i("Scene/VerticalOrigin",["../Core/freezeObject"],function(e){"use strict";var t={CENTER:0,BOTTOM:1,TOP:-1};return e(t)}),i("Scene/Billboard",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/NearFarScalar","./HeightReference","./HorizontalOrigin","./SceneMode","./SceneTransforms","./VerticalOrigin"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(e,t){var i=e._billboardCollection;l(i)&&(i._updateBillboard(e,t),e._dirty=!0)}var y=function(e,r){e=s(e,s.EMPTY_OBJECT),this._show=s(e.show,!0),this._position=i.clone(s(e.position,i.ZERO)),this._actualPosition=i.clone(this._position),this._pixelOffset=t.clone(s(e.pixelOffset,t.ZERO)),this._translate=new t(0,0),this._eyeOffset=i.clone(s(e.eyeOffset,i.ZERO)),this._verticalOrigin=s(e.verticalOrigin,g.CENTER),this._horizontalOrigin=s(e.horizontalOrigin,m.CENTER),this._scale=s(e.scale,1),this._color=o.clone(s(e.color,o.WHITE)),this._rotation=s(e.rotation,0),this._alignedAxis=i.clone(s(e.alignedAxis,i.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=e.scaleByDistance,this._translucencyByDistance=e.translucencyByDistance,this._pixelOffsetScaleByDistance=e.pixelOffsetScaleByDistance,this._heightReference=s(e.heightReference,p.NONE),this._id=e.id,this._collection=s(e.collection,r),this._pickId=void 0,this._pickPrimitive=s(e._pickPrimitive,this),this._billboardCollection=r,this._dirty=!1,this._index=-1,this._imageIndex=-1,this._imageIndexPromise=void 0,this._imageId=void 0,this._image=void 0,this._imageSubRegion=void 0,this._imageWidth=void 0,this._imageHeight=void 0;var n=e.image,u=e.imageId;l(n)&&(l(u)||(u="string"==typeof n?n:l(n.src)?n.src:a()),this._imageId=u,this._image=n),l(e.imageSubRegion)&&(this._imageId=u,this._imageSubRegion=e.imageSubRegion),l(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=f.SCENE3D,this._updateClamping()},C=y.SHOW_INDEX=0,w=y.POSITION_INDEX=1,S=y.PIXEL_OFFSET_INDEX=2,E=y.EYE_OFFSET_INDEX=3,b=y.HORIZONTAL_ORIGIN_INDEX=4,x=y.VERTICAL_ORIGIN_INDEX=5,T=y.SCALE_INDEX=6,P=y.IMAGE_INDEX_INDEX=7,A=y.COLOR_INDEX=8,D=y.ROTATION_INDEX=9,M=y.ALIGNED_AXIS_INDEX=10,I=y.SCALE_BY_DISTANCE_INDEX=11,O=y.TRANSLUCENCY_BY_DISTANCE_INDEX=12,R=y.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13;y.NUMBER_OF_PROPERTIES=14,u(y.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,_(this,C))}},position:{get:function(){return this._position},set:function(e){var t=this._position;i.equals(t,e)||(i.clone(e,t),i.clone(e,this._actualPosition),this._updateClamping(),_(this,w))}},heightReference:{get:function(){return this._heightReference},set:function(e){var t=this._heightReference;e!==t&&(this._heightReference=e,this._updateClamping(),_(this,w))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){var i=this._pixelOffset;t.equals(i,e)||(t.clone(e,i),_(this,S))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;d.equals(t,e)||(this._scaleByDistance=d.clone(e,t),_(this,I))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;d.equals(t,e)||(this._translucencyByDistance=d.clone(e,t),_(this,O))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){var t=this._pixelOffsetScaleByDistance;d.equals(t,e)||(this._pixelOffsetScaleByDistance=d.clone(e,t),_(this,R))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){var t=this._eyeOffset;i.equals(t,e)||(i.clone(e,t),_(this,E))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,_(this,b))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin!==e&&(this._verticalOrigin=e,_(this,x))}},scale:{get:function(){return this._scale},set:function(e){this._scale!==e&&(this._scale=e,_(this,T))}},color:{get:function(){return this._color},set:function(e){var t=this._color;o.equals(t,e)||(o.clone(e,t),_(this,A))}},rotation:{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,_(this,D))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){var t=this._alignedAxis;i.equals(t,e)||(i.clone(e,t),_(this,M))}},width:{get:function(){return s(this._width,this._imageWidth)},set:function(e){this._width!==e&&(this._width=e,_(this,P))}},height:{get:function(){return s(this._height,this._imageHeight)},set:function(e){this._height!==e&&(this._height=e,_(this,P))}},id:{get:function(){return this._id},set:function(e){this._id=e,l(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,l(this._pickId)&&(this._pickId.object.primitive=e)}},image:{get:function(){return this._imageId},set:function(e){l(e)?"string"==typeof e?this.setImage(e,e):l(e.src)?this.setImage(e.src,e):this.setImage(a(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,_(this,P))}},ready:{get:function(){return-1!==this._imageIndex}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=i.clone(e,this._actualClampedPosition),_(this,w)}}}),y.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId},y.prototype._updateClamping=function(){y._updateClamping(this._billboardCollection,this)};var L=new n,N=new i;y._updateClamping=function(e,t){var r=e._scene;if(l(r)){var o=r.globe,a=o.ellipsoid,s=o._surface,u=r.frameState.mode,h=r.frameState.mapProjection,d=u!==t._mode;if(t._mode=u,(t._heightReference===p.NONE||d)&&l(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference!==p.NONE&&l(t._position)){var m=a.cartesianToCartographic(t._position);if(l(m)){l(t._removeCallbackFunc)&&t._removeCallbackFunc();var v=function(e){if(t._heightReference===p.RELATIVE_TO_GROUND)if(t._mode===f.SCENE3D){var r=a.cartesianToCartographic(e,L);r.height+=m.height,a.cartographicToCartesian(r,e)}else e.x+=m.height;t._clampedPosition=i.clone(e,t._clampedPosition)};t._removeCallbackFunc=s.updateHeight(m,v);var g=o.getHeight(m);l(g)&&(n.clone(m,L),L.height=g,t._mode===f.SCENE3D?a.cartographicToCartesian(L,N):(h.project(L,N),i.fromElements(N.z,N.x,N.y,N)),v(N))}}}else if(t._heightReference!==p.NONE)throw new c("Height reference is not supported.")},y.prototype._loadImage=function(){var t,i=this._billboardCollection._textureAtlas,r=this._imageId,n=this._image,o=this._imageSubRegion;if(l(n)&&(t=i.addImage(r,n)),l(o)&&(t=i.addSubRegion(r,o)),this._imageIndexPromise=t,l(t)){var a=this;t.then(function(t){if(a._imageId===r&&a._image===n&&e.equals(a._imageSubRegion,o)){var s=i.textureCoordinates[t];a._imageWidth=i.texture.width*s.width,a._imageHeight=i.texture.height*s.height,a._imageIndex=t,a._ready=!0,a._image=void 0,a._imageIndexPromise=void 0,_(a,P)}}).otherwise(function(e){console.error("Error loading image for billboard: "+e),a._imageIndexPromise=void 0})}},y.prototype.setImage=function(e,t){this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,l(this._billboardCollection._textureAtlas)&&this._loadImage())},y.prototype.setImageSubRegion=function(t,i){this._imageId===t&&e.equals(this._imageSubRegion,i)||(this._imageIndex=-1,this._imageId=t,this._imageSubRegion=e.clone(i),l(this._billboardCollection._textureAtlas)&&this._loadImage())},y.prototype._setTranslate=function(e){var i=this._translate;t.equals(i,e)||(t.clone(e,i),_(this,S))},y.prototype._getActualPosition=function(){return l(this._clampedPosition)?this._clampedPosition:this._actualPosition},y.prototype._setActualPosition=function(e){l(this._clampedPosition)||i.clone(e,this._actualPosition),_(this,w)};var F=new r;y._computeActualPosition=function(e,t,i,r){return l(e._clampedPosition)?(i.mode!==e._mode&&e._updateClamping(),e._clampedPosition):i.mode===f.SCENE3D?t:(h.multiplyByPoint(r,t,F),v.computeActualWgs84Position(i,F))};var B=new h,z=new r,k=new i,V=new t,U=new t;y._computeScreenSpacePosition=function(e,n,o,a,s,l){var u=s.camera,c=u.viewMatrix,d=u.frustum.projectionMatrix,p=h.multiplyTransformation(c,e,B),m=h.multiplyByVector(p,r.fromElements(n.x,n.y,n.z,1,z),z),f=i.multiplyComponents(o,i.normalize(m,k),k);m.x+=o.x+f.x,m.y+=o.y+f.y,m.z+=f.z;var g=h.multiplyByVector(d,m,z),_=v.clipToGLWindowCoordinates(s,g,l);a=t.clone(a,U),a.y=-a.y;var y=t.multiplyByScalar(a,s.context.uniformState.resolutionScale,V);return _.x+=y.x,_.y+=y.y,_};var W=new t(0,0);return y.prototype.computeScreenSpacePosition=function(e,i){var r=this._billboardCollection;l(i)||(i=new t),t.clone(this._pixelOffset,W),t.add(W,this._translate,W);var n=r.modelMatrix,o=this._getActualPosition(),a=y._computeScreenSpacePosition(n,o,this._eyeOffset,W,e,i);return a.y=e.canvas.clientHeight-a.y,a},y.prototype.equals=function(r){return this===r||l(r)&&this._id===r._id&&i.equals(this._position,r._position)&&this._imageId===r._imageId&&this._show===r._show&&this._scale===r._scale&&this._verticalOrigin===r._verticalOrigin&&this._horizontalOrigin===r._horizontalOrigin&&e.equals(this._imageSubRegion,r._imageSubRegion)&&o.equals(this._color,r._color)&&t.equals(this._pixelOffset,r._pixelOffset)&&t.equals(this._translate,r._translate)&&i.equals(this._eyeOffset,r._eyeOffset)&&d.equals(this._scaleByDistance,r._scaleByDistance)&&d.equals(this._translucencyByDistance,r._translucencyByDistance)&&d.equals(this._pixelOffsetScaleByDistance,r._pixelOffsetScaleByDistance)},y.prototype._destroy=function(){l(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0},y}),i("Scene/BlendEquation",["../Core/freezeObject"],function(e){"use strict";var t={ADD:32774,SUBTRACT:32778,REVERSE_SUBTRACT:32779};return e(t)}),i("Scene/BlendFunction",["../Core/freezeObject"],function(e){"use strict";var t={ZERO:0,ONE:1,SOURCE_COLOR:768,ONE_MINUS_SOURCE_COLOR:769,DESTINATION_COLOR:774,ONE_MINUS_DESTINATION_COLOR:775,SOURCE_ALPHA:770,ONE_MINUS_SOURCE_ALPHA:771,DESTINATION_ALPHA:772,ONE_MINUS_DESTINATION_ALPHA:773,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,SOURCE_ALPHA_SATURATE:776};return e(t)}),i("Scene/BlendingState",["../Core/freezeObject","./BlendEquation","./BlendFunction"],function(e,t,i){"use strict";var r={DISABLED:e({enabled:!1}),ALPHA_BLEND:e({enabled:!0,equationRgb:t.ADD,equationAlpha:t.ADD,functionSourceRgb:i.SOURCE_ALPHA,functionSourceAlpha:i.SOURCE_ALPHA,functionDestinationRgb:i.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:i.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:e({enabled:!0,equationRgb:t.ADD,equationAlpha:t.ADD,functionSourceRgb:i.ONE,functionSourceAlpha:i.ONE,functionDestinationRgb:i.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:i.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:e({enabled:!0,equationRgb:t.ADD,equationAlpha:t.ADD,functionSourceRgb:i.SOURCE_ALPHA,functionSourceAlpha:i.SOURCE_ALPHA,functionDestinationRgb:i.ONE,functionDestinationAlpha:i.ONE})};return e(r)}),i("Scene/Pass",["../Core/freezeObject"],function(e){"use strict";var t={GLOBE:0,OPAQUE:1,TRANSLUCENT:2,OVERLAY:3,NUMBER_OF_PASSES:4};return e(t)}),i("Scene/TextureAtlas",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/loadImage","../Core/PixelFormat","../Core/RuntimeError","../ThirdParty/when"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,i,n,o,a){this.bottomLeft=r(e,t.ZERO),this.topRight=r(i,t.ZERO),this.childNode1=n,this.childNode2=o,this.imageIndex=a}function p(e,i){var r=e.numberOfImages,o=2;if(r>0){var a=e._texture.width,s=e._texture.height,l=o*(a+i.width+e._borderWidthInPixels),u=o*(s+i.height+e._borderWidthInPixels),c=a/l,h=s/u,p=new d(new t(a+e._borderWidthInPixels,0),new t(l,s)),m=new d(new t,new t(l,s),e._root,p),f=new d(new t(0,s+e._borderWidthInPixels),new t(l,u)),v=new d(new t,new t(l,u),m,f);e._root=v;for(var g=0;gs||0>l)return void 0;if(0===s&&0===l)return i;if(s>l){i.childNode1=new d(new t(i.bottomLeft.x,i.bottomLeft.y),new t(i.bottomLeft.x+r.width,i.topRight.y));var u=i.bottomLeft.x+r.width+e._borderWidthInPixels;ui;++i)e[i]&&e[i]._destroy()}function A(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;for(var t=[],i=e._billboards,r=i.length,n=0,o=0;r>n;++n){var a=i[n];a&&(a._index=o++,t.push(a))}e._billboards=t}}function D(e){var t=16384,i=e.cache.billboardCollection_indexBuffer;if(s(i))return i;for(var r=6*t,n=new Uint16Array(r),o=0,a=0;r>o;o+=6,a+=4)n[o]=a,n[o+1]=a+1,n[o+2]=a+2,n[o+3]=a+0,n[o+4]=a+2,n[o+5]=a+3;return i=e.createIndexBuffer(n,f.STATIC_DRAW,d.UNSIGNED_SHORT),i.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBuffer=i,i}function M(e,t,i){return new _(e,[{index:rt.positionHighAndScale,componentsPerAttribute:4,componentDatatype:o.FLOAT,usage:i[G]},{index:rt.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:o.FLOAT,usage:i[G]},{index:rt.compressedAttribute0,componentsPerAttribute:4,componentDatatype:o.FLOAT,usage:i[H]},{index:rt.compressedAttribute1,componentsPerAttribute:4,componentDatatype:o.FLOAT,usage:i[et]},{index:rt.compressedAttribute2,componentsPerAttribute:4,componentDatatype:o.FLOAT,usage:i[J]},{index:rt.eyeOffset,componentsPerAttribute:3,componentDatatype:o.FLOAT,usage:i[q]},{index:rt.scaleByDistance,componentsPerAttribute:4,componentDatatype:o.FLOAT,usage:i[$]},{index:rt.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:o.FLOAT,usage:i[tt]}],4*t)}function I(e,i,r,n,o){var a=4*o._index,s=o._getActualPosition();e._mode===x.SCENE3D&&(t.expand(e._baseVolume,s,e._baseVolume),e._boundingVolumeDirty=!0),h.fromCartesian(s,ot);var l=o.scale,u=o.rotation;0!==u&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,l);var c=n[rt.positionHighAndScale],d=ot.high;c(a+0,d.x,d.y,d.z,l),c(a+1,d.x,d.y,d.z,l),c(a+2,d.x,d.y,d.z,l),c(a+3,d.x,d.y,d.z,l);var p=n[rt.positionLowAndRotation],m=ot.low;p(a+0,m.x,m.y,m.z,u),p(a+1,m.x,m.y,m.z,u),p(a+2,m.x,m.y,m.z,u),p(a+3,m.x,m.y,m.z,u)}function O(t,i,r,n,o){var a=4*o._index,s=o.pixelOffset,l=s.x,u=s.y,c=o._translate,h=c.x,d=c.y;t._maxPixelOffset=Math.max(t._maxPixelOffset,Math.abs(l+h),Math.abs(-u+d));var m=o.horizontalOrigin,f=o.verticalOrigin,v=o.show;0===o.color.alpha&&(v=!1),t._allHorizontalCenter=t._allHorizontalCenter&&m===E.CENTER;var g=0,_=0,y=0,C=0,w=o._imageIndex;if(-1!==w){var S=r[w];g=S.x,_=S.y,y=S.width,C=S.height}var b=g+y,x=_+C,T=Math.floor(p.clamp(l,-st,st)+st)*ct;T+=(m+1)*ht,T+=(f+1)*dt,T+=(v?1:0)*pt;var P=Math.floor(p.clamp(u,-st,st)+st)*ut,A=Math.floor(p.clamp(h,-st,st)+st)*ut,D=(p.clamp(d,-st,st)+st)*mt,M=Math.floor(D),I=Math.floor((D-M)*ut);P+=M,A+=I,at.x=g,at.y=_;var O=e.compressTextureCoordinates(at);at.x=b;var R=e.compressTextureCoordinates(at);at.y=x;var L=e.compressTextureCoordinates(at);at.x=g;var N=e.compressTextureCoordinates(at),F=n[rt.compressedAttribute0];F(a+0,T+ft,P,A,O),F(a+1,T+vt,P,A,R),F(a+2,T+gt,P,A,L),F(a+3,T+_t,P,A,N)}function R(t,i,n,o,l){var u=4*l._index,c=l.alignedAxis;r.equals(c,r.ZERO)||(t._shaderAlignedAxis=!0);var h=0,d=1,m=1,f=1,v=l.translucencyByDistance;s(v)&&(h=v.near,d=v.nearValue,m=v.far,f=v.farValue,(1!==d||1!==f)&&(t._shaderTranslucencyByDistance=!0));var g=0,_=l._imageIndex;if(-1!==_){var y=n[_];g=y.width}var C=t._textureAtlas.texture.width,w=Math.ceil(.5*a(l.width,C*g));t._maxSize=Math.max(t._maxSize,w);var S=p.clamp(w,0,lt),E=0;Math.abs(r.magnitudeSquared(c)-1)c;++c){var h=i[c],d=h.position,p=w._computeActualPosition(h,d,n,o);s(p)&&(h._setActualPosition(p),a?u.push(p):t.expand(l,p,l))}a&&t.fromPoints(u,l)}function V(e,t){var i=t.mode,r=e._billboards,n=e._billboardsToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==x.SCENE3D&&!m.equals(o,e.modelMatrix)?(e._mode=i,m.clone(e.modelMatrix,o),e._createVertexArray=!0,(i===x.SCENE3D||i===x.SCENE2D||i===x.COLUMBUS_VIEW)&&k(e,r,r.length,t,o,!0)):i===x.MORPHING?k(e,r,r.length,t,o,!0):(i===x.SCENE2D||i===x.COLUMBUS_VIEW)&&k(e,n,e._billboardsToUpdateIndex,t,o,!1)}function U(e,t,i,n){var o=i.camera,a=o.frustum,s=r.subtract(o.positionWC,n.center,Ct),l=r.multiplyByScalar(o.directionWC,r.dot(s,o.directionWC),wt),u=Math.max(0,r.magnitude(l)-n.radius);yt.x=t.drawingBufferWidth,yt.y=t.drawingBufferHeight;var c=a.getPixelSize(yt,u),h=Math.max(c.x,c.y),d=2*h*e._maxScale*e._maxSize;e._allHorizontalCenter&&(d*=.5);var p=h*e._maxPixelOffset+e._maxEyeOffset;n.radius+=d+p}var W=w.SHOW_INDEX,G=w.POSITION_INDEX,H=w.PIXEL_OFFSET_INDEX,q=w.EYE_OFFSET_INDEX,j=w.HORIZONTAL_ORIGIN_INDEX,Y=w.VERTICAL_ORIGIN_INDEX,X=w.SCALE_INDEX,Z=w.IMAGE_INDEX_INDEX,J=w.COLOR_INDEX,Q=w.ROTATION_INDEX,K=w.ALIGNED_AXIS_INDEX,$=w.SCALE_BY_DISTANCE_INDEX,et=w.TRANSLUCENCY_BY_DISTANCE_INDEX,tt=w.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,it=w.NUMBER_OF_PROPERTIES,rt={positionHighAndScale:0,positionLowAndRotation:1,compressedAttribute0:2,compressedAttribute1:3,compressedAttribute2:4,eyeOffset:5,scaleByDistance:6,pixelOffsetScaleByDistance:7},nt=function(e){e=a(e,a.EMPTY_OBJECT),this._scene=e.scene,this._textureAtlas=void 0,this._textureAtlasGUID=void 0,this._destroyTextureAtlas=!0,this._sp=void 0,this._rs=void 0,this._vaf=void 0,this._spPick=void 0,this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!1,this._shaderRotation=!1,this._compiledShaderRotation=!1,this._compiledShaderRotationPick=!1,this._shaderAlignedAxis=!1,this._compiledShaderAlignedAxis=!1,this._compiledShaderAlignedAxisPick=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._compiledShaderScaleByDistancePick=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistancePick=!1,this._shaderPixelOffsetScaleByDistance=!1,this._compiledShaderPixelOffsetScaleByDistance=!1,this._compiledShaderPixelOffsetScaleByDistancePick=!1,this._propertiesChanged=new Uint32Array(it),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._baseVolume=new t,this._baseVolumeWC=new t,this._baseVolume2D=new t,this._boundingVolume=new t,this._boundingVolumeDirty=!1,this._colorCommands=[],this._pickCommands=[],this.modelMatrix=m.clone(a(e.modelMatrix,m.IDENTITY)),this._modelMatrix=m.clone(m.IDENTITY),this.debugShowBoundingVolume=a(e.debugShowBoundingVolume,!1),this._mode=x.SCENE3D,this._buffersUsage=[f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW,f.STATIC_DRAW];var i=this;this._uniforms={u_atlas:function(){return i._textureAtlas.texture}}};l(nt.prototype,{length:{get:function(){return A(this),this._billboards.length}},textureAtlas:{get:function(){return this._textureAtlas},set:function(e){this._textureAtlas!==e&&(this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._textureAtlas=e,this._createVertexArray=!0)}},destroyTextureAtlas:{get:function(){return this._destroyTextureAtlas},set:function(e){this._destroyTextureAtlas=e}}}),nt.prototype.add=function(e){var t=new w(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t},nt.prototype.remove=function(e){return this.contains(e)?(this._billboards[e._index]=null,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1},nt.prototype.removeAll=function(){P(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0},nt.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]},nt.prototype.contains=function(e){return s(e)&&e._billboardCollection===this},nt.prototype.get=function(e){return A(this),this._billboards[e]},nt.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;it>r;++r){var n=0===i[r]?f.STATIC_DRAW:f.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var ot=new h,at=new i,st=32768,lt=65536,ut=256,ct=128,ht=32,dt=8,pt=4,mt=1/256,ft=0,vt=2,gt=3,_t=1,yt=new i,Ct=new r,wt=new r,St=[];return nt.prototype.update=function(e,i,r){A(this);var n=this._billboards,o=n.length,a=this._textureAtlas;if(!s(a)){a=this._textureAtlas=new T({context:e});for(var l=0;o>l;++l)n[l]._loadImage()}var u=a.textureCoordinates;if(0!==u.length){V(this,i),n=this._billboards,o=n.length;var c=this._billboardsToUpdate,h=this._billboardsToUpdateIndex,d=this._propertiesChanged,p=a.guid,f=this._createVertexArray||this._textureAtlasGUID!==p;this._textureAtlasGUID=p;var _,w=i.passes,E=w.pick;if(f||!E&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var P=0;it>P;++P)d[P]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),o>0){this._vaf=M(e,o,this._buffersUsage),_=this._vaf.writers;for(var k=0;o>k;++k){var nt=this._billboards[k];nt._dirty=!1,z(this,e,u,_,nt)}this._vaf.commit(D(e))}this._billboardsToUpdateIndex=0}else if(h>0){var ot=St;ot.length=0,(d[G]||d[Q]||d[X])&&ot.push(I),(d[Z]||d[H]||d[j]||d[Y]||d[W])&&ot.push(O),(d[Z]||d[K]||d[et])&&ot.push(R),(d[Z]||d[J])&&ot.push(L),d[q]&&ot.push(N),d[$]&&ot.push(F),d[tt]&&ot.push(B);var at=ot.length;if(_=this._vaf.writers,h/o>.1){for(var st=0;h>st;++st){var lt=c[st];lt._dirty=!1;for(var ut=0;at>ut;++ut)ot[ut](this,e,u,_,lt)}this._vaf.commit(D(e))}else{for(var ct=0;h>ct;++ct){var ht=c[ct];ht._dirty=!1;for(var dt=0;at>dt;++dt)ot[dt](this,e,u,_,ht);this._vaf.subCommit(4*ht._index,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(h>1.5*o&&(c.length=o),s(this._vaf)&&s(this._vaf.va)){this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,t.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var pt,mt=m.IDENTITY;i.mode===x.SCENE3D?(mt=this.modelMatrix,pt=t.clone(this._baseVolumeWC,this._boundingVolume)):pt=t.clone(this._baseVolume2D,this._boundingVolume),U(this,e,i,pt);var ft,vt,gt,_t,yt,Ct;if(w.render){var wt=this._colorCommands;for(s(this._rs)||(this._rs=e.createRenderState({depthTest:{enabled:!0},blending:S.ALPHA_BLEND})),(!s(this._sp)||this._shaderRotation&&!this._compiledShaderRotation||this._shaderAlignedAxis&&!this._compiledShaderAlignedAxis||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderPixelOffsetScaleByDistance&&!this._compiledShaderPixelOffsetScaleByDistance)&&(_t=new g({sources:[C]}),this._shaderRotation&&_t.defines.push("ROTATION"),this._shaderAlignedAxis&&_t.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&_t.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&_t.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&_t.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),s(this._scene)&&_t.defines.push("CLAMPED_TO_GROUND"),this._sp=e.replaceShaderProgram(this._sp,_t,y,rt),this._compiledShaderRotation=this._shaderRotation,this._compiledShaderAlignedAxis=this._shaderAlignedAxis,this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistance=this._shaderPixelOffsetScaleByDistance),ft=this._vaf.va,vt=ft.length,wt.length=vt,Ct=0;vt>Ct;++Ct)gt=wt[Ct],s(gt)||(gt=wt[Ct]=new v({pass:b.OPAQUE,owner:this})),gt.boundingVolume=pt,gt.modelMatrix=mt,gt.count=ft[Ct].indicesCount,gt.shaderProgram=this._sp,gt.uniformMap=this._uniforms,gt.vertexArray=ft[Ct].va,gt.renderState=this._rs,gt.debugShowBoundingVolume=this.debugShowBoundingVolume,r.push(gt) -}if(E){var Et=this._pickCommands;for((!s(this._spPick)||this._shaderRotation&&!this._compiledShaderRotationPick||this._shaderAlignedAxis&&!this._compiledShaderAlignedAxisPick||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistancePick||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistancePick||this._shaderPixelOffsetScaleByDistance&&!this._compiledShaderPixelOffsetScaleByDistancePick)&&(_t=new g({defines:["RENDER_FOR_PICK"],sources:[C]}),this._shaderRotation&&_t.defines.push("ROTATION"),this._shaderAlignedAxis&&_t.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&_t.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&_t.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&_t.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),s(this._scene)&&_t.defines.push("CLAMPED_TO_GROUND"),yt=new g({defines:["RENDER_FOR_PICK"],sources:[y]}),this._spPick=e.replaceShaderProgram(this._spPick,_t,yt,rt),this._compiledShaderRotationPick=this._shaderRotation,this._compiledShaderAlignedAxisPick=this._shaderAlignedAxis,this._compiledShaderScaleByDistancePick=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistancePick=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistancePick=this._shaderPixelOffsetScaleByDistance),ft=this._vaf.va,vt=ft.length,Et.length=vt,Ct=0;vt>Ct;++Ct)gt=Et[Ct],s(gt)||(gt=Et[Ct]=new v({pass:b.OPAQUE,owner:this})),gt.boundingVolume=pt,gt.modelMatrix=mt,gt.count=ft[Ct].indicesCount,gt.shaderProgram=this._spPick,gt.uniformMap=this._uniforms,gt.vertexArray=ft[Ct].va,gt.renderState=this._rs,r.push(gt)}}}},nt.prototype.isDestroyed=function(){return!1},nt.prototype.destroy=function(){return this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),P(this._billboards),u(this)},nt}),i("DataSources/BoundingSphereState",["../Core/freezeObject"],function(e){"use strict";var t={DONE:0,PENDING:1,FAILED:2};return e(t)}),i("DataSources/Property",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Iso8601"],function(e,t,i,r){"use strict";var n=function(){r.throwInstantiationError()};return i(n.prototype,{isConstant:{get:r.throwInstantiationError},definitionChanged:{get:r.throwInstantiationError}}),n.prototype.getValue=r.throwInstantiationError,n.prototype.equals=r.throwInstantiationError,n.equals=function(e,i){return e===i||t(e)&&e.equals(i)},n.arrayEquals=function(e,i){if(e===i)return!0;if(!t(e)||!t(i)||e.length!==i.length)return!1;for(var r=e.length,o=0;r>o;o++)if(!n.equals(e[o],i[o]))return!1;return!0},n.isConstant=function(e){return!t(e)||e.isConstant},n.getValueOrUndefined=function(e,i,r){return t(e)?e.getValue(i,r):void 0},n.getValueOrDefault=function(i,r,n,o){return t(i)?e(i.getValue(r,o),n):n},n.getValueOrClonedDefault=function(e,i,r,n){var o;return t(e)&&(o=e.getValue(i,n)),t(o)||(o=r.clone(o)),o},n}),i("DataSources/BillboardVisualizer",["../Core/AssociativeArray","../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/NearFarScalar","../Scene/BillboardCollection","../Scene/HorizontalOrigin","../Scene/VerticalOrigin","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e,t){if(o(e)){var i=e.billboard;o(i)&&(e.textureValue=void 0,e.billboard=void 0,i.show=!1,i.image=void 0,t.push(i._index))}}var f=n.WHITE,v=r.ZERO,g=i.ZERO,_=1,y=0,C=r.ZERO,w=c.CENTER,S=h.CENTER,E=new r,b=new n,x=new r,T=new i,P=new l,A=new l,D=new l,M=new t,I=function(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0},O=function(t,i){i.collectionChanged.addEventListener(O.prototype._onCollectionChanged,this),this._scene=t,this._unusedIndexes=[],this._billboardCollection=void 0,this._entityCollection=i,this._items=new e,this._onCollectionChanged(i,i.values,[],[])};return O.prototype.update=function(e){for(var t=this._items.values,i=this._unusedIndexes,r=0,n=t.length;n>r;r++){var a,s=t[r],l=s.entity,c=l._billboard,h=s.billboard,d=l.isShowing&&l.isAvailable(e)&&p.getValueOrDefault(c._show,e,!0);if(d&&(E=p.getValueOrUndefined(l._position,e,E),a=p.getValueOrUndefined(c._image,e),d=o(E)&&o(a)),d){if(!o(h)){var I=this._billboardCollection;o(I)||(I=new u,this._billboardCollection=I,this._scene.primitives.add(I));var O=i.length;h=O>0?I.get(i.pop()):I.add(),h.id=l,h.image=void 0,s.billboard=h}h.show=d,s.textureValue!==a&&(h.image=a,s.textureValue=a),h.position=E,h.color=p.getValueOrDefault(c._color,e,f,b),h.eyeOffset=p.getValueOrDefault(c._eyeOffset,e,v,x),h.pixelOffset=p.getValueOrDefault(c._pixelOffset,e,g,T),h.scale=p.getValueOrDefault(c._scale,e,_),h.rotation=p.getValueOrDefault(c._rotation,e,y),h.alignedAxis=p.getValueOrDefault(c._alignedAxis,e,C),h.horizontalOrigin=p.getValueOrDefault(c._horizontalOrigin,e,w),h.verticalOrigin=p.getValueOrDefault(c._verticalOrigin,e,S),h.width=p.getValueOrUndefined(c._width,e),h.height=p.getValueOrUndefined(c._height,e),h.scaleByDistance=p.getValueOrUndefined(c._scaleByDistance,e,P),h.translucencyByDistance=p.getValueOrUndefined(c._translucencyByDistance,e,A),h.pixelOffsetScaleByDistance=p.getValueOrUndefined(c._pixelOffsetScaleByDistance,e,D);var R=p.getValueOrUndefined(c._imageSubRegion,e,M);o(R)&&h.setImageSubRegion(h._imageId,R)}else m(s,i)}return!0},O.prototype.getBoundingSphere=function(e,t){var i=this._items.get(e.id);return o(i)&&o(i.billboard)?(t.center=r.clone(i.billboard.position,t.center),t.radius=0,d.DONE):d.FAILED},O.prototype.isDestroyed=function(){return!1},O.prototype.destroy=function(){return this._entityCollection.collectionChanged.removeEventListener(O.prototype._onCollectionChanged,this),o(this._billboardCollection)&&this._scene.primitives.remove(this._billboardCollection),a(this)},O.prototype._onCollectionChanged=function(e,t,i,r){var n,a,s=this._unusedIndexes,l=this._items;for(n=t.length-1;n>-1;n--)a=t[n],o(a._billboard)&&o(a._position)&&l.set(a.id,new I(a));for(n=r.length-1;n>-1;n--)a=r[n],o(a._billboard)&&o(a._position)?l.contains(a.id)||l.set(a.id,new I(a)):(m(l.get(a.id),s),l.remove(a.id));for(n=i.length-1;n>-1;n--)a=i[n],m(l.get(a.id),s),l.remove(a.id)},O}),i("Shaders/Appearances/AllMaterialAppearanceFS",[],function(){"use strict";return"varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_binormalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nmat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_binormalEC);\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = tangentToEyeMatrix;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n"}),i("Shaders/Appearances/AllMaterialAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec3 tangent;\nattribute vec3 binormal;\nattribute vec2 st;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_binormalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_tangentEC = czm_normal * tangent;\nv_binormalEC = czm_normal * binormal;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Shaders/Appearances/BasicMaterialAppearanceFS",[],function(){"use strict";return"varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n"}),i("Shaders/Appearances/BasicMaterialAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Shaders/Appearances/TexturedMaterialAppearanceFS",[],function(){"use strict";return"varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);;\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n"}),i("Shaders/Appearances/TexturedMaterialAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec2 st;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Scene/CullFace",["../Core/freezeObject"],function(e){"use strict";var t={FRONT:1028,BACK:1029,FRONT_AND_BACK:1032};return e(t)}),i("Scene/Appearance",["../Core/clone","../Core/combine","../Core/defaultValue","../Core/defined","../Core/defineProperties","./BlendingState","./CullFace"],function(e,t,i,r,n,o,a){"use strict";var s=function(e){e=i(e,i.EMPTY_OBJECT),this.material=e.material,this.translucent=i(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=i(e.closed,!1)};return n(s.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}}}),s.prototype.getFragmentShaderSource=function(){var e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),r(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join("\n")},s.prototype.isTranslucent=function(){return r(this.material)&&this.material.isTranslucent()||!r(this.material)&&this.translucent},s.prototype.getRenderState=function(){var t=this.isTranslucent(),i=e(this.renderState,!1);return t?(i.depthMask=!1,i.blending=o.ALPHA_BLEND):i.depthMask=!0,i},s.getDefaultRenderState=function(e,i,n){var s={depthTest:{enabled:!0}};return e&&(s.depthMask=!1,s.blending=o.ALPHA_BLEND),i&&(s.cull={enabled:!0,face:a.BACK}),r(n)&&(s=t(n,s,!0)),s},s}),i("Renderer/PixelDatatype",["../Core/freezeObject"],function(e){"use strict";var t={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126,UNSIGNED_INT_24_8_WEBGL:34042,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,validate:function(e){return e===t.UNSIGNED_BYTE||e===t.UNSIGNED_SHORT||e===t.UNSIGNED_INT||e===t.FLOAT||e===t.UNSIGNED_INT_24_8_WEBGL||e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5}};return e(t)}),i("Renderer/CubeMapFace",["../Core/defaultValue","../Core/defineProperties","../Core/DeveloperError","./PixelDatatype"],function(e,t){"use strict";var i=function(e,t,i,r,n,o,a,s,l){this._gl=e,this._texture=t,this._textureTarget=i,this._targetFace=r,this._pixelFormat=n,this._pixelDatatype=o,this._size=a,this._preMultiplyAlpha=s,this._flipY=l};return t(i.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}}),i.prototype.copyFrom=function(t,i,r){i=e(i,0),r=e(r,0);var n=this._gl,o=this._textureTarget;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._preMultiplyAlpha),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,this._flipY),n.activeTexture(n.TEXTURE0),n.bindTexture(o,this._texture),t.arrayBufferView?n.texSubImage2D(this._targetFace,0,i,r,t.width,t.height,this._pixelFormat,this._pixelDatatype,t.arrayBufferView):n.texSubImage2D(this._targetFace,0,i,r,this._pixelFormat,this._pixelDatatype,t),n.bindTexture(o,null)},i.prototype.copyFromFramebuffer=function(t,i,r,n,o,a){t=e(t,0),i=e(i,0),r=e(r,0),n=e(n,0),o=e(o,this._size),a=e(a,this._size);var s=this._gl,l=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(l,this._texture),s.copyTexSubImage2D(this._targetFace,0,t,i,r,n,o,a),s.bindTexture(l,null)},i}),i("Renderer/MipmapHint",["../Core/freezeObject"],function(e){"use strict";var t={DONT_CARE:4352,FASTEST:4353,NICEST:4354,validate:function(e){return e===t.DONT_CARE||e===t.FASTEST||e===t.NICEST}};return e(t)}),i("Renderer/TextureMagnificationFilter",["../Core/freezeObject"],function(e){"use strict";var t={NEAREST:9728,LINEAR:9729,validate:function(e){return e===t.NEAREST||e===t.LINEAR}};return e(t)}),i("Renderer/TextureMinificationFilter",["../Core/freezeObject"],function(e){"use strict";var t={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,validate:function(e){return e===t.NEAREST||e===t.LINEAR||e===t.NEAREST_MIPMAP_NEAREST||e===t.LINEAR_MIPMAP_NEAREST||e===t.NEAREST_MIPMAP_LINEAR||e===t.LINEAR_MIPMAP_LINEAR}};return e(t)}),i("Renderer/TextureWrap",["../Core/freezeObject"],function(e){"use strict";var t={CLAMP_TO_EDGE:33071,REPEAT:10497,MIRRORED_REPEAT:33648,validate:function(e){return e===t.CLAMP_TO_EDGE||e===t.REPEAT||e===t.MIRRORED_REPEAT}};return e(t)}),i("Renderer/CubeMap",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Math","./CubeMapFace","./MipmapHint","./PixelDatatype","./TextureMagnificationFilter","./TextureMinificationFilter","./TextureWrap"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";var d=function(e,t,i,r,n,o,s,l,u){this._gl=e,this._textureFilterAnisotropic=t,this._textureTarget=i,this._texture=r,this._pixelFormat=n,this._pixelDatatype=o,this._size=s,this._preMultiplyAlpha=l,this._flipY=u,this._sampler=void 0,this._positiveX=new a(e,r,i,e.TEXTURE_CUBE_MAP_POSITIVE_X,n,o,s,l,u),this._negativeX=new a(e,r,i,e.TEXTURE_CUBE_MAP_NEGATIVE_X,n,o,s,l,u),this._positiveY=new a(e,r,i,e.TEXTURE_CUBE_MAP_POSITIVE_Y,n,o,s,l,u),this._negativeY=new a(e,r,i,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,n,o,s,l,u),this._positiveZ=new a(e,r,i,e.TEXTURE_CUBE_MAP_POSITIVE_Z,n,o,s,l,u),this._negativeZ=new a(e,r,i,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,n,o,s,l,u),this.sampler=void 0};return i(d.prototype,{positiveX:{get:function(){return this._positiveX}},negativeX:{get:function(){return this._negativeX}},positiveY:{get:function(){return this._positiveY}},negativeY:{get:function(){return this._negativeY}},positiveZ:{get:function(){return this._positiveZ}},negativeZ:{get:function(){return this._negativeZ}},sampler:{get:function(){return this._sampler},set:function(e){var i=!0;if(!t(e)){i=!1;var r=c.LINEAR,o=u.LINEAR;this._pixelDatatype===l.FLOAT&&(r=c.NEAREST,o=u.NEAREST),e={wrapS:h.CLAMP_TO_EDGE,wrapT:h.CLAMP_TO_EDGE,minificationFilter:r,magnificationFilter:o,maximumAnisotropy:1}}if(this._pixelDatatype===l.FLOAT){if(e.minificationFilter!==c.NEAREST&&e.minificationFilter!==c.NEAREST_MIPMAP_NEAREST)throw new n("Only NEAREST and NEAREST_MIPMAP_NEAREST minification filters are supported for floating point textures.");if(e.magnificationFilter!==u.NEAREST)throw new n("Only the NEAREST magnification filter is supported for floating point textures.")}var a=this._gl,s=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(s,this._texture),a.texParameteri(s,a.TEXTURE_MIN_FILTER,e.minificationFilter),a.texParameteri(s,a.TEXTURE_MAG_FILTER,e.magnificationFilter),a.texParameteri(s,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(s,a.TEXTURE_WRAP_T,e.wrapT),t(this._textureFilterAnisotropic)&&a.texParameteri(s,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(s,null),this._sampler=i?{wrapS:e.wrapS,wrapT:e.wrapT,minificationFilter:e.minificationFilter,magnificationFilter:e.magnificationFilter,maximumAnisotropy:e.maximumAnisotropy}:void 0}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},width:{get:function(){return this._size}},height:{get:function(){return this._size}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}}),d.prototype.generateMipmap=function(t){t=e(t,s.DONT_CARE);var i=this._gl,r=this._textureTarget;i.hint(i.GENERATE_MIPMAP_HINT,t),i.activeTexture(i.TEXTURE0),i.bindTexture(r,this._texture),i.generateMipmap(r),i.bindTexture(r,null)},d.prototype.isDestroyed=function(){return!1},d.prototype.destroy=function(){return this._gl.deleteTexture(this._texture),this._positiveX=r(this._positiveX),this._negativeX=r(this._negativeX),this._positiveY=r(this._positiveY),this._negativeY=r(this._negativeY),this._positiveZ=r(this._positiveZ),this._negativeZ=r(this._negativeZ),r(this)},d}),i("Renderer/Texture",["../Core/Cartesian2","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Math","../Core/PixelFormat","./MipmapHint","./PixelDatatype","./TextureMagnificationFilter","./TextureMinificationFilter","./TextureWrap"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";var p=function(r,n){n=t(n,t.EMPTY_OBJECT);var a=n.source,l=i(a)?a.width:n.width,c=i(a)?a.height:n.height,h=t(n.pixelFormat,s.RGBA),d=t(n.pixelDatatype,u.UNSIGNED_BYTE);if(d===u.FLOAT&&!r.floatingPointTexture)throw new o("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. Check context.floatingPointTexture.");if(s.isDepthFormat(h)&&!r.depthTexture)throw new o("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check context.depthTexture.");var p=n.preMultiplyAlpha||h===s.RGB||h===s.LUMINANCE,m=t(n.flipY,!0),f=r._gl,v=f.TEXTURE_2D,g=f.createTexture();f.activeTexture(f.TEXTURE0),f.bindTexture(v,g),i(a)?(f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,m),i(a.arrayBufferView)?f.texImage2D(v,0,h,l,c,0,h,d,a.arrayBufferView):i(a.framebuffer)?(a.framebuffer!==r.defaultFramebuffer&&a.framebuffer._bind(),f.copyTexImage2D(v,0,h,a.xOffset,a.yOffset,l,c,0),a.framebuffer!==r.defaultFramebuffer&&a.framebuffer._unBind()):f.texImage2D(v,0,h,h,d,a)):f.texImage2D(v,0,h,l,c,0,h,d,null),f.bindTexture(v,null),this._context=r,this._textureFilterAnisotropic=r._textureFilterAnisotropic,this._textureTarget=v,this._texture=g,this._pixelFormat=h,this._pixelDatatype=d,this._width=l,this._height=c,this._dimensions=new e(l,c),this._preMultiplyAlpha=p,this._flipY=m,this._sampler=void 0,this.sampler=void 0};return r(p.prototype,{sampler:{get:function(){return this._sampler},set:function(e){var t=!0;if(!i(e)){t=!1;var r=h.LINEAR,n=c.LINEAR;this._pixelDatatype===u.FLOAT&&(r=h.NEAREST,n=c.NEAREST),e={wrapS:d.CLAMP_TO_EDGE,wrapT:d.CLAMP_TO_EDGE,minificationFilter:r,magnificationFilter:n,maximumAnisotropy:1}}if(this._pixelDatatype===u.FLOAT){if(e.minificationFilter!==h.NEAREST&&e.minificationFilter!==h.NEAREST_MIPMAP_NEAREST)throw new o("Only NEAREST and NEAREST_MIPMAP_NEAREST minification filters are supported for floating point textures.");if(e.magnificationFilter!==c.NEAREST)throw new o("Only the NEAREST magnification filter is supported for floating point textures.")}var a=this._context._gl,s=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(s,this._texture),a.texParameteri(s,a.TEXTURE_MIN_FILTER,e.minificationFilter),a.texParameteri(s,a.TEXTURE_MAG_FILTER,e.magnificationFilter),a.texParameteri(s,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(s,a.TEXTURE_WRAP_T,e.wrapT),i(this._textureFilterAnisotropic)&&a.texParameteri(s,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(s,null),this._sampler=t?{wrapS:e.wrapS,wrapT:e.wrapT,minificationFilter:e.minificationFilter,magnificationFilter:e.magnificationFilter,maximumAnisotropy:e.maximumAnisotropy}:void 0}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},dimensions:{get:function(){return this._dimensions}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},_target:{get:function(){return this._textureTarget}}}),p.prototype.copyFrom=function(e,i,r){i=t(i,0),r=t(r,0);var n=this._context._gl,o=this._textureTarget;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._preMultiplyAlpha),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,this._flipY),n.activeTexture(n.TEXTURE0),n.bindTexture(o,this._texture),e.arrayBufferView?n.texSubImage2D(o,0,i,r,e.width,e.height,this._pixelFormat,this._pixelDatatype,e.arrayBufferView):n.texSubImage2D(o,0,i,r,this._pixelFormat,this._pixelDatatype,e),n.bindTexture(o,null)},p.prototype.copyFromFramebuffer=function(e,i,r,n,o,a){e=t(e,0),i=t(i,0),r=t(r,0),n=t(n,0),o=t(o,this._width),a=t(a,this._height);var s=this._context._gl,l=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(l,this._texture),s.copyTexSubImage2D(l,0,e,i,r,n,o,a),s.bindTexture(l,null)},p.prototype.generateMipmap=function(e){e=t(e,l.DONT_CARE);var i=this._context._gl,r=this._textureTarget;i.hint(i.GENERATE_MIPMAP_HINT,e),i.activeTexture(i.TEXTURE0),i.bindTexture(r,this._texture),i.generateMipmap(r),i.bindTexture(r,null)},p.prototype.isDestroyed=function(){return!1},p.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),n(this)},p}),i("Shaders/Materials/BumpMapMaterial",[],function(){"use strict";return"uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 centerPixel = fract(repeat * st);\nfloat centerBump = texture2D(image, centerPixel).channel;\nfloat imageWidth = float(imageDimensions.x);\nvec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\nfloat rightBump = texture2D(image, rightPixel).channel;\nfloat imageHeight = float(imageDimensions.y);\nvec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\nfloat topBump = texture2D(image, leftPixel).channel;\nvec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nmaterial.diffuse = vec3(0.01);\nreturn material;\n}\n"}),i("Shaders/Materials/CheckerboardMaterial",[],function(){"use strict";return"uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);\nfloat scaledWidth = fract(repeat.s * st.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(repeat.t * st.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value = min(scaledWidth, scaledHeight);\nvec4 currentColor = mix(lightColor, darkColor, b);\nvec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"}),i("Shaders/Materials/DotMaterial",[],function(){"use strict";return"uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));\nvec4 color = mix(lightColor, darkColor, b);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"}),i("Shaders/Materials/FadeMaterial",[],function(){"use strict";return"uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\nfloat getTime(float t, float coord)\n{\nfloat scalar = 1.0 / maximumDistance;\nfloat q = distance(t, coord) * scalar;\nif (repeat)\n{\nfloat r = distance(t, coord + 1.0) * scalar;\nfloat s = distance(t, coord - 1.0) * scalar;\nq = min(min(r, s), q);\n}\nreturn clamp(q, 0.0, 1.0);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat s = getTime(time.x, st.s) * fadeDirection.s;\nfloat t = getTime(time.y, st.t) * fadeDirection.t;\nfloat u = length(vec2(s, t));\nvec4 color = mix(fadeInColor, fadeOutColor, u);\nmaterial.emission = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"}),i("Shaders/Materials/GridMaterial",[],function(){"use strict";return"#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nuniform vec2 lineOffset;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat scaledWidth = fract(lineCount.s * st.s - lineOffset.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(lineCount.t * st.t - lineOffset.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value;\n#ifdef GL_OES_standard_derivatives\nconst float fuzz = 1.2;\nvec2 thickness = (lineThickness * czm_resolutionScale) - 1.0;\nvec2 dx = abs(dFdx(st));\nvec2 dy = abs(dFdy(st));\nvec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\nvalue = min(\nsmoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\nsmoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\nconst float fuzz = 0.05;\nvec2 range = 0.5 - (lineThickness * 0.05);\nvalue = min(\n1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\nfloat dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));\nfloat sRim = smoothstep(0.8, 1.0, dRim);\nvalue *= (1.0 - sRim);\nvec3 halfColor = color.rgb * 0.5;\nmaterial.diffuse = halfColor;\nmaterial.emission = halfColor;\nmaterial.alpha = color.a * (1.0 - ((1.0 - cellAlpha) * value));\nreturn material;\n}\n"}),i("Shaders/Materials/NormalMapMaterial",[],function(){"use strict";return"uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\nvec3 normalTangentSpace = textureValue.channels;\nnormalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\nnormalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\nnormalTangentSpace = normalize(normalTangentSpace);\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nreturn material;\n}\n"}),i("Shaders/Materials/PolylineArrowMaterial",[],function(){"use strict";return"#extension GL_OES_standard_derivatives : enable\nuniform vec4 color;\nvarying float v_width;\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\nfloat slope = (p0.y - p1.y) / (p0.x - p1.x);\nreturn slope * (x - p0.x) + p0.y;\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat base = 1.0 - abs(fwidth(st.s)) * 10.0;\nvec2 center = vec2(1.0, 0.5);\nfloat ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\nfloat ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\nfloat halfWidth = 0.15;\nfloat s = step(0.5 - halfWidth, st.t);\ns *= 1.0 - step(0.5 + halfWidth, st.t);\ns *= 1.0 - step(base, st.s);\nfloat t = step(base, materialInput.st.s);\nt *= 1.0 - step(ptOnUpperLine, st.t);\nt *= step(ptOnLowerLine, st.t);\nfloat dist;\nif (st.s < base)\n{\nfloat d1 = abs(st.t - (0.5 - halfWidth));\nfloat d2 = abs(st.t - (0.5 + halfWidth));\ndist = min(d1, d2);\n}\nelse\n{\nfloat d1 = czm_infinity;\nif (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n{\nd1 = abs(st.s - base);\n}\nfloat d2 = abs(st.t - ptOnUpperLine);\nfloat d3 = abs(st.t - ptOnLowerLine);\ndist = min(min(d1, d2), d3);\n}\nvec4 outsideColor = vec4(0.0);\nvec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\nvec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n"}),i("Shaders/Materials/PolylineGlowMaterial",[],function(){"use strict";return"uniform vec4 color;\nuniform float glowPower;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\nmaterial.emission = max(vec3(glow - 1.0 + color.rgb), color.rgb);\nmaterial.alpha = clamp(0.0, 1.0, glow) * color.a;\nreturn material;\n}\n"}),i("Shaders/Materials/PolylineOutlineMaterial",[],function(){"use strict";return"uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\nfloat b = step(0.5 - halfInteriorWidth, st.t);\nb *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\nfloat d1 = abs(st.t - (0.5 - halfInteriorWidth));\nfloat d2 = abs(st.t - (0.5 + halfInteriorWidth));\nfloat dist = min(d1, d2);\nvec4 currentColor = mix(outlineColor, color, b);\nvec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n"}),i("Shaders/Materials/RimLightingMaterial",[],function(){"use strict";return"uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\nfloat s = smoothstep(1.0 - width, 1.0, d);\nmaterial.diffuse = color.rgb;\nmaterial.emission = rimColor.rgb * s;\nmaterial.alpha = mix(color.a, rimColor.a, s);\nreturn material;\n}\n" -}),i("Shaders/Materials/StripeMaterial",[],function(){"use strict";return"uniform vec4 evenColor;\nuniform vec4 oddColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\nfloat value = fract((coord - offset) * (repeat * 0.5));\nfloat dist = min(value, min(abs(value - 0.5), 1.0 - value));\nvec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\nvec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"}),i("Shaders/Materials/Water",[],function(){"use strict";return"uniform 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;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat time = czm_frameNumber * animationSpeed;\nfloat fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\nfloat specularMapValue = texture2D(specularMap, materialInput.st).r;\nvec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\nvec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\nnormalTangentSpace.xy /= fade;\nnormalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\nnormalTangentSpace = normalize(normalTangentSpace);\nfloat tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\nmaterial.alpha = specularMapValue;\nmaterial.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\nmaterial.diffuse += (0.1 * tsPerturbationRatio);\nmaterial.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\nmaterial.specular = specularIntensity;\nmaterial.shininess = 10.0;\nreturn material;\n}\n"}),i("Scene/Material",["../Core/Cartesian2","../Core/clone","../Core/Color","../Core/combine","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/isArray","../Core/loadImage","../Core/Matrix2","../Core/Matrix3","../Core/Matrix4","../Renderer/CubeMap","../Renderer/Texture","../Shaders/Materials/BumpMapMaterial","../Shaders/Materials/CheckerboardMaterial","../Shaders/Materials/DotMaterial","../Shaders/Materials/FadeMaterial","../Shaders/Materials/GridMaterial","../Shaders/Materials/NormalMapMaterial","../Shaders/Materials/PolylineArrowMaterial","../Shaders/Materials/PolylineGlowMaterial","../Shaders/Materials/PolylineOutlineMaterial","../Shaders/Materials/RimLightingMaterial","../Shaders/Materials/StripeMaterial","../Shaders/Materials/Water","../ThirdParty/when"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D){"use strict";function M(e,i){e=o(e,o.EMPTY_OBJECT),i._strict=o(e.strict,!1),i._count=o(e.count,0),i._template=t(o(e.fabric,o.EMPTY_OBJECT)),i._template.uniforms=t(o(i._template.uniforms,o.EMPTY_OBJECT)),i._template.materials=t(o(i._template.materials,o.EMPTY_OBJECT)),i.type=a(i._template.type)?i._template.type:n(),i.shaderSource="",i.materials={},i.uniforms={},i._uniforms={},i._translucentFunctions=[];var s,l=H._materialCache.getMaterial(i.type);if(a(l)){var u=t(l.fabric,!0);i._template=r(i._template,u,!0),s=l.translucent}L(i),a(l)||H._materialCache.addMaterial(i.type,i),N(i),z(i),U(i);var c=0===i._translucentFunctions.length?!0:void 0;if(s=o(s,c),s=o(e.translucent,s),a(s))if("function"==typeof s){var h=function(){return s(i)};i._translucentFunctions.push(h)}else i._translucentFunctions.push(s)}function I(e,t,i,r){if(a(e))for(var n in e)if(e.hasOwnProperty(n)){var o=-1!==t.indexOf(n);(r&&!o||!r&&o)&&i(n,t)}}function O(e,t){for(var i="fabric: property name '"+e+"' is not valid. It should be ",r=0;r0&&(r[s]={type:"ivec3",x:1,y:1},k(e,s))}var l=new RegExp("uniform\\s+"+o+"\\s+"+t+"\\s*;");if(!l.test(e.shaderSource)){var c="uniform "+o+" "+t+";";e.shaderSource=c+e.shaderSource}var h=t+"_"+e._count++;if(1===W(e,t,h)&&i)throw new u("strict: shader source does not use uniform '"+t+"'.");if(e.uniforms[t]=n,"sampler2D"===o)e._uniforms[h]=function(){return e._textures[t]},e._updateFunctions.push(F(t));else if("samplerCube"===o)e._uniforms[h]=function(){return e._textures[t]},e._updateFunctions.push(B(t));else if(-1!==o.indexOf("mat")){var d=new Y[o];e._uniforms[h]=function(){return Y[o].fromColumnMajorArray(e.uniforms[t],d)}}else e._uniforms[h]=function(){return e.uniforms[t]}}}function V(e){var t=e.type;if(!a(t)){var i=typeof e;if("number"===i)t="float";else if("boolean"===i)t="bool";else if("string"===i||e instanceof HTMLCanvasElement)t=/^([rgba]){1,4}$/i.test(e)?"channels":e===H.DefaultCubeMapId?"samplerCube":"sampler2D";else if("object"===i)if(c(e))(4===e.length||9===e.length||16===e.length)&&(t="mat"+Math.sqrt(e.length));else{var r=0;for(var n in e)e.hasOwnProperty(n)&&(r+=1);r>=2&&4>=r?t="vec"+r:6===r&&(t="samplerCube")}}return t}function U(e){var t=e._strict,i=e._template.materials;for(var n in i)if(i.hasOwnProperty(n)){var o=new H({strict:t,fabric:i[n],count:e._count});e._count=o._count,e._uniforms=r(e._uniforms,o._uniforms,!0),e.materials[n]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);var a="czm_getMaterial",s=a+"_"+e._count++;W(o,a,s),e.shaderSource=o.shaderSource+e.shaderSource;var l=s+"(materialInput)";if(0===W(e,n,l)&&t)throw new u("strict: shader source does not use material '"+n+"'.")}}function W(e,t,i,r){r=o(r,!0);var n=0,a="([\\w])?",s="([\\w"+(r?".":"")+"])?",l=new RegExp(s+t+a,"g");return e.shaderSource=e.shaderSource.replace(l,function(e,t,r){return t||r?e:(n+=1,i)}),n}function G(e,t,i){return W(e,t,t,i)}var H=function(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,M(e,this),s(this,{type:{value:this.type,writable:!1}}),a(H._uniformList[this.type])||(H._uniformList[this.type]=Object.keys(this._uniforms))};H._uniformList={},H.fromType=function(e,t){var i=new H({fabric:{type:e}});if(a(t))for(var r in t)t.hasOwnProperty(r)&&(i.uniforms[r]=t[r]);return i},H.prototype.isTranslucent=function(){if(a(this.translucent))return"function"==typeof this.translucent?this.translucent():this.translucent;for(var e=!0,t=this._translucentFunctions,i=t.length,r=0;i>r;++r){var n=t[r];if(e="function"==typeof n?e&&n():e&&n,!e)break}return e},H.prototype.update=function(e){var t,i,r=this._loadedImages,n=r.length;for(t=0;n>t;++t){var o=r[t];i=o.id;var a=o.image,s=e.createTexture2D({source:a});this._textures[i]=s;var l=i+"Dimensions";if(this.uniforms.hasOwnProperty(l)){var u=this.uniforms[l];u.x=s._width,u.y=s._height}}r.length=0;var c=this._loadedCubeMaps;for(n=c.length,t=0;n>t;++t){var h=c[t];i=h.id;var d=h.images,p=e.createCubeMap({source:{positiveX:d[0],negativeX:d[1],positiveY:d[2],negativeY:d[3],positiveZ:d[4],negativeZ:d[5]}});this._textures[i]=p}c.length=0;var m=this._updateFunctions;for(n=m.length,t=0;n>t;++t)m[t](this,e);var f=this.materials;for(var v in f)f.hasOwnProperty(v)&&f[v].update(e)},H.prototype.isDestroyed=function(){return!1},H.prototype.destroy=function(){var e=this._textures;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];i!==this._defaultTexture&&i.destroy()}var r=this.materials;for(var n in r)r.hasOwnProperty(n)&&r[n].destroy();return l(this)};var q=["type","materials","uniforms","components","source"],j=["diffuse","specular","shininess","normal","emission","alpha"],Y={mat2:d,mat3:p,mat4:m};return H._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}},H.DefaultImageId="czm_defaultImage",H.DefaultCubeMapId="czm_defaultCubeMap",H.ColorType="Color",H._materialCache.addMaterial(H.ColorType,{fabric:{type:H.ColorType,uniforms:{color:new i(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),H.ImageType="Image",H._materialCache.addMaterial(H.ImageType,{fabric:{type:H.ImageType,uniforms:{image:H.DefaultImageId,repeat:new e(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).rgb",alpha:"texture2D(image, fract(repeat * materialInput.st)).a"}},translucent:!0}),H.DiffuseMapType="DiffuseMap",H._materialCache.addMaterial(H.DiffuseMapType,{fabric:{type:H.DiffuseMapType,uniforms:{image:H.DefaultImageId,channels:"rgb",repeat:new e(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),H.AlphaMapType="AlphaMap",H._materialCache.addMaterial(H.AlphaMapType,{fabric:{type:H.AlphaMapType,uniforms:{image:H.DefaultImageId,channel:"a",repeat:new e(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0}),H.SpecularMapType="SpecularMap",H._materialCache.addMaterial(H.SpecularMapType,{fabric:{type:H.SpecularMapType,uniforms:{image:H.DefaultImageId,channel:"r",repeat:new e(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1}),H.EmissionMapType="EmissionMap",H._materialCache.addMaterial(H.EmissionMapType,{fabric:{type:H.EmissionMapType,uniforms:{image:H.DefaultImageId,channels:"rgb",repeat:new e(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),H.BumpMapType="BumpMap",H._materialCache.addMaterial(H.BumpMapType,{fabric:{type:H.BumpMapType,uniforms:{image:H.DefaultImageId,channel:"r",strength:.8,repeat:new e(1,1)},source:g},translucent:!1}),H.NormalMapType="NormalMap",H._materialCache.addMaterial(H.NormalMapType,{fabric:{type:H.NormalMapType,uniforms:{image:H.DefaultImageId,channels:"rgb",strength:.8,repeat:new e(1,1)},source:S},translucent:!1}),H.GridType="Grid",H._materialCache.addMaterial(H.GridType,{fabric:{type:H.GridType,uniforms:{color:new i(0,1,0,1),cellAlpha:.1,lineCount:new e(8,8),lineThickness:new e(1,1),lineOffset:new e(0,0)},source:w},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}}),H.StripeType="Stripe",H._materialCache.addMaterial(H.StripeType,{fabric:{type:H.StripeType,uniforms:{horizontal:!0,evenColor:new i(1,1,1,.5),oddColor:new i(0,0,1,.5),offset:0,repeat:5},source:P},translucent:function(e){var t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<0}}),H.CheckerboardType="Checkerboard",H._materialCache.addMaterial(H.CheckerboardType,{fabric:{type:H.CheckerboardType,uniforms:{lightColor:new i(1,1,1,.5),darkColor:new i(0,0,0,.5),repeat:new e(5,5)},source:_},translucent:function(e){var t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<0}}),H.DotType="Dot",H._materialCache.addMaterial(H.DotType,{fabric:{type:H.DotType,uniforms:{lightColor:new i(1,1,0,.75),darkColor:new i(0,1,1,.75),repeat:new e(5,5)},source:y},translucent:function(e){var t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<0}}),H.WaterType="Water",H._materialCache.addMaterial(H.WaterType,{fabric:{type:H.WaterType,uniforms:{baseWaterColor:new i(.2,.3,.6,1),blendColor:new i(0,1,.699,1),specularMap:H.DefaultImageId,normalMap:H.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:A},translucent:function(e){var t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<0}}),H.RimLightingType="RimLighting",H._materialCache.addMaterial(H.RimLightingType,{fabric:{type:H.RimLightingType,uniforms:{color:new i(1,0,0,.7),rimColor:new i(1,1,1,.4),width:.3},source:T},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<0}}),H.FadeType="Fade",H._materialCache.addMaterial(H.FadeType,{fabric:{type:H.FadeType,uniforms:{fadeInColor:new i(1,0,0,1),fadeOutColor:new i(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new e(.5,.5)},source:C},translucent:function(e){var t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<0}}),H.PolylineArrowType="PolylineArrow",H._materialCache.addMaterial(H.PolylineArrowType,{fabric:{type:H.PolylineArrowType,uniforms:{color:new i(1,1,1,1)},source:E},translucent:!0}),H.PolylineGlowType="PolylineGlow",H._materialCache.addMaterial(H.PolylineGlowType,{fabric:{type:H.PolylineGlowType,uniforms:{color:new i(0,.5,1,1),glowPower:.25},source:b},translucent:!0}),H.PolylineOutlineType="PolylineOutline",H._materialCache.addMaterial(H.PolylineOutlineType,{fabric:{type:H.PolylineOutlineType,uniforms:{color:new i(1,1,1,1),outlineColor:new i(1,0,0,1),outlineWidth:1},source:x},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}}),H}),i("Scene/MaterialAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/freezeObject","../Core/VertexFormat","../Shaders/Appearances/AllMaterialAppearanceFS","../Shaders/Appearances/AllMaterialAppearanceVS","../Shaders/Appearances/BasicMaterialAppearanceFS","../Shaders/Appearances/BasicMaterialAppearanceVS","../Shaders/Appearances/TexturedMaterialAppearanceFS","../Shaders/Appearances/TexturedMaterialAppearanceVS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";var p=function(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),n=e(i.closed,!1),o=e(i.materialSupport,p.MaterialSupport.TEXTURED);this.material=t(i.material)?i.material:d.fromType(d.ColorType),this.translucent=r,this._vertexShaderSource=e(i.vertexShaderSource,o.vertexShaderSource),this._fragmentShaderSource=e(i.fragmentShaderSource,o.fragmentShaderSource),this._renderState=h.getDefaultRenderState(r,n,i.renderState),this._closed=n,this._materialSupport=o,this._vertexFormat=o.vertexFormat,this._flat=e(i.flat,!1),this._faceForward=e(i.faceForward,!n)};return i(p.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},materialSupport:{get:function(){return this._materialSupport}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}}),p.prototype.getFragmentShaderSource=h.prototype.getFragmentShaderSource,p.prototype.isTranslucent=h.prototype.isTranslucent,p.prototype.getRenderState=h.prototype.getRenderState,p.MaterialSupport={BASIC:r({vertexFormat:n.POSITION_AND_NORMAL,vertexShaderSource:l,fragmentShaderSource:s}),TEXTURED:r({vertexFormat:n.POSITION_NORMAL_AND_ST,vertexShaderSource:c,fragmentShaderSource:u}),ALL:r({vertexFormat:n.ALL,vertexShaderSource:a,fragmentShaderSource:o})},p}),i("Shaders/Appearances/PerInstanceColorAppearanceFS",[],function(){"use strict";return"varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = v_color.rgb;\nmaterial.alpha = v_color.a;\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n}\n"}),i("Shaders/Appearances/PerInstanceColorAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec4 color;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Shaders/Appearances/PerInstanceFlatColorAppearanceFS",[],function(){"use strict";return"varying vec4 v_color;\nvoid main()\n{\ngl_FragColor = v_color;\n}\n"}),i("Shaders/Appearances/PerInstanceFlatColorAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Scene/PerInstanceColorAppearance",["../Core/defaultValue","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PerInstanceColorAppearanceFS","../Shaders/Appearances/PerInstanceColorAppearanceVS","../Shaders/Appearances/PerInstanceFlatColorAppearanceFS","../Shaders/Appearances/PerInstanceFlatColorAppearanceVS","./Appearance"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(t){t=e(t,e.EMPTY_OBJECT);var i=e(t.translucent,!0),u=e(t.closed,!1),c=e(t.flat,!1),h=c?a:n,d=c?o:r,p=c?l.FLAT_VERTEX_FORMAT:l.VERTEX_FORMAT;this.material=void 0,this.translucent=i,this._vertexShaderSource=e(t.vertexShaderSource,h),this._fragmentShaderSource=e(t.fragmentShaderSource,d),this._renderState=s.getDefaultRenderState(i,u,t.renderState),this._closed=u,this._vertexFormat=p,this._flat=c,this._faceForward=e(t.faceForward,!u)};return t(l.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}}),l.VERTEX_FORMAT=i.POSITION_AND_NORMAL,l.FLAT_VERTEX_FORMAT=i.POSITION_ONLY,l.prototype.getFragmentShaderSource=s.prototype.getFragmentShaderSource,l.prototype.isTranslucent=s.prototype.isTranslucent,l.prototype.getRenderState=s.prototype.getRenderState,l}),i("Scene/PrimitivePipeline",["../Core/BoundingSphere","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Ellipsoid","../Core/FeatureDetection","../Core/GeographicProjection","../Core/Geometry","../Core/GeometryAttribute","../Core/GeometryAttributes","../Core/GeometryPipeline","../Core/IndexDatatype","../Core/Matrix4","../Core/WebMercatorProjection"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f){"use strict";function v(e,t,i){var r,n=!i,o=e.length;if(!n&&o>1){var a=e[0].modelMatrix;for(r=1;o>r;++r)if(!m.equals(a,e[r].modelMatrix)){n=!0;break}}if(n)for(r=0;o>r;++r)d.transformToWorldCoordinates(e[r]);else m.multiplyTransformation(t,e[0].modelMatrix,t)}function g(e,r){var n=e.attributes,o=n.position,a=4*(o.values.length/o.componentsPerAttribute);n.pickColor=new c({componentDatatype:i.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,values:new Uint8Array(a)});for(var s=t.floatToByte(r.red),l=t.floatToByte(r.green),u=t.floatToByte(r.blue),h=t.floatToByte(r.alpha),d=n.pickColor.values,p=0;a>p;p+=4)d[p]=s,d[p+1]=l,d[p+2]=u,d[p+3]=h}function _(e,t){for(var i=e.length,r=0;i>r;++r){var o=e[r],a=t[r];n(o.geometry)?g(o.geometry,a):(g(o.westHemisphereGeometry,a),g(o.eastHemisphereGeometry,a))}}function y(e){var t,i=e.length,r=[],o=e[0].attributes;for(t in o)if(o.hasOwnProperty(t)){for(var a=o[t],s=!0,l=1;i>l;++l){var u=e[l].attributes[t];if(!n(u)||a.componentDatatype!==u.componentDatatype||a.componentsPerAttribute!==u.componentsPerAttribute||a.normalize!==u.normalize){s=!1;break}}s&&r.push(t)}return r}function C(e,t,r){for(var n=u.computeNumberOfVertices(t),o=r.length,a=0;o>a;++a){for(var s=r[a],l=e[s],h=l.componentDatatype,d=l.value,p=d.length,m=i.createTypedArray(h,n*p),f=0;n>f;++f)m.set(d,f*p);t.attributes[s]=new c({componentDatatype:h,componentsPerAttribute:p,normalize:l.normalize,values:m})}}function w(e,t){for(var i=e.length,r=0;i>r;++r){var o=e[r],a=o.attributes;n(o.geometry)?C(a,o.geometry,t):(C(a,o.westHemisphereGeometry,t),C(a,o.eastHemisphereGeometry,t))}}function S(t){var r,o,a=t.instances,s=t.pickIds,l=t.projection,u=t.elementIndexUintSupported,c=t.scene3DOnly,h=t.allowPicking,p=t.vertexCacheOptimize,m=t.compressVertices,f=t.modelMatrix,g=a.length;if(a[0].geometry.primitiveType,v(a,f,c),!c)for(r=0;g>r;++r)d.splitLongitude(a[r]);h&&_(a,s);var C=y(a);if(w(a,C),p)for(r=0;g>r;++r){var S=a[r];n(S.geometry)?(d.reorderForPostVertexCache(S.geometry),d.reorderForPreVertexCache(S.geometry)):(d.reorderForPostVertexCache(S.westHemisphereGeometry),d.reorderForPreVertexCache(S.westHemisphereGeometry),d.reorderForPostVertexCache(S.eastHemisphereGeometry),d.reorderForPreVertexCache(S.eastHemisphereGeometry))}var E=d.combineInstances(a);for(g=E.length,r=0;g>r;++r){o=E[r];var b,x=o.attributes;if(c)for(b in x)x.hasOwnProperty(b)&&x[b].componentDatatype===i.DOUBLE&&d.encodeAttribute(o,b,b+"3DHigh",b+"3DLow");else for(b in x)if(x.hasOwnProperty(b)&&x[b].componentDatatype===i.DOUBLE){var T=b+"3D",P=b+"2D";d.projectTo2D(o,b,T,P,l),n(o.boundingSphere)&&"position"===b&&(o.boundingSphereCV=e.fromVertices(o.attributes.position2D.values)),d.encodeAttribute(o,T,T+"High",T+"Low"),d.encodeAttribute(o,P,P+"High",P+"Low")}m&&d.compressVertices(o)}if(!u){var A=[];for(g=E.length,r=0;g>r;++r)o=E[r],A=A.concat(d.fitToUnsignedShortIndices(o));E=A}return E}function E(e,t,r){for(var n=[],o=e.attributes,a=r.length,s=0;a>s;++s){var l=r[s],u=o[l],c=u.componentDatatype;c===i.DOUBLE&&(c=i.FLOAT);var h=i.createTypedArray(c,u.values);n.push({index:t[l],componentDatatype:c,componentsPerAttribute:u.componentsPerAttribute,normalize:u.normalize,values:h}),delete o[l]}return n}function b(e,t,i,o,a,s,l,c,h){var d=u.computeNumberOfVertices(t);n(l[e])||(l[e]={boundingSphere:t.boundingSphere,boundingSphereCV:t.boundingSphereCV});for(var p=o.length,m=0;p>m;++m)for(var f=o[m],v=a[f],g=d;g>0;){for(var _,y=r(h[f],0),C=s[y],w=C.length,S=0;w>S&&(_=C[S],_.index!==v);++S);n(l[e][f])||(l[e][f]={dirty:!1,valid:!0,value:i[f].value,indices:[]});var E,b=_.values.length/_.componentsPerAttribute,x=r(c[f],0);b>x+g?(E=g,l[e][f].indices.push({attribute:_,offset:x,count:E}),c[f]=x+g):(E=b-x,l[e][f].indices.push({attribute:_,offset:x,count:E}),c[f]=0,h[f]=y+1),g-=E}}function x(e,t,i,r,o){var a,s,l,u=[],c=e.length,h={},d={};for(a=0;c>a;++a)s=e[a],l=s.attributes,n(s.geometry)&&b(a,s.geometry,l,o,r,i,u,h,d);for(a=0;c>a;++a)s=e[a],l=s.attributes,n(s.westHemisphereGeometry)&&b(a,s.westHemisphereGeometry,l,o,r,i,u,h,d);for(a=0;c>a;++a)s=e[a],l=s.attributes,n(s.eastHemisphereGeometry)&&b(a,s.eastHemisphereGeometry,l,o,r,i,u,h,d);for(c=t.length,a=0;c>a;++a){s=t[a],l=s.attributes;var p={};u.push(p);for(var m=o.length,f=0;m>f;++f){var v=o[f];p[v]={dirty:!1,valid:!1,value:l[v].value,indices:[]}}}return u}function T(e,t){var i=e.attributes;for(var r in i)if(i.hasOwnProperty(r)){var o=i[r];n(o)&&n(o.values)&&t.push(o.values.buffer)}n(e.indices)&&t.push(e.indices.buffer)}function P(e,t){for(var i=e.length,r=0;i>r;++r)T(e[r],t)}function A(e,t){for(var i=e.length,r=0;i>r;++r)for(var n=e[r],o=n.length,a=0;o>a;++a)t.push(n[a].values.buffer)}function D(t){for(var i=1,r=t.length,o=0;r>o;o++){var a=t[o];if(++i,n(a)){var s=a.attributes;i+=6+2*e.packedLength+(n(a.indices)?a.indices.length:0);for(var l in s)if(s.hasOwnProperty(l)&&n(s[l])){var u=s[l];i+=5+u.values.length}}}return i}function M(e,t){for(var i=e.length,r=new Uint32Array(e.length),n=0;i>n;++n)r[n]=e[n].toRgba();return t.push(r.buffer),r}function I(e){for(var i=e.length,r=new Array(i),n=0;i>n;n++)r[n]=t.fromRgba(e[n]);return r}function O(e){for(var t=e.length,i=1+17*t,r=0;t>r;r++){var o=e[r].attributes;for(var a in o)if(o.hasOwnProperty(a)&&n(o[a])){var s=o[a];i+=5+s.value.length}}return i}function R(e,t){var i=new Float64Array(O(e)),r={},o=[],a=e.length,s=0;i[s++]=a;for(var l=0;a>l;l++){var u=e[l];m.pack(u.modelMatrix,i,s),s+=m.packedLength;var c=u.attributes,h=[];for(var d in c)c.hasOwnProperty(d)&&n(c[d])&&(h.push(d),n(r[d])||(r[d]=o.length,o.push(d)));i[s++]=h.length;for(var p=0;pc;c++){for(var h=r[t[a++]],d=t[a++],p=t[a++],f=0!==t[a++],v=t[a++],g=i.createTypedArray(d,v),_=0;v>_;_++)g[_]=t[a++];l[h]={componentDatatype:d,componentsPerAttribute:p,normalize:f,value:g}}n[o++]={attributes:l,modelMatrix:s}}return n}function N(t){for(var i=t.length,r=1+i,o=0;i>o;o++){var a=t[o];r+=2,r+=n(a.boundingSphere)?e.packedLength:0,r+=n(a.boundingSphereCV)?e.packedLength:0;for(var s in a)if(a.hasOwnProperty(s)&&n(a[s])&&"boundingSphere"!==s&&"boundingSphereCV"!==s){var l=a[s];r+=4+3*l.indices.length+l.value.length}}return r}function F(t,i){var r=new Float64Array(N(t)),o=[],a=[],s={},l=t.length,u=0;r[u++]=l;for(var c=0;l>c;c++){var h=t[c],d=h.boundingSphere,p=n(d);r[u++]=p?1:0,p&&(e.pack(d,r,u),u+=e.packedLength),d=h.boundingSphereCV,p=n(d),r[u++]=p?1:0,p&&(e.pack(d,r,u),u+=e.packedLength);var m=[];for(var f in h)h.hasOwnProperty(f)&&n(h[f])&&"boundingSphere"!==f&&"boundingSphereCV"!==f&&(m.push(f),n(s[f])||(s[f]=o.length,o.push(f)));r[u++]=m.length;for(var v=0;vw;w++){var S=y[w];r[u++]=S.count,r[u++]=S.offset;var E=a.indexOf(S.attribute);-1===E&&(E=a.length,a.push(S.attribute)),r[u++]=E}r[u++]=_.value.length,r.set(_.value,u),u+=_.value.length}}return i.push(r.buffer),{stringTable:o,packedData:r,attributeTable:a}}function B(t){for(var r=t.stringTable,n=t.attributeTable,o=t.packedData,a=new Array(o[0]),s=0,l=1,u=o.length;u>l;){var c={},h=1===o[l++];h&&(c.boundingSphere=e.unpack(o,l),l+=e.packedLength),h=1===o[l++],h&&(c.boundingSphereCV=e.unpack(o,l),l+=e.packedLength);for(var d=o[l++],p=0;d>p;p++){for(var m=r[o[l++]],f=1===o[l++],v=o[l++],g=v>0?new Array(v):void 0,_=0;v>_;_++){var y={};y.count=o[l++],y.offset=o[l++],y.attribute=n[o[l++]],g[_]=y}for(var C=o[l++],w=f?i.createTypedArray(g[0].attribute.componentDatatype,C):new Array(C),S=0;C>S;S++)w[S]=o[l++];c[m]={dirty:!1,valid:f,indices:g,value:w}}a[s++]=c}return a}if(!s.supportsTypedArrays())return{};var z={};return z.combineGeometry=function(e){var t,i,r,o,a,s=e.instances,l=e.invalidInstances;if(s.length>0){t=S(e),i=d.createAttributeLocations(t[0]),o=y(s),r=[],a=t.length;for(var u=0;a>u;++u){var c=t[u];r.push(E(c,i,o))}}o=n(o)?o:y(l);var h=x(s,l,r,i,o);return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:i,vaAttributes:r,vaAttributeLocations:h,validInstancesIndices:e.validInstancesIndices,invalidInstancesIndices:e.invalidInstancesIndices}},z.packCreateGeometryResults=function(t,i){var r=new Float64Array(D(t)),o=[],a={},s=t.length,l=0;r[l++]=s;for(var u=0;s>u;u++){var c=t[u],h=n(c);if(r[l++]=h?1:0,h){r[l++]=c.primitiveType,r[l++]=c.geometryType;var d=n(c.boundingSphere)?1:0;r[l++]=d,d&&e.pack(c.boundingSphere,r,l),l+=e.packedLength;var p=n(c.boundingSphereCV)?1:0;r[l++]=p,p&&e.pack(c.boundingSphereCV,r,l),l+=e.packedLength;var m=c.attributes,f=[];for(var v in m)m.hasOwnProperty(v)&&n(m[v])&&(f.push(v),n(a[v])||(a[v]=o.length,o.push(v)));r[l++]=f.length;for(var g=0;g0&&(r.set(c.indices,l),l+=C)}}return i.push(r.buffer),{stringTable:o,packedData:r}},z.unpackCreateGeometryResults=function(t){for(var r,n=t.stringTable,o=t.packedData,a=new Array(o[0]),s=0,l=1;lr;r++){var x=n[o[l++]],T=o[l++];S=o[l++];var P=0!==o[l++];C=o[l++],w=i.createTypedArray(T,C);for(var A=0;C>A;A++)w[A]=o[l++];E[x]=new c({componentDatatype:T,componentsPerAttribute:S,normalize:P,values:w})}var D;if(C=o[l++],C>0){var M=w.length/S;for(D=p.createTypedArray(M,C),r=0;C>r;r++)D[r]=o[l++]}a[s++]=new u({primitiveType:v,geometryType:g,boundingSphere:m,indices:D,attributes:E})}else a[s++]=void 0}return a},z.packCombineGeometryParameters=function(e,t){for(var i=e.createGeometryResults,r=i.length,n=0;r>n;n++)t.push(i[n].packedData.buffer);var o;return e.allowPicking&&(o=M(e.pickIds,t)),{createGeometryResults:e.createGeometryResults,packedInstances:R(e.instances,t),packedPickIds:o,ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof l,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,allowPicking:e.allowPicking,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix}},z.unpackCombineGeometryParameters=function(e){for(var t=L(e.packedInstances),i=e.allowPicking,r=i?I(e.packedPickIds):void 0,o=e.createGeometryResults,s=o.length,u=0,c=[],h=[],d=[],p=[],v=[],g=0;s>g;g++)for(var _=z.unpackCreateGeometryResults(o[g]),y=_.length,C=0;y>C;C++){var w=_[C],S=t[u]; -n(w)?(S.geometry=w,c.push(S),d.push(u),i&&v.push(r[u])):(h.push(S),p.push(u)),++u}var E=a.clone(e.ellipsoid),b=e.isGeographic?new l(E):new f(E);return{instances:c,invalidInstances:h,validInstancesIndices:d,invalidInstancesIndices:p,pickIds:v,ellipsoid:E,projection:b,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,allowPicking:e.allowPicking,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:m.clone(e.modelMatrix)}},z.packCombineGeometryResults=function(e,t){return n(e.geometries)&&(P(e.geometries,t),A(e.vaAttributes,t)),{geometries:e.geometries,attributeLocations:e.attributeLocations,vaAttributes:e.vaAttributes,packedVaAttributeLocations:F(e.vaAttributeLocations,t),modelMatrix:e.modelMatrix,validInstancesIndices:e.validInstancesIndices,invalidInstancesIndices:e.invalidInstancesIndices}},z.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,vaAttributes:e.vaAttributes,perInstanceAttributeLocations:B(e.packedVaAttributeLocations,e.vaAttributes),modelMatrix:e.modelMatrix}},z}),i("Scene/PrimitiveState",["../Core/freezeObject"],function(e){"use strict";var t={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6};return e(t)}),i("Scene/Primitive",["../Core/BoundingSphere","../Core/clone","../Core/combine","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/FeatureDetection","../Core/Geometry","../Core/GeometryAttribute","../Core/GeometryAttributes","../Core/GeometryInstance","../Core/GeometryInstanceAttribute","../Core/isArray","../Core/Matrix4","../Core/subdivideArray","../Core/TaskProcessor","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/ShaderSource","../ThirdParty/when","./CullFace","./Pass","./PrimitivePipeline","./PrimitiveState","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P){"use strict";function A(e){return new h({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:new e.values.constructor(e.values)})}function D(t){var i=t.attributes,r=new d;for(var n in i)i.hasOwnProperty(n)&&o(i[n])&&(r[n]=A(i[n]));var a;if(o(t.indices)){var s=t.indices;a=new s.constructor(s)}return new c({attributes:r,indices:a,primitiveType:t.primitiveType,boundingSphere:e.clone(t.boundingSphere)})}function M(e){return new m({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,value:new e.value.constructor(e.value)})}function I(e,t){var i=e.attributes,r={};for(var n in i)i.hasOwnProperty(n)&&(r[n]=M(i[n]));return new p({geometry:t,modelMatrix:v.clone(e.modelMatrix),attributes:r,pickPrimitive:e.pickPrimitive,id:e.id})}function O(e,t,i){for(var r,n="",o="",a="";null!==(r=H.exec(t));){var s=r[1],l="vec4 czm_compute"+s[0].toUpperCase()+s.substr(1)+"()";"vec4 czm_computePosition()"!==l&&(n+=l+";\n"),i?a+=l+"\n"+"{\n"+" return czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow);\n"+"}\n\n":(o+="attribute vec3 "+s+"2DHigh;\n"+"attribute vec3 "+s+"2DLow;\n",a+=l+"\n"+"{\n"+" vec4 p;\n"+" if (czm_morphTime == 1.0)\n"+" {\n"+" p = czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow);\n"+" }\n"+" else if (czm_morphTime == 0.0)\n"+" {\n"+" p = czm_translateRelativeToEye("+s+"2DHigh.zxy, "+s+"2DLow.zxy);\n"+" }\n"+" else\n"+" {\n"+" p = czm_columbusViewMorph(\n"+" czm_translateRelativeToEye("+s+"2DHigh.zxy, "+s+"2DLow.zxy),\n"+" czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow),\n"+" czm_morphTime);\n"+" }\n"+" return p;\n"+"}\n\n")}return[n,o,t,a].join("\n")}function R(e){var t=e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,"void czm_old_main()"),i="attribute vec4 pickColor; \nvarying vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n czm_pickColor = pickColor; \n}";return t+"\n"+i}function L(e,t){if(!o(e._attributeLocations.show))return t;var i=t.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,"void czm_non_show_main()"),r="attribute float show;\nvoid main() \n{ \n czm_non_show_main(); \n gl_Position *= show; \n}";return i+"\n"+r}function N(e,t){if(!e.compressVertices)return t;var i=-1!==t.search(/attribute\s+vec3\s+normal;/g),r=-1!==t.search(/attribute\s+vec2\s+st;/g);if(!i&&!r)return t;var n=-1!==t.search(/attribute\s+vec3\s+tangent;/g),o=-1!==t.search(/attribute\s+vec3\s+binormal;/g),a=r&&i?2:1;a+=n||o?1:0;var s=a>1?"vec"+a:"float",l="compressedAttributes",u="attribute "+s+" "+l+";",c="",h="";if(r){c+="vec2 st;\n";var d=a>1?l+".x":l;h+=" st = czm_decompressTextureCoordinates("+d+");\n"}i&&n&&o?(c+="vec3 normal;\nvec3 tangent;\nvec3 binormal;\n",h+=" czm_octDecode("+l+"."+(r?"yz":"xy")+", normal, tangent, binormal);\n"):(i&&(c+="vec3 normal;\n",h+=" normal = czm_octDecode("+l+(a>1?"."+(r?"y":"x"):"")+");\n"),n&&(c+="vec3 tangent;\n",h+=" tangent = czm_octDecode("+l+"."+(r&&i?"z":"y")+");\n"),o&&(c+="vec3 binormal;\n",h+=" binormal = czm_octDecode("+l+"."+(r&&i?"z":"y")+");\n"));var p=t;p=p.replace(/attribute\s+vec3\s+normal;/g,""),p=p.replace(/attribute\s+vec2\s+st;/g,""),p=p.replace(/attribute\s+vec3\s+tangent;/g,""),p=p.replace(/attribute\s+vec3\s+binormal;/g,""),p=p.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,"void czm_non_compressed_main()");var m="void main() \n{ \n"+h+" czm_non_compressed_main(); \n"+"}";return[u,c,p,m].join("\n")}function F(e){e.vertexAttributes}function B(e,t,i){for(var r=[],a=i.length,s=0;a>s;++s){var l={primitive:n(i[s].pickPrimitive,t)};o(i[s].id)&&(l.id=i[s].id);var u=e.createPickId(l);t._pickIds.push(u),r.push(u.color)}return r}function z(e,t){return function(){return e[t]}}function k(e,t){var i=t[e];return function(){return o(i)&&o(i.value)?t[e].value:i}}function V(e,t,i){return function(r){var n=t[e];n.value=r,!n.dirty&&n.valid&&(i.push(n),n.dirty=!0)}}function U(e,t,i,r){e._error=r,e._state=i,t.afterRender.push(function(){e._ready=e._state===T.COMPLETE||e._state===T.FAILED,o(r)?e._readyPromise.reject(r):e._readyPromise.resolve(e)})}var W=function(e){e=n(e,n.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this.appearance=e.appearance,this._appearance=void 0,this._material=void 0,this.modelMatrix=v.clone(n(e.modelMatrix,v.IDENTITY)),this._modelMatrix=new v,this.show=n(e.show,!0),this._vertexCacheOptimize=n(e.vertexCacheOptimize,!1),this._interleave=n(e.interleave,!1),this._releaseGeometryInstances=n(e.releaseGeometryInstances,!0),this._allowPicking=n(e.allowPicking,!0),this._asynchronous=n(e.asynchronous,!0),this._compressVertices=n(e.compressVertices,!0),this.cull=n(e.cull,!0),this.debugShowBoundingVolume=n(e.debugShowBoundingVolume,!1),this._translucent=void 0,this._state=T.READY,this._geometries=[],this._vaAttributes=void 0,this._error=void 0,this._numberOfInstances=0,this._validModelMatrix=!1,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeLocations=void 0,this._perInstanceAttributeCache=[],this._instanceIds=[],this._lastPerInstanceAttributeIndex=0,this._dirtyAttributes=[],this._va=[],this._attributeLocations=void 0,this._primitiveType=void 0,this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._pickRS=void 0,this._pickSP=void 0,this._pickIds=[],this._colorCommands=[],this._pickCommands=[],this._createGeometryResults=void 0,this._ready=!1,this._readyPromise=S.defer()};a(W.prototype,{vertexCacheOptimize:{get:function(){return this._vertexCacheOptimize}},interleave:{get:function(){return this._interleave}},releaseGeometryInstances:{get:function(){return this._releaseGeometryInstances}},allowPicking:{get:function(){return this._allowPicking}},asynchronous:{get:function(){return this._asynchronous}},compressVertices:{get:function(){return this._compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}}});var G,H=/attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g,q=Math.max(u.hardwareConcurrency-1,1),j=new _("combineGeometry",Number.POSITIVE_INFINITY);return W.prototype.update=function(a,s,u){if(!(!o(this.geometryInstances)&&0===this._va.length||o(this.geometryInstances)&&f(this.geometryInstances)&&0===this.geometryInstances.length||!o(this.appearance)||s.mode!==P.SCENE3D&&s.scene3DOnly||!s.passes.render&&!s.passes.pick)){if(o(this._error))throw this._error;if(this._state!==T.FAILED){var c,h,d,p,m,A,M,k,V,W,H,Y,X,Z,J=s.mapProjection,Q=this.allowPicking,K=this._instanceIds,$=s.scene3DOnly,et=this;if(this._state!==T.COMPLETE&&this._state!==T.COMBINED)if(this.asynchronous){if(this._state===T.READY){Y=f(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],this._numberOfInstances=A=Y.length;var tt=[],it=[];for(M=0;A>M;++M)d=Y[M].geometry,K.push(Y[M].id),it.push({moduleName:d._workerName,geometry:d});if(!o(G))for(G=new Array(q),M=0;q>M;M++)G[M]=new _("createGeometry",Number.POSITIVE_INFINITY);var rt;for(it=g(it,q),M=0;Mk;++k)rt=ot[k],d=rt.geometry,o(d.constructor.pack)&&(rt.offset=nt,nt+=n(d.constructor.packedLength,d.packedLength));var st;if(nt>0){var lt=new Float64Array(nt);for(st=[lt.buffer],k=0;at>k;++k)rt=ot[k],d=rt.geometry,o(d.constructor.pack)&&(d.constructor.pack(d,lt,rt.offset),rt.geometry=lt)}tt.push(G[M].scheduleTask({subTasks:it[M]},st))}this._state=T.CREATING,S.all(tt,function(e){et._createGeometryResults=e,et._state=T.CREATED}).otherwise(function(e){U(et,s,T.FAILED,e)})}else if(this._state===T.CREATED){var ut=[];Y=f(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],W=j.scheduleTask(x.packCombineGeometryParameters({createGeometryResults:this._createGeometryResults,instances:Y,pickIds:Q?B(a,this,Y):void 0,ellipsoid:J.ellipsoid,projection:J,elementIndexUintSupported:a.elementIndexUint,scene3DOnly:$,allowPicking:Q,vertexCacheOptimize:this.vertexCacheOptimize,compressVertices:this.compressVertices,modelMatrix:this.modelMatrix},ut),ut),this._createGeometryResults=void 0,this._state=T.COMBINING,S(W,function(e){var t=x.unpackCombineGeometryResults(e);et._geometries=t.geometries,et._attributeLocations=t.attributeLocations,et._vaAttributes=t.vaAttributes,et._perInstanceAttributeLocations=t.perInstanceAttributeLocations,et.modelMatrix=v.clone(t.modelMatrix,et.modelMatrix),et._validModelMatrix=!v.equals(et.modelMatrix,v.IDENTITY);for(var i=e.validInstancesIndices,r=e.invalidInstancesIndices,n=et._instanceIds,a=new Array(n.length),l=i.length,u=0;l>u;++u)a[u]=n[i[u]];for(var c=r.length,h=0;c>h;++h)a[l+h]=n[r[h]];et._instanceIds=a,o(et._geometries)?et._state=T.COMBINED:U(et,s,T.FAILED,void 0)}).otherwise(function(e){U(et,s,T.FAILED,e)})}}else{Y=f(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],this._numberOfInstances=A=Y.length,Z=new Array(A),X=new Array(A);var ct=[],ht=0;for(M=0;A>M;M++){H=Y[M],d=H.geometry;var dt;dt=o(d.attributes)&&o(d.primitiveType)?D(d):d.constructor.createGeometry(d),o(dt)?(Z[ht]=dt,X[ht++]=I(H,dt),K.push(H.id)):ct.push(H)}Z.length=ht,X.length=ht;var pt=x.combineGeometry({instances:X,invalidInstances:ct,pickIds:Q?B(a,this,X):void 0,ellipsoid:J.ellipsoid,projection:J,elementIndexUintSupported:a.elementIndexUint,scene3DOnly:$,allowPicking:Q,vertexCacheOptimize:this.vertexCacheOptimize,compressVertices:this.compressVertices,modelMatrix:this.modelMatrix});for(this._geometries=pt.geometries,this._attributeLocations=pt.attributeLocations,this._vaAttributes=pt.vaAttributes,this._perInstanceAttributeLocations=pt.vaAttributeLocations,this.modelMatrix=v.clone(pt.modelMatrix,this.modelMatrix),this._validModelMatrix=!v.equals(this.modelMatrix,v.IDENTITY),M=0;MM;++M){d=Z[M],p=ft[M];var gt=p.length;for(k=0;gt>k;++k)m=p[k],m.vertexBuffer=a.createVertexBuffer(m.values,y.DYNAMIC_DRAW),delete m.values;if(vt.push(a.createVertexArrayFromGeometry({geometry:d,attributeLocations:mt,bufferUsage:y.STATIC_DRAW,interleave:this._interleave,vertexArrayAttributes:p})),this._boundingSpheres.push(e.clone(d.boundingSphere)),this._boundingSphereWC.push(new e),!$){var _t=d.boundingSphereCV.center,yt=_t.x,Ct=_t.y,wt=_t.z;_t.x=wt,_t.y=yt,_t.z=Ct,this._boundingSphereCV.push(e.clone(d.boundingSphereCV)),this._boundingSphere2D.push(new e),this._boundingSphereMorph.push(new e)}}this._va=vt,this._primitiveType=Z[0].primitiveType,this.releaseGeometryInstances&&(this.geometryInstances=void 0),this._geometries=void 0,U(this,s,T.COMPLETE,void 0)}if(this.show&&this._state===T.COMPLETE){var St=this.appearance,Et=St.material,bt=!1,xt=!1;this._appearance!==St?(this._appearance=St,this._material=Et,bt=!0,xt=!0):this._material!==Et&&(this._material=Et,xt=!0);var Tt=this._appearance.isTranslucent();this._translucent!==Tt&&(this._translucent=Tt,bt=!0),o(this._material)&&this._material.update(a);var Pt=St.closed&&Tt;if(bt){var At,Dt=St.getRenderState();Pt?(At=t(Dt,!1),At.cull={enabled:!0,face:E.BACK},this._frontFaceRS=a.createRenderState(At),At.cull.face=E.FRONT,this._backFaceRS=a.createRenderState(At)):(this._frontFaceRS=a.createRenderState(Dt),this._backFaceRS=this._frontFaceRS),Q?Pt?(At=t(Dt,!1),At.cull={enabled:!1},this._pickRS=a.createRenderState(At)):this._pickRS=this._frontFaceRS:(At=t(Dt,!1),At.colorMask={red:!1,green:!1,blue:!1,alpha:!1},Pt?(At.cull={enabled:!1},this._pickRS=a.createRenderState(At)):this._pickRS=a.createRenderState(At))}if(xt){var Mt=O(this,St.vertexShaderSource,$);Mt=L(this,Mt),Mt=N(this,Mt);var It=St.getFragmentShaderSource();if(this._sp=a.replaceShaderProgram(this._sp,Mt,It,mt),F(this._sp,mt),Q){var Ot=new w({sources:[It],pickColorQualifier:"varying"});this._pickSP=a.replaceShaderProgram(this._pickSP,R(Mt),Ot,mt)}else this._pickSP=a.createShaderProgram(Mt,It,mt);F(this._pickSP,mt)}var Rt=this._colorCommands,Lt=this._pickCommands;if(bt||xt){var Nt=o(Et)?Et._uniforms:void 0,Ft={},Bt=St.uniforms;if(o(Bt))for(var zt in Bt)if(Bt.hasOwnProperty(zt)){if(o(Nt)&&o(Nt[zt]))throw new l("Appearance and material have a uniform with the same name: "+zt);Ft[zt]=z(Bt,zt)}var kt=i(Ft,Nt),Vt=Tt?b.TRANSLUCENT:b.OPAQUE;Rt.length=this._va.length*(Pt?2:1),Lt.length=this._va.length,A=Rt.length;var Ut=0,Wt=0;for(M=0;A>M;++M)Pt&&(c=Rt[M],o(c)||(c=Rt[M]=new C({owner:this,primitiveType:this._primitiveType})),c.vertexArray=this._va[Wt],c.renderState=this._backFaceRS,c.shaderProgram=this._sp,c.uniformMap=kt,c.pass=Vt,++M),c=Rt[M],o(c)||(c=Rt[M]=new C({owner:this,primitiveType:this._primitiveType})),c.vertexArray=this._va[Wt],c.renderState=this._frontFaceRS,c.shaderProgram=this._sp,c.uniformMap=kt,c.pass=Vt,h=Lt[Ut],o(h)||(h=Lt[Ut]=new C({owner:this,primitiveType:this._primitiveType})),h.vertexArray=this._va[Wt],h.renderState=this._pickRS,h.shaderProgram=this._pickSP,h.uniformMap=kt,h.pass=Vt,++Ut,++Wt}if(this._dirtyAttributes.length>0){for(p=this._dirtyAttributes,A=p.length,M=0;A>M;++M){m=p[M];var Gt=m.value,Ht=m.indices,qt=Ht.length;for(k=0;qt>k;++k){V=Ht[k];for(var jt=V.offset,Yt=V.count,Xt=V.attribute,Zt=Xt.componentDatatype,Jt=Xt.componentsPerAttribute,Qt=r.createTypedArray(Zt,Yt*Jt),Kt=0;Yt>Kt;++Kt)Qt.set(Gt,Kt*Jt);var $t=jt*Jt*r.getSizeInBytes(Zt);Xt.vertexBuffer.copyFromArrayView(Qt,$t)}m.dirty=!1}p.length=0}var ei=this.modelMatrix;if(!v.equals(ei,this._modelMatrix))for(v.clone(ei,this._modelMatrix),A=this._boundingSpheres.length,M=0;A>M;++M){var ti=this._boundingSpheres[M];o(ti)&&(this._boundingSphereWC[M]=e.transform(ti,ei,this._boundingSphereWC[M]),$||(this._boundingSphere2D[M]=e.clone(this._boundingSphereCV[M],this._boundingSphere2D[M]),this._boundingSphere2D[M].center.x=0,this._boundingSphereMorph[M]=e.union(this._boundingSphereWC[M],this._boundingSphereCV[M])))}var ii;s.mode===P.SCENE3D?ii=this._boundingSphereWC:s.mode===P.COLUMBUS_VIEW?ii=this._boundingSphereCV:s.mode===P.SCENE2D&&o(this._boundingSphere2D)?ii=this._boundingSphere2D:o(this._boundingSphereMorph)&&(ii=this._boundingSphereMorph);var ri=s.passes;if(ri.render)for(A=Rt.length,M=0;A>M;++M){var ni=Pt?Math.floor(M/2):M;Rt[M].modelMatrix=ei,Rt[M].boundingVolume=ii[ni],Rt[M].cull=this.cull,Rt[M].debugShowBoundingVolume=this.debugShowBoundingVolume,u.push(Rt[M])}if(ri.pick)for(A=Lt.length,M=0;A>M;++M)Lt[M].modelMatrix=ei,Lt[M].boundingVolume=ii[M],Lt[M].cull=this.cull,u.push(Lt[M])}}}},W.prototype.getGeometryInstanceAttributes=function(e){for(var t=-1,i=this._lastPerInstanceAttributeIndex,r=this._instanceIds,n=r.length,s=0;n>s;++s){var l=(i+s)%n;if(e===r[l]){t=l;break}}if(-1===t)return void 0;var u=this._perInstanceAttributeCache[t];if(o(u))return u;var c=this._perInstanceAttributeLocations[t];u={};var h={},d=!1;for(var p in c)c.hasOwnProperty(p)&&(d=!0,h[p]={get:k(p,c)},"boundingSphere"!==p&&"boundingSphereCV"!==p&&(h[p].set=V(p,c,this._dirtyAttributes)));return d&&a(u,h),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=u,u},W.prototype.isDestroyed=function(){return!1},W.prototype.destroy=function(){var e,t;this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy();var i=this._va;for(e=i.length,t=0;e>t;++t)i[t].destroy();this._va=void 0;var r=this._pickIds;for(e=r.length,t=0;e>t;++t)r[t].destroy();return this._pickIds=void 0,s(this)},W}),i("DataSources/ColorMaterialProperty",["../Core/Color","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./ConstantProperty","./createPropertyDescriptor","./Property"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(e){this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this.color=e};return i(l.prototype,{isConstant:{get:function(){return s.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:a("color")}),l.prototype.getType=function(){return"Color"},l.prototype.getValue=function(i,r){return t(r)||(r={}),r.color=s.getValueOrClonedDefault(this._color,i,e.WHITE,r.color),r},l.prototype.equals=function(e){return this===e||e instanceof l&&s.equals(this._color,e._color)},l}),i("DataSources/dynamicGeometryGetBoundingSphere",["../Core/BoundingSphere","../Core/defined","../Core/DeveloperError","./BoundingSphereState"],function(e,t,i,r){"use strict";var n=function(i,n,o,a){var s;return t(n)&&n.show&&n.ready&&(s=n.getGeometryInstanceAttributes(i),t(s)&&t(s.boundingSphere))?(e.transform(s.boundingSphere,n.modelMatrix,a),r.DONE):t(o)&&o.show&&o.ready&&(s=o.getGeometryInstanceAttributes(i),t(s)&&t(s.boundingSphere))?(e.transform(s.boundingSphere,o.modelMatrix,a),r.DONE):t(n)&&!n.ready||t(o)&&!o.ready?r.PENDING:r.FAILED};return n}),i("DataSources/MaterialProperty",["../Core/Color","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Scene/Material"],function(e,t,i,r,n){"use strict";var o=function(){r.throwInstantiationError()};return i(o.prototype,{isConstant:{get:r.throwInstantiationError},definitionChanged:{get:r.throwInstantiationError}}),o.prototype.getType=r.throwInstantiationError,o.prototype.getValue=r.throwInstantiationError,o.prototype.equals=r.throwInstantiationError,o.getValue=function(i,r,o){var a;return t(r)&&(a=r.getType(i),t(a))?(t(o)&&o.type===a||(o=n.fromType(a)),r.getValue(i,o.uniforms),o):(t(o)&&o.type===n.ColorType||(o=n.fromType(n.ColorType)),e.clone(e.WHITE,o.uniforms.color),o)},o}),i("DataSources/BoxGeometryUpdater",["../Core/BoxGeometry","../Core/BoxOutlineGeometry","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";var w=new v(i.WHITE),S=new g(!0),E=new g(!0),b=new g(!1),x=new g(i.BLACK),T=new i,P=function(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0},A=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(A.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new P(e),this._onEntityPropertyChanged(e,"box",e.box,void 0)};a(A,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),a(A.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!o(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!o(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),A.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},A.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},A.prototype.createFillGeometryInstance=function(t){var n,a,s=this._entity,l=s.isAvailable(t),u=new d(l&&s.isShowing&&this._showProperty.getValue(t)&&this._fillProperty.getValue(t));if(this._materialProperty instanceof v){var p=i.WHITE;o(this._materialProperty.color)&&(this._materialProperty.color.isConstant||l)&&(p=this._materialProperty.color.getValue(t)),a=r.fromColor(p),n={show:u,color:a}}else n={show:u};return new c({id:s,geometry:e.fromDimensions(this._options),modelMatrix:s._getModelMatrix(h.MINIMUM_VALUE),attributes:n})},A.prototype.createOutlineGeometryInstance=function(e){var n=this._entity,o=n.isAvailable(e),a=C.getValueOrDefault(this._outlineColorProperty,e,i.BLACK);return new c({id:n,geometry:t.fromDimensions(this._options),modelMatrix:n._getModelMatrix(h.MINIMUM_VALUE),attributes:{show:new d(o&&n.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:r.fromColor(a)}})},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){this._entitySubscription(),s(this)},A.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"position"===t||"orientation"===t||"box"===t){var i=this._entity.box;if(!o(i))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var r=i.fill,a=o(r)&&r.isConstant?r.getValue(h.MINIMUM_VALUE):!0,s=i.outline,l=o(s);if(l&&s.isConstant&&(l=s.getValue(h.MINIMUM_VALUE)),!a&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var u=i.dimensions,c=e.position,d=i.show;if(!o(u)||!o(c)||o(d)&&d.isConstant&&!d.getValue(h.MINIMUM_VALUE))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var f=n(i.material,w),g=f instanceof v;this._materialProperty=f,this._fillProperty=n(r,E),this._showProperty=n(d,S),this._showOutlineProperty=n(i.outline,b),this._outlineColorProperty=l?n(i.outlineColor,x):void 0;var _=i.outlineWidth;if(this._fillEnabled=a,this._outlineEnabled=l,c.isConstant&&C.isConstant(e.orientation)&&u.isConstant&&C.isConstant(_)){var y=this._options;y.vertexFormat=g?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,y.dimensions=u.getValue(h.MINIMUM_VALUE,y.dimensions),this._outlineWidth=o(_)?_.getValue(h.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},A.prototype.createDynamicUpdater=function(e){return new D(e,this)};var D=function(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new P(t._entity)};return D.prototype.update=function(n){var a=this._primitives;a.removeAndDestroy(this._primitive),a.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var s=this._geometryUpdater,l=s._entity,u=l.box;if(l.isShowing&&l.isAvailable(n)&&C.getValueOrDefault(u.show,n,!0)){var h=this._options,d=l._getModelMatrix(n),v=C.getValueOrUndefined(u.dimensions,n,h.dimensions);if(o(d)&&o(v)){if(h.dimensions=v,C.getValueOrDefault(u.fill,n,!0)){var g=y.getValue(n,s.fillMaterialProperty,this._material);this._material=g;var _=new p({material:g,translucent:g.isTranslucent(),closed:!0});h.vertexFormat=_.vertexFormat,this._primitive=a.add(new f({geometryInstances:new c({id:l,geometry:e.fromDimensions(h),modelMatrix:d}),appearance:_,asynchronous:!1}))}if(C.getValueOrDefault(u.outline,n,!1)){h.vertexFormat=m.VERTEX_FORMAT;var w=C.getValueOrClonedDefault(u.outlineColor,n,i.BLACK,T),S=C.getValueOrDefault(u.outlineWidth,n,1),E=1!==w.alpha;this._outlinePrimitive=a.add(new f({geometryInstances:new c({id:l,geometry:t.fromDimensions(h),modelMatrix:d,attributes:{color:r.fromColor(w)}}),appearance:new m({flat:!0,translucent:E,renderState:{lineWidth:s._scene.clampLineWidth(S)}}),asynchronous:!1}))}}}},D.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},D.prototype.isDestroyed=function(){return!1},D.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),s(this)},A}),i("DataSources/ImageMaterialProperty",["../Core/Cartesian2","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","./createPropertyDescriptor","./Property"],function(e,t,i,r,n,o,a){"use strict";var s=new e(1,1),l=function(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new n,this._image=void 0,this._imageSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.image=e.image,this.repeat=e.repeat};return r(l.prototype,{isConstant:{get:function(){return a.isConstant(this._image)&&a.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:o("image"),repeat:o("repeat")}),l.prototype.getType=function(){return"Image"},l.prototype.getValue=function(e,t){return i(t)||(t={}),t.image=a.getValueOrUndefined(this._image,e),t.repeat=a.getValueOrClonedDefault(this._repeat,e,s,t.repeat),t},l.prototype.equals=function(e){return this===e||e instanceof l&&a.equals(this._image,e._image)&&a.equals(this._repeat,e._repeat)},l}),i("DataSources/createMaterialPropertyDescriptor",["../Core/Color","../Core/DeveloperError","./ColorMaterialProperty","./createPropertyDescriptor","./ImageMaterialProperty"],function(e,t,i,r,n){"use strict";function o(t){if(t instanceof e)return new i(t);if("string"==typeof t||t instanceof HTMLCanvasElement){var r=new n;return r.image=t,r}}function a(e,t){return r(e,t,o)}return a}),i("DataSources/BoxGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._dimensions=void 0,this._dimensionsSubscription=void 0,this._show=void 0,this._showSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),dimensions:a("dimensions"),material:o("material"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth")}),s.prototype.clone=function(e){return t(e)?(e.dimensions=this.dimensions,e.show=this.show,e.material=this.material,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e):new s(this)},s.prototype.merge=function(t){this.dimensions=e(this.dimensions,t.dimensions),this.show=e(this.show,t.show),this.material=e(this.material,t.material),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth)},s}),i("DataSources/CallbackProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event"],function(e,t,i,r){"use strict";var n=function(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new r,this.setCallback(e,t)};return t(n.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}}),n.prototype.getValue=function(e,t){return this._callback(e,t)},n.prototype.setCallback=function(e,t){var i=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,i&&this._definitionChanged.raiseEvent(this)},n.prototype.equals=function(e){return this===e||e instanceof n&&this._callback===e._callback&&this._isConstant===e._isConstant},n}),i("DataSources/CheckerboardMaterialProperty",["../Core/Cartesian2","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","./createPropertyDescriptor","./Property"],function(e,t,i,r,n,o,a,s){"use strict";var l=t.WHITE,u=t.BLACK,c=new e(2,2),h=function(e){e=i(e,i.EMPTY_OBJECT),this._definitionChanged=new o,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.repeat=e.repeat};return n(h.prototype,{isConstant:{get:function(){return s.isConstant(this._evenColor)&&s.isConstant(this._oddColor)&&s.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},evenColor:a("evenColor"),oddColor:a("oddColor"),repeat:a("repeat")}),h.prototype.getType=function(){return"Checkerboard"},h.prototype.getValue=function(e,t){return r(t)||(t={}),t.lightColor=s.getValueOrClonedDefault(this._evenColor,e,l,t.lightColor),t.darkColor=s.getValueOrClonedDefault(this._oddColor,e,u,t.darkColor),t.repeat=s.getValueOrDefault(this._repeat,e,c),t},h.prototype.equals=function(e){return this===e||e instanceof h&&s.equals(this._evenColor,e._evenColor)&&s.equals(this._oddColor,e._oddColor)&&s.equals(this._repeat,e._repeat)},h}),i("DataSources/PositionProperty",["../Core/Cartesian3","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix3","../Core/ReferenceFrame","../Core/Transforms"],function(e,t,i,r,n,o,a){"use strict";var s=function(){r.throwInstantiationError()};i(s.prototype,{isConstant:{get:r.throwInstantiationError},definitionChanged:{get:r.throwInstantiationError},referenceFrame:{get:r.throwInstantiationError}}),s.prototype.getValue=r.throwInstantiationError,s.prototype.getValueInReferenceFrame=r.throwInstantiationError,s.prototype.equals=r.throwInstantiationError; -var l=new n;return s.convertToReferenceFrame=function(i,r,s,u,c){if(!t(r))return r;if(t(c)||(c=new e),s===u)return e.clone(r,c);var h=a.computeIcrfToFixedMatrix(i,l);return t(h)||(h=a.computeTemeToPseudoFixedMatrix(i,l)),s===o.INERTIAL?n.multiplyByVector(h,r,c):s===o.FIXED?n.multiplyByVector(n.transpose(h,l),r,c):void 0},s}),i("DataSources/ConstantPositionProperty",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ReferenceFrame","./PositionProperty"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(i,r){this._definitionChanged=new o,this._value=e.clone(i),this._referenceFrame=t(r,a.FIXED)};return r(l.prototype,{isConstant:{get:function(){return!i(this._value)||this._referenceFrame===a.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),l.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,a.FIXED,t)},l.prototype.setValue=function(t,r){var n=!1;e.equals(this._value,t)||(n=!0,this._value=e.clone(t)),i(r)&&this._referenceFrame!==r&&(n=!0,this._referenceFrame=r),n&&this._definitionChanged.raiseEvent(this)},l.prototype.getValueInReferenceFrame=function(e,t,i){return s.convertToReferenceFrame(e,this._value,this._referenceFrame,t,i)},l.prototype.equals=function(t){return this===t||t instanceof l&&e.equals(this._value,t._value)&&this._referenceFrame===t._referenceFrame},l}),i("DataSources/CorridorGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._show=void 0,this._showSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),material:o("material"),positions:a("positions"),height:a("height"),extrudedHeight:a("extrudedHeight"),granularity:a("granularity"),width:a("width"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth"),cornerType:a("cornerType")}),s.prototype.clone=function(e){return t(e)?(e.show=this.show,e.material=this.material,e.positions=this.positions,e.height=this.height,e.extrudedHeight=this.extrudedHeight,e.granularity=this.granularity,e.width=this.width,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.cornerType=this.cornerType,e):new s(this)},s.prototype.merge=function(t){this.show=e(this.show,t.show),this.material=e(this.material,t.material),this.positions=e(this.positions,t.positions),this.height=e(this.height,t.height),this.extrudedHeight=e(this.extrudedHeight,t.extrudedHeight),this.granularity=e(this.granularity,t.granularity),this.width=e(this.width,t.width),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth),this.cornerType=e(this.cornerType,t.cornerType)},s}),i("DataSources/createRawPropertyDescriptor",["./createPropertyDescriptor"],function(e){"use strict";function t(e){return e}function i(i,r){return e(i,r,t)}return i}),i("DataSources/CylinderGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._length=void 0,this._lengthSubscription=void 0,this._topRadius=void 0,this._topRadiusSubscription=void 0,this._bottomRadius=void 0,this._bottomRadiusSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._slices=void 0,this._slicesSubscription=void 0,this._show=void 0,this._showSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},length:a("length"),topRadius:a("topRadius"),bottomRadius:a("bottomRadius"),numberOfVerticalLines:a("numberOfVerticalLines"),slices:a("slices"),show:a("show"),material:o("material"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth")}),s.prototype.clone=function(e){return t(e)?(e.bottomRadius=this.bottomRadius,e.length=this.length,e.topRadius=this.topRadius,e.show=this.show,e.material=this.material,e.numberOfVerticalLines=this.numberOfVerticalLines,e.slices=this.slices,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e):new s(this)},s.prototype.merge=function(t){this.bottomRadius=e(this.bottomRadius,t.bottomRadius),this.length=e(this.length,t.length),this.topRadius=e(this.topRadius,t.topRadius),this.show=e(this.show,t.show),this.material=e(this.material,t.material),this.numberOfVerticalLines=e(this.numberOfVerticalLines,t.numberOfVerticalLines),this.slices=e(this.slices,t.slices),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth)},s}),i("DataSources/EllipseGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._semiMajorAxis=void 0,this._semiMajorAxisSubscription=void 0,this._semiMinorAxis=void 0,this._semiMinorAxisSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._show=void 0,this._showSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},semiMajorAxis:a("semiMajorAxis"),semiMinorAxis:a("semiMinorAxis"),rotation:a("rotation"),show:a("show"),material:o("material"),height:a("height"),extrudedHeight:a("extrudedHeight"),granularity:a("granularity"),stRotation:a("stRotation"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth"),numberOfVerticalLines:a("numberOfVerticalLines")}),s.prototype.clone=function(e){return t(e)?(e.rotation=this.rotation,e.semiMajorAxis=this.semiMajorAxis,e.semiMinorAxis=this.semiMinorAxis,e.show=this.show,e.material=this.material,e.height=this.height,e.extrudedHeight=this.extrudedHeight,e.granularity=this.granularity,e.stRotation=this.stRotation,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e):new s(this)},s.prototype.merge=function(t){this.rotation=e(this.rotation,t.rotation),this.semiMajorAxis=e(this.semiMajorAxis,t.semiMajorAxis),this.semiMinorAxis=e(this.semiMinorAxis,t.semiMinorAxis),this.show=e(this.show,t.show),this.material=e(this.material,t.material),this.height=e(this.height,t.height),this.extrudedHeight=e(this.extrudedHeight,t.extrudedHeight),this.granularity=e(this.granularity,t.granularity),this.stRotation=e(this.stRotation,t.stRotation),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth),this.numberOfVerticalLines=e(this.numberOfVerticalLines,t.numberOfVerticalLines)},s}),i("DataSources/EllipsoidGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._show=void 0,this._showSubscription=void 0,this._radii=void 0,this._radiiSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._stackPartitions=void 0,this._stackPartitionsSubscription=void 0,this._slicePartitions=void 0,this._slicePartitionsSubscription=void 0,this._subdivisions=void 0,this._subdivisionsSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),radii:a("radii"),material:o("material"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth"),stackPartitions:a("stackPartitions"),slicePartitions:a("slicePartitions"),subdivisions:a("subdivisions")}),s.prototype.clone=function(e){return t(e)?(e.show=this.show,e.radii=this.radii,e.material=this.material,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.stackPartitions=this.stackPartitions,e.slicePartitions=this.slicePartitions,e.subdivisions=this.subdivisions,e):new s(this)},s.prototype.merge=function(t){this.show=e(this.show,t.show),this.radii=e(this.radii,t.radii),this.material=e(this.material,t.material),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth),this.stackPartitions=e(this.stackPartitions,t.stackPartitions),this.slicePartitions=e(this.slicePartitions,t.slicePartitions),this.subdivisions=e(this.subdivisions,t.subdivisions)},s}),i("DataSources/LabelGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createPropertyDescriptor"],function(e,t,i,r,n,o){"use strict";var a=function(t){this._text=void 0,this._textSubscription=void 0,this._font=void 0,this._fontSubscription=void 0,this._style=void 0,this._styleSubscription=void 0,this._fillColor=void 0,this._fillColorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._show=void 0,this._showSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(a.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},text:o("text"),font:o("font"),style:o("style"),fillColor:o("fillColor"),outlineColor:o("outlineColor"),outlineWidth:o("outlineWidth"),horizontalOrigin:o("horizontalOrigin"),verticalOrigin:o("verticalOrigin"),eyeOffset:o("eyeOffset"),pixelOffset:o("pixelOffset"),scale:o("scale"),show:o("show"),translucencyByDistance:o("translucencyByDistance"),pixelOffsetScaleByDistance:o("pixelOffsetScaleByDistance")}),a.prototype.clone=function(e){return t(e)?(e.text=this.text,e.font=this.font,e.show=this.show,e.style=this.style,e.fillColor=this.fillColor,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.scale=this.scale,e.horizontalOrigin=this.horizontalOrigin,e.verticalOrigin=this.verticalOrigin,e.eyeOffset=this.eyeOffset,e.pixelOffset=this.pixelOffset,e.translucencyByDistance=this.translucencyByDistance,e.pixelOffsetScaleByDistance=this.pixelOffsetScaleByDistance,e):new a(this)},a.prototype.merge=function(t){this.text=e(this.text,t.text),this.font=e(this.font,t.font),this.show=e(this.show,t.show),this.style=e(this.style,t.style),this.fillColor=e(this.fillColor,t.fillColor),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth),this.scale=e(this.scale,t.scale),this.horizontalOrigin=e(this.horizontalOrigin,t.horizontalOrigin),this.verticalOrigin=e(this.verticalOrigin,t.verticalOrigin),this.eyeOffset=e(this.eyeOffset,t.eyeOffset),this.pixelOffset=e(this.pixelOffset,t.pixelOffset),this.translucencyByDistance=e(this._translucencyByDistance,t.translucencyByDistance),this.pixelOffsetScaleByDistance=e(this._pixelOffsetScaleByDistance,t.pixelOffsetScaleByDistance)},a}),i("DataSources/ModelGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createPropertyDescriptor"],function(e,t,i,r,n,o){"use strict";var a=function(t){this._show=void 0,this._showSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._minimumPixelSize=void 0,this._minimumPixelSizeSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(a.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:o("show"),scale:o("scale"),minimumPixelSize:o("minimumPixelSize"),uri:o("uri")}),a.prototype.clone=function(e){return t(e)?(e.show=this.show,e.scale=this.scale,e.minimumPixelSize=this.minimumPixelSize,e.uri=this.uri,e):new a(this)},a.prototype.merge=function(t){this.show=e(this.show,t.show),this.scale=e(this.scale,t.scale),this.minimumPixelSize=e(this.minimumPixelSize,t.minimumPixelSize),this.uri=e(this.uri,t.uri)},a}),i("DataSources/PathGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._material=void 0,this._materialSubscription=void 0,this._show=void 0,this._showSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._resolution=void 0,this._resolutionSubscription=void 0,this._leadTime=void 0,this._leadTimeSubscription=void 0,this._trailTime=void 0,this._trailTimeSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),material:o("material"),width:a("width"),resolution:a("resolution"),leadTime:a("leadTime"),trailTime:a("trailTime")}),s.prototype.clone=function(e){return t(e)?(e.material=this.material,e.width=this.width,e.resolution=this.resolution,e.show=this.show,e.leadTime=this.leadTime,e.trailTime=this.trailTime,e):new s(this)},s.prototype.merge=function(t){this.material=e(this.material,t.material),this.width=e(this.width,t.width),this.resolution=e(this.resolution,t.resolution),this.show=e(this.show,t.show),this.leadTime=e(this.leadTime,t.leadTime),this.trailTime=e(this.trailTime,t.trailTime)},s}),i("DataSources/PointGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createPropertyDescriptor"],function(e,t,i,r,n,o){"use strict";var a=function(t){this._color=void 0,this._colorSubscription=void 0,this._pixelSize=void 0,this._pixelSizeSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._show=void 0,this._showSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(a.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},color:o("color"),pixelSize:o("pixelSize"),outlineColor:o("outlineColor"),outlineWidth:o("outlineWidth"),show:o("show"),scaleByDistance:o("scaleByDistance"),translucencyByDistance:o("translucencyByDistance")}),a.prototype.clone=function(e){return t(e)?(e.color=this.color,e.pixelSize=this.pixelSize,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.show=this.show,e.scaleByDistance=this.scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e):new a(this)},a.prototype.merge=function(t){this.color=e(this.color,t.color),this.pixelSize=e(this.pixelSize,t.pixelSize),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth),this.show=e(this.show,t.show),this.scaleByDistance=e(this.scaleByDistance,t.scaleByDistance),this.translucencyByDistance=e(this._translucencyByDistance,t.translucencyByDistance)},a}),i("DataSources/PolygonGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._show=void 0,this._showSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._hierarchy=void 0,this._hierarchySubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._perPositionHeight=void 0,this._perPositionHeightSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._definitionChanged=new n,this._fill=void 0,this._fillSubscription=void 0,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),material:o("material"),hierarchy:a("hierarchy"),height:a("height"),extrudedHeight:a("extrudedHeight"),granularity:a("granularity"),stRotation:a("stRotation"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth"),perPositionHeight:a("perPositionHeight")}),s.prototype.clone=function(e){return t(e)?(e.show=this.show,e.material=this.material,e.hierarchy=this.hierarchy,e.height=this.height,e.extrudedHeight=this.extrudedHeight,e.granularity=this.granularity,e.stRotation=this.stRotation,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.perPositionHeight=this.perPositionHeight,e):new s(this)},s.prototype.merge=function(t){this.show=e(this.show,t.show),this.material=e(this.material,t.material),this.hierarchy=e(this.hierarchy,t.hierarchy),this.height=e(this.height,t.height),this.extrudedHeight=e(this.extrudedHeight,t.extrudedHeight),this.granularity=e(this.granularity,t.granularity),this.stRotation=e(this.stRotation,t.stRotation),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth),this.perPositionHeight=e(this.perPositionHeight,t.perPositionHeight)},s}),i("DataSources/PolylineGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._show=void 0,this._showSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._followSurface=void 0,this._followSurfaceSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._widthSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),material:o("material"),positions:a("positions"),width:a("width"),followSurface:a("followSurface"),granularity:a("granularity")}),s.prototype.clone=function(e){return t(e)?(e.show=this.show,e.material=this.material,e.positions=this.positions,e.width=this.width,e.followSurface=this.followSurface,e.granularity=this.granularity,e):new s(this)},s.prototype.merge=function(t){this.show=e(this.show,t.show),this.material=e(this.material,t.material),this.positions=e(this.positions,t.positions),this.width=e(this.width,t.width),this.followSurface=e(this.followSurface,t.followSurface),this.granularity=e(this.granularity,t.granularity)},s}),i("DataSources/PolylineVolumeGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._show=void 0,this._showSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._shape=void 0,this._shapeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),material:o("material"),positions:a("positions"),shape:a("shape"),granularity:a("granularity"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth"),cornerType:a("cornerType")}),s.prototype.clone=function(e){return t(e)?(e.show=this.show,e.material=this.material,e.positions=this.positions,e.shape=this.shape,e.granularity=this.granularity,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.cornerType=this.cornerType,e):new s(this)},s.prototype.merge=function(t){this.show=e(this.show,t.show),this.material=e(this.material,t.material),this.positions=e(this.positions,t.positions),this.shape=e(this.shape,t.shape),this.granularity=e(this.granularity,t.granularity),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth),this.cornerType=e(this.cornerType,t.cornerType)},s}),i("DataSources/RectangleGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._show=void 0,this._showSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._coordinates=void 0,this._coordinatesSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._closeTop=void 0,this._closeTopSubscription=void 0,this._closeBottom=void 0,this._closeBottomSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),coordinates:a("coordinates"),material:o("material"),height:a("height"),extrudedHeight:a("extrudedHeight"),granularity:a("granularity"),stRotation:a("stRotation"),rotation:a("rotation"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth"),closeTop:a("closeTop"),closeBottom:a("closeBottom")}),s.prototype.clone=function(e){return t(e)?(e.show=this.show,e.coordinates=this.coordinates,e.material=this.material,e.height=this.height,e.extrudedHeight=this.extrudedHeight,e.granularity=this.granularity,e.stRotation=this.stRotation,e.rotation=this.rotation,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.closeTop=this.closeTop,e.closeBottom=this.closeBottom,e):new s(this)},s.prototype.merge=function(t){this.show=e(this.show,t.show),this.coordinates=e(this.coordinates,t.coordinates),this.material=e(this.material,t.material),this.height=e(this.height,t.height),this.extrudedHeight=e(this.extrudedHeight,t.extrudedHeight),this.granularity=e(this.granularity,t.granularity),this.stRotation=e(this.stRotation,t.stRotation),this.rotation=e(this.rotation,t.rotation),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth),this.closeTop=e(this.closeTop,t.closeTop),this.closeBottom=e(this.closeBottom,t.closeBottom)},s}),i("DataSources/WallGraphics",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./createMaterialPropertyDescriptor","./createPropertyDescriptor"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){this._show=void 0,this._showSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._minimumHeights=void 0,this._minimumHeightsSubscription=void 0,this._maximumHeights=void 0,this._maximumHeightsSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._definitionChanged=new n,this.merge(e(t,e.EMPTY_OBJECT))};return i(s.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),material:o("material"),positions:a("positions"),minimumHeights:a("minimumHeights"),maximumHeights:a("maximumHeights"),granularity:a("granularity"),fill:a("fill"),outline:a("outline"),outlineColor:a("outlineColor"),outlineWidth:a("outlineWidth")}),s.prototype.clone=function(e){return t(e)?(e.show=this.show,e.material=this.material,e.positions=this.positions,e.minimumHeights=this.minimumHeights,e.maximumHeights=this.maximumHeights,e.granularity=this.granularity,e.fill=this.fill,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e):new s(this)},s.prototype.merge=function(t){this.show=e(this.show,t.show),this.material=e(this.material,t.material),this.positions=e(this.positions,t.positions),this.minimumHeights=e(this.minimumHeights,t.minimumHeights),this.maximumHeights=e(this.maximumHeights,t.maximumHeights),this.granularity=e(this.granularity,t.granularity),this.fill=e(this.fill,t.fill),this.outline=e(this.outline,t.outline),this.outlineColor=e(this.outlineColor,t.outlineColor),this.outlineWidth=e(this.outlineWidth,t.outlineWidth)},s}),i("DataSources/Entity",["../Core/Cartesian3","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/Matrix3","../Core/Matrix4","../Core/Quaternion","../Core/Transforms","./BillboardGraphics","./BoxGraphics","./ConstantPositionProperty","./CorridorGraphics","./createPropertyDescriptor","./createRawPropertyDescriptor","./CylinderGraphics","./EllipseGraphics","./EllipsoidGraphics","./LabelGraphics","./ModelGraphics","./PathGraphics","./PointGraphics","./PolygonGraphics","./PolylineGraphics","./PolylineVolumeGraphics","./Property","./RectangleGraphics","./WallGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D){"use strict";function M(e){return new p(e)}function I(e){return f(e,void 0,M)}function O(e,t){return f(e,void 0,function(e){return e instanceof t?e:new t(e)})}function R(e,t,i){for(var r=t.length,n=0;r>n;n++){var o=t[n],a=o._show,s=!i&&a,l=i&&a;s!==l&&R(o,o._children,i)}e._definitionChanged.raiseEvent(e,"isShowing",i,!i)}var L=function(e){e=i(e,i.EMPTY_OBJECT);var n=e.id;r(n)||(n=t()),this._availability=void 0,this._id=n,this._definitionChanged=new a,this._name=e.name,this._show=i(e.show,!0),this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","orientation","path","point","polygon","polyline","polylineVolume","position","rectangle","viewFrom","wall"],this._billboard=void 0,this._billboardSubscription=void 0,this._box=void 0,this._boxSubscription=void 0,this._corridor=void 0,this._corridorSubscription=void 0,this._cylinder=void 0,this._cylinderSubscription=void 0,this._description=void 0,this._descriptionSubscription=void 0,this._ellipse=void 0,this._ellipseSubscription=void 0,this._ellipsoid=void 0,this._ellipsoidSubscription=void 0,this._label=void 0,this._labelSubscription=void 0,this._model=void 0,this._modelSubscription=void 0,this._orientation=void 0,this._orientationSubscription=void 0,this._path=void 0,this._pathSubscription=void 0,this._point=void 0,this._pointSubscription=void 0,this._polygon=void 0,this._polygonSubscription=void 0,this._polyline=void 0,this._polylineSubscription=void 0,this._polylineVolume=void 0,this._polylineVolumeSubscription=void 0,this._position=void 0,this._positionSubscription=void 0,this._rectangle=void 0,this._rectangleSubscription=void 0,this._viewFrom=void 0,this._viewFromSubscription=void 0,this._wall=void 0,this._wallSubscription=void 0,this._children=[],this.parent=e.parent,this.merge(e)};n(L.prototype,{availability:v("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:v("name"),show:{get:function(){return this._show},set:function(e){if(e!==this._show){var t=this.isShowing;this._show=e;var i=this.isShowing;t!==i&&R(this,this._children,i),this._definitionChanged.raiseEvent(this,"show",e,!e)}}},isShowing:{get:function(){return this._show&&(!r(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){var t=this._parent;if(t!==e){var i=this.isShowing;if(r(t)){var n=t._children.indexOf(this);t._children.splice(n,1)}this._parent=e,e._children.push(this); -var o=this.isShowing;i!==o&&R(this,this._children,o),this._definitionChanged.raiseEvent(this,"parent",e,t)}}},propertyNames:{get:function(){return this._propertyNames}},billboard:O("billboard",h),box:O("box",d),corridor:O("corridor",m),cylinder:O("cylinder",g),description:f("description"),ellipse:O("ellipse",_),ellipsoid:O("ellipsoid",y),label:O("label",C),model:O("model",w),orientation:f("orientation"),path:O("path",S),point:O("point",E),polygon:O("polygon",b),polyline:O("polyline",x),polylineVolume:O("polylineVolume",T),position:I("position"),rectangle:O("rectangle",A),viewFrom:f("viewFrom"),wall:O("wall",D)}),L.prototype.isAvailable=function(e){var t=this._availability;return!r(t)||t.contains(e)},L.prototype.addProperty=function(e){var t=this._propertyNames;t.push(e),Object.defineProperty(this,e,v(e,!0))},L.prototype.removeProperty=function(e){this._propertyNames,this._propertyNames.push(e),delete this[e]},L.prototype.merge=function(e){this.name=i(this.name,e.name),this.availability=i(e.availability,this.availability);for(var t=this._propertyNames,n=r(e._propertyNames)?e._propertyNames:Object.keys(e),o=n.length,a=0;o>a;a++){var s=n[a];if("parent"!==s){var l=this[s],u=e[s];r(l)||-1!==t.indexOf(s)||this.addProperty(s),r(u)&&(r(l)?r(l.merge)&&l.merge(u):this[s]=r(u.merge)&&r(u.clone)?u.clone():u)}}};var N=new s,F=new e,B=new u;return L.prototype._getModelMatrix=function(e,t){var i=P.getValueOrUndefined(this._position,e,F);if(!r(i))return void 0;var n=P.getValueOrUndefined(this._orientation,e,B);return t=r(n)?l.fromRotationTranslation(s.fromQuaternion(n,N),i,t):c.eastNorthUpToFixedFrame(i,void 0,t)},L}),i("DataSources/EntityCollection",["../Core/AssociativeArray","../Core/createGuid","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/Iso8601","../Core/JulianDate","../Core/RuntimeError","../Core/TimeInterval","./Entity"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e){if(0===e._suspendCount){var t=e._addedEntities,i=e._removedEntities,r=e._changedEntities;(0!==r.length||0!==t.length||0!==i.length)&&(e._collectionChanged.raiseEvent(e,t.values,i.values,r.values),t.removeAll(),i.removeAll(),r.removeAll())}}var d={id:void 0},p=function(){this._entities=new e,this._addedEntities=new e,this._removedEntities=new e,this._changedEntities=new e,this._suspendCount=0,this._collectionChanged=new o,this._id=t()};return p.prototype.suspendEvents=function(){this._suspendCount++},p.prototype.resumeEvents=function(){this._suspendCount--,h(this)},p.collectionChangedEventCallback=void 0,r(p.prototype,{collectionChanged:{get:function(){return this._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._entities.values}}}),p.prototype.computeAvailability=function(){for(var e=a.MAXIMUM_VALUE,t=a.MINIMUM_VALUE,r=this._entities.values,n=0,o=r.length;o>n;n++){var l=r[n],c=l.availability;if(i(c)){var h=c.start,d=c.stop;s.lessThan(h,e)&&!h.equals(a.MINIMUM_VALUE)&&(e=h),s.greaterThan(d,t)&&!d.equals(a.MAXIMUM_VALUE)&&(t=d)}}return a.MAXIMUM_VALUE.equals(e)&&(e=a.MINIMUM_VALUE),a.MINIMUM_VALUE.equals(t)&&(t=a.MAXIMUM_VALUE),new u({start:e,stop:t})},p.prototype.add=function(e){e instanceof c||(e=new c(e));var t=e.id,i=this._entities;if(i.contains(t))throw new l("An entity with id "+t+" already exists in this collection.");return i.set(t,e),this._removedEntities,this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener(p.prototype._onEntityDefinitionChanged,this),h(this),e},p.prototype.remove=function(e){return i(e)?this.removeById(e.id):!1},p.prototype.contains=function(e){return this._entities.get(e.id)===e},p.prototype.removeById=function(e){if(!i(e))return!1;var t=this._entities,r=t.get(e);return this._entities.remove(e)?(this._addedEntities.remove(e)||(this._removedEntities.set(e,r),this._changedEntities.remove(e)),this._entities.remove(e),r.definitionChanged.removeEventListener(p.prototype._onEntityDefinitionChanged,this),h(this),!0):!1},p.prototype.removeAll=function(){for(var e=this._entities,t=e.length,r=e.values,n=this._addedEntities,o=this._removedEntities,a=0;t>a;a++){var s=r[a],l=s.id,u=n.get(l);i(u)||(s.definitionChanged.removeEventListener(p.prototype._onEntityDefinitionChanged,this),o.set(l,s))}e.removeAll(),n.removeAll(),this._changedEntities.removeAll(),h(this)},p.prototype.getById=function(e){return this._entities.get(e)},p.prototype.getOrCreateEntity=function(e){var t=this._entities.get(e);return i(t)||(d.id=e,t=new c(d),this.add(t)),t},p.prototype._onEntityDefinitionChanged=function(e){var t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),h(this)},p}),i("DataSources/CompositeEntityCollection",["../Core/createGuid","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Math","./Entity","./EntityCollection"],function(e,t,i,r,n,o,a){"use strict";function s(e){for(var t=e.propertyNames,i=t.length,r=0;i>r;r++)e[t[r]]=void 0}function l(e,t,i,r){m[0]=i,m[1]=r.id,t[JSON.stringify(m)]=r.definitionChanged.addEventListener(f.prototype._onDefinitionChanged,e)}function u(e,t,i,r){m[0]=i,m[1]=r.id;var n=JSON.stringify(m);t[n](),t[n]=void 0}function c(e){if(e._shouldRecomposite=!0,0===e._suspendCount){var i,r,n,c,h,d,m=e._collections,v=m.length,g=e._collectionsCopy,_=g.length,y=e._composite,C=new a,w=e._eventHash;for(i=0;_>i;i++)for(h=g[i],h.collectionChanged.removeEventListener(f.prototype._onCollectionChanged,e),n=h.values,d=h.id,c=n.length-1;c>-1;c--)r=n[c],u(e,w,d,r);for(i=v-1;i>=0;i--)for(h=m[i],h.collectionChanged.addEventListener(f.prototype._onCollectionChanged,e),n=h.values,d=h.id,c=n.length-1;c>-1;c--){r=n[c],l(e,w,d,r);var S=C.getById(r.id);t(S)||(S=y.getById(r.id),t(S)?s(S):(p.id=r.id,S=new o(p)),C.add(S)),S.merge(r)}e._collectionsCopy=m.slice(0),y.suspendEvents(),y.removeAll();var E=C.values;for(i=0;ih;h++){var y=r[h];u(this,g,_,y);var C=y.id;for(d=a-1;d>=0;d--)m=n[d].getById(C),t(m)&&(t(f)||(f=c.getById(C),s(f)),f.merge(m));t(f)||c.removeById(C),f=void 0}var w=i.length;for(h=0;w>h;h++){var S=i[h];l(this,g,_,S);var E=S.id;for(d=a-1;d>=0;d--)m=n[d].getById(E),t(m)&&(t(f)||(f=c.getById(E),t(f)?s(f):(p.id=E,f=new o(p),c.add(f))),f.merge(m));f=void 0}c.resumeEvents()},f.prototype._onDefinitionChanged=function(e,i){for(var r=this._collections,n=this._composite,o=r.length,a=e.id,s=n.getById(a),l=s[i],u=!t(l),c=!0,h=o-1;h>=0;h--){var d=r[h].getById(e.id);if(t(d)){var p=d[i];if(t(p)){if(c){if(c=!1,!t(p.merge)||!t(p.clone)){l=p;break}l=p.clone(l)}l.merge(p)}}}u&&-1===s.propertyNames.indexOf(i)&&s.addProperty(i),s[i]=l},f}),i("DataSources/CompositeProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/EventHelper","../Core/TimeIntervalCollection","./Property"],function(e,t,i,r,n,o,a){"use strict";function s(t,i,r,n){var o=function(){r.raiseEvent(t)},a=[];i.removeAll();for(var s=n.length,l=0;s>l;l++){var u=n.get(l);e(u.data)&&-1===a.indexOf(u.data)&&i.add(u.data.definitionChanged,o)}}var l=function(){this._eventHelper=new n,this._definitionChanged=new r,this._intervals=new o,this._intervals.changedEvent.addEventListener(l.prototype._intervalsChanged,this)};return t(l.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),l.prototype.getValue=function(t,i){var r=this._intervals.findDataForIntervalContainingDate(t);return e(r)?r.getValue(t,i):void 0},l.prototype.equals=function(e){return this===e||e instanceof l&&this._intervals.equals(e._intervals,a.equals)},l.prototype._intervalsChanged=function(){s(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)},l}),i("DataSources/CompositeMaterialProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","./CompositeProperty","./Property"],function(e,t,i,r,n,o){"use strict";var a=function(){this._definitionChanged=new r,this._composite=new n,this._composite.definitionChanged.addEventListener(a.prototype._raiseDefinitionChanged,this)};return t(a.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite._intervals}}}),a.prototype.getType=function(t){var i=this._composite._intervals.findDataForIntervalContainingDate(t);return e(i)?i.getType(t):void 0},a.prototype.getValue=function(t,i){var r=this._composite._intervals.findDataForIntervalContainingDate(t);return e(r)?r.getValue(t,i):void 0},a.prototype.equals=function(e){return this===e||e instanceof a&&this._composite.equals(e._composite,o.equals)},a.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},a}),i("DataSources/CompositePositionProperty",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ReferenceFrame","./CompositeProperty","./Property"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(t){this._referenceFrame=e(t,o.FIXED),this._definitionChanged=new n,this._composite=new a,this._composite.definitionChanged.addEventListener(l.prototype._raiseDefinitionChanged,this)};return i(l.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite.intervals}},referenceFrame:{get:function(){return this._referenceFrame},set:function(e){this._referenceFrame=e}}}),l.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},l.prototype.getValueInReferenceFrame=function(e,i,r){var n=this._composite._intervals.findDataForIntervalContainingDate(e);return t(n)?n.getValueInReferenceFrame(e,i,r):void 0},l.prototype.equals=function(e){return this===e||e instanceof l&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,s.equals)},l.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},l}),i("DataSources/CorridorGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/CorridorGeometry","../Core/CorridorOutlineGeometry","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";var w=new v(e.WHITE),S=new g(!0),E=new g(!0),b=new g(!1),x=new g(e.BLACK),T=new e,P=function(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.cornerType=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0},A=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(A.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new P(e),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)};a(A,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),a(A.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!o(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!o(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),A.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},A.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},A.prototype.createFillGeometryInstance=function(r){var n,a,s=this._entity,l=s.isAvailable(r),u=new d(l&&s.isShowing&&this._showProperty.getValue(r)&&this._fillProperty.getValue(r));if(this._materialProperty instanceof v){var h=e.WHITE;o(this._materialProperty.color)&&(this._materialProperty.color.isConstant||l)&&(h=this._materialProperty.color.getValue(r)),a=t.fromColor(h),n={show:u,color:a}}else n={show:u};return new c({id:s,geometry:new i(this._options),attributes:n})},A.prototype.createOutlineGeometryInstance=function(i){var n=this._entity,o=n.isAvailable(i),a=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new c({id:n,geometry:new r(this._options),attributes:{show:new d(o&&n.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(a)}})},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){this._entitySubscription(),s(this)},A.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"corridor"===t){var i=this._entity.corridor;if(!o(i))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var r=i.fill,a=o(r)&&r.isConstant?r.getValue(h.MINIMUM_VALUE):!0,s=i.outline,l=o(s);if(l&&s.isConstant&&(l=s.getValue(h.MINIMUM_VALUE)),!a&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var u=i.positions,c=i.show;if(o(c)&&c.isConstant&&!c.getValue(h.MINIMUM_VALUE)||!o(u))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var d=n(i.material,w),f=d instanceof v;this._materialProperty=d,this._fillProperty=n(r,E),this._showProperty=n(c,S),this._showOutlineProperty=n(i.outline,b),this._outlineColorProperty=l?n(i.outlineColor,x):void 0;var g=i.height,_=i.extrudedHeight,y=i.granularity,T=i.width,P=i.outlineWidth,A=i.cornerType;if(this._isClosed=o(_),this._fillEnabled=a,this._outlineEnabled=l,u.isConstant&&C.isConstant(g)&&C.isConstant(_)&&C.isConstant(y)&&C.isConstant(T)&&C.isConstant(P)&&C.isConstant(A)){var D=this._options;D.vertexFormat=f?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,D.positions=u.getValue(h.MINIMUM_VALUE,D.positions),D.height=o(g)?g.getValue(h.MINIMUM_VALUE):void 0,D.extrudedHeight=o(_)?_.getValue(h.MINIMUM_VALUE):void 0,D.granularity=o(y)?y.getValue(h.MINIMUM_VALUE):void 0,D.width=o(T)?T.getValue(h.MINIMUM_VALUE):void 0,D.cornerType=o(A)?A.getValue(h.MINIMUM_VALUE):void 0,this._outlineWidth=o(P)?P.getValue(h.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},A.prototype.createDynamicUpdater=function(e){return new D(e,this)};var D=function(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new P(t._entity)};return D.prototype.update=function(n){var a=this._primitives;a.removeAndDestroy(this._primitive),a.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var s=this._geometryUpdater,l=s._entity,u=l.corridor;if(l.isShowing&&l.isAvailable(n)&&C.getValueOrDefault(u.show,n,!0)){var h=this._options,d=C.getValueOrUndefined(u.positions,n,h.positions),v=C.getValueOrUndefined(u.width,n);if(o(d)&&o(v)){if(h.positions=d,h.width=v,h.height=C.getValueOrUndefined(u.height,n),h.extrudedHeight=C.getValueOrUndefined(u.extrudedHeight,n),h.granularity=C.getValueOrUndefined(u.granularity,n),h.cornerType=C.getValueOrUndefined(u.cornerType,n),!o(u.fill)||u.fill.getValue(n)){var g=y.getValue(n,s.fillMaterialProperty,this._material);this._material=g;var _=new p({material:g,translucent:g.isTranslucent(),closed:o(h.extrudedHeight)});h.vertexFormat=_.vertexFormat,this._primitive=a.add(new f({geometryInstances:new c({id:l,geometry:new i(h)}),appearance:_,asynchronous:!1}))}if(o(u.outline)&&u.outline.getValue(n)){h.vertexFormat=m.VERTEX_FORMAT;var w=C.getValueOrClonedDefault(u.outlineColor,n,e.BLACK,T),S=C.getValueOrDefault(u.outlineWidth,n,1),E=1!==w.alpha;this._outlinePrimitive=a.add(new f({geometryInstances:new c({id:l,geometry:new r(h),attributes:{color:t.fromColor(w)}}),appearance:new m({flat:!0,translucent:E,renderState:{lineWidth:s._scene.clampLineWidth(S)}}),asynchronous:!1}))}}}},D.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},D.prototype.isDestroyed=function(){return!1},D.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),s(this)},A}),i("DataSources/DataSource",["../Core/defineProperties","../Core/DeveloperError"],function(e,t){"use strict";var i=function(){t.throwInstantiationError()};return e(i.prototype,{name:{get:t.throwInstantiationError},clock:{get:t.throwInstantiationError},entities:{get:t.throwInstantiationError},isLoading:{get:t.throwInstantiationError},changedEvent:{get:t.throwInstantiationError},errorEvent:{get:t.throwInstantiationError},loadingEvent:{get:t.throwInstantiationError}}),i.prototype.update=t.throwInstantiationError,i.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))},i}),i("DataSources/CustomDataSource",["../Core/defineProperties","../Core/Event","./DataSource","./EntityCollection"],function(e,t,i,r){"use strict";var n=function(e){this._name=e,this._clock=void 0,this._changed=new t,this._error=new t,this._isLoading=!1,this._loading=new t,this._entityCollection=new r};return e(n.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._changed.raiseEvent(this))}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading},set:function(e){i.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}}}),n}),i("DataSources/CylinderGeometryUpdater",["../Core/Cartesian3","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/CylinderGeometry","../Core/CylinderOutlineGeometry","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w){"use strict";var S=new g(t.WHITE),E=new _(!0),b=new _(!0),x=new _(!1),T=new _(t.BLACK),P=new t,A=function(e){this.id=e,this.vertexFormat=void 0,this.length=void 0,this.topRadius=void 0,this.bottomRadius=void 0,this.slices=void 0,this.numberOfVerticalLines=void 0},D=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(D.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new c,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new A(e),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)};s(D,{perInstanceColorAppearanceType:{value:f},materialAppearanceType:{value:m}}),s(D.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!a(this._entity.availability)&&w.isConstant(this._showProperty)&&w.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!a(this._entity.availability)&&w.isConstant(this._showProperty)&&w.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),D.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},D.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},D.prototype.createFillGeometryInstance=function(e){var n,o,s=this._entity,l=s.isAvailable(e),u=new p(l&&s.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e));if(this._materialProperty instanceof g){var c=t.WHITE;a(this._materialProperty.color)&&(this._materialProperty.color.isConstant||l)&&(c=this._materialProperty.color.getValue(e)),o=i.fromColor(c),n={show:u,color:o}}else n={show:u};return new h({id:s,geometry:new r(this._options),modelMatrix:s._getModelMatrix(d.MINIMUM_VALUE),attributes:n})},D.prototype.createOutlineGeometryInstance=function(e){var r=this._entity,o=r.isAvailable(e),a=w.getValueOrDefault(this._outlineColorProperty,e,t.BLACK);return new h({id:r,geometry:new n(this._options),modelMatrix:r._getModelMatrix(d.MINIMUM_VALUE),attributes:{show:new p(o&&r.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:i.fromColor(a)}})},D.prototype.isDestroyed=function(){return!1},D.prototype.destroy=function(){this._entitySubscription(),l(this)},D.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"position"===t||"orientation"===t||"cylinder"===t){var i=e.cylinder;if(!a(i))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var r=i.fill,n=a(r)&&r.isConstant?r.getValue(d.MINIMUM_VALUE):!0,s=i.outline,l=a(s);if(l&&s.isConstant&&(l=s.getValue(d.MINIMUM_VALUE)),!n&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var u=e.position,c=i.length,h=i.topRadius,p=i.bottomRadius,v=i.show;if(a(v)&&v.isConstant&&!v.getValue(d.MINIMUM_VALUE)||!a(u)||!a(c)||!a(h)||!a(p))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var _=o(i.material,S),y=_ instanceof g;this._materialProperty=_,this._fillProperty=o(r,b),this._showProperty=o(v,E),this._showOutlineProperty=o(i.outline,x),this._outlineColorProperty=l?o(i.outlineColor,T):void 0;var C=i.slices,P=i.outlineWidth,A=i.numberOfVerticalLines;if(this._fillEnabled=n,this._outlineEnabled=l,u.isConstant&&w.isConstant(e.orientation)&&c.isConstant&&h.isConstant&&p.isConstant&&w.isConstant(C)&&w.isConstant(P)&&w.isConstant(A)){var D=this._options;D.vertexFormat=y?f.VERTEX_FORMAT:m.MaterialSupport.TEXTURED.vertexFormat,D.length=c.getValue(d.MINIMUM_VALUE),D.topRadius=h.getValue(d.MINIMUM_VALUE),D.bottomRadius=p.getValue(d.MINIMUM_VALUE),D.slices=a(C)?C.getValue(d.MINIMUM_VALUE):void 0,D.numberOfVerticalLines=a(A)?A.getValue(d.MINIMUM_VALUE):void 0,this._outlineWidth=a(P)?P.getValue(d.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},D.prototype.createDynamicUpdater=function(e){return new M(e,this)};var M=function(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new A(t._entity)};return M.prototype.update=function(e){var o=this._primitives;o.removeAndDestroy(this._primitive),o.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var s=this._geometryUpdater,l=s._entity,u=l.cylinder;if(l.isShowing&&l.isAvailable(e)&&w.getValueOrDefault(u.show,e,!0)){var c=this._options,d=l._getModelMatrix(e),p=w.getValueOrUndefined(u.length,e),g=w.getValueOrUndefined(u.topRadius,e),_=w.getValueOrUndefined(u.bottomRadius,e);if(a(d)&&a(p)&&a(g)&&a(_)){if(c.length=p,c.topRadius=g,c.bottomRadius=_,c.slices=w.getValueOrUndefined(u.slices,e),c.numberOfVerticalLines=w.getValueOrUndefined(u.numberOfVerticalLines,e),w.getValueOrDefault(u.fill,e,!0)){var y=C.getValue(e,s.fillMaterialProperty,this._material);this._material=y;var S=new m({material:y,translucent:y.isTranslucent(),closed:!0});c.vertexFormat=S.vertexFormat,this._primitive=o.add(new v({geometryInstances:new h({id:l,geometry:new r(c),modelMatrix:d}),appearance:S,asynchronous:!1}))}if(w.getValueOrDefault(u.outline,e,!1)){c.vertexFormat=f.VERTEX_FORMAT;var E=w.getValueOrClonedDefault(u.outlineColor,e,t.BLACK,P),b=w.getValueOrDefault(u.outlineWidth,e,1),x=1!==E.alpha;this._outlinePrimitive=o.add(new v({geometryInstances:new h({id:l,geometry:new n(c),modelMatrix:d,attributes:{color:i.fromColor(E)}}),appearance:new f({flat:!0,translucent:x,renderState:{lineWidth:s._scene.clampLineWidth(b)}}),asynchronous:!1}))}}}},M.prototype.getBoundingSphere=function(e,t){return y(e,this._primitive,this._outlinePrimitive,t)},M.prototype.isDestroyed=function(){return!1},M.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),l(this)},D}),i("Scene/LabelStyle",["../Core/freezeObject"],function(e){"use strict";var t={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2};return e(t)}),i("DataSources/Rotation",["../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Math"],function(e,t,i,r){"use strict";var n={packedLength:1,pack:function(t,i,r){r=e(r,0),i[r]=t},unpack:function(t,i){return i=e(i,0),t[i]},convertPackedArrayForInterpolation:function(t,i,n,o){i=e(i,0),n=e(n,t.length);for(var a,s=0,l=n-i+1;l>s;s++){var u=t[i+s];o[s]=0===s||Math.abs(a-u)o?o+r.TWO_PI:o}};return n}),i("DataSources/DataSourceClock",["../Core/Clock","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/JulianDate","./createRawPropertyDescriptor"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(){this._startTime=void 0,this._stopTime=void 0,this._currentTime=void 0,this._clockRange=void 0,this._clockStep=void 0,this._multiplier=void 0,this._definitionChanged=new o};return r(l.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},startTime:s("startTime"),stopTime:s("stopTime"),currentTime:s("currentTime"),clockRange:s("clockRange"),clockStep:s("clockStep"),multiplier:s("multiplier")}),l.prototype.clone=function(e){return i(e)||(e=new l),e.startTime=this.startTime,e.stopTime=this.stopTime,e.currentTime=this.currentTime,e.clockRange=this.clockRange,e.clockStep=this.clockStep,e.multiplier=this.multiplier,e},l.prototype.equals=function(e){return this===e||i(e)&&a.equals(this.startTime,e.startTime)&&a.equals(this.stopTime,e.stopTime)&&a.equals(this.currentTime,e.currentTime)&&this.clockRange===e.clockRange&&this.clockStep===e.clockStep&&this.multiplier===e.multiplier},l.prototype.merge=function(e){this.startTime=t(this.startTime,e.startTime),this.stopTime=t(this.stopTime,e.stopTime),this.currentTime=t(this.currentTime,e.currentTime),this.clockRange=t(this.clockRange,e.clockRange),this.clockStep=t(this.clockStep,e.clockStep),this.multiplier=t(this.multiplier,e.multiplier)},l.prototype.getValue=function(t){return i(t)||(t=new e),t.startTime=this.startTime,t.stopTime=this.stopTime,t.clockRange=this.clockRange,t.clockStep=this.clockStep,t.multiplier=this.multiplier,t.currentTime=this.currentTime,t},l}),i("DataSources/GridMaterialProperty",["../Core/Cartesian2","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","./createPropertyDescriptor","./Property"],function(e,t,i,r,n,o,a,s){"use strict";var l=t.WHITE,u=.1,c=new e(8,8),h=new e(0,0),d=new e(1,1),p=function(e){e=i(e,i.EMPTY_OBJECT),this._definitionChanged=new o,this._color=void 0,this._colorSubscription=void 0,this._cellAlpha=void 0,this._cellAlphaSubscription=void 0,this._lineCount=void 0,this._lineCountSubscription=void 0,this._lineThickness=void 0,this._lineThicknessSubscription=void 0,this._lineOffset=void 0,this._lineOffsetSubscription=void 0,this.color=e.color,this.cellAlpha=e.cellAlpha,this.lineCount=e.lineCount,this.lineThickness=e.lineThickness,this.lineOffset=e.lineOffset -};return n(p.prototype,{isConstant:{get:function(){return s.isConstant(this._color)&&s.isConstant(this._cellAlpha)&&s.isConstant(this._lineCount)&&s.isConstant(this._lineThickness)&&s.isConstant(this._lineOffset)}},definitionChanged:{get:function(){return this._definitionChanged}},color:a("color"),cellAlpha:a("cellAlpha"),lineCount:a("lineCount"),lineThickness:a("lineThickness"),lineOffset:a("lineOffset")}),p.prototype.getType=function(){return"Grid"},p.prototype.getValue=function(e,t){return r(t)||(t={}),t.color=s.getValueOrClonedDefault(this._color,e,l,t.color),t.cellAlpha=s.getValueOrDefault(this._cellAlpha,e,u),t.lineCount=s.getValueOrClonedDefault(this._lineCount,e,c,t.lineCount),t.lineThickness=s.getValueOrClonedDefault(this._lineThickness,e,d,t.lineThickness),t.lineOffset=s.getValueOrClonedDefault(this._lineOffset,e,h,t.lineOffset),t},p.prototype.equals=function(e){return this===e||e instanceof p&&s.equals(this._color,e._color)&&s.equals(this._cellAlpha,e._cellAlpha)&&s.equals(this._lineCount,e._lineCount)&&s.equals(this._lineThickness,e._lineThickness)&&s.equals(this._lineOffset,e._lineOffset)},p}),i("DataSources/PolylineGlowMaterialProperty",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","./createPropertyDescriptor","./Property"],function(e,t,i,r,n,o,a){"use strict";var s=e.WHITE,l=.25,u=function(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this._glowPower=void 0,this._glowPowerSubscription=void 0,this.color=e.color,this.glowPower=e.glowPower};return r(u.prototype,{isConstant:{get:function(){return a.isConstant(this._color)&&a.isConstant(this._glow)}},definitionChanged:{get:function(){return this._definitionChanged}},color:o("color"),glowPower:o("glowPower")}),u.prototype.getType=function(){return"PolylineGlow"},u.prototype.getValue=function(e,t){return i(t)||(t={}),t.color=a.getValueOrClonedDefault(this._color,e,s,t.color),t.glowPower=a.getValueOrDefault(this._glowPower,e,l,t.glowPower),t},u.prototype.equals=function(e){return this===e||e instanceof u&&a.equals(this._color,e._color)&&a.equals(this._glowPower,e._glowPower)},u}),i("DataSources/PolylineOutlineMaterialProperty",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","./createPropertyDescriptor","./Property"],function(e,t,i,r,n,o,a){"use strict";var s=e.WHITE,l=e.BLACK,u=1,c=function(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new n,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this.color=e.color,this.outlineColor=e.outlineColor,this.outlineWidth=e.outlineWidth};return r(c.prototype,{isConstant:{get:function(){return a.isConstant(this._color)&&a.isConstant(this._outlineColor)&&a.isConstant(this._outlineWidth)}},definitionChanged:{get:function(){return this._definitionChanged}},color:o("color"),outlineColor:o("outlineColor"),outlineWidth:o("outlineWidth")}),c.prototype.getType=function(){return"PolylineOutline"},c.prototype.getValue=function(e,t){return i(t)||(t={}),t.color=a.getValueOrClonedDefault(this._color,e,s,t.color),t.outlineColor=a.getValueOrClonedDefault(this._outlineColor,e,l,t.outlineColor),t.outlineWidth=a.getValueOrDefault(this._outlineWidth,e,u),t},c.prototype.equals=function(e){return this===e||e instanceof c&&a.equals(this._color,e._color)&&a.equals(this._outlineColor,e._outlineColor)&&a.equals(this._outlineWidth,e._outlineWidth)},c}),i("DataSources/PositionPropertyArray",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/EventHelper","../Core/ReferenceFrame","./Property"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(t,i){this._value=void 0,this._definitionChanged=new n,this._eventHelper=new o,this._referenceFrame=e(i,a.FIXED),this.setValue(t)};return i(l.prototype,{isConstant:{get:function(){var e=this._value;if(!t(e))return!0;for(var i=e.length,r=0;i>r;r++)if(!s.isConstant(e[r]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),l.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,a.FIXED,t)},l.prototype.getValueInReferenceFrame=function(e,i,r){var n=this._value;if(!t(n))return void 0;var o=n.length;t(r)||(r=new Array(o));for(var a=0,s=0;o>a;){var l=n[a],u=l.getValueInReferenceFrame(e,i,r[a]);t(u)&&(r[s]=u,s++),a++}return r.length=s,r},l.prototype.setValue=function(e){var i=this._eventHelper;if(i.removeAll(),t(e)){this._value=e.slice();for(var r=e.length,n=0;r>n;n++){var o=e[n];t(o)&&i.add(o.definitionChanged,l.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},l.prototype.equals=function(e){return this===e||e instanceof l&&this._referenceFrame===e._referenceFrame&&s.arrayEquals(this._value,e._value)},l.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},l}),i("DataSources/ReferenceProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/RuntimeError","./Property"],function(e,t,i,r,n,o){"use strict";function a(t){var i=!0;if(t._resolveEntity){var r=t._targetCollection.getById(t._targetId);if(e(r)?(r.definitionChanged.addEventListener(l.prototype._onTargetEntityDefinitionChanged,t),t._targetEntity=r,t._resolveEntity=!1):(r=t._targetEntity,i=!1),!e(r))throw new n('target entity "'+t._targetId+'" could not be resolved.')}return i}function s(t){var i=t._targetProperty;if(t._resolveProperty){var r=a(t),o=t._targetPropertyNames;i=t._targetEntity;for(var s=o.length,l=0;s>l&&e(i);l++)i=i[o[l]];if(e(i))t._targetProperty=i,t._resolveProperty=!r;else if(!e(t._targetProperty))throw new n('targetProperty "'+t._targetId+"."+o.join(".")+'" could not be resolved.')}return i}var l=function(e,t,i){this._targetCollection=e,this._targetId=t,this._targetPropertyNames=i,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new r,this._resolveEntity=!0,this._resolveProperty=!0,e.collectionChanged.addEventListener(l.prototype._onCollectionChanged,this)};return t(l.prototype,{isConstant:{get:function(){return o.isConstant(s(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return s(this).referenceFrame}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return s(this)}}}),l.fromString=function(e,t){for(var i,r=[],n=!0,o=!1,a="",s=0;sn;n++)if(t[n]!==i[n])return!1;return!0},l.prototype._onTargetEntityDefinitionChanged=function(e,t){this._targetPropertyNames[0]===t&&(this._resolveProperty=!0,this._definitionChanged.raiseEvent(this))},l.prototype._onCollectionChanged=function(t,i,r){var n=this._targetEntity;e(n)&&(-1!==r.indexOf(n)?(n.definitionChanged.removeEventListener(l.prototype._onTargetEntityDefinitionChanged,this),this._resolveEntity=!0,this._resolveProperty=!0):this._resolveEntity&&(s(this),this._resolveEntity||this._definitionChanged.raiseEvent(this)))},l}),i("DataSources/SampledProperty",["../Core/binarySearch","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ExtrapolationType","../Core/JulianDate","../Core/LinearApproximation"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(e,t,i){var r,n=e.length,o=i.length,a=n+o;if(e.length=a,n!==t){var s=n-1;for(r=a-1;r>=t;r--)e[r]=e[s--]}for(r=0;o>r;r++)e[t++]=i[r]}function c(e,t){return e instanceof s?e:"string"==typeof e?s.fromIso8601(e):s.addSeconds(t,e,new s)}var h={packedLength:1,pack:function(e,i,r){r=t(r,0),i[r]=e},unpack:function(e,i){return i=t(i,0),e[i]}},d=[],p=[],m=function(t,r,n,o,a){for(var l,h,m,f,v,g,_=0;_m){for(m=~m,f=m*a,h=void 0,g=r[m];_=0||i(g)&&s.compare(v,g)>=0));){for(d[y++]=v,_+=1,l=0;a>l;l++)p[C++]=o[_],_+=1;h=v}y>0&&(p.length=C,u(n,f,p),d.length=y,u(r,m,d))}else{for(l=0;a>l;l++)_++,n[m*a+l]=o[_];_++}}},f=function(e,r){var n=e;n===Number&&(n=h);var s,u=n.packedLength,c=t(n.packedInterpolationLength,u),d=0;if(i(r)){var p=r.length;s=new Array(p);for(var m=0;p>m;m++){var f=r[m];f===Number&&(f=h);var v=f.packedLength;u+=v,c+=t(f.packedInterpolationLength,v),s[m]=f}d=p}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=l,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=u,this._packedInterpolationLength=c,this._updateTableLength=!0,this._interpolationResult=new Array(c),this._definitionChanged=new o,this._derivativeTypes=r,this._innerDerivativeTypes=s,this._inputOrder=d,this._forwardExtrapolationType=a.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=a.NONE,this._backwardExtrapolationDuration=0};return r(f.prototype,{isConstant:{get:function(){return 0===this._values.length}},definitionChanged:{get:function(){return this._definitionChanged}},type:{get:function(){return this._type}},derivativeTypes:{get:function(){return this._derivativeTypes}},interpolationDegree:{get:function(){return this._interpolationDegree}},interpolationAlgorithm:{get:function(){return this._interpolationAlgorithm}},forwardExtrapolationType:{get:function(){return this._forwardExtrapolationType},set:function(e){this._forwardExtrapolationType!==e&&(this._forwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},forwardExtrapolationDuration:{get:function(){return this._forwardExtrapolationDuration},set:function(e){this._forwardExtrapolationDuration!==e&&(this._forwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationType:{get:function(){return this._backwardExtrapolationType},set:function(e){this._backwardExtrapolationType!==e&&(this._backwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationDuration:{get:function(){return this._backwardExtrapolationDuration},set:function(e){this._backwardExtrapolationDuration!==e&&(this._backwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}}}),f.prototype.getValue=function(t,r){var n=this._times,o=n.length;if(0===o)return void 0;var l,u=this._innerType,c=this._values,h=e(n,t,s.compare);if(0>h){if(h=~h,0===h){var d=n[h];if(l=this._backwardExtrapolationDuration,this._backwardExtrapolationType===a.NONE||0!==l&&s.secondsDifference(d,t)>l)return void 0;if(this._backwardExtrapolationType===a.HOLD)return u.unpack(c,0,r)}if(h>=o){h=o-1;var p=n[h];if(l=this._forwardExtrapolationDuration,this._forwardExtrapolationType===a.NONE||0!==l&&s.secondsDifference(t,p)>l)return void 0;if(this._forwardExtrapolationType===a.HOLD)return h=o-1,u.unpack(c,h*u.packedLength,r)}var m=this._xTable,f=this._yTable,v=this._interpolationAlgorithm,g=this._packedInterpolationLength,_=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;var y=Math.min(v.getRequiredDataPoints(this._interpolationDegree,_),o);y!==this._numberOfPoints&&(this._numberOfPoints=y,m.length=y,f.length=y*g)}var C=this._numberOfPoints-1;if(1>C)return void 0;var w=0,S=o-1,E=S-w+1;if(C+1>E);else{var b=h-(0|C/2)-1;w>b&&(b=w);var x=b+C;x>S&&(x=S,b=x-C,w>b&&(b=w)),w=b,S=x}for(var T=S-w+1,P=0;T>P;++P)m[P]=s.secondsDifference(n[w+P],n[S]);if(i(u.convertPackedArrayForInterpolation))u.convertPackedArrayForInterpolation(c,w,S,f);else for(var A=0,D=this._packedLength,M=w*D,I=(S+1)*D;I>M;)f[A]=c[M],M++,A++;var O,R=s.secondsDifference(t,n[S]);if(0!==_&&i(v.interpolate)){var L=Math.floor(g/(_+1));O=v.interpolate(R,m,f,L,_,_,this._interpolationResult)}else O=v.interpolateOrderZero(R,m,f,g,this._interpolationResult);return i(u.unpackInterpolationResult)?u.unpackInterpolationResult(O,c,w,S,r):u.unpack(O,0,r)}return u.unpack(c,h*this._packedLength,r)},f.prototype.setInterpolationOptions=function(e){var t=!1,i=e.interpolationAlgorithm,r=e.interpolationDegree;this._interpolationAlgorithm!==i&&(this._interpolationAlgorithm=i,t=!0),this._interpolationDegree!==r&&(this._interpolationDegree=r,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))},f.prototype.addSample=function(e,t,r){var n=this._innerDerivativeTypes,o=i(n),a=this._innerType,s=[];if(s.push(e),a.pack(t,s,s.length),o)for(var l=n.length,u=0;l>u;u++)n[u].pack(r[u],s,s.length);m(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},f.prototype.addSamples=function(e,t,r){for(var n=this._innerDerivativeTypes,o=i(n),a=this._innerType,s=e.length,l=[],u=0;s>u;u++)if(l.push(e[u]),a.pack(t[u],l,l.length),o)for(var c=r[u],h=n.length,d=0;h>d;d++)n[d].pack(c[d],l,l.length);m(void 0,this._times,this._values,l,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},f.prototype.addSamplesPackedArray=function(e,t){m(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},f.prototype.equals=function(e){if(this===e)return!0;if(!i(e))return!1;if(this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;var t=this._derivativeTypes,r=i(t),n=e._derivativeTypes,o=i(n);if(r!==o)return!1;var a,l;if(r){if(l=t.length,l!==n.length)return!1;for(a=0;l>a;a++)if(t[a]!==n[a])return!1}var u=this._times,c=e._times;if(l=u.length,l!==c.length)return!1;for(a=0;l>a;a++)if(!s.equals(u[a],c[a]))return!1;var h=this._values,d=e._values;for(a=0;l>a;a++)if(h[a]!==d[a])return!1;return!0},f._mergeNewSamples=m,f}),i("DataSources/SampledPositionProperty",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ReferenceFrame","./PositionProperty","./Property","./SampledProperty"],function(e,t,i,r,n,o,a,s,l,u){"use strict";var c=function(i,r){r=t(r,0);var n;if(r>0){n=new Array(r);for(var s=0;r>s;s++)n[s]=e}this._numberOfDerivatives=r,this._property=new u(e,n),this._definitionChanged=new o,this._referenceFrame=t(i,a.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)};return r(c.prototype,{isConstant:{get:function(){return this._property.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}},interpolationDegree:{get:function(){return this._property.interpolationDegree}},interpolationAlgorithm:{get:function(){return this._property.interpolationAlgorithm}},numberOfDerivatives:{get:function(){return this._numberOfDerivatives}},forwardExtrapolationType:{get:function(){return this._property.forwardExtrapolationType},set:function(e){this._property.forwardExtrapolationType=e}},forwardExtrapolationDuration:{get:function(){return this._property.forwardExtrapolationDuration},set:function(e){this._property.forwardExtrapolationDuration=e}},backwardExtrapolationType:{get:function(){return this._property.backwardExtrapolationType},set:function(e){this._property.backwardExtrapolationType=e}},backwardExtrapolationDuration:{get:function(){return this._property.backwardExtrapolationDuration},set:function(e){this._property.backwardExtrapolationDuration=e}}}),c.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,a.FIXED,t)},c.prototype.getValueInReferenceFrame=function(e,t,r){return r=this._property.getValue(e,r),i(r)?s.convertToReferenceFrame(e,r,this._referenceFrame,t,r):void 0},c.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)},c.prototype.addSample=function(e,t,i){this._numberOfDerivatives,this._property.addSample(e,t,i)},c.prototype.addSamples=function(e,t,i){this._property.addSamples(e,t,i)},c.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)},c.prototype.equals=function(e){return this===e||e instanceof c&&l.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame},c}),i("DataSources/StripeOrientation",["../Core/freezeObject"],function(e){"use strict";var t={HORIZONTAL:0,VERTICAL:1};return e(t)}),i("DataSources/StripeMaterialProperty",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","./createPropertyDescriptor","./Property","./StripeOrientation"],function(e,t,i,r,n,o,a,s){"use strict";var l=s.HORIZONTAL,u=e.WHITE,c=e.BLACK,h=0,d=1,p=function(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new n,this._orientation=void 0,this._orientationSubscription=void 0,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._offset=void 0,this._offsetSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.orientation=e.orientation,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.offset=e.offset,this.repeat=e.repeat};return r(p.prototype,{isConstant:{get:function(){return a.isConstant(this._orientation)&&a.isConstant(this._evenColor)&&a.isConstant(this._oddColor)&&a.isConstant(this._offset)&&a.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:o("orientation"),evenColor:o("evenColor"),oddColor:o("oddColor"),offset:o("offset"),repeat:o("repeat")}),p.prototype.getType=function(){return"Stripe"},p.prototype.getValue=function(e,t){return i(t)||(t={}),t.horizontal=a.getValueOrDefault(this._orientation,e,l)===s.HORIZONTAL,t.evenColor=a.getValueOrClonedDefault(this._evenColor,e,u,t.evenColor),t.oddColor=a.getValueOrClonedDefault(this._oddColor,e,c,t.oddColor),t.offset=a.getValueOrDefault(this._offset,e,h),t.repeat=a.getValueOrDefault(this._repeat,e,d),t},p.prototype.equals=function(e){return this===e||e instanceof p&&a.equals(this._orientation,e._orientation)&&a.equals(this._evenColor,e._evenColor)&&a.equals(this._oddColor,e._oddColor)&&a.equals(this._offset,e._offset)&&a.equals(this._repeat,e._repeat)},p}),i("DataSources/TimeIntervalCollectionPositionProperty",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ReferenceFrame","../Core/TimeIntervalCollection","./PositionProperty","./Property"],function(e,t,i,r,n,o,a,s,l){"use strict";var u=function(t){this._definitionChanged=new n,this._intervals=new a,this._intervals.changedEvent.addEventListener(u.prototype._intervalsChanged,this),this._referenceFrame=e(t,o.FIXED)};return i(u.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}},referenceFrame:{get:function(){return this._referenceFrame}}}),u.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},u.prototype.getValueInReferenceFrame=function(e,i,r){var n=this._intervals.findDataForIntervalContainingDate(e);return t(n)?s.convertToReferenceFrame(e,n,this._referenceFrame,i,r):void 0},u.prototype.equals=function(e){return this===e||e instanceof u&&this._intervals.equals(e._intervals,l.equals)&&this._referenceFrame===e._referenceFrame},u.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},u}),i("DataSources/TimeIntervalCollectionProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/TimeIntervalCollection","./Property"],function(e,t,i,r,n,o){"use strict";var a=function(){this._definitionChanged=new r,this._intervals=new n,this._intervals.changedEvent.addEventListener(a.prototype._intervalsChanged,this)};return t(a.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),a.prototype.getValue=function(t,i){var r=this._intervals.findDataForIntervalContainingDate(t);return e(r)&&"function"==typeof r.clone?r.clone(i):r},a.prototype.equals=function(e){return this===e||e instanceof a&&this._intervals.equals(e._intervals,o.equals)},a.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},a}),i("DataSources/CzmlDataSource",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/ClockRange","../Core/ClockStep","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/ExtrapolationType","../Core/getFilenameFromUri","../Core/HermitePolynomialApproximation","../Core/isArray","../Core/Iso8601","../Core/JulianDate","../Core/LagrangePolynomialApproximation","../Core/LinearApproximation","../Core/loadJson","../Core/Math","../Core/Quaternion","../Core/Rectangle","../Core/ReferenceFrame","../Core/RuntimeError","../Core/Spherical","../Core/TimeInterval","../Core/TimeIntervalCollection","../Scene/HorizontalOrigin","../Scene/LabelStyle","../Scene/VerticalOrigin","../ThirdParty/Uri","../ThirdParty/when","./Rotation","./BillboardGraphics","./ColorMaterialProperty","./CompositeMaterialProperty","./CompositePositionProperty","./CompositeProperty","./ConstantPositionProperty","./ConstantProperty","./DataSource","./DataSourceClock","./EllipseGraphics","./EllipsoidGraphics","./EntityCollection","./GridMaterialProperty","./ImageMaterialProperty","./LabelGraphics","./ModelGraphics","./PathGraphics","./PointGraphics","./PolygonGraphics","./PolylineGlowMaterialProperty","./PolylineGraphics","./PolylineOutlineMaterialProperty","./PositionPropertyArray","./RectangleGraphics","./ReferenceProperty","./SampledPositionProperty","./SampledProperty","./StripeMaterialProperty","./StripeOrientation","./TimeIntervalCollectionPositionProperty","./TimeIntervalCollectionProperty","./WallGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B,z,k,V,U,W,G,H,q,j,Y,X,Z,J,Q,K,$,et,tt,it,rt,nt,ot,at,st,lt,ut,ct,ht,dt,pt){"use strict";function mt(e,t){return"#"===t[0]&&(t=$t+t),at.fromString(e,t)}function ft(e){var t=e.rgbaf;if(l(t))return t;var i=e.rgba;if(!l(i))return void 0;if(i.length===o.length)return[o.byteToFloat(i[0]),o.byteToFloat(i[1]),o.byteToFloat(i[2]),o.byteToFloat(i[3])];var r=i.length;t=new Array(r);for(var n=0;r>n;n+=5)t[n]=i[n],t[n+1]=o.byteToFloat(i[n+1]),t[n+2]=o.byteToFloat(i[n+2]),t[n+3]=o.byteToFloat(i[n+3]),t[n+4]=o.byteToFloat(i[n+4]);return t}function vt(e,t){var i=s(e.uri,e);if(l(t)){var r=new R(document.location.href);t=new R(t),i=new R(i).resolve(t.resolve(r)).toString()}return i}function gt(e){var t=e.wsenDegrees;if(l(t)){for(var i=t.length,r=0;i>r;r++)t[r]=S.toRadians(t[r]);return t}return e.wsen}function _t(e){if(l(e.cartesian))return e.cartesian;if(l(e.cartesianVelocity))return e.cartesianVelocity;if(l(e.unitCartesian))return e.unitCartesian;var i,r,n,o=e.unitSpherical;if(l(o)){if(r=o.length,2===r)ti.clock=o[0],ti.cone=o[1],t.fromSpherical(ti,ei),n=[ei.x,ei.y,ei.z];else{var a=0;for(n=new Array(4*(r/3)),i=0;r>i;i+=4)n[i]=o[a++],ti.clock=o[a++],ti.cone=o[a++],t.fromSpherical(ti,ei),n[i+1]=ei.x,n[i+2]=ei.y,n[i+3]=ei.z}return n}var s=e.cartographicRadians;if(l(s)){if(3===s.length)ii.longitude=s[0],ii.latitude=s[1],ii.height=s[2],h.WGS84.cartographicToCartesian(ii,ei),n=[ei.x,ei.y,ei.z];else for(r=s.length,n=new Array(r),i=0;r>i;i+=4)ii.longitude=s[i+1],ii.latitude=s[i+2],ii.height=s[i+3],h.WGS84.cartographicToCartesian(ii,ei),n[i]=s[i],n[i+1]=ei.x,n[i+2]=ei.y,n[i+3]=ei.z;return n}var u=e.cartographicDegrees;if(!l(u))throw new T(JSON.stringify(e)+" is not a valid CZML interval.");if(3===u.length)ii.longitude=S.toRadians(u[0]),ii.latitude=S.toRadians(u[1]),ii.height=u[2],h.WGS84.cartographicToCartesian(ii,ei),n=[ei.x,ei.y,ei.z];else for(r=u.length,n=new Array(r),i=0;r>i;i+=4)ii.longitude=S.toRadians(u[i+1]),ii.latitude=S.toRadians(u[i+2]),ii.height=u[i+3],h.WGS84.cartographicToCartesian(ii,ei),n[i]=u[i],n[i+1]=ei.x,n[i+2]=ei.y,n[i+3]=ei.z;return n}function yt(e,t){var i=e[t],r=e[t+1],n=e[t+2],o=e[t+3],a=1/Math.sqrt(i*i+r*r+n*n+o*o);e[t]=i*a,e[t+1]=r*a,e[t+2]=n*a,e[t+3]=o*a}function Ct(e){var t=e.unitQuaternion;if(l(t)){if(4===t.length)return yt(t,0),t;for(var i=1;ih);var y="function"==typeof e.unpack&&e!==N;if(!d&&!v)return t[i]=f?mt(a,r.reference):y?new W(e.unpack(p,0)):new W(p),void 0;var C,w=t[i],S=r.epoch;if(l(S)&&(C=_.fromIso8601(S)),d&&!v)return w instanceof lt||(w=new lt(e),t[i]=w),w.addSamplesPackedArray(p,C),St(r,w),void 0;var E;if(!d&&v)return u=u.clone(),u.data=f?mt(a,r.reference):y?e.unpack(p,0):p,l(w)||(w=f?new V:new dt,t[i]=w),!f&&w instanceof dt?w.intervals.addInterval(u):w instanceof V?(u.data=f?u.data:new W(u.data),w.intervals.addInterval(u)):(E=g.MAXIMUM_INTERVAL.clone(),E.data=w,w=new V,t[i]=w,w.intervals.addInterval(E),u.data=f?u.data:new W(u.data),w.intervals.addInterval(u)),void 0;l(w)||(w=new V,t[i]=w),w instanceof V||(E=g.MAXIMUM_INTERVAL.clone(),E.data=w,w=new V,t[i]=w,w.intervals.addInterval(E));var b=w.intervals;E=b.findInterval(u),l(E)&&E.data instanceof lt||(E=u.clone(),E.data=new lt(e),b.addInterval(E)),E.data.addSamplesPackedArray(p,C),St(r,E.data)}function bt(e,t,i,r,n,o,a){if(l(r))if(v(r))for(var s=0,u=r.length;u>s;s++)Et(e,t,i,r[s],n,o,a);else Et(e,t,i,r,n,o,a)}function xt(e,i,r,n,o,a){var u,c=r.interval;l(c)?(oi.iso8601=c,u=A.fromIso8601(oi),l(n)&&(u=A.intersect(u,n,ri))):l(n)&&(u=n);var h,d,p,m=!1,f=l(r.cartesianVelocity)?1:0,v=t.packedLength*(f+1),y=l(r.reference),C=l(u)&&!u.equals(g.MAXIMUM_INTERVAL);if(y||(h=s(x[r.referenceFrame],void 0),d=_t(r),p=s(d.length,1),m=p>v),!m&&!C)return e[i]=y?mt(a,r.reference):new U(t.unpack(d),h),void 0;var w,S=e[i],E=r.epoch;if(l(E)&&(w=_.fromIso8601(E)),m&&!C)return(!(S instanceof st)||l(h)&&S.referenceFrame!==h)&&(S=new st(h,f),e[i]=S),S.addSamplesPackedArray(d,w),St(r,S),void 0;var b;if(!m&&C)return u=u.clone(),u.data=y?mt(a,r.reference):t.unpack(d),l(S)||(S=y?new k(h):new ht(h),e[i]=S),!y&&S instanceof ht&&l(h)&&S.referenceFrame===h?S.intervals.addInterval(u):S instanceof k?(u.data=y?u.data:new U(u.data,h),S.intervals.addInterval(u)):(b=g.MAXIMUM_INTERVAL.clone(),b.data=S,S=new k(S.referenceFrame),e[i]=S,S.intervals.addInterval(b),u.data=y?u.data:new U(u.data,h),S.intervals.addInterval(u)),void 0;l(S)?S instanceof k||(b=g.MAXIMUM_INTERVAL.clone(),b.data=S,S=new k(S.referenceFrame),e[i]=S,S.intervals.addInterval(b)):(S=new k(h),e[i]=S);var T=S.intervals;b=T.findInterval(u),l(b)&&b.data instanceof st&&(!l(h)||b.data.referenceFrame===h)||(b=u.clone(),b.data=new st(h,f),T.addInterval(b)),b.data.addSamplesPackedArray(d,w),St(r,b.data)}function Tt(e,t,i,r,n,o){if(l(i))if(v(i))for(var a=0,s=i.length;s>a;a++)xt(e,t,i[a],r,n,o);else xt(e,t,i,r,n,o)}function Pt(t,i,r,n,a,s){var u,c=r.interval;l(c)?(oi.iso8601=c,u=A.fromIso8601(oi),l(n)&&(u=A.intersect(u,n,ri))):l(n)&&(u=n);var h,d,p=t[i];if(l(u)){p instanceof z||(p=new z,t[i]=p);var m=p.intervals;d=m.findInterval({start:u.start,stop:u.stop}),l(d)?h=d.data:(d=u.clone(),m.addInterval(d))}else h=p;var f;l(r.solidColor)?(h instanceof B||(h=new B),f=r.solidColor,bt(o,h,"color",f.color,void 0,void 0,s)):l(r.grid)?(h instanceof X||(h=new X),f=r.grid,bt(o,h,"color",f.color,void 0,a,s),bt(Number,h,"cellAlpha",f.cellAlpha,void 0,a,s),bt(e,h,"lineThickness",f.lineThickness,void 0,a,s),bt(e,h,"lineOffset",f.lineOffset,void 0,a,s),bt(e,h,"lineCount",f.lineCount,void 0,a,s)):l(r.image)?(h instanceof Z||(h=new Z),f=r.image,bt(Image,h,"image",f.image,void 0,a,s),bt(e,h,"repeat",f.repeat,void 0,a,s)):l(r.stripe)?(h instanceof ut||(h=new ut),f=r.stripe,bt(ct,h,"orientation",f.orientation,void 0,a,s),bt(o,h,"evenColor",f.evenColor,void 0,a,s),bt(o,h,"oddColor",f.oddColor,void 0,a,s),bt(Number,h,"offset",f.offset,void 0,a,s),bt(Number,h,"repeat",f.repeat,void 0,a,s)):l(r.polylineOutline)?(h instanceof rt||(h=new rt),f=r.polylineOutline,bt(o,h,"color",f.color,void 0,a,s),bt(o,h,"outlineColor",f.outlineColor,void 0,a,s),bt(Number,h,"outlineWidth",f.outlineWidth,void 0,a,s)):l(r.polylineGlow)&&(h instanceof tt||(h=new tt),f=r.polylineGlow,bt(o,h,"color",f.color,void 0,a,s),bt(Number,h,"glowPower",f.glowPower,void 0,a,s)),l(d)?d.data=h:t[i]=h}function At(e,t,i,r,n,o){if(l(i))if(v(i))for(var a=0,s=i.length;s>a;a++)Pt(e,t,i[a],r,n,o);else Pt(e,t,i,r,n,o)}function Dt(e,t){e.name=s(t.name,e.name)}function Mt(e,t,i,r){var n=t.description;l(n)&&bt(String,e,"description",n,void 0,r,i)}function It(e,t,i,r){var n=t.position;l(n)&&Tt(e,"position",n,void 0,r,i)}function Ot(e,i,r,n){var o=i.viewFrom;l(o)&&bt(t,e,"viewFrom",o,void 0,n,r)}function Rt(e,t,i,r){var n=t.orientation;l(n)&&bt(E,e,"orientation",n,void 0,r,i)}function Lt(e,i,r,n){var o,a,s=r.references;if(l(s)){var u=[];for(o=0,a=s.length;a>o;o++)u.push(mt(n,s[o]));var c=r.interval;if(l(c)){if(c=A.fromIso8601(c),!(e[i]instanceof k)){c.data=new nt(u);var d=new k;d.intervals.addInterval(c),e[i]=d}}else e[i]=new nt(u)}else{var p=[],m=r.cartesian;if(l(m)){for(o=0,a=m.length;a>o;o+=3)p.push(new t(m[o],m[o+1],m[o+2]));r.array=p}else if(m=r.cartographicRadians,l(m)){for(o=0,a=m.length;a>o;o+=3)ii.longitude=m[o],ii.latitude=m[o+1],ii.height=m[o+2],p.push(h.WGS84.cartographicToCartesian(ii));r.array=p}else if(m=r.cartographicDegrees,l(m)){for(o=0,a=m.length;a>o;o+=3)p.push(t.fromDegrees(m[o],m[o+1],m[o+2]));r.array=p}l(r.array)&&bt(Array,e,i,r,void 0,void 0,n)}}function Nt(e,t,i,r){if(l(i))if(v(i))for(var n=i.length,o=0;n>o;o++)Lt(e,t,i[o],r);else Lt(e,t,i,r)}function Ft(e,t){var i,r=t.availability;if(l(r)){var n;if(v(r))for(var o=r.length,a=0;o>a;a++)l(n)||(n=new D),oi.iso8601=r[a],i=A.fromIso8601(oi),n.addInterval(i);else oi.iso8601=r,i=A.fromIso8601(oi),n=new D,n.addInterval(i);e.availability=n}}function Bt(i,r,n,a){var s=r.billboard;if(l(s)){var u,c=s.interval; -l(c)&&(oi.iso8601=c,u=A.fromIso8601(oi));var h=i.billboard;l(h)||(i.billboard=h=new F),bt(o,h,"color",s.color,u,a,n),bt(t,h,"eyeOffset",s.eyeOffset,u,a,n),bt(M,h,"horizontalOrigin",s.horizontalOrigin,u,a,n),bt(Image,h,"image",s.image,u,a,n),bt(e,h,"pixelOffset",s.pixelOffset,u,a,n),bt(Number,h,"scale",s.scale,u,a,n),bt(N,h,"rotation",s.rotation,u,a,n),bt(t,h,"alignedAxis",s.alignedAxis,u,a,n),bt(Boolean,h,"show",s.show,u,a,n),bt(O,h,"verticalOrigin",s.verticalOrigin,u,a,n)}}function zt(e,t){var i=e.version;if(l(i)&&"string"==typeof i){var r=i.split(".");if(2===r.length){if("1"!==r[0])throw new T("Cesium only supports CZML version 1.");t._version=i}}if(!l(t._version))throw new T("CZML version information invalid. It is expected to be a property on the document object in the . version format.");var n=t._documentPacket;l(e.name)&&(n.name=e.name);var o=e.clock;if(l(o)){var a=n.clock;l(a)?(a.interval=s(o.interval,a.interval),a.currentTime=s(o.currentTime,a.currentTime),a.range=s(o.range,a.range),a.step=s(o.step,a.step),a.multiplier=s(o.multiplier,a.multiplier)):n.clock={interval:o.interval,currentTime:o.currentTime,range:o.range,step:o.step,multiplier:o.multiplier}}}function kt(e,t,i,r){var n=t.ellipse;if(l(n)){var a,s=n.interval;l(s)&&(oi.iso8601=s,a=A.fromIso8601(oi));var u=e.ellipse;l(u)||(e.ellipse=u=new q),bt(Boolean,u,"show",n.show,a,r,i),bt(N,u,"rotation",n.rotation,a,r,i),bt(Number,u,"semiMajorAxis",n.semiMajorAxis,a,r,i),bt(Number,u,"semiMinorAxis",n.semiMinorAxis,a,r,i),bt(Number,u,"height",n.height,a,r,i),bt(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),bt(Number,u,"granularity",n.granularity,a,r,i),bt(N,u,"stRotation",n.stRotation,a,r,i),At(u,"material",n.material,a,r,i),bt(Boolean,u,"fill",n.fill,a,r,i),bt(Boolean,u,"outline",n.outline,a,r,i),bt(o,u,"outlineColor",n.outlineColor,a,r,i),bt(Number,u,"outlineWidth",n.outlineWidth,a,r,i),bt(Number,u,"numberOfVerticalLines",n.numberOfVerticalLines,a,r,i)}}function Vt(e,i,r,n){var a=i.ellipsoid;if(l(a)){var s,u=a.interval;l(u)&&(oi.iso8601=u,s=A.fromIso8601(oi));var c=e.ellipsoid;l(c)||(e.ellipsoid=c=new j),bt(Boolean,c,"show",a.show,s,n,r),bt(t,c,"radii",a.radii,s,n,r),At(c,"material",a.material,s,n,r),bt(Boolean,c,"fill",a.fill,s,n,r),bt(Boolean,c,"outline",a.outline,s,n,r),bt(o,c,"outlineColor",a.outlineColor,s,n,r),bt(Number,c,"outlineWidth",a.outlineWidth,s,n,r)}}function Ut(i,r,n,a){var s=r.label;if(l(s)){var u,c=s.interval;l(c)&&(oi.iso8601=c,u=A.fromIso8601(oi));var h=i.label;l(h)||(i.label=h=new J),bt(o,h,"fillColor",s.fillColor,u,a,n),bt(o,h,"outlineColor",s.outlineColor,u,a,n),bt(Number,h,"outlineWidth",s.outlineWidth,u,a,n),bt(t,h,"eyeOffset",s.eyeOffset,u,a,n),bt(M,h,"horizontalOrigin",s.horizontalOrigin,u,a,n),bt(String,h,"text",s.text,u,a,n),bt(e,h,"pixelOffset",s.pixelOffset,u,a,n),bt(Number,h,"scale",s.scale,u,a,n),bt(Boolean,h,"show",s.show,u,a,n),bt(O,h,"verticalOrigin",s.verticalOrigin,u,a,n),bt(String,h,"font",s.font,u,a,n),bt(I,h,"style",s.style,u,a,n)}}function Wt(e,t,i,r){var n=t.model;if(l(n)){var o,a=n.interval;l(a)&&(oi.iso8601=a,o=A.fromIso8601(oi));var s=e.model;l(s)||(e.model=s=new Q),bt(Boolean,s,"show",n.show,o,r,i),bt(Number,s,"scale",n.scale,o,r,i),bt(Number,s,"minimumPixelSize",n.minimumPixelSize,o,r,i),bt(R,s,"uri",n.gltf,o,r,i)}}function Gt(e,t,i,r){var n=t.path;if(l(n)){var o,a=n.interval;l(a)&&(oi.iso8601=a,o=A.fromIso8601(oi));var s=e.path;l(s)||(e.path=s=new K),bt(Boolean,s,"show",n.show,o,r,i),bt(Number,s,"width",n.width,o,r,i),bt(Number,s,"resolution",n.resolution,o,r,i),bt(Number,s,"leadTime",n.leadTime,o,r,i),bt(Number,s,"trailTime",n.trailTime,o,r,i),At(s,"material",n.material,o,r,i)}}function Ht(e,t,i,r){var n=t.point;if(l(n)){var a,s=n.interval;l(s)&&(oi.iso8601=s,a=A.fromIso8601(oi));var u=e.point;l(u)||(e.point=u=new $),bt(o,u,"color",n.color,a,r,i),bt(Number,u,"pixelSize",n.pixelSize,a,r,i),bt(o,u,"outlineColor",n.outlineColor,a,r,i),bt(Number,u,"outlineWidth",n.outlineWidth,a,r,i),bt(Boolean,u,"show",n.show,a,r,i)}}function qt(e,t,i,r){var n=t.polygon;if(l(n)){var a,s=n.interval;l(s)&&(oi.iso8601=s,a=A.fromIso8601(oi));var u=e.polygon;l(u)||(e.polygon=u=new et),bt(Boolean,u,"show",n.show,a,r,i),At(u,"material",n.material,a,r,i),bt(Number,u,"height",n.height,a,r,i),bt(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),bt(Number,u,"granularity",n.granularity,a,r,i),bt(N,u,"stRotation",n.stRotation,a,r,i),bt(Boolean,u,"fill",n.fill,a,r,i),bt(Boolean,u,"outline",n.outline,a,r,i),bt(o,u,"outlineColor",n.outlineColor,a,r,i),bt(Number,u,"outlineWidth",n.outlineWidth,a,r,i),bt(Boolean,u,"perPositionHeight",n.perPositionHeight,a,r,i),Nt(u,"hierarchy",n.positions,i)}}function jt(e,t,i,r){var n=t.rectangle;if(l(n)){var a,s=n.interval;l(s)&&(oi.iso8601=s,a=A.fromIso8601(oi));var u=e.rectangle;l(u)||(e.rectangle=u=new ot),bt(Boolean,u,"show",n.show,a,r,i),bt(b,u,"coordinates",n.coordinates,a,r,i),At(u,"material",n.material,a,r,i),bt(Number,u,"height",n.height,a,r,i),bt(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),bt(Number,u,"granularity",n.granularity,a,r,i),bt(N,u,"rotation",n.rotation,a,r,i),bt(N,u,"stRotation",n.stRotation,a,r,i),bt(Boolean,u,"fill",n.fill,a,r,i),bt(Boolean,u,"outline",n.outline,a,r,i),bt(o,u,"outlineColor",n.outlineColor,a,r,i),bt(Number,u,"outlineWidth",n.outlineWidth,a,r,i),bt(Boolean,u,"closeBottom",n.closeBottom,a,r,i),bt(Boolean,u,"closeTop",n.closeTop,a,r,i)}}function Yt(e,t,i,r){var n=t.wall;if(l(n)){var a,s=n.interval;l(s)&&(oi.iso8601=s,a=A.fromIso8601(oi));var u=e.wall;l(u)||(e.wall=u=new pt),bt(Boolean,u,"show",n.show,a,r,i),At(u,"material",n.material,a,r,i),bt(Array,u,"minimumHeights",n.minimumHeights,a,r,i),bt(Array,u,"maximumHeights",n.maximumHeights,a,r,i),bt(Number,u,"granularity",n.granularity,a,r,i),bt(Boolean,u,"fill",n.fill,a,r,i),bt(Boolean,u,"outline",n.outline,a,r,i),bt(o,u,"outlineColor",n.outlineColor,a,r,i),bt(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Nt(u,"positions",n.positions,i)}}function Xt(e,t,i,r){var n=t.polyline;if(l(n)){var o,a=n.interval;l(a)&&(oi.iso8601=a,o=A.fromIso8601(oi));var s=e.polyline;l(s)||(e.polyline=s=new it),bt(Boolean,s,"show",n.show,o,r,i),bt(Number,s,"width",n.width,o,r,i),At(s,"material",n.material,o,r,i),bt(Boolean,s,"followSurface",n.followSurface,o,r,i),bt(Number,s,"granularity",n.granularity,o,r,i),Nt(s,"positions",n.positions,i)}}function Zt(e,t,i,r,n){var o=e.id;if(l(o)||(o=a()),$t=o,!l(n._version)&&"document"!==o)throw new T("The first CZML packet is required to be the document object.");if(e["delete"]===!0)t.removeById(o);else if("document"===o)zt(e,n);else{var s=t.getOrCreateEntity(o),u=e.parent;l(u)&&(s.parent=t.getOrCreateEntity(u));for(var c=i.length-1;c>-1;c--)i[c](s,e,t,r)}$t=void 0}function Jt(e){var t,i=e._documentPacket.clock;if(!l(i)){if(!l(e._clock)){var o=e._entityCollection.computeAvailability();if(!o.start.equals(g.MINIMUM_VALUE)){var a=o.start,u=o.stop,c=_.secondsDifference(u,a),h=Math.round(c/120);return t=new H,t.startTime=_.clone(a),t.stopTime=_.clone(u),t.clockRange=r.LOOP_STOP,t.multiplier=h,t.currentTime=_.clone(a),t.clockStep=n.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}if(l(e._clock)?t=e._clock.clone():(t=new H,t.startTime=g.MINIMUM_VALUE.clone(),t.stopTime=g.MAXIMUM_VALUE.clone(),t.currentTime=g.MINIMUM_VALUE.clone(),t.clockRange=r.LOOP_STOP,t.clockStep=n.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1),l(i.interval)){oi.iso8601=i.interval;var d=A.fromIso8601(oi);t.startTime=d.start,t.stopTime=d.stop}return l(i.currentTime)&&(t.currentTime=_.fromIso8601(i.currentTime)),l(i.range)&&(t.clockRange=s(r[i.range],r.LOOP_STOP)),l(i.step)&&(t.clockStep=s(n[i.step],n.SYSTEM_CLOCK_MULTIPLIER)),l(i.multiplier)&&(t.multiplier=i.multiplier),t.equals(e._clock)?!1:(e._clock=t.clone(e._clock),!0)}function Qt(e,t,i,r){i=s(i,s.EMPTY_OBJECT);var n=t,o=i.sourceUri;return"string"==typeof t&&(n=w(t),o=s(o,t)),G.setLoading(e,!0),L(n,function(t){return Kt(e,t,o,r)}).otherwise(function(t){return G.setLoading(e,!1),e._error.raiseEvent(e,t),window.console.log(t),L.reject(t)})}function Kt(e,t,i,r){G.setLoading(e,!0);var n=e._entityCollection;r&&(e._version=void 0,e._documentPacket=new ai,n.removeAll()),si._processCzml(t,n,i,void 0,e);var o=Jt(e),a=e._documentPacket;return l(a.name)&&e._name!==a.name?(e._name=a.name,o=!0):!l(e._name)&&l(i)&&(e._name=m(i),o=!0),G.setLoading(e,!1),o&&e._changed.raiseEvent(e),e}var $t,ei=new t,ti=new P,ii=new i,ri=new A,ni={HERMITE:f,LAGRANGE:y,LINEAR:C},oi={iso8601:void 0},ai=function(){this.name=void 0,this.clock=void 0},si=function(e){this._name=e,this._changed=new d,this._error=new d,this._isLoading=!1,this._loading=new d,this._clock=void 0,this._documentPacket=new ai,this._version=void 0,this._entityCollection=new Y};return si.load=function(e,t){return(new si).load(e,t)},u(si.prototype,{name:{get:function(){return this._name}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}}}),si.updaters=[Bt,kt,Vt,Ut,Wt,Dt,Mt,Gt,Ht,qt,Xt,jt,It,Ot,Yt,Rt,Ft],si.prototype.process=function(e,t){return Qt(this,e,t,!1)},si.prototype.load=function(e,t){return Qt(this,e,t,!0)},si.processPacketData=bt,si.processPositionPacketData=Tt,si.processMaterialPacketData=At,si._processCzml=function(e,t,i,r,n){if(r=l(r)?r:si.updaters,v(e))for(var o=0,a=e.length;a>o;o++)Zt(e[o],t,r,i,n);else Zt(e,t,r,i,n)},si}),i("DataSources/DataSourceCollection",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../ThirdParty/when"],function(e,t,i,r,n,o,a){"use strict";var s=function(){this._dataSources=[],this._dataSourceAdded=new o,this._dataSourceRemoved=new o};return i(s.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}}}),s.prototype.add=function(e){var t=this,i=this._dataSources;return a(e,function(e){return i===t._dataSources&&(t._dataSources.push(e),t._dataSourceAdded.raiseEvent(t,e)),e})},s.prototype.remove=function(t,i){i=e(i,!1);var r=this._dataSources.indexOf(t);return-1!==r?(this._dataSources.splice(r,1),this._dataSourceRemoved.raiseEvent(this,t),i&&"function"==typeof t.destroy&&t.destroy(),!0):!1},s.prototype.removeAll=function(t){t=e(t,!1);for(var i=this._dataSources,r=0,n=i.length;n>r;++r){var o=i[r];this._dataSourceRemoved.raiseEvent(this,o),t&&"function"==typeof o.destroy&&o.destroy()}this._dataSources=[]},s.prototype.contains=function(e){return-1!==this.indexOf(e)},s.prototype.indexOf=function(e){return this._dataSources.indexOf(e)},s.prototype.get=function(e){return this._dataSources[e]},s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return this.removeAll(!0),r(this)},s}),i("DataSources/EllipseGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EllipseGeometry","../Core/EllipseOutlineGeometry","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";var w=new v(e.WHITE),S=new g(!0),E=new g(!0),b=new g(!1),x=new g(e.BLACK),T=new e,P=function(e){this.id=e,this.vertexFormat=void 0,this.center=void 0,this.semiMajorAxis=void 0,this.semiMinorAxis=void 0,this.rotation=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.numberOfVerticalLines=void 0},A=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(A.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new P(e),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)};n(A,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(A.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),A.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},A.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},A.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,l=a.isAvailable(i),u=new d(l&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||l)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new c({id:a,geometry:new s(this._options),attributes:n})},A.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new c({id:r,geometry:new l(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){this._entitySubscription(),o(this)},A.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"position"===t||"ellipse"===t){var n=this._entity.ellipse;if(!r(n))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var o=n.fill,a=r(o)&&o.isConstant?o.getValue(h.MINIMUM_VALUE):!0,s=n.outline,l=r(s);if(l&&s.isConstant&&(l=s.getValue(h.MINIMUM_VALUE)),!a&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var u=this._entity.position,c=n.semiMajorAxis,d=n.semiMinorAxis,f=n.show;if(r(f)&&f.isConstant&&!f.getValue(h.MINIMUM_VALUE)||!r(u)||!r(c)||!r(d))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var g=i(n.material,w),_=g instanceof v;this._materialProperty=g,this._fillProperty=i(o,E),this._showProperty=i(f,S),this._showOutlineProperty=i(n.outline,b),this._outlineColorProperty=l?i(n.outlineColor,x):void 0;var y=n.rotation,T=n.height,P=n.extrudedHeight,A=n.granularity,D=n.stRotation,M=n.outlineWidth,I=n.numberOfVerticalLines;if(this._isClosed=r(P),this._fillEnabled=a,this._outlineEnabled=l,u.isConstant&&c.isConstant&&d.isConstant&&C.isConstant(y)&&C.isConstant(T)&&C.isConstant(P)&&C.isConstant(A)&&C.isConstant(D)&&C.isConstant(M)&&C.isConstant(I)){var O=this._options;O.vertexFormat=_?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,O.center=u.getValue(h.MINIMUM_VALUE,O.center),O.semiMajorAxis=c.getValue(h.MINIMUM_VALUE,O.semiMajorAxis),O.semiMinorAxis=d.getValue(h.MINIMUM_VALUE,O.semiMinorAxis),O.rotation=r(y)?y.getValue(h.MINIMUM_VALUE):void 0,O.height=r(T)?T.getValue(h.MINIMUM_VALUE):void 0,O.extrudedHeight=r(P)?P.getValue(h.MINIMUM_VALUE):void 0,O.granularity=r(A)?A.getValue(h.MINIMUM_VALUE):void 0,O.stRotation=r(D)?D.getValue(h.MINIMUM_VALUE):void 0,O.numberOfVerticalLines=r(I)?I.getValue(h.MINIMUM_VALUE):void 0,this._outlineWidth=r(M)?M.getValue(h.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},A.prototype.createDynamicUpdater=function(e){return new D(e,this)};var D=function(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new P(t._entity)};return D.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,u=a.ellipse;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(u.show,i,!0)){var h=this._options,d=C.getValueOrUndefined(a.position,i,h.center),v=C.getValueOrUndefined(u.semiMajorAxis,i),g=C.getValueOrUndefined(u.semiMinorAxis,i);if(r(d)&&r(v)&&r(g)){if(h.center=d,h.semiMajorAxis=v,h.semiMinorAxis=g,h.rotation=C.getValueOrUndefined(u.rotation,i),h.height=C.getValueOrUndefined(u.height,i),h.extrudedHeight=C.getValueOrUndefined(u.extrudedHeight,i),h.granularity=C.getValueOrUndefined(u.granularity,i),h.stRotation=C.getValueOrUndefined(u.stRotation,i),h.numberOfVerticalLines=C.getValueOrUndefined(u.numberOfVerticalLines,i),C.getValueOrDefault(u.fill,i,!0)){var _=y.getValue(i,o.fillMaterialProperty,this._material);this._material=_;var w=new p({material:_,translucent:_.isTranslucent(),closed:r(h.extrudedHeight)});h.vertexFormat=w.vertexFormat,this._primitive=n.add(new f({geometryInstances:new c({id:a,geometry:new s(h)}),appearance:w,asynchronous:!1}))}if(C.getValueOrDefault(u.outline,i,!1)){h.vertexFormat=m.VERTEX_FORMAT;var S=C.getValueOrClonedDefault(u.outlineColor,i,e.BLACK,T),E=C.getValueOrDefault(u.outlineWidth,i,1),b=1!==S.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new c({id:a,geometry:new l(h),attributes:{color:t.fromColor(S)}}),appearance:new m({flat:!0,translucent:b,renderState:{lineWidth:o._scene.clampLineWidth(E)}}),asynchronous:!1}))}}}},D.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},D.prototype.isDestroyed=function(){return!1},D.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},A}),i("DataSources/EllipsoidGeometryUpdater",["../Core/Cartesian3","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EllipsoidGeometry","../Core/EllipsoidOutlineGeometry","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/Matrix4","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","../Scene/SceneMode","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E){"use strict";var b=new y(t.WHITE),x=new C(!0),T=new C(!0),P=new C(!1),A=new C(t.BLACK),D=new e,M=new t,I=new e(1,1,1),O=function(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0},R=function(e,t){this._scene=t,this._entity=e,this._entitySubscription=e.definitionChanged.addEventListener(R.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new c,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new O(e),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)};o(R,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:f}}),o(R.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!n(this._entity.availability)&&E.isConstant(this._showProperty)&&E.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!n(this._entity.availability)&&E.isConstant(this._showProperty)&&E.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),R.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},R.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},R.prototype.createFillGeometryInstance=function(e){var r,o,a=this._entity,s=a.isAvailable(e),u=new m(s&&a.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e));if(this._materialProperty instanceof y){var c=t.WHITE;n(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(c=this._materialProperty.color.getValue(e)),o=i.fromColor(c),r={show:u,color:o}}else r={show:u};return new h({id:a,geometry:new l(this._options),modelMatrix:a._getModelMatrix(d.MINIMUM_VALUE),attributes:r})},R.prototype.createOutlineGeometryInstance=function(e){var r=this._entity,n=r.isAvailable(e),o=E.getValueOrDefault(this._outlineColorProperty,e,t.BLACK);return new h({id:r,geometry:new u(this._options),modelMatrix:r._getModelMatrix(d.MINIMUM_VALUE),attributes:{show:new m(n&&r.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:i.fromColor(o)}})},R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){this._entitySubscription(),a(this)},R.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"position"===t||"orientation"===t||"ellipsoid"===t){var i=e.ellipsoid;if(!n(i))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var o=i.fill,a=n(o)&&o.isConstant?o.getValue(d.MINIMUM_VALUE):!0,s=i.outline,l=n(s);if(l&&s.isConstant&&(l=s.getValue(d.MINIMUM_VALUE)),!a&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var u=e.position,c=i.radii,h=i.show;if(n(h)&&h.isConstant&&!h.getValue(d.MINIMUM_VALUE)||!n(u)||!n(c))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var p=r(i.material,b),m=p instanceof y;this._materialProperty=p,this._fillProperty=r(o,T),this._showProperty=r(h,x),this._showOutlineProperty=r(i.outline,P),this._outlineColorProperty=l?r(i.outlineColor,A):void 0,this._fillEnabled=a,this._outlineEnabled=l;var g=i.stackPartitions,_=i.slicePartitions,C=i.outlineWidth,w=i.subdivisions;if(u.isConstant&&E.isConstant(e.orientation)&&c.isConstant&&E.isConstant(g)&&E.isConstant(_)&&E.isConstant(C)&&E.isConstant(w)){var S=this._options;S.vertexFormat=m?v.VERTEX_FORMAT:f.MaterialSupport.TEXTURED.vertexFormat,S.radii=c.getValue(d.MINIMUM_VALUE,S.radii),S.stackPartitions=n(g)?g.getValue(d.MINIMUM_VALUE):void 0,S.slicePartitions=n(_)?_.getValue(d.MINIMUM_VALUE):void 0,S.subdivisions=n(w)?w.getValue(d.MINIMUM_VALUE):void 0,this._outlineWidth=n(C)?C.getValue(d.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},R.prototype.createDynamicUpdater=function(e){return new L(e,this)};var L=function(e,t){this._entity=t._entity,this._scene=t._scene,this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new O(t._entity),this._modelMatrix=new p,this._material=void 0,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0};return L.prototype.update=function(e){var o=this._entity,a=o.ellipsoid;if(!o.isShowing||!o.isAvailable(e)||!E.getValueOrDefault(a.show,e,!0))return n(this._primitive)&&(this._primitive.show=!1),n(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1),void 0;var s=E.getValueOrUndefined(a.radii,e,D),c=o._getModelMatrix(e,this._modelMatrix);if(!n(c)||!n(s))return n(this._primitive)&&(this._primitive.show=!1),n(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1),void 0;var d,y=E.getValueOrDefault(a.fill,e,!0),C=E.getValueOrDefault(a.outline,e,!1),w=E.getValueOrClonedDefault(a.outlineColor,e,t.BLACK,M),x=S.getValue(e,r(a.material,b),this._material);this._material=x;var T=E.getValueOrUndefined(a.stackPartitions,e),P=E.getValueOrUndefined(a.slicePartitions,e),A=E.getValueOrUndefined(a.subdivisions,e),O=E.getValueOrDefault(a.outlineWidth,e,1),R=this._scene.mode,L=R===_.SCENE3D,N=this._options,F=!L||this._lastSceneMode!==R||!n(this._primitive)||N.stackPartitions!==T||N.slicePartitions!==P||N.subdivisions!==A||this._lastOutlineWidth!==O;if(F){var B=this._primitives;B.removeAndDestroy(this._primitive),B.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=R,this._lastOutlineWidth=O,N.stackPartitions=T,N.slicePartitions=P,N.subdivisions=A,N.radii=L?I:s,d=new f({material:x,translucent:x.isTranslucent(),closed:!0}),N.vertexFormat=d.vertexFormat,this._primitive=B.add(new g({geometryInstances:new h({id:o,geometry:new l(N),modelMatrix:L?void 0:c,attributes:{show:new m(y)}}),appearance:d,asynchronous:!1})),N.vertexFormat=v.VERTEX_FORMAT,this._outlinePrimitive=B.add(new g({geometryInstances:new h({id:o,geometry:new u(N),modelMatrix:L?void 0:c,attributes:{show:new m(C),color:i.fromColor(w)}}),appearance:new v({flat:!0,translucent:1!==w.alpha,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(O)}}),asynchronous:!1})),this._lastShow=y,this._lastOutlineShow=C,this._lastOutlineColor=t.clone(w,this._lastOutlineColor)}else if(this._primitive.ready){var z=this._primitive,k=this._outlinePrimitive;z.show=!0,k.show=!0,d=z.appearance,d.material=x;var V=this._attributes;n(V)||(V=z.getGeometryInstanceAttributes(o),this._attributes=V),y!==this._lastShow&&(V.show=m.toValue(y,V.show),this._lastShow=y);var U=this._outlineAttributes;n(U)||(U=k.getGeometryInstanceAttributes(o),this._outlineAttributes=U),C!==this._lastOutlineShow&&(U.show=m.toValue(C,U.show),this._lastOutlineShow=C),t.equals(w,this._lastOutlineColor)||(U.color=i.toValue(w,U.color),t.clone(w,this._lastOutlineColor))}L&&(s.x=Math.max(s.x,.001),s.y=Math.max(s.y,.001),s.z=Math.max(s.z,.001),c=p.multiplyByScale(c,s,c),this._primitive.modelMatrix=c,this._outlinePrimitive.modelMatrix=c)},L.prototype.getBoundingSphere=function(e,t){return w(e,this._primitive,this._outlinePrimitive,t)},L.prototype.isDestroyed=function(){return!1},L.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),a(this)},R}),i("DataSources/StaticGeometryColorBatch",["../Core/AssociativeArray","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/Primitive","./BoundingSphereState"],function(e,t,i,r,n,o,a){"use strict";var s=new t,l=function(t,i,r,n){this.translucent=i,this.appearanceType=r,this.closed=n,this.primitives=t,this.createPrimitive=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.updaters=new e,this.updatersWithAttributes=new e,this.attributes=new e,this.subscriptions=new e,this.showsUpdated=new e,this.itemsToRemove=[]};l.prototype.add=function(e,t){var i=e.entity.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantFill&&e.fillMaterialProperty.isConstant){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener(function(t,i){"isShowing"===i&&r.showsUpdated.set(t.id,e)}))}else this.updatersWithAttributes.set(i,e)},l.prototype.remove=function(e){var t=e.entity.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);r(i)&&(i(),this.subscriptions.remove(t))}},l.prototype.update=function(e){var a,l,u=!0,c=0,h=this.primitive,d=this.primitives;if(this.createPrimitive){r(h)&&(r(this.oldPrimitive)?d.remove(h):this.oldPrimitive=h);var p=this.geometry.values,m=p.length;if(m>0){for(l=0;m>l;l++){var f=p[l],v=f.attributes;a=this.attributes.get(f.id.id),r(a)&&(r(v.show)&&(v.show.value=a.show),r(v.color)&&(v.color.value=a.color))}h=new o({asynchronous:!0,geometryInstances:p,appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed})}),d.add(h),u=!1}this.attributes.removeAll(),this.primitive=h,this.createPrimitive=!1}else if(r(h)&&h.ready){r(this.oldPrimitive)&&(d.remove(this.oldPrimitive),this.oldPrimitive=void 0);var g=this.updatersWithAttributes.values,_=g.length;for(l=0;_>l;l++){var y=g[l],C=this.geometry.get(y.entity.id);if(a=this.attributes.get(C.id.id),r(a)||(a=h.getGeometryInstanceAttributes(C.id),this.attributes.set(C.id.id,a)),!y.fillMaterialProperty.isConstant){var w=y.fillMaterialProperty.color;w.getValue(e,s),t.equals(a._lastColor,s)||(a._lastColor=t.clone(s,a._lastColor),a.color=i.toValue(s,a.color),(this.translucent&&255===a.color[3]||!this.translucent&&255!==a.color[3])&&(this.itemsToRemove[c++]=y))}var S=y.entity.isShowing&&(y.hasConstantFill||y.isFilled(e)),E=1===a.show[0];S!==E&&(a.show=n.toValue(S,a.show))}this.updateShows(h)}else r(h)&&!h.ready&&(u=!1);return this.itemsToRemove.length=c,u},l.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,o=0;i>o;o++){var a=t[o],s=this.geometry.get(a.entity.id),l=this.attributes.get(s.id.id);r(l)||(l=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,l));var u=a.entity.isShowing,c=1===l.show[0];u!==c&&(l.show=n.toValue(u,l.show))}this.showsUpdated.removeAll()},l.prototype.contains=function(e){return this.updaters.contains(e.id)},l.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return a.PENDING;var n=i.getGeometryInstanceAttributes(e);return!r(n)||!r(n.boundingSphere)||r(n.show)&&0===n.show[0]?a.FAILED:(n.boundingSphere.clone(t),a.DONE)},l.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;r(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;r(i)&&(e.remove(i),this.oldPrimitive=void 0)};var u=function(e,t,i){this._solidBatch=new l(e,!1,t,i),this._translucentBatch=new l(e,!0,t,i)};return u.prototype.add=function(e,t){var i=t.createFillGeometryInstance(e);255===i.attributes.color.value[3]?this._solidBatch.add(t,i):this._translucentBatch.add(t,i)},u.prototype.remove=function(e){this._solidBatch.remove(e)||this._translucentBatch.remove(e)},u.prototype.update=function(e){var t,i,r=this._solidBatch.update(e); -r=this._translucentBatch.update(e)&&r;var n=this._solidBatch.itemsToRemove,o=n.length;if(o>0)for(t=0;o>t;t++)i=n[t],this._solidBatch.remove(i),this._translucentBatch.add(i,i.createFillGeometryInstance(e));n=this._translucentBatch.itemsToRemove;var a=n.length;if(a>0)for(t=0;a>t;t++)i=n[t],this._translucentBatch.remove(i),this._solidBatch.add(i,i.createFillGeometryInstance(e));return(o>0||a>0)&&(r=this._solidBatch.update(e)&&r,r=this._translucentBatch.update(e)&&r),r},u.prototype.getBoundingSphere=function(e,t){return this._solidBatch.contains(e)?this._solidBatch.getBoundingSphere(e,t):this._translucentBatch.contains(e)?this._translucentBatch.getBoundingSphere(e,t):a.FAILED},u.prototype.removeAllPrimitives=function(){this._solidBatch.removeAllPrimitives(),this._translucentBatch.removeAllPrimitives()},u}),i("DataSources/StaticGeometryPerMaterialBatch",["../Core/AssociativeArray","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/Primitive","./BoundingSphereState","./MaterialProperty"],function(e,t,i,r,n,o){"use strict";var a=function(t,i,r,n){this.primitives=t,this.appearanceType=i,this.materialProperty=r,this.closed=n,this.updaters=new e,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.material=void 0,this.updatersWithAttributes=new e,this.attributes=new e,this.invalidated=!1,this.removeMaterialSubscription=r.definitionChanged.addEventListener(a.prototype.onMaterialChanged,this),this.subscriptions=new e,this.showsUpdated=new e};a.prototype.onMaterialChanged=function(){this.invalidated=!0},a.prototype.isMaterial=function(e){var i=this.materialProperty,r=e.fillMaterialProperty;return r===i?!0:t(i)?i.equals(r):!1},a.prototype.add=function(e,t){var i=t.entity.id;if(this.updaters.set(i,t),this.geometry.set(i,t.createFillGeometryInstance(e)),t.hasConstantFill&&t.fillMaterialProperty.isConstant){var r=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(e,i){"isShowing"===i&&r.showsUpdated.set(e.id,t)}))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},a.prototype.remove=function(e){var i=e.entity.id,r=this.updaters.remove(i);if(r){this.geometry.remove(i),this.updatersWithAttributes.remove(i);var n=this.subscriptions.get(i);t(n)&&(n(),this.subscriptions.remove(i))}return this.createPrimitive=r,r},a.prototype.update=function(e){var n,a,s=!0,l=this.primitive,u=this.primitives,c=this.geometry.values;if(this.createPrimitive){t(l)&&(t(this.oldPrimitive)?u.remove(l):this.oldPrimitive=l);var h=c.length;if(h>0){for(a=0;h>a;a++){var d=c[a],p=d.attributes;n=this.attributes.get(d.id.id),t(n)&&(t(p.show)&&(p.show.value=n.show),t(p.color)&&(p.color.value=n.color))}this.material=o.getValue(e,this.materialProperty,this.material),l=new r({asynchronous:!0,geometryInstances:c,appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed})}),u.add(l),s=!1}this.attributes.removeAll(),this.primitive=l,this.createPrimitive=!1}else if(t(l)&&l.ready){t(this.oldPrimitive)&&(u.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=o.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;var m=this.updatersWithAttributes.values,f=m.length;for(a=0;f>a;a++){var v=m[a],g=v.entity,_=this.geometry.get(g.id);n=this.attributes.get(_.id.id),t(n)||(n=l.getGeometryInstanceAttributes(_.id),this.attributes.set(_.id.id,n));var y=g.isShowing&&(v.hasConstantFill||v.isFilled(e)),C=1===n.show[0];y!==C&&(n.show=i.toValue(y,n.show))}this.updateShows(l)}else t(l)&&!l.ready&&(s=!1);return s},a.prototype.updateShows=function(e){for(var r=this.showsUpdated.values,n=r.length,o=0;n>o;o++){var a=r[o],s=a.entity,l=this.geometry.get(s.id),u=this.attributes.get(l.id.id);t(u)||(u=e.getGeometryInstanceAttributes(l.id),this.attributes.set(l.id.id,u));var c=s.isShowing,h=1===u.show[0];c!==h&&(u.show=i.toValue(c,u.show))}this.showsUpdated.removeAll()},a.prototype.contains=function(e){return this.updaters.contains(e.id)},a.prototype.getBoundingSphere=function(e,i){var r=this.primitive;if(!r.ready)return n.PENDING;var o=r.getGeometryInstanceAttributes(e);return!t(o)||!t(o.boundingSphere)||t(o.show)&&0===o.show[0]?n.FAILED:(o.boundingSphere.clone(i),n.DONE)},a.prototype.destroy=function(){var e=this.primitive,i=this.primitives;t(e)&&i.remove(e);var r=this.oldPrimitive;t(r)&&i.remove(r),this.removeMaterialSubscription()};var s=function(e,t,i){this._items=[],this._primitives=e,this._appearanceType=t,this._closed=i};return s.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=0;r>n;n++){var o=i[n];if(o.isMaterial(t))return o.add(e,t),void 0}var s=new a(this._primitives,this._appearanceType,t.fillMaterialProperty,this._closed);s.add(e,t),i.push(s)},s.prototype.remove=function(e){for(var t=this._items,i=t.length,r=i-1;r>=0;r--){var n=t[r];if(n.remove(e)){0===n.updaters.length&&(t.splice(r,1),n.destroy());break}}},s.prototype.update=function(e){var t,i=this._items,r=i.length;for(t=r-1;t>=0;t--){var n=i[t];if(n.invalidated){i.splice(t,1);for(var o=n.updaters.values,a=o.length,s=0;a>s;s++)this.add(e,o[s]);n.destroy()}}var l=!0;for(t=0;r>t;t++)l=i[t].update(e)&&l;return l},s.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,o=0;r>o;o++){var a=i[o];if(a.contains(e))return a.getBoundingSphere(e,t)}return n.FAILED},s.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;t>i;i++)e[i].destroy();this._items.length=0},s}),i("DataSources/StaticOutlineGeometryBatch",["../Core/AssociativeArray","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./BoundingSphereState"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(t,i,r){this.translucent=i,this.primitives=t,this.createPrimitive=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.updaters=new e,this.updatersWithAttributes=new e,this.attributes=new e,this.itemsToRemove=[],this.width=r,this.subscriptions=new e,this.showsUpdated=new e};l.prototype.add=function(e,t){var i=e.entity.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantOutline&&e.outlineColorProperty.isConstant){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener(function(t,i){"isShowing"===i&&r.showsUpdated.set(t.id,e)}))}else this.updatersWithAttributes.set(i,e)},l.prototype.remove=function(e){var t=e.entity.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);r(i)&&(i(),this.subscriptions.remove(t))}};var u=new t;l.prototype.update=function(e){var s,l,c=!0,h=0,d=this.primitive,p=this.primitives;if(this.createPrimitive){r(d)&&(r(this.oldPrimitive)?p.remove(d):this.oldPrimitive=d);var m=this.geometry.values,f=m.length;if(f>0){for(l=0;f>l;l++){var v=m[l],g=v.attributes;s=this.attributes.get(v.id.id),r(s)&&(r(g.show)&&(g.show.value=s.show),r(g.color)&&(g.color.value=s.color))}d=new a({asynchronous:!0,geometryInstances:m,appearance:new o({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}})}),p.add(d),c=!1}this.attributes.removeAll(),this.primitive=d,this.createPrimitive=!1}else if(r(d)&&d.ready){r(this.oldPrimitive)&&(p.remove(this.oldPrimitive),this.oldPrimitive=void 0);var _=this.updatersWithAttributes.values,y=_.length;for(l=0;y>l;l++){var C=_[l],w=this.geometry.get(C.entity.id);if(s=this.attributes.get(w.id.id),r(s)||(s=d.getGeometryInstanceAttributes(w.id),this.attributes.set(w.id.id,s)),!C.outlineColorProperty.isConstant){var S=C.outlineColorProperty;S.getValue(e,u),t.equals(s._lastColor,u)||(s._lastColor=t.clone(u,s._lastColor),s.color=i.toValue(u,s.color),(this.translucent&&255===s.color[3]||!this.translucent&&255!==s.color[3])&&(this.itemsToRemove[h++]=C))}var E=C.entity.isShowing&&(C.hasConstantOutline||C.isOutlineVisible(e)),b=1===s.show[0];E!==b&&(s.show=n.toValue(E,s.show))}this.updateShows(d)}else r(d)&&!d.ready&&(c=!1);return this.itemsToRemove.length=h,c},l.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,o=0;i>o;o++){var a=t[o],s=this.geometry.get(a.entity.id),l=this.attributes.get(s.id.id);r(l)||(l=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,l));var u=a.entity.isShowing,c=1===l.show[0];u!==c&&(l.show=n.toValue(u,l.show))}this.showsUpdated.removeAll()},l.prototype.contains=function(e){return this.updaters.contains(e.id)},l.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return s.PENDING;var n=i.getGeometryInstanceAttributes(e);return!r(n)||!r(n.boundingSphere)||r(n.show)&&0===n.show[0]?s.FAILED:(n.boundingSphere.clone(t),s.DONE)},l.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;r(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;r(i)&&(e.remove(i),this.oldPrimitive=void 0)};var c=function(t,i){this._primitives=t,this._scene=i,this._solidBatches=new e,this._translucentBatches=new e};return c.prototype.add=function(e,t){var i,n,o=t.createOutlineGeometryInstance(e),a=this._scene.clampLineWidth(t.outlineWidth);255===o.attributes.color.value[3]?(i=this._solidBatches,n=i.get(a),r(n)||(n=new l(this._primitives,!1,a),i.set(a,n)),n.add(t,o)):(i=this._translucentBatches,n=i.get(a),r(n)||(n=new l(this._primitives,!0,a),i.set(a,n)),n.add(t,o))},c.prototype.remove=function(e){var t,i=this._solidBatches.values,r=i.length;for(t=0;r>t;t++)if(i[t].remove(e))return;var n=this._translucentBatches.values,o=n.length;for(t=0;o>t;t++)if(n[t].remove(e))return},c.prototype.update=function(e){var t,i,r,n,o,a=this._solidBatches.values,s=a.length,l=this._translucentBatches.values,u=l.length,c=!0,h=!1;do{for(h=!1,i=0;s>i;i++){n=a[i],c=n.update(e),o=n.itemsToRemove;var d=o.length;if(d>0)for(h=!0,t=0;d>t;t++)r=o[t],n.remove(r),this.add(e,r)}for(i=0;u>i;i++){n=l[i],c=n.update(e),o=n.itemsToRemove;var p=o.length;if(p>0)for(h=!0,t=0;p>t;t++)r=o[t],n.remove(r),this.add(e,r)}}while(h);return c},c.prototype.getBoundingSphere=function(e,t){var i,r=this._solidBatches.values,n=r.length;for(i=0;n>i;i++){var o=r[i];if(o.contains(e))return o.getBoundingSphere(e,t)}var a=this._translucentBatches.values,l=a.length;for(i=0;l>i;i++){var u=a[i];if(u.contains(e))return u.getBoundingSphere(e,t)}return s.FAILED},c.prototype.removeAllPrimitives=function(){var e,t=this._solidBatches.values,i=t.length;for(e=0;i>e;e++)t[e].removeAllPrimitives();var r=this._translucentBatches.values,n=r.length;for(e=0;n>e;e++)r[e].removeAllPrimitives()},c}),i("DataSources/GeometryVisualizer",["../Core/AssociativeArray","../Core/BoundingSphere","../Core/defined","../Core/destroyObject","../Core/DeveloperError","./BoundingSphereState","./ColorMaterialProperty","./StaticGeometryColorBatch","./StaticGeometryPerMaterialBatch","./StaticOutlineGeometryBatch"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e,t){for(var i=e._batches,r=i.length,n=0;r>n;n++)i[n].remove(t)}function h(e,t,i){return i.isDynamic?(e._dynamicBatch.add(t,i),void 0):(i.outlineEnabled&&e._outlineBatch.add(t,i),i.fillEnabled&&(i.isClosed?i.fillMaterialProperty instanceof a?e._closedColorBatch.add(t,i):e._closedMaterialBatch.add(t,i):i.fillMaterialProperty instanceof a?e._openColorBatch.add(t,i):e._openMaterialBatch.add(t,i)),void 0)}var d=[],p=function(t){this._primitives=t,this._dynamicUpdaters=new e};p.prototype.add=function(e,t){this._dynamicUpdaters.set(t.entity.id,t.createDynamicUpdater(this._primitives))},p.prototype.remove=function(e){var t=e.entity.id,r=this._dynamicUpdaters.get(t);i(r)&&(this._dynamicUpdaters.remove(t),r.destroy())},p.prototype.update=function(e){for(var t=this._dynamicUpdaters.values,i=0,r=t.length;r>i;i++)t[i].update(e);return!0},p.prototype.removeAllPrimitives=function(){for(var e=this._dynamicUpdaters.values,t=0,i=e.length;i>t;t++)e[t].destroy();this._dynamicUpdaters.removeAll()},p.prototype.getBoundingSphere=function(e,t){var r=this._dynamicUpdaters.get(e.id);return i(r)&&i(r.getBoundingSphere)?r.getBoundingSphere(e,t):o.FAILED};var m=function(t,i,r){this._type=t;var n=i.primitives;this._scene=i,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new e,this._removedObjects=new e,this._changedObjects=new e,this._outlineBatch=new u(n,i),this._closedColorBatch=new s(n,t.perInstanceColorAppearanceType,!0),this._closedMaterialBatch=new l(n,t.materialAppearanceType,!0),this._openColorBatch=new s(n,t.perInstanceColorAppearanceType,!1),this._openMaterialBatch=new l(n,t.materialAppearanceType,!1),this._dynamicBatch=new p(n),this._batches=[this._closedColorBatch,this._closedMaterialBatch,this._openColorBatch,this._openMaterialBatch,this._dynamicBatch,this._outlineBatch],this._subscriptions=new e,this._updaters=new e,this._entityCollection=r,r.collectionChanged.addEventListener(m.prototype._onCollectionChanged,this),this._onCollectionChanged(r,r.values,d)};m.prototype.update=function(e){var t,i,r,n,o=this._addedObjects,a=o.values,s=this._removedObjects,l=s.values,u=this._changedObjects,d=u.values;for(t=d.length-1;t>-1;t--)i=d[t],r=i.id,n=this._updaters.get(r),n.entity===i?(c(this,n),h(this,e,n)):(l.push(i),a.push(i));for(t=l.length-1;t>-1;t--)i=l[t],r=i.id,n=this._updaters.get(r),c(this,n),n.destroy(),this._updaters.remove(r),this._subscriptions.get(r)(),this._subscriptions.remove(r);for(t=a.length-1;t>-1;t--)i=a[t],r=i.id,n=new this._type(i,this._scene),this._updaters.set(r,n),h(this,e,n),this._subscriptions.set(r,n.geometryChanged.addEventListener(m._onGeometryChanged,this));o.removeAll(),s.removeAll(),u.removeAll();var p=!0,f=this._batches,v=f.length;for(t=0;v>t;t++)p=f[t].update(e)&&p;return p};var f=[],v=new t;return m.prototype.getBoundingSphere=function(e,i){for(var r=f,n=v,a=0,s=o.DONE,l=this._batches,u=l.length,c=0;u>c;c++){if(s=l[c].getBoundingSphere(e,n),s===o.PENDING)return o.PENDING;s===o.DONE&&(r[a]=t.clone(n,r[a]),a++)}return 0===a?o.FAILED:(r.length=a,t.fromBoundingSpheres(r,i),o.DONE)},m.prototype.isDestroyed=function(){return!1},m.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(m.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();var e,t=this._batches,i=t.length;for(e=0;i>e;e++)t[e].removeAllPrimitives();var n=this._subscriptions.values;for(i=n.length,e=0;i>e;e++)n[e]();return this._subscriptions.removeAll(),r(this)},m._onGeometryChanged=function(e){var t=this._removedObjects,r=this._changedObjects,n=e.entity,o=n.id;i(t.get(o))||i(r.get(o))||r.set(o,n)},m.prototype._onCollectionChanged=function(e,t,i){var r,n,o,a=this._addedObjects,s=this._removedObjects,l=this._changedObjects;for(r=i.length-1;r>-1;r--)o=i[r],n=o.id,a.remove(n)||(s.set(n,o),l.remove(n));for(r=t.length-1;r>-1;r--)o=t[r],n=o.id,s.remove(n)?l.set(n,o):a.set(n,o)},m}),i("Scene/Label",["../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/NearFarScalar","./Billboard","./HeightReference","./HorizontalOrigin","./LabelStyle","./VerticalOrigin"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";function p(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function m(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}var f=function(n,o){n=r(n,r.EMPTY_OBJECT),this._text=r(n.text,""),this._show=r(n.show,!0),this._font=r(n.font,"30px sans-serif"),this._fillColor=i.clone(r(n.fillColor,i.WHITE)),this._outlineColor=i.clone(r(n.outlineColor,i.BLACK)),this._outlineWidth=r(n.outlineWidth,1),this._style=r(n.style,h.FILL),this._verticalOrigin=r(n.verticalOrigin,d.BOTTOM),this._horizontalOrigin=r(n.horizontalOrigin,c.LEFT),this._pixelOffset=e.clone(r(n.pixelOffset,e.ZERO)),this._eyeOffset=t.clone(r(n.eyeOffset,t.ZERO)),this._position=t.clone(r(n.position,t.ZERO)),this._scale=r(n.scale,1),this._id=n.id,this._translucencyByDistance=n.translucencyByDistance,this._pixelOffsetScaleByDistance=n.pixelOffsetScaleByDistance,this._heightReference=r(n.heightReference,u.NONE),this._labelCollection=o,this._glyphs=[],this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._updateClamping()};return o(f.prototype,{show:{get:function(){return this._show},set:function(e){if(this._show!==e){this._show=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.show=e)}}}},position:{get:function(){return this._position},set:function(e){var i=this._position;if(!t.equals(i,e))if(t.clone(e,i),this._heightReference===u.NONE)for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.position=e)}else this._updateClamping()}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightReference=e,this._updateClamping())}},text:{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,p(this))}},font:{get:function(){return this._font},set:function(e){this._font!==e&&(this._font=e,p(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){var t=this._fillColor;i.equals(t,e)||(i.clone(e,t),p(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;i.equals(t,e)||(i.clone(e,t),p(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,p(this))}},style:{get:function(){return this._style},set:function(e){this._style!==e&&(this._style=e,p(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(t){var i=this._pixelOffset;if(!e.equals(i,t)){e.clone(t,i);for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.pixelOffset=t)}}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;if(!s.equals(t,e)){this._translucencyByDistance=s.clone(e,t);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.translucencyByDistance=e)}}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){var t=this._pixelOffsetScaleByDistance;if(!s.equals(t,e)){this._pixelOffsetScaleByDistance=s.clone(e,t);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.pixelOffsetScaleByDistance=e)}}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){var i=this._eyeOffset;if(!t.equals(i,e)){t.clone(e,i);for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.eyeOffset=e)}}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,m(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(this._verticalOrigin!==e){this._verticalOrigin=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.verticalOrigin=e)}m(this)}}},scale:{get:function(){return this._scale},set:function(e){if(this._scale!==e){this._scale=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.scale=e)}m(this)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.id=e)}}}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=t.clone(e,this._actualClampedPosition);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.position=e)}}}}),f.prototype._updateClamping=function(){l._updateClamping(this._labelCollection,this)},f.prototype.computeScreenSpacePosition=function(t,i){n(i)||(i=new e);var r=this._labelCollection,o=r.modelMatrix,a=l._computeActualPosition(this,this._position,t.frameState,o),s=l._computeScreenSpacePosition(o,a,this._eyeOffset,this._pixelOffset,t,i);return s.y=t.canvas.clientHeight-s.y,s},f.prototype.equals=function(r){return this===r||n(r)&&this._show===r._show&&this._scale===r._scale&&this._style===r._style&&this._verticalOrigin===r._verticalOrigin&&this._horizontalOrigin===r._horizontalOrigin&&this._text===r._text&&this._font===r._font&&t.equals(this._position,r._position)&&i.equals(this._fillColor,r._fillColor)&&i.equals(this._outlineColor,r._outlineColor)&&e.equals(this._pixelOffset,r._pixelOffset)&&t.equals(this._eyeOffset,r._eyeOffset)&&s.equals(this._translucencyByDistance,r._translucencyByDistance)&&s.equals(this._pixelOffsetScaleByDistance,r._pixelOffsetScaleByDistance)&&this._id===r._id},f.prototype.isDestroyed=function(){return!1},f}),i("Scene/LabelCollection",["../Core/Cartesian2","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Core/writeTextToCanvas","./BillboardCollection","./HorizontalOrigin","./Label","./LabelStyle","./TextureAtlas","./VerticalOrigin"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function f(e,t,i){this.labelCollection=e,this.index=t,this.dimensions=i}function v(e,t,i,r,n,o,a){return S.font=t,S.fillColor=i,S.strokeColor=r,S.strokeWidth=n,S.textBaseline=a===p.BOTTOM?"bottom":a===p.TOP?"top":"middle",S.fill=o===h.FILL||o===h.FILL_AND_OUTLINE,S.stroke=o===h.OUTLINE||o===h.FILL_AND_OUTLINE,s(e,S)}function g(e,t){t.textureInfo=void 0,t.dimensions=void 0;var r=t.billboard;i(r)&&(r.show=!1,r.image=void 0,e._spareBillboards.push(r),t.billboard=void 0)}function _(e,t,i,r){e.addImage(t,i).then(function(e){r.index=e})}function y(e,t){var r,n,o,a=t._text,s=a.length,l=t._glyphs,c=l.length;if(c>s)for(n=s;c>n;++n)g(e,l[n]);l.length=s;var h=e._glyphTextureCache;for(o=0;s>o;++o){var d=a.charAt(o),p=t._font,y=t._fillColor,C=t._outlineColor,w=t._outlineWidth,S=t._style,E=t._verticalOrigin,b=JSON.stringify([d,p,y.toRgba(),C.toRgba(),w,+S,+E]),x=h[b];if(!i(x)){var T=v(d,p,y,C,w,S,E);x=new f(e,-1,T.dimensions),h[b]=x,T.width>0&&T.height>0&&_(e._textureAtlas,b,T,x)}if(r=l[o],i(r)?-1===x.index?g(e,r):i(r.textureInfo)&&(r.textureInfo=void 0):(r=new m,l[o]=r),r.textureInfo=x,r.dimensions=x.dimensions,-1!==x.index){var P=r.billboard;i(P)||(P=e._spareBillboards.length>0?e._spareBillboards.pop():e._billboardCollection.add({collection:e}),r.billboard=P),P.show=t._show,P.position=t._position,P.eyeOffset=t._eyeOffset,P.pixelOffset=t._pixelOffset,P.horizontalOrigin=u.LEFT,P.verticalOrigin=t._verticalOrigin,P.scale=t._scale,P.pickPrimitive=t,P.id=t._id,P.image=b,P.translucencyByDistance=t._translucencyByDistance,P.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance}}t._repositionAllGlyphs=!0}function C(e,t){var r,n,o=e._glyphs,a=0,s=0,l=0,c=o.length;for(l=0;c>l;++l)r=o[l],n=r.dimensions,a+=n.computedWidth,s=Math.max(s,n.height);var h=e._scale,d=e._horizontalOrigin,m=0;d===u.CENTER?m-=a/2*h:d===u.RIGHT&&(m-=a*h),E.x=m*t,E.y=0;var f=e._verticalOrigin;for(l=0;c>l;++l)r=o[l],n=r.dimensions,f===p.BOTTOM||n.height===s?E.y=-n.descent*h:f===p.TOP?E.y=-(s-n.height)*h-n.descent*h:f===p.CENTER&&(E.y=-(s-n.height)/2*h-n.descent*h),E.y*=t,i(r.billboard)&&r.billboard._setTranslate(E),E.x+=n.computedWidth*h*t}function w(e,t){for(var r=t._glyphs,o=0,a=r.length;a>o;++o)g(e,r[o]);t._labelCollection=void 0,i(t._removeCallbackFunc)&&t._removeCallbackFunc(),n(t)}var S={},E=new e,b=function(e){e=t(e,t.EMPTY_OBJECT),this._scene=e.scene,this._textureAtlas=void 0,this._billboardCollection=new l({scene:this._scene}),this._billboardCollection.destroyTextureAtlas=!1,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._resolutionScale=void 0,this.modelMatrix=a.clone(t(e.modelMatrix,a.IDENTITY)),this.debugShowBoundingVolume=t(e.debugShowBoundingVolume,!1)};return r(b.prototype,{length:{get:function(){return this._labels.length}}}),b.prototype.add=function(e){var t=new c(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t},b.prototype.remove=function(e){if(i(e)&&e._labelCollection===this){var t=this._labels.indexOf(e);if(-1!==t)return this._labels.splice(t,1),w(this,e),!0}return!1},b.prototype.removeAll=function(){for(var e=this._labels,t=0,i=e.length;i>t;++t)w(this,e[t]);e.length=0},b.prototype.contains=function(e){return i(e)&&e._labelCollection===this},b.prototype.get=function(e){return this._labels[e]},b.prototype.update=function(e,t,r){var n=this._billboardCollection;n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume,i(this._textureAtlas)||(this._textureAtlas=new d({context:e}),n.textureAtlas=this._textureAtlas);var o=e.uniformState,a=o.resolutionScale,s=this._resolutionScale!==a;this._resolutionScale=a;var l;l=s?this._labels:this._labelsToUpdate;for(var u=l.length,c=0;u>c;++c){var h=l[c];if(!h.isDestroyed()){var p=h._glyphs.length;h._rebindAllGlyphs&&(y(this,h),h._rebindAllGlyphs=!1),(s||h._repositionAllGlyphs)&&(C(h,a),h._repositionAllGlyphs=!1);var m=h._glyphs.length-p;this._totalGlyphCount+=m}}this._labelsToUpdate.length=0,n.update(e,t,r)},b.prototype.isDestroyed=function(){return!1},b.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),n(this)},b}),i("DataSources/LabelVisualizer",["../Core/AssociativeArray","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/NearFarScalar","../Scene/HorizontalOrigin","../Scene/LabelCollection","../Scene/LabelStyle","../Scene/VerticalOrigin","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e,t){if(n(e)){var i=e.label;n(i)&&(t.push(e.index),i.show=!1,e.label=void 0,e.index=-1)}}var f=1,v="30px sans-serif",g=c.FILL,_=r.WHITE,y=r.BLACK,C=1,w=t.ZERO,S=i.ZERO,E=l.CENTER,b=h.CENTER,x=new i,T=new r,P=new r,A=new i,D=new t,M=new s,I=new s,O=function(e){this.entity=e,this.label=void 0,this.index=void 0},R=function(t,i){i.collectionChanged.addEventListener(R.prototype._onCollectionChanged,this),this._scene=t,this._unusedIndexes=[],this._labelCollection=void 0,this._entityCollection=i,this._items=new e,this._onCollectionChanged(i,i.values,[],[])};return R.prototype.update=function(e){for(var t=this._items.values,i=this._unusedIndexes,r=0,o=t.length;o>r;r++){var a,s=t[r],l=s.entity,c=l._label,h=s.label,d=l.isShowing&&l.isAvailable(e)&&p.getValueOrDefault(c._show,e,!0);if(d&&(x=p.getValueOrUndefined(l._position,e,x),a=p.getValueOrUndefined(c._text,e),d=n(x)&&n(a)),d){if(!n(h)){var O=this._labelCollection;n(O)||(O=new u,this._labelCollection=O,this._scene.primitives.add(O));var R=i.length;if(R>0){var L=i.pop();s.index=L,h=O.get(L)}else h=O.add(),s.index=O.length-1;h.id=l,s.label=h}h.show=!0,h.position=x,h.text=a,h.scale=p.getValueOrDefault(c._scale,e,f),h.font=p.getValueOrDefault(c._font,e,v),h.style=p.getValueOrDefault(c._style,e,g),h.fillColor=p.getValueOrDefault(c._fillColor,e,_,T),h.outlineColor=p.getValueOrDefault(c._outlineColor,e,y,P),h.outlineWidth=p.getValueOrDefault(c._outlineWidth,e,C),h.pixelOffset=p.getValueOrDefault(c._pixelOffset,e,w,D),h.eyeOffset=p.getValueOrDefault(c._eyeOffset,e,S,A),h.horizontalOrigin=p.getValueOrDefault(c._horizontalOrigin,e,E),h.verticalOrigin=p.getValueOrDefault(c._verticalOrigin,e,b),h.translucencyByDistance=p.getValueOrUndefined(c._translucencyByDistance,e,M),h.pixelOffsetScaleByDistance=p.getValueOrUndefined(c._pixelOffsetScaleByDistance,e,I)}else m(s,i)}return!0},R.prototype.getBoundingSphere=function(e,t){var r=this._items.get(e.id);return n(r)&&n(r.label)?(t.center=i.clone(r.label.position,t.center),t.radius=0,d.DONE):d.FAILED},R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){return this._entityCollection.collectionChanged.removeEventListener(R.prototype._onCollectionChanged,this),n(this._labelCollection)&&this._scene.primitives.remove(this._labelCollection),o(this)},R.prototype._onCollectionChanged=function(e,t,i,r){var o,a,s=this._unusedIndexes,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],n(a._label)&&n(a._position)&&l.set(a.id,new O(a));for(o=r.length-1;o>-1;o--)a=r[o],n(a._label)&&n(a._position)?l.contains(a.id)||l.set(a.id,new O(a)):(m(l.get(a.id),s),l.remove(a.id));for(o=i.length-1;o>-1;o--)a=i[o],m(l.get(a.id),s),l.remove(a.id)},R}),i("ThirdParty/gltfDefaults",["../Core/defaultValue","../Core/defined"],function(e,t){"use strict";function i(i){t(i.accessors)||(i.accessors={});var r=i.accessors;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];o.byteStride=e(o.byteStride,0)}}function r(i){t(i.animations)||(i.animations={});var r=i.animations;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];t(o.channels)||(o.channels=[]),t(o.parameters)||(o.parameters={}),t(o.samplers)||(o.samplers={});var a=r.samplers;for(var s in a)if(a.hasOwnProperty(s)){var l=a[s];l.interpolation=e(l.interpolation,"LINEAR")}}}function n(i){t(i.asset)||(i.asset={});var r=i.asset;t(r.profile)&&"string"!=typeof r.profile||(r.profile={});var n=r.profile;r.premultipliedAlpha=e(i.asset.premultipliedAlpha,!1),n.api=e(n.api,"WebGL"),n.version=e(n.version,"1.0.2"),r.version=e(i.version,"0.9")}function o(i){t(i.buffers)||(i.buffers={});var r=i.buffers;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];o.type=e(o.type,"arraybuffer")}}function a(e){t(e.bufferViews)||(e.bufferViews={})}function s(e){t(e.cameras)||(e.cameras={})}function l(e){t(e.images)||(e.images={})}function u(i){t(i.lights)||(i.lights={});var r=i.lights;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];if("ambient"===o.type){t(o.ambient)||(o.ambient={});var a=o.ambient;t(a.color)||(a.color=[1,1,1])}else if("directional"===o.type){t(o.directional)||(o.directional={});var s=o.directional;t(s.color)||(s.color=[1,1,1])}else if("point"===o.type){t(o.point)||(o.point={});var l=o.point;t(l.color)||(l.color=[1,1,1]),l.constantAttenuation=e(l.constantAttenuation,1),l.linearAttenuation=e(l.linearAttenuation,0),l.quadraticAttenuation=e(l.quadraticAttenuation,0)}else if("spot"===o.type){t(o.spot)||(o.spot={});var u=o.spot;t(u.color)||(u.color=[1,1,1]),u.constantAttenuation=e(u.constantAttenuation,1),u.fallOffAngle=e(u.fallOffAngle,3.14159265),u.fallOffExponent=e(u.fallOffExponent,0),u.linearAttenuation=e(u.linearAttenuation,0),u.quadraticAttenuation=e(u.quadraticAttenuation,0)}}}function c(e){t(e.materials)||(e.materials={});var i=e.materials;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r].instanceTechnique;t(n.values)||(n.values={})}}function h(i){t(i.meshes)||(i.meshes={});var r=i.meshes;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];t(o.primitives)||(o.primitives=[]);for(var a=o.primitives.length,s=a.length,l=0;s>l;++l){var u=a[l];t(u.attributes)||(u.attributes={});var c=e(u.primitive,WebGLRenderingContext.TRIANGLES);u.mode=e(u.mode,c)}}}function d(e){t(e.nodes)||(e.nodes={});var i=e.nodes;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];t(n.children)||(n.children=[]),t(n.matrix)||(t(n.translation)&&t(n.rotation)&&t(n.scale)?(t(n.translation)||(n.translation=[0,0,0]),t(n.rotation)||(n.rotation=[1,0,0,0]),t(n.scale)||(n.scale=[1,1,1])):n.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}}function p(e){t(e.programs)||(e.programs={});var i=e.programs;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];t(n.attributes)||(n.attributes=[])}}function m(i){t(i.samplers)||(i.samplers={});var r=i.samplers;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];o.magFilter=e(o.magFilter,WebGLRenderingContext.LINEAR),o.minFilter=e(o.minFilter,WebGLRenderingContext.NEAREST_MIPMAP_LINEAR),o.wrapS=e(o.wrapS,WebGLRenderingContext.REPEAT),o.wrapT=e(o.wrapT,WebGLRenderingContext.REPEAT) -}}function f(e){t(e.scenes)||(e.scenes={});var i=e.scenes;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];t(n.node)||(n.node=[])}}function v(e){t(e.shaders)||(e.shaders={})}function g(e){t(e.skins)||(e.skins={});var i=e.skins;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];t(n.bindShapeMatrix)&&(n.bindShapeMatrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}}function _(e){t(e.enable)||(e.enable=[]),t(e.disable)||(e.disable=[])}function y(e){t(e.techniques)||(e.techniques={});var i=e.techniques;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];t(n.parameters)||(n.parameters={});var o=n.passes;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a],l=s.instanceProgram;t(l.attributes)||(l.attributes={}),t(l.uniforms)||(l.uniforms={}),t(s.states)||(s.states={}),_(s.states)}}}function C(i){t(i.textures)||(i.textures={});var r=i.textures;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];o.format=e(o.format,WebGLRenderingContext.RGBA),o.internalFormat=e(o.internalFormat,o.format),o.target=e(o.target,WebGLRenderingContext.TEXTURE_2D),o.type=e(o.type,WebGLRenderingContext.UNSIGNED_BYTE)}}var w=function(e){return t(e)?(t(e.allExtensions)||(e.allExtensions=[]),i(e),r(e),n(e),o(e),a(e),s(e),l(e),u(e),c(e),h(e),d(e),p(e),m(e),f(e),v(e),g(e),y(e),C(e),e):void 0};return w}),i("Scene/getModelAccessor",["../Core/ComponentDatatype"],function(e){"use strict";var t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},i=function(i){var r=i.componentType,n=t[i.type];return{componentsPerAttribute:n,createArrayBufferView:function(t,i,o){return e.createArrayBufferView(r,t,i,n*o)}}};return i}),i("Scene/ModelAnimationCache",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/LinearSpline","../Core/Matrix4","../Core/Quaternion","../Core/QuaternionSpline","./getModelAccessor"],function(e,t,i,r,n,o,a,s){"use strict";function l(e,i){var r=e.gltf,n=r.buffers,o=r.bufferViews,a=o[i.bufferView],l=n[a.buffer],u=a.byteOffset+i.byteOffset,c=i.count*s(i).componentsPerAttribute;return e.cacheKey+"//"+t(l.path,"")+"/"+u+"/"+c}function u(e,t,i){return e.cacheKey+"//"+t+"/"+i}var c=function(){},h={},d=new e;c.getAnimationParameterValues=function(t,r){var n=l(t,r),a=h[n];if(!i(a)){var u,c=t._loadResources,p=t.gltf,m=p.bufferViews,f=m[r.bufferView],v=r.componentType,g=r.type,_=r.count,y=c.getBuffer(f),C=s(r).createArrayBufferView(y.buffer,y.byteOffset+r.byteOffset,_);if(v===WebGLRenderingContext.FLOAT&&"SCALAR"===g)a=C;else if(v===WebGLRenderingContext.FLOAT&&"VEC3"===g)for(a=new Array(_),u=0;_>u;++u)a[u]=e.fromArray(C,3*u);else if(v===WebGLRenderingContext.FLOAT&&"VEC4"===g)for(a=new Array(_),u=0;_>u;++u){var w=4*u;a[u]=o.fromAxisAngle(e.fromArray(C,w,d),C[w+3])}i(t.cacheKey)&&(h[n]=a)}return a};var p={},m=function(e){this._value=e};m.prototype.evaluate=function(){return this._value},c.getAnimationSpline=function(e,t,n,o,s,l){var c=u(e,t,o),h=p[c];if(!i(h)){var d=l[s.input],f=e.gltf.accessors[n.parameters[s.output]],v=l[s.output];if(1===d.length&&1===v.length)h=new m(v[0]);else{var g=f.componentType,_=f.type;"LINEAR"===s.interpolation&&(g===WebGLRenderingContext.FLOAT&&"VEC3"===_?h=new r({times:d,points:v}):g===WebGLRenderingContext.FLOAT&&"VEC4"===_&&(h=new a({times:d,points:v})))}i(e.cacheKey)&&(p[c]=h)}return h};var f={};return c.getSkinInverseBindMatrices=function(e,t){var r=l(e,t),o=f[r];if(!i(o)){var a=e._loadResources,u=e.gltf,c=u.bufferViews,h=c[t.bufferView],d=t.componentType,p=t.type,m=t.count,v=a.getBuffer(h),g=s(t).createArrayBufferView(v.buffer,v.byteOffset+t.byteOffset,m);if(o=new Array(m),d===WebGLRenderingContext.FLOAT&&"MAT4"===p)for(var _=0;m>_;++_)o[_]=n.fromArray(g,16*_);f[r]=o}return o},c}),i("Scene/ModelAnimationLoop",["../Core/freezeObject"],function(e){"use strict";var t={NONE:0,REPEAT:1,MIRRORED_REPEAT:2};return e(t)}),i("Scene/ModelAnimationState",["../Core/freezeObject"],function(e){"use strict";return e({STOPPED:0,ANIMATING:1})}),i("Scene/ModelAnimation",["../Core/defaultValue","../Core/defineProperties","../Core/Event","../Core/JulianDate","./ModelAnimationLoop","./ModelAnimationState"],function(e,t,i,r,n,o){"use strict";var a=function(t,a,s){this._name=t.name,this._startTime=r.clone(t.startTime),this._delay=e(t.delay,0),this._stopTime=t.stopTime,this.removeOnStop=e(t.removeOnStop,!1),this._speedup=e(t.speedup,1),this._reverse=e(t.reverse,!1),this._loop=e(t.loop,n.NONE),this.start=new i,this.update=new i,this.stop=new i,this._state=o.STOPPED,this._runtimeAnimation=s,this._computedStartTime=void 0,this._duration=void 0;var l=this;this._raiseStartEvent=function(){l.start.raiseEvent(a,l)},this._updateEventTime=0,this._raiseUpdateEvent=function(){l.update.raiseEvent(a,l,l._updateEventTime)},this._raiseStopEvent=function(){l.stop.raiseEvent(a,l)}};return t(a.prototype,{name:{get:function(){return this._name}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},speedup:{get:function(){return this._speedup}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}}}),a}),i("Scene/ModelAnimationCollection",["../Core/clone","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/JulianDate","../Core/Math","./ModelAnimation","./ModelAnimationLoop","./ModelAnimationState"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e,t){for(var i=e.channelEvaluators,r=i.length,n=0;r>n;++n)i[n](t)}function d(e,t,i){return function(){e.animationRemoved.raiseEvent(t,i)}}var p=function(e){this.animationAdded=new o,this.animationRemoved=new o,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0};r(p.prototype,{length:{get:function(){return this._scheduledAnimations.length}}}),p.prototype.add=function(e){e=t(e,t.EMPTY_OBJECT);var i=this._model,r=i._runtime.animations,n=r[e.name],o=new l(e,i,n);return this._scheduledAnimations.push(o),this.animationAdded.raiseEvent(i,o),o},p.prototype.addAll=function(i){i=t(i,t.EMPTY_OBJECT),i=e(i);for(var r=[],n=this._model._animationIds,o=n.length,a=0;o>a;++a)i.name=n[a],r.push(this.add(i));return r},p.prototype.remove=function(e){if(i(e)){var t=this._scheduledAnimations,r=t.indexOf(e);if(-1!==r)return t.splice(r,1),this.animationRemoved.raiseEvent(this._model,e),!0}return!1},p.prototype.removeAll=function(){var e=this._model,t=this._scheduledAnimations,i=t.length;this._scheduledAnimations=[];for(var r=0;i>r;++r)this.animationRemoved.raiseEvent(e,t[r])},p.prototype.contains=function(e){return i(e)?-1!==this._scheduledAnimations.indexOf(e):!1},p.prototype.get=function(e){return this._scheduledAnimations[e]};var m=[];return p.prototype.update=function(e){if(a.equals(e.time,this._previousTime))return!1;this._previousTime=a.clone(e.time,this._previousTime);for(var r=!1,n=e.time,o=this._model,l=this._scheduledAnimations,p=l.length,f=0;p>f;++f){var v=l[f],g=v._runtimeAnimation;i(v._computedStartTime)||(v._computedStartTime=a.addSeconds(t(v.startTime,n),v.delay,new a)),i(v._duration)||(v._duration=g.stopTime*(1/v.speedup));var _=v._computedStartTime,y=v._duration,C=v.stopTime,w=0!==y?a.secondsDifference(n,_)/y:0,S=w>=0,E=S&&(1>=w||v.loop===u.REPEAT||v.loop===u.MIRRORED_REPEAT)&&(!i(C)||a.lessThanOrEquals(n,C));if(E){if(v._state===c.STOPPED&&(v._state=c.ANIMATING,v.start.numberOfListeners>0&&e.afterRender.push(v._raiseStartEvent)),v.loop===u.REPEAT)w-=Math.floor(w);else if(v.loop===u.MIRRORED_REPEAT){var b=Math.floor(w),x=w-b;w=1===b%2?1-x:x}v.reverse&&(w=1-w);var T=w*y*v.speedup;T=s.clamp(T,g.startTime,g.stopTime),h(g,T),v.update.numberOfListeners>0&&(v._updateEventTime=T,e.afterRender.push(v._raiseUpdateEvent)),r=!0}else S&&v._state===c.ANIMATING&&(v._state=c.STOPPED,v.stop.numberOfListeners>0&&e.afterRender.push(v._raiseStopEvent),v.removeOnStop&&m.push(v))}p=m.length;for(var P=0;p>P;++P){var A=m[P];l.splice(l.indexOf(A),1),e.afterRender.push(d(this,o,A))}return m.length=0,r},p}),i("Scene/ModelMaterial",["../Core/defined","../Core/defineProperties","../Core/DeveloperError"],function(e,t){"use strict";var i=function(e,t,i){this._name=t.name,this._id=i,this._uniformMap=e._uniformMaps[i]};return t(i.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}}}),i.prototype.setValue=function(e,t){var i=this._uniformMap.values[e];i.value=i.clone(t,i.value)},i.prototype.getValue=function(t){var i=this._uniformMap.values[t];return e(i)?i.value:void 0},i}),i("Scene/ModelMesh",["../Core/defineProperties"],function(e){"use strict";var t=function(e,t,i){for(var r=[],n=e.primitives,o=n.length,a=0;o>a;++a){var s=n[a];r[a]=t[s.material]}this._name=e.name,this._materials=r,this._id=i};return e(t.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),t}),i("Scene/ModelNode",["../Core/defaultValue","../Core/defineProperties","../Core/Matrix4"],function(e,t,i){"use strict";var r=function(e,t,r,n,o){this._model=e,this._runtimeNode=r,this._name=t.name,this._id=n,this.useMatrix=!1,this._show=!0,this._matrix=i.clone(o)};return t(r.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,this._model._perNodeShowDirty=!0)}},matrix:{get:function(){return this._matrix},set:function(e){this._matrix=i.clone(e,this._matrix),this.useMatrix=!0;var t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}}}),r.prototype.setMatrix=function(e){i.clone(e,this._matrix)},r}),i("Scene/Model",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/clone","../Core/combine","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/getStringFromTypedArray","../Core/IndexDatatype","../Core/loadArrayBuffer","../Core/loadImage","../Core/loadImageFromTypedArray","../Core/loadText","../Core/Math","../Core/Matrix2","../Core/Matrix3","../Core/Matrix4","../Core/PrimitiveType","../Core/Quaternion","../Core/Queue","../Core/RuntimeError","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/ShaderSource","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../ThirdParty/gltfDefaults","../ThirdParty/Uri","../ThirdParty/when","./getModelAccessor","./ModelAnimationCache","./ModelAnimationCollection","./ModelMaterial","./ModelMesh","./ModelNode","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B,z,k,V,U){"use strict";function W(){this.buffersToCreate=new b,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new b,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new b,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new b,this.pendingBufferViewToImage=0,this.createSamplers=!0,this.createSkins=!0,this.createRuntimeAnimations=!0,this.createVertexArrays=!0,this.createRenderStates=!0,this.createUniformMaps=!0,this.createRuntimeNodes=!0,this.skinnedNodesNames=[]}function G(e,t){e._cachedGltf=t,e._animationIds=H(t)}function H(e){var t=[];if(s(e)&&s(e.gltf)){var i=e.gltf.animations;for(var r in i)i.hasOwnProperty(r)&&t.push(r)}return t}function q(e){var t="",i=e.lastIndexOf("/");return-1!==i&&(t=e.substring(0,i+1)),t}function j(e){var t=new O(document.location.href),i=new O(e);return i.resolve(t).toString()}function Y(e,t,i){return e.subarray(t,t+i)}function X(e){return e.byteLength<4?!1:"glTF"===d(e.subarray(0,4))}function Z(e){if(!X(e))throw new c("bgltf is not a valid Binary glTF file.");var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;i+=hi,i+=hi,i+=hi;var r=t.getUint32(i,!0);i+=hi;var n=t.getUint32(i,!0);i+=hi;var o=d(Y(e,r,n));return JSON.parse(o)}function J(e,t,i){return e._runtime[t][i]}function Q(t){for(var r=t.nodes,n=t.meshes,o=t.accessors,l=t.scenes[t.scene].nodes,u=l.length,c=[],h=new i(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),d=new i(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),p=0;u>p;++p){var m=r[l[p]];for(m._transformToRoot=st(m),c.push(m);c.length>0;){m=c.pop();var f=m._transformToRoot,v=a(m.meshes,s(m.instanceSkin)?m.instanceSkin.meshes:void 0);if(s(v))for(var g=v.length,_=0;g>_;++_)for(var y=n[v[_]].primitives,C=y.length,S=0;C>S;++S){var E=y[S].attributes.POSITION;if(s(E)){var b=o[E],x=i.fromArray(b.min,0,di),T=i.fromArray(b.max,0,pi);s(h)&&s(d)&&(w.multiplyByPoint(f,x,x),w.multiplyByPoint(f,T,T),i.minimumByComponent(h,x,h),i.maximumByComponent(d,T,d))}}for(var P=m.children,A=P.length,D=0;A>D;++D){var M=r[P[D]];M._transformToRoot=st(M),w.multiplyTransformation(f,M._transformToRoot,M._transformToRoot),c.push(M)}delete m._transformToRoot}}var I=e.fromCornerPoints(h,d);return e.transformWithoutScale(I,ni,I)}function K(e,t,i){return function(){e._loadError=new x("Failed to load "+t+": "+i),e._state=ai.FAILED}}function $(e,t){return function(i){var r=e._loadResources;r.buffers[t]=new Uint8Array(i),--r.pendingBufferLoads}}function et(e){var t=e.gltf.buffers;for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if("CESIUM_binary_glTF"===i){var n=e._loadResources;n.buffers[i]=e._cachedGltf.bgltf}else if("arraybuffer"===r.type){++e._loadResources.pendingBufferLoads;var o=new O(r.uri),a=o.resolve(e._baseUri).toString();m(a).then($(e,i)).otherwise(K(e,"buffer",a))}else"text"===r.type}}function tt(e){var t=e.gltf.bufferViews;for(var i in t)t.hasOwnProperty(i)&&t[i].target===WebGLRenderingContext.ARRAY_BUFFER&&e._loadResources.buffersToCreate.enqueue(i)}function it(e,t){return function(i){var r=e._loadResources;r.shaders[t]={source:i,bufferView:void 0},--r.pendingShaderLoads}}function rt(e){var t=e.gltf.shaders;for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if(s(r.extensions)&&s(r.extensions.CESIUM_binary_glTF))e._loadResources.shaders[i]={source:void 0,bufferView:r.extensions.CESIUM_binary_glTF.bufferView};else{++e._loadResources.pendingShaderLoads;var n=new O(r.uri),o=n.resolve(e._baseUri).toString();g(o).then(it(e,i)).otherwise(K(e,"shader",o))}}}function nt(e){var t=e.gltf.programs;for(var i in t)t.hasOwnProperty(i)&&e._loadResources.programsToCreate.enqueue(i)}function ot(e,t){return function(i){var r=e._loadResources;--r.pendingTextureLoads,r.texturesToCreate.enqueue({name:t,image:i,bufferView:void 0})}}function at(e){var t=e.gltf.images,i=e.gltf.textures;for(var r in i)if(i.hasOwnProperty(r)){var n=t[i[r].source];if(s(n.extensions)&&s(n.extensions.CESIUM_binary_glTF)){var o=n.extensions.CESIUM_binary_glTF;e._loadResources.texturesToCreateFromBufferView.enqueue({name:r,image:void 0,bufferView:o.bufferView,mimeType:o.mimeType})}else{++e._loadResources.pendingTextureLoads;var a=new O(n.uri),l=a.resolve(e._baseUri).toString();f(l).then(ot(e,r)).otherwise(K(e,"image",l))}}}function st(e){if(s(e.matrix))return w.fromArray(e.matrix);var t=i.fromArray(e.rotation,0,mi);return w.fromTranslationQuaternionRotationScale(i.fromArray(e.translation,0,fi),E.fromAxisAngle(t,e.rotation[3],vi),i.fromArray(e.scale,0,gi))}function lt(e){var t={},i={},r=[],n=e._loadResources.skinnedNodesNames,o=e.gltf.nodes;for(var a in o)if(o.hasOwnProperty(a)){var l=o[a],u={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new w,computedMatrix:new w,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:l.jointName,children:[],parents:[],publicNode:void 0};u.publicNode=new k(e,l,u,a,st(l)),t[a]=u,i[l.name]=u,s(l.instanceSkin)&&(n.push(a),r.push(u))}e._runtime.nodes=t,e._runtime.nodesByName=i,e._runtime.skinnedNodes=r}function ut(e){var t={},i={},r=e.gltf.materials,n=e._uniformMaps;for(var o in r)if(r.hasOwnProperty(o)){n[o]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0};var a=r[o],s=new B(e,a,o);t[a.name]=s,i[o]=s}e._runtime.materialsByName=t,e._runtime.materialsById=i}function ct(e){var t={},i=e._runtime.materialsById,r=e.gltf.meshes;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];t[o.name]=new z(o,i,n)}e._runtime.meshesByName=t}function ht(e){e._loadRendererResourcesFromCache||(et(e),tt(e),rt(e),nt(e),at(e)),ut(e),ct(e),lt(e)}function dt(e,t){var i=e._loadResources;if(0===i.pendingBufferLoads){for(var r,n=e.gltf.bufferViews,o=e._rendererResources.buffers;i.buffersToCreate.length>0;){var a=i.buffersToCreate.dequeue();r=n[a];var l=t.createVertexBuffer(i.getBuffer(r),T.STATIC_DRAW);l.vertexArrayDestroyable=!1,o[a]=l}var u=e.gltf.accessors;for(var c in u)if(u.hasOwnProperty(c)){var h=u[c];if(r=n[h.bufferView],r.target===WebGLRenderingContext.ELEMENT_ARRAY_BUFFER&&!s(o[h.bufferView])){var d=t.createIndexBuffer(i.getBuffer(r),T.STATIC_DRAW,h.componentType);d.vertexArrayDestroyable=!1,o[h.bufferView]=d}}}}function pt(e){for(var t={},i=e.length,r=0;i>r;++r)t[e[r]]=r;return t}function mt(e,t){if(s(t.source))return t.source;var i=e._loadResources,r=e.gltf,n=r.bufferViews[t.bufferView];return d(i.getBuffer(n))}function ft(e,t,i){var r=t.gltf.programs,n=t._loadResources.shaders,o=r[e],a=pt(o.attributes),s=mt(t,n[o.vertexShader]),l=mt(t,n[o.fragmentShader]);if(t._rendererResources.programs[e]=i.createShaderProgram(s,l,a),t.allowPicking){var u=new A({sources:[l],pickColorQualifier:"uniform"});t._rendererResources.pickPrograms[e]=i.createShaderProgram(s,u,a)}}function vt(e,t){var i,r=e._loadResources;if(0===r.pendingShaderLoads&&0===r.pendingBufferLoads)if(e.asynchronous)r.programsToCreate.length>0&&(i=r.programsToCreate.dequeue(),ft(i,e,t));else for(;r.programsToCreate.length>0;)i=r.programsToCreate.dequeue(),ft(i,e,t)}function gt(e,t){return function(i){e.texturesToCreate.enqueue({name:t.name,image:i,bufferView:void 0}),--e.pendingBufferViewToImage}}function _t(e){var t=e._loadResources;if(0===t.pendingBufferLoads)for(;t.texturesToCreateFromBufferView.length>0;){var i=t.texturesToCreateFromBufferView.dequeue(),r=e.gltf,n=r.bufferViews[i.bufferView],o=gt(t,i),a=K(e,"image","name: "+i.name+", bufferView: "+i.bufferView);v(t.getBuffer(n),i.mimeType).then(o).otherwise(a),++t.pendingBufferViewToImage}}function yt(e,t){var i=e._loadResources;if(i.createSamplers){i.createSamplers=!1;var r=e._rendererResources.samplers,n=e.gltf.samplers;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];r[o]=t.createSampler({wrapS:a.wrapS,wrapT:a.wrapT,minificationFilter:a.minFilter,magnificationFilter:a.magFilter})}}}function Ct(e,t,i){var r=t.gltf.textures,n=r[e.name],o=t._rendererResources.samplers,a=o[n.sampler],s=a.minificationFilter===D.NEAREST_MIPMAP_NEAREST||a.minificationFilter===D.NEAREST_MIPMAP_LINEAR||a.minificationFilter===D.LINEAR_MIPMAP_NEAREST||a.minificationFilter===D.LINEAR_MIPMAP_LINEAR,l=s||a.wrapS===M.REPEAT||a.wrapS===M.MIRRORED_REPEAT||a.wrapT===M.REPEAT||a.wrapT===M.MIRRORED_REPEAT,u=e.image,c=!_.isPowerOfTwo(u.width)||!_.isPowerOfTwo(u.height);if(l&&c){var h=document.createElement("canvas");h.width=_.nextPowerOfTwo(u.width),h.height=_.nextPowerOfTwo(u.height);var d=h.getContext("2d");d.drawImage(u,0,0,u.width,u.height,0,0,h.width,h.height),u=h}var p;n.target===WebGLRenderingContext.TEXTURE_2D&&(p=i.createTexture2D({source:u,pixelFormat:n.internalFormat,pixelDatatype:n.type,flipY:!1})),s&&p.generateMipmap(),p.sampler=a,t._rendererResources.textures[e.name]=p}function wt(e,t){var i,r=e._loadResources;if(e.asynchronous)r.texturesToCreate.length>0&&(i=r.texturesToCreate.dequeue(),Ct(i,e,t));else for(;r.texturesToCreate.length>0;)i=r.texturesToCreate.dequeue(),Ct(i,e,t)}function St(e,t){var i=e.gltf;i.programs;var r=i.techniques,n=i.materials,o={},a=r[n[t.material].instanceTechnique.technique],s=a.parameters,l=a.passes[a.pass],u=l.instanceProgram,c=u.attributes,h=e._rendererResources.programs[u.program].vertexAttributes;for(var d in h)if(h.hasOwnProperty(d)){var p=s[c[d]];o[p.semantic]=h[d].index}return o}function Et(e,t){for(var i=e.length,r=0;i>r;++r)for(var n=[e[r]];n.length>0;){var o=n.pop();if(o.jointName===t)return o;for(var a=o.children,s=a.length,l=0;s>l;++l)n.push(a[l])}return void 0}function bt(e,t){for(var i=e.gltf,r=i.skins,n=i.nodes,o=e._runtime.nodes,a=e._loadResources.skinnedNodesNames,s=a.length,l=0;s>l;++l){var u=a[l],c=o[u],h=n[u].instanceSkin,d=t[h.skin];c.inverseBindMatrices=d.inverseBindMatrices,c.bindShapeMatrix=d.bindShapeMatrix;for(var p=[],m=h.skeletons,f=m.length,v=0;f>v;++v)p.push(o[m[v]]);for(var g=r[h.skin].jointNames,_=g.length,y=0;_>y;++y){var C=g[y];c.joints.push(Et(p,C))}}}function xt(e){var t=e._loadResources;if(0===t.pendingBufferLoads&&t.createSkins){t.createSkins=!1;var i=e.gltf,r=i.accessors,n=i.skins,o={};for(var a in n)if(n.hasOwnProperty(a)){var s,l=n[a],u=r[l.inverseBindMatrices];w.equals(l.bindShapeMatrix,w.IDENTITY)||(s=w.clone(l.bindShapeMatrix)),o[a]={inverseBindMatrices:N.getSkinInverseBindMatrices(e,u),bindShapeMatrix:s}}bt(e,o)}}function Tt(e,t,i,r){return function(n){t[i]=r.evaluate(n,t[i]),t.dirtyNumber=e._maxDirtyNumber}}function Pt(e){var t=e._loadResources;if(t.finishedPendingLoads()&&t.createRuntimeAnimations){t.createRuntimeAnimations=!1,e._runtime.animations={};var i,r=e._runtime.nodes,n=e.gltf.animations,o=e.gltf.accessors;for(var a in n)if(n.hasOwnProperty(a)){var s=n[a],l=s.channels,u=s.parameters,c=s.samplers,h={};for(i in u)u.hasOwnProperty(i)&&(h[i]=N.getAnimationParameterValues(e,o[u[i]]));for(var d=Number.MAX_VALUE,p=-Number.MAX_VALUE,m=l.length,f=new Array(m),v=0;m>v;++v){var g=l[v],_=g.target,y=c[g.sampler],C=h[y.input];d=Math.min(d,C[0]),p=Math.max(p,C[C.length-1]);var w=N.getAnimationSpline(e,a,s,g.sampler,y,h);f[v]=Tt(e,r[_.id],_.path,w)}e._runtime.animations[a]={startTime:d,stopTime:p,channelEvaluators:f}}}}function At(e,t){var i=e._loadResources;if(i.finishedBuffersCreation()&&i.finishedProgramCreation()&&i.createVertexArrays){i.createVertexArrays=!1;var r=e._rendererResources.buffers,n=e._rendererResources.vertexArrays,o=e.gltf,a=o.accessors,l=o.meshes;for(var u in l)if(l.hasOwnProperty(u))for(var c=l[u].primitives,h=c.length,d=0;h>d;++d){var p=c[d],m=St(e,p),f=[],v=p.attributes;for(var g in v)if(v.hasOwnProperty(g)){var _=m[g];if(s(_)){var y=a[v[g]];f.push({index:_,vertexBuffer:r[y.bufferView],componentsPerAttribute:L(y).componentsPerAttribute,componentDatatype:y.componentType,normalize:!1,offsetInBytes:y.byteOffset,strideInBytes:y.byteStride})}}var C=a[p.indices],w=r[C.bufferView];n[u+".primitive."+d]=t.createVertexArray(f,w)}}}function Dt(e){var t={};t[WebGLRenderingContext.BLEND]=!1,t[WebGLRenderingContext.CULL_FACE]=!1,t[WebGLRenderingContext.DEPTH_TEST]=!1,t[WebGLRenderingContext.POLYGON_OFFSET_FILL]=!1,t[WebGLRenderingContext.SCISSOR_TEST]=!1;var i,r=e.enable,n=r.length;for(i=0;n>i;++i)t[r[i]]=!0;return t}function Mt(e,t){var i=e._loadResources;if(i.createRenderStates){i.createRenderStates=!1;var r=e._rendererResources.renderStates,n=e.gltf.techniques;for(var o in n)if(n.hasOwnProperty(o)){var l=n[o],u=l.passes[l.pass],c=u.states,h=Dt(c),d=a(c.functions,a.EMPTY_OBJECT),p=a(d.blendColor,[0,0,0,0]),m=a(d.blendEquationSeparate,[WebGLRenderingContext.FUNC_ADD,WebGLRenderingContext.FUNC_ADD]),f=a(d.blendFuncSeparate,[WebGLRenderingContext.ONE,WebGLRenderingContext.ONE,WebGLRenderingContext.ZERO,WebGLRenderingContext.ZERO]),v=a(d.colorMask,[!0,!0,!0,!0]),g=a(d.depthRange,[0,1]),_=a(d.polygonOffset,[0,0]),y=a(d.scissor,[0,0,0,0]);r[o]=t.createRenderState({frontFace:s(d.frontFace)?d.frontFace[0]:WebGLRenderingContext.CCW,cull:{enabled:h[WebGLRenderingContext.CULL_FACE],face:s(d.cullFace)?d.cullFace[0]:WebGLRenderingContext.BACK},lineWidth:s(d.lineWidth)?d.lineWidth[0]:1,polygonOffset:{enabled:h[WebGLRenderingContext.POLYGON_OFFSET_FILL],factor:_[0],units:_[1]},scissorTest:{enabled:h[WebGLRenderingContext.SCISSOR_TEST],rectangle:{x:y[0],y:y[1],width:y[2],height:y[3]}},depthRange:{near:g[0],far:g[1]},depthTest:{enabled:h[WebGLRenderingContext.DEPTH_TEST],func:s(d.depthFunc)?d.depthFunc[0]:WebGLRenderingContext.LESS},colorMask:{red:v[0],green:v[1],blue:v[2],alpha:v[3]},depthMask:s(d.depthMask)?d.depthMask[0]:!0,blending:{enabled:h[WebGLRenderingContext.BLEND],color:{red:p[0],green:p[1],blue:p[2],alpha:p[3]},equationRgb:m[0],equationAlpha:m[1],functionSourceRgb:f[0],functionSourceAlpha:f[1],functionDestinationRgb:f[2],functionDestinationAlpha:f[3]}})}}}function It(e){var t={value:e,clone:function(e){return e},func:function(){return t.value}};return t}function Ot(e){var i={value:t.fromArray(e),clone:t.clone,func:function(){return i.value}};return i}function Rt(e){var t={value:i.fromArray(e),clone:i.clone,func:function(){return t.value}};return t}function Lt(e){var t={value:r.fromArray(e),clone:r.clone,func:function(){return t.value}};return t}function Nt(e){var t={value:y.fromColumnMajorArray(e),clone:y.clone,func:function(){return t.value}};return t}function Ft(e){var t={value:C.fromColumnMajorArray(e),clone:C.clone,func:function(){return t.value}};return t}function Bt(e){var t={value:w.fromColumnMajorArray(e),clone:w.clone,func:function(){return t.value}};return t}function zt(e,t){var i={value:t._rendererResources.textures[e],clone:function(e){return e},func:function(){return i.value}};return i}function kt(e,t){var i=t._runtime.nodes[e];return function(){return i.computedMatrix}}function Vt(e,t){var i=e._loadResources;if(i.finishedTextureCreation()&&i.finishedProgramCreation()&&i.createUniformMaps){i.createUniformMaps=!1;var r=e.gltf,n=r.materials,o=r.techniques;r.programs;var a=e._uniformMaps;for(var l in n)if(n.hasOwnProperty(l)){var u,c=n[l],h=c.instanceTechnique,d=h.values,p=o[h.technique],m=p.parameters,f=p.passes[p.pass],v=f.instanceProgram,g=v.uniforms,_={},y={};for(var C in g)if(g.hasOwnProperty(C)){var w=g[C],S=m[w];if(s(d[w])){var E=yi[S.type](d[w],e);_[C]=E.func,y[w]=E}else if(s(S.semantic))"JOINTMATRIX"!==S.semantic?_[C]=_i[S.semantic](t.uniformState,e):u=C;else if(s(S.source))_[C]=kt(S.source,e);else if(s(S.value)){var b=yi[S.type](S.value,e);_[C]=b.func,y[w]=b}}var x=a[l];x.uniformMap=_,x.values=y,x.jointMatrixUniformName=u}}}function Ut(e){return function(){return e}}function Wt(e){return function(){return e.computedJointMatrices}}function Gt(t,r,n,l){var u=t._nodeCommands,c=t._pickIds,h=t.allowPicking,d=t._runtime.meshesByName;t.debugShowBoundingVolume;for(var m=t._rendererResources,f=m.vertexArrays,v=m.programs,g=m.pickPrograms,_=m.renderStates,y=t._uniformMaps,C=t.gltf,S=C.accessors,E=C.meshes,b=C.techniques,x=C.materials,T=s(r.meshes)?r.meshes:r.instanceSkin.meshes,A=T.length,D=0;A>D;++D)for(var M=T[D],I=E[M],O=I.primitives,R=O.length,L=0;R>L;++L){var N,F=O[L],B=S[F.indices],z=x[F.material].instanceTechnique,k=b[z.technique],U=k.passes[k.pass],W=U.instanceProgram,G=F.attributes.POSITION;if(s(G)){var H=S[G];N=e.fromCornerPoints(i.fromArray(H.min),i.fromArray(H.max))}var q=f[M+".primitive."+L],j=B.count,Y=B.byteOffset/p.getSizeInBytes(B.componentType),X=y[F.material],Z=X.uniformMap;if(s(X.jointMatrixUniformName)){var J={};J[X.jointMatrixUniformName]=Wt(n),Z=o(Z,J)}var Q,K=_[z.technique],$=K.blending.enabled,et={primitive:a(t.pickPrimitive,t),id:t.id,node:n.publicNode,mesh:d[I.name]},tt=new P({boundingVolume:new e,modelMatrix:new w,primitiveType:F.mode,vertexArray:q,count:j,offset:Y,shaderProgram:v[W.program],uniformMap:Z,renderState:K,owner:et,pass:$?V.TRANSLUCENT:V.OPAQUE});if(h){var it=l.createPickId(et);c.push(it);var rt=o(Z,{czm_pickColor:Ut(it.color)});Q=new P({boundingVolume:new e,modelMatrix:new w,primitiveType:F.mode,vertexArray:q,count:j,offset:Y,shaderProgram:g[W.program],uniformMap:rt,renderState:K,owner:et,pass:$?V.TRANSLUCENT:V.OPAQUE})}var nt={show:!0,boundingSphere:N,command:tt,pickCommand:Q};n.commands.push(nt),u.push(nt)}}function Ht(e,t){var r=e._loadResources;if(r.finishedPendingLoads()&&r.finishedResourceCreation()&&r.createRuntimeNodes){r.createRuntimeNodes=!1;for(var n=[],o=e._runtime.nodes,a=e.gltf,l=a.nodes,u=a.scenes[a.scene],c=u.nodes,h=c.length,d=[],p=new i,m=0;h>m;++m)for(d.push({parentRuntimeNode:void 0,gltfNode:l[c[m]],id:c[m]});d.length>0;){var f=d.pop(),v=f.parentRuntimeNode,g=f.gltfNode,_=o[f.id];0===_.parents.length&&(s(g.matrix)?_.matrix=w.fromColumnMajorArray(g.matrix):(p=i.fromArray(g.rotation,0,p),_.translation=i.fromArray(g.translation),_.rotation=E.fromAxisAngle(p,g.rotation[3]),_.scale=i.fromArray(g.scale))),s(v)?(v.children.push(_),_.parents.push(v)):n.push(_),(s(g.meshes)||s(g.instanceSkin))&&Gt(e,g,_,t);for(var y=g.children,C=y.length,S=0;C>S;++S)d.push({parentRuntimeNode:_,gltfNode:l[y[S]],id:y[S]})}e._runtime.rootNodes=n,e._runtime.nodes=o}}function qt(e,t){if(e._loadRendererResourcesFromCache){var i=e._rendererResources,r=e._cachedRendererResources;i.buffers=r.buffers,i.vertexArrays=r.vertexArrays,i.programs=r.programs,i.pickPrograms=r.pickPrograms,i.textures=r.textures,i.samplers=r.samplers,i.renderStates=r.renderStates}else dt(e,t),vt(e,t),yt(e,t),_t(e),wt(e,t);xt(e),Pt(e),e._loadRendererResourcesFromCache||(At(e,t),Mt(e,t)),Vt(e,t),Ht(e,t)}function jt(e,t){var i=e.publicNode,r=i.matrix;i.useMatrix&&s(r)?w.clone(r,t):s(e.matrix)?w.clone(e.matrix,t):(w.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t),i.setMatrix(t))}function Yt(t,r,n){for(var o=t._maxDirtyNumber,a=t.allowPicking,l=t._runtime.rootNodes,u=l.length,c=Ci,h=t._computedModelMatrix,d=0;u>d;++d){var p=l[d];for(jt(p,p.transformToRoot),c.push(p);c.length>0;){p=c.pop();var m=p.transformToRoot,f=p.commands;if(p.dirtyNumber===o||r||n){var v=f.length;if(v>0)for(var g=0;v>g;++g){var _=f[g],y=_.command;if(w.multiplyTransformation(h,m,y.modelMatrix),e.transform(_.boundingSphere,y.modelMatrix,y.boundingVolume),s(t._rtcCenter)&&i.add(t._rtcCenter,y.boundingVolume.center,y.boundingVolume.center),a){var C=_.pickCommand;w.clone(y.modelMatrix,C.modelMatrix),e.clone(y.boundingVolume,C.boundingVolume)}}else p.computedMatrix=w.multiplyTransformation(h,m,p.computedMatrix)}for(var S=p.children,E=S.length,b=0;E>b;++b){var x=S[b];x.dirtyNumber=Math.max(x.dirtyNumber,p.dirtyNumber),(x.dirtyNumber===o||n)&&(jt(x,x.transformToRoot),w.multiplyTransformation(m,x.transformToRoot,x.transformToRoot)),c.push(x)}}}++t._maxDirtyNumber}function Xt(e){for(var t=e._runtime.skinnedNodes,i=t.length,r=0;i>r;++r){var n=t[r];wi=w.inverseTransformation(n.transformToRoot,wi);for(var o=n.computedJointMatrices,a=n.joints,l=n.bindShapeMatrix,u=n.inverseBindMatrices,c=u.length,h=0;c>h;++h)s(o[h])||(o[h]=new w),o[h]=w.multiplyTransformation(wi,a[h].transformToRoot,o[h]),o[h]=w.multiplyTransformation(o[h],u[h],o[h]),s(l)&&(o[h]=w.multiplyTransformation(o[h],l,o[h]))}}function Zt(e){for(var t=e._runtime.rootNodes,i=t.length,r=Ci,n=0;i>n;++n){var o=t[n];for(o.computedShow=o.publicNode.show,r.push(o);r.length>0;){o=r.pop();for(var a=o.computedShow,s=o.commands,l=s.length,u=0;l>u;++u)s[u].show=a;for(var c=o.children,h=c.length,d=0;h>d;++d){var p=c[d];p.computedShow=a&&p.publicNode.show,r.push(p)}}}}function Jt(e){var t=e.id;if(e._id!==t){e._id=t;for(var i=e._pickIds,r=i.length,n=0;r>n;++n)i[n].object.id=t}}function Qt(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;for(var t=e.debugWireframe?S.LINES:S.TRIANGLES,i=e._nodeCommands,r=i.length,n=0;r>n;++n)i[n].command.primitiveType=t}}function Kt(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var t=e.debugShowBoundingVolume,i=e._nodeCommands,r=i.length,n=0;r>n;n++)i[n].command.debugShowBoundingVolume=t}}function $t(e,t,r,n){var o=n.camera,a=o.frustum,s=i.subtract(o.positionWC,e,Ei),l=i.multiplyByScalar(o.directionWC,i.dot(s,o.directionWC),bi),u=Math.max(a.near,i.magnitude(l)-t);Si.x=r.drawingBufferWidth,Si.y=r.drawingBufferHeight;var c=a.getPixelSize(Si,u),h=Math.max(c.x,c.y);return h}function ei(e,t,r){var n=e.scale;if(0!==e.minimumPixelSize){var o=Math.max(t.drawingBufferWidth,t.drawingBufferHeight),a=e.modelMatrix;xi.x=a[12],xi.y=a[13],xi.z=a[14],s(e._rtcCenter)&&i.add(e._rtcCenter,xi,xi);var l=e.boundingSphere.radius,u=$t(xi,l,t,r),c=1/u,h=Math.min(c*2*l,o);hn;++n){var o=i[n];o.isDestroyed()||G(o,this)}this.modelsToLoad=void 0,this.ready=!0};var ui={},ci=function(t){t=a(t,a.EMPTY_OBJECT);var i=t.cacheKey;this._cacheKey=i,this._cachedGltf=void 0,this._releaseGltfJson=a(t.releaseGltfJson,!1),this._animationIds=void 0;var r;if(s(i)&&s(ui[i])&&ui[i].ready)r=ui[i],++r.count;else{var n=t.gltf;s(n)&&(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),r=n instanceof Uint8Array?new li({gltf:Z(n),bgltf:n,ready:!0}):new li({gltf:t.gltf,ready:!0}),r.count=1,s(i)&&(ui[i]=r))}G(this,r),this._basePath=a(t.basePath,"");var o=new O(document.location.href),l=new O(this._basePath);this._baseUri=l.resolve(o),this.show=a(t.show,!0),this.modelMatrix=w.clone(a(t.modelMatrix,w.IDENTITY)),this._modelMatrix=w.clone(this.modelMatrix),this.scale=a(t.scale,1),this._scale=this.scale,this.minimumPixelSize=a(t.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.id=t.id,this._id=t.id,this.pickPrimitive=t.pickPrimitive,this._allowPicking=a(t.allowPicking,!0),this._ready=!1,this._readyPromise=R.defer(),this.activeAnimations=new F(this),this._asynchronous=a(t.asynchronous,!0),this.debugShowBoundingVolume=a(t.debugShowBoundingVolume,!1),this._debugShowBoudingVolume=!1,this.debugWireframe=a(t.debugWireframe,!1),this._debugWireframe=!1,this._computedModelMatrix=new w,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new e,this._state=ai.NEEDS_LOAD,this._loadError=void 0,this._loadResources=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,rootNodes:void 0,nodes:void 0,nodesByName:void 0,skinnedNodes:void 0,meshesByName:void 0,materialsByName:void 0,materialsById:void 0},this._uniformMaps={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},pickPrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0};l(ci.prototype,{gltf:{get:function(){return s(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._basePath}},boundingSphere:{get:function(){var e=w.getScale(this.modelMatrix,oi);i.multiplyByScalar(e,this.scale,e);var t=this._scaledBoundingSphere;return t.center=i.multiplyComponents(this._boundingSphere.center,e,t.center),t.radius=i.maximumComponent(e)*this._initialRadius,s(this._rtcCenter)&&i.add(this._rtcCenter,t.center,t.center),t}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},asynchronous:{get:function(){return this._asynchronous}},allowPicking:{get:function(){return this._allowPicking}}});var hi=Uint32Array.BYTES_PER_ELEMENT;ci.fromGltf=function(e){var t=e.url,i=a(e.cacheKey,j(t));e=n(e),e.basePath=q(t),e.cacheKey=i;var r=new ci(e);e.headers=s(e.headers)?n(e.headers):{},s(e.headers.Accept)||(e.headers.Accept=si);var o=ui[i];return s(o)?o.ready||(++o.count,o.modelsToLoad.push(r)):(o=new li({ready:!1}),o.count=1,o.modelsToLoad.push(r),G(r,o),ui[i]=o,m(t,e.headers).then(function(e){var t=new Uint8Array(e);if(X(t))o.makeReady(Z(t),t);else{var i=d(t);o.makeReady(JSON.parse(i))}}).otherwise(K(r,"model",t))),r},ci._gltfCache=ui,ci.prototype.getNode=function(e){var t=J(this,"nodesByName",e);return s(t)?t.publicNode:void 0},ci.prototype.getMesh=function(e){return J(this,"meshesByName",e)},ci.prototype.getMaterial=function(e){return J(this,"materialsByName",e)};var di=new i,pi=new i,mi=new i,fi=new i,vi=new E,gi=new i,_i={MODEL:function(e){return function(){return e.model}},VIEW:function(e){return function(){return e.view}},PROJECTION:function(e){return function(){return e.projection}},MODELVIEW:function(e){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){var i=new w;return function(){return w.setTranslation(e.modelView,t._rtcCenterEye,i)}},MODELVIEWPROJECTION:function(e){return function(){return e.modelViewProjection}},MODELINVERSE:function(e){return function(){return e.inverseModel}},VIEWINVERSE:function(e){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e){return function(){return e.inverseModelView}},MODELVIEWPROJECTIONINVERSE:function(e){return function(){return e.inverseModelViewProjection}},MODELINVERSETRANSPOSE:function(e){return function(){return e.inverseTranposeModel}},MODELVIEWINVERSETRANSPOSE:function(e){return function(){return e.normal}},VIEWPORT:function(e){return function(){return e.viewportCartesian4}}},yi={};"undefined"!=typeof WebGLRenderingContext&&(yi[WebGLRenderingContext.FLOAT]=It,yi[WebGLRenderingContext.FLOAT_VEC2]=Ot,yi[WebGLRenderingContext.FLOAT_VEC3]=Rt,yi[WebGLRenderingContext.FLOAT_VEC4]=Lt,yi[WebGLRenderingContext.INT]=It,yi[WebGLRenderingContext.INT_VEC2]=Ot,yi[WebGLRenderingContext.INT_VEC3]=Rt,yi[WebGLRenderingContext.INT_VEC4]=Lt,yi[WebGLRenderingContext.BOOL]=It,yi[WebGLRenderingContext.BOOL_VEC2]=Ot,yi[WebGLRenderingContext.BOOL_VEC3]=Rt,yi[WebGLRenderingContext.BOOL_VEC4]=Lt,yi[WebGLRenderingContext.FLOAT_MAT2]=Nt,yi[WebGLRenderingContext.FLOAT_MAT3]=Ft,yi[WebGLRenderingContext.FLOAT_MAT4]=Bt,yi[WebGLRenderingContext.SAMPLER_2D]=zt);var Ci=[],wi=new w,Si=new t,Ei=new i,bi=new i,xi=new i,Ti=function(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.pickPrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0};return Ti.prototype.release=function(){return 0===--this.count?(s(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],ri(this),u(this)):void 0},ci.prototype.update=function(e,t,r){if(t.mode===U.SCENE3D){if(this._state===ai.NEEDS_LOAD&&s(this.gltf)){var n,o=this.cacheKey;if(s(o)){e.cache.modelRendererResourceCache=a(e.cache.modelRendererResourceCache,{});var l=e.cache.modelRendererResourceCache;if(n=l[this.cacheKey],s(n)){if(!n.ready)return;++n.count,this._loadRendererResourcesFromCache=!0}else n=new Ti(e,o),n.count=1,l[this.cacheKey]=n;this._cachedRendererResources=n}else n=new Ti(e),n.count=1,this._cachedRendererResources=n;this._state=ai.LOADING,this._boundingSphere=Q(this.gltf),this._initialRadius=this._boundingSphere.radius;var u=this.gltf.extensions;s(u)&&s(u.CESIUM_RTC)&&(this._rtcCenter=i.fromArray(u.CESIUM_RTC.center),this._rtcCenterEye=new i),this._loadResources=new W,ht(this)}var c=!1;if(this._state===ai.FAILED)throw this._loadError;if(this._state===ai.LOADING){qt(this,e);var h=this._loadResources;if(h.finishedPendingLoads()&&h.finishedResourceCreation()){this._state=ai.LOADED,this._loadResources=void 0;var d=this._rendererResources,p=this._cachedRendererResources;p.buffers=d.buffers,p.vertexArrays=d.vertexArrays,p.programs=d.programs,p.pickPrograms=d.pickPrograms,p.textures=d.textures,p.samplers=d.samplers,p.renderStates=d.renderStates,p.ready=!0,this.releaseGltfJson&&ti(this),c=!0}}var m=this.show&&0!==this.scale;if(m&&this._state===ai.LOADED||c){var f=this.activeAnimations.update(t)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1;var v=!w.equals(this._modelMatrix,this.modelMatrix)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize;if(v||c){w.clone(this.modelMatrix,this._modelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize;var g=ei(this,e,t),_=this._computedModelMatrix;w.multiplyByUniformScale(this.modelMatrix,g,_),w.multiplyTransformation(_,ni,_)}(f||v||c)&&(Yt(this,v,c),(f||c)&&Xt(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,Zt(this)),Jt(this,e),Qt(this),Kt(this),s(this._rtcCenter)&&w.multiplyByPoint(t.camera.viewMatrix,this._rtcCenter,this._rtcCenterEye)}if(c){var y=this;return t.afterRender.push(function(){y._ready=!0,y.readyPromise.resolve(y)}),void 0}if(m){var C,S,E=t.passes,b=this._nodeCommands,x=b.length;if(E.render)for(C=0;x>C;++C)S=b[C],S.show&&r.push(S.command);if(E.pick)for(C=0;x>C;++C)S=b[C],S.show&&r.push(S.pickCommand)}}},ci.prototype.isDestroyed=function(){return!1},ci.prototype.destroy=function(){this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release();for(var e=this._pickIds,t=e.length,i=0;t>i;++i)e[i].destroy();return ti(this),u(this)},ci}),i("DataSources/ModelVisualizer",["../Core/AssociativeArray","../Core/BoundingSphere","../Core/Cartesian3","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Scene/Model","../Scene/ModelAnimationLoop","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e,t,i,n){var o=i[t.id];r(o)&&(n.removeAndDestroy(o.modelPrimitive),delete i[t.id])}function d(e){e.activeAnimations.addAll({loop:l.REPEAT})}function p(e){console.error(e)}var m=1,f=0,v=function(t,i){i.collectionChanged.addEventListener(v.prototype._onCollectionChanged,this),this._scene=t,this._primitives=t.primitives,this._entityCollection=i,this._modelHash={},this._entitiesToVisualize=new e,this._modelMatrixScratch=new a,this._onCollectionChanged(i,i.values,[],[])};return v.prototype.update=function(e){this._scene.context;var t=this._entitiesToVisualize.values,i=this._modelHash,n=this._primitives;this._scene;for(var o=0,l=t.length;l>o;o++){var u,h,v=t[o],g=v._model,_=i[v.id],y=v.isShowing&&v.isAvailable(e)&&c.getValueOrDefault(g._show,e,!0);if(y&&(h=v._getModelMatrix(e,this._modelMatrixScratch),u=c.getValueOrUndefined(g._uri,e),y=r(h)&&r(u)),y){var C=r(_)?_.modelPrimitive:void 0;r(C)&&u===_.uri||(r(C)&&(n.removeAndDestroy(C),delete i[v.id]),C=s.fromGltf({url:u}),C.readyPromise.then(d).otherwise(p),C.id=v,n.add(C),_={modelPrimitive:C,uri:u},i[v.id]=_),C.show=!0,C.scale=c.getValueOrDefault(g._scale,e,m),C.minimumPixelSize=c.getValueOrDefault(g._minimumPixelSize,e,f),C.modelMatrix=a.clone(h,C.modelMatrix)}else r(_)&&(_.modelPrimitive.show=!1)}return!0},v.prototype.isDestroyed=function(){return!1},v.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(v.prototype._onCollectionChanged,this);for(var e=this._entitiesToVisualize.values,t=this._modelHash,i=this._primitives,r=e.length-1;r>-1;r--)h(this,e[r],t,i);return n(this)},v.prototype.getBoundingSphere=function(e,i){var n=this._modelHash[e.id];if(!r(n))return u.FAILED;var o=n.modelPrimitive;return r(o)&&o.show?o.ready?(t.transform(o.boundingSphere,o.modelMatrix,i),u.DONE):u.PENDING:u.FAILED},v.prototype._onCollectionChanged=function(e,t,i,n){var o,a,s=this._entitiesToVisualize,l=this._modelHash,u=this._primitives;for(o=t.length-1;o>-1;o--)a=t[o],r(a._model)&&r(a._position)&&s.set(a.id,a);for(o=n.length-1;o>-1;o--)a=n[o],r(a._model)&&r(a._position)?s.set(a.id,a):(h(this,a,l,u),s.remove(a.id));for(o=i.length-1;o>-1;o--)a=i[o],h(this,a,l,u),s.remove(a.id)},v}),i("Shaders/PolylineCommon",[],function(){"use strict";return"void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p1ToP0 = p1 - p0;\nfloat magnitude = length(p1ToP0);\nvec3 direction = normalize(p1ToP0);\nfloat endPoint0Distance = -(czm_currentFrustum.x + p0.z);\nfloat denominator = -direction.z;\nif (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n{\nfloat t = (czm_currentFrustum.x + p0.z) / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\nclipped = true;\n}\n}\npositionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious) {\nvec4 endPointWC, p0, p1;\nbool culledByNearPlane, clipped;\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\nif (culledByNearPlane)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 prevWC = normalize(p0.xy - endPointWC.xy);\nvec2 nextWC = normalize(p1.xy - endPointWC.xy);\nfloat expandWidth = width * 0.5;\nvec2 direction;\nif (czm_equalsEpsilon(normalize(previous.xyz - position.xyz), vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n{\ndirection = vec2(-nextWC.y, nextWC.x);\n}\nelse if (czm_equalsEpsilon(normalize(next.xyz - position.xyz), vec3(0.0), czm_epsilon1) || clipped)\n{\ndirection = vec2(prevWC.y, -prevWC.x);\n}\nelse\n{\nvec2 normal = vec2(-nextWC.y, nextWC.x);\ndirection = normalize((nextWC + prevWC) * 0.5);\nif (dot(direction, normal) < 0.0)\n{\ndirection = -direction;\n}\nfloat sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = direction * expandDirection * expandWidth * czm_resolutionScale;\nreturn vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\n}\n"}),i("Shaders/PolylineFS",[],function(){"use strict";return"varying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n"}),i("Shaders/PolylineVS",[],function(){"use strict";return"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 texCoordExpandWidthAndShow;\nattribute vec4 pickColor;\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 czm_pickColor;\nvoid main()\n{\nfloat texCoord = texCoordExpandWidthAndShow.x;\nfloat expandDir = texCoordExpandWidthAndShow.y;\nfloat width = abs(texCoordExpandWidthAndShow.z) + 0.5;\nbool usePrev = texCoordExpandWidthAndShow.z < 0.0;\nfloat show = texCoordExpandWidthAndShow.w;\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\nv_width = width;\nczm_pickColor = pickColor;\n}\n"}),i("Scene/Polyline",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/PolylinePipeline","./Material"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e,t){++e._propertiesChanged[t];var i=e._polylineCollection;n(i)&&(i._updatePolyline(e,t),e._dirty=!0)}var h=function(o,a){o=r(o,r.EMPTY_OBJECT),this._show=r(o.show,!0),this._width=r(o.width,1),this._loop=r(o.loop,!1),this._material=o.material,n(this._material)||(this._material=u.fromType(u.ColorType,{color:new i(1,1,1,1)}));var c=o.positions;n(c)||(c=[]),this._positions=c,this._actualPositions=l.removeDuplicates(c),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=c.slice()),this._actualPositions.push(t.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=o.id;var h;n(a)&&(h=s.clone(a.modelMatrix)),this._modelMatrix=h,this._segments=l.wrapLongitude(this._actualPositions,h),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(g),this._polylineCollection=a,this._dirty=!1,this._pickId=void 0,this._boundingVolume=e.fromPoints(this._actualPositions),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new e},d=h.SHOW_INDEX=0,p=h.WIDTH_INDEX=1,m=h.POSITION_INDEX=2,f=h.MATERIAL_INDEX=3,v=h.POSITION_SIZE_INDEX=4,g=h.NUMBER_OF_PROPERTIES=5;return o(h.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,c(this,d))}},positions:{get:function(){return this._positions},set:function(i){var r=l.removeDuplicates(i);this._loop&&r.length>2&&(r===i&&(r=i.slice()),r.push(t.clone(r[0]))),(this._actualPositions.length!==r.length||this._actualPositions.length!==this._length)&&c(this,v),this._positions=i,this._actualPositions=r,this._length=r.length,this._boundingVolume=e.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),c(this,m),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,c(this,f))}},width:{get:function(){return this._width},set:function(e){var t=this._width;e!==t&&(this._width=e,c(this,p))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){var i=this._actualPositions;e?i.length>2&&!t.equals(i[0],i[i.length-1])&&(i.length===this._positions.length&&(this._actualPositions=i=this._positions.slice()),i.push(t.clone(i[0]))):i.length>2&&t.equals(i[0],i[i.length-1])&&(i.length-1===this._positions.length?this._actualPositions=this._positions:i.pop()),this._loop=e,c(this,v)}}},id:{get:function(){return this._id},set:function(e){this._id=e,n(this._pickId)&&(this._pickId.object.id=e)}}}),h.prototype.update=function(){var t=s.IDENTITY;n(this._polylineCollection)&&(t=this._polylineCollection.modelMatrix);var i=this._segments.positions.length,r=this._segments.lengths,o=this._propertiesChanged[m]>0||this._propertiesChanged[v]>0;if((!s.equals(t,this._modelMatrix)||o)&&(this._segments=l.wrapLongitude(this._actualPositions,t),this._boundingVolumeWC=e.transform(this._boundingVolume,t,this._boundingVolumeWC)),this._modelMatrix=t,this._segments.positions.length!==i)c(this,v);else for(var a=r.length,u=0;a>u;++u)if(r[u]!==this._segments.lengths[u]){c(this,v);break}},h.prototype.getPickId=function(e){return n(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},h.prototype._clean=function(){this._dirty=!1;for(var e=this._propertiesChanged,t=0;g-1>t;++t)e[t]=0},h.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0},h}),i("Scene/PolylineCollection",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/IndexDatatype","../Core/Intersect","../Core/Math","../Core/Matrix4","../Core/Plane","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/ShaderSource","../Shaders/PolylineCommon","../Shaders/PolylineFS","../Shaders/PolylineVS","./BlendingState","./Material","./Pass","./Polyline","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P){"use strict";function A(t,i,r,n,o,a,l){for(var u=n.length,c=0,h=!0,d=t._vertexArrays,p=t.debugShowBoundingVolume,m=d.length,f=0;m>f;++f)for(var v=d[f],g=v.buckets,y=g.length,C=0;y>C;++C){for(var w,S,E,b=g[C],T=b.offset,A=l?b.bucket.shaderProgram:b.bucket.pickShaderProgram,D=b.bucket.polylines,M=D.length,O=0,R=0;M>R;++R){var L=D[R],N=I(L._material);if(N!==w){if(s(w)&&O>0){var F=S.isTranslucent();c>=u?(E=new _({owner:t}),n.push(E)):E=n[c],++c,E.boundingVolume=e.clone(X,E.boundingVolume),E.modelMatrix=a,E.shaderProgram=A,E.vertexArray=v.va,E.renderState=F?t._translucentRS:t._opaqueRS,E.pass=F?x.TRANSLUCENT:x.OPAQUE,E.debugShowBoundingVolume=l?p:!1,E.uniformMap=S._uniforms,E.count=O,E.offset=T,T+=O,O=0,h=!0,o.push(E)}S=L._material,S.update(i),w=N}for(var B=L._locatorBuckets,z=B.length,k=0;z>k;++k){var V=B[k];V.locator===b&&(O+=V.count)}var U;r.mode===P.SCENE3D?U=L._boundingVolumeWC:r.mode===P.COLUMBUS_VIEW?U=L._boundingVolume2D:r.mode===P.SCENE2D?s(L._boundingVolume2D)&&(U=e.clone(L._boundingVolume2D,Z),U.center.x=0):s(L._boundingVolumeWC)&&s(L._boundingVolume2D)&&(U=e.union(L._boundingVolumeWC,L._boundingVolume2D,Z)),h?(h=!1,e.clone(U,X)):e.union(U,X,X)}s(w)&&O>0&&(c>=u?(E=new _({owner:t}),n.push(E)):E=n[c],++c,E.boundingVolume=e.clone(X,E.boundingVolume),E.modelMatrix=a,E.shaderProgram=A,E.vertexArray=v.va,E.renderState=S.isTranslucent()?t._translucentRS:t._opaqueRS,E.pass=S.isTranslucent()?x.TRANSLUCENT:x.OPAQUE,E.debugShowBoundingVolume=l?p:!1,E.uniformMap=S._uniforms,E.count=O,E.offset=T,h=!0,o.push(E)),w=void 0}n.length=c}function D(e){for(var t=e._buffersUsage,i=!1,r=e._propertiesChanged,n=0;q-2>n;++n){var o=t[n];r[n]?o.bufferUsage!==g.STREAM_DRAW?(i=!0,o.bufferUsage=g.STREAM_DRAW,o.frameCount=100):o.frameCount=100:o.bufferUsage!==g.STATIC_DRAW&&(0===o.frameCount?(i=!0,o.bufferUsage=g.STATIC_DRAW):o.frameCount--)}return i}function M(e,t,i){e._createVertexArray=!1,N(e),F(e),O(e);var r,n,a=[[]],l=a[0],u=[0],c=0,h=[[]],p=0,f=e._polylineBuckets;for(r in f)f.hasOwnProperty(r)&&(n=f[r],n.updateShader(t),p+=n.lengthOfPositions);if(p>0){var v,_=e._mode,y=new Float32Array(3*6*p),C=new Uint8Array(4*p),w=new Float32Array(4*p),S=0,E=0,b=0;for(r in f)if(f.hasOwnProperty(r)){n=f[r],n.write(y,C,w,S,E,b,t,i),_===P.MORPHING&&(s(v)||(v=new Float32Array(3*6*p)),n.writeForMorph(v,S));var x=n.lengthOfPositions;S+=3*6*x,E+=4*x,b+=4*x,c=n.updateIndices(a,u,h,c)}var T=e._buffersUsage[W].bufferUsage,A=e._buffersUsage[V].bufferUsage,D=e._buffersUsage[U].bufferUsage,M=A===g.STREAM_DRAW||D===g.STREAM_DRAW?g.STREAM_DRAW:g.STATIC_DRAW;e._positionBuffer=t.createVertexBuffer(y,T);var I;s(v)&&(I=t.createVertexBuffer(v,T)),e._pickColorBuffer=t.createVertexBuffer(C,g.STATIC_DRAW),e._texCoordExpandWidthAndShowBuffer=t.createVertexBuffer(w,M);for(var R=4*Uint8Array.BYTES_PER_ELEMENT,L=3*Float32Array.BYTES_PER_ELEMENT,B=4*Float32Array.BYTES_PER_ELEMENT,z=0,k=a.length,G=0;k>G;++G)if(l=a[G],l.length>0){var H=new Uint16Array(l),q=t.createIndexBuffer(H,g.STATIC_DRAW,d.UNSIGNED_SHORT);z+=u[G];var Y,X,Z,Q,K=6*(G*L*m.SIXTY_FOUR_KILOBYTES-z*L),$=L+K,et=L+$,tt=L+et,it=L+tt,rt=L+it,nt=G*R*m.SIXTY_FOUR_KILOBYTES-z*R,ot=G*B*m.SIXTY_FOUR_KILOBYTES-z*B,at=[{index:j.position3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:K,strideInBytes:6*L},{index:j.position3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:j.position2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:K,strideInBytes:6*L},{index:j.position2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:j.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:et,strideInBytes:6*L},{index:j.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:tt,strideInBytes:6*L},{index:j.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:et,strideInBytes:6*L},{index:j.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:tt,strideInBytes:6*L},{index:j.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:it,strideInBytes:6*L},{index:j.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:rt,strideInBytes:6*L},{index:j.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:it,strideInBytes:6*L},{index:j.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:rt,strideInBytes:6*L},{index:j.texCoordExpandWidthAndShow,componentsPerAttribute:4,componentDatatype:o.FLOAT,vertexBuffer:e._texCoordExpandWidthAndShowBuffer,offsetInBytes:ot},{index:j.pickColor,componentsPerAttribute:4,componentDatatype:o.UNSIGNED_BYTE,vertexBuffer:e._pickColorBuffer,offsetInBytes:nt,normalize:!0}];_===P.SCENE3D?(Y=e._positionBuffer,X="vertexBuffer",Z=J,Q="value"):_===P.SCENE2D||_===P.COLUMBUS_VIEW?(Y=J,X="value",Z=e._positionBuffer,Q="vertexBuffer"):(Y=I,X="vertexBuffer",Z=e._positionBuffer,Q="vertexBuffer"),at[0][X]=Y,at[1][X]=Y,at[2][Q]=Z,at[3][Q]=Z,at[4][X]=Y,at[5][X]=Y,at[6][Q]=Z,at[7][Q]=Z,at[8][X]=Y,at[9][X]=Y,at[10][Q]=Z,at[11][Q]=Z;var st=t.createVertexArray(at,q);e._vertexArrays.push({va:st,buckets:h[G]})}}}function I(e){var t=b._uniformList[e.type],i=t.length;Q.length=2*i;for(var r=0,n=0;i>n;++n){var o=t[n];Q[r]=o,Q[r+1]=e._uniforms[o](),r+=2}return e.type+":"+JSON.stringify(Q)}function O(e){for(var t=e._mode,i=e._modelMatrix,r=e._polylineBuckets={},n=e._polylines,o=n.length,a=0;o>a;++a){var l=n[a];if(l._actualPositions.length>1){l.update();var u=l.material,c=r[u.type];s(c)||(c=r[u.type]=new K(u,t,i)),c.addPolyline(l)}}}function R(e,t){var i=t.mode;e._mode===i&&f.equals(e._modelMatrix,e.modelMatrix)||(e._mode=i,e._modelMatrix=f.clone(e.modelMatrix),e._createVertexArray=!0)}function L(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;for(var t=[],i=e._polylines.length,r=0,n=0;i>r;++r){var o=e._polylines[r];s(o)&&(o._index=n++,t.push(o))}e._polylines=t}}function N(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)if(s(t[r])){var n=t[r]._bucket;s(n)&&(n.shaderProgram=n.shaderProgram&&n.shaderProgram.destroy())}}function F(e){for(var t=e._vertexArrays.length,i=0;t>i;++i)e._vertexArrays[i].va.destroy();e._vertexArrays.length=0}function B(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)s(t[r])&&t[r]._destroy()}function z(e,t,i){this.count=e,this.offset=t,this.bucket=i}function k(e){return t.dot(t.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(v.ORIGIN_ZX_PLANE)===p.INTERSECTING}var V=T.SHOW_INDEX,U=T.WIDTH_INDEX,W=T.POSITION_INDEX,G=T.MATERIAL_INDEX,H=T.POSITION_SIZE_INDEX,q=T.NUMBER_OF_PROPERTIES,j={texCoordExpandWidthAndShow:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12,pickColor:13},Y=function(e){e=a(e,a.EMPTY_OBJECT),this.modelMatrix=f.clone(a(e.modelMatrix,f.IDENTITY)),this._modelMatrix=f.clone(f.IDENTITY),this.debugShowBoundingVolume=a(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._pickCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(q),this._polylines=[],this._polylineBuckets={},this._buffersUsage=[{bufferUsage:g.STATIC_DRAW,frameCount:0},{bufferUsage:g.STATIC_DRAW,frameCount:0},{bufferUsage:g.STATIC_DRAW,frameCount:0}],this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._pickColorBuffer=void 0,this._texCoordExpandWidthAndShowBuffer=void 0};l(Y.prototype,{length:{get:function(){return L(this),this._polylines.length}}}),Y.prototype.add=function(e){var t=new T(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,t},Y.prototype.remove=function(e){if(this.contains(e)){if(this._polylines[e._index]=void 0,this._polylinesRemoved=!0,this._createVertexArray=!0,s(e._bucket)){var t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy(),t.pickShaderProgram=t.pickShaderProgram&&t.pickShaderProgram.destroy()}return e._destroy(),!0}return!1},Y.prototype.removeAll=function(){N(this),B(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},Y.prototype.contains=function(e){return s(e)&&e._polylineCollection===this},Y.prototype.get=function(e){return L(this),this._polylines[e]},Y.prototype.update=function(e,t,i){if(L(this),0!==this._polylines.length){R(this,t);var r,n=t.mapProjection,o=this._propertiesChanged;if(this._createVertexArray||D(this))M(this,e,n);else if(this._polylinesUpdated){var a=this._polylinesToUpdate;if(this._mode!==P.SCENE3D)for(var l=a.length,u=0;l>u;++u)r=a[u],r.update();if(o[H]||o[G])M(this,e,n);else for(var c=a.length,h=this._polylineBuckets,d=0;c>d;++d){r=a[d],o=r._propertiesChanged;var p=r._bucket,m=0;for(var v in h)if(h.hasOwnProperty(v)){if(h[v]===p){(o[W]||o[V]||o[U])&&p.writeUpdate(m,r,this._positionBuffer,this._texCoordExpandWidthAndShowBuffer,n);break}m+=h[v].lengthOfPositions}r._clean()}a.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(var g=0;q>g;++g)o[g]=0;var _=f.IDENTITY;t.mode===P.SCENE3D&&(_=this.modelMatrix);var y=t.passes,C=0!==t.morphTime;if(s(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===C||(this._opaqueRS=e.createRenderState({depthMask:C,depthTest:{enabled:C}})),s(this._translucentRS)&&this._translucentRS.depthTest.enabled===C||(this._translucentRS=e.createRenderState({blending:E.ALPHA_BLEND,depthMask:!C,depthTest:{enabled:C}})),y.render){var w=this._colorCommands; -A(this,e,t,w,i,_,!0)}if(y.pick){var S=this._pickCommands;A(this,e,t,S,i,_,!1)}}};var X=new e,Z=new e;Y.prototype.isDestroyed=function(){return!1},Y.prototype.destroy=function(){return F(this),N(this),B(this),u(this)};var J=[0,0,0],Q=[];Y.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,this._polylinesToUpdate.push(e),++this._propertiesChanged[t]};var K=function(e,t,i){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.pickShaderProgram=void 0,this.mode=t,this.modelMatrix=i};K.prototype.addPolyline=function(e){var t=this.polylines;t.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},K.prototype.updateShader=function(e){if(!s(this.shaderProgram)){var t=new y({sources:[C,S]}),i=new y({sources:[this.material.shaderSource,w]}),r=new y({sources:i.sources,pickColorQualifier:"varying"});this.shaderProgram=e.createShaderProgram(t,i,j),this.pickShaderProgram=e.createShaderProgram(t,r,j)}},K.prototype.getPolylinePositionsLength=function(e){var t;if(this.mode===P.SCENE3D||!k(e))return t=e._actualPositions.length,4*t-4;var i=0,r=e._segments.lengths;t=r.length;for(var n=0;t>n;++n)i+=4*r[n]-4;return i};var $=new t,et=new t,tt=new t,it=new t;K.prototype.write=function(e,i,r,o,a,s,l,u){for(var c=this.mode,d=this.polylines,p=d.length,m=0;p>m;++m)for(var f,v=d[m],g=v.width,_=v.show&&g>0,y=this.getSegments(v,u),C=y.positions,w=y.lengths,S=C.length,E=v.getPickId(l).color,b=0,x=0,T=0;S>T;++T){0===T?v._loop?f=C[S-2]:(f=it,t.subtract(C[0],C[1],f),t.add(C[0],f,f)):f=C[T-1],et.x=f.x,et.y=f.y,et.z=c!==P.SCENE2D?f.z:0,f=C[T],$.x=f.x,$.y=f.y,$.z=c!==P.SCENE2D?f.z:0,T===S-1?v._loop?f=C[1]:(f=it,t.subtract(C[S-1],C[S-2],f),t.add(C[S-1],f,f)):f=C[T+1],tt.x=f.x,tt.y=f.y,tt.z=c!==P.SCENE2D?f.z:0;var A=w[b];T===x+A&&(x+=A,++b);for(var D=0===T-x,M=T===x+w[b]-1,I=D?2:0,O=M?2:4,R=I;O>R;++R){h.writeElements($,e,o),h.writeElements(et,e,o+6),h.writeElements(tt,e,o+12),i[a]=n.floatToByte(E.red),i[a+1]=n.floatToByte(E.green),i[a+2]=n.floatToByte(E.blue),i[a+3]=n.floatToByte(E.alpha);var L=0>R-2?-1:1;r[s]=T/(S-1),r[s+1]=2*(R%2)-1,r[s+2]=L*g,r[s+3]=_,o+=18,a+=4,s+=4}}};var rt=new t,nt=new t,ot=new t,at=new t;K.prototype.writeForMorph=function(e,i){for(var r=this.modelMatrix,n=this.polylines,o=n.length,a=0;o>a;++a)for(var s=n[a],l=s._segments.positions,u=s._segments.lengths,c=l.length,d=0,p=0,m=0;c>m;++m){var v;0===m?s._loop?v=l[c-2]:(v=at,t.subtract(l[0],l[1],v),t.add(l[0],v,v)):v=l[m-1],v=f.multiplyByPoint(r,v,nt);var g,_=f.multiplyByPoint(r,l[m],rt);m===c-1?s._loop?g=l[1]:(g=at,t.subtract(l[c-1],l[c-2],g),t.add(l[c-1],g,g)):g=l[m+1],g=f.multiplyByPoint(r,g,ot);var y=u[d];m===p+y&&(p+=y,++d);for(var C=0===m-p,w=m===p+u[d]-1,S=C?2:0,E=w?2:4,b=S;E>b;++b)h.writeElements(_,e,i),h.writeElements(v,e,i+6),h.writeElements(g,e,i+12),i+=18}};var st=new Array(1);K.prototype.updateIndices=function(e,t,i,r){var n=i.length-1,o=new z(0,r,this);i[n].push(o);var a=0,s=e[e.length-1],l=0;s.length>0&&(l=s[s.length-1]+1);for(var u=this.polylines,c=u.length,h=0;c>h;++h){var d=u[h];d._locatorBuckets=[];var p;if(this.mode===P.SCENE3D){p=st;var f=d._actualPositions.length;if(!(f>0))continue;p[0]=f}else p=d._segments.lengths;var v=p.length;if(v>0){for(var g=0,_=0;v>_;++_)for(var y=p[_]-1,C=0;y>C;++C)l+4>=m.SIXTY_FOUR_KILOBYTES-1&&(d._locatorBuckets.push({locator:o,count:g}),g=0,t.push(4),s=[],e.push(s),l=0,o.count=a,a=0,r=0,o=new z(0,0,this),i[++n]=[o]),s.push(l,l+2,l+1),s.push(l+1,l+2,l+3),g+=6,a+=6,r+=6,l+=4;d._locatorBuckets.push({locator:o,count:g}),l+4>=m.SIXTY_FOUR_KILOBYTES-1&&(t.push(0),s=[],e.push(s),l=0,o.count=a,r=0,a=0,o=new z(0,0,this),i[++n]=[o])}d._clean()}return o.count=a,r},K.prototype.getPolylineStartIndex=function(e){for(var t=this.polylines,i=0,r=t.length,n=0;r>n;++n){var o=t[n];if(o===e)break;i+=o._actualLength}return i};var lt={positions:void 0,lengths:void 0},ut=new Array(1),ct=new t,ht=new r;K.prototype.getSegments=function(i,r){var n=i._actualPositions;if(this.mode===P.SCENE3D)return ut[0]=n.length,lt.positions=n,lt.lengths=ut,lt;k(i)&&(n=i._segments.positions);for(var o,a=r.ellipsoid,s=[],l=this.modelMatrix,u=n.length,c=ct,h=0;u>h;++h)o=n[h],c=f.multiplyByPoint(l,o,c),s.push(r.project(a.cartesianToCartographic(c,ht)));if(s.length>0){i._boundingVolume2D=e.fromPoints(s,i._boundingVolume2D);var d=i._boundingVolume2D.center;i._boundingVolume2D.center=new t(d.z,d.x,d.y)}return lt.positions=s,lt.lengths=i._segments.lengths,lt};var dt,pt;return K.prototype.writeUpdate=function(e,i,r,n,o){var a=this.mode,l=i._actualLength;if(l){e+=this.getPolylineStartIndex(i);var u=dt,c=pt,d=3*6*l;!s(u)||u.lengthd&&(u=new Float32Array(u.buffer,0,d),c=new Float32Array(c.buffer,0,4*l));var p,m=0,f=0,v=this.getSegments(i,o),g=v.positions,_=v.lengths,y=0,C=0,w=i.width,S=i.show&&w>0;l=g.length;for(var E=0;l>E;++E){0===E?i._loop?p=g[l-2]:(p=it,t.subtract(g[0],g[1],p),t.add(g[0],p,p)):p=g[E-1],et.x=p.x,et.y=p.y,et.z=a!==P.SCENE2D?p.z:0,p=g[E],$.x=p.x,$.y=p.y,$.z=a!==P.SCENE2D?p.z:0,E===l-1?i._loop?p=g[1]:(p=it,t.subtract(g[l-1],g[l-2],p),t.add(g[l-1],p,p)):p=g[E+1],tt.x=p.x,tt.y=p.y,tt.z=a!==P.SCENE2D?p.z:0;var b=_[y];E===C+b&&(C+=b,++y);for(var x=0===E-C,T=E===C+_[y]-1,A=x?2:0,D=T?2:4,M=A;D>M;++M){h.writeElements($,u,m),h.writeElements(et,u,m+6),h.writeElements(tt,u,m+12);var I=0>M-2?-1:1;c[f]=E/(l-1),c[f+1]=2*(M%2)-1,c[f+2]=I*w,c[f+3]=S,m+=18,f+=4}}r.copyFromArrayView(u,18*Float32Array.BYTES_PER_ELEMENT*e),n.copyFromArrayView(c,4*Float32Array.BYTES_PER_ELEMENT*e)}},Y}),i("DataSources/ScaledPositionProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/ReferenceFrame","./Property"],function(e,t,i,r,n,o,a){"use strict";var s=function(e){this._definitionChanged=new n,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)};return t(s.prototype,{isConstant:{get:function(){return a.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return e(this._value)?this._value.referenceFrame:o.FIXED}}}),s.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},s.prototype.setValue=function(t){this._value!==t&&(this._value=t,e(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),e(t)&&(this._removeSubscription=t.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},s.prototype.getValueInReferenceFrame=function(t,i,n){return e(this._value)?(n=this._value.getValueInReferenceFrame(t,i,n),e(n)?r.WGS84.scaleToGeodeticSurface(n,n):void 0):void 0},s.prototype.equals=function(e){return this===e||e instanceof s&&this._value===e._value},s.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},s}),i("DataSources/PathVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/JulianDate","../Core/Matrix3","../Core/Matrix4","../Core/ReferenceFrame","../Core/TimeInterval","../Core/Transforms","../Scene/PolylineCollection","../Scene/SceneMode","./CompositePositionProperty","./ConstantPositionProperty","./MaterialProperty","./Property","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionPositionProperty"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function w(e,t,r,n,a,s,l,u,c){var h,d=u;h=e.getValueInReferenceFrame(t,s,c[d]),i(h)&&(c[d++]=h);for(var p,m,f,v=!i(a)||o.lessThanOrEquals(a,t)||o.greaterThanOrEquals(a,r),g=0,_=n.length,y=n[g],C=r,w=!1;_>g;){if(!v&&o.greaterThanOrEquals(y,a)&&(h=e.getValueInReferenceFrame(a,s,c[d]),i(h)&&(c[d++]=h),v=!0),o.greaterThan(y,t)&&o.lessThan(y,C)&&!y.equals(a)&&(h=e.getValueInReferenceFrame(y,s,c[d]),i(h)&&(c[d++]=h)),_-1>g){if(l>0&&!w){var S=n[g+1],E=o.secondsDifference(S,y);w=E>l,w&&(p=Math.ceil(E/l),m=0,f=E/Math.max(p,2),p=Math.max(p-1,1))}if(w&&p>m){y=o.addSeconds(y,f,new o),m++;continue}}w=!1,g++,y=n[g]}return h=e.getValueInReferenceFrame(r,s,c[d]),i(h)&&(c[d++]=h),d}function S(e,t,r,n,a,s,l,u){for(var c,h=0,d=l,p=t,m=Math.max(s,60),f=!i(n)||o.lessThanOrEquals(n,t)||o.greaterThanOrEquals(n,r);o.lessThan(p,r);)!f&&o.greaterThanOrEquals(p,n)&&(f=!0,c=e.getValueInReferenceFrame(n,a,u[d]),i(c)&&(u[d]=c,d++)),c=e.getValueInReferenceFrame(p,a,u[d]),i(c)&&(u[d]=c,d++),h++,p=o.addSeconds(t,m*h,new o);return c=e.getValueInReferenceFrame(r,a,u[d]),i(c)&&(u[d]=c,d++),d}function E(e,t,r,n,a,s,l,c){O.start=t,O.stop=r;for(var h=l,d=e.intervals,p=0;p0){var b=S.pop();c=this._polylineCollection.get(b),t.index=b}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=a,t.polyline=c}var x=v.getValueOrDefault(s._resolution,e,A);c.show=!0,c.positions=P(l,r,n,e,this._referenceFrame,x,c.positions),c.material=f.getValue(e,s._material,c.material),c.width=v.getValueOrDefault(s._width,e,D)},N.prototype.removeObject=function(e){var t=e.polyline;i(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,e.index=void 0)},N.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),r(this)};var F=function(t,i){i.collectionChanged.addEventListener(F.prototype._onCollectionChanged,this),this._scene=t,this._updaters={},this._entityCollection=i,this._items=new e,this._onCollectionChanged(i,i.values,[],[])};return F.prototype.update=function(e){var t=this._updaters;for(var r in t)t.hasOwnProperty(r)&&t[r].update(e);for(var n=this._items.values,o=0,a=n.length;a>o;o++){var s=n[o],u=s.entity,c=u._position,h=s.updater,p=l.FIXED;this._scene.mode===d.SCENE3D&&(p=c.referenceFrame);var m=this._updaters[p];h===m&&i(m)?m.updateObject(e,s):(i(h)&&h.removeObject(s),i(m)||(m=new N(this._scene,p),m.update(e),this._updaters[p]=m),s.updater=m,i(m)&&m.updateObject(e,s))}return!0},F.prototype.isDestroyed=function(){return!1},F.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(F.prototype._onCollectionChanged,this);var e=this._updaters;for(var t in e)e.hasOwnProperty(t)&&e[t].destroy();return r(this)},F.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],i(a._path)&&i(a._position)&&l.set(a.id,new R(a));for(o=n.length-1;o>-1;o--)a=n[o],i(a._path)&&i(a._position)?l.contains(a.id)||l.set(a.id,new R(a)):(s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id)));for(o=r.length-1;o>-1;o--)a=r[o],s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id))},F._subSample=P,F}),i("Shaders/PointPrimitiveCollectionFS",[],function(){"use strict";return"varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nvoid main()\n{\nfloat distanceToCenter = length(gl_PointCoord - vec2(0.5));\nfloat maxDistance = max(0.0, 0.5 - v_pixelDistance);\nfloat wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\nfloat innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\nvec4 color = mix(v_outlineColor, v_color, innerAlpha);\ncolor.a *= wholeAlpha;\nif (color.a < 0.005)\n{\ndiscard;\n}\n#ifdef RENDER_FOR_PICK\ngl_FragColor = v_pickColor;\n#else\ngl_FragColor = color;\n#endif\n}\n"}),i("Shaders/PointPrimitiveCollectionVS",[],function(){"use strict";return"uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nvoid main()\n{\nvec3 positionHigh = positionHighAndSize.xyz;\nvec3 positionLow = positionLowAndOutline.xyz;\nfloat outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\nfloat totalSize = positionHighAndSize.w + outlineWidthBothSides;\nfloat outlinePercent = outlineWidthBothSides / totalSize;\ntotalSize *= czm_resolutionScale;\ntotalSize += 3.0;\nfloat temp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat show = floor(temp);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\nvec4 color;\nvec4 outlineColor;\n#ifdef RENDER_FOR_PICK\ncolor = vec4(0.0);\noutlineColor = vec4(0.0);\nvec4 pickColor;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\n#else\ntemp = compressedAttribute0.x * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute0.y * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\n#endif\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\n#ifdef RENDER_FOR_PICK\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\n#endif\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\ntotalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\ntotalSize = min(totalSize, u_maxTotalPointSize);\nif (totalSize < 1.0)\n{\npositionEC.xyz = vec3(0.0);\ntotalSize = 1.0;\n}\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency < 0.004)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\nv_color = color;\nv_color.a *= translucency;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize;\n#ifdef RENDER_FOR_PICK\nv_pickColor = pickColor;\n#endif\n}\n"}),i("Scene/PointPrimitive",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/NearFarScalar","./SceneMode","./SceneTransforms"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,t){var i=e._pointPrimitiveCollection;o(i)&&(i._updatePointPrimitive(e,t),e._dirty=!0)}var p=function(e,i){e=n(e,n.EMPTY_OBJECT),this._show=n(e.show,!0),this._position=t.clone(n(e.position,t.ZERO)),this._actualPosition=t.clone(this._position),this._color=r.clone(n(e.color,r.WHITE)),this._outlineColor=r.clone(n(e.outlineColor,r.TRANSPARENT)),this._outlineWidth=n(e.outlineWidth,0),this._pixelSize=n(e.pixelSize,10),this._scaleByDistance=e.scaleByDistance,this._translucencyByDistance=e.translucencyByDistance,this._id=e.id,this._collection=n(e.collection,i),this._pickId=void 0,this._pointPrimitiveCollection=i,this._dirty=!1,this._index=-1},m=p.SHOW_INDEX=0,f=p.POSITION_INDEX=1,v=p.COLOR_INDEX=2,g=p.OUTLINE_COLOR_INDEX=3,_=p.OUTLINE_WIDTH_INDEX=4,y=p.PIXEL_SIZE_INDEX=5,C=p.SCALE_BY_DISTANCE_INDEX=6,w=p.TRANSLUCENCY_BY_DISTANCE_INDEX=7;p.NUMBER_OF_PROPERTIES=8,a(p.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,d(this,m))}},position:{get:function(){return this._position},set:function(e){var i=this._position;t.equals(i,e)||(t.clone(e,i),t.clone(e,this._actualPosition),d(this,f))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;u.equals(t,e)||(this._scaleByDistance=u.clone(e,t),d(this,C))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;u.equals(t,e)||(this._translucencyByDistance=u.clone(e,t),d(this,w))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,d(this,y))}},color:{get:function(){return this._color},set:function(e){var t=this._color;r.equals(t,e)||(r.clone(e,t),d(this,v))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;r.equals(t,e)||(r.clone(e,t),d(this,g))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,d(this,_))}},id:{get:function(){return this._id},set:function(e){this._id=e,o(this._pickId)&&(this._pickId.object.id=e)}}}),p.prototype.getPickId=function(e){return o(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},p.prototype._getActualPosition=function(){return this._actualPosition},p.prototype._setActualPosition=function(e){t.clone(e,this._actualPosition),d(this,f)};var S=new i;p._computeActualPosition=function(e,t,i){return t.mode===c.SCENE3D?e:(l.multiplyByPoint(i,e,S),h.computeActualWgs84Position(t,S))};var E=new l,b=new i;return p._computeScreenSpacePosition=function(e,t,r,n){var o=r.camera,a=o.viewMatrix,s=o.frustum.projectionMatrix,u=l.multiplyTransformation(a,e,E),c=l.multiplyByVector(u,i.fromElements(t.x,t.y,t.z,1,b),b),d=l.multiplyByVector(s,c,b),p=h.clipToGLWindowCoordinates(r,d,n);return p},p.prototype.computeScreenSpacePosition=function(t,i){var r=this._pointPrimitiveCollection;o(i)||(i=new e);var n=r.modelMatrix,a=p._computeScreenSpacePosition(n,this._actualPosition,t,i);return a.y=t.canvas.clientHeight-a.y,a},p.prototype.equals=function(e){return this===e||o(e)&&this._id===e._id&&t.equals(this._position,e._position)&&r.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&r.equals(this._outlineColor,e._outlineColor)&&u.equals(this._scaleByDistance,e._scaleByDistance)&&u.equals(this._translucencyByDistance,e._translucencyByDistance)},p.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0},p}),i("Scene/PointPrimitiveCollection",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/Math","../Core/Matrix4","../Core/PrimitiveType","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/ShaderSource","../Renderer/VertexArrayFacade","../Shaders/PointPrimitiveCollectionFS","../Shaders/PointPrimitiveCollectionVS","./PointPrimitive","./BlendingState","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E){"use strict";function b(e){for(var t=e.length,i=0;t>i;++i)e[i]&&e[i]._destroy()}function x(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;for(var t=[],i=e._pointPrimitives,r=i.length,n=0,o=0;r>n;++n){var a=i[n];a&&(a._index=o++,t.push(a))}e._pointPrimitives=t}}function T(e,t,i){return new g(e,[{index:H.positionHighAndSize,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[F]},{index:H.positionLowAndShow,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[F]},{index:H.compressedAttribute0,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[B]},{index:H.compressedAttribute1,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[W]},{index:H.scaleByDistance,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[U]}],t)}function P(t,i,r,n){var o=n._index,a=n._getActualPosition();t._mode===E.SCENE3D&&(e.expand(t._baseVolume,a,t._baseVolume),t._boundingVolumeDirty=!0),c.fromCartesian(a,j);var s=n.pixelSize,l=n.outlineWidth;t._maxPixelSize=Math.max(t._maxPixelSize,s+l);var u=r[H.positionHighAndSize],h=j.high;u(o,h.x,h.y,h.z,s);var d=r[H.positionLowAndOutline],p=j.low;d(o,p.x,p.y,p.z,l)}function A(e,t,i,n){var o=n._index,a=n.color,s=n.getPickId(t).color,l=n.outlineColor,u=r.floatToByte(a.red),c=r.floatToByte(a.green),h=r.floatToByte(a.blue),d=u*Y+c*X+h;u=r.floatToByte(l.red),c=r.floatToByte(l.green),h=r.floatToByte(l.blue);var p=u*Y+c*X+h;u=r.floatToByte(s.red),c=r.floatToByte(s.green),h=r.floatToByte(s.blue);var m=u*Y+c*X+h,f=r.floatToByte(a.alpha)*Y+r.floatToByte(l.alpha)*X+r.floatToByte(s.alpha),v=i[H.compressedAttribute0];v(o,d,p,m,f)}function D(e,t,i,r){var n=r._index,o=0,s=1,l=1,u=1,c=r.translucencyByDistance;a(c)&&(o=c.near,s=c.nearValue,l=c.far,u=c.farValue,(1!==s||1!==u)&&(e._shaderTranslucencyByDistance=!0));var d=r.show;0===r.color.alpha&&0===r.outlineColor.alpha&&(d=!1),s=h.clamp(s,0,1),s=1===s?255:0|255*s;var p=(d?1:0)*X+s;u=h.clamp(u,0,1),u=1===u?255:0|255*u;var m=u,f=i[H.compressedAttribute1];f(n,p,m,o,l)}function M(e,t,i,r){var n=r._index,o=i[H.scaleByDistance],s=0,l=1,u=1,c=1,h=r.scaleByDistance;a(h)&&(s=h.near,l=h.nearValue,u=h.far,c=h.farValue,(1!==l||1!==c)&&(e._shaderScaleByDistance=!0)),o(n,s,l,u,c)}function I(e,t,i,r){P(e,t,i,r),A(e,t,i,r),D(e,t,i,r),M(e,t,i,r)}function O(t,i,r,n,o,s){var l;n.mode===E.SCENE3D?(l=t._baseVolume,t._boundingVolumeDirty=!0):l=t._baseVolume2D;for(var u=[],c=0;r>c;++c){var h=i[c],d=h.position,p=C._computeActualPosition(d,n,o);a(p)&&(h._setActualPosition(p),s?u.push(p):e.expand(l,p,l))}s&&e.fromPoints(u,l)}function R(e,t){var i=t.mode,r=e._pointPrimitives,n=e._pointPrimitivesToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==E.SCENE3D&&!d.equals(o,e.modelMatrix)?(e._mode=i,d.clone(e.modelMatrix,o),e._createVertexArray=!0,(i===E.SCENE3D||i===E.SCENE2D||i===E.COLUMBUS_VIEW)&&O(e,r,r.length,t,o,!0)):i===E.MORPHING?O(e,r,r.length,t,o,!0):(i===E.SCENE2D||i===E.COLUMBUS_VIEW)&&O(e,n,e._pointPrimitivesToUpdateIndex,t,o,!1)}function L(e,t,r,n){var o=r.camera,a=o.frustum,s=i.subtract(o.positionWC,n.center,J),l=i.multiplyByScalar(o.directionWC,i.dot(s,o.directionWC),Q),u=Math.max(0,i.magnitude(l)-n.radius);Z.x=t.drawingBufferWidth,Z.y=t.drawingBufferHeight;var c=a.getPixelSize(Z,u),h=Math.max(c.x,c.y),d=h*e._maxPixelSize;n.radius+=d}var N=C.SHOW_INDEX,F=C.POSITION_INDEX,B=C.COLOR_INDEX,z=C.OUTLINE_COLOR_INDEX,k=C.OUTLINE_WIDTH_INDEX,V=C.PIXEL_SIZE_INDEX,U=C.SCALE_BY_DISTANCE_INDEX,W=C.TRANSLUCENCY_BY_DISTANCE_INDEX,G=C.NUMBER_OF_PROPERTIES,H={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4},q=function(t){t=o(t,o.EMPTY_OBJECT),this._sp=void 0,this._rs=void 0,this._vaf=void 0,this._spPick=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._compiledShaderScaleByDistancePick=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistancePick=!1,this._propertiesChanged=new Uint32Array(G),this._maxPixelSize=1,this._baseVolume=new e,this._baseVolumeWC=new e,this._baseVolume2D=new e,this._boundingVolume=new e,this._boundingVolumeDirty=!1,this._colorCommands=[],this._pickCommands=[],this.modelMatrix=d.clone(o(t.modelMatrix,d.IDENTITY)),this._modelMatrix=d.clone(d.IDENTITY),this.debugShowBoundingVolume=o(t.debugShowBoundingVolume,!1),this._mode=E.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW];var i=this;this._uniforms={u_maxTotalPointSize:function(){return i._maxTotalPointSize}}};s(q.prototype,{length:{get:function(){return x(this),this._pointPrimitives.length}}}),q.prototype.add=function(e){var t=new C(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},q.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1},q.prototype.removeAll=function(){b(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},q.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},q.prototype.contains=function(e){return a(e)&&e._pointPrimitiveCollection===this},q.prototype.get=function(e){return x(this),this._pointPrimitives[e]},q.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;G>r;++r){var n=0===i[r]?m.STATIC_DRAW:m.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var j=new c,Y=65536,X=256,Z=new t,J=new i,Q=new i,K=[];return q.prototype.update=function(t,i,r){x(this),this._maxTotalPointSize=t.maximumAliasedPointSize,R(this,i);var n,o=this._pointPrimitives,s=o.length,l=this._pointPrimitivesToUpdate,u=this._pointPrimitivesToUpdateIndex,c=this._propertiesChanged,h=this._createVertexArray,m=i.passes,g=m.pick;if(h||!g&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var C=0;G>C;++C)c[C]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),s>0){this._vaf=T(t,s,this._buffersUsage),n=this._vaf.writers;for(var b=0;s>b;++b){var O=this._pointPrimitives[b];O._dirty=!1,I(this,t,n,O)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(u>0){var q=K;q.length=0,(c[F]||c[k]||c[V])&&q.push(P),(c[B]||c[z])&&q.push(A),(c[N]||c[W])&&q.push(D),c[U]&&q.push(M);var j=q.length;if(n=this._vaf.writers,u/s>.1){for(var Y=0;u>Y;++Y){var X=l[Y];X._dirty=!1;for(var Z=0;j>Z;++Z)q[Z](this,t,n,X)}this._vaf.commit()}else{for(var J=0;u>J;++J){var Q=l[J];Q._dirty=!1;for(var $=0;j>$;++$)q[$](this,t,n,Q);this._vaf.subCommit(Q._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(u>1.5*s&&(l.length=s),a(this._vaf)&&a(this._vaf.va)){this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,e.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var et,tt=d.IDENTITY;i.mode===E.SCENE3D?(tt=this.modelMatrix,et=e.clone(this._baseVolumeWC,this._boundingVolume)):et=e.clone(this._baseVolume2D,this._boundingVolume),L(this,t,i,et);var it,rt,nt,ot,at,st;if(m.render){var lt=this._colorCommands;for(a(this._rs)||(this._rs=t.createRenderState({depthTest:{enabled:!0},blending:w.ALPHA_BLEND})),(!a(this._sp)||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance)&&(at=new v({sources:[y]}),this._shaderScaleByDistance&&at.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&at.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._sp=t.replaceShaderProgram(this._sp,at,_,H),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance),it=this._vaf.va,rt=it.length,lt.length=rt,ot=0;rt>ot;++ot)nt=lt[ot],a(nt)||(nt=lt[ot]=new f({primitiveType:p.POINTS,pass:S.OPAQUE,owner:this})),nt.boundingVolume=et,nt.modelMatrix=tt,nt.shaderProgram=this._sp,nt.uniformMap=this._uniforms,nt.vertexArray=it[ot].va,nt.renderState=this._rs,nt.debugShowBoundingVolume=this.debugShowBoundingVolume,r.push(nt)}if(g){var ut=this._pickCommands;for((!a(this._spPick)||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistancePick||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistancePick)&&(at=new v({defines:["RENDER_FOR_PICK"],sources:[y]}),this._shaderScaleByDistance&&at.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&at.defines.push("EYE_DISTANCE_TRANSLUCENCY"),st=new v({defines:["RENDER_FOR_PICK"],sources:[_]}),this._spPick=t.replaceShaderProgram(this._spPick,at,st,H),this._compiledShaderScaleByDistancePick=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistancePick=this._shaderTranslucencyByDistance),it=this._vaf.va,rt=it.length,ut.length=rt,ot=0;rt>ot;++ot)nt=ut[ot],a(nt)||(nt=ut[ot]=new f({primitiveType:p.POINTS,pass:S.OPAQUE,owner:this})),nt.boundingVolume=et,nt.modelMatrix=tt,nt.shaderProgram=this._spPick,nt.uniformMap=this._uniforms,nt.vertexArray=it[ot].va,nt.renderState=this._rs,r.push(nt)}}},q.prototype.isDestroyed=function(){return!1},q.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),b(this._pointPrimitives),l(this)},q}),i("DataSources/PointVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/NearFarScalar","../Scene/PointPrimitiveCollection","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e,t){if(r(e)){var i=e.pointPrimitive;r(i)&&(e.pointPrimitive=void 0,i.show=!1,t.push(i._index))}}var h=i.WHITE,d=i.BLACK,p=0,m=1,f=new i,v=new t,g=new i,_=new a,y=new a,C=function(e){this.entity=e,this.pointPrimitive=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0 -},w=function(t,i){i.collectionChanged.addEventListener(w.prototype._onCollectionChanged,this),this._scene=t,this._unusedIndexes=[],this._entityCollection=i,this._pointPrimitiveCollection=void 0,this._items=new e,this._onCollectionChanged(i,i.values,[],[])};return w.prototype.update=function(e){for(var t=this._items.values,i=this._unusedIndexes,n=0,o=t.length;o>n;n++){var a=t[n],l=a.entity,C=l._point,w=a.pointPrimitive,S=l.isShowing&&l.isAvailable(e)&&u.getValueOrDefault(C._show,e,!0);if(S&&(v=u.getValueOrUndefined(l._position,e,v),S=r(v)),S){if(!r(w)){var E=this._pointPrimitiveCollection;r(E)||(E=new s,this._pointPrimitiveCollection=E,this._scene.primitives.add(E));var b=i.length;w=b>0?E.get(i.pop()):E.add(),w.id=l,a.pointPrimitive=w}w.show=!0,w.position=v,w.scaleByDistance=u.getValueOrUndefined(C._scaleByDistance,e,_),w.translucencyByDistance=u.getValueOrUndefined(C._translucencyByDistance,e,y),w.color=u.getValueOrDefault(C._color,e,h,f),w.outlineColor=u.getValueOrDefault(C._outlineColor,e,d,g),w.outlineWidth=u.getValueOrDefault(C._outlineWidth,e,p),w.pixelSize=u.getValueOrDefault(C._pixelSize,e,m)}else c(a,i)}return!0},w.prototype.getBoundingSphere=function(e,i){var n=this._items.get(e.id);return r(n)&&r(n.pointPrimitive)?(i.center=t.clone(n.pointPrimitive.position,i.center),i.radius=0,l.DONE):l.FAILED},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){return this._entityCollection.collectionChanged.removeEventListener(w.prototype._onCollectionChanged,this),r(this._pointPrimitiveCollection)&&this._scene.primitives.remove(this._pointPrimitiveCollection),n(this)},w.prototype._onCollectionChanged=function(e,t,i,n){var o,a,s=this._unusedIndexes,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],r(a._point)&&r(a._position)&&l.set(a.id,new C(a));for(o=n.length-1;o>-1;o--)a=n[o],r(a._point)&&r(a._position)?l.contains(a.id)||l.set(a.id,new C(a)):(c(l.get(a.id),s),l.remove(a.id));for(o=i.length-1;o>-1;o--)a=i[o],c(l.get(a.id),s),l.remove(a.id)},w}),i("DataSources/PolygonGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/isArray","../Core/Iso8601","../Core/PolygonGeometry","../Core/PolygonHierarchy","../Core/PolygonOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S){"use strict";var E=new _(e.WHITE),b=new y(!0),x=new y(!0),T=new y(!1),P=new y(e.BLACK),A=new e,D=function(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0},M=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(M.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new D(e),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)};n(M,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:f}}),n(M.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&S.isConstant(this._showProperty)&&S.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&S.isConstant(this._showProperty)&&S.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),M.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},M.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},M.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new m(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof _){var c=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(c=this._materialProperty.color.getValue(i)),o=t.fromColor(c),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new h(this._options),attributes:n})},M.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=S.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new p(this._options),attributes:{show:new m(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},M.prototype.isDestroyed=function(){return!1},M.prototype.destroy=function(){this._entitySubscription(),o(this)},M.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"polygon"===t){var n=this._entity.polygon;if(!r(n))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var o=n.fill,a=r(o)&&o.isConstant?o.getValue(c.MINIMUM_VALUE):!0,s=n.outline,l=r(s);if(l&&s.isConstant&&(l=s.getValue(c.MINIMUM_VALUE)),!a&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var h=n.hierarchy,p=n.show;if(r(p)&&p.isConstant&&!p.getValue(c.MINIMUM_VALUE)||!r(h))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var m=i(n.material,E),g=m instanceof _;this._materialProperty=m,this._fillProperty=i(o,x),this._showProperty=i(p,b),this._showOutlineProperty=i(n.outline,T),this._outlineColorProperty=l?i(n.outlineColor,P):void 0;var y=n.height,C=n.extrudedHeight,w=n.granularity,A=n.stRotation,D=n.outlineWidth,M=n.perPositionHeight;if(this._fillEnabled=a,this._outlineEnabled=l,h.isConstant&&S.isConstant(y)&&S.isConstant(C)&&S.isConstant(w)&&S.isConstant(A)&&S.isConstant(D)&&S.isConstant(M)){var I=this._options;I.vertexFormat=g?v.VERTEX_FORMAT:f.MaterialSupport.TEXTURED.vertexFormat;var O=h.getValue(c.MINIMUM_VALUE);u(O)&&(O=new d(O));var R=r(y)?y.getValue(c.MINIMUM_VALUE):void 0,L=r(C)?C.getValue(c.MINIMUM_VALUE):void 0;I.polygonHierarchy=O,I.height=R,I.extrudedHeight=L,I.granularity=r(w)?w.getValue(c.MINIMUM_VALUE):void 0,I.stRotation=r(A)?A.getValue(c.MINIMUM_VALUE):void 0,I.perPositionHeight=r(M)?M.getValue(c.MINIMUM_VALUE):void 0,this._outlineWidth=r(D)?D.getValue(c.MINIMUM_VALUE):1,this._isClosed=r(L)&&L!==R,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},M.prototype.createDynamicUpdater=function(e){return new I(e,this)};var I=function(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new D(t._entity)};return I.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.polygon;if(a.isShowing&&a.isAvailable(i)&&S.getValueOrDefault(s.show,i,!0)){var c=this._options,m=S.getValueOrUndefined(s.hierarchy,i);if(r(m)){if(c.polygonHierarchy=u(m)?new d(m):m,c.height=S.getValueOrUndefined(s.height,i),c.extrudedHeight=S.getValueOrUndefined(s.extrudedHeight,i),c.granularity=S.getValueOrUndefined(s.granularity,i),c.stRotation=S.getValueOrUndefined(s.stRotation,i),c.perPositionHeight=S.getValueOrUndefined(s.perPositionHeight,i),S.getValueOrDefault(s.fill,i,!0)){var _=w.getValue(i,o.fillMaterialProperty,this._material);this._material=_;var y=new f({material:_,translucent:_.isTranslucent(),closed:r(c.extrudedHeight)&&c.extrudedHeight!==c.height});c.vertexFormat=y.vertexFormat,this._primitive=n.add(new g({geometryInstances:new l({id:a,geometry:new h(c)}),appearance:y,asynchronous:!1}))}if(S.getValueOrDefault(s.outline,i,!1)){c.vertexFormat=v.VERTEX_FORMAT;var C=S.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,A),E=S.getValueOrDefault(s.outlineWidth,i,1),b=1!==C.alpha;this._outlinePrimitive=n.add(new g({geometryInstances:new l({id:a,geometry:new p(c),attributes:{color:t.fromColor(C)}}),appearance:new v({flat:!0,translucent:b,renderState:{lineWidth:o._scene.clampLineWidth(E)}}),asynchronous:!1}))}}}},I.prototype.getBoundingSphere=function(e,t){return C(e,this._primitive,this._outlinePrimitive,t)},I.prototype.isDestroyed=function(){return!1},I.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},M}),i("Shaders/Appearances/PolylineColorAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nvarying vec4 v_color;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_color = color;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n"}),i("Scene/PolylineColorAppearance",["../Core/defaultValue","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PerInstanceFlatColorAppearanceFS","../Shaders/Appearances/PolylineColorAppearanceVS","../Shaders/PolylineCommon","./Appearance"],function(e,t,i,r,n,o,a){"use strict";var s=o+"\n"+n,l=r,u=function(t){t=e(t,e.EMPTY_OBJECT);var i=e(t.translucent,!0),r=!1,n=u.VERTEX_FORMAT;this.material=void 0,this.translucent=i,this._vertexShaderSource=e(t.vertexShaderSource,s),this._fragmentShaderSource=e(t.fragmentShaderSource,l),this._renderState=a.getDefaultRenderState(i,r,t.renderState),this._closed=r,this._vertexFormat=n};return t(u.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),u.VERTEX_FORMAT=i.POSITION_ONLY,u.prototype.getFragmentShaderSource=a.prototype.getFragmentShaderSource,u.prototype.isTranslucent=a.prototype.isTranslucent,u.prototype.getRenderState=a.prototype.getRenderState,u}),i("Shaders/Appearances/PolylineMaterialAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nvarying float v_width;\nvarying vec2 v_st;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_width = width;\nv_st = st;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n"}),i("Scene/PolylineMaterialAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PolylineMaterialAppearanceVS","../Shaders/PolylineCommon","../Shaders/PolylineFS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s,l){"use strict";var u=o+"\n"+n,c=a,h=function(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),n=!1,o=h.VERTEX_FORMAT;this.material=t(i.material)?i.material:l.fromType(l.ColorType),this.translucent=r,this._vertexShaderSource=e(i.vertexShaderSource,u),this._fragmentShaderSource=e(i.fragmentShaderSource,c),this._renderState=s.getDefaultRenderState(r,n,i.renderState),this._closed=n,this._vertexFormat=o};return i(h.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),h.VERTEX_FORMAT=r.POSITION_AND_ST,h.prototype.getFragmentShaderSource=s.prototype.getFragmentShaderSource,h.prototype.isTranslucent=s.prototype.isTranslucent,h.prototype.getRenderState=s.prototype.getRenderState,h}),i("DataSources/PolylineGeometryUpdater",["../Core/BoundingSphere","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/PolylineGeometry","../Core/PolylinePipeline","../Core/ShowGeometryInstanceAttribute","../Scene/PolylineCollection","../Scene/PolylineColorAppearance","../Scene/PolylineMaterialAppearance","./BoundingSphereState","./ColorMaterialProperty","./ConstantProperty","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S){"use strict";var E={},b=new y(t.WHITE),x=new C(!0),T=function(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.followSurface=void 0,this.granularity=void 0},P=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(P.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._options=new T(e),this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)};o(P,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:g}}),o(P.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!n(this._entity.availability)&&S.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}}}),P.prototype.isOutlineVisible=function(){return!1},P.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)},P.prototype.createFillGeometryInstance=function(e){var r,o,a=this._entity,s=a.isAvailable(e),l=new m(s&&a.isShowing&&this._showProperty.getValue(e));if(this._materialProperty instanceof y){var u=t.WHITE;n(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(u=this._materialProperty.color.getValue(e)),r=i.fromColor(u),o={show:l,color:r}}else o={show:l};return new c({id:a,geometry:new d(this._options),attributes:o})},P.prototype.createOutlineGeometryInstance=function(){},P.prototype.isDestroyed=function(){return!1},P.prototype.destroy=function(){this._entitySubscription(),a(this)},P.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"polyline"===t){var i=this._entity.polyline;if(!n(i))return this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var o=i.positions,a=i.show;if(n(a)&&a.isConstant&&!a.getValue(h.MINIMUM_VALUE)||!n(o))return this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var s=r(i.material,b),l=s instanceof y;this._materialProperty=s,this._showProperty=r(a,x),this._fillEnabled=!0;var u=i.width,c=i.followSurface,d=i.granularity;if(o.isConstant&&S.isConstant(u)&&S.isConstant(c)&&S.isConstant(d)){var p=this._options,m=o.getValue(h.MINIMUM_VALUE,p.positions);if(!n(m)||m.length<2)return this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;p.vertexFormat=l?v.VERTEX_FORMAT:g.VERTEX_FORMAT,p.positions=m,p.width=n(u)?u.getValue(h.MINIMUM_VALUE):void 0,p.followSurface=n(c)?c.getValue(h.MINIMUM_VALUE):void 0,p.granularity=n(d)?d.getValue(h.MINIMUM_VALUE):void 0,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},P.prototype.createDynamicUpdater=function(e){return new A(e,this)};var A=function(e,t){var i=t._scene.id,r=E[i];!n(r)||r.isDestroyed()?(r=new f,E[i]=r,e.add(r)):e.contains(r)||e.add(r);var o=r.add();o.id=t._entity,this._line=o,this._primitives=e,this._geometryUpdater=t,this._positions=[]},D={positions:void 0,granularity:void 0,height:void 0};return A.prototype.update=function(e){var t=this._geometryUpdater,i=t._entity,r=i.polyline,o=this._line;if(!i.isShowing||!i.isAvailable(e)||!S.getValueOrDefault(r._show,e,!0))return o.show=!1,void 0;var a=r.positions,s=S.getValueOrUndefined(a,e,this._positions);if(!n(s)||s.length<2)return o.show=!1,void 0;var l=S.getValueOrDefault(r._followSurface,e,!0);l&&(D.positions=s,D.granularity=S.getValueOrUndefined(r._granularity,e),D.height=p.extractHeights(s,this._geometryUpdater._scene.globe.ellipsoid),s=p.generateCartesianArc(D)),o.show=!0,o.positions=s,o.material=w.getValue(e,t.fillMaterialProperty,o.material),o.width=S.getValueOrDefault(r._width,e,1)},A.prototype.getBoundingSphere=function(t,i){var r=this._line;return r.show&&r.positions.length>0?(e.fromPoints(r.positions,i),_.DONE):_.FAILED},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){var e=this._geometryUpdater,t=e._scene.id,i=E[t];i.remove(this._line),0===i.length&&(this._primitives.removeAndDestroy(i),delete E[t]),a(this)},P}),i("DataSources/PolylineVolumeGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/PolylineVolumeGeometry","../Core/PolylineVolumeOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";var w=new v(e.WHITE),S=new g(!0),E=new g(!0),b=new g(!1),x=new g(e.BLACK),T=new e,P=function(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0},A=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(A.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new P(e),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)};n(A,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(A.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),A.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},A.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},A.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new d(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new c(this._options),attributes:n})},A.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new h(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){this._entitySubscription(),o(this)},A.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"polylineVolume"===t){var n=this._entity.polylineVolume;if(!r(n))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var o=n.fill,a=r(o)&&o.isConstant?o.getValue(u.MINIMUM_VALUE):!0,s=n.outline,l=r(s);if(l&&s.isConstant&&(l=s.getValue(u.MINIMUM_VALUE)),!a&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var c=n.positions,h=n.shape,d=n.show;if(!r(c)||!r(h)||r(d)&&d.isConstant&&!d.getValue(u.MINIMUM_VALUE))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var f=i(n.material,w),g=f instanceof v;this._materialProperty=f,this._fillProperty=i(o,E),this._showProperty=i(d,S),this._showOutlineProperty=i(n.outline,b),this._outlineColorProperty=l?i(n.outlineColor,x):void 0;var _=n.granularity,y=n.outlineWidth,T=n.cornerType;if(this._fillEnabled=a,this._outlineEnabled=l,c.isConstant&&h.isConstant&&C.isConstant(_)&&C.isConstant(y)&&C.isConstant(T)){var P=this._options;P.vertexFormat=g?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,P.polylinePositions=c.getValue(u.MINIMUM_VALUE,P.polylinePositions),P.shapePositions=h.getValue(u.MINIMUM_VALUE,P.shape),P.granularity=r(_)?_.getValue(u.MINIMUM_VALUE):void 0,P.cornerType=r(T)?T.getValue(u.MINIMUM_VALUE):void 0,this._outlineWidth=r(y)?y.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},A.prototype.createDynamicUpdater=function(e){return new D(e,this)};var D=function(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new P(t._entity)};return D.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.polylineVolume;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,d=C.getValueOrUndefined(s.positions,i,u.polylinePositions),v=C.getValueOrUndefined(s.shape,i);if(r(d)&&r(v)){if(u.polylinePositions=d,u.shapePositions=v,u.granularity=C.getValueOrUndefined(s.granularity,i),u.cornerType=C.getValueOrUndefined(s.cornerType,i),!r(s.fill)||s.fill.getValue(i)){var g=y.getValue(i,o.fillMaterialProperty,this._material);this._material=g;var _=new p({material:g,translucent:g.isTranslucent(),closed:!0});u.vertexFormat=_.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new c(u)}),appearance:_,asynchronous:!1}))}if(r(s.outline)&&s.outline.getValue(i)){u.vertexFormat=m.VERTEX_FORMAT;var w=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,T),S=C.getValueOrDefault(s.outlineWidth,i,1),E=1!==w.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u),attributes:{color:t.fromColor(w)}}),appearance:new m({flat:!0,translucent:E,renderState:{lineWidth:o._scene.clampLineWidth(S)}}),asynchronous:!1}))}}}},D.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},D.prototype.isDestroyed=function(){return!1},D.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},A}),i("DataSources/RectangleGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/RectangleGeometry","../Core/RectangleOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";var w=new v(e.WHITE),S=new g(!0),E=new g(!0),b=new g(!1),x=new g(e.BLACK),T=new e,P=function(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.closeBottom=void 0,this.closeTop=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0},A=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(A.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new P(e),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)};n(A,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(A.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),A.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},A.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},A.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new d(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new c(this._options),attributes:n})},A.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new h(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){this._entitySubscription(),o(this)},A.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"rectangle"===t){var n=this._entity.rectangle;if(!r(n))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var o=n.fill,a=r(o)&&o.isConstant?o.getValue(u.MINIMUM_VALUE):!0,s=n.outline,l=r(s);if(l&&s.isConstant&&(l=s.getValue(u.MINIMUM_VALUE)),!a&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var c=n.coordinates,h=n.show;if(r(h)&&h.isConstant&&!h.getValue(u.MINIMUM_VALUE)||!r(c))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var d=i(n.material,w),f=d instanceof v;this._materialProperty=d,this._fillProperty=i(o,E),this._showProperty=i(h,S),this._showOutlineProperty=i(n.outline,b),this._outlineColorProperty=l?i(n.outlineColor,x):void 0;var g=n.height,_=n.extrudedHeight,y=n.granularity,T=n.stRotation,P=n.rotation,A=n.outlineWidth,D=n.closeBottom,M=n.closeTop;if(this._fillEnabled=a,this._outlineEnabled=l,c.isConstant&&C.isConstant(g)&&C.isConstant(_)&&C.isConstant(y)&&C.isConstant(T)&&C.isConstant(P)&&C.isConstant(A)&&C.isConstant(D)&&C.isConstant(M)){var I=this._options;I.vertexFormat=f?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,I.rectangle=c.getValue(u.MINIMUM_VALUE,I.rectangle),I.height=r(g)?g.getValue(u.MINIMUM_VALUE):void 0,I.extrudedHeight=r(_)?_.getValue(u.MINIMUM_VALUE):void 0,I.granularity=r(y)?y.getValue(u.MINIMUM_VALUE):void 0,I.stRotation=r(T)?T.getValue(u.MINIMUM_VALUE):void 0,I.rotation=r(P)?P.getValue(u.MINIMUM_VALUE):void 0,I.closeBottom=r(D)?D.getValue(u.MINIMUM_VALUE):void 0,I.closeTop=r(M)?M.getValue(u.MINIMUM_VALUE):void 0,this._isClosed=r(_)&&r(I.closeTop)&&r(I.closeBottom)&&I.closeTop&&I.closeBottom,this._outlineWidth=r(A)?A.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},A.prototype.createDynamicUpdater=function(e){return new D(e,this)};var D=function(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new P(t._entity)};return D.prototype.update=function(i){var n=this._primitives; -n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.rectangle;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,d=C.getValueOrUndefined(s.coordinates,i,u.rectangle);if(r(d)){if(u.rectangle=d,u.height=C.getValueOrUndefined(s.height,i),u.extrudedHeight=C.getValueOrUndefined(s.extrudedHeight,i),u.granularity=C.getValueOrUndefined(s.granularity,i),u.stRotation=C.getValueOrUndefined(s.stRotation,i),u.rotation=C.getValueOrUndefined(s.rotation,i),u.closeBottom=C.getValueOrUndefined(s.closeBottom,i),u.closeTop=C.getValueOrUndefined(s.closeTop,i),C.getValueOrDefault(s.fill,i,!0)){var v=y.getValue(i,o.fillMaterialProperty,this._material);this._material=v;var g=new p({material:v,translucent:v.isTranslucent(),closed:r(u.extrudedHeight)});u.vertexFormat=g.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new c(u)}),appearance:g,asynchronous:!1}))}if(C.getValueOrDefault(s.outline,i,!1)){u.vertexFormat=m.VERTEX_FORMAT;var _=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,T),w=C.getValueOrDefault(s.outlineWidth,i,1),S=1!==_.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u),attributes:{color:t.fromColor(_)}}),appearance:new m({flat:!0,translucent:S,renderState:{lineWidth:o._scene.clampLineWidth(w)}}),asynchronous:!1}))}}}},D.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},D.prototype.isDestroyed=function(){return!1},D.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},A}),i("DataSources/WallGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Core/WallGeometry","../Core/WallOutlineGeometry","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";var w=new v(e.WHITE),S=new g(!0),E=new g(!0),b=new g(!1),x=new g(e.BLACK),T=new e,P=function(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0},A=function(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(A.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new P(e),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)};n(A,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(A.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return!1}},geometryChanged:{get:function(){return this._geometryChanged}}}),A.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},A.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},A.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new c(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var d=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(d=this._materialProperty.color.getValue(i)),o=t.fromColor(d),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new h(this._options),attributes:n})},A.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new d(this._options),attributes:{show:new c(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){this._entitySubscription(),o(this)},A.prototype._onEntityPropertyChanged=function(e,t){if("availability"===t||"wall"===t){var n=this._entity.wall;if(!r(n))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var o=n.fill,a=r(o)&&o.isConstant?o.getValue(u.MINIMUM_VALUE):!0,s=n.outline,l=r(s);if(l&&s.isConstant&&(l=s.getValue(u.MINIMUM_VALUE)),!a&&!l)return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var c=n.positions,h=n.show;if(r(h)&&h.isConstant&&!h.getValue(u.MINIMUM_VALUE)||!r(c))return(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)),void 0;var d=i(n.material,w),f=d instanceof v;this._materialProperty=d,this._fillProperty=i(o,E),this._showProperty=i(h,S),this._showOutlineProperty=i(n.outline,b),this._outlineColorProperty=l?i(n.outlineColor,x):void 0;var g=n.minimumHeights,_=n.maximumHeights,y=n.outlineWidth,T=n.granularity;if(this._fillEnabled=a,this._outlineEnabled=l,c.isConstant&&C.isConstant(g)&&C.isConstant(_)&&C.isConstant(y)&&C.isConstant(T)){var P=this._options;P.vertexFormat=f?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,P.positions=c.getValue(u.MINIMUM_VALUE,P.positions),P.minimumHeights=r(g)?g.getValue(u.MINIMUM_VALUE,P.minimumHeights):void 0,P.maximumHeights=r(_)?_.getValue(u.MINIMUM_VALUE,P.maximumHeights):void 0,P.granularity=r(T)?T.getValue(u.MINIMUM_VALUE):void 0,this._outlineWidth=r(y)?y.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},A.prototype.createDynamicUpdater=function(e){return new D(e,this)};var D=function(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new P(t._entity)};return D.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.wall;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,c=C.getValueOrUndefined(s.positions,i,u.positions);if(r(c)){if(u.positions=c,u.minimumHeights=C.getValueOrUndefined(s.minimumHeights,i,u.minimumHeights),u.maximumHeights=C.getValueOrUndefined(s.maximumHeights,i,u.maximumHeights),u.granularity=C.getValueOrUndefined(s.granularity,i),C.getValueOrDefault(s.fill,i,!0)){var v=y.getValue(i,o.fillMaterialProperty,this._material);this._material=v;var g=new p({material:v,translucent:v.isTranslucent(),closed:r(u.extrudedHeight)});u.vertexFormat=g.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u)}),appearance:g,asynchronous:!1}))}if(C.getValueOrDefault(s.outline,i,!1)){u.vertexFormat=m.VERTEX_FORMAT;var _=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,T),w=C.getValueOrDefault(s.outlineWidth,i,1),S=1!==_.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new d(u),attributes:{color:t.fromColor(_)}}),appearance:new m({flat:!0,translucent:S,renderState:{lineWidth:o._scene.clampLineWidth(w)}}),asynchronous:!1}))}}}},D.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},D.prototype.isDestroyed=function(){return!1},D.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},A}),i("DataSources/DataSourceDisplay",["../Core/BoundingSphere","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EventHelper","./BillboardVisualizer","./BoundingSphereState","./BoxGeometryUpdater","./CorridorGeometryUpdater","./CustomDataSource","./CylinderGeometryUpdater","./EllipseGeometryUpdater","./EllipsoidGeometryUpdater","./GeometryVisualizer","./LabelVisualizer","./ModelVisualizer","./PathVisualizer","./PointVisualizer","./PolygonGeometryUpdater","./PolylineGeometryUpdater","./PolylineVolumeGeometryUpdater","./RectangleGeometryUpdater","./WallGeometryUpdater"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b){"use strict";var x=function(e){var i=e.scene,r=e.dataSourceCollection;this._eventHelper=new a,this._eventHelper.add(r.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(r.dataSourceRemoved,this._onDataSourceRemoved,this),this._dataSourceCollection=r,this._scene=i,this._visualizersCallback=t(e.visualizersCallback,x.defaultVisualizersCallback);for(var n=0,o=r.length;o>n;n++)this._onDataSourceAdded(r,r.get(n));var s=new h;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s};x.defaultVisualizersCallback=function(e,t){var i=t.entities;return[new s(e,i),new f(u,e,i),new f(d,e,i),new f(c,e,i),new f(p,e,i),new f(m,e,i),new f(C,e,i),new f(w,e,i),new f(S,e,i),new f(E,e,i),new f(b,e,i),new v(e,i),new g(e,i),new y(e,i),new _(e,i)]},r(x.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}}}),x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){this._eventHelper.removeAll();for(var e=this._dataSourceCollection,t=0,i=e.length;i>t;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),n(this)},x.prototype.update=function(e){var t,r,n,o,a=!0,s=this._dataSourceCollection,l=s.length;for(t=0;l>t;t++){var u=s.get(t);for(i(u.update)&&(a=u.update(e)&&a),n=u._visualizers,o=n.length,r=0;o>r;r++)a=n[r].update(e)&&a}for(n=this._defaultDataSource._visualizers,o=n.length,r=0;o>r;r++)a=n[r].update(e)&&a;return a};var T=[],P=new e;return x.prototype.getBoundingSphere=function(t,r,n){var o,a,s=this._defaultDataSource;if(!s.entities.contains(t)){s=void 0;var u=this._dataSourceCollection;for(a=u.length,o=0;a>o;o++){var c=u.get(o);if(c.entities.contains(t)){s=c;break}}}if(!i(s))return l.FAILED;var h=T,d=P,p=0,m=l.DONE,f=s._visualizers,v=f.length;for(o=0;v>o;o++){var g=f[o];if(i(g.getBoundingSphere)){if(m=f[o].getBoundingSphere(t,d),!r&&m===l.PENDING)return l.PENDING;m===l.DONE&&(h[p]=e.clone(d,h[p]),p++)}}return 0===p?l.FAILED:(h.length=p,e.fromBoundingSpheres(h,n),l.DONE)},x.prototype._onDataSourceAdded=function(e,t){var i=this._visualizersCallback(this._scene,t);t._visualizers=i},x.prototype._onDataSourceRemoved=function(e,t){for(var i=t._visualizers,r=i.length,n=0;r>n;n++)i[n].destroy(),t._visualizers=void 0},x}),i("DataSources/DynamicGeometryUpdater",["../Core/DeveloperError"],function(e){"use strict";var t=function(){e.throwInstantiationError()};return t.prototype.update=e.throwInstantiationError,t.prototype.getBoundingSphere=e.throwInstantiationError,t.prototype.isDestroyed=e.throwInstantiationError,t.prototype.destroy=e.throwInstantiationError,t}),i("Scene/HeadingPitchRange",["../Core/defaultValue","../Core/defined"],function(e,t){"use strict";var i=function(t,i,r){this.heading=e(t,0),this.pitch=e(i,0),this.range=e(r,0)};return i.clone=function(e,r){return t(e)?(t(r)||(r=new i),r.heading=e.heading,r.pitch=e.pitch,r.range=e.range,r):void 0},i}),i("DataSources/EntityView",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/JulianDate","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Transforms","../Scene/HeadingPitchRange","../Scene/SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";function f(e,i,r,o,a,s,h){var p=e.scene.mode,f=a.getValue(s,e._lastCartesian);if(n(f)){var A,D,M,I=!1;if(p===m.SCENE3D){T=l.addSeconds(s,.001,T);var O=a.getValue(T,C);if(n(O)){var R,L=d.computeFixedToIcrfMatrix(s,v),N=d.computeFixedToIcrfMatrix(T,g);n(L)&&n(N)?R=c.transpose(L,_):(R=d.computeTemeToPseudoFixedMatrix(s,_),L=c.transpose(R,v),N=d.computeTemeToPseudoFixedMatrix(T,g),c.transpose(N,N));var F=c.multiplyByVector(L,f,b),B=c.multiplyByVector(N,O,x);t.subtract(F,B,E);var z=1e3*t.magnitude(E),k=3986004418e5,V=-k/(z*z-2*k/t.magnitude(F));0>V||V>P*h.maximumRadius?(A=w,t.normalize(f,A),t.negate(A,A),M=t.clone(t.UNIT_Z,S),D=t.cross(M,A,C),t.magnitude(D)>u.EPSILON7&&(t.normalize(A,A),t.normalize(D,D),M=t.cross(A,D,S),t.normalize(M,M),I=!0)):t.equalsEpsilon(f,O,u.EPSILON7)||(M=w,t.normalize(F,M),t.normalize(B,B),D=t.cross(M,B,S),t.equalsEpsilon(D,t.ZERO,u.EPSILON7)||(A=t.cross(D,M,C),c.multiplyByVector(R,A,A),c.multiplyByVector(R,D,D),c.multiplyByVector(R,M,M),t.normalize(A,A),t.normalize(D,D),t.normalize(M,M),I=!0))}}n(e._boundingSphereOffset)&&t.add(e._boundingSphereOffset,f,f);var U,W,G;o&&(U=t.clone(i.position,E),W=t.clone(i.direction,b),G=t.clone(i.up,x));var H=y;I?(H[0]=A.x,H[1]=A.y,H[2]=A.z,H[3]=0,H[4]=D.x,H[5]=D.y,H[6]=D.z,H[7]=0,H[8]=M.x,H[9]=M.y,H[10]=M.z,H[11]=0,H[12]=f.x,H[13]=f.y,H[14]=f.z,H[15]=0):d.eastNorthUpToFixedFrame(f,h,H),i._setTransform(H),o&&(t.clone(U,i.position),t.clone(W,i.direction),t.clone(G,i.up),t.cross(W,G,i.right))}if(r){var q=p===m.SCENE2D||t.equals(e._offset3D,t.ZERO)?void 0:e._offset3D;i.lookAtTransform(i.transform,q)}}var v=new c,g=new c,_=new c,y=new h,C=new t,w=new t,S=new t,E=new t,b=new t,x=new t,T=new l,P=1.25,A=function(i,n,o,a){this.entity=i,this.scene=n,this.ellipsoid=r(o,s.WGS84),this.boundingSphere=e.clone(a),this._boundingSphereOffset=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new t,this._defaultOffset3D=void 0,this._offset3D=new t};o(A,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=t.clone(e,new t)}}}),A.defaultOffset3D=new t(-14e3,3500,3500);var D=new p,M=new t;return A.prototype.update=function(e){var i=this.scene,r=this.entity,o=this.ellipsoid,a=i.mode;if(a!==m.MORPHING){var s=r.position,l=r!==this._lastEntity,c=a!==this._mode,h=this._offset3D,d=i.camera,p=l||c,v=!0;if(l){var g=r.viewFrom,_=n(g),y=this.boundingSphere;if(this._boundingSphereOffset=void 0,!_&&n(y)){var C=i.screenSpaceCameraController;C.minimumZoomDistance=Math.min(C.minimumZoomDistance,.5*y.radius),D.pitch=-u.PI_OVER_FOUR,D.range=0;var w=s.getValue(e,M);if(n(w)){var S=2-1/Math.max(1,t.magnitude(w)/o.maximumRadius);D.pitch*=S}d.viewBoundingSphere(y,D),this._boundingSphereOffset=t.subtract(y.center,r.position.getValue(e),new t),p=!1,v=!1}else _&&n(g.getValue(e,h))||t.clone(A._defaultOffset3D,h)}else c||i.mode===m.MORPHING||this._mode===m.SCENE2D||t.clone(d.position,h);this._lastEntity=r,this._mode=i.mode!==m.MORPHING?i.mode:this._mode,i.mode!==m.MORPHING&&f(this,d,p,v,s,e,o)}},A}),!function(){function e(e,t){function i(t){var i,r=e.arcs[0>t?~t:t],n=r[0];return e.transform?(i=[0,0],r.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=r[r.length-1],0>t?[i,n]:[n,i]}function r(e,t){for(var i in e){var r=e[i];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){n[0>e?~e:e]=1}),s.push(r)}}var n={},o={},a={},s=[],l=-1;return t.forEach(function(i,r){var n,o=e.arcs[0>i?~i:i];o.length<3&&!o[1][0]&&!o[1][1]&&(n=t[++l],t[l]=i,t[r]=n)}),t.forEach(function(e){var t,r,n=i(e),s=n[0],l=n[1];if(t=a[s])if(delete a[t.end],t.push(e),t.end=l,r=o[l]){delete o[r.start];var u=r===t?t:t.concat(r);o[u.start=t.start]=a[u.end=r.end]=u}else o[t.start]=a[t.end]=t;else if(t=o[l])if(delete o[t.start],t.unshift(e),t.start=s,r=a[s]){delete a[r.end];var c=r===t?t:r.concat(t);o[c.start=r.start]=a[c.end=t.end]=c}else o[t.start]=a[t.end]=t;else t=[e],o[t.start=s]=a[t.end=l]=t}),r(a,o),r(o,a),t.forEach(function(e){n[0>e?~e:e]||s.push([e])}),s}function t(t,i,r){function n(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function o(e){e.forEach(n)}function a(e){e.forEach(o)}function s(e){"GeometryCollection"===e.type?e.geometries.forEach(s):e.type in h&&(u=e,h[e.type](e.arcs))}var l=[];if(arguments.length>1){var u,c=[],h={LineString:o,MultiLineString:a,Polygon:a,MultiPolygon:function(e){e.forEach(a)}};s(i),c.forEach(arguments.length<3?function(e){l.push(e[0].i)}:function(e){r(e[0].g,e[e.length-1].g)&&l.push(e[0].i)})}else for(var d=0,p=t.arcs.length;p>d;++d)l.push(d);return{type:"MultiLineString",arcs:e(t,l)}}function r(t,i){function r(e){e.forEach(function(t){t.forEach(function(t){(a[t=0>t?~t:t]||(a[t]=[])).push(e)})}),l.push(e)}function o(e){return d(s(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var a={},l=[],u=[];return i.forEach(function(e){"Polygon"===e.type?r(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(r)}),l.forEach(function(e){if(!e._){var t=[],i=[e];for(e._=1,u.push(t);e=i.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){a[0>e?~e:e].forEach(function(e){e._||(e._=1,i.push(e))})})})}}),l.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:u.map(function(i){var r=[];if(i.forEach(function(e){e.forEach(function(e){e.forEach(function(e){a[0>e?~e:e].length<2&&r.push(e)})})}),r=e(t,r),(n=r.length)>1)for(var s,l=o(i[0][0]),u=0;n>u;++u)if(l===o(r[u])){s=r[0],r[0]=r[u],r[u]=s;break}return r})}}function o(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return a(e,t)})}:a(e,t)}function a(e,t){var i={type:"Feature",id:t.id,properties:t.properties||{},geometry:s(e,t)};return null==t.id&&delete i.id,i}function s(e,t){function i(e,t){t.length&&t.pop();for(var i,r=c[0>e?~e:e],n=0,o=r.length;o>n;++n)t.push(i=r[n].slice()),u(i,n);0>e&&l(t,o)}function r(e){return e=e.slice(),u(e,0),e}function n(e){for(var t=[],r=0,n=e.length;n>r;++r)i(e[r],t);return t.length<2&&t.push(t[0].slice()),t}function o(e){for(var t=n(e);t.length<4;)t.push(t[0].slice());return t}function a(e){return e.map(o)}function s(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(s)}:t in h?{type:t,coordinates:h[t](e)}:null}var u=v(e.transform),c=e.arcs,h={Point:function(e){return r(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(r)},LineString:function(e){return n(e.arcs)},MultiLineString:function(e){return e.arcs.map(n)},Polygon:function(e){return a(e.arcs)},MultiPolygon:function(e){return e.arcs.map(a)}};return s(t)}function l(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i}function u(e,t){for(var i=0,r=e.length;r>i;){var n=i+r>>>1;e[n]e&&(e=~e);var i=n[e];i?i.push(t):n[e]=[t]})}function i(e,i){e.forEach(function(e){t(e,i)})}function r(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){r(e,t)}):e.type in a&&a[e.type](e.arcs,t)}var n={},o=e.map(function(){return[]}),a={LineString:t,MultiLineString:i,Polygon:i,MultiPolygon:function(e,t){e.forEach(function(e){i(e,t)})}};e.forEach(r);for(var s in n)for(var l=n[s],c=l.length,h=0;c>h;++h)for(var d=h+1;c>d;++d){var p,m=l[h],f=l[d];(p=o[m])[s=u(p,f)]!==f&&p.splice(s,0,f),(p=o[f])[s=u(p,m)]!==m&&p.splice(s,0,m)}return o}function h(e,t){function i(e){o.remove(e),e[1][2]=t(e),o.push(e)}var r=v(e.transform),n=g(e.transform),o=f();return t||(t=p),e.arcs.forEach(function(e){for(var a,s,l=[],u=0,c=0,h=e.length;h>c;++c)s=e[c],r(e[c]=[s[0],s[1],1/0],c);for(var c=1,h=e.length-1;h>c;++c)a=e.slice(c-1,c+2),a[1][2]=t(a),l.push(a),o.push(a);for(var c=0,h=l.length;h>c;++c)a=l[c],a.previous=l[c-1],a.next=l[c+1];for(;a=o.pop();){var d=a.previous,p=a.next;a[1][2]0;){var i=(t+1>>1)-1,n=r[i];if(m(e,n)>=0)break;r[n._=t]=n,r[e._=t=i]=e}}function t(e,t){for(;;){var i=t+1<<1,o=i-1,a=t,s=r[a];if(n>o&&m(r[o],s)<0&&(s=r[a=o]),n>i&&m(r[i],s)<0&&(s=r[a=i]),a===t)break;r[s._=t]=s,r[e._=t=a]=e}}var i={},r=[],n=0;return i.push=function(t){return e(r[t._=n]=t,n++),n},i.pop=function(){if(!(0>=n)){var e,i=r[0];return--n>0&&(e=r[n],t(r[e._=0]=e,0)),i}},i.remove=function(i){var o,a=i._;if(r[a]===i)return a!==--n&&(o=r[n],(m(o,i)<0?e:t)(r[o._=a]=o,a)),a},i}function v(e){if(!e)return _;var t,i,r=e.scale[0],n=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0),e[0]=(t+=e[0])*r+o,e[1]=(i+=e[1])*n+a}}function g(e){if(!e)return _;var t,i,r=e.scale[0],n=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0);var l=0|(e[0]-o)/r,u=0|(e[1]-a)/n;e[0]=l-t,e[1]=u-i,t=l,i=u}}function _(){}var y={version:"1.6.18",mesh:function(e){return s(e,t.apply(this,arguments))},meshArcs:t,merge:function(e){return s(e,r.apply(this,arguments))},mergeArcs:r,feature:o,neighbors:c,presimplify:h};"function"==typeof i&&i.amd?i("ThirdParty/topojson",y):"object"==typeof module&&module.exports?module.exports=y:this.topojson=y}(),i("DataSources/GeoJsonDataSource",["../Core/Cartesian3","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getFilenameFromUri","../Core/loadJson","../Core/PinBuilder","../Core/PolygonHierarchy","../Core/RuntimeError","../Scene/VerticalOrigin","../ThirdParty/topojson","../ThirdParty/when","./BillboardGraphics","./CallbackProperty","./ColorMaterialProperty","./ConstantPositionProperty","./ConstantProperty","./DataSource","./EntityCollection","./PolygonGraphics","./PolylineGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x){"use strict";function T(t){return e.fromDegrees(t[0],t[1],t[2])}function P(e,t){var i="";for(var r in e)if(e.hasOwnProperty(r)){if(r===t||-1!==nt.indexOf(r))continue;var n=e[r];o(n)&&(i+="object"==typeof n?""+r+""+P(n)+"":""+r+""+n+"")}return i.length>0&&(i=''+i+"
"),i}function A(e,t){var i;return function(){return n(i)||(i=P(e,t)),i}}function D(e,t){var r=e.id;if(o(r)&&"Feature"===e.type){for(var a=2,s=r;n(t.getById(s));)s=r+"_"+a,a++;r=s}else r=i();var l=t.getOrCreateEntity(r),u=e.properties;if(o(u)){l.addProperty("properties"),l.properties=u;var c,h=u.title;if(o(h))l.name=h,c="title";else{var d=Number.MAX_VALUE;for(var p in u)if(u.hasOwnProperty(p)&&u[p]){var m=p.toLowerCase();if(d>1&&"title"===m){d=1,c=p;break}d>2&&"name"===m?(d=2,c=p):d>3&&/title/i.test(p)?(d=3,c=p):d>4&&/name/i.test(p)&&(d=4,c=p)}o(c)&&(l.name=u[c])}var f=u.description;n(f)?null!==f&&(l.description=new w(f)):l.description=new _(A(u,c),!0)}return l}function M(e,t){for(var i=new Array(e.length),r=0;ra;a++)I(e,o[a],void 0,r,n)}function R(e,t,i,r,n){for(var a=i.geometries,s=0,l=a.length;l>s;s++){var u=a[s],c=u.type,h=st[c];if(!o(h))throw new p("Unknown geometry type: "+c);h(e,t,u,r,n)}}function L(e,i,a,s,l){var u=l.markerSymbol,c=l.markerColor,h=l.markerSize,d=i.properties;if(o(d)){var p=d["marker-color"];o(p)&&(c=t.fromCssColorString(p)),h=r(rt[d["marker-size"]],h);var f=d["marker-symbol"];o(f)&&(u=f)}ot[0]=u,ot[1]=c,ot[2]=h,JSON.stringify(ot);var _;_=n(u)?1===u.length?e._pinBuilder.fromText(u.toUpperCase(),c,h):e._pinBuilder.fromMakiIconId(u,c,h):e._pinBuilder.fromColor(c,h),e._promises.push(v(_,function(t){var r=new g;r.verticalOrigin=new w(m.BOTTOM),r.image=new w(t);var n=D(i,e._entityCollection);n.billboard=r,n.position=new C(a(s))}))}function N(e,t,i,r,n){L(e,t,r,i.coordinates,n)}function F(e,t,i,r,n){for(var o=i.coordinates,a=0;aE;E++)S.push(new d(M(a[E],r)));var T=a[0];C.hierarchy=new w(new d(M(T,r),S)),T[0].length>2&&(C.perPositionHeight=new w(!0));var P=D(i,e._entityCollection);P.polygon=C}}function U(e,t,i,r,n){V(e,t,r,i.coordinates,n)}function W(e,t,i,r,n){for(var o=i.coordinates,a=0;ao;o++){var s=i[o],l=s.getType(),u=s.getText();if("element"===l)"a"===s.getTagName()&&(s.isClosing()?r=Math.max(r-1,0):r++),n.push(u);else if("entity"===l||"comment"===l)n.push(u); -else if(0===r){var c=this.linkifyStr(u);n.push(c)}else n.push(u)}return n.join("")},linkifyStr:function(e){return this.getMatchParser().replace(e,this.createMatchReturnVal,this)},createMatchReturnVal:function(t){var i;if(this.replaceFn&&(i=this.replaceFn.call(this,this,t)),"string"==typeof i)return i;if(i===!1)return t.getMatchedText();if(i instanceof e.HtmlTag)return i.toAnchorString();var r=this.getTagBuilder(),n=r.build(t);return n.toAnchorString()},getHtmlParser:function(){var t=this.htmlParser;return t||(t=this.htmlParser=new e.htmlParser.HtmlParser),t},getMatchParser:function(){var t=this.matchParser;return t||(t=this.matchParser=new e.matchParser.MatchParser({urls:this.urls,email:this.email,twitter:this.twitter,phone:this.phone,hashtag:this.hashtag,stripPrefix:this.stripPrefix})),t},getTagBuilder:function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new e.AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t}},e.link=function(t,i){var r=new e(i);return r.link(t)},e.match={},e.htmlParser={},e.matchParser={},e.Util={abstractMethod:function(){throw"abstract"},trimRegex:/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,assign:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},extend:function(t,i){var r=t.prototype,n=function(){};n.prototype=r;var o;o=i.hasOwnProperty("constructor")?i.constructor:function(){r.constructor.apply(this,arguments)};var a=o.prototype=new n;return a.constructor=o,a.superclass=r,delete i.constructor,e.Util.assign(a,i),o},ellipsis:function(e,t,i){return e.length>t&&(i=null==i?"..":i,e=e.substring(0,t-i.length)+i),e},indexOf:function(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var i=0,r=e.length;r>i;i++)if(e[i]===t)return i;return-1},splitAndCapture:function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var i,r=[],n=0;i=t.exec(e);)r.push(e.substring(n,i.index)),r.push(i[0]),n=i.index+i[0].length;return r.push(e.substring(n)),r},trim:function(e){return e.replace(this.trimRegex,"")}},e.HtmlTag=e.Util.extend(Object,{whitespaceRegex:/\s+/,constructor:function(t){e.Util.assign(this,t),this.innerHtml=this.innerHtml||this.innerHTML},setTagName:function(e){return this.tagName=e,this},getTagName:function(){return this.tagName||""},setAttr:function(e,t){var i=this.getAttrs();return i[e]=t,this},getAttr:function(e){return this.getAttrs()[e]},setAttrs:function(t){var i=this.getAttrs();return e.Util.assign(i,t),this},getAttrs:function(){return this.attrs||(this.attrs={})},setClass:function(e){return this.setAttr("class",e)},addClass:function(t){for(var i,r=this.getClass(),n=this.whitespaceRegex,o=e.Util.indexOf,a=r?r.split(n):[],s=t.split(n);i=s.shift();)-1===o(a,i)&&a.push(i);return this.getAttrs()["class"]=a.join(" "),this},removeClass:function(t){for(var i,r=this.getClass(),n=this.whitespaceRegex,o=e.Util.indexOf,a=r?r.split(n):[],s=t.split(n);a.length&&(i=s.shift());){var l=o(a,i);-1!==l&&a.splice(l,1)}return this.getAttrs()["class"]=a.join(" "),this},getClass:function(){return this.getAttrs()["class"]||""},hasClass:function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},setInnerHtml:function(e){return this.innerHtml=e,this},getInnerHtml:function(){return this.innerHtml||""},toAnchorString:function(){var e=this.getTagName(),t=this.buildAttrsStr();return t=t?" "+t:"",["<",e,t,">",this.getInnerHtml(),""].join("")},buildAttrsStr:function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i+'="'+e[i]+'"');return t.join(" ")}}),e.AnchorTagBuilder=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},build:function(t){var i=new e.HtmlTag({tagName:"a",attrs:this.createAttrs(t.getType(),t.getAnchorHref()),innerHtml:this.processAnchorText(t.getAnchorText())});return i},createAttrs:function(e,t){var i={href:t},r=this.createCssClass(e);return r&&(i["class"]=r),this.newWindow&&(i.target="_blank"),i},createCssClass:function(e){var t=this.className;return t?t+" "+t+"-"+e:""},processAnchorText:function(e){return e=this.doTruncate(e)},doTruncate:function(t){return e.Util.ellipsis(t,this.truncate||Number.POSITIVE_INFINITY)}}),e.htmlParser.HtmlParser=e.Util.extend(Object,{htmlRegex:function(){var e=/!--([\s\S]+?)--/,t=/[0-9a-zA-Z][0-9a-zA-Z:]*/,i=/[^\s\0"'>\/=\x01-\x1F\x7F]+/,r=/(?:"[^"]*?"|'[^']*?'|[^'"=<>`\s]+)/,n=i.source+"(?:\\s*=\\s*"+r.source+")?";return new RegExp(["(?:","<(!DOCTYPE)","(?:","\\s+","(?:",n,"|",r.source+")",")*",">",")","|","(?:","<(/)?","(?:",e.source,"|","(?:","("+t.source+")","(?:","\\s+",n,")*","\\s*/?",")",")",">",")"].join(""),"gi")}(),htmlCharacterEntitiesRegex:/( | |<|<|>|>|"|"|')/gi,parse:function(e){for(var t,i,r=this.htmlRegex,n=0,o=[];null!==(t=r.exec(e));){var a=t[0],s=t[3],l=t[1]||t[4],u=!!t[2],c=e.substring(n,t.index);c&&(i=this.parseTextAndEntityNodes(c),o.push.apply(o,i)),s?o.push(this.createCommentNode(a,s)):o.push(this.createElementNode(a,l,u)),n=t.index+a.length}if(nn;n+=2){var a=r[n],s=r[n+1];a&&i.push(this.createTextNode(a)),s&&i.push(this.createEntityNode(s))}return i},createCommentNode:function(t,i){return new e.htmlParser.CommentNode({text:t,comment:e.Util.trim(i)})},createElementNode:function(t,i,r){return new e.htmlParser.ElementNode({text:t,tagName:i.toLowerCase(),closing:r})},createEntityNode:function(t){return new e.htmlParser.EntityNode({text:t})},createTextNode:function(t){return new e.htmlParser.TextNode({text:t})}}),e.htmlParser.HtmlNode=e.Util.extend(Object,{text:"",constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getText:function(){return this.text}}),e.htmlParser.CommentNode=e.Util.extend(e.htmlParser.HtmlNode,{comment:"",getType:function(){return"comment"},getComment:function(){return this.comment}}),e.htmlParser.ElementNode=e.Util.extend(e.htmlParser.HtmlNode,{tagName:"",closing:!1,getType:function(){return"element"},getTagName:function(){return this.tagName},isClosing:function(){return this.closing}}),e.htmlParser.EntityNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"entity"}}),e.htmlParser.TextNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"text"}}),e.matchParser.MatchParser=e.Util.extend(Object,{urls:!0,email:!0,twitter:!0,phone:!0,hashtag:!1,stripPrefix:!0,matcherRegex:function(){var e=/(^|[^\w])@(\w{1,15})/,t=/(^|[^\w])#(\w{1,15})/,i=/(?:[\-;:&=\+\$,\w\.]+@)/,r=/(?:\+?\d{1,3}[-\s.])?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/,n=/(?:[A-Za-z][-.+A-Za-z0-9]+:(?![A-Za-z][-.+A-Za-z0-9]+:\/\/)(?!\d+\/?)(?:\/\/)?)/,o=/(?:www\.)/,a=/[A-Za-z0-9\.\-]*[A-Za-z0-9\-]/,s=/\.(?:international|construction|contractors|enterprises|photography|productions|foundation|immobilien|industries|management|properties|technology|christmas|community|directory|education|equipment|institute|marketing|solutions|vacations|bargains|boutique|builders|catering|cleaning|clothing|computer|democrat|diamonds|graphics|holdings|lighting|partners|plumbing|supplies|training|ventures|academy|careers|company|cruises|domains|exposed|flights|florist|gallery|guitars|holiday|kitchen|neustar|okinawa|recipes|rentals|reviews|shiksha|singles|support|systems|agency|berlin|camera|center|coffee|condos|dating|estate|events|expert|futbol|kaufen|luxury|maison|monash|museum|nagoya|photos|repair|report|social|supply|tattoo|tienda|travel|viajes|villas|vision|voting|voyage|actor|build|cards|cheap|codes|dance|email|glass|house|mango|ninja|parts|photo|shoes|solar|today|tokyo|tools|watch|works|aero|arpa|asia|best|bike|blue|buzz|camp|club|cool|coop|farm|fish|gift|guru|info|jobs|kiwi|kred|land|limo|link|menu|mobi|moda|name|pics|pink|post|qpon|rich|ruhr|sexy|tips|vote|voto|wang|wien|wiki|zone|bar|bid|biz|cab|cat|ceo|com|edu|gov|int|kim|mil|net|onl|org|pro|pub|red|tel|uno|wed|xxx|xyz|ac|ad|ae|af|ag|ai|al|am|an|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|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|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)\b/,l=/[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]?!:,.;]*[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]]/;return new RegExp(["(",e.source,")","|","(",i.source,a.source,s.source,")","|","(","(?:","(",n.source,a.source,")","|","(?:","(.?//)?",o.source,a.source,")","|","(?:","(.?//)?",a.source,s.source,")",")","(?:"+l.source+")?",")","|","(",r.source,")","|","(",t.source,")"].join(""),"gi")}(),charBeforeProtocolRelMatchRegex:/^(.)?\/\//,constructor:function(t){e.Util.assign(this,t),this.matchValidator=new e.MatchValidator},replace:function(e,t,i){var r=this;return e.replace(this.matcherRegex,function(e,n,o,a,s,l,u,c,h,d,p,m,f){var v=r.processCandidateMatch(e,n,o,a,s,l,u,c,h,d,p,m,f);if(v){var g=t.call(i,v.match);return v.prefixStr+g+v.suffixStr}return e})},processCandidateMatch:function(t,i,r,n,o,a,s,l,u,c,h,d,p){var m,f=l||u,v="",g="";if(a&&!this.urls||o&&!this.email||c&&!this.phone||i&&!this.twitter||h&&!this.hashtag||!this.matchValidator.isValidMatch(a,s,f))return null;if(this.matchHasUnbalancedClosingParen(t)&&(t=t.substr(0,t.length-1),g=")"),o)m=new e.match.Email({matchedText:t,email:o});else if(i)r&&(v=r,t=t.slice(1)),m=new e.match.Twitter({matchedText:t,twitterHandle:n});else if(c){var _=t.replace(/\D/g,"");m=new e.match.Phone({matchedText:t,number:_})}else if(h)d&&(v=d,t=t.slice(1)),m=new e.match.Hashtag({matchedText:t,serviceName:this.hashtag,hashtag:p});else{if(f){var y=f.match(this.charBeforeProtocolRelMatchRegex)[1]||"";y&&(v=y,t=t.slice(1))}m=new e.match.Url({matchedText:t,url:t,protocolUrlMatch:!!s,protocolRelativeMatch:!!f,stripPrefix:this.stripPrefix})}return{prefixStr:v,suffixStr:g,match:m}},matchHasUnbalancedClosingParen:function(e){var t=e.charAt(e.length-1);if(")"===t){var i=e.match(/\(/g),r=e.match(/\)/g),n=i&&i.length||0,o=r&&r.length||0;if(o>n)return!0}return!1}}),e.MatchValidator=e.Util.extend(Object,{invalidProtocolRelMatchRegex:/^[\w]\/\//,hasFullProtocolRegex:/^[A-Za-z][-.+A-Za-z0-9]+:\/\//,uriSchemeRegex:/^[A-Za-z][-.+A-Za-z0-9]+:/,hasWordCharAfterProtocolRegex:/:[^\s]*?[A-Za-z]/,isValidMatch:function(e,t,i){return t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)||this.isInvalidProtocolRelativeMatch(i)?!1:!0},isValidUriScheme:function(e){var t=e.match(this.uriSchemeRegex)[0].toLowerCase();return"javascript:"!==t&&"vbscript:"!==t},urlMatchDoesNotHaveProtocolOrDot:function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},urlMatchDoesNotHaveAtLeastOneWordChar:function(e,t){return e&&t?!this.hasWordCharAfterProtocolRegex.test(e):!1},isInvalidProtocolRelativeMatch:function(e){return!!e&&this.invalidProtocolRelMatchRegex.test(e)}}),e.match.Match=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getMatchedText:function(){return this.matchedText},getAnchorHref:e.Util.abstractMethod,getAnchorText:e.Util.abstractMethod}),e.match.Email=e.Util.extend(e.match.Match,{getType:function(){return"email"},getEmail:function(){return this.email},getAnchorHref:function(){return"mailto:"+this.email},getAnchorText:function(){return this.email}}),e.match.Hashtag=e.Util.extend(e.match.Match,{getType:function(){return"hashtag"},getHashtag:function(){return this.hashtag},getAnchorHref:function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;default:throw new Error("Unknown service name to point hashtag to: ",e)}},getAnchorText:function(){return"#"+this.hashtag}}),e.match.Phone=e.Util.extend(e.match.Match,{getType:function(){return"phone"},getNumber:function(){return this.number},getAnchorHref:function(){return"tel:"+this.number},getAnchorText:function(){return this.matchedText}}),e.match.Twitter=e.Util.extend(e.match.Match,{getType:function(){return"twitter"},getTwitterHandle:function(){return this.twitterHandle},getAnchorHref:function(){return"https://twitter.com/"+this.twitterHandle},getAnchorText:function(){return"@"+this.twitterHandle}}),e.match.Url=e.Util.extend(e.match.Match,{urlPrefixRegex:/^(https?:\/\/)?(www\.)?/i,protocolRelativeRegex:/^\/\//,protocolPrepended:!1,getType:function(){return"url"},getUrl:function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},getAnchorHref:function(){var e=this.getUrl();return e.replace(/&/g,"&")},getAnchorText:function(){var e=this.getUrl();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix&&(e=this.stripUrlPrefix(e)),e=this.removeTrailingSlash(e)},stripUrlPrefix:function(e){return e.replace(this.urlPrefixRegex,"")},stripProtocolRelativePrefix:function(e){return e.replace(this.protocolRelativeRegex,"")},removeTrailingSlash:function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e}}),e}),i("ThirdParty/zip",["../Core/buildModuleUrl"],function(e){var t={};return function(t){function i(){var e=-1,t=this;t.append=function(i){var r,n=t.table;for(r=0;r>>8^n[255&(e^i[r])]},t.get=function(){return~e}}function r(e,t,i){return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}function n(e,t){var i,r;return i=new ArrayBuffer(e),r=new Uint8Array(i),t&&r.set(t,0),{buffer:i,array:r,view:new DataView(i)}}function o(){}function a(e){function t(t,i){var o=new Blob([e],{type:k});r=new l(o),r.init(function(){n.size=r.size,t()},i)}function i(e,t,i,n){r.readUint8Array(e,t,i,n)}var r,n=this;n.size=0,n.init=t,n.readUint8Array=i}function s(e){function t(t){for(var i=e.length;"="==e.charAt(i-1);)i--;r=e.indexOf(",")+1,o.size=Math.floor(.75*(i-r)),t()}function i(t,i,o){var a,s=n(i),l=4*Math.floor(t/3),u=4*Math.ceil((t+i)/3),c=window.atob(e.substring(l+r,u+r)),h=t-3*Math.floor(l/4);for(a=h;h+i>a;a++)s.array[a-h]=c.charCodeAt(a);o(s.array)}var r,o=this;o.size=0,o.init=t,o.readUint8Array=i}function l(e){function t(t){this.size=e.size,t()}function i(t,i,n,o){var a=new FileReader;a.onload=function(e){n(new Uint8Array(e.target.result))},a.onerror=o,a.readAsArrayBuffer(r(e,t,i))}var n=this;n.size=0,n.init=t,n.readUint8Array=i}function u(){}function c(e){function t(e){n=new Blob([],{type:k}),e()}function i(e,t){n=new Blob([n,P?e:e.buffer],{type:k}),t()}function r(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=i,r.readAsText(n,e)}var n,o=this;o.init=t,o.writeUint8Array=i,o.getData=r}function h(e){function t(t){o+="data:"+(e||"")+";base64,",t()}function i(e,t){var i,r=a.length,n=a;for(a="",i=0;i<3*Math.floor((r+e.length)/3)-r;i++)n+=String.fromCharCode(e[i]);for(;i2?o+=window.btoa(n):a=n,t()}function r(e){e(o+window.btoa(a))}var n=this,o="",a="";n.init=t,n.writeUint8Array=i,n.getData=r}function d(e){function t(t){n=new Blob([],{type:e}),t()}function i(t,i){n=new Blob([n,P?t:t.buffer],{type:e}),i()}function r(e){e(n)}var n,o=this;o.init=t,o.writeUint8Array=i,o.getData=r}function p(e,t,i,r,n,o,a,s,l,u){function c(){e.removeEventListener(V,h,!1),s(m)}function h(e){var t=e.data,r=t.data;t.onappend&&(m+=r.length,i.writeUint8Array(r,function(){o(!1,r),d()},u)),t.onflush&&(r?(m+=r.length,i.writeUint8Array(r,function(){o(!1,r),c()},u)):c()),t.progress&&a&&a(p+t.current,n)}function d(){p=f*F,n>p?t.readUint8Array(r+p,Math.min(F,n-p),function(t){e.postMessage({append:!0,data:t}),f++,a&&a(p,n),o(!0,t)},l):e.postMessage({flush:!0})}var p,m,f=0;m=0,e.addEventListener(V,h,!1),d()}function m(e,t,i,r,n,o,a,s,l,u){function c(){var m;h=d*F,n>h?t.readUint8Array(r+h,Math.min(F,n-h),function(t){var s=e.append(t,function(){a&&a(r+h,n)});p+=s.length,o(!0,t),i.writeUint8Array(s,function(){o(!1,s),d++,setTimeout(c,1)},u),a&&a(h,n)},l):(m=e.flush(),m?(p+=m.length,i.writeUint8Array(m,function(){o(!1,m),s(p)},u)):s(p))}var h,d=0,p=0;c()}function f(e,r,n,o,a,s,l,u,c){function h(e,t){a&&!e&&v.append(t)}function d(e){s(e,v.get())}var f,v=new i;return t.zip.useWebWorkers?(f=new Worker(t.zip.workerScriptsPath+B),p(f,e,r,n,o,h,l,d,u,c)):m(new t.zip.Inflater,e,r,n,o,h,l,d,u,c),f}function v(e,r,n,o,a,s,l){function u(e,t){e&&f.append(t)}function c(e){o(e,f.get())}function h(){d.removeEventListener(V,h,!1),p(d,e,r,0,e.size,u,a,c,s,l)}var d,f=new i;return t.zip.useWebWorkers?(d=new Worker(t.zip.workerScriptsPath+z),d.addEventListener(V,h,!1),d.postMessage({init:!0,level:n})):m(new t.zip.Deflater,e,r,0,e.size,u,a,c,s,l),d}function g(e,t,r,n,o,a,s,l,u){function c(){var i=h*F;n>i?e.readUint8Array(r+i,Math.min(F,n-i),function(e){o&&d.append(e),s&&s(i,n,e),t.writeUint8Array(e,function(){h++,c()},u)},l):a(n,d.get())}var h=0,d=new i;c()}function _(e){var t,i,r="",n=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];for(t=0;t127?n[i-128]:String.fromCharCode(i);return r}function y(e){return decodeURIComponent(escape(e))}function C(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(r){}}function S(e,t,i,r,n){return e.version=t.view.getUint16(i,!0),e.bitFlag=t.view.getUint16(i+2,!0),e.compressionMethod=t.view.getUint16(i+4,!0),e.lastModDateRaw=t.view.getUint32(i+6,!0),e.lastModDate=w(e.lastModDateRaw),1===(1&e.bitFlag)?(n(D),void 0):((r||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295===e.compressedSize||4294967295===e.uncompressedSize?(n(M),void 0):(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0),void 0))}function E(e,t){function i(){}function r(i,o){e.readUint8Array(e.size-i,i,function(e){var t=n(e.length,e).view;1347093766!=t.getUint32(0)?r(i+1,o):o(t)},function(){t(I)})}return i.prototype.getData=function(i,r,o,a){function s(e,t){d&&d.terminate(),d=null,e&&e(t)}function l(e){var t=n(4);return t.view.setUint32(0,e),p.crc32==t.view.getUint32(0)}function u(e,t){a&&!l(t)?c():i.getData(function(e){s(r,e)})}function c(){s(t,L)}function h(){s(t,R)}var d,p=this;e.readUint8Array(p.offset,30,function(r){var s,l=n(r.length,r);return 1347093252!=l.view.getUint32(0)?(t(A),void 0):(S(p,l,4,!1,t),s=p.offset+30+p.filenameLength+p.extraFieldLength,i.init(function(){0===p.compressionMethod?g(e,i,s,p.compressedSize,a,u,o,c,h):d=f(e,i,s,p.compressedSize,a,u,o,c,h)},h),void 0)},c)},{getEntries:function(o){return e.size<22?(t(A),void 0):(r(22,function(r){var a,s;a=r.getUint32(16,!0),s=r.getUint16(8,!0),e.readUint8Array(a,e.size-a,function(e){var r,a,l,u,c=0,h=[],d=n(e.length,e);for(r=0;s>r;r++){if(a=new i,1347092738!=d.view.getUint32(c))return t(A),void 0;S(a,d,c+6,!0,t),a.commentLength=d.view.getUint16(c+32,!0),a.directory=16==(16&d.view.getUint8(c+38)),a.offset=d.view.getUint32(c+42,!0),l=C(d.array.subarray(c+46,c+46+a.filenameLength)),a.filename=2048===(2048&a.bitFlag)?y(l):_(l),a.directory||"/"!=a.filename.charAt(a.filename.length-1)||(a.directory=!0),u=C(d.array.subarray(c+46+a.filenameLength+a.extraFieldLength,c+46+a.filenameLength+a.extraFieldLength+a.commentLength)),a.comment=2048===(2048&a.bitFlag)?y(u):_(u),h.push(a),c+=46+a.filenameLength+a.extraFieldLength+a.commentLength}o(h)},function(){t(I)})}),void 0)},close:function(e){e&&e()}}}function b(e){return unescape(encodeURIComponent(e))}function x(e){var t,i=[];for(t=0;te;e++){for(i=e,t=0;8>t;t++)1&i?i=3988292384^i>>>1:i>>>=1;r[e]=i}return r}(),a.prototype=new o,a.prototype.constructor=a,s.prototype=new o,s.prototype.constructor=s,l.prototype=new o,l.prototype.constructor=l,u.prototype.getData=function(e){e(this.data)},c.prototype=new u,c.prototype.constructor=c,h.prototype=new u,h.prototype.constructor=h,d.prototype=new u,d.prototype.constructor=d,t.zip={Reader:o,Writer:u,BlobReader:l,Data64URIReader:s,TextReader:a,BlobWriter:d,Data64URIWriter:h,TextWriter:c,createReader:function(e,t,i){e.init(function(){t(E(e,i))},i)},createWriter:function(e,t,i,r){e.init(function(){t(T(e,i,r))},i)},useWebWorkers:!0};var W;Object.defineProperty(t.zip,"workerScriptsPath",{get:function(){return"undefined"==typeof W&&(W=e("ThirdParty/Workers/")),W}})}(t),t.zip}),i("DataSources/KmlDataSource",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/ClockRange","../Core/ClockStep","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/getFilenameFromUri","../Core/Iso8601","../Core/JulianDate","../Core/loadBlob","../Core/loadXML","../Core/Math","../Core/NearFarScalar","../Core/PinBuilder","../Core/PolygonHierarchy","../Core/Rectangle","../Core/RuntimeError","../Core/TimeInterval","../Core/TimeIntervalCollection","../Scene/HorizontalOrigin","../Scene/LabelStyle","../ThirdParty/Autolinker","../ThirdParty/Uri","../ThirdParty/when","../ThirdParty/zip","./BillboardGraphics","./CompositePositionProperty","./ConstantPositionProperty","./DataSource","./DataSourceClock","./Entity","./EntityCollection","./LabelGraphics","./PathGraphics","./PolygonGraphics","./PolylineGraphics","./PositionPropertyArray","./RectangleGraphics","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionProperty","./WallGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B,z,k,V,U,W,G,H,q,j,Y,X,Z){"use strict";function J(e){var t=e.slice(0,Math.min(4,e.size)),i=M.defer(),r=new FileReader;return r.addEventListener("load",function(){i.resolve(1347093252===new DataView(r.result).getUint32(0,!1))}),r.addEventListener("error",function(){i.reject(r.error)}),r.readAsArrayBuffer(t),i}function Q(e){var t=M.defer(),i=new FileReader;return i.addEventListener("load",function(){t.resolve(i.result)}),i.addEventListener("error",function(){t.reject(i.error)}),i.readAsText(e),t}function K(e,t,i,r){t.getData(new I.TextWriter,function(e){i.kml=Kt.parseFromString(e,"application/xml"),r.resolve()})}function $(e,t,i,r){var n=s(Qt.detectFromFilename(t.filename),"application/octet-stream");t.getData(new I.Data64URIWriter(n),function(e){i[t.filename]=e,r.resolve()})}function et(e,t,i,r){for(var n=r.keys,o=new D("."),a=e.querySelectorAll(t),s=0;so;o++)r[n++]=nt(t[o]);return r}function at(e,t){if(!l(e))return void 0;var i=e.getAttribute(t);if(null!==i){var r=parseFloat(i);return isNaN(r)?void 0:r}return void 0}function st(e,t){if(!l(e))return void 0;var i=e.getAttribute(t);return null!==i?i:void 0}function lt(e,t,i){if(!l(e))return void 0;for(var r=e.childNodes,n=r.length,o=0;n>o;o++){var a=r[o];if(a.localName===t&&-1!==i.indexOf(a.namespaceURI))return a}return void 0}function ut(e,t,i){if(!l(e))return void 0;for(var r=[],n=e.getElementsByTagName(t),o=n.length,a=0;o>a;a++){var s=n[a];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}function ct(e,t,i){if(!l(e))return[];for(var r=[],n=e.childNodes,o=n.length,a=0;o>a;a++){var s=n[a];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}function ht(e,t,i){var r=lt(e,t,i);if(l(r)){var n=parseFloat(r.textContent);return isNaN(n)?void 0:n}return void 0}function dt(e,t,i){var r=lt(e,t,i);return l(r)?r.textContent.trim():void 0}function pt(e,t,i){var r=lt(e,t,i);return l(r)?"1"===r.textContent:void 0}function mt(e,t,i,r){if(!l(e))return void 0;var n=!1;if(l(r)){var o=r[e];l(o)&&(n=!0,e=o)}if(!n&&l(i)){var a=new D(document.location.href);i=new D(i),e=new D(e).resolve(i.resolve(a)).toString(),e=tt(e,t)}return e}function ft(e,t){if(!l(e))return void 0;"#"===e[0]&&(e=e.substring(1));var i=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,n=parseInt(e.substring(4,6),16)/255,a=parseInt(e.substring(6,8),16)/255;return t?(a>0?oi.maximumRed=a:oi.red=0,n>0?oi.maximumGreen=n:oi.green=0,r>0?oi.maximumBlue=r:oi.blue=0,oi.alpha=i,o.fromRandom(oi)):new o(a,n,r,i)}function vt(e,t,i){var r=dt(e,t,i);return l(r)?ft(r,"random"===dt(e,"colorMode",i)):void 0}function gt(e){var t=lt(e,"TimeStamp",ni.kmlgx),i=dt(t,"when",ni.kmlgx);if(!l(t)||!l(i)||0===i.length)return void 0;var r=f.fromIso8601(i),n=new x;return n.addInterval(new b({start:r,stop:m.MAXIMUM_VALUE})),n}function _t(e){var t=lt(e,"TimeSpan",ni.kmlgx);if(!l(t))return void 0;var i,r=lt(t,"begin",ni.kmlgx),n=l(r)?f.fromIso8601(r.textContent):void 0,o=lt(t,"end",ni.kmlgx),a=l(o)?f.fromIso8601(o.textContent):void 0;if(l(n)&&l(a)){if(f.lessThan(a,n)){var s=n;n=a,a=s}i=new x,i.addInterval(new b({start:n,stop:a}))}else l(n)?(i=new x,i.addInterval(new b({start:n,stop:m.MAXIMUM_VALUE}))):l(a)&&(i=new x,i.addInterval(new b({start:m.MINIMUM_VALUE,stop:a})));return i}function yt(){var e=new O;return e.width=ei,e.height=ei,e.scaleByDistance=new y(2414016,1,16093e3,.1),e}function Ct(){var e=new U;return e.outline=!0,e.outlineColor=o.WHITE,e}function wt(){var e=new k;return e.translucencyByDistance=new y(3e6,1,5e6,0),e.pixelOffset=new t(17,0),e.horizontalOrigin=T.LEFT,e.font="16px sans-serif",e.style=P.FILL_AND_OUTLINE,e}function St(r,n,o,a,u){var c=ht(n,"scale",ni.kml),h=ht(n,"heading",ni.kml),d=vt(n,"color",ni.kml),p=lt(n,"Icon",ni.kml),m=dt(p,"href",ni.kml),f=mt(m,r._proxy,a,u),v=ht(p,"x",ni.gx),g=ht(p,"y",ni.gx),y=ht(p,"w",ni.gx),C=ht(p,"h",ni.gx),w=lt(n,"hotSpot",ni.kml),S=at(w,"x"),E=at(w,"y"),b=st(w,"xunits"),x=st(w,"yunits"),T=o.billboard;l(T)||(T=yt(r),o.billboard=T),T.image=f,T.scale=c,T.color=d,(l(v)||l(g)||l(y)||l(C))&&(T.imageSubRegion=new e(v,g,y,C)),l(h)&&0!==h&&(T.rotation=_.toRadians(-h),T.alignedAxis=i.UNIT_Z),c=s(c,1);var P,A;l(S)&&("pixels"===b?P=-S*c:"insetPixels"===b?P=(S-ei)*c:"fraction"===b&&(P=-ei*c*S),P+=.5*ei*c),l(E)&&("pixels"===x?A=E:"insetPixels"===x?A=-E:"fraction"===x&&(A=E*ei),A-=.5*ei*c),(l(P)||l(A))&&(T.pixelOffset=new t(P,A))}function Et(e,t,i,r,n){for(var a=0,u=t.childNodes.length;u>a;a++){var c=t.childNodes.item(a);if("IconStyle"===c.localName)St(e,c,i,r,n);else if("LabelStyle"===c.localName){var h=i.label;l(h)||(h=wt(),i.label=h),h.scale=s(ht(c,"scale",ni.kml),h.scale),h.fillColor=s(vt(c,"color",ni.kml),h.fillColor),h.text=i.name}else if("LineStyle"===c.localName){var d=i.polyline;l(d)||(d=new W,i.polyline=d),d.width=ht(c,"width",ni.kml),d.material=vt(c,"color",ni.kml)}else if("PolyStyle"===c.localName){var p=i.polygon;l(p)||(p=Ct(),i.polygon=p),p.material=s(vt(c,"color",ni.kml),p.material),p.fill=s(pt(c,"fill",ni.kml),p.fill),p.outline=s(pt(c,"outline",ni.kml),p.outline)}else if("BalloonStyle"===c.localName){var m=s(ft(dt(c,"bgColor",ni.kml)),o.WHITE),f=s(ft(dt(c,"textColor",ni.kml)),o.BLACK),v=dt(c,"text",ni.kml);i.addProperty("balloonStyle"),i.balloonStyle={bgColor:m,textColor:f,text:v}}}}function bt(e,t,i,r,n,o){var a=new B,s=ct(i,"Style",ni.kml),u=s.length;u>0&&Et(t,s[u-1],a,n,o);var c=dt(i,"styleUrl",ni.kml);if(l(c)){var h=c,d=r.getById(h);l(d)||(d=r.getById("#"+h)),l(d)&&a.merge(d)}return a}function xt(e,t,i){return M(g(tt(t,e._proxy)),function(r){return Tt(e,r,i,t,!0)})}function Tt(e,t,i,r,n,o){var a,s,u,c,h=ut(t,"Style",ni.kml);if(l(h)){var d=h.length;for(a=0;d>a;a++)c=h[a],s=st(c,"id"),l(s)&&(s="#"+s,n&&l(r)&&(s=r+s),l(i.getById(s))||(u=new B({id:s}),i.add(u),Et(e,c,u,r,o)))}var p=ut(t,"StyleMap",ni.kml); -if(l(p)){var m=p.length;for(a=0;m>a;a++){var f=p[a];if(s=st(f,"id"),l(s))for(var v=ct(f,"Pair",ni.kml),g=0;ga;a++){var x=E[a].textContent;if("#"!==x[0]){var T=x.split("#");if(2===T.length){var P=T[0];if(!l(w[P])){if(l(r)){var A=new D(document.location.href);r=new D(r),P=new D(P).resolve(r.resolve(A)).toString()}S.push(xt(e,P,i,r))}}}}return S}function Pt(e,t,i){var r=new q(e._entityCollection,t.id,["position"]),n=new Y(t.position);t.polyline=l(i.polyline)?i.polyline.clone():new W,t.polyline.positions=new G([r,n])}function At(e,t,i){return"relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t?e:((l(t)&&"clampToGround"!==t||l(i)&&"clampToSeaFloor"!==i)&&window.console.log("KML - Unknown altitudeMode: "+s(t,i)),new Y(e))}function Dt(e,t,i){if(!l(e))return void 0;if("relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t)return e;(l(t)&&"clampToGround"!==t||l(i)&&"clampToSeaFloor"!==i)&&window.console.log("KML - Unknown altitudeMode: "+s(t,i));for(var r=e.length,n=0;r>n;n++){var o=e[n];h.WGS84.scaleToGeodeticSurface(o,o)}return e}function Mt(e,i,r){var n=i.label;l(n)||(n=l(r.label)?r.label.clone():wt(),i.label=n),n.text=i.name;var a=i.billboard;if(l(a)||(a=l(r.billboard)?r.billboard.clone():yt(),i.billboard=a),l(a.image)||(a.image=e._pinBuilder.fromColor(o.YELLOW,64)),l(a.scale)){var s=a.scale.getValue();0!==s?n.pixelOffset=new t(16*s+1,0):(n.pixelOffset=void 0,n.horizontalOrigin=void 0)}}function It(e,t,i){var r=t.path;l(r)||(r=new V,r.leadTime=0,t.path=r);var n=i.polyline;l(n)&&(r.material=n.material,r.width=n.width)}function Ot(e,t,i,r){var n=dt(t,"coordinates",ni.kml),o=dt(t,"altitudeMode",ni.kml),a=dt(t,"altitudeMode",ni.gx),s=pt(t,"extrude",ni.kml),u=nt(n);l(u)&&(i.position=At(new L(u),o,a),Mt(e,i,r),s&&rt(o,a)&&Pt(e,i,r))}function Rt(e,t,i,r){var n=lt(t,"coordinates",ni.kml),a=dt(t,"altitudeMode",ni.kml),s=dt(t,"altitudeMode",ni.gx),u=pt(t,"extrude",ni.kml),c=pt(t,"tessellate",ni.kml),h=rt(a,s),d=ot(n),p=r.polyline;if(h&&u){var m=new Z;i.wall=m,m.positions=d;var f=r.polygon;l(f)&&(m.fill=f.fill,m.outline=f.outline,m.material=f.material),l(p)&&(m.outlineColor=l(p.material)?p.material.color:o.WHITE,m.outlineWidth=p.width)}else p=l(p)?p.clone():new W,i.polyline=p,p.positions=Dt(d,a,s),(!c||h)&&(p.followSurface=!1)}function Lt(e,t,i,r){var n=lt(t,"outerBoundaryIs",ni.kml),a=lt(n,"LinearRing",ni.kml),s=lt(a,"coordinates",ni.kml),u=ot(s),c=pt(t,"extrude",ni.kml),h=dt(t,"altitudeMode",ni.kml),d=dt(t,"altitudeMode",ni.gx),p=rt(h,d),m=l(r.polygon)?r.polygon.clone():Ct(),f=r.polyline;if(l(f)&&(m.outlineColor=l(f.material)?f.material.color:o.WHITE,m.outlineWidth=f.width),i.polygon=m,p&&(m.perPositionHeight=!0,m.extrudedHeight=c?0:void 0),l(u)){for(var v=new w(u),g=ct(t,"innerBoundaryIs",ni.kml),_=0;_m;m++){var v=nt(a[m].textContent);l(v)&&(d.push(v),p.push(f.fromIso8601(s[m].textContent)))}var g=new j;g.addSamples(p,d),i.position=At(g,n,o),Mt(e,i,r),It(e,i,r),i.availability=new x,s.length>0&&i.availability.addInterval(new b({start:p[0],stop:p[p.length-1]})),c&&u&&Pt(e,i,r)}function Ft(e,t,i,r,n,o,a,s,l){var u=e[0],c=e[e.length-1],h=new j;h.addSamples(e,t),i.intervals.addInterval(new b({start:u,stop:c,isStartIncluded:l,isStopIncluded:l,data:At(h,a,s)})),r.addInterval(new b({start:u,stop:c,isStartIncluded:l,isStopIncluded:l})),n.intervals.addInterval(new b({start:u,stop:c,isStartIncluded:l,isStopIncluded:l,data:o}))}function Bt(e,t,i,r){for(var n,o,a,s=pt(t,"interpolate",ni.gx),u=ct(t,"Track",ni.gx),c=!1,h=new X,d=new x,p=new R,m=0,v=u.length;v>m;m++){var g=u[m],_=ct(g,"when",ni.kml),y=ct(g,"coord",ni.gx),C=dt(g,"altitudeMode",ni.kml),w=dt(g,"altitudeMode",ni.gx),S=rt(C,w),E=pt(g,"extrude",ni.kml),b=Math.min(y.length,_.length),T=[];n=[];for(var P=0;b>P;P++){var A=nt(y[P].textContent);l(A)&&(T.push(A),n.push(f.fromIso8601(_[P].textContent)))}s&&(l(o)&&Ft([o,n[0]],[a,T[0]],p,d,h,!1,"absolute",void 0,!1),o=n[b-1],a=T[T.length-1]),Ft(n,T,p,d,h,S&&E,C,w,!0),c=c||S&&E}i.availability=d,i.position=p,Mt(e,i,r),It(e,i,r),c&&(Pt(e,i,r),i.polyline.show=h)}function zt(e,t,i,r){for(var n=t.childNodes,o=0,a=n.length;a>o;o++){var s=n.item(o),u=si[s.localName];if(l(u)){var c=it(s,e._entityCollection);c.parent=i,c.name=i.name,c.availability=i.availability,c.description=i.description,c.kml=i.kml,u(e,s,c,r)}}}function kt(e,t){var i=lt(e,"ExtendedData",ni.kml);if(!l(i))return void 0;var r={},n=ct(i,"Data",ni.kml);if(l(n))for(var o=n.length,a=0;o>a;a++){var s=n[a],u=st(s,"name");l(u)&&(r[u]={displayName:dt(s,"displayName",ni.kml),value:dt(s,"value",ni.kml)})}t.kml.extendedData=r}function Vt(e,t,i,r){var n,a,u,c=t.kml,h=c.extendedData,d=dt(e,"description",ni.kml),p=s(t.balloonStyle,i.balloonStyle),m=o.WHITE,f=o.BLACK,v=d;l(p)&&(m=s(p.bgColor,o.WHITE),f=s(p.textColor,o.BLACK),v=s(p.text,d));var g;if(l(v)){if(v=v.replace("$[name]",s(t.name,"")),v=v.replace("$[description]",s(d,"")),v=v.replace("$[address]",s(c.address,"")),v=v.replace("$[Snippet]",s(c.snippet,"")),v=v.replace("$[id]",t.id),v=v.replace("$[geDirections]",""),l(h)){var _=v.match(/\$\[.+?\]/g);if(null!==_)for(n=0;n<_.length;n++){var y=_[n],C=y.substr(2,y.length-3),w=/\/displayName$/.test(C);C=C.replace(/\/displayName$/,""),g=h[C],l(g)&&(g=w?g.displayName:g.value),l(g)&&(v=v.replace(y,s(g,"")))}}}else if(l(h)&&(u=Object.keys(h),u.length>0)){for(v='',n=0;n";v+="
"+s(g.displayName,a)+""+s(g.value,"")+"
"}if(l(v)){v=$t.link(v),ai.innerHTML=v;var S=ai.querySelectorAll("a");for(n=0;n1&&(et(ai,"a","href",r),et(ai,"img","src",r));var E='
",ai.innerHTML="",t.description=E}}function Ut(e,t,i,r,n,o,a){var u=it(i,r),c=u.kml,h=bt(u,e,i,n,o,a),d=dt(i,"name",ni.kml);u.name=d,u.parent=t;var p=_t(i);l(p)||(p=gt(i)),u.availability=p;var m=pt(i,"visibility",ni.kml);u.show=s(m,!0);var f=lt(i,"author",ni.atom),v=c.author;v.name=dt(f,"name",ni.atom),v.uri=dt(f,"uri",ni.atom),v.email=dt(f,"email",ni.atom);var g=lt(i,"link",ni.atom),_=c.link;return _.href=st(g,"href"),_.hreflang=st(g,"hreflang"),_.rel=st(g,"rel"),_.type=st(g,"type"),_.title=st(g,"title"),_.length=st(g,"length"),c.address=dt(i,"address",ni.kml),c.phoneNumber=dt(i,"phoneNumber",ni.kml),c.snippet=dt(i,"Snippet",ni.kml),kt(i,u),Vt(i,u,h,a),{entity:u,styleEntity:h}}function Wt(e,t,i,r,n,o,a){for(var s=Object.keys(li),l=s.length,u=0;l>u;u++)for(var c=s[u],h=li[c],d=i.childNodes,p=d.length,m=0;p>m;m++){var f=d[m];f.localName===c&&-1!==ni.kml.indexOf(f.namespaceURI)&&h(e,t,f,r,n,o,a)}}function Gt(e,t,i,r,n,o,a){var s=Ut(e,t,i,r,n,o,a);Wt(e,s.entity,i,r,n,o,a)}function Ht(e,t,i,r,n,o,a){for(var s=Ut(e,t,i,r,n,o,a),u=s.entity,c=s.styleEntity,h=!1,d=i.childNodes,p=0,m=d.length;m>p&&!h;p++){var f=d.item(p),v=si[f.localName];l(v)&&(v(e,f,u,c),h=!0)}h||(u.merge(c),Mt(e,u,c))}function qt(e,t,i,r,n,o,a){var s=Ut(e,t,i,r,n,o,a),u=s.entity;s.stylEntity;var c,h=!1,d=ot(lt(i,"LatLonQuad",ni.gx));if(l(d))c=Ct(),c.hierarchy=new w(d),u.polygon=c,h=!0;else{c=new H,u.rectangle=c;var p=lt(i,"LatLonBox",ni.kml);if(l(p)){var m=ht(p,"west",ni.kml),f=ht(p,"south",ni.kml),v=ht(p,"east",ni.kml),g=ht(p,"north",ni.kml);l(m)&&(m=_.negativePiToPi(_.toRadians(m))),l(f)&&(f=_.negativePiToPi(_.toRadians(f))),l(v)&&(v=_.negativePiToPi(_.toRadians(v))),l(g)&&(g=_.negativePiToPi(_.toRadians(g))),c.coordinates=new S(m,f,v,g);var y=ht(p,"rotation",ni.kml);l(y)&&(c.rotation=_.toRadians(y))}}var C=lt(i,"Icon",ni.kml),E=dt(C,"href",ni.kml);l(E)?(h&&window.console.log("KML - gx:LatLonQuad Icon does not support texture projection."),c.material=mt(E,e._proxy,o,a)):c.material=vt(i,"color",ni.kml);var b=dt(i,"altitudeMode",ni.kml);l(b)?"absolute"===b?c.height=ht(i,"altitude",ni.kml):"clampToGround"===b||window.console.log("KML - Unknown altitudeMode: "+b):(b=dt(i,"altitudeMode",ni.gx),"relativeToSeaFloor"===b?(window.console.log("KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),c.height=ht(i,"altitude",ni.kml)):"clampToSeaFloor"===b?window.console.log("KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):l(b)&&window.console.log("KML - Unknown altitudeMode: "+b))}function jt(e,t,i){window.console.log("KML - Unsupported feature: "+i.localName)}function Yt(e,t,i,r,n,o,a){var s=Ut(e,t,i,r,n,o,a),u=s.entity,c=lt(i,"Link",ni.kml);if(l(c)){var h=dt(c,"href",ni.kml);if(l(h)){h=mt(h,void 0,o,a);var d=new ui(e._proxy),p=M(d.load(h),function(){for(var t=d.entities.values,i=0;ir;r++)if(!o.isConstant(t[r]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),a.prototype.getValue=function(t,i){var r=this._value;if(!e(r))return void 0;var n=r.length;e(i)||(i=new Array(n));for(var o=0,a=0;n>o;){var s=this._value[o],l=s.getValue(t,i[o]);e(l)&&(i[a]=l,a++),o++}return i.length=a,i},a.prototype.setValue=function(t){var i=this._eventHelper;if(i.removeAll(),e(t)){this._value=t.slice();for(var r=t.length,n=0;r>n;n++){var o=t[n];e(o)&&i.add(o.definitionChanged,a.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},a.prototype.equals=function(e){return this===e||e instanceof a&&o.arrayEquals(this._value,e._value)},a.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},a}),i("DataSources/VelocityOrientationProperty",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/JulianDate","../Core/Matrix3","../Core/Quaternion","../Core/Transforms","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";var d=function(e,i){this._position=void 0,this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new a,this.position=e,this.ellipsoid=t(i,o.WGS84)};r(d.prototype,{isConstant:{get:function(){return h.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){var t=this._position;t!==e&&(i(t)&&this._subscription(),this._position=e,i(e)&&(this._subscription=e._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)),this._definitionChanged.raiseEvent(this))}},ellipsoid:{get:function(){return this._ellipsoid},set:function(e){var t=this._ellipsoid;t!==e&&(this._ellipsoid=e,this._definitionChanged.raiseEvent(this))}}});var p=new e,m=new e,f=new e,v=new s,g=new l,_=1/60;return d.prototype.getValue=function(t,r){var n=this._position;if(h.isConstant(n))return void 0;var o=n.getValue(t,p),a=n.getValue(s.addSeconds(t,_,v),m);if(!i(o))return void 0;if(!i(a)&&(a=o,o=n.getValue(s.addSeconds(t,-_,v),m),!i(o)))return void 0;if(e.equals(o,a))return void 0;var l=e.subtract(a,o,f);return e.normalize(l,l),c.rotationMatrixFromPositionVelocity(o,l,this._ellipsoid,g),u.fromRotationMatrix(g,r)},d.prototype.equals=function(e){return this===e||e instanceof d&&h.equals(this._position,e._position)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))},d}),i("DataSources/Visualizer",["../Core/DeveloperError"],function(e){"use strict";var t=function(){e.throwInstantiationError()};return t.prototype.update=e.throwInstantiationError,t.prototype.getBoundingSphere=e.throwInstantiationError,t.prototype.isDestroyed=e.throwInstantiationError,t.prototype.destroy=e.throwInstantiationError,t}),i("Renderer/Buffer",["../Core/defaultValue","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i){"use strict";var r=function(e,t,i,r,n){this._gl=e,this._bufferTarget=t,this._sizeInBytes=i,this._usage=r,this._buffer=n,this.vertexArrayDestroyable=!0};return t(r.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}}),r.prototype._getBuffer=function(){return this._buffer},r.prototype.copyFromArrayView=function(t,i){i=e(i,0);var r=this._gl,n=this._bufferTarget;r.bindBuffer(n,this._buffer),r.bufferSubData(n,i,t),r.bindBuffer(n,null)},r.prototype.isDestroyed=function(){return!1},r.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),i(this)},r}),i("Renderer/ClearCommand",["../Core/Color","../Core/defaultValue","../Core/freezeObject"],function(e,t,i){"use strict";var r=function(e){e=t(e,t.EMPTY_OBJECT),this.color=e.color,this.depth=e.depth,this.stencil=e.stencil,this.renderState=e.renderState,this.framebuffer=e.framebuffer,this.owner=e.owner};return r.ALL=i(new r({color:new e(0,0,0,0),depth:1,stencil:0})),r.prototype.execute=function(e,t){e.clear(this,t)},r}),i("Shaders/ViewportQuadVS",[],function(){"use strict";return"attribute vec4 position;\nattribute vec2 textureCoordinates;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_textureCoordinates = textureCoordinates;\n}\n"}),i("Renderer/Framebuffer",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/PixelFormat"],function(e,t,i,r){"use strict";function n(e,t,i){var r=e._gl;r.framebufferTexture2D(r.FRAMEBUFFER,t,i._target,i._texture,0)}function o(e,t,i){var r=e._gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,t,r.RENDERBUFFER,i._getRenderbuffer())}var a=function(i,r,a){a=e(a,e.EMPTY_OBJECT),this._gl=i,this._framebuffer=i.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=e(a.destroyAttachments,!0),t(a.depthTexture)||t(a.depthRenderbuffer),t(a.depthStencilTexture)||t(a.depthStencilRenderbuffer),this._bind();var s,l,u,c,h;if(t(a.colorTextures)){var d=a.colorTextures;for(c=this._colorTextures.length=this._activeColorAttachments.length=d.length,u=0;c>u;++u)s=d[u],h=this._gl.COLOR_ATTACHMENT0+u,n(this,h,s),this._activeColorAttachments[u]=h,this._colorTextures[u]=s}if(t(a.colorRenderbuffers)){var p=a.colorRenderbuffers;for(c=this._colorRenderbuffers.length=this._activeColorAttachments.length=p.length,u=0;c>u;++u)l=p[u],h=this._gl.COLOR_ATTACHMENT0+u,o(this,h,l),this._activeColorAttachments[u]=h,this._colorRenderbuffers[u]=l}t(a.depthTexture)&&(s=a.depthTexture,n(this,this._gl.DEPTH_ATTACHMENT,s),this._depthTexture=s),t(a.depthRenderbuffer)&&(l=a.depthRenderbuffer,o(this,this._gl.DEPTH_ATTACHMENT,l),this._depthRenderbuffer=l),t(a.stencilRenderbuffer)&&(l=a.stencilRenderbuffer,o(this,this._gl.STENCIL_ATTACHMENT,l),this._stencilRenderbuffer=l),t(a.depthStencilTexture)&&(s=a.depthStencilTexture,n(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilTexture=s),t(a.depthStencilRenderbuffer)&&(l=a.depthStencilRenderbuffer,o(this,this._gl.DEPTH_STENCIL_ATTACHMENT,l),this._depthStencilRenderbuffer=l),this._unBind()};return i(a.prototype,{status:{get:function(){this._bind();var e=this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);return this._unBind(),e}},numberOfColorAttachments:{get:function(){return this._activeColorAttachments.length}},depthTexture:{get:function(){return this._depthTexture}},depthRenderbuffer:{get:function(){return this._depthRenderbuffer}},stencilRenderbuffer:{get:function(){return this._stencilRenderbuffer}},depthStencilTexture:{get:function(){return this._depthStencilTexture}},depthStencilRenderbuffer:{get:function(){return this._depthStencilRenderbuffer}},hasDepthAttachment:{get:function(){return!!(this.depthTexture||this.depthRenderbuffer||this.depthStencilTexture||this.depthStencilRenderbuffer)}}}),a.prototype._bind=function(){var e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)},a.prototype._unBind=function(){var e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},a.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments},a.prototype.getColorTexture=function(e){return this._colorTextures[e]},a.prototype.getColorRenderbuffer=function(e){return this._colorRenderbuffers[e]},a.prototype.isDestroyed=function(){return!1},a.prototype.destroy=function(){if(this.destroyAttachments){for(var e=0,i=this._colorTextures,n=i.length;n>e;++e){var o=i[e];t(o)&&o.destroy()}var a=this._colorRenderbuffers;for(n=a.length,e=0;n>e;++e){var s=a[e];t(s)&&s.destroy()}this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._stencilRenderbuffer=this._stencilRenderbuffer&&this._stencilRenderbuffer.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()}return this._gl.deleteFramebuffer(this._framebuffer),r(this)},a}),i("Renderer/PassState",[],function(){"use strict";var e=function(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0};return e}),i("Renderer/RenderbufferFormat",["../Core/freezeObject"],function(e){"use strict";var t={RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,validate:function(e){return e===t.RGBA4||e===t.RGB5_A1||e===t.RGB565||e===t.DEPTH_COMPONENT16||e===t.STENCIL_INDEX8||e===t.DEPTH_STENCIL}};return e(t)}),i("Renderer/PickFramebuffer",["../Core/BoundingRectangle","../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","./PassState","./RenderbufferFormat"],function(e,t,i,r,n,o,a){"use strict";var s=function(t){var i=new o(t);i.blendingEnabled=!1,i.scissorTest={enabled:!0,rectangle:new e},this._context=t,this._fb=void 0,this._passState=i,this._width=0,this._height=0};s.prototype.begin=function(t){var i=this._context,n=i.drawingBufferWidth,o=i.drawingBufferHeight;return e.clone(t,this._passState.scissorTest.rectangle),r(this._fb)&&this._width===n&&this._height===o||(this._width=n,this._height=o,this._fb=this._fb&&this._fb.destroy(),this._fb=i.createFramebuffer({colorTextures:[i.createTexture2D({width:n,height:o})],depthRenderbuffer:i.createRenderbuffer({format:a.DEPTH_COMPONENT16})}),this._passState.framebuffer=this._fb),this._passState};var l=new t;return s.prototype.end=function(e){for(var n=i(e.width,1),o=i(e.height,1),a=this._context,s=a.readPixels({x:e.x,y:e.y,width:n,height:o,framebuffer:this._fb}),u=Math.max(n,o),c=u*u,h=Math.floor(.5*n),d=Math.floor(.5*o),p=0,m=0,f=0,v=-1,g=0;c>g;++g){if(p>=-h&&h>=p&&m>=-d&&d>=m){var _=4*((d-m)*n+p+h);l.red=t.byteToFloat(s[_]),l.green=t.byteToFloat(s[_+1]),l.blue=t.byteToFloat(s[_+2]),l.alpha=t.byteToFloat(s[_+3]);var y=a.getObjectByPickColor(l);if(r(y))return y}if(p===m||0>p&&-p===m||p>0&&p===1-m){var C=f;f=-v,v=C}p+=f,m+=v}return void 0},s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return this._fb=this._fb&&this._fb.destroy(),n(this)},s}),i("Renderer/Renderbuffer",["../Core/defineProperties","../Core/destroyObject"],function(e,t){"use strict";function i(e,t,i,r){this._gl=e,this._format=t,this._width=i,this._height=r,this._renderbuffer=this._gl.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this._renderbuffer),e.renderbufferStorage(e.RENDERBUFFER,t,i,r),e.bindRenderbuffer(e.RENDERBUFFER,null)}return e(i.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),i.prototype._getRenderbuffer=function(){return this._renderbuffer},i.prototype.isDestroyed=function(){return!1},i.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),t(this)},i}),i("Renderer/RenderState",["../Core/BoundingRectangle","../Core/Color","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/RuntimeError","../Core/WindingOrder"],function(e,t,i,r,n,o,a){"use strict";function s(e,t,i){i?e.enable(t):e.disable(t)}function l(e,t){e.frontFace(t.frontFace)}function u(e,t){var i=t.cull,r=i.enabled;s(e,e.CULL_FACE,r),r&&e.cullFace(i.face)}function c(e,t){e.lineWidth(t.lineWidth)}function h(e,t){var i=t.polygonOffset,r=i.enabled;s(e,e.POLYGON_OFFSET_FILL,r),r&&e.polygonOffset(i.factor,i.units)}function d(e,t,i){var n=t.scissorTest,o=r(i.scissorTest)?i.scissorTest.enabled:n.enabled;if(s(e,e.SCISSOR_TEST,o),o){var a=r(i.scissorTest)?i.scissorTest.rectangle:n.rectangle;e.scissor(a.x,a.y,a.width,a.height)}}function p(e,t){var i=t.depthRange;e.depthRange(i.near,i.far)}function m(e,t){var i=t.depthTest,r=i.enabled;s(e,e.DEPTH_TEST,r),r&&e.depthFunc(i.func)}function f(e,t){var i=t.colorMask;e.colorMask(i.red,i.green,i.blue,i.alpha)}function v(e,t){e.depthMask(t.depthMask)}function g(e,t){e.stencilMask(t.stencilMask)}function _(e,t,i){var n=t.blending,o=r(i.blendingEnabled)?i.blendingEnabled:n.enabled;s(e,e.BLEND,o),o&&(E(e,n.color),e.blendEquationSeparate(n.equationRgb,n.equationAlpha),e.blendFuncSeparate(n.functionSourceRgb,n.functionDestinationRgb,n.functionSourceAlpha,n.functionDestinationAlpha))}function y(e,t){var i=t.stencilTest,r=i.enabled;if(s(e,e.STENCIL_TEST,r),r){var n=i.frontFunction,o=i.backFunction,a=i.reference,l=i.mask;e.stencilFunc(i.frontFunction,i.reference,i.mask),e.stencilFuncSeparate(e.BACK,o,a,l),e.stencilFuncSeparate(e.FRONT,n,a,l);var u=i.frontOperation,c=u.fail,h=u.zFail,d=u.zPass;e.stencilOpSeparate(e.FRONT,c,h,d);var p=i.backOperation,m=p.fail,f=p.zFail,v=p.zPass;e.stencilOpSeparate(e.BACK,m,f,v)}}function C(e,t,i){var n=t.viewport;r(n)||(n=x,n.width=i.context.drawingBufferWidth,n.height=i.context.drawingBufferHeight),i.context.uniformState.viewport=n,e.viewport(n.x,n.y,n.width,n.height)}function w(e,t){var i=[];return e.frontFace!==t.frontFace&&i.push(l),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&i.push(u),e.lineWidth!==t.lineWidth&&i.push(c),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&i.push(h),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&i.push(p),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&i.push(m),(e.colorMask.red!==t.colorMask.red||e.colorMask.green!==t.colorMask.green||e.colorMask.blue!==t.colorMask.blue||e.colorMask.alpha!==t.colorMask.alpha)&&i.push(f),e.depthMask!==t.depthMask&&i.push(v),e.stencilMask!==t.stencilMask&&i.push(g),(e.stencilTest.enabled!==t.stencilTest.enabled||e.stencilTest.frontFunction!==t.stencilTest.frontFunction||e.stencilTest.backFunction!==t.stencilTest.backFunction||e.stencilTest.reference!==t.stencilTest.reference||e.stencilTest.mask!==t.stencilTest.mask||e.stencilTest.frontOperation.fail!==t.stencilTest.frontOperation.fail||e.stencilTest.frontOperation.zFail!==t.stencilTest.frontOperation.zFail||e.stencilTest.backOperation.fail!==t.stencilTest.backOperation.fail||e.stencilTest.backOperation.zFail!==t.stencilTest.backOperation.zFail||e.stencilTest.backOperation.zPass!==t.stencilTest.backOperation.zPass)&&i.push(y),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&i.push(b),i}var S=function(n,s){var l=i(s,{}),u=i(l.cull,{}),c=i(l.polygonOffset,{}),h=i(l.scissorTest,{}),d=i(h.rectangle,{}),p=i(l.depthRange,{}),m=i(l.depthTest,{}),f=i(l.colorMask,{}),v=i(l.blending,{}),g=i(v.color,{}),_=i(l.stencilTest,{}),y=i(_.frontOperation,{}),C=i(_.backOperation,{}),w=i(l.sampleCoverage,{}),S=l.viewport;if(this.frontFace=i(l.frontFace,a.COUNTER_CLOCKWISE),this.cull={enabled:i(u.enabled,!1),face:i(u.face,WebGLRenderingContext.BACK)},this.lineWidth=i(l.lineWidth,1),this.polygonOffset={enabled:i(c.enabled,!1),factor:i(c.factor,0),units:i(c.units,0)},this.scissorTest={enabled:i(h.enabled,!1),rectangle:e.clone(d)},this.depthRange={near:i(p.near,0),far:i(p.far,1)},this.depthTest={enabled:i(m.enabled,!1),func:i(m.func,WebGLRenderingContext.LESS)},this.colorMask={red:i(f.red,!0),green:i(f.green,!0),blue:i(f.blue,!0),alpha:i(f.alpha,!0)},this.depthMask=i(l.depthMask,!0),this.stencilMask=i(l.stencilMask,-1),this.blending={enabled:i(v.enabled,!1),color:new t(i(g.red,0),i(g.green,0),i(g.blue,0),i(g.alpha,0)),equationRgb:i(v.equationRgb,WebGLRenderingContext.FUNC_ADD),equationAlpha:i(v.equationAlpha,WebGLRenderingContext.FUNC_ADD),functionSourceRgb:i(v.functionSourceRgb,WebGLRenderingContext.ONE),functionSourceAlpha:i(v.functionSourceAlpha,WebGLRenderingContext.ONE),functionDestinationRgb:i(v.functionDestinationRgb,WebGLRenderingContext.ZERO),functionDestinationAlpha:i(v.functionDestinationAlpha,WebGLRenderingContext.ZERO)},this.stencilTest={enabled:i(_.enabled,!1),frontFunction:i(_.frontFunction,WebGLRenderingContext.ALWAYS),backFunction:i(_.backFunction,WebGLRenderingContext.ALWAYS),reference:i(_.reference,0),mask:i(_.mask,-1),frontOperation:{fail:i(y.fail,WebGLRenderingContext.KEEP),zFail:i(y.zFail,WebGLRenderingContext.KEEP),zPass:i(y.zPass,WebGLRenderingContext.KEEP)},backOperation:{fail:i(C.fail,WebGLRenderingContext.KEEP),zFail:i(C.zFail,WebGLRenderingContext.KEEP),zPass:i(C.zPass,WebGLRenderingContext.KEEP)}},this.sampleCoverage={enabled:i(w.enabled,!1),value:i(w.value,1),invert:i(w.invert,!1)},this.viewport=r(S)?new e(S.x,S.y,r(S.width)?S.width:n.drawingBufferWidth,r(S.height)?S.height:n.drawingBufferHeight):void 0,this.lineWidthn.maximumAliasedLineWidth)throw new o("renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth."); -if(r(this.viewport)){if(this.viewport.width>n.maximumViewportWidth)throw new o("renderState.viewport.width must be less than or equal to the maximum viewport width ("+this.maximumViewportWidth.toString()+"). Check maximumViewportWidth.");if(this.viewport.height>n.maximumViewportHeight)throw new o("renderState.viewport.height must be less than or equal to the maximum viewport height ("+this.maximumViewportHeight.toString()+"). Check maximumViewportHeight.")}this.id=0,this._applyFunctions=[]},E=function(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)},b=function(e,t){var i=t.sampleCoverage,r=i.enabled;s(e,e.SAMPLE_COVERAGE,r),r&&e.sampleCoverage(i.value,i.invert)},x=new e;return S.apply=function(e,t,i){l(e,t),u(e,t),c(e,t),h(e,t),p(e,t),m(e,t),f(e,t),v(e,t),g(e,t),y(e,t),b(e,t),d(e,t,i),_(e,t,i),C(e,t,i)},S.partialApply=function(e,t,i,n,o){if(t!==i){var a=i._applyFunctions[t.id];r(a)||(a=w(t,i),i._applyFunctions[t.id]=a);for(var s=a.length,l=0;s>l;++l)a[l](e,i)}var u=r(n.scissorTest)?n.scissorTest:t.scissorTest,c=r(o.scissorTest)?o.scissorTest:i.scissorTest;u!==c&&d(e,i,o);var h=r(n.blendingEnabled)?n.blendingEnabled:t.blending.enabled,p=r(o.blendingEnabled)?o.blendingEnabled:i.blending.enabled;(h!==p||p&&t.blending!==i.blending)&&_(e,i,o),(t!==i||n.context!==o.context)&&C(e,i,o)},S.clone=function(i){return{frontFace:i.frontFace,cull:{enabled:i.cull.enabled,face:i.cull.face},lineWidth:i.lineWidth,polygonOffset:{enabled:i.polygonOffset.enabled,factor:i.polygonOffset.factor,units:i.polygonOffset.units},scissorTest:{enabled:i.scissorTest.enabled,rectangle:e.clone(i.scissorTest.rectangle)},depthRange:{near:i.depthRange.near,far:i.depthRange.far},depthTest:{enabled:i.depthTest.enabled,func:i.depthTest.func},colorMask:{red:i.colorMask.red,green:i.colorMask.green,blue:i.colorMask.blue,alpha:i.colorMask.alpha},depthMask:i.depthMask,stencilMask:i.stencilMask,blending:{enabled:i.blending.enabled,color:t.clone(i.blending.color),equationRgb:i.blending.equationRgb,equationAlpha:i.blending.equationAlpha,functionSourceRgb:i.blending.functionSourceRgb,functionSourceAlpha:i.blending.functionSourceAlpha,functionDestinationRgb:i.blending.functionDestinationRgb,functionDestinationAlpha:i.blending.functionDestinationAlpha},stencilTest:{enabled:i.stencilTest.enabled,frontFunction:i.stencilTest.frontFunction,backFunction:i.stencilTest.backFunction,reference:i.stencilTest.reference,mask:i.stencilTest.mask,frontOperation:{fail:i.stencilTest.frontOperation.fail,zFail:i.stencilTest.frontOperation.zFail,zPass:i.stencilTest.frontOperation.zPass},backOperation:{fail:i.stencilTest.backOperation.fail,zFail:i.stencilTest.backOperation.zFail,zPass:i.stencilTest.backOperation.zPass}},sampleCoverage:{enabled:i.sampleCoverage.enabled,value:i.sampleCoverage.value,invert:i.sampleCoverage.invert},viewport:r(i.viewport)?e.clone(i.viewport):void 0}},S}),i("Renderer/createUniform",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/defined","../Core/DeveloperError","../Core/Matrix2","../Core/Matrix3","../Core/Matrix4","../Core/RuntimeError"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e,t,i,r){this.name=i,this.value=void 0,this._value=0,this._gl=e,this._location=r}function h(t,i,r,n){this.name=r,this.value=void 0,this._value=new e,this._gl=t,this._location=n}function d(e,t,i,r){this.name=i,this.value=void 0,this._value=void 0,this._gl=e,this._location=r}function p(e,t,i,r){this.name=i,this.value=void 0,this._value=void 0,this._gl=e,this._location=r}function m(e,t,i,r){this.name=i,this.value=void 0,this._gl=e,this._location=r,this.textureUnitIndex=void 0}function f(e,t,i,r){this.name=i,this.value=void 0,this._value=0,this._gl=e,this._location=r}function v(t,i,r,n){this.name=r,this.value=void 0,this._value=new e,this._gl=t,this._location=n}function g(e,i,r,n){this.name=r,this.value=void 0,this._value=new t,this._gl=e,this._location=n}function _(e,t,r,n){this.name=r,this.value=void 0,this._value=new i,this._gl=e,this._location=n}function y(e,t,i,r){this.name=i,this.value=void 0,this._value=new Float32Array(4),this._gl=e,this._location=r}function C(e,t,i,r){this.name=i,this.value=void 0,this._value=new Float32Array(9),this._gl=e,this._location=r}function w(e,t,i,r){this.name=i,this.value=void 0,this._value=new Float32Array(16),this._gl=e,this._location=r}var S=function(e,t,i,r){switch(t.type){case e.FLOAT:return new c(e,t,i,r);case e.FLOAT_VEC2:return new h(e,t,i,r);case e.FLOAT_VEC3:return new d(e,t,i,r);case e.FLOAT_VEC4:return new p(e,t,i,r);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new m(e,t,i,r);case e.INT:case e.BOOL:return new f(e,t,i,r);case e.INT_VEC2:case e.BOOL_VEC2:return new v(e,t,i,r);case e.INT_VEC3:case e.BOOL_VEC3:return new g(e,t,i,r);case e.INT_VEC4:case e.BOOL_VEC4:return new _(e,t,i,r);case e.FLOAT_MAT2:return new y(e,t,i,r);case e.FLOAT_MAT3:return new C(e,t,i,r);case e.FLOAT_MAT4:return new w(e,t,i,r);default:throw new u("Unrecognized uniform type: "+t.type+' for uniform "'+i+'".')}};return c.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))},h.prototype.set=function(){var t=this.value;e.equals(t,this._value)||(e.clone(t,this._value),this._gl.uniform2f(this._location,t.x,t.y))},d.prototype.set=function(){var e=this.value;if(n(e.red))r.equals(e,this._value)||(this._value=r.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue));else{if(!n(e.x))throw new o('Invalid vec3 value for uniform "'+this._activethis.name+'".');t.equals(e,this._value)||(this._value=t.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z))}},p.prototype.set=function(){var e=this.value;if(n(e.red))r.equals(e,this._value)||(this._value=r.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha));else{if(!n(e.x))throw new o('Invalid vec4 value for uniform "'+this._activethis.name+'".');i.equals(e,this._value)||(this._value=i.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w))}},m.prototype.set=function(){var e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);var t=this.value;e.bindTexture(t._target,t._texture)},m.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1},f.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))},v.prototype.set=function(){var t=this.value;e.equals(t,this._value)||(e.clone(t,this._value),this._gl.uniform2i(this._location,t.x,t.y))},g.prototype.set=function(){var e=this.value;t.equals(e,this._value)||(t.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))},_.prototype.set=function(){var e=this.value;i.equals(e,this._value)||(i.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))},y.prototype.set=function(){a.equalsArray(this.value,this._value,0)||(a.toArray(this.value,this._value),this._gl.uniformMatrix2fv(this._location,!1,this._value))},C.prototype.set=function(){s.equalsArray(this.value,this._value,0)||(s.toArray(this.value,this._value),this._gl.uniformMatrix3fv(this._location,!1,this._value))},w.prototype.set=function(){l.equalsArray(this.value,this._value,0)||(l.toArray(this.value,this._value),this._gl.uniformMatrix4fv(this._location,!1,this._value))},S}),i("Renderer/createUniformArray",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix2","../Core/Matrix3","../Core/Matrix4","../Core/RuntimeError"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(n),this._gl=e,this._location=r[0]}function d(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(2*n),this._gl=e,this._location=r[0]}function p(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(3*n),this._gl=e,this._location=r[0]}function m(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(4*n),this._gl=e,this._location=r[0]}function f(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(n),this._gl=e,this._locations=r,this.textureUnitIndex=void 0}function v(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(n),this._gl=e,this._location=r[0]}function g(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(2*n),this._gl=e,this._location=r[0]}function _(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(3*n),this._gl=e,this._location=r[0]}function y(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(4*n),this._gl=e,this._location=r[0]}function C(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(4*n),this._gl=e,this._location=r[0]}function w(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(9*n),this._gl=e,this._location=r[0]}function S(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(16*n),this._gl=e,this._location=r[0]}var E=function(e,t,i,r){switch(t.type){case e.FLOAT:return new h(e,t,i,r);case e.FLOAT_VEC2:return new d(e,t,i,r);case e.FLOAT_VEC3:return new p(e,t,i,r);case e.FLOAT_VEC4:return new m(e,t,i,r);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new f(e,t,i,r);case e.INT:case e.BOOL:return new v(e,t,i,r);case e.INT_VEC2:case e.BOOL_VEC2:return new g(e,t,i,r);case e.INT_VEC3:case e.BOOL_VEC3:return new _(e,t,i,r);case e.INT_VEC4:case e.BOOL_VEC4:return new y(e,t,i,r);case e.FLOAT_MAT2:return new C(e,t,i,r);case e.FLOAT_MAT3:return new w(e,t,i,r);case e.FLOAT_MAT4:return new S(e,t,i,r);default:throw new c("Unrecognized uniform type: "+t.type+' for uniform "'+i+'".')}};return h.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0;t>n;++n){var o=e[n];o!==i[n]&&(i[n]=o,r=!0)}r&&this._gl.uniform1fv(this._location,i)},d.prototype.set=function(){for(var t=this.value,i=t.length,r=this._value,n=!1,o=0,a=0;i>a;++a){var s=t[a];e.equalsArray(s,r,o)||(e.pack(s,r,o),n=!0),o+=2}n&&this._gl.uniform2fv(this._location,r)},p.prototype.set=function(){for(var e=this.value,i=e.length,r=this._value,o=!1,s=0,l=0;i>l;++l){var u=e[l];if(n(u.red))(u.red!==r[s]||u.green!==r[s+1]||u.blue!==r[s+2])&&(r[s]=u.red,r[s+1]=u.green,r[s+2]=u.blue,o=!0);else{if(!n(u.x))throw new a("Invalid vec3 value.");t.equalsArray(u,r,s)||(t.pack(u,r,s),o=!0)}s+=3}o&&this._gl.uniform3fv(this._location,r)},m.prototype.set=function(){for(var e=this.value,t=e.length,o=this._value,s=!1,l=0,u=0;t>u;++u){var c=e[u];if(n(c.red))r.equalsArray(c,o,l)||(r.pack(c,o,l),s=!0);else{if(!n(c.x))throw new a("Invalid vec4 value.");i.equalsArray(c,o,l)||(i.pack(c,o,l),s=!0)}l+=4}s&&this._gl.uniform4fv(this._location,o)},f.prototype.set=function(){for(var e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,i=this.value,r=i.length,n=0;r>n;++n){var o=i[n];e.activeTexture(t+n),e.bindTexture(o._target,o._texture)}},f.prototype._setSampler=function(e){this.textureUnitIndex=e;for(var t=this._locations,i=t.length,r=0;i>r;++r){var n=e+r;this._gl.uniform1i(t[r],n)}return e+i},v.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0;t>n;++n){var o=e[n];o!==i[n]&&(i[n]=o,r=!0)}r&&this._gl.uniform1iv(this._location,i)},g.prototype.set=function(){for(var t=this.value,i=t.length,r=this._value,n=!1,o=0,a=0;i>a;++a){var s=t[a];e.equalsArray(s,r,o)||(e.pack(s,r,o),n=!0),o+=2}n&&this._gl.uniform2iv(this._location,r)},_.prototype.set=function(){for(var e=this.value,i=e.length,r=this._value,n=!1,o=0,a=0;i>a;++a){var s=e[a];t.equalsArray(s,r,o)||(t.pack(s,r,o),n=!0),o+=3}n&&this._gl.uniform3iv(this._location,r)},y.prototype.set=function(){for(var e=this.value,t=e.length,r=this._value,n=!1,o=0,a=0;t>a;++a){var s=e[a];i.equalsArray(s,r,o)||(i.pack(s,r,o),n=!0),o+=4}n&&this._gl.uniform4iv(this._location,r)},C.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,o=0;t>o;++o){var a=e[o];s.equalsArray(a,i,n)||(s.pack(a,i,n),r=!0),n+=4}r&&this._gl.uniformMatrix2fv(this._location,!1,i)},w.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,o=0;t>o;++o){var a=e[o];l.equalsArray(a,i,n)||(l.pack(a,i,n),r=!0),n+=9}r&&this._gl.uniformMatrix3fv(this._location,!1,i)},S.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,o=0;t>o;++o){var a=e[o];u.equalsArray(a,i,n)||(u.pack(a,i,n),r=!0),n+=16}r&&this._gl.uniformMatrix4fv(this._location,!1,i)},E}),i("Renderer/ShaderProgram",["../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/RuntimeError","./AutomaticUniforms","./createUniform","./createUniformArray"],function(e,t,i,r,n,o,a,s){"use strict";function l(t,i){var r=i._vertexShaderText,o=i._fragmentShaderText,a=t.createShader(t.VERTEX_SHADER);t.shaderSource(a,r),t.compileShader(a);var s=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(s,o),t.compileShader(s);var l=t.createProgram();t.attachShader(l,a),t.attachShader(l,s),t.deleteShader(a),t.deleteShader(s);var u=i._attributeLocations;if(e(u))for(var c in u)u.hasOwnProperty(c)&&t.bindAttribLocation(l,u[c],c);t.linkProgram(l);var h;if(!t.getProgramParameter(l,t.LINK_STATUS)){var d=i._debugShaders;if(!t.getShaderParameter(s,t.COMPILE_STATUS)){if(h=t.getShaderInfoLog(s),console.error(v+"Fragment shader compile log: "+h),e(d)){var p=d.getTranslatedShaderSource(s);""!==p?console.error(v+"Translated fragment shader source:\n"+p):console.error(v+"Fragment shader translation failed.")}throw t.deleteProgram(l),new n("Fragment shader failed to compile. Compile log: "+h)}if(!t.getShaderParameter(a,t.COMPILE_STATUS)){if(h=t.getShaderInfoLog(a),console.error(v+"Vertex shader compile log: "+h),e(d)){var m=d.getTranslatedShaderSource(a);""!==m?console.error(v+"Translated vertex shader source:\n"+m):console.error(v+"Vertex shader translation failed.")}throw t.deleteProgram(l),new n("Vertex shader failed to compile. Compile log: "+h)}throw h=t.getProgramInfoLog(l),console.error(v+"Shader program link log: "+h),e(d)&&(console.error(v+"Translated vertex shader source:\n"+d.getTranslatedShaderSource(a)),console.error(v+"Translated fragment shader source:\n"+d.getTranslatedShaderSource(s))),t.deleteProgram(l),new n("Program failed to link. Link log: "+h)}var f=i._logShaderCompilation;return f&&(h=t.getShaderInfoLog(a),e(h)&&h.length>0&&console.log(v+"Vertex shader compile log: "+h)),f&&(h=t.getShaderInfoLog(s),e(h)&&h.length>0&&console.log(v+"Fragment shader compile log: "+h)),f&&(h=t.getProgramInfoLog(l),e(h)&&h.length>0&&console.log(v+"Shader program link log: "+h)),l}function u(e,t,i){for(var r={},n=0;i>n;++n){var o=e.getActiveAttrib(t,n),a=e.getAttribLocation(t,o.name);r[o.name]={name:o.name,type:o.type,index:a}}return r}function c(t,i){for(var r={},n=[],o=[],l=t.getProgramParameter(i,t.ACTIVE_UNIFORMS),u=0;l>u;++u){var c=t.getActiveUniform(i,u),h="[0]",d=-1!==c.name.indexOf(h,c.name.length-h.length)?c.name.slice(0,c.name.length-3):c.name;if(0!==d.indexOf("gl_"))if(c.name.indexOf("[")<0){var p=t.getUniformLocation(i,d);if(null!==p){var m=a(t,c,d,p);r[d]=m,n.push(m),m._setSampler&&o.push(m)}}else{var f,v,g,_,y=d.indexOf("[");if(y>=0){if(f=r[d.slice(0,y)],!e(f))continue;v=f._locations,v.length<=1&&(g=f.value,_=t.getUniformLocation(i,d),null!==_&&(v.push(_),g.push(t.getUniform(i,_))))}else{v=[];for(var C=0;Co;++o)r=i[o]._setSampler(r);return e.useProgram(null),r}function p(t){if(!e(t._program)){var i=t._gl,r=l(i,t,t._debugShaders),n=i.getProgramParameter(r,i.ACTIVE_ATTRIBUTES),o=c(i,r),a=h(o.uniformsByName);t._program=r,t._numberOfVertexAttributes=n,t._vertexAttributes=u(i,r,n),t._uniformsByName=o.uniformsByName,t._uniforms=o.uniforms,t._automaticUniforms=a.automaticUniforms,t._manualUniforms=a.manualUniforms,t.maximumTextureUnitIndex=d(i,r,o.samplerUniforms)}}var m=0,f=function(e){this._gl=e.gl,this._logShaderCompilation=e.logShaderCompilation,this._debugShaders=e.debugShaders,this._attributeLocations=e.attributeLocations,this._program=void 0,this._numberOfVertexAttributes=void 0,this._vertexAttributes=void 0,this._uniformsByName=void 0,this._uniforms=void 0,this._automaticUniforms=void 0,this._manualUniforms=void 0,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=e.fragmentShaderText,this.id=m++};t(f.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return p(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return p(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return p(this),this._uniformsByName}}});var v="[Cesium WebGL] ";return f.prototype._bind=function(){p(this),this._gl.useProgram(this._program)},f.prototype._setUniforms=function(t,i,n){var o,a;if(e(t)){var s=this._manualUniforms;for(o=s.length,a=0;o>a;++a){var l=s[a];l.value=t[l.name]()}}var u=this._automaticUniforms;for(o=u.length,a=0;o>a;++a){var c=u[a];c.uniform.value=c.automaticUniform.getValue(i)}var h=this._uniforms;for(o=h.length,a=0;o>a;++a)h[a].set();if(n){var d=this._gl,p=this._program;if(d.validateProgram(p),!d.getProgramParameter(p,d.VALIDATE_STATUS))throw new r("Program validation failed. Program info log: "+d.getProgramInfoLog(p))}},f.prototype.isDestroyed=function(){return!1},f.prototype.destroy=function(){return this._cachedShader.cache.releaseShaderProgram(this),void 0},f.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),i(this)},f}),i("Renderer/ShaderCache",["../Core/defined","../Core/defineProperties","../Core/destroyObject","./ShaderProgram","./ShaderSource"],function(e,t,i,r,n){"use strict";var o=function(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}};return t(o.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}}),o.prototype.replaceShaderProgram=function(t,i,r,n){return e(t)&&t.destroy(),this.getShaderProgram(i,r,n)},o.prototype.getShaderProgram=function(e,t,i){"string"==typeof e&&(e=new n({sources:[e]})),"string"==typeof t&&(t=new n({sources:[t]}));var o,a=e.createCombinedVertexShader(),s=t.createCombinedFragmentShader(),l=a+s+JSON.stringify(i);if(this._shaders[l])o=this._shaders[l],delete this._shadersToRelease[l];else{var u=this._context,c=new r({gl:u._gl,logShaderCompilation:u.logShaderCompilation,debugShaders:u.debugShaders,vertexShaderSource:e,vertexShaderText:a,fragmentShaderSource:t,fragmentShaderText:s,attributeLocations:i});o={cache:this,shaderProgram:c,keyword:l,count:0},c._cachedShader=o,this._shaders[l]=o,++this._numberOfShaders}return++o.count,o.shaderProgram},o.prototype.destroyReleasedShaderPrograms=function(){var e=this._shadersToRelease;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];delete this._shaders[i.keyword],i.shaderProgram.finalDestroy(),--this._numberOfShaders}this._shadersToRelease={}},o.prototype.releaseShaderProgram=function(e){if(e){var t=e._cachedShader;t&&0===--t.count&&(this._shadersToRelease[t.keyword]=t)}},o.prototype.isDestroyed=function(){return!1},o.prototype.destroy=function(){var e=this._shaders;for(var t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return i(this)},o}),i("Renderer/UniformState",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defined","../Core/defineProperties","../Core/EncodedCartesian3","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Simon1994PlanetaryPositions","../Core/Transforms","../Scene/SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e,t){c.clone(t,e._view),c.getRotation(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function f(e,t){c.clone(t,e._inverseView),c.getRotation(t,e._inverseViewRotation)}function v(e,t){c.clone(t,e._projection),e._inverseProjectionDirty=!0,e._inverseProjectionOITDirty=!0,e._viewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function g(e,t){c.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function _(e,t){i.clone(t.positionWC,e._cameraPosition),i.clone(t.directionWC,e._cameraDirection),i.clone(t.rightWC,e._cameraRight),i.clone(t.upWC,e._cameraUp),e._encodedCameraPositionMCDirty=!0}function y(e,t){o(d.computeIcrfToFixedMatrix(t.time,U))||(U=d.computeTemeToPseudoFixedMatrix(t.time,U));var r=h.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);u.multiplyByVector(U,r,r),i.normalize(r,e._sunDirectionWC),r=u.multiplyByVector(e.viewRotation3D,r,e._sunDirectionEC),i.normalize(r,r),r=h.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),u.multiplyByVector(U,r,r),u.multiplyByVector(e.viewRotation3D,r,r),i.normalize(r,r);var n=t.mapProjection,a=n.ellipsoid,s=a.cartesianToCartographic(e._sunPositionWC,W);n.project(s,e._sunPositionColumbusView)}function C(e){if(e._viewportDirty){var t=e._viewport;c.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),c.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function w(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,c.inverse(e._projection,e._inverseProjection))}function S(e){e._inverseProjectionOITDirty&&(e._inverseProjectionOITDirty=!1,e._mode!==p.SCENE2D&&e._mode!==p.MORPHING?c.inverse(e._projection,e._inverseProjectionOIT):c.clone(c.IDENTITY,e._inverseProjectionOIT))}function E(e){e._modelViewDirty&&(e._modelViewDirty=!1,c.multiplyTransformation(e._view,e._model,e._modelView))}function b(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,c.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function x(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,c.inverse(e.modelView,e._inverseModelView))}function T(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,c.inverse(e.modelView3D,e._inverseModelView3D))}function P(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,c.multiply(e._projection,e._view,e._viewProjection))}function A(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,c.inverse(e.viewProjection,e._inverseViewProjection))}function D(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,c.multiply(e._projection,e.modelView,e._modelViewProjection))}function M(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;var t=e.modelView,i=e._modelViewRelativeToEye;i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=0,i[13]=0,i[14]=0,i[15]=t[15]}}function I(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,c.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function O(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,c.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function R(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,c.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function L(e){if(e._normalDirty){e._normalDirty=!1;var t=e._normal;c.getRotation(e.inverseModelView,t),u.transpose(t,t)}}function N(e){if(e._normal3DDirty){e._normal3DDirty=!1;var t=e._normal3D;c.getRotation(e.inverseModelView3D,t),u.transpose(t,t)}}function F(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,c.getRotation(e.inverseModelView,e._inverseNormal))}function B(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,c.getRotation(e.inverseModelView3D,e._inverseNormal3D))}function z(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,c.multiplyByPoint(e.inverseModel,e._cameraPosition,G),s.fromCartesian(G,e._encodedCameraPositionMC))}function k(e,t,r,n,a,s,u,h){var m=H;m.x=e.y,m.y=e.z,m.z=e.x;var f=q;f.x=r.y,f.y=r.z,f.z=r.x;var v=j;v.x=n.y,v.y=n.z,v.z=n.x;var g=Y;g.x=t.y,g.y=t.z,g.z=t.x,s===p.SCENE2D&&(m.z=.5*a);var _=u.unproject(m,X);_.longitude=l.clamp(_.longitude,-Math.PI,Math.PI),_.latitude=l.clamp(_.latitude,-l.PI_OVER_TWO,l.PI_OVER_TWO);var y=u.ellipsoid,C=y.cartographicToCartesian(_,Z),w=d.eastNorthUpToFixedFrame(C,y,J);return c.multiplyByPointAsVector(w,f,f),c.multiplyByPointAsVector(w,v,v),c.multiplyByPointAsVector(w,g,g),o(h)||(h=new c),h[0]=f.x,h[1]=v.x,h[2]=-g.x,h[3]=0,h[4]=f.y,h[5]=v.y,h[6]=-g.y,h[7]=0,h[8]=f.z,h[9]=v.z,h[10]=-g.z,h[11]=0,h[12]=-i.dot(f,C),h[13]=-i.dot(v,C),h[14]=i.dot(g,C),h[15]=1,h}var V=function(){this.globeDepthTexture=void 0,this._viewport=new e,this._viewportCartesian4=new r,this._viewportDirty=!1,this._viewportOrthographicMatrix=c.clone(c.IDENTITY),this._viewportTransformation=c.clone(c.IDENTITY),this._model=c.clone(c.IDENTITY),this._view=c.clone(c.IDENTITY),this._inverseView=c.clone(c.IDENTITY),this._projection=c.clone(c.IDENTITY),this._infiniteProjection=c.clone(c.IDENTITY),this._entireFrustum=new t,this._currentFrustum=new t,this._frameState=void 0,this._temeToPseudoFixed=u.clone(c.IDENTITY),this._view3DDirty=!0,this._view3D=new c,this._inverseView3DDirty=!0,this._inverseView3D=new c,this._inverseModelDirty=!0,this._inverseModel=new c,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new u,this._viewRotation=new u,this._inverseViewRotation=new u,this._viewRotation3D=new u,this._inverseViewRotation3D=new u,this._inverseProjectionDirty=!0,this._inverseProjection=new c,this._inverseProjectionOITDirty=!0,this._inverseProjectionOIT=new c,this._modelViewDirty=!0,this._modelView=new c,this._modelView3DDirty=!0,this._modelView3D=new c,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new c,this._inverseModelViewDirty=!0,this._inverseModelView=new c,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new c,this._viewProjectionDirty=!0,this._viewProjection=new c,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new c,this._modelViewProjectionDirty=!0,this._modelViewProjection=new c,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new c,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new c,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new c,this._normalDirty=!0,this._normal=new u,this._normal3DDirty=!0,this._normal3D=new u,this._inverseNormalDirty=!0,this._inverseNormal=new u,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new u,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new s,this._cameraPosition=new i,this._sunPositionWC=new i,this._sunPositionColumbusView=new i,this._sunDirectionWC=new i,this._sunDirectionEC=new i,this._moonDirectionEC=new i,this._mode=void 0,this._mapProjection=void 0,this._cameraDirection=new i,this._cameraRight=new i,this._cameraUp=new i,this._frustum2DWidth=0,this._eyeHeight2D=new t,this._resolutionScale=1};a(V.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(t){if(!e.equals(t,this._viewport)){e.clone(t,this._viewport);var i=this._viewport,r=this._viewportCartesian4;r.x=i.x,r.y=i.y,r.z=i.width,r.w=i.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return C(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return C(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){c.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._viewProjectionDirty=!0,this._inverseViewProjectionDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,c.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTranposeModel:{get:function(){var e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,c.getRotation(this.inverseModel,e),u.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return this._view3DDirty&&(this._mode===p.SCENE3D?c.clone(this._view,this._view3D):k(this._cameraPosition,this._cameraDirection,this._cameraRight,this._cameraUp,this._frustum2DWidth,this._mode,this._mapProjection,this._view3D),c.getRotation(this._view3D,this._viewRotation3D),this._view3DDirty=!1),this._view3D}},viewRotation:{get:function(){return this._viewRotation}},viewRotation3D:{get:function(){return this.view3D,this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return this._inverseView3DDirty&&(c.inverseTransformation(this.view3D,this._inverseView3D),c.getRotation(this._inverseView3D,this._inverseViewRotation3D),this._inverseView3DDirty=!1),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return this.inverseView3D,this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return w(this),this._inverseProjection}},inverseProjectionOIT:{get:function(){return S(this),this._inverseProjectionOIT}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return E(this),this._modelView}},modelView3D:{get:function(){return b(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return M(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return x(this),this._inverseModelView}},inverseModelView3D:{get:function(){return T(this),this._inverseModelView3D}},viewProjection:{get:function(){return P(this),this._viewProjection}},inverseViewProjection:{get:function(){return A(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return D(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return I(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return O(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return R(this),this._modelViewInfiniteProjection}},normal:{get:function(){return L(this),this._normal}},normal3D:{get:function(){return N(this),this._normal3D}},inverseNormal:{get:function(){return F(this),this._inverseNormal}},inverseNormal3D:{get:function(){return B(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum -}},currentFrustum:{get:function(){return this._currentFrustum}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},encodedCameraPositionMCHigh:{get:function(){return z(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return z(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},resolutionScale:{get:function(){return this._resolutionScale}}});var U=new u,W=new n;V.prototype.updateFrustum=function(e){v(this,e.projectionMatrix),o(e.infiniteProjectionMatrix)&&g(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far},V.prototype.update=function(e,t){this._mode=t.mode,this._mapProjection=t.mapProjection;var i=e._canvas;this._resolutionScale=i.width/i.clientWidth;var r=t.camera;m(this,r.viewMatrix),f(this,r.inverseViewMatrix),_(this,r),t.mode===p.SCENE2D?(this._frustum2DWidth=r.frustum.right-r.frustum.left,this._eyeHeight2D.x=.5*this._frustum2DWidth,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),y(this,t),this._entireFrustum.x=r.frustum.near,this._entireFrustum.y=r.frustum.far,this.updateFrustum(r.frustum),this._frameState=t,this._temeToPseudoFixed=d.computeTemeToPseudoFixedMatrix(t.time,this._temeToPseudoFixed)};var G=new i,H=new i,q=new i,j=new i,Y=new i,X=new n,Z=new i,J=new c;return V}),i("Renderer/VertexArray",["../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i,r,n,o){"use strict";function a(r,n,o){var a=i(n.vertexBuffer),s=i(n.value),l=n.value?n.value.length:n.componentsPerAttribute,u={index:t(n.index,o),enabled:t(n.enabled,!0),vertexBuffer:n.vertexBuffer,value:s?n.value.slice(0):void 0,componentsPerAttribute:l,componentDatatype:t(n.componentDatatype,e.FLOAT),normalize:t(n.normalize,!1),offsetInBytes:t(n.offsetInBytes,0),strideInBytes:t(n.strideInBytes,0)};if(a)u.vertexAttrib=function(e){e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),e.vertexAttribPointer(this.index,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),e.enableVertexAttribArray(this.index)},u.disableVertexAttribArray=function(e){e.disableVertexAttribArray(this.index)};else{switch(u.componentsPerAttribute){case 1:u.vertexAttrib=function(e){e.vertexAttrib1fv(this.index,this.value)};break;case 2:u.vertexAttrib=function(e){e.vertexAttrib2fv(this.index,this.value)};break;case 3:u.vertexAttrib=function(e){e.vertexAttrib3fv(this.index,this.value)};break;case 4:u.vertexAttrib=function(e){e.vertexAttrib4fv(this.index,this.value)}}u.disableVertexAttribArray=function(){}}r.push(u)}function s(e,t,r){for(var n=0;nr;++r){var n=e.getExtension(t[r]);if(n)return n}return void 0}function H(e,t,i,r){var n;"number"==typeof i?n=i:"object"==typeof i&&"number"==typeof i.byteLength&&(n=i.byteLength);var o=e.createBuffer();return e.bindBuffer(t,o),e.bufferData(t,i,r),e.bindBuffer(t,null),new y(e,t,n,r,o)}function q(e){if(e.validateFramebuffer){var t=e._gl,i=t.checkFramebufferStatus(t.FRAMEBUFFER);if(i!==t.FRAMEBUFFER_COMPLETE){var r;switch(i){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:r="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.";break;case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:r="Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height.";break;case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:r="Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer.";break;case t.FRAMEBUFFER_UNSUPPORTED:r="Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions."}throw new l(r)}}}function j(e,t,i){var r=e._currentRenderState,n=e._currentPassState;e._currentRenderState=t,e._currentPassState=i,M.partialApply(e._gl,r,t,n,i)}function Y(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;var i=nt;if(o(t))t._bind(),q(e,t),i=t._getActiveColorAttachments();else{var r=e._gl;r.bindFramebuffer(r.FRAMEBUFFER,null)}e.drawBuffers&&e._drawBuffers.drawBuffersWEBGL(i)}}function X(e,t,i,r,o,a){var s=n(n(o,i.renderState),e._defaultRenderState);Y(e,t),j(e,s,r);var l=n(a,i.shaderProgram);l._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,l.maximumTextureUnitIndex)}function Z(e,t,i){var r=t.primitiveType,a=t.vertexArray,s=t.offset,l=t.count;e._us.model=n(t.modelMatrix,m.IDENTITY);var u=n(i,t.shaderProgram);u._setUniforms(t.uniformMap,e._us,e.validateShaderProgram),a._bind();var c=a.indexBuffer;o(c)?(s*=c.bytesPerIndex,l=n(l,c.numberOfIndices),e._gl.drawElements(r,l,c.indexDatatype,s)):(l=n(l,a.numberOfVertices),e._gl.drawArrays(r,s,l)),a._unBind()}function J(e){return e.values.length/e.componentsPerAttribute}function Q(e){return i.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function K(e){var t,r,n,a=[];for(r in e)e.hasOwnProperty(r)&&o(e[r])&&o(e[r].values)&&(a.push(r),e[r].componentDatatype===i.DOUBLE&&(e[r].componentDatatype=i.FLOAT,e[r].values=i.createTypedArray(i.FLOAT,e[r].values)));var s,l=a.length;if(l>0)for(s=J(e[a[0]]),t=1;l>t;++t){var u=J(e[a[t]]);if(u!==s)throw new g("Each attribute list must have the same number of vertices. Attribute "+a[t]+" has a different number of vertices "+"("+u.toString()+")"+" than attribute "+a[0]+" ("+s.toString()+").")}a.sort(function(t,r){return i.getSizeInBytes(e[r].componentDatatype)-i.getSizeInBytes(e[t].componentDatatype)});var c=0,h={};for(t=0;l>t;++t)r=a[t],n=e[r],h[r]=c,c+=Q(n);if(c>0){var d=i.getSizeInBytes(e[a[0]].componentDatatype),p=c%d;0!==p&&(c+=d-p);var m=s*c,f=new ArrayBuffer(m),v={};for(t=0;l>t;++t){r=a[t];var _=i.getSizeInBytes(e[r].componentDatatype);v[r]={pointer:i.createTypedArray(e[r].componentDatatype,f),index:h[r]/_,strideInComponentType:c/_}}for(t=0;s>t;++t)for(var y=0;l>y;++y){r=a[y],n=e[r];for(var C=n.values,w=v[r],S=w.pointer,E=n.componentsPerAttribute,b=0;E>b;++b)S[w.index+b]=C[t*E+b];w.index+=w.strideInComponentType}return{buffer:f,offsetsInBytes:h,vertexSizeInBytes:c}}return void 0}function $(e,t,i){this._pickObjects=e,this.key=t,this.color=i}var et=function(i,a){if("undefined"==typeof WebGLRenderingContext)throw new g("The browser does not support WebGL. Visit http://get.webgl.org.");this._canvas=i,a=e(a,!0),a=n(a,{}),a.allowTextureFilterAnisotropic=n(a.allowTextureFilterAnisotropic,!0);var s=n(a.webgl,{});if(s.alpha=n(s.alpha,!1),s.failIfMajorPerformanceCaveat=n(s.failIfMajorPerformanceCaveat,!0),u.isFirefox()&&u.isWindows()){var l=u.firefoxVersion();35===l[0]&&(s.alpha=!0)}if(this._originalGLContext=i.getContext("webgl",s)||i.getContext("experimental-webgl",s)||void 0,!o(this._originalGLContext))throw new g("The browser supports WebGL, but initialization failed.");this._id=r(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new I(this);var c=this._gl=this._originalGLContext;this._version=c.getParameter(c.VERSION),this._shadingLanguageVersion=c.getParameter(c.SHADING_LANGUAGE_VERSION),this._vendor=c.getParameter(c.VENDOR),this._renderer=c.getParameter(c.RENDERER),this._redBits=c.getParameter(c.RED_BITS),this._greenBits=c.getParameter(c.GREEN_BITS),this._blueBits=c.getParameter(c.BLUE_BITS),this._alphaBits=c.getParameter(c.ALPHA_BITS),this._depthBits=c.getParameter(c.DEPTH_BITS),this._stencilBits=c.getParameter(c.STENCIL_BITS),this._maximumCombinedTextureImageUnits=c.getParameter(c.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this._maximumCubeMapSize=c.getParameter(c.MAX_CUBE_MAP_TEXTURE_SIZE),this._maximumFragmentUniformVectors=c.getParameter(c.MAX_FRAGMENT_UNIFORM_VECTORS),this._maximumTextureImageUnits=c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS),this._maximumRenderbufferSize=c.getParameter(c.MAX_RENDERBUFFER_SIZE),this._maximumTextureSize=c.getParameter(c.MAX_TEXTURE_SIZE),this._maximumVaryingVectors=c.getParameter(c.MAX_VARYING_VECTORS),this._maximumVertexAttributes=c.getParameter(c.MAX_VERTEX_ATTRIBS),this._maximumVertexTextureImageUnits=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._maximumVertexUniformVectors=c.getParameter(c.MAX_VERTEX_UNIFORM_VECTORS),this._aliasedLineWidthRange=c.getParameter(c.ALIASED_LINE_WIDTH_RANGE),this._aliasedPointSizeRange=c.getParameter(c.ALIASED_POINT_SIZE_RANGE),this._maximumViewportDimensions=c.getParameter(c.MAX_VIEWPORT_DIMS),this._antialias=c.getContextAttributes().antialias,this._standardDerivatives=G(c,["OES_standard_derivatives"]),this._elementIndexUint=G(c,["OES_element_index_uint"]),this._depthTexture=G(c,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._textureFloat=G(c,["OES_texture_float"]);var h=a.allowTextureFilterAnisotropic?G(c,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=h,this._maximumTextureFilterAnisotropy=o(h)?c.getParameter(h.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1,this._vertexArrayObject=G(c,["OES_vertex_array_object"]),this._fragDepth=G(c,["EXT_frag_depth"]),this._drawBuffers=G(c,["WEBGL_draw_buffers"]),this._maximumDrawBuffers=o(this._drawBuffers)?c.getParameter(this._drawBuffers.MAX_DRAW_BUFFERS_WEBGL):1,this._maximumColorAttachments=o(this._drawBuffers)?c.getParameter(this._drawBuffers.MAX_COLOR_ATTACHMENTS_WEBGL):1,this._debugShaders=G(c,["WEBGL_debug_shaders"]);var d=c.getParameter(c.COLOR_CLEAR_VALUE);this._clearColor=new t(d[0],d[1],d[2],d[3]),this._clearDepth=c.getParameter(c.DEPTH_CLEAR_VALUE),this._clearStencil=c.getParameter(c.STENCIL_CLEAR_VALUE);var p=new F,m=new x(this),f=this.createRenderState();this._defaultPassState=m,this._defaultRenderState=f,this._defaultTexture=void 0,this._defaultCubeMap=void 0,this._us=p,this._currentRenderState=f,this._currentPassState=m,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options=a,this.cache={},M.apply(c,f,m)},tt={};a(et.prototype,{id:{get:function(){return this._id}},canvas:{get:function(){return this._canvas}},shaderCache:{get:function(){return this._shaderCache}},uniformState:{get:function(){return this._us}},version:{get:function(){return this._version}},shadingLanguageVersion:{get:function(){return this._shadingLanguageVersion}},vendor:{get:function(){return this._vendor}},renderer:{get:function(){return this._renderer}},redBits:{get:function(){return this._redBits}},greenBits:{get:function(){return this._greenBits}},blueBits:{get:function(){return this._blueBits}},alphaBits:{get:function(){return this._alphaBits}},depthBits:{get:function(){return this._depthBits}},stencilBits:{get:function(){return this._stencilBits}},maximumCombinedTextureImageUnits:{get:function(){return this._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return this._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return this._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return this._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return this._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return this._maximumTextureSize}},maximumVaryingVectors:{get:function(){return this._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return this._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return this._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return this._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return this._aliasedLineWidthRange[0]}},maximumAliasedLineWidth:{get:function(){return this._aliasedLineWidthRange[1]}},minimumAliasedPointSize:{get:function(){return this._aliasedPointSizeRange[0]}},maximumAliasedPointSize:{get:function(){return this._aliasedPointSizeRange[1]}},maximumViewportWidth:{get:function(){return this._maximumViewportDimensions[0]}},maximumViewportHeight:{get:function(){return this._maximumViewportDimensions[1]}},antialias:{get:function(){return this._antialias}},standardDerivatives:{get:function(){return!!this._standardDerivatives}},elementIndexUint:{get:function(){return!!this._elementIndexUint}},depthTexture:{get:function(){return!!this._depthTexture}},floatingPointTexture:{get:function(){return!!this._textureFloat}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},maximumTextureFilterAnisotropy:{get:function(){return this._maximumTextureFilterAnisotropy}},vertexArrayObject:{get:function(){return!!this._vertexArrayObject}},fragmentDepth:{get:function(){return!!this._fragDepth}},drawBuffers:{get:function(){return!!this._drawBuffers}},maximumDrawBuffers:{get:function(){return this._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return this._maximumColorAttachments}},debugShaders:{get:function(){return this._debugShaders}},throwOnWebGLError:{get:function(){return this._throwOnWebGLError},set:function(e){this._throwOnWebGLError=e,this._gl=W(this._originalGLContext,e?V:null)}},defaultTexture:{get:function(){return void 0===this._defaultTexture&&(this._defaultTexture=this.createTexture2D({source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])}})),this._defaultTexture}},defaultCubeMap:{get:function(){if(void 0===this._defaultCubeMap){var e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=this.createCubeMap({source:{positiveX:e,negativeX:e,positiveY:e,negativeY:e,positiveZ:e,negativeZ:e}})}return this._defaultCubeMap}},drawingBufferHeight:{get:function(){return this._gl.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._gl.drawingBufferWidth}},defaultFramebuffer:{get:function(){return tt}}}),et.prototype.replaceShaderProgram=function(e,t,i,r){return this._shaderCache.replaceShaderProgram(e,t,i,r)},et.prototype.createShaderProgram=function(e,t,i){return this._shaderCache.getShaderProgram(e,t,i)},et.prototype.createVertexBuffer=function(e,t){return H(this._gl,this._gl.ARRAY_BUFFER,e,t)},et.prototype.createIndexBuffer=function(e,t,i){if(i===d.UNSIGNED_INT&&!this.elementIndexUint)throw new l("IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint.");var r=d.getSizeInBytes(i),n=this._gl,o=H(n,n.ELEMENT_ARRAY_BUFFER,e,t),s=o.sizeInBytes/r;return a(o,{indexDatatype:{get:function(){return i}},bytesPerIndex:{get:function(){return r}},numberOfIndices:{get:function(){return s}}}),o},et.prototype.createVertexArray=function(e,t){return new B(this._gl,this._vertexArrayObject,e,t)},et.prototype.createTexture2D=function(e){return new O(this,e)},et.prototype.createTexture2DFromFramebuffer=function(e,t,i,r,a,s){var l=this._gl;e=n(e,f.RGB),t=n(t,0),i=n(i,0),r=n(r,l.drawingBufferWidth),a=n(a,l.drawingBufferHeight);var u=new O(this,{width:r,height:a,pixelFormat:e,source:{framebuffer:o(s)?s:this.defaultFramebuffer,xOffset:t,yOffset:i,width:r,height:a}});return u},et.prototype.createCubeMap=function(e){function t(e,t){t.arrayBufferView?m.texImage2D(e,0,c,u,u,0,c,h,t.arrayBufferView):m.texImage2D(e,0,c,c,h,t)}e=n(e,n.EMPTY_OBJECT);var i,r,a=e.source;if(o(a)){var s=[a.positiveX,a.negativeX,a.positiveY,a.negativeY,a.positiveZ,a.negativeZ];i=s[0].width,r=s[0].height}else i=e.width,r=e.height;var u=i,c=n(e.pixelFormat,f.RGBA),h=n(e.pixelDatatype,P.UNSIGNED_BYTE);if(h===P.FLOAT&&!this.floatingPointTexture)throw new l("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.");var d=e.preMultiplyAlpha||c===f.RGB||c===f.LUMINANCE,p=n(e.flipY,!0),m=this._gl,v=m.TEXTURE_CUBE_MAP,g=m.createTexture();return m.activeTexture(m.TEXTURE0),m.bindTexture(v,g),o(a)?(m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,p),t(m.TEXTURE_CUBE_MAP_POSITIVE_X,a.positiveX),t(m.TEXTURE_CUBE_MAP_NEGATIVE_X,a.negativeX),t(m.TEXTURE_CUBE_MAP_POSITIVE_Y,a.positiveY),t(m.TEXTURE_CUBE_MAP_NEGATIVE_Y,a.negativeY),t(m.TEXTURE_CUBE_MAP_POSITIVE_Z,a.positiveZ),t(m.TEXTURE_CUBE_MAP_NEGATIVE_Z,a.negativeZ)):(m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X,0,c,u,u,0,c,h,null),m.texImage2D(m.TEXTURE_CUBE_MAP_NEGATIVE_X,0,c,u,u,0,c,h,null),m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_Y,0,c,u,u,0,c,h,null),m.texImage2D(m.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,c,u,u,0,c,h,null),m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_Z,0,c,u,u,0,c,h,null),m.texImage2D(m.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,c,u,u,0,c,h,null)),m.bindTexture(v,null),new S(m,this._textureFilterAnisotropic,v,g,c,h,u,d,p)},et.prototype.createFramebuffer=function(e){return new b(this._gl,this._maximumColorAttachments,e)},et.prototype.createRenderbuffer=function(e){var t=this._gl;e=n(e,n.EMPTY_OBJECT);var i=n(e.format,D.RGBA4),r=o(e.width)?e.width:t.drawingBufferWidth,a=o(e.height)?e.height:t.drawingBufferHeight;return new A(t,i,r,a)};var it=0,rt={};et.prototype.createRenderState=function(e){var t=JSON.stringify(e),i=rt[t];if(o(i))return i;var r=new M(this,e),n=JSON.stringify(r);return i=rt[n],o(i)||(r.id=it++,i=r,rt[n]=i),rt[t]=i,i},et.prototype.createSampler=function(e){var t={wrapS:n(e.wrapS,N.CLAMP_TO_EDGE),wrapT:n(e.wrapT,N.CLAMP_TO_EDGE),minificationFilter:n(e.minificationFilter,L.LINEAR),magnificationFilter:n(e.magnificationFilter,R.LINEAR),maximumAnisotropy:o(e.maximumAnisotropy)?e.maximumAnisotropy:1};return t};var nt;"undefined"!=typeof WebGLRenderingContext&&(nt=[WebGLRenderingContext.BACK]);var ot=new w;et.prototype.clear=function(e,i){e=n(e,ot),i=n(i,this._defaultPassState);var r=this._gl,a=0,s=e.color,l=e.depth,u=e.stencil;o(s)&&(t.equals(this._clearColor,s)||(t.clone(s,this._clearColor),r.clearColor(s.red,s.green,s.blue,s.alpha)),a|=r.COLOR_BUFFER_BIT),o(l)&&(l!==this._clearDepth&&(this._clearDepth=l,r.clearDepth(l)),a|=r.DEPTH_BUFFER_BIT),o(u)&&(u!==this._clearStencil&&(this._clearStencil=u,r.clearStencil(u)),a|=r.STENCIL_BUFFER_BIT);var c=n(e.renderState,this._defaultRenderState);j(this,c,i);var h=n(e.framebuffer,i.framebuffer);Y(this,h),r.clear(a)},et.prototype.draw=function(e,t,i,r){t=n(t,this._defaultPassState);var o=n(e.framebuffer,t.framebuffer);X(this,o,e,t,i,r),Z(this,e,r)},et.prototype.endFrame=function(){var e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null),this.drawBuffers&&this._drawBuffers.drawBuffersWEBGL(nt);var t=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(var i=0;t>i;++i)e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)},et.prototype.readPixels=function(e){var t=this._gl;e=e||{};var i=Math.max(e.x||0,0),r=Math.max(e.y||0,0),n=e.width||t.drawingBufferWidth,o=e.height||t.drawingBufferHeight,a=e.framebuffer,s=new Uint8Array(4*n*o);return Y(this,a),t.readPixels(i,r,n,o,t.RGBA,t.UNSIGNED_BYTE,s),s},et.prototype.createVertexArrayFromGeometry=function(e){e=n(e,n.EMPTY_OBJECT);var t,r,a,s=n(e.geometry,n.EMPTY_OBJECT),l=n(e.bufferUsage,C.DYNAMIC_DRAW),u=n(e.attributeLocations,n.EMPTY_OBJECT),h=n(e.interleave,!1),m=e.vertexArrayAttributes,f=o(m)?m:[],v=s.attributes;if(h){var g=K(v);if(o(g)){a=this.createVertexBuffer(g.buffer,l);var _=g.offsetsInBytes,y=g.vertexSizeInBytes;for(t in v)v.hasOwnProperty(t)&&o(v[t])&&(r=v[t],o(r.values)?f.push({index:u[t],vertexBuffer:a,componentDatatype:r.componentDatatype,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize,offsetInBytes:_[t],strideInBytes:y}):f.push({index:u[t],value:r.value,componentDatatype:r.componentDatatype,normalize:r.normalize}))}}else for(t in v)if(v.hasOwnProperty(t)&&o(v[t])){r=v[t];var w=r.componentDatatype;w===i.DOUBLE&&(w=i.FLOAT),a=void 0,o(r.values)&&(a=this.createVertexBuffer(i.createTypedArray(w,r.values),l)),f.push({index:u[t],vertexBuffer:a,value:r.value,componentDatatype:w,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize})}var S,E=s.indices;return o(E)&&(S=c.computeNumberOfVertices(s)>p.SIXTY_FOUR_KILOBYTES&&this.elementIndexUint?this.createIndexBuffer(new Uint32Array(E),l,d.UNSIGNED_INT):this.createIndexBuffer(new Uint16Array(E),l,d.UNSIGNED_SHORT)),this.createVertexArray(f,S)};var at={position:0,textureCoordinates:1};return et.prototype.createViewportQuadCommand=function(e,t){var r=this.cache.viewportQuad_vertexArray;if(!o(r)){var a=new c({attributes:{position:new h({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new h({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:v.TRIANGLES});r=this.createVertexArrayFromGeometry({geometry:a,attributeLocations:{position:0,textureCoordinates:1},bufferUsage:C.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=r}return t=n(t,n.EMPTY_OBJECT),new E({vertexArray:r,primitiveType:v.TRIANGLES,renderState:t.renderState,shaderProgram:this.createShaderProgram(_,e,at),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer})},et.prototype.createPickFramebuffer=function(){return new T(this)},et.prototype.getObjectByPickColor=function(e){return this._pickObjects[e.toRgba()]},a($.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}}),$.prototype.destroy=function(){return delete this._pickObjects[this.key],void 0},et.prototype.createPickId=function(e){++this._nextPickColor[0];var i=this._nextPickColor[0];if(0===i)throw new g("Out of unique Pick IDs.");return this._pickObjects[i]=e,new $(this._pickObjects,i,t.fromRgba(i))},et.prototype.isDestroyed=function(){return!1},et.prototype.destroy=function(){var e=this.cache;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];o(i.destroy)&&i.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),s(this)},et}),i("Renderer/loadCubeMap",["../Core/defined","../Core/DeveloperError","../Core/loadImage","../ThirdParty/when"],function(e,t,i,r){"use strict";var n=function(e,t,n){var o=[i(t.positiveX,n),i(t.negativeX,n),i(t.positiveY,n),i(t.negativeY,n),i(t.positiveZ,n),i(t.negativeZ,n)];return r.all(o,function(t){return e.createCubeMap({source:{positiveX:t[0],negativeX:t[1],positiveY:t[2],negativeY:t[3],positiveZ:t[4],negativeZ:t[5]}})})};return n}),i("Scene/DiscardMissingTileImagePolicy",["../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/getImagePixels","../Core/loadImageViaBlob","../ThirdParty/when"],function(e,t,i,r,n,o){"use strict";var a=function(a){function s(e){t(e.blob)&&(u._missingImageByteLength=e.blob.size);var i=r(e);if(a.disableCheckIfAllPixelsAreTransparent){for(var n=!0,o=e.width,s=a.pixelsToCheck,l=0,c=s.length;n&&c>l;++l){var h=s[l],d=4*h.x+h.y*o,p=i[d+3];p>0&&(n=!1)}n&&(i=void 0)}u._missingImagePixels=i,u._isReady=!0}function l(){u._missingImagePixels=void 0,u._isReady=!0}if(a=e(a,e.EMPTY_OBJECT),!t(a.missingImageUrl))throw new i("options.missingImageUrl is required.");if(!t(a.pixelsToCheck))throw new i("options.pixelsToCheck is required.");this._pixelsToCheck=a.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;var u=this;o(n(a.missingImageUrl),s,l)};return a.prototype.isReady=function(){return this._isReady},a.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new i("shouldDiscardImage must not be called before the discard policy is ready.");var n=this._pixelsToCheck,o=this._missingImagePixels;if(!t(o))return!1;if(t(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;for(var a=r(e),s=e.width,l=0,u=n.length;u>l;++l)for(var c=n[l],h=4*c.x+c.y*s,d=0;4>d;++d){var p=h+d;if(a[p]!==o[p])return!1}return!0},a}),i("Scene/ImageryLayerFeatureInfo",["../Core/defined"],function(e){"use strict";var t=function(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0};return t.prototype.configureNameFromProperties=function(t){var i,r=10;for(var n in t)if(t.hasOwnProperty(n)&&t[n]){var o=n.toLowerCase();r>1&&"name"===o?(r=1,i=n):r>2&&"title"===o?(r=2,i=n):r>3&&/name/i.test(n)?(r=3,i=n):r>4&&/title/i.test(n)&&(r=4,i=n)}e(i)&&(this.name=t[i])},t.prototype.configureDescriptionFromProperties=function(t){function i(t){var r='';for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];e(o)&&(r+="object"==typeof o?"":"")}return r+="
"+n+""+i(o)+"
"+n+""+o+"
"}this.description=i(t)},t}),i("Scene/ImageryProvider",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/loadImage","../Core/loadImageViaBlob","../Core/throttleRequestByServer"],function(e,t,i,r,n,o){"use strict";var a=function(){this.defaultAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,i.throwInstantiationError()};return t(a.prototype,{ready:{get:i.throwInstantiationError},rectangle:{get:i.throwInstantiationError},tileWidth:{get:i.throwInstantiationError},tileHeight:{get:i.throwInstantiationError},maximumLevel:{get:i.throwInstantiationError},minimumLevel:{get:i.throwInstantiationError},tilingScheme:{get:i.throwInstantiationError},tileDiscardPolicy:{get:i.throwInstantiationError},errorEvent:{get:i.throwInstantiationError},credit:{get:i.throwInstantiationError},proxy:{get:i.throwInstantiationError},hasAlphaChannel:{get:i.throwInstantiationError}}),a.prototype.getTileCredits=i.throwInstantiationError,a.prototype.requestImage=i.throwInstantiationError,a.prototype.pickFeatures=i.throwInstantiationError,a.loadImage=function(t,i){return e(t.tileDiscardPolicy)?o(i,n):o(i,r)},a}),i("Scene/ArcGisMapServerImageryProvider",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/Math","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicProjection","../Core/GeographicTilingScheme","../Core/jsonp","../Core/loadJson","../Core/Rectangle","../Core/TileProviderError","../Core/WebMercatorProjection","../Core/WebMercatorTilingScheme","../ThirdParty/when","./DiscardMissingTileImagePolicy","./ImageryLayerFeatureInfo","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w){"use strict";function S(e,t,i,r){var n;if(e._useTiles)n=e._url+"/tile/"+r+"/"+i+"/"+t;else{var o=e._tilingScheme.tileXYToNativeRectangle(t,i,r),s=o.west+"%2C"+o.south+"%2C"+o.east+"%2C"+o.north;n=e._url+"/export?",n+="bbox="+s,n+=e._tilingScheme instanceof h?"&bboxSR=4326&imageSR=4326":"&bboxSR=3857&imageSR=3857",n+="&size="+e._tileWidth+"%2C"+e._tileHeight,n+="&format=png&transparent=true&f=image",e.layers&&(n+="&layers=show:"+e.layers)}var l=e._proxy;return a(l)&&(n=l.getURL(n)),n}var E=function(t){function i(i){var r=i.tileInfo;if(a(r)){if(c._tileWidth=r.rows,c._tileHeight=r.cols,102100===r.spatialReference.wkid||102113===r.spatialReference.wkid)c._tilingScheme=new g({ellipsoid:t.ellipsoid});else{if(4326!==i.tileInfo.spatialReference.wkid){var o="Tile spatial reference WKID "+i.tileInfo.spatialReference.wkid+" is not supported.";return l=f.handleError(l,c,c._errorEvent,o,void 0,void 0,void 0,s),void 0}c._tilingScheme=new h({ellipsoid:t.ellipsoid})}if(c._maximumLevel=i.tileInfo.lods.length-1,a(i.fullExtent)){if(a(i.fullExtent.spatialReference)&&a(i.fullExtent.spatialReference.wkid))if(102100===i.fullExtent.spatialReference.wkid||102113===i.fullExtent.spatialReference.wkid){var u=new v,d=u.unproject(new e(i.fullExtent.xmin,i.fullExtent.ymin)),p=u.unproject(new e(i.fullExtent.xmax,i.fullExtent.ymax)); -c._rectangle=new m(d.longitude,d.latitude,p.longitude,p.latitude)}else{if(4326!==i.fullExtent.spatialReference.wkid){var _="fullExtent.spatialReference WKID "+i.fullExtent.spatialReference.wkid+" is not supported.";return l=f.handleError(l,c,c._errorEvent,_,void 0,void 0,void 0,s),void 0}c._rectangle=m.fromDegrees(i.fullExtent.xmin,i.fullExtent.ymin,i.fullExtent.xmax,i.fullExtent.ymax)}}else c._rectangle=c._tilingScheme.rectangle;a(c._tileDiscardPolicy)||(c._tileDiscardPolicy=new y({missingImageUrl:S(c,0,0,c._maximumLevel),pixelsToCheck:[new e(0,0),new e(200,20),new e(20,200),new e(80,110),new e(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),c._useTiles=!0}else c._useTiles=!1;a(i.copyrightText)&&i.copyrightText.length>0&&(c._credit=new n(i.copyrightText)),c._ready=!0,f.handleSuccess(l)}function r(){var e="An error occurred while accessing "+c._url+".";l=f.handleError(l,c,c._errorEvent,e,void 0,void 0,void 0,s)}function s(){var e=d(c._url,{parameters:{f:"json"},proxy:c._proxy});_(e,i,r)}t=o(t,{}),this._url=t.url,this._tileDiscardPolicy=t.tileDiscardPolicy,this._proxy=t.proxy,this._tileWidth=o(t.tileWidth,256),this._tileHeight=o(t.tileHeight,256),this._maximumLevel=t.maximumLevel,this._tilingScheme=o(t.tilingScheme,new h({ellipsoid:t.ellipsoid})),this._credit=void 0,this._useTiles=o(t.usePreCachedTilesIfAvailable,!0),this._rectangle=o(t.rectangle,this._tilingScheme.rectangle),this._layers=t.layers,this._enablePickFeatures=o(t.enablePickFeatures,!0),this._errorEvent=new u,this._ready=!1;var l,c=this;this._useTiles?s():this._ready=!0};return s(E.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}},enablePickFeatures:{get:function(){return this._enablePickFeatures}}}),E.prototype.getTileCredits=function(){return void 0},E.prototype.requestImage=function(e,t,i){var r=S(this,e,t,i);return w.loadImage(this,r)},E.prototype.pickFeatures=function(e,n,o,s,l){if(!this._enablePickFeatures)return void 0;var u,c,d,m=this._tilingScheme.tileXYToNativeRectangle(e,n,o);if(this._tilingScheme instanceof h)u=r.toDegrees(s),c=r.toDegrees(l),d="4326";else{var f=this._tilingScheme.projection.project(new i(s,l,0));u=f.x,c=f.y,d="3857"}var g=this._url+"/identify?f=json&tolerance=2&geometryType=esriGeometryPoint";return g+="&geometry="+u+","+c,g+="&mapExtent="+m.west+","+m.south+","+m.east+","+m.north,g+="&imageDisplay="+this._tileWidth+","+this._tileHeight+",96",g+="&sr="+d,g+="&layers=visible",a(this._layers)&&(g+=":"+this._layers),p(g).then(function(e){var r=[],n=e.results;if(!a(n))return r;for(var o=0;oo;++o){for(var s=e[o],l=s.coverageAreas,u=!1,h=0,d=s.coverageAreas.length;!u&&d>h;++h){var p=l[h];if(t>=p.zoomMin&&t<=p.zoomMax){var m=c.intersection(i,p.bbox,w);n(m)&&(u=!0)}}u&&r.push(s.credit)}return r}var y=function S(o){function a(e){var r=e.resourceSets[0].resources[0];w._tileWidth=r.imageWidth,w._tileHeight=r.imageHeight,w._maximumLevel=r.zoomMax-1,w._imageUrlSubdomains=r.imageUrlSubdomains,w._imageUrlTemplate=r.imageUrl.replace("{culture}",w._culture);var o=w._tileProtocol;if(!n(o)){var a=document.location.protocol;o=/^http/.test(a)?a:"http:"}w._imageUrlTemplate=w._imageUrlTemplate.replace(/^http:/,o),n(w._tileDiscardPolicy)||(w._tileDiscardPolicy=new f({missingImageUrl:g(w,0,0,w._maximumLevel),pixelsToCheck:[new t(0,0),new t(120,140),new t(130,160),new t(200,50),new t(200,200)],disableCheckIfAllPixelsAreTransparent:!0}));var s=w._attributionList=r.imageryProviders;s||(s=w._attributionList=[]);for(var l=0,d=s.length;d>l;++l){var p=s[l];p.credit=new i(p.attribution);for(var m=p.coverageAreas,v=0,_=p.coverageAreas.length;_>v;++v){var C=m[v],S=C.bbox;C.bbox=new c(u.toRadians(S[1]),u.toRadians(S[0]),u.toRadians(S[3]),u.toRadians(S[2]))}}w._ready=!0,h.handleSuccess(y)}function v(){var e="An error occurred while accessing "+C+".";y=h.handleError(y,w,w._errorEvent,e,void 0,void 0,void 0,_)}function _(){var e=l(C,{callbackParameterName:"jsonp",proxy:w._proxy});p(e,a,v)}o=r(o,{}),this._key=e.getKey(o.key),this._url=o.url,this._tileProtocol=o.tileProtocol,this._mapStyle=r(o.mapStyle,m.AERIAL),this._culture=r(o.culture,""),this._tileDiscardPolicy=o.tileDiscardPolicy,this._proxy=o.proxy,this._credit=new i("Bing Imagery",S._logoData,"http://www.bing.com"),this.defaultGamma=1,(this._mapStyle===m.AERIAL||this._mapStyle===m.AERIAL_WITH_LABELS)&&(this.defaultGamma=1.3),this._tilingScheme=new d({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:o.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._errorEvent=new s,this._ready=!1;var y,C=this._url+"/REST/v1/Imagery/Metadata/"+this._mapStyle+"?incl=ImageryProviders&key="+this._key,w=this;_()};o(y.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});var C=new c;y.prototype.getTileCredits=function(e,t,i){if(!this._ready)throw new a("getTileCredits must not be called before the imagery provider is ready.");var r=this._tilingScheme.tileXYToRectangle(e,t,i,C);return _(this._attributionList,i,r)},y.prototype.requestImage=function(e,t,i){var r=g(this,e,t,i);return v.loadImage(this,r)},y.prototype.pickFeatures=function(){return void 0},y._logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAAaCAYAAAAEy1RnAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH3gIDEgcPTMnXOQAAClZJREFUWMPdWGtsFNcV/u689uH1+sXaONhlWQzBENtxiUFBpBSLd60IpXHSNig4URtSYQUkRJNSi0igViVVVBJBaBsiAgKRQJSG8AgEHCCWU4iBCprY2MSgXfOI16y9D3s9Mzsztz9yB12WNU2i9Ecy0tHOzN4793zn3POdcy7BnRfJ8I7iB3SRDPeEExswLz8Y0DZIAYDIRGAgLQAm+7Xle31J3L3Anp1MZPY+BUBjorN332vgYhpgV1FRUd6TTz45ubq6OtDV1SXpuu5g//Oept9wNwlMyAi8IXDjyF245TsDTdivDMATCATGNDU1/WbhwoWPTZs2bWx1dXWhx+Oxrl+/PqTrus5t9W8KWEzjinTAYhro/xuBStwiIgBnJBLxKIoy1u/3V/r9/krDMMz3339/Z3t7e38ikUgCMDLEt8W+Q0cAI3McYTDDmZxh7DESG5Ni43jg9Gsa+X+OsxWxPSJTSj3JZFK5ZRVJErOzs8e6XC4fgGwALhbzDgAKU1hK28KEA6PMmTMn56233qpevnz5PQDcbJ7EzVUAuMrLy3MBeABkcWOEDELSyFe4y7iMoHkriZZlKYZh8ASHZDKpJJPJHAC5APIA5APIAeBlCjo5TwlpXnbOmTPHP3fu3KZVq1atZKBcDJQ9x7V48WJfc3Pzhp6enj+tXLnyR8w4MjdG4gyVDk7KICMClzKlLUrpbQMNw5AkScppbGz8cWdn57WjR4/2caw+DEBlYjO8wX1foZQWuN3uKZIklQD4G+fhlG0Yl8uVm5WVVW6app6dne0D0G8vnxbjJntHubCUOK/badZICyWanrJuAaeUknTQpmlKkUhEWbx48U8LCwtHhUKha+fPn+85fPhwV0tLyzUACSZx9jvMFhIByNFoVDEMw/qKB5HPvJfkUqBr9+7deklJyZ/j8bi5ffv2OAslieMLsG+m2DybT2QuzEQOsF5SUqJfvXo1yc2l6Xn6rgSRSCSEc+fOhVeuXLmwoqJixvTp0wcWLFgQ7unpudHR0dF97ty5z/fu3XseQJh5adjeerquy5ZlCalUivh8Pt8HH3ywzOPxyD09PZ81NjZ+2NnZaQEQx40b54vFYqaqquEVK1b4a2tr/WvWrDn18ssv144fP36SqqoD69ev371nz57rDLwAwHHkyJGfjRs3rtowDOv06dOnu7q6rs6bN2/s7Nmz9zIjDKenWoFZKg/AlMLCwl82Nzf/m3LX22+/fXb06NF/ALC8u7u7m6ZdkUhksL29/UpLS0vzunXrVgAoBzAaQBGAiY2NjUui0ei1RCLRFwwG/9PX19cVi8WCqqoOdHd3HysrK6sDMCccDl8IBoOtiqIsOnbs2D+i0eiV3t7ez8Ph8GeRSKRT07TB/v7+i1OnTp0HYBqABzs7O/+paVo0Fot1RyKRi/F4/Gp/f39XIpHoZnoUMn6wU+ZtRDaymwmxZFk2AWjvvvvuJ/F4PMn/n5+fn1VeXu6fOXNmbU1NzUOM4Bz8QqIoyg6HwxuLxfq3bdu2a+vWrW/09/dfKy0tffDVV199BEC20+n0ud3uQgBup9Pp83g8JYqieE+ePPnxxo0bt33xxRen8/Ly7n3hhRcWASh47bXX5pWVldWFw+GuXbt27XjzzTd3BoPBDq/XG1AUZRRHmAKPVfqaoKkgCCkA+oYNG84Eg0FHTU1N5ezZs8eWlJQ4CSF8/LvZYhJPQoQQpFKpwcrKyo1su9HBwUF99erVv588eXINgOOmacIwDEopdaZSKUIpxYkTJz6sr68/BMBav379RcMwZk2aNOl+AP+qq6t7xDTNVEVFxR+j0WgSAJk4ceKlTz/9tNzpdHpZvIvpjVW6pykhhBJCbkvwgiAQQogEQL558ybdtGlTsLm5OWJZdxZmlmWll5OUEEJN0zSGhob6GcOrALSzZ8/2apqWcLlc2axGACNRkRAimqaph0Kh68xIwwB0y7IMSZKcABz5+fkl8Xj8y2g0apOb5na7rYGBgS/JV54Q0qpAAoBKaS0jBWClg1ZVFeFw2AlgVF1dXeDpp5+eWVFRUVpcXOzgvQwAbrcbDJhdudlGpKZpGtx6JCcnRxIEQbQsS2PjbjM+AMvlchnMSBaXkr7ymCCIhmEYfMoVRVESBEHI0CaTTNubssUsQRBuubCtra33pZdeCk6YMCGwZs2aipqaGn9paWmuJEl3JP0bN258eeTIkRMABrm0YomiaImiKGVlZeWxLecAgBkzZvgdDkfWjRs3ggA0bpfpoiiahBCqKEqKAy2yULMA6MlkMp6Xl3cP1x2SWCwmFhQU+CmlFhfHNFOevpX4LcvSJUkyAeDQoUOh119//fpTTz01Zf78+UWBQCBHUZQ7yE/TNGPfvn0n33vvvSP79+//BECMeZsCMGRZNgRBgNPpHHXx4sVVDQ0Nf1+wYMGYJ554YikAevDgwUMA4oIgQJZlSggZdDqdBiGEZGdn6ww0tQlJURTT4/EMHz9+/MCjjz7622AwuHbZsmVbiouLvWvXrm1wOp3ZqVRqaKQTIInf1gAMl8ulU0q1CxcuBGOxmL5u3bryQCDgycrKEjORXGtra8eOHTsOHz169OyVK1cuA+hlRYrGlNRkWR7UNO2mYRiaz+cb3dLS8gYhhOi6Hj116tSOVatWHQNALcsaME0zLghClBDSZ9+zQsZ2SoJS2udwOKLPPffcvsrKyrJAIPDQ/v37txiGofX19V3r7e29UlBQMHqEVpjwnrYA6PF4PK6q6s2qqqqpZWVlitvtljOB7enpiWzbtu3wgQMHTre1tV0E0MeKkkGuIhMAqHv37u30er3Px+NxlyiKygMPPOAnhFiXLl0Kbd68uYPNsXbu3Lk6mUwaqqr2btmyZUdtbe3hd955pwvAEFNcO3jw4K/b2tqiqqpGIpGI4/HHH/9rQ0PDCa/XOyoSidDLly8PNTU1PcZ4QuNK1ju6NYHFRAGASXPnzv1Fa2vrxzTDpapqateuXR/Nnz+/SVGUhwFMBzCBFSLZLF75DsrJGpXRAH4EIABgPIBxAEoBFAPwARjFif1sNzZ25+VlOhaxufcCqAFQC+BhAPVLliz5XSqVUkOhUAuAKWnFyR3dlsw+fg+A+8eMGfPzTZs2bY9GozEb8JkzZ9qXLl36l+Li4l8B+AmAyQDGsGrOzfXNPGPawG2l85jksmcPm+vihH+2W1iF3bvZPN+sWbPuGx4eDrW3t+85fvz41o6OjmZN04Y0TYvV19cvYIbN5QqUjG2mwj5YAqDK4XDMe+aZZ55vbW09+sorr2yuqqpqYFatAuBn3uB7XzJCY297XeaUd2RoGzOJmHb6IjFj5D777LP3DQwMfDw8PBxSVbUvkUj0hEKhj1588cXH2O7zMSPdplumoxveMx5Zlj3jx4/39vb26gMDA4MsvgYZo+p8Pr7LqQX5Ds/U7d0jFxUVZS1atKg4Nzc317Isp67rZldXV6y5ufkmI78hFtcmrx8ZweMit6XsUs4+6kmlgbW+peLf9gyMZNCR374G0y/FxEzX8b/8+bkXEBxKFwAAAABJRU5ErkJggg==",y.tileXYToQuadKey=function(e,t,i){for(var r="",n=i;n>=0;--n){var o=1<=0;--n){var o=1<r;++r){var l=e.intersectPlane(o.fromCartesian4(t[r],s));if(l===n.OUTSIDE)return n.OUTSIDE;l===n.INTERSECTING&&(i=!0)}return i?n.INTERSECTING:n.INSIDE},a}),i("Scene/PerspectiveOffCenterFrustum",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","./CullingVolume"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(e){var t=e.top,i=e.bottom,r=e.right,n=e.left,o=e.near,a=e.far;(t!==e._top||i!==e._bottom||n!==e._left||r!==e._right||o!==e._near||a!==e._far)&&(e._left=n,e._right=r,e._top=t,e._bottom=i,e._near=o,e._far=a,e._perspectiveMatrix=s.computePerspectiveOffCenter(n,r,i,t,o,a,e._perspectiveMatrix),e._infinitePerspective=s.computeInfinitePerspectiveOffCenter(n,r,i,t,o,e._infinitePerspective))}var c=function(){this.left=void 0,this._left=void 0,this.right=void 0,this._right=void 0,this.top=void 0,this._top=void 0,this.bottom=void 0,this._bottom=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far,this._cullingVolume=new l,this._perspectiveMatrix=new s,this._infinitePerspective=new s};o(c.prototype,{projectionMatrix:{get:function(){return u(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return u(this),this._infinitePerspective}}});var h=new t,d=new t,p=new t,m=new t;return c.prototype.computeCullingVolume=function(e,r,o){var a=this._cullingVolume.planes,s=this.top,l=this.bottom,u=this.right,c=this.left,f=this.near,v=this.far,g=t.cross(r,o,h),_=d;t.multiplyByScalar(r,f,_),t.add(e,_,_);var y=p;t.multiplyByScalar(r,v,y),t.add(e,y,y);var C=m;t.multiplyByScalar(g,c,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(C,o,C);var w=a[0];return n(w)||(w=a[0]=new i),w.x=C.x,w.y=C.y,w.z=C.z,w.w=-t.dot(C,e),t.multiplyByScalar(g,u,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(o,C,C),w=a[1],n(w)||(w=a[1]=new i),w.x=C.x,w.y=C.y,w.z=C.z,w.w=-t.dot(C,e),t.multiplyByScalar(o,l,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(g,C,C),w=a[2],n(w)||(w=a[2]=new i),w.x=C.x,w.y=C.y,w.z=C.z,w.w=-t.dot(C,e),t.multiplyByScalar(o,s,C),t.add(_,C,C),t.subtract(C,e,C),t.normalize(C,C),t.cross(C,g,C),w=a[3],n(w)||(w=a[3]=new i),w.x=C.x,w.y=C.y,w.z=C.z,w.w=-t.dot(C,e),w=a[4],n(w)||(w=a[4]=new i),w.x=r.x,w.y=r.y,w.z=r.z,w.w=-t.dot(r,_),t.negate(r,C),w=a[5],n(w)||(w=a[5]=new i),w.x=C.x,w.y=C.y,w.z=C.z,w.w=-t.dot(C,y),this._cullingVolume},c.prototype.getPixelSize=function(t,i,o){u(this);var a=t.x,s=t.y;i=r(i,this.near);var l=1/this.near,c=this.top*l,h=2*i*c/s;c=this.right*l;var d=2*i*c/a;return n(o)?(o.x=d,o.y=h,o):new e(d,h)},c.prototype.clone=function(e){return n(e)||(e=new c),e.right=this.right,e.left=this.left,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e},c.prototype.equals=function(e){return n(e)&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},c}),i("Scene/PerspectiveFrustum",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","./PerspectiveOffCenterFrustum"],function(e,t,i,r){"use strict";function n(e){var t=e._offCenterFrustum;(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far)&&(e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:2*Math.atan(Math.tan(.5*e.fov)/e.aspectRatio),e._near=e.near,e._far=e.far,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far)}var o=function(){this._offCenterFrustum=new r,this.fov=void 0,this._fov=void 0,this._fovy=void 0,this.aspectRatio=void 0,this._aspectRatio=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far};return t(o.prototype,{projectionMatrix:{get:function(){return n(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return n(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return n(this),this._fovy}}}),o.prototype.computeCullingVolume=function(e,t,i){return n(this),this._offCenterFrustum.computeCullingVolume(e,t,i)},o.prototype.getPixelSize=function(e,t,i){return n(this),this._offCenterFrustum.getPixelSize(e,t,i)},o.prototype.clone=function(t){return e(t)||(t=new o),t.aspectRatio=this.aspectRatio,t.fov=this.fov,t.near=this.near,t.far=this.far,t._aspectRatio=void 0,t._fov=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},o.prototype.equals=function(t){return e(t)?(n(this),n(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum)):!1},o}),i("Scene/CameraFlightPath",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/EasingFunction","../Core/Math","./PerspectiveFrustum","./PerspectiveOffCenterFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e,t,i){var r,n,o;if(e instanceof l){var a=Math.tan(.5*e.fovy);return r=e.near,n=e.near*a,o=e.aspectRatio*n,Math.max(t*r/o,i*r/n)}return e instanceof u?(r=e.near,n=e.top,o=e.right,Math.max(t*r/o,i*r/n)):Math.max(t,i)}function d(e,i,r,o,a){var l,u=a;if(!n(a)){var c=e.position,d=i,p=e.up,m=e.right,f=e.frustum,v=t.subtract(c,d,C),g=t.magnitude(t.multiplyByScalar(p,t.dot(v,p),w)),_=t.magnitude(t.multiplyByScalar(m,t.dot(v,m),w));l=Math.max(r,o),u=Math.min(.2*h(f,g,_),1e9)}if(n(a)||u>l){var y=8,S=1e6,E=-Math.pow((u-r)*S,1/y),b=Math.pow((u-o)*S,1/y);return function(e){var t=e*(b-E)+E;return-Math.pow(t,y)/S+u}}return function(e){return s.lerp(r,o,e)}}function p(e,t){return s.equalsEpsilon(e,s.TWO_PI,s.EPSILON11)&&(e=0),t>e+Math.PI?e+=s.TWO_PI:ts.PI&&(_.longitude+=s.TWO_PI);var C=d(u,r,m.height,_.height,l),w=function(e){var i=e.time/t,r=x;r.longitude=s.lerp(m.longitude,_.longitude,i),r.latitude=s.lerp(m.latitude,_.latitude,i),r.height=C(i),u.setView({positionCartographic:r,heading:s.lerp(v,n,i),pitch:s.lerp(f,o,i),roll:s.lerp(g,a,i)})};return w}function v(i,r,n,o,a,l,u){var c=i.camera,h=t.clone(c.position,S),m=c.pitch,f=p(c.heading,o),v=p(c.roll,l),g=c.frustum.right-c.frustum.left,_=d(c,n,g,n.z,u),y=function(t){var i=t.time/r;c.setView({heading:s.lerp(f,o,i),pitch:s.lerp(m,a,i),roll:s.lerp(v,l,i)}),e.lerp(h,n,i,c.position);var u=_(i),d=c.frustum,p=d.top/d.right,g=.5*(u-(d.right-d.left));d.right+=g,d.left-=g,d.top=p*d.right,d.bottom=-d.top};return y}function g(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function _(e,t){var i=function(){"function"==typeof t&&t(),e.enableInputs=!0};return i}var y={},C=new t,w=new t,S=new t,E=new i,b=new i,x=new i;new t,new t,new t;var T=new i,P=new t;return y.createTween=function(i,o){o=r(o,r.EMPTY_OBJECT);var l=o.destination,u=i.mapProjection,h=u.ellipsoid,d=o.maximumHeight,p=o.easingFunction;if(i.mode===c.MORPHING)return g();var y=r(o.convert,!0);y&&i.mode!==c.SCENE3D&&(h.cartesianToCartographic(l,T),l=u.project(T,P));var C=i.camera,w=o.endTransform;n(w)&&C._setTransform(w);var S=o.duration;n(S)||(S=Math.ceil(t.distance(C.position,l)/1e6)+2,S=Math.min(S,3));var E=i.mode,b=r(o.heading,0),x=i.mode!==c.SCENE2D?r(o.pitch,-s.PI_OVER_TWO):-s.PI_OVER_TWO,A=r(o.roll,0),D=i.screenSpaceCameraController;D.enableInputs=!1;var M=_(D,o.complete),I=_(D,o.cancel),O=C.frustum,R=i.mode===c.SCENE2D;if(R=R&&e.equalsEpsilon(C.position,l,s.EPSILON6),R=R&&s.equalsEpsilon(Math.max(O.right-O.left,O.top-O.bottom),l.z,s.EPSILON6),R=R||i.mode!==c.SCENE2D&&t.equalsEpsilon(l,C.position,s.EPSILON6))return g(M,I);var L=new Array(4);if(L[c.SCENE2D]=v,L[c.SCENE3D]=f,L[c.COLUMBUS_VIEW]=m,0>=S){var N=function(){var e=L[E](i,1,l,b,x,A,d);e({time:1}),"function"==typeof M&&M()};return g(N,I)}var F=L[E](i,S,l,b,x,A,d);if(!n(p)){var B=C.positionCartographic.height,z=E===c.SCENE3D?h.cartesianToCartographic(l).height:l.z;p=B>z&&B>11500?a.CUBIC_OUT:a.QUINTIC_IN_OUT}return{duration:S,easingFunction:p,startObject:{time:0},stopObject:{time:S},update:F,complete:M,cancel:I}},y}),i("Scene/Camera",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/EasingFunction","../Core/Ellipsoid","../Core/EllipsoidGeodesic","../Core/Event","../Core/IntersectionTests","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Quaternion","../Core/Ray","../Core/Rectangle","../Core/Transforms","./CameraFlightPath","./HeadingPitchRange","./PerspectiveFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E){"use strict";function b(e){var i=e._right,r=e._up,n=e._direction,o=e._position,a=e._viewMatrix;a[0]=i.x,a[1]=r.x,a[2]=-n.x,a[3]=0,a[4]=i.y,a[5]=r.y,a[6]=-n.y,a[7]=0,a[8]=i.z,a[9]=r.z,a[10]=-n.z,a[11]=0,a[12]=-t.dot(i,o),a[13]=-t.dot(r,o),a[14]=t.dot(n,o),a[15]=1,f.multiply(a,e._actualInvTransform,e._viewMatrix),f.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function x(e){var r=e._projection,n=r.ellipsoid,o=f.getColumn(e._transform,3,tt),a=n.cartesianToCartographic(o,K),s=r.project(a,$),l=it;l.x=s.z,l.y=s.x,l.z=s.y,l.w=1;var u=i.add(f.getColumn(e._transform,0,et),o,et);n.cartesianToCartographic(u,a),r.project(a,s);var c=rt;c.x=s.z,c.y=s.x,c.z=s.y,c.w=0,t.subtract(c,l,c);var h=i.add(f.getColumn(e._transform,1,et),o,et);n.cartesianToCartographic(h,a),r.project(a,s);var d=nt;d.x=s.z,d.y=s.x,d.z=s.y,d.w=0,t.subtract(d,l,d);var p=ot;t.cross(c,d,p),t.normalize(p,p),t.cross(d,p,c),t.normalize(c,c),t.cross(p,c,d),t.normalize(d,d),f.setColumn(e._actualTransform,0,c,e._actualTransform),f.setColumn(e._actualTransform,1,d,e._actualTransform),f.setColumn(e._actualTransform,2,p,e._actualTransform),f.setColumn(e._actualTransform,3,l,e._actualTransform)}function T(e){var r=e._projection,n=r.ellipsoid,o=f.getColumn(e._transform,3,tt),a=n.cartesianToCartographic(o,K),s=r.project(a,$),l=it;l.x=s.z,l.y=s.x,l.z=s.y,l.w=1;var u=i.clone(i.UNIT_X,ot),c=i.add(f.getColumn(e._transform,0,et),o,et);n.cartesianToCartographic(c,a),r.project(a,s);var h=rt;h.x=s.z,h.y=s.x,h.z=s.y,h.w=0,t.subtract(h,l,h),h.x=0;var d=nt;if(t.magnitudeSquared(h)>p.EPSILON10)t.cross(u,h,d);else{var m=i.add(f.getColumn(e._transform,1,et),o,et);n.cartesianToCartographic(m,a),r.project(a,s),d.x=s.z,d.y=s.x,d.z=s.y,d.w=0,t.subtract(d,l,d),d.x=0,t.magnitudeSquared(d)p.EPSILON2){n=t.normalize(n,e._direction),t.clone(n,e.direction);var g=1/t.magnitudeSquared(a),_=t.dot(a,n)*g,y=t.multiplyByScalar(n,_,at);a=t.normalize(t.subtract(a,y,e._up),e._up),t.clone(a,e.up),l=t.cross(n,a,e._right),t.clone(l,e.right)}}(o||c)&&(e._directionWC=f.multiplyByPointAsVector(h,n,e._directionWC)),(s||c)&&(e._upWC=f.multiplyByPointAsVector(h,a,e._upWC)),(u||c)&&(e._rightWC=f.multiplyByPointAsVector(h,l,e._rightWC)),(r||o||s||u||c)&&b(e)}function A(e,t){var i;return i=p.equalsEpsilon(Math.abs(e.z),1,p.EPSILON3)?Math.atan2(t.y,t.x)-p.PI_OVER_TWO:Math.atan2(e.y,e.x)-p.PI_OVER_TWO,p.TWO_PI-p.zeroToTwoPi(i)}function D(e){return p.PI_OVER_TWO-p.acosClamped(e.z)}function M(e,t,i){var r=0;return p.equalsEpsilon(Math.abs(e.z),1,p.EPSILON3)||(r=Math.atan2(-i.z,t.z),r=p.zeroToTwoPi(r+p.TWO_PI)),r}function I(e,t){var i=e._maxCoord.x*e.maximumTranslateFactor;t.x>i&&(t.x=i),t.x<-i&&(t.x=-i);var r=e._maxCoord.y*e.maximumTranslateFactor;t.y>r&&(t.y=r),t.y<-r&&(t.y=-r)}function O(e,i){var r=e.position,n=t.normalize(r,Et);if(o(e.constrainedAxis)){var a=t.equalsEpsilon(n,e.constrainedAxis,p.EPSILON2),s=t.equalsEpsilon(n,t.negate(e.constrainedAxis,Tt),p.EPSILON2);if(a||s)(a&&0>i||s&&i>0)&&e.rotate(e.right,i);else{var l=t.normalize(e.constrainedAxis,bt),u=t.dot(n,l),c=p.acosClamped(u);i>0&&i>c&&(i=c-p.EPSILON4),u=t.dot(n,t.negate(l,Tt)),c=p.acosClamped(u),0>i&&-i>c&&(i=-c+p.EPSILON4);var h=t.cross(l,n,xt);e.rotate(h,i)}}else e.rotate(e.right,i)}function R(e,t){o(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function L(e,t){var i=e.frustum;t=.5*t;var r=i.right-t,n=i.left+t,o=e._maxCoord.x*e.maximumZoomFactor;r>o&&(r=o,n=-o),n>=r&&(r=1,n=-1);var a=i.top/i.right;i.right=r,i.left=n,i.top=i.right*a,i.bottom=-i.top}function N(e,t){e.move(e.direction,t)}function F(e,i,r){i=p.clamp(i,-p.PI_OVER_TWO,p.PI_OVER_TWO),e=p.zeroToTwoPi(e)-p.PI_OVER_TWO;var n=v.fromAxisAngle(t.UNIT_Y,-i,Dt),o=v.fromAxisAngle(t.UNIT_Z,-e,Mt),a=v.multiply(o,n,o),s=m.fromQuaternion(a,It),l=t.clone(t.UNIT_X,At);return m.multiplyByVector(s,l,l),t.negate(l,l),t.multiplyByScalar(l,r,l),l}function B(e,i,r,n,a){function s(e,i,r,n){var o=Math.abs(t.dot(i,r));return o/n-t.dot(e,r)}o(n)||(n=new t);var l=e;a&&(l=Gt);var u=i.north,h=i.south,d=i.east,m=i.west;m>d&&(d+=p.TWO_PI);var f,v=.5*(m+d);if(h<-p.PI_OVER_TWO+p.RADIANS_PER_DEGREE&&u>p.PI_OVER_TWO-p.RADIANS_PER_DEGREE)f=0;else{var g=Rt;g.longitude=v,g.latitude=u,g.height=0;var _=Lt;_.longitude=v,_.latitude=h,_.height=0;var y=Ot;o(y)&&y.ellipsoid===r||(Ot=y=new c(void 0,void 0,r)),y.setEndPoints(g,_),f=y.interpolateUsingFraction(.5,Rt).latitude}var C=Rt;C.longitude=v,C.latitude=f,C.height=0;var w=r.cartographicToCartesian(C,Ut),S=Rt;S.longitude=d,S.latitude=u;var E=r.cartographicToCartesian(S,Nt);S.longitude=m;var b=r.cartographicToCartesian(S,Bt);S.longitude=v;var x=r.cartographicToCartesian(S,kt);S.latitude=h;var T=r.cartographicToCartesian(S,Vt);S.longitude=d;var P=r.cartographicToCartesian(S,zt);S.longitude=m;var A=r.cartographicToCartesian(S,Ft);t.subtract(b,w,b),t.subtract(P,w,P),t.subtract(E,w,E),t.subtract(A,w,A),t.subtract(x,w,x),t.subtract(T,w,T);var D=r.geodeticSurfaceNormal(w,l.direction);t.negate(D,D);var M=t.cross(D,t.UNIT_Z,l.right);t.normalize(M,M);var I=t.cross(M,D,l.up),O=Math.tan(.5*e.frustum.fovy),R=e.frustum.aspectRatio*O,L=Math.max(s(D,I,b,O),s(D,I,P,O),s(D,I,E,O),s(D,I,A,O),s(D,I,x,O),s(D,I,T,O),s(D,M,b,R),s(D,M,P,R),s(D,M,E,R),s(D,M,A,R),s(D,M,x,R),s(D,M,T,R));if(0>h&&u>0){var N=Rt;N.longitude=m,N.latitude=0,N.height=0;var F=r.cartographicToCartesian(N,Wt);t.subtract(F,w,F),L=Math.max(L,s(D,I,F,O),s(D,M,F,R)),N.longitude=d,F=r.cartographicToCartesian(N,Wt),t.subtract(F,w,F),L=Math.max(L,s(D,I,F,O),s(D,M,F,R))}return t.add(w,t.multiplyByScalar(D,-L,Wt),n)}function z(e,i,r,n,a){var s=i.north,l=i.south,u=i.east,c=i.west,h=e._actualTransform,d=e._actualInvTransform,p=Ht;p.longitude=u,p.latitude=s;var m=r.project(p,qt);f.multiplyByPoint(h,m,m),f.multiplyByPoint(d,m,m),p.longitude=c,p.latitude=l;var v=r.project(p,jt);f.multiplyByPoint(h,v,v),f.multiplyByPoint(d,v,v);var g=Math.tan(.5*e.frustum.fovy),_=e.frustum.aspectRatio*g;if(o(n)||(n=new t),n.x=.5*(m.x-v.x)+v.x,n.y=.5*(m.y-v.y)+v.y,n.z=.5*Math.max((m.x-v.x)/_,(m.y-v.y)/g),!a){var y=t.clone(t.UNIT_Z,e.direction);t.negate(y,y),t.clone(t.UNIT_X,e.right),t.clone(t.UNIT_Y,e.up)}return n}function k(e,i,r,n,a){var s=i.north,l=i.south,u=i.east,c=i.west,h=Yt;h.longitude=u,h.latitude=s;var d=r.project(h,Xt);h.longitude=c,h.latitude=l;var p,m,f=r.project(h,Zt),v=.5*Math.abs(d.x-f.x),g=.5*Math.abs(d.y-f.y),_=e.frustum.right/e.frustum.top,y=g*_;if(v>y?(p=v,m=p/_):(m=g,p=y),g=Math.max(2*p,2*m),o(n)||(n=new t),n.x=.5*(d.x-f.x)+f.x,n.y=.5*(d.y-f.y)+f.y,a)h=r.unproject(n,h),h.height=g,n=r.project(h,n);else{var C=e.frustum;C.right=p,C.left=-p,C.top=m,C.bottom=-m;var w=t.clone(t.UNIT_Z,e.direction);t.negate(w,w),t.clone(t.UNIT_X,e.right),t.clone(t.UNIT_Y,e.up)}return n}function V(e,t,i,r){i=n(i,u.WGS84);var o=e.getPickRay(t,Jt),a=d.rayEllipsoid(o,i);if(!a)return void 0;var s=a.start>0?a.start:a.stop;return g.getPoint(o,s,r)}function U(e,t,i,r){var n=e.getPickRay(t,Qt),o=n.origin;o.z=0;var a=i.unproject(o);return a.latitude<-p.PI_OVER_TWO||a.latitude>p.PI_OVER_TWO||a.longitude<-Math.PI||a.longitude>Math.PI?void 0:i.ellipsoid.cartographicToCartesian(a,r)}function W(e,i,r,n){var o=e.getPickRay(i,Kt),a=-o.origin.x/o.direction.x;g.getPoint(o,a,n);var s=r.unproject(new t(n.y,n.z,0));return s.latitude<-p.PI_OVER_TWO||s.latitude>p.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI?void 0:r.ellipsoid.cartographicToCartesian(s,n)}function G(e,i,r){var n=e._scene.canvas,o=n.clientWidth,a=n.clientHeight,s=Math.tan(.5*e.frustum.fovy),l=e.frustum.aspectRatio*s,u=e.frustum.near,c=2/o*i.x-1,h=2/a*(a-i.y)-1,d=e.positionWC;t.clone(d,r.origin);var p=t.multiplyByScalar(e.directionWC,u,$t);t.add(d,p,p);var m=t.multiplyByScalar(e.rightWC,c*u*l,ei),f=t.multiplyByScalar(e.upWC,h*u*s,ti),v=t.add(p,m,r.direction);return t.add(v,f,v),t.subtract(v,d,v),t.normalize(v,v),r}function H(e,i,r){var n=e._scene.canvas,o=n.clientWidth,a=n.clientHeight,s=2/o*i.x-1;s*=.5*(e.frustum.right-e.frustum.left);var l=2/a*(a-i.y)-1;l*=.5*(e.frustum.top-e.frustum.bottom);var u=r.origin;return t.clone(e.position,u),t.multiplyByScalar(e.right,s,ii),t.add(ii,u,u),t.multiplyByScalar(e.up,l,ii),t.add(ii,u,u),t.clone(e.directionWC,r.direction),r}function q(e,i){var r=e.position,n=r.x<-e._maxCoord.x||r.x>e._maxCoord.x,o=r.y<-e._maxCoord.y||r.y>e._maxCoord.y,a=n||o,s=e.frustum,u=s.top,c=s.bottom,h=s.right,d=s.left,m=e._max2Dfrustum,f=h>e._max2Dfrustum.right;if(a||f){var v=t.clone(r);v.x>e._maxCoord.x?v.x=e._maxCoord.x:v.x<-e._maxCoord.x&&(v.x=-e._maxCoord.x),v.y>e._maxCoord.y?v.y=e._maxCoord.y:v.y<-e._maxCoord.y&&(v.y=-e._maxCoord.y);var g=function(i){a&&(e.position=t.lerp(r,v,i.time,e.position)),f&&(e.frustum.top=p.lerp(u,m.top,i.time),e.frustum.bottom=p.lerp(c,m.bottom,i.time),e.frustum.right=p.lerp(h,m.right,i.time),e.frustum.left=p.lerp(d,m.left,i.time)) -};return{easingFunction:l.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:i,update:g}}return void 0}function j(e,i,r,n,o,a){var s=t.clone(i);r.y>n?s.y-=r.y-n:r.y<-n&&(s.y+=-n-r.y),r.z>o?s.z-=r.z-o:r.z<-o&&(s.z+=-o-r.z);var u=function(r){var n=t.lerp(i,s,r.time,new t);e.worldToCameraCoordinatesPoint(n,e.position)};return{easingFunction:l.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:a,update:u}}function Y(e,i){var r=e.position,n=e.direction,o=e.worldToCameraCoordinatesVector(t.UNIT_X,ri),a=-t.dot(o,r)/t.dot(o,n),s=t.add(r,t.multiplyByScalar(n,a,ni),ni);e.cameraToWorldCoordinatesPoint(s,s),r=e.cameraToWorldCoordinatesPoint(e.position,oi);var l=Math.tan(.5*e.frustum.fovy),u=e.frustum.aspectRatio*l,c=t.magnitude(t.subtract(r,s,ai)),h=u*c,d=l*c,p=e._maxCoord.x,m=e._maxCoord.y,f=Math.max(h-p,p),v=Math.max(d-m,m);if(r.z<-f||r.z>f||r.y<-v||r.y>v){var g=s.y<-f||s.y>f,_=s.z<-v||s.z>v;if(g||_)return j(e,r,s,f,v,i)}return void 0}function X(e,t){var i=e.frustum,r=Math.tan(.5*i.fovy),n=i.aspectRatio*r;return Math.max(t/n,t/r)}function Z(e,t){var i,r,n=e.frustum,o=n.right/n.top,a=t*o;return t>a?(i=t,r=i/o):(r=t,i=a),1.5*Math.max(i,r)}function J(e,t,i){o(i)||(i=w.clone(di));var r=i.range;if(!o(r)||0===r){var n=t.radius;i.range=0===n?pi:e._mode===E.SCENE2D?Z(e,n):X(e,n)}return i}var Q=function(e){this._scene=e,this._transform=f.clone(f.IDENTITY),this._invTransform=f.clone(f.IDENTITY),this._actualTransform=f.clone(f.IDENTITY),this._actualInvTransform=f.clone(f.IDENTITY),this._transformChanged=!1,this.position=new t,this._position=new t,this._positionWC=new t,this._positionCartographic=new r,this.direction=new t,this._direction=new t,this._directionWC=new t,this.up=new t,this._up=new t,this._upWC=new t,this.right=new t,this._right=new t,this._rightWC=new t,this.frustum=new S,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=p.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumTranslateFactor=1.5,this.maximumZoomFactor=2.5,this._moveStart=new h,this._moveEnd=new h,this._viewMatrix=new f,this._invViewMatrix=new f,b(this),this._mode=E.SCENE3D,this._modeChanged=!0;var i=e.mapProjection;this._projection=i,this._maxCoord=i.project(new r(Math.PI,p.PI_OVER_TWO)),this._max2Dfrustum=void 0,this.viewRectangle(Q.DEFAULT_VIEW_RECTANGLE,e.mapProjection.ellipsoid);var n=t.magnitude(this.position);n+=n*Q.DEFAULT_VIEW_FACTOR,t.normalize(this.position,this.position),t.multiplyByScalar(this.position,n,this.position)};Q.TRANSFORM_2D=new f(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),Q.TRANSFORM_2D_INVERSE=f.inverseTransformation(Q.TRANSFORM_2D,new f),Q.DEFAULT_VIEW_RECTANGLE=_.fromDegrees(-95,-20,-70,90),Q.DEFAULT_VIEW_FACTOR=.5;var K=new r,$=new t,et=new t,tt=new i,it=new i,rt=new i,nt=new i,ot=new i,at=new t,st=new f,lt=new f;a(Q.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return P(this),this._invTransform}},viewMatrix:{get:function(){return P(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return P(this),this._invViewMatrix}},positionCartographic:{get:function(){return P(this),this._positionCartographic}},positionWC:{get:function(){return P(this),this._positionWC}},directionWC:{get:function(){return P(this),this._directionWC}},upWC:{get:function(){return P(this),this._upWC}},rightWC:{get:function(){return P(this),this._rightWC}},heading:{get:function(){if(this._mode!==E.MORPHING){this.positionWC;var e=this._projection.ellipsoid,t=f.clone(this._transform,st),i=y.eastNorthUpToFixedFrame(this.positionWC,e,lt);this._setTransform(i);var r=A(this.direction,this.up);return this._setTransform(t),r}return void 0}},pitch:{get:function(){if(this._mode!==E.MORPHING){this.positionWC;var e=this._projection.ellipsoid,t=f.clone(this._transform,st),i=y.eastNorthUpToFixedFrame(this.positionWC,e,lt);this._setTransform(i);var r=D(this.direction);return this._setTransform(t),r}return void 0}},roll:{get:function(){if(this._mode!==E.MORPHING){this.positionWC;var e=this._projection.ellipsoid,t=f.clone(this._transform,st),i=y.eastNorthUpToFixedFrame(this.positionWC,e,lt);this._setTransform(i);var r=M(this.direction,this.up,this.right);return this._setTransform(t),r}return void 0}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}}}),Q.prototype.update=function(e){var t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==E.MORPHING,t=this._mode===E.SCENE2D),t){var i=this._max2Dfrustum=this.frustum.clone(),r=2,n=i.top/i.right;i.right=this._maxCoord.x*r,i.left=-i.right,i.top=n*i.right,i.bottom=-i.top}};var ut=new t,ct=new t,ht=new t;Q.prototype._setTransform=function(e){var i=t.clone(this.positionWC,ut),r=t.clone(this.upWC,ct),n=t.clone(this.directionWC,ht);f.clone(e,this._transform),this._transformChanged=!0,P(this);var o=this._actualInvTransform;f.multiplyByPoint(o,i,this.position),f.multiplyByPointAsVector(o,n,this.direction),f.multiplyByPointAsVector(o,r,this.up),t.cross(this.direction,this.up,this.right)};var dt=new t,pt=new f,mt=new f,ft=new v,vt=new m,gt=new r;Q.prototype.setView=function(i){if(this._mode!==E.MORPHING){i=n(i,n.EMPTY_OBJECT);var r=this._mode===E.SCENE2D,a=n(i.heading,this.heading),s=r?-p.PI_OVER_TWO:n(i.pitch,this.pitch),l=r?0:n(i.roll,this.roll),u=i.position,c=i.positionCartographic,h=this._projection,d=h.ellipsoid;o(u)||(u=o(c)?d.cartographicToCartesian(c,dt):t.clone(this.positionWC,dt));var g=f.clone(this.transform,pt),_=y.eastNorthUpToFixedFrame(u,d,mt);if(this._setTransform(_),r){e.clone(t.ZERO,this.position);var C=d.cartesianToCartographic(u,gt),w=.5*-C.height,S=-w,b=this.frustum;if(S>w){var x=b.top/b.right;b.right=S,b.left=w,b.top=b.right*x,b.bottom=-b.top}}else t.clone(t.ZERO,this.position);var T=v.fromHeadingPitchRoll(a-p.PI_OVER_TWO,s,l,ft),P=m.fromQuaternion(T,vt);m.getColumn(P,0,this.direction),m.getColumn(P,2,this.up),t.cross(this.direction,this.up,this.right),this._setTransform(g)}},Q.prototype.worldToCameraCoordinates=function(e,t){return o(t)||(t=new i),P(this),f.multiplyByVector(this._actualInvTransform,e,t)},Q.prototype.worldToCameraCoordinatesPoint=function(e,i){return o(i)||(i=new t),P(this),f.multiplyByPoint(this._actualInvTransform,e,i)},Q.prototype.worldToCameraCoordinatesVector=function(e,i){return o(i)||(i=new t),P(this),f.multiplyByPointAsVector(this._actualInvTransform,e,i)},Q.prototype.cameraToWorldCoordinates=function(e,t){return o(t)||(t=new i),P(this),f.multiplyByVector(this._actualTransform,e,t)},Q.prototype.cameraToWorldCoordinatesPoint=function(e,i){return o(i)||(i=new t),P(this),f.multiplyByPoint(this._actualTransform,e,i)},Q.prototype.cameraToWorldCoordinatesVector=function(e,i){return o(i)||(i=new t),P(this),f.multiplyByPointAsVector(this._actualTransform,e,i)};var _t=new t;Q.prototype.move=function(e,i){var r=this.position;t.multiplyByScalar(e,i,_t),t.add(r,_t,r),this._mode===E.SCENE2D&&I(this,r)},Q.prototype.moveForward=function(e){e=n(e,this.defaultMoveAmount),this.move(this.direction,e)},Q.prototype.moveBackward=function(e){e=n(e,this.defaultMoveAmount),this.move(this.direction,-e)},Q.prototype.moveUp=function(e){e=n(e,this.defaultMoveAmount),this.move(this.up,e)},Q.prototype.moveDown=function(e){e=n(e,this.defaultMoveAmount),this.move(this.up,-e)},Q.prototype.moveRight=function(e){e=n(e,this.defaultMoveAmount),this.move(this.right,e)},Q.prototype.moveLeft=function(e){e=n(e,this.defaultMoveAmount),this.move(this.right,-e)},Q.prototype.lookLeft=function(e){e=n(e,this.defaultLookAmount),this.look(this.up,-e)},Q.prototype.lookRight=function(e){e=n(e,this.defaultLookAmount),this.look(this.up,e)},Q.prototype.lookUp=function(e){e=n(e,this.defaultLookAmount),this.look(this.right,-e)},Q.prototype.lookDown=function(e){e=n(e,this.defaultLookAmount),this.look(this.right,e)};var yt=new v,Ct=new m;Q.prototype.look=function(e,t){var i=n(t,this.defaultLookAmount),r=v.fromAxisAngle(e,-i,yt),o=m.fromQuaternion(r,Ct),a=this.direction,s=this.up,l=this.right;m.multiplyByVector(o,a,a),m.multiplyByVector(o,s,s),m.multiplyByVector(o,l,l)},Q.prototype.twistLeft=function(e){e=n(e,this.defaultLookAmount),this.look(this.direction,e)},Q.prototype.twistRight=function(e){e=n(e,this.defaultLookAmount),this.look(this.direction,-e)};var wt=new v,St=new m;Q.prototype.rotate=function(e,i){var r=n(i,this.defaultRotateAmount),o=v.fromAxisAngle(e,-r,wt),a=m.fromQuaternion(o,St);m.multiplyByVector(a,this.position,this.position),m.multiplyByVector(a,this.direction,this.direction),m.multiplyByVector(a,this.up,this.up),t.cross(this.direction,this.up,this.right),t.cross(this.right,this.direction,this.up)},Q.prototype.rotateDown=function(e){e=n(e,this.defaultRotateAmount),O(this,e)},Q.prototype.rotateUp=function(e){e=n(e,this.defaultRotateAmount),O(this,-e)};var Et=new t,bt=new t,xt=new t,Tt=new t;Q.prototype.rotateRight=function(e){e=n(e,this.defaultRotateAmount),R(this,-e)},Q.prototype.rotateLeft=function(e){e=n(e,this.defaultRotateAmount),R(this,e)},Q.prototype.zoomIn=function(e){e=n(e,this.defaultZoomAmount),this._mode===E.SCENE2D?L(this,e):N(this,e)},Q.prototype.zoomOut=function(e){e=n(e,this.defaultZoomAmount),this._mode===E.SCENE2D?L(this,-e):N(this,-e)},Q.prototype.getMagnitude=function(){return this._mode===E.SCENE3D?t.magnitude(this.position):this._mode===E.COLUMBUS_VIEW?Math.abs(this.position.z):this._mode===E.SCENE2D?Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom):void 0};var Pt=new f;new f,Q.prototype.lookAt=function(e,t){var i=y.eastNorthUpToFixedFrame(e,u.WGS84,Pt);this.lookAtTransform(i,t)};var At=new t,Dt=new v,Mt=new v,It=new m;Q.prototype.lookAtTransform=function(i,r){if(this._setTransform(i),o(r)){var n;if(n=o(r.heading)?F(r.heading,r.pitch,r.range):r,this._mode===E.SCENE2D){e.clone(e.ZERO,this.position),t.negate(n,this.up),this.up.z=0,t.magnitudeSquared(this.up)i.east&&(i=_.MAX_VALUE),i=r.camera.getRectangleCameraCoordinates(i,si));var s,l,u,c=n(e.orientation,n.EMPTY_OBJECT);if(o(c.heading))s=c.heading,l=c.pitch,u=c.roll;else if(o(c.direction)){var h=t.clone(c.direction,ui),d=t.clone(c.up,ci);if(r.mode===E.SCENE3D){var p=this._projection.ellipsoid,m=y.eastNorthUpToFixedFrame(i,p,st),v=f.inverseTransformation(m,lt);f.multiplyByPointAsVector(v,h,h),f.multiplyByPointAsVector(v,d,d)}var g=t.cross(h,d,hi);s=A(h,d),l=D(h),u=M(h,d,g)}li.destination=i,li.heading=s,li.pitch=l,li.roll=u,li.duration=e.duration,li.complete=e.complete,li.cancel=e.cancel,li.endTransform=e.endTransform,li.convert=a?!1:e.convert,li.maximumHeight=e.maximumHeight,li.easingFunction=e.easingFunction,r.tweens.add(C.createTween(r,li))};var di=new w(0,-p.PI_OVER_FOUR,0),pi=100;Q.prototype.viewBoundingSphere=function(e,t){if(this._mode===E.MORPHING)throw new s("viewBoundingSphere is not supported while morphing.");t=J(this,e,t),this.lookAt(e.center,t)};var mi=new f,fi=new t,vi=new t,gi=new t,_i=new t,yi=new i,Ci=new v,wi=new m;return Q.prototype.flyToBoundingSphere=function(e,i){i=n(i,n.EMPTY_OBJECT);var r=this._mode===E.SCENE2D||this._mode===E.COLUMBUS_VIEW;this._setTransform(f.IDENTITY);var o,a=J(this,e,i.offset);o=r?t.multiplyByScalar(t.UNIT_Z,a.range,fi):F(a.heading,a.pitch,a.range);var s=y.eastNorthUpToFixedFrame(e.center,u.WGS84,mi);f.multiplyByPoint(s,o,o);var l,c;if(!r){if(l=t.subtract(e.center,o,vi),t.normalize(l,l),c=f.multiplyByPointAsVector(s,t.UNIT_Z,gi),1-Math.abs(t.dot(l,c))=r+Math.PI;)i-=l;for(;i0||e}}}),g.prototype.isMoving=function(e,t){var i=c(e,t);return!this._update[i]},g.prototype.getMovement=function(e,t){var i=c(e,t),r=this._movement[i];return r},g.prototype.getLastMovement=function(e,t){var i=c(e,t),r=this._lastMovement[i];return r.valid?r:void 0},g.prototype.isButtonDown=function(e,t){var i=c(e,t);return this._isDown[i]},g.prototype.getStartMousePosition=function(e,t){if(e===u.WHEEL||e===u.PINCH)return this._currentMousePosition;var i=c(e,t);return this._eventStartPosition[i]},g.prototype.getButtonPressTime=function(e,t){var i=c(e,t);return this._pressTime[i]},g.prototype.getButtonReleaseTime=function(e,t){var i=c(e,t);return this._releaseTime[i]},g.prototype.reset=function(){for(var e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)},g.prototype.isDestroyed=function(){return!1},g.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),r(this)},g}),i("Scene/CreditDisplay",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i,r){"use strict";function n(e,t,r){if(!i(e.element)){var n=e.text,o=e.link,a=document.createElement("span");if(e.hasLink()){var s=document.createElement("a");s.textContent=n,s.href=o,s.target="_blank",a.appendChild(s)}else a.textContent=n;a.className="cesium-credit-text",e.element=a}if(t.hasChildNodes()){var l=document.createElement("span");l.textContent=r,l.className="cesium-credit-delimiter",t.appendChild(l)}t.appendChild(e.element)}function o(e,t){if(!i(e.element)){var r=e.text,n=e.link,o=document.createElement("span"),a=document.createElement("img");if(a.src=e.imageUrl,a.style["vertical-align"]="bottom",i(r)&&(a.alt=r,a.title=r),e.hasLink()){var s=document.createElement("a");s.appendChild(a),s.href=n,s.target="_blank",o.appendChild(s)}else o.appendChild(a);o.className="cesium-credit-image",e.element=o}t.appendChild(e.element)}function a(t,i){for(var r=t.length,n=0;r>n;n++){var o=t[n];if(e.equals(o,i))return!0}return!1}function s(e){var t=e.element;if(i(t)){var r=t.parentNode;if(!e.hasImage()){var n=t.previousSibling;null===n&&(n=t.nextSibling),null!==n&&r.removeChild(n)}r.removeChild(t)}}function l(e,t){var r,o,a,l=e._displayedCredits.textCredits;for(r=0;r= 0.0) {\nt1 = (-b - sqrt(discriminant)) * 0.5;\nt2 = (-b + sqrt(discriminant)) * 0.5;\n}\nif (t1 < 0.0 && t2 < 0.0) {\ndiscard;\n}\nfloat t = min(t1, t2);\nif (t < 0.0) {\nt = 0.0;\n}\nczm_ellipsoid ellipsoid = czm_ellipsoidNew(ellipsoidCenter, u_radii);\nczm_ray ray = czm_ray(t * direction, direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (czm_isEmpty(intersection))\n{\ndiscard;\n}\nvec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\nvec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\ngl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\ngl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\nt = (intersection.start != 0.0) ? intersection.start : intersection.stop;\nvec3 positionEC = czm_pointAlongRay(ray, t);\nvec4 positionCC = czm_projection * vec4(positionEC, 1.0);\nfloat z = positionCC.z / positionCC.w;\nfloat n = czm_depthRange.near;\nfloat f = czm_depthRange.far;\ngl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n}\n"}),i("Shaders/EllipsoidVS",[],function(){"use strict";return"attribute vec3 position;\nuniform vec3 u_radii;\nvarying vec3 v_positionEC;\nvoid main()\n{\nvec4 p = vec4(u_radii * position, 1.0);\nv_positionEC = (czm_modelView * p).xyz;\ngl_Position = czm_modelViewProjection * p;\ngl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\n}\n"}),i("Scene/EllipsoidPrimitive",["../Core/BoundingSphere","../Core/BoxGeometry","../Core/Cartesian3","../Core/combine","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Core/VertexFormat","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/ShaderSource","../Shaders/EllipsoidFS","../Shaders/EllipsoidVS","./BlendingState","./CullFace","./Material","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y){"use strict";function C(e){var r=e.cache.ellipsoidPrimitive_vertexArray;if(o(r))return r;var n=t.createGeometry(t.fromDimensions({dimensions:new i(2,2,2),vertexFormat:u.POSITION_ONLY}));return r=e.createVertexArrayFromGeometry({geometry:n,attributeLocations:w,bufferUsage:c.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=r,r}var w={position:0},S=function(t){t=n(t,n.EMPTY_OBJECT),this.center=i.clone(n(t.center,i.ZERO)),this._center=new i,this.radii=i.clone(t.radii),this._radii=new i,this._oneOverEllipsoidRadiiSquared=new i,this._boundingSphere=new e,this.modelMatrix=l.clone(n(t.modelMatrix,l.IDENTITY)),this._modelMatrix=new l,this._computedModelMatrix=new l,this.show=n(t.show,!0),this.material=n(t.material,g.fromType(g.ColorType)),this._material=void 0,this._translucent=void 0,this.id=t.id,this._id=void 0,this.debugShowBoundingVolume=n(t.debugShowBoundingVolume,!1),this.onlySunLighting=n(t.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=n(t.depthTestEnabled,!0),this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new h({owner:n(t._owner,this)}),this._pickCommand=new h({owner:n(t._owner,this)}); -var r=this;this._uniforms={u_radii:function(){return r.radii},u_oneOverEllipsoidRadiiSquared:function(){return r._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return r._pickId.color}}};return S.prototype.update=function(t,n,a){if(this.show&&n.mode===y.SCENE3D&&o(this.center)&&o(this.radii)){var s=this.material.isTranslucent(),u=this._translucent!==s;(!o(this._rs)||u)&&(this._translucent=s,this._rs=t.createRenderState({cull:{enabled:!0,face:v.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!s&&t.fragmentDepth,blending:s?f.ALPHA_BLEND:void 0})),o(this._va)||(this._va=C(t));var c=!1,h=this.radii;if(!i.equals(this._radii,h)){i.clone(h,this._radii);var g=this._oneOverEllipsoidRadiiSquared;g.x=1/(h.x*h.x),g.y=1/(h.y*h.y),g.z=1/(h.z*h.z),c=!0}l.equals(this.modelMatrix,this._modelMatrix)&&i.equals(this.center,this._center)||(l.clone(this.modelMatrix,this._modelMatrix),i.clone(this.center,this._center),l.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),c=!0),c&&(i.clone(i.ZERO,this._boundingSphere.center),this._boundingSphere.radius=i.maximumComponent(h),e.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));var S=this._material!==this.material;this._material=this.material,this._material.update(t);var E=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;var b,x=this._colorCommand;(S||E||u)&&(b=new d({sources:[this.material.shaderSource,p]}),this.onlySunLighting&&b.defines.push("ONLY_SUN_LIGHTING"),!s&&t.fragmentDepth&&b.defines.push("WRITE_DEPTH"),this._sp=t.replaceShaderProgram(this._sp,m,b,w),x.vertexArray=this._va,x.renderState=this._rs,x.shaderProgram=this._sp,x.uniformMap=r(this._uniforms,this.material._uniforms),x.executeInClosestFrustum=s);var T=n.passes;if(T.render&&(x.boundingVolume=this._boundingSphere,x.debugShowBoundingVolume=this.debugShowBoundingVolume,x.modelMatrix=this._computedModelMatrix,x.pass=s?_.TRANSLUCENT:_.OPAQUE,a.push(x)),T.pick){var P=this._pickCommand;o(this._pickId)&&this._id===this.id||(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(S||E||!o(this._pickSP))&&(b=new d({sources:[this.material.shaderSource,p],pickColorQualifier:"uniform"}),this.onlySunLighting&&b.defines.push("ONLY_SUN_LIGHTING"),!s&&t.fragmentDepth&&b.defines.push("WRITE_DEPTH"),this._pickSP=t.replaceShaderProgram(this._pickSP,m,b,w),P.vertexArray=this._va,P.renderState=this._rs,P.shaderProgram=this._pickSP,P.uniformMap=r(r(this._uniforms,this._pickUniforms),this.material._uniforms),P.executeInClosestFrustum=s),P.boundingVolume=this._boundingSphere,P.modelMatrix=this._computedModelMatrix,P.pass=s?_.TRANSLUCENT:_.OPAQUE,a.push(P)}}},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),a(this)},S}),i("Shaders/Appearances/EllipsoidSurfaceAppearanceFS",[],function(){"use strict";return"varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n"}),i("Shaders/Appearances/EllipsoidSurfaceAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Scene/EllipsoidSurfaceAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/EllipsoidSurfaceAppearanceFS","../Shaders/Appearances/EllipsoidSurfaceAppearanceVS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),l=e(i.aboveGround,!1);this.material=t(i.material)?i.material:s.fromType(s.ColorType),this.translucent=e(i.translucent,!0),this._vertexShaderSource=e(i.vertexShaderSource,o),this._fragmentShaderSource=e(i.fragmentShaderSource,n),this._renderState=a.getDefaultRenderState(r,!l,i.renderState),this._closed=!1,this._flat=e(i.flat,!1),this._faceForward=e(i.faceForward,l),this._aboveGround=l};return i(l.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return l.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),l.VERTEX_FORMAT=r.POSITION_AND_ST,l.prototype.getFragmentShaderSource=a.prototype.getFragmentShaderSource,l.prototype.isTranslucent=a.prototype.isTranslucent,l.prototype.getRenderState=a.prototype.getRenderState,l}),i("Shaders/PostProcessFilters/FXAA",[],function(){"use strict";return"#ifndef FXAA_PRESET\n#define FXAA_PRESET 3\n#endif\n#if (FXAA_PRESET == 3)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 16\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 4)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 24\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 5)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 32\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#define FXAA_SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_SUBPIX_TRIM))\nfloat FxaaLuma(vec3 rgb) {\nreturn rgb.y * (0.587/0.299) + rgb.x;\n}\nvec3 FxaaLerp3(vec3 a, vec3 b, float amountOfA) {\nreturn (vec3(-amountOfA) * b) + ((a * vec3(amountOfA)) + b);\n}\nvec4 FxaaTexOff(sampler2D tex, vec2 pos, ivec2 off, vec2 rcpFrame) {\nfloat x = pos.x + float(off.x) * rcpFrame.x;\nfloat y = pos.y + float(off.y) * rcpFrame.y;\nreturn texture2D(tex, vec2(x, y));\n}\nvec3 FxaaPixelShader(vec2 pos, sampler2D tex, vec2 rcpFrame)\n{\nvec3 rgbN = FxaaTexOff(tex, pos.xy, ivec2( 0,-1), rcpFrame).xyz;\nvec3 rgbW = FxaaTexOff(tex, pos.xy, ivec2(-1, 0), rcpFrame).xyz;\nvec3 rgbM = FxaaTexOff(tex, pos.xy, ivec2( 0, 0), rcpFrame).xyz;\nvec3 rgbE = FxaaTexOff(tex, pos.xy, ivec2( 1, 0), rcpFrame).xyz;\nvec3 rgbS = FxaaTexOff(tex, pos.xy, ivec2( 0, 1), rcpFrame).xyz;\nfloat lumaN = FxaaLuma(rgbN);\nfloat lumaW = FxaaLuma(rgbW);\nfloat lumaM = FxaaLuma(rgbM);\nfloat lumaE = FxaaLuma(rgbE);\nfloat lumaS = FxaaLuma(rgbS);\nfloat rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));\nfloat rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));\nfloat range = rangeMax - rangeMin;\nif(range < max(FXAA_EDGE_THRESHOLD_MIN, rangeMax * FXAA_EDGE_THRESHOLD))\n{\nreturn rgbM;\n}\nvec3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS;\nfloat lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;\nfloat rangeL = abs(lumaL - lumaM);\nfloat blendL = max(0.0, (rangeL / range) - FXAA_SUBPIX_TRIM) * FXAA_SUBPIX_TRIM_SCALE;\nblendL = min(FXAA_SUBPIX_CAP, blendL);\nvec3 rgbNW = FxaaTexOff(tex, pos.xy, ivec2(-1,-1), rcpFrame).xyz;\nvec3 rgbNE = FxaaTexOff(tex, pos.xy, ivec2( 1,-1), rcpFrame).xyz;\nvec3 rgbSW = FxaaTexOff(tex, pos.xy, ivec2(-1, 1), rcpFrame).xyz;\nvec3 rgbSE = FxaaTexOff(tex, pos.xy, ivec2( 1, 1), rcpFrame).xyz;\nrgbL += (rgbNW + rgbNE + rgbSW + rgbSE);\nrgbL *= vec3(1.0/9.0);\nfloat lumaNW = FxaaLuma(rgbNW);\nfloat lumaNE = FxaaLuma(rgbNE);\nfloat lumaSW = FxaaLuma(rgbSW);\nfloat lumaSE = FxaaLuma(rgbSE);\nfloat edgeVert =\nabs((0.25 * lumaNW) + (-0.5 * lumaN) + (0.25 * lumaNE)) +\nabs((0.50 * lumaW ) + (-1.0 * lumaM) + (0.50 * lumaE )) +\nabs((0.25 * lumaSW) + (-0.5 * lumaS) + (0.25 * lumaSE));\nfloat edgeHorz =\nabs((0.25 * lumaNW) + (-0.5 * lumaW) + (0.25 * lumaSW)) +\nabs((0.50 * lumaN ) + (-1.0 * lumaM) + (0.50 * lumaS )) +\nabs((0.25 * lumaNE) + (-0.5 * lumaE) + (0.25 * lumaSE));\nbool horzSpan = edgeHorz >= edgeVert;\nfloat lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;\nif(!horzSpan)\n{\nlumaN = lumaW;\nlumaS = lumaE;\n}\nfloat gradientN = abs(lumaN - lumaM);\nfloat gradientS = abs(lumaS - lumaM);\nlumaN = (lumaN + lumaM) * 0.5;\nlumaS = (lumaS + lumaM) * 0.5;\nif (gradientN < gradientS)\n{\nlumaN = lumaS;\nlumaN = lumaS;\ngradientN = gradientS;\nlengthSign *= -1.0;\n}\nvec2 posN;\nposN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);\nposN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);\ngradientN *= FXAA_SEARCH_THRESHOLD;\nvec2 posP = posN;\nvec2 offNP = horzSpan ? vec2(rcpFrame.x, 0.0) : vec2(0.0, rcpFrame.y);\nfloat lumaEndN = lumaN;\nfloat lumaEndP = lumaN;\nbool doneN = false;\nbool doneP = false;\nposN += offNP * vec2(-1.0, -1.0);\nposP += offNP * vec2( 1.0, 1.0);\nfor(int i = 0; i < FXAA_SEARCH_STEPS; i++) {\nif(!doneN)\n{\nlumaEndN = FxaaLuma(texture2D(tex, posN.xy).xyz);\n}\nif(!doneP)\n{\nlumaEndP = FxaaLuma(texture2D(tex, posP.xy).xyz);\n}\ndoneN = doneN || (abs(lumaEndN - lumaN) >= gradientN);\ndoneP = doneP || (abs(lumaEndP - lumaN) >= gradientN);\nif(doneN && doneP)\n{\nbreak;\n}\nif(!doneN)\n{\nposN -= offNP;\n}\nif(!doneP)\n{\nposP += offNP;\n}\n}\nfloat dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;\nfloat dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;\nbool directionN = dstN < dstP;\nlumaEndN = directionN ? lumaEndN : lumaEndP;\nif(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))\n{\nlengthSign = 0.0;\n}\nfloat spanLength = (dstP + dstN);\ndstN = directionN ? dstN : dstP;\nfloat subPixelOffset = (0.5 + (dstN * (-1.0/spanLength))) * lengthSign;\nvec3 rgbF = texture2D(tex, vec2(\npos.x + (horzSpan ? 0.0 : subPixelOffset),\npos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;\nreturn FxaaLerp3(rgbL, rgbF, blendL);\n}\nuniform sampler2D u_texture;\nuniform vec2 u_step;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = vec4(FxaaPixelShader(v_textureCoordinates, u_texture, u_step), 1.0);\n}\n"}),i("Scene/FXAA",["../Core/Cartesian2","../Core/Color","../Core/defined","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/PixelDatatype","../Renderer/RenderbufferFormat","../Shaders/PostProcessFilters/FXAA"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(e,t,i,r){e._fbo=e._fbo&&e._fbo.destroy();var o,l,u=t.createTexture2D({width:i,height:r,pixelFormat:n.RGBA,pixelDatatype:a.UNSIGNED_BYTE});t.depthTexture?o=t.createTexture2D({width:i,height:r,pixelFormat:n.DEPTH_COMPONENT,pixelDatatype:a.UNSIGNED_SHORT}):l=t.createRenderbuffer({width:i,height:r,format:s.DEPTH_COMPONENT16}),e._fbo=t.createFramebuffer({colorTextures:[u],depthTexture:o,depthRenderbuffer:l})}var c=function(){this._texture=void 0,this._fbo=void 0,this._command=void 0,this._clearCommand=void 0,this._step=new e};return c.prototype.update=function(e,r){var n=e.drawingBufferWidth,a=e.drawingBufferHeight;if(i(this._fbo)||u(this,e,n,a),i(r))this._texture=r;else{var s=this._fbo.getColorTexture(0),c=s.width,h=s.height;(c!==n||h!==a)&&u(this,e,n,a),this._texture=s}if(this._step.x=1/this._texture.width,this._step.y=1/this._texture.height,i(this._clearCommand)||(this._clearCommand=new o({color:new t(0,0,0,0),depth:1,owner:this})),!i(this._command)){var d=this;this._command=e.createViewportQuadCommand(l,{renderState:e.createRenderState(),uniformMap:{u_texture:function(){return d._texture},u_step:function(){return d._step}},owner:this})}},c.prototype.execute=function(e,t){this._command.execute(e,t)},c.prototype.clear=function(e,i,r){var n=i.framebuffer;i.framebuffer=this._fbo,t.clone(r,this._clearCommand.color),this._clearCommand.execute(e,i),i.framebuffer=n},c.prototype.getColorFramebuffer=function(){return this._fbo},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this._fbo=this._fbo&&this._fbo.destroy(),i(this._command)&&(this._command.shaderProgram=this._command.shaderProgram&&this._command.shaderProgram.destroy()),r(this)},c}),i("Scene/FrameRateMonitor",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/TimeConstants"],function(e,t,i,r,n,o,a,s){"use strict";function l(e){if(!(e._pauseCount>0)){var t=a();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=t+e.quietPeriod/s.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/s.SECONDS_PER_MILLISECOND;else if(t>=e._quietPeriodEndTime){e._frameTimes.push(t);var i=t-e.samplingWindow/s.SECONDS_PER_MILLISECOND;if(e._frameTimes.length>=2&&e._frameTimes[0]<=i){for(;e._frameTimes.length>=2&&e._frameTimes[1]e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup);r>n?e._frameRateIsLow||(e._frameRateIsLow=!0,e._needsQuietPeriod=!0,e.lowFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond)):e._frameRateIsLow&&(e._frameRateIsLow=!1,e._needsQuietPeriod=!0,e.nominalFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond))}}}}function u(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}var c=function(i){function r(){u(n)}this._scene=i.scene,this.samplingWindow=e(i.samplingWindow,c.defaultSettings.samplingWindow),this.quietPeriod=e(i.quietPeriod,c.defaultSettings.quietPeriod),this.warmupPeriod=e(i.warmupPeriod,c.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=e(i.minimumFrameRateDuringWarmup,c.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=e(i.minimumFrameRateAfterWarmup,c.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new o,this._nominalFrameRate=new o,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;var n=this;this._preRenderRemoveListener=this._scene.preRender.addEventListener(function(e,t){l(n,t)}),this._hiddenPropertyName=t(document.hidden)?"hidden":t(document.mozHidden)?"mozHidden":t(document.msHidden)?"msHidden":t(document.webkitHidden)?"webkitHidden":void 0;var a=t(document.hidden)?"visibilitychange":t(document.mozHidden)?"mozvisibilitychange":t(document.msHidden)?"msvisibilitychange":t(document.webkitHidden)?"webkitvisibilitychange":void 0;this._visibilityChangeRemoveListener=void 0,t(a)&&(document.addEventListener(a,r,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(a,r,!1)})};return c.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8},c.fromScene=function(e){return(!t(e._frameRateMonitor)||e._frameRateMonitor.isDestroyed())&&(e._frameRateMonitor=new c({scene:e})),e._frameRateMonitor},i(c.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}}),c.prototype.pause=function(){++this._pauseCount,1===this._pauseCount&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)},c.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this._preRenderRemoveListener(),t(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),r(this)},c}),i("Scene/FrameState",["./SceneMode"],function(e){"use strict";var t=function(t){this.mode=e.SCENE3D,this.morphTime=e.getMorphTime(e.SCENE3D),this.frameNumber=0,this.time=void 0,this.mapProjection=void 0,this.camera=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.passes={render:!1,pick:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1};return t}),i("Scene/FrustumCommands",["../Core/defaultValue","./Pass"],function(e,t){"use strict";var i=function(i,r){this.near=e(i,0),this.far=e(r,0);for(var n=t.NUMBER_OF_PASSES,o=new Array(n),a=new Array(n),s=0;n>s;++s)o[s]=[],a[s]=0;this.commands=o,this.indices=a};return i}),i("Scene/GetFeatureInfoFormat",["../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/DeveloperError","../Core/RuntimeError","./ImageryLayerFeatureInfo"],function(e,t,i,r,n,o,a){"use strict";function s(t){for(var i=[],n=t.features,o=0;o1&&(t=i[1]);var r=new a;return r.name=t,r.description=e,r.data=e,[r]}var f=function(e,t,r){this.type=e,i(t)||("json"===e?t="application/json":"xml"===e?t="text/xml":"html"===e?t="text/html":"text"===e&&(t="text/plain")),this.format=t,i(r)||("json"===e?r=s:"xml"===e?r=l:"html"===e?r=m:"text"===e&&(r=m)),this.callback=r},v="http://www.mapinfo.com/mxp",g="http://www.esri.com/wms",_="http://www.opengis.net/wfs",y="http://www.opengis.net/gml",C=/\s*<\/body>/im,w=//im,S=/([^]*)<\/title>/im;return f}),i("Shaders/GlobeFS",[],function(){"use strict";return"uniform vec4 u_initialColor;\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_BRIGHTNESS\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_CONTRAST\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_HUE\nuniform float u_dayTextureHue[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SATURATION\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_GAMMA\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n#endif\nuniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\n#ifdef ENABLE_DAYNIGHT_SHADING\nuniform vec2 u_lightingFadeDistance;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\nvec4 sampleAndBlend(\nvec4 previousColor,\nsampler2D texture,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateRectangle,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma)\n{\nvec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nalphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 sample = texture2D(texture, textureCoordinates);\nvec3 color = sample.rgb;\nfloat alpha = sample.a;\n#ifdef APPLY_BRIGHTNESS\ncolor = mix(vec3(0.0), color, textureBrightness);\n#endif\n#ifdef APPLY_CONTRAST\ncolor = mix(vec3(0.5), color, textureContrast);\n#endif\n#ifdef APPLY_HUE\ncolor = czm_hue(color, textureHue);\n#endif\n#ifdef APPLY_SATURATION\ncolor = czm_saturation(color, textureSaturation);\n#endif\n#ifdef APPLY_GAMMA\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\nfloat sourceAlpha = alpha * textureAlpha;\nfloat outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\nvec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\nreturn vec4(outColor, outAlpha);\n}\nvec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue);\nvoid main()\n{\nvec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n#ifdef SHOW_TILE_BOUNDARIES\nif (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\nv_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n{\ncolor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n#endif\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\nvec3 normalMC = normalize(czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\nvec3 normalEC = normalize(czm_normal3D * normalMC);\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates * waterMaskScale + waterMaskTranslation;\nfloat mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\nif (mask > 0.0)\n{\nmat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\nvec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\nvec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\nvec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\ncolor = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask);\n}\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalize(v_normalEC)) * 0.9 + 0.3, 0.0, 1.0);\ngl_FragColor = vec4(color.rgb * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\nfloat cameraDist = length(czm_view[3]);\nfloat fadeOutDist = u_lightingFadeDistance.x;\nfloat fadeInDist = u_lightingFadeDistance.y;\nfloat t = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\ndiffuseIntensity = mix(1.0, diffuseIntensity, t);\ngl_FragColor = vec4(color.rgb * diffuseIntensity, color.a);\n#else\ngl_FragColor = color;\n#endif\n}\n#ifdef SHOW_REFLECTIVE_OCEAN\nfloat waveFade(float edge0, float edge1, float x)\n{\nfloat y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn pow(1.0 - y, 5.0);\n}\nfloat linearFade(float edge0, float edge1, float x)\n{\nreturn clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\nconst float oceanFrequencyLowAltitude = 825000.0;\nconst float oceanAnimationSpeedLowAltitude = 0.004;\nconst float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\nconst float oceanSpecularIntensity = 0.5;\nconst float oceanFrequencyHighAltitude = 125000.0;\nconst float oceanAnimationSpeedHighAltitude = 0.008;\nconst float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue)\n{\nvec3 positionToEyeEC = -positionEyeCoordinates;\nfloat positionToEyeECLength = length(positionToEyeEC);\nvec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\nfloat waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n#ifdef SHOW_OCEAN_WAVES\nfloat time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\nvec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\nvec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\ntime = czm_frameNumber * oceanAnimationSpeedLowAltitude;\nnoise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\nvec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\nfloat highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\nfloat lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\nvec3 normalTangentSpace =\n(highAltitudeFade * normalTangentSpaceHighAltitude) +\n(lowAltitudeFade * normalTangentSpaceLowAltitude);\nnormalTangentSpace = normalize(normalTangentSpace);\nnormalTangentSpace.xy *= waveIntensity;\nnormalTangentSpace = normalize(normalTangentSpace);\n#else\nvec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\nvec3 normalEC = enuToEye * normalTangentSpace;\nconst vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\nfloat diffuseIntensity = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * maskValue;\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity;\n#ifdef SHOW_OCEAN_WAVES\nfloat tsPerturbationRatio = normalTangentSpace.z;\nvec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\nvec3 nonDiffuseHighlight = vec3(0.0);\n#endif\nfloat specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\nfloat specular = specularIntensity * surfaceReflectance;\nreturn vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a);\n}\n#endif\n"}),i("Shaders/GlobeFSDepth",[],function(){"use strict";return"varying vec4 positionEC;\nvoid main()\n{\nczm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\nvec3 direction = normalize(positionEC.xyz);\nczm_ray ray = czm_ray(vec3(0.0), direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (!czm_isEmpty(intersection))\n{\ngl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\nelse\n{\ndiscard;\n}\n}\n"}),i("Shaders/GlobeFSPole",[],function(){"use strict";return"uniform vec3 u_color;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nczm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\nvec3 direction = normalize(czm_windowToEyeCoordinates(gl_FragCoord).xyz);\nczm_ray ray = czm_ray(vec3(0.0), direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (!czm_isEmpty(intersection))\n{\nvec3 positionEC = czm_pointAlongRay(ray, intersection.start);\nvec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\nvec3 normalMC = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), vec3(1.0)));\nvec3 normalEC = normalize(czm_normal * normalMC);\nvec3 startDayColor = u_color;\ngl_FragColor = vec4(startDayColor, 1.0);\n}\nelse\n{\ndiscard;\n}\n}\n"}),i("Shaders/GlobeVS",[],function(){"use strict";return"attribute vec4 position3DAndHeight;\nattribute vec3 textureCoordAndEncodedNormals;\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform vec4 u_tileRectangle;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec3 u_southMercatorYLowAndHighAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\nvec4 getPosition(vec3 position3DWC);\nfloat get2DYPositionFraction();\nvec4 getPosition3DMode(vec3 position3DWC)\n{\nreturn czm_projection * (u_modifiedModelView * vec4(position3DAndHeight.xyz, 1.0));\n}\nfloat get2DMercatorYPositionFraction()\n{\nconst float maxTileWidth = 0.003068;\nfloat positionFraction = textureCoordAndEncodedNormals.y;\nfloat southLatitude = u_southAndNorthLatitude.x;\nfloat northLatitude = u_southAndNorthLatitude.y;\nif (northLatitude - southLatitude > maxTileWidth)\n{\nfloat southMercatorYLow = u_southMercatorYLowAndHighAndOneOverHeight.x;\nfloat southMercatorYHigh = u_southMercatorYLowAndHighAndOneOverHeight.y;\nfloat oneOverMercatorHeight = u_southMercatorYLowAndHighAndOneOverHeight.z;\nfloat currentLatitude = mix(southLatitude, northLatitude, textureCoordAndEncodedNormals.y);\ncurrentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\npositionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorYLow, southMercatorYHigh, oneOverMercatorHeight);\n}\nreturn positionFraction;\n}\nfloat get2DGeographicYPositionFraction()\n{\nreturn textureCoordAndEncodedNormals.y;\n}\nvec4 getPositionPlanarEarth(vec3 position3DWC, float height2D)\n{\nfloat yPositionFraction = get2DYPositionFraction();\nvec4 rtcPosition2D = vec4(height2D, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordAndEncodedNormals.x, yPositionFraction)), 1.0);\nreturn czm_projection * (u_modifiedModelView * rtcPosition2D);\n}\nvec4 getPosition2DMode(vec3 position3DWC)\n{\nreturn getPositionPlanarEarth(position3DWC, 0.0);\n}\nvec4 getPositionColumbusViewMode(vec3 position3DWC)\n{\nreturn getPositionPlanarEarth(position3DWC, position3DAndHeight.w);\n}\nvec4 getPositionMorphingMode(vec3 position3DWC)\n{\nfloat yPositionFraction = get2DYPositionFraction();\nvec4 position2DWC = vec4(0.0, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordAndEncodedNormals.x, yPositionFraction)), 1.0);\nvec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\nreturn czm_modelViewProjection * morphPosition;\n}\nvoid main()\n{\nvec3 position3DWC = position3DAndHeight.xyz + u_center3D;\ngl_Position = getPosition(position3DWC);\n#if defined(ENABLE_VERTEX_LIGHTING)\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\nfloat encodedNormal = textureCoordAndEncodedNormals.z;\nv_normalMC = czm_octDecode(encodedNormal);\nv_normalEC = czm_normal3D * v_normalMC;\n#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\nv_textureCoordinates = textureCoordAndEncodedNormals.xy;\n}\n" -}),i("Shaders/GlobeVSDepth",[],function(){"use strict";return"attribute vec4 position;\nvarying vec4 positionEC;\nvoid main()\n{\npositionEC = czm_modelView * position;\ngl_Position = czm_projection * positionEC;\n}\n"}),i("Shaders/GlobeVSPole",[],function(){"use strict";return"attribute vec4 position;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nfloat x = (position.x - czm_viewport.x) / czm_viewport.z;\nfloat y = (position.y - czm_viewport.y) / czm_viewport.w;\nv_textureCoordinates = vec2(x, y);\ngl_Position = czm_viewportOrthographic * position;\n}\n"}),i("Scene/terrainAttributeLocations",[],function(){"use strict";return{position3DAndHeight:0,textureCoordAndEncodedNormals:1}}),i("Scene/GlobeSurfaceShaderSet",["../Core/defined","../Core/destroyObject","../Scene/SceneMode","../Scene/terrainAttributeLocations"],function(e,t,i,r){"use strict";function n(e,t,i){this.numberOfDayTextures=e,this.flags=t,this.shaderProgram=i}function o(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._attributeLocations=r,this._shadersByTexturesFlags=[]}return o.prototype.getShaderProgram=function(t,r,o,a,s,l,u,c,h,d,p,m,f,v,g){var _=r|s<<2|l<<3|u<<4|c<<5|h<<6|d<<7|p<<8|m<<9|f<<10|v<<11|g<<12,y=o.surfaceShader;if(e(y)&&y.numberOfDayTextures===a&&y.flags===_)return y.shaderProgram;var C=this._shadersByTexturesFlags[a];if(e(C)||(C=this._shadersByTexturesFlags[a]=[]),y=C[_],!e(y)){var w=this.baseVertexShaderSource.clone(),S=this.baseFragmentShaderSource.clone();S.defines.push("TEXTURE_UNITS "+a),s&&S.defines.push("APPLY_BRIGHTNESS"),l&&S.defines.push("APPLY_CONTRAST"),u&&S.defines.push("APPLY_HUE"),c&&S.defines.push("APPLY_SATURATION"),h&&S.defines.push("APPLY_GAMMA"),d&&S.defines.push("APPLY_ALPHA"),p&&(S.defines.push("SHOW_REFLECTIVE_OCEAN"),w.defines.push("SHOW_REFLECTIVE_OCEAN")),m&&S.defines.push("SHOW_OCEAN_WAVES"),f&&(v?(w.defines.push("ENABLE_VERTEX_LIGHTING"),S.defines.push("ENABLE_VERTEX_LIGHTING")):(w.defines.push("ENABLE_DAYNIGHT_SHADING"),S.defines.push("ENABLE_DAYNIGHT_SHADING")));for(var E=" vec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates)\n {\n vec4 color = initialColor;\n",b=0;a>b;++b)E+=" color = sampleAndBlend(\n color,\n u_dayTextures["+b+"],\n textureCoordinates,\n u_dayTextureTexCoordsRectangle["+b+"],\n u_dayTextureTranslationAndScale["+b+"],\n "+(d?"u_dayTextureAlpha["+b+"]":"1.0")+",\n "+(s?"u_dayTextureBrightness["+b+"]":"0.0")+",\n "+(l?"u_dayTextureContrast["+b+"]":"0.0")+",\n "+(u?"u_dayTextureHue["+b+"]":"0.0")+",\n "+(c?"u_dayTextureSaturation["+b+"]":"0.0")+",\n "+(h?"u_dayTextureOneOverGamma["+b+"]":"0.0")+"\n );\n";E+=" return color;\n }",S.sources.push(E);var x,T="vec4 getPosition(vec3 position3DWC) { return getPosition3DMode(position3DWC); }",P="vec4 getPosition(vec3 position3DWC) { return getPosition2DMode(position3DWC); }",A="vec4 getPosition(vec3 position3DWC) { return getPositionColumbusViewMode(position3DWC); }",D="vec4 getPosition(vec3 position3DWC) { return getPositionMorphingMode(position3DWC); }";switch(r){case i.SCENE3D:x=T;break;case i.SCENE2D:x=P;break;case i.COLUMBUS_VIEW:x=A;break;case i.MORPHING:x=D}w.sources.push(x);var M,I="float get2DYPositionFraction() { return get2DGeographicYPositionFraction(); }",O="float get2DYPositionFraction() { return get2DMercatorYPositionFraction(); }";M=g?O:I,w.sources.push(M);var R=t.createShaderProgram(w,S,this._attributeLocations);y=C[_]=new n(a,_,R)}return o.surfaceShader=y,y.shaderProgram},o.prototype.destroy=function(){var i=this._shadersByTexturesFlags;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];if(!e(n))continue;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];e(a)&&a.shaderProgram.destroy()}}return t(this)},o}),i("Scene/ImageryState",["../Core/freezeObject"],function(e){"use strict";var t={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7};return e(t)}),i("Scene/QuadtreeTileLoadState",["../Core/freezeObject"],function(e){"use strict";var t={START:0,LOADING:1,DONE:2,FAILED:3};return e(t)}),i("Scene/TerrainState",["../Core/freezeObject"],function(e){"use strict";var t={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6};return e(t)}),i("Scene/TileTerrain",["../Core/BoundingSphere","../Core/Cartesian3","../Core/ComponentDatatype","../Core/defined","../Core/DeveloperError","../Core/IndexDatatype","../Core/OrientedBoundingBox","../Core/TileProviderError","../Renderer/BufferUsage","../ThirdParty/when","./terrainAttributeLocations","./TerrainState"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,t,i,n,o){function a(t){e.data=t,e.state=h.RECEIVED}function l(){e.state=h.FAILED;var r="Failed to obtain terrain tile X: "+i+" Y: "+n+" Level: "+o+".";t._requestError=s.handleError(t._requestError,t,t.errorEvent,r,i,n,o,c)}function c(){e.data=t.requestTileGeometry(i,n,o),r(e.data)?(e.state=h.RECEIVING,u(e.data,a,l)):e.state=h.UNLOADED}c()}function p(e,t,i,n,o,a){var s=i.tilingScheme,l=e.data,c=l.createMesh(s,n,o,a);r(c)&&(e.state=h.TRANSFORMING,u(c,function(t){e.mesh=t,e.state=h.TRANSFORMED},function(){e.state=h.FAILED}))}function m(e,t,n){var a,s,u=i.FLOAT,d=e.mesh.vertices,p=t.createVertexBuffer(d,l.STATIC_DRAW);n.hasVertexNormals?(a=7*i.getSizeInBytes(u),s=3):(a=6*i.getSizeInBytes(u),s=2);var m=4,f=[{index:c.position3DAndHeight,vertexBuffer:p,componentDatatype:u,componentsPerAttribute:m,offsetInBytes:0,strideInBytes:a},{index:c.textureCoordAndEncodedNormals,vertexBuffer:p,componentDatatype:u,componentsPerAttribute:s,offsetInBytes:m*i.getSizeInBytes(u),strideInBytes:a}],v=e.mesh.indices.indexBuffers||{},g=v[t.id];if(!r(g)||g.isDestroyed()){var _=e.mesh.indices,y=2===_.BYTES_PER_ELEMENT?o.UNSIGNED_SHORT:o.UNSIGNED_INT;g=t.createIndexBuffer(_,l.STATIC_DRAW,y),g.vertexArrayDestroyable=!1,g.referenceCount=1,v[t.id]=g,e.mesh.indices.indexBuffers=v}else++g.referenceCount;e.vertexArray=t.createVertexArray(f,g),e.state=h.READY}var f=function(e){this.state=h.UNLOADED,this.data=void 0,this.mesh=void 0,this.vertexArray=void 0,this.upsampleDetails=e};return f.prototype.freeResources=function(){if(this.state=h.UNLOADED,this.data=void 0,this.mesh=void 0,r(this.vertexArray)){var e=this.vertexArray.indexBuffer;this.vertexArray.destroy(),this.vertexArray=void 0,!e.isDestroyed()&&r(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy())}},f.prototype.publishToTile=function(i){var r=i.data,n=this.mesh;t.clone(n.center,r.center),r.minimumHeight=n.minimumHeight,r.maximumHeight=n.maximumHeight,r.boundingSphere3D=e.clone(n.boundingSphere3D,r.boundingSphere3D),r.orientedBoundingBox=a.clone(n.orientedBoundingBox,r.orientedBoundingBox),i.data.occludeePointInScaledSpace=t.clone(n.occludeePointInScaledSpace,r.occludeePointInScaledSpace),r.freeVertexArray(),r.vertexArray=this.vertexArray,this.vertexArray=void 0},f.prototype.processLoadStateMachine=function(e,t,i,r,n){this.state===h.UNLOADED&&d(this,t,i,r,n),this.state===h.RECEIVED&&p(this,e,t,i,r,n),this.state===h.TRANSFORMED&&m(this,e,t,i,r,n)},f.prototype.processUpsampleStateMachine=function(e,t,i,n,o){if(this.state===h.UNLOADED){var a=this.upsampleDetails,s=a.data,l=a.x,c=a.y,d=a.level;if(this.data=s.upsample(t.tilingScheme,l,c,d,i,n,o),!r(this.data))return;this.state=h.RECEIVING;var f=this;u(this.data,function(e){f.data=e,f.state=h.RECEIVED},function(){f.state=h.FAILED})}this.state===h.RECEIVED&&p(this,e,t,i,n,o),this.state===h.TRANSFORMED&&m(this,e,t,i,n,o)},f}),i("Scene/GlobeSurfaceTile",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/IntersectionTests","../Core/PixelFormat","../Core/Rectangle","../Renderer/PixelDatatype","../Renderer/TextureMagnificationFilter","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","./ImageryState","./QuadtreeTileLoadState","./SceneMode","./TerrainState","./TileTerrain"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_){"use strict";function y(e,i,r,n,a,s,l){if(t.unpack(n,s*a,l),t.add(e.center,l,l),o(i)&&i!==v.SCENE3D){var u=r.ellipsoid,c=u.cartesianToCartographic(l);r.project(c,l),t.fromElements(l.z,l.x,l.y,l)}return l}function C(e,i,r){var n=e.data,a=S(e);o(a)&&(n.upsampledTerrain=new _(a)),x(e,i)&&(n.loadedTerrain=new _);for(var s=0,l=r.length;l>s;++s){var c=r.get(s);c.show&&c._createTileImagerySkeletons(e,i)}var h=e.tilingScheme.ellipsoid,d=e.rectangle;h.cartographicToCartesian(u.southwest(d),n.southwestCornerCartesian),h.cartographicToCartesian(u.northeast(d),n.northeastCornerCartesian),z.longitude=d.west,z.latitude=.5*(d.south+d.north),z.height=0;var p=h.cartographicToCartesian(z,F),m=t.cross(p,t.UNIT_Z,L);t.normalize(m,n.westNormal),z.longitude=d.east;var f=h.cartographicToCartesian(z,B),v=t.cross(t.UNIT_Z,f,L);t.normalize(v,n.eastNormal);var g=h.geodeticSurfaceNormalCartographic(u.southeast(d),N),y=t.subtract(p,f,L),C=t.cross(g,y,N);t.normalize(C,n.southNormal);var w=h.geodeticSurfaceNormalCartographic(u.northwest(d),N),E=t.cross(y,w,N);t.normalize(E,n.northNormal)}function w(e,t,i){var r=e.data,a=r.loadedTerrain,s=r.upsampledTerrain,l=!1;o(a)&&(a.processLoadStateMachine(t,i,e.x,e.y,e.level),a.state>=g.RECEIVED&&(r.terrainData!==a.data&&(r.terrainData=a.data,P(t,r),b(e)),l=!0),a.state===g.READY?(a.publishToTile(e),r.pickTerrain=n(r.loadedTerrain,r.upsampledTerrain),r.loadedTerrain=void 0,r.upsampledTerrain=void 0):a.state===g.FAILED&&(r.loadedTerrain=void 0)),!l&&o(s)&&(s.processUpsampleStateMachine(t,i,e.x,e.y,e.level),s.state>=g.RECEIVED&&r.terrainData!==s.data&&(r.terrainData=s.data,i.hasWaterMask&&A(e),E(e)),s.state===g.READY?(s.publishToTile(e),r.pickTerrain=r.upsampledTerrain,r.upsampledTerrain=void 0):s.state===g.FAILED&&(r.upsampledTerrain=void 0))}function S(e){for(var t=e.parent;o(t)&&o(t.data)&&!o(t.data.terrainData);)t=t.parent;return o(t)&&o(t.data)?{data:t.data.terrainData,x:t.x,y:t.y,level:t.level}:void 0}function E(e){var t=e.data;if(o(e._children))for(var i=0;4>i;++i){var r=e._children[i];if(r.state!==f.START){var n=r.data;if(o(n.terrainData)&&!n.terrainData.wasCreatedByUpsampling())continue;o(n.upsampledTerrain)&&n.upsampledTerrain.freeResources(),n.upsampledTerrain=new _({data:t.terrainData,x:e.x,y:e.y,level:e.level}),r.state=f.LOADING}}}function b(e){var t=e.data;if(o(e.children))for(var i=0;4>i;++i){var r=e.children[i];if(r.state!==f.START){var n=r.data;if(o(n.terrainData)&&!n.terrainData.wasCreatedByUpsampling())continue;o(n.upsampledTerrain)&&n.upsampledTerrain.freeResources(),n.upsampledTerrain=new _({data:t.terrainData,x:e.x,y:e.y,level:e.level}),t.terrainData.isChildAvailable(e.x,e.y,r.x,r.y)&&(o(n.loadedTerrain)||(n.loadedTerrain=new _)),r.state=f.LOADING}}}function x(e,t){var i=t.getTileDataAvailable(e.x,e.y,e.level);if(o(i))return i;var r=e.parent;return o(r)?o(r.data)&&o(r.data.terrainData)?r.data.terrainData.isChildAvailable(r.x,r.y,e.x,e.y):!1:!0}function T(e){var t=e.cache.tile_waterMaskData;if(!o(t)){var i=e.createTexture2D({pixelFormat:l.LUMINANCE,pixelDatatype:c.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});i.referenceCount=1;var r=e.createSampler({wrapS:p.CLAMP_TO_EDGE,wrapT:p.CLAMP_TO_EDGE,minificationFilter:d.LINEAR,magnificationFilter:h.LINEAR});t={allWaterTexture:i,sampler:r,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function P(e,t){var r=t.waterMaskTexture;o(r)&&(--r.referenceCount,0===r.referenceCount&&r.destroy(),t.waterMaskTexture=void 0);var n=t.terrainData.waterMask;if(o(n)){var a,s=T(e),u=n.length;if(1===u){if(0===n[0])return;a=s.allWaterTexture}else{var h=Math.sqrt(u);a=e.createTexture2D({pixelFormat:l.LUMINANCE,pixelDatatype:c.UNSIGNED_BYTE,source:{width:h,height:h,arrayBufferView:n}}),a.referenceCount=0,a.sampler=s.sampler}++a.referenceCount,t.waterMaskTexture=a,i.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}}function A(e){for(var t=e.data,i=e.parent;o(i)&&!o(i.data.terrainData)||i.data.terrainData.wasCreatedByUpsampling();)i=i.parent;if(o(i)&&o(i.data.waterMaskTexture)){t.waterMaskTexture=i.data.waterMaskTexture,++t.waterMaskTexture.referenceCount;var r=i.rectangle,n=e.rectangle,a=n.width,s=n.height,l=a/r.width,u=s/r.height;t.waterMaskTranslationAndScale.x=l*(n.west-r.west)/a,t.waterMaskTranslationAndScale.y=u*(n.south-r.south)/s,t.waterMaskTranslationAndScale.z=l,t.waterMaskTranslationAndScale.w=u}}var D=function(){this.imagery=[],this.southwestCornerCartesian=new t,this.northeastCornerCartesian=new t,this.westNormal=new t,this.southNormal=new t,this.eastNormal=new t,this.northNormal=new t,this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new i(0,0,1,1),this.terrainData=void 0,this.center=new t,this.vertexArray=void 0,this.minimumHeight=0,this.maximumHeight=0,this.boundingSphere3D=new e,this.boundingSphere2D=new e,this.orientedBoundingBox=void 0,this.occludeePointInScaledSpace=new t,this.loadedTerrain=void 0,this.upsampledTerrain=void 0,this.pickBoundingSphere=new e,this.pickTerrain=void 0,this.surfaceShader=void 0};a(D.prototype,{eligibleForUnloading:{get:function(){for(var e=this.loadedTerrain,t=o(e)&&(e.state===g.RECEIVING||e.state===g.TRANSFORMING),i=this.upsampledTerrain,r=o(i)&&(i.state===g.RECEIVING||i.state===g.TRANSFORMING),n=!t&&!r,a=this.imagery,s=0,l=a.length;n&&l>s;++s){var u=a[s];n=!o(u.loadingImagery)||u.loadingImagery.state!==m.TRANSITIONING}return n}}});var M=new t,I=new t,O=new t,R=new t;D.prototype.pick=function(e,i,r,n,a){var l=this.pickTerrain;if(!o(l))return void 0;var u=l.mesh;if(!o(u))return void 0;for(var c=u.vertices,h=u.stride,d=u.indices,p=d.length,m=0;p>m;m+=3){var f=d[m],v=d[m+1],g=d[m+2],_=y(this,i,r,c,h,f,M),C=y(this,i,r,c,h,v,I),w=y(this,i,r,c,h,g,O),S=s.rayTriangle(e,_,C,w,n,R);if(o(S))return t.clone(S,a)}return void 0},D.prototype.freeResources=function(){o(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,o(this.loadedTerrain)&&(this.loadedTerrain.freeResources(),this.loadedTerrain=void 0),o(this.upsampledTerrain)&&(this.upsampledTerrain.freeResources(),this.upsampledTerrain=void 0),o(this.pickTerrain)&&(this.pickTerrain.freeResources(),this.pickTerrain=void 0);var e,t,i=this.imagery;for(e=0,t=i.length;t>e;++e)i[e].freeResources();this.imagery.length=0,this.freeVertexArray()},D.prototype.freeVertexArray=function(){var e;o(this.vertexArray)&&(e=this.vertexArray.indexBuffer,this.vertexArray=this.vertexArray.destroy(),!e.isDestroyed()&&o(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy())),o(this.wireframeVertexArray)&&(e=this.wireframeVertexArray.indexBuffer,this.wireframeVertexArray=this.wireframeVertexArray.destroy(),!e.isDestroyed()&&o(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy()))},D.processStateMachine=function(e,t,i,r){var n=e.data;o(n)||(n=e.data=new D),e.state===f.START&&(C(e,i,r),e.state=f.LOADING),e.state===f.LOADING&&w(e,t,i);for(var a=o(n.vertexArray),s=!o(n.loadedTerrain)&&!o(n.upsampledTerrain),l=o(n.terrainData)&&n.terrainData.wasCreatedByUpsampling(),u=n.imagery,c=0,h=u.length;h>c;++c){var d=u[c];if(o(d.loadingImagery)){if(d.loadingImagery.state===m.PLACEHOLDER){var p=d.loadingImagery.imageryLayer;if(p.imageryProvider.ready){d.freeResources(),u.splice(c,1),p._createTileImagerySkeletons(e,i,c),--c,h=u.length;continue}l=!1}var v=d.processStateMachine(e,t);s=s&&v,a=a&&(v||o(d.readyImagery)),l=l&&o(d.loadingImagery)&&(d.loadingImagery.state===m.FAILED||d.loadingImagery.state===m.INVALID)}else l=!1}e.upsampledFromParent=l,c===h&&(a&&(e.renderable=!0),s&&(e.state=f.DONE))};var L=new t,N=new t,F=new t,B=new t,z=new r;return D}),i("Shaders/ReprojectWebMercatorFS",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Shaders/ReprojectWebMercatorVS",[],function(){"use strict";return"attribute vec4 position;\nattribute float webMercatorT;\nuniform vec2 u_textureDimensions;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nv_textureCoordinates = vec2(position.x, webMercatorT);\ngl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n"}),i("Scene/Imagery",["../Core/defined","../Core/destroyObject","./ImageryState"],function(e,t,i){"use strict";var r=function(t,r,n,o,a){if(this.imageryLayer=t,this.x=r,this.y=n,this.level=o,0!==o){var s=0|r/2,l=0|n/2,u=o-1;this.parent=t.getImageryFromCache(s,l,u)}if(this.state=i.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.credits=void 0,this.referenceCount=0,!e(a)&&t.imageryProvider.ready){var c=t.imageryProvider.tilingScheme;a=c.tileXYToRectangle(r,n,o)}this.rectangle=a};return r.createPlaceholder=function(e){var t=new r(e,0,0,0);return t.addReference(),t.state=i.PLACEHOLDER,t},r.prototype.addReference=function(){++this.referenceCount},r.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),e(this.parent)&&this.parent.releaseReference(),e(this.image)&&e(this.image.destroy)&&this.image.destroy(),e(this.texture)&&this.texture.destroy(),t(this),0):this.referenceCount},r.prototype.processStateMachine=function(e){this.state===i.UNLOADED&&(this.state=i.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===i.RECEIVED&&(this.state=i.TRANSITIONING,this.imageryLayer._createTexture(e,this)),this.state===i.TEXTURE_LOADED&&(this.state=i.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this))},r}),i("Scene/TileImagery",["../Core/defined","./ImageryState"],function(e,t){"use strict";var i=function(e,t){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0};return i.prototype.freeResources=function(){e(this.readyImagery)&&this.readyImagery.releaseReference(),e(this.loadingImagery)&&this.loadingImagery.releaseReference()},i.prototype.processStateMachine=function(i,r){var n=this.loadingImagery,o=n.imageryLayer;if(n.processStateMachine(r),n.state===t.READY)return e(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(i,this),!0;for(var a,s=n.parent;e(s)&&s.state!==t.READY;)s.state!==t.FAILED&&s.state!==t.INVALID&&(a=a||s),s=s.parent;return this.readyImagery!==s&&(e(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=s,e(s)&&(s.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(i,this))),n.state===t.FAILED||n.state===t.INVALID?e(a)?(a.processStateMachine(r),!1):!0:!1},i}),i("Scene/ImageryLayer",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian4","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/FeatureDetection","../Core/GeographicTilingScheme","../Core/IndexDatatype","../Core/Math","../Core/PixelFormat","../Core/PrimitiveType","../Core/Rectangle","../Core/TerrainProvider","../Core/TileProviderError","../Renderer/BufferUsage","../Renderer/ClearCommand","../Renderer/DrawCommand","../Renderer/MipmapHint","../Renderer/ShaderSource","../Renderer/TextureMagnificationFilter","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../Shaders/ReprojectWebMercatorFS","../Shaders/ReprojectWebMercatorVS","../ThirdParty/when","./Imagery","./ImageryState","./TileImagery"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I){"use strict";function O(e,t,i){return JSON.stringify([e,t,i])}function R(t,i,n,o){var s=i.cache.imageryLayer_reproject;if(!a(s)){s=i.cache.imageryLayer_reproject={framebuffer:void 0,vertexArray:void 0,shaderProgram:void 0,renderState:void 0,sampler:void 0,destroy:function(){a(this.framebuffer)&&this.framebuffer.destroy(),a(this.vertexArray)&&this.vertexArray.destroy(),a(this.shaderProgram)&&this.shaderProgram.destroy()}};for(var l=new Float32Array(256),u=0,c=0;64>c;++c){var p=c/63;l[u++]=0,l[u++]=p,l[u++]=1,l[u++]=p}var f={position:0,webMercatorT:1},g=v.getRegularGridIndices(2,64),A=i.createIndexBuffer(g,_.STATIC_DRAW,h.UNSIGNED_SHORT);s.vertexArray=i.createVertexArray([{index:f.position,vertexBuffer:i.createVertexBuffer(l,_.STATIC_DRAW),componentsPerAttribute:2},{index:f.webMercatorT,vertexBuffer:i.createVertexBuffer(512,_.STREAM_DRAW),componentsPerAttribute:1}],A);var D=new S({sources:[P]});s.shaderProgram=i.createShaderProgram(D,T,f),s.sampler=i.createSampler({wrapS:x.CLAMP_TO_EDGE,wrapT:x.CLAMP_TO_EDGE,minificationFilter:b.LINEAR,magnificationFilter:E.LINEAR})}n.sampler=s.sampler;var M=n.width,I=n.height;k.textureDimensions.x=M,k.textureDimensions.y=I,k.texture=n;var O=Math.sin(o.south),R=.5*Math.log((1+O)/(1-O));O=Math.sin(o.north);var L=.5*Math.log((1+O)/(1-O)),N=1/(L-R),F=i.createTexture2D({width:M,height:I,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});d.isPowerOfTwo(M)&&d.isPowerOfTwo(I)&&F.generateMipmap(w.NICEST),a(s.framebuffer)&&s.framebuffer.destroy(),s.framebuffer=i.createFramebuffer({colorTextures:[F]}),s.framebuffer.destroyAttachments=!1;for(var B=o.south,z=o.north,U=V,W=0,G=0;64>G;++G){var H=G/63,q=d.lerp(B,z,H);O=Math.sin(q);var j=.5*Math.log((1+O)/(1-O)),Y=(j-R)*N;U[W++]=Y,U[W++]=Y}s.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(U);var X=new y({color:r.BLACK,framebuffer:s.framebuffer});X.execute(i),a(s.renderState)&&s.renderState.viewport.width===M&&s.renderState.viewport.height===I||(s.renderState=i.createRenderState({viewport:new e(0,0,M,I)}));var Z=new C({framebuffer:s.framebuffer,shaderProgram:s.shaderProgram,renderState:s.renderState,primitiveType:m.TRIANGLES,vertexArray:s.vertexArray,uniformMap:k});return Z.execute(i),F}function L(e,t,i){var r=e._imageryProvider,n=r.tilingScheme,o=n.ellipsoid,a=e._imageryProvider.tilingScheme instanceof c?1:Math.cos(i),s=n.rectangle,l=o.maximumRadius*s.width*a/(r.tileWidth*n.getNumberOfXTilesAtLevel(0)),u=l/t,h=Math.log(u)/Math.log(2),d=Math.round(h);return 0|d}var N=function U(e,t){this._imageryProvider=e,t=o(t,{}),this.alpha=o(t.alpha,o(e.defaultAlpha,1)),this.brightness=o(t.brightness,o(e.defaultBrightness,U.DEFAULT_BRIGHTNESS)),this.contrast=o(t.contrast,o(e.defaultContrast,U.DEFAULT_CONTRAST)),this.hue=o(t.hue,o(e.defaultHue,U.DEFAULT_HUE)),this.saturation=o(t.saturation,o(e.defaultSaturation,U.DEFAULT_SATURATION)),this.gamma=o(t.gamma,o(e.defaultGamma,U.DEFAULT_GAMMA)),this.show=o(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=o(t.rectangle,f.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new I(D.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0};s(N.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}}),N.DEFAULT_BRIGHTNESS=1,N.DEFAULT_CONTRAST=1,N.DEFAULT_HUE=0,N.DEFAULT_SATURATION=1,N.DEFAULT_GAMMA=1,N.prototype.isBaseLayer=function(){return this._isBaseLayer},N.prototype.isDestroyed=function(){return!1},N.prototype.destroy=function(){return l(this)};var F=new f,B=new f,z=new f;N.prototype._createTileImagerySkeletons=function(e,t,r){var n=e.data;if(a(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(a(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;var o=this._imageryProvider;if(a(r)||(r=n.imagery.length),!o.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),n.imagery.splice(r,0,this._skeletonPlaceholder),!0;var s=f.intersection(o.rectangle,this._rectangle,F),l=f.intersection(e.rectangle,s,B);if(!a(l)){if(!this.isBaseLayer())return!1;var u=s,c=e.rectangle;l=B,c.south>=u.north?l.north=l.south=u.north:c.north<=u.south?l.north=l.south=u.south:(l.south=Math.max(c.south,u.south),l.north=Math.min(c.north,u.north)),c.west>=u.east?l.west=l.east=u.east:c.east<=u.west?l.west=l.east=u.west:(l.west=Math.max(c.west,u.west),l.east=Math.min(c.east,u.east))}var h=0;l.south>0?h=l.south:l.north<0&&(h=l.north);var d=1,p=d*t.getLevelMaximumGeometricError(e.level),m=L(this,p,h);m=Math.max(0,m);var v=o.maximumLevel;if(m>v&&(m=v),a(o.minimumLevel)){var g=o.minimumLevel;g>m&&(m=g)}var _=o.tilingScheme,y=_.positionToTileXY(f.northwest(l),m),C=_.positionToTileXY(f.southeast(l),m),w=e.rectangle.height/512,S=e.rectangle.width/512,E=_.tileXYToRectangle(y.x,y.y,m);Math.abs(E.south-e.rectangle.north)<S&&y.y<C.y&&++y.y,Math.abs(E.east-e.rectangle.west)<w&&y.x<C.x&&++y.x;var b=_.tileXYToRectangle(C.x,C.y,m);Math.abs(b.north-e.rectangle.south)<S&&C.y>y.y&&--C.y,Math.abs(b.west-e.rectangle.east)<w&&C.x>y.x&&--C.x;var x,T,P=e.rectangle,A=_.tileXYToRectangle(y.x,y.y,m),D=f.intersection(A,s,z),M=0,O=1;!this.isBaseLayer()&&Math.abs(D.west-e.rectangle.west)>=w&&(M=Math.min(1,(D.west-P.west)/P.width)),!this.isBaseLayer()&&Math.abs(D.north-e.rectangle.north)>=S&&(O=Math.max(0,(D.north-P.south)/P.height));for(var R=O,N=y.x;N<=C.x;N++){x=M,A=_.tileXYToRectangle(N,y.y,m),D=f.intersection(A,s,z),M=Math.min(1,(D.east-P.west)/P.width),N===C.x&&(this.isBaseLayer()||Math.abs(D.east-e.rectangle.east)<w)&&(M=1),O=R;for(var k=y.y;k<=C.y;k++){T=O,A=_.tileXYToRectangle(N,k,m),D=f.intersection(A,s,z),O=Math.max(0,(D.south-P.south)/P.height),k===C.y&&(this.isBaseLayer()||Math.abs(D.south-e.rectangle.south)<S)&&(O=0);var V=new i(x,O,M,T),U=this.getImageryFromCache(N,k,m,A);n.imagery.splice(r,0,new I(U,V)),++r}}return!0},N.prototype._calculateTextureTranslationAndScale=function(e,t){var r=t.readyImagery.rectangle,n=e.rectangle,o=n.width,a=n.height,s=o/r.width,l=a/r.height;return new i(s*(n.west-r.west)/o,l*(n.south-r.south)/a,s,l)},N.prototype._requestImagery=function(e){function t(t){return a(t)?(e.image=t,e.state=M.RECEIVED,g.handleSuccess(o._requestImageError),void 0):i()}function i(t){e.state=M.FAILED;var i="Failed to obtain image tile X: "+e.x+" Y: "+e.y+" Level: "+e.level+".";o._requestImageError=g.handleError(o._requestImageError,n,n.errorEvent,i,e.x,e.y,e.level,r,t)}function r(){e.state=M.TRANSITIONING;var r=n.requestImage(e.x,e.y,e.level);return a(r)?(a(n.getTileCredits)&&(e.credits=n.getTileCredits(e.x,e.y,e.level)),A(r,t,i),void 0):(e.state=M.UNLOADED,void 0)}var n=this._imageryProvider,o=this;r()},N.prototype._createTexture=function(e,t){var i=this._imageryProvider;if(a(i.tileDiscardPolicy)){var r=i.tileDiscardPolicy;if(a(r)){if(!r.isReady())return t.state=M.RECEIVED,void 0;if(r.shouldDiscardImage(t.image))return t.state=M.INVALID,void 0}}var n=e.createTexture2D({source:t.image,pixelFormat:i.hasAlphaChannel?p.RGBA:p.RGB});t.texture=n,t.image=void 0,t.state=M.TEXTURE_LOADED},N.prototype._reprojectTexture=function(e,t){var i=t.texture,r=t.rectangle;if(!(this._imageryProvider.tilingScheme instanceof c)&&r.width/i.width>1e-5){var n=R(this,e,i,t.rectangle);i.destroy(),t.texture=i=n}if(d.isPowerOfTwo(i.width)&&d.isPowerOfTwo(i.height)){var s=e.cache.imageryLayer_mipmapSampler;if(!a(s)){var l=e.maximumTextureFilterAnisotropy;s=e.cache.imageryLayer_mipmapSampler=e.createSampler({wrapS:x.CLAMP_TO_EDGE,wrapT:x.CLAMP_TO_EDGE,minificationFilter:b.LINEAR_MIPMAP_LINEAR,magnificationFilter:E.LINEAR,maximumAnisotropy:Math.min(l,o(this._maximumAnisotropy,l))})}i.generateMipmap(w.NICEST),i.sampler=s}else{var u=e.cache.imageryLayer_nonMipmapSampler;a(u)||(u=e.cache.imageryLayer_nonMipmapSampler=e.createSampler({wrapS:x.CLAMP_TO_EDGE,wrapT:x.CLAMP_TO_EDGE,minificationFilter:b.LINEAR,magnificationFilter:E.LINEAR})),i.sampler=u}t.state=M.READY},N.prototype.getImageryFromCache=function(e,t,i,r){var n=O(e,t,i),o=this._imageryCache[n];return a(o)||(o=new D(this,e,t,i,r),this._imageryCache[n]=o),o.addReference(),o},N.prototype.removeImageryFromCache=function(e){var t=O(e.x,e.y,e.level);delete this._imageryCache[t]};var k={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new t,texture:void 0},V=u.supportsTypedArrays()?new Float32Array(128):void 0;return N}),i("Scene/GlobeSurfaceTileProvider",["../Core/BoundingSphere","../Core/BoxOutlineGeometry","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/FeatureDetection","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/IndexDatatype","../Core/Intersect","../Core/Matrix4","../Core/OrientedBoundingBox","../Core/PrimitiveType","../Core/Rectangle","../Core/SphereOutlineGeometry","../Core/Visibility","../Core/WebMercatorProjection","../Renderer/BufferUsage","../Renderer/DrawCommand","../Scene/BlendingState","../Scene/DepthFunction","../Scene/Pass","../Scene/PerInstanceColorAppearance","../Scene/Primitive","../ThirdParty/when","./GlobeSurfaceTile","./ImageryLayer","./ImageryState","./QuadtreeTileLoadState","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B){"use strict";function z(e,t){var i=e.loadingImagery;l(i)||(i=e.readyImagery);var r=t.loadingImagery;return l(r)||(r=t.readyImagery),i.imageryLayer._layerIndex-r.imageryLayer._layerIndex}function k(){var e={u_initialColor:function(){return this.initialColor},u_zoomedOutOceanSpecularIntensity:function(){return this.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.oceanNormalMap},u_lightingFadeDistance:function(){return this.lightingFadeDistance},u_center3D:function(){return this.center3D},u_tileRectangle:function(){return this.tileRectangle},u_modifiedModelView:function(){return this.modifiedModelView},u_dayTextures:function(){return this.dayTextures},u_dayTextureTranslationAndScale:function(){return this.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.dayTextureTexCoordsRectangle},u_dayTextureAlpha:function(){return this.dayTextureAlpha},u_dayTextureBrightness:function(){return this.dayTextureBrightness},u_dayTextureContrast:function(){return this.dayTextureContrast},u_dayTextureHue:function(){return this.dayTextureHue},u_dayTextureSaturation:function(){return this.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.dayTextureOneOverGamma},u_dayIntensity:function(){return this.dayIntensity},u_southAndNorthLatitude:function(){return this.southAndNorthLatitude},u_southMercatorYLowAndHighAndOneOverHeight:function(){return this.southMercatorYLowAndHighAndOneOverHeight},u_waterMask:function(){return this.waterMask},u_waterMaskTranslationAndScale:function(){return this.waterMaskTranslationAndScale},initialColor:new n(0,0,.5,1),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new i(65e5,9e6),center3D:void 0,modifiedModelView:new _,tileRectangle:new n,dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayIntensity:0,southAndNorthLatitude:new i,southMercatorYLowAndHighAndOneOverHeight:new r,waterMask:void 0,waterMaskTranslationAndScale:new n};return e}function V(e,t,i){var r=i.data;if(!l(r.wireframeVertexArray)&&!l(r.meshForWireframePromise)&&(r.meshForWireframePromise=r.terrainData.createMesh(t._terrainProvider.tilingScheme,i.x,i.y,i.level),l(r.meshForWireframePromise))){var n=r.vertexArray;O(r.meshForWireframePromise,function(t){r.vertexArray===n&&(r.wireframeVertexArray=U(e,r.vertexArray,t)),r.meshForWireframePromise=void 0})}}function U(e,t,i){var r={indices:i.indices,primitiveType:C.TRIANGLES};f.toWireframe(r); -var n=r.indices,o=e.createIndexBuffer(n,x.STATIC_DRAW,v.UNSIGNED_SHORT);return e.createVertexArray(t._attributes,o)}function W(t,i,a,s,u){var c=i.data,h=s.camera.viewMatrix,d=a.maximumTextureImageUnits,p=c.waterMaskTexture,m=t.hasWaterMask&&l(p),f=t.oceanNormalMap,v=m&&l(f),g=t.terrainProvider.ready&&t.terrainProvider.hasVertexNormals;m&&--d,v&&--d;var S=c.center,E=Y,x=0,P=0,A=0,M=0,I=0,O=!1;if(s.mode!==B.SCENE3D){var R=s.mapProjection,F=R.project(w.southwest(i.rectangle),J),z=R.project(w.northeast(i.rectangle),Q);if(E.x=F.x,E.y=F.y,E.z=z.x,E.w=z.y,s.mode!==B.MORPHING&&(S=X,S.x=0,S.y=.5*(E.z+E.x),S.z=.5*(E.w+E.y),E.x-=S.y,E.y-=S.z,E.z-=S.y,E.w-=S.z),R instanceof b){x=i.rectangle.south,P=i.rectangle.north;var U=b.geodeticLatitudeToMercatorAngle(x),W=b.geodeticLatitudeToMercatorAngle(P);q[0]=U,A=q[0],M=U-q[0],I=1/(W-U),O=!0}}var G=_.multiplyByPoint(h,S,Z);_.setTranslation(h,G,j);var H=c.imagery,K=0,$=H.length,et=t._renderState,tt=t._blendRenderState,it=et,st=t._firstPassInitialColor;l(t._debug.boundingSphereTile)||ot();do{var lt,ut,ct=0;t._drawCommands.length<=t._usedDrawCommands?(lt=new T,lt.owner=i,lt.cull=!1,lt.boundingVolume=new e,lt.orientedBoundingBox=void 0,ut=k(),t._drawCommands.push(lt),t._uniformMaps.push(ut)):(lt=t._drawCommands[t._usedDrawCommands],ut=t._uniformMaps[t._usedDrawCommands]),lt.owner=i,++t._usedDrawCommands,i===t._debug.boundingSphereTile&&(l(c.orientedBoundingBox)?rt(c.orientedBoundingBox,o.RED).update(a,s,u):l(c.boundingSphere3D)&&nt(c.boundingSphere3D,o.RED).update(a,s,u)),n.clone(st,ut.initialColor),ut.oceanNormalMap=f,ut.lightingFadeDistance.x=t.lightingFadeOutDistance,ut.lightingFadeDistance.y=t.lightingFadeInDistance,ut.zoomedOutOceanSpecularIntensity=t.zoomedOutOceanSpecularIntensity,ut.center3D=c.center,n.clone(E,ut.tileRectangle),ut.southAndNorthLatitude.x=x,ut.southAndNorthLatitude.y=P,ut.southMercatorYLowAndHighAndOneOverHeight.x=M,ut.southMercatorYLowAndHighAndOneOverHeight.y=A,ut.southMercatorYLowAndHighAndOneOverHeight.z=I,_.clone(j,ut.modifiedModelView);for(var ht=!1,dt=!1,pt=!1,mt=!1,ft=!1,vt=!1;d>ct&&$>K;){var gt=H[K],_t=gt.readyImagery;if(++K,l(_t)&&_t.state===N.READY&&0!==_t.imageryLayer.alpha){var yt=_t.imageryLayer;if(l(gt.textureTranslationAndScale)||(gt.textureTranslationAndScale=yt._calculateTextureTranslationAndScale(i,gt)),ut.dayTextures[ct]=_t.texture,ut.dayTextureTranslationAndScale[ct]=gt.textureTranslationAndScale,ut.dayTextureTexCoordsRectangle[ct]=gt.textureCoordinateRectangle,ut.dayTextureAlpha[ct]=yt.alpha,vt=vt||1!==ut.dayTextureAlpha[ct],ut.dayTextureBrightness[ct]=yt.brightness,ht=ht||ut.dayTextureBrightness[ct]!==L.DEFAULT_BRIGHTNESS,ut.dayTextureContrast[ct]=yt.contrast,dt=dt||ut.dayTextureContrast[ct]!==L.DEFAULT_CONTRAST,ut.dayTextureHue[ct]=yt.hue,pt=pt||ut.dayTextureHue[ct]!==L.DEFAULT_HUE,ut.dayTextureSaturation[ct]=yt.saturation,mt=mt||ut.dayTextureSaturation[ct]!==L.DEFAULT_SATURATION,ut.dayTextureOneOverGamma[ct]=1/yt.gamma,ft=ft||ut.dayTextureOneOverGamma[ct]!==1/L.DEFAULT_GAMMA,l(_t.credits))for(var Ct=s.creditDisplay,wt=_t.credits,St=0,Et=wt.length;Et>St;++St)Ct.addCredit(wt[St]);++ct}}ut.dayTextures.length=ct,ut.waterMask=p,n.clone(c.waterMaskTranslationAndScale,ut.waterMaskTranslationAndScale),lt.shaderProgram=t._surfaceShaderSet.getShaderProgram(a,s.mode,c,ct,ht,dt,pt,mt,ft,vt,m,v,t.enableLighting,g,O),lt.renderState=it,lt.primitiveType=C.TRIANGLES,lt.vertexArray=c.vertexArray,lt.uniformMap=ut,lt.pass=D.GLOBE,t._debug.wireframe&&(V(a,t,i),l(c.wireframeVertexArray)&&(lt.vertexArray=c.wireframeVertexArray,lt.primitiveType=C.LINES));var bt=lt.boundingVolume,xt=lt.orientedBoundingBox;s.mode!==B.SCENE3D?(e.fromRectangleWithHeights2D(i.rectangle,s.mapProjection,c.minimumHeight,c.maximumHeight,bt),r.fromElements(bt.center.z,bt.center.x,bt.center.y,bt.center),s.mode===B.MORPHING&&(bt=e.union(c.boundingSphere3D,bt,bt))):(lt.boundingVolume=e.clone(c.boundingSphere3D,bt),lt.orientedBoundingBox=y.clone(c.orientedBoundingBox,xt)),u.push(lt),it=tt,st=at}while($>K)}var G=function st(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._errorEvent=new d,this._imageryLayers.layerAdded.addEventListener(st.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(st.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(st.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(st.prototype._onLayerShownOrHidden,this),this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._usedDrawCommands=0,this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new o(0,0,.5,1)};u(G.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=n.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(0===this._imageryLayers.length||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,l(this._quadtree)&&this._quadtree.invalidateAllTiles())}}}),G.prototype.beginUpdate=function(e,t){this._imageryLayers._update(),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(e){e.data.imagery.sort(z)}));var i,r,n=this._tilesToRenderByTextureCount;for(i=0,r=n.length;r>i;++i){var o=n[i];l(o)&&(o.length=0)}this._usedDrawCommands=0;var a=t.creditDisplay;this._terrainProvider.ready&&l(this._terrainProvider.credit)&&a.addCredit(this._terrainProvider.credit);var s=this._imageryLayers;for(i=0,r=s.length;r>i;++i){var u=s.get(i).imageryProvider;u.ready&&l(u.credit)&&a.addCredit(u.credit)}},G.prototype.endUpdate=function(e,t,i){l(this._renderState)||(this._renderState=e.createRenderState({cull:{enabled:!0},depthTest:{enabled:!0}})),l(this._blendRenderState)||(this._blendRenderState=e.createRenderState({cull:{enabled:!0},depthTest:{enabled:!0,func:A.LESS_OR_EQUAL},blending:P.ALPHA_BLEND})),this._renderState.depthTest.enabled=t.mode===B.SCENE3D||t.mode===B.COLUMBUS_VIEW,this._blendRenderState.depthTest.enabled=this._renderState.depthTest.enabled;for(var r=this._tilesToRenderByTextureCount,n=0,o=r.length;o>n;++n){var a=r[n];if(l(a))for(var s=0,u=a.length;u>s;++s)W(this,a[s],e,t,i)}},G.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},G.prototype.loadTile=function(e,t,i){R.processStateMachine(i,e,this._terrainProvider,this._imageryLayers)};var H=new e;G.prototype.computeTileVisibility=function(t,i,n){var o=t.data,a=i.cullingVolume,u=s(o.orientedBoundingBox,o.boundingSphere3D);i.mode!==B.SCENE3D&&(u=H,e.fromRectangleWithHeights2D(t.rectangle,i.mapProjection,o.minimumHeight,o.maximumHeight,u),r.fromElements(u.center.z,u.center.x,u.center.y,u.center),i.mode===B.MORPHING&&(u=e.union(o.boundingSphere3D,u,u)));var c=a.computeVisibility(u);if(c===g.OUTSIDE)return E.NONE;if(i.mode===B.SCENE3D){var h=o.occludeePointInScaledSpace;return l(h)?n.ellipsoid.isScaledSpacePointVisible(h)?c:E.NONE:c}return c};var q=p.supportsTypedArrays()?new Float32Array(1):void 0,j=new _,Y=new n,X=new r,Z=new r,J=new r,Q=new r;G.prototype.showTileThisFrame=function(e){for(var t=0,i=e.data.imagery,r=0,n=i.length;n>r;++r){var o=i[r];l(o.readyImagery)&&0!==o.readyImagery.imageryLayer.alpha&&++t}var a=this._tilesToRenderByTextureCount[t];l(a)||(a=[],this._tilesToRenderByTextureCount[t]=a),a.push(e);var s=this._debug;++s.tilesRendered,s.texturesRendered+=t};var K=new r,$=new r,et=new r(0,-1,0),tt=new r(0,0,-1),it=new r;G.prototype.computeDistanceToTile=function(e,t){var i=e.data,n=i.southwestCornerCartesian,o=i.northeastCornerCartesian,a=i.westNormal,s=i.southNormal,l=i.eastNormal,u=i.northNormal,c=i.maximumHeight;t.mode!==B.SCENE3D&&(n=t.mapProjection.project(w.southwest(e.rectangle),K),n.z=n.y,n.y=n.x,n.x=0,o=t.mapProjection.project(w.northeast(e.rectangle),$),o.z=o.y,o.y=o.x,o.x=0,a=et,l=r.UNIT_Y,s=tt,u=r.UNIT_Z,c=0);var h,d=t.camera.positionWC,p=t.camera.positionCartographic,m=r.subtract(d,n,it),f=r.dot(m,a),v=r.dot(m,s),g=r.subtract(d,o,it),_=r.dot(g,l),y=r.dot(g,u);h=t.mode===B.SCENE3D?p.height:d.x;var C=h-c,S=0;return f>0?S+=f*f:_>0&&(S+=_*_),v>0?S+=v*v:y>0&&(S+=y*y),C>0&&(S+=C*C),Math.sqrt(S)},G.prototype.isDestroyed=function(){return!1},G.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),c(this)},G.prototype._onLayerAdded=function(e){if(e.show){var t=this._terrainProvider;this._quadtree.forEachLoadedTile(function(i){e._createTileImagerySkeletons(i,t)&&(i.state=F.LOADING)}),this._layerOrderChanged=!0}},G.prototype._onLayerRemoved=function(e){this._quadtree.forEachLoadedTile(function(t){for(var i=t.data.imagery,r=-1,n=0,o=0,a=i.length;a>o;++o){var s=i[o],u=s.loadingImagery;if(l(u)||(u=s.readyImagery),u.imageryLayer===e)-1===r&&(r=o),s.freeResources(),++n;else if(-1!==r)break}-1!==r&&i.splice(r,n)})},G.prototype._onLayerMoved=function(){this._layerOrderChanged=!0},G.prototype._onLayerShownOrHidden=function(e,t,i){i?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var rt,nt,ot;!function(){function e(e){return new I({geometryInstances:e,appearance:new M({translucent:!1,flat:!0}),asynchronous:!1})}var i,n,o=new m({geometry:t.fromDimensions({dimensions:new r(2,2,2)})}),s=new m({geometry:new S({radius:1})}),u=new _;rt=function(t,r){return t===i?n:(ot(),i=t,u=_.fromRotationTranslation(t.halfAxes,t.center,u),o.modelMatrix=u,o.attributes.color=a.fromColor(r),n=e(o))},nt=function(t,r){return t===i?n:(ot(),i=t,u=_.fromTranslation(t.center,u),u=_.multiplyByUniformScale(u,t.radius,u),s.modelMatrix=u,s.attributes.color=a.fromColor(r),n=e(s))},ot=function(){l(n)&&(n.destroy(),n=void 0,i=void 0)}}();var at=new n(0,0,0,0);return G}),i("Scene/ImageryLayerCollection",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/Math","../Core/Rectangle","../ThirdParty/when","./ImageryLayer"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e,t){var i=e.indexOf(t);return i}function h(e,t,i){var r=e._layers;if(t=a.clamp(t,0,r.length-1),i=a.clamp(i,0,r.length-1),t!==i){var n=r[t];r[t]=r[i],r[i]=n,e._update(),e.layerMoved.raiseEvent(n,i,t)}}var d=function(){this._layers=[],this.layerAdded=new o,this.layerRemoved=new o,this.layerMoved=new o,this.layerShownOrHidden=new o};i(d.prototype,{length:{get:function(){return this._layers.length}}}),d.prototype.add=function(e,i){var r=t(i);r?this._layers.splice(i,0,e):(i=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,i)},d.prototype.addImageryProvider=function(e,t){var i=new u(e);return this.add(i,t),i},d.prototype.remove=function(t,i){i=e(i,!0);var r=this._layers.indexOf(t);return-1!==r?(this._layers.splice(r,1),this._update(),this.layerRemoved.raiseEvent(t,r),i&&t.destroy(),!0):!1},d.prototype.removeAll=function(t){t=e(t,!0);for(var i=this._layers,r=0,n=i.length;n>r;r++){var o=i[r];this.layerRemoved.raiseEvent(o,r),t&&o.destroy()}this._layers=[]},d.prototype.contains=function(e){return-1!==this.indexOf(e)},d.prototype.indexOf=function(e){return this._layers.indexOf(e)},d.prototype.get=function(e){return this._layers[e]},d.prototype.raise=function(e){var t=c(this._layers,e);h(this,t,t+1)},d.prototype.lower=function(e){var t=c(this._layers,e);h(this,t,t-1)},d.prototype.raiseToTop=function(e){var t=c(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))},d.prototype.lowerToBottom=function(e){var t=c(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};var p=new s;return d.prototype.pickImageryLayerFeatures=function(e,i){var r=i.globe.pick(e,i);if(!t(r))return void 0;var n=i.globe.ellipsoid.cartesianToCartographic(r),o=i.globe._surface._tilesToRender;o.length;for(var u,c=0;!t(u)&&c<o.length;++c){var h=o[c];s.contains(h.rectangle,n)&&(u=h)}if(!t(u))return void 0;u.rectangle;for(var d=u.data.imagery,m=[],f=d.length-1;f>=0;--f){var v=d[f],g=v.readyImagery;if(t(g)){var _=g.imageryLayer.imageryProvider;if(t(_.pickFeatures)&&s.contains(g.rectangle,n)){var y=p,C=1/1024;if(y.west=a.lerp(u.rectangle.west,u.rectangle.east,v.textureCoordinateRectangle.x-C),y.east=a.lerp(u.rectangle.west,u.rectangle.east,v.textureCoordinateRectangle.z+C),y.south=a.lerp(u.rectangle.south,u.rectangle.north,v.textureCoordinateRectangle.y-C),y.north=a.lerp(u.rectangle.south,u.rectangle.north,v.textureCoordinateRectangle.w+C),s.contains(y,n)){var w=_.pickFeatures(g.x,g.y,g.level,n.longitude,n.latitude);t(w)&&m.push(w)}}}}return 0===m.length?void 0:l.all(m,function(e){for(var i=[],r=0;r<e.length;++r){var o=e[r];if(t(o)&&o.length>0)for(var a=0;a<o.length;++a){var s=o[a];t(s.position)||(s.position=n),i.push(s)}}return i})},d.prototype.isDestroyed=function(){return!1},d.prototype.destroy=function(){return this.removeAll(!0),r(this)},d.prototype._update=function(){for(var e,i,r=!0,n=this._layers,o=0,a=n.length;a>o;++o)i=n[o],i._layerIndex=o,i.show?(i._isBaseLayer=r,r=!1):i._isBaseLayer=!1,i.show!==i._show&&(t(i._show)&&(t(e)||(e=[]),e.push(i)),i._show=i.show);if(t(e))for(o=0,a=e.length;a>o;++o)i=e[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)},d}),i("Scene/QuadtreeOccluders",["../Core/Cartesian3","../Core/defineProperties","../Core/EllipsoidalOccluder"],function(e,t,i){"use strict";var r=function(t){this._ellipsoid=new i(t.ellipsoid,e.ZERO)};return t(r.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),r}),i("Scene/QuadtreeTile",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Rectangle","./QuadtreeTileLoadState"],function(e,t,i,r,n){"use strict";var o=function(e){this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._children=void 0,this._replacementPrevious=void 0,this._replacementNext=void 0,this._distance=0,this._customData=[],this._frameUpdated=void 0,this._frameRendered=void 0,this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0};return o.createLevelZeroTiles=function(t){if(!e(t))throw new i("tilingScheme is required.");for(var r=t.getNumberOfXTilesAtLevel(0),n=t.getNumberOfYTilesAtLevel(0),a=new Array(r*n),s=0,l=0;n>l;++l)for(var u=0;r>u;++u)a[s++]=new o({tilingScheme:t,x:u,y:l,level:0});return a},o.prototype._updateCustomData=function(t,i,n){var o,a,s,l=this.customData;if(e(i)&&e(n)){for(o=0;o<n.length;++o){a=n[o];for(var u=0;u<l.length;++u)if(l[u]===a){l.splice(u,1);break}}for(s=this._rectangle,o=0;o<i.length;++o)a=i[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=t}else{var c=this._parent;if(e(c)&&this._frameUpdated!==c._frameUpdated){l.length=0,s=this._rectangle;var h=c.customData;for(o=0;o<h.length;++o)a=h[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=c._frameUpdated}}},t(o.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){if(!e(this._children)){var t=this.tilingScheme,i=this.level+1,r=2*this.x,n=2*this.y;this._children=[new o({tilingScheme:t,x:r,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r,y:n+1,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n+1,level:i,parent:this})]}return this._children}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<n.DONE}},eligibleForUnloading:{get:function(){var t=!0;return e(this.data)&&(t=this.data.eligibleForUnloading,e(t)||(t=!0)),t}}}),o.prototype.freeResources=function(){if(this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,e(this.data)&&e(this.data.freeResources)&&this.data.freeResources(),e(this._children)){for(var t=0,i=this._children.length;i>t;++t)this._children[t].freeResources();this._children=void 0}},o}),i("Scene/TileReplacementQueue",["../Core/defined"],function(e){"use strict";function t(e,t){var i=t.replacementPrevious,r=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=r),t===e.head?e.head=r:i.replacementNext=r,t===e.tail?e.tail=i:r.replacementPrevious=i,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}var i=function(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0};return i.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},i.prototype.trimTiles=function(i){for(var r=this.tail,n=!0;n&&e(this._lastBeforeStartOfFrame)&&this.count>i&&e(r);){n=r!==this._lastBeforeStartOfFrame;var o=r.replacementPrevious;r.eligibleForUnloading&&(r.freeResources(),t(this,r)),r=o}},i.prototype.markTileRendered=function(i){var r=this.head;return r===i?(i===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=i.replacementNext),void 0):(++this.count,e(r)?((e(i.replacementPrevious)||e(i.replacementNext))&&t(this,i),i.replacementPrevious=void 0,i.replacementNext=r,r.replacementPrevious=i,this.head=i,void 0):(i.replacementPrevious=void 0,i.replacementNext=void 0,this.head=i,this.tail=i,void 0))},i}),i("Scene/QuadtreePrimitive",["../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/Queue","../Core/Ray","../Core/Rectangle","../Core/Visibility","./QuadtreeOccluders","./QuadtreeTile","./QuadtreeTileLoadState","./SceneMode","./TileReplacementQueue"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";function g(e,t,i){var n=e._debug;if(!n.suspendLodUpdate){var o,a,s=e._tilesToRender;s.length=0;var l=e._tileTraversalQueue;if(l.clear(),n.maxDepth=0,n.tilesVisited=0,n.tilesCulled=0,n.tilesRendered=0,n.tilesWaitingForChildren=0,e._tileLoadQueue.length=0,e._tileReplacementQueue.markStartOfRenderFrame(),!r(e._levelZeroTiles)){if(!e._tileProvider.ready)return;var u=e._tileProvider.tilingScheme;e._levelZeroTiles=p.createLevelZeroTiles(u)}e._occluders.ellipsoid.cameraPosition=i.camera.positionWC;var c,d=e._tileProvider,m=e._occluders,f=e._levelZeroTiles,v=e._addHeightCallbacks,g=e._removeHeightCallbacks,y=i.frameNumber;if(v.length>0||g.length>0){for(o=0,a=f.length;a>o;++o)c=f[o],c._updateCustomData(y,v,g);v.length=0,g.length=0}for(o=0,a=f.length;a>o;++o)c=f[o],e._tileReplacementQueue.markTileRendered(c),c.needsLoading&&S(e,c),c.renderable&&d.computeTileVisibility(c,i,m)!==h.NONE?l.enqueue(c):(++n.tilesCulled,c.renderable||++n.tilesWaitingForChildren);for(;r(c=l.dequeue());)if(++n.tilesVisited,e._tileReplacementQueue.markTileRendered(c),c._updateCustomData(y),c.level>n.maxDepth&&(n.maxDepth=c.level),_(e,t,i,c)<e.maximumScreenSpaceError)C(e,c);else if(w(e,c)){var E=c.children;for(o=0,a=E.length;a>o;++o)d.computeTileVisibility(E[o],i,m)!==h.NONE?l.enqueue(E[o]):++n.tilesCulled}else C(e,c);n.enableDebugOutput&&(n.tilesVisited!==n.lastTilesVisited||n.tilesRendered!==n.lastTilesRendered||n.tilesCulled!==n.lastTilesCulled||n.maxDepth!==n.lastMaxDepth||n.tilesWaitingForChildren!==n.lastTilesWaitingForChildren)&&(console.log("Visited "+n.tilesVisited+", Rendered: "+n.tilesRendered+", Culled: "+n.tilesCulled+", Max Depth: "+n.maxDepth+", Waiting for children: "+n.tilesWaitingForChildren),n.lastTilesVisited=n.tilesVisited,n.lastTilesRendered=n.tilesRendered,n.lastTilesCulled=n.tilesCulled,n.lastMaxDepth=n.maxDepth,n.lastTilesWaitingForChildren=n.tilesWaitingForChildren)}}function _(e,t,i,r){if(i.mode===f.SCENE2D)return y(e,t,i,r);var n=e._tileProvider.getLevelMaximumGeometricError(r.level),o=e._tileProvider.computeDistanceToTile(r,i);r._distance=o;var a=t.drawingBufferHeight,s=i.camera,l=s.frustum,u=l.fovy;return n*a/(2*o*Math.tan(.5*u))}function y(e,t,i,r){var n=i.camera,o=n.frustum,a=t.drawingBufferWidth,s=t.drawingBufferHeight,l=e._tileProvider.getLevelMaximumGeometricError(r.level),u=Math.max(o.top-o.bottom,o.right-o.left)/Math.max(a,s);return l/u}function C(e,t){e._tilesToRender.push(t),++e._debug.tilesRendered}function w(e,t){for(var i=!0,r=!0,n=t.children,o=0,a=n.length;a>o;++o){var s=n[o];e._tileReplacementQueue.markTileRendered(s),r=r&&s.upsampledFromParent,i=i&&s.renderable,s.needsLoading&&S(e,s)}return i||++e._debug.tilesWaitingForChildren,i&&!r}function S(e,t){e._tileLoadQueue.push(t)}function E(e,t,i){var r=e._tileLoadQueue,n=e._tileProvider;if(0!==r.length){e._tileReplacementQueue.trimTiles(e.tileCacheSize);for(var o=s(),a=e._loadQueueTimeSlice,l=o+a,u=r.length-1,c=u;c>=0;--c){var h=r[c];if(e._tileReplacementQueue.markTileRendered(h),n.loadTile(t,i,h),s()>=l)break}}}function b(i,n){for(var o=i._tileToUpdateHeights,a=i._tileProvider.terrainProvider,l=s(),u=i._updateHeightsTimeSlice,h=l+u,d=n.mode,p=n.mapProjection,m=p.ellipsoid;o.length>0;){var v=o[o.length-1];v!==i._lastTileUpdated&&(i._lastTileIndex=0);for(var g=v.customData,_=g.length,y=!1,C=i._lastTileIndex;_>C;++C){var w=g[C];if(v.level>w.level){r(w.position)||(w.position=m.cartographicToCartesian(w.positionCartographic)),d===f.SCENE3D?(e.clone(e.ZERO,A.origin),e.normalize(w.position,A.direction)):(t.clone(w.positionCartographic,D),D.height=-11500,p.project(D,M),e.fromElements(M.z,M.x,M.y,M),e.clone(M,A.origin),e.clone(e.UNIT_X,A.direction));var S=v.data.pick(A,d,p,!1,M);r(S)&&w.callback(S),w.level=v.level}else if(v.level===w.level){for(var E,b=v.children,x=b.length,T=0;x>T&&(E=b[T],!c.contains(E.rectangle,w.positionCartographic));++T);var P=a.getTileDataAvailable(E.x,E.y,E.level);(r(P)&&!P||r(parent)&&r(parent.data)&&r(parent.data.terrainData)&&!parent.data.terrainData.isChildAvailable(parent.x,parent.y,E.x,E.y))&&w.removeFunc()}if(s()>=h){y=!0;break}}if(y){i._lastTileUpdated=v,i._lastTileIndex=C;break}o.pop()}}function x(e,t){return e._distance-t._distance}function T(e,t,i,r){var n=e._tileProvider,o=e._tilesToRender,a=e._tileToUpdateHeights;o.sort(x);for(var s=0,l=o.length;l>s;++s){var u=o[s];n.showTileThisFrame(u,t,i,r),u._frameRendered!==i.frameNumber-1&&a.push(u),u._frameRendered=i.frameNumber}b(e,i)}var P=function(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};var t=this._tileProvider.tilingScheme,r=t.ellipsoid;this._tilesToRender=[],this._tileTraversalQueue=new l,this._tileLoadQueue=[],this._tileReplacementQueue=new v,this._levelZeroTiles=void 0,this._levelZeroTilesReady=!1,this._loadQueueTimeSlice=5,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this.maximumScreenSpaceError=i(e.maximumScreenSpaceError,2),this.tileCacheSize=i(e.tileCacheSize,100),this._occluders=new d({ellipsoid:r})};n(P.prototype,{tileProvider:{get:function(){return this._tileProvider}}}),P.prototype.invalidateAllTiles=function(){var e=this._tileReplacementQueue;e.head=void 0,e.tail=void 0,e.count=0;var t=this._levelZeroTiles;if(r(t))for(var i=0;i<t.length;++i){for(var n=t[i],o=n.customData,a=o.length,s=0;a>s;++s){var l=o[s];l.level=0,this._addHeightCallbacks.push(l)}t[i].freeResources()}this._levelZeroTiles=void 0},P.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;r(t);)t.state!==m.START&&e(t),t=t.replacementNext},P.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,r=t.length;r>i;++i)e(t[i])},P.prototype.updateHeight=function(e,t){var i=this,r={position:void 0,positionCartographic:e,level:-1,callback:t};return r.removeFunc=function(){i._removeHeightCallbacks.push(r)},i._addHeightCallbacks.push(r),r.removeFunc},P.prototype.update=function(e,t,i){this._tileProvider.beginUpdate(e,t,i),g(this,e,t),E(this,e,t),T(this,e,t,i),this._tileProvider.endUpdate(e,t,i)},P.prototype.isDestroyed=function(){return!1},P.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var A=new u,D=new t,M=new e;return P}),i("Scene/Globe",["../Core/BoundingRectangle","../Core/BoundingSphere","../Core/buildModuleUrl","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/combine","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/EllipsoidTerrainProvider","../Core/FeatureDetection","../Core/GeographicProjection","../Core/Geometry","../Core/GeometryAttribute","../Core/Intersect","../Core/IntersectionTests","../Core/loadImage","../Core/Math","../Core/Matrix4","../Core/Occluder","../Core/PrimitiveType","../Core/Ray","../Core/Rectangle","../Core/Transforms","../Renderer/BufferUsage","../Renderer/ClearCommand","../Renderer/DrawCommand","../Renderer/ShaderSource","../Shaders/GlobeFS","../Shaders/GlobeFSDepth","../Shaders/GlobeFSPole","../Shaders/GlobeVS","../Shaders/GlobeVSDepth","../Shaders/GlobeVSPole","../ThirdParty/when","./DepthFunction","./GlobeSurfaceShaderSet","./GlobeSurfaceTileProvider","./ImageryLayerCollection","./Pass","./QuadtreePrimitive","./SceneMode","./terrainAttributeLocations"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B,z,k,V,U,W,G,H,q,j,Y){"use strict";function X(e){return function(i,r){var n=t.distanceSquaredTo(i.pickBoundingSphere,e),o=t.distanceSquaredTo(r.pickBoundingSphere,e);return n-o}}function Z(e,t){var i=e._ellipsoid.radii,r=t.camera.positionWC,o=n.multiplyComponents(e._ellipsoid.oneOverRadii,r,at),a=n.magnitude(o),s=n.normalize(o,st),l=n.normalize(n.cross(n.UNIT_Z,o,lt),lt),u=n.normalize(n.cross(s,l,ut),ut),c=Math.sqrt(n.magnitudeSquared(o)-1),h=n.multiplyByScalar(s,1/a,at),d=c/a,p=n.multiplyByScalar(l,d,st),m=n.multiplyByScalar(u,d,lt),f=n.add(h,m,ut);n.subtract(f,p,f),n.multiplyComponents(i,f,f),n.pack(f,ot,0);var v=n.subtract(h,m,ut);n.subtract(v,p,v),n.multiplyComponents(i,v,v),n.pack(v,ot,3);var g=n.add(h,m,ut);n.add(g,p,g),n.multiplyComponents(i,g,g),n.pack(g,ot,6);var _=n.subtract(h,m,ut);return n.add(_,p,_),n.multiplyComponents(i,_,_),n.pack(_,ot,9),ot}function J(t,i,r,o,a,s){pt.longitude=0,pt.latitude=o;var l=t._ellipsoid.cartographicToCartesian(pt,mt);pt.longitude=Math.PI;var u=t._ellipsoid.cartographicToCartesian(pt,ft),c=.5*n.magnitude(n.subtract(l,u,ct),ct);pt.longitude=0,pt.latitude=r;var h,d=t._ellipsoid.cartographicToCartesian(pt,mt),p=i.camera.direction;h=1-n.dot(dt,p)<S.EPSILON6?n.UNIT_X:n.normalize(n.cross(p,n.UNIT_Z,ct),ct);var m=n.add(d,n.multiplyByScalar(h,c,ct),ct),f=n.add(d,n.multiplyByScalar(n.normalize(n.cross(n.UNIT_Z,h,ht),ht),c,ht),ht);A.pointToGLWindowCoordinates(a,s,d,d),A.pointToGLWindowCoordinates(a,s,m,m),A.pointToGLWindowCoordinates(a,s,f,f);var v=Math.floor(Math.max(n.distance(f,d),n.distance(m,d))),g=v;return new e(Math.floor(d.x)-v,Math.floor(d.y)-g,2*v,2*g)}function Q(e,i,r){var n=e.terrainProvider;if(r.mode===j.SCENE3D&&n.ready){var o=n.tilingScheme.rectangle,l=i.uniformState.viewProjection,c=vt;c.width=i.drawingBufferWidth,c.height=i.drawingBufferHeight;var h,d,p,m,f,v,C,w=E.computeViewportTransformation(c,0,1,gt),x=.05,T=e._occluder;o.north<S.PI_OVER_TWO&&(h=new P(-Math.PI,o.north,Math.PI,S.PI_OVER_TWO),d=t.fromRectangle3D(h,e._ellipsoid),p=r.cullingVolume.computeVisibility(d)===y.OUTSIDE,m=b.computeOccludeePointFromRectangle(h,e._ellipsoid),f=m&&!T.isPointVisible(m,0)||!T.isBoundingSphereVisible(d),e._drawNorthPole=!p&&!f,e._drawNorthPole&&(C=J(e,r,h.north,h.south-x,l,w),_t[0]=C.x,_t[1]=C.y,_t[2]=C.x+C.width,_t[3]=C.y,_t[4]=C.x+C.width,_t[5]=C.y+C.height,_t[6]=C.x,_t[7]=C.y+C.height,u(e._northPoleCommand.vertexArray)?e._northPoleCommand.vertexArray.getAttribute(0).vertexBuffer.copyFromArrayView(_t):(e._northPoleCommand.boundingVolume=t.fromRectangle3D(h,e._ellipsoid),v=new g({attributes:{position:new _({componentDatatype:s.FLOAT,componentsPerAttribute:2,values:_t})}}),e._northPoleCommand.vertexArray=i.createVertexArrayFromGeometry({geometry:v,attributeLocations:{position:0},bufferUsage:D.STREAM_DRAW})))),o.south>-S.PI_OVER_TWO&&(h=new P(-Math.PI,-S.PI_OVER_TWO,Math.PI,o.south),d=t.fromRectangle3D(h,e._ellipsoid),p=r.cullingVolume.computeVisibility(d)===y.OUTSIDE,m=b.computeOccludeePointFromRectangle(h,e._ellipsoid),f=m&&!T.isPointVisible(m)||!T.isBoundingSphereVisible(d),e._drawSouthPole=!p&&!f,e._drawSouthPole&&(C=J(e,r,h.south,h.north+x,l,w),_t[0]=C.x,_t[1]=C.y,_t[2]=C.x+C.width,_t[3]=C.y,_t[4]=C.x+C.width,_t[5]=C.y+C.height,_t[6]=C.x,_t[7]=C.y+C.height,u(e._southPoleCommand.vertexArray)?e._southPoleCommand.vertexArray.getAttribute(0).vertexBuffer.copyFromArrayView(_t):(e._southPoleCommand.boundingVolume=t.fromRectangle3D(h,e._ellipsoid),v=new g({attributes:{position:new _({componentDatatype:s.FLOAT,componentsPerAttribute:2,values:_t})}}),e._southPoleCommand.vertexArray=i.createVertexArrayFromGeometry({geometry:v,attributeLocations:{position:0},bufferUsage:D.STREAM_DRAW}))));var A=0,M=e._imageryLayerCollection.length>0?e._imageryLayerCollection.get(0):void 0;u(M)&&u(M.imageryProvider)&&u(M.imageryProvider.getPoleIntensity)&&(A=M.imageryProvider.getPoleIntensity());var I={u_dayIntensity:function(){return A}};if(!u(e._northPoleCommand.uniformMap)){var O=a(I,{u_color:function(){return e.northPoleColor}});e._northPoleCommand.uniformMap=a(O,e._drawUniforms)}if(!u(e._southPoleCommand.uniformMap)){var R=a(I,{u_color:function(){return e.southPoleColor}});e._southPoleCommand.uniformMap=a(R,e._drawUniforms)}}}var K=function(e){e=l(e,p.WGS84);var o=new m({ellipsoid:e}),a=new G;this._ellipsoid=e,this._imageryLayerCollection=a,this._surfaceShaderSet=new U,this._surfaceShaderSet.baseVertexShaderSource=new O({sources:[F]}),this._surfaceShaderSet.baseFragmentShaderSource=new O({sources:[R]}),this._surface=new q({tileProvider:new W({terrainProvider:o,imageryLayers:a,surfaceShaderSet:this._surfaceShaderSet})}),this._occluder=new b(new t(n.ZERO,e.minimumRadius),n.ZERO),this._rsColor=void 0,this._rsColorWithoutDepthTest=void 0,this._clearDepthCommand=new M({depth:1,stencil:0,owner:this}),this._depthCommand=new I({boundingVolume:new t(n.ZERO,e.maximumRadius),pass:H.OPAQUE,owner:this}),this._northPoleCommand=new I({pass:H.OPAQUE,owner:this}),this._southPoleCommand=new I({pass:H.OPAQUE,owner:this}),this._drawNorthPole=!1,this._drawSouthPole=!1,this._mode=j.SCENE3D,this.terrainProvider=o,this.northPoleColor=new n(2/255,6/255,18/255),this.southPoleColor=new n(1,1,1),this.show=!0,this.oceanNormalMapUrl=i("Assets/Textures/waterNormalsSmall.jpg"),this._oceanNormalMapUrl=void 0,this.depthTestAgainstTerrain=!1,this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.enableLighting=!1,this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.showWaterEffect=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=.5,this._lightingFadeDistance=new r(this.lightingFadeOutDistance,this.lightingFadeInDistance);var s=this;this._drawUniforms={u_zoomedOutOceanSpecularIntensity:function(){return s._zoomedOutOceanSpecularIntensity -},u_oceanNormalMap:function(){return s._oceanNormalMap},u_lightingFadeDistance:function(){return s._lightingFadeDistance}}};c(K.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}}});var $=[],et={start:0,stop:0};K.prototype.pick=function(e,i,r){var o=i.mode,a=i.mapProjection,s=$;s.length=0;var l,c,h=this._surface._tilesToRender,d=h.length;for(c=0;d>c;++c){l=h[c];var p=l.data;if(u(p)){var m=p.pickBoundingSphere;o!==j.SCENE3D?(t.fromRectangleWithHeights2D(l.rectangle,a,p.minimumHeight,p.maximumHeight,m),n.fromElements(m.center.z,m.center.x,m.center.y,m.center)):t.clone(p.boundingSphere3D,m);var f=C.raySphere(e,m,et);u(f)&&s.push(p)}}s.sort(X(e.origin));var v;for(d=s.length,c=0;d>c&&(v=s[c].pick(e,i.mode,i.mapProjection,!0,r),!u(v));++c);return v};var tt=new n,it=new n,rt=new o,nt=new T;K.prototype.getHeight=function(e){var t=this._surface._levelZeroTiles;if(u(t)){var i,r,o=t.length;for(r=0;o>r&&(i=t[r],!P.contains(i.rectangle,e));++r);if(!u(i)||!P.contains(i.rectangle,e))return void 0;for(;i.renderable;){var a=i.children;for(o=a.length,r=0;o>r&&(i=a[r],!P.contains(i.rectangle,e));++r);}for(;u(i)&&(!u(i.data)||!u(i.data.pickTerrain));)i=i.parent;if(!u(i))return void 0;var s=this._surface._tileProvider.tilingScheme.ellipsoid,l=s.cartographicToCartesian(e,tt),c=nt;n.normalize(l,c.direction);var h=i.data.pick(c,void 0,void 0,!1,it);return u(h)?s.cartesianToCartographic(h,rt).height:void 0}};var ot=f.supportsTypedArrays()?new Float32Array(12):[],at=new n,st=new n,lt=new n,ut=new n,ct=new n,ht=new n,dt=n.negate(n.UNIT_Z,new n),pt=new o(0,0),mt=new n,ft=new n,vt=new e,gt=new E,_t=f.supportsTypedArrays()?new Float32Array(8):[];return K.prototype.update=function(e,t,i){if(this.show){var r=e.drawingBufferWidth,n=e.drawingBufferHeight;if(0!==r&&0!==n){var o=t.mode;t.mapProjection;var a=!1;this._mode===o&&u(this._rsColor)||(a=!0,o===j.SCENE3D||o===j.COLUMBUS_VIEW?(this._rsColor=e.createRenderState({cull:{enabled:!0},depthTest:{enabled:!0}}),this._rsColorWithoutDepthTest=e.createRenderState({cull:{enabled:!0}}),this._depthCommand.renderState=e.createRenderState({cull:{enabled:!0},depthTest:{enabled:!0,func:V.ALWAYS},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}})):(this._rsColor=e.createRenderState({cull:{enabled:!0}}),this._rsColorWithoutDepthTest=e.createRenderState({cull:{enabled:!0}}))),this._mode=o;var l=this._northPoleCommand,c=this._southPoleCommand;l.renderState=this._rsColorWithoutDepthTest,c.renderState=this._rsColorWithoutDepthTest;var h=Z(this,t);if(this._depthCommand.vertexArray)this._depthCommand.vertexArray.getAttribute(0).vertexBuffer.copyFromArrayView(h);else{var d=new g({attributes:{position:new _({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:h})},indices:[0,1,2,2,1,3],primitiveType:x.TRIANGLES});this._depthCommand.vertexArray=e.createVertexArrayFromGeometry({geometry:d,attributeLocations:{position:0},bufferUsage:D.DYNAMIC_DRAW})}u(this._depthCommand.shaderProgram)||(this._depthCommand.shaderProgram=e.createShaderProgram(B,L,{position:0}));var p=this._surface,m=p.tileProvider,f=this.terrainProvider,v=this.showWaterEffect&&f.ready&&f.hasWaterMask;if(v&&this.oceanNormalMapUrl!==this._oceanNormalMapUrl){var y=this.oceanNormalMapUrl;if(this._oceanNormalMapUrl=y,u(y)){var C=this;k(w(y),function(t){y===C.oceanNormalMapUrl&&(C._oceanNormalMap=C._oceanNormalMap&&C._oceanNormalMap.destroy(),C._oceanNormalMap=e.createTexture2D({source:t}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}if(!u(l.shaderProgram)||!u(c.shaderProgram)){var S=e.replaceShaderProgram(l.shaderProgram,z,N,Y);l.shaderProgram=S,c.shaderProgram=S}this._occluder.cameraPosition=t.camera.positionWC,Q(this,e,t);var E=t.passes;E.render&&(o===j.SCENE3D&&(this._drawNorthPole&&i.push(l),this._drawSouthPole&&i.push(c)),this._zoomedOutOceanSpecularIntensity=o===j.SCENE3D?.5:0,p.maximumScreenSpaceError=this.maximumScreenSpaceError,p.tileCacheSize=this.tileCacheSize,m.terrainProvider=this.terrainProvider,m.lightingFadeOutDistance=this.lightingFadeOutDistance,m.lightingFadeInDistance=this.lightingFadeInDistance,m.zoomedOutOceanSpecularIntensity=this._zoomedOutOceanSpecularIntensity,m.hasWaterMask=v,m.oceanNormalMap=this._oceanNormalMap,m.enableLighting=this.enableLighting,p.update(e,t,i),(o===j.SCENE3D||o===j.COLUMBUS_VIEW)&&(this.depthTestAgainstTerrain||(i.push(this._clearDepthCommand),o===j.SCENE3D&&i.push(this._depthCommand)))),E.pick&&o===j.SCENE3D&&i.push(this._depthCommand)}}},K.prototype.isDestroyed=function(){return!1},K.prototype.destroy=function(){return this._northPoleCommand.vertexArray=this._northPoleCommand.vertexArray&&this._northPoleCommand.vertexArray.destroy(),this._southPoleCommand.vertexArray=this._southPoleCommand.vertexArray&&this._southPoleCommand.vertexArray.destroy(),this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._northPoleCommand.shaderProgram=this._northPoleCommand.shaderProgram&&this._northPoleCommand.shaderProgram.destroy(),this._southPoleCommand.shaderProgram=this._northPoleCommand.shaderProgram,this._depthCommand.shaderProgram=this._depthCommand.shaderProgram&&this._depthCommand.shaderProgram.destroy(),this._depthCommand.vertexArray=this._depthCommand.vertexArray&&this._depthCommand.vertexArray.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),h(this)},K}),i("Shaders/PostProcessFilters/PassThrough",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Scene/GlobeDepth",["../Core/Color","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/PixelDatatype","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s){"use strict";function l(e,i,r){if(!t(e._debugGlobeDepthViewportCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\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";e._debugGlobeDepthViewportCommand=i.createViewportQuadCommand(n,{uniformMap:{u_texture:function(){return e._globeDepthTexture}},owner:e})}e._debugGlobeDepthViewportCommand.execute(i,r)}function u(e){e._colorTexture=e._colorTexture&&!e._colorTexture.isDestroyed()&&e._colorTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&!e._depthStencilTexture.isDestroyed()&&e._depthStencilTexture.destroy(),e._globeDepthTexture=e._globeDepthTexture&&!e._globeDepthTexture.isDestroyed()&&e._globeDepthTexture.destroy()}function c(e){e.framebuffer=e.framebuffer&&!e.framebuffer.isDestroyed()&&e.framebuffer.destroy(),e._copyDepthFramebuffer=e._copyDepthFramebuffer&&!e._copyDepthFramebuffer.isDestroyed()&&e._copyDepthFramebuffer.destroy()}function h(e,t,i,r){e._colorTexture=t.createTexture2D({width:i,height:r,pixelFormat:n.RGBA,pixelDatatype:a.UNSIGNED_BYTE}),e._depthStencilTexture=t.createTexture2D({width:i,height:r,pixelFormat:n.DEPTH_STENCIL,pixelDatatype:a.UNSIGNED_INT_24_8_WEBGL}),e._globeDepthTexture=t.createTexture2D({width:i,height:r,pixelFormat:n.RGBA,pixelDatatype:a.UNSIGNED_BYTE})}function d(e,t,i,r){u(e),c(e),h(e,t,i,r),e.framebuffer=t.createFramebuffer({colorTextures:[e._colorTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._copyDepthFramebuffer=t.createFramebuffer({colorTextures:[e._globeDepthTexture],destroyAttachments:!1})}function p(e,i){var r=i.drawingBufferWidth,n=i.drawingBufferHeight,o=e._colorTexture,a=!t(o)||o.width!==r||o.height!==n;(!t(e.framebuffer)||a)&&d(e,i,r,n)}function m(i,r){if(!t(i._copyDepthCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";i._copyDepthCommand=r.createViewportQuadCommand(n,{renderState:r.createRenderState(),uniformMap:{u_texture:function(){return i._depthStencilTexture}},owner:i})}i._copyDepthCommand.framebuffer=i._copyDepthFramebuffer,t(i._copyColorCommand)||(i._copyColorCommand=r.createViewportQuadCommand(s,{renderState:r.createRenderState(),uniformMap:{u_texture:function(){return i._colorTexture}},owner:i})),t(i._clearColorCommand)||(i._clearColorCommand=new o({color:new e(0,0,0,0),owner:i})),i._clearColorCommand.framebuffer=i.framebuffer}var f=function(){this._colorTexture=void 0,this._depthStencilTexture=void 0,this._globeDepthTexture=void 0,this.framebuffer=void 0,this._copyDepthFramebuffer=void 0,this._clearColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._debugGlobeDepthViewportCommand=void 0};return f.prototype.executeDebugGlobeDepth=function(e,t){l(this,e,t)},f.prototype.update=function(e){p(this,e),m(this,e),e.uniformState.globeDepthTexture=void 0},f.prototype.executeCopyDepth=function(e,i){t(this._copyDepthCommand)&&(this._copyDepthCommand.execute(e,i),e.uniformState.globeDepthTexture=this._globeDepthTexture)},f.prototype.executeCopyColor=function(e,i){t(this._copyColorCommand)&&this._copyColorCommand.execute(e,i)},f.prototype.clear=function(i,r,n){var o=this._clearColorCommand;t(o)&&(e.clone(n,o.color),o.execute(i,r))},f.prototype.isDestroyed=function(){return!1},f.prototype.destroy=function(){u(this),c(this),t(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),t(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy());var e=this._debugGlobeDepthViewportCommand;return t(e)&&(e.shaderProgram=e.shaderProgram.destroy()),r(this)},f}),i("Scene/GoogleEarthImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/loadText","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e,t,r,n){var o=e._imageUrlTemplate;o=o.replace("{x}",t),o=o.replace("{y}",r),o=o.replace("{zoom}",n+1);var a=e._proxy;return i(a)&&(o=a.getURL(o)),o}var f=function v(r){function n(e){var t;try{t=JSON.parse(e)}catch(n){t=JSON.parse(e.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(var o,s=0;s<t.layers.length;s++)if(t.layers[s].id===_._channel){o=t.layers[s];break}var d;if(!i(o))throw d="Could not find layer with channel (id) of "+_._channel+".",f=c.handleError(f,_,_._errorEvent,d,void 0,void 0,void 0,m),new u(d);if(!i(o.version))throw d="Could not find a version in channel (id) "+_._channel+".",f=c.handleError(f,_,_._errorEvent,d,void 0,void 0,void 0,m),new u(d);if(_._version=o.version,i(t.projection)&&"flat"===t.projection)_._tilingScheme=new a({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new l(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:r.ellipsoid});else{if(i(t.projection)&&"mercator"!==t.projection)throw d="Unsupported projection "+t.projection+".",f=c.handleError(f,_,_._errorEvent,d,void 0,void 0,void 0,m),new u(d);_._tilingScheme=new h({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:r.ellipsoid})}_._imageUrlTemplate=_._imageUrlTemplate.replace("{request}",_._requestType).replace("{channel}",_._channel).replace("{version}",_._version),_._ready=!0,c.handleSuccess(f)}function p(){var e="An error occurred while accessing "+g+".";f=c.handleError(f,_,_._errorEvent,e,void 0,void 0,void 0,m)}function m(){var e=i(_._proxy)?_._proxy.getURL(g):g,t=s(e);d(t,n,p)}r=t(r,{}),this._url=r.url,this._path=t(r.path,"/default_map"),this._tileDiscardPolicy=r.tileDiscardPolicy,this._proxy=r.proxy,this._channel=r.channel,this._requestType="ImageryMaps",this._credit=new e("Google Imagery",v._logoData,"http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"),this.defaultGamma=1.9,this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=r.maximumLevel,this._imageUrlTemplate=this._url+this._path+"/query?request={request}&channel={channel}&version={version}&x={x}&y={y}&z={zoom}",this._errorEvent=new o,this._ready=!1;var f,g=this._url+this._path+"/query?request=Json&vars=geeServerDefs&is2d=t",_=this;m()};return r(f.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),f.prototype.getTileCredits=function(){return void 0},f.prototype.requestImage=function(e,t,i){var r=m(this,e,t,i);return p.loadImage(this,r)},f.prototype.pickFeatures=function(){return void 0},f._logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAAnCAYAAACmP2LfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAHdElNRQfcDB4TJDr1mp5kAAAAGnRFWHRTb2Z0d2FyZQBQYWludC5ORVQgdjMuNS4xMDD0cqEAAB1zSURBVHhe7ZwHeFTFFsf/u+l9N70npOxuSAKEFFIhCSH0qhEQUHkgKCgWUFGBB6IoCAoo0ntooaRvEkIIBBBpoYSa3nvvfd+5u4sQUigPfMX8v2/Y3Tkzs3fv/d0z58zcgF69Ql1SY+MM1wQJem44ZeiJk8beEOqPwG6uC7ZqyElb9eo/JZEIkH2nRQkBIlNMauuPCS3uGN/kjkmNDghoskBAgzrZ2NLmf1+JwIKQpYsoxdmIV9+N07onCegzBPM9bOdmYKnazF6g/1N6UySPqSJzvCaaiLHtP8G/Phq+FRfgU5ogKWUXMLT6Mvzqr2BE40mMadqO8c3zMabBC6PqDDC8SlY60t9HByCLVTKu+ERmHr5TWI9wjVxEaOZivWo1pil8D1tZeWnLXv1l8iZ3PF2kjymiWRgvCoJv5U243IyAXcQq8A9Mg9W+4bDe6wv+kVGwCZkL+4Sf4ZR+BZ5VGQR3EkbWn8Hopm3wq54Lz2JD6ah/P21XGopQ9Qoc16jGSqVyTJWbQbUsibFXf42mihTwZpsvAtp3k0dOhFOSEH1+ngaDefrgjFCgFkxY8fCisCBvKgODzxRh9qslBFGfYmDGLbiV5mBwRRo8KtPhVBgPu8teMP7u73chD6kMRYRGBY5xqrFKqQwz5SdTbS/Qf5mmUYw8rf01CjHC4VP7AHZxO6E3qy9ZZCQNnio2rE/4o9/tkxiQUYp+KRXgx8XC5FsXcLz/hkCrDUU4pxLHuDVYpdwL9F+qqSJZKlPwenskfOoI5tN7YPCJGVme7wKYr5EBXzgYfW+mwTI0Gjrznaj2WW+I/y8dVPdDGLcKRzXrsEqlHO8oTKHaXqAZWe9hQXCi63NhHWYI3ilfWIW/YLjqL2JRiOFBJRz+LffhcPs09D+0J8vzn3zXdBnYnp8Mi6NboTWzH9X8fVc+DhDQodxqAroe36lU9AJNWr4cEAjNwI8OAC9cT1rbUfzwGeCfKiL7dGnNc+q1NiO80b4BY1oT4V6WDcsdc6j2xbyq4wMWrA9rQmeWFn36ey/jBaoPQ4hmLYI0G/AtAf22fC/QDols8ITrIYi/Bl6knbS2o3gRbxHQxQQ0k0S/gCa2v4OJovPwacqAQ1ICjL40klr+UrWoQbFBETo18jCpZsOoFODkvuCNJYoHW3QKXFEM7ETRcKfiQe8d6NVIFImXvg4skhY40mxnQYVRIIeA1qrHEc1GrFSpxFtP99AiFbDbNKDZpAzzGkVYVcvBuBJQEo/9/6C+dyjPitwLwak74D8V6Bfw0P5VShjXFoTR7TfhUZkL29M/wfATJan1lauWC3aDOgyaVDCuTgbf1bFkfmtkye1ogsK2asivLYfCglIoD8qCknI2NHuG4QSVGMgQyMbt0fioRYh9VYcRU7QX55uDcaHtFOJEsThMtmWtQgxsDodsWaC0c3ea3MzGBJEqxrfbYmzr6xjfPAeTmt5HQPO7eK1xDibUz8eY+k8xtHYJPCtXwvHOu7AXMrMTsF/TH8HajTis1YwVqpWY0TXQDKy1OpBr5EJA52Fukxx+bmKxtjWx2DuaWawNlZD5qhzyo9KhpHAbKpJO/6t65UCPbPHA2PYrGNacgkElabCJJDev/MpDhUKKnuq44LRoYEK1IiswkS1zYCfk5y+F0qjvoTwqBOof34dGeAnUL1ZCLboEnJ9zoe0QD/Nuj00UBVXRabzVLETM3S0ICfwA8yc7Y6C3ANYbZsA7aQ1W1xzEfZEQ6dT2BkG9pP4ouo7jGE1u42JS20QMrzkCr4xwuN4+AM+cYII3EaNar2J86zmMrP8DHulCON4NhU3YWuhOYy6SZENpH9cfx7WacFC7BSvUqjBDsRPQIiugURvazeqYVaqAw6dYrJ9WQy7gayj4nYDy3HtQOVQGpYRqKEWXQf2HdGha/AFdae9Xr4czz0ubISRA75ECbSut7agegO75OLxpahze8j5GtifBpzEDLiV30Dd2mNT6StWiCbVmLt5rUkBQCEt2zWzIMSA8HgrIBkLD+Sp0jhHISYXQ/KMYukfvQ3fQxq68XCTBHId/tMTg7LV1CFs4BszJ6hBarBgHlcRv8H7tbuSKQpFPYGe0BmND+nZ0npECaPKf0r4UIxsuoF/IMpitsAVnrA4s15uh3x8fwLXkLobUZGJIXTqcUzbDaJE5FAVq0t4S7dEcjqMEc6B2K5arVWN6Z6AbdOmm5mJelQKOHWSxF44Cy4CqxW0s6RwchCovFRohdGNfLgX3WiZ0N4aD++y7jfwYJUrAPCle/ZjKV+BFTSegrGAZIm3QjXhBytTWB3zhByzryMUU986jz16wD+96ijCNUIAgmkc3tS6G7GERjCbgR82B4OTbEESqIiCIcqsIYzoGGyrBEMSmgh8xBoIIAR2fAHZhj8Z9DOhl9FHeKkSDvn809fuc+iyCddRYaiOZBTvIt1YJfs0b4N+WDO+GHPLQN2Ab7S61vjJV60C9SRPvNSqzTpxlyQfS1dGUmjppK7gW16B/LhN6abnQu5cDwzO3YNhhqqK4WJY887sEdGzWFpxfOxmDpKZOOvgWFB8sx9L6nShvP4FyUQjKGg5gScpGKEqbUE7RxiGYv6QQ4zIG/r4D2m88sjEy/EIW/a6+TQ4gHe5VhXCvy4JL7gLYnesI2i6t4Tii04r92u1YKt767gB0ozrkGzmY26zEOh7Hkt+kAKhLTX9qOVVdg9aoNOjcToR+wUVKLYKgN0Zq7l7884wn9CKgr4AfWw/B6SwqKQRKOdXVghe9CpbherASSjtIpGpxRIHFjwygNreoXy0lb+lU7lHJBP9kPcGXQnBNghUB/Lh44fbUp5JA+5Hs71LbPPLCVRDEJZDNGIJgeQI6mG6KegKzldq1U7tGKjQmHR8vwl86kgRoAQN0xBw6ztn0nQ/ocxEdQ7L4d/BjG6g+m8aZTL/xsXPuW82Fb8t+DG1Ox5D6XAwqvQ67OA+p9ZWoUQPsei78mjSwNU9GLmEzVGZJTd3qFPTn3YZhXgYMMjNhlHsDxms/hNWfoUdrNPgEc2h7BG5d/Bo7Blt0BuNxXf4MVmXrkdRyEHWiY6hr2oc7mevRX2wc18gioEeI1+N9a+/CNnImVAZ0mhEoNOPAJT8MHjUF8KTiWhqHgbfMpVaJdhLQh3XasU9bJAZ6ekeg6zQwgEKuLSWysmd3QGmatLqD8qDNug3dCX/AIPk4jGr2wDB/JXTmkan70IvmZTY/rB9BdZlKLkG0lG0d5klAObKsw1+jzyFiWPnRawiaDrMYwTyMwMwh220WP2IWFVfqN4CKO8E3n0C6R/ZUej9Y2kUiMdDRFTRePH3nA3q/m7xpAEtAXl0QrkTwscnmS/3eptdzNEYevZLnZ5booqk8tuYs9tAny+n1LL1mghezlcULH0VtHamOZhvhIvoNOXQsd2EZIbluYnlWaMO75TCFG9kYXJ8H14o76H/10Z3yClSrCm6jGtbWK7LC7kIlYRfUmY2XHnUa+mbXYRSfCuNCptyE6b1jMBD/EPKwchQPLxGdxOWWI8iKXYBPqLozgI8pfA5YBWvxbfMeNLUfRmPTLjRnr8YKsdGvRQ5j2zZTSSRQ78H+7GhxfScFAINypsG9ukDspZ0LKKE+O0pqlGi71ggcIqD3dga6RhFKjSqYT+VEFkvu/E9Q+HNWKaE2VVDgVkPFqwAaay5CN3En9M59BM2vfKDs7AvljjPGE5LlharQdL+LoCmhOHU0rIUyD+NgVTOa+q2iVQiIcAKpHtbhXuJOjPqeVCRYThNE6VTvKNs3hM3cHGIxntxKyCbP7Erj1lHZJbVIJAG6iiCroZCAPGukvOyASJbvCgoaAoKoAQ1kHcGC7nmZDkmhBR2PfSQLtkcl4zCSAE2eO6qExYuYxrE4KqdvelBiM4+ncYQy1IY8d0wbhUSLJAZGbsUceNYdwJCGPAyuy4NbZToG3JoO1Qk9AvHvqF4ejo0KCKlisyl04Jw+AE1ma71HRUJP+QqM1t2HcVEyTEoSYVYQCuN3HenCt4XDhGA+KorAnYZ9KIj5ELOl3XpU/k/wrt+OmraDaG7cjpacbxFvYAAZDG5Vw/DWCxjRdp+ATsWAS6+D69H1+XDNsoVb1T06b0VwzCmBIOYdqUWibTojcFBH1CXQctBtUcA6Oh/RmVC4sBmKA5j6erC1qqE4sRpqG25A43QIOHuXgvOmP5R4ZH6m5UY2L9SSLjZ5sKjjsI/o8olH8ngjCZoSgmw9DMIl3t42Up0g+pq89/sEjLK47knZhSkSuDepJP4JOyNJyEFAR8VQKMOR1nbWM69yxNJYwh+VLE90ffPyxLE3EwL9Jq0huWQqwL1iA7zq8+FVl0+epgBO6T+gb2TH+OglqgastxtZrNNlkLt8E5oJx6HZdab7mFZBk3UZRjMewCT7HkzLfodZxREYr5sBjiIBPYiAPt8ehvSGPSg5vwjzpd16VNkmmDTswp22QDTXbkJrxhJkzHGDFoUQmvBpvo2hrZl0TnLhlLIYfUO7nt7dSg3hURcP1/JiDEgphuXBqVKLRFsfA3oJAf3mI6Cr2OjTwGYdqWGzzmZD6WoYVCfehdqsZKjuuwS1oB1Q+5piHac3oaxBzZ9vLZ4nHEeesoXg6niDPSYWP9yUgD5PHu48eKE64krHcErchHIEuRysTpAXjObQWIYEHiV4EQYEojp5aEoyY+IIpOQugKYYOnIdJXrdJ63PtWwXMQM6m6SVT4gfZkbHV0XHsVtaQ3K8yoJr0YfwoHDDq5ZiQSqDik/B4Q9taYtn18gyNia1qGJsmTrGlUjK2FJ1jCjRwOASDnkxDvN95ZD/og5yl0qgfCMJ2leDoeksHaFHXYOJVyrMkm/DrPwMzGr2wmjnLGipthyHL0W7t9pDkduwF2U3lmGFtvbTdyirt0OreT+iWwPRUrUBbSkLkT/fCUZwKVYikBMwpDlPXNzLwuAQ2rWX8KzUh2dDDJyLSmB7/S5Mf3WRWiR6CPSezkCXQs6qBnLCKsheyoXqnTCoL9oOFd9/Qtl9KJT6UJMX3/zhCz8iuCjhiviSYtMx3ZTJBN8lCE7eIRgF0p6krRRaRBDskTTGySBKws5SuUjJHYUiMQdpzCUE0Q3y5MnSDhJJQg5JUvjSgO5hHZofaioGmvc40IycMgbRtJktjgOZ5Ma9irzSg46xYHcaVEZevkgBHqUWGFK+FENKQ+BdGAq/wiMYWbwHI6h4FwTDOes0BMKFMHxPNg9qn1dANakYanfuQSs5FJoTpaP1qBswsSGgb9+EeUU0Af0LDH4dBhXlmv3wajuOpPYQFDcEojxtNQ6sn9ZzUsiofjfUWg/iYOt+tJatRtvN95DqZgxNuKTKwLV4Jdyqc8Wz1uCGTLjmDIVDQqewQ8anwpJi6GsYkF4Ey2O/QvsfXKlJIgboAwT07s5AZ0G1TylUIsuhdKMI6vcuQ3PVAqg+9UZ8JvGEywiuNoIwD4IzaV2X+HSa1otgE3+NwJImVkycG0kx8snfyUZJW+QFApeSu+hN9BpIn6n+ZBp9bqDv+C8Fum+8IpzzJNOmR3UhTaGFcC07iAHXmamuZw28C/S/aIt+CcthF7+ToN0EQdhqOFzcBu/Sm/ApvAGX3DzYXIiF9jtWTJf74L6ZC83UfGg8SId2xnloSZKxp+gWjC0J6KSrMK8KhmnlSugtInpkCzaBV78Hl5oPoaLpECrLt+Bi4jfgS7t1q+YDUGsPwj5KDFsLlqD97JuIpmpZmP+TftM1ezjlxsOllM4H3eReDWHwKrOBW84jqMeK5OBTv4Bu6HxxgqU1s/N3MkAHSoH+ioCe+gjoJHB0s8ENLID6/UJo3E+GVlwoNEwY278tXhR50RhmeexzgmM8JXjdF36MHwEoiXn70Csv6gxBm8PiRc6gJFD1HDzFpq1cP0omo5QJZAfqQzH0f6uHZjQgeR4cC/IJZCnUtSkYVPAWBiX2/CdU/S7Ql+9TgtFCTaiP0qAEXA2yRsqwuzECziWZcM4tgv2DSljF7ID+l+JNh9+hY38HuvcYmLOhk5EEnVPfQOmpW+33YGaXhj53E2BWuxvGebOh5cPUX/sWSgXrsa9mB2qaDqCK4C7I2IA3jn8u7tat2g6D034MIbWb0fZgHlr2DscXUhNNuYdkYRPrg/7JiXDMLYBrZS6GNEZgVJM/JjWY4I16G4xr/BCDq2nKjjoAvY+Zpwo7eXBskQK9Swr0lEdAn4a2wk3o/DMNWmn54KYUQIuZsebGQuXFQ42H4kfNk4QckSOkNZ1lGkGAUoInOKkAm2jJsVtH+om9Nj9ytZxNcNdhljXByo+JJXj/i4G2u2xM02YInPJLxFB7VudTPH0ZHkWu0hbPpwHpfnAszoFDVgVsb1fDMmoL9L8S7wTFQE/1AvR33oB+QSp0czKgl34B2iO9uwJCKib5SGaZjbqLPlkhMG1YDr1gQyioSs24vQTDitagsnIL6loCUVu9C2EJK9FjYtsWBNP2Q7hb9A155zdwY5mTeGexo0w32hEcy2F7JQaOqZfgk38KY6rDMKFBiGHNt+iGPgCNYd0/s/sbAb2fgN5JQC9Wq8bkR0AzioOOx3Xo30mGbnY+tNMKoJOQCm03qfnFxRf6E1yUFAqZJcyuZRWuQmB+TWHJcgJfkjPxImcSSIUsXviMx/O9DvqfALrPDjb6nhuBAWkZ5JFKKTYuIqhz4FUdAo9CGwzO7Ra2LjUg0w9OxdlwyKxAXzHQm8lDi4HeAT1WMPSHnYXR7aswKE6Gfl4K9PdfgZ6+uG8XSmMbKyXD/LsEmFduglH2NHA7rA3Hvg+Ve1/gYO4KNFRvQUPLQVRU7MG4yn1dJ4eiULAo3JhW9xsa77+Hml8GY8FQ425uAM5wRRivNoPlTjs4XhoH35oLGFZ/S/wglyDkbWmrrsUAvY+A3kHlSwJ6ihKzCvLnuQyElmIs9LdfhmHxA+jn5kI3jcrRFOjxU6DTbTx9DybsOBh0f034EeYEVyaFD0IYhnQ9y1pTIsiPvU5AnKYkUBL78yKmQhDLgDRPSWtPp/HFkFtHqFCfRBr73wX67qsD+qFsEubCnqKBAZllcCkkT12RjSHVMfApH0bJXfcH+aQGZg6FU1EWeeoK2NwgoMM3Q++zP/fq/Smf2g392ZEwzk2Acfl9GBHURmuSYPyn132oHBizH8B8wjX0SadQI2cWtOZZQbHTdEgRn8XN93EiczFayn5GU3Mg7lJMPab5SEeoCWZZ0TF4Ne/A/ZSPUbXdDz9Qdddrrk/KtcwR7jX34VXDzGCFGFT0GzyLu922x069kdiv145tOu34jlOHBWoz4arUAZQt0LYOhmFcHJ2H6zAsYnZDc2FwKhv60+m9UQrLUJ4hSYQAVhpM1O6jj30EDD33Q6frZyoY8cMVaWZZR560kuB5V9H6iVUas+Py5L1/IHsT2ZldR4nEkMdkUd8Y8tYd43mLIMhYhenDWvgjQSQiGFOkiEv0rEAzK2u8yG10M2WwBWFdb6q9NKDNd6rCOuYD9L2VI/57QMfcEniU5cCnJgG+lR9haAnz4MzT5ZjmA4e8HBqnGtYXamF+nK7bpx0uwHxoqGyE3sKD5HHjYVJ1C6Z5qTD5Ph2G1hnQEV/0LBhxU2E+4yYsbgTCJGsuNBfYQrnjA0CPxDo2CRYJ0xGesgD1ZWvQ3LQbKeSJ54uC0UcUDVVRGExFR/FB2y7cSf4C+Zv9sXSUeQ9P2z2pQdnmBHQsPKqKqFCyWJsM75o1GMw8O/iEhFZs/KK9CD9wRfhCTYTP1dqwnBOHrQYz8IuuH5ZxxI/MLQZH5kfoeu6D4cVQGNecgXHFbRgXZsD4Xg5MjqfDeE0KTBbRDLXsLiwOR8HkxCJoOs+Eavdr08ZBBGdYP7rYzAZILsH3LYUYtgSsAXlYRwLqW0r8Ksl2id4/Onaz47IE+kayUfwddYhsgwkqXRrLgOpHEuyhVF9B7ytoTAL//qNjeFagGfGEi5nvYPEifqOx/ek4p1J/8aKBWC8N6Icy2+oL6zOhECTmw46SuoHZpXBn/pK7/DK8K1bCp3Q0vAv7wqfIBD55OuS9teFVYASPfAFccseThw+E4Ho5LOMqYB6ZCeOdK6H1bleJH2sOOPZradqlC3otDqY5F2GafQmmCZdgFnMBZteEML2yCnprh0CZWVp66gbDuD5Q2uSLUacm43jSB0gq+h55JeuRX7wRqUUbkJL8DS4GTcPqCdZgduZ6XiZjgvcp9fIY3aAH/yY+3KvcMDBjLSXQBXDML4VbaQG8a9PgUxcOzyIneKY/Or6FHDO8q7INY+RiMFJaJijE4i2VeEylej/FDs99TAPH8Dvofv8bDK/vhVHxMRhX0W+vOgXTijiY5UXANGkNnYeRUGN2VrsPNx6XVaQNgRNM03sBgUjeOKJJ/Cr+LNzFsg61YB5/elyKtic0qM031CaZAG0gqJnVEuYBIoI49gy9D6DXrQR3GoU2j3YE+WE2FI9TGBG1FLywnhNbPt1Y/OhY+o5iGqsGNmdLaVxfqZUB+g0Iztwi2AOkNZ3FCzOm30bHeHK9tKYHKfPZMFhlAtM9c2EpjALv93zY3qlE/8xyOOUVUTiSBrfy83CvDIdbRZC4uJSGwzHzd0qgkmEVfRnGW/dC79vPobtkFLRmm0HDpVt43MnrzoOm/dfQeeOf0P3wB+guJogXrIDuhHfAsdOFbKdQ5GkaYQbNNYNht2c8/AOnYNKB6Ri//Q14zRwIuohdPC76pCbWKGFCkx9GNC7B0NZD8CiJh8Odi7A59zud7EuwvU4hVUYZBhUXwqsqA56V0RiUM1Dam36UoiyFuprQhc6fRZuKKhV5+rcLKD2hrPQ+NPsvgNb0j6C9eCG0v/kU2l9/BK0ZM8EdRJQ833noG8Qib6lDkA0lYD6i8GIJlffZ/IhhbJtQjW4TP164EiWWztTnH9T+a4L/MxpjAn02hWWYDAQnefSZzm7Io7zDOpiSzGh3grwPwd3zDccPZdH4phBEkXcWBrD4wlE07qObw5pmBUGsK43T/YPfgmAFWEe5U2EeCXhGcV5nQ3u2KrTf6w+jdTNhtud7mB/ZC4vg43QAwbAMDYLF0e3os+8HGP80D7oLx0F9dD+oj9AGZ4Y85K0Yj/Vs3kQiFgeybFPIySiDzdwAz9O3JzHjPNtYk8gjv948FOOatlGodR0Dk07Bau9n0F8wFBp+luBO1CXeuDD51Q3830PRP7UIzgUlcC0vhHPRSdic6eI53ecT3W0sKyjI2EFRxhzyz3sOO8voBkEUTclYhAyshCwr642PR79diwlbBOEs8vLMFjgbbuelhpeoz5rEDxsNNl/+9ON5RWJOLsXCysQdh5IhWWbzhUmoel6v/l/RxGpZTKgbh3EtEZQMp5AX2ASd2f3AVu7695ky/7nOuc2U/BZSCFIGp+I82F/rfprsVa/+Mk0sZ2F0tTvGNZ+gRO8B7C/HQ92beWine+/IDWDBbJUmbBN/hUNOGRyyStH34vfQeP3ZV4R61atXIu9Kefg1rIB/XRJciwso9nymLXmxbP+wxcCsVAxIKwfv1AZoDH96jN6rXr1SuVeowKsuFINrs+BSXATbc59JLU/XwCwdDMw7B/vUEpgHfQYZ7v9HCNar/2E55ynDpSwYrhXF4uKUeQiY0/Oy3kM555nCITcJgmvp0F30Yo8L9KpXL1X9E2XhkPoVBuYWwbmolKDOhmv+WHiXyGNkgbTRE1pOublXkRycCz+AfUoRzPdsgKJN1w/19KpXf7n6xlnCPikE/SkWdswrozDkNoZUfIWhFTYYWaPy4a6NkgSR2XAZXSOLIWUWcCv7FP1T7sH8wFZwp7ycxz971auXIm4AG+b77MFLEKLv7ULJMy0FefCsPAOv0t0YUrIMg0s+gVfxYrgVbIJLUSzsrl2F2ZZl4L7J/Pdp/956ca969UrEna0O41/HwSJ4F3in42Fz5Trsbt5Bv3u30e9uImyvnoV15GGY/LIA6kOZP1966pZ8r3r1n5eqhwZ0F/aB4ToHGK9zh/FPHjD60RE6H1tDaaA2cdy7mvFfI+BffksPNrEksu0AAAAASUVORK5CYII=",f}),i("Scene/GridImageryProvider",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","../Core/GeographicTilingScheme"],function(e,t,i,r,n,o){"use strict";var a=new e(1,1,1,.4),s=new e(0,1,0,.05),l=new e(0,.5,0,.2),u=function(e){e=t(e,t.EMPTY_OBJECT),this._tilingScheme=i(e.tilingScheme)?e.tilingScheme:new o({ellipsoid:e.ellipsoid}),this._cells=t(e.cells,8),this._color=t(e.color,a),this._glowColor=t(e.glowColor,s),this._glowWidth=t(e.glowWidth,6),this._backgroundColor=t(e.backgroundColor,l),this._errorEvent=new n,this._tileWidth=t(e.tileWidth,256),this._tileHeight=t(e.tileHeight,256),this._canvasSize=t(e.canvasSize,256),this._canvas=this._createGridCanvas()};return r(u.prototype,{proxy:{get:function(){return void 0}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return void 0}},minimumLevel:{get:function(){return void 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return void 0}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},credit:{get:function(){return void 0}},hasAlphaChannel:{get:function(){return!0}}}),u.prototype._drawGrid=function(e){for(var t=0,i=this._canvasSize,r=0;r<=this._cells;++r){var n=r/this._cells,o=1+n*(i-1);e.moveTo(o,t),e.lineTo(o,i),e.moveTo(t,o),e.lineTo(i,o)}e.stroke()},u.prototype._createGridCanvas=function(){var e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;var t=0,i=this._canvasSize,r=e.getContext("2d"),n=this._backgroundColor.toCssColorString();r.fillStyle=n,r.fillRect(t,t,i,i);var o=this._glowColor.toCssColorString();r.strokeStyle=o,r.lineWidth=this._glowWidth,r.strokeRect(t,t,i,i),this._drawGrid(r),r.lineWidth=.5*this._glowWidth,r.strokeRect(t,t,i,i),this._drawGrid(r);var a=this._color.toCssColorString();return r.strokeStyle=a,r.lineWidth=2,r.strokeRect(t,t,i,i),r.lineWidth=1,this._drawGrid(r),e},u.prototype.getTileCredits=function(){return void 0},u.prototype.requestImage=function(){return this._canvas},u.prototype.pickFeatures=function(){return void 0},u}),i("Scene/Moon",["../Core/buildModuleUrl","../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/Ellipsoid","../Core/IauOrientationAxes","../Core/Matrix3","../Core/Matrix4","../Core/Simon1994PlanetaryPositions","../Core/Transforms","./EllipsoidPrimitive","./Material"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";var m=function(t){t=i(t,i.EMPTY_OBJECT);var n=t.textureUrl;r(n)||(n=e("Assets/Textures/moonSmall.jpg")),this.show=i(t.show,!0),this.textureUrl=n,this._ellipsoid=i(t.ellipsoid,a.MOON),this.onlySunLighting=i(t.onlySunLighting,!0),this._ellipsoidPrimitive=new d({radii:this.ellipsoid.radii,material:p.fromType(p.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new s};n(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var f=new l,v=new l,g=new t,_=[];return m.prototype.update=function(e,t){if(this.show){var i=this._ellipsoidPrimitive;i.material.uniforms.image=this.textureUrl,i.onlySunLighting=this.onlySunLighting;var n=t.time;r(h.computeIcrfToFixedMatrix(n,f))||h.computeTemeToPseudoFixedMatrix(n,f);var o=this._axes.evaluate(n,v);l.transpose(o,o),l.multiply(f,o,o);var a=c.computeMoonPositionInEarthInertialFrame(n,g);return l.multiplyByVector(f,a,a),u.fromRotationTranslation(o,a,i.modelMatrix),_.length=0,i.update(e,t,_),1===_.length?_[0]:void 0}},m.prototype.isDestroyed=function(){return!1},m.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),o(this)},m}),i("Scene/NeverTileDiscardPolicy",[],function(){"use strict";var e=function(){};return e.prototype.isReady=function(){return!0},e.prototype.shouldDiscardImage=function(){return!1},e}),i("Shaders/AdjustTranslucentFS",[],function(){"use strict";return"#ifdef MRT\n#extension GL_EXT_draw_buffers : enable\n#endif\nuniform vec4 u_bgColor;\nuniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nif (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n{\n#ifdef MRT\ngl_FragData[0] = u_bgColor;\ngl_FragData[1] = vec4(u_bgColor.a);\n#else\ngl_FragColor = u_bgColor;\n#endif\nreturn;\n}\ndiscard;\n}\n"}),i("Shaders/CompositeOITFS",[],function(){"use strict";return"uniform sampler2D u_opaque;\nuniform sampler2D u_accumulation;\nuniform sampler2D u_revealage;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 opaque = texture2D(u_opaque, v_textureCoordinates);\nvec4 accum = texture2D(u_accumulation, v_textureCoordinates);\nfloat r = texture2D(u_revealage, v_textureCoordinates).r;\n#ifdef MRT\nvec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n#else\nvec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n#endif\ngl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\n}\n"}),i("Scene/OIT",["../Core/Color","../Core/defined","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/ShaderSource","../Shaders/AdjustTranslucentFS","../Shaders/CompositeOITFS","./BlendEquation","./BlendFunction"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function p(e){e._translucentFBO=e._translucentFBO&&!e._translucentFBO.isDestroyed()&&e._translucentFBO.destroy(),e._alphaFBO=e._alphaFBO&&!e._alphaFBO.isDestroyed()&&e._alphaFBO.destroy(),e._adjustTranslucentFBO=e._adjustTranslucentFBO&&!e._adjustTranslucentFBO.isDestroyed()&&e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO=e._adjustAlphaFBO&&!e._adjustAlphaFBO.isDestroyed()&&e._adjustAlphaFBO.destroy()}function m(e){d(e),p(e)}function f(e,t,i,n){d(e),e._accumulationTexture=t.createTexture2D({width:i,height:n,pixelFormat:r.RGBA,pixelDatatype:o.FLOAT}),e._revealageTexture=t.createTexture2D({width:i,height:n,pixelFormat:r.RGBA,pixelDatatype:o.FLOAT})}function v(e,t){p(e);var i=WebGLRenderingContext.FRAMEBUFFER_COMPLETE,r=!0;if(e._translucentMRTSupport&&(e._translucentFBO=t.createFramebuffer({colorTextures:[e._accumulationTexture,e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=t.createFramebuffer({colorTextures:[e._accumulationTexture,e._revealageTexture],destroyAttachments:!1}),(e._translucentFBO.status!==i||e._adjustTranslucentFBO.status!==i)&&(p(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO=t.createFramebuffer({colorTextures:[e._accumulationTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._alphaFBO=t.createFramebuffer({colorTextures:[e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=t.createFramebuffer({colorTextures:[e._accumulationTexture],destroyAttachments:!1}),e._adjustAlphaFBO=t.createFramebuffer({colorTextures:[e._revealageTexture],destroyAttachments:!1});var n=e._translucentFBO.status===i,o=e._alphaFBO.status===i,a=e._adjustTranslucentFBO.status===i,s=e._adjustAlphaFBO.status===i;n&&o&&a&&s||(m(e),e._translucentMultipassSupport=!1,r=!1)}return r}function g(e,i,r,n){var o=r[n.id];if(!t(o)){var s=a.clone(n);s.depthMask=!1,s.blending=i,o=e.createRenderState(s),r[n.id]=o}return o}function _(e,t,i){return g(t,A,e._translucentRenderStateCache,i)}function y(e,t,i){return g(t,D,e._translucentRenderStateCache,i) -}function C(e,t,i){return g(t,M,e._alphaRenderStateCache,i)}function w(e,i,r,n){var o=i.id,a=r[o];if(!t(a)){var s=i._attributeLocations,l=i.fragmentShaderSource.clone();l.sources=l.sources.map(function(e){return e=e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,"void czm_translucent_main()"),e=e.replace(/gl_FragColor/g,"czm_gl_FragColor"),e=e.replace(/\bdiscard\b/g,"czm_discard = true"),e=e.replace(/czm_phong/g,"czm_translucentPhong")}),l.sources.splice(0,0,(-1!==n.indexOf("gl_FragData")?"#extension GL_EXT_draw_buffers : enable \n":"")+"vec4 czm_gl_FragColor;\n"+"bool czm_discard = false;\n"),l.sources.push("void main()\n{\n czm_translucent_main();\n if (czm_discard)\n {\n discard;\n }\n"+n+"}\n"),a=e.createShaderProgram(i.vertexShaderSource,l,s),r[o]=a}return a}function S(e,t,i){return w(t,i,e._translucentShaderCache,I)}function E(e,t,i){return w(t,i,e._translucentShaderCache,O)}function b(e,t,i){return w(t,i,e._alphaShaderCache,R)}function x(e,i,r,n,o){var a,s,l,u,c=i.context,h=n.framebuffer,d=o.length;n.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(c,n),n.framebuffer=e._adjustAlphaFBO,e._adjustAlphaCommand.execute(c,n);var p=e._opaqueFBO;for(n.framebuffer=e._translucentFBO,u=0;d>u;++u)a=o[u],t(a.oit)&&a.shaderProgram.id===a.oit.shaderProgramId||(a.oit={colorRenderState:y(e,c,a.renderState),alphaRenderState:C(e,c,a.renderState),colorShaderProgram:E(e,c,a.shaderProgram),alphaShaderProgram:b(e,c,a.shaderProgram),shaderProgramId:a.shaderProgram.id}),s=a.oit.colorRenderState,l=a.oit.colorShaderProgram,r(a,i,c,n,s,l,p);for(n.framebuffer=e._alphaFBO,u=0;d>u;++u)a=o[u],s=a.oit.alphaRenderState,l=a.oit.alphaShaderProgram,r(a,i,c,n,s,l,p);n.framebuffer=h}function T(e,i,r,n,o){var a=i.context,s=n.framebuffer,l=o.length;n.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(a,n);var u=e._opaqueFBO;n.framebuffer=e._translucentFBO;for(var c=0;l>c;++c){var h=o[c];t(h.oit)&&h.shaderProgram.id===h.oit.shaderProgramId||(h.oit={translucentRenderState:_(e,a,h.renderState),translucentShaderProgram:S(e,a,h.shaderProgram),shaderProgramId:h.shaderProgram.id});var d=h.oit.translucentRenderState,p=h.oit.translucentShaderProgram;r(h,i,a,n,d,p,u)}n.framebuffer=s}var P=function(t){this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;var i=t.floatingPointTexture&&t.depthTexture;this._translucentMRTSupport=t.drawBuffers&&i,this._translucentMultipassSupport=!this._translucentMRTSupport&&i,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=void 0,this._alphaFBO=void 0,this._adjustTranslucentFBO=void 0,this._adjustAlphaFBO=void 0,this._opaqueClearCommand=new n({color:new e(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new n({color:new e(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new n({color:new e(0,0,0,0),owner:this}),this._alphaClearCommand=new n({color:new e(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._translucentShaderCache={},this._alphaShaderCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0};P.prototype.update=function(e,i){if(this.isSupported()){this._opaqueFBO=i,this._opaqueTexture=i.getColorTexture(0),this._depthStencilTexture=i.depthStencilTexture;var r=this._opaqueTexture.width,n=this._opaqueTexture.height,o=this._accumulationTexture,a=!t(o)||o.width!==r||o.height!==n;if(a&&f(this,e,r,n),t(this._translucentFBO)&&!a||v(this,e)){var c,h,d=this;t(this._compositeCommand)||(c=new s({sources:[u]}),this._translucentMRTSupport&&c.defines.push("MRT"),h={u_opaque:function(){return d._opaqueTexture},u_accumulation:function(){return d._accumulationTexture},u_revealage:function(){return d._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(c,{renderState:e.createRenderState(),uniformMap:h,owner:this})),t(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(c=new s({defines:["MRT"],sources:[l]}),h={u_bgColor:function(){return d._translucentMRTClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(c,{renderState:e.createRenderState(),uniformMap:h,owner:this})):this._translucentMultipassSupport&&(c=new s({sources:[l]}),h={u_bgColor:function(){return d._translucentMultipassClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(c,{renderState:e.createRenderState(),uniformMap:h,owner:this}),h={u_bgColor:function(){return d._alphaClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(c,{renderState:e.createRenderState(),uniformMap:h,owner:this})))}}};var A={enabled:!0,color:new e(0,0,0,0),equationRgb:c.ADD,equationAlpha:c.ADD,functionSourceRgb:h.ONE,functionDestinationRgb:h.ONE,functionSourceAlpha:h.ZERO,functionDestinationAlpha:h.ONE_MINUS_SOURCE_ALPHA},D={enabled:!0,color:new e(0,0,0,0),equationRgb:c.ADD,equationAlpha:c.ADD,functionSourceRgb:h.ONE,functionDestinationRgb:h.ONE,functionSourceAlpha:h.ONE,functionDestinationAlpha:h.ONE},M={enabled:!0,color:new e(0,0,0,0),equationRgb:c.ADD,equationAlpha:c.ADD,functionSourceRgb:h.ZERO,functionDestinationRgb:h.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:h.ZERO,functionDestinationAlpha:h.ONE_MINUS_SOURCE_ALPHA},I=" 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",O=" 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",R=" float ai = czm_gl_FragColor.a;\n gl_FragColor = vec4(ai);\n";return P.prototype.executeCommands=function(e,t,i,r){return this._translucentMRTSupport?(T(this,e,t,i,r),void 0):(x(this,e,t,i,r),void 0)},P.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)},P.prototype.clear=function(t,i,r){var n=i.framebuffer;i.framebuffer=this._opaqueFBO,e.clone(r,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(t,i),i.framebuffer=this._translucentFBO;var o=this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand;o.execute(t,i),this._translucentMultipassSupport&&(i.framebuffer=this._alphaFBO,this._alphaClearCommand.execute(t,i)),i.framebuffer=n},P.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport},P.prototype.isDestroyed=function(){return!1},P.prototype.destroy=function(){m(this),t(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),t(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),t(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy());var e,r=this._translucentShaderCache;for(e in r)r.hasOwnProperty(e)&&t(r[e])&&r[e].destroy();this._translucentShaderCache={},r=this._alphaShaderCache;for(e in r)r.hasOwnProperty(e)&&t(r[e])&&r[e].destroy();return this._alphaShaderCache={},i(this)},P}),i("Scene/OpenStreetMapImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/Rectangle","../Core/WebMercatorTilingScheme","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(e,t,r,n){var o=e._url+n+"/"+t+"/"+r+"."+e._fileExtension,a=e._proxy;return i(a)&&(o=a.getURL(o)),o}var c=/\/$/,h=new e("MapQuest, Open Street Map and contributors, CC-BY-SA"),d=function(i){i=t(i,{});var r=t(i.url,"//a.tile.openstreetmap.org/");c.test(r)||(r+="/"),this._url=r,this._fileExtension=t(i.fileExtension,"png"),this._proxy=i.proxy,this._tileDiscardPolicy=i.tileDiscardPolicy,this._tilingScheme=new s({ellipsoid:i.ellipsoid}),this._tileWidth=256,this._tileHeight=256,this._minimumLevel=t(i.minimumLevel,0),this._maximumLevel=i.maximumLevel,this._rectangle=t(i.rectangle,this._tilingScheme.rectangle);var l=this._tilingScheme.positionToTileXY(a.southwest(this._rectangle),this._minimumLevel),u=this._tilingScheme.positionToTileXY(a.northeast(this._rectangle),this._minimumLevel),d=(Math.abs(u.x-l.x)+1)*(Math.abs(u.y-l.y)+1);if(d>4)throw new n("The imagery provider's rectangle and minimumLevel indicate that there are "+d+" tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.");this._errorEvent=new o,this._ready=!0;var p=t(i.credit,h);"string"==typeof p&&(p=new e(p)),this._credit=p};return r(d.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),d.prototype.getTileCredits=function(){return void 0},d.prototype.requestImage=function(e,t,i){var r=u(this,e,t,i);return l.loadImage(this,r)},d.prototype.pickFeatures=function(){return void 0},d}),i("Scene/OrthographicFrustum",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","./CullingVolume"],function(e,t,i,r,n,o,a,s){"use strict";function l(e){(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far)&&(e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=a.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix))}var u=function(){this.left=void 0,this._left=void 0,this.right=void 0,this._right=void 0,this.top=void 0,this._top=void 0,this.bottom=void 0,this._bottom=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far,this._cullingVolume=new s,this._orthographicMatrix=new a};n(u.prototype,{projectionMatrix:{get:function(){return l(this),this._orthographicMatrix}}});var c=new t,h=new t,d=new t,p=new t;return u.prototype.computeCullingVolume=function(e,n,o){var a=this._cullingVolume.planes,s=this.top,l=this.bottom,u=this.right,m=this.left,f=this.near,v=this.far,g=t.cross(n,o,c),_=h;t.multiplyByScalar(n,f,_),t.add(e,_,_);var y=d;t.multiplyByScalar(g,m,y),t.add(_,y,y);var C=a[0];return r(C)||(C=a[0]=new i),C.x=g.x,C.y=g.y,C.z=g.z,C.w=-t.dot(g,y),t.multiplyByScalar(g,u,y),t.add(_,y,y),C=a[1],r(C)||(C=a[1]=new i),C.x=-g.x,C.y=-g.y,C.z=-g.z,C.w=-t.dot(t.negate(g,p),y),t.multiplyByScalar(o,l,y),t.add(_,y,y),C=a[2],r(C)||(C=a[2]=new i),C.x=o.x,C.y=o.y,C.z=o.z,C.w=-t.dot(o,y),t.multiplyByScalar(o,s,y),t.add(_,y,y),C=a[3],r(C)||(C=a[3]=new i),C.x=-o.x,C.y=-o.y,C.z=-o.z,C.w=-t.dot(t.negate(o,p),y),C=a[4],r(C)||(C=a[4]=new i),C.x=n.x,C.y=n.y,C.z=n.z,C.w=-t.dot(n,_),t.multiplyByScalar(n,v,y),t.add(e,y,y),C=a[5],r(C)||(C=a[5]=new i),C.x=-n.x,C.y=-n.y,C.z=-n.z,C.w=-t.dot(t.negate(n,p),y),this._cullingVolume},u.prototype.getPixelSize=function(t,i,n){l(this);var o=this.right-this.left,a=this.top-this.bottom,s=o/t.x,u=a/t.y;return r(n)?(n.x=s,n.y=u,n):new e(s,u)},u.prototype.clone=function(e){return r(e)||(e=new u),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e},u.prototype.equals=function(e){return r(e)&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},u}),i("Widgets/getElement",["../Core/DeveloperError"],function(){"use strict";var e=function(e){if("string"==typeof e){var t=document.getElementById(e);e=t}return e};return e}),i("Scene/PerformanceDisplay",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/getTimestamp","../Widgets/getElement"],function(e,t,i,r,n,o,a){"use strict";var s=function(e){e=t(e,t.EMPTY_OBJECT);var r=a(e.container);if(!i(r))throw new n("container is required");this._container=r;var o=document.createElement("div");o.className="cesium-performanceDisplay";var s=document.createElement("div");s.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),s.appendChild(this._fpsText);var l=document.createElement("div");l.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),l.appendChild(this._msText),o.appendChild(l),o.appendChild(s),this._container.appendChild(o),this._lastFpsSampleTime=void 0,this._frameCount=0,this._time=void 0,this._fps=0,this._frameTime=0};return s.prototype.update=function(){if(!i(this._time))return this._lastFpsSampleTime=o(),this._time=o(),void 0;var e=this._time,t=o();this._time=t;var r=t-e;this._frameCount++;var n=this._fps,a=t-this._lastFpsSampleTime;a>1e3&&(n=0|1e3*this._frameCount/a,this._lastFpsSampleTime=t,this._frameCount=0),n!==this._fps&&(this._fpsText.nodeValue=n+" FPS",this._fps=n),r!==this._frameTime&&(this._msText.nodeValue=r.toFixed(2)+" MS",this._frameTime=r)},s.prototype.destroy=function(){return r(this)},s}),i("Scene/PickDepth",["../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/PixelFormat","../Renderer/PixelDatatype","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n){"use strict";function o(t,i,r){if(!e(t._debugPickDepthViewportCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\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";t._debugPickDepthViewportCommand=i.createViewportQuadCommand(n,{uniformMap:{u_texture:function(){return t._depthTexture}},owner:t})}t._debugPickDepthViewportCommand.execute(i,r)}function a(e){e._depthTexture=e._depthTexture&&!e._depthTexture.isDestroyed()&&e._depthTexture.destroy()}function s(e){e.framebuffer=e.framebuffer&&!e.framebuffer.isDestroyed()&&e.framebuffer.destroy()}function l(e,t,i,o){e._depthTexture=t.createTexture2D({width:i,height:o,pixelFormat:r.RGBA,pixelDatatype:n.UNSIGNED_BYTE})}function u(e,t,i,r){a(e),s(e),l(e,t,i,r),e.framebuffer=t.createFramebuffer({colorTextures:[e._depthTexture],destroyAttachments:!1})}function c(t,i,r){var n=r.width,o=r.height,a=t._depthTexture,s=!e(a)||a.width!==n||a.height!==o;(!e(t.framebuffer)||s)&&u(t,i,n,o)}function h(t,i,r){if(!e(t._copyDepthCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";t._copyDepthCommand=i.createViewportQuadCommand(n,{renderState:i.createRenderState(),uniformMap:{u_texture:function(){return t._textureToCopy}},owner:t})}t._textureToCopy=r,t._copyDepthCommand.framebuffer=t.framebuffer}var d=function(){this.framebuffer=void 0,this._depthTexture=void 0,this._textureToCopy=void 0,this._copyDepthCommand=void 0,this._debugPickDepthViewportCommand=void 0};return d.prototype.executeDebugPickDepth=function(e,t){o(this,e,t)},d.prototype.update=function(e,t){c(this,e,t),h(this,e,t)},d.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)},d.prototype.isDestroyed=function(){return!1},d.prototype.destroy=function(){return a(this),s(this),this._copyDepthCommand.shaderProgram=e(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy(),i(this)},d}),i("Scene/Polygon",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/GeometryInstance","../Core/Math","../Core/PolygonGeometry","./EllipsoidSurfaceAppearance","./Material","./Primitive"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";var p=function(r){r=t(r,t.EMPTY_OBJECT),this.ellipsoid=t(r.ellipsoid,a.WGS84),this._ellipsoid=void 0,this.granularity=t(r.granularity,l.RADIANS_PER_DEGREE),this._granularity=void 0,this.height=t(r.height,0),this._height=void 0,this.textureRotationAngle=t(r.textureRotationAngle,0),this._textureRotationAngle=void 0,this.show=t(r.show,!0);var n=h.fromType(h.ColorType,{color:new e(1,1,0,.5)});this.material=t(r.material,n),this.id=r.id,this._id=void 0,this.asynchronous=t(r.asynchronous,!0),this.debugShowBoundingVolume=t(r.debugShowBoundingVolume,!1),this._positions=void 0,this._polygonHierarchy=void 0,this._createPrimitive=!1,this._primitive=void 0,i(r.positions)?this.positions=r.positions:i(r.polygonHierarchy)&&this.configureFromPolygonHierarchy(r.polygonHierarchy)};return r(p.prototype,{positions:{get:function(){return this._positions},set:function(e){this._positions=e,this._polygonHierarchy=void 0,this._createPrimitive=!0}}}),p.prototype.configureFromPolygonHierarchy=function(e){this._positions=void 0,this._polygonHierarchy=e,this._createPrimitive=!0},p.prototype.update=function(e,t,r){if(this.show&&(this._createPrimitive||i(this._primitive))){if(this._createPrimitive||this._ellipsoid!==this.ellipsoid||this._granularity!==this.granularity||this._height!==this.height||this._textureRotationAngle!==this.textureRotationAngle||this._id!==this.id){if(this._createPrimitive=!1,this._ellipsoid=this.ellipsoid,this._granularity=this.granularity,this._height=this.height,this._textureRotationAngle=this.textureRotationAngle,this._id=this.id,this._primitive=this._primitive&&this._primitive.destroy(),!i(this._positions)&&!i(this._polygonHierarchy))return;var n;n=i(this._positions)?new s({geometry:u.fromPositions({positions:this._positions,height:this.height,vertexFormat:c.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity}),id:this.id,pickPrimitive:this}):new s({geometry:new u({polygonHierarchy:this._polygonHierarchy,height:this.height,vertexFormat:c.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity}),id:this.id,pickPrimitive:this}),this._primitive=new d({geometryInstances:n,appearance:new c({aboveGround:this.height>0}),asynchronous:this.asynchronous})}var o=this._primitive;o.debugShowBoundingVolume=this.debugShowBoundingVolume,o.appearance.material=this.material,o.update(e,t,r)}},p.prototype.isDestroyed=function(){return!1},p.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),n(this)},p}),i("Scene/PrimitiveCollection",["../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i,r,n){"use strict";function o(e,t){return e._primitives.indexOf(t)}var a=function(i){i=t(i,t.EMPTY_OBJECT),this._primitives=[],this._guid=e(),this.show=t(i.show,!0),this.destroyPrimitives=t(i.destroyPrimitives,!0)};return r(a.prototype,{length:{get:function(){return this._primitives.length}}}),a.prototype.add=function(e){var t=e._external=e._external||{},i=t._composites=t._composites||{};return i[this._guid]={collection:this},this._primitives.push(e),e},a.prototype.remove=function(e){if(this.contains(e)){var t=this._primitives.indexOf(e);if(-1!==t)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),!0}return!1},a.prototype.removeAndDestroy=function(e){var t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t},a.prototype.removeAll=function(){if(this.destroyPrimitives)for(var e=this._primitives,t=e.length,i=0;t>i;++i)e[i].destroy();this._primitives=[]},a.prototype.contains=function(e){return!!(i(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])},a.prototype.raise=function(e){if(i(e)){var t=o(this,e),r=this._primitives;if(t!==r.length-1){var n=r[t];r[t]=r[t+1],r[t+1]=n}}},a.prototype.raiseToTop=function(e){if(i(e)){var t=o(this,e),r=this._primitives;t!==r.length-1&&(r.splice(t,1),r.push(e))}},a.prototype.lower=function(e){if(i(e)){var t=o(this,e),r=this._primitives;if(0!==t){var n=r[t];r[t]=r[t-1],r[t-1]=n}}},a.prototype.lowerToBottom=function(e){if(i(e)){var t=o(this,e),r=this._primitives;0!==t&&(r.splice(t,1),r.unshift(e))}},a.prototype.get=function(e){return this._primitives[e]},a.prototype.update=function(e,t,i){if(this.show)for(var r=this._primitives,n=0;n<r.length;++n)r[n].update(e,t,i)},a.prototype.isDestroyed=function(){return!1},a.prototype.destroy=function(){return this.removeAll(),n(this)},a}),i("Scene/QuadtreeTileProvider",["../Core/defineProperties","../Core/DeveloperError"],function(e,t){"use strict";var i=function(){t.throwInstantiationError()};return i.computeDefaultLevelZeroMaximumGeometricError=function(e){return.25*2*e.ellipsoid.maximumRadius*Math.PI/(65*e.getNumberOfXTilesAtLevel(0))},e(i.prototype,{quadtree:{get:t.throwInstantiationError,set:t.throwInstantiationError},ready:{get:t.throwInstantiationError},tilingScheme:{get:t.throwInstantiationError},errorEvent:{get:t.throwInstantiationError}}),i.prototype.beginUpdate=t.throwInstantiationError,i.prototype.endUpdate=t.throwInstantiationError,i.prototype.getLevelMaximumGeometricError=t.throwInstantiationError,i.prototype.loadTile=t.throwInstantiationError,i.prototype.computeTileVisibility=t.throwInstantiationError,i.prototype.showTileThisFrame=t.throwInstantiationError,i.prototype.computeDistanceToTile=t.throwInstantiationError,i.prototype.isDestroyed=t.throwInstantiationError,i.prototype.destroy=t.throwInstantiationError,i}),i("Scene/RectanglePrimitive",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/GeometryInstance","../Core/Math","../Core/Rectangle","../Core/RectangleGeometry","./EllipsoidSurfaceAppearance","./Material","./Primitive"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";var p=function(i){i=t(i,t.EMPTY_OBJECT),this.ellipsoid=t(i.ellipsoid,o.WGS84),this._ellipsoid=void 0,this.rectangle=l.clone(i.rectangle),this._rectangle=void 0,this.granularity=t(i.granularity,s.RADIANS_PER_DEGREE),this._granularity=void 0,this.height=t(i.height,0),this._height=void 0,this.rotation=t(i.rotation,0),this._rotation=void 0,this.textureRotationAngle=t(i.textureRotationAngle,0),this._textureRotationAngle=void 0,this.show=t(i.show,!0);var r=h.fromType(h.ColorType,{color:new e(1,1,0,.5)});this.material=t(i.material,r),this.id=i.id,this._id=void 0,this.asynchronous=t(i.asynchronous,!0),this.debugShowBoundingVolume=t(i.debugShowBoundingVolume,!1),this._primitive=void 0};return p.prototype.update=function(e,t,r){if(this.show&&i(this.rectangle)){if(!l.equals(this._rectangle,this.rectangle)||this._ellipsoid!==this.ellipsoid||this._granularity!==this.granularity||this._height!==this.height||this._rotation!==this.rotation||this._textureRotationAngle!==this.textureRotationAngle||this._id!==this.id){this._rectangle=l.clone(this.rectangle,this._rectangle),this._ellipsoid=this.ellipsoid,this._granularity=this.granularity,this._height=this.height,this._rotation=this.rotation,this._textureRotationAngle=this.textureRotationAngle,this._id=this.id;var n=new a({geometry:new u({rectangle:this.rectangle,vertexFormat:c.VERTEX_FORMAT,ellipsoid:this.ellipsoid,granularity:this.granularity,height:this.height,rotation:this.rotation,stRotation:this.textureRotationAngle}),id:this.id,pickPrimitive:this});i(this._primitive)&&this._primitive.destroy(),this._primitive=new d({geometryInstances:n,appearance:new c({aboveGround:this.height>0}),asynchronous:this.asynchronous})}var o=this._primitive;o.appearance.material=this.material,o.debugShowBoundingVolume=this.debugShowBoundingVolume,o.update(e,t,r)}},p.prototype.isDestroyed=function(){return!1},p.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),r(this)},p}),i("Scene/SceneTransitioner",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/EasingFunction","../Core/Ellipsoid","../Core/Math","../Core/Matrix4","../Core/ScreenSpaceEventHandler","../Core/ScreenSpaceEventType","./Camera","./OrthographicFrustum","./PerspectiveFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";function f(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new u(e._scene.canvas,!1);var i=function(){e._morphCancelled=!0,t(e)};e._completeMorph=i,e._morphHandler.setInputAction(i,c.LEFT_DOWN),e._morphHandler.setInputAction(i,c.MIDDLE_DOWN),e._morphHandler.setInputAction(i,c.RIGHT_DOWN),e._morphHandler.setInputAction(i,c.WHEEL)}}function v(e){for(var t=e._currentTweens,i=0;i<t.length;++i)t[i].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}function g(t,i,r,n){var a=t._scene,s=a.camera;s._setTransform(l.IDENTITY);var u=s.position,c=s.direction,h=s.up,d=e.clone(t._camera2D.position),p=e.clone(t._camera2D.direction),m=e.clone(t._camera2D.up),f=function(t){s.position=y(u,d,t.time),s.direction=y(c,p,t.time),s.up=y(h,m,t.time),s.right=e.cross(s.direction,s.up,s.right),e.normalize(s.right,s.right)},v=a.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f});t._currentTweens.push(v),T(t,a,0,1,i,n)}function _(e,t,i,r){t*=.5;var n=e._scene.camera;n._setTransform(l.IDENTITY),E(e,t,i,function(){n.frustum=e._cameraCV.frustum.clone(),g(e,t,i,r)})}function y(t,i,r){return e.lerp(t,i,r,new e)}function C(t,i,r){var n=t._scene,a=n.camera,l=a.position,u=a.frustum.fov,c=.5*s.RADIANS_PER_DEGREE,h=e.magnitude(l)*Math.tan(.5*u);a.frustum.far=h/Math.tan(.5*c)+1e7;var d=function(t){a.frustum.fov=s.lerp(u,c,t.time);var i=h/Math.tan(.5*a.frustum.fov),r=new e;a.position=e.multiplyByScalar(e.normalize(a.position,r),i,r)},p=n.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:d,complete:function(){a.frustum=t._camera2D.frustum.clone(),r(t)}});t._currentTweens.push(p)}function w(t,i,r,n){var a=t._scene,s=a.camera;s._setTransform(l.IDENTITY);var u=r.maximumRadius,c=e.clone(s.position),h=e.clone(s.direction),d=e.clone(s.up),p=Math.tan(.5*t._cameraCV.frustum.fovy),m=t._cameraCV.frustum.aspectRatio*p,f=u*Math.PI/m,v=new e;v=e.multiplyByScalar(e.normalize(t._camera2D.position,v),f,v);var g=e.clone(t._camera2D.direction),_=e.clone(t._camera2D.up),w=function(t){s.position=y(c,v,t.time),s.direction=y(h,g,t.time),s.up=y(d,_,t.time),s.right=e.cross(s.direction,s.up,s.right),e.normalize(s.right,s.right)};i*=.5;var S=a.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:w,complete:function(){C(t,i,n)}});t._currentTweens.push(S)}function S(t,i,r,n){i*=.5;var o=r.maximumRadius,a=Math.tan(.5*t._camera3D.frustum.fovy),s=t._camera3D.frustum.aspectRatio*a,l=o*Math.PI/s,u={},c=new e;u.position2D=e.multiplyByScalar(e.normalize(t._camera2D.position2D,c),l,c),u.direction2D=e.clone(t._camera2D.direction2D),u.up2D=e.clone(t._camera2D.up2D);var h=function(){C(t,i,n)};x(t,i,u,h)}function E(t,i,r,n){var a=t._scene,l=a.camera,u=r.maximumRadius,c=Math.tan(.5*t._cameraCV.frustum.fovy),h=t._cameraCV.frustum.aspectRatio*c,d=u*Math.PI/h,p=new e;p=e.multiplyByScalar(e.normalize(t._camera2D.position,p),d,p);var m=l.frustum.top,f=l.frustum.bottom,v=l.frustum.right,g=l.frustum.left,_=t._camera2D.frustum,C=t._cameraCV.frustum,w=e.clone(l.position),S=function(e){l.position=y(w,p,e.time),l.frustum.top=s.lerp(m,_.top,e.time),l.frustum.bottom=s.lerp(f,_.bottom,e.time),l.frustum.right=s.lerp(v,_.right,e.time),l.frustum.left=s.lerp(g,_.left,e.time)},E=(v-g)/(2*u*Math.PI),b=1;E>b&&(E=0);var x=(b-E)*i;if(x<s.EPSILON6){if(e.equalsEpsilon(w,p,s.EPSILON6))return l.position=p,l.frustum=C.clone(),n(t),void 0;x=i,E=0,b=1}var T=a.tweens.add({easingFunction:o.QUARTIC_OUT,duration:x,startObject:{time:E},stopObject:{time:b},update:S,complete:function(){l.frustum=C.clone(),n(t)}});t._currentTweens.push(T)}function b(t,i,r,n){var a=t._scene,s=a.camera;s._setTransform(l.IDENTITY),i*=.5;var u=function(){var r=e.clone(s.position),l=e.clone(s.direction),u=e.clone(s.up),c=e.clone(t._cameraCV.position),h=e.clone(t._cameraCV.direction),d=e.clone(t._cameraCV.up),p=function(t){s.position=y(r,c,t.time),s.direction=y(l,h,t.time),s.up=y(u,d,t.time),s.right=e.cross(s.direction,s.up,s.right),e.normalize(s.right,s.right)},m=a.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:p,complete:function(){n(t)}});t._currentTweens.push(m)};E(t,i,r,u)}function x(t,i,r,n){var a=t._scene,s=a.camera;s._setTransform(l.IDENTITY);var u=e.clone(s.position),c=e.clone(s.direction),h=e.clone(s.up),d=e.clone(r.position2D),p=e.clone(r.direction2D),m=e.clone(r.up2D),f=function(t){s.position=y(u,d,t.time),s.direction=y(c,p,t.time),s.up=y(h,m,t.time),s.right=e.cross(s.direction,s.up,s.right),e.normalize(s.right,s.right)},v=a.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){s.position=d,s.direction=p,s.up=m,s.right=e.cross(p,m,s.right),e.normalize(s.right,s.right)}});t._currentTweens.push(v),T(t,a,1,0,i,n)}function T(e,t,r,n,a,s){var l={object:t,property:"morphTime",startValue:r,stopValue:n,duration:a,easingFunction:o.QUARTIC_OUT};i(s)&&(l.complete=function(){s(e)});var u=t.tweens.addProperty(l);e._currentTweens.push(u)}function P(e){var t=e._scene,i=t.drawingBufferHeight/t.drawingBufferWidth,r=e._camera2D.frustum;r.top=r.right*i,r.bottom=-r.top,i=1/i,r=e._cameraCV.frustum,r.aspectRatio=i,r=e._camera3D.frustum,r.aspectRatio=i;var n=t.camera;switch(t.mode){case m.SCENE3D:n.frustum=e._camera3D.frustum.clone();break;case m.COLUMBUS_VIEW:n.frustum=e._cameraCV.frustum.clone();break;case m.SCENE2D:n.frustum=e._camera2D.frustum.clone()}}function A(t){var r=t._scene;if(r.mode=m.SCENE3D,r.morphTime=m.getMorphTime(m.SCENE3D),v(t),P(t),t._previousMode!==m.MORPHING||t._morphCancelled){t._morphCancelled=!1;var n=r.camera;n.position=e.clone(t._camera3D.position),n.direction=e.clone(t._camera3D.direction),n.up=e.clone(t._camera3D.up),n.right=e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right)}var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.SCENE3D,o)}function D(t){var r=t._scene;r.mode=m.SCENE2D,r.morphTime=m.getMorphTime(m.SCENE2D),v(t),P(t);var n=r.camera;e.clone(t._camera2D.position,n.position),e.clone(t._camera2D.direction,n.direction),e.clone(t._camera2D.up,n.up),e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right);var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.SCENE2D,o)}function M(t){var r=t._scene;if(r.mode=m.COLUMBUS_VIEW,r.morphTime=m.getMorphTime(m.COLUMBUS_VIEW),v(t),P(t),t._previousModeMode!==m.MORPHING||t._morphCancelled){t._morphCancelled=!1;var n=r.camera;e.clone(t._cameraCV.position,n.position),e.clone(t._cameraCV.direction,n.direction),e.clone(t._cameraCV.up,n.up),e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right)}var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.COLUMBUS_VIEW,o) -}var I=function(i,r){this._scene=i,r=t(r,a.WGS84);var n=r.maximumRadius,o=new e(0,0,2*n),u=new e;u=e.normalize(e.negate(o,u),u);var c=e.clone(e.UNIT_Y),m=l.multiplyByPoint(h.TRANSFORM_2D,o,new e),f=l.multiplyByPointAsVector(h.TRANSFORM_2D,u,new e),v=l.multiplyByPointAsVector(h.TRANSFORM_2D,c,new e),g=new d;g.right=n*Math.PI,g.left=-g.right,g.top=g.right*(i.drawingBufferHeight/i.drawingBufferWidth),g.bottom=-g.top,this._camera2D={position:o,direction:u,up:c,position2D:m,direction2D:f,up2D:v,frustum:g},o=new e(0,-1,1),o=e.multiplyByScalar(e.normalize(o,o),5*n,o),u=new e,u=e.normalize(e.subtract(e.ZERO,o,u),u);var _=new e;_=e.normalize(e.cross(u,e.UNIT_Z,_),_),c=new e,c=e.normalize(e.cross(_,u,c),c),m=l.multiplyByPoint(h.TRANSFORM_2D,o,new e),f=l.multiplyByPointAsVector(h.TRANSFORM_2D,u,new e);var y=l.multiplyByPointAsVector(h.TRANSFORM_2D,_,new e);v=new e,v=e.normalize(e.cross(y,f,v),v),g=new p,g.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,g.fov=s.toRadians(60),this._cameraCV={position:o,direction:u,up:c,position2D:m,direction2D:f,up2D:v,frustum:g},o=new e,o=e.multiplyByScalar(e.normalize(new e(0,-2,1),o),2*n,o),u=new e,u=e.normalize(e.subtract(e.ZERO,o,u),u),_=new e,_=e.normalize(e.cross(u,e.UNIT_Z,_),_),c=new e,c=e.normalize(e.cross(_,u,c),c),this._camera3D={position:o,direction:u,up:c,frustum:g},this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0};return I.prototype.completeMorph=function(){i(this._completeMorph)&&this._completeMorph()},I.prototype.morphTo2D=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.SCENE2D&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.SCENE2D,!0),P(this),r.mode=m.MORPHING,f(this,D),this._previousMode===m.COLUMBUS_VIEW?w(this,e,t,D):S(this,e,t,D),0===e&&i(this._completeMorph)&&this._completeMorph())},I.prototype.morphToColumbusView=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.COLUMBUS_VIEW&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.COLUMBUS_VIEW,!0),P(this),r.mode=m.MORPHING,f(this,M),this._previousMode===m.SCENE2D?b(this,e,t,M):x(this,e,this._cameraCV,M),0===e&&i(this._completeMorph)&&this._completeMorph())},I.prototype.morphTo3D=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.SCENE3D&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.SCENE3D,!0),P(this),r.mode=m.MORPHING,f(this,A),this._previousMode===m.SCENE2D?_(this,e,t,A):g(this,e,t,A),0===e&&i(this._completeMorph)&&this._completeMorph())},I.prototype.isDestroyed=function(){return!1},I.prototype.destroy=function(){return v(this),r(this)},I}),i("Scene/TweenCollection",["../Core/clone","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/EasingFunction","../Core/getTimestamp","../Core/TimeConstants","../ThirdParty/Tween"],function(e,t,i,r,n,o,a,s,l){"use strict";var u=function(t,i,r,n,o,a,s,l,u,c){this._tweens=t,this._tweenjs=i,this._startObject=e(r),this._stopObject=e(n),this._duration=o,this._delay=a,this._easingFunction=s,this._update=l,this._complete=u,this.cancel=c,this.needsStart=!0};r(u.prototype,{startObject:{get:function(){return this._startObject}},stopObject:{get:function(){return this._stopObject}},duration:{get:function(){return this._duration}},delay:{get:function(){return this._delay}},easingFunction:{get:function(){return this._easingFunction}},update:{get:function(){return this._update}},complete:{get:function(){return this._complete}},tweenjs:{get:function(){return this._tweenjs}}}),u.prototype.cancelTween=function(){this._tweens.remove(this)};var c=function(){this._tweens=[]};return r(c.prototype,{length:{get:function(){return this._tweens.length}}}),c.prototype.add=function(r){if(r=t(r,t.EMPTY_OBJECT),0===r.duration)return i(r.complete)&&r.complete(),new u(this);var n=r.duration/s.SECONDS_PER_MILLISECOND,a=t(r.delay,0),c=a/s.SECONDS_PER_MILLISECOND,h=t(r.easingFunction,o.LINEAR_NONE),d=r.startObject,p=new l.Tween(d);p.to(e(r.stopObject),n),p.delay(c),p.easing(h),i(r.update)&&p.onUpdate(function(){r.update(d)}),p.onComplete(t(r.complete,null)),p.repeat(t(r._repeat,0));var m=new u(this,p,r.startObject,r.stopObject,r.duration,a,h,r.update,r.complete,r.cancel);return this._tweens.push(m),m},c.prototype.addProperty=function(e){function i(e){r[n]=e.value}e=t(e,t.EMPTY_OBJECT);var r=e.object,n=e.property,o=e.startValue,a=e.stopValue;return this.add({startObject:{value:o},stopObject:{value:a},duration:t(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})},c.prototype.addAlpha=function(e){function r(e){for(var t=o.length,i=0;t>i;++i)n.uniforms[o[i]].alpha=e.alpha}e=t(e,t.EMPTY_OBJECT);var n=e.material,o=[];for(var a in n.uniforms)n.uniforms.hasOwnProperty(a)&&i(n.uniforms[a])&&i(n.uniforms[a].alpha)&&o.push(a);return this.add({startObject:{alpha:t(e.startValue,0)},stopObject:{alpha:t(e.stopValue,1)},duration:t(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel})},c.prototype.addOffsetIncrement=function(e){e=t(e,t.EMPTY_OBJECT);var i=e.material,r=i.uniforms;return this.addProperty({object:r,property:"offset",startValue:r.offset,stopValue:r.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})},c.prototype.remove=function(e){if(!i(e))return!1;var t=this._tweens.indexOf(e);return-1!==t?(e.tweenjs.stop(),i(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1},c.prototype.removeAll=function(){for(var e=this._tweens,t=0;t<e.length;++t){var r=e[t];r.tweenjs.stop(),i(r.cancel)&&r.cancel()}e.length=0},c.prototype.contains=function(e){return i(e)&&-1!==this._tweens.indexOf(e)},c.prototype.get=function(e){return this._tweens[e]},c.prototype.update=function(e){var t=this._tweens,r=0;for(e=i(e)?e/s.SECONDS_PER_MILLISECOND:a();r<t.length;){var n=t[r],o=n.tweenjs;n.needsStart?(n.needsStart=!1,o.start(e)):o.update(e)?r++:(o.stop(),t.splice(r,1))}},c}),i("Scene/ScreenSpaceCameraController",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/IntersectionTests","../Core/isArray","../Core/KeyboardEventModifier","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Plane","../Core/Quaternion","../Core/Ray","../Core/Transforms","./CameraEventAggregator","./CameraEventType","./SceneMode","./SceneTransforms","./TweenCollection"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E){"use strict";function b(e,t){if(0>e)return 0;var i=25*(1-t);return Math.exp(-i*e)}function x(t){return e.equalsEpsilon(t.startPosition,t.endPosition,d.EPSILON14)}function T(t,i,r,n,a,s,l){var u=s[l];o(u)||(u=s[l]={startPosition:new e,endPosition:new e,motion:new e,active:!1});var c=t.getButtonPressTime(i,r),h=t.getButtonReleaseTime(i,r),d=c&&h&&(h.getTime()-c.getTime())/1e3,p=new Date,m=h&&(p.getTime()-h.getTime())/1e3;if(c&&h&&$>d){var f=b(m,n);if(u.active)u.startPosition=e.clone(u.endPosition,u.startPosition),u.endPosition=e.multiplyByScalar(u.motion,f,u.endPosition),u.endPosition=e.add(u.startPosition,u.endPosition,u.endPosition),u.motion=e.clone(e.ZERO,u.motion);else{var v=t.getLastMovement(i,r);if(!o(v)||x(v))return;u.motion.x=.5*(v.endPosition.x-v.startPosition.x),u.motion.y=.5*(v.endPosition.y-v.startPosition.y),u.startPosition=e.clone(v.startPosition,u.startPosition),u.endPosition=e.multiplyByScalar(u.motion,f,u.endPosition),u.endPosition=e.add(u.startPosition,u.endPosition,u.endPosition),u.active=!0}if(isNaN(u.endPosition.x)||isNaN(u.endPosition.y)||x(u))return u.active=!1,void 0;if(!t.isButtonDown(i,r)){var g=t.getStartMousePosition(i,r);a(s,g,u)}}else u.active=!1}function P(e,t,i,r,n,a){if(o(i)){var s=e._aggregator;c(i)||(et[0]=i,i=et);for(var l=i.length,u=0;l>u;++u){var h=i[u],d=o(h.eventType)?h.eventType:h,p=h.modifier,m=s.isMoving(d,p)&&s.getMovement(d,p),f=s.getStartMousePosition(d,p);e.enableInputs&&t&&(m?r(e,f,m):1>n&&T(s,d,p,n,r,e,a))}}}function A(i,r,n,a,s,l){var u=1;o(l)&&(u=d.clamp(Math.abs(l),.25,1));var c=i.minimumZoomDistance*u,h=i.maximumZoomDistance,p=s-c,m=a*p;m=d.clamp(m,i._minimumZoomRate,i._maximumZoomRate);var f=n.endPosition.y-n.startPosition.y,v=f/i._scene.canvas.clientHeight;v=Math.min(v,i.maximumMovementRatio);var g=m*v;if(!(g>0&&Math.abs(s-c)<1||0>g&&Math.abs(s-h)<1)){c>s-g?g=s-c-1:s-g>h&&(g=s-h);var _=i._scene,y=_.camera,C=_.mode,E=C!==w.SCENE2D?L(i,r,it):y.getPickRay(r,tt).origin;if(!o(E))return y.zoomIn(g),void 0;var b=e.equals(r,i._zoomMouseStart),x=i._zoomingOnVector,T=i._rotatingZoom;b||(i._zoomMouseStart=e.clone(r,i._zoomMouseStart),i._zoomWorldPosition=t.clone(E,i._zoomWorldPosition),x=i._zoomingOnVector=!1,T=i._rotatingZoom=!1);var P=C===w.COLUMBUS_VIEW;if(!b||T){if(C===w.SCENE2D){var A=i._zoomWorldPosition,D=y.position;if(!t.equals(A,D)){var M=t.subtract(A,D,nt);t.normalize(M,M);var I=t.distance(A,D)*g/(.5*y.getMagnitude());y.move(M,.5*I)}}else if(C===w.SCENE3D){var O=t.normalize(y.position,ct);if(y.positionCartographic.height<3e3&&Math.abs(t.dot(y.direction,O))<.6)P=!0;else{var R=_.canvas,N=ot;N.x=R.clientWidth/2,N.y=R.clientHeight/2;var F=L(i,N,at);if(o(F)){var B=t.normalize(F,st),z=t.normalize(i._zoomWorldPosition,lt),k=d.acosClamped(t.dot(z,B)),V=t.cross(z,B,ut),U=Math.abs(k)>d.toRadians(20)?.75*y.positionCartographic.height:y.positionCartographic.height-g,W=g/U;y.rotate(V,k*W)}else P=!0}}i._rotatingZoom=!P}if(!b&&P||x){var G,H=S.wgs84ToWindowCoordinates(_,i._zoomWorldPosition,rt);G=C!==w.COLUMBUS_VIEW&&e.equals(r,i._zoomMouseStart)&&o(H)?y.getPickRay(H,tt):y.getPickRay(r,tt);var q=G.direction;C===w.COLUMBUS_VIEW&&t.fromElements(q.y,q.z,q.x,q),y.move(q,g),i._zoomingOnVector=!0}else y.zoomIn(g)}}function D(e,i,r){var n=e._scene,o=n.camera,a=o.getPickRay(r.startPosition,ht).origin,s=o.getPickRay(r.endPosition,dt).origin,l=t.subtract(a,s,pt),u=t.magnitude(l);u>0&&(t.normalize(l,l),o.move(l,u))}function M(e,t,i){o(i.distance)&&(i=i.distance);var r=e._scene,n=r.camera;A(e,t,i,e._zoomFactor,n.getMagnitude())}function I(t,i,r){if(o(r.angleAndHeight))return O(t,i,r.angleAndHeight),void 0;var n=t._scene,a=n.camera,s=n.canvas,l=s.clientWidth,u=s.clientHeight,c=mt;c.x=2/l*r.startPosition.x-1,c.y=2/u*(u-r.startPosition.y)-1,c=e.normalize(c,c);var h=ft;h.x=2/l*r.endPosition.x-1,h.y=2/u*(u-r.endPosition.y)-1,h=e.normalize(h,h);var p=d.acosClamped(c.x);c.y<0&&(p=d.TWO_PI-p);var m=d.acosClamped(h.x);h.y<0&&(m=d.TWO_PI-m);var f=m-p;a.twistRight(f)}function O(e,t,i){var r=e._rotateFactor*e._rotateRateRangeAdjustment;r>e._maximumRotateRate&&(r=e._maximumRotateRate),r<e._minimumRotateRate&&(r=e._minimumRotateRate);var n=e._scene,o=n.camera,a=n.canvas,s=(i.endPosition.x-i.startPosition.x)/a.clientWidth;s=Math.min(s,e.maximumMovementRatio);var l=4*r*s*Math.PI;o.twistRight(l)}function R(e){var t=e._tweens;e._aggregator.anyButtonDown&&t.removeAll();var i=e._scene,r=i.camera;if(t.contains(e._tween)||(m.equals(m.IDENTITY,r.transform)?(P(e,e.enableTranslate,e.translateEventTypes,D,e.inertiaTranslate,"_lastInertiaTranslateMovement"),P(e,e.enableZoom,e.zoomEventTypes,M,e.inertiaZoom,"_lastInertiaZoomMovement"),P(e,e.enableRotate,e.tiltEventTypes,I,e.inertiaSpin,"_lastInertiaTiltMovement")):(P(e,e.enableRotate,e.translateEventTypes,I,e.inertiaSpin,"_lastInertiaSpinMovement"),P(e,e.enableZoom,e.zoomEventTypes,M,e.inertiaZoom,"_lastInertiaZoomMovement"))),!(e._aggregator.anyButtonDown||o(e._lastInertiaZoomMovement)&&e._lastInertiaZoomMovement.active||o(e._lastInertiaTranslateMovement)&&e._lastInertiaTranslateMovement.active||t.contains(e._tween))){var n=r.createCorrectPositionTween(e.bounceAnimationTime);o(n)&&(e._tween=t.add(n))}t.update()}function L(e,i,r){var n=e._scene,a=e._globe,s=n.camera;if(!o(a))return void 0;var l;n.pickPositionSupported&&(l=n.pickPosition(i,gt));var u=s.getPickRay(i,vt),c=a.pick(u,n,_t),h=o(l)?t.distance(l,s.positionWC):Number.POSITIVE_INFINITY,d=o(c)?t.distance(c,s.positionWC):Number.POSITIVE_INFINITY;return d>h?t.clone(l,r):t.clone(c,r)}function N(i,r,n){if(t.equals(r,i._translateMousePosition)||(i._looking=!1),t.equals(r,i._strafeMousePosition)||(i._strafing=!1),i._looking)return Z(i,r,n),void 0;if(i._strafing)return U(i,r,n),void 0;var a,s=i._scene,l=s.camera,c=e.clone(n.startPosition,Tt),h=e.clone(n.endPosition,Pt),p=l.getPickRay(c,yt),m=t.clone(t.ZERO,bt),v=t.UNIT_X;if(l.position.z<i.minimumPickingTerrainHeight&&(a=L(i,c,wt),o(a)&&(m.x=a.x)),m.x>l.position.z&&o(a))return t.clone(a,i._strafeStartPosition),i._strafing=!0,U(i,r,n),i._strafeMousePosition=e.clone(r,i._strafeMousePosition),void 0;var g=f.fromPointNormal(m,v,xt);p=l.getPickRay(c,yt);var _=u.rayPlane(p,g,wt),y=l.getPickRay(h,Ct),C=u.rayPlane(y,g,St);if(!o(_)||!o(C))return i._looking=!0,Z(i,r,n),e.clone(r,i._translateMousePosition),void 0;var w=t.subtract(_,C,Et),S=w.x;w.x=w.y,w.y=w.z,w.z=S;var E=t.magnitude(w);E>d.EPSILON6&&(t.normalize(w,w),l.move(w,E))}function F(t,i,r){if(o(r.angleAndHeight)&&(r=r.angleAndHeight),e.equals(i,t._tiltCenterMousePosition)||(t._tiltCVOffMap=!1,t._looking=!1),t._looking)return Z(t,i,r),void 0;var n=t._scene,a=n.camera,s=t._maxCoord,l=Math.abs(a.position.x)-s.x<0&&Math.abs(a.position.y)-s.y<0;t._tiltCVOffMap||!l||a.position.z>t.minimumPickingTerrainHeight?(t._tiltCVOffMap=!0,B(t,i,r)):z(t,i,r)}function B(i,r,n){var a=i._scene,s=a.camera,u=a.canvas,c=At;c.x=u.clientWidth/2,c.y=u.clientHeight/2;var h,p=s.getPickRay(c,Dt),f=t.UNIT_X,v=p.origin,g=p.direction,y=t.dot(f,g);if(Math.abs(y)>d.EPSILON6&&(h=-t.dot(f,v)/y),!o(h)||0>=h)return i._looking=!0,Z(i,r,n),e.clone(r,i._tiltCenterMousePosition),void 0;var C=t.multiplyByScalar(g,h,Mt);t.add(v,C,C);var w=a.mapProjection,S=w.ellipsoid;t.fromElements(C.y,C.z,C.x,C);var E=w.unproject(C,Bt);S.cartographicToCartesian(E,C);var b=_.eastNorthUpToFixedFrame(C,S,Ot),x=i._globe,T=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var P=m.clone(s.transform,zt);s._setTransform(b),G(i,r,n,t.UNIT_Z),s._setTransform(P),i._globe=x,i._ellipsoid=T;var A=T.maximumRadius;i._rotateFactor=1/A,i._rotateRateRangeAdjustment=A}function z(i,r,n){var a,s,c=i._ellipsoid,h=i._scene,g=h.camera,y=t.UNIT_X;if(e.equals(r,i._tiltCenterMousePosition))a=t.clone(i._tiltCenter,Mt);else{if(g.position.z<i.minimumPickingTerrainHeight&&(a=L(i,r,Mt)),!o(a)){s=g.getPickRay(r,Dt);var C,w=s.origin,S=s.direction,E=t.dot(y,S);if(Math.abs(E)>d.EPSILON6&&(C=-t.dot(y,w)/E),!o(C)||0>=C)return i._looking=!0,Z(i,r,n),e.clone(r,i._tiltCenterMousePosition),void 0;a=t.multiplyByScalar(S,C,Mt),t.add(w,a,a)}e.clone(r,i._tiltCenterMousePosition),t.clone(a,i._tiltCenter)}var b=h.canvas,x=At;x.x=b.clientWidth/2,x.y=i._tiltCenterMousePosition.y,s=g.getPickRay(x,Dt);var T=t.clone(t.ZERO,Lt);T.x=a.x;var P=f.fromPointNormal(T,y,Nt),A=u.rayPlane(s,P,It),D=g._projection;c=D.ellipsoid,t.fromElements(a.y,a.z,a.x,a);var M=D.unproject(a,Bt);c.cartographicToCartesian(M,a);var I,O=_.eastNorthUpToFixedFrame(a,c,Ot);o(A)?(t.fromElements(A.y,A.z,A.x,A),M=D.unproject(A,Bt),c.cartographicToCartesian(M,A),I=_.eastNorthUpToFixedFrame(A,c,Rt)):I=O;var R=i._globe,N=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var F=t.UNIT_Z,B=m.clone(g.transform,zt);g._setTransform(O);var z=t.cross(t.UNIT_Z,t.normalize(g.position,Ft),Ft),k=t.dot(g.right,z);if(G(i,r,n,F,!1,!0),g._setTransform(I),0>k){n.startPosition.y>n.endPosition.y&&(F=void 0);var V=g.constrainedAxis;g.constrainedAxis=void 0,G(i,r,n,F,!0,!1),g.constrainedAxis=V}else G(i,r,n,F,!0,!1);if(o(g.constrainedAxis)){var U=t.cross(g.direction,g.constrainedAxis,vi);t.equalsEpsilon(U,t.ZERO,d.EPSILON6)||(t.dot(U,g.right)<0&&t.negate(U,U),t.cross(U,g.direction,g.up),t.cross(g.direction,g.up,g.right),t.normalize(g.up,g.up),t.normalize(g.right,g.right))}g._setTransform(B),i._globe=R,i._ellipsoid=N;var W=N.maximumRadius;i._rotateFactor=1/W,i._rotateRateRangeAdjustment=W;var H=t.clone(g.positionWC,Ft);if(Q(i),!t.equals(g.positionWC,H)){g._setTransform(I),g.worldToCameraCoordinatesPoint(H,H);var q=t.magnitudeSquared(H);t.magnitudeSquared(g.position)>q&&(t.normalize(g.position,g.position),t.multiplyByScalar(g.position,Math.sqrt(q),g.position));var j=t.angleBetween(H,g.position),Y=t.cross(H,g.position,H);t.normalize(Y,Y);var X=v.fromAxisAngle(Y,j,kt),J=p.fromQuaternion(X,Vt);p.multiplyByVector(J,g.direction,g.direction),p.multiplyByVector(J,g.up,g.up),t.cross(g.direction,g.up,g.right),t.cross(g.right,g.direction,g.up),g._setTransform(B)}}function k(e,i,r){o(r.distance)&&(r=r.distance);var n=e._scene,a=n.camera,s=n.canvas,l=Ut;l.x=s.clientWidth/2,l.y=s.clientHeight/2;var u,c=a.getPickRay(l,Wt);a.position.z<e.minimumPickingTerrainHeight&&(u=L(e,l,Gt));var h;if(o(u))h=t.distance(c.origin,u);else{var d=t.UNIT_X,p=c.origin,m=c.direction;h=-t.dot(d,p)/t.dot(d,m)}A(e,i,r,e._zoomFactor,h)}function V(e){var t=e._scene,i=t.camera;if(m.equals(m.IDENTITY,i.transform)){var r=e._tweens;if(e._aggregator.anyButtonDown&&r.removeAll(),P(e,e.enableTilt,e.tiltEventTypes,F,e.inertiaSpin,"_lastInertiaTiltMovement"),P(e,e.enableTranslate,e.translateEventTypes,N,e.inertiaTranslate,"_lastInertiaTranslateMovement"),P(e,e.enableZoom,e.zoomEventTypes,k,e.inertiaZoom,"_lastInertiaZoomMovement"),P(e,e.enableLook,e.lookEventTypes,Z),!(e._aggregator.anyButtonDown||o(e._lastInertiaZoomMovement)&&e._lastInertiaZoomMovement.active||o(e._lastInertiaTranslateMovement)&&e._lastInertiaTranslateMovement.active||r.contains(e._tween))){var n=i.createCorrectPositionTween(e.bounceAnimationTime);o(n)&&(e._tween=r.add(n))}r.update()}else P(e,e.enableRotate,e.rotateEventTypes,G,e.inertiaSpin,"_lastInertiaSpinMovement"),P(e,e.enableZoom,e.zoomEventTypes,q,e.inertiaZoom,"_lastInertiaZoomMovement")}function U(e,i,r){var n=e._scene,a=n.camera,s=L(e,r.startPosition,Jt);if(o(s)){var l=r.endPosition,c=a.getPickRay(l,Ht),h=t.clone(a.direction,Yt);n.mode===w.COLUMBUS_VIEW&&t.fromElements(h.z,h.x,h.y,h);var d=f.fromPointNormal(s,h,qt),p=u.rayPlane(c,d,jt);o(p)&&(h=t.subtract(s,p,h),n.mode===w.COLUMBUS_VIEW&&t.fromElements(h.y,h.z,h.x,h),t.add(a.position,h,a.position))}}function W(i,r,n){var a=i._scene,s=a.camera;if(!m.equals(s.transform,m.IDENTITY))return G(i,r,n),void 0;var u,c,h,d,p=i._ellipsoid.geodeticSurfaceNormal(s.position,$t),f=i._ellipsoid.cartesianToCartographic(s.positionWC,Zt).height,v=i._globe,g=!1;if(o(v)&&f<i.minimumPickingTerrainHeight&&(d=L(i,n.startPosition,Jt),o(d))){var _=s.getPickRay(n.startPosition,vt),y=i._ellipsoid.geodeticSurfaceNormal(d);g=Math.abs(t.dot(_.direction,y))<.05,g&&!i._looking&&(i._rotating=!1,i._strafing=!0)}return e.equals(r,i._rotateMousePosition)?(i._looking?Z(i,r,n,p):i._rotating?G(i,r,n):i._strafing?(t.clone(d,i._strafeStartPosition),U(i,r,n)):(u=t.magnitude(i._rotateStartPosition),c=Qt,c.x=c.y=c.z=u,h=l.fromCartesian3(c,Kt),H(i,r,n,h)),void 0):(i._looking=!1,i._rotating=!1,i._strafing=!1,o(v)&&f<i.minimumPickingTerrainHeight?o(d)?t.magnitude(s.position)<t.magnitude(d)?(t.clone(d,i._strafeStartPosition),i._strafing=!0,U(i,r,n)):(u=t.magnitude(d),c=Qt,c.x=c.y=c.z=u,h=l.fromCartesian3(c,Kt),H(i,r,n,h),t.clone(d,i._rotateStartPosition)):(i._looking=!0,Z(i,r,n,p)):o(s.pickEllipsoid(n.startPosition,i._ellipsoid,Xt))?(H(i,r,n,i._ellipsoid),t.clone(Xt,i._rotateStartPosition)):f>i.minimumTrackBallHeight?(i._rotating=!0,G(i,r,n)):(i._looking=!0,Z(i,r,n,p)),e.clone(r,i._rotateMousePosition),void 0)}function G(e,i,r,a,s,l){s=n(s,!1),l=n(l,!1);var u=e._scene,c=u.camera,h=u.canvas,d=c.constrainedAxis;o(a)&&(c.constrainedAxis=a);var p=t.magnitude(c.position),m=e._rotateFactor*(p-e._rotateRateRangeAdjustment);m>e._maximumRotateRate&&(m=e._maximumRotateRate),m<e._minimumRotateRate&&(m=e._minimumRotateRate);var f=(r.startPosition.x-r.endPosition.x)/h.clientWidth,v=(r.startPosition.y-r.endPosition.y)/h.clientHeight;f=Math.min(f,e.maximumMovementRatio),v=Math.min(v,e.maximumMovementRatio);var g=2*m*f*Math.PI,_=m*v*Math.PI;s||c.rotateRight(g),l||c.rotateUp(_),c.constrainedAxis=d}function H(i,r,n,a){var s=i._scene,l=s.camera,u=e.clone(n.startPosition,ai),c=e.clone(n.endPosition,si),h=l.pickEllipsoid(u,a,ei),p=l.pickEllipsoid(c,a,ti);if(!o(h)||!o(p))return i._rotating=!0,G(i,r,n),void 0;if(h=l.worldToCameraCoordinates(h,h),p=l.worldToCameraCoordinates(p,p),o(l.constrainedAxis)){var m=l.constrainedAxis,f=t.mostOrthogonalAxis(m,ii);t.cross(f,m,f),t.normalize(f,f);var v=t.cross(m,f,ri),g=t.magnitude(h),_=t.dot(m,h),y=Math.acos(_/g),C=t.multiplyByScalar(m,_,ni);t.subtract(h,C,C),t.normalize(C,C);var w=t.magnitude(p),S=t.dot(m,p),E=Math.acos(S/w),b=t.multiplyByScalar(m,S,oi);t.subtract(p,b,b),t.normalize(b,b);var x=Math.acos(t.dot(C,f));t.dot(C,v)<0&&(x=d.TWO_PI-x);var T=Math.acos(t.dot(b,f));t.dot(b,v)<0&&(T=d.TWO_PI-T);var P,A=x-T;P=t.equalsEpsilon(m,l.position,d.EPSILON2)?l.right:t.cross(m,l.position,ii);var D,M=t.cross(m,P,ii),I=t.dot(M,t.subtract(h,m,ri)),O=t.dot(M,t.subtract(p,m,ri));D=I>0&&O>0?E-y:I>0&&0>=O?t.dot(l.position,m)>0?-y-E:y+E:y-E,l.rotateRight(A),l.rotateUp(D)}else{t.normalize(h,h),t.normalize(p,p);var R=t.dot(h,p),L=t.cross(h,p,ii);if(1>R&&!t.equalsEpsilon(L,t.ZERO,d.EPSILON14)){var N=Math.acos(R);l.rotate(L,N)}}}function q(e,i,r){o(r.distance)&&(r=r.distance);var n=e._ellipsoid,a=e._scene,s=a.camera,l=a.canvas,u=Ut;u.x=l.clientWidth/2,u.y=l.clientHeight/2;var c,h=s.getPickRay(u,Wt),d=n.cartesianToCartographic(s.position,ui).height;d<e.minimumPickingTerrainHeight&&(c=L(e,u,Gt));var p;p=o(c)?t.distance(h.origin,c):d;var m=t.normalize(s.position,li);A(e,i,r,e._zoomFactor,p,t.dot(m,s.direction))}function j(t,i,r){var n=t._scene,a=n.camera;if(m.equals(a.transform,m.IDENTITY)){if(o(r.angleAndHeight)&&(r=r.angleAndHeight),e.equals(i,t._tiltCenterMousePosition)||(t._tiltOnEllipsoid=!1,t._looking=!1),t._looking){var s=t._ellipsoid.geodeticSurfaceNormal(a.position,wi);return Z(t,i,r,s),void 0}var l=t._ellipsoid,u=l.cartesianToCartographic(a.position,Ci);t._tiltOnEllipsoid||u.height>t.minimumCollisionTerrainHeight?(t._tiltOnEllipsoid=!0,Y(t,i,r)):X(t,i,r)}}function Y(i,r,n){var a=i._ellipsoid,s=i._scene,c=s.camera,h=.25*i.minimumZoomDistance,p=a.cartesianToCartographic(c.positionWC,Si).height;if(!(p-h-1<d.EPSILON3&&n.endPosition.y-n.startPosition.y<0)){var f=s.canvas,v=ci;v.x=f.clientWidth/2,v.y=f.clientHeight/2;var y,C=c.getPickRay(v,hi),w=u.rayEllipsoid(C,a);if(o(w))y=g.getPoint(C,w.start,di);else{if(!(p>i.minimumTrackBallHeight)){i._looking=!0;var S=i._ellipsoid.geodeticSurfaceNormal(c.position,wi);return Z(i,r,n,S),e.clone(r,i._tiltCenterMousePosition),void 0}var E=u.grazingAltitudeLocation(C,a);if(!o(E))return;var b=a.cartesianToCartographic(E,Ci);b.height=0,y=a.cartographicToCartesian(b,di)}var x=_.eastNorthUpToFixedFrame(y,a,mi),T=i._globe,P=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var A=m.clone(c.transform,gi);c._setTransform(x),G(i,r,n,t.UNIT_Z),c._setTransform(A),i._globe=T,i._ellipsoid=P;var D=P.maximumRadius;i._rotateFactor=1/D,i._rotateRateRangeAdjustment=D}}function X(i,r,n){var a,s,c,h=i._ellipsoid,f=i._scene,y=f.camera;if(e.equals(r,i._tiltCenterMousePosition))a=t.clone(i._tiltCenter,di);else{if(a=L(i,r,di),!o(a)){if(s=y.getPickRay(r,hi),c=u.rayEllipsoid(s,h),!o(c)){var C=h.cartesianToCartographic(y.position,Ci);if(C.height<=i.minimumTrackBallHeight){i._looking=!0;var w=i._ellipsoid.geodeticSurfaceNormal(y.position,wi);Z(i,r,n,w),e.clone(r,i._tiltCenterMousePosition)}return}a=g.getPoint(s,c.start,di)}e.clone(r,i._tiltCenterMousePosition),t.clone(a,i._tiltCenter)}var S=f.canvas,E=ci;E.x=S.clientWidth/2,E.y=i._tiltCenterMousePosition.y,s=y.getPickRay(E,hi);var b=t.magnitude(a),x=t.fromElements(b,b,b,Qt),T=l.fromCartesian3(x,Kt);if(c=u.rayEllipsoid(s,T),o(c)){var P=t.magnitude(s.origin)>b?c.start:c.stop,A=g.getPoint(s,P,pi),D=_.eastNorthUpToFixedFrame(a,h,mi),M=_.eastNorthUpToFixedFrame(A,T,fi),I=i._globe,O=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var R=t.UNIT_Z,N=m.clone(y.transform,gi);y._setTransform(D);var F=t.cross(A,y.positionWC,vi),B=t.dot(y.rightWC,F);if(G(i,r,n,R,!1,!0),y._setTransform(M),0>B){n.startPosition.y>n.endPosition.y&&(R=void 0);var z=y.constrainedAxis;y.constrainedAxis=void 0,G(i,r,n,R,!0,!1),y.constrainedAxis=z}else G(i,r,n,R,!0,!1);if(o(y.constrainedAxis)){var k=t.cross(y.direction,y.constrainedAxis,vi);t.equalsEpsilon(k,t.ZERO,d.EPSILON6)||(t.dot(k,y.right)<0&&t.negate(k,k),t.cross(k,y.direction,y.up),t.cross(y.direction,y.up,y.right),t.normalize(y.up,y.up),t.normalize(y.right,y.right))}y._setTransform(N),i._globe=I,i._ellipsoid=O;var V=O.maximumRadius;i._rotateFactor=1/V,i._rotateRateRangeAdjustment=V;var U=t.clone(y.positionWC,vi);if(Q(i),!t.equals(y.positionWC,U)){y._setTransform(M),y.worldToCameraCoordinatesPoint(U,U);var W=t.magnitudeSquared(U);t.magnitudeSquared(y.position)>W&&(t.normalize(y.position,y.position),t.multiplyByScalar(y.position,Math.sqrt(W),y.position));var H=t.angleBetween(U,y.position),q=t.cross(U,y.position,U);t.normalize(q,q);var j=v.fromAxisAngle(q,H,_i),Y=p.fromQuaternion(j,yi);p.multiplyByVector(Y,y.direction,y.direction),p.multiplyByVector(Y,y.up,y.up),t.cross(y.direction,y.up,y.right),t.cross(y.right,y.direction,y.up),y._setTransform(N)}}}function Z(e,i,r,a){var s=e._scene,l=s.camera,u=Ei;u.x=r.startPosition.x,u.y=0;var c=bi;c.x=r.endPosition.x,c.y=0;var h=l.getPickRay(u,xi).direction,p=l.getPickRay(c,Ti).direction,m=0,f=t.dot(h,p);1>f&&(m=Math.acos(f)),m=r.startPosition.x>r.endPosition.x?-m:m;var v=e._horizontalRotationAxis;if(o(a)?l.look(a,-m):o(v)?l.look(v,-m):l.lookLeft(m),u.x=0,u.y=r.startPosition.y,c.x=0,c.y=r.endPosition.y,h=l.getPickRay(u,xi).direction,p=l.getPickRay(c,Ti).direction,m=0,f=t.dot(h,p),1>f&&(m=Math.acos(f)),m=r.startPosition.y>r.endPosition.y?-m:m,a=n(a,v),o(a)){var g=l.direction,_=t.negate(a,Pi),y=t.equalsEpsilon(g,a,d.EPSILON2),C=t.equalsEpsilon(g,_,d.EPSILON2);if(y||C)(y&&0>m||C&&m>0)&&l.look(l.right,-m);else{f=t.dot(g,a);var w=d.acosClamped(f);m>0&&m>w&&(m=w-d.EPSILON4),f=t.dot(g,_),w=d.acosClamped(f),0>m&&-m>w&&(m=-w+d.EPSILON4);var S=t.cross(a,g,Ai);l.look(S,m)}}else l.lookUp(m)}function J(e){P(e,e.enableRotate,e.rotateEventTypes,W,e.inertiaSpin,"_lastInertiaSpinMovement"),P(e,e.enableZoom,e.zoomEventTypes,q,e.inertiaZoom,"_lastInertiaZoomMovement"),P(e,e.enableTilt,e.tiltEventTypes,j,e.inertiaSpin,"_lastInertiaTiltMovement"),P(e,e.enableLook,e.lookEventTypes,Z)}function Q(e){if(e.enableCollisionDetection){var i=e._scene,r=i.mode,n=i.globe;if(o(n)&&r!==w.SCENE2D&&r!==w.MORPHING){var a,s,l=i.camera,u=n.ellipsoid,c=i.mapProjection;m.equals(l.transform,m.IDENTITY)||(a=m.clone(l.transform),s=t.magnitude(l.position),l._setTransform(m.IDENTITY));var h=Di;r===w.SCENE3D?u.cartesianToCartographic(l.position,h):c.unproject(l.position,h);var d=!1;if(h.height<e.minimumCollisionTerrainHeight){var p=n.getHeight(h);o(p)&&(p+=e.minimumZoomDistance,h.height<p&&(h.height=p,r===w.SCENE3D?u.cartographicToCartesian(h,l.position):c.project(h,l.position),d=!0))}o(a)&&(l._setTransform(a),d&&(t.normalize(l.position,l.position),t.negate(l.position,l.direction),t.multiplyByScalar(l.position,Math.max(s,e.minimumZoomDistance),l.position),t.normalize(l.direction,l.direction),t.cross(l.direction,l.up,l.right),t.cross(l.right,l.direction,l.up)))}}}var K=function(i){this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=20,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=C.LEFT_DRAG,this.zoomEventTypes=[C.RIGHT_DRAG,C.WHEEL,C.PINCH],this.rotateEventTypes=C.LEFT_DRAG,this.tiltEventTypes=[C.MIDDLE_DRAG,C.PINCH,{eventType:C.LEFT_DRAG,modifier:h.CTRL}],this.lookEventTypes={eventType:C.LEFT_DRAG,modifier:h.SHIFT},this.minimumPickingTerrainHeight=15e4,this.minimumCollisionTerrainHeight=15e3,this.minimumTrackBallHeight=75e5,this.enableCollisionDetection=!0,this._scene=i,this._globe=void 0,this._ellipsoid=void 0,this._aggregator=new y(i.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaWheelZoomMovement=void 0,this._lastInertiaTiltMovement=void 0,this._tweens=new E,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new e(-1,-1),this._tiltCenter=new t,this._rotateMousePosition=new e(-1,-1),this._rotateStartPosition=new t,this._strafeStartPosition=new t,this._zoomMouseStart=new e,this._zoomWorldPosition=new t,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._rotatingZoom=!1;var n=i.mapProjection;this._maxCoord=n.project(new r(Math.PI,d.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=2e-4,this._translateFactor=1,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3},$=.4,et=[],tt=new g,it=new t,rt=new e,nt=new t,ot=new e,at=new t,st=new t,lt=new t,ut=new t,ct=new t,ht=new g,dt=new g,pt=new t,mt=new e,ft=new e,vt=new g,gt=new t,_t=new t,yt=new g,Ct=new g,wt=new t,St=new t,Et=new t,bt=new t,xt=new f(t.ZERO,0),Tt=new e,Pt=new e,At=new e,Dt=new g,Mt=new t,It=new t,Ot=new m,Rt=new m,Lt=new t,Nt=new f(t.ZERO,0),Ft=new t,Bt=new r,zt=new m,kt=new v,Vt=new p,Ut=new e,Wt=new g,Gt=new t,Ht=new g,qt=new f(t.ZERO,0),jt=new t,Yt=new t,Xt=new t;new g;var Zt=new r,Jt=new t,Qt=new t,Kt=new l,$t=new t,ei=i.clone(i.UNIT_W),ti=i.clone(i.UNIT_W),ii=new t,ri=new t,ni=new t,oi=new t,ai=new e,si=new e,li=new t,ui=new r,ci=new e,hi=new g,di=new t,pi=new t,mi=new m,fi=new m,vi=new t,gi=new m,_i=new v,yi=new p,Ci=new r,wi=new t,Si=new r,Ei=new e,bi=new e,xi=new g,Ti=new g,Pi=new t,Ai=new t,Di=new r;return K.prototype.update=function(){m.equals(this._scene.camera.transform,m.IDENTITY)?(this._globe=this._scene.globe,this._ellipsoid=o(this._globe)?this._globe.ellipsoid:this._scene.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=l.UNIT_SPHERE);var e=this._ellipsoid.maximumRadius;this._rotateFactor=1/e,this._rotateRateRangeAdjustment=e;var i=this._scene,r=i.mode;r===w.SCENE2D?R(this):r===w.COLUMBUS_VIEW?(this._horizontalRotationAxis=t.UNIT_Z,V(this)):r===w.SCENE3D&&(this._horizontalRotationAxis=void 0,J(this)),Q(this),this._aggregator.reset()},K.prototype.isDestroyed=function(){return!1},K.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),a(this)},K}),i("Shaders/PostProcessFilters/AdditiveBlend",[],function(){"use strict";return"uniform sampler2D u_texture0;\nuniform sampler2D u_texture1;\nuniform vec2 u_center;\nuniform float u_radius;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color0 = texture2D(u_texture0, v_textureCoordinates);\nvec4 color1 = texture2D(u_texture1, v_textureCoordinates);\nfloat x = length(gl_FragCoord.xy - u_center) / u_radius;\nfloat t = smoothstep(0.5, 0.8, x);\ngl_FragColor = mix(color0 + color1, color0, t);\n}\n"}),i("Shaders/PostProcessFilters/BrightPass",[],function(){"use strict";return"uniform sampler2D u_texture;\nuniform float u_avgLuminance;\nuniform float u_threshold;\nuniform float u_offset;\nvarying vec2 v_textureCoordinates;\nfloat key(float avg)\n{\nfloat guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\nreturn max(0.0, guess) + 0.1;\n}\nvoid main()\n{\nvec4 color = texture2D(u_texture, v_textureCoordinates);\nvec3 xyz = czm_RGBToXYZ(color.rgb);\nfloat luminance = xyz.r;\nfloat scaledLum = key(u_avgLuminance) * luminance / u_avgLuminance;\nfloat brightLum = max(scaledLum - u_threshold, 0.0);\nfloat brightness = brightLum / (u_offset + brightLum);\nxyz.r = brightness;\ngl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n" -}),i("Shaders/PostProcessFilters/GaussianBlur1D",[],function(){"use strict";return"#define SAMPLES 8\nuniform float delta;\nuniform float sigma;\nuniform float direction;\nuniform sampler2D u_texture;\nuniform vec2 u_step;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nvec2 dir = vec2(1.0 - direction, direction);\nvec3 g;\ng.x = 1.0 / (sqrt(czm_twoPi) * sigma);\ng.y = exp((-0.5 * delta * delta) / (sigma * sigma));\ng.z = g.y * g.y;\nvec4 result = texture2D(u_texture, st) * g.x;\nfor (int i = 1; i < SAMPLES; ++i)\n{\ng.xy *= g.yz;\nvec2 offset = float(i) * dir * u_step;\nresult += texture2D(u_texture, st - offset) * g.x;\nresult += texture2D(u_texture, st + offset) * g.x;\n}\ngl_FragColor = result;\n}\n"}),i("Scene/SunPostProcess",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian4","../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/Math","../Core/Matrix4","../Core/PixelFormat","../Core/Transforms","../Renderer/ClearCommand","../Renderer/PassState","../Renderer/PixelDatatype","../Renderer/RenderbufferFormat","../Shaders/PostProcessFilters/AdditiveBlend","../Shaders/PostProcessFilters/BrightPass","../Shaders/PostProcessFilters/GaussianBlur1D","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_){"use strict";var y=function(){this._fbo=void 0,this._downSampleFBO1=void 0,this._downSampleFBO2=void 0,this._clearFBO1Command=void 0,this._clearFBO2Command=void 0,this._downSampleCommand=void 0,this._brightPassCommand=void 0,this._blurXCommand=void 0,this._blurYCommand=void 0,this._blendCommand=void 0,this._fullScreenCommand=void 0,this._downSamplePassState=new d,this._downSamplePassState.scissorTest={enable:!0,rectangle:new e},this._upSamplePassState=new d,this._upSamplePassState.scissorTest={enabled:!0,rectangle:new e},this._uCenter=new t,this._uRadius=void 0,this._blurStep=new t};y.prototype.clear=function(e,t){var i=this._clearFBO1Command;r.clone(n(t,r.BLACK),i.color),i.execute(e),i=this._clearFBO2Command,r.clone(n(t,r.BLACK),i.color),i.execute(e)},y.prototype.execute=function(e,t){this._downSampleCommand.execute(e,this._downSamplePassState),this._brightPassCommand.execute(e,this._downSamplePassState),this._blurXCommand.execute(e,this._downSamplePassState),this._blurYCommand.execute(e,this._downSamplePassState),this._fullScreenCommand.framebuffer=t,this._blendCommand.framebuffer=t,this._fullScreenCommand.execute(e),this._blendCommand.execute(e,this._upSamplePassState)};var C=new e,w=new e,S=new i,E=new t,b=new t,x=new l;return y.prototype.update=function(e){var i=e.drawingBufferWidth,n=e.drawingBufferHeight,a=this;if(!o(this._downSampleCommand)){this._clearFBO1Command=new h({color:new r}),this._clearFBO2Command=new h({color:new r});var d,y={};this._downSampleCommand=e.createViewportQuadCommand(_,{renderState:d,uniformMap:y,owner:this}),y={u_avgLuminance:function(){return.5},u_threshold:function(){return.25},u_offset:function(){return.1}},this._brightPassCommand=e.createViewportQuadCommand(v,{renderState:d,uniformMap:y,owner:this});var T=1,P=2;y={delta:function(){return T},sigma:function(){return P},direction:function(){return 0}},this._blurXCommand=e.createViewportQuadCommand(g,{renderState:d,uniformMap:y,owner:this}),y={delta:function(){return T},sigma:function(){return P},direction:function(){return 1}},this._blurYCommand=e.createViewportQuadCommand(g,{renderState:d,uniformMap:y,owner:this}),y={u_center:function(){return a._uCenter},u_radius:function(){return a._uRadius}},this._blendCommand=e.createViewportQuadCommand(f,{renderState:d,uniformMap:y,owner:this}),y={},this._fullScreenCommand=e.createViewportQuadCommand(_,{renderState:d,uniformMap:y,owner:this})}var A=Math.pow(2,Math.ceil(Math.log(i)/Math.log(2))-2),D=Math.pow(2,Math.ceil(Math.log(n)/Math.log(2))-2),M=Math.max(A,D),I=C;I.width=i,I.height=n;var O=w;O.width=M,O.height=M;var R=this._fbo,L=o(R)&&R.getColorTexture(0)||void 0;if(!o(L)||L.width!==i||L.height!==n){R=R&&R.destroy(),this._downSampleFBO1=this._downSampleFBO1&&this._downSampleFBO1.destroy(),this._downSampleFBO2=this._downSampleFBO2&&this._downSampleFBO2.destroy(),this._blurStep.x=this._blurStep.y=1/M;var N=[e.createTexture2D({width:i,height:n})];R=this._fbo=e.depthTexture?e.createFramebuffer({colorTextures:N,depthTexture:e.createTexture2D({width:i,height:n,pixelFormat:u.DEPTH_COMPONENT,pixelDatatype:p.UNSIGNED_SHORT})}):e.createFramebuffer({colorTextures:N,depthRenderbuffer:e.createRenderbuffer({format:m.DEPTH_COMPONENT16})}),this._downSampleFBO1=e.createFramebuffer({colorTextures:[e.createTexture2D({width:M,height:M})]}),this._downSampleFBO2=e.createFramebuffer({colorTextures:[e.createTexture2D({width:M,height:M})]}),this._clearFBO1Command.framebuffer=this._downSampleFBO1,this._clearFBO2Command.framebuffer=this._downSampleFBO2,this._downSampleCommand.framebuffer=this._downSampleFBO1,this._brightPassCommand.framebuffer=this._downSampleFBO2,this._blurXCommand.framebuffer=this._downSampleFBO1,this._blurYCommand.framebuffer=this._downSampleFBO2;var F=e.createRenderState({viewport:O}),B=e.createRenderState();this._downSampleCommand.uniformMap.u_texture=function(){return R.getColorTexture(0)},this._downSampleCommand.renderState=F,this._brightPassCommand.uniformMap.u_texture=function(){return a._downSampleFBO1.getColorTexture(0)},this._brightPassCommand.renderState=F,this._blurXCommand.uniformMap.u_texture=function(){return a._downSampleFBO2.getColorTexture(0)},this._blurXCommand.uniformMap.u_step=function(){return a._blurStep},this._blurXCommand.renderState=F,this._blurYCommand.uniformMap.u_texture=function(){return a._downSampleFBO1.getColorTexture(0)},this._blurYCommand.uniformMap.u_step=function(){return a._blurStep},this._blurYCommand.renderState=F,this._blendCommand.uniformMap.u_texture0=function(){return R.getColorTexture(0)},this._blendCommand.uniformMap.u_texture1=function(){return a._downSampleFBO2.getColorTexture(0)},this._blendCommand.renderState=B,this._fullScreenCommand.uniformMap.u_texture=function(){return R.getColorTexture(0)},this._fullScreenCommand.renderState=B}var z=e.uniformState,k=z.sunPositionWC,V=z.view,U=z.viewProjection,W=z.projection,G=l.computeViewportTransformation(I,0,1,x),H=l.multiplyByPoint(V,k,S),q=c.pointToGLWindowCoordinates(U,G,k,E);H.x+=s.SOLAR_RADIUS;var j=c.pointToGLWindowCoordinates(W,G,H,H),Y=2*30*t.magnitude(t.subtract(j,q,j)),X=b;X.x=Y,X.y=Y;var Z=this._upSamplePassState.scissorTest.rectangle;return Z.x=Math.max(q.x-.5*X.x,0),Z.y=Math.max(q.y-.5*X.y,0),Z.width=Math.min(X.x,i),Z.height=Math.min(X.y,n),this._uCenter=t.clone(q,this._uCenter),this._uRadius=.5*Math.max(X.x,X.y),G=l.computeViewportTransformation(O,0,1,x),q=c.pointToGLWindowCoordinates(U,G,k,E),X.x*=A/i,X.y*=D/n,Z=this._downSamplePassState.scissorTest.rectangle,Z.x=Math.max(q.x-.5*X.x,0),Z.y=Math.max(q.y-.5*X.y,0),Z.width=Math.min(X.x,i),Z.height=Math.min(X.y,n),this._downSamplePassState.context=e,this._upSamplePassState.context=e,this._fbo},y.prototype.isDestroyed=function(){return!1},y.prototype.destroy=function(){return this._fbo=this._fbo&&this._fbo.destroy(),this._downSampleFBO1=this._downSampleFBO1&&this._downSampleFBO1.destroy(),this._downSampleFBO2=this._downSampleFBO2&&this._downSampleFBO2.destroy(),this._downSampleCommand=this._downSampleCommand&&this._downSampleCommand.shaderProgram&&this._downSampleCommand.shaderProgram.destroy(),this._brightPassCommand=this._brightPassCommand&&this._brightPassCommand.shaderProgram&&this._brightPassCommand.shaderProgram.destroy(),this._blurXCommand=this._blurXCommand&&this._blurXCommand.shaderProgram&&this._blurXCommand.shaderProgram.destroy(),this._blurYCommand=this._blurYCommand&&this._blurYCommand.shaderProgram&&this._blurYCommand.shaderProgram.destroy(),this._blendCommand=this._blendCommand&&this._blendCommand.shaderProgram&&this._blendCommand.shaderProgram.destroy(),this._fullScreenCommand=this._fullScreenCommand&&this._fullScreenCommand.shaderProgram&&this._fullScreenCommand.shaderProgram.destroy(),a(this)},y}),i("Scene/Scene",["../Core/BoundingRectangle","../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EllipsoidGeometry","../Core/Event","../Core/GeographicProjection","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/getTimestamp","../Core/Intersect","../Core/Interval","../Core/JulianDate","../Core/Math","../Core/Matrix4","../Core/mergeSort","../Core/Occluder","../Core/ShowGeometryInstanceAttribute","../Renderer/ClearCommand","../Renderer/Context","../Renderer/PassState","./Camera","./CreditDisplay","./CullingVolume","./FrameState","./FrustumCommands","./FXAA","./GlobeDepth","./OIT","./OrthographicFrustum","./Pass","./PerformanceDisplay","./PerInstanceColorAppearance","./PerspectiveFrustum","./PerspectiveOffCenterFrustum","./PickDepth","./Primitive","./PrimitiveCollection","./SceneMode","./SceneTransforms","./SceneTransitioner","./ScreenSpaceCameraController","./SunPostProcess","./TweenCollection"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B,z,k,V,U,W,G,H,q,j,Y,X,Z,J,Q,K){"use strict";function $(e,t){var i=Math.max(Math.abs(e.x),Math.abs(t.x)),r=Math.max(Math.abs(e.y),Math.abs(t.y)),n=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(i,r),n)}function et(e,t,i){var n=1/Math.max(1,$(e.position,t.position));return r.multiplyByScalar(e.position,n,Pt),r.multiplyByScalar(t.position,n,At),r.equalsEpsilon(Pt,At,i)&&r.equalsEpsilon(e.direction,t.direction,i)&&r.equalsEpsilon(e.up,t.up,i)&&r.equalsEpsilon(e.right,t.right,i)&&E.equalsEpsilon(e.transform,t.transform,i)}function tt(e){var t=e.globe;if(e._mode===Y.SCENE3D&&u(t)){var i=t.ellipsoid;return Dt.radius=i.minimumRadius,Tt=x.fromBoundingSphere(Dt,e._camera.positionWC,Tt)}return void 0}function it(e){e.render=!1,e.pick=!1}function rt(e,t,i){var r=e._camera,n=e._frameState;n.mode=e._mode,n.morphTime=e.morphTime,n.mapProjection=e.mapProjection,n.frameNumber=t,n.time=w.clone(i,n.time),n.camera=r,n.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),n.occluder=tt(e),it(n.passes)}function nt(e,t,i,r,n){n.length=r;for(var o=0;r>o;++o){var a=Math.max(e,Math.pow(i,o)*e),s=Math.min(t,i*a),l=n[o];u(l)?(l.near=a,l.far=s):l=n[o]=new L(a,s)}}function ot(e,t,i){e.debugShowFrustums&&(t.debugOverlappingFrustums=0);for(var r=e._frustumCommandsList,n=r.length,o=0;n>o;++o){var a=r[o],s=a.near,l=a.far;if(!(i.start>l)){if(i.stop<s)break;var c=t instanceof P?k.OPAQUE:t.pass,h=a.indices[c]++;if(a.commands[c][h]=t,e.debugShowFrustums&&(t.debugOverlappingFrustums|=1<<o),t.executeInClosestFrustum)break}}if(e.debugShowFrustums){var d=e._debugFrustumStatistics.commandsInFrustums;d[t.debugOverlappingFrustums]=u(d[t.debugOverlappingFrustums])?d[t.debugOverlappingFrustums]+1:1,++e._debugFrustumStatistics.totalCommands}}function at(e){var i=e._commandList,r=e._overlayCommandList,n=e._frameState.cullingVolume,o=e._camera,a=o.directionWC,s=o.positionWC;e.debugShowFrustums&&(e._debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});for(var l=e._frustumCommandsList,c=l.length,h=k.NUMBER_OF_PASSES,d=0;c>d;++d)for(var p=0;h>p;++p)l[d].indices[p]=0;r.length=0;var m,f=Number.MAX_VALUE,v=Number.MIN_VALUE,g=!1;e._frameState.mode===Y.SCENE3D&&(m=e._frameState.occluder);for(var _=Mt.planes,C=0;5>C;++C)_[C]=n.planes[C];n=Mt;for(var w=i.length,S=0;w>S;++S){var E=i[S],b=E.pass;if(b===k.OVERLAY)r.push(E);else{var x=E.boundingVolume;if(u(x)){if(E.cull&&(n.computeVisibility(x)===y.OUTSIDE||u(m)&&!m.isBoundingSphereVisible(x)))continue;It=t.computePlaneDistances(x,s,a,It),f=Math.min(f,It.start),v=Math.max(v,It.stop)}else It.start=o.frustum.near,It.stop=o.frustum.far,g=!(E instanceof P);ot(e,E,It)}}g?(f=o.frustum.near,v=o.frustum.far):(f=Math.min(Math.max(f,o.frustum.near),o.frustum.far),v=Math.max(Math.min(v,o.frustum.far),f));var T=e.farToNearRatio,A=Math.ceil(Math.log(v/f)/Math.log(T));f!==Number.MAX_VALUE&&(A!==c||0!==l.length&&(f<l[0].near||v>l[c-1].far))&&(nt(f,v,T,A,l),at(e))}function st(e){var t={},i=e.vertexAttributes;for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r].index);return t}function lt(e,t,i){var r=t.context,n=l(i,e.shaderProgram),a=n.fragmentShaderSource.clone();a.sources=a.sources.map(function(e){return e=e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,"void czm_Debug_main()")});var s="void main() \n{ \n czm_Debug_main(); \n";if(t.debugShowCommands){u(e._debugColor)||(e._debugColor=o.fromRandom());var c=e._debugColor;s+=" gl_FragColor.rgb *= vec3("+c.red+", "+c.green+", "+c.blue+"); \n"}if(t.debugShowFrustums){var h=1&e.debugOverlappingFrustums?"1.0":"0.0",d=2&e.debugOverlappingFrustums?"1.0":"0.0",p=4&e.debugOverlappingFrustums?"1.0":"0.0";s+=" gl_FragColor.rgb *= vec3("+h+", "+d+", "+p+"); \n"}s+="}",a.sources.push(s);var m=st(n);return r.createShaderProgram(n.vertexShaderSource,a,m)}function ut(e,t,i,r,n){if(u(e.shaderProgram)||u(n)){var o=lt(e,t,n);e.execute(t.context,i,r,o),o.destroy()}}function ct(e,t,i,n,o,s,l){if((!u(t.debugCommandFilter)||t.debugCommandFilter(e))&&(t.debugShowCommands||t.debugShowFrustums?ut(e,t,n,o,s):e.execute(i,n,o,s),e.debugShowBoundingVolume&&u(e.boundingVolume))){u(t._debugSphere)&&t._debugSphere.destroy();var c=t._frameState,h=e.boundingVolume,d=h.radius,m=h.center,f=g.toWireframe(p.createGeometry(new p({radii:new r(d,d,d),vertexFormat:U.FLAT_VERTEX_FORMAT})));if(c.mode!==Y.SCENE3D){m=E.multiplyByPoint(Ot,m,m);var _=c.mapProjection,y=_.unproject(m);m=_.ellipsoid.cartographicToCartesian(y)}t._debugSphere=new q({geometryInstances:new v({geometry:f,modelMatrix:E.multiplyByTranslation(E.IDENTITY,m,new E),attributes:{color:new a(1,0,0,1)}}),appearance:new U({flat:!0,translucent:!1}),asynchronous:!1});var C=[];t._debugSphere.update(i,c,C);var w;u(l)&&(w=n.framebuffer,n.framebuffer=l),C[0].execute(i,n),u(w)&&(n.framebuffer=w)}}function ht(e,t){if(u(e)){for(var i=t.mode===Y.SCENE3D?t.occluder:void 0,r=t.cullingVolume,n=Mt.planes,o=0;5>o;++o)n[o]=r.planes[o];r=Mt;var a=e.boundingVolume;return u(e)&&(!u(e.boundingVolume)||!e.cull||r.computeVisibility(a)!==y.OUTSIDE&&(!u(i)||i.isBoundingSphereVisible(a)))}}function dt(e,i,r){return t.distanceSquaredTo(i.boundingVolume,r)-t.distanceSquaredTo(e.boundingVolume,r)}function pt(e,t,i,r){var n=e.context;b(r,dt,e._camera.positionWC);for(var o=r.length,a=0;o>a;++a)t(r[a],e,n,i)}function mt(e,t){var i=e._debugGlobeDepths[t];return!u(i)&&e.context.depthTexture&&(i=new F,e._debugGlobeDepths[t]=i),i}function ft(e,t){var i=e._pickDepths[t];return u(i)||(i=new H,e._pickDepths[t]=i),i}function vt(e,t,i,r){var n,a,s=e._frameState,l=e._camera,c=e.context,h=c.uniformState;u(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom?e._sunPostProcess=new Q:u(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!u(e.sun)&&u(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);var d,p=s.passes.render,m=p&&u(e.skyBox)?e.skyBox.update(c,s):void 0,f=p&&u(e.skyAtmosphere)?e.skyAtmosphere.update(c,s):void 0,v=p&&u(e.sun)?e.sun.update(e):void 0,g=ht(v,s),_=p&&u(e.moon)?e.moon.update(c,s):void 0,y=ht(_,s),C=t.framebuffer;d=u(l.frustum.fov)?l.frustum.clone(Rt):u(l.frustum.infiniteProjectionMatrix)?l.frustum.clone(Lt):l.frustum.clone(Nt);var w=e._clearColorCommand;o.clone(i,w.color),w.execute(c,t),u(e._globeDepth)&&(e._globeDepth.update(c),e._globeDepth.clear(c,t,i));var S=!1,E=e._frustumCommandsList,b=E.length;for(n=0;b>n;++n)if(E[n].indices[k.TRANSLUCENT]>0){S=!0;break}var x=!r&&S&&u(e._oit)&&e._oit.isSupported();x&&(e._oit.update(c,e._globeDepth.framebuffer),e._oit.clear(c,t,i),x=x&&e._oit.isSupported());var T=!r&&e.fxaa;if(T){var P=!x&&u(e._globeDepth)?e._globeDepth._colorTexture:void 0;e._fxaa.update(c,P),e._fxaa.clear(c,t,i)}if(g&&e.sunBloom?t.framebuffer=e._sunPostProcess.update(c):u(e._globeDepth)?t.framebuffer=e._globeDepth.framebuffer:T&&(t.framebuffer=e._fxaa.getColorFramebuffer()),u(t.framebuffer)&&w.execute(c,t),d.near=l.frustum.near,d.far=l.frustum.far,h.updateFrustum(d),u(m)&&ct(m,e,c,t),u(f)&&ct(f,e,c,t),g&&(v.execute(c,t),e.sunBloom)){var A;A=u(e._globeDepth)?e._globeDepth.framebuffer:e.fxaa?e._fxaa.getColorFramebuffer():C,e._sunPostProcess.execute(c,A),t.framebuffer=A}y&&_.execute(c,t);var D;x?(u(e._executeOITFunction)||(e._executeOITFunction=function(e,t,i,r){e._oit.executeCommands(e,t,i,r)}),D=e._executeOITFunction):D=pt;var M=e._depthClearCommand;for(n=0;b>n;++n){var I=b-n-1,O=E[I];d.near=O.near,d.far=O.far,0!==I&&(d.near*=xt);var R,L=e.debugShowGlobeDepth?mt(e,I):e._globeDepth;e.debugShowGlobeDepth&&u(L)&&(R=t.framebuffer,t.framebuffer=L.framebuffer),h.updateFrustum(d),M.execute(c,t);var N=O.commands[k.GLOBE],F=O.indices[k.GLOBE];for(a=0;F>a;++a)ct(N[a],e,c,t);u(L)&&(e.copyGlobeDepth||e.debugShowGlobeDepth)&&(L.update(c),L.executeCopyDepth(c,t)),e.debugShowGlobeDepth&&u(L)&&(t.framebuffer=R);for(var B=k.GLOBE+1,z=k.TRANSLUCENT,V=B;z>V;++V)for(N=O.commands[V],F=O.indices[V],a=0;F>a;++a)ct(N[a],e,c,t);if(0!==I&&(d.near=O.near,h.updateFrustum(d)),N=O.commands[k.TRANSLUCENT],N.length=O.indices[k.TRANSLUCENT],D(e,ct,t,N),u(L)){var U=ft(e,I);U.update(c,L.framebuffer.depthStencilTexture),U.executeCopyDepth(c,t)}}if(e.debugShowGlobeDepth&&u(e._globeDepth)){var W=mt(e,e.debugShowDepthFrustum-1);W.executeDebugGlobeDepth(c,t)}if(e.debugShowPickDepth&&u(e._globeDepth)){var G=ft(e,e.debugShowDepthFrustum-1);G.executeDebugPickDepth(c,t)}x&&(t.framebuffer=T?e._fxaa.getColorFramebuffer():void 0,e._oit.execute(c,t)),T&&(t.framebuffer=C,e._fxaa.execute(c,t)),x||T||!u(e._globeDepth)||(t.framebuffer=C,e._globeDepth.executeCopyColor(c,t))}function gt(e,t){for(var i=e.context,r=e._overlayCommandList,n=r.length,o=0;n>o;++o)r[o].execute(i,t)}function _t(e){var t=e.context,i=e._frameState,r=e._commandList;e._globe&&e._globe.update(t,i,r),e._primitives.update(t,i,r)}function yt(e){for(var t=e.afterRender,i=0,r=t.length;r>i;++i)t[i]();t.length=0}function Ct(e,t){u(t)||(t=w.now());var i=e._camera;et(i,e._cameraClone,S.EPSILON6)?e._cameraStartFired&&_()-e._cameraMovedTime>e.cameraEventWaitTime&&(i.moveEnd.raiseEvent(),e._cameraStartFired=!1):(e._cameraStartFired||(i.moveStart.raiseEvent(),e._cameraStartFired=!0),e._cameraMovedTime=_(),M.clone(i,e._cameraClone)),e._preRender.raiseEvent(e,t);var r=e.context.uniformState,n=e._frameState,a=S.incrementWrap(n.frameNumber,15e6,1);rt(e,a,t),n.passes.render=!0,n.creditDisplay.beginFrame();var s=e.context;r.update(s,n),e._commandList.length=0,e._overlayCommandList.length=0,_t(e),at(e);var c=e._passState;if(c.framebuffer=void 0,c.blendingEnabled=void 0,c.scissorTest=void 0,vt(e,c,l(e.backgroundColor,o.BLACK)),gt(e,c),n.creditDisplay.endFrame(),e.debugShowFramesPerSecond){if(!u(e._performanceDisplay)){var h=document.createElement("div");h.className="cesium-performanceDisplay-defaultContainer";var d=e._canvas.parentNode;d.appendChild(h);var p=new V({container:h});e._performanceDisplay=p,e._performanceContainer=h}e._performanceDisplay.update()}else u(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer));s.endFrame(),yt(n),e._postRender.raiseEvent(e,t)}function wt(e,t){var i=e._camera,n=i.frustum,o=e.drawingBufferWidth,a=e.drawingBufferHeight,s=2/o*t.x-1;s*=.5*(n.right-n.left);var l=2/a*(a-t.y)-1;l*=.5*(n.top-n.bottom);var u=E.clone(i.transform,Ut);i._setTransform(E.IDENTITY);var c=r.clone(i.position,Bt);r.multiplyByScalar(i.right,s,zt),r.add(zt,c,c),r.multiplyByScalar(i.up,l,zt),r.add(zt,c,c),i._setTransform(u),r.fromElements(c.z,c.x,c.y,c),kt.x=o,kt.y=a;var h=n.getPixelSize(kt,void 0,Vt),d=Ft;return d.right=.5*h.x,d.left=-d.right,d.top=.5*h.y,d.bottom=-d.top,d.near=n.near,d.far=n.far,d.computeCullingVolume(c,i.directionWC,i.upWC)}function St(e,t,i,r){var n=e._camera,o=n.frustum,a=o.near,s=e.drawingBufferWidth,l=e.drawingBufferHeight,u=Math.tan(.5*o.fovy),c=o.aspectRatio*u,h=2/s*t.x-1,d=2/l*(l-t.y)-1,p=h*a*c,m=d*a*u;kt.x=s,kt.y=l;var f=o.getPixelSize(kt,void 0,Vt),v=.5*f.x*i,g=.5*f.y*r,_=Wt;return _.top=m+g,_.bottom=m-g,_.right=p+v,_.left=p-v,_.near=a,_.far=o.far,_.computeCullingVolume(n.positionWC,n.directionWC,n.upWC)}function Et(e,t,i,r){return e._mode===Y.SCENE2D?wt(e,t,i,r):St(e,t,i,r)}var bt=function(e){e=l(e,l.EMPTY_OBJECT);var t=e.canvas,i=e.contextOptions,r=e.creditContainer,n=new A(t,i);u(r)||(r=document.createElement("div"),r.style.position="absolute",r.style.bottom="0",r.style["text-shadow"]="0px 0px 2px #000000",r.style.color="#ffffff",r.style["font-size"]="10px",r.style["padding-right"]="5px",t.parentNode.appendChild(r)),this._id=s(),this._frameState=new R(new I(r)),this._frameState.scene3DOnly=l(e.scene3DOnly,!1),this._passState=new D(n),this._canvas=t,this._context=n,this._globe=void 0,this._primitives=new j,this._tweens=new K,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._commandList=[],this._frustumCommandsList=[],this._overlayCommandList=[],this._pickFramebuffer=void 0,this._useOIT=l(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0;var a;n.depthTexture&&(a=new F);var c;this._useOIT&&u(a)&&(c=new B(n)),this._globeDepth=a,this._oit=c,this._fxaa=new N,this._clearColorCommand=new P({color:new o,owner:this}),this._depthClearCommand=new P({depth:1,owner:this}),this._pickDepths=[],this._debugGlobeDepths=[],this._transitioner=new Z(this),this._renderError=new m,this._preRender=new m,this._postRender=new m,this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new m,this.morphComplete=new m,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=o.clone(o.BLACK),this._mode=Y.SCENE3D,this._mapProjection=u(e.mapProjection)?e.mapProjection:new f,this._transitioner=new Z(this,this._mapProjection.ellipsoid),this.morphTime=1,this.farToNearRatio=1e3,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this._debugFrustumStatistics=void 0,this.debugShowFramesPerSecond=!1,this.debugShowGlobeDepth=!1,this.debugShowDepthFrustum=1,this.fxaa=!0,this.cameraEventWaitTime=500,this.copyGlobeDepth=!1,this._performanceDisplay=void 0,this._debugSphere=void 0;var h=new M(this);this._camera=h,this._cameraClone=M.clone(h),this._screenSpaceCameraController=new J(this);var d=h.frustum.near,p=h.frustum.far,v=Math.ceil(Math.log(p/d)/Math.log(this.farToNearRatio));nt(d,p,this.farToNearRatio,v,this._frustumCommandsList),rt(this,0,w.now()),this.initializeFrame()},xt=.99;c(bt.prototype,{canvas:{get:function(){return this._canvas}},drawingBufferHeight:{get:function(){return this._context.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._context.drawingBufferWidth}},maximumAliasedLineWidth:{get:function(){return this._context.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return this._context.maximumCubeMapSize}},pickPositionSupported:{get:function(){return this._context.depthTexture}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e}},primitives:{get:function(){return this._primitives}},camera:{get:function(){return this._camera}},screenSpaceCameraController:{get:function(){return this._screenSpaceCameraController}},mapProjection:{get:function(){return this._mapProjection}},frameState:{get:function(){return this._frameState}},tweens:{get:function(){return this._tweens}},imageryLayers:{get:function(){return this.globe.imageryLayers}},terrainProvider:{get:function(){return this.globe.terrainProvider},set:function(e){this.globe.terrainProvider=e}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return u(this._oit)}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){if(this.scene3DOnly&&e!==Y.SCENE3D)throw new d("Only SceneMode.SCENE3D is valid when scene3DOnly is true.");this._mode=e}},numberOfFrustums:{get:function(){return this._frustumCommandsList.length}}});var Tt,Pt=new r,At=new r,Dt=new t,Mt=new O,It=new C,Ot=new E(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);Ot=E.inverseTransformation(Ot,Ot);var Rt=new W,Lt=new G,Nt=new z;bt.prototype.initializeFrame=function(){120===this._shaderFrameCount++&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms()),this._tweens.update(),this._camera.update(this._mode),this._screenSpaceCameraController.update()},bt.prototype.render=function(e){try{Ct(this,e)}catch(t){if(this._renderError.raiseEvent(this,t),this.rethrowRenderErrors)throw t}},bt.prototype.clampLineWidth=function(e){var t=this._context;return Math.max(t.minimumAliasedLineWidth,Math.min(e,t.maximumAliasedLineWidth))};var Ft=new z,Bt=new r,zt=new r,kt=new i,Vt=new i,Ut=new E,Wt=new G,Gt=3,Ht=3,qt=new e(0,0,Gt,Ht),jt=new o(0,0,0,0),Yt=new i;bt.prototype.pick=function(e){var t=this._context,i=t.uniformState,r=this._frameState,n=X.transformWindowToDrawingBuffer(this,e,Yt);u(this._pickFramebuffer)||(this._pickFramebuffer=t.createPickFramebuffer()),rt(this,r.frameNumber,r.time),r.cullingVolume=Et(this,n,Gt,Ht),r.passes.pick=!0,i.update(t,r),this._commandList.length=0,_t(this),at(this),qt.x=n.x-.5*(Gt-1),qt.y=this.drawingBufferHeight-n.y-.5*(Ht-1),vt(this,this._pickFramebuffer.begin(qt),jt,!0);var o=this._pickFramebuffer.end(qt);return t.endFrame(),yt(r),o},new r,new r;var Xt=new n,Zt=new n(1,1/255,1/65025,1/160581375);return bt.prototype.pickPosition=function(e,t){var i=this._context,r=i.uniformState,o=X.transformWindowToDrawingBuffer(this,e,Yt);o.y=this.drawingBufferHeight-o.y;var a,s=this._camera;u(s.frustum.fov)?a=s.frustum.clone(Rt):u(s.frustum.infiniteProjectionMatrix)&&(a=s.frustum.clone(Lt));for(var l=this.numberOfFrustums,c=0;l>c;++c){var h=ft(this,c),d=i.readPixels({x:o.x,y:o.y,width:1,height:1,framebuffer:h.framebuffer}),p=n.unpack(d,0,Xt);n.divideByScalar(p,255,p);var m=n.dot(p,Zt);if(m>0&&1>m){var f=this._frustumCommandsList[c];return a.near=f.near*(0!==c?xt:1),a.far=f.far,r.updateFrustum(a),X.drawingBufferToWgs84Coordinates(this,o,m,t)}}return void 0},bt.prototype.drillPick=function(e,t){var i,r,n=[],o=[],a=[];u(t)||(t=Number.MAX_VALUE);for(var s=this.pick(e);u(s)&&u(s.primitive)&&(n.push(s),!(0>=--t));){var l=s.primitive,c=!1;"function"==typeof l.getGeometryInstanceAttributes&&u(s.id)&&(r=l.getGeometryInstanceAttributes(s.id),u(r)&&u(r.show)&&(c=!0,r.show=T.toValue(!1,r.show),a.push(r))),c||(l.show=!1,o.push(l)),s=this.pick(e)}for(i=0;i<o.length;++i)o[i].show=!0;for(i=0;i<a.length;++i)r=a[i],r.show=T.toValue(!0,r.show);return n},bt.prototype.completeMorph=function(){this._transitioner.completeMorph()},bt.prototype.morphTo2D=function(e){var t,i=this.globe;t=u(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=l(e,2),this._transitioner.morphTo2D(e,t)},bt.prototype.morphToColumbusView=function(e){var t,i=this.globe;t=u(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=l(e,2),this._transitioner.morphToColumbusView(e,t)},bt.prototype.morphTo3D=function(e){var t,i=this.globe;t=u(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=l(e,2),this._transitioner.morphTo3D(e,t)},bt.prototype.isDestroyed=function(){return!1},bt.prototype.destroy=function(){return this._tweens.removeAll(),this._screenSpaceCameraController=this._screenSpaceCameraController&&this._screenSpaceCameraController.destroy(),this._pickFramebuffer=this._pickFramebuffer&&this._pickFramebuffer.destroy(),this._primitives=this._primitives&&this._primitives.destroy(),this._globe=this._globe&&this._globe.destroy(),this.skyBox=this.skyBox&&this.skyBox.destroy(),this.skyAtmosphere=this.skyAtmosphere&&this.skyAtmosphere.destroy(),this._debugSphere=this._debugSphere&&this._debugSphere.destroy(),this.sun=this.sun&&this.sun.destroy(),this._sunPostProcess=this._sunPostProcess&&this._sunPostProcess.destroy(),this._transitioner.destroy(),this._globeDepth.destroy(),u(this._oit)&&this._oit.destroy(),this._fxaa.destroy(),this._context=this._context&&this._context.destroy(),this._frameState.creditDisplay.destroy(),u(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),h(this)},bt}),i("Scene/SingleTileImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/loadImage","../Core/Rectangle","../Core/TileProviderError","../ThirdParty/when"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";var h=function(r){function n(e){C._image=e,C._tileWidth=e.width,C._tileHeight=e.height,C._ready=!0,u.handleSuccess(C._errorEvent)}function h(e){var t="Failed to load image "+g+".";y=u.handleError(y,C,C._errorEvent,t,0,0,0,d,e)}function d(){c(s(g),n,h)}r=t(r,{});var p=r.url;this._url=p;var m=r.proxy;this._proxy=m;var f=t(r.rectangle,l.MAX_VALUE),v=new a({rectangle:f,numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:r.ellipsoid});this._tilingScheme=v,this._image=void 0,this._texture=void 0,this._tileWidth=0,this._tileHeight=0,this._errorEvent=new o,this._ready=!1;var g=p;i(m)&&(g=m.getURL(g));var _=r.credit;"string"==typeof _&&(_=new e(_)),this._credit=_;var y,C=this;d()};return r(h.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return 0}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return void 0}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),h.prototype.getTileCredits=function(){return void 0},h.prototype.requestImage=function(){return this._image},h.prototype.pickFeatures=function(){return void 0},h}),i("Shaders/SkyAtmosphereFS",[],function(){"use strict";return"const float g = -0.95;\nconst float g2 = g * g;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\nvarying vec3 v_toCamera;\nvarying vec3 v_positionEC;\nvoid main (void)\n{\nczm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\nvec3 direction = normalize(v_positionEC);\nczm_ray ray = czm_ray(vec3(0.0), direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (!czm_isEmpty(intersection)) {\ndiscard;\n}\nfloat fCos = dot(czm_sunDirectionWC, normalize(v_toCamera)) / length(v_toCamera);\nfloat fRayleighPhase = 0.75 * (1.0 + fCos*fCos);\nfloat fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos*fCos) / pow(1.0 + g2 - 2.0*g*fCos, 1.5);\nconst float fExposure = 2.0;\nvec3 rgb = fRayleighPhase * v_rayleighColor + fMiePhase * v_mieColor;\nrgb = vec3(1.0) - exp(-fExposure * rgb);\nfloat l = czm_luminance(rgb);\ngl_FragColor = vec4(rgb, min(smoothstep(0.0, 0.1, l), 1.0) * smoothstep(0.0, 1.0, czm_morphTime));\n}\n"}),i("Shaders/SkyAtmosphereVS",[],function(){"use strict";return"attribute vec4 position;\nuniform float fCameraHeight;\nuniform float fCameraHeight2;\nuniform float fOuterRadius;\nuniform float fOuterRadius2;\nuniform float fInnerRadius;\nuniform float fScale;\nuniform float fScaleDepth;\nuniform float fScaleOverScaleDepth;\nconst float Kr = 0.0025;\nconst float fKr4PI = Kr * 4.0 * czm_pi;\nconst float Km = 0.0015;\nconst float fKm4PI = Km * 4.0 * czm_pi;\nconst float ESun = 15.0;\nconst float fKmESun = Km * ESun;\nconst float fKrESun = Kr * ESun;\nconst vec3 v3InvWavelength = vec3(\n5.60204474633241,\n9.473284437923038,\n19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\nvarying vec3 v_toCamera;\nvarying vec3 v_positionEC;\nfloat scale(float fCos)\n{\nfloat x = 1.0 - fCos;\nreturn fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid main(void)\n{\nvec3 v3Pos = position.xyz;\nvec3 v3Ray = v3Pos - czm_viewerPositionWC;\nfloat fFar = length(v3Ray);\nv3Ray /= fFar;\n#ifdef SKY_FROM_SPACE\nfloat B = 2.0 * dot(czm_viewerPositionWC, v3Ray);\nfloat C = fCameraHeight2 - fOuterRadius2;\nfloat fDet = max(0.0, B*B - 4.0 * C);\nfloat fNear = 0.5 * (-B - sqrt(fDet));\nvec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\nfFar -= fNear;\nfloat fStartAngle = dot(v3Ray, v3Start) / fOuterRadius;\nfloat fStartDepth = exp(-1.0 / fScaleDepth);\nfloat fStartOffset = fStartDepth*scale(fStartAngle);\n#else\nvec3 v3Start = czm_viewerPositionWC;\nfloat fHeight = length(v3Start);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fCameraHeight));\nfloat fStartAngle = dot(v3Ray, v3Start) / fHeight;\nfloat fStartOffset = fDepth*scale(fStartAngle);\n#endif\nfloat fSampleLength = fFar / fSamples;\nfloat fScaledLength = fSampleLength * fScale;\nvec3 v3SampleRay = v3Ray * fSampleLength;\nvec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\nvec3 v3FrontColor = vec3(0.0, 0.0, 0.0);\nfor(int i=0; i<nSamples; i++)\n{\nfloat fHeight = length(v3SamplePoint);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight));\nvec3 lightPosition = normalize(czm_viewerPositionWC);\nfloat fLightAngle = dot(lightPosition, v3SamplePoint) / fHeight;\nfloat fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight;\nfloat fScatter = (fStartOffset + fDepth*(scale(fLightAngle) - scale(fCameraAngle)));\nvec3 v3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI));\nv3FrontColor += v3Attenuate * (fDepth * fScaledLength);\nv3SamplePoint += v3SampleRay;\n}\nv_mieColor = v3FrontColor * fKmESun;\nv_rayleighColor = v3FrontColor * (v3InvWavelength * fKrESun);\nv_toCamera = czm_viewerPositionWC - v3Pos;\nv_positionEC = (czm_modelView * position).xyz;\ngl_Position = czm_modelViewProjection * position;\n}\n" -}),i("Scene/SkyAtmosphere",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/Ellipsoid","../Core/EllipsoidGeometry","../Core/GeometryPipeline","../Core/VertexFormat","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/ShaderSource","../Shaders/SkyAtmosphereFS","../Shaders/SkyAtmosphereVS","./BlendingState","./CullFace","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";var g=function(i){i=t(i,o.WGS84),this.show=!0,this._ellipsoid=i,this._command=new c({owner:this}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._fCameraHeight=void 0,this._fCameraHeight2=void 0,this._outerRadius=e.maximumComponent(e.multiplyByScalar(i.radii,1.025,new e));var r=i.maximumRadius,n=.25,a=this;this._command.uniformMap={fCameraHeight:function(){return a._fCameraHeight},fCameraHeight2:function(){return a._fCameraHeight2},fOuterRadius:function(){return a._outerRadius},fOuterRadius2:function(){return a._outerRadius*a._outerRadius},fInnerRadius:function(){return r},fScale:function(){return 1/(a._outerRadius-r)},fScaleDepth:function(){return n},fScaleOverScaleDepth:function(){return 1/(a._outerRadius-r)/n}}};return r(g.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),g.prototype.update=function(t,r){if(!this.show)return void 0;if(r.mode!==v.SCENE3D&&r.mode!==v.MORPHING)return void 0;if(!r.passes.render)return void 0;var n=this._command;if(!i(n.vertexArray)){var o=a.createGeometry(new a({radii:e.multiplyByScalar(this._ellipsoid.radii,1.025,new e),slicePartitions:256,stackPartitions:256,vertexFormat:l.POSITION_ONLY}));n.vertexArray=t.createVertexArrayFromGeometry({geometry:o,attributeLocations:s.createAttributeLocations(o),bufferUsage:u.STATIC_DRAW}),n.renderState=t.createRenderState({cull:{enabled:!0,face:f.FRONT},blending:m.ALPHA_BLEND});var c=new h({defines:["SKY_FROM_SPACE"],sources:[p]});this._spSkyFromSpace=t.createShaderProgram(c,d),c=new h({defines:["SKY_FROM_ATMOSPHERE"],sources:[p]}),this._spSkyFromAtmosphere=t.createShaderProgram(c,d)}var g=r.camera.positionWC;return this._fCameraHeight2=e.magnitudeSquared(g),this._fCameraHeight=Math.sqrt(this._fCameraHeight2),n.shaderProgram=this._fCameraHeight>this._outerRadius?this._spSkyFromSpace:this._spSkyFromAtmosphere,n},g.prototype.isDestroyed=function(){return!1},g.prototype.destroy=function(){var e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyFromSpace=this._spSkyFromSpace&&this._spSkyFromSpace.destroy(),this._spSkyFromAtmosphere=this._spSkyFromAtmosphere&&this._spSkyFromAtmosphere.destroy(),n(this)},g}),i("Shaders/SkyBoxFS",[],function(){"use strict";return"uniform samplerCube u_cubeMap;\nvarying vec3 v_texCoord;\nvoid main()\n{\nvec3 rgb = textureCube(u_cubeMap, normalize(v_texCoord)).rgb;\ngl_FragColor = vec4(rgb, czm_morphTime);\n}\n"}),i("Shaders/SkyBoxVS",[],function(){"use strict";return"attribute vec3 position;\nvarying vec3 v_texCoord;\nvoid main()\n{\nvec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\ngl_Position = czm_projection * vec4(p, 1.0);\nv_texCoord = position.xyz;\n}\n"}),i("Scene/SkyBox",["../Core/BoxGeometry","../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/GeometryPipeline","../Core/Matrix4","../Core/VertexFormat","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/loadCubeMap","../Shaders/SkyBoxFS","../Shaders/SkyBoxVS","./BlendingState","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f){"use strict";var v=function(e){this.sources=e.sources,this._sources=void 0,this.show=i(e.show,!0),this._command=new c({modelMatrix:s.clone(s.IDENTITY),owner:this}),this._cubeMap=void 0};return v.prototype.update=function(i,n){if(!this.show)return void 0;if(n.mode!==f.SCENE3D&&n.mode!==f.MORPHING)return void 0;if(!n.passes.render)return void 0;if(this._sources!==this.sources){this._sources=this.sources;var o=this.sources;"string"==typeof o.positiveX?h(i,this._sources).then(function(e){c._cubeMap=c._cubeMap&&c._cubeMap.destroy(),c._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=i.createCubeMap({source:o}))}var s=this._command;if(!r(s.vertexArray)){var c=this;s.uniformMap={u_cubeMap:function(){return c._cubeMap}};var v=e.createGeometry(e.fromDimensions({dimensions:new t(2,2,2),vertexFormat:l.POSITION_ONLY})),g=a.createAttributeLocations(v);s.vertexArray=i.createVertexArrayFromGeometry({geometry:v,attributeLocations:g,bufferUsage:u.STATIC_DRAW}),s.shaderProgram=i.createShaderProgram(p,d,g),s.renderState=i.createRenderState({blending:m.ALPHA_BLEND})}return r(this._cubeMap)?s:void 0},v.prototype.isDestroyed=function(){return!1},v.prototype.destroy=function(){var e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),n(this)},v}),i("Scene/StencilFunction",["../Core/freezeObject"],function(e){"use strict";var t={NEVER:512,LESS:513,EQUAL:514,LESS_OR_EQUAL:515,GREATER:516,NOT_EQUAL:517,GREATER_OR_EQUAL:518,ALWAYS:519};return e(t)}),i("Scene/StencilOperation",["../Core/freezeObject"],function(e){"use strict";var t={ZERO:0,KEEP:7680,REPLACE:7681,INCREMENT:7682,DECREMENT:7683,INVERT:5386,INCREMENT_WRAP:34055,DECREMENT_WRAP:34056};return e(t)}),i("Shaders/SunFS",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Shaders/SunTextureFS",[],function(){"use strict";return"uniform float u_glowLengthTS;\nuniform float u_radiusTS;\nvarying vec2 v_textureCoordinates;\nvec2 rotate(vec2 p, vec2 direction)\n{\nreturn vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);\n}\nvec4 addBurst(vec2 position, vec2 direction)\n{\nvec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);\nfloat radius = length(rotatedPosition);\nfloat burst = 1.0 - smoothstep(0.0, 0.55, radius);\nreturn vec4(burst);\n}\nvoid main()\n{\nvec2 position = v_textureCoordinates - vec2(0.5);\nfloat radius = length(position);\nfloat surface = step(radius, u_radiusTS);\nvec4 color = vec4(1.0, 1.0, surface + 0.2, surface);\nfloat glow = 1.0 - smoothstep(0.0, 0.55, radius);\ncolor.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;\nvec4 burst = vec4(0.0);\nburst += 0.4 * addBurst(position, vec2(0.38942, 0.92106));\nburst += 0.4 * addBurst(position, vec2(0.99235, 0.12348));\nburst += 0.4 * addBurst(position, vec2(0.60327, -0.79754));\nburst += 0.3 * addBurst(position, vec2(0.31457, 0.94924));\nburst += 0.3 * addBurst(position, vec2(0.97931, 0.20239));\nburst += 0.3 * addBurst(position, vec2(0.66507, -0.74678));\ncolor += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;\ngl_FragColor = clamp(color, vec4(0.0), vec4(1.0));\n}\n"}),i("Shaders/SunVS",[],function(){"use strict";return"attribute vec2 direction;\nuniform float u_size;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 position;\nif (czm_morphTime == 1.0)\n{\nposition = vec4(czm_sunPositionWC, 1.0);\n}\nelse\n{\nposition = vec4(czm_sunPositionColumbusView.zxy, 1.0);\n}\nvec4 positionEC = czm_view * position;\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nvec2 halfSize = vec2(u_size * 0.5);\nhalfSize *= ((direction * 2.0) - 1.0);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);\nv_textureCoordinates = direction;\n}\n"}),i("Scene/Sun",["../Core/BoundingRectangle","../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/ComponentDatatype","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/IndexDatatype","../Core/Math","../Core/Matrix4","../Core/PixelFormat","../Core/PrimitiveType","../Renderer/BufferUsage","../Renderer/ClearCommand","../Renderer/DrawCommand","../Shaders/SunFS","../Shaders/SunTextureFS","../Shaders/SunVS","./BlendingState","./SceneMode","./SceneTransforms"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E){"use strict";var b=function(){this.show=!0,this._command=new g({primitiveType:m.TRIANGLES,boundingVolume:new t,owner:this}),this._boundingVolume=new t,this._boundingVolume2D=new t,this._texture=void 0,this._drawingBufferWidth=void 0,this._drawingBufferHeight=void 0,this._radiusTS=void 0,this._size=void 0,this.glowFactor=1,this._glowFactorDirty=!1;var e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}};l(b.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});var x=new i,T=new i,P=new n,A=new n;return b.prototype.update=function(n){var l=n.frameState,u=n.context;if(!this.show)return void 0;var m=l.mode;if(m===S.SCENE2D||m===S.MORPHING)return void 0;if(!l.passes.render)return void 0;var g=n.drawingBufferWidth,b=n.drawingBufferHeight;if(!s(this._texture)||g!==this._drawingBufferWidth||b!==this._drawingBufferHeight||this._glowFactorDirty){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=g,this._drawingBufferHeight=b,this._glowFactorDirty=!1;var D=Math.max(g,b);D=Math.pow(2,Math.ceil(Math.log(D)/Math.log(2))-2),this._texture=u.createTexture2D({width:D,height:D,pixelFormat:p.RGBA});var M=u.createFramebuffer({colorTextures:[this._texture]});M.destroyAttachments=!1;var I=new v({color:new o(0,0,0,0),framebuffer:M}),O=u.createRenderState({viewport:new e(0,0,D,D)});this._glowLengthTS=5*this._glowFactor,this._radiusTS=.5*(1/(1+2*this._glowLengthTS));var R=this,L={u_glowLengthTS:function(){return R._glowLengthTS},u_radiusTS:function(){return R._radiusTS}},N=u.createViewportQuadCommand(y,{renderState:O,uniformMap:L,framebuffer:M,owner:this});I.execute(u),N.execute(u),N.shaderProgram.destroy(),M.destroy()}var F=this._command;if(!s(F.vertexArray)){var B={direction:0},z=new Uint8Array(8);z[0]=0,z[1]=0,z[2]=255,z[3]=0,z[4]=255,z[5]=255,z[6]=0,z[7]=255;var k=u.createVertexBuffer(z,f.STATIC_DRAW),V=[{index:B.direction,vertexBuffer:k,componentsPerAttribute:2,normalize:!0,componentDatatype:a.UNSIGNED_BYTE}],U=u.createIndexBuffer(new Uint16Array([0,1,2,0,2,3]),f.STATIC_DRAW,c.UNSIGNED_SHORT);F.vertexArray=u.createVertexArray(V,U),F.shaderProgram=u.createShaderProgram(C,_,B),F.renderState=u.createRenderState({blending:w.ALPHA_BLEND}),F.uniformMap=this._uniformMap}var W=u.uniformState.sunPositionWC,G=u.uniformState.sunPositionColumbusView,H=this._boundingVolume,q=this._boundingVolume2D;r.clone(W,H.center),q.center.x=G.z,q.center.y=G.x,q.center.z=G.y,H.radius=h.SOLAR_RADIUS+h.SOLAR_RADIUS*this._glowLengthTS,q.radius=H.radius,m===S.SCENE3D?t.clone(H,F.boundingVolume):m===S.COLUMBUS_VIEW&&t.clone(q,F.boundingVolume);var j=E.computeActualWgs84Position(l,W,A),Y=r.magnitude(r.subtract(j,n.camera.position,A)),X=u.uniformState.projection,Z=P;Z.x=0,Z.y=0,Z.z=-Y,Z.w=1;var J=d.multiplyByVector(X,Z,A),Q=E.clipToDrawingBufferCoordinates(n,J,x);Z.x=h.SOLAR_RADIUS;var K=d.multiplyByVector(X,Z,A),$=E.clipToDrawingBufferCoordinates(n,K,T);return this._size=Math.ceil(i.magnitude(i.subtract($,Q,A))),this._size=2*this._size*(1+2*this._glowLengthTS),F},b.prototype.isDestroyed=function(){return!1},b.prototype.destroy=function(){var e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._texture=this._texture&&this._texture.destroy(),u(this)},b}),i("Scene/TileCoordinatesImageryProvider",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","../Core/GeographicTilingScheme"],function(e,t,i,r,n,o){"use strict";var a=function(r){r=t(r,t.EMPTY_OBJECT),this._tilingScheme=i(r.tilingScheme)?r.tilingScheme:new o({ellipsoid:r.ellipsoid}),this._color=t(r.color,e.YELLOW),this._errorEvent=new n,this._tileWidth=t(r.tileWidth,256),this._tileHeight=t(r.tileHeight,256)};return r(a.prototype,{proxy:{get:function(){return void 0}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return void 0}},minimumLevel:{get:function(){return void 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return void 0}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},credit:{get:function(){return void 0}},hasAlphaChannel:{get:function(){return!0}}}),a.prototype.getTileCredits=function(){return void 0},a.prototype.requestImage=function(e,t,i){var r=document.createElement("canvas");r.width=256,r.height=256;var n=r.getContext("2d"),o=this._color.toCssColorString();n.strokeStyle=o,n.lineWidth=2,n.strokeRect(1,1,255,255);var a="L"+i+"X"+e+"Y"+t;return n.font="bold 25px Arial",n.textAlign="center",n.fillStyle="black",n.fillText(a,127,127),n.fillStyle=o,n.fillText(a,124,124),r},a.prototype.pickFeatures=function(){return void 0},a}),i("Scene/TileDiscardPolicy",["../Core/DeveloperError"],function(e){"use strict";var t=function(){e.throwInstantiationError()};return t.prototype.isReady=e.throwInstantiationError,t.prototype.shouldDiscardImage=e.throwInstantiationError,t}),i("Scene/TileMapServiceImageryProvider",["../Core/appendForwardSlash","../Core/Cartesian2","../Core/Cartographic","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/loadXML","../Core/Rectangle","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f){"use strict";function v(e,t,i,r){var n=e._tilingScheme.getNumberOfYTilesAtLevel(r),a=e._url+r+"/"+t+"/"+(n-i-1)+"."+e._fileExtension,s=e._proxy;return o(s)&&(a=s.getURL(a)),a}var g=function(a){function s(e){for(var r,s,l,c,m=/tileformat/i,f=/tileset/i,_=/tilesets/i,w=/boundingbox/i,S=/srs/i,E=[],b=e.childNodes[0].childNodes,x=0;x<b.length;x++)if(m.test(b.item(x).nodeName))r=b.item(x);else if(_.test(b.item(x).nodeName)){l=b.item(x);for(var T=b.item(x).childNodes,P=0;P<T.length;P++)f.test(T.item(P).nodeName)&&E.push(T.item(P))}else w.test(b.item(x).nodeName)?s=b.item(x):S.test(b.item(x).nodeName)&&(c=b.item(x).textContent);C._fileExtension=n(C._fileExtension,r.getAttribute("extension")),C._tileWidth=n(C._tileWidth,parseInt(r.getAttribute("width"),10)),C._tileHeight=n(C._tileHeight,parseInt(r.getAttribute("height"),10)),C._minimumLevel=n(C._minimumLevel,parseInt(E[0].getAttribute("order"),10)),C._maximumLevel=n(C._maximumLevel,parseInt(E[E.length-1].getAttribute("order"),10));var A=l.getAttribute("profile"),D=!1;if(("geodetic"===A||"mercator"===A)&&(D=!0),!o(C._tilingScheme))if("geodetic"===A||"global-geodetic"===A)C._tilingScheme=new u({ellipsoid:a.ellipsoid});else{if("mercator"!==A&&"global-mercator"!==A){var M=g+"tilemapresource.xml specifies an unsupported profile attribute, "+A+".";return y=d.handleError(y,C,C._errorEvent,M,void 0,void 0,void 0,v),void 0}C._tilingScheme=new p({ellipsoid:a.ellipsoid})}var I=C._tilingScheme;if(!o(C._rectangle)){var O,R,L,N;if(D)O=new t(parseFloat(s.getAttribute("miny")),parseFloat(s.getAttribute("minx"))),R=new t(parseFloat(s.getAttribute("maxy")),parseFloat(s.getAttribute("maxx"))),L=i.fromDegrees(O.x,O.y),N=i.fromDegrees(R.x,R.y);else if(O=new t(parseFloat(s.getAttribute("minx")),parseFloat(s.getAttribute("miny"))),R=new t(parseFloat(s.getAttribute("maxx")),parseFloat(s.getAttribute("maxy"))),C._tilingScheme instanceof u)L=i.fromDegrees(O.x,O.y),N=i.fromDegrees(R.x,R.y);else{var F=C._tilingScheme.projection;L=F.unproject(O),N=F.unproject(R)}C._rectangle=new h(L.longitude,L.latitude,N.longitude,N.latitude)}C._rectangle.west<I.rectangle.west&&(C._rectangle.west=I.rectangle.west),C._rectangle.east>I.rectangle.east&&(C._rectangle.east=I.rectangle.east),C._rectangle.south<I.rectangle.south&&(C._rectangle.south=I.rectangle.south),C._rectangle.north>I.rectangle.north&&(C._rectangle.north=I.rectangle.north);var B=I.positionToTileXY(h.southwest(C._rectangle),C._minimumLevel),z=I.positionToTileXY(h.northeast(C._rectangle),C._minimumLevel),k=(Math.abs(z.x-B.x)+1)*(Math.abs(z.y-B.y)+1);k>4&&(C._minimumLevel=0),C._tilingScheme=I,C._ready=!0}function f(){C._fileExtension=n(a.fileExtension,"png"),C._tileWidth=n(a.tileWidth,256),C._tileHeight=n(a.tileHeight,256),C._minimumLevel=n(a.minimumLevel,0),C._maximumLevel=a.maximumLevel,C._tilingScheme=o(a.tilingScheme)?a.tilingScheme:new p({ellipsoid:a.ellipsoid}),C._rectangle=n(a.rectangle,C._tilingScheme.rectangle),C._ready=!0}function v(){var e=g+"tilemapresource.xml",t=C._proxy;o(t)&&(e=t.getURL(e)),m(c(e),s,f)}a=n(a,{});var g=e(a.url);this._url=g,this._ready=!1,this._proxy=a.proxy,this._tileDiscardPolicy=a.tileDiscardPolicy,this._errorEvent=new l,this._fileExtension=a.fileExtension,this._tileWidth=a.tileWidth,this._tileHeight=a.tileHeight,this._minimumLevel=a.minimumLevel,this._maximumLevel=a.maximumLevel,this._rectangle=h.clone(a.rectangle),this._tilingScheme=a.tilingScheme;var _=a.credit;"string"==typeof _&&(_=new r(_)),this._credit=_;var y,C=this;v()};return a(g.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),g.prototype.getTileCredits=function(){return void 0},g.prototype.requestImage=function(e,t,i){var r=v(this,e,t,i);return f.loadImage(this,r)},g.prototype.pickFeatures=function(){return void 0},g}),i("Scene/TileState",["../Core/freezeObject"],function(e){"use strict";var t={START:0,LOADING:1,READY:2,UPSAMPLED_ONLY:3};return e(t)}),i("Scene/UrlTemplateImageryProvider",["../Core/Cartesian2","../Core/Cartographic","../Core/Math","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/loadXML","../Core/Rectangle","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f){"use strict";function v(e,t,i,r){L=!1,F=!1;for(var n="",a=e._urlParts,s=0;s<a.length;++s){var l=a[s];n+="string"==typeof l?l:encodeURIComponent(l(e,t,i,r))}var u=e._proxy;return o(u)&&(n=u.getURL(n)),n}function g(e,t){return t}function _(e,t,i,r){return e.tilingScheme.getNumberOfXTilesAtLevel(r)-t-1}function y(e,t,i){return i}function C(e,t,i,r){return e.tilingScheme.getNumberOfYTilesAtLevel(r)-i-1}function w(e,t,i,r){return r}function S(e,t,i,r){var n=(t+i+r)%e._subdomains.length;return e._subdomains[n]}function E(e,t,r,n){L||(e.tilingScheme.tileXYToRectangle(t,r,n,N),N.west=i.toDegrees(N.west),N.south=i.toDegrees(N.south),N.east=i.toDegrees(N.east),N.north=i.toDegrees(N.north),L=!0)}function b(e,t,i,r){return E(e,t,i,r),N.west}function x(e,t,i,r){return E(e,t,i,r),N.south}function T(e,t,i,r){return E(e,t,i,r),N.east}function P(e,t,i,r){return E(e,t,i,r),N.north}function A(e,t,i,r){F||(e.tilingScheme.tileXYToNativeRectangle(t,i,r,B),F=!0)}function D(e,t,i,r){return A(e,t,i,r),B.west}function M(e,t,i,r){return A(e,t,i,r),B.south}function I(e,t,i,r){return A(e,t,i,r),B.east}function O(e,t,i,r){return A(e,t,i,r),B.north}var R=function(e){this._url=e.url,this._proxy=e.proxy,this._tileDiscardPolicy=e.tileDiscardPolicy,this._errorEvent=new l,this._subdomains=e.subdomains,this._subdomains=Array.isArray(this._subdomains)?this._subdomains.slice():o(this._subdomains)&&this._subdomains.length>0?this._subdomains.split(""):["a","b","c"],this._tileWidth=n(e.tileWidth,256),this._tileHeight=n(e.tileHeight,256),this._minimumLevel=n(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._tilingScheme=n(e.tilingScheme,new p({ellipsoid:e.ellipsoid})),this._rectangle=n(e.rectangle,this._tilingScheme.rectangle),this._hasAlphaChannel=n(e.hasAlphaChannel,!0);var t=e.credit;"string"==typeof t&&(t=new r(t)),this._credit=t;for(var i,a,s=this._url,u=[],c=0,h=Object.keys(z);c<s.length;){i=Number.MAX_VALUE,a=void 0;for(var d=0;d<h.length;++d){var m=s.indexOf(h[d],c);m>=0&&i>m&&(i=m,a=h[d])}o(a)?(i>c&&u.push(s.substring(c,i)),u.push(z[a]),c=i+a.length):(u.push(s.substring(c)),c=s.length)}this._urlParts=u};a(R.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}}),R.prototype.getTileCredits=function(){return void 0},R.prototype.requestImage=function(e,t,i){var r=v(this,e,t,i);return f.loadImage(this,r)},R.prototype.pickFeatures=function(){return void 0};var L=!1,N=new h,F=!1,B=new h,z={"{x}":g,"{y}":y,"{z}":w,"{s}":S,"{reverseX}":_,"{reverseY}":C,"{westDegrees}":b,"{southDegrees}":x,"{eastDegrees}":T,"{northDegrees}":P,"{westProjected}":D,"{southProjected}":M,"{eastProjected}":I,"{northProjected}":O};return R}),i("Shaders/ViewportQuadFS",[],function(){"use strict";return"varying vec2 v_textureCoordinates;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_textureCoordinates.s;\nmaterialInput.st = v_textureCoordinates;\nmaterialInput.str = vec3(v_textureCoordinates, 0.0);\nmaterialInput.normalEC = vec3(0.0, 0.0, -1.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n"}),i("Scene/ViewportQuad",["../Core/BoundingRectangle","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Renderer/ShaderSource","../Shaders/ViewportQuadFS","./BlendingState","./Material","./Pass"],function(e,t,i,r,n,o,a,s,l,u){"use strict";var c=function(r,n){this.show=!0,i(r)||(r=new e),this.rectangle=e.clone(r),i(n)||(n=l.fromType(l.ColorType,{color:new t(1,1,1,1)})),this.material=n,this._material=void 0,this._overlayCommand=void 0,this._rs=void 0};return c.prototype.update=function(t,r,n){if(this.show){var l=this._rs;i(l)&&e.equals(l.viewport,this.rectangle)||(this._rs=t.createRenderState({blending:s.ALPHA_BLEND,viewport:this.rectangle}));var c=r.passes;if(c.render){if(this._material!==this.material||!i(this._overlayCommand)){this._material=this.material,i(this._overlayCommand)&&this._overlayCommand.shaderProgram.destroy();var h=new o({sources:[this._material.shaderSource,a]});this._overlayCommand=t.createViewportQuadCommand(h,{renderState:this._rs,uniformMap:this._material._uniforms,owner:this}),this._overlayCommand.pass=u.OVERLAY}this._material.update(t),this._overlayCommand.uniformMap=this._material._uniforms,n.push(this._overlayCommand)}}},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return i(this._overlayCommand)&&(this._overlayCommand.shaderProgram=this._overlayCommand.shaderProgram&&this._overlayCommand.shaderProgram.destroy()),r(this)},c}),i("Scene/WebMapServiceImageryProvider",["../Core/Cartesian3","../Core/Cartographic","../Core/combine","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/deprecationWarning","../Core/DeveloperError","../Core/Event","../Core/freezeObject","../Core/GeographicTilingScheme","../Core/loadJson","../Core/loadText","../Core/loadWithXhr","../Core/loadXML","../Core/Math","../Core/objectToQuery","../Core/queryToObject","../Core/Rectangle","../Core/WebMercatorTilingScheme","../ThirdParty/Uri","../ThirdParty/when","./GetFeatureInfoFormat","./ImageryLayerFeatureInfo","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x){"use strict";function T(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i.toLowerCase()]=e[i]);return t}function P(e,t,r,a){var s=new w(e._url),l=_(n(s.query,""));if(l=i(e._parameters,l),o(l.layers)||(l.layers=e._layers),o(l.srs)||(l.srs=e._tilingScheme instanceof C?"EPSG:3857":"EPSG:4326"),!o(l.bbox)){var u=e._tilingScheme.tileXYToNativeRectangle(t,r,a);l.bbox=u.west+","+u.south+","+u.east+","+u.north}o(l.width)||(l.width=e._tileWidth),o(l.height)||(l.height=e._tileHeight),s.query=g(l);var c=s.toString(),h=e._proxy;return o(h)&&(c=h.getURL(c)),c}function A(e,t,r,a,s,l,u){var c=new w(e._url),h=_(n(c.query,""));if(h=i(e._getFeatureInfoParameters,h),o(h.layers)||(h.layers=e._layers),o(h.query_layers)||(h.query_layers=e._layers),o(h.srs)||(h.srs=e._tilingScheme instanceof C?"EPSG:3857":"EPSG:4326"),!o(h.bbox)){var d=e._tilingScheme.tileXYToNativeRectangle(r,a,s);h.bbox=d.west+","+d.south+","+d.east+","+d.north}o(h.x)||(h.x=l),o(h.y)||(h.y=u),o(h.width)||(h.width=e._tileWidth),o(h.height)||(h.height=e._tileHeight),o(h.info_format)||(h.info_format=t),c.query=g(h);var p=c.toString(),m=e._proxy;return o(m)&&(p=m.getURL(p)),p}var D=function O(e){e=n(e,n.EMPTY_OBJECT),this._url=e.url,this._tileDiscardPolicy=e.tileDiscardPolicy,this._proxy=e.proxy,this._layers=e.layers,this._enablePickFeatures=n(e.enablePickFeatures,!0),this._getFeatureInfoFormats=n(e.getFeatureInfoFormats,O.DefaultGetFeatureInfoFormats),(o(e.getFeatureInfoAsGeoJson)||o(e.getFeatureInfoAsXml))&&(s("WebMapServiceImageryProvider.getFeatureInfo","The options.getFeatureInfoAsGeoJson and getFeatureInfoAsXml parameters to WebMapServiceImageryProvider were deprecated in Cesium 1.10 and will be removed in 1.13. Use options.getFeatureInfoFormats instead."),this._getFeatureInfoFormats=[],n(e.getFeatureInfoAsGeoJson,!0)&&this._getFeatureInfoFormats.push(new E("json","application/json")),n(e.getFeatureInfoAsXml,!0)&&this._getFeatureInfoFormats.push(new E("xml","text/xml"))),this._parameters=i(T(n(e.parameters,n.EMPTY_OBJECT)),O.DefaultParameters),this._getFeatureInfoParameters=i(T(n(e.getFeatureInfoParameters,n.EMPTY_OBJECT)),O.GetFeatureInfoDefaultParameters),this._tileWidth=n(e.tileWidth,256),this._tileHeight=n(e.tileHeight,256),this._minimumLevel=n(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=n(e.rectangle,y.MAX_VALUE),this._tilingScheme=o(e.tilingScheme)?e.tilingScheme:new h({ellipsoid:e.ellipsoid}),this._rectangle=y.intersection(this._rectangle,this._tilingScheme.rectangle);var t=e.credit;"string"==typeof t&&(t=new r(t)),this._credit=t,this._errorEvent=new u,this._ready=!0};a(D.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},layers:{get:function(){return this._layers}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),D.prototype.getTileCredits=function(){return void 0},D.prototype.requestImage=function(e,t,i){var r=P(this,e,t,i);return x.loadImage(this,r)};var M=new t,I=new e;return D.prototype.pickFeatures=function(e,t,i,r,n){function o(e,t){return e.callback(t)}function a(){if(_>=y._getFeatureInfoFormats.length)return S([]);var r=y._getFeatureInfoFormats[_],n=A(y,r.format,e,t,i,c,g);return++_,"json"===r.type?d(n).then(r.callback).otherwise(a):"xml"===r.type?f(n).then(r.callback).otherwise(a):"text"===r.type||"html"===r.type?p(n).then(r.callback).otherwise(a):m({url:n,responseType:r.format}).then(o.bind(void 0,r)).otherwise(a)}if(!this._enablePickFeatures||0===this._getFeatureInfoFormats.length)return void 0;var s,l=this._tilingScheme.tileXYToNativeRectangle(e,t,i);if(this._tilingScheme instanceof h)s=I,s.x=v.toDegrees(r),s.y=v.toDegrees(n);else{var u=M;u.longitude=r,u.latitude=n,s=this._tilingScheme.projection.project(u,I)}var c=0|this._tileWidth*(s.x-l.west)/l.width,g=0|this._tileHeight*(l.north-s.y)/l.height,_=0,y=this;return a()},D.DefaultParameters=c({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"}),D.GetFeatureInfoDefaultParameters=c({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"}),D.DefaultGetFeatureInfoFormats=c([c(new E("json","application/json")),c(new E("xml","text/xml")),c(new E("text","text/html"))]),D}),i("Scene/WebMapTileServiceImageryProvider",["../Core/combine","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/freezeObject","../Core/objectToQuery","../Core/queryToObject","../Core/Rectangle","../Core/WebMercatorTilingScheme","../ThirdParty/Uri","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(t,n,o,a){var s,c=t._tileMatrixLabels,h=r(c)?c[a]:a.toString();if(t._url.indexOf("{")>=0)s=t._url.replace("{style}",t._style).replace("{Style}",t._style).replace("{TileMatrixSet}",t._tileMatrixSetID).replace("{TileMatrix}",h).replace("{TileRow}",o.toString()).replace("{TileCol}",n.toString());else{var p=new d(t._url),m=u(i(p.query,""));m=e(v,m),m.tilematrix=h,m.layer=t._layer,m.style=t._style,m.tilerow=o,m.tilecol=n,m.tilematrixset=t._tileMatrixSetID,m.format=t._format,p.query=l(m),s=p.toString()}var f=t._proxy;return r(f)&&(s=f.getURL(s)),s}var f=function(e){if(e=i(e,i.EMPTY_OBJECT),!r(e.url))throw new o("options.url is required.");if(!r(e.layer))throw new o("options.layer is required.");if(!r(e.style))throw new o("options.style is required.");if(!r(e.tileMatrixSetID))throw new o("options.tileMatrixSetID is required.");this._url=e.url,this._layer=e.layer,this._style=e.style,this._tileMatrixSetID=e.tileMatrixSetID,this._tileMatrixLabels=e.tileMatrixLabels,this._format=i(e.format,"image/jpeg"),this._proxy=e.proxy,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=r(e.tilingScheme)?e.tilingScheme:new h({ellipsoid:e.ellipsoid}),this._tileWidth=i(e.tileWidth,256),this._tileHeight=i(e.tileHeight,256),this._minimumLevel=i(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=i(e.rectangle,this._tilingScheme.rectangle);var n=this._tilingScheme.positionToTileXY(c.southwest(this._rectangle),this._minimumLevel),s=this._tilingScheme.positionToTileXY(c.northeast(this._rectangle),this._minimumLevel),l=(Math.abs(s.x-n.x)+1)*(Math.abs(s.y-n.y)+1);if(l>4)throw new o("The imagery provider's rectangle and minimumLevel indicate that there are "+l+" tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.");this._errorEvent=new a;var u=e.credit;this._credit="string"==typeof u?new t(u):u},v=s({service:"WMTS",version:"1.0.0",request:"GetTile"});return n(f.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme -}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},format:{get:function(){return this._format}},ready:{value:!0},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),f.prototype.getTileCredits=function(){return void 0},f.prototype.requestImage=function(e,t,i){var r=m(this,e,t,i);return p.loadImage(this,r)},f.prototype.pickFeatures=function(){return void 0},f}),i("Scene/createTangentSpaceDebugPrimitive",["../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/Matrix4","./PerInstanceColorAppearance","./Primitive"],function(e,t,i,r,n,o,a,s,l){"use strict";var u=function(r){r=t(r,t.EMPTY_OBJECT);var u=[],c=r.geometry;i(c.attributes)&&i(c.primitiveType)||(c=c.constructor.createGeometry(c));var h=c.attributes,d=a.clone(t(r.modelMatrix,a.IDENTITY)),p=t(r.length,1e4);return i(h.normal)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"normal",p),attributes:{color:new e(1,0,0,1)},modelMatrix:d})),i(h.binormal)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"binormal",p),attributes:{color:new e(0,1,0,1)},modelMatrix:d})),i(h.tangent)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"tangent",p),attributes:{color:new e(0,0,1,1)},modelMatrix:d})),u.length>0?new l({asynchronous:!1,geometryInstances:u,appearance:new s({flat:!0,translucent:!1})}):void 0};return u}),function(){!function(e){var r=this||(0,eval)("this"),n=r.document,o=r.navigator,a=r.jQuery,s=r.JSON;!function(e){"function"==typeof t&&"object"==typeof exports&&"object"==typeof module?e(module.exports||exports,t):"function"==typeof i&&i.amd?i("ThirdParty/knockout-3.2.0",["exports","require"],e):e(r.ko={})}(function(t,i){function l(e,t){return null===e||typeof e in p?e===t:!1}function u(t,i){var r;return function(){r||(r=setTimeout(function(){r=e,t()},i))}}function c(e,t){var i;return function(){clearTimeout(i),i=setTimeout(e,t)}}function h(e,t,i,r){d.d[e]={init:function(e,n,o,a,s){var l,u;return d.s(function(){var o=d.a.c(n()),a=!i!=!o,c=!u;(c||t||a!==l)&&(c&&d.Y.la()&&(u=d.a.ia(d.f.childNodes(e),!0)),a?(c||d.f.T(e,d.a.ia(u)),d.Ca(r?r(s,o):s,e)):d.f.ja(e),l=a)},null,{o:e}),{controlsDescendantBindings:!0}}},d.h.ha[e]=!1,d.f.Q[e]=!0}var d="undefined"!=typeof t?t:{};d.b=function(e,t){for(var i=e.split("."),r=d,n=0;n<i.length-1;n++)r=r[i[n]];r[i[i.length-1]]=t},d.A=function(e,t,i){e[t]=i},d.version="3.2.0",d.b("version",d.version),d.a=function(){function t(e,t){for(var i in e)e.hasOwnProperty(i)&&t(i,e[i])}function i(e,t){if(t)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function l(e,t){return e.__proto__=t,e}var u={__proto__:[]}instanceof Array,c={},h={};c[o&&/Firefox\/2/i.test(o.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],c.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),t(c,function(e,t){if(t.length)for(var i=0,r=t.length;r>i;i++)h[t[i]]=e});var p={propertychange:!0},m=n&&function(){for(var t=3,i=n.createElement("div"),r=i.getElementsByTagName("i");i.innerHTML="<!--[if gt IE "+ ++t+"]><i></i><![endif]-->",r[0];);return t>4?t:e}();return{vb:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],u:function(e,t){for(var i=0,r=e.length;r>i;i++)t(e[i],i)},m:function(e,t){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t);for(var i=0,r=e.length;r>i;i++)if(e[i]===t)return i;return-1},qb:function(e,t,i){for(var r=0,n=e.length;n>r;r++)if(t.call(i,e[r],r))return e[r];return null},ua:function(e,t){var i=d.a.m(e,t);i>0?e.splice(i,1):0===i&&e.shift()},rb:function(e){e=e||[];for(var t=[],i=0,r=e.length;r>i;i++)0>d.a.m(t,e[i])&&t.push(e[i]);return t},Da:function(e,t){e=e||[];for(var i=[],r=0,n=e.length;n>r;r++)i.push(t(e[r],r));return i},ta:function(e,t){e=e||[];for(var i=[],r=0,n=e.length;n>r;r++)t(e[r],r)&&i.push(e[r]);return i},ga:function(e,t){if(t instanceof Array)e.push.apply(e,t);else for(var i=0,r=t.length;r>i;i++)e.push(t[i]);return e},ea:function(e,t,i){var r=d.a.m(d.a.Xa(e),t);0>r?i&&e.push(t):i||e.splice(r,1)},xa:u,extend:i,za:l,Aa:u?l:i,G:t,na:function(e,t){if(!e)return e;var i,r={};for(i in e)e.hasOwnProperty(i)&&(r[i]=t(e[i],i,e));return r},Ka:function(e){for(;e.firstChild;)d.removeNode(e.firstChild)},oc:function(e){e=d.a.S(e);for(var t=n.createElement("div"),i=0,r=e.length;r>i;i++)t.appendChild(d.R(e[i]));return t},ia:function(e,t){for(var i=0,r=e.length,n=[];r>i;i++){var o=e[i].cloneNode(!0);n.push(t?d.R(o):o)}return n},T:function(e,t){if(d.a.Ka(e),t)for(var i=0,r=t.length;r>i;i++)e.appendChild(t[i])},Lb:function(e,t){var i=e.nodeType?[e]:e;if(0<i.length){for(var r=i[0],n=r.parentNode,o=0,a=t.length;a>o;o++)n.insertBefore(t[o],r);for(o=0,a=i.length;a>o;o++)d.removeNode(i[o])}},ka:function(e,t){if(e.length){for(t=8===t.nodeType&&t.parentNode||t;e.length&&e[0].parentNode!==t;)e.shift();if(1<e.length){var i=e[0],r=e[e.length-1];for(e.length=0;i!==r;)if(e.push(i),i=i.nextSibling,!i)return;e.push(r)}}return e},Nb:function(e,t){7>m?e.setAttribute("selected",t):e.selected=t},cb:function(t){return null===t||t===e?"":t.trim?t.trim():t.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},vc:function(e,t){return e=e||"",t.length>e.length?!1:e.substring(0,t.length)===t},cc:function(e,t){if(e===t)return!0;if(11===e.nodeType)return!1;if(t.contains)return t.contains(3===e.nodeType?e.parentNode:e);if(t.compareDocumentPosition)return 16==(16&t.compareDocumentPosition(e));for(;e&&e!=t;)e=e.parentNode;return!!e},Ja:function(e){return d.a.cc(e,e.ownerDocument.documentElement)},ob:function(e){return!!d.a.qb(e,d.a.Ja)},t:function(e){return e&&e.tagName&&e.tagName.toLowerCase()},n:function(e,t,i){var r=m&&p[t];if(!r&&a)a(e).bind(t,i);else if(r||"function"!=typeof e.addEventListener){if("undefined"==typeof e.attachEvent)throw Error("Browser doesn't support addEventListener or attachEvent");var n=function(t){i.call(e,t)},o="on"+t;e.attachEvent(o,n),d.a.w.da(e,function(){e.detachEvent(o,n)})}else e.addEventListener(t,i,!1)},oa:function(e,t){if(!e||!e.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var i;if("input"===d.a.t(e)&&e.type&&"click"==t.toLowerCase()?(i=e.type,i="checkbox"==i||"radio"==i):i=!1,a&&!i)a(e).trigger(t);else if("function"==typeof n.createEvent){if("function"!=typeof e.dispatchEvent)throw Error("The supplied element doesn't support dispatchEvent");i=n.createEvent(h[t]||"HTMLEvents"),i.initEvent(t,!0,!0,r,0,0,0,0,0,!1,!1,!1,!1,0,e),e.dispatchEvent(i)}else if(i&&e.click)e.click();else{if("undefined"==typeof e.fireEvent)throw Error("Browser doesn't support triggering events");e.fireEvent("on"+t)}},c:function(e){return d.C(e)?e():e},Xa:function(e){return d.C(e)?e.v():e},Ba:function(e,t,i){if(t){var r=/\S+/g,n=e.className.match(r)||[];d.a.u(t.match(r),function(e){d.a.ea(n,e,i)}),e.className=n.join(" ")}},bb:function(t,i){var r=d.a.c(i);(null===r||r===e)&&(r="");var n=d.f.firstChild(t);!n||3!=n.nodeType||d.f.nextSibling(n)?d.f.T(t,[t.ownerDocument.createTextNode(r)]):n.data=r,d.a.fc(t)},Mb:function(e,t){if(e.name=t,7>=m)try{e.mergeAttributes(n.createElement("<input name='"+e.name+"'/>"),!1)}catch(i){}},fc:function(e){m>=9&&(e=1==e.nodeType?e:e.parentNode,e.style&&(e.style.zoom=e.style.zoom))},dc:function(e){if(m){var t=e.style.width;e.style.width=0,e.style.width=t}},sc:function(e,t){e=d.a.c(e),t=d.a.c(t);for(var i=[],r=e;t>=r;r++)i.push(r);return i},S:function(e){for(var t=[],i=0,r=e.length;r>i;i++)t.push(e[i]);return t},yc:6===m,zc:7===m,L:m,xb:function(e,t){for(var i=d.a.S(e.getElementsByTagName("input")).concat(d.a.S(e.getElementsByTagName("textarea"))),r="string"==typeof t?function(e){return e.name===t}:function(e){return t.test(e.name)},n=[],o=i.length-1;o>=0;o--)r(i[o])&&n.push(i[o]);return n},pc:function(e){return"string"==typeof e&&(e=d.a.cb(e))?s&&s.parse?s.parse(e):new Function("return "+e)():null},eb:function(e,t,i){if(!s||!s.stringify)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");return s.stringify(d.a.c(e),t,i)},qc:function(e,i,r){r=r||{};var o=r.params||{},a=r.includeFields||this.vb,s=e;if("object"==typeof e&&"form"===d.a.t(e))for(var s=e.action,l=a.length-1;l>=0;l--)for(var u=d.a.xb(e,a[l]),c=u.length-1;c>=0;c--)o[u[c].name]=u[c].value;i=d.a.c(i);var h=n.createElement("form");h.style.display="none",h.action=s,h.method="post";for(var p in i)e=n.createElement("input"),e.type="hidden",e.name=p,e.value=d.a.eb(d.a.c(i[p])),h.appendChild(e);t(o,function(e,t){var i=n.createElement("input");i.type="hidden",i.name=e,i.value=t,h.appendChild(i)}),n.body.appendChild(h),r.submitter?r.submitter(h):h.submit(),setTimeout(function(){h.parentNode.removeChild(h)},0)}}}(),d.b("utils",d.a),d.b("utils.arrayForEach",d.a.u),d.b("utils.arrayFirst",d.a.qb),d.b("utils.arrayFilter",d.a.ta),d.b("utils.arrayGetDistinctValues",d.a.rb),d.b("utils.arrayIndexOf",d.a.m),d.b("utils.arrayMap",d.a.Da),d.b("utils.arrayPushAll",d.a.ga),d.b("utils.arrayRemoveItem",d.a.ua),d.b("utils.extend",d.a.extend),d.b("utils.fieldsIncludedWithJsonPost",d.a.vb),d.b("utils.getFormFields",d.a.xb),d.b("utils.peekObservable",d.a.Xa),d.b("utils.postJson",d.a.qc),d.b("utils.parseJson",d.a.pc),d.b("utils.registerEventHandler",d.a.n),d.b("utils.stringifyJson",d.a.eb),d.b("utils.range",d.a.sc),d.b("utils.toggleDomNodeCssClass",d.a.Ba),d.b("utils.triggerEvent",d.a.oa),d.b("utils.unwrapObservable",d.a.c),d.b("utils.objectForEach",d.a.G),d.b("utils.addOrRemoveItem",d.a.ea),d.b("unwrap",d.a.c),Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,i=Array.prototype.slice.call(arguments);return e=i.shift(),function(){return t.apply(e,i.concat(Array.prototype.slice.call(arguments)))}}),d.a.e=new function(){function t(t,o){var a=t[r];if(!a||"null"===a||!n[a]){if(!o)return e;a=t[r]="ko"+i++,n[a]={}}return n[a]}var i=0,r="__ko__"+(new Date).getTime(),n={};return{get:function(i,r){var n=t(i,!1);return n===e?e:n[r]},set:function(i,r,n){(n!==e||t(i,!1)!==e)&&(t(i,!0)[r]=n)},clear:function(e){var t=e[r];return t?(delete n[t],e[r]=null,!0):!1},F:function(){return i++ +r}}},d.b("utils.domData",d.a.e),d.b("utils.domData.clear",d.a.e.clear),d.a.w=new function(){function t(t,i){var n=d.a.e.get(t,r);return n===e&&i&&(n=[],d.a.e.set(t,r,n)),n}function i(e){var r=t(e,!1);if(r)for(var r=r.slice(0),n=0;n<r.length;n++)r[n](e);if(d.a.e.clear(e),d.a.w.cleanExternalData(e),o[e.nodeType])for(r=e.firstChild;e=r;)r=e.nextSibling,8===e.nodeType&&i(e)}var r=d.a.e.F(),n={1:!0,8:!0,9:!0},o={1:!0,9:!0};return{da:function(e,i){if("function"!=typeof i)throw Error("Callback must be a function");t(e,!0).push(i)},Kb:function(i,n){var o=t(i,!1);o&&(d.a.ua(o,n),0==o.length&&d.a.e.set(i,r,e))},R:function(e){if(n[e.nodeType]&&(i(e),o[e.nodeType])){var t=[];d.a.ga(t,e.getElementsByTagName("*"));for(var r=0,a=t.length;a>r;r++)i(t[r])}return e},removeNode:function(e){d.R(e),e.parentNode&&e.parentNode.removeChild(e)},cleanExternalData:function(e){a&&"function"==typeof a.cleanData&&a.cleanData([e])}}},d.R=d.a.w.R,d.removeNode=d.a.w.removeNode,d.b("cleanNode",d.R),d.b("removeNode",d.removeNode),d.b("utils.domNodeDisposal",d.a.w),d.b("utils.domNodeDisposal.addDisposeCallback",d.a.w.da),d.b("utils.domNodeDisposal.removeDisposeCallback",d.a.w.Kb),function(){d.a.ba=function(e){var t;if(a){if(a.parseHTML)t=a.parseHTML(e)||[];else if((t=a.clean([e]))&&t[0]){for(e=t[0];e.parentNode&&11!==e.parentNode.nodeType;)e=e.parentNode;e.parentNode&&e.parentNode.removeChild(e)}}else{var i=d.a.cb(e).toLowerCase();for(t=n.createElement("div"),i=i.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!i.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!i.indexOf("<td")||!i.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""],e="ignored<div>"+i[1]+e+i[2]+"</div>","function"==typeof r.innerShiv?t.appendChild(r.innerShiv(e)):t.innerHTML=e;i[0]--;)t=t.lastChild;t=d.a.S(t.lastChild.childNodes)}return t},d.a.$a=function(t,i){if(d.a.Ka(t),i=d.a.c(i),null!==i&&i!==e)if("string"!=typeof i&&(i=i.toString()),a)a(t).html(i);else for(var r=d.a.ba(i),n=0;n<r.length;n++)t.appendChild(r[n])}}(),d.b("utils.parseHtmlFragment",d.a.ba),d.b("utils.setHtml",d.a.$a),d.D=function(){function t(e,i){if(e)if(8==e.nodeType){var r=d.D.Gb(e.nodeValue);null!=r&&i.push({bc:e,mc:r})}else if(1==e.nodeType)for(var r=0,n=e.childNodes,o=n.length;o>r;r++)t(n[r],i)}var i={};return{Ua:function(e){if("function"!=typeof e)throw Error("You can only pass a function to ko.memoization.memoize()");var t=(0|4294967296*(1+Math.random())).toString(16).substring(1)+(0|4294967296*(1+Math.random())).toString(16).substring(1);return i[t]=e,"<!--[ko_memo:"+t+"]-->"},Rb:function(t,r){var n=i[t];if(n===e)throw Error("Couldn't find any memo with ID "+t+". Perhaps it's already been unmemoized.");try{return n.apply(null,r||[]),!0}finally{delete i[t]}},Sb:function(e,i){var r=[];t(e,r);for(var n=0,o=r.length;o>n;n++){var a=r[n].bc,s=[a];i&&d.a.ga(s,i),d.D.Rb(r[n].mc,s),a.nodeValue="",a.parentNode&&a.parentNode.removeChild(a)}},Gb:function(e){return(e=e.match(/^\[ko_memo\:(.*?)\]$/))?e[1]:null}}}(),d.b("memoization",d.D),d.b("memoization.memoize",d.D.Ua),d.b("memoization.unmemoize",d.D.Rb),d.b("memoization.parseMemoText",d.D.Gb),d.b("memoization.unmemoizeDomNodeAndDescendants",d.D.Sb),d.La={throttle:function(e,t){e.throttleEvaluation=t;var i=null;return d.j({read:e,write:function(r){clearTimeout(i),i=setTimeout(function(){e(r)},t)}})},rateLimit:function(e,t){var i,r,n;"number"==typeof t?i=t:(i=t.timeout,r=t.method),n="notifyWhenChangesStop"==r?c:u,e.Ta(function(e){return n(e,i)})},notify:function(e,t){e.equalityComparer="always"==t?null:l}};var p={undefined:1,"boolean":1,number:1,string:1};d.b("extenders",d.La),d.Pb=function(e,t,i){this.target=e,this.wa=t,this.ac=i,this.Cb=!1,d.A(this,"dispose",this.K)},d.Pb.prototype.K=function(){this.Cb=!0,this.ac()},d.P=function(){d.a.Aa(this,d.P.fn),this.M={}};var m="change",f={U:function(e,t,i){var r=this;i=i||m;var n=new d.Pb(r,t?e.bind(t):e,function(){d.a.ua(r.M[i],n),r.nb&&r.nb()});return r.va&&r.va(i),r.M[i]||(r.M[i]=[]),r.M[i].push(n),n},notifySubscribers:function(e,t){if(t=t||m,this.Ab(t))try{d.k.Ea();for(var i,r=this.M[t].slice(0),n=0;i=r[n];++n)i.Cb||i.wa(e)}finally{d.k.end()}},Ta:function(e){var t,i,r,n=this,o=d.C(n);n.qa||(n.qa=n.notifySubscribers,n.notifySubscribers=function(e,t){t&&t!==m?"beforeChange"===t?n.kb(e):n.qa(e,t):n.lb(e)});var a=e(function(){o&&r===n&&(r=n()),t=!1,n.Pa(i,r)&&n.qa(i=r)});n.lb=function(e){t=!0,r=e,a()},n.kb=function(e){t||(i=e,n.qa(e,"beforeChange"))}},Ab:function(e){return this.M[e]&&this.M[e].length},yb:function(){var e=0;return d.a.G(this.M,function(t,i){e+=i.length}),e},Pa:function(e,t){return!this.equalityComparer||!this.equalityComparer(e,t)},extend:function(e){var t=this;return e&&d.a.G(e,function(e,i){var r=d.La[e];"function"==typeof r&&(t=r(t,i)||t)}),t}};d.A(f,"subscribe",f.U),d.A(f,"extend",f.extend),d.A(f,"getSubscriptionsCount",f.yb),d.a.xa&&d.a.za(f,Function.prototype),d.P.fn=f,d.Db=function(e){return null!=e&&"function"==typeof e.U&&"function"==typeof e.notifySubscribers},d.b("subscribable",d.P),d.b("isSubscribable",d.Db),d.Y=d.k=function(){function e(e){r.push(i),i=e}function t(){i=r.pop()}var i,r=[],n=0;return{Ea:e,end:t,Jb:function(e){if(i){if(!d.Db(e))throw Error("Only subscribable things can act as dependencies");i.wa(e,e.Vb||(e.Vb=++n))}},B:function(i,r,n){try{return e(),i.apply(r,n||[])}finally{t()}},la:function(){return i?i.s.la():void 0},ma:function(){return i?i.ma:void 0}}}(),d.b("computedContext",d.Y),d.b("computedContext.getDependenciesCount",d.Y.la),d.b("computedContext.isInitial",d.Y.ma),d.b("computedContext.isSleeping",d.Y.Ac),d.p=function(e){function t(){return 0<arguments.length?(t.Pa(i,arguments[0])&&(t.X(),i=arguments[0],t.W()),this):(d.k.Jb(t),i)}var i=e;return d.P.call(t),d.a.Aa(t,d.p.fn),t.v=function(){return i},t.W=function(){t.notifySubscribers(i)},t.X=function(){t.notifySubscribers(i,"beforeChange")},d.A(t,"peek",t.v),d.A(t,"valueHasMutated",t.W),d.A(t,"valueWillMutate",t.X),t},d.p.fn={equalityComparer:l};var v=d.p.rc="__ko_proto__";d.p.fn[v]=d.p,d.a.xa&&d.a.za(d.p.fn,d.P.fn),d.Ma=function(t,i){return null===t||t===e||t[v]===e?!1:t[v]===i?!0:d.Ma(t[v],i)},d.C=function(e){return d.Ma(e,d.p)},d.Ra=function(e){return"function"==typeof e&&e[v]===d.p||"function"==typeof e&&e[v]===d.j&&e.hc?!0:!1},d.b("observable",d.p),d.b("isObservable",d.C),d.b("isWriteableObservable",d.Ra),d.b("isWritableObservable",d.Ra),d.aa=function(e){if(e=e||[],"object"!=typeof e||!("length"in e))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return e=d.p(e),d.a.Aa(e,d.aa.fn),e.extend({trackArrayChanges:!0})},d.aa.fn={remove:function(e){for(var t=this.v(),i=[],r="function"!=typeof e||d.C(e)?function(t){return t===e}:e,n=0;n<t.length;n++){var o=t[n];r(o)&&(0===i.length&&this.X(),i.push(o),t.splice(n,1),n--)}return i.length&&this.W(),i},removeAll:function(t){if(t===e){var i=this.v(),r=i.slice(0);return this.X(),i.splice(0,i.length),this.W(),r}return t?this.remove(function(e){return 0<=d.a.m(t,e)}):[]},destroy:function(e){var t=this.v(),i="function"!=typeof e||d.C(e)?function(t){return t===e}:e;this.X();for(var r=t.length-1;r>=0;r--)i(t[r])&&(t[r]._destroy=!0);this.W()},destroyAll:function(t){return t===e?this.destroy(function(){return!0}):t?this.destroy(function(e){return 0<=d.a.m(t,e)}):[]},indexOf:function(e){var t=this();return d.a.m(t,e)},replace:function(e,t){var i=this.indexOf(e);i>=0&&(this.X(),this.v()[i]=t,this.W())}},d.a.u("pop push reverse shift sort splice unshift".split(" "),function(e){d.aa.fn[e]=function(){var t=this.v();return this.X(),this.sb(t,e,arguments),t=t[e].apply(t,arguments),this.W(),t}}),d.a.u(["slice"],function(e){d.aa.fn[e]=function(){var t=this();return t[e].apply(t,arguments)}}),d.a.xa&&d.a.za(d.aa.fn,d.p.fn),d.b("observableArray",d.aa);var g="arrayChange";d.La.trackArrayChanges=function(e){function t(){if(!i){i=!0;var t=e.notifySubscribers;e.notifySubscribers=function(e,i){return i&&i!==m||++n,t.apply(this,arguments)};var o=[].concat(e.v()||[]);r=null,e.U(function(t){if(t=[].concat(t||[]),e.Ab(g)){var i;(!r||n>1)&&(r=d.a.Fa(o,t,{sparse:!0})),i=r,i.length&&e.notifySubscribers(i,g)}o=t,r=null,n=0})}}if(!e.sb){var i=!1,r=null,n=0,o=e.U;e.U=e.subscribe=function(e,i,r){return r===g&&t(),o.apply(this,arguments)},e.sb=function(e,t,o){function a(e,t,i){return s[s.length]={status:e,value:t,index:i}}if(i&&!n){var s=[],l=e.length,u=o.length,c=0;switch(t){case"push":c=l;case"unshift":for(t=0;u>t;t++)a("added",o[t],c+t);break;case"pop":c=l-1;case"shift":l&&a("deleted",e[c],c);break;case"splice":t=Math.min(Math.max(0,0>o[0]?l+o[0]:o[0]),l);for(var l=1===u?l:Math.min(t+(o[1]||0),l),u=t+u-2,c=Math.max(l,u),h=[],p=[],m=2;c>t;++t,++m)l>t&&p.push(a("deleted",e[t],t)),u>t&&h.push(a("added",o[m],t));d.a.wb(p,h);break;default:return}r=s}}}},d.s=d.j=function(t,i,r){function n(){d.a.G(x,function(e,t){t.K()}),x={}}function o(){n(),T=0,v=!0,p=!1}function a(){var e=l.throttleEvaluation;e&&e>=0?(clearTimeout(P),P=setTimeout(s,e)):l.ib?l.ib():s()}function s(t){if(m){if(_)throw Error("A 'pure' computed must not be called recursively")}else if(!v){if(E&&E()){if(!f)return b(),void 0}else f=!1;if(m=!0,y)try{var r={};d.k.Ea({wa:function(e,t){r[t]||(r[t]=1,++T)},s:l,ma:e}),T=0,h=g.call(i)}finally{d.k.end(),m=!1}else try{var n=x,o=T;d.k.Ea({wa:function(e,t){v||(o&&n[t]?(x[t]=n[t],++T,delete n[t],--o):x[t]||(x[t]=e.U(a),++T))},s:l,ma:_?e:!T}),x={},T=0;try{var s=i?g.call(i):g()}finally{d.k.end(),o&&d.a.G(n,function(e,t){t.K()}),p=!1}l.Pa(h,s)&&(l.notifySubscribers(h,"beforeChange"),h=s,!0!==t&&l.notifySubscribers(h))}finally{m=!1}T||b()}}function l(){if(0<arguments.length){if("function"!=typeof C)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.");return C.apply(i,arguments),this}return d.k.Jb(l),p&&s(!0),h}function u(){return p&&!T&&s(!0),h}function c(){return p||T>0}var h,p=!0,m=!1,f=!1,v=!1,g=t,_=!1,y=!1;if(g&&"object"==typeof g?(r=g,g=r.read):(r=r||{},g||(g=r.read)),"function"!=typeof g)throw Error("Pass a function that returns the value of the ko.computed");var C=r.write,w=r.disposeWhenNodeIsRemoved||r.o||null,S=r.disposeWhen||r.Ia,E=S,b=o,x={},T=0,P=null;i||(i=r.owner),d.P.call(l),d.a.Aa(l,d.j.fn),l.v=u,l.la=function(){return T},l.hc="function"==typeof r.write,l.K=function(){b()},l.Z=c;var A=l.Ta;return l.Ta=function(e){A.call(l,e),l.ib=function(){l.kb(h),p=!0,l.lb(l)}},r.pure?(y=_=!0,l.va=function(){y&&(y=!1,s(!0))},l.nb=function(){l.yb()||(n(),y=p=!0)}):r.deferEvaluation&&(l.va=function(){u(),delete l.va}),d.A(l,"peek",l.v),d.A(l,"dispose",l.K),d.A(l,"isActive",l.Z),d.A(l,"getDependenciesCount",l.la),w&&(f=!0,w.nodeType&&(E=function(){return!d.a.Ja(w)||S&&S()})),y||r.deferEvaluation||s(),w&&c()&&w.nodeType&&(b=function(){d.a.w.Kb(w,b),o()},d.a.w.da(w,b)),l},d.jc=function(e){return d.Ma(e,d.j)},f=d.p.rc,d.j[f]=d.p,d.j.fn={equalityComparer:l},d.j.fn[f]=d.j,d.a.xa&&d.a.za(d.j.fn,d.P.fn),d.b("dependentObservable",d.j),d.b("computed",d.j),d.b("isComputed",d.jc),d.Ib=function(e,t){return"function"==typeof e?d.s(e,t,{pure:!0}):(e=d.a.extend({},e),e.pure=!0,d.s(e,t))},d.b("pureComputed",d.Ib),function(){function t(n,o,a){if(a=a||new r,n=o(n),"object"!=typeof n||null===n||n===e||n instanceof Date||n instanceof String||n instanceof Number||n instanceof Boolean)return n;var s=n instanceof Array?[]:{};return a.save(n,s),i(n,function(i){var r=o(n[i]);switch(typeof r){case"boolean":case"number":case"string":case"function":s[i]=r;break;case"object":case"undefined":var l=a.get(r);s[i]=l!==e?l:t(r,o,a)}}),s}function i(e,t){if(e instanceof Array){for(var i=0;i<e.length;i++)t(i);"function"==typeof e.toJSON&&t("toJSON")}else for(i in e)t(i)}function r(){this.keys=[],this.hb=[]}d.Qb=function(e){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return t(e,function(e){for(var t=0;d.C(e)&&10>t;t++)e=e();return e})},d.toJSON=function(e,t,i){return e=d.Qb(e),d.a.eb(e,t,i)},r.prototype={save:function(e,t){var i=d.a.m(this.keys,e);i>=0?this.hb[i]=t:(this.keys.push(e),this.hb.push(t))},get:function(t){return t=d.a.m(this.keys,t),t>=0?this.hb[t]:e}}}(),d.b("toJS",d.Qb),d.b("toJSON",d.toJSON),function(){d.i={q:function(t){switch(d.a.t(t)){case"option":return!0===t.__ko__hasDomDataOptionValue__?d.a.e.get(t,d.d.options.Va):7>=d.a.L?t.getAttributeNode("value")&&t.getAttributeNode("value").specified?t.value:t.text:t.value;case"select":return 0<=t.selectedIndex?d.i.q(t.options[t.selectedIndex]):e;default:return t.value}},ca:function(t,i,r){switch(d.a.t(t)){case"option":switch(typeof i){case"string":d.a.e.set(t,d.d.options.Va,e),"__ko__hasDomDataOptionValue__"in t&&delete t.__ko__hasDomDataOptionValue__,t.value=i;break;default:d.a.e.set(t,d.d.options.Va,i),t.__ko__hasDomDataOptionValue__=!0,t.value="number"==typeof i?i:""}break;case"select":(""===i||null===i)&&(i=e);for(var n,o=-1,a=0,s=t.options.length;s>a;++a)if(n=d.i.q(t.options[a]),n==i||""==n&&i===e){o=a;break}(r||o>=0||i===e&&1<t.size)&&(t.selectedIndex=o);break;default:(null===i||i===e)&&(i=""),t.value=i}}}}(),d.b("selectExtensions",d.i),d.b("selectExtensions.readValue",d.i.q),d.b("selectExtensions.writeValue",d.i.ca),d.h=function(){function e(e){e=d.a.cb(e),123===e.charCodeAt(0)&&(e=e.slice(1,-1));var t,i,a=[],s=e.match(r),l=0;if(s){s.push(",");for(var u,c=0;u=s[c];++c){var h=u.charCodeAt(0);if(44===h){if(0>=l){t&&a.push(i?{key:t,value:i.join("")}:{unknown:t}),t=i=l=0;continue}}else if(58===h){if(!i)continue}else if(47===h&&c&&1<u.length)(h=s[c-1].match(n))&&!o[h[0]]&&(e=e.substr(e.indexOf(u)+1),s=e.match(r),s.push(","),c=-1,u="/");else if(40===h||123===h||91===h)++l;else if(41===h||125===h||93===h)--l;else if(!t&&!i){t=34===h||39===h?u.slice(1,-1):u;continue}i?i.push(u):i=[u]}}return a}var t=["true","false","null","undefined"],i=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,r=RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]","g"),n=/[\])"'A-Za-z0-9_$]+$/,o={"in":1,"return":1,"typeof":1},a={};return{ha:[],V:a,Wa:e,ya:function(r,n){function o(e,r){var n;if(!c){var h=d.getBindingHandler(e);if(h&&h.preprocess&&!(r=h.preprocess(r,e,o)))return;(h=a[e])&&(n=r,0<=d.a.m(t,n)?n=!1:(h=n.match(i),n=null===h?!1:h[1]?"Object("+h[1]+")"+h[2]:n),h=n),h&&l.push("'"+e+"':function(_z){"+n+"=_z}")}u&&(r="function(){return "+r+" }"),s.push("'"+e+"':"+r)}n=n||{};var s=[],l=[],u=n.valueAccessors,c=n.bindingParams,h="string"==typeof r?e(r):r;return d.a.u(h,function(e){o(e.key||e.unknown,e.value)}),l.length&&o("_ko_property_writers","{"+l.join(",")+" }"),s.join(",")},lc:function(e,t){for(var i=0;i<e.length;i++)if(e[i].key==t)return!0;return!1},pa:function(e,t,i,r,n){e&&d.C(e)?!d.Ra(e)||n&&e.v()===r||e(r):(e=t.get("_ko_property_writers"))&&e[i]&&e[i](r)}}}(),d.b("expressionRewriting",d.h),d.b("expressionRewriting.bindingRewriteValidators",d.h.ha),d.b("expressionRewriting.parseObjectLiteral",d.h.Wa),d.b("expressionRewriting.preProcessBindings",d.h.ya),d.b("expressionRewriting._twoWayBindings",d.h.V),d.b("jsonExpressionRewriting",d.h),d.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",d.h.ya),function(){function e(e){return 8==e.nodeType&&a.test(o?e.text:e.nodeValue)}function t(e){return 8==e.nodeType&&s.test(o?e.text:e.nodeValue)}function i(i,r){for(var n=i,o=1,a=[];n=n.nextSibling;){if(t(n)&&(o--,0===o))return a;a.push(n),e(n)&&o++}if(!r)throw Error("Cannot find closing comment tag to match: "+i.nodeValue);return null}function r(e,t){var r=i(e,t);return r?0<r.length?r[r.length-1].nextSibling:e.nextSibling:null}var o=n&&"<!--test-->"===n.createComment("test").text,a=o?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,s=o?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,l={ul:!0,ol:!0};d.f={Q:{},childNodes:function(t){return e(t)?i(t):t.childNodes},ja:function(t){if(e(t)){t=d.f.childNodes(t);for(var i=0,r=t.length;r>i;i++)d.removeNode(t[i])}else d.a.Ka(t)},T:function(t,i){if(e(t)){d.f.ja(t);for(var r=t.nextSibling,n=0,o=i.length;o>n;n++)r.parentNode.insertBefore(i[n],r)}else d.a.T(t,i)},Hb:function(t,i){e(t)?t.parentNode.insertBefore(i,t.nextSibling):t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i)},Bb:function(t,i,r){r?e(t)?t.parentNode.insertBefore(i,r.nextSibling):r.nextSibling?t.insertBefore(i,r.nextSibling):t.appendChild(i):d.f.Hb(t,i)},firstChild:function(i){return e(i)?!i.nextSibling||t(i.nextSibling)?null:i.nextSibling:i.firstChild},nextSibling:function(i){return e(i)&&(i=r(i)),i.nextSibling&&t(i.nextSibling)?null:i.nextSibling},gc:e,xc:function(e){return(e=(o?e.text:e.nodeValue).match(a))?e[1]:null},Fb:function(i){if(l[d.a.t(i)]){var n=i.firstChild;if(n)do if(1===n.nodeType){var o;o=n.firstChild;var a=null;if(o)do if(a)a.push(o);else if(e(o)){var s=r(o,!0);s?o=s:a=[o]}else t(o)&&(a=[o]);while(o=o.nextSibling);if(o=a)for(a=n.nextSibling,s=0;s<o.length;s++)a?i.insertBefore(o[s],a):i.appendChild(o[s])}while(n=n.nextSibling)}}}}(),d.b("virtualElements",d.f),d.b("virtualElements.allowedBindings",d.f.Q),d.b("virtualElements.emptyNode",d.f.ja),d.b("virtualElements.insertAfter",d.f.Bb),d.b("virtualElements.prepend",d.f.Hb),d.b("virtualElements.setDomNodeChildren",d.f.T),function(){d.J=function(){this.Yb={}},d.a.extend(d.J.prototype,{nodeHasBindings:function(e){switch(e.nodeType){case 1:return null!=e.getAttribute("data-bind")||d.g.getComponentNameForNode(e);case 8:return d.f.gc(e);default:return!1}},getBindings:function(e,t){var i=this.getBindingsString(e,t),i=i?this.parseBindingsString(i,t,e):null;return d.g.mb(i,e,t,!1)},getBindingAccessors:function(e,t){var i=this.getBindingsString(e,t),i=i?this.parseBindingsString(i,t,e,{valueAccessors:!0}):null;return d.g.mb(i,e,t,!0)},getBindingsString:function(e){switch(e.nodeType){case 1:return e.getAttribute("data-bind");case 8:return d.f.xc(e);default:return null}},parseBindingsString:function(e,t,i,r){try{var n,o=this.Yb,a=e+(r&&r.valueAccessors||"");if(!(n=o[a])){var s,l="with($context){with($data||{}){return{"+d.h.ya(e,r)+"}}}";s=new Function("$context","$element",l),n=o[a]=s}return n(t,i)}catch(u){throw u.message="Unable to parse bindings.\nBindings value: "+e+"\nMessage: "+u.message,u}}}),d.J.instance=new d.J}(),d.b("bindingProvider",d.J),function(){function t(e){return function(){return e}}function i(e){return e()}function n(e){return d.a.na(d.k.B(e),function(t,i){return function(){return e()[i]}})}function o(e,t){return n(this.getBindings.bind(this,e,t))}function s(e,t,i){var r,n=d.f.firstChild(t),o=d.J.instance,a=o.preprocessNode;if(a){for(;r=n;)n=d.f.nextSibling(r),a.call(o,r);n=d.f.firstChild(t)}for(;r=n;)n=d.f.nextSibling(r),l(e,r,i)}function l(e,t,i){var r=!0,n=1===t.nodeType;n&&d.f.Fb(t),(n&&i||d.J.instance.nodeHasBindings(t))&&(r=c(t,null,e,i).shouldBindDescendants),r&&!p[d.a.t(t)]&&s(e,t,!n)}function u(e){var t=[],i={},r=[];return d.a.G(e,function n(o){if(!i[o]){var a=d.getBindingHandler(o);a&&(a.after&&(r.push(o),d.a.u(a.after,function(t){if(e[t]){if(-1!==d.a.m(r,t))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+r.join(", "));n(t)}}),r.length--),t.push({key:o,zb:a})),i[o]=!0}}),t}function c(t,r,n,a){var s=d.a.e.get(t,m);if(!r){if(s)throw Error("You cannot apply bindings multiple times to the same element.");d.a.e.set(t,m,!0)}!s&&a&&d.Ob(t,n);var l;if(r&&"function"!=typeof r)l=r;else{var c=d.J.instance,h=c.getBindingAccessors||o,p=d.j(function(){return(l=r?r(n,t):h.call(c,t,n))&&n.I&&n.I(),l},null,{o:t});l&&p.Z()||(p=null)}var f;if(l){var v=p?function(e){return function(){return i(p()[e])}}:function(e){return l[e]},g=function(){return d.a.na(p?p():l,i)};g.get=function(e){return l[e]&&i(v(e))},g.has=function(e){return e in l},a=u(l),d.a.u(a,function(i){var r=i.zb.init,o=i.zb.update,a=i.key;if(8===t.nodeType&&!d.f.Q[a])throw Error("The binding '"+a+"' cannot be used with virtual elements");try{"function"==typeof r&&d.k.B(function(){var i=r(t,v(a),g,n.$data,n);if(i&&i.controlsDescendantBindings){if(f!==e)throw Error("Multiple bindings ("+f+" and "+a+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");f=a}}),"function"==typeof o&&d.j(function(){o(t,v(a),g,n.$data,n)},null,{o:t})}catch(s){throw s.message='Unable to process binding "'+a+": "+l[a]+'"\nMessage: '+s.message,s}})}return{shouldBindDescendants:f===e}}function h(e){return e&&e instanceof d.N?e:new d.N(e)}d.d={};var p={script:!0};d.getBindingHandler=function(e){return d.d[e]},d.N=function(t,i,r,n){var o,a=this,s="function"==typeof t&&!d.C(t),l=d.j(function(){var e=s?t():t,o=d.a.c(e);return i?(i.I&&i.I(),d.a.extend(a,i),l&&(a.I=l)):(a.$parents=[],a.$root=o,a.ko=d),a.$rawData=e,a.$data=o,r&&(a[r]=o),n&&n(a,i,o),a.$data},null,{Ia:function(){return o&&!d.a.ob(o)},o:!0});l.Z()&&(a.I=l,l.equalityComparer=null,o=[],l.Tb=function(t){o.push(t),d.a.w.da(t,function(t){d.a.ua(o,t),o.length||(l.K(),a.I=l=e)})})},d.N.prototype.createChildContext=function(e,t,i){return new d.N(e,this,t,function(e,t){e.$parentContext=t,e.$parent=t.$data,e.$parents=(t.$parents||[]).slice(0),e.$parents.unshift(e.$parent),i&&i(e)})},d.N.prototype.extend=function(e){return new d.N(this.I||this.$data,this,null,function(t,i){t.$rawData=i.$rawData,d.a.extend(t,"function"==typeof e?e():e)})};var m=d.a.e.F(),f=d.a.e.F();d.Ob=function(e,t){return 2!=arguments.length?d.a.e.get(e,f):(d.a.e.set(e,f,t),t.I&&t.I.Tb(e),void 0)},d.ra=function(e,t,i){return 1===e.nodeType&&d.f.Fb(e),c(e,t,h(i),!0)},d.Wb=function(e,i,r){return r=h(r),d.ra(e,"function"==typeof i?n(i.bind(null,r,e)):d.a.na(i,t),r) -},d.Ca=function(e,t){1!==t.nodeType&&8!==t.nodeType||s(h(e),t,!0)},d.pb=function(e,t){if(!a&&r.jQuery&&(a=r.jQuery),t&&1!==t.nodeType&&8!==t.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");t=t||r.document.body,l(h(e),t,!0)},d.Ha=function(t){switch(t.nodeType){case 1:case 8:var i=d.Ob(t);if(i)return i;if(t.parentNode)return d.Ha(t.parentNode)}return e},d.$b=function(t){return(t=d.Ha(t))?t.$data:e},d.b("bindingHandlers",d.d),d.b("applyBindings",d.pb),d.b("applyBindingsToDescendants",d.Ca),d.b("applyBindingAccessorsToNode",d.ra),d.b("applyBindingsToNode",d.Wb),d.b("contextFor",d.Ha),d.b("dataFor",d.$b)}(),function(e){function t(t,r){var a,s=n.hasOwnProperty(t)?n[t]:e;s||(s=n[t]=new d.P,i(t,function(e){o[t]=e,delete n[t],a?s.notifySubscribers(e):setTimeout(function(){s.notifySubscribers(e)},0)}),a=!0),s.U(r)}function i(e,t){r("getConfig",[e],function(i){i?r("loadComponent",[e,i],function(e){t(e)}):t(null)})}function r(t,i,n,o){o||(o=d.g.loaders.slice(0));var a=o.shift();if(a){var s=a[t];if(s){var l=!1;if(s.apply(a,i.concat(function(e){l?n(null):null!==e?n(e):r(t,i,n,o)}))!==e&&(l=!0,!a.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else r(t,i,n,o)}else n(null)}var n={},o={};d.g={get:function(i,r){var n=o.hasOwnProperty(i)?o[i]:e;n?setTimeout(function(){r(n)},0):t(i,r)},tb:function(e){delete o[e]},jb:r},d.g.loaders=[],d.b("components",d.g),d.b("components.get",d.g.get),d.b("components.clearCachedDefinition",d.g.tb)}(),function(){function e(e,t,i,r){function n(){0===--a&&r(o)}var o={},a=2,l=i.template;i=i.viewModel,l?s(t,l,function(t){d.g.jb("loadTemplate",[e,t],function(e){o.template=e,n()})}):n(),i?s(t,i,function(t){d.g.jb("loadViewModel",[e,t],function(e){o[c]=e,n()})}):n()}function t(e,i,r){if("function"==typeof i)r(function(e){return new i(e)});else if("function"==typeof i[c])r(i[c]);else if("instance"in i){var n=i.instance;r(function(){return n})}else"viewModel"in i?t(e,i.viewModel,r):e("Unknown viewModel value: "+i)}function o(e){switch(d.a.t(e)){case"script":return d.a.ba(e.text);case"textarea":return d.a.ba(e.value);case"template":if(a(e.content))return d.a.ia(e.content.childNodes)}return d.a.ia(e.childNodes)}function a(e){return r.DocumentFragment?e instanceof DocumentFragment:e&&11===e.nodeType}function s(e,t,n){"string"==typeof t.require?i||r.require?(i||r.require)([t.require],n):e("Uses require, but no AMD loader is present"):n(t)}function l(e){return function(t){throw Error("Component '"+e+"': "+t)}}var u={};d.g.tc=function(e,t){if(!t)throw Error("Invalid configuration for "+e);if(d.g.Qa(e))throw Error("Component "+e+" is already registered");u[e]=t},d.g.Qa=function(e){return e in u},d.g.wc=function(e){delete u[e],d.g.tb(e)},d.g.ub={getConfig:function(e,t){t(u.hasOwnProperty(e)?u[e]:null)},loadComponent:function(t,i,r){var n=l(t);s(n,i,function(i){e(t,n,i,r)})},loadTemplate:function(e,t,i){if(e=l(e),"string"==typeof t)i(d.a.ba(t));else if(t instanceof Array)i(t);else if(a(t))i(d.a.S(t.childNodes));else if(t.element)if(t=t.element,r.HTMLElement?t instanceof HTMLElement:t&&t.tagName&&1===t.nodeType)i(o(t));else if("string"==typeof t){var s=n.getElementById(t);s?i(o(s)):e("Cannot find element with ID "+t)}else e("Unknown element type: "+t);else e("Unknown template value: "+t)},loadViewModel:function(e,i,r){t(l(e),i,r)}};var c="createViewModel";d.b("components.register",d.g.tc),d.b("components.isRegistered",d.g.Qa),d.b("components.unregister",d.g.wc),d.b("components.defaultLoader",d.g.ub),d.g.loaders.push(d.g.ub),d.g.Ub=u}(),function(){function e(e,i){var r=e.getAttribute("params");if(r){var r=t.parseBindingsString(r,i,e,{valueAccessors:!0,bindingParams:!0}),r=d.a.na(r,function(t){return d.s(t,null,{o:e})}),n=d.a.na(r,function(t){return t.Z()?d.s(function(){return d.a.c(t())},null,{o:e}):t.v()});return n.hasOwnProperty("$raw")||(n.$raw=r),n}return{$raw:{}}}d.g.getComponentNameForNode=function(e){return e=d.a.t(e),d.g.Qa(e)&&e},d.g.mb=function(t,i,r,n){if(1===i.nodeType){var o=d.g.getComponentNameForNode(i);if(o){if(t=t||{},t.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var a={name:o,params:e(i,r)};t.component=n?function(){return a}:a}}return t};var t=new d.J;9>d.a.L&&(d.g.register=function(e){return function(t){return n.createElement(t),e.apply(this,arguments)}}(d.g.register),n.createDocumentFragment=function(e){return function(){var t,i=e(),r=d.g.Ub;for(t in r)r.hasOwnProperty(t)&&i.createElement(t);return i}}(n.createDocumentFragment))}(),function(){var e=0;d.d.component={init:function(t,i,r,n,o){function a(){var e=s&&s.dispose;"function"==typeof e&&e.call(s),l=null}var s,l;return d.a.w.da(t,a),d.s(function(){var r,n,u=d.a.c(i());if("string"==typeof u?r=u:(r=d.a.c(u.name),n=d.a.c(u.params)),!r)throw Error("No component name specified");var c=l=++e;d.g.get(r,function(e){if(l===c){if(a(),!e)throw Error("Unknown component '"+r+"'");var i=e.template;if(!i)throw Error("Component '"+r+"' has no template");i=d.a.ia(i),d.f.T(t,i);var i=n,u=e.createViewModel;e=u?u.call(e,i,{element:t}):i,i=o.createChildContext(e),s=e,d.Ca(i,t)}})},null,{o:t}),{controlsDescendantBindings:!0}}},d.f.Q.component=!0}();var _={"class":"className","for":"htmlFor"};d.d.attr={update:function(t,i){var r=d.a.c(i())||{};d.a.G(r,function(i,r){r=d.a.c(r);var n=!1===r||null===r||r===e;n&&t.removeAttribute(i),8>=d.a.L&&i in _?(i=_[i],n?t.removeAttribute(i):t[i]=r):n||t.setAttribute(i,r.toString()),"name"===i&&d.a.Mb(t,n?"":r.toString())})}},function(){d.d.checked={after:["value","attr"],init:function(t,i,r){function n(){var e=t.checked,n=h?a():e;if(!d.Y.ma()&&(!l||e)){var o=d.k.B(i);u?c!==n?(e&&(d.a.ea(o,n,!0),d.a.ea(o,c,!1)),c=n):d.a.ea(o,n,e):d.h.pa(o,r,"checked",n,!0)}}function o(){var e=d.a.c(i());t.checked=u?0<=d.a.m(e,a()):s?e:a()===e}var a=d.Ib(function(){return r.has("checkedValue")?d.a.c(r.get("checkedValue")):r.has("value")?d.a.c(r.get("value")):t.value}),s="checkbox"==t.type,l="radio"==t.type;if(s||l){var u=s&&d.a.c(i())instanceof Array,c=u?a():e,h=l||u;l&&!t.name&&d.d.uniqueName.init(t,function(){return!0}),d.s(n,null,{o:t}),d.a.n(t,"click",n),d.s(o,null,{o:t})}}},d.h.V.checked=!0,d.d.checkedValue={update:function(e,t){e.value=d.a.c(t())}}}(),d.d.css={update:function(e,t){var i=d.a.c(t());"object"==typeof i?d.a.G(i,function(t,i){i=d.a.c(i),d.a.Ba(e,t,i)}):(i=String(i||""),d.a.Ba(e,e.__ko__cssValue,!1),e.__ko__cssValue=i,d.a.Ba(e,i,!0))}},d.d.enable={update:function(e,t){var i=d.a.c(t());i&&e.disabled?e.removeAttribute("disabled"):i||e.disabled||(e.disabled=!0)}},d.d.disable={update:function(e,t){d.d.enable.update(e,function(){return!d.a.c(t())})}},d.d.event={init:function(e,t,i,r,n){var o=t()||{};d.a.G(o,function(o){"string"==typeof o&&d.a.n(e,o,function(e){var a,s=t()[o];if(s){try{var l=d.a.S(arguments);r=n.$data,l.unshift(r),a=s.apply(r,l)}finally{!0!==a&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}!1===i.get(o+"Bubble")&&(e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation())}})})}},d.d.foreach={Eb:function(e){return function(){var t=e(),i=d.a.Xa(t);return i&&"number"!=typeof i.length?(d.a.c(t),{foreach:i.data,as:i.as,includeDestroyed:i.includeDestroyed,afterAdd:i.afterAdd,beforeRemove:i.beforeRemove,afterRender:i.afterRender,beforeMove:i.beforeMove,afterMove:i.afterMove,templateEngine:d.O.Oa}):{foreach:t,templateEngine:d.O.Oa}}},init:function(e,t){return d.d.template.init(e,d.d.foreach.Eb(t))},update:function(e,t,i,r,n){return d.d.template.update(e,d.d.foreach.Eb(t),i,r,n)}},d.h.ha.foreach=!1,d.f.Q.foreach=!0,d.d.hasfocus={init:function(e,t,i){function r(r){e.__ko_hasfocusUpdating=!0;var n=e.ownerDocument;if("activeElement"in n){var o;try{o=n.activeElement}catch(a){o=n.body}r=o===e}n=t(),d.h.pa(n,i,"hasfocus",r,!0),e.__ko_hasfocusLastValue=r,e.__ko_hasfocusUpdating=!1}var n=r.bind(null,!0),o=r.bind(null,!1);d.a.n(e,"focus",n),d.a.n(e,"focusin",n),d.a.n(e,"blur",o),d.a.n(e,"focusout",o)},update:function(e,t){var i=!!d.a.c(t());e.__ko_hasfocusUpdating||e.__ko_hasfocusLastValue===i||(i?e.focus():e.blur(),d.k.B(d.a.oa,null,[e,i?"focusin":"focusout"]))}},d.h.V.hasfocus=!0,d.d.hasFocus=d.d.hasfocus,d.h.V.hasFocus=!0,d.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){d.a.$a(e,t())}},h("if"),h("ifnot",!1,!0),h("with",!0,!1,function(e,t){return e.createChildContext(t)});var y={};d.d.options={init:function(e){if("select"!==d.a.t(e))throw Error("options binding applies only to SELECT elements");for(;0<e.length;)e.remove(0);return{controlsDescendantBindings:!0}},update:function(t,i,r){function n(){return d.a.ta(t.options,function(e){return e.selected})}function o(e,t,i){var r=typeof t;return"function"==r?t(e):"string"==r?e[t]:i}function a(e,i){if(h.length){var r=0<=d.a.m(h,d.i.q(i[0]));d.a.Nb(i[0],r),p&&!r&&d.k.B(d.a.oa,null,[t,"change"])}}var s=0!=t.length&&t.multiple?t.scrollTop:null,l=d.a.c(i()),u=r.get("optionsIncludeDestroyed");i={};var c,h;h=t.multiple?d.a.Da(n(),d.i.q):0<=t.selectedIndex?[d.i.q(t.options[t.selectedIndex])]:[],l&&("undefined"==typeof l.length&&(l=[l]),c=d.a.ta(l,function(t){return u||t===e||null===t||!d.a.c(t._destroy)}),r.has("optionsCaption")&&(l=d.a.c(r.get("optionsCaption")),null!==l&&l!==e&&c.unshift(y)));var p=!1;i.beforeRemove=function(e){t.removeChild(e)},l=a,r.has("optionsAfterRender")&&(l=function(t,i){a(0,i),d.k.B(r.get("optionsAfterRender"),null,[i[0],t!==y?t:e])}),d.a.Za(t,c,function(i,n,a){return a.length&&(h=a[0].selected?[d.i.q(a[0])]:[],p=!0),n=t.ownerDocument.createElement("option"),i===y?(d.a.bb(n,r.get("optionsCaption")),d.i.ca(n,e)):(a=o(i,r.get("optionsValue"),i),d.i.ca(n,d.a.c(a)),i=o(i,r.get("optionsText"),a),d.a.bb(n,i)),[n]},i,l),d.k.B(function(){r.get("valueAllowUnset")&&r.has("value")?d.i.ca(t,d.a.c(r.get("value")),!0):(t.multiple?h.length&&n().length<h.length:h.length&&0<=t.selectedIndex?d.i.q(t.options[t.selectedIndex])!==h[0]:h.length||0<=t.selectedIndex)&&d.a.oa(t,"change")}),d.a.dc(t),s&&20<Math.abs(s-t.scrollTop)&&(t.scrollTop=s)}},d.d.options.Va=d.a.e.F(),d.d.selectedOptions={after:["options","foreach"],init:function(e,t,i){d.a.n(e,"change",function(){var r=t(),n=[];d.a.u(e.getElementsByTagName("option"),function(e){e.selected&&n.push(d.i.q(e))}),d.h.pa(r,i,"selectedOptions",n)})},update:function(e,t){if("select"!=d.a.t(e))throw Error("values binding applies only to SELECT elements");var i=d.a.c(t());i&&"number"==typeof i.length&&d.a.u(e.getElementsByTagName("option"),function(e){var t=0<=d.a.m(i,d.i.q(e));d.a.Nb(e,t)})}},d.h.V.selectedOptions=!0,d.d.style={update:function(t,i){var r=d.a.c(i()||{});d.a.G(r,function(i,r){r=d.a.c(r),(null===r||r===e||!1===r)&&(r=""),t.style[i]=r})}},d.d.submit={init:function(e,t,i,r,n){if("function"!=typeof t())throw Error("The value for a submit binding must be a function");d.a.n(e,"submit",function(i){var r,o=t();try{r=o.call(n.$data,e)}finally{!0!==r&&(i.preventDefault?i.preventDefault():i.returnValue=!1)}})}},d.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){d.a.bb(e,t())}},d.f.Q.text=!0,function(){if(r&&r.navigator)var t=function(e){return e?parseFloat(e[1]):void 0},i=r.opera&&r.opera.version&&parseInt(r.opera.version()),n=r.navigator.userAgent,o=t(n.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),a=t(n.match(/Firefox\/([^ ]*)/));if(10>d.a.L)var s=d.a.e.F(),l=d.a.e.F(),u=function(e){var t=this.activeElement;(t=t&&d.a.e.get(t,l))&&t(e)},c=function(e,t){var i=e.ownerDocument;d.a.e.get(i,s)||(d.a.e.set(i,s,!0),d.a.n(i,"selectionchange",u)),d.a.e.set(e,l,t)};d.d.textInput={init:function(t,r,n){function s(e,i){d.a.n(t,e,i)}function l(){var i=d.a.c(r());(null===i||i===e)&&(i=""),m!==e&&i===m?setTimeout(l,4):t.value!==i&&(f=i,t.value=i)}function u(){p||(m=t.value,p=setTimeout(h,4))}function h(){clearTimeout(p),m=p=e;var i=t.value;f!==i&&(f=i,d.h.pa(r(),n,"textInput",i))}var p,m,f=t.value;10>d.a.L?(s("propertychange",function(e){"value"===e.propertyName&&h()}),8==d.a.L&&(s("keyup",h),s("keydown",h)),8<=d.a.L&&(c(t,h),s("dragend",u))):(s("input",h),5>o&&"textarea"===d.a.t(t)?(s("keydown",u),s("paste",u),s("cut",u)):11>i?s("keydown",u):4>a&&(s("DOMAutoComplete",h),s("dragdrop",h),s("drop",h))),s("change",h),d.s(l,null,{o:t})}},d.h.V.textInput=!0,d.d.textinput={preprocess:function(e,t,i){i("textInput",e)}}}(),d.d.uniqueName={init:function(e,t){if(t()){var i="ko_unique_"+ ++d.d.uniqueName.Zb;d.a.Mb(e,i)}}},d.d.uniqueName.Zb=0,d.d.value={after:["options","foreach"],init:function(e,t,i){if("input"!=e.tagName.toLowerCase()||"checkbox"!=e.type&&"radio"!=e.type){var r=["change"],n=i.get("valueUpdate"),o=!1,a=null;n&&("string"==typeof n&&(n=[n]),d.a.ga(r,n),r=d.a.rb(r));var s=function(){a=null,o=!1;var r=t(),n=d.i.q(e);d.h.pa(r,i,"value",n)};!d.a.L||"input"!=e.tagName.toLowerCase()||"text"!=e.type||"off"==e.autocomplete||e.form&&"off"==e.form.autocomplete||-1!=d.a.m(r,"propertychange")||(d.a.n(e,"propertychange",function(){o=!0}),d.a.n(e,"focus",function(){o=!1}),d.a.n(e,"blur",function(){o&&s()})),d.a.u(r,function(t){var i=s;d.a.vc(t,"after")&&(i=function(){a=d.i.q(e),setTimeout(s,0)},t=t.substring(5)),d.a.n(e,t,i)});var l=function(){var r=d.a.c(t()),n=d.i.q(e);if(null!==a&&r===a)setTimeout(l,0);else if(r!==n)if("select"===d.a.t(e)){var o=i.get("valueAllowUnset"),n=function(){d.i.ca(e,r,o)};n(),o||r===d.i.q(e)?setTimeout(n,0):d.k.B(d.a.oa,null,[e,"change"])}else d.i.ca(e,r)};d.s(l,null,{o:e})}else d.ra(e,{checkedValue:t})},update:function(){}},d.h.V.value=!0,d.d.visible={update:function(e,t){var i=d.a.c(t()),r="none"!=e.style.display;i&&!r?e.style.display="":!i&&r&&(e.style.display="none")}},function(e){d.d[e]={init:function(t,i,r,n,o){return d.d.event.init.call(this,t,function(){var t={};return t[e]=i(),t},r,n,o)}}}("click"),d.H=function(){},d.H.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},d.H.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},d.H.prototype.makeTemplateSource=function(e,t){if("string"==typeof e){t=t||n;var i=t.getElementById(e);if(!i)throw Error("Cannot find template with ID "+e);return new d.r.l(i)}if(1==e.nodeType||8==e.nodeType)return new d.r.fa(e);throw Error("Unknown template type: "+e)},d.H.prototype.renderTemplate=function(e,t,i,r){return e=this.makeTemplateSource(e,r),this.renderTemplateSource(e,t,i)},d.H.prototype.isTemplateRewritten=function(e,t){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(e,t).data("isRewritten")},d.H.prototype.rewriteTemplate=function(e,t,i){e=this.makeTemplateSource(e,i),t=t(e.text()),e.text(t),e.data("isRewritten",!0)},d.b("templateEngine",d.H),d.fb=function(){function e(e,t,i,r){e=d.h.Wa(e);for(var n=d.h.ha,o=0;o<e.length;o++){var a=e[o].key;if(n.hasOwnProperty(a)){var s=n[a];if("function"==typeof s){if(a=s(e[o].value))throw Error(a)}else if(!s)throw Error("This template engine does not support the '"+a+"' binding within its templates")}}return i="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+d.h.ya(e,{valueAccessors:!0})+" } })()},'"+i.toLowerCase()+"')",r.createJavaScriptEvaluatorBlock(i)+t}var t=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,i=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{ec:function(e,t,i){t.isTemplateRewritten(e,i)||t.rewriteTemplate(e,function(e){return d.fb.nc(e,t)},i)},nc:function(r,n){return r.replace(t,function(t,i,r,o,a){return e(a,i,r,n)}).replace(i,function(t,i){return e(i,"<!-- ko -->","#comment",n)})},Xb:function(e,t){return d.D.Ua(function(i,r){var n=i.nextSibling;n&&n.nodeName.toLowerCase()===t&&d.ra(n,e,r)})}}}(),d.b("__tr_ambtns",d.fb.Xb),function(){d.r={},d.r.l=function(e){this.l=e},d.r.l.prototype.text=function(){var e=d.a.t(this.l),e="script"===e?"text":"textarea"===e?"value":"innerHTML";if(0==arguments.length)return this.l[e];var t=arguments[0];"innerHTML"===e?d.a.$a(this.l,t):this.l[e]=t};var t=d.a.e.F()+"_";d.r.l.prototype.data=function(e){return 1===arguments.length?d.a.e.get(this.l,t+e):(d.a.e.set(this.l,t+e,arguments[1]),void 0)};var i=d.a.e.F();d.r.fa=function(e){this.l=e},d.r.fa.prototype=new d.r.l,d.r.fa.prototype.text=function(){if(0==arguments.length){var t=d.a.e.get(this.l,i)||{};return t.gb===e&&t.Ga&&(t.gb=t.Ga.innerHTML),t.gb}d.a.e.set(this.l,i,{gb:arguments[0]})},d.r.l.prototype.nodes=function(){return 0==arguments.length?(d.a.e.get(this.l,i)||{}).Ga:(d.a.e.set(this.l,i,{Ga:arguments[0]}),void 0)},d.b("templateSources",d.r),d.b("templateSources.domElement",d.r.l),d.b("templateSources.anonymousTemplate",d.r.fa)}(),function(){function t(e,t,i){var r;for(t=d.f.nextSibling(t);e&&(r=e)!==t;)e=d.f.nextSibling(r),i(r,e)}function i(e,i){if(e.length){var r=e[0],n=e[e.length-1],o=r.parentNode,a=d.J.instance,s=a.preprocessNode;if(s){if(t(r,n,function(e,t){var i=e.previousSibling,o=s.call(a,e);o&&(e===r&&(r=o[0]||t),e===n&&(n=o[o.length-1]||i))}),e.length=0,!r)return;r===n?e.push(r):(e.push(r,n),d.a.ka(e,o))}t(r,n,function(e){1!==e.nodeType&&8!==e.nodeType||d.pb(i,e)}),t(r,n,function(e){1!==e.nodeType&&8!==e.nodeType||d.D.Sb(e,[i])}),d.a.ka(e,o)}}function r(e){return e.nodeType?e:0<e.length?e[0]:null}function n(e,t,n,a,s){s=s||{};var l=e&&r(e),l=l&&l.ownerDocument,u=s.templateEngine||o;if(d.fb.ec(n,u,l),n=u.renderTemplate(n,a,s,l),"number"!=typeof n.length||0<n.length&&"number"!=typeof n[0].nodeType)throw Error("Template engine must return an array of DOM nodes");switch(l=!1,t){case"replaceChildren":d.f.T(e,n),l=!0;break;case"replaceNode":d.a.Lb(e,n),l=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+t)}return l&&(i(n,a),s.afterRender&&d.k.B(s.afterRender,null,[n,a.$data])),n}var o;d.ab=function(t){if(t!=e&&!(t instanceof d.H))throw Error("templateEngine must inherit from ko.templateEngine");o=t},d.Ya=function(t,i,a,s,l){if(a=a||{},(a.templateEngine||o)==e)throw Error("Set a template engine before calling renderTemplate");if(l=l||"replaceChildren",s){var u=r(s);return d.j(function(){var e=i&&i instanceof d.N?i:new d.N(d.a.c(i)),o=d.C(t)?t():"function"==typeof t?t(e.$data,e):t,e=n(s,l,o,e,a);"replaceNode"==l&&(s=e,u=r(s))},null,{Ia:function(){return!u||!d.a.Ja(u)},o:u&&"replaceNode"==l?u.parentNode:u})}return d.D.Ua(function(e){d.Ya(t,i,a,e,"replaceNode")})},d.uc=function(t,r,o,a,s){function l(e,t){i(t,c),o.afterRender&&o.afterRender(t,e)}function u(e,i){c=s.createChildContext(e,o.as,function(e){e.$index=i});var r=d.C(t)?t():"function"==typeof t?t(e,c):t;return n(null,"ignoreTargetNode",r,c,o)}var c;return d.j(function(){var t=d.a.c(r)||[];"undefined"==typeof t.length&&(t=[t]),t=d.a.ta(t,function(t){return o.includeDestroyed||t===e||null===t||!d.a.c(t._destroy)}),d.k.B(d.a.Za,null,[a,t,u,o,l])},null,{o:a})};var a=d.a.e.F();d.d.template={init:function(e,t){var i=d.a.c(t());return"string"==typeof i||i.name?d.f.ja(e):(i=d.f.childNodes(e),i=d.a.oc(i),new d.r.fa(e).nodes(i)),{controlsDescendantBindings:!0}},update:function(t,i,r,n,o){var s,l=i();i=d.a.c(l),r=!0,n=null,"string"==typeof i?i={}:(l=i.name,"if"in i&&(r=d.a.c(i["if"])),r&&"ifnot"in i&&(r=!d.a.c(i.ifnot)),s=d.a.c(i.data)),"foreach"in i?n=d.uc(l||t,r&&i.foreach||[],i,t,o):r?(o="data"in i?o.createChildContext(s,i.as):o,n=d.Ya(l||t,o,i,t)):d.f.ja(t),o=n,(s=d.a.e.get(t,a))&&"function"==typeof s.K&&s.K(),d.a.e.set(t,a,o&&o.Z()?o:e)}},d.h.ha.template=function(e){return e=d.h.Wa(e),1==e.length&&e[0].unknown||d.h.lc(e,"name")?null:"This template engine does not support anonymous templates nested within its templates"},d.f.Q.template=!0}(),d.b("setTemplateEngine",d.ab),d.b("renderTemplate",d.Ya),d.a.wb=function(e,t,i){if(e.length&&t.length){var r,n,o,a,s;for(r=n=0;(!i||i>r)&&(a=e[n]);++n){for(o=0;s=t[o];++o)if(a.value===s.value){a.moved=s.index,s.moved=a.index,t.splice(o,1),r=o=0;break}r+=o}}},d.a.Fa=function(){function e(e,t,i,r,n){var o,a,s,l,u,c=Math.min,h=Math.max,p=[],m=e.length,f=t.length,v=f-m||1,g=m+f+1;for(o=0;m>=o;o++)for(l=s,p.push(s=[]),u=c(f,o+v),a=h(0,o-1);u>=a;a++)s[a]=a?o?e[o-1]===t[a-1]?l[a-1]:c(l[a]||g,s[a-1]||g)+1:a+1:o+1;for(c=[],h=[],v=[],o=m,a=f;o||a;)f=p[o][a]-1,a&&f===p[o][a-1]?h.push(c[c.length]={status:i,value:t[--a],index:a}):o&&f===p[o-1][a]?v.push(c[c.length]={status:r,value:e[--o],index:o}):(--a,--o,n.sparse||c.push({status:"retained",value:t[a]}));return d.a.wb(h,v,10*m),c.reverse()}return function(t,i,r){return r="boolean"==typeof r?{dontLimitMoves:r}:r||{},t=t||[],i=i||[],t.length<=i.length?e(t,i,"added","deleted",r):e(i,t,"deleted","added",r)}}(),d.b("utils.compareArrays",d.a.Fa),function(){function t(t,i,r,n,o){var a=[],s=d.j(function(){var e=i(r,o,d.a.ka(a,t))||[];0<a.length&&(d.a.Lb(a,e),n&&d.k.B(n,null,[r,e,o])),a.length=0,d.a.ga(a,e)},null,{o:t,Ia:function(){return!d.a.ob(a)}});return{$:a,j:s.Z()?s:e}}var i=d.a.e.F();d.a.Za=function(r,n,o,a,s){function l(e,t){C=h[t],g!==t&&(E[e]=C),C.Na(g++),d.a.ka(C.$,r),f.push(C),y.push(C)}function u(e,t){if(e)for(var i=0,r=t.length;r>i;i++)t[i]&&d.a.u(t[i].$,function(r){e(r,i,t[i].sa)})}n=n||[],a=a||{};var c=d.a.e.get(r,i)===e,h=d.a.e.get(r,i)||[],p=d.a.Da(h,function(e){return e.sa}),m=d.a.Fa(p,n,a.dontLimitMoves),f=[],v=0,g=0,_=[],y=[];n=[];for(var C,w,S,E=[],p=[],b=0;w=m[b];b++)switch(S=w.moved,w.status){case"deleted":S===e&&(C=h[v],C.j&&C.j.K(),_.push.apply(_,d.a.ka(C.$,r)),a.beforeRemove&&(n[b]=C,y.push(C))),v++;break;case"retained":l(b,v++);break;case"added":S!==e?l(b,S):(C={sa:w.value,Na:d.p(g++)},f.push(C),y.push(C),c||(p[b]=C))}u(a.beforeMove,E),d.a.u(_,a.beforeRemove?d.R:d.removeNode);for(var x,b=0,c=d.f.firstChild(r);C=y[b];b++){for(C.$||d.a.extend(C,t(r,o,C.sa,s,C.Na)),v=0;m=C.$[v];c=m.nextSibling,x=m,v++)m!==c&&d.f.Bb(r,m,x);!C.ic&&s&&(s(C.sa,C.$,C.Na),C.ic=!0)}u(a.beforeRemove,n),u(a.afterMove,E),u(a.afterAdd,p),d.a.e.set(r,i,f)}}(),d.b("utils.setDomNodeChildrenFromArrayMapping",d.a.Za),d.O=function(){this.allowTemplateRewriting=!1},d.O.prototype=new d.H,d.O.prototype.renderTemplateSource=function(e){var t=(9>d.a.L?0:e.nodes)?e.nodes():null;return t?d.a.S(t.cloneNode(!0).childNodes):(e=e.text(),d.a.ba(e))},d.O.Oa=new d.O,d.ab(d.O.Oa),d.b("nativeTemplateEngine",d.O),function(){d.Sa=function(){var e=this.kc=function(){if(!a||!a.tmpl)return 0;try{if(0<=a.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(e){}return 1}();this.renderTemplateSource=function(t,i,r){if(r=r||{},2>e)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var o=t.data("precompiled");return o||(o=t.text()||"",o=a.template(null,"{{ko_with $item.koBindingContext}}"+o+"{{/ko_with}}"),t.data("precompiled",o)),t=[i.$data],i=a.extend({koBindingContext:i},r.templateOptions),i=a.tmpl(o,t,i),i.appendTo(n.createElement("div")),a.fragments={},i},this.createJavaScriptEvaluatorBlock=function(e){return"{{ko_code ((function() { return "+e+" })()) }}"},this.addTemplate=function(e,t){n.write("<script type='text/html' id='"+e+"'>"+t+"</script>")},e>0&&(a.tmpl.tag.ko_code={open:"__.push($1 || '');"},a.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},d.Sa.prototype=new d.H;var e=new d.Sa;0<e.kc&&d.ab(e),d.b("jqueryTmplTemplateEngine",d.Sa)}()})}()}(),i("ThirdParty/knockout-es5",[],function(){"use strict";function e(e,i){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,o=t(e,!0);return i=i||Object.getOwnPropertyNames(e),i.forEach(function(t){if(t!==h&&t!==d&&!(t in o)){var i=e[t],a=i instanceof Array,s=n.isObservable(i)?i:a?n.observableArray(i):n.observable(i);Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:s,set:n.isWriteableObservable(s)?s:void 0}),o[t]=s,a&&r(n,s)}}),e}function t(e,t){var i=e[h];return!i&&t&&(i={},Object.defineProperty(e,h,{value:i})),i}function i(t,i,r){var n=this,o={owner:t,deferEvaluation:!0};if("function"==typeof r)o.read=r;else{if("value"in r)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if("function"!=typeof r.get)throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');o.read=r.get,o.write=r.set}return t[i]=n.computed(o),e.call(n,t,[i]),t}function r(e,t){var i=null;e.computed(function(){i&&(i.dispose(),i=null);var r=t();r instanceof Array&&(i=n(e,t,r))})}function n(e,t,i){var r=o(e,i);return r.subscribe(t)}function o(e,t){var i=t[d];if(!i){i=new e.subscribable,Object.defineProperty(t,d,{value:i});var r={};a(t,i,r),s(e,t,i,r)}return i}function a(e,t,i){["pop","push","reverse","shift","sort","splice","unshift"].forEach(function(r){var n=e[r];e[r]=function(){var e=n.apply(this,arguments);return i.pause!==!0&&t.notifySubscribers(this),e}})}function s(e,t,i,r){["remove","removeAll","destroy","destroyAll","replace"].forEach(function(n){Object.defineProperty(t,n,{enumerable:!1,value:function(){var o;r.pause=!0;try{o=e.observableArray.fn[n].apply(e.observableArray(t),arguments)}finally{r.pause=!1}return i.notifySubscribers(t),o}})})}function l(e,i){if(!e)return null;var r=t(e,!1);return r&&r[i]||null}function u(e,t){var i=l(e,t);i&&i.valueHasMutated()}function c(t){t.track=e,t.getObservable=l,t.valueHasMutated=u,t.defineProperty=i}var h="__knockoutObservables",d="__knockoutSubscribable";return{attachToKo:c}}),i("Widgets/SvgPathBindingHandler",[],function(){"use strict";var e="http://www.w3.org/2000/svg",t="cesium-svgPath-svg",i={register:function(i){i.bindingHandlers.cesiumSvgPath={init:function(r,n){var o=document.createElementNS(e,"svg:svg");o.setAttribute("class",t);var a=document.createElementNS(e,"path");return o.appendChild(a),i.virtualElements.setDomNodeChildren(r,[o]),i.computed({read:function(){var e=i.unwrap(n());a.setAttribute("d",i.unwrap(e.path));var r=i.unwrap(e.width),s=i.unwrap(e.height);o.setAttribute("width",r),o.setAttribute("height",s),o.setAttribute("viewBox","0 0 "+r+" "+s),e.css&&o.setAttribute("class",t+" "+i.unwrap(e.css))},disposeWhenNodeIsRemoved:r}),{controlsDescendantBindings:!0}}},i.virtualElements.allowedBindings.cesiumSvgPath=!0}};return i}),i("ThirdParty/knockout",["./knockout-3.2.0","./knockout-es5","../Widgets/SvgPathBindingHandler"],function(e,t,i){"use strict";return t.attachToKo(e),i.register(e),e}),i("Widgets/subscribeAndEvaluate",["../ThirdParty/knockout"],function(e){"use strict";var t=function(t,i,r,n,o){return r.call(n,t[i]),e.getObservable(t,i).subscribe(r,n,o)};return t}),i("Widgets/Animation/Animation",["../../Core/Color","../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../getElement","../subscribeAndEvaluate"],function(e,t,i,r,n,o,a){"use strict";function s(t){return e.fromCssColorString(window.getComputedStyle(t).getPropertyValue("color"))}function l(e){var t=document.createElementNS(v,e.tagName);for(var i in e)if(e.hasOwnProperty(i)&&"tagName"!==i)if("children"===i){var r,n=e.children.length;for(r=0;n>r;++r)t.appendChild(l(e.children[r]))}else 0===i.indexOf("xlink:")?t.setAttributeNS(g,i.substring(6),e[i]):"textContent"===i?t.textContent=e[i]:t.setAttribute(i,e[i]);return t}function u(e,t,i){var r=document.createElementNS(v,"text");r.setAttribute("x",e),r.setAttribute("y",t),r.setAttribute("class","cesium-animation-svgText");var n=document.createElementNS(v,"tspan");return n.textContent=i,r.appendChild(n),r}function c(e,t,i){e.setAttribute("transform","translate(100,100) rotate("+i+")"),t.setAttribute("transform","rotate("+i+")")}function h(e,t){var i=t.alpha,r=1-i;return T.red=e.red*r+t.red*i,T.green=e.green*r+t.green*i,T.blue=e.blue*r+t.blue*i,T.toCssColorString()}function d(e,t,i){var r={tagName:"g","class":"cesium-animation-rectButton",transform:"translate("+e+","+t+")",children:[{tagName:"rect","class":"cesium-animation-buttonGlow",width:32,height:32,rx:2,ry:2},{tagName:"rect","class":"cesium-animation-buttonMain",width:32,height:32,rx:4,ry:4},{tagName:"use","class":"cesium-animation-buttonPath","xlink:href":i},{tagName:"title",textContent:""}]};return l(r)}function p(e,t,i){var r={tagName:"g","class":"cesium-animation-rectButton",transform:"translate("+e+","+t+")",children:[{tagName:"use","class":"cesium-animation-buttonGlow","xlink:href":"#animation_pathWingButton"},{tagName:"use","class":"cesium-animation-buttonMain","xlink:href":"#animation_pathWingButton"},{tagName:"use","class":"cesium-animation-buttonPath","xlink:href":i},{tagName:"title",textContent:""}]};return l(r)}function m(e,t){var i=e._viewModel,r=i.shuttleRingDragging;if(!r||f===e)if("mousedown"===t.type||r&&"mousemove"===t.type||"touchstart"===t.type&&1===t.touches.length||r&&"touchmove"===t.type&&1===t.touches.length){var n,o,a=e._centerX,s=e._centerY,l=e._svgNode,u=l.getBoundingClientRect();if("touchstart"===t.type||"touchmove"===t.type?(n=t.touches[0].clientX,o=t.touches[0].clientY):(n=t.clientX,o=t.clientY),!r&&(n>u.right||n<u.left||o<u.top||o>u.bottom))return;var c=e._shuttleRingPointer.getBoundingClientRect(),h=n-a-u.left,d=o-s-u.top,p=180*Math.atan2(d,h)/Math.PI+90;p>180&&(p-=360);var m=i.shuttleRingAngle;r||n<c.right&&n>c.left&&o>c.top&&o<c.bottom?(f=e,i.shuttleRingDragging=!0,i.shuttleRingAngle=p):m>p?i.slower():p>m&&i.faster(),t.preventDefault()}else e===f&&(f=void 0),i.shuttleRingDragging=!1}var f,v="http://www.w3.org/2000/svg",g="http://www.w3.org/1999/xlink",_=e.fromCssColorString("rgba(247,250,255,0.384)"),y=e.fromCssColorString("rgba(143,191,255,0.216)"),C=e.fromCssColorString("rgba(153,197,255,0.098)"),w=e.fromCssColorString("rgba(255,255,255,0.086)"),S=e.fromCssColorString("rgba(255,255,255,0.267)"),E=e.fromCssColorString("rgba(255,255,255,0)"),b=e.fromCssColorString("rgba(66,67,68,0.3)"),x=e.fromCssColorString("rgba(0,0,0,0.5)"),T=new e,P=function(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;var i=this;this._clickFunction=function(){var e=i._viewModel.command;e.canExecute&&e()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[a(t,"toggled",this.setToggled,this),a(t,"tooltip",this.setTooltip,this),a(t.command,"canExecute",this.setEnabled,this)]};P.prototype.destroy=function(){this.svgElement.removeEventListener("click",this._clickFunction,!0);for(var e=this._subscriptions,t=0,i=e.length;i>t;t++)e[t].dispose();r(this)},P.prototype.isDestroyed=function(){return!1},P.prototype.setEnabled=function(e){if(this._enabled!==e){if(this._enabled=e,!e)return this.svgElement.setAttribute("class","cesium-animation-buttonDisabled"),void 0;if(this._toggled)return this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled"),void 0;this.svgElement.setAttribute("class","cesium-animation-rectButton")}},P.prototype.setToggled=function(e){this._toggled!==e&&(this._toggled=e,this._enabled&&(e?this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled"):this.svgElement.setAttribute("class","cesium-animation-rectButton")))},P.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e};var A=function(e,t){e=o(e),this._viewModel=t,this._container=e,this._centerX=0,this._centerY=0,this._defsElement=void 0,this._svgNode=void 0,this._topG=void 0,this._lastHeight=void 0,this._lastWidth=void 0;var i=document.createElement("style");i.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); }",document.head.insertBefore(i,document.head.childNodes[0]); -var r=document.createElement("div");r.className="cesium-animation-theme",r.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>',this._theme=r,this._themeNormal=r.childNodes[0],this._themeHover=r.childNodes[1],this._themeSelect=r.childNodes[2],this._themeDisabled=r.childNodes[3],this._themeKnob=r.childNodes[4],this._themePointer=r.childNodes[5],this._themeSwoosh=r.childNodes[6],this._themeSwooshHover=r.childNodes[7];var n=document.createElementNS(v,"svg:svg");this._svgNode=n,n.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",g);var s=document.createElementNS(v,"g");this._topG=s,this._realtimeSVG=new P(p(3,4,"#animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new P(d(44,99,"#animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new P(d(124,99,"#animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new P(d(84,99,"#animation_pathPause"),t.pauseViewModel);var h=document.createElementNS(v,"g");h.appendChild(this._realtimeSVG.svgElement),h.appendChild(this._playReverseSVG.svgElement),h.appendChild(this._playForwardSVG.svgElement),h.appendChild(this._pauseSVG.svgElement);var f=l({tagName:"circle","class":"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=f;var _=l({tagName:"g","class":"cesium-animation-shuttleRingSwoosh",children:[{tagName:"use",transform:"translate(100,97) scale(-1,1)","xlink:href":"#animation_pathSwooshFX"},{tagName:"use",transform:"translate(100,97)","xlink:href":"#animation_pathSwooshFX"},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=_,this._shuttleRingPointer=l({tagName:"use","class":"cesium-animation-shuttleRingPointer","xlink:href":"#animation_pathPointer"});var y=l({tagName:"g",transform:"translate(100,100)"});this._knobOuter=l({tagName:"circle","class":"cesium-animation-knobOuter",cx:0,cy:0,r:71});var C=61,w=l({tagName:"circle","class":"cesium-animation-knobInner",cx:0,cy:0,r:C});this._knobDate=u(0,-24,""),this._knobTime=u(0,-7,""),this._knobStatus=u(0,-41,"");var S=l({tagName:"circle","class":"cesium-animation-blank",cx:0,cy:0,r:C}),E=document.createElementNS(v,"g");E.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(r),s.appendChild(E),s.appendChild(y),s.appendChild(h),E.appendChild(f),E.appendChild(_),E.appendChild(this._shuttleRingPointer),y.appendChild(this._knobOuter),y.appendChild(w),y.appendChild(this._knobDate),y.appendChild(this._knobTime),y.appendChild(this._knobStatus),y.appendChild(S),n.appendChild(s),e.appendChild(n);var b=this,x=function(e){m(b,e)};this._mouseCallback=x,f.addEventListener("mousedown",x,!0),f.addEventListener("touchstart",x,!0),_.addEventListener("mousedown",x,!0),_.addEventListener("touchstart",x,!0),document.addEventListener("mousemove",x,!0),document.addEventListener("touchmove",x,!0),document.addEventListener("mouseup",x,!0),document.addEventListener("touchend",x,!0),this._shuttleRingPointer.addEventListener("mousedown",x,!0),this._shuttleRingPointer.addEventListener("touchstart",x,!0),this._knobOuter.addEventListener("mousedown",x,!0),this._knobOuter.addEventListener("touchstart",x,!0);var T,A=this._knobTime.childNodes[0],D=this._knobDate.childNodes[0],M=this._knobStatus.childNodes[0];this._subscriptions=[a(t.pauseViewModel,"toggled",function(e){T!==e&&(T=e,T?b._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):b._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),a(t,"shuttleRingAngle",function(e){c(b._shuttleRingPointer,b._knobOuter,e)}),a(t,"dateLabel",function(e){D.textContent!==e&&(D.textContent=e)}),a(t,"timeLabel",function(e){A.textContent!==e&&(A.textContent=e)}),a(t,"multiplierLabel",function(e){M.textContent!==e&&(M.textContent=e)})],this.applyThemeChanges(),this.resize()};return i(A.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){var e=this._mouseCallback;this._shuttleRingBackPanel.removeEventListener("mousedown",e,!0),this._shuttleRingBackPanel.removeEventListener("touchstart",e,!0),this._shuttleRingSwooshG.removeEventListener("mousedown",e,!0),this._shuttleRingSwooshG.removeEventListener("touchstart",e,!0),document.removeEventListener("mousemove",e,!0),document.removeEventListener("touchmove",e,!0),document.removeEventListener("mouseup",e,!0),document.removeEventListener("touchend",e,!0),this._shuttleRingPointer.removeEventListener("mousedown",e,!0),this._shuttleRingPointer.removeEventListener("touchstart",e,!0),this._knobOuter.removeEventListener("mousedown",e,!0),this._knobOuter.removeEventListener("touchstart",e,!0),this._container.removeChild(this._svgNode),this._container.removeChild(this._theme),this._realtimeSVG.destroy(),this._playReverseSVG.destroy(),this._playForwardSVG.destroy(),this._pauseSVG.destroy();for(var t=this._subscriptions,i=0,n=t.length;n>i;i++)t[i].dispose();return r(this)},A.prototype.resize=function(){var e=this._container.clientWidth,t=this._container.clientHeight;if(e!==this._lastWidth||t!==this._lastHeight){var i=this._svgNode,r=200,n=132,o=e,a=t;0===e&&0===t?(o=r,a=n):0===e?(a=t,o=r*(t/n)):0===t&&(o=e,a=n*(e/r));var s=o/r,l=a/n;i.style.cssText="width: "+o+"px; height: "+a+"px; position: absolute; bottom: 0; left: 0; overflow: hidden;",i.setAttribute("width",o),i.setAttribute("height",a),i.setAttribute("viewBox","0 0 "+o+" "+a),this._topG.setAttribute("transform","scale("+s+","+l+")"),this._centerX=Math.max(1,100*s),this._centerY=Math.max(1,100*l),this._lastHeight=e,this._lastWidth=t}},A.prototype.applyThemeChanges=function(){var e=s(this._themeNormal),i=s(this._themeHover),r=s(this._themeSelect),n=s(this._themeDisabled),o=s(this._themeKnob),a=s(this._themePointer),u=s(this._themeSwoosh),c=s(this._themeSwooshHover),d=l({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":h(e,_)},{tagName:"stop",offset:"12%","stop-color":h(e,y)},{tagName:"stop",offset:"46%","stop-color":h(e,C)},{tagName:"stop",offset:"81%","stop-color":h(e,w)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":h(i,_)},{tagName:"stop",offset:"12%","stop-color":h(i,y)},{tagName:"stop",offset:"46%","stop-color":h(i,C)},{tagName:"stop",offset:"81%","stop-color":h(i,w)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":h(r,_)},{tagName:"stop",offset:"12%","stop-color":h(r,y)},{tagName:"stop",offset:"46%","stop-color":h(r,C)},{tagName:"stop",offset:"81%","stop-color":h(r,w)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":h(n,S)},{tagName:"stop",offset:"75%","stop-color":h(n,E)}]},{id:"animation_blurred",tagName:"filter",width:"200%",height:"200%",x:"-50%",y:"-50%",children:[{tagName:"feGaussianBlur",stdDeviation:4,"in":"SourceGraphic"}]},{id:"animation_shuttleRingSwooshGradient",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":u.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":u.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":u.toCssColorString()}]},{id:"animation_shuttleRingSwooshHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":c.toCssColorString()}]},{id:"animation_shuttleRingPointerGradient",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":a.toCssColorString()},{tagName:"stop",offset:"40%","stop-color":a.toCssColorString()},{tagName:"stop",offset:"60%","stop-color":h(a,x)},{tagName:"stop",offset:"100%","stop-color":h(a,x)}]},{id:"animation_shuttleRingPointerPaused",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":"#CCC"},{tagName:"stop",offset:"40%","stop-color":"#CCC"},{tagName:"stop",offset:"60%","stop-color":"#555"},{tagName:"stop",offset:"100%","stop-color":"#555"}]},{id:"animation_knobOuter",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":h(o,_)},{tagName:"stop",offset:"60%","stop-color":h(o,b)},{tagName:"stop",offset:"85%","stop-color":h(o,y)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":h(o,b)},{tagName:"stop",offset:"60%","stop-color":h(o,_)},{tagName:"stop",offset:"85%","stop-color":h(o,w)}]},{id:"animation_pathReset",tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",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"},{id:"animation_pathPause",tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",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"},{id:"animation_pathPlay",tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},{id:"animation_pathPlayReverse",tagName:"path",transform:"translate(16,16) scale(-0.85,0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},{id:"animation_pathLoop",tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",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"},{id:"animation_pathClock",tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-15.5)",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"},{id:"animation_pathWingButton",tagName:"path",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"},{id:"animation_pathPointer",tagName:"path",d:"M-15,-65,-15,-55,15,-55,15,-65,0,-95z"},{id:"animation_pathSwooshFX",tagName:"path",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"}]});t(this._defsElement)?this._svgNode.replaceChild(d,this._defsElement):this._svgNode.appendChild(d),this._defsElement=d},A}),i("Widgets/createCommand",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../ThirdParty/knockout"],function(e,t,i,r,n,o){"use strict";var a=function(t,r){function a(){var e,i={args:arguments,cancel:!1};return s.raiseEvent(i),i.cancel||(e=t.apply(null,arguments),l.raiseEvent(e)),e}r=e(r,!0);var s=new n,l=new n;return a.canExecute=r,o.track(a,["canExecute"]),i(a,{beforeExecute:{value:s},afterExecute:{value:l}}),a};return a}),i("Widgets/ToggleButtonViewModel",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../ThirdParty/knockout"],function(e,t,i,r,n){"use strict";var o=function(t,i){this._command=t,i=e(i,e.EMPTY_OBJECT),this.toggled=e(i.toggled,!1),this.tooltip=e(i.tooltip,""),n.track(this,["toggled","tooltip"])};return i(o.prototype,{command:{get:function(){return this._command}}}),o}),i("Widgets/Animation/AnimationViewModel",["../../Core/binarySearch","../../Core/ClockRange","../../Core/ClockStep","../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../../Core/JulianDate","../../ThirdParty/knockout","../../ThirdParty/sprintf","../createCommand","../ToggleButtonViewModel"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e){e.clockStep===i.SYSTEM_CLOCK&&(e.clockStep=i.SYSTEM_CLOCK_MULTIPLIER,e.multiplier=1)}function d(e){h(e),e.shouldAnimate=!0}function p(e,t){return e-t}function m(t,i){var r=e(i,t,p);return 0>r?~r:r}function f(e,t){if(Math.abs(e)<=_)return e/_;var i,r,n=_,o=y,a=0;return e>0?(i=Math.log(t[t.length-1]),r=(i-a)/(o-n),Math.exp(a+r*(e-n))):(i=Math.log(-t[0]),r=(i-a)/(o-n),-Math.exp(a+r*(Math.abs(e)-n)))}function v(e,t,r){if(r.clockStep===i.SYSTEM_CLOCK)return _;if(Math.abs(e)<=1)return e*_;var n,o,a=_,s=y,l=0;return e>0?(n=Math.log(t[t.length-1]),o=(n-l)/(s-a),(Math.log(e)-l)/o+a):(n=Math.log(-t[0]),o=(n-l)/(s-a),-((Math.log(Math.abs(e))-l)/o+a))}var g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_=15,y=105,C=function(e){var r=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=C.defaultDateFormatter,this._timeFormatter=C.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,s.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(C.defaultTicks),this.timeLabel=void 0,s.defineProperty(this,"timeLabel",function(){return r._timeFormatter(r._clockViewModel.currentTime,r)}),this.dateLabel=void 0,s.defineProperty(this,"dateLabel",function(){return r._dateFormatter(r._clockViewModel.currentTime,r)}),this.multiplierLabel=void 0,s.defineProperty(this,"multiplierLabel",function(){var e=r._clockViewModel;if(e.clockStep===i.SYSTEM_CLOCK)return"Today";var t=e.multiplier;return 0===t%1?t.toFixed(0)+"x":t.toFixed(3).replace(/0{0,3}$/,"")+"x"}),this.shuttleRingAngle=void 0,s.defineProperty(this,"shuttleRingAngle",{get:function(){return v(e.multiplier,r._allShuttleRingTicks,e)},set:function(e){e=Math.max(Math.min(e,y),-y);var t=r._allShuttleRingTicks,n=r._clockViewModel;if(n.clockStep=i.SYSTEM_CLOCK_MULTIPLIER,Math.abs(e)===y)return n.multiplier=e>0?t[t.length-1]:t[0],void 0;var o=f(e,t);if(r.snapToTicks)o=t[m(o,t)];else if(0!==o){var a=Math.abs(o);if(a>100){var s=a.toFixed(0).length-2,l=Math.pow(10,s);o=0|Math.round(o/l)*l}else a>_?o=Math.round(o):a>1?o=+o.toFixed(1):a>0&&(o=+o.toFixed(2))}n.multiplier=o}}),this._canAnimate=void 0,s.defineProperty(this,"_canAnimate",function(){var e=r._clockViewModel,i=e.clockRange;if(r.shuttleRingDragging||i===t.UNBOUNDED)return!0;var n=e.multiplier,o=e.currentTime,s=e.startTime,l=!1;if(i===t.LOOP_STOP)l=a.greaterThan(o,s)||o.equals(s)&&n>0;else{var u=e.stopTime;l=a.greaterThan(o,s)&&a.lessThan(o,u)||o.equals(s)&&n>0||o.equals(u)&&0>n}return l||(e.shouldAnimate=!1),l}),this._isSystemTimeAvailable=void 0,s.defineProperty(this,"_isSystemTimeAvailable",function(){var e=r._clockViewModel,i=e.clockRange;if(i===t.UNBOUNDED)return!0;var n=e.systemTime;return a.greaterThanOrEquals(n,e.startTime)&&a.lessThanOrEquals(n,e.stopTime)}),this._isAnimating=void 0,s.defineProperty(this,"_isAnimating",function(){return r._clockViewModel.shouldAnimate&&(r._canAnimate||r.shuttleRingDragging)});var n=u(function(){var e=r._clockViewModel;e.shouldAnimate?(h(e),e.shouldAnimate=!1):r._canAnimate&&d(e)});this._pauseViewModel=new c(n,{toggled:s.computed(function(){return!r._isAnimating}),tooltip:"Pause"});var o=u(function(){var e=r._clockViewModel;h(e);var t=e.multiplier;t>0&&(e.multiplier=-t),e.shouldAnimate=!0});this._playReverseViewModel=new c(o,{toggled:s.computed(function(){return r._isAnimating&&e.multiplier<0}),tooltip:"Play Reverse"});var l=u(function(){var e=r._clockViewModel;h(e);var t=e.multiplier;0>t&&(e.multiplier=-t),e.shouldAnimate=!0});this._playForwardViewModel=new c(l,{toggled:s.computed(function(){return r._isAnimating&&e.multiplier>0&&e.clockStep!==i.SYSTEM_CLOCK}),tooltip:"Play Forward"});var p=u(function(){var e=r._clockViewModel;e.clockStep=i.SYSTEM_CLOCK,e.multiplier=1,e.shouldAnimate=!0},s.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new c(p,{toggled:s.computed(function(){return e.shouldAnimate&&e.clockStep===i.SYSTEM_CLOCK}),tooltip:s.computed(function(){return r._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"})}),this._slower=u(function(){var e=r._clockViewModel;h(e);var t=r._allShuttleRingTicks,i=e.multiplier,n=m(i,t)-1;n>=0&&(e.multiplier=t[n])}),this._faster=u(function(){var e=r._clockViewModel;h(e);var t=r._allShuttleRingTicks,i=e.multiplier,n=m(i,t)+1;n<t.length&&(e.multiplier=t[n])})};return C.defaultDateFormatter=function(e){var t=a.toGregorianDate(e);return g[t.month-1]+" "+t.day+" "+t.year},C.defaultTicks=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800],C.defaultTimeFormatter=function(e,t){var i=a.toGregorianDate(e),r=Math.round(i.millisecond);return Math.abs(t._clockViewModel.multiplier)<1?l("%02d:%02d:%02d.%03d",i.hour,i.minute,i.second,r):l("%02d:%02d:%02d UTC",i.hour,i.minute,i.second)},C.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)},C.prototype.setShuttleRingTicks=function(e){var t,i,r,n={},o=this._sortedFilteredPositiveTicks;for(o.length=0,t=0,i=e.length;i>t;++t)r=e[t],n.hasOwnProperty(r)||(n[r]=!0,o.push(r));o.sort(p);var a=[];for(i=o.length,t=i-1;t>=0;--t)r=o[t],0!==r&&a.push(-r);Array.prototype.push.apply(a,o),this._allShuttleRingTicks=a},n(C.prototype,{slower:{get:function(){return this._slower}},faster:{get:function(){return this._faster}},clockViewModel:{get:function(){return this._clockViewModel}},pauseViewModel:{get:function(){return this._pauseViewModel}},playReverseViewModel:{get:function(){return this._playReverseViewModel}},playForwardViewModel:{get:function(){return this._playForwardViewModel}},playRealtimeViewModel:{get:function(){return this._playRealtimeViewModel}},dateFormatter:{get:function(){return this._dateFormatter},set:function(e){this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){this._timeFormatter=e}}}),C._maxShuttleRingAngle=y,C._realtimeShuttleRingAngle=_,C}),i("Widgets/BaseLayerPicker/BaseLayerPickerViewModel",["../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../../Core/EllipsoidTerrainProvider","../../Core/isArray","../../ThirdParty/knockout","../createCommand"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(i){i=e(i,e.EMPTY_OBJECT);var r=i.globe,l=e(i.imageryProviderViewModels,[]),u=e(i.terrainProviderViewModels,[]);this._globe=r,this.imageryProviderViewModels=l.slice(0),this.terrainProviderViewModels=u.slice(0),this.dropDownVisible=!1,a.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]),this.buttonTooltip=void 0,a.defineProperty(this,"buttonTooltip",function(){var e=this.selectedImagery,i=this.selectedTerrain,r=t(e)?e.name:void 0,n=t(i)?i.name:void 0;return t(r)&&t(n)?r+"\n"+n:t(r)?r:n}),this.buttonImageUrl=void 0,a.defineProperty(this,"buttonImageUrl",function(){var e=this.selectedImagery;return t(e)?e.iconUrl:void 0}),this.selectedImagery=void 0;var c=a.observable();this._currentImageryProviders=[],a.defineProperty(this,"selectedImagery",{get:function(){return c()},set:function(e){if(c()===e)return this.dropDownVisible=!1,void 0;var i,r=this._currentImageryProviders,n=r.length,a=this._globe.imageryLayers;for(i=0;n>i;i++)for(var s=a.length,l=0;s>l;l++){var u=a.get(l);if(u.imageryProvider===r[i]){a.remove(u);break}}if(t(e)){var h=e.creationCommand();if(o(h)){var d=h.length;for(i=d-1;i>=0;i--)a.addImageryProvider(h[i],0);this._currentImageryProviders=h.slice(0)}else this._currentImageryProviders=[h],a.addImageryProvider(h,0)}c(e),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;var h=a.observable();a.defineProperty(this,"selectedTerrain",{get:function(){return h()},set:function(e){if(h()===e)return this.dropDownVisible=!1,void 0;var i;t(e)&&(i=e.creationCommand()),this._globe.depthTestAgainstTerrain=!(i instanceof n),this._globe.terrainProvider=i,h(e),this.dropDownVisible=!1}});var d=this;this._toggleDropDown=s(function(){d.dropDownVisible=!d.dropDownVisible}),this.selectedImagery=e(i.selectedImageryProviderViewModel,l[0]),this.selectedTerrain=e(i.selectedTerrainProviderViewModel,u[0])};return i(l.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}}),l}),i("Widgets/BaseLayerPicker/BaseLayerPicker",["../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/FeatureDetection","../../ThirdParty/knockout","../getElement","./BaseLayerPickerViewModel"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(e,t){e=a(e);var i=new s(t),r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button",r.setAttribute("data-bind","attr: { title: buttonTooltip },click: toggleDropDown"),e.appendChild(r);var l=document.createElement("img");l.setAttribute("draggable","false"),l.className="cesium-baseLayerPicker-selected",l.setAttribute("data-bind","attr: { src: buttonImageUrl }"),r.appendChild(l);var u=document.createElement("div");u.className="cesium-baseLayerPicker-dropDown",u.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(u);var c=document.createElement("div");c.className="cesium-baseLayerPicker-sectionTitle",c.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),c.innerHTML="Imagery",u.appendChild(c);var h=document.createElement("div");h.className="cesium-baseLayerPicker-choices",h.setAttribute("data-bind","foreach: imageryProviderViewModels"),u.appendChild(h);var d=document.createElement("div");d.className="cesium-baseLayerPicker-item",d.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parent.selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parent.selectedImagery = $data; }'),h.appendChild(d);var p=document.createElement("img");p.className="cesium-baseLayerPicker-itemIcon",p.setAttribute("data-bind","attr: { src: iconUrl }"),p.setAttribute("draggable","false"),d.appendChild(p);var m=document.createElement("div");m.className="cesium-baseLayerPicker-itemLabel",m.setAttribute("data-bind","text: name"),d.appendChild(m);var f=document.createElement("div");f.className="cesium-baseLayerPicker-sectionTitle",f.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),f.innerHTML="Terrain",u.appendChild(f);var v=document.createElement("div");v.className="cesium-baseLayerPicker-choices",v.setAttribute("data-bind","foreach: terrainProviderViewModels"),u.appendChild(v);var g=document.createElement("div");g.className="cesium-baseLayerPicker-item",g.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parent.selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parent.selectedTerrain = $data; }'),v.appendChild(g);var _=document.createElement("img");_.className="cesium-baseLayerPicker-itemIcon",_.setAttribute("data-bind","attr: { src: iconUrl }"),_.setAttribute("draggable","false"),g.appendChild(_);var y=document.createElement("div");y.className="cesium-baseLayerPicker-itemLabel",y.setAttribute("data-bind","text: name"),g.appendChild(y),o.applyBindings(i,r),o.applyBindings(i,u),this._viewModel=i,this._container=e,this._element=r,this._dropPanel=u,this._closeDropDown=function(e){r.contains(e.target)||u.contains(e.target)||(i.dropDownVisible=!1)},n.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))};return t(l.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),l.prototype.isDestroyed=function(){return!1},l.prototype.destroy=function(){return n.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),o.cleanNode(this._element),o.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),i(this)},l}),i("Widgets/BaseLayerPicker/ProviderViewModel",["../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../../ThirdParty/knockout","../createCommand"],function(e,t,i,r,n){"use strict";var o=function(t){var i=t.creationFunction;e(i.canExecute)||(i=n(i)),this._creationCommand=i,this.name=t.name,this.tooltip=t.tooltip,this.iconUrl=t.iconUrl,r.track(this,["name","tooltip","iconUrl"])};return t(o.prototype,{creationCommand:{get:function(){return this._creationCommand}}}),o}),i("Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels",["../../Core/buildModuleUrl","../../Scene/ArcGisMapServerImageryProvider","../../Scene/BingMapsImageryProvider","../../Scene/BingMapsStyle","../../Scene/OpenStreetMapImageryProvider","../../Scene/TileMapServiceImageryProvider","../BaseLayerPicker/ProviderViewModel"],function(e,t,i,r,n,o,a){"use strict";function s(){var s=[];return s.push(new a({name:"Bing Maps Aerial",iconUrl:e("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery \nhttp://www.bing.com/maps",creationFunction:function(){return new i({url:"//dev.virtualearth.net",mapStyle:r.AERIAL})}})),s.push(new a({name:"Bing Maps Aerial with Labels",iconUrl:e("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with label overlays \nhttp://www.bing.com/maps",creationFunction:function(){return new i({url:"//dev.virtualearth.net",mapStyle:r.AERIAL_WITH_LABELS})}})),s.push(new a({name:"Bing Maps Roads",iconUrl:e("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps\nhttp://www.bing.com/maps",creationFunction:function(){return new i({url:"//dev.virtualearth.net",mapStyle:r.ROAD})}})),s.push(new a({name:"ESRI World Imagery",iconUrl:e("Widgets/Images/ImageryProviders/esriWorldImagery.png"),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",creationFunction:function(){return new t({url:"//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"})}})),s.push(new a({name:"ESRI World Street Map",iconUrl:e("Widgets/Images/ImageryProviders/esriWorldStreetMap.png"),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",creationFunction:function(){return new t({url:"//services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"})}})),s.push(new a({name:"ESRI National Geographic",iconUrl:e("Widgets/Images/ImageryProviders/esriNationalGeographic.png"),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",creationFunction:function(){return new t({url:"//services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/"})}})),s.push(new a({name:"Open­Street­Map",iconUrl:e("Widgets/Images/ImageryProviders/openStreetMap.png"),tooltip:"OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.\nhttp://www.openstreetmap.org",creationFunction:function(){return new n({url:"//a.tile.openstreetmap.org/"})}})),s.push(new a({name:"Stamen Watercolor",iconUrl:e("Widgets/Images/ImageryProviders/stamenWatercolor.png"),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",creationFunction:function(){return new n({url:"//stamen-tiles.a.ssl.fastly.net/watercolor/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."}) -}})),s.push(new a({name:"Stamen Toner",iconUrl:e("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:"A high contrast black and white map.\nhttp://maps.stamen.com",creationFunction:function(){return new n({url:"//stamen-tiles.a.ssl.fastly.net/toner/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),s.push(new a({name:"MapQuest Open­Street­Map",iconUrl:e("Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png"),tooltip:"OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.\nhttp://www.openstreetmap.org",creationFunction:function(){return new n({url:"//otile1-s.mqcdn.com/tiles/1.0.0/osm/"})}})),s.push(new a({name:"The Black Marble",iconUrl:e("Widgets/Images/ImageryProviders/blackMarble.png"),tooltip:"The lights of cities and villages trace the outlines of civilization in this global view of the Earth at night as seen by NASA/NOAA's Suomi NPP satellite.",creationFunction:function(){return new o({url:"//cesiumjs.org/blackmarble",maximumLevel:8,credit:"Black Marble imagery courtesy NASA Earth Observatory"})}})),s.push(new a({name:"Natural Earth II",iconUrl:e("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:"Natural Earth II, darkened for contrast.\nhttp://www.naturalearthdata.com/",creationFunction:function(){return new o({url:e("Assets/Textures/NaturalEarthII")})}})),s}return s}),i("Widgets/BaseLayerPicker/createDefaultTerrainProviderViewModels",["../../Core/buildModuleUrl","../../Core/CesiumTerrainProvider","../../Core/EllipsoidTerrainProvider","../BaseLayerPicker/ProviderViewModel"],function(e,t,i,r){"use strict";function n(){var n=[];return n.push(new r({name:"WGS84 Ellipsoid",iconUrl:e("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",creationFunction:function(){return new i}})),n.push(new r({name:"STK World Terrain meshes",iconUrl:e("Widgets/Images/TerrainProviders/STK.png"),tooltip:"High-resolution, mesh-based terrain for the entire globe. Free for use on the Internet. Closed-network options are available.\nhttp://www.agi.com",creationFunction:function(){return new t({url:"//assets.agi.com/stk-terrain/world",requestWaterMask:!0,requestVertexNormals:!0})}})),n}return n}),i("Widgets/CesiumInspector/CesiumInspectorViewModel",["../../Core/Color","../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/Rectangle","../../Core/ScreenSpaceEventHandler","../../Core/ScreenSpaceEventType","../../Scene/DebugModelMatrixPrimitive","../../Scene/PerformanceDisplay","../../Scene/TileCoordinatesImageryProvider","../../ThirdParty/knockout","../createCommand"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";function p(e){var i;if(t(e)){i="Command Statistics";var r=e.commandsInFrustums;for(var n in r)if(r.hasOwnProperty(n)){var o,a=parseInt(n,10);if(7===a)o="1, 2 and 3";else{for(var s=[],l=2;l>=0;l--){var u=Math.pow(2,l);a>=u&&(s.push(l+1),a-=u)}o=s.reverse().join(" and ")}i+="<br>    "+r[n]+" in frustum "+o}i+="<br>Total: "+e.totalCommands}return i}function m(e,t,i){var r=Math.min(i,t);return r=Math.max(r,e)}var f=function(e,i){var r=this,n=e.canvas,p=new a(n);this._eventHandler=p,this._scene=e,this._canvas=n,this._primitive=void 0,this._tile=void 0,this._modelMatrixPrimitive=void 0,this._performanceDisplay=void 0,this._performanceContainer=i;var f=this._scene.globe;f.depthTestAgainstTerrain=!0,this.frustums=!1,this.performance=!1,this.shaderCacheText="",this.primitiveBoundingSphere=!1,this.primitiveReferenceFrame=!1,this.filterPrimitive=!1,this.tileBoundingSphere=!1,this.filterTile=!1,this.wireframe=!1,this.globeDepth=!1,this.pickDepth=!1,this.depthFrustum=1,this._numberOfFrustums=1,this.depthFrustumText="1 of 1",this.suspendUpdates=!1,this.tileCoordinates=!1,this.frustumStatisticText="",this.tileText="",this.hasPickedPrimitive=!1,this.hasPickedTile=!1,this.pickPimitiveActive=!1,this.pickTileActive=!1,this.dropDownVisible=!0,this.generalVisible=!0,this.primitivesVisible=!1,this.terrainVisible=!1,this.generalSwitchText="-",this.primitivesSwitchText="+",this.terrainSwitchText="+",h.track(this,["filterTile","suspendUpdates","dropDownVisible","shaderCacheText","frustums","frustumStatisticText","pickTileActive","pickPrimitiveActive","hasPickedPrimitive","hasPickedTile","tileText","generalVisible","generalSwitchText","primitivesVisible","primitivesSwitchText","terrainVisible","terrainSwitchText","depthFrustumText"]),this._toggleDropDown=d(function(){r.dropDownVisible=!r.dropDownVisible}),this._toggleGeneral=d(function(){r.generalVisible=!r.generalVisible,r.generalSwitchText=r.generalVisible?"-":"+"}),this._togglePrimitives=d(function(){r.primitivesVisible=!r.primitivesVisible,r.primitivesSwitchText=r.primitivesVisible?"-":"+"}),this._toggleTerrain=d(function(){r.terrainVisible=!r.terrainVisible,r.terrainSwitchText=r.terrainVisible?"-":"+"}),this._showFrustums=d(function(){return r._scene.debugShowFrustums=r.frustums?!0:!1,!0}),this._showPerformance=d(function(){return r.performance?r._performanceDisplay=new u({container:r._performanceContainer}):r._performanceContainer.innerHTML="",!0}),this._showPrimitiveBoundingSphere=d(function(){return r._primitive.debugShowBoundingVolume=r.primitiveBoundingSphere,!0}),this._showPrimitiveReferenceFrame=d(function(){if(r.primitiveReferenceFrame){var e=r._primitive.modelMatrix;r._modelMatrixPrimitive=new l({modelMatrix:e}),r._scene.primitives.add(r._modelMatrixPrimitive)}else t(r._modelMatrixPrimitive)&&(r._scene.primitives.remove(r._modelMatrixPrimitive),r._modelMatrixPrimitive=void 0);return!0}),this._doFilterPrimitive=d(function(){return r._scene.debugCommandFilter=r.filterPrimitive?function(e){return t(r._modelMatrixPrimitive)&&e.owner===r._modelMatrixPrimitive._primitive?!0:t(r._primitive)?e.owner===r._primitive||e.owner===r._primitive._billboardCollection||e.owner.primitive===r._primitive:!1}:void 0,!0}),this._showWireframe=d(function(){return f._surface.tileProvider._debug.wireframe=r.wireframe,!0}),this._showGlobeDepth=d(function(){return r._scene.debugShowGlobeDepth=r.globeDepth,!0}),this._showPickDepth=d(function(){return r._scene.debugShowPickDepth=r.pickDepth,!0}),this._incrementDepthFrustum=d(function(){var e=r.depthFrustum+1;return r.depthFrustum=m(1,r._numberOfFrustums,e),r.scene.debugShowDepthFrustum=r.depthFrustum,!0}),this._decrementDepthFrustum=d(function(){var e=r.depthFrustum-1;return r.depthFrustum=m(1,r._numberOfFrustums,e),r.scene.debugShowDepthFrustum=r.depthFrustum,!0}),this._doSuspendUpdates=d(function(){return f._surface._debug.suspendLodUpdate=r.suspendUpdates,r.suspendUpdates||(r.filterTile=!1),!0});var v;this._showTileCoordinates=d(function(){return r.tileCoordinates&&!t(v)?v=e.imageryLayers.addImageryProvider(new c({tilingScheme:e.terrainProvider.tilingScheme})):!r.tileCoordinates&&t(v)&&(e.imageryLayers.remove(v),v=void 0),!0}),this._showTileBoundingSphere=d(function(){return f._surface.tileProvider._debug.boundingSphereTile=r.tileBoundingSphere?r._tile:void 0,!0}),this._doFilterTile=d(function(){return r.filterTile?(r.suspendUpdates=!0,r.doSuspendUpdates(),f._surface._tilesToRender=[],t(r._tile)&&f._surface._tilesToRender.push(r._tile)):(r.suspendUpdates=!1,r.doSuspendUpdates()),!0});var g=function(e){p.removeInputAction(s.LEFT_CLICK),r.pickPrimitiveActive=!1;var i=r._scene.pick({x:e.position.x,y:e.position.y});t(i)&&(r.primitive=t(i.collection)?i.collection:i.primitive)};this._pickPrimitive=d(function(){r.pickPrimitiveActive=!r.pickPrimitiveActive,r.pickPrimitiveActive?p.setInputAction(g,s.LEFT_CLICK):p.removeInputAction(s.LEFT_CLICK)});var _=function(e){var i,n=f.ellipsoid,a=r._scene.camera.pickEllipsoid({x:e.position.x,y:e.position.y},n);if(t(a))for(var l=n.cartesianToCartographic(a),u=f._surface.tileProvider._tilesToRenderByTextureCount,c=0;!i&&c<u.length;++c){var h=u[c];if(t(h))for(var d=0;!i&&d<h.length;++d){var m=h[d];o.contains(m.rectangle,l)&&(i=m)}}r.tile=i,p.removeInputAction(s.LEFT_CLICK),r.pickTileActive=!1};this._pickTile=d(function(){r.pickTileActive=!r.pickTileActive,r.pickTileActive?p.setInputAction(_,s.LEFT_CLICK):p.removeInputAction(s.LEFT_CLICK)})};return i(f.prototype,{scene:{get:function(){return this._scene}},performanceContainer:{get:function(){return this._performanceContainer}},toggleDropDown:{get:function(){return this._toggleDropDown}},showFrustums:{get:function(){return this._showFrustums}},showPerformance:{get:function(){return this._showPerformance}},showPrimitiveBoundingSphere:{get:function(){return this._showPrimitiveBoundingSphere}},showPrimitiveReferenceFrame:{get:function(){return this._showPrimitiveReferenceFrame}},doFilterPrimitive:{get:function(){return this._doFilterPrimitive}},showWireframe:{get:function(){return this._showWireframe}},showGlobeDepth:{get:function(){return this._showGlobeDepth}},showPickDepth:{get:function(){return this._showPickDepth}},incrementDepthFrustum:{get:function(){return this._incrementDepthFrustum}},decrementDepthFrustum:{get:function(){return this._decrementDepthFrustum}},doSuspendUpdates:{get:function(){return this._doSuspendUpdates}},showTileCoordinates:{get:function(){return this._showTileCoordinates}},showTileBoundingSphere:{get:function(){return this._showTileBoundingSphere}},doFilterTile:{get:function(){return this._doFilterTile}},toggleGeneral:{get:function(){return this._toggleGeneral}},togglePrimitives:{get:function(){return this._togglePrimitives}},toggleTerrain:{get:function(){return this._toggleTerrain}},pickPrimitive:{get:function(){return this._pickPrimitive}},pickTile:{get:function(){return this._pickTile}},selectParent:{get:function(){var e=this;return d(function(){e.tile=e.tile.parent})}},selectNW:{get:function(){var e=this;return d(function(){e.tile=e.tile.children[0]})}},selectNE:{get:function(){var e=this;return d(function(){e.tile=e.tile.children[1]})}},selectSW:{get:function(){var e=this;return d(function(){e.tile=e.tile.children[2]})}},selectSE:{get:function(){var e=this;return d(function(){e.tile=e.tile.children[3]})}},primitive:{set:function(e){var i=this._primitive;e!==i&&(this.hasPickedPrimitive=!0,t(i)&&(i.debugShowBoundingVolume=!1),this._scene.debugCommandFilter=void 0,t(this._modelMatrixPrimitive)&&(this._scene.primitives.remove(this._modelMatrixPrimitive),this._modelMatrixPrimitive=void 0),this._primitive=e,e.show=!1,setTimeout(function(){e.show=!0},50),this.showPrimitiveBoundingSphere(),this.showPrimitiveReferenceFrame(),this.doFilterPrimitive())},get:function(){return this._primitive}},tile:{set:function(e){if(t(e)){this.hasPickedTile=!0;var i=this._tile;e!==i&&(this.tileText="L: "+e.level+" X: "+e.x+" Y: "+e.y,this.tileText+="<br>SW corner: "+e.rectangle.west+", "+e.rectangle.south,this.tileText+="<br>NE corner: "+e.rectangle.east+", "+e.rectangle.north,this.tileText+="<br>Min: "+e.data.minimumHeight+" Max: "+e.data.maximumHeight),this._tile=e,this.showTileBoundingSphere(),this.doFilterTile()}else this.hasPickedTile=!1,this._tile=void 0},get:function(){return this._tile}},update:{get:function(){var e=this;return function(){e.frustums&&(e.frustumStatisticText=p(e._scene.debugFrustumStatistics));var t=e._scene.numberOfFrustums;e._numberOfFrustums=t;var i=m(1,t,e.depthFrustum);e.depthFrustum=i,e.scene.debugShowDepthFrustum=i,e.depthFrustumText=i+" of "+t,e.performance&&e._performanceDisplay.update(),e.primitiveReferenceFrame&&(e._modelMatrixPrimitive.modelMatrix=e._primitive.modelMatrix),e.shaderCacheText="Cached shaders: "+e._scene.context.shaderCache.numberOfShaders}}}}),f.prototype.isDestroyed=function(){return!1},f.prototype.destroy=function(){return this._eventHandler.destroy(),r(this)},f}),i("Widgets/CesiumInspector/CesiumInspector",["../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../ThirdParty/knockout","../getElement","./CesiumInspectorViewModel"],function(e,t,i,r,n,o,a){"use strict";var s=function(t,i){if(!e(t))throw new r("container is required.");if(!e(i))throw new r("scene is required.");t=o(t);var s=document.createElement("div"),l=new a(i,s);this._viewModel=l,this._container=t;var u=document.createElement("div");this._element=u;var c=document.createElement("div");c.textContent="Cesium Inspector",c.className="cesium-cesiumInspector-button",c.setAttribute("data-bind","click: toggleDropDown"),u.appendChild(c),u.className="cesium-cesiumInspector",u.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : dropDownVisible, "cesium-cesiumInspector-hidden" : !dropDownVisible }'),t.appendChild(this._element);var h=document.createElement("div");this._panel=h,h.className="cesium-cesiumInspector-dropDown",u.appendChild(h);var d=document.createElement("div");d.className="cesium-cesiumInspector-sectionHeader";var p=document.createElement("span");p.className="cesium-cesiumInspector-toggleSwitch",p.setAttribute("data-bind","click: toggleGeneral, text: generalSwitchText"),d.appendChild(p),d.appendChild(document.createTextNode("General")),h.appendChild(d);var m=document.createElement("div");m.className="cesium-cesiumInspector-section",m.setAttribute("data-bind",'css: {"cesium-cesiumInspector-show" : generalVisible, "cesium-cesiumInspector-hide" : !generalVisible}'),h.appendChild(m);var f=document.createElement("div");m.appendChild(f);var v=document.createElement("div");v.className="cesium-cesiumInspector-frustumStats",v.setAttribute("data-bind",'css: {"cesium-cesiumInspector-show" : frustums, "cesium-cesiumInspector-hide" : !frustums}, html: frustumStatisticText');var g=document.createElement("input");g.type="checkbox",g.setAttribute("data-bind","checked: frustums, click: showFrustums"),f.appendChild(g),f.appendChild(document.createTextNode("Show Frustums")),f.appendChild(v);var _=document.createElement("div");m.appendChild(_);var y=document.createElement("input");y.type="checkbox",y.setAttribute("data-bind","checked: performance, click: showPerformance"),_.appendChild(y),_.appendChild(document.createTextNode("Performance Display")),s.className="cesium-cesiumInspector-performanceDisplay",m.appendChild(s);var C=document.createElement("div");C.className="cesium-cesiumInspector-shaderCache",C.setAttribute("data-bind","html: shaderCacheText"),m.appendChild(C);var w=document.createElement("div");m.appendChild(w);var S=document.createElement("input");S.type="checkbox",S.setAttribute("data-bind","checked: globeDepth, click: showGlobeDepth"),w.appendChild(S),w.appendChild(document.createTextNode("Show globe depth"));var E=document.createElement("div");w.appendChild(E);var b=document.createElement("div");m.appendChild(b);var x=document.createElement("input");x.type="checkbox",x.setAttribute("data-bind","checked: pickDepth, click: showPickDepth"),b.appendChild(x),b.appendChild(document.createTextNode("Show pick depth"));var T=document.createElement("div");m.appendChild(T);var P=document.createElement("span");P.setAttribute("data-bind",'html: "     Frustum:"'),T.appendChild(P);var A=document.createElement("span");A.setAttribute("data-bind","text: depthFrustumText"),T.appendChild(A);var D=document.createElement("input");D.type="button",D.value="-",D.className="cesium-cesiumInspector-pickButton",D.setAttribute("data-bind","click: decrementDepthFrustum"),T.appendChild(D);var M=document.createElement("input");M.type="button",M.value="+",M.className="cesium-cesiumInspector-pickButton",M.setAttribute("data-bind","click: incrementDepthFrustum"),T.appendChild(M);var I=document.createElement("div");I.className="cesium-cesiumInspector-sectionHeader",p=document.createElement("span"),p.className="cesium-cesiumInspector-toggleSwitch",p.setAttribute("data-bind","click: togglePrimitives, text: primitivesSwitchText"),I.appendChild(p),I.appendChild(document.createTextNode("Primitives")),h.appendChild(I);var O=document.createElement("div");O.className="cesium-cesiumInspector-section",O.setAttribute("data-bind",'css: {"cesium-cesiumInspector-show" : primitivesVisible, "cesium-cesiumInspector-hide" : !primitivesVisible}'),h.appendChild(O);var R=document.createElement("div");R.className="cesium-cesiumInspector-pickSection",O.appendChild(R);var L=document.createElement("input");L.type="button",L.value="Pick a primitive",L.className="cesium-cesiumInspector-pickButton",L.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickPrimitiveActive}, click: pickPrimitive');var N=document.createElement("div");N.className="cesium-cesiumInspector-center",N.appendChild(L),R.appendChild(N);var F=document.createElement("div");R.appendChild(F);var B=document.createElement("input");B.type="checkbox",B.setAttribute("data-bind","checked: primitiveBoundingSphere, click: showPrimitiveBoundingSphere, enable: hasPickedPrimitive"),F.appendChild(B),F.appendChild(document.createTextNode("Show bounding sphere"));var z=document.createElement("div");R.appendChild(z);var k=document.createElement("input");k.type="checkbox",k.setAttribute("data-bind","checked: primitiveReferenceFrame, click: showPrimitiveReferenceFrame, enable: hasPickedPrimitive"),z.appendChild(k),z.appendChild(document.createTextNode("Show reference frame"));var V=document.createElement("div");this._primitiveOnly=V,R.appendChild(V);var U=document.createElement("input");U.type="checkbox",U.setAttribute("data-bind","checked: filterPrimitive, click: doFilterPrimitive, enable: hasPickedPrimitive"),V.appendChild(U),V.appendChild(document.createTextNode("Show only selected"));var W=document.createElement("div");W.className="cesium-cesiumInspector-sectionHeader",p=document.createElement("span"),p.className="cesium-cesiumInspector-toggleSwitch",p.setAttribute("data-bind","click: toggleTerrain, text: terrainSwitchText"),W.appendChild(p),W.appendChild(document.createTextNode("Terrain")),h.appendChild(W);var G=document.createElement("div");G.className="cesium-cesiumInspector-section",G.setAttribute("data-bind",'css: {"cesium-cesiumInspector-show" : terrainVisible, "cesium-cesiumInspector-hide" : !terrainVisible}'),h.appendChild(G);var H=document.createElement("div");H.className="cesium-cesiumInspector-pickSection",G.appendChild(H);var q=document.createElement("input");q.type="button",q.value="Pick a tile",q.className="cesium-cesiumInspector-pickButton",q.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickTileActive}, click: pickTile'),N=document.createElement("div"),N.appendChild(q),N.className="cesium-cesiumInspector-center",H.appendChild(N);var j=document.createElement("div");H.appendChild(j);var Y=document.createElement("input");Y.type="button",Y.value="Parent",Y.className="cesium-cesiumInspector-pickButton",Y.setAttribute("data-bind","click: selectParent");var X=document.createElement("input");X.type="button",X.value="NW",X.className="cesium-cesiumInspector-pickButton",X.setAttribute("data-bind","click: selectNW");var Z=document.createElement("input");Z.type="button",Z.value="NE",Z.className="cesium-cesiumInspector-pickButton",Z.setAttribute("data-bind","click: selectNE");var J=document.createElement("input");J.type="button",J.value="SW",J.className="cesium-cesiumInspector-pickButton",J.setAttribute("data-bind","click: selectSW");var Q=document.createElement("input");Q.type="button",Q.value="SE",Q.className="cesium-cesiumInspector-pickButton",Q.setAttribute("data-bind","click: selectSE");var K=document.createElement("div");K.className="cesium-cesiumInspector-tileText",j.className="cesium-cesiumInspector-frustumStats",j.appendChild(K),j.setAttribute("data-bind",'css: {"cesium-cesiumInspector-show" : hasPickedTile, "cesium-cesiumInspector-hide" : !hasPickedTile}'),K.setAttribute("data-bind","html: tileText");var $=document.createElement("div");$.className="cesium-cesiumInspector-relativeText",$.textContent="Select relative:",j.appendChild($);var et=document.createElement("table"),tt=document.createElement("tr"),it=document.createElement("tr"),rt=document.createElement("td");rt.appendChild(Y);var nt=document.createElement("td");nt.appendChild(X);var ot=document.createElement("td");ot.appendChild(Z),tt.appendChild(rt),tt.appendChild(nt),tt.appendChild(ot);var at=document.createElement("td"),st=document.createElement("td");st.appendChild(J);var lt=document.createElement("td");lt.appendChild(Q),it.appendChild(at),it.appendChild(st),it.appendChild(lt),et.appendChild(tt),et.appendChild(it),j.appendChild(et);var ut=document.createElement("div");H.appendChild(ut);var ct=document.createElement("input");ct.type="checkbox",ct.setAttribute("data-bind","checked: tileBoundingSphere, enable: hasPickedTile, click: showTileBoundingSphere"),ut.appendChild(ct),ut.appendChild(document.createTextNode("Show bounding volume"));var ht=document.createElement("div");H.appendChild(ht);var dt=document.createElement("input");dt.type="checkbox",dt.setAttribute("data-bind","checked: filterTile, enable: hasPickedTile, click: doFilterTile"),ht.appendChild(dt),ht.appendChild(document.createTextNode("Show only selected"));var pt=document.createElement("div");G.appendChild(pt);var mt=document.createElement("input");mt.type="checkbox",mt.setAttribute("data-bind","checked: wireframe, click: showWireframe"),pt.appendChild(mt),pt.appendChild(document.createTextNode("Wireframe"));var ft=document.createElement("div");G.appendChild(ft);var vt=document.createElement("input");vt.type="checkbox",vt.setAttribute("data-bind","checked: suspendUpdates, click: doSuspendUpdates"),ft.appendChild(vt),ft.appendChild(document.createTextNode("Suspend LOD update"));var gt=document.createElement("div");G.appendChild(gt);var _t=document.createElement("input");_t.type="checkbox",_t.setAttribute("data-bind","checked: tileCoordinates, click: showTileCoordinates"),gt.appendChild(_t),gt.appendChild(document.createTextNode("Show tile coordinates")),n.applyBindings(l,this._element)};return t(s.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return n.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),i(this)},s}),i("Widgets/CesiumWidget/CesiumWidget",["../../Core/buildModuleUrl","../../Core/Cartesian3","../../Core/Clock","../../Core/Credit","../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/Ellipsoid","../../Core/formatError","../../Core/requestAnimationFrame","../../Core/ScreenSpaceEventHandler","../../Scene/BingMapsImageryProvider","../../Scene/Globe","../../Scene/Moon","../../Scene/Scene","../../Scene/SceneMode","../../Scene/SkyAtmosphere","../../Scene/SkyBox","../../Scene/Sun","../getElement"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w){"use strict";function S(t){return e("Assets/Textures/SkyBox/tycho2t3_80_"+t+".jpg")}function E(e){function t(r){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{var n=e._targetFrameRate;if(o(n)){var a=1e3/n,s=r-i;s>a&&(e.resize(),e.render(),i=r-s%a),h(t)}else e.resize(),e.render(),h(t)}catch(l){if(e._useDefaultRenderLoop=!1,e._renderLoopRunning=!1,e._showRenderLoopErrors){var u="An error occurred while rendering. Rendering has stopped.";e.showErrorPanel(u,void 0,l)}}else e._renderLoopRunning=!1}e._renderLoopRunning=!0;var i=0;h(t)}function b(e){var t=e._canvas,i=t.clientWidth,r=t.clientHeight,o=n(window.devicePixelRatio,1)*e._resolutionScale;e._canvasWidth=i,e._canvasHeight=r,i*=o,r*=o,t.width=i,t.height=r,e._canRender=0!==i&&0!==r}function x(e){var t=e._canvas,i=t.width,r=t.height;if(0!==i&&0!==r){var n=e._scene.camera.frustum;o(n.aspectRatio)?n.aspectRatio=i/r:(n.top=n.right*(r/i),n.bottom=-n.top)}}var T="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHYAAAAaCAYAAABikagwAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB9wGGRQyF371QVsAABOHSURBVGje7Vp5cFTHmf91v2Nm3owGnYMuEEJCOBiEjDlsDMYQjGMOOwmXcWxiLywpJ9iuTXZd612corJssFOxi8LerXizxEGUvWsivNxxHHCQ8WYBYSFzmUMCCXQjaUajOd/V+4f6Kc14kI/KZv/xq+p6M/PmO15/9/c1wa0vwpcMQAHgBuAFoPG7mz8jAGwASQBxADFhJQGYACwAjK+vrr/AJQ8jVMqfuwH4AGQByAaQnTNqXGHWqHGFbq8/g1BJsgw9GQ12Bds/qWsxEvEeAEEAfQDCAKKCgPGVcP//BOsIVQHgAZAJIACgsHTqvDvK7150T2bR2DFaZm6W4slwUypR20yaiUg4OtDbcaP36rlPPt6/7f2B3q5mAB0AeriAE18J9y93kVu4X4W73BwAhQBK5v/gZ98ZVXXvDG92IJMx569MQDEoK0tPmOHu1s4L7799sH7vtvcAXAPQCaCfu2qLu+7h+Eh3sS8Bcyt48iVgPos2+4J7jS+BIx2etDBSynfH/Xq46y0CUL70n3/zXMmUuXepWoZHFCQhFIQARCBFJYV6/Nn+QHnVBH9Ovq/51JFWADpfJhcqEzyDcx9ukTTr/xr2VnDpng0nuHR0h1u3wvWF6EspgBIAFYAfQAGAsuU/rfm7kePvvJ0QiTj6QSgBISS9ujEGSikkxaXklIwfK8uK2Xru2HVurWKspZyezGmmWwp/LqVsupPQub4grPQ5YIejKQvPJAGflLLJSBGmxPEqKXhU4XdJEBq7BR5Z+L+DKx3MTTHWEaybx9WCud/btCJQMeX2Qevk+NPoks0YPArF/RUj0NyXxOmO2CAy1a1OmL9yUVfTmatXTx52EildYFQVNlgRmBR1xQJgCBbPBAVUhcw8lTObLz0FVk4RIEmJJyJNZzFBiCTFBRL+f50rriFUATRFiZSU/XYEAw6X5LlIUghZqXvl5p8pfycRZsgjymlKGw1Adm7JbRUVs785nwGghP5pp9mfFMOxWstmuC3gwdcrRqA/buJUWwyKRMAYgydrZNZt9337623njn+ixyN9nAmdM5nBvYOPfxc3mnEmTQ4T5VZv8hfz8aUKnocJd5tvVhxAhOMADzNefleFjRUFa/D/xzi8LQhIEpTG4VXnNBzlZYISufk7juCfqaAoLkHYcZ6HBAEM8O+ObJz3HcFDpJfDJwWYfiHMMTklviocKHv6I3+zRFLdKhEEatmALBFIBIibNhQ6KFyJEjT2JHDoUj/a+nVIVIBhBGOnzptWXzhmTFfT2TZBOH4AgSeeeGJqRUVFqdfr9btcLnVQXwapmqZpJZPJRCgUCh47duzie++9dwWAXl5enrlp06bF0WhUM01TYYwRrmg2vzNKqS3Lsunz+Yy6urpTP//5z09blkVLSkryVq9ePT03NzegqqqbUnqTGyOEMNM0k319fX2///3vz9bW1l4DYD700EPFy5Ytm65pmvbBBx9c2rp166Wnnnqq7MEHH5zAGIu8/vrr+w8ePPgJVwrRO2gAcg8cOLA2mUx62tvbB9avX39s+fLlo++///5JXNiwbXugpqam9tChQ2cEj6NzuQwlsi+//PKSzMzMQtu2qcfjMZqbm09v2LDht4J3sQEQOU2Jo8mKKzt7VEU5lSgFBi3PZkBZrgv3lGbCo1Jc7I7iSGN40JcQgoGkhXdO94ESQJEoGI+1k/M9mDKqQHEv++akl186e45rNAAE3njjjccWLFhwfyAQyJEkiabGbcc7JJNJva2trX3Lli3vvPbaa+eKi4uLV6xY8d10cf5TcZ8x5OXl5b366qs9lFLtrbfeWldVVXW7pmkuxhjS0SSEIJlMGitXrrz2/PPPv1lTU3NtypQp0x955JG/kmVZdrlcR7du3WrOnTt33pIlS+YDwNGjR68ePHiwjVtukm+wI9ichQsXPgUAHR0d3evXr78xc+bMu9asWbOQUjpENz8/v/jQoUP/IiiH40UzAeQvW7Zs1rp16/7a5/NpDr/19fWlGzZsOM4tNsphkc5iPaXTvl6uuDUvY4MZLwNQ4Ffw+LR8+KQQTCuJSQUFcMsEe88FoSkSKCFwyWSISQbg9pEefHdGAJHIdUydVjFecL3K448/Pm3hwoUPBAKBHFGIlmU5pRCRpMGEze12q2PHjh2zatWqeTt37gwODAxkOQIJhUJ6Y2Njn6IojFJqE0KYsGyPx0POnTvXnUgkfGvXrr1j5syZU7iFsKampv5YLBZ34GzbJgAwatSo7MzMTE95eXnZT37yk0dramr+PRQKZSQSCdPn88nBYNADID8UCmkAYBiGGQ6Hna6cksbdZliWZUuSRKPRKAAUBINBfywWM30+n+yEtenTp9+5YsWKGTt37oxwz+a44RwARc8+++xSr9eriQrY398v8311CUncTTHN0Q7Vl1OQJymq4iBwyxQPT8qDVwri1d1/i8ttp/AP39mOBeMn41pQx9mOGFSZ3qT52ZqMR6aMRGvXKfzbgX9Ea3PnSLEdOWXKlK/5/X4/AFy8ePHG6tWr90QikS5VVaOEEIsxRhljngcffLBi8+bNjxBCUFJSMrKkpMRvGIbboXP27Nn+2bNn/3cgEIgSQmKEEAOARQixKKVxRVEioVAoYtu2dMcdd4x24Hbv3t3+ox/96ONoNBqklMa4ppNkMinNnz8///nnn6/y+Xw0mUxaANy6rrsdl28YhguAX9d1F98jwn9TUjJkJ5N1DWV0ti0ByDAMw+PsbzQatX0+Hy0oKMhcvnz5nP3791+IxWJRIUaPfO655+ZVVlaOA4BoNGprmkZ5uJJThZouKyYAqOrWVEKoE7cwszQDlQUK3jr8S5y++iEIIXh55/fwylOH8e3KHHSEdfQnLFBuRbJEsLQyF27Sh3eO/iuudV+EaSuqkJF6MjMzs9xutwIAv/rVr06eOHHiEwCtPBHQOaPaxYsXLxcXF8cKCwtzOzo6+ltbW4OFhYU+h2nDMAgAqbu7W8xkLSEBcsos1bbtocZIIBBQs7Ky5Pb2dkvXdV1wfaipqemsqak5yF1bFABljNEU4Sj87nia1LKHCJWGLLh6AkDhiksAoLq6um/VqlWZWVlZ8gMPPHDHwoULK2tqasJcYJ7y8vKyb33rW/f4/X43YwybNm26vnnz5pIUb0tvVe44maSVjEfizDJtmwFlOS4srczGiQvv4ncnd4ASAkIo+mN92LLrB/j7Vb/GQxOz8Z/1PTDsQXc6p3QEqopU7Dr6S5y8fAiKpCKhs6SQSUqyLKsO4d7e3j4AvbxD1csFQQF4EolEaP369TVCFjuiqKiogG8w5s6dm8sY++ZwcfbZZ5/dvHXr1isnT55scVz+rFmz8urr6xc4Ls22bZZIJExd181oNGr09PREDx06dPmFF144Ho/HTVGIjiE4guECoyl1LYTPcppGEAghDAAikUjixRdfbHnppZfKfD6fa82aNfMOHz7cHgwGbwBwr1ix4u677rqrgsfU4I4dO66lCPZTXSkqpOaMa60e7mjuosw0RmYoWHf3SLT3NOKt91+CbsZBeOlDCcX5luP4rw9fw4wSH+4p9cMlU3xtpAfLJmej/vIR7PnjLyDRwXeKhoxubokWAOYkDXxTLE5brB11oTZMCrWoNQgymJwZhsHC4bAZjUaNaDRqxGIx3VnxeDzJky8TQGLHjh3n9u3bd6ytrS3U2dkZ6e3tjfX398cHBgYS8XjcIIQQr9frKioq8ldWVhb88Ic/vHfbtm3zAXhs25aHUx7uEt1COeXEXM3JfAWLvWnSxRhLbNu2rampqSlMCME3vvGNyXPmzKkCUFZeXn776tWr72WMwbZtvPDCCx+5XK6wo6BcOdhwQ4Chuu/KR39onDGS9T80u9ivkgiqD/0UbT2NcKvelMaEhXfrqlGaPwEPT5qH0lwvqopcaOtpxPb3/gmGmYBEFRBC0HUlfp67tQQALxMKYsaYU+tlcSadNN8NIOO+++4bnZ2d7Q+Hw+zIkSNJxtiQ9TQ1NUW3bNnSmJWVlZBlWaeUWs5SVTUxYsSIRF1dXScAwzTN2MMPP7w3Pz//ZFVVVUFubq7L6/VKmqZRl8ulKIriVlVVmz59ev6cOXMCLpeLLliwYDyAOpGm08SglA659mQy6eHTrwiPtRYXbi6vP2/yjI61AoDL5Ur09vZ2bt++/ezGjRvvppSSjRs3Lti9e/fvnnzyyfHjx48fyRjDwYMHL9TW1jYWFhZ6xfIs3UhUTlPQRwGE9Gv/c/ba9YGi2rPv0FONf/iUUB3Lj8SDqD60GYtmdGBcYSVOnL+K39b9Gp19zVDkwZzBSpLY9Qv9Z3lKHgOgmaYZd9zg1KlTS994441L3G3lcD6oo/1btmxZFwgEctrb27vWrFlzwLIs2cmKW1pa4q+//vp1AbchdIKiPGZHAJDFixcHpk+ffnsoFNLefvvt3ra2Nl0YSDhdt4zy8vLwsWPHsl0ul6ooigSACuEZXKBJwzAMxhhUVZW8Xm8uH5hQ3mCwOf95VVVVYx03yQVhUEpNQbBxADfefPPN6NKlS8dUVlYWVlZW5r344osz1q1bV8IYQzAYjFVXV5+IxWIdkiTlpfDCUgcC6Sw2CqBvw4ZN+7/9d+Wzo1avT5HU9N1tMpj4dfU14z/efxletx9xPYpIPAhVccO2bVBKcf189I/h3mSLkBi5b9y40RWLxZJer9f12GOPTa6oqMjq6enpJYQYlFLGyx21tLQ0MGnSpDGEECQSCZMQIjuNCF6aqI8++mheVlZWJrdYkzcoLEVREj6fL1FfX39x165dzfPnzy/7/ve/v1LXdWvlypVde/bsuRKLxQyn1LEsS2aMeebNm1fs8/lkxhgsy7IAJBRF0Yc2TZZ1AANNTU0djoJt2rRpzqxZs/K6urq6JUnSCSHMMAxZ07SsxYsXV1JKCWMMAwMDMQBhVVWTjtU6gr1y5Yq1d+/ej8aNG5eraZr6zDPPjPV4PBJjDLW1ted27dr1MYCYqqpDcpMkyRIaEyydxToxNgagr7e3t+XEe0rNxPkjnvhTznNr4Sb0KBL6YO9BovJQnRXptTqaPgr9wTLsDgAhTkOurq4+unz58vs1TRvl9/vVuXPnljHGxgqxw2GcEjLYJLlw4cKV06dPd06bNo04+MePH+/ftm3bNNG1iW5KVVVl//79ew4cONC8d+/ey88884ysKIp85513jpo8eXJh2pHX4EUIITh58uRFAN1utzvHcb0ejycGoKuurk5vbW29u7i4ODB69OisJ5988i4xxDhsKIoiEUJgmqZ94MCBOgBdmqaVODxrmhbhiaP+4x//+N2lS5dOmjBhwhiPxyMBQFdXV191dfX7tm23AdBdLtdQzFYUxWmb3iRcmqbh7vQfOz9+v/PdjvP6kcHuE288MJZWuM4Smw1mgkQvHw/v6Wga+BjADY53AEDfmTNnLq9du/Znp06datB13RA3ROwGmaZphcPhgX379v326aefftO27Tafz9fJGGOmadqMMSbLMpEkiaZbjDFommYQQsK1tbWNr7zyymvhcLifEIJbwRBCmGVZ1vHjxz9atGjRLwA0Z2dndzpdHb/fHwTQcuLEiYann3761fPnz3+i67pBCCGUUkoIofwjpZQS27ZZd3f3ja1bt1Zv3LhxL4CrmZmZPYQQkxCCjIyMEIB2AG0Amrdv3/6beDweNwzD1nXdPHXq1Indu3cf48+7MjIyupw98ng8EW4wCWH4kHbQLgsnJ4oAlN332Ji1hbeps6lEaLohQLrhQCJi9zcei77TcLh9H4CrALp4rLN5LBvBE4scAP6JEyfmBQIBL6VUopSCMcYGBgYSly5dCvX19YW5QkQAmD6fz3PvvfeWxmIxr2EYHqFXPBRrKKWWJEmG1+uNtbW1dTU0NNzgz7wA/OXl5bkFBQV+XsYQwVpZMpk0jh8/3snpRQCYo0aN8k6YMCHX5XLRa9euBRsaGnr4Jnp458c7ceLEbK/X6xL5MQzDbGhoCNq2HeO4YgBYWVmZv6KiIkdVVbS0tHQ3NDR0CsORrDlz5oyllHoYY3p9ff31cDjczeGhaVrGkiVLSg3DkLu7u/s+/PDDFn4UKeJYLhnmAJvGs9QCAKOnLMhfNHqSNl/LlHOpTORbWa4et2ORXqv1wgf9NVfO9B7nTYcuPvlICq02t9CJ8ggjOJomodOF0ZQtHNvxCC08pBnbmcIhO53jdA7mpXaKUkOSWGoxYaaKlIa7IozT0uET+XDGehDGhhBGb6bTmBHezeb8OyNPCPQk/ptzeHConCSfcZDNI1hWQXaBVl5254hZmSPVce4MKUdxEQ+VJMnUbcNIWJFoyOzoa02eOX2k+yg/79TFNWkgZchOUobe4vA63WzUEmpYsa+dCoM0Izgz5aQkTUOPpGvUpKFJBaUR8Q03cLdT8NkppyEgPGOCYcnCiNASsn2SwrstDA2Gxnbkc5xSdHGrcmaBWYoqZ+YUe4pcXuqXJCobupWIhaze3vZohzAfdOaKN2mSwPxwR0ZSZ6uptZoIN9yxFCYIiqV5v3THStgwNNPhvtXxFgzDP9K8q52Cj6ZRNnaLffoUDfI5zhVLgrvxCN0Ux5URYXYYF84Wf2qqf4uDV591ZuiLHir7c8F+mZOU5M+Iazg8n3mYjnxORkV3I6dxg6KrMQW3Yaexlq+uv8D1v2IL+t4z3B/NAAAAAElFTkSuQmCC",P=function(e,a){e=w(e),a=n(a,{});var s=document.createElement("div");s.className="cesium-widget",e.appendChild(s);var l=document.createElement("canvas");l.oncontextmenu=function(){return!1},l.onselectstart=function(){return!1},s.appendChild(l);var c=document.createElement("div");c.className="cesium-widget-credits";var h=o(a.creditContainer)?w(a.creditContainer):s;h.appendChild(c);var E=n(a.showRenderLoopErrors,!0);this._element=s,this._container=e,this._canvas=l,this._canvasWidth=0,this._canvasHeight=0,this._creditContainer=c,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=E,this._resolutionScale=1,this._forceResize=!1,this._clock=o(a.clock)?a.clock:new i,b(this);try{var P=new v({canvas:l,contextOptions:a.contextOptions,creditContainer:c,mapProjection:a.mapProjection,orderIndependentTranslucency:a.orderIndependentTranslucency,scene3DOnly:n(a.scene3DOnly,!1)});this._scene=P,P.camera.constrainedAxis=t.UNIT_Z,x(this);var A=n(P.mapProjection.ellipsoid,u.WGS84),D=P.frameState.creditDisplay,M=new r("Cesium",T,"http://cesiumjs.org/");D.addDefaultCredit(M);var I=a.globe;o(I)||(I=new m(A)),I!==!1&&(P.globe=I);var O=a.skyBox;o(O)||(O=new y({sources:{positiveX:S("px"),negativeX:S("mx"),positiveY:S("py"),negativeY:S("my"),positiveZ:S("pz"),negativeZ:S("mz")}})),O!==!1&&(P.skyBox=O,P.sun=new C,P.moon=new f);var R=a.skyAtmosphere;o(R)||(R=new _(A)),R!==!1&&(P.skyAtmosphere=R); -var L=a.globe===!1?!1:a.imageryProvider;o(L)||(L=new p({url:"//dev.virtualearth.net"})),L!==!1&&P.imageryLayers.addImageryProvider(L),o(a.terrainProvider)&&a.globe!==!1&&(P.terrainProvider=a.terrainProvider),this._screenSpaceEventHandler=new d(l,!1),o(a.sceneMode)&&(a.sceneMode===g.SCENE2D&&this._scene.morphTo2D(0),a.sceneMode===g.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=n(a.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=a.targetFrameRate;var N=this;P.renderError.addEventListener(function(e,t){if(N._useDefaultRenderLoop=!1,N._renderLoopRunning=!1,N._showRenderLoopErrors){var i="An error occurred while rendering. Rendering has stopped.";N.showErrorPanel(i,void 0,t)}})}catch(F){if(E){var B="Error constructing CesiumWidget.",z='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:';this.showErrorPanel(B,z,F)}throw F}};return a(P.prototype,{container:{get:function(){return this._container}},canvas:{get:function(){return this._canvas}},creditContainer:{get:function(){return this._creditContainer}},scene:{get:function(){return this._scene}},imageryLayers:{get:function(){return this._scene.imageryLayers}},terrainProvider:{get:function(){return this._scene.terrainProvider},set:function(e){this._scene.terrainProvider=e}},camera:{get:function(){return this._scene.camera}},clock:{get:function(){return this._clock}},screenSpaceEventHandler:{get:function(){return this._screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._targetFrameRate},set:function(e){if(0>=e)throw new l("targetFrameRate must be greater than 0.");this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&E(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){if(0>=e)throw new l("resolutionScale must be greater than 0.");this._resolutionScale=e,this._forceResize=!0}}}),P.prototype.showErrorPanel=function(e,t,i){var r=this._element,n=document.createElement("div");n.className="cesium-widget-errorPanel";var a=document.createElement("div");a.className="cesium-widget-errorPanel-content",n.appendChild(a);var s=document.createElement("div");s.className="cesium-widget-errorPanel-header",s.appendChild(document.createTextNode(e)),a.appendChild(s);var l=document.createElement("div");l.className="cesium-widget-errorPanel-scroll",a.appendChild(l);var u=function(){l.style.maxHeight=Math.max(Math.round(.9*r.clientHeight-100),30)+"px"};if(u(),o(window.addEventListener)&&window.addEventListener("resize",u,!1),o(t)){var h=document.createElement("div");h.className="cesium-widget-errorPanel-message",h.innerHTML="<p>"+t+"</p>",l.appendChild(h)}var d="(no error details available)";o(i)&&(d=c(i));var p=document.createElement("div");p.className="cesium-widget-errorPanel-message",p.appendChild(document.createTextNode(d)),l.appendChild(p);var m=document.createElement("div");m.className="cesium-widget-errorPanel-buttonPanel",a.appendChild(m);var f=document.createElement("button");f.setAttribute("type","button"),f.className="cesium-button",f.appendChild(document.createTextNode("OK")),f.onclick=function(){o(u)&&o(window.removeEventListener)&&window.removeEventListener("resize",u,!1),r.removeChild(n)},m.appendChild(f),r.appendChild(n),console.error(e+"\n"+t+"\n"+d)},P.prototype.isDestroyed=function(){return!1},P.prototype.destroy=function(){this._scene=this._scene&&this._scene.destroy(),this._container.removeChild(this._element),s(this)},P.prototype.resize=function(){var e=this._canvas,t=e.clientWidth,i=e.clientHeight;(this._forceResize||this._canvasWidth!==t||this._canvasHeight!==i)&&(this._forceResize=!1,b(this),x(this))},P.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();var e=this._clock.tick();this._scene.render(e)}else this._clock.tick()},P}),i("Widgets/ClockViewModel",["../Core/Clock","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/EventHelper","../Core/JulianDate","../ThirdParty/knockout"],function(e,t,i,r,n,o,a){"use strict";var s=function(i){t(i)||(i=new e),this._clock=i,this._eventHelper=new n,this._eventHelper.add(i.onTick,this.synchronize,this);var r=a.observable(i.startTime);r.equalityComparer=o.equals,this.systemTime=a.observable(o.now()),this.systemTime.equalityComparer=o.equals,a.track(this,["systemTime"]),this.startTime=void 0,a.defineProperty(this,"startTime",{get:r,set:function(e){r(e),i.startTime=e}});var s=a.observable(i.stopTime);s.equalityComparer=o.equals,this.stopTime=void 0,a.defineProperty(this,"stopTime",{get:s,set:function(e){i.stopTime=e,s(e)}});var l=a.observable(i.currentTime);l.equalityComparer=o.equals,this.currentTime=void 0,a.defineProperty(this,"currentTime",{get:l,set:function(e){i.currentTime=e,l(e)}});var u=a.observable(i.multiplier);this.multiplier=void 0,a.defineProperty(this,"multiplier",{get:u,set:function(e){i.multiplier=e,u(e)}});var c=a.observable(i.clockStep);c.equalityComparer=function(e,t){return e===t},this.clockStep=void 0,a.defineProperty(this,"clockStep",{get:c,set:function(e){c(e),i.clockStep=e}});var h=a.observable(i.clockRange);h.equalityComparer=function(e,t){return e===t},this.clockRange=void 0,a.defineProperty(this,"clockRange",{get:h,set:function(e){h(e),i.clockRange=e}});var d=a.observable(i.canAnimate);this.canAnimate=void 0,a.defineProperty(this,"canAnimate",{get:d,set:function(e){d(e),i.canAnimate=e}});var p=a.observable(i.shouldAnimate);this.shouldAnimate=void 0,a.defineProperty(this,"shouldAnimate",{get:p,set:function(e){p(e),i.shouldAnimate=e}})};return i(s.prototype,{clock:{get:function(){return this._clock}}}),s.prototype.synchronize=function(){var e=this._clock,t=e.startTime,i=e.stopTime,r=e.currentTime,n=e.multiplier,a=e.clockStep,s=e.clockRange,l=e.canAnimate,u=e.shouldAnimate;this.systemTime=o.now(),this.startTime=t,this.stopTime=i,this.currentTime=r,this.multiplier=n,this.clockStep=a,this.clockRange=s,this.canAnimate=l,this.shouldAnimate=u},s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){this._eventHelper.removeAll(),r(this)},s}),i("Widgets/Command",["../Core/DeveloperError"],function(e){"use strict";var t=function(){this.canExecute=void 0,this.beforeExecute=void 0,this.afterExecute=void 0,e.throwInstantiationError()};return t}),i("Widgets/FullscreenButton/FullscreenButtonViewModel",["../../Core/defaultValue","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/Fullscreen","../../ThirdParty/knockout","../createCommand","../getElement"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(t){var i=this,r=o.observable(n.fullscreen),l=o.observable(n.enabled);this.isFullscreen=void 0,o.defineProperty(this,"isFullscreen",{get:function(){return r()}}),this.isFullscreenEnabled=void 0,o.defineProperty(this,"isFullscreenEnabled",{get:function(){return l()},set:function(e){l(e&&n.enabled)}}),this.tooltip=void 0,o.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?r()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=a(function(){n.fullscreen?n.exitFullscreen():n.requestFullscreen(i._fullscreenElement)},o.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=e(s(t),document.body),this._callback=function(){r(n.fullscreen)},document.addEventListener(n.changeEventName,this._callback)};return t(l.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){this._fullscreenElement=e}},command:{get:function(){return this._command}}}),l.prototype.isDestroyed=function(){return!1},l.prototype.destroy=function(){document.removeEventListener(n.changeEventName,this._callback),i(this)},l}),i("Widgets/FullscreenButton/FullscreenButton",["../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../ThirdParty/knockout","../getElement","./FullscreenButtonViewModel"],function(e,t,i,r,n,o,a){"use strict";var s="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",l="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",u=function(e,t){e=o(e);var i=new a(t);i._exitFullScreenPath=l,i._enterFullScreenPath=s;var r=document.createElement("button");r.type="button",r.className="cesium-button cesium-fullscreenButton",r.setAttribute("data-bind","attr: { title: tooltip },click: command,enable: isFullscreenEnabled,cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }"),e.appendChild(r),n.applyBindings(i,r),this._container=e,this._viewModel=i,this._element=r};return t(u.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),u.prototype.isDestroyed=function(){return!1},u.prototype.destroy=function(){return this._viewModel.destroy(),n.cleanNode(this._element),this._container.removeChild(this._element),i(this)},u}),i("Widgets/Geocoder/GeocoderViewModel",["../../Core/BingMapsApi","../../Core/Cartesian3","../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../../Core/Event","../../Core/jsonp","../../Core/Matrix4","../../Core/Rectangle","../../ThirdParty/knockout","../../ThirdParty/when","../createCommand"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";function p(e,t){0===e._flightDuration?(e._scene.camera.setView({position:t}),e._complete.raiseEvent()):e._scene.camera.flyTo({destination:t,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:l.IDENTITY,convert:!1})}function m(e){var i=e.searchText;if(!/^\s*$/.test(i)){var n=i.match(/[^\s,\n]+/g);if(2===n.length||3===n.length){var o=+n[0],a=+n[1],l=3===n.length?+n[2]:300;if(!isNaN(o)&&!isNaN(a)&&!isNaN(l))return p(e,t.fromDegrees(o,a,l)),void 0}e._isSearchInProgress=!0;var c=s(e._url+"REST/v1/Locations",{parameters:{query:i,key:e._key},callbackParameterName:"jsonp"}),d=e._geocodeInProgress=h(c,function(t){if(!d.cancel){if(e._isSearchInProgress=!1,0===t.resourceSets.length)return e.searchText=e._searchText+" (not found)",void 0;var i=t.resourceSets[0];if(0===i.resources.length)return e.searchText=e._searchText+" (not found)",void 0;var n=i.resources[0];e._searchText=n.name;var o=n.bbox,a=o[0],s=o[1],l=o[2],c=o[3],h=u.fromDegrees(s,a,c,l),m=e._scene.camera,f=m.getRectangleCameraCoordinates(h);r(f)&&p(e,f)}},function(){d.cancel||(e._isSearchInProgress=!1,e.searchText=e._searchText+" (error)")})}}function f(e){e._isSearchInProgress=!1,r(e._geocodeInProgress)&&(e._geocodeInProgress.cancel=!0,e._geocodeInProgress=void 0)}var v=function(t){this._url=i(t.url,"//dev.virtualearth.net/"),this._url.length>0&&"/"!==this._url[this._url.length-1]&&(this._url+="/"),this._key=e.getKey(t.key),this._scene=t.scene,this._flightDuration=t.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._geocodeInProgress=void 0,this._complete=new a;var r=this;this._searchCommand=d(function(){r.isSearchInProgress?f(r):m(r)}),c.track(this,["_searchText","_isSearchInProgress"]),this.isSearchInProgress=void 0,c.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,c.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(e){this._searchText=e}}),this.flightDuration=void 0,c.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(e){this._flightDuration=e}})};return n(v.prototype,{url:{get:function(){return this._url}},key:{get:function(){return this._key}},complete:{get:function(){return this._complete}},scene:{get:function(){return this._scene}},search:{get:function(){return this._searchCommand}}}),v}),i("Widgets/Geocoder/Geocoder",["../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/FeatureDetection","../../ThirdParty/knockout","../getElement","./GeocoderViewModel"],function(e,t,i,r,n,o,a,s){"use strict";var l="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",u="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",c=function(e){var t=a(e.container),i=new s(e);i._startSearchPath=l,i._stopSearchPath=u;var r=document.createElement("form");r.setAttribute("data-bind","submit: search");var c=document.createElement("input");c.type="search",c.className="cesium-geocoder-input",c.setAttribute("placeholder","Enter an address or landmark..."),c.setAttribute("data-bind",'value: searchText,valueUpdate: "afterkeydown",disable: isSearchInProgress,css: { "cesium-geocoder-input-wide" : searchText.length > 0 }'),r.appendChild(c);var h=document.createElement("span");h.className="cesium-geocoder-searchButton",h.setAttribute("data-bind","click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"),r.appendChild(h),t.appendChild(r),o.applyBindings(i,r),this._container=t,this._viewModel=i,this._form=r,this._onInputBegin=function(e){t.contains(e.target)||c.blur()},this._onInputEnd=function(e){t.contains(e.target)&&c.focus()},n.supportsPointerEvents()?(document.addEventListener("pointerdown",this._onInputBegin,!0),document.addEventListener("pointerup",this._onInputEnd,!0)):(document.addEventListener("mousedown",this._onInputBegin,!0),document.addEventListener("mouseup",this._onInputEnd,!0),document.addEventListener("touchstart",this._onInputBegin,!0),document.addEventListener("touchend",this._onInputEnd,!0))};return t(c.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return n.supportsPointerEvents()?(document.removeEventListener("pointerdown",this._onInputBegin,!0),document.removeEventListener("pointerup",this._onInputEnd,!0)):(document.removeEventListener("mousedown",this._onInputBegin,!0),document.removeEventListener("mouseup",this._onInputEnd,!0),document.removeEventListener("touchstart",this._onInputBegin,!0),document.removeEventListener("touchend",this._onInputEnd,!0)),o.cleanNode(this._form),this._container.removeChild(this._form),i(this)},c}),i("Widgets/HomeButton/HomeButtonViewModel",["../../Core/Cartesian3","../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../../Core/Matrix4","../../Core/Rectangle","../../Scene/Camera","../../Scene/SceneMode","../../ThirdParty/knockout","../createCommand"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(t,r){var n=t.mode;if(i(t)&&n===l.MORPHING&&t.completeMorph(),n===l.SCENE2D)t.camera.flyTo({destination:a.MAX_VALUE,duration:r,endTransform:o.IDENTITY});else if(n===l.SCENE3D){var u=t.camera.getRectangleCameraCoordinates(s.DEFAULT_VIEW_RECTANGLE),c=e.magnitude(u);c+=c*s.DEFAULT_VIEW_FACTOR,e.normalize(u,u),e.multiplyByScalar(u,c,u),t.camera.flyTo({destination:u,orientation:{heading:0,pitch:.5*-Math.PI,roll:0},duration:r,endTransform:o.IDENTITY})}else if(n===l.COLUMBUS_VIEW){var h=t.globe.ellipsoid.maximumRadius,d=new e(0,-1,1);d=e.multiplyByScalar(e.normalize(d,d),5*h,d);var p=-Math.acos(e.normalize(d,new e).z);t.camera.flyTo({destination:d,duration:r,orientation:{heading:0,pitch:p,roll:0},endTransform:o.IDENTITY,convert:!1})}}var d=function(e,t){this._scene=e,this._duration=t;var i=this;this._command=c(function(){h(i._scene,i._duration)}),this.tooltip="View Home",u.track(this,["tooltip"])};return r(d.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){this._duration=e}}}),d}),i("Widgets/HomeButton/HomeButton",["../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../ThirdParty/knockout","../getElement","./HomeButtonViewModel"],function(e,t,i,r,n,o,a){"use strict";var s=function(e,t,i){e=o(e);var r=new a(t,i);r._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";var s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-home-button",s.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"),e.appendChild(s),n.applyBindings(r,s),this._container=e,this._viewModel=r,this._element=s};return t(s.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return n.cleanNode(this._element),this._container.removeChild(this._element),i(this)},s}),i("Widgets/InfoBox/InfoBoxViewModel",["../../Core/defined","../../Core/defineProperties","../../Core/Event","../../ThirdParty/knockout"],function(e,t,i,r){"use strict";var n="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",o="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",a=function(){this._cameraClicked=new i,this._closeClicked=new i,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",r.track(this,["showInfo","titleText","description","maxHeight","enableCamera","isCameraTracking"]),this._loadingIndicatorHtml='<div class="cesium-infoBox-loadingContainer"><span class="cesium-infoBox-loading"></span></div>',this.cameraIconPath=void 0,r.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?o:n}}),r.defineProperty(this,"_bodyless",{get:function(){return!e(this.description)||0===this.description.length}})};return a.prototype.maxHeightOffset=function(e){return this.maxHeight-e+"px"},t(a.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}}),a}),i("Widgets/InfoBox/InfoBox",["../../Core/buildModuleUrl","../../Core/Color","../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../ThirdParty/knockout","../getElement","../subscribeAndEvaluate","./InfoBoxViewModel"],function(e,t,i,r,n,o,a,s,l,u){"use strict";var c=function(r){r=s(r);var n=document.createElement("div");n.className="cesium-infoBox",n.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),r.appendChild(n);var o=document.createElement("div");o.className="cesium-infoBox-title",o.setAttribute("data-bind","text: titleText"),n.appendChild(o);var c=document.createElement("button");c.type="button",c.className="cesium-button cesium-infoBox-camera",c.setAttribute("data-bind",'attr: { title: "Focus camera on object" },click: function () { cameraClicked.raiseEvent(this); },enable: enableCamera,cesiumSvgPath: { path: cameraIconPath, width: 32, height: 32 }'),n.appendChild(c);var h=document.createElement("button");h.type="button",h.className="cesium-infoBox-close",h.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),h.innerHTML="×",n.appendChild(h);var d=document.createElement("iframe");d.className="cesium-infoBox-iframe",d.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),d.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),d.setAttribute("allowfullscreen",!0),n.appendChild(d);var p=new u;a.applyBindings(p,n),this._container=r,this._element=n,this._frame=d,this._viewModel=p,this._descriptionSubscription=void 0;var m=this;d.addEventListener("load",function(){var r=d.contentDocument,o=r.createElement("link");o.href=e("Widgets/InfoBox/InfoBoxDescription.css"),o.rel="stylesheet",o.type="text/css";var a=r.createElement("div");a.className="cesium-infoBox-description",r.head.appendChild(o),r.body.appendChild(a),m._descriptionSubscription=l(p,"description",function(e){d.style.height="5px",a.innerHTML=e;var r=null,o=a.firstElementChild;if(null!==o&&1===a.childNodes.length){var s=window.getComputedStyle(o);if(null!==s){var l=s["background-color"],u=t.fromCssColorString(l);i(u)&&0!==u.alpha&&(r=s["background-color"])}}n.style["background-color"]=r;var c=a.getBoundingClientRect().height;d.style.height=c+"px"})}),d.setAttribute("src","about:blank")};return r(c.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}}),c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){var e=this._container;return a.cleanNode(this._element),e.removeChild(this._element),i(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),n(this)},c}),i("Widgets/NavigationHelpButton/NavigationHelpButtonViewModel",["../../Core/defineProperties","../../ThirdParty/knockout","../createCommand"],function(e,t,i){"use strict";var r=function(){this.showInstructions=!1;var e=this;this._command=i(function(){e.showInstructions=!e.showInstructions}),this._showClick=i(function(){e._touch=!1}),this._showTouch=i(function(){e._touch=!0}),this._touch=!1,this.tooltip="Navigation Instructions",t.track(this,["tooltip","showInstructions","_touch"])};return e(r.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}}),r}),i("Widgets/NavigationHelpButton/NavigationHelpButton",["../../Core/buildModuleUrl","../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/FeatureDetection","../../ThirdParty/knockout","../getElement","./NavigationHelpButtonViewModel"],function(e,t,i,r,n,o,a,s,l,u){"use strict";var c=function(i){var r=l(i.container),n=new u,o=t(i.instructionsInitiallyVisible,!1);n.showInstructions=o,n._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";var c=document.createElement("span");c.className="cesium-navigationHelpButton-wrapper",r.appendChild(c);var h=document.createElement("button");h.type="button",h.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",h.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),c.appendChild(h);var d=document.createElement("div");d.className="cesium-navigation-help",d.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),c.appendChild(d);var p=document.createElement("button");p.className="cesium-navigation-button cesium-navigation-button-left",p.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');var m=document.createElement("img");m.src=e("Widgets/Images/NavigationHelp/Mouse.svg"),m.className="cesium-navigation-button-icon",m.style.width="25px",m.style.height="25px",p.appendChild(m),p.appendChild(document.createTextNode("Mouse"));var f=document.createElement("button");f.className="cesium-navigation-button cesium-navigation-button-right",f.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');var v=document.createElement("img");v.src=e("Widgets/Images/NavigationHelp/Touch.svg"),v.className="cesium-navigation-button-icon",v.style.width="25px",v.style.height="25px",f.appendChild(v),f.appendChild(document.createTextNode("Touch")),d.appendChild(p),d.appendChild(f);var g=document.createElement("div");g.className="cesium-click-navigation-help cesium-navigation-help-instructions",g.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),g.innerHTML=' <table> <tr> <td><img src="'+e("Widgets/Images/NavigationHelp/MouseLeft.svg")+'" 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="'+e("Widgets/Images/NavigationHelp/MouseRight.svg")+'" 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="'+e("Widgets/Images/NavigationHelp/MouseMiddle.svg")+'" 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 click + drag</div> </td> </tr> </table>',d.appendChild(g);var _=document.createElement("div");_.className="cesium-touch-navigation-help cesium-navigation-help-instructions",_.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),_.innerHTML=' <table> <tr> <td><img src="'+e("Widgets/Images/NavigationHelp/TouchDrag.svg")+'" 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="'+e("Widgets/Images/NavigationHelp/TouchZoom.svg")+'" 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="'+e("Widgets/Images/NavigationHelp/TouchTilt.svg")+'" 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="'+e("Widgets/Images/NavigationHelp/TouchRotate.svg")+'" 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>',d.appendChild(_),s.applyBindings(n,c),this._container=r,this._viewModel=n,this._wrapper=c,this._closeInstructions=function(e){c.contains(e.target)||(n.showInstructions=!1)},a.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))};return r(c.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return a.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),s.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),n(this)},c}),i("Widgets/PerformanceWatchdog/PerformanceWatchdogViewModel",["../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Scene/FrameRateMonitor","../../ThirdParty/knockout","../createCommand"],function(e,t,i,r,n,o,a,s){"use strict";var l=function(t){this._scene=t.scene,this.lowFrameRateMessage=e(t.lowFrameRateMessage,"This application appears to be performing poorly on your system. Please try using a different web browser or updating your video drivers."),this.lowFrameRateMessageDismissed=!1,this.showingLowFrameRateMessage=!1,a.track(this,["lowFrameRateMessage","lowFrameRateMessageDismissed","showingLowFrameRateMessage"]);var i=this;this._dismissMessage=s(function(){i.showingLowFrameRateMessage=!1,i.lowFrameRateMessageDismissed=!0});var r=o.fromScene(t.scene); -this._unsubscribeLowFrameRate=r.lowFrameRate.addEventListener(function(){i.lowFrameRateMessageDismissed||(i.showingLowFrameRateMessage=!0)}),this._unsubscribeNominalFrameRate=r.nominalFrameRate.addEventListener(function(){i.showingLowFrameRateMessage=!1})};return i(l.prototype,{scene:{get:function(){return this._scene}},dismissMessage:{get:function(){return this._dismissMessage}}}),l.prototype.destroy=function(){return this._unsubscribeLowFrameRate(),this._unsubscribeNominalFrameRate(),r(this)},l}),i("Widgets/PerformanceWatchdog/PerformanceWatchdog",["../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../ThirdParty/knockout","../getElement","./PerformanceWatchdogViewModel"],function(e,t,i,r,n,o,a){"use strict";var s=function(e){var t=o(e.container),i=new a(e),r=document.createElement("div");r.className="cesium-performance-watchdog-message-area",r.setAttribute("data-bind","visible: showingLowFrameRateMessage");var s=document.createElement("button");s.setAttribute("type","button"),s.className="cesium-performance-watchdog-message-dismiss",s.innerHTML="×",s.setAttribute("data-bind","click: dismissMessage"),r.appendChild(s);var l=document.createElement("div");l.className="cesium-performance-watchdog-message",l.setAttribute("data-bind","html: lowFrameRateMessage"),r.appendChild(l),t.appendChild(r),n.applyBindings(i,r),this._container=t,this._viewModel=i,this._element=r};return t(s.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return this._viewModel.destroy(),n.cleanNode(this._element),this._container.removeChild(this._element),i(this)},s}),i("Widgets/SceneModePicker/SceneModePickerViewModel",["../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/EventHelper","../../Scene/SceneMode","../../ThirdParty/knockout","../createCommand"],function(e,t,i,r,n,o,a,s,l){"use strict";var u=function(t,i){this._scene=t;var r=this,n=function(e,t,i){r.sceneMode=i,r.dropDownVisible=!1};this._eventHelper=new o,this._eventHelper.add(t.morphStart,n),this._duration=e(i,2),this.sceneMode=t.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",s.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,s.defineProperty(this,"selectedTooltip",function(){var e=r.sceneMode;return e===a.SCENE2D?r.tooltip2D:e===a.SCENE3D?r.tooltip3D:r.tooltipColumbusView}),this._toggleDropDown=l(function(){r.dropDownVisible=!r.dropDownVisible}),this._morphTo2D=l(function(){t.morphTo2D(r._duration)}),this._morphTo3D=l(function(){t.morphTo3D(r._duration)}),this._morphToColumbusView=l(function(){t.morphToColumbusView(r._duration)}),this._sceneMode=a};return i(u.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){this._duration=e}},toggleDropDown:{get:function(){return this._toggleDropDown}},morphTo2D:{get:function(){return this._morphTo2D}},morphTo3D:{get:function(){return this._morphTo3D}},morphToColumbusView:{get:function(){return this._morphToColumbusView}}}),u.prototype.isDestroyed=function(){return!1},u.prototype.destroy=function(){this._eventHelper.removeAll(),r(this)},u}),i("Widgets/SceneModePicker/SceneModePicker",["../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/FeatureDetection","../../ThirdParty/knockout","../getElement","./SceneModePickerViewModel"],function(e,t,i,r,n,o,a,s){"use strict";var l="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",u="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",c="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",h=function(e,t,i){e=a(e);var r=new s(t,i);r._globePath=l,r._flatMapPath=u,r._columbusViewPath=c;var h=document.createElement("span");h.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(h);var d=document.createElement("button");d.type="button",d.className="cesium-button cesium-toolbar-button",d.setAttribute("data-bind",'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'),d.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 -->',h.appendChild(d);var p=document.createElement("button");p.type="button",p.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",p.setAttribute("data-bind",'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 }'),h.appendChild(p);var m=document.createElement("button");m.type="button",m.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",m.setAttribute("data-bind",'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 }'),h.appendChild(m);var f=document.createElement("button");f.type="button",f.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",f.setAttribute("data-bind",'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 }'),h.appendChild(f),o.applyBindings(r,h),this._viewModel=r,this._container=e,this._wrapper=h,this._closeDropDown=function(e){h.contains(e.target)||(r.dropDownVisible=!1)},n.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))};return t(h.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),h.prototype.isDestroyed=function(){return!1},h.prototype.destroy=function(){return this._viewModel.destroy(),n.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),o.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),i(this)},h}),i("Widgets/SelectionIndicator/SelectionIndicatorViewModel",["../../Core/Cartesian2","../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../../Core/EasingFunction","../../Scene/SceneTransforms","../../ThirdParty/knockout"],function(e,t,i,r,n,o,a,s){"use strict";var l=new e,u="-1000px",c=function(e,r,n){this._scene=e,this._screenPositionX=u,this._screenPositionY=u,this._tweens=e.tweens,this._container=t(n,document.body),this._selectionIndicatorElement=r,this._scale=1,this.position=void 0,this.showSelection=!1,s.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,s.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&i(this.position)}}),s.defineProperty(this,"_transform",{get:function(){return"scale("+this._scale+")"}}),this.computeScreenSpacePosition=function(t,i){return a.wgs84ToWindowCoordinates(e,t,i)}};return c.prototype.update=function(){if(this.showSelection&&i(this.position)){var e=this.computeScreenSpacePosition(this.position,l);if(i(e)){var t=this._container,r=t.parentNode.clientWidth,n=t.parentNode.clientHeight,o=this._selectionIndicatorElement.clientWidth,a=.5*o;e.x=Math.min(Math.max(e.x,-o),r+o)-a,e.y=Math.min(Math.max(e.y,-o),n+o)-a,this._screenPositionX=Math.floor(e.x+.25)+"px",this._screenPositionY=Math.floor(e.y+.25)+"px"}else this._screenPositionX=u,this._screenPositionY=u}},c.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:o.EXPONENTIAL_OUT})},c.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:o.EXPONENTIAL_OUT})},r(c.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}}),c}),i("Widgets/SelectionIndicator/SelectionIndicator",["../../Core/defined","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../ThirdParty/knockout","../getElement","./SelectionIndicatorViewModel"],function(e,t,i,r,n,o,a){"use strict";var s=function(e,t){e=o(e),this._container=e;var i=document.createElement("div");i.className="cesium-selection-wrapper",i.setAttribute("data-bind",'style: { "top" : _screenPositionY, "left" : _screenPositionX },css: { "cesium-selection-wrapper-visible" : isVisible }'),e.appendChild(i),this._element=i;var r="http://www.w3.org/2000/svg",s="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",l=document.createElementNS(r,"svg:svg");l.setAttribute("width",160),l.setAttribute("height",160),l.setAttribute("viewBox","0 0 160 160");var u=document.createElementNS(r,"g");u.setAttribute("transform","translate(80,80)"),l.appendChild(u);var c=document.createElementNS(r,"path");c.setAttribute("data-bind","attr: { transform: _transform }"),c.setAttribute("d",s),u.appendChild(c),i.appendChild(l);var h=new a(t,this._element,this._container);this._viewModel=h,n.applyBindings(this._viewModel,this._element)};return t(s.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){var e=this._container;return n.cleanNode(this._element),e.removeChild(this._element),i(this)},s}),i("Widgets/Timeline/TimelineHighlightRange",["../../Core/defaultValue","../../Core/JulianDate"],function(e,t){"use strict";function i(t,i,r){this._color=t,this._height=i,this._base=e(r,0)}return i.prototype.getHeight=function(){return this._height},i.prototype.getBase=function(){return this._base},i.prototype.getStartTime=function(){return this._start},i.prototype.getStopTime=function(){return this._stop},i.prototype.setRange=function(e,t){this._start=e,this._stop=t},i.prototype.render=function(e){var i="";if(this._start&&this._stop&&this._color){var r=t.secondsDifference(this._start,e.epochJulian),n=Math.round(e.timeBarWidth*e.getAlpha(r)),o=t.secondsDifference(this._stop,e.epochJulian),a=Math.round(e.timeBarWidth*e.getAlpha(o))-n;0>n&&(a+=n,n=0),n+a>e.timeBarWidth&&(a=e.timeBarWidth-n),a>0&&(i='<span class="cesium-timeline-highlight" style="left: '+n.toString()+"px; width: "+a.toString()+"px; bottom: "+this._base.toString()+"px; height: "+this._height+"px; background-color: "+this._color+';"></span>')}return i},i}),i("Widgets/Timeline/TimelineTrack",["../../Core/Color","../../Core/defined","../../Core/JulianDate"],function(e,t,i){"use strict";function r(t,i,r,n){this.interval=t,this.height=i,this.color=r||new e(.5,.5,.5,1),this.backgroundColor=n||new e(0,0,0,0)}return r.prototype.render=function(e,r){var n=this.interval.start,o=this.interval.stop,a=r.startJulian,s=i.addSeconds(r.startJulian,r.duration,new i);if(i.lessThan(n,a)&&i.greaterThan(o,s))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,r.y,r.timeBarWidth,this.height);else if(i.lessThanOrEquals(n,s)&&i.greaterThanOrEquals(o,a)){var l,u,c;for(l=0;l<r.timeBarWidth;++l){var h=i.addSeconds(r.startJulian,l/r.timeBarWidth*r.duration,new i);!t(u)&&i.greaterThanOrEquals(h,n)?u=l:!t(c)&&i.greaterThanOrEquals(h,o)&&(c=l)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,r.y,r.timeBarWidth,this.height),t(u)&&(t(c)||(c=r.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(u,r.y,Math.max(c-u,1),this.height))}},r}),i("Widgets/Timeline/Timeline",["../../Core/ClockRange","../../Core/defined","../../Core/destroyObject","../../Core/DeveloperError","../../Core/JulianDate","../getElement","./TimelineHighlightRange","./TimelineTrack"],function(e,t,i,r,n,o,a,s){"use strict";function l(e){return 10>e?"0"+e.toString():e.toString()}function u(e){return function(t){e._mouseMode!==g.touchOnly&&(0===t.button?(e._mouseMode=g.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,e._mouseMode=2===t.button?g.zoom:g.slide)),t.preventDefault()}}function c(e){return function(){e._mouseMode=g.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0px 0px"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function h(e){return function(t){var i;if(e._mouseMode===g.scrub){t.preventDefault();var r=t.clientX-e._topDiv.getBoundingClientRect().left;0>r?(e._timelineDragLocation=0,e._timelineDrag=-.01*e._timeBarSecondsSpan):r>e._topDiv.clientWidth?(e._timelineDragLocation=e._topDiv.clientWidth,e._timelineDrag=.01*e._timeBarSecondsSpan):(e._timelineDragLocation=void 0,e._setTimeBarTime(r,r*e._timeBarSecondsSpan/e._topDiv.clientWidth))}else if(e._mouseMode===g.slide){if(i=e._mouseX-t.clientX,e._mouseX=t.clientX,0!==i){var o=i*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(n.addSeconds(e._startJulian,o,new n),n.addSeconds(e._endJulian,o,new n))}}else e._mouseMode===g.zoom&&(i=e._mouseX-t.clientX,e._mouseX=t.clientX,0!==i&&e.zoomFrom(Math.pow(1.01,i)))}}function d(e){return function(t){var i=t.wheelDeltaY||t.wheelDelta||-t.detail;v=Math.max(Math.min(Math.abs(i),v),1),i/=v,e.zoomFrom(Math.pow(1.05,-i))}}function p(e){return function(t){var i,r,o=t.touches.length,a=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=g.touchOnly,1===o?(i=n.secondsDifference(e._scrubJulian,e._startJulian),r=Math.round(i*e._topDiv.clientWidth/e._timeBarSecondsSpan+a),Math.abs(t.touches[0].clientX-r)<50?(e._touchMode=_.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=1===o?"-16px 0":"0 0")):(e._touchMode=_.singleTap,e._touchState.centerX=t.touches[0].clientX-a)):2===o?(e._touchMode=_.slideZoom,e._touchState.centerX=.5*(t.touches[0].clientX+t.touches[1].clientX)-a,e._touchState.spanX=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):e._touchMode=_.ignore}}function m(e){return function(t){var i=t.touches.length,r=e._topDiv.getBoundingClientRect().left;e._touchMode===_.singleTap?(e._touchMode=_.scrub,e._handleTouchMove(t)):e._touchMode===_.scrub&&e._handleTouchMove(t),e._mouseMode=g.touchOnly,1!==i?e._touchMode=i>0?_.ignore:_.none:e._touchMode===_.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-r),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function f(e){return function(i){var r,o,a,s,l,u,c=1,h=e._topDiv.getBoundingClientRect().left;e._touchMode===_.singleTap&&(e._touchMode=_.slideZoom),e._mouseMode=g.touchOnly,e._touchMode===_.scrub?(i.preventDefault(),1===i.changedTouches.length&&(o=i.changedTouches[0].clientX-h,o>=0&&o<=e._topDiv.clientWidth&&e._setTimeBarTime(o,o*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===_.slideZoom&&(a=i.touches.length,2===a?(s=.5*(i.touches[0].clientX+i.touches[1].clientX)-h,l=Math.abs(i.touches[0].clientX-i.touches[1].clientX)):1===a&&(s=i.touches[0].clientX-h,l=0),t(s)&&(l>0&&e._touchState.spanX>0?(c=e._touchState.spanX/l,u=n.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-s*e._timeBarSecondsSpan*c)/e._topDiv.clientWidth,new n)):(r=e._touchState.centerX-s,u=n.addSeconds(e._startJulian,r*e._timeBarSecondsSpan/e._topDiv.clientWidth,new n)),e.zoomTo(u,n.addSeconds(u,e._timeBarSecondsSpan*c,new n)),e._touchState.centerX=s,e._touchState.spanX=l))}}var v=1e12,g={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},_={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},y=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],w=function(e,t){e=o(e),this.container=e;var i=document.createElement("div");i.className="cesium-timeline-main",e.appendChild(i),this._topDiv=i,this._endJulian=void 0,this._epochJulian=void 0,this._lastXPos=void 0,this._scrubElement=void 0,this._startJulian=void 0,this._timeBarSecondsSpan=void 0,this._clock=t,this._scrubJulian=t.currentTime,this._mainTicSpan=-1,this._mouseMode=g.none,this._touchMode=_.none,this._touchState={centerX:0,spanX:0},this._mouseX=0,this._timelineDrag=0,this._timelineDragLocation=void 0,this._lastHeight=void 0,this._lastWidth=void 0,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>',this._timeBarEle=this._topDiv.childNodes[0],this._trackContainer=this._topDiv.childNodes[1],this._trackListEle=this._topDiv.childNodes[1].childNodes[0],this._needleEle=this._topDiv.childNodes[2],this._rulerEle=this._topDiv.childNodes[3],this._context=this._trackListEle.getContext("2d"),this._trackList=[],this._highlightRanges=[],this.zoomTo(t.startTime,t.stopTime),this._onMouseDown=u(this),this._onMouseUp=c(this),this._onMouseMove=h(this),this._onMouseWheel=d(this),this._onTouchStart=p(this),this._onTouchMove=f(this),this._onTouchEnd=m(this);var r=this._timeBarEle;document.addEventListener("mouseup",this._onMouseUp,!1),document.addEventListener("mousemove",this._onMouseMove,!1),r.addEventListener("mousedown",this._onMouseDown,!1),r.addEventListener("DOMMouseScroll",this._onMouseWheel,!1),r.addEventListener("mousewheel",this._onMouseWheel,!1),r.addEventListener("touchstart",this._onTouchStart,!1),r.addEventListener("touchmove",this._onTouchMove,!1),r.addEventListener("touchend",this._onTouchEnd,!1),this._topDiv.oncontextmenu=function(){return!1},t.onTick.addEventListener(this.updateFromClock,this),this.updateFromClock()};return w.prototype.addEventListener=function(e,t,i){this._topDiv.addEventListener(e,t,i)},w.prototype.removeEventListener=function(e,t,i){this._topDiv.removeEventListener(e,t,i)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){this._clock.onTick.removeEventListener(this.updateFromClock,this),document.removeEventListener("mouseup",this._onMouseUp,!1),document.removeEventListener("mousemove",this._onMouseMove,!1);var e=this._timeBarEle;e.removeEventListener("mousedown",this._onMouseDown,!1),e.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),e.removeEventListener("mousewheel",this._onMouseWheel,!1),e.removeEventListener("touchstart",this._onTouchStart,!1),e.removeEventListener("touchmove",this._onTouchMove,!1),e.removeEventListener("touchend",this._onTouchEnd,!1),this.container.removeChild(this._topDiv),i(this)},w.prototype.addHighlightRange=function(e,t,i){var r=new a(e,t,i);return this._highlightRanges.push(r),this.resize(),r},w.prototype.addTrack=function(e,t,i,r){var n=new s(e,t,i,r);return this._trackList.push(n),this._lastHeight=void 0,this.resize(),n},w.prototype.zoomTo=function(t,i){if(this._startJulian=t,this._endJulian=i,this._timeBarSecondsSpan=n.secondsDifference(i,t),this._clock&&this._clock.clockRange!==e.UNBOUNDED){var r=this._clock.startTime,o=this._clock.stopTime,a=n.secondsDifference(o,r),s=n.secondsDifference(r,this._startJulian),l=n.secondsDifference(o,this._endJulian);this._timeBarSecondsSpan>=a?(this._timeBarSecondsSpan=a,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):s>0?(this._endJulian=n.addSeconds(this._endJulian,s,new n),this._startJulian=r,this._timeBarSecondsSpan=n.secondsDifference(this._endJulian,this._startJulian)):0>l&&(this._startJulian=n.addSeconds(this._startJulian,l,new n),this._endJulian=o,this._timeBarSecondsSpan=n.secondsDifference(this._endJulian,this._startJulian))}this._makeTics();var u=document.createEvent("Event");u.initEvent("setzoom",!0,!0),u.startJulian=this._startJulian,u.endJulian=this._endJulian,u.epochJulian=this._epochJulian,u.totalSpan=this._timeBarSecondsSpan,u.mainTicSpan=this._mainTicSpan,this._topDiv.dispatchEvent(u)},w.prototype.zoomFrom=function(e){var t=n.secondsDifference(this._scrubJulian,this._startJulian);e>1||0>t||t>this._timeBarSecondsSpan?t=.5*this._timeBarSecondsSpan:t+=t-.5*this._timeBarSecondsSpan;var i=this._timeBarSecondsSpan-t;this.zoomTo(n.addSeconds(this._startJulian,t-t*e,new n),n.addSeconds(this._endJulian,i*e-i,new n))},w.prototype.makeLabel=function(e){var t=n.toGregorianDate(e),i=t.millisecond,r=" UTC";if(i>0&&this._timeBarSecondsSpan<3600){for(r=Math.floor(i).toString();r.length<3;)r="0"+r;r="."+r}return C[t.month-1]+" "+t.day+" "+t.year+" "+l(t.hour)+":"+l(t.minute)+":"+l(t.second)+r},w.prototype.smallestTicInPixels=7,w.prototype._makeTics=function(){function e(e){return Math.floor(S/e)*e}function t(e,t){return Math.ceil(e/t+.5)*t}function i(e){return(e-S)/v}function r(e,t){return e-t*Math.round(e/t)}var o,a=this._timeBarEle,s=n.secondsDifference(this._scrubJulian,this._startJulian),l=Math.round(s*this._topDiv.clientWidth/this._timeBarSecondsSpan),u=l-8,c=this;this._needleEle.style.left=l.toString()+"px";var h="",d=.01,p=31536e6,m=1e-10,f=0,v=this._timeBarSecondsSpan;d>v?(v=d,this._timeBarSecondsSpan=d,this._endJulian=n.addSeconds(this._startJulian,d,new n)):v>p&&(v=p,this._timeBarSecondsSpan=p,this._endJulian=n.addSeconds(this._startJulian,p,new n));var g=this._timeBarEle.clientWidth;10>g&&(g=10);var _,C=this._startJulian,w=Math.min(1e-5*(v/g),.4);_=v>31536e4?n.fromIso8601(n.toDate(C).toISOString().substring(0,2)+"00-01-01T00:00:00Z"):v>31536e3?n.fromIso8601(n.toDate(C).toISOString().substring(0,3)+"0-01-01T00:00:00Z"):v>86400?n.fromIso8601(n.toDate(C).toISOString().substring(0,4)+"-01-01T00:00:00Z"):n.fromIso8601(n.toDate(C).toISOString().substring(0,10)+"T00:00:00Z");var S=n.secondsDifference(this._startJulian,n.addSeconds(_,w,new n)),E=S+v;this._epochJulian=_,this._rulerEle.innerHTML=this.makeLabel(n.addSeconds(this._endJulian,-d,new n));var b=this._rulerEle.offsetWidth+20;30>b&&(b=180);var x=f;f-=m;var T={startTime:S,startJulian:C,epochJulian:_,duration:v,timeBarWidth:g,getAlpha:i};this._highlightRanges.forEach(function(e){h+=e.render(T)});var P=0,A=0,D=0,M=b/g;M>1&&(M=1),M*=this._timeBarSecondsSpan;var I,O=-1,R=-1,L=y.length;for(I=0;L>I;++I){var N=y[I];if(++O,P=N,N>M&&N>f)break;0>R&&g*(N/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(R=O)}if(O>0){for(;O>0;)if(--O,Math.abs(r(P,y[O]))<1e-5){y[O]>=f&&(A=y[O]);break}if(R>=0)for(;O>R;){if(Math.abs(r(A,y[R]))<1e-5&&y[R]>=f){D=y[R];break}++R}}f=x,f>m&&1e-5>D&&Math.abs(f-P)>m&&(D=f,P+m>=f&&(A=0));var F,B=-999999;if(g*(D/this._timeBarSecondsSpan)>=3)for(o=e(D);E>=o;o=t(o,D))h+='<span class="cesium-timeline-ticTiny" style="left: '+Math.round(g*i(o)).toString()+'px;"></span>';if(g*(A/this._timeBarSecondsSpan)>=3)for(o=e(A);E>=o;o=t(o,A))h+='<span class="cesium-timeline-ticSub" style="left: '+Math.round(g*i(o)).toString()+'px;"></span>'; -if(g*(P/this._timeBarSecondsSpan)>=2){this._mainTicSpan=P,E+=P,o=e(P);for(var z=n.computeTaiMinusUtc(_);E>=o;){var k=n.addSeconds(C,o-S,new n);if(P>2.1){var V=n.computeTaiMinusUtc(k);Math.abs(V-z)>.1&&(o+=V-z,k=n.addSeconds(C,o-S,new n))}var U=Math.round(g*i(o)),W=this.makeLabel(k);this._rulerEle.innerHTML=W,F=this._rulerEle.offsetWidth,10>F&&(F=b);var G=U-(F/2-1);G>B?(B=G+F+5,h+='<span class="cesium-timeline-ticMain" style="left: '+U.toString()+'px;"></span>'+'<span class="cesium-timeline-ticLabel" style="left: '+G.toString()+'px;">'+W+"</span>"):h+='<span class="cesium-timeline-ticSub" style="left: '+U.toString()+'px;"></span>',o=t(o,P)}}else this._mainTicSpan=-1;h+='<span class="cesium-timeline-icon16" style="left:'+u+'px;bottom:0;background-position: 0px 0px;"></span>',a.innerHTML=h,this._scrubElement=a.lastChild,this._context.clearRect(0,0,this._trackListEle.width,this._trackListEle.height),T.y=0,this._trackList.forEach(function(e){e.render(c._context,T),T.y+=e.height})},w.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;var e=this._scrubElement;if(t(this._scrubElement)){var i=n.secondsDifference(this._scrubJulian,this._startJulian),r=Math.round(i*this._topDiv.clientWidth/this._timeBarSecondsSpan);this._lastXPos!==r&&(this._lastXPos=r,e.style.left=r-8+"px",this._needleEle.style.left=r+"px")}t(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(n.addSeconds(this._startJulian,this._timelineDrag,new n),n.addSeconds(this._endJulian,this._timelineDrag,new n)))},w.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=n.addSeconds(this._startJulian,t,new n),this._scrubElement){var i=e-8;this._scrubElement.style.left=i.toString()+"px",this._needleEle.style.left=e.toString()+"px"}var r=document.createEvent("Event");r.initEvent("settime",!0,!0),r.clientX=e,r.timeSeconds=t,r.timeJulian=this._scrubJulian,r.clock=this._clock,this._topDiv.dispatchEvent(r)},w.prototype.resize=function(){var e=this.container.clientWidth,t=this.container.clientHeight;if(e!==this._lastWidth||t!==this._lastHeight){this._trackContainer.style.height=t+"px";var i=1;this._trackList.forEach(function(e){i+=e.height}),this._trackListEle.style.height=i.toString()+"px",this._trackListEle.width=this._trackListEle.clientWidth,this._trackListEle.height=i,this._makeTics(),this._lastWidth=e,this._lastHeight=t}},w}),i("Widgets/Viewer/Viewer",["../../Core/BoundingSphere","../../Core/Cartesian3","../../Core/defaultValue","../../Core/defined","../../Core/definedNotNull","../../Core/defineProperties","../../Core/destroyObject","../../Core/DeveloperError","../../Core/EventHelper","../../Core/isArray","../../Core/Matrix4","../../Core/ScreenSpaceEventType","../../DataSources/BoundingSphereState","../../DataSources/ConstantPositionProperty","../../DataSources/DataSourceCollection","../../DataSources/DataSourceDisplay","../../DataSources/Entity","../../DataSources/EntityView","../../DataSources/Property","../../Scene/SceneMode","../../ThirdParty/knockout","../../ThirdParty/when","../Animation/Animation","../Animation/AnimationViewModel","../BaseLayerPicker/BaseLayerPicker","../BaseLayerPicker/createDefaultImageryProviderViewModels","../BaseLayerPicker/createDefaultTerrainProviderViewModels","../CesiumWidget/CesiumWidget","../ClockViewModel","../FullscreenButton/FullscreenButton","../Geocoder/Geocoder","../getElement","../HomeButton/HomeButton","../InfoBox/InfoBox","../NavigationHelpButton/NavigationHelpButton","../SceneModePicker/SceneModePicker","../SelectionIndicator/SelectionIndicator","../subscribeAndEvaluate","../Timeline/Timeline"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B,z){"use strict";function k(e){var t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function V(e,t){var n=e.scene.pick(t.position);if(r(n)){var o=i(n.id,n.primitive.id);if(o instanceof v)return o}return r(e.scene.globe)?W(e,t.position):void 0}function U(e,t,i){if(r(i)){var n=i.clock;r(n)&&(n.getValue(t),r(e)&&(e.updateFromClock(),e.zoomTo(n.startTime,n.stopTime)))}}function W(e,t){var i=e.scene,n=i.camera.getPickRay(t),o=i.imageryLayers.pickImageryLayerFeatures(n,i);if(r(o)){var a=new v({id:"Loading...",description:"Loading feature information..."});return w(o,function(t){if(e.selectedEntity===a){if(!r(t)||0===t.length)return e.selectedEntity=G(),void 0;var i=t[0],n=new v({id:i.name,description:i.description});if(r(i.position)){var o=e.scene.globe.ellipsoid.cartographicToCartesian(i.position,J);n.position=new p(o)}e.selectedEntity=n}},function(){e.selectedEntity===a&&(e.selectedEntity=G())}),a}}function G(){return new v({id:"None",description:"No features found."})}function H(e,t,n,o){j(e);var a=w.defer();return e._zoomPromise=a,e._zoomIsFlight=o,e._zoomOptions=n,w(t,function(t){if(e._zoomPromise===a)if(t.isLoading&&r(t.loadingEvent))var n=t.loadingEvent.addEventListener(function(){n(),e._zoomPromise===a&&(e._zoomTarget=t.entities.values.slice(0))});else t=i(t.values,t),r(t.entities)&&(t=t.entities.values),e._zoomTarget=u(t)?t.slice(0):[t]}),a}function q(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function j(e){var t=e._zoomPromise;r(t)&&(q(e),t.resolve(!1))}function Y(t){var n=t._zoomTarget;if(r(n)&&t.scene.mode!==y.MORPHING){for(var o=t._zoomPromise,a=[],s=0,l=n.length;l>s;s++){var u=t._dataSourceDisplay.getBoundingSphere(n[s],!1,Z);if(u===d.PENDING)return;u!==d.FAILED&&a.push(e.clone(Z))}if(0===a.length)return j(t),void 0;t.trackedEntity=void 0;var h=t.scene,p=h.camera,m=e.fromBoundingSpheres(a),f=h.screenSpaceCameraController;if(f.minimumZoomDistance=Math.min(f.minimumZoomDistance,.5*m.radius),t._zoomIsFlight){var v=i(t._zoomOptions,{}),g={duration:v.duration,complete:function(){o.resolve(!0)},cancel:function(){o.resolve(!1)},offset:v.offset};q(t),p.flyToBoundingSphere(m,g)}else p.viewBoundingSphere(m,t._zoomOptions),p.lookAtTransform(c.IDENTITY),q(t),o.resolve(!0)}}function X(e){if(e._needTrackedEntityUpdate){var t=e._trackedEntity,i=e.clock.currentTime,n=_.getValueOrUndefined(t.position,i);if(r(n)){var o=e.scene,a=e._dataSourceDisplay.getBoundingSphere(t,!1,Z);if(a!==d.PENDING){var s=o.mode;(s===y.COLUMBUS_VIEW||s===y.SCENE2D)&&(o.screenSpaceCameraController.enableTranslate=!1),(s===y.COLUMBUS_VIEW||s===y.SCENE3D)&&(o.screenSpaceCameraController.enableTilt=!1);var l=a!==d.FAILED?Z:void 0;e._entityView=new g(t,o,o.mapProjection.ellipsoid,l),e._entityView.update(i),e._needTrackedEntityUpdate=!1}}}}var Z=new e,J=new t,Q=function(e,t){function o(e){var t=V(Ct,e);r(t)&&(_.getValueOrUndefined(t.position,Ct.clock.currentTime)?Ct.trackedEntity=t:Ct.zoomTo(t))}function a(e){Ct.selectedEntity=V(Ct,e)}e=I(e),t=i(t,i.EMPTY_OBJECT);var u=!(r(t.globe)&&t.globe===!1||r(t.baseLayerPicker)&&t.baseLayerPicker===!1),c=document.createElement("div");c.className="cesium-viewer",e.appendChild(c);var d=document.createElement("div");d.className="cesium-viewer-cesiumWidgetContainer",c.appendChild(d);var p=document.createElement("div");p.className="cesium-viewer-bottom",c.appendChild(p);var v=i(t.scene3DOnly,!1),g=new P(d,{terrainProvider:t.terrainProvider,imageryProvider:u?!1:t.imageryProvider,clock:t.clock,skyBox:t.skyBox,skyAtmosphere:t.skyAtmosphere,sceneMode:t.sceneMode,mapProjection:t.mapProjection,globe:t.globe,orderIndependentTranslucency:t.orderIndependentTranslucency,contextOptions:t.contextOptions,useDefaultRenderLoop:t.useDefaultRenderLoop,targetFrameRate:t.targetFrameRate,showRenderLoopErrors:t.showRenderLoopErrors,creditContainer:r(t.creditContainer)?t.creditContainer:p,scene3DOnly:v}),y=t.dataSources,w=!1;r(y)||(y=new m,w=!0);var U=new f({scene:g.scene,dataSourceCollection:y}),W=g.clock,G=new A(W),H=new l;H.add(W.onTick,Q.prototype._onTick,this);var q;if(!r(t.selectionIndicator)||t.selectionIndicator!==!1){var j=document.createElement("div");j.className="cesium-viewer-selectionIndicatorContainer",c.appendChild(j),q=new F(j,g.scene)}var Y;if(!r(t.infoBox)||t.infoBox!==!1){var X=document.createElement("div");X.className="cesium-viewer-infoBoxContainer",c.appendChild(X),Y=new R(X);var Z=Y.viewModel;H.add(Z.cameraClicked,Q.prototype._onInfoBoxCameraClicked,this),H.add(Z.closeClicked,Q.prototype._onInfoBoxClockClicked,this)}var J=document.createElement("div");J.className="cesium-viewer-toolbar",c.appendChild(J);var K;if(!r(t.geocoder)||t.geocoder!==!1){var $=document.createElement("div");$.className="cesium-viewer-geocoderContainer",J.appendChild($),K=new M({container:$,scene:g.scene}),H.add(K.viewModel.search.beforeExecute,Q.prototype._clearObjects,this)}var et;if(r(t.homeButton)&&t.homeButton===!1||(et=new O(J,g.scene),r(K)&&H.add(et.viewModel.command.afterExecute,function(){var e=K.viewModel;e.searchText="",e.isSearchInProgress&&e.search()}),H.add(et.viewModel.command.beforeExecute,Q.prototype._clearTrackedObject,this)),t.sceneModePicker===!0&&v)throw new s("options.sceneModePicker is not available when options.scene3DOnly is set to true.");var tt;v||r(t.sceneModePicker)&&t.sceneModePicker===!1||(tt=new N(J,g.scene));var it,rt;if(u){var nt=i(t.imageryProviderViewModels,x()),ot=i(t.terrainProviderViewModels,T());it=new b(J,{globe:g.scene.globe,imageryProviderViewModels:nt,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:ot,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel});var at=J.getElementsByClassName("cesium-baseLayerPicker-dropDown");rt=at[0]}var st;if(!r(t.navigationHelpButton)||t.navigationHelpButton!==!1){var lt=!0;try{if(n(window.localStorage)){var ut=window.localStorage.getItem("cesium-hasSeenNavHelp");r(ut)&&Boolean(ut)?lt=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch(ct){}st=new L({container:J,instructionsInitiallyVisible:i(t.navigationInstructionsInitiallyVisible,lt)})}var ht;if(!r(t.animation)||t.animation!==!1){var dt=document.createElement("div");dt.className="cesium-viewer-animationContainer",c.appendChild(dt),ht=new S(dt,new E(G))}var pt;if(!r(t.timeline)||t.timeline!==!1){var mt=document.createElement("div");mt.className="cesium-viewer-timelineContainer",c.appendChild(mt),pt=new z(mt,W),pt.addEventListener("settime",k,!1),pt.zoomTo(W.startTime,W.stopTime)}var ft,vt;if(r(t.fullscreenButton)&&t.fullscreenButton===!1)r(pt)&&(pt.container.style.right=0);else{var gt=document.createElement("div");gt.className="cesium-viewer-fullscreenContainer",c.appendChild(gt),ft=new D(gt,t.fullscreenElement),vt=B(ft.viewModel,"isFullscreenEnabled",function(e){gt.style.display=e?"block":"none",r(pt)&&(pt.container.style.right=gt.clientWidth+"px",pt.resize())})}this._baseLayerPickerDropDown=rt,this._fullscreenSubscription=vt,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=i(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=p,this._element=c,this._cesiumWidget=g,this._selectionIndicator=q,this._infoBox=Y,this._dataSourceCollection=y,this._destroyDataSourceCollection=w,this._dataSourceDisplay=U,this._clockViewModel=G,this._toolbar=J,this._homeButton=et,this._sceneModePicker=tt,this._baseLayerPicker=it,this._animation=ht,this._timeline=pt,this._fullscreenButton=ft,this._geocoder=K,this._eventHelper=H,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=r(Y)||r(q),this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._selectedEntity=void 0,this._clockTrackedDataSource=void 0,this._forceResize=!1,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,C.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),H.add(y.dataSourceAdded,Q.prototype._onDataSourceAdded,this),H.add(y.dataSourceRemoved,Q.prototype._onDataSourceRemoved,this),H.add(g.scene.preRender,Q.prototype.resize,this),H.add(g.scene.postRender,Q.prototype._postRender,this);for(var _t=y.length,yt=0;_t>yt;yt++)this._dataSourceAdded(y,y.get(yt));this._dataSourceAdded(void 0,U.defaultDataSource),H.add(y.dataSourceAdded,Q.prototype._dataSourceAdded,this),H.add(y.dataSourceRemoved,Q.prototype._dataSourceRemoved,this);var Ct=this;g.screenSpaceEventHandler.setInputAction(a,h.LEFT_CLICK),g.screenSpaceEventHandler.setInputAction(o,h.LEFT_DOUBLE_CLICK)};return o(Q.prototype,{container:{get:function(){return this._container}},bottomContainer:{get:function(){return this._bottomContainer}},cesiumWidget:{get:function(){return this._cesiumWidget}},selectionIndicator:{get:function(){return this._selectionIndicator}},infoBox:{get:function(){return this._infoBox}},geocoder:{get:function(){return this._geocoder}},homeButton:{get:function(){return this._homeButton}},sceneModePicker:{get:function(){return this._sceneModePicker}},baseLayerPicker:{get:function(){return this._baseLayerPicker}},animation:{get:function(){return this._animation}},timeline:{get:function(){return this._timeline}},fullscreenButton:{get:function(){return this._fullscreenButton}},dataSourceDisplay:{get:function(){return this._dataSourceDisplay}},entities:{get:function(){return this._dataSourceDisplay.defaultDataSource.entities}},dataSources:{get:function(){return this._dataSourceCollection}},canvas:{get:function(){return this._cesiumWidget.canvas}},cesiumLogo:{get:function(){return this._cesiumWidget.cesiumLogo}},scene:{get:function(){return this._cesiumWidget.scene}},imageryLayers:{get:function(){return this.scene.imageryLayers}},terrainProvider:{get:function(){return this.scene.terrainProvider},set:function(e){this.scene.terrainProvider=e}},camera:{get:function(){return this.scene.camera}},clock:{get:function(){return this._cesiumWidget.clock}},screenSpaceEventHandler:{get:function(){return this._cesiumWidget.screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._cesiumWidget.targetFrameRate},set:function(e){this._cesiumWidget.targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._cesiumWidget.useDefaultRenderLoop},set:function(e){this._cesiumWidget.useDefaultRenderLoop=e}},resolutionScale:{get:function(){return this._cesiumWidget.resolutionScale},set:function(e){this._cesiumWidget.resolutionScale=e,this._forceResize=!0}},allowDataSourcesToSuspendAnimation:{get:function(){return this._allowDataSourcesToSuspendAnimation},set:function(e){this._allowDataSourcesToSuspendAnimation=e}},trackedEntity:{get:function(){return this._trackedEntity},set:function(e){if(this._trackedEntity!==e){this._trackedEntity=e,j(this);var t=this.scene,i=t.mode;if(!r(e)||!r(e.position))return this._needTrackedEntityUpdate=!1,(i===y.COLUMBUS_VIEW||i===y.SCENE2D)&&(t.screenSpaceCameraController.enableTranslate=!0),(i===y.COLUMBUS_VIEW||i===y.SCENE3D)&&(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(c.IDENTITY),void 0;this._needTrackedEntityUpdate=!0}}},selectedEntity:{get:function(){return this._selectedEntity},set:function(e){if(this._selectedEntity!==e){this._selectedEntity=e;var t=r(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;r(e)?r(t)&&t.animateAppear():r(t)&&t.animateDepart()}}},clockTrackedDataSource:{get:function(){return this._clockTrackedDataSource},set:function(e){this._clockTrackedDataSource!==e&&(this._clockTrackedDataSource=e,U(this._timeline,this.clock,e))}}}),Q.prototype.extend=function(e,t){e(this,t)},Q.prototype.resize=function(){var e=this._cesiumWidget,t=this._container,i=t.clientWidth,n=t.clientHeight,o=r(this._animation),a=r(this._timeline);if(this._forceResize||i!==this._lastWidth||n!==this._lastHeight){e.resize(),this._forceResize=!1;var s=n-125,l=this._baseLayerPickerDropDown;r(l)&&(l.style.maxHeight=s+"px"),r(this._infoBox)&&(this._infoBox.viewModel.maxHeight=s);var u,c=this._timeline,h=0,d=0,p=0;if(o&&"hidden"!==window.getComputedStyle(this._animation.container).visibility){var m=this._lastWidth;u=this._animation.container,i>900?(h=169,900>=m&&(u.style.width="169px",u.style.height="112px",this._animation.resize())):i>=600?(h=136,(600>m||m>900)&&(u.style.width="136px",u.style.height="90px",this._animation.resize())):(h=106,(m>600||0===m)&&(u.style.width="106px",u.style.height="70px",this._animation.resize())),d=h+5}if(a&&"hidden"!==window.getComputedStyle(this._timeline.container).visibility){var f=this._fullscreenButton,v=c.container,g=v.style;p=v.clientHeight+3,g.left=h+"px",r(f)&&(g.right=f.container.clientWidth+"px"),c.resize()}this._bottomContainer.style.left=d+"px",this._bottomContainer.style.bottom=p+"px",this._lastWidth=i,this._lastHeight=n}},Q.prototype.forceResize=function(){this._lastWidth=0,this.resize()},Q.prototype.render=function(){this._cesiumWidget.render()},Q.prototype.isDestroyed=function(){return!1},Q.prototype.destroy=function(){var e;this.screenSpaceEventHandler.removeInputAction(h.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(h.LEFT_DOUBLE_CLICK);var t=this.dataSources,i=t.length;for(e=0;i>e;e++)this._dataSourceRemoved(t,t.get(e));return this._dataSourceRemoved(void 0,this._dataSourceDisplay.defaultDataSource),this._container.removeChild(this._element),this._element.removeChild(this._toolbar),this._eventHelper.removeAll(),r(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),r(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),r(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),r(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),r(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),r(this._timeline)&&(this._timeline.removeEventListener("settime",k,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),r(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),r(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),r(this._selectionIndicator)&&(this._element.removeChild(this._selectionIndicator.container),this._selectionIndicator=this._selectionIndicator.destroy()),this._clockViewModel=this._clockViewModel.destroy(),this._dataSourceDisplay=this._dataSourceDisplay.destroy(),this._cesiumWidget=this._cesiumWidget.destroy(),this._destroyDataSourceCollection&&(this._dataSourceCollection=this._dataSourceCollection.destroy()),a(this)},Q.prototype._dataSourceAdded=function(e,t){var i=t.entities;i.collectionChanged.addEventListener(Q.prototype._onEntityCollectionChanged,this)},Q.prototype._dataSourceRemoved=function(e,t){var i=t.entities;i.collectionChanged.removeEventListener(Q.prototype._onEntityCollectionChanged,this),r(this.trackedEntity)&&i.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),r(this.selectedEntity)&&i.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)},Q.prototype._onTick=function(e){var n=e.currentTime,o=this._dataSourceDisplay.update(n);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=o);var a=this._entityView;r(a)&&a.update(n);var s,l=!1,u=this.selectedEntity,c=r(u)&&this._enableInfoOrSelection;if(c&&u.isShowing&&u.isAvailable(n)){var h=this._dataSourceDisplay.getBoundingSphere(u,!0,Z);h!==d.FAILED?s=Z.center:r(u.position)&&(s=u.position.getValue(n,s)),l=r(s)}var p=r(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;r(p)&&(p.position=t.clone(s,p.position),p.showSelection=c&&l,p.update());var m=r(this._infoBox)?this._infoBox.viewModel:void 0;r(m)&&(m.showInfo=c,m.enableCamera=l,m.isCameraTracking=this.trackedEntity===this.selectedEntity,c?(m.titleText=i(u.name,u.id),m.description=_.getValueOrDefault(u.description,n,"")):(m.titleText="",m.description=""))},Q.prototype._onEntityCollectionChanged=function(e,t,i){for(var r=i.length,n=0;r>n;n++){var o=i[n];this.trackedEntity===o&&(this.trackedEntity=void 0),this.selectedEntity===o&&(this.selectedEntity=void 0)}},Q.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{var t=this.selectedEntity,i=t.position;r(i)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}},Q.prototype._clearTrackedObject=function(){this.trackedEntity=void 0},Q.prototype._onInfoBoxClockClicked=function(){this.selectedEntity=void 0},Q.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0},Q.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&U(this.timeline,this.clock,e)},Q.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);var i=t.entities.id,r=this._eventHelper.add(t.changedEvent,Q.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[i]=r},Q.prototype._onDataSourceRemoved=function(e,t){var i=this.clockTrackedDataSource===t,r=t.entities.id;if(this._dataSourceChangedListeners[r](),this._dataSourceChangedListeners[r]=void 0,i){var n=e.length;this.clockTrackedDataSource=this._automaticallyTrackDataSourceClocks&&n>0?e.get(n-1):void 0}},Q.prototype.zoomTo=function(e,t){return H(this,e,t,!1)},Q.prototype.flyTo=function(e,t){return H(this,e,t,!0)},Q.prototype._postRender=function(){Y(this),X(this)},Q}),i("Widgets/Viewer/viewerCesiumInspectorMixin",["../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../CesiumInspector/CesiumInspector"],function(e,t,i,r){"use strict";var n=function(n){if(!e(n))throw new i("viewer is required.");var o=document.createElement("div");o.className="cesium-viewer-cesiumInspectorContainer",n.container.appendChild(o);var a=new r(o,n.scene);t(n,{cesiumInspector:{get:function(){return a}}}),n.scene.postRender.addEventListener(function(){n.cesiumInspector.viewModel.update()})};return n}),i("Widgets/Viewer/viewerDragDropMixin",["../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../../Core/Event","../../Core/wrapFunction","../../DataSources/CzmlDataSource","../../DataSources/GeoJsonDataSource","../../DataSources/KmlDataSource","../getElement"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e){e.stopPropagation(),e.preventDefault()}function h(e,i){var r=e;t(r)&&(r.removeEventListener("drop",i,!1),r.removeEventListener("dragenter",c,!1),r.removeEventListener("dragover",c,!1),r.removeEventListener("dragexit",c,!1))}function d(e,t){e.addEventListener("drop",t,!1),e.addEventListener("dragenter",c,!1),e.addEventListener("dragover",c,!1),e.addEventListener("dragexit",c,!1)}function p(e,i,r){return function(n){var o=i.name;try{var u;if(/\.czml$/i.test(o))u=a.load(JSON.parse(n.target.result),{sourceUri:o});else if(/\.geojson$/i.test(o)||/\.json$/i.test(o)||/\.topojson$/i.test(o))u=s.load(JSON.parse(n.target.result),{sourceUri:o});else{if(!/\.(kml|kmz)$/i.test(o))return e.dropError.raiseEvent(e,o,"Unrecognized file: "+o),void 0;u=l.load(i,{sourceUri:o,proxy:r})}t(u)&&e.dataSources.add(u).then(function(t){e.flyToOnDrop&&e.flyTo(t)}).otherwise(function(t){e.dropError.raiseEvent(e,o,t)})}catch(c){e.dropError.raiseEvent(e,o,c)}}}function m(e,t){return function(i){e.dropError.raiseEvent(e,t.name,i.target.error)}}var f=function(t,r){function a(e){c(e),v&&(t.entities.removeAll(),t.dataSources.removeAll());for(var i=e.dataTransfer.files,r=i.length,n=0;r>n;n++){var o=i[n],a=new FileReader;a.onload=p(t,o,_),a.onerror=m(t,o),a.readAsText(o)}}r=e(r,e.EMPTY_OBJECT);var s=!0,l=!0,f=new n,v=e(r.clearOnDrop,!0),g=e(r.dropTarget,t.container),_=r.proxy;g=u(g),i(t,{dropTarget:{get:function(){return g},set:function(e){h(g,a),g=e,d(g,a)}},dropEnabled:{get:function(){return s},set:function(e){e!==s&&(e?d(g,a):h(g,a),s=e)}},dropError:{get:function(){return f}},clearOnDrop:{get:function(){return v},set:function(e){v=e}},flyToOnDrop:{get:function(){return l},set:function(e){l=e}},proxy:{get:function(){return _},set:function(e){_=e}}}),d(g,a),t.destroy=o(t,t.destroy,function(){t.dropEnabled=!1}),t._handleDrop=a};return f}),i("Widgets/Viewer/viewerPerformanceWatchdogMixin",["../../Core/defaultValue","../../Core/defined","../../Core/defineProperties","../../Core/DeveloperError","../PerformanceWatchdog/PerformanceWatchdog"],function(e,t,i,r,n){"use strict";var o=function(o,a){if(!t(o))throw new r("viewer is required.");a=e(a,e.EMPTY_OBJECT);var s=new n({scene:o.scene,container:o.bottomContainer,lowFrameRateMessage:a.lowFrameRateMessage});i(o,{performanceWatchdog:{get:function(){return s}}})};return o}),i("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,t,i){"use strict";var r=function(r){var n,o=[],a={id:void 0,result:void 0,error:void 0};return function(s){var l=s.data;o.length=0,a.id=l.id,a.error=void 0,a.result=void 0;try{a.result=r(l.parameters,o)}catch(u){a.error=u instanceof Error?{name:u.name,message:u.message,stack:u.stack}:u}t(n)||(n=e(self.webkitPostMessage,self.postMessage)),l.canTransferArrayBuffer||(o.length=0);try{n(a,o)}catch(u){a.result=void 0,a.error="postMessage failed with error: "+i(u)+"\n with responseMessage: "+JSON.stringify(a),n(a)}}};return r}),i("Cesium",["./Core/ArcGisImageServerTerrainProvider","./Core/AssociativeArray","./Core/AttributeCompression","./Core/AxisAlignedBoundingBox","./Core/BingMapsApi","./Core/BoundingRectangle","./Core/BoundingSphere","./Core/BoxGeometry","./Core/BoxOutlineGeometry","./Core/Cartesian2","./Core/Cartesian3","./Core/Cartesian4","./Core/Cartographic","./Core/CatmullRomSpline","./Core/CesiumTerrainProvider","./Core/CircleGeometry","./Core/CircleOutlineGeometry","./Core/Clock","./Core/ClockRange","./Core/ClockStep","./Core/Color","./Core/ColorGeometryInstanceAttribute","./Core/ComponentDatatype","./Core/CornerType","./Core/CorridorGeometry","./Core/CorridorGeometryLibrary","./Core/CorridorOutlineGeometry","./Core/Credit","./Core/CubicRealPolynomial","./Core/CylinderGeometry","./Core/CylinderGeometryLibrary","./Core/CylinderOutlineGeometry","./Core/DefaultProxy","./Core/DeveloperError","./Core/EarthOrientationParameters","./Core/EarthOrientationParametersSample","./Core/EasingFunction","./Core/EllipseGeometry","./Core/EllipseGeometryLibrary","./Core/EllipseOutlineGeometry","./Core/Ellipsoid","./Core/EllipsoidGeodesic","./Core/EllipsoidGeometry","./Core/EllipsoidOutlineGeometry","./Core/EllipsoidTangentPlane","./Core/EllipsoidTerrainProvider","./Core/EllipsoidalOccluder","./Core/EncodedCartesian3","./Core/Event","./Core/EventHelper","./Core/ExtrapolationType","./Core/FeatureDetection","./Core/Fullscreen","./Core/GeographicProjection","./Core/GeographicTilingScheme","./Core/Geometry","./Core/GeometryAttribute","./Core/GeometryAttributes","./Core/GeometryInstance","./Core/GeometryInstanceAttribute","./Core/GeometryPipeline","./Core/GeometryType","./Core/GregorianDate","./Core/HeightmapTerrainData","./Core/HeightmapTessellator","./Core/HermitePolynomialApproximation","./Core/HermiteSpline","./Core/Iau2000Orientation","./Core/Iau2006XysData","./Core/Iau2006XysSample","./Core/IauOrientationAxes","./Core/IauOrientationParameters","./Core/IndexDatatype","./Core/InterpolationAlgorithm","./Core/Intersect","./Core/IntersectionTests","./Core/Intersections2D","./Core/Interval","./Core/Iso8601","./Core/JulianDate","./Core/KeyboardEventModifier","./Core/LagrangePolynomialApproximation","./Core/LeapSecond","./Core/LinearApproximation","./Core/LinearSpline","./Core/MapProjection","./Core/Math","./Core/Matrix2","./Core/Matrix3","./Core/Matrix4","./Core/NearFarScalar","./Core/ObjectOrientedBoundingBox","./Core/Occluder","./Core/OrientedBoundingBox","./Core/Packable","./Core/PackableForInterpolation","./Core/PinBuilder","./Core/PixelFormat","./Core/Plane","./Core/PolygonGeometry","./Core/PolygonGeometryLibrary","./Core/PolygonHierarchy","./Core/PolygonOutlineGeometry","./Core/PolygonPipeline","./Core/PolylineGeometry","./Core/PolylinePipeline","./Core/PolylineVolumeGeometry","./Core/PolylineVolumeGeometryLibrary","./Core/PolylineVolumeOutlineGeometry","./Core/PrimitiveType","./Core/QuadraticRealPolynomial","./Core/QuantizedMeshTerrainData","./Core/QuarticRealPolynomial","./Core/Quaternion","./Core/QuaternionSpline","./Core/Queue","./Core/Ray","./Core/Rectangle","./Core/RectangleGeometry","./Core/RectangleGeometryLibrary","./Core/RectangleOutlineGeometry","./Core/ReferenceFrame","./Core/RequestErrorEvent","./Core/RuntimeError","./Core/ScreenSpaceEventHandler","./Core/ScreenSpaceEventType","./Core/ShowGeometryInstanceAttribute","./Core/Simon1994PlanetaryPositions","./Core/SimplePolylineGeometry","./Core/SphereGeometry","./Core/SphereOutlineGeometry","./Core/Spherical","./Core/Spline","./Core/TaskProcessor","./Core/TerrainData","./Core/TerrainMesh","./Core/TerrainProvider","./Core/TileProviderError","./Core/TilingScheme","./Core/TimeConstants","./Core/TimeInterval","./Core/TimeIntervalCollection","./Core/TimeStandard","./Core/Tipsify","./Core/Transforms","./Core/TridiagonalSystemSolver","./Core/VRTheWorldTerrainProvider","./Core/VertexFormat","./Core/Visibility","./Core/WallGeometry","./Core/WallGeometryLibrary","./Core/WallOutlineGeometry","./Core/WebMercatorProjection","./Core/WebMercatorTilingScheme","./Core/WindingOrder","./Core/appendForwardSlash","./Core/barycentricCoordinates","./Core/binarySearch","./Core/buildModuleUrl","./Core/cancelAnimationFrame","./Core/clone","./Core/combine","./Core/createGuid","./Core/defaultValue","./Core/defineProperties","./Core/defined","./Core/definedNotNull","./Core/deprecationWarning","./Core/destroyObject","./Core/formatError","./Core/freezeObject","./Core/getFilenameFromUri","./Core/getImagePixels","./Core/getStringFromTypedArray","./Core/getTimestamp","./Core/isArray","./Core/isCrossOriginUrl","./Core/isLeapYear","./Core/jsonp","./Core/loadArrayBuffer","./Core/loadBlob","./Core/loadImage","./Core/loadImageFromTypedArray","./Core/loadImageViaBlob","./Core/loadJson","./Core/loadText","./Core/loadWithXhr","./Core/loadXML","./Core/mergeSort","./Core/objectToQuery","./Core/parseResponseHeaders","./Core/pointInsideTriangle","./Core/queryToObject","./Core/requestAnimationFrame","./Core/sampleTerrain","./Core/subdivideArray","./Core/throttleRequestByServer","./Core/wrapFunction","./Core/writeTextToCanvas","./DataSources/BillboardGraphics","./DataSources/BillboardVisualizer","./DataSources/BoundingSphereState","./DataSources/BoxGeometryUpdater","./DataSources/BoxGraphics","./DataSources/CallbackProperty","./DataSources/CheckerboardMaterialProperty","./DataSources/ColorMaterialProperty","./DataSources/CompositeEntityCollection","./DataSources/CompositeMaterialProperty","./DataSources/CompositePositionProperty","./DataSources/CompositeProperty","./DataSources/ConstantPositionProperty","./DataSources/ConstantProperty","./DataSources/CorridorGeometryUpdater","./DataSources/CorridorGraphics","./DataSources/CustomDataSource","./DataSources/CylinderGeometryUpdater","./DataSources/CylinderGraphics","./DataSources/CzmlDataSource","./DataSources/DataSource","./DataSources/DataSourceClock","./DataSources/DataSourceCollection","./DataSources/DataSourceDisplay","./DataSources/DynamicGeometryUpdater","./DataSources/EllipseGeometryUpdater","./DataSources/EllipseGraphics","./DataSources/EllipsoidGeometryUpdater","./DataSources/EllipsoidGraphics","./DataSources/Entity","./DataSources/EntityCollection","./DataSources/EntityView","./DataSources/GeoJsonDataSource","./DataSources/GeometryUpdater","./DataSources/GeometryVisualizer","./DataSources/GridMaterialProperty","./DataSources/ImageMaterialProperty","./DataSources/KmlDataSource","./DataSources/LabelGraphics","./DataSources/LabelVisualizer","./DataSources/MaterialProperty","./DataSources/ModelGraphics","./DataSources/ModelVisualizer","./DataSources/PathGraphics","./DataSources/PathVisualizer","./DataSources/PointGraphics","./DataSources/PointVisualizer","./DataSources/PolygonGeometryUpdater","./DataSources/PolygonGraphics","./DataSources/PolylineArrowMaterialProperty","./DataSources/PolylineGeometryUpdater","./DataSources/PolylineGlowMaterialProperty","./DataSources/PolylineGraphics","./DataSources/PolylineOutlineMaterialProperty","./DataSources/PolylineVolumeGeometryUpdater","./DataSources/PolylineVolumeGraphics","./DataSources/PositionProperty","./DataSources/PositionPropertyArray","./DataSources/Property","./DataSources/PropertyArray","./DataSources/RectangleGeometryUpdater","./DataSources/RectangleGraphics","./DataSources/ReferenceProperty","./DataSources/Rotation","./DataSources/SampledPositionProperty","./DataSources/SampledProperty","./DataSources/ScaledPositionProperty","./DataSources/StaticGeometryColorBatch","./DataSources/StaticGeometryPerMaterialBatch","./DataSources/StaticOutlineGeometryBatch","./DataSources/StripeMaterialProperty","./DataSources/StripeOrientation","./DataSources/TimeIntervalCollectionPositionProperty","./DataSources/TimeIntervalCollectionProperty","./DataSources/VelocityOrientationProperty","./DataSources/Visualizer","./DataSources/WallGeometryUpdater","./DataSources/WallGraphics","./DataSources/createMaterialPropertyDescriptor","./DataSources/createPropertyDescriptor","./DataSources/createRawPropertyDescriptor","./DataSources/dynamicGeometryGetBoundingSphere","./Renderer/AutomaticUniforms","./Renderer/Buffer","./Renderer/BufferUsage","./Renderer/ClearCommand","./Renderer/Context","./Renderer/CubeMap","./Renderer/CubeMapFace","./Renderer/DrawCommand","./Renderer/Framebuffer","./Renderer/MipmapHint","./Renderer/PassState","./Renderer/PickFramebuffer","./Renderer/PixelDatatype","./Renderer/RenderState","./Renderer/Renderbuffer","./Renderer/RenderbufferFormat","./Renderer/ShaderCache","./Renderer/ShaderProgram","./Renderer/ShaderSource","./Renderer/Texture","./Renderer/TextureMagnificationFilter","./Renderer/TextureMinificationFilter","./Renderer/TextureWrap","./Renderer/UniformState","./Renderer/VertexArray","./Renderer/VertexArrayFacade","./Renderer/createUniform","./Renderer/createUniformArray","./Renderer/loadCubeMap","./Scene/Appearance","./Scene/ArcGisMapServerImageryProvider","./Scene/Billboard","./Scene/BillboardCollection","./Scene/BingMapsImageryProvider","./Scene/BingMapsStyle","./Scene/BlendEquation","./Scene/BlendFunction","./Scene/BlendingState","./Scene/Camera","./Scene/CameraEventAggregator","./Scene/CameraEventType","./Scene/CameraFlightPath","./Scene/CreditDisplay","./Scene/CullFace","./Scene/CullingVolume","./Scene/DebugAppearance","./Scene/DebugModelMatrixPrimitive","./Scene/DepthFunction","./Scene/DiscardMissingTileImagePolicy","./Scene/EllipsoidPrimitive","./Scene/EllipsoidSurfaceAppearance","./Scene/FXAA","./Scene/FrameRateMonitor","./Scene/FrameState","./Scene/FrustumCommands","./Scene/GetFeatureInfoFormat","./Scene/Globe","./Scene/GlobeDepth","./Scene/GlobeSurfaceShaderSet","./Scene/GlobeSurfaceTile","./Scene/GlobeSurfaceTileProvider","./Scene/GoogleEarthImageryProvider","./Scene/GridImageryProvider","./Scene/HeadingPitchRange","./Scene/HeightReference","./Scene/HorizontalOrigin","./Scene/Imagery","./Scene/ImageryLayer","./Scene/ImageryLayerCollection","./Scene/ImageryLayerFeatureInfo","./Scene/ImageryProvider","./Scene/ImageryState","./Scene/Label","./Scene/LabelCollection","./Scene/LabelStyle","./Scene/Material","./Scene/MaterialAppearance","./Scene/Model","./Scene/ModelAnimation","./Scene/ModelAnimationCache","./Scene/ModelAnimationCollection","./Scene/ModelAnimationLoop","./Scene/ModelAnimationState","./Scene/ModelMaterial","./Scene/ModelMesh","./Scene/ModelNode","./Scene/Moon","./Scene/NeverTileDiscardPolicy","./Scene/OIT","./Scene/OpenStreetMapImageryProvider","./Scene/OrthographicFrustum","./Scene/Pass","./Scene/PerInstanceColorAppearance","./Scene/PerformanceDisplay","./Scene/PerspectiveFrustum","./Scene/PerspectiveOffCenterFrustum","./Scene/PickDepth","./Scene/PointPrimitive","./Scene/PointPrimitiveCollection","./Scene/Polygon","./Scene/Polyline","./Scene/PolylineCollection","./Scene/PolylineColorAppearance","./Scene/PolylineMaterialAppearance","./Scene/Primitive","./Scene/PrimitiveCollection","./Scene/PrimitivePipeline","./Scene/PrimitiveState","./Scene/QuadtreeOccluders","./Scene/QuadtreePrimitive","./Scene/QuadtreeTile","./Scene/QuadtreeTileLoadState","./Scene/QuadtreeTileProvider","./Scene/RectanglePrimitive","./Scene/Scene","./Scene/SceneMode","./Scene/SceneTransforms","./Scene/SceneTransitioner","./Scene/ScreenSpaceCameraController","./Scene/SingleTileImageryProvider","./Scene/SkyAtmosphere","./Scene/SkyBox","./Scene/StencilFunction","./Scene/StencilOperation","./Scene/Sun","./Scene/SunPostProcess","./Scene/TerrainState","./Scene/TextureAtlas","./Scene/TileCoordinatesImageryProvider","./Scene/TileDiscardPolicy","./Scene/TileImagery","./Scene/TileMapServiceImageryProvider","./Scene/TileReplacementQueue","./Scene/TileState","./Scene/TileTerrain","./Scene/TweenCollection","./Scene/UrlTemplateImageryProvider","./Scene/VerticalOrigin","./Scene/ViewportQuad","./Scene/WebMapServiceImageryProvider","./Scene/WebMapTileServiceImageryProvider","./Scene/createTangentSpaceDebugPrimitive","./Scene/getModelAccessor","./Scene/terrainAttributeLocations","./Shaders/AdjustTranslucentFS","./Shaders/Appearances/AllMaterialAppearanceFS","./Shaders/Appearances/AllMaterialAppearanceVS","./Shaders/Appearances/BasicMaterialAppearanceFS","./Shaders/Appearances/BasicMaterialAppearanceVS","./Shaders/Appearances/EllipsoidSurfaceAppearanceFS","./Shaders/Appearances/EllipsoidSurfaceAppearanceVS","./Shaders/Appearances/PerInstanceColorAppearanceFS","./Shaders/Appearances/PerInstanceColorAppearanceVS","./Shaders/Appearances/PerInstanceFlatColorAppearanceFS","./Shaders/Appearances/PerInstanceFlatColorAppearanceVS","./Shaders/Appearances/PolylineColorAppearanceVS","./Shaders/Appearances/PolylineMaterialAppearanceVS","./Shaders/Appearances/TexturedMaterialAppearanceFS","./Shaders/Appearances/TexturedMaterialAppearanceVS","./Shaders/BillboardCollectionFS","./Shaders/BillboardCollectionVS","./Shaders/Builtin/Constants/degreesPerRadian","./Shaders/Builtin/Constants/depthRange","./Shaders/Builtin/Constants/epsilon1","./Shaders/Builtin/Constants/epsilon2","./Shaders/Builtin/Constants/epsilon3","./Shaders/Builtin/Constants/epsilon4","./Shaders/Builtin/Constants/epsilon5","./Shaders/Builtin/Constants/epsilon6","./Shaders/Builtin/Constants/epsilon7","./Shaders/Builtin/Constants/infinity","./Shaders/Builtin/Constants/oneOverPi","./Shaders/Builtin/Constants/oneOverTwoPi","./Shaders/Builtin/Constants/pi","./Shaders/Builtin/Constants/piOverFour","./Shaders/Builtin/Constants/piOverSix","./Shaders/Builtin/Constants/piOverThree","./Shaders/Builtin/Constants/piOverTwo","./Shaders/Builtin/Constants/radiansPerDegree","./Shaders/Builtin/Constants/sceneMode2D","./Shaders/Builtin/Constants/sceneMode3D","./Shaders/Builtin/Constants/sceneModeColumbusView","./Shaders/Builtin/Constants/sceneModeMorphing","./Shaders/Builtin/Constants/solarRadius","./Shaders/Builtin/Constants/threePiOver2","./Shaders/Builtin/Constants/twoPi","./Shaders/Builtin/Constants/webMercatorMaxLatitude","./Shaders/Builtin/CzmBuiltins","./Shaders/Builtin/Functions/RGBToXYZ","./Shaders/Builtin/Functions/XYZToRGB","./Shaders/Builtin/Functions/alphaWeight","./Shaders/Builtin/Functions/antialias","./Shaders/Builtin/Functions/columbusViewMorph","./Shaders/Builtin/Functions/computePosition","./Shaders/Builtin/Functions/cosineAndSine","./Shaders/Builtin/Functions/decompressTextureCoordinates","./Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates","./Shaders/Builtin/Functions/ellipsoidContainsPoint","./Shaders/Builtin/Functions/ellipsoidNew","./Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates","./Shaders/Builtin/Functions/equalsEpsilon","./Shaders/Builtin/Functions/eyeOffset","./Shaders/Builtin/Functions/eyeToWindowCoordinates","./Shaders/Builtin/Functions/geodeticSurfaceNormal","./Shaders/Builtin/Functions/getDefaultMaterial","./Shaders/Builtin/Functions/getLambertDiffuse","./Shaders/Builtin/Functions/getSpecular","./Shaders/Builtin/Functions/getWaterNoise","./Shaders/Builtin/Functions/getWgs84EllipsoidEC","./Shaders/Builtin/Functions/hue","./Shaders/Builtin/Functions/isEmpty","./Shaders/Builtin/Functions/isFull","./Shaders/Builtin/Functions/latitudeToWebMercatorFraction","./Shaders/Builtin/Functions/luminance","./Shaders/Builtin/Functions/modelToWindowCoordinates","./Shaders/Builtin/Functions/multiplyWithColorBalance","./Shaders/Builtin/Functions/nearFarScalar","./Shaders/Builtin/Functions/octDecode","./Shaders/Builtin/Functions/packDepth","./Shaders/Builtin/Functions/phong","./Shaders/Builtin/Functions/pointAlongRay","./Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval","./Shaders/Builtin/Functions/saturation","./Shaders/Builtin/Functions/signNotZero","./Shaders/Builtin/Functions/tangentToEyeSpaceMatrix","./Shaders/Builtin/Functions/translateRelativeToEye","./Shaders/Builtin/Functions/translucentPhong","./Shaders/Builtin/Functions/transpose","./Shaders/Builtin/Functions/unpackDepth","./Shaders/Builtin/Functions/windowToEyeCoordinates","./Shaders/Builtin/Structs/depthRangeStruct","./Shaders/Builtin/Structs/ellipsoid","./Shaders/Builtin/Structs/material","./Shaders/Builtin/Structs/materialInput","./Shaders/Builtin/Structs/ray","./Shaders/Builtin/Structs/raySegment","./Shaders/CompositeOITFS","./Shaders/EllipsoidFS","./Shaders/EllipsoidVS","./Shaders/GlobeFS","./Shaders/GlobeFSDepth","./Shaders/GlobeFSPole","./Shaders/GlobeVS","./Shaders/GlobeVSDepth","./Shaders/GlobeVSPole","./Shaders/Materials/BumpMapMaterial","./Shaders/Materials/CheckerboardMaterial","./Shaders/Materials/DotMaterial","./Shaders/Materials/FadeMaterial","./Shaders/Materials/GridMaterial","./Shaders/Materials/NormalMapMaterial","./Shaders/Materials/PolylineArrowMaterial","./Shaders/Materials/PolylineGlowMaterial","./Shaders/Materials/PolylineOutlineMaterial","./Shaders/Materials/RimLightingMaterial","./Shaders/Materials/StripeMaterial","./Shaders/Materials/Water","./Shaders/PointPrimitiveCollectionFS","./Shaders/PointPrimitiveCollectionVS","./Shaders/PolylineCommon","./Shaders/PolylineFS","./Shaders/PolylineVS","./Shaders/PostProcessFilters/AdditiveBlend","./Shaders/PostProcessFilters/BrightPass","./Shaders/PostProcessFilters/FXAA","./Shaders/PostProcessFilters/GaussianBlur1D","./Shaders/PostProcessFilters/PassThrough","./Shaders/ReprojectWebMercatorFS","./Shaders/ReprojectWebMercatorVS","./Shaders/SkyAtmosphereFS","./Shaders/SkyAtmosphereVS","./Shaders/SkyBoxFS","./Shaders/SkyBoxVS","./Shaders/SunFS","./Shaders/SunTextureFS","./Shaders/SunVS","./Shaders/ViewportQuadFS","./Shaders/ViewportQuadVS","./ThirdParty/Autolinker","./ThirdParty/Tween","./ThirdParty/Uri","./ThirdParty/gltfDefaults","./ThirdParty/knockout-3.2.0","./ThirdParty/knockout-es5","./ThirdParty/knockout","./ThirdParty/measureText","./ThirdParty/mersenne-twister","./ThirdParty/sprintf","./ThirdParty/topojson","./ThirdParty/when","./ThirdParty/zip","./Widgets/Animation/Animation","./Widgets/Animation/AnimationViewModel","./Widgets/BaseLayerPicker/BaseLayerPicker","./Widgets/BaseLayerPicker/BaseLayerPickerViewModel","./Widgets/BaseLayerPicker/ProviderViewModel","./Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels","./Widgets/BaseLayerPicker/createDefaultTerrainProviderViewModels","./Widgets/CesiumInspector/CesiumInspector","./Widgets/CesiumInspector/CesiumInspectorViewModel","./Widgets/CesiumWidget/CesiumWidget","./Widgets/ClockViewModel","./Widgets/Command","./Widgets/FullscreenButton/FullscreenButton","./Widgets/FullscreenButton/FullscreenButtonViewModel","./Widgets/Geocoder/Geocoder","./Widgets/Geocoder/GeocoderViewModel","./Widgets/HomeButton/HomeButton","./Widgets/HomeButton/HomeButtonViewModel","./Widgets/InfoBox/InfoBox","./Widgets/InfoBox/InfoBoxViewModel","./Widgets/NavigationHelpButton/NavigationHelpButton","./Widgets/NavigationHelpButton/NavigationHelpButtonViewModel","./Widgets/PerformanceWatchdog/PerformanceWatchdog","./Widgets/PerformanceWatchdog/PerformanceWatchdogViewModel","./Widgets/SceneModePicker/SceneModePicker","./Widgets/SceneModePicker/SceneModePickerViewModel","./Widgets/SelectionIndicator/SelectionIndicator","./Widgets/SelectionIndicator/SelectionIndicatorViewModel","./Widgets/SvgPathBindingHandler","./Widgets/Timeline/Timeline","./Widgets/Timeline/TimelineHighlightRange","./Widgets/Timeline/TimelineTrack","./Widgets/ToggleButtonViewModel","./Widgets/Viewer/Viewer","./Widgets/Viewer/viewerCesiumInspectorMixin","./Widgets/Viewer/viewerDragDropMixin","./Widgets/Viewer/viewerPerformanceWatchdogMixin","./Widgets/createCommand","./Widgets/getElement","./Widgets/subscribeAndEvaluate","./Workers/createTaskProcessorWorker"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,w,S,E,b,x,T,P,A,D,M,I,O,R,L,N,F,B,z,k,V,U,W,G,H,q,j,Y,X,Z,J,Q,K,$,et,tt,it,rt,nt,ot,at,st,lt,ut,ct,ht,dt,pt,mt,ft,vt,gt,_t,yt,Ct,wt,St,Et,bt,xt,Tt,Pt,At,Dt,Mt,It,Ot,Rt,Lt,Nt,Ft,Bt,zt,kt,Vt,Ut,Wt,Gt,Ht,qt,jt,Yt,Xt,Zt,Jt,Qt,Kt,$t,ei,ti,ii,ri,ni,oi,ai,si,li,ui,ci,hi,di,pi,mi,fi,vi,gi,_i,yi,Ci,wi,Si,Ei,bi,xi,Ti,Pi,Ai,Di,Mi,Ii,Oi,Ri,Li,Ni,Fi,Bi,zi,ki,Vi,Ui,Wi,Gi,Hi,qi,ji,Yi,Xi,Zi,Ji,Qi,Ki,$i,er,tr,ir,rr,nr,or,ar,sr,lr,ur,cr,hr,dr,pr,mr,fr,vr,gr,_r,yr,Cr,wr,Sr,Er,br,xr,Tr,Pr,Ar,Dr,Mr,Ir,Or,Rr,Lr,Nr,Fr,Br,zr,kr,Vr,Ur,Wr,Gr,Hr,qr,jr,Yr,Xr,Zr,Jr,Qr,Kr,$r,en,tn,rn,nn,on,an,sn,ln,un,cn,hn,dn,pn,mn,fn,vn,gn,_n,yn,Cn,wn,Sn,En,bn,xn,Tn,Pn,An,Dn,Mn,In,On,Rn,Ln,Nn,Fn,Bn,zn,kn,Vn,Un,Wn,Gn,Hn,qn,jn,Yn,Xn,Zn,Jn,Qn,Kn,$n,eo,to,io,ro,no,oo,ao,so,lo,uo,co,ho,po,mo,fo,vo,go,_o,yo,Co,wo,So,Eo,bo,xo,To,Po,Ao,Do,Mo,Io,Oo,Ro,Lo,No,Fo,Bo,zo,ko,Vo,Uo,Wo,Go,Ho,qo,jo,Yo,Xo,Zo,Jo,Qo,Ko,$o,ea,ta,ia,ra,na,oa,aa,sa,la,ua,ca,ha,da,pa,ma,fa,va,ga,_a,ya,Ca,wa,Sa,Ea,ba,xa,Ta,Pa,Aa,Da,Ma,Ia,Oa,Ra,La,Na,Fa,Ba,za,ka,Va,Ua,Wa,Ga,Ha,qa,ja,Ya,Xa,Za,Ja,Qa,Ka,$a,es,ts,is,rs,ns,os,as,ss,ls,us,cs,hs,ds,ps,ms,fs,vs,gs,_s,ys,Cs,ws,Ss,Es,bs,xs,Ts,Ps,As,Ds,Ms,Is,Os,Rs,Ls,Ns,Fs,Bs,zs,ks,Vs,Us,Ws,Gs,Hs,qs,js,Ys,Xs,Zs,Js,Qs,Ks,$s,el,tl,il,rl,nl,ol,al,sl,ll,ul,cl,hl,dl,pl,ml,fl,vl,gl,_l,yl,Cl,wl,Sl,El,bl,xl,Tl,Pl,Al,Dl,Ml,Il,Ol,Rl,Ll,Nl,Fl,Bl,zl,kl,Vl,Ul,Wl,Gl,Hl,ql,jl,Yl,Xl,Zl,Jl,Ql,Kl,$l,eu,tu,iu,ru,nu,ou,au,su,lu,uu,cu,hu,du,pu,mu,fu,vu,gu,_u,yu,Cu,wu,Su,Eu,bu,xu,Tu,Pu,Au,Du,Mu,Iu,Ou,Ru,Lu,Nu,Fu,Bu,zu,ku,Vu,Uu,Wu,Gu,Hu,qu,ju,Yu,Xu,Zu,Ju,Qu,Ku,$u,ec,tc,ic,rc,nc,oc,ac,sc,lc,uc,cc,hc,dc,pc,mc,fc,vc,gc,_c,yc,Cc,wc,Sc,Ec,bc,xc,Tc,Pc,Ac,Dc,Mc,Ic,Oc,Rc,Lc,Nc,Fc,Bc,zc,kc,Vc,Uc,Wc,Gc,Hc,qc,jc,Yc,Xc,Zc,Jc,Qc,Kc,$c,eh,th,ih,rh,nh,oh,ah,sh,lh,uh,ch,hh,dh,ph,mh,fh,vh,gh,_h,yh,Ch){"use strict"; -var wh={VERSION:"1.11",_shaders:{}};return wh.ArcGisImageServerTerrainProvider=e,wh.AssociativeArray=t,wh.AttributeCompression=i,wh.AxisAlignedBoundingBox=r,wh.BingMapsApi=n,wh.BoundingRectangle=o,wh.BoundingSphere=a,wh.BoxGeometry=s,wh.BoxOutlineGeometry=l,wh.Cartesian2=u,wh.Cartesian3=c,wh.Cartesian4=h,wh.Cartographic=d,wh.CatmullRomSpline=p,wh.CesiumTerrainProvider=m,wh.CircleGeometry=f,wh.CircleOutlineGeometry=v,wh.Clock=g,wh.ClockRange=_,wh.ClockStep=y,wh.Color=C,wh.ColorGeometryInstanceAttribute=w,wh.ComponentDatatype=S,wh.CornerType=E,wh.CorridorGeometry=b,wh.CorridorGeometryLibrary=x,wh.CorridorOutlineGeometry=T,wh.Credit=P,wh.CubicRealPolynomial=A,wh.CylinderGeometry=D,wh.CylinderGeometryLibrary=M,wh.CylinderOutlineGeometry=I,wh.DefaultProxy=O,wh.DeveloperError=R,wh.EarthOrientationParameters=L,wh.EarthOrientationParametersSample=N,wh.EasingFunction=F,wh.EllipseGeometry=B,wh.EllipseGeometryLibrary=z,wh.EllipseOutlineGeometry=k,wh.Ellipsoid=V,wh.EllipsoidGeodesic=U,wh.EllipsoidGeometry=W,wh.EllipsoidOutlineGeometry=G,wh.EllipsoidTangentPlane=H,wh.EllipsoidTerrainProvider=q,wh.EllipsoidalOccluder=j,wh.EncodedCartesian3=Y,wh.Event=X,wh.EventHelper=Z,wh.ExtrapolationType=J,wh.FeatureDetection=Q,wh.Fullscreen=K,wh.GeographicProjection=$,wh.GeographicTilingScheme=et,wh.Geometry=tt,wh.GeometryAttribute=it,wh.GeometryAttributes=rt,wh.GeometryInstance=nt,wh.GeometryInstanceAttribute=ot,wh.GeometryPipeline=at,wh.GeometryType=st,wh.GregorianDate=lt,wh.HeightmapTerrainData=ut,wh.HeightmapTessellator=ct,wh.HermitePolynomialApproximation=ht,wh.HermiteSpline=dt,wh.Iau2000Orientation=pt,wh.Iau2006XysData=mt,wh.Iau2006XysSample=ft,wh.IauOrientationAxes=vt,wh.IauOrientationParameters=gt,wh.IndexDatatype=_t,wh.InterpolationAlgorithm=yt,wh.Intersect=Ct,wh.IntersectionTests=wt,wh.Intersections2D=St,wh.Interval=Et,wh.Iso8601=bt,wh.JulianDate=xt,wh.KeyboardEventModifier=Tt,wh.LagrangePolynomialApproximation=Pt,wh.LeapSecond=At,wh.LinearApproximation=Dt,wh.LinearSpline=Mt,wh.MapProjection=It,wh.Math=Ot,wh.Matrix2=Rt,wh.Matrix3=Lt,wh.Matrix4=Nt,wh.NearFarScalar=Ft,wh.ObjectOrientedBoundingBox=Bt,wh.Occluder=zt,wh.OrientedBoundingBox=kt,wh.Packable=Vt,wh.PackableForInterpolation=Ut,wh.PinBuilder=Wt,wh.PixelFormat=Gt,wh.Plane=Ht,wh.PolygonGeometry=qt,wh.PolygonGeometryLibrary=jt,wh.PolygonHierarchy=Yt,wh.PolygonOutlineGeometry=Xt,wh.PolygonPipeline=Zt,wh.PolylineGeometry=Jt,wh.PolylinePipeline=Qt,wh.PolylineVolumeGeometry=Kt,wh.PolylineVolumeGeometryLibrary=$t,wh.PolylineVolumeOutlineGeometry=ei,wh.PrimitiveType=ti,wh.QuadraticRealPolynomial=ii,wh.QuantizedMeshTerrainData=ri,wh.QuarticRealPolynomial=ni,wh.Quaternion=oi,wh.QuaternionSpline=ai,wh.Queue=si,wh.Ray=li,wh.Rectangle=ui,wh.RectangleGeometry=ci,wh.RectangleGeometryLibrary=hi,wh.RectangleOutlineGeometry=di,wh.ReferenceFrame=pi,wh.RequestErrorEvent=mi,wh.RuntimeError=fi,wh.ScreenSpaceEventHandler=vi,wh.ScreenSpaceEventType=gi,wh.ShowGeometryInstanceAttribute=_i,wh.Simon1994PlanetaryPositions=yi,wh.SimplePolylineGeometry=Ci,wh.SphereGeometry=wi,wh.SphereOutlineGeometry=Si,wh.Spherical=Ei,wh.Spline=bi,wh.TaskProcessor=xi,wh.TerrainData=Ti,wh.TerrainMesh=Pi,wh.TerrainProvider=Ai,wh.TileProviderError=Di,wh.TilingScheme=Mi,wh.TimeConstants=Ii,wh.TimeInterval=Oi,wh.TimeIntervalCollection=Ri,wh.TimeStandard=Li,wh.Tipsify=Ni,wh.Transforms=Fi,wh.TridiagonalSystemSolver=Bi,wh.VRTheWorldTerrainProvider=zi,wh.VertexFormat=ki,wh.Visibility=Vi,wh.WallGeometry=Ui,wh.WallGeometryLibrary=Wi,wh.WallOutlineGeometry=Gi,wh.WebMercatorProjection=Hi,wh.WebMercatorTilingScheme=qi,wh.WindingOrder=ji,wh.appendForwardSlash=Yi,wh.barycentricCoordinates=Xi,wh.binarySearch=Zi,wh.buildModuleUrl=Ji,wh.cancelAnimationFrame=Qi,wh.clone=Ki,wh.combine=$i,wh.createGuid=er,wh.defaultValue=tr,wh.defineProperties=ir,wh.defined=rr,wh.definedNotNull=nr,wh.deprecationWarning=or,wh.destroyObject=ar,wh.formatError=sr,wh.freezeObject=lr,wh.getFilenameFromUri=ur,wh.getImagePixels=cr,wh.getStringFromTypedArray=hr,wh.getTimestamp=dr,wh.isArray=pr,wh.isCrossOriginUrl=mr,wh.isLeapYear=fr,wh.jsonp=vr,wh.loadArrayBuffer=gr,wh.loadBlob=_r,wh.loadImage=yr,wh.loadImageFromTypedArray=Cr,wh.loadImageViaBlob=wr,wh.loadJson=Sr,wh.loadText=Er,wh.loadWithXhr=br,wh.loadXML=xr,wh.mergeSort=Tr,wh.objectToQuery=Pr,wh.parseResponseHeaders=Ar,wh.pointInsideTriangle=Dr,wh.queryToObject=Mr,wh.requestAnimationFrame=Ir,wh.sampleTerrain=Or,wh.subdivideArray=Rr,wh.throttleRequestByServer=Lr,wh.wrapFunction=Nr,wh.writeTextToCanvas=Fr,wh.BillboardGraphics=Br,wh.BillboardVisualizer=zr,wh.BoundingSphereState=kr,wh.BoxGeometryUpdater=Vr,wh.BoxGraphics=Ur,wh.CallbackProperty=Wr,wh.CheckerboardMaterialProperty=Gr,wh.ColorMaterialProperty=Hr,wh.CompositeEntityCollection=qr,wh.CompositeMaterialProperty=jr,wh.CompositePositionProperty=Yr,wh.CompositeProperty=Xr,wh.ConstantPositionProperty=Zr,wh.ConstantProperty=Jr,wh.CorridorGeometryUpdater=Qr,wh.CorridorGraphics=Kr,wh.CustomDataSource=$r,wh.CylinderGeometryUpdater=en,wh.CylinderGraphics=tn,wh.CzmlDataSource=rn,wh.DataSource=nn,wh.DataSourceClock=on,wh.DataSourceCollection=an,wh.DataSourceDisplay=sn,wh.DynamicGeometryUpdater=ln,wh.EllipseGeometryUpdater=un,wh.EllipseGraphics=cn,wh.EllipsoidGeometryUpdater=hn,wh.EllipsoidGraphics=dn,wh.Entity=pn,wh.EntityCollection=mn,wh.EntityView=fn,wh.GeoJsonDataSource=vn,wh.GeometryUpdater=gn,wh.GeometryVisualizer=_n,wh.GridMaterialProperty=yn,wh.ImageMaterialProperty=Cn,wh.KmlDataSource=wn,wh.LabelGraphics=Sn,wh.LabelVisualizer=En,wh.MaterialProperty=bn,wh.ModelGraphics=xn,wh.ModelVisualizer=Tn,wh.PathGraphics=Pn,wh.PathVisualizer=An,wh.PointGraphics=Dn,wh.PointVisualizer=Mn,wh.PolygonGeometryUpdater=In,wh.PolygonGraphics=On,wh.PolylineArrowMaterialProperty=Rn,wh.PolylineGeometryUpdater=Ln,wh.PolylineGlowMaterialProperty=Nn,wh.PolylineGraphics=Fn,wh.PolylineOutlineMaterialProperty=Bn,wh.PolylineVolumeGeometryUpdater=zn,wh.PolylineVolumeGraphics=kn,wh.PositionProperty=Vn,wh.PositionPropertyArray=Un,wh.Property=Wn,wh.PropertyArray=Gn,wh.RectangleGeometryUpdater=Hn,wh.RectangleGraphics=qn,wh.ReferenceProperty=jn,wh.Rotation=Yn,wh.SampledPositionProperty=Xn,wh.SampledProperty=Zn,wh.ScaledPositionProperty=Jn,wh.StaticGeometryColorBatch=Qn,wh.StaticGeometryPerMaterialBatch=Kn,wh.StaticOutlineGeometryBatch=$n,wh.StripeMaterialProperty=eo,wh.StripeOrientation=to,wh.TimeIntervalCollectionPositionProperty=io,wh.TimeIntervalCollectionProperty=ro,wh.VelocityOrientationProperty=no,wh.Visualizer=oo,wh.WallGeometryUpdater=ao,wh.WallGraphics=so,wh.createMaterialPropertyDescriptor=lo,wh.createPropertyDescriptor=uo,wh.createRawPropertyDescriptor=co,wh.dynamicGeometryGetBoundingSphere=ho,wh.AutomaticUniforms=po,wh.Buffer=mo,wh.BufferUsage=fo,wh.ClearCommand=vo,wh.Context=go,wh.CubeMap=_o,wh.CubeMapFace=yo,wh.DrawCommand=Co,wh.Framebuffer=wo,wh.MipmapHint=So,wh.PassState=Eo,wh.PickFramebuffer=bo,wh.PixelDatatype=xo,wh.RenderState=To,wh.Renderbuffer=Po,wh.RenderbufferFormat=Ao,wh.ShaderCache=Do,wh.ShaderProgram=Mo,wh.ShaderSource=Io,wh.Texture=Oo,wh.TextureMagnificationFilter=Ro,wh.TextureMinificationFilter=Lo,wh.TextureWrap=No,wh.UniformState=Fo,wh.VertexArray=Bo,wh.VertexArrayFacade=zo,wh.createUniform=ko,wh.createUniformArray=Vo,wh.loadCubeMap=Uo,wh.Appearance=Wo,wh.ArcGisMapServerImageryProvider=Go,wh.Billboard=Ho,wh.BillboardCollection=qo,wh.BingMapsImageryProvider=jo,wh.BingMapsStyle=Yo,wh.BlendEquation=Xo,wh.BlendFunction=Zo,wh.BlendingState=Jo,wh.Camera=Qo,wh.CameraEventAggregator=Ko,wh.CameraEventType=$o,wh.CameraFlightPath=ea,wh.CreditDisplay=ta,wh.CullFace=ia,wh.CullingVolume=ra,wh.DebugAppearance=na,wh.DebugModelMatrixPrimitive=oa,wh.DepthFunction=aa,wh.DiscardMissingTileImagePolicy=sa,wh.EllipsoidPrimitive=la,wh.EllipsoidSurfaceAppearance=ua,wh.FXAA=ca,wh.FrameRateMonitor=ha,wh.FrameState=da,wh.FrustumCommands=pa,wh.GetFeatureInfoFormat=ma,wh.Globe=fa,wh.GlobeDepth=va,wh.GlobeSurfaceShaderSet=ga,wh.GlobeSurfaceTile=_a,wh.GlobeSurfaceTileProvider=ya,wh.GoogleEarthImageryProvider=Ca,wh.GridImageryProvider=wa,wh.HeadingPitchRange=Sa,wh.HeightReference=Ea,wh.HorizontalOrigin=ba,wh.Imagery=xa,wh.ImageryLayer=Ta,wh.ImageryLayerCollection=Pa,wh.ImageryLayerFeatureInfo=Aa,wh.ImageryProvider=Da,wh.ImageryState=Ma,wh.Label=Ia,wh.LabelCollection=Oa,wh.LabelStyle=Ra,wh.Material=La,wh.MaterialAppearance=Na,wh.Model=Fa,wh.ModelAnimation=Ba,wh.ModelAnimationCache=za,wh.ModelAnimationCollection=ka,wh.ModelAnimationLoop=Va,wh.ModelAnimationState=Ua,wh.ModelMaterial=Wa,wh.ModelMesh=Ga,wh.ModelNode=Ha,wh.Moon=qa,wh.NeverTileDiscardPolicy=ja,wh.OIT=Ya,wh.OpenStreetMapImageryProvider=Xa,wh.OrthographicFrustum=Za,wh.Pass=Ja,wh.PerInstanceColorAppearance=Qa,wh.PerformanceDisplay=Ka,wh.PerspectiveFrustum=$a,wh.PerspectiveOffCenterFrustum=es,wh.PickDepth=ts,wh.PointPrimitive=is,wh.PointPrimitiveCollection=rs,wh.Polygon=ns,wh.Polyline=os,wh.PolylineCollection=as,wh.PolylineColorAppearance=ss,wh.PolylineMaterialAppearance=ls,wh.Primitive=us,wh.PrimitiveCollection=cs,wh.PrimitivePipeline=hs,wh.PrimitiveState=ds,wh.QuadtreeOccluders=ps,wh.QuadtreePrimitive=ms,wh.QuadtreeTile=fs,wh.QuadtreeTileLoadState=vs,wh.QuadtreeTileProvider=gs,wh.RectanglePrimitive=_s,wh.Scene=ys,wh.SceneMode=Cs,wh.SceneTransforms=ws,wh.SceneTransitioner=Ss,wh.ScreenSpaceCameraController=Es,wh.SingleTileImageryProvider=bs,wh.SkyAtmosphere=xs,wh.SkyBox=Ts,wh.StencilFunction=Ps,wh.StencilOperation=As,wh.Sun=Ds,wh.SunPostProcess=Ms,wh.TerrainState=Is,wh.TextureAtlas=Os,wh.TileCoordinatesImageryProvider=Rs,wh.TileDiscardPolicy=Ls,wh.TileImagery=Ns,wh.TileMapServiceImageryProvider=Fs,wh.TileReplacementQueue=Bs,wh.TileState=zs,wh.TileTerrain=ks,wh.TweenCollection=Vs,wh.UrlTemplateImageryProvider=Us,wh.VerticalOrigin=Ws,wh.ViewportQuad=Gs,wh.WebMapServiceImageryProvider=Hs,wh.WebMapTileServiceImageryProvider=qs,wh.createTangentSpaceDebugPrimitive=js,wh.getModelAccessor=Ys,wh.terrainAttributeLocations=Xs,wh._shaders.AdjustTranslucentFS=Zs,wh._shaders.AllMaterialAppearanceFS=Js,wh._shaders.AllMaterialAppearanceVS=Qs,wh._shaders.BasicMaterialAppearanceFS=Ks,wh._shaders.BasicMaterialAppearanceVS=$s,wh._shaders.EllipsoidSurfaceAppearanceFS=el,wh._shaders.EllipsoidSurfaceAppearanceVS=tl,wh._shaders.PerInstanceColorAppearanceFS=il,wh._shaders.PerInstanceColorAppearanceVS=rl,wh._shaders.PerInstanceFlatColorAppearanceFS=nl,wh._shaders.PerInstanceFlatColorAppearanceVS=ol,wh._shaders.PolylineColorAppearanceVS=al,wh._shaders.PolylineMaterialAppearanceVS=sl,wh._shaders.TexturedMaterialAppearanceFS=ll,wh._shaders.TexturedMaterialAppearanceVS=ul,wh._shaders.BillboardCollectionFS=cl,wh._shaders.BillboardCollectionVS=hl,wh._shaders.degreesPerRadian=dl,wh._shaders.depthRange=pl,wh._shaders.epsilon1=ml,wh._shaders.epsilon2=fl,wh._shaders.epsilon3=vl,wh._shaders.epsilon4=gl,wh._shaders.epsilon5=_l,wh._shaders.epsilon6=yl,wh._shaders.epsilon7=Cl,wh._shaders.infinity=wl,wh._shaders.oneOverPi=Sl,wh._shaders.oneOverTwoPi=El,wh._shaders.pi=bl,wh._shaders.piOverFour=xl,wh._shaders.piOverSix=Tl,wh._shaders.piOverThree=Pl,wh._shaders.piOverTwo=Al,wh._shaders.radiansPerDegree=Dl,wh._shaders.sceneMode2D=Ml,wh._shaders.sceneMode3D=Il,wh._shaders.sceneModeColumbusView=Ol,wh._shaders.sceneModeMorphing=Rl,wh._shaders.solarRadius=Ll,wh._shaders.threePiOver2=Nl,wh._shaders.twoPi=Fl,wh._shaders.webMercatorMaxLatitude=Bl,wh._shaders.CzmBuiltins=zl,wh._shaders.RGBToXYZ=kl,wh._shaders.XYZToRGB=Vl,wh._shaders.alphaWeight=Ul,wh._shaders.antialias=Wl,wh._shaders.columbusViewMorph=Gl,wh._shaders.computePosition=Hl,wh._shaders.cosineAndSine=ql,wh._shaders.decompressTextureCoordinates=jl,wh._shaders.eastNorthUpToEyeCoordinates=Yl,wh._shaders.ellipsoidContainsPoint=Xl,wh._shaders.ellipsoidNew=Zl,wh._shaders.ellipsoidWgs84TextureCoordinates=Jl,wh._shaders.equalsEpsilon=Ql,wh._shaders.eyeOffset=Kl,wh._shaders.eyeToWindowCoordinates=$l,wh._shaders.geodeticSurfaceNormal=eu,wh._shaders.getDefaultMaterial=tu,wh._shaders.getLambertDiffuse=iu,wh._shaders.getSpecular=ru,wh._shaders.getWaterNoise=nu,wh._shaders.getWgs84EllipsoidEC=ou,wh._shaders.hue=au,wh._shaders.isEmpty=su,wh._shaders.isFull=lu,wh._shaders.latitudeToWebMercatorFraction=uu,wh._shaders.luminance=cu,wh._shaders.modelToWindowCoordinates=hu,wh._shaders.multiplyWithColorBalance=du,wh._shaders.nearFarScalar=pu,wh._shaders.octDecode=mu,wh._shaders.packDepth=fu,wh._shaders.phong=vu,wh._shaders.pointAlongRay=gu,wh._shaders.rayEllipsoidIntersectionInterval=_u,wh._shaders.saturation=yu,wh._shaders.signNotZero=Cu,wh._shaders.tangentToEyeSpaceMatrix=wu,wh._shaders.translateRelativeToEye=Su,wh._shaders.translucentPhong=Eu,wh._shaders.transpose=bu,wh._shaders.unpackDepth=xu,wh._shaders.windowToEyeCoordinates=Tu,wh._shaders.depthRangeStruct=Pu,wh._shaders.ellipsoid=Au,wh._shaders.material=Du,wh._shaders.materialInput=Mu,wh._shaders.ray=Iu,wh._shaders.raySegment=Ou,wh._shaders.CompositeOITFS=Ru,wh._shaders.EllipsoidFS=Lu,wh._shaders.EllipsoidVS=Nu,wh._shaders.GlobeFS=Fu,wh._shaders.GlobeFSDepth=Bu,wh._shaders.GlobeFSPole=zu,wh._shaders.GlobeVS=ku,wh._shaders.GlobeVSDepth=Vu,wh._shaders.GlobeVSPole=Uu,wh._shaders.BumpMapMaterial=Wu,wh._shaders.CheckerboardMaterial=Gu,wh._shaders.DotMaterial=Hu,wh._shaders.FadeMaterial=qu,wh._shaders.GridMaterial=ju,wh._shaders.NormalMapMaterial=Yu,wh._shaders.PolylineArrowMaterial=Xu,wh._shaders.PolylineGlowMaterial=Zu,wh._shaders.PolylineOutlineMaterial=Ju,wh._shaders.RimLightingMaterial=Qu,wh._shaders.StripeMaterial=Ku,wh._shaders.Water=$u,wh._shaders.PointPrimitiveCollectionFS=ec,wh._shaders.PointPrimitiveCollectionVS=tc,wh._shaders.PolylineCommon=ic,wh._shaders.PolylineFS=rc,wh._shaders.PolylineVS=nc,wh._shaders.AdditiveBlend=oc,wh._shaders.BrightPass=ac,wh._shaders.FXAA=sc,wh._shaders.GaussianBlur1D=lc,wh._shaders.PassThrough=uc,wh._shaders.ReprojectWebMercatorFS=cc,wh._shaders.ReprojectWebMercatorVS=hc,wh._shaders.SkyAtmosphereFS=dc,wh._shaders.SkyAtmosphereVS=pc,wh._shaders.SkyBoxFS=mc,wh._shaders.SkyBoxVS=fc,wh._shaders.SunFS=vc,wh._shaders.SunTextureFS=gc,wh._shaders.SunVS=_c,wh._shaders.ViewportQuadFS=yc,wh._shaders.ViewportQuadVS=Cc,wh.Autolinker=wc,wh.Tween=Sc,wh.Uri=Ec,wh.gltfDefaults=bc,wh["knockout-3.2.0"]=xc,wh["knockout-es5"]=Tc,wh.knockout=Pc,wh.measureText=Ac,wh["mersenne-twister"]=Dc,wh.sprintf=Mc,wh.topojson=Ic,wh.when=Oc,wh.zip=Rc,wh.Animation=Lc,wh.AnimationViewModel=Nc,wh.BaseLayerPicker=Fc,wh.BaseLayerPickerViewModel=Bc,wh.ProviderViewModel=zc,wh.createDefaultImageryProviderViewModels=kc,wh.createDefaultTerrainProviderViewModels=Vc,wh.CesiumInspector=Uc,wh.CesiumInspectorViewModel=Wc,wh.CesiumWidget=Gc,wh.ClockViewModel=Hc,wh.Command=qc,wh.FullscreenButton=jc,wh.FullscreenButtonViewModel=Yc,wh.Geocoder=Xc,wh.GeocoderViewModel=Zc,wh.HomeButton=Jc,wh.HomeButtonViewModel=Qc,wh.InfoBox=Kc,wh.InfoBoxViewModel=$c,wh.NavigationHelpButton=eh,wh.NavigationHelpButtonViewModel=th,wh.PerformanceWatchdog=ih,wh.PerformanceWatchdogViewModel=rh,wh.SceneModePicker=nh,wh.SceneModePickerViewModel=oh,wh.SelectionIndicator=ah,wh.SelectionIndicatorViewModel=sh,wh.SvgPathBindingHandler=lh,wh.Timeline=uh,wh.TimelineHighlightRange=ch,wh.TimelineTrack=hh,wh.ToggleButtonViewModel=dh,wh.Viewer=ph,wh.viewerCesiumInspectorMixin=mh,wh.viewerDragDropMixin=fh,wh.viewerPerformanceWatchdogMixin=vh,wh.createCommand=gh,wh.getElement=_h,wh.subscribeAndEvaluate=yh,wh.createTaskProcessorWorker=Ch,wh}),t(["Cesium"],function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof self?self:{};t.Cesium=e},void 0,!0)}(); \ No newline at end of file diff --git a/libs/Cesium/LICENSE.md b/libs/Cesium/LICENSE.md deleted file mode 100644 index 1917e19d..00000000 --- a/libs/Cesium/LICENSE.md +++ /dev/null @@ -1,381 +0,0 @@ -Copyright 2011-2015 Cesium Contributors - -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 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - -Columbus View (Pat. Pend.) - -Third-Party Code -================ - -Cesium includes the following third-party code. - -### Sean O'Neil - -http://sponeil.net/ - -> Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) -> -> All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> * Neither the name of the project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### Grauw Uri utilities - -http://hg.grauw.nl/grauw-lib - -> Laurens Holst (http://www.grauw.nl/) -> -> Copyright 2012 Laurens Holst -> -> 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 -> -> Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - -### when.js - -https://github.com/cujojs/when - -> Open Source Initiative OSI - The MIT License -> -> http://www.opensource.org/licenses/mit-license.php -> -> Copyright (c) 2011 Brian Cavalier -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### zip.js - -https://github.com/gildas-lormeau/zip.js - -> Copyright (c) 2013 Gildas Lormeau. All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> -> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> -> 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### Autolinker.js - -https://github.com/gregjacobs/Autolinker.js - -The MIT License (MIT) - -> Copyright (c) 2014 Gregory Jacobs (http://greg-jacobs.com) - -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> ->THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### tween.js - -https://github.com/sole/tween.js - -> Copyright (c) 2010-2012 Tween.js authors. -> -> Easing equations Copyright (c) 2001 Robert Penner http://robertpenner.com/easing/ -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### php.js - -https://github.com/kvz/phpjs - -> php.js is copyright 2012 Kevin van Zonneveld. -> -> Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld (http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White (http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick (https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. L. Rodrigues (http://www.jsfromhell.com), Ash Searle (http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny Mast (http://www.phpvrouwen.nl), T.Wild, d3x, http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo (http://webdevhobo.blogspot.com/), marrtins, GeekFG (http://geekf blogspot.com), Andrea Giammarchi (http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser (http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), Marc Palau, Martin (http://www.erlenwiese.de/), Breaking Par Consulting Inc (http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), Chris, Mirek Slugen, saulius, Alfonso Jimenez (http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio Ariede (http://caioariede.com), Robin, Kankrelune (http://www.webfaktory.info/), Karol Kowalski, Imgen Tata (http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, David, Aman Gupta, Michael White, Public Domain (http://www.json.org/json2.js), Steven Levithan (http://b g.stevenlevithan.com), Sakimori, Pellentesque Malesuada, Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon (http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov (http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford (http://javascript.crockford.com), madipta, Slawomir Kaniecki, ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner (http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick (https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt (http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, josh, jd, Pier Paolo Ramon (http://www.mastersoup.c /), P, merabi, Soren Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon (http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX (http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, Stoyan Kyosev (http://www.svest.org/), nord_ua, omid (http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc (http://yass.meetcweb.com), Peter-Paul Koch (http://www.quirksmode.org/js/beat.html), Olivier Louvignes (http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger (http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong (http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, M rco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke (http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya (http://www.premasolutions.com/), Philippe Jausions (http://pear.php.net/user/jausions), Aidan Lister (http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, strcmp, Taras Bogach, jpfle, Alexander Ermolaev (http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha (http://www.pedrotainha.com), James, Arnout Kazemier (http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan Jensen (http://www.winternet.no), Ho ard Yeend, Benjamin Lupton, davook, daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage (http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, Billy, stensi, Cord, Manish, T.J. Leahy, Riddler (http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi (http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, Russell Walker (http://www.nbill.co.uk/), Jamie Beck (http://www.terabit.ca/), setcookie, Michael, YUI Library: http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at http://hacks.bluesmoon.info/strftime/strftime.js, Ben (http://benblume.co.uk/), DtTvB (http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, meo, incidence, Cagri Ekin, Amirouche, Amir Habibi (http://www.residence-mixte.com/), Luke Smith (http://lucassmith.na ), Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben Bryan -> -> Licensed under the MIT (MIT-LICENSE.txt) license. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OROTHER DEALINGS IN THE SOFTWARE. - -### fontmetrics.js - -https://github.com/Pomax/fontmetrics.js - -> Copyright (C) 2011 by Mike "Pomax" Kamermans -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### almond - -https://github.com/jrburke/almond - -> Copyright (c) 2010-2011, The Dojo Foundation -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### RequireJS - -https://github.com/jrburke/requirejs - -> Copyright (c) 2010-2011, The Dojo Foundation -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### Knockout - -http://knockoutjs.com/ - -> (c) Steven Sanderson - http://knockoutjs.com/ -> License: MIT (http://www.opensource.org/licenses/mit-license.php) -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### Knockout ES5 plugin - -https://github.com/SteveSanderson/knockout-es5 - -> Copyright (c) Steve Sanderson -> MIT license -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### topojson - -https://github.com/mbostock/topojson - -> Copyright (c) 2012, Michael Bostock -> All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> -> * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> -> * The name Michael Bostock may not be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### mersenne-twister.js - -https://gist.github.com/banksean/300494 - -> Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, -> All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> -> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> -> 3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### NVIDIA Image-Based Anti-Aliasing - -https://developer.nvidia.com/nvidia-graphics-sdk-11-direct3d - -> Copyright 2011 NVIDIA Corporation -> -> BY DOWNLOADING THE SOFTWARE AND OTHER AVAILABLE MATERIALS, YOU ("DEVELOPER") AGREE TO BE BOUND BY THE FOLLOWING TERMS AND CONDITIONS -> -> The materials available for download to Developers may include software in both sample source ("Source Code") and object code ("Object Code") versions, documentation ("Documentation"), certain art work ("Art Assets") and other materials (collectively, these materials referred to herein as "Materials"). Except as expressly indicated herein, all terms and conditions of this Agreement apply to all of the Materials. -> -> Except as expressly set forth herein, NVIDIA owns all of the Materials and makes them available to Developer only under the terms and conditions set forth in this Agreement. -> -> License: Subject to the terms of this Agreement, NVIDIA hereby grants to Developer a royalty-free, non-exclusive license to possess and to use the Materials. The following terms apply to the specified type of Material: -> -> Source Code: Developer shall have the right to modify and create derivative works with the Source Code. Developer shall own any derivative works ("Derivatives") it creates to the Source Code, provided that Developer uses the Materials in accordance with the terms of this Agreement. Developer may distribute the Derivatives, provided that all NVIDIA copyright notices and trademarks are used properly and the Derivatives include the following statement: "This software contains source code provided by NVIDIA Corporation." -> -> Object Code: Developer agrees not to disassemble, decompile or reverse engineer the Object Code versions of any of the Materials. Developer acknowledges that certain of the Materials provided in Object Code version may contain third party components that may be subject to restrictions, and expressly agrees not to attempt to modify or distribute such Materials without first receiving consent from NVIDIA. -> -> Art Assets: Developer shall have the right to modify and create Derivatives of the Art Assets, but may not distribute any of the Art Assets or Derivatives created therefrom without NVIDIA’s prior written consent. -> -> Government End Users: If you are acquiring the Software on behalf of any unit or agency of the United States Government, the following provisions apply. The Government agrees the Software and documentation were developed at private expense and are provided with “RESTRICTED RIGHTS”. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in DFARS 227.7202-1(a) and 227.7202-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (Oct 1988), FAR 12.212(a)(1995), FAR 52.227-19, (June 1987) or FAR 52.227-14(ALT III) (June 1987),as amended from time to time. In the event that this License, or any part thereof, is deemed inconsistent with the minimum rights identified in the Restricted Rights provisions, the minimum rights shall prevail. -> No Other License. No rights or licenses are granted by NVIDIA under this License, expressly or by implication, with respect to any proprietary information or patent, copyright, trade secret or other intellectual property right owned or controlled by NVIDIA, except as expressly provided in this License. -> Term: This License is effective until terminated. NVIDIA may terminate this Agreement (and with it, all of Developer’s right to the Materials) immediately upon written notice (which may include email) to Developer, with or without cause. -> -> Support: NVIDIA has no obligation to support or to continue providing or updating any of the Materials. -> -> No Warranty: THE SOFTWARE AND ANY OTHER MATERIALS PROVIDED BY NVIDIA TO DEVELOPER HEREUNDER ARE PROVIDED "AS IS." NVIDIA DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> -> LIMITATION OF LIABILITY: NVIDIA SHALL NOT BE LIABLE TO DEVELOPER, DEVELOPER’S CUSTOMERS, OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR UNDER DEVELOPER FOR ANY LOSS OF PROFITS, INCOME, SAVINGS, OR ANY OTHER CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, DIRECT OR INDIRECT DAMAGES (WHETHER IN AN ACTION IN CONTRACT, TORT OR BASED ON A WARRANTY), EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF THE ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. IN NO EVENT SHALL NVIDIA’S AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE SOFTWARE OR ANY OTHER MATERIALS. - -Tests -===== - -The Cesium tests use the following third-party libraries and data. - -### Jasmine - -http://jasmine.github.io/ - -Copyright (c) 2008-2015 Pivotal Labs - -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### es5-shim - -https://github.com/kriskowal/es5-shim - -> Copyright 2009, 2010 Kristopher Michael Kowal. All rights reserved. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Example Applications -==================== - -The Cesium example applications include the following third-party libraries and data. - -### Dojo Toolkit - -http://dojotoolkit.org/ - -> Copyright (c) 2005-2011, The Dojo Foundation -> -> All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> * Neither the name of the Dojo Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### CodeMirror - -http://codemirror.net/ - -> Copyright (C) 2012 by Marijn Haverbeke <marijnh@gmail.com> -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -> -> Please note that some subdirectories of the CodeMirror distribution include their own LICENSE files, and are released under different licences. - -### JSHint - -http://www.jshint.com/ - -> JSHint, by JSHint Community. -> -> Licensed under the same slightly modified MIT license that JSLint is. It stops evil-doers everywhere. -> -> JSHint is a derivative work of JSLint: -> -> Copyright (c) 2002 Douglas Crockford (www.JSLint.com) -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> The Software shall be used for Good, not Evil. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. JSHint was forked from the 2010-12-16 edition of JSLint. - -### Public domain data from Natural Earth - -Free vector and raster map data @ naturalearthdata.com - -Terms of use: http://www.naturalearthdata.com/about/terms-of-use/ - -### Data from JHT's Planetary Pixel Emporium - -Copyright (c) by James Hastings-Trew - -http://planetpixelemporium.com/ - -Copyright Information: http://planetpixelemporium.com/planets.html - -### Sky box images from NASA - -http://maps.jpl.nasa.gov/stars.html - -http://svs.gsfc.nasa.gov/vis/a000000/a003500/a003572/ - -Terms of use: http://www.nasa.gov/audience/formedia/features/MP_Photo_Guidelines.html - -### Some vector icons from (or inspired by) Raphaël JS - -http://raphaeljs.com/icons/ - -http://raphaeljs.com/license.html - -### Mouse and gesture vector icons made by Freepik from Flaticon.com - -http://www.flaticon.com/authors/freepik - -### Maki icon set from Mapbox - -https://www.mapbox.com/maki/ - -https://github.com/mapbox/maki - -### population909500.json ### - -https://github.com/dataarts/webgl-globe - -> Copyright 2011 Google Data Arts Team -> -> 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 -> -> Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - diff --git a/libs/Cesium/ThirdParty/Workers/deflate.js b/libs/Cesium/ThirdParty/Workers/deflate.js deleted file mode 100644 index b3df40a1..00000000 --- a/libs/Cesium/ThirdParty/Workers/deflate.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/* - Copyright (c) 2013 Gildas Lormeau. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the distribution. - - 3. The names of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, - INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -!function(e){function t(){function e(e){var t,n,i,r,_,o,d=a.dyn_tree,f=a.stat_desc.static_tree,l=a.stat_desc.extra_bits,s=a.stat_desc.extra_base,c=a.stat_desc.max_length,p=0;for(r=0;u>=r;r++)e.bl_count[r]=0;for(d[2*e.heap[e.heap_max]+1]=0,t=e.heap_max+1;h>t;t++)n=e.heap[t],r=d[2*d[2*n+1]+1]+1,r>c&&(r=c,p++),d[2*n+1]=r,n>a.max_code||(e.bl_count[r]++,_=0,n>=s&&(_=l[n-s]),o=d[2*n],e.opt_len+=o*(r+_),f&&(e.static_len+=o*(f[2*n+1]+_)));if(0!==p){do{for(r=c-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[c]--,p-=2}while(p>0);for(r=c;0!==r;r--)for(n=e.bl_count[r];0!==n;)i=e.heap[--t],i>a.max_code||(d[2*i+1]!=r&&(e.opt_len+=(r-d[2*i+1])*d[2*i],d[2*i+1]=r),n--)}}function t(e,t){var n=0;do n|=1&e,e>>>=1,n<<=1;while(--t>0);return n>>>1}function n(e,n,a){var i,r,_,o=[],d=0;for(i=1;u>=i;i++)o[i]=d=d+a[i-1]<<1;for(r=0;n>=r;r++)_=e[2*r+1],0!==_&&(e[2*r]=t(o[_]++,_))}var a=this;a.build_tree=function(t){var i,r,_,o=a.dyn_tree,u=a.stat_desc.static_tree,d=a.stat_desc.elems,f=-1;for(t.heap_len=0,t.heap_max=h,i=0;d>i;i++)0!==o[2*i]?(t.heap[++t.heap_len]=f=i,t.depth[i]=0):o[2*i+1]=0;for(;t.heap_len<2;)_=t.heap[++t.heap_len]=2>f?++f:0,o[2*_]=1,t.depth[_]=0,t.opt_len--,u&&(t.static_len-=u[2*_+1]);for(a.max_code=f,i=Math.floor(t.heap_len/2);i>=1;i--)t.pqdownheap(o,i);_=d;do i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],t.pqdownheap(o,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,o[2*_]=o[2*i]+o[2*r],t.depth[_]=Math.max(t.depth[i],t.depth[r])+1,o[2*i+1]=o[2*r+1]=_,t.heap[1]=_++,t.pqdownheap(o,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],e(t),n(o,a.max_code,t.bl_count)}}function n(e,t,n,a,i){var r=this;r.static_tree=e,r.extra_bits=t,r.extra_base=n,r.elems=a,r.max_length=i}function a(e,t,n,a,i){var r=this;r.good_length=e,r.max_lazy=t,r.nice_length=n,r.max_chain=a,r.func=i}function i(e,t,n,a){var i=e[2*t],r=e[2*n];return r>i||i==r&&a[t]<=a[n]}function r(){function e(){var e;for(Dt=2*Et,Pt[Lt-1]=0,e=0;Lt-1>e;e++)Pt[e]=0;Tt=J[Vt].max_lazy,Xt=J[Vt].good_length,Yt=J[Vt].nice_length,Rt=J[Vt].max_chain,Kt=0,Ft=0,Ot=0,Gt=Qt=tt-1,Jt=0,St=0}function a(){var e;for(e=0;c>e;e++)Zt[2*e]=0;for(e=0;d>e;e++)$t[2*e]=0;for(e=0;f>e;e++)en[2*e]=0;Zt[2*p]=1,tn.opt_len=tn.static_len=0,un=fn=0}function r(){nn.dyn_tree=Zt,nn.stat_desc=n.static_l_desc,an.dyn_tree=$t,an.stat_desc=n.static_d_desc,rn.dyn_tree=en,rn.stat_desc=n.static_bl_desc,sn=0,cn=0,ln=8,a()}function _(e,t){var n,a,i=-1,r=e[1],_=0,o=7,u=4;for(0===r&&(o=138,u=3),e[2*(t+1)+1]=65535,n=0;t>=n;n++)a=r,r=e[2*(n+1)+1],++_<o&&a==r||(u>_?en[2*a]+=_:0!==a?(a!=i&&en[2*a]++,en[2*v]++):10>=_?en[2*b]++:en[2*g]++,_=0,i=a,0===r?(o=138,u=3):a==r?(o=6,u=3):(o=7,u=4))}function o(){var e;for(_(Zt,nn.max_code),_($t,an.max_code),rn.build_tree(tn),e=f-1;e>=3&&0===en[2*t.bl_order[e]+1];e--);return tn.opt_len+=3*(e+1)+5+5+4,e}function u(e){tn.pending_buf[tn.pending++]=e}function l(e){u(255&e),u(255&e>>>8)}function h(e){u(255&e>>8),u(255&(255&e))}function x(e,t){var n,a=t;cn>w-a?(n=e,sn|=65535&n<<cn,l(sn),sn=n>>>w-cn,cn+=a-w):(sn|=65535&e<<cn,cn+=a)}function j(e,t){var n=2*e;x(65535&t[n],65535&t[n+1])}function it(e,t){var n,a,i=-1,r=e[1],_=0,o=7,u=4;for(0===r&&(o=138,u=3),n=0;t>=n;n++)if(a=r,r=e[2*(n+1)+1],!(++_<o&&a==r)){if(u>_){do j(a,en);while(0!==--_)}else 0!==a?(a!=i&&(j(a,en),_--),j(v,en),x(_-3,2)):10>=_?(j(b,en),x(_-3,3)):(j(g,en),x(_-11,7));_=0,i=a,0===r?(o=138,u=3):a==r?(o=6,u=3):(o=7,u=4)}}function rt(e,n,a){var i;for(x(e-257,5),x(n-1,5),x(a-4,4),i=0;a>i;i++)x(en[2*t.bl_order[i]+1],3);it(Zt,e-1),it($t,n-1)}function _t(){16==cn?(l(sn),sn=0,cn=0):cn>=8&&(u(255&sn),sn>>>=8,cn-=8)}function ot(){x($<<1,3),j(p,n.static_ltree),_t(),9>1+ln+10-cn&&(x($<<1,3),j(p,n.static_ltree),_t()),ln=7}function ut(e,n){var a,i,r;if(tn.pending_buf[dn+2*un]=255&e>>>8,tn.pending_buf[dn+2*un+1]=255&e,tn.pending_buf[_n+un]=255&n,un++,0===e?Zt[2*n]++:(fn++,e--,Zt[2*(t._length_code[n]+s+1)]++,$t[2*t.d_code(e)]++),0===(8191&un)&&Vt>2){for(a=8*un,i=Kt-Ft,r=0;d>r;r++)a+=$t[2*r]*(5+t.extra_dbits[r]);if(a>>>=3,fn<Math.floor(un/2)&&a<Math.floor(i/2))return!0}return un==on-1}function dt(e,n){var a,i,r,_,o=0;if(0!==un)do a=65280&tn.pending_buf[dn+2*o]<<8|255&tn.pending_buf[dn+2*o+1],i=255&tn.pending_buf[_n+o],o++,0===a?j(i,e):(r=t._length_code[i],j(r+s+1,e),_=t.extra_lbits[r],0!==_&&(i-=t.base_length[r],x(i,_)),a--,r=t.d_code(a),j(r,n),_=t.extra_dbits[r],0!==_&&(a-=t.base_dist[r],x(a,_)));while(un>o);j(p,e),ln=e[2*p+1]}function ft(){cn>8?l(sn):cn>0&&u(255&sn),sn=0,cn=0}function lt(e,t,n){ft(),ln=8,n&&(l(t),l(~t)),tn.pending_buf.set(qt.subarray(e,e+t),tn.pending),tn.pending+=t}function st(e,t,n){x((Z<<1)+(n?1:0),3),lt(e,t,!0)}function ct(e,t,i){var r,_,u=0;Vt>0?(nn.build_tree(tn),an.build_tree(tn),u=o(),r=tn.opt_len+3+7>>>3,_=tn.static_len+3+7>>>3,r>=_&&(r=_)):r=_=t+5,r>=t+4&&-1!=e?st(e,t,i):_==r?(x(($<<1)+(i?1:0),3),dt(n.static_ltree,n.static_dtree)):(x((et<<1)+(i?1:0),3),rt(nn.max_code+1,an.max_code+1,u+1),dt(Zt,$t)),a(),i&&ft()}function ht(e){ct(Ft>=0?Ft:-1,Kt-Ft,e),Ft=Kt,mt.flush_pending()}function pt(){var e,t,n,a;do{if(a=Dt-Ot-Kt,0===a&&0===Kt&&0===Ot)a=Et;else if(-1==a)a--;else if(Kt>=Et+Et-at){qt.set(qt.subarray(Et,Et+Et),0),Nt-=Et,Kt-=Et,Ft-=Et,e=Lt,n=e;do t=65535&Pt[--n],Pt[n]=t>=Et?t-Et:0;while(0!==--e);e=Et,n=e;do t=65535&It[--n],It[n]=t>=Et?t-Et:0;while(0!==--e);a+=Et}if(0===mt.avail_in)return;e=mt.read_buf(qt,Kt+Ot,a),Ot+=e,Ot>=tt&&(St=255&qt[Kt],St=(St<<Ct^255&qt[Kt+1])&Bt)}while(at>Ot&&0!==mt.avail_in)}function xt(e){var t,n=65535;for(n>Mt-5&&(n=Mt-5);;){if(1>=Ot){if(pt(),0===Ot&&e==U)return N;if(0===Ot)break}if(Kt+=Ot,Ot=0,t=Ft+n,(0===Kt||Kt>=t)&&(Ot=Kt-t,Kt=t,ht(!1),0===mt.avail_out))return N;if(Kt-Ft>=Et-at&&(ht(!1),0===mt.avail_out))return N}return ht(e==z),0===mt.avail_out?e==z?Q:N:e==z?R:O}function vt(e){var t,n,a=Rt,i=Kt,r=Qt,_=Kt>Et-at?Kt-(Et-at):0,o=Yt,u=zt,d=Kt+nt,f=qt[i+r-1],l=qt[i+r];Qt>=Xt&&(a>>=2),o>Ot&&(o=Ot);do if(t=e,qt[t+r]==l&&qt[t+r-1]==f&&qt[t]==qt[i]&&qt[++t]==qt[i+1]){i+=2,t++;do;while(qt[++i]==qt[++t]&&qt[++i]==qt[++t]&&qt[++i]==qt[++t]&&qt[++i]==qt[++t]&&qt[++i]==qt[++t]&&qt[++i]==qt[++t]&&qt[++i]==qt[++t]&&qt[++i]==qt[++t]&&d>i);if(n=nt-(d-i),i=d-nt,n>r){if(Nt=e,r=n,n>=o)break;f=qt[i+r-1],l=qt[i+r]}}while((e=65535&It[e&u])>_&&0!==--a);return Ot>=r?r:Ot}function bt(e){for(var t,n=0;;){if(at>Ot){if(pt(),at>Ot&&e==U)return N;if(0===Ot)break}if(Ot>=tt&&(St=(St<<Ct^255&qt[Kt+(tt-1)])&Bt,n=65535&Pt[St],It[Kt&zt]=Pt[St],Pt[St]=Kt),0!==n&&Et-at>=(65535&Kt-n)&&Wt!=M&&(Gt=vt(n)),Gt>=tt)if(t=ut(Kt-Nt,Gt-tt),Ot-=Gt,Tt>=Gt&&Ot>=tt){Gt--;do Kt++,St=(St<<Ct^255&qt[Kt+(tt-1)])&Bt,n=65535&Pt[St],It[Kt&zt]=Pt[St],Pt[St]=Kt;while(0!==--Gt);Kt++}else Kt+=Gt,Gt=0,St=255&qt[Kt],St=(St<<Ct^255&qt[Kt+1])&Bt;else t=ut(0,255&qt[Kt]),Ot--,Kt++;if(t&&(ht(!1),0===mt.avail_out))return N}return ht(e==z),0===mt.avail_out?e==z?Q:N:e==z?R:O}function gt(e){for(var t,n,a=0;;){if(at>Ot){if(pt(),at>Ot&&e==U)return N;if(0===Ot)break}if(Ot>=tt&&(St=(St<<Ct^255&qt[Kt+(tt-1)])&Bt,a=65535&Pt[St],It[Kt&zt]=Pt[St],Pt[St]=Kt),Qt=Gt,Ht=Nt,Gt=tt-1,0!==a&&Tt>Qt&&Et-at>=(65535&Kt-a)&&(Wt!=M&&(Gt=vt(a)),5>=Gt&&(Wt==y||Gt==tt&&Kt-Nt>4096)&&(Gt=tt-1)),Qt>=tt&&Qt>=Gt){n=Kt+Ot-tt,t=ut(Kt-1-Ht,Qt-tt),Ot-=Qt-1,Qt-=2;do++Kt<=n&&(St=(St<<Ct^255&qt[Kt+(tt-1)])&Bt,a=65535&Pt[St],It[Kt&zt]=Pt[St],Pt[St]=Kt);while(0!==--Qt);if(Jt=0,Gt=tt-1,Kt++,t&&(ht(!1),0===mt.avail_out))return N}else if(0!==Jt){if(t=ut(0,255&qt[Kt-1]),t&&ht(!1),Kt++,Ot--,0===mt.avail_out)return N}else Jt=1,Kt++,Ot--}return 0!==Jt&&(t=ut(0,255&qt[Kt-1]),Jt=0),ht(e==z),0===mt.avail_out?e==z?Q:N:e==z?R:O}function wt(t){return t.total_in=t.total_out=0,t.msg=null,tn.pending=0,tn.pending_out=0,yt=W,Ut=U,r(),e(),q}var mt,yt,Mt,At,Ut,Et,kt,zt,qt,Dt,It,Pt,St,Lt,jt,Bt,Ct,Ft,Gt,Ht,Jt,Kt,Nt,Ot,Qt,Rt,Tt,Vt,Wt,Xt,Yt,Zt,$t,en,tn=this,nn=new t,an=new t,rn=new t;tn.depth=[];var _n,on,un,dn,fn,ln,sn,cn;tn.bl_count=[],tn.heap=[],Zt=[],$t=[],en=[],tn.pqdownheap=function(e,t){for(var n=tn.heap,a=n[t],r=t<<1;r<=tn.heap_len&&(r<tn.heap_len&&i(e,n[r+1],n[r],tn.depth)&&r++,!i(e,a,n[r],tn.depth));)n[t]=n[r],t=r,r<<=1;n[t]=a},tn.deflateInit=function(e,t,n,a,i,r){return a||(a=Y),i||(i=C),r||(r=A),e.msg=null,t==m&&(t=6),1>i||i>B||a!=Y||9>n||n>15||0>t||t>9||0>r||r>M?P:(e.dstate=tn,kt=n,Et=1<<kt,zt=Et-1,jt=i+7,Lt=1<<jt,Bt=Lt-1,Ct=Math.floor((jt+tt-1)/tt),qt=new Uint8Array(2*Et),It=[],Pt=[],on=1<<i+6,tn.pending_buf=new Uint8Array(4*on),Mt=4*on,dn=Math.floor(on/2),_n=3*on,Vt=t,Wt=r,At=255&a,wt(e))},tn.deflateEnd=function(){return yt!=V&&yt!=W&&yt!=X?P:(tn.pending_buf=null,Pt=null,It=null,qt=null,tn.dstate=null,yt==W?S:q)},tn.deflateParams=function(e,t,n){var a=q;return t==m&&(t=6),0>t||t>9||0>n||n>M?P:(J[Vt].func!=J[t].func&&0!==e.total_in&&(a=e.deflate(E)),Vt!=t&&(Vt=t,Tt=J[Vt].max_lazy,Xt=J[Vt].good_length,Yt=J[Vt].nice_length,Rt=J[Vt].max_chain),Wt=n,a)},tn.deflateSetDictionary=function(e,t,n){var a,i=n,r=0;if(!t||yt!=V)return P;if(tt>i)return q;for(i>Et-at&&(i=Et-at,r=n-i),qt.set(t.subarray(r,r+i),0),Kt=i,Ft=i,St=255&qt[0],St=(St<<Ct^255&qt[1])&Bt,a=0;i-tt>=a;a++)St=(St<<Ct^255&qt[a+(tt-1)])&Bt,It[a&zt]=Pt[St],Pt[St]=a;return q},tn.deflate=function(e,t){var n,a,i,r,_;if(t>z||0>t)return P;if(!e.next_out||!e.next_in&&0!==e.avail_in||yt==X&&t!=z)return e.msg=K[I-P],P;if(0===e.avail_out)return e.msg=K[I-L],L;if(mt=e,r=Ut,Ut=t,yt==V&&(a=Y+(kt-8<<4)<<8,i=(255&Vt-1)>>1,i>3&&(i=3),a|=i<<6,0!==Kt&&(a|=T),a+=31-a%31,yt=W,h(a)),0!==tn.pending){if(mt.flush_pending(),0===mt.avail_out)return Ut=-1,q}else if(0===mt.avail_in&&r>=t&&t!=z)return mt.msg=K[I-L],L;if(yt==X&&0!==mt.avail_in)return e.msg=K[I-L],L;if(0!==mt.avail_in||0!==Ot||t!=U&&yt!=X){switch(_=-1,J[Vt].func){case F:_=xt(t);break;case G:_=bt(t);break;case H:_=gt(t)}if((_==Q||_==R)&&(yt=X),_==N||_==Q)return 0===mt.avail_out&&(Ut=-1),q;if(_==O){if(t==E)ot();else if(st(0,0,!1),t==k)for(n=0;Lt>n;n++)Pt[n]=0;if(mt.flush_pending(),0===mt.avail_out)return Ut=-1,q}}return t!=z?q:D}}function _(){var e=this;e.next_in_index=0,e.next_out_index=0,e.avail_in=0,e.total_in=0,e.avail_out=0,e.total_out=0}function o(e){var t=this,n=new _,a=512,i=U,r=new Uint8Array(a);"undefined"==typeof e&&(e=m),n.deflateInit(e),n.next_out=r,t.append=function(e,t){var _,o,u=[],d=0,f=0,l=0;if(e.length){n.next_in_index=0,n.next_in=e,n.avail_in=e.length;do{if(n.next_out_index=0,n.avail_out=a,_=n.deflate(i),_!=q)throw"deflating: "+n.msg;n.next_out_index&&(n.next_out_index==a?u.push(new Uint8Array(r)):u.push(new Uint8Array(r.subarray(0,n.next_out_index)))),l+=n.next_out_index,t&&n.next_in_index>0&&n.next_in_index!=d&&(t(n.next_in_index),d=n.next_in_index)}while(n.avail_in>0||0===n.avail_out);return o=new Uint8Array(l),u.forEach(function(e){o.set(e,f),f+=e.length}),o}},t.flush=function(){var e,t,i=[],_=0,o=0;do{if(n.next_out_index=0,n.avail_out=a,e=n.deflate(z),e!=D&&e!=q)throw"deflating: "+n.msg;a-n.avail_out>0&&i.push(new Uint8Array(r.subarray(0,n.next_out_index))),o+=n.next_out_index}while(n.avail_in>0||0===n.avail_out);return n.deflateEnd(),t=new Uint8Array(o),i.forEach(function(e){t.set(e,_),_+=e.length}),t}}var u=15,d=30,f=19,l=29,s=256,c=s+1+l,h=2*c+1,p=256,x=7,v=16,b=17,g=18,w=16,m=-1,y=1,M=2,A=0,U=0,E=1,k=3,z=4,q=0,D=1,I=2,P=-2,S=-3,L=-5,j=[0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,0,0,16,17,18,18,19,19,20,20,20,20,21,21,21,21,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29];t._length_code=[0,1,2,3,4,5,6,7,8,8,9,9,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28],t.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],t.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],t.d_code=function(e){return 256>e?j[e]:j[256+(e>>>7)]},t.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],t.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],t.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],t.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],n.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],n.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],n.static_l_desc=new n(n.static_ltree,t.extra_lbits,s+1,c,u),n.static_d_desc=new n(n.static_dtree,t.extra_dbits,0,d,u),n.static_bl_desc=new n(null,t.extra_blbits,0,f,x);var B=9,C=8,F=0,G=1,H=2,J=[new a(0,0,0,0,F),new a(4,4,8,4,G),new a(4,5,16,8,G),new a(4,6,32,32,G),new a(4,4,16,16,H),new a(8,16,32,32,H),new a(8,16,128,128,H),new a(8,32,128,256,H),new a(32,128,258,1024,H),new a(32,258,258,4096,H)],K=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],N=0,O=1,Q=2,R=3,T=32,V=42,W=113,X=666,Y=8,Z=0,$=1,et=2,tt=3,nt=258,at=nt+tt+1;_.prototype={deflateInit:function(e,t){var n=this;return n.dstate=new r,t||(t=u),n.dstate.deflateInit(n,e,t)},deflate:function(e){var t=this;return t.dstate?t.dstate.deflate(t,e):P},deflateEnd:function(){var e=this;if(!e.dstate)return P;var t=e.dstate.deflateEnd();return e.dstate=null,t},deflateParams:function(e,t){var n=this;return n.dstate?n.dstate.deflateParams(n,e,t):P},deflateSetDictionary:function(e,t){var n=this;return n.dstate?n.dstate.deflateSetDictionary(n,e,t):P},read_buf:function(e,t,n){var a=this,i=a.avail_in;return i>n&&(i=n),0===i?0:(a.avail_in-=i,e.set(a.next_in.subarray(a.next_in_index,a.next_in_index+i),t),a.next_in_index+=i,a.total_in+=i,i)},flush_pending:function(){var e=this,t=e.dstate.pending;t>e.avail_out&&(t=e.avail_out),0!==t&&(e.next_out.set(e.dstate.pending_buf.subarray(e.dstate.pending_out,e.dstate.pending_out+t),e.next_out_index),e.next_out_index+=t,e.dstate.pending_out+=t,e.total_out+=t,e.avail_out-=t,e.dstate.pending-=t,0===e.dstate.pending&&(e.dstate.pending_out=0))}};var it;e.zip?e.zip.Deflater=o:(it=new o,e.addEventListener("message",function(t){var n=t.data;n.init&&(it=new o(n.level),e.postMessage({oninit:!0})),n.append&&e.postMessage({onappend:!0,data:it.append(n.data,function(t){e.postMessage({progress:!0,current:t})})}),n.flush&&e.postMessage({onflush:!0,data:it.flush()})},!1))}(this); \ No newline at end of file diff --git a/libs/Cesium/ThirdParty/Workers/inflate.js b/libs/Cesium/ThirdParty/Workers/inflate.js deleted file mode 100644 index 7c84e911..00000000 --- a/libs/Cesium/ThirdParty/Workers/inflate.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/* - Copyright (c) 2013 Gildas Lormeau. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the distribution. - - 3. The names of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, - INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -!function(i){function e(){function i(i,e,t,n,s,o,f,u,w,v,h){var k,m,y,g,p,A,I,E,U,z,D,M,L,P,j;z=0,p=t;do a[i[e+z]]++,z++,p--;while(0!==p);if(a[0]==t)return f[0]=-1,u[0]=0,d;for(E=u[0],A=1;S>=A&&0===a[A];A++);for(I=A,A>E&&(E=A),p=S;0!==p&&0===a[p];p--);for(y=p,E>p&&(E=p),u[0]=E,P=1<<A;p>A;A++,P<<=1)if((P-=a[A])<0)return b;if((P-=a[p])<0)return b;for(a[p]+=P,l[1]=A=0,z=1,L=2;0!==--p;)l[L]=A+=a[z],L++,z++;p=0,z=0;do 0!==(A=i[e+z])&&(h[l[A]++]=p),z++;while(++p<t);for(t=l[y],l[0]=p=0,z=0,g=-1,M=-E,_[0]=0,D=0,j=0;y>=I;I++)for(k=a[I];0!==k--;){for(;I>M+E;){if(g++,M+=E,j=y-M,j=j>E?E:j,(m=1<<(A=I-M))>k+1&&(m-=k+1,L=I,j>A))for(;++A<j&&!((m<<=1)<=a[++L]);)m-=a[L];if(j=1<<A,v[0]+j>c)return b;_[g]=D=v[0],v[0]+=j,0!==g?(l[g]=p,r[0]=A,r[1]=E,A=p>>>M-E,r[2]=D-_[g-1]-A,w.set(r,3*(_[g-1]+A))):f[0]=D}for(r[1]=I-M,z>=t?r[0]=192:h[z]<n?(r[0]=h[z]<256?0:96,r[2]=h[z++]):(r[0]=o[h[z]-n]+16+64,r[2]=s[h[z++]-n]),m=1<<I-M,A=p>>>M;j>A;A+=m)w.set(r,3*(D+A));for(A=1<<I-1;0!==(p&A);A>>>=1)p^=A;for(p^=A,U=(1<<M)-1;(p&U)!=l[g];)g--,M-=E,U=(1<<M)-1}return 0!==P&&1!=y?x:d}function e(i){var e;for(t||(t=[],n=[],a=new Int32Array(S+1),r=[],_=new Int32Array(S),l=new Int32Array(S+1)),n.length<i&&(n=[]),e=0;i>e;e++)n[e]=0;for(e=0;S+1>e;e++)a[e]=0;for(e=0;3>e;e++)r[e]=0;_.set(a.subarray(0,S),0),l.set(a.subarray(0,S+1),0)}var t,n,a,r,_,l,s=this;s.inflate_trees_bits=function(a,r,_,l,d){var s;return e(19),t[0]=0,s=i(a,0,19,19,null,null,_,r,l,t,n),s==b?d.msg="oversubscribed dynamic bit lengths tree":(s==x||0===r[0])&&(d.msg="incomplete dynamic bit lengths tree",s=b),s},s.inflate_trees_dynamic=function(a,r,_,l,s,o,f,w,c){var v;return e(288),t[0]=0,v=i(_,0,a,257,p,A,o,l,w,t,n),v!=d||0===l[0]?(v==b?c.msg="oversubscribed literal/length tree":v!=u&&(c.msg="incomplete literal/length tree",v=b),v):(e(288),v=i(_,a,r,0,I,E,f,s,w,t,n),v!=d||0===s[0]&&a>257?(v==b?c.msg="oversubscribed distance tree":v==x?(c.msg="incomplete distance tree",v=b):v!=u&&(c.msg="empty distance tree with lengths",v=b),v):d)}}function t(){function i(i,e,t,n,a,r,_,l){var o,f,u,x,c,v,h,k,m,y,g,p,A,I,E,S;h=l.next_in_index,k=l.avail_in,c=_.bitb,v=_.bitk,m=_.write,y=m<_.read?_.read-m-1:_.end-m,g=w[i],p=w[e];do{for(;20>v;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;if(o=c&g,f=t,u=n,S=3*(u+o),0!==(x=f[S]))for(;;){if(c>>=f[S+1],v-=f[S+1],0!==(16&x)){for(x&=15,A=f[S+2]+(c&w[x]),c>>=x,v-=x;15>v;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;for(o=c&p,f=a,u=r,S=3*(u+o),x=f[S];;){if(c>>=f[S+1],v-=f[S+1],0!==(16&x)){for(x&=15;x>v;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;if(I=f[S+2]+(c&w[x]),c>>=x,v-=x,y-=A,m>=I)E=m-I,m-E>0&&2>m-E?(_.window[m++]=_.window[E++],_.window[m++]=_.window[E++],A-=2):(_.window.set(_.window.subarray(E,E+2),m),m+=2,E+=2,A-=2);else{E=m-I;do E+=_.end;while(0>E);if(x=_.end-E,A>x){if(A-=x,m-E>0&&x>m-E){do _.window[m++]=_.window[E++];while(0!==--x)}else _.window.set(_.window.subarray(E,E+x),m),m+=x,E+=x,x=0;E=0}}if(m-E>0&&A>m-E){do _.window[m++]=_.window[E++];while(0!==--A)}else _.window.set(_.window.subarray(E,E+A),m),m+=A,E+=A,A=0;break}if(0!==(64&x))return l.msg="invalid distance code",A=l.avail_in-k,A=A>v>>3?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,b;o+=f[S+2],o+=c&w[x],S=3*(u+o),x=f[S]}break}if(0!==(64&x))return 0!==(32&x)?(A=l.avail_in-k,A=A>v>>3?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,s):(l.msg="invalid literal/length code",A=l.avail_in-k,A=A>v>>3?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,b);if(o+=f[S+2],o+=c&w[x],S=3*(u+o),0===(x=f[S])){c>>=f[S+1],v-=f[S+1],_.window[m++]=f[S+2],y--;break}}else c>>=f[S+1],v-=f[S+1],_.window[m++]=f[S+2],y--}while(y>=258&&k>=10);return A=l.avail_in-k,A=A>v>>3?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,d}var e,t,n,a,r=this,_=0,l=0,o=0,u=0,x=0,c=0,v=0,h=0,k=0,m=0;r.init=function(i,r,_,l,d,s){e=U,v=i,h=r,n=_,k=l,a=d,m=s,t=null},r.proc=function(r,y,g){var p,A,I,E,S,F,G,H=0,J=0,K=0;for(K=y.next_in_index,E=y.avail_in,H=r.bitb,J=r.bitk,S=r.write,F=S<r.read?r.read-S-1:r.end-S;;)switch(e){case U:if(F>=258&&E>=10&&(r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,g=i(v,h,n,k,a,m,r,y),K=y.next_in_index,E=y.avail_in,H=r.bitb,J=r.bitk,S=r.write,F=S<r.read?r.read-S-1:r.end-S,g!=d)){e=g==s?q:C;break}o=v,t=n,l=k,e=z;case z:for(p=o;p>J;){if(0===E)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,E--,H|=(255&y.read_byte(K++))<<J,J+=8}if(A=3*(l+(H&w[p])),H>>>=t[A+1],J-=t[A+1],I=t[A],0===I){u=t[A+2],e=j;break}if(0!==(16&I)){x=15&I,_=t[A+2],e=D;break}if(0===(64&I)){o=I,l=A/3+t[A+2];break}if(0!==(32&I)){e=q;break}return e=C,y.msg="invalid literal/length code",g=b,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);case D:for(p=x;p>J;){if(0===E)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,E--,H|=(255&y.read_byte(K++))<<J,J+=8}_+=H&w[p],H>>=p,J-=p,o=h,t=a,l=m,e=M;case M:for(p=o;p>J;){if(0===E)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,E--,H|=(255&y.read_byte(K++))<<J,J+=8}if(A=3*(l+(H&w[p])),H>>=t[A+1],J-=t[A+1],I=t[A],0!==(16&I)){x=15&I,c=t[A+2],e=L;break}if(0===(64&I)){o=I,l=A/3+t[A+2];break}return e=C,y.msg="invalid distance code",g=b,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);case L:for(p=x;p>J;){if(0===E)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,E--,H|=(255&y.read_byte(K++))<<J,J+=8}c+=H&w[p],H>>=p,J-=p,e=P;case P:for(G=S-c;0>G;)G+=r.end;for(;0!==_;){if(0===F&&(S==r.end&&0!==r.read&&(S=0,F=S<r.read?r.read-S-1:r.end-S),0===F&&(r.write=S,g=r.inflate_flush(y,g),S=r.write,F=S<r.read?r.read-S-1:r.end-S,S==r.end&&0!==r.read&&(S=0,F=S<r.read?r.read-S-1:r.end-S),0===F)))return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);r.window[S++]=r.window[G++],F--,G==r.end&&(G=0),_--}e=U;break;case j:if(0===F&&(S==r.end&&0!==r.read&&(S=0,F=S<r.read?r.read-S-1:r.end-S),0===F&&(r.write=S,g=r.inflate_flush(y,g),S=r.write,F=S<r.read?r.read-S-1:r.end-S,S==r.end&&0!==r.read&&(S=0,F=S<r.read?r.read-S-1:r.end-S),0===F)))return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,r.window[S++]=u,F--,e=U;break;case q:if(J>7&&(J-=8,E++,K--),r.write=S,g=r.inflate_flush(y,g),S=r.write,F=S<r.read?r.read-S-1:r.end-S,r.read!=r.write)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);e=B;case B:return g=s,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);case C:return g=b,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);default:return g=f,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g)}},r.free=function(){}}function n(i,n){var a,r=this,_=G,l=0,o=0,u=0,v=[0],h=[0],k=new t,m=0,y=new Int32Array(3*c),g=0,p=new e;r.bitk=0,r.bitb=0,r.window=new Uint8Array(n),r.end=n,r.read=0,r.write=0,r.reset=function(i,e){e&&(e[0]=g),_==Q&&k.free(i),_=G,r.bitk=0,r.bitb=0,r.read=r.write=0},r.reset(i,null),r.inflate_flush=function(i,e){var t,n,a;return n=i.next_out_index,a=r.read,t=(a<=r.write?r.write:r.end)-a,t>i.avail_out&&(t=i.avail_out),0!==t&&e==x&&(e=d),i.avail_out-=t,i.total_out+=t,i.next_out.set(r.window.subarray(a,a+t),n),n+=t,a+=t,a==r.end&&(a=0,r.write==r.end&&(r.write=0),t=r.write-a,t>i.avail_out&&(t=i.avail_out),0!==t&&e==x&&(e=d),i.avail_out-=t,i.total_out+=t,i.next_out.set(r.window.subarray(a,a+t),n),n+=t,a+=t),i.next_out_index=n,r.read=a,e},r.proc=function(i,t){var n,x,c,g,A,I,E,S;for(g=i.next_in_index,A=i.avail_in,x=r.bitb,c=r.bitk,I=r.write,E=I<r.read?r.read-I-1:r.end-I;;)switch(_){case G:for(;3>c;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}switch(n=7&x,m=1&n,n>>>1){case 0:x>>>=3,c-=3,n=7&c,x>>>=n,c-=n,_=H;break;case 1:var U=[],z=[],D=[[]],M=[[]];e.inflate_trees_fixed(U,z,D,M),k.init(U[0],z[0],D[0],0,M[0],0),x>>>=3,c-=3,_=Q;break;case 2:x>>>=3,c-=3,_=K;break;case 3:return x>>>=3,c-=3,_=V,i.msg="invalid block type",t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t)}break;case H:for(;32>c;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}if((65535&~x>>>16)!=(65535&x))return _=V,i.msg="invalid stored block lengths",t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);l=65535&x,x=c=0,_=0!==l?J:0!==m?R:G;break;case J:if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);if(0===E&&(I==r.end&&0!==r.read&&(I=0,E=I<r.read?r.read-I-1:r.end-I),0===E&&(r.write=I,t=r.inflate_flush(i,t),I=r.write,E=I<r.read?r.read-I-1:r.end-I,I==r.end&&0!==r.read&&(I=0,E=I<r.read?r.read-I-1:r.end-I),0===E)))return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);if(t=d,n=l,n>A&&(n=A),n>E&&(n=E),r.window.set(i.read_buf(g,n),I),g+=n,A-=n,I+=n,E-=n,0!==(l-=n))break;_=0!==m?R:G;break;case K:for(;14>c;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}if(o=n=16383&x,(31&n)>29||(31&n>>5)>29)return _=V,i.msg="too many length or distance symbols",t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);if(n=258+(31&n)+(31&n>>5),!a||a.length<n)a=[];else for(S=0;n>S;S++)a[S]=0;x>>>=14,c-=14,u=0,_=N;case N:for(;4+(o>>>10)>u;){for(;3>c;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}a[F[u++]]=7&x,x>>>=3,c-=3}for(;19>u;)a[F[u++]]=0;if(v[0]=7,n=p.inflate_trees_bits(a,v,h,y,i),n!=d)return t=n,t==b&&(a=null,_=V),r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);u=0,_=O;case O:for(;;){if(n=o,!(258+(31&n)+(31&n>>5)>u))break;var L,P;for(n=v[0];n>c;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}if(n=y[3*(h[0]+(x&w[n]))+1],P=y[3*(h[0]+(x&w[n]))+2],16>P)x>>>=n,c-=n,a[u++]=P;else{for(S=18==P?7:P-14,L=18==P?11:3;n+S>c;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}if(x>>>=n,c-=n,L+=x&w[S],x>>>=S,c-=S,S=u,n=o,S+L>258+(31&n)+(31&n>>5)||16==P&&1>S)return a=null,_=V,i.msg="invalid bit length repeat",t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);P=16==P?a[S-1]:0;do a[S++]=P;while(0!==--L);u=S}}h[0]=-1;var j=[],q=[],B=[],C=[];if(j[0]=9,q[0]=6,n=o,n=p.inflate_trees_dynamic(257+(31&n),1+(31&n>>5),a,j,q,B,C,y,i),n!=d)return n==b&&(a=null,_=V),t=n,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);k.init(j[0],q[0],y,B[0],y,C[0]),_=Q;case Q:if(r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,(t=k.proc(r,i,t))!=s)return r.inflate_flush(i,t);if(t=d,k.free(i),g=i.next_in_index,A=i.avail_in,x=r.bitb,c=r.bitk,I=r.write,E=I<r.read?r.read-I-1:r.end-I,0===m){_=G;break}_=R;case R:if(r.write=I,t=r.inflate_flush(i,t),I=r.write,E=I<r.read?r.read-I-1:r.end-I,r.read!=r.write)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);_=T;case T:return t=s,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);case V:return t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);default:return t=f,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t)}},r.free=function(i){r.reset(i,null),r.window=null,y=null},r.set_dictionary=function(i,e,t){r.window.set(i.subarray(e,e+t),0),r.read=r.write=t},r.sync_point=function(){return _==H?1:0}}function a(){function i(i){return i&&i.istate?(i.total_in=i.total_out=0,i.msg=null,i.istate.mode=ae,i.istate.blocks.reset(i,null),d):f}var e=this;e.mode=0,e.method=0,e.was=[0],e.need=0,e.marker=0,e.wbits=0,e.inflateEnd=function(i){return e.blocks&&e.blocks.free(i),e.blocks=null,d},e.inflateInit=function(t,a){return t.msg=null,e.blocks=null,8>a||a>15?(e.inflateEnd(t),f):(e.wbits=a,t.istate.blocks=new n(t,1<<a),i(t),d)},e.inflate=function(i,e){var t,n;if(!i||!i.istate||!i.next_in)return f;for(e=e==h?x:d,t=x;;)switch(i.istate.mode){case Y:if(0===i.avail_in)return t;if(t=e,i.avail_in--,i.total_in++,(15&(i.istate.method=i.read_byte(i.next_in_index++)))!=X){i.istate.mode=_e,i.msg="unknown compression method",i.istate.marker=5;break}if((i.istate.method>>4)+8>i.istate.wbits){i.istate.mode=_e,i.msg="invalid window size",i.istate.marker=5;break}i.istate.mode=Z;case Z:if(0===i.avail_in)return t;if(t=e,i.avail_in--,i.total_in++,n=255&i.read_byte(i.next_in_index++),0!==((i.istate.method<<8)+n)%31){i.istate.mode=_e,i.msg="incorrect header check",i.istate.marker=5;break}if(0===(n&W)){i.istate.mode=ae;break}i.istate.mode=$;case $:if(0===i.avail_in)return t;t=e,i.avail_in--,i.total_in++,i.istate.need=4278190080&(255&i.read_byte(i.next_in_index++))<<24,i.istate.mode=ie;case ie:if(0===i.avail_in)return t;t=e,i.avail_in--,i.total_in++,i.istate.need+=16711680&(255&i.read_byte(i.next_in_index++))<<16,i.istate.mode=ee;case ee:if(0===i.avail_in)return t;t=e,i.avail_in--,i.total_in++,i.istate.need+=65280&(255&i.read_byte(i.next_in_index++))<<8,i.istate.mode=te;case te:return 0===i.avail_in?t:(t=e,i.avail_in--,i.total_in++,i.istate.need+=255&i.read_byte(i.next_in_index++),i.istate.mode=ne,o);case ne:return i.istate.mode=_e,i.msg="need dictionary",i.istate.marker=0,f;case ae:if(t=i.istate.blocks.proc(i,t),t==b){i.istate.mode=_e,i.istate.marker=0;break}if(t==d&&(t=e),t!=s)return t;t=e,i.istate.blocks.reset(i,i.istate.was),i.istate.mode=re;case re:return s;case _e:return b;default:return f}},e.inflateSetDictionary=function(i,e,t){var n=0,a=t;return i&&i.istate&&i.istate.mode==ne?(a>=1<<i.istate.wbits&&(a=(1<<i.istate.wbits)-1,n=t-a),i.istate.blocks.set_dictionary(e,n,a),i.istate.mode=ae,d):f},e.inflateSync=function(e){var t,n,a,r,_;if(!e||!e.istate)return f;if(e.istate.mode!=_e&&(e.istate.mode=_e,e.istate.marker=0),0===(t=e.avail_in))return x;for(n=e.next_in_index,a=e.istate.marker;0!==t&&4>a;)e.read_byte(n)==le[a]?a++:a=0!==e.read_byte(n)?0:4-a,n++,t--;return e.total_in+=n-e.next_in_index,e.next_in_index=n,e.avail_in=t,e.istate.marker=a,4!=a?b:(r=e.total_in,_=e.total_out,i(e),e.total_in=r,e.total_out=_,e.istate.mode=ae,d)},e.inflateSyncPoint=function(i){return i&&i.istate&&i.istate.blocks?i.istate.blocks.sync_point():f}}function r(){}function _(){var i=this,e=new r,t=512,n=v,a=new Uint8Array(t),_=!1;e.inflateInit(),e.next_out=a,i.append=function(i,r){var l,o,f=[],b=0,u=0,w=0;if(0!==i.length){e.next_in_index=0,e.next_in=i,e.avail_in=i.length;do{if(e.next_out_index=0,e.avail_out=t,0!==e.avail_in||_||(e.next_in_index=0,_=!0),l=e.inflate(n),_&&l==x)return-1;if(l!=d&&l!=s)throw"inflating: "+e.msg;if((_||l==s)&&e.avail_in==i.length)return-1;e.next_out_index&&(e.next_out_index==t?f.push(new Uint8Array(a)):f.push(new Uint8Array(a.subarray(0,e.next_out_index)))),w+=e.next_out_index,r&&e.next_in_index>0&&e.next_in_index!=b&&(r(e.next_in_index),b=e.next_in_index)}while(e.avail_in>0||0===e.avail_out);return o=new Uint8Array(w),f.forEach(function(i){o.set(i,u),u+=i.length}),o}},i.flush=function(){e.inflateEnd()}}var l=15,d=0,s=1,o=2,f=-2,b=-3,u=-4,x=-5,w=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],c=1440,v=0,h=4,k=9,m=5,y=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],g=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],p=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],A=[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,112,112],I=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],E=[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],S=15;e.inflate_trees_fixed=function(i,e,t,n){return i[0]=k,e[0]=m,t[0]=y,n[0]=g,d};var U=0,z=1,D=2,M=3,L=4,P=5,j=6,q=7,B=8,C=9,F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],G=0,H=1,J=2,K=3,N=4,O=5,Q=6,R=7,T=8,V=9,W=32,X=8,Y=0,Z=1,$=2,ie=3,ee=4,te=5,ne=6,ae=7,re=12,_e=13,le=[0,0,255,255];r.prototype={inflateInit:function(i){var e=this;return e.istate=new a,i||(i=l),e.istate.inflateInit(e,i)},inflate:function(i){var e=this;return e.istate?e.istate.inflate(e,i):f},inflateEnd:function(){var i=this;if(!i.istate)return f;var e=i.istate.inflateEnd(i);return i.istate=null,e},inflateSync:function(){var i=this;return i.istate?i.istate.inflateSync(i):f},inflateSetDictionary:function(i,e){var t=this;return t.istate?t.istate.inflateSetDictionary(t,i,e):f},read_byte:function(i){var e=this;return e.next_in.subarray(i,i+1)[0]},read_buf:function(i,e){var t=this;return t.next_in.subarray(i,i+e)}};var de;i.zip?i.zip.Inflater=_:(de=new _,i.addEventListener("message",function(e){var t=e.data;t.append&&i.postMessage({onappend:!0,data:de.append(t.data,function(e){i.postMessage({progress:!0,current:e})})}),t.flush&&(de.flush(),i.postMessage({onflush:!0}))},!1))}(this); \ No newline at end of file diff --git a/libs/Cesium/Widgets/Animation/Animation.css b/libs/Cesium/Widgets/Animation/Animation.css deleted file mode 100644 index e8487a2b..00000000 --- a/libs/Cesium/Widgets/Animation/Animation.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-animation-theme {visibility: hidden; display: block; position: absolute; z-index: -100;} .cesium-animation-themeNormal {color: #222;} .cesium-animation-themeHover {color: #4488B0;} .cesium-animation-themeSelect {color: #242;} .cesium-animation-themeDisabled {color: #333;} .cesium-animation-themeKnob {color: #222;} .cesium-animation-themePointer {color: #2E2;} .cesium-animation-themeSwoosh {color: #8AC;} .cesium-animation-themeSwooshHover {color: #AEF;} .cesium-animation-svgText {fill: #edffff; font-family: Sans-Serif; font-size: 15px; text-anchor: middle;} .cesium-animation-blank {fill: #000; fill-opacity: 0.01; stroke: none;} .cesium-animation-rectButton {cursor: pointer; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none;} .cesium-animation-rectButton .cesium-animation-buttonGlow {fill: #fff; stroke: none; display: none;} .cesium-animation-rectButton:hover .cesium-animation-buttonGlow {display: block;} .cesium-animation-rectButton .cesium-animation-buttonPath {fill: #edffff;} .cesium-animation-rectButton .cesium-animation-buttonMain {stroke: #444; stroke-width: 1.2;} .cesium-animation-rectButton:hover .cesium-animation-buttonMain {stroke: #AEF;} .cesium-animation-rectButton:active .cesium-animation-buttonMain {fill: #ABD6FF;} .cesium-animation-buttonDisabled {-moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none;} .cesium-animation-buttonDisabled .cesium-animation-buttonMain {stroke: #555;} .cesium-animation-buttonDisabled .cesium-animation-buttonPath {fill: #818181;} .cesium-animation-buttonDisabled .cesium-animation-buttonGlow {display: none;} .cesium-animation-buttonToggled .cesium-animation-buttonGlow {display: block; fill: #2E2;} .cesium-animation-buttonToggled .cesium-animation-buttonMain {stroke: #2E2;} .cesium-animation-buttonToggled:hover .cesium-animation-buttonGlow {fill: #fff;} .cesium-animation-buttonToggled:hover .cesium-animation-buttonMain {stroke: #2E2;} .cesium-animation-shuttleRingG {cursor: pointer;} .cesium-animation-shuttleRingPointer {cursor: pointer;} .cesium-animation-shuttleRingPausePointer {cursor: pointer;} .cesium-animation-shuttleRingBack {fill: #181818; fill-opacity: 0.8; stroke: #333; stroke-width: 1.2;} .cesium-animation-shuttleRingSwoosh line {stroke: #8AC; stroke-width: 3; stroke-opacity: 0.2; stroke-linecap: round;} .cesium-animation-knobOuter {cursor: pointer; stroke: #444; stroke-width: 1.2;} .cesium-animation-knobInner {cursor: pointer;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/Animation/lighter.css b/libs/Cesium/Widgets/Animation/lighter.css deleted file mode 100644 index f0446984..00000000 --- a/libs/Cesium/Widgets/Animation/lighter.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-lighter .cesium-animation-themeNormal {color: #E5F2FE;} .cesium-lighter .cesium-animation-themeHover {color: #ABD6FF;} .cesium-lighter .cesium-animation-themeSelect {color: #E5F2FE;} .cesium-lighter .cesium-animation-themeDisabled {color: #EFEFEF;} .cesium-lighter .cesium-animation-themeKnob {color: #E1E2E3;} .cesium-lighter .cesium-animation-themePointer {color: #FA5;} .cesium-lighter .cesium-animation-themeSwoosh {color: #ACE;} .cesium-lighter .cesium-animation-themeSwooshHover {color: #BDF;} .cesium-lighter .cesium-animation-svgText {fill: #111;} .cesium-lighter .cesium-animation-rectButton .cesium-animation-buttonPath {fill: #111;} .cesium-lighter .cesium-animation-rectButton .cesium-animation-buttonMain {stroke: #759DC0;} .cesium-lighter .cesium-animation-buttonToggled .cesium-animation-buttonGlow {fill: #FFAA2A;} .cesium-lighter .cesium-animation-buttonToggled .cesium-animation-buttonMain {stroke: #EA0;} .cesium-lighter .cesium-animation-rectButton:hover .cesium-animation-buttonMain {stroke: #759DC0;} .cesium-lighter .cesium-animation-buttonToggled:hover .cesium-animation-buttonGlow {fill: #fff;} .cesium-lighter .cesium-animation-buttonToggled:hover .cesium-animation-buttonMain {stroke: #EA0;} .cesium-lighter .cesium-animation-rectButton:active .cesium-animation-buttonMain {fill: #ABD6FF;} .cesium-lighter .cesium-animation-buttonDisabled .cesium-animation-buttonMain {stroke: #D3D3D3;} .cesium-lighter .cesium-animation-buttonDisabled .cesium-animation-buttonPath {fill: #818181;} .cesium-lighter .cesium-animation-shuttleRingBack {fill: #FAFAFA; fill-opacity: 1; stroke: #AEAEAE; stroke-width: 1.2;} .cesium-lighter .cesium-animation-shuttleRingSwoosh line {stroke: #8AC;} .cesium-lighter .cesium-animation-knobOuter {stroke: #A5A5A5;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/BaseLayerPicker/BaseLayerPicker.css b/libs/Cesium/Widgets/BaseLayerPicker/BaseLayerPicker.css deleted file mode 100644 index b411b9cb..00000000 --- a/libs/Cesium/Widgets/BaseLayerPicker/BaseLayerPicker.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-baseLayerPicker-selected {position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;} .cesium-baseLayerPicker-dropDown {display: block; position: absolute; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; top: auto; right: 0; width: 320px; max-height: 500px; margin-top: 5px; background-color: rgba(38, 38, 38, 0.75); border: 1px solid #444; padding: 6px; overflow: auto; border-radius: 10px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; -webkit-transform: translate(0, -20%); -moz-transform: translate(0, -20%); transform: translate(0, -20%); visibility: hidden; opacity: 0; -webkit-transition: visibility 0s 0.2s, opacity 0.2s ease-in, -webkit-transform 0.2s ease-in; -moz-transition: visibility 0s 0.2s, opacity 0.2s ease-in, -moz-transform 0.2s ease-in; transition: visibility 0s 0.2s, opacity 0.2s ease-in, transform 0.2s ease-in;} .cesium-baseLayerPicker-dropDown-visible {-webkit-transform: translate(0, 0); -moz-transform: translate(0, 0); transform: translate(0, 0); visibility: visible; opacity: 1; -webkit-transition: opacity 0.2s ease-out, -webkit-transform 0.2s ease-out; -moz-transition: opacity 0.2s ease-out, -moz-transform 0.2s ease-out; transition: opacity 0.2s ease-out, transform 0.2s ease-out;} .cesium-baseLayerPicker-sectionTitle {display: block; font-family: sans-serif; font-size: 16pt; text-align: left; color: #edffff; border-bottom: 1px solid #888; margin-bottom: 4px;} .cesium-baseLayerPicker-choices {display: block; position: relative; top: auto; right: 0;} .cesium-baseLayerPicker-item {display: inline-block; vertical-align: top; margin: 2px 5px; width: 64px; text-align: center; cursor: pointer;} .cesium-baseLayerPicker-itemLabel {display: block; font-family: sans-serif; font-size: 8pt; text-align: center; vertical-align: middle; color: #edffff; cursor: pointer; word-wrap: break-word;} .cesium-baseLayerPicker-item:hover .cesium-baseLayerPicker-itemLabel, .cesium-baseLayerPicker-item:focus .cesium-baseLayerPicker-itemLabel {text-decoration: underline;} .cesium-baseLayerPicker-itemIcon {display: inline-block; position: relative; width: inherit; height: auto; background-size: 100% 100%; border: solid 1px #444; border-radius: 9px; color: #edffff; margin: 0; padding: 0; cursor: pointer; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;} .cesium-baseLayerPicker-item:hover .cesium-baseLayerPicker-itemIcon {border-color: #fff; box-shadow: 0 0 8px #fff, 0 0 8px #fff;} .cesium-baseLayerPicker-selectedItem .cesium-baseLayerPicker-itemLabel {color: rgb(189, 236, 248);} .cesium-baseLayerPicker-selectedItem .cesium-baseLayerPicker-itemIcon {border: double 4px rgb(189, 236, 248);} \ No newline at end of file diff --git a/libs/Cesium/Widgets/BaseLayerPicker/lighter.css b/libs/Cesium/Widgets/BaseLayerPicker/lighter.css deleted file mode 100644 index 2b39fc02..00000000 --- a/libs/Cesium/Widgets/BaseLayerPicker/lighter.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-lighter .cesium-baseLayerPicker-itemIcon {border-color: #759dc0;} .cesium-lighter .cesium-baseLayerPicker-dropDown {background-color: rgba(240, 240, 240, 0.75);} .cesium-lighter .cesium-baseLayerPicker-sectionTitle {color: black;} .cesium-lighter .cesium-baseLayerPicker-itemLabel {color: black;} .cesium-lighter .cesium-baseLayerPicker-item:hover .cesium-baseLayerPicker-itemIcon {border-color: #000;} .cesium-lighter .cesium-baseLayerPicker-selectedItem .cesium-baseLayerPicker-itemLabel {color: rgb(0, 61, 168);} .cesium-lighter .cesium-baseLayerPicker-selectedItem .cesium-baseLayerPicker-itemIcon {border: double 4px rgb(0, 61, 168);} \ No newline at end of file diff --git a/libs/Cesium/Widgets/CesiumInspector/CesiumInspector.css b/libs/Cesium/Widgets/CesiumInspector/CesiumInspector.css deleted file mode 100644 index 8c65249d..00000000 --- a/libs/Cesium/Widgets/CesiumInspector/CesiumInspector.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-cesiumInspector {border-radius: 5px; -webkit-transition: width ease-in-out 0.25s; -moz-transition: width ease-in-out 0.25s; transition: width ease-in-out 0.25s; background: rgba(48, 51, 54, 0.8); border: 1px solid #444; color: #edffff; display: inline-block; position: relative; padding: 4px 12px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; overflow: hidden;} .cesium-cesiumInspector-button {text-align: center; font-size: 11pt;} .cesium-cesiumInspector-visible .cesium-cesiumInspector-button {border-bottom: 1px solid #aaa; padding-bottom: 3px;} .cesium-cesiumInspector input:enabled, .cesium-cesiumInspector-button {cursor: pointer;} .cesium-cesiumInspector-visible {width: 185px; height: auto;} .cesium-cesiumInspector-hidden {width: 122px; height: 17px;} .cesium-cesiumInspector-show {max-height: 500px;} .cesium-cesiumInspector-hide {max-height: 0; padding: 0 !important; overflow: hidden;} .cesium-cesiumInspector-dropDown {margin: 5px 0; font-family: sans-serif; font-size: 10pt; width: 185px;} .cesium-cesiumInspector-frustumStats {padding-left: 10px; padding: 5px; background-color: rgba(80, 80, 80, 0.75);} .cesium-cesiumInspector-pickButton {background-color: rgba(0, 0, 0, 0.3); border: 1px solid #444; color: #edffff; border-radius: 5px; padding: 3px 7px; cursor: pointer; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; margin: 0 auto;} .cesium-cesiumInspector-pickButton:focus {outline: none;} .cesium-cesiumInspector-pickButton:active, .cesium-cesiumInspector-pickButtonHighlight {color: #000; background: #adf; border-color: #fff; box-shadow: 0 0 8px #fff;} .cesium-cesiumInspector-center {text-align: center;} .cesium-cesiumInspector-sectionHeader {font-weight: bold;} .cesium-cesiumInspector-pickSection {border: 1px solid #aaa; border-radius: 5px; padding: 3px; margin-bottom: 5px;} .cesium-cesiumInspector-section {margin-bottom: 10px; -webkit-transition: max-height 0.25s; -moz-transition: max-height 0.25s; transition: max-height 0.25s;} .cesium-cesiumInspector-toggleSwitch {padding: 3px; cursor: pointer;} .cesium-cesiumInspector-tileText {padding-bottom: 10px; border-bottom: 1px solid #aaa;} .cesium-cesiumInspector-relativeText {padding-top: 10px;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/CesiumWidget/CesiumWidget.css b/libs/Cesium/Widgets/CesiumWidget/CesiumWidget.css deleted file mode 100644 index ed344d24..00000000 --- a/libs/Cesium/Widgets/CesiumWidget/CesiumWidget.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-widget {position: relative;} .cesium-widget, .cesium-widget canvas {width: 100%; height: 100%; touch-action: none;} .cesium-widget-credits {display: block; position: absolute; bottom: 0; left: 0; color: #fff; font-size: 10px; text-shadow: 0px 0px 2px #000000; padding-right: 5px;} .cesium-widget-credits a, .cesium-widget-credits a:visited {color: #fff;} .cesium-widget-errorPanel {position: absolute; top: 0; right: 0; bottom: 0; left: 0; text-align: center; background: rgba(0, 0, 0, 0.7); z-index: 99999;} .cesium-widget-errorPanel:before {display: inline-block; vertical-align: middle; height: 100%; content: "";} .cesium-widget-errorPanel-content {width: 75%; display: inline-block; text-align: left; vertical-align: middle; border: 1px solid #526F82; border-radius: 7px; background-color: black; color: white; font-size: 10pt; padding: 1em;} .cesium-widget-errorPanel-header {font-size: 120%; color: #fe4;} .cesium-widget-errorPanel-scroll {overflow: auto; font-family: monospace; white-space: pre-wrap; padding: 0; margin: 10px 0;} .cesium-widget-errorPanel-buttonPanel {text-align: center;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/CesiumWidget/lighter.css b/libs/Cesium/Widgets/CesiumWidget/lighter.css deleted file mode 100644 index 5b06a900..00000000 --- a/libs/Cesium/Widgets/CesiumWidget/lighter.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-lighter .cesium-widget-errorPanel {background: rgba(255, 255, 255, 0.7);} .cesium-lighter .cesium-widget-errorPanel-content {border: 1px solid #526F82; border-radius: 7px; background-color: white; color: black;} .cesium-lighter .cesium-widget-errorPanel-header {color: #B87D00;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/FullscreenButton/FullscreenButton.css b/libs/Cesium/Widgets/FullscreenButton/FullscreenButton.css deleted file mode 100644 index 8ac41b3e..00000000 --- a/libs/Cesium/Widgets/FullscreenButton/FullscreenButton.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-button.cesium-fullscreenButton {display: block; width: 100%; height: 100%; margin: 0; border-radius: 0;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/Geocoder/Geocoder.css b/libs/Cesium/Widgets/Geocoder/Geocoder.css deleted file mode 100644 index 21b5618f..00000000 --- a/libs/Cesium/Widgets/Geocoder/Geocoder.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-viewer-geocoderContainer .cesium-geocoder-input {border: solid 1px #444; background-color: rgba(40, 40, 40, 0.7); color: white; display: inline-block; vertical-align: middle; width: 0; height: 32px; margin: 0; padding: 0 32px 0 0; border-radius: 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; -webkit-transition: width ease-in-out 0.25s, background-color 0.2s ease-in-out; -moz-transition: width ease-in-out 0.25s, background-color 0.2s ease-in-out; transition: width ease-in-out 0.25s, background-color 0.2s ease-in-out; -webkit-appearance: none;} .cesium-viewer-geocoderContainer:hover .cesium-geocoder-input {border-color: #aef; box-shadow: 0 0 8px #fff;} .cesium-viewer-geocoderContainer .cesium-geocoder-input:focus {border-color: #ea4; background-color: rgba(15, 15, 15, 0.9); box-shadow: none; outline: none;} .cesium-viewer-geocoderContainer:hover .cesium-geocoder-input, .cesium-viewer-geocoderContainer .cesium-geocoder-input:focus, .cesium-viewer-geocoderContainer .cesium-geocoder-input-wide {padding-left: 4px; width: 250px;} .cesium-geocoder-searchButton {background-color: #303336; display: inline-block; position: absolute; cursor: pointer; width: 32px; top: 1px; right: 1px; height: 30px; vertical-align: middle; fill: #edffff;} .cesium-geocoder-searchButton:hover {background-color: #48b;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/Geocoder/lighter.css b/libs/Cesium/Widgets/Geocoder/lighter.css deleted file mode 100644 index a906d8fa..00000000 --- a/libs/Cesium/Widgets/Geocoder/lighter.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-lighter .cesium-geocoder-input {border: solid 1px #759dc0; background-color: rgba(240, 240, 240, 0.9); color: black;} .cesium-lighter .cesium-viewer-geocoderContainer:hover .cesium-geocoder-input {border-color: #aef; box-shadow: 0 0 8px #fff;} .cesium-lighter .cesium-geocoder-searchButton {background-color: #e2f0ff; fill: #111;} .cesium-lighter .cesium-geocoder-searchButton:hover {background-color: #a6d2ff;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/Cesium_Logo_overlay.png b/libs/Cesium/Widgets/Images/Cesium_Logo_overlay.png deleted file mode 100644 index fb156163..00000000 Binary files a/libs/Cesium/Widgets/Images/Cesium_Logo_overlay.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/bingAerial.png b/libs/Cesium/Widgets/Images/ImageryProviders/bingAerial.png deleted file mode 100644 index a78a154b..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/bingAerial.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png b/libs/Cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png deleted file mode 100644 index 4cafd40f..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/bingRoads.png b/libs/Cesium/Widgets/Images/ImageryProviders/bingRoads.png deleted file mode 100644 index 282d6ada..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/bingRoads.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/blackMarble.png b/libs/Cesium/Widgets/Images/ImageryProviders/blackMarble.png deleted file mode 100644 index 45e0fc7b..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/blackMarble.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/esriNationalGeographic.png b/libs/Cesium/Widgets/Images/ImageryProviders/esriNationalGeographic.png deleted file mode 100644 index bcfdd0b2..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/esriNationalGeographic.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/esriWorldImagery.png b/libs/Cesium/Widgets/Images/ImageryProviders/esriWorldImagery.png deleted file mode 100644 index a9429daf..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/esriWorldImagery.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/esriWorldStreetMap.png b/libs/Cesium/Widgets/Images/ImageryProviders/esriWorldStreetMap.png deleted file mode 100644 index dfbc1f42..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/esriWorldStreetMap.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png b/libs/Cesium/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png deleted file mode 100644 index f2eba410..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/naturalEarthII.png b/libs/Cesium/Widgets/Images/ImageryProviders/naturalEarthII.png deleted file mode 100644 index 50271c79..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/naturalEarthII.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/openStreetMap.png b/libs/Cesium/Widgets/Images/ImageryProviders/openStreetMap.png deleted file mode 100644 index 84acdb80..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/openStreetMap.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/stamenToner.png b/libs/Cesium/Widgets/Images/ImageryProviders/stamenToner.png deleted file mode 100644 index af894096..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/stamenToner.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png b/libs/Cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png deleted file mode 100644 index 552130eb..00000000 Binary files a/libs/Cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/Mouse.svg b/libs/Cesium/Widgets/Images/NavigationHelp/Mouse.svg deleted file mode 100644 index 7fae028c..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/Mouse.svg +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Layer_1" - x="0px" - y="0px" - width="29.6875" - height="40.625095" - viewBox="0 0 29.6875 40.625095" - enable-background="new 0 0 64 64" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="Mouse.svg"><metadata - id="metadata21"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs19" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="747" - inkscape:window-height="596" - id="namedview17" - showgrid="false" - inkscape:zoom="1.84375" - inkscape:cx="-37.919388" - inkscape:cy="92.305679" - inkscape:window-x="266" - inkscape:window-y="72" - inkscape:window-maximized="0" - inkscape:current-layer="Layer_1" - inkscape:snap-center="false" - inkscape:snap-page="false" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" /> -<g - id="g3" - transform="translate(-17.15625,-19.531154)"> - <g - id="g5" - style="fill:#4d4d4d;stroke:#4d4d4d"> - <path - d="M 31.9335,20.041 C 24.639,20.034 17.653,20.318 17.653,44.617 c 0,10.951 8.799,15.032 14.347,15.032 5.545,0 14.347,-4.081 14.347,-15.032 0,-24.27 -7.119,-24.569 -14.4135,-24.576 z m 0.7515,1.358 c 5.643,0.012 10.927,0.236 12.063,16.153 -3.86,1.805 -7.916,2.765 -12.063,2.86 l 0,-2.966 c 0.845,-0.162 1.481,-0.909 1.481,-1.782 l 0,-8.956 c 0,-0.876 -0.637,-1.621 -1.481,-1.784 z m -1.027,4.855 0.685,0 c 0.249,0 0.453,0.205 0.453,0.454 l 0,8.956 c 0,0.249 -0.204,0.449 -0.453,0.449 l -0.685,0 c -0.249,0 -0.452,-0.2 -0.452,-0.449 l 0,-8.956 c 0,-0.249 0.203,-0.454 0.452,-0.454 z m -0.345,-4.855 0,3.525 c -0.845,0.163 -1.479,0.91 -1.479,1.784 l 0,8.956 c 0,0.873 0.634,1.62 1.479,1.782 l 0,2.966 C 25.002,40.264 20.408,38.16 19.25,37.573 20.381,21.633 25.668,21.411 31.313,21.399 z M 32,58.274 c -5.016,0 -12.976,-3.707 -12.976,-13.658 0,-1.983 0.045,-3.853 0.134,-5.563 2.003,0.929 6.696,2.74 12.868,2.74 4.394,0 8.704,-0.934 12.813,-2.771 0.089,1.718 0.135,3.6 0.135,5.595 0,9.95 -7.958,13.657 -12.974,13.657 z" - id="path7" - style="fill:#4d4d4d;stroke:#4d4d4d" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cssscccccssccsssssssssccssccccsscscss" /> - </g> - - -<path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 32.922034,38.950793 c 0,-1.135825 0.114919,-1.458045 0.677966,-1.900938 l 0.677966,-0.533288 0,-5.28078 c 0,-5.271249 -0.0012,-5.282003 -0.677966,-5.958745 -0.557439,-0.557439 -0.677966,-0.940935 -0.677966,-2.157165 l 0,-1.479199 1.535487,0 c 5.657554,0 8.584338,3.728529 9.71855,12.380791 0.498434,3.802265 0.50348,3.525731 -0.0676,3.704572 -0.261017,0.08174 -1.528694,0.512016 -2.817059,0.956167 -2.037206,0.702306 -4.048032,1.113044 -7.488026,1.529528 l -0.881356,0.106707 0,-1.36765 z" - id="path3768" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 31.485081,35.842143 c -0.104591,-0.104591 -0.190166,-2.231347 -0.190166,-4.726123 0,-3.983994 0.05502,-4.557071 0.452127,-4.709456 0.24867,-0.09542 0.556802,-0.06882 0.684738,0.05912 0.127937,0.127936 0.199056,2.296481 0.158043,4.818988 -0.06319,3.886405 -0.13867,4.598683 -0.494572,4.667009 -0.231003,0.04435 -0.505579,-0.0049 -0.61017,-0.109533 l 0,0 z" - id="path3770" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 30.440433,57.945316 c -3.064053,-0.42113 -6.77723,-2.474953 -8.457621,-4.67806 -2.1588,-2.830333 -3.113918,-6.737716 -2.769592,-11.330385 l 0.193121,-2.575872 2.07988,0.735628 c 3.527026,1.247466 6.337701,1.719068 10.215474,1.71405 4.171771,-0.0054 6.642981,-0.38868 10.25836,-1.591058 2.178973,-0.724668 2.692193,-0.815856 2.813444,-0.499883 0.08157,0.21256 0.08664,2.119864 0.01127,4.238453 -0.106217,2.98581 -0.266531,4.212938 -0.712935,5.457208 -1.450217,4.042206 -4.401118,6.844156 -8.437938,8.012017 -2.314747,0.669661 -3.34314,0.772215 -5.193465,0.517902 z" - id="path3772" - inkscape:connector-curvature="0" /></g> -<path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644;stroke-opacity:1" - d="M 11.584306,20.532528 C 9.1265112,20.247533 6.2927846,19.555647 4.1047676,18.706316 c -0.969492,-0.376332 -1.792939,-0.704961 -1.829884,-0.730287 -0.152564,-0.104584 0.766016,-6.242541 1.16801,-7.804656 1.421191,-5.5226316 4.304477,-8.0618496 9.1542404,-8.0618496 l 1.541531,0 0,1.627119 c 0,1.237125 -0.09381,1.627118 -0.391402,1.627118 -0.215271,0 -0.581373,0.271221 -0.813559,0.602714 -0.345889,0.493826 -0.422157,1.5275241 -0.422157,5.7217066 l 0,5.118992 0.813559,0.759978 c 0.675846,0.631335 0.813559,0.971083 0.813559,2.007108 0,0.835921 -0.111771,1.235378 -0.338983,1.211489 -0.18644,-0.0196 -1.18336,-0.133551 -2.215376,-0.25322 l 0,0 z" - id="path3766" - inkscape:connector-curvature="0" /></svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/MouseLeft.svg b/libs/Cesium/Widgets/Images/NavigationHelp/MouseLeft.svg deleted file mode 100644 index 0c49c15f..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/MouseLeft.svg +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Layer_1" - x="0px" - y="0px" - width="64px" - height="64px" - viewBox="0 0 64 64" - enable-background="new 0 0 64 64" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="MouseLeft.svg"><metadata - id="metadata21"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs19" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1282" - inkscape:window-height="886" - id="namedview17" - showgrid="false" - inkscape:zoom="3.6875" - inkscape:cx="-10.305085" - inkscape:cy="32" - inkscape:window-x="104" - inkscape:window-y="136" - inkscape:window-maximized="0" - inkscape:current-layer="g3" /> -<g - id="g3"> - <g - id="g5" - style="fill:#4d4d4d;stroke:#4d4d4d"> - <path - fill="#020202" - d="M32.854,20.028c-0.015-1.274,0.576-2.269,1.151-3.236c0.758-1.278,1.543-2.6,0.997-4.417 c-0.555-1.667-1.607-2.485-2.539-3.212c-1.254-0.973-2.159-1.676-1.687-4.343l0.041-0.229l-1.35-0.238L29.427,4.58 c-0.615,3.484,0.878,4.643,2.195,5.666c0.85,0.663,1.653,1.288,2.072,2.542c0.366,1.224-0.18,2.143-0.869,3.306 c-0.641,1.081-1.366,2.3-1.349,3.933c-6.837,0.007-13.823,0.291-13.823,24.59c0,10.951,8.799,15.032,14.347,15.032 c5.545,0,14.347-4.081,14.347-15.032C46.347,20.347,39.228,20.048,32.854,20.028z M32.685,21.399 c5.643,0.012,10.927,0.236,12.063,16.153c-3.86,1.805-7.916,2.765-12.063,2.86v-2.966c0.845-0.162,1.481-0.909,1.481-1.782v-8.956 c0-0.876-0.637-1.621-1.481-1.784V21.399z M31.658,26.254h0.685c0.249,0,0.453,0.205,0.453,0.454v8.956 c0,0.249-0.204,0.449-0.453,0.449h-0.685c-0.249,0-0.452-0.2-0.452-0.449v-8.956C31.206,26.459,31.409,26.254,31.658,26.254z M31.313,21.399v3.525c-0.845,0.163-1.479,0.91-1.479,1.784v8.956c0,0.873,0.634,1.62,1.479,1.782v2.966 c-6.311-0.148-10.905-2.252-12.063-2.839C20.381,21.633,25.668,21.411,31.313,21.399z M32,58.274 c-5.016,0-12.976-3.707-12.976-13.658c0-1.983,0.045-3.853,0.134-5.563c2.003,0.929,6.696,2.74,12.868,2.74 c4.394,0,8.704-0.934,12.813-2.771c0.089,1.718,0.135,3.6,0.135,5.595C44.974,54.567,37.016,58.274,32,58.274z" - id="path7" - style="fill:#4d4d4d;stroke:#4d4d4d" /> - </g> - - -<path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 32.922034,38.950793 c 0,-1.135825 0.114919,-1.458045 0.677966,-1.900938 l 0.677966,-0.533288 0,-5.28078 c 0,-5.271249 -0.0012,-5.282003 -0.677966,-5.958745 -0.557439,-0.557439 -0.677966,-0.940935 -0.677966,-2.157165 l 0,-1.479199 1.535487,0 c 5.657554,0 8.584338,3.728529 9.71855,12.380791 0.498434,3.802265 0.50348,3.525731 -0.0676,3.704572 -0.261017,0.08174 -1.528694,0.512016 -2.817059,0.956167 -2.037206,0.702306 -4.048032,1.113044 -7.488026,1.529528 l -0.881356,0.106707 0,-1.36765 z" - id="path3768" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 31.485081,35.842143 c -0.104591,-0.104591 -0.190166,-2.231347 -0.190166,-4.726123 0,-3.983994 0.05502,-4.557071 0.452127,-4.709456 0.24867,-0.09542 0.556802,-0.06882 0.684738,0.05912 0.127937,0.127936 0.199056,2.296481 0.158043,4.818988 -0.06319,3.886405 -0.13867,4.598683 -0.494572,4.667009 -0.231003,0.04435 -0.505579,-0.0049 -0.61017,-0.109533 l 0,0 z" - id="path3770" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 30.440433,57.945316 c -3.064053,-0.42113 -6.77723,-2.474953 -8.457621,-4.67806 -2.1588,-2.830333 -3.113918,-6.737716 -2.769592,-11.330385 l 0.193121,-2.575872 2.07988,0.735628 c 3.527026,1.247466 6.337701,1.719068 10.215474,1.71405 4.171771,-0.0054 6.642981,-0.38868 10.25836,-1.591058 2.178973,-0.724668 2.692193,-0.815856 2.813444,-0.499883 0.08157,0.21256 0.08664,2.119864 0.01127,4.238453 -0.106217,2.98581 -0.266531,4.212938 -0.712935,5.457208 -1.450217,4.042206 -4.401118,6.844156 -8.437938,8.012017 -2.314747,0.669661 -3.34314,0.772215 -5.193465,0.517902 z" - id="path3772" - inkscape:connector-curvature="0" /></g> -<path - style="fill:#66CCFF;stroke:#66CCFF;stroke-width:0.27118643999999997" - d="m 28.740556,40.063682 c -2.457795,-0.284995 -5.291522,-0.976881 -7.479539,-1.826212 -0.969492,-0.376332 -1.792939,-0.704961 -1.829884,-0.730287 -0.152564,-0.104584 0.766016,-6.242541 1.16801,-7.804656 1.421191,-5.522631 4.304477,-8.061849 9.154241,-8.061849 l 1.541531,0 0,1.627119 c 0,1.237125 -0.09381,1.627118 -0.391402,1.627118 -0.215271,0 -0.581373,0.271221 -0.813559,0.602714 -0.345889,0.493826 -0.422157,1.527524 -0.422157,5.721706 l 0,5.118992 0.813559,0.759978 c 0.675846,0.631335 0.813559,0.971083 0.813559,2.007108 0,0.835921 -0.111771,1.235378 -0.338983,1.211489 -0.18644,-0.0196 -1.18336,-0.133551 -2.215376,-0.25322 l 0,0 z" - id="path3766" - inkscape:connector-curvature="0" /></svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/MouseMiddle.svg b/libs/Cesium/Widgets/Images/NavigationHelp/MouseMiddle.svg deleted file mode 100644 index 9dd533d5..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/MouseMiddle.svg +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Layer_1" - x="0px" - y="0px" - width="64px" - height="64px" - viewBox="0 0 64 64" - enable-background="new 0 0 64 64" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="MouseMiddle.svg"><metadata - id="metadata21"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs19" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1282" - inkscape:window-height="886" - id="namedview17" - showgrid="false" - inkscape:zoom="3.6875" - inkscape:cx="-10.305085" - inkscape:cy="32" - inkscape:window-x="31" - inkscape:window-y="15" - inkscape:window-maximized="0" - inkscape:current-layer="g3" /> -<g - id="g3"> - <g - id="g5" - style="stroke:#4d4d4d;fill:#4d4d4d"> - <path - fill="#020202" - d="M32.854,20.028c-0.015-1.274,0.576-2.269,1.151-3.236c0.758-1.278,1.543-2.6,0.997-4.417 c-0.555-1.667-1.607-2.485-2.539-3.212c-1.254-0.973-2.159-1.676-1.687-4.343l0.041-0.229l-1.35-0.238L29.427,4.58 c-0.615,3.484,0.878,4.643,2.195,5.666c0.85,0.663,1.653,1.288,2.072,2.542c0.366,1.224-0.18,2.143-0.869,3.306 c-0.641,1.081-1.366,2.3-1.349,3.933c-6.837,0.007-13.823,0.291-13.823,24.59c0,10.951,8.799,15.032,14.347,15.032 c5.545,0,14.347-4.081,14.347-15.032C46.347,20.347,39.228,20.048,32.854,20.028z M32.685,21.399 c5.643,0.012,10.927,0.236,12.063,16.153c-3.86,1.805-7.916,2.765-12.063,2.86v-2.966c0.845-0.162,1.481-0.909,1.481-1.782v-8.956 c0-0.876-0.637-1.621-1.481-1.784V21.399z M31.658,26.254h0.685c0.249,0,0.453,0.205,0.453,0.454v8.956 c0,0.249-0.204,0.449-0.453,0.449h-0.685c-0.249,0-0.452-0.2-0.452-0.449v-8.956C31.206,26.459,31.409,26.254,31.658,26.254z M31.313,21.399v3.525c-0.845,0.163-1.479,0.91-1.479,1.784v8.956c0,0.873,0.634,1.62,1.479,1.782v2.966 c-6.311-0.148-10.905-2.252-12.063-2.839C20.381,21.633,25.668,21.411,31.313,21.399z M32,58.274 c-5.016,0-12.976-3.707-12.976-13.658c0-1.983,0.045-3.853,0.134-5.563c2.003,0.929,6.696,2.74,12.868,2.74 c4.394,0,8.704-0.934,12.813-2.771c0.089,1.718,0.135,3.6,0.135,5.595C44.974,54.567,37.016,58.274,32,58.274z" - id="path7" - style="stroke:#4d4d4d;fill:#4d4d4d" /> - </g> - - -<path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118643999999997" - d="m 32.922034,38.950793 c 0,-1.135825 0.114919,-1.458045 0.677966,-1.900938 l 0.677966,-0.533288 0,-5.28078 c 0,-5.271249 -0.0012,-5.282003 -0.677966,-5.958745 -0.557439,-0.557439 -0.677966,-0.940935 -0.677966,-2.157165 l 0,-1.479199 1.535487,0 c 5.657554,0 8.584338,3.728529 9.71855,12.380791 0.498434,3.802265 0.50348,3.525731 -0.0676,3.704572 -0.261017,0.08174 -1.528694,0.512016 -2.817059,0.956167 -2.037206,0.702306 -4.048032,1.113044 -7.488026,1.529528 l -0.881356,0.106707 0,-1.36765 z" - id="path3768" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 30.440433,57.945316 c -3.064053,-0.42113 -6.77723,-2.474953 -8.457621,-4.67806 -2.1588,-2.830333 -3.113918,-6.737716 -2.769592,-11.330385 l 0.193121,-2.575872 2.07988,0.735628 c 3.527026,1.247466 6.337701,1.719068 10.215474,1.71405 4.171771,-0.0054 6.642981,-0.38868 10.25836,-1.591058 2.178973,-0.724668 2.692193,-0.815856 2.813444,-0.499883 0.08157,0.21256 0.08664,2.119864 0.01127,4.238453 -0.106217,2.98581 -0.266531,4.212938 -0.712935,5.457208 -1.450217,4.042206 -4.401118,6.844156 -8.437938,8.012017 -2.314747,0.669661 -3.34314,0.772215 -5.193465,0.517902 z" - id="path3772" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 28.740556,40.063682 c -2.457795,-0.284995 -5.291522,-0.976881 -7.479539,-1.826212 -0.969492,-0.376332 -1.792939,-0.704961 -1.829884,-0.730287 -0.152564,-0.104584 0.766016,-6.242541 1.16801,-7.804656 1.421191,-5.522631 4.304477,-8.061849 9.154241,-8.061849 l 1.541531,0 0,1.627119 c 0,1.237125 -0.09381,1.627118 -0.391402,1.627118 -0.215271,0 -0.581373,0.271221 -0.813559,0.602714 -0.345889,0.493826 -0.422157,1.527524 -0.422157,5.721706 l 0,5.118992 0.813559,0.759978 c 0.675846,0.631335 0.813559,0.971083 0.813559,2.007108 0,0.835921 -0.111771,1.235378 -0.338983,1.211489 -0.18644,-0.0196 -1.18336,-0.133551 -2.215376,-0.25322 l 0,0 z" - id="path3778" - inkscape:connector-curvature="0" /><path - style="fill:#ffd800;stroke:#ffd800;stroke-width:0.33870965" - d="m 31.356243,35.809264 c -0.164314,-0.103856 -0.298753,-2.215682 -0.298753,-4.692945 0,-3.956026 0.08644,-4.52508 0.710296,-4.676395 0.390663,-0.09475 0.87474,-0.06834 1.075729,0.0587 0.200991,0.127038 0.312719,2.28036 0.248288,4.785159 -0.09927,3.859122 -0.217853,4.566401 -0.776977,4.634247 -0.362909,0.04404 -0.79427,-0.0049 -0.958583,-0.108765 l 0,0 z" - id="path3770" - inkscape:connector-curvature="0" /></g> -</svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/MouseRight.svg b/libs/Cesium/Widgets/Images/NavigationHelp/MouseRight.svg deleted file mode 100644 index 2662ad18..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/MouseRight.svg +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Layer_1" - x="0px" - y="0px" - width="64px" - height="64px" - viewBox="0 0 64 64" - enable-background="new 0 0 64 64" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="MouseRight.svg"><metadata - id="metadata21"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs19" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1282" - inkscape:window-height="886" - id="namedview17" - showgrid="false" - inkscape:zoom="3.6875" - inkscape:cx="32" - inkscape:cy="32" - inkscape:window-x="31" - inkscape:window-y="15" - inkscape:window-maximized="0" - inkscape:current-layer="g3" /> -<g - id="g3"> - <g - id="g5" - style="stroke:#4d4d4d;fill:#4d4d4d"> - <path - fill="#020202" - d="M32.854,20.028c-0.015-1.274,0.576-2.269,1.151-3.236c0.758-1.278,1.543-2.6,0.997-4.417 c-0.555-1.667-1.607-2.485-2.539-3.212c-1.254-0.973-2.159-1.676-1.687-4.343l0.041-0.229l-1.35-0.238L29.427,4.58 c-0.615,3.484,0.878,4.643,2.195,5.666c0.85,0.663,1.653,1.288,2.072,2.542c0.366,1.224-0.18,2.143-0.869,3.306 c-0.641,1.081-1.366,2.3-1.349,3.933c-6.837,0.007-13.823,0.291-13.823,24.59c0,10.951,8.799,15.032,14.347,15.032 c5.545,0,14.347-4.081,14.347-15.032C46.347,20.347,39.228,20.048,32.854,20.028z M32.685,21.399 c5.643,0.012,10.927,0.236,12.063,16.153c-3.86,1.805-7.916,2.765-12.063,2.86v-2.966c0.845-0.162,1.481-0.909,1.481-1.782v-8.956 c0-0.876-0.637-1.621-1.481-1.784V21.399z M31.658,26.254h0.685c0.249,0,0.453,0.205,0.453,0.454v8.956 c0,0.249-0.204,0.449-0.453,0.449h-0.685c-0.249,0-0.452-0.2-0.452-0.449v-8.956C31.206,26.459,31.409,26.254,31.658,26.254z M31.313,21.399v3.525c-0.845,0.163-1.479,0.91-1.479,1.784v8.956c0,0.873,0.634,1.62,1.479,1.782v2.966 c-6.311-0.148-10.905-2.252-12.063-2.839C20.381,21.633,25.668,21.411,31.313,21.399z M32,58.274 c-5.016,0-12.976-3.707-12.976-13.658c0-1.983,0.045-3.853,0.134-5.563c2.003,0.929,6.696,2.74,12.868,2.74 c4.394,0,8.704-0.934,12.813-2.771c0.089,1.718,0.135,3.6,0.135,5.595C44.974,54.567,37.016,58.274,32,58.274z" - id="path7" - style="stroke:#4d4d4d;fill:#4d4d4d" /> - </g> - - -<path - style="fill:#65FD00;stroke:#65FD00;stroke-width:0.27118643999999997" - d="m 32.922034,38.950793 c 0,-1.135825 0.114919,-1.458045 0.677966,-1.900938 l 0.677966,-0.533288 0,-5.28078 c 0,-5.271249 -0.0012,-5.282003 -0.677966,-5.958745 -0.557439,-0.557439 -0.677966,-0.940935 -0.677966,-2.157165 l 0,-1.479199 1.535487,0 c 5.657554,0 8.584338,3.728529 9.71855,12.380791 0.498434,3.802265 0.50348,3.525731 -0.0676,3.704572 -0.261017,0.08174 -1.528694,0.512016 -2.817059,0.956167 -2.037206,0.702306 -4.048032,1.113044 -7.488026,1.529528 l -0.881356,0.106707 0,-1.36765 z" - id="path3768" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 31.485081,35.842143 c -0.104591,-0.104591 -0.190166,-2.231347 -0.190166,-4.726123 0,-3.983994 0.05502,-4.557071 0.452127,-4.709456 0.24867,-0.09542 0.556802,-0.06882 0.684738,0.05912 0.127937,0.127936 0.199056,2.296481 0.158043,4.818988 -0.06319,3.886405 -0.13867,4.598683 -0.494572,4.667009 -0.231003,0.04435 -0.505579,-0.0049 -0.61017,-0.109533 l 0,0 z" - id="path3770" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 30.440433,57.945316 c -3.064053,-0.42113 -6.77723,-2.474953 -8.457621,-4.67806 -2.1588,-2.830333 -3.113918,-6.737716 -2.769592,-11.330385 l 0.193121,-2.575872 2.07988,0.735628 c 3.527026,1.247466 6.337701,1.719068 10.215474,1.71405 4.171771,-0.0054 6.642981,-0.38868 10.25836,-1.591058 2.178973,-0.724668 2.692193,-0.815856 2.813444,-0.499883 0.08157,0.21256 0.08664,2.119864 0.01127,4.238453 -0.106217,2.98581 -0.266531,4.212938 -0.712935,5.457208 -1.450217,4.042206 -4.401118,6.844156 -8.437938,8.012017 -2.314747,0.669661 -3.34314,0.772215 -5.193465,0.517902 z" - id="path3772" - inkscape:connector-curvature="0" /><path - style="fill:#ffffff;stroke:#ffffff;stroke-width:0.27118644" - d="m 28.740556,40.063682 c -2.457795,-0.284995 -5.291522,-0.976881 -7.479539,-1.826212 -0.969492,-0.376332 -1.792939,-0.704961 -1.829884,-0.730287 -0.152564,-0.104584 0.766016,-6.242541 1.16801,-7.804656 1.421191,-5.522631 4.304477,-8.061849 9.154241,-8.061849 l 1.541531,0 0,1.627119 c 0,1.237125 -0.09381,1.627118 -0.391402,1.627118 -0.215271,0 -0.581373,0.271221 -0.813559,0.602714 -0.345889,0.493826 -0.422157,1.527524 -0.422157,5.721706 l 0,5.118992 0.813559,0.759978 c 0.675846,0.631335 0.813559,0.971083 0.813559,2.007108 0,0.835921 -0.111771,1.235378 -0.338983,1.211489 -0.18644,-0.0196 -1.18336,-0.133551 -2.215376,-0.25322 l 0,0 z" - id="path3778" - inkscape:connector-curvature="0" /></g> -</svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/Touch.svg b/libs/Cesium/Widgets/Images/NavigationHelp/Touch.svg deleted file mode 100644 index e682b301..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/Touch.svg +++ /dev/null @@ -1,120 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Capa_1" - x="0px" - y="0px" - width="76.664284" - height="128.25087" - viewBox="0 0 76.664283 128.25086" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="Touch.svg"><metadata - id="metadata3468"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs3466" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="920" - inkscape:window-height="780" - id="namedview3464" - showgrid="false" - inkscape:zoom="1.7688899" - inkscape:cx="-0.07794217" - inkscape:cy="94.239301" - inkscape:window-x="1529" - inkscape:window-y="186" - inkscape:window-maximized="0" - inkscape:current-layer="g3428" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" /> -<g - id="g3428" - transform="translate(-7.9878665e-4,-5.1661327)"> - - <path - d="M 76.151,80.896 C 77.465,66.89 62.145,65.577 62.145,65.577 57.771,52.885 46.39,59.45 46.39,59.45 40.701,46.758 29.322,55.511 29.322,55.511 27.912,55.092 25.613,11.796 24.414,11.604 23.44,7.068 14.011,-1.728 12.511,14.772 c 0,36.5 -1.135,47.304 -1.135,47.304 C 9.188,67.328 5.31,80.458 5.31,80.458 -3.006,89.649 0.933,96.214 0.933,96.214 c 7.002,12.255 21.385,28.449 21.385,28.449 6.129,5.252 2.627,8.316 2.627,8.316 l 42.455,0.438 2.334,-7.878 c 9.628,-18.382 6.417,-44.643 6.417,-44.643 z" - id="path3432" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccccccccc" - style="fill:#ffffff;fill-opacity:1" /> -</g> -<g - id="g3434" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3436" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3438" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3440" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3442" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3444" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3446" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3448" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3450" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3452" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3454" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3456" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3458" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3460" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -<g - id="g3462" - transform="translate(-7.9878665e-4,-5.1661327)"> -</g> -</svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/TouchDrag.svg b/libs/Cesium/Widgets/Images/NavigationHelp/TouchDrag.svg deleted file mode 100644 index f0509e85..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/TouchDrag.svg +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Capa_1" - x="0px" - y="0px" - width="76.664284" - height="133.41701" - viewBox="0 0 76.664283 133.417" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="TouchDrag.svg"><metadata - id="metadata3468"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs3466" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="920" - inkscape:window-height="780" - id="namedview3464" - showgrid="false" - inkscape:zoom="1.7688899" - inkscape:cx="-0.077942171" - inkscape:cy="94.239298" - inkscape:window-x="161" - inkscape:window-y="225" - inkscape:window-maximized="0" - inkscape:current-layer="g3428" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" /> -<g - id="g3428" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> - <path - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd" - d="M 18.653,0 C 12.359,0 7.258,5.102 7.258,11.395 c 0,6.293 5.102,11.395 11.396,11.395 6.293,0 11.395,-5.102 11.395,-11.395 C 30.048,5.102 24.946,0 18.653,0 z m 0,20.43 c -4.989,0 -9.036,-4.046 -9.036,-9.036 0,-4.989 4.047,-9.035 9.036,-9.035 4.989,0 9.035,4.046 9.035,9.035 0,4.99 -4.045,9.036 -9.035,9.036 z" - id="path3430" - inkscape:connector-curvature="0" /> - <path - d="M 76.151,80.896 C 77.465,66.89 62.145,65.577 62.145,65.577 57.771,52.885 46.39,59.45 46.39,59.45 40.701,46.758 29.322,55.511 29.322,55.511 27.912,55.092 25.613,11.796 24.414,11.604 23.44,7.068 14.011,-1.728 12.511,14.772 c 0,36.5 -1.135,47.304 -1.135,47.304 C 9.188,67.328 5.31,80.458 5.31,80.458 -3.006,89.649 0.933,96.214 0.933,96.214 c 7.002,12.255 21.385,28.449 21.385,28.449 6.129,5.252 2.627,8.316 2.627,8.316 l 42.455,0.438 2.334,-7.878 c 9.628,-18.382 6.417,-44.643 6.417,-44.643 z" - id="path3432" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccccccccc" - style="fill:#ffffff;fill-opacity:1" /> -<path - d="m 65.247258,98.823749 c -0.681067,0.71969 -7.149935,7.376421 -7.149935,7.376421 0,0 -0.86404,0.92222 -0.86404,-0.29705 0.0013,-1.22468 0.0013,-3.17039 0.0013,-3.17039 0,0 -0.498094,0.003 -1.261753,0.002 -2.35324,0.002 -6.936466,0.002 -8.692502,0.002 0,0 -0.07751,-0.007 -0.162642,-0.0472 0,0.0378 0,0.0972 0,0.13232 0.01652,0.0891 0.0013,0.16068 0,0.16608 0,0.0149 0,0.0419 0,0.0554 0,0 0.01779,0.077 0,0.17013 0,2.02673 0,6.49066 0,8.99672 0.0013,0.90332 0,1.49203 0,1.49203 0,0 2.283354,0.002 3.229986,0 0.942821,0 0.07751,0.87225 0.07751,0.87225 l -7.121981,7.36157 c 0,0 -0.470139,0.5833 -0.963151,0.0607 -0.677255,-0.72374 -6.941548,-7.59515 -6.941548,-7.59515 0,0 -0.867853,-0.91952 0.280812,-0.91952 1.151207,0.002 2.983481,0.002 2.983481,0.002 0,0 -0.0026,-0.52929 -0.0013,-1.34079 -0.0013,-2.50067 -0.0013,-7.37102 -0.0013,-9.23572 l 0,-0.004 c 0,-0.0567 0,-0.14582 0,-0.21333 -0.08259,0.0392 -0.15883,0.0459 -0.15883,0.0459 -1.756036,0 -6.339262,0 -8.696314,-0.002 -0.759847,0.002 -1.260482,0 -1.260482,0 0,0 0.0026,1.94706 0.0026,3.17039 -0.0013,1.21793 -0.864041,0.29975 -0.864041,0.29975 0,0 -6.467597,-6.655381 -7.147393,-7.377761 -0.493012,-0.52525 0.05464,-1.02484 0.05464,-1.02484 l 6.927571,-7.566801 c 0,0 0.82338,-0.92357 0.82211,0.08236 0.0026,1.004586 0.0026,3.432334 0.0026,3.432334 0,0 0.552732,-0.0014 1.402796,-0.0041 2.439643,0.0041 6.872933,0.0027 8.678524,0.0014 0,0 0.116899,-0.03106 0.23634,0.027 0,-4.084505 0,-8.204115 0.0013,-9.436893 -0.0013,-0.807449 0,-1.339448 0,-1.339448 0,0 -1.832274,0.0027 -2.983481,0.0027 -1.146124,-0.0014 -0.280813,-0.918169 -0.280813,-0.918169 0,0 6.261752,-6.872771 6.942819,-7.596505 0.494283,-0.522547 0.964422,0.05806 0.964422,0.05806 l 7.12071,7.361561 c 0,0 0.869123,0.874963 -0.07624,0.872261 -0.945362,0.0027 -3.229987,0.0027 -3.229987,0.0027 0,0 0.0013,0.587358 0.0038,1.492025 -0.0013,1.284087 -0.0026,5.419901 -0.0026,9.503056 0.120712,-0.06211 0.240153,-0.02835 0.240153,-0.02835 1.804319,0 6.237609,0 8.675982,0 0.851334,-0.0014 1.404066,0 1.404066,0 0,0 0.0013,-2.426399 0,-3.430985 0,-1.003235 0.820838,-0.08236 0.820838,-0.08236 l 6.927572,7.566803 c 0,0.001 0.546378,0.50094 0.05845,1.02484 z" - id="path3238" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccccccccccccccccsscccccccccccccccccccccccccccccccc" - style="fill:#66ccff;fill-opacity:1" /></g> -<g - id="g3434" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3436" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3438" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3440" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3442" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3444" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3446" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3448" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3450" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3452" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3454" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3456" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3458" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3460" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -<g - id="g3462" - transform="translate(-7.9878665e-4,-2.9265169e-6)"> -</g> -</svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/TouchRotate.svg b/libs/Cesium/Widgets/Images/NavigationHelp/TouchRotate.svg deleted file mode 100644 index fe968ff4..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/TouchRotate.svg +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Capa_1" - x="0px" - y="0px" - width="99.001816" - height="101.57817" - viewBox="0 0 99.001814 101.57817" - enable-background="new 0 0 100.775 118.638" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="TouchRotate.svg"><metadata - id="metadata3382"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs3380" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1105" - inkscape:window-height="739" - id="namedview3378" - showgrid="false" - inkscape:zoom="1.9873603" - inkscape:cx="11.856691" - inkscape:cy="15.112094" - inkscape:window-x="67" - inkscape:window-y="152" - inkscape:window-maximized="0" - inkscape:current-layer="Capa_1" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" /> - -<path - inkscape:connector-curvature="0" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd" - d="m 48.832974,0 c -5.85006,0 -10.591269,4.862311 -10.591269,10.85967 0,5.997358 4.742138,10.859669 10.592198,10.859669 5.849132,0 10.59127,-4.862311 10.59127,-10.859669 C 59.42425,4.862311 54.682106,0 48.832974,0 z m 0,19.47021 c -4.637107,0 -8.398657,-3.855921 -8.398657,-8.611493 0,-4.754621 3.76155,-8.610543 8.398657,-8.610543 4.637107,0 8.397729,3.855922 8.397729,8.610543 0,4.755572 -3.759691,8.611493 -8.397729,8.611493 z" - id="path3430" /><path - inkscape:connector-curvature="0" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd" - d="m 27.154761,39.321738 c -5.457398,0 -9.88037,4.703155 -9.88037,10.504205 0,5.801049 4.423839,10.504204 9.881237,10.504204 5.456532,0 9.880371,-4.703155 9.880371,-10.504204 -8.67e-4,-5.80105 -4.424707,-10.504205 -9.881238,-10.504205 z m 0,18.8329 c -4.325859,0 -7.834929,-3.729707 -7.834929,-8.329617 0,-4.598989 3.50907,-8.328696 7.834929,-8.328696 4.32586,0 7.834063,3.729707 7.834063,8.328696 0,4.59991 -3.507336,8.329617 -7.834063,8.329617 z" - id="path3430-5" /><path - d="M 93.394891,94.930552 91.5074,101.57817 52.728925,101.21032 c 8.08e-4,-8.5e-4 2.829619,-2.585988 -2.124439,-7.016318 0,0 -10.822746,-5.22596 -18.506953,-18.0968 0,0 -6.310236,-6.742109 -6.091889,-9.206596 -0.583067,-4.408398 -1.209805,-6.954724 -1.715239,-8.534999 -1.063849,-4.039774 -1.553525,-2.844172 -1.553525,-7.228104 2.452812,-14.333817 10.869455,1.810623 12.764445,5.488368 0,0 6.305384,7.578229 9.063029,9.283373 8.851152,-2.291524 3.039071,-22.109494 3.660956,-23.668675 0,0 -1.25024,-10.043558 -2.822341,-23.064577 -3.9949,-15.561935 8.286796,-19.626706 11.636292,-3.093053 1.545414,7.344522 3.686834,19.52689 4.483397,19.774098 0,0 8.395048,-7.385018 12.995707,3.323385 0,0 9.202125,-5.538975 12.741777,5.170273 0,0 12.387573,1.10695 11.326563,12.923992 0,0 2.595085,22.156743 -5.191814,37.665865 z" - id="path3376" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccccccccccccc" - style="fill:#ffffff" /><path - d="m 36.857901,10.534807 -5.731265,12.511815 c 0,0 -0.666487,1.516584 -1.19043,0.316343 -0.52908,-1.19559 -1.800413,-4.092683 -1.800413,-4.092683 0,0 -0.774356,0.279126 -1.962218,0.711771 -3.412049,1.225827 -9.61846,3.462323 -12.145716,4.370646 0,0 -0.609983,0.412873 -1.019633,-0.532666 -0.419926,-0.944375 -3.7806092,-8.602891 -4.0798222,-9.279772 -0.294076,-0.674552 0.288938,-0.867615 0.288938,-0.867615 2.4553422,-0.886224 8.8659382,-3.19599 12.1688342,-4.381112 1.05816,-0.382636 1.763171,-0.631523 1.763171,-0.631523 0,0 -1.02734,-2.324887 -1.664289,-3.782156 -0.636951,-1.454944 1.049169,-0.79202 1.049169,-0.79202 0,0 12.534822,4.676522 13.866509,5.195231 0.963131,0.382636 0.457165,1.253741 0.457165,1.253741 z" - id="path9" - style="fill:#d800d8;fill-opacity:1" - inkscape:connector-curvature="0" /><g - id="g2997" - transform="matrix(0,-1,1,0,-0.01316643,45.882166)" - inkscape:transform-center-x="-4.9812271" - inkscape:transform-center-y="-4.2696251"><path - id="path2999" - d="M 6.6614176,0.14173229 19.48819,5.5984253 c 0,0 1.559055,0.6377953 0.354331,1.1338583 -1.240158,0.5314961 -4.181103,1.7716536 -4.181103,1.7716536 0,0 0.283465,0.7440945 0.744095,1.9133858 1.27559,3.259843 3.57874,9.248032 4.535433,11.692914 0,0 0.425197,0.566929 -0.566929,0.992126 -0.956693,0.389764 -8.751969,3.685039 -9.460631,4.003937 -0.673228,0.283464 -0.885827,-0.283465 -0.885827,-0.283465 C 9.1062996,24.448819 6.6968507,18.283465 5.4921262,15.094489 5.0669294,14.066929 4.8188979,13.393701 4.8188979,13.393701 c 0,0 -2.3740159,0.992126 -3.86220494,1.629921 -1.48818905,0.637796 -0.81496067,-0.992126 -0.81496067,-0.992126 0,0 4.71259861,-12.1535432 5.24409471,-13.42913378 0.3897638,-0.95669294 1.2755906,-0.46062993 1.2755906,-0.46062993 z" - style="fill:#d800d8;fill-opacity:1;fill-rule:nonzero;stroke:none" - inkscape:connector-curvature="0" /></g></svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/TouchTilt.svg b/libs/Cesium/Widgets/Images/NavigationHelp/TouchTilt.svg deleted file mode 100644 index e1206c5d..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/TouchTilt.svg +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Capa_1" - x="0px" - y="0px" - width="76.663582" - height="140.44" - viewBox="0 0 76.663581 140.44" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="TouchTilt.svg"><metadata - id="metadata3364"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs3362" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="766" - inkscape:window-height="480" - id="namedview3360" - showgrid="false" - inkscape:zoom="1.6804329" - inkscape:cx="6.1930652" - inkscape:cy="74.717535" - inkscape:window-x="343" - inkscape:window-y="203" - inkscape:window-maximized="0" - inkscape:current-layer="Capa_1" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" /> -<g - id="g3322" - style="fill:#ffffff" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> - <path - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd" - d="m 12.622,5.815 c -6.294,0 -11.396,5.102 -11.396,11.395 0,6.293 5.102,11.395 11.396,11.395 6.293,0 11.395,-5.102 11.395,-11.395 0,-6.293 -5.102,-11.395 -11.395,-11.395 z m 0,20.431 c -4.99,0 -9.036,-4.046 -9.036,-9.036 0,-4.989 4.046,-9.035 9.036,-9.035 4.988,0 9.035,4.046 9.035,9.035 0,4.99 -4.047,9.036 -9.035,9.036 z" - id="path3324" - inkscape:connector-curvature="0" /> - <path - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd" - d="m 43.793,0 c -6.294,0 -11.396,5.102 -11.396,11.395 0,6.293 5.102,11.395 11.396,11.395 6.293,0 11.395,-5.102 11.395,-11.395 C 55.188,5.102 50.086,0 43.793,0 z m 0,20.43 c -4.99,0 -9.036,-4.046 -9.036,-9.036 0,-4.989 4.046,-9.035 9.036,-9.035 4.988,0 9.035,4.046 9.035,9.035 0,4.99 -4.047,9.036 -9.035,9.036 z" - id="path3326" - inkscape:connector-curvature="0" /> - <path - d="M 76.151,87.918 C 77.464,73.913 62.146,72.6 62.146,72.6 57.769,59.907 47.556,66.472 47.556,66.472 c 0,0 2.262,-49.025 1.395,-54.713 -0.51,-3.331 -6.383,-10.562 -9.998,-1.684 -2.137,6.166 -5.59,60.75 -9.465,56.874 C 24.984,62.447 20.611,18.817 19.414,18.626 18.438,14.09 9.011,5.294 7.511,21.794 c 3,39.5 3.865,47.304 3.865,47.304 C 9.187,74.35 5.31,87.481 5.31,87.481 c -8.316,9.191 -4.377,15.756 -4.377,15.756 7.002,12.255 21.385,28.449 21.385,28.449 6.127,5.252 2.625,8.316 2.625,8.316 l 42.455,0.438 2.334,-7.879 c 9.628,-18.382 6.419,-44.643 6.419,-44.643 z" - id="path3328" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccccccccccc" - style="fill:#ffffff" /> -</g> -<g - id="g3330" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3332" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3334" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3336" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3338" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3340" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3342" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3344" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3346" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3348" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3350" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3352" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3354" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3356" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<g - id="g3358" - transform="translate(-7.9878665e-4,-3.8214145e-7)"> -</g> -<path - inkscape:connector-curvature="0" - d="m 52.342987,124.78465 -8.980622,9.44613 c 0,0 -0.592129,0.74692 -1.214412,0.0786 -0.853927,-0.92772 -8.753091,-9.74549 -8.753091,-9.74549 0,0 -1.096535,-1.17966 0.352262,-1.17818 1.454279,10e-4 3.762485,10e-4 3.762485,10e-4 0,0 -0.0027,-0.67875 -0.0014,-1.72058 -0.0014,-3.20848 -0.0014,-9.4565 -0.0027,-11.8499 0,0 -0.01233,-0.56315 0.655179,-0.56019 0.672999,0 8.298029,0 9.238308,-0.003 0.937537,0.003 0.774428,0.66985 0.774428,0.66985 0,2.45861 0,8.50359 -0.0027,11.82767 0.0041,1.16039 0.0027,1.91472 0.0027,1.91472 0,0 2.879775,0.003 4.070886,0 1.192483,-10e-4 0.09869,1.11889 0.09869,1.11889 z m -0.09869,-37.828986 c -1.191111,0.003 -4.073627,0.003 -4.073627,0.003 0,0 0.0027,0.752845 0.0041,1.914716 -0.0041,3.327041 -0.0041,9.370556 -0.0014,11.83064 0,0 0.16174,0.66393 -0.774427,0.66096 -0.943021,0.006 -8.563939,0.003 -9.235567,0.004 -0.670257,-0.003 -0.65655,-0.56167 -0.65655,-0.56167 -0.0014,-2.393393 -0.0014,-8.642902 0.0014,-11.855831 -0.0014,-1.034421 0,-1.717613 0,-1.717613 0,0 -2.312318,0.003 -3.762486,0.0044 -1.444685,-0.003 -0.355003,-1.178173 -0.355003,-1.178173 0,0 7.896422,-8.81777 8.755832,-9.745488 0.622284,-0.671338 1.215783,0.07558 1.215783,0.07558 l 8.979252,9.444648 c 0,0 1.096534,1.121857 -0.09732,1.120375 z" - id="path3432" - sodipodi:nodetypes="ccccsccccccccccccccccccccccccc" - style="fill:#ffd800;fill-opacity:1" /></svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/NavigationHelp/TouchZoom.svg b/libs/Cesium/Widgets/Images/NavigationHelp/TouchZoom.svg deleted file mode 100644 index 74e55d7c..00000000 --- a/libs/Cesium/Widgets/Images/NavigationHelp/TouchZoom.svg +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.1" - id="Capa_1" - x="0px" - y="0px" - width="95.087433" - height="118.43173" - viewBox="0 0 95.087431 118.43173" - enable-background="new 0 0 100.775 118.638" - xml:space="preserve" - inkscape:version="0.48.4 r9939" - sodipodi:docname="TouchZoom.svg"><metadata - id="metadata3382"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs3380" /><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1105" - inkscape:window-height="739" - id="namedview3378" - showgrid="false" - inkscape:zoom="2.8132167" - inkscape:cx="10.565593" - inkscape:cy="72.192791" - inkscape:window-x="67" - inkscape:window-y="152" - inkscape:window-maximized="0" - inkscape:current-layer="Capa_1" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" /> - -<path - d="m 0.0436199,84.941029 c 0,0 -0.2799964,-1.323641 0.578786,-0.720397 0.8621957,0.601498 2.9536375,2.059778 2.9536375,2.059778 0,0 0.3431801,-0.517567 0.8707286,-1.316651 1.521209,-2.28009 4.281925,-6.427623 5.405325,-8.116707 0,0 0.187721,-0.53855 0.863902,-0.06295 0.682926,0.472104 6.206065,4.329377 6.692655,4.668591 0.483157,0.340966 0.220227,0.718649 0.220227,0.718649 -1.094368,1.641877 -3.948985,5.929292 -5.418977,8.132449 -0.469526,0.711655 -0.783654,1.178514 -0.783654,1.178514 0,0 1.678274,1.168023 2.728271,1.900661 1.043172,0.732637 -0.28341,0.987925 -0.28341,0.987925 0,0 -9.7470195,2.05628 -10.7936043,2.25911 -0.756328,0.145111 -0.8468168,-0.666198 -0.8468168,-0.666198 z" - id="path3376-4" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccccccccccccc" - style="fill:#65ff00;fill-opacity:1" /><path - inkscape:connector-curvature="0" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd" - d="m 44.918594,16.853557 c -5.85006,0 -10.591269,4.862311 -10.591269,10.85967 0,5.997358 4.742138,10.859669 10.592198,10.859669 5.849132,0 10.59127,-4.862311 10.59127,-10.859669 -9.23e-4,-5.997359 -4.743067,-10.85967 -10.592199,-10.85967 z m 0,19.47021 c -4.637107,0 -8.398657,-3.855921 -8.398657,-8.611493 0,-4.754621 3.76155,-8.610543 8.398657,-8.610543 4.637107,0 8.397729,3.855922 8.397729,8.610543 0,4.755572 -3.759691,8.611493 -8.397729,8.611493 z" - id="path3430" /><path - inkscape:connector-curvature="0" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd" - d="m 23.240381,56.175295 c -5.457398,0 -9.88037,4.703155 -9.88037,10.504205 0,5.801049 4.423839,10.504204 9.881237,10.504204 5.456532,0 9.880371,-4.703155 9.880371,-10.504204 -8.67e-4,-5.80105 -4.424707,-10.504205 -9.881238,-10.504205 z m 0,18.8329 c -4.325859,0 -7.834929,-3.729707 -7.834929,-8.329617 0,-4.598989 3.50907,-8.328696 7.834929,-8.328696 4.32586,0 7.834063,3.729707 7.834063,8.328696 0,4.59991 -3.507336,8.329617 -7.834063,8.329617 z" - id="path3430-5" /><path - d="m 89.480511,111.78411 -1.887491,6.64762 -38.778475,-0.36785 c 8.08e-4,-8.5e-4 2.829619,-2.58599 -2.124439,-7.01632 0,0 -10.822746,-5.22596 -18.506953,-18.096801 0,0 -6.310236,-6.742109 -6.091889,-9.206596 C 21.508197,79.335765 20.881459,76.789439 20.376025,75.209164 19.312176,71.16939 18.8225,72.364992 18.8225,67.98106 c 2.452812,-14.333817 10.869455,1.810623 12.764445,5.488368 0,0 6.305384,7.578229 9.063029,9.283373 8.851152,-2.291524 3.039071,-22.109494 3.660956,-23.668675 0,0 -1.25024,-10.043558 -2.822341,-23.064577 -3.9949,-15.561935 8.286796,-19.626706 11.636292,-3.093053 1.545414,7.344522 3.686834,19.52689 4.483397,19.774098 0,0 8.395048,-7.385018 12.995707,3.323385 0,0 9.202125,-5.538975 12.741777,5.170273 0,0 12.387573,1.10695 11.326563,12.923992 0,0 2.59509,22.156743 -5.191814,37.665866 z" - id="path3376" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccccccccccccc" - style="fill:#ffffff" /><path - d="m 49.854025,14.903508 c 0.696314,0.466948 6.359531,4.268019 6.858144,4.604015 0.491619,0.334273 0.748797,-0.05343 0.748797,-0.05343 1.121449,-1.617954 4.044902,-5.844621 5.545997,-8.013953 0.488115,-0.703007 0.803031,-1.164787 0.803031,-1.164787 0,0 1.714536,1.152726 2.792243,1.876411 1.07596,0.721961 0.813533,-0.620302 0.813533,-0.620302 0,0 -1.732034,-9.8989818 -1.933227,-10.95349441 -0.150463,-0.7615853 -0.939496,-0.5513731 -0.939496,-0.5513731 L 53.458049,1.9374693 c 0,0 -1.336636,0.2136595 -0.454876,0.8046693 0.88876,0.5927325 3.02493,2.0297666 3.02493,2.0297666 0,0 -0.355152,0.5083037 -0.895757,1.2940169 -1.558825,2.2468717 -4.387811,6.3339699 -5.538999,7.9984459 -0.0018,0.0017 -0.433883,0.370456 0.260678,0.83914 z" - id="path3376-7-4" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccccccccccccc" - style="fill:#65ff00;fill-opacity:1" /></svg> \ No newline at end of file diff --git a/libs/Cesium/Widgets/Images/TerrainProviders/Ellipsoid.png b/libs/Cesium/Widgets/Images/TerrainProviders/Ellipsoid.png deleted file mode 100644 index a36259bb..00000000 Binary files a/libs/Cesium/Widgets/Images/TerrainProviders/Ellipsoid.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/TerrainProviders/STK.png b/libs/Cesium/Widgets/Images/TerrainProviders/STK.png deleted file mode 100644 index 1eadbf9d..00000000 Binary files a/libs/Cesium/Widgets/Images/TerrainProviders/STK.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/TimelineIcons.png b/libs/Cesium/Widgets/Images/TimelineIcons.png deleted file mode 100644 index e3a04556..00000000 Binary files a/libs/Cesium/Widgets/Images/TimelineIcons.png and /dev/null differ diff --git a/libs/Cesium/Widgets/Images/info-loading.gif b/libs/Cesium/Widgets/Images/info-loading.gif deleted file mode 100644 index 8df10dd5..00000000 Binary files a/libs/Cesium/Widgets/Images/info-loading.gif and /dev/null differ diff --git a/libs/Cesium/Widgets/InfoBox/InfoBox.css b/libs/Cesium/Widgets/InfoBox/InfoBox.css deleted file mode 100644 index b505db22..00000000 --- a/libs/Cesium/Widgets/InfoBox/InfoBox.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-infoBox {display: block; position: absolute; top: 50px; right: 0; width: 40%; max-width: 480px; background: rgba(38, 38, 38, 0.95); color: #edffff; border: 1px solid #444; border-right: none; border-top-left-radius: 7px; border-bottom-left-radius: 7px; box-shadow: 0 0 10px 1px #000; -webkit-transform: translate(100%, 0); -moz-transform: translate(100%, 0); transform: translate(100%, 0); visibility: hidden; opacity: 0; -webkit-transition: visibility 0s 0.2s, opacity 0.2s ease-in, -webkit-transform 0.2s ease-in; -moz-transition: visibility 0s 0.2s, opacity 0.2s ease-in, -moz-transform 0.2s ease-in; transition: visibility 0s 0.2s, opacity 0.2s ease-in, transform 0.2s ease-in;} .cesium-infoBox-visible {-webkit-transform: translate(0, 0); -moz-transform: translate(0, 0); transform: translate(0, 0); visibility: visible; opacity: 1; -webkit-transition: opacity 0.2s ease-out, -webkit-transform 0.2s ease-out; -moz-transition: opacity 0.2s ease-out, -moz-transform 0.2s ease-out; transition: opacity 0.2s ease-out, transform 0.2s ease-out;} .cesium-infoBox-title {display: block; height: 20px; padding: 5px 30px 5px 25px; background: rgba(84, 84, 84, 1.0); border-top-left-radius: 7px; text-align: center; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box;} .cesium-infoBox-bodyless .cesium-infoBox-title {border-bottom-left-radius: 7px;} button.cesium-infoBox-camera {display: block; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; background: transparent; border-color: transparent; border-radius: 3px; padding: 0 5px; margin: 0;} button.cesium-infoBox-close {display: block; position: absolute; top: 5px; right: 5px; height: 20px; background: transparent; border: none; border-radius: 2px; font-weight: bold; font-size: 16px; padding: 0 5px; margin: 0; color: #edffff;} button.cesium-infoBox-close:focus {background: rgba(238, 136, 0, 0.44); outline: none;} button.cesium-infoBox-close:hover {background: #888; color: #000;} button.cesium-infoBox-close:active {background: #a00; color: #000;} .cesium-infoBox-bodyless .cesium-infoBox-iframe {display: none;} .cesium-infoBox-loadingContainer {margin: 5px; text-align: center;} .cesium-infoBox-loading {display: inline-block; background-image: url(../Images/info-loading.gif); width: 16px; height: 11px;} .cesium-infoBox-iframe {border: none; width: 100%; width: calc(100% - 2px);} \ No newline at end of file diff --git a/libs/Cesium/Widgets/InfoBox/InfoBoxDescription.css b/libs/Cesium/Widgets/InfoBox/InfoBoxDescription.css deleted file mode 100644 index 70b49400..00000000 --- a/libs/Cesium/Widgets/InfoBox/InfoBoxDescription.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-svgPath-svg {position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;} .cesium-button {display: inline-block; position: relative; background: #303336; border: 1px solid #444; color: #edffff; fill: #edffff; border-radius: 4px; padding: 5px 12px; margin: 2px 3px; cursor: pointer; overflow: hidden; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none;} .cesium-button:focus {color: #fff; fill: #fff; border-color: #ea4; outline: none;} .cesium-button:hover {color: #fff; fill: #fff; background: #48b; border-color: #aef; box-shadow: 0 0 8px #fff;} .cesium-button:active {color: #000; fill: #000; background: #adf; border-color: #fff; box-shadow: 0 0 8px #fff;} .cesium-button:disabled, .cesium-button-disabled, .cesium-button-disabled:focus, .cesium-button-disabled:hover, .cesium-button-disabled:active {background: #303336; border-color: #444; color: #646464; fill: #646464; box-shadow: none; cursor: default;} .cesium-button option {background-color: #000; color: #eee;} .cesium-button option:disabled {color: #777;} .cesium-toolbar-button {-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; width: 32px; height: 32px; border-radius: 14%; padding: 0; vertical-align: middle; z-index: 0;} .cesium-performanceDisplay-defaultContainer {position: absolute; top: 50px; right: 10px; text-align: right;} .cesium-performanceDisplay {background-color: rgba(40, 40, 40, 0.7); padding: 7px; border-radius: 5px; border: 1px solid #444; font: bold 12px sans-serif;} .cesium-performanceDisplay-fps {color: #e52;} .cesium-performanceDisplay-ms {color: #de3;} body {margin: 0; padding: 0;} .cesium-infoBox-description {font-family: sans-serif; font-size: 13px; padding: 4px 10px; margin-right: 4px; color: #edffff;} .cesium-infoBox-description a:link, .cesium-infoBox-description a:visited, .cesium-infoBox-description a:hover, .cesium-infoBox-description a:active {color: #edffff;} .cesium-infoBox-description table {color: #edffff;} .cesium-infoBox-defaultTable {width: 100%; color: #edffff;} .cesium-infoBox-defaultTable tr:nth-child(odd) {background-color: rgba(84, 84, 84, 0.8);} .cesium-infoBox-defaultTable tr:nth-child(even) {background-color: rgba(84, 84, 84, 0.25);} .cesium-infoBox-defaultTable th {font-weight: normal; padding: 3px; vertical-align: middle; text-align: center;} .cesium-infoBox-defaultTable td {padding: 3px; vertical-align: middle; text-align: left;} .cesium-infoBox-description-lighter {color: #000000;} .cesium-infoBox-description-lighter a:link, .cesium-infoBox-description-lighter a:visited, .cesium-infoBox-description-lighter a:hover, .cesium-infoBox-description-lighter a:active {color: #000000;} .cesium-infoBox-description-lighter table {color: #000000;} .cesium-infoBox-defaultTable-lighter {width: 100%; color: #000000;} .cesium-infoBox-defaultTable-lighter tr:nth-child(odd) {background-color: rgba(179, 179, 179, 0.8);} .cesium-infoBox-defaultTable-lighter tr:nth-child(even) {background-color: rgba(179, 179, 179, 0.25);} \ No newline at end of file diff --git a/libs/Cesium/Widgets/NavigationHelpButton/NavigationHelpButton.css b/libs/Cesium/Widgets/NavigationHelpButton/NavigationHelpButton.css deleted file mode 100644 index 7ce39a61..00000000 --- a/libs/Cesium/Widgets/NavigationHelpButton/NavigationHelpButton.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-navigationHelpButton-wrapper {position: relative; display: inline-block;} .cesium-navigation-help {visibility: hidden; position: absolute; top: 38px; right: 2px; width: 250px; border-radius: 10px; -webkit-transform: scale(0.01); -moz-transform: scale(0.01); transform: scale(0.01); -webkit-transform-origin: 234px -10px; -moz-transform-origin: 234px -10px; transform-origin: 234px -10px; -webkit-transition: visibility 0s 0.25s, -webkit-transform 0.25s ease-in; -moz-transition: visibility 0s 0.25s, -moz-transform 0.25s ease-in; transition: visibility 0s 0.25s, transform 0.25s ease-in;} .cesium-navigation-help-visible {visibility: visible; -webkit-transform: scale(1); -moz-transform: scale(1); transform: scale(1); -webkit-transition: -webkit-transform 0.25s ease-out; -moz-transition: -moz-transform 0.25s ease-out; transition: transform 0.25s ease-out;} .cesium-navigation-help-instructions {border: 1px solid #444; background-color: rgba(38, 38, 38, 0.75); padding-bottom: 5px; border-radius: 0 0 10px 10px;} .cesium-click-navigation-help {display: none;} .cesium-touch-navigation-help {display: none; padding-top: 5px;} .cesium-click-navigation-help-visible {display: block;} .cesium-touch-navigation-help-visible {display: block;} .cesium-navigation-help-pan {color: #66ccff; font-weight: bold;} .cesium-navigation-help-zoom {color: #65fd00; font-weight: bold;} .cesium-navigation-help-rotate {color: #ffd800; font-weight: bold;} .cesium-navigation-help-tilt {color: #d800d8; font-weight: bold;} .cesium-navigation-help-details {color: #ffffff;} .cesium-navigation-button {color: #fff; background-color: transparent; border-bottom: none; border-top: 1px solid #444; border-right: 1px solid #444; margin: 0; width: 50%; cursor: pointer;} .cesium-navigation-button-icon {vertical-align: middle; padding: 5px 1px;} .cesium-navigation-button:focus {outline: none;} .cesium-navigation-button-left {border-radius: 10px 0 0 0; border-left: 1px solid #444;} .cesium-navigation-button-right {border-radius: 0 10px 0 0; border-left: none;} .cesium-navigation-button-selected {background-color: rgba(38, 38, 38, 0.75);} .cesium-navigation-button-unselected {background-color: rgba(0, 0, 0, 0.75);} .cesium-navigation-button-unselected:hover {background-color: rgba(76, 76, 76, 0.75);} \ No newline at end of file diff --git a/libs/Cesium/Widgets/NavigationHelpButton/lighter.css b/libs/Cesium/Widgets/NavigationHelpButton/lighter.css deleted file mode 100644 index b4be2722..00000000 --- a/libs/Cesium/Widgets/NavigationHelpButton/lighter.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-lighter .cesium-navigation-help-instructions {border: 1px solid #759dc0; background-color: rgba(255, 255, 255, 0.9);} .cesium-lighter .cesium-navigation-help-pan {color: #66ccee; font-weight: bold;} .cesium-lighter .cesium-navigation-help-zoom {color: #65ec00; font-weight: bold;} .cesium-lighter .cesium-navigation-help-rotate {color: #eec722; font-weight: bold;} .cesium-lighter .cesium-navigation-help-tilt {color: #d800d8; font-weight: bold;} .cesium-lighter .cesium-navigation-help-details {color: #222222;} .cesium-lighter .cesium-navigation-button {color: #222222; border-top: 1px solid #759dc0; border-right: 1px solid #759dc0;} .cesium-lighter .cesium-navigation-button-selected {background-color: rgba(196, 225, 255, 0.9);} .cesium-lighter .cesium-navigation-button-unselected {background-color: rgba(226, 240, 255, 0.9);} .cesium-lighter .cesium-navigation-button-unselected:hover {background-color: rgba(166, 210, 255, 0.9);} \ No newline at end of file diff --git a/libs/Cesium/Widgets/PerformanceWatchdog/PerformanceWatchdog.css b/libs/Cesium/Widgets/PerformanceWatchdog/PerformanceWatchdog.css deleted file mode 100644 index d93b0633..00000000 --- a/libs/Cesium/Widgets/PerformanceWatchdog/PerformanceWatchdog.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-performance-watchdog-message-area {position: relative; background-color: yellow; color: black; padding: 10px;} .cesium-performance-watchdog-message {margin-right: 30px;} .cesium-performance-watchdog-message-dismiss {position: absolute; right: 0; margin: 0 10px 0 0;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/SceneModePicker/SceneModePicker.css b/libs/Cesium/Widgets/SceneModePicker/SceneModePicker.css deleted file mode 100644 index edcb25fc..00000000 --- a/libs/Cesium/Widgets/SceneModePicker/SceneModePicker.css +++ /dev/null @@ -1 +0,0 @@ -span.cesium-sceneModePicker-wrapper {display: inline-block; position: relative; margin: 0 3px;} .cesium-sceneModePicker-visible {visibility: visible; opacity: 1; transition: opacity 0.25s linear; -webkit-transition: opacity 0.25s linear; -moz-transition: opacity 0.25s linear;} .cesium-sceneModePicker-hidden {visibility: hidden; opacity: 0; transition: visibility 0s 0.25s, opacity 0.25s linear; -webkit-transition: visibility 0s 0.25s, opacity 0.25s linear; -moz-transition: visibility 0s 0.25s, opacity 0.25s linear;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-none {display: none;} .cesium-sceneModePicker-slide-svg {-webkit-transition: left 2s; -moz-transition: left 2s; transition: left 2s; top: 0; left: 0;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-dropDown-icon {-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; padding: 0; margin: 3px 0;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button3D, .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-buttonColumbusView, .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button2D {margin: 0 0 3px 0;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button3D .cesium-sceneModePicker-icon2D {left: 100%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button3D .cesium-sceneModePicker-iconColumbusView {left: 200%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-buttonColumbusView .cesium-sceneModePicker-icon3D {left: -200%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-buttonColumbusView .cesium-sceneModePicker-icon2D {left: -100%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button2D .cesium-sceneModePicker-icon3D {left: -100%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button2D .cesium-sceneModePicker-iconColumbusView {left: 100%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-selected {border-color: #2e2; box-shadow: 0 0 8px #fff, 0 0 8px #fff;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/SelectionIndicator/SelectionIndicator.css b/libs/Cesium/Widgets/SelectionIndicator/SelectionIndicator.css deleted file mode 100644 index ed160c9b..00000000 --- a/libs/Cesium/Widgets/SelectionIndicator/SelectionIndicator.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-selection-wrapper {position: absolute; width: 160px; height: 160px; pointer-events: none; visibility: hidden; opacity: 0; -webkit-transition: visibility 0s 0.2s, opacity 0.2s ease-in; -moz-transition: visibility 0s 0.2s, opacity 0.2s ease-in; transition: visibility 0s 0.2s, opacity 0.2s ease-in;} .cesium-selection-wrapper-visible {visibility: visible; opacity: 1; -webkit-transition: opacity 0.2s ease-out; -moz-transition: opacity 0.2s ease-out; transition: opacity 0.2s ease-out;} .cesium-selection-wrapper svg {fill: #2e2; stroke: #000; stroke-width: 1.1px;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/Timeline/Timeline.css b/libs/Cesium/Widgets/Timeline/Timeline.css deleted file mode 100644 index d2d8d010..00000000 --- a/libs/Cesium/Widgets/Timeline/Timeline.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-timeline-main {position: relative; left: 0; bottom: 0; overflow: hidden; border: solid 1px #888;} .cesium-timeline-trackContainer {width: 100%; overflow: auto; border-top: solid 1px #888; position: relative; top: 0; left: 0;} .cesium-timeline-tracks {position: absolute; top: 0; left: 0; width: 100%;} .cesium-timeline-needle {position: absolute; left: 0; top: 1.7em; bottom: 0; width: 1px; background: #F00;} .cesium-timeline-bar {position: relative; left: 0; top: 0; overflow: hidden; cursor: pointer; width: 100%; height: 1.7em; background-color: #fafafa; background: rgba(32, 32, 32, 0.8); background: -moz-linear-gradient(top, rgba(116,117,119,0.8) 0%, rgba(58,68,82,0.8) 11%, rgba(46,50,56,0.8) 46%, rgba(53,53,53,0.8) 81%, rgba(53,53,53,0.8) 100%); background: -webkit-linear-gradient(top, rgba(116,117,119,0.8) 0%,rgba(58,68,82,0.8) 11%,rgba(46,50,56,0.8) 46%,rgba(53,53,53,0.8) 81%,rgba(53,53,53,0.8) 100%); background: linear-gradient(to bottom, rgba(116,117,119,0.8) 0%,rgba(58,68,82,0.8) 11%,rgba(46,50,56,0.8) 46%,rgba(53,53,53,0.8) 81%,rgba(53,53,53,0.8) 100%);} .cesium-timeline-ruler {visibility: hidden; white-space: nowrap; font-size: 80%; z-index: -200;} .cesium-timeline-highlight {position: absolute; bottom: 0; left: 0; background: #08F;} .cesium-timeline-ticLabel {position: absolute; top: 0; left: 0; white-space: nowrap; font-size: 80%; color: #eee;} .cesium-timeline-ticMain {position: absolute; bottom: 0; left: 0; width: 1px; height: 50%; background: #eee;} .cesium-timeline-ticSub {position: absolute; bottom: 0; left: 0; width: 1px; height: 33%; background: #aaa;} .cesium-timeline-ticTiny {position: absolute; bottom: 0; left: 0; width: 1px; height: 25%; background: #888;} .cesium-timeline-icon16 {display: block; position: absolute; width: 16px; height: 16px; background-image: url("../Images/TimelineIcons.png"); background-repeat: no-repeat;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/Timeline/lighter.css b/libs/Cesium/Widgets/Timeline/lighter.css deleted file mode 100644 index 03843b9a..00000000 --- a/libs/Cesium/Widgets/Timeline/lighter.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-lighter .cesium-timeline-bar {background: -moz-linear-gradient(top, #eeeeee 0%, #ffffff 50%, #fafafa 100%); background: -webkit-linear-gradient(top, #eeeeee 0%,#ffffff 50%,#fafafa 100%); background: linear-gradient(to bottom, #eeeeee 0%,#ffffff 50%,#fafafa 100%);} .cesium-lighter .cesium-timeline-ticLabel {color: #000;} .cesium-lighter .cesium-timeline-ticMain {position: absolute; bottom: 0; left: 0; width: 1px; height: 50%; background: #000;} .cesium-lighter .cesium-timeline-ticSub {background: #444;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/Viewer/Viewer.css b/libs/Cesium/Widgets/Viewer/Viewer.css deleted file mode 100644 index 4cf5f0ed..00000000 --- a/libs/Cesium/Widgets/Viewer/Viewer.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-viewer {font-family: sans-serif; font-size: 16px; overflow: hidden; display: block; position: relative; top: 0; left: 0; width: 100%; height: 100%;} .cesium-viewer-cesiumWidgetContainer {width: 100%; height: 100%;} .cesium-viewer-bottom {display: block; position: absolute; bottom: 0; left: 0; right: 0; padding-right: 5px;} .cesium-viewer .cesium-widget-credits {display: inline; position: static; bottom: auto; left: auto; padding-right: 0; color: #ffffff; font-size: 10px; text-shadow: 0 0 2px #000000;} .cesium-viewer-timelineContainer {position: absolute; bottom: 0; left: 169px; right: 29px; height: 27px; padding: 0; margin: 0; overflow: hidden; font-size: 14px;} .cesium-viewer-animationContainer {position: absolute; bottom: 0; left: 0; padding: 0; width: 169px; height: 112px;} .cesium-viewer-fullscreenContainer {position: absolute; bottom: 0; right: 0; padding: 0; width: 29px; height: 29px; overflow: hidden;} .cesium-viewer-toolbar {display: block; position: absolute; top: 5px; right: 5px;} .cesium-viewer-cesiumInspectorContainer {display: block; position: absolute; top: 50px; right: 10px;} .cesium-viewer-geocoderContainer {position: relative; display: inline-block; margin: 0 3px;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/lighter.css b/libs/Cesium/Widgets/lighter.css deleted file mode 100644 index 0d6cc66e..00000000 --- a/libs/Cesium/Widgets/lighter.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-lighter .cesium-button {color: #111; fill: #111; background: #e2f0ff; border: 1px solid #759dc0;} .cesium-lighter .cesium-button:focus {color: #000; fill: #000; border-color: #ea4;} .cesium-lighter .cesium-button:hover {color: #000; fill: #000; background: #a6d2ff; border-color: #aef; box-shadow: 0 0 8px #777;} .cesium-lighter .cesium-button:active {color: #fff; fill: #fff; background: #48b; border-color: #ea0;} .cesium-lighter .cesium-button:disabled, .cesium-lighter .cesium-button-disabled, .cesium-lighter .cesium-button-disabled:focus, .cesium-lighter .cesium-button-disabled:hover, .cesium-lighter .cesium-button-disabled:active {background: #ccc; border-color: #999; color: #999; fill: #999; box-shadow: none;} .cesium-lighter .cesium-performanceDisplay {background-color: #e2f0ff; border-color: #759dc0;} .cesium-lighter .cesium-performanceDisplay-fps {color: #e52;} .cesium-lighter .cesium-performanceDisplay-ms {color: #ea4;} .cesium-lighter .cesium-animation-themeNormal {color: #E5F2FE;} .cesium-lighter .cesium-animation-themeHover {color: #ABD6FF;} .cesium-lighter .cesium-animation-themeSelect {color: #E5F2FE;} .cesium-lighter .cesium-animation-themeDisabled {color: #EFEFEF;} .cesium-lighter .cesium-animation-themeKnob {color: #E1E2E3;} .cesium-lighter .cesium-animation-themePointer {color: #FA5;} .cesium-lighter .cesium-animation-themeSwoosh {color: #ACE;} .cesium-lighter .cesium-animation-themeSwooshHover {color: #BDF;} .cesium-lighter .cesium-animation-svgText {fill: #111;} .cesium-lighter .cesium-animation-rectButton .cesium-animation-buttonPath {fill: #111;} .cesium-lighter .cesium-animation-rectButton .cesium-animation-buttonMain {stroke: #759DC0;} .cesium-lighter .cesium-animation-buttonToggled .cesium-animation-buttonGlow {fill: #FFAA2A;} .cesium-lighter .cesium-animation-buttonToggled .cesium-animation-buttonMain {stroke: #EA0;} .cesium-lighter .cesium-animation-rectButton:hover .cesium-animation-buttonMain {stroke: #759DC0;} .cesium-lighter .cesium-animation-buttonToggled:hover .cesium-animation-buttonGlow {fill: #fff;} .cesium-lighter .cesium-animation-buttonToggled:hover .cesium-animation-buttonMain {stroke: #EA0;} .cesium-lighter .cesium-animation-rectButton:active .cesium-animation-buttonMain {fill: #ABD6FF;} .cesium-lighter .cesium-animation-buttonDisabled .cesium-animation-buttonMain {stroke: #D3D3D3;} .cesium-lighter .cesium-animation-buttonDisabled .cesium-animation-buttonPath {fill: #818181;} .cesium-lighter .cesium-animation-shuttleRingBack {fill: #FAFAFA; fill-opacity: 1; stroke: #AEAEAE; stroke-width: 1.2;} .cesium-lighter .cesium-animation-shuttleRingSwoosh line {stroke: #8AC;} .cesium-lighter .cesium-animation-knobOuter {stroke: #A5A5A5;} .cesium-lighter .cesium-baseLayerPicker-itemIcon {border-color: #759dc0;} .cesium-lighter .cesium-baseLayerPicker-dropDown {background-color: rgba(240, 240, 240, 0.75);} .cesium-lighter .cesium-baseLayerPicker-sectionTitle {color: black;} .cesium-lighter .cesium-baseLayerPicker-itemLabel {color: black;} .cesium-lighter .cesium-baseLayerPicker-item:hover .cesium-baseLayerPicker-itemIcon {border-color: #000;} .cesium-lighter .cesium-baseLayerPicker-selectedItem .cesium-baseLayerPicker-itemLabel {color: rgb(0, 61, 168);} .cesium-lighter .cesium-baseLayerPicker-selectedItem .cesium-baseLayerPicker-itemIcon {border: double 4px rgb(0, 61, 168);} .cesium-lighter .cesium-widget-errorPanel {background: rgba(255, 255, 255, 0.7);} .cesium-lighter .cesium-widget-errorPanel-content {border: 1px solid #526F82; border-radius: 7px; background-color: white; color: black;} .cesium-lighter .cesium-widget-errorPanel-header {color: #B87D00;} .cesium-lighter .cesium-geocoder-input {border: solid 1px #759dc0; background-color: rgba(240, 240, 240, 0.9); color: black;} .cesium-lighter .cesium-viewer-geocoderContainer:hover .cesium-geocoder-input {border-color: #aef; box-shadow: 0 0 8px #fff;} .cesium-lighter .cesium-geocoder-searchButton {background-color: #e2f0ff; fill: #111;} .cesium-lighter .cesium-geocoder-searchButton:hover {background-color: #a6d2ff;} .cesium-lighter .cesium-timeline-bar {background: -moz-linear-gradient(top, #eeeeee 0%, #ffffff 50%, #fafafa 100%); background: -webkit-linear-gradient(top, #eeeeee 0%,#ffffff 50%,#fafafa 100%); background: linear-gradient(to bottom, #eeeeee 0%,#ffffff 50%,#fafafa 100%);} .cesium-lighter .cesium-timeline-ticLabel {color: #000;} .cesium-lighter .cesium-timeline-ticMain {position: absolute; bottom: 0; left: 0; width: 1px; height: 50%; background: #000;} .cesium-lighter .cesium-timeline-ticSub {background: #444;} .cesium-lighter .cesium-navigation-help-instructions {border: 1px solid #759dc0; background-color: rgba(255, 255, 255, 0.9);} .cesium-lighter .cesium-navigation-help-pan {color: #66ccee; font-weight: bold;} .cesium-lighter .cesium-navigation-help-zoom {color: #65ec00; font-weight: bold;} .cesium-lighter .cesium-navigation-help-rotate {color: #eec722; font-weight: bold;} .cesium-lighter .cesium-navigation-help-tilt {color: #d800d8; font-weight: bold;} .cesium-lighter .cesium-navigation-help-details {color: #222222;} .cesium-lighter .cesium-navigation-button {color: #222222; border-top: 1px solid #759dc0; border-right: 1px solid #759dc0;} .cesium-lighter .cesium-navigation-button-selected {background-color: rgba(196, 225, 255, 0.9);} .cesium-lighter .cesium-navigation-button-unselected {background-color: rgba(226, 240, 255, 0.9);} .cesium-lighter .cesium-navigation-button-unselected:hover {background-color: rgba(166, 210, 255, 0.9);} \ No newline at end of file diff --git a/libs/Cesium/Widgets/lighterShared.css b/libs/Cesium/Widgets/lighterShared.css deleted file mode 100644 index 5c59f756..00000000 --- a/libs/Cesium/Widgets/lighterShared.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-lighter .cesium-button {color: #111; fill: #111; background: #e2f0ff; border: 1px solid #759dc0;} .cesium-lighter .cesium-button:focus {color: #000; fill: #000; border-color: #ea4;} .cesium-lighter .cesium-button:hover {color: #000; fill: #000; background: #a6d2ff; border-color: #aef; box-shadow: 0 0 8px #777;} .cesium-lighter .cesium-button:active {color: #fff; fill: #fff; background: #48b; border-color: #ea0;} .cesium-lighter .cesium-button:disabled, .cesium-lighter .cesium-button-disabled, .cesium-lighter .cesium-button-disabled:focus, .cesium-lighter .cesium-button-disabled:hover, .cesium-lighter .cesium-button-disabled:active {background: #ccc; border-color: #999; color: #999; fill: #999; box-shadow: none;} .cesium-lighter .cesium-performanceDisplay {background-color: #e2f0ff; border-color: #759dc0;} .cesium-lighter .cesium-performanceDisplay-fps {color: #e52;} .cesium-lighter .cesium-performanceDisplay-ms {color: #ea4;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/shared.css b/libs/Cesium/Widgets/shared.css deleted file mode 100644 index 7d60ce4d..00000000 --- a/libs/Cesium/Widgets/shared.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-svgPath-svg {position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;} .cesium-button {display: inline-block; position: relative; background: #303336; border: 1px solid #444; color: #edffff; fill: #edffff; border-radius: 4px; padding: 5px 12px; margin: 2px 3px; cursor: pointer; overflow: hidden; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none;} .cesium-button:focus {color: #fff; fill: #fff; border-color: #ea4; outline: none;} .cesium-button:hover {color: #fff; fill: #fff; background: #48b; border-color: #aef; box-shadow: 0 0 8px #fff;} .cesium-button:active {color: #000; fill: #000; background: #adf; border-color: #fff; box-shadow: 0 0 8px #fff;} .cesium-button:disabled, .cesium-button-disabled, .cesium-button-disabled:focus, .cesium-button-disabled:hover, .cesium-button-disabled:active {background: #303336; border-color: #444; color: #646464; fill: #646464; box-shadow: none; cursor: default;} .cesium-button option {background-color: #000; color: #eee;} .cesium-button option:disabled {color: #777;} .cesium-toolbar-button {-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; width: 32px; height: 32px; border-radius: 14%; padding: 0; vertical-align: middle; z-index: 0;} .cesium-performanceDisplay-defaultContainer {position: absolute; top: 50px; right: 10px; text-align: right;} .cesium-performanceDisplay {background-color: rgba(40, 40, 40, 0.7); padding: 7px; border-radius: 5px; border: 1px solid #444; font: bold 12px sans-serif;} .cesium-performanceDisplay-fps {color: #e52;} .cesium-performanceDisplay-ms {color: #de3;} \ No newline at end of file diff --git a/libs/Cesium/Widgets/widgets.css b/libs/Cesium/Widgets/widgets.css deleted file mode 100644 index 28b50b86..00000000 --- a/libs/Cesium/Widgets/widgets.css +++ /dev/null @@ -1 +0,0 @@ -.cesium-svgPath-svg {position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;} .cesium-button {display: inline-block; position: relative; background: #303336; border: 1px solid #444; color: #edffff; fill: #edffff; border-radius: 4px; padding: 5px 12px; margin: 2px 3px; cursor: pointer; overflow: hidden; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none;} .cesium-button:focus {color: #fff; fill: #fff; border-color: #ea4; outline: none;} .cesium-button:hover {color: #fff; fill: #fff; background: #48b; border-color: #aef; box-shadow: 0 0 8px #fff;} .cesium-button:active {color: #000; fill: #000; background: #adf; border-color: #fff; box-shadow: 0 0 8px #fff;} .cesium-button:disabled, .cesium-button-disabled, .cesium-button-disabled:focus, .cesium-button-disabled:hover, .cesium-button-disabled:active {background: #303336; border-color: #444; color: #646464; fill: #646464; box-shadow: none; cursor: default;} .cesium-button option {background-color: #000; color: #eee;} .cesium-button option:disabled {color: #777;} .cesium-toolbar-button {-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; width: 32px; height: 32px; border-radius: 14%; padding: 0; vertical-align: middle; z-index: 0;} .cesium-performanceDisplay-defaultContainer {position: absolute; top: 50px; right: 10px; text-align: right;} .cesium-performanceDisplay {background-color: rgba(40, 40, 40, 0.7); padding: 7px; border-radius: 5px; border: 1px solid #444; font: bold 12px sans-serif;} .cesium-performanceDisplay-fps {color: #e52;} .cesium-performanceDisplay-ms {color: #de3;} .cesium-animation-theme {visibility: hidden; display: block; position: absolute; z-index: -100;} .cesium-animation-themeNormal {color: #222;} .cesium-animation-themeHover {color: #4488B0;} .cesium-animation-themeSelect {color: #242;} .cesium-animation-themeDisabled {color: #333;} .cesium-animation-themeKnob {color: #222;} .cesium-animation-themePointer {color: #2E2;} .cesium-animation-themeSwoosh {color: #8AC;} .cesium-animation-themeSwooshHover {color: #AEF;} .cesium-animation-svgText {fill: #edffff; font-family: Sans-Serif; font-size: 15px; text-anchor: middle;} .cesium-animation-blank {fill: #000; fill-opacity: 0.01; stroke: none;} .cesium-animation-rectButton {cursor: pointer; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none;} .cesium-animation-rectButton .cesium-animation-buttonGlow {fill: #fff; stroke: none; display: none;} .cesium-animation-rectButton:hover .cesium-animation-buttonGlow {display: block;} .cesium-animation-rectButton .cesium-animation-buttonPath {fill: #edffff;} .cesium-animation-rectButton .cesium-animation-buttonMain {stroke: #444; stroke-width: 1.2;} .cesium-animation-rectButton:hover .cesium-animation-buttonMain {stroke: #AEF;} .cesium-animation-rectButton:active .cesium-animation-buttonMain {fill: #ABD6FF;} .cesium-animation-buttonDisabled {-moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none;} .cesium-animation-buttonDisabled .cesium-animation-buttonMain {stroke: #555;} .cesium-animation-buttonDisabled .cesium-animation-buttonPath {fill: #818181;} .cesium-animation-buttonDisabled .cesium-animation-buttonGlow {display: none;} .cesium-animation-buttonToggled .cesium-animation-buttonGlow {display: block; fill: #2E2;} .cesium-animation-buttonToggled .cesium-animation-buttonMain {stroke: #2E2;} .cesium-animation-buttonToggled:hover .cesium-animation-buttonGlow {fill: #fff;} .cesium-animation-buttonToggled:hover .cesium-animation-buttonMain {stroke: #2E2;} .cesium-animation-shuttleRingG {cursor: pointer;} .cesium-animation-shuttleRingPointer {cursor: pointer;} .cesium-animation-shuttleRingPausePointer {cursor: pointer;} .cesium-animation-shuttleRingBack {fill: #181818; fill-opacity: 0.8; stroke: #333; stroke-width: 1.2;} .cesium-animation-shuttleRingSwoosh line {stroke: #8AC; stroke-width: 3; stroke-opacity: 0.2; stroke-linecap: round;} .cesium-animation-knobOuter {cursor: pointer; stroke: #444; stroke-width: 1.2;} .cesium-animation-knobInner {cursor: pointer;} .cesium-baseLayerPicker-selected {position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;} .cesium-baseLayerPicker-dropDown {display: block; position: absolute; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; top: auto; right: 0; width: 320px; max-height: 500px; margin-top: 5px; background-color: rgba(38, 38, 38, 0.75); border: 1px solid #444; padding: 6px; overflow: auto; border-radius: 10px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; -webkit-transform: translate(0, -20%); -moz-transform: translate(0, -20%); transform: translate(0, -20%); visibility: hidden; opacity: 0; -webkit-transition: visibility 0s 0.2s, opacity 0.2s ease-in, -webkit-transform 0.2s ease-in; -moz-transition: visibility 0s 0.2s, opacity 0.2s ease-in, -moz-transform 0.2s ease-in; transition: visibility 0s 0.2s, opacity 0.2s ease-in, transform 0.2s ease-in;} .cesium-baseLayerPicker-dropDown-visible {-webkit-transform: translate(0, 0); -moz-transform: translate(0, 0); transform: translate(0, 0); visibility: visible; opacity: 1; -webkit-transition: opacity 0.2s ease-out, -webkit-transform 0.2s ease-out; -moz-transition: opacity 0.2s ease-out, -moz-transform 0.2s ease-out; transition: opacity 0.2s ease-out, transform 0.2s ease-out;} .cesium-baseLayerPicker-sectionTitle {display: block; font-family: sans-serif; font-size: 16pt; text-align: left; color: #edffff; border-bottom: 1px solid #888; margin-bottom: 4px;} .cesium-baseLayerPicker-choices {display: block; position: relative; top: auto; right: 0;} .cesium-baseLayerPicker-item {display: inline-block; vertical-align: top; margin: 2px 5px; width: 64px; text-align: center; cursor: pointer;} .cesium-baseLayerPicker-itemLabel {display: block; font-family: sans-serif; font-size: 8pt; text-align: center; vertical-align: middle; color: #edffff; cursor: pointer; word-wrap: break-word;} .cesium-baseLayerPicker-item:hover .cesium-baseLayerPicker-itemLabel, .cesium-baseLayerPicker-item:focus .cesium-baseLayerPicker-itemLabel {text-decoration: underline;} .cesium-baseLayerPicker-itemIcon {display: inline-block; position: relative; width: inherit; height: auto; background-size: 100% 100%; border: solid 1px #444; border-radius: 9px; color: #edffff; margin: 0; padding: 0; cursor: pointer; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;} .cesium-baseLayerPicker-item:hover .cesium-baseLayerPicker-itemIcon {border-color: #fff; box-shadow: 0 0 8px #fff, 0 0 8px #fff;} .cesium-baseLayerPicker-selectedItem .cesium-baseLayerPicker-itemLabel {color: rgb(189, 236, 248);} .cesium-baseLayerPicker-selectedItem .cesium-baseLayerPicker-itemIcon {border: double 4px rgb(189, 236, 248);} .cesium-widget {position: relative;} .cesium-widget, .cesium-widget canvas {width: 100%; height: 100%; touch-action: none;} .cesium-widget-credits {display: block; position: absolute; bottom: 0; left: 0; color: #fff; font-size: 10px; text-shadow: 0px 0px 2px #000000; padding-right: 5px;} .cesium-widget-credits a, .cesium-widget-credits a:visited {color: #fff;} .cesium-widget-errorPanel {position: absolute; top: 0; right: 0; bottom: 0; left: 0; text-align: center; background: rgba(0, 0, 0, 0.7); z-index: 99999;} .cesium-widget-errorPanel:before {display: inline-block; vertical-align: middle; height: 100%; content: "";} .cesium-widget-errorPanel-content {width: 75%; display: inline-block; text-align: left; vertical-align: middle; border: 1px solid #526F82; border-radius: 7px; background-color: black; color: white; font-size: 10pt; padding: 1em;} .cesium-widget-errorPanel-header {font-size: 120%; color: #fe4;} .cesium-widget-errorPanel-scroll {overflow: auto; font-family: monospace; white-space: pre-wrap; padding: 0; margin: 10px 0;} .cesium-widget-errorPanel-buttonPanel {text-align: center;} .cesium-cesiumInspector {border-radius: 5px; -webkit-transition: width ease-in-out 0.25s; -moz-transition: width ease-in-out 0.25s; transition: width ease-in-out 0.25s; background: rgba(48, 51, 54, 0.8); border: 1px solid #444; color: #edffff; display: inline-block; position: relative; padding: 4px 12px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; overflow: hidden;} .cesium-cesiumInspector-button {text-align: center; font-size: 11pt;} .cesium-cesiumInspector-visible .cesium-cesiumInspector-button {border-bottom: 1px solid #aaa; padding-bottom: 3px;} .cesium-cesiumInspector input:enabled, .cesium-cesiumInspector-button {cursor: pointer;} .cesium-cesiumInspector-visible {width: 185px; height: auto;} .cesium-cesiumInspector-hidden {width: 122px; height: 17px;} .cesium-cesiumInspector-show {max-height: 500px;} .cesium-cesiumInspector-hide {max-height: 0; padding: 0 !important; overflow: hidden;} .cesium-cesiumInspector-dropDown {margin: 5px 0; font-family: sans-serif; font-size: 10pt; width: 185px;} .cesium-cesiumInspector-frustumStats {padding-left: 10px; padding: 5px; background-color: rgba(80, 80, 80, 0.75);} .cesium-cesiumInspector-pickButton {background-color: rgba(0, 0, 0, 0.3); border: 1px solid #444; color: #edffff; border-radius: 5px; padding: 3px 7px; cursor: pointer; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; margin: 0 auto;} .cesium-cesiumInspector-pickButton:focus {outline: none;} .cesium-cesiumInspector-pickButton:active, .cesium-cesiumInspector-pickButtonHighlight {color: #000; background: #adf; border-color: #fff; box-shadow: 0 0 8px #fff;} .cesium-cesiumInspector-center {text-align: center;} .cesium-cesiumInspector-sectionHeader {font-weight: bold;} .cesium-cesiumInspector-pickSection {border: 1px solid #aaa; border-radius: 5px; padding: 3px; margin-bottom: 5px;} .cesium-cesiumInspector-section {margin-bottom: 10px; -webkit-transition: max-height 0.25s; -moz-transition: max-height 0.25s; transition: max-height 0.25s;} .cesium-cesiumInspector-toggleSwitch {padding: 3px; cursor: pointer;} .cesium-cesiumInspector-tileText {padding-bottom: 10px; border-bottom: 1px solid #aaa;} .cesium-cesiumInspector-relativeText {padding-top: 10px;} .cesium-button.cesium-fullscreenButton {display: block; width: 100%; height: 100%; margin: 0; border-radius: 0;} .cesium-viewer-geocoderContainer .cesium-geocoder-input {border: solid 1px #444; background-color: rgba(40, 40, 40, 0.7); color: white; display: inline-block; vertical-align: middle; width: 0; height: 32px; margin: 0; padding: 0 32px 0 0; border-radius: 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; -webkit-transition: width ease-in-out 0.25s, background-color 0.2s ease-in-out; -moz-transition: width ease-in-out 0.25s, background-color 0.2s ease-in-out; transition: width ease-in-out 0.25s, background-color 0.2s ease-in-out; -webkit-appearance: none;} .cesium-viewer-geocoderContainer:hover .cesium-geocoder-input {border-color: #aef; box-shadow: 0 0 8px #fff;} .cesium-viewer-geocoderContainer .cesium-geocoder-input:focus {border-color: #ea4; background-color: rgba(15, 15, 15, 0.9); box-shadow: none; outline: none;} .cesium-viewer-geocoderContainer:hover .cesium-geocoder-input, .cesium-viewer-geocoderContainer .cesium-geocoder-input:focus, .cesium-viewer-geocoderContainer .cesium-geocoder-input-wide {padding-left: 4px; width: 250px;} .cesium-geocoder-searchButton {background-color: #303336; display: inline-block; position: absolute; cursor: pointer; width: 32px; top: 1px; right: 1px; height: 30px; vertical-align: middle; fill: #edffff;} .cesium-geocoder-searchButton:hover {background-color: #48b;} .cesium-infoBox {display: block; position: absolute; top: 50px; right: 0; width: 40%; max-width: 480px; background: rgba(38, 38, 38, 0.95); color: #edffff; border: 1px solid #444; border-right: none; border-top-left-radius: 7px; border-bottom-left-radius: 7px; box-shadow: 0 0 10px 1px #000; -webkit-transform: translate(100%, 0); -moz-transform: translate(100%, 0); transform: translate(100%, 0); visibility: hidden; opacity: 0; -webkit-transition: visibility 0s 0.2s, opacity 0.2s ease-in, -webkit-transform 0.2s ease-in; -moz-transition: visibility 0s 0.2s, opacity 0.2s ease-in, -moz-transform 0.2s ease-in; transition: visibility 0s 0.2s, opacity 0.2s ease-in, transform 0.2s ease-in;} .cesium-infoBox-visible {-webkit-transform: translate(0, 0); -moz-transform: translate(0, 0); transform: translate(0, 0); visibility: visible; opacity: 1; -webkit-transition: opacity 0.2s ease-out, -webkit-transform 0.2s ease-out; -moz-transition: opacity 0.2s ease-out, -moz-transform 0.2s ease-out; transition: opacity 0.2s ease-out, transform 0.2s ease-out;} .cesium-infoBox-title {display: block; height: 20px; padding: 5px 30px 5px 25px; background: rgba(84, 84, 84, 1.0); border-top-left-radius: 7px; text-align: center; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box;} .cesium-infoBox-bodyless .cesium-infoBox-title {border-bottom-left-radius: 7px;} button.cesium-infoBox-camera {display: block; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; background: transparent; border-color: transparent; border-radius: 3px; padding: 0 5px; margin: 0;} button.cesium-infoBox-close {display: block; position: absolute; top: 5px; right: 5px; height: 20px; background: transparent; border: none; border-radius: 2px; font-weight: bold; font-size: 16px; padding: 0 5px; margin: 0; color: #edffff;} button.cesium-infoBox-close:focus {background: rgba(238, 136, 0, 0.44); outline: none;} button.cesium-infoBox-close:hover {background: #888; color: #000;} button.cesium-infoBox-close:active {background: #a00; color: #000;} .cesium-infoBox-bodyless .cesium-infoBox-iframe {display: none;} .cesium-infoBox-loadingContainer {margin: 5px; text-align: center;} .cesium-infoBox-loading {display: inline-block; background-image: url(Images/info-loading.gif); width: 16px; height: 11px;} .cesium-infoBox-iframe {border: none; width: 100%; width: calc(100% - 2px);} span.cesium-sceneModePicker-wrapper {display: inline-block; position: relative; margin: 0 3px;} .cesium-sceneModePicker-visible {visibility: visible; opacity: 1; transition: opacity 0.25s linear; -webkit-transition: opacity 0.25s linear; -moz-transition: opacity 0.25s linear;} .cesium-sceneModePicker-hidden {visibility: hidden; opacity: 0; transition: visibility 0s 0.25s, opacity 0.25s linear; -webkit-transition: visibility 0s 0.25s, opacity 0.25s linear; -moz-transition: visibility 0s 0.25s, opacity 0.25s linear;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-none {display: none;} .cesium-sceneModePicker-slide-svg {-webkit-transition: left 2s; -moz-transition: left 2s; transition: left 2s; top: 0; left: 0;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-dropDown-icon {-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; padding: 0; margin: 3px 0;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button3D, .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-buttonColumbusView, .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button2D {margin: 0 0 3px 0;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button3D .cesium-sceneModePicker-icon2D {left: 100%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button3D .cesium-sceneModePicker-iconColumbusView {left: 200%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-buttonColumbusView .cesium-sceneModePicker-icon3D {left: -200%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-buttonColumbusView .cesium-sceneModePicker-icon2D {left: -100%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button2D .cesium-sceneModePicker-icon3D {left: -100%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-button2D .cesium-sceneModePicker-iconColumbusView {left: 100%;} .cesium-sceneModePicker-wrapper .cesium-sceneModePicker-selected {border-color: #2e2; box-shadow: 0 0 8px #fff, 0 0 8px #fff;} .cesium-performance-watchdog-message-area {position: relative; background-color: yellow; color: black; padding: 10px;} .cesium-performance-watchdog-message {margin-right: 30px;} .cesium-performance-watchdog-message-dismiss {position: absolute; right: 0; margin: 0 10px 0 0;} .cesium-navigationHelpButton-wrapper {position: relative; display: inline-block;} .cesium-navigation-help {visibility: hidden; position: absolute; top: 38px; right: 2px; width: 250px; border-radius: 10px; -webkit-transform: scale(0.01); -moz-transform: scale(0.01); transform: scale(0.01); -webkit-transform-origin: 234px -10px; -moz-transform-origin: 234px -10px; transform-origin: 234px -10px; -webkit-transition: visibility 0s 0.25s, -webkit-transform 0.25s ease-in; -moz-transition: visibility 0s 0.25s, -moz-transform 0.25s ease-in; transition: visibility 0s 0.25s, transform 0.25s ease-in;} .cesium-navigation-help-visible {visibility: visible; -webkit-transform: scale(1); -moz-transform: scale(1); transform: scale(1); -webkit-transition: -webkit-transform 0.25s ease-out; -moz-transition: -moz-transform 0.25s ease-out; transition: transform 0.25s ease-out;} .cesium-navigation-help-instructions {border: 1px solid #444; background-color: rgba(38, 38, 38, 0.75); padding-bottom: 5px; border-radius: 0 0 10px 10px;} .cesium-click-navigation-help {display: none;} .cesium-touch-navigation-help {display: none; padding-top: 5px;} .cesium-click-navigation-help-visible {display: block;} .cesium-touch-navigation-help-visible {display: block;} .cesium-navigation-help-pan {color: #66ccff; font-weight: bold;} .cesium-navigation-help-zoom {color: #65fd00; font-weight: bold;} .cesium-navigation-help-rotate {color: #ffd800; font-weight: bold;} .cesium-navigation-help-tilt {color: #d800d8; font-weight: bold;} .cesium-navigation-help-details {color: #ffffff;} .cesium-navigation-button {color: #fff; background-color: transparent; border-bottom: none; border-top: 1px solid #444; border-right: 1px solid #444; margin: 0; width: 50%; cursor: pointer;} .cesium-navigation-button-icon {vertical-align: middle; padding: 5px 1px;} .cesium-navigation-button:focus {outline: none;} .cesium-navigation-button-left {border-radius: 10px 0 0 0; border-left: 1px solid #444;} .cesium-navigation-button-right {border-radius: 0 10px 0 0; border-left: none;} .cesium-navigation-button-selected {background-color: rgba(38, 38, 38, 0.75);} .cesium-navigation-button-unselected {background-color: rgba(0, 0, 0, 0.75);} .cesium-navigation-button-unselected:hover {background-color: rgba(76, 76, 76, 0.75);} .cesium-selection-wrapper {position: absolute; width: 160px; height: 160px; pointer-events: none; visibility: hidden; opacity: 0; -webkit-transition: visibility 0s 0.2s, opacity 0.2s ease-in; -moz-transition: visibility 0s 0.2s, opacity 0.2s ease-in; transition: visibility 0s 0.2s, opacity 0.2s ease-in;} .cesium-selection-wrapper-visible {visibility: visible; opacity: 1; -webkit-transition: opacity 0.2s ease-out; -moz-transition: opacity 0.2s ease-out; transition: opacity 0.2s ease-out;} .cesium-selection-wrapper svg {fill: #2e2; stroke: #000; stroke-width: 1.1px;} .cesium-timeline-main {position: relative; left: 0; bottom: 0; overflow: hidden; border: solid 1px #888;} .cesium-timeline-trackContainer {width: 100%; overflow: auto; border-top: solid 1px #888; position: relative; top: 0; left: 0;} .cesium-timeline-tracks {position: absolute; top: 0; left: 0; width: 100%;} .cesium-timeline-needle {position: absolute; left: 0; top: 1.7em; bottom: 0; width: 1px; background: #F00;} .cesium-timeline-bar {position: relative; left: 0; top: 0; overflow: hidden; cursor: pointer; width: 100%; height: 1.7em; background-color: #fafafa; background: rgba(32, 32, 32, 0.8); background: -moz-linear-gradient(top, rgba(116,117,119,0.8) 0%, rgba(58,68,82,0.8) 11%, rgba(46,50,56,0.8) 46%, rgba(53,53,53,0.8) 81%, rgba(53,53,53,0.8) 100%); background: -webkit-linear-gradient(top, rgba(116,117,119,0.8) 0%,rgba(58,68,82,0.8) 11%,rgba(46,50,56,0.8) 46%,rgba(53,53,53,0.8) 81%,rgba(53,53,53,0.8) 100%); background: linear-gradient(to bottom, rgba(116,117,119,0.8) 0%,rgba(58,68,82,0.8) 11%,rgba(46,50,56,0.8) 46%,rgba(53,53,53,0.8) 81%,rgba(53,53,53,0.8) 100%);} .cesium-timeline-ruler {visibility: hidden; white-space: nowrap; font-size: 80%; z-index: -200;} .cesium-timeline-highlight {position: absolute; bottom: 0; left: 0; background: #08F;} .cesium-timeline-ticLabel {position: absolute; top: 0; left: 0; white-space: nowrap; font-size: 80%; color: #eee;} .cesium-timeline-ticMain {position: absolute; bottom: 0; left: 0; width: 1px; height: 50%; background: #eee;} .cesium-timeline-ticSub {position: absolute; bottom: 0; left: 0; width: 1px; height: 33%; background: #aaa;} .cesium-timeline-ticTiny {position: absolute; bottom: 0; left: 0; width: 1px; height: 25%; background: #888;} .cesium-timeline-icon16 {display: block; position: absolute; width: 16px; height: 16px; background-image: url(Images/TimelineIcons.png); background-repeat: no-repeat;} .cesium-viewer {font-family: sans-serif; font-size: 16px; overflow: hidden; display: block; position: relative; top: 0; left: 0; width: 100%; height: 100%;} .cesium-viewer-cesiumWidgetContainer {width: 100%; height: 100%;} .cesium-viewer-bottom {display: block; position: absolute; bottom: 0; left: 0; right: 0; padding-right: 5px;} .cesium-viewer .cesium-widget-credits {display: inline; position: static; bottom: auto; left: auto; padding-right: 0; color: #ffffff; font-size: 10px; text-shadow: 0 0 2px #000000;} .cesium-viewer-timelineContainer {position: absolute; bottom: 0; left: 169px; right: 29px; height: 27px; padding: 0; margin: 0; overflow: hidden; font-size: 14px;} .cesium-viewer-animationContainer {position: absolute; bottom: 0; left: 0; padding: 0; width: 169px; height: 112px;} .cesium-viewer-fullscreenContainer {position: absolute; bottom: 0; right: 0; padding: 0; width: 29px; height: 29px; overflow: hidden;} .cesium-viewer-toolbar {display: block; position: absolute; top: 5px; right: 5px;} .cesium-viewer-cesiumInspectorContainer {display: block; position: absolute; top: 50px; right: 10px;} .cesium-viewer-geocoderContainer {position: relative; display: inline-block; margin: 0 3px;} \ No newline at end of file diff --git a/libs/Cesium/Workers/cesiumWorkerBootstrapper.js b/libs/Cesium/Workers/cesiumWorkerBootstrapper.js deleted file mode 100644 index db6c77fc..00000000 --- a/libs/Cesium/Workers/cesiumWorkerBootstrapper.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** vim: et:ts=4:sw=4:sts=4 - * @license RequireJS 2.1.9 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/jrburke/requirejs for details - */ - -function setTimeout(e){e()}"undefined"==typeof self&&(self={}),self.onmessage=function(e){var t=e.data;require(t.loaderConfig,[t.workerModule],function(e){self.onmessage=e})};var requirejs,require,define;!function(global){function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var i;for(i=0;i<e.length&&(!e[i]||!t(e[i],i,e));i+=1);}}function eachReverse(e,t){if(e){var i;for(i=e.length-1;i>-1&&(!e[i]||!t(e[i],i,e));i-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var i;for(i in e)if(hasProp(e,i)&&t(e[i],i))break}function mixin(e,t,i,r){return t&&eachProp(t,function(t,n){(i||!hasProp(e,n))&&(r&&"string"!=typeof t?(e[n]||(e[n]={}),mixin(e[n],t,i,r)):e[n]=t)}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,i,r){var n=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return n.requireType=e,n.requireModules=r,i&&(n.originalError=i),n}function newContext(e){function t(e){var t,i;for(t=0;e[t];t+=1)if(i=e[t],"."===i)e.splice(t,1),t-=1;else if(".."===i){if(1===t&&(".."===e[2]||".."===e[0]))break;t>0&&(e.splice(t-1,2),t-=2)}}function i(e,i,r){var n,a,o,s,c,u,p,d,f,l,h,m=i&&i.split("/"),g=m,v=y.map,x=v&&v["*"];if(e&&"."===e.charAt(0)&&(i?(g=getOwn(y.pkgs,i)?m=[i]:m.slice(0,m.length-1),e=g.concat(e.split("/")),t(e),a=getOwn(y.pkgs,n=e[0]),e=e.join("/"),a&&e===n+"/"+a.main&&(e=n)):0===e.indexOf("./")&&(e=e.substring(2))),r&&v&&(m||x)){for(s=e.split("/"),c=s.length;c>0;c-=1){if(p=s.slice(0,c).join("/"),m)for(u=m.length;u>0;u-=1)if(o=getOwn(v,m.slice(0,u).join("/")),o&&(o=getOwn(o,p))){d=o,f=c;break}if(d)break;!l&&x&&getOwn(x,p)&&(l=getOwn(x,p),h=c)}!d&&l&&(d=l,f=h),d&&(s.splice(0,f,d),e=s.join("/"))}return e}function r(e){isBrowser&&each(scripts(),function(t){return t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===q.contextName?(t.parentNode.removeChild(t),!0):void 0})}function n(e){var t=getOwn(y.paths,e);return t&&isArray(t)&&t.length>1?(t.shift(),q.require.undef(e),q.require([e]),!0):void 0}function a(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function o(e,t,r,n){var o,s,c,u,p=null,d=t?t.name:null,f=e,l=!0,h="";return e||(l=!1,e="_@r"+(A+=1)),u=a(e),p=u[0],e=u[1],p&&(p=i(p,d,n),s=getOwn(j,p)),e&&(p?h=s&&s.normalize?s.normalize(e,function(e){return i(e,d,n)}):i(e,d,n):(h=i(e,d,n),u=a(h),p=u[0],h=u[1],r=!0,o=q.nameToUrl(h))),c=!p||s||r?"":"_unnormalized"+(T+=1),{prefix:p,name:h,parentMap:t,unnormalized:!!c,url:o,originalName:f,isDefine:l,id:(p?p+"!"+h:h)+c}}function s(e){var t=e.id,i=getOwn(k,t);return i||(i=k[t]=new q.Module(e)),i}function c(e,t,i){var r=e.id,n=getOwn(k,r);!hasProp(j,r)||n&&!n.defineEmitComplete?(n=s(e),n.error&&"error"===t?i(n.error):n.on(t,i)):"defined"===t&&i(j[r])}function u(e,t){var i=e.requireModules,r=!1;t?t(e):(each(i,function(t){var i=getOwn(k,t);i&&(i.error=e,i.events.error&&(r=!0,i.emit("error",e)))}),r||req.onError(e))}function p(){globalDefQueue.length&&(apsp.apply(M,[M.length-1,0].concat(globalDefQueue)),globalDefQueue=[])}function d(e){delete k[e],delete S[e]}function f(e,t,i){var r=e.map.id;e.error?e.emit("error",e.error):(t[r]=!0,each(e.depMaps,function(r,n){var a=r.id,o=getOwn(k,a);!o||e.depMatched[n]||i[a]||(getOwn(t,a)?(e.defineDep(n,j[a]),e.check()):f(o,t,i))}),i[r]=!0)}function l(){var e,t,i,a,o=1e3*y.waitSeconds,s=o&&q.startTime+o<(new Date).getTime(),c=[],p=[],d=!1,h=!0;if(!x){if(x=!0,eachProp(S,function(i){if(e=i.map,t=e.id,i.enabled&&(e.isDefine||p.push(i),!i.error))if(!i.inited&&s)n(t)?(a=!0,d=!0):(c.push(t),r(t));else if(!i.inited&&i.fetched&&e.isDefine&&(d=!0,!e.prefix))return h=!1}),s&&c.length)return i=makeError("timeout","Load timeout for modules: "+c,null,c),i.contextName=q.contextName,u(i);h&&each(p,function(e){f(e,{},{})}),s&&!a||!d||!isBrowser&&!isWebWorker||w||(w=setTimeout(function(){w=0,l()},50)),x=!1}}function h(e){hasProp(j,e[0])||s(o(e[0],null,!0)).init(e[1],e[2])}function m(e,t,i,r){e.detachEvent&&!isOpera?r&&e.detachEvent(r,t):e.removeEventListener(i,t,!1)}function g(e){var t=e.currentTarget||e.srcElement;return m(t,q.onScriptLoad,"load","onreadystatechange"),m(t,q.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function v(){var e;for(p();M.length;){if(e=M.shift(),null===e[0])return u(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));h(e)}}var x,b,q,E,w,y={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},k={},S={},O={},M=[],j={},P={},A=1,T=1;return E={require:function(e){return e.require?e.require:e.require=q.makeRequire(e.map)},exports:function(e){return e.usingExports=!0,e.map.isDefine?e.exports?e.exports:e.exports=j[e.map.id]={}:void 0},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){var t,i=getOwn(y.pkgs,e.map.id);return t=i?getOwn(y.config,e.map.id+"/"+i.main):getOwn(y.config,e.map.id),t||{}},exports:j[e.map.id]}}},b=function(e){this.events=getOwn(O,e.id)||{},this.map=e,this.shim=getOwn(y.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},b.prototype={init:function(e,t,i,r){r=r||{},this.inited||(this.factory=t,i?this.on("error",i):this.events.error&&(i=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=i,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,q.startTime=(new Date).getTime();var e=this.map;return this.shim?(q.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})),void 0):e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;P[e]||(P[e]=!0,q.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,i=this.map.id,r=this.depExports,n=this.exports,a=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(a)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{n=q.execCb(i,a,r,n)}catch(o){e=o}else n=q.execCb(i,a,r,n);if(this.map.isDefine&&(t=this.module,t&&void 0!==t.exports&&t.exports!==this.exports?n=t.exports:void 0===n&&this.usingExports&&(n=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",u(this.error=e)}else n=a;this.exports=n,this.map.isDefine&&!this.ignore&&(j[i]=n,req.onResourceLoad&&req.onResourceLoad(q,this.map,this.depMaps)),d(i),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,r=o(e.prefix);this.depMaps.push(r),c(r,"defined",bind(this,function(r){var n,a,p,f=this.map.name,l=this.map.parentMap?this.map.parentMap.name:null,h=q.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(r.normalize&&(f=r.normalize(f,function(e){return i(e,l,!0)})||""),a=o(e.prefix+"!"+f,this.map.parentMap),c(a,"defined",bind(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),p=getOwn(k,a.id),p&&(this.depMaps.push(a),this.events.error&&p.on("error",bind(this,function(e){this.emit("error",e)})),p.enable()),void 0):(n=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),n.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(k,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&d(e.map.id)}),u(e)}),n.fromText=bind(this,function(i,r){var a=e.name,c=o(a),p=useInteractive;r&&(i=r),p&&(useInteractive=!1),s(c),hasProp(y.config,t)&&(y.config[a]=y.config[t]);try{req.exec(i)}catch(d){return u(makeError("fromtexteval","fromText eval for "+t+" failed: "+d,d,[t]))}p&&(useInteractive=!0),this.depMaps.push(c),q.completeLoad(a),h([a],n)}),r.load(e.name,h,n,y),void 0)})),q.enable(r,this),this.pluginMaps[r.id]=r},enable:function(){S[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var i,r,n;if("string"==typeof e){if(e=o(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,n=getOwn(E,e.id))return this.depExports[t]=n(this),void 0;this.depCount+=1,c(e,"defined",bind(this,function(e){this.defineDep(t,e),this.check()})),this.errback&&c(e,"error",bind(this,this.errback))}i=e.id,r=k[i],hasProp(E,i)||!r||r.enabled||q.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(k,e.id);t&&!t.enabled&&q.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var i=this.events[e];i||(i=this.events[e]=[]),i.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},q={config:y,contextName:e,registry:k,defined:j,urlFetched:P,defQueue:M,Module:b,makeModuleMap:o,nextTick:req.nextTick,onError:u,configure:function(e){e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/");var t=y.pkgs,i=y.shim,r={paths:!0,config:!0,map:!0};eachProp(e,function(e,t){r[t]?"map"===t?(y.map||(y.map={}),mixin(y[t],e,!0,!0)):mixin(y[t],e,!0):y[t]=e}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=q.makeShimExports(e)),i[t]=e}),y.shim=i),e.packages&&(each(e.packages,function(e){var i;e="string"==typeof e?{name:e}:e,i=e.location,t[e.name]={name:e.name,location:i||e.name,main:(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}}),y.pkgs=t),eachProp(k,function(e,t){e.inited||e.map.unnormalized||(e.map=o(t))}),(e.deps||e.callback)&&q.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,n){function a(i,r,c){var p,d,f;return n.enableBuildCallback&&r&&isFunction(r)&&(r.__requireJsBuild=!0),"string"==typeof i?isFunction(r)?u(makeError("requireargs","Invalid require call"),c):t&&hasProp(E,i)?E[i](k[t.id]):req.get?req.get(q,i,t,a):(d=o(i,t,!1,!0),p=d.id,hasProp(j,p)?j[p]:u(makeError("notloaded",'Module name "'+p+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(v(),q.nextTick(function(){v(),f=s(o(null,t)),f.skipMap=n.skipMap,f.init(i,r,c,{enabled:!0}),l()}),a)}return n=n||{},mixin(a,{isBrowser:isBrowser,toUrl:function(e){var r,n=e.lastIndexOf("."),a=e.split("/")[0],o="."===a||".."===a;return-1!==n&&(!o||n>1)&&(r=e.substring(n,e.length),e=e.substring(0,n)),q.nameToUrl(i(e,t&&t.id,!0),r,!0)},defined:function(e){return hasProp(j,o(e,t,!1,!0).id)},specified:function(e){return e=o(e,t,!1,!0).id,hasProp(j,e)||hasProp(k,e)}}),t||(a.undef=function(e){p();var i=o(e,t,!0),n=getOwn(k,e);r(e),delete j[e],delete P[i.url],delete O[e],n&&(n.events.defined&&(O[e]=n.events),d(e))}),a},enable:function(e){var t=getOwn(k,e.id);t&&s(e).enable()},completeLoad:function(e){var t,i,r,a=getOwn(y.shim,e)||{},o=a.exports;for(p();M.length;){if(i=M.shift(),null===i[0]){if(i[0]=e,t)break;t=!0}else i[0]===e&&(t=!0);h(i)}if(r=getOwn(k,e),!t&&!hasProp(j,e)&&r&&!r.inited){if(!(!y.enforceDefine||o&&getGlobal(o)))return n(e)?void 0:u(makeError("nodefine","No define call for "+e,null,[e]));h([e,a.deps||[],a.exportsFn])}l()},nameToUrl:function(e,t,i){var r,n,a,o,s,c,u,p,d;if(req.jsExtRegExp.test(e))p=e+(t||"");else{for(r=y.paths,n=y.pkgs,s=e.split("/"),c=s.length;c>0;c-=1){if(u=s.slice(0,c).join("/"),a=getOwn(n,u),d=getOwn(r,u)){isArray(d)&&(d=d[0]),s.splice(0,c,d);break}if(a){o=e===a.name?a.location+"/"+a.main:a.location,s.splice(0,c,o);break}}p=s.join("/"),p+=t||(/^data\:|\?/.test(p)||i?"":".js"),p=("/"===p.charAt(0)||p.match(/^[\w\+\.\-]+:/)?"":y.baseUrl)+p}return y.urlArgs?p+((-1===p.indexOf("?")?"?":"&")+y.urlArgs):p},load:function(e,t){req.load(q,e,t)},execCb:function(e,t,i,r){return t.apply(r,i)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=g(e);q.completeLoad(t.id)}},onScriptError:function(e){var t=g(e);return n(t.id)?void 0:u(makeError("scripterror","Script error for: "+t.id,e,[t.id]))}},q.require=q.makeRequire(),q}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){return"interactive"===e.readyState?interactiveScript=e:void 0}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.9",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,apsp=ap.splice,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}"undefined"==typeof require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,i,r){var n,a,o=defContextName;return isArray(e)||"string"==typeof e||(a=e,isArray(t)?(e=t,t=i,i=r):e=[]),a&&a.context&&(o=a.context),n=getOwn(contexts,o),n||(n=contexts[o]=req.s.newContext(o)),a&&n.configure(a),n.require(e,t,i)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e){var t=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return t.type=e.scriptType||"text/javascript",t.charset="utf-8",t.async=!0,t},req.load=function(e,t,i){var r,n=e&&e.config||{};if(isBrowser)return r=req.createNode(n,t,i),r.setAttribute("data-requirecontext",e.contextName),r.setAttribute("data-requiremodule",t),!r.attachEvent||r.attachEvent.toString&&r.attachEvent.toString().indexOf("[native code")<0||isOpera?(r.addEventListener("load",e.onScriptLoad,!1),r.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,r.attachEvent("onreadystatechange",e.onScriptLoad)),r.src=i,currentlyAddingScript=r,baseElement?head.insertBefore(r,baseElement):head.appendChild(r),currentlyAddingScript=null,r;if(isWebWorker)try{importScripts(i),e.completeLoad(t)}catch(a){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+i,a,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){return head||(head=e.parentNode),dataMain=e.getAttribute("data-main"),dataMain?(mainScript=dataMain,cfg.baseUrl||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0):void 0}),define=function(e,t,i){var r,n;"string"!=typeof e&&(i=t,t=e,e=null),isArray(t)||(i=t,t=null),!t&&isFunction(i)&&(t=[],i.length&&(i.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,i){t.push(i)}),t=(1===i.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(r=currentlyAddingScript||getInteractiveScript(),r&&(e||(e=r.getAttribute("data-requiremodule")),n=contexts[r.getAttribute("data-requirecontext")])),(n?n.defQueue:globalDefQueue).push([e,t,i])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this); \ No newline at end of file diff --git a/libs/Cesium/Workers/combineGeometry.js b/libs/Cesium/Workers/combineGeometry.js deleted file mode 100644 index 77455de3..00000000 --- a/libs/Cesium/Workers/combineGeometry.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(e){return e>0?1:0>e?-1:0},r.signNotZero=function(e){return 0>e?-1:1},r.toSNorm=function(e){return Math.round(255*(.5*r.clamp(e,-1,1)+.5))},r.fromSNorm=function(e){return 2*(r.clamp(e,0,255)/255)-1},r.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},r.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},r.lerp=function(e,t,r){return(1-r)*e+r*t},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(e){return e*r.RADIANS_PER_DEGREE},r.toDegrees=function(e){return e*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(e){var t=r.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},r.negativePiToPi=function(e){return r.zeroToTwoPi(e+r.PI)-r.PI},r.zeroToTwoPi=function(e){var t=r.mod(e,r.TWO_PI);return Math.abs(t)<r.EPSILON14&&Math.abs(e)>r.EPSILON14?r.TWO_PI:t},r.mod=function(e,t){return(e%t+t)%t},r.equalsEpsilon=function(e,r,n,o){o=t(o,n);var i=Math.abs(e-r);return o>=i||i<=n*Math.max(Math.abs(e),Math.abs(r))};var n=[1];r.factorial=function(e){var t=n.length;if(e>=t)for(var r=n[t-1],o=t;e>=o;o++)n.push(r*o);return n[e]},r.incrementWrap=function(e,r,n){return n=t(n,0),++e,e>r&&(e=n),e},r.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},r.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},r.clamp=function(e,t,r){return t>e?t:e>r?r:e};var o=new e;return r.setRandomNumberSeed=function(t){o=new e(t)},r.nextRandomNumber=function(){return o.random()},r.acosClamped=function(e){return Math.acos(r.clamp(e,-1,1))},r.asinClamped=function(e){return Math.asin(r.clamp(e,-1,1))},r.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},r}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o){"use strict";var i=function(t,r,n){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0)};i.fromSpherical=function(r,n){t(n)||(n=new i);var o=r.clock,a=r.cone,s=e(r.magnitude,1),u=s*Math.sin(a);return n.x=u*Math.cos(o),n.y=u*Math.sin(o),n.z=s*Math.cos(a),n},i.fromElements=function(e,r,n,o){return t(o)?(o.x=e,o.y=r,o.z=n,o):new i(e,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n]=t.z},i.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new i),o.x=r[n++],o.y=r[n++],o.z=r[n],o},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var a=new i;i.distance=function(e,t){return i.subtract(e,t,a),i.magnitude(a)},i.distanceSquared=function(e,t){return i.subtract(e,t,a),i.magnitudeSquared(a)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var s=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,s),n=i.multiplyByScalar(e,1-r,n),i.add(s,n,n)};var u=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,u),i.normalize(t,c);var r=i.dot(u,c),n=i.magnitude(i.cross(u,c,u));return Math.atan2(n,r)};var l=new i;i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):r.y<=r.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&o.equalsEpsilon(e.x,r.x,n,i)&&o.equalsEpsilon(e.y,r.y,n,i)&&o.equalsEpsilon(e.z,r.z,n,i)},i.cross=function(e,t,r){var n=e.x,o=e.y,i=e.z,a=t.x,s=t.y,u=t.z,c=o*u-i*s,l=i*a-n*u,f=n*s-o*a;return r.x=c,r.y=l,r.z=f,r},i.fromDegrees=function(e,t,r,n,a){var s=o.toRadians(e),u=o.toRadians(t);return i.fromRadians(s,u,r,n,a)};var f=new i,m=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(r,n,o,a,s){o=e(o,0);var u=t(a)?a.radiiSquared:h,c=Math.cos(n);f.x=c*Math.cos(r),f.y=c*Math.sin(r),f.z=Math.sin(n),f=i.normalize(f,f),i.multiplyComponents(u,f,m);var l=Math.sqrt(i.dot(f,m));return m=i.divideByScalar(m,l,m),f=i.multiplyByScalar(f,o,f),t(s)||(s=new i),i.add(m,f,s)},i.fromDegreesArray=function(e,t,r){for(var n=new Array(e.length),a=0;a<e.length;a++)n[a]=o.toRadians(e[a]);return i.fromRadiansArray(n,t,r)},i.fromRadiansArray=function(e,r,n){var o=e.length;t(n)?n.length=o/2:n=new Array(o/2);for(var a=0;o>a;a+=2){var s=e[a],u=e[a+1];n[a/2]=i.fromRadians(s,u,0,r,n[a/2])}return n},i.fromDegreesArrayHeights=function(e,t,r){for(var n=new Array(e.length),a=0;a<e.length;a+=3)n[a]=o.toRadians(e[a]),n[a+1]=o.toRadians(e[a+1]),n[a+2]=e[a+2];return i.fromRadiansArrayHeights(n,t,r)},i.fromRadiansArrayHeights=function(e,r,n){var o=e.length;t(n)?n.length=o/3:n=new Array(o/3);for(var a=0;o>a;a+=3){var s=e[a],u=e[a+1],c=e[a+2];n[a/3]=i.fromRadians(s,u,c,r,n[a/3])}return n},i.ZERO=n(new i(0,0,0)),i.UNIT_X=n(new i(1,0,0)),i.UNIT_Y=n(new i(0,1,0)),i.UNIT_Z=n(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o){"use strict";var i=function(t,r,n){this.longitude=e(t,0),this.latitude=e(r,0),this.height=e(n,0)};return i.fromRadians=function(r,n,o,a){return o=e(o,0),t(a)?(a.longitude=r,a.latitude=n,a.height=o,a):new i(r,n,o)},i.fromDegrees=function(e,t,r,n){return e=o.toRadians(e),t=o.toRadians(t),i.fromRadians(e,t,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},i.equalsEpsilon=function(e,r,n){return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=n&&Math.abs(e.latitude-r.latitude)<=n&&Math.abs(e.height-r.height)<=n},i.ZERO=n(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},r=function(r,n){e(t[r])||(t[r]=!0,console.log(n))};return r}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o,i,a,s){"use strict";function u(t,n,o,i){n=r(n,0),o=r(o,0),i=r(i,0),t._radii=new e(n,o,i),t._radiiSquared=new e(n*n,o*o,i*i),t._radiiToTheFourth=new e(n*n*n*n,o*o*o*o,i*i*i*i),t._oneOverRadii=new e(0===n?0:1/n,0===o?0:1/o,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===o?0:1/(o*o),0===i?0:1/(i*i)),t._minimumRadius=Math.min(n,o,i),t._maximumRadius=Math.max(n,o,i),t._centerToleranceSquared=s.EPSILON1}var c=function(e,t,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,u(this,e,t,r)};o(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,r){if(!n(t))return void 0;var o=t._radii;return n(r)?(e.clone(o,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new c(o.x,o.y,o.z)},c.fromCartesian3=function(e,t){return n(t)||(t=new c),n(e)?(u(t,e.x,e.y,e.z),t):t},c.WGS84=a(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=a(new c(1,1,1)),c.MOON=a(new c(s.LUNAR_RADIUS,s.LUNAR_RADIUS,s.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,n,o){o=r(o,0),e.pack(t._radii,n,o)},c.unpack=function(t,n,o){n=r(n,0);var i=e.unpack(t,n);return c.fromCartesian3(i,o)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,r){var o=t.longitude,i=t.latitude,a=Math.cos(i),s=a*Math.cos(o),u=a*Math.sin(o),c=Math.sin(i);return n(r)||(r=new e),r.x=s,r.y=u,r.z=c,e.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(t,r){return n(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,r){var o=l,i=f;this.geodeticSurfaceNormalCartographic(t,o),e.multiplyComponents(this._radiiSquared,o,i);var a=Math.sqrt(e.dot(o,i));return e.divideByScalar(i,a,i),e.multiplyByScalar(o,t.height,o),n(r)||(r=new e),e.add(i,o,r)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var o=0;r>o;o++)t[o]=this.cartographicToCartesian(e[o],t[o]);return t};var m=new e,h=new e,d=new e;c.prototype.cartesianToCartographic=function(r,o){var i=this.scaleToGeodeticSurface(r,h);if(!n(i))return void 0;var a=this.geodeticSurfaceNormal(i,m),u=e.subtract(r,i,d),c=Math.atan2(a.y,a.x),l=Math.asin(a.z),f=s.sign(e.dot(u,r))*e.magnitude(u);return n(o)?(o.longitude=c,o.latitude=l,o.height=f,o):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var o=0;r>o;++o)t[o]=this.cartesianToCartographic(e[o],t[o]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,r){var o=t.x,i=t.y,a=t.z,u=this._oneOverRadii,c=u.x,l=u.y,f=u.z,m=o*o*c*c,h=i*i*l*l,d=a*a*f*f,v=m+h+d,g=Math.sqrt(1/v),E=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(E,r):void 0;var S=this._oneOverRadiiSquared,C=S.x,w=S.y,b=S.z,A=y;A.x=2*E.x*C,A.y=2*E.y*w,A.z=2*E.z*b;var x,T,M,I,O,R,N,L,P,z,D,F=(1-g)*e.magnitude(t)/(.5*e.magnitude(A)),_=0;do{F-=_,M=1/(1+F*C),I=1/(1+F*w),O=1/(1+F*b),R=M*M,N=I*I,L=O*O,P=R*M,z=N*I,D=L*O,x=m*R+h*N+d*L-1,T=m*P*C+h*z*w+d*D*b;var B=-2*T;_=x/B}while(Math.abs(x)>s.EPSILON12);return n(r)?(r.x=o*M,r.y=i*I,r.z=a*O,r):new e(o*M,i*I,a*O)},c.prototype.scaleToGeocentricSurface=function(t,r){n(r)||(r=new e);var o=t.x,i=t.y,a=t.z,s=this._oneOverRadiiSquared,u=1/Math.sqrt(o*o*s.x+i*i*s.y+a*a*s.z);return e.multiplyByScalar(t,u,r)},c.prototype.transformPositionToScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},c.prototype.equals=function(t){return this===t||n(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,o,i,a){"use strict";var s=function(e){this._ellipsoid=r(e,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return o(s.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),s.prototype.project=function(t,r){var o=this._semimajorAxis,i=t.longitude*o,a=t.latitude*o,s=t.height;return n(r)?(r.x=i,r.y=a,r.z=s,r):new e(i,a,s)},s.prototype.unproject=function(e,r){var o=this._oneOverSemimajorAxis,i=e.x*o,a=e.y*o,s=e.z;return n(r)?(r.longitude=i,r.latitude=a,r.height=s,r):new t(i,a,s)},s}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,r){this.start=e(t,0),this.stop=e(r,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o){"use strict";var i=function(t,r,n,o){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0),this.w=e(o,0)};i.fromElements=function(e,r,n,o,a){return t(a)?(a.x=e,a.y=r,a.z=n,a.w=o,a):new i(e,r,n,o)},i.fromColor=function(e,r){return t(r)?(r.x=e.red,r.y=e.green,r.z=e.blue,r.w=e.alpha,r):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n++]=t.z,r[n]=t.w},i.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new i),o.x=r[n++],o.y=r[n++],o.z=r[n++],o.w=r[n],o},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r.w=Math.min(e.w,t.w),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r.w=Math.max(e.w,t.w),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var a=new i;i.distance=function(e,t){return i.subtract(e,t,a),i.magnitude(a)},i.distanceSquared=function(e,t){return i.subtract(e,t,a),i.magnitudeSquared(a)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t.w=e.w/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var s=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,s),n=i.multiplyByScalar(e,1-r,n),i.add(s,n,n)};var u=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,u);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?r.x<=r.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):r.y<=r.z?r.y<=r.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&o.equalsEpsilon(e.x,r.x,n,i)&&o.equalsEpsilon(e.y,r.y,n,i)&&o.equalsEpsilon(e.z,r.z,n,i)&&o.equalsEpsilon(e.w,r.w,n,i)},i.ZERO=n(new i(0,0,0,0)),i.UNIT_X=n(new i(1,0,0,0)),i.UNIT_Y=n(new i(0,1,0,0)),i.UNIT_Z=n(new i(0,0,1,0)),i.UNIT_W=n(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o,i){"use strict";function a(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function s(e){for(var t=0,r=0;3>r;++r){var n=e[c.getElementIndex(h[r],m[r])];t+=2*n*n}return Math.sqrt(t)}function u(e,t){for(var r=i.EPSILON15,n=0,o=1,a=0;3>a;++a){var s=Math.abs(e[c.getElementIndex(h[a],m[a])]);s>n&&(o=a,n=s)}var u=1,l=0,f=m[o],d=h[o];if(Math.abs(e[c.getElementIndex(d,f)])>r){var p,y=e[c.getElementIndex(d,d)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(d,f)],E=(y-v)/2/g;p=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),u=1/Math.sqrt(1+p*p),l=p*u}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(d,d)]=u,t[c.getElementIndex(d,f)]=l,t[c.getElementIndex(f,d)]=-l,t}var c=function(e,r,n,o,i,a,s,u,c){this[0]=t(e,0),this[1]=t(o,0),this[2]=t(s,0),this[3]=t(r,0),this[4]=t(i,0),this[5]=t(u,0),this[6]=t(n,0),this[7]=t(a,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3],r[n++]=e[4],r[n++]=e[5],r[n++]=e[6],r[n++]=e[7],r[n++]=e[8]},c.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new c),o[0]=e[n++],o[1]=e[n++],o[2]=e[n++],o[3]=e[n++],o[4]=e[n++],o[5]=e[n++],o[6]=e[n++],o[7]=e[n++],o[8]=e[n++],o},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,n,o){return n=t(n,0),r(o)||(o=new c),o[0]=e[n],o[1]=e[n+1],o[2]=e[n+2],o[3]=e[n+3],o[4]=e[n+4],o[5]=e[n+5],o[6]=e[n+6],o[7]=e[n+7],o[8]=e[n+8],o},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var n=e.x*e.x,o=e.x*e.y,i=e.x*e.z,a=e.x*e.w,s=e.y*e.y,u=e.y*e.z,l=e.y*e.w,f=e.z*e.z,m=e.z*e.w,h=e.w*e.w,d=n-s-f+h,p=2*(o-m),y=2*(i+l),v=2*(o+m),g=-n+s-f+h,E=2*(u-a),S=2*(i-l),C=2*(u+a),w=-n-s+f+h;return r(t)?(t[0]=d,t[1]=v,t[2]=S,t[3]=p,t[4]=g,t[5]=C,t[6]=y,t[7]=E,t[8]=w,t):new c(d,p,y,v,g,E,S,C,w)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var n=Math.cos(e),o=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=o,t[6]=0,t[7]=-o,t[8]=n,t):new c(1,0,0,0,n,-o,0,o,n)},c.fromRotationY=function(e,t){var n=Math.cos(e),o=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-o,t[3]=0,t[4]=1,t[5]=0,t[6]=o,t[7]=0,t[8]=n,t):new c(n,0,o,0,1,0,-o,0,n)},c.fromRotationZ=function(e,t){var n=Math.cos(e),o=Math.sin(e);return r(t)?(t[0]=n,t[1]=o,t[2]=0,t[3]=-o,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(n,-o,0,o,n,0,0,0,1)},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,r){var n=3*t,o=e[n],i=e[n+1],a=e[n+2];return r.x=o,r.y=i,r.z=a,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var o=3*t;return n[o]=r.x,n[o+1]=r.y,n[o+2]=r.z,n},c.getRow=function(e,t,r){var n=e[t],o=e[t+3],i=e[t+6];return r.x=n,r.y=o,r.z=i,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+3]=r.y,n[t+6]=r.z,n};var l=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),r.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),r.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),r};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,r){var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],o=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],a=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],s=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],u=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=o,r[2]=i,r[3]=a,r[4]=s,r[5]=u,r[6]=c,r[7]=l,r[8]=f,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},c.multiplyByVector=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=e[0]*n+e[3]*o+e[6]*i,s=e[1]*n+e[4]*o+e[7]*i,u=e[2]*n+e[5]*o+e[8]*i;return r.x=a,r.y=s,r.z=u,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},c.multiplyByScale=function(e,t,r){return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.x,r[3]=e[3]*t.y,r[4]=e[4]*t.y,r[5]=e[5]*t.y,r[6]=e[6]*t.z,r[7]=e[7]*t.z,r[8]=e[8]*t.z,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var r=e[0],n=e[3],o=e[6],i=e[1],a=e[4],s=e[7],u=e[2],c=e[5],l=e[8];return t[0]=r,t[1]=n,t[2]=o,t[3]=i,t[4]=a,t[5]=s,t[6]=u,t[7]=c,t[8]=l,t};var m=[1,0,0],h=[2,2,1],d=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var n=i.EPSILON20,o=10,l=0,f=0;r(t)||(t={});for(var m=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=n*a(h);o>f&&s(h)>y;)u(h,d),c.transpose(d,p),c.multiply(h,d,h),c.multiply(p,h,h),c.multiply(m,d,m),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],r=e[3],n=e[6],o=e[1],i=e[4],a=e[7],s=e[2],u=e[5],c=e[8];return t*(i*c-u*a)+o*(u*n-r*c)+s*(r*a-i*n)},c.inverse=function(e,t){var r=e[0],o=e[1],a=e[2],s=e[3],u=e[4],l=e[5],f=e[6],m=e[7],h=e[8],d=c.determinant(e);if(Math.abs(d)<=i.EPSILON15)throw new n("matrix is not invertible");t[0]=u*h-m*l,t[1]=m*a-o*h,t[2]=o*l-u*a,t[3]=f*l-s*h,t[4]=r*h-f*a,t[5]=s*a-r*l,t[6]=s*m-f*u,t[7]=f*o-r*m,t[8]=r*u-s*o;var p=1/d;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},c.IDENTITY=o(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=o(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,o,i,a,s,u){"use strict";var c=function(e,t,n,o,i,a,s,u,c,l,f,m,h,d,p,y){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(c,0),this[3]=r(h,0),this[4]=r(t,0),this[5]=r(a,0),this[6]=r(l,0),this[7]=r(d,0),this[8]=r(n,0),this[9]=r(s,0),this[10]=r(f,0),this[11]=r(p,0),this[12]=r(o,0),this[13]=r(u,0),this[14]=r(m,0),this[15]=r(y,0)};c.packedLength=16,c.pack=function(e,t,n){n=r(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15]},c.unpack=function(e,t,o){return t=r(t,0),n(o)||(o=new c),o[0]=e[t++],o[1]=e[t++],o[2]=e[t++],o[3]=e[t++],o[4]=e[t++],o[5]=e[t++],o[6]=e[t++],o[7]=e[t++],o[8]=e[t++],o[9]=e[t++],o[10]=e[t++],o[11]=e[t++],o[12]=e[t++],o[13]=e[t++],o[14]=e[t++],o[15]=e[t],o},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,o,i){return o=r(o,e.ZERO),n(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=o.x,i[13]=o.y,i[14]=o.z,i[15]=1,i):new c(t[0],t[3],t[6],o.x,t[1],t[4],t[7],o.y,t[2],t[5],t[8],o.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,r,o){n(o)||(o=new c);var i=r.x,a=r.y,s=r.z,u=t.x*t.x,l=t.x*t.y,f=t.x*t.z,m=t.x*t.w,h=t.y*t.y,d=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,E=u-h-y+g,S=2*(l-v),C=2*(f+p),w=2*(l+v),b=-u+h-y+g,A=2*(d-m),x=2*(f-p),T=2*(d+m),M=-u-h+y+g;return o[0]=E*i,o[1]=w*i,o[2]=x*i,o[3]=0,o[4]=S*a,o[5]=b*a,o[6]=T*a,o[7]=0,o[8]=C*s,o[9]=A*s,o[10]=M*s,o[11]=0,o[12]=e.x,o[13]=e.y,o[14]=e.z,o[15]=1,o},c.fromTranslation=function(e,t){return c.fromRotationTranslation(s.IDENTITY,e,t)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,m=new e;c.fromCamera=function(t,r){var o=t.eye,i=t.target,a=t.up;e.normalize(e.subtract(i,o,l),l),e.normalize(e.cross(l,a,f),f),e.normalize(e.cross(f,l,m),m);var s=f.x,u=f.y,h=f.z,d=l.x,p=l.y,y=l.z,v=m.x,g=m.y,E=m.z,S=o.x,C=o.y,w=o.z,b=s*-S+u*-C+h*-w,A=v*-S+g*-C+E*-w,x=d*S+p*C+y*w;return n(r)?(r[0]=s,r[1]=v,r[2]=-d,r[3]=0,r[4]=u,r[5]=g,r[6]=-p,r[7]=0,r[8]=h,r[9]=E,r[10]=-y,r[11]=0,r[12]=b,r[13]=A,r[14]=x,r[15]=1,r):new c(s,u,h,b,v,g,E,A,-d,-p,-y,x,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,r,n,o){var i=Math.tan(.5*e),a=1/i,s=a/t,u=(n+r)/(r-n),c=2*n*r/(r-n);return o[0]=s,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=u,o[11]=-1,o[12]=0,o[13]=0,o[14]=c,o[15]=0,o},c.computeOrthographicOffCenter=function(e,t,r,n,o,i,a){var s=1/(t-e),u=1/(n-r),c=1/(i-o),l=-(t+e)*s,f=-(n+r)*u,m=-(i+o)*c;return s*=2,u*=2,c*=-2,a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=c,a[11]=0,a[12]=l,a[13]=f,a[14]=m,a[15]=1,a -},c.computePerspectiveOffCenter=function(e,t,r,n,o,i,a){var s=2*o/(t-e),u=2*o/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),f=-(i+o)/(i-o),m=-1,h=-2*i*o/(i-o);return a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=c,a[9]=l,a[10]=f,a[11]=m,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeInfinitePerspectiveOffCenter=function(e,t,r,n,o,i){var a=2*o/(t-e),s=2*o/(n-r),u=(t+e)/(t-e),c=(n+r)/(n-r),l=-1,f=-1,m=-2*o;return i[0]=a,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=u,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=m,i[15]=0,i},c.computeViewportTransformation=function(e,t,n,o){e=r(e,r.EMPTY_OBJECT);var i=r(e.x,0),a=r(e.y,0),s=r(e.width,0),u=r(e.height,0);t=r(t,0),n=r(n,1);var c=.5*s,l=.5*u,f=.5*(n-t),m=c,h=l,d=f,p=i+c,y=a+l,v=t+f,g=1;return o[0]=m,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=h,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=d,o[11]=0,o[12]=p,o[13]=y,o[14]=v,o[15]=g,o},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,r){var n=4*t,o=e[n],i=e[n+1],a=e[n+2],s=e[n+3];return r.x=o,r.y=i,r.z=a,r.w=s,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var o=4*t;return n[o]=r.x,n[o+1]=r.y,n[o+2]=r.z,n[o+3]=r.w,n},c.setTranslation=function(e,t,r){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=e[15],r},c.getRow=function(e,t,r){var n=e[t],o=e[t+4],i=e[t+8],a=e[t+12];return r.x=n,r.y=o,r.z=i,r.w=a,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+4]=r.y,n[t+8]=r.z,n[t+12]=r.w,n};var h=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),r.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),r.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),r};var d=new e;c.getMaximumScale=function(t){return c.getScale(t,d),e.maximumComponent(d)},c.multiply=function(e,t,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],f=e[8],m=e[9],h=e[10],d=e[11],p=e[12],y=e[13],v=e[14],g=e[15],E=t[0],S=t[1],C=t[2],w=t[3],b=t[4],A=t[5],x=t[6],T=t[7],M=t[8],I=t[9],O=t[10],R=t[11],N=t[12],L=t[13],P=t[14],z=t[15],D=n*E+s*S+f*C+p*w,F=o*E+u*S+m*C+y*w,_=i*E+c*S+h*C+v*w,B=a*E+l*S+d*C+g*w,U=n*b+s*A+f*x+p*T,G=o*b+u*A+m*x+y*T,q=i*b+c*A+h*x+v*T,k=a*b+l*A+d*x+g*T,V=n*M+s*I+f*O+p*R,W=o*M+u*I+m*O+y*R,Y=i*M+c*I+h*O+v*R,H=a*M+l*I+d*O+g*R,j=n*N+s*L+f*P+p*z,K=o*N+u*L+m*P+y*z,Z=i*N+c*L+h*P+v*z,X=a*N+l*L+d*P+g*z;return r[0]=D,r[1]=F,r[2]=_,r[3]=B,r[4]=U,r[5]=G,r[6]=q,r[7]=k,r[8]=V,r[9]=W,r[10]=Y,r[11]=H,r[12]=j,r[13]=K,r[14]=Z,r[15]=X,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},c.multiplyTransformation=function(e,t,r){var n=e[0],o=e[1],i=e[2],a=e[4],s=e[5],u=e[6],c=e[8],l=e[9],f=e[10],m=e[12],h=e[13],d=e[14],p=t[0],y=t[1],v=t[2],g=t[4],E=t[5],S=t[6],C=t[8],w=t[9],b=t[10],A=t[12],x=t[13],T=t[14],M=n*p+a*y+c*v,I=o*p+s*y+l*v,O=i*p+u*y+f*v,R=n*g+a*E+c*S,N=o*g+s*E+l*S,L=i*g+u*E+f*S,P=n*C+a*w+c*b,z=o*C+s*w+l*b,D=i*C+u*w+f*b,F=n*A+a*x+c*T+m,_=o*A+s*x+l*T+h,B=i*A+u*x+f*T+d;return r[0]=M,r[1]=I,r[2]=O,r[3]=0,r[4]=R,r[5]=N,r[6]=L,r[7]=0,r[8]=P,r[9]=z,r[10]=D,r[11]=0,r[12]=F,r[13]=_,r[14]=B,r[15]=1,r},c.multiplyByMatrix3=function(e,t,r){var n=e[0],o=e[1],i=e[2],a=e[4],s=e[5],u=e[6],c=e[8],l=e[9],f=e[10],m=t[0],h=t[1],d=t[2],p=t[3],y=t[4],v=t[5],g=t[6],E=t[7],S=t[8],C=n*m+a*h+c*d,w=o*m+s*h+l*d,b=i*m+u*h+f*d,A=n*p+a*y+c*v,x=o*p+s*y+l*v,T=i*p+u*y+f*v,M=n*g+a*E+c*S,I=o*g+s*E+l*S,O=i*g+u*E+f*S;return r[0]=C,r[1]=w,r[2]=b,r[3]=0,r[4]=A,r[5]=x,r[6]=T,r[7]=0,r[8]=M,r[9]=I,r[10]=O,r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},c.multiplyByTranslation=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=n*e[0]+o*e[4]+i*e[8]+e[12],s=n*e[1]+o*e[5]+i*e[9]+e[13],u=n*e[2]+o*e[6]+i*e[10]+e[14];return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=a,r[13]=s,r[14]=u,r[15]=e[15],r};var p=new e;c.multiplyByUniformScale=function(e,t,r){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,r)},c.multiplyByScale=function(e,t,r){var n=t.x,o=t.y,i=t.z;return 1===n&&1===o&&1===i?c.clone(e,r):(r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=0,r[4]=o*e[4],r[5]=o*e[5],r[6]=o*e[6],r[7]=0,r[8]=i*e[8],r[9]=i*e[9],r[10]=i*e[10],r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=1,r)},c.multiplyByVector=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=t.w,s=e[0]*n+e[4]*o+e[8]*i+e[12]*a,u=e[1]*n+e[5]*o+e[9]*i+e[13]*a,c=e[2]*n+e[6]*o+e[10]*i+e[14]*a,l=e[3]*n+e[7]*o+e[11]*i+e[15]*a;return r.x=s,r.y=u,r.z=c,r.w=l,r},c.multiplyByPointAsVector=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=e[0]*n+e[4]*o+e[8]*i,s=e[1]*n+e[5]*o+e[9]*i,u=e[2]*n+e[6]*o+e[10]*i;return r.x=a,r.y=s,r.z=u,r},c.multiplyByPoint=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=e[0]*n+e[4]*o+e[8]*i+e[12],s=e[1]*n+e[5]*o+e[9]*i+e[13],u=e[2]*n+e[6]*o+e[10]*i+e[14];return r.x=a,r.y=s,r.z=u,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var r=e[1],n=e[2],o=e[3],i=e[6],a=e[7],s=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=o,t[13]=a,t[14]=s,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r&&Math.abs(e[9]-t[9])<=r&&Math.abs(e[10]-t[10])<=r&&Math.abs(e[11]-t[11])<=r&&Math.abs(e[12]-t[12])<=r&&Math.abs(e[13]-t[13])<=r&&Math.abs(e[14]-t[14])<=r&&Math.abs(e[15]-t[15])<=r},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new s,v=new s,g=new t,E=new t(0,0,0,1);return c.inverse=function(e,r){if(s.equalsEpsilon(c.getRotation(e,y),v,a.EPSILON7)&&t.equals(c.getRow(e,3,g),E))return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=0,r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=1,r;var n=e[0],o=e[4],i=e[8],l=e[12],f=e[1],m=e[5],h=e[9],d=e[13],p=e[2],S=e[6],C=e[10],w=e[14],b=e[3],A=e[7],x=e[11],T=e[15],M=C*T,I=w*x,O=S*T,R=w*A,N=S*x,L=C*A,P=p*T,z=w*b,D=p*x,F=C*b,_=p*A,B=S*b,U=M*m+R*h+N*d-(I*m+O*h+L*d),G=I*f+P*h+F*d-(M*f+z*h+D*d),q=O*f+z*m+_*d-(R*f+P*m+B*d),k=L*f+D*m+B*h-(N*f+F*m+_*h),V=I*o+O*i+L*l-(M*o+R*i+N*l),W=M*n+z*i+D*l-(I*n+P*i+F*l),Y=R*n+P*o+B*l-(O*n+z*o+_*l),H=N*n+F*o+_*i-(L*n+D*o+B*i);M=i*d,I=l*h,O=o*d,R=l*m,N=o*h,L=i*m,P=n*d,z=l*f,D=n*h,F=i*f,_=n*m,B=o*f;var j=M*A+R*x+N*T-(I*A+O*x+L*T),K=I*b+P*x+F*T-(M*b+z*x+D*T),Z=O*b+z*A+_*T-(R*b+P*A+B*T),X=L*b+D*A+B*x-(N*b+F*A+_*x),Q=O*C+L*w+I*S-(N*w+M*S+R*C),J=D*w+M*p+z*C-(P*C+F*w+I*p),$=P*S+B*w+R*p-(_*w+O*p+z*S),et=_*C+N*p+F*S-(D*S+B*C+L*p),tt=n*U+o*G+i*q+l*k;if(Math.abs(tt)<a.EPSILON20)throw new u("matrix is not invertible because its determinate is zero.");return tt=1/tt,r[0]=U*tt,r[1]=G*tt,r[2]=q*tt,r[3]=k*tt,r[4]=V*tt,r[5]=W*tt,r[6]=Y*tt,r[7]=H*tt,r[8]=j*tt,r[9]=K*tt,r[10]=Z*tt,r[11]=X*tt,r[12]=Q*tt,r[13]=J*tt,r[14]=$*tt,r[15]=et*tt,r},c.inverseTransformation=function(e,t){var r=e[0],n=e[1],o=e[2],i=e[4],a=e[5],s=e[6],u=e[8],c=e[9],l=e[10],f=e[12],m=e[13],h=e[14],d=-r*f-n*m-o*h,p=-i*f-a*m-s*h,y=-u*f-c*m-l*h;return t[0]=r,t[1]=i,t[2]=u,t[3]=0,t[4]=n,t[5]=a,t[6]=c,t[7]=0,t[8]=o,t[9]=s,t[10]=l,t[11]=0,t[12]=d,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]&&e[9]===t[r+9]&&e[10]===t[r+10]&&e[11]===t[r+11]&&e[12]===t[r+12]&&e[13]===t[r+13]&&e[14]===t[r+14]&&e[15]===t[r+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var o=function(t,r){this.normal=e.clone(t),this.distance=r};o.fromPointNormal=function(r,n,i){var a=-e.dot(n,r);return t(i)?(e.clone(n,i.normal),i.distance=a,i):new o(n,a)};var i=new e;return o.fromCartesian4=function(r,n){var a=e.fromCartesian4(r,i),s=r.w;return t(n)?(e.clone(a,n.normal),n.distance=s,n):new o(a,s)},o.getPointDistance=function(t,r){return e.dot(t.normal,r)+t.distance},o.ORIGIN_XY_PLANE=n(new o(e.UNIT_Z,0)),o.ORIGIN_YZ_PLANE=n(new o(e.UNIT_X,0)),o.ORIGIN_ZX_PLANE=n(new o(e.UNIT_Y,0)),o}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,o,i,a,s){"use strict";var u=function(e,r,n,o){this.west=t(e,0),this.south=t(r,0),this.east=t(n,0),this.north=t(o,0)};n(u.prototype,{width:{get:function(){return u.computeWidth(this)}},height:{get:function(){return u.computeHeight(this)}}}),u.packedLength=4,u.pack=function(e,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},u.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new u),o.west=e[n++],o.south=e[n++],o.east=e[n++],o.north=e[n],o},u.computeWidth=function(e){var t=e.east,r=e.west;return r>t&&(t+=s.TWO_PI),t-r},u.computeHeight=function(e){return e.north-e.south},u.fromDegrees=function(e,n,o,i,a){return e=s.toRadians(t(e,0)),n=s.toRadians(t(n,0)),o=s.toRadians(t(o,0)),i=s.toRadians(t(i,0)),r(a)?(a.west=e,a.south=n,a.east=o,a.north=i,a):new u(e,n,o,i)},u.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,o=-Number.MAX_VALUE,i=Number.MAX_VALUE,a=-Number.MAX_VALUE,s=0,c=e.length;c>s;s++){var l=e[s];n=Math.min(n,l.longitude),o=Math.max(o,l.longitude),i=Math.min(i,l.latitude),a=Math.max(a,l.latitude)}return r(t)?(t.west=n,t.south=i,t.east=o,t.north=a,t):new u(n,i,o,a)},u.clone=function(e,t){return r(e)?r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new u(e.west,e.south,e.east,e.north):void 0},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u.equals=function(e,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},u.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},u.validate=function(){},u.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},u.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},u.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},u.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},u.center=function(t,n){var o=t.east,i=t.west;i>o&&(o+=s.TWO_PI);var a=s.negativePiToPi(.5*(i+o)),u=.5*(t.south+t.north);return r(n)?(n.longitude=a,n.latitude=u,n.height=0,n):new e(a,u)},u.intersection=function(e,t,n){var o=e.east,i=e.west,a=t.east,c=t.west;i>o&&a>0?o+=s.TWO_PI:c>a&&o>0&&(a+=s.TWO_PI),i>o&&0>c?c+=s.TWO_PI:c>a&&0>i&&(i+=s.TWO_PI);var l=s.negativePiToPi(Math.max(i,c)),f=s.negativePiToPi(Math.min(o,a));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var m=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return m>=h?void 0:r(n)?(n.west=l,n.south=m,n.east=f,n.north=h,n):new u(l,m,f,h)},u.contains=function(e,t){var r=t.longitude,n=t.latitude,o=e.west,i=e.east;return o>i&&(i+=s.TWO_PI,0>r&&(r+=s.TWO_PI)),(r>o||s.equalsEpsilon(r,o,s.EPSILON14))&&(i>r||s.equalsEpsilon(r,i,s.EPSILON14))&&n>=e.south&&n<=e.north};var c=new e;return u.subsample=function(e,n,o,a){n=t(n,i.WGS84),o=t(o,0),r(a)||(a=[]);var l=0,f=e.north,m=e.south,h=e.east,d=e.west,p=c;p.height=o,p.longitude=d,p.latitude=f,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.longitude=h,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.latitude=m,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.longitude=d,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.latitude=0>f?f:m>0?m:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*s.PI_OVER_TWO,u.contains(e,p)&&(a[l]=n.cartographicToCartesian(p,a[l]),l++);return 0===p.latitude&&(p.longitude=d,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.longitude=h,a[l]=n.cartographicToCartesian(p,a[l]),l++),a.length=l,a},u.MAX_VALUE=a(new u(-Math.PI,-s.PI_OVER_TWO,Math.PI,s.PI_OVER_TWO)),u}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,r,n,o,i,a,s,u,c,l,f,m){"use strict";var h=function(t,n){this.center=e.clone(r(t,e.ZERO)),this.radius=r(n,0)},d=new e,p=new e,y=new e,v=new e,g=new e,E=new e,S=new e,C=new e,w=new e,b=new e,A=new e,x=new e;h.fromPoints=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;for(var o=e.clone(t[0],S),i=e.clone(o,d),a=e.clone(o,p),s=e.clone(o,y),u=e.clone(o,v),c=e.clone(o,g),l=e.clone(o,E),f=t.length,m=1;f>m;m++){e.clone(t[m],o);var T=o.x,M=o.y,I=o.z;T<i.x&&e.clone(o,i),T>u.x&&e.clone(o,u),M<a.y&&e.clone(o,a),M>c.y&&e.clone(o,c),I<s.z&&e.clone(o,s),I>l.z&&e.clone(o,l)}var O=e.magnitudeSquared(e.subtract(u,i,C)),R=e.magnitudeSquared(e.subtract(c,a,C)),N=e.magnitudeSquared(e.subtract(l,s,C)),L=i,P=u,z=O;R>z&&(z=R,L=a,P=c),N>z&&(z=N,L=s,P=l);var D=w;D.x=.5*(L.x+P.x),D.y=.5*(L.y+P.y),D.z=.5*(L.z+P.z);var F=e.magnitudeSquared(e.subtract(P,D,C)),_=Math.sqrt(F),B=b;B.x=i.x,B.y=a.y,B.z=s.z;var U=A;U.x=u.x,U.y=c.y,U.z=l.z;var G=e.multiplyByScalar(e.add(B,U,C),.5,x),q=0;for(m=0;f>m;m++){e.clone(t[m],o);var k=e.magnitude(e.subtract(o,G,C));k>q&&(q=k);var V=e.magnitudeSquared(e.subtract(o,D,C));if(V>F){var W=Math.sqrt(V);_=.5*(_+W),F=_*_;var Y=W-_;D.x=(_*D.x+Y*o.x)/W,D.y=(_*D.y+Y*o.y)/W,D.z=(_*D.z+Y*o.z)/W}}return q>_?(e.clone(D,r.center),r.radius=_):(e.clone(G,r.center),r.radius=q),r};var T=new s,M=new e,I=new e,O=new t,R=new t;h.fromRectangle2D=function(e,t,r){return h.fromRectangleWithHeights2D(e,t,0,0,r)},h.fromRectangleWithHeights2D=function(t,o,i,a,s){if(n(s)||(s=new h),!n(t))return s.center=e.clone(e.ZERO,s.center),s.radius=0,s;o=r(o,T),m.southwest(t,O),O.height=i,m.northeast(t,R),R.height=a;var u=o.project(O,M),c=o.project(R,I),l=c.x-u.x,f=c.y-u.y,d=c.z-u.z;s.radius=.5*Math.sqrt(l*l+f*f+d*d);var p=s.center;return p.x=u.x+.5*l,p.y=u.y+.5*f,p.z=u.z+.5*d,s};var N=[];h.fromRectangle3D=function(e,t,o,i){t=r(t,a.WGS84),o=r(o,0);var s;return n(e)&&(s=m.subsample(e,t,o,N)),h.fromPoints(s,i)},h.fromVertices=function(t,o,i,a){if(n(a)||(a=new h),!n(t)||0===t.length)return a.center=e.clone(e.ZERO,a.center),a.radius=0,a;o=r(o,e.ZERO),i=r(i,3);var s=S;s.x=t[0]+o.x,s.y=t[1]+o.y,s.z=t[2]+o.z;for(var u=e.clone(s,d),c=e.clone(s,p),l=e.clone(s,y),f=e.clone(s,v),m=e.clone(s,g),T=e.clone(s,E),M=t.length,I=0;M>I;I+=i){var O=t[I]+o.x,R=t[I+1]+o.y,N=t[I+2]+o.z;s.x=O,s.y=R,s.z=N,O<u.x&&e.clone(s,u),O>f.x&&e.clone(s,f),R<c.y&&e.clone(s,c),R>m.y&&e.clone(s,m),N<l.z&&e.clone(s,l),N>T.z&&e.clone(s,T)}var L=e.magnitudeSquared(e.subtract(f,u,C)),P=e.magnitudeSquared(e.subtract(m,c,C)),z=e.magnitudeSquared(e.subtract(T,l,C)),D=u,F=f,_=L;P>_&&(_=P,D=c,F=m),z>_&&(_=z,D=l,F=T);var B=w;B.x=.5*(D.x+F.x),B.y=.5*(D.y+F.y),B.z=.5*(D.z+F.z);var U=e.magnitudeSquared(e.subtract(F,B,C)),G=Math.sqrt(U),q=b;q.x=u.x,q.y=c.y,q.z=l.z;var k=A;k.x=f.x,k.y=m.y,k.z=T.z;var V=e.multiplyByScalar(e.add(q,k,C),.5,x),W=0;for(I=0;M>I;I+=i){s.x=t[I]+o.x,s.y=t[I+1]+o.y,s.z=t[I+2]+o.z;var Y=e.magnitude(e.subtract(s,V,C));Y>W&&(W=Y);var H=e.magnitudeSquared(e.subtract(s,B,C));if(H>U){var j=Math.sqrt(H);G=.5*(G+j),U=G*G;var K=j-G;B.x=(G*B.x+K*s.x)/j,B.y=(G*B.y+K*s.y)/j,B.z=(G*B.z+K*s.z)/j}}return W>G?(e.clone(B,a.center),a.radius=G):(e.clone(V,a.center),a.radius=W),a},h.fromCornerPoints=function(t,r,o){n(o)||(o=new h);var i=o.center;return e.add(t,r,i),e.multiplyByScalar(i,.5,i),o.radius=e.distance(i,r),o},h.fromEllipsoid=function(t,r){return n(r)||(r=new h),e.clone(e.ZERO,r.center),r.radius=t.maximumRadius,r};var L=new e;h.fromBoundingSpheres=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var o=t.length;if(1===o)return h.clone(t[0],r);if(2===o)return h.union(t[0],t[1],r);for(var i=[],a=0;o>a;a++)i.push(t[a].center);r=h.fromPoints(i,r);var s=r.center,u=r.radius;for(a=0;o>a;a++){var c=t[a];u=Math.max(u,e.distance(s,c.center,L)+c.radius)}return r.radius=u,r},h.clone=function(t,r){return n(t)?n(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,n){n=r(n,0);var o=e.center;t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n]=e.radius},h.unpack=function(e,t,o){t=r(t,0),n(o)||(o=new h);var i=o.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],o.radius=e[t],o};var P=new e,z=new e;h.union=function(t,r,o){n(o)||(o=new h);var i=t.center,a=t.radius,s=r.center,u=r.radius,c=e.subtract(s,i,P),l=e.magnitude(c);if(a>=l+u)return t.clone(o),o;if(u>=l+a)return r.clone(o),o;var f=.5*(a+l+u),m=e.multiplyByScalar(c,(-a+f)/l,z);return e.add(m,i,m),e.clone(m,o.center),o.radius=f,o};var D=new e;h.expand=function(t,r,n){n=h.clone(t,n);var o=e.magnitude(e.subtract(r,n.center,D));return o>n.radius&&(n.radius=o),n},h.intersectPlane=function(t,r){var n=t.center,o=t.radius,i=r.normal,a=e.dot(i,n)+r.distance;return-o>a?u.OUTSIDE:o>a?u.INTERSECTING:u.INSIDE};var F=new f(new e,0);h.intersect=function(e,t){o("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var r=f.fromCartesian4(t,F);return h.intersectPlane(e,r)},h.transform=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=l.getMaximumScale(t)*e.radius,r};var _=new e;h.distanceSquaredTo=function(t,r){var n=e.subtract(t.center,r,_);return e.magnitudeSquared(n)-t.radius*t.radius},h.transformWithoutScale=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var B=new e;h.computePlaneDistances=function(t,r,o,i){n(i)||(i=new c);var a=e.subtract(t.center,r,B),s=e.multiplyByScalar(o,e.dot(o,a),B),u=e.magnitude(s);return i.start=u-t.radius,i.stop=u+t.radius,i};for(var U=new e,G=new e,q=new e,k=new e,V=new e,W=new t,Y=new Array(8),H=0;8>H;++H)Y[H]=new e;var j=new s;return h.projectTo2D=function(t,n,o){n=r(n,j);var i=n.ellipsoid,a=t.center,s=t.radius,u=i.geodeticSurfaceNormal(a,U),c=e.cross(e.UNIT_Z,u,G);e.normalize(c,c);var l=e.cross(u,c,q);e.normalize(l,l),e.multiplyByScalar(u,s,u),e.multiplyByScalar(l,s,l),e.multiplyByScalar(c,s,c);var f=e.negate(l,V),m=e.negate(c,k),d=Y,p=d[0];e.add(u,l,p),e.add(p,c,p),p=d[1],e.add(u,l,p),e.add(p,m,p),p=d[2],e.add(u,f,p),e.add(p,m,p),p=d[3],e.add(u,f,p),e.add(p,c,p),e.negate(u,u),p=d[4],e.add(u,l,p),e.add(p,c,p),p=d[5],e.add(u,l,p),e.add(p,m,p),p=d[6],e.add(u,f,p),e.add(p,m,p),p=d[7],e.add(u,f,p),e.add(p,c,p);for(var y=d.length,v=0;y>v;++v){var g=d[v];e.add(a,g,g);var E=i.cartesianToCartographic(g,W);n.project(E,g)}o=h.fromPoints(d,o),a=o.center;var S=a.x,C=a.y,w=a.z;return a.x=w,a.y=S,a.z=C,o},h.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},o={};return t(o,{element:{get:function(){return o.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return o.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return o.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return o.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return o.supportsFullscreen()?null!==o.element:void 0}}}),o.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var o,i=["webkit","moz","o","ms","khtml"],a=0,s=i.length;s>a;++a){var u=i[a];o=u+"RequestFullscreen","function"==typeof t[o]?(n.requestFullscreen=o,r=!0):(o=u+"RequestFullScreen","function"==typeof t[o]&&(n.requestFullscreen=o,r=!0)),o=u+"ExitFullscreen","function"==typeof document[o]?n.exitFullscreen=o:(o=u+"CancelFullScreen","function"==typeof document[o]&&(n.exitFullscreen=o)),o=u+"FullscreenEnabled",e(document[o])?n.fullscreenEnabled=o:(o=u+"FullScreenEnabled",e(document[o])&&(n.fullscreenEnabled=o)),o=u+"FullscreenElement",e(document[o])?n.fullscreenElement=o:(o=u+"FullScreenElement",e(document[o])&&(n.fullscreenElement=o)),o=u+"fullscreenchange",e(document["on"+o])&&("ms"===u&&(o="MSFullscreenChange"),n.fullscreenchange=o),o=u+"fullscreenerror",e(document["on"+o])&&("ms"===u&&(o="MSFullscreenError"),n.fullscreenerror=o)}return r},o.requestFullscreen=function(e){o.supportsFullscreen()&&e[n.requestFullscreen]()},o.exitFullscreen=function(){o.supportsFullscreen()&&document[n.exitFullscreen]()},o}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function o(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=n(e[1]))}return y}function i(){return o()&&v}function a(){if(!t(g)&&(g=!1,!o()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,E=n(e[1]))}return g}function s(){return a()&&E}function u(){if(!t(S)){S=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(S=!0,C=n(e[1]),C.isNightly=!!e[2])}return S}function c(){return u()&&C}function l(){if(!t(w)){w=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(w=!0,b=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(w=!0,b=n(e[1])))}return w}function f(){return l()&&b}function m(){if(!t(A)){A=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(A=!0,x=n(e[1]))}return A}function h(){return t(T)||(T=/Windows/i.test(navigator.appVersion)),T}function d(){return m()&&x}function p(){return t(M)||(M=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),M}var y,v,g,E,S,C,w,b,A,x,T,M,I={isChrome:o,chromeVersion:i,isSafari:a,safariVersion:s,isWebkit:u,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:m,firefoxVersion:d,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return I.supportsFullscreen=function(){return r.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/Color",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math"],function(e,t,r,n,o,i){"use strict";function a(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1>6*r?e+6*(t-e)*r:1>2*r?t:2>3*r?e+6*(t-e)*(2/3-r):e}var s=function(t,r,n,o){this.red=e(t,1),this.green=e(r,1),this.blue=e(n,1),this.alpha=e(o,1)};s.fromCartesian4=function(e,r){return t(r)?(r.red=e.x,r.green=e.y,r.blue=e.z,r.alpha=e.w,r):new s(e.x,e.y,e.z,e.w)},s.fromBytes=function(r,n,o,i,a){return r=s.byteToFloat(e(r,255)),n=s.byteToFloat(e(n,255)),o=s.byteToFloat(e(o,255)),i=s.byteToFloat(e(i,255)),t(a)?(a.red=r,a.green=n,a.blue=o,a.alpha=i,a):new s(r,n,o,i)},s.fromAlpha=function(e,r,n){return t(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=r,n):new s(e.red,e.green,e.blue,r)};var u,c,l;n.supportsTypedArrays()&&(u=new ArrayBuffer(4),c=new Uint32Array(u),l=new Uint8Array(u)),s.fromRgba=function(e){return c[0]=e,s.fromBytes(l[0],l[1],l[2],l[3])},s.fromHsl=function(t,r,n,o){t=e(t,0)%1,r=e(r,0),n=e(n,0),o=e(o,1);var i=n,u=n,c=n;if(0!==r){var l;l=.5>n?n*(1+r):n+r-n*r;var f=2*n-l;i=a(f,l,t+1/3),u=a(f,l,t),c=a(f,l,t-1/3)}return new s(i,u,c,o)},s.fromRandom=function(r,n){r=e(r,e.EMPTY_OBJECT);var o=r.red;if(!t(o)){var a=e(r.minimumRed,0),u=e(r.maximumRed,1);o=a+i.nextRandomNumber()*(u-a)}var c=r.green;if(!t(c)){var l=e(r.minimumGreen,0),f=e(r.maximumGreen,1);c=l+i.nextRandomNumber()*(f-l)}var m=r.blue;if(!t(m)){var h=e(r.minimumBlue,0),d=e(r.maximumBlue,1);m=h+i.nextRandomNumber()*(d-h)}var p=r.alpha;if(!t(p)){var y=e(r.minimumAlpha,0),v=e(r.maximumAlpha,1);p=y+i.nextRandomNumber()*(v-y)}return t(n)?(n.red=o,n.green=c,n.blue=m,n.alpha=p,n):new s(o,c,m,p)};var f=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,m=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,h=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,d=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;return s.fromCssColorString=function(r){var n=s[r.toUpperCase()];if(t(n))return s.clone(n);var o=f.exec(r);return null!==o?new s(parseInt(o[1],16)/15,parseInt(o[2],16)/15,parseInt(o[3],16)/15):(o=m.exec(r),null!==o?new s(parseInt(o[1],16)/255,parseInt(o[2],16)/255,parseInt(o[3],16)/255):(o=h.exec(r),null!==o?new s(parseFloat(o[1])/("%"===o[1].substr(-1)?100:255),parseFloat(o[2])/("%"===o[2].substr(-1)?100:255),parseFloat(o[3])/("%"===o[3].substr(-1)?100:255),parseFloat(e(o[4],"1.0"))):(o=d.exec(r),null!==o?s.fromHsl(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,parseFloat(e(o[4],"1.0"))):void 0)))},s.packedLength=4,s.pack=function(t,r,n){n=e(n,0),r[n++]=t.red,r[n++]=t.green,r[n++]=t.blue,r[n]=t.alpha},s.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new s),o.red=r[n++],o.green=r[n++],o.blue=r[n++],o.alpha=r[n],o},s.byteToFloat=function(e){return e/255},s.floatToByte=function(e){return 1===e?255:0|256*e},s.clone=function(e,r){return t(e)?t(r)?(r.red=e.red,r.green=e.green,r.blue=e.blue,r.alpha=e.alpha,r):new s(e.red,e.green,e.blue,e.alpha):void 0},s.equals=function(e,r){return e===r||t(e)&&t(r)&&e.red===r.red&&e.green===r.green&&e.blue===r.blue&&e.alpha===r.alpha},s.equalsArray=function(e,t,r){return e.red===t[r]&&e.green===t[r+1]&&e.blue===t[r+2]&&e.alpha===t[r+3]},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,r){return this===e||t(e)&&Math.abs(this.red-e.red)<=r&&Math.abs(this.green-e.green)<=r&&Math.abs(this.blue-e.blue)<=r&&Math.abs(this.alpha-e.alpha)<=r},s.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},s.prototype.toCssColorString=function(){var e=s.floatToByte(this.red),t=s.floatToByte(this.green),r=s.floatToByte(this.blue);return 1===this.alpha?"rgb("+e+","+t+","+r+")":"rgba("+e+","+t+","+r+","+this.alpha+")"},s.prototype.toBytes=function(e){var r=s.floatToByte(this.red),n=s.floatToByte(this.green),o=s.floatToByte(this.blue),i=s.floatToByte(this.alpha);return t(e)?(e[0]=r,e[1]=n,e[2]=o,e[3]=i,e):[r,n,o,i]},s.prototype.toRgba=function(){return l[0]=s.floatToByte(this.red),l[1]=s.floatToByte(this.green),l[2]=s.floatToByte(this.blue),l[3]=s.floatToByte(this.alpha),c[0]},s.prototype.brighten=function(e,t){return e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t},s.prototype.darken=function(e,t){return e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t},s.prototype.withAlpha=function(e,t){return s.fromAlpha(this,e,t)},s.ALICEBLUE=o(s.fromCssColorString("#F0F8FF")),s.ANTIQUEWHITE=o(s.fromCssColorString("#FAEBD7")),s.AQUA=o(s.fromCssColorString("#00FFFF")),s.AQUAMARINE=o(s.fromCssColorString("#7FFFD4")),s.AZURE=o(s.fromCssColorString("#F0FFFF")),s.BEIGE=o(s.fromCssColorString("#F5F5DC")),s.BISQUE=o(s.fromCssColorString("#FFE4C4")),s.BLACK=o(s.fromCssColorString("#000000")),s.BLANCHEDALMOND=o(s.fromCssColorString("#FFEBCD")),s.BLUE=o(s.fromCssColorString("#0000FF")),s.BLUEVIOLET=o(s.fromCssColorString("#8A2BE2")),s.BROWN=o(s.fromCssColorString("#A52A2A")),s.BURLYWOOD=o(s.fromCssColorString("#DEB887")),s.CADETBLUE=o(s.fromCssColorString("#5F9EA0")),s.CHARTREUSE=o(s.fromCssColorString("#7FFF00")),s.CHOCOLATE=o(s.fromCssColorString("#D2691E")),s.CORAL=o(s.fromCssColorString("#FF7F50")),s.CORNFLOWERBLUE=o(s.fromCssColorString("#6495ED")),s.CORNSILK=o(s.fromCssColorString("#FFF8DC")),s.CRIMSON=o(s.fromCssColorString("#DC143C")),s.CYAN=o(s.fromCssColorString("#00FFFF")),s.DARKBLUE=o(s.fromCssColorString("#00008B")),s.DARKCYAN=o(s.fromCssColorString("#008B8B")),s.DARKGOLDENROD=o(s.fromCssColorString("#B8860B")),s.DARKGRAY=o(s.fromCssColorString("#A9A9A9")),s.DARKGREEN=o(s.fromCssColorString("#006400")),s.DARKGREY=s.DARKGRAY,s.DARKKHAKI=o(s.fromCssColorString("#BDB76B")),s.DARKMAGENTA=o(s.fromCssColorString("#8B008B")),s.DARKOLIVEGREEN=o(s.fromCssColorString("#556B2F")),s.DARKORANGE=o(s.fromCssColorString("#FF8C00")),s.DARKORCHID=o(s.fromCssColorString("#9932CC")),s.DARKRED=o(s.fromCssColorString("#8B0000")),s.DARKSALMON=o(s.fromCssColorString("#E9967A")),s.DARKSEAGREEN=o(s.fromCssColorString("#8FBC8F")),s.DARKSLATEBLUE=o(s.fromCssColorString("#483D8B")),s.DARKSLATEGRAY=o(s.fromCssColorString("#2F4F4F")),s.DARKSLATEGREY=s.DARKSLATEGRAY,s.DARKTURQUOISE=o(s.fromCssColorString("#00CED1")),s.DARKVIOLET=o(s.fromCssColorString("#9400D3")),s.DEEPPINK=o(s.fromCssColorString("#FF1493")),s.DEEPSKYBLUE=o(s.fromCssColorString("#00BFFF")),s.DIMGRAY=o(s.fromCssColorString("#696969")),s.DIMGREY=s.DIMGRAY,s.DODGERBLUE=o(s.fromCssColorString("#1E90FF")),s.FIREBRICK=o(s.fromCssColorString("#B22222")),s.FLORALWHITE=o(s.fromCssColorString("#FFFAF0")),s.FORESTGREEN=o(s.fromCssColorString("#228B22")),s.FUSCHIA=o(s.fromCssColorString("#FF00FF")),s.GAINSBORO=o(s.fromCssColorString("#DCDCDC")),s.GHOSTWHITE=o(s.fromCssColorString("#F8F8FF")),s.GOLD=o(s.fromCssColorString("#FFD700")),s.GOLDENROD=o(s.fromCssColorString("#DAA520")),s.GRAY=o(s.fromCssColorString("#808080")),s.GREEN=o(s.fromCssColorString("#008000")),s.GREENYELLOW=o(s.fromCssColorString("#ADFF2F")),s.GREY=s.GRAY,s.HONEYDEW=o(s.fromCssColorString("#F0FFF0")),s.HOTPINK=o(s.fromCssColorString("#FF69B4")),s.INDIANRED=o(s.fromCssColorString("#CD5C5C")),s.INDIGO=o(s.fromCssColorString("#4B0082")),s.IVORY=o(s.fromCssColorString("#FFFFF0")),s.KHAKI=o(s.fromCssColorString("#F0E68C")),s.LAVENDER=o(s.fromCssColorString("#E6E6FA")),s.LAVENDAR_BLUSH=o(s.fromCssColorString("#FFF0F5")),s.LAWNGREEN=o(s.fromCssColorString("#7CFC00")),s.LEMONCHIFFON=o(s.fromCssColorString("#FFFACD")),s.LIGHTBLUE=o(s.fromCssColorString("#ADD8E6")),s.LIGHTCORAL=o(s.fromCssColorString("#F08080")),s.LIGHTCYAN=o(s.fromCssColorString("#E0FFFF")),s.LIGHTGOLDENRODYELLOW=o(s.fromCssColorString("#FAFAD2")),s.LIGHTGRAY=o(s.fromCssColorString("#D3D3D3")),s.LIGHTGREEN=o(s.fromCssColorString("#90EE90")),s.LIGHTGREY=s.LIGHTGRAY,s.LIGHTPINK=o(s.fromCssColorString("#FFB6C1")),s.LIGHTSEAGREEN=o(s.fromCssColorString("#20B2AA")),s.LIGHTSKYBLUE=o(s.fromCssColorString("#87CEFA")),s.LIGHTSLATEGRAY=o(s.fromCssColorString("#778899")),s.LIGHTSLATEGREY=s.LIGHTSLATEGRAY,s.LIGHTSTEELBLUE=o(s.fromCssColorString("#B0C4DE")),s.LIGHTYELLOW=o(s.fromCssColorString("#FFFFE0")),s.LIME=o(s.fromCssColorString("#00FF00")),s.LIMEGREEN=o(s.fromCssColorString("#32CD32")),s.LINEN=o(s.fromCssColorString("#FAF0E6")),s.MAGENTA=o(s.fromCssColorString("#FF00FF")),s.MAROON=o(s.fromCssColorString("#800000")),s.MEDIUMAQUAMARINE=o(s.fromCssColorString("#66CDAA")),s.MEDIUMBLUE=o(s.fromCssColorString("#0000CD")),s.MEDIUMORCHID=o(s.fromCssColorString("#BA55D3")),s.MEDIUMPURPLE=o(s.fromCssColorString("#9370DB")),s.MEDIUMSEAGREEN=o(s.fromCssColorString("#3CB371")),s.MEDIUMSLATEBLUE=o(s.fromCssColorString("#7B68EE")),s.MEDIUMSPRINGGREEN=o(s.fromCssColorString("#00FA9A")),s.MEDIUMTURQUOISE=o(s.fromCssColorString("#48D1CC")),s.MEDIUMVIOLETRED=o(s.fromCssColorString("#C71585")),s.MIDNIGHTBLUE=o(s.fromCssColorString("#191970")),s.MINTCREAM=o(s.fromCssColorString("#F5FFFA")),s.MISTYROSE=o(s.fromCssColorString("#FFE4E1")),s.MOCCASIN=o(s.fromCssColorString("#FFE4B5")),s.NAVAJOWHITE=o(s.fromCssColorString("#FFDEAD")),s.NAVY=o(s.fromCssColorString("#000080")),s.OLDLACE=o(s.fromCssColorString("#FDF5E6")),s.OLIVE=o(s.fromCssColorString("#808000")),s.OLIVEDRAB=o(s.fromCssColorString("#6B8E23")),s.ORANGE=o(s.fromCssColorString("#FFA500")),s.ORANGERED=o(s.fromCssColorString("#FF4500")),s.ORCHID=o(s.fromCssColorString("#DA70D6")),s.PALEGOLDENROD=o(s.fromCssColorString("#EEE8AA")),s.PALEGREEN=o(s.fromCssColorString("#98FB98")),s.PALETURQUOISE=o(s.fromCssColorString("#AFEEEE")),s.PALEVIOLETRED=o(s.fromCssColorString("#DB7093")),s.PAPAYAWHIP=o(s.fromCssColorString("#FFEFD5")),s.PEACHPUFF=o(s.fromCssColorString("#FFDAB9")),s.PERU=o(s.fromCssColorString("#CD853F")),s.PINK=o(s.fromCssColorString("#FFC0CB")),s.PLUM=o(s.fromCssColorString("#DDA0DD")),s.POWDERBLUE=o(s.fromCssColorString("#B0E0E6")),s.PURPLE=o(s.fromCssColorString("#800080")),s.RED=o(s.fromCssColorString("#FF0000")),s.ROSYBROWN=o(s.fromCssColorString("#BC8F8F")),s.ROYALBLUE=o(s.fromCssColorString("#4169E1")),s.SADDLEBROWN=o(s.fromCssColorString("#8B4513")),s.SALMON=o(s.fromCssColorString("#FA8072")),s.SANDYBROWN=o(s.fromCssColorString("#F4A460")),s.SEAGREEN=o(s.fromCssColorString("#2E8B57")),s.SEASHELL=o(s.fromCssColorString("#FFF5EE")),s.SIENNA=o(s.fromCssColorString("#A0522D")),s.SILVER=o(s.fromCssColorString("#C0C0C0")),s.SKYBLUE=o(s.fromCssColorString("#87CEEB")),s.SLATEBLUE=o(s.fromCssColorString("#6A5ACD")),s.SLATEGRAY=o(s.fromCssColorString("#708090")),s.SLATEGREY=s.SLATEGRAY,s.SNOW=o(s.fromCssColorString("#FFFAFA")),s.SPRINGGREEN=o(s.fromCssColorString("#00FF7F")),s.STEELBLUE=o(s.fromCssColorString("#4682B4")),s.TAN=o(s.fromCssColorString("#D2B48C")),s.TEAL=o(s.fromCssColorString("#008080")),s.THISTLE=o(s.fromCssColorString("#D8BFD8")),s.TOMATO=o(s.fromCssColorString("#FF6347")),s.TURQUOISE=o(s.fromCssColorString("#40E0D0")),s.VIOLET=o(s.fromCssColorString("#EE82EE")),s.WHEAT=o(s.fromCssColorString("#F5DEB3")),s.WHITE=o(s.fromCssColorString("#FFFFFF")),s.WHITESMOKE=o(s.fromCssColorString("#F5F5F5")),s.YELLOW=o(s.fromCssColorString("#FFFF00")),s.YELLOWGREEN=o(s.fromCssColorString("#9ACD32")),s.TRANSPARENT=o(new s(0,0,0,0)),s -}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,r,n,o){"use strict";if(!n.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new r("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,n,o,a){switch(o=e(o,0),a=e(a,(n.byteLength-o)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(n,o,a);case i.UNSIGNED_BYTE:return new Uint8Array(n,o,a);case i.SHORT:return new Int16Array(n,o,a);case i.UNSIGNED_SHORT:return new Uint16Array(n,o,a);case i.FLOAT:return new Float32Array(n,o,a);case i.DOUBLE:return new Float64Array(n,o,a);default:throw new r("componentDatatype is not a valid value.")}},o(i)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,o){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,o.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,n.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var n=-1;for(var o in e.attributes)if(e.attributes.hasOwnProperty(o)&&t(e.attributes[o])&&t(e.attributes[o].values)){var i=e.attributes[o],a=i.values.length/i.componentsPerAttribute;if(n!==a&&-1!==n)throw new r("All attribute lists must have the same number of attributes.");n=a}return n},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o){"use strict";var i=function(t,r){this.x=e(t,0),this.y=e(r,0)};i.fromElements=function(e,r,n){return t(n)?(n.x=e,n.y=r,n):new i(e,r)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n]=t.y},i.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new i),o.x=r[n++],o.y=r[n],o},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var a=new i;i.distance=function(e,t){return i.subtract(e,t,a),i.magnitude(a)},i.distanceSquared=function(e,t){return i.subtract(e,t,a),i.magnitudeSquared(a)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var s=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,s),n=i.multiplyByScalar(e,1-r,n),i.add(s,n,n)};var u=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,u),i.normalize(t,c),o.acosClamped(i.dot(u,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&o.equalsEpsilon(e.x,r.x,n,i)&&o.equalsEpsilon(e.y,r.y,n,i)},i.ZERO=n(new i(0,0)),i.UNIT_X=n(new i(1,0)),i.UNIT_Y=n(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n,o){"use strict";var i={};i.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=t.x,n=t.y;t.x=(1-Math.abs(n))*o.signNotZero(r),t.y=(1-Math.abs(r))*o.signNotZero(n)}return t.x=o.toSNorm(t.x),t.y=o.toSNorm(t.y),t},i.octDecode=function(e,r,n){if(n.x=o.fromSNorm(e),n.y=o.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var i=n.x;n.x=(1-Math.abs(n.y))*o.signNotZero(i),n.y=(1-Math.abs(i))*o.signNotZero(n.y)}return t.normalize(n,n)},i.octPackFloat=function(e){return 256*e.x+e.y};var a=new e;return i.octEncodeFloat=function(e){return i.octEncode(e,a),i.octPackFloat(a)},i.octDecodeFloat=function(e,t){var r=e/256,n=Math.floor(r),o=256*(r-n);return i.octDecode(n,o,t)},i.octPack=function(e,t,r,n){var o=i.octEncodeFloat(e),s=i.octEncodeFloat(t),u=i.octEncode(r,a);return n.x=65536*u.x+o,n.y=65536*u.y+s,n},i.octUnpack=function(e,t,r,n){var o=e.x/65536,a=Math.floor(o),s=65536*(o-a);o=e.y/65536;var u=Math.floor(o),c=65536*(o-u);i.octDecodeFloat(s,t),i.octDecodeFloat(c,r),i.octDecode(a,u,n)},i.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,r=1===e.y?4095:0|4096*e.y;return 4096*t+r},i.decompressTextureCoordinates=function(e,t){var r=e/4096;return t.x=Math.floor(r)/4096,t.y=r-Math.floor(r),t},i}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=new t,o=new t,i=new t,a=function(a,s,u,c,l){r(l)||(l=new t);var f,m,h,d,p,y,v,g;r(s.z)?(f=t.subtract(u,s,n),m=t.subtract(c,s,o),h=t.subtract(a,s,i),d=t.dot(f,f),p=t.dot(f,m),y=t.dot(f,h),v=t.dot(m,m),g=t.dot(m,h)):(f=e.subtract(u,s,n),m=e.subtract(c,s,o),h=e.subtract(a,s,i),d=e.dot(f,f),p=e.dot(f,m),y=e.dot(f,h),v=e.dot(m,m),g=e.dot(m,h));var E=1/(d*v-p*p);return l.y=(v*y-p*g)*E,l.z=(d*g-p*y)*E,l.x=1-l.y-l.z,l};return a}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};r.encode=function(e,r){t(r)||(r={high:0,low:0});var n;return e>=0?(n=65536*Math.floor(e/65536),r.high=n,r.low=e-n):(n=65536*Math.floor(-e/65536),r.high=-n,r.low=e+n),r};var n={high:0,low:0};r.fromCartesian=function(e,o){t(o)||(o=new r);var i=o.high,a=o.low;return r.encode(e.x,n),i.x=n.high,a.x=n.low,r.encode(e.y,n),i.y=n.high,a.y=n.low,r.encode(e.z,n),i.z=n.high,a.z=n.low,o};var o=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,o);var i=o.high,a=o.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=a.x,t[n+4]=a.y,t[n+5]=a.z},r}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";var o=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=n.clone(e(t.modelMatrix,n.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return o}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n){"use strict";var o={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return o.getSizeInBytes=function(e){switch(e){case o.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case o.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case o.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},o.validate=function(t){return e(t)&&(t===o.UNSIGNED_BYTE||t===o.UNSIGNED_SHORT||t===o.UNSIGNED_INT)},o.createTypedArray=function(e,t){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},o.createTypedArrayFromArrayBuffer=function(e,t,r,o){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,o):new Uint16Array(t,r,o)},r(o)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var o=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(o/Math.max(Math.abs(e),Math.abs(r)))<n?0:o}var n={};return n.computeDiscriminant=function(e,t,r){var n=t*t-4*e*r;return n},n.computeRealRoots=function(e,n,o){var i;if(0===e)return 0===n?[]:[-o/n];if(0===n){if(0===o)return[0,0];var a=Math.abs(o),s=Math.abs(e);if(s>a&&a/s<t.EPSILON14)return[0,0];if(a>s&&s/a<t.EPSILON14)return[];if(i=-o/e,0>i)return[];var u=Math.sqrt(i);return[-u,u]}if(0===o)return i=-n/e,0>i?[i,0]:[0,i];var c=n*n,l=4*e*o,f=r(c,-l,t.EPSILON14);if(0>f)return[];var m=-.5*r(n,t.sign(n)*Math.sqrt(f),t.EPSILON14);return n>0?[m/e,o/m]:[o/m,m/e]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var o,i,a=e,s=t/3,u=r/3,c=n,l=a*u,f=s*c,m=s*s,h=u*u,d=a*u-m,p=a*c-s*u,y=s*c-h,v=4*d*y-p*p;if(0>v){var g,E,S;m*f>=l*h?(g=a,E=d,S=-2*s*d+a*p):(g=c,E=y,S=-c*p+2*u*y);var C=0>S?-1:1,w=-C*Math.abs(g)*Math.sqrt(-v);i=-S+w;var b=i/2,A=0>b?-Math.pow(-b,1/3):Math.pow(b,1/3),x=i===w?-A:-E/A;return o=0>=E?A+x:-S/(A*A+x*x+E),m*f>=l*h?[(o-s)/a]:[-c/(o+u)]}var T=d,M=-2*s*d+a*p,I=y,O=-c*p+2*u*y,R=Math.sqrt(v),N=Math.sqrt(3)/2,L=Math.abs(Math.atan2(a*R,-M)/3);o=2*Math.sqrt(-T);var P=Math.cos(L);i=o*P;var z=o*(-P/2-N*Math.sin(L)),D=i+z>2*s?i-s:z-s,F=a,_=D/F;L=Math.abs(Math.atan2(c*R,-O)/3),o=2*Math.sqrt(-I),P=Math.cos(L),i=o*P,z=o*(-P/2-N*Math.sin(L));var B=-c,U=2*u>i+z?i+u:z+u,G=B/U,q=F*U,k=-D*U-F*B,V=D*B,W=(u*k-s*V)/(-s*k+u*q);return W>=_?G>=_?G>=W?[_,W,G]:[_,G,W]:[G,_,W]:G>=_?[W,_,G]:G>=W?[W,G,_]:[G,W,_]}var n={};return n.computeDiscriminant=function(e,t,r,n){var o=e*e,i=t*t,a=r*r,s=n*n,u=18*e*t*r*n+i*a-27*o*s-4*(e*a*r+i*t*n);return u},n.computeRealRoots=function(e,n,o,i){var a,s;if(0===e)return t.computeRealRoots(n,o,i);if(0===n){if(0===o){if(0===i)return[0,0,0];s=-i/e;var u=0>s?-Math.pow(-s,1/3):Math.pow(s,1/3);return[u,u,u]}return 0===i?(a=t.computeRealRoots(e,0,o),0===a.Length?[0]:[a[0],0,a[1]]):r(e,0,o,i)}return 0===o?0===i?(s=-n/e,0>s?[s,0,0]:[0,0,s]):r(e,n,0,i):0===i?(a=t.computeRealRoots(e,n,o),0===a.length?[0]:a[1]<=0?[a[0],a[1],0]:a[0]>=0?[0,a[0],a[1]]:[a[0],0,a[1]]):r(e,n,o,i)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function o(t,o,i,a){var s=t*t,u=o-3*s/8,c=i-o*t/2+s*t/8,l=a-i*t/4+o*s/16-3*s*s/256,f=e.computeRealRoots(1,2*u,u*u-4*l,-c*c);if(f.length>0){var m=-t/4,h=f[f.length-1];if(Math.abs(h)<r.EPSILON14){var d=n.computeRealRoots(1,u,l);if(2===d.length){var p,y=d[0],v=d[1];if(y>=0&&v>=0){var g=Math.sqrt(y),E=Math.sqrt(v);return[m-E,m-g,m+g,m+E]}if(y>=0&&0>v)return p=Math.sqrt(y),[m-p,m+p];if(0>y&&v>=0)return p=Math.sqrt(v),[m-p,m+p]}return[]}if(h>0){var S=Math.sqrt(h),C=(u+h-c/S)/2,w=(u+h+c/S)/2,b=n.computeRealRoots(1,S,C),A=n.computeRealRoots(1,-S,w);return 0!==b.length?(b[0]+=m,b[1]+=m,0!==A.length?(A[0]+=m,A[1]+=m,b[1]<=A[0]?[b[0],b[1],A[0],A[1]]:A[1]<=b[0]?[A[0],A[1],b[0],b[1]]:b[0]>=A[0]&&b[1]<=A[1]?[A[0],b[0],b[1],A[1]]:A[0]>=b[0]&&A[1]<=b[1]?[b[0],A[0],A[1],b[1]]:b[0]>A[0]&&b[0]<A[1]?[A[0],b[0],A[1],b[1]]:[b[0],A[0],b[1],A[1]]):b):0!==A.length?(A[0]+=m,A[1]+=m,A):[]}}return[]}function i(t,o,i,a){var s=i*i,u=o*o,c=t*t,l=-2*o,f=i*t+u-4*a,m=c*a-i*o*t+s,h=e.computeRealRoots(1,l,f,m);if(h.length>0){var d,p,y=h[0],v=o-y,g=v*v,E=t/2,S=v/2,C=g-4*a,w=g+4*Math.abs(a),b=c-4*y,A=c+4*Math.abs(y);if(0>y||b*w>C*A){var x=Math.sqrt(b);d=x/2,p=0===x?0:(t*S-i)/x}else{var T=Math.sqrt(C);d=0===T?0:(t*S-i)/T,p=T/2}var M,I;0===E&&0===d?(M=0,I=0):r.sign(E)===r.sign(d)?(M=E+d,I=y/M):(I=E-d,M=y/I);var O,R;0===S&&0===p?(O=0,R=0):r.sign(S)===r.sign(p)?(O=S+p,R=a/O):(R=S-p,O=a/R);var N=n.computeRealRoots(1,M,O),L=n.computeRealRoots(1,I,R);if(0!==N.length)return 0!==L.length?N[1]<=L[0]?[N[0],N[1],L[0],L[1]]:L[1]<=N[0]?[L[0],L[1],N[0],N[1]]:N[0]>=L[0]&&N[1]<=L[1]?[L[0],N[0],N[1],L[1]]:L[0]>=N[0]&&L[1]<=N[1]?[N[0],L[0],L[1],N[1]]:N[0]>L[0]&&N[0]<L[1]?[L[0],N[0],L[1],N[1]]:[N[0],L[0],N[1],L[1]]:N;if(0!==L.length)return L}return[]}var a={};return a.computeDiscriminant=function(e,t,r,n,o){var i=e*e,a=i*e,s=t*t,u=s*t,c=r*r,l=c*r,f=n*n,m=f*n,h=o*o,d=h*o,p=s*c*f-4*u*m-4*e*l*f+18*e*t*r*m-27*i*f*f+256*a*d+o*(18*u*r*n-4*s*l+16*e*c*c-80*e*t*c*n-6*e*s*f+144*i*r*f)+h*(144*e*s*r-27*s*s-128*i*c-192*i*t*n);return p},a.computeRealRoots=function(t,n,a,s,u){if(Math.abs(t)<r.EPSILON15)return e.computeRealRoots(n,a,s,u);var c=n/t,l=a/t,f=s/t,m=u/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>m?h+1:h){case 0:return o(c,l,f,m);case 1:return i(c,l,f,m);case 2:return i(c,l,f,m);case 3:return o(c,l,f,m);case 4:return o(c,l,f,m);case 5:return i(c,l,f,m);case 6:return o(c,l,f,m);case 7:return o(c,l,f,m);case 8:return i(c,l,f,m);case 9:return o(c,l,f,m);case 10:return o(c,l,f,m);case 11:return i(c,l,f,m);case 12:return o(c,l,f,m);case 13:return o(c,l,f,m);case 14:return o(c,l,f,m);case 15:return o(c,l,f,m);default:return void 0}},a}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=function(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n};return n.getPoint=function(t,n,o){return r(o)||(o=new e),o=e.multiplyByScalar(t.direction,n,o),e.add(t.origin,o,o)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,o,i,a,s,u,c){"use strict";function l(t,n,o,a,s){s=r(s,!1);var u,c,l,f,m,h=t.origin,d=t.direction,p=e.subtract(o,n,y),C=e.subtract(a,n,v),w=e.cross(d,C,g),b=e.dot(p,w);if(s){if(b<i.EPSILON6)return void 0;if(u=e.subtract(h,n,E),l=e.dot(u,w),0>l||l>b)return void 0;if(c=e.cross(u,p,S),f=e.dot(d,c),0>f||l+f>b)return void 0;m=e.dot(C,c)/b}else{if(Math.abs(b)<i.EPSILON6)return void 0;var A=1/b;if(u=e.subtract(h,n,E),l=e.dot(u,w)*A,0>l||l>1)return void 0;if(c=e.cross(u,p,S),f=e.dot(d,c)*A,0>f||l+f>1)return void 0;m=e.dot(C,c)*A}return m}function f(e,t,r,n){var o=t*t-4*e*r;if(0>o)return void 0;if(o>0){var i=1/(2*e),a=Math.sqrt(o),s=(-t+a)*i,u=(-t-a)*i;return u>s?(n.root0=s,n.root1=u):(n.root0=u,n.root1=s),n}var c=-t/(2*e);return 0===c?void 0:(n.root0=n.root1=c,n)}function m(t,r,o){n(o)||(o={});var i=t.origin,a=t.direction,s=r.center,u=r.radius*r.radius,c=e.subtract(i,s,g),l=e.dot(a,a),m=2*e.dot(a,c),h=e.magnitudeSquared(c)-u,d=f(l,m,h,w);return n(d)?(o.start=d.root0,o.stop=d.root1,o):void 0}function h(e,t,r){var n=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))<r?0:n}function d(t,r,n,o,c){var l,f=o*o,m=c*c,d=(t[a.COLUMN1ROW1]-t[a.COLUMN2ROW2])*m,p=c*(o*h(t[a.COLUMN1ROW0],t[a.COLUMN0ROW1],i.EPSILON15)+r.y),y=t[a.COLUMN0ROW0]*f+t[a.COLUMN2ROW2]*m+o*r.x+n,v=m*h(t[a.COLUMN2ROW1],t[a.COLUMN1ROW2],i.EPSILON15),g=c*(o*h(t[a.COLUMN2ROW0],t[a.COLUMN0ROW2])+r.z),E=[];if(0===g&&0===v){if(l=s.computeRealRoots(d,p,y),0===l.length)return E;var S=l[0],C=Math.sqrt(Math.max(1-S*S,0));if(E.push(new e(o,c*S,c*-C)),E.push(new e(o,c*S,c*C)),2===l.length){var w=l[1],b=Math.sqrt(Math.max(1-w*w,0));E.push(new e(o,c*w,c*-b)),E.push(new e(o,c*w,c*b))}return E}var A=g*g,x=v*v,T=d*d,M=g*v,I=T+x,O=2*(p*d+M),R=2*y*d+p*p-x+A,N=2*(y*p-M),L=y*y-A;if(0===I&&0===O&&0===R&&0===N)return E;l=u.computeRealRoots(I,O,R,N,L);var P=l.length;if(0===P)return E;for(var z=0;P>z;++z){var D,F=l[z],_=F*F,B=Math.max(1-_,0),U=Math.sqrt(B);D=i.sign(d)===i.sign(y)?h(d*_+y,p*F,i.EPSILON12):i.sign(y)===i.sign(p*F)?h(d*_,p*F+y,i.EPSILON12):h(d*_+p*F,y,i.EPSILON12);var G=h(v*F,g,i.EPSILON15),q=D*G;0>q?E.push(new e(o,c*F,c*U)):q>0?E.push(new e(o,c*F,c*-U)):0!==U?(E.push(new e(o,c*F,c*-U)),E.push(new e(o,c*F,c*U)),++z):E.push(new e(o,c*F,c*U))}return E}var p={};p.rayPlane=function(t,r,o){n(o)||(o=new e);var a=t.origin,s=t.direction,u=r.normal,c=e.dot(u,s);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-r.distance-e.dot(u,a))/c;return 0>l?void 0:(o=e.multiplyByScalar(s,l,o),e.add(a,o,o))};var y=new e,v=new e,g=new e,E=new e,S=new e;p.rayTriangle=function(t,r,o,i,a,s){var u=l(t,r,o,i,a);return!n(u)||0>u?void 0:(n(s)||(s=new e),e.multiplyByScalar(t.direction,u,s),e.add(t.origin,s,s))};var C=new c;p.lineSegmentTriangle=function(t,r,o,i,a,s,u){var c=C;e.clone(t,c.origin),e.subtract(r,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,o,i,a,s);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(u)||(u=new e),e.multiplyByScalar(c.direction,f,u),e.add(c.origin,u,u))};var w={root0:0,root1:0};p.raySphere=function(e,t,r){return r=m(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var b=new c;p.lineSegmentSphere=function(t,r,o,i){var a=b;e.clone(t,a.origin);var s=e.subtract(r,t,a.direction),u=e.magnitude(s);return e.normalize(s,s),i=m(a,o,i),!n(i)||i.stop<0||i.start>u?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,u),i)};var A=new e,x=new e;p.rayEllipsoid=function(t,r){var n,o,i,a,s,u=r.oneOverRadii,c=e.multiplyComponents(u,t.origin,A),l=e.multiplyComponents(u,t.direction,x),f=e.magnitudeSquared(c),m=e.dot(c,l);if(f>1){if(m>=0)return void 0;var h=m*m;if(n=f-1,o=e.magnitudeSquared(l),i=o*n,i>h)return void 0;if(h>i){a=m*m-i,s=-m+Math.sqrt(a);var d=s/o,p=n/s;return p>d?{start:d,stop:p}:{start:p,stop:d}}var y=Math.sqrt(n/o);return{start:y,stop:y}}return 1>f?(n=f-1,o=e.magnitudeSquared(l),i=o*n,a=m*m-i,s=-m+Math.sqrt(a),{start:0,stop:s/o}):0>m?(o=e.magnitudeSquared(l),{start:0,stop:-m/o}):void 0};var T=new e,M=new e,I=new e,O=new e,R=new e,N=new a,L=new a,P=new a,z=new a,D=new a,F=new a,_=new a,B=new e,U=new e,G=new t;p.grazingAltitudeLocation=function(t,r){var o=t.origin,s=t.direction,u=r.geodeticSurfaceNormal(o,T);if(e.dot(s,u)>=0)return o;var c=n(this.rayEllipsoid(t,r)),l=r.transformPositionToScaledSpace(s,T),f=e.normalize(l,l),m=e.mostOrthogonalAxis(l,O),h=e.normalize(e.cross(m,f,M),M),p=e.normalize(e.cross(f,h,I),I),y=N;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=a.transpose(y,L),g=a.fromScale(r.radii,P),E=a.fromScale(r.oneOverRadii,z),S=D;S[0]=0,S[1]=-s.z,S[2]=s.y,S[3]=s.z,S[4]=0,S[5]=-s.x,S[6]=-s.y,S[7]=s.x,S[8]=0;var C,w,b=a.multiply(a.multiply(v,E,F),S,F),A=a.multiply(a.multiply(b,g,_),y,_),x=a.multiplyByVector(b,o,R),q=d(A,e.negate(x,T),0,0,1),k=q.length;if(k>0){for(var V=e.clone(e.ZERO,U),W=Number.NEGATIVE_INFINITY,Y=0;k>Y;++Y){C=a.multiplyByVector(g,a.multiplyByVector(y,q[Y],B),B);var H=e.normalize(e.subtract(C,o,O),O),j=e.dot(H,s);j>W&&(W=j,V=e.clone(C,V))}var K=r.cartesianToCartographic(V,G);return W=i.clamp(W,0,1),w=e.magnitude(e.subtract(V,o,O))*Math.sqrt(1-W*W),w=c?-w:w,K.height=w,r.cartographicToCartesian(K,new e)}return void 0};var q=new e;return p.lineSegmentPlane=function(t,r,o,a){n(a)||(a=new e);var s=e.subtract(r,t,q),u=o.normal,c=e.dot(u,s);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(u,t),f=-(o.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(s,f,a),e.add(t,a,a),a)},p.trianglePlaneIntersection=function(t,r,n,o){var i=o.normal,a=o.distance,s=e.dot(i,t)+a<0,u=e.dot(i,r)+a<0,c=e.dot(i,n)+a<0,l=0;l+=s?1:0,l+=u?1:0,l+=c?1:0;var f,m;if((1===l||2===l)&&(f=new e,m=new e),1===l){if(s)return p.lineSegmentPlane(t,r,o,f),p.lineSegmentPlane(t,n,o,m),{positions:[t,r,n,f,m],indices:[0,3,4,1,2,4,1,4,3]};if(u)return p.lineSegmentPlane(r,n,o,f),p.lineSegmentPlane(r,t,o,m),{positions:[t,r,n,f,m],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(n,t,o,f),p.lineSegmentPlane(n,r,o,m),{positions:[t,r,n,f,m],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!s)return p.lineSegmentPlane(r,t,o,f),p.lineSegmentPlane(n,t,o,m),{positions:[t,r,n,f,m],indices:[1,2,4,1,4,3,0,3,4]};if(!u)return p.lineSegmentPlane(n,r,o,f),p.lineSegmentPlane(t,r,o,m),{positions:[t,r,n,f,m],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,n,o,f),p.lineSegmentPlane(r,n,o,m),{positions:[t,r,n,f,m],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};return r.calculateACMR=function(r){r=e(r,e.EMPTY_OBJECT);var n=r.indices,o=r.maximumIndex,i=e(r.cacheSize,24),a=n.length;if(!t(o)){o=0;for(var s=0,u=n[s];a>s;)u>o&&(o=u),++s,u=n[s]}for(var c=[],l=0;o+1>l;l++)c[l]=0;for(var f=i+1,m=0;a>m;++m)f-c[n[m]]>i&&(c[n[m]]=f,++f);return(f-i+1)/(a/3)},r.tipsify=function(r){function n(e,t,r,n){for(;t.length>=1;){var o=t[t.length-1];if(t.splice(t.length-1,1),e[o].numLiveTriangles>0)return o}for(;n>i;){if(e[i].numLiveTriangles>0)return++i,i-1;++i}return-1}function o(e,t,r,o,i,a,s){for(var u,c=-1,l=-1,f=0;f<r.length;){var m=r[f];o[m].numLiveTriangles&&(u=0,i-o[m].timeStamp+2*o[m].numLiveTriangles<=t&&(u=i-o[m].timeStamp),(u>l||-1===l)&&(l=u,c=m)),++f}return-1===c?n(o,a,e,s):c}r=e(r,e.EMPTY_OBJECT);var i,a=r.indices,s=r.maximumIndex,u=e(r.cacheSize,24),c=a.length,l=0,f=0,m=a[f],h=c;if(t(s))l=s+1;else{for(;h>f;)m>l&&(l=m),++f,m=a[f];if(-1===l)return 0;++l}for(var d=[],p=0;l>p;p++)d[p]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var y=0;h>f;)d[a[f]].vertexTriangles.push(y),++d[a[f]].numLiveTriangles,d[a[f+1]].vertexTriangles.push(y),++d[a[f+1]].numLiveTriangles,d[a[f+2]].vertexTriangles.push(y),++d[a[f+2]].numLiveTriangles,++y,f+=3;var v=0,g=u+1;i=1;var E,S,C=[],w=[],b=0,A=[],x=c/3,T=[];for(p=0;x>p;p++)T[p]=!1;for(var M,I;-1!==v;){C=[],S=d[v],I=S.vertexTriangles.length;for(var O=0;I>O;++O)if(y=S.vertexTriangles[O],!T[y]){T[y]=!0,f=y+y+y;for(var R=0;3>R;++R)M=a[f],C.push(M),w.push(M),A[b]=M,++b,E=d[M],--E.numLiveTriangles,g-E.timeStamp>u&&(E.timeStamp=g,++g),++f}v=o(a,u,C,d,g,w,l)}return A},r}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,r,n,o,i,a,s,u,c,l,f,m,h,d,p,y,v,g,E,S,C,w,b,A,x){"use strict";function T(e,t,r,n,o){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=o,e[t++]=o,e[t]=r}function M(e){for(var t=e.length,r=6*(t/3),n=v.createTypedArray(t,r),o=0,i=0;t>i;i+=3,o+=6)T(n,o,e[i],e[i+1],e[i+2]);return n}function I(e){var t=e.length;if(t>=3){var r=6*(t-2),n=v.createTypedArray(t,r);T(n,0,e[0],e[1],e[2]);for(var o=6,i=3;t>i;++i,o+=6)T(n,o,e[i-1],e[i],e[i-2]);return n}return new Uint16Array}function O(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=v.createTypedArray(t,r),o=e[0],i=0,a=1;t>a;++a,i+=6)T(n,i,o,e[a],e[a+1]);return n}return new Uint16Array}function R(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new d({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function N(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var o=t[n],i=0;i<o.componentsPerAttribute;++i)e[n].values.push(o.values[r*o.componentsPerAttribute+i])}function L(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)o.unpack(r,i,it),w.multiplyByPoint(e,it,it),o.pack(it,r,i)}function P(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)o.unpack(r,i,it),C.multiplyByVector(e,it,it),it=o.normalize(it,it),o.pack(it,r,i)}function z(e,t){var r,n=e.length,o={},i=e[0][t].attributes;for(r in i)if(i.hasOwnProperty(r)&&c(i[r])&&c(i[r].values)){for(var a=i[r],u=a.values.length,l=!0,f=1;n>f;++f){var m=e[f][t].attributes[r];if(!c(m)||a.componentDatatype!==m.componentDatatype||a.componentsPerAttribute!==m.componentsPerAttribute||a.normalize!==m.normalize){l=!1;break}u+=m.values.length}l&&(o[r]=new d({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:s.createTypedArray(a.componentDatatype,u)}))}return o}function D(e,t){var n,i,a,s,u=e.length;e[0].modelMatrix;var l,f,m,d=c(e[0][t].indices),p=e[0][t].primitiveType,y=z(e,t);for(n in y)if(y.hasOwnProperty(n))for(l=y[n].values,s=0,i=0;u>i;++i)for(f=e[i][t].attributes[n].values,m=f.length,a=0;m>a;++a)l[s++]=f[a];var g;if(d){var E=0;for(i=0;u>i;++i)E+=e[i][t].indices.length;var S=h.computeNumberOfVertices(new h({attributes:y,primitiveType:A.POINTS})),C=v.createTypedArray(S,E),w=0,b=0;for(i=0;u>i;++i){var x=e[i][t].indices,T=x.length;for(s=0;T>s;++s)C[w++]=b+x[s];b+=h.computeNumberOfVertices(e[i][t])}g=C}var M,I=new o,O=0;for(i=0;u>i;++i){if(M=e[i][t].boundingSphere,!c(M)){I=void 0;break}o.add(M.center,I,I)}if(c(I))for(o.divideByScalar(I,u,I),i=0;u>i;++i){M=e[i][t].boundingSphere;var R=o.magnitude(o.subtract(M.center,I,ut))+M.radius;R>O&&(O=R)}return new h({attributes:y,indices:g,primitiveType:p,boundingSphere:c(I)?new r(I,O):void 0})}function F(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function _(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,o=3;t>o;++o)r[n++]=o-1,r[n++]=0,r[n++]=o;return e.indices=r,e.primitiveType=A.TRIANGLES,e}function B(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,o=3;t-1>o;o+=2)r[n++]=o,r[n++]=o-1,r[n++]=o+1,t>o+2&&(r[n++]=o,r[n++]=o+1,r[n++]=o+2);return e.indices=r,e.primitiveType=A.TRIANGLES,e}function U(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function G(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,o=2;t>o;++o)r[n++]=o-1,r[n++]=o;return e.indices=r,e.primitiveType=A.LINES,e}function q(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,o=2;t>o;++o)r[n++]=o-1,r[n++]=o;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=A.LINES,e}function k(e){switch(e.primitiveType){case A.TRIANGLE_FAN:return _(e);case A.TRIANGLE_STRIP:return B(e);case A.TRIANGLES:return F(e);case A.LINE_STRIP:return G(e);case A.LINE_LOOP:return q(e);case A.LINES:return U(e)}return e}function V(e,t){Math.abs(e.y)<S.EPSILON6&&(e.y=t?-S.EPSILON6:S.EPSILON6)}function W(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return V(e,e.y<0),V(t,t.y<0),V(r,r.y<0),void 0;var n,o=Math.abs(e.y),i=Math.abs(t.y),a=Math.abs(r.y);n=o>i?o>a?S.sign(e.y):S.sign(r.y):i>a?S.sign(t.y):S.sign(r.y);var s=0>n;V(e,s),V(t,s),V(r,s)}function Y(e,t,r,n){o.add(e,o.multiplyByScalar(o.subtract(t,e,St),e.y/(e.y-t.y),St),r),o.clone(r,n),V(r,!0),V(n,!1)}function H(e,t,r){if(e.x>=0||t.x>=0||r.x>=0)return void 0;W(e,t,r);var n=e.y<0,o=t.y<0,i=r.y<0,a=0;a+=n?1:0,a+=o?1:0,a+=i?1:0;var s=xt.indices;1===a?(s[1]=3,s[2]=4,s[5]=6,s[7]=6,s[8]=5,n?(Y(e,t,Ct,bt),Y(e,r,wt,At),s[0]=0,s[3]=1,s[4]=2,s[6]=1):o?(Y(t,r,Ct,bt),Y(t,e,wt,At),s[0]=1,s[3]=2,s[4]=0,s[6]=2):i&&(Y(r,e,Ct,bt),Y(r,t,wt,At),s[0]=2,s[3]=0,s[4]=1,s[6]=0)):2===a&&(s[2]=4,s[4]=4,s[5]=3,s[7]=5,s[8]=6,n?o?i||(Y(r,e,Ct,bt),Y(r,t,wt,At),s[0]=0,s[1]=1,s[3]=0,s[6]=2):(Y(t,r,Ct,bt),Y(t,e,wt,At),s[0]=2,s[1]=0,s[3]=2,s[6]=1):(Y(e,t,Ct,bt),Y(e,r,wt,At),s[0]=1,s[1]=2,s[3]=1,s[6]=0));var u=xt.positions;return u[0]=e,u[1]=t,u[2]=r,u.length=3,(1===a||2===a)&&(u[3]=Ct,u[4]=wt,u[5]=bt,u[6]=At,u.length=7),xt}function j(e,t){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var o in n)if(n.hasOwnProperty(o)&&c(n[o])&&c(n[o].values)){var i=n[o];i.values=s.createTypedArray(i.componentDatatype,i.values)}var a=h.computeNumberOfVertices(e);return e.indices=v.createTypedArray(a,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}function K(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var o=t[n];r[n]=new d({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:[]})}return new h({attributes:r,indices:[],primitiveType:e.primitiveType})}function Z(e,t,r){var n=c(e.geometry.boundingSphere);t=j(t,n),r=j(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function X(e,r,i,a,s,u,l,f,m,h,d){if(c(u)||c(l)||c(f)||c(m)){var p=o.fromArray(s,3*e,Tt),y=o.fromArray(s,3*r,Mt),v=o.fromArray(s,3*i,It),g=t(a,p,y,v,Ot);if(c(u)){var E=o.fromArray(u,3*e,Tt),S=o.fromArray(u,3*r,Mt),C=o.fromArray(u,3*i,It);o.multiplyByScalar(E,g.x,E),o.multiplyByScalar(S,g.y,S),o.multiplyByScalar(C,g.z,C);var w=o.add(E,S,E);o.add(w,C,w),o.normalize(w,w),o.pack(w,h.normal.values,3*d)}if(c(l)){var b=o.fromArray(l,3*e,Tt),A=o.fromArray(l,3*r,Mt),x=o.fromArray(l,3*i,It);o.multiplyByScalar(b,g.x,b),o.multiplyByScalar(A,g.y,A),o.multiplyByScalar(x,g.z,x);var T=o.add(b,A,b);o.add(T,x,T),o.normalize(T,T),o.pack(T,h.binormal.values,3*d)}if(c(f)){var M=o.fromArray(f,3*e,Tt),I=o.fromArray(f,3*r,Mt),O=o.fromArray(f,3*i,It);o.multiplyByScalar(M,g.x,M),o.multiplyByScalar(I,g.y,I),o.multiplyByScalar(O,g.z,O);var R=o.add(M,I,M);o.add(R,O,R),o.normalize(R,R),o.pack(R,h.tangent.values,3*d)}if(c(m)){var N=n.fromArray(m,2*e,Rt),L=n.fromArray(m,2*r,Nt),P=n.fromArray(m,2*i,Lt);n.multiplyByScalar(N,g.x,N),n.multiplyByScalar(L,g.y,L),n.multiplyByScalar(P,g.z,P);var z=n.add(N,L,N);n.add(z,P,z),n.pack(z,h.st.values,2*d)}}}function Q(e,t,r,n,o,i){var a=e.position.values.length/3;if(-1!==o){var s=n[o],u=r[s];return-1===u?(r[s]=a,e.position.values.push(i.x,i.y,i.z),t.push(a),a):(t.push(u),u)}return e.position.values.push(i.x,i.y,i.z),t.push(a),a}function J(e){var t,r,n,i,a,s=e.geometry,u=s.attributes,l=u.position.values,f=c(u.normal)?u.normal.values:void 0,m=c(u.binormal)?u.binormal.values:void 0,h=c(u.tangent)?u.tangent.values:void 0,d=c(u.st)?u.st.values:void 0,p=s.indices,y=K(s),v=K(s),g=[]; -g.length=l.length/3;var E=[];for(E.length=l.length/3,a=0;a<g.length;++a)g[a]=-1,E[a]=-1;var S=p.length;for(a=0;S>a;a+=3){var C=p[a],w=p[a+1],b=p[a+2],A=o.fromArray(l,3*C),x=o.fromArray(l,3*w),T=o.fromArray(l,3*b),M=H(A,x,T);if(c(M)&&M.positions.length>3)for(var I=M.positions,O=M.indices,R=O.length,N=0;R>N;++N){var L=O[N],P=I[L];P.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=E),i=Q(t,r,n,p,3>L?a+L:-1,P),X(C,w,b,P,l,f,m,h,d,t,i)}else c(M)&&(A=M.positions[0],x=M.positions[1],T=M.positions[2]),A.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=E),i=Q(t,r,n,p,a,A),X(C,w,b,A,l,f,m,h,d,t,i),i=Q(t,r,n,p,a+1,x),X(C,w,b,x,l,f,m,h,d,t,i),i=Q(t,r,n,p,a+2,T),X(C,w,b,T,l,f,m,h,d,t,i)}Z(e,v,y)}function $(e){var t,r=e.geometry,n=r.attributes,i=n.position.values,a=r.indices,s=K(r),u=K(r),l=a.length,f=[];f.length=i.length/3;var m=[];for(m.length=i.length/3,t=0;t<f.length;++t)f[t]=-1,m[t]=-1;for(t=0;l>t;t+=2){var h=a[t],d=a[t+1],p=o.fromArray(i,3*h,Tt),y=o.fromArray(i,3*d,Mt);Math.abs(p.y)<S.EPSILON6&&(p.y=p.y<0?-S.EPSILON6:S.EPSILON6),Math.abs(y.y)<S.EPSILON6&&(y.y=y.y<0?-S.EPSILON6:S.EPSILON6);var v=s.attributes,g=s.indices,C=m,w=u.attributes,b=u.indices,A=f,x=E.lineSegmentPlane(p,y,Pt,It);if(c(x)){var T=o.multiplyByScalar(o.UNIT_Y,5*S.EPSILON9,zt);p.y<0&&(o.negate(T,T),v=u.attributes,g=u.indices,C=f,w=s.attributes,b=s.indices,A=m);var M=o.add(x,T,Dt);Q(v,g,C,a,t,p),Q(v,g,C,a,-1,M),o.negate(T,T),o.add(x,T,M),Q(w,b,A,a,-1,M),Q(w,b,A,a,t+1,y)}else{var I,O,R;p.y<0?(I=u.attributes,O=u.indices,R=f):(I=s.attributes,O=s.indices,R=m),Q(I,O,R,a,t,p),Q(I,O,R,a,t+1,y)}}Z(e,u,s)}function et(e){var t=e.geometry,r=t.attributes,a=r.position.values,s=r.prevPosition.values,u=r.nextPosition.values,l=r.expandAndWidth.values;t.indices;var f,m,h,d=c(r.st)?r.st.values:void 0,p=c(r.color)?r.color.values:void 0,y=K(t),v=K(t),g=a.length/3;for(f=0;g>f;f+=4){var C=f,w=f+1,b=f+2,A=f+3,x=o.fromArray(a,3*C,Bt),T=o.fromArray(a,3*w,Ut),M=o.fromArray(a,3*b,Gt),I=o.fromArray(a,3*A,qt);Math.abs(x.y)<S.EPSILON6&&(x.y=S.EPSILON6*(M.y<0?-1:1),T.y=x.y),Math.abs(M.y)<S.EPSILON6&&(M.y=S.EPSILON6*(x.y<0?-1:1),I.y=M.y);var O=y.attributes,R=y.indices,N=v.attributes,L=v.indices,P=E.lineSegmentPlane(x,M,Pt,kt);if(c(P)){var z=o.multiplyByScalar(o.UNIT_Y,5*S.EPSILON9,Vt);x.y<0&&(o.negate(z,z),O=v.attributes,R=v.indices,N=y.attributes,L=y.indices);var D=o.add(P,z,Wt);for(O.position.values.push(x.x,x.y,x.z,T.x,T.y,T.z),O.position.values.push(D.x,D.y,D.z),O.position.values.push(D.x,D.y,D.z),o.negate(z,z),o.add(P,z,D),N.position.values.push(D.x,D.y,D.z),N.position.values.push(D.x,D.y,D.z),N.position.values.push(M.x,M.y,M.z,I.x,I.y,I.z),m=3*C;3*C+6>m;++m)O.prevPosition.values.push(s[m]);for(O.prevPosition.values.push(x.x,x.y,x.z,x.x,x.y,x.z),N.prevPosition.values.push(x.x,x.y,x.z,x.x,x.y,x.z),m=3*b;3*b+6>m;++m)N.prevPosition.values.push(s[m]);for(m=3*C;3*C+6>m;++m)O.nextPosition.values.push(u[m]);for(O.nextPosition.values.push(M.x,M.y,M.z,M.x,M.y,M.z),N.nextPosition.values.push(M.x,M.y,M.z,M.x,M.y,M.z),m=3*b;3*b+6>m;++m)N.nextPosition.values.push(u[m]);var F=n.fromArray(l,2*C,Ft),_=Math.abs(F.y);O.expandAndWidth.values.push(-1,_,1,_),O.expandAndWidth.values.push(-1,-_,1,-_),N.expandAndWidth.values.push(-1,_,1,_),N.expandAndWidth.values.push(-1,-_,1,-_);var B=o.magnitudeSquared(o.subtract(P,x,qt));if(B/=o.magnitudeSquared(o.subtract(M,x,qt)),c(p)){var U=i.fromArray(p,4*C,Yt),G=i.fromArray(p,4*b,Yt),q=S.lerp(U.x,G.x,B),k=S.lerp(U.y,G.y,B),V=S.lerp(U.z,G.z,B),W=S.lerp(U.w,G.w,B);for(m=4*C;4*C+8>m;++m)O.color.values.push(p[m]);for(O.color.values.push(q,k,V,W),O.color.values.push(q,k,V,W),N.color.values.push(q,k,V,W),N.color.values.push(q,k,V,W),m=4*b;4*b+8>m;++m)N.color.values.push(p[m])}if(c(d)){var Y=n.fromArray(d,2*C,Ft),H=n.fromArray(d,2*(f+3),_t),j=S.lerp(Y.x,H.x,B);for(m=2*C;2*C+4>m;++m)O.st.values.push(d[m]);for(O.st.values.push(j,Y.y),O.st.values.push(j,H.y),N.st.values.push(j,Y.y),N.st.values.push(j,H.y),m=2*b;2*b+4>m;++m)N.st.values.push(d[m])}h=O.position.values.length/3-4,R.push(h,h+2,h+1),R.push(h+1,h+2,h+3),h=N.position.values.length/3-4,L.push(h,h+2,h+1),L.push(h+1,h+2,h+3)}else{var X,Q;for(x.y<0?(X=v.attributes,Q=v.indices):(X=y.attributes,Q=y.indices),X.position.values.push(x.x,x.y,x.z),X.position.values.push(T.x,T.y,T.z),X.position.values.push(M.x,M.y,M.z),X.position.values.push(I.x,I.y,I.z),m=3*f;3*f+12>m;++m)X.prevPosition.values.push(s[m]),X.nextPosition.values.push(u[m]);for(m=2*f;2*f+8>m;++m)X.expandAndWidth.values.push(l[m]),c(d)&&X.st.values.push(d[m]);if(c(p))for(m=4*f;4*f+16>m;++m)X.color.values.push(p[m]);h=X.position.values.length/3-4,Q.push(h,h+2,h+1),Q.push(h+1,h+2,h+3)}}Z(e,v,y)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case A.TRIANGLES:e.indices=M(t);break;case A.TRIANGLE_STRIP:e.indices=I(t);break;case A.TRIANGLE_FAN:e.indices=O(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=A.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,n){t=u(t,"normal"),n=u(n,1e4);for(var o=e.attributes.position.values,i=e.attributes[t].values,a=o.length,l=new Float64Array(2*a),f=0,m=0;a>m;m+=3)l[f++]=o[m],l[f++]=o[m+1],l[f++]=o[m+2],l[f++]=o[m]+i[m]*n,l[f++]=o[m+1]+i[m+1]*n,l[f++]=o[m+2]+i[m+2]*n;var p,y=e.boundingSphere;return c(y)&&(p=new r(y.center,y.radius+n)),new h({attributes:{position:new d({componentDatatype:s.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:A.LINES,boundingSphere:p})},tt.createAttributeLocations=function(e){var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,o={},i=0,a=r.length;for(t=0;a>t;++t){var s=r[t];c(n[s])&&(o[s]=i++)}for(var u in n)n.hasOwnProperty(u)&&!c(o[u])&&(o[u]=i++);return o},tt.reorderForPreVertexCache=function(e){var t=h.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),o=0;t>o;o++)n[o]=-1;for(var i,a=r,u=a.length,l=v.createTypedArray(t,u),f=0,m=0,d=0;u>f;)i=n[a[f]],-1!==i?l[m]=i:(i=a[f],n[i]=d,l[m]=d,++d),++f,++m;e.indices=l;var p=e.attributes;for(var y in p)if(p.hasOwnProperty(y)&&c(p[y])&&c(p[y].values)){for(var g=p[y],E=g.values,S=0,C=g.componentsPerAttribute,w=s.createTypedArray(g.componentDatatype,d*C);t>S;){var b=n[S];if(-1!==b)for(o=0;C>o;o++)w[C*b+o]=E[C*S+o];++S}g.values=w}}return e},tt.reorderForPostVertexCache=function(e,t){var r=e.indices;if(e.primitiveType===A.TRIANGLES&&c(r)){for(var n=r.length,o=0,i=0;n>i;i++)r[i]>o&&(o=r[i]);e.indices=x.tipsify({indices:r,maximumIndex:o,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],r=h.computeNumberOfVertices(e);if(c(e.indices)&&r>S.SIXTY_FOUR_KILOBYTES){var n,o=[],i=[],a=0,s=R(e.attributes),u=e.indices,l=u.length;e.primitiveType===A.TRIANGLES?n=3:e.primitiveType===A.LINES?n=2:e.primitiveType===A.POINTS&&(n=1);for(var f=0;l>f;f+=n){for(var m=0;n>m;++m){var d=u[f+m],p=o[d];c(p)||(p=a++,o[d]=p,N(s,e.attributes,d)),i.push(p)}a+n>S.SIXTY_FOUR_KILOBYTES&&(t.push(new h({attributes:s,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),o=[],i=[],a=0,s=R(e.attributes))}0!==i.length&&t.push(new h({attributes:s,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var rt=new o,nt=new a;tt.projectTo2D=function(e,t,r,n,i){var a=e.attributes[t];i=c(i)?i:new m;for(var u=i.ellipsoid,f=a.values,h=new Float64Array(f.length),p=0,y=0;y<f.length;y+=3){var v=o.fromArray(f,y,rt),g=u.cartesianToCartographic(v,nt);if(!c(g))throw new l("Could not project point ("+v.x+", "+v.y+", "+v.z+") to 2D.");var E=i.project(g,rt);h[p++]=E.x,h[p++]=E.y,h[p++]=E.z}return e.attributes[r]=a,e.attributes[n]=new d({componentDatatype:s.DOUBLE,componentsPerAttribute:3,values:h}),delete e.attributes[t],e};var ot={high:0,low:0};tt.encodeAttribute=function(e,t,r,n){for(var o=e.attributes[t],i=o.values,a=i.length,u=new Float32Array(a),c=new Float32Array(a),l=0;a>l;++l)f.encode(i[l],ot),u[l]=ot.high,c[l]=ot.low;var m=o.componentsPerAttribute;return e.attributes[r]=new d({componentDatatype:s.FLOAT,componentsPerAttribute:m,values:u}),e.attributes[n]=new d({componentDatatype:s.FLOAT,componentsPerAttribute:m,values:c}),delete e.attributes[t],e};var it=new o,at=new w,st=new C;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(w.equals(t,w.IDENTITY))return e;var n=e.geometry.attributes;L(t,n.position),L(t,n.prevPosition),L(t,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(w.inverse(t,at),w.transpose(at,at),w.getRotation(at,st),P(st,n.normal),P(st,n.binormal),P(st,n.tangent));var o=e.geometry.boundingSphere;return c(o)&&(e.geometry.boundingSphere=r.transform(o,t,o)),e.modelMatrix=w.clone(w.IDENTITY),e};var ut=new o;tt.combineInstances=function(e){for(var t=[],r=[],n=e.length,o=0;n>o;++o){var i=e[o];c(i.geometry)?t.push(i):r.push(i)}var a=[];return t.length>0&&a.push(D(t,"geometry")),r.length>0&&(a.push(D(r,"westHemisphereGeometry")),a.push(D(r,"eastHemisphereGeometry"))),a};var ct=new o,lt=new o,ft=new o,mt=new o;tt.computeNormal=function(e){for(var t=e.indices,r=e.attributes,n=r.position.values,i=r.position.values.length/3,a=t.length,u=new Array(i),c=new Array(a/3),l=new Array(a),f=0;i>f;f++)u[f]={indexOffset:0,count:0,currentCount:0};var m=0;for(f=0;a>f;f+=3){var h=t[f],p=t[f+1],y=t[f+2],v=3*h,g=3*p,E=3*y;lt.x=n[v],lt.y=n[v+1],lt.z=n[v+2],ft.x=n[g],ft.y=n[g+1],ft.z=n[g+2],mt.x=n[E],mt.y=n[E+1],mt.z=n[E+2],u[h].count++,u[p].count++,u[y].count++,o.subtract(ft,lt,ft),o.subtract(mt,lt,mt),c[m]=o.cross(ft,mt,new o),m++}var S=0;for(f=0;i>f;f++)u[f].indexOffset+=S,S+=u[f].count;m=0;var C;for(f=0;a>f;f+=3){C=u[t[f]];var w=C.indexOffset+C.currentCount;l[w]=m,C.currentCount++,C=u[t[f+1]],w=C.indexOffset+C.currentCount,l[w]=m,C.currentCount++,C=u[t[f+2]],w=C.indexOffset+C.currentCount,l[w]=m,C.currentCount++,m++}var b=new Float32Array(3*i);for(f=0;i>f;f++){var A=3*f;if(C=u[f],C.count>0){for(o.clone(o.ZERO,ct),m=0;m<C.count;m++)o.add(ct,c[l[C.indexOffset+m]],ct);o.normalize(ct,ct),b[A]=ct.x,b[A+1]=ct.y,b[A+2]=ct.z}else b[A]=0,b[A+1]=0,b[A+2]=1}return e.attributes.normal=new d({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:b}),e};var ht=new o,dt=new o,pt=new o;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,r=e.attributes.position.values,n=e.attributes.normal.values,i=e.attributes.st.values,a=e.attributes.position.values.length/3,u=t.length,c=new Array(3*a),l=0;l<c.length;l++)c[l]=0;var f,m,h;for(l=0;u>l;l+=3){var p=t[l],y=t[l+1],v=t[l+2];f=3*p,m=3*y,h=3*v;var g=2*p,E=2*y,S=2*v,C=r[f],w=r[f+1],b=r[f+2],A=i[g],x=i[g+1],T=i[E+1]-x,M=i[S+1]-x,I=1/((i[E]-A)*M-(i[S]-A)*T),O=(M*(r[m]-C)-T*(r[h]-C))*I,R=(M*(r[m+1]-w)-T*(r[h+1]-w))*I,N=(M*(r[m+2]-b)-T*(r[h+2]-b))*I;c[f]+=O,c[f+1]+=R,c[f+2]+=N,c[m]+=O,c[m+1]+=R,c[m+2]+=N,c[h]+=O,c[h+1]+=R,c[h+2]+=N}var L=new Float32Array(3*a),P=new Float32Array(3*a);for(l=0;a>l;l++){f=3*l,m=f+1,h=f+2;var z=o.fromArray(n,f,ht),D=o.fromArray(c,f,pt),F=o.dot(z,D);o.multiplyByScalar(z,F,dt),o.normalize(o.subtract(D,dt,D),D),P[f]=D.x,P[m]=D.y,P[h]=D.z,o.normalize(o.cross(z,D,D),D),L[f]=D.x,L[m]=D.y,L[h]=D.z}return e.attributes.tangent=new d({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:P}),e.attributes.binormal=new d({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:L}),e};var yt=new n,vt=new o,gt=new o,Et=new o;tt.compressVertices=function(t){var r=t.attributes.normal,i=t.attributes.st;if(!c(r)&&!c(i))return t;var a,u,l,f,m=t.attributes.tangent,h=t.attributes.binormal;c(r)&&(a=r.values),c(i)&&(u=i.values),c(m)&&(l=m.values),h&&(f=h.values);var p=c(a)?a.length:u.length,y=c(a)?3:2,v=p/y,g=v,E=c(u)&&c(a)?2:1;E+=c(l)||c(f)?1:0,g*=E;for(var S=new Float32Array(g),C=0,w=0;v>w;++w){c(u)&&(n.fromArray(u,2*w,yt),S[C++]=e.compressTextureCoordinates(yt));var b=3*w;c(a)&&c(l)&&c(f)?(o.fromArray(a,b,vt),o.fromArray(l,b,gt),o.fromArray(f,b,Et),e.octPack(vt,gt,Et,yt),S[C++]=yt.x,S[C++]=yt.y):(c(a)&&(o.fromArray(a,b,vt),S[C++]=e.octEncodeFloat(vt)),c(l)&&(o.fromArray(l,b,vt),S[C++]=e.octEncodeFloat(vt)),c(f)&&(o.fromArray(f,b,vt),S[C++]=e.octEncodeFloat(vt)))}return t.attributes.compressedAttributes=new d({componentDatatype:s.FLOAT,componentsPerAttribute:E,values:S}),c(a)&&delete t.attributes.normal,c(u)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var St=new o,Ct=new o,wt=new o,bt=new o,At=new o,xt={positions:new Array(7),indices:new Array(9)},Tt=new o,Mt=new o,It=new o,Ot=new o,Rt=new n,Nt=new n,Lt=new n,Pt=b.fromPointNormal(o.ZERO,o.UNIT_Y),zt=new o,Dt=new o,Ft=new n,_t=new n,Bt=new o,Ut=new o,Gt=new o,qt=new o,kt=new o,Vt=new o,Wt=new o,Yt=new i;return new i,tt.splitLongitude=function(e){var t=e.geometry,n=t.boundingSphere;if(c(n)){var o=n.center.x-n.radius;if(o>0||r.intersectPlane(n,b.ORIGIN_ZX_PLANE)!==g.INTERSECTING)return e}if(t.geometryType!==y.NONE)switch(t.geometryType){case y.POLYLINES:et(e);break;case y.TRIANGLES:J(e);break;case y.LINES:$(e)}else k(t),t.primitiveType===A.TRIANGLES?J(e):t.primitiveType===A.LINES&&$(e);return e},tt}),define("Core/WebMercatorProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,r,n,o,i,a,s){"use strict";var u=function(e){this._ellipsoid=r(e,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return o(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.mercatorAngleToGeodeticLatitude=function(e){return s.PI_OVER_TWO-2*Math.atan(Math.exp(-e))},u.geodeticLatitudeToMercatorAngle=function(e){e>u.MaximumLatitude?e=u.MaximumLatitude:e<-u.MaximumLatitude&&(e=-u.MaximumLatitude);var t=Math.sin(e);return.5*Math.log((1+t)/(1-t))},u.MaximumLatitude=u.mercatorAngleToGeodeticLatitude(Math.PI),u.prototype.project=function(t,r){var o=this._semimajorAxis,i=t.longitude*o,a=u.geodeticLatitudeToMercatorAngle(t.latitude)*o,s=t.height;return n(r)?(r.x=i,r.y=a,r.z=s,r):new e(i,a,s)},u.prototype.unproject=function(e,r){var o=this._oneOverSemimajorAxis,i=e.x*o,a=u.mercatorAngleToGeodeticLatitude(e.y*o),s=e.z;return n(r)?(r.longitude=i,r.latitude=a,r.height=s,r):new t(i,a,s)},u}),define("Scene/PrimitivePipeline",["../Core/BoundingSphere","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Ellipsoid","../Core/FeatureDetection","../Core/GeographicProjection","../Core/Geometry","../Core/GeometryAttribute","../Core/GeometryAttributes","../Core/GeometryPipeline","../Core/IndexDatatype","../Core/Matrix4","../Core/WebMercatorProjection"],function(e,t,r,n,o,i,a,s,u,c,l,f,m,h,d,p){"use strict";function y(e,t,r){var n,o=!r,i=e.length;if(!o&&i>1){var a=e[0].modelMatrix;for(n=1;i>n;++n)if(!d.equals(a,e[n].modelMatrix)){o=!0;break}}if(o)for(n=0;i>n;++n)m.transformToWorldCoordinates(e[n]);else d.multiplyTransformation(t,e[0].modelMatrix,t)}function v(e,n){var o=e.attributes,i=o.position,a=4*(i.values.length/i.componentsPerAttribute);o.pickColor=new l({componentDatatype:r.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,values:new Uint8Array(a)});for(var s=t.floatToByte(n.red),u=t.floatToByte(n.green),c=t.floatToByte(n.blue),f=t.floatToByte(n.alpha),m=o.pickColor.values,h=0;a>h;h+=4)m[h]=s,m[h+1]=u,m[h+2]=c,m[h+3]=f}function g(e,t){for(var r=e.length,n=0;r>n;++n){var i=e[n],a=t[n];o(i.geometry)?v(i.geometry,a):(v(i.westHemisphereGeometry,a),v(i.eastHemisphereGeometry,a))}}function E(e){var t,r=e.length,n=[],i=e[0].attributes;for(t in i)if(i.hasOwnProperty(t)){for(var a=i[t],s=!0,u=1;r>u;++u){var c=e[u].attributes[t];if(!o(c)||a.componentDatatype!==c.componentDatatype||a.componentsPerAttribute!==c.componentsPerAttribute||a.normalize!==c.normalize){s=!1;break}}s&&n.push(t)}return n}function S(e,t,n){for(var o=c.computeNumberOfVertices(t),i=n.length,a=0;i>a;++a){for(var s=n[a],u=e[s],f=u.componentDatatype,m=u.value,h=m.length,d=r.createTypedArray(f,o*h),p=0;o>p;++p)d.set(m,p*h);t.attributes[s]=new l({componentDatatype:f,componentsPerAttribute:h,normalize:u.normalize,values:d})}}function C(e,t){for(var r=e.length,n=0;r>n;++n){var i=e[n],a=i.attributes;o(i.geometry)?S(a,i.geometry,t):(S(a,i.westHemisphereGeometry,t),S(a,i.eastHemisphereGeometry,t))}}function w(t){var n,i,a=t.instances,s=t.pickIds,u=t.projection,c=t.elementIndexUintSupported,l=t.scene3DOnly,f=t.allowPicking,h=t.vertexCacheOptimize,d=t.compressVertices,p=t.modelMatrix,v=a.length;if(a[0].geometry.primitiveType,y(a,p,l),!l)for(n=0;v>n;++n)m.splitLongitude(a[n]);f&&g(a,s);var S=E(a);if(C(a,S),h)for(n=0;v>n;++n){var w=a[n];o(w.geometry)?(m.reorderForPostVertexCache(w.geometry),m.reorderForPreVertexCache(w.geometry)):(m.reorderForPostVertexCache(w.westHemisphereGeometry),m.reorderForPreVertexCache(w.westHemisphereGeometry),m.reorderForPostVertexCache(w.eastHemisphereGeometry),m.reorderForPreVertexCache(w.eastHemisphereGeometry))}var b=m.combineInstances(a);for(v=b.length,n=0;v>n;++n){i=b[n];var A,x=i.attributes;if(l)for(A in x)x.hasOwnProperty(A)&&x[A].componentDatatype===r.DOUBLE&&m.encodeAttribute(i,A,A+"3DHigh",A+"3DLow");else for(A in x)if(x.hasOwnProperty(A)&&x[A].componentDatatype===r.DOUBLE){var T=A+"3D",M=A+"2D";m.projectTo2D(i,A,T,M,u),o(i.boundingSphere)&&"position"===A&&(i.boundingSphereCV=e.fromVertices(i.attributes.position2D.values)),m.encodeAttribute(i,T,T+"High",T+"Low"),m.encodeAttribute(i,M,M+"High",M+"Low")}d&&m.compressVertices(i)}if(!c){var I=[];for(v=b.length,n=0;v>n;++n)i=b[n],I=I.concat(m.fitToUnsignedShortIndices(i));b=I}return b}function b(e,t,n){for(var o=[],i=e.attributes,a=n.length,s=0;a>s;++s){var u=n[s],c=i[u],l=c.componentDatatype;l===r.DOUBLE&&(l=r.FLOAT);var f=r.createTypedArray(l,c.values);o.push({index:t[u],componentDatatype:l,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,values:f}),delete i[u]}return o}function A(e,t,r,i,a,s,u,l,f){var m=c.computeNumberOfVertices(t);o(u[e])||(u[e]={boundingSphere:t.boundingSphere,boundingSphereCV:t.boundingSphereCV});for(var h=i.length,d=0;h>d;++d)for(var p=i[d],y=a[p],v=m;v>0;){for(var g,E=n(f[p],0),S=s[E],C=S.length,w=0;C>w&&(g=S[w],g.index!==y);++w);o(u[e][p])||(u[e][p]={dirty:!1,valid:!0,value:r[p].value,indices:[]});var b,A=g.values.length/g.componentsPerAttribute,x=n(l[p],0);A>x+v?(b=v,u[e][p].indices.push({attribute:g,offset:x,count:b}),l[p]=x+v):(b=A-x,u[e][p].indices.push({attribute:g,offset:x,count:b}),l[p]=0,f[p]=E+1),v-=b}}function x(e,t,r,n,i){var a,s,u,c=[],l=e.length,f={},m={};for(a=0;l>a;++a)s=e[a],u=s.attributes,o(s.geometry)&&A(a,s.geometry,u,i,n,r,c,f,m);for(a=0;l>a;++a)s=e[a],u=s.attributes,o(s.westHemisphereGeometry)&&A(a,s.westHemisphereGeometry,u,i,n,r,c,f,m);for(a=0;l>a;++a)s=e[a],u=s.attributes,o(s.eastHemisphereGeometry)&&A(a,s.eastHemisphereGeometry,u,i,n,r,c,f,m);for(l=t.length,a=0;l>a;++a){s=t[a],u=s.attributes;var h={};c.push(h);for(var d=i.length,p=0;d>p;++p){var y=i[p];h[y]={dirty:!1,valid:!1,value:u[y].value,indices:[]}}}return c}function T(e,t){var r=e.attributes;for(var n in r)if(r.hasOwnProperty(n)){var i=r[n];o(i)&&o(i.values)&&t.push(i.values.buffer)}o(e.indices)&&t.push(e.indices.buffer)}function M(e,t){for(var r=e.length,n=0;r>n;++n)T(e[n],t)}function I(e,t){for(var r=e.length,n=0;r>n;++n)for(var o=e[n],i=o.length,a=0;i>a;++a)t.push(o[a].values.buffer)}function O(t){for(var r=1,n=t.length,i=0;n>i;i++){var a=t[i];if(++r,o(a)){var s=a.attributes;r+=6+2*e.packedLength+(o(a.indices)?a.indices.length:0);for(var u in s)if(s.hasOwnProperty(u)&&o(s[u])){var c=s[u];r+=5+c.values.length}}}return r}function R(e,t){for(var r=e.length,n=new Uint32Array(e.length),o=0;r>o;++o)n[o]=e[o].toRgba();return t.push(n.buffer),n}function N(e){for(var r=e.length,n=new Array(r),o=0;r>o;o++)n[o]=t.fromRgba(e[o]);return n}function L(e){for(var t=e.length,r=1+17*t,n=0;t>n;n++){var i=e[n].attributes;for(var a in i)if(i.hasOwnProperty(a)&&o(i[a])){var s=i[a];r+=5+s.value.length}}return r}function P(e,t){var r=new Float64Array(L(e)),n={},i=[],a=e.length,s=0;r[s++]=a;for(var u=0;a>u;u++){var c=e[u];d.pack(c.modelMatrix,r,s),s+=d.packedLength;var l=c.attributes,f=[];for(var m in l)l.hasOwnProperty(m)&&o(l[m])&&(f.push(m),o(n[m])||(n[m]=i.length,i.push(m)));r[s++]=f.length;for(var h=0;h<f.length;h++){var p=f[h],y=l[p];r[s++]=n[p],r[s++]=y.componentDatatype,r[s++]=y.componentsPerAttribute,r[s++]=y.normalize,r[s++]=y.value.length,r.set(y.value,s),s+=y.value.length}}return t.push(r.buffer),{stringTable:i,packedData:r}}function z(e){for(var t=e.packedData,n=e.stringTable,o=new Array(t[0]),i=0,a=1;a<t.length;){var s=d.unpack(t,a);a+=d.packedLength;for(var u={},c=t[a++],l=0;c>l;l++){for(var f=n[t[a++]],m=t[a++],h=t[a++],p=0!==t[a++],y=t[a++],v=r.createTypedArray(m,y),g=0;y>g;g++)v[g]=t[a++];u[f]={componentDatatype:m,componentsPerAttribute:h,normalize:p,value:v}}o[i++]={attributes:u,modelMatrix:s}}return o}function D(t){for(var r=t.length,n=1+r,i=0;r>i;i++){var a=t[i];n+=2,n+=o(a.boundingSphere)?e.packedLength:0,n+=o(a.boundingSphereCV)?e.packedLength:0;for(var s in a)if(a.hasOwnProperty(s)&&o(a[s])&&"boundingSphere"!==s&&"boundingSphereCV"!==s){var u=a[s];n+=4+3*u.indices.length+u.value.length}}return n}function F(t,r){var n=new Float64Array(D(t)),i=[],a=[],s={},u=t.length,c=0;n[c++]=u;for(var l=0;u>l;l++){var f=t[l],m=f.boundingSphere,h=o(m);n[c++]=h?1:0,h&&(e.pack(m,n,c),c+=e.packedLength),m=f.boundingSphereCV,h=o(m),n[c++]=h?1:0,h&&(e.pack(m,n,c),c+=e.packedLength);var d=[];for(var p in f)f.hasOwnProperty(p)&&o(f[p])&&"boundingSphere"!==p&&"boundingSphereCV"!==p&&(d.push(p),o(s[p])||(s[p]=i.length,i.push(p)));n[c++]=d.length;for(var y=0;y<d.length;y++){var v=d[y],g=f[v];n[c++]=s[v],n[c++]=g.valid?1:0;var E=g.indices,S=E.length;n[c++]=S;for(var C=0;S>C;C++){var w=E[C];n[c++]=w.count,n[c++]=w.offset;var b=a.indexOf(w.attribute);-1===b&&(b=a.length,a.push(w.attribute)),n[c++]=b}n[c++]=g.value.length,n.set(g.value,c),c+=g.value.length}}return r.push(n.buffer),{stringTable:i,packedData:n,attributeTable:a}}function _(t){for(var n=t.stringTable,o=t.attributeTable,i=t.packedData,a=new Array(i[0]),s=0,u=1,c=i.length;c>u;){var l={},f=1===i[u++];f&&(l.boundingSphere=e.unpack(i,u),u+=e.packedLength),f=1===i[u++],f&&(l.boundingSphereCV=e.unpack(i,u),u+=e.packedLength);for(var m=i[u++],h=0;m>h;h++){for(var d=n[i[u++]],p=1===i[u++],y=i[u++],v=y>0?new Array(y):void 0,g=0;y>g;g++){var E={};E.count=i[u++],E.offset=i[u++],E.attribute=o[i[u++]],v[g]=E}for(var S=i[u++],C=p?r.createTypedArray(v[0].attribute.componentDatatype,S):new Array(S),w=0;S>w;w++)C[w]=i[u++];l[d]={dirty:!1,valid:p,indices:v,value:C}}a[s++]=l}return a}if(!s.supportsTypedArrays())return{};var B={};return B.combineGeometry=function(e){var t,r,n,i,a,s=e.instances,u=e.invalidInstances;if(s.length>0){t=w(e),r=m.createAttributeLocations(t[0]),i=E(s),n=[],a=t.length;for(var c=0;a>c;++c){var l=t[c];n.push(b(l,r,i))}}i=o(i)?i:E(u);var f=x(s,u,n,r,i);return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:r,vaAttributes:n,vaAttributeLocations:f,validInstancesIndices:e.validInstancesIndices,invalidInstancesIndices:e.invalidInstancesIndices}},B.packCreateGeometryResults=function(t,r){var n=new Float64Array(O(t)),i=[],a={},s=t.length,u=0;n[u++]=s;for(var c=0;s>c;c++){var l=t[c],f=o(l);if(n[u++]=f?1:0,f){n[u++]=l.primitiveType,n[u++]=l.geometryType;var m=o(l.boundingSphere)?1:0;n[u++]=m,m&&e.pack(l.boundingSphere,n,u),u+=e.packedLength;var h=o(l.boundingSphereCV)?1:0;n[u++]=h,h&&e.pack(l.boundingSphereCV,n,u),u+=e.packedLength;var d=l.attributes,p=[];for(var y in d)d.hasOwnProperty(y)&&o(d[y])&&(p.push(y),o(a[y])||(a[y]=i.length,i.push(y)));n[u++]=p.length;for(var v=0;v<p.length;v++){var g=p[v],E=d[g];n[u++]=a[g],n[u++]=E.componentDatatype,n[u++]=E.componentsPerAttribute,n[u++]=E.normalize?1:0,n[u++]=E.values.length,n.set(E.values,u),u+=E.values.length}var S=o(l.indices)?l.indices.length:0;n[u++]=S,S>0&&(n.set(l.indices,u),u+=S)}}return r.push(n.buffer),{stringTable:i,packedData:n}},B.unpackCreateGeometryResults=function(t){for(var n,o=t.stringTable,i=t.packedData,a=new Array(i[0]),s=0,u=1;u<i.length;){var m=1===i[u++];if(m){var d,p,y=i[u++],v=i[u++],g=1===i[u++];g&&(d=e.unpack(i,u)),u+=e.packedLength;var E=1===i[u++];E&&(p=e.unpack(i,u)),u+=e.packedLength;var S,C,w,b=new f,A=i[u++];for(n=0;A>n;n++){var x=o[i[u++]],T=i[u++];w=i[u++];var M=0!==i[u++];S=i[u++],C=r.createTypedArray(T,S);for(var I=0;S>I;I++)C[I]=i[u++];b[x]=new l({componentDatatype:T,componentsPerAttribute:w,normalize:M,values:C})}var O;if(S=i[u++],S>0){var R=C.length/w;for(O=h.createTypedArray(R,S),n=0;S>n;n++)O[n]=i[u++]}a[s++]=new c({primitiveType:y,geometryType:v,boundingSphere:d,indices:O,attributes:b})}else a[s++]=void 0}return a},B.packCombineGeometryParameters=function(e,t){for(var r=e.createGeometryResults,n=r.length,o=0;n>o;o++)t.push(r[o].packedData.buffer);var i;return e.allowPicking&&(i=R(e.pickIds,t)),{createGeometryResults:e.createGeometryResults,packedInstances:P(e.instances,t),packedPickIds:i,ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof u,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,allowPicking:e.allowPicking,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix}},B.unpackCombineGeometryParameters=function(e){for(var t=z(e.packedInstances),r=e.allowPicking,n=r?N(e.packedPickIds):void 0,i=e.createGeometryResults,s=i.length,c=0,l=[],f=[],m=[],h=[],y=[],v=0;s>v;v++)for(var g=B.unpackCreateGeometryResults(i[v]),E=g.length,S=0;E>S;S++){var C=g[S],w=t[c];o(C)?(w.geometry=C,l.push(w),m.push(c),r&&y.push(n[c])):(f.push(w),h.push(c)),++c}var b=a.clone(e.ellipsoid),A=e.isGeographic?new u(b):new p(b);return{instances:l,invalidInstances:f,validInstancesIndices:m,invalidInstancesIndices:h,pickIds:y,ellipsoid:b,projection:A,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,allowPicking:e.allowPicking,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:d.clone(e.modelMatrix)}},B.packCombineGeometryResults=function(e,t){return o(e.geometries)&&(M(e.geometries,t),I(e.vaAttributes,t)),{geometries:e.geometries,attributeLocations:e.attributeLocations,vaAttributes:e.vaAttributes,packedVaAttributeLocations:F(e.vaAttributeLocations,t),modelMatrix:e.modelMatrix,validInstancesIndices:e.validInstancesIndices,invalidInstancesIndices:e.invalidInstancesIndices}},B.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,vaAttributes:e.vaAttributes,perInstanceAttributeLocations:_(e.packedVaAttributeLocations,e.vaAttributes),modelMatrix:e.modelMatrix}},B}),define("Core/formatError",["./defined"],function(e){"use strict";var t=function(t){var r,n=t.name,o=t.message;r=e(n)&&e(o)?n+": "+o:t.toString();var i=t.stack;return e(i)&&(r+="\n"+i),r};return t}),define("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,t,r){"use strict";var n=function(n){var o,i=[],a={id:void 0,result:void 0,error:void 0};return function(s){var u=s.data;i.length=0,a.id=u.id,a.error=void 0,a.result=void 0;try{a.result=n(u.parameters,i)}catch(c){a.error=c instanceof Error?{name:c.name,message:c.message,stack:c.stack}:c}t(o)||(o=e(self.webkitPostMessage,self.postMessage)),u.canTransferArrayBuffer||(i.length=0);try{o(a,i)}catch(c){a.result=void 0,a.error="postMessage failed with error: "+r(c)+"\n with responseMessage: "+JSON.stringify(a),o(a)}}};return n}),define("Workers/combineGeometry",["../Scene/PrimitivePipeline","./createTaskProcessorWorker"],function(e,t){"use strict";function r(t,r){var n=e.unpackCombineGeometryParameters(t),o=e.combineGeometry(n);return e.packCombineGeometryResults(o,r)}return t(r)})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createBoxGeometry.js b/libs/Cesium/Workers/createBoxGeometry.js deleted file mode 100644 index fd9943c8..00000000 --- a/libs/Cesium/Workers/createBoxGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(t){return t>0?1:0>t?-1:0},n.signNotZero=function(t){return 0>t?-1:1},n.toSNorm=function(t){return Math.round(255*(.5*n.clamp(t,-1,1)+.5))},n.fromSNorm=function(t){return 2*(n.clamp(t,0,255)/255)-1},n.sinh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e-n)},n.cosh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e+n)},n.lerp=function(t,e,n){return(1-n)*t+n*e},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(t){return t*n.RADIANS_PER_DEGREE},n.toDegrees=function(t){return t*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(t){var e=n.TWO_PI,r=t-Math.floor(t/e)*e;return r<-Math.PI?r+e:r>=Math.PI?r-e:r},n.negativePiToPi=function(t){return n.zeroToTwoPi(t+n.PI)-n.PI},n.zeroToTwoPi=function(t){var e=n.mod(t,n.TWO_PI);return Math.abs(e)<n.EPSILON14&&Math.abs(t)>n.EPSILON14?n.TWO_PI:e},n.mod=function(t,e){return(t%e+e)%e},n.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return i>=a||a<=r*Math.max(Math.abs(t),Math.abs(n))};var r=[1];n.factorial=function(t){var e=r.length;if(t>=e)for(var n=r[e-1],i=e;t>=i;i++)r.push(n*i);return r[t]},n.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},n.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},n.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},n.clamp=function(t,e,n){return e>t?e:t>n?n:t};var i=new t;return n.setRandomNumberSeed=function(e){i=new t(e)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(t){return Math.acos(n.clamp(t,-1,1))},n.asinClamped=function(t){return Math.asin(n.clamp(t,-1,1))},n.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)};a.fromSpherical=function(n,r){e(r)||(r=new a);var i=n.clock,o=n.cone,u=t(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(t,n,r,i){return e(i)?(i.x=t,i.y=n,i.z=r,i):new a(t,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):n.y<=n.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)},a.cross=function(t,e,n){var r=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(t,e,n,r,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),e(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o++)r[o]=i.toRadians(t[o]);return a.fromRadiansArray(r,e,n)},a.fromRadiansArray=function(t,n,r){var i=t.length;e(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o+=3)r[o]=i.toRadians(t[o]),r[o+1]=i.toRadians(t[o+1]),r[o+2]=t[o+2];return a.fromRadiansArrayHeights(r,e,n)},a.fromRadiansArrayHeights=function(t,n,r){var i=t.length;e(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)};return a.fromRadians=function(n,r,i,o){return i=t(i,0),e(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(t,e,n,r){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},a.equalsEpsilon=function(t,n,r){return t===n||e(t)&&e(n)&&Math.abs(t.longitude-n.longitude)<=r&&Math.abs(t.latitude-n.latitude)<=r&&Math.abs(t.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var e={},n=function(n,r){t(e[n])||(e[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(e,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),e._radii=new t(r,i,a),e._radiiSquared=new t(r*r,i*i,a*a),e._radiiToTheFourth=new t(r*r*r*r,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(r,i,a),e._maximumRadius=Math.max(r,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,n){if(!r(e))return void 0;var i=e._radii;return r(n)?(t.clone(i,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return r(e)||(e=new c),r(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,r,i){i=n(i,0),t.pack(e._radii,r,i)},c.unpack=function(e,r,i){r=n(r,0);var a=t.unpack(e,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,n){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(e,n){return r(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;c.prototype.cartographicToCartesian=function(e,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),r(n)||(n=new t),t.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var h=new t,d=new t,m=new t;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=t.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(t.dot(s,n))*t.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new e(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,n){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),x=t.multiplyByScalar(e,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?t.clone(x,n):void 0;var g=this._oneOverRadiiSquared,E=g.x,z=g.y,M=g.z,S=p;S.x=2*x.x*E,S.y=2*x.y*z,S.z=2*x.z*M;var O,T,_,I,N,R,b,A,P,C,L,q=(1-w)*t.magnitude(e)/(.5*t.magnitude(S)),U=0;do{q-=U,_=1/(1+q*E),I=1/(1+q*z),N=1/(1+q*M),R=_*_,b=I*I,A=N*N,P=R*_,C=b*I,L=A*N,O=h*R+d*b+m*A-1,T=h*P*E+d*C*z+m*L*M;var D=-2*T;U=O/D}while(Math.abs(O)>u.EPSILON12);return r(n)?(n.x=i*_,n.y=a*I,n.z=o*N,n):new t(i*_,a*I,o*N)},c.prototype.scaleToGeocentricSurface=function(e,n){r(n)||(n=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,n)},c.prototype.transformPositionToScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._radii,n)},c.prototype.equals=function(e){return this===e||r(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";var u=function(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var e={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(e)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var e=function(e,n){this.start=t(e,0),this.stop=t(n,0)};return e}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)};a.fromElements=function(t,n,r,i,o){return e(o)?(o.x=t,o.y=n,o.z=r,o.w=i,o):new a(t,n,r,i)},a.fromColor=function(t,n){return e(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new a(t.red,t.green,t.blue,t.alpha)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new a(t.x,t.y,t.z,t.w):void 0},a.packedLength=4,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n.w=Math.min(t.w,e.w),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n.w=Math.max(t.w,e.w),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e.w=t.w/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n.w=t.w*e.w,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n.w=t.w+e.w,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n.w=t.w-e.w,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n.w=t.w*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n.w=t.w/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e.w=Math.abs(t.w),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,s);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]&&t.w===e[n+3]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)&&i.equalsEpsilon(t.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t){for(var e=0,n=0;9>n;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function u(t){for(var e=0,n=0;3>n;++n){var r=t[c.getElementIndex(d[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function s(t,e){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(t[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(t[c.getElementIndex(m,f)])>n){var y,p=t[c.getElementIndex(m,m)],v=t[c.getElementIndex(f,f)],w=t[c.getElementIndex(m,f)],x=(p-v)/2/w;y=0>x?-1/(-x+Math.sqrt(1+x*x)):1/(x+Math.sqrt(1+x*x)),s=1/Math.sqrt(1+y*y),l=y*s}return e=c.clone(c.IDENTITY,e),e[c.getElementIndex(f,f)]=e[c.getElementIndex(m,m)]=s,e[c.getElementIndex(m,f)]=l,e[c.getElementIndex(f,m)]=-l,e}var c=function(t,n,r,i,a,o,u,s,c){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(u,0),this[3]=e(n,0),this[4]=e(a,0),this[5]=e(s,0),this[6]=e(r,0),this[7]=e(o,0),this[8]=e(c,0)};c.packedLength=9,c.pack=function(t,n,r){r=e(r,0),n[r++]=t[0],n[r++]=t[1],n[r++]=t[2],n[r++]=t[3],n[r++]=t[4],n[r++]=t[5],n[r++]=t[6],n[r++]=t[7],n[r++]=t[8]},c.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r++],i[1]=t[r++],i[2]=t[r++],i[3]=t[r++],i[4]=t[r++],i[5]=t[r++],i[6]=t[r++],i[7]=t[r++],i[8]=t[r++],i},c.clone=function(t,e){return n(t)?n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new c(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},c.fromArray=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r],i[1]=t[r+1],i[2]=t[r+2],i[3]=t[r+3],i[4]=t[r+4],i[5]=t[r+5],i[6]=t[r+6],i[7]=t[r+7],i[8]=t[r+8],i},c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},c.fromQuaternion=function(t,e){var r=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,s=t.y*t.z,l=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,x=2*(s-o),g=2*(a-l),E=2*(s+o),z=-r-u+f+d;return n(e)?(e[0]=m,e[1]=v,e[2]=g,e[3]=y,e[4]=w,e[5]=E,e[6]=p,e[7]=x,e[8]=z,e):new c(m,y,p,v,w,x,g,E,z)},c.fromScale=function(t,e){return n(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new c(t.x,0,0,0,t.y,0,0,0,t.z)},c.fromUniformScale=function(t,e){return n(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new c(t,0,0,0,t,0,0,0,t)},c.fromCrossProduct=function(t,e){return n(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new c(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},c.fromRotationX=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=r,e[5]=i,e[6]=0,e[7]=-i,e[8]=r,e):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=r,e):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},c.getElementIndex=function(t,e){return 3*t+e},c.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;c.getMaximumScale=function(e){return c.getScale(e,f),t.maximumComponent(f)},c.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],l=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],f=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},c.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},c.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],l=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=l,e};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(t,e){var r=a.EPSILON20,i=10,l=0,f=0;n(e)||(e={});for(var h=e.unitary=c.clone(c.IDENTITY,e.unitary),d=e.diagonal=c.clone(t,e.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},c.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(t,e){var n=t[0],i=t[1],o=t[2],u=t[3],s=t[4],l=t[5],f=t[6],h=t[7],d=t[8],m=c.determinant(t);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");e[0]=s*d-h*l,e[1]=h*o-i*d,e[2]=i*l-s*o,e[3]=f*l-u*d,e[4]=n*d-f*o,e[5]=u*o-n*l,e[6]=u*h-f*s,e[7]=f*i-n*h,e[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(e,y,e)},c.equals=function(t,e){return t===e||n(t)&&n(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},c.equalsEpsilon=function(t,e,r){return t===e||n(t)&&n(e)&&Math.abs(t[0]-e[0])<=r&&Math.abs(t[1]-e[1])<=r&&Math.abs(t[2]-e[2])<=r&&Math.abs(t[3]-e[3])<=r&&Math.abs(t[4]-e[4])<=r&&Math.abs(t[5]-e[5])<=r&&Math.abs(t[6]-e[6])<=r&&Math.abs(t[7]-e[7])<=r&&Math.abs(t[8]-e[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var e=function(t){this.name="RuntimeError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,e,n,r,i,a,o,u,s){"use strict";var c=function(t,e,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(t,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(e,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(t,e,r){r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e[r++]=t[9],e[r++]=t[10],e[r++]=t[11],e[r++]=t[12],e[r++]=t[13],e[r++]=t[14],e[r]=t[15]},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},c.clone=function(t,e){return r(t)?r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):new c(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},c.fromRotationTranslation=function(e,i,a){return i=n(i,t.ZERO),r(a)?(a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=0,a[4]=e[3],a[5]=e[4],a[6]=e[5],a[7]=0,a[8]=e[6],a[9]=e[7],a[10]=e[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(e[0],e[3],e[6],i.x,e[1],e[4],e[7],i.y,e[2],e[5],e[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(t,e,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=e.x*e.x,l=e.x*e.y,f=e.x*e.z,h=e.x*e.w,d=e.y*e.y,m=e.y*e.z,y=e.y*e.w,p=e.z*e.z,v=e.z*e.w,w=e.w*e.w,x=s-d-p+w,g=2*(l-v),E=2*(f+y),z=2*(l+v),M=-s+d-p+w,S=2*(m-h),O=2*(f-y),T=2*(m+h),_=-s-d+p+w;return i[0]=x*a,i[1]=z*a,i[2]=O*a,i[3]=0,i[4]=g*o,i[5]=M*o,i[6]=T*o,i[7]=0,i[8]=E*u,i[9]=S*u,i[10]=_*u,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i},c.fromTranslation=function(t,e){return c.fromRotationTranslation(u.IDENTITY,t,e)},c.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},c.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var l=new t,f=new t,h=new t;c.fromCamera=function(e,n){var i=e.eye,a=e.target,o=e.up;t.normalize(t.subtract(a,i,l),l),t.normalize(t.cross(l,o,f),f),t.normalize(t.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,x=h.z,g=i.x,E=i.y,z=i.z,M=u*-g+s*-E+d*-z,S=v*-g+w*-E+x*-z,O=m*g+y*E+p*z;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=x,n[10]=-p,n[11]=0,n[12]=M,n[13]=S,n[14]=O,n[15]=1,n):new c(u,s,d,M,v,w,x,S,-m,-y,-p,O,0,0,0,1)},c.computePerspectiveFieldOfView=function(t,e,n,r,i){var a=Math.tan(.5*t),o=1/a,u=o/e,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(t,e,n,r,i,a,o){var u=1/(e-t),s=1/(r-n),c=1/(a-i),l=-(e+t)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(t,e,n,r,i,a,o){var u=2*i/(e-t),s=2*i/(r-n),c=(e+t)/(e-t),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(t,e,n,r,i,a){var o=2*i/(e-t),u=2*i/(r-n),s=(e+t)/(e-t),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(t,e,r,i){t=n(t,n.EMPTY_OBJECT);var a=n(t.x,0),o=n(t.y,0),u=n(t.width,0),s=n(t.height,0);e=n(e,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-e),h=c,d=l,m=f,y=a+c,p=o+l,v=e+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},c.getElementIndex=function(t,e){return 4*t+e},c.getColumn=function(t,e,n){var r=4*e,i=t[r],a=t[r+1],o=t[r+2],u=t[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=4*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=t[15],n},c.getRow=function(t,e,n){var r=t[e],i=t[e+4],a=t[e+8],o=t[e+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+4]=n.y,r[e+8]=n.z,r[e+12]=n.w,r};var d=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],d)),n.y=t.magnitude(t.fromElements(e[4],e[5],e[6],d)),n.z=t.magnitude(t.fromElements(e[8],e[9],e[10],d)),n};var m=new t;c.getMaximumScale=function(e){return c.getScale(e,m),t.maximumComponent(m)},c.multiply=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[3],u=t[4],s=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],p=t[13],v=t[14],w=t[15],x=e[0],g=e[1],E=e[2],z=e[3],M=e[4],S=e[5],O=e[6],T=e[7],_=e[8],I=e[9],N=e[10],R=e[11],b=e[12],A=e[13],P=e[14],C=e[15],L=r*x+u*g+f*E+y*z,q=i*x+s*g+h*E+p*z,U=a*x+c*g+d*E+v*z,D=o*x+l*g+m*E+w*z,B=r*M+u*S+f*O+y*T,F=i*M+s*S+h*O+p*T,W=a*M+c*S+d*O+v*T,k=o*M+l*S+m*O+w*T,G=r*_+u*I+f*N+y*R,V=i*_+s*I+h*N+p*R,Y=a*_+c*I+d*N+v*R,j=o*_+l*I+m*N+w*R,Z=r*b+u*A+f*P+y*C,H=i*b+s*A+h*P+p*C,X=a*b+c*A+d*P+v*C,K=o*b+l*A+m*P+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=D,n[4]=B,n[5]=F,n[6]=W,n[7]=k,n[8]=G,n[9]=V,n[10]=Y,n[11]=j,n[12]=Z,n[13]=H,n[14]=X,n[15]=K,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n[9]=t[9]+e[9],n[10]=t[10]+e[10],n[11]=t[11]+e[11],n[12]=t[12]+e[12],n[13]=t[13]+e[13],n[14]=t[14]+e[14],n[15]=t[15]+e[15],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n[9]=t[9]-e[9],n[10]=t[10]-e[10],n[11]=t[11]-e[11],n[12]=t[12]-e[12],n[13]=t[13]-e[13],n[14]=t[14]-e[14],n[15]=t[15]-e[15],n},c.multiplyTransformation=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=t[12],d=t[13],m=t[14],y=e[0],p=e[1],v=e[2],w=e[4],x=e[5],g=e[6],E=e[8],z=e[9],M=e[10],S=e[12],O=e[13],T=e[14],_=r*y+o*p+c*v,I=i*y+u*p+l*v,N=a*y+s*p+f*v,R=r*w+o*x+c*g,b=i*w+u*x+l*g,A=a*w+s*x+f*g,P=r*E+o*z+c*M,C=i*E+u*z+l*M,L=a*E+s*z+f*M,q=r*S+o*O+c*T+h,U=i*S+u*O+l*T+d,D=a*S+s*O+f*T+m;return n[0]=_,n[1]=I,n[2]=N,n[3]=0,n[4]=R,n[5]=b,n[6]=A,n[7]=0,n[8]=P,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=D,n[15]=1,n},c.multiplyByMatrix3=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=e[0],d=e[1],m=e[2],y=e[3],p=e[4],v=e[5],w=e[6],x=e[7],g=e[8],E=r*h+o*d+c*m,z=i*h+u*d+l*m,M=a*h+s*d+f*m,S=r*y+o*p+c*v,O=i*y+u*p+l*v,T=a*y+s*p+f*v,_=r*w+o*x+c*g,I=i*w+u*x+l*g,N=a*w+s*x+f*g;return n[0]=E,n[1]=z,n[2]=M,n[3]=0,n[4]=S,n[5]=O,n[6]=T,n[7]=0,n[8]=_,n[9]=I,n[10]=N,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},c.multiplyByTranslation=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=r*t[0]+i*t[4]+a*t[8]+t[12],u=r*t[1]+i*t[5]+a*t[9]+t[13],s=r*t[2]+i*t[6]+a*t[10]+t[14];return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=o,n[13]=u,n[14]=s,n[15]=t[15],n};var y=new t;c.multiplyByUniformScale=function(t,e,n){return y.x=e,y.y=e,y.z=e,c.multiplyByScale(t,y,n)},c.multiplyByScale=function(t,e,n){var r=e.x,i=e.y,a=e.z;return 1===r&&1===i&&1===a?c.clone(t,n):(n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=0,n[4]=i*t[4],n[5]=i*t[5],n[6]=i*t[6],n[7]=0,n[8]=a*t[8],n[9]=a*t[9],n[10]=a*t[10],n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=1,n)},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t[0]*r+t[4]*i+t[8]*a+t[12]*o,s=t[1]*r+t[5]*i+t[9]*a+t[13]*o,c=t[2]*r+t[6]*i+t[10]*a+t[14]*o,l=t[3]*r+t[7]*i+t[11]*a+t[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a,u=t[1]*r+t[5]*i+t[9]*a,s=t[2]*r+t[6]*i+t[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a+t[12],u=t[1]*r+t[5]*i+t[9]*a+t[13],s=t[2]*r+t[6]*i+t[10]*a+t[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n[9]=t[9]*e,n[10]=t[10]*e,n[11]=t[11]*e,n[12]=t[12]*e,n[13]=t[13]*e,n[14]=t[14]*e,n[15]=t[15]*e,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},c.transpose=function(t,e){var n=t[1],r=t[2],i=t[3],a=t[6],o=t[7],u=t[11];return e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[10]=t[10],e[11]=t[14],e[12]=i,e[13]=o,e[14]=u,e[15]=t[15],e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e[9]=Math.abs(t[9]),e[10]=Math.abs(t[10]),e[11]=Math.abs(t[11]),e[12]=Math.abs(t[12]),e[13]=Math.abs(t[13]),e[14]=Math.abs(t[14]),e[15]=Math.abs(t[15]),e},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[3]===e[3]&&t[7]===e[7]&&t[11]===e[11]&&t[15]===e[15]},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n&&Math.abs(t[9]-e[9])<=n&&Math.abs(t[10]-e[10])<=n&&Math.abs(t[11]-e[11])<=n&&Math.abs(t[12]-e[12])<=n&&Math.abs(t[13]-e[13])<=n&&Math.abs(t[14]-e[14])<=n&&Math.abs(t[15]-e[15])<=n},c.getTranslation=function(t,e){return e.x=t[12],e.y=t[13],e.z=t[14],e},c.getRotation=function(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e};var p=new u,v=new u,w=new e,x=new e(0,0,0,1);return c.inverse=function(t,n){if(u.equalsEpsilon(c.getRotation(t,p),v,o.EPSILON7)&&e.equals(c.getRow(t,3,w),x))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-t[12],n[13]=-t[13],n[14]=-t[14],n[15]=1,n;var r=t[0],i=t[4],a=t[8],l=t[12],f=t[1],h=t[5],d=t[9],m=t[13],y=t[2],g=t[6],E=t[10],z=t[14],M=t[3],S=t[7],O=t[11],T=t[15],_=E*T,I=z*O,N=g*T,R=z*S,b=g*O,A=E*S,P=y*T,C=z*M,L=y*O,q=E*M,U=y*S,D=g*M,B=_*h+R*d+b*m-(I*h+N*d+A*m),F=I*f+P*d+q*m-(_*f+C*d+L*m),W=N*f+C*h+U*m-(R*f+P*h+D*m),k=A*f+L*h+D*d-(b*f+q*h+U*d),G=I*i+N*a+A*l-(_*i+R*a+b*l),V=_*r+C*a+L*l-(I*r+P*a+q*l),Y=R*r+P*i+D*l-(N*r+C*i+U*l),j=b*r+q*i+U*a-(A*r+L*i+D*a);_=a*m,I=l*d,N=i*m,R=l*h,b=i*d,A=a*h,P=r*m,C=l*f,L=r*d,q=a*f,U=r*h,D=i*f;var Z=_*S+R*O+b*T-(I*S+N*O+A*T),H=I*M+P*O+q*T-(_*M+C*O+L*T),X=N*M+C*S+U*T-(R*M+P*S+D*T),K=A*M+L*S+D*O-(b*M+q*S+U*O),J=N*E+A*z+I*g-(b*z+_*g+R*E),Q=L*z+_*y+C*E-(P*E+q*z+I*y),$=P*g+D*z+R*y-(U*z+N*y+C*g),te=U*E+b*y+q*g-(L*g+D*E+A*y),ee=r*B+i*F+a*W+l*k;if(Math.abs(ee)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return ee=1/ee,n[0]=B*ee,n[1]=F*ee,n[2]=W*ee,n[3]=k*ee,n[4]=G*ee,n[5]=V*ee,n[6]=Y*ee,n[7]=j*ee,n[8]=Z*ee,n[9]=H*ee,n[10]=X*ee,n[11]=K*ee,n[12]=J*ee,n[13]=Q*ee,n[14]=$*ee,n[15]=te*ee,n},c.inverseTransformation=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],u=t[6],s=t[8],c=t[9],l=t[10],f=t[12],h=t[13],d=t[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return e[0]=n,e[1]=a,e[2]=s,e[3]=0,e[4]=r,e[5]=o,e[6]=c,e[7]=0,e[8]=i,e[9]=u,e[10]=l,e[11]=0,e[12]=m,e[13]=y,e[14]=p,e[15]=1,e},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]&&t[9]===e[n+9]&&t[10]===e[n+10]&&t[11]===e[n+11]&&t[12]===e[n+12]&&t[13]===e[n+13]&&t[14]===e[n+14]&&t[15]===e[n+15]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e,n){this.normal=t.clone(e),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-t.dot(r,n);return e(a)?(t.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new t;return i.fromCartesian4=function(n,r){var o=t.fromCartesian4(n,a),u=n.w;return e(r)?(t.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(e,n){return t.dot(e.normal,n)+e.distance},i.ORIGIN_XY_PLANE=r(new i(t.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(t.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(t.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";var s=function(t,n,r,i){this.west=e(t,0),this.south=e(n,0),this.east=e(r,0),this.north=e(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(t,n,r){r=e(r,0),n[r++]=t.west,n[r++]=t.south,n[r++]=t.east,n[r]=t.north},s.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new s),i.west=t[r++],i.south=t[r++],i.east=t[r++],i.north=t[r],i},s.computeWidth=function(t){var e=t.east,n=t.west;return n>e&&(e+=u.TWO_PI),e-n},s.computeHeight=function(t){return t.north-t.south},s.fromDegrees=function(t,r,i,a,o){return t=u.toRadians(e(t,0)),r=u.toRadians(e(r,0)),i=u.toRadians(e(i,0)),a=u.toRadians(e(a,0)),n(o)?(o.west=t,o.south=r,o.east=i,o.north=a,o):new s(t,r,i,a)},s.fromCartographicArray=function(t,e){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=t.length;c>u;u++){var l=t[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(e)?(e.west=r,e.south=a,e.east=i,e.north=o,e):new s(r,a,i,o)},s.clone=function(t,e){return n(t)?n(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north):void 0},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||n(t)&&n(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return n(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(){},s.southwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.south,r.height=0,r):new t(e.west,e.south)},s.northwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.north,r.height=0,r):new t(e.west,e.north)},s.northeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.north,r.height=0,r):new t(e.east,e.north)},s.southeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.south,r.height=0,r):new t(e.east,e.south)},s.center=function(e,r){var i=e.east,a=e.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(e.south+e.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new t(o,s)},s.intersection=function(t,e,r){var i=t.east,a=t.west,o=e.east,c=e.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((t.west<t.east||e.west<e.east)&&l>=f)return void 0;var h=Math.max(t.south,e.south),d=Math.min(t.north,e.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(t,e){var n=e.longitude,r=e.latitude,i=t.west,a=t.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,r,i,o){r=e(r,a.WGS84),i=e(i,0),n(o)||(o=[]);var l=0,f=t.north,h=t.south,d=t.east,m=t.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(t,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,r){this.center=t.clone(n(e,t.ZERO)),this.radius=n(r,0)},m=new t,y=new t,p=new t,v=new t,w=new t,x=new t,g=new t,E=new t,z=new t,M=new t,S=new t,O=new t;d.fromPoints=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;for(var i=t.clone(e[0],g),a=t.clone(i,m),o=t.clone(i,y),u=t.clone(i,p),s=t.clone(i,v),c=t.clone(i,w),l=t.clone(i,x),f=e.length,h=1;f>h;h++){t.clone(e[h],i);var T=i.x,_=i.y,I=i.z;T<a.x&&t.clone(i,a),T>s.x&&t.clone(i,s),_<o.y&&t.clone(i,o),_>c.y&&t.clone(i,c),I<u.z&&t.clone(i,u),I>l.z&&t.clone(i,l)}var N=t.magnitudeSquared(t.subtract(s,a,E)),R=t.magnitudeSquared(t.subtract(c,o,E)),b=t.magnitudeSquared(t.subtract(l,u,E)),A=a,P=s,C=N;R>C&&(C=R,A=o,P=c),b>C&&(C=b,A=u,P=l);var L=z;L.x=.5*(A.x+P.x),L.y=.5*(A.y+P.y),L.z=.5*(A.z+P.z);var q=t.magnitudeSquared(t.subtract(P,L,E)),U=Math.sqrt(q),D=M;D.x=a.x,D.y=o.y,D.z=u.z;var B=S;B.x=s.x,B.y=c.y,B.z=l.z;var F=t.multiplyByScalar(t.add(D,B,E),.5,O),W=0;for(h=0;f>h;h++){t.clone(e[h],i);var k=t.magnitude(t.subtract(i,F,E));k>W&&(W=k);var G=t.magnitudeSquared(t.subtract(i,L,E));if(G>q){var V=Math.sqrt(G);U=.5*(U+V),q=U*U;var Y=V-U;L.x=(U*L.x+Y*i.x)/V,L.y=(U*L.y+Y*i.y)/V,L.z=(U*L.z+Y*i.z)/V}}return W>U?(t.clone(L,n.center),n.radius=U):(t.clone(F,n.center),n.radius=W),n};var T=new u,_=new t,I=new t,N=new e,R=new e;d.fromRectangle2D=function(t,e,n){return d.fromRectangleWithHeights2D(t,e,0,0,n)},d.fromRectangleWithHeights2D=function(e,i,a,o,u){if(r(u)||(u=new d),!r(e))return u.center=t.clone(t.ZERO,u.center),u.radius=0,u;i=n(i,T),h.southwest(e,N),N.height=a,h.northeast(e,R),R.height=o;var s=i.project(N,_),c=i.project(R,I),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var b=[];d.fromRectangle3D=function(t,e,i,a){e=n(e,o.WGS84),i=n(i,0);var u;return r(t)&&(u=h.subsample(t,e,i,b)),d.fromPoints(u,a)},d.fromVertices=function(e,i,a,o){if(r(o)||(o=new d),!r(e)||0===e.length)return o.center=t.clone(t.ZERO,o.center),o.radius=0,o;i=n(i,t.ZERO),a=n(a,3);var u=g;u.x=e[0]+i.x,u.y=e[1]+i.y,u.z=e[2]+i.z;for(var s=t.clone(u,m),c=t.clone(u,y),l=t.clone(u,p),f=t.clone(u,v),h=t.clone(u,w),T=t.clone(u,x),_=e.length,I=0;_>I;I+=a){var N=e[I]+i.x,R=e[I+1]+i.y,b=e[I+2]+i.z;u.x=N,u.y=R,u.z=b,N<s.x&&t.clone(u,s),N>f.x&&t.clone(u,f),R<c.y&&t.clone(u,c),R>h.y&&t.clone(u,h),b<l.z&&t.clone(u,l),b>T.z&&t.clone(u,T)}var A=t.magnitudeSquared(t.subtract(f,s,E)),P=t.magnitudeSquared(t.subtract(h,c,E)),C=t.magnitudeSquared(t.subtract(T,l,E)),L=s,q=f,U=A;P>U&&(U=P,L=c,q=h),C>U&&(U=C,L=l,q=T);var D=z;D.x=.5*(L.x+q.x),D.y=.5*(L.y+q.y),D.z=.5*(L.z+q.z);var B=t.magnitudeSquared(t.subtract(q,D,E)),F=Math.sqrt(B),W=M;W.x=s.x,W.y=c.y,W.z=l.z;var k=S;k.x=f.x,k.y=h.y,k.z=T.z;var G=t.multiplyByScalar(t.add(W,k,E),.5,O),V=0;for(I=0;_>I;I+=a){u.x=e[I]+i.x,u.y=e[I+1]+i.y,u.z=e[I+2]+i.z;var Y=t.magnitude(t.subtract(u,G,E));Y>V&&(V=Y);var j=t.magnitudeSquared(t.subtract(u,D,E));if(j>B){var Z=Math.sqrt(j);F=.5*(F+Z),B=F*F;var H=Z-F;D.x=(F*D.x+H*u.x)/Z,D.y=(F*D.y+H*u.y)/Z,D.z=(F*D.z+H*u.z)/Z}}return V>F?(t.clone(D,o.center),o.radius=F):(t.clone(G,o.center),o.radius=V),o},d.fromCornerPoints=function(e,n,i){r(i)||(i=new d);var a=i.center;return t.add(e,n,a),t.multiplyByScalar(a,.5,a),i.radius=t.distance(a,n),i},d.fromEllipsoid=function(e,n){return r(n)||(n=new d),t.clone(t.ZERO,n.center),n.radius=e.maximumRadius,n};var A=new t;d.fromBoundingSpheres=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var i=e.length;if(1===i)return d.clone(e[0],n);if(2===i)return d.union(e[0],e[1],n);for(var a=[],o=0;i>o;o++)a.push(e[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=e[o];s=Math.max(s,t.distance(u,c.center,A)+c.radius)}return n.radius=s,n},d.clone=function(e,n){return r(e)?r(n)?(n.center=t.clone(e.center,n.center),n.radius=e.radius,n):new d(e.center,e.radius):void 0},d.packedLength=4,d.pack=function(t,e,r){r=n(r,0);var i=t.center;e[r++]=i.x,e[r++]=i.y,e[r++]=i.z,e[r]=t.radius},d.unpack=function(t,e,i){e=n(e,0),r(i)||(i=new d);var a=i.center;return a.x=t[e++],a.y=t[e++],a.z=t[e++],i.radius=t[e],i};var P=new t,C=new t;d.union=function(e,n,i){r(i)||(i=new d);var a=e.center,o=e.radius,u=n.center,s=n.radius,c=t.subtract(u,a,P),l=t.magnitude(c);if(o>=l+s)return e.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=t.multiplyByScalar(c,(-o+f)/l,C);return t.add(h,a,h),t.clone(h,i.center),i.radius=f,i};var L=new t;d.expand=function(e,n,r){r=d.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new t,0);d.intersect=function(t,e){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(e,q);return d.intersectPlane(t,n)},d.transform=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=l.getMaximumScale(e)*t.radius,n};var U=new t;d.distanceSquaredTo=function(e,n){var r=t.subtract(e.center,n,U);return t.magnitudeSquared(r)-e.radius*e.radius},d.transformWithoutScale=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=t.radius,n};var D=new t;d.computePlaneDistances=function(e,n,i,a){r(a)||(a=new c);var o=t.subtract(e.center,n,D),u=t.multiplyByScalar(i,t.dot(i,o),D),s=t.magnitude(u);return a.start=s-e.radius,a.stop=s+e.radius,a};for(var B=new t,F=new t,W=new t,k=new t,G=new t,V=new e,Y=new Array(8),j=0;8>j;++j)Y[j]=new t;var Z=new u;return d.projectTo2D=function(e,r,i){r=n(r,Z);var a=r.ellipsoid,o=e.center,u=e.radius,s=a.geodeticSurfaceNormal(o,B),c=t.cross(t.UNIT_Z,s,F);t.normalize(c,c);var l=t.cross(s,c,W);t.normalize(l,l),t.multiplyByScalar(s,u,s),t.multiplyByScalar(l,u,l),t.multiplyByScalar(c,u,c);var f=t.negate(l,G),h=t.negate(c,k),m=Y,y=m[0];t.add(s,l,y),t.add(y,c,y),y=m[1],t.add(s,l,y),t.add(y,h,y),y=m[2],t.add(s,f,y),t.add(y,h,y),y=m[3],t.add(s,f,y),t.add(y,c,y),t.negate(s,s),y=m[4],t.add(s,l,y),t.add(y,c,y),y=m[5],t.add(s,l,y),t.add(y,h,y),y=m[6],t.add(s,f,y),t.add(y,h,y),y=m[7],t.add(s,f,y),t.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];t.add(o,w,w);var x=a.cartesianToCartographic(w,V);r.project(x,w)}i=d.fromPoints(m,i),o=i.center;var g=o.x,E=o.y,z=o.z;return o.x=z,o.y=g,o.z=E,i},d.equals=function(e,n){return e===n||r(e)&&r(n)&&t.equals(e.center,n.center)&&e.radius===n.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,e){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return e(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(t(n))return n;n=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof e[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof e[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",t(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",t(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",t(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",t(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(t){i.supportsFullscreen()&&t[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,e,n){"use strict";function r(t){for(var e=t.split("."),n=0,r=e.length;r>n;++n)e[n]=parseInt(e[n],10);return e}function i(){if(!e(p)){p=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(p=!0,v=r(t[1]))}return p}function a(){return i()&&v}function o(){if(!e(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(w=!0,x=r(t[1]))}return w}function u(){return o()&&x}function s(){if(!e(g)){g=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(g=!0,E=r(t[1]),E.isNightly=!!t[2])}return g}function c(){return s()&&E}function l(){if(!e(z)){z=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(z=!0,M=r(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(z=!0,M=r(t[1])))}return z}function f(){return l()&&M}function h(){if(!e(S)){S=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(S=!0,O=r(t[1]))}return S}function d(){return e(T)||(T=/Windows/i.test(navigator.appVersion)),T}function m(){return h()&&O}function y(){return e(_)||(_=e(window.PointerEvent)&&(!e(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),_}var p,v,w,x,g,E,z,M,S,O,T,_,I={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return I.supportsFullscreen=function(){return n.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,e,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(t){switch(t){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(t){return t instanceof Int8Array?a.BYTE:t instanceof Uint8Array?a.UNSIGNED_BYTE:t instanceof Int16Array?a.SHORT:t instanceof Uint16Array?a.UNSIGNED_SHORT:t instanceof Float32Array?a.FLOAT:t instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(t){return e(t)&&(t===a.BYTE||t===a.UNSIGNED_BYTE||t===a.SHORT||t===a.UNSIGNED_SHORT||t===a.FLOAT||t===a.DOUBLE)},a.createTypedArray=function(t,e){switch(t){case a.BYTE:return new Int8Array(e);case a.UNSIGNED_BYTE:return new Uint8Array(e);case a.SHORT:return new Int16Array(e);case a.UNSIGNED_SHORT:return new Uint16Array(e);case a.FLOAT:return new Float32Array(e);case a.DOUBLE:return new Float64Array(e);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(e,r,i,o){switch(i=t(i,0),o=t(o,(r.byteLength-i)/a.getSizeInBytes(e)),e){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var e={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(e)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===e.POINTS||t===e.LINES||t===e.LINE_LOOP||t===e.LINE_STRIP||t===e.TRIANGLES||t===e.TRIANGLE_STRIP||t===e.TRIANGLE_FAN}};return t(e)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,e,n,r,i){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=t(e.primitiveType,i.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=t(e.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(t){var r=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&e(t.attributes[i])&&e(t.attributes[i].values)){var a=t.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=t(e.normalize,!1),this.values=e.values};return e}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color};return e}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e){e=t(e,t.EMPTY_OBJECT),this.position=t(e.position,!1),this.normal=t(e.normal,!1),this.st=t(e.st,!1),this.binormal=t(e.binormal,!1),this.tangent=t(e.tangent,!1),this.color=t(e.color,!1)};return i.POSITION_ONLY=r(new i({position:!0})),i.POSITION_AND_NORMAL=r(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=r(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=r(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=r(new i({position:!0,color:!0})),i.ALL=r(new i({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(e,n,r){r=t(r,0),n[r++]=e.position?1:0,n[r++]=e.normal?1:0,n[r++]=e.st?1:0,n[r++]=e.binormal?1:0,n[r++]=e.tangent?1:0,n[r++]=e.color?1:0},i.unpack=function(n,r,a){return r=t(r,0),e(a)||(a=new i),a.position=1===n[r++],a.normal=1===n[r++],a.st=1===n[r++],a.binormal=1===n[r++],a.tangent=1===n[r++],a.color=1===n[r++],a},i.clone=function(t,n){return e(t)?(e(n)||(n=new i),n.position=t.position,n.normal=t.normal,n.st=t.st,n.binormal=t.binormal,n.tangent=t.tangent,n.color=t.color,n):void 0},i}),define("Core/BoxGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Geometry","./GeometryAttribute","./GeometryAttributes","./PrimitiveType","./VertexFormat"],function(t,e,n,r,i,a,o,u,s,c,l){"use strict";var f=new e,h=function(t){t=r(t,r.EMPTY_OBJECT);var n=t.minimumCorner,i=t.maximumCorner,a=r(t.vertexFormat,l.DEFAULT);this._minimumCorner=e.clone(n),this._maximumCorner=e.clone(i),this._vertexFormat=a,this._workerName="createBoxGeometry"};h.fromDimensions=function(t){t=r(t,r.EMPTY_OBJECT);var n=t.dimensions,i=e.multiplyByScalar(n,.5,new e),a=e.negate(i,new e),o=i,u={minimumCorner:a,maximumCorner:o,vertexFormat:t.vertexFormat};return new h(u)},h.packedLength=2*e.packedLength+l.packedLength,h.pack=function(t,n,i){i=r(i,0),e.pack(t._minimumCorner,n,i),e.pack(t._maximumCorner,n,i+e.packedLength),l.pack(t._vertexFormat,n,i+2*e.packedLength)};var d=new e,m=new e,y=new l,p={minimumCorner:d,maximumCorner:m,vertexFormat:y};return h.unpack=function(t,n,a){n=r(n,0);var o=e.unpack(t,n,d),u=e.unpack(t,n+e.packedLength,m),s=l.unpack(t,n+2*e.packedLength,y); -return i(a)?(a._minimumCorner=e.clone(o,a._minimumCorner),a._maximumCorner=e.clone(u,a._maximumCorner),a._vertexFormat=l.clone(s,a._vertexFormat),a):new h(p)},h.createGeometry=function(r){var i,a,l=r._minimumCorner,h=r._maximumCorner,d=r._vertexFormat,m=new s;if(d.position&&(d.st||d.normal||d.binormal||d.tangent)){if(d.position&&(a=new Float64Array(72),a[0]=l.x,a[1]=l.y,a[2]=h.z,a[3]=h.x,a[4]=l.y,a[5]=h.z,a[6]=h.x,a[7]=h.y,a[8]=h.z,a[9]=l.x,a[10]=h.y,a[11]=h.z,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=h.x,a[16]=l.y,a[17]=l.z,a[18]=h.x,a[19]=h.y,a[20]=l.z,a[21]=l.x,a[22]=h.y,a[23]=l.z,a[24]=h.x,a[25]=l.y,a[26]=l.z,a[27]=h.x,a[28]=h.y,a[29]=l.z,a[30]=h.x,a[31]=h.y,a[32]=h.z,a[33]=h.x,a[34]=l.y,a[35]=h.z,a[36]=l.x,a[37]=l.y,a[38]=l.z,a[39]=l.x,a[40]=h.y,a[41]=l.z,a[42]=l.x,a[43]=h.y,a[44]=h.z,a[45]=l.x,a[46]=l.y,a[47]=h.z,a[48]=l.x,a[49]=h.y,a[50]=l.z,a[51]=h.x,a[52]=h.y,a[53]=l.z,a[54]=h.x,a[55]=h.y,a[56]=h.z,a[57]=l.x,a[58]=h.y,a[59]=h.z,a[60]=l.x,a[61]=l.y,a[62]=l.z,a[63]=h.x,a[64]=l.y,a[65]=l.z,a[66]=h.x,a[67]=l.y,a[68]=h.z,a[69]=l.x,a[70]=l.y,a[71]=h.z,m.position=new u({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:a})),d.normal){var y=new Float32Array(72);y[0]=0,y[1]=0,y[2]=1,y[3]=0,y[4]=0,y[5]=1,y[6]=0,y[7]=0,y[8]=1,y[9]=0,y[10]=0,y[11]=1,y[12]=0,y[13]=0,y[14]=-1,y[15]=0,y[16]=0,y[17]=-1,y[18]=0,y[19]=0,y[20]=-1,y[21]=0,y[22]=0,y[23]=-1,y[24]=1,y[25]=0,y[26]=0,y[27]=1,y[28]=0,y[29]=0,y[30]=1,y[31]=0,y[32]=0,y[33]=1,y[34]=0,y[35]=0,y[36]=-1,y[37]=0,y[38]=0,y[39]=-1,y[40]=0,y[41]=0,y[42]=-1,y[43]=0,y[44]=0,y[45]=-1,y[46]=0,y[47]=0,y[48]=0,y[49]=1,y[50]=0,y[51]=0,y[52]=1,y[53]=0,y[54]=0,y[55]=1,y[56]=0,y[57]=0,y[58]=1,y[59]=0,y[60]=0,y[61]=-1,y[62]=0,y[63]=0,y[64]=-1,y[65]=0,y[66]=0,y[67]=-1,y[68]=0,y[69]=0,y[70]=-1,y[71]=0,m.normal=new u({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:y})}if(d.st){var p=new Float32Array(48);p[0]=0,p[1]=0,p[2]=1,p[3]=0,p[4]=1,p[5]=1,p[6]=0,p[7]=1,p[8]=1,p[9]=0,p[10]=0,p[11]=0,p[12]=0,p[13]=1,p[14]=1,p[15]=1,p[16]=0,p[17]=0,p[18]=1,p[19]=0,p[20]=1,p[21]=1,p[22]=0,p[23]=1,p[24]=1,p[25]=0,p[26]=0,p[27]=0,p[28]=0,p[29]=1,p[30]=1,p[31]=1,p[32]=1,p[33]=0,p[34]=0,p[35]=0,p[36]=0,p[37]=1,p[38]=1,p[39]=1,p[40]=0,p[41]=0,p[42]=1,p[43]=0,p[44]=1,p[45]=1,p[46]=0,p[47]=1,m.st=new u({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:p})}if(d.tangent){var v=new Float32Array(72);v[0]=1,v[1]=0,v[2]=0,v[3]=1,v[4]=0,v[5]=0,v[6]=1,v[7]=0,v[8]=0,v[9]=1,v[10]=0,v[11]=0,v[12]=-1,v[13]=0,v[14]=0,v[15]=-1,v[16]=0,v[17]=0,v[18]=-1,v[19]=0,v[20]=0,v[21]=-1,v[22]=0,v[23]=0,v[24]=0,v[25]=1,v[26]=0,v[27]=0,v[28]=1,v[29]=0,v[30]=0,v[31]=1,v[32]=0,v[33]=0,v[34]=1,v[35]=0,v[36]=0,v[37]=-1,v[38]=0,v[39]=0,v[40]=-1,v[41]=0,v[42]=0,v[43]=-1,v[44]=0,v[45]=0,v[46]=-1,v[47]=0,v[48]=-1,v[49]=0,v[50]=0,v[51]=-1,v[52]=0,v[53]=0,v[54]=-1,v[55]=0,v[56]=0,v[57]=-1,v[58]=0,v[59]=0,v[60]=1,v[61]=0,v[62]=0,v[63]=1,v[64]=0,v[65]=0,v[66]=1,v[67]=0,v[68]=0,v[69]=1,v[70]=0,v[71]=0,m.tangent=new u({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:v})}if(d.binormal){var w=new Float32Array(72);w[0]=0,w[1]=1,w[2]=0,w[3]=0,w[4]=1,w[5]=0,w[6]=0,w[7]=1,w[8]=0,w[9]=0,w[10]=1,w[11]=0,w[12]=0,w[13]=1,w[14]=0,w[15]=0,w[16]=1,w[17]=0,w[18]=0,w[19]=1,w[20]=0,w[21]=0,w[22]=1,w[23]=0,w[24]=0,w[25]=0,w[26]=1,w[27]=0,w[28]=0,w[29]=1,w[30]=0,w[31]=0,w[32]=1,w[33]=0,w[34]=0,w[35]=1,w[36]=0,w[37]=0,w[38]=1,w[39]=0,w[40]=0,w[41]=1,w[42]=0,w[43]=0,w[44]=1,w[45]=0,w[46]=0,w[47]=1,w[48]=0,w[49]=0,w[50]=1,w[51]=0,w[52]=0,w[53]=1,w[54]=0,w[55]=0,w[56]=1,w[57]=0,w[58]=0,w[59]=1,w[60]=0,w[61]=0,w[62]=1,w[63]=0,w[64]=0,w[65]=1,w[66]=0,w[67]=0,w[68]=1,w[69]=0,w[70]=0,w[71]=1,m.binormal=new u({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:w})}i=new Uint16Array(36),i[0]=0,i[1]=1,i[2]=2,i[3]=0,i[4]=2,i[5]=3,i[6]=6,i[7]=5,i[8]=4,i[9]=7,i[10]=6,i[11]=4,i[12]=8,i[13]=9,i[14]=10,i[15]=8,i[16]=10,i[17]=11,i[18]=14,i[19]=13,i[20]=12,i[21]=15,i[22]=14,i[23]=12,i[24]=18,i[25]=17,i[26]=16,i[27]=19,i[28]=18,i[29]=16,i[30]=20,i[31]=21,i[32]=22,i[33]=20,i[34]=22,i[35]=23}else a=new Float64Array(24),a[0]=l.x,a[1]=l.y,a[2]=l.z,a[3]=h.x,a[4]=l.y,a[5]=l.z,a[6]=h.x,a[7]=h.y,a[8]=l.z,a[9]=l.x,a[10]=h.y,a[11]=l.z,a[12]=l.x,a[13]=l.y,a[14]=h.z,a[15]=h.x,a[16]=l.y,a[17]=h.z,a[18]=h.x,a[19]=h.y,a[20]=h.z,a[21]=l.x,a[22]=h.y,a[23]=h.z,m.position=new u({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:a}),i=new Uint16Array(36),i[0]=4,i[1]=5,i[2]=6,i[3]=4,i[4]=6,i[5]=7,i[6]=1,i[7]=0,i[8]=3,i[9]=1,i[10]=3,i[11]=2,i[12]=1,i[13]=6,i[14]=5,i[15]=1,i[16]=2,i[17]=6,i[18]=2,i[19]=3,i[20]=7,i[21]=2,i[22]=7,i[23]=6,i[24]=3,i[25]=0,i[26]=4,i[27]=3,i[28]=4,i[29]=7,i[30]=0,i[31]=1,i[32]=5,i[33]=0,i[34]=5,i[35]=4;var x=e.subtract(h,l,f),g=.5*e.magnitude(x);return new o({attributes:m,indices:i,primitiveType:c.TRIANGLES,boundingSphere:new t(e.ZERO,g)})},h}),define("Workers/createBoxGeometry",["../Core/BoxGeometry","../Core/defined"],function(t,e){"use strict";return function(n,r){return e(r)&&(n=t.unpack(n,r)),t.createGeometry(n)}})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createBoxOutlineGeometry.js b/libs/Cesium/Workers/createBoxOutlineGeometry.js deleted file mode 100644 index aadff4dd..00000000 --- a/libs/Cesium/Workers/createBoxOutlineGeometry.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(t){return t>0?1:0>t?-1:0},n.signNotZero=function(t){return 0>t?-1:1},n.toSNorm=function(t){return Math.round(255*(.5*n.clamp(t,-1,1)+.5))},n.fromSNorm=function(t){return 2*(n.clamp(t,0,255)/255)-1},n.sinh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e-n)},n.cosh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e+n)},n.lerp=function(t,e,n){return(1-n)*t+n*e},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(t){return t*n.RADIANS_PER_DEGREE},n.toDegrees=function(t){return t*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(t){var e=n.TWO_PI,r=t-Math.floor(t/e)*e;return r<-Math.PI?r+e:r>=Math.PI?r-e:r},n.negativePiToPi=function(t){return n.zeroToTwoPi(t+n.PI)-n.PI},n.zeroToTwoPi=function(t){var e=n.mod(t,n.TWO_PI);return Math.abs(e)<n.EPSILON14&&Math.abs(t)>n.EPSILON14?n.TWO_PI:e},n.mod=function(t,e){return(t%e+e)%e},n.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return i>=a||a<=r*Math.max(Math.abs(t),Math.abs(n))};var r=[1];n.factorial=function(t){var e=r.length;if(t>=e)for(var n=r[e-1],i=e;t>=i;i++)r.push(n*i);return r[t]},n.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},n.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},n.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},n.clamp=function(t,e,n){return e>t?e:t>n?n:t};var i=new t;return n.setRandomNumberSeed=function(e){i=new t(e)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(t){return Math.acos(n.clamp(t,-1,1))},n.asinClamped=function(t){return Math.asin(n.clamp(t,-1,1))},n.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)};a.fromSpherical=function(n,r){e(r)||(r=new a);var i=n.clock,o=n.cone,u=t(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(t,n,r,i){return e(i)?(i.x=t,i.y=n,i.z=r,i):new a(t,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):n.y<=n.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)},a.cross=function(t,e,n){var r=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(t,e,n,r,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),e(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o++)r[o]=i.toRadians(t[o]);return a.fromRadiansArray(r,e,n)},a.fromRadiansArray=function(t,n,r){var i=t.length;e(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o+=3)r[o]=i.toRadians(t[o]),r[o+1]=i.toRadians(t[o+1]),r[o+2]=t[o+2];return a.fromRadiansArrayHeights(r,e,n)},a.fromRadiansArrayHeights=function(t,n,r){var i=t.length;e(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)};return a.fromRadians=function(n,r,i,o){return i=t(i,0),e(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(t,e,n,r){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},a.equalsEpsilon=function(t,n,r){return t===n||e(t)&&e(n)&&Math.abs(t.longitude-n.longitude)<=r&&Math.abs(t.latitude-n.latitude)<=r&&Math.abs(t.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var e={},n=function(n,r){t(e[n])||(e[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(e,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),e._radii=new t(r,i,a),e._radiiSquared=new t(r*r,i*i,a*a),e._radiiToTheFourth=new t(r*r*r*r,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(r,i,a),e._maximumRadius=Math.max(r,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,n){if(!r(e))return void 0;var i=e._radii;return r(n)?(t.clone(i,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return r(e)||(e=new c),r(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,r,i){i=n(i,0),t.pack(e._radii,r,i)},c.unpack=function(e,r,i){r=n(r,0);var a=t.unpack(e,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,n){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(e,n){return r(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;c.prototype.cartographicToCartesian=function(e,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),r(n)||(n=new t),t.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var h=new t,d=new t,m=new t;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=t.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(t.dot(s,n))*t.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new e(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,n){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),E=t.multiplyByScalar(e,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?t.clone(E,n):void 0;var g=this._oneOverRadiiSquared,x=g.x,M=g.y,z=g.z,S=p;S.x=2*E.x*x,S.y=2*E.y*M,S.z=2*E.z*z;var O,T,R,_,I,N,b,P,A,C,L,q=(1-w)*t.magnitude(e)/(.5*t.magnitude(S)),U=0;do{q-=U,R=1/(1+q*x),_=1/(1+q*M),I=1/(1+q*z),N=R*R,b=_*_,P=I*I,A=N*R,C=b*_,L=P*I,O=h*N+d*b+m*P-1,T=h*A*x+d*C*M+m*L*z;var B=-2*T;U=O/B}while(Math.abs(O)>u.EPSILON12);return r(n)?(n.x=i*R,n.y=a*_,n.z=o*I,n):new t(i*R,a*_,o*I)},c.prototype.scaleToGeocentricSurface=function(e,n){r(n)||(n=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,n)},c.prototype.transformPositionToScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._radii,n)},c.prototype.equals=function(e){return this===e||r(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";var u=function(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var e={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(e)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var e=function(e,n){this.start=t(e,0),this.stop=t(n,0)};return e}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)};a.fromElements=function(t,n,r,i,o){return e(o)?(o.x=t,o.y=n,o.z=r,o.w=i,o):new a(t,n,r,i)},a.fromColor=function(t,n){return e(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new a(t.red,t.green,t.blue,t.alpha)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new a(t.x,t.y,t.z,t.w):void 0},a.packedLength=4,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n.w=Math.min(t.w,e.w),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n.w=Math.max(t.w,e.w),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e.w=t.w/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n.w=t.w*e.w,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n.w=t.w+e.w,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n.w=t.w-e.w,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n.w=t.w*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n.w=t.w/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e.w=Math.abs(t.w),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,s);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]&&t.w===e[n+3]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)&&i.equalsEpsilon(t.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t){for(var e=0,n=0;9>n;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function u(t){for(var e=0,n=0;3>n;++n){var r=t[c.getElementIndex(d[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function s(t,e){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(t[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(t[c.getElementIndex(m,f)])>n){var y,p=t[c.getElementIndex(m,m)],v=t[c.getElementIndex(f,f)],w=t[c.getElementIndex(m,f)],E=(p-v)/2/w;y=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),s=1/Math.sqrt(1+y*y),l=y*s}return e=c.clone(c.IDENTITY,e),e[c.getElementIndex(f,f)]=e[c.getElementIndex(m,m)]=s,e[c.getElementIndex(m,f)]=l,e[c.getElementIndex(f,m)]=-l,e}var c=function(t,n,r,i,a,o,u,s,c){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(u,0),this[3]=e(n,0),this[4]=e(a,0),this[5]=e(s,0),this[6]=e(r,0),this[7]=e(o,0),this[8]=e(c,0)};c.packedLength=9,c.pack=function(t,n,r){r=e(r,0),n[r++]=t[0],n[r++]=t[1],n[r++]=t[2],n[r++]=t[3],n[r++]=t[4],n[r++]=t[5],n[r++]=t[6],n[r++]=t[7],n[r++]=t[8]},c.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r++],i[1]=t[r++],i[2]=t[r++],i[3]=t[r++],i[4]=t[r++],i[5]=t[r++],i[6]=t[r++],i[7]=t[r++],i[8]=t[r++],i},c.clone=function(t,e){return n(t)?n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new c(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},c.fromArray=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r],i[1]=t[r+1],i[2]=t[r+2],i[3]=t[r+3],i[4]=t[r+4],i[5]=t[r+5],i[6]=t[r+6],i[7]=t[r+7],i[8]=t[r+8],i},c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},c.fromQuaternion=function(t,e){var r=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,s=t.y*t.z,l=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,E=2*(s-o),g=2*(a-l),x=2*(s+o),M=-r-u+f+d;return n(e)?(e[0]=m,e[1]=v,e[2]=g,e[3]=y,e[4]=w,e[5]=x,e[6]=p,e[7]=E,e[8]=M,e):new c(m,y,p,v,w,E,g,x,M)},c.fromScale=function(t,e){return n(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new c(t.x,0,0,0,t.y,0,0,0,t.z)},c.fromUniformScale=function(t,e){return n(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new c(t,0,0,0,t,0,0,0,t)},c.fromCrossProduct=function(t,e){return n(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new c(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},c.fromRotationX=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=r,e[5]=i,e[6]=0,e[7]=-i,e[8]=r,e):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=r,e):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},c.getElementIndex=function(t,e){return 3*t+e},c.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;c.getMaximumScale=function(e){return c.getScale(e,f),t.maximumComponent(f)},c.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],l=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],f=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},c.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},c.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],l=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=l,e};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(t,e){var r=a.EPSILON20,i=10,l=0,f=0;n(e)||(e={});for(var h=e.unitary=c.clone(c.IDENTITY,e.unitary),d=e.diagonal=c.clone(t,e.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},c.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(t,e){var n=t[0],i=t[1],o=t[2],u=t[3],s=t[4],l=t[5],f=t[6],h=t[7],d=t[8],m=c.determinant(t);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");e[0]=s*d-h*l,e[1]=h*o-i*d,e[2]=i*l-s*o,e[3]=f*l-u*d,e[4]=n*d-f*o,e[5]=u*o-n*l,e[6]=u*h-f*s,e[7]=f*i-n*h,e[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(e,y,e)},c.equals=function(t,e){return t===e||n(t)&&n(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},c.equalsEpsilon=function(t,e,r){return t===e||n(t)&&n(e)&&Math.abs(t[0]-e[0])<=r&&Math.abs(t[1]-e[1])<=r&&Math.abs(t[2]-e[2])<=r&&Math.abs(t[3]-e[3])<=r&&Math.abs(t[4]-e[4])<=r&&Math.abs(t[5]-e[5])<=r&&Math.abs(t[6]-e[6])<=r&&Math.abs(t[7]-e[7])<=r&&Math.abs(t[8]-e[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var e=function(t){this.name="RuntimeError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,e,n,r,i,a,o,u,s){"use strict";var c=function(t,e,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(t,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(e,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(t,e,r){r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e[r++]=t[9],e[r++]=t[10],e[r++]=t[11],e[r++]=t[12],e[r++]=t[13],e[r++]=t[14],e[r]=t[15]},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},c.clone=function(t,e){return r(t)?r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):new c(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},c.fromRotationTranslation=function(e,i,a){return i=n(i,t.ZERO),r(a)?(a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=0,a[4]=e[3],a[5]=e[4],a[6]=e[5],a[7]=0,a[8]=e[6],a[9]=e[7],a[10]=e[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(e[0],e[3],e[6],i.x,e[1],e[4],e[7],i.y,e[2],e[5],e[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(t,e,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=e.x*e.x,l=e.x*e.y,f=e.x*e.z,h=e.x*e.w,d=e.y*e.y,m=e.y*e.z,y=e.y*e.w,p=e.z*e.z,v=e.z*e.w,w=e.w*e.w,E=s-d-p+w,g=2*(l-v),x=2*(f+y),M=2*(l+v),z=-s+d-p+w,S=2*(m-h),O=2*(f-y),T=2*(m+h),R=-s-d+p+w;return i[0]=E*a,i[1]=M*a,i[2]=O*a,i[3]=0,i[4]=g*o,i[5]=z*o,i[6]=T*o,i[7]=0,i[8]=x*u,i[9]=S*u,i[10]=R*u,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i},c.fromTranslation=function(t,e){return c.fromRotationTranslation(u.IDENTITY,t,e)},c.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},c.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var l=new t,f=new t,h=new t;c.fromCamera=function(e,n){var i=e.eye,a=e.target,o=e.up;t.normalize(t.subtract(a,i,l),l),t.normalize(t.cross(l,o,f),f),t.normalize(t.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,E=h.z,g=i.x,x=i.y,M=i.z,z=u*-g+s*-x+d*-M,S=v*-g+w*-x+E*-M,O=m*g+y*x+p*M;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=E,n[10]=-p,n[11]=0,n[12]=z,n[13]=S,n[14]=O,n[15]=1,n):new c(u,s,d,z,v,w,E,S,-m,-y,-p,O,0,0,0,1)},c.computePerspectiveFieldOfView=function(t,e,n,r,i){var a=Math.tan(.5*t),o=1/a,u=o/e,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(t,e,n,r,i,a,o){var u=1/(e-t),s=1/(r-n),c=1/(a-i),l=-(e+t)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(t,e,n,r,i,a,o){var u=2*i/(e-t),s=2*i/(r-n),c=(e+t)/(e-t),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(t,e,n,r,i,a){var o=2*i/(e-t),u=2*i/(r-n),s=(e+t)/(e-t),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(t,e,r,i){t=n(t,n.EMPTY_OBJECT);var a=n(t.x,0),o=n(t.y,0),u=n(t.width,0),s=n(t.height,0);e=n(e,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-e),h=c,d=l,m=f,y=a+c,p=o+l,v=e+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},c.getElementIndex=function(t,e){return 4*t+e},c.getColumn=function(t,e,n){var r=4*e,i=t[r],a=t[r+1],o=t[r+2],u=t[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=4*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=t[15],n},c.getRow=function(t,e,n){var r=t[e],i=t[e+4],a=t[e+8],o=t[e+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+4]=n.y,r[e+8]=n.z,r[e+12]=n.w,r};var d=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],d)),n.y=t.magnitude(t.fromElements(e[4],e[5],e[6],d)),n.z=t.magnitude(t.fromElements(e[8],e[9],e[10],d)),n};var m=new t;c.getMaximumScale=function(e){return c.getScale(e,m),t.maximumComponent(m)},c.multiply=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[3],u=t[4],s=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],p=t[13],v=t[14],w=t[15],E=e[0],g=e[1],x=e[2],M=e[3],z=e[4],S=e[5],O=e[6],T=e[7],R=e[8],_=e[9],I=e[10],N=e[11],b=e[12],P=e[13],A=e[14],C=e[15],L=r*E+u*g+f*x+y*M,q=i*E+s*g+h*x+p*M,U=a*E+c*g+d*x+v*M,B=o*E+l*g+m*x+w*M,D=r*z+u*S+f*O+y*T,W=i*z+s*S+h*O+p*T,F=a*z+c*S+d*O+v*T,k=o*z+l*S+m*O+w*T,G=r*R+u*_+f*I+y*N,V=i*R+s*_+h*I+p*N,Y=a*R+c*_+d*I+v*N,j=o*R+l*_+m*I+w*N,Z=r*b+u*P+f*A+y*C,H=i*b+s*P+h*A+p*C,X=a*b+c*P+d*A+v*C,K=o*b+l*P+m*A+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=B,n[4]=D,n[5]=W,n[6]=F,n[7]=k,n[8]=G,n[9]=V,n[10]=Y,n[11]=j,n[12]=Z,n[13]=H,n[14]=X,n[15]=K,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n[9]=t[9]+e[9],n[10]=t[10]+e[10],n[11]=t[11]+e[11],n[12]=t[12]+e[12],n[13]=t[13]+e[13],n[14]=t[14]+e[14],n[15]=t[15]+e[15],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n[9]=t[9]-e[9],n[10]=t[10]-e[10],n[11]=t[11]-e[11],n[12]=t[12]-e[12],n[13]=t[13]-e[13],n[14]=t[14]-e[14],n[15]=t[15]-e[15],n},c.multiplyTransformation=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=t[12],d=t[13],m=t[14],y=e[0],p=e[1],v=e[2],w=e[4],E=e[5],g=e[6],x=e[8],M=e[9],z=e[10],S=e[12],O=e[13],T=e[14],R=r*y+o*p+c*v,_=i*y+u*p+l*v,I=a*y+s*p+f*v,N=r*w+o*E+c*g,b=i*w+u*E+l*g,P=a*w+s*E+f*g,A=r*x+o*M+c*z,C=i*x+u*M+l*z,L=a*x+s*M+f*z,q=r*S+o*O+c*T+h,U=i*S+u*O+l*T+d,B=a*S+s*O+f*T+m;return n[0]=R,n[1]=_,n[2]=I,n[3]=0,n[4]=N,n[5]=b,n[6]=P,n[7]=0,n[8]=A,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=B,n[15]=1,n},c.multiplyByMatrix3=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=e[0],d=e[1],m=e[2],y=e[3],p=e[4],v=e[5],w=e[6],E=e[7],g=e[8],x=r*h+o*d+c*m,M=i*h+u*d+l*m,z=a*h+s*d+f*m,S=r*y+o*p+c*v,O=i*y+u*p+l*v,T=a*y+s*p+f*v,R=r*w+o*E+c*g,_=i*w+u*E+l*g,I=a*w+s*E+f*g;return n[0]=x,n[1]=M,n[2]=z,n[3]=0,n[4]=S,n[5]=O,n[6]=T,n[7]=0,n[8]=R,n[9]=_,n[10]=I,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},c.multiplyByTranslation=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=r*t[0]+i*t[4]+a*t[8]+t[12],u=r*t[1]+i*t[5]+a*t[9]+t[13],s=r*t[2]+i*t[6]+a*t[10]+t[14];return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=o,n[13]=u,n[14]=s,n[15]=t[15],n};var y=new t;c.multiplyByUniformScale=function(t,e,n){return y.x=e,y.y=e,y.z=e,c.multiplyByScale(t,y,n)},c.multiplyByScale=function(t,e,n){var r=e.x,i=e.y,a=e.z;return 1===r&&1===i&&1===a?c.clone(t,n):(n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=0,n[4]=i*t[4],n[5]=i*t[5],n[6]=i*t[6],n[7]=0,n[8]=a*t[8],n[9]=a*t[9],n[10]=a*t[10],n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=1,n)},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t[0]*r+t[4]*i+t[8]*a+t[12]*o,s=t[1]*r+t[5]*i+t[9]*a+t[13]*o,c=t[2]*r+t[6]*i+t[10]*a+t[14]*o,l=t[3]*r+t[7]*i+t[11]*a+t[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a,u=t[1]*r+t[5]*i+t[9]*a,s=t[2]*r+t[6]*i+t[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a+t[12],u=t[1]*r+t[5]*i+t[9]*a+t[13],s=t[2]*r+t[6]*i+t[10]*a+t[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n[9]=t[9]*e,n[10]=t[10]*e,n[11]=t[11]*e,n[12]=t[12]*e,n[13]=t[13]*e,n[14]=t[14]*e,n[15]=t[15]*e,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},c.transpose=function(t,e){var n=t[1],r=t[2],i=t[3],a=t[6],o=t[7],u=t[11];return e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[10]=t[10],e[11]=t[14],e[12]=i,e[13]=o,e[14]=u,e[15]=t[15],e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e[9]=Math.abs(t[9]),e[10]=Math.abs(t[10]),e[11]=Math.abs(t[11]),e[12]=Math.abs(t[12]),e[13]=Math.abs(t[13]),e[14]=Math.abs(t[14]),e[15]=Math.abs(t[15]),e},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[3]===e[3]&&t[7]===e[7]&&t[11]===e[11]&&t[15]===e[15]},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n&&Math.abs(t[9]-e[9])<=n&&Math.abs(t[10]-e[10])<=n&&Math.abs(t[11]-e[11])<=n&&Math.abs(t[12]-e[12])<=n&&Math.abs(t[13]-e[13])<=n&&Math.abs(t[14]-e[14])<=n&&Math.abs(t[15]-e[15])<=n},c.getTranslation=function(t,e){return e.x=t[12],e.y=t[13],e.z=t[14],e},c.getRotation=function(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e};var p=new u,v=new u,w=new e,E=new e(0,0,0,1);return c.inverse=function(t,n){if(u.equalsEpsilon(c.getRotation(t,p),v,o.EPSILON7)&&e.equals(c.getRow(t,3,w),E))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-t[12],n[13]=-t[13],n[14]=-t[14],n[15]=1,n;var r=t[0],i=t[4],a=t[8],l=t[12],f=t[1],h=t[5],d=t[9],m=t[13],y=t[2],g=t[6],x=t[10],M=t[14],z=t[3],S=t[7],O=t[11],T=t[15],R=x*T,_=M*O,I=g*T,N=M*S,b=g*O,P=x*S,A=y*T,C=M*z,L=y*O,q=x*z,U=y*S,B=g*z,D=R*h+N*d+b*m-(_*h+I*d+P*m),W=_*f+A*d+q*m-(R*f+C*d+L*m),F=I*f+C*h+U*m-(N*f+A*h+B*m),k=P*f+L*h+B*d-(b*f+q*h+U*d),G=_*i+I*a+P*l-(R*i+N*a+b*l),V=R*r+C*a+L*l-(_*r+A*a+q*l),Y=N*r+A*i+B*l-(I*r+C*i+U*l),j=b*r+q*i+U*a-(P*r+L*i+B*a);R=a*m,_=l*d,I=i*m,N=l*h,b=i*d,P=a*h,A=r*m,C=l*f,L=r*d,q=a*f,U=r*h,B=i*f;var Z=R*S+N*O+b*T-(_*S+I*O+P*T),H=_*z+A*O+q*T-(R*z+C*O+L*T),X=I*z+C*S+U*T-(N*z+A*S+B*T),K=P*z+L*S+B*O-(b*z+q*S+U*O),J=I*x+P*M+_*g-(b*M+R*g+N*x),Q=L*M+R*y+C*x-(A*x+q*M+_*y),$=A*g+B*M+N*y-(U*M+I*y+C*g),te=U*x+b*y+q*g-(L*g+B*x+P*y),ee=r*D+i*W+a*F+l*k;if(Math.abs(ee)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return ee=1/ee,n[0]=D*ee,n[1]=W*ee,n[2]=F*ee,n[3]=k*ee,n[4]=G*ee,n[5]=V*ee,n[6]=Y*ee,n[7]=j*ee,n[8]=Z*ee,n[9]=H*ee,n[10]=X*ee,n[11]=K*ee,n[12]=J*ee,n[13]=Q*ee,n[14]=$*ee,n[15]=te*ee,n},c.inverseTransformation=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],u=t[6],s=t[8],c=t[9],l=t[10],f=t[12],h=t[13],d=t[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return e[0]=n,e[1]=a,e[2]=s,e[3]=0,e[4]=r,e[5]=o,e[6]=c,e[7]=0,e[8]=i,e[9]=u,e[10]=l,e[11]=0,e[12]=m,e[13]=y,e[14]=p,e[15]=1,e},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]&&t[9]===e[n+9]&&t[10]===e[n+10]&&t[11]===e[n+11]&&t[12]===e[n+12]&&t[13]===e[n+13]&&t[14]===e[n+14]&&t[15]===e[n+15]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e,n){this.normal=t.clone(e),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-t.dot(r,n);return e(a)?(t.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new t;return i.fromCartesian4=function(n,r){var o=t.fromCartesian4(n,a),u=n.w;return e(r)?(t.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(e,n){return t.dot(e.normal,n)+e.distance},i.ORIGIN_XY_PLANE=r(new i(t.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(t.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(t.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";var s=function(t,n,r,i){this.west=e(t,0),this.south=e(n,0),this.east=e(r,0),this.north=e(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(t,n,r){r=e(r,0),n[r++]=t.west,n[r++]=t.south,n[r++]=t.east,n[r]=t.north},s.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new s),i.west=t[r++],i.south=t[r++],i.east=t[r++],i.north=t[r],i},s.computeWidth=function(t){var e=t.east,n=t.west;return n>e&&(e+=u.TWO_PI),e-n},s.computeHeight=function(t){return t.north-t.south},s.fromDegrees=function(t,r,i,a,o){return t=u.toRadians(e(t,0)),r=u.toRadians(e(r,0)),i=u.toRadians(e(i,0)),a=u.toRadians(e(a,0)),n(o)?(o.west=t,o.south=r,o.east=i,o.north=a,o):new s(t,r,i,a)},s.fromCartographicArray=function(t,e){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=t.length;c>u;u++){var l=t[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(e)?(e.west=r,e.south=a,e.east=i,e.north=o,e):new s(r,a,i,o)},s.clone=function(t,e){return n(t)?n(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north):void 0},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||n(t)&&n(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return n(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(){},s.southwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.south,r.height=0,r):new t(e.west,e.south)},s.northwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.north,r.height=0,r):new t(e.west,e.north)},s.northeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.north,r.height=0,r):new t(e.east,e.north)},s.southeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.south,r.height=0,r):new t(e.east,e.south)},s.center=function(e,r){var i=e.east,a=e.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(e.south+e.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new t(o,s)},s.intersection=function(t,e,r){var i=t.east,a=t.west,o=e.east,c=e.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((t.west<t.east||e.west<e.east)&&l>=f)return void 0;var h=Math.max(t.south,e.south),d=Math.min(t.north,e.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(t,e){var n=e.longitude,r=e.latitude,i=t.west,a=t.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,r,i,o){r=e(r,a.WGS84),i=e(i,0),n(o)||(o=[]);var l=0,f=t.north,h=t.south,d=t.east,m=t.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(t,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,r){this.center=t.clone(n(e,t.ZERO)),this.radius=n(r,0)},m=new t,y=new t,p=new t,v=new t,w=new t,E=new t,g=new t,x=new t,M=new t,z=new t,S=new t,O=new t;d.fromPoints=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;for(var i=t.clone(e[0],g),a=t.clone(i,m),o=t.clone(i,y),u=t.clone(i,p),s=t.clone(i,v),c=t.clone(i,w),l=t.clone(i,E),f=e.length,h=1;f>h;h++){t.clone(e[h],i);var T=i.x,R=i.y,_=i.z;T<a.x&&t.clone(i,a),T>s.x&&t.clone(i,s),R<o.y&&t.clone(i,o),R>c.y&&t.clone(i,c),_<u.z&&t.clone(i,u),_>l.z&&t.clone(i,l)}var I=t.magnitudeSquared(t.subtract(s,a,x)),N=t.magnitudeSquared(t.subtract(c,o,x)),b=t.magnitudeSquared(t.subtract(l,u,x)),P=a,A=s,C=I;N>C&&(C=N,P=o,A=c),b>C&&(C=b,P=u,A=l);var L=M;L.x=.5*(P.x+A.x),L.y=.5*(P.y+A.y),L.z=.5*(P.z+A.z);var q=t.magnitudeSquared(t.subtract(A,L,x)),U=Math.sqrt(q),B=z;B.x=a.x,B.y=o.y,B.z=u.z;var D=S;D.x=s.x,D.y=c.y,D.z=l.z;var W=t.multiplyByScalar(t.add(B,D,x),.5,O),F=0;for(h=0;f>h;h++){t.clone(e[h],i);var k=t.magnitude(t.subtract(i,W,x));k>F&&(F=k);var G=t.magnitudeSquared(t.subtract(i,L,x));if(G>q){var V=Math.sqrt(G);U=.5*(U+V),q=U*U;var Y=V-U;L.x=(U*L.x+Y*i.x)/V,L.y=(U*L.y+Y*i.y)/V,L.z=(U*L.z+Y*i.z)/V}}return F>U?(t.clone(L,n.center),n.radius=U):(t.clone(W,n.center),n.radius=F),n};var T=new u,R=new t,_=new t,I=new e,N=new e;d.fromRectangle2D=function(t,e,n){return d.fromRectangleWithHeights2D(t,e,0,0,n)},d.fromRectangleWithHeights2D=function(e,i,a,o,u){if(r(u)||(u=new d),!r(e))return u.center=t.clone(t.ZERO,u.center),u.radius=0,u;i=n(i,T),h.southwest(e,I),I.height=a,h.northeast(e,N),N.height=o;var s=i.project(I,R),c=i.project(N,_),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var b=[];d.fromRectangle3D=function(t,e,i,a){e=n(e,o.WGS84),i=n(i,0);var u;return r(t)&&(u=h.subsample(t,e,i,b)),d.fromPoints(u,a)},d.fromVertices=function(e,i,a,o){if(r(o)||(o=new d),!r(e)||0===e.length)return o.center=t.clone(t.ZERO,o.center),o.radius=0,o;i=n(i,t.ZERO),a=n(a,3);var u=g;u.x=e[0]+i.x,u.y=e[1]+i.y,u.z=e[2]+i.z;for(var s=t.clone(u,m),c=t.clone(u,y),l=t.clone(u,p),f=t.clone(u,v),h=t.clone(u,w),T=t.clone(u,E),R=e.length,_=0;R>_;_+=a){var I=e[_]+i.x,N=e[_+1]+i.y,b=e[_+2]+i.z;u.x=I,u.y=N,u.z=b,I<s.x&&t.clone(u,s),I>f.x&&t.clone(u,f),N<c.y&&t.clone(u,c),N>h.y&&t.clone(u,h),b<l.z&&t.clone(u,l),b>T.z&&t.clone(u,T)}var P=t.magnitudeSquared(t.subtract(f,s,x)),A=t.magnitudeSquared(t.subtract(h,c,x)),C=t.magnitudeSquared(t.subtract(T,l,x)),L=s,q=f,U=P;A>U&&(U=A,L=c,q=h),C>U&&(U=C,L=l,q=T);var B=M;B.x=.5*(L.x+q.x),B.y=.5*(L.y+q.y),B.z=.5*(L.z+q.z);var D=t.magnitudeSquared(t.subtract(q,B,x)),W=Math.sqrt(D),F=z;F.x=s.x,F.y=c.y,F.z=l.z;var k=S;k.x=f.x,k.y=h.y,k.z=T.z;var G=t.multiplyByScalar(t.add(F,k,x),.5,O),V=0;for(_=0;R>_;_+=a){u.x=e[_]+i.x,u.y=e[_+1]+i.y,u.z=e[_+2]+i.z;var Y=t.magnitude(t.subtract(u,G,x));Y>V&&(V=Y);var j=t.magnitudeSquared(t.subtract(u,B,x));if(j>D){var Z=Math.sqrt(j);W=.5*(W+Z),D=W*W;var H=Z-W;B.x=(W*B.x+H*u.x)/Z,B.y=(W*B.y+H*u.y)/Z,B.z=(W*B.z+H*u.z)/Z}}return V>W?(t.clone(B,o.center),o.radius=W):(t.clone(G,o.center),o.radius=V),o},d.fromCornerPoints=function(e,n,i){r(i)||(i=new d);var a=i.center;return t.add(e,n,a),t.multiplyByScalar(a,.5,a),i.radius=t.distance(a,n),i},d.fromEllipsoid=function(e,n){return r(n)||(n=new d),t.clone(t.ZERO,n.center),n.radius=e.maximumRadius,n};var P=new t;d.fromBoundingSpheres=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var i=e.length;if(1===i)return d.clone(e[0],n);if(2===i)return d.union(e[0],e[1],n);for(var a=[],o=0;i>o;o++)a.push(e[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=e[o];s=Math.max(s,t.distance(u,c.center,P)+c.radius)}return n.radius=s,n},d.clone=function(e,n){return r(e)?r(n)?(n.center=t.clone(e.center,n.center),n.radius=e.radius,n):new d(e.center,e.radius):void 0},d.packedLength=4,d.pack=function(t,e,r){r=n(r,0);var i=t.center;e[r++]=i.x,e[r++]=i.y,e[r++]=i.z,e[r]=t.radius},d.unpack=function(t,e,i){e=n(e,0),r(i)||(i=new d);var a=i.center;return a.x=t[e++],a.y=t[e++],a.z=t[e++],i.radius=t[e],i};var A=new t,C=new t;d.union=function(e,n,i){r(i)||(i=new d);var a=e.center,o=e.radius,u=n.center,s=n.radius,c=t.subtract(u,a,A),l=t.magnitude(c);if(o>=l+s)return e.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=t.multiplyByScalar(c,(-o+f)/l,C);return t.add(h,a,h),t.clone(h,i.center),i.radius=f,i};var L=new t;d.expand=function(e,n,r){r=d.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new t,0);d.intersect=function(t,e){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(e,q);return d.intersectPlane(t,n)},d.transform=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=l.getMaximumScale(e)*t.radius,n};var U=new t;d.distanceSquaredTo=function(e,n){var r=t.subtract(e.center,n,U);return t.magnitudeSquared(r)-e.radius*e.radius},d.transformWithoutScale=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=t.radius,n};var B=new t;d.computePlaneDistances=function(e,n,i,a){r(a)||(a=new c);var o=t.subtract(e.center,n,B),u=t.multiplyByScalar(i,t.dot(i,o),B),s=t.magnitude(u);return a.start=s-e.radius,a.stop=s+e.radius,a};for(var D=new t,W=new t,F=new t,k=new t,G=new t,V=new e,Y=new Array(8),j=0;8>j;++j)Y[j]=new t;var Z=new u;return d.projectTo2D=function(e,r,i){r=n(r,Z);var a=r.ellipsoid,o=e.center,u=e.radius,s=a.geodeticSurfaceNormal(o,D),c=t.cross(t.UNIT_Z,s,W);t.normalize(c,c);var l=t.cross(s,c,F);t.normalize(l,l),t.multiplyByScalar(s,u,s),t.multiplyByScalar(l,u,l),t.multiplyByScalar(c,u,c);var f=t.negate(l,G),h=t.negate(c,k),m=Y,y=m[0];t.add(s,l,y),t.add(y,c,y),y=m[1],t.add(s,l,y),t.add(y,h,y),y=m[2],t.add(s,f,y),t.add(y,h,y),y=m[3],t.add(s,f,y),t.add(y,c,y),t.negate(s,s),y=m[4],t.add(s,l,y),t.add(y,c,y),y=m[5],t.add(s,l,y),t.add(y,h,y),y=m[6],t.add(s,f,y),t.add(y,h,y),y=m[7],t.add(s,f,y),t.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];t.add(o,w,w);var E=a.cartesianToCartographic(w,V);r.project(E,w)}i=d.fromPoints(m,i),o=i.center;var g=o.x,x=o.y,M=o.z;return o.x=M,o.y=g,o.z=x,i},d.equals=function(e,n){return e===n||r(e)&&r(n)&&t.equals(e.center,n.center)&&e.radius===n.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,e){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return e(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(t(n))return n;n=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof e[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof e[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",t(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",t(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",t(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",t(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(t){i.supportsFullscreen()&&t[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,e,n){"use strict";function r(t){for(var e=t.split("."),n=0,r=e.length;r>n;++n)e[n]=parseInt(e[n],10);return e}function i(){if(!e(p)){p=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(p=!0,v=r(t[1]))}return p}function a(){return i()&&v}function o(){if(!e(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(w=!0,E=r(t[1]))}return w}function u(){return o()&&E}function s(){if(!e(g)){g=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(g=!0,x=r(t[1]),x.isNightly=!!t[2])}return g}function c(){return s()&&x}function l(){if(!e(M)){M=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(M=!0,z=r(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(M=!0,z=r(t[1])))}return M}function f(){return l()&&z}function h(){if(!e(S)){S=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(S=!0,O=r(t[1]))}return S}function d(){return e(T)||(T=/Windows/i.test(navigator.appVersion)),T}function m(){return h()&&O}function y(){return e(R)||(R=e(window.PointerEvent)&&(!e(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),R}var p,v,w,E,g,x,M,z,S,O,T,R,_={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return _.supportsFullscreen=function(){return n.supportsFullscreen()},_.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},_.supportsWebWorkers=function(){return"undefined"!=typeof Worker},_}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,e,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(t){switch(t){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(t){return t instanceof Int8Array?a.BYTE:t instanceof Uint8Array?a.UNSIGNED_BYTE:t instanceof Int16Array?a.SHORT:t instanceof Uint16Array?a.UNSIGNED_SHORT:t instanceof Float32Array?a.FLOAT:t instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(t){return e(t)&&(t===a.BYTE||t===a.UNSIGNED_BYTE||t===a.SHORT||t===a.UNSIGNED_SHORT||t===a.FLOAT||t===a.DOUBLE)},a.createTypedArray=function(t,e){switch(t){case a.BYTE:return new Int8Array(e);case a.UNSIGNED_BYTE:return new Uint8Array(e);case a.SHORT:return new Int16Array(e);case a.UNSIGNED_SHORT:return new Uint16Array(e);case a.FLOAT:return new Float32Array(e);case a.DOUBLE:return new Float64Array(e);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(e,r,i,o){switch(i=t(i,0),o=t(o,(r.byteLength-i)/a.getSizeInBytes(e)),e){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var e={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(e)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===e.POINTS||t===e.LINES||t===e.LINE_LOOP||t===e.LINE_STRIP||t===e.TRIANGLES||t===e.TRIANGLE_STRIP||t===e.TRIANGLE_FAN}};return t(e)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,e,n,r,i){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=t(e.primitiveType,i.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=t(e.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(t){var r=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&e(t.attributes[i])&&e(t.attributes[i].values)){var a=t.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=t(e.normalize,!1),this.values=e.values};return e}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color};return e}),define("Core/BoxOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Geometry","./GeometryAttribute","./GeometryAttributes","./PrimitiveType"],function(t,e,n,r,i,a,o,u,s,c){"use strict";var l=new e,f=function(t){t=r(t,r.EMPTY_OBJECT);var n=t.minimumCorner,i=t.maximumCorner;this._min=e.clone(n),this._max=e.clone(i),this._workerName="createBoxOutlineGeometry"};f.fromDimensions=function(t){t=r(t,r.EMPTY_OBJECT);var n=t.dimensions,i=e.multiplyByScalar(n,.5,new e),a=e.negate(i,new e),o=i,u={minimumCorner:a,maximumCorner:o};return new f(u)},f.packedLength=2*e.packedLength,f.pack=function(t,n,i){i=r(i,0),e.pack(t._min,n,i),e.pack(t._max,n,i+e.packedLength)};var h=new e,d=new e,m={minimumCorner:h,maximumCorner:d};return f.unpack=function(t,n,a){n=r(n,0);var o=e.unpack(t,n,h),u=e.unpack(t,n+e.packedLength,d);return i(a)?(a._min=e.clone(o,a._min),a._max=e.clone(u,a._max),a):new f(m)},f.createGeometry=function(r){var i=r._min,a=r._max,f=new s,h=new Uint16Array(24),d=new Float64Array(24);d[0]=i.x,d[1]=i.y,d[2]=i.z,d[3]=a.x,d[4]=i.y,d[5]=i.z,d[6]=a.x,d[7]=a.y,d[8]=i.z,d[9]=i.x,d[10]=a.y,d[11]=i.z,d[12]=i.x,d[13]=i.y,d[14]=a.z,d[15]=a.x,d[16]=i.y,d[17]=a.z,d[18]=a.x,d[19]=a.y,d[20]=a.z,d[21]=i.x,d[22]=a.y,d[23]=a.z,f.position=new u({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:d}),h[0]=4,h[1]=5,h[2]=5,h[3]=6,h[4]=6,h[5]=7,h[6]=7,h[7]=4,h[8]=0,h[9]=1,h[10]=1,h[11]=2,h[12]=2,h[13]=3,h[14]=3,h[15]=0,h[16]=0,h[17]=4,h[18]=1,h[19]=5,h[20]=2,h[21]=6,h[22]=3,h[23]=7;var m=e.subtract(a,i,l),y=.5*e.magnitude(m);return new o({attributes:f,indices:h,primitiveType:c.LINES,boundingSphere:new t(e.ZERO,y)})},f}),define("Workers/createBoxOutlineGeometry",["../Core/BoxOutlineGeometry","../Core/defined"],function(t,e){"use strict";return function(n,r){return e(r)&&(n=t.unpack(n,r)),t.createGeometry(n)}})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createCircleGeometry.js b/libs/Cesium/Workers/createCircleGeometry.js deleted file mode 100644 index 999d2f9d..00000000 --- a/libs/Cesium/Workers/createCircleGeometry.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(e){return e>0?1:0>e?-1:0},r.signNotZero=function(e){return 0>e?-1:1},r.toSNorm=function(e){return Math.round(255*(.5*r.clamp(e,-1,1)+.5))},r.fromSNorm=function(e){return 2*(r.clamp(e,0,255)/255)-1},r.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},r.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},r.lerp=function(e,t,r){return(1-r)*e+r*t},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(e){return e*r.RADIANS_PER_DEGREE},r.toDegrees=function(e){return e*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(e){var t=r.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},r.negativePiToPi=function(e){return r.zeroToTwoPi(e+r.PI)-r.PI},r.zeroToTwoPi=function(e){var t=r.mod(e,r.TWO_PI);return Math.abs(t)<r.EPSILON14&&Math.abs(e)>r.EPSILON14?r.TWO_PI:t},r.mod=function(e,t){return(e%t+t)%t},r.equalsEpsilon=function(e,r,n,i){i=t(i,n);var a=Math.abs(e-r);return i>=a||a<=n*Math.max(Math.abs(e),Math.abs(r))};var n=[1];r.factorial=function(e){var t=n.length;if(e>=t)for(var r=n[t-1],i=t;e>=i;i++)n.push(r*i);return n[e]},r.incrementWrap=function(e,r,n){return n=t(n,0),++e,e>r&&(e=n),e},r.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},r.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},r.clamp=function(e,t,r){return t>e?t:e>r?r:e};var i=new e;return r.setRandomNumberSeed=function(t){i=new e(t)},r.nextRandomNumber=function(){return i.random()},r.acosClamped=function(e){return Math.acos(r.clamp(e,-1,1))},r.asinClamped=function(e){return Math.asin(r.clamp(e,-1,1))},r.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},r}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i){"use strict";var a=function(t,r,n){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0)};a.fromSpherical=function(r,n){t(n)||(n=new a);var i=r.clock,o=r.cone,u=e(r.magnitude,1),s=u*Math.sin(o);return n.x=s*Math.cos(i),n.y=s*Math.sin(i),n.z=u*Math.cos(o),n},a.fromElements=function(e,r,n,i){return t(i)?(i.x=e,i.y=r,i.z=n,i):new a(e,r,n)},a.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n]=t.z},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.x=r[n++],i.y=r[n++],i.z=r[n],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r},a.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var r=a.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},a.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r},a.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r},a.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r},a.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r},a.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new a;a.lerp=function(e,t,r,n){return a.multiplyByScalar(t,r,u),n=a.multiplyByScalar(e,1-r,n),a.add(u,n,n)};var s=new a,c=new a;a.angleBetween=function(e,t){a.normalize(e,s),a.normalize(t,c);var r=a.dot(s,c),n=a.magnitude(a.cross(s,c,s));return Math.atan2(n,r)};var l=new a;a.mostOrthogonalAxis=function(e,t){var r=a.normalize(e,l);return a.abs(r,r),t=r.x<=r.y?r.x<=r.z?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Z,t):r.y<=r.z?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_Z,t)},a.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z},a.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},a.equalsEpsilon=function(e,r,n,a){return e===r||t(e)&&t(r)&&i.equalsEpsilon(e.x,r.x,n,a)&&i.equalsEpsilon(e.y,r.y,n,a)&&i.equalsEpsilon(e.z,r.z,n,a)},a.cross=function(e,t,r){var n=e.x,i=e.y,a=e.z,o=t.x,u=t.y,s=t.z,c=i*s-a*u,l=a*o-n*s,f=n*u-i*o;return r.x=c,r.y=l,r.z=f,r},a.fromDegrees=function(e,t,r,n,o){var u=i.toRadians(e),s=i.toRadians(t);return a.fromRadians(u,s,r,n,o)};var f=new a,d=new a,h=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(r,n,i,o,u){i=e(i,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(n);f.x=c*Math.cos(r),f.y=c*Math.sin(r),f.z=Math.sin(n),f=a.normalize(f,f),a.multiplyComponents(s,f,d);var l=Math.sqrt(a.dot(f,d));return d=a.divideByScalar(d,l,d),f=a.multiplyByScalar(f,i,f),t(u)||(u=new a),a.add(d,f,u)},a.fromDegreesArray=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o++)n[o]=i.toRadians(e[o]);return a.fromRadiansArray(n,t,r)},a.fromRadiansArray=function(e,r,n){var i=e.length;t(n)?n.length=i/2:n=new Array(i/2);for(var o=0;i>o;o+=2){var u=e[o],s=e[o+1];n[o/2]=a.fromRadians(u,s,0,r,n[o/2])}return n},a.fromDegreesArrayHeights=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o+=3)n[o]=i.toRadians(e[o]),n[o+1]=i.toRadians(e[o+1]),n[o+2]=e[o+2];return a.fromRadiansArrayHeights(n,t,r)},a.fromRadiansArrayHeights=function(e,r,n){var i=e.length;t(n)?n.length=i/3:n=new Array(i/3);for(var o=0;i>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];n[o/3]=a.fromRadians(u,s,c,r,n[o/3])}return n},a.ZERO=n(new a(0,0,0)),a.UNIT_X=n(new a(1,0,0)),a.UNIT_Y=n(new a(0,1,0)),a.UNIT_Z=n(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,r){return a.equalsEpsilon(this,e,t,r)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i){"use strict";var a=function(t,r,n){this.longitude=e(t,0),this.latitude=e(r,0),this.height=e(n,0)};return a.fromRadians=function(r,n,i,o){return i=e(i,0),t(o)?(o.longitude=r,o.latitude=n,o.height=i,o):new a(r,n,i)},a.fromDegrees=function(e,t,r,n){return e=i.toRadians(e),t=i.toRadians(t),a.fromRadians(e,t,r,n)},a.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new a(e.longitude,e.latitude,e.height):void 0},a.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},a.equalsEpsilon=function(e,r,n){return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=n&&Math.abs(e.latitude-r.latitude)<=n&&Math.abs(e.height-r.height)<=n},a.ZERO=n(new a(0,0,0)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t){return a.equalsEpsilon(this,e,t)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},r=function(r,n){e(t[r])||(t[r]=!0,console.log(n))};return r}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i,a,o,u){"use strict";function s(t,n,i,a){n=r(n,0),i=r(i,0),a=r(a,0),t._radii=new e(n,i,a),t._radiiSquared=new e(n*n,i*i,a*a),t._radiiToTheFourth=new e(n*n*n*n,i*i*i*i,a*a*a*a),t._oneOverRadii=new e(0===n?0:1/n,0===i?0:1/i,0===a?0:1/a),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===i?0:1/(i*i),0===a?0:1/(a*a)),t._minimumRadius=Math.min(n,i,a),t._maximumRadius=Math.max(n,i,a),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,r)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,r){if(!n(t))return void 0;var i=t._radii;return n(r)?(e.clone(i,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new c(i.x,i.y,i.z)},c.fromCartesian3=function(e,t){return n(t)||(t=new c),n(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,n,i){i=r(i,0),e.pack(t._radii,n,i)},c.unpack=function(t,n,i){n=r(n,0);var a=e.unpack(t,n);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,r){var i=t.longitude,a=t.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return n(r)||(r=new e),r.x=u,r.y=s,r.z=c,e.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(t,r){return n(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,r){var i=l,a=f;this.geodeticSurfaceNormalCartographic(t,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,t.height,i),n(r)||(r=new e),e.add(a,i,r)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var i=0;r>i;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var d=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(r,i){var a=this.scaleToGeodeticSurface(r,h);if(!n(a))return void 0;var o=this.geodeticSurfaceNormal(a,d),s=e.subtract(r,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,r))*e.magnitude(s);return n(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var i=0;r>i;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};var y=new e,p=new e;return c.prototype.scaleToGeodeticSurface=function(t,r){var i=t.x,a=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,d=i*i*c*c,h=a*a*l*l,m=o*o*f*f,v=d+h+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,y);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,r):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,M=x.z,b=p;b.x=2*w.x*E,b.y=2*w.y*S,b.z=2*w.z*M;var T,A,O,I,N,z,_,R,P,L,C,q=(1-g)*e.magnitude(t)/(.5*e.magnitude(b)),D=0;do{q-=D,O=1/(1+q*E),I=1/(1+q*S),N=1/(1+q*M),z=O*O,_=I*I,R=N*N,P=z*O,L=_*I,C=R*N,T=d*z+h*_+m*R-1,A=d*P*E+h*L*S+m*C*M;var B=-2*A;D=T/B}while(Math.abs(T)>u.EPSILON12);return n(r)?(r.x=i*O,r.y=a*I,r.z=o*N,r):new e(i*O,a*I,o*N)},c.prototype.scaleToGeocentricSurface=function(t,r){n(r)||(r=new e);var i=t.x,a=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return e.multiplyByScalar(t,s,r)},c.prototype.transformPositionToScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},c.prototype.equals=function(t){return this===t||n(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,i,a,o){"use strict";var u=function(e){this._ellipsoid=r(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,r){var i=this._semimajorAxis,a=t.longitude*i,o=t.latitude*i,u=t.height;return n(r)?(r.x=a,r.y=o,r.z=u,r):new e(a,o,u)},u.prototype.unproject=function(e,r){var i=this._oneOverSemimajorAxis,a=e.x*i,o=e.y*i,u=e.z;return n(r)?(r.longitude=a,r.latitude=o,r.height=u,r):new t(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,r){this.start=e(t,0),this.stop=e(r,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i){"use strict";var a=function(t,r,n,i){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0),this.w=e(i,0)};a.fromElements=function(e,r,n,i,o){return t(o)?(o.x=e,o.y=r,o.z=n,o.w=i,o):new a(e,r,n,i)},a.fromColor=function(e,r){return t(r)?(r.x=e.red,r.y=e.green,r.z=e.blue,r.w=e.alpha,r):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n++]=t.z,r[n]=t.w},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.x=r[n++],i.y=r[n++],i.z=r[n++],i.w=r[n],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r.w=Math.min(e.w,t.w),r},a.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r.w=Math.max(e.w,t.w),r},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var r=a.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t.w=e.w/r,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},a.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w,r},a.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},a.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},a.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},a.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new a;a.lerp=function(e,t,r,n){return a.multiplyByScalar(t,r,u),n=a.multiplyByScalar(e,1-r,n),a.add(u,n,n)};var s=new a;return a.mostOrthogonalAxis=function(e,t){var r=a.normalize(e,s);return a.abs(r,r),t=r.x<=r.y?r.x<=r.z?r.x<=r.w?a.clone(a.UNIT_X,t):a.clone(a.UNIT_W,t):r.z<=r.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t):r.y<=r.z?r.y<=r.w?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_W,t):r.z<=r.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t)},a.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},a.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},a.equalsEpsilon=function(e,r,n,a){return e===r||t(e)&&t(r)&&i.equalsEpsilon(e.x,r.x,n,a)&&i.equalsEpsilon(e.y,r.y,n,a)&&i.equalsEpsilon(e.z,r.z,n,a)&&i.equalsEpsilon(e.w,r.w,n,a)},a.ZERO=n(new a(0,0,0,0)),a.UNIT_X=n(new a(1,0,0,0)),a.UNIT_Y=n(new a(0,1,0,0)),a.UNIT_Z=n(new a(0,0,1,0)),a.UNIT_W=n(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,r){return a.equalsEpsilon(this,e,t,r)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i,a){"use strict";function o(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function u(e){for(var t=0,r=0;3>r;++r){var n=e[c.getElementIndex(h[r],d[r])];t+=2*n*n}return Math.sqrt(t)}function s(e,t){for(var r=a.EPSILON15,n=0,i=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],d[o])]);u>n&&(i=o,n=u)}var s=1,l=0,f=d[i],m=h[i];if(Math.abs(e[c.getElementIndex(m,f)])>r){var y,p=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(p-v)/2/g;y=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+y*y),l=y*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,r,n,i,a,o,u,s,c){this[0]=t(e,0),this[1]=t(i,0),this[2]=t(u,0),this[3]=t(r,0),this[4]=t(a,0),this[5]=t(s,0),this[6]=t(n,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3],r[n++]=e[4],r[n++]=e[5],r[n++]=e[6],r[n++]=e[7],r[n++]=e[8]},c.unpack=function(e,n,i){return n=t(n,0),r(i)||(i=new c),i[0]=e[n++],i[1]=e[n++],i[2]=e[n++],i[3]=e[n++],i[4]=e[n++],i[5]=e[n++],i[6]=e[n++],i[7]=e[n++],i[8]=e[n++],i},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,n,i){return n=t(n,0),r(i)||(i=new c),i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],i[4]=e[n+4],i[5]=e[n+5],i[6]=e[n+6],i[7]=e[n+7],i[8]=e[n+8],i},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var n=e.x*e.x,i=e.x*e.y,a=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,d=e.z*e.w,h=e.w*e.w,m=n-u-f+h,y=2*(i-d),p=2*(a+l),v=2*(i+d),g=-n+u-f+h,w=2*(s-o),x=2*(a-l),E=2*(s+o),S=-n-u+f+h;return r(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=y,t[4]=g,t[5]=E,t[6]=p,t[7]=w,t[8]=S,t):new c(m,y,p,v,g,w,x,E,S)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var n=Math.cos(e),i=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new c(1,0,0,0,n,-i,0,i,n)},c.fromRotationY=function(e,t){var n=Math.cos(e),i=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new c(n,0,i,0,1,0,-i,0,n)},c.fromRotationZ=function(e,t){var n=Math.cos(e),i=Math.sin(e);return r(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(n,-i,0,i,n,0,0,0,1)},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,r){var n=3*t,i=e[n],a=e[n+1],o=e[n+2];return r.x=i,r.y=a,r.z=o,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var i=3*t;return n[i]=r.x,n[i+1]=r.y,n[i+2]=r.z,n},c.getRow=function(e,t,r){var n=e[t],i=e[t+3],a=e[t+6];return r.x=n,r.y=i,r.z=a,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+3]=r.y,n[t+6]=r.z,n};var l=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),r.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),r.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),r};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,r){var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},c.multiplyByVector=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=e[0]*n+e[3]*i+e[6]*a,u=e[1]*n+e[4]*i+e[7]*a,s=e[2]*n+e[5]*i+e[8]*a;return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},c.multiplyByScale=function(e,t,r){return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.x,r[3]=e[3]*t.y,r[4]=e[4]*t.y,r[5]=e[5]*t.y,r[6]=e[6]*t.z,r[7]=e[7]*t.z,r[8]=e[8]*t.z,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var r=e[0],n=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],h=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(e,t){var n=a.EPSILON20,i=10,l=0,f=0;r(t)||(t={});for(var d=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),p=n*o(h);i>f&&u(h)>p;)s(h,m),c.transpose(m,y),c.multiply(h,m,h),c.multiply(y,h,h),c.multiply(d,m,d),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],r=e[3],n=e[6],i=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+i*(s*n-r*c)+u*(r*o-a*n)},c.inverse=function(e,t){var r=e[0],i=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],d=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=a.EPSILON15)throw new n("matrix is not invertible");t[0]=s*h-d*l,t[1]=d*o-i*h,t[2]=i*l-s*o,t[3]=f*l-u*h,t[4]=r*h-f*o,t[5]=u*o-r*l,t[6]=u*d-f*s,t[7]=f*i-r*d,t[8]=r*s-u*i;var y=1/m;return c.multiplyByScalar(t,y,t)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,i,a,o,u,s){"use strict";var c=function(e,t,n,i,a,o,u,s,c,l,f,d,h,m,y,p){this[0]=r(e,0),this[1]=r(a,0),this[2]=r(c,0),this[3]=r(h,0),this[4]=r(t,0),this[5]=r(o,0),this[6]=r(l,0),this[7]=r(m,0),this[8]=r(n,0),this[9]=r(u,0),this[10]=r(f,0),this[11]=r(y,0),this[12]=r(i,0),this[13]=r(s,0),this[14]=r(d,0),this[15]=r(p,0)};c.packedLength=16,c.pack=function(e,t,n){n=r(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15]},c.unpack=function(e,t,i){return t=r(t,0),n(i)||(i=new c),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,i,a){return i=r(i,e.ZERO),n(a)?(a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=0,a[4]=t[3],a[5]=t[4],a[6]=t[5],a[7]=0,a[8]=t[6],a[9]=t[7],a[10]=t[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(t[0],t[3],t[6],i.x,t[1],t[4],t[7],i.y,t[2],t[5],t[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,r,i){n(i)||(i=new c);var a=r.x,o=r.y,u=r.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,d=t.x*t.w,h=t.y*t.y,m=t.y*t.z,y=t.y*t.w,p=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-p+g,x=2*(l-v),E=2*(f+y),S=2*(l+v),M=-s+h-p+g,b=2*(m-d),T=2*(f-y),A=2*(m+d),O=-s-h+p+g;return i[0]=w*a,i[1]=S*a,i[2]=T*a,i[3]=0,i[4]=x*o,i[5]=M*o,i[6]=A*o,i[7]=0,i[8]=E*u,i[9]=b*u,i[10]=O*u,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,d=new e;c.fromCamera=function(t,r){var i=t.eye,a=t.target,o=t.up;e.normalize(e.subtract(a,i,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,d),d);var u=f.x,s=f.y,h=f.z,m=l.x,y=l.y,p=l.z,v=d.x,g=d.y,w=d.z,x=i.x,E=i.y,S=i.z,M=u*-x+s*-E+h*-S,b=v*-x+g*-E+w*-S,T=m*x+y*E+p*S;return n(r)?(r[0]=u,r[1]=v,r[2]=-m,r[3]=0,r[4]=s,r[5]=g,r[6]=-y,r[7]=0,r[8]=h,r[9]=w,r[10]=-p,r[11]=0,r[12]=M,r[13]=b,r[14]=T,r[15]=1,r):new c(u,s,h,M,v,g,w,b,-m,-y,-p,T,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,r,n,i){var a=Math.tan(.5*e),o=1/a,u=o/t,s=(n+r)/(r-n),c=2*n*r/(r-n);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(e,t,r,n,i,a,o){var u=1/(t-e),s=1/(n-r),c=1/(a-i),l=-(t+e)*u,f=-(n+r)*s,d=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=d,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,r,n,i,a,o){var u=2*i/(t-e),s=2*i/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),f=-(a+i)/(a-i),d=-1,h=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=d,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,r,n,i,a){var o=2*i/(t-e),u=2*i/(n-r),s=(t+e)/(t-e),c=(n+r)/(n-r),l=-1,f=-1,d=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=d,a[15]=0,a},c.computeViewportTransformation=function(e,t,n,i){e=r(e,r.EMPTY_OBJECT);var a=r(e.x,0),o=r(e.y,0),u=r(e.width,0),s=r(e.height,0);t=r(t,0),n=r(n,1);var c=.5*u,l=.5*s,f=.5*(n-t),d=c,h=l,m=f,y=a+c,p=o+l,v=t+f,g=1;return i[0]=d,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=g,i},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,r){var n=4*t,i=e[n],a=e[n+1],o=e[n+2],u=e[n+3];return r.x=i,r.y=a,r.z=o,r.w=u,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var i=4*t;return n[i]=r.x,n[i+1]=r.y,n[i+2]=r.z,n[i+3]=r.w,n},c.setTranslation=function(e,t,r){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=e[15],r},c.getRow=function(e,t,r){var n=e[t],i=e[t+4],a=e[t+8],o=e[t+12];return r.x=n,r.y=i,r.z=a,r.w=o,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+4]=r.y,n[t+8]=r.z,n[t+12]=r.w,n};var h=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),r.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),r.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),r};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,r){var n=e[0],i=e[1],a=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],y=e[12],p=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],M=t[4],b=t[5],T=t[6],A=t[7],O=t[8],I=t[9],N=t[10],z=t[11],_=t[12],R=t[13],P=t[14],L=t[15],C=n*w+u*x+f*E+y*S,q=i*w+s*x+d*E+p*S,D=a*w+c*x+h*E+v*S,B=o*w+l*x+m*E+g*S,U=n*M+u*b+f*T+y*A,F=i*M+s*b+d*T+p*A,G=a*M+c*b+h*T+v*A,k=o*M+l*b+m*T+g*A,W=n*O+u*I+f*N+y*z,V=i*O+s*I+d*N+p*z,Y=a*O+c*I+h*N+v*z,j=o*O+l*I+m*N+g*z,H=n*_+u*R+f*P+y*L,Z=i*_+s*R+d*P+p*L,X=a*_+c*R+h*P+v*L,Q=o*_+l*R+m*P+g*L;return r[0]=C,r[1]=q,r[2]=D,r[3]=B,r[4]=U,r[5]=F,r[6]=G,r[7]=k,r[8]=W,r[9]=V,r[10]=Y,r[11]=j,r[12]=H,r[13]=Z,r[14]=X,r[15]=Q,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},c.multiplyTransformation=function(e,t,r){var n=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=e[12],h=e[13],m=e[14],y=t[0],p=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],M=t[10],b=t[12],T=t[13],A=t[14],O=n*y+o*p+c*v,I=i*y+u*p+l*v,N=a*y+s*p+f*v,z=n*g+o*w+c*x,_=i*g+u*w+l*x,R=a*g+s*w+f*x,P=n*E+o*S+c*M,L=i*E+u*S+l*M,C=a*E+s*S+f*M,q=n*b+o*T+c*A+d,D=i*b+u*T+l*A+h,B=a*b+s*T+f*A+m;return r[0]=O,r[1]=I,r[2]=N,r[3]=0,r[4]=z,r[5]=_,r[6]=R,r[7]=0,r[8]=P,r[9]=L,r[10]=C,r[11]=0,r[12]=q,r[13]=D,r[14]=B,r[15]=1,r},c.multiplyByMatrix3=function(e,t,r){var n=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=t[0],h=t[1],m=t[2],y=t[3],p=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=n*d+o*h+c*m,S=i*d+u*h+l*m,M=a*d+s*h+f*m,b=n*y+o*p+c*v,T=i*y+u*p+l*v,A=a*y+s*p+f*v,O=n*g+o*w+c*x,I=i*g+u*w+l*x,N=a*g+s*w+f*x;return r[0]=E,r[1]=S,r[2]=M,r[3]=0,r[4]=b,r[5]=T,r[6]=A,r[7]=0,r[8]=O,r[9]=I,r[10]=N,r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},c.multiplyByTranslation=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=n*e[0]+i*e[4]+a*e[8]+e[12],u=n*e[1]+i*e[5]+a*e[9]+e[13],s=n*e[2]+i*e[6]+a*e[10]+e[14];return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=o,r[13]=u,r[14]=s,r[15]=e[15],r};var y=new e;c.multiplyByUniformScale=function(e,t,r){return y.x=t,y.y=t,y.z=t,c.multiplyByScale(e,y,r)},c.multiplyByScale=function(e,t,r){var n=t.x,i=t.y,a=t.z;return 1===n&&1===i&&1===a?c.clone(e,r):(r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=0,r[4]=i*e[4],r[5]=i*e[5],r[6]=i*e[6],r[7]=0,r[8]=a*e[8],r[9]=a*e[9],r[10]=a*e[10],r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=1,r)},c.multiplyByVector=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=t.w,u=e[0]*n+e[4]*i+e[8]*a+e[12]*o,s=e[1]*n+e[5]*i+e[9]*a+e[13]*o,c=e[2]*n+e[6]*i+e[10]*a+e[14]*o,l=e[3]*n+e[7]*i+e[11]*a+e[15]*o;return r.x=u,r.y=s,r.z=c,r.w=l,r},c.multiplyByPointAsVector=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=e[0]*n+e[4]*i+e[8]*a,u=e[1]*n+e[5]*i+e[9]*a,s=e[2]*n+e[6]*i+e[10]*a;return r.x=o,r.y=u,r.z=s,r},c.multiplyByPoint=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=e[0]*n+e[4]*i+e[8]*a+e[12],u=e[1]*n+e[5]*i+e[9]*a+e[13],s=e[2]*n+e[6]*i+e[10]*a+e[14];return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var r=e[1],n=e[2],i=e[3],a=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=a,t[10]=e[10],t[11]=e[14],t[12]=i,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r&&Math.abs(e[9]-t[9])<=r&&Math.abs(e[10]-t[10])<=r&&Math.abs(e[11]-t[11])<=r&&Math.abs(e[12]-t[12])<=r&&Math.abs(e[13]-t[13])<=r&&Math.abs(e[14]-t[14])<=r&&Math.abs(e[15]-t[15])<=r},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var p=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,r){if(u.equalsEpsilon(c.getRotation(e,p),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=0,r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=1,r;var n=e[0],i=e[4],a=e[8],l=e[12],f=e[1],d=e[5],h=e[9],m=e[13],y=e[2],x=e[6],E=e[10],S=e[14],M=e[3],b=e[7],T=e[11],A=e[15],O=E*A,I=S*T,N=x*A,z=S*b,_=x*T,R=E*b,P=y*A,L=S*M,C=y*T,q=E*M,D=y*b,B=x*M,U=O*d+z*h+_*m-(I*d+N*h+R*m),F=I*f+P*h+q*m-(O*f+L*h+C*m),G=N*f+L*d+D*m-(z*f+P*d+B*m),k=R*f+C*d+B*h-(_*f+q*d+D*h),W=I*i+N*a+R*l-(O*i+z*a+_*l),V=O*n+L*a+C*l-(I*n+P*a+q*l),Y=z*n+P*i+B*l-(N*n+L*i+D*l),j=_*n+q*i+D*a-(R*n+C*i+B*a);O=a*m,I=l*h,N=i*m,z=l*d,_=i*h,R=a*d,P=n*m,L=l*f,C=n*h,q=a*f,D=n*d,B=i*f;var H=O*b+z*T+_*A-(I*b+N*T+R*A),Z=I*M+P*T+q*A-(O*M+L*T+C*A),X=N*M+L*b+D*A-(z*M+P*b+B*A),Q=R*M+C*b+B*T-(_*M+q*b+D*T),K=N*E+R*S+I*x-(_*S+O*x+z*E),J=C*S+O*y+L*E-(P*E+q*S+I*y),$=P*x+B*S+z*y-(D*S+N*y+L*x),et=D*E+_*y+q*x-(C*x+B*E+R*y),tt=n*U+i*F+a*G+l*k;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,r[0]=U*tt,r[1]=F*tt,r[2]=G*tt,r[3]=k*tt,r[4]=W*tt,r[5]=V*tt,r[6]=Y*tt,r[7]=j*tt,r[8]=H*tt,r[9]=Z*tt,r[10]=X*tt,r[11]=Q*tt,r[12]=K*tt,r[13]=J*tt,r[14]=$*tt,r[15]=et*tt,r},c.inverseTransformation=function(e,t){var r=e[0],n=e[1],i=e[2],a=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],d=e[13],h=e[14],m=-r*f-n*d-i*h,y=-a*f-o*d-u*h,p=-s*f-c*d-l*h;return t[0]=r,t[1]=a,t[2]=s,t[3]=0,t[4]=n,t[5]=o,t[6]=c,t[7]=0,t[8]=i,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=y,t[14]=p,t[15]=1,t},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]&&e[9]===t[r+9]&&e[10]===t[r+10]&&e[11]===t[r+11]&&e[12]===t[r+12]&&e[13]===t[r+13]&&e[14]===t[r+14]&&e[15]===t[r+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var i=function(t,r){this.normal=e.clone(t),this.distance=r};i.fromPointNormal=function(r,n,a){var o=-e.dot(n,r);return t(a)?(e.clone(n,a.normal),a.distance=o,a):new i(n,o)};var a=new e;return i.fromCartesian4=function(r,n){var o=e.fromCartesian4(r,a),u=r.w;return t(n)?(e.clone(o,n.normal),n.distance=u,n):new i(o,u)},i.getPointDistance=function(t,r){return e.dot(t.normal,r)+t.distance},i.ORIGIN_XY_PLANE=n(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=n(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=n(new i(e.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,i,a,o,u){"use strict";var s=function(e,r,n,i){this.west=t(e,0),this.south=t(r,0),this.east=t(n,0),this.north=t(i,0)};n(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},s.unpack=function(e,n,i){return n=t(n,0),r(i)||(i=new s),i.west=e[n++],i.south=e[n++],i.east=e[n++],i.north=e[n],i},s.computeWidth=function(e){var t=e.east,r=e.west;return r>t&&(t+=u.TWO_PI),t-r},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,n,i,a,o){return e=u.toRadians(t(e,0)),n=u.toRadians(t(n,0)),i=u.toRadians(t(i,0)),a=u.toRadians(t(a,0)),r(o)?(o.west=e,o.south=n,o.east=i,o.north=a,o):new s(e,n,i,a)},s.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];n=Math.min(n,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return r(t)?(t.west=n,t.south=a,t.east=i,t.north=o,t):new s(n,a,i,o)},s.clone=function(e,t){return r(e)?r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},s.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},s.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},s.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},s.center=function(t,n){var i=t.east,a=t.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(t.south+t.north);return r(n)?(n.longitude=o,n.latitude=s,n.height=0,n):new e(o,s)},s.intersection=function(e,t,n){var i=e.east,a=e.west,o=t.east,c=t.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var d=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return d>=h?void 0:r(n)?(n.west=l,n.south=d,n.east=f,n.north=h,n):new s(l,d,f,h)},s.contains=function(e,t){var r=t.longitude,n=t.latitude,i=e.west,a=e.east;return i>a&&(a+=u.TWO_PI,0>r&&(r+=u.TWO_PI)),(r>i||u.equalsEpsilon(r,i,u.EPSILON14))&&(a>r||u.equalsEpsilon(r,a,u.EPSILON14))&&n>=e.south&&n<=e.north};var c=new e;return s.subsample=function(e,n,i,o){n=t(n,a.WGS84),i=t(i,0),r(o)||(o=[]);var l=0,f=e.north,d=e.south,h=e.east,m=e.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.longitude=h,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.latitude=d,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:d>0?d:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(e,y)&&(o[l]=n.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.longitude=h,o[l]=n.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,r,n,i,a,o,u,s,c,l,f,d){"use strict";var h=function(t,n){this.center=e.clone(r(t,e.ZERO)),this.radius=r(n,0)},m=new e,y=new e,p=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,M=new e,b=new e,T=new e;h.fromPoints=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;for(var i=e.clone(t[0],x),a=e.clone(i,m),o=e.clone(i,y),u=e.clone(i,p),s=e.clone(i,v),c=e.clone(i,g),l=e.clone(i,w),f=t.length,d=1;f>d;d++){e.clone(t[d],i);var A=i.x,O=i.y,I=i.z;A<a.x&&e.clone(i,a),A>s.x&&e.clone(i,s),O<o.y&&e.clone(i,o),O>c.y&&e.clone(i,c),I<u.z&&e.clone(i,u),I>l.z&&e.clone(i,l)}var N=e.magnitudeSquared(e.subtract(s,a,E)),z=e.magnitudeSquared(e.subtract(c,o,E)),_=e.magnitudeSquared(e.subtract(l,u,E)),R=a,P=s,L=N;z>L&&(L=z,R=o,P=c),_>L&&(L=_,R=u,P=l);var C=S;C.x=.5*(R.x+P.x),C.y=.5*(R.y+P.y),C.z=.5*(R.z+P.z);var q=e.magnitudeSquared(e.subtract(P,C,E)),D=Math.sqrt(q),B=M;B.x=a.x,B.y=o.y,B.z=u.z;var U=b;U.x=s.x,U.y=c.y,U.z=l.z;var F=e.multiplyByScalar(e.add(B,U,E),.5,T),G=0;for(d=0;f>d;d++){e.clone(t[d],i);var k=e.magnitude(e.subtract(i,F,E));k>G&&(G=k);var W=e.magnitudeSquared(e.subtract(i,C,E));if(W>q){var V=Math.sqrt(W);D=.5*(D+V),q=D*D;var Y=V-D;C.x=(D*C.x+Y*i.x)/V,C.y=(D*C.y+Y*i.y)/V,C.z=(D*C.z+Y*i.z)/V}}return G>D?(e.clone(C,r.center),r.radius=D):(e.clone(F,r.center),r.radius=G),r};var A=new u,O=new e,I=new e,N=new t,z=new t;h.fromRectangle2D=function(e,t,r){return h.fromRectangleWithHeights2D(e,t,0,0,r)},h.fromRectangleWithHeights2D=function(t,i,a,o,u){if(n(u)||(u=new h),!n(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=r(i,A),d.southwest(t,N),N.height=a,d.northeast(t,z),z.height=o;var s=i.project(N,O),c=i.project(z,I),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var _=[];h.fromRectangle3D=function(e,t,i,a){t=r(t,o.WGS84),i=r(i,0);var u;return n(e)&&(u=d.subsample(e,t,i,_)),h.fromPoints(u,a)},h.fromVertices=function(t,i,a,o){if(n(o)||(o=new h),!n(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;i=r(i,e.ZERO),a=r(a,3);var u=x;u.x=t[0]+i.x,u.y=t[1]+i.y,u.z=t[2]+i.z;for(var s=e.clone(u,m),c=e.clone(u,y),l=e.clone(u,p),f=e.clone(u,v),d=e.clone(u,g),A=e.clone(u,w),O=t.length,I=0;O>I;I+=a){var N=t[I]+i.x,z=t[I+1]+i.y,_=t[I+2]+i.z;u.x=N,u.y=z,u.z=_,N<s.x&&e.clone(u,s),N>f.x&&e.clone(u,f),z<c.y&&e.clone(u,c),z>d.y&&e.clone(u,d),_<l.z&&e.clone(u,l),_>A.z&&e.clone(u,A)}var R=e.magnitudeSquared(e.subtract(f,s,E)),P=e.magnitudeSquared(e.subtract(d,c,E)),L=e.magnitudeSquared(e.subtract(A,l,E)),C=s,q=f,D=R;P>D&&(D=P,C=c,q=d),L>D&&(D=L,C=l,q=A);var B=S;B.x=.5*(C.x+q.x),B.y=.5*(C.y+q.y),B.z=.5*(C.z+q.z);var U=e.magnitudeSquared(e.subtract(q,B,E)),F=Math.sqrt(U),G=M;G.x=s.x,G.y=c.y,G.z=l.z;var k=b;k.x=f.x,k.y=d.y,k.z=A.z;var W=e.multiplyByScalar(e.add(G,k,E),.5,T),V=0;for(I=0;O>I;I+=a){u.x=t[I]+i.x,u.y=t[I+1]+i.y,u.z=t[I+2]+i.z;var Y=e.magnitude(e.subtract(u,W,E));Y>V&&(V=Y);var j=e.magnitudeSquared(e.subtract(u,B,E));if(j>U){var H=Math.sqrt(j);F=.5*(F+H),U=F*F;var Z=H-F;B.x=(F*B.x+Z*u.x)/H,B.y=(F*B.y+Z*u.y)/H,B.z=(F*B.z+Z*u.z)/H}}return V>F?(e.clone(B,o.center),o.radius=F):(e.clone(W,o.center),o.radius=V),o},h.fromCornerPoints=function(t,r,i){n(i)||(i=new h);var a=i.center;return e.add(t,r,a),e.multiplyByScalar(a,.5,a),i.radius=e.distance(a,r),i},h.fromEllipsoid=function(t,r){return n(r)||(r=new h),e.clone(e.ZERO,r.center),r.radius=t.maximumRadius,r};var R=new e;h.fromBoundingSpheres=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var i=t.length;if(1===i)return h.clone(t[0],r);if(2===i)return h.union(t[0],t[1],r);for(var a=[],o=0;i>o;o++)a.push(t[o].center);r=h.fromPoints(a,r);var u=r.center,s=r.radius;for(o=0;i>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,R)+c.radius)}return r.radius=s,r},h.clone=function(t,r){return n(t)?n(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,n){n=r(n,0);var i=e.center;t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius},h.unpack=function(e,t,i){t=r(t,0),n(i)||(i=new h);var a=i.center;return a.x=e[t++],a.y=e[t++],a.z=e[t++],i.radius=e[t],i};var P=new e,L=new e;h.union=function(t,r,i){n(i)||(i=new h);var a=t.center,o=t.radius,u=r.center,s=r.radius,c=e.subtract(u,a,P),l=e.magnitude(c);if(o>=l+s)return t.clone(i),i;if(s>=l+o)return r.clone(i),i;var f=.5*(o+l+s),d=e.multiplyByScalar(c,(-o+f)/l,L);return e.add(d,a,d),e.clone(d,i.center),i.radius=f,i};var C=new e;h.expand=function(t,r,n){n=h.clone(t,n);var i=e.magnitude(e.subtract(r,n.center,C));return i>n.radius&&(n.radius=i),n},h.intersectPlane=function(t,r){var n=t.center,i=t.radius,a=r.normal,o=e.dot(a,n)+r.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);h.intersect=function(e,t){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var r=f.fromCartesian4(t,q);return h.intersectPlane(e,r)},h.transform=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=l.getMaximumScale(t)*e.radius,r};var D=new e;h.distanceSquaredTo=function(t,r){var n=e.subtract(t.center,r,D);return e.magnitudeSquared(n)-t.radius*t.radius},h.transformWithoutScale=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var B=new e;h.computePlaneDistances=function(t,r,i,a){n(a)||(a=new c);var o=e.subtract(t.center,r,B),u=e.multiplyByScalar(i,e.dot(i,o),B),s=e.magnitude(u);return a.start=s-t.radius,a.stop=s+t.radius,a};for(var U=new e,F=new e,G=new e,k=new e,W=new e,V=new t,Y=new Array(8),j=0;8>j;++j)Y[j]=new e;var H=new u;return h.projectTo2D=function(t,n,i){n=r(n,H);var a=n.ellipsoid,o=t.center,u=t.radius,s=a.geodeticSurfaceNormal(o,U),c=e.cross(e.UNIT_Z,s,F);e.normalize(c,c);var l=e.cross(s,c,G);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,W),d=e.negate(c,k),m=Y,y=m[0];e.add(s,l,y),e.add(y,c,y),y=m[1],e.add(s,l,y),e.add(y,d,y),y=m[2],e.add(s,f,y),e.add(y,d,y),y=m[3],e.add(s,f,y),e.add(y,c,y),e.negate(s,s),y=m[4],e.add(s,l,y),e.add(y,c,y),y=m[5],e.add(s,l,y),e.add(y,d,y),y=m[6],e.add(s,f,y),e.add(y,d,y),y=m[7],e.add(s,f,y),e.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var g=m[v];e.add(o,g,g);var w=a.cartesianToCartographic(g,V);n.project(w,g)}i=h.fromPoints(m,i),o=i.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,i},h.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i){"use strict";var a=function(t,r){this.x=e(t,0),this.y=e(r,0)};a.fromElements=function(e,r,n){return t(n)?(n.x=e,n.y=r,n):new a(e,r)},a.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r):new a(e.x,e.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n]=t.y},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.x=r[n++],i.y=r[n],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y)},a.minimumComponent=function(e){return Math.min(e.x,e.y)},a.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r},a.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var r=a.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y},a.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r},a.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r},a.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r},a.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r},a.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new a;a.lerp=function(e,t,r,n){return a.multiplyByScalar(t,r,u),n=a.multiplyByScalar(e,1-r,n),a.add(u,n,n)};var s=new a,c=new a;a.angleBetween=function(e,t){return a.normalize(e,s),a.normalize(t,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(e,t){var r=a.normalize(e,l);return a.abs(r,r),t=r.x<=r.y?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Y,t)},a.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y},a.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},a.equalsEpsilon=function(e,r,n,a){return e===r||t(e)&&t(r)&&i.equalsEpsilon(e.x,r.x,n,a)&&i.equalsEpsilon(e.y,r.y,n,a)},a.ZERO=n(new a(0,0)),a.UNIT_X=n(new a(1,0)),a.UNIT_Y=n(new a(0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,r){return a.equalsEpsilon(this,e,t,r)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return t(i,{element:{get:function(){return i.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof t[i]?(n.requestFullscreen=i,r=!0):(i=s+"RequestFullScreen","function"==typeof t[i]&&(n.requestFullscreen=i,r=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?n.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(n.exitFullscreen=i)),i=s+"FullscreenEnabled",e(document[i])?n.fullscreenEnabled=i:(i=s+"FullScreenEnabled",e(document[i])&&(n.fullscreenEnabled=i)),i=s+"FullscreenElement",e(document[i])?n.fullscreenElement=i:(i=s+"FullScreenElement",e(document[i])&&(n.fullscreenElement=i)),i=s+"fullscreenchange",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),n.fullscreenchange=i),i=s+"fullscreenerror",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),n.fullscreenerror=i)}return r},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[n.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[n.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function i(){if(!t(p)){p=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(p=!0,v=n(e[1]))}return p}function a(){return i()&&v}function o(){if(!t(g)&&(g=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=n(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=n(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,M=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,M=n(e[1])))}return S}function f(){return l()&&M}function d(){if(!t(b)){b=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(b=!0,T=n(e[1]))}return b}function h(){return t(A)||(A=/Windows/i.test(navigator.appVersion)),A}function m(){return d()&&T}function y(){return t(O)||(O=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),O}var p,v,g,w,x,E,S,M,b,T,A,O,I={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:d,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return I.supportsFullscreen=function(){return r.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,r,n,i){"use strict";if(!n.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(e){switch(e){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},a.fromTypedArray=function(e){return e instanceof Int8Array?a.BYTE:e instanceof Uint8Array?a.UNSIGNED_BYTE:e instanceof Int16Array?a.SHORT:e instanceof Uint16Array?a.UNSIGNED_SHORT:e instanceof Float32Array?a.FLOAT:e instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(e){return t(e)&&(e===a.BYTE||e===a.UNSIGNED_BYTE||e===a.SHORT||e===a.UNSIGNED_SHORT||e===a.FLOAT||e===a.DOUBLE)},a.createTypedArray=function(e,t){switch(e){case a.BYTE:return new Int8Array(t);case a.UNSIGNED_BYTE:return new Uint8Array(t);case a.SHORT:return new Int16Array(t);case a.UNSIGNED_SHORT:return new Uint16Array(t);case a.FLOAT:return new Float32Array(t);case a.DOUBLE:return new Float64Array(t);default:throw new r("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(t,n,i,o){switch(i=e(i,0),o=e(o,(n.byteLength-i)/a.getSizeInBytes(t)),t){case a.BYTE:return new Int8Array(n,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(n,i,o);case a.SHORT:return new Int16Array(n,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(n,i,o);case a.FLOAT:return new Float32Array(n,i,o);case a.DOUBLE:return new Float64Array(n,i,o);default:throw new r("componentDatatype is not a valid value.")}},i(a)}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,r,n,i,a,o,u){"use strict";var s=function(e,r,n,i){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(i,0)},c=new e;s.fromAxisAngle=function(t,n,i){var a=n/2,o=Math.sin(a);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,d=Math.cos(a);return r(i)?(i.x=u,i.y=l,i.z=f,i.w=d,i):new s(u,l,f,d)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var n,i,a,o,c,d=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],y=d+h+m;if(y>0)n=Math.sqrt(y+1),c=.5*n,n=.5/n,i=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*n,a=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*n,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*n;else{var p=l,v=0;h>d&&(v=1),m>d&&m>h&&(v=2);var g=p[v],w=p[g];n=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*n,n=.5/n,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*n,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*n,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*n,i=-x[0],a=-x[1],o=-x[2]}return r(t)?(t.x=i,t.y=a,t.z=o,t.w=c,t):new s(i,a,o,c)};var d=new s;s.fromHeadingPitchRoll=function(t,r,n,i){var a=s.fromAxisAngle(e.UNIT_X,n,d),o=s.fromAxisAngle(e.UNIT_Y,-r,i);i=s.multiply(o,a,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,d);return s.multiply(u,i,i)};var h=new e,m=new e,y=new s,p=new s,v=new s; -s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.x,r[n++]=e.y,r[n++]=e.z,r[n]=e.w},s.unpack=function(e,n,i){return n=t(n,0),r(i)||(i=new s),i.x=e[n],i.y=e[n+1],i.z=e[n+2],i.w=e[n+3],i},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,r,n){s.unpack(e,4*r,v),s.conjugate(v,v);for(var i=0,a=r-t+1;a>i;i++){var o=3*i;s.unpack(e,4*(t+i),y),s.multiply(y,v,y),y.w<0&&s.negate(y,y),s.computeAxis(y,h);var u=s.computeAngle(y);n[o]=h.x*u,n[o+1]=h.y*u,n[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,n,i,a,o){r(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(n,4*a,p),0===u?s.clone(s.IDENTITY,y):s.fromAxisAngle(m,u,y),s.multiply(y,p,o)},s.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var r=1/s.magnitude(e),n=e.x*r,i=e.y*r,a=e.z*r,o=e.w*r;return t.x=n,t.y=i,t.z=a,t.w=o,t},s.inverse=function(e,t){var r=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/r,t)},s.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},s.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,r){var n=e.x,i=e.y,a=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+n*l+i*c-a*s,d=o*s-n*c+i*l+a*u,h=o*c+n*s-i*u+a*l,m=o*l-n*u-i*s-a*c;return r.x=f,r.y=d,r.z=h,r.w=m,r},s.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},s.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},s.computeAxis=function(e,t){var r=e.w;if(Math.abs(r-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var n=1/Math.sqrt(1-r*r);return t.x=e.x*n,t.y=e.y*n,t.z=e.z*n,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,r,n){return g=s.multiplyByScalar(t,r,g),n=s.multiplyByScalar(e,1-r,n),s.add(g,n,n)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,r,n){var i=s.dot(e,t),a=t;if(0>i&&(i=-i,a=w=s.negate(t,w)),1-i<o.EPSILON6)return s.lerp(e,a,r,n);var u=Math.acos(i);return x=s.multiplyByScalar(e,Math.sin((1-r)*u),x),E=s.multiplyByScalar(a,Math.sin(r*u),E),n=s.add(x,E,n),s.multiplyByScalar(n,1/Math.sin(u),n)},s.log=function(t,r){var n=o.acosClamped(t.w),i=0;return 0!==n&&(i=n/Math.sin(n)),e.multiplyByScalar(t,i,r)},s.exp=function(t,r){var n=e.magnitude(t),i=0;return 0!==n&&(i=Math.sin(n)/n),r.x=t.x*i,r.y=t.y*i,r.z=t.z*i,r.w=Math.cos(n),r};var S=new e,M=new e,b=new s,T=new s;s.computeInnerQuadrangle=function(t,r,n,i){var a=s.conjugate(r,b);s.multiply(a,n,T);var o=s.log(T,S);s.multiply(a,t,T);var u=s.log(T,M);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,b),s.multiply(r,b,i)},s.squad=function(e,t,r,n,i,a){var o=s.slerp(e,t,i,b),u=s.slerp(r,n,i,T);return s.slerp(o,u,2*i*(1-i),a)};for(var A=new s,O=1.9011074535173003,I=i.supportsTypedArrays()?new Float32Array(8):[],N=i.supportsTypedArrays()?new Float32Array(8):[],z=i.supportsTypedArrays()?new Float32Array(8):[],_=i.supportsTypedArrays()?new Float32Array(8):[],R=0;7>R;++R){var P=R+1,L=2*P+1;I[R]=1/(P*L),N[R]=P/L}return I[7]=O/136,N[7]=8*O/17,s.fastSlerp=function(e,t,r,n){var i,a=s.dot(e,t);a>=0?i=1:(i=-1,a=-a);for(var o=a-1,u=1-r,c=r*r,l=u*u,f=7;f>=0;--f)z[f]=(I[f]*c-N[f])*o,_[f]=(I[f]*l-N[f])*o;var d=i*r*(1+z[0]*(1+z[1]*(1+z[2]*(1+z[3]*(1+z[4]*(1+z[5]*(1+z[6]*(1+z[7])))))))),h=u*(1+_[0]*(1+_[1]*(1+_[2]*(1+_[3]*(1+_[4]*(1+_[5]*(1+_[6]*(1+_[7])))))))),m=s.multiplyByScalar(e,h,A);return s.multiplyByScalar(t,d,n),s.add(m,n,n)},s.fastSquad=function(e,t,r,n,i,a){var o=s.fastSlerp(e,t,i,b),u=s.fastSlerp(r,n,i,T);return s.fastSlerp(o,u,2*i*(1-i),a)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/EllipseGeometryLibrary",["./Cartesian3","./Math","./Matrix3","./Quaternion"],function(e,t,r,n){"use strict";function i(t,i,a,l,f,d,h,m,y,p){var v=t+i;e.multiplyByScalar(l,Math.cos(v),o),e.multiplyByScalar(a,Math.sin(v),u),e.add(o,u,o);var g=Math.cos(t);g*=g;var w=Math.sin(t);w*=w;var x=d/Math.sqrt(h*g+f*w),E=x/m;return n.fromAxisAngle(o,E,s),r.fromQuaternion(s,c),r.multiplyByVector(c,y,p),e.normalize(p,p),e.multiplyByScalar(p,m,p),p}var a={},o=new e,u=new e,s=new n,c=new r,l=new e,f=new e,d=new e,h=new e;a.raisePositionsToHeight=function(t,r,n){for(var i=r.ellipsoid,a=r.height,o=r.extrudedHeight,u=n?2*(t.length/3):t.length/3,s=new Float64Array(3*u),c=t.length,m=n?c:0,y=0;c>y;y+=3){var p=y+1,v=y+2,g=e.fromArray(t,y,l);i.scaleToGeodeticSurface(g,g);var w=e.clone(g,f),x=i.geodeticSurfaceNormal(g,h),E=e.multiplyByScalar(x,a,d);e.add(g,E,g),n&&(e.multiplyByScalar(x,o,E),e.add(w,E,w),s[y+m]=w.x,s[p+m]=w.y,s[v+m]=w.z),s[y]=g.x,s[p]=g.y,s[v]=g.z}return s};var m=new e,y=new e,p=new e;return a.computeEllipsePositions=function(r,n,a){var o=r.semiMinorAxis,u=r.semiMajorAxis,s=r.rotation,c=r.center,h=8*r.granularity,v=o*o,g=u*u,w=u*o,x=e.magnitude(c),E=e.normalize(c,m),S=e.cross(e.UNIT_Z,c,y);S=e.normalize(S,S);var M=e.cross(E,S,p),b=1+Math.ceil(t.PI_OVER_TWO/h),T=t.PI_OVER_TWO/(b-1),A=t.PI_OVER_TWO-b*T;0>A&&(b-=Math.ceil(Math.abs(A)/T));var O,I,N,z,_,R=2*b*(b+1),P=n?new Array(3*R):void 0,L=0,C=l,q=f,D=3*(2*b+2*(b-1)),B=D-1,U=0,F=a?new Array(D):void 0;for(A=t.PI_OVER_TWO,O=0;b>O;++O){if(C=i(A,s,M,S,v,w,g,x,E,C),q=i(Math.PI-A,s,M,S,v,w,g,x,E,q),n){for(P[L++]=C.x,P[L++]=C.y,P[L++]=C.z,N=2*O+2,I=1;N-1>I;++I)z=I/(N-1),_=e.lerp(C,q,z,d),P[L++]=_.x,P[L++]=_.y,P[L++]=_.z;P[L++]=q.x,P[L++]=q.y,P[L++]=q.z}a&&(F[B--]=C.z,F[B--]=C.y,F[B--]=C.x,0!==O&&(F[U++]=q.x,F[U++]=q.y,F[U++]=q.z)),A=t.PI_OVER_TWO-(O+1)*T}for(O=b;O>0;--O){if(A=t.PI_OVER_TWO-(O-1)*T,C=i(-A,s,M,S,v,w,g,x,E,C),q=i(A+Math.PI,s,M,S,v,w,g,x,E,q),n){for(P[L++]=C.x,P[L++]=C.y,P[L++]=C.z,N=2*(O-1)+2,I=1;N-1>I;++I)z=I/(N-1),_=e.lerp(C,q,z,d),P[L++]=_.x,P[L++]=_.y,P[L++]=_.z;P[L++]=q.x,P[L++]=q.y,P[L++]=q.z}a&&(F[B--]=C.z,F[B--]=C.y,F[B--]=C.x,1!==O&&(F[U++]=q.x,F[U++]=q.y,F[U++]=q.z))}var G={};return n&&(G.positions=P,G.numPts=b),a&&(G.outerPositions=F),G},a}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,i){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,i.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,n.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(e){var n=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&t(e.attributes[i])&&t(e.attributes[i].values)){var a=e.attributes[i],o=a.values.length/a.componentsPerAttribute;if(n!==o&&-1!==n)throw new r("All attribute lists must have the same number of attributes.");n=o}return n},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=n.clone(e(t.modelMatrix,n.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return i}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n,i){"use strict";var a={};a.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=t.x,n=t.y;t.x=(1-Math.abs(n))*i.signNotZero(r),t.y=(1-Math.abs(r))*i.signNotZero(n)}return t.x=i.toSNorm(t.x),t.y=i.toSNorm(t.y),t},a.octDecode=function(e,r,n){if(n.x=i.fromSNorm(e),n.y=i.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var a=n.x;n.x=(1-Math.abs(n.y))*i.signNotZero(a),n.y=(1-Math.abs(a))*i.signNotZero(n.y)}return t.normalize(n,n)},a.octPackFloat=function(e){return 256*e.x+e.y};var o=new e;return a.octEncodeFloat=function(e){return a.octEncode(e,o),a.octPackFloat(o)},a.octDecodeFloat=function(e,t){var r=e/256,n=Math.floor(r),i=256*(r-n);return a.octDecode(n,i,t)},a.octPack=function(e,t,r,n){var i=a.octEncodeFloat(e),u=a.octEncodeFloat(t),s=a.octEncode(r,o);return n.x=65536*s.x+i,n.y=65536*s.y+u,n},a.octUnpack=function(e,t,r,n){var i=e.x/65536,o=Math.floor(i),u=65536*(i-o);i=e.y/65536;var s=Math.floor(i),c=65536*(i-s);a.octDecodeFloat(u,t),a.octDecodeFloat(c,r),a.octDecode(o,s,n)},a.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,r=1===e.y?4095:0|4096*e.y;return 4096*t+r},a.decompressTextureCoordinates=function(e,t){var r=e/4096;return t.x=Math.floor(r)/4096,t.y=r-Math.floor(r),t},a}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=new t,i=new t,a=new t,o=function(o,u,s,c,l){r(l)||(l=new t);var f,d,h,m,y,p,v,g;r(u.z)?(f=t.subtract(s,u,n),d=t.subtract(c,u,i),h=t.subtract(o,u,a),m=t.dot(f,f),y=t.dot(f,d),p=t.dot(f,h),v=t.dot(d,d),g=t.dot(d,h)):(f=e.subtract(s,u,n),d=e.subtract(c,u,i),h=e.subtract(o,u,a),m=e.dot(f,f),y=e.dot(f,d),p=e.dot(f,h),v=e.dot(d,d),g=e.dot(d,h));var w=1/(m*v-y*y);return l.y=(v*p-y*g)*w,l.z=(m*g-y*p)*w,l.x=1-l.y-l.z,l};return o}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};r.encode=function(e,r){t(r)||(r={high:0,low:0});var n;return e>=0?(n=65536*Math.floor(e/65536),r.high=n,r.low=e-n):(n=65536*Math.floor(-e/65536),r.high=-n,r.low=e+n),r};var n={high:0,low:0};r.fromCartesian=function(e,i){t(i)||(i=new r);var a=i.high,o=i.low;return r.encode(e.x,n),a.x=n.high,o.x=n.low,r.encode(e.y,n),a.y=n.high,o.y=n.low,r.encode(e.z,n),a.z=n.high,o.z=n.low,i};var i=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,i);var a=i.high,o=i.low;t[n]=a.x,t[n+1]=a.y,t[n+2]=a.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z},r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(t){return e(t)&&(t===i.UNSIGNED_BYTE||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)},i.createTypedArray=function(e,t){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},i.createTypedArrayFromArrayBuffer=function(e,t,r,i){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,i):new Uint16Array(t,r,i)},r(i)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var i=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(r)))<n?0:i}var n={};return n.computeDiscriminant=function(e,t,r){var n=t*t-4*e*r;return n},n.computeRealRoots=function(e,n,i){var a;if(0===e)return 0===n?[]:[-i/n];if(0===n){if(0===i)return[0,0];var o=Math.abs(i),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(a=-i/e,0>a)return[];var s=Math.sqrt(a);return[-s,s]}if(0===i)return a=-n/e,0>a?[a,0]:[0,a];var c=n*n,l=4*e*i,f=r(c,-l,t.EPSILON14);if(0>f)return[];var d=-.5*r(n,t.sign(n)*Math.sqrt(f),t.EPSILON14);return n>0?[d/e,i/d]:[i/d,d/e]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var i,a,o=e,u=t/3,s=r/3,c=n,l=o*s,f=u*c,d=u*u,h=s*s,m=o*s-d,y=o*c-u*s,p=u*c-h,v=4*m*p-y*y;if(0>v){var g,w,x;d*f>=l*h?(g=o,w=m,x=-2*u*m+o*y):(g=c,w=p,x=-c*y+2*s*p);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);a=-x+S;var M=a/2,b=0>M?-Math.pow(-M,1/3):Math.pow(M,1/3),T=a===S?-b:-w/b;return i=0>=w?b+T:-x/(b*b+T*T+w),d*f>=l*h?[(i-u)/o]:[-c/(i+s)]}var A=m,O=-2*u*m+o*y,I=p,N=-c*y+2*s*p,z=Math.sqrt(v),_=Math.sqrt(3)/2,R=Math.abs(Math.atan2(o*z,-O)/3);i=2*Math.sqrt(-A);var P=Math.cos(R);a=i*P;var L=i*(-P/2-_*Math.sin(R)),C=a+L>2*u?a-u:L-u,q=o,D=C/q;R=Math.abs(Math.atan2(c*z,-N)/3),i=2*Math.sqrt(-I),P=Math.cos(R),a=i*P,L=i*(-P/2-_*Math.sin(R));var B=-c,U=2*s>a+L?a+s:L+s,F=B/U,G=q*U,k=-C*U-q*B,W=C*B,V=(s*k-u*W)/(-u*k+s*G);return V>=D?F>=D?F>=V?[D,V,F]:[D,F,V]:[F,D,V]:F>=D?[V,D,F]:F>=V?[V,F,D]:[F,V,D]}var n={};return n.computeDiscriminant=function(e,t,r,n){var i=e*e,a=t*t,o=r*r,u=n*n,s=18*e*t*r*n+a*o-27*i*u-4*(e*o*r+a*t*n);return s},n.computeRealRoots=function(e,n,i,a){var o,u;if(0===e)return t.computeRealRoots(n,i,a);if(0===n){if(0===i){if(0===a)return[0,0,0];u=-a/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===a?(o=t.computeRealRoots(e,0,i),0===o.Length?[0]:[o[0],0,o[1]]):r(e,0,i,a)}return 0===i?0===a?(u=-n/e,0>u?[u,0,0]:[0,0,u]):r(e,n,0,a):0===a?(o=t.computeRealRoots(e,n,i),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):r(e,n,i,a)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function i(t,i,a,o){var u=t*t,s=i-3*u/8,c=a-i*t/2+u*t/8,l=o-a*t/4+i*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var d=-t/4,h=f[f.length-1];if(Math.abs(h)<r.EPSILON14){var m=n.computeRealRoots(1,s,l);if(2===m.length){var y,p=m[0],v=m[1];if(p>=0&&v>=0){var g=Math.sqrt(p),w=Math.sqrt(v);return[d-w,d-g,d+g,d+w]}if(p>=0&&0>v)return y=Math.sqrt(p),[d-y,d+y];if(0>p&&v>=0)return y=Math.sqrt(v),[d-y,d+y]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,M=n.computeRealRoots(1,x,E),b=n.computeRealRoots(1,-x,S);return 0!==M.length?(M[0]+=d,M[1]+=d,0!==b.length?(b[0]+=d,b[1]+=d,M[1]<=b[0]?[M[0],M[1],b[0],b[1]]:b[1]<=M[0]?[b[0],b[1],M[0],M[1]]:M[0]>=b[0]&&M[1]<=b[1]?[b[0],M[0],M[1],b[1]]:b[0]>=M[0]&&b[1]<=M[1]?[M[0],b[0],b[1],M[1]]:M[0]>b[0]&&M[0]<b[1]?[b[0],M[0],b[1],M[1]]:[M[0],b[0],M[1],b[1]]):M):0!==b.length?(b[0]+=d,b[1]+=d,b):[]}}return[]}function a(t,i,a,o){var u=a*a,s=i*i,c=t*t,l=-2*i,f=a*t+s-4*o,d=c*o-a*i*t+u,h=e.computeRealRoots(1,l,f,d);if(h.length>0){var m,y,p=h[0],v=i-p,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),M=c-4*p,b=c+4*Math.abs(p);if(0>p||M*S>E*b){var T=Math.sqrt(M);m=T/2,y=0===T?0:(t*x-a)/T}else{var A=Math.sqrt(E);m=0===A?0:(t*x-a)/A,y=A/2}var O,I;0===w&&0===m?(O=0,I=0):r.sign(w)===r.sign(m)?(O=w+m,I=p/O):(I=w-m,O=p/I);var N,z;0===x&&0===y?(N=0,z=0):r.sign(x)===r.sign(y)?(N=x+y,z=o/N):(z=x-y,N=o/z);var _=n.computeRealRoots(1,O,N),R=n.computeRealRoots(1,I,z);if(0!==_.length)return 0!==R.length?_[1]<=R[0]?[_[0],_[1],R[0],R[1]]:R[1]<=_[0]?[R[0],R[1],_[0],_[1]]:_[0]>=R[0]&&_[1]<=R[1]?[R[0],_[0],_[1],R[1]]:R[0]>=_[0]&&R[1]<=_[1]?[_[0],R[0],R[1],_[1]]:_[0]>R[0]&&_[0]<R[1]?[R[0],_[0],R[1],_[1]]:[_[0],R[0],_[1],R[1]]:_;if(0!==R.length)return R}return[]}var o={};return o.computeDiscriminant=function(e,t,r,n,i){var a=e*e,o=a*e,u=t*t,s=u*t,c=r*r,l=c*r,f=n*n,d=f*n,h=i*i,m=h*i,y=u*c*f-4*s*d-4*e*l*f+18*e*t*r*d-27*a*f*f+256*o*m+i*(18*s*r*n-4*u*l+16*e*c*c-80*e*t*c*n-6*e*u*f+144*a*r*f)+h*(144*e*u*r-27*u*u-128*a*c-192*a*t*n);return y},o.computeRealRoots=function(t,n,o,u,s){if(Math.abs(t)<r.EPSILON15)return e.computeRealRoots(n,o,u,s);var c=n/t,l=o/t,f=u/t,d=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>d?h+1:h){case 0:return i(c,l,f,d);case 1:return a(c,l,f,d);case 2:return a(c,l,f,d);case 3:return i(c,l,f,d);case 4:return i(c,l,f,d);case 5:return a(c,l,f,d);case 6:return i(c,l,f,d);case 7:return i(c,l,f,d);case 8:return a(c,l,f,d);case 9:return i(c,l,f,d);case 10:return i(c,l,f,d);case 11:return a(c,l,f,d);case 12:return i(c,l,f,d);case 13:return i(c,l,f,d);case 14:return i(c,l,f,d);case 15:return i(c,l,f,d);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=function(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n};return n.getPoint=function(t,n,i){return r(i)||(i=new e),i=e.multiplyByScalar(t.direction,n,i),e.add(t.origin,i,i)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,i,a,o,u,s,c){"use strict";function l(t,n,i,o,u){u=r(u,!1);var s,c,l,f,d,h=t.origin,m=t.direction,y=e.subtract(i,n,p),E=e.subtract(o,n,v),S=e.cross(m,E,g),M=e.dot(y,S);if(u){if(M<a.EPSILON6)return void 0;if(s=e.subtract(h,n,w),l=e.dot(s,S),0>l||l>M)return void 0;if(c=e.cross(s,y,x),f=e.dot(m,c),0>f||l+f>M)return void 0;d=e.dot(E,c)/M}else{if(Math.abs(M)<a.EPSILON6)return void 0;var b=1/M;if(s=e.subtract(h,n,w),l=e.dot(s,S)*b,0>l||l>1)return void 0;if(c=e.cross(s,y,x),f=e.dot(m,c)*b,0>f||l+f>1)return void 0;d=e.dot(E,c)*b}return d}function f(e,t,r,n){var i=t*t-4*e*r;if(0>i)return void 0;if(i>0){var a=1/(2*e),o=Math.sqrt(i),u=(-t+o)*a,s=(-t-o)*a;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-t/(2*e);return 0===c?void 0:(n.root0=n.root1=c,n)}function d(t,r,i){n(i)||(i={});var a=t.origin,o=t.direction,u=r.center,s=r.radius*r.radius,c=e.subtract(a,u,g),l=e.dot(o,o),d=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=f(l,d,h,S);return n(m)?(i.start=m.root0,i.stop=m.root1,i):void 0}function h(e,t,r){var n=e+t;return a.sign(e)!==a.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))<r?0:n}function m(t,r,n,i,c){var l,f=i*i,d=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*d,y=c*(i*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],a.EPSILON15)+r.y),p=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*d+i*r.x+n,v=d*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],a.EPSILON15),g=c*(i*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+r.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,y,p),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(i,c*x,c*-E)),w.push(new e(i,c*x,c*E)),2===l.length){var S=l[1],M=Math.sqrt(Math.max(1-S*S,0));w.push(new e(i,c*S,c*-M)),w.push(new e(i,c*S,c*M))}return w}var b=g*g,T=v*v,A=m*m,O=g*v,I=A+T,N=2*(y*m+O),z=2*p*m+y*y-T+b,_=2*(p*y-O),R=p*p-b;if(0===I&&0===N&&0===z&&0===_)return w;l=s.computeRealRoots(I,N,z,_,R);var P=l.length;if(0===P)return w;for(var L=0;P>L;++L){var C,q=l[L],D=q*q,B=Math.max(1-D,0),U=Math.sqrt(B);C=a.sign(m)===a.sign(p)?h(m*D+p,y*q,a.EPSILON12):a.sign(p)===a.sign(y*q)?h(m*D,y*q+p,a.EPSILON12):h(m*D+y*q,p,a.EPSILON12);var F=h(v*q,g,a.EPSILON15),G=C*F;0>G?w.push(new e(i,c*q,c*U)):G>0?w.push(new e(i,c*q,c*-U)):0!==U?(w.push(new e(i,c*q,c*-U)),w.push(new e(i,c*q,c*U)),++L):w.push(new e(i,c*q,c*U))}return w}var y={};y.rayPlane=function(t,r,i){n(i)||(i=new e);var o=t.origin,u=t.direction,s=r.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON15)return void 0;var l=(-r.distance-e.dot(s,o))/c;return 0>l?void 0:(i=e.multiplyByScalar(u,l,i),e.add(o,i,i))};var p=new e,v=new e,g=new e,w=new e,x=new e;y.rayTriangle=function(t,r,i,a,o,u){var s=l(t,r,i,a,o);return!n(s)||0>s?void 0:(n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;y.lineSegmentTriangle=function(t,r,i,a,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(r,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,i,a,o,u);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};y.raySphere=function(e,t,r){return r=d(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var M=new c;y.lineSegmentSphere=function(t,r,i,a){var o=M;e.clone(t,o.origin);var u=e.subtract(r,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),a=d(o,i,a),!n(a)||a.stop<0||a.start>s?void 0:(a.start=Math.max(a.start,0),a.stop=Math.min(a.stop,s),a)};var b=new e,T=new e;y.rayEllipsoid=function(t,r){var n,i,a,o,u,s=r.oneOverRadii,c=e.multiplyComponents(s,t.origin,b),l=e.multiplyComponents(s,t.direction,T),f=e.magnitudeSquared(c),d=e.dot(c,l);if(f>1){if(d>=0)return void 0;var h=d*d;if(n=f-1,i=e.magnitudeSquared(l),a=i*n,a>h)return void 0;if(h>a){o=d*d-a,u=-d+Math.sqrt(o);var m=u/i,y=n/u;return y>m?{start:m,stop:y}:{start:y,stop:m}}var p=Math.sqrt(n/i);return{start:p,stop:p}}return 1>f?(n=f-1,i=e.magnitudeSquared(l),a=i*n,o=d*d-a,u=-d+Math.sqrt(o),{start:0,stop:u/i}):0>d?(i=e.magnitudeSquared(l),{start:0,stop:-d/i}):void 0};var A=new e,O=new e,I=new e,N=new e,z=new e,_=new o,R=new o,P=new o,L=new o,C=new o,q=new o,D=new o,B=new e,U=new e,F=new t;y.grazingAltitudeLocation=function(t,r){var i=t.origin,u=t.direction,s=r.geodeticSurfaceNormal(i,A);if(e.dot(u,s)>=0)return i;var c=n(this.rayEllipsoid(t,r)),l=r.transformPositionToScaledSpace(u,A),f=e.normalize(l,l),d=e.mostOrthogonalAxis(l,N),h=e.normalize(e.cross(d,f,O),O),y=e.normalize(e.cross(f,h,I),I),p=_;p[0]=f.x,p[1]=f.y,p[2]=f.z,p[3]=h.x,p[4]=h.y,p[5]=h.z,p[6]=y.x,p[7]=y.y,p[8]=y.z;var v=o.transpose(p,R),g=o.fromScale(r.radii,P),w=o.fromScale(r.oneOverRadii,L),x=C;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,M=o.multiply(o.multiply(v,w,q),x,q),b=o.multiply(o.multiply(M,g,D),p,D),T=o.multiplyByVector(M,i,z),G=m(b,e.negate(T,A),0,0,1),k=G.length;if(k>0){for(var W=e.clone(e.ZERO,U),V=Number.NEGATIVE_INFINITY,Y=0;k>Y;++Y){E=o.multiplyByVector(g,o.multiplyByVector(p,G[Y],B),B);var j=e.normalize(e.subtract(E,i,N),N),H=e.dot(j,u);H>V&&(V=H,W=e.clone(E,W))}var Z=r.cartesianToCartographic(W,F);return V=a.clamp(V,0,1),S=e.magnitude(e.subtract(W,i,N))*Math.sqrt(1-V*V),S=c?-S:S,Z.height=S,r.cartographicToCartesian(Z,new e)}return void 0};var G=new e;return y.lineSegmentPlane=function(t,r,i,o){n(o)||(o=new e);var u=e.subtract(r,t,G),s=i.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON6)return void 0;var l=e.dot(s,t),f=-(i.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},y.trianglePlaneIntersection=function(t,r,n,i){var a=i.normal,o=i.distance,u=e.dot(a,t)+o<0,s=e.dot(a,r)+o<0,c=e.dot(a,n)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,d;if((1===l||2===l)&&(f=new e,d=new e),1===l){if(u)return y.lineSegmentPlane(t,r,i,f),y.lineSegmentPlane(t,n,i,d),{positions:[t,r,n,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(s)return y.lineSegmentPlane(r,n,i,f),y.lineSegmentPlane(r,t,i,d),{positions:[t,r,n,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return y.lineSegmentPlane(n,t,i,f),y.lineSegmentPlane(n,r,i,d),{positions:[t,r,n,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return y.lineSegmentPlane(r,t,i,f),y.lineSegmentPlane(n,t,i,d),{positions:[t,r,n,f,d],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return y.lineSegmentPlane(n,r,i,f),y.lineSegmentPlane(t,r,i,d),{positions:[t,r,n,f,d],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return y.lineSegmentPlane(t,n,i,f),y.lineSegmentPlane(r,n,i,d),{positions:[t,r,n,f,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},y}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};return r.calculateACMR=function(r){r=e(r,e.EMPTY_OBJECT);var n=r.indices,i=r.maximumIndex,a=e(r.cacheSize,24),o=n.length;if(!t(i)){i=0;for(var u=0,s=n[u];o>u;)s>i&&(i=s),++u,s=n[u]}for(var c=[],l=0;i+1>l;l++)c[l]=0;for(var f=a+1,d=0;o>d;++d)f-c[n[d]]>a&&(c[n[d]]=f,++f);return(f-a+1)/(o/3)},r.tipsify=function(r){function n(e,t,r,n){for(;t.length>=1;){var i=t[t.length-1];if(t.splice(t.length-1,1),e[i].numLiveTriangles>0)return i}for(;n>a;){if(e[a].numLiveTriangles>0)return++a,a-1;++a}return-1}function i(e,t,r,i,a,o,u){for(var s,c=-1,l=-1,f=0;f<r.length;){var d=r[f];i[d].numLiveTriangles&&(s=0,a-i[d].timeStamp+2*i[d].numLiveTriangles<=t&&(s=a-i[d].timeStamp),(s>l||-1===l)&&(l=s,c=d)),++f}return-1===c?n(i,o,e,u):c}r=e(r,e.EMPTY_OBJECT);var a,o=r.indices,u=r.maximumIndex,s=e(r.cacheSize,24),c=o.length,l=0,f=0,d=o[f],h=c;if(t(u))l=u+1;else{for(;h>f;)d>l&&(l=d),++f,d=o[f];if(-1===l)return 0;++l}for(var m=[],y=0;l>y;y++)m[y]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var p=0;h>f;)m[o[f]].vertexTriangles.push(p),++m[o[f]].numLiveTriangles,m[o[f+1]].vertexTriangles.push(p),++m[o[f+1]].numLiveTriangles,m[o[f+2]].vertexTriangles.push(p),++m[o[f+2]].numLiveTriangles,++p,f+=3;var v=0,g=s+1;a=1;var w,x,E=[],S=[],M=0,b=[],T=c/3,A=[];for(y=0;T>y;y++)A[y]=!1;for(var O,I;-1!==v;){E=[],x=m[v],I=x.vertexTriangles.length;for(var N=0;I>N;++N)if(p=x.vertexTriangles[N],!A[p]){A[p]=!0,f=p+p+p;for(var z=0;3>z;++z)O=o[f],E.push(O),S.push(O),b[M]=O,++M,w=m[O],--w.numLiveTriangles,g-w.timeStamp>s&&(w.timeStamp=g,++g),++f}v=i(o,s,E,m,g,S,l)}return b},r}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,r,n,i,a,o,u,s,c,l,f,d,h,m,y,p,v,g,w,x,E,S,M,b,T){"use strict";function A(e,t,r,n,i){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=i,e[t++]=i,e[t]=r}function O(e){for(var t=e.length,r=6*(t/3),n=v.createTypedArray(t,r),i=0,a=0;t>a;a+=3,i+=6)A(n,i,e[a],e[a+1],e[a+2]);return n}function I(e){var t=e.length;if(t>=3){var r=6*(t-2),n=v.createTypedArray(t,r);A(n,0,e[0],e[1],e[2]);for(var i=6,a=3;t>a;++a,i+=6)A(n,i,e[a-1],e[a],e[a-2]);return n}return new Uint16Array}function N(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=v.createTypedArray(t,r),i=e[0],a=0,o=1;t>o;++o,a+=6)A(n,a,i,e[o],e[o+1]);return n}return new Uint16Array}function z(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new m({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function _(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var i=t[n],a=0;a<i.componentsPerAttribute;++a)e[n].values.push(i.values[r*i.componentsPerAttribute+a])}function R(e,t){if(c(t))for(var r=t.values,n=r.length,a=0;n>a;a+=3)i.unpack(r,a,at),S.multiplyByPoint(e,at,at),i.pack(at,r,a)}function P(e,t){if(c(t))for(var r=t.values,n=r.length,a=0;n>a;a+=3)i.unpack(r,a,at),E.multiplyByVector(e,at,at),at=i.normalize(at,at),i.pack(at,r,a)}function L(e,t){var r,n=e.length,i={},a=e[0][t].attributes;for(r in a)if(a.hasOwnProperty(r)&&c(a[r])&&c(a[r].values)){for(var o=a[r],s=o.values.length,l=!0,f=1;n>f;++f){var d=e[f][t].attributes[r];if(!c(d)||o.componentDatatype!==d.componentDatatype||o.componentsPerAttribute!==d.componentsPerAttribute||o.normalize!==d.normalize){l=!1;break}s+=d.values.length}l&&(i[r]=new m({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return i}function C(e,t){var n,a,o,u,s=e.length;e[0].modelMatrix;var l,f,d,m=c(e[0][t].indices),y=e[0][t].primitiveType,p=L(e,t);for(n in p)if(p.hasOwnProperty(n))for(l=p[n].values,u=0,a=0;s>a;++a)for(f=e[a][t].attributes[n].values,d=f.length,o=0;d>o;++o)l[u++]=f[o];var g;if(m){var w=0;for(a=0;s>a;++a)w+=e[a][t].indices.length;var x=h.computeNumberOfVertices(new h({attributes:p,primitiveType:b.POINTS})),E=v.createTypedArray(x,w),S=0,M=0;for(a=0;s>a;++a){var T=e[a][t].indices,A=T.length;for(u=0;A>u;++u)E[S++]=M+T[u];M+=h.computeNumberOfVertices(e[a][t])}g=E}var O,I=new i,N=0;for(a=0;s>a;++a){if(O=e[a][t].boundingSphere,!c(O)){I=void 0;break}i.add(O.center,I,I)}if(c(I))for(i.divideByScalar(I,s,I),a=0;s>a;++a){O=e[a][t].boundingSphere;var z=i.magnitude(i.subtract(O.center,I,st))+O.radius;z>N&&(N=z)}return new h({attributes:p,indices:g,primitiveType:y,boundingSphere:c(I)?new r(I,N):void 0})}function q(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function D(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,i=3;t>i;++i)r[n++]=i-1,r[n++]=0,r[n++]=i;return e.indices=r,e.primitiveType=b.TRIANGLES,e}function B(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,i=3;t-1>i;i+=2)r[n++]=i,r[n++]=i-1,r[n++]=i+1,t>i+2&&(r[n++]=i,r[n++]=i+1,r[n++]=i+2);return e.indices=r,e.primitiveType=b.TRIANGLES,e}function U(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function F(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,i=2;t>i;++i)r[n++]=i-1,r[n++]=i;return e.indices=r,e.primitiveType=b.LINES,e}function G(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,i=2;t>i;++i)r[n++]=i-1,r[n++]=i;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=b.LINES,e}function k(e){switch(e.primitiveType){case b.TRIANGLE_FAN:return D(e);case b.TRIANGLE_STRIP:return B(e);case b.TRIANGLES:return q(e);case b.LINE_STRIP:return F(e);case b.LINE_LOOP:return G(e);case b.LINES:return U(e)}return e}function W(e,t){Math.abs(e.y)<x.EPSILON6&&(e.y=t?-x.EPSILON6:x.EPSILON6)}function V(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return W(e,e.y<0),W(t,t.y<0),W(r,r.y<0),void 0;var n,i=Math.abs(e.y),a=Math.abs(t.y),o=Math.abs(r.y);n=i>a?i>o?x.sign(e.y):x.sign(r.y):a>o?x.sign(t.y):x.sign(r.y);var u=0>n;W(e,u),W(t,u),W(r,u)}function Y(e,t,r,n){i.add(e,i.multiplyByScalar(i.subtract(t,e,xt),e.y/(e.y-t.y),xt),r),i.clone(r,n),W(r,!0),W(n,!1)}function j(e,t,r){if(e.x>=0||t.x>=0||r.x>=0)return void 0;V(e,t,r);var n=e.y<0,i=t.y<0,a=r.y<0,o=0;o+=n?1:0,o+=i?1:0,o+=a?1:0;var u=Tt.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(Y(e,t,Et,Mt),Y(e,r,St,bt),u[0]=0,u[3]=1,u[4]=2,u[6]=1):i?(Y(t,r,Et,Mt),Y(t,e,St,bt),u[0]=1,u[3]=2,u[4]=0,u[6]=2):a&&(Y(r,e,Et,Mt),Y(r,t,St,bt),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,n?i?a||(Y(r,e,Et,Mt),Y(r,t,St,bt),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(Y(t,r,Et,Mt),Y(t,e,St,bt),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(Y(e,t,Et,Mt),Y(e,r,St,bt),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=Tt.positions;return s[0]=e,s[1]=t,s[2]=r,s.length=3,(1===o||2===o)&&(s[3]=Et,s[4]=St,s[5]=Mt,s[6]=bt,s.length=7),Tt}function H(e,t){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var i in n)if(n.hasOwnProperty(i)&&c(n[i])&&c(n[i].values)){var a=n[i]; -a.values=u.createTypedArray(a.componentDatatype,a.values)}var o=h.computeNumberOfVertices(e);return e.indices=v.createTypedArray(o,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}function Z(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var i=t[n];r[n]=new m({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return new h({attributes:r,indices:[],primitiveType:e.primitiveType})}function X(e,t,r){var n=c(e.geometry.boundingSphere);t=H(t,n),r=H(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function Q(e,r,a,o,u,s,l,f,d,h,m){if(c(s)||c(l)||c(f)||c(d)){var y=i.fromArray(u,3*e,At),p=i.fromArray(u,3*r,Ot),v=i.fromArray(u,3*a,It),g=t(o,y,p,v,Nt);if(c(s)){var w=i.fromArray(s,3*e,At),x=i.fromArray(s,3*r,Ot),E=i.fromArray(s,3*a,It);i.multiplyByScalar(w,g.x,w),i.multiplyByScalar(x,g.y,x),i.multiplyByScalar(E,g.z,E);var S=i.add(w,x,w);i.add(S,E,S),i.normalize(S,S),i.pack(S,h.normal.values,3*m)}if(c(l)){var M=i.fromArray(l,3*e,At),b=i.fromArray(l,3*r,Ot),T=i.fromArray(l,3*a,It);i.multiplyByScalar(M,g.x,M),i.multiplyByScalar(b,g.y,b),i.multiplyByScalar(T,g.z,T);var A=i.add(M,b,M);i.add(A,T,A),i.normalize(A,A),i.pack(A,h.binormal.values,3*m)}if(c(f)){var O=i.fromArray(f,3*e,At),I=i.fromArray(f,3*r,Ot),N=i.fromArray(f,3*a,It);i.multiplyByScalar(O,g.x,O),i.multiplyByScalar(I,g.y,I),i.multiplyByScalar(N,g.z,N);var z=i.add(O,I,O);i.add(z,N,z),i.normalize(z,z),i.pack(z,h.tangent.values,3*m)}if(c(d)){var _=n.fromArray(d,2*e,zt),R=n.fromArray(d,2*r,_t),P=n.fromArray(d,2*a,Rt);n.multiplyByScalar(_,g.x,_),n.multiplyByScalar(R,g.y,R),n.multiplyByScalar(P,g.z,P);var L=n.add(_,R,_);n.add(L,P,L),n.pack(L,h.st.values,2*m)}}}function K(e,t,r,n,i,a){var o=e.position.values.length/3;if(-1!==i){var u=n[i],s=r[u];return-1===s?(r[u]=o,e.position.values.push(a.x,a.y,a.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(a.x,a.y,a.z),t.push(o),o}function J(e){var t,r,n,a,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,d=c(s.binormal)?s.binormal.values:void 0,h=c(s.tangent)?s.tangent.values:void 0,m=c(s.st)?s.st.values:void 0,y=u.indices,p=Z(u),v=Z(u),g=[];g.length=l.length/3;var w=[];for(w.length=l.length/3,o=0;o<g.length;++o)g[o]=-1,w[o]=-1;var x=y.length;for(o=0;x>o;o+=3){var E=y[o],S=y[o+1],M=y[o+2],b=i.fromArray(l,3*E),T=i.fromArray(l,3*S),A=i.fromArray(l,3*M),O=j(b,T,A);if(c(O)&&O.positions.length>3)for(var I=O.positions,N=O.indices,z=N.length,_=0;z>_;++_){var R=N[_],P=I[R];P.y<0?(t=v.attributes,r=v.indices,n=g):(t=p.attributes,r=p.indices,n=w),a=K(t,r,n,y,3>R?o+R:-1,P),Q(E,S,M,P,l,f,d,h,m,t,a)}else c(O)&&(b=O.positions[0],T=O.positions[1],A=O.positions[2]),b.y<0?(t=v.attributes,r=v.indices,n=g):(t=p.attributes,r=p.indices,n=w),a=K(t,r,n,y,o,b),Q(E,S,M,b,l,f,d,h,m,t,a),a=K(t,r,n,y,o+1,T),Q(E,S,M,T,l,f,d,h,m,t,a),a=K(t,r,n,y,o+2,A),Q(E,S,M,A,l,f,d,h,m,t,a)}X(e,v,p)}function $(e){var t,r=e.geometry,n=r.attributes,a=n.position.values,o=r.indices,u=Z(r),s=Z(r),l=o.length,f=[];f.length=a.length/3;var d=[];for(d.length=a.length/3,t=0;t<f.length;++t)f[t]=-1,d[t]=-1;for(t=0;l>t;t+=2){var h=o[t],m=o[t+1],y=i.fromArray(a,3*h,At),p=i.fromArray(a,3*m,Ot);Math.abs(y.y)<x.EPSILON6&&(y.y=y.y<0?-x.EPSILON6:x.EPSILON6),Math.abs(p.y)<x.EPSILON6&&(p.y=p.y<0?-x.EPSILON6:x.EPSILON6);var v=u.attributes,g=u.indices,E=d,S=s.attributes,M=s.indices,b=f,T=w.lineSegmentPlane(y,p,Pt,It);if(c(T)){var A=i.multiplyByScalar(i.UNIT_Y,5*x.EPSILON9,Lt);y.y<0&&(i.negate(A,A),v=s.attributes,g=s.indices,E=f,S=u.attributes,M=u.indices,b=d);var O=i.add(T,A,Ct);K(v,g,E,o,t,y),K(v,g,E,o,-1,O),i.negate(A,A),i.add(T,A,O),K(S,M,b,o,-1,O),K(S,M,b,o,t+1,p)}else{var I,N,z;y.y<0?(I=s.attributes,N=s.indices,z=f):(I=u.attributes,N=u.indices,z=d),K(I,N,z,o,t,y),K(I,N,z,o,t+1,p)}}X(e,s,u)}function et(e){var t=e.geometry,r=t.attributes,o=r.position.values,u=r.prevPosition.values,s=r.nextPosition.values,l=r.expandAndWidth.values;t.indices;var f,d,h,m=c(r.st)?r.st.values:void 0,y=c(r.color)?r.color.values:void 0,p=Z(t),v=Z(t),g=o.length/3;for(f=0;g>f;f+=4){var E=f,S=f+1,M=f+2,b=f+3,T=i.fromArray(o,3*E,Bt),A=i.fromArray(o,3*S,Ut),O=i.fromArray(o,3*M,Ft),I=i.fromArray(o,3*b,Gt);Math.abs(T.y)<x.EPSILON6&&(T.y=x.EPSILON6*(O.y<0?-1:1),A.y=T.y),Math.abs(O.y)<x.EPSILON6&&(O.y=x.EPSILON6*(T.y<0?-1:1),I.y=O.y);var N=p.attributes,z=p.indices,_=v.attributes,R=v.indices,P=w.lineSegmentPlane(T,O,Pt,kt);if(c(P)){var L=i.multiplyByScalar(i.UNIT_Y,5*x.EPSILON9,Wt);T.y<0&&(i.negate(L,L),N=v.attributes,z=v.indices,_=p.attributes,R=p.indices);var C=i.add(P,L,Vt);for(N.position.values.push(T.x,T.y,T.z,A.x,A.y,A.z),N.position.values.push(C.x,C.y,C.z),N.position.values.push(C.x,C.y,C.z),i.negate(L,L),i.add(P,L,C),_.position.values.push(C.x,C.y,C.z),_.position.values.push(C.x,C.y,C.z),_.position.values.push(O.x,O.y,O.z,I.x,I.y,I.z),d=3*E;3*E+6>d;++d)N.prevPosition.values.push(u[d]);for(N.prevPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),_.prevPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),d=3*M;3*M+6>d;++d)_.prevPosition.values.push(u[d]);for(d=3*E;3*E+6>d;++d)N.nextPosition.values.push(s[d]);for(N.nextPosition.values.push(O.x,O.y,O.z,O.x,O.y,O.z),_.nextPosition.values.push(O.x,O.y,O.z,O.x,O.y,O.z),d=3*M;3*M+6>d;++d)_.nextPosition.values.push(s[d]);var q=n.fromArray(l,2*E,qt),D=Math.abs(q.y);N.expandAndWidth.values.push(-1,D,1,D),N.expandAndWidth.values.push(-1,-D,1,-D),_.expandAndWidth.values.push(-1,D,1,D),_.expandAndWidth.values.push(-1,-D,1,-D);var B=i.magnitudeSquared(i.subtract(P,T,Gt));if(B/=i.magnitudeSquared(i.subtract(O,T,Gt)),c(y)){var U=a.fromArray(y,4*E,Yt),F=a.fromArray(y,4*M,Yt),G=x.lerp(U.x,F.x,B),k=x.lerp(U.y,F.y,B),W=x.lerp(U.z,F.z,B),V=x.lerp(U.w,F.w,B);for(d=4*E;4*E+8>d;++d)N.color.values.push(y[d]);for(N.color.values.push(G,k,W,V),N.color.values.push(G,k,W,V),_.color.values.push(G,k,W,V),_.color.values.push(G,k,W,V),d=4*M;4*M+8>d;++d)_.color.values.push(y[d])}if(c(m)){var Y=n.fromArray(m,2*E,qt),j=n.fromArray(m,2*(f+3),Dt),H=x.lerp(Y.x,j.x,B);for(d=2*E;2*E+4>d;++d)N.st.values.push(m[d]);for(N.st.values.push(H,Y.y),N.st.values.push(H,j.y),_.st.values.push(H,Y.y),_.st.values.push(H,j.y),d=2*M;2*M+4>d;++d)_.st.values.push(m[d])}h=N.position.values.length/3-4,z.push(h,h+2,h+1),z.push(h+1,h+2,h+3),h=_.position.values.length/3-4,R.push(h,h+2,h+1),R.push(h+1,h+2,h+3)}else{var Q,K;for(T.y<0?(Q=v.attributes,K=v.indices):(Q=p.attributes,K=p.indices),Q.position.values.push(T.x,T.y,T.z),Q.position.values.push(A.x,A.y,A.z),Q.position.values.push(O.x,O.y,O.z),Q.position.values.push(I.x,I.y,I.z),d=3*f;3*f+12>d;++d)Q.prevPosition.values.push(u[d]),Q.nextPosition.values.push(s[d]);for(d=2*f;2*f+8>d;++d)Q.expandAndWidth.values.push(l[d]),c(m)&&Q.st.values.push(m[d]);if(c(y))for(d=4*f;4*f+16>d;++d)Q.color.values.push(y[d]);h=Q.position.values.length/3-4,K.push(h,h+2,h+1),K.push(h+1,h+2,h+3)}}X(e,v,p)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case b.TRIANGLES:e.indices=O(t);break;case b.TRIANGLE_STRIP:e.indices=I(t);break;case b.TRIANGLE_FAN:e.indices=N(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=b.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,n){t=s(t,"normal"),n=s(n,1e4);for(var i=e.attributes.position.values,a=e.attributes[t].values,o=i.length,l=new Float64Array(2*o),f=0,d=0;o>d;d+=3)l[f++]=i[d],l[f++]=i[d+1],l[f++]=i[d+2],l[f++]=i[d]+a[d]*n,l[f++]=i[d+1]+a[d+1]*n,l[f++]=i[d+2]+a[d+2]*n;var y,p=e.boundingSphere;return c(p)&&(y=new r(p.center,p.radius+n)),new h({attributes:{position:new m({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:b.LINES,boundingSphere:y})},tt.createAttributeLocations=function(e){var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,i={},a=0,o=r.length;for(t=0;o>t;++t){var u=r[t];c(n[u])&&(i[u]=a++)}for(var s in n)n.hasOwnProperty(s)&&!c(i[s])&&(i[s]=a++);return i},tt.reorderForPreVertexCache=function(e){var t=h.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),i=0;t>i;i++)n[i]=-1;for(var a,o=r,s=o.length,l=v.createTypedArray(t,s),f=0,d=0,m=0;s>f;)a=n[o[f]],-1!==a?l[d]=a:(a=o[f],n[a]=m,l[d]=m,++m),++f,++d;e.indices=l;var y=e.attributes;for(var p in y)if(y.hasOwnProperty(p)&&c(y[p])&&c(y[p].values)){for(var g=y[p],w=g.values,x=0,E=g.componentsPerAttribute,S=u.createTypedArray(g.componentDatatype,m*E);t>x;){var M=n[x];if(-1!==M)for(i=0;E>i;i++)S[E*M+i]=w[E*x+i];++x}g.values=S}}return e},tt.reorderForPostVertexCache=function(e,t){var r=e.indices;if(e.primitiveType===b.TRIANGLES&&c(r)){for(var n=r.length,i=0,a=0;n>a;a++)r[a]>i&&(i=r[a]);e.indices=T.tipsify({indices:r,maximumIndex:i,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],r=h.computeNumberOfVertices(e);if(c(e.indices)&&r>x.SIXTY_FOUR_KILOBYTES){var n,i=[],a=[],o=0,u=z(e.attributes),s=e.indices,l=s.length;e.primitiveType===b.TRIANGLES?n=3:e.primitiveType===b.LINES?n=2:e.primitiveType===b.POINTS&&(n=1);for(var f=0;l>f;f+=n){for(var d=0;n>d;++d){var m=s[f+d],y=i[m];c(y)||(y=o++,i[m]=y,_(u,e.attributes,m)),a.push(y)}o+n>x.SIXTY_FOUR_KILOBYTES&&(t.push(new h({attributes:u,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],a=[],o=0,u=z(e.attributes))}0!==a.length&&t.push(new h({attributes:u,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var rt=new i,nt=new o;tt.projectTo2D=function(e,t,r,n,a){var o=e.attributes[t];a=c(a)?a:new d;for(var s=a.ellipsoid,f=o.values,h=new Float64Array(f.length),y=0,p=0;p<f.length;p+=3){var v=i.fromArray(f,p,rt),g=s.cartesianToCartographic(v,nt);if(!c(g))throw new l("Could not project point ("+v.x+", "+v.y+", "+v.z+") to 2D.");var w=a.project(g,rt);h[y++]=w.x,h[y++]=w.y,h[y++]=w.z}return e.attributes[r]=o,e.attributes[n]=new m({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:h}),delete e.attributes[t],e};var it={high:0,low:0};tt.encodeAttribute=function(e,t,r,n){for(var i=e.attributes[t],a=i.values,o=a.length,s=new Float32Array(o),c=new Float32Array(o),l=0;o>l;++l)f.encode(a[l],it),s[l]=it.high,c[l]=it.low;var d=i.componentsPerAttribute;return e.attributes[r]=new m({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:s}),e.attributes[n]=new m({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:c}),delete e.attributes[t],e};var at=new i,ot=new S,ut=new E;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(S.equals(t,S.IDENTITY))return e;var n=e.geometry.attributes;R(t,n.position),R(t,n.prevPosition),R(t,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(S.inverse(t,ot),S.transpose(ot,ot),S.getRotation(ot,ut),P(ut,n.normal),P(ut,n.binormal),P(ut,n.tangent));var i=e.geometry.boundingSphere;return c(i)&&(e.geometry.boundingSphere=r.transform(i,t,i)),e.modelMatrix=S.clone(S.IDENTITY),e};var st=new i;tt.combineInstances=function(e){for(var t=[],r=[],n=e.length,i=0;n>i;++i){var a=e[i];c(a.geometry)?t.push(a):r.push(a)}var o=[];return t.length>0&&o.push(C(t,"geometry")),r.length>0&&(o.push(C(r,"westHemisphereGeometry")),o.push(C(r,"eastHemisphereGeometry"))),o};var ct=new i,lt=new i,ft=new i,dt=new i;tt.computeNormal=function(e){for(var t=e.indices,r=e.attributes,n=r.position.values,a=r.position.values.length/3,o=t.length,s=new Array(a),c=new Array(o/3),l=new Array(o),f=0;a>f;f++)s[f]={indexOffset:0,count:0,currentCount:0};var d=0;for(f=0;o>f;f+=3){var h=t[f],y=t[f+1],p=t[f+2],v=3*h,g=3*y,w=3*p;lt.x=n[v],lt.y=n[v+1],lt.z=n[v+2],ft.x=n[g],ft.y=n[g+1],ft.z=n[g+2],dt.x=n[w],dt.y=n[w+1],dt.z=n[w+2],s[h].count++,s[y].count++,s[p].count++,i.subtract(ft,lt,ft),i.subtract(dt,lt,dt),c[d]=i.cross(ft,dt,new i),d++}var x=0;for(f=0;a>f;f++)s[f].indexOffset+=x,x+=s[f].count;d=0;var E;for(f=0;o>f;f+=3){E=s[t[f]];var S=E.indexOffset+E.currentCount;l[S]=d,E.currentCount++,E=s[t[f+1]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,E=s[t[f+2]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,d++}var M=new Float32Array(3*a);for(f=0;a>f;f++){var b=3*f;if(E=s[f],E.count>0){for(i.clone(i.ZERO,ct),d=0;d<E.count;d++)i.add(ct,c[l[E.indexOffset+d]],ct);i.normalize(ct,ct),M[b]=ct.x,M[b+1]=ct.y,M[b+2]=ct.z}else M[b]=0,M[b+1]=0,M[b+2]=1}return e.attributes.normal=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:M}),e};var ht=new i,mt=new i,yt=new i;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,r=e.attributes.position.values,n=e.attributes.normal.values,a=e.attributes.st.values,o=e.attributes.position.values.length/3,s=t.length,c=new Array(3*o),l=0;l<c.length;l++)c[l]=0;var f,d,h;for(l=0;s>l;l+=3){var y=t[l],p=t[l+1],v=t[l+2];f=3*y,d=3*p,h=3*v;var g=2*y,w=2*p,x=2*v,E=r[f],S=r[f+1],M=r[f+2],b=a[g],T=a[g+1],A=a[w+1]-T,O=a[x+1]-T,I=1/((a[w]-b)*O-(a[x]-b)*A),N=(O*(r[d]-E)-A*(r[h]-E))*I,z=(O*(r[d+1]-S)-A*(r[h+1]-S))*I,_=(O*(r[d+2]-M)-A*(r[h+2]-M))*I;c[f]+=N,c[f+1]+=z,c[f+2]+=_,c[d]+=N,c[d+1]+=z,c[d+2]+=_,c[h]+=N,c[h+1]+=z,c[h+2]+=_}var R=new Float32Array(3*o),P=new Float32Array(3*o);for(l=0;o>l;l++){f=3*l,d=f+1,h=f+2;var L=i.fromArray(n,f,ht),C=i.fromArray(c,f,yt),q=i.dot(L,C);i.multiplyByScalar(L,q,mt),i.normalize(i.subtract(C,mt,C),C),P[f]=C.x,P[d]=C.y,P[h]=C.z,i.normalize(i.cross(L,C,C),C),R[f]=C.x,R[d]=C.y,R[h]=C.z}return e.attributes.tangent=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:P}),e.attributes.binormal=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:R}),e};var pt=new n,vt=new i,gt=new i,wt=new i;tt.compressVertices=function(t){var r=t.attributes.normal,a=t.attributes.st;if(!c(r)&&!c(a))return t;var o,s,l,f,d=t.attributes.tangent,h=t.attributes.binormal;c(r)&&(o=r.values),c(a)&&(s=a.values),c(d)&&(l=d.values),h&&(f=h.values);var y=c(o)?o.length:s.length,p=c(o)?3:2,v=y/p,g=v,w=c(s)&&c(o)?2:1;w+=c(l)||c(f)?1:0,g*=w;for(var x=new Float32Array(g),E=0,S=0;v>S;++S){c(s)&&(n.fromArray(s,2*S,pt),x[E++]=e.compressTextureCoordinates(pt));var M=3*S;c(o)&&c(l)&&c(f)?(i.fromArray(o,M,vt),i.fromArray(l,M,gt),i.fromArray(f,M,wt),e.octPack(vt,gt,wt,pt),x[E++]=pt.x,x[E++]=pt.y):(c(o)&&(i.fromArray(o,M,vt),x[E++]=e.octEncodeFloat(vt)),c(l)&&(i.fromArray(l,M,vt),x[E++]=e.octEncodeFloat(vt)),c(f)&&(i.fromArray(f,M,vt),x[E++]=e.octEncodeFloat(vt)))}return t.attributes.compressedAttributes=new m({componentDatatype:u.FLOAT,componentsPerAttribute:w,values:x}),c(o)&&delete t.attributes.normal,c(s)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var xt=new i,Et=new i,St=new i,Mt=new i,bt=new i,Tt={positions:new Array(7),indices:new Array(9)},At=new i,Ot=new i,It=new i,Nt=new i,zt=new n,_t=new n,Rt=new n,Pt=M.fromPointNormal(i.ZERO,i.UNIT_Y),Lt=new i,Ct=new i,qt=new n,Dt=new n,Bt=new i,Ut=new i,Ft=new i,Gt=new i,kt=new i,Wt=new i,Vt=new i,Yt=new a;return new a,tt.splitLongitude=function(e){var t=e.geometry,n=t.boundingSphere;if(c(n)){var i=n.center.x-n.radius;if(i>0||r.intersectPlane(n,M.ORIGIN_ZX_PLANE)!==g.INTERSECTING)return e}if(t.geometryType!==p.NONE)switch(t.geometryType){case p.POLYLINES:et(e);break;case p.TRIANGLES:J(e);break;case p.LINES:$(e)}else k(t),t.primitiveType===b.TRIANGLES?J(e):t.primitiveType===b.LINES&&$(e);return e},tt}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return i.POSITION_ONLY=n(new i({position:!0})),i.POSITION_AND_NORMAL=n(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=n(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=n(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=n(new i({position:!0,color:!0})),i.ALL=n(new i({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.position?1:0,r[n++]=t.normal?1:0,r[n++]=t.st?1:0,r[n++]=t.binormal?1:0,r[n++]=t.tangent?1:0,r[n++]=t.color?1:0},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.position=1===r[n++],a.normal=1===r[n++],a.st=1===r[n++],a.binormal=1===r[n++],a.tangent=1===r[n++],a.color=1===r[n++],a},i.clone=function(e,r){return t(e)?(t(r)||(r=new i),r.position=e.position,r.normal=e.normal,r.st=e.st,r.binormal=e.binormal,r.tangent=e.tangent,r.color=e.color,r):void 0},i}),define("Core/EllipseGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EllipseGeometryLibrary","./Ellipsoid","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix3","./PrimitiveType","./Quaternion","./VertexFormat"],function(e,t,r,n,i,a,o,u,s,c,l,f,d,h,m,y,p,v,g,w,x,E){"use strict";function S(e,n,a){var o=n.vertexFormat,u=n.center,c=n.semiMajorAxis,f=n.semiMinorAxis,m=n.ellipsoid,y=n.stRotation,p=a?2*(e.length/3):e.length/3,v=o.st?new Float32Array(2*p):void 0,w=o.normal?new Float32Array(3*p):void 0,E=o.tangent?new Float32Array(3*p):void 0,S=o.binormal?new Float32Array(3*p):void 0,M=0,b=C,T=q,A=D,O=new l(m),_=O.project(m.cartesianToCartographic(u,B),U),k=m.scaleToGeodeticSurface(u,I);m.geodeticSurfaceNormal(k,k);for(var W=x.fromAxisAngle(k,y,L),V=g.fromQuaternion(W,P),Y=t.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,F),j=t.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,G),H=e.length,Z=a?H:0,X=2*(Z/3),Q=0;H>Q;Q+=3){var K=Q+1,J=Q+2,$=r.fromArray(e,Q,I);if(o.st){var et=g.multiplyByVector(V,$,N),tt=O.project(m.cartesianToCartographic(et,B),z);r.subtract(tt,_,tt),R.x=(tt.x+c)/(2*c),R.y=(tt.y+f)/(2*f),Y.x=Math.min(R.x,Y.x),Y.y=Math.min(R.y,Y.y),j.x=Math.max(R.x,j.x),j.y=Math.max(R.y,j.y),a&&(v[M+X]=R.x,v[M+1+X]=R.y),v[M++]=R.x,v[M++]=R.y}b=m.geodeticSurfaceNormal($,b),(o.normal||o.tangent||o.binormal)&&((o.tangent||o.binormal)&&(T=r.cross(r.UNIT_Z,b,T),g.multiplyByVector(V,T,T)),o.normal&&(w[Q]=b.x,w[K]=b.y,w[J]=b.z,a&&(w[Q+Z]=-b.x,w[K+Z]=-b.y,w[J+Z]=-b.z)),o.tangent&&(E[Q]=T.x,E[K]=T.y,E[J]=T.z,a&&(E[Q+Z]=-T.x,E[K+Z]=-T.y,E[J+Z]=-T.z)),o.binormal&&(A=r.cross(b,T,A),S[Q]=A.x,S[K]=A.y,S[J]=A.z,a&&(S[Q+Z]=A.x,S[K+Z]=A.y,S[J+Z]=A.z)))}if(o.st){H=v.length;for(var rt=0;H>rt;rt+=2)v[rt]=(v[rt]-Y.x)/(j.x-Y.x),v[rt+1]=(v[rt+1]-Y.y)/(j.y-Y.y)}var nt=new h;if(o.position){var it=s.raisePositionsToHeight(e,n,a);nt.position=new d({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:it})}return o.st&&(nt.st=new d({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:v})),o.normal&&(nt.normal=new d({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:w})),o.tangent&&(nt.tangent=new d({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:E})),o.binormal&&(nt.binormal=new d({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:S})),nt}function M(e){var t,r,n,i,a,o=new Array(2*e*(e+1)),u=0;for(i=1;e>i;++i){for(n=i*(i+1),t=(i-1)*i,o[u++]=n++,o[u++]=t,o[u++]=n,r=2*i,a=0;r-1>a;++a)o[u++]=n,o[u++]=t++,o[u++]=t,o[u++]=n++,o[u++]=t,o[u++]=n;o[u++]=n++,o[u++]=t,o[u++]=n}for(r=2*e,++n,++t,i=0;r-1>i;++i)o[u++]=n,o[u++]=t++,o[u++]=t,o[u++]=n++,o[u++]=t,o[u++]=n;for(++t,++n,i=e-1;i>0;--i){for(o[u++]=t++,o[u++]=t,o[u++]=n,r=2*i,a=0;r-1>a;++a)o[u++]=n,o[u++]=t++,o[u++]=t,o[u++]=n++,o[u++]=t,o[u++]=n;o[u++]=t++,o[u++]=t++,o[u++]=n++}return o}function b(t){var n=t.center;k=r.multiplyByScalar(t.ellipsoid.geodeticSurfaceNormal(n,k),t.height,k),k=r.add(n,k,k);var i=new e(k,t.semiMajorAxis),a=s.computeEllipsePositions(t,!0,!1),o=a.positions,u=a.numPts,c=S(o,t,!1),l=M(u);return l=p.createTypedArray(o.length/3,l),{boundingSphere:i,attributes:c,indices:l}}function T(e,n){var a=n.vertexFormat,o=n.center,u=n.semiMajorAxis,s=n.semiMinorAxis,c=n.ellipsoid,f=n.height,m=n.extrudedHeight,y=n.stRotation,p=2*(e.length/3),v=new Float64Array(3*p),w=a.st?new Float32Array(2*p):void 0,E=a.normal?new Float32Array(3*p):void 0,S=a.tangent?new Float32Array(3*p):void 0,M=a.binormal?new Float32Array(3*p):void 0,b=0,T=C,A=q,O=D,k=new l(c),W=k.project(c.cartesianToCartographic(o,B),U),V=c.scaleToGeodeticSurface(o,I);c.geodeticSurfaceNormal(V,V);for(var Y=x.fromAxisAngle(V,y,L),j=g.fromQuaternion(Y,P),H=t.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,F),Z=t.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,G),X=e.length,Q=2*(X/3),K=0;X>K;K+=3){var J,$=K+1,et=K+2,tt=r.fromArray(e,K,I);if(a.st){var rt=g.multiplyByVector(j,tt,N),nt=k.project(c.cartesianToCartographic(rt,B),z);r.subtract(nt,W,nt),R.x=(nt.x+u)/(2*u),R.y=(nt.y+s)/(2*s),H.x=Math.min(R.x,H.x),H.y=Math.min(R.y,H.y),Z.x=Math.max(R.x,Z.x),Z.y=Math.max(R.y,Z.y),w[b+Q]=R.x,w[b+1+Q]=R.y,w[b++]=R.x,w[b++]=R.y}tt=c.scaleToGeodeticSurface(tt,tt),J=r.clone(tt,N),T=c.geodeticSurfaceNormal(tt,T);var it=r.multiplyByScalar(T,f,_);if(tt=r.add(tt,it,tt),it=r.multiplyByScalar(T,m,it),J=r.add(J,it,J),a.position&&(v[K+X]=J.x,v[$+X]=J.y,v[et+X]=J.z,v[K]=tt.x,v[$]=tt.y,v[et]=tt.z),a.normal||a.tangent||a.binormal){O=r.clone(T,O);var at=r.fromArray(e,(K+3)%X,_);r.subtract(at,tt,at);var ot=r.subtract(J,tt,z);T=r.normalize(r.cross(ot,at,T),T),a.normal&&(E[K]=T.x,E[$]=T.y,E[et]=T.z,E[K+X]=T.x,E[$+X]=T.y,E[et+X]=T.z),a.tangent&&(A=r.normalize(r.cross(O,T,A),A),S[K]=A.x,S[$]=A.y,S[et]=A.z,S[K+X]=A.x,S[K+1+X]=A.y,S[K+2+X]=A.z),a.binormal&&(M[K]=O.x,M[$]=O.y,M[et]=O.z,M[K+X]=O.x,M[$+X]=O.y,M[et+X]=O.z)}}if(a.st){X=w.length;for(var ut=0;X>ut;ut+=2)w[ut]=(w[ut]-H.x)/(Z.x-H.x),w[ut+1]=(w[ut+1]-H.y)/(Z.y-H.y)}var st=new h;return a.position&&(st.position=new d({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:v})),a.st&&(st.st=new d({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:w})),a.normal&&(st.normal=new d({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:E})),a.tangent&&(st.tangent=new d({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:S})),a.binormal&&(st.binormal=new d({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:M})),st}function A(e){for(var t=e.length/3,r=p.createTypedArray(t,6*t),n=0,i=0;t>i;i++){var a=i,o=i+t,u=(a+1)%t,s=u+t;r[n++]=a,r[n++]=o,r[n++]=u,r[n++]=u,r[n++]=o,r[n++]=s}return r}function O(t){var n=t.center,i=t.ellipsoid,a=t.semiMajorAxis,o=r.multiplyByScalar(i.geodeticSurfaceNormal(n,I),t.height,I);W.center=r.add(n,o,W.center),W.radius=a,o=r.multiplyByScalar(i.geodeticSurfaceNormal(n,o),t.extrudedHeight,o),V.center=r.add(n,o,V.center),V.radius=a;var u=s.computeEllipsePositions(t,!0,!0),c=u.positions,l=u.numPts,d=u.outerPositions,h=e.union(W,V),v=S(c,t,!0),g=M(l),x=g.length;g.length=2*x;for(var E=c.length/3,b=0;x>b;b+=3)g[b+x]=g[b+2]+E,g[b+1+x]=g[b+1]+E,g[b+2+x]=g[b]+E;var O=p.createTypedArray(2*E/3,g),N=new f({attributes:v,indices:O,primitiveType:w.TRIANGLES}),z=T(d,t);g=A(d);var _=p.createTypedArray(2*d.length/3,g),R=new f({attributes:z,indices:_,primitiveType:w.TRIANGLES}),P=y.combineInstances([new m({geometry:N}),new m({geometry:R})]);return{boundingSphere:h,attributes:P[0].attributes,indices:P[0].indices}}var I=new r,N=new r,z=new r,_=new r,R=new t,P=new g,L=new x,C=new r,q=new r,D=new r,B=new n,U=new r,F=new t,G=new t,k=new r,W=new e,V=new e,Y=function(e){e=a(e,a.EMPTY_OBJECT);var t=e.center,n=a(e.ellipsoid,c.WGS84),i=e.semiMajorAxis,u=e.semiMinorAxis,s=a(e.granularity,v.RADIANS_PER_DEGREE),l=a(e.height,0),f=e.extrudedHeight,d=o(f)&&Math.abs(l-f)>1,h=a(e.vertexFormat,E.DEFAULT);this._center=r.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=u,this._ellipsoid=c.clone(n),this._rotation=a(e.rotation,0),this._stRotation=a(e.stRotation,0),this._height=l,this._granularity=s,this._vertexFormat=E.clone(h),this._extrudedHeight=a(f,l),this._extrude=d,this._workerName="createEllipseGeometry"};Y.packedLength=r.packedLength+c.packedLength+E.packedLength+8,Y.pack=function(e,t,n){n=a(n,0),r.pack(e._center,t,n),n+=r.packedLength,c.pack(e._ellipsoid,t,n),n+=c.packedLength,E.pack(e._vertexFormat,t,n),n+=E.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n]=e._extrude?1:0};var j=new r,H=new c,Z=new E,X={center:j,ellipsoid:H,vertexFormat:Z,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0};return Y.unpack=function(e,t,n){t=a(t,0);var i=r.unpack(e,t,j);t+=r.packedLength;var u=c.unpack(e,t,H);t+=c.packedLength;var s=E.unpack(e,t,Z);t+=E.packedLength;var l=e[t++],f=e[t++],d=e[t++],h=e[t++],m=e[t++],y=e[t++],p=e[t++],v=1===e[t];return o(n)?(n._center=r.clone(i,n._center),n._ellipsoid=c.clone(u,n._ellipsoid),n._vertexFormat=E.clone(s,n._vertexFormat),n._semiMajorAxis=l,n._semiMinorAxis=f,n._rotation=d,n._stRotation=h,n._height=m,n._granularity=y,n._extrudedHeight=p,n._extrude=v,n):(X.height=m,X.extrudedHeight=p,X.granularity=y,X.stRotation=h,X.rotation=d,X.semiMajorAxis=l,X.semiMinorAxis=f,new Y(X))},Y.createGeometry=function(e){e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var t,r={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:e._height,extrudedHeight:e._extrudedHeight,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};return e._extrude?(r.extrudedHeight=Math.min(e._extrudedHeight,e._height),r.height=Math.max(e._extrudedHeight,e._height),t=O(r)):t=b(r),new f({attributes:t.attributes,indices:t.indices,primitiveType:w.TRIANGLES,boundingSphere:t.boundingSphere})},Y}),define("Core/CircleGeometry",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./EllipseGeometry","./Ellipsoid","./VertexFormat"],function(e,t,r,n,i,a,o){"use strict";var u=function(e){e=t(e,t.EMPTY_OBJECT);var r=e.radius,n={center:e.center,semiMajorAxis:r,semiMinorAxis:r,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,vertexFormat:e.vertexFormat,stRotation:e.stRotation};this._ellipseGeometry=new i(n),this._workerName="createCircleGeometry"};u.packedLength=i.packedLength,u.pack=function(e,t,r){i.pack(e._ellipseGeometry,t,r)};var s=new i({center:new e,semiMajorAxis:1,semiMinorAxis:1}),c={center:new e,radius:void 0,ellipsoid:a.clone(a.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,vertexFormat:new o,stRotation:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0};return u.unpack=function(t,n,l){var f=i.unpack(t,n,s);return c.center=e.clone(f._center,c.center),c.ellipsoid=a.clone(f._ellipsoid,c.ellipsoid),c.height=f._height,c.extrudedHeight=f._extrudedHeight,c.granularity=f._granularity,c.vertexFormat=o.clone(f._vertexFormat,c.vertexFormat),c.stRotation=f._stRotation,r(l)?(c.semiMajorAxis=f._semiMajorAxis,c.semiMinorAxis=f._semiMinorAxis,l._ellipseGeometry=new i(c),l):(c.radius=f._semiMajorAxis,new u(c))},u.createGeometry=function(e){return i.createGeometry(e._ellipseGeometry)},u}),define("Workers/createCircleGeometry",["../Core/Cartesian3","../Core/CircleGeometry","../Core/defined","../Core/Ellipsoid"],function(e,t,r,n){"use strict";function i(i,a){return r(a)&&(i=t.unpack(i,a)),i._ellipseGeometry._center=e.clone(i._ellipseGeometry._center),i._ellipseGeometry._ellipsoid=n.clone(i._ellipseGeometry._ellipsoid),t.createGeometry(i)}return i})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createCircleOutlineGeometry.js b/libs/Cesium/Workers/createCircleOutlineGeometry.js deleted file mode 100644 index 35726d34..00000000 --- a/libs/Cesium/Workers/createCircleOutlineGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,i){i=t(i,r);var a=Math.abs(e-n);return i>=a||a<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],i=t;e>=i;i++)r.push(n*i);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var i=new e;return n.setRandomNumberSeed=function(t){i=new e(t)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};a.fromSpherical=function(n,r){t(r)||(r=new a);var i=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(e,n,r,i){return t(i)?(i.x=e,i.y=n,i.z=r,i):new a(e,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(e,t){a.normalize(e,s),a.normalize(t,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,l);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Z,t):n.y<=n.z?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_Z,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)},a.cross=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=t.x,u=t.y,s=t.z,c=i*s-a*u,l=a*o-r*s,d=r*u-i*o;return n.x=c,n.y=l,n.z=d,n},a.fromDegrees=function(e,t,n,r,o){var u=i.toRadians(e),s=i.toRadians(t);return a.fromRadians(u,s,n,r,o)};var d=new a,h=new a,f=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=e(i,0);var s=t(o)?o.radiiSquared:f,c=Math.cos(r);d.x=c*Math.cos(n),d.y=c*Math.sin(n),d.z=Math.sin(r),d=a.normalize(d,d),a.multiplyComponents(s,d,h);var l=Math.sqrt(a.dot(d,h));return h=a.divideByScalar(h,l,h),d=a.multiplyByScalar(d,i,d),t(u)||(u=new a),a.add(h,d,u)},a.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=i.toRadians(e[o]);return a.fromRadiansArray(r,t,n)},a.fromRadiansArray=function(e,n,r){var i=e.length;t(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=i.toRadians(e[o]),r[o+1]=i.toRadians(e[o+1]),r[o+2]=e[o+2];return a.fromRadiansArrayHeights(r,t,n)},a.fromRadiansArrayHeights=function(e,n,r){var i=e.length;t(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return a.fromRadians=function(n,r,i,o){return i=e(i,0),t(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(e,t,n,r){return e=i.toRadians(e),t=i.toRadians(t),a.fromRadians(e,t,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new a(e.longitude,e.latitude,e.height):void 0},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},a.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t){return a.equalsEpsilon(this,e,t)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";function s(t,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),t._radii=new e(r,i,a),t._radiiSquared=new e(r*r,i*i,a*a),t._radiiToTheFourth=new e(r*r*r*r,i*i*i*i,a*a*a*a),t._oneOverRadii=new e(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),t._minimumRadius=Math.min(r,i,a),t._maximumRadius=Math.max(r,i,a),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var i=t._radii;return r(n)?(e.clone(i,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,i){i=n(i,0),e.pack(t._radii,r,i)},c.unpack=function(t,r,i){r=n(r,0);var a=e.unpack(t,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var i=t.longitude,a=t.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,d=new e;c.prototype.cartographicToCartesian=function(t,n){var i=l,a=d;this.geodeticSurfaceNormalCartographic(t,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,t.height,i),r(n)||(n=new e),e.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var h=new e,f=new e,m=new e;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,f);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=e.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),d=u.sign(e.dot(s,n))*e.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=d,i):new t(c,l,d)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};var y=new e,p=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var i=t.x,a=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,d=s.z,h=i*i*c*c,f=a*a*l*l,m=o*o*d*d,v=h+f+m,w=Math.sqrt(1/v),g=e.multiplyByScalar(t,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?e.clone(g,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,M=x.y,_=x.z,S=p;S.x=2*g.x*E,S.y=2*g.y*M,S.z=2*g.z*_;var z,O,I,T,N,R,A,b,P,C,L,q=(1-w)*e.magnitude(t)/(.5*e.magnitude(S)),U=0;do{q-=U,I=1/(1+q*E),T=1/(1+q*M),N=1/(1+q*_),R=I*I,A=T*T,b=N*N,P=R*I,C=A*T,L=b*N,z=h*R+f*A+m*b-1,O=h*P*E+f*C*M+m*L*_;var B=-2*O;U=z/B}while(Math.abs(z)>u.EPSILON12);return r(n)?(n.x=i*I,n.y=a*T,n.z=o*N,n):new e(i*I,a*T,o*N)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var i=t.x,a=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,i,a,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var i=this._semimajorAxis,a=t.longitude*i,o=t.latitude*i,u=t.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new e(a,o,u)},u.prototype.unproject=function(e,n){var i=this._oneOverSemimajorAxis,a=e.x*i,o=e.y*i,u=e.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new t(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r,i){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(i,0)};a.fromElements=function(e,n,r,i,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=i,o):new a(e,n,r,i)},a.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,s);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)&&i.equalsEpsilon(e.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(f[n],h[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(f[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,d=h[i],m=f[i];if(Math.abs(e[c.getElementIndex(m,d)])>n){var y,p=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(d,d)],w=e[c.getElementIndex(m,d)],g=(p-v)/2/w;y=0>g?-1/(-g+Math.sqrt(1+g*g)):1/(g+Math.sqrt(1+g*g)),s=1/Math.sqrt(1+y*y),l=y*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(d,d)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,d)]=l,t[c.getElementIndex(d,m)]=-l,t}var c=function(e,n,r,i,a,o,u,s,c){this[0]=t(e,0),this[1]=t(i,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(a,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r++],i[1]=e[r++],i[2]=e[r++],i[3]=e[r++],i[4]=e[r++],i[5]=e[r++],i[6]=e[r++],i[7]=e[r++],i[8]=e[r++],i},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],i[8]=e[r+8],i},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,i=e.x*e.y,a=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,d=e.z*e.z,h=e.z*e.w,f=e.w*e.w,m=r-u-d+f,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-d+f,g=2*(s-o),x=2*(a-l),E=2*(s+o),M=-r-u+d+f;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=y,t[4]=w,t[5]=E,t[6]=p,t[7]=g,t[8]=M,t):new c(m,y,p,v,w,g,x,E,M)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=i,t[6]=0,t[7]=-i,t[8]=r,t):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=r,t):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,i=e[r],a=e[r+1],o=e[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=3*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],i=e[t+3],a=e[t+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var d=new e;c.getMaximumScale=function(t){return c.getScale(t,d),e.maximumComponent(d)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],d=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=d,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[3]*i+e[6]*a,u=e[1]*r+e[4]*i+e[7]*a,s=e[2]*r+e[5]*i+e[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var h=[1,0,0],f=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(e,t){var r=a.EPSILON20,i=10,l=0,d=0;n(t)||(t={});for(var h=t.unitary=c.clone(c.IDENTITY,t.unitary),f=t.diagonal=c.clone(e,t.diagonal),p=r*o(f);i>d&&u(f)>p;)s(f,m),c.transpose(m,y),c.multiply(f,m,f),c.multiply(y,f,f),c.multiply(h,m,h),++l>2&&(++d,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],i=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(e,t){var n=e[0],i=e[1],o=e[2],u=e[3],s=e[4],l=e[5],d=e[6],h=e[7],f=e[8],m=c.determinant(e);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");t[0]=s*f-h*l,t[1]=h*o-i*f,t[2]=i*l-s*o,t[3]=d*l-u*f,t[4]=n*f-d*o,t[5]=u*o-n*l,t[6]=u*h-d*s,t[7]=d*i-n*h,t[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(t,y,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,i,a,o,u,s){"use strict";var c=function(e,t,r,i,a,o,u,s,c,l,d,h,f,m,y,p){this[0]=n(e,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(f,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(d,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,i){return t=n(t,0),r(i)||(i=new c),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,i,a){return i=n(i,e.ZERO),r(a)?(a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=0,a[4]=t[3],a[5]=t[4],a[6]=t[5],a[7]=0,a[8]=t[6],a[9]=t[7],a[10]=t[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(t[0],t[3],t[6],i.x,t[1],t[4],t[7],i.y,t[2],t[5],t[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,d=t.x*t.z,h=t.x*t.w,f=t.y*t.y,m=t.y*t.z,y=t.y*t.w,p=t.z*t.z,v=t.z*t.w,w=t.w*t.w,g=s-f-p+w,x=2*(l-v),E=2*(d+y),M=2*(l+v),_=-s+f-p+w,S=2*(m-h),z=2*(d-y),O=2*(m+h),I=-s-f+p+w;return i[0]=g*a,i[1]=M*a,i[2]=z*a,i[3]=0,i[4]=x*o,i[5]=_*o,i[6]=O*o,i[7]=0,i[8]=E*u,i[9]=S*u,i[10]=I*u,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,d=new e,h=new e;c.fromCamera=function(t,n){var i=t.eye,a=t.target,o=t.up;e.normalize(e.subtract(a,i,l),l),e.normalize(e.cross(l,o,d),d),e.normalize(e.cross(d,l,h),h);var u=d.x,s=d.y,f=d.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,g=h.z,x=i.x,E=i.y,M=i.z,_=u*-x+s*-E+f*-M,S=v*-x+w*-E+g*-M,z=m*x+y*E+p*M;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=f,n[9]=g,n[10]=-p,n[11]=0,n[12]=_,n[13]=S,n[14]=z,n[15]=1,n):new c(u,s,f,_,v,w,g,S,-m,-y,-p,z,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,i){var a=Math.tan(.5*e),o=1/a,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(e,t,n,r,i,a,o){var u=1/(t-e),s=1/(r-n),c=1/(a-i),l=-(t+e)*u,d=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=d,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,n,r,i,a,o){var u=2*i/(t-e),s=2*i/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),d=-(a+i)/(a-i),h=-1,f=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=d,o[11]=h,o[12]=0,o[13]=0,o[14]=f,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,i,a){var o=2*i/(t-e),u=2*i/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,d=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=d,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(e,t,r,i){e=n(e,n.EMPTY_OBJECT);var a=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,d=.5*(r-t),h=c,f=l,m=d,y=a+c,p=o+l,v=t+d,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=f,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,i=e[r],a=e[r+1],o=e[r+2],u=e[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=4*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],i=e[t+4],a=e[t+8],o=e[t+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var f=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],f)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],f)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],f)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],d=e[8],h=e[9],f=e[10],m=e[11],y=e[12],p=e[13],v=e[14],w=e[15],g=t[0],x=t[1],E=t[2],M=t[3],_=t[4],S=t[5],z=t[6],O=t[7],I=t[8],T=t[9],N=t[10],R=t[11],A=t[12],b=t[13],P=t[14],C=t[15],L=r*g+u*x+d*E+y*M,q=i*g+s*x+h*E+p*M,U=a*g+c*x+f*E+v*M,B=o*g+l*x+m*E+w*M,D=r*_+u*S+d*z+y*O,W=i*_+s*S+h*z+p*O,G=a*_+c*S+f*z+v*O,F=o*_+l*S+m*z+w*O,k=r*I+u*T+d*N+y*R,V=i*I+s*T+h*N+p*R,j=a*I+c*T+f*N+v*R,Y=o*I+l*T+m*N+w*R,H=r*A+u*b+d*P+y*C,Z=i*A+s*b+h*P+p*C,X=a*A+c*b+f*P+v*C,K=o*A+l*b+m*P+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=B,n[4]=D,n[5]=W,n[6]=G,n[7]=F,n[8]=k,n[9]=V,n[10]=j,n[11]=Y,n[12]=H,n[13]=Z,n[14]=X,n[15]=K,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],d=e[10],h=e[12],f=e[13],m=e[14],y=t[0],p=t[1],v=t[2],w=t[4],g=t[5],x=t[6],E=t[8],M=t[9],_=t[10],S=t[12],z=t[13],O=t[14],I=r*y+o*p+c*v,T=i*y+u*p+l*v,N=a*y+s*p+d*v,R=r*w+o*g+c*x,A=i*w+u*g+l*x,b=a*w+s*g+d*x,P=r*E+o*M+c*_,C=i*E+u*M+l*_,L=a*E+s*M+d*_,q=r*S+o*z+c*O+h,U=i*S+u*z+l*O+f,B=a*S+s*z+d*O+m;return n[0]=I,n[1]=T,n[2]=N,n[3]=0,n[4]=R,n[5]=A,n[6]=b,n[7]=0,n[8]=P,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=B,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],d=e[10],h=t[0],f=t[1],m=t[2],y=t[3],p=t[4],v=t[5],w=t[6],g=t[7],x=t[8],E=r*h+o*f+c*m,M=i*h+u*f+l*m,_=a*h+s*f+d*m,S=r*y+o*p+c*v,z=i*y+u*p+l*v,O=a*y+s*p+d*v,I=r*w+o*g+c*x,T=i*w+u*g+l*x,N=a*w+s*g+d*x;return n[0]=E,n[1]=M,n[2]=_,n[3]=0,n[4]=S,n[5]=z,n[6]=O,n[7]=0,n[8]=I,n[9]=T,n[10]=N,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=r*e[0]+i*e[4]+a*e[8]+e[12],u=r*e[1]+i*e[5]+a*e[9]+e[13],s=r*e[2]+i*e[6]+a*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var y=new e;c.multiplyByUniformScale=function(e,t,n){return y.x=t,y.y=t,y.z=t,c.multiplyByScale(e,y,n)},c.multiplyByScale=function(e,t,n){var r=t.x,i=t.y,a=t.z;return 1===r&&1===i&&1===a?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=i*e[4],n[5]=i*e[5],n[6]=i*e[6],n[7]=0,n[8]=a*e[8],n[9]=a*e[9],n[10]=a*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=t.w,u=e[0]*r+e[4]*i+e[8]*a+e[12]*o,s=e[1]*r+e[5]*i+e[9]*a+e[13]*o,c=e[2]*r+e[6]*i+e[10]*a+e[14]*o,l=e[3]*r+e[7]*i+e[11]*a+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a,u=e[1]*r+e[5]*i+e[9]*a,s=e[2]*r+e[6]*i+e[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a+e[12],u=e[1]*r+e[5]*i+e[9]*a+e[13],s=e[2]*r+e[6]*i+e[10]*a+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],i=e[3],a=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[10]=e[10],t[11]=e[14],t[12]=i,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var p=new u,v=new u,w=new t,g=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,p),v,o.EPSILON7)&&t.equals(c.getRow(e,3,w),g))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],i=e[4],a=e[8],l=e[12],d=e[1],h=e[5],f=e[9],m=e[13],y=e[2],x=e[6],E=e[10],M=e[14],_=e[3],S=e[7],z=e[11],O=e[15],I=E*O,T=M*z,N=x*O,R=M*S,A=x*z,b=E*S,P=y*O,C=M*_,L=y*z,q=E*_,U=y*S,B=x*_,D=I*h+R*f+A*m-(T*h+N*f+b*m),W=T*d+P*f+q*m-(I*d+C*f+L*m),G=N*d+C*h+U*m-(R*d+P*h+B*m),F=b*d+L*h+B*f-(A*d+q*h+U*f),k=T*i+N*a+b*l-(I*i+R*a+A*l),V=I*r+C*a+L*l-(T*r+P*a+q*l),j=R*r+P*i+B*l-(N*r+C*i+U*l),Y=A*r+q*i+U*a-(b*r+L*i+B*a);I=a*m,T=l*f,N=i*m,R=l*h,A=i*f,b=a*h,P=r*m,C=l*d,L=r*f,q=a*d,U=r*h,B=i*d;var H=I*S+R*z+A*O-(T*S+N*z+b*O),Z=T*_+P*z+q*O-(I*_+C*z+L*O),X=N*_+C*S+U*O-(R*_+P*S+B*O),K=b*_+L*S+B*z-(A*_+q*S+U*z),J=N*E+b*M+T*x-(A*M+I*x+R*E),Q=L*M+I*y+C*E-(P*E+q*M+T*y),$=P*x+B*M+R*y-(U*M+N*y+C*x),et=U*E+A*y+q*x-(L*x+B*E+b*y),tt=r*D+i*W+a*G+l*F;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=D*tt,n[1]=W*tt,n[2]=G*tt,n[3]=F*tt,n[4]=k*tt,n[5]=V*tt,n[6]=j*tt,n[7]=Y*tt,n[8]=H*tt,n[9]=Z*tt,n[10]=X*tt,n[11]=K*tt,n[12]=J*tt,n[13]=Q*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],d=e[12],h=e[13],f=e[14],m=-n*d-r*h-i*f,y=-a*d-o*h-u*f,p=-s*d-c*h-l*f;return t[0]=n,t[1]=a,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=i,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=y,t[14]=p,t[15]=1,t},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var i=function(t,n){this.normal=e.clone(t),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-e.dot(r,n);return t(a)?(e.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new e;return i.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,a),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},i.ORIGIN_XY_PLANE=r(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(e.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.west=e[r++],i.south=e[r++],i.east=e[r++],i.north=e[r],i},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,i,a,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),i=u.toRadians(t(i,0)),a=u.toRadians(t(a,0)),n(o)?(o.west=e,o.south=r,o.east=i,o.north=a,o):new s(e,r,i,a)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=a,t.east=i,t.north=o,t):new s(r,a,i,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var i=t.east,a=t.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var i=e.east,a=e.west,o=t.east,c=t.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),d=u.negativePiToPi(Math.min(i,o));if((e.west<e.east||t.west<t.east)&&l>=d)return void 0;var h=Math.max(e.south,t.south),f=Math.min(e.north,t.north);return h>=f?void 0:n(r)?(r.west=l,r.south=h,r.east=d,r.north=f,r):new s(l,h,d,f)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,i=e.west,a=e.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,i,o){r=t(r,a.WGS84),i=t(i,0),n(o)||(o=[]);var l=0,d=e.north,h=e.south,f=e.east,m=e.west,y=c;y.height=i,y.longitude=m,y.latitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>d?d:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(e,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,i,a,o,u,s,c,l,d,h){"use strict";var f=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,y=new e,p=new e,v=new e,w=new e,g=new e,x=new e,E=new e,M=new e,_=new e,S=new e,z=new e;f.fromPoints=function(t,n){if(r(n)||(n=new f),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var i=e.clone(t[0],x),a=e.clone(i,m),o=e.clone(i,y),u=e.clone(i,p),s=e.clone(i,v),c=e.clone(i,w),l=e.clone(i,g),d=t.length,h=1;d>h;h++){e.clone(t[h],i);var O=i.x,I=i.y,T=i.z;O<a.x&&e.clone(i,a),O>s.x&&e.clone(i,s),I<o.y&&e.clone(i,o),I>c.y&&e.clone(i,c),T<u.z&&e.clone(i,u),T>l.z&&e.clone(i,l)}var N=e.magnitudeSquared(e.subtract(s,a,E)),R=e.magnitudeSquared(e.subtract(c,o,E)),A=e.magnitudeSquared(e.subtract(l,u,E)),b=a,P=s,C=N;R>C&&(C=R,b=o,P=c),A>C&&(C=A,b=u,P=l);var L=M;L.x=.5*(b.x+P.x),L.y=.5*(b.y+P.y),L.z=.5*(b.z+P.z);var q=e.magnitudeSquared(e.subtract(P,L,E)),U=Math.sqrt(q),B=_;B.x=a.x,B.y=o.y,B.z=u.z;var D=S;D.x=s.x,D.y=c.y,D.z=l.z;var W=e.multiplyByScalar(e.add(B,D,E),.5,z),G=0;for(h=0;d>h;h++){e.clone(t[h],i);var F=e.magnitude(e.subtract(i,W,E));F>G&&(G=F);var k=e.magnitudeSquared(e.subtract(i,L,E));if(k>q){var V=Math.sqrt(k);U=.5*(U+V),q=U*U;var j=V-U;L.x=(U*L.x+j*i.x)/V,L.y=(U*L.y+j*i.y)/V,L.z=(U*L.z+j*i.z)/V}}return G>U?(e.clone(L,n.center),n.radius=U):(e.clone(W,n.center),n.radius=G),n};var O=new u,I=new e,T=new e,N=new t,R=new t;f.fromRectangle2D=function(e,t,n){return f.fromRectangleWithHeights2D(e,t,0,0,n)},f.fromRectangleWithHeights2D=function(t,i,a,o,u){if(r(u)||(u=new f),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=n(i,O),h.southwest(t,N),N.height=a,h.northeast(t,R),R.height=o;var s=i.project(N,I),c=i.project(R,T),l=c.x-s.x,d=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+d*d+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*d,y.z=s.z+.5*m,u};var A=[];f.fromRectangle3D=function(e,t,i,a){t=n(t,o.WGS84),i=n(i,0);var u;return r(e)&&(u=h.subsample(e,t,i,A)),f.fromPoints(u,a)},f.fromVertices=function(t,i,a,o){if(r(o)||(o=new f),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;i=n(i,e.ZERO),a=n(a,3);var u=x;u.x=t[0]+i.x,u.y=t[1]+i.y,u.z=t[2]+i.z;for(var s=e.clone(u,m),c=e.clone(u,y),l=e.clone(u,p),d=e.clone(u,v),h=e.clone(u,w),O=e.clone(u,g),I=t.length,T=0;I>T;T+=a){var N=t[T]+i.x,R=t[T+1]+i.y,A=t[T+2]+i.z;u.x=N,u.y=R,u.z=A,N<s.x&&e.clone(u,s),N>d.x&&e.clone(u,d),R<c.y&&e.clone(u,c),R>h.y&&e.clone(u,h),A<l.z&&e.clone(u,l),A>O.z&&e.clone(u,O)}var b=e.magnitudeSquared(e.subtract(d,s,E)),P=e.magnitudeSquared(e.subtract(h,c,E)),C=e.magnitudeSquared(e.subtract(O,l,E)),L=s,q=d,U=b;P>U&&(U=P,L=c,q=h),C>U&&(U=C,L=l,q=O);var B=M;B.x=.5*(L.x+q.x),B.y=.5*(L.y+q.y),B.z=.5*(L.z+q.z);var D=e.magnitudeSquared(e.subtract(q,B,E)),W=Math.sqrt(D),G=_;G.x=s.x,G.y=c.y,G.z=l.z;var F=S;F.x=d.x,F.y=h.y,F.z=O.z;var k=e.multiplyByScalar(e.add(G,F,E),.5,z),V=0;for(T=0;I>T;T+=a){u.x=t[T]+i.x,u.y=t[T+1]+i.y,u.z=t[T+2]+i.z;var j=e.magnitude(e.subtract(u,k,E));j>V&&(V=j);var Y=e.magnitudeSquared(e.subtract(u,B,E));if(Y>D){var H=Math.sqrt(Y);W=.5*(W+H),D=W*W;var Z=H-W;B.x=(W*B.x+Z*u.x)/H,B.y=(W*B.y+Z*u.y)/H,B.z=(W*B.z+Z*u.z)/H}}return V>W?(e.clone(B,o.center),o.radius=W):(e.clone(k,o.center),o.radius=V),o},f.fromCornerPoints=function(t,n,i){r(i)||(i=new f);var a=i.center;return e.add(t,n,a),e.multiplyByScalar(a,.5,a),i.radius=e.distance(a,n),i},f.fromEllipsoid=function(t,n){return r(n)||(n=new f),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var b=new e;f.fromBoundingSpheres=function(t,n){if(r(n)||(n=new f),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var i=t.length;if(1===i)return f.clone(t[0],n);if(2===i)return f.union(t[0],t[1],n);for(var a=[],o=0;i>o;o++)a.push(t[o].center);n=f.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,b)+c.radius)}return n.radius=s,n},f.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new f(t.center,t.radius):void 0},f.packedLength=4,f.pack=function(e,t,r){r=n(r,0);var i=e.center;t[r++]=i.x,t[r++]=i.y,t[r++]=i.z,t[r]=e.radius},f.unpack=function(e,t,i){t=n(t,0),r(i)||(i=new f);var a=i.center;return a.x=e[t++],a.y=e[t++],a.z=e[t++],i.radius=e[t],i};var P=new e,C=new e;f.union=function(t,n,i){r(i)||(i=new f);var a=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,a,P),l=e.magnitude(c);if(o>=l+s)return t.clone(i),i;if(s>=l+o)return n.clone(i),i;var d=.5*(o+l+s),h=e.multiplyByScalar(c,(-o+d)/l,C);return e.add(h,a,h),e.clone(h,i.center),i.radius=d,i};var L=new e;f.expand=function(t,n,r){r=f.clone(t,r);var i=e.magnitude(e.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},f.intersectPlane=function(t,n){var r=t.center,i=t.radius,a=n.normal,o=e.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new d(new e,0);f.intersect=function(e,t){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=d.fromCartesian4(t,q);return f.intersectPlane(e,n)},f.transform=function(e,t,n){return r(n)||(n=new f),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var U=new e;f.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,U);return e.magnitudeSquared(r)-t.radius*t.radius},f.transformWithoutScale=function(e,t,n){return r(n)||(n=new f),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var B=new e;f.computePlaneDistances=function(t,n,i,a){r(a)||(a=new c);var o=e.subtract(t.center,n,B),u=e.multiplyByScalar(i,e.dot(i,o),B),s=e.magnitude(u);return a.start=s-t.radius,a.stop=s+t.radius,a};for(var D=new e,W=new e,G=new e,F=new e,k=new e,V=new t,j=new Array(8),Y=0;8>Y;++Y)j[Y]=new e;var H=new u;return f.projectTo2D=function(t,r,i){r=n(r,H);var a=r.ellipsoid,o=t.center,u=t.radius,s=a.geodeticSurfaceNormal(o,D),c=e.cross(e.UNIT_Z,s,W);e.normalize(c,c);var l=e.cross(s,c,G);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var d=e.negate(l,k),h=e.negate(c,F),m=j,y=m[0];e.add(s,l,y),e.add(y,c,y),y=m[1],e.add(s,l,y),e.add(y,h,y),y=m[2],e.add(s,d,y),e.add(y,h,y),y=m[3],e.add(s,d,y),e.add(y,c,y),e.negate(s,s),y=m[4],e.add(s,l,y),e.add(y,c,y),y=m[5],e.add(s,l,y),e.add(y,h,y),y=m[6],e.add(s,d,y),e.add(y,h,y),y=m[7],e.add(s,d,y),e.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];e.add(o,w,w);var g=a.cartesianToCartographic(w,V);r.project(g,w)}i=f.fromPoints(m,i),o=i.center;var x=o.x,E=o.y,M=o.z;return o.x=M,o.y=x,o.z=E,i},f.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},f.prototype.intersectPlane=function(e){return f.intersectPlane(this,e)},f.prototype.intersect=function(e){return f.intersect(this,e)},f.prototype.equals=function(e){return f.equals(this,e)},f.prototype.clone=function(e){return f.clone(this,e)},f}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return t(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof t[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof t[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",e(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",e(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",e(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",e(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function i(){if(!t(p)){p=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(p=!0,v=r(e[1]))}return p}function a(){return i()&&v}function o(){if(!t(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(w=!0,g=r(e[1]))}return w}function u(){return o()&&g}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(M)){M=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(M=!0,_=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(M=!0,_=r(e[1])))}return M}function d(){return l()&&_}function h(){if(!t(S)){S=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(S=!0,z=r(e[1]))}return S}function f(){return t(O)||(O=/Windows/i.test(navigator.appVersion)),O}function m(){return h()&&z}function y(){return t(I)||(I=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),I}var p,v,w,g,x,E,M,_,S,z,O,I,T={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:d,isFirefox:h,firefoxVersion:m,isWindows:f,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return T.supportsFullscreen=function(){return n.supportsFullscreen()},T.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},T.supportsWebWorkers=function(){return"undefined"!=typeof Worker},T}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(e){switch(e){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(e){return e instanceof Int8Array?a.BYTE:e instanceof Uint8Array?a.UNSIGNED_BYTE:e instanceof Int16Array?a.SHORT:e instanceof Uint16Array?a.UNSIGNED_SHORT:e instanceof Float32Array?a.FLOAT:e instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(e){return t(e)&&(e===a.BYTE||e===a.UNSIGNED_BYTE||e===a.SHORT||e===a.UNSIGNED_SHORT||e===a.FLOAT||e===a.DOUBLE)},a.createTypedArray=function(e,t){switch(e){case a.BYTE:return new Int8Array(t);case a.UNSIGNED_BYTE:return new Uint8Array(t);case a.SHORT:return new Int16Array(t);case a.UNSIGNED_SHORT:return new Uint16Array(t);case a.FLOAT:return new Float32Array(t);case a.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(t,r,i,o){switch(i=e(i,0),o=e(o,(r.byteLength-i)/a.getSizeInBytes(t)),t){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)},c=new e;s.fromAxisAngle=function(t,r,i){var a=r/2,o=Math.sin(a);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,d=c.z*o,h=Math.cos(a);return n(i)?(i.x=u,i.y=l,i.z=d,i.w=h,i):new s(u,l,d,h)};var l=[1,2,0],d=new Array(3);s.fromRotationMatrix=function(e,t){var r,i,a,o,c,h=e[u.COLUMN0ROW0],f=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],y=h+f+m;if(y>0)r=Math.sqrt(y+1),c=.5*r,r=.5/r,i=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,a=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var p=l,v=0;f>h&&(v=1),m>h&&m>f&&(v=2);var w=p[v],g=p[w];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(w,w)]-e[u.getElementIndex(g,g)]+1);var x=d;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(g,w)]-e[u.getElementIndex(w,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,i=-x[0],a=-x[1],o=-x[2]}return n(t)?(t.x=i,t.y=a,t.z=o,t.w=c,t):new s(i,a,o,c)};var h=new s;s.fromHeadingPitchRoll=function(t,n,r,i){var a=s.fromAxisAngle(e.UNIT_X,r,h),o=s.fromAxisAngle(e.UNIT_Y,-n,i);i=s.multiply(o,a,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,h);return s.multiply(u,i,i)};var f=new e,m=new e,y=new s,p=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.x=e[r],i.y=e[r+1],i.z=e[r+2],i.w=e[r+3],i},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var i=0,a=n-t+1;a>i;i++){var o=3*i;s.unpack(e,4*(t+i),y),s.multiply(y,v,y),y.w<0&&s.negate(y,y),s.computeAxis(y,f);var u=s.computeAngle(y);r[o]=f.x*u,r[o+1]=f.y*u,r[o+2]=f.z*u}},s.unpackInterpolationResult=function(t,r,i,a,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*a,p),0===u?s.clone(s.IDENTITY,y):s.fromAxisAngle(m,u,y),s.multiply(y,p,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,i=e.y*n,a=e.z*n,o=e.w*n;return t.x=r,t.y=i,t.z=a,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,d=o*u+r*l+i*c-a*s,h=o*s-r*c+i*l+a*u,f=o*c+r*s-i*u+a*l,m=o*l-r*u-i*s-a*c;return n.x=d,n.y=h,n.z=f,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var w=new s;s.lerp=function(e,t,n,r){return w=s.multiplyByScalar(t,n,w),r=s.multiplyByScalar(e,1-n,r),s.add(w,r,r)};var g=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var i=s.dot(e,t),a=t;if(0>i&&(i=-i,a=g=s.negate(t,g)),1-i<o.EPSILON6)return s.lerp(e,a,n,r);var u=Math.acos(i);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(a,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),i=0;return 0!==r&&(i=r/Math.sin(r)),e.multiplyByScalar(t,i,n) -},s.exp=function(t,n){var r=e.magnitude(t),i=0;return 0!==r&&(i=Math.sin(r)/r),n.x=t.x*i,n.y=t.y*i,n.z=t.z*i,n.w=Math.cos(r),n};var M=new e,_=new e,S=new s,z=new s;s.computeInnerQuadrangle=function(t,n,r,i){var a=s.conjugate(n,S);s.multiply(a,r,z);var o=s.log(z,M);s.multiply(a,t,z);var u=s.log(z,_);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,S),s.multiply(n,S,i)},s.squad=function(e,t,n,r,i,a){var o=s.slerp(e,t,i,S),u=s.slerp(n,r,i,z);return s.slerp(o,u,2*i*(1-i),a)};for(var O=new s,I=1.9011074535173003,T=i.supportsTypedArrays()?new Float32Array(8):[],N=i.supportsTypedArrays()?new Float32Array(8):[],R=i.supportsTypedArrays()?new Float32Array(8):[],A=i.supportsTypedArrays()?new Float32Array(8):[],b=0;7>b;++b){var P=b+1,C=2*P+1;T[b]=1/(P*C),N[b]=P/C}return T[7]=I/136,N[7]=8*I/17,s.fastSlerp=function(e,t,n,r){var i,a=s.dot(e,t);a>=0?i=1:(i=-1,a=-a);for(var o=a-1,u=1-n,c=n*n,l=u*u,d=7;d>=0;--d)R[d]=(T[d]*c-N[d])*o,A[d]=(T[d]*l-N[d])*o;var h=i*n*(1+R[0]*(1+R[1]*(1+R[2]*(1+R[3]*(1+R[4]*(1+R[5]*(1+R[6]*(1+R[7])))))))),f=u*(1+A[0]*(1+A[1]*(1+A[2]*(1+A[3]*(1+A[4]*(1+A[5]*(1+A[6]*(1+A[7])))))))),m=s.multiplyByScalar(e,f,O);return s.multiplyByScalar(t,h,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,i,a){var o=s.fastSlerp(e,t,i,S),u=s.fastSlerp(n,r,i,z);return s.fastSlerp(o,u,2*i*(1-i),a)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/EllipseGeometryLibrary",["./Cartesian3","./Math","./Matrix3","./Quaternion"],function(e,t,n,r){"use strict";function i(t,i,a,l,d,h,f,m,y,p){var v=t+i;e.multiplyByScalar(l,Math.cos(v),o),e.multiplyByScalar(a,Math.sin(v),u),e.add(o,u,o);var w=Math.cos(t);w*=w;var g=Math.sin(t);g*=g;var x=h/Math.sqrt(f*w+d*g),E=x/m;return r.fromAxisAngle(o,E,s),n.fromQuaternion(s,c),n.multiplyByVector(c,y,p),e.normalize(p,p),e.multiplyByScalar(p,m,p),p}var a={},o=new e,u=new e,s=new r,c=new n,l=new e,d=new e,h=new e,f=new e;a.raisePositionsToHeight=function(t,n,r){for(var i=n.ellipsoid,a=n.height,o=n.extrudedHeight,u=r?2*(t.length/3):t.length/3,s=new Float64Array(3*u),c=t.length,m=r?c:0,y=0;c>y;y+=3){var p=y+1,v=y+2,w=e.fromArray(t,y,l);i.scaleToGeodeticSurface(w,w);var g=e.clone(w,d),x=i.geodeticSurfaceNormal(w,f),E=e.multiplyByScalar(x,a,h);e.add(w,E,w),r&&(e.multiplyByScalar(x,o,E),e.add(g,E,g),s[y+m]=g.x,s[p+m]=g.y,s[v+m]=g.z),s[y]=w.x,s[p]=w.y,s[v]=w.z}return s};var m=new e,y=new e,p=new e;return a.computeEllipsePositions=function(n,r,a){var o=n.semiMinorAxis,u=n.semiMajorAxis,s=n.rotation,c=n.center,f=8*n.granularity,v=o*o,w=u*u,g=u*o,x=e.magnitude(c),E=e.normalize(c,m),M=e.cross(e.UNIT_Z,c,y);M=e.normalize(M,M);var _=e.cross(E,M,p),S=1+Math.ceil(t.PI_OVER_TWO/f),z=t.PI_OVER_TWO/(S-1),O=t.PI_OVER_TWO-S*z;0>O&&(S-=Math.ceil(Math.abs(O)/z));var I,T,N,R,A,b=2*S*(S+1),P=r?new Array(3*b):void 0,C=0,L=l,q=d,U=3*(2*S+2*(S-1)),B=U-1,D=0,W=a?new Array(U):void 0;for(O=t.PI_OVER_TWO,I=0;S>I;++I){if(L=i(O,s,_,M,v,g,w,x,E,L),q=i(Math.PI-O,s,_,M,v,g,w,x,E,q),r){for(P[C++]=L.x,P[C++]=L.y,P[C++]=L.z,N=2*I+2,T=1;N-1>T;++T)R=T/(N-1),A=e.lerp(L,q,R,h),P[C++]=A.x,P[C++]=A.y,P[C++]=A.z;P[C++]=q.x,P[C++]=q.y,P[C++]=q.z}a&&(W[B--]=L.z,W[B--]=L.y,W[B--]=L.x,0!==I&&(W[D++]=q.x,W[D++]=q.y,W[D++]=q.z)),O=t.PI_OVER_TWO-(I+1)*z}for(I=S;I>0;--I){if(O=t.PI_OVER_TWO-(I-1)*z,L=i(-O,s,_,M,v,g,w,x,E,L),q=i(O+Math.PI,s,_,M,v,g,w,x,E,q),r){for(P[C++]=L.x,P[C++]=L.y,P[C++]=L.z,N=2*(I-1)+2,T=1;N-1>T;++T)R=T/(N-1),A=e.lerp(L,q,R,h),P[C++]=A.x,P[C++]=A.y,P[C++]=A.z;P[C++]=q.x,P[C++]=q.y,P[C++]=q.z}a&&(W[B--]=L.z,W[B--]=L.y,W[B--]=L.x,1!==I&&(W[D++]=q.x,W[D++]=q.y,W[D++]=q.z))}var G={};return r&&(G.positions=P,G.numPts=S),a&&(G.outerPositions=W),G},a}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,i){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,i.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(e){var r=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&t(e.attributes[i])&&t(e.attributes[i].values)){var a=e.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(t){return e(t)&&(t===i.UNSIGNED_BYTE||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)},i.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},i.createTypedArrayFromArrayBuffer=function(e,t,n,i){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)},n(i)}),define("Core/EllipseOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EllipseGeometryLibrary","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType"],function(e,t,n,r,i,a,o,u,s,c,l,d,h,f){"use strict";function m(r){var i=r.center;v=t.multiplyByScalar(r.ellipsoid.geodeticSurfaceNormal(i,v),r.height,v),v=t.add(i,v,v);for(var a=new e(v,r.semiMajorAxis),u=o.computeEllipsePositions(r,!1,!0).outerPositions,s=new l({position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:o.raisePositionsToHeight(u,r,!1)})}),h=u.length/3,f=d.createTypedArray(h,2*h),m=0,y=0;h>y;++y)f[m++]=y,f[m++]=(y+1)%h;return{boundingSphere:a,attributes:s,indices:f}}function y(i){var a=r(i.numberOfVerticalLines,16);a=Math.max(a,0);var u=i.center,s=i.ellipsoid,h=i.semiMajorAxis,f=t.multiplyByScalar(s.geodeticSurfaceNormal(u,p),i.height,p);w.center=t.add(u,f,w.center),w.radius=h,f=t.multiplyByScalar(s.geodeticSurfaceNormal(u,f),i.extrudedHeight,f),g.center=t.add(u,f,g.center),g.radius=h;var m=o.computeEllipsePositions(i,!1,!0).outerPositions,y=new l({position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:o.raisePositionsToHeight(m,i,!0)})});m=y.position.values;var v=e.union(w,g),x=m.length/3,E=d.createTypedArray(x,2*x+2*a);x/=2;var M,_=0;for(M=0;x>M;++M)E[_++]=M,E[_++]=(M+1)%x,E[_++]=M+x,E[_++]=(M+1)%x+x;var S;if(a>0){var z=Math.min(a,x);S=Math.round(x/z)}var O=Math.min(S*a,x);if(a>0)for(M=0;O>M;M+=S)E[_++]=M,E[_++]=M+x;return{boundingSphere:v,attributes:y,indices:E}}var p=new t,v=new t,w=new e,g=new e,x=function(e){e=r(e,r.EMPTY_OBJECT);var n=e.center,a=r(e.ellipsoid,u.WGS84),o=e.semiMajorAxis,s=e.semiMinorAxis,c=r(e.granularity,h.RADIANS_PER_DEGREE),l=r(e.height,0),d=e.extrudedHeight,f=i(d)&&Math.abs(l-d)>1;this._center=t.clone(n),this._semiMajorAxis=o,this._semiMinorAxis=s,this._ellipsoid=u.clone(a),this._rotation=r(e.rotation,0),this._height=l,this._granularity=c,this._extrudedHeight=d,this._extrude=f,this._numberOfVerticalLines=Math.max(r(e.numberOfVerticalLines,16),0),this._workerName="createEllipseOutlineGeometry"};x.packedLength=t.packedLength+u.packedLength+9,x.pack=function(e,n,a){a=r(a,0),t.pack(e._center,n,a),a+=t.packedLength,u.pack(e._ellipsoid,n,a),a+=u.packedLength,n[a++]=e._semiMajorAxis,n[a++]=e._semiMinorAxis,n[a++]=e._rotation,n[a++]=e._height,n[a++]=e._granularity,n[a++]=i(e._extrudedHeight)?1:0,n[a++]=r(e._extrudedHeight,0),n[a++]=e._extrude?1:0,n[a]=e._numberOfVerticalLines};var E=new t,M=new u,_={center:E,ellipsoid:M,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0};return x.unpack=function(e,n,a){n=r(n,0);var o=t.unpack(e,n,E);n+=t.packedLength;var s=u.unpack(e,n,M);n+=u.packedLength;var c=e[n++],l=e[n++],d=e[n++],h=e[n++],f=e[n++],m=e[n++],y=e[n++],p=1===e[n++],v=e[n];return i(a)?(a._center=t.clone(o,a._center),a._ellipsoid=u.clone(s,a._ellipsoid),a._semiMajorAxis=c,a._semiMinorAxis=l,a._rotation=d,a._height=h,a._granularity=f,a._extrudedHeight=m?y:void 0,a._extrude=p,a._numberOfVerticalLines=v,a):(_.height=h,_.extrudedHeight=m?y:void 0,_.granularity=f,_.rotation=d,_.semiMajorAxis=c,_.semiMinorAxis=l,_.numberOfVerticalLines=v,new x(_))},x.createGeometry=function(e){e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var t,n={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:e._height,extrudedHeight:e._extrudedHeight,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};return e._extrude?(n.extrudedHeight=Math.min(e._extrudedHeight,e._height),n.height=Math.max(e._extrudedHeight,e._height),t=y(n)):t=m(n),new s({attributes:t.attributes,indices:t.indices,primitiveType:f.LINES,boundingSphere:t.boundingSphere})},x}),define("Core/CircleOutlineGeometry",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./EllipseOutlineGeometry","./Ellipsoid"],function(e,t,n,r,i,a){"use strict";var o=function(e){e=t(e,t.EMPTY_OBJECT);var n=e.radius,r={center:e.center,semiMajorAxis:n,semiMinorAxis:n,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,numberOfVerticalLines:e.numberOfVerticalLines};this._ellipseGeometry=new i(r),this._workerName="createCircleOutlineGeometry"};o.packedLength=i.packedLength,o.pack=function(e,t,n){i.pack(e._ellipseGeometry,t,n)};var u=new i({center:new e,semiMajorAxis:1,semiMinorAxis:1}),s={center:new e,radius:void 0,ellipsoid:a.clone(a.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,numberOfVerticalLines:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0};return o.unpack=function(t,r,c){var l=i.unpack(t,r,u);return s.center=e.clone(l._center,s.center),s.ellipsoid=a.clone(l._ellipsoid,s.ellipsoid),s.height=l._height,s.extrudedHeight=l._extrudedHeight,s.granularity=l._granularity,s.numberOfVerticalLines=l._numberOfVerticalLines,n(c)?(s.semiMajorAxis=l._semiMajorAxis,s.semiMinorAxis=l._semiMinorAxis,c._ellipseGeometry=new i(s),c):(s.radius=l._semiMajorAxis,new o(s))},o.createGeometry=function(e){return i.createGeometry(e._ellipseGeometry)},o}),define("Workers/createCircleOutlineGeometry",["../Core/Cartesian3","../Core/CircleOutlineGeometry","../Core/defined","../Core/Ellipsoid"],function(e,t,n,r){"use strict";function i(i,a){return n(a)&&(i=t.unpack(i,a)),i._ellipseGeometry._center=e.clone(i._ellipseGeometry._center),i._ellipseGeometry._ellipsoid=r.clone(i._ellipseGeometry._ellipsoid),t.createGeometry(i)}return i})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createCorridorGeometry.js b/libs/Cesium/Workers/createCorridorGeometry.js deleted file mode 100644 index a62f7d89..00000000 --- a/libs/Cesium/Workers/createCorridorGeometry.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,a){a=t(a,r);var i=Math.abs(e-n);return a>=i||i<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],a=t;e>=a;a++)r.push(n*a);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var a=new e;return n.setRandomNumberSeed=function(t){a=new e(t)},n.nextRandomNumber=function(){return a.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};i.fromSpherical=function(n,r){t(r)||(r=new i);var a=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(a),r.y=s*Math.sin(a),r.z=u*Math.cos(o),r},i.fromElements=function(e,n,r,a){return t(a)?(a.x=e,a.y=n,a.z=r,a):new i(e,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var n=i.dot(s,c),r=i.magnitude(i.cross(s,c,s));return Math.atan2(r,n)};var l=new i;i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):n.y<=n.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)},i.cross=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-r*s,d=r*u-a*o;return n.x=c,n.y=l,n.z=d,n},i.fromDegrees=function(e,t,n,r,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,n,r,o)};var d=new i,f=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(n,r,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(r);d.x=c*Math.cos(n),d.y=c*Math.sin(n),d.z=Math.sin(r),d=i.normalize(d,d),i.multiplyComponents(s,d,f);var l=Math.sqrt(i.dot(d,f));return f=i.divideByScalar(f,l,f),d=i.multiplyByScalar(d,a,d),t(u)||(u=new i),i.add(f,d,u)},i.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=a.toRadians(e[o]);return i.fromRadiansArray(r,t,n)},i.fromRadiansArray=function(e,n,r){var a=e.length;t(r)?r.length=a/2:r=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=i.fromRadians(u,s,0,n,r[o/2])}return r},i.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=a.toRadians(e[o]),r[o+1]=a.toRadians(e[o+1]),r[o+2]=e[o+2];return i.fromRadiansArrayHeights(r,t,n)},i.fromRadiansArrayHeights=function(e,n,r){var a=e.length;t(r)?r.length=a/3:r=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=i.fromRadians(u,s,c,n,r[o/3])}return r},i.ZERO=r(new i(0,0,0)),i.UNIT_X=r(new i(1,0,0)),i.UNIT_Y=r(new i(0,1,0)),i.UNIT_Z=r(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return i.fromRadians=function(n,r,a,o){return a=e(a,0),t(o)?(o.longitude=n,o.latitude=r,o.height=a,o):new i(n,r,a)},i.fromDegrees=function(e,t,n,r){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},i.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},i.ZERO=r(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(t,r,a,i){r=n(r,0),a=n(a,0),i=n(i,0),t._radii=new e(r,a,i),t._radiiSquared=new e(r*r,a*a,i*i),t._radiiToTheFourth=new e(r*r*r*r,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===r?0:1/r,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(r,a,i),t._maximumRadius=Math.max(r,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var a=t._radii;return r(n)?(e.clone(a,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,a){a=n(a,0),e.pack(t._radii,r,a)},c.unpack=function(t,r,a){r=n(r,0);var i=e.unpack(t,r);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,d=new e;c.prototype.cartographicToCartesian=function(t,n){var a=l,i=d;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),r(n)||(n=new e),e.add(i,a,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var f=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(n,a){var i=this.scaleToGeodeticSurface(n,h);if(!r(i))return void 0;var o=this.geodeticSurfaceNormal(i,f),s=e.subtract(n,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),d=u.sign(e.dot(s,n))*e.magnitude(s);return r(a)?(a.longitude=c,a.latitude=l,a.height=d,a):new t(c,l,d)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,d=s.z,f=a*a*c*c,h=i*i*l*l,m=o*o*d*d,v=f+h+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,_=x.z,O=y;O.x=2*w.x*E,O.y=2*w.y*S,O.z=2*w.z*_;var M,T,P,A,N,R,z,I,b,C,D,U=(1-g)*e.magnitude(t)/(.5*e.magnitude(O)),L=0;do{U-=L,P=1/(1+U*E),A=1/(1+U*S),N=1/(1+U*_),R=P*P,z=A*A,I=N*N,b=R*P,C=z*A,D=I*N,M=f*R+h*z+m*I-1,T=f*b*E+h*C*S+m*D*_;var q=-2*T;L=M/q}while(Math.abs(M)>u.EPSILON12);return r(n)?(n.x=a*P,n.y=i*A,n.z=o*N,n):new e(a*P,i*A,o*N)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,a,i,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return r(n)?(n.x=i,n.y=o,n.z=u,n):new e(i,o,u)},u.prototype.unproject=function(e,n){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return r(n)?(n.longitude=i,n.latitude=o,n.height=u,n):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r,a){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(a,0)};i.fromElements=function(e,n,r,a,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=a,o):new i(e,n,r,a)},i.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r++],a.w=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,s);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):n.y<=n.z?n.y<=n.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)&&a.equalsEpsilon(e.w,n.w,r,i)},i.ZERO=r(new i(0,0,0,0)),i.UNIT_X=r(new i(1,0,0,0)),i.UNIT_Y=r(new i(0,1,0,0)),i.UNIT_Z=r(new i(0,0,1,0)),i.UNIT_W=r(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(h[n],f[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=i.EPSILON15,r=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],f[o])]);u>r&&(a=o,r=u)}var s=1,l=0,d=f[a],m=h[a];if(Math.abs(e[c.getElementIndex(m,d)])>n){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(d,d)],g=e[c.getElementIndex(m,d)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(d,d)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,d)]=l,t[c.getElementIndex(d,m)]=-l,t}var c=function(e,n,r,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++],a[4]=e[r++],a[5]=e[r++],a[6]=e[r++],a[7]=e[r++],a[8]=e[r++],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],a[4]=e[r+4],a[5]=e[r+5],a[6]=e[r+6],a[7]=e[r+7],a[8]=e[r+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,d=e.z*e.z,f=e.z*e.w,h=e.w*e.w,m=r-u-d+h,p=2*(a-f),y=2*(i+l),v=2*(a+f),g=-r+u-d+h,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-r-u+d+h;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(m,p,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=a,t[6]=0,t[7]=-a,t[8]=r,t):new c(1,0,0,0,r,-a,0,a,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=r,t):new c(r,0,a,0,1,0,-a,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=a,t[2]=0,t[3]=-a,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-a,0,a,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,a=e[r],i=e[r+1],o=e[r+2];return n.x=a,n.y=i,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=3*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],a=e[t+3],i=e[t+6];return n.x=r,n.y=a,n.z=i,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var d=new e;c.getMaximumScale=function(t){return c.getScale(t,d),e.maximumComponent(d)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],d=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=a,n[2]=i,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=d,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[3]*a+e[6]*i,u=e[1]*r+e[4]*a+e[7]*i,s=e[2]*r+e[5]*a+e[8]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var f=[1,0,0],h=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var r=i.EPSILON20,a=10,l=0,d=0;n(t)||(t={});for(var f=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=r*o(h);a>d&&u(h)>y;)s(h,m),c.transpose(m,p),c.multiply(h,m,h),c.multiply(p,h,h),c.multiply(f,m,f),++l>2&&(++d,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*r-n*c)+u*(n*o-i*r)},c.inverse=function(e,t){var n=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],d=e[6],f=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=i.EPSILON15)throw new r("matrix is not invertible");t[0]=s*h-f*l,t[1]=f*o-a*h,t[2]=a*l-s*o,t[3]=d*l-u*h,t[4]=n*h-d*o,t[5]=u*o-n*l,t[6]=u*f-d*s,t[7]=d*a-n*f,t[8]=n*s-u*a;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,a,i,o,u,s){"use strict";var c=function(e,t,r,a,i,o,u,s,c,l,d,f,h,m,p,y){this[0]=n(e,0),this[1]=n(i,0),this[2]=n(c,0),this[3]=n(h,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(d,0),this[11]=n(p,0),this[12]=n(a,0),this[13]=n(s,0),this[14]=n(f,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=n(a,e.ZERO),r(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,a){r(a)||(a=new c);var i=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,d=t.x*t.z,f=t.x*t.w,h=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-y+g,x=2*(l-v),E=2*(d+p),S=2*(l+v),_=-s+h-y+g,O=2*(m-f),M=2*(d-p),T=2*(m+f),P=-s-h+y+g;return a[0]=w*i,a[1]=S*i,a[2]=M*i,a[3]=0,a[4]=x*o,a[5]=_*o,a[6]=T*o,a[7]=0,a[8]=E*u,a[9]=O*u,a[10]=P*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,d=new e,f=new e;c.fromCamera=function(t,n){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,d),d),e.normalize(e.cross(d,l,f),f);var u=d.x,s=d.y,h=d.z,m=l.x,p=l.y,y=l.z,v=f.x,g=f.y,w=f.z,x=a.x,E=a.y,S=a.z,_=u*-x+s*-E+h*-S,O=v*-x+g*-E+w*-S,M=m*x+p*E+y*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=g,n[6]=-p,n[7]=0,n[8]=h,n[9]=w,n[10]=-y,n[11]=0,n[12]=_,n[13]=O,n[14]=M,n[15]=1,n):new c(u,s,h,_,v,g,w,O,-m,-p,-y,M,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,n,r,a,i,o){var u=1/(t-e),s=1/(r-n),c=1/(i-a),l=-(t+e)*u,d=-(r+n)*s,f=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=d,o[14]=f,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,n,r,a,i,o){var u=2*a/(t-e),s=2*a/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),d=-(i+a)/(i-a),f=-1,h=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=d,o[11]=f,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,a,i){var o=2*a/(t-e),u=2*a/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,d=-1,f=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=d,i[12]=0,i[13]=0,i[14]=f,i[15]=0,i},c.computeViewportTransformation=function(e,t,r,a){e=n(e,n.EMPTY_OBJECT);var i=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,d=.5*(r-t),f=c,h=l,m=d,p=i+c,y=o+l,v=t+d,g=1;return a[0]=f,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=m,a[11]=0,a[12]=p,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,a=e[r],i=e[r+1],o=e[r+2],u=e[r+3];return n.x=a,n.y=i,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=4*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r[a+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return n.x=r,n.y=a,n.z=i,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var h=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],d=e[8],f=e[9],h=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],_=t[4],O=t[5],M=t[6],T=t[7],P=t[8],A=t[9],N=t[10],R=t[11],z=t[12],I=t[13],b=t[14],C=t[15],D=r*w+u*x+d*E+p*S,U=a*w+s*x+f*E+y*S,L=i*w+c*x+h*E+v*S,q=o*w+l*x+m*E+g*S,B=r*_+u*O+d*M+p*T,F=a*_+s*O+f*M+y*T,W=i*_+c*O+h*M+v*T,G=o*_+l*O+m*M+g*T,k=r*P+u*A+d*N+p*R,V=a*P+s*A+f*N+y*R,j=i*P+c*A+h*N+v*R,Y=o*P+l*A+m*N+g*R,H=r*z+u*I+d*b+p*C,Z=a*z+s*I+f*b+y*C,X=i*z+c*I+h*b+v*C,J=o*z+l*I+m*b+g*C;return n[0]=D,n[1]=U,n[2]=L,n[3]=q,n[4]=B,n[5]=F,n[6]=W,n[7]=G,n[8]=k,n[9]=V,n[10]=j,n[11]=Y,n[12]=H,n[13]=Z,n[14]=X,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],d=e[10],f=e[12],h=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],_=t[10],O=t[12],M=t[13],T=t[14],P=r*p+o*y+c*v,A=a*p+u*y+l*v,N=i*p+s*y+d*v,R=r*g+o*w+c*x,z=a*g+u*w+l*x,I=i*g+s*w+d*x,b=r*E+o*S+c*_,C=a*E+u*S+l*_,D=i*E+s*S+d*_,U=r*O+o*M+c*T+f,L=a*O+u*M+l*T+h,q=i*O+s*M+d*T+m;return n[0]=P,n[1]=A,n[2]=N,n[3]=0,n[4]=R,n[5]=z,n[6]=I,n[7]=0,n[8]=b,n[9]=C,n[10]=D,n[11]=0,n[12]=U,n[13]=L,n[14]=q,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],d=e[10],f=t[0],h=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=r*f+o*h+c*m,S=a*f+u*h+l*m,_=i*f+s*h+d*m,O=r*p+o*y+c*v,M=a*p+u*y+l*v,T=i*p+s*y+d*v,P=r*g+o*w+c*x,A=a*g+u*w+l*x,N=i*g+s*w+d*x;return n[0]=E,n[1]=S,n[2]=_,n[3]=0,n[4]=O,n[5]=M,n[6]=T,n[7]=0,n[8]=P,n[9]=A,n[10]=N,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=r*e[0]+a*e[4]+i*e[8]+e[12],u=r*e[1]+a*e[5]+i*e[9]+e[13],s=r*e[2]+a*e[6]+i*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var p=new e;c.multiplyByUniformScale=function(e,t,n){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,n)},c.multiplyByScale=function(e,t,n){var r=t.x,a=t.y,i=t.z;return 1===r&&1===a&&1===i?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=a*e[4],n[5]=a*e[5],n[6]=a*e[6],n[7]=0,n[8]=i*e[8],n[9]=i*e[9],n[10]=i*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*r+e[4]*a+e[8]*i+e[12]*o,s=e[1]*r+e[5]*a+e[9]*i+e[13]*o,c=e[2]*r+e[6]*a+e[10]*i+e[14]*o,l=e[3]*r+e[7]*a+e[11]*i+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i,u=e[1]*r+e[5]*a+e[9]*i,s=e[2]*r+e[6]*a+e[10]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i+e[12],u=e[1]*r+e[5]*a+e[9]*i+e[13],s=e[2]*r+e[6]*a+e[10]*i+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],a=e[4],i=e[8],l=e[12],d=e[1],f=e[5],h=e[9],m=e[13],p=e[2],x=e[6],E=e[10],S=e[14],_=e[3],O=e[7],M=e[11],T=e[15],P=E*T,A=S*M,N=x*T,R=S*O,z=x*M,I=E*O,b=p*T,C=S*_,D=p*M,U=E*_,L=p*O,q=x*_,B=P*f+R*h+z*m-(A*f+N*h+I*m),F=A*d+b*h+U*m-(P*d+C*h+D*m),W=N*d+C*f+L*m-(R*d+b*f+q*m),G=I*d+D*f+q*h-(z*d+U*f+L*h),k=A*a+N*i+I*l-(P*a+R*i+z*l),V=P*r+C*i+D*l-(A*r+b*i+U*l),j=R*r+b*a+q*l-(N*r+C*a+L*l),Y=z*r+U*a+L*i-(I*r+D*a+q*i);P=i*m,A=l*h,N=a*m,R=l*f,z=a*h,I=i*f,b=r*m,C=l*d,D=r*h,U=i*d,L=r*f,q=a*d;var H=P*O+R*M+z*T-(A*O+N*M+I*T),Z=A*_+b*M+U*T-(P*_+C*M+D*T),X=N*_+C*O+L*T-(R*_+b*O+q*T),J=I*_+D*O+q*M-(z*_+U*O+L*M),Q=N*E+I*S+A*x-(z*S+P*x+R*E),K=D*S+P*p+C*E-(b*E+U*S+A*p),$=b*x+q*S+R*p-(L*S+N*p+C*x),et=L*E+z*p+U*x-(D*x+q*E+I*p),tt=r*B+a*F+i*W+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=B*tt,n[1]=F*tt,n[2]=W*tt,n[3]=G*tt,n[4]=k*tt,n[5]=V*tt,n[6]=j*tt,n[7]=Y*tt,n[8]=H*tt,n[9]=Z*tt,n[10]=X*tt,n[11]=J*tt,n[12]=Q*tt,n[13]=K*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],d=e[12],f=e[13],h=e[14],m=-n*d-r*f-a*h,p=-i*d-o*f-u*h,y=-s*d-c*f-l*h;return t[0]=n,t[1]=i,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t,n){this.normal=e.clone(t),this.distance=n};a.fromPointNormal=function(n,r,i){var o=-e.dot(r,n);return t(i)?(e.clone(r,i.normal),i.distance=o,i):new a(r,o)};var i=new e;return a.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,i),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new a(o,u)},a.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},a.ORIGIN_XY_PLANE=r(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=r(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=r(new a(e.UNIT_Y,0)),a}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(a,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.west=e[r++],a.south=e[r++],a.east=e[r++],a.north=e[r],a},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,a,i,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),n(o)?(o.west=e,o.south=r,o.east=a,o.north=i,o):new s(e,r,a,i)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=i,t.east=a,t.north=o,t):new s(r,i,a,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),d=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=d)return void 0;var f=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return f>=h?void 0:n(r)?(r.west=l,r.south=f,r.east=d,r.north=h,r):new s(l,f,d,h)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>a||u.equalsEpsilon(n,a,u.EPSILON14))&&(i>n||u.equalsEpsilon(n,i,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,a,o){r=t(r,i.WGS84),a=t(a,0),n(o)||(o=[]);var l=0,d=e.north,f=e.south,h=e.east,m=e.west,p=c;p.height=a,p.longitude=m,p.latitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=f,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=0>d?d:f>0?f:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=r.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,a,i,o,u,s,c,l,d,f){"use strict";var h=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,_=new e,O=new e,M=new e;h.fromPoints=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var a=e.clone(t[0],x),i=e.clone(a,m),o=e.clone(a,p),u=e.clone(a,y),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),d=t.length,f=1;d>f;f++){e.clone(t[f],a);var T=a.x,P=a.y,A=a.z;T<i.x&&e.clone(a,i),T>s.x&&e.clone(a,s),P<o.y&&e.clone(a,o),P>c.y&&e.clone(a,c),A<u.z&&e.clone(a,u),A>l.z&&e.clone(a,l)}var N=e.magnitudeSquared(e.subtract(s,i,E)),R=e.magnitudeSquared(e.subtract(c,o,E)),z=e.magnitudeSquared(e.subtract(l,u,E)),I=i,b=s,C=N;R>C&&(C=R,I=o,b=c),z>C&&(C=z,I=u,b=l);var D=S;D.x=.5*(I.x+b.x),D.y=.5*(I.y+b.y),D.z=.5*(I.z+b.z);var U=e.magnitudeSquared(e.subtract(b,D,E)),L=Math.sqrt(U),q=_;q.x=i.x,q.y=o.y,q.z=u.z;var B=O;B.x=s.x,B.y=c.y,B.z=l.z;var F=e.multiplyByScalar(e.add(q,B,E),.5,M),W=0;for(f=0;d>f;f++){e.clone(t[f],a);var G=e.magnitude(e.subtract(a,F,E));G>W&&(W=G);var k=e.magnitudeSquared(e.subtract(a,D,E));if(k>U){var V=Math.sqrt(k);L=.5*(L+V),U=L*L;var j=V-L;D.x=(L*D.x+j*a.x)/V,D.y=(L*D.y+j*a.y)/V,D.z=(L*D.z+j*a.z)/V}}return W>L?(e.clone(D,n.center),n.radius=L):(e.clone(F,n.center),n.radius=W),n};var T=new u,P=new e,A=new e,N=new t,R=new t;h.fromRectangle2D=function(e,t,n){return h.fromRectangleWithHeights2D(e,t,0,0,n)},h.fromRectangleWithHeights2D=function(t,a,i,o,u){if(r(u)||(u=new h),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=n(a,T),f.southwest(t,N),N.height=i,f.northeast(t,R),R.height=o;var s=a.project(N,P),c=a.project(R,A),l=c.x-s.x,d=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+d*d+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*d,p.z=s.z+.5*m,u};var z=[];h.fromRectangle3D=function(e,t,a,i){t=n(t,o.WGS84),a=n(a,0);var u;return r(e)&&(u=f.subsample(e,t,a,z)),h.fromPoints(u,i)},h.fromVertices=function(t,a,i,o){if(r(o)||(o=new h),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=n(a,e.ZERO),i=n(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),d=e.clone(u,v),f=e.clone(u,g),T=e.clone(u,w),P=t.length,A=0;P>A;A+=i){var N=t[A]+a.x,R=t[A+1]+a.y,z=t[A+2]+a.z;u.x=N,u.y=R,u.z=z,N<s.x&&e.clone(u,s),N>d.x&&e.clone(u,d),R<c.y&&e.clone(u,c),R>f.y&&e.clone(u,f),z<l.z&&e.clone(u,l),z>T.z&&e.clone(u,T)}var I=e.magnitudeSquared(e.subtract(d,s,E)),b=e.magnitudeSquared(e.subtract(f,c,E)),C=e.magnitudeSquared(e.subtract(T,l,E)),D=s,U=d,L=I;b>L&&(L=b,D=c,U=f),C>L&&(L=C,D=l,U=T);var q=S;q.x=.5*(D.x+U.x),q.y=.5*(D.y+U.y),q.z=.5*(D.z+U.z);var B=e.magnitudeSquared(e.subtract(U,q,E)),F=Math.sqrt(B),W=_;W.x=s.x,W.y=c.y,W.z=l.z;var G=O;G.x=d.x,G.y=f.y,G.z=T.z;var k=e.multiplyByScalar(e.add(W,G,E),.5,M),V=0;for(A=0;P>A;A+=i){u.x=t[A]+a.x,u.y=t[A+1]+a.y,u.z=t[A+2]+a.z;var j=e.magnitude(e.subtract(u,k,E));j>V&&(V=j);var Y=e.magnitudeSquared(e.subtract(u,q,E));if(Y>B){var H=Math.sqrt(Y);F=.5*(F+H),B=F*F;var Z=H-F;q.x=(F*q.x+Z*u.x)/H,q.y=(F*q.y+Z*u.y)/H,q.z=(F*q.z+Z*u.z)/H}}return V>F?(e.clone(q,o.center),o.radius=F):(e.clone(k,o.center),o.radius=V),o},h.fromCornerPoints=function(t,n,a){r(a)||(a=new h);var i=a.center;return e.add(t,n,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,n),a},h.fromEllipsoid=function(t,n){return r(n)||(n=new h),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var I=new e;h.fromBoundingSpheres=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var a=t.length;if(1===a)return h.clone(t[0],n);if(2===a)return h.union(t[0],t[1],n);for(var i=[],o=0;a>o;o++)i.push(t[o].center);n=h.fromPoints(i,n);var u=n.center,s=n.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,I)+c.radius)}return n.radius=s,n},h.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,r){r=n(r,0);var a=e.center;t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r]=e.radius},h.unpack=function(e,t,a){t=n(t,0),r(a)||(a=new h);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var b=new e,C=new e;h.union=function(t,n,a){r(a)||(a=new h);var i=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,i,b),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return n.clone(a),a;var d=.5*(o+l+s),f=e.multiplyByScalar(c,(-o+d)/l,C);return e.add(f,i,f),e.clone(f,a.center),a.radius=d,a};var D=new e;h.expand=function(t,n,r){r=h.clone(t,r);var a=e.magnitude(e.subtract(n,r.center,D));return a>r.radius&&(r.radius=a),r},h.intersectPlane=function(t,n){var r=t.center,a=t.radius,i=n.normal,o=e.dot(i,r)+n.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var U=new d(new e,0);h.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=d.fromCartesian4(t,U);return h.intersectPlane(e,n)},h.transform=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var L=new e;h.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,L);return e.magnitudeSquared(r)-t.radius*t.radius},h.transformWithoutScale=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var q=new e;h.computePlaneDistances=function(t,n,a,i){r(i)||(i=new c);var o=e.subtract(t.center,n,q),u=e.multiplyByScalar(a,e.dot(a,o),q),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var B=new e,F=new e,W=new e,G=new e,k=new e,V=new t,j=new Array(8),Y=0;8>Y;++Y)j[Y]=new e;var H=new u;return h.projectTo2D=function(t,r,a){r=n(r,H);var i=r.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,F);e.normalize(c,c);var l=e.cross(s,c,W);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var d=e.negate(l,k),f=e.negate(c,G),m=j,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,f,p),p=m[2],e.add(s,d,p),e.add(p,f,p),p=m[3],e.add(s,d,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,f,p),p=m[6],e.add(s,d,p),e.add(p,f,p),p=m[7],e.add(s,d,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,V);r.project(w,g)}a=h.fromPoints(m,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},h.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(r.requestFullscreen=a,n=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(r.requestFullscreen=a,n=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?r.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(r.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?r.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(r.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?r.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(r.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),r.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),r.fullscreenerror=a)}return n},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[r.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[r.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=r(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1])))}return S}function d(){return l()&&_}function f(){if(!t(O)){O=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(O=!0,M=r(e[1]))}return O}function h(){return t(T)||(T=/Windows/i.test(navigator.appVersion)),T}function m(){return f()&&M}function p(){return t(P)||(P=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),P}var y,v,g,w,x,E,S,_,O,M,T,P,A={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:d,isFirefox:f,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return A.supportsFullscreen=function(){return n.supportsFullscreen()},A.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},A.supportsWebWorkers=function(){return"undefined"!=typeof Worker},A}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,a){"use strict";if(!r.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,r,a,o){switch(a=e(a,0),o=e(o,(r.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(r,a,o);case i.UNSIGNED_BYTE:return new Uint8Array(r,a,o);case i.SHORT:return new Int16Array(r,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(r,a,o);case i.FLOAT:return new Float32Array(r,a,o);case i.DOUBLE:return new Float64Array(r,a,o);default:throw new n("componentDatatype is not a valid value.")}},a(i)}),define("Core/CornerType",["./freezeObject"],function(e){"use strict";var t={ROUNDED:0,MITERED:1,BEVELED:2};return e(t)}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(e){var t=e._uSquared,n=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,a=(n-r)/n,i=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-a)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,i),d=s*o,f=d*d,h=1-f,m=Math.sqrt(h),p=t/4,y=p*p,v=y*p,g=y*y,w=1+p-3*y/4+5*v/4-175*g/64,x=1-p+15*y/8-35*v/8,E=1-3*p+35*y/4,S=1-5*p,_=w*l-x*Math.sin(2*l)*p/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,O=e._constants;O.a=n,O.b=r,O.f=a,O.cosineHeading=i,O.sineHeading=o,O.tanU=u,O.cosineU=s,O.sineU=c,O.sigma=l,O.sineAlpha=d,O.sineSquaredAlpha=f,O.cosineSquaredAlpha=h,O.cosineAlpha=m,O.u2Over4=p,O.u4Over16=y,O.u6Over64=v,O.u8Over256=g,O.a0=w,O.a1=x,O.a2=E,O.a3=S,O.distanceRatio=_}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,n,r,a,i,o){var u=c(e,n);return(1-u)*e*t*(r+u*a*(o+u*i*(2*o*o-1)))}function d(e,t,n,r,a,i,o){var s,c,d,f,h,m=(t-n)/t,p=i-r,y=Math.atan((1-m)*Math.tan(a)),v=Math.atan((1-m)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,_=g*E,O=w*E,M=w*x,T=p,P=u.TWO_PI,A=Math.cos(T),N=Math.sin(T);do{A=Math.cos(T),N=Math.sin(T);var R=_-M*A;d=Math.sqrt(x*x*N*N+R*R),c=O+S*A,s=Math.atan2(d,c);var z;0===d?(z=0,f=1):(z=S*N/d,f=1-z*z),P=T,h=c-2*O/f,isNaN(h)&&(h=0),T=p+l(m,z,f,s,d,c,h)}while(Math.abs(T-P)>u.EPSILON12);var I=f*(t*t-n*n)/(n*n),b=1+I*(4096+I*(I*(320-175*I)-768))/16384,C=I*(256+I*(I*(74-47*I)-128))/1024,D=h*h,U=C*d*(h+C*(c*(2*D-1)-C*h*(4*d*d-3)*(4*D-3)/6)/4),L=n*b*(s-U),q=Math.atan2(x*N,_-M*A),B=Math.atan2(g*N,_*A-M);e._distance=L,e._startHeading=q,e._endHeading=B,e._uSquared=I}function f(n,r,a,i){e.normalize(i.cartographicToCartesian(r,m),h),e.normalize(i.cartographicToCartesian(a,m),m),d(n,i.maximumRadius,i.minimumRadius,r.longitude,r.latitude,a.longitude,a.latitude),n._start=t.clone(r,n._start),n._end=t.clone(a,n._end),n._start.height=0,n._end.height=0,s(n)}var h=new e,m=new e,p=function(e,a,i){var u=n(i,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,r(e)&&r(a)&&f(this,e,a,u)};return a(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(e,t){f(this,e,t,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},p.prototype.interpolateUsingSurfaceDistance=function(e,n){var a=this._constants,i=a.distanceRatio+e/a.b,o=Math.cos(2*i),u=Math.cos(4*i),s=Math.cos(6*i),c=Math.sin(2*i),d=Math.sin(4*i),f=Math.sin(6*i),h=Math.sin(8*i),m=i*i,p=i*m,y=a.u8Over256,v=a.u2Over4,g=a.u6Over64,w=a.u4Over16,x=2*p*y*o/3+i*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*d-m*((g-11*y/2)*c+5*y*d/2)+(29*g/96-29*y/16)*f+539*y*h/1536,E=Math.asin(Math.sin(x)*a.cosineAlpha),S=Math.atan(a.a/a.b*Math.tan(E));x-=a.sigma;var _=Math.cos(2*a.sigma+x),O=Math.sin(x),M=Math.cos(x),T=a.cosineU*M,P=a.sineU*O,A=Math.atan2(O*a.sineHeading,T-P*a.cosineHeading),N=A-l(a.f,a.sineAlpha,a.cosineSquaredAlpha,x,O,M,_);return r(n)?(n.longitude=this._start.longitude+N,n.latitude=S,n.height=0,n):new t(this._start.longitude+N,S,0)},p}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict"; -function n(e,n,r){var a=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(n)))<r?0:a}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,a){var i;if(0===e)return 0===r?[]:[-a/r];if(0===r){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-r/e,0>i?[i,0]:[0,i];var c=r*r,l=4*e*a,d=n(c,-l,t.EPSILON14);if(0>d)return[];var f=-.5*n(r,t.sign(r)*Math.sqrt(d),t.EPSILON14);return r>0?[f/e,a/f]:[a/f,f/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var a,i,o=e,u=t/3,s=n/3,c=r,l=o*s,d=u*c,f=u*u,h=s*s,m=o*s-f,p=o*c-u*s,y=u*c-h,v=4*m*y-p*p;if(0>v){var g,w,x;f*d>=l*h?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var _=i/2,O=0>_?-Math.pow(-_,1/3):Math.pow(_,1/3),M=i===S?-O:-w/O;return a=0>=w?O+M:-x/(O*O+M*M+w),f*d>=l*h?[(a-u)/o]:[-c/(a+s)]}var T=m,P=-2*u*m+o*p,A=y,N=-c*p+2*s*y,R=Math.sqrt(v),z=Math.sqrt(3)/2,I=Math.abs(Math.atan2(o*R,-P)/3);a=2*Math.sqrt(-T);var b=Math.cos(I);i=a*b;var C=a*(-b/2-z*Math.sin(I)),D=i+C>2*u?i-u:C-u,U=o,L=D/U;I=Math.abs(Math.atan2(c*R,-N)/3),a=2*Math.sqrt(-A),b=Math.cos(I),i=a*b,C=a*(-b/2-z*Math.sin(I));var q=-c,B=2*s>i+C?i+s:C+s,F=q/B,W=U*B,G=-D*B-U*q,k=D*q,V=(s*G-u*k)/(-u*G+s*W);return V>=L?F>=L?F>=V?[L,V,F]:[L,F,V]:[F,L,V]:F>=L?[V,L,F]:F>=V?[V,F,L]:[F,V,L]}var r={};return r.computeDiscriminant=function(e,t,n,r){var a=e*e,i=t*t,o=n*n,u=r*r,s=18*e*t*n*r+i*o-27*a*u-4*(e*o*n+i*t*r);return s},r.computeRealRoots=function(e,r,a,i){var o,u;if(0===e)return t.computeRealRoots(r,a,i);if(0===r){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,a,i)}return 0===a?0===i?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,i):0===i?(o=t.computeRealRoots(e,r,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,a,i)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,d=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(d.length>0){var f=-t/4,h=d[d.length-1];if(Math.abs(h)<n.EPSILON14){var m=r.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[f-w,f-g,f+g,f+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[f-p,f+p];if(0>y&&v>=0)return p=Math.sqrt(v),[f-p,f+p]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,_=r.computeRealRoots(1,x,E),O=r.computeRealRoots(1,-x,S);return 0!==_.length?(_[0]+=f,_[1]+=f,0!==O.length?(O[0]+=f,O[1]+=f,_[1]<=O[0]?[_[0],_[1],O[0],O[1]]:O[1]<=_[0]?[O[0],O[1],_[0],_[1]]:_[0]>=O[0]&&_[1]<=O[1]?[O[0],_[0],_[1],O[1]]:O[0]>=_[0]&&O[1]<=_[1]?[_[0],O[0],O[1],_[1]]:_[0]>O[0]&&_[0]<O[1]?[O[0],_[0],O[1],_[1]]:[_[0],O[0],_[1],O[1]]):_):0!==O.length?(O[0]+=f,O[1]+=f,O):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,d=i*t+s-4*o,f=c*o-i*a*t+u,h=e.computeRealRoots(1,l,d,f);if(h.length>0){var m,p,y=h[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),_=c-4*y,O=c+4*Math.abs(y);if(0>y||_*S>E*O){var M=Math.sqrt(_);m=M/2,p=0===M?0:(t*x-i)/M}else{var T=Math.sqrt(E);m=0===T?0:(t*x-i)/T,p=T/2}var P,A;0===w&&0===m?(P=0,A=0):n.sign(w)===n.sign(m)?(P=w+m,A=y/P):(A=w-m,P=y/A);var N,R;0===x&&0===p?(N=0,R=0):n.sign(x)===n.sign(p)?(N=x+p,R=o/N):(R=x-p,N=o/R);var z=r.computeRealRoots(1,P,N),I=r.computeRealRoots(1,A,R);if(0!==z.length)return 0!==I.length?z[1]<=I[0]?[z[0],z[1],I[0],I[1]]:I[1]<=z[0]?[I[0],I[1],z[0],z[1]]:z[0]>=I[0]&&z[1]<=I[1]?[I[0],z[0],z[1],I[1]]:I[0]>=z[0]&&I[1]<=z[1]?[z[0],I[0],I[1],z[1]]:z[0]>I[0]&&z[0]<I[1]?[I[0],z[0],I[1],z[1]]:[z[0],I[0],z[1],I[1]]:z;if(0!==I.length)return I}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=n*n,l=c*n,d=r*r,f=d*r,h=a*a,m=h*a,p=u*c*d-4*s*f-4*e*l*d+18*e*t*n*f-27*i*d*d+256*o*m+a*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*d+144*i*n*d)+h*(144*e*u*n-27*u*u-128*i*c-192*i*t*r);return p},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,d=u/t,f=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>d?h+1:h,h+=0>f?h+1:h){case 0:return a(c,l,d,f);case 1:return i(c,l,d,f);case 2:return i(c,l,d,f);case 3:return a(c,l,d,f);case 4:return a(c,l,d,f);case 5:return i(c,l,d,f);case 6:return a(c,l,d,f);case 7:return a(c,l,d,f);case 8:return i(c,l,d,f);case 9:return a(c,l,d,f);case 10:return a(c,l,d,f);case 11:return i(c,l,d,f);case 12:return a(c,l,d,f);case 13:return a(c,l,d,f);case 14:return a(c,l,d,f);case 15:return a(c,l,d,f);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,a){return n(a)||(a=new e),a=e.multiplyByScalar(t.direction,r,a),e.add(t.origin,a,a)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(t,r,a,o,u){u=n(u,!1);var s,c,l,d,f,h=t.origin,m=t.direction,p=e.subtract(a,r,y),E=e.subtract(o,r,v),S=e.cross(m,E,g),_=e.dot(p,S);if(u){if(_<i.EPSILON6)return void 0;if(s=e.subtract(h,r,w),l=e.dot(s,S),0>l||l>_)return void 0;if(c=e.cross(s,p,x),d=e.dot(m,c),0>d||l+d>_)return void 0;f=e.dot(E,c)/_}else{if(Math.abs(_)<i.EPSILON6)return void 0;var O=1/_;if(s=e.subtract(h,r,w),l=e.dot(s,S)*O,0>l||l>1)return void 0;if(c=e.cross(s,p,x),d=e.dot(m,c)*O,0>d||l+d>1)return void 0;f=e.dot(E,c)*O}return f}function d(e,t,n,r){var a=t*t-4*e*n;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function f(t,n,a){r(a)||(a={});var i=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(i,u,g),l=e.dot(o,o),f=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=d(l,f,h,S);return r(m)?(a.start=m.root0,a.stop=m.root1,a):void 0}function h(e,t,n){var r=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function m(t,n,r,a,c){var l,d=a*a,f=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*f,p=c*(a*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*d+t[o.COLUMN2ROW2]*f+a*n.x+r,v=f*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],_=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-_)),w.push(new e(a,c*S,c*_))}return w}var O=g*g,M=v*v,T=m*m,P=g*v,A=T+M,N=2*(p*m+P),R=2*y*m+p*p-M+O,z=2*(y*p-P),I=y*y-O;if(0===A&&0===N&&0===R&&0===z)return w;l=s.computeRealRoots(A,N,R,z,I);var b=l.length;if(0===b)return w;for(var C=0;b>C;++C){var D,U=l[C],L=U*U,q=Math.max(1-L,0),B=Math.sqrt(q);D=i.sign(m)===i.sign(y)?h(m*L+y,p*U,i.EPSILON12):i.sign(y)===i.sign(p*U)?h(m*L,p*U+y,i.EPSILON12):h(m*L+p*U,y,i.EPSILON12);var F=h(v*U,g,i.EPSILON15),W=D*F;0>W?w.push(new e(a,c*U,c*B)):W>0?w.push(new e(a,c*U,c*-B)):0!==B?(w.push(new e(a,c*U,c*-B)),w.push(new e(a,c*U,c*B)),++C):w.push(new e(a,c*U,c*B))}return w}var p={};p.rayPlane=function(t,n,a){r(a)||(a=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,n,a,i,o,u){var s=l(t,n,a,i,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;p.lineSegmentTriangle=function(t,n,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var d=l(c,a,i,o,u);return!r(d)||0>d||d>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,d,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};p.raySphere=function(e,t,n){return n=f(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var _=new c;p.lineSegmentSphere=function(t,n,a,i){var o=_;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=f(o,a,i),!r(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var O=new e,M=new e;p.rayEllipsoid=function(t,n){var r,a,i,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,O),l=e.multiplyComponents(s,t.direction,M),d=e.magnitudeSquared(c),f=e.dot(c,l);if(d>1){if(f>=0)return void 0;var h=f*f;if(r=d-1,a=e.magnitudeSquared(l),i=a*r,i>h)return void 0;if(h>i){o=f*f-i,u=-f+Math.sqrt(o);var m=u/a,p=r/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(r/a);return{start:y,stop:y}}return 1>d?(r=d-1,a=e.magnitudeSquared(l),i=a*r,o=f*f-i,u=-f+Math.sqrt(o),{start:0,stop:u/a}):0>f?(a=e.magnitudeSquared(l),{start:0,stop:-f/a}):void 0};var T=new e,P=new e,A=new e,N=new e,R=new e,z=new o,I=new o,b=new o,C=new o,D=new o,U=new o,L=new o,q=new e,B=new e,F=new t;p.grazingAltitudeLocation=function(t,n){var a=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(a,T);if(e.dot(u,s)>=0)return a;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,T),d=e.normalize(l,l),f=e.mostOrthogonalAxis(l,N),h=e.normalize(e.cross(f,d,P),P),p=e.normalize(e.cross(d,h,A),A),y=z;y[0]=d.x,y[1]=d.y,y[2]=d.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,I),g=o.fromScale(n.radii,b),w=o.fromScale(n.oneOverRadii,C),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,_=o.multiply(o.multiply(v,w,U),x,U),O=o.multiply(o.multiply(_,g,L),y,L),M=o.multiplyByVector(_,a,R),W=m(O,e.negate(M,T),0,0,1),G=W.length;if(G>0){for(var k=e.clone(e.ZERO,B),V=Number.NEGATIVE_INFINITY,j=0;G>j;++j){E=o.multiplyByVector(g,o.multiplyByVector(y,W[j],q),q);var Y=e.normalize(e.subtract(E,a,N),N),H=e.dot(Y,u);H>V&&(V=H,k=e.clone(E,k))}var Z=n.cartesianToCartographic(k,F);return V=i.clamp(V,0,1),S=e.magnitude(e.subtract(k,a,N))*Math.sqrt(1-V*V),S=c?-S:S,Z.height=S,n.cartographicToCartesian(Z,new e)}return void 0};var W=new e;return p.lineSegmentPlane=function(t,n,a,o){r(o)||(o=new e);var u=e.subtract(n,t,W),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),d=-(a.distance+l)/c;return 0>d||d>1?void 0:(e.multiplyByScalar(u,d,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,n,r,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,n)+o<0,c=e.dot(i,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var d,f;if((1===l||2===l)&&(d=new e,f=new e),1===l){if(u)return p.lineSegmentPlane(t,n,a,d),p.lineSegmentPlane(t,r,a,f),{positions:[t,n,r,d,f],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,a,d),p.lineSegmentPlane(n,t,a,f),{positions:[t,n,r,d,f],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,a,d),p.lineSegmentPlane(r,n,a,f),{positions:[t,n,r,d,f],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,a,d),p.lineSegmentPlane(r,t,a,f),{positions:[t,n,r,d,f],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,a,d),p.lineSegmentPlane(t,n,a,f),{positions:[t,n,r,d,f],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,a,d),p.lineSegmentPlane(n,r,a,f),{positions:[t,n,r,d,f],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,n,r,a,i,o,u,s,c,l,d){"use strict";function f(e,t,n){var r=O;r.length=e;var a;if(t===n){for(a=0;e>a;a++)r[a]=t;return r}var i=n-t,o=i/e;for(a=0;e>a;a++){var u=t+a*o;r[a]=u}return r}function h(t,n,r,a,i,o,u,s){var c=a.scaleToGeodeticSurface(t,A),l=a.scaleToGeodeticSurface(n,N),d=m.numberOfPoints(t,n,r),h=a.cartesianToCartographic(c,M),p=a.cartesianToCartographic(l,T),y=f(d,i,o);R.setEndPoints(h,p);var v=R.surfaceDistance/d,g=s;h.height=i;var w=a.cartographicToCartesian(h,P);e.pack(w,u,g),g+=3;for(var x=1;d>x;x++){var E=R.interpolateUsingSurfaceDistance(x*v,T);E.height=y[x],w=a.cartographicToCartesian(E,P),e.pack(w,u,g),g+=3}return g}var m={};m.numberOfPoints=function(t,n,r){var a=e.distance(t,n);return Math.ceil(a/r)};var p=new t;m.extractHeights=function(e,t){for(var n=e.length,r=new Array(n),a=0;n>a;a++){var i=e[a];r[a]=t.cartesianToCartographic(i,p).height}return r};var y=new l,v=new e,g=new e,w=new d(e.ZERO,0),x=new e,E=new d(e.ZERO,0),S=new e,_=new e,O=[],M=new t,T=new t,P=new e,A=new e,N=new e,R=new o;m.wrapLongitude=function(t,a){var i=[],o=[];if(r(t)&&t.length>0){a=n(a,l.IDENTITY);var s=l.inverseTransformation(a,y),c=l.multiplyByPoint(s,e.ZERO,v),f=l.multiplyByPointAsVector(s,e.UNIT_Y,g),h=d.fromPointNormal(c,f,w),m=l.multiplyByPointAsVector(s,e.UNIT_X,x),p=d.fromPointNormal(c,m,E),O=1;i.push(e.clone(t[0]));for(var M=i[0],T=t.length,P=1;T>P;++P){var A=t[P];if(d.getPointDistance(p,M)<0||d.getPointDistance(p,A)<0){var N=u.lineSegmentPlane(M,A,h,S);if(r(N)){var R=e.multiplyByScalar(f,5e-9,_);d.getPointDistance(h,M)<0&&e.negate(R,R),i.push(e.add(N,R,new e)),o.push(O+1),e.negate(R,R),i.push(e.add(N,R,new e)),O=1}}i.push(e.clone(t[P])),O++,M=A}o.push(O)}return{positions:i,lengths:o}};var z=c.EPSILON7;return m.removeDuplicates=function(t){var n=t.length;if(2>n)return t;var r,a,i;for(r=1;n>r&&(a=t[r-1],i=t[r],!e.equalsEpsilon(a,i,z));++r);if(r===n)return t;for(var o=t.slice(0,r);n>r;++r)i=t[r],e.equalsEpsilon(a,i,z)||(o.push(e.clone(i)),a=i);return o},m.generateArc=function(t){r(t)||(t={});var a=t.positions,o=a.length,u=n(t.ellipsoid,i.WGS84),l=n(t.height,0);if(1>o)return[];if(1===o){var d=u.scaleToGeodeticSurface(a[0],A);if(0!==l){var f=u.geodeticSurfaceNormal(d,P);e.multiplyByScalar(f,l,f),e.add(d,f,d)}return[d.x,d.y,d.z]}var p=t.minDistance;if(!r(p)){var y=n(t.granularity,c.RADIANS_PER_DEGREE);p=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=m.numberOfPoints(a[v],a[v+1],p);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var _=a[v],T=a[v+1],N=S?l[v]:l,R=S?l[v+1]:l;E=h(_,T,p,u,N,R,x,E)}O.length=0;var z=a[o-1],I=u.cartesianToCartographic(z,M);I.height=S?l[o-1]:l;var b=u.cartographicToCartesian(I,P);return e.pack(b,x,w-3),x},m.generateCartesianArc=function(t){for(var n=m.generateArc(t),r=n.length/3,a=new Array(r),i=0;r>i;i++)a[i]=e.unpack(n,3*i);return a},m}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n){this.x=e(t,0),this.y=e(n,0)};i.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new i(e,n)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)},i.ZERO=r(new i(0,0)),i.UNIT_X=r(new i(1,0)),i.UNIT_Y=r(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,a,i,o){"use strict";var u=function(r,a,i){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),n(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var a=t[0].x,i=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,d=t.length,f=1;d>f;f++){var h=t[f],m=h.x,p=h.y,y=h.z;a=Math.min(m,a),s=Math.max(m,s),i=Math.min(p,i),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=a,v.y=i,v.z=o;var g=r.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,r.center);return e.multiplyByScalar(w,.5,w),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),a=n.normal,o=r.x*Math.abs(a.x)+r.y*Math.abs(a.y)+r.z*Math.abs(a.z),u=e.dot(t.center,a)+n.distance;return u-o>0?i.INSIDE:0>u+o?i.OUTSIDE:i.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,a){return t(e).then(n,r,a)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=a(e),t}function n(t){return e(t,i)}function r(e){this.then=e}function a(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return i(r)}});return n}function i(e){var n=new r(function(n,r){try{return r?t(r(e)):i(e)}catch(a){return i(a)}});return n}function o(){function e(e,t,n){return f(e,t,n)}function n(e){return m(e)}function a(e){return m(i(e))}function u(e){return h(e)}var s,c,l,d,f,h,m;return c=new r(e),s={then:e,resolve:n,reject:a,progress:u,promise:c,resolver:{resolve:n,reject:a,progress:u}},l=[],d=[],f=function(e,t,n){var r,a;return r=o(),a="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,a)}),d.push(a),r.promise},h=function(e){return p(d,e),e},m=function(e){return e=t(e),f=e.then,m=t,h=v,p(l,e),d=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,a,i){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,d,f,h,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(n,g)),d=[],l=g-c+1,f=[],h=o(),c)for(y=h.progress,p=function(e){f.push(e),--l||(m=p=v,h.reject(f))},m=function(e){d.push(e),--c||(m=p=v,h.resolve(d))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else h.resolve(d);return h.then(r,a,i)})}function c(e,t,n,r){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,n,r)}function l(e,t,n,r){return y(1,arguments),f(e,g).then(t,n,r)}function d(){return f(arguments,g)}function f(t,n){return e(t,function(t){var r,a,i,u,s,c;if(i=a=t.length>>>0,r=[],c=o(),i)for(u=function(t,a){e(t,n).then(function(e){r[a]=e,--i||c.resolve(r)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(r);return c.promise})}function h(t,n){var r=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,r[0]=function(t,r,i){return e(t,function(t){return e(r,function(e){return n(t,e,i,a)})})},w.apply(t,r)})}function m(t,n,r){var a=arguments.length>2;return e(t,function(e){return e=a?r:e,n.resolve(e),e},function(e){return n.reject(e),i(e)},n.progress)}function p(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=n,e.join=d,e.all=l,e.map=f,e.reduce=h,e.any=c,e.some=s,e.chain=m,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,n,r,a,i;if(i=0,t=Object(this),a=t.length>>>0,n=arguments,n.length<=1)for(;;){if(i in t){r=t[i++];break}if(++i>=a)throw new TypeError}else r=n[1];for(;a>i;++i)i in t&&(r=e(r,t[i],i,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,a,i=0,o=e.length-1;o>=i;)if(r=~~((i+o)/2),a=n(e[r],t),0>a)i=r+1;else{if(!(a>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],a=function(e,t,n,r){n||(n=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+a:a+e},i=function(e,t,n,r,i,o){var u=r-e.length;return u>0&&(e=n||!i?a(e,r,o,n):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+a(c.toString(t),u||0,"0",!1),i(e,n,r,o,s)},u=function(e,t,n,r,a,o){return null!=r&&(e=e.slice(0,r)),i(e,"",t,n,a,o)},s=function(e,r,s,c,l,d,f){var h,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",_=s.length,O=0;s&&_>O;O++)switch(s.charAt(O)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(O+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(d=d?"*"==d?+t[n++]:"*"==d.charAt(0)?+t[d.slice(1,-1)]:+d:"fFeE".indexOf(f)>-1?6:"d"==f?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],f){case"s":return u(String(v),g,c,d,x,S);case"c":return u(String.fromCharCode(+v),g,c,d,x);case"b":return o(v,2,E,g,c,d,x);case"o":return o(v,8,E,g,c,d,x);case"x":return o(v,16,E,g,c,d,x);case"X":return o(v,16,E,g,c,d,x).toUpperCase();case"u":return o(v,10,E,g,c,d,x);case"i":case"d":return h=+v||0,h=Math.round(h-h%1),m=0>h?"-":w,v=m+a(String(Math.abs(h)),d,"0",!1),i(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return h=+v,m=0>h?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(f.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(f)%2],v=m+Math.abs(h)[p](d),i(v,m,g,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,a,i,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(e,t){return N.compare(e.julianDate,t.julianDate)}function d(e){g.julianDate=e;var n=N.leapSeconds,r=t(n,g,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var a=n[r].offset;if(r>0){var i=N.secondsDifference(n[r].julianDate,e);i>a&&(r--,a=n[r].offset)}N.addSeconds(e,a,e)}function f(e,n){g.julianDate=e;var r=N.leapSeconds,a=t(r,g,l);if(0>a&&(a=~a),0===a)return N.addSeconds(e,-r[0].offset,n);if(a>=r.length)return N.addSeconds(e,-r[a-1].offset,n);var i=N.secondsDifference(r[a].julianDate,e);return 0===i?N.addSeconds(e,-r[a].offset,n):1>=i?void 0:N.addSeconds(e,-r[--a].offset,n)}function h(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function m(e,t,n,r,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var d=i+(r*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return d>=43200&&(l-=1),[l,d]}var p=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,_=/^(\d{4})-?(\d{2})-?(\d{2})$/,O=/([Z+\-])?(\d{2})?:?(\d{2})?$/,M=/^(\d{2})(\.\d+)?/.source+O.source,T=/^(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,P=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,A="Invalid ISO 8601 date.",N=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,h(a,t,this),r===c.UTC&&d(this)};N.fromDate=function(e,t){var n=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(h(n[0],n[1],t),d(t),t):new N(n[0],n[1],c.UTC)},N.fromIso8601=function(e,t){e=e.replace(",",".");var n,i,u,s=e.split("T"),l=1,f=1,p=0,g=0,O=0,R=0,z=s[0],I=s[1];if(!r(z))throw new a(A);var b;if(s=z.match(_),null!==s){if(b=z.split("-").length-1,b>0&&2!==b)throw new a(A);n=+s[1],l=+s[2],f=+s[3]}else if(s=z.match(x),null!==s)n=+s[1],l=+s[2];else if(s=z.match(w),null!==s)n=+s[1];else{var C;if(s=z.match(E),null!==s){if(n=+s[1],C=+s[2],u=o(n),1>C||u&&C>366||!u&&C>365)throw new a(A)}else{if(s=z.match(S),null===s)throw new a(A);n=+s[1];var D=+s[2],U=+s[3]||0;if(b=z.split("-").length-1,b>0&&(!r(s[3])&&1!==b||r(s[3])&&2!==b))throw new a(A);var L=new Date(Date.UTC(n,0,4));C=7*D+U-L.getUTCDay()-3}i=new Date(Date.UTC(n,0,1)),i.setUTCDate(C),l=i.getUTCMonth()+1,f=i.getUTCDate()}if(u=o(n),1>l||l>12||1>f||(2!==l||!u)&&f>y[l-1]||u&&2===l&&f>v)throw new a(A);var q;if(r(I)){if(s=I.match(P),null!==s){if(b=I.split(":").length-1,b>0&&2!==b&&3!==b)throw new a(A);p=+s[1],g=+s[2],O=+s[3],R=1e3*+(s[4]||0),q=5}else if(s=I.match(T),null!==s){if(b=I.split(":").length-1,b>0&&1!==b)throw new a(A);p=+s[1],g=+s[2],O=60*+(s[3]||0),q=4}else{if(s=I.match(M),null===s)throw new a(A);p=+s[1],g=60*+(s[2]||0),q=3}if(g>=60||O>=61||p>24||24===p&&(g>0||O>0||R>0))throw new a(A);var B=s[q],F=+s[q+1],W=+(s[q+2]||0);switch(B){case"+":p-=F,g-=W;break;case"-":p+=F,g+=W;break;case"Z":break;default:g+=new Date(Date.UTC(n,l-1,f,p,g)).getTimezoneOffset()}}else g+=new Date(n,l-1,f).getTimezoneOffset();var G=60===O;for(G&&O--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,f++;for(i=u&&2===l?v:y[l-1];f>i;)f-=i,l++,l>12&&(l-=12,n++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,f--;for(;1>f;)l--,1>l&&(l+=12,n--),i=u&&2===l?v:y[l-1],f+=i;var k=m(n,l,f,p,g,O,R);return r(t)?(h(k[0],k[1],t),d(t)):t=new N(k[0],k[1],c.UTC),G&&N.addSeconds(t,1,t),t},N.now=function(e){return N.fromDate(new Date,e)};var R=new N(0,0,c.TAI);return N.toGregorianDate=function(e,t){var n=!1,a=f(e,R);r(a)||(N.addSeconds(e,-1,R),a=f(R,R),n=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var d=0|4e3*(c+1)/1461001;c=0|c-(0|1461*d/4)+31;var h=0|80*c/2447,m=0|c-(0|2447*h/80);c=0|h/11;var p=0|h+2-12*c,y=0|100*(l-49)+d+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=n,t):new i(y,p,m,v,w,x,E,n)},N.toDate=function(e){var t=N.toGregorianDate(e,p),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},N.toIso8601=function(t,n){var a,i=N.toGregorianDate(t,i);return r(n)||0===i.millisecond?r(n)&&0!==n?(a=(.01*i.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},N.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new N(e.dayNumber,e.secondsOfDay,c.TAI):void 0},N.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},N.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},N.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(N.secondsDifference(e,t))<=n},N.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},N.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},N.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},N.computeTaiMinusUtc=function(e){g.julianDate=e; -var n=N.leapSeconds,r=t(n,g,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},N.addSeconds=function(e,t,n){return h(e.dayNumber,e.secondsOfDay+t,n)},N.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return h(e.dayNumber,r,n)},N.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return h(e.dayNumber,r,n)},N.addDays=function(e,t,n){var r=e.dayNumber+t;return h(r,e.secondsOfDay,n)},N.lessThan=function(e,t){return N.compare(e,t)<0},N.lessThanOrEquals=function(e,t){return N.compare(e,t)<=0},N.greaterThan=function(e,t){return N.compare(e,t)>0},N.greaterThanOrEquals=function(e,t){return N.compare(e,t)>=0},N.prototype.clone=function(e){return N.clone(this,e)},N.prototype.equals=function(e){return N.equals(this,e)},N.prototype.equalsEpsilon=function(e,t){return N.equalsEpsilon(this,e,t)},N.prototype.toString=function(){return N.toIso8601(this)},N.leapSeconds=[new u(new N(2441317,43210,c.TAI),10),new u(new N(2441499,43211,c.TAI),11),new u(new N(2441683,43212,c.TAI),12),new u(new N(2442048,43213,c.TAI),13),new u(new N(2442413,43214,c.TAI),14),new u(new N(2442778,43215,c.TAI),15),new u(new N(2443144,43216,c.TAI),16),new u(new N(2443509,43217,c.TAI),17),new u(new N(2443874,43218,c.TAI),18),new u(new N(2444239,43219,c.TAI),19),new u(new N(2444786,43220,c.TAI),20),new u(new N(2445151,43221,c.TAI),21),new u(new N(2445516,43222,c.TAI),22),new u(new N(2446247,43223,c.TAI),23),new u(new N(2447161,43224,c.TAI),24),new u(new N(2447892,43225,c.TAI),25),new u(new N(2448257,43226,c.TAI),26),new u(new N(2448804,43227,c.TAI),27),new u(new N(2449169,43228,c.TAI),28),new u(new N(2449534,43229,c.TAI),29),new u(new N(2450083,43230,c.TAI),30),new u(new N(2450630,43231,c.TAI),31),new u(new N(2451179,43232,c.TAI),32),new u(new N(2453736,43233,c.TAI),33),new u(new N(2454832,43234,c.TAI),34),new u(new N(2456109,43235,c.TAI),35),new u(new N(2457204,43236,c.TAI),36)],N}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var a=new n.constructor;for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];r&&(o=t(o,r)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var a=n[r],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,a,i){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return r}function s(e,n){n=t(n,"");var a=e[1],i=!!e[2],s=e[3];switch(n){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s);return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,a=t(n.method,"GET"),i=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,a,i,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,d){var f=l.exec(e);if(null!==f)return c.resolve(s(f,t)),void 0;var h=new XMLHttpRequest;if(n(d)&&n(h.overrideMimeType)&&h.overrideMimeType(d),h.open(r,e,!0),n(u))for(var m in u)u.hasOwnProperty(m)&&h.setRequestHeader(m,u[m]);n(t)&&(h.responseType=t),h.onload=function(){200===h.status?n(h.response)?c.resolve(h.response):n(h.responseXML)&&h.responseXML.hasChildNodes()?c.resolve(h.responseXML):n(h.responseText)?c.resolve(h.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){c.reject(new a)},h.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(n,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,r(n,i).then(function(e){return JSON.parse(e)})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c,l,d){"use strict";function f(e,t){return o.compare(e.julianDate,t)}function h(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=n.columnNames.indexOf("modifiedJulianDateUtc"),i=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),h=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>h||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],_=y[x+p],O=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,M=new o(O,_,d.TAI);if(v.push(M),w){if(_!==g&&r(g)){var T=o.leapSeconds,P=t(T,M,f);if(0>P){var A=new u(M,_);T.splice(~P,0,A)}}g=_}}}function m(e,t,n,r,a){var i=n*r;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function p(e,t,n){return t+e*(n-t)}function y(e,t,n,r,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[a],l=t[i];if(c.equals(l)||r.equals(c))return m(e,n,a,s,u),u;if(r.equals(l))return m(e,n,i,s,u),u;var d=o.secondsDifference(r,c)/o.secondsDifference(l,c),f=a*s,h=i*s,y=n[f+e._ut1MinusUtcSecondsColumn],v=n[h+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=n[f+e._taiMinusUtcSecondsColumn],x=n[h+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(r)?y=v:v-=x-w)}return u.xPoleWander=p(d,n[f+e._xPoleWanderRadiansColumn],n[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(d,n[f+e._yPoleWanderRadiansColumn],n[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(d,n[f+e._xCelestialPoleOffsetRadiansColumn],n[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(d,n[f+e._yCelestialPoleOffsetRadiansColumn],n[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(d,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))h(this,t.data);else if(r(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){h(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new a(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var i=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var d=i[u],f=i[u+1],h=o.lessThanOrEquals(d,e),m=!r(f),p=m||o.greaterThanOrEquals(f,e);if(h&&p)return s=u,!m&&f.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,n),n}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),a=d.exec(r);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,d=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,f=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return f._cesiumScriptRegex=d,f.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},f}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t,n){var r=d;return r.dayNumber=t,r.secondsOfDay=n,i.daysDifference(r,e._sampleZeroDateTT)}function c(n,a){if(n._chunkDownloadsInProgress[a])return n._chunkDownloadsInProgress[a];var i=e.defer();n._chunkDownloadsInProgress[a]=i;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[a]=!1;for(var t=n._samples,r=e.samples,o=3*a*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];i.resolve()}),i.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},d=new i(0,0,u.TAI);return l.prototype.preload=function(t,n,r,a){var i=s(this,t,n),o=s(this,r,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var d=0|u/this._samplesPerXysFile,f=0|l/this._samplesPerXysFile,h=[],m=d;f>=m;++m)h.push(c(this,m));return e.all(h)},l.prototype.computeXysRadians=function(e,t,n){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var d=l+u;d>=this._totalSamples&&(d=this._totalSamples-1,l=d-u,0>l&&(l=0));var f=!1,h=this._samples;if(r(h[3*l])||(c(this,0|l/this._samplesPerXysFile),f=!0),r(h[3*d])||(c(this,0|d/this._samplesPerXysFile),f=!0),f)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new a(0,0,0);var m,p,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var E=3*(l+m);n.x+=w[m]*h[E++],n.y+=w[m]*h[E++],n.s+=w[m]*h[E]}return n},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,r,a){var i=r/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,d=c.z*o,f=Math.cos(i);return n(a)?(a.x=u,a.y=l,a.z=d,a.w=f,a):new s(u,l,d,f)};var l=[1,2,0],d=new Array(3);s.fromRotationMatrix=function(e,t){var r,a,i,o,c,f=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=f+h+m;if(p>0)r=Math.sqrt(p+1),c=.5*r,r=.5/r,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;h>f&&(v=1),m>f&&m>h&&(v=2);var g=y[v],w=y[g];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=d;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,a=-x[0],i=-x[1],o=-x[2]}return n(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var f=new s;s.fromHeadingPitchRoll=function(t,n,r,a){var i=s.fromAxisAngle(e.UNIT_X,r,f),o=s.fromAxisAngle(e.UNIT_Y,-n,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,f);return s.multiply(u,a,a)};var h=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.x=e[r],a.y=e[r+1],a.z=e[r+2],a.w=e[r+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var a=0,i=n-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,h);var u=s.computeAngle(p);r[o]=h.x*u,r[o+1]=h.y*u,r[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,r,a,i,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*i,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,a=e.y*n,i=e.z*n,o=e.w*n;return t.x=r,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,d=o*u+r*l+a*c-i*s,f=o*s-r*c+a*l+i*u,h=o*c+r*s-a*u+i*l,m=o*l-r*u-a*s-i*c;return n.x=d,n.y=f,n.z=h,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,n,r){return g=s.multiplyByScalar(t,n,g),r=s.multiplyByScalar(e,1-n,r),s.add(g,r,r)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,n,r);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(i,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),a=0;return 0!==r&&(a=r/Math.sin(r)),e.multiplyByScalar(t,a,n)},s.exp=function(t,n){var r=e.magnitude(t),a=0;return 0!==r&&(a=Math.sin(r)/r),n.x=t.x*a,n.y=t.y*a,n.z=t.z*a,n.w=Math.cos(r),n};var S=new e,_=new e,O=new s,M=new s;s.computeInnerQuadrangle=function(t,n,r,a){var i=s.conjugate(n,O);s.multiply(i,r,M);var o=s.log(M,S);s.multiply(i,t,M);var u=s.log(M,_);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,O),s.multiply(n,O,a)},s.squad=function(e,t,n,r,a,i){var o=s.slerp(e,t,a,O),u=s.slerp(n,r,a,M);return s.slerp(o,u,2*a*(1-a),i)};for(var T=new s,P=1.9011074535173003,A=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],R=a.supportsTypedArrays()?new Float32Array(8):[],z=a.supportsTypedArrays()?new Float32Array(8):[],I=0;7>I;++I){var b=I+1,C=2*b+1;A[I]=1/(b*C),N[I]=b/C}return A[7]=P/136,N[7]=8*P/17,s.fastSlerp=function(e,t,n,r){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-n,c=n*n,l=u*u,d=7;d>=0;--d)R[d]=(A[d]*c-N[d])*o,z[d]=(A[d]*l-N[d])*o;var f=a*n*(1+R[0]*(1+R[1]*(1+R[2]*(1+R[3]*(1+R[4]*(1+R[5]*(1+R[6]*(1+R[7])))))))),h=u*(1+z[0]*(1+z[1]*(1+z[2]*(1+z[3]*(1+z[4]*(1+z[5]*(1+z[6]*(1+z[7])))))))),m=s.multiplyByScalar(e,h,T);return s.multiplyByScalar(t,f,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,a,i){var o=s.fastSlerp(e,t,a,O),u=s.fastSlerp(n,r,a,M);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,a,i,o,u,s,c,l,d,f,h,m,p,y,v){"use strict";var g={},w=new n,x=new n,E=new n;g.eastNorthUpToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new n,_=new n,O=new n;g.northEastDownToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=_,l=O;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var M=new y,T=new n(1,1,1),P=new p;g.headingPitchRollToFixedFrame=function(e,t,r,a,i,o){var u=y.fromHeadingPitchRoll(t,r,a,M),s=p.fromTranslationQuaternionRotationScale(n.ZERO,u,T,P);return o=g.eastNorthUpToFixedFrame(e,i,o),p.multiply(o,s,o)};var A=new p,N=new m;g.headingPitchRollQuaternion=function(e,t,n,r,a,i){var o=g.headingPitchRollToFixedFrame(e,t,n,r,a,A),u=p.getRotation(o,N);return y.fromRotationMatrix(u,i)};var R=24110.54841,z=8640184.812866,I=.093104,b=-62e-7,C=1.1772758384668e-19,D=72921158553e-15,U=h.TWO_PI/86400,L=new f;g.computeTemeToPseudoFixedMatrix=function(e,t){L=f.addSeconds(e,-f.computeTaiMinusUtc(e),L);var n,r=L.dayNumber,a=L.secondsOfDay,o=r-2451545;n=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=R+n*(z+n*(I+n*b)),s=u*U%h.TWO_PI,c=D+C*(r-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,d=s+c*l,p=Math.cos(d),y=Math.sin(d);return i(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var q=32.184,B=2451545;g.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+q,a=t.stop.dayNumber,i=t.stop.secondsOfDay+q,o=g.iau2006XysData.preload(n,r,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new m);var n=g.computeFixedToIcrfMatrix(e,t);return i(n)?m.transpose(n,t):void 0};var F=new d(0,0,0),W=new s(0,0,0,0,0,0),G=new m,k=new m;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new m);var n=g.earthOrientationParameters.compute(e,W);if(!i(n))return void 0;var r=e.dayNumber,a=e.secondsOfDay+q,o=g.iau2006XysData.computeXysRadians(r,a,F);if(!i(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var d=m.fromRotationZ(-o.s,k),p=m.multiply(l,d,G),y=e.dayNumber,w=e.secondsOfDay-f.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*h.TWO_PI;var _=m.fromRotationZ(S,k),O=m.multiply(p,_,G),M=Math.cos(n.xPoleWander),T=Math.cos(n.yPoleWander),P=Math.sin(n.xPoleWander),A=Math.sin(n.yPoleWander),N=r-B+a/v.SECONDS_PER_DAY;N/=36525;var R=-47e-6*N*h.RADIANS_PER_DEGREE/3600,z=Math.cos(R),I=Math.sin(R),b=k;return b[0]=M*z,b[1]=M*I,b[2]=P,b[3]=-T*I+A*P*z,b[4]=T*z+A*P*I,b[5]=-A*M,b[6]=-A*I-T*P*z,b[7]=A*z-T*P*I,b[8]=T*M,m.multiply(O,b,t)};var V=new r;g.pointToWindowCoordinates=function(e,t,n,r){return r=g.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},g.pointToGLWindowCoordinates=function(e,n,a,o){i(o)||(o=new t);var u=V;return p.multiplyByVector(e,r.fromElements(a.x,a.y,a.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var j=new n,Y=new n,H=new n;return g.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=a(r,c.WGS84).geodeticSurfaceNormal(e,j),s=n.cross(t,u,Y);n.equalsEpsilon(s,n.ZERO,h.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,H);return n.cross(t,l,s),n.negate(s,s),i(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,d,f,h,m){"use strict";var p=new r,y=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(d.getColumn(r,0,p)),this._yAxis=n.fromCartesian4(d.getColumn(r,1,p));var i=n.fromCartesian4(d.getColumn(r,2,p));this._plane=f.fromPointNormal(e,i)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var g=new h,w=new n;y.prototype.projectPointOntoPlane=function(e,r){var a=g;a.origin=e,n.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,w);if(i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w)),i(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return i(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var n=0,r=e.length,a=0;r>a;a++){var o=this.projectPointOntoPlane(e[a],t[n]);i(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){i(r)||(r=new t);var a=g;a.origin=e,n.clone(this._plane.normal,a.direction);var o=c.rayPlane(a,this._plane,w);i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){i(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;i(t)?t.length=r:t=new Array(r);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var d=e[l];n.multiplyByScalar(u,d.x,c),i(t[l])||(t[l]=new n);var f=n.add(o,c,t[l]);n.multiplyByScalar(s,d.y,c),n.add(f,c,f),a.scaleToGeocentricSurface(f,f)}return t},y}),define("Core/PolylineVolumeGeometryLibrary",["./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./CornerType","./EllipsoidTangentPlane","./Math","./Matrix3","./Matrix4","./PolylinePipeline","./Quaternion","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,d){"use strict";function f(e,t){for(var n=new Array(e.length),r=0;r<e.length;r++){var a=e[r];C=t.cartesianToCartographic(a,C),n[r]=C.height,e[r]=t.scaleToGeodeticSurface(a,a)}return n}function h(e,n,r,a){var i,o=e[0],u=e[1],s=t.angleBetween(o,u),c=Math.ceil(s/a),l=new Array(c);if(n===r){for(i=0;c>i;i++)l[i]=n;return l.push(r),l}var d=r-n,f=d/c;for(i=1;c>i;i++){var h=n+i*f;l[i]=h}return l[0]=n,l.push(r),l}function m(n,r,a,o){var u=new i(a,o),s=u.projectPointOntoPlane(t.add(a,n,H),H),c=u.projectPointOntoPlane(t.add(a,r,Z),Z),l=e.angleBetween(s,c);return c.x*s.y-c.y*s.x>=0?-l:l}function p(e,n,r,a,i,o,c,l){var f=F,h=W;U=d.eastNorthUpToFixedFrame(e,i,U),f=s.multiplyByPointAsVector(U,D,f),f=t.normalize(f,f);var p=m(f,n,e,i);q=u.fromRotationZ(p,q),G.z=o,U=s.multiplyTransformation(U,s.fromRotationTranslation(q,G,L),U);var y=B;y[0]=c;for(var v=0;l>v;v++)for(var g=0;g<r.length;g+=3)h=t.fromArray(r,g,h),h=u.multiplyByVector(y,h,h),h=s.multiplyByPoint(U,h,h),a.push(h.x,h.y,h.z);return a}function y(e,n,r,a,i,o,u){for(var s=0;s<e.length;s+=3){var c=t.fromArray(e,s,k);a=p(c,n,r,a,i,o[s/3],u,1)}return a}function v(e,t){var n=e.length,r=new Array(6*n),a=0,i=t.x+t.width/2,o=t.y+t.height/2,u=e[0];r[a++]=u.x-i,r[a++]=0,r[a++]=u.y-o;for(var s=1;n>s;s++){u=e[s];var c=u.x-i,l=u.y-o;r[a++]=c,r[a++]=0,r[a++]=l,r[a++]=c,r[a++]=0,r[a++]=l}return u=e[0],r[a++]=u.x-i,r[a++]=0,r[a++]=u.y-o,r}function g(e,t){for(var n=e.length,r=new Array(3*n),a=0,i=t.x+t.width/2,o=t.y+t.height/2,u=0;n>u;u++)r[a++]=e[u].x-i,r[a++]=0,r[a++]=e[u].y-o; -return r}function w(e,n,r,i,s,c,d,f,h,m){var y,v=t.angleBetween(t.subtract(n,e,z),t.subtract(r,e,I)),g=i===a.BEVELED?0:Math.ceil(v/o.toRadians(5));y=s?u.fromQuaternion(l.fromAxisAngle(t.negate(e,z),v/(g+1),V),Y):u.fromQuaternion(l.fromAxisAngle(e,v/(g+1),V),Y);var w,x;if(n=t.clone(n,j),g>0)for(var E=m?2:1,S=0;g>S;S++)n=u.multiplyByVector(y,n,n),w=t.subtract(n,e,z),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(n,I),d=p(x,w,f,d,c,h,1,E);else w=t.subtract(n,e,z),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(n,I),d=p(x,w,f,d,c,h,1,1),r=t.clone(r,j),w=t.subtract(r,e,z),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(r,I),d=p(x,w,f,d,c,h,1,1);return d}function x(e,t){return o.equalsEpsilon(e.latitude,t.latitude,o.EPSILON6)&&o.equalsEpsilon(e.longitude,t.longitude,o.EPSILON6)}var E=[new t,new t],S=new t,_=new t,O=new t,M=new t,T=new t,P=new t,A=new t,N=new t,R=new t,z=new t,I=new t,b={},C=new r,D=new t(-1,0,0),U=new s,L=new s,q=new u,B=u.IDENTITY.clone(),F=new t,W=new n,G=new t,k=new t,V=new l,j=new t,Y=new u;b.removeDuplicatesFromShape=function(t){for(var n=t.length,r=[],a=n-1,i=0;n>i;a=i++){var o=t[a],u=t[i];e.equals(o,u)||r.push(u)}return r};var H=new t,Z=new t;b.angleIsGreaterThanPi=function(e,n,r,a){var o=new i(r,a),u=o.projectPointOntoPlane(t.add(r,e,H),H),s=o.projectPointOntoPlane(t.add(r,n,Z),Z);return s.x*u.y-s.y*u.x>=0};var X=new r,J=new r;b.removeDuplicatesFromPositions=function(e,t){var n=e.length;if(2>n)return e.slice(0);var r=[];r.push(e[0]);for(var a=1;n>a;++a){var i=e[a-1],o=e[a],u=t.cartesianToCartographic(i,X),s=t.cartesianToCartographic(o,J);x(u,s)||r.push(o)}return r};var Q=new t,K=new t;return b.computePositions=function(e,n,r,i,u){var s=i._ellipsoid,l=f(e,s),d=i._granularity,m=i._cornerType,x=u?v(n,r):g(n,r),I=u?g(n,r):void 0,C=r.height/2,D=r.width/2,U=e.length,L=[],q=u?[]:void 0,B=S,F=_,W=O,G=M,k=T,V=P,j=A,Y=N,H=R,Z=e[0],X=e[1];G=s.geodeticSurfaceNormal(Z,G),B=t.subtract(X,Z,B),B=t.normalize(B,B),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y);var J=l[0],$=l[1];u&&(q=p(Z,Y,I,q,s,J+C,1,1)),H=t.clone(Z,H),Z=X,F=t.negate(B,F);for(var et,tt,nt=1;U-1>nt;nt++){var rt=u?2:1;X=e[nt+1],B=t.subtract(X,Z,B),B=t.normalize(B,B),W=t.add(B,F,W),W=t.normalize(W,W),G=s.geodeticSurfaceNormal(Z,G);var at=t.multiplyByScalar(G,t.dot(B,G),Q);t.subtract(B,at,at),t.normalize(at,at);var it=t.multiplyByScalar(G,t.dot(F,G),K);t.subtract(F,it,it),t.normalize(it,it);var ot=!o.equalsEpsilon(Math.abs(t.dot(at,it)),1,o.EPSILON7);if(ot){W=t.cross(W,G,W),W=t.cross(G,W,W),W=t.normalize(W,W);var ut=1/Math.max(.25,t.magnitude(t.cross(W,F,z))),st=b.angleIsGreaterThanPi(B,F,Z,s);st?(k=t.add(Z,t.multiplyByScalar(W,ut*D,W),k),V=t.add(k,t.multiplyByScalar(Y,D,V),V),E[0]=t.clone(H,E[0]),E[1]=t.clone(V,E[1]),et=h(E,J+C,$+C,d),tt=c.generateArc({positions:E,granularity:d,ellipsoid:s}),L=y(tt,Y,x,L,s,et,1),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y),j=t.add(k,t.multiplyByScalar(Y,D,j),j),m===a.ROUNDED||m===a.BEVELED?w(k,V,j,m,st,s,L,x,$+C,u):(W=t.negate(W,W),L=p(Z,W,x,L,s,$+C,ut,rt)),H=t.clone(j,H)):(k=t.add(Z,t.multiplyByScalar(W,ut*D,W),k),V=t.add(k,t.multiplyByScalar(Y,-D,V),V),E[0]=t.clone(H,E[0]),E[1]=t.clone(V,E[1]),et=h(E,J+C,$+C,d),tt=c.generateArc({positions:E,granularity:d,ellipsoid:s}),L=y(tt,Y,x,L,s,et,1),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y),j=t.add(k,t.multiplyByScalar(Y,-D,j),j),m===a.ROUNDED||m===a.BEVELED?w(k,V,j,m,st,s,L,x,$+C,u):L=p(Z,W,x,L,s,$+C,ut,rt),H=t.clone(j,H)),F=t.negate(B,F)}else L=p(H,Y,x,L,s,J+C,1,1),H=Z;J=$,$=l[nt+1],Z=X}E[0]=t.clone(H,E[0]),E[1]=t.clone(Z,E[1]),et=h(E,J+C,$+C,d),tt=c.generateArc({positions:E,granularity:d,ellipsoid:s}),L=y(tt,Y,x,L,s,et,1),u&&(q=p(Z,Y,I,q,s,$+C,1,1)),U=L.length;var ct=u?U+q.length:U,lt=new Float64Array(ct);return lt.set(L),u&<.set(q,U),lt},b}),define("Core/CorridorGeometryLibrary",["./Cartesian3","./CornerType","./defined","./isArray","./Math","./Matrix3","./PolylinePipeline","./PolylineVolumeGeometryLibrary","./Quaternion"],function(e,t,n,r,a,i,o,u,s){"use strict";function c(n,r,o,u,c){var l=e.angleBetween(e.subtract(r,n,p),e.subtract(o,n,y)),d=u===t.BEVELED?1:Math.ceil(l/a.toRadians(5))+1,f=3*d,h=new Array(f);h[f-3]=o.x,h[f-2]=o.y,h[f-1]=o.z;var m;m=c?i.fromQuaternion(s.fromAxisAngle(e.negate(n,p),l/d,R),z):i.fromQuaternion(s.fromAxisAngle(n,l/d,R),z);var v=0;r=e.clone(r,p);for(var g=0;d>g;g++)r=i.multiplyByVector(m,r,r),h[v++]=r.x,h[v++]=r.y,h[v++]=r.z;return h}function l(n){var r=x,a=E,i=S,o=n[1];a=e.fromArray(n[1],o.length-3,a),i=e.fromArray(n[0],0,i),r=e.multiplyByScalar(e.add(a,i,r),.5,r);var u=c(r,a,i,t.ROUNDED,!1),s=n.length-1,l=n[s-1];o=n[s],a=e.fromArray(l,l.length-3,a),i=e.fromArray(o,0,i),r=e.multiplyByScalar(e.add(a,i,r),.5,r);var d=c(r,a,i,t.ROUNDED,!1);return[u,d]}function d(t,n,r,a){var i=p;return a?i=e.add(t,n,i):(n=e.negate(n,n),i=e.add(t,n,i)),[i.x,i.y,i.z,r.x,r.y,r.z]}function f(t,n,r,a){for(var i=new Array(t.length),o=new Array(t.length),u=e.multiplyByScalar(n,r,p),s=e.negate(u,y),c=0,l=t.length-1,d=0;d<t.length;d+=3){var f=e.fromArray(t,d,v),h=e.add(f,s,g);i[c++]=h.x,i[c++]=h.y,i[c++]=h.z;var m=e.add(f,u,g);o[l--]=m.z,o[l--]=m.y,o[l--]=m.x}return a.push(i,o),a}function h(e,t){for(var n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}var m={},p=new e,y=new e,v=new e,g=new e,w=[new e,new e],x=new e,E=new e,S=new e,_=new e,O=new e,M=new e,T=new e,P=new e,A=new e,N=new e,R=new s,z=new i;m.addAttribute=function(e,t,r,a){var i=t.x,o=t.y,u=t.z;n(r)&&(e[r]=i,e[r+1]=o,e[r+2]=u),n(a)&&(e[a]=u,e[a-1]=o,e[a-2]=i)};var I=new e,b=new e;m.computePositions=function(n){var r=n.granularity,i=n.positions,s=n.ellipsoid;i=h(i,s);var m=n.width/2,y=n.cornerType,v=n.saveAttributes,g=x,R=E,z=S,C=_,D=O,U=M,L=T,q=P,B=A,F=N,W=[],G=v?[]:void 0,k=v?[]:void 0,V=i[0],j=i[1];R=e.normalize(e.subtract(j,V,R),R),g=s.geodeticSurfaceNormal(V,g),C=e.normalize(e.cross(g,R,C),C),v&&(G.push(C.x,C.y,C.z),k.push(g.x,g.y,g.z)),L=e.clone(V,L),V=j,z=e.negate(R,z);var Y,H,Z=[],X=i.length;for(H=1;X-1>H;H++){g=s.geodeticSurfaceNormal(V,g),j=i[H+1],R=e.normalize(e.subtract(j,V,R),R),D=e.normalize(e.add(R,z,D),D);var J=e.multiplyByScalar(g,e.dot(R,g),I);e.subtract(R,J,J),e.normalize(J,J);var Q=e.multiplyByScalar(g,e.dot(z,g),b);e.subtract(z,Q,Q),e.normalize(Q,Q);var K=!a.equalsEpsilon(Math.abs(e.dot(J,Q)),1,a.EPSILON7);if(K){D=e.cross(D,g,D),D=e.cross(g,D,D);var $=m/Math.max(.25,e.magnitude(e.cross(D,z,p))),et=u.angleIsGreaterThanPi(R,z,V,s);D=e.multiplyByScalar(D,$,D),et?(q=e.add(V,D,q),F=e.add(q,e.multiplyByScalar(C,m,F),F),B=e.add(q,e.multiplyByScalar(C,2*m,B),B),w[0]=e.clone(L,w[0]),w[1]=e.clone(F,w[1]),Y=o.generateArc({positions:w,granularity:r,ellipsoid:s}),W=f(Y,C,m,W),v&&(G.push(C.x,C.y,C.z),k.push(g.x,g.y,g.z)),U=e.clone(B,U),C=e.normalize(e.cross(g,R,C),C),B=e.add(q,e.multiplyByScalar(C,2*m,B),B),L=e.add(q,e.multiplyByScalar(C,m,L),L),y===t.ROUNDED||y===t.BEVELED?Z.push({leftPositions:c(q,U,B,y,et)}):Z.push({leftPositions:d(V,e.negate(D,D),B,et)})):(B=e.add(V,D,B),F=e.add(B,e.negate(e.multiplyByScalar(C,m,F),F),F),q=e.add(B,e.negate(e.multiplyByScalar(C,2*m,q),q),q),w[0]=e.clone(L,w[0]),w[1]=e.clone(F,w[1]),Y=o.generateArc({positions:w,granularity:r,ellipsoid:s}),W=f(Y,C,m,W),v&&(G.push(C.x,C.y,C.z),k.push(g.x,g.y,g.z)),U=e.clone(q,U),C=e.normalize(e.cross(g,R,C),C),q=e.add(B,e.negate(e.multiplyByScalar(C,2*m,q),q),q),L=e.add(B,e.negate(e.multiplyByScalar(C,m,L),L),L),y===t.ROUNDED||y===t.BEVELED?Z.push({rightPositions:c(B,U,q,y,et)}):Z.push({rightPositions:d(V,D,q,et)})),z=e.negate(R,z)}V=j}g=s.geodeticSurfaceNormal(V,g),w[0]=e.clone(L,w[0]),w[1]=e.clone(V,w[1]),Y=o.generateArc({positions:w,granularity:r,ellipsoid:s}),W=f(Y,C,m,W),v&&(G.push(C.x,C.y,C.z),k.push(g.x,g.y,g.z));var tt;return y===t.ROUNDED&&(tt=l(W)),{positions:W,corners:Z,lefts:G,normals:k,endPositions:tt}};var C=new e,D=new e;return m.scaleToGeodeticHeight=function(t,n,a,i){var o=t.length,u=r(i)?i:new Array(t.length);u.length=t.length;for(var s=n,c=0;o>c;c+=3){var l=a.scaleToGeodeticSurface(e.fromArray(t,c,D),D),d=C;0!==n&&(d=a.geodeticSurfaceNormal(l,d),d=e.multiplyByScalar(d,s,d),l=e.add(l,d,l)),u[c]=l.x,u[c+1]=l.y,u[c+2]=l.z}return u},m}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var r=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,n,a){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,a):new Uint16Array(t,n,a)},n(a)}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return a.POSITION_ONLY=r(new a({position:!0})),a.POSITION_AND_NORMAL=r(new a({position:!0,normal:!0})),a.POSITION_NORMAL_AND_ST=r(new a({position:!0,normal:!0,st:!0})),a.POSITION_AND_ST=r(new a({position:!0,st:!0})),a.POSITION_AND_COLOR=r(new a({position:!0,color:!0})),a.ALL=r(new a({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),a.DEFAULT=a.POSITION_NORMAL_AND_ST,a.packedLength=6,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.position?1:0,n[r++]=t.normal?1:0,n[r++]=t.st?1:0,n[r++]=t.binormal?1:0,n[r++]=t.tangent?1:0,n[r++]=t.color?1:0},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.position=1===n[r++],i.normal=1===n[r++],i.st=1===n[r++],i.binormal=1===n[r++],i.tangent=1===n[r++],i.color=1===n[r++],i},a.clone=function(e,n){return t(e)?(t(n)||(n=new a),n.position=e.position,n.normal=e.normal,n.st=e.st,n.binormal=e.binormal,n.tangent=e.tangent,n.color=e.color,n):void 0},a}),define("Core/CorridorGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./CornerType","./CorridorGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolylinePipeline","./PrimitiveType","./VertexFormat"],function(e,t,n,r,a,i,o,u,s,c,l,d,f,h,m,p,y){"use strict";function v(e,n,r,i,o,u){var s=e.normals,c=e.tangents,l=e.binormals,d=t.normalize(t.cross(r,n,A),A);u.normal&&a.addAttribute(s,n,i,o),u.binormal&&a.addAttribute(l,r,i,o),u.tangent&&a.addAttribute(c,d,i,o)}function g(e,r,i){var u,s,c,m=e.positions,p=e.corners,y=e.endPositions,g=e.lefts,w=e.normals,x=new d,E=0,T=0,R=0;for(s=0;s<m.length;s+=2)c=m[s].length-3,E+=c,R+=2*c,T+=m[s+1].length-3;for(E+=3,T+=3,s=0;s<p.length;s++){u=p[s];var z=p[s].leftPositions;o(z)?(c=z.length,E+=c,R+=c):(c=p[s].rightPositions.length,T+=c,R+=c)}var I,b=o(y);b&&(I=y[0].length-3,E+=I,T+=I,I/=3,R+=6*I);var C,D,U,L,q,B,F=E+T,W=new Float64Array(F),G=r.normal?new Float32Array(F):void 0,k=r.tangent?new Float32Array(F):void 0,V=r.binormal?new Float32Array(F):void 0,j={normals:G,tangents:k,binormals:V},Y=0,H=F-1,Z=S,X=_,J=I/2,Q=f.createTypedArray(F/3,R),K=0;if(b){B=O,q=M;var $=y[0];for(Z=t.fromArray(w,0,Z),X=t.fromArray(g,0,X),s=0;J>s;s++)B=t.fromArray($,3*(J-1-s),B),q=t.fromArray($,3*(J+s),q),a.addAttribute(W,q,Y),a.addAttribute(W,B,void 0,H),v(j,Z,X,Y,H,r),D=Y/3,L=D+1,C=(H-2)/3,U=C-1,Q[K++]=C,Q[K++]=D,Q[K++]=U,Q[K++]=U,Q[K++]=D,Q[K++]=L,Y+=3,H-=3}var et=0,tt=0,nt=m[et++],rt=m[et++];W.set(nt,Y),W.set(rt,H-rt.length+1),X=t.fromArray(g,tt,X);var at,it;for(c=rt.length-3,s=0;c>s;s+=3)at=i.geodeticSurfaceNormal(t.fromArray(nt,s,A),A),it=i.geodeticSurfaceNormal(t.fromArray(rt,c-s,N),N),Z=t.normalize(t.add(at,it,Z),Z),v(j,Z,X,Y,H,r),D=Y/3,L=D+1,C=(H-2)/3,U=C-1,Q[K++]=C,Q[K++]=D,Q[K++]=U,Q[K++]=U,Q[K++]=D,Q[K++]=L,Y+=3,H-=3;for(at=i.geodeticSurfaceNormal(t.fromArray(nt,c,A),A),it=i.geodeticSurfaceNormal(t.fromArray(rt,c,N),N),Z=t.normalize(t.add(at,it,Z),Z),tt+=3,s=0;s<p.length;s++){var ot;u=p[s];var ut,st,ct=u.leftPositions,lt=u.rightPositions,dt=P,ft=O,ht=M;if(Z=t.fromArray(w,tt,Z),o(ct)){for(v(j,Z,X,void 0,H,r),H-=3,ut=L,st=U,ot=0;ot<ct.length/3;ot++)dt=t.fromArray(ct,3*ot,dt),Q[K++]=ut,Q[K++]=st-ot-1,Q[K++]=st-ot,a.addAttribute(W,dt,void 0,H),ft=t.fromArray(W,3*(st-ot-1),ft),ht=t.fromArray(W,3*ut,ht),X=t.normalize(t.subtract(ft,ht,X),X),v(j,Z,X,void 0,H,r),H-=3;dt=t.fromArray(W,3*ut,dt),ft=t.subtract(t.fromArray(W,3*st,ft),dt,ft),ht=t.subtract(t.fromArray(W,3*(st-ot),ht),dt,ht),X=t.normalize(t.add(ft,ht,X),X),v(j,Z,X,Y,void 0,r),Y+=3}else{for(v(j,Z,X,Y,void 0,r),Y+=3,ut=U,st=L,ot=0;ot<lt.length/3;ot++)dt=t.fromArray(lt,3*ot,dt),Q[K++]=ut,Q[K++]=st+ot,Q[K++]=st+ot+1,a.addAttribute(W,dt,Y),ft=t.fromArray(W,3*ut,ft),ht=t.fromArray(W,3*(st+ot),ht),X=t.normalize(t.subtract(ft,ht,X),X),v(j,Z,X,Y,void 0,r),Y+=3;dt=t.fromArray(W,3*ut,dt),ft=t.subtract(t.fromArray(W,3*(st+ot),ft),dt,ft),ht=t.subtract(t.fromArray(W,3*st,ht),dt,ht),X=t.normalize(t.negate(t.add(ht,ft,X),X),X),v(j,Z,X,void 0,H,r),H-=3}for(nt=m[et++],rt=m[et++],nt.splice(0,3),rt.splice(rt.length-3,3),W.set(nt,Y),W.set(rt,H-rt.length+1),c=rt.length-3,tt+=3,X=t.fromArray(g,tt,X),ot=0;ot<rt.length;ot+=3)at=i.geodeticSurfaceNormal(t.fromArray(nt,ot,A),A),it=i.geodeticSurfaceNormal(t.fromArray(rt,c-ot,N),N),Z=t.normalize(t.add(at,it,Z),Z),v(j,Z,X,Y,H,r),L=Y/3,D=L-1,U=(H-2)/3,C=U+1,Q[K++]=C,Q[K++]=D,Q[K++]=U,Q[K++]=U,Q[K++]=D,Q[K++]=L,Y+=3,H-=3;Y-=3,H+=3}if(Z=t.fromArray(w,w.length-3,Z),v(j,Z,X,Y,H,r),b){Y+=3,H-=3,B=O,q=M;var mt=y[1];for(s=0;J>s;s++)B=t.fromArray(mt,3*(I-s-1),B),q=t.fromArray(mt,3*s,q),a.addAttribute(W,B,void 0,H),a.addAttribute(W,q,Y),v(j,Z,X,Y,H,r),L=Y/3,D=L-1,U=(H-2)/3,C=U+1,Q[K++]=C,Q[K++]=D,Q[K++]=U,Q[K++]=U,Q[K++]=D,Q[K++]=L,Y+=3,H-=3}if(x.position=new l({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:W}),r.st){var pt,yt,vt=new Float32Array(2*(F/3)),gt=0;if(b){E/=3,T/=3;var wt=Math.PI/(I+1);yt=1/(E-I+1),pt=1/(T-I+1);var xt,Et=I/2;for(s=Et+1;I+1>s;s++)xt=h.PI_OVER_TWO+wt*s,vt[gt++]=pt*(1+Math.cos(xt)),vt[gt++]=.5*(1+Math.sin(xt));for(s=1;T-I+1>s;s++)vt[gt++]=s*pt,vt[gt++]=0;for(s=I;s>Et;s--)xt=h.PI_OVER_TWO-s*wt,vt[gt++]=1-pt*(1+Math.cos(xt)),vt[gt++]=.5*(1+Math.sin(xt));for(s=Et;s>0;s--)xt=h.PI_OVER_TWO-wt*s,vt[gt++]=1-yt*(1+Math.cos(xt)),vt[gt++]=.5*(1+Math.sin(xt));for(s=E-I;s>0;s--)vt[gt++]=s*yt,vt[gt++]=1;for(s=1;Et+1>s;s++)xt=h.PI_OVER_TWO+wt*s,vt[gt++]=yt*(1+Math.cos(xt)),vt[gt++]=.5*(1+Math.sin(xt))}else{for(E/=3,T/=3,yt=1/(E-1),pt=1/(T-1),s=0;T>s;s++)vt[gt++]=s*pt,vt[gt++]=0;for(s=E;s>0;s--)vt[gt++]=(s-1)*yt,vt[gt++]=1}x.st=new l({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:vt})}return r.normal&&(x.normal=new l({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:j.normals})),r.tangent&&(x.tangent=new l({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:j.tangents})),r.binormal&&(x.binormal=new l({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:j.binormals})),{attributes:x,indices:Q}}function w(e,n){if(!(n.normal||n.binormal||n.tangent||n.st))return e;var r,i,o=e.position.values;(n.normal||n.binormal)&&(r=e.normal.values,i=e.binormal.values);var u,s=e.position.values.length/18,c=3*s,l=2*s,d=2*c;if(n.normal||n.binormal||n.tangent){var f=n.normal?new Float32Array(6*c):void 0,h=n.binormal?new Float32Array(6*c):void 0,m=n.tangent?new Float32Array(6*c):void 0,p=S,y=_,v=O,g=M,w=T,x=P,E=d;for(u=0;c>u;u+=3){var A=E+d;p=t.fromArray(o,u,p),y=t.fromArray(o,u+c,y),v=t.fromArray(o,(u+3)%c,v),y=t.subtract(y,p,y),v=t.subtract(v,p,v),g=t.normalize(t.cross(y,v,g),g),n.normal&&(a.addAttribute(f,g,A),a.addAttribute(f,g,A+3),a.addAttribute(f,g,E),a.addAttribute(f,g,E+3)),(n.tangent||n.binormal)&&(x=t.fromArray(r,u,x),n.binormal&&(a.addAttribute(h,x,A),a.addAttribute(h,x,A+3),a.addAttribute(h,x,E),a.addAttribute(h,x,E+3)),n.tangent&&(w=t.normalize(t.cross(x,g,w),w),a.addAttribute(m,w,A),a.addAttribute(m,w,A+3),a.addAttribute(m,w,E),a.addAttribute(m,w,E+3))),E+=6}if(n.normal){for(f.set(r),u=0;c>u;u+=3)f[u+c]=-r[u],f[u+c+1]=-r[u+1],f[u+c+2]=-r[u+2];e.normal.values=f}else e.normal=void 0;if(n.binormal?(h.set(i),h.set(i,c),e.binormal.values=h):e.binormal=void 0,n.tangent){var N=e.tangent.values;m.set(N),m.set(N,c),e.tangent.values=m}}if(n.st){var R=e.st.values,z=new Float32Array(6*l);z.set(R),z.set(R,l);for(var I=2*l,b=0;2>b;b++){for(z[I++]=R[0],z[I++]=R[1],u=2;l>u;u+=2){var C=R[u],D=R[u+1];z[I++]=C,z[I++]=D,z[I++]=C,z[I++]=D}z[I++]=R[0],z[I++]=R[1]}e.st.values=z}return e}function x(e,t,n){n[t++]=e[0],n[t++]=e[1],n[t++]=e[2];for(var r=3;r<e.length;r+=3){var a=e[r],i=e[r+1],o=e[r+2];n[t++]=a,n[t++]=i,n[t++]=o,n[t++]=a,n[t++]=i,n[t++]=o}return n[t++]=e[0],n[t++]=e[1],n[t++]=e[2],n}function E(e,t){var n=new y({position:t.positon,normal:t.normal||t.binormal,tangent:t.tangent,binormal:t.normal||t.binormal,st:t.st}),r=e.ellipsoid,i=a.computePositions(e),o=g(i,n,r),u=e.height,s=e.extrudedHeight,c=o.attributes,l=o.indices,d=c.position.values,h=d.length,m=new Float64Array(6*h),p=new Float64Array(h);p.set(d);var v=new Float64Array(4*h);d=a.scaleToGeodeticHeight(d,u,r,d),v=x(d,0,v),p=a.scaleToGeodeticHeight(p,s,r,p),v=x(p,2*h,v),m.set(d),m.set(p,h),m.set(v,2*h),c.position.values=m,h/=3;var E,S=l.length,_=h+h,O=f.createTypedArray(m.length/3,2*S+3*_);O.set(l);var M=S;for(E=0;S>E;E+=3){var T=l[E],P=l[E+1],A=l[E+2];O[M++]=A+h,O[M++]=P+h,O[M++]=T+h}c=w(c,t);var N,R,z,I;for(E=0;_>E;E+=2)N=E+_,R=N+_,z=N+1,I=R+1,O[M++]=N,O[M++]=R,O[M++]=z,O[M++]=z,O[M++]=R,O[M++]=I;return{attributes:c,indices:O}}var S=new t,_=new t,O=new t,M=new t,T=new t,P=new t,A=new t,N=new t,R=function(e){e=i(e,i.EMPTY_OBJECT);var n=e.positions,a=e.width;this._positions=n,this._ellipsoid=s.clone(i(e.ellipsoid,s.WGS84)),this._vertexFormat=y.clone(i(e.vertexFormat,y.DEFAULT)),this._width=a,this._height=i(e.height,0),this._extrudedHeight=i(e.extrudedHeight,this._height),this._cornerType=i(e.cornerType,r.ROUNDED),this._granularity=i(e.granularity,h.RADIANS_PER_DEGREE),this._workerName="createCorridorGeometry",this.packedLength=1+n.length*t.packedLength+s.packedLength+y.packedLength+5};R.pack=function(e,n,r){r=i(r,0);var a=e._positions,o=a.length;n[r++]=o;for(var u=0;o>u;++u,r+=t.packedLength)t.pack(a[u],n,r);s.pack(e._ellipsoid,n,r),r+=s.packedLength,y.pack(e._vertexFormat,n,r),r+=y.packedLength,n[r++]=e._width,n[r++]=e._height,n[r++]=e._extrudedHeight,n[r++]=e._cornerType,n[r]=e._granularity};var z=s.clone(s.UNIT_SPHERE),I=new y,b={positions:void 0,ellipsoid:z,vertexFormat:I,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0};return R.unpack=function(e,n,r){n=i(n,0);for(var a=e[n++],u=new Array(a),c=0;a>c;++c,n+=t.packedLength)u[c]=t.unpack(e,n);var l=s.unpack(e,n,z);n+=s.packedLength;var d=y.unpack(e,n,I);n+=y.packedLength;var f=e[n++],h=e[n++],m=e[n++],p=e[n++],v=e[n];return o(r)?(r._positions=u,r._ellipsoid=s.clone(l,r._ellipsoid),r._vertexFormat=y.clone(d,r._vertexFormat),r._width=f,r._height=h,r._extrudedHeight=m,r._cornerType=p,r._granularity=v,r):(b.positions=u,b.width=f,b.height=h,b.extrudedHeight=m,b.cornerType=p,b.granularity=v,new R(b))},R.createGeometry=function(t){var n=t._positions,r=t._height,i=t._extrudedHeight,o=r!==i,u=m.removeDuplicates(n);if(u.length<2)return void 0;var s,l=t._ellipsoid,d=t._vertexFormat,f={ellipsoid:l,positions:u,width:t._width,cornerType:t._cornerType,granularity:t._granularity,saveAttributes:!0};if(o){var h=Math.max(r,i);i=Math.min(r,i),r=h,f.height=r,f.extrudedHeight=i,s=E(f,d)}else{var y=a.computePositions(f);s=g(y,d,l),s.attributes.position.values=a.scaleToGeodeticHeight(s.attributes.position.values,r,l,s.attributes.position.values)}var v=s.attributes,w=e.fromVertices(v.position.values,void 0,3);return d.position||(s.attributes.position.values=void 0),new c({attributes:v,indices:s.indices,primitiveType:p.TRIANGLES,boundingSphere:w})},R}),define("Workers/createCorridorGeometry",["../Core/CorridorGeometry","../Core/defined","../Core/Ellipsoid"],function(e,t,n){"use strict";function r(r,a){return t(a)&&(r=e.unpack(r,a)),r._ellipsoid=n.clone(r._ellipsoid),e.createGeometry(r)}return r})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createCorridorOutlineGeometry.js b/libs/Cesium/Workers/createCorridorOutlineGeometry.js deleted file mode 100644 index 06a3b354..00000000 --- a/libs/Cesium/Workers/createCorridorOutlineGeometry.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,a){a=t(a,r);var i=Math.abs(e-n);return a>=i||i<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],a=t;e>=a;a++)r.push(n*a);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var a=new e;return n.setRandomNumberSeed=function(t){a=new e(t)},n.nextRandomNumber=function(){return a.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};i.fromSpherical=function(n,r){t(r)||(r=new i);var a=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(a),r.y=s*Math.sin(a),r.z=u*Math.cos(o),r},i.fromElements=function(e,n,r,a){return t(a)?(a.x=e,a.y=n,a.z=r,a):new i(e,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var n=i.dot(s,c),r=i.magnitude(i.cross(s,c,s));return Math.atan2(r,n)};var l=new i;i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):n.y<=n.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)},i.cross=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-r*s,d=r*u-a*o;return n.x=c,n.y=l,n.z=d,n},i.fromDegrees=function(e,t,n,r,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,n,r,o)};var d=new i,f=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(n,r,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(r);d.x=c*Math.cos(n),d.y=c*Math.sin(n),d.z=Math.sin(r),d=i.normalize(d,d),i.multiplyComponents(s,d,f);var l=Math.sqrt(i.dot(d,f));return f=i.divideByScalar(f,l,f),d=i.multiplyByScalar(d,a,d),t(u)||(u=new i),i.add(f,d,u)},i.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=a.toRadians(e[o]);return i.fromRadiansArray(r,t,n)},i.fromRadiansArray=function(e,n,r){var a=e.length;t(r)?r.length=a/2:r=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=i.fromRadians(u,s,0,n,r[o/2])}return r},i.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=a.toRadians(e[o]),r[o+1]=a.toRadians(e[o+1]),r[o+2]=e[o+2];return i.fromRadiansArrayHeights(r,t,n)},i.fromRadiansArrayHeights=function(e,n,r){var a=e.length;t(r)?r.length=a/3:r=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=i.fromRadians(u,s,c,n,r[o/3])}return r},i.ZERO=r(new i(0,0,0)),i.UNIT_X=r(new i(1,0,0)),i.UNIT_Y=r(new i(0,1,0)),i.UNIT_Z=r(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return i.fromRadians=function(n,r,a,o){return a=e(a,0),t(o)?(o.longitude=n,o.latitude=r,o.height=a,o):new i(n,r,a)},i.fromDegrees=function(e,t,n,r){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},i.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},i.ZERO=r(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(t,r,a,i){r=n(r,0),a=n(a,0),i=n(i,0),t._radii=new e(r,a,i),t._radiiSquared=new e(r*r,a*a,i*i),t._radiiToTheFourth=new e(r*r*r*r,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===r?0:1/r,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(r,a,i),t._maximumRadius=Math.max(r,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var a=t._radii;return r(n)?(e.clone(a,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,a){a=n(a,0),e.pack(t._radii,r,a)},c.unpack=function(t,r,a){r=n(r,0);var i=e.unpack(t,r);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,d=new e;c.prototype.cartographicToCartesian=function(t,n){var a=l,i=d;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),r(n)||(n=new e),e.add(i,a,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var f=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(n,a){var i=this.scaleToGeodeticSurface(n,h);if(!r(i))return void 0;var o=this.geodeticSurfaceNormal(i,f),s=e.subtract(n,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),d=u.sign(e.dot(s,n))*e.magnitude(s);return r(a)?(a.longitude=c,a.latitude=l,a.height=d,a):new t(c,l,d)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,d=s.z,f=a*a*c*c,h=i*i*l*l,m=o*o*d*d,v=f+h+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,_=x.z,M=y;M.x=2*w.x*E,M.y=2*w.y*S,M.z=2*w.z*_;var O,T,P,R,N,z,I,C,A,b,D,U=(1-g)*e.magnitude(t)/(.5*e.magnitude(M)),q=0;do{U-=q,P=1/(1+U*E),R=1/(1+U*S),N=1/(1+U*_),z=P*P,I=R*R,C=N*N,A=z*P,b=I*R,D=C*N,O=f*z+h*I+m*C-1,T=f*A*E+h*b*S+m*D*_;var L=-2*T;q=O/L}while(Math.abs(O)>u.EPSILON12);return r(n)?(n.x=a*P,n.y=i*R,n.z=o*N,n):new e(a*P,i*R,o*N)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,a,i,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return r(n)?(n.x=i,n.y=o,n.z=u,n):new e(i,o,u)},u.prototype.unproject=function(e,n){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return r(n)?(n.longitude=i,n.latitude=o,n.height=u,n):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r,a){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(a,0)};i.fromElements=function(e,n,r,a,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=a,o):new i(e,n,r,a)},i.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r++],a.w=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,s);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):n.y<=n.z?n.y<=n.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)&&a.equalsEpsilon(e.w,n.w,r,i)},i.ZERO=r(new i(0,0,0,0)),i.UNIT_X=r(new i(1,0,0,0)),i.UNIT_Y=r(new i(0,1,0,0)),i.UNIT_Z=r(new i(0,0,1,0)),i.UNIT_W=r(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(h[n],f[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=i.EPSILON15,r=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],f[o])]);u>r&&(a=o,r=u)}var s=1,l=0,d=f[a],m=h[a];if(Math.abs(e[c.getElementIndex(m,d)])>n){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(d,d)],g=e[c.getElementIndex(m,d)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(d,d)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,d)]=l,t[c.getElementIndex(d,m)]=-l,t}var c=function(e,n,r,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++],a[4]=e[r++],a[5]=e[r++],a[6]=e[r++],a[7]=e[r++],a[8]=e[r++],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],a[4]=e[r+4],a[5]=e[r+5],a[6]=e[r+6],a[7]=e[r+7],a[8]=e[r+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,d=e.z*e.z,f=e.z*e.w,h=e.w*e.w,m=r-u-d+h,p=2*(a-f),y=2*(i+l),v=2*(a+f),g=-r+u-d+h,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-r-u+d+h;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(m,p,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=a,t[6]=0,t[7]=-a,t[8]=r,t):new c(1,0,0,0,r,-a,0,a,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=r,t):new c(r,0,a,0,1,0,-a,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=a,t[2]=0,t[3]=-a,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-a,0,a,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,a=e[r],i=e[r+1],o=e[r+2];return n.x=a,n.y=i,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=3*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],a=e[t+3],i=e[t+6];return n.x=r,n.y=a,n.z=i,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var d=new e;c.getMaximumScale=function(t){return c.getScale(t,d),e.maximumComponent(d)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],d=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=a,n[2]=i,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=d,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[3]*a+e[6]*i,u=e[1]*r+e[4]*a+e[7]*i,s=e[2]*r+e[5]*a+e[8]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var f=[1,0,0],h=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var r=i.EPSILON20,a=10,l=0,d=0;n(t)||(t={});for(var f=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=r*o(h);a>d&&u(h)>y;)s(h,m),c.transpose(m,p),c.multiply(h,m,h),c.multiply(p,h,h),c.multiply(f,m,f),++l>2&&(++d,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*r-n*c)+u*(n*o-i*r)},c.inverse=function(e,t){var n=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],d=e[6],f=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=i.EPSILON15)throw new r("matrix is not invertible");t[0]=s*h-f*l,t[1]=f*o-a*h,t[2]=a*l-s*o,t[3]=d*l-u*h,t[4]=n*h-d*o,t[5]=u*o-n*l,t[6]=u*f-d*s,t[7]=d*a-n*f,t[8]=n*s-u*a;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,a,i,o,u,s){"use strict";var c=function(e,t,r,a,i,o,u,s,c,l,d,f,h,m,p,y){this[0]=n(e,0),this[1]=n(i,0),this[2]=n(c,0),this[3]=n(h,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(d,0),this[11]=n(p,0),this[12]=n(a,0),this[13]=n(s,0),this[14]=n(f,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=n(a,e.ZERO),r(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,a){r(a)||(a=new c);var i=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,d=t.x*t.z,f=t.x*t.w,h=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-y+g,x=2*(l-v),E=2*(d+p),S=2*(l+v),_=-s+h-y+g,M=2*(m-f),O=2*(d-p),T=2*(m+f),P=-s-h+y+g;return a[0]=w*i,a[1]=S*i,a[2]=O*i,a[3]=0,a[4]=x*o,a[5]=_*o,a[6]=T*o,a[7]=0,a[8]=E*u,a[9]=M*u,a[10]=P*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,d=new e,f=new e;c.fromCamera=function(t,n){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,d),d),e.normalize(e.cross(d,l,f),f);var u=d.x,s=d.y,h=d.z,m=l.x,p=l.y,y=l.z,v=f.x,g=f.y,w=f.z,x=a.x,E=a.y,S=a.z,_=u*-x+s*-E+h*-S,M=v*-x+g*-E+w*-S,O=m*x+p*E+y*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=g,n[6]=-p,n[7]=0,n[8]=h,n[9]=w,n[10]=-y,n[11]=0,n[12]=_,n[13]=M,n[14]=O,n[15]=1,n):new c(u,s,h,_,v,g,w,M,-m,-p,-y,O,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,n,r,a,i,o){var u=1/(t-e),s=1/(r-n),c=1/(i-a),l=-(t+e)*u,d=-(r+n)*s,f=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=d,o[14]=f,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,n,r,a,i,o){var u=2*a/(t-e),s=2*a/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),d=-(i+a)/(i-a),f=-1,h=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=d,o[11]=f,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,a,i){var o=2*a/(t-e),u=2*a/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,d=-1,f=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=d,i[12]=0,i[13]=0,i[14]=f,i[15]=0,i},c.computeViewportTransformation=function(e,t,r,a){e=n(e,n.EMPTY_OBJECT);var i=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,d=.5*(r-t),f=c,h=l,m=d,p=i+c,y=o+l,v=t+d,g=1;return a[0]=f,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=m,a[11]=0,a[12]=p,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,a=e[r],i=e[r+1],o=e[r+2],u=e[r+3];return n.x=a,n.y=i,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=4*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r[a+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return n.x=r,n.y=a,n.z=i,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var h=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],d=e[8],f=e[9],h=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],_=t[4],M=t[5],O=t[6],T=t[7],P=t[8],R=t[9],N=t[10],z=t[11],I=t[12],C=t[13],A=t[14],b=t[15],D=r*w+u*x+d*E+p*S,U=a*w+s*x+f*E+y*S,q=i*w+c*x+h*E+v*S,L=o*w+l*x+m*E+g*S,B=r*_+u*M+d*O+p*T,W=a*_+s*M+f*O+y*T,F=i*_+c*M+h*O+v*T,G=o*_+l*M+m*O+g*T,k=r*P+u*R+d*N+p*z,V=a*P+s*R+f*N+y*z,j=i*P+c*R+h*N+v*z,Y=o*P+l*R+m*N+g*z,H=r*I+u*C+d*A+p*b,Z=a*I+s*C+f*A+y*b,X=i*I+c*C+h*A+v*b,J=o*I+l*C+m*A+g*b;return n[0]=D,n[1]=U,n[2]=q,n[3]=L,n[4]=B,n[5]=W,n[6]=F,n[7]=G,n[8]=k,n[9]=V,n[10]=j,n[11]=Y,n[12]=H,n[13]=Z,n[14]=X,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],d=e[10],f=e[12],h=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],_=t[10],M=t[12],O=t[13],T=t[14],P=r*p+o*y+c*v,R=a*p+u*y+l*v,N=i*p+s*y+d*v,z=r*g+o*w+c*x,I=a*g+u*w+l*x,C=i*g+s*w+d*x,A=r*E+o*S+c*_,b=a*E+u*S+l*_,D=i*E+s*S+d*_,U=r*M+o*O+c*T+f,q=a*M+u*O+l*T+h,L=i*M+s*O+d*T+m;return n[0]=P,n[1]=R,n[2]=N,n[3]=0,n[4]=z,n[5]=I,n[6]=C,n[7]=0,n[8]=A,n[9]=b,n[10]=D,n[11]=0,n[12]=U,n[13]=q,n[14]=L,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],d=e[10],f=t[0],h=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=r*f+o*h+c*m,S=a*f+u*h+l*m,_=i*f+s*h+d*m,M=r*p+o*y+c*v,O=a*p+u*y+l*v,T=i*p+s*y+d*v,P=r*g+o*w+c*x,R=a*g+u*w+l*x,N=i*g+s*w+d*x;return n[0]=E,n[1]=S,n[2]=_,n[3]=0,n[4]=M,n[5]=O,n[6]=T,n[7]=0,n[8]=P,n[9]=R,n[10]=N,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=r*e[0]+a*e[4]+i*e[8]+e[12],u=r*e[1]+a*e[5]+i*e[9]+e[13],s=r*e[2]+a*e[6]+i*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var p=new e;c.multiplyByUniformScale=function(e,t,n){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,n)},c.multiplyByScale=function(e,t,n){var r=t.x,a=t.y,i=t.z;return 1===r&&1===a&&1===i?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=a*e[4],n[5]=a*e[5],n[6]=a*e[6],n[7]=0,n[8]=i*e[8],n[9]=i*e[9],n[10]=i*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*r+e[4]*a+e[8]*i+e[12]*o,s=e[1]*r+e[5]*a+e[9]*i+e[13]*o,c=e[2]*r+e[6]*a+e[10]*i+e[14]*o,l=e[3]*r+e[7]*a+e[11]*i+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i,u=e[1]*r+e[5]*a+e[9]*i,s=e[2]*r+e[6]*a+e[10]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i+e[12],u=e[1]*r+e[5]*a+e[9]*i+e[13],s=e[2]*r+e[6]*a+e[10]*i+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],a=e[4],i=e[8],l=e[12],d=e[1],f=e[5],h=e[9],m=e[13],p=e[2],x=e[6],E=e[10],S=e[14],_=e[3],M=e[7],O=e[11],T=e[15],P=E*T,R=S*O,N=x*T,z=S*M,I=x*O,C=E*M,A=p*T,b=S*_,D=p*O,U=E*_,q=p*M,L=x*_,B=P*f+z*h+I*m-(R*f+N*h+C*m),W=R*d+A*h+U*m-(P*d+b*h+D*m),F=N*d+b*f+q*m-(z*d+A*f+L*m),G=C*d+D*f+L*h-(I*d+U*f+q*h),k=R*a+N*i+C*l-(P*a+z*i+I*l),V=P*r+b*i+D*l-(R*r+A*i+U*l),j=z*r+A*a+L*l-(N*r+b*a+q*l),Y=I*r+U*a+q*i-(C*r+D*a+L*i);P=i*m,R=l*h,N=a*m,z=l*f,I=a*h,C=i*f,A=r*m,b=l*d,D=r*h,U=i*d,q=r*f,L=a*d;var H=P*M+z*O+I*T-(R*M+N*O+C*T),Z=R*_+A*O+U*T-(P*_+b*O+D*T),X=N*_+b*M+q*T-(z*_+A*M+L*T),J=C*_+D*M+L*O-(I*_+U*M+q*O),Q=N*E+C*S+R*x-(I*S+P*x+z*E),K=D*S+P*p+b*E-(A*E+U*S+R*p),$=A*x+L*S+z*p-(q*S+N*p+b*x),et=q*E+I*p+U*x-(D*x+L*E+C*p),tt=r*B+a*W+i*F+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=B*tt,n[1]=W*tt,n[2]=F*tt,n[3]=G*tt,n[4]=k*tt,n[5]=V*tt,n[6]=j*tt,n[7]=Y*tt,n[8]=H*tt,n[9]=Z*tt,n[10]=X*tt,n[11]=J*tt,n[12]=Q*tt,n[13]=K*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],d=e[12],f=e[13],h=e[14],m=-n*d-r*f-a*h,p=-i*d-o*f-u*h,y=-s*d-c*f-l*h;return t[0]=n,t[1]=i,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t,n){this.normal=e.clone(t),this.distance=n};a.fromPointNormal=function(n,r,i){var o=-e.dot(r,n);return t(i)?(e.clone(r,i.normal),i.distance=o,i):new a(r,o)};var i=new e;return a.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,i),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new a(o,u)},a.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},a.ORIGIN_XY_PLANE=r(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=r(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=r(new a(e.UNIT_Y,0)),a}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(a,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.west=e[r++],a.south=e[r++],a.east=e[r++],a.north=e[r],a},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,a,i,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),n(o)?(o.west=e,o.south=r,o.east=a,o.north=i,o):new s(e,r,a,i)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=i,t.east=a,t.north=o,t):new s(r,i,a,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),d=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=d)return void 0;var f=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return f>=h?void 0:n(r)?(r.west=l,r.south=f,r.east=d,r.north=h,r):new s(l,f,d,h)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>a||u.equalsEpsilon(n,a,u.EPSILON14))&&(i>n||u.equalsEpsilon(n,i,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,a,o){r=t(r,i.WGS84),a=t(a,0),n(o)||(o=[]);var l=0,d=e.north,f=e.south,h=e.east,m=e.west,p=c;p.height=a,p.longitude=m,p.latitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=f,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=0>d?d:f>0?f:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=r.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,a,i,o,u,s,c,l,d,f){"use strict";var h=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,_=new e,M=new e,O=new e;h.fromPoints=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var a=e.clone(t[0],x),i=e.clone(a,m),o=e.clone(a,p),u=e.clone(a,y),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),d=t.length,f=1;d>f;f++){e.clone(t[f],a);var T=a.x,P=a.y,R=a.z;T<i.x&&e.clone(a,i),T>s.x&&e.clone(a,s),P<o.y&&e.clone(a,o),P>c.y&&e.clone(a,c),R<u.z&&e.clone(a,u),R>l.z&&e.clone(a,l)}var N=e.magnitudeSquared(e.subtract(s,i,E)),z=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),C=i,A=s,b=N;z>b&&(b=z,C=o,A=c),I>b&&(b=I,C=u,A=l);var D=S;D.x=.5*(C.x+A.x),D.y=.5*(C.y+A.y),D.z=.5*(C.z+A.z);var U=e.magnitudeSquared(e.subtract(A,D,E)),q=Math.sqrt(U),L=_;L.x=i.x,L.y=o.y,L.z=u.z;var B=M;B.x=s.x,B.y=c.y,B.z=l.z;var W=e.multiplyByScalar(e.add(L,B,E),.5,O),F=0;for(f=0;d>f;f++){e.clone(t[f],a);var G=e.magnitude(e.subtract(a,W,E));G>F&&(F=G);var k=e.magnitudeSquared(e.subtract(a,D,E));if(k>U){var V=Math.sqrt(k);q=.5*(q+V),U=q*q;var j=V-q;D.x=(q*D.x+j*a.x)/V,D.y=(q*D.y+j*a.y)/V,D.z=(q*D.z+j*a.z)/V}}return F>q?(e.clone(D,n.center),n.radius=q):(e.clone(W,n.center),n.radius=F),n};var T=new u,P=new e,R=new e,N=new t,z=new t;h.fromRectangle2D=function(e,t,n){return h.fromRectangleWithHeights2D(e,t,0,0,n)},h.fromRectangleWithHeights2D=function(t,a,i,o,u){if(r(u)||(u=new h),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=n(a,T),f.southwest(t,N),N.height=i,f.northeast(t,z),z.height=o;var s=a.project(N,P),c=a.project(z,R),l=c.x-s.x,d=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+d*d+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*d,p.z=s.z+.5*m,u};var I=[];h.fromRectangle3D=function(e,t,a,i){t=n(t,o.WGS84),a=n(a,0);var u;return r(e)&&(u=f.subsample(e,t,a,I)),h.fromPoints(u,i)},h.fromVertices=function(t,a,i,o){if(r(o)||(o=new h),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=n(a,e.ZERO),i=n(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),d=e.clone(u,v),f=e.clone(u,g),T=e.clone(u,w),P=t.length,R=0;P>R;R+=i){var N=t[R]+a.x,z=t[R+1]+a.y,I=t[R+2]+a.z;u.x=N,u.y=z,u.z=I,N<s.x&&e.clone(u,s),N>d.x&&e.clone(u,d),z<c.y&&e.clone(u,c),z>f.y&&e.clone(u,f),I<l.z&&e.clone(u,l),I>T.z&&e.clone(u,T)}var C=e.magnitudeSquared(e.subtract(d,s,E)),A=e.magnitudeSquared(e.subtract(f,c,E)),b=e.magnitudeSquared(e.subtract(T,l,E)),D=s,U=d,q=C;A>q&&(q=A,D=c,U=f),b>q&&(q=b,D=l,U=T);var L=S;L.x=.5*(D.x+U.x),L.y=.5*(D.y+U.y),L.z=.5*(D.z+U.z);var B=e.magnitudeSquared(e.subtract(U,L,E)),W=Math.sqrt(B),F=_;F.x=s.x,F.y=c.y,F.z=l.z;var G=M;G.x=d.x,G.y=f.y,G.z=T.z;var k=e.multiplyByScalar(e.add(F,G,E),.5,O),V=0;for(R=0;P>R;R+=i){u.x=t[R]+a.x,u.y=t[R+1]+a.y,u.z=t[R+2]+a.z;var j=e.magnitude(e.subtract(u,k,E));j>V&&(V=j);var Y=e.magnitudeSquared(e.subtract(u,L,E));if(Y>B){var H=Math.sqrt(Y);W=.5*(W+H),B=W*W;var Z=H-W;L.x=(W*L.x+Z*u.x)/H,L.y=(W*L.y+Z*u.y)/H,L.z=(W*L.z+Z*u.z)/H}}return V>W?(e.clone(L,o.center),o.radius=W):(e.clone(k,o.center),o.radius=V),o},h.fromCornerPoints=function(t,n,a){r(a)||(a=new h);var i=a.center;return e.add(t,n,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,n),a},h.fromEllipsoid=function(t,n){return r(n)||(n=new h),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var C=new e;h.fromBoundingSpheres=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var a=t.length;if(1===a)return h.clone(t[0],n);if(2===a)return h.union(t[0],t[1],n);for(var i=[],o=0;a>o;o++)i.push(t[o].center);n=h.fromPoints(i,n);var u=n.center,s=n.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,C)+c.radius)}return n.radius=s,n},h.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,r){r=n(r,0);var a=e.center;t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r]=e.radius},h.unpack=function(e,t,a){t=n(t,0),r(a)||(a=new h);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var A=new e,b=new e;h.union=function(t,n,a){r(a)||(a=new h);var i=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,i,A),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return n.clone(a),a;var d=.5*(o+l+s),f=e.multiplyByScalar(c,(-o+d)/l,b);return e.add(f,i,f),e.clone(f,a.center),a.radius=d,a};var D=new e;h.expand=function(t,n,r){r=h.clone(t,r);var a=e.magnitude(e.subtract(n,r.center,D));return a>r.radius&&(r.radius=a),r},h.intersectPlane=function(t,n){var r=t.center,a=t.radius,i=n.normal,o=e.dot(i,r)+n.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var U=new d(new e,0);h.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=d.fromCartesian4(t,U);return h.intersectPlane(e,n)},h.transform=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var q=new e;h.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,q);return e.magnitudeSquared(r)-t.radius*t.radius},h.transformWithoutScale=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var L=new e;h.computePlaneDistances=function(t,n,a,i){r(i)||(i=new c);var o=e.subtract(t.center,n,L),u=e.multiplyByScalar(a,e.dot(a,o),L),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var B=new e,W=new e,F=new e,G=new e,k=new e,V=new t,j=new Array(8),Y=0;8>Y;++Y)j[Y]=new e;var H=new u;return h.projectTo2D=function(t,r,a){r=n(r,H);var i=r.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,W);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var d=e.negate(l,k),f=e.negate(c,G),m=j,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,f,p),p=m[2],e.add(s,d,p),e.add(p,f,p),p=m[3],e.add(s,d,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,f,p),p=m[6],e.add(s,d,p),e.add(p,f,p),p=m[7],e.add(s,d,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,V);r.project(w,g)}a=h.fromPoints(m,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},h.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(r.requestFullscreen=a,n=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(r.requestFullscreen=a,n=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?r.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(r.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?r.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(r.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?r.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(r.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),r.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),r.fullscreenerror=a)}return n},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[r.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[r.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=r(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1])))}return S}function d(){return l()&&_}function f(){if(!t(M)){M=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(M=!0,O=r(e[1]))}return M}function h(){return t(T)||(T=/Windows/i.test(navigator.appVersion)),T}function m(){return f()&&O}function p(){return t(P)||(P=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),P}var y,v,g,w,x,E,S,_,M,O,T,P,R={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:d,isFirefox:f,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return R.supportsFullscreen=function(){return n.supportsFullscreen()},R.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},R.supportsWebWorkers=function(){return"undefined"!=typeof Worker},R}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,a){"use strict";if(!r.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,r,a,o){switch(a=e(a,0),o=e(o,(r.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(r,a,o);case i.UNSIGNED_BYTE:return new Uint8Array(r,a,o);case i.SHORT:return new Int16Array(r,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(r,a,o);case i.FLOAT:return new Float32Array(r,a,o);case i.DOUBLE:return new Float64Array(r,a,o);default:throw new n("componentDatatype is not a valid value.")}},a(i)}),define("Core/CornerType",["./freezeObject"],function(e){"use strict";var t={ROUNDED:0,MITERED:1,BEVELED:2};return e(t)}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(e){var t=e._uSquared,n=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,a=(n-r)/n,i=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-a)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,i),d=s*o,f=d*d,h=1-f,m=Math.sqrt(h),p=t/4,y=p*p,v=y*p,g=y*y,w=1+p-3*y/4+5*v/4-175*g/64,x=1-p+15*y/8-35*v/8,E=1-3*p+35*y/4,S=1-5*p,_=w*l-x*Math.sin(2*l)*p/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,M=e._constants;M.a=n,M.b=r,M.f=a,M.cosineHeading=i,M.sineHeading=o,M.tanU=u,M.cosineU=s,M.sineU=c,M.sigma=l,M.sineAlpha=d,M.sineSquaredAlpha=f,M.cosineSquaredAlpha=h,M.cosineAlpha=m,M.u2Over4=p,M.u4Over16=y,M.u6Over64=v,M.u8Over256=g,M.a0=w,M.a1=x,M.a2=E,M.a3=S,M.distanceRatio=_}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,n,r,a,i,o){var u=c(e,n);return(1-u)*e*t*(r+u*a*(o+u*i*(2*o*o-1)))}function d(e,t,n,r,a,i,o){var s,c,d,f,h,m=(t-n)/t,p=i-r,y=Math.atan((1-m)*Math.tan(a)),v=Math.atan((1-m)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,_=g*E,M=w*E,O=w*x,T=p,P=u.TWO_PI,R=Math.cos(T),N=Math.sin(T);do{R=Math.cos(T),N=Math.sin(T);var z=_-O*R;d=Math.sqrt(x*x*N*N+z*z),c=M+S*R,s=Math.atan2(d,c);var I;0===d?(I=0,f=1):(I=S*N/d,f=1-I*I),P=T,h=c-2*M/f,isNaN(h)&&(h=0),T=p+l(m,I,f,s,d,c,h)}while(Math.abs(T-P)>u.EPSILON12);var C=f*(t*t-n*n)/(n*n),A=1+C*(4096+C*(C*(320-175*C)-768))/16384,b=C*(256+C*(C*(74-47*C)-128))/1024,D=h*h,U=b*d*(h+b*(c*(2*D-1)-b*h*(4*d*d-3)*(4*D-3)/6)/4),q=n*A*(s-U),L=Math.atan2(x*N,_-O*R),B=Math.atan2(g*N,_*R-O);e._distance=q,e._startHeading=L,e._endHeading=B,e._uSquared=C}function f(n,r,a,i){e.normalize(i.cartographicToCartesian(r,m),h),e.normalize(i.cartographicToCartesian(a,m),m),d(n,i.maximumRadius,i.minimumRadius,r.longitude,r.latitude,a.longitude,a.latitude),n._start=t.clone(r,n._start),n._end=t.clone(a,n._end),n._start.height=0,n._end.height=0,s(n)}var h=new e,m=new e,p=function(e,a,i){var u=n(i,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,r(e)&&r(a)&&f(this,e,a,u)};return a(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(e,t){f(this,e,t,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},p.prototype.interpolateUsingSurfaceDistance=function(e,n){var a=this._constants,i=a.distanceRatio+e/a.b,o=Math.cos(2*i),u=Math.cos(4*i),s=Math.cos(6*i),c=Math.sin(2*i),d=Math.sin(4*i),f=Math.sin(6*i),h=Math.sin(8*i),m=i*i,p=i*m,y=a.u8Over256,v=a.u2Over4,g=a.u6Over64,w=a.u4Over16,x=2*p*y*o/3+i*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*d-m*((g-11*y/2)*c+5*y*d/2)+(29*g/96-29*y/16)*f+539*y*h/1536,E=Math.asin(Math.sin(x)*a.cosineAlpha),S=Math.atan(a.a/a.b*Math.tan(E));x-=a.sigma;var _=Math.cos(2*a.sigma+x),M=Math.sin(x),O=Math.cos(x),T=a.cosineU*O,P=a.sineU*M,R=Math.atan2(M*a.sineHeading,T-P*a.cosineHeading),N=R-l(a.f,a.sineAlpha,a.cosineSquaredAlpha,x,M,O,_);return r(n)?(n.longitude=this._start.longitude+N,n.latitude=S,n.height=0,n):new t(this._start.longitude+N,S,0)},p}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict"; -function n(e,n,r){var a=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(n)))<r?0:a}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,a){var i;if(0===e)return 0===r?[]:[-a/r];if(0===r){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-r/e,0>i?[i,0]:[0,i];var c=r*r,l=4*e*a,d=n(c,-l,t.EPSILON14);if(0>d)return[];var f=-.5*n(r,t.sign(r)*Math.sqrt(d),t.EPSILON14);return r>0?[f/e,a/f]:[a/f,f/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var a,i,o=e,u=t/3,s=n/3,c=r,l=o*s,d=u*c,f=u*u,h=s*s,m=o*s-f,p=o*c-u*s,y=u*c-h,v=4*m*y-p*p;if(0>v){var g,w,x;f*d>=l*h?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var _=i/2,M=0>_?-Math.pow(-_,1/3):Math.pow(_,1/3),O=i===S?-M:-w/M;return a=0>=w?M+O:-x/(M*M+O*O+w),f*d>=l*h?[(a-u)/o]:[-c/(a+s)]}var T=m,P=-2*u*m+o*p,R=y,N=-c*p+2*s*y,z=Math.sqrt(v),I=Math.sqrt(3)/2,C=Math.abs(Math.atan2(o*z,-P)/3);a=2*Math.sqrt(-T);var A=Math.cos(C);i=a*A;var b=a*(-A/2-I*Math.sin(C)),D=i+b>2*u?i-u:b-u,U=o,q=D/U;C=Math.abs(Math.atan2(c*z,-N)/3),a=2*Math.sqrt(-R),A=Math.cos(C),i=a*A,b=a*(-A/2-I*Math.sin(C));var L=-c,B=2*s>i+b?i+s:b+s,W=L/B,F=U*B,G=-D*B-U*L,k=D*L,V=(s*G-u*k)/(-u*G+s*F);return V>=q?W>=q?W>=V?[q,V,W]:[q,W,V]:[W,q,V]:W>=q?[V,q,W]:W>=V?[V,W,q]:[W,V,q]}var r={};return r.computeDiscriminant=function(e,t,n,r){var a=e*e,i=t*t,o=n*n,u=r*r,s=18*e*t*n*r+i*o-27*a*u-4*(e*o*n+i*t*r);return s},r.computeRealRoots=function(e,r,a,i){var o,u;if(0===e)return t.computeRealRoots(r,a,i);if(0===r){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,a,i)}return 0===a?0===i?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,i):0===i?(o=t.computeRealRoots(e,r,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,a,i)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,d=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(d.length>0){var f=-t/4,h=d[d.length-1];if(Math.abs(h)<n.EPSILON14){var m=r.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[f-w,f-g,f+g,f+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[f-p,f+p];if(0>y&&v>=0)return p=Math.sqrt(v),[f-p,f+p]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,_=r.computeRealRoots(1,x,E),M=r.computeRealRoots(1,-x,S);return 0!==_.length?(_[0]+=f,_[1]+=f,0!==M.length?(M[0]+=f,M[1]+=f,_[1]<=M[0]?[_[0],_[1],M[0],M[1]]:M[1]<=_[0]?[M[0],M[1],_[0],_[1]]:_[0]>=M[0]&&_[1]<=M[1]?[M[0],_[0],_[1],M[1]]:M[0]>=_[0]&&M[1]<=_[1]?[_[0],M[0],M[1],_[1]]:_[0]>M[0]&&_[0]<M[1]?[M[0],_[0],M[1],_[1]]:[_[0],M[0],_[1],M[1]]):_):0!==M.length?(M[0]+=f,M[1]+=f,M):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,d=i*t+s-4*o,f=c*o-i*a*t+u,h=e.computeRealRoots(1,l,d,f);if(h.length>0){var m,p,y=h[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),_=c-4*y,M=c+4*Math.abs(y);if(0>y||_*S>E*M){var O=Math.sqrt(_);m=O/2,p=0===O?0:(t*x-i)/O}else{var T=Math.sqrt(E);m=0===T?0:(t*x-i)/T,p=T/2}var P,R;0===w&&0===m?(P=0,R=0):n.sign(w)===n.sign(m)?(P=w+m,R=y/P):(R=w-m,P=y/R);var N,z;0===x&&0===p?(N=0,z=0):n.sign(x)===n.sign(p)?(N=x+p,z=o/N):(z=x-p,N=o/z);var I=r.computeRealRoots(1,P,N),C=r.computeRealRoots(1,R,z);if(0!==I.length)return 0!==C.length?I[1]<=C[0]?[I[0],I[1],C[0],C[1]]:C[1]<=I[0]?[C[0],C[1],I[0],I[1]]:I[0]>=C[0]&&I[1]<=C[1]?[C[0],I[0],I[1],C[1]]:C[0]>=I[0]&&C[1]<=I[1]?[I[0],C[0],C[1],I[1]]:I[0]>C[0]&&I[0]<C[1]?[C[0],I[0],C[1],I[1]]:[I[0],C[0],I[1],C[1]]:I;if(0!==C.length)return C}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=n*n,l=c*n,d=r*r,f=d*r,h=a*a,m=h*a,p=u*c*d-4*s*f-4*e*l*d+18*e*t*n*f-27*i*d*d+256*o*m+a*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*d+144*i*n*d)+h*(144*e*u*n-27*u*u-128*i*c-192*i*t*r);return p},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,d=u/t,f=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>d?h+1:h,h+=0>f?h+1:h){case 0:return a(c,l,d,f);case 1:return i(c,l,d,f);case 2:return i(c,l,d,f);case 3:return a(c,l,d,f);case 4:return a(c,l,d,f);case 5:return i(c,l,d,f);case 6:return a(c,l,d,f);case 7:return a(c,l,d,f);case 8:return i(c,l,d,f);case 9:return a(c,l,d,f);case 10:return a(c,l,d,f);case 11:return i(c,l,d,f);case 12:return a(c,l,d,f);case 13:return a(c,l,d,f);case 14:return a(c,l,d,f);case 15:return a(c,l,d,f);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,a){return n(a)||(a=new e),a=e.multiplyByScalar(t.direction,r,a),e.add(t.origin,a,a)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(t,r,a,o,u){u=n(u,!1);var s,c,l,d,f,h=t.origin,m=t.direction,p=e.subtract(a,r,y),E=e.subtract(o,r,v),S=e.cross(m,E,g),_=e.dot(p,S);if(u){if(_<i.EPSILON6)return void 0;if(s=e.subtract(h,r,w),l=e.dot(s,S),0>l||l>_)return void 0;if(c=e.cross(s,p,x),d=e.dot(m,c),0>d||l+d>_)return void 0;f=e.dot(E,c)/_}else{if(Math.abs(_)<i.EPSILON6)return void 0;var M=1/_;if(s=e.subtract(h,r,w),l=e.dot(s,S)*M,0>l||l>1)return void 0;if(c=e.cross(s,p,x),d=e.dot(m,c)*M,0>d||l+d>1)return void 0;f=e.dot(E,c)*M}return f}function d(e,t,n,r){var a=t*t-4*e*n;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function f(t,n,a){r(a)||(a={});var i=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(i,u,g),l=e.dot(o,o),f=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=d(l,f,h,S);return r(m)?(a.start=m.root0,a.stop=m.root1,a):void 0}function h(e,t,n){var r=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function m(t,n,r,a,c){var l,d=a*a,f=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*f,p=c*(a*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*d+t[o.COLUMN2ROW2]*f+a*n.x+r,v=f*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],_=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-_)),w.push(new e(a,c*S,c*_))}return w}var M=g*g,O=v*v,T=m*m,P=g*v,R=T+O,N=2*(p*m+P),z=2*y*m+p*p-O+M,I=2*(y*p-P),C=y*y-M;if(0===R&&0===N&&0===z&&0===I)return w;l=s.computeRealRoots(R,N,z,I,C);var A=l.length;if(0===A)return w;for(var b=0;A>b;++b){var D,U=l[b],q=U*U,L=Math.max(1-q,0),B=Math.sqrt(L);D=i.sign(m)===i.sign(y)?h(m*q+y,p*U,i.EPSILON12):i.sign(y)===i.sign(p*U)?h(m*q,p*U+y,i.EPSILON12):h(m*q+p*U,y,i.EPSILON12);var W=h(v*U,g,i.EPSILON15),F=D*W;0>F?w.push(new e(a,c*U,c*B)):F>0?w.push(new e(a,c*U,c*-B)):0!==B?(w.push(new e(a,c*U,c*-B)),w.push(new e(a,c*U,c*B)),++b):w.push(new e(a,c*U,c*B))}return w}var p={};p.rayPlane=function(t,n,a){r(a)||(a=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,n,a,i,o,u){var s=l(t,n,a,i,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;p.lineSegmentTriangle=function(t,n,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var d=l(c,a,i,o,u);return!r(d)||0>d||d>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,d,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};p.raySphere=function(e,t,n){return n=f(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var _=new c;p.lineSegmentSphere=function(t,n,a,i){var o=_;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=f(o,a,i),!r(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var M=new e,O=new e;p.rayEllipsoid=function(t,n){var r,a,i,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,M),l=e.multiplyComponents(s,t.direction,O),d=e.magnitudeSquared(c),f=e.dot(c,l);if(d>1){if(f>=0)return void 0;var h=f*f;if(r=d-1,a=e.magnitudeSquared(l),i=a*r,i>h)return void 0;if(h>i){o=f*f-i,u=-f+Math.sqrt(o);var m=u/a,p=r/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(r/a);return{start:y,stop:y}}return 1>d?(r=d-1,a=e.magnitudeSquared(l),i=a*r,o=f*f-i,u=-f+Math.sqrt(o),{start:0,stop:u/a}):0>f?(a=e.magnitudeSquared(l),{start:0,stop:-f/a}):void 0};var T=new e,P=new e,R=new e,N=new e,z=new e,I=new o,C=new o,A=new o,b=new o,D=new o,U=new o,q=new o,L=new e,B=new e,W=new t;p.grazingAltitudeLocation=function(t,n){var a=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(a,T);if(e.dot(u,s)>=0)return a;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,T),d=e.normalize(l,l),f=e.mostOrthogonalAxis(l,N),h=e.normalize(e.cross(f,d,P),P),p=e.normalize(e.cross(d,h,R),R),y=I;y[0]=d.x,y[1]=d.y,y[2]=d.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,C),g=o.fromScale(n.radii,A),w=o.fromScale(n.oneOverRadii,b),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,_=o.multiply(o.multiply(v,w,U),x,U),M=o.multiply(o.multiply(_,g,q),y,q),O=o.multiplyByVector(_,a,z),F=m(M,e.negate(O,T),0,0,1),G=F.length;if(G>0){for(var k=e.clone(e.ZERO,B),V=Number.NEGATIVE_INFINITY,j=0;G>j;++j){E=o.multiplyByVector(g,o.multiplyByVector(y,F[j],L),L);var Y=e.normalize(e.subtract(E,a,N),N),H=e.dot(Y,u);H>V&&(V=H,k=e.clone(E,k))}var Z=n.cartesianToCartographic(k,W);return V=i.clamp(V,0,1),S=e.magnitude(e.subtract(k,a,N))*Math.sqrt(1-V*V),S=c?-S:S,Z.height=S,n.cartographicToCartesian(Z,new e)}return void 0};var F=new e;return p.lineSegmentPlane=function(t,n,a,o){r(o)||(o=new e);var u=e.subtract(n,t,F),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),d=-(a.distance+l)/c;return 0>d||d>1?void 0:(e.multiplyByScalar(u,d,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,n,r,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,n)+o<0,c=e.dot(i,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var d,f;if((1===l||2===l)&&(d=new e,f=new e),1===l){if(u)return p.lineSegmentPlane(t,n,a,d),p.lineSegmentPlane(t,r,a,f),{positions:[t,n,r,d,f],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,a,d),p.lineSegmentPlane(n,t,a,f),{positions:[t,n,r,d,f],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,a,d),p.lineSegmentPlane(r,n,a,f),{positions:[t,n,r,d,f],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,a,d),p.lineSegmentPlane(r,t,a,f),{positions:[t,n,r,d,f],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,a,d),p.lineSegmentPlane(t,n,a,f),{positions:[t,n,r,d,f],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,a,d),p.lineSegmentPlane(n,r,a,f),{positions:[t,n,r,d,f],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,n,r,a,i,o,u,s,c,l,d){"use strict";function f(e,t,n){var r=M;r.length=e;var a;if(t===n){for(a=0;e>a;a++)r[a]=t;return r}var i=n-t,o=i/e;for(a=0;e>a;a++){var u=t+a*o;r[a]=u}return r}function h(t,n,r,a,i,o,u,s){var c=a.scaleToGeodeticSurface(t,R),l=a.scaleToGeodeticSurface(n,N),d=m.numberOfPoints(t,n,r),h=a.cartesianToCartographic(c,O),p=a.cartesianToCartographic(l,T),y=f(d,i,o);z.setEndPoints(h,p);var v=z.surfaceDistance/d,g=s;h.height=i;var w=a.cartographicToCartesian(h,P);e.pack(w,u,g),g+=3;for(var x=1;d>x;x++){var E=z.interpolateUsingSurfaceDistance(x*v,T);E.height=y[x],w=a.cartographicToCartesian(E,P),e.pack(w,u,g),g+=3}return g}var m={};m.numberOfPoints=function(t,n,r){var a=e.distance(t,n);return Math.ceil(a/r)};var p=new t;m.extractHeights=function(e,t){for(var n=e.length,r=new Array(n),a=0;n>a;a++){var i=e[a];r[a]=t.cartesianToCartographic(i,p).height}return r};var y=new l,v=new e,g=new e,w=new d(e.ZERO,0),x=new e,E=new d(e.ZERO,0),S=new e,_=new e,M=[],O=new t,T=new t,P=new e,R=new e,N=new e,z=new o;m.wrapLongitude=function(t,a){var i=[],o=[];if(r(t)&&t.length>0){a=n(a,l.IDENTITY);var s=l.inverseTransformation(a,y),c=l.multiplyByPoint(s,e.ZERO,v),f=l.multiplyByPointAsVector(s,e.UNIT_Y,g),h=d.fromPointNormal(c,f,w),m=l.multiplyByPointAsVector(s,e.UNIT_X,x),p=d.fromPointNormal(c,m,E),M=1;i.push(e.clone(t[0]));for(var O=i[0],T=t.length,P=1;T>P;++P){var R=t[P];if(d.getPointDistance(p,O)<0||d.getPointDistance(p,R)<0){var N=u.lineSegmentPlane(O,R,h,S);if(r(N)){var z=e.multiplyByScalar(f,5e-9,_);d.getPointDistance(h,O)<0&&e.negate(z,z),i.push(e.add(N,z,new e)),o.push(M+1),e.negate(z,z),i.push(e.add(N,z,new e)),M=1}}i.push(e.clone(t[P])),M++,O=R}o.push(M)}return{positions:i,lengths:o}};var I=c.EPSILON7;return m.removeDuplicates=function(t){var n=t.length;if(2>n)return t;var r,a,i;for(r=1;n>r&&(a=t[r-1],i=t[r],!e.equalsEpsilon(a,i,I));++r);if(r===n)return t;for(var o=t.slice(0,r);n>r;++r)i=t[r],e.equalsEpsilon(a,i,I)||(o.push(e.clone(i)),a=i);return o},m.generateArc=function(t){r(t)||(t={});var a=t.positions,o=a.length,u=n(t.ellipsoid,i.WGS84),l=n(t.height,0);if(1>o)return[];if(1===o){var d=u.scaleToGeodeticSurface(a[0],R);if(0!==l){var f=u.geodeticSurfaceNormal(d,P);e.multiplyByScalar(f,l,f),e.add(d,f,d)}return[d.x,d.y,d.z]}var p=t.minDistance;if(!r(p)){var y=n(t.granularity,c.RADIANS_PER_DEGREE);p=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=m.numberOfPoints(a[v],a[v+1],p);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var _=a[v],T=a[v+1],N=S?l[v]:l,z=S?l[v+1]:l;E=h(_,T,p,u,N,z,x,E)}M.length=0;var I=a[o-1],C=u.cartesianToCartographic(I,O);C.height=S?l[o-1]:l;var A=u.cartographicToCartesian(C,P);return e.pack(A,x,w-3),x},m.generateCartesianArc=function(t){for(var n=m.generateArc(t),r=n.length/3,a=new Array(r),i=0;r>i;i++)a[i]=e.unpack(n,3*i);return a},m}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n){this.x=e(t,0),this.y=e(n,0)};i.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new i(e,n)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)},i.ZERO=r(new i(0,0)),i.UNIT_X=r(new i(1,0)),i.UNIT_Y=r(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,a,i,o){"use strict";var u=function(r,a,i){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),n(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var a=t[0].x,i=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,d=t.length,f=1;d>f;f++){var h=t[f],m=h.x,p=h.y,y=h.z;a=Math.min(m,a),s=Math.max(m,s),i=Math.min(p,i),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=a,v.y=i,v.z=o;var g=r.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,r.center);return e.multiplyByScalar(w,.5,w),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),a=n.normal,o=r.x*Math.abs(a.x)+r.y*Math.abs(a.y)+r.z*Math.abs(a.z),u=e.dot(t.center,a)+n.distance;return u-o>0?i.INSIDE:0>u+o?i.OUTSIDE:i.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,a){return t(e).then(n,r,a)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=a(e),t}function n(t){return e(t,i)}function r(e){this.then=e}function a(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return i(r)}});return n}function i(e){var n=new r(function(n,r){try{return r?t(r(e)):i(e)}catch(a){return i(a)}});return n}function o(){function e(e,t,n){return f(e,t,n)}function n(e){return m(e)}function a(e){return m(i(e))}function u(e){return h(e)}var s,c,l,d,f,h,m;return c=new r(e),s={then:e,resolve:n,reject:a,progress:u,promise:c,resolver:{resolve:n,reject:a,progress:u}},l=[],d=[],f=function(e,t,n){var r,a;return r=o(),a="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,a)}),d.push(a),r.promise},h=function(e){return p(d,e),e},m=function(e){return e=t(e),f=e.then,m=t,h=v,p(l,e),d=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,a,i){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,d,f,h,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(n,g)),d=[],l=g-c+1,f=[],h=o(),c)for(y=h.progress,p=function(e){f.push(e),--l||(m=p=v,h.reject(f))},m=function(e){d.push(e),--c||(m=p=v,h.resolve(d))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else h.resolve(d);return h.then(r,a,i)})}function c(e,t,n,r){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,n,r)}function l(e,t,n,r){return y(1,arguments),f(e,g).then(t,n,r)}function d(){return f(arguments,g)}function f(t,n){return e(t,function(t){var r,a,i,u,s,c;if(i=a=t.length>>>0,r=[],c=o(),i)for(u=function(t,a){e(t,n).then(function(e){r[a]=e,--i||c.resolve(r)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(r);return c.promise})}function h(t,n){var r=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,r[0]=function(t,r,i){return e(t,function(t){return e(r,function(e){return n(t,e,i,a)})})},w.apply(t,r)})}function m(t,n,r){var a=arguments.length>2;return e(t,function(e){return e=a?r:e,n.resolve(e),e},function(e){return n.reject(e),i(e)},n.progress)}function p(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=n,e.join=d,e.all=l,e.map=f,e.reduce=h,e.any=c,e.some=s,e.chain=m,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,n,r,a,i;if(i=0,t=Object(this),a=t.length>>>0,n=arguments,n.length<=1)for(;;){if(i in t){r=t[i++];break}if(++i>=a)throw new TypeError}else r=n[1];for(;a>i;++i)i in t&&(r=e(r,t[i],i,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,a,i=0,o=e.length-1;o>=i;)if(r=~~((i+o)/2),a=n(e[r],t),0>a)i=r+1;else{if(!(a>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],a=function(e,t,n,r){n||(n=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+a:a+e},i=function(e,t,n,r,i,o){var u=r-e.length;return u>0&&(e=n||!i?a(e,r,o,n):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+a(c.toString(t),u||0,"0",!1),i(e,n,r,o,s)},u=function(e,t,n,r,a,o){return null!=r&&(e=e.slice(0,r)),i(e,"",t,n,a,o)},s=function(e,r,s,c,l,d,f){var h,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",_=s.length,M=0;s&&_>M;M++)switch(s.charAt(M)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(M+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(d=d?"*"==d?+t[n++]:"*"==d.charAt(0)?+t[d.slice(1,-1)]:+d:"fFeE".indexOf(f)>-1?6:"d"==f?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],f){case"s":return u(String(v),g,c,d,x,S);case"c":return u(String.fromCharCode(+v),g,c,d,x);case"b":return o(v,2,E,g,c,d,x);case"o":return o(v,8,E,g,c,d,x);case"x":return o(v,16,E,g,c,d,x);case"X":return o(v,16,E,g,c,d,x).toUpperCase();case"u":return o(v,10,E,g,c,d,x);case"i":case"d":return h=+v||0,h=Math.round(h-h%1),m=0>h?"-":w,v=m+a(String(Math.abs(h)),d,"0",!1),i(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return h=+v,m=0>h?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(f.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(f)%2],v=m+Math.abs(h)[p](d),i(v,m,g,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,a,i,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(e,t){return N.compare(e.julianDate,t.julianDate)}function d(e){g.julianDate=e;var n=N.leapSeconds,r=t(n,g,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var a=n[r].offset;if(r>0){var i=N.secondsDifference(n[r].julianDate,e);i>a&&(r--,a=n[r].offset)}N.addSeconds(e,a,e)}function f(e,n){g.julianDate=e;var r=N.leapSeconds,a=t(r,g,l);if(0>a&&(a=~a),0===a)return N.addSeconds(e,-r[0].offset,n);if(a>=r.length)return N.addSeconds(e,-r[a-1].offset,n);var i=N.secondsDifference(r[a].julianDate,e);return 0===i?N.addSeconds(e,-r[a].offset,n):1>=i?void 0:N.addSeconds(e,-r[--a].offset,n)}function h(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function m(e,t,n,r,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var d=i+(r*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return d>=43200&&(l-=1),[l,d]}var p=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,_=/^(\d{4})-?(\d{2})-?(\d{2})$/,M=/([Z+\-])?(\d{2})?:?(\d{2})?$/,O=/^(\d{2})(\.\d+)?/.source+M.source,T=/^(\d{2}):?(\d{2})(\.\d+)?/.source+M.source,P=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+M.source,R="Invalid ISO 8601 date.",N=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,h(a,t,this),r===c.UTC&&d(this)};N.fromDate=function(e,t){var n=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(h(n[0],n[1],t),d(t),t):new N(n[0],n[1],c.UTC)},N.fromIso8601=function(e,t){e=e.replace(",",".");var n,i,u,s=e.split("T"),l=1,f=1,p=0,g=0,M=0,z=0,I=s[0],C=s[1];if(!r(I))throw new a(R);var A;if(s=I.match(_),null!==s){if(A=I.split("-").length-1,A>0&&2!==A)throw new a(R);n=+s[1],l=+s[2],f=+s[3]}else if(s=I.match(x),null!==s)n=+s[1],l=+s[2];else if(s=I.match(w),null!==s)n=+s[1];else{var b;if(s=I.match(E),null!==s){if(n=+s[1],b=+s[2],u=o(n),1>b||u&&b>366||!u&&b>365)throw new a(R)}else{if(s=I.match(S),null===s)throw new a(R);n=+s[1];var D=+s[2],U=+s[3]||0;if(A=I.split("-").length-1,A>0&&(!r(s[3])&&1!==A||r(s[3])&&2!==A))throw new a(R);var q=new Date(Date.UTC(n,0,4));b=7*D+U-q.getUTCDay()-3}i=new Date(Date.UTC(n,0,1)),i.setUTCDate(b),l=i.getUTCMonth()+1,f=i.getUTCDate()}if(u=o(n),1>l||l>12||1>f||(2!==l||!u)&&f>y[l-1]||u&&2===l&&f>v)throw new a(R);var L;if(r(C)){if(s=C.match(P),null!==s){if(A=C.split(":").length-1,A>0&&2!==A&&3!==A)throw new a(R);p=+s[1],g=+s[2],M=+s[3],z=1e3*+(s[4]||0),L=5}else if(s=C.match(T),null!==s){if(A=C.split(":").length-1,A>0&&1!==A)throw new a(R);p=+s[1],g=+s[2],M=60*+(s[3]||0),L=4}else{if(s=C.match(O),null===s)throw new a(R);p=+s[1],g=60*+(s[2]||0),L=3}if(g>=60||M>=61||p>24||24===p&&(g>0||M>0||z>0))throw new a(R);var B=s[L],W=+s[L+1],F=+(s[L+2]||0);switch(B){case"+":p-=W,g-=F;break;case"-":p+=W,g+=F;break;case"Z":break;default:g+=new Date(Date.UTC(n,l-1,f,p,g)).getTimezoneOffset()}}else g+=new Date(n,l-1,f).getTimezoneOffset();var G=60===M;for(G&&M--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,f++;for(i=u&&2===l?v:y[l-1];f>i;)f-=i,l++,l>12&&(l-=12,n++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,f--;for(;1>f;)l--,1>l&&(l+=12,n--),i=u&&2===l?v:y[l-1],f+=i;var k=m(n,l,f,p,g,M,z);return r(t)?(h(k[0],k[1],t),d(t)):t=new N(k[0],k[1],c.UTC),G&&N.addSeconds(t,1,t),t},N.now=function(e){return N.fromDate(new Date,e)};var z=new N(0,0,c.TAI);return N.toGregorianDate=function(e,t){var n=!1,a=f(e,z);r(a)||(N.addSeconds(e,-1,z),a=f(z,z),n=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var d=0|4e3*(c+1)/1461001;c=0|c-(0|1461*d/4)+31;var h=0|80*c/2447,m=0|c-(0|2447*h/80);c=0|h/11;var p=0|h+2-12*c,y=0|100*(l-49)+d+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=n,t):new i(y,p,m,v,w,x,E,n)},N.toDate=function(e){var t=N.toGregorianDate(e,p),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},N.toIso8601=function(t,n){var a,i=N.toGregorianDate(t,i);return r(n)||0===i.millisecond?r(n)&&0!==n?(a=(.01*i.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},N.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new N(e.dayNumber,e.secondsOfDay,c.TAI):void 0},N.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},N.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},N.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(N.secondsDifference(e,t))<=n},N.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},N.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},N.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},N.computeTaiMinusUtc=function(e){g.julianDate=e; -var n=N.leapSeconds,r=t(n,g,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},N.addSeconds=function(e,t,n){return h(e.dayNumber,e.secondsOfDay+t,n)},N.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return h(e.dayNumber,r,n)},N.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return h(e.dayNumber,r,n)},N.addDays=function(e,t,n){var r=e.dayNumber+t;return h(r,e.secondsOfDay,n)},N.lessThan=function(e,t){return N.compare(e,t)<0},N.lessThanOrEquals=function(e,t){return N.compare(e,t)<=0},N.greaterThan=function(e,t){return N.compare(e,t)>0},N.greaterThanOrEquals=function(e,t){return N.compare(e,t)>=0},N.prototype.clone=function(e){return N.clone(this,e)},N.prototype.equals=function(e){return N.equals(this,e)},N.prototype.equalsEpsilon=function(e,t){return N.equalsEpsilon(this,e,t)},N.prototype.toString=function(){return N.toIso8601(this)},N.leapSeconds=[new u(new N(2441317,43210,c.TAI),10),new u(new N(2441499,43211,c.TAI),11),new u(new N(2441683,43212,c.TAI),12),new u(new N(2442048,43213,c.TAI),13),new u(new N(2442413,43214,c.TAI),14),new u(new N(2442778,43215,c.TAI),15),new u(new N(2443144,43216,c.TAI),16),new u(new N(2443509,43217,c.TAI),17),new u(new N(2443874,43218,c.TAI),18),new u(new N(2444239,43219,c.TAI),19),new u(new N(2444786,43220,c.TAI),20),new u(new N(2445151,43221,c.TAI),21),new u(new N(2445516,43222,c.TAI),22),new u(new N(2446247,43223,c.TAI),23),new u(new N(2447161,43224,c.TAI),24),new u(new N(2447892,43225,c.TAI),25),new u(new N(2448257,43226,c.TAI),26),new u(new N(2448804,43227,c.TAI),27),new u(new N(2449169,43228,c.TAI),28),new u(new N(2449534,43229,c.TAI),29),new u(new N(2450083,43230,c.TAI),30),new u(new N(2450630,43231,c.TAI),31),new u(new N(2451179,43232,c.TAI),32),new u(new N(2453736,43233,c.TAI),33),new u(new N(2454832,43234,c.TAI),34),new u(new N(2456109,43235,c.TAI),35),new u(new N(2457204,43236,c.TAI),36)],N}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var a=new n.constructor;for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];r&&(o=t(o,r)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var a=n[r],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,a,i){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return r}function s(e,n){n=t(n,"");var a=e[1],i=!!e[2],s=e[3];switch(n){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s);return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,a=t(n.method,"GET"),i=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,a,i,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,d){var f=l.exec(e);if(null!==f)return c.resolve(s(f,t)),void 0;var h=new XMLHttpRequest;if(n(d)&&n(h.overrideMimeType)&&h.overrideMimeType(d),h.open(r,e,!0),n(u))for(var m in u)u.hasOwnProperty(m)&&h.setRequestHeader(m,u[m]);n(t)&&(h.responseType=t),h.onload=function(){200===h.status?n(h.response)?c.resolve(h.response):n(h.responseXML)&&h.responseXML.hasChildNodes()?c.resolve(h.responseXML):n(h.responseText)?c.resolve(h.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){c.reject(new a)},h.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(n,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,r(n,i).then(function(e){return JSON.parse(e)})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c,l,d){"use strict";function f(e,t){return o.compare(e.julianDate,t)}function h(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=n.columnNames.indexOf("modifiedJulianDateUtc"),i=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),h=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>h||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],_=y[x+p],M=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,O=new o(M,_,d.TAI);if(v.push(O),w){if(_!==g&&r(g)){var T=o.leapSeconds,P=t(T,O,f);if(0>P){var R=new u(O,_);T.splice(~P,0,R)}}g=_}}}function m(e,t,n,r,a){var i=n*r;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function p(e,t,n){return t+e*(n-t)}function y(e,t,n,r,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[a],l=t[i];if(c.equals(l)||r.equals(c))return m(e,n,a,s,u),u;if(r.equals(l))return m(e,n,i,s,u),u;var d=o.secondsDifference(r,c)/o.secondsDifference(l,c),f=a*s,h=i*s,y=n[f+e._ut1MinusUtcSecondsColumn],v=n[h+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=n[f+e._taiMinusUtcSecondsColumn],x=n[h+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(r)?y=v:v-=x-w)}return u.xPoleWander=p(d,n[f+e._xPoleWanderRadiansColumn],n[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(d,n[f+e._yPoleWanderRadiansColumn],n[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(d,n[f+e._xCelestialPoleOffsetRadiansColumn],n[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(d,n[f+e._yCelestialPoleOffsetRadiansColumn],n[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(d,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))h(this,t.data);else if(r(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){h(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new a(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var i=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var d=i[u],f=i[u+1],h=o.lessThanOrEquals(d,e),m=!r(f),p=m||o.greaterThanOrEquals(f,e);if(h&&p)return s=u,!m&&f.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,n),n}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),a=d.exec(r);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,d=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,f=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return f._cesiumScriptRegex=d,f.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},f}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t,n){var r=d;return r.dayNumber=t,r.secondsOfDay=n,i.daysDifference(r,e._sampleZeroDateTT)}function c(n,a){if(n._chunkDownloadsInProgress[a])return n._chunkDownloadsInProgress[a];var i=e.defer();n._chunkDownloadsInProgress[a]=i;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[a]=!1;for(var t=n._samples,r=e.samples,o=3*a*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];i.resolve()}),i.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},d=new i(0,0,u.TAI);return l.prototype.preload=function(t,n,r,a){var i=s(this,t,n),o=s(this,r,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var d=0|u/this._samplesPerXysFile,f=0|l/this._samplesPerXysFile,h=[],m=d;f>=m;++m)h.push(c(this,m));return e.all(h)},l.prototype.computeXysRadians=function(e,t,n){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var d=l+u;d>=this._totalSamples&&(d=this._totalSamples-1,l=d-u,0>l&&(l=0));var f=!1,h=this._samples;if(r(h[3*l])||(c(this,0|l/this._samplesPerXysFile),f=!0),r(h[3*d])||(c(this,0|d/this._samplesPerXysFile),f=!0),f)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new a(0,0,0);var m,p,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var E=3*(l+m);n.x+=w[m]*h[E++],n.y+=w[m]*h[E++],n.s+=w[m]*h[E]}return n},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,r,a){var i=r/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,d=c.z*o,f=Math.cos(i);return n(a)?(a.x=u,a.y=l,a.z=d,a.w=f,a):new s(u,l,d,f)};var l=[1,2,0],d=new Array(3);s.fromRotationMatrix=function(e,t){var r,a,i,o,c,f=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=f+h+m;if(p>0)r=Math.sqrt(p+1),c=.5*r,r=.5/r,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;h>f&&(v=1),m>f&&m>h&&(v=2);var g=y[v],w=y[g];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=d;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,a=-x[0],i=-x[1],o=-x[2]}return n(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var f=new s;s.fromHeadingPitchRoll=function(t,n,r,a){var i=s.fromAxisAngle(e.UNIT_X,r,f),o=s.fromAxisAngle(e.UNIT_Y,-n,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,f);return s.multiply(u,a,a)};var h=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.x=e[r],a.y=e[r+1],a.z=e[r+2],a.w=e[r+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var a=0,i=n-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,h);var u=s.computeAngle(p);r[o]=h.x*u,r[o+1]=h.y*u,r[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,r,a,i,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*i,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,a=e.y*n,i=e.z*n,o=e.w*n;return t.x=r,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,d=o*u+r*l+a*c-i*s,f=o*s-r*c+a*l+i*u,h=o*c+r*s-a*u+i*l,m=o*l-r*u-a*s-i*c;return n.x=d,n.y=f,n.z=h,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,n,r){return g=s.multiplyByScalar(t,n,g),r=s.multiplyByScalar(e,1-n,r),s.add(g,r,r)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,n,r);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(i,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),a=0;return 0!==r&&(a=r/Math.sin(r)),e.multiplyByScalar(t,a,n)},s.exp=function(t,n){var r=e.magnitude(t),a=0;return 0!==r&&(a=Math.sin(r)/r),n.x=t.x*a,n.y=t.y*a,n.z=t.z*a,n.w=Math.cos(r),n};var S=new e,_=new e,M=new s,O=new s;s.computeInnerQuadrangle=function(t,n,r,a){var i=s.conjugate(n,M);s.multiply(i,r,O);var o=s.log(O,S);s.multiply(i,t,O);var u=s.log(O,_);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,M),s.multiply(n,M,a)},s.squad=function(e,t,n,r,a,i){var o=s.slerp(e,t,a,M),u=s.slerp(n,r,a,O);return s.slerp(o,u,2*a*(1-a),i)};for(var T=new s,P=1.9011074535173003,R=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],z=a.supportsTypedArrays()?new Float32Array(8):[],I=a.supportsTypedArrays()?new Float32Array(8):[],C=0;7>C;++C){var A=C+1,b=2*A+1;R[C]=1/(A*b),N[C]=A/b}return R[7]=P/136,N[7]=8*P/17,s.fastSlerp=function(e,t,n,r){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-n,c=n*n,l=u*u,d=7;d>=0;--d)z[d]=(R[d]*c-N[d])*o,I[d]=(R[d]*l-N[d])*o;var f=a*n*(1+z[0]*(1+z[1]*(1+z[2]*(1+z[3]*(1+z[4]*(1+z[5]*(1+z[6]*(1+z[7])))))))),h=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=s.multiplyByScalar(e,h,T);return s.multiplyByScalar(t,f,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,a,i){var o=s.fastSlerp(e,t,a,M),u=s.fastSlerp(n,r,a,O);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,a,i,o,u,s,c,l,d,f,h,m,p,y,v){"use strict";var g={},w=new n,x=new n,E=new n;g.eastNorthUpToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new n,_=new n,M=new n;g.northEastDownToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=_,l=M;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var O=new y,T=new n(1,1,1),P=new p;g.headingPitchRollToFixedFrame=function(e,t,r,a,i,o){var u=y.fromHeadingPitchRoll(t,r,a,O),s=p.fromTranslationQuaternionRotationScale(n.ZERO,u,T,P);return o=g.eastNorthUpToFixedFrame(e,i,o),p.multiply(o,s,o)};var R=new p,N=new m;g.headingPitchRollQuaternion=function(e,t,n,r,a,i){var o=g.headingPitchRollToFixedFrame(e,t,n,r,a,R),u=p.getRotation(o,N);return y.fromRotationMatrix(u,i)};var z=24110.54841,I=8640184.812866,C=.093104,A=-62e-7,b=1.1772758384668e-19,D=72921158553e-15,U=h.TWO_PI/86400,q=new f;g.computeTemeToPseudoFixedMatrix=function(e,t){q=f.addSeconds(e,-f.computeTaiMinusUtc(e),q);var n,r=q.dayNumber,a=q.secondsOfDay,o=r-2451545;n=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=z+n*(I+n*(C+n*A)),s=u*U%h.TWO_PI,c=D+b*(r-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,d=s+c*l,p=Math.cos(d),y=Math.sin(d);return i(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var L=32.184,B=2451545;g.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+L,a=t.stop.dayNumber,i=t.stop.secondsOfDay+L,o=g.iau2006XysData.preload(n,r,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new m);var n=g.computeFixedToIcrfMatrix(e,t);return i(n)?m.transpose(n,t):void 0};var W=new d(0,0,0),F=new s(0,0,0,0,0,0),G=new m,k=new m;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new m);var n=g.earthOrientationParameters.compute(e,F);if(!i(n))return void 0;var r=e.dayNumber,a=e.secondsOfDay+L,o=g.iau2006XysData.computeXysRadians(r,a,W);if(!i(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var d=m.fromRotationZ(-o.s,k),p=m.multiply(l,d,G),y=e.dayNumber,w=e.secondsOfDay-f.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*h.TWO_PI;var _=m.fromRotationZ(S,k),M=m.multiply(p,_,G),O=Math.cos(n.xPoleWander),T=Math.cos(n.yPoleWander),P=Math.sin(n.xPoleWander),R=Math.sin(n.yPoleWander),N=r-B+a/v.SECONDS_PER_DAY;N/=36525;var z=-47e-6*N*h.RADIANS_PER_DEGREE/3600,I=Math.cos(z),C=Math.sin(z),A=k;return A[0]=O*I,A[1]=O*C,A[2]=P,A[3]=-T*C+R*P*I,A[4]=T*I+R*P*C,A[5]=-R*O,A[6]=-R*C-T*P*I,A[7]=R*I-T*P*C,A[8]=T*O,m.multiply(M,A,t)};var V=new r;g.pointToWindowCoordinates=function(e,t,n,r){return r=g.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},g.pointToGLWindowCoordinates=function(e,n,a,o){i(o)||(o=new t);var u=V;return p.multiplyByVector(e,r.fromElements(a.x,a.y,a.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var j=new n,Y=new n,H=new n;return g.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=a(r,c.WGS84).geodeticSurfaceNormal(e,j),s=n.cross(t,u,Y);n.equalsEpsilon(s,n.ZERO,h.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,H);return n.cross(t,l,s),n.negate(s,s),i(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,d,f,h,m){"use strict";var p=new r,y=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(d.getColumn(r,0,p)),this._yAxis=n.fromCartesian4(d.getColumn(r,1,p));var i=n.fromCartesian4(d.getColumn(r,2,p));this._plane=f.fromPointNormal(e,i)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var g=new h,w=new n;y.prototype.projectPointOntoPlane=function(e,r){var a=g;a.origin=e,n.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,w);if(i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w)),i(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return i(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var n=0,r=e.length,a=0;r>a;a++){var o=this.projectPointOntoPlane(e[a],t[n]);i(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){i(r)||(r=new t);var a=g;a.origin=e,n.clone(this._plane.normal,a.direction);var o=c.rayPlane(a,this._plane,w);i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){i(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;i(t)?t.length=r:t=new Array(r);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var d=e[l];n.multiplyByScalar(u,d.x,c),i(t[l])||(t[l]=new n);var f=n.add(o,c,t[l]);n.multiplyByScalar(s,d.y,c),n.add(f,c,f),a.scaleToGeocentricSurface(f,f)}return t},y}),define("Core/PolylineVolumeGeometryLibrary",["./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./CornerType","./EllipsoidTangentPlane","./Math","./Matrix3","./Matrix4","./PolylinePipeline","./Quaternion","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,d){"use strict";function f(e,t){for(var n=new Array(e.length),r=0;r<e.length;r++){var a=e[r];b=t.cartesianToCartographic(a,b),n[r]=b.height,e[r]=t.scaleToGeodeticSurface(a,a)}return n}function h(e,n,r,a){var i,o=e[0],u=e[1],s=t.angleBetween(o,u),c=Math.ceil(s/a),l=new Array(c);if(n===r){for(i=0;c>i;i++)l[i]=n;return l.push(r),l}var d=r-n,f=d/c;for(i=1;c>i;i++){var h=n+i*f;l[i]=h}return l[0]=n,l.push(r),l}function m(n,r,a,o){var u=new i(a,o),s=u.projectPointOntoPlane(t.add(a,n,H),H),c=u.projectPointOntoPlane(t.add(a,r,Z),Z),l=e.angleBetween(s,c);return c.x*s.y-c.y*s.x>=0?-l:l}function p(e,n,r,a,i,o,c,l){var f=W,h=F;U=d.eastNorthUpToFixedFrame(e,i,U),f=s.multiplyByPointAsVector(U,D,f),f=t.normalize(f,f);var p=m(f,n,e,i);L=u.fromRotationZ(p,L),G.z=o,U=s.multiplyTransformation(U,s.fromRotationTranslation(L,G,q),U);var y=B;y[0]=c;for(var v=0;l>v;v++)for(var g=0;g<r.length;g+=3)h=t.fromArray(r,g,h),h=u.multiplyByVector(y,h,h),h=s.multiplyByPoint(U,h,h),a.push(h.x,h.y,h.z);return a}function y(e,n,r,a,i,o,u){for(var s=0;s<e.length;s+=3){var c=t.fromArray(e,s,k);a=p(c,n,r,a,i,o[s/3],u,1)}return a}function v(e,t){var n=e.length,r=new Array(6*n),a=0,i=t.x+t.width/2,o=t.y+t.height/2,u=e[0];r[a++]=u.x-i,r[a++]=0,r[a++]=u.y-o;for(var s=1;n>s;s++){u=e[s];var c=u.x-i,l=u.y-o;r[a++]=c,r[a++]=0,r[a++]=l,r[a++]=c,r[a++]=0,r[a++]=l}return u=e[0],r[a++]=u.x-i,r[a++]=0,r[a++]=u.y-o,r}function g(e,t){for(var n=e.length,r=new Array(3*n),a=0,i=t.x+t.width/2,o=t.y+t.height/2,u=0;n>u;u++)r[a++]=e[u].x-i,r[a++]=0,r[a++]=e[u].y-o; -return r}function w(e,n,r,i,s,c,d,f,h,m){var y,v=t.angleBetween(t.subtract(n,e,I),t.subtract(r,e,C)),g=i===a.BEVELED?0:Math.ceil(v/o.toRadians(5));y=s?u.fromQuaternion(l.fromAxisAngle(t.negate(e,I),v/(g+1),V),Y):u.fromQuaternion(l.fromAxisAngle(e,v/(g+1),V),Y);var w,x;if(n=t.clone(n,j),g>0)for(var E=m?2:1,S=0;g>S;S++)n=u.multiplyByVector(y,n,n),w=t.subtract(n,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(n,C),d=p(x,w,f,d,c,h,1,E);else w=t.subtract(n,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(n,C),d=p(x,w,f,d,c,h,1,1),r=t.clone(r,j),w=t.subtract(r,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(r,C),d=p(x,w,f,d,c,h,1,1);return d}function x(e,t){return o.equalsEpsilon(e.latitude,t.latitude,o.EPSILON6)&&o.equalsEpsilon(e.longitude,t.longitude,o.EPSILON6)}var E=[new t,new t],S=new t,_=new t,M=new t,O=new t,T=new t,P=new t,R=new t,N=new t,z=new t,I=new t,C=new t,A={},b=new r,D=new t(-1,0,0),U=new s,q=new s,L=new u,B=u.IDENTITY.clone(),W=new t,F=new n,G=new t,k=new t,V=new l,j=new t,Y=new u;A.removeDuplicatesFromShape=function(t){for(var n=t.length,r=[],a=n-1,i=0;n>i;a=i++){var o=t[a],u=t[i];e.equals(o,u)||r.push(u)}return r};var H=new t,Z=new t;A.angleIsGreaterThanPi=function(e,n,r,a){var o=new i(r,a),u=o.projectPointOntoPlane(t.add(r,e,H),H),s=o.projectPointOntoPlane(t.add(r,n,Z),Z);return s.x*u.y-s.y*u.x>=0};var X=new r,J=new r;A.removeDuplicatesFromPositions=function(e,t){var n=e.length;if(2>n)return e.slice(0);var r=[];r.push(e[0]);for(var a=1;n>a;++a){var i=e[a-1],o=e[a],u=t.cartesianToCartographic(i,X),s=t.cartesianToCartographic(o,J);x(u,s)||r.push(o)}return r};var Q=new t,K=new t;return A.computePositions=function(e,n,r,i,u){var s=i._ellipsoid,l=f(e,s),d=i._granularity,m=i._cornerType,x=u?v(n,r):g(n,r),C=u?g(n,r):void 0,b=r.height/2,D=r.width/2,U=e.length,q=[],L=u?[]:void 0,B=S,W=_,F=M,G=O,k=T,V=P,j=R,Y=N,H=z,Z=e[0],X=e[1];G=s.geodeticSurfaceNormal(Z,G),B=t.subtract(X,Z,B),B=t.normalize(B,B),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y);var J=l[0],$=l[1];u&&(L=p(Z,Y,C,L,s,J+b,1,1)),H=t.clone(Z,H),Z=X,W=t.negate(B,W);for(var et,tt,nt=1;U-1>nt;nt++){var rt=u?2:1;X=e[nt+1],B=t.subtract(X,Z,B),B=t.normalize(B,B),F=t.add(B,W,F),F=t.normalize(F,F),G=s.geodeticSurfaceNormal(Z,G);var at=t.multiplyByScalar(G,t.dot(B,G),Q);t.subtract(B,at,at),t.normalize(at,at);var it=t.multiplyByScalar(G,t.dot(W,G),K);t.subtract(W,it,it),t.normalize(it,it);var ot=!o.equalsEpsilon(Math.abs(t.dot(at,it)),1,o.EPSILON7);if(ot){F=t.cross(F,G,F),F=t.cross(G,F,F),F=t.normalize(F,F);var ut=1/Math.max(.25,t.magnitude(t.cross(F,W,I))),st=A.angleIsGreaterThanPi(B,W,Z,s);st?(k=t.add(Z,t.multiplyByScalar(F,ut*D,F),k),V=t.add(k,t.multiplyByScalar(Y,D,V),V),E[0]=t.clone(H,E[0]),E[1]=t.clone(V,E[1]),et=h(E,J+b,$+b,d),tt=c.generateArc({positions:E,granularity:d,ellipsoid:s}),q=y(tt,Y,x,q,s,et,1),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y),j=t.add(k,t.multiplyByScalar(Y,D,j),j),m===a.ROUNDED||m===a.BEVELED?w(k,V,j,m,st,s,q,x,$+b,u):(F=t.negate(F,F),q=p(Z,F,x,q,s,$+b,ut,rt)),H=t.clone(j,H)):(k=t.add(Z,t.multiplyByScalar(F,ut*D,F),k),V=t.add(k,t.multiplyByScalar(Y,-D,V),V),E[0]=t.clone(H,E[0]),E[1]=t.clone(V,E[1]),et=h(E,J+b,$+b,d),tt=c.generateArc({positions:E,granularity:d,ellipsoid:s}),q=y(tt,Y,x,q,s,et,1),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y),j=t.add(k,t.multiplyByScalar(Y,-D,j),j),m===a.ROUNDED||m===a.BEVELED?w(k,V,j,m,st,s,q,x,$+b,u):q=p(Z,F,x,q,s,$+b,ut,rt),H=t.clone(j,H)),W=t.negate(B,W)}else q=p(H,Y,x,q,s,J+b,1,1),H=Z;J=$,$=l[nt+1],Z=X}E[0]=t.clone(H,E[0]),E[1]=t.clone(Z,E[1]),et=h(E,J+b,$+b,d),tt=c.generateArc({positions:E,granularity:d,ellipsoid:s}),q=y(tt,Y,x,q,s,et,1),u&&(L=p(Z,Y,C,L,s,$+b,1,1)),U=q.length;var ct=u?U+L.length:U,lt=new Float64Array(ct);return lt.set(q),u&<.set(L,U),lt},A}),define("Core/CorridorGeometryLibrary",["./Cartesian3","./CornerType","./defined","./isArray","./Math","./Matrix3","./PolylinePipeline","./PolylineVolumeGeometryLibrary","./Quaternion"],function(e,t,n,r,a,i,o,u,s){"use strict";function c(n,r,o,u,c){var l=e.angleBetween(e.subtract(r,n,p),e.subtract(o,n,y)),d=u===t.BEVELED?1:Math.ceil(l/a.toRadians(5))+1,f=3*d,h=new Array(f);h[f-3]=o.x,h[f-2]=o.y,h[f-1]=o.z;var m;m=c?i.fromQuaternion(s.fromAxisAngle(e.negate(n,p),l/d,z),I):i.fromQuaternion(s.fromAxisAngle(n,l/d,z),I);var v=0;r=e.clone(r,p);for(var g=0;d>g;g++)r=i.multiplyByVector(m,r,r),h[v++]=r.x,h[v++]=r.y,h[v++]=r.z;return h}function l(n){var r=x,a=E,i=S,o=n[1];a=e.fromArray(n[1],o.length-3,a),i=e.fromArray(n[0],0,i),r=e.multiplyByScalar(e.add(a,i,r),.5,r);var u=c(r,a,i,t.ROUNDED,!1),s=n.length-1,l=n[s-1];o=n[s],a=e.fromArray(l,l.length-3,a),i=e.fromArray(o,0,i),r=e.multiplyByScalar(e.add(a,i,r),.5,r);var d=c(r,a,i,t.ROUNDED,!1);return[u,d]}function d(t,n,r,a){var i=p;return a?i=e.add(t,n,i):(n=e.negate(n,n),i=e.add(t,n,i)),[i.x,i.y,i.z,r.x,r.y,r.z]}function f(t,n,r,a){for(var i=new Array(t.length),o=new Array(t.length),u=e.multiplyByScalar(n,r,p),s=e.negate(u,y),c=0,l=t.length-1,d=0;d<t.length;d+=3){var f=e.fromArray(t,d,v),h=e.add(f,s,g);i[c++]=h.x,i[c++]=h.y,i[c++]=h.z;var m=e.add(f,u,g);o[l--]=m.z,o[l--]=m.y,o[l--]=m.x}return a.push(i,o),a}function h(e,t){for(var n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}var m={},p=new e,y=new e,v=new e,g=new e,w=[new e,new e],x=new e,E=new e,S=new e,_=new e,M=new e,O=new e,T=new e,P=new e,R=new e,N=new e,z=new s,I=new i;m.addAttribute=function(e,t,r,a){var i=t.x,o=t.y,u=t.z;n(r)&&(e[r]=i,e[r+1]=o,e[r+2]=u),n(a)&&(e[a]=u,e[a-1]=o,e[a-2]=i)};var C=new e,A=new e;m.computePositions=function(n){var r=n.granularity,i=n.positions,s=n.ellipsoid;i=h(i,s);var m=n.width/2,y=n.cornerType,v=n.saveAttributes,g=x,z=E,I=S,b=_,D=M,U=O,q=T,L=P,B=R,W=N,F=[],G=v?[]:void 0,k=v?[]:void 0,V=i[0],j=i[1];z=e.normalize(e.subtract(j,V,z),z),g=s.geodeticSurfaceNormal(V,g),b=e.normalize(e.cross(g,z,b),b),v&&(G.push(b.x,b.y,b.z),k.push(g.x,g.y,g.z)),q=e.clone(V,q),V=j,I=e.negate(z,I);var Y,H,Z=[],X=i.length;for(H=1;X-1>H;H++){g=s.geodeticSurfaceNormal(V,g),j=i[H+1],z=e.normalize(e.subtract(j,V,z),z),D=e.normalize(e.add(z,I,D),D);var J=e.multiplyByScalar(g,e.dot(z,g),C);e.subtract(z,J,J),e.normalize(J,J);var Q=e.multiplyByScalar(g,e.dot(I,g),A);e.subtract(I,Q,Q),e.normalize(Q,Q);var K=!a.equalsEpsilon(Math.abs(e.dot(J,Q)),1,a.EPSILON7);if(K){D=e.cross(D,g,D),D=e.cross(g,D,D);var $=m/Math.max(.25,e.magnitude(e.cross(D,I,p))),et=u.angleIsGreaterThanPi(z,I,V,s);D=e.multiplyByScalar(D,$,D),et?(L=e.add(V,D,L),W=e.add(L,e.multiplyByScalar(b,m,W),W),B=e.add(L,e.multiplyByScalar(b,2*m,B),B),w[0]=e.clone(q,w[0]),w[1]=e.clone(W,w[1]),Y=o.generateArc({positions:w,granularity:r,ellipsoid:s}),F=f(Y,b,m,F),v&&(G.push(b.x,b.y,b.z),k.push(g.x,g.y,g.z)),U=e.clone(B,U),b=e.normalize(e.cross(g,z,b),b),B=e.add(L,e.multiplyByScalar(b,2*m,B),B),q=e.add(L,e.multiplyByScalar(b,m,q),q),y===t.ROUNDED||y===t.BEVELED?Z.push({leftPositions:c(L,U,B,y,et)}):Z.push({leftPositions:d(V,e.negate(D,D),B,et)})):(B=e.add(V,D,B),W=e.add(B,e.negate(e.multiplyByScalar(b,m,W),W),W),L=e.add(B,e.negate(e.multiplyByScalar(b,2*m,L),L),L),w[0]=e.clone(q,w[0]),w[1]=e.clone(W,w[1]),Y=o.generateArc({positions:w,granularity:r,ellipsoid:s}),F=f(Y,b,m,F),v&&(G.push(b.x,b.y,b.z),k.push(g.x,g.y,g.z)),U=e.clone(L,U),b=e.normalize(e.cross(g,z,b),b),L=e.add(B,e.negate(e.multiplyByScalar(b,2*m,L),L),L),q=e.add(B,e.negate(e.multiplyByScalar(b,m,q),q),q),y===t.ROUNDED||y===t.BEVELED?Z.push({rightPositions:c(B,U,L,y,et)}):Z.push({rightPositions:d(V,D,L,et)})),I=e.negate(z,I)}V=j}g=s.geodeticSurfaceNormal(V,g),w[0]=e.clone(q,w[0]),w[1]=e.clone(V,w[1]),Y=o.generateArc({positions:w,granularity:r,ellipsoid:s}),F=f(Y,b,m,F),v&&(G.push(b.x,b.y,b.z),k.push(g.x,g.y,g.z));var tt;return y===t.ROUNDED&&(tt=l(F)),{positions:F,corners:Z,lefts:G,normals:k,endPositions:tt}};var b=new e,D=new e;return m.scaleToGeodeticHeight=function(t,n,a,i){var o=t.length,u=r(i)?i:new Array(t.length);u.length=t.length;for(var s=n,c=0;o>c;c+=3){var l=a.scaleToGeodeticSurface(e.fromArray(t,c,D),D),d=b;0!==n&&(d=a.geodeticSurfaceNormal(l,d),d=e.multiplyByScalar(d,s,d),l=e.add(l,d,l)),u[c]=l.x,u[c+1]=l.y,u[c+2]=l.z}return u},m}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var r=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,n,a){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,a):new Uint16Array(t,n,a)},n(a)}),define("Core/CorridorOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./CornerType","./CorridorGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolylinePipeline","./PrimitiveType"],function(e,t,n,r,a,i,o,u,s,c,l,d,f,h,m,p){"use strict";function y(e,i){var u,s,c,h=[],m=e.positions,p=e.corners,y=e.endPositions,v=new d,E=0,S=0,_=0;for(s=0;s<m.length;s+=2)c=m[s].length-3,E+=c,_+=4*(c/3),S+=m[s+1].length-3;for(E+=3,S+=3,s=0;s<p.length;s++){u=p[s];var M=p[s].leftPositions;o(M)?(c=M.length,E+=c,_+=2*(c/3)):(c=p[s].rightPositions.length,S+=c,_+=2*(c/3))}var O,T=o(y);T&&(O=y[0].length-3,E+=O,S+=O,O/=3,_+=4*O);var P,R,N,z,I,C,A=E+S,b=new Float64Array(A),D=0,U=A-1,q=O/2,L=f.createTypedArray(A/3,_+4),B=0;if(L[B++]=D/3,L[B++]=(U-2)/3,T){h.push(D/3),C=g,I=w;var W=y[0];for(s=0;q>s;s++)C=t.fromArray(W,3*(q-1-s),C),I=t.fromArray(W,3*(q+s),I),a.addAttribute(b,I,D),a.addAttribute(b,C,void 0,U),R=D/3,z=R+1,P=(U-2)/3,N=P-1,L[B++]=P,L[B++]=N,L[B++]=R,L[B++]=z,D+=3,U-=3}var F=0,G=m[F++],k=m[F++];for(b.set(G,D),b.set(k,U-k.length+1),c=k.length-3,h.push(D/3,(U-2)/3),s=0;c>s;s+=3)R=D/3,z=R+1,P=(U-2)/3,N=P-1,L[B++]=P,L[B++]=N,L[B++]=R,L[B++]=z,D+=3,U-=3;for(s=0;s<p.length;s++){var V;u=p[s];var j,Y=u.leftPositions,H=u.rightPositions,Z=x;if(o(Y)){for(U-=3,j=N,h.push(z),V=0;V<Y.length/3;V++)Z=t.fromArray(Y,3*V,Z),L[B++]=j-V-1,L[B++]=j-V,a.addAttribute(b,Z,void 0,U),U-=3;h.push(j-Math.floor(Y.length/6)),i===r.BEVELED&&h.push((U-2)/3+1),D+=3}else{for(D+=3,j=z,h.push(N),V=0;V<H.length/3;V++)Z=t.fromArray(H,3*V,Z),L[B++]=j+V,L[B++]=j+V+1,a.addAttribute(b,Z,D),D+=3;h.push(j+Math.floor(H.length/6)),i===r.BEVELED&&h.push(D/3-1),U-=3}for(G=m[F++],k=m[F++],G.splice(0,3),k.splice(k.length-3,3),b.set(G,D),b.set(k,U-k.length+1),c=k.length-3,V=0;V<k.length;V+=3)z=D/3,R=z-1,N=(U-2)/3,P=N+1,L[B++]=P,L[B++]=N,L[B++]=R,L[B++]=z,D+=3,U-=3;D-=3,U+=3,h.push(D/3,(U-2)/3)}if(T){D+=3,U-=3,C=g,I=w;var X=y[1];for(s=0;q>s;s++)C=t.fromArray(X,3*(O-s-1),C),I=t.fromArray(X,3*s,I),a.addAttribute(b,C,void 0,U),a.addAttribute(b,I,D),z=D/3,R=z-1,N=(U-2)/3,P=N+1,L[B++]=P,L[B++]=N,L[B++]=R,L[B++]=z,D+=3,U-=3;h.push(D/3)}else h.push(D/3,(U-2)/3);return L[B++]=D/3,L[B++]=(U-2)/3,v.position=new l({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:b}),{attributes:v,indices:L,wallIndices:h}}function v(e){var t=e.ellipsoid,n=a.computePositions(e),r=y(n,e.cornerType),i=r.wallIndices,o=e.height,u=e.extrudedHeight,s=r.attributes,c=r.indices,l=s.position.values,d=l.length,h=new Float64Array(d);h.set(l);var m=new Float64Array(2*d);l=a.scaleToGeodeticHeight(l,o,t,l),h=a.scaleToGeodeticHeight(h,u,t,h),m.set(l),m.set(h,d),s.position.values=m,d/=3;var p,v=c.length,g=f.createTypedArray(m.length/3,2*(v+i.length));g.set(c);var w=v;for(p=0;v>p;p+=2){var x=c[p],E=c[p+1];g[w++]=x+d,g[w++]=E+d}var S,_;for(p=0;p<i.length;p++)S=i[p],_=S+d,g[w++]=S,g[w++]=_;return{attributes:s,indices:g}}var g=new t,w=new t,x=new t,E=function(e){e=i(e,i.EMPTY_OBJECT);var n=e.positions,a=e.width;this._positions=n,this._ellipsoid=s.clone(i(e.ellipsoid,s.WGS84)),this._width=a,this._height=i(e.height,0),this._extrudedHeight=i(e.extrudedHeight,this._height),this._cornerType=i(e.cornerType,r.ROUNDED),this._granularity=i(e.granularity,h.RADIANS_PER_DEGREE),this._workerName="createCorridorOutlineGeometry",this.packedLength=1+n.length*t.packedLength+s.packedLength+5};E.pack=function(e,n,r){r=i(r,0);var a=e._positions,o=a.length;n[r++]=o;for(var u=0;o>u;++u,r+=t.packedLength)t.pack(a[u],n,r);s.pack(e._ellipsoid,n,r),r+=s.packedLength,n[r++]=e._width,n[r++]=e._height,n[r++]=e._extrudedHeight,n[r++]=e._cornerType,n[r]=e._granularity};var S=s.clone(s.UNIT_SPHERE),_={positions:void 0,ellipsoid:S,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0};return E.unpack=function(e,n,r){n=i(n,0);for(var a=e[n++],u=new Array(a),c=0;a>c;++c,n+=t.packedLength)u[c]=t.unpack(e,n);var l=s.unpack(e,n,S);n+=s.packedLength;var d=e[n++],f=e[n++],h=e[n++],m=e[n++],p=e[n];return o(r)?(r._positions=u,r._ellipsoid=s.clone(l,r._ellipsoid),r._width=d,r._height=f,r._extrudedHeight=h,r._cornerType=m,r._granularity=p,r):(_.positions=u,_.width=d,_.height=f,_.extrudedHeight=h,_.cornerType=m,_.granularity=p,new E(_))},E.createGeometry=function(t){var n=t._positions,r=t._height,i=t._extrudedHeight,o=r!==i,u=m.removeDuplicates(n);if(u.length<2)return void 0;var s,l=t._ellipsoid,d={ellipsoid:l,positions:u,width:t._width,cornerType:t._cornerType,granularity:t._granularity,saveAttributes:!1};if(o){var f=Math.max(r,i);i=Math.min(r,i),r=f,d.height=r,d.extrudedHeight=i,s=v(d)}else{var h=a.computePositions(d);s=y(h,d.cornerType),s.attributes.position.values=a.scaleToGeodeticHeight(s.attributes.position.values,r,l,s.attributes.position.values)}var g=s.attributes,w=e.fromVertices(g.position.values,void 0,3);return new c({attributes:g,indices:s.indices,primitiveType:p.LINES,boundingSphere:w})},E}),define("Workers/createCorridorOutlineGeometry",["../Core/CorridorOutlineGeometry","../Core/defined","../Core/Ellipsoid"],function(e,t,n){"use strict";function r(r,a){return t(a)&&(r=e.unpack(r,a)),r._ellipsoid=n.clone(r._ellipsoid),e.createGeometry(r)}return r})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createCylinderGeometry.js b/libs/Cesium/Workers/createCylinderGeometry.js deleted file mode 100644 index 3c12536a..00000000 --- a/libs/Cesium/Workers/createCylinderGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(t){return t>0?1:0>t?-1:0},n.signNotZero=function(t){return 0>t?-1:1},n.toSNorm=function(t){return Math.round(255*(.5*n.clamp(t,-1,1)+.5))},n.fromSNorm=function(t){return 2*(n.clamp(t,0,255)/255)-1},n.sinh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e-n)},n.cosh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e+n)},n.lerp=function(t,e,n){return(1-n)*t+n*e},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(t){return t*n.RADIANS_PER_DEGREE},n.toDegrees=function(t){return t*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(t){var e=n.TWO_PI,r=t-Math.floor(t/e)*e;return r<-Math.PI?r+e:r>=Math.PI?r-e:r},n.negativePiToPi=function(t){return n.zeroToTwoPi(t+n.PI)-n.PI},n.zeroToTwoPi=function(t){var e=n.mod(t,n.TWO_PI);return Math.abs(e)<n.EPSILON14&&Math.abs(t)>n.EPSILON14?n.TWO_PI:e},n.mod=function(t,e){return(t%e+e)%e},n.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return i>=a||a<=r*Math.max(Math.abs(t),Math.abs(n))};var r=[1];n.factorial=function(t){var e=r.length;if(t>=e)for(var n=r[e-1],i=e;t>=i;i++)r.push(n*i);return r[t]},n.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},n.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},n.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},n.clamp=function(t,e,n){return e>t?e:t>n?n:t};var i=new t;return n.setRandomNumberSeed=function(e){i=new t(e)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(t){return Math.acos(n.clamp(t,-1,1))},n.asinClamped=function(t){return Math.asin(n.clamp(t,-1,1))},n.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)};a.fromSpherical=function(n,r){e(r)||(r=new a);var i=n.clock,o=n.cone,u=t(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(t,n,r,i){return e(i)?(i.x=t,i.y=n,i.z=r,i):new a(t,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):n.y<=n.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)},a.cross=function(t,e,n){var r=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(t,e,n,r,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),e(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o++)r[o]=i.toRadians(t[o]);return a.fromRadiansArray(r,e,n)},a.fromRadiansArray=function(t,n,r){var i=t.length;e(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o+=3)r[o]=i.toRadians(t[o]),r[o+1]=i.toRadians(t[o+1]),r[o+2]=t[o+2];return a.fromRadiansArrayHeights(r,e,n)},a.fromRadiansArrayHeights=function(t,n,r){var i=t.length;e(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)};return a.fromRadians=function(n,r,i,o){return i=t(i,0),e(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(t,e,n,r){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},a.equalsEpsilon=function(t,n,r){return t===n||e(t)&&e(n)&&Math.abs(t.longitude-n.longitude)<=r&&Math.abs(t.latitude-n.latitude)<=r&&Math.abs(t.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var e={},n=function(n,r){t(e[n])||(e[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(e,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),e._radii=new t(r,i,a),e._radiiSquared=new t(r*r,i*i,a*a),e._radiiToTheFourth=new t(r*r*r*r,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(r,i,a),e._maximumRadius=Math.max(r,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,n){if(!r(e))return void 0;var i=e._radii;return r(n)?(t.clone(i,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return r(e)||(e=new c),r(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,r,i){i=n(i,0),t.pack(e._radii,r,i)},c.unpack=function(e,r,i){r=n(r,0);var a=t.unpack(e,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,n){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(e,n){return r(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;c.prototype.cartographicToCartesian=function(e,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),r(n)||(n=new t),t.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var h=new t,d=new t,m=new t;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=t.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(t.dot(s,n))*t.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new e(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,n){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),E=t.multiplyByScalar(e,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?t.clone(E,n):void 0;var x=this._oneOverRadiiSquared,g=x.x,S=x.y,M=x.z,O=p;O.x=2*E.x*g,O.y=2*E.y*S,O.z=2*E.z*M;var _,z,T,I,N,R,b,A,P,C,L,q=(1-w)*t.magnitude(e)/(.5*t.magnitude(O)),U=0;do{q-=U,T=1/(1+q*g),I=1/(1+q*S),N=1/(1+q*M),R=T*T,b=I*I,A=N*N,P=R*T,C=b*I,L=A*N,_=h*R+d*b+m*A-1,z=h*P*g+d*C*S+m*L*M;var D=-2*z;U=_/D}while(Math.abs(_)>u.EPSILON12);return r(n)?(n.x=i*T,n.y=a*I,n.z=o*N,n):new t(i*T,a*I,o*N)},c.prototype.scaleToGeocentricSurface=function(e,n){r(n)||(n=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,n)},c.prototype.transformPositionToScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._radii,n)},c.prototype.equals=function(e){return this===e||r(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";var u=function(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var e={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(e)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var e=function(e,n){this.start=t(e,0),this.stop=t(n,0)};return e}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)};a.fromElements=function(t,n,r,i,o){return e(o)?(o.x=t,o.y=n,o.z=r,o.w=i,o):new a(t,n,r,i)},a.fromColor=function(t,n){return e(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new a(t.red,t.green,t.blue,t.alpha)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new a(t.x,t.y,t.z,t.w):void 0},a.packedLength=4,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n.w=Math.min(t.w,e.w),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n.w=Math.max(t.w,e.w),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e.w=t.w/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n.w=t.w*e.w,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n.w=t.w+e.w,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n.w=t.w-e.w,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n.w=t.w*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n.w=t.w/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e.w=Math.abs(t.w),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,s);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]&&t.w===e[n+3]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)&&i.equalsEpsilon(t.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t){for(var e=0,n=0;9>n;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function u(t){for(var e=0,n=0;3>n;++n){var r=t[c.getElementIndex(d[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function s(t,e){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(t[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(t[c.getElementIndex(m,f)])>n){var y,p=t[c.getElementIndex(m,m)],v=t[c.getElementIndex(f,f)],w=t[c.getElementIndex(m,f)],E=(p-v)/2/w;y=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),s=1/Math.sqrt(1+y*y),l=y*s}return e=c.clone(c.IDENTITY,e),e[c.getElementIndex(f,f)]=e[c.getElementIndex(m,m)]=s,e[c.getElementIndex(m,f)]=l,e[c.getElementIndex(f,m)]=-l,e}var c=function(t,n,r,i,a,o,u,s,c){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(u,0),this[3]=e(n,0),this[4]=e(a,0),this[5]=e(s,0),this[6]=e(r,0),this[7]=e(o,0),this[8]=e(c,0)};c.packedLength=9,c.pack=function(t,n,r){r=e(r,0),n[r++]=t[0],n[r++]=t[1],n[r++]=t[2],n[r++]=t[3],n[r++]=t[4],n[r++]=t[5],n[r++]=t[6],n[r++]=t[7],n[r++]=t[8]},c.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r++],i[1]=t[r++],i[2]=t[r++],i[3]=t[r++],i[4]=t[r++],i[5]=t[r++],i[6]=t[r++],i[7]=t[r++],i[8]=t[r++],i},c.clone=function(t,e){return n(t)?n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new c(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},c.fromArray=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r],i[1]=t[r+1],i[2]=t[r+2],i[3]=t[r+3],i[4]=t[r+4],i[5]=t[r+5],i[6]=t[r+6],i[7]=t[r+7],i[8]=t[r+8],i},c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},c.fromQuaternion=function(t,e){var r=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,s=t.y*t.z,l=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,E=2*(s-o),x=2*(a-l),g=2*(s+o),S=-r-u+f+d;return n(e)?(e[0]=m,e[1]=v,e[2]=x,e[3]=y,e[4]=w,e[5]=g,e[6]=p,e[7]=E,e[8]=S,e):new c(m,y,p,v,w,E,x,g,S)},c.fromScale=function(t,e){return n(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new c(t.x,0,0,0,t.y,0,0,0,t.z)},c.fromUniformScale=function(t,e){return n(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new c(t,0,0,0,t,0,0,0,t)},c.fromCrossProduct=function(t,e){return n(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new c(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},c.fromRotationX=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=r,e[5]=i,e[6]=0,e[7]=-i,e[8]=r,e):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=r,e):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},c.getElementIndex=function(t,e){return 3*t+e},c.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;c.getMaximumScale=function(e){return c.getScale(e,f),t.maximumComponent(f)},c.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],l=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],f=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},c.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},c.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],l=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=l,e};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(t,e){var r=a.EPSILON20,i=10,l=0,f=0;n(e)||(e={});for(var h=e.unitary=c.clone(c.IDENTITY,e.unitary),d=e.diagonal=c.clone(t,e.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},c.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(t,e){var n=t[0],i=t[1],o=t[2],u=t[3],s=t[4],l=t[5],f=t[6],h=t[7],d=t[8],m=c.determinant(t);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");e[0]=s*d-h*l,e[1]=h*o-i*d,e[2]=i*l-s*o,e[3]=f*l-u*d,e[4]=n*d-f*o,e[5]=u*o-n*l,e[6]=u*h-f*s,e[7]=f*i-n*h,e[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(e,y,e)},c.equals=function(t,e){return t===e||n(t)&&n(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},c.equalsEpsilon=function(t,e,r){return t===e||n(t)&&n(e)&&Math.abs(t[0]-e[0])<=r&&Math.abs(t[1]-e[1])<=r&&Math.abs(t[2]-e[2])<=r&&Math.abs(t[3]-e[3])<=r&&Math.abs(t[4]-e[4])<=r&&Math.abs(t[5]-e[5])<=r&&Math.abs(t[6]-e[6])<=r&&Math.abs(t[7]-e[7])<=r&&Math.abs(t[8]-e[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var e=function(t){this.name="RuntimeError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,e,n,r,i,a,o,u,s){"use strict";var c=function(t,e,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(t,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(e,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(t,e,r){r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e[r++]=t[9],e[r++]=t[10],e[r++]=t[11],e[r++]=t[12],e[r++]=t[13],e[r++]=t[14],e[r]=t[15]},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},c.clone=function(t,e){return r(t)?r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):new c(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},c.fromRotationTranslation=function(e,i,a){return i=n(i,t.ZERO),r(a)?(a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=0,a[4]=e[3],a[5]=e[4],a[6]=e[5],a[7]=0,a[8]=e[6],a[9]=e[7],a[10]=e[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(e[0],e[3],e[6],i.x,e[1],e[4],e[7],i.y,e[2],e[5],e[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(t,e,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=e.x*e.x,l=e.x*e.y,f=e.x*e.z,h=e.x*e.w,d=e.y*e.y,m=e.y*e.z,y=e.y*e.w,p=e.z*e.z,v=e.z*e.w,w=e.w*e.w,E=s-d-p+w,x=2*(l-v),g=2*(f+y),S=2*(l+v),M=-s+d-p+w,O=2*(m-h),_=2*(f-y),z=2*(m+h),T=-s-d+p+w;return i[0]=E*a,i[1]=S*a,i[2]=_*a,i[3]=0,i[4]=x*o,i[5]=M*o,i[6]=z*o,i[7]=0,i[8]=g*u,i[9]=O*u,i[10]=T*u,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i},c.fromTranslation=function(t,e){return c.fromRotationTranslation(u.IDENTITY,t,e)},c.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},c.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var l=new t,f=new t,h=new t;c.fromCamera=function(e,n){var i=e.eye,a=e.target,o=e.up;t.normalize(t.subtract(a,i,l),l),t.normalize(t.cross(l,o,f),f),t.normalize(t.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,E=h.z,x=i.x,g=i.y,S=i.z,M=u*-x+s*-g+d*-S,O=v*-x+w*-g+E*-S,_=m*x+y*g+p*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=E,n[10]=-p,n[11]=0,n[12]=M,n[13]=O,n[14]=_,n[15]=1,n):new c(u,s,d,M,v,w,E,O,-m,-y,-p,_,0,0,0,1)},c.computePerspectiveFieldOfView=function(t,e,n,r,i){var a=Math.tan(.5*t),o=1/a,u=o/e,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(t,e,n,r,i,a,o){var u=1/(e-t),s=1/(r-n),c=1/(a-i),l=-(e+t)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(t,e,n,r,i,a,o){var u=2*i/(e-t),s=2*i/(r-n),c=(e+t)/(e-t),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(t,e,n,r,i,a){var o=2*i/(e-t),u=2*i/(r-n),s=(e+t)/(e-t),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(t,e,r,i){t=n(t,n.EMPTY_OBJECT);var a=n(t.x,0),o=n(t.y,0),u=n(t.width,0),s=n(t.height,0);e=n(e,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-e),h=c,d=l,m=f,y=a+c,p=o+l,v=e+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},c.getElementIndex=function(t,e){return 4*t+e},c.getColumn=function(t,e,n){var r=4*e,i=t[r],a=t[r+1],o=t[r+2],u=t[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=4*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=t[15],n},c.getRow=function(t,e,n){var r=t[e],i=t[e+4],a=t[e+8],o=t[e+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+4]=n.y,r[e+8]=n.z,r[e+12]=n.w,r};var d=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],d)),n.y=t.magnitude(t.fromElements(e[4],e[5],e[6],d)),n.z=t.magnitude(t.fromElements(e[8],e[9],e[10],d)),n};var m=new t;c.getMaximumScale=function(e){return c.getScale(e,m),t.maximumComponent(m)},c.multiply=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[3],u=t[4],s=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],p=t[13],v=t[14],w=t[15],E=e[0],x=e[1],g=e[2],S=e[3],M=e[4],O=e[5],_=e[6],z=e[7],T=e[8],I=e[9],N=e[10],R=e[11],b=e[12],A=e[13],P=e[14],C=e[15],L=r*E+u*x+f*g+y*S,q=i*E+s*x+h*g+p*S,U=a*E+c*x+d*g+v*S,D=o*E+l*x+m*g+w*S,B=r*M+u*O+f*_+y*z,F=i*M+s*O+h*_+p*z,W=a*M+c*O+d*_+v*z,G=o*M+l*O+m*_+w*z,k=r*T+u*I+f*N+y*R,V=i*T+s*I+h*N+p*R,Y=a*T+c*I+d*N+v*R,j=o*T+l*I+m*N+w*R,Z=r*b+u*A+f*P+y*C,H=i*b+s*A+h*P+p*C,X=a*b+c*A+d*P+v*C,K=o*b+l*A+m*P+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=D,n[4]=B,n[5]=F,n[6]=W,n[7]=G,n[8]=k,n[9]=V,n[10]=Y,n[11]=j,n[12]=Z,n[13]=H,n[14]=X,n[15]=K,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n[9]=t[9]+e[9],n[10]=t[10]+e[10],n[11]=t[11]+e[11],n[12]=t[12]+e[12],n[13]=t[13]+e[13],n[14]=t[14]+e[14],n[15]=t[15]+e[15],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n[9]=t[9]-e[9],n[10]=t[10]-e[10],n[11]=t[11]-e[11],n[12]=t[12]-e[12],n[13]=t[13]-e[13],n[14]=t[14]-e[14],n[15]=t[15]-e[15],n},c.multiplyTransformation=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=t[12],d=t[13],m=t[14],y=e[0],p=e[1],v=e[2],w=e[4],E=e[5],x=e[6],g=e[8],S=e[9],M=e[10],O=e[12],_=e[13],z=e[14],T=r*y+o*p+c*v,I=i*y+u*p+l*v,N=a*y+s*p+f*v,R=r*w+o*E+c*x,b=i*w+u*E+l*x,A=a*w+s*E+f*x,P=r*g+o*S+c*M,C=i*g+u*S+l*M,L=a*g+s*S+f*M,q=r*O+o*_+c*z+h,U=i*O+u*_+l*z+d,D=a*O+s*_+f*z+m;return n[0]=T,n[1]=I,n[2]=N,n[3]=0,n[4]=R,n[5]=b,n[6]=A,n[7]=0,n[8]=P,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=D,n[15]=1,n},c.multiplyByMatrix3=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=e[0],d=e[1],m=e[2],y=e[3],p=e[4],v=e[5],w=e[6],E=e[7],x=e[8],g=r*h+o*d+c*m,S=i*h+u*d+l*m,M=a*h+s*d+f*m,O=r*y+o*p+c*v,_=i*y+u*p+l*v,z=a*y+s*p+f*v,T=r*w+o*E+c*x,I=i*w+u*E+l*x,N=a*w+s*E+f*x;return n[0]=g,n[1]=S,n[2]=M,n[3]=0,n[4]=O,n[5]=_,n[6]=z,n[7]=0,n[8]=T,n[9]=I,n[10]=N,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},c.multiplyByTranslation=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=r*t[0]+i*t[4]+a*t[8]+t[12],u=r*t[1]+i*t[5]+a*t[9]+t[13],s=r*t[2]+i*t[6]+a*t[10]+t[14];return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=o,n[13]=u,n[14]=s,n[15]=t[15],n};var y=new t;c.multiplyByUniformScale=function(t,e,n){return y.x=e,y.y=e,y.z=e,c.multiplyByScale(t,y,n)},c.multiplyByScale=function(t,e,n){var r=e.x,i=e.y,a=e.z;return 1===r&&1===i&&1===a?c.clone(t,n):(n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=0,n[4]=i*t[4],n[5]=i*t[5],n[6]=i*t[6],n[7]=0,n[8]=a*t[8],n[9]=a*t[9],n[10]=a*t[10],n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=1,n)},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t[0]*r+t[4]*i+t[8]*a+t[12]*o,s=t[1]*r+t[5]*i+t[9]*a+t[13]*o,c=t[2]*r+t[6]*i+t[10]*a+t[14]*o,l=t[3]*r+t[7]*i+t[11]*a+t[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a,u=t[1]*r+t[5]*i+t[9]*a,s=t[2]*r+t[6]*i+t[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a+t[12],u=t[1]*r+t[5]*i+t[9]*a+t[13],s=t[2]*r+t[6]*i+t[10]*a+t[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n[9]=t[9]*e,n[10]=t[10]*e,n[11]=t[11]*e,n[12]=t[12]*e,n[13]=t[13]*e,n[14]=t[14]*e,n[15]=t[15]*e,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},c.transpose=function(t,e){var n=t[1],r=t[2],i=t[3],a=t[6],o=t[7],u=t[11];return e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[10]=t[10],e[11]=t[14],e[12]=i,e[13]=o,e[14]=u,e[15]=t[15],e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e[9]=Math.abs(t[9]),e[10]=Math.abs(t[10]),e[11]=Math.abs(t[11]),e[12]=Math.abs(t[12]),e[13]=Math.abs(t[13]),e[14]=Math.abs(t[14]),e[15]=Math.abs(t[15]),e},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[3]===e[3]&&t[7]===e[7]&&t[11]===e[11]&&t[15]===e[15]},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n&&Math.abs(t[9]-e[9])<=n&&Math.abs(t[10]-e[10])<=n&&Math.abs(t[11]-e[11])<=n&&Math.abs(t[12]-e[12])<=n&&Math.abs(t[13]-e[13])<=n&&Math.abs(t[14]-e[14])<=n&&Math.abs(t[15]-e[15])<=n},c.getTranslation=function(t,e){return e.x=t[12],e.y=t[13],e.z=t[14],e},c.getRotation=function(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e};var p=new u,v=new u,w=new e,E=new e(0,0,0,1);return c.inverse=function(t,n){if(u.equalsEpsilon(c.getRotation(t,p),v,o.EPSILON7)&&e.equals(c.getRow(t,3,w),E))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-t[12],n[13]=-t[13],n[14]=-t[14],n[15]=1,n;var r=t[0],i=t[4],a=t[8],l=t[12],f=t[1],h=t[5],d=t[9],m=t[13],y=t[2],x=t[6],g=t[10],S=t[14],M=t[3],O=t[7],_=t[11],z=t[15],T=g*z,I=S*_,N=x*z,R=S*O,b=x*_,A=g*O,P=y*z,C=S*M,L=y*_,q=g*M,U=y*O,D=x*M,B=T*h+R*d+b*m-(I*h+N*d+A*m),F=I*f+P*d+q*m-(T*f+C*d+L*m),W=N*f+C*h+U*m-(R*f+P*h+D*m),G=A*f+L*h+D*d-(b*f+q*h+U*d),k=I*i+N*a+A*l-(T*i+R*a+b*l),V=T*r+C*a+L*l-(I*r+P*a+q*l),Y=R*r+P*i+D*l-(N*r+C*i+U*l),j=b*r+q*i+U*a-(A*r+L*i+D*a);T=a*m,I=l*d,N=i*m,R=l*h,b=i*d,A=a*h,P=r*m,C=l*f,L=r*d,q=a*f,U=r*h,D=i*f;var Z=T*O+R*_+b*z-(I*O+N*_+A*z),H=I*M+P*_+q*z-(T*M+C*_+L*z),X=N*M+C*O+U*z-(R*M+P*O+D*z),K=A*M+L*O+D*_-(b*M+q*O+U*_),J=N*g+A*S+I*x-(b*S+T*x+R*g),Q=L*S+T*y+C*g-(P*g+q*S+I*y),$=P*x+D*S+R*y-(U*S+N*y+C*x),te=U*g+b*y+q*x-(L*x+D*g+A*y),ee=r*B+i*F+a*W+l*G;if(Math.abs(ee)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return ee=1/ee,n[0]=B*ee,n[1]=F*ee,n[2]=W*ee,n[3]=G*ee,n[4]=k*ee,n[5]=V*ee,n[6]=Y*ee,n[7]=j*ee,n[8]=Z*ee,n[9]=H*ee,n[10]=X*ee,n[11]=K*ee,n[12]=J*ee,n[13]=Q*ee,n[14]=$*ee,n[15]=te*ee,n},c.inverseTransformation=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],u=t[6],s=t[8],c=t[9],l=t[10],f=t[12],h=t[13],d=t[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return e[0]=n,e[1]=a,e[2]=s,e[3]=0,e[4]=r,e[5]=o,e[6]=c,e[7]=0,e[8]=i,e[9]=u,e[10]=l,e[11]=0,e[12]=m,e[13]=y,e[14]=p,e[15]=1,e},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]&&t[9]===e[n+9]&&t[10]===e[n+10]&&t[11]===e[n+11]&&t[12]===e[n+12]&&t[13]===e[n+13]&&t[14]===e[n+14]&&t[15]===e[n+15]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e,n){this.normal=t.clone(e),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-t.dot(r,n);return e(a)?(t.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new t;return i.fromCartesian4=function(n,r){var o=t.fromCartesian4(n,a),u=n.w;return e(r)?(t.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(e,n){return t.dot(e.normal,n)+e.distance},i.ORIGIN_XY_PLANE=r(new i(t.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(t.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(t.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";var s=function(t,n,r,i){this.west=e(t,0),this.south=e(n,0),this.east=e(r,0),this.north=e(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(t,n,r){r=e(r,0),n[r++]=t.west,n[r++]=t.south,n[r++]=t.east,n[r]=t.north},s.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new s),i.west=t[r++],i.south=t[r++],i.east=t[r++],i.north=t[r],i},s.computeWidth=function(t){var e=t.east,n=t.west;return n>e&&(e+=u.TWO_PI),e-n},s.computeHeight=function(t){return t.north-t.south},s.fromDegrees=function(t,r,i,a,o){return t=u.toRadians(e(t,0)),r=u.toRadians(e(r,0)),i=u.toRadians(e(i,0)),a=u.toRadians(e(a,0)),n(o)?(o.west=t,o.south=r,o.east=i,o.north=a,o):new s(t,r,i,a)},s.fromCartographicArray=function(t,e){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=t.length;c>u;u++){var l=t[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(e)?(e.west=r,e.south=a,e.east=i,e.north=o,e):new s(r,a,i,o)},s.clone=function(t,e){return n(t)?n(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north):void 0},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||n(t)&&n(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return n(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(){},s.southwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.south,r.height=0,r):new t(e.west,e.south)},s.northwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.north,r.height=0,r):new t(e.west,e.north)},s.northeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.north,r.height=0,r):new t(e.east,e.north)},s.southeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.south,r.height=0,r):new t(e.east,e.south)},s.center=function(e,r){var i=e.east,a=e.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(e.south+e.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new t(o,s)},s.intersection=function(t,e,r){var i=t.east,a=t.west,o=e.east,c=e.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((t.west<t.east||e.west<e.east)&&l>=f)return void 0;var h=Math.max(t.south,e.south),d=Math.min(t.north,e.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(t,e){var n=e.longitude,r=e.latitude,i=t.west,a=t.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,r,i,o){r=e(r,a.WGS84),i=e(i,0),n(o)||(o=[]);var l=0,f=t.north,h=t.south,d=t.east,m=t.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(t,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,r){this.center=t.clone(n(e,t.ZERO)),this.radius=n(r,0)},m=new t,y=new t,p=new t,v=new t,w=new t,E=new t,x=new t,g=new t,S=new t,M=new t,O=new t,_=new t;d.fromPoints=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;for(var i=t.clone(e[0],x),a=t.clone(i,m),o=t.clone(i,y),u=t.clone(i,p),s=t.clone(i,v),c=t.clone(i,w),l=t.clone(i,E),f=e.length,h=1;f>h;h++){t.clone(e[h],i);var z=i.x,T=i.y,I=i.z;z<a.x&&t.clone(i,a),z>s.x&&t.clone(i,s),T<o.y&&t.clone(i,o),T>c.y&&t.clone(i,c),I<u.z&&t.clone(i,u),I>l.z&&t.clone(i,l)}var N=t.magnitudeSquared(t.subtract(s,a,g)),R=t.magnitudeSquared(t.subtract(c,o,g)),b=t.magnitudeSquared(t.subtract(l,u,g)),A=a,P=s,C=N;R>C&&(C=R,A=o,P=c),b>C&&(C=b,A=u,P=l);var L=S;L.x=.5*(A.x+P.x),L.y=.5*(A.y+P.y),L.z=.5*(A.z+P.z);var q=t.magnitudeSquared(t.subtract(P,L,g)),U=Math.sqrt(q),D=M;D.x=a.x,D.y=o.y,D.z=u.z;var B=O;B.x=s.x,B.y=c.y,B.z=l.z;var F=t.multiplyByScalar(t.add(D,B,g),.5,_),W=0;for(h=0;f>h;h++){t.clone(e[h],i);var G=t.magnitude(t.subtract(i,F,g));G>W&&(W=G);var k=t.magnitudeSquared(t.subtract(i,L,g));if(k>q){var V=Math.sqrt(k);U=.5*(U+V),q=U*U;var Y=V-U;L.x=(U*L.x+Y*i.x)/V,L.y=(U*L.y+Y*i.y)/V,L.z=(U*L.z+Y*i.z)/V}}return W>U?(t.clone(L,n.center),n.radius=U):(t.clone(F,n.center),n.radius=W),n};var z=new u,T=new t,I=new t,N=new e,R=new e;d.fromRectangle2D=function(t,e,n){return d.fromRectangleWithHeights2D(t,e,0,0,n)},d.fromRectangleWithHeights2D=function(e,i,a,o,u){if(r(u)||(u=new d),!r(e))return u.center=t.clone(t.ZERO,u.center),u.radius=0,u;i=n(i,z),h.southwest(e,N),N.height=a,h.northeast(e,R),R.height=o;var s=i.project(N,T),c=i.project(R,I),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var b=[];d.fromRectangle3D=function(t,e,i,a){e=n(e,o.WGS84),i=n(i,0);var u;return r(t)&&(u=h.subsample(t,e,i,b)),d.fromPoints(u,a)},d.fromVertices=function(e,i,a,o){if(r(o)||(o=new d),!r(e)||0===e.length)return o.center=t.clone(t.ZERO,o.center),o.radius=0,o;i=n(i,t.ZERO),a=n(a,3);var u=x;u.x=e[0]+i.x,u.y=e[1]+i.y,u.z=e[2]+i.z;for(var s=t.clone(u,m),c=t.clone(u,y),l=t.clone(u,p),f=t.clone(u,v),h=t.clone(u,w),z=t.clone(u,E),T=e.length,I=0;T>I;I+=a){var N=e[I]+i.x,R=e[I+1]+i.y,b=e[I+2]+i.z;u.x=N,u.y=R,u.z=b,N<s.x&&t.clone(u,s),N>f.x&&t.clone(u,f),R<c.y&&t.clone(u,c),R>h.y&&t.clone(u,h),b<l.z&&t.clone(u,l),b>z.z&&t.clone(u,z)}var A=t.magnitudeSquared(t.subtract(f,s,g)),P=t.magnitudeSquared(t.subtract(h,c,g)),C=t.magnitudeSquared(t.subtract(z,l,g)),L=s,q=f,U=A;P>U&&(U=P,L=c,q=h),C>U&&(U=C,L=l,q=z);var D=S;D.x=.5*(L.x+q.x),D.y=.5*(L.y+q.y),D.z=.5*(L.z+q.z);var B=t.magnitudeSquared(t.subtract(q,D,g)),F=Math.sqrt(B),W=M;W.x=s.x,W.y=c.y,W.z=l.z;var G=O;G.x=f.x,G.y=h.y,G.z=z.z;var k=t.multiplyByScalar(t.add(W,G,g),.5,_),V=0;for(I=0;T>I;I+=a){u.x=e[I]+i.x,u.y=e[I+1]+i.y,u.z=e[I+2]+i.z;var Y=t.magnitude(t.subtract(u,k,g));Y>V&&(V=Y);var j=t.magnitudeSquared(t.subtract(u,D,g));if(j>B){var Z=Math.sqrt(j);F=.5*(F+Z),B=F*F;var H=Z-F;D.x=(F*D.x+H*u.x)/Z,D.y=(F*D.y+H*u.y)/Z,D.z=(F*D.z+H*u.z)/Z}}return V>F?(t.clone(D,o.center),o.radius=F):(t.clone(k,o.center),o.radius=V),o},d.fromCornerPoints=function(e,n,i){r(i)||(i=new d);var a=i.center;return t.add(e,n,a),t.multiplyByScalar(a,.5,a),i.radius=t.distance(a,n),i},d.fromEllipsoid=function(e,n){return r(n)||(n=new d),t.clone(t.ZERO,n.center),n.radius=e.maximumRadius,n};var A=new t;d.fromBoundingSpheres=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var i=e.length;if(1===i)return d.clone(e[0],n);if(2===i)return d.union(e[0],e[1],n);for(var a=[],o=0;i>o;o++)a.push(e[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=e[o];s=Math.max(s,t.distance(u,c.center,A)+c.radius)}return n.radius=s,n},d.clone=function(e,n){return r(e)?r(n)?(n.center=t.clone(e.center,n.center),n.radius=e.radius,n):new d(e.center,e.radius):void 0},d.packedLength=4,d.pack=function(t,e,r){r=n(r,0);var i=t.center;e[r++]=i.x,e[r++]=i.y,e[r++]=i.z,e[r]=t.radius},d.unpack=function(t,e,i){e=n(e,0),r(i)||(i=new d);var a=i.center;return a.x=t[e++],a.y=t[e++],a.z=t[e++],i.radius=t[e],i};var P=new t,C=new t;d.union=function(e,n,i){r(i)||(i=new d);var a=e.center,o=e.radius,u=n.center,s=n.radius,c=t.subtract(u,a,P),l=t.magnitude(c);if(o>=l+s)return e.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=t.multiplyByScalar(c,(-o+f)/l,C);return t.add(h,a,h),t.clone(h,i.center),i.radius=f,i};var L=new t;d.expand=function(e,n,r){r=d.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new t,0);d.intersect=function(t,e){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(e,q);return d.intersectPlane(t,n)},d.transform=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=l.getMaximumScale(e)*t.radius,n};var U=new t;d.distanceSquaredTo=function(e,n){var r=t.subtract(e.center,n,U);return t.magnitudeSquared(r)-e.radius*e.radius},d.transformWithoutScale=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=t.radius,n};var D=new t;d.computePlaneDistances=function(e,n,i,a){r(a)||(a=new c);var o=t.subtract(e.center,n,D),u=t.multiplyByScalar(i,t.dot(i,o),D),s=t.magnitude(u);return a.start=s-e.radius,a.stop=s+e.radius,a};for(var B=new t,F=new t,W=new t,G=new t,k=new t,V=new e,Y=new Array(8),j=0;8>j;++j)Y[j]=new t;var Z=new u;return d.projectTo2D=function(e,r,i){r=n(r,Z);var a=r.ellipsoid,o=e.center,u=e.radius,s=a.geodeticSurfaceNormal(o,B),c=t.cross(t.UNIT_Z,s,F);t.normalize(c,c);var l=t.cross(s,c,W);t.normalize(l,l),t.multiplyByScalar(s,u,s),t.multiplyByScalar(l,u,l),t.multiplyByScalar(c,u,c);var f=t.negate(l,k),h=t.negate(c,G),m=Y,y=m[0];t.add(s,l,y),t.add(y,c,y),y=m[1],t.add(s,l,y),t.add(y,h,y),y=m[2],t.add(s,f,y),t.add(y,h,y),y=m[3],t.add(s,f,y),t.add(y,c,y),t.negate(s,s),y=m[4],t.add(s,l,y),t.add(y,c,y),y=m[5],t.add(s,l,y),t.add(y,h,y),y=m[6],t.add(s,f,y),t.add(y,h,y),y=m[7],t.add(s,f,y),t.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];t.add(o,w,w);var E=a.cartesianToCartographic(w,V);r.project(E,w)}i=d.fromPoints(m,i),o=i.center;var x=o.x,g=o.y,S=o.z;return o.x=S,o.y=x,o.z=g,i},d.equals=function(e,n){return e===n||r(e)&&r(n)&&t.equals(e.center,n.center)&&e.radius===n.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n){this.x=t(e,0),this.y=t(n,0)};a.fromElements=function(t,n,r){return e(r)?(r.x=t,r.y=n,r):new a(t,n)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n):new a(t.x,t.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r]=e.y},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y)},a.minimumComponent=function(t){return Math.min(t.x,t.y)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){return a.normalize(t,s),a.normalize(e,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Y,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)},a.ZERO=r(new a(0,0)),a.UNIT_X=r(new a(1,0)),a.UNIT_Y=r(new a(0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,e){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return e(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(t(n))return n;n=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof e[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof e[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",t(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",t(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",t(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",t(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(t){i.supportsFullscreen()&&t[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,e,n){"use strict";function r(t){for(var e=t.split("."),n=0,r=e.length;r>n;++n)e[n]=parseInt(e[n],10);return e}function i(){if(!e(p)){p=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(p=!0,v=r(t[1]))}return p}function a(){return i()&&v}function o(){if(!e(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(w=!0,E=r(t[1]))}return w}function u(){return o()&&E}function s(){if(!e(x)){x=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(x=!0,g=r(t[1]),g.isNightly=!!t[2])}return x}function c(){return s()&&g}function l(){if(!e(S)){S=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1])))}return S}function f(){return l()&&M}function h(){if(!e(O)){O=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(O=!0,_=r(t[1]))}return O}function d(){return e(z)||(z=/Windows/i.test(navigator.appVersion)),z}function m(){return h()&&_}function y(){return e(T)||(T=e(window.PointerEvent)&&(!e(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var p,v,w,E,x,g,S,M,O,_,z,T,I={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return I.supportsFullscreen=function(){return n.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,e,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(t){switch(t){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(t){return t instanceof Int8Array?a.BYTE:t instanceof Uint8Array?a.UNSIGNED_BYTE:t instanceof Int16Array?a.SHORT:t instanceof Uint16Array?a.UNSIGNED_SHORT:t instanceof Float32Array?a.FLOAT:t instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(t){return e(t)&&(t===a.BYTE||t===a.UNSIGNED_BYTE||t===a.SHORT||t===a.UNSIGNED_SHORT||t===a.FLOAT||t===a.DOUBLE)},a.createTypedArray=function(t,e){switch(t){case a.BYTE:return new Int8Array(e);case a.UNSIGNED_BYTE:return new Uint8Array(e);case a.SHORT:return new Int16Array(e);case a.UNSIGNED_SHORT:return new Uint16Array(e);case a.FLOAT:return new Float32Array(e);case a.DOUBLE:return new Float64Array(e);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(e,r,i,o){switch(i=t(i,0),o=t(o,(r.byteLength-i)/a.getSizeInBytes(e)),e){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/CylinderGeometryLibrary",["./Math"],function(t){"use strict";var e={};return e.computePositions=function(e,n,r,i,a){var o,u=.5*e,s=-u,c=i+i,l=a?2*c:c,f=new Float64Array(3*l),h=0,d=0,m=a?3*c:0,y=a?3*(c+i):3*i;for(o=0;i>o;o++){var p=o/i*t.TWO_PI,v=Math.cos(p),w=Math.sin(p),E=v*r,x=w*r,g=v*n,S=w*n;f[d+m]=E,f[d+m+1]=x,f[d+m+2]=s,f[d+y]=g,f[d+y+1]=S,f[d+y+2]=u,d+=3,a&&(f[h++]=E,f[h++]=x,f[h++]=s,f[h++]=g,f[h++]=S,f[h++]=u)}return f},e}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var e={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(e)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===e.POINTS||t===e.LINES||t===e.LINE_LOOP||t===e.LINE_STRIP||t===e.TRIANGLES||t===e.TRIANGLE_STRIP||t===e.TRIANGLE_FAN}};return t(e)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,e,n,r,i){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=t(e.primitiveType,i.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=t(e.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(t){var r=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&e(t.attributes[i])&&e(t.attributes[i].values)){var a=t.attributes[i],o=a.values.length/a.componentsPerAttribute; -if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=t(e.normalize,!1),this.values=e.values};return e}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color};return e}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(t){switch(t){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(e){return t(e)&&(e===i.UNSIGNED_BYTE||e===i.UNSIGNED_SHORT||e===i.UNSIGNED_INT)},i.createTypedArray=function(t,e){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e):new Uint16Array(e)},i.createTypedArrayFromArrayBuffer=function(t,e,n,i){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e,n,i):new Uint16Array(e,n,i)},n(i)}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e){e=t(e,t.EMPTY_OBJECT),this.position=t(e.position,!1),this.normal=t(e.normal,!1),this.st=t(e.st,!1),this.binormal=t(e.binormal,!1),this.tangent=t(e.tangent,!1),this.color=t(e.color,!1)};return i.POSITION_ONLY=r(new i({position:!0})),i.POSITION_AND_NORMAL=r(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=r(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=r(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=r(new i({position:!0,color:!0})),i.ALL=r(new i({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(e,n,r){r=t(r,0),n[r++]=e.position?1:0,n[r++]=e.normal?1:0,n[r++]=e.st?1:0,n[r++]=e.binormal?1:0,n[r++]=e.tangent?1:0,n[r++]=e.color?1:0},i.unpack=function(n,r,a){return r=t(r,0),e(a)||(a=new i),a.position=1===n[r++],a.normal=1===n[r++],a.st=1===n[r++],a.binormal=1===n[r++],a.tangent=1===n[r++],a.color=1===n[r++],a},i.clone=function(t,n){return e(t)?(e(n)||(n=new i),n.position=t.position,n.normal=t.normal,n.st=t.st,n.binormal=t.binormal,n.tangent=t.tangent,n.color=t.color,n):void 0},i}),define("Core/CylinderGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./CylinderGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./VertexFormat"],function(t,e,n,r,i,a,o,u,s,c,l,f,h,d,m){"use strict";var y=new e,p=new n,v=new n,w=new n,E=new n,x=function(t){t=a(t,a.EMPTY_OBJECT);var e=t.length,n=t.topRadius,r=t.bottomRadius,i=a(t.vertexFormat,m.DEFAULT),o=a(t.slices,128);this._length=e,this._topRadius=n,this._bottomRadius=r,this._vertexFormat=m.clone(i),this._slices=o,this._workerName="createCylinderGeometry"};x.packedLength=m.packedLength+4,x.pack=function(t,e,n){n=a(n,0),m.pack(t._vertexFormat,e,n),n+=m.packedLength,e[n++]=t._length,e[n++]=t._topRadius,e[n++]=t._bottomRadius,e[n]=t._slices};var g=new m,S={vertexFormat:g,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0};return x.unpack=function(t,e,n){e=a(e,0);var r=m.unpack(t,e,g);e+=m.packedLength;var i=t[e++],u=t[e++],s=t[e++],c=t[e];return o(n)?(n._vertexFormat=m.clone(r,n._vertexFormat),n._length=i,n._topRadius=u,n._bottomRadius=s,n._slices=c,n):(S.length=i,S.topRadius=u,S.bottomRadius=s,S.slices=c,new x(S))},x.createGeometry=function(a){var o,u=a._length,m=a._topRadius,x=a._bottomRadius,g=a._vertexFormat,S=a._slices,M=S+S,O=S+M,_=M+M,z=i.computePositions(u,m,x,S,!0),T=g.st?new Float32Array(2*_):void 0,I=g.normal?new Float32Array(3*_):void 0,N=g.tangent?new Float32Array(3*_):void 0,R=g.binormal?new Float32Array(3*_):void 0,b=g.normal||g.tangent||g.binormal;if(b){var A=g.tangent||g.binormal,P=0,C=0,L=0,q=p;q.z=0;var U=w,D=v;for(o=0;S>o;o++){var B=o/S*h.TWO_PI,F=Math.cos(B),W=Math.sin(B);b&&(q.x=F,q.y=W,A&&(U=n.normalize(n.cross(n.UNIT_Z,q,U),U)),g.normal&&(I[P++]=F,I[P++]=W,I[P++]=0,I[P++]=F,I[P++]=W,I[P++]=0),g.tangent&&(N[C++]=U.x,N[C++]=U.y,N[C++]=U.z,N[C++]=U.x,N[C++]=U.y,N[C++]=U.z),g.binormal&&(D=n.normalize(n.cross(q,U,D),D),R[L++]=D.x,R[L++]=D.y,R[L++]=D.z,R[L++]=D.x,R[L++]=D.y,R[L++]=D.z))}for(o=0;S>o;o++)g.normal&&(I[P++]=0,I[P++]=0,I[P++]=-1),g.tangent&&(N[C++]=1,N[C++]=0,N[C++]=0),g.binormal&&(R[L++]=0,R[L++]=-1,R[L++]=0);for(o=0;S>o;o++)g.normal&&(I[P++]=0,I[P++]=0,I[P++]=1),g.tangent&&(N[C++]=1,N[C++]=0,N[C++]=0),g.binormal&&(R[L++]=0,R[L++]=1,R[L++]=0)}var G=12*S-12,k=f.createTypedArray(_,G),V=0,Y=0;for(o=0;S-1>o;o++)k[V++]=Y,k[V++]=Y+2,k[V++]=Y+3,k[V++]=Y,k[V++]=Y+3,k[V++]=Y+1,Y+=2;for(k[V++]=M-2,k[V++]=0,k[V++]=1,k[V++]=M-2,k[V++]=1,k[V++]=M-1,o=1;S-1>o;o++)k[V++]=M+o+1,k[V++]=M+o,k[V++]=M;for(o=1;S-1>o;o++)k[V++]=O,k[V++]=O+o,k[V++]=O+o+1;var j=0;if(g.st){var Z=Math.max(m,x);for(o=0;_>o;o++){var H=n.fromArray(z,3*o,E);T[j++]=(H.x+Z)/(2*Z),T[j++]=(H.y+Z)/(2*Z)}}var X=new l;g.position&&(X.position=new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:z})),g.normal&&(X.normal=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:I})),g.tangent&&(X.tangent=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:N})),g.binormal&&(X.binormal=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:R})),g.st&&(X.st=new c({componentDatatype:r.FLOAT,componentsPerAttribute:2,values:T})),y.x=.5*u,y.y=Math.max(x,m);var K=new t(n.ZERO,e.magnitude(y));return new s({attributes:X,indices:k,primitiveType:d.TRIANGLES,boundingSphere:K})},x}),define("Workers/createCylinderGeometry",["../Core/CylinderGeometry","../Core/defined"],function(t,e){"use strict";return function(n,r){return e(r)&&(n=t.unpack(n,r)),t.createGeometry(n)}})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createCylinderOutlineGeometry.js b/libs/Cesium/Workers/createCylinderOutlineGeometry.js deleted file mode 100644 index 4fade954..00000000 --- a/libs/Cesium/Workers/createCylinderOutlineGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(t){return t>0?1:0>t?-1:0},n.signNotZero=function(t){return 0>t?-1:1},n.toSNorm=function(t){return Math.round(255*(.5*n.clamp(t,-1,1)+.5))},n.fromSNorm=function(t){return 2*(n.clamp(t,0,255)/255)-1},n.sinh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e-n)},n.cosh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e+n)},n.lerp=function(t,e,n){return(1-n)*t+n*e},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(t){return t*n.RADIANS_PER_DEGREE},n.toDegrees=function(t){return t*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(t){var e=n.TWO_PI,r=t-Math.floor(t/e)*e;return r<-Math.PI?r+e:r>=Math.PI?r-e:r},n.negativePiToPi=function(t){return n.zeroToTwoPi(t+n.PI)-n.PI},n.zeroToTwoPi=function(t){var e=n.mod(t,n.TWO_PI);return Math.abs(e)<n.EPSILON14&&Math.abs(t)>n.EPSILON14?n.TWO_PI:e},n.mod=function(t,e){return(t%e+e)%e},n.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return i>=a||a<=r*Math.max(Math.abs(t),Math.abs(n))};var r=[1];n.factorial=function(t){var e=r.length;if(t>=e)for(var n=r[e-1],i=e;t>=i;i++)r.push(n*i);return r[t]},n.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},n.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},n.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},n.clamp=function(t,e,n){return e>t?e:t>n?n:t};var i=new t;return n.setRandomNumberSeed=function(e){i=new t(e)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(t){return Math.acos(n.clamp(t,-1,1))},n.asinClamped=function(t){return Math.asin(n.clamp(t,-1,1))},n.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)};a.fromSpherical=function(n,r){e(r)||(r=new a);var i=n.clock,o=n.cone,u=t(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(t,n,r,i){return e(i)?(i.x=t,i.y=n,i.z=r,i):new a(t,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):n.y<=n.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)},a.cross=function(t,e,n){var r=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(t,e,n,r,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),e(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o++)r[o]=i.toRadians(t[o]);return a.fromRadiansArray(r,e,n)},a.fromRadiansArray=function(t,n,r){var i=t.length;e(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o+=3)r[o]=i.toRadians(t[o]),r[o+1]=i.toRadians(t[o+1]),r[o+2]=t[o+2];return a.fromRadiansArrayHeights(r,e,n)},a.fromRadiansArrayHeights=function(t,n,r){var i=t.length;e(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)};return a.fromRadians=function(n,r,i,o){return i=t(i,0),e(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(t,e,n,r){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},a.equalsEpsilon=function(t,n,r){return t===n||e(t)&&e(n)&&Math.abs(t.longitude-n.longitude)<=r&&Math.abs(t.latitude-n.latitude)<=r&&Math.abs(t.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var e={},n=function(n,r){t(e[n])||(e[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(e,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),e._radii=new t(r,i,a),e._radiiSquared=new t(r*r,i*i,a*a),e._radiiToTheFourth=new t(r*r*r*r,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(r,i,a),e._maximumRadius=Math.max(r,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,n){if(!r(e))return void 0;var i=e._radii;return r(n)?(t.clone(i,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return r(e)||(e=new c),r(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,r,i){i=n(i,0),t.pack(e._radii,r,i)},c.unpack=function(e,r,i){r=n(r,0);var a=t.unpack(e,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,n){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(e,n){return r(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;c.prototype.cartographicToCartesian=function(e,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),r(n)||(n=new t),t.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var h=new t,d=new t,m=new t;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=t.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(t.dot(s,n))*t.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new e(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,n){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),E=t.multiplyByScalar(e,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?t.clone(E,n):void 0;var x=this._oneOverRadiiSquared,g=x.x,M=x.y,S=x.z,O=p;O.x=2*E.x*g,O.y=2*E.y*M,O.z=2*E.z*S;var z,_,T,R,I,N,b,P,A,C,L,q=(1-w)*t.magnitude(e)/(.5*t.magnitude(O)),U=0;do{q-=U,T=1/(1+q*g),R=1/(1+q*M),I=1/(1+q*S),N=T*T,b=R*R,P=I*I,A=N*T,C=b*R,L=P*I,z=h*N+d*b+m*P-1,_=h*A*g+d*C*M+m*L*S;var B=-2*_;U=z/B}while(Math.abs(z)>u.EPSILON12);return r(n)?(n.x=i*T,n.y=a*R,n.z=o*I,n):new t(i*T,a*R,o*I)},c.prototype.scaleToGeocentricSurface=function(e,n){r(n)||(n=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,n)},c.prototype.transformPositionToScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._radii,n)},c.prototype.equals=function(e){return this===e||r(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";var u=function(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var e={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(e)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var e=function(e,n){this.start=t(e,0),this.stop=t(n,0)};return e}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)};a.fromElements=function(t,n,r,i,o){return e(o)?(o.x=t,o.y=n,o.z=r,o.w=i,o):new a(t,n,r,i)},a.fromColor=function(t,n){return e(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new a(t.red,t.green,t.blue,t.alpha)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new a(t.x,t.y,t.z,t.w):void 0},a.packedLength=4,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n.w=Math.min(t.w,e.w),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n.w=Math.max(t.w,e.w),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e.w=t.w/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n.w=t.w*e.w,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n.w=t.w+e.w,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n.w=t.w-e.w,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n.w=t.w*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n.w=t.w/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e.w=Math.abs(t.w),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,s);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]&&t.w===e[n+3]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)&&i.equalsEpsilon(t.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t){for(var e=0,n=0;9>n;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function u(t){for(var e=0,n=0;3>n;++n){var r=t[c.getElementIndex(d[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function s(t,e){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(t[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(t[c.getElementIndex(m,f)])>n){var y,p=t[c.getElementIndex(m,m)],v=t[c.getElementIndex(f,f)],w=t[c.getElementIndex(m,f)],E=(p-v)/2/w;y=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),s=1/Math.sqrt(1+y*y),l=y*s}return e=c.clone(c.IDENTITY,e),e[c.getElementIndex(f,f)]=e[c.getElementIndex(m,m)]=s,e[c.getElementIndex(m,f)]=l,e[c.getElementIndex(f,m)]=-l,e}var c=function(t,n,r,i,a,o,u,s,c){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(u,0),this[3]=e(n,0),this[4]=e(a,0),this[5]=e(s,0),this[6]=e(r,0),this[7]=e(o,0),this[8]=e(c,0)};c.packedLength=9,c.pack=function(t,n,r){r=e(r,0),n[r++]=t[0],n[r++]=t[1],n[r++]=t[2],n[r++]=t[3],n[r++]=t[4],n[r++]=t[5],n[r++]=t[6],n[r++]=t[7],n[r++]=t[8]},c.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r++],i[1]=t[r++],i[2]=t[r++],i[3]=t[r++],i[4]=t[r++],i[5]=t[r++],i[6]=t[r++],i[7]=t[r++],i[8]=t[r++],i},c.clone=function(t,e){return n(t)?n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new c(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},c.fromArray=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r],i[1]=t[r+1],i[2]=t[r+2],i[3]=t[r+3],i[4]=t[r+4],i[5]=t[r+5],i[6]=t[r+6],i[7]=t[r+7],i[8]=t[r+8],i},c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},c.fromQuaternion=function(t,e){var r=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,s=t.y*t.z,l=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,E=2*(s-o),x=2*(a-l),g=2*(s+o),M=-r-u+f+d;return n(e)?(e[0]=m,e[1]=v,e[2]=x,e[3]=y,e[4]=w,e[5]=g,e[6]=p,e[7]=E,e[8]=M,e):new c(m,y,p,v,w,E,x,g,M)},c.fromScale=function(t,e){return n(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new c(t.x,0,0,0,t.y,0,0,0,t.z)},c.fromUniformScale=function(t,e){return n(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new c(t,0,0,0,t,0,0,0,t)},c.fromCrossProduct=function(t,e){return n(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new c(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},c.fromRotationX=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=r,e[5]=i,e[6]=0,e[7]=-i,e[8]=r,e):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=r,e):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},c.getElementIndex=function(t,e){return 3*t+e},c.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;c.getMaximumScale=function(e){return c.getScale(e,f),t.maximumComponent(f)},c.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],l=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],f=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},c.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},c.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],l=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=l,e};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(t,e){var r=a.EPSILON20,i=10,l=0,f=0;n(e)||(e={});for(var h=e.unitary=c.clone(c.IDENTITY,e.unitary),d=e.diagonal=c.clone(t,e.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},c.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(t,e){var n=t[0],i=t[1],o=t[2],u=t[3],s=t[4],l=t[5],f=t[6],h=t[7],d=t[8],m=c.determinant(t);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");e[0]=s*d-h*l,e[1]=h*o-i*d,e[2]=i*l-s*o,e[3]=f*l-u*d,e[4]=n*d-f*o,e[5]=u*o-n*l,e[6]=u*h-f*s,e[7]=f*i-n*h,e[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(e,y,e)},c.equals=function(t,e){return t===e||n(t)&&n(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},c.equalsEpsilon=function(t,e,r){return t===e||n(t)&&n(e)&&Math.abs(t[0]-e[0])<=r&&Math.abs(t[1]-e[1])<=r&&Math.abs(t[2]-e[2])<=r&&Math.abs(t[3]-e[3])<=r&&Math.abs(t[4]-e[4])<=r&&Math.abs(t[5]-e[5])<=r&&Math.abs(t[6]-e[6])<=r&&Math.abs(t[7]-e[7])<=r&&Math.abs(t[8]-e[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var e=function(t){this.name="RuntimeError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,e,n,r,i,a,o,u,s){"use strict";var c=function(t,e,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(t,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(e,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(t,e,r){r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e[r++]=t[9],e[r++]=t[10],e[r++]=t[11],e[r++]=t[12],e[r++]=t[13],e[r++]=t[14],e[r]=t[15]},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},c.clone=function(t,e){return r(t)?r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):new c(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},c.fromRotationTranslation=function(e,i,a){return i=n(i,t.ZERO),r(a)?(a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=0,a[4]=e[3],a[5]=e[4],a[6]=e[5],a[7]=0,a[8]=e[6],a[9]=e[7],a[10]=e[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(e[0],e[3],e[6],i.x,e[1],e[4],e[7],i.y,e[2],e[5],e[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(t,e,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=e.x*e.x,l=e.x*e.y,f=e.x*e.z,h=e.x*e.w,d=e.y*e.y,m=e.y*e.z,y=e.y*e.w,p=e.z*e.z,v=e.z*e.w,w=e.w*e.w,E=s-d-p+w,x=2*(l-v),g=2*(f+y),M=2*(l+v),S=-s+d-p+w,O=2*(m-h),z=2*(f-y),_=2*(m+h),T=-s-d+p+w;return i[0]=E*a,i[1]=M*a,i[2]=z*a,i[3]=0,i[4]=x*o,i[5]=S*o,i[6]=_*o,i[7]=0,i[8]=g*u,i[9]=O*u,i[10]=T*u,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i},c.fromTranslation=function(t,e){return c.fromRotationTranslation(u.IDENTITY,t,e)},c.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},c.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var l=new t,f=new t,h=new t;c.fromCamera=function(e,n){var i=e.eye,a=e.target,o=e.up;t.normalize(t.subtract(a,i,l),l),t.normalize(t.cross(l,o,f),f),t.normalize(t.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,E=h.z,x=i.x,g=i.y,M=i.z,S=u*-x+s*-g+d*-M,O=v*-x+w*-g+E*-M,z=m*x+y*g+p*M;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=E,n[10]=-p,n[11]=0,n[12]=S,n[13]=O,n[14]=z,n[15]=1,n):new c(u,s,d,S,v,w,E,O,-m,-y,-p,z,0,0,0,1)},c.computePerspectiveFieldOfView=function(t,e,n,r,i){var a=Math.tan(.5*t),o=1/a,u=o/e,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(t,e,n,r,i,a,o){var u=1/(e-t),s=1/(r-n),c=1/(a-i),l=-(e+t)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(t,e,n,r,i,a,o){var u=2*i/(e-t),s=2*i/(r-n),c=(e+t)/(e-t),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(t,e,n,r,i,a){var o=2*i/(e-t),u=2*i/(r-n),s=(e+t)/(e-t),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(t,e,r,i){t=n(t,n.EMPTY_OBJECT);var a=n(t.x,0),o=n(t.y,0),u=n(t.width,0),s=n(t.height,0);e=n(e,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-e),h=c,d=l,m=f,y=a+c,p=o+l,v=e+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},c.getElementIndex=function(t,e){return 4*t+e},c.getColumn=function(t,e,n){var r=4*e,i=t[r],a=t[r+1],o=t[r+2],u=t[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=4*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=t[15],n},c.getRow=function(t,e,n){var r=t[e],i=t[e+4],a=t[e+8],o=t[e+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+4]=n.y,r[e+8]=n.z,r[e+12]=n.w,r};var d=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],d)),n.y=t.magnitude(t.fromElements(e[4],e[5],e[6],d)),n.z=t.magnitude(t.fromElements(e[8],e[9],e[10],d)),n};var m=new t;c.getMaximumScale=function(e){return c.getScale(e,m),t.maximumComponent(m)},c.multiply=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[3],u=t[4],s=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],p=t[13],v=t[14],w=t[15],E=e[0],x=e[1],g=e[2],M=e[3],S=e[4],O=e[5],z=e[6],_=e[7],T=e[8],R=e[9],I=e[10],N=e[11],b=e[12],P=e[13],A=e[14],C=e[15],L=r*E+u*x+f*g+y*M,q=i*E+s*x+h*g+p*M,U=a*E+c*x+d*g+v*M,B=o*E+l*x+m*g+w*M,D=r*S+u*O+f*z+y*_,W=i*S+s*O+h*z+p*_,F=a*S+c*O+d*z+v*_,G=o*S+l*O+m*z+w*_,V=r*T+u*R+f*I+y*N,k=i*T+s*R+h*I+p*N,Y=a*T+c*R+d*I+v*N,j=o*T+l*R+m*I+w*N,Z=r*b+u*P+f*A+y*C,H=i*b+s*P+h*A+p*C,X=a*b+c*P+d*A+v*C,K=o*b+l*P+m*A+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=B,n[4]=D,n[5]=W,n[6]=F,n[7]=G,n[8]=V,n[9]=k,n[10]=Y,n[11]=j,n[12]=Z,n[13]=H,n[14]=X,n[15]=K,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n[9]=t[9]+e[9],n[10]=t[10]+e[10],n[11]=t[11]+e[11],n[12]=t[12]+e[12],n[13]=t[13]+e[13],n[14]=t[14]+e[14],n[15]=t[15]+e[15],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n[9]=t[9]-e[9],n[10]=t[10]-e[10],n[11]=t[11]-e[11],n[12]=t[12]-e[12],n[13]=t[13]-e[13],n[14]=t[14]-e[14],n[15]=t[15]-e[15],n},c.multiplyTransformation=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=t[12],d=t[13],m=t[14],y=e[0],p=e[1],v=e[2],w=e[4],E=e[5],x=e[6],g=e[8],M=e[9],S=e[10],O=e[12],z=e[13],_=e[14],T=r*y+o*p+c*v,R=i*y+u*p+l*v,I=a*y+s*p+f*v,N=r*w+o*E+c*x,b=i*w+u*E+l*x,P=a*w+s*E+f*x,A=r*g+o*M+c*S,C=i*g+u*M+l*S,L=a*g+s*M+f*S,q=r*O+o*z+c*_+h,U=i*O+u*z+l*_+d,B=a*O+s*z+f*_+m;return n[0]=T,n[1]=R,n[2]=I,n[3]=0,n[4]=N,n[5]=b,n[6]=P,n[7]=0,n[8]=A,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=B,n[15]=1,n},c.multiplyByMatrix3=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=e[0],d=e[1],m=e[2],y=e[3],p=e[4],v=e[5],w=e[6],E=e[7],x=e[8],g=r*h+o*d+c*m,M=i*h+u*d+l*m,S=a*h+s*d+f*m,O=r*y+o*p+c*v,z=i*y+u*p+l*v,_=a*y+s*p+f*v,T=r*w+o*E+c*x,R=i*w+u*E+l*x,I=a*w+s*E+f*x;return n[0]=g,n[1]=M,n[2]=S,n[3]=0,n[4]=O,n[5]=z,n[6]=_,n[7]=0,n[8]=T,n[9]=R,n[10]=I,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},c.multiplyByTranslation=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=r*t[0]+i*t[4]+a*t[8]+t[12],u=r*t[1]+i*t[5]+a*t[9]+t[13],s=r*t[2]+i*t[6]+a*t[10]+t[14];return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=o,n[13]=u,n[14]=s,n[15]=t[15],n};var y=new t;c.multiplyByUniformScale=function(t,e,n){return y.x=e,y.y=e,y.z=e,c.multiplyByScale(t,y,n)},c.multiplyByScale=function(t,e,n){var r=e.x,i=e.y,a=e.z;return 1===r&&1===i&&1===a?c.clone(t,n):(n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=0,n[4]=i*t[4],n[5]=i*t[5],n[6]=i*t[6],n[7]=0,n[8]=a*t[8],n[9]=a*t[9],n[10]=a*t[10],n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=1,n)},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t[0]*r+t[4]*i+t[8]*a+t[12]*o,s=t[1]*r+t[5]*i+t[9]*a+t[13]*o,c=t[2]*r+t[6]*i+t[10]*a+t[14]*o,l=t[3]*r+t[7]*i+t[11]*a+t[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a,u=t[1]*r+t[5]*i+t[9]*a,s=t[2]*r+t[6]*i+t[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a+t[12],u=t[1]*r+t[5]*i+t[9]*a+t[13],s=t[2]*r+t[6]*i+t[10]*a+t[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n[9]=t[9]*e,n[10]=t[10]*e,n[11]=t[11]*e,n[12]=t[12]*e,n[13]=t[13]*e,n[14]=t[14]*e,n[15]=t[15]*e,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},c.transpose=function(t,e){var n=t[1],r=t[2],i=t[3],a=t[6],o=t[7],u=t[11];return e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[10]=t[10],e[11]=t[14],e[12]=i,e[13]=o,e[14]=u,e[15]=t[15],e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e[9]=Math.abs(t[9]),e[10]=Math.abs(t[10]),e[11]=Math.abs(t[11]),e[12]=Math.abs(t[12]),e[13]=Math.abs(t[13]),e[14]=Math.abs(t[14]),e[15]=Math.abs(t[15]),e},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[3]===e[3]&&t[7]===e[7]&&t[11]===e[11]&&t[15]===e[15]},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n&&Math.abs(t[9]-e[9])<=n&&Math.abs(t[10]-e[10])<=n&&Math.abs(t[11]-e[11])<=n&&Math.abs(t[12]-e[12])<=n&&Math.abs(t[13]-e[13])<=n&&Math.abs(t[14]-e[14])<=n&&Math.abs(t[15]-e[15])<=n},c.getTranslation=function(t,e){return e.x=t[12],e.y=t[13],e.z=t[14],e},c.getRotation=function(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e};var p=new u,v=new u,w=new e,E=new e(0,0,0,1);return c.inverse=function(t,n){if(u.equalsEpsilon(c.getRotation(t,p),v,o.EPSILON7)&&e.equals(c.getRow(t,3,w),E))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-t[12],n[13]=-t[13],n[14]=-t[14],n[15]=1,n;var r=t[0],i=t[4],a=t[8],l=t[12],f=t[1],h=t[5],d=t[9],m=t[13],y=t[2],x=t[6],g=t[10],M=t[14],S=t[3],O=t[7],z=t[11],_=t[15],T=g*_,R=M*z,I=x*_,N=M*O,b=x*z,P=g*O,A=y*_,C=M*S,L=y*z,q=g*S,U=y*O,B=x*S,D=T*h+N*d+b*m-(R*h+I*d+P*m),W=R*f+A*d+q*m-(T*f+C*d+L*m),F=I*f+C*h+U*m-(N*f+A*h+B*m),G=P*f+L*h+B*d-(b*f+q*h+U*d),V=R*i+I*a+P*l-(T*i+N*a+b*l),k=T*r+C*a+L*l-(R*r+A*a+q*l),Y=N*r+A*i+B*l-(I*r+C*i+U*l),j=b*r+q*i+U*a-(P*r+L*i+B*a);T=a*m,R=l*d,I=i*m,N=l*h,b=i*d,P=a*h,A=r*m,C=l*f,L=r*d,q=a*f,U=r*h,B=i*f;var Z=T*O+N*z+b*_-(R*O+I*z+P*_),H=R*S+A*z+q*_-(T*S+C*z+L*_),X=I*S+C*O+U*_-(N*S+A*O+B*_),K=P*S+L*O+B*z-(b*S+q*O+U*z),J=I*g+P*M+R*x-(b*M+T*x+N*g),Q=L*M+T*y+C*g-(A*g+q*M+R*y),$=A*x+B*M+N*y-(U*M+I*y+C*x),te=U*g+b*y+q*x-(L*x+B*g+P*y),ee=r*D+i*W+a*F+l*G;if(Math.abs(ee)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return ee=1/ee,n[0]=D*ee,n[1]=W*ee,n[2]=F*ee,n[3]=G*ee,n[4]=V*ee,n[5]=k*ee,n[6]=Y*ee,n[7]=j*ee,n[8]=Z*ee,n[9]=H*ee,n[10]=X*ee,n[11]=K*ee,n[12]=J*ee,n[13]=Q*ee,n[14]=$*ee,n[15]=te*ee,n},c.inverseTransformation=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],u=t[6],s=t[8],c=t[9],l=t[10],f=t[12],h=t[13],d=t[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return e[0]=n,e[1]=a,e[2]=s,e[3]=0,e[4]=r,e[5]=o,e[6]=c,e[7]=0,e[8]=i,e[9]=u,e[10]=l,e[11]=0,e[12]=m,e[13]=y,e[14]=p,e[15]=1,e},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]&&t[9]===e[n+9]&&t[10]===e[n+10]&&t[11]===e[n+11]&&t[12]===e[n+12]&&t[13]===e[n+13]&&t[14]===e[n+14]&&t[15]===e[n+15]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e,n){this.normal=t.clone(e),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-t.dot(r,n);return e(a)?(t.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new t;return i.fromCartesian4=function(n,r){var o=t.fromCartesian4(n,a),u=n.w;return e(r)?(t.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(e,n){return t.dot(e.normal,n)+e.distance},i.ORIGIN_XY_PLANE=r(new i(t.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(t.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(t.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";var s=function(t,n,r,i){this.west=e(t,0),this.south=e(n,0),this.east=e(r,0),this.north=e(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(t,n,r){r=e(r,0),n[r++]=t.west,n[r++]=t.south,n[r++]=t.east,n[r]=t.north},s.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new s),i.west=t[r++],i.south=t[r++],i.east=t[r++],i.north=t[r],i},s.computeWidth=function(t){var e=t.east,n=t.west;return n>e&&(e+=u.TWO_PI),e-n},s.computeHeight=function(t){return t.north-t.south},s.fromDegrees=function(t,r,i,a,o){return t=u.toRadians(e(t,0)),r=u.toRadians(e(r,0)),i=u.toRadians(e(i,0)),a=u.toRadians(e(a,0)),n(o)?(o.west=t,o.south=r,o.east=i,o.north=a,o):new s(t,r,i,a)},s.fromCartographicArray=function(t,e){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=t.length;c>u;u++){var l=t[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(e)?(e.west=r,e.south=a,e.east=i,e.north=o,e):new s(r,a,i,o)},s.clone=function(t,e){return n(t)?n(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north):void 0},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||n(t)&&n(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return n(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(){},s.southwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.south,r.height=0,r):new t(e.west,e.south)},s.northwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.north,r.height=0,r):new t(e.west,e.north)},s.northeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.north,r.height=0,r):new t(e.east,e.north)},s.southeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.south,r.height=0,r):new t(e.east,e.south)},s.center=function(e,r){var i=e.east,a=e.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(e.south+e.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new t(o,s)},s.intersection=function(t,e,r){var i=t.east,a=t.west,o=e.east,c=e.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((t.west<t.east||e.west<e.east)&&l>=f)return void 0;var h=Math.max(t.south,e.south),d=Math.min(t.north,e.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(t,e){var n=e.longitude,r=e.latitude,i=t.west,a=t.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,r,i,o){r=e(r,a.WGS84),i=e(i,0),n(o)||(o=[]);var l=0,f=t.north,h=t.south,d=t.east,m=t.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(t,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,r){this.center=t.clone(n(e,t.ZERO)),this.radius=n(r,0)},m=new t,y=new t,p=new t,v=new t,w=new t,E=new t,x=new t,g=new t,M=new t,S=new t,O=new t,z=new t;d.fromPoints=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;for(var i=t.clone(e[0],x),a=t.clone(i,m),o=t.clone(i,y),u=t.clone(i,p),s=t.clone(i,v),c=t.clone(i,w),l=t.clone(i,E),f=e.length,h=1;f>h;h++){t.clone(e[h],i);var _=i.x,T=i.y,R=i.z;_<a.x&&t.clone(i,a),_>s.x&&t.clone(i,s),T<o.y&&t.clone(i,o),T>c.y&&t.clone(i,c),R<u.z&&t.clone(i,u),R>l.z&&t.clone(i,l)}var I=t.magnitudeSquared(t.subtract(s,a,g)),N=t.magnitudeSquared(t.subtract(c,o,g)),b=t.magnitudeSquared(t.subtract(l,u,g)),P=a,A=s,C=I;N>C&&(C=N,P=o,A=c),b>C&&(C=b,P=u,A=l);var L=M;L.x=.5*(P.x+A.x),L.y=.5*(P.y+A.y),L.z=.5*(P.z+A.z);var q=t.magnitudeSquared(t.subtract(A,L,g)),U=Math.sqrt(q),B=S;B.x=a.x,B.y=o.y,B.z=u.z;var D=O;D.x=s.x,D.y=c.y,D.z=l.z;var W=t.multiplyByScalar(t.add(B,D,g),.5,z),F=0;for(h=0;f>h;h++){t.clone(e[h],i);var G=t.magnitude(t.subtract(i,W,g));G>F&&(F=G);var V=t.magnitudeSquared(t.subtract(i,L,g));if(V>q){var k=Math.sqrt(V);U=.5*(U+k),q=U*U;var Y=k-U;L.x=(U*L.x+Y*i.x)/k,L.y=(U*L.y+Y*i.y)/k,L.z=(U*L.z+Y*i.z)/k}}return F>U?(t.clone(L,n.center),n.radius=U):(t.clone(W,n.center),n.radius=F),n};var _=new u,T=new t,R=new t,I=new e,N=new e;d.fromRectangle2D=function(t,e,n){return d.fromRectangleWithHeights2D(t,e,0,0,n)},d.fromRectangleWithHeights2D=function(e,i,a,o,u){if(r(u)||(u=new d),!r(e))return u.center=t.clone(t.ZERO,u.center),u.radius=0,u;i=n(i,_),h.southwest(e,I),I.height=a,h.northeast(e,N),N.height=o;var s=i.project(I,T),c=i.project(N,R),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var b=[];d.fromRectangle3D=function(t,e,i,a){e=n(e,o.WGS84),i=n(i,0);var u;return r(t)&&(u=h.subsample(t,e,i,b)),d.fromPoints(u,a)},d.fromVertices=function(e,i,a,o){if(r(o)||(o=new d),!r(e)||0===e.length)return o.center=t.clone(t.ZERO,o.center),o.radius=0,o;i=n(i,t.ZERO),a=n(a,3);var u=x;u.x=e[0]+i.x,u.y=e[1]+i.y,u.z=e[2]+i.z;for(var s=t.clone(u,m),c=t.clone(u,y),l=t.clone(u,p),f=t.clone(u,v),h=t.clone(u,w),_=t.clone(u,E),T=e.length,R=0;T>R;R+=a){var I=e[R]+i.x,N=e[R+1]+i.y,b=e[R+2]+i.z;u.x=I,u.y=N,u.z=b,I<s.x&&t.clone(u,s),I>f.x&&t.clone(u,f),N<c.y&&t.clone(u,c),N>h.y&&t.clone(u,h),b<l.z&&t.clone(u,l),b>_.z&&t.clone(u,_)}var P=t.magnitudeSquared(t.subtract(f,s,g)),A=t.magnitudeSquared(t.subtract(h,c,g)),C=t.magnitudeSquared(t.subtract(_,l,g)),L=s,q=f,U=P;A>U&&(U=A,L=c,q=h),C>U&&(U=C,L=l,q=_);var B=M;B.x=.5*(L.x+q.x),B.y=.5*(L.y+q.y),B.z=.5*(L.z+q.z);var D=t.magnitudeSquared(t.subtract(q,B,g)),W=Math.sqrt(D),F=S;F.x=s.x,F.y=c.y,F.z=l.z;var G=O;G.x=f.x,G.y=h.y,G.z=_.z;var V=t.multiplyByScalar(t.add(F,G,g),.5,z),k=0;for(R=0;T>R;R+=a){u.x=e[R]+i.x,u.y=e[R+1]+i.y,u.z=e[R+2]+i.z;var Y=t.magnitude(t.subtract(u,V,g));Y>k&&(k=Y);var j=t.magnitudeSquared(t.subtract(u,B,g));if(j>D){var Z=Math.sqrt(j);W=.5*(W+Z),D=W*W;var H=Z-W;B.x=(W*B.x+H*u.x)/Z,B.y=(W*B.y+H*u.y)/Z,B.z=(W*B.z+H*u.z)/Z}}return k>W?(t.clone(B,o.center),o.radius=W):(t.clone(V,o.center),o.radius=k),o},d.fromCornerPoints=function(e,n,i){r(i)||(i=new d);var a=i.center;return t.add(e,n,a),t.multiplyByScalar(a,.5,a),i.radius=t.distance(a,n),i},d.fromEllipsoid=function(e,n){return r(n)||(n=new d),t.clone(t.ZERO,n.center),n.radius=e.maximumRadius,n};var P=new t;d.fromBoundingSpheres=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var i=e.length;if(1===i)return d.clone(e[0],n);if(2===i)return d.union(e[0],e[1],n);for(var a=[],o=0;i>o;o++)a.push(e[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=e[o];s=Math.max(s,t.distance(u,c.center,P)+c.radius)}return n.radius=s,n},d.clone=function(e,n){return r(e)?r(n)?(n.center=t.clone(e.center,n.center),n.radius=e.radius,n):new d(e.center,e.radius):void 0},d.packedLength=4,d.pack=function(t,e,r){r=n(r,0);var i=t.center;e[r++]=i.x,e[r++]=i.y,e[r++]=i.z,e[r]=t.radius},d.unpack=function(t,e,i){e=n(e,0),r(i)||(i=new d);var a=i.center;return a.x=t[e++],a.y=t[e++],a.z=t[e++],i.radius=t[e],i};var A=new t,C=new t;d.union=function(e,n,i){r(i)||(i=new d);var a=e.center,o=e.radius,u=n.center,s=n.radius,c=t.subtract(u,a,A),l=t.magnitude(c);if(o>=l+s)return e.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=t.multiplyByScalar(c,(-o+f)/l,C);return t.add(h,a,h),t.clone(h,i.center),i.radius=f,i};var L=new t;d.expand=function(e,n,r){r=d.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new t,0);d.intersect=function(t,e){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(e,q);return d.intersectPlane(t,n)},d.transform=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=l.getMaximumScale(e)*t.radius,n};var U=new t;d.distanceSquaredTo=function(e,n){var r=t.subtract(e.center,n,U);return t.magnitudeSquared(r)-e.radius*e.radius},d.transformWithoutScale=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=t.radius,n};var B=new t;d.computePlaneDistances=function(e,n,i,a){r(a)||(a=new c);var o=t.subtract(e.center,n,B),u=t.multiplyByScalar(i,t.dot(i,o),B),s=t.magnitude(u);return a.start=s-e.radius,a.stop=s+e.radius,a};for(var D=new t,W=new t,F=new t,G=new t,V=new t,k=new e,Y=new Array(8),j=0;8>j;++j)Y[j]=new t;var Z=new u;return d.projectTo2D=function(e,r,i){r=n(r,Z);var a=r.ellipsoid,o=e.center,u=e.radius,s=a.geodeticSurfaceNormal(o,D),c=t.cross(t.UNIT_Z,s,W);t.normalize(c,c);var l=t.cross(s,c,F);t.normalize(l,l),t.multiplyByScalar(s,u,s),t.multiplyByScalar(l,u,l),t.multiplyByScalar(c,u,c);var f=t.negate(l,V),h=t.negate(c,G),m=Y,y=m[0];t.add(s,l,y),t.add(y,c,y),y=m[1],t.add(s,l,y),t.add(y,h,y),y=m[2],t.add(s,f,y),t.add(y,h,y),y=m[3],t.add(s,f,y),t.add(y,c,y),t.negate(s,s),y=m[4],t.add(s,l,y),t.add(y,c,y),y=m[5],t.add(s,l,y),t.add(y,h,y),y=m[6],t.add(s,f,y),t.add(y,h,y),y=m[7],t.add(s,f,y),t.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];t.add(o,w,w);var E=a.cartesianToCartographic(w,k);r.project(E,w)}i=d.fromPoints(m,i),o=i.center;var x=o.x,g=o.y,M=o.z;return o.x=M,o.y=x,o.z=g,i},d.equals=function(e,n){return e===n||r(e)&&r(n)&&t.equals(e.center,n.center)&&e.radius===n.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n){this.x=t(e,0),this.y=t(n,0)};a.fromElements=function(t,n,r){return e(r)?(r.x=t,r.y=n,r):new a(t,n)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n):new a(t.x,t.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r]=e.y},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y)},a.minimumComponent=function(t){return Math.min(t.x,t.y)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){return a.normalize(t,s),a.normalize(e,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Y,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)},a.ZERO=r(new a(0,0)),a.UNIT_X=r(new a(1,0)),a.UNIT_Y=r(new a(0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,e){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return e(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(t(n))return n;n=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof e[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof e[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",t(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",t(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",t(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",t(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(t){i.supportsFullscreen()&&t[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,e,n){"use strict";function r(t){for(var e=t.split("."),n=0,r=e.length;r>n;++n)e[n]=parseInt(e[n],10);return e}function i(){if(!e(p)){p=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(p=!0,v=r(t[1]))}return p}function a(){return i()&&v}function o(){if(!e(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(w=!0,E=r(t[1]))}return w}function u(){return o()&&E}function s(){if(!e(x)){x=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(x=!0,g=r(t[1]),g.isNightly=!!t[2])}return x}function c(){return s()&&g}function l(){if(!e(M)){M=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(M=!0,S=r(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(M=!0,S=r(t[1])))}return M}function f(){return l()&&S}function h(){if(!e(O)){O=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(O=!0,z=r(t[1]))}return O}function d(){return e(_)||(_=/Windows/i.test(navigator.appVersion)),_}function m(){return h()&&z}function y(){return e(T)||(T=e(window.PointerEvent)&&(!e(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var p,v,w,E,x,g,M,S,O,z,_,T,R={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return R.supportsFullscreen=function(){return n.supportsFullscreen()},R.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},R.supportsWebWorkers=function(){return"undefined"!=typeof Worker},R}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,e,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(t){switch(t){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(t){return t instanceof Int8Array?a.BYTE:t instanceof Uint8Array?a.UNSIGNED_BYTE:t instanceof Int16Array?a.SHORT:t instanceof Uint16Array?a.UNSIGNED_SHORT:t instanceof Float32Array?a.FLOAT:t instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(t){return e(t)&&(t===a.BYTE||t===a.UNSIGNED_BYTE||t===a.SHORT||t===a.UNSIGNED_SHORT||t===a.FLOAT||t===a.DOUBLE)},a.createTypedArray=function(t,e){switch(t){case a.BYTE:return new Int8Array(e);case a.UNSIGNED_BYTE:return new Uint8Array(e);case a.SHORT:return new Int16Array(e);case a.UNSIGNED_SHORT:return new Uint16Array(e);case a.FLOAT:return new Float32Array(e);case a.DOUBLE:return new Float64Array(e);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(e,r,i,o){switch(i=t(i,0),o=t(o,(r.byteLength-i)/a.getSizeInBytes(e)),e){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/CylinderGeometryLibrary",["./Math"],function(t){"use strict";var e={};return e.computePositions=function(e,n,r,i,a){var o,u=.5*e,s=-u,c=i+i,l=a?2*c:c,f=new Float64Array(3*l),h=0,d=0,m=a?3*c:0,y=a?3*(c+i):3*i;for(o=0;i>o;o++){var p=o/i*t.TWO_PI,v=Math.cos(p),w=Math.sin(p),E=v*r,x=w*r,g=v*n,M=w*n;f[d+m]=E,f[d+m+1]=x,f[d+m+2]=s,f[d+y]=g,f[d+y+1]=M,f[d+y+2]=u,d+=3,a&&(f[h++]=E,f[h++]=x,f[h++]=s,f[h++]=g,f[h++]=M,f[h++]=u)}return f},e}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var e={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(e)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===e.POINTS||t===e.LINES||t===e.LINE_LOOP||t===e.LINE_STRIP||t===e.TRIANGLES||t===e.TRIANGLE_STRIP||t===e.TRIANGLE_FAN}};return t(e)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,e,n,r,i){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=t(e.primitiveType,i.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=t(e.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(t){var r=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&e(t.attributes[i])&&e(t.attributes[i].values)){var a=t.attributes[i],o=a.values.length/a.componentsPerAttribute; -if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=t(e.normalize,!1),this.values=e.values};return e}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color};return e}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(t){switch(t){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(e){return t(e)&&(e===i.UNSIGNED_BYTE||e===i.UNSIGNED_SHORT||e===i.UNSIGNED_INT)},i.createTypedArray=function(t,e){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e):new Uint16Array(e)},i.createTypedArrayFromArrayBuffer=function(t,e,n,i){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e,n,i):new Uint16Array(e,n,i)},n(i)}),define("Core/CylinderOutlineGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./CylinderGeometryLibrary","./defaultValue","./defined","./DeveloperError","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./PrimitiveType"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=new e,m=function(t){t=a(t,a.EMPTY_OBJECT);var e=t.length,n=t.topRadius,r=t.bottomRadius,i=a(t.slices,128),o=Math.max(a(t.numberOfVerticalLines,16),0);this._length=e,this._topRadius=n,this._bottomRadius=r,this._slices=i,this._numberOfVerticalLines=o,this._workerName="createCylinderOutlineGeometry"};m.packedLength=5,m.pack=function(t,e,n){n=a(n,0),e[n++]=t._length,e[n++]=t._topRadius,e[n++]=t._bottomRadius,e[n++]=t._slices,e[n]=t._numberOfVerticalLines};var y={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0};return m.unpack=function(t,e,n){e=a(e,0);var r=t[e++],i=t[e++],u=t[e++],s=t[e++],c=t[e];return o(n)?(n._length=r,n._topRadius=i,n._bottomRadius=u,n._slices=s,n._numberOfVerticalLines=c,n):(y.length=r,y.topRadius=i,y.bottomRadius=u,y.slices=s,y.numberOfVerticalLines=c,new m(y))},m.createGeometry=function(a){var o,u=a._length,m=a._topRadius,y=a._bottomRadius,p=a._slices,v=a._numberOfVerticalLines,w=2*p,E=i.computePositions(u,m,y,p,!1),x=2*p;if(v>0){var g=Math.min(v,p);o=Math.round(p/g),x+=g}for(var M=f.createTypedArray(w,2*x),S=0,O=0;p-1>O;O++)M[S++]=O,M[S++]=O+1,M[S++]=O+p,M[S++]=O+1+p;if(M[S++]=p-1,M[S++]=0,M[S++]=p+p-1,M[S++]=p,v>0)for(O=0;p>O;O+=o)M[S++]=O,M[S++]=O+p;var z=new l;z.position=new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:E}),d.x=.5*u,d.y=Math.max(y,m);var _=new t(n.ZERO,e.magnitude(d));return new s({attributes:z,indices:M,primitiveType:h.LINES,boundingSphere:_})},m}),define("Workers/createCylinderOutlineGeometry",["../Core/CylinderOutlineGeometry","../Core/defined"],function(t,e){"use strict";return function(n,r){return e(r)&&(n=t.unpack(n,r)),t.createGeometry(n)}})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createEllipseGeometry.js b/libs/Cesium/Workers/createEllipseGeometry.js deleted file mode 100644 index f5e6e211..00000000 --- a/libs/Cesium/Workers/createEllipseGeometry.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(e){return e>0?1:0>e?-1:0},r.signNotZero=function(e){return 0>e?-1:1},r.toSNorm=function(e){return Math.round(255*(.5*r.clamp(e,-1,1)+.5))},r.fromSNorm=function(e){return 2*(r.clamp(e,0,255)/255)-1},r.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},r.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},r.lerp=function(e,t,r){return(1-r)*e+r*t},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(e){return e*r.RADIANS_PER_DEGREE},r.toDegrees=function(e){return e*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(e){var t=r.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},r.negativePiToPi=function(e){return r.zeroToTwoPi(e+r.PI)-r.PI},r.zeroToTwoPi=function(e){var t=r.mod(e,r.TWO_PI);return Math.abs(t)<r.EPSILON14&&Math.abs(e)>r.EPSILON14?r.TWO_PI:t},r.mod=function(e,t){return(e%t+t)%t},r.equalsEpsilon=function(e,r,n,a){a=t(a,n);var i=Math.abs(e-r);return a>=i||i<=n*Math.max(Math.abs(e),Math.abs(r))};var n=[1];r.factorial=function(e){var t=n.length;if(e>=t)for(var r=n[t-1],a=t;e>=a;a++)n.push(r*a);return n[e]},r.incrementWrap=function(e,r,n){return n=t(n,0),++e,e>r&&(e=n),e},r.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},r.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},r.clamp=function(e,t,r){return t>e?t:e>r?r:e};var a=new e;return r.setRandomNumberSeed=function(t){a=new e(t)},r.nextRandomNumber=function(){return a.random()},r.acosClamped=function(e){return Math.acos(r.clamp(e,-1,1))},r.asinClamped=function(e){return Math.asin(r.clamp(e,-1,1))},r.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},r}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0)};i.fromSpherical=function(r,n){t(n)||(n=new i);var a=r.clock,o=r.cone,u=e(r.magnitude,1),s=u*Math.sin(o);return n.x=s*Math.cos(a),n.y=s*Math.sin(a),n.z=u*Math.cos(o),n},i.fromElements=function(e,r,n,a){return t(a)?(a.x=e,a.y=r,a.z=n,a):new i(e,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n]=t.z},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n++],a.z=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var r=i.dot(s,c),n=i.magnitude(i.cross(s,c,s));return Math.atan2(n,r)};var l=new i;i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):r.y<=r.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)&&a.equalsEpsilon(e.z,r.z,n,i)},i.cross=function(e,t,r){var n=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-n*s,f=n*u-a*o;return r.x=c,r.y=l,r.z=f,r},i.fromDegrees=function(e,t,r,n,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,r,n,o)};var f=new i,d=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(r,n,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(n);f.x=c*Math.cos(r),f.y=c*Math.sin(r),f.z=Math.sin(n),f=i.normalize(f,f),i.multiplyComponents(s,f,d);var l=Math.sqrt(i.dot(f,d));return d=i.divideByScalar(d,l,d),f=i.multiplyByScalar(f,a,f),t(u)||(u=new i),i.add(d,f,u)},i.fromDegreesArray=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o++)n[o]=a.toRadians(e[o]);return i.fromRadiansArray(n,t,r)},i.fromRadiansArray=function(e,r,n){var a=e.length;t(n)?n.length=a/2:n=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];n[o/2]=i.fromRadians(u,s,0,r,n[o/2])}return n},i.fromDegreesArrayHeights=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o+=3)n[o]=a.toRadians(e[o]),n[o+1]=a.toRadians(e[o+1]),n[o+2]=e[o+2];return i.fromRadiansArrayHeights(n,t,r)},i.fromRadiansArrayHeights=function(e,r,n){var a=e.length;t(n)?n.length=a/3:n=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];n[o/3]=i.fromRadians(u,s,c,r,n[o/3])}return n},i.ZERO=n(new i(0,0,0)),i.UNIT_X=n(new i(1,0,0)),i.UNIT_Y=n(new i(0,1,0)),i.UNIT_Z=n(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n){this.longitude=e(t,0),this.latitude=e(r,0),this.height=e(n,0)};return i.fromRadians=function(r,n,a,o){return a=e(a,0),t(o)?(o.longitude=r,o.latitude=n,o.height=a,o):new i(r,n,a)},i.fromDegrees=function(e,t,r,n){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},i.equalsEpsilon=function(e,r,n){return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=n&&Math.abs(e.latitude-r.latitude)<=n&&Math.abs(e.height-r.height)<=n},i.ZERO=n(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},r=function(r,n){e(t[r])||(t[r]=!0,console.log(n))};return r}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";function s(t,n,a,i){n=r(n,0),a=r(a,0),i=r(i,0),t._radii=new e(n,a,i),t._radiiSquared=new e(n*n,a*a,i*i),t._radiiToTheFourth=new e(n*n*n*n,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===n?0:1/n,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(n,a,i),t._maximumRadius=Math.max(n,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,r)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,r){if(!n(t))return void 0;var a=t._radii;return n(r)?(e.clone(a,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return n(t)||(t=new c),n(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,n,a){a=r(a,0),e.pack(t._radii,n,a)},c.unpack=function(t,n,a){n=r(n,0);var i=e.unpack(t,n);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,r){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return n(r)||(r=new e),r.x=u,r.y=s,r.z=c,e.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(t,r){return n(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,r){var a=l,i=f;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),n(r)||(r=new e),e.add(i,a,r)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var a=0;r>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var d=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(r,a){var i=this.scaleToGeodeticSurface(r,h);if(!n(i))return void 0;var o=this.geodeticSurfaceNormal(i,d),s=e.subtract(r,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,r))*e.magnitude(s);return n(a)?(a.longitude=c,a.latitude=l,a.height=f,a):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var a=0;r>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var y=new e,p=new e;return c.prototype.scaleToGeodeticSurface=function(t,r){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,d=a*a*c*c,h=i*i*l*l,m=o*o*f*f,v=d+h+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,y);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,r):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,M=x.z,b=p;b.x=2*w.x*E,b.y=2*w.y*S,b.z=2*w.z*M;var T,A,O,I,N,z,P,R,_,L,C,q=(1-g)*e.magnitude(t)/(.5*e.magnitude(b)),D=0;do{q-=D,O=1/(1+q*E),I=1/(1+q*S),N=1/(1+q*M),z=O*O,P=I*I,R=N*N,_=z*O,L=P*I,C=R*N,T=d*z+h*P+m*R-1,A=d*_*E+h*L*S+m*C*M;var B=-2*A;D=T/B}while(Math.abs(T)>u.EPSILON12);return n(r)?(r.x=a*O,r.y=i*I,r.z=o*N,r):new e(a*O,i*I,o*N)},c.prototype.scaleToGeocentricSurface=function(t,r){n(r)||(r=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,r)},c.prototype.transformPositionToScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},c.prototype.equals=function(t){return this===t||n(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,a,i,o){"use strict";var u=function(e){this._ellipsoid=r(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,r){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return n(r)?(r.x=i,r.y=o,r.z=u,r):new e(i,o,u)},u.prototype.unproject=function(e,r){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return n(r)?(r.longitude=i,r.latitude=o,r.height=u,r):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,r){this.start=e(t,0),this.stop=e(r,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n,a){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0),this.w=e(a,0)};i.fromElements=function(e,r,n,a,o){return t(o)?(o.x=e,o.y=r,o.z=n,o.w=a,o):new i(e,r,n,a)},i.fromColor=function(e,r){return t(r)?(r.x=e.red,r.y=e.green,r.z=e.blue,r.w=e.alpha,r):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n++]=t.z,r[n]=t.w},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n++],a.z=r[n++],a.w=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r.w=Math.min(e.w,t.w),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r.w=Math.max(e.w,t.w),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t.w=e.w/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,s);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?r.x<=r.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):r.y<=r.z?r.y<=r.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)&&a.equalsEpsilon(e.z,r.z,n,i)&&a.equalsEpsilon(e.w,r.w,n,i)},i.ZERO=n(new i(0,0,0,0)),i.UNIT_X=n(new i(1,0,0,0)),i.UNIT_Y=n(new i(0,1,0,0)),i.UNIT_Z=n(new i(0,0,1,0)),i.UNIT_W=n(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i){"use strict";function o(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function u(e){for(var t=0,r=0;3>r;++r){var n=e[c.getElementIndex(h[r],d[r])];t+=2*n*n}return Math.sqrt(t)}function s(e,t){for(var r=i.EPSILON15,n=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],d[o])]);u>n&&(a=o,n=u)}var s=1,l=0,f=d[a],m=h[a];if(Math.abs(e[c.getElementIndex(m,f)])>r){var y,p=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(p-v)/2/g;y=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+y*y),l=y*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,r,n,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(r,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(n,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3],r[n++]=e[4],r[n++]=e[5],r[n++]=e[6],r[n++]=e[7],r[n++]=e[8]},c.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new c),a[0]=e[n++],a[1]=e[n++],a[2]=e[n++],a[3]=e[n++],a[4]=e[n++],a[5]=e[n++],a[6]=e[n++],a[7]=e[n++],a[8]=e[n++],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,n,a){return n=t(n,0),r(a)||(a=new c),a[0]=e[n],a[1]=e[n+1],a[2]=e[n+2],a[3]=e[n+3],a[4]=e[n+4],a[5]=e[n+5],a[6]=e[n+6],a[7]=e[n+7],a[8]=e[n+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var n=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,d=e.z*e.w,h=e.w*e.w,m=n-u-f+h,y=2*(a-d),p=2*(i+l),v=2*(a+d),g=-n+u-f+h,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-n-u+f+h;return r(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=y,t[4]=g,t[5]=E,t[6]=p,t[7]=w,t[8]=S,t):new c(m,y,p,v,g,w,x,E,S)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=a,t[6]=0,t[7]=-a,t[8]=n,t):new c(1,0,0,0,n,-a,0,a,n)},c.fromRotationY=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=n,t):new c(n,0,a,0,1,0,-a,0,n)},c.fromRotationZ=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=a,t[2]=0,t[3]=-a,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(n,-a,0,a,n,0,0,0,1)},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,r){var n=3*t,a=e[n],i=e[n+1],o=e[n+2];return r.x=a,r.y=i,r.z=o,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var a=3*t;return n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z,n},c.getRow=function(e,t,r){var n=e[t],a=e[t+3],i=e[t+6];return r.x=n,r.y=a,r.z=i,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+3]=r.y,n[t+6]=r.z,n};var l=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),r.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),r.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),r};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,r){var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},c.multiplyByVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[3]*a+e[6]*i,u=e[1]*n+e[4]*a+e[7]*i,s=e[2]*n+e[5]*a+e[8]*i;return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},c.multiplyByScale=function(e,t,r){return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.x,r[3]=e[3]*t.y,r[4]=e[4]*t.y,r[5]=e[5]*t.y,r[6]=e[6]*t.z,r[7]=e[7]*t.z,r[8]=e[8]*t.z,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var r=e[0],n=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=r,t[1]=n,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],h=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(e,t){var n=i.EPSILON20,a=10,l=0,f=0;r(t)||(t={});for(var d=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),p=n*o(h);a>f&&u(h)>p;)s(h,m),c.transpose(m,y),c.multiply(h,m,h),c.multiply(y,h,h),c.multiply(d,m,d),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],r=e[3],n=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*n-r*c)+u*(r*o-i*n)},c.inverse=function(e,t){var r=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],d=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=i.EPSILON15)throw new n("matrix is not invertible");t[0]=s*h-d*l,t[1]=d*o-a*h,t[2]=a*l-s*o,t[3]=f*l-u*h,t[4]=r*h-f*o,t[5]=u*o-r*l,t[6]=u*d-f*s,t[7]=f*a-r*d,t[8]=r*s-u*a;var y=1/m;return c.multiplyByScalar(t,y,t)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,a,i,o,u,s){"use strict";var c=function(e,t,n,a,i,o,u,s,c,l,f,d,h,m,y,p){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(c,0),this[3]=r(h,0),this[4]=r(t,0),this[5]=r(o,0),this[6]=r(l,0),this[7]=r(m,0),this[8]=r(n,0),this[9]=r(u,0),this[10]=r(f,0),this[11]=r(y,0),this[12]=r(a,0),this[13]=r(s,0),this[14]=r(d,0),this[15]=r(p,0)};c.packedLength=16,c.pack=function(e,t,n){n=r(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15]},c.unpack=function(e,t,a){return t=r(t,0),n(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=r(a,e.ZERO),n(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,r,a){n(a)||(a=new c);var i=r.x,o=r.y,u=r.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,d=t.x*t.w,h=t.y*t.y,m=t.y*t.z,y=t.y*t.w,p=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-p+g,x=2*(l-v),E=2*(f+y),S=2*(l+v),M=-s+h-p+g,b=2*(m-d),T=2*(f-y),A=2*(m+d),O=-s-h+p+g;return a[0]=w*i,a[1]=S*i,a[2]=T*i,a[3]=0,a[4]=x*o,a[5]=M*o,a[6]=A*o,a[7]=0,a[8]=E*u,a[9]=b*u,a[10]=O*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,d=new e;c.fromCamera=function(t,r){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,d),d);var u=f.x,s=f.y,h=f.z,m=l.x,y=l.y,p=l.z,v=d.x,g=d.y,w=d.z,x=a.x,E=a.y,S=a.z,M=u*-x+s*-E+h*-S,b=v*-x+g*-E+w*-S,T=m*x+y*E+p*S;return n(r)?(r[0]=u,r[1]=v,r[2]=-m,r[3]=0,r[4]=s,r[5]=g,r[6]=-y,r[7]=0,r[8]=h,r[9]=w,r[10]=-p,r[11]=0,r[12]=M,r[13]=b,r[14]=T,r[15]=1,r):new c(u,s,h,M,v,g,w,b,-m,-y,-p,T,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,r,n,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(n+r)/(r-n),c=2*n*r/(r-n);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,r,n,a,i,o){var u=1/(t-e),s=1/(n-r),c=1/(i-a),l=-(t+e)*u,f=-(n+r)*s,d=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=d,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,r,n,a,i,o){var u=2*a/(t-e),s=2*a/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),f=-(i+a)/(i-a),d=-1,h=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=d,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,r,n,a,i){var o=2*a/(t-e),u=2*a/(n-r),s=(t+e)/(t-e),c=(n+r)/(n-r),l=-1,f=-1,d=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=d,i[15]=0,i},c.computeViewportTransformation=function(e,t,n,a){e=r(e,r.EMPTY_OBJECT);var i=r(e.x,0),o=r(e.y,0),u=r(e.width,0),s=r(e.height,0);t=r(t,0),n=r(n,1);var c=.5*u,l=.5*s,f=.5*(n-t),d=c,h=l,m=f,y=i+c,p=o+l,v=t+f,g=1;return a[0]=d,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=m,a[11]=0,a[12]=y,a[13]=p,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,r){var n=4*t,a=e[n],i=e[n+1],o=e[n+2],u=e[n+3];return r.x=a,r.y=i,r.z=o,r.w=u,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var a=4*t;return n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z,n[a+3]=r.w,n},c.setTranslation=function(e,t,r){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=e[15],r},c.getRow=function(e,t,r){var n=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return r.x=n,r.y=a,r.z=i,r.w=o,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+4]=r.y,n[t+8]=r.z,n[t+12]=r.w,n};var h=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),r.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),r.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),r};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],y=e[12],p=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],M=t[4],b=t[5],T=t[6],A=t[7],O=t[8],I=t[9],N=t[10],z=t[11],P=t[12],R=t[13],_=t[14],L=t[15],C=n*w+u*x+f*E+y*S,q=a*w+s*x+d*E+p*S,D=i*w+c*x+h*E+v*S,B=o*w+l*x+m*E+g*S,U=n*M+u*b+f*T+y*A,F=a*M+s*b+d*T+p*A,G=i*M+c*b+h*T+v*A,W=o*M+l*b+m*T+g*A,V=n*O+u*I+f*N+y*z,k=a*O+s*I+d*N+p*z,Y=i*O+c*I+h*N+v*z,j=o*O+l*I+m*N+g*z,H=n*P+u*R+f*_+y*L,Z=a*P+s*R+d*_+p*L,X=i*P+c*R+h*_+v*L,Q=o*P+l*R+m*_+g*L;return r[0]=C,r[1]=q,r[2]=D,r[3]=B,r[4]=U,r[5]=F,r[6]=G,r[7]=W,r[8]=V,r[9]=k,r[10]=Y,r[11]=j,r[12]=H,r[13]=Z,r[14]=X,r[15]=Q,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},c.multiplyTransformation=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=e[12],h=e[13],m=e[14],y=t[0],p=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],M=t[10],b=t[12],T=t[13],A=t[14],O=n*y+o*p+c*v,I=a*y+u*p+l*v,N=i*y+s*p+f*v,z=n*g+o*w+c*x,P=a*g+u*w+l*x,R=i*g+s*w+f*x,_=n*E+o*S+c*M,L=a*E+u*S+l*M,C=i*E+s*S+f*M,q=n*b+o*T+c*A+d,D=a*b+u*T+l*A+h,B=i*b+s*T+f*A+m;return r[0]=O,r[1]=I,r[2]=N,r[3]=0,r[4]=z,r[5]=P,r[6]=R,r[7]=0,r[8]=_,r[9]=L,r[10]=C,r[11]=0,r[12]=q,r[13]=D,r[14]=B,r[15]=1,r},c.multiplyByMatrix3=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=t[0],h=t[1],m=t[2],y=t[3],p=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=n*d+o*h+c*m,S=a*d+u*h+l*m,M=i*d+s*h+f*m,b=n*y+o*p+c*v,T=a*y+u*p+l*v,A=i*y+s*p+f*v,O=n*g+o*w+c*x,I=a*g+u*w+l*x,N=i*g+s*w+f*x;return r[0]=E,r[1]=S,r[2]=M,r[3]=0,r[4]=b,r[5]=T,r[6]=A,r[7]=0,r[8]=O,r[9]=I,r[10]=N,r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},c.multiplyByTranslation=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=n*e[0]+a*e[4]+i*e[8]+e[12],u=n*e[1]+a*e[5]+i*e[9]+e[13],s=n*e[2]+a*e[6]+i*e[10]+e[14];return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=o,r[13]=u,r[14]=s,r[15]=e[15],r};var y=new e;c.multiplyByUniformScale=function(e,t,r){return y.x=t,y.y=t,y.z=t,c.multiplyByScale(e,y,r)},c.multiplyByScale=function(e,t,r){var n=t.x,a=t.y,i=t.z;return 1===n&&1===a&&1===i?c.clone(e,r):(r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=0,r[4]=a*e[4],r[5]=a*e[5],r[6]=a*e[6],r[7]=0,r[8]=i*e[8],r[9]=i*e[9],r[10]=i*e[10],r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=1,r)},c.multiplyByVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*n+e[4]*a+e[8]*i+e[12]*o,s=e[1]*n+e[5]*a+e[9]*i+e[13]*o,c=e[2]*n+e[6]*a+e[10]*i+e[14]*o,l=e[3]*n+e[7]*a+e[11]*i+e[15]*o;return r.x=u,r.y=s,r.z=c,r.w=l,r},c.multiplyByPointAsVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[4]*a+e[8]*i,u=e[1]*n+e[5]*a+e[9]*i,s=e[2]*n+e[6]*a+e[10]*i;return r.x=o,r.y=u,r.z=s,r},c.multiplyByPoint=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[4]*a+e[8]*i+e[12],u=e[1]*n+e[5]*a+e[9]*i+e[13],s=e[2]*n+e[6]*a+e[10]*i+e[14];return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var r=e[1],n=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r&&Math.abs(e[9]-t[9])<=r&&Math.abs(e[10]-t[10])<=r&&Math.abs(e[11]-t[11])<=r&&Math.abs(e[12]-t[12])<=r&&Math.abs(e[13]-t[13])<=r&&Math.abs(e[14]-t[14])<=r&&Math.abs(e[15]-t[15])<=r},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var p=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,r){if(u.equalsEpsilon(c.getRotation(e,p),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=0,r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=1,r;var n=e[0],a=e[4],i=e[8],l=e[12],f=e[1],d=e[5],h=e[9],m=e[13],y=e[2],x=e[6],E=e[10],S=e[14],M=e[3],b=e[7],T=e[11],A=e[15],O=E*A,I=S*T,N=x*A,z=S*b,P=x*T,R=E*b,_=y*A,L=S*M,C=y*T,q=E*M,D=y*b,B=x*M,U=O*d+z*h+P*m-(I*d+N*h+R*m),F=I*f+_*h+q*m-(O*f+L*h+C*m),G=N*f+L*d+D*m-(z*f+_*d+B*m),W=R*f+C*d+B*h-(P*f+q*d+D*h),V=I*a+N*i+R*l-(O*a+z*i+P*l),k=O*n+L*i+C*l-(I*n+_*i+q*l),Y=z*n+_*a+B*l-(N*n+L*a+D*l),j=P*n+q*a+D*i-(R*n+C*a+B*i);O=i*m,I=l*h,N=a*m,z=l*d,P=a*h,R=i*d,_=n*m,L=l*f,C=n*h,q=i*f,D=n*d,B=a*f;var H=O*b+z*T+P*A-(I*b+N*T+R*A),Z=I*M+_*T+q*A-(O*M+L*T+C*A),X=N*M+L*b+D*A-(z*M+_*b+B*A),Q=R*M+C*b+B*T-(P*M+q*b+D*T),K=N*E+R*S+I*x-(P*S+O*x+z*E),J=C*S+O*y+L*E-(_*E+q*S+I*y),$=_*x+B*S+z*y-(D*S+N*y+L*x),et=D*E+P*y+q*x-(C*x+B*E+R*y),tt=n*U+a*F+i*G+l*W;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,r[0]=U*tt,r[1]=F*tt,r[2]=G*tt,r[3]=W*tt,r[4]=V*tt,r[5]=k*tt,r[6]=Y*tt,r[7]=j*tt,r[8]=H*tt,r[9]=Z*tt,r[10]=X*tt,r[11]=Q*tt,r[12]=K*tt,r[13]=J*tt,r[14]=$*tt,r[15]=et*tt,r},c.inverseTransformation=function(e,t){var r=e[0],n=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],d=e[13],h=e[14],m=-r*f-n*d-a*h,y=-i*f-o*d-u*h,p=-s*f-c*d-l*h;return t[0]=r,t[1]=i,t[2]=s,t[3]=0,t[4]=n,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=y,t[14]=p,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]&&e[9]===t[r+9]&&e[10]===t[r+10]&&e[11]===t[r+11]&&e[12]===t[r+12]&&e[13]===t[r+13]&&e[14]===t[r+14]&&e[15]===t[r+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var a=function(t,r){this.normal=e.clone(t),this.distance=r};a.fromPointNormal=function(r,n,i){var o=-e.dot(n,r);return t(i)?(e.clone(n,i.normal),i.distance=o,i):new a(n,o)};var i=new e;return a.fromCartesian4=function(r,n){var o=e.fromCartesian4(r,i),u=r.w;return t(n)?(e.clone(o,n.normal),n.distance=u,n):new a(o,u)},a.getPointDistance=function(t,r){return e.dot(t.normal,r)+t.distance},a.ORIGIN_XY_PLANE=n(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=n(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=n(new a(e.UNIT_Y,0)),a}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";var s=function(e,r,n,a){this.west=t(e,0),this.south=t(r,0),this.east=t(n,0),this.north=t(a,0)};n(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},s.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new s),a.west=e[n++],a.south=e[n++],a.east=e[n++],a.north=e[n],a},s.computeWidth=function(e){var t=e.east,r=e.west;return r>t&&(t+=u.TWO_PI),t-r},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,n,a,i,o){return e=u.toRadians(t(e,0)),n=u.toRadians(t(n,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),r(o)?(o.west=e,o.south=n,o.east=a,o.north=i,o):new s(e,n,a,i)},s.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];n=Math.min(n,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return r(t)?(t.west=n,t.south=i,t.east=a,t.north=o,t):new s(n,i,a,o)},s.clone=function(e,t){return r(e)?r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},s.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},s.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},s.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},s.center=function(t,n){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return r(n)?(n.longitude=o,n.latitude=s,n.height=0,n):new e(o,s)},s.intersection=function(e,t,n){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var d=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return d>=h?void 0:r(n)?(n.west=l,n.south=d,n.east=f,n.north=h,n):new s(l,d,f,h)},s.contains=function(e,t){var r=t.longitude,n=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>r&&(r+=u.TWO_PI)),(r>a||u.equalsEpsilon(r,a,u.EPSILON14))&&(i>r||u.equalsEpsilon(r,i,u.EPSILON14))&&n>=e.south&&n<=e.north};var c=new e;return s.subsample=function(e,n,a,o){n=t(n,i.WGS84),a=t(a,0),r(o)||(o=[]);var l=0,f=e.north,d=e.south,h=e.east,m=e.west,y=c;y.height=a,y.longitude=m,y.latitude=f,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.longitude=h,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.latitude=d,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:d>0?d:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(e,y)&&(o[l]=n.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=n.cartographicToCartesian(y,o[l]),l++,y.longitude=h,o[l]=n.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,r,n,a,i,o,u,s,c,l,f,d){"use strict";var h=function(t,n){this.center=e.clone(r(t,e.ZERO)),this.radius=r(n,0)},m=new e,y=new e,p=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,M=new e,b=new e,T=new e;h.fromPoints=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;for(var a=e.clone(t[0],x),i=e.clone(a,m),o=e.clone(a,y),u=e.clone(a,p),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),f=t.length,d=1;f>d;d++){e.clone(t[d],a);var A=a.x,O=a.y,I=a.z;A<i.x&&e.clone(a,i),A>s.x&&e.clone(a,s),O<o.y&&e.clone(a,o),O>c.y&&e.clone(a,c),I<u.z&&e.clone(a,u),I>l.z&&e.clone(a,l)}var N=e.magnitudeSquared(e.subtract(s,i,E)),z=e.magnitudeSquared(e.subtract(c,o,E)),P=e.magnitudeSquared(e.subtract(l,u,E)),R=i,_=s,L=N;z>L&&(L=z,R=o,_=c),P>L&&(L=P,R=u,_=l);var C=S;C.x=.5*(R.x+_.x),C.y=.5*(R.y+_.y),C.z=.5*(R.z+_.z);var q=e.magnitudeSquared(e.subtract(_,C,E)),D=Math.sqrt(q),B=M;B.x=i.x,B.y=o.y,B.z=u.z;var U=b;U.x=s.x,U.y=c.y,U.z=l.z;var F=e.multiplyByScalar(e.add(B,U,E),.5,T),G=0;for(d=0;f>d;d++){e.clone(t[d],a);var W=e.magnitude(e.subtract(a,F,E));W>G&&(G=W);var V=e.magnitudeSquared(e.subtract(a,C,E));if(V>q){var k=Math.sqrt(V);D=.5*(D+k),q=D*D;var Y=k-D;C.x=(D*C.x+Y*a.x)/k,C.y=(D*C.y+Y*a.y)/k,C.z=(D*C.z+Y*a.z)/k}}return G>D?(e.clone(C,r.center),r.radius=D):(e.clone(F,r.center),r.radius=G),r};var A=new u,O=new e,I=new e,N=new t,z=new t;h.fromRectangle2D=function(e,t,r){return h.fromRectangleWithHeights2D(e,t,0,0,r)},h.fromRectangleWithHeights2D=function(t,a,i,o,u){if(n(u)||(u=new h),!n(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=r(a,A),d.southwest(t,N),N.height=i,d.northeast(t,z),z.height=o;var s=a.project(N,O),c=a.project(z,I),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var P=[];h.fromRectangle3D=function(e,t,a,i){t=r(t,o.WGS84),a=r(a,0);var u;return n(e)&&(u=d.subsample(e,t,a,P)),h.fromPoints(u,i)},h.fromVertices=function(t,a,i,o){if(n(o)||(o=new h),!n(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=r(a,e.ZERO),i=r(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,m),c=e.clone(u,y),l=e.clone(u,p),f=e.clone(u,v),d=e.clone(u,g),A=e.clone(u,w),O=t.length,I=0;O>I;I+=i){var N=t[I]+a.x,z=t[I+1]+a.y,P=t[I+2]+a.z;u.x=N,u.y=z,u.z=P,N<s.x&&e.clone(u,s),N>f.x&&e.clone(u,f),z<c.y&&e.clone(u,c),z>d.y&&e.clone(u,d),P<l.z&&e.clone(u,l),P>A.z&&e.clone(u,A)}var R=e.magnitudeSquared(e.subtract(f,s,E)),_=e.magnitudeSquared(e.subtract(d,c,E)),L=e.magnitudeSquared(e.subtract(A,l,E)),C=s,q=f,D=R;_>D&&(D=_,C=c,q=d),L>D&&(D=L,C=l,q=A);var B=S;B.x=.5*(C.x+q.x),B.y=.5*(C.y+q.y),B.z=.5*(C.z+q.z);var U=e.magnitudeSquared(e.subtract(q,B,E)),F=Math.sqrt(U),G=M;G.x=s.x,G.y=c.y,G.z=l.z;var W=b;W.x=f.x,W.y=d.y,W.z=A.z;var V=e.multiplyByScalar(e.add(G,W,E),.5,T),k=0;for(I=0;O>I;I+=i){u.x=t[I]+a.x,u.y=t[I+1]+a.y,u.z=t[I+2]+a.z;var Y=e.magnitude(e.subtract(u,V,E));Y>k&&(k=Y);var j=e.magnitudeSquared(e.subtract(u,B,E));if(j>U){var H=Math.sqrt(j);F=.5*(F+H),U=F*F;var Z=H-F;B.x=(F*B.x+Z*u.x)/H,B.y=(F*B.y+Z*u.y)/H,B.z=(F*B.z+Z*u.z)/H}}return k>F?(e.clone(B,o.center),o.radius=F):(e.clone(V,o.center),o.radius=k),o},h.fromCornerPoints=function(t,r,a){n(a)||(a=new h);var i=a.center;return e.add(t,r,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,r),a},h.fromEllipsoid=function(t,r){return n(r)||(r=new h),e.clone(e.ZERO,r.center),r.radius=t.maximumRadius,r};var R=new e;h.fromBoundingSpheres=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var a=t.length;if(1===a)return h.clone(t[0],r);if(2===a)return h.union(t[0],t[1],r);for(var i=[],o=0;a>o;o++)i.push(t[o].center);r=h.fromPoints(i,r);var u=r.center,s=r.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,R)+c.radius)}return r.radius=s,r},h.clone=function(t,r){return n(t)?n(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,n){n=r(n,0);var a=e.center;t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n]=e.radius},h.unpack=function(e,t,a){t=r(t,0),n(a)||(a=new h);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var _=new e,L=new e;h.union=function(t,r,a){n(a)||(a=new h);var i=t.center,o=t.radius,u=r.center,s=r.radius,c=e.subtract(u,i,_),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return r.clone(a),a;var f=.5*(o+l+s),d=e.multiplyByScalar(c,(-o+f)/l,L);return e.add(d,i,d),e.clone(d,a.center),a.radius=f,a};var C=new e;h.expand=function(t,r,n){n=h.clone(t,n);var a=e.magnitude(e.subtract(r,n.center,C));return a>n.radius&&(n.radius=a),n},h.intersectPlane=function(t,r){var n=t.center,a=t.radius,i=r.normal,o=e.dot(i,n)+r.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);h.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var r=f.fromCartesian4(t,q);return h.intersectPlane(e,r)},h.transform=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=l.getMaximumScale(t)*e.radius,r};var D=new e;h.distanceSquaredTo=function(t,r){var n=e.subtract(t.center,r,D);return e.magnitudeSquared(n)-t.radius*t.radius},h.transformWithoutScale=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var B=new e;h.computePlaneDistances=function(t,r,a,i){n(i)||(i=new c);var o=e.subtract(t.center,r,B),u=e.multiplyByScalar(a,e.dot(a,o),B),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var U=new e,F=new e,G=new e,W=new e,V=new e,k=new t,Y=new Array(8),j=0;8>j;++j)Y[j]=new e;var H=new u;return h.projectTo2D=function(t,n,a){n=r(n,H);var i=n.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,U),c=e.cross(e.UNIT_Z,s,F);e.normalize(c,c);var l=e.cross(s,c,G);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,V),d=e.negate(c,W),m=Y,y=m[0];e.add(s,l,y),e.add(y,c,y),y=m[1],e.add(s,l,y),e.add(y,d,y),y=m[2],e.add(s,f,y),e.add(y,d,y),y=m[3],e.add(s,f,y),e.add(y,c,y),e.negate(s,s),y=m[4],e.add(s,l,y),e.add(y,c,y),y=m[5],e.add(s,l,y),e.add(y,d,y),y=m[6],e.add(s,f,y),e.add(y,d,y),y=m[7],e.add(s,f,y),e.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var g=m[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,k);n.project(w,g)}a=h.fromPoints(m,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},h.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r){this.x=e(t,0),this.y=e(r,0)};i.fromElements=function(e,r,n){return t(n)?(n.x=e,n.y=r,n):new i(e,r)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n]=t.y},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)},i.ZERO=n(new i(0,0)),i.UNIT_X=n(new i(1,0)),i.UNIT_Y=n(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(n.requestFullscreen=a,r=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(n.requestFullscreen=a,r=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?n.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(n.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?n.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(n.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?n.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(n.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),n.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),n.fullscreenerror=a)}return r},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[n.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[n.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function a(){if(!t(p)){p=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(p=!0,v=n(e[1]))}return p}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=n(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=n(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,M=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,M=n(e[1])))}return S}function f(){return l()&&M}function d(){if(!t(b)){b=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(b=!0,T=n(e[1]))}return b}function h(){return t(A)||(A=/Windows/i.test(navigator.appVersion)),A}function m(){return d()&&T}function y(){return t(O)||(O=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),O}var p,v,g,w,x,E,S,M,b,T,A,O,I={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:d,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return I.supportsFullscreen=function(){return r.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,r,n,a){"use strict";if(!n.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new r("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,n,a,o){switch(a=e(a,0),o=e(o,(n.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(n,a,o);case i.UNSIGNED_BYTE:return new Uint8Array(n,a,o);case i.SHORT:return new Int16Array(n,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(n,a,o);case i.FLOAT:return new Float32Array(n,a,o);case i.DOUBLE:return new Float64Array(n,a,o);default:throw new r("componentDatatype is not a valid value.")}},a(i)}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,r,n,a,i,o,u){"use strict";var s=function(e,r,n,a){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,n,a){var i=n/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,d=Math.cos(i);return r(a)?(a.x=u,a.y=l,a.z=f,a.w=d,a):new s(u,l,f,d)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var n,a,i,o,c,d=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],y=d+h+m;if(y>0)n=Math.sqrt(y+1),c=.5*n,n=.5/n,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*n,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*n,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*n;else{var p=l,v=0;h>d&&(v=1),m>d&&m>h&&(v=2);var g=p[v],w=p[g];n=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*n,n=.5/n,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*n,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*n,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*n,a=-x[0],i=-x[1],o=-x[2]}return r(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var d=new s;s.fromHeadingPitchRoll=function(t,r,n,a){var i=s.fromAxisAngle(e.UNIT_X,n,d),o=s.fromAxisAngle(e.UNIT_Y,-r,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,d);return s.multiply(u,a,a)};var h=new e,m=new e,y=new s,p=new s,v=new s; -s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.x,r[n++]=e.y,r[n++]=e.z,r[n]=e.w},s.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new s),a.x=e[n],a.y=e[n+1],a.z=e[n+2],a.w=e[n+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,r,n){s.unpack(e,4*r,v),s.conjugate(v,v);for(var a=0,i=r-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),y),s.multiply(y,v,y),y.w<0&&s.negate(y,y),s.computeAxis(y,h);var u=s.computeAngle(y);n[o]=h.x*u,n[o+1]=h.y*u,n[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,n,a,i,o){r(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(n,4*i,p),0===u?s.clone(s.IDENTITY,y):s.fromAxisAngle(m,u,y),s.multiply(y,p,o)},s.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var r=1/s.magnitude(e),n=e.x*r,a=e.y*r,i=e.z*r,o=e.w*r;return t.x=n,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var r=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/r,t)},s.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},s.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,r){var n=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+n*l+a*c-i*s,d=o*s-n*c+a*l+i*u,h=o*c+n*s-a*u+i*l,m=o*l-n*u-a*s-i*c;return r.x=f,r.y=d,r.z=h,r.w=m,r},s.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},s.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},s.computeAxis=function(e,t){var r=e.w;if(Math.abs(r-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var n=1/Math.sqrt(1-r*r);return t.x=e.x*n,t.y=e.y*n,t.z=e.z*n,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,r,n){return g=s.multiplyByScalar(t,r,g),n=s.multiplyByScalar(e,1-r,n),s.add(g,n,n)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,r,n){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,r,n);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-r)*u),x),E=s.multiplyByScalar(i,Math.sin(r*u),E),n=s.add(x,E,n),s.multiplyByScalar(n,1/Math.sin(u),n)},s.log=function(t,r){var n=o.acosClamped(t.w),a=0;return 0!==n&&(a=n/Math.sin(n)),e.multiplyByScalar(t,a,r)},s.exp=function(t,r){var n=e.magnitude(t),a=0;return 0!==n&&(a=Math.sin(n)/n),r.x=t.x*a,r.y=t.y*a,r.z=t.z*a,r.w=Math.cos(n),r};var S=new e,M=new e,b=new s,T=new s;s.computeInnerQuadrangle=function(t,r,n,a){var i=s.conjugate(r,b);s.multiply(i,n,T);var o=s.log(T,S);s.multiply(i,t,T);var u=s.log(T,M);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,b),s.multiply(r,b,a)},s.squad=function(e,t,r,n,a,i){var o=s.slerp(e,t,a,b),u=s.slerp(r,n,a,T);return s.slerp(o,u,2*a*(1-a),i)};for(var A=new s,O=1.9011074535173003,I=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],z=a.supportsTypedArrays()?new Float32Array(8):[],P=a.supportsTypedArrays()?new Float32Array(8):[],R=0;7>R;++R){var _=R+1,L=2*_+1;I[R]=1/(_*L),N[R]=_/L}return I[7]=O/136,N[7]=8*O/17,s.fastSlerp=function(e,t,r,n){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-r,c=r*r,l=u*u,f=7;f>=0;--f)z[f]=(I[f]*c-N[f])*o,P[f]=(I[f]*l-N[f])*o;var d=a*r*(1+z[0]*(1+z[1]*(1+z[2]*(1+z[3]*(1+z[4]*(1+z[5]*(1+z[6]*(1+z[7])))))))),h=u*(1+P[0]*(1+P[1]*(1+P[2]*(1+P[3]*(1+P[4]*(1+P[5]*(1+P[6]*(1+P[7])))))))),m=s.multiplyByScalar(e,h,A);return s.multiplyByScalar(t,d,n),s.add(m,n,n)},s.fastSquad=function(e,t,r,n,a,i){var o=s.fastSlerp(e,t,a,b),u=s.fastSlerp(r,n,a,T);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/EllipseGeometryLibrary",["./Cartesian3","./Math","./Matrix3","./Quaternion"],function(e,t,r,n){"use strict";function a(t,a,i,l,f,d,h,m,y,p){var v=t+a;e.multiplyByScalar(l,Math.cos(v),o),e.multiplyByScalar(i,Math.sin(v),u),e.add(o,u,o);var g=Math.cos(t);g*=g;var w=Math.sin(t);w*=w;var x=d/Math.sqrt(h*g+f*w),E=x/m;return n.fromAxisAngle(o,E,s),r.fromQuaternion(s,c),r.multiplyByVector(c,y,p),e.normalize(p,p),e.multiplyByScalar(p,m,p),p}var i={},o=new e,u=new e,s=new n,c=new r,l=new e,f=new e,d=new e,h=new e;i.raisePositionsToHeight=function(t,r,n){for(var a=r.ellipsoid,i=r.height,o=r.extrudedHeight,u=n?2*(t.length/3):t.length/3,s=new Float64Array(3*u),c=t.length,m=n?c:0,y=0;c>y;y+=3){var p=y+1,v=y+2,g=e.fromArray(t,y,l);a.scaleToGeodeticSurface(g,g);var w=e.clone(g,f),x=a.geodeticSurfaceNormal(g,h),E=e.multiplyByScalar(x,i,d);e.add(g,E,g),n&&(e.multiplyByScalar(x,o,E),e.add(w,E,w),s[y+m]=w.x,s[p+m]=w.y,s[v+m]=w.z),s[y]=g.x,s[p]=g.y,s[v]=g.z}return s};var m=new e,y=new e,p=new e;return i.computeEllipsePositions=function(r,n,i){var o=r.semiMinorAxis,u=r.semiMajorAxis,s=r.rotation,c=r.center,h=8*r.granularity,v=o*o,g=u*u,w=u*o,x=e.magnitude(c),E=e.normalize(c,m),S=e.cross(e.UNIT_Z,c,y);S=e.normalize(S,S);var M=e.cross(E,S,p),b=1+Math.ceil(t.PI_OVER_TWO/h),T=t.PI_OVER_TWO/(b-1),A=t.PI_OVER_TWO-b*T;0>A&&(b-=Math.ceil(Math.abs(A)/T));var O,I,N,z,P,R=2*b*(b+1),_=n?new Array(3*R):void 0,L=0,C=l,q=f,D=3*(2*b+2*(b-1)),B=D-1,U=0,F=i?new Array(D):void 0;for(A=t.PI_OVER_TWO,O=0;b>O;++O){if(C=a(A,s,M,S,v,w,g,x,E,C),q=a(Math.PI-A,s,M,S,v,w,g,x,E,q),n){for(_[L++]=C.x,_[L++]=C.y,_[L++]=C.z,N=2*O+2,I=1;N-1>I;++I)z=I/(N-1),P=e.lerp(C,q,z,d),_[L++]=P.x,_[L++]=P.y,_[L++]=P.z;_[L++]=q.x,_[L++]=q.y,_[L++]=q.z}i&&(F[B--]=C.z,F[B--]=C.y,F[B--]=C.x,0!==O&&(F[U++]=q.x,F[U++]=q.y,F[U++]=q.z)),A=t.PI_OVER_TWO-(O+1)*T}for(O=b;O>0;--O){if(A=t.PI_OVER_TWO-(O-1)*T,C=a(-A,s,M,S,v,w,g,x,E,C),q=a(A+Math.PI,s,M,S,v,w,g,x,E,q),n){for(_[L++]=C.x,_[L++]=C.y,_[L++]=C.z,N=2*(O-1)+2,I=1;N-1>I;++I)z=I/(N-1),P=e.lerp(C,q,z,d),_[L++]=P.x,_[L++]=P.y,_[L++]=P.z;_[L++]=q.x,_[L++]=q.y,_[L++]=q.z}i&&(F[B--]=C.z,F[B--]=C.y,F[B--]=C.x,1!==O&&(F[U++]=q.x,F[U++]=q.y,F[U++]=q.z))}var G={};return n&&(G.positions=_,G.numPts=b),i&&(G.outerPositions=F),G},i}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,n.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var n=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(n!==o&&-1!==n)throw new r("All attribute lists must have the same number of attributes.");n=o}return n},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=n.clone(e(t.modelMatrix,n.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return a}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n,a){"use strict";var i={};i.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=t.x,n=t.y;t.x=(1-Math.abs(n))*a.signNotZero(r),t.y=(1-Math.abs(r))*a.signNotZero(n)}return t.x=a.toSNorm(t.x),t.y=a.toSNorm(t.y),t},i.octDecode=function(e,r,n){if(n.x=a.fromSNorm(e),n.y=a.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var i=n.x;n.x=(1-Math.abs(n.y))*a.signNotZero(i),n.y=(1-Math.abs(i))*a.signNotZero(n.y)}return t.normalize(n,n)},i.octPackFloat=function(e){return 256*e.x+e.y};var o=new e;return i.octEncodeFloat=function(e){return i.octEncode(e,o),i.octPackFloat(o)},i.octDecodeFloat=function(e,t){var r=e/256,n=Math.floor(r),a=256*(r-n);return i.octDecode(n,a,t)},i.octPack=function(e,t,r,n){var a=i.octEncodeFloat(e),u=i.octEncodeFloat(t),s=i.octEncode(r,o);return n.x=65536*s.x+a,n.y=65536*s.y+u,n},i.octUnpack=function(e,t,r,n){var a=e.x/65536,o=Math.floor(a),u=65536*(a-o);a=e.y/65536;var s=Math.floor(a),c=65536*(a-s);i.octDecodeFloat(u,t),i.octDecodeFloat(c,r),i.octDecode(o,s,n)},i.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,r=1===e.y?4095:0|4096*e.y;return 4096*t+r},i.decompressTextureCoordinates=function(e,t){var r=e/4096;return t.x=Math.floor(r)/4096,t.y=r-Math.floor(r),t},i}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=new t,a=new t,i=new t,o=function(o,u,s,c,l){r(l)||(l=new t);var f,d,h,m,y,p,v,g;r(u.z)?(f=t.subtract(s,u,n),d=t.subtract(c,u,a),h=t.subtract(o,u,i),m=t.dot(f,f),y=t.dot(f,d),p=t.dot(f,h),v=t.dot(d,d),g=t.dot(d,h)):(f=e.subtract(s,u,n),d=e.subtract(c,u,a),h=e.subtract(o,u,i),m=e.dot(f,f),y=e.dot(f,d),p=e.dot(f,h),v=e.dot(d,d),g=e.dot(d,h));var w=1/(m*v-y*y);return l.y=(v*p-y*g)*w,l.z=(m*g-y*p)*w,l.x=1-l.y-l.z,l};return o}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};r.encode=function(e,r){t(r)||(r={high:0,low:0});var n;return e>=0?(n=65536*Math.floor(e/65536),r.high=n,r.low=e-n):(n=65536*Math.floor(-e/65536),r.high=-n,r.low=e+n),r};var n={high:0,low:0};r.fromCartesian=function(e,a){t(a)||(a=new r);var i=a.high,o=a.low;return r.encode(e.x,n),i.x=n.high,o.x=n.low,r.encode(e.y,n),i.y=n.high,o.y=n.low,r.encode(e.z,n),i.z=n.high,o.z=n.low,a};var a=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,a);var i=a.high,o=a.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z},r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,r,a){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,a):new Uint16Array(t,r,a)},r(a)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var a=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(r)))<n?0:a}var n={};return n.computeDiscriminant=function(e,t,r){var n=t*t-4*e*r;return n},n.computeRealRoots=function(e,n,a){var i;if(0===e)return 0===n?[]:[-a/n];if(0===n){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-n/e,0>i?[i,0]:[0,i];var c=n*n,l=4*e*a,f=r(c,-l,t.EPSILON14);if(0>f)return[];var d=-.5*r(n,t.sign(n)*Math.sqrt(f),t.EPSILON14);return n>0?[d/e,a/d]:[a/d,d/e]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var a,i,o=e,u=t/3,s=r/3,c=n,l=o*s,f=u*c,d=u*u,h=s*s,m=o*s-d,y=o*c-u*s,p=u*c-h,v=4*m*p-y*y;if(0>v){var g,w,x;d*f>=l*h?(g=o,w=m,x=-2*u*m+o*y):(g=c,w=p,x=-c*y+2*s*p);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var M=i/2,b=0>M?-Math.pow(-M,1/3):Math.pow(M,1/3),T=i===S?-b:-w/b;return a=0>=w?b+T:-x/(b*b+T*T+w),d*f>=l*h?[(a-u)/o]:[-c/(a+s)]}var A=m,O=-2*u*m+o*y,I=p,N=-c*y+2*s*p,z=Math.sqrt(v),P=Math.sqrt(3)/2,R=Math.abs(Math.atan2(o*z,-O)/3);a=2*Math.sqrt(-A);var _=Math.cos(R);i=a*_;var L=a*(-_/2-P*Math.sin(R)),C=i+L>2*u?i-u:L-u,q=o,D=C/q;R=Math.abs(Math.atan2(c*z,-N)/3),a=2*Math.sqrt(-I),_=Math.cos(R),i=a*_,L=a*(-_/2-P*Math.sin(R));var B=-c,U=2*s>i+L?i+s:L+s,F=B/U,G=q*U,W=-C*U-q*B,V=C*B,k=(s*W-u*V)/(-u*W+s*G);return k>=D?F>=D?F>=k?[D,k,F]:[D,F,k]:[F,D,k]:F>=D?[k,D,F]:F>=k?[k,F,D]:[F,k,D]}var n={};return n.computeDiscriminant=function(e,t,r,n){var a=e*e,i=t*t,o=r*r,u=n*n,s=18*e*t*r*n+i*o-27*a*u-4*(e*o*r+i*t*n);return s},n.computeRealRoots=function(e,n,a,i){var o,u;if(0===e)return t.computeRealRoots(n,a,i);if(0===n){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):r(e,0,a,i)}return 0===a?0===i?(u=-n/e,0>u?[u,0,0]:[0,0,u]):r(e,n,0,i):0===i?(o=t.computeRealRoots(e,n,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):r(e,n,a,i)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var d=-t/4,h=f[f.length-1];if(Math.abs(h)<r.EPSILON14){var m=n.computeRealRoots(1,s,l);if(2===m.length){var y,p=m[0],v=m[1];if(p>=0&&v>=0){var g=Math.sqrt(p),w=Math.sqrt(v);return[d-w,d-g,d+g,d+w]}if(p>=0&&0>v)return y=Math.sqrt(p),[d-y,d+y];if(0>p&&v>=0)return y=Math.sqrt(v),[d-y,d+y]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,M=n.computeRealRoots(1,x,E),b=n.computeRealRoots(1,-x,S);return 0!==M.length?(M[0]+=d,M[1]+=d,0!==b.length?(b[0]+=d,b[1]+=d,M[1]<=b[0]?[M[0],M[1],b[0],b[1]]:b[1]<=M[0]?[b[0],b[1],M[0],M[1]]:M[0]>=b[0]&&M[1]<=b[1]?[b[0],M[0],M[1],b[1]]:b[0]>=M[0]&&b[1]<=M[1]?[M[0],b[0],b[1],M[1]]:M[0]>b[0]&&M[0]<b[1]?[b[0],M[0],b[1],M[1]]:[M[0],b[0],M[1],b[1]]):M):0!==b.length?(b[0]+=d,b[1]+=d,b):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,f=i*t+s-4*o,d=c*o-i*a*t+u,h=e.computeRealRoots(1,l,f,d);if(h.length>0){var m,y,p=h[0],v=a-p,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),M=c-4*p,b=c+4*Math.abs(p);if(0>p||M*S>E*b){var T=Math.sqrt(M);m=T/2,y=0===T?0:(t*x-i)/T}else{var A=Math.sqrt(E);m=0===A?0:(t*x-i)/A,y=A/2}var O,I;0===w&&0===m?(O=0,I=0):r.sign(w)===r.sign(m)?(O=w+m,I=p/O):(I=w-m,O=p/I);var N,z;0===x&&0===y?(N=0,z=0):r.sign(x)===r.sign(y)?(N=x+y,z=o/N):(z=x-y,N=o/z);var P=n.computeRealRoots(1,O,N),R=n.computeRealRoots(1,I,z);if(0!==P.length)return 0!==R.length?P[1]<=R[0]?[P[0],P[1],R[0],R[1]]:R[1]<=P[0]?[R[0],R[1],P[0],P[1]]:P[0]>=R[0]&&P[1]<=R[1]?[R[0],P[0],P[1],R[1]]:R[0]>=P[0]&&R[1]<=P[1]?[P[0],R[0],R[1],P[1]]:P[0]>R[0]&&P[0]<R[1]?[R[0],P[0],R[1],P[1]]:[P[0],R[0],P[1],R[1]]:P;if(0!==R.length)return R}return[]}var o={};return o.computeDiscriminant=function(e,t,r,n,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=r*r,l=c*r,f=n*n,d=f*n,h=a*a,m=h*a,y=u*c*f-4*s*d-4*e*l*f+18*e*t*r*d-27*i*f*f+256*o*m+a*(18*s*r*n-4*u*l+16*e*c*c-80*e*t*c*n-6*e*u*f+144*i*r*f)+h*(144*e*u*r-27*u*u-128*i*c-192*i*t*n);return y},o.computeRealRoots=function(t,n,o,u,s){if(Math.abs(t)<r.EPSILON15)return e.computeRealRoots(n,o,u,s);var c=n/t,l=o/t,f=u/t,d=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>d?h+1:h){case 0:return a(c,l,f,d);case 1:return i(c,l,f,d);case 2:return i(c,l,f,d);case 3:return a(c,l,f,d);case 4:return a(c,l,f,d);case 5:return i(c,l,f,d);case 6:return a(c,l,f,d);case 7:return a(c,l,f,d);case 8:return i(c,l,f,d);case 9:return a(c,l,f,d);case 10:return a(c,l,f,d);case 11:return i(c,l,f,d);case 12:return a(c,l,f,d);case 13:return a(c,l,f,d);case 14:return a(c,l,f,d);case 15:return a(c,l,f,d);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=function(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n};return n.getPoint=function(t,n,a){return r(a)||(a=new e),a=e.multiplyByScalar(t.direction,n,a),e.add(t.origin,a,a)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(t,n,a,o,u){u=r(u,!1);var s,c,l,f,d,h=t.origin,m=t.direction,y=e.subtract(a,n,p),E=e.subtract(o,n,v),S=e.cross(m,E,g),M=e.dot(y,S);if(u){if(M<i.EPSILON6)return void 0;if(s=e.subtract(h,n,w),l=e.dot(s,S),0>l||l>M)return void 0;if(c=e.cross(s,y,x),f=e.dot(m,c),0>f||l+f>M)return void 0;d=e.dot(E,c)/M}else{if(Math.abs(M)<i.EPSILON6)return void 0;var b=1/M;if(s=e.subtract(h,n,w),l=e.dot(s,S)*b,0>l||l>1)return void 0;if(c=e.cross(s,y,x),f=e.dot(m,c)*b,0>f||l+f>1)return void 0;d=e.dot(E,c)*b}return d}function f(e,t,r,n){var a=t*t-4*e*r;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-t/(2*e);return 0===c?void 0:(n.root0=n.root1=c,n)}function d(t,r,a){n(a)||(a={});var i=t.origin,o=t.direction,u=r.center,s=r.radius*r.radius,c=e.subtract(i,u,g),l=e.dot(o,o),d=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=f(l,d,h,S);return n(m)?(a.start=m.root0,a.stop=m.root1,a):void 0}function h(e,t,r){var n=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))<r?0:n}function m(t,r,n,a,c){var l,f=a*a,d=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*d,y=c*(a*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+r.y),p=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*d+a*r.x+n,v=d*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+r.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,y,p),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],M=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-M)),w.push(new e(a,c*S,c*M))}return w}var b=g*g,T=v*v,A=m*m,O=g*v,I=A+T,N=2*(y*m+O),z=2*p*m+y*y-T+b,P=2*(p*y-O),R=p*p-b;if(0===I&&0===N&&0===z&&0===P)return w;l=s.computeRealRoots(I,N,z,P,R);var _=l.length;if(0===_)return w;for(var L=0;_>L;++L){var C,q=l[L],D=q*q,B=Math.max(1-D,0),U=Math.sqrt(B);C=i.sign(m)===i.sign(p)?h(m*D+p,y*q,i.EPSILON12):i.sign(p)===i.sign(y*q)?h(m*D,y*q+p,i.EPSILON12):h(m*D+y*q,p,i.EPSILON12);var F=h(v*q,g,i.EPSILON15),G=C*F;0>G?w.push(new e(a,c*q,c*U)):G>0?w.push(new e(a,c*q,c*-U)):0!==U?(w.push(new e(a,c*q,c*-U)),w.push(new e(a,c*q,c*U)),++L):w.push(new e(a,c*q,c*U))}return w}var y={};y.rayPlane=function(t,r,a){n(a)||(a=new e);var o=t.origin,u=t.direction,s=r.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-r.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var p=new e,v=new e,g=new e,w=new e,x=new e;y.rayTriangle=function(t,r,a,i,o,u){var s=l(t,r,a,i,o);return!n(s)||0>s?void 0:(n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;y.lineSegmentTriangle=function(t,r,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(r,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,a,i,o,u);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};y.raySphere=function(e,t,r){return r=d(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var M=new c;y.lineSegmentSphere=function(t,r,a,i){var o=M;e.clone(t,o.origin);var u=e.subtract(r,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=d(o,a,i),!n(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var b=new e,T=new e;y.rayEllipsoid=function(t,r){var n,a,i,o,u,s=r.oneOverRadii,c=e.multiplyComponents(s,t.origin,b),l=e.multiplyComponents(s,t.direction,T),f=e.magnitudeSquared(c),d=e.dot(c,l);if(f>1){if(d>=0)return void 0;var h=d*d;if(n=f-1,a=e.magnitudeSquared(l),i=a*n,i>h)return void 0;if(h>i){o=d*d-i,u=-d+Math.sqrt(o);var m=u/a,y=n/u;return y>m?{start:m,stop:y}:{start:y,stop:m}}var p=Math.sqrt(n/a);return{start:p,stop:p}}return 1>f?(n=f-1,a=e.magnitudeSquared(l),i=a*n,o=d*d-i,u=-d+Math.sqrt(o),{start:0,stop:u/a}):0>d?(a=e.magnitudeSquared(l),{start:0,stop:-d/a}):void 0};var A=new e,O=new e,I=new e,N=new e,z=new e,P=new o,R=new o,_=new o,L=new o,C=new o,q=new o,D=new o,B=new e,U=new e,F=new t;y.grazingAltitudeLocation=function(t,r){var a=t.origin,u=t.direction,s=r.geodeticSurfaceNormal(a,A);if(e.dot(u,s)>=0)return a;var c=n(this.rayEllipsoid(t,r)),l=r.transformPositionToScaledSpace(u,A),f=e.normalize(l,l),d=e.mostOrthogonalAxis(l,N),h=e.normalize(e.cross(d,f,O),O),y=e.normalize(e.cross(f,h,I),I),p=P;p[0]=f.x,p[1]=f.y,p[2]=f.z,p[3]=h.x,p[4]=h.y,p[5]=h.z,p[6]=y.x,p[7]=y.y,p[8]=y.z;var v=o.transpose(p,R),g=o.fromScale(r.radii,_),w=o.fromScale(r.oneOverRadii,L),x=C;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,M=o.multiply(o.multiply(v,w,q),x,q),b=o.multiply(o.multiply(M,g,D),p,D),T=o.multiplyByVector(M,a,z),G=m(b,e.negate(T,A),0,0,1),W=G.length;if(W>0){for(var V=e.clone(e.ZERO,U),k=Number.NEGATIVE_INFINITY,Y=0;W>Y;++Y){E=o.multiplyByVector(g,o.multiplyByVector(p,G[Y],B),B);var j=e.normalize(e.subtract(E,a,N),N),H=e.dot(j,u);H>k&&(k=H,V=e.clone(E,V))}var Z=r.cartesianToCartographic(V,F);return k=i.clamp(k,0,1),S=e.magnitude(e.subtract(V,a,N))*Math.sqrt(1-k*k),S=c?-S:S,Z.height=S,r.cartographicToCartesian(Z,new e)}return void 0};var G=new e;return y.lineSegmentPlane=function(t,r,a,o){n(o)||(o=new e);var u=e.subtract(r,t,G),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(a.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},y.trianglePlaneIntersection=function(t,r,n,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,r)+o<0,c=e.dot(i,n)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,d;if((1===l||2===l)&&(f=new e,d=new e),1===l){if(u)return y.lineSegmentPlane(t,r,a,f),y.lineSegmentPlane(t,n,a,d),{positions:[t,r,n,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(s)return y.lineSegmentPlane(r,n,a,f),y.lineSegmentPlane(r,t,a,d),{positions:[t,r,n,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return y.lineSegmentPlane(n,t,a,f),y.lineSegmentPlane(n,r,a,d),{positions:[t,r,n,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return y.lineSegmentPlane(r,t,a,f),y.lineSegmentPlane(n,t,a,d),{positions:[t,r,n,f,d],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return y.lineSegmentPlane(n,r,a,f),y.lineSegmentPlane(t,r,a,d),{positions:[t,r,n,f,d],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return y.lineSegmentPlane(t,n,a,f),y.lineSegmentPlane(r,n,a,d),{positions:[t,r,n,f,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},y}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};return r.calculateACMR=function(r){r=e(r,e.EMPTY_OBJECT);var n=r.indices,a=r.maximumIndex,i=e(r.cacheSize,24),o=n.length;if(!t(a)){a=0;for(var u=0,s=n[u];o>u;)s>a&&(a=s),++u,s=n[u]}for(var c=[],l=0;a+1>l;l++)c[l]=0;for(var f=i+1,d=0;o>d;++d)f-c[n[d]]>i&&(c[n[d]]=f,++f);return(f-i+1)/(o/3)},r.tipsify=function(r){function n(e,t,r,n){for(;t.length>=1;){var a=t[t.length-1];if(t.splice(t.length-1,1),e[a].numLiveTriangles>0)return a}for(;n>i;){if(e[i].numLiveTriangles>0)return++i,i-1;++i}return-1}function a(e,t,r,a,i,o,u){for(var s,c=-1,l=-1,f=0;f<r.length;){var d=r[f];a[d].numLiveTriangles&&(s=0,i-a[d].timeStamp+2*a[d].numLiveTriangles<=t&&(s=i-a[d].timeStamp),(s>l||-1===l)&&(l=s,c=d)),++f}return-1===c?n(a,o,e,u):c}r=e(r,e.EMPTY_OBJECT);var i,o=r.indices,u=r.maximumIndex,s=e(r.cacheSize,24),c=o.length,l=0,f=0,d=o[f],h=c;if(t(u))l=u+1;else{for(;h>f;)d>l&&(l=d),++f,d=o[f];if(-1===l)return 0;++l}for(var m=[],y=0;l>y;y++)m[y]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var p=0;h>f;)m[o[f]].vertexTriangles.push(p),++m[o[f]].numLiveTriangles,m[o[f+1]].vertexTriangles.push(p),++m[o[f+1]].numLiveTriangles,m[o[f+2]].vertexTriangles.push(p),++m[o[f+2]].numLiveTriangles,++p,f+=3;var v=0,g=s+1;i=1;var w,x,E=[],S=[],M=0,b=[],T=c/3,A=[];for(y=0;T>y;y++)A[y]=!1;for(var O,I;-1!==v;){E=[],x=m[v],I=x.vertexTriangles.length;for(var N=0;I>N;++N)if(p=x.vertexTriangles[N],!A[p]){A[p]=!0,f=p+p+p;for(var z=0;3>z;++z)O=o[f],E.push(O),S.push(O),b[M]=O,++M,w=m[O],--w.numLiveTriangles,g-w.timeStamp>s&&(w.timeStamp=g,++g),++f}v=a(o,s,E,m,g,S,l)}return b},r}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m,y,p,v,g,w,x,E,S,M,b,T){"use strict";function A(e,t,r,n,a){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=a,e[t++]=a,e[t]=r}function O(e){for(var t=e.length,r=6*(t/3),n=v.createTypedArray(t,r),a=0,i=0;t>i;i+=3,a+=6)A(n,a,e[i],e[i+1],e[i+2]);return n}function I(e){var t=e.length;if(t>=3){var r=6*(t-2),n=v.createTypedArray(t,r);A(n,0,e[0],e[1],e[2]);for(var a=6,i=3;t>i;++i,a+=6)A(n,a,e[i-1],e[i],e[i-2]);return n}return new Uint16Array}function N(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=v.createTypedArray(t,r),a=e[0],i=0,o=1;t>o;++o,i+=6)A(n,i,a,e[o],e[o+1]);return n}return new Uint16Array}function z(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new m({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function P(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var a=t[n],i=0;i<a.componentsPerAttribute;++i)e[n].values.push(a.values[r*a.componentsPerAttribute+i])}function R(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,it),S.multiplyByPoint(e,it,it),a.pack(it,r,i)}function _(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,it),E.multiplyByVector(e,it,it),it=a.normalize(it,it),a.pack(it,r,i)}function L(e,t){var r,n=e.length,a={},i=e[0][t].attributes;for(r in i)if(i.hasOwnProperty(r)&&c(i[r])&&c(i[r].values)){for(var o=i[r],s=o.values.length,l=!0,f=1;n>f;++f){var d=e[f][t].attributes[r];if(!c(d)||o.componentDatatype!==d.componentDatatype||o.componentsPerAttribute!==d.componentsPerAttribute||o.normalize!==d.normalize){l=!1;break}s+=d.values.length}l&&(a[r]=new m({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return a}function C(e,t){var n,i,o,u,s=e.length;e[0].modelMatrix;var l,f,d,m=c(e[0][t].indices),y=e[0][t].primitiveType,p=L(e,t);for(n in p)if(p.hasOwnProperty(n))for(l=p[n].values,u=0,i=0;s>i;++i)for(f=e[i][t].attributes[n].values,d=f.length,o=0;d>o;++o)l[u++]=f[o];var g;if(m){var w=0;for(i=0;s>i;++i)w+=e[i][t].indices.length;var x=h.computeNumberOfVertices(new h({attributes:p,primitiveType:b.POINTS})),E=v.createTypedArray(x,w),S=0,M=0;for(i=0;s>i;++i){var T=e[i][t].indices,A=T.length;for(u=0;A>u;++u)E[S++]=M+T[u];M+=h.computeNumberOfVertices(e[i][t])}g=E}var O,I=new a,N=0;for(i=0;s>i;++i){if(O=e[i][t].boundingSphere,!c(O)){I=void 0;break}a.add(O.center,I,I)}if(c(I))for(a.divideByScalar(I,s,I),i=0;s>i;++i){O=e[i][t].boundingSphere;var z=a.magnitude(a.subtract(O.center,I,st))+O.radius;z>N&&(N=z)}return new h({attributes:p,indices:g,primitiveType:y,boundingSphere:c(I)?new r(I,N):void 0})}function q(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function D(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,a=3;t>a;++a)r[n++]=a-1,r[n++]=0,r[n++]=a;return e.indices=r,e.primitiveType=b.TRIANGLES,e}function B(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,a=3;t-1>a;a+=2)r[n++]=a,r[n++]=a-1,r[n++]=a+1,t>a+2&&(r[n++]=a,r[n++]=a+1,r[n++]=a+2);return e.indices=r,e.primitiveType=b.TRIANGLES,e}function U(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function F(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return e.indices=r,e.primitiveType=b.LINES,e}function G(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=b.LINES,e}function W(e){switch(e.primitiveType){case b.TRIANGLE_FAN:return D(e);case b.TRIANGLE_STRIP:return B(e);case b.TRIANGLES:return q(e);case b.LINE_STRIP:return F(e);case b.LINE_LOOP:return G(e);case b.LINES:return U(e)}return e}function V(e,t){Math.abs(e.y)<x.EPSILON6&&(e.y=t?-x.EPSILON6:x.EPSILON6)}function k(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return V(e,e.y<0),V(t,t.y<0),V(r,r.y<0),void 0;var n,a=Math.abs(e.y),i=Math.abs(t.y),o=Math.abs(r.y);n=a>i?a>o?x.sign(e.y):x.sign(r.y):i>o?x.sign(t.y):x.sign(r.y);var u=0>n;V(e,u),V(t,u),V(r,u)}function Y(e,t,r,n){a.add(e,a.multiplyByScalar(a.subtract(t,e,xt),e.y/(e.y-t.y),xt),r),a.clone(r,n),V(r,!0),V(n,!1)}function j(e,t,r){if(e.x>=0||t.x>=0||r.x>=0)return void 0;k(e,t,r);var n=e.y<0,a=t.y<0,i=r.y<0,o=0;o+=n?1:0,o+=a?1:0,o+=i?1:0;var u=Tt.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(Y(e,t,Et,Mt),Y(e,r,St,bt),u[0]=0,u[3]=1,u[4]=2,u[6]=1):a?(Y(t,r,Et,Mt),Y(t,e,St,bt),u[0]=1,u[3]=2,u[4]=0,u[6]=2):i&&(Y(r,e,Et,Mt),Y(r,t,St,bt),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,n?a?i||(Y(r,e,Et,Mt),Y(r,t,St,bt),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(Y(t,r,Et,Mt),Y(t,e,St,bt),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(Y(e,t,Et,Mt),Y(e,r,St,bt),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=Tt.positions;return s[0]=e,s[1]=t,s[2]=r,s.length=3,(1===o||2===o)&&(s[3]=Et,s[4]=St,s[5]=Mt,s[6]=bt,s.length=7),Tt}function H(e,t){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var a in n)if(n.hasOwnProperty(a)&&c(n[a])&&c(n[a].values)){var i=n[a]; -i.values=u.createTypedArray(i.componentDatatype,i.values)}var o=h.computeNumberOfVertices(e);return e.indices=v.createTypedArray(o,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}function Z(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var a=t[n];r[n]=new m({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:[]})}return new h({attributes:r,indices:[],primitiveType:e.primitiveType})}function X(e,t,r){var n=c(e.geometry.boundingSphere);t=H(t,n),r=H(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function Q(e,r,i,o,u,s,l,f,d,h,m){if(c(s)||c(l)||c(f)||c(d)){var y=a.fromArray(u,3*e,At),p=a.fromArray(u,3*r,Ot),v=a.fromArray(u,3*i,It),g=t(o,y,p,v,Nt);if(c(s)){var w=a.fromArray(s,3*e,At),x=a.fromArray(s,3*r,Ot),E=a.fromArray(s,3*i,It);a.multiplyByScalar(w,g.x,w),a.multiplyByScalar(x,g.y,x),a.multiplyByScalar(E,g.z,E);var S=a.add(w,x,w);a.add(S,E,S),a.normalize(S,S),a.pack(S,h.normal.values,3*m)}if(c(l)){var M=a.fromArray(l,3*e,At),b=a.fromArray(l,3*r,Ot),T=a.fromArray(l,3*i,It);a.multiplyByScalar(M,g.x,M),a.multiplyByScalar(b,g.y,b),a.multiplyByScalar(T,g.z,T);var A=a.add(M,b,M);a.add(A,T,A),a.normalize(A,A),a.pack(A,h.binormal.values,3*m)}if(c(f)){var O=a.fromArray(f,3*e,At),I=a.fromArray(f,3*r,Ot),N=a.fromArray(f,3*i,It);a.multiplyByScalar(O,g.x,O),a.multiplyByScalar(I,g.y,I),a.multiplyByScalar(N,g.z,N);var z=a.add(O,I,O);a.add(z,N,z),a.normalize(z,z),a.pack(z,h.tangent.values,3*m)}if(c(d)){var P=n.fromArray(d,2*e,zt),R=n.fromArray(d,2*r,Pt),_=n.fromArray(d,2*i,Rt);n.multiplyByScalar(P,g.x,P),n.multiplyByScalar(R,g.y,R),n.multiplyByScalar(_,g.z,_);var L=n.add(P,R,P);n.add(L,_,L),n.pack(L,h.st.values,2*m)}}}function K(e,t,r,n,a,i){var o=e.position.values.length/3;if(-1!==a){var u=n[a],s=r[u];return-1===s?(r[u]=o,e.position.values.push(i.x,i.y,i.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(i.x,i.y,i.z),t.push(o),o}function J(e){var t,r,n,i,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,d=c(s.binormal)?s.binormal.values:void 0,h=c(s.tangent)?s.tangent.values:void 0,m=c(s.st)?s.st.values:void 0,y=u.indices,p=Z(u),v=Z(u),g=[];g.length=l.length/3;var w=[];for(w.length=l.length/3,o=0;o<g.length;++o)g[o]=-1,w[o]=-1;var x=y.length;for(o=0;x>o;o+=3){var E=y[o],S=y[o+1],M=y[o+2],b=a.fromArray(l,3*E),T=a.fromArray(l,3*S),A=a.fromArray(l,3*M),O=j(b,T,A);if(c(O)&&O.positions.length>3)for(var I=O.positions,N=O.indices,z=N.length,P=0;z>P;++P){var R=N[P],_=I[R];_.y<0?(t=v.attributes,r=v.indices,n=g):(t=p.attributes,r=p.indices,n=w),i=K(t,r,n,y,3>R?o+R:-1,_),Q(E,S,M,_,l,f,d,h,m,t,i)}else c(O)&&(b=O.positions[0],T=O.positions[1],A=O.positions[2]),b.y<0?(t=v.attributes,r=v.indices,n=g):(t=p.attributes,r=p.indices,n=w),i=K(t,r,n,y,o,b),Q(E,S,M,b,l,f,d,h,m,t,i),i=K(t,r,n,y,o+1,T),Q(E,S,M,T,l,f,d,h,m,t,i),i=K(t,r,n,y,o+2,A),Q(E,S,M,A,l,f,d,h,m,t,i)}X(e,v,p)}function $(e){var t,r=e.geometry,n=r.attributes,i=n.position.values,o=r.indices,u=Z(r),s=Z(r),l=o.length,f=[];f.length=i.length/3;var d=[];for(d.length=i.length/3,t=0;t<f.length;++t)f[t]=-1,d[t]=-1;for(t=0;l>t;t+=2){var h=o[t],m=o[t+1],y=a.fromArray(i,3*h,At),p=a.fromArray(i,3*m,Ot);Math.abs(y.y)<x.EPSILON6&&(y.y=y.y<0?-x.EPSILON6:x.EPSILON6),Math.abs(p.y)<x.EPSILON6&&(p.y=p.y<0?-x.EPSILON6:x.EPSILON6);var v=u.attributes,g=u.indices,E=d,S=s.attributes,M=s.indices,b=f,T=w.lineSegmentPlane(y,p,_t,It);if(c(T)){var A=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,Lt);y.y<0&&(a.negate(A,A),v=s.attributes,g=s.indices,E=f,S=u.attributes,M=u.indices,b=d);var O=a.add(T,A,Ct);K(v,g,E,o,t,y),K(v,g,E,o,-1,O),a.negate(A,A),a.add(T,A,O),K(S,M,b,o,-1,O),K(S,M,b,o,t+1,p)}else{var I,N,z;y.y<0?(I=s.attributes,N=s.indices,z=f):(I=u.attributes,N=u.indices,z=d),K(I,N,z,o,t,y),K(I,N,z,o,t+1,p)}}X(e,s,u)}function et(e){var t=e.geometry,r=t.attributes,o=r.position.values,u=r.prevPosition.values,s=r.nextPosition.values,l=r.expandAndWidth.values;t.indices;var f,d,h,m=c(r.st)?r.st.values:void 0,y=c(r.color)?r.color.values:void 0,p=Z(t),v=Z(t),g=o.length/3;for(f=0;g>f;f+=4){var E=f,S=f+1,M=f+2,b=f+3,T=a.fromArray(o,3*E,Bt),A=a.fromArray(o,3*S,Ut),O=a.fromArray(o,3*M,Ft),I=a.fromArray(o,3*b,Gt);Math.abs(T.y)<x.EPSILON6&&(T.y=x.EPSILON6*(O.y<0?-1:1),A.y=T.y),Math.abs(O.y)<x.EPSILON6&&(O.y=x.EPSILON6*(T.y<0?-1:1),I.y=O.y);var N=p.attributes,z=p.indices,P=v.attributes,R=v.indices,_=w.lineSegmentPlane(T,O,_t,Wt);if(c(_)){var L=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,Vt);T.y<0&&(a.negate(L,L),N=v.attributes,z=v.indices,P=p.attributes,R=p.indices);var C=a.add(_,L,kt);for(N.position.values.push(T.x,T.y,T.z,A.x,A.y,A.z),N.position.values.push(C.x,C.y,C.z),N.position.values.push(C.x,C.y,C.z),a.negate(L,L),a.add(_,L,C),P.position.values.push(C.x,C.y,C.z),P.position.values.push(C.x,C.y,C.z),P.position.values.push(O.x,O.y,O.z,I.x,I.y,I.z),d=3*E;3*E+6>d;++d)N.prevPosition.values.push(u[d]);for(N.prevPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),P.prevPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),d=3*M;3*M+6>d;++d)P.prevPosition.values.push(u[d]);for(d=3*E;3*E+6>d;++d)N.nextPosition.values.push(s[d]);for(N.nextPosition.values.push(O.x,O.y,O.z,O.x,O.y,O.z),P.nextPosition.values.push(O.x,O.y,O.z,O.x,O.y,O.z),d=3*M;3*M+6>d;++d)P.nextPosition.values.push(s[d]);var q=n.fromArray(l,2*E,qt),D=Math.abs(q.y);N.expandAndWidth.values.push(-1,D,1,D),N.expandAndWidth.values.push(-1,-D,1,-D),P.expandAndWidth.values.push(-1,D,1,D),P.expandAndWidth.values.push(-1,-D,1,-D);var B=a.magnitudeSquared(a.subtract(_,T,Gt));if(B/=a.magnitudeSquared(a.subtract(O,T,Gt)),c(y)){var U=i.fromArray(y,4*E,Yt),F=i.fromArray(y,4*M,Yt),G=x.lerp(U.x,F.x,B),W=x.lerp(U.y,F.y,B),V=x.lerp(U.z,F.z,B),k=x.lerp(U.w,F.w,B);for(d=4*E;4*E+8>d;++d)N.color.values.push(y[d]);for(N.color.values.push(G,W,V,k),N.color.values.push(G,W,V,k),P.color.values.push(G,W,V,k),P.color.values.push(G,W,V,k),d=4*M;4*M+8>d;++d)P.color.values.push(y[d])}if(c(m)){var Y=n.fromArray(m,2*E,qt),j=n.fromArray(m,2*(f+3),Dt),H=x.lerp(Y.x,j.x,B);for(d=2*E;2*E+4>d;++d)N.st.values.push(m[d]);for(N.st.values.push(H,Y.y),N.st.values.push(H,j.y),P.st.values.push(H,Y.y),P.st.values.push(H,j.y),d=2*M;2*M+4>d;++d)P.st.values.push(m[d])}h=N.position.values.length/3-4,z.push(h,h+2,h+1),z.push(h+1,h+2,h+3),h=P.position.values.length/3-4,R.push(h,h+2,h+1),R.push(h+1,h+2,h+3)}else{var Q,K;for(T.y<0?(Q=v.attributes,K=v.indices):(Q=p.attributes,K=p.indices),Q.position.values.push(T.x,T.y,T.z),Q.position.values.push(A.x,A.y,A.z),Q.position.values.push(O.x,O.y,O.z),Q.position.values.push(I.x,I.y,I.z),d=3*f;3*f+12>d;++d)Q.prevPosition.values.push(u[d]),Q.nextPosition.values.push(s[d]);for(d=2*f;2*f+8>d;++d)Q.expandAndWidth.values.push(l[d]),c(m)&&Q.st.values.push(m[d]);if(c(y))for(d=4*f;4*f+16>d;++d)Q.color.values.push(y[d]);h=Q.position.values.length/3-4,K.push(h,h+2,h+1),K.push(h+1,h+2,h+3)}}X(e,v,p)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case b.TRIANGLES:e.indices=O(t);break;case b.TRIANGLE_STRIP:e.indices=I(t);break;case b.TRIANGLE_FAN:e.indices=N(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=b.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,n){t=s(t,"normal"),n=s(n,1e4);for(var a=e.attributes.position.values,i=e.attributes[t].values,o=a.length,l=new Float64Array(2*o),f=0,d=0;o>d;d+=3)l[f++]=a[d],l[f++]=a[d+1],l[f++]=a[d+2],l[f++]=a[d]+i[d]*n,l[f++]=a[d+1]+i[d+1]*n,l[f++]=a[d+2]+i[d+2]*n;var y,p=e.boundingSphere;return c(p)&&(y=new r(p.center,p.radius+n)),new h({attributes:{position:new m({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:b.LINES,boundingSphere:y})},tt.createAttributeLocations=function(e){var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,a={},i=0,o=r.length;for(t=0;o>t;++t){var u=r[t];c(n[u])&&(a[u]=i++)}for(var s in n)n.hasOwnProperty(s)&&!c(a[s])&&(a[s]=i++);return a},tt.reorderForPreVertexCache=function(e){var t=h.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),a=0;t>a;a++)n[a]=-1;for(var i,o=r,s=o.length,l=v.createTypedArray(t,s),f=0,d=0,m=0;s>f;)i=n[o[f]],-1!==i?l[d]=i:(i=o[f],n[i]=m,l[d]=m,++m),++f,++d;e.indices=l;var y=e.attributes;for(var p in y)if(y.hasOwnProperty(p)&&c(y[p])&&c(y[p].values)){for(var g=y[p],w=g.values,x=0,E=g.componentsPerAttribute,S=u.createTypedArray(g.componentDatatype,m*E);t>x;){var M=n[x];if(-1!==M)for(a=0;E>a;a++)S[E*M+a]=w[E*x+a];++x}g.values=S}}return e},tt.reorderForPostVertexCache=function(e,t){var r=e.indices;if(e.primitiveType===b.TRIANGLES&&c(r)){for(var n=r.length,a=0,i=0;n>i;i++)r[i]>a&&(a=r[i]);e.indices=T.tipsify({indices:r,maximumIndex:a,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],r=h.computeNumberOfVertices(e);if(c(e.indices)&&r>x.SIXTY_FOUR_KILOBYTES){var n,a=[],i=[],o=0,u=z(e.attributes),s=e.indices,l=s.length;e.primitiveType===b.TRIANGLES?n=3:e.primitiveType===b.LINES?n=2:e.primitiveType===b.POINTS&&(n=1);for(var f=0;l>f;f+=n){for(var d=0;n>d;++d){var m=s[f+d],y=a[m];c(y)||(y=o++,a[m]=y,P(u,e.attributes,m)),i.push(y)}o+n>x.SIXTY_FOUR_KILOBYTES&&(t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],i=[],o=0,u=z(e.attributes))}0!==i.length&&t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var rt=new a,nt=new o;tt.projectTo2D=function(e,t,r,n,i){var o=e.attributes[t];i=c(i)?i:new d;for(var s=i.ellipsoid,f=o.values,h=new Float64Array(f.length),y=0,p=0;p<f.length;p+=3){var v=a.fromArray(f,p,rt),g=s.cartesianToCartographic(v,nt);if(!c(g))throw new l("Could not project point ("+v.x+", "+v.y+", "+v.z+") to 2D.");var w=i.project(g,rt);h[y++]=w.x,h[y++]=w.y,h[y++]=w.z}return e.attributes[r]=o,e.attributes[n]=new m({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:h}),delete e.attributes[t],e};var at={high:0,low:0};tt.encodeAttribute=function(e,t,r,n){for(var a=e.attributes[t],i=a.values,o=i.length,s=new Float32Array(o),c=new Float32Array(o),l=0;o>l;++l)f.encode(i[l],at),s[l]=at.high,c[l]=at.low;var d=a.componentsPerAttribute;return e.attributes[r]=new m({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:s}),e.attributes[n]=new m({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:c}),delete e.attributes[t],e};var it=new a,ot=new S,ut=new E;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(S.equals(t,S.IDENTITY))return e;var n=e.geometry.attributes;R(t,n.position),R(t,n.prevPosition),R(t,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(S.inverse(t,ot),S.transpose(ot,ot),S.getRotation(ot,ut),_(ut,n.normal),_(ut,n.binormal),_(ut,n.tangent));var a=e.geometry.boundingSphere;return c(a)&&(e.geometry.boundingSphere=r.transform(a,t,a)),e.modelMatrix=S.clone(S.IDENTITY),e};var st=new a;tt.combineInstances=function(e){for(var t=[],r=[],n=e.length,a=0;n>a;++a){var i=e[a];c(i.geometry)?t.push(i):r.push(i)}var o=[];return t.length>0&&o.push(C(t,"geometry")),r.length>0&&(o.push(C(r,"westHemisphereGeometry")),o.push(C(r,"eastHemisphereGeometry"))),o};var ct=new a,lt=new a,ft=new a,dt=new a;tt.computeNormal=function(e){for(var t=e.indices,r=e.attributes,n=r.position.values,i=r.position.values.length/3,o=t.length,s=new Array(i),c=new Array(o/3),l=new Array(o),f=0;i>f;f++)s[f]={indexOffset:0,count:0,currentCount:0};var d=0;for(f=0;o>f;f+=3){var h=t[f],y=t[f+1],p=t[f+2],v=3*h,g=3*y,w=3*p;lt.x=n[v],lt.y=n[v+1],lt.z=n[v+2],ft.x=n[g],ft.y=n[g+1],ft.z=n[g+2],dt.x=n[w],dt.y=n[w+1],dt.z=n[w+2],s[h].count++,s[y].count++,s[p].count++,a.subtract(ft,lt,ft),a.subtract(dt,lt,dt),c[d]=a.cross(ft,dt,new a),d++}var x=0;for(f=0;i>f;f++)s[f].indexOffset+=x,x+=s[f].count;d=0;var E;for(f=0;o>f;f+=3){E=s[t[f]];var S=E.indexOffset+E.currentCount;l[S]=d,E.currentCount++,E=s[t[f+1]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,E=s[t[f+2]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,d++}var M=new Float32Array(3*i);for(f=0;i>f;f++){var b=3*f;if(E=s[f],E.count>0){for(a.clone(a.ZERO,ct),d=0;d<E.count;d++)a.add(ct,c[l[E.indexOffset+d]],ct);a.normalize(ct,ct),M[b]=ct.x,M[b+1]=ct.y,M[b+2]=ct.z}else M[b]=0,M[b+1]=0,M[b+2]=1}return e.attributes.normal=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:M}),e};var ht=new a,mt=new a,yt=new a;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,r=e.attributes.position.values,n=e.attributes.normal.values,i=e.attributes.st.values,o=e.attributes.position.values.length/3,s=t.length,c=new Array(3*o),l=0;l<c.length;l++)c[l]=0;var f,d,h;for(l=0;s>l;l+=3){var y=t[l],p=t[l+1],v=t[l+2];f=3*y,d=3*p,h=3*v;var g=2*y,w=2*p,x=2*v,E=r[f],S=r[f+1],M=r[f+2],b=i[g],T=i[g+1],A=i[w+1]-T,O=i[x+1]-T,I=1/((i[w]-b)*O-(i[x]-b)*A),N=(O*(r[d]-E)-A*(r[h]-E))*I,z=(O*(r[d+1]-S)-A*(r[h+1]-S))*I,P=(O*(r[d+2]-M)-A*(r[h+2]-M))*I;c[f]+=N,c[f+1]+=z,c[f+2]+=P,c[d]+=N,c[d+1]+=z,c[d+2]+=P,c[h]+=N,c[h+1]+=z,c[h+2]+=P}var R=new Float32Array(3*o),_=new Float32Array(3*o);for(l=0;o>l;l++){f=3*l,d=f+1,h=f+2;var L=a.fromArray(n,f,ht),C=a.fromArray(c,f,yt),q=a.dot(L,C);a.multiplyByScalar(L,q,mt),a.normalize(a.subtract(C,mt,C),C),_[f]=C.x,_[d]=C.y,_[h]=C.z,a.normalize(a.cross(L,C,C),C),R[f]=C.x,R[d]=C.y,R[h]=C.z}return e.attributes.tangent=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:_}),e.attributes.binormal=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:R}),e};var pt=new n,vt=new a,gt=new a,wt=new a;tt.compressVertices=function(t){var r=t.attributes.normal,i=t.attributes.st;if(!c(r)&&!c(i))return t;var o,s,l,f,d=t.attributes.tangent,h=t.attributes.binormal;c(r)&&(o=r.values),c(i)&&(s=i.values),c(d)&&(l=d.values),h&&(f=h.values);var y=c(o)?o.length:s.length,p=c(o)?3:2,v=y/p,g=v,w=c(s)&&c(o)?2:1;w+=c(l)||c(f)?1:0,g*=w;for(var x=new Float32Array(g),E=0,S=0;v>S;++S){c(s)&&(n.fromArray(s,2*S,pt),x[E++]=e.compressTextureCoordinates(pt));var M=3*S;c(o)&&c(l)&&c(f)?(a.fromArray(o,M,vt),a.fromArray(l,M,gt),a.fromArray(f,M,wt),e.octPack(vt,gt,wt,pt),x[E++]=pt.x,x[E++]=pt.y):(c(o)&&(a.fromArray(o,M,vt),x[E++]=e.octEncodeFloat(vt)),c(l)&&(a.fromArray(l,M,vt),x[E++]=e.octEncodeFloat(vt)),c(f)&&(a.fromArray(f,M,vt),x[E++]=e.octEncodeFloat(vt)))}return t.attributes.compressedAttributes=new m({componentDatatype:u.FLOAT,componentsPerAttribute:w,values:x}),c(o)&&delete t.attributes.normal,c(s)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var xt=new a,Et=new a,St=new a,Mt=new a,bt=new a,Tt={positions:new Array(7),indices:new Array(9)},At=new a,Ot=new a,It=new a,Nt=new a,zt=new n,Pt=new n,Rt=new n,_t=M.fromPointNormal(a.ZERO,a.UNIT_Y),Lt=new a,Ct=new a,qt=new n,Dt=new n,Bt=new a,Ut=new a,Ft=new a,Gt=new a,Wt=new a,Vt=new a,kt=new a,Yt=new i;return new i,tt.splitLongitude=function(e){var t=e.geometry,n=t.boundingSphere;if(c(n)){var a=n.center.x-n.radius;if(a>0||r.intersectPlane(n,M.ORIGIN_ZX_PLANE)!==g.INTERSECTING)return e}if(t.geometryType!==p.NONE)switch(t.geometryType){case p.POLYLINES:et(e);break;case p.TRIANGLES:J(e);break;case p.LINES:$(e)}else W(t),t.primitiveType===b.TRIANGLES?J(e):t.primitiveType===b.LINES&&$(e);return e},tt}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return a.POSITION_ONLY=n(new a({position:!0})),a.POSITION_AND_NORMAL=n(new a({position:!0,normal:!0})),a.POSITION_NORMAL_AND_ST=n(new a({position:!0,normal:!0,st:!0})),a.POSITION_AND_ST=n(new a({position:!0,st:!0})),a.POSITION_AND_COLOR=n(new a({position:!0,color:!0})),a.ALL=n(new a({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),a.DEFAULT=a.POSITION_NORMAL_AND_ST,a.packedLength=6,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.position?1:0,r[n++]=t.normal?1:0,r[n++]=t.st?1:0,r[n++]=t.binormal?1:0,r[n++]=t.tangent?1:0,r[n++]=t.color?1:0},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.position=1===r[n++],i.normal=1===r[n++],i.st=1===r[n++],i.binormal=1===r[n++],i.tangent=1===r[n++],i.color=1===r[n++],i},a.clone=function(e,r){return t(e)?(t(r)||(r=new a),r.position=e.position,r.normal=e.normal,r.st=e.st,r.binormal=e.binormal,r.tangent=e.tangent,r.color=e.color,r):void 0},a}),define("Core/EllipseGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EllipseGeometryLibrary","./Ellipsoid","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix3","./PrimitiveType","./Quaternion","./VertexFormat"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m,y,p,v,g,w,x,E){"use strict";function S(e,n,i){var o=n.vertexFormat,u=n.center,c=n.semiMajorAxis,f=n.semiMinorAxis,m=n.ellipsoid,y=n.stRotation,p=i?2*(e.length/3):e.length/3,v=o.st?new Float32Array(2*p):void 0,w=o.normal?new Float32Array(3*p):void 0,E=o.tangent?new Float32Array(3*p):void 0,S=o.binormal?new Float32Array(3*p):void 0,M=0,b=C,T=q,A=D,O=new l(m),P=O.project(m.cartesianToCartographic(u,B),U),W=m.scaleToGeodeticSurface(u,I);m.geodeticSurfaceNormal(W,W);for(var V=x.fromAxisAngle(W,y,L),k=g.fromQuaternion(V,_),Y=t.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,F),j=t.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,G),H=e.length,Z=i?H:0,X=2*(Z/3),Q=0;H>Q;Q+=3){var K=Q+1,J=Q+2,$=r.fromArray(e,Q,I);if(o.st){var et=g.multiplyByVector(k,$,N),tt=O.project(m.cartesianToCartographic(et,B),z);r.subtract(tt,P,tt),R.x=(tt.x+c)/(2*c),R.y=(tt.y+f)/(2*f),Y.x=Math.min(R.x,Y.x),Y.y=Math.min(R.y,Y.y),j.x=Math.max(R.x,j.x),j.y=Math.max(R.y,j.y),i&&(v[M+X]=R.x,v[M+1+X]=R.y),v[M++]=R.x,v[M++]=R.y}b=m.geodeticSurfaceNormal($,b),(o.normal||o.tangent||o.binormal)&&((o.tangent||o.binormal)&&(T=r.cross(r.UNIT_Z,b,T),g.multiplyByVector(k,T,T)),o.normal&&(w[Q]=b.x,w[K]=b.y,w[J]=b.z,i&&(w[Q+Z]=-b.x,w[K+Z]=-b.y,w[J+Z]=-b.z)),o.tangent&&(E[Q]=T.x,E[K]=T.y,E[J]=T.z,i&&(E[Q+Z]=-T.x,E[K+Z]=-T.y,E[J+Z]=-T.z)),o.binormal&&(A=r.cross(b,T,A),S[Q]=A.x,S[K]=A.y,S[J]=A.z,i&&(S[Q+Z]=A.x,S[K+Z]=A.y,S[J+Z]=A.z)))}if(o.st){H=v.length;for(var rt=0;H>rt;rt+=2)v[rt]=(v[rt]-Y.x)/(j.x-Y.x),v[rt+1]=(v[rt+1]-Y.y)/(j.y-Y.y)}var nt=new h;if(o.position){var at=s.raisePositionsToHeight(e,n,i);nt.position=new d({componentDatatype:a.DOUBLE,componentsPerAttribute:3,values:at})}return o.st&&(nt.st=new d({componentDatatype:a.FLOAT,componentsPerAttribute:2,values:v})),o.normal&&(nt.normal=new d({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:w})),o.tangent&&(nt.tangent=new d({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:E})),o.binormal&&(nt.binormal=new d({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:S})),nt}function M(e){var t,r,n,a,i,o=new Array(2*e*(e+1)),u=0;for(a=1;e>a;++a){for(n=a*(a+1),t=(a-1)*a,o[u++]=n++,o[u++]=t,o[u++]=n,r=2*a,i=0;r-1>i;++i)o[u++]=n,o[u++]=t++,o[u++]=t,o[u++]=n++,o[u++]=t,o[u++]=n;o[u++]=n++,o[u++]=t,o[u++]=n}for(r=2*e,++n,++t,a=0;r-1>a;++a)o[u++]=n,o[u++]=t++,o[u++]=t,o[u++]=n++,o[u++]=t,o[u++]=n;for(++t,++n,a=e-1;a>0;--a){for(o[u++]=t++,o[u++]=t,o[u++]=n,r=2*a,i=0;r-1>i;++i)o[u++]=n,o[u++]=t++,o[u++]=t,o[u++]=n++,o[u++]=t,o[u++]=n;o[u++]=t++,o[u++]=t++,o[u++]=n++}return o}function b(t){var n=t.center;W=r.multiplyByScalar(t.ellipsoid.geodeticSurfaceNormal(n,W),t.height,W),W=r.add(n,W,W);var a=new e(W,t.semiMajorAxis),i=s.computeEllipsePositions(t,!0,!1),o=i.positions,u=i.numPts,c=S(o,t,!1),l=M(u);return l=p.createTypedArray(o.length/3,l),{boundingSphere:a,attributes:c,indices:l}}function T(e,n){var i=n.vertexFormat,o=n.center,u=n.semiMajorAxis,s=n.semiMinorAxis,c=n.ellipsoid,f=n.height,m=n.extrudedHeight,y=n.stRotation,p=2*(e.length/3),v=new Float64Array(3*p),w=i.st?new Float32Array(2*p):void 0,E=i.normal?new Float32Array(3*p):void 0,S=i.tangent?new Float32Array(3*p):void 0,M=i.binormal?new Float32Array(3*p):void 0,b=0,T=C,A=q,O=D,W=new l(c),V=W.project(c.cartesianToCartographic(o,B),U),k=c.scaleToGeodeticSurface(o,I);c.geodeticSurfaceNormal(k,k);for(var Y=x.fromAxisAngle(k,y,L),j=g.fromQuaternion(Y,_),H=t.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,F),Z=t.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,G),X=e.length,Q=2*(X/3),K=0;X>K;K+=3){var J,$=K+1,et=K+2,tt=r.fromArray(e,K,I);if(i.st){var rt=g.multiplyByVector(j,tt,N),nt=W.project(c.cartesianToCartographic(rt,B),z);r.subtract(nt,V,nt),R.x=(nt.x+u)/(2*u),R.y=(nt.y+s)/(2*s),H.x=Math.min(R.x,H.x),H.y=Math.min(R.y,H.y),Z.x=Math.max(R.x,Z.x),Z.y=Math.max(R.y,Z.y),w[b+Q]=R.x,w[b+1+Q]=R.y,w[b++]=R.x,w[b++]=R.y}tt=c.scaleToGeodeticSurface(tt,tt),J=r.clone(tt,N),T=c.geodeticSurfaceNormal(tt,T);var at=r.multiplyByScalar(T,f,P);if(tt=r.add(tt,at,tt),at=r.multiplyByScalar(T,m,at),J=r.add(J,at,J),i.position&&(v[K+X]=J.x,v[$+X]=J.y,v[et+X]=J.z,v[K]=tt.x,v[$]=tt.y,v[et]=tt.z),i.normal||i.tangent||i.binormal){O=r.clone(T,O);var it=r.fromArray(e,(K+3)%X,P);r.subtract(it,tt,it);var ot=r.subtract(J,tt,z);T=r.normalize(r.cross(ot,it,T),T),i.normal&&(E[K]=T.x,E[$]=T.y,E[et]=T.z,E[K+X]=T.x,E[$+X]=T.y,E[et+X]=T.z),i.tangent&&(A=r.normalize(r.cross(O,T,A),A),S[K]=A.x,S[$]=A.y,S[et]=A.z,S[K+X]=A.x,S[K+1+X]=A.y,S[K+2+X]=A.z),i.binormal&&(M[K]=O.x,M[$]=O.y,M[et]=O.z,M[K+X]=O.x,M[$+X]=O.y,M[et+X]=O.z)}}if(i.st){X=w.length;for(var ut=0;X>ut;ut+=2)w[ut]=(w[ut]-H.x)/(Z.x-H.x),w[ut+1]=(w[ut+1]-H.y)/(Z.y-H.y)}var st=new h;return i.position&&(st.position=new d({componentDatatype:a.DOUBLE,componentsPerAttribute:3,values:v})),i.st&&(st.st=new d({componentDatatype:a.FLOAT,componentsPerAttribute:2,values:w})),i.normal&&(st.normal=new d({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:E})),i.tangent&&(st.tangent=new d({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:S})),i.binormal&&(st.binormal=new d({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:M})),st}function A(e){for(var t=e.length/3,r=p.createTypedArray(t,6*t),n=0,a=0;t>a;a++){var i=a,o=a+t,u=(i+1)%t,s=u+t;r[n++]=i,r[n++]=o,r[n++]=u,r[n++]=u,r[n++]=o,r[n++]=s}return r}function O(t){var n=t.center,a=t.ellipsoid,i=t.semiMajorAxis,o=r.multiplyByScalar(a.geodeticSurfaceNormal(n,I),t.height,I);V.center=r.add(n,o,V.center),V.radius=i,o=r.multiplyByScalar(a.geodeticSurfaceNormal(n,o),t.extrudedHeight,o),k.center=r.add(n,o,k.center),k.radius=i;var u=s.computeEllipsePositions(t,!0,!0),c=u.positions,l=u.numPts,d=u.outerPositions,h=e.union(V,k),v=S(c,t,!0),g=M(l),x=g.length;g.length=2*x;for(var E=c.length/3,b=0;x>b;b+=3)g[b+x]=g[b+2]+E,g[b+1+x]=g[b+1]+E,g[b+2+x]=g[b]+E;var O=p.createTypedArray(2*E/3,g),N=new f({attributes:v,indices:O,primitiveType:w.TRIANGLES}),z=T(d,t);g=A(d);var P=p.createTypedArray(2*d.length/3,g),R=new f({attributes:z,indices:P,primitiveType:w.TRIANGLES}),_=y.combineInstances([new m({geometry:N}),new m({geometry:R})]);return{boundingSphere:h,attributes:_[0].attributes,indices:_[0].indices}}var I=new r,N=new r,z=new r,P=new r,R=new t,_=new g,L=new x,C=new r,q=new r,D=new r,B=new n,U=new r,F=new t,G=new t,W=new r,V=new e,k=new e,Y=function(e){e=i(e,i.EMPTY_OBJECT);var t=e.center,n=i(e.ellipsoid,c.WGS84),a=e.semiMajorAxis,u=e.semiMinorAxis,s=i(e.granularity,v.RADIANS_PER_DEGREE),l=i(e.height,0),f=e.extrudedHeight,d=o(f)&&Math.abs(l-f)>1,h=i(e.vertexFormat,E.DEFAULT);this._center=r.clone(t),this._semiMajorAxis=a,this._semiMinorAxis=u,this._ellipsoid=c.clone(n),this._rotation=i(e.rotation,0),this._stRotation=i(e.stRotation,0),this._height=l,this._granularity=s,this._vertexFormat=E.clone(h),this._extrudedHeight=i(f,l),this._extrude=d,this._workerName="createEllipseGeometry"};Y.packedLength=r.packedLength+c.packedLength+E.packedLength+8,Y.pack=function(e,t,n){n=i(n,0),r.pack(e._center,t,n),n+=r.packedLength,c.pack(e._ellipsoid,t,n),n+=c.packedLength,E.pack(e._vertexFormat,t,n),n+=E.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n]=e._extrude?1:0};var j=new r,H=new c,Z=new E,X={center:j,ellipsoid:H,vertexFormat:Z,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0};return Y.unpack=function(e,t,n){t=i(t,0);var a=r.unpack(e,t,j);t+=r.packedLength;var u=c.unpack(e,t,H);t+=c.packedLength;var s=E.unpack(e,t,Z);t+=E.packedLength;var l=e[t++],f=e[t++],d=e[t++],h=e[t++],m=e[t++],y=e[t++],p=e[t++],v=1===e[t];return o(n)?(n._center=r.clone(a,n._center),n._ellipsoid=c.clone(u,n._ellipsoid),n._vertexFormat=E.clone(s,n._vertexFormat),n._semiMajorAxis=l,n._semiMinorAxis=f,n._rotation=d,n._stRotation=h,n._height=m,n._granularity=y,n._extrudedHeight=p,n._extrude=v,n):(X.height=m,X.extrudedHeight=p,X.granularity=y,X.stRotation=h,X.rotation=d,X.semiMajorAxis=l,X.semiMinorAxis=f,new Y(X))},Y.createGeometry=function(e){e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var t,r={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:e._height,extrudedHeight:e._extrudedHeight,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};return e._extrude?(r.extrudedHeight=Math.min(e._extrudedHeight,e._height),r.height=Math.max(e._extrudedHeight,e._height),t=O(r)):t=b(r),new f({attributes:t.attributes,indices:t.indices,primitiveType:w.TRIANGLES,boundingSphere:t.boundingSphere})},Y}),define("Workers/createEllipseGeometry",["../Core/Cartesian3","../Core/defined","../Core/EllipseGeometry","../Core/Ellipsoid"],function(e,t,r,n){"use strict";function a(a,i){return t(i)&&(a=r.unpack(a,i)),a._center=e.clone(a._center),a._ellipsoid=n.clone(a._ellipsoid),r.createGeometry(a)}return a})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createEllipseOutlineGeometry.js b/libs/Cesium/Workers/createEllipseOutlineGeometry.js deleted file mode 100644 index 969702b8..00000000 --- a/libs/Cesium/Workers/createEllipseOutlineGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,i){i=t(i,r);var a=Math.abs(e-n);return i>=a||a<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],i=t;e>=i;i++)r.push(n*i);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var i=new e;return n.setRandomNumberSeed=function(t){i=new e(t)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};a.fromSpherical=function(n,r){t(r)||(r=new a);var i=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(e,n,r,i){return t(i)?(i.x=e,i.y=n,i.z=r,i):new a(e,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(e,t){a.normalize(e,s),a.normalize(t,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,l);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Z,t):n.y<=n.z?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_Z,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)},a.cross=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=t.x,u=t.y,s=t.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(e,t,n,r,o){var u=i.toRadians(e),s=i.toRadians(t);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=e(i,0);var s=t(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),t(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=i.toRadians(e[o]);return a.fromRadiansArray(r,t,n)},a.fromRadiansArray=function(e,n,r){var i=e.length;t(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=i.toRadians(e[o]),r[o+1]=i.toRadians(e[o+1]),r[o+2]=e[o+2];return a.fromRadiansArrayHeights(r,t,n)},a.fromRadiansArrayHeights=function(e,n,r){var i=e.length;t(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return a.fromRadians=function(n,r,i,o){return i=e(i,0),t(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(e,t,n,r){return e=i.toRadians(e),t=i.toRadians(t),a.fromRadians(e,t,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new a(e.longitude,e.latitude,e.height):void 0},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},a.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t){return a.equalsEpsilon(this,e,t)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";function s(t,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),t._radii=new e(r,i,a),t._radiiSquared=new e(r*r,i*i,a*a),t._radiiToTheFourth=new e(r*r*r*r,i*i*i*i,a*a*a*a),t._oneOverRadii=new e(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),t._minimumRadius=Math.min(r,i,a),t._maximumRadius=Math.max(r,i,a),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var i=t._radii;return r(n)?(e.clone(i,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,i){i=n(i,0),e.pack(t._radii,r,i)},c.unpack=function(t,r,i){r=n(r,0);var a=e.unpack(t,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var i=t.longitude,a=t.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(t,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,t.height,i),r(n)||(n=new e),e.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var h=new e,d=new e,m=new e;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=e.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,n))*e.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};var y=new e,p=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var i=t.x,a=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),g=e.multiplyByScalar(t,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?e.clone(g,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,M=x.y,S=x.z,z=p;z.x=2*g.x*E,z.y=2*g.y*M,z.z=2*g.z*S;var _,O,I,T,N,R,A,b,P,C,L,q=(1-w)*e.magnitude(t)/(.5*e.magnitude(z)),U=0;do{q-=U,I=1/(1+q*E),T=1/(1+q*M),N=1/(1+q*S),R=I*I,A=T*T,b=N*N,P=R*I,C=A*T,L=b*N,_=h*R+d*A+m*b-1,O=h*P*E+d*C*M+m*L*S;var B=-2*O;U=_/B}while(Math.abs(_)>u.EPSILON12);return r(n)?(n.x=i*I,n.y=a*T,n.z=o*N,n):new e(i*I,a*T,o*N)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var i=t.x,a=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,i,a,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var i=this._semimajorAxis,a=t.longitude*i,o=t.latitude*i,u=t.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new e(a,o,u)},u.prototype.unproject=function(e,n){var i=this._oneOverSemimajorAxis,a=e.x*i,o=e.y*i,u=e.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new t(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r,i){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(i,0)};a.fromElements=function(e,n,r,i,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=i,o):new a(e,n,r,i)},a.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,s);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)&&i.equalsEpsilon(e.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(d[n],h[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(e[c.getElementIndex(m,f)])>n){var y,p=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],w=e[c.getElementIndex(m,f)],g=(p-v)/2/w;y=0>g?-1/(-g+Math.sqrt(1+g*g)):1/(g+Math.sqrt(1+g*g)),s=1/Math.sqrt(1+y*y),l=y*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,n,r,i,a,o,u,s,c){this[0]=t(e,0),this[1]=t(i,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(a,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r++],i[1]=e[r++],i[2]=e[r++],i[3]=e[r++],i[4]=e[r++],i[5]=e[r++],i[6]=e[r++],i[7]=e[r++],i[8]=e[r++],i},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],i[8]=e[r+8],i},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,i=e.x*e.y,a=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,h=e.z*e.w,d=e.w*e.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,g=2*(s-o),x=2*(a-l),E=2*(s+o),M=-r-u+f+d;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=y,t[4]=w,t[5]=E,t[6]=p,t[7]=g,t[8]=M,t):new c(m,y,p,v,w,g,x,E,M)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=i,t[6]=0,t[7]=-i,t[8]=r,t):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=r,t):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,i=e[r],a=e[r+1],o=e[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=3*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],i=e[t+3],a=e[t+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[3]*i+e[6]*a,u=e[1]*r+e[4]*i+e[7]*a,s=e[2]*r+e[5]*i+e[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(e,t){var r=a.EPSILON20,i=10,l=0,f=0;n(t)||(t={});for(var h=t.unitary=c.clone(c.IDENTITY,t.unitary),d=t.diagonal=c.clone(e,t.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],i=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(e,t){var n=e[0],i=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],h=e[7],d=e[8],m=c.determinant(e);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");t[0]=s*d-h*l,t[1]=h*o-i*d,t[2]=i*l-s*o,t[3]=f*l-u*d,t[4]=n*d-f*o,t[5]=u*o-n*l,t[6]=u*h-f*s,t[7]=f*i-n*h,t[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(t,y,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,i,a,o,u,s){"use strict";var c=function(e,t,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(e,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,i){return t=n(t,0),r(i)||(i=new c),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,i,a){return i=n(i,e.ZERO),r(a)?(a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=0,a[4]=t[3],a[5]=t[4],a[6]=t[5],a[7]=0,a[8]=t[6],a[9]=t[7],a[10]=t[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(t[0],t[3],t[6],i.x,t[1],t[4],t[7],i.y,t[2],t[5],t[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,h=t.x*t.w,d=t.y*t.y,m=t.y*t.z,y=t.y*t.w,p=t.z*t.z,v=t.z*t.w,w=t.w*t.w,g=s-d-p+w,x=2*(l-v),E=2*(f+y),M=2*(l+v),S=-s+d-p+w,z=2*(m-h),_=2*(f-y),O=2*(m+h),I=-s-d+p+w;return i[0]=g*a,i[1]=M*a,i[2]=_*a,i[3]=0,i[4]=x*o,i[5]=S*o,i[6]=O*o,i[7]=0,i[8]=E*u,i[9]=z*u,i[10]=I*u,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,h=new e;c.fromCamera=function(t,n){var i=t.eye,a=t.target,o=t.up;e.normalize(e.subtract(a,i,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,g=h.z,x=i.x,E=i.y,M=i.z,S=u*-x+s*-E+d*-M,z=v*-x+w*-E+g*-M,_=m*x+y*E+p*M;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=g,n[10]=-p,n[11]=0,n[12]=S,n[13]=z,n[14]=_,n[15]=1,n):new c(u,s,d,S,v,w,g,z,-m,-y,-p,_,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,i){var a=Math.tan(.5*e),o=1/a,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(e,t,n,r,i,a,o){var u=1/(t-e),s=1/(r-n),c=1/(a-i),l=-(t+e)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,n,r,i,a,o){var u=2*i/(t-e),s=2*i/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,i,a){var o=2*i/(t-e),u=2*i/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(e,t,r,i){e=n(e,n.EMPTY_OBJECT);var a=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-t),h=c,d=l,m=f,y=a+c,p=o+l,v=t+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,i=e[r],a=e[r+1],o=e[r+2],u=e[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=4*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],i=e[t+4],a=e[t+8],o=e[t+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var d=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],d)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],d)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],d)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],h=e[9],d=e[10],m=e[11],y=e[12],p=e[13],v=e[14],w=e[15],g=t[0],x=t[1],E=t[2],M=t[3],S=t[4],z=t[5],_=t[6],O=t[7],I=t[8],T=t[9],N=t[10],R=t[11],A=t[12],b=t[13],P=t[14],C=t[15],L=r*g+u*x+f*E+y*M,q=i*g+s*x+h*E+p*M,U=a*g+c*x+d*E+v*M,B=o*g+l*x+m*E+w*M,D=r*S+u*z+f*_+y*O,W=i*S+s*z+h*_+p*O,F=a*S+c*z+d*_+v*O,G=o*S+l*z+m*_+w*O,k=r*I+u*T+f*N+y*R,V=i*I+s*T+h*N+p*R,Y=a*I+c*T+d*N+v*R,j=o*I+l*T+m*N+w*R,H=r*A+u*b+f*P+y*C,Z=i*A+s*b+h*P+p*C,X=a*A+c*b+d*P+v*C,K=o*A+l*b+m*P+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=B,n[4]=D,n[5]=W,n[6]=F,n[7]=G,n[8]=k,n[9]=V,n[10]=Y,n[11]=j,n[12]=H,n[13]=Z,n[14]=X,n[15]=K,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=e[12],d=e[13],m=e[14],y=t[0],p=t[1],v=t[2],w=t[4],g=t[5],x=t[6],E=t[8],M=t[9],S=t[10],z=t[12],_=t[13],O=t[14],I=r*y+o*p+c*v,T=i*y+u*p+l*v,N=a*y+s*p+f*v,R=r*w+o*g+c*x,A=i*w+u*g+l*x,b=a*w+s*g+f*x,P=r*E+o*M+c*S,C=i*E+u*M+l*S,L=a*E+s*M+f*S,q=r*z+o*_+c*O+h,U=i*z+u*_+l*O+d,B=a*z+s*_+f*O+m;return n[0]=I,n[1]=T,n[2]=N,n[3]=0,n[4]=R,n[5]=A,n[6]=b,n[7]=0,n[8]=P,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=B,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=t[0],d=t[1],m=t[2],y=t[3],p=t[4],v=t[5],w=t[6],g=t[7],x=t[8],E=r*h+o*d+c*m,M=i*h+u*d+l*m,S=a*h+s*d+f*m,z=r*y+o*p+c*v,_=i*y+u*p+l*v,O=a*y+s*p+f*v,I=r*w+o*g+c*x,T=i*w+u*g+l*x,N=a*w+s*g+f*x;return n[0]=E,n[1]=M,n[2]=S,n[3]=0,n[4]=z,n[5]=_,n[6]=O,n[7]=0,n[8]=I,n[9]=T,n[10]=N,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=r*e[0]+i*e[4]+a*e[8]+e[12],u=r*e[1]+i*e[5]+a*e[9]+e[13],s=r*e[2]+i*e[6]+a*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var y=new e;c.multiplyByUniformScale=function(e,t,n){return y.x=t,y.y=t,y.z=t,c.multiplyByScale(e,y,n)},c.multiplyByScale=function(e,t,n){var r=t.x,i=t.y,a=t.z;return 1===r&&1===i&&1===a?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=i*e[4],n[5]=i*e[5],n[6]=i*e[6],n[7]=0,n[8]=a*e[8],n[9]=a*e[9],n[10]=a*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=t.w,u=e[0]*r+e[4]*i+e[8]*a+e[12]*o,s=e[1]*r+e[5]*i+e[9]*a+e[13]*o,c=e[2]*r+e[6]*i+e[10]*a+e[14]*o,l=e[3]*r+e[7]*i+e[11]*a+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a,u=e[1]*r+e[5]*i+e[9]*a,s=e[2]*r+e[6]*i+e[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a+e[12],u=e[1]*r+e[5]*i+e[9]*a+e[13],s=e[2]*r+e[6]*i+e[10]*a+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],i=e[3],a=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[10]=e[10],t[11]=e[14],t[12]=i,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var p=new u,v=new u,w=new t,g=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,p),v,o.EPSILON7)&&t.equals(c.getRow(e,3,w),g))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],i=e[4],a=e[8],l=e[12],f=e[1],h=e[5],d=e[9],m=e[13],y=e[2],x=e[6],E=e[10],M=e[14],S=e[3],z=e[7],_=e[11],O=e[15],I=E*O,T=M*_,N=x*O,R=M*z,A=x*_,b=E*z,P=y*O,C=M*S,L=y*_,q=E*S,U=y*z,B=x*S,D=I*h+R*d+A*m-(T*h+N*d+b*m),W=T*f+P*d+q*m-(I*f+C*d+L*m),F=N*f+C*h+U*m-(R*f+P*h+B*m),G=b*f+L*h+B*d-(A*f+q*h+U*d),k=T*i+N*a+b*l-(I*i+R*a+A*l),V=I*r+C*a+L*l-(T*r+P*a+q*l),Y=R*r+P*i+B*l-(N*r+C*i+U*l),j=A*r+q*i+U*a-(b*r+L*i+B*a);I=a*m,T=l*d,N=i*m,R=l*h,A=i*d,b=a*h,P=r*m,C=l*f,L=r*d,q=a*f,U=r*h,B=i*f;var H=I*z+R*_+A*O-(T*z+N*_+b*O),Z=T*S+P*_+q*O-(I*S+C*_+L*O),X=N*S+C*z+U*O-(R*S+P*z+B*O),K=b*S+L*z+B*_-(A*S+q*z+U*_),J=N*E+b*M+T*x-(A*M+I*x+R*E),Q=L*M+I*y+C*E-(P*E+q*M+T*y),$=P*x+B*M+R*y-(U*M+N*y+C*x),et=U*E+A*y+q*x-(L*x+B*E+b*y),tt=r*D+i*W+a*F+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=D*tt,n[1]=W*tt,n[2]=F*tt,n[3]=G*tt,n[4]=k*tt,n[5]=V*tt,n[6]=Y*tt,n[7]=j*tt,n[8]=H*tt,n[9]=Z*tt,n[10]=X*tt,n[11]=K*tt,n[12]=J*tt,n[13]=Q*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],h=e[13],d=e[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return t[0]=n,t[1]=a,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=i,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=y,t[14]=p,t[15]=1,t},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var i=function(t,n){this.normal=e.clone(t),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-e.dot(r,n);return t(a)?(e.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new e;return i.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,a),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},i.ORIGIN_XY_PLANE=r(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(e.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.west=e[r++],i.south=e[r++],i.east=e[r++],i.north=e[r],i},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,i,a,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),i=u.toRadians(t(i,0)),a=u.toRadians(t(a,0)),n(o)?(o.west=e,o.south=r,o.east=i,o.north=a,o):new s(e,r,i,a)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=a,t.east=i,t.north=o,t):new s(r,a,i,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var i=t.east,a=t.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var i=e.east,a=e.west,o=t.east,c=t.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var h=Math.max(e.south,t.south),d=Math.min(e.north,t.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,i=e.west,a=e.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,i,o){r=t(r,a.WGS84),i=t(i,0),n(o)||(o=[]);var l=0,f=e.north,h=e.south,d=e.east,m=e.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(e,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,y=new e,p=new e,v=new e,w=new e,g=new e,x=new e,E=new e,M=new e,S=new e,z=new e,_=new e;d.fromPoints=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var i=e.clone(t[0],x),a=e.clone(i,m),o=e.clone(i,y),u=e.clone(i,p),s=e.clone(i,v),c=e.clone(i,w),l=e.clone(i,g),f=t.length,h=1;f>h;h++){e.clone(t[h],i);var O=i.x,I=i.y,T=i.z;O<a.x&&e.clone(i,a),O>s.x&&e.clone(i,s),I<o.y&&e.clone(i,o),I>c.y&&e.clone(i,c),T<u.z&&e.clone(i,u),T>l.z&&e.clone(i,l)}var N=e.magnitudeSquared(e.subtract(s,a,E)),R=e.magnitudeSquared(e.subtract(c,o,E)),A=e.magnitudeSquared(e.subtract(l,u,E)),b=a,P=s,C=N;R>C&&(C=R,b=o,P=c),A>C&&(C=A,b=u,P=l);var L=M;L.x=.5*(b.x+P.x),L.y=.5*(b.y+P.y),L.z=.5*(b.z+P.z);var q=e.magnitudeSquared(e.subtract(P,L,E)),U=Math.sqrt(q),B=S;B.x=a.x,B.y=o.y,B.z=u.z;var D=z;D.x=s.x,D.y=c.y,D.z=l.z;var W=e.multiplyByScalar(e.add(B,D,E),.5,_),F=0;for(h=0;f>h;h++){e.clone(t[h],i);var G=e.magnitude(e.subtract(i,W,E));G>F&&(F=G);var k=e.magnitudeSquared(e.subtract(i,L,E));if(k>q){var V=Math.sqrt(k);U=.5*(U+V),q=U*U;var Y=V-U;L.x=(U*L.x+Y*i.x)/V,L.y=(U*L.y+Y*i.y)/V,L.z=(U*L.z+Y*i.z)/V}}return F>U?(e.clone(L,n.center),n.radius=U):(e.clone(W,n.center),n.radius=F),n};var O=new u,I=new e,T=new e,N=new t,R=new t;d.fromRectangle2D=function(e,t,n){return d.fromRectangleWithHeights2D(e,t,0,0,n)},d.fromRectangleWithHeights2D=function(t,i,a,o,u){if(r(u)||(u=new d),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=n(i,O),h.southwest(t,N),N.height=a,h.northeast(t,R),R.height=o;var s=i.project(N,I),c=i.project(R,T),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var A=[];d.fromRectangle3D=function(e,t,i,a){t=n(t,o.WGS84),i=n(i,0);var u;return r(e)&&(u=h.subsample(e,t,i,A)),d.fromPoints(u,a)},d.fromVertices=function(t,i,a,o){if(r(o)||(o=new d),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;i=n(i,e.ZERO),a=n(a,3);var u=x;u.x=t[0]+i.x,u.y=t[1]+i.y,u.z=t[2]+i.z;for(var s=e.clone(u,m),c=e.clone(u,y),l=e.clone(u,p),f=e.clone(u,v),h=e.clone(u,w),O=e.clone(u,g),I=t.length,T=0;I>T;T+=a){var N=t[T]+i.x,R=t[T+1]+i.y,A=t[T+2]+i.z;u.x=N,u.y=R,u.z=A,N<s.x&&e.clone(u,s),N>f.x&&e.clone(u,f),R<c.y&&e.clone(u,c),R>h.y&&e.clone(u,h),A<l.z&&e.clone(u,l),A>O.z&&e.clone(u,O)}var b=e.magnitudeSquared(e.subtract(f,s,E)),P=e.magnitudeSquared(e.subtract(h,c,E)),C=e.magnitudeSquared(e.subtract(O,l,E)),L=s,q=f,U=b;P>U&&(U=P,L=c,q=h),C>U&&(U=C,L=l,q=O);var B=M;B.x=.5*(L.x+q.x),B.y=.5*(L.y+q.y),B.z=.5*(L.z+q.z);var D=e.magnitudeSquared(e.subtract(q,B,E)),W=Math.sqrt(D),F=S;F.x=s.x,F.y=c.y,F.z=l.z;var G=z;G.x=f.x,G.y=h.y,G.z=O.z;var k=e.multiplyByScalar(e.add(F,G,E),.5,_),V=0;for(T=0;I>T;T+=a){u.x=t[T]+i.x,u.y=t[T+1]+i.y,u.z=t[T+2]+i.z;var Y=e.magnitude(e.subtract(u,k,E));Y>V&&(V=Y);var j=e.magnitudeSquared(e.subtract(u,B,E));if(j>D){var H=Math.sqrt(j);W=.5*(W+H),D=W*W;var Z=H-W;B.x=(W*B.x+Z*u.x)/H,B.y=(W*B.y+Z*u.y)/H,B.z=(W*B.z+Z*u.z)/H}}return V>W?(e.clone(B,o.center),o.radius=W):(e.clone(k,o.center),o.radius=V),o},d.fromCornerPoints=function(t,n,i){r(i)||(i=new d);var a=i.center;return e.add(t,n,a),e.multiplyByScalar(a,.5,a),i.radius=e.distance(a,n),i},d.fromEllipsoid=function(t,n){return r(n)||(n=new d),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var b=new e;d.fromBoundingSpheres=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var i=t.length;if(1===i)return d.clone(t[0],n);if(2===i)return d.union(t[0],t[1],n);for(var a=[],o=0;i>o;o++)a.push(t[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,b)+c.radius)}return n.radius=s,n},d.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new d(t.center,t.radius):void 0},d.packedLength=4,d.pack=function(e,t,r){r=n(r,0);var i=e.center;t[r++]=i.x,t[r++]=i.y,t[r++]=i.z,t[r]=e.radius},d.unpack=function(e,t,i){t=n(t,0),r(i)||(i=new d);var a=i.center;return a.x=e[t++],a.y=e[t++],a.z=e[t++],i.radius=e[t],i};var P=new e,C=new e;d.union=function(t,n,i){r(i)||(i=new d);var a=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,a,P),l=e.magnitude(c);if(o>=l+s)return t.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=e.multiplyByScalar(c,(-o+f)/l,C);return e.add(h,a,h),e.clone(h,i.center),i.radius=f,i};var L=new e;d.expand=function(t,n,r){r=d.clone(t,r);var i=e.magnitude(e.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(t,n){var r=t.center,i=t.radius,a=n.normal,o=e.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);d.intersect=function(e,t){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(t,q);return d.intersectPlane(e,n)},d.transform=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var U=new e;d.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,U);return e.magnitudeSquared(r)-t.radius*t.radius},d.transformWithoutScale=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var B=new e;d.computePlaneDistances=function(t,n,i,a){r(a)||(a=new c);var o=e.subtract(t.center,n,B),u=e.multiplyByScalar(i,e.dot(i,o),B),s=e.magnitude(u);return a.start=s-t.radius,a.stop=s+t.radius,a};for(var D=new e,W=new e,F=new e,G=new e,k=new e,V=new t,Y=new Array(8),j=0;8>j;++j)Y[j]=new e;var H=new u;return d.projectTo2D=function(t,r,i){r=n(r,H);var a=r.ellipsoid,o=t.center,u=t.radius,s=a.geodeticSurfaceNormal(o,D),c=e.cross(e.UNIT_Z,s,W);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),h=e.negate(c,G),m=Y,y=m[0];e.add(s,l,y),e.add(y,c,y),y=m[1],e.add(s,l,y),e.add(y,h,y),y=m[2],e.add(s,f,y),e.add(y,h,y),y=m[3],e.add(s,f,y),e.add(y,c,y),e.negate(s,s),y=m[4],e.add(s,l,y),e.add(y,c,y),y=m[5],e.add(s,l,y),e.add(y,h,y),y=m[6],e.add(s,f,y),e.add(y,h,y),y=m[7],e.add(s,f,y),e.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];e.add(o,w,w);var g=a.cartesianToCartographic(w,V);r.project(g,w)}i=d.fromPoints(m,i),o=i.center;var x=o.x,E=o.y,M=o.z;return o.x=M,o.y=x,o.z=E,i},d.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},d.prototype.intersectPlane=function(e){return d.intersectPlane(this,e)},d.prototype.intersect=function(e){return d.intersect(this,e)},d.prototype.equals=function(e){return d.equals(this,e)},d.prototype.clone=function(e){return d.clone(this,e)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return t(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof t[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof t[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",e(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",e(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",e(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",e(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function i(){if(!t(p)){p=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(p=!0,v=r(e[1]))}return p}function a(){return i()&&v}function o(){if(!t(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(w=!0,g=r(e[1]))}return w}function u(){return o()&&g}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(M)){M=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(M=!0,S=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(M=!0,S=r(e[1])))}return M}function f(){return l()&&S}function h(){if(!t(z)){z=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(z=!0,_=r(e[1]))}return z}function d(){return t(O)||(O=/Windows/i.test(navigator.appVersion)),O}function m(){return h()&&_}function y(){return t(I)||(I=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),I}var p,v,w,g,x,E,M,S,z,_,O,I,T={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return T.supportsFullscreen=function(){return n.supportsFullscreen()},T.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},T.supportsWebWorkers=function(){return"undefined"!=typeof Worker},T}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(e){switch(e){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(e){return e instanceof Int8Array?a.BYTE:e instanceof Uint8Array?a.UNSIGNED_BYTE:e instanceof Int16Array?a.SHORT:e instanceof Uint16Array?a.UNSIGNED_SHORT:e instanceof Float32Array?a.FLOAT:e instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(e){return t(e)&&(e===a.BYTE||e===a.UNSIGNED_BYTE||e===a.SHORT||e===a.UNSIGNED_SHORT||e===a.FLOAT||e===a.DOUBLE)},a.createTypedArray=function(e,t){switch(e){case a.BYTE:return new Int8Array(t);case a.UNSIGNED_BYTE:return new Uint8Array(t);case a.SHORT:return new Int16Array(t);case a.UNSIGNED_SHORT:return new Uint16Array(t);case a.FLOAT:return new Float32Array(t);case a.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(t,r,i,o){switch(i=e(i,0),o=e(o,(r.byteLength-i)/a.getSizeInBytes(t)),t){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)},c=new e;s.fromAxisAngle=function(t,r,i){var a=r/2,o=Math.sin(a);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,h=Math.cos(a);return n(i)?(i.x=u,i.y=l,i.z=f,i.w=h,i):new s(u,l,f,h)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var r,i,a,o,c,h=e[u.COLUMN0ROW0],d=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],y=h+d+m;if(y>0)r=Math.sqrt(y+1),c=.5*r,r=.5/r,i=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,a=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var p=l,v=0;d>h&&(v=1),m>h&&m>d&&(v=2);var w=p[v],g=p[w];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(w,w)]-e[u.getElementIndex(g,g)]+1);var x=f;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(g,w)]-e[u.getElementIndex(w,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,i=-x[0],a=-x[1],o=-x[2]}return n(t)?(t.x=i,t.y=a,t.z=o,t.w=c,t):new s(i,a,o,c)};var h=new s;s.fromHeadingPitchRoll=function(t,n,r,i){var a=s.fromAxisAngle(e.UNIT_X,r,h),o=s.fromAxisAngle(e.UNIT_Y,-n,i);i=s.multiply(o,a,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,h);return s.multiply(u,i,i)};var d=new e,m=new e,y=new s,p=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.x=e[r],i.y=e[r+1],i.z=e[r+2],i.w=e[r+3],i},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var i=0,a=n-t+1;a>i;i++){var o=3*i;s.unpack(e,4*(t+i),y),s.multiply(y,v,y),y.w<0&&s.negate(y,y),s.computeAxis(y,d);var u=s.computeAngle(y);r[o]=d.x*u,r[o+1]=d.y*u,r[o+2]=d.z*u}},s.unpackInterpolationResult=function(t,r,i,a,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*a,p),0===u?s.clone(s.IDENTITY,y):s.fromAxisAngle(m,u,y),s.multiply(y,p,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,i=e.y*n,a=e.z*n,o=e.w*n;return t.x=r,t.y=i,t.z=a,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+r*l+i*c-a*s,h=o*s-r*c+i*l+a*u,d=o*c+r*s-i*u+a*l,m=o*l-r*u-i*s-a*c;return n.x=f,n.y=h,n.z=d,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var w=new s;s.lerp=function(e,t,n,r){return w=s.multiplyByScalar(t,n,w),r=s.multiplyByScalar(e,1-n,r),s.add(w,r,r)};var g=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var i=s.dot(e,t),a=t;if(0>i&&(i=-i,a=g=s.negate(t,g)),1-i<o.EPSILON6)return s.lerp(e,a,n,r);var u=Math.acos(i);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(a,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),i=0;return 0!==r&&(i=r/Math.sin(r)),e.multiplyByScalar(t,i,n) -},s.exp=function(t,n){var r=e.magnitude(t),i=0;return 0!==r&&(i=Math.sin(r)/r),n.x=t.x*i,n.y=t.y*i,n.z=t.z*i,n.w=Math.cos(r),n};var M=new e,S=new e,z=new s,_=new s;s.computeInnerQuadrangle=function(t,n,r,i){var a=s.conjugate(n,z);s.multiply(a,r,_);var o=s.log(_,M);s.multiply(a,t,_);var u=s.log(_,S);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,z),s.multiply(n,z,i)},s.squad=function(e,t,n,r,i,a){var o=s.slerp(e,t,i,z),u=s.slerp(n,r,i,_);return s.slerp(o,u,2*i*(1-i),a)};for(var O=new s,I=1.9011074535173003,T=i.supportsTypedArrays()?new Float32Array(8):[],N=i.supportsTypedArrays()?new Float32Array(8):[],R=i.supportsTypedArrays()?new Float32Array(8):[],A=i.supportsTypedArrays()?new Float32Array(8):[],b=0;7>b;++b){var P=b+1,C=2*P+1;T[b]=1/(P*C),N[b]=P/C}return T[7]=I/136,N[7]=8*I/17,s.fastSlerp=function(e,t,n,r){var i,a=s.dot(e,t);a>=0?i=1:(i=-1,a=-a);for(var o=a-1,u=1-n,c=n*n,l=u*u,f=7;f>=0;--f)R[f]=(T[f]*c-N[f])*o,A[f]=(T[f]*l-N[f])*o;var h=i*n*(1+R[0]*(1+R[1]*(1+R[2]*(1+R[3]*(1+R[4]*(1+R[5]*(1+R[6]*(1+R[7])))))))),d=u*(1+A[0]*(1+A[1]*(1+A[2]*(1+A[3]*(1+A[4]*(1+A[5]*(1+A[6]*(1+A[7])))))))),m=s.multiplyByScalar(e,d,O);return s.multiplyByScalar(t,h,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,i,a){var o=s.fastSlerp(e,t,i,z),u=s.fastSlerp(n,r,i,_);return s.fastSlerp(o,u,2*i*(1-i),a)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/EllipseGeometryLibrary",["./Cartesian3","./Math","./Matrix3","./Quaternion"],function(e,t,n,r){"use strict";function i(t,i,a,l,f,h,d,m,y,p){var v=t+i;e.multiplyByScalar(l,Math.cos(v),o),e.multiplyByScalar(a,Math.sin(v),u),e.add(o,u,o);var w=Math.cos(t);w*=w;var g=Math.sin(t);g*=g;var x=h/Math.sqrt(d*w+f*g),E=x/m;return r.fromAxisAngle(o,E,s),n.fromQuaternion(s,c),n.multiplyByVector(c,y,p),e.normalize(p,p),e.multiplyByScalar(p,m,p),p}var a={},o=new e,u=new e,s=new r,c=new n,l=new e,f=new e,h=new e,d=new e;a.raisePositionsToHeight=function(t,n,r){for(var i=n.ellipsoid,a=n.height,o=n.extrudedHeight,u=r?2*(t.length/3):t.length/3,s=new Float64Array(3*u),c=t.length,m=r?c:0,y=0;c>y;y+=3){var p=y+1,v=y+2,w=e.fromArray(t,y,l);i.scaleToGeodeticSurface(w,w);var g=e.clone(w,f),x=i.geodeticSurfaceNormal(w,d),E=e.multiplyByScalar(x,a,h);e.add(w,E,w),r&&(e.multiplyByScalar(x,o,E),e.add(g,E,g),s[y+m]=g.x,s[p+m]=g.y,s[v+m]=g.z),s[y]=w.x,s[p]=w.y,s[v]=w.z}return s};var m=new e,y=new e,p=new e;return a.computeEllipsePositions=function(n,r,a){var o=n.semiMinorAxis,u=n.semiMajorAxis,s=n.rotation,c=n.center,d=8*n.granularity,v=o*o,w=u*u,g=u*o,x=e.magnitude(c),E=e.normalize(c,m),M=e.cross(e.UNIT_Z,c,y);M=e.normalize(M,M);var S=e.cross(E,M,p),z=1+Math.ceil(t.PI_OVER_TWO/d),_=t.PI_OVER_TWO/(z-1),O=t.PI_OVER_TWO-z*_;0>O&&(z-=Math.ceil(Math.abs(O)/_));var I,T,N,R,A,b=2*z*(z+1),P=r?new Array(3*b):void 0,C=0,L=l,q=f,U=3*(2*z+2*(z-1)),B=U-1,D=0,W=a?new Array(U):void 0;for(O=t.PI_OVER_TWO,I=0;z>I;++I){if(L=i(O,s,S,M,v,g,w,x,E,L),q=i(Math.PI-O,s,S,M,v,g,w,x,E,q),r){for(P[C++]=L.x,P[C++]=L.y,P[C++]=L.z,N=2*I+2,T=1;N-1>T;++T)R=T/(N-1),A=e.lerp(L,q,R,h),P[C++]=A.x,P[C++]=A.y,P[C++]=A.z;P[C++]=q.x,P[C++]=q.y,P[C++]=q.z}a&&(W[B--]=L.z,W[B--]=L.y,W[B--]=L.x,0!==I&&(W[D++]=q.x,W[D++]=q.y,W[D++]=q.z)),O=t.PI_OVER_TWO-(I+1)*_}for(I=z;I>0;--I){if(O=t.PI_OVER_TWO-(I-1)*_,L=i(-O,s,S,M,v,g,w,x,E,L),q=i(O+Math.PI,s,S,M,v,g,w,x,E,q),r){for(P[C++]=L.x,P[C++]=L.y,P[C++]=L.z,N=2*(I-1)+2,T=1;N-1>T;++T)R=T/(N-1),A=e.lerp(L,q,R,h),P[C++]=A.x,P[C++]=A.y,P[C++]=A.z;P[C++]=q.x,P[C++]=q.y,P[C++]=q.z}a&&(W[B--]=L.z,W[B--]=L.y,W[B--]=L.x,1!==I&&(W[D++]=q.x,W[D++]=q.y,W[D++]=q.z))}var F={};return r&&(F.positions=P,F.numPts=z),a&&(F.outerPositions=W),F},a}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,i){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,i.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(e){var r=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&t(e.attributes[i])&&t(e.attributes[i].values)){var a=e.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(t){return e(t)&&(t===i.UNSIGNED_BYTE||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)},i.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},i.createTypedArrayFromArrayBuffer=function(e,t,n,i){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)},n(i)}),define("Core/EllipseOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EllipseGeometryLibrary","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType"],function(e,t,n,r,i,a,o,u,s,c,l,f,h,d){"use strict";function m(r){var i=r.center;v=t.multiplyByScalar(r.ellipsoid.geodeticSurfaceNormal(i,v),r.height,v),v=t.add(i,v,v);for(var a=new e(v,r.semiMajorAxis),u=o.computeEllipsePositions(r,!1,!0).outerPositions,s=new l({position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:o.raisePositionsToHeight(u,r,!1)})}),h=u.length/3,d=f.createTypedArray(h,2*h),m=0,y=0;h>y;++y)d[m++]=y,d[m++]=(y+1)%h;return{boundingSphere:a,attributes:s,indices:d}}function y(i){var a=r(i.numberOfVerticalLines,16);a=Math.max(a,0);var u=i.center,s=i.ellipsoid,h=i.semiMajorAxis,d=t.multiplyByScalar(s.geodeticSurfaceNormal(u,p),i.height,p);w.center=t.add(u,d,w.center),w.radius=h,d=t.multiplyByScalar(s.geodeticSurfaceNormal(u,d),i.extrudedHeight,d),g.center=t.add(u,d,g.center),g.radius=h;var m=o.computeEllipsePositions(i,!1,!0).outerPositions,y=new l({position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:o.raisePositionsToHeight(m,i,!0)})});m=y.position.values;var v=e.union(w,g),x=m.length/3,E=f.createTypedArray(x,2*x+2*a);x/=2;var M,S=0;for(M=0;x>M;++M)E[S++]=M,E[S++]=(M+1)%x,E[S++]=M+x,E[S++]=(M+1)%x+x;var z;if(a>0){var _=Math.min(a,x);z=Math.round(x/_)}var O=Math.min(z*a,x);if(a>0)for(M=0;O>M;M+=z)E[S++]=M,E[S++]=M+x;return{boundingSphere:v,attributes:y,indices:E}}var p=new t,v=new t,w=new e,g=new e,x=function(e){e=r(e,r.EMPTY_OBJECT);var n=e.center,a=r(e.ellipsoid,u.WGS84),o=e.semiMajorAxis,s=e.semiMinorAxis,c=r(e.granularity,h.RADIANS_PER_DEGREE),l=r(e.height,0),f=e.extrudedHeight,d=i(f)&&Math.abs(l-f)>1;this._center=t.clone(n),this._semiMajorAxis=o,this._semiMinorAxis=s,this._ellipsoid=u.clone(a),this._rotation=r(e.rotation,0),this._height=l,this._granularity=c,this._extrudedHeight=f,this._extrude=d,this._numberOfVerticalLines=Math.max(r(e.numberOfVerticalLines,16),0),this._workerName="createEllipseOutlineGeometry"};x.packedLength=t.packedLength+u.packedLength+9,x.pack=function(e,n,a){a=r(a,0),t.pack(e._center,n,a),a+=t.packedLength,u.pack(e._ellipsoid,n,a),a+=u.packedLength,n[a++]=e._semiMajorAxis,n[a++]=e._semiMinorAxis,n[a++]=e._rotation,n[a++]=e._height,n[a++]=e._granularity,n[a++]=i(e._extrudedHeight)?1:0,n[a++]=r(e._extrudedHeight,0),n[a++]=e._extrude?1:0,n[a]=e._numberOfVerticalLines};var E=new t,M=new u,S={center:E,ellipsoid:M,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0};return x.unpack=function(e,n,a){n=r(n,0);var o=t.unpack(e,n,E);n+=t.packedLength;var s=u.unpack(e,n,M);n+=u.packedLength;var c=e[n++],l=e[n++],f=e[n++],h=e[n++],d=e[n++],m=e[n++],y=e[n++],p=1===e[n++],v=e[n];return i(a)?(a._center=t.clone(o,a._center),a._ellipsoid=u.clone(s,a._ellipsoid),a._semiMajorAxis=c,a._semiMinorAxis=l,a._rotation=f,a._height=h,a._granularity=d,a._extrudedHeight=m?y:void 0,a._extrude=p,a._numberOfVerticalLines=v,a):(S.height=h,S.extrudedHeight=m?y:void 0,S.granularity=d,S.rotation=f,S.semiMajorAxis=c,S.semiMinorAxis=l,S.numberOfVerticalLines=v,new x(S))},x.createGeometry=function(e){e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var t,n={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:e._height,extrudedHeight:e._extrudedHeight,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};return e._extrude?(n.extrudedHeight=Math.min(e._extrudedHeight,e._height),n.height=Math.max(e._extrudedHeight,e._height),t=y(n)):t=m(n),new s({attributes:t.attributes,indices:t.indices,primitiveType:d.LINES,boundingSphere:t.boundingSphere})},x}),define("Workers/createEllipseOutlineGeometry",["../Core/Cartesian3","../Core/defined","../Core/EllipseOutlineGeometry","../Core/Ellipsoid"],function(e,t,n,r){"use strict";function i(i,a){return t(a)&&(i=n.unpack(i,a)),i._center=e.clone(i._center),i._ellipsoid=r.clone(i._ellipsoid),n.createGeometry(i)}return i})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createEllipsoidGeometry.js b/libs/Cesium/Workers/createEllipsoidGeometry.js deleted file mode 100644 index ae3819ba..00000000 --- a/libs/Cesium/Workers/createEllipsoidGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(t){return t>0?1:0>t?-1:0},n.signNotZero=function(t){return 0>t?-1:1},n.toSNorm=function(t){return Math.round(255*(.5*n.clamp(t,-1,1)+.5))},n.fromSNorm=function(t){return 2*(n.clamp(t,0,255)/255)-1},n.sinh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e-n)},n.cosh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e+n)},n.lerp=function(t,e,n){return(1-n)*t+n*e},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(t){return t*n.RADIANS_PER_DEGREE},n.toDegrees=function(t){return t*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(t){var e=n.TWO_PI,r=t-Math.floor(t/e)*e;return r<-Math.PI?r+e:r>=Math.PI?r-e:r},n.negativePiToPi=function(t){return n.zeroToTwoPi(t+n.PI)-n.PI},n.zeroToTwoPi=function(t){var e=n.mod(t,n.TWO_PI);return Math.abs(e)<n.EPSILON14&&Math.abs(t)>n.EPSILON14?n.TWO_PI:e},n.mod=function(t,e){return(t%e+e)%e},n.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return i>=a||a<=r*Math.max(Math.abs(t),Math.abs(n))};var r=[1];n.factorial=function(t){var e=r.length;if(t>=e)for(var n=r[e-1],i=e;t>=i;i++)r.push(n*i);return r[t]},n.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},n.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},n.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},n.clamp=function(t,e,n){return e>t?e:t>n?n:t};var i=new t;return n.setRandomNumberSeed=function(e){i=new t(e)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(t){return Math.acos(n.clamp(t,-1,1))},n.asinClamped=function(t){return Math.asin(n.clamp(t,-1,1))},n.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)};a.fromSpherical=function(n,r){e(r)||(r=new a);var i=n.clock,o=n.cone,u=t(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(t,n,r,i){return e(i)?(i.x=t,i.y=n,i.z=r,i):new a(t,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):n.y<=n.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)},a.cross=function(t,e,n){var r=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(t,e,n,r,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),e(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o++)r[o]=i.toRadians(t[o]);return a.fromRadiansArray(r,e,n)},a.fromRadiansArray=function(t,n,r){var i=t.length;e(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o+=3)r[o]=i.toRadians(t[o]),r[o+1]=i.toRadians(t[o+1]),r[o+2]=t[o+2];return a.fromRadiansArrayHeights(r,e,n)},a.fromRadiansArrayHeights=function(t,n,r){var i=t.length;e(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)};return a.fromRadians=function(n,r,i,o){return i=t(i,0),e(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(t,e,n,r){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},a.equalsEpsilon=function(t,n,r){return t===n||e(t)&&e(n)&&Math.abs(t.longitude-n.longitude)<=r&&Math.abs(t.latitude-n.latitude)<=r&&Math.abs(t.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var e={},n=function(n,r){t(e[n])||(e[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(e,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),e._radii=new t(r,i,a),e._radiiSquared=new t(r*r,i*i,a*a),e._radiiToTheFourth=new t(r*r*r*r,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(r,i,a),e._maximumRadius=Math.max(r,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,n){if(!r(e))return void 0;var i=e._radii;return r(n)?(t.clone(i,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return r(e)||(e=new c),r(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,r,i){i=n(i,0),t.pack(e._radii,r,i)},c.unpack=function(e,r,i){r=n(r,0);var a=t.unpack(e,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,n){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(e,n){return r(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;c.prototype.cartographicToCartesian=function(e,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),r(n)||(n=new t),t.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var h=new t,d=new t,m=new t;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=t.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(t.dot(s,n))*t.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new e(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,n){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),E=t.multiplyByScalar(e,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?t.clone(E,n):void 0;var x=this._oneOverRadiiSquared,g=x.x,S=x.y,M=x.z,O=p;O.x=2*E.x*g,O.y=2*E.y*S,O.z=2*E.z*M;var z,_,T,I,N,R,b,P,A,C,L,q=(1-w)*t.magnitude(e)/(.5*t.magnitude(O)),U=0;do{q-=U,T=1/(1+q*g),I=1/(1+q*S),N=1/(1+q*M),R=T*T,b=I*I,P=N*N,A=R*T,C=b*I,L=P*N,z=h*R+d*b+m*P-1,_=h*A*g+d*C*S+m*L*M;var D=-2*_;U=z/D}while(Math.abs(z)>u.EPSILON12);return r(n)?(n.x=i*T,n.y=a*I,n.z=o*N,n):new t(i*T,a*I,o*N)},c.prototype.scaleToGeocentricSurface=function(e,n){r(n)||(n=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,n)},c.prototype.transformPositionToScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._radii,n)},c.prototype.equals=function(e){return this===e||r(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";var u=function(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var e={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(e)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var e=function(e,n){this.start=t(e,0),this.stop=t(n,0)};return e}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)};a.fromElements=function(t,n,r,i,o){return e(o)?(o.x=t,o.y=n,o.z=r,o.w=i,o):new a(t,n,r,i)},a.fromColor=function(t,n){return e(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new a(t.red,t.green,t.blue,t.alpha)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new a(t.x,t.y,t.z,t.w):void 0},a.packedLength=4,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n.w=Math.min(t.w,e.w),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n.w=Math.max(t.w,e.w),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e.w=t.w/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n.w=t.w*e.w,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n.w=t.w+e.w,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n.w=t.w-e.w,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n.w=t.w*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n.w=t.w/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e.w=Math.abs(t.w),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,s);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]&&t.w===e[n+3]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)&&i.equalsEpsilon(t.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t){for(var e=0,n=0;9>n;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function u(t){for(var e=0,n=0;3>n;++n){var r=t[c.getElementIndex(d[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function s(t,e){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(t[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(t[c.getElementIndex(m,f)])>n){var y,p=t[c.getElementIndex(m,m)],v=t[c.getElementIndex(f,f)],w=t[c.getElementIndex(m,f)],E=(p-v)/2/w;y=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),s=1/Math.sqrt(1+y*y),l=y*s}return e=c.clone(c.IDENTITY,e),e[c.getElementIndex(f,f)]=e[c.getElementIndex(m,m)]=s,e[c.getElementIndex(m,f)]=l,e[c.getElementIndex(f,m)]=-l,e}var c=function(t,n,r,i,a,o,u,s,c){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(u,0),this[3]=e(n,0),this[4]=e(a,0),this[5]=e(s,0),this[6]=e(r,0),this[7]=e(o,0),this[8]=e(c,0)};c.packedLength=9,c.pack=function(t,n,r){r=e(r,0),n[r++]=t[0],n[r++]=t[1],n[r++]=t[2],n[r++]=t[3],n[r++]=t[4],n[r++]=t[5],n[r++]=t[6],n[r++]=t[7],n[r++]=t[8]},c.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r++],i[1]=t[r++],i[2]=t[r++],i[3]=t[r++],i[4]=t[r++],i[5]=t[r++],i[6]=t[r++],i[7]=t[r++],i[8]=t[r++],i},c.clone=function(t,e){return n(t)?n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new c(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},c.fromArray=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r],i[1]=t[r+1],i[2]=t[r+2],i[3]=t[r+3],i[4]=t[r+4],i[5]=t[r+5],i[6]=t[r+6],i[7]=t[r+7],i[8]=t[r+8],i},c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},c.fromQuaternion=function(t,e){var r=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,s=t.y*t.z,l=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,E=2*(s-o),x=2*(a-l),g=2*(s+o),S=-r-u+f+d;return n(e)?(e[0]=m,e[1]=v,e[2]=x,e[3]=y,e[4]=w,e[5]=g,e[6]=p,e[7]=E,e[8]=S,e):new c(m,y,p,v,w,E,x,g,S)},c.fromScale=function(t,e){return n(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new c(t.x,0,0,0,t.y,0,0,0,t.z)},c.fromUniformScale=function(t,e){return n(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new c(t,0,0,0,t,0,0,0,t)},c.fromCrossProduct=function(t,e){return n(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new c(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},c.fromRotationX=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=r,e[5]=i,e[6]=0,e[7]=-i,e[8]=r,e):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=r,e):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},c.getElementIndex=function(t,e){return 3*t+e},c.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;c.getMaximumScale=function(e){return c.getScale(e,f),t.maximumComponent(f)},c.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],l=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],f=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},c.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},c.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],l=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=l,e};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(t,e){var r=a.EPSILON20,i=10,l=0,f=0;n(e)||(e={});for(var h=e.unitary=c.clone(c.IDENTITY,e.unitary),d=e.diagonal=c.clone(t,e.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},c.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(t,e){var n=t[0],i=t[1],o=t[2],u=t[3],s=t[4],l=t[5],f=t[6],h=t[7],d=t[8],m=c.determinant(t);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");e[0]=s*d-h*l,e[1]=h*o-i*d,e[2]=i*l-s*o,e[3]=f*l-u*d,e[4]=n*d-f*o,e[5]=u*o-n*l,e[6]=u*h-f*s,e[7]=f*i-n*h,e[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(e,y,e)},c.equals=function(t,e){return t===e||n(t)&&n(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},c.equalsEpsilon=function(t,e,r){return t===e||n(t)&&n(e)&&Math.abs(t[0]-e[0])<=r&&Math.abs(t[1]-e[1])<=r&&Math.abs(t[2]-e[2])<=r&&Math.abs(t[3]-e[3])<=r&&Math.abs(t[4]-e[4])<=r&&Math.abs(t[5]-e[5])<=r&&Math.abs(t[6]-e[6])<=r&&Math.abs(t[7]-e[7])<=r&&Math.abs(t[8]-e[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var e=function(t){this.name="RuntimeError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,e,n,r,i,a,o,u,s){"use strict";var c=function(t,e,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(t,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(e,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(t,e,r){r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e[r++]=t[9],e[r++]=t[10],e[r++]=t[11],e[r++]=t[12],e[r++]=t[13],e[r++]=t[14],e[r]=t[15]},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},c.clone=function(t,e){return r(t)?r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):new c(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},c.fromRotationTranslation=function(e,i,a){return i=n(i,t.ZERO),r(a)?(a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=0,a[4]=e[3],a[5]=e[4],a[6]=e[5],a[7]=0,a[8]=e[6],a[9]=e[7],a[10]=e[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(e[0],e[3],e[6],i.x,e[1],e[4],e[7],i.y,e[2],e[5],e[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(t,e,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=e.x*e.x,l=e.x*e.y,f=e.x*e.z,h=e.x*e.w,d=e.y*e.y,m=e.y*e.z,y=e.y*e.w,p=e.z*e.z,v=e.z*e.w,w=e.w*e.w,E=s-d-p+w,x=2*(l-v),g=2*(f+y),S=2*(l+v),M=-s+d-p+w,O=2*(m-h),z=2*(f-y),_=2*(m+h),T=-s-d+p+w;return i[0]=E*a,i[1]=S*a,i[2]=z*a,i[3]=0,i[4]=x*o,i[5]=M*o,i[6]=_*o,i[7]=0,i[8]=g*u,i[9]=O*u,i[10]=T*u,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i},c.fromTranslation=function(t,e){return c.fromRotationTranslation(u.IDENTITY,t,e)},c.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},c.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var l=new t,f=new t,h=new t;c.fromCamera=function(e,n){var i=e.eye,a=e.target,o=e.up;t.normalize(t.subtract(a,i,l),l),t.normalize(t.cross(l,o,f),f),t.normalize(t.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,E=h.z,x=i.x,g=i.y,S=i.z,M=u*-x+s*-g+d*-S,O=v*-x+w*-g+E*-S,z=m*x+y*g+p*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=E,n[10]=-p,n[11]=0,n[12]=M,n[13]=O,n[14]=z,n[15]=1,n):new c(u,s,d,M,v,w,E,O,-m,-y,-p,z,0,0,0,1)},c.computePerspectiveFieldOfView=function(t,e,n,r,i){var a=Math.tan(.5*t),o=1/a,u=o/e,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(t,e,n,r,i,a,o){var u=1/(e-t),s=1/(r-n),c=1/(a-i),l=-(e+t)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(t,e,n,r,i,a,o){var u=2*i/(e-t),s=2*i/(r-n),c=(e+t)/(e-t),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(t,e,n,r,i,a){var o=2*i/(e-t),u=2*i/(r-n),s=(e+t)/(e-t),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(t,e,r,i){t=n(t,n.EMPTY_OBJECT);var a=n(t.x,0),o=n(t.y,0),u=n(t.width,0),s=n(t.height,0);e=n(e,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-e),h=c,d=l,m=f,y=a+c,p=o+l,v=e+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},c.getElementIndex=function(t,e){return 4*t+e},c.getColumn=function(t,e,n){var r=4*e,i=t[r],a=t[r+1],o=t[r+2],u=t[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=4*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=t[15],n},c.getRow=function(t,e,n){var r=t[e],i=t[e+4],a=t[e+8],o=t[e+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+4]=n.y,r[e+8]=n.z,r[e+12]=n.w,r};var d=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],d)),n.y=t.magnitude(t.fromElements(e[4],e[5],e[6],d)),n.z=t.magnitude(t.fromElements(e[8],e[9],e[10],d)),n};var m=new t;c.getMaximumScale=function(e){return c.getScale(e,m),t.maximumComponent(m)},c.multiply=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[3],u=t[4],s=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],p=t[13],v=t[14],w=t[15],E=e[0],x=e[1],g=e[2],S=e[3],M=e[4],O=e[5],z=e[6],_=e[7],T=e[8],I=e[9],N=e[10],R=e[11],b=e[12],P=e[13],A=e[14],C=e[15],L=r*E+u*x+f*g+y*S,q=i*E+s*x+h*g+p*S,U=a*E+c*x+d*g+v*S,D=o*E+l*x+m*g+w*S,B=r*M+u*O+f*z+y*_,F=i*M+s*O+h*z+p*_,W=a*M+c*O+d*z+v*_,k=o*M+l*O+m*z+w*_,G=r*T+u*I+f*N+y*R,V=i*T+s*I+h*N+p*R,Y=a*T+c*I+d*N+v*R,j=o*T+l*I+m*N+w*R,Z=r*b+u*P+f*A+y*C,H=i*b+s*P+h*A+p*C,X=a*b+c*P+d*A+v*C,K=o*b+l*P+m*A+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=D,n[4]=B,n[5]=F,n[6]=W,n[7]=k,n[8]=G,n[9]=V,n[10]=Y,n[11]=j,n[12]=Z,n[13]=H,n[14]=X,n[15]=K,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n[9]=t[9]+e[9],n[10]=t[10]+e[10],n[11]=t[11]+e[11],n[12]=t[12]+e[12],n[13]=t[13]+e[13],n[14]=t[14]+e[14],n[15]=t[15]+e[15],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n[9]=t[9]-e[9],n[10]=t[10]-e[10],n[11]=t[11]-e[11],n[12]=t[12]-e[12],n[13]=t[13]-e[13],n[14]=t[14]-e[14],n[15]=t[15]-e[15],n},c.multiplyTransformation=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=t[12],d=t[13],m=t[14],y=e[0],p=e[1],v=e[2],w=e[4],E=e[5],x=e[6],g=e[8],S=e[9],M=e[10],O=e[12],z=e[13],_=e[14],T=r*y+o*p+c*v,I=i*y+u*p+l*v,N=a*y+s*p+f*v,R=r*w+o*E+c*x,b=i*w+u*E+l*x,P=a*w+s*E+f*x,A=r*g+o*S+c*M,C=i*g+u*S+l*M,L=a*g+s*S+f*M,q=r*O+o*z+c*_+h,U=i*O+u*z+l*_+d,D=a*O+s*z+f*_+m;return n[0]=T,n[1]=I,n[2]=N,n[3]=0,n[4]=R,n[5]=b,n[6]=P,n[7]=0,n[8]=A,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=D,n[15]=1,n},c.multiplyByMatrix3=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=e[0],d=e[1],m=e[2],y=e[3],p=e[4],v=e[5],w=e[6],E=e[7],x=e[8],g=r*h+o*d+c*m,S=i*h+u*d+l*m,M=a*h+s*d+f*m,O=r*y+o*p+c*v,z=i*y+u*p+l*v,_=a*y+s*p+f*v,T=r*w+o*E+c*x,I=i*w+u*E+l*x,N=a*w+s*E+f*x;return n[0]=g,n[1]=S,n[2]=M,n[3]=0,n[4]=O,n[5]=z,n[6]=_,n[7]=0,n[8]=T,n[9]=I,n[10]=N,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},c.multiplyByTranslation=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=r*t[0]+i*t[4]+a*t[8]+t[12],u=r*t[1]+i*t[5]+a*t[9]+t[13],s=r*t[2]+i*t[6]+a*t[10]+t[14];return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=o,n[13]=u,n[14]=s,n[15]=t[15],n};var y=new t;c.multiplyByUniformScale=function(t,e,n){return y.x=e,y.y=e,y.z=e,c.multiplyByScale(t,y,n)},c.multiplyByScale=function(t,e,n){var r=e.x,i=e.y,a=e.z;return 1===r&&1===i&&1===a?c.clone(t,n):(n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=0,n[4]=i*t[4],n[5]=i*t[5],n[6]=i*t[6],n[7]=0,n[8]=a*t[8],n[9]=a*t[9],n[10]=a*t[10],n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=1,n)},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t[0]*r+t[4]*i+t[8]*a+t[12]*o,s=t[1]*r+t[5]*i+t[9]*a+t[13]*o,c=t[2]*r+t[6]*i+t[10]*a+t[14]*o,l=t[3]*r+t[7]*i+t[11]*a+t[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a,u=t[1]*r+t[5]*i+t[9]*a,s=t[2]*r+t[6]*i+t[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a+t[12],u=t[1]*r+t[5]*i+t[9]*a+t[13],s=t[2]*r+t[6]*i+t[10]*a+t[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n[9]=t[9]*e,n[10]=t[10]*e,n[11]=t[11]*e,n[12]=t[12]*e,n[13]=t[13]*e,n[14]=t[14]*e,n[15]=t[15]*e,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},c.transpose=function(t,e){var n=t[1],r=t[2],i=t[3],a=t[6],o=t[7],u=t[11];return e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[10]=t[10],e[11]=t[14],e[12]=i,e[13]=o,e[14]=u,e[15]=t[15],e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e[9]=Math.abs(t[9]),e[10]=Math.abs(t[10]),e[11]=Math.abs(t[11]),e[12]=Math.abs(t[12]),e[13]=Math.abs(t[13]),e[14]=Math.abs(t[14]),e[15]=Math.abs(t[15]),e},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[3]===e[3]&&t[7]===e[7]&&t[11]===e[11]&&t[15]===e[15]},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n&&Math.abs(t[9]-e[9])<=n&&Math.abs(t[10]-e[10])<=n&&Math.abs(t[11]-e[11])<=n&&Math.abs(t[12]-e[12])<=n&&Math.abs(t[13]-e[13])<=n&&Math.abs(t[14]-e[14])<=n&&Math.abs(t[15]-e[15])<=n},c.getTranslation=function(t,e){return e.x=t[12],e.y=t[13],e.z=t[14],e},c.getRotation=function(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e};var p=new u,v=new u,w=new e,E=new e(0,0,0,1);return c.inverse=function(t,n){if(u.equalsEpsilon(c.getRotation(t,p),v,o.EPSILON7)&&e.equals(c.getRow(t,3,w),E))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-t[12],n[13]=-t[13],n[14]=-t[14],n[15]=1,n;var r=t[0],i=t[4],a=t[8],l=t[12],f=t[1],h=t[5],d=t[9],m=t[13],y=t[2],x=t[6],g=t[10],S=t[14],M=t[3],O=t[7],z=t[11],_=t[15],T=g*_,I=S*z,N=x*_,R=S*O,b=x*z,P=g*O,A=y*_,C=S*M,L=y*z,q=g*M,U=y*O,D=x*M,B=T*h+R*d+b*m-(I*h+N*d+P*m),F=I*f+A*d+q*m-(T*f+C*d+L*m),W=N*f+C*h+U*m-(R*f+A*h+D*m),k=P*f+L*h+D*d-(b*f+q*h+U*d),G=I*i+N*a+P*l-(T*i+R*a+b*l),V=T*r+C*a+L*l-(I*r+A*a+q*l),Y=R*r+A*i+D*l-(N*r+C*i+U*l),j=b*r+q*i+U*a-(P*r+L*i+D*a);T=a*m,I=l*d,N=i*m,R=l*h,b=i*d,P=a*h,A=r*m,C=l*f,L=r*d,q=a*f,U=r*h,D=i*f;var Z=T*O+R*z+b*_-(I*O+N*z+P*_),H=I*M+A*z+q*_-(T*M+C*z+L*_),X=N*M+C*O+U*_-(R*M+A*O+D*_),K=P*M+L*O+D*z-(b*M+q*O+U*z),J=N*g+P*S+I*x-(b*S+T*x+R*g),Q=L*S+T*y+C*g-(A*g+q*S+I*y),$=A*x+D*S+R*y-(U*S+N*y+C*x),te=U*g+b*y+q*x-(L*x+D*g+P*y),ee=r*B+i*F+a*W+l*k;if(Math.abs(ee)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return ee=1/ee,n[0]=B*ee,n[1]=F*ee,n[2]=W*ee,n[3]=k*ee,n[4]=G*ee,n[5]=V*ee,n[6]=Y*ee,n[7]=j*ee,n[8]=Z*ee,n[9]=H*ee,n[10]=X*ee,n[11]=K*ee,n[12]=J*ee,n[13]=Q*ee,n[14]=$*ee,n[15]=te*ee,n},c.inverseTransformation=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],u=t[6],s=t[8],c=t[9],l=t[10],f=t[12],h=t[13],d=t[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return e[0]=n,e[1]=a,e[2]=s,e[3]=0,e[4]=r,e[5]=o,e[6]=c,e[7]=0,e[8]=i,e[9]=u,e[10]=l,e[11]=0,e[12]=m,e[13]=y,e[14]=p,e[15]=1,e},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]&&t[9]===e[n+9]&&t[10]===e[n+10]&&t[11]===e[n+11]&&t[12]===e[n+12]&&t[13]===e[n+13]&&t[14]===e[n+14]&&t[15]===e[n+15]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e,n){this.normal=t.clone(e),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-t.dot(r,n);return e(a)?(t.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new t;return i.fromCartesian4=function(n,r){var o=t.fromCartesian4(n,a),u=n.w;return e(r)?(t.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(e,n){return t.dot(e.normal,n)+e.distance},i.ORIGIN_XY_PLANE=r(new i(t.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(t.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(t.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";var s=function(t,n,r,i){this.west=e(t,0),this.south=e(n,0),this.east=e(r,0),this.north=e(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(t,n,r){r=e(r,0),n[r++]=t.west,n[r++]=t.south,n[r++]=t.east,n[r]=t.north},s.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new s),i.west=t[r++],i.south=t[r++],i.east=t[r++],i.north=t[r],i},s.computeWidth=function(t){var e=t.east,n=t.west;return n>e&&(e+=u.TWO_PI),e-n},s.computeHeight=function(t){return t.north-t.south},s.fromDegrees=function(t,r,i,a,o){return t=u.toRadians(e(t,0)),r=u.toRadians(e(r,0)),i=u.toRadians(e(i,0)),a=u.toRadians(e(a,0)),n(o)?(o.west=t,o.south=r,o.east=i,o.north=a,o):new s(t,r,i,a)},s.fromCartographicArray=function(t,e){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=t.length;c>u;u++){var l=t[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(e)?(e.west=r,e.south=a,e.east=i,e.north=o,e):new s(r,a,i,o)},s.clone=function(t,e){return n(t)?n(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north):void 0},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||n(t)&&n(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return n(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(){},s.southwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.south,r.height=0,r):new t(e.west,e.south)},s.northwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.north,r.height=0,r):new t(e.west,e.north)},s.northeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.north,r.height=0,r):new t(e.east,e.north)},s.southeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.south,r.height=0,r):new t(e.east,e.south)},s.center=function(e,r){var i=e.east,a=e.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(e.south+e.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new t(o,s)},s.intersection=function(t,e,r){var i=t.east,a=t.west,o=e.east,c=e.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((t.west<t.east||e.west<e.east)&&l>=f)return void 0;var h=Math.max(t.south,e.south),d=Math.min(t.north,e.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(t,e){var n=e.longitude,r=e.latitude,i=t.west,a=t.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,r,i,o){r=e(r,a.WGS84),i=e(i,0),n(o)||(o=[]);var l=0,f=t.north,h=t.south,d=t.east,m=t.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(t,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,r){this.center=t.clone(n(e,t.ZERO)),this.radius=n(r,0)},m=new t,y=new t,p=new t,v=new t,w=new t,E=new t,x=new t,g=new t,S=new t,M=new t,O=new t,z=new t;d.fromPoints=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;for(var i=t.clone(e[0],x),a=t.clone(i,m),o=t.clone(i,y),u=t.clone(i,p),s=t.clone(i,v),c=t.clone(i,w),l=t.clone(i,E),f=e.length,h=1;f>h;h++){t.clone(e[h],i);var _=i.x,T=i.y,I=i.z;_<a.x&&t.clone(i,a),_>s.x&&t.clone(i,s),T<o.y&&t.clone(i,o),T>c.y&&t.clone(i,c),I<u.z&&t.clone(i,u),I>l.z&&t.clone(i,l)}var N=t.magnitudeSquared(t.subtract(s,a,g)),R=t.magnitudeSquared(t.subtract(c,o,g)),b=t.magnitudeSquared(t.subtract(l,u,g)),P=a,A=s,C=N;R>C&&(C=R,P=o,A=c),b>C&&(C=b,P=u,A=l);var L=S;L.x=.5*(P.x+A.x),L.y=.5*(P.y+A.y),L.z=.5*(P.z+A.z);var q=t.magnitudeSquared(t.subtract(A,L,g)),U=Math.sqrt(q),D=M;D.x=a.x,D.y=o.y,D.z=u.z;var B=O;B.x=s.x,B.y=c.y,B.z=l.z;var F=t.multiplyByScalar(t.add(D,B,g),.5,z),W=0;for(h=0;f>h;h++){t.clone(e[h],i);var k=t.magnitude(t.subtract(i,F,g));k>W&&(W=k);var G=t.magnitudeSquared(t.subtract(i,L,g));if(G>q){var V=Math.sqrt(G);U=.5*(U+V),q=U*U;var Y=V-U;L.x=(U*L.x+Y*i.x)/V,L.y=(U*L.y+Y*i.y)/V,L.z=(U*L.z+Y*i.z)/V}}return W>U?(t.clone(L,n.center),n.radius=U):(t.clone(F,n.center),n.radius=W),n};var _=new u,T=new t,I=new t,N=new e,R=new e;d.fromRectangle2D=function(t,e,n){return d.fromRectangleWithHeights2D(t,e,0,0,n)},d.fromRectangleWithHeights2D=function(e,i,a,o,u){if(r(u)||(u=new d),!r(e))return u.center=t.clone(t.ZERO,u.center),u.radius=0,u;i=n(i,_),h.southwest(e,N),N.height=a,h.northeast(e,R),R.height=o;var s=i.project(N,T),c=i.project(R,I),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var b=[];d.fromRectangle3D=function(t,e,i,a){e=n(e,o.WGS84),i=n(i,0);var u;return r(t)&&(u=h.subsample(t,e,i,b)),d.fromPoints(u,a)},d.fromVertices=function(e,i,a,o){if(r(o)||(o=new d),!r(e)||0===e.length)return o.center=t.clone(t.ZERO,o.center),o.radius=0,o;i=n(i,t.ZERO),a=n(a,3);var u=x;u.x=e[0]+i.x,u.y=e[1]+i.y,u.z=e[2]+i.z;for(var s=t.clone(u,m),c=t.clone(u,y),l=t.clone(u,p),f=t.clone(u,v),h=t.clone(u,w),_=t.clone(u,E),T=e.length,I=0;T>I;I+=a){var N=e[I]+i.x,R=e[I+1]+i.y,b=e[I+2]+i.z;u.x=N,u.y=R,u.z=b,N<s.x&&t.clone(u,s),N>f.x&&t.clone(u,f),R<c.y&&t.clone(u,c),R>h.y&&t.clone(u,h),b<l.z&&t.clone(u,l),b>_.z&&t.clone(u,_)}var P=t.magnitudeSquared(t.subtract(f,s,g)),A=t.magnitudeSquared(t.subtract(h,c,g)),C=t.magnitudeSquared(t.subtract(_,l,g)),L=s,q=f,U=P;A>U&&(U=A,L=c,q=h),C>U&&(U=C,L=l,q=_);var D=S;D.x=.5*(L.x+q.x),D.y=.5*(L.y+q.y),D.z=.5*(L.z+q.z);var B=t.magnitudeSquared(t.subtract(q,D,g)),F=Math.sqrt(B),W=M;W.x=s.x,W.y=c.y,W.z=l.z;var k=O;k.x=f.x,k.y=h.y,k.z=_.z;var G=t.multiplyByScalar(t.add(W,k,g),.5,z),V=0;for(I=0;T>I;I+=a){u.x=e[I]+i.x,u.y=e[I+1]+i.y,u.z=e[I+2]+i.z;var Y=t.magnitude(t.subtract(u,G,g));Y>V&&(V=Y);var j=t.magnitudeSquared(t.subtract(u,D,g));if(j>B){var Z=Math.sqrt(j);F=.5*(F+Z),B=F*F;var H=Z-F;D.x=(F*D.x+H*u.x)/Z,D.y=(F*D.y+H*u.y)/Z,D.z=(F*D.z+H*u.z)/Z}}return V>F?(t.clone(D,o.center),o.radius=F):(t.clone(G,o.center),o.radius=V),o},d.fromCornerPoints=function(e,n,i){r(i)||(i=new d);var a=i.center;return t.add(e,n,a),t.multiplyByScalar(a,.5,a),i.radius=t.distance(a,n),i},d.fromEllipsoid=function(e,n){return r(n)||(n=new d),t.clone(t.ZERO,n.center),n.radius=e.maximumRadius,n};var P=new t;d.fromBoundingSpheres=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var i=e.length;if(1===i)return d.clone(e[0],n);if(2===i)return d.union(e[0],e[1],n);for(var a=[],o=0;i>o;o++)a.push(e[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=e[o];s=Math.max(s,t.distance(u,c.center,P)+c.radius)}return n.radius=s,n},d.clone=function(e,n){return r(e)?r(n)?(n.center=t.clone(e.center,n.center),n.radius=e.radius,n):new d(e.center,e.radius):void 0},d.packedLength=4,d.pack=function(t,e,r){r=n(r,0);var i=t.center;e[r++]=i.x,e[r++]=i.y,e[r++]=i.z,e[r]=t.radius},d.unpack=function(t,e,i){e=n(e,0),r(i)||(i=new d);var a=i.center;return a.x=t[e++],a.y=t[e++],a.z=t[e++],i.radius=t[e],i};var A=new t,C=new t;d.union=function(e,n,i){r(i)||(i=new d);var a=e.center,o=e.radius,u=n.center,s=n.radius,c=t.subtract(u,a,A),l=t.magnitude(c);if(o>=l+s)return e.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=t.multiplyByScalar(c,(-o+f)/l,C);return t.add(h,a,h),t.clone(h,i.center),i.radius=f,i};var L=new t;d.expand=function(e,n,r){r=d.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new t,0);d.intersect=function(t,e){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(e,q);return d.intersectPlane(t,n)},d.transform=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=l.getMaximumScale(e)*t.radius,n};var U=new t;d.distanceSquaredTo=function(e,n){var r=t.subtract(e.center,n,U);return t.magnitudeSquared(r)-e.radius*e.radius},d.transformWithoutScale=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=t.radius,n};var D=new t;d.computePlaneDistances=function(e,n,i,a){r(a)||(a=new c);var o=t.subtract(e.center,n,D),u=t.multiplyByScalar(i,t.dot(i,o),D),s=t.magnitude(u);return a.start=s-e.radius,a.stop=s+e.radius,a};for(var B=new t,F=new t,W=new t,k=new t,G=new t,V=new e,Y=new Array(8),j=0;8>j;++j)Y[j]=new t;var Z=new u;return d.projectTo2D=function(e,r,i){r=n(r,Z);var a=r.ellipsoid,o=e.center,u=e.radius,s=a.geodeticSurfaceNormal(o,B),c=t.cross(t.UNIT_Z,s,F);t.normalize(c,c);var l=t.cross(s,c,W);t.normalize(l,l),t.multiplyByScalar(s,u,s),t.multiplyByScalar(l,u,l),t.multiplyByScalar(c,u,c);var f=t.negate(l,G),h=t.negate(c,k),m=Y,y=m[0];t.add(s,l,y),t.add(y,c,y),y=m[1],t.add(s,l,y),t.add(y,h,y),y=m[2],t.add(s,f,y),t.add(y,h,y),y=m[3],t.add(s,f,y),t.add(y,c,y),t.negate(s,s),y=m[4],t.add(s,l,y),t.add(y,c,y),y=m[5],t.add(s,l,y),t.add(y,h,y),y=m[6],t.add(s,f,y),t.add(y,h,y),y=m[7],t.add(s,f,y),t.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];t.add(o,w,w);var E=a.cartesianToCartographic(w,V);r.project(E,w)}i=d.fromPoints(m,i),o=i.center;var x=o.x,g=o.y,S=o.z;return o.x=S,o.y=x,o.z=g,i},d.equals=function(e,n){return e===n||r(e)&&r(n)&&t.equals(e.center,n.center)&&e.radius===n.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n){this.x=t(e,0),this.y=t(n,0)};a.fromElements=function(t,n,r){return e(r)?(r.x=t,r.y=n,r):new a(t,n)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n):new a(t.x,t.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r]=e.y},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y)},a.minimumComponent=function(t){return Math.min(t.x,t.y)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){return a.normalize(t,s),a.normalize(e,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Y,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)},a.ZERO=r(new a(0,0)),a.UNIT_X=r(new a(1,0)),a.UNIT_Y=r(new a(0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,e){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return e(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(t(n))return n;n=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof e[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof e[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",t(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",t(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",t(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",t(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(t){i.supportsFullscreen()&&t[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,e,n){"use strict";function r(t){for(var e=t.split("."),n=0,r=e.length;r>n;++n)e[n]=parseInt(e[n],10);return e}function i(){if(!e(p)){p=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(p=!0,v=r(t[1]))}return p}function a(){return i()&&v}function o(){if(!e(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(w=!0,E=r(t[1]))}return w}function u(){return o()&&E}function s(){if(!e(x)){x=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(x=!0,g=r(t[1]),g.isNightly=!!t[2])}return x}function c(){return s()&&g}function l(){if(!e(S)){S=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1])))}return S}function f(){return l()&&M}function h(){if(!e(O)){O=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(O=!0,z=r(t[1]))}return O}function d(){return e(_)||(_=/Windows/i.test(navigator.appVersion)),_}function m(){return h()&&z}function y(){return e(T)||(T=e(window.PointerEvent)&&(!e(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var p,v,w,E,x,g,S,M,O,z,_,T,I={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return I.supportsFullscreen=function(){return n.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,e,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(t){switch(t){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(t){return t instanceof Int8Array?a.BYTE:t instanceof Uint8Array?a.UNSIGNED_BYTE:t instanceof Int16Array?a.SHORT:t instanceof Uint16Array?a.UNSIGNED_SHORT:t instanceof Float32Array?a.FLOAT:t instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(t){return e(t)&&(t===a.BYTE||t===a.UNSIGNED_BYTE||t===a.SHORT||t===a.UNSIGNED_SHORT||t===a.FLOAT||t===a.DOUBLE)},a.createTypedArray=function(t,e){switch(t){case a.BYTE:return new Int8Array(e);case a.UNSIGNED_BYTE:return new Uint8Array(e);case a.SHORT:return new Int16Array(e);case a.UNSIGNED_SHORT:return new Uint16Array(e);case a.FLOAT:return new Float32Array(e);case a.DOUBLE:return new Float64Array(e);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(e,r,i,o){switch(i=t(i,0),o=t(o,(r.byteLength-i)/a.getSizeInBytes(e)),e){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var e={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(e)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===e.POINTS||t===e.LINES||t===e.LINE_LOOP||t===e.LINE_STRIP||t===e.TRIANGLES||t===e.TRIANGLE_STRIP||t===e.TRIANGLE_FAN}};return t(e)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,e,n,r,i){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=t(e.primitiveType,i.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=t(e.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(t){var r=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&e(t.attributes[i])&&e(t.attributes[i].values)){var a=t.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=t(e.normalize,!1),this.values=e.values -};return e}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color};return e}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(t){switch(t){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(e){return t(e)&&(e===i.UNSIGNED_BYTE||e===i.UNSIGNED_SHORT||e===i.UNSIGNED_INT)},i.createTypedArray=function(t,e){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e):new Uint16Array(e)},i.createTypedArrayFromArrayBuffer=function(t,e,n,i){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e,n,i):new Uint16Array(e,n,i)},n(i)}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e){e=t(e,t.EMPTY_OBJECT),this.position=t(e.position,!1),this.normal=t(e.normal,!1),this.st=t(e.st,!1),this.binormal=t(e.binormal,!1),this.tangent=t(e.tangent,!1),this.color=t(e.color,!1)};return i.POSITION_ONLY=r(new i({position:!0})),i.POSITION_AND_NORMAL=r(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=r(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=r(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=r(new i({position:!0,color:!0})),i.ALL=r(new i({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(e,n,r){r=t(r,0),n[r++]=e.position?1:0,n[r++]=e.normal?1:0,n[r++]=e.st?1:0,n[r++]=e.binormal?1:0,n[r++]=e.tangent?1:0,n[r++]=e.color?1:0},i.unpack=function(n,r,a){return r=t(r,0),e(a)||(a=new i),a.position=1===n[r++],a.normal=1===n[r++],a.st=1===n[r++],a.binormal=1===n[r++],a.tangent=1===n[r++],a.color=1===n[r++],a},i.clone=function(t,n){return e(t)?(e(n)||(n=new i),n.position=t.position,n.normal=t.normal,n.st=t.st,n.binormal=t.binormal,n.tangent=t.tangent,n.color=t.color,n):void 0},i}),define("Core/EllipsoidGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./VertexFormat"],function(t,e,n,r,i,a,o,u,s,c,l,f,h,d,m){"use strict";var y=new n,p=new n,v=new n,w=new n,E=new n,x=new n(1,1,1),g=Math.cos,S=Math.sin,M=function(t){t=i(t,i.EMPTY_OBJECT);var e=i(t.radii,x),r=i(t.stackPartitions,64),a=i(t.slicePartitions,64),o=i(t.vertexFormat,m.DEFAULT);this._radii=n.clone(e),this._stackPartitions=r,this._slicePartitions=a,this._vertexFormat=m.clone(o),this._workerName="createEllipsoidGeometry"};M.packedLength=n.packedLength+m.packedLength+2,M.pack=function(t,e,r){r=i(r,0),n.pack(t._radii,e,r),r+=n.packedLength,m.pack(t._vertexFormat,e,r),r+=m.packedLength,e[r++]=t._stackPartitions,e[r]=t._slicePartitions};var O=new n,z=new m,_={radii:O,vertexFormat:z,stackPartitions:void 0,slicePartitions:void 0};return M.unpack=function(t,e,r){e=i(e,0);var o=n.unpack(t,e,O);e+=n.packedLength;var u=m.unpack(t,e,z);e+=m.packedLength;var s=t[e++],c=t[e];return a(r)?(r._radii=n.clone(o,r._radii),r._vertexFormat=m.clone(u,r._vertexFormat),r._stackPartitions=s,r._slicePartitions=c,r):(_.stackPartitions=s,_.slicePartitions=c,new M(_))},M.createGeometry=function(i){var a,o,m=i._radii,x=u.fromCartesian3(m),M=i._vertexFormat,O=i._slicePartitions+1,z=i._stackPartitions+1,_=z*O,T=new Float64Array(3*_),I=6*(O-1)*(z-1),N=f.createTypedArray(_,I),R=M.normal?new Float32Array(3*_):void 0,b=M.tangent?new Float32Array(3*_):void 0,P=M.binormal?new Float32Array(3*_):void 0,A=M.st?new Float32Array(2*_):void 0,C=new Array(O),L=new Array(O),q=0;for(a=0;O>a;a++){var U=h.TWO_PI*a/(O-1);C[a]=g(U),L[a]=S(U),T[q++]=0,T[q++]=0,T[q++]=m.z}for(a=1;z-1>a;a++){var D=Math.PI*a/(z-1),B=S(D),F=m.x*B,W=m.y*B,k=m.z*g(D);for(o=0;O>o;o++)T[q++]=C[o]*F,T[q++]=L[o]*W,T[q++]=k}for(a=0;O>a;a++)T[q++]=0,T[q++]=0,T[q++]=-m.z;var G=new l;M.position&&(G.position=new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:T}));var V=0,Y=0,j=0,Z=0;if(M.st||M.normal||M.tangent||M.binormal){for(a=0;_>a;a++){var H=n.fromArray(T,3*a,y),X=x.geodeticSurfaceNormal(H,p);if(M.st){var K=e.negate(X,E);e.magnitude(K)<h.EPSILON6&&(q=3*(a+O*Math.floor(.5*z)),q>T.length&&(q=3*(a-O*Math.floor(.5*z))),n.fromArray(T,q,K),x.geodeticSurfaceNormal(K,K),e.negate(K,K)),A[V++]=Math.atan2(K.y,K.x)/h.TWO_PI+.5,A[V++]=Math.asin(X.z)/Math.PI+.5}if(M.normal&&(R[Y++]=X.x,R[Y++]=X.y,R[Y++]=X.z),M.tangent||M.binormal){var J=v;if(O>a||a>_-O-1?(n.cross(n.UNIT_X,X,J),n.normalize(J,J)):(n.cross(n.UNIT_Z,X,J),n.normalize(J,J)),M.tangent&&(b[j++]=J.x,b[j++]=J.y,b[j++]=J.z),M.binormal){var Q=n.cross(X,J,w);n.normalize(Q,Q),P[Z++]=Q.x,P[Z++]=Q.y,P[Z++]=Q.z}}}M.st&&(G.st=new c({componentDatatype:r.FLOAT,componentsPerAttribute:2,values:A})),M.normal&&(G.normal=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:R})),M.tangent&&(G.tangent=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:b})),M.binormal&&(G.binormal=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:P}))}for(q=0,a=0;z>a;a++){var $=a*O,te=(a+1)*O;for(o=0;O-1>o;o++)N[q++]=te+o,N[q++]=te+o+1,N[q++]=$+o+1,N[q++]=te+o,N[q++]=$+o+1,N[q++]=$+o}return new s({attributes:G,indices:N,primitiveType:d.TRIANGLES,boundingSphere:t.fromEllipsoid(x)})},M}),define("Workers/createEllipsoidGeometry",["../Core/defined","../Core/EllipsoidGeometry"],function(t,e){"use strict";return function(n,r){return t(r)&&(n=e.unpack(n,r)),e.createGeometry(n)}})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createEllipsoidOutlineGeometry.js b/libs/Cesium/Workers/createEllipsoidOutlineGeometry.js deleted file mode 100644 index 867ef4ff..00000000 --- a/libs/Cesium/Workers/createEllipsoidOutlineGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(t){return t>0?1:0>t?-1:0},n.signNotZero=function(t){return 0>t?-1:1},n.toSNorm=function(t){return Math.round(255*(.5*n.clamp(t,-1,1)+.5))},n.fromSNorm=function(t){return 2*(n.clamp(t,0,255)/255)-1},n.sinh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e-n)},n.cosh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e+n)},n.lerp=function(t,e,n){return(1-n)*t+n*e},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(t){return t*n.RADIANS_PER_DEGREE},n.toDegrees=function(t){return t*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(t){var e=n.TWO_PI,r=t-Math.floor(t/e)*e;return r<-Math.PI?r+e:r>=Math.PI?r-e:r},n.negativePiToPi=function(t){return n.zeroToTwoPi(t+n.PI)-n.PI},n.zeroToTwoPi=function(t){var e=n.mod(t,n.TWO_PI);return Math.abs(e)<n.EPSILON14&&Math.abs(t)>n.EPSILON14?n.TWO_PI:e},n.mod=function(t,e){return(t%e+e)%e},n.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return i>=a||a<=r*Math.max(Math.abs(t),Math.abs(n))};var r=[1];n.factorial=function(t){var e=r.length;if(t>=e)for(var n=r[e-1],i=e;t>=i;i++)r.push(n*i);return r[t]},n.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},n.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},n.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},n.clamp=function(t,e,n){return e>t?e:t>n?n:t};var i=new t;return n.setRandomNumberSeed=function(e){i=new t(e)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(t){return Math.acos(n.clamp(t,-1,1))},n.asinClamped=function(t){return Math.asin(n.clamp(t,-1,1))},n.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)};a.fromSpherical=function(n,r){e(r)||(r=new a);var i=n.clock,o=n.cone,u=t(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(t,n,r,i){return e(i)?(i.x=t,i.y=n,i.z=r,i):new a(t,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):n.y<=n.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)},a.cross=function(t,e,n){var r=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(t,e,n,r,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),e(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o++)r[o]=i.toRadians(t[o]);return a.fromRadiansArray(r,e,n)},a.fromRadiansArray=function(t,n,r){var i=t.length;e(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o+=3)r[o]=i.toRadians(t[o]),r[o+1]=i.toRadians(t[o+1]),r[o+2]=t[o+2];return a.fromRadiansArrayHeights(r,e,n)},a.fromRadiansArrayHeights=function(t,n,r){var i=t.length;e(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)};return a.fromRadians=function(n,r,i,o){return i=t(i,0),e(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(t,e,n,r){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},a.equalsEpsilon=function(t,n,r){return t===n||e(t)&&e(n)&&Math.abs(t.longitude-n.longitude)<=r&&Math.abs(t.latitude-n.latitude)<=r&&Math.abs(t.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var e={},n=function(n,r){t(e[n])||(e[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(e,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),e._radii=new t(r,i,a),e._radiiSquared=new t(r*r,i*i,a*a),e._radiiToTheFourth=new t(r*r*r*r,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(r,i,a),e._maximumRadius=Math.max(r,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,n){if(!r(e))return void 0;var i=e._radii;return r(n)?(t.clone(i,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return r(e)||(e=new c),r(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,r,i){i=n(i,0),t.pack(e._radii,r,i)},c.unpack=function(e,r,i){r=n(r,0);var a=t.unpack(e,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,n){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(e,n){return r(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;c.prototype.cartographicToCartesian=function(e,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),r(n)||(n=new t),t.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var h=new t,d=new t,m=new t;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=t.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(t.dot(s,n))*t.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new e(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,n){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),E=t.multiplyByScalar(e,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?t.clone(E,n):void 0;var g=this._oneOverRadiiSquared,x=g.x,S=g.y,M=g.z,z=p;z.x=2*E.x*x,z.y=2*E.y*S,z.z=2*E.z*M;var O,_,T,I,N,R,b,P,A,C,L,q=(1-w)*t.magnitude(e)/(.5*t.magnitude(z)),U=0;do{q-=U,T=1/(1+q*x),I=1/(1+q*S),N=1/(1+q*M),R=T*T,b=I*I,P=N*N,A=R*T,C=b*I,L=P*N,O=h*R+d*b+m*P-1,_=h*A*x+d*C*S+m*L*M;var D=-2*_;U=O/D}while(Math.abs(O)>u.EPSILON12);return r(n)?(n.x=i*T,n.y=a*I,n.z=o*N,n):new t(i*T,a*I,o*N)},c.prototype.scaleToGeocentricSurface=function(e,n){r(n)||(n=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,n)},c.prototype.transformPositionToScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._radii,n)},c.prototype.equals=function(e){return this===e||r(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";var u=function(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var e={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(e)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var e=function(e,n){this.start=t(e,0),this.stop=t(n,0)};return e}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)};a.fromElements=function(t,n,r,i,o){return e(o)?(o.x=t,o.y=n,o.z=r,o.w=i,o):new a(t,n,r,i)},a.fromColor=function(t,n){return e(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new a(t.red,t.green,t.blue,t.alpha)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new a(t.x,t.y,t.z,t.w):void 0},a.packedLength=4,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n.w=Math.min(t.w,e.w),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n.w=Math.max(t.w,e.w),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e.w=t.w/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n.w=t.w*e.w,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n.w=t.w+e.w,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n.w=t.w-e.w,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n.w=t.w*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n.w=t.w/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e.w=Math.abs(t.w),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,s);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]&&t.w===e[n+3]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)&&i.equalsEpsilon(t.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t){for(var e=0,n=0;9>n;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function u(t){for(var e=0,n=0;3>n;++n){var r=t[c.getElementIndex(d[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function s(t,e){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(t[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(t[c.getElementIndex(m,f)])>n){var y,p=t[c.getElementIndex(m,m)],v=t[c.getElementIndex(f,f)],w=t[c.getElementIndex(m,f)],E=(p-v)/2/w;y=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),s=1/Math.sqrt(1+y*y),l=y*s}return e=c.clone(c.IDENTITY,e),e[c.getElementIndex(f,f)]=e[c.getElementIndex(m,m)]=s,e[c.getElementIndex(m,f)]=l,e[c.getElementIndex(f,m)]=-l,e}var c=function(t,n,r,i,a,o,u,s,c){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(u,0),this[3]=e(n,0),this[4]=e(a,0),this[5]=e(s,0),this[6]=e(r,0),this[7]=e(o,0),this[8]=e(c,0)};c.packedLength=9,c.pack=function(t,n,r){r=e(r,0),n[r++]=t[0],n[r++]=t[1],n[r++]=t[2],n[r++]=t[3],n[r++]=t[4],n[r++]=t[5],n[r++]=t[6],n[r++]=t[7],n[r++]=t[8]},c.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r++],i[1]=t[r++],i[2]=t[r++],i[3]=t[r++],i[4]=t[r++],i[5]=t[r++],i[6]=t[r++],i[7]=t[r++],i[8]=t[r++],i},c.clone=function(t,e){return n(t)?n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new c(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},c.fromArray=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r],i[1]=t[r+1],i[2]=t[r+2],i[3]=t[r+3],i[4]=t[r+4],i[5]=t[r+5],i[6]=t[r+6],i[7]=t[r+7],i[8]=t[r+8],i},c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},c.fromQuaternion=function(t,e){var r=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,s=t.y*t.z,l=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,E=2*(s-o),g=2*(a-l),x=2*(s+o),S=-r-u+f+d;return n(e)?(e[0]=m,e[1]=v,e[2]=g,e[3]=y,e[4]=w,e[5]=x,e[6]=p,e[7]=E,e[8]=S,e):new c(m,y,p,v,w,E,g,x,S)},c.fromScale=function(t,e){return n(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new c(t.x,0,0,0,t.y,0,0,0,t.z)},c.fromUniformScale=function(t,e){return n(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new c(t,0,0,0,t,0,0,0,t)},c.fromCrossProduct=function(t,e){return n(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new c(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},c.fromRotationX=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=r,e[5]=i,e[6]=0,e[7]=-i,e[8]=r,e):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=r,e):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},c.getElementIndex=function(t,e){return 3*t+e},c.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;c.getMaximumScale=function(e){return c.getScale(e,f),t.maximumComponent(f)},c.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],l=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],f=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},c.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},c.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],l=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=l,e};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(t,e){var r=a.EPSILON20,i=10,l=0,f=0;n(e)||(e={});for(var h=e.unitary=c.clone(c.IDENTITY,e.unitary),d=e.diagonal=c.clone(t,e.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},c.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(t,e){var n=t[0],i=t[1],o=t[2],u=t[3],s=t[4],l=t[5],f=t[6],h=t[7],d=t[8],m=c.determinant(t);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");e[0]=s*d-h*l,e[1]=h*o-i*d,e[2]=i*l-s*o,e[3]=f*l-u*d,e[4]=n*d-f*o,e[5]=u*o-n*l,e[6]=u*h-f*s,e[7]=f*i-n*h,e[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(e,y,e)},c.equals=function(t,e){return t===e||n(t)&&n(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},c.equalsEpsilon=function(t,e,r){return t===e||n(t)&&n(e)&&Math.abs(t[0]-e[0])<=r&&Math.abs(t[1]-e[1])<=r&&Math.abs(t[2]-e[2])<=r&&Math.abs(t[3]-e[3])<=r&&Math.abs(t[4]-e[4])<=r&&Math.abs(t[5]-e[5])<=r&&Math.abs(t[6]-e[6])<=r&&Math.abs(t[7]-e[7])<=r&&Math.abs(t[8]-e[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var e=function(t){this.name="RuntimeError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,e,n,r,i,a,o,u,s){"use strict";var c=function(t,e,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(t,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(e,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(t,e,r){r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e[r++]=t[9],e[r++]=t[10],e[r++]=t[11],e[r++]=t[12],e[r++]=t[13],e[r++]=t[14],e[r]=t[15]},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},c.clone=function(t,e){return r(t)?r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):new c(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},c.fromRotationTranslation=function(e,i,a){return i=n(i,t.ZERO),r(a)?(a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=0,a[4]=e[3],a[5]=e[4],a[6]=e[5],a[7]=0,a[8]=e[6],a[9]=e[7],a[10]=e[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(e[0],e[3],e[6],i.x,e[1],e[4],e[7],i.y,e[2],e[5],e[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(t,e,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=e.x*e.x,l=e.x*e.y,f=e.x*e.z,h=e.x*e.w,d=e.y*e.y,m=e.y*e.z,y=e.y*e.w,p=e.z*e.z,v=e.z*e.w,w=e.w*e.w,E=s-d-p+w,g=2*(l-v),x=2*(f+y),S=2*(l+v),M=-s+d-p+w,z=2*(m-h),O=2*(f-y),_=2*(m+h),T=-s-d+p+w;return i[0]=E*a,i[1]=S*a,i[2]=O*a,i[3]=0,i[4]=g*o,i[5]=M*o,i[6]=_*o,i[7]=0,i[8]=x*u,i[9]=z*u,i[10]=T*u,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i},c.fromTranslation=function(t,e){return c.fromRotationTranslation(u.IDENTITY,t,e)},c.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},c.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var l=new t,f=new t,h=new t;c.fromCamera=function(e,n){var i=e.eye,a=e.target,o=e.up;t.normalize(t.subtract(a,i,l),l),t.normalize(t.cross(l,o,f),f),t.normalize(t.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,E=h.z,g=i.x,x=i.y,S=i.z,M=u*-g+s*-x+d*-S,z=v*-g+w*-x+E*-S,O=m*g+y*x+p*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=E,n[10]=-p,n[11]=0,n[12]=M,n[13]=z,n[14]=O,n[15]=1,n):new c(u,s,d,M,v,w,E,z,-m,-y,-p,O,0,0,0,1)},c.computePerspectiveFieldOfView=function(t,e,n,r,i){var a=Math.tan(.5*t),o=1/a,u=o/e,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(t,e,n,r,i,a,o){var u=1/(e-t),s=1/(r-n),c=1/(a-i),l=-(e+t)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(t,e,n,r,i,a,o){var u=2*i/(e-t),s=2*i/(r-n),c=(e+t)/(e-t),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(t,e,n,r,i,a){var o=2*i/(e-t),u=2*i/(r-n),s=(e+t)/(e-t),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(t,e,r,i){t=n(t,n.EMPTY_OBJECT);var a=n(t.x,0),o=n(t.y,0),u=n(t.width,0),s=n(t.height,0);e=n(e,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-e),h=c,d=l,m=f,y=a+c,p=o+l,v=e+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},c.getElementIndex=function(t,e){return 4*t+e},c.getColumn=function(t,e,n){var r=4*e,i=t[r],a=t[r+1],o=t[r+2],u=t[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=4*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=t[15],n},c.getRow=function(t,e,n){var r=t[e],i=t[e+4],a=t[e+8],o=t[e+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+4]=n.y,r[e+8]=n.z,r[e+12]=n.w,r};var d=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],d)),n.y=t.magnitude(t.fromElements(e[4],e[5],e[6],d)),n.z=t.magnitude(t.fromElements(e[8],e[9],e[10],d)),n};var m=new t;c.getMaximumScale=function(e){return c.getScale(e,m),t.maximumComponent(m)},c.multiply=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[3],u=t[4],s=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],p=t[13],v=t[14],w=t[15],E=e[0],g=e[1],x=e[2],S=e[3],M=e[4],z=e[5],O=e[6],_=e[7],T=e[8],I=e[9],N=e[10],R=e[11],b=e[12],P=e[13],A=e[14],C=e[15],L=r*E+u*g+f*x+y*S,q=i*E+s*g+h*x+p*S,U=a*E+c*g+d*x+v*S,D=o*E+l*g+m*x+w*S,B=r*M+u*z+f*O+y*_,W=i*M+s*z+h*O+p*_,F=a*M+c*z+d*O+v*_,G=o*M+l*z+m*O+w*_,k=r*T+u*I+f*N+y*R,V=i*T+s*I+h*N+p*R,Y=a*T+c*I+d*N+v*R,j=o*T+l*I+m*N+w*R,H=r*b+u*P+f*A+y*C,Z=i*b+s*P+h*A+p*C,X=a*b+c*P+d*A+v*C,K=o*b+l*P+m*A+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=D,n[4]=B,n[5]=W,n[6]=F,n[7]=G,n[8]=k,n[9]=V,n[10]=Y,n[11]=j,n[12]=H,n[13]=Z,n[14]=X,n[15]=K,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n[9]=t[9]+e[9],n[10]=t[10]+e[10],n[11]=t[11]+e[11],n[12]=t[12]+e[12],n[13]=t[13]+e[13],n[14]=t[14]+e[14],n[15]=t[15]+e[15],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n[9]=t[9]-e[9],n[10]=t[10]-e[10],n[11]=t[11]-e[11],n[12]=t[12]-e[12],n[13]=t[13]-e[13],n[14]=t[14]-e[14],n[15]=t[15]-e[15],n},c.multiplyTransformation=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=t[12],d=t[13],m=t[14],y=e[0],p=e[1],v=e[2],w=e[4],E=e[5],g=e[6],x=e[8],S=e[9],M=e[10],z=e[12],O=e[13],_=e[14],T=r*y+o*p+c*v,I=i*y+u*p+l*v,N=a*y+s*p+f*v,R=r*w+o*E+c*g,b=i*w+u*E+l*g,P=a*w+s*E+f*g,A=r*x+o*S+c*M,C=i*x+u*S+l*M,L=a*x+s*S+f*M,q=r*z+o*O+c*_+h,U=i*z+u*O+l*_+d,D=a*z+s*O+f*_+m;return n[0]=T,n[1]=I,n[2]=N,n[3]=0,n[4]=R,n[5]=b,n[6]=P,n[7]=0,n[8]=A,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=D,n[15]=1,n},c.multiplyByMatrix3=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=e[0],d=e[1],m=e[2],y=e[3],p=e[4],v=e[5],w=e[6],E=e[7],g=e[8],x=r*h+o*d+c*m,S=i*h+u*d+l*m,M=a*h+s*d+f*m,z=r*y+o*p+c*v,O=i*y+u*p+l*v,_=a*y+s*p+f*v,T=r*w+o*E+c*g,I=i*w+u*E+l*g,N=a*w+s*E+f*g;return n[0]=x,n[1]=S,n[2]=M,n[3]=0,n[4]=z,n[5]=O,n[6]=_,n[7]=0,n[8]=T,n[9]=I,n[10]=N,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},c.multiplyByTranslation=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=r*t[0]+i*t[4]+a*t[8]+t[12],u=r*t[1]+i*t[5]+a*t[9]+t[13],s=r*t[2]+i*t[6]+a*t[10]+t[14];return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=o,n[13]=u,n[14]=s,n[15]=t[15],n};var y=new t;c.multiplyByUniformScale=function(t,e,n){return y.x=e,y.y=e,y.z=e,c.multiplyByScale(t,y,n)},c.multiplyByScale=function(t,e,n){var r=e.x,i=e.y,a=e.z;return 1===r&&1===i&&1===a?c.clone(t,n):(n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=0,n[4]=i*t[4],n[5]=i*t[5],n[6]=i*t[6],n[7]=0,n[8]=a*t[8],n[9]=a*t[9],n[10]=a*t[10],n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=1,n)},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t[0]*r+t[4]*i+t[8]*a+t[12]*o,s=t[1]*r+t[5]*i+t[9]*a+t[13]*o,c=t[2]*r+t[6]*i+t[10]*a+t[14]*o,l=t[3]*r+t[7]*i+t[11]*a+t[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a,u=t[1]*r+t[5]*i+t[9]*a,s=t[2]*r+t[6]*i+t[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a+t[12],u=t[1]*r+t[5]*i+t[9]*a+t[13],s=t[2]*r+t[6]*i+t[10]*a+t[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n[9]=t[9]*e,n[10]=t[10]*e,n[11]=t[11]*e,n[12]=t[12]*e,n[13]=t[13]*e,n[14]=t[14]*e,n[15]=t[15]*e,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},c.transpose=function(t,e){var n=t[1],r=t[2],i=t[3],a=t[6],o=t[7],u=t[11];return e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[10]=t[10],e[11]=t[14],e[12]=i,e[13]=o,e[14]=u,e[15]=t[15],e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e[9]=Math.abs(t[9]),e[10]=Math.abs(t[10]),e[11]=Math.abs(t[11]),e[12]=Math.abs(t[12]),e[13]=Math.abs(t[13]),e[14]=Math.abs(t[14]),e[15]=Math.abs(t[15]),e},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[3]===e[3]&&t[7]===e[7]&&t[11]===e[11]&&t[15]===e[15]},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n&&Math.abs(t[9]-e[9])<=n&&Math.abs(t[10]-e[10])<=n&&Math.abs(t[11]-e[11])<=n&&Math.abs(t[12]-e[12])<=n&&Math.abs(t[13]-e[13])<=n&&Math.abs(t[14]-e[14])<=n&&Math.abs(t[15]-e[15])<=n},c.getTranslation=function(t,e){return e.x=t[12],e.y=t[13],e.z=t[14],e},c.getRotation=function(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e};var p=new u,v=new u,w=new e,E=new e(0,0,0,1);return c.inverse=function(t,n){if(u.equalsEpsilon(c.getRotation(t,p),v,o.EPSILON7)&&e.equals(c.getRow(t,3,w),E))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-t[12],n[13]=-t[13],n[14]=-t[14],n[15]=1,n;var r=t[0],i=t[4],a=t[8],l=t[12],f=t[1],h=t[5],d=t[9],m=t[13],y=t[2],g=t[6],x=t[10],S=t[14],M=t[3],z=t[7],O=t[11],_=t[15],T=x*_,I=S*O,N=g*_,R=S*z,b=g*O,P=x*z,A=y*_,C=S*M,L=y*O,q=x*M,U=y*z,D=g*M,B=T*h+R*d+b*m-(I*h+N*d+P*m),W=I*f+A*d+q*m-(T*f+C*d+L*m),F=N*f+C*h+U*m-(R*f+A*h+D*m),G=P*f+L*h+D*d-(b*f+q*h+U*d),k=I*i+N*a+P*l-(T*i+R*a+b*l),V=T*r+C*a+L*l-(I*r+A*a+q*l),Y=R*r+A*i+D*l-(N*r+C*i+U*l),j=b*r+q*i+U*a-(P*r+L*i+D*a);T=a*m,I=l*d,N=i*m,R=l*h,b=i*d,P=a*h,A=r*m,C=l*f,L=r*d,q=a*f,U=r*h,D=i*f;var H=T*z+R*O+b*_-(I*z+N*O+P*_),Z=I*M+A*O+q*_-(T*M+C*O+L*_),X=N*M+C*z+U*_-(R*M+A*z+D*_),K=P*M+L*z+D*O-(b*M+q*z+U*O),J=N*x+P*S+I*g-(b*S+T*g+R*x),Q=L*S+T*y+C*x-(A*x+q*S+I*y),$=A*g+D*S+R*y-(U*S+N*y+C*g),te=U*x+b*y+q*g-(L*g+D*x+P*y),ee=r*B+i*W+a*F+l*G;if(Math.abs(ee)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return ee=1/ee,n[0]=B*ee,n[1]=W*ee,n[2]=F*ee,n[3]=G*ee,n[4]=k*ee,n[5]=V*ee,n[6]=Y*ee,n[7]=j*ee,n[8]=H*ee,n[9]=Z*ee,n[10]=X*ee,n[11]=K*ee,n[12]=J*ee,n[13]=Q*ee,n[14]=$*ee,n[15]=te*ee,n},c.inverseTransformation=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],u=t[6],s=t[8],c=t[9],l=t[10],f=t[12],h=t[13],d=t[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return e[0]=n,e[1]=a,e[2]=s,e[3]=0,e[4]=r,e[5]=o,e[6]=c,e[7]=0,e[8]=i,e[9]=u,e[10]=l,e[11]=0,e[12]=m,e[13]=y,e[14]=p,e[15]=1,e},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]&&t[9]===e[n+9]&&t[10]===e[n+10]&&t[11]===e[n+11]&&t[12]===e[n+12]&&t[13]===e[n+13]&&t[14]===e[n+14]&&t[15]===e[n+15]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e,n){this.normal=t.clone(e),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-t.dot(r,n);return e(a)?(t.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new t;return i.fromCartesian4=function(n,r){var o=t.fromCartesian4(n,a),u=n.w;return e(r)?(t.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(e,n){return t.dot(e.normal,n)+e.distance},i.ORIGIN_XY_PLANE=r(new i(t.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(t.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(t.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";var s=function(t,n,r,i){this.west=e(t,0),this.south=e(n,0),this.east=e(r,0),this.north=e(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(t,n,r){r=e(r,0),n[r++]=t.west,n[r++]=t.south,n[r++]=t.east,n[r]=t.north},s.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new s),i.west=t[r++],i.south=t[r++],i.east=t[r++],i.north=t[r],i},s.computeWidth=function(t){var e=t.east,n=t.west;return n>e&&(e+=u.TWO_PI),e-n},s.computeHeight=function(t){return t.north-t.south},s.fromDegrees=function(t,r,i,a,o){return t=u.toRadians(e(t,0)),r=u.toRadians(e(r,0)),i=u.toRadians(e(i,0)),a=u.toRadians(e(a,0)),n(o)?(o.west=t,o.south=r,o.east=i,o.north=a,o):new s(t,r,i,a)},s.fromCartographicArray=function(t,e){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=t.length;c>u;u++){var l=t[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(e)?(e.west=r,e.south=a,e.east=i,e.north=o,e):new s(r,a,i,o)},s.clone=function(t,e){return n(t)?n(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north):void 0},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||n(t)&&n(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return n(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(){},s.southwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.south,r.height=0,r):new t(e.west,e.south)},s.northwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.north,r.height=0,r):new t(e.west,e.north)},s.northeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.north,r.height=0,r):new t(e.east,e.north)},s.southeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.south,r.height=0,r):new t(e.east,e.south)},s.center=function(e,r){var i=e.east,a=e.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(e.south+e.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new t(o,s)},s.intersection=function(t,e,r){var i=t.east,a=t.west,o=e.east,c=e.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((t.west<t.east||e.west<e.east)&&l>=f)return void 0;var h=Math.max(t.south,e.south),d=Math.min(t.north,e.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(t,e){var n=e.longitude,r=e.latitude,i=t.west,a=t.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,r,i,o){r=e(r,a.WGS84),i=e(i,0),n(o)||(o=[]);var l=0,f=t.north,h=t.south,d=t.east,m=t.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(t,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,r){this.center=t.clone(n(e,t.ZERO)),this.radius=n(r,0)},m=new t,y=new t,p=new t,v=new t,w=new t,E=new t,g=new t,x=new t,S=new t,M=new t,z=new t,O=new t;d.fromPoints=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;for(var i=t.clone(e[0],g),a=t.clone(i,m),o=t.clone(i,y),u=t.clone(i,p),s=t.clone(i,v),c=t.clone(i,w),l=t.clone(i,E),f=e.length,h=1;f>h;h++){t.clone(e[h],i);var _=i.x,T=i.y,I=i.z;_<a.x&&t.clone(i,a),_>s.x&&t.clone(i,s),T<o.y&&t.clone(i,o),T>c.y&&t.clone(i,c),I<u.z&&t.clone(i,u),I>l.z&&t.clone(i,l)}var N=t.magnitudeSquared(t.subtract(s,a,x)),R=t.magnitudeSquared(t.subtract(c,o,x)),b=t.magnitudeSquared(t.subtract(l,u,x)),P=a,A=s,C=N;R>C&&(C=R,P=o,A=c),b>C&&(C=b,P=u,A=l);var L=S;L.x=.5*(P.x+A.x),L.y=.5*(P.y+A.y),L.z=.5*(P.z+A.z);var q=t.magnitudeSquared(t.subtract(A,L,x)),U=Math.sqrt(q),D=M;D.x=a.x,D.y=o.y,D.z=u.z;var B=z;B.x=s.x,B.y=c.y,B.z=l.z;var W=t.multiplyByScalar(t.add(D,B,x),.5,O),F=0;for(h=0;f>h;h++){t.clone(e[h],i);var G=t.magnitude(t.subtract(i,W,x));G>F&&(F=G);var k=t.magnitudeSquared(t.subtract(i,L,x));if(k>q){var V=Math.sqrt(k);U=.5*(U+V),q=U*U;var Y=V-U;L.x=(U*L.x+Y*i.x)/V,L.y=(U*L.y+Y*i.y)/V,L.z=(U*L.z+Y*i.z)/V}}return F>U?(t.clone(L,n.center),n.radius=U):(t.clone(W,n.center),n.radius=F),n};var _=new u,T=new t,I=new t,N=new e,R=new e;d.fromRectangle2D=function(t,e,n){return d.fromRectangleWithHeights2D(t,e,0,0,n)},d.fromRectangleWithHeights2D=function(e,i,a,o,u){if(r(u)||(u=new d),!r(e))return u.center=t.clone(t.ZERO,u.center),u.radius=0,u;i=n(i,_),h.southwest(e,N),N.height=a,h.northeast(e,R),R.height=o;var s=i.project(N,T),c=i.project(R,I),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var b=[];d.fromRectangle3D=function(t,e,i,a){e=n(e,o.WGS84),i=n(i,0);var u;return r(t)&&(u=h.subsample(t,e,i,b)),d.fromPoints(u,a)},d.fromVertices=function(e,i,a,o){if(r(o)||(o=new d),!r(e)||0===e.length)return o.center=t.clone(t.ZERO,o.center),o.radius=0,o;i=n(i,t.ZERO),a=n(a,3);var u=g;u.x=e[0]+i.x,u.y=e[1]+i.y,u.z=e[2]+i.z;for(var s=t.clone(u,m),c=t.clone(u,y),l=t.clone(u,p),f=t.clone(u,v),h=t.clone(u,w),_=t.clone(u,E),T=e.length,I=0;T>I;I+=a){var N=e[I]+i.x,R=e[I+1]+i.y,b=e[I+2]+i.z;u.x=N,u.y=R,u.z=b,N<s.x&&t.clone(u,s),N>f.x&&t.clone(u,f),R<c.y&&t.clone(u,c),R>h.y&&t.clone(u,h),b<l.z&&t.clone(u,l),b>_.z&&t.clone(u,_)}var P=t.magnitudeSquared(t.subtract(f,s,x)),A=t.magnitudeSquared(t.subtract(h,c,x)),C=t.magnitudeSquared(t.subtract(_,l,x)),L=s,q=f,U=P;A>U&&(U=A,L=c,q=h),C>U&&(U=C,L=l,q=_);var D=S;D.x=.5*(L.x+q.x),D.y=.5*(L.y+q.y),D.z=.5*(L.z+q.z);var B=t.magnitudeSquared(t.subtract(q,D,x)),W=Math.sqrt(B),F=M;F.x=s.x,F.y=c.y,F.z=l.z;var G=z;G.x=f.x,G.y=h.y,G.z=_.z;var k=t.multiplyByScalar(t.add(F,G,x),.5,O),V=0;for(I=0;T>I;I+=a){u.x=e[I]+i.x,u.y=e[I+1]+i.y,u.z=e[I+2]+i.z;var Y=t.magnitude(t.subtract(u,k,x));Y>V&&(V=Y);var j=t.magnitudeSquared(t.subtract(u,D,x));if(j>B){var H=Math.sqrt(j);W=.5*(W+H),B=W*W;var Z=H-W;D.x=(W*D.x+Z*u.x)/H,D.y=(W*D.y+Z*u.y)/H,D.z=(W*D.z+Z*u.z)/H}}return V>W?(t.clone(D,o.center),o.radius=W):(t.clone(k,o.center),o.radius=V),o},d.fromCornerPoints=function(e,n,i){r(i)||(i=new d);var a=i.center;return t.add(e,n,a),t.multiplyByScalar(a,.5,a),i.radius=t.distance(a,n),i},d.fromEllipsoid=function(e,n){return r(n)||(n=new d),t.clone(t.ZERO,n.center),n.radius=e.maximumRadius,n};var P=new t;d.fromBoundingSpheres=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var i=e.length;if(1===i)return d.clone(e[0],n);if(2===i)return d.union(e[0],e[1],n);for(var a=[],o=0;i>o;o++)a.push(e[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=e[o];s=Math.max(s,t.distance(u,c.center,P)+c.radius)}return n.radius=s,n},d.clone=function(e,n){return r(e)?r(n)?(n.center=t.clone(e.center,n.center),n.radius=e.radius,n):new d(e.center,e.radius):void 0},d.packedLength=4,d.pack=function(t,e,r){r=n(r,0);var i=t.center;e[r++]=i.x,e[r++]=i.y,e[r++]=i.z,e[r]=t.radius},d.unpack=function(t,e,i){e=n(e,0),r(i)||(i=new d);var a=i.center;return a.x=t[e++],a.y=t[e++],a.z=t[e++],i.radius=t[e],i};var A=new t,C=new t;d.union=function(e,n,i){r(i)||(i=new d);var a=e.center,o=e.radius,u=n.center,s=n.radius,c=t.subtract(u,a,A),l=t.magnitude(c);if(o>=l+s)return e.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=t.multiplyByScalar(c,(-o+f)/l,C);return t.add(h,a,h),t.clone(h,i.center),i.radius=f,i};var L=new t;d.expand=function(e,n,r){r=d.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new t,0);d.intersect=function(t,e){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(e,q);return d.intersectPlane(t,n)},d.transform=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=l.getMaximumScale(e)*t.radius,n};var U=new t;d.distanceSquaredTo=function(e,n){var r=t.subtract(e.center,n,U);return t.magnitudeSquared(r)-e.radius*e.radius},d.transformWithoutScale=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=t.radius,n};var D=new t;d.computePlaneDistances=function(e,n,i,a){r(a)||(a=new c);var o=t.subtract(e.center,n,D),u=t.multiplyByScalar(i,t.dot(i,o),D),s=t.magnitude(u);return a.start=s-e.radius,a.stop=s+e.radius,a};for(var B=new t,W=new t,F=new t,G=new t,k=new t,V=new e,Y=new Array(8),j=0;8>j;++j)Y[j]=new t;var H=new u;return d.projectTo2D=function(e,r,i){r=n(r,H);var a=r.ellipsoid,o=e.center,u=e.radius,s=a.geodeticSurfaceNormal(o,B),c=t.cross(t.UNIT_Z,s,W);t.normalize(c,c);var l=t.cross(s,c,F);t.normalize(l,l),t.multiplyByScalar(s,u,s),t.multiplyByScalar(l,u,l),t.multiplyByScalar(c,u,c);var f=t.negate(l,k),h=t.negate(c,G),m=Y,y=m[0];t.add(s,l,y),t.add(y,c,y),y=m[1],t.add(s,l,y),t.add(y,h,y),y=m[2],t.add(s,f,y),t.add(y,h,y),y=m[3],t.add(s,f,y),t.add(y,c,y),t.negate(s,s),y=m[4],t.add(s,l,y),t.add(y,c,y),y=m[5],t.add(s,l,y),t.add(y,h,y),y=m[6],t.add(s,f,y),t.add(y,h,y),y=m[7],t.add(s,f,y),t.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];t.add(o,w,w);var E=a.cartesianToCartographic(w,V);r.project(E,w)}i=d.fromPoints(m,i),o=i.center;var g=o.x,x=o.y,S=o.z;return o.x=S,o.y=g,o.z=x,i},d.equals=function(e,n){return e===n||r(e)&&r(n)&&t.equals(e.center,n.center)&&e.radius===n.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,e){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return e(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(t(n))return n;n=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof e[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof e[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",t(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",t(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",t(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",t(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(t){i.supportsFullscreen()&&t[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,e,n){"use strict";function r(t){for(var e=t.split("."),n=0,r=e.length;r>n;++n)e[n]=parseInt(e[n],10);return e}function i(){if(!e(p)){p=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(p=!0,v=r(t[1]))}return p}function a(){return i()&&v}function o(){if(!e(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(w=!0,E=r(t[1]))}return w}function u(){return o()&&E}function s(){if(!e(g)){g=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(g=!0,x=r(t[1]),x.isNightly=!!t[2])}return g}function c(){return s()&&x}function l(){if(!e(S)){S=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1])))}return S}function f(){return l()&&M}function h(){if(!e(z)){z=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(z=!0,O=r(t[1]))}return z}function d(){return e(_)||(_=/Windows/i.test(navigator.appVersion)),_}function m(){return h()&&O}function y(){return e(T)||(T=e(window.PointerEvent)&&(!e(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var p,v,w,E,g,x,S,M,z,O,_,T,I={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return I.supportsFullscreen=function(){return n.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,e,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(t){switch(t){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(t){return t instanceof Int8Array?a.BYTE:t instanceof Uint8Array?a.UNSIGNED_BYTE:t instanceof Int16Array?a.SHORT:t instanceof Uint16Array?a.UNSIGNED_SHORT:t instanceof Float32Array?a.FLOAT:t instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(t){return e(t)&&(t===a.BYTE||t===a.UNSIGNED_BYTE||t===a.SHORT||t===a.UNSIGNED_SHORT||t===a.FLOAT||t===a.DOUBLE)},a.createTypedArray=function(t,e){switch(t){case a.BYTE:return new Int8Array(e);case a.UNSIGNED_BYTE:return new Uint8Array(e);case a.SHORT:return new Int16Array(e);case a.UNSIGNED_SHORT:return new Uint16Array(e);case a.FLOAT:return new Float32Array(e);case a.DOUBLE:return new Float64Array(e);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(e,r,i,o){switch(i=t(i,0),o=t(o,(r.byteLength-i)/a.getSizeInBytes(e)),e){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var e={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(e)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===e.POINTS||t===e.LINES||t===e.LINE_LOOP||t===e.LINE_STRIP||t===e.TRIANGLES||t===e.TRIANGLE_STRIP||t===e.TRIANGLE_FAN}};return t(e)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,e,n,r,i){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=t(e.primitiveType,i.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=t(e.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(t){var r=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&e(t.attributes[i])&&e(t.attributes[i].values)){var a=t.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=t(e.normalize,!1),this.values=e.values};return e}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color};return e}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(t){switch(t){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(e){return t(e)&&(e===i.UNSIGNED_BYTE||e===i.UNSIGNED_SHORT||e===i.UNSIGNED_INT)},i.createTypedArray=function(t,e){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e):new Uint16Array(e)},i.createTypedArrayFromArrayBuffer=function(t,e,n,i){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e,n,i):new Uint16Array(e,n,i)},n(i)}),define("Core/EllipsoidOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=new e(1,1,1),m=Math.cos,y=Math.sin,p=function(t){t=r(t,r.EMPTY_OBJECT);var n=r(t.radii,d),i=r(t.stackPartitions,10),a=r(t.slicePartitions,8),o=r(t.subdivisions,128);this._radii=e.clone(n),this._stackPartitions=i,this._slicePartitions=a,this._subdivisions=o,this._workerName="createEllipsoidOutlineGeometry"};p.packedLength=e.packedLength+3,p.pack=function(t,n,i){i=r(i,0),e.pack(t._radii,n,i),i+=e.packedLength,n[i++]=t._stackPartitions,n[i++]=t._slicePartitions,n[i]=t._subdivisions};var v=new e,w={radii:v,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};return p.unpack=function(t,n,a){n=r(n,0);var o=e.unpack(t,n,v);n+=e.packedLength;var u=t[n++],s=t[n++],c=t[n++];return i(a)?(a._radii=e.clone(o,a._radii),a._stackPartitions=u,a._slicePartitions=s,a._subdivisions=c,a):(w.stackPartitions=u,w.slicePartitions=s,w.subdivisions=c,new p(w))},p.createGeometry=function(e){var r,i,a,d,p,v,w=e._radii,E=o.fromCartesian3(w),g=e._stackPartitions,x=e._slicePartitions,S=e._subdivisions,M=S*(g+x-1),z=M-x+2,O=new Float64Array(3*z),_=l.createTypedArray(z,2*M),T=0,I=new Array(S),N=new Array(S);for(r=0;S>r;r++)a=f.TWO_PI*r/S,I[r]=m(a),N[r]=y(a);for(r=1;g>r;r++)for(d=Math.PI*r/g,p=m(d),v=y(d),i=0;S>i;i++)O[T++]=w.x*I[i]*v,O[T++]=w.y*N[i]*v,O[T++]=w.z*p; -for(I.length=x,N.length=x,r=0;x>r;r++)a=f.TWO_PI*r/x,I[r]=m(a),N[r]=y(a);for(O[T++]=0,O[T++]=0,O[T++]=w.z,r=1;S>r;r++)for(d=Math.PI*r/S,p=m(d),v=y(d),i=0;x>i;i++)O[T++]=w.x*I[i]*v,O[T++]=w.y*N[i]*v,O[T++]=w.z*p;for(O[T++]=0,O[T++]=0,O[T++]=-w.z,T=0,r=0;g-1>r;++r){var R=r*S;for(i=0;S-1>i;++i)_[T++]=R+i,_[T++]=R+i+1;_[T++]=R+S-1,_[T++]=R}var b=S*(g-1);for(i=1;x+1>i;++i)_[T++]=b,_[T++]=b+i;for(r=0;S-2>r;++r){var P=r*x+1+b,A=(r+1)*x+1+b;for(i=0;x-1>i;++i)_[T++]=A+i,_[T++]=P+i;_[T++]=A+x-1,_[T++]=P+x-1}var C=O.length/3-1;for(i=C-1;i>C-x-1;--i)_[T++]=C,_[T++]=i;var L=new c({position:new s({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:O})});return new u({attributes:L,indices:_,primitiveType:h.LINES,boundingSphere:t.fromEllipsoid(E)})},p}),define("Workers/createEllipsoidOutlineGeometry",["../Core/defined","../Core/EllipsoidOutlineGeometry"],function(t,e){"use strict";return function(n,r){return t(n.buffer,r)&&(n=e.unpack(n,r)),e.createGeometry(n)}})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createGeometry.js b/libs/Cesium/Workers/createGeometry.js deleted file mode 100644 index fff88dd8..00000000 --- a/libs/Cesium/Workers/createGeometry.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(e){return e>0?1:0>e?-1:0},r.signNotZero=function(e){return 0>e?-1:1},r.toSNorm=function(e){return Math.round(255*(.5*r.clamp(e,-1,1)+.5))},r.fromSNorm=function(e){return 2*(r.clamp(e,0,255)/255)-1},r.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},r.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},r.lerp=function(e,t,r){return(1-r)*e+r*t},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(e){return e*r.RADIANS_PER_DEGREE},r.toDegrees=function(e){return e*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(e){var t=r.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},r.negativePiToPi=function(e){return r.zeroToTwoPi(e+r.PI)-r.PI},r.zeroToTwoPi=function(e){var t=r.mod(e,r.TWO_PI);return Math.abs(t)<r.EPSILON14&&Math.abs(e)>r.EPSILON14?r.TWO_PI:t},r.mod=function(e,t){return(e%t+t)%t},r.equalsEpsilon=function(e,r,n,o){o=t(o,n);var i=Math.abs(e-r);return o>=i||i<=n*Math.max(Math.abs(e),Math.abs(r))};var n=[1];r.factorial=function(e){var t=n.length;if(e>=t)for(var r=n[t-1],o=t;e>=o;o++)n.push(r*o);return n[e]},r.incrementWrap=function(e,r,n){return n=t(n,0),++e,e>r&&(e=n),e},r.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},r.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},r.clamp=function(e,t,r){return t>e?t:e>r?r:e};var o=new e;return r.setRandomNumberSeed=function(t){o=new e(t)},r.nextRandomNumber=function(){return o.random()},r.acosClamped=function(e){return Math.acos(r.clamp(e,-1,1))},r.asinClamped=function(e){return Math.asin(r.clamp(e,-1,1))},r.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},r}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o){"use strict";var i=function(t,r,n){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0)};i.fromSpherical=function(r,n){t(n)||(n=new i);var o=r.clock,a=r.cone,u=e(r.magnitude,1),s=u*Math.sin(a);return n.x=s*Math.cos(o),n.y=s*Math.sin(o),n.z=u*Math.cos(a),n},i.fromElements=function(e,r,n,o){return t(o)?(o.x=e,o.y=r,o.z=n,o):new i(e,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n]=t.z},i.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new i),o.x=r[n++],o.y=r[n++],o.z=r[n],o},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var a=new i;i.distance=function(e,t){return i.subtract(e,t,a),i.magnitude(a)},i.distanceSquared=function(e,t){return i.subtract(e,t,a),i.magnitudeSquared(a)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var r=i.dot(s,c),n=i.magnitude(i.cross(s,c,s));return Math.atan2(n,r)};var l=new i;i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):r.y<=r.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&o.equalsEpsilon(e.x,r.x,n,i)&&o.equalsEpsilon(e.y,r.y,n,i)&&o.equalsEpsilon(e.z,r.z,n,i)},i.cross=function(e,t,r){var n=e.x,o=e.y,i=e.z,a=t.x,u=t.y,s=t.z,c=o*s-i*u,l=i*a-n*s,f=n*u-o*a;return r.x=c,r.y=l,r.z=f,r},i.fromDegrees=function(e,t,r,n,a){var u=o.toRadians(e),s=o.toRadians(t);return i.fromRadians(u,s,r,n,a)};var f=new i,h=new i,m=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(r,n,o,a,u){o=e(o,0);var s=t(a)?a.radiiSquared:m,c=Math.cos(n);f.x=c*Math.cos(r),f.y=c*Math.sin(r),f.z=Math.sin(n),f=i.normalize(f,f),i.multiplyComponents(s,f,h);var l=Math.sqrt(i.dot(f,h));return h=i.divideByScalar(h,l,h),f=i.multiplyByScalar(f,o,f),t(u)||(u=new i),i.add(h,f,u)},i.fromDegreesArray=function(e,t,r){for(var n=new Array(e.length),a=0;a<e.length;a++)n[a]=o.toRadians(e[a]);return i.fromRadiansArray(n,t,r)},i.fromRadiansArray=function(e,r,n){var o=e.length;t(n)?n.length=o/2:n=new Array(o/2);for(var a=0;o>a;a+=2){var u=e[a],s=e[a+1];n[a/2]=i.fromRadians(u,s,0,r,n[a/2])}return n},i.fromDegreesArrayHeights=function(e,t,r){for(var n=new Array(e.length),a=0;a<e.length;a+=3)n[a]=o.toRadians(e[a]),n[a+1]=o.toRadians(e[a+1]),n[a+2]=e[a+2];return i.fromRadiansArrayHeights(n,t,r)},i.fromRadiansArrayHeights=function(e,r,n){var o=e.length;t(n)?n.length=o/3:n=new Array(o/3);for(var a=0;o>a;a+=3){var u=e[a],s=e[a+1],c=e[a+2];n[a/3]=i.fromRadians(u,s,c,r,n[a/3])}return n},i.ZERO=n(new i(0,0,0)),i.UNIT_X=n(new i(1,0,0)),i.UNIT_Y=n(new i(0,1,0)),i.UNIT_Z=n(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o){"use strict";var i=function(t,r,n){this.longitude=e(t,0),this.latitude=e(r,0),this.height=e(n,0)};return i.fromRadians=function(r,n,o,a){return o=e(o,0),t(a)?(a.longitude=r,a.latitude=n,a.height=o,a):new i(r,n,o)},i.fromDegrees=function(e,t,r,n){return e=o.toRadians(e),t=o.toRadians(t),i.fromRadians(e,t,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},i.equalsEpsilon=function(e,r,n){return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=n&&Math.abs(e.latitude-r.latitude)<=n&&Math.abs(e.height-r.height)<=n},i.ZERO=n(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},r=function(r,n){e(t[r])||(t[r]=!0,console.log(n))};return r}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o,i,a,u){"use strict";function s(t,n,o,i){n=r(n,0),o=r(o,0),i=r(i,0),t._radii=new e(n,o,i),t._radiiSquared=new e(n*n,o*o,i*i),t._radiiToTheFourth=new e(n*n*n*n,o*o*o*o,i*i*i*i),t._oneOverRadii=new e(0===n?0:1/n,0===o?0:1/o,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===o?0:1/(o*o),0===i?0:1/(i*i)),t._minimumRadius=Math.min(n,o,i),t._maximumRadius=Math.max(n,o,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,r)};o(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,r){if(!n(t))return void 0;var o=t._radii;return n(r)?(e.clone(o,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new c(o.x,o.y,o.z)},c.fromCartesian3=function(e,t){return n(t)||(t=new c),n(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=a(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=a(new c(1,1,1)),c.MOON=a(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,n,o){o=r(o,0),e.pack(t._radii,n,o)},c.unpack=function(t,n,o){n=r(n,0);var i=e.unpack(t,n);return c.fromCartesian3(i,o)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,r){var o=t.longitude,i=t.latitude,a=Math.cos(i),u=a*Math.cos(o),s=a*Math.sin(o),c=Math.sin(i);return n(r)||(r=new e),r.x=u,r.y=s,r.z=c,e.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(t,r){return n(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,r){var o=l,i=f;this.geodeticSurfaceNormalCartographic(t,o),e.multiplyComponents(this._radiiSquared,o,i);var a=Math.sqrt(e.dot(o,i));return e.divideByScalar(i,a,i),e.multiplyByScalar(o,t.height,o),n(r)||(r=new e),e.add(i,o,r)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var o=0;r>o;o++)t[o]=this.cartographicToCartesian(e[o],t[o]);return t};var h=new e,m=new e,d=new e;c.prototype.cartesianToCartographic=function(r,o){var i=this.scaleToGeodeticSurface(r,m);if(!n(i))return void 0;var a=this.geodeticSurfaceNormal(i,h),s=e.subtract(r,i,d),c=Math.atan2(a.y,a.x),l=Math.asin(a.z),f=u.sign(e.dot(s,r))*e.magnitude(s);return n(o)?(o.longitude=c,o.latitude=l,o.height=f,o):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var o=0;r>o;++o)t[o]=this.cartesianToCartographic(e[o],t[o]);return t};var p=new e,v=new e;return c.prototype.scaleToGeodeticSurface=function(t,r){var o=t.x,i=t.y,a=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=o*o*c*c,m=i*i*l*l,d=a*a*f*f,y=h+m+d,g=Math.sqrt(1/y),E=e.multiplyByScalar(t,g,p);if(y<this._centerToleranceSquared)return isFinite(g)?e.clone(E,r):void 0;var S=this._oneOverRadiiSquared,C=S.x,w=S.y,b=S.z,x=v;x.x=2*E.x*C,x.y=2*E.y*w,x.z=2*E.z*b;var A,T,M,I,O,R,N,L,P,z,D,F=(1-g)*e.magnitude(t)/(.5*e.magnitude(x)),_=0;do{F-=_,M=1/(1+F*C),I=1/(1+F*w),O=1/(1+F*b),R=M*M,N=I*I,L=O*O,P=R*M,z=N*I,D=L*O,A=h*R+m*N+d*L-1,T=h*P*C+m*z*w+d*D*b;var B=-2*T;_=A/B}while(Math.abs(A)>u.EPSILON12);return n(r)?(r.x=o*M,r.y=i*I,r.z=a*O,r):new e(o*M,i*I,a*O)},c.prototype.scaleToGeocentricSurface=function(t,r){n(r)||(r=new e);var o=t.x,i=t.y,a=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(o*o*u.x+i*i*u.y+a*a*u.z);return e.multiplyByScalar(t,s,r)},c.prototype.transformPositionToScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},c.prototype.equals=function(t){return this===t||n(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,o,i,a){"use strict";var u=function(e){this._ellipsoid=r(e,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return o(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,r){var o=this._semimajorAxis,i=t.longitude*o,a=t.latitude*o,u=t.height;return n(r)?(r.x=i,r.y=a,r.z=u,r):new e(i,a,u)},u.prototype.unproject=function(e,r){var o=this._oneOverSemimajorAxis,i=e.x*o,a=e.y*o,u=e.z;return n(r)?(r.longitude=i,r.latitude=a,r.height=u,r):new t(i,a,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,r){this.start=e(t,0),this.stop=e(r,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o){"use strict";var i=function(t,r,n,o){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0),this.w=e(o,0)};i.fromElements=function(e,r,n,o,a){return t(a)?(a.x=e,a.y=r,a.z=n,a.w=o,a):new i(e,r,n,o)},i.fromColor=function(e,r){return t(r)?(r.x=e.red,r.y=e.green,r.z=e.blue,r.w=e.alpha,r):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n++]=t.z,r[n]=t.w},i.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new i),o.x=r[n++],o.y=r[n++],o.z=r[n++],o.w=r[n],o},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r.w=Math.min(e.w,t.w),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r.w=Math.max(e.w,t.w),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var a=new i;i.distance=function(e,t){return i.subtract(e,t,a),i.magnitude(a)},i.distanceSquared=function(e,t){return i.subtract(e,t,a),i.magnitudeSquared(a)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t.w=e.w/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,s);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?r.x<=r.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):r.y<=r.z?r.y<=r.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&o.equalsEpsilon(e.x,r.x,n,i)&&o.equalsEpsilon(e.y,r.y,n,i)&&o.equalsEpsilon(e.z,r.z,n,i)&&o.equalsEpsilon(e.w,r.w,n,i)},i.ZERO=n(new i(0,0,0,0)),i.UNIT_X=n(new i(1,0,0,0)),i.UNIT_Y=n(new i(0,1,0,0)),i.UNIT_Z=n(new i(0,0,1,0)),i.UNIT_W=n(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o,i){"use strict";function a(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function u(e){for(var t=0,r=0;3>r;++r){var n=e[c.getElementIndex(m[r],h[r])];t+=2*n*n}return Math.sqrt(t)}function s(e,t){for(var r=i.EPSILON15,n=0,o=1,a=0;3>a;++a){var u=Math.abs(e[c.getElementIndex(m[a],h[a])]);u>n&&(o=a,n=u)}var s=1,l=0,f=h[o],d=m[o];if(Math.abs(e[c.getElementIndex(d,f)])>r){var p,v=e[c.getElementIndex(d,d)],y=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(d,f)],E=(v-y)/2/g;p=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(d,d)]=s,t[c.getElementIndex(d,f)]=l,t[c.getElementIndex(f,d)]=-l,t}var c=function(e,r,n,o,i,a,u,s,c){this[0]=t(e,0),this[1]=t(o,0),this[2]=t(u,0),this[3]=t(r,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(n,0),this[7]=t(a,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3],r[n++]=e[4],r[n++]=e[5],r[n++]=e[6],r[n++]=e[7],r[n++]=e[8]},c.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new c),o[0]=e[n++],o[1]=e[n++],o[2]=e[n++],o[3]=e[n++],o[4]=e[n++],o[5]=e[n++],o[6]=e[n++],o[7]=e[n++],o[8]=e[n++],o},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,n,o){return n=t(n,0),r(o)||(o=new c),o[0]=e[n],o[1]=e[n+1],o[2]=e[n+2],o[3]=e[n+3],o[4]=e[n+4],o[5]=e[n+5],o[6]=e[n+6],o[7]=e[n+7],o[8]=e[n+8],o},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var n=e.x*e.x,o=e.x*e.y,i=e.x*e.z,a=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,h=e.z*e.w,m=e.w*e.w,d=n-u-f+m,p=2*(o-h),v=2*(i+l),y=2*(o+h),g=-n+u-f+m,E=2*(s-a),S=2*(i-l),C=2*(s+a),w=-n-u+f+m;return r(t)?(t[0]=d,t[1]=y,t[2]=S,t[3]=p,t[4]=g,t[5]=C,t[6]=v,t[7]=E,t[8]=w,t):new c(d,p,v,y,g,E,S,C,w)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var n=Math.cos(e),o=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=o,t[6]=0,t[7]=-o,t[8]=n,t):new c(1,0,0,0,n,-o,0,o,n)},c.fromRotationY=function(e,t){var n=Math.cos(e),o=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-o,t[3]=0,t[4]=1,t[5]=0,t[6]=o,t[7]=0,t[8]=n,t):new c(n,0,o,0,1,0,-o,0,n)},c.fromRotationZ=function(e,t){var n=Math.cos(e),o=Math.sin(e);return r(t)?(t[0]=n,t[1]=o,t[2]=0,t[3]=-o,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(n,-o,0,o,n,0,0,0,1)},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,r){var n=3*t,o=e[n],i=e[n+1],a=e[n+2];return r.x=o,r.y=i,r.z=a,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var o=3*t;return n[o]=r.x,n[o+1]=r.y,n[o+2]=r.z,n},c.getRow=function(e,t,r){var n=e[t],o=e[t+3],i=e[t+6];return r.x=n,r.y=o,r.z=i,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+3]=r.y,n[t+6]=r.z,n};var l=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),r.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),r.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),r};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,r){var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],o=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],a=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=o,r[2]=i,r[3]=a,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},c.multiplyByVector=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=e[0]*n+e[3]*o+e[6]*i,u=e[1]*n+e[4]*o+e[7]*i,s=e[2]*n+e[5]*o+e[8]*i;return r.x=a,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},c.multiplyByScale=function(e,t,r){return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.x,r[3]=e[3]*t.y,r[4]=e[4]*t.y,r[5]=e[5]*t.y,r[6]=e[6]*t.z,r[7]=e[7]*t.z,r[8]=e[8]*t.z,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var r=e[0],n=e[3],o=e[6],i=e[1],a=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=r,t[1]=n,t[2]=o,t[3]=i,t[4]=a,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var h=[1,0,0],m=[2,2,1],d=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var n=i.EPSILON20,o=10,l=0,f=0;r(t)||(t={});for(var h=t.unitary=c.clone(c.IDENTITY,t.unitary),m=t.diagonal=c.clone(e,t.diagonal),v=n*a(m);o>f&&u(m)>v;)s(m,d),c.transpose(d,p),c.multiply(m,d,m),c.multiply(p,m,m),c.multiply(h,d,h),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],r=e[3],n=e[6],o=e[1],i=e[4],a=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*a)+o*(s*n-r*c)+u*(r*a-i*n)},c.inverse=function(e,t){var r=e[0],o=e[1],a=e[2],u=e[3],s=e[4],l=e[5],f=e[6],h=e[7],m=e[8],d=c.determinant(e);if(Math.abs(d)<=i.EPSILON15)throw new n("matrix is not invertible");t[0]=s*m-h*l,t[1]=h*a-o*m,t[2]=o*l-s*a,t[3]=f*l-u*m,t[4]=r*m-f*a,t[5]=u*a-r*l,t[6]=u*h-f*s,t[7]=f*o-r*h,t[8]=r*s-u*o;var p=1/d;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},c.IDENTITY=o(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=o(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,o,i,a,u,s){"use strict";var c=function(e,t,n,o,i,a,u,s,c,l,f,h,m,d,p,v){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(c,0),this[3]=r(m,0),this[4]=r(t,0),this[5]=r(a,0),this[6]=r(l,0),this[7]=r(d,0),this[8]=r(n,0),this[9]=r(u,0),this[10]=r(f,0),this[11]=r(p,0),this[12]=r(o,0),this[13]=r(s,0),this[14]=r(h,0),this[15]=r(v,0)};c.packedLength=16,c.pack=function(e,t,n){n=r(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15]},c.unpack=function(e,t,o){return t=r(t,0),n(o)||(o=new c),o[0]=e[t++],o[1]=e[t++],o[2]=e[t++],o[3]=e[t++],o[4]=e[t++],o[5]=e[t++],o[6]=e[t++],o[7]=e[t++],o[8]=e[t++],o[9]=e[t++],o[10]=e[t++],o[11]=e[t++],o[12]=e[t++],o[13]=e[t++],o[14]=e[t++],o[15]=e[t],o},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,o,i){return o=r(o,e.ZERO),n(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=o.x,i[13]=o.y,i[14]=o.z,i[15]=1,i):new c(t[0],t[3],t[6],o.x,t[1],t[4],t[7],o.y,t[2],t[5],t[8],o.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,r,o){n(o)||(o=new c);var i=r.x,a=r.y,u=r.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,h=t.x*t.w,m=t.y*t.y,d=t.y*t.z,p=t.y*t.w,v=t.z*t.z,y=t.z*t.w,g=t.w*t.w,E=s-m-v+g,S=2*(l-y),C=2*(f+p),w=2*(l+y),b=-s+m-v+g,x=2*(d-h),A=2*(f-p),T=2*(d+h),M=-s-m+v+g;return o[0]=E*i,o[1]=w*i,o[2]=A*i,o[3]=0,o[4]=S*a,o[5]=b*a,o[6]=T*a,o[7]=0,o[8]=C*u,o[9]=x*u,o[10]=M*u,o[11]=0,o[12]=e.x,o[13]=e.y,o[14]=e.z,o[15]=1,o},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,h=new e;c.fromCamera=function(t,r){var o=t.eye,i=t.target,a=t.up;e.normalize(e.subtract(i,o,l),l),e.normalize(e.cross(l,a,f),f),e.normalize(e.cross(f,l,h),h);var u=f.x,s=f.y,m=f.z,d=l.x,p=l.y,v=l.z,y=h.x,g=h.y,E=h.z,S=o.x,C=o.y,w=o.z,b=u*-S+s*-C+m*-w,x=y*-S+g*-C+E*-w,A=d*S+p*C+v*w;return n(r)?(r[0]=u,r[1]=y,r[2]=-d,r[3]=0,r[4]=s,r[5]=g,r[6]=-p,r[7]=0,r[8]=m,r[9]=E,r[10]=-v,r[11]=0,r[12]=b,r[13]=x,r[14]=A,r[15]=1,r):new c(u,s,m,b,y,g,E,x,-d,-p,-v,A,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,r,n,o){var i=Math.tan(.5*e),a=1/i,u=a/t,s=(n+r)/(r-n),c=2*n*r/(r-n);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=s,o[11]=-1,o[12]=0,o[13]=0,o[14]=c,o[15]=0,o},c.computeOrthographicOffCenter=function(e,t,r,n,o,i,a){var u=1/(t-e),s=1/(n-r),c=1/(i-o),l=-(t+e)*u,f=-(n+r)*s,h=-(i+o)*c;return u*=2,s*=2,c*=-2,a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=s,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=c,a[11]=0,a[12]=l,a[13]=f,a[14]=h,a[15]=1,a -},c.computePerspectiveOffCenter=function(e,t,r,n,o,i,a){var u=2*o/(t-e),s=2*o/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),f=-(i+o)/(i-o),h=-1,m=-2*i*o/(i-o);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=s,a[6]=0,a[7]=0,a[8]=c,a[9]=l,a[10]=f,a[11]=h,a[12]=0,a[13]=0,a[14]=m,a[15]=0,a},c.computeInfinitePerspectiveOffCenter=function(e,t,r,n,o,i){var a=2*o/(t-e),u=2*o/(n-r),s=(t+e)/(t-e),c=(n+r)/(n-r),l=-1,f=-1,h=-2*o;return i[0]=a,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=h,i[15]=0,i},c.computeViewportTransformation=function(e,t,n,o){e=r(e,r.EMPTY_OBJECT);var i=r(e.x,0),a=r(e.y,0),u=r(e.width,0),s=r(e.height,0);t=r(t,0),n=r(n,1);var c=.5*u,l=.5*s,f=.5*(n-t),h=c,m=l,d=f,p=i+c,v=a+l,y=t+f,g=1;return o[0]=h,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=m,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=d,o[11]=0,o[12]=p,o[13]=v,o[14]=y,o[15]=g,o},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,r){var n=4*t,o=e[n],i=e[n+1],a=e[n+2],u=e[n+3];return r.x=o,r.y=i,r.z=a,r.w=u,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var o=4*t;return n[o]=r.x,n[o+1]=r.y,n[o+2]=r.z,n[o+3]=r.w,n},c.setTranslation=function(e,t,r){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=e[15],r},c.getRow=function(e,t,r){var n=e[t],o=e[t+4],i=e[t+8],a=e[t+12];return r.x=n,r.y=o,r.z=i,r.w=a,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+4]=r.y,n[t+8]=r.z,n[t+12]=r.w,n};var m=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],m)),r.y=e.magnitude(e.fromElements(t[4],t[5],t[6],m)),r.z=e.magnitude(e.fromElements(t[8],t[9],t[10],m)),r};var d=new e;c.getMaximumScale=function(t){return c.getScale(t,d),e.maximumComponent(d)},c.multiply=function(e,t,r){var n=e[0],o=e[1],i=e[2],a=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],h=e[9],m=e[10],d=e[11],p=e[12],v=e[13],y=e[14],g=e[15],E=t[0],S=t[1],C=t[2],w=t[3],b=t[4],x=t[5],A=t[6],T=t[7],M=t[8],I=t[9],O=t[10],R=t[11],N=t[12],L=t[13],P=t[14],z=t[15],D=n*E+u*S+f*C+p*w,F=o*E+s*S+h*C+v*w,_=i*E+c*S+m*C+y*w,B=a*E+l*S+d*C+g*w,U=n*b+u*x+f*A+p*T,G=o*b+s*x+h*A+v*T,q=i*b+c*x+m*A+y*T,k=a*b+l*x+d*A+g*T,V=n*M+u*I+f*O+p*R,W=o*M+s*I+h*O+v*R,Y=i*M+c*I+m*O+y*R,H=a*M+l*I+d*O+g*R,j=n*N+u*L+f*P+p*z,K=o*N+s*L+h*P+v*z,Z=i*N+c*L+m*P+y*z,X=a*N+l*L+d*P+g*z;return r[0]=D,r[1]=F,r[2]=_,r[3]=B,r[4]=U,r[5]=G,r[6]=q,r[7]=k,r[8]=V,r[9]=W,r[10]=Y,r[11]=H,r[12]=j,r[13]=K,r[14]=Z,r[15]=X,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},c.multiplyTransformation=function(e,t,r){var n=e[0],o=e[1],i=e[2],a=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=e[12],m=e[13],d=e[14],p=t[0],v=t[1],y=t[2],g=t[4],E=t[5],S=t[6],C=t[8],w=t[9],b=t[10],x=t[12],A=t[13],T=t[14],M=n*p+a*v+c*y,I=o*p+u*v+l*y,O=i*p+s*v+f*y,R=n*g+a*E+c*S,N=o*g+u*E+l*S,L=i*g+s*E+f*S,P=n*C+a*w+c*b,z=o*C+u*w+l*b,D=i*C+s*w+f*b,F=n*x+a*A+c*T+h,_=o*x+u*A+l*T+m,B=i*x+s*A+f*T+d;return r[0]=M,r[1]=I,r[2]=O,r[3]=0,r[4]=R,r[5]=N,r[6]=L,r[7]=0,r[8]=P,r[9]=z,r[10]=D,r[11]=0,r[12]=F,r[13]=_,r[14]=B,r[15]=1,r},c.multiplyByMatrix3=function(e,t,r){var n=e[0],o=e[1],i=e[2],a=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=t[0],m=t[1],d=t[2],p=t[3],v=t[4],y=t[5],g=t[6],E=t[7],S=t[8],C=n*h+a*m+c*d,w=o*h+u*m+l*d,b=i*h+s*m+f*d,x=n*p+a*v+c*y,A=o*p+u*v+l*y,T=i*p+s*v+f*y,M=n*g+a*E+c*S,I=o*g+u*E+l*S,O=i*g+s*E+f*S;return r[0]=C,r[1]=w,r[2]=b,r[3]=0,r[4]=x,r[5]=A,r[6]=T,r[7]=0,r[8]=M,r[9]=I,r[10]=O,r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},c.multiplyByTranslation=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=n*e[0]+o*e[4]+i*e[8]+e[12],u=n*e[1]+o*e[5]+i*e[9]+e[13],s=n*e[2]+o*e[6]+i*e[10]+e[14];return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=a,r[13]=u,r[14]=s,r[15]=e[15],r};var p=new e;c.multiplyByUniformScale=function(e,t,r){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,r)},c.multiplyByScale=function(e,t,r){var n=t.x,o=t.y,i=t.z;return 1===n&&1===o&&1===i?c.clone(e,r):(r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=0,r[4]=o*e[4],r[5]=o*e[5],r[6]=o*e[6],r[7]=0,r[8]=i*e[8],r[9]=i*e[9],r[10]=i*e[10],r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=1,r)},c.multiplyByVector=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=t.w,u=e[0]*n+e[4]*o+e[8]*i+e[12]*a,s=e[1]*n+e[5]*o+e[9]*i+e[13]*a,c=e[2]*n+e[6]*o+e[10]*i+e[14]*a,l=e[3]*n+e[7]*o+e[11]*i+e[15]*a;return r.x=u,r.y=s,r.z=c,r.w=l,r},c.multiplyByPointAsVector=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=e[0]*n+e[4]*o+e[8]*i,u=e[1]*n+e[5]*o+e[9]*i,s=e[2]*n+e[6]*o+e[10]*i;return r.x=a,r.y=u,r.z=s,r},c.multiplyByPoint=function(e,t,r){var n=t.x,o=t.y,i=t.z,a=e[0]*n+e[4]*o+e[8]*i+e[12],u=e[1]*n+e[5]*o+e[9]*i+e[13],s=e[2]*n+e[6]*o+e[10]*i+e[14];return r.x=a,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var r=e[1],n=e[2],o=e[3],i=e[6],a=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=o,t[13]=a,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r&&Math.abs(e[9]-t[9])<=r&&Math.abs(e[10]-t[10])<=r&&Math.abs(e[11]-t[11])<=r&&Math.abs(e[12]-t[12])<=r&&Math.abs(e[13]-t[13])<=r&&Math.abs(e[14]-t[14])<=r&&Math.abs(e[15]-t[15])<=r},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var v=new u,y=new u,g=new t,E=new t(0,0,0,1);return c.inverse=function(e,r){if(u.equalsEpsilon(c.getRotation(e,v),y,a.EPSILON7)&&t.equals(c.getRow(e,3,g),E))return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=0,r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=1,r;var n=e[0],o=e[4],i=e[8],l=e[12],f=e[1],h=e[5],m=e[9],d=e[13],p=e[2],S=e[6],C=e[10],w=e[14],b=e[3],x=e[7],A=e[11],T=e[15],M=C*T,I=w*A,O=S*T,R=w*x,N=S*A,L=C*x,P=p*T,z=w*b,D=p*A,F=C*b,_=p*x,B=S*b,U=M*h+R*m+N*d-(I*h+O*m+L*d),G=I*f+P*m+F*d-(M*f+z*m+D*d),q=O*f+z*h+_*d-(R*f+P*h+B*d),k=L*f+D*h+B*m-(N*f+F*h+_*m),V=I*o+O*i+L*l-(M*o+R*i+N*l),W=M*n+z*i+D*l-(I*n+P*i+F*l),Y=R*n+P*o+B*l-(O*n+z*o+_*l),H=N*n+F*o+_*i-(L*n+D*o+B*i);M=i*d,I=l*m,O=o*d,R=l*h,N=o*m,L=i*h,P=n*d,z=l*f,D=n*m,F=i*f,_=n*h,B=o*f;var j=M*x+R*A+N*T-(I*x+O*A+L*T),K=I*b+P*A+F*T-(M*b+z*A+D*T),Z=O*b+z*x+_*T-(R*b+P*x+B*T),X=L*b+D*x+B*A-(N*b+F*x+_*A),Q=O*C+L*w+I*S-(N*w+M*S+R*C),J=D*w+M*p+z*C-(P*C+F*w+I*p),$=P*S+B*w+R*p-(_*w+O*p+z*S),et=_*C+N*p+F*S-(D*S+B*C+L*p),tt=n*U+o*G+i*q+l*k;if(Math.abs(tt)<a.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,r[0]=U*tt,r[1]=G*tt,r[2]=q*tt,r[3]=k*tt,r[4]=V*tt,r[5]=W*tt,r[6]=Y*tt,r[7]=H*tt,r[8]=j*tt,r[9]=K*tt,r[10]=Z*tt,r[11]=X*tt,r[12]=Q*tt,r[13]=J*tt,r[14]=$*tt,r[15]=et*tt,r},c.inverseTransformation=function(e,t){var r=e[0],n=e[1],o=e[2],i=e[4],a=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],h=e[13],m=e[14],d=-r*f-n*h-o*m,p=-i*f-a*h-u*m,v=-s*f-c*h-l*m;return t[0]=r,t[1]=i,t[2]=s,t[3]=0,t[4]=n,t[5]=a,t[6]=c,t[7]=0,t[8]=o,t[9]=u,t[10]=l,t[11]=0,t[12]=d,t[13]=p,t[14]=v,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]&&e[9]===t[r+9]&&e[10]===t[r+10]&&e[11]===t[r+11]&&e[12]===t[r+12]&&e[13]===t[r+13]&&e[14]===t[r+14]&&e[15]===t[r+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var o=function(t,r){this.normal=e.clone(t),this.distance=r};o.fromPointNormal=function(r,n,i){var a=-e.dot(n,r);return t(i)?(e.clone(n,i.normal),i.distance=a,i):new o(n,a)};var i=new e;return o.fromCartesian4=function(r,n){var a=e.fromCartesian4(r,i),u=r.w;return t(n)?(e.clone(a,n.normal),n.distance=u,n):new o(a,u)},o.getPointDistance=function(t,r){return e.dot(t.normal,r)+t.distance},o.ORIGIN_XY_PLANE=n(new o(e.UNIT_Z,0)),o.ORIGIN_YZ_PLANE=n(new o(e.UNIT_X,0)),o.ORIGIN_ZX_PLANE=n(new o(e.UNIT_Y,0)),o}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,o,i,a,u){"use strict";var s=function(e,r,n,o){this.west=t(e,0),this.south=t(r,0),this.east=t(n,0),this.north=t(o,0)};n(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},s.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new s),o.west=e[n++],o.south=e[n++],o.east=e[n++],o.north=e[n],o},s.computeWidth=function(e){var t=e.east,r=e.west;return r>t&&(t+=u.TWO_PI),t-r},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,n,o,i,a){return e=u.toRadians(t(e,0)),n=u.toRadians(t(n,0)),o=u.toRadians(t(o,0)),i=u.toRadians(t(i,0)),r(a)?(a.west=e,a.south=n,a.east=o,a.north=i,a):new s(e,n,o,i)},s.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,o=-Number.MAX_VALUE,i=Number.MAX_VALUE,a=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];n=Math.min(n,l.longitude),o=Math.max(o,l.longitude),i=Math.min(i,l.latitude),a=Math.max(a,l.latitude)}return r(t)?(t.west=n,t.south=i,t.east=o,t.north=a,t):new s(n,i,o,a)},s.clone=function(e,t){return r(e)?r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},s.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},s.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},s.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},s.center=function(t,n){var o=t.east,i=t.west;i>o&&(o+=u.TWO_PI);var a=u.negativePiToPi(.5*(i+o)),s=.5*(t.south+t.north);return r(n)?(n.longitude=a,n.latitude=s,n.height=0,n):new e(a,s)},s.intersection=function(e,t,n){var o=e.east,i=e.west,a=t.east,c=t.west;i>o&&a>0?o+=u.TWO_PI:c>a&&o>0&&(a+=u.TWO_PI),i>o&&0>c?c+=u.TWO_PI:c>a&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(o,a));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var h=Math.max(e.south,t.south),m=Math.min(e.north,t.north);return h>=m?void 0:r(n)?(n.west=l,n.south=h,n.east=f,n.north=m,n):new s(l,h,f,m)},s.contains=function(e,t){var r=t.longitude,n=t.latitude,o=e.west,i=e.east;return o>i&&(i+=u.TWO_PI,0>r&&(r+=u.TWO_PI)),(r>o||u.equalsEpsilon(r,o,u.EPSILON14))&&(i>r||u.equalsEpsilon(r,i,u.EPSILON14))&&n>=e.south&&n<=e.north};var c=new e;return s.subsample=function(e,n,o,a){n=t(n,i.WGS84),o=t(o,0),r(a)||(a=[]);var l=0,f=e.north,h=e.south,m=e.east,d=e.west,p=c;p.height=o,p.longitude=d,p.latitude=f,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.longitude=m,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.latitude=h,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.longitude=d,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.latitude=0>f?f:h>0?h:0;for(var v=1;8>v;++v)p.longitude=-Math.PI+v*u.PI_OVER_TWO,s.contains(e,p)&&(a[l]=n.cartographicToCartesian(p,a[l]),l++);return 0===p.latitude&&(p.longitude=d,a[l]=n.cartographicToCartesian(p,a[l]),l++,p.longitude=m,a[l]=n.cartographicToCartesian(p,a[l]),l++),a.length=l,a},s.MAX_VALUE=a(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,r,n,o,i,a,u,s,c,l,f,h){"use strict";var m=function(t,n){this.center=e.clone(r(t,e.ZERO)),this.radius=r(n,0)},d=new e,p=new e,v=new e,y=new e,g=new e,E=new e,S=new e,C=new e,w=new e,b=new e,x=new e,A=new e;m.fromPoints=function(t,r){if(n(r)||(r=new m),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;for(var o=e.clone(t[0],S),i=e.clone(o,d),a=e.clone(o,p),u=e.clone(o,v),s=e.clone(o,y),c=e.clone(o,g),l=e.clone(o,E),f=t.length,h=1;f>h;h++){e.clone(t[h],o);var T=o.x,M=o.y,I=o.z;T<i.x&&e.clone(o,i),T>s.x&&e.clone(o,s),M<a.y&&e.clone(o,a),M>c.y&&e.clone(o,c),I<u.z&&e.clone(o,u),I>l.z&&e.clone(o,l)}var O=e.magnitudeSquared(e.subtract(s,i,C)),R=e.magnitudeSquared(e.subtract(c,a,C)),N=e.magnitudeSquared(e.subtract(l,u,C)),L=i,P=s,z=O;R>z&&(z=R,L=a,P=c),N>z&&(z=N,L=u,P=l);var D=w;D.x=.5*(L.x+P.x),D.y=.5*(L.y+P.y),D.z=.5*(L.z+P.z);var F=e.magnitudeSquared(e.subtract(P,D,C)),_=Math.sqrt(F),B=b;B.x=i.x,B.y=a.y,B.z=u.z;var U=x;U.x=s.x,U.y=c.y,U.z=l.z;var G=e.multiplyByScalar(e.add(B,U,C),.5,A),q=0;for(h=0;f>h;h++){e.clone(t[h],o);var k=e.magnitude(e.subtract(o,G,C));k>q&&(q=k);var V=e.magnitudeSquared(e.subtract(o,D,C));if(V>F){var W=Math.sqrt(V);_=.5*(_+W),F=_*_;var Y=W-_;D.x=(_*D.x+Y*o.x)/W,D.y=(_*D.y+Y*o.y)/W,D.z=(_*D.z+Y*o.z)/W}}return q>_?(e.clone(D,r.center),r.radius=_):(e.clone(G,r.center),r.radius=q),r};var T=new u,M=new e,I=new e,O=new t,R=new t;m.fromRectangle2D=function(e,t,r){return m.fromRectangleWithHeights2D(e,t,0,0,r)},m.fromRectangleWithHeights2D=function(t,o,i,a,u){if(n(u)||(u=new m),!n(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;o=r(o,T),h.southwest(t,O),O.height=i,h.northeast(t,R),R.height=a;var s=o.project(O,M),c=o.project(R,I),l=c.x-s.x,f=c.y-s.y,d=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+d*d);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*f,p.z=s.z+.5*d,u};var N=[];m.fromRectangle3D=function(e,t,o,i){t=r(t,a.WGS84),o=r(o,0);var u;return n(e)&&(u=h.subsample(e,t,o,N)),m.fromPoints(u,i)},m.fromVertices=function(t,o,i,a){if(n(a)||(a=new m),!n(t)||0===t.length)return a.center=e.clone(e.ZERO,a.center),a.radius=0,a;o=r(o,e.ZERO),i=r(i,3);var u=S;u.x=t[0]+o.x,u.y=t[1]+o.y,u.z=t[2]+o.z;for(var s=e.clone(u,d),c=e.clone(u,p),l=e.clone(u,v),f=e.clone(u,y),h=e.clone(u,g),T=e.clone(u,E),M=t.length,I=0;M>I;I+=i){var O=t[I]+o.x,R=t[I+1]+o.y,N=t[I+2]+o.z;u.x=O,u.y=R,u.z=N,O<s.x&&e.clone(u,s),O>f.x&&e.clone(u,f),R<c.y&&e.clone(u,c),R>h.y&&e.clone(u,h),N<l.z&&e.clone(u,l),N>T.z&&e.clone(u,T)}var L=e.magnitudeSquared(e.subtract(f,s,C)),P=e.magnitudeSquared(e.subtract(h,c,C)),z=e.magnitudeSquared(e.subtract(T,l,C)),D=s,F=f,_=L;P>_&&(_=P,D=c,F=h),z>_&&(_=z,D=l,F=T);var B=w;B.x=.5*(D.x+F.x),B.y=.5*(D.y+F.y),B.z=.5*(D.z+F.z);var U=e.magnitudeSquared(e.subtract(F,B,C)),G=Math.sqrt(U),q=b;q.x=s.x,q.y=c.y,q.z=l.z;var k=x;k.x=f.x,k.y=h.y,k.z=T.z;var V=e.multiplyByScalar(e.add(q,k,C),.5,A),W=0;for(I=0;M>I;I+=i){u.x=t[I]+o.x,u.y=t[I+1]+o.y,u.z=t[I+2]+o.z;var Y=e.magnitude(e.subtract(u,V,C));Y>W&&(W=Y);var H=e.magnitudeSquared(e.subtract(u,B,C));if(H>U){var j=Math.sqrt(H);G=.5*(G+j),U=G*G;var K=j-G;B.x=(G*B.x+K*u.x)/j,B.y=(G*B.y+K*u.y)/j,B.z=(G*B.z+K*u.z)/j}}return W>G?(e.clone(B,a.center),a.radius=G):(e.clone(V,a.center),a.radius=W),a},m.fromCornerPoints=function(t,r,o){n(o)||(o=new m);var i=o.center;return e.add(t,r,i),e.multiplyByScalar(i,.5,i),o.radius=e.distance(i,r),o},m.fromEllipsoid=function(t,r){return n(r)||(r=new m),e.clone(e.ZERO,r.center),r.radius=t.maximumRadius,r};var L=new e;m.fromBoundingSpheres=function(t,r){if(n(r)||(r=new m),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var o=t.length;if(1===o)return m.clone(t[0],r);if(2===o)return m.union(t[0],t[1],r);for(var i=[],a=0;o>a;a++)i.push(t[a].center);r=m.fromPoints(i,r);var u=r.center,s=r.radius;for(a=0;o>a;a++){var c=t[a];s=Math.max(s,e.distance(u,c.center,L)+c.radius)}return r.radius=s,r},m.clone=function(t,r){return n(t)?n(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new m(t.center,t.radius):void 0},m.packedLength=4,m.pack=function(e,t,n){n=r(n,0);var o=e.center;t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n]=e.radius},m.unpack=function(e,t,o){t=r(t,0),n(o)||(o=new m);var i=o.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],o.radius=e[t],o};var P=new e,z=new e;m.union=function(t,r,o){n(o)||(o=new m);var i=t.center,a=t.radius,u=r.center,s=r.radius,c=e.subtract(u,i,P),l=e.magnitude(c);if(a>=l+s)return t.clone(o),o;if(s>=l+a)return r.clone(o),o;var f=.5*(a+l+s),h=e.multiplyByScalar(c,(-a+f)/l,z);return e.add(h,i,h),e.clone(h,o.center),o.radius=f,o};var D=new e;m.expand=function(t,r,n){n=m.clone(t,n);var o=e.magnitude(e.subtract(r,n.center,D));return o>n.radius&&(n.radius=o),n},m.intersectPlane=function(t,r){var n=t.center,o=t.radius,i=r.normal,a=e.dot(i,n)+r.distance;return-o>a?s.OUTSIDE:o>a?s.INTERSECTING:s.INSIDE};var F=new f(new e,0);m.intersect=function(e,t){o("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var r=f.fromCartesian4(t,F);return m.intersectPlane(e,r)},m.transform=function(e,t,r){return n(r)||(r=new m),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=l.getMaximumScale(t)*e.radius,r};var _=new e;m.distanceSquaredTo=function(t,r){var n=e.subtract(t.center,r,_);return e.magnitudeSquared(n)-t.radius*t.radius},m.transformWithoutScale=function(e,t,r){return n(r)||(r=new m),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var B=new e;m.computePlaneDistances=function(t,r,o,i){n(i)||(i=new c);var a=e.subtract(t.center,r,B),u=e.multiplyByScalar(o,e.dot(o,a),B),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var U=new e,G=new e,q=new e,k=new e,V=new e,W=new t,Y=new Array(8),H=0;8>H;++H)Y[H]=new e;var j=new u;return m.projectTo2D=function(t,n,o){n=r(n,j);var i=n.ellipsoid,a=t.center,u=t.radius,s=i.geodeticSurfaceNormal(a,U),c=e.cross(e.UNIT_Z,s,G);e.normalize(c,c);var l=e.cross(s,c,q);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,V),h=e.negate(c,k),d=Y,p=d[0];e.add(s,l,p),e.add(p,c,p),p=d[1],e.add(s,l,p),e.add(p,h,p),p=d[2],e.add(s,f,p),e.add(p,h,p),p=d[3],e.add(s,f,p),e.add(p,c,p),e.negate(s,s),p=d[4],e.add(s,l,p),e.add(p,c,p),p=d[5],e.add(s,l,p),e.add(p,h,p),p=d[6],e.add(s,f,p),e.add(p,h,p),p=d[7],e.add(s,f,p),e.add(p,c,p);for(var v=d.length,y=0;v>y;++y){var g=d[y];e.add(a,g,g);var E=i.cartesianToCartographic(g,W);n.project(E,g)}o=m.fromPoints(d,o),a=o.center;var S=a.x,C=a.y,w=a.z;return a.x=w,a.y=S,a.z=C,o},m.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},m.prototype.intersectPlane=function(e){return m.intersectPlane(this,e)},m.prototype.intersect=function(e){return m.intersect(this,e)},m.prototype.equals=function(e){return m.equals(this,e)},m.prototype.clone=function(e){return m.clone(this,e)},m}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},o={};return t(o,{element:{get:function(){return o.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return o.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return o.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return o.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return o.supportsFullscreen()?null!==o.element:void 0}}}),o.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var o,i=["webkit","moz","o","ms","khtml"],a=0,u=i.length;u>a;++a){var s=i[a];o=s+"RequestFullscreen","function"==typeof t[o]?(n.requestFullscreen=o,r=!0):(o=s+"RequestFullScreen","function"==typeof t[o]&&(n.requestFullscreen=o,r=!0)),o=s+"ExitFullscreen","function"==typeof document[o]?n.exitFullscreen=o:(o=s+"CancelFullScreen","function"==typeof document[o]&&(n.exitFullscreen=o)),o=s+"FullscreenEnabled",e(document[o])?n.fullscreenEnabled=o:(o=s+"FullScreenEnabled",e(document[o])&&(n.fullscreenEnabled=o)),o=s+"FullscreenElement",e(document[o])?n.fullscreenElement=o:(o=s+"FullScreenElement",e(document[o])&&(n.fullscreenElement=o)),o=s+"fullscreenchange",e(document["on"+o])&&("ms"===s&&(o="MSFullscreenChange"),n.fullscreenchange=o),o=s+"fullscreenerror",e(document["on"+o])&&("ms"===s&&(o="MSFullscreenError"),n.fullscreenerror=o)}return r},o.requestFullscreen=function(e){o.supportsFullscreen()&&e[n.requestFullscreen]()},o.exitFullscreen=function(){o.supportsFullscreen()&&document[n.exitFullscreen]()},o}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function o(){if(!t(v)){v=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(v=!0,y=n(e[1]))}return v}function i(){return o()&&y}function a(){if(!t(g)&&(g=!1,!o()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,E=n(e[1]))}return g}function u(){return a()&&E}function s(){if(!t(S)){S=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(S=!0,C=n(e[1]),C.isNightly=!!e[2])}return S}function c(){return s()&&C}function l(){if(!t(w)){w=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(w=!0,b=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(w=!0,b=n(e[1])))}return w}function f(){return l()&&b}function h(){if(!t(x)){x=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(x=!0,A=n(e[1]))}return x}function m(){return t(T)||(T=/Windows/i.test(navigator.appVersion)),T}function d(){return h()&&A}function p(){return t(M)||(M=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),M}var v,y,g,E,S,C,w,b,x,A,T,M,I={isChrome:o,chromeVersion:i,isSafari:a,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:d,isWindows:m,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return I.supportsFullscreen=function(){return r.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/Color",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math"],function(e,t,r,n,o,i){"use strict";function a(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1>6*r?e+6*(t-e)*r:1>2*r?t:2>3*r?e+6*(t-e)*(2/3-r):e}var u=function(t,r,n,o){this.red=e(t,1),this.green=e(r,1),this.blue=e(n,1),this.alpha=e(o,1)};u.fromCartesian4=function(e,r){return t(r)?(r.red=e.x,r.green=e.y,r.blue=e.z,r.alpha=e.w,r):new u(e.x,e.y,e.z,e.w)},u.fromBytes=function(r,n,o,i,a){return r=u.byteToFloat(e(r,255)),n=u.byteToFloat(e(n,255)),o=u.byteToFloat(e(o,255)),i=u.byteToFloat(e(i,255)),t(a)?(a.red=r,a.green=n,a.blue=o,a.alpha=i,a):new u(r,n,o,i)},u.fromAlpha=function(e,r,n){return t(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=r,n):new u(e.red,e.green,e.blue,r)};var s,c,l;n.supportsTypedArrays()&&(s=new ArrayBuffer(4),c=new Uint32Array(s),l=new Uint8Array(s)),u.fromRgba=function(e){return c[0]=e,u.fromBytes(l[0],l[1],l[2],l[3])},u.fromHsl=function(t,r,n,o){t=e(t,0)%1,r=e(r,0),n=e(n,0),o=e(o,1);var i=n,s=n,c=n;if(0!==r){var l;l=.5>n?n*(1+r):n+r-n*r;var f=2*n-l;i=a(f,l,t+1/3),s=a(f,l,t),c=a(f,l,t-1/3)}return new u(i,s,c,o)},u.fromRandom=function(r,n){r=e(r,e.EMPTY_OBJECT);var o=r.red;if(!t(o)){var a=e(r.minimumRed,0),s=e(r.maximumRed,1);o=a+i.nextRandomNumber()*(s-a)}var c=r.green;if(!t(c)){var l=e(r.minimumGreen,0),f=e(r.maximumGreen,1);c=l+i.nextRandomNumber()*(f-l)}var h=r.blue;if(!t(h)){var m=e(r.minimumBlue,0),d=e(r.maximumBlue,1);h=m+i.nextRandomNumber()*(d-m)}var p=r.alpha;if(!t(p)){var v=e(r.minimumAlpha,0),y=e(r.maximumAlpha,1);p=v+i.nextRandomNumber()*(y-v)}return t(n)?(n.red=o,n.green=c,n.blue=h,n.alpha=p,n):new u(o,c,h,p)};var f=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,h=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,m=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,d=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;return u.fromCssColorString=function(r){var n=u[r.toUpperCase()];if(t(n))return u.clone(n);var o=f.exec(r);return null!==o?new u(parseInt(o[1],16)/15,parseInt(o[2],16)/15,parseInt(o[3],16)/15):(o=h.exec(r),null!==o?new u(parseInt(o[1],16)/255,parseInt(o[2],16)/255,parseInt(o[3],16)/255):(o=m.exec(r),null!==o?new u(parseFloat(o[1])/("%"===o[1].substr(-1)?100:255),parseFloat(o[2])/("%"===o[2].substr(-1)?100:255),parseFloat(o[3])/("%"===o[3].substr(-1)?100:255),parseFloat(e(o[4],"1.0"))):(o=d.exec(r),null!==o?u.fromHsl(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,parseFloat(e(o[4],"1.0"))):void 0)))},u.packedLength=4,u.pack=function(t,r,n){n=e(n,0),r[n++]=t.red,r[n++]=t.green,r[n++]=t.blue,r[n]=t.alpha},u.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new u),o.red=r[n++],o.green=r[n++],o.blue=r[n++],o.alpha=r[n],o},u.byteToFloat=function(e){return e/255},u.floatToByte=function(e){return 1===e?255:0|256*e},u.clone=function(e,r){return t(e)?t(r)?(r.red=e.red,r.green=e.green,r.blue=e.blue,r.alpha=e.alpha,r):new u(e.red,e.green,e.blue,e.alpha):void 0},u.equals=function(e,r){return e===r||t(e)&&t(r)&&e.red===r.red&&e.green===r.green&&e.blue===r.blue&&e.alpha===r.alpha},u.equalsArray=function(e,t,r){return e.red===t[r]&&e.green===t[r+1]&&e.blue===t[r+2]&&e.alpha===t[r+3]},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u.prototype.equalsEpsilon=function(e,r){return this===e||t(e)&&Math.abs(this.red-e.red)<=r&&Math.abs(this.green-e.green)<=r&&Math.abs(this.blue-e.blue)<=r&&Math.abs(this.alpha-e.alpha)<=r},u.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},u.prototype.toCssColorString=function(){var e=u.floatToByte(this.red),t=u.floatToByte(this.green),r=u.floatToByte(this.blue);return 1===this.alpha?"rgb("+e+","+t+","+r+")":"rgba("+e+","+t+","+r+","+this.alpha+")"},u.prototype.toBytes=function(e){var r=u.floatToByte(this.red),n=u.floatToByte(this.green),o=u.floatToByte(this.blue),i=u.floatToByte(this.alpha);return t(e)?(e[0]=r,e[1]=n,e[2]=o,e[3]=i,e):[r,n,o,i]},u.prototype.toRgba=function(){return l[0]=u.floatToByte(this.red),l[1]=u.floatToByte(this.green),l[2]=u.floatToByte(this.blue),l[3]=u.floatToByte(this.alpha),c[0]},u.prototype.brighten=function(e,t){return e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t},u.prototype.darken=function(e,t){return e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t},u.prototype.withAlpha=function(e,t){return u.fromAlpha(this,e,t)},u.ALICEBLUE=o(u.fromCssColorString("#F0F8FF")),u.ANTIQUEWHITE=o(u.fromCssColorString("#FAEBD7")),u.AQUA=o(u.fromCssColorString("#00FFFF")),u.AQUAMARINE=o(u.fromCssColorString("#7FFFD4")),u.AZURE=o(u.fromCssColorString("#F0FFFF")),u.BEIGE=o(u.fromCssColorString("#F5F5DC")),u.BISQUE=o(u.fromCssColorString("#FFE4C4")),u.BLACK=o(u.fromCssColorString("#000000")),u.BLANCHEDALMOND=o(u.fromCssColorString("#FFEBCD")),u.BLUE=o(u.fromCssColorString("#0000FF")),u.BLUEVIOLET=o(u.fromCssColorString("#8A2BE2")),u.BROWN=o(u.fromCssColorString("#A52A2A")),u.BURLYWOOD=o(u.fromCssColorString("#DEB887")),u.CADETBLUE=o(u.fromCssColorString("#5F9EA0")),u.CHARTREUSE=o(u.fromCssColorString("#7FFF00")),u.CHOCOLATE=o(u.fromCssColorString("#D2691E")),u.CORAL=o(u.fromCssColorString("#FF7F50")),u.CORNFLOWERBLUE=o(u.fromCssColorString("#6495ED")),u.CORNSILK=o(u.fromCssColorString("#FFF8DC")),u.CRIMSON=o(u.fromCssColorString("#DC143C")),u.CYAN=o(u.fromCssColorString("#00FFFF")),u.DARKBLUE=o(u.fromCssColorString("#00008B")),u.DARKCYAN=o(u.fromCssColorString("#008B8B")),u.DARKGOLDENROD=o(u.fromCssColorString("#B8860B")),u.DARKGRAY=o(u.fromCssColorString("#A9A9A9")),u.DARKGREEN=o(u.fromCssColorString("#006400")),u.DARKGREY=u.DARKGRAY,u.DARKKHAKI=o(u.fromCssColorString("#BDB76B")),u.DARKMAGENTA=o(u.fromCssColorString("#8B008B")),u.DARKOLIVEGREEN=o(u.fromCssColorString("#556B2F")),u.DARKORANGE=o(u.fromCssColorString("#FF8C00")),u.DARKORCHID=o(u.fromCssColorString("#9932CC")),u.DARKRED=o(u.fromCssColorString("#8B0000")),u.DARKSALMON=o(u.fromCssColorString("#E9967A")),u.DARKSEAGREEN=o(u.fromCssColorString("#8FBC8F")),u.DARKSLATEBLUE=o(u.fromCssColorString("#483D8B")),u.DARKSLATEGRAY=o(u.fromCssColorString("#2F4F4F")),u.DARKSLATEGREY=u.DARKSLATEGRAY,u.DARKTURQUOISE=o(u.fromCssColorString("#00CED1")),u.DARKVIOLET=o(u.fromCssColorString("#9400D3")),u.DEEPPINK=o(u.fromCssColorString("#FF1493")),u.DEEPSKYBLUE=o(u.fromCssColorString("#00BFFF")),u.DIMGRAY=o(u.fromCssColorString("#696969")),u.DIMGREY=u.DIMGRAY,u.DODGERBLUE=o(u.fromCssColorString("#1E90FF")),u.FIREBRICK=o(u.fromCssColorString("#B22222")),u.FLORALWHITE=o(u.fromCssColorString("#FFFAF0")),u.FORESTGREEN=o(u.fromCssColorString("#228B22")),u.FUSCHIA=o(u.fromCssColorString("#FF00FF")),u.GAINSBORO=o(u.fromCssColorString("#DCDCDC")),u.GHOSTWHITE=o(u.fromCssColorString("#F8F8FF")),u.GOLD=o(u.fromCssColorString("#FFD700")),u.GOLDENROD=o(u.fromCssColorString("#DAA520")),u.GRAY=o(u.fromCssColorString("#808080")),u.GREEN=o(u.fromCssColorString("#008000")),u.GREENYELLOW=o(u.fromCssColorString("#ADFF2F")),u.GREY=u.GRAY,u.HONEYDEW=o(u.fromCssColorString("#F0FFF0")),u.HOTPINK=o(u.fromCssColorString("#FF69B4")),u.INDIANRED=o(u.fromCssColorString("#CD5C5C")),u.INDIGO=o(u.fromCssColorString("#4B0082")),u.IVORY=o(u.fromCssColorString("#FFFFF0")),u.KHAKI=o(u.fromCssColorString("#F0E68C")),u.LAVENDER=o(u.fromCssColorString("#E6E6FA")),u.LAVENDAR_BLUSH=o(u.fromCssColorString("#FFF0F5")),u.LAWNGREEN=o(u.fromCssColorString("#7CFC00")),u.LEMONCHIFFON=o(u.fromCssColorString("#FFFACD")),u.LIGHTBLUE=o(u.fromCssColorString("#ADD8E6")),u.LIGHTCORAL=o(u.fromCssColorString("#F08080")),u.LIGHTCYAN=o(u.fromCssColorString("#E0FFFF")),u.LIGHTGOLDENRODYELLOW=o(u.fromCssColorString("#FAFAD2")),u.LIGHTGRAY=o(u.fromCssColorString("#D3D3D3")),u.LIGHTGREEN=o(u.fromCssColorString("#90EE90")),u.LIGHTGREY=u.LIGHTGRAY,u.LIGHTPINK=o(u.fromCssColorString("#FFB6C1")),u.LIGHTSEAGREEN=o(u.fromCssColorString("#20B2AA")),u.LIGHTSKYBLUE=o(u.fromCssColorString("#87CEFA")),u.LIGHTSLATEGRAY=o(u.fromCssColorString("#778899")),u.LIGHTSLATEGREY=u.LIGHTSLATEGRAY,u.LIGHTSTEELBLUE=o(u.fromCssColorString("#B0C4DE")),u.LIGHTYELLOW=o(u.fromCssColorString("#FFFFE0")),u.LIME=o(u.fromCssColorString("#00FF00")),u.LIMEGREEN=o(u.fromCssColorString("#32CD32")),u.LINEN=o(u.fromCssColorString("#FAF0E6")),u.MAGENTA=o(u.fromCssColorString("#FF00FF")),u.MAROON=o(u.fromCssColorString("#800000")),u.MEDIUMAQUAMARINE=o(u.fromCssColorString("#66CDAA")),u.MEDIUMBLUE=o(u.fromCssColorString("#0000CD")),u.MEDIUMORCHID=o(u.fromCssColorString("#BA55D3")),u.MEDIUMPURPLE=o(u.fromCssColorString("#9370DB")),u.MEDIUMSEAGREEN=o(u.fromCssColorString("#3CB371")),u.MEDIUMSLATEBLUE=o(u.fromCssColorString("#7B68EE")),u.MEDIUMSPRINGGREEN=o(u.fromCssColorString("#00FA9A")),u.MEDIUMTURQUOISE=o(u.fromCssColorString("#48D1CC")),u.MEDIUMVIOLETRED=o(u.fromCssColorString("#C71585")),u.MIDNIGHTBLUE=o(u.fromCssColorString("#191970")),u.MINTCREAM=o(u.fromCssColorString("#F5FFFA")),u.MISTYROSE=o(u.fromCssColorString("#FFE4E1")),u.MOCCASIN=o(u.fromCssColorString("#FFE4B5")),u.NAVAJOWHITE=o(u.fromCssColorString("#FFDEAD")),u.NAVY=o(u.fromCssColorString("#000080")),u.OLDLACE=o(u.fromCssColorString("#FDF5E6")),u.OLIVE=o(u.fromCssColorString("#808000")),u.OLIVEDRAB=o(u.fromCssColorString("#6B8E23")),u.ORANGE=o(u.fromCssColorString("#FFA500")),u.ORANGERED=o(u.fromCssColorString("#FF4500")),u.ORCHID=o(u.fromCssColorString("#DA70D6")),u.PALEGOLDENROD=o(u.fromCssColorString("#EEE8AA")),u.PALEGREEN=o(u.fromCssColorString("#98FB98")),u.PALETURQUOISE=o(u.fromCssColorString("#AFEEEE")),u.PALEVIOLETRED=o(u.fromCssColorString("#DB7093")),u.PAPAYAWHIP=o(u.fromCssColorString("#FFEFD5")),u.PEACHPUFF=o(u.fromCssColorString("#FFDAB9")),u.PERU=o(u.fromCssColorString("#CD853F")),u.PINK=o(u.fromCssColorString("#FFC0CB")),u.PLUM=o(u.fromCssColorString("#DDA0DD")),u.POWDERBLUE=o(u.fromCssColorString("#B0E0E6")),u.PURPLE=o(u.fromCssColorString("#800080")),u.RED=o(u.fromCssColorString("#FF0000")),u.ROSYBROWN=o(u.fromCssColorString("#BC8F8F")),u.ROYALBLUE=o(u.fromCssColorString("#4169E1")),u.SADDLEBROWN=o(u.fromCssColorString("#8B4513")),u.SALMON=o(u.fromCssColorString("#FA8072")),u.SANDYBROWN=o(u.fromCssColorString("#F4A460")),u.SEAGREEN=o(u.fromCssColorString("#2E8B57")),u.SEASHELL=o(u.fromCssColorString("#FFF5EE")),u.SIENNA=o(u.fromCssColorString("#A0522D")),u.SILVER=o(u.fromCssColorString("#C0C0C0")),u.SKYBLUE=o(u.fromCssColorString("#87CEEB")),u.SLATEBLUE=o(u.fromCssColorString("#6A5ACD")),u.SLATEGRAY=o(u.fromCssColorString("#708090")),u.SLATEGREY=u.SLATEGRAY,u.SNOW=o(u.fromCssColorString("#FFFAFA")),u.SPRINGGREEN=o(u.fromCssColorString("#00FF7F")),u.STEELBLUE=o(u.fromCssColorString("#4682B4")),u.TAN=o(u.fromCssColorString("#D2B48C")),u.TEAL=o(u.fromCssColorString("#008080")),u.THISTLE=o(u.fromCssColorString("#D8BFD8")),u.TOMATO=o(u.fromCssColorString("#FF6347")),u.TURQUOISE=o(u.fromCssColorString("#40E0D0")),u.VIOLET=o(u.fromCssColorString("#EE82EE")),u.WHEAT=o(u.fromCssColorString("#F5DEB3")),u.WHITE=o(u.fromCssColorString("#FFFFFF")),u.WHITESMOKE=o(u.fromCssColorString("#F5F5F5")),u.YELLOW=o(u.fromCssColorString("#FFFF00")),u.YELLOWGREEN=o(u.fromCssColorString("#9ACD32")),u.TRANSPARENT=o(new u(0,0,0,0)),u -}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,r,n,o){"use strict";if(!n.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new r("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,n,o,a){switch(o=e(o,0),a=e(a,(n.byteLength-o)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(n,o,a);case i.UNSIGNED_BYTE:return new Uint8Array(n,o,a);case i.SHORT:return new Int16Array(n,o,a);case i.UNSIGNED_SHORT:return new Uint16Array(n,o,a);case i.FLOAT:return new Float32Array(n,o,a);case i.DOUBLE:return new Float64Array(n,o,a);default:throw new r("componentDatatype is not a valid value.")}},o(i)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,o){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,o.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,n.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var n=-1;for(var o in e.attributes)if(e.attributes.hasOwnProperty(o)&&t(e.attributes[o])&&t(e.attributes[o].values)){var i=e.attributes[o],a=i.values.length/i.componentsPerAttribute;if(n!==a&&-1!==n)throw new r("All attribute lists must have the same number of attributes.");n=a}return n},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,o){"use strict";var i=function(t,r){this.x=e(t,0),this.y=e(r,0)};i.fromElements=function(e,r,n){return t(n)?(n.x=e,n.y=r,n):new i(e,r)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n]=t.y},i.unpack=function(r,n,o){return n=e(n,0),t(o)||(o=new i),o.x=r[n++],o.y=r[n],o},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var a=new i;i.distance=function(e,t){return i.subtract(e,t,a),i.magnitude(a)},i.distanceSquared=function(e,t){return i.subtract(e,t,a),i.magnitudeSquared(a)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),o.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&o.equalsEpsilon(e.x,r.x,n,i)&&o.equalsEpsilon(e.y,r.y,n,i)},i.ZERO=n(new i(0,0)),i.UNIT_X=n(new i(1,0)),i.UNIT_Y=n(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n,o){"use strict";var i={};i.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=t.x,n=t.y;t.x=(1-Math.abs(n))*o.signNotZero(r),t.y=(1-Math.abs(r))*o.signNotZero(n)}return t.x=o.toSNorm(t.x),t.y=o.toSNorm(t.y),t},i.octDecode=function(e,r,n){if(n.x=o.fromSNorm(e),n.y=o.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var i=n.x;n.x=(1-Math.abs(n.y))*o.signNotZero(i),n.y=(1-Math.abs(i))*o.signNotZero(n.y)}return t.normalize(n,n)},i.octPackFloat=function(e){return 256*e.x+e.y};var a=new e;return i.octEncodeFloat=function(e){return i.octEncode(e,a),i.octPackFloat(a)},i.octDecodeFloat=function(e,t){var r=e/256,n=Math.floor(r),o=256*(r-n);return i.octDecode(n,o,t)},i.octPack=function(e,t,r,n){var o=i.octEncodeFloat(e),u=i.octEncodeFloat(t),s=i.octEncode(r,a);return n.x=65536*s.x+o,n.y=65536*s.y+u,n},i.octUnpack=function(e,t,r,n){var o=e.x/65536,a=Math.floor(o),u=65536*(o-a);o=e.y/65536;var s=Math.floor(o),c=65536*(o-s);i.octDecodeFloat(u,t),i.octDecodeFloat(c,r),i.octDecode(a,s,n)},i.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,r=1===e.y?4095:0|4096*e.y;return 4096*t+r},i.decompressTextureCoordinates=function(e,t){var r=e/4096;return t.x=Math.floor(r)/4096,t.y=r-Math.floor(r),t},i}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=new t,o=new t,i=new t,a=function(a,u,s,c,l){r(l)||(l=new t);var f,h,m,d,p,v,y,g;r(u.z)?(f=t.subtract(s,u,n),h=t.subtract(c,u,o),m=t.subtract(a,u,i),d=t.dot(f,f),p=t.dot(f,h),v=t.dot(f,m),y=t.dot(h,h),g=t.dot(h,m)):(f=e.subtract(s,u,n),h=e.subtract(c,u,o),m=e.subtract(a,u,i),d=e.dot(f,f),p=e.dot(f,h),v=e.dot(f,m),y=e.dot(h,h),g=e.dot(h,m));var E=1/(d*y-p*p);return l.y=(y*v-p*g)*E,l.z=(d*g-p*v)*E,l.x=1-l.y-l.z,l};return a}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};r.encode=function(e,r){t(r)||(r={high:0,low:0});var n;return e>=0?(n=65536*Math.floor(e/65536),r.high=n,r.low=e-n):(n=65536*Math.floor(-e/65536),r.high=-n,r.low=e+n),r};var n={high:0,low:0};r.fromCartesian=function(e,o){t(o)||(o=new r);var i=o.high,a=o.low;return r.encode(e.x,n),i.x=n.high,a.x=n.low,r.encode(e.y,n),i.y=n.high,a.y=n.low,r.encode(e.z,n),i.z=n.high,a.z=n.low,o};var o=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,o);var i=o.high,a=o.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=a.x,t[n+4]=a.y,t[n+5]=a.z},r}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";var o=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=n.clone(e(t.modelMatrix,n.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return o}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n){"use strict";var o={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return o.getSizeInBytes=function(e){switch(e){case o.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case o.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case o.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},o.validate=function(t){return e(t)&&(t===o.UNSIGNED_BYTE||t===o.UNSIGNED_SHORT||t===o.UNSIGNED_INT)},o.createTypedArray=function(e,t){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},o.createTypedArrayFromArrayBuffer=function(e,t,r,o){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,o):new Uint16Array(t,r,o)},r(o)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var o=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(o/Math.max(Math.abs(e),Math.abs(r)))<n?0:o}var n={};return n.computeDiscriminant=function(e,t,r){var n=t*t-4*e*r;return n},n.computeRealRoots=function(e,n,o){var i;if(0===e)return 0===n?[]:[-o/n];if(0===n){if(0===o)return[0,0];var a=Math.abs(o),u=Math.abs(e);if(u>a&&a/u<t.EPSILON14)return[0,0];if(a>u&&u/a<t.EPSILON14)return[];if(i=-o/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===o)return i=-n/e,0>i?[i,0]:[0,i];var c=n*n,l=4*e*o,f=r(c,-l,t.EPSILON14);if(0>f)return[];var h=-.5*r(n,t.sign(n)*Math.sqrt(f),t.EPSILON14);return n>0?[h/e,o/h]:[o/h,h/e]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var o,i,a=e,u=t/3,s=r/3,c=n,l=a*s,f=u*c,h=u*u,m=s*s,d=a*s-h,p=a*c-u*s,v=u*c-m,y=4*d*v-p*p;if(0>y){var g,E,S;h*f>=l*m?(g=a,E=d,S=-2*u*d+a*p):(g=c,E=v,S=-c*p+2*s*v);var C=0>S?-1:1,w=-C*Math.abs(g)*Math.sqrt(-y);i=-S+w;var b=i/2,x=0>b?-Math.pow(-b,1/3):Math.pow(b,1/3),A=i===w?-x:-E/x;return o=0>=E?x+A:-S/(x*x+A*A+E),h*f>=l*m?[(o-u)/a]:[-c/(o+s)]}var T=d,M=-2*u*d+a*p,I=v,O=-c*p+2*s*v,R=Math.sqrt(y),N=Math.sqrt(3)/2,L=Math.abs(Math.atan2(a*R,-M)/3);o=2*Math.sqrt(-T);var P=Math.cos(L);i=o*P;var z=o*(-P/2-N*Math.sin(L)),D=i+z>2*u?i-u:z-u,F=a,_=D/F;L=Math.abs(Math.atan2(c*R,-O)/3),o=2*Math.sqrt(-I),P=Math.cos(L),i=o*P,z=o*(-P/2-N*Math.sin(L));var B=-c,U=2*s>i+z?i+s:z+s,G=B/U,q=F*U,k=-D*U-F*B,V=D*B,W=(s*k-u*V)/(-u*k+s*q);return W>=_?G>=_?G>=W?[_,W,G]:[_,G,W]:[G,_,W]:G>=_?[W,_,G]:G>=W?[W,G,_]:[G,W,_]}var n={};return n.computeDiscriminant=function(e,t,r,n){var o=e*e,i=t*t,a=r*r,u=n*n,s=18*e*t*r*n+i*a-27*o*u-4*(e*a*r+i*t*n);return s},n.computeRealRoots=function(e,n,o,i){var a,u;if(0===e)return t.computeRealRoots(n,o,i);if(0===n){if(0===o){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(a=t.computeRealRoots(e,0,o),0===a.Length?[0]:[a[0],0,a[1]]):r(e,0,o,i)}return 0===o?0===i?(u=-n/e,0>u?[u,0,0]:[0,0,u]):r(e,n,0,i):0===i?(a=t.computeRealRoots(e,n,o),0===a.length?[0]:a[1]<=0?[a[0],a[1],0]:a[0]>=0?[0,a[0],a[1]]:[a[0],0,a[1]]):r(e,n,o,i)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function o(t,o,i,a){var u=t*t,s=o-3*u/8,c=i-o*t/2+u*t/8,l=a-i*t/4+o*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var h=-t/4,m=f[f.length-1];if(Math.abs(m)<r.EPSILON14){var d=n.computeRealRoots(1,s,l);if(2===d.length){var p,v=d[0],y=d[1];if(v>=0&&y>=0){var g=Math.sqrt(v),E=Math.sqrt(y);return[h-E,h-g,h+g,h+E]}if(v>=0&&0>y)return p=Math.sqrt(v),[h-p,h+p];if(0>v&&y>=0)return p=Math.sqrt(y),[h-p,h+p]}return[]}if(m>0){var S=Math.sqrt(m),C=(s+m-c/S)/2,w=(s+m+c/S)/2,b=n.computeRealRoots(1,S,C),x=n.computeRealRoots(1,-S,w);return 0!==b.length?(b[0]+=h,b[1]+=h,0!==x.length?(x[0]+=h,x[1]+=h,b[1]<=x[0]?[b[0],b[1],x[0],x[1]]:x[1]<=b[0]?[x[0],x[1],b[0],b[1]]:b[0]>=x[0]&&b[1]<=x[1]?[x[0],b[0],b[1],x[1]]:x[0]>=b[0]&&x[1]<=b[1]?[b[0],x[0],x[1],b[1]]:b[0]>x[0]&&b[0]<x[1]?[x[0],b[0],x[1],b[1]]:[b[0],x[0],b[1],x[1]]):b):0!==x.length?(x[0]+=h,x[1]+=h,x):[]}}return[]}function i(t,o,i,a){var u=i*i,s=o*o,c=t*t,l=-2*o,f=i*t+s-4*a,h=c*a-i*o*t+u,m=e.computeRealRoots(1,l,f,h);if(m.length>0){var d,p,v=m[0],y=o-v,g=y*y,E=t/2,S=y/2,C=g-4*a,w=g+4*Math.abs(a),b=c-4*v,x=c+4*Math.abs(v);if(0>v||b*w>C*x){var A=Math.sqrt(b);d=A/2,p=0===A?0:(t*S-i)/A}else{var T=Math.sqrt(C);d=0===T?0:(t*S-i)/T,p=T/2}var M,I;0===E&&0===d?(M=0,I=0):r.sign(E)===r.sign(d)?(M=E+d,I=v/M):(I=E-d,M=v/I);var O,R;0===S&&0===p?(O=0,R=0):r.sign(S)===r.sign(p)?(O=S+p,R=a/O):(R=S-p,O=a/R);var N=n.computeRealRoots(1,M,O),L=n.computeRealRoots(1,I,R);if(0!==N.length)return 0!==L.length?N[1]<=L[0]?[N[0],N[1],L[0],L[1]]:L[1]<=N[0]?[L[0],L[1],N[0],N[1]]:N[0]>=L[0]&&N[1]<=L[1]?[L[0],N[0],N[1],L[1]]:L[0]>=N[0]&&L[1]<=N[1]?[N[0],L[0],L[1],N[1]]:N[0]>L[0]&&N[0]<L[1]?[L[0],N[0],L[1],N[1]]:[N[0],L[0],N[1],L[1]]:N;if(0!==L.length)return L}return[]}var a={};return a.computeDiscriminant=function(e,t,r,n,o){var i=e*e,a=i*e,u=t*t,s=u*t,c=r*r,l=c*r,f=n*n,h=f*n,m=o*o,d=m*o,p=u*c*f-4*s*h-4*e*l*f+18*e*t*r*h-27*i*f*f+256*a*d+o*(18*s*r*n-4*u*l+16*e*c*c-80*e*t*c*n-6*e*u*f+144*i*r*f)+m*(144*e*u*r-27*u*u-128*i*c-192*i*t*n);return p},a.computeRealRoots=function(t,n,a,u,s){if(Math.abs(t)<r.EPSILON15)return e.computeRealRoots(n,a,u,s);var c=n/t,l=a/t,f=u/t,h=s/t,m=0>c?1:0;switch(m+=0>l?m+1:m,m+=0>f?m+1:m,m+=0>h?m+1:m){case 0:return o(c,l,f,h);case 1:return i(c,l,f,h);case 2:return i(c,l,f,h);case 3:return o(c,l,f,h);case 4:return o(c,l,f,h);case 5:return i(c,l,f,h);case 6:return o(c,l,f,h);case 7:return o(c,l,f,h);case 8:return i(c,l,f,h);case 9:return o(c,l,f,h);case 10:return o(c,l,f,h);case 11:return i(c,l,f,h);case 12:return o(c,l,f,h);case 13:return o(c,l,f,h);case 14:return o(c,l,f,h);case 15:return o(c,l,f,h);default:return void 0}},a}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=function(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n};return n.getPoint=function(t,n,o){return r(o)||(o=new e),o=e.multiplyByScalar(t.direction,n,o),e.add(t.origin,o,o)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,o,i,a,u,s,c){"use strict";function l(t,n,o,a,u){u=r(u,!1);var s,c,l,f,h,m=t.origin,d=t.direction,p=e.subtract(o,n,v),C=e.subtract(a,n,y),w=e.cross(d,C,g),b=e.dot(p,w);if(u){if(b<i.EPSILON6)return void 0;if(s=e.subtract(m,n,E),l=e.dot(s,w),0>l||l>b)return void 0;if(c=e.cross(s,p,S),f=e.dot(d,c),0>f||l+f>b)return void 0;h=e.dot(C,c)/b}else{if(Math.abs(b)<i.EPSILON6)return void 0;var x=1/b;if(s=e.subtract(m,n,E),l=e.dot(s,w)*x,0>l||l>1)return void 0;if(c=e.cross(s,p,S),f=e.dot(d,c)*x,0>f||l+f>1)return void 0;h=e.dot(C,c)*x}return h}function f(e,t,r,n){var o=t*t-4*e*r;if(0>o)return void 0;if(o>0){var i=1/(2*e),a=Math.sqrt(o),u=(-t+a)*i,s=(-t-a)*i;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-t/(2*e);return 0===c?void 0:(n.root0=n.root1=c,n)}function h(t,r,o){n(o)||(o={});var i=t.origin,a=t.direction,u=r.center,s=r.radius*r.radius,c=e.subtract(i,u,g),l=e.dot(a,a),h=2*e.dot(a,c),m=e.magnitudeSquared(c)-s,d=f(l,h,m,w);return n(d)?(o.start=d.root0,o.stop=d.root1,o):void 0}function m(e,t,r){var n=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))<r?0:n}function d(t,r,n,o,c){var l,f=o*o,h=c*c,d=(t[a.COLUMN1ROW1]-t[a.COLUMN2ROW2])*h,p=c*(o*m(t[a.COLUMN1ROW0],t[a.COLUMN0ROW1],i.EPSILON15)+r.y),v=t[a.COLUMN0ROW0]*f+t[a.COLUMN2ROW2]*h+o*r.x+n,y=h*m(t[a.COLUMN2ROW1],t[a.COLUMN1ROW2],i.EPSILON15),g=c*(o*m(t[a.COLUMN2ROW0],t[a.COLUMN0ROW2])+r.z),E=[];if(0===g&&0===y){if(l=u.computeRealRoots(d,p,v),0===l.length)return E;var S=l[0],C=Math.sqrt(Math.max(1-S*S,0));if(E.push(new e(o,c*S,c*-C)),E.push(new e(o,c*S,c*C)),2===l.length){var w=l[1],b=Math.sqrt(Math.max(1-w*w,0));E.push(new e(o,c*w,c*-b)),E.push(new e(o,c*w,c*b))}return E}var x=g*g,A=y*y,T=d*d,M=g*y,I=T+A,O=2*(p*d+M),R=2*v*d+p*p-A+x,N=2*(v*p-M),L=v*v-x;if(0===I&&0===O&&0===R&&0===N)return E;l=s.computeRealRoots(I,O,R,N,L);var P=l.length;if(0===P)return E;for(var z=0;P>z;++z){var D,F=l[z],_=F*F,B=Math.max(1-_,0),U=Math.sqrt(B);D=i.sign(d)===i.sign(v)?m(d*_+v,p*F,i.EPSILON12):i.sign(v)===i.sign(p*F)?m(d*_,p*F+v,i.EPSILON12):m(d*_+p*F,v,i.EPSILON12);var G=m(y*F,g,i.EPSILON15),q=D*G;0>q?E.push(new e(o,c*F,c*U)):q>0?E.push(new e(o,c*F,c*-U)):0!==U?(E.push(new e(o,c*F,c*-U)),E.push(new e(o,c*F,c*U)),++z):E.push(new e(o,c*F,c*U))}return E}var p={};p.rayPlane=function(t,r,o){n(o)||(o=new e);var a=t.origin,u=t.direction,s=r.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-r.distance-e.dot(s,a))/c;return 0>l?void 0:(o=e.multiplyByScalar(u,l,o),e.add(a,o,o))};var v=new e,y=new e,g=new e,E=new e,S=new e;p.rayTriangle=function(t,r,o,i,a,u){var s=l(t,r,o,i,a);return!n(s)||0>s?void 0:(n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var C=new c;p.lineSegmentTriangle=function(t,r,o,i,a,u,s){var c=C;e.clone(t,c.origin),e.subtract(r,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,o,i,a,u);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var w={root0:0,root1:0};p.raySphere=function(e,t,r){return r=h(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var b=new c;p.lineSegmentSphere=function(t,r,o,i){var a=b;e.clone(t,a.origin);var u=e.subtract(r,t,a.direction),s=e.magnitude(u);return e.normalize(u,u),i=h(a,o,i),!n(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var x=new e,A=new e;p.rayEllipsoid=function(t,r){var n,o,i,a,u,s=r.oneOverRadii,c=e.multiplyComponents(s,t.origin,x),l=e.multiplyComponents(s,t.direction,A),f=e.magnitudeSquared(c),h=e.dot(c,l);if(f>1){if(h>=0)return void 0;var m=h*h;if(n=f-1,o=e.magnitudeSquared(l),i=o*n,i>m)return void 0;if(m>i){a=h*h-i,u=-h+Math.sqrt(a);var d=u/o,p=n/u;return p>d?{start:d,stop:p}:{start:p,stop:d}}var v=Math.sqrt(n/o);return{start:v,stop:v}}return 1>f?(n=f-1,o=e.magnitudeSquared(l),i=o*n,a=h*h-i,u=-h+Math.sqrt(a),{start:0,stop:u/o}):0>h?(o=e.magnitudeSquared(l),{start:0,stop:-h/o}):void 0};var T=new e,M=new e,I=new e,O=new e,R=new e,N=new a,L=new a,P=new a,z=new a,D=new a,F=new a,_=new a,B=new e,U=new e,G=new t;p.grazingAltitudeLocation=function(t,r){var o=t.origin,u=t.direction,s=r.geodeticSurfaceNormal(o,T);if(e.dot(u,s)>=0)return o;var c=n(this.rayEllipsoid(t,r)),l=r.transformPositionToScaledSpace(u,T),f=e.normalize(l,l),h=e.mostOrthogonalAxis(l,O),m=e.normalize(e.cross(h,f,M),M),p=e.normalize(e.cross(f,m,I),I),v=N;v[0]=f.x,v[1]=f.y,v[2]=f.z,v[3]=m.x,v[4]=m.y,v[5]=m.z,v[6]=p.x,v[7]=p.y,v[8]=p.z;var y=a.transpose(v,L),g=a.fromScale(r.radii,P),E=a.fromScale(r.oneOverRadii,z),S=D;S[0]=0,S[1]=-u.z,S[2]=u.y,S[3]=u.z,S[4]=0,S[5]=-u.x,S[6]=-u.y,S[7]=u.x,S[8]=0;var C,w,b=a.multiply(a.multiply(y,E,F),S,F),x=a.multiply(a.multiply(b,g,_),v,_),A=a.multiplyByVector(b,o,R),q=d(x,e.negate(A,T),0,0,1),k=q.length;if(k>0){for(var V=e.clone(e.ZERO,U),W=Number.NEGATIVE_INFINITY,Y=0;k>Y;++Y){C=a.multiplyByVector(g,a.multiplyByVector(v,q[Y],B),B);var H=e.normalize(e.subtract(C,o,O),O),j=e.dot(H,u);j>W&&(W=j,V=e.clone(C,V))}var K=r.cartesianToCartographic(V,G);return W=i.clamp(W,0,1),w=e.magnitude(e.subtract(V,o,O))*Math.sqrt(1-W*W),w=c?-w:w,K.height=w,r.cartographicToCartesian(K,new e)}return void 0};var q=new e;return p.lineSegmentPlane=function(t,r,o,a){n(a)||(a=new e);var u=e.subtract(r,t,q),s=o.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(o.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,a),e.add(t,a,a),a)},p.trianglePlaneIntersection=function(t,r,n,o){var i=o.normal,a=o.distance,u=e.dot(i,t)+a<0,s=e.dot(i,r)+a<0,c=e.dot(i,n)+a<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,h;if((1===l||2===l)&&(f=new e,h=new e),1===l){if(u)return p.lineSegmentPlane(t,r,o,f),p.lineSegmentPlane(t,n,o,h),{positions:[t,r,n,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(r,n,o,f),p.lineSegmentPlane(r,t,o,h),{positions:[t,r,n,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(n,t,o,f),p.lineSegmentPlane(n,r,o,h),{positions:[t,r,n,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(r,t,o,f),p.lineSegmentPlane(n,t,o,h),{positions:[t,r,n,f,h],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(n,r,o,f),p.lineSegmentPlane(t,r,o,h),{positions:[t,r,n,f,h],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,n,o,f),p.lineSegmentPlane(r,n,o,h),{positions:[t,r,n,f,h],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};return r.calculateACMR=function(r){r=e(r,e.EMPTY_OBJECT);var n=r.indices,o=r.maximumIndex,i=e(r.cacheSize,24),a=n.length;if(!t(o)){o=0;for(var u=0,s=n[u];a>u;)s>o&&(o=s),++u,s=n[u]}for(var c=[],l=0;o+1>l;l++)c[l]=0;for(var f=i+1,h=0;a>h;++h)f-c[n[h]]>i&&(c[n[h]]=f,++f);return(f-i+1)/(a/3)},r.tipsify=function(r){function n(e,t,r,n){for(;t.length>=1;){var o=t[t.length-1];if(t.splice(t.length-1,1),e[o].numLiveTriangles>0)return o}for(;n>i;){if(e[i].numLiveTriangles>0)return++i,i-1;++i}return-1}function o(e,t,r,o,i,a,u){for(var s,c=-1,l=-1,f=0;f<r.length;){var h=r[f];o[h].numLiveTriangles&&(s=0,i-o[h].timeStamp+2*o[h].numLiveTriangles<=t&&(s=i-o[h].timeStamp),(s>l||-1===l)&&(l=s,c=h)),++f}return-1===c?n(o,a,e,u):c}r=e(r,e.EMPTY_OBJECT);var i,a=r.indices,u=r.maximumIndex,s=e(r.cacheSize,24),c=a.length,l=0,f=0,h=a[f],m=c;if(t(u))l=u+1;else{for(;m>f;)h>l&&(l=h),++f,h=a[f];if(-1===l)return 0;++l}for(var d=[],p=0;l>p;p++)d[p]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var v=0;m>f;)d[a[f]].vertexTriangles.push(v),++d[a[f]].numLiveTriangles,d[a[f+1]].vertexTriangles.push(v),++d[a[f+1]].numLiveTriangles,d[a[f+2]].vertexTriangles.push(v),++d[a[f+2]].numLiveTriangles,++v,f+=3;var y=0,g=s+1;i=1;var E,S,C=[],w=[],b=0,x=[],A=c/3,T=[];for(p=0;A>p;p++)T[p]=!1;for(var M,I;-1!==y;){C=[],S=d[y],I=S.vertexTriangles.length;for(var O=0;I>O;++O)if(v=S.vertexTriangles[O],!T[v]){T[v]=!0,f=v+v+v;for(var R=0;3>R;++R)M=a[f],C.push(M),w.push(M),x[b]=M,++b,E=d[M],--E.numLiveTriangles,g-E.timeStamp>s&&(E.timeStamp=g,++g),++f}y=o(a,s,C,d,g,w,l)}return x},r}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,r,n,o,i,a,u,s,c,l,f,h,m,d,p,v,y,g,E,S,C,w,b,x,A){"use strict";function T(e,t,r,n,o){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=o,e[t++]=o,e[t]=r}function M(e){for(var t=e.length,r=6*(t/3),n=y.createTypedArray(t,r),o=0,i=0;t>i;i+=3,o+=6)T(n,o,e[i],e[i+1],e[i+2]);return n}function I(e){var t=e.length;if(t>=3){var r=6*(t-2),n=y.createTypedArray(t,r);T(n,0,e[0],e[1],e[2]);for(var o=6,i=3;t>i;++i,o+=6)T(n,o,e[i-1],e[i],e[i-2]);return n}return new Uint16Array}function O(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=y.createTypedArray(t,r),o=e[0],i=0,a=1;t>a;++a,i+=6)T(n,i,o,e[a],e[a+1]);return n}return new Uint16Array}function R(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new d({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function N(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var o=t[n],i=0;i<o.componentsPerAttribute;++i)e[n].values.push(o.values[r*o.componentsPerAttribute+i])}function L(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)o.unpack(r,i,it),w.multiplyByPoint(e,it,it),o.pack(it,r,i)}function P(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)o.unpack(r,i,it),C.multiplyByVector(e,it,it),it=o.normalize(it,it),o.pack(it,r,i)}function z(e,t){var r,n=e.length,o={},i=e[0][t].attributes;for(r in i)if(i.hasOwnProperty(r)&&c(i[r])&&c(i[r].values)){for(var a=i[r],s=a.values.length,l=!0,f=1;n>f;++f){var h=e[f][t].attributes[r];if(!c(h)||a.componentDatatype!==h.componentDatatype||a.componentsPerAttribute!==h.componentsPerAttribute||a.normalize!==h.normalize){l=!1;break}s+=h.values.length}l&&(o[r]=new d({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:u.createTypedArray(a.componentDatatype,s)}))}return o}function D(e,t){var n,i,a,u,s=e.length;e[0].modelMatrix;var l,f,h,d=c(e[0][t].indices),p=e[0][t].primitiveType,v=z(e,t);for(n in v)if(v.hasOwnProperty(n))for(l=v[n].values,u=0,i=0;s>i;++i)for(f=e[i][t].attributes[n].values,h=f.length,a=0;h>a;++a)l[u++]=f[a];var g;if(d){var E=0;for(i=0;s>i;++i)E+=e[i][t].indices.length;var S=m.computeNumberOfVertices(new m({attributes:v,primitiveType:x.POINTS})),C=y.createTypedArray(S,E),w=0,b=0;for(i=0;s>i;++i){var A=e[i][t].indices,T=A.length;for(u=0;T>u;++u)C[w++]=b+A[u];b+=m.computeNumberOfVertices(e[i][t])}g=C}var M,I=new o,O=0;for(i=0;s>i;++i){if(M=e[i][t].boundingSphere,!c(M)){I=void 0;break}o.add(M.center,I,I)}if(c(I))for(o.divideByScalar(I,s,I),i=0;s>i;++i){M=e[i][t].boundingSphere;var R=o.magnitude(o.subtract(M.center,I,st))+M.radius;R>O&&(O=R)}return new m({attributes:v,indices:g,primitiveType:p,boundingSphere:c(I)?new r(I,O):void 0})}function F(e){if(c(e.indices))return e;for(var t=m.computeNumberOfVertices(e),r=y.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function _(e){var t=m.computeNumberOfVertices(e),r=y.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,o=3;t>o;++o)r[n++]=o-1,r[n++]=0,r[n++]=o;return e.indices=r,e.primitiveType=x.TRIANGLES,e}function B(e){var t=m.computeNumberOfVertices(e),r=y.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,o=3;t-1>o;o+=2)r[n++]=o,r[n++]=o-1,r[n++]=o+1,t>o+2&&(r[n++]=o,r[n++]=o+1,r[n++]=o+2);return e.indices=r,e.primitiveType=x.TRIANGLES,e}function U(e){if(c(e.indices))return e;for(var t=m.computeNumberOfVertices(e),r=y.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function G(e){var t=m.computeNumberOfVertices(e),r=y.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,o=2;t>o;++o)r[n++]=o-1,r[n++]=o;return e.indices=r,e.primitiveType=x.LINES,e}function q(e){var t=m.computeNumberOfVertices(e),r=y.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,o=2;t>o;++o)r[n++]=o-1,r[n++]=o;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=x.LINES,e}function k(e){switch(e.primitiveType){case x.TRIANGLE_FAN:return _(e);case x.TRIANGLE_STRIP:return B(e);case x.TRIANGLES:return F(e);case x.LINE_STRIP:return G(e);case x.LINE_LOOP:return q(e);case x.LINES:return U(e)}return e}function V(e,t){Math.abs(e.y)<S.EPSILON6&&(e.y=t?-S.EPSILON6:S.EPSILON6)}function W(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return V(e,e.y<0),V(t,t.y<0),V(r,r.y<0),void 0;var n,o=Math.abs(e.y),i=Math.abs(t.y),a=Math.abs(r.y);n=o>i?o>a?S.sign(e.y):S.sign(r.y):i>a?S.sign(t.y):S.sign(r.y);var u=0>n;V(e,u),V(t,u),V(r,u)}function Y(e,t,r,n){o.add(e,o.multiplyByScalar(o.subtract(t,e,St),e.y/(e.y-t.y),St),r),o.clone(r,n),V(r,!0),V(n,!1)}function H(e,t,r){if(e.x>=0||t.x>=0||r.x>=0)return void 0;W(e,t,r);var n=e.y<0,o=t.y<0,i=r.y<0,a=0;a+=n?1:0,a+=o?1:0,a+=i?1:0;var u=At.indices;1===a?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(Y(e,t,Ct,bt),Y(e,r,wt,xt),u[0]=0,u[3]=1,u[4]=2,u[6]=1):o?(Y(t,r,Ct,bt),Y(t,e,wt,xt),u[0]=1,u[3]=2,u[4]=0,u[6]=2):i&&(Y(r,e,Ct,bt),Y(r,t,wt,xt),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===a&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,n?o?i||(Y(r,e,Ct,bt),Y(r,t,wt,xt),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(Y(t,r,Ct,bt),Y(t,e,wt,xt),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(Y(e,t,Ct,bt),Y(e,r,wt,xt),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=At.positions;return s[0]=e,s[1]=t,s[2]=r,s.length=3,(1===a||2===a)&&(s[3]=Ct,s[4]=wt,s[5]=bt,s[6]=xt,s.length=7),At}function j(e,t){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var o in n)if(n.hasOwnProperty(o)&&c(n[o])&&c(n[o].values)){var i=n[o];i.values=u.createTypedArray(i.componentDatatype,i.values)}var a=m.computeNumberOfVertices(e);return e.indices=y.createTypedArray(a,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}function K(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var o=t[n];r[n]=new d({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:[]})}return new m({attributes:r,indices:[],primitiveType:e.primitiveType})}function Z(e,t,r){var n=c(e.geometry.boundingSphere);t=j(t,n),r=j(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function X(e,r,i,a,u,s,l,f,h,m,d){if(c(s)||c(l)||c(f)||c(h)){var p=o.fromArray(u,3*e,Tt),v=o.fromArray(u,3*r,Mt),y=o.fromArray(u,3*i,It),g=t(a,p,v,y,Ot);if(c(s)){var E=o.fromArray(s,3*e,Tt),S=o.fromArray(s,3*r,Mt),C=o.fromArray(s,3*i,It);o.multiplyByScalar(E,g.x,E),o.multiplyByScalar(S,g.y,S),o.multiplyByScalar(C,g.z,C);var w=o.add(E,S,E);o.add(w,C,w),o.normalize(w,w),o.pack(w,m.normal.values,3*d)}if(c(l)){var b=o.fromArray(l,3*e,Tt),x=o.fromArray(l,3*r,Mt),A=o.fromArray(l,3*i,It);o.multiplyByScalar(b,g.x,b),o.multiplyByScalar(x,g.y,x),o.multiplyByScalar(A,g.z,A);var T=o.add(b,x,b);o.add(T,A,T),o.normalize(T,T),o.pack(T,m.binormal.values,3*d)}if(c(f)){var M=o.fromArray(f,3*e,Tt),I=o.fromArray(f,3*r,Mt),O=o.fromArray(f,3*i,It);o.multiplyByScalar(M,g.x,M),o.multiplyByScalar(I,g.y,I),o.multiplyByScalar(O,g.z,O);var R=o.add(M,I,M);o.add(R,O,R),o.normalize(R,R),o.pack(R,m.tangent.values,3*d)}if(c(h)){var N=n.fromArray(h,2*e,Rt),L=n.fromArray(h,2*r,Nt),P=n.fromArray(h,2*i,Lt);n.multiplyByScalar(N,g.x,N),n.multiplyByScalar(L,g.y,L),n.multiplyByScalar(P,g.z,P);var z=n.add(N,L,N);n.add(z,P,z),n.pack(z,m.st.values,2*d)}}}function Q(e,t,r,n,o,i){var a=e.position.values.length/3;if(-1!==o){var u=n[o],s=r[u];return-1===s?(r[u]=a,e.position.values.push(i.x,i.y,i.z),t.push(a),a):(t.push(s),s)}return e.position.values.push(i.x,i.y,i.z),t.push(a),a}function J(e){var t,r,n,i,a,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,h=c(s.binormal)?s.binormal.values:void 0,m=c(s.tangent)?s.tangent.values:void 0,d=c(s.st)?s.st.values:void 0,p=u.indices,v=K(u),y=K(u),g=[]; -g.length=l.length/3;var E=[];for(E.length=l.length/3,a=0;a<g.length;++a)g[a]=-1,E[a]=-1;var S=p.length;for(a=0;S>a;a+=3){var C=p[a],w=p[a+1],b=p[a+2],x=o.fromArray(l,3*C),A=o.fromArray(l,3*w),T=o.fromArray(l,3*b),M=H(x,A,T);if(c(M)&&M.positions.length>3)for(var I=M.positions,O=M.indices,R=O.length,N=0;R>N;++N){var L=O[N],P=I[L];P.y<0?(t=y.attributes,r=y.indices,n=g):(t=v.attributes,r=v.indices,n=E),i=Q(t,r,n,p,3>L?a+L:-1,P),X(C,w,b,P,l,f,h,m,d,t,i)}else c(M)&&(x=M.positions[0],A=M.positions[1],T=M.positions[2]),x.y<0?(t=y.attributes,r=y.indices,n=g):(t=v.attributes,r=v.indices,n=E),i=Q(t,r,n,p,a,x),X(C,w,b,x,l,f,h,m,d,t,i),i=Q(t,r,n,p,a+1,A),X(C,w,b,A,l,f,h,m,d,t,i),i=Q(t,r,n,p,a+2,T),X(C,w,b,T,l,f,h,m,d,t,i)}Z(e,y,v)}function $(e){var t,r=e.geometry,n=r.attributes,i=n.position.values,a=r.indices,u=K(r),s=K(r),l=a.length,f=[];f.length=i.length/3;var h=[];for(h.length=i.length/3,t=0;t<f.length;++t)f[t]=-1,h[t]=-1;for(t=0;l>t;t+=2){var m=a[t],d=a[t+1],p=o.fromArray(i,3*m,Tt),v=o.fromArray(i,3*d,Mt);Math.abs(p.y)<S.EPSILON6&&(p.y=p.y<0?-S.EPSILON6:S.EPSILON6),Math.abs(v.y)<S.EPSILON6&&(v.y=v.y<0?-S.EPSILON6:S.EPSILON6);var y=u.attributes,g=u.indices,C=h,w=s.attributes,b=s.indices,x=f,A=E.lineSegmentPlane(p,v,Pt,It);if(c(A)){var T=o.multiplyByScalar(o.UNIT_Y,5*S.EPSILON9,zt);p.y<0&&(o.negate(T,T),y=s.attributes,g=s.indices,C=f,w=u.attributes,b=u.indices,x=h);var M=o.add(A,T,Dt);Q(y,g,C,a,t,p),Q(y,g,C,a,-1,M),o.negate(T,T),o.add(A,T,M),Q(w,b,x,a,-1,M),Q(w,b,x,a,t+1,v)}else{var I,O,R;p.y<0?(I=s.attributes,O=s.indices,R=f):(I=u.attributes,O=u.indices,R=h),Q(I,O,R,a,t,p),Q(I,O,R,a,t+1,v)}}Z(e,s,u)}function et(e){var t=e.geometry,r=t.attributes,a=r.position.values,u=r.prevPosition.values,s=r.nextPosition.values,l=r.expandAndWidth.values;t.indices;var f,h,m,d=c(r.st)?r.st.values:void 0,p=c(r.color)?r.color.values:void 0,v=K(t),y=K(t),g=a.length/3;for(f=0;g>f;f+=4){var C=f,w=f+1,b=f+2,x=f+3,A=o.fromArray(a,3*C,Bt),T=o.fromArray(a,3*w,Ut),M=o.fromArray(a,3*b,Gt),I=o.fromArray(a,3*x,qt);Math.abs(A.y)<S.EPSILON6&&(A.y=S.EPSILON6*(M.y<0?-1:1),T.y=A.y),Math.abs(M.y)<S.EPSILON6&&(M.y=S.EPSILON6*(A.y<0?-1:1),I.y=M.y);var O=v.attributes,R=v.indices,N=y.attributes,L=y.indices,P=E.lineSegmentPlane(A,M,Pt,kt);if(c(P)){var z=o.multiplyByScalar(o.UNIT_Y,5*S.EPSILON9,Vt);A.y<0&&(o.negate(z,z),O=y.attributes,R=y.indices,N=v.attributes,L=v.indices);var D=o.add(P,z,Wt);for(O.position.values.push(A.x,A.y,A.z,T.x,T.y,T.z),O.position.values.push(D.x,D.y,D.z),O.position.values.push(D.x,D.y,D.z),o.negate(z,z),o.add(P,z,D),N.position.values.push(D.x,D.y,D.z),N.position.values.push(D.x,D.y,D.z),N.position.values.push(M.x,M.y,M.z,I.x,I.y,I.z),h=3*C;3*C+6>h;++h)O.prevPosition.values.push(u[h]);for(O.prevPosition.values.push(A.x,A.y,A.z,A.x,A.y,A.z),N.prevPosition.values.push(A.x,A.y,A.z,A.x,A.y,A.z),h=3*b;3*b+6>h;++h)N.prevPosition.values.push(u[h]);for(h=3*C;3*C+6>h;++h)O.nextPosition.values.push(s[h]);for(O.nextPosition.values.push(M.x,M.y,M.z,M.x,M.y,M.z),N.nextPosition.values.push(M.x,M.y,M.z,M.x,M.y,M.z),h=3*b;3*b+6>h;++h)N.nextPosition.values.push(s[h]);var F=n.fromArray(l,2*C,Ft),_=Math.abs(F.y);O.expandAndWidth.values.push(-1,_,1,_),O.expandAndWidth.values.push(-1,-_,1,-_),N.expandAndWidth.values.push(-1,_,1,_),N.expandAndWidth.values.push(-1,-_,1,-_);var B=o.magnitudeSquared(o.subtract(P,A,qt));if(B/=o.magnitudeSquared(o.subtract(M,A,qt)),c(p)){var U=i.fromArray(p,4*C,Yt),G=i.fromArray(p,4*b,Yt),q=S.lerp(U.x,G.x,B),k=S.lerp(U.y,G.y,B),V=S.lerp(U.z,G.z,B),W=S.lerp(U.w,G.w,B);for(h=4*C;4*C+8>h;++h)O.color.values.push(p[h]);for(O.color.values.push(q,k,V,W),O.color.values.push(q,k,V,W),N.color.values.push(q,k,V,W),N.color.values.push(q,k,V,W),h=4*b;4*b+8>h;++h)N.color.values.push(p[h])}if(c(d)){var Y=n.fromArray(d,2*C,Ft),H=n.fromArray(d,2*(f+3),_t),j=S.lerp(Y.x,H.x,B);for(h=2*C;2*C+4>h;++h)O.st.values.push(d[h]);for(O.st.values.push(j,Y.y),O.st.values.push(j,H.y),N.st.values.push(j,Y.y),N.st.values.push(j,H.y),h=2*b;2*b+4>h;++h)N.st.values.push(d[h])}m=O.position.values.length/3-4,R.push(m,m+2,m+1),R.push(m+1,m+2,m+3),m=N.position.values.length/3-4,L.push(m,m+2,m+1),L.push(m+1,m+2,m+3)}else{var X,Q;for(A.y<0?(X=y.attributes,Q=y.indices):(X=v.attributes,Q=v.indices),X.position.values.push(A.x,A.y,A.z),X.position.values.push(T.x,T.y,T.z),X.position.values.push(M.x,M.y,M.z),X.position.values.push(I.x,I.y,I.z),h=3*f;3*f+12>h;++h)X.prevPosition.values.push(u[h]),X.nextPosition.values.push(s[h]);for(h=2*f;2*f+8>h;++h)X.expandAndWidth.values.push(l[h]),c(d)&&X.st.values.push(d[h]);if(c(p))for(h=4*f;4*f+16>h;++h)X.color.values.push(p[h]);m=X.position.values.length/3-4,Q.push(m,m+2,m+1),Q.push(m+1,m+2,m+3)}}Z(e,y,v)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case x.TRIANGLES:e.indices=M(t);break;case x.TRIANGLE_STRIP:e.indices=I(t);break;case x.TRIANGLE_FAN:e.indices=O(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=x.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,n){t=s(t,"normal"),n=s(n,1e4);for(var o=e.attributes.position.values,i=e.attributes[t].values,a=o.length,l=new Float64Array(2*a),f=0,h=0;a>h;h+=3)l[f++]=o[h],l[f++]=o[h+1],l[f++]=o[h+2],l[f++]=o[h]+i[h]*n,l[f++]=o[h+1]+i[h+1]*n,l[f++]=o[h+2]+i[h+2]*n;var p,v=e.boundingSphere;return c(v)&&(p=new r(v.center,v.radius+n)),new m({attributes:{position:new d({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:x.LINES,boundingSphere:p})},tt.createAttributeLocations=function(e){var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,o={},i=0,a=r.length;for(t=0;a>t;++t){var u=r[t];c(n[u])&&(o[u]=i++)}for(var s in n)n.hasOwnProperty(s)&&!c(o[s])&&(o[s]=i++);return o},tt.reorderForPreVertexCache=function(e){var t=m.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),o=0;t>o;o++)n[o]=-1;for(var i,a=r,s=a.length,l=y.createTypedArray(t,s),f=0,h=0,d=0;s>f;)i=n[a[f]],-1!==i?l[h]=i:(i=a[f],n[i]=d,l[h]=d,++d),++f,++h;e.indices=l;var p=e.attributes;for(var v in p)if(p.hasOwnProperty(v)&&c(p[v])&&c(p[v].values)){for(var g=p[v],E=g.values,S=0,C=g.componentsPerAttribute,w=u.createTypedArray(g.componentDatatype,d*C);t>S;){var b=n[S];if(-1!==b)for(o=0;C>o;o++)w[C*b+o]=E[C*S+o];++S}g.values=w}}return e},tt.reorderForPostVertexCache=function(e,t){var r=e.indices;if(e.primitiveType===x.TRIANGLES&&c(r)){for(var n=r.length,o=0,i=0;n>i;i++)r[i]>o&&(o=r[i]);e.indices=A.tipsify({indices:r,maximumIndex:o,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],r=m.computeNumberOfVertices(e);if(c(e.indices)&&r>S.SIXTY_FOUR_KILOBYTES){var n,o=[],i=[],a=0,u=R(e.attributes),s=e.indices,l=s.length;e.primitiveType===x.TRIANGLES?n=3:e.primitiveType===x.LINES?n=2:e.primitiveType===x.POINTS&&(n=1);for(var f=0;l>f;f+=n){for(var h=0;n>h;++h){var d=s[f+h],p=o[d];c(p)||(p=a++,o[d]=p,N(u,e.attributes,d)),i.push(p)}a+n>S.SIXTY_FOUR_KILOBYTES&&(t.push(new m({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),o=[],i=[],a=0,u=R(e.attributes))}0!==i.length&&t.push(new m({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var rt=new o,nt=new a;tt.projectTo2D=function(e,t,r,n,i){var a=e.attributes[t];i=c(i)?i:new h;for(var s=i.ellipsoid,f=a.values,m=new Float64Array(f.length),p=0,v=0;v<f.length;v+=3){var y=o.fromArray(f,v,rt),g=s.cartesianToCartographic(y,nt);if(!c(g))throw new l("Could not project point ("+y.x+", "+y.y+", "+y.z+") to 2D.");var E=i.project(g,rt);m[p++]=E.x,m[p++]=E.y,m[p++]=E.z}return e.attributes[r]=a,e.attributes[n]=new d({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:m}),delete e.attributes[t],e};var ot={high:0,low:0};tt.encodeAttribute=function(e,t,r,n){for(var o=e.attributes[t],i=o.values,a=i.length,s=new Float32Array(a),c=new Float32Array(a),l=0;a>l;++l)f.encode(i[l],ot),s[l]=ot.high,c[l]=ot.low;var h=o.componentsPerAttribute;return e.attributes[r]=new d({componentDatatype:u.FLOAT,componentsPerAttribute:h,values:s}),e.attributes[n]=new d({componentDatatype:u.FLOAT,componentsPerAttribute:h,values:c}),delete e.attributes[t],e};var it=new o,at=new w,ut=new C;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(w.equals(t,w.IDENTITY))return e;var n=e.geometry.attributes;L(t,n.position),L(t,n.prevPosition),L(t,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(w.inverse(t,at),w.transpose(at,at),w.getRotation(at,ut),P(ut,n.normal),P(ut,n.binormal),P(ut,n.tangent));var o=e.geometry.boundingSphere;return c(o)&&(e.geometry.boundingSphere=r.transform(o,t,o)),e.modelMatrix=w.clone(w.IDENTITY),e};var st=new o;tt.combineInstances=function(e){for(var t=[],r=[],n=e.length,o=0;n>o;++o){var i=e[o];c(i.geometry)?t.push(i):r.push(i)}var a=[];return t.length>0&&a.push(D(t,"geometry")),r.length>0&&(a.push(D(r,"westHemisphereGeometry")),a.push(D(r,"eastHemisphereGeometry"))),a};var ct=new o,lt=new o,ft=new o,ht=new o;tt.computeNormal=function(e){for(var t=e.indices,r=e.attributes,n=r.position.values,i=r.position.values.length/3,a=t.length,s=new Array(i),c=new Array(a/3),l=new Array(a),f=0;i>f;f++)s[f]={indexOffset:0,count:0,currentCount:0};var h=0;for(f=0;a>f;f+=3){var m=t[f],p=t[f+1],v=t[f+2],y=3*m,g=3*p,E=3*v;lt.x=n[y],lt.y=n[y+1],lt.z=n[y+2],ft.x=n[g],ft.y=n[g+1],ft.z=n[g+2],ht.x=n[E],ht.y=n[E+1],ht.z=n[E+2],s[m].count++,s[p].count++,s[v].count++,o.subtract(ft,lt,ft),o.subtract(ht,lt,ht),c[h]=o.cross(ft,ht,new o),h++}var S=0;for(f=0;i>f;f++)s[f].indexOffset+=S,S+=s[f].count;h=0;var C;for(f=0;a>f;f+=3){C=s[t[f]];var w=C.indexOffset+C.currentCount;l[w]=h,C.currentCount++,C=s[t[f+1]],w=C.indexOffset+C.currentCount,l[w]=h,C.currentCount++,C=s[t[f+2]],w=C.indexOffset+C.currentCount,l[w]=h,C.currentCount++,h++}var b=new Float32Array(3*i);for(f=0;i>f;f++){var x=3*f;if(C=s[f],C.count>0){for(o.clone(o.ZERO,ct),h=0;h<C.count;h++)o.add(ct,c[l[C.indexOffset+h]],ct);o.normalize(ct,ct),b[x]=ct.x,b[x+1]=ct.y,b[x+2]=ct.z}else b[x]=0,b[x+1]=0,b[x+2]=1}return e.attributes.normal=new d({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:b}),e};var mt=new o,dt=new o,pt=new o;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,r=e.attributes.position.values,n=e.attributes.normal.values,i=e.attributes.st.values,a=e.attributes.position.values.length/3,s=t.length,c=new Array(3*a),l=0;l<c.length;l++)c[l]=0;var f,h,m;for(l=0;s>l;l+=3){var p=t[l],v=t[l+1],y=t[l+2];f=3*p,h=3*v,m=3*y;var g=2*p,E=2*v,S=2*y,C=r[f],w=r[f+1],b=r[f+2],x=i[g],A=i[g+1],T=i[E+1]-A,M=i[S+1]-A,I=1/((i[E]-x)*M-(i[S]-x)*T),O=(M*(r[h]-C)-T*(r[m]-C))*I,R=(M*(r[h+1]-w)-T*(r[m+1]-w))*I,N=(M*(r[h+2]-b)-T*(r[m+2]-b))*I;c[f]+=O,c[f+1]+=R,c[f+2]+=N,c[h]+=O,c[h+1]+=R,c[h+2]+=N,c[m]+=O,c[m+1]+=R,c[m+2]+=N}var L=new Float32Array(3*a),P=new Float32Array(3*a);for(l=0;a>l;l++){f=3*l,h=f+1,m=f+2;var z=o.fromArray(n,f,mt),D=o.fromArray(c,f,pt),F=o.dot(z,D);o.multiplyByScalar(z,F,dt),o.normalize(o.subtract(D,dt,D),D),P[f]=D.x,P[h]=D.y,P[m]=D.z,o.normalize(o.cross(z,D,D),D),L[f]=D.x,L[h]=D.y,L[m]=D.z}return e.attributes.tangent=new d({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:P}),e.attributes.binormal=new d({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:L}),e};var vt=new n,yt=new o,gt=new o,Et=new o;tt.compressVertices=function(t){var r=t.attributes.normal,i=t.attributes.st;if(!c(r)&&!c(i))return t;var a,s,l,f,h=t.attributes.tangent,m=t.attributes.binormal;c(r)&&(a=r.values),c(i)&&(s=i.values),c(h)&&(l=h.values),m&&(f=m.values);var p=c(a)?a.length:s.length,v=c(a)?3:2,y=p/v,g=y,E=c(s)&&c(a)?2:1;E+=c(l)||c(f)?1:0,g*=E;for(var S=new Float32Array(g),C=0,w=0;y>w;++w){c(s)&&(n.fromArray(s,2*w,vt),S[C++]=e.compressTextureCoordinates(vt));var b=3*w;c(a)&&c(l)&&c(f)?(o.fromArray(a,b,yt),o.fromArray(l,b,gt),o.fromArray(f,b,Et),e.octPack(yt,gt,Et,vt),S[C++]=vt.x,S[C++]=vt.y):(c(a)&&(o.fromArray(a,b,yt),S[C++]=e.octEncodeFloat(yt)),c(l)&&(o.fromArray(l,b,yt),S[C++]=e.octEncodeFloat(yt)),c(f)&&(o.fromArray(f,b,yt),S[C++]=e.octEncodeFloat(yt)))}return t.attributes.compressedAttributes=new d({componentDatatype:u.FLOAT,componentsPerAttribute:E,values:S}),c(a)&&delete t.attributes.normal,c(s)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var St=new o,Ct=new o,wt=new o,bt=new o,xt=new o,At={positions:new Array(7),indices:new Array(9)},Tt=new o,Mt=new o,It=new o,Ot=new o,Rt=new n,Nt=new n,Lt=new n,Pt=b.fromPointNormal(o.ZERO,o.UNIT_Y),zt=new o,Dt=new o,Ft=new n,_t=new n,Bt=new o,Ut=new o,Gt=new o,qt=new o,kt=new o,Vt=new o,Wt=new o,Yt=new i;return new i,tt.splitLongitude=function(e){var t=e.geometry,n=t.boundingSphere;if(c(n)){var o=n.center.x-n.radius;if(o>0||r.intersectPlane(n,b.ORIGIN_ZX_PLANE)!==g.INTERSECTING)return e}if(t.geometryType!==v.NONE)switch(t.geometryType){case v.POLYLINES:et(e);break;case v.TRIANGLES:J(e);break;case v.LINES:$(e)}else k(t),t.primitiveType===x.TRIANGLES?J(e):t.primitiveType===x.LINES&&$(e);return e},tt}),define("Core/WebMercatorProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,r,n,o,i,a,u){"use strict";var s=function(e){this._ellipsoid=r(e,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return o(s.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),s.mercatorAngleToGeodeticLatitude=function(e){return u.PI_OVER_TWO-2*Math.atan(Math.exp(-e))},s.geodeticLatitudeToMercatorAngle=function(e){e>s.MaximumLatitude?e=s.MaximumLatitude:e<-s.MaximumLatitude&&(e=-s.MaximumLatitude);var t=Math.sin(e);return.5*Math.log((1+t)/(1-t))},s.MaximumLatitude=s.mercatorAngleToGeodeticLatitude(Math.PI),s.prototype.project=function(t,r){var o=this._semimajorAxis,i=t.longitude*o,a=s.geodeticLatitudeToMercatorAngle(t.latitude)*o,u=t.height;return n(r)?(r.x=i,r.y=a,r.z=u,r):new e(i,a,u)},s.prototype.unproject=function(e,r){var o=this._oneOverSemimajorAxis,i=e.x*o,a=s.mercatorAngleToGeodeticLatitude(e.y*o),u=e.z;return n(r)?(r.longitude=i,r.latitude=a,r.height=u,r):new t(i,a,u)},s}),define("Scene/PrimitivePipeline",["../Core/BoundingSphere","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Ellipsoid","../Core/FeatureDetection","../Core/GeographicProjection","../Core/Geometry","../Core/GeometryAttribute","../Core/GeometryAttributes","../Core/GeometryPipeline","../Core/IndexDatatype","../Core/Matrix4","../Core/WebMercatorProjection"],function(e,t,r,n,o,i,a,u,s,c,l,f,h,m,d,p){"use strict";function v(e,t,r){var n,o=!r,i=e.length;if(!o&&i>1){var a=e[0].modelMatrix;for(n=1;i>n;++n)if(!d.equals(a,e[n].modelMatrix)){o=!0;break}}if(o)for(n=0;i>n;++n)h.transformToWorldCoordinates(e[n]);else d.multiplyTransformation(t,e[0].modelMatrix,t)}function y(e,n){var o=e.attributes,i=o.position,a=4*(i.values.length/i.componentsPerAttribute);o.pickColor=new l({componentDatatype:r.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,values:new Uint8Array(a)});for(var u=t.floatToByte(n.red),s=t.floatToByte(n.green),c=t.floatToByte(n.blue),f=t.floatToByte(n.alpha),h=o.pickColor.values,m=0;a>m;m+=4)h[m]=u,h[m+1]=s,h[m+2]=c,h[m+3]=f}function g(e,t){for(var r=e.length,n=0;r>n;++n){var i=e[n],a=t[n];o(i.geometry)?y(i.geometry,a):(y(i.westHemisphereGeometry,a),y(i.eastHemisphereGeometry,a))}}function E(e){var t,r=e.length,n=[],i=e[0].attributes;for(t in i)if(i.hasOwnProperty(t)){for(var a=i[t],u=!0,s=1;r>s;++s){var c=e[s].attributes[t];if(!o(c)||a.componentDatatype!==c.componentDatatype||a.componentsPerAttribute!==c.componentsPerAttribute||a.normalize!==c.normalize){u=!1;break}}u&&n.push(t)}return n}function S(e,t,n){for(var o=c.computeNumberOfVertices(t),i=n.length,a=0;i>a;++a){for(var u=n[a],s=e[u],f=s.componentDatatype,h=s.value,m=h.length,d=r.createTypedArray(f,o*m),p=0;o>p;++p)d.set(h,p*m);t.attributes[u]=new l({componentDatatype:f,componentsPerAttribute:m,normalize:s.normalize,values:d})}}function C(e,t){for(var r=e.length,n=0;r>n;++n){var i=e[n],a=i.attributes;o(i.geometry)?S(a,i.geometry,t):(S(a,i.westHemisphereGeometry,t),S(a,i.eastHemisphereGeometry,t))}}function w(t){var n,i,a=t.instances,u=t.pickIds,s=t.projection,c=t.elementIndexUintSupported,l=t.scene3DOnly,f=t.allowPicking,m=t.vertexCacheOptimize,d=t.compressVertices,p=t.modelMatrix,y=a.length;if(a[0].geometry.primitiveType,v(a,p,l),!l)for(n=0;y>n;++n)h.splitLongitude(a[n]);f&&g(a,u);var S=E(a);if(C(a,S),m)for(n=0;y>n;++n){var w=a[n];o(w.geometry)?(h.reorderForPostVertexCache(w.geometry),h.reorderForPreVertexCache(w.geometry)):(h.reorderForPostVertexCache(w.westHemisphereGeometry),h.reorderForPreVertexCache(w.westHemisphereGeometry),h.reorderForPostVertexCache(w.eastHemisphereGeometry),h.reorderForPreVertexCache(w.eastHemisphereGeometry))}var b=h.combineInstances(a);for(y=b.length,n=0;y>n;++n){i=b[n];var x,A=i.attributes;if(l)for(x in A)A.hasOwnProperty(x)&&A[x].componentDatatype===r.DOUBLE&&h.encodeAttribute(i,x,x+"3DHigh",x+"3DLow");else for(x in A)if(A.hasOwnProperty(x)&&A[x].componentDatatype===r.DOUBLE){var T=x+"3D",M=x+"2D";h.projectTo2D(i,x,T,M,s),o(i.boundingSphere)&&"position"===x&&(i.boundingSphereCV=e.fromVertices(i.attributes.position2D.values)),h.encodeAttribute(i,T,T+"High",T+"Low"),h.encodeAttribute(i,M,M+"High",M+"Low")}d&&h.compressVertices(i)}if(!c){var I=[];for(y=b.length,n=0;y>n;++n)i=b[n],I=I.concat(h.fitToUnsignedShortIndices(i));b=I}return b}function b(e,t,n){for(var o=[],i=e.attributes,a=n.length,u=0;a>u;++u){var s=n[u],c=i[s],l=c.componentDatatype;l===r.DOUBLE&&(l=r.FLOAT);var f=r.createTypedArray(l,c.values);o.push({index:t[s],componentDatatype:l,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,values:f}),delete i[s]}return o}function x(e,t,r,i,a,u,s,l,f){var h=c.computeNumberOfVertices(t);o(s[e])||(s[e]={boundingSphere:t.boundingSphere,boundingSphereCV:t.boundingSphereCV});for(var m=i.length,d=0;m>d;++d)for(var p=i[d],v=a[p],y=h;y>0;){for(var g,E=n(f[p],0),S=u[E],C=S.length,w=0;C>w&&(g=S[w],g.index!==v);++w);o(s[e][p])||(s[e][p]={dirty:!1,valid:!0,value:r[p].value,indices:[]});var b,x=g.values.length/g.componentsPerAttribute,A=n(l[p],0);x>A+y?(b=y,s[e][p].indices.push({attribute:g,offset:A,count:b}),l[p]=A+y):(b=x-A,s[e][p].indices.push({attribute:g,offset:A,count:b}),l[p]=0,f[p]=E+1),y-=b}}function A(e,t,r,n,i){var a,u,s,c=[],l=e.length,f={},h={};for(a=0;l>a;++a)u=e[a],s=u.attributes,o(u.geometry)&&x(a,u.geometry,s,i,n,r,c,f,h);for(a=0;l>a;++a)u=e[a],s=u.attributes,o(u.westHemisphereGeometry)&&x(a,u.westHemisphereGeometry,s,i,n,r,c,f,h);for(a=0;l>a;++a)u=e[a],s=u.attributes,o(u.eastHemisphereGeometry)&&x(a,u.eastHemisphereGeometry,s,i,n,r,c,f,h);for(l=t.length,a=0;l>a;++a){u=t[a],s=u.attributes;var m={};c.push(m);for(var d=i.length,p=0;d>p;++p){var v=i[p];m[v]={dirty:!1,valid:!1,value:s[v].value,indices:[]}}}return c}function T(e,t){var r=e.attributes;for(var n in r)if(r.hasOwnProperty(n)){var i=r[n];o(i)&&o(i.values)&&t.push(i.values.buffer)}o(e.indices)&&t.push(e.indices.buffer)}function M(e,t){for(var r=e.length,n=0;r>n;++n)T(e[n],t)}function I(e,t){for(var r=e.length,n=0;r>n;++n)for(var o=e[n],i=o.length,a=0;i>a;++a)t.push(o[a].values.buffer)}function O(t){for(var r=1,n=t.length,i=0;n>i;i++){var a=t[i];if(++r,o(a)){var u=a.attributes;r+=6+2*e.packedLength+(o(a.indices)?a.indices.length:0);for(var s in u)if(u.hasOwnProperty(s)&&o(u[s])){var c=u[s];r+=5+c.values.length}}}return r}function R(e,t){for(var r=e.length,n=new Uint32Array(e.length),o=0;r>o;++o)n[o]=e[o].toRgba();return t.push(n.buffer),n}function N(e){for(var r=e.length,n=new Array(r),o=0;r>o;o++)n[o]=t.fromRgba(e[o]);return n}function L(e){for(var t=e.length,r=1+17*t,n=0;t>n;n++){var i=e[n].attributes;for(var a in i)if(i.hasOwnProperty(a)&&o(i[a])){var u=i[a];r+=5+u.value.length}}return r}function P(e,t){var r=new Float64Array(L(e)),n={},i=[],a=e.length,u=0;r[u++]=a;for(var s=0;a>s;s++){var c=e[s];d.pack(c.modelMatrix,r,u),u+=d.packedLength;var l=c.attributes,f=[];for(var h in l)l.hasOwnProperty(h)&&o(l[h])&&(f.push(h),o(n[h])||(n[h]=i.length,i.push(h)));r[u++]=f.length;for(var m=0;m<f.length;m++){var p=f[m],v=l[p];r[u++]=n[p],r[u++]=v.componentDatatype,r[u++]=v.componentsPerAttribute,r[u++]=v.normalize,r[u++]=v.value.length,r.set(v.value,u),u+=v.value.length}}return t.push(r.buffer),{stringTable:i,packedData:r}}function z(e){for(var t=e.packedData,n=e.stringTable,o=new Array(t[0]),i=0,a=1;a<t.length;){var u=d.unpack(t,a);a+=d.packedLength;for(var s={},c=t[a++],l=0;c>l;l++){for(var f=n[t[a++]],h=t[a++],m=t[a++],p=0!==t[a++],v=t[a++],y=r.createTypedArray(h,v),g=0;v>g;g++)y[g]=t[a++];s[f]={componentDatatype:h,componentsPerAttribute:m,normalize:p,value:y}}o[i++]={attributes:s,modelMatrix:u}}return o}function D(t){for(var r=t.length,n=1+r,i=0;r>i;i++){var a=t[i];n+=2,n+=o(a.boundingSphere)?e.packedLength:0,n+=o(a.boundingSphereCV)?e.packedLength:0;for(var u in a)if(a.hasOwnProperty(u)&&o(a[u])&&"boundingSphere"!==u&&"boundingSphereCV"!==u){var s=a[u];n+=4+3*s.indices.length+s.value.length}}return n}function F(t,r){var n=new Float64Array(D(t)),i=[],a=[],u={},s=t.length,c=0;n[c++]=s;for(var l=0;s>l;l++){var f=t[l],h=f.boundingSphere,m=o(h);n[c++]=m?1:0,m&&(e.pack(h,n,c),c+=e.packedLength),h=f.boundingSphereCV,m=o(h),n[c++]=m?1:0,m&&(e.pack(h,n,c),c+=e.packedLength);var d=[];for(var p in f)f.hasOwnProperty(p)&&o(f[p])&&"boundingSphere"!==p&&"boundingSphereCV"!==p&&(d.push(p),o(u[p])||(u[p]=i.length,i.push(p)));n[c++]=d.length;for(var v=0;v<d.length;v++){var y=d[v],g=f[y];n[c++]=u[y],n[c++]=g.valid?1:0;var E=g.indices,S=E.length;n[c++]=S;for(var C=0;S>C;C++){var w=E[C];n[c++]=w.count,n[c++]=w.offset;var b=a.indexOf(w.attribute);-1===b&&(b=a.length,a.push(w.attribute)),n[c++]=b}n[c++]=g.value.length,n.set(g.value,c),c+=g.value.length}}return r.push(n.buffer),{stringTable:i,packedData:n,attributeTable:a}}function _(t){for(var n=t.stringTable,o=t.attributeTable,i=t.packedData,a=new Array(i[0]),u=0,s=1,c=i.length;c>s;){var l={},f=1===i[s++];f&&(l.boundingSphere=e.unpack(i,s),s+=e.packedLength),f=1===i[s++],f&&(l.boundingSphereCV=e.unpack(i,s),s+=e.packedLength);for(var h=i[s++],m=0;h>m;m++){for(var d=n[i[s++]],p=1===i[s++],v=i[s++],y=v>0?new Array(v):void 0,g=0;v>g;g++){var E={};E.count=i[s++],E.offset=i[s++],E.attribute=o[i[s++]],y[g]=E}for(var S=i[s++],C=p?r.createTypedArray(y[0].attribute.componentDatatype,S):new Array(S),w=0;S>w;w++)C[w]=i[s++];l[d]={dirty:!1,valid:p,indices:y,value:C}}a[u++]=l}return a}if(!u.supportsTypedArrays())return{};var B={};return B.combineGeometry=function(e){var t,r,n,i,a,u=e.instances,s=e.invalidInstances;if(u.length>0){t=w(e),r=h.createAttributeLocations(t[0]),i=E(u),n=[],a=t.length;for(var c=0;a>c;++c){var l=t[c];n.push(b(l,r,i))}}i=o(i)?i:E(s);var f=A(u,s,n,r,i);return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:r,vaAttributes:n,vaAttributeLocations:f,validInstancesIndices:e.validInstancesIndices,invalidInstancesIndices:e.invalidInstancesIndices}},B.packCreateGeometryResults=function(t,r){var n=new Float64Array(O(t)),i=[],a={},u=t.length,s=0;n[s++]=u;for(var c=0;u>c;c++){var l=t[c],f=o(l);if(n[s++]=f?1:0,f){n[s++]=l.primitiveType,n[s++]=l.geometryType;var h=o(l.boundingSphere)?1:0;n[s++]=h,h&&e.pack(l.boundingSphere,n,s),s+=e.packedLength;var m=o(l.boundingSphereCV)?1:0;n[s++]=m,m&&e.pack(l.boundingSphereCV,n,s),s+=e.packedLength;var d=l.attributes,p=[];for(var v in d)d.hasOwnProperty(v)&&o(d[v])&&(p.push(v),o(a[v])||(a[v]=i.length,i.push(v)));n[s++]=p.length;for(var y=0;y<p.length;y++){var g=p[y],E=d[g];n[s++]=a[g],n[s++]=E.componentDatatype,n[s++]=E.componentsPerAttribute,n[s++]=E.normalize?1:0,n[s++]=E.values.length,n.set(E.values,s),s+=E.values.length}var S=o(l.indices)?l.indices.length:0;n[s++]=S,S>0&&(n.set(l.indices,s),s+=S)}}return r.push(n.buffer),{stringTable:i,packedData:n}},B.unpackCreateGeometryResults=function(t){for(var n,o=t.stringTable,i=t.packedData,a=new Array(i[0]),u=0,s=1;s<i.length;){var h=1===i[s++];if(h){var d,p,v=i[s++],y=i[s++],g=1===i[s++];g&&(d=e.unpack(i,s)),s+=e.packedLength;var E=1===i[s++];E&&(p=e.unpack(i,s)),s+=e.packedLength;var S,C,w,b=new f,x=i[s++];for(n=0;x>n;n++){var A=o[i[s++]],T=i[s++];w=i[s++];var M=0!==i[s++];S=i[s++],C=r.createTypedArray(T,S);for(var I=0;S>I;I++)C[I]=i[s++];b[A]=new l({componentDatatype:T,componentsPerAttribute:w,normalize:M,values:C})}var O;if(S=i[s++],S>0){var R=C.length/w;for(O=m.createTypedArray(R,S),n=0;S>n;n++)O[n]=i[s++]}a[u++]=new c({primitiveType:v,geometryType:y,boundingSphere:d,indices:O,attributes:b})}else a[u++]=void 0}return a},B.packCombineGeometryParameters=function(e,t){for(var r=e.createGeometryResults,n=r.length,o=0;n>o;o++)t.push(r[o].packedData.buffer);var i;return e.allowPicking&&(i=R(e.pickIds,t)),{createGeometryResults:e.createGeometryResults,packedInstances:P(e.instances,t),packedPickIds:i,ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof s,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,allowPicking:e.allowPicking,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix}},B.unpackCombineGeometryParameters=function(e){for(var t=z(e.packedInstances),r=e.allowPicking,n=r?N(e.packedPickIds):void 0,i=e.createGeometryResults,u=i.length,c=0,l=[],f=[],h=[],m=[],v=[],y=0;u>y;y++)for(var g=B.unpackCreateGeometryResults(i[y]),E=g.length,S=0;E>S;S++){var C=g[S],w=t[c];o(C)?(w.geometry=C,l.push(w),h.push(c),r&&v.push(n[c])):(f.push(w),m.push(c)),++c}var b=a.clone(e.ellipsoid),x=e.isGeographic?new s(b):new p(b);return{instances:l,invalidInstances:f,validInstancesIndices:h,invalidInstancesIndices:m,pickIds:v,ellipsoid:b,projection:x,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,allowPicking:e.allowPicking,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:d.clone(e.modelMatrix)}},B.packCombineGeometryResults=function(e,t){return o(e.geometries)&&(M(e.geometries,t),I(e.vaAttributes,t)),{geometries:e.geometries,attributeLocations:e.attributeLocations,vaAttributes:e.vaAttributes,packedVaAttributeLocations:F(e.vaAttributeLocations,t),modelMatrix:e.modelMatrix,validInstancesIndices:e.validInstancesIndices,invalidInstancesIndices:e.invalidInstancesIndices}},B.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,vaAttributes:e.vaAttributes,perInstanceAttributeLocations:_(e.packedVaAttributeLocations,e.vaAttributes),modelMatrix:e.modelMatrix}},B}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,r,n,o){return t(e).then(r,n,o)}function t(e){var t,r;return e instanceof n?t=e:u(e)?(r=a(),e.then(function(e){r.resolve(e)},function(e){r.reject(e)},function(e){r.progress(e)}),t=r.promise):t=o(e),t}function r(t){return e(t,i)}function n(e){this.then=e}function o(e){var r=new n(function(r){try{return t(r?r(e):e)}catch(n){return i(n)}});return r}function i(e){var r=new n(function(r,n){try{return n?t(n(e)):i(e)}catch(o){return i(o)}});return r}function a(){function e(e,t,r){return h(e,t,r)}function r(e){return d(e)}function o(e){return d(i(e))}function u(e){return m(e)}var s,c,l,f,h,m,d;return c=new n(e),s={then:e,resolve:r,reject:o,progress:u,promise:c,resolver:{resolve:r,reject:o,progress:u}},l=[],f=[],h=function(e,t,r){var n,o;return n=a(),o="function"==typeof r?function(e){try{n.progress(r(e))}catch(t){n.progress(t)}}:function(e){n.progress(e)},l.push(function(r){r.then(e,t).then(n.resolve,n.reject,o)}),f.push(o),n.promise},m=function(e){return p(f,e),e},d=function(e){return e=t(e),h=e.then,d=t,m=y,p(l,e),f=l=C,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,r,n,o,i){return v(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){d(e)}var c,l,f,h,m,d,p,v,g,E;if(g=t.length>>>0,c=Math.max(0,Math.min(r,g)),f=[],l=g-c+1,h=[],m=a(),c)for(v=m.progress,p=function(e){h.push(e),--l||(d=p=y,m.reject(h))},d=function(e){f.push(e),--c||(d=p=y,m.resolve(f))},E=0;g>E;++E)E in t&&e(t[E],s,u,v);else m.resolve(f);return m.then(n,o,i)})}function c(e,t,r,n){function o(e){return t?t(e[0]):e[0]}return s(e,1,o,r,n)}function l(e,t,r,n){return v(1,arguments),h(e,g).then(t,r,n)}function f(){return h(arguments,g)}function h(t,r){return e(t,function(t){var n,o,i,u,s,c;if(i=o=t.length>>>0,n=[],c=a(),i)for(u=function(t,o){e(t,r).then(function(e){n[o]=e,--i||c.resolve(n)},c.reject)},s=0;o>s;s++)s in t?u(t[s],s):--i;else c.resolve(n);return c.promise})}function m(t,r){var n=S.call(arguments,1);return e(t,function(t){var o;return o=t.length,n[0]=function(t,n,i){return e(t,function(t){return e(n,function(e){return r(t,e,i,o)})})},E.apply(t,n)})}function d(t,r,n){var o=arguments.length>2;return e(t,function(e){return e=o?n:e,r.resolve(e),e},function(e){return r.reject(e),i(e)},r.progress)}function p(e,t){for(var r,n=0;r=e[n++];)r(t)}function v(e,t){for(var r,n=t.length;n>e;)if(r=t[--n],null!=r&&"function"!=typeof r)throw new Error("arg "+n+" must be a function")}function y(){}function g(e){return e}var E,S,C;return e.defer=a,e.resolve=t,e.reject=r,e.join=f,e.all=l,e.map=h,e.reduce=m,e.any=c,e.some=s,e.chain=d,e.isPromise=u,n.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(C,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(C,t)})})}},S=[].slice,E=[].reduce||function(e){var t,r,n,o,i;if(i=0,t=Object(this),o=t.length>>>0,r=arguments,r.length<=1)for(;;){if(i in t){n=t[i++];break}if(++i>=o)throw new TypeError}else n=r[1];for(;o>i;++i)i in t&&(n=e(n,t[i],i,t));return n},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/formatError",["./defined"],function(e){"use strict";var t=function(t){var r,n=t.name,o=t.message;r=e(n)&&e(o)?n+": "+o:t.toString();var i=t.stack;return e(i)&&(r+="\n"+i),r};return t}),define("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,t,r){"use strict";var n=function(n){var o,i=[],a={id:void 0,result:void 0,error:void 0};return function(u){var s=u.data;i.length=0,a.id=s.id,a.error=void 0,a.result=void 0;try{a.result=n(s.parameters,i)}catch(c){a.error=c instanceof Error?{name:c.name,message:c.message,stack:c.stack}:c}t(o)||(o=e(self.webkitPostMessage,self.postMessage)),s.canTransferArrayBuffer||(i.length=0);try{o(a,i)}catch(c){a.result=void 0,a.error="postMessage failed with error: "+r(c)+"\n with responseMessage: "+JSON.stringify(a),o(a)}}};return n}),define("Workers/createGeometry",["../Core/defined","../Scene/PrimitivePipeline","../ThirdParty/when","./createTaskProcessorWorker","require"],function(e,t,r,n,o){"use strict";function i(t){var r=u[t];return e(r)||("object"==typeof exports?u[r]=r=o("Workers/"+t):o(["./"+t],function(e){r=e,u[r]=e})),r}function a(r,n){for(var o=r.subTasks,a=o.length,u=new Array(a),s=0;a>s;s++){var c=o[s],l=c.geometry,f=c.moduleName;if(e(f)){var h=i(f);u[s]=h(l,c.offset)}else u[s]=l}return t.packCreateGeometryResults(u,n)}var u={};return n(a)})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createPolygonGeometry.js b/libs/Cesium/Workers/createPolygonGeometry.js deleted file mode 100644 index a0ad5f05..00000000 --- a/libs/Cesium/Workers/createPolygonGeometry.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(e){return e>0?1:0>e?-1:0},r.signNotZero=function(e){return 0>e?-1:1},r.toSNorm=function(e){return Math.round(255*(.5*r.clamp(e,-1,1)+.5))},r.fromSNorm=function(e){return 2*(r.clamp(e,0,255)/255)-1},r.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},r.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},r.lerp=function(e,t,r){return(1-r)*e+r*t},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(e){return e*r.RADIANS_PER_DEGREE},r.toDegrees=function(e){return e*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(e){var t=r.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},r.negativePiToPi=function(e){return r.zeroToTwoPi(e+r.PI)-r.PI},r.zeroToTwoPi=function(e){var t=r.mod(e,r.TWO_PI);return Math.abs(t)<r.EPSILON14&&Math.abs(e)>r.EPSILON14?r.TWO_PI:t},r.mod=function(e,t){return(e%t+t)%t},r.equalsEpsilon=function(e,r,n,i){i=t(i,n);var a=Math.abs(e-r);return i>=a||a<=n*Math.max(Math.abs(e),Math.abs(r))};var n=[1];r.factorial=function(e){var t=n.length;if(e>=t)for(var r=n[t-1],i=t;e>=i;i++)n.push(r*i);return n[e]},r.incrementWrap=function(e,r,n){return n=t(n,0),++e,e>r&&(e=n),e},r.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},r.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},r.clamp=function(e,t,r){return t>e?t:e>r?r:e};var i=new e;return r.setRandomNumberSeed=function(t){i=new e(t)},r.nextRandomNumber=function(){return i.random()},r.acosClamped=function(e){return Math.acos(r.clamp(e,-1,1))},r.asinClamped=function(e){return Math.asin(r.clamp(e,-1,1))},r.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},r}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i){"use strict";var a=function(t,r,n){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0)};a.fromSpherical=function(r,n){t(n)||(n=new a);var i=r.clock,o=r.cone,u=e(r.magnitude,1),s=u*Math.sin(o);return n.x=s*Math.cos(i),n.y=s*Math.sin(i),n.z=u*Math.cos(o),n},a.fromElements=function(e,r,n,i){return t(i)?(i.x=e,i.y=r,i.z=n,i):new a(e,r,n)},a.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n]=t.z},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.x=r[n++],i.y=r[n++],i.z=r[n],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r},a.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var r=a.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},a.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r},a.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r},a.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r},a.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r},a.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new a;a.lerp=function(e,t,r,n){return a.multiplyByScalar(t,r,u),n=a.multiplyByScalar(e,1-r,n),a.add(u,n,n)};var s=new a,c=new a;a.angleBetween=function(e,t){a.normalize(e,s),a.normalize(t,c);var r=a.dot(s,c),n=a.magnitude(a.cross(s,c,s));return Math.atan2(n,r)};var l=new a;a.mostOrthogonalAxis=function(e,t){var r=a.normalize(e,l);return a.abs(r,r),t=r.x<=r.y?r.x<=r.z?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Z,t):r.y<=r.z?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_Z,t)},a.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z},a.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},a.equalsEpsilon=function(e,r,n,a){return e===r||t(e)&&t(r)&&i.equalsEpsilon(e.x,r.x,n,a)&&i.equalsEpsilon(e.y,r.y,n,a)&&i.equalsEpsilon(e.z,r.z,n,a)},a.cross=function(e,t,r){var n=e.x,i=e.y,a=e.z,o=t.x,u=t.y,s=t.z,c=i*s-a*u,l=a*o-n*s,f=n*u-i*o;return r.x=c,r.y=l,r.z=f,r},a.fromDegrees=function(e,t,r,n,o){var u=i.toRadians(e),s=i.toRadians(t);return a.fromRadians(u,s,r,n,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(r,n,i,o,u){i=e(i,0);var s=t(o)?o.radiiSquared:d,c=Math.cos(n);f.x=c*Math.cos(r),f.y=c*Math.sin(r),f.z=Math.sin(n),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),t(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o++)n[o]=i.toRadians(e[o]);return a.fromRadiansArray(n,t,r)},a.fromRadiansArray=function(e,r,n){var i=e.length;t(n)?n.length=i/2:n=new Array(i/2);for(var o=0;i>o;o+=2){var u=e[o],s=e[o+1];n[o/2]=a.fromRadians(u,s,0,r,n[o/2])}return n},a.fromDegreesArrayHeights=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o+=3)n[o]=i.toRadians(e[o]),n[o+1]=i.toRadians(e[o+1]),n[o+2]=e[o+2];return a.fromRadiansArrayHeights(n,t,r)},a.fromRadiansArrayHeights=function(e,r,n){var i=e.length;t(n)?n.length=i/3:n=new Array(i/3);for(var o=0;i>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];n[o/3]=a.fromRadians(u,s,c,r,n[o/3])}return n},a.ZERO=n(new a(0,0,0)),a.UNIT_X=n(new a(1,0,0)),a.UNIT_Y=n(new a(0,1,0)),a.UNIT_Z=n(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,r){return a.equalsEpsilon(this,e,t,r)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i){"use strict";var a=function(t,r,n){this.longitude=e(t,0),this.latitude=e(r,0),this.height=e(n,0)};return a.fromRadians=function(r,n,i,o){return i=e(i,0),t(o)?(o.longitude=r,o.latitude=n,o.height=i,o):new a(r,n,i)},a.fromDegrees=function(e,t,r,n){return e=i.toRadians(e),t=i.toRadians(t),a.fromRadians(e,t,r,n)},a.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new a(e.longitude,e.latitude,e.height):void 0},a.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},a.equalsEpsilon=function(e,r,n){return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=n&&Math.abs(e.latitude-r.latitude)<=n&&Math.abs(e.height-r.height)<=n},a.ZERO=n(new a(0,0,0)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t){return a.equalsEpsilon(this,e,t)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i,a,o,u){"use strict";function s(t,n,i,a){n=r(n,0),i=r(i,0),a=r(a,0),t._radii=new e(n,i,a),t._radiiSquared=new e(n*n,i*i,a*a),t._radiiToTheFourth=new e(n*n*n*n,i*i*i*i,a*a*a*a),t._oneOverRadii=new e(0===n?0:1/n,0===i?0:1/i,0===a?0:1/a),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===i?0:1/(i*i),0===a?0:1/(a*a)),t._minimumRadius=Math.min(n,i,a),t._maximumRadius=Math.max(n,i,a),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,r)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,r){if(!n(t))return void 0;var i=t._radii;return n(r)?(e.clone(i,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new c(i.x,i.y,i.z)},c.fromCartesian3=function(e,t){return n(t)||(t=new c),n(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,n,i){i=r(i,0),e.pack(t._radii,n,i)},c.unpack=function(t,n,i){n=r(n,0);var a=e.unpack(t,n);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,r){var i=t.longitude,a=t.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return n(r)||(r=new e),r.x=u,r.y=s,r.z=c,e.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(t,r){return n(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,r){var i=l,a=f;this.geodeticSurfaceNormalCartographic(t,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,t.height,i),n(r)||(r=new e),e.add(a,i,r)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var i=0;r>i;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var h=new e,d=new e,p=new e;c.prototype.cartesianToCartographic=function(r,i){var a=this.scaleToGeodeticSurface(r,d);if(!n(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=e.subtract(r,a,p),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,r))*e.magnitude(s);return n(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var i=0;r>i;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};var m=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,r){var i=t.x,a=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,p=o*o*f*f,v=h+d+p,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,m);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,r):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,O=x.z,T=y;T.x=2*w.x*E,T.y=2*w.y*S,T.z=2*w.z*O;var _,M,P,b,N,A,I,R,z,C,D,L=(1-g)*e.magnitude(t)/(.5*e.magnitude(T)),q=0;do{L-=q,P=1/(1+L*E),b=1/(1+L*S),N=1/(1+L*O),A=P*P,I=b*b,R=N*N,z=A*P,C=I*b,D=R*N,_=h*A+d*I+p*R-1,M=h*z*E+d*C*S+p*D*O;var U=-2*M;q=_/U}while(Math.abs(_)>u.EPSILON12);return n(r)?(r.x=i*P,r.y=a*b,r.z=o*N,r):new e(i*P,a*b,o*N)},c.prototype.scaleToGeocentricSurface=function(t,r){n(r)||(r=new e);var i=t.x,a=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return e.multiplyByScalar(t,s,r)},c.prototype.transformPositionToScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},c.prototype.equals=function(t){return this===t||n(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i){"use strict";var a=function(t,r){this.x=e(t,0),this.y=e(r,0)};a.fromElements=function(e,r,n){return t(n)?(n.x=e,n.y=r,n):new a(e,r)},a.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r):new a(e.x,e.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n]=t.y},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.x=r[n++],i.y=r[n],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y)},a.minimumComponent=function(e){return Math.min(e.x,e.y)},a.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r},a.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var r=a.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y},a.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r},a.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r},a.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r},a.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r},a.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new a;a.lerp=function(e,t,r,n){return a.multiplyByScalar(t,r,u),n=a.multiplyByScalar(e,1-r,n),a.add(u,n,n)};var s=new a,c=new a;a.angleBetween=function(e,t){return a.normalize(e,s),a.normalize(t,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(e,t){var r=a.normalize(e,l);return a.abs(r,r),t=r.x<=r.y?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Y,t)},a.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y},a.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},a.equalsEpsilon=function(e,r,n,a){return e===r||t(e)&&t(r)&&i.equalsEpsilon(e.x,r.x,n,a)&&i.equalsEpsilon(e.y,r.y,n,a)},a.ZERO=n(new a(0,0)),a.UNIT_X=n(new a(1,0)),a.UNIT_Y=n(new a(0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,r){return a.equalsEpsilon(this,e,t,r)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,i,a,o){"use strict";var u=function(e){this._ellipsoid=r(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,r){var i=this._semimajorAxis,a=t.longitude*i,o=t.latitude*i,u=t.height;return n(r)?(r.x=a,r.y=o,r.z=u,r):new e(a,o,u)},u.prototype.unproject=function(e,r){var i=this._oneOverSemimajorAxis,a=e.x*i,o=e.y*i,u=e.z;return n(r)?(r.longitude=a,r.latitude=o,r.height=u,r):new t(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,i,a,o,u){"use strict";var s=function(e,r,n,i){this.west=t(e,0),this.south=t(r,0),this.east=t(n,0),this.north=t(i,0)};n(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},s.unpack=function(e,n,i){return n=t(n,0),r(i)||(i=new s),i.west=e[n++],i.south=e[n++],i.east=e[n++],i.north=e[n],i},s.computeWidth=function(e){var t=e.east,r=e.west;return r>t&&(t+=u.TWO_PI),t-r},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,n,i,a,o){return e=u.toRadians(t(e,0)),n=u.toRadians(t(n,0)),i=u.toRadians(t(i,0)),a=u.toRadians(t(a,0)),r(o)?(o.west=e,o.south=n,o.east=i,o.north=a,o):new s(e,n,i,a)},s.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];n=Math.min(n,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return r(t)?(t.west=n,t.south=a,t.east=i,t.north=o,t):new s(n,a,i,o)},s.clone=function(e,t){return r(e)?r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},s.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},s.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},s.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},s.center=function(t,n){var i=t.east,a=t.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(t.south+t.north);return r(n)?(n.longitude=o,n.latitude=s,n.height=0,n):new e(o,s)},s.intersection=function(e,t,n){var i=e.east,a=e.west,o=t.east,c=t.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var h=Math.max(e.south,t.south),d=Math.min(e.north,t.north);return h>=d?void 0:r(n)?(n.west=l,n.south=h,n.east=f,n.north=d,n):new s(l,h,f,d)},s.contains=function(e,t){var r=t.longitude,n=t.latitude,i=e.west,a=e.east;return i>a&&(a+=u.TWO_PI,0>r&&(r+=u.TWO_PI)),(r>i||u.equalsEpsilon(r,i,u.EPSILON14))&&(a>r||u.equalsEpsilon(r,a,u.EPSILON14))&&n>=e.south&&n<=e.north};var c=new e;return s.subsample=function(e,n,i,o){n=t(n,a.WGS84),i=t(i,0),r(o)||(o=[]);var l=0,f=e.north,h=e.south,d=e.east,p=e.west,m=c;m.height=i,m.longitude=p,m.latitude=f,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.longitude=d,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.latitude=h,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.longitude=p,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.latitude=0>f?f:h>0?h:0;for(var y=1;8>y;++y)m.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,m)&&(o[l]=n.cartographicToCartesian(m,o[l]),l++);return 0===m.latitude&&(m.longitude=p,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.longitude=d,o[l]=n.cartographicToCartesian(m,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingRectangle",["./Cartesian2","./Cartographic","./defaultValue","./defined","./DeveloperError","./GeographicProjection","./Intersect","./Rectangle"],function(e,t,r,n,i,a,o,u){"use strict";var s=function(e,t,n,i){this.x=r(e,0),this.y=r(t,0),this.width=r(n,0),this.height=r(i,0)};s.fromPoints=function(e,t){if(n(t)||(t=new s),!n(e)||0===e.length)return t.x=0,t.y=0,t.width=0,t.height=0,t;for(var r=e.length,i=e[0].x,a=e[0].y,o=e[0].x,u=e[0].y,c=1;r>c;c++){var l=e[c],f=l.x,h=l.y;i=Math.min(f,i),o=Math.max(f,o),a=Math.min(h,a),u=Math.max(h,u)}return t.x=i,t.y=a,t.width=o-i,t.height=u-a,t};var c=new a,l=new t,f=new t;return s.fromRectangle=function(t,i,a){if(n(a)||(a=new s),!n(t))return a.x=0,a.y=0,a.width=0,a.height=0,a;i=r(i,c);var o=i.project(u.southwest(t,l)),h=i.project(u.northeast(t,f));return e.subtract(h,o,h),a.x=o.x,a.y=o.y,a.width=h.x,a.height=h.y,a},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new s(e.x,e.y,e.width,e.height):void 0},s.union=function(e,t,r){n(r)||(r=new s);var i=Math.min(e.x,t.x),a=Math.min(e.y,t.y),o=Math.max(e.x+e.width,t.x+t.width),u=Math.max(e.y+e.height,t.y+t.height);return r.x=i,r.y=a,r.width=o-i,r.height=u-a,r},s.expand=function(e,t,r){r=s.clone(e,r);var n=t.x-r.x,i=t.y-r.y;return n>r.width?r.width=n:0>n&&(r.width-=n,r.x=t.x),i>r.height?r.height=i:0>i&&(r.height-=i,r.y=t.y),r},s.intersect=function(e,t){var r=e.x,n=e.y,i=t.x,a=t.y;return r>i+t.width||r+e.width<i||n+e.height<a||n>a+t.height?o.OUTSIDE:o.INTERSECTING},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.intersect=function(e){return s.intersect(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},r=function(r,n){e(t[r])||(t[r]=!0,console.log(n))};return r}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,r){this.start=e(t,0),this.stop=e(r,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i){"use strict";var a=function(t,r,n,i){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0),this.w=e(i,0)};a.fromElements=function(e,r,n,i,o){return t(o)?(o.x=e,o.y=r,o.z=n,o.w=i,o):new a(e,r,n,i)},a.fromColor=function(e,r){return t(r)?(r.x=e.red,r.y=e.green,r.z=e.blue,r.w=e.alpha,r):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n++]=t.z,r[n]=t.w},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.x=r[n++],i.y=r[n++],i.z=r[n++],i.w=r[n],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r.w=Math.min(e.w,t.w),r},a.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r.w=Math.max(e.w,t.w),r},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var r=a.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t.w=e.w/r,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},a.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w,r},a.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},a.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},a.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},a.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new a;a.lerp=function(e,t,r,n){return a.multiplyByScalar(t,r,u),n=a.multiplyByScalar(e,1-r,n),a.add(u,n,n)};var s=new a;return a.mostOrthogonalAxis=function(e,t){var r=a.normalize(e,s);return a.abs(r,r),t=r.x<=r.y?r.x<=r.z?r.x<=r.w?a.clone(a.UNIT_X,t):a.clone(a.UNIT_W,t):r.z<=r.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t):r.y<=r.z?r.y<=r.w?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_W,t):r.z<=r.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t)},a.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},a.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},a.equalsEpsilon=function(e,r,n,a){return e===r||t(e)&&t(r)&&i.equalsEpsilon(e.x,r.x,n,a)&&i.equalsEpsilon(e.y,r.y,n,a)&&i.equalsEpsilon(e.z,r.z,n,a)&&i.equalsEpsilon(e.w,r.w,n,a)},a.ZERO=n(new a(0,0,0,0)),a.UNIT_X=n(new a(1,0,0,0)),a.UNIT_Y=n(new a(0,1,0,0)),a.UNIT_Z=n(new a(0,0,1,0)),a.UNIT_W=n(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,r){return a.equalsEpsilon(this,e,t,r)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i,a){"use strict";function o(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function u(e){for(var t=0,r=0;3>r;++r){var n=e[c.getElementIndex(d[r],h[r])];t+=2*n*n}return Math.sqrt(t)}function s(e,t){for(var r=a.EPSILON15,n=0,i=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(d[o],h[o])]);u>n&&(i=o,n=u)}var s=1,l=0,f=h[i],p=d[i];if(Math.abs(e[c.getElementIndex(p,f)])>r){var m,y=e[c.getElementIndex(p,p)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(p,f)],w=(y-v)/2/g;m=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+m*m),l=m*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(p,p)]=s,t[c.getElementIndex(p,f)]=l,t[c.getElementIndex(f,p)]=-l,t}var c=function(e,r,n,i,a,o,u,s,c){this[0]=t(e,0),this[1]=t(i,0),this[2]=t(u,0),this[3]=t(r,0),this[4]=t(a,0),this[5]=t(s,0),this[6]=t(n,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3],r[n++]=e[4],r[n++]=e[5],r[n++]=e[6],r[n++]=e[7],r[n++]=e[8]},c.unpack=function(e,n,i){return n=t(n,0),r(i)||(i=new c),i[0]=e[n++],i[1]=e[n++],i[2]=e[n++],i[3]=e[n++],i[4]=e[n++],i[5]=e[n++],i[6]=e[n++],i[7]=e[n++],i[8]=e[n++],i},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,n,i){return n=t(n,0),r(i)||(i=new c),i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],i[4]=e[n+4],i[5]=e[n+5],i[6]=e[n+6],i[7]=e[n+7],i[8]=e[n+8],i},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var n=e.x*e.x,i=e.x*e.y,a=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,h=e.z*e.w,d=e.w*e.w,p=n-u-f+d,m=2*(i-h),y=2*(a+l),v=2*(i+h),g=-n+u-f+d,w=2*(s-o),x=2*(a-l),E=2*(s+o),S=-n-u+f+d;return r(t)?(t[0]=p,t[1]=v,t[2]=x,t[3]=m,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(p,m,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var n=Math.cos(e),i=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new c(1,0,0,0,n,-i,0,i,n)},c.fromRotationY=function(e,t){var n=Math.cos(e),i=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new c(n,0,i,0,1,0,-i,0,n)},c.fromRotationZ=function(e,t){var n=Math.cos(e),i=Math.sin(e);return r(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(n,-i,0,i,n,0,0,0,1)},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,r){var n=3*t,i=e[n],a=e[n+1],o=e[n+2];return r.x=i,r.y=a,r.z=o,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var i=3*t;return n[i]=r.x,n[i+1]=r.y,n[i+2]=r.z,n},c.getRow=function(e,t,r){var n=e[t],i=e[t+3],a=e[t+6]; -return r.x=n,r.y=i,r.z=a,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+3]=r.y,n[t+6]=r.z,n};var l=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),r.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),r.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),r};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,r){var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},c.multiplyByVector=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=e[0]*n+e[3]*i+e[6]*a,u=e[1]*n+e[4]*i+e[7]*a,s=e[2]*n+e[5]*i+e[8]*a;return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},c.multiplyByScale=function(e,t,r){return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.x,r[3]=e[3]*t.y,r[4]=e[4]*t.y,r[5]=e[5]*t.y,r[6]=e[6]*t.z,r[7]=e[7]*t.z,r[8]=e[8]*t.z,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var r=e[0],n=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var h=[1,0,0],d=[2,2,1],p=new c,m=new c;return c.computeEigenDecomposition=function(e,t){var n=a.EPSILON20,i=10,l=0,f=0;r(t)||(t={});for(var h=t.unitary=c.clone(c.IDENTITY,t.unitary),d=t.diagonal=c.clone(e,t.diagonal),y=n*o(d);i>f&&u(d)>y;)s(d,p),c.transpose(p,m),c.multiply(d,p,d),c.multiply(m,d,d),c.multiply(h,p,h),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],r=e[3],n=e[6],i=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+i*(s*n-r*c)+u*(r*o-a*n)},c.inverse=function(e,t){var r=e[0],i=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],h=e[7],d=e[8],p=c.determinant(e);if(Math.abs(p)<=a.EPSILON15)throw new n("matrix is not invertible");t[0]=s*d-h*l,t[1]=h*o-i*d,t[2]=i*l-s*o,t[3]=f*l-u*d,t[4]=r*d-f*o,t[5]=u*o-r*l,t[6]=u*h-f*s,t[7]=f*i-r*h,t[8]=r*s-u*i;var m=1/p;return c.multiplyByScalar(t,m,t)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,i,a,o,u,s){"use strict";var c=function(e,t,n,i,a,o,u,s,c,l,f,h,d,p,m,y){this[0]=r(e,0),this[1]=r(a,0),this[2]=r(c,0),this[3]=r(d,0),this[4]=r(t,0),this[5]=r(o,0),this[6]=r(l,0),this[7]=r(p,0),this[8]=r(n,0),this[9]=r(u,0),this[10]=r(f,0),this[11]=r(m,0),this[12]=r(i,0),this[13]=r(s,0),this[14]=r(h,0),this[15]=r(y,0)};c.packedLength=16,c.pack=function(e,t,n){n=r(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15]},c.unpack=function(e,t,i){return t=r(t,0),n(i)||(i=new c),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,i,a){return i=r(i,e.ZERO),n(a)?(a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=0,a[4]=t[3],a[5]=t[4],a[6]=t[5],a[7]=0,a[8]=t[6],a[9]=t[7],a[10]=t[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(t[0],t[3],t[6],i.x,t[1],t[4],t[7],i.y,t[2],t[5],t[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,r,i){n(i)||(i=new c);var a=r.x,o=r.y,u=r.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,h=t.x*t.w,d=t.y*t.y,p=t.y*t.z,m=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-d-y+g,x=2*(l-v),E=2*(f+m),S=2*(l+v),O=-s+d-y+g,T=2*(p-h),_=2*(f-m),M=2*(p+h),P=-s-d+y+g;return i[0]=w*a,i[1]=S*a,i[2]=_*a,i[3]=0,i[4]=x*o,i[5]=O*o,i[6]=M*o,i[7]=0,i[8]=E*u,i[9]=T*u,i[10]=P*u,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,h=new e;c.fromCamera=function(t,r){var i=t.eye,a=t.target,o=t.up;e.normalize(e.subtract(a,i,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,p=l.x,m=l.y,y=l.z,v=h.x,g=h.y,w=h.z,x=i.x,E=i.y,S=i.z,O=u*-x+s*-E+d*-S,T=v*-x+g*-E+w*-S,_=p*x+m*E+y*S;return n(r)?(r[0]=u,r[1]=v,r[2]=-p,r[3]=0,r[4]=s,r[5]=g,r[6]=-m,r[7]=0,r[8]=d,r[9]=w,r[10]=-y,r[11]=0,r[12]=O,r[13]=T,r[14]=_,r[15]=1,r):new c(u,s,d,O,v,g,w,T,-p,-m,-y,_,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,r,n,i){var a=Math.tan(.5*e),o=1/a,u=o/t,s=(n+r)/(r-n),c=2*n*r/(r-n);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(e,t,r,n,i,a,o){var u=1/(t-e),s=1/(n-r),c=1/(a-i),l=-(t+e)*u,f=-(n+r)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o},c.computePerspectiveOffCenter=function(e,t,r,n,i,a,o){var u=2*i/(t-e),s=2*i/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,r,n,i,a){var o=2*i/(t-e),u=2*i/(n-r),s=(t+e)/(t-e),c=(n+r)/(n-r),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(e,t,n,i){e=r(e,r.EMPTY_OBJECT);var a=r(e.x,0),o=r(e.y,0),u=r(e.width,0),s=r(e.height,0);t=r(t,0),n=r(n,1);var c=.5*u,l=.5*s,f=.5*(n-t),h=c,d=l,p=f,m=a+c,y=o+l,v=t+f,g=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=p,i[11]=0,i[12]=m,i[13]=y,i[14]=v,i[15]=g,i},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,r){var n=4*t,i=e[n],a=e[n+1],o=e[n+2],u=e[n+3];return r.x=i,r.y=a,r.z=o,r.w=u,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var i=4*t;return n[i]=r.x,n[i+1]=r.y,n[i+2]=r.z,n[i+3]=r.w,n},c.setTranslation=function(e,t,r){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=e[15],r},c.getRow=function(e,t,r){var n=e[t],i=e[t+4],a=e[t+8],o=e[t+12];return r.x=n,r.y=i,r.z=a,r.w=o,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+4]=r.y,n[t+8]=r.z,n[t+12]=r.w,n};var d=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],d)),r.y=e.magnitude(e.fromElements(t[4],t[5],t[6],d)),r.z=e.magnitude(e.fromElements(t[8],t[9],t[10],d)),r};var p=new e;c.getMaximumScale=function(t){return c.getScale(t,p),e.maximumComponent(p)},c.multiply=function(e,t,r){var n=e[0],i=e[1],a=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],h=e[9],d=e[10],p=e[11],m=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],O=t[4],T=t[5],_=t[6],M=t[7],P=t[8],b=t[9],N=t[10],A=t[11],I=t[12],R=t[13],z=t[14],C=t[15],D=n*w+u*x+f*E+m*S,L=i*w+s*x+h*E+y*S,q=a*w+c*x+d*E+v*S,U=o*w+l*x+p*E+g*S,B=n*O+u*T+f*_+m*M,F=i*O+s*T+h*_+y*M,W=a*O+c*T+d*_+v*M,G=o*O+l*T+p*_+g*M,k=n*P+u*b+f*N+m*A,V=i*P+s*b+h*N+y*A,H=a*P+c*b+d*N+v*A,Y=o*P+l*b+p*N+g*A,j=n*I+u*R+f*z+m*C,Z=i*I+s*R+h*z+y*C,X=a*I+c*R+d*z+v*C,J=o*I+l*R+p*z+g*C;return r[0]=D,r[1]=L,r[2]=q,r[3]=U,r[4]=B,r[5]=F,r[6]=W,r[7]=G,r[8]=k,r[9]=V,r[10]=H,r[11]=Y,r[12]=j,r[13]=Z,r[14]=X,r[15]=J,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},c.multiplyTransformation=function(e,t,r){var n=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=e[12],d=e[13],p=e[14],m=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],O=t[10],T=t[12],_=t[13],M=t[14],P=n*m+o*y+c*v,b=i*m+u*y+l*v,N=a*m+s*y+f*v,A=n*g+o*w+c*x,I=i*g+u*w+l*x,R=a*g+s*w+f*x,z=n*E+o*S+c*O,C=i*E+u*S+l*O,D=a*E+s*S+f*O,L=n*T+o*_+c*M+h,q=i*T+u*_+l*M+d,U=a*T+s*_+f*M+p;return r[0]=P,r[1]=b,r[2]=N,r[3]=0,r[4]=A,r[5]=I,r[6]=R,r[7]=0,r[8]=z,r[9]=C,r[10]=D,r[11]=0,r[12]=L,r[13]=q,r[14]=U,r[15]=1,r},c.multiplyByMatrix3=function(e,t,r){var n=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=t[0],d=t[1],p=t[2],m=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=n*h+o*d+c*p,S=i*h+u*d+l*p,O=a*h+s*d+f*p,T=n*m+o*y+c*v,_=i*m+u*y+l*v,M=a*m+s*y+f*v,P=n*g+o*w+c*x,b=i*g+u*w+l*x,N=a*g+s*w+f*x;return r[0]=E,r[1]=S,r[2]=O,r[3]=0,r[4]=T,r[5]=_,r[6]=M,r[7]=0,r[8]=P,r[9]=b,r[10]=N,r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},c.multiplyByTranslation=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=n*e[0]+i*e[4]+a*e[8]+e[12],u=n*e[1]+i*e[5]+a*e[9]+e[13],s=n*e[2]+i*e[6]+a*e[10]+e[14];return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=o,r[13]=u,r[14]=s,r[15]=e[15],r};var m=new e;c.multiplyByUniformScale=function(e,t,r){return m.x=t,m.y=t,m.z=t,c.multiplyByScale(e,m,r)},c.multiplyByScale=function(e,t,r){var n=t.x,i=t.y,a=t.z;return 1===n&&1===i&&1===a?c.clone(e,r):(r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=0,r[4]=i*e[4],r[5]=i*e[5],r[6]=i*e[6],r[7]=0,r[8]=a*e[8],r[9]=a*e[9],r[10]=a*e[10],r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=1,r)},c.multiplyByVector=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=t.w,u=e[0]*n+e[4]*i+e[8]*a+e[12]*o,s=e[1]*n+e[5]*i+e[9]*a+e[13]*o,c=e[2]*n+e[6]*i+e[10]*a+e[14]*o,l=e[3]*n+e[7]*i+e[11]*a+e[15]*o;return r.x=u,r.y=s,r.z=c,r.w=l,r},c.multiplyByPointAsVector=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=e[0]*n+e[4]*i+e[8]*a,u=e[1]*n+e[5]*i+e[9]*a,s=e[2]*n+e[6]*i+e[10]*a;return r.x=o,r.y=u,r.z=s,r},c.multiplyByPoint=function(e,t,r){var n=t.x,i=t.y,a=t.z,o=e[0]*n+e[4]*i+e[8]*a+e[12],u=e[1]*n+e[5]*i+e[9]*a+e[13],s=e[2]*n+e[6]*i+e[10]*a+e[14];return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var r=e[1],n=e[2],i=e[3],a=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=a,t[10]=e[10],t[11]=e[14],t[12]=i,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r&&Math.abs(e[9]-t[9])<=r&&Math.abs(e[10]-t[10])<=r&&Math.abs(e[11]-t[11])<=r&&Math.abs(e[12]-t[12])<=r&&Math.abs(e[13]-t[13])<=r&&Math.abs(e[14]-t[14])<=r&&Math.abs(e[15]-t[15])<=r},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,r){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=0,r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=1,r;var n=e[0],i=e[4],a=e[8],l=e[12],f=e[1],h=e[5],d=e[9],p=e[13],m=e[2],x=e[6],E=e[10],S=e[14],O=e[3],T=e[7],_=e[11],M=e[15],P=E*M,b=S*_,N=x*M,A=S*T,I=x*_,R=E*T,z=m*M,C=S*O,D=m*_,L=E*O,q=m*T,U=x*O,B=P*h+A*d+I*p-(b*h+N*d+R*p),F=b*f+z*d+L*p-(P*f+C*d+D*p),W=N*f+C*h+q*p-(A*f+z*h+U*p),G=R*f+D*h+U*d-(I*f+L*h+q*d),k=b*i+N*a+R*l-(P*i+A*a+I*l),V=P*n+C*a+D*l-(b*n+z*a+L*l),H=A*n+z*i+U*l-(N*n+C*i+q*l),Y=I*n+L*i+q*a-(R*n+D*i+U*a);P=a*p,b=l*d,N=i*p,A=l*h,I=i*d,R=a*h,z=n*p,C=l*f,D=n*d,L=a*f,q=n*h,U=i*f;var j=P*T+A*_+I*M-(b*T+N*_+R*M),Z=b*O+z*_+L*M-(P*O+C*_+D*M),X=N*O+C*T+q*M-(A*O+z*T+U*M),J=R*O+D*T+U*_-(I*O+L*T+q*_),K=N*E+R*S+b*x-(I*S+P*x+A*E),Q=D*S+P*m+C*E-(z*E+L*S+b*m),$=z*x+U*S+A*m-(q*S+N*m+C*x),et=q*E+I*m+L*x-(D*x+U*E+R*m),tt=n*B+i*F+a*W+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,r[0]=B*tt,r[1]=F*tt,r[2]=W*tt,r[3]=G*tt,r[4]=k*tt,r[5]=V*tt,r[6]=H*tt,r[7]=Y*tt,r[8]=j*tt,r[9]=Z*tt,r[10]=X*tt,r[11]=J*tt,r[12]=K*tt,r[13]=Q*tt,r[14]=$*tt,r[15]=et*tt,r},c.inverseTransformation=function(e,t){var r=e[0],n=e[1],i=e[2],a=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],h=e[13],d=e[14],p=-r*f-n*h-i*d,m=-a*f-o*h-u*d,y=-s*f-c*h-l*d;return t[0]=r,t[1]=a,t[2]=s,t[3]=0,t[4]=n,t[5]=o,t[6]=c,t[7]=0,t[8]=i,t[9]=u,t[10]=l,t[11]=0,t[12]=p,t[13]=m,t[14]=y,t[15]=1,t},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]&&e[9]===t[r+9]&&e[10]===t[r+10]&&e[11]===t[r+11]&&e[12]===t[r+12]&&e[13]===t[r+13]&&e[14]===t[r+14]&&e[15]===t[r+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var i=function(t,r){this.normal=e.clone(t),this.distance=r};i.fromPointNormal=function(r,n,a){var o=-e.dot(n,r);return t(a)?(e.clone(n,a.normal),a.distance=o,a):new i(n,o)};var a=new e;return i.fromCartesian4=function(r,n){var o=e.fromCartesian4(r,a),u=r.w;return t(n)?(e.clone(o,n.normal),n.distance=u,n):new i(o,u)},i.getPointDistance=function(t,r){return e.dot(t.normal,r)+t.distance},i.ORIGIN_XY_PLANE=n(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=n(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=n(new i(e.UNIT_Y,0)),i}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,r,n,i,a,o,u,s,c,l,f,h){"use strict";var d=function(t,n){this.center=e.clone(r(t,e.ZERO)),this.radius=r(n,0)},p=new e,m=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,O=new e,T=new e,_=new e;d.fromPoints=function(t,r){if(n(r)||(r=new d),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;for(var i=e.clone(t[0],x),a=e.clone(i,p),o=e.clone(i,m),u=e.clone(i,y),s=e.clone(i,v),c=e.clone(i,g),l=e.clone(i,w),f=t.length,h=1;f>h;h++){e.clone(t[h],i);var M=i.x,P=i.y,b=i.z;M<a.x&&e.clone(i,a),M>s.x&&e.clone(i,s),P<o.y&&e.clone(i,o),P>c.y&&e.clone(i,c),b<u.z&&e.clone(i,u),b>l.z&&e.clone(i,l)}var N=e.magnitudeSquared(e.subtract(s,a,E)),A=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),R=a,z=s,C=N;A>C&&(C=A,R=o,z=c),I>C&&(C=I,R=u,z=l);var D=S;D.x=.5*(R.x+z.x),D.y=.5*(R.y+z.y),D.z=.5*(R.z+z.z);var L=e.magnitudeSquared(e.subtract(z,D,E)),q=Math.sqrt(L),U=O;U.x=a.x,U.y=o.y,U.z=u.z;var B=T;B.x=s.x,B.y=c.y,B.z=l.z;var F=e.multiplyByScalar(e.add(U,B,E),.5,_),W=0;for(h=0;f>h;h++){e.clone(t[h],i);var G=e.magnitude(e.subtract(i,F,E));G>W&&(W=G);var k=e.magnitudeSquared(e.subtract(i,D,E));if(k>L){var V=Math.sqrt(k);q=.5*(q+V),L=q*q;var H=V-q;D.x=(q*D.x+H*i.x)/V,D.y=(q*D.y+H*i.y)/V,D.z=(q*D.z+H*i.z)/V}}return W>q?(e.clone(D,r.center),r.radius=q):(e.clone(F,r.center),r.radius=W),r};var M=new u,P=new e,b=new e,N=new t,A=new t;d.fromRectangle2D=function(e,t,r){return d.fromRectangleWithHeights2D(e,t,0,0,r)},d.fromRectangleWithHeights2D=function(t,i,a,o,u){if(n(u)||(u=new d),!n(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=r(i,M),h.southwest(t,N),N.height=a,h.northeast(t,A),A.height=o;var s=i.project(N,P),c=i.project(A,b),l=c.x-s.x,f=c.y-s.y,p=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+p*p);var m=u.center;return m.x=s.x+.5*l,m.y=s.y+.5*f,m.z=s.z+.5*p,u};var I=[];d.fromRectangle3D=function(e,t,i,a){t=r(t,o.WGS84),i=r(i,0);var u;return n(e)&&(u=h.subsample(e,t,i,I)),d.fromPoints(u,a)},d.fromVertices=function(t,i,a,o){if(n(o)||(o=new d),!n(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;i=r(i,e.ZERO),a=r(a,3);var u=x;u.x=t[0]+i.x,u.y=t[1]+i.y,u.z=t[2]+i.z;for(var s=e.clone(u,p),c=e.clone(u,m),l=e.clone(u,y),f=e.clone(u,v),h=e.clone(u,g),M=e.clone(u,w),P=t.length,b=0;P>b;b+=a){var N=t[b]+i.x,A=t[b+1]+i.y,I=t[b+2]+i.z;u.x=N,u.y=A,u.z=I,N<s.x&&e.clone(u,s),N>f.x&&e.clone(u,f),A<c.y&&e.clone(u,c),A>h.y&&e.clone(u,h),I<l.z&&e.clone(u,l),I>M.z&&e.clone(u,M)}var R=e.magnitudeSquared(e.subtract(f,s,E)),z=e.magnitudeSquared(e.subtract(h,c,E)),C=e.magnitudeSquared(e.subtract(M,l,E)),D=s,L=f,q=R;z>q&&(q=z,D=c,L=h),C>q&&(q=C,D=l,L=M);var U=S;U.x=.5*(D.x+L.x),U.y=.5*(D.y+L.y),U.z=.5*(D.z+L.z);var B=e.magnitudeSquared(e.subtract(L,U,E)),F=Math.sqrt(B),W=O;W.x=s.x,W.y=c.y,W.z=l.z;var G=T;G.x=f.x,G.y=h.y,G.z=M.z;var k=e.multiplyByScalar(e.add(W,G,E),.5,_),V=0;for(b=0;P>b;b+=a){u.x=t[b]+i.x,u.y=t[b+1]+i.y,u.z=t[b+2]+i.z;var H=e.magnitude(e.subtract(u,k,E));H>V&&(V=H);var Y=e.magnitudeSquared(e.subtract(u,U,E));if(Y>B){var j=Math.sqrt(Y);F=.5*(F+j),B=F*F;var Z=j-F;U.x=(F*U.x+Z*u.x)/j,U.y=(F*U.y+Z*u.y)/j,U.z=(F*U.z+Z*u.z)/j}}return V>F?(e.clone(U,o.center),o.radius=F):(e.clone(k,o.center),o.radius=V),o},d.fromCornerPoints=function(t,r,i){n(i)||(i=new d);var a=i.center;return e.add(t,r,a),e.multiplyByScalar(a,.5,a),i.radius=e.distance(a,r),i},d.fromEllipsoid=function(t,r){return n(r)||(r=new d),e.clone(e.ZERO,r.center),r.radius=t.maximumRadius,r};var R=new e;d.fromBoundingSpheres=function(t,r){if(n(r)||(r=new d),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var i=t.length;if(1===i)return d.clone(t[0],r);if(2===i)return d.union(t[0],t[1],r);for(var a=[],o=0;i>o;o++)a.push(t[o].center);r=d.fromPoints(a,r);var u=r.center,s=r.radius;for(o=0;i>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,R)+c.radius)}return r.radius=s,r},d.clone=function(t,r){return n(t)?n(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new d(t.center,t.radius):void 0},d.packedLength=4,d.pack=function(e,t,n){n=r(n,0);var i=e.center;t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius},d.unpack=function(e,t,i){t=r(t,0),n(i)||(i=new d);var a=i.center;return a.x=e[t++],a.y=e[t++],a.z=e[t++],i.radius=e[t],i};var z=new e,C=new e;d.union=function(t,r,i){n(i)||(i=new d);var a=t.center,o=t.radius,u=r.center,s=r.radius,c=e.subtract(u,a,z),l=e.magnitude(c);if(o>=l+s)return t.clone(i),i;if(s>=l+o)return r.clone(i),i;var f=.5*(o+l+s),h=e.multiplyByScalar(c,(-o+f)/l,C);return e.add(h,a,h),e.clone(h,i.center),i.radius=f,i};var D=new e;d.expand=function(t,r,n){n=d.clone(t,n);var i=e.magnitude(e.subtract(r,n.center,D));return i>n.radius&&(n.radius=i),n},d.intersectPlane=function(t,r){var n=t.center,i=t.radius,a=r.normal,o=e.dot(a,n)+r.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var L=new f(new e,0);d.intersect=function(e,t){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var r=f.fromCartesian4(t,L);return d.intersectPlane(e,r)},d.transform=function(e,t,r){return n(r)||(r=new d),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=l.getMaximumScale(t)*e.radius,r};var q=new e;d.distanceSquaredTo=function(t,r){var n=e.subtract(t.center,r,q);return e.magnitudeSquared(n)-t.radius*t.radius},d.transformWithoutScale=function(e,t,r){return n(r)||(r=new d),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var U=new e;d.computePlaneDistances=function(t,r,i,a){n(a)||(a=new c);var o=e.subtract(t.center,r,U),u=e.multiplyByScalar(i,e.dot(i,o),U),s=e.magnitude(u);return a.start=s-t.radius,a.stop=s+t.radius,a};for(var B=new e,F=new e,W=new e,G=new e,k=new e,V=new t,H=new Array(8),Y=0;8>Y;++Y)H[Y]=new e;var j=new u;return d.projectTo2D=function(t,n,i){n=r(n,j);var a=n.ellipsoid,o=t.center,u=t.radius,s=a.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,F);e.normalize(c,c);var l=e.cross(s,c,W);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),h=e.negate(c,G),p=H,m=p[0];e.add(s,l,m),e.add(m,c,m),m=p[1],e.add(s,l,m),e.add(m,h,m),m=p[2],e.add(s,f,m),e.add(m,h,m),m=p[3],e.add(s,f,m),e.add(m,c,m),e.negate(s,s),m=p[4],e.add(s,l,m),e.add(m,c,m),m=p[5],e.add(s,l,m),e.add(m,h,m),m=p[6],e.add(s,f,m),e.add(m,h,m),m=p[7],e.add(s,f,m),e.add(m,c,m);for(var y=p.length,v=0;y>v;++v){var g=p[v];e.add(o,g,g);var w=a.cartesianToCartographic(g,V);n.project(w,g)}i=d.fromPoints(p,i),o=i.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,i},d.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},d.prototype.intersectPlane=function(e){return d.intersectPlane(this,e)},d.prototype.intersect=function(e){return d.intersect(this,e)},d.prototype.equals=function(e){return d.equals(this,e)},d.prototype.clone=function(e){return d.clone(this,e)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return t(i,{element:{get:function(){return i.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof t[i]?(n.requestFullscreen=i,r=!0):(i=s+"RequestFullScreen","function"==typeof t[i]&&(n.requestFullscreen=i,r=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?n.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(n.exitFullscreen=i)),i=s+"FullscreenEnabled",e(document[i])?n.fullscreenEnabled=i:(i=s+"FullScreenEnabled",e(document[i])&&(n.fullscreenEnabled=i)),i=s+"FullscreenElement",e(document[i])?n.fullscreenElement=i:(i=s+"FullScreenElement",e(document[i])&&(n.fullscreenElement=i)),i=s+"fullscreenchange",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),n.fullscreenchange=i),i=s+"fullscreenerror",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),n.fullscreenerror=i)}return r},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[n.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[n.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function i(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=n(e[1]))}return y}function a(){return i()&&v}function o(){if(!t(g)&&(g=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=n(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=n(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=n(e[1])))}return S}function f(){return l()&&O}function h(){if(!t(T)){T=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(T=!0,_=n(e[1]))}return T}function d(){return t(M)||(M=/Windows/i.test(navigator.appVersion)),M}function p(){return h()&&_}function m(){return t(P)||(P=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),P}var y,v,g,w,x,E,S,O,T,_,M,P,b={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:p,isWindows:d,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:m};return b.supportsFullscreen=function(){return r.supportsFullscreen()},b.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},b.supportsWebWorkers=function(){return"undefined"!=typeof Worker},b}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,r,n,i){"use strict";if(!n.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(e){switch(e){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},a.fromTypedArray=function(e){return e instanceof Int8Array?a.BYTE:e instanceof Uint8Array?a.UNSIGNED_BYTE:e instanceof Int16Array?a.SHORT:e instanceof Uint16Array?a.UNSIGNED_SHORT:e instanceof Float32Array?a.FLOAT:e instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(e){return t(e)&&(e===a.BYTE||e===a.UNSIGNED_BYTE||e===a.SHORT||e===a.UNSIGNED_SHORT||e===a.FLOAT||e===a.DOUBLE)},a.createTypedArray=function(e,t){switch(e){case a.BYTE:return new Int8Array(t);case a.UNSIGNED_BYTE:return new Uint8Array(t);case a.SHORT:return new Int16Array(t);case a.UNSIGNED_SHORT:return new Uint16Array(t);case a.FLOAT:return new Float32Array(t);case a.DOUBLE:return new Float64Array(t);default:throw new r("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(t,n,i,o){switch(i=e(i,0),o=e(o,(n.byteLength-i)/a.getSizeInBytes(t)),t){case a.BYTE:return new Int8Array(n,i,o); -case a.UNSIGNED_BYTE:return new Uint8Array(n,i,o);case a.SHORT:return new Int16Array(n,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(n,i,o);case a.FLOAT:return new Float32Array(n,i,o);case a.DOUBLE:return new Float64Array(n,i,o);default:throw new r("componentDatatype is not a valid value.")}},i(a)}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,r,n,i,a,o){"use strict";var u=function(n,i,a){this.minimum=e.clone(t(n,e.ZERO)),this.maximum=e.clone(t(i,e.ZERO)),r(a)?a=e.clone(a):(a=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(a,.5,a)),this.center=a};u.fromPoints=function(t,n){if(r(n)||(n=new u),!r(t)||0===t.length)return n.minimum=e.clone(e.ZERO,n.minimum),n.maximum=e.clone(e.ZERO,n.maximum),n.center=e.clone(e.ZERO,n.center),n;for(var i=t[0].x,a=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,h=1;f>h;h++){var d=t[h],p=d.x,m=d.y,y=d.z;i=Math.min(p,i),s=Math.max(p,s),a=Math.min(m,a),c=Math.max(m,c),o=Math.min(y,o),l=Math.max(y,l)}var v=n.minimum;v.x=i,v.y=a,v.z=o;var g=n.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,n.center);return e.multiplyByScalar(w,.5,w),n},u.clone=function(t,n){return r(t)?r(n)?(n.minimum=e.clone(t.minimum,n.minimum),n.maximum=e.clone(t.maximum,n.maximum),n.center=e.clone(t.center,n.center),n):new u(t.minimum,t.maximum):void 0},u.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&e.equals(t.minimum,n.minimum)&&e.equals(t.maximum,n.maximum)};var s=new e;u.intersectPlane=function(t,r){s=e.subtract(t.maximum,t.minimum,s);var n=e.multiplyByScalar(s,.5,s),i=r.normal,o=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),u=e.dot(t.center,i)+r.distance;return u-o>0?a.INSIDE:0>u+o?a.OUTSIDE:a.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){n("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var r=o.fromCartesian4(t,c);return u.intersectPlane(e,r)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var i=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(r)))<n?0:i}var n={};return n.computeDiscriminant=function(e,t,r){var n=t*t-4*e*r;return n},n.computeRealRoots=function(e,n,i){var a;if(0===e)return 0===n?[]:[-i/n];if(0===n){if(0===i)return[0,0];var o=Math.abs(i),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(a=-i/e,0>a)return[];var s=Math.sqrt(a);return[-s,s]}if(0===i)return a=-n/e,0>a?[a,0]:[0,a];var c=n*n,l=4*e*i,f=r(c,-l,t.EPSILON14);if(0>f)return[];var h=-.5*r(n,t.sign(n)*Math.sqrt(f),t.EPSILON14);return n>0?[h/e,i/h]:[i/h,h/e]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var i,a,o=e,u=t/3,s=r/3,c=n,l=o*s,f=u*c,h=u*u,d=s*s,p=o*s-h,m=o*c-u*s,y=u*c-d,v=4*p*y-m*m;if(0>v){var g,w,x;h*f>=l*d?(g=o,w=p,x=-2*u*p+o*m):(g=c,w=y,x=-c*m+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);a=-x+S;var O=a/2,T=0>O?-Math.pow(-O,1/3):Math.pow(O,1/3),_=a===S?-T:-w/T;return i=0>=w?T+_:-x/(T*T+_*_+w),h*f>=l*d?[(i-u)/o]:[-c/(i+s)]}var M=p,P=-2*u*p+o*m,b=y,N=-c*m+2*s*y,A=Math.sqrt(v),I=Math.sqrt(3)/2,R=Math.abs(Math.atan2(o*A,-P)/3);i=2*Math.sqrt(-M);var z=Math.cos(R);a=i*z;var C=i*(-z/2-I*Math.sin(R)),D=a+C>2*u?a-u:C-u,L=o,q=D/L;R=Math.abs(Math.atan2(c*A,-N)/3),i=2*Math.sqrt(-b),z=Math.cos(R),a=i*z,C=i*(-z/2-I*Math.sin(R));var U=-c,B=2*s>a+C?a+s:C+s,F=U/B,W=L*B,G=-D*B-L*U,k=D*U,V=(s*G-u*k)/(-u*G+s*W);return V>=q?F>=q?F>=V?[q,V,F]:[q,F,V]:[F,q,V]:F>=q?[V,q,F]:F>=V?[V,F,q]:[F,V,q]}var n={};return n.computeDiscriminant=function(e,t,r,n){var i=e*e,a=t*t,o=r*r,u=n*n,s=18*e*t*r*n+a*o-27*i*u-4*(e*o*r+a*t*n);return s},n.computeRealRoots=function(e,n,i,a){var o,u;if(0===e)return t.computeRealRoots(n,i,a);if(0===n){if(0===i){if(0===a)return[0,0,0];u=-a/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===a?(o=t.computeRealRoots(e,0,i),0===o.Length?[0]:[o[0],0,o[1]]):r(e,0,i,a)}return 0===i?0===a?(u=-n/e,0>u?[u,0,0]:[0,0,u]):r(e,n,0,a):0===a?(o=t.computeRealRoots(e,n,i),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):r(e,n,i,a)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function i(t,i,a,o){var u=t*t,s=i-3*u/8,c=a-i*t/2+u*t/8,l=o-a*t/4+i*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var h=-t/4,d=f[f.length-1];if(Math.abs(d)<r.EPSILON14){var p=n.computeRealRoots(1,s,l);if(2===p.length){var m,y=p[0],v=p[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[h-w,h-g,h+g,h+w]}if(y>=0&&0>v)return m=Math.sqrt(y),[h-m,h+m];if(0>y&&v>=0)return m=Math.sqrt(v),[h-m,h+m]}return[]}if(d>0){var x=Math.sqrt(d),E=(s+d-c/x)/2,S=(s+d+c/x)/2,O=n.computeRealRoots(1,x,E),T=n.computeRealRoots(1,-x,S);return 0!==O.length?(O[0]+=h,O[1]+=h,0!==T.length?(T[0]+=h,T[1]+=h,O[1]<=T[0]?[O[0],O[1],T[0],T[1]]:T[1]<=O[0]?[T[0],T[1],O[0],O[1]]:O[0]>=T[0]&&O[1]<=T[1]?[T[0],O[0],O[1],T[1]]:T[0]>=O[0]&&T[1]<=O[1]?[O[0],T[0],T[1],O[1]]:O[0]>T[0]&&O[0]<T[1]?[T[0],O[0],T[1],O[1]]:[O[0],T[0],O[1],T[1]]):O):0!==T.length?(T[0]+=h,T[1]+=h,T):[]}}return[]}function a(t,i,a,o){var u=a*a,s=i*i,c=t*t,l=-2*i,f=a*t+s-4*o,h=c*o-a*i*t+u,d=e.computeRealRoots(1,l,f,h);if(d.length>0){var p,m,y=d[0],v=i-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),O=c-4*y,T=c+4*Math.abs(y);if(0>y||O*S>E*T){var _=Math.sqrt(O);p=_/2,m=0===_?0:(t*x-a)/_}else{var M=Math.sqrt(E);p=0===M?0:(t*x-a)/M,m=M/2}var P,b;0===w&&0===p?(P=0,b=0):r.sign(w)===r.sign(p)?(P=w+p,b=y/P):(b=w-p,P=y/b);var N,A;0===x&&0===m?(N=0,A=0):r.sign(x)===r.sign(m)?(N=x+m,A=o/N):(A=x-m,N=o/A);var I=n.computeRealRoots(1,P,N),R=n.computeRealRoots(1,b,A);if(0!==I.length)return 0!==R.length?I[1]<=R[0]?[I[0],I[1],R[0],R[1]]:R[1]<=I[0]?[R[0],R[1],I[0],I[1]]:I[0]>=R[0]&&I[1]<=R[1]?[R[0],I[0],I[1],R[1]]:R[0]>=I[0]&&R[1]<=I[1]?[I[0],R[0],R[1],I[1]]:I[0]>R[0]&&I[0]<R[1]?[R[0],I[0],R[1],I[1]]:[I[0],R[0],I[1],R[1]]:I;if(0!==R.length)return R}return[]}var o={};return o.computeDiscriminant=function(e,t,r,n,i){var a=e*e,o=a*e,u=t*t,s=u*t,c=r*r,l=c*r,f=n*n,h=f*n,d=i*i,p=d*i,m=u*c*f-4*s*h-4*e*l*f+18*e*t*r*h-27*a*f*f+256*o*p+i*(18*s*r*n-4*u*l+16*e*c*c-80*e*t*c*n-6*e*u*f+144*a*r*f)+d*(144*e*u*r-27*u*u-128*a*c-192*a*t*n);return m},o.computeRealRoots=function(t,n,o,u,s){if(Math.abs(t)<r.EPSILON15)return e.computeRealRoots(n,o,u,s);var c=n/t,l=o/t,f=u/t,h=s/t,d=0>c?1:0;switch(d+=0>l?d+1:d,d+=0>f?d+1:d,d+=0>h?d+1:d){case 0:return i(c,l,f,h);case 1:return a(c,l,f,h);case 2:return a(c,l,f,h);case 3:return i(c,l,f,h);case 4:return i(c,l,f,h);case 5:return a(c,l,f,h);case 6:return i(c,l,f,h);case 7:return i(c,l,f,h);case 8:return a(c,l,f,h);case 9:return i(c,l,f,h);case 10:return i(c,l,f,h);case 11:return a(c,l,f,h);case 12:return i(c,l,f,h);case 13:return i(c,l,f,h);case 14:return i(c,l,f,h);case 15:return i(c,l,f,h);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=function(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n};return n.getPoint=function(t,n,i){return r(i)||(i=new e),i=e.multiplyByScalar(t.direction,n,i),e.add(t.origin,i,i)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,i,a,o,u,s,c){"use strict";function l(t,n,i,o,u){u=r(u,!1);var s,c,l,f,h,d=t.origin,p=t.direction,m=e.subtract(i,n,y),E=e.subtract(o,n,v),S=e.cross(p,E,g),O=e.dot(m,S);if(u){if(O<a.EPSILON6)return void 0;if(s=e.subtract(d,n,w),l=e.dot(s,S),0>l||l>O)return void 0;if(c=e.cross(s,m,x),f=e.dot(p,c),0>f||l+f>O)return void 0;h=e.dot(E,c)/O}else{if(Math.abs(O)<a.EPSILON6)return void 0;var T=1/O;if(s=e.subtract(d,n,w),l=e.dot(s,S)*T,0>l||l>1)return void 0;if(c=e.cross(s,m,x),f=e.dot(p,c)*T,0>f||l+f>1)return void 0;h=e.dot(E,c)*T}return h}function f(e,t,r,n){var i=t*t-4*e*r;if(0>i)return void 0;if(i>0){var a=1/(2*e),o=Math.sqrt(i),u=(-t+o)*a,s=(-t-o)*a;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-t/(2*e);return 0===c?void 0:(n.root0=n.root1=c,n)}function h(t,r,i){n(i)||(i={});var a=t.origin,o=t.direction,u=r.center,s=r.radius*r.radius,c=e.subtract(a,u,g),l=e.dot(o,o),h=2*e.dot(o,c),d=e.magnitudeSquared(c)-s,p=f(l,h,d,S);return n(p)?(i.start=p.root0,i.stop=p.root1,i):void 0}function d(e,t,r){var n=e+t;return a.sign(e)!==a.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))<r?0:n}function p(t,r,n,i,c){var l,f=i*i,h=c*c,p=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*h,m=c*(i*d(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],a.EPSILON15)+r.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*h+i*r.x+n,v=h*d(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],a.EPSILON15),g=c*(i*d(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+r.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(p,m,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(i,c*x,c*-E)),w.push(new e(i,c*x,c*E)),2===l.length){var S=l[1],O=Math.sqrt(Math.max(1-S*S,0));w.push(new e(i,c*S,c*-O)),w.push(new e(i,c*S,c*O))}return w}var T=g*g,_=v*v,M=p*p,P=g*v,b=M+_,N=2*(m*p+P),A=2*y*p+m*m-_+T,I=2*(y*m-P),R=y*y-T;if(0===b&&0===N&&0===A&&0===I)return w;l=s.computeRealRoots(b,N,A,I,R);var z=l.length;if(0===z)return w;for(var C=0;z>C;++C){var D,L=l[C],q=L*L,U=Math.max(1-q,0),B=Math.sqrt(U);D=a.sign(p)===a.sign(y)?d(p*q+y,m*L,a.EPSILON12):a.sign(y)===a.sign(m*L)?d(p*q,m*L+y,a.EPSILON12):d(p*q+m*L,y,a.EPSILON12);var F=d(v*L,g,a.EPSILON15),W=D*F;0>W?w.push(new e(i,c*L,c*B)):W>0?w.push(new e(i,c*L,c*-B)):0!==B?(w.push(new e(i,c*L,c*-B)),w.push(new e(i,c*L,c*B)),++C):w.push(new e(i,c*L,c*B))}return w}var m={};m.rayPlane=function(t,r,i){n(i)||(i=new e);var o=t.origin,u=t.direction,s=r.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON15)return void 0;var l=(-r.distance-e.dot(s,o))/c;return 0>l?void 0:(i=e.multiplyByScalar(u,l,i),e.add(o,i,i))};var y=new e,v=new e,g=new e,w=new e,x=new e;m.rayTriangle=function(t,r,i,a,o,u){var s=l(t,r,i,a,o);return!n(s)||0>s?void 0:(n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;m.lineSegmentTriangle=function(t,r,i,a,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(r,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,i,a,o,u);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};m.raySphere=function(e,t,r){return r=h(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var O=new c;m.lineSegmentSphere=function(t,r,i,a){var o=O;e.clone(t,o.origin);var u=e.subtract(r,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),a=h(o,i,a),!n(a)||a.stop<0||a.start>s?void 0:(a.start=Math.max(a.start,0),a.stop=Math.min(a.stop,s),a)};var T=new e,_=new e;m.rayEllipsoid=function(t,r){var n,i,a,o,u,s=r.oneOverRadii,c=e.multiplyComponents(s,t.origin,T),l=e.multiplyComponents(s,t.direction,_),f=e.magnitudeSquared(c),h=e.dot(c,l);if(f>1){if(h>=0)return void 0;var d=h*h;if(n=f-1,i=e.magnitudeSquared(l),a=i*n,a>d)return void 0;if(d>a){o=h*h-a,u=-h+Math.sqrt(o);var p=u/i,m=n/u;return m>p?{start:p,stop:m}:{start:m,stop:p}}var y=Math.sqrt(n/i);return{start:y,stop:y}}return 1>f?(n=f-1,i=e.magnitudeSquared(l),a=i*n,o=h*h-a,u=-h+Math.sqrt(o),{start:0,stop:u/i}):0>h?(i=e.magnitudeSquared(l),{start:0,stop:-h/i}):void 0};var M=new e,P=new e,b=new e,N=new e,A=new e,I=new o,R=new o,z=new o,C=new o,D=new o,L=new o,q=new o,U=new e,B=new e,F=new t;m.grazingAltitudeLocation=function(t,r){var i=t.origin,u=t.direction,s=r.geodeticSurfaceNormal(i,M);if(e.dot(u,s)>=0)return i;var c=n(this.rayEllipsoid(t,r)),l=r.transformPositionToScaledSpace(u,M),f=e.normalize(l,l),h=e.mostOrthogonalAxis(l,N),d=e.normalize(e.cross(h,f,P),P),m=e.normalize(e.cross(f,d,b),b),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=d.x,y[4]=d.y,y[5]=d.z,y[6]=m.x,y[7]=m.y,y[8]=m.z;var v=o.transpose(y,R),g=o.fromScale(r.radii,z),w=o.fromScale(r.oneOverRadii,C),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,O=o.multiply(o.multiply(v,w,L),x,L),T=o.multiply(o.multiply(O,g,q),y,q),_=o.multiplyByVector(O,i,A),W=p(T,e.negate(_,M),0,0,1),G=W.length;if(G>0){for(var k=e.clone(e.ZERO,B),V=Number.NEGATIVE_INFINITY,H=0;G>H;++H){E=o.multiplyByVector(g,o.multiplyByVector(y,W[H],U),U);var Y=e.normalize(e.subtract(E,i,N),N),j=e.dot(Y,u);j>V&&(V=j,k=e.clone(E,k))}var Z=r.cartesianToCartographic(k,F);return V=a.clamp(V,0,1),S=e.magnitude(e.subtract(k,i,N))*Math.sqrt(1-V*V),S=c?-S:S,Z.height=S,r.cartographicToCartesian(Z,new e)}return void 0};var W=new e;return m.lineSegmentPlane=function(t,r,i,o){n(o)||(o=new e);var u=e.subtract(r,t,W),s=i.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON6)return void 0;var l=e.dot(s,t),f=-(i.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},m.trianglePlaneIntersection=function(t,r,n,i){var a=i.normal,o=i.distance,u=e.dot(a,t)+o<0,s=e.dot(a,r)+o<0,c=e.dot(a,n)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,h;if((1===l||2===l)&&(f=new e,h=new e),1===l){if(u)return m.lineSegmentPlane(t,r,i,f),m.lineSegmentPlane(t,n,i,h),{positions:[t,r,n,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(s)return m.lineSegmentPlane(r,n,i,f),m.lineSegmentPlane(r,t,i,h),{positions:[t,r,n,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return m.lineSegmentPlane(n,t,i,f),m.lineSegmentPlane(n,r,i,h),{positions:[t,r,n,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return m.lineSegmentPlane(r,t,i,f),m.lineSegmentPlane(n,t,i,h),{positions:[t,r,n,f,h],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return m.lineSegmentPlane(n,r,i,f),m.lineSegmentPlane(t,r,i,h),{positions:[t,r,n,f,h],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return m.lineSegmentPlane(t,n,i,f),m.lineSegmentPlane(r,n,i,h),{positions:[t,r,n,f,h],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},m}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,r,n,i){return t(e).then(r,n,i)}function t(e){var t,r;return e instanceof n?t=e:u(e)?(r=o(),e.then(function(e){r.resolve(e)},function(e){r.reject(e)},function(e){r.progress(e)}),t=r.promise):t=i(e),t}function r(t){return e(t,a)}function n(e){this.then=e}function i(e){var r=new n(function(r){try{return t(r?r(e):e)}catch(n){return a(n)}});return r}function a(e){var r=new n(function(r,n){try{return n?t(n(e)):a(e)}catch(i){return a(i)}});return r}function o(){function e(e,t,r){return h(e,t,r)}function r(e){return p(e)}function i(e){return p(a(e))}function u(e){return d(e)}var s,c,l,f,h,d,p;return c=new n(e),s={then:e,resolve:r,reject:i,progress:u,promise:c,resolver:{resolve:r,reject:i,progress:u}},l=[],f=[],h=function(e,t,r){var n,i;return n=o(),i="function"==typeof r?function(e){try{n.progress(r(e))}catch(t){n.progress(t)}}:function(e){n.progress(e)},l.push(function(r){r.then(e,t).then(n.resolve,n.reject,i)}),f.push(i),n.promise},d=function(e){return m(f,e),e},p=function(e){return e=t(e),h=e.then,p=t,d=v,m(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,r,n,i,a){return y(2,arguments),e(t,function(t){function u(e){m(e)}function s(e){p(e)}var c,l,f,h,d,p,m,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(r,g)),f=[],l=g-c+1,h=[],d=o(),c)for(y=d.progress,m=function(e){h.push(e),--l||(p=m=v,d.reject(h))},p=function(e){f.push(e),--c||(p=m=v,d.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else d.resolve(f);return d.then(n,i,a)})}function c(e,t,r,n){function i(e){return t?t(e[0]):e[0]}return s(e,1,i,r,n)}function l(e,t,r,n){return y(1,arguments),h(e,g).then(t,r,n)}function f(){return h(arguments,g)}function h(t,r){return e(t,function(t){var n,i,a,u,s,c;if(a=i=t.length>>>0,n=[],c=o(),a)for(u=function(t,i){e(t,r).then(function(e){n[i]=e,--a||c.resolve(n)},c.reject)},s=0;i>s;s++)s in t?u(t[s],s):--a;else c.resolve(n);return c.promise})}function d(t,r){var n=x.call(arguments,1);return e(t,function(t){var i;return i=t.length,n[0]=function(t,n,a){return e(t,function(t){return e(n,function(e){return r(t,e,a,i)})})},w.apply(t,n)})}function p(t,r,n){var i=arguments.length>2;return e(t,function(e){return e=i?n:e,r.resolve(e),e},function(e){return r.reject(e),a(e)},r.progress)}function m(e,t){for(var r,n=0;r=e[n++];)r(t)}function y(e,t){for(var r,n=t.length;n>e;)if(r=t[--n],null!=r&&"function"!=typeof r)throw new Error("arg "+n+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=r,e.join=f,e.all=l,e.map=h,e.reduce=d,e.any=c,e.some=s,e.chain=p,e.isPromise=u,n.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,r,n,i,a;if(a=0,t=Object(this),i=t.length>>>0,r=arguments,r.length<=1)for(;;){if(a in t){n=t[a++];break}if(++a>=i)throw new TypeError}else n=r[1];for(;i>a;++a)a in t&&(n=e(n,t[a],a,t));return n},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,r){for(var n,i,a=0,o=e.length-1;o>=a;)if(n=~~((a+o)/2),i=r(e[n],t),0>i)a=n+1;else{if(!(i>0))return n;o=n-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,r,n,i){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=r,this.yPoleOffset=n,this.ut1MinusUtc=i};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,n=t[r++],i=function(e,t,r,n){r||(r=" ");var i=e.length>=t?"":Array(1+t-e.length>>>0).join(r);return n?e+i:i+e},a=function(e,t,r,n,a,o){var u=n-e.length;return u>0&&(e=r||!a?i(e,n,o,r):e.slice(0,t.length)+i("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,r,n,o,u,s){var c=e>>>0;return r=r&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+i(c.toString(t),u||0,"0",!1),a(e,r,n,o,s)},u=function(e,t,r,n,i,o){return null!=n&&(e=e.slice(0,n)),a(e,"",t,r,i,o)},s=function(e,n,s,c,l,f,h){var d,p,m,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",O=s.length,T=0;s&&O>T;T++)switch(s.charAt(T)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(T+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[r++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[r++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(h)>-1?6:"d"==h?0:void 0,v=n?t[n.slice(0,-1)]:t[r++],h){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return d=+v||0,d=Math.round(d-d%1),p=0>d?"-":w,v=p+i(String(Math.abs(d)),f,"0",!1),a(v,p,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return d=+v,p=0>d?"-":w,m=["toExponential","toFixed","toPrecision"]["efg".indexOf(h.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(h)%2],v=p+Math.abs(d)[m](f),a(v,p,g,c,x)[y]();default:return e}};return n.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,r,n,i,a,o,u){this.year=e,this.month=t,this.day=r,this.hour=n,this.minute=i,this.second=a,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,r,n,i,a,o,u,s,c){"use strict";function l(e,t){return N.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var r=N.leapSeconds,n=t(r,g,l);0>n&&(n=~n),n>=r.length&&(n=r.length-1);var i=r[n].offset;if(n>0){var a=N.secondsDifference(r[n].julianDate,e);a>i&&(n--,i=r[n].offset)}N.addSeconds(e,i,e)}function h(e,r){g.julianDate=e;var n=N.leapSeconds,i=t(n,g,l);if(0>i&&(i=~i),0===i)return N.addSeconds(e,-n[0].offset,r);if(i>=n.length)return N.addSeconds(e,-n[i-1].offset,r);var a=N.secondsDifference(n[i].julianDate,e);return 0===a?N.addSeconds(e,-n[i].offset,r):1>=a?void 0:N.addSeconds(e,-n[--i].offset,r)}function d(e,t,r){var n=0|t/s.SECONDS_PER_DAY;return e+=n,t-=s.SECONDS_PER_DAY*n,0>t&&(e--,t+=s.SECONDS_PER_DAY),r.dayNumber=e,r.secondsOfDay=t,r}function p(e,t,r,n,i,a,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+r-32075;n-=12,0>n&&(n+=24);var f=a+(n*s.SECONDS_PER_HOUR+i*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var m=new a,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,O=/^(\d{4})-?(\d{2})-?(\d{2})$/,T=/([Z+\-])?(\d{2})?:?(\d{2})?$/,_=/^(\d{2})(\.\d+)?/.source+T.source,M=/^(\d{2}):?(\d{2})(\.\d+)?/.source+T.source,P=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+T.source,b="Invalid ISO 8601 date.",N=function(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=r(e,0),t=r(t,0),n=r(n,c.UTC);var i=0|e;t+=(e-i)*s.SECONDS_PER_DAY,d(i,t,this),n===c.UTC&&f(this)};N.fromDate=function(e,t){var r=p(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return n(t)?(d(r[0],r[1],t),f(t),t):new N(r[0],r[1],c.UTC)},N.fromIso8601=function(e,t){e=e.replace(",",".");var r,a,u,s=e.split("T"),l=1,h=1,m=0,g=0,T=0,A=0,I=s[0],R=s[1];if(!n(I))throw new i(b);var z;if(s=I.match(O),null!==s){if(z=I.split("-").length-1,z>0&&2!==z)throw new i(b);r=+s[1],l=+s[2],h=+s[3]}else if(s=I.match(x),null!==s)r=+s[1],l=+s[2];else if(s=I.match(w),null!==s)r=+s[1];else{var C;if(s=I.match(E),null!==s){if(r=+s[1],C=+s[2],u=o(r),1>C||u&&C>366||!u&&C>365)throw new i(b)}else{if(s=I.match(S),null===s)throw new i(b);r=+s[1];var D=+s[2],L=+s[3]||0;if(z=I.split("-").length-1,z>0&&(!n(s[3])&&1!==z||n(s[3])&&2!==z))throw new i(b);var q=new Date(Date.UTC(r,0,4));C=7*D+L-q.getUTCDay()-3}a=new Date(Date.UTC(r,0,1)),a.setUTCDate(C),l=a.getUTCMonth()+1,h=a.getUTCDate()}if(u=o(r),1>l||l>12||1>h||(2!==l||!u)&&h>y[l-1]||u&&2===l&&h>v)throw new i(b);var U;if(n(R)){if(s=R.match(P),null!==s){if(z=R.split(":").length-1,z>0&&2!==z&&3!==z)throw new i(b);m=+s[1],g=+s[2],T=+s[3],A=1e3*+(s[4]||0),U=5}else if(s=R.match(M),null!==s){if(z=R.split(":").length-1,z>0&&1!==z)throw new i(b);m=+s[1],g=+s[2],T=60*+(s[3]||0),U=4}else{if(s=R.match(_),null===s)throw new i(b);m=+s[1],g=60*+(s[2]||0),U=3}if(g>=60||T>=61||m>24||24===m&&(g>0||T>0||A>0))throw new i(b);var B=s[U],F=+s[U+1],W=+(s[U+2]||0);switch(B){case"+":m-=F,g-=W;break;case"-":m+=F,g+=W;break;case"Z":break;default:g+=new Date(Date.UTC(r,l-1,h,m,g)).getTimezoneOffset()}}else g+=new Date(r,l-1,h).getTimezoneOffset();var G=60===T;for(G&&T--;g>=60;)g-=60,m++;for(;m>=24;)m-=24,h++;for(a=u&&2===l?v:y[l-1];h>a;)h-=a,l++,l>12&&(l-=12,r++),a=u&&2===l?v:y[l-1];for(;0>g;)g+=60,m--;for(;0>m;)m+=24,h--;for(;1>h;)l--,1>l&&(l+=12,r--),a=u&&2===l?v:y[l-1],h+=a;var k=p(r,l,h,m,g,T,A);return n(t)?(d(k[0],k[1],t),f(t)):t=new N(k[0],k[1],c.UTC),G&&N.addSeconds(t,1,t),t},N.now=function(e){return N.fromDate(new Date,e)};var A=new N(0,0,c.TAI);return N.toGregorianDate=function(e,t){var r=!1,i=h(e,A);n(i)||(N.addSeconds(e,-1,A),i=h(A,A),r=!0);var o=i.dayNumber,u=i.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var d=0|80*c/2447,p=0|c-(0|2447*d/80);c=0|d/11;var m=0|d+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),r&&(x+=1),n(t)?(t.year=y,t.month=m,t.day=p,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=r,t):new a(y,m,p,v,w,x,E,r)},N.toDate=function(e){var t=N.toGregorianDate(e,m),r=t.second;return t.isLeapSecond&&(r-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,r,t.millisecond))},N.toIso8601=function(t,r){var i,a=N.toGregorianDate(t,a);return n(r)||0===a.millisecond?n(r)&&0!==r?(i=(.01*a.millisecond).toFixed(r).replace(".","").slice(0,r),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",a.year,a.month,a.day,a.hour,a.minute,a.second,i)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",a.year,a.month,a.day,a.hour,a.minute,a.second):(i=(.01*a.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",a.year,a.month,a.day,a.hour,a.minute,a.second,i))},N.clone=function(e,t){return n(e)?n(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new N(e.dayNumber,e.secondsOfDay,c.TAI):void 0},N.compare=function(e,t){var r=e.dayNumber-t.dayNumber;return 0!==r?r:e.secondsOfDay-t.secondsOfDay},N.equals=function(e,t){return e===t||n(e)&&n(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},N.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(N.secondsDifference(e,t))<=r},N.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},N.secondsDifference=function(e,t){var r=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return r+(e.secondsOfDay-t.secondsOfDay)},N.daysDifference=function(e,t){var r=e.dayNumber-t.dayNumber,n=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return r+n},N.computeTaiMinusUtc=function(e){g.julianDate=e;var r=N.leapSeconds,n=t(r,g,l);return 0>n&&(n=~n,--n,0>n&&(n=0)),r[n].offset},N.addSeconds=function(e,t,r){return d(e.dayNumber,e.secondsOfDay+t,r)},N.addMinutes=function(e,t,r){var n=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return d(e.dayNumber,n,r)},N.addHours=function(e,t,r){var n=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return d(e.dayNumber,n,r)},N.addDays=function(e,t,r){var n=e.dayNumber+t;return d(n,e.secondsOfDay,r)},N.lessThan=function(e,t){return N.compare(e,t)<0},N.lessThanOrEquals=function(e,t){return N.compare(e,t)<=0},N.greaterThan=function(e,t){return N.compare(e,t)>0},N.greaterThanOrEquals=function(e,t){return N.compare(e,t)>=0},N.prototype.clone=function(e){return N.clone(this,e)},N.prototype.equals=function(e){return N.equals(this,e)},N.prototype.equalsEpsilon=function(e,t){return N.equalsEpsilon(this,e,t)},N.prototype.toString=function(){return N.toIso8601(this)},N.leapSeconds=[new u(new N(2441317,43210,c.TAI),10),new u(new N(2441499,43211,c.TAI),11),new u(new N(2441683,43212,c.TAI),12),new u(new N(2442048,43213,c.TAI),13),new u(new N(2442413,43214,c.TAI),14),new u(new N(2442778,43215,c.TAI),15),new u(new N(2443144,43216,c.TAI),16),new u(new N(2443509,43217,c.TAI),17),new u(new N(2443874,43218,c.TAI),18),new u(new N(2444239,43219,c.TAI),19),new u(new N(2444786,43220,c.TAI),20),new u(new N(2445151,43221,c.TAI),21),new u(new N(2445516,43222,c.TAI),22),new u(new N(2446247,43223,c.TAI),23),new u(new N(2447161,43224,c.TAI),24),new u(new N(2447892,43225,c.TAI),25),new u(new N(2448257,43226,c.TAI),26),new u(new N(2448804,43227,c.TAI),27),new u(new N(2449169,43228,c.TAI),28),new u(new N(2449534,43229,c.TAI),29),new u(new N(2450083,43230,c.TAI),30),new u(new N(2450630,43231,c.TAI),31),new u(new N(2451179,43232,c.TAI),32),new u(new N(2453736,43233,c.TAI),33),new u(new N(2454832,43234,c.TAI),34),new u(new N(2456109,43235,c.TAI),35),new u(new N(2457204,43236,c.TAI),36)],N}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(r,n){if(null===r||"object"!=typeof r)return r;n=e(n,!1);var i=new r.constructor;for(var a in r)if(r.hasOwnProperty(a)){var o=r[a];n&&(o=t(o,n)),i[a]=o}return i};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0;n<r.length;++n){var i=r[n],a=i.indexOf(": ");if(a>0){var o=i.substring(0,a),u=i.substring(a+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var r=function(e,r,n){this.statusCode=e,this.response=r,this.responseHeaders=n,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return r.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},r}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,r,n,i,a){"use strict";function o(e,t){var r=decodeURIComponent(t);return e?atob(r):r}function u(e,t){for(var r=o(e,t),n=new ArrayBuffer(r.length),i=new Uint8Array(n),a=0;a<r.length;a++)i[a]=r.charCodeAt(a);return n}function s(e,r){r=t(r,"");var i=e[1],a=!!e[2],s=e[3];switch(r){case"":case"text":return o(a,s);case"arraybuffer":return u(a,s);case"blob":var c=u(a,s);return new Blob([c],{type:i});case"document":var l=new DOMParser;return l.parseFromString(o(a,s),i);case"json":return JSON.parse(o(a,s));default:throw new n("Unhandled responseType: "+r)}}var c=function(r){r=t(r,t.EMPTY_OBJECT);var n=r.responseType,i=t(r.method,"GET"),a=r.data,o=r.headers,u=r.overrideMimeType;return e(r.url,function(t){var r=e.defer();return c.load(t,n,i,a,o,r,u),r.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,n,o,u,c,f){var h=l.exec(e);if(null!==h)return c.resolve(s(h,t)),void 0;var d=new XMLHttpRequest;if(r(f)&&r(d.overrideMimeType)&&d.overrideMimeType(f),d.open(n,e,!0),r(u))for(var p in u)u.hasOwnProperty(p)&&d.setRequestHeader(p,u[p]);r(t)&&(d.responseType=t),d.onload=function(){200===d.status?r(d.response)?c.resolve(d.response):r(d.responseXML)&&d.responseXML.hasChildNodes()?c.resolve(d.responseXML):r(d.responseText)?c.resolve(d.responseText):c.reject(new a("unknown XMLHttpRequest response type.")):c.reject(new i(d.status,d.response,d.getAllResponseHeaders()))},d.onerror=function(){c.reject(new i)},d.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,r){return e({url:t,headers:r})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,r,n){"use strict";var i={Accept:"application/json,*/*;q=0.01"},a=function(r,a){return t(a)?t(a.Accept)||(a=e(a),a.Accept=i.Accept):a=i,n(r,a).then(function(e){return JSON.parse(e)})};return a}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,r,n,i,a,o,u,s,c,l,f){"use strict";function h(e,t){return o.compare(e.julianDate,t)}function d(e,r){if(!n(r.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0; -if(!n(r.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var i=r.columnNames.indexOf("modifiedJulianDateUtc"),a=r.columnNames.indexOf("xPoleWanderRadians"),s=r.columnNames.indexOf("yPoleWanderRadians"),c=r.columnNames.indexOf("ut1MinusUtcSeconds"),d=r.columnNames.indexOf("xCelestialPoleOffsetRadians"),p=r.columnNames.indexOf("yCelestialPoleOffsetRadians"),m=r.columnNames.indexOf("taiMinusUtcSeconds");if(0>i||0>a||0>s||0>c||0>d||0>p||0>m)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=r.samples,v=e._dates=[];e._dateColumn=i,e._xPoleWanderRadiansColumn=a,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=d,e._yCelestialPoleOffsetRadiansColumn=p,e._taiMinusUtcSecondsColumn=m,e._columnCount=r.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+i],O=y[x+m],T=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,_=new o(T,O,f.TAI);if(v.push(_),w){if(O!==g&&n(g)){var M=o.leapSeconds,P=t(M,_,h);if(0>P){var b=new u(_,O);M.splice(~P,0,b)}}g=O}}}function p(e,t,r,n,i){var a=r*n;i.xPoleWander=t[a+e._xPoleWanderRadiansColumn],i.yPoleWander=t[a+e._yPoleWanderRadiansColumn],i.xPoleOffset=t[a+e._xCelestialPoleOffsetRadiansColumn],i.yPoleOffset=t[a+e._yCelestialPoleOffsetRadiansColumn],i.ut1MinusUtc=t[a+e._ut1MinusUtcSecondsColumn]}function m(e,t,r){return t+e*(r-t)}function y(e,t,r,n,i,a,u){var s=e._columnCount;if(a>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[i],l=t[a];if(c.equals(l)||n.equals(c))return p(e,r,i,s,u),u;if(n.equals(l))return p(e,r,a,s,u),u;var f=o.secondsDifference(n,c)/o.secondsDifference(l,c),h=i*s,d=a*s,y=r[h+e._ut1MinusUtcSecondsColumn],v=r[d+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=r[h+e._taiMinusUtcSecondsColumn],x=r[d+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(n)?y=v:v-=x-w)}return u.xPoleWander=m(f,r[h+e._xPoleWanderRadiansColumn],r[d+e._xPoleWanderRadiansColumn]),u.yPoleWander=m(f,r[h+e._yPoleWanderRadiansColumn],r[d+e._yPoleWanderRadiansColumn]),u.xPoleOffset=m(f,r[h+e._xCelestialPoleOffsetRadiansColumn],r[d+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=m(f,r[h+e._yCelestialPoleOffsetRadiansColumn],r[d+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=m(f,y,v),u}var v=function(t){if(t=r(t,r.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=r(t.addNewLeapSeconds,!0),n(t.data))d(this,t.data);else if(n(t.url)){var i=this;this._downloadPromise=e(s(t.url),function(e){d(i,e)},function(){i._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else d(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=a({getPromiseToLoad:function(){return e()},compute:function(e,t){return n(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new i(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,r){if(!n(this._samples)){if(n(this._dataError))throw new c(this._dataError);return void 0}if(n(r)||(r=new i(0,0,0,0,0)),0===this._samples.length)return r.xPoleWander=0,r.yPoleWander=0,r.xPoleOffset=0,r.yPoleOffset=0,r.ut1MinusUtc=0,r;var a=this._dates,u=this._lastIndex,s=0,l=0;if(n(u)){var f=a[u],h=a[u+1],d=o.lessThanOrEquals(f,e),p=!n(h),m=p||o.greaterThanOrEquals(h,e);if(d&&m)return s=u,!p&&h.equals(e)&&++s,l=s+1,y(this,a,this._samples,e,s,l,r),r}var v=t(a,e,o.compare,this._dateColumn);return v>=0?(v<a.length-1&&a[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,a,this._samples,e,s,l,r),r},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var r=n.exec(t);this.scheme=r[1],this.authority=r[2],this.path=r[3],this.query=r[4],this.fragment=r[5]}}function t(e){var t=unescape(e);return a.test(t)?t:e.toUpperCase()}function r(e,t,r,n){return(t||"")+r.toLowerCase()+(n||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var n=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,r).replace(i,t)),this.path&&(this.path=this.path.replace(i,t)),this.query&&(this.query=this.query.replace(i,t)),this.fragment&&(this.fragment=this.fragment.replace(i,t))};var i=/%[0-9a-z]{2}/gi,a=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var r=new e;return this.scheme?(r.scheme=this.scheme,r.authority=this.authority,r.path=this.path,r.query=this.query):(r.scheme=t.scheme,this.authority?(r.authority=this.authority,r.path=this.path,r.query=this.query):(r.authority=t.authority,""==this.path?(r.path=t.path,r.query=this.query||t.query):("/"==this.path.charAt(0)?(r.path=this.path,r.removeDotSegments()):(r.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,r.removeDotSegments()),r.query=this.query))),r.fragment=this.fragment,r},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),r=[],n=""==t[0];for(n&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?r.pop():"."!=e&&r.push(e);("."==e||".."==e)&&r.push(""),n&&r.unshift(""),this.path=r.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,r,n){"use strict";function i(){for(var e=document.getElementsByTagName("script"),t=0,r=e.length;r>t;++t){var n=e[t].getAttribute("src"),i=f.exec(n);if(null!==i)return i[1]}return void 0}function a(){if(t(s))return s;var n;if(n="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:i(),!t(n))throw new r("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(n).resolve(new e(document.location.href))}function o(e){return n.toUrl("../"+e)}function u(t){return new e(t).resolve(a()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,h=function(e){t(c)||(c=t(n.toUrl)?o:u),t(l)||(l=document.createElement("a"));var r=c(e);return l.href=r,l.href=l.href,l.href};return h._cesiumScriptRegex=f,h.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},h}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,r){this.x=e,this.y=t,this.s=r};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,r,n,i,a,o,u){"use strict";function s(e,t,r){var n=f;return n.dayNumber=t,n.secondsOfDay=r,a.daysDifference(n,e._sampleZeroDateTT)}function c(r,i){if(r._chunkDownloadsInProgress[i])return r._chunkDownloadsInProgress[i];var a=e.defer();r._chunkDownloadsInProgress[i]=a;var u,s=r._xysFileUrlTemplate;return u=n(s)?s.replace("{0}",i):t("Assets/IAU2006_XYS/IAU2006_XYS_"+i+".json"),e(o(u),function(e){r._chunkDownloadsInProgress[i]=!1;for(var t=r._samples,n=e.samples,o=3*i*r._samplesPerXysFile,u=0,s=n.length;s>u;++u)t[o+u]=n[u];a.resolve()}),a.promise}var l=function(e){e=r(e,r.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=r(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=r(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new a(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=r(e.stepSizeDays,1),this._samplesPerXysFile=r(e.samplesPerXysFile,1e3),this._totalSamples=r(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,n=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){n[s]=o,i[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(n[s]*=s-c);n[s]=1/n[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new a(0,0,u.TAI);return l.prototype.preload=function(t,r,n,i){var a=s(this,t,r),o=s(this,n,i),u=0|a/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,h=0|l/this._samplesPerXysFile,d=[],p=f;h>=p;++p)d.push(c(this,p));return e.all(d)},l.prototype.computeXysRadians=function(e,t,r){var a=s(this,e,t);if(0>a)return void 0;var o=0|a/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var h=!1,d=this._samples;if(n(d[3*l])||(c(this,0|l/this._samplesPerXysFile),h=!0),n(d[3*f])||(c(this,0|f/this._samplesPerXysFile),h=!0),h)return void 0;n(r)?(r.x=0,r.y=0,r.s=0):r=new i(0,0,0);var p,m,y=a-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(p=0;u>=p;++p)v[p]=y-x[p];for(p=0;u>=p;++p){for(w[p]=1,m=0;u>=m;++m)m!==p&&(w[p]*=v[m]);w[p]*=g[p];var E=3*(l+p);r.x+=w[p]*d[E++],r.y+=w[p]*d[E++],r.s+=w[p]*d[E]}return r},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,r,n,i,a,o,u){"use strict";var s=function(e,r,n,i){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(i,0)},c=new e;s.fromAxisAngle=function(t,n,i){var a=n/2,o=Math.sin(a);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,h=Math.cos(a);return r(i)?(i.x=u,i.y=l,i.z=f,i.w=h,i):new s(u,l,f,h)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var n,i,a,o,c,h=e[u.COLUMN0ROW0],d=e[u.COLUMN1ROW1],p=e[u.COLUMN2ROW2],m=h+d+p;if(m>0)n=Math.sqrt(m+1),c=.5*n,n=.5/n,i=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*n,a=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*n,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*n;else{var y=l,v=0;d>h&&(v=1),p>h&&p>d&&(v=2);var g=y[v],w=y[g];n=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*n,n=.5/n,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*n,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*n,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*n,i=-x[0],a=-x[1],o=-x[2]}return r(t)?(t.x=i,t.y=a,t.z=o,t.w=c,t):new s(i,a,o,c)};var h=new s;s.fromHeadingPitchRoll=function(t,r,n,i){var a=s.fromAxisAngle(e.UNIT_X,n,h),o=s.fromAxisAngle(e.UNIT_Y,-r,i);i=s.multiply(o,a,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,h);return s.multiply(u,i,i)};var d=new e,p=new e,m=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.x,r[n++]=e.y,r[n++]=e.z,r[n]=e.w},s.unpack=function(e,n,i){return n=t(n,0),r(i)||(i=new s),i.x=e[n],i.y=e[n+1],i.z=e[n+2],i.w=e[n+3],i},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,r,n){s.unpack(e,4*r,v),s.conjugate(v,v);for(var i=0,a=r-t+1;a>i;i++){var o=3*i;s.unpack(e,4*(t+i),m),s.multiply(m,v,m),m.w<0&&s.negate(m,m),s.computeAxis(m,d);var u=s.computeAngle(m);n[o]=d.x*u,n[o+1]=d.y*u,n[o+2]=d.z*u}},s.unpackInterpolationResult=function(t,n,i,a,o){r(o)||(o=new s),e.fromArray(t,0,p);var u=e.magnitude(p);return s.unpack(n,4*a,y),0===u?s.clone(s.IDENTITY,m):s.fromAxisAngle(p,u,m),s.multiply(m,y,o)},s.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var r=1/s.magnitude(e),n=e.x*r,i=e.y*r,a=e.z*r,o=e.w*r;return t.x=n,t.y=i,t.z=a,t.w=o,t},s.inverse=function(e,t){var r=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/r,t)},s.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},s.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,r){var n=e.x,i=e.y,a=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+n*l+i*c-a*s,h=o*s-n*c+i*l+a*u,d=o*c+n*s-i*u+a*l,p=o*l-n*u-i*s-a*c;return r.x=f,r.y=h,r.z=d,r.w=p,r},s.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},s.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},s.computeAxis=function(e,t){var r=e.w;if(Math.abs(r-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var n=1/Math.sqrt(1-r*r);return t.x=e.x*n,t.y=e.y*n,t.z=e.z*n,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,r,n){return g=s.multiplyByScalar(t,r,g),n=s.multiplyByScalar(e,1-r,n),s.add(g,n,n)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,r,n){var i=s.dot(e,t),a=t;if(0>i&&(i=-i,a=w=s.negate(t,w)),1-i<o.EPSILON6)return s.lerp(e,a,r,n);var u=Math.acos(i);return x=s.multiplyByScalar(e,Math.sin((1-r)*u),x),E=s.multiplyByScalar(a,Math.sin(r*u),E),n=s.add(x,E,n),s.multiplyByScalar(n,1/Math.sin(u),n)},s.log=function(t,r){var n=o.acosClamped(t.w),i=0;return 0!==n&&(i=n/Math.sin(n)),e.multiplyByScalar(t,i,r)},s.exp=function(t,r){var n=e.magnitude(t),i=0;return 0!==n&&(i=Math.sin(n)/n),r.x=t.x*i,r.y=t.y*i,r.z=t.z*i,r.w=Math.cos(n),r};var S=new e,O=new e,T=new s,_=new s;s.computeInnerQuadrangle=function(t,r,n,i){var a=s.conjugate(r,T);s.multiply(a,n,_);var o=s.log(_,S);s.multiply(a,t,_);var u=s.log(_,O);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,T),s.multiply(r,T,i)},s.squad=function(e,t,r,n,i,a){var o=s.slerp(e,t,i,T),u=s.slerp(r,n,i,_);return s.slerp(o,u,2*i*(1-i),a)};for(var M=new s,P=1.9011074535173003,b=i.supportsTypedArrays()?new Float32Array(8):[],N=i.supportsTypedArrays()?new Float32Array(8):[],A=i.supportsTypedArrays()?new Float32Array(8):[],I=i.supportsTypedArrays()?new Float32Array(8):[],R=0;7>R;++R){var z=R+1,C=2*z+1;b[R]=1/(z*C),N[R]=z/C}return b[7]=P/136,N[7]=8*P/17,s.fastSlerp=function(e,t,r,n){var i,a=s.dot(e,t);a>=0?i=1:(i=-1,a=-a);for(var o=a-1,u=1-r,c=r*r,l=u*u,f=7;f>=0;--f)A[f]=(b[f]*c-N[f])*o,I[f]=(b[f]*l-N[f])*o;var h=i*r*(1+A[0]*(1+A[1]*(1+A[2]*(1+A[3]*(1+A[4]*(1+A[5]*(1+A[6]*(1+A[7])))))))),d=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),p=s.multiplyByScalar(e,d,M);return s.multiplyByScalar(t,h,n),s.add(p,n,n)},s.fastSquad=function(e,t,r,n,i,a){var o=s.fastSlerp(e,t,i,T),u=s.fastSlerp(r,n,i,_);return s.fastSlerp(o,u,2*i*(1-i),a)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,r,n,i,a,o,u,s,c,l,f,h,d,p,m,y,v){"use strict";var g={},w=new r,x=new r,E=new r;g.eastNorthUpToFixedFrame=function(e,t,n){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(n)?(n[0]=0,n[1]=1,n[2]=0,n[3]=0,n[4]=-o,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=o,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),a(n)?(n[0]=s.x,n[1]=s.y,n[2]=s.z,n[3]=0,n[4]=l.x,n[5]=l.y,n[6]=l.z,n[7]=0,n[8]=u.x,n[9]=u.y,n[10]=u.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new r,O=new r,T=new r;g.northEastDownToFixedFrame=function(e,t,n){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(n)?(n[0]=-o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-o,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=O,l=T;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),a(n)?(n[0]=l.x,n[1]=l.y,n[2]=l.z,n[3]=0,n[4]=s.x,n[5]=s.y,n[6]=s.z,n[7]=0,n[8]=-u.x,n[9]=-u.y,n[10]=-u.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,n){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(n)?(n[0]=-o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=o,n[7]=0,n[8]=0,n[9]=1,n[10]=0,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),a(n)?(n[0]=l.x,n[1]=l.y,n[2]=l.z,n[3]=0,n[4]=u.x,n[5]=u.y,n[6]=u.z,n[7]=0,n[8]=s.x,n[9]=s.y,n[10]=s.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var _=new y,M=new r(1,1,1),P=new m;g.headingPitchRollToFixedFrame=function(e,t,n,i,a,o){var u=y.fromHeadingPitchRoll(t,n,i,_),s=m.fromTranslationQuaternionRotationScale(r.ZERO,u,M,P);return o=g.eastNorthUpToFixedFrame(e,a,o),m.multiply(o,s,o)};var b=new m,N=new p;g.headingPitchRollQuaternion=function(e,t,r,n,i,a){var o=g.headingPitchRollToFixedFrame(e,t,r,n,i,b),u=m.getRotation(o,N);return y.fromRotationMatrix(u,a)};var A=24110.54841,I=8640184.812866,R=.093104,z=-62e-7,C=1.1772758384668e-19,D=72921158553e-15,L=d.TWO_PI/86400,q=new h;g.computeTemeToPseudoFixedMatrix=function(e,t){q=h.addSeconds(e,-h.computeTaiMinusUtc(e),q);var r,n=q.dayNumber,i=q.secondsOfDay,o=n-2451545;r=i>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=A+r*(I+r*(R+r*z)),s=u*L%d.TWO_PI,c=D+C*(n-2451545.5),l=(i+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,m=Math.cos(f),y=Math.sin(f);return a(t)?(t[0]=m,t[1]=-y,t[2]=0,t[3]=y,t[4]=m,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new p(m,y,0,-y,m,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var U=32.184,B=2451545;g.preloadIcrfFixed=function(t){var r=t.start.dayNumber,n=t.start.secondsOfDay+U,i=t.stop.dayNumber,a=t.stop.secondsOfDay+U,o=g.iau2006XysData.preload(r,n,i,a),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){a(t)||(t=new p);var r=g.computeFixedToIcrfMatrix(e,t);return a(r)?p.transpose(r,t):void 0};var F=new f(0,0,0),W=new s(0,0,0,0,0,0),G=new p,k=new p;g.computeFixedToIcrfMatrix=function(e,t){a(t)||(t=new p);var r=g.earthOrientationParameters.compute(e,W);if(!a(r))return void 0;var n=e.dayNumber,i=e.secondsOfDay+U,o=g.iau2006XysData.computeXysRadians(n,i,F);if(!a(o))return void 0;var u=o.x+r.xPoleOffset,s=o.y+r.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=p.fromRotationZ(-o.s,k),m=p.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-h.computeTaiMinusUtc(e)+r.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*d.TWO_PI;var O=p.fromRotationZ(S,k),T=p.multiply(m,O,G),_=Math.cos(r.xPoleWander),M=Math.cos(r.yPoleWander),P=Math.sin(r.xPoleWander),b=Math.sin(r.yPoleWander),N=n-B+i/v.SECONDS_PER_DAY;N/=36525;var A=-47e-6*N*d.RADIANS_PER_DEGREE/3600,I=Math.cos(A),R=Math.sin(A),z=k;return z[0]=_*I,z[1]=_*R,z[2]=P,z[3]=-M*R+b*P*I,z[4]=M*I+b*P*R,z[5]=-b*_,z[6]=-b*R-M*P*I,z[7]=b*I-M*P*R,z[8]=M*_,p.multiply(T,z,t)};var V=new n;g.pointToWindowCoordinates=function(e,t,r,n){return n=g.pointToGLWindowCoordinates(e,t,r,n),n.y=2*t[5]-n.y,n},g.pointToGLWindowCoordinates=function(e,r,i,o){a(o)||(o=new t);var u=V;return m.multiplyByVector(e,n.fromElements(i.x,i.y,i.z,1,u),u),n.multiplyByScalar(u,1/u.w,u),m.multiplyByVector(r,u,u),t.fromCartesian4(u,o)};var H=new r,Y=new r,j=new r;return g.rotationMatrixFromPositionVelocity=function(e,t,n,o){var u=i(n,c.WGS84).geodeticSurfaceNormal(e,H),s=r.cross(t,u,Y);r.equalsEpsilon(s,r.ZERO,d.EPSILON6)&&(s=r.clone(r.UNIT_X,s));var l=r.cross(s,t,j);return r.cross(t,l,s),r.negate(s,s),a(o)||(o=new p),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,r,n,i,a,o,u,s,c,l,f,h,d,p){"use strict";var m=new n,y=function(e,t){t=i(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var n=p.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=r.fromCartesian4(f.getColumn(n,0,m)),this._yAxis=r.fromCartesian4(f.getColumn(n,1,m));var a=r.fromCartesian4(f.getColumn(n,2,m));this._plane=h.fromPointNormal(e,a)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,r){var n=e.fromPoints(t,v);return new y(n.center,r)};var g=new d,w=new r;y.prototype.projectPointOntoPlane=function(e,n){var i=g;i.origin=e,r.normalize(e,i.direction);var o=c.rayPlane(i,this._plane,w);if(a(o)||(r.negate(i.direction,i.direction),o=c.rayPlane(i,this._plane,w)),a(o)){var u=r.subtract(o,this._origin,o),s=r.dot(this._xAxis,u),l=r.dot(this._yAxis,u);return a(n)?(n.x=s,n.y=l,n):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){a(t)||(t=[]);for(var r=0,n=e.length,i=0;n>i;i++){var o=this.projectPointOntoPlane(e[i],t[r]);a(o)&&(t[r]=o,r++)}return t.length=r,t},y.prototype.projectPointToNearestOnPlane=function(e,n){a(n)||(n=new t);var i=g;i.origin=e,r.clone(this._plane.normal,i.direction);var o=c.rayPlane(i,this._plane,w);a(o)||(r.negate(i.direction,i.direction),o=c.rayPlane(i,this._plane,w));var u=r.subtract(o,this._origin,o),s=r.dot(this._xAxis,u),l=r.dot(this._yAxis,u);return n.x=s,n.y=l,n},y.prototype.projectPointsToNearestOnPlane=function(e,t){a(t)||(t=[]);var r=e.length;t.length=r;for(var n=0;r>n;n++)t[n]=this.projectPointToNearestOnPlane(e[n],t[n]);return t};var x=new r;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var n=e.length;a(t)?t.length=n:t=new Array(n);for(var i=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;n>l;++l){var f=e[l];r.multiplyByScalar(u,f.x,c),a(t[l])||(t[l]=new r);var h=r.add(o,c,t[l]);r.multiplyByScalar(s,f.y,c),r.add(h,c,h),i.scaleToGeocentricSurface(h,h)}return t},y}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,i){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,i.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,n.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(e){var n=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&t(e.attributes[i])&&t(e.attributes[i].values)){var a=e.attributes[i],o=a.values.length/a.componentsPerAttribute;if(n!==o&&-1!==n)throw new r("All attribute lists must have the same number of attributes.");n=o}return n},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=n.clone(e(t.modelMatrix,n.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return i}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n,i){"use strict";var a={};a.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=t.x,n=t.y;t.x=(1-Math.abs(n))*i.signNotZero(r),t.y=(1-Math.abs(r))*i.signNotZero(n)}return t.x=i.toSNorm(t.x),t.y=i.toSNorm(t.y),t},a.octDecode=function(e,r,n){if(n.x=i.fromSNorm(e),n.y=i.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var a=n.x;n.x=(1-Math.abs(n.y))*i.signNotZero(a),n.y=(1-Math.abs(a))*i.signNotZero(n.y)}return t.normalize(n,n)},a.octPackFloat=function(e){return 256*e.x+e.y};var o=new e;return a.octEncodeFloat=function(e){return a.octEncode(e,o),a.octPackFloat(o)},a.octDecodeFloat=function(e,t){var r=e/256,n=Math.floor(r),i=256*(r-n);return a.octDecode(n,i,t)},a.octPack=function(e,t,r,n){var i=a.octEncodeFloat(e),u=a.octEncodeFloat(t),s=a.octEncode(r,o);return n.x=65536*s.x+i,n.y=65536*s.y+u,n},a.octUnpack=function(e,t,r,n){var i=e.x/65536,o=Math.floor(i),u=65536*(i-o);i=e.y/65536;var s=Math.floor(i),c=65536*(i-s);a.octDecodeFloat(u,t),a.octDecodeFloat(c,r),a.octDecode(o,s,n)},a.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,r=1===e.y?4095:0|4096*e.y;return 4096*t+r},a.decompressTextureCoordinates=function(e,t){var r=e/4096;return t.x=Math.floor(r)/4096,t.y=r-Math.floor(r),t},a}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=new t,i=new t,a=new t,o=function(o,u,s,c,l){r(l)||(l=new t);var f,h,d,p,m,y,v,g;r(u.z)?(f=t.subtract(s,u,n),h=t.subtract(c,u,i),d=t.subtract(o,u,a),p=t.dot(f,f),m=t.dot(f,h),y=t.dot(f,d),v=t.dot(h,h),g=t.dot(h,d)):(f=e.subtract(s,u,n),h=e.subtract(c,u,i),d=e.subtract(o,u,a),p=e.dot(f,f),m=e.dot(f,h),y=e.dot(f,d),v=e.dot(h,h),g=e.dot(h,d));var w=1/(p*v-m*m);return l.y=(v*y-m*g)*w,l.z=(p*g-m*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};r.encode=function(e,r){t(r)||(r={high:0,low:0});var n;return e>=0?(n=65536*Math.floor(e/65536),r.high=n,r.low=e-n):(n=65536*Math.floor(-e/65536),r.high=-n,r.low=e+n),r};var n={high:0,low:0};r.fromCartesian=function(e,i){t(i)||(i=new r);var a=i.high,o=i.low;return r.encode(e.x,n),a.x=n.high,o.x=n.low,r.encode(e.y,n),a.y=n.high,o.y=n.low,r.encode(e.z,n),a.z=n.high,o.z=n.low,i};var i=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,i);var a=i.high,o=i.low;t[n]=a.x,t[n+1]=a.y,t[n+2]=a.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z},r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(t){return e(t)&&(t===i.UNSIGNED_BYTE||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)},i.createTypedArray=function(e,t){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},i.createTypedArrayFromArrayBuffer=function(e,t,r,i){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,i):new Uint16Array(t,r,i)},r(i)}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};return r.calculateACMR=function(r){r=e(r,e.EMPTY_OBJECT);var n=r.indices,i=r.maximumIndex,a=e(r.cacheSize,24),o=n.length;if(!t(i)){i=0;for(var u=0,s=n[u];o>u;)s>i&&(i=s),++u,s=n[u]}for(var c=[],l=0;i+1>l;l++)c[l]=0;for(var f=a+1,h=0;o>h;++h)f-c[n[h]]>a&&(c[n[h]]=f,++f);return(f-a+1)/(o/3)},r.tipsify=function(r){function n(e,t,r,n){for(;t.length>=1;){var i=t[t.length-1];if(t.splice(t.length-1,1),e[i].numLiveTriangles>0)return i}for(;n>a;){if(e[a].numLiveTriangles>0)return++a,a-1;++a}return-1}function i(e,t,r,i,a,o,u){for(var s,c=-1,l=-1,f=0;f<r.length;){var h=r[f];i[h].numLiveTriangles&&(s=0,a-i[h].timeStamp+2*i[h].numLiveTriangles<=t&&(s=a-i[h].timeStamp),(s>l||-1===l)&&(l=s,c=h)),++f}return-1===c?n(i,o,e,u):c}r=e(r,e.EMPTY_OBJECT);var a,o=r.indices,u=r.maximumIndex,s=e(r.cacheSize,24),c=o.length,l=0,f=0,h=o[f],d=c;if(t(u))l=u+1;else{for(;d>f;)h>l&&(l=h),++f,h=o[f];if(-1===l)return 0;++l}for(var p=[],m=0;l>m;m++)p[m]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var y=0;d>f;)p[o[f]].vertexTriangles.push(y),++p[o[f]].numLiveTriangles,p[o[f+1]].vertexTriangles.push(y),++p[o[f+1]].numLiveTriangles,p[o[f+2]].vertexTriangles.push(y),++p[o[f+2]].numLiveTriangles,++y,f+=3;var v=0,g=s+1;a=1;var w,x,E=[],S=[],O=0,T=[],_=c/3,M=[];for(m=0;_>m;m++)M[m]=!1;for(var P,b;-1!==v;){E=[],x=p[v],b=x.vertexTriangles.length; -for(var N=0;b>N;++N)if(y=x.vertexTriangles[N],!M[y]){M[y]=!0,f=y+y+y;for(var A=0;3>A;++A)P=o[f],E.push(P),S.push(P),T[O]=P,++O,w=p[P],--w.numLiveTriangles,g-w.timeStamp>s&&(w.timeStamp=g,++g),++f}v=i(o,s,E,p,g,S,l)}return T},r}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,r,n,i,a,o,u,s,c,l,f,h,d,p,m,y,v,g,w,x,E,S,O,T,_){"use strict";function M(e,t,r,n,i){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=i,e[t++]=i,e[t]=r}function P(e){for(var t=e.length,r=6*(t/3),n=v.createTypedArray(t,r),i=0,a=0;t>a;a+=3,i+=6)M(n,i,e[a],e[a+1],e[a+2]);return n}function b(e){var t=e.length;if(t>=3){var r=6*(t-2),n=v.createTypedArray(t,r);M(n,0,e[0],e[1],e[2]);for(var i=6,a=3;t>a;++a,i+=6)M(n,i,e[a-1],e[a],e[a-2]);return n}return new Uint16Array}function N(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=v.createTypedArray(t,r),i=e[0],a=0,o=1;t>o;++o,a+=6)M(n,a,i,e[o],e[o+1]);return n}return new Uint16Array}function A(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new p({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function I(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var i=t[n],a=0;a<i.componentsPerAttribute;++a)e[n].values.push(i.values[r*i.componentsPerAttribute+a])}function R(e,t){if(c(t))for(var r=t.values,n=r.length,a=0;n>a;a+=3)i.unpack(r,a,at),S.multiplyByPoint(e,at,at),i.pack(at,r,a)}function z(e,t){if(c(t))for(var r=t.values,n=r.length,a=0;n>a;a+=3)i.unpack(r,a,at),E.multiplyByVector(e,at,at),at=i.normalize(at,at),i.pack(at,r,a)}function C(e,t){var r,n=e.length,i={},a=e[0][t].attributes;for(r in a)if(a.hasOwnProperty(r)&&c(a[r])&&c(a[r].values)){for(var o=a[r],s=o.values.length,l=!0,f=1;n>f;++f){var h=e[f][t].attributes[r];if(!c(h)||o.componentDatatype!==h.componentDatatype||o.componentsPerAttribute!==h.componentsPerAttribute||o.normalize!==h.normalize){l=!1;break}s+=h.values.length}l&&(i[r]=new p({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return i}function D(e,t){var n,a,o,u,s=e.length;e[0].modelMatrix;var l,f,h,p=c(e[0][t].indices),m=e[0][t].primitiveType,y=C(e,t);for(n in y)if(y.hasOwnProperty(n))for(l=y[n].values,u=0,a=0;s>a;++a)for(f=e[a][t].attributes[n].values,h=f.length,o=0;h>o;++o)l[u++]=f[o];var g;if(p){var w=0;for(a=0;s>a;++a)w+=e[a][t].indices.length;var x=d.computeNumberOfVertices(new d({attributes:y,primitiveType:T.POINTS})),E=v.createTypedArray(x,w),S=0,O=0;for(a=0;s>a;++a){var _=e[a][t].indices,M=_.length;for(u=0;M>u;++u)E[S++]=O+_[u];O+=d.computeNumberOfVertices(e[a][t])}g=E}var P,b=new i,N=0;for(a=0;s>a;++a){if(P=e[a][t].boundingSphere,!c(P)){b=void 0;break}i.add(P.center,b,b)}if(c(b))for(i.divideByScalar(b,s,b),a=0;s>a;++a){P=e[a][t].boundingSphere;var A=i.magnitude(i.subtract(P.center,b,st))+P.radius;A>N&&(N=A)}return new d({attributes:y,indices:g,primitiveType:m,boundingSphere:c(b)?new r(b,N):void 0})}function L(e){if(c(e.indices))return e;for(var t=d.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function q(e){var t=d.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,i=3;t>i;++i)r[n++]=i-1,r[n++]=0,r[n++]=i;return e.indices=r,e.primitiveType=T.TRIANGLES,e}function U(e){var t=d.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,i=3;t-1>i;i+=2)r[n++]=i,r[n++]=i-1,r[n++]=i+1,t>i+2&&(r[n++]=i,r[n++]=i+1,r[n++]=i+2);return e.indices=r,e.primitiveType=T.TRIANGLES,e}function B(e){if(c(e.indices))return e;for(var t=d.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function F(e){var t=d.computeNumberOfVertices(e),r=v.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,i=2;t>i;++i)r[n++]=i-1,r[n++]=i;return e.indices=r,e.primitiveType=T.LINES,e}function W(e){var t=d.computeNumberOfVertices(e),r=v.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,i=2;t>i;++i)r[n++]=i-1,r[n++]=i;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=T.LINES,e}function G(e){switch(e.primitiveType){case T.TRIANGLE_FAN:return q(e);case T.TRIANGLE_STRIP:return U(e);case T.TRIANGLES:return L(e);case T.LINE_STRIP:return F(e);case T.LINE_LOOP:return W(e);case T.LINES:return B(e)}return e}function k(e,t){Math.abs(e.y)<x.EPSILON6&&(e.y=t?-x.EPSILON6:x.EPSILON6)}function V(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return k(e,e.y<0),k(t,t.y<0),k(r,r.y<0),void 0;var n,i=Math.abs(e.y),a=Math.abs(t.y),o=Math.abs(r.y);n=i>a?i>o?x.sign(e.y):x.sign(r.y):a>o?x.sign(t.y):x.sign(r.y);var u=0>n;k(e,u),k(t,u),k(r,u)}function H(e,t,r,n){i.add(e,i.multiplyByScalar(i.subtract(t,e,xt),e.y/(e.y-t.y),xt),r),i.clone(r,n),k(r,!0),k(n,!1)}function Y(e,t,r){if(e.x>=0||t.x>=0||r.x>=0)return void 0;V(e,t,r);var n=e.y<0,i=t.y<0,a=r.y<0,o=0;o+=n?1:0,o+=i?1:0,o+=a?1:0;var u=_t.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(H(e,t,Et,Ot),H(e,r,St,Tt),u[0]=0,u[3]=1,u[4]=2,u[6]=1):i?(H(t,r,Et,Ot),H(t,e,St,Tt),u[0]=1,u[3]=2,u[4]=0,u[6]=2):a&&(H(r,e,Et,Ot),H(r,t,St,Tt),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,n?i?a||(H(r,e,Et,Ot),H(r,t,St,Tt),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(H(t,r,Et,Ot),H(t,e,St,Tt),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(H(e,t,Et,Ot),H(e,r,St,Tt),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=_t.positions;return s[0]=e,s[1]=t,s[2]=r,s.length=3,(1===o||2===o)&&(s[3]=Et,s[4]=St,s[5]=Ot,s[6]=Tt,s.length=7),_t}function j(e,t){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var i in n)if(n.hasOwnProperty(i)&&c(n[i])&&c(n[i].values)){var a=n[i];a.values=u.createTypedArray(a.componentDatatype,a.values)}var o=d.computeNumberOfVertices(e);return e.indices=v.createTypedArray(o,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}function Z(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var i=t[n];r[n]=new p({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return new d({attributes:r,indices:[],primitiveType:e.primitiveType})}function X(e,t,r){var n=c(e.geometry.boundingSphere);t=j(t,n),r=j(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function J(e,r,a,o,u,s,l,f,h,d,p){if(c(s)||c(l)||c(f)||c(h)){var m=i.fromArray(u,3*e,Mt),y=i.fromArray(u,3*r,Pt),v=i.fromArray(u,3*a,bt),g=t(o,m,y,v,Nt);if(c(s)){var w=i.fromArray(s,3*e,Mt),x=i.fromArray(s,3*r,Pt),E=i.fromArray(s,3*a,bt);i.multiplyByScalar(w,g.x,w),i.multiplyByScalar(x,g.y,x),i.multiplyByScalar(E,g.z,E);var S=i.add(w,x,w);i.add(S,E,S),i.normalize(S,S),i.pack(S,d.normal.values,3*p)}if(c(l)){var O=i.fromArray(l,3*e,Mt),T=i.fromArray(l,3*r,Pt),_=i.fromArray(l,3*a,bt);i.multiplyByScalar(O,g.x,O),i.multiplyByScalar(T,g.y,T),i.multiplyByScalar(_,g.z,_);var M=i.add(O,T,O);i.add(M,_,M),i.normalize(M,M),i.pack(M,d.binormal.values,3*p)}if(c(f)){var P=i.fromArray(f,3*e,Mt),b=i.fromArray(f,3*r,Pt),N=i.fromArray(f,3*a,bt);i.multiplyByScalar(P,g.x,P),i.multiplyByScalar(b,g.y,b),i.multiplyByScalar(N,g.z,N);var A=i.add(P,b,P);i.add(A,N,A),i.normalize(A,A),i.pack(A,d.tangent.values,3*p)}if(c(h)){var I=n.fromArray(h,2*e,At),R=n.fromArray(h,2*r,It),z=n.fromArray(h,2*a,Rt);n.multiplyByScalar(I,g.x,I),n.multiplyByScalar(R,g.y,R),n.multiplyByScalar(z,g.z,z);var C=n.add(I,R,I);n.add(C,z,C),n.pack(C,d.st.values,2*p)}}}function K(e,t,r,n,i,a){var o=e.position.values.length/3;if(-1!==i){var u=n[i],s=r[u];return-1===s?(r[u]=o,e.position.values.push(a.x,a.y,a.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(a.x,a.y,a.z),t.push(o),o}function Q(e){var t,r,n,a,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,h=c(s.binormal)?s.binormal.values:void 0,d=c(s.tangent)?s.tangent.values:void 0,p=c(s.st)?s.st.values:void 0,m=u.indices,y=Z(u),v=Z(u),g=[];g.length=l.length/3;var w=[];for(w.length=l.length/3,o=0;o<g.length;++o)g[o]=-1,w[o]=-1;var x=m.length;for(o=0;x>o;o+=3){var E=m[o],S=m[o+1],O=m[o+2],T=i.fromArray(l,3*E),_=i.fromArray(l,3*S),M=i.fromArray(l,3*O),P=Y(T,_,M);if(c(P)&&P.positions.length>3)for(var b=P.positions,N=P.indices,A=N.length,I=0;A>I;++I){var R=N[I],z=b[R];z.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=w),a=K(t,r,n,m,3>R?o+R:-1,z),J(E,S,O,z,l,f,h,d,p,t,a)}else c(P)&&(T=P.positions[0],_=P.positions[1],M=P.positions[2]),T.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=w),a=K(t,r,n,m,o,T),J(E,S,O,T,l,f,h,d,p,t,a),a=K(t,r,n,m,o+1,_),J(E,S,O,_,l,f,h,d,p,t,a),a=K(t,r,n,m,o+2,M),J(E,S,O,M,l,f,h,d,p,t,a)}X(e,v,y)}function $(e){var t,r=e.geometry,n=r.attributes,a=n.position.values,o=r.indices,u=Z(r),s=Z(r),l=o.length,f=[];f.length=a.length/3;var h=[];for(h.length=a.length/3,t=0;t<f.length;++t)f[t]=-1,h[t]=-1;for(t=0;l>t;t+=2){var d=o[t],p=o[t+1],m=i.fromArray(a,3*d,Mt),y=i.fromArray(a,3*p,Pt);Math.abs(m.y)<x.EPSILON6&&(m.y=m.y<0?-x.EPSILON6:x.EPSILON6),Math.abs(y.y)<x.EPSILON6&&(y.y=y.y<0?-x.EPSILON6:x.EPSILON6);var v=u.attributes,g=u.indices,E=h,S=s.attributes,O=s.indices,T=f,_=w.lineSegmentPlane(m,y,zt,bt);if(c(_)){var M=i.multiplyByScalar(i.UNIT_Y,5*x.EPSILON9,Ct);m.y<0&&(i.negate(M,M),v=s.attributes,g=s.indices,E=f,S=u.attributes,O=u.indices,T=h);var P=i.add(_,M,Dt);K(v,g,E,o,t,m),K(v,g,E,o,-1,P),i.negate(M,M),i.add(_,M,P),K(S,O,T,o,-1,P),K(S,O,T,o,t+1,y)}else{var b,N,A;m.y<0?(b=s.attributes,N=s.indices,A=f):(b=u.attributes,N=u.indices,A=h),K(b,N,A,o,t,m),K(b,N,A,o,t+1,y)}}X(e,s,u)}function et(e){var t=e.geometry,r=t.attributes,o=r.position.values,u=r.prevPosition.values,s=r.nextPosition.values,l=r.expandAndWidth.values;t.indices;var f,h,d,p=c(r.st)?r.st.values:void 0,m=c(r.color)?r.color.values:void 0,y=Z(t),v=Z(t),g=o.length/3;for(f=0;g>f;f+=4){var E=f,S=f+1,O=f+2,T=f+3,_=i.fromArray(o,3*E,Ut),M=i.fromArray(o,3*S,Bt),P=i.fromArray(o,3*O,Ft),b=i.fromArray(o,3*T,Wt);Math.abs(_.y)<x.EPSILON6&&(_.y=x.EPSILON6*(P.y<0?-1:1),M.y=_.y),Math.abs(P.y)<x.EPSILON6&&(P.y=x.EPSILON6*(_.y<0?-1:1),b.y=P.y);var N=y.attributes,A=y.indices,I=v.attributes,R=v.indices,z=w.lineSegmentPlane(_,P,zt,Gt);if(c(z)){var C=i.multiplyByScalar(i.UNIT_Y,5*x.EPSILON9,kt);_.y<0&&(i.negate(C,C),N=v.attributes,A=v.indices,I=y.attributes,R=y.indices);var D=i.add(z,C,Vt);for(N.position.values.push(_.x,_.y,_.z,M.x,M.y,M.z),N.position.values.push(D.x,D.y,D.z),N.position.values.push(D.x,D.y,D.z),i.negate(C,C),i.add(z,C,D),I.position.values.push(D.x,D.y,D.z),I.position.values.push(D.x,D.y,D.z),I.position.values.push(P.x,P.y,P.z,b.x,b.y,b.z),h=3*E;3*E+6>h;++h)N.prevPosition.values.push(u[h]);for(N.prevPosition.values.push(_.x,_.y,_.z,_.x,_.y,_.z),I.prevPosition.values.push(_.x,_.y,_.z,_.x,_.y,_.z),h=3*O;3*O+6>h;++h)I.prevPosition.values.push(u[h]);for(h=3*E;3*E+6>h;++h)N.nextPosition.values.push(s[h]);for(N.nextPosition.values.push(P.x,P.y,P.z,P.x,P.y,P.z),I.nextPosition.values.push(P.x,P.y,P.z,P.x,P.y,P.z),h=3*O;3*O+6>h;++h)I.nextPosition.values.push(s[h]);var L=n.fromArray(l,2*E,Lt),q=Math.abs(L.y);N.expandAndWidth.values.push(-1,q,1,q),N.expandAndWidth.values.push(-1,-q,1,-q),I.expandAndWidth.values.push(-1,q,1,q),I.expandAndWidth.values.push(-1,-q,1,-q);var U=i.magnitudeSquared(i.subtract(z,_,Wt));if(U/=i.magnitudeSquared(i.subtract(P,_,Wt)),c(m)){var B=a.fromArray(m,4*E,Ht),F=a.fromArray(m,4*O,Ht),W=x.lerp(B.x,F.x,U),G=x.lerp(B.y,F.y,U),k=x.lerp(B.z,F.z,U),V=x.lerp(B.w,F.w,U);for(h=4*E;4*E+8>h;++h)N.color.values.push(m[h]);for(N.color.values.push(W,G,k,V),N.color.values.push(W,G,k,V),I.color.values.push(W,G,k,V),I.color.values.push(W,G,k,V),h=4*O;4*O+8>h;++h)I.color.values.push(m[h])}if(c(p)){var H=n.fromArray(p,2*E,Lt),Y=n.fromArray(p,2*(f+3),qt),j=x.lerp(H.x,Y.x,U);for(h=2*E;2*E+4>h;++h)N.st.values.push(p[h]);for(N.st.values.push(j,H.y),N.st.values.push(j,Y.y),I.st.values.push(j,H.y),I.st.values.push(j,Y.y),h=2*O;2*O+4>h;++h)I.st.values.push(p[h])}d=N.position.values.length/3-4,A.push(d,d+2,d+1),A.push(d+1,d+2,d+3),d=I.position.values.length/3-4,R.push(d,d+2,d+1),R.push(d+1,d+2,d+3)}else{var J,K;for(_.y<0?(J=v.attributes,K=v.indices):(J=y.attributes,K=y.indices),J.position.values.push(_.x,_.y,_.z),J.position.values.push(M.x,M.y,M.z),J.position.values.push(P.x,P.y,P.z),J.position.values.push(b.x,b.y,b.z),h=3*f;3*f+12>h;++h)J.prevPosition.values.push(u[h]),J.nextPosition.values.push(s[h]);for(h=2*f;2*f+8>h;++h)J.expandAndWidth.values.push(l[h]),c(p)&&J.st.values.push(p[h]);if(c(m))for(h=4*f;4*f+16>h;++h)J.color.values.push(m[h]);d=J.position.values.length/3-4,K.push(d,d+2,d+1),K.push(d+1,d+2,d+3)}}X(e,v,y)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case T.TRIANGLES:e.indices=P(t);break;case T.TRIANGLE_STRIP:e.indices=b(t);break;case T.TRIANGLE_FAN:e.indices=N(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=T.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,n){t=s(t,"normal"),n=s(n,1e4);for(var i=e.attributes.position.values,a=e.attributes[t].values,o=i.length,l=new Float64Array(2*o),f=0,h=0;o>h;h+=3)l[f++]=i[h],l[f++]=i[h+1],l[f++]=i[h+2],l[f++]=i[h]+a[h]*n,l[f++]=i[h+1]+a[h+1]*n,l[f++]=i[h+2]+a[h+2]*n;var m,y=e.boundingSphere;return c(y)&&(m=new r(y.center,y.radius+n)),new d({attributes:{position:new p({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:T.LINES,boundingSphere:m})},tt.createAttributeLocations=function(e){var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,i={},a=0,o=r.length;for(t=0;o>t;++t){var u=r[t];c(n[u])&&(i[u]=a++)}for(var s in n)n.hasOwnProperty(s)&&!c(i[s])&&(i[s]=a++);return i},tt.reorderForPreVertexCache=function(e){var t=d.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),i=0;t>i;i++)n[i]=-1;for(var a,o=r,s=o.length,l=v.createTypedArray(t,s),f=0,h=0,p=0;s>f;)a=n[o[f]],-1!==a?l[h]=a:(a=o[f],n[a]=p,l[h]=p,++p),++f,++h;e.indices=l;var m=e.attributes;for(var y in m)if(m.hasOwnProperty(y)&&c(m[y])&&c(m[y].values)){for(var g=m[y],w=g.values,x=0,E=g.componentsPerAttribute,S=u.createTypedArray(g.componentDatatype,p*E);t>x;){var O=n[x];if(-1!==O)for(i=0;E>i;i++)S[E*O+i]=w[E*x+i];++x}g.values=S}}return e},tt.reorderForPostVertexCache=function(e,t){var r=e.indices;if(e.primitiveType===T.TRIANGLES&&c(r)){for(var n=r.length,i=0,a=0;n>a;a++)r[a]>i&&(i=r[a]);e.indices=_.tipsify({indices:r,maximumIndex:i,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],r=d.computeNumberOfVertices(e);if(c(e.indices)&&r>x.SIXTY_FOUR_KILOBYTES){var n,i=[],a=[],o=0,u=A(e.attributes),s=e.indices,l=s.length;e.primitiveType===T.TRIANGLES?n=3:e.primitiveType===T.LINES?n=2:e.primitiveType===T.POINTS&&(n=1);for(var f=0;l>f;f+=n){for(var h=0;n>h;++h){var p=s[f+h],m=i[p];c(m)||(m=o++,i[p]=m,I(u,e.attributes,p)),a.push(m)}o+n>x.SIXTY_FOUR_KILOBYTES&&(t.push(new d({attributes:u,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],a=[],o=0,u=A(e.attributes))}0!==a.length&&t.push(new d({attributes:u,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var rt=new i,nt=new o;tt.projectTo2D=function(e,t,r,n,a){var o=e.attributes[t];a=c(a)?a:new h;for(var s=a.ellipsoid,f=o.values,d=new Float64Array(f.length),m=0,y=0;y<f.length;y+=3){var v=i.fromArray(f,y,rt),g=s.cartesianToCartographic(v,nt);if(!c(g))throw new l("Could not project point ("+v.x+", "+v.y+", "+v.z+") to 2D.");var w=a.project(g,rt);d[m++]=w.x,d[m++]=w.y,d[m++]=w.z}return e.attributes[r]=o,e.attributes[n]=new p({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:d}),delete e.attributes[t],e};var it={high:0,low:0};tt.encodeAttribute=function(e,t,r,n){for(var i=e.attributes[t],a=i.values,o=a.length,s=new Float32Array(o),c=new Float32Array(o),l=0;o>l;++l)f.encode(a[l],it),s[l]=it.high,c[l]=it.low;var h=i.componentsPerAttribute;return e.attributes[r]=new p({componentDatatype:u.FLOAT,componentsPerAttribute:h,values:s}),e.attributes[n]=new p({componentDatatype:u.FLOAT,componentsPerAttribute:h,values:c}),delete e.attributes[t],e};var at=new i,ot=new S,ut=new E;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(S.equals(t,S.IDENTITY))return e;var n=e.geometry.attributes;R(t,n.position),R(t,n.prevPosition),R(t,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(S.inverse(t,ot),S.transpose(ot,ot),S.getRotation(ot,ut),z(ut,n.normal),z(ut,n.binormal),z(ut,n.tangent));var i=e.geometry.boundingSphere;return c(i)&&(e.geometry.boundingSphere=r.transform(i,t,i)),e.modelMatrix=S.clone(S.IDENTITY),e};var st=new i;tt.combineInstances=function(e){for(var t=[],r=[],n=e.length,i=0;n>i;++i){var a=e[i];c(a.geometry)?t.push(a):r.push(a)}var o=[];return t.length>0&&o.push(D(t,"geometry")),r.length>0&&(o.push(D(r,"westHemisphereGeometry")),o.push(D(r,"eastHemisphereGeometry"))),o};var ct=new i,lt=new i,ft=new i,ht=new i;tt.computeNormal=function(e){for(var t=e.indices,r=e.attributes,n=r.position.values,a=r.position.values.length/3,o=t.length,s=new Array(a),c=new Array(o/3),l=new Array(o),f=0;a>f;f++)s[f]={indexOffset:0,count:0,currentCount:0};var h=0;for(f=0;o>f;f+=3){var d=t[f],m=t[f+1],y=t[f+2],v=3*d,g=3*m,w=3*y;lt.x=n[v],lt.y=n[v+1],lt.z=n[v+2],ft.x=n[g],ft.y=n[g+1],ft.z=n[g+2],ht.x=n[w],ht.y=n[w+1],ht.z=n[w+2],s[d].count++,s[m].count++,s[y].count++,i.subtract(ft,lt,ft),i.subtract(ht,lt,ht),c[h]=i.cross(ft,ht,new i),h++}var x=0;for(f=0;a>f;f++)s[f].indexOffset+=x,x+=s[f].count;h=0;var E;for(f=0;o>f;f+=3){E=s[t[f]];var S=E.indexOffset+E.currentCount;l[S]=h,E.currentCount++,E=s[t[f+1]],S=E.indexOffset+E.currentCount,l[S]=h,E.currentCount++,E=s[t[f+2]],S=E.indexOffset+E.currentCount,l[S]=h,E.currentCount++,h++}var O=new Float32Array(3*a);for(f=0;a>f;f++){var T=3*f;if(E=s[f],E.count>0){for(i.clone(i.ZERO,ct),h=0;h<E.count;h++)i.add(ct,c[l[E.indexOffset+h]],ct);i.normalize(ct,ct),O[T]=ct.x,O[T+1]=ct.y,O[T+2]=ct.z}else O[T]=0,O[T+1]=0,O[T+2]=1}return e.attributes.normal=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:O}),e};var dt=new i,pt=new i,mt=new i;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,r=e.attributes.position.values,n=e.attributes.normal.values,a=e.attributes.st.values,o=e.attributes.position.values.length/3,s=t.length,c=new Array(3*o),l=0;l<c.length;l++)c[l]=0;var f,h,d;for(l=0;s>l;l+=3){var m=t[l],y=t[l+1],v=t[l+2];f=3*m,h=3*y,d=3*v;var g=2*m,w=2*y,x=2*v,E=r[f],S=r[f+1],O=r[f+2],T=a[g],_=a[g+1],M=a[w+1]-_,P=a[x+1]-_,b=1/((a[w]-T)*P-(a[x]-T)*M),N=(P*(r[h]-E)-M*(r[d]-E))*b,A=(P*(r[h+1]-S)-M*(r[d+1]-S))*b,I=(P*(r[h+2]-O)-M*(r[d+2]-O))*b;c[f]+=N,c[f+1]+=A,c[f+2]+=I,c[h]+=N,c[h+1]+=A,c[h+2]+=I,c[d]+=N,c[d+1]+=A,c[d+2]+=I}var R=new Float32Array(3*o),z=new Float32Array(3*o);for(l=0;o>l;l++){f=3*l,h=f+1,d=f+2;var C=i.fromArray(n,f,dt),D=i.fromArray(c,f,mt),L=i.dot(C,D);i.multiplyByScalar(C,L,pt),i.normalize(i.subtract(D,pt,D),D),z[f]=D.x,z[h]=D.y,z[d]=D.z,i.normalize(i.cross(C,D,D),D),R[f]=D.x,R[h]=D.y,R[d]=D.z}return e.attributes.tangent=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:z}),e.attributes.binormal=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:R}),e};var yt=new n,vt=new i,gt=new i,wt=new i;tt.compressVertices=function(t){var r=t.attributes.normal,a=t.attributes.st;if(!c(r)&&!c(a))return t;var o,s,l,f,h=t.attributes.tangent,d=t.attributes.binormal;c(r)&&(o=r.values),c(a)&&(s=a.values),c(h)&&(l=h.values),d&&(f=d.values);var m=c(o)?o.length:s.length,y=c(o)?3:2,v=m/y,g=v,w=c(s)&&c(o)?2:1;w+=c(l)||c(f)?1:0,g*=w;for(var x=new Float32Array(g),E=0,S=0;v>S;++S){c(s)&&(n.fromArray(s,2*S,yt),x[E++]=e.compressTextureCoordinates(yt));var O=3*S;c(o)&&c(l)&&c(f)?(i.fromArray(o,O,vt),i.fromArray(l,O,gt),i.fromArray(f,O,wt),e.octPack(vt,gt,wt,yt),x[E++]=yt.x,x[E++]=yt.y):(c(o)&&(i.fromArray(o,O,vt),x[E++]=e.octEncodeFloat(vt)),c(l)&&(i.fromArray(l,O,vt),x[E++]=e.octEncodeFloat(vt)),c(f)&&(i.fromArray(f,O,vt),x[E++]=e.octEncodeFloat(vt)))}return t.attributes.compressedAttributes=new p({componentDatatype:u.FLOAT,componentsPerAttribute:w,values:x}),c(o)&&delete t.attributes.normal,c(s)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var xt=new i,Et=new i,St=new i,Ot=new i,Tt=new i,_t={positions:new Array(7),indices:new Array(9)},Mt=new i,Pt=new i,bt=new i,Nt=new i,At=new n,It=new n,Rt=new n,zt=O.fromPointNormal(i.ZERO,i.UNIT_Y),Ct=new i,Dt=new i,Lt=new n,qt=new n,Ut=new i,Bt=new i,Ft=new i,Wt=new i,Gt=new i,kt=new i,Vt=new i,Ht=new a;return new a,tt.splitLongitude=function(e){var t=e.geometry,n=t.boundingSphere;if(c(n)){var i=n.center.x-n.radius;if(i>0||r.intersectPlane(n,O.ORIGIN_ZX_PLANE)!==g.INTERSECTING)return e}if(t.geometryType!==y.NONE)switch(t.geometryType){case y.POLYLINES:et(e);break;case y.TRIANGLES:Q(e);break;case y.LINES:$(e)}else G(t),t.primitiveType===T.TRIANGLES?Q(e):t.primitiveType===T.LINES&&$(e);return e},tt}),define("Core/PolygonGeometryLibrary",["./Cartesian3","./defaultValue","./defined","./Ellipsoid"],function(e,t,r,n){"use strict";function i(t,r,n,i){return e.subtract(r,t,o),e.multiplyByScalar(o,n/i,o),e.add(t,o,o),[o.x,o.y,o.z]}var a={};a.computeHierarchyPackedLength=function(t){for(var n=0,i=[t];i.length>0;){var a=i.pop();if(r(a)){n+=2;var o=a.positions,u=a.holes;if(r(o)&&(n+=o.length*e.packedLength),r(u))for(var s=u.length,c=0;s>c;++c)i.push(u[c])}}return n},a.packPolygonHierarchy=function(t,n,i){for(var a=[t];a.length>0;){var o=a.pop();if(r(o)){var u=o.positions,s=o.holes;if(n[i++]=r(u)?u.length:0,n[i++]=r(s)?s.length:0,r(u))for(var c=u.length,l=0;c>l;++l,i+=3)e.pack(u[l],n,i);if(r(s))for(var f=s.length,h=0;f>h;++h)a.push(s[h])}}return i},a.unpackPolygonHierarchy=function(t,r){for(var n=t[r++],i=t[r++],o=new Array(n),u=i>0?new Array(i):void 0,s=0;n>s;++s,r+=e.packedLength)o[s]=e.unpack(t,r);for(var c=0;i>c;++c)u[c]=a.unpackPolygonHierarchy(t,r),r=u[c].startingIndex,delete u[c].startingIndex;return{positions:o,holes:u,startingIndex:r}};var o=new e;a.subdivideLineCount=function(t,r,n){var i=e.distance(t,r),a=i/n,o=Math.max(0,Math.ceil(Math.log(a)/Math.log(2)));return Math.pow(2,o)},a.subdivideLine=function(t,n,o,u){var s=a.subdivideLineCount(t,n,o),c=e.distance(t,n),l=c/s;r(u)||(u=[]);var f=u;f.length=3*s;for(var h=0,d=0;s>d;d++){var p=i(t,n,d*l,c);f[h++]=p[0],f[h++]=p[1],f[h++]=p[2]}return f};var u=new e,s=new e,c=new e,l=new e;return a.scaleToGeodeticHeightExtruded=function(i,a,o,f,h){f=t(f,n.WGS84);var d=u,p=s,m=c,y=l;if(r(i)&&r(i.attributes)&&r(i.attributes.position))for(var v=i.attributes.position.values,g=v.length/2,w=0;g>w;w+=3)e.fromArray(v,w,m),f.geodeticSurfaceNormal(m,d),y=f.scaleToGeodeticSurface(m,y),p=e.multiplyByScalar(d,o,p),p=e.add(y,p,p),v[w+g]=p.x,v[w+1+g]=p.y,v[w+2+g]=p.z,h&&(y=e.clone(m,y)),p=e.multiplyByScalar(d,a,p),p=e.add(y,p,p),v[w]=p.x,v[w+1]=p.y,v[w+2]=p.z;return i},a}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var r=new t,n=function(t,n,i,a){return e(t,n,i,a,r),r.x>0&&r.y>0&&r.z>0};return n}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,r,n,i,a,o,u){"use strict";function s(e){var t=e._uSquared,r=e._ellipsoid.maximumRadius,n=e._ellipsoid.minimumRadius,i=(r-n)/r,a=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-i)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,a),f=s*o,h=f*f,d=1-h,p=Math.sqrt(d),m=t/4,y=m*m,v=y*m,g=y*y,w=1+m-3*y/4+5*v/4-175*g/64,x=1-m+15*y/8-35*v/8,E=1-3*m+35*y/4,S=1-5*m,O=w*l-x*Math.sin(2*l)*m/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,T=e._constants;T.a=r,T.b=n,T.f=i,T.cosineHeading=a,T.sineHeading=o,T.tanU=u,T.cosineU=s,T.sineU=c,T.sigma=l,T.sineAlpha=f,T.sineSquaredAlpha=h,T.cosineSquaredAlpha=d,T.cosineAlpha=p,T.u2Over4=m,T.u4Over16=y,T.u6Over64=v,T.u8Over256=g,T.a0=w,T.a1=x,T.a2=E,T.a3=S,T.distanceRatio=O}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,r,n,i,a,o){var u=c(e,r);return(1-u)*e*t*(n+u*i*(o+u*a*(2*o*o-1)))}function f(e,t,r,n,i,a,o){var s,c,f,h,d,p=(t-r)/t,m=a-n,y=Math.atan((1-p)*Math.tan(i)),v=Math.atan((1-p)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,O=g*E,T=w*E,_=w*x,M=m,P=u.TWO_PI,b=Math.cos(M),N=Math.sin(M);do{b=Math.cos(M),N=Math.sin(M);var A=O-_*b;f=Math.sqrt(x*x*N*N+A*A),c=T+S*b,s=Math.atan2(f,c);var I;0===f?(I=0,h=1):(I=S*N/f,h=1-I*I),P=M,d=c-2*T/h,isNaN(d)&&(d=0),M=m+l(p,I,h,s,f,c,d)}while(Math.abs(M-P)>u.EPSILON12);var R=h*(t*t-r*r)/(r*r),z=1+R*(4096+R*(R*(320-175*R)-768))/16384,C=R*(256+R*(R*(74-47*R)-128))/1024,D=d*d,L=C*f*(d+C*(c*(2*D-1)-C*d*(4*f*f-3)*(4*D-3)/6)/4),q=r*z*(s-L),U=Math.atan2(x*N,O-_*b),B=Math.atan2(g*N,O*b-_);e._distance=q,e._startHeading=U,e._endHeading=B,e._uSquared=R}function h(r,n,i,a){e.normalize(a.cartographicToCartesian(n,p),d),e.normalize(a.cartographicToCartesian(i,p),p),f(r,a.maximumRadius,a.minimumRadius,n.longitude,n.latitude,i.longitude,i.latitude),r._start=t.clone(n,r._start),r._end=t.clone(i,r._end),r._start.height=0,r._end.height=0,s(r)}var d=new e,p=new e,m=function(e,i,a){var u=r(a,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,n(e)&&n(i)&&h(this,e,i,u)};return i(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),m.prototype.setEndPoints=function(e,t){h(this,e,t,this._ellipsoid)},m.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},m.prototype.interpolateUsingSurfaceDistance=function(e,r){var i=this._constants,a=i.distanceRatio+e/i.b,o=Math.cos(2*a),u=Math.cos(4*a),s=Math.cos(6*a),c=Math.sin(2*a),f=Math.sin(4*a),h=Math.sin(6*a),d=Math.sin(8*a),p=a*a,m=a*p,y=i.u8Over256,v=i.u2Over4,g=i.u6Over64,w=i.u4Over16,x=2*m*y*o/3+a*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*f-p*((g-11*y/2)*c+5*y*f/2)+(29*g/96-29*y/16)*h+539*y*d/1536,E=Math.asin(Math.sin(x)*i.cosineAlpha),S=Math.atan(i.a/i.b*Math.tan(E));x-=i.sigma;var O=Math.cos(2*i.sigma+x),T=Math.sin(x),_=Math.cos(x),M=i.cosineU*_,P=i.sineU*T,b=Math.atan2(T*i.sineHeading,M-P*i.cosineHeading),N=b-l(i.f,i.sineAlpha,i.cosineSquaredAlpha,x,T,_,O);return n(r)?(r.longitude=this._start.longitude+N,r.latitude=S,r.height=0,r):new t(this._start.longitude+N,S,0)},m}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,r,n,i,a,o,u,s,c,l,f){"use strict";function h(e,t,r){var n=T;n.length=e;var i;if(t===r){for(i=0;e>i;i++)n[i]=t;return n}var a=r-t,o=a/e;for(i=0;e>i;i++){var u=t+i*o;n[i]=u}return n}function d(t,r,n,i,a,o,u,s){var c=i.scaleToGeodeticSurface(t,b),l=i.scaleToGeodeticSurface(r,N),f=p.numberOfPoints(t,r,n),d=i.cartesianToCartographic(c,_),m=i.cartesianToCartographic(l,M),y=h(f,a,o);A.setEndPoints(d,m);var v=A.surfaceDistance/f,g=s;d.height=a;var w=i.cartographicToCartesian(d,P);e.pack(w,u,g),g+=3;for(var x=1;f>x;x++){var E=A.interpolateUsingSurfaceDistance(x*v,M);E.height=y[x],w=i.cartographicToCartesian(E,P),e.pack(w,u,g),g+=3}return g}var p={};p.numberOfPoints=function(t,r,n){var i=e.distance(t,r);return Math.ceil(i/n)};var m=new t;p.extractHeights=function(e,t){for(var r=e.length,n=new Array(r),i=0;r>i;i++){var a=e[i];n[i]=t.cartesianToCartographic(a,m).height}return n};var y=new l,v=new e,g=new e,w=new f(e.ZERO,0),x=new e,E=new f(e.ZERO,0),S=new e,O=new e,T=[],_=new t,M=new t,P=new e,b=new e,N=new e,A=new o;p.wrapLongitude=function(t,i){var a=[],o=[];if(n(t)&&t.length>0){i=r(i,l.IDENTITY);var s=l.inverseTransformation(i,y),c=l.multiplyByPoint(s,e.ZERO,v),h=l.multiplyByPointAsVector(s,e.UNIT_Y,g),d=f.fromPointNormal(c,h,w),p=l.multiplyByPointAsVector(s,e.UNIT_X,x),m=f.fromPointNormal(c,p,E),T=1;a.push(e.clone(t[0]));for(var _=a[0],M=t.length,P=1;M>P;++P){var b=t[P];if(f.getPointDistance(m,_)<0||f.getPointDistance(m,b)<0){var N=u.lineSegmentPlane(_,b,d,S);if(n(N)){var A=e.multiplyByScalar(h,5e-9,O);f.getPointDistance(d,_)<0&&e.negate(A,A),a.push(e.add(N,A,new e)),o.push(T+1),e.negate(A,A),a.push(e.add(N,A,new e)),T=1}}a.push(e.clone(t[P])),T++,_=b}o.push(T)}return{positions:a,lengths:o}};var I=c.EPSILON7;return p.removeDuplicates=function(t){var r=t.length;if(2>r)return t;var n,i,a;for(n=1;r>n&&(i=t[n-1],a=t[n],!e.equalsEpsilon(i,a,I));++n);if(n===r)return t;for(var o=t.slice(0,n);r>n;++n)a=t[n],e.equalsEpsilon(i,a,I)||(o.push(e.clone(a)),i=a);return o},p.generateArc=function(t){n(t)||(t={});var i=t.positions,o=i.length,u=r(t.ellipsoid,a.WGS84),l=r(t.height,0);if(1>o)return[];if(1===o){var f=u.scaleToGeodeticSurface(i[0],b);if(0!==l){var h=u.geodeticSurfaceNormal(f,P);e.multiplyByScalar(h,l,h),e.add(f,h,f)}return[f.x,f.y,f.z]}var m=t.minDistance;if(!n(m)){var y=r(t.granularity,c.RADIANS_PER_DEGREE);m=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=p.numberOfPoints(i[v],i[v+1],m);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var O=i[v],M=i[v+1],N=S?l[v]:l,A=S?l[v+1]:l;E=d(O,M,m,u,N,A,x,E)}T.length=0;var I=i[o-1],R=u.cartesianToCartographic(I,_);R.height=S?l[o-1]:l;var z=u.cartographicToCartesian(R,P);return e.pack(z,x,w-3),x},p.generateCartesianArc=function(t){for(var r=p.generateArc(t),n=r.length/3,i=new Array(n),a=0;n>a;a++)i[a]=e.unpack(r,3*a);return i},p}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,r=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,r},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,r,n,i,a,o,u,s,c,l,f,h,d,p,m){"use strict";function y(t,r,n){var i=e.subtract(r,t,L),a=e.subtract(n,r,q); -return i.x*a.y-i.y*a.x>=0}function v(e){for(var t=e[0].x,r=0,n=0;n<e.length;n++)e[n].x>t&&(t=e[n].x,r=n);return r}function g(e){for(var t=e[0][0].x,r=0,n=0;n<e.length;n++){var i=e[n][v(e[n])].x;i>t&&(t=i,r=n)}return r}function w(e){for(var t=[],r=0;r<e.length;r++){var n=e[(r-1+e.length)%e.length],i=e[r],a=e[(r+1)%e.length];y(n,i,a)||t.push(i)}return t}function x(t,r){for(var n=0;n<t.length;n++)if(e.equals(r,t[n]))return n;return-1}function E(r,i,a){a=n(a,[]);var o=Number.MAX_VALUE,u=v(i),s=new e(i[u].x,r.y);a.push(u),a.push((u+1)%i.length);for(var c=i[0].x,l=c,f=1;f<i.length;++f)i[f].x<c?c=i[f].x:i[f].x>l&&(l=i[f].x);l+=l-c;var h=new t(l,r.y,0);for(f=0;f<i.length;f++){var d=i[f],p=i[(f+1)%i.length];if((d.x>=r.x||p.x>=r.x)&&(d.y>=r.y&&p.y<=r.y||d.y<=r.y&&p.y>=r.y)){var m=(p.y-d.y)*(h.x-r.x)-(p.x-d.x)*(h.y-r.y);if(0!==m){m=1/m;var y=((p.x-d.x)*(r.y-d.y)-(p.y-d.y)*(r.x-d.x))*m,g=((h.x-r.x)*(r.y-d.y)-(h.y-r.y)*(r.x-d.x))*m;if(y>=0&&1>=y&&g>=0&&1>=g){var w=new e(r.x+y*(h.x-r.x),r.y+y*(h.y-r.y)),x=e.subtract(w,r,U);m=e.magnitudeSquared(x),o>m&&(s=w,o=m,a[0]=f,a[1]=(f+1)%i.length)}}}}return s}function S(t,r){var n=g(r),i=r[n],a=v(i),o=i[a],u=[],s=E(o,t,u),c=x(t,s);if(-1!==c)return c;var h=e.magnitudeSquared(e.subtract(t[u[0]],o,B)),d=e.magnitudeSquared(e.subtract(t[u[1]],o,B)),p=d>h?t[u[0]]:t[u[1]],m=w(t),y=m.indexOf(p);-1!==y&&m.splice(y,1);for(var S=[],O=0;O<m.length;O++){var T=m[O];f(T,o,s,p)&&S.push(T)}var _=Number.MAX_VALUE;if(S.length>0){var M=e.fromElements(1,0,B);for(O=0;O<S.length;O++){var P=e.subtract(S[O],o,F),b=e.magnitude(M)*e.magnitudeSquared(P);if(0!==b){var N=Math.abs(l.acosClamped(e.dot(M,P)/b));_>N&&(_=N,p=S[O])}}}return t.indexOf(p)}function O(e,r,n){for(var i=et.computeWindingOrder2D(e),a=0;a<r.length;a++){var o=r[a];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=et.computeWindingOrder2D(o);s===i&&o.reverse()}var c=u.fromPoints(e,n),l=c.projectPointsOntoPlane(e),f=[];for(a=0;a<r.length;a++)f.push(c.projectPointsOntoPlane(r[a]));var h=S(l,f),d=g(f),p=v(f[d]),m=r[d],y=[];for(a=0;a<e.length;a++)y.push(e[a]);var w,x=[];if(0!==p)for(w=0;w<=m.length;w++){var E=(w+p)%m.length;0!==E&&x.push(m[E])}else for(w=0;w<m.length;w++)x.push(m[(w+p)%m.length]);var O=y.lastIndexOf(e[h]);x.push(e[O]);var T=y.slice(0,O+1),_=y.slice(O+1);return y=T.concat(x,_),r.splice(d,1),y}function T(e){var t=l.nextRandomNumber(),r=Math.floor(t*e);return r===e&&r--,r}function _(e,t,r,n){var i=n[e].position,a=n[t].position,o=n[r].position,u=o.x,s=o.y,c=i.x-u,l=i.y-s,f=a.x-u,h=a.y-s;return c*h-l*f}function M(e,t){return e.x*t.y-e.y*t.x}function P(e,t){var r=t.length,n=l.mod(e-1,r),i=l.mod(e+1,r);return 0===_(n,i,e,t)?!1:!0}function b(t,r){return e.magnitudeSquared(r)<e.magnitudeSquared(t)}function N(t,r,n){if(!P(t,n))return t;var i=n[t].position,a=n[r].position,o=n.length,u=l.mod(t-1,o);if(!P(u,n))return u;var s=l.mod(t+1,o);if(!P(s,n))return s;var c=e.subtract(n[u].position,i,k),f=e.subtract(n[s].position,i,V),h=e.subtract(a,i,H),d=M(c,h),p=M(f,h);if(0===d)return b(c,h)?W:G;if(0===p)return b(f,h)?W:G;var m=M(c,f);return 0>m?0>d&&p>0?W:G:m>0?d>0&&0>p?G:W:void 0}function A(e,t,r){return(e>t||e>r)&&(t>e||r>e)||t===r&&t===e}function I(t,r,n,i){var a=e.subtract(n,t,j),o=r.x*i.y-r.y*i.x,u=o*o,s=e.magnitudeSquared(r),c=e.magnitudeSquared(i);if(u>Y*s*c){var l=(a.x*i.y-a.y*i.x)/o;return e.add(t,e.multiplyByScalar(r,l,j),j)}return void 0}function R(t,r,n){for(var a=e.subtract(r,t,Z),o=n.length,u=0;o>u;u++){var s=n[u].position,c=n[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(r,c)||e.equals(t,c)||e.equals(r,s))){var f=e.subtract(c,s,X),h=I(t,a,s,f);if(i(h)&&!(e.equals(h,t)||e.equals(h,r)||e.equals(h,s)||e.equals(h,c))){var d=h.x,p=h.y,m=A(d,t.x,r.x)&&A(p,t.y,r.y)&&A(d,s.x,c.x)&&A(p,s.y,c.y);if(m)return!0}}}return!1}function z(t,r,n){var i=N(t,r,n);if(i>=0)return i;var a=N(r,t,n);return a>=0?a:i!==W||a!==W||R(n[t].position,n[r].position,n)||e.equals(n[t].position,n[r].position)?K:J}function C(e){return 0===_(1,2,0,e)}function D(e){var t=e.length;if(3===t)return C(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new a("Invalid polygon: must have at least three vertices.");for(var r,n,i=0,o=10*e.length,u=K;J>u&&i++<o;){for(r=T(e.length),n=r+1;Math.abs(r-n)<2||Math.abs(r-n)>e.length-2;)n=T(e.length);if(r>n){var s=r;r=n,n=s}u=z(r,n,e)}if(u===J){var c=e.splice(r,n-r+1,e[r],e[n]);return D(e).concat(D(c))}return u>=0?(e.splice(u,1),D(e)):[]}var L=new e,q=new e,U=new e,B=new e(1,0),F=new e,W=-1,G=-2,k=new t,V=new t,H=new t,Y=l.EPSILON14,j=new e;new e;var Z=new e,X=new e,J=-1,K=-2,Q=new t,$=new t,et={};et.removeDuplicates=function(e){var r=h.removeDuplicates(e);return t.equals(r[0],r[r.length-1])?r.slice(1):r},et.computeArea2D=function(e){for(var t=e.length,r=0,n=t-1,i=0;t>i;n=i++){var a=e[n],o=e[i];r+=a.x*o.y-o.x*a.y}return.5*r},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?m.COUNTER_CLOCKWISE:m.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,r=[],n=0;t>n;++n)r[n]={position:e[n],index:n};return D(r)};var tt=new t,rt=new t,nt=new t,it=new t,at=new t,ot=new t,ut=new t;return et.computeSubdivision=function(e,a,o,u){u=n(u,l.RADIANS_PER_DEGREE);var f,h=o.slice(0),p=a.length,m=new Array(3*p),y=0;for(f=0;p>f;f++){var v=a[f];m[y++]=v.x,m[y++]=v.y,m[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;h.length>0;){var O,T,_=h.pop(),M=h.pop(),P=h.pop(),b=t.fromArray(m,3*P,tt),N=t.fromArray(m,3*M,rt),A=t.fromArray(m,3*_,nt),I=t.multiplyByScalar(t.normalize(b,it),x,it),R=t.multiplyByScalar(t.normalize(N,at),x,at),z=t.multiplyByScalar(t.normalize(A,ot),x,ot),C=t.magnitudeSquared(t.subtract(I,R,ut)),D=t.magnitudeSquared(t.subtract(R,z,ut)),L=t.magnitudeSquared(t.subtract(z,I,ut)),q=Math.max(C,D,L);q>S?C===q?(O=Math.min(P,M)+" "+Math.max(P,M),f=w[O],i(f)||(T=t.add(b,N,ut),t.multiplyByScalar(T,.5,T),m.push(T.x,T.y,T.z),f=m.length/3-1,w[O]=f),h.push(P,f,_),h.push(f,M,_)):D===q?(O=Math.min(M,_)+" "+Math.max(M,_),f=w[O],i(f)||(T=t.add(N,A,ut),t.multiplyByScalar(T,.5,T),m.push(T.x,T.y,T.z),f=m.length/3-1,w[O]=f),h.push(M,f,P),h.push(f,_,P)):L===q&&(O=Math.min(_,P)+" "+Math.max(_,P),f=w[O],i(f)||(T=t.add(A,b,ut),t.multiplyByScalar(T,.5,T),m.push(T.x,T.y,T.z),f=m.length/3-1,w[O]=f),h.push(_,f,M),h.push(f,P,M)):(g.push(P),g.push(M),g.push(_))}return new s({attributes:{position:new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:m})},indices:g,primitiveType:d.TRIANGLES})},et.scaleToGeodeticHeight=function(e,r,a,u){a=n(a,o.WGS84);var s=Q,c=$;if(r=n(r,0),u=n(u,!0),i(e)&&i(e.attributes)&&i(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,h=0;f>h;h+=3)t.fromArray(l,h,c),u&&(c=a.scaleToGeodeticSurface(c,c)),s=a.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,r,s),t.add(c,s,c),l[h]=c.x,l[h+1]=c.y,l[h+2]=c.z;return e},et.eliminateHoles=function(e,r,i){i=n(i,o.WGS84);for(var a=[],u=0;u<r.length;u++){for(var s=[],c=0;c<r[u].length;c++)s.push(t.clone(r[u][c]));a.push(s)}for(var l=e;a.length>0;)l=O(l,a,i);return l},et}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return i.POSITION_ONLY=n(new i({position:!0})),i.POSITION_AND_NORMAL=n(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=n(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=n(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=n(new i({position:!0,color:!0})),i.ALL=n(new i({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.position?1:0,r[n++]=t.normal?1:0,r[n++]=t.st?1:0,r[n++]=t.binormal?1:0,r[n++]=t.tangent?1:0,r[n++]=t.color?1:0},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.position=1===r[n++],a.normal=1===r[n++],a.st=1===r[n++],a.binormal=1===r[n++],a.tangent=1===r[n++],a.color=1===r[n++],a},i.clone=function(e,r){return t(e)?(t(r)||(r=new i),r.position=e.position,r.normal=e.normal,r.st=e.st,r.binormal=e.binormal,r.tangent=e.tangent,r.color=e.color,r):void 0},i}),define("Core/PolygonGeometry",["./BoundingRectangle","./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix3","./PolygonGeometryLibrary","./PolygonPipeline","./PrimitiveType","./Quaternion","./Queue","./VertexFormat","./WindingOrder"],function(e,t,r,n,i,a,o,u,s,c,l,f,h,d,p,m,y,v,g,w,x,E,S,O,T){"use strict";function _(e,t,r,i){for(var a=E.fromAxisAngle(e._plane.normal,r,R),u=v.fromQuaternion(a,z),s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY,h=t.length,d=0;h>d;++d){var p=n.clone(t[d],I);v.multiplyByVector(u,p,p);var m=e.projectPointOntoPlane(p,A);o(m)&&(s=Math.min(s,m.x),c=Math.max(c,m.x),l=Math.min(l,m.y),f=Math.max(f,m.y))}return i.x=s,i.y=l,i.width=c-s,i.height=f-l,i}function M(e,t,r,n){var a=c.fromPoints(t,e),o=a.projectPointsOntoPlane(t,C),u=w.computeWindingOrder2D(o);u===T.CLOCKWISE&&(o.reverse(),t.reverse());var s=w.triangulate(o);s.length<3&&(s=[0,1,2]);var h;if(n){for(var p=t.length,m=new Array(3*p),y=0,v=0;p>v;v++){var g=t[v];m[y++]=g.x,m[y++]=g.y,m[y++]=g.z}h=new l({attributes:{position:new f({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:m})},indices:s,primitiveType:x.TRIANGLES})}else h=w.computeSubdivision(e,t,s,r);return new d({geometry:h})}function P(e,t,a,o,u,s,l){if(e.st||e.normal||e.tangent||e.binormal){var h=c.fromPoints(a,o),d=_(h,a,u,D),p=G;p.x=d.x,p.y=d.y;var m=t.attributes.position.values,g=m.length,w=e.st?new Float32Array(2*(g/3)):void 0,x=e.normal?new Float32Array(g):void 0,S=e.tangent?new Float32Array(g):void 0,O=e.binormal?new Float32Array(g):void 0,T=0,M=0,P=q,b=U,N=B,A=!0,I=E.fromAxisAngle(h._plane.normal,u,H),R=v.fromQuaternion(I,Y),z=g/2,C=g/3;s&&(g/=2);for(var j=0;g>j;j+=3){var Z=n.fromArray(m,j,V);if(e.st){var X=v.multiplyByVector(R,Z,L),J=h.projectPointOntoPlane(X,k);r.subtract(J,p,J),s&&(w[T+C]=J.x/d.width,w[T+1+C]=J.y/d.height),w[T]=J.x/d.width,w[T+1]=J.y/d.height,T+=2}if(e.normal||e.tangent||e.binormal){var K=M+1,Q=M+2;if(l){if(g>j+3){var $=n.fromArray(m,j+3,F);if(A){var et=n.fromArray(m,j+g,W);n.subtract($,Z,$),n.subtract(et,Z,et),P=n.normalize(n.cross(et,$,P),P),A=!1}n.equalsEpsilon($,Z,y.EPSILON10)&&(A=!0)}(e.tangent||e.binormal)&&(N=o.geodeticSurfaceNormal(Z,N),e.tangent&&(b=n.normalize(n.cross(N,P,b),b)))}else P=o.geodeticSurfaceNormal(Z,P),(e.tangent||e.binormal)&&(b=n.cross(n.UNIT_Z,P,b),b=n.normalize(v.multiplyByVector(R,b,b),b),e.binormal&&(N=n.normalize(n.cross(P,b,N),N)));e.normal&&(s&&!l?(x[M+z]=-P.x,x[K+z]=-P.y,x[Q+z]=-P.z):(x[M+z]=P.x,x[K+z]=P.y,x[Q+z]=P.z),x[M]=P.x,x[K]=P.y,x[Q]=P.z),e.tangent&&(s&&!l?(S[M+z]=-b.x,S[K+z]=-b.y,S[Q+z]=-b.z):(S[M+z]=b.x,S[K+z]=b.y,S[Q+z]=b.z),S[M]=b.x,S[K]=b.y,S[Q]=b.z),e.binormal&&(s&&(O[M+z]=N.x,O[K+z]=N.y,O[Q+z]=N.z),O[M]=N.x,O[K]=N.y,O[Q]=N.z),M+=3}}e.st&&(t.attributes.st=new f({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:w})),e.normal&&(t.attributes.normal=new f({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:x})),e.tangent&&(t.attributes.tangent=new f({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:S})),e.binormal&&(t.attributes.binormal=new f({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:O}))}return t}function b(e,t,r,a){var o,u,s,c,d,p=e.length,v=0;if(a)for(u=2*3*p,o=new Array(2*u),s=0;p>s;s++)c=e[s],d=e[(s+1)%p],o[v]=o[v+u]=c.x,++v,o[v]=o[v+u]=c.y,++v,o[v]=o[v+u]=c.z,++v,o[v]=o[v+u]=d.x,++v,o[v]=o[v+u]=d.y,++v,o[v]=o[v+u]=d.z,++v;else{var w=y.chordLength(r,t.maximumRadius),E=0;for(s=0;p>s;s++)E+=g.subdivideLineCount(e[s],e[(s+1)%p],w);for(u=3*(E+p),o=new Array(2*u),s=0;p>s;s++){c=e[s],d=e[(s+1)%p];for(var S=g.subdivideLine(c,d,w,j),O=S.length,T=0;O>T;++T,++v)o[v]=S[T],o[v+u]=S[T];o[v]=d.x,o[v+u]=d.x,++v,o[v]=d.y,o[v+u]=d.y,++v,o[v]=d.z,o[v+u]=d.z,++v}}p=o.length;var _=m.createTypedArray(p/3,p-6*e.length),M=0;for(p/=6,s=0;p>s;s++){var P=s,b=P+1,N=P+p,A=N+1;c=n.fromArray(o,3*P,F),d=n.fromArray(o,3*b,W),n.equalsEpsilon(c,d,y.EPSILON14)||(_[M++]=P,_[M++]=N,_[M++]=b,_[M++]=b,_[M++]=N,_[M++]=A)}return new l({attributes:new h({position:new f({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:o})}),indices:_,primitiveType:x.TRIANGLES})}function N(e,t,r,n,a){var o=M(e,t,r,a).geometry,u=o.attributes.position.values,s=o.indices,p=u.concat(u),y=p.length/3,v=m.createTypedArray(y,2*s.length);v.set(s);var g,x=s.length,E=y/2;for(g=0;x>g;g+=3){var S=v[g]+E,O=v[g+1]+E,_=v[g+2]+E;v[g+x]=_,v[g+1+x]=O,v[g+2+x]=S}var P=new l({attributes:new h({position:new f({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:p})}),indices:v,primitiveType:o.primitiveType}),N={topAndBottom:new d({geometry:P}),walls:[]},A=n.outerRing,I=c.fromPoints(A,e),R=I.projectPointsOntoPlane(A,Z),z=w.computeWindingOrder2D(R);z===T.CLOCKWISE&&A.reverse();var C=b(A,e,r,a);N.walls.push(new d({geometry:C}));var D=n.holes;for(g=0;g<D.length;g++){var L=D[g];I=c.fromPoints(L,e),R=I.projectPointsOntoPlane(L,Z),z=w.computeWindingOrder2D(R),z===T.COUNTER_CLOCKWISE&&L.reverse(),C=b(L,e,r),N.walls.push(new d({geometry:C}))}return N}var A=new r,I=new n,R=new E,z=new v,C=[],D=new e,L=new n,q=new n,U=new n,B=new n,F=new n,W=new n,G=new r,k=new r,V=new n,H=new E,Y=new v,j=[],Z=[],X=function(e){var t=e.polygonHierarchy,r=a(e.vertexFormat,O.DEFAULT),n=a(e.ellipsoid,s.WGS84),i=a(e.granularity,y.RADIANS_PER_DEGREE),u=a(e.stRotation,0),c=a(e.height,0),l=a(e.perPositionHeight,!1),f=e.extrudedHeight,h=o(f)&&(!y.equalsEpsilon(c,f,y.EPSILON6)||l);if(h){var d=f;f=Math.min(d,c),c=Math.max(d,c)}this._vertexFormat=O.clone(r),this._ellipsoid=s.clone(n),this._granularity=i,this._stRotation=u,this._height=c,this._extrudedHeight=a(f,0),this._extrude=h,this._polygonHierarchy=t,this._perPositionHeight=l,this._workerName="createPolygonGeometry",this.packedLength=g.computeHierarchyPackedLength(t)+s.packedLength+O.packedLength+7};X.fromPositions=function(e){e=a(e,a.EMPTY_OBJECT);var t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight};return new X(t)},X.pack=function(e,t,r){r=a(r,0),r=g.packPolygonHierarchy(e._polygonHierarchy,t,r),s.pack(e._ellipsoid,t,r),r+=s.packedLength,O.pack(e._vertexFormat,t,r),r+=O.packedLength,t[r++]=e._height,t[r++]=e._extrudedHeight,t[r++]=e._granularity,t[r++]=e._stRotation,t[r++]=e._extrude?1:0,t[r++]=e._perPositionHeight?1:0,t[r]=e.packedLength};var J=s.clone(s.UNIT_SPHERE),K=new O,Q={polygonHierarchy:{}};return X.unpack=function(e,t,r){t=a(t,0);var n=g.unpackPolygonHierarchy(e,t);t=n.startingIndex,delete n.startingIndex;var i=s.unpack(e,t,J);t+=s.packedLength;var u=O.unpack(e,t,K);t+=O.packedLength;var c=e[t++],l=e[t++],f=e[t++],h=e[t++],d=1===e[t++],p=1===e[t++],m=e[t];return o(r)||(r=new X(Q)),r._polygonHierarchy=n,r._ellipsoid=s.clone(i,r._ellipsoid),r._vertexFormat=O.clone(u,r._vertexFormat),r._height=c,r._extrudedHeight=l,r._granularity=f,r._stRotation=h,r._extrude=d,r._perPositionHeight=p,r.packedLength=m,r},X.createGeometry=function(e){var r,n,i,a=e._vertexFormat,u=e._ellipsoid,s=e._granularity,c=e._stRotation,f=e._height,h=e._extrudedHeight,d=e._extrude,y=e._polygonHierarchy,v=e._perPositionHeight,x=[],E=new S;E.enqueue(y),y=[];for(var O;0!==E.length;){var T=E.dequeue(),_=T.positions,b=T.holes;if(_=w.removeDuplicates(_),!(_.length<3)){var A=o(b)?b.length:0,I=[];for(O=0;A>O;O++){var R=b[O];if(R.positions=w.removeDuplicates(R.positions),!(R.positions.length<3)){I.push(R.positions);var z=0;o(R.holes)&&(z=R.holes.length);for(var C=0;z>C;C++)E.enqueue(R.holes[C])}}y.push({outerRing:_,holes:I});var D=I.length>0?w.eliminateHoles(_,I):_;x.push(D)}}if(0===x.length)return void 0;i=x[0];var L,q=[];if(d)for(O=0;O<x.length;O++){L=N(u,x[O],s,y[O],v),n=L.topAndBottom,n.geometry=g.scaleToGeodeticHeightExtruded(n.geometry,f,h,u,v),n.geometry=P(a,n.geometry,i,u,c,!0,!1),q.push(n),r=L.walls;for(var U=0;U<r.length;U++){var B=r[U];B.geometry=g.scaleToGeodeticHeightExtruded(B.geometry,f,h,u,v),B.geometry=P(a,B.geometry,i,u,c,!0,!0),q.push(B)}}else for(O=0;O<x.length;O++)L=M(u,x[O],s,v),L.geometry=w.scaleToGeodeticHeight(L.geometry,f,u,!v),L.geometry=P(a,L.geometry,i,u,c,!1,!1),q.push(L);L=p.combineInstances(q)[0],L.attributes.position.values=new Float64Array(L.attributes.position.values),L.indices=m.createTypedArray(L.attributes.position.values.length/3,L.indices);var F=L.attributes,W=t.fromVertices(F.position.values);return a.position||delete F.position,new l({attributes:F,indices:L.indices,primitiveType:L.primitiveType,boundingSphere:W})},X}),define("Workers/createPolygonGeometry",["../Core/defined","../Core/Ellipsoid","../Core/PolygonGeometry"],function(e,t,r){"use strict";function n(n,i){return e(i)&&(n=r.unpack(n,i)),n._ellipsoid=t.clone(n._ellipsoid),r.createGeometry(n)}return n})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createPolygonOutlineGeometry.js b/libs/Cesium/Workers/createPolygonOutlineGeometry.js deleted file mode 100644 index 11c23e3c..00000000 --- a/libs/Cesium/Workers/createPolygonOutlineGeometry.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(e){return e>0?1:0>e?-1:0},r.signNotZero=function(e){return 0>e?-1:1},r.toSNorm=function(e){return Math.round(255*(.5*r.clamp(e,-1,1)+.5))},r.fromSNorm=function(e){return 2*(r.clamp(e,0,255)/255)-1},r.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},r.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},r.lerp=function(e,t,r){return(1-r)*e+r*t},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(e){return e*r.RADIANS_PER_DEGREE},r.toDegrees=function(e){return e*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(e){var t=r.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},r.negativePiToPi=function(e){return r.zeroToTwoPi(e+r.PI)-r.PI},r.zeroToTwoPi=function(e){var t=r.mod(e,r.TWO_PI);return Math.abs(t)<r.EPSILON14&&Math.abs(e)>r.EPSILON14?r.TWO_PI:t},r.mod=function(e,t){return(e%t+t)%t},r.equalsEpsilon=function(e,r,n,a){a=t(a,n);var i=Math.abs(e-r);return a>=i||i<=n*Math.max(Math.abs(e),Math.abs(r))};var n=[1];r.factorial=function(e){var t=n.length;if(e>=t)for(var r=n[t-1],a=t;e>=a;a++)n.push(r*a);return n[e]},r.incrementWrap=function(e,r,n){return n=t(n,0),++e,e>r&&(e=n),e},r.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},r.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},r.clamp=function(e,t,r){return t>e?t:e>r?r:e};var a=new e;return r.setRandomNumberSeed=function(t){a=new e(t)},r.nextRandomNumber=function(){return a.random()},r.acosClamped=function(e){return Math.acos(r.clamp(e,-1,1))},r.asinClamped=function(e){return Math.asin(r.clamp(e,-1,1))},r.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},r}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0)};i.fromSpherical=function(r,n){t(n)||(n=new i);var a=r.clock,o=r.cone,u=e(r.magnitude,1),s=u*Math.sin(o);return n.x=s*Math.cos(a),n.y=s*Math.sin(a),n.z=u*Math.cos(o),n},i.fromElements=function(e,r,n,a){return t(a)?(a.x=e,a.y=r,a.z=n,a):new i(e,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n]=t.z},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n++],a.z=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var r=i.dot(s,c),n=i.magnitude(i.cross(s,c,s));return Math.atan2(n,r)};var l=new i;i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):r.y<=r.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)&&a.equalsEpsilon(e.z,r.z,n,i)},i.cross=function(e,t,r){var n=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-n*s,f=n*u-a*o;return r.x=c,r.y=l,r.z=f,r},i.fromDegrees=function(e,t,r,n,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,r,n,o)};var f=new i,d=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(r,n,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(n);f.x=c*Math.cos(r),f.y=c*Math.sin(r),f.z=Math.sin(n),f=i.normalize(f,f),i.multiplyComponents(s,f,d);var l=Math.sqrt(i.dot(f,d));return d=i.divideByScalar(d,l,d),f=i.multiplyByScalar(f,a,f),t(u)||(u=new i),i.add(d,f,u)},i.fromDegreesArray=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o++)n[o]=a.toRadians(e[o]);return i.fromRadiansArray(n,t,r)},i.fromRadiansArray=function(e,r,n){var a=e.length;t(n)?n.length=a/2:n=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];n[o/2]=i.fromRadians(u,s,0,r,n[o/2])}return n},i.fromDegreesArrayHeights=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o+=3)n[o]=a.toRadians(e[o]),n[o+1]=a.toRadians(e[o+1]),n[o+2]=e[o+2];return i.fromRadiansArrayHeights(n,t,r)},i.fromRadiansArrayHeights=function(e,r,n){var a=e.length;t(n)?n.length=a/3:n=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];n[o/3]=i.fromRadians(u,s,c,r,n[o/3])}return n},i.ZERO=n(new i(0,0,0)),i.UNIT_X=n(new i(1,0,0)),i.UNIT_Y=n(new i(0,1,0)),i.UNIT_Z=n(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n){this.longitude=e(t,0),this.latitude=e(r,0),this.height=e(n,0)};return i.fromRadians=function(r,n,a,o){return a=e(a,0),t(o)?(o.longitude=r,o.latitude=n,o.height=a,o):new i(r,n,a)},i.fromDegrees=function(e,t,r,n){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},i.equalsEpsilon=function(e,r,n){return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=n&&Math.abs(e.latitude-r.latitude)<=n&&Math.abs(e.height-r.height)<=n},i.ZERO=n(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";function s(t,n,a,i){n=r(n,0),a=r(a,0),i=r(i,0),t._radii=new e(n,a,i),t._radiiSquared=new e(n*n,a*a,i*i),t._radiiToTheFourth=new e(n*n*n*n,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===n?0:1/n,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(n,a,i),t._maximumRadius=Math.max(n,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,r)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,r){if(!n(t))return void 0;var a=t._radii;return n(r)?(e.clone(a,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return n(t)||(t=new c),n(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,n,a){a=r(a,0),e.pack(t._radii,n,a)},c.unpack=function(t,n,a){n=r(n,0);var i=e.unpack(t,n);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,r){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return n(r)||(r=new e),r.x=u,r.y=s,r.z=c,e.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(t,r){return n(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,r){var a=l,i=f;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),n(r)||(r=new e),e.add(i,a,r)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var a=0;r>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var d=new e,h=new e,p=new e;c.prototype.cartesianToCartographic=function(r,a){var i=this.scaleToGeodeticSurface(r,h);if(!n(i))return void 0;var o=this.geodeticSurfaceNormal(i,d),s=e.subtract(r,i,p),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,r))*e.magnitude(s);return n(a)?(a.longitude=c,a.latitude=l,a.height=f,a):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var a=0;r>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var m=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,r){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,d=a*a*c*c,h=i*i*l*l,p=o*o*f*f,v=d+h+p,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,m);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,r):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,O=x.z,M=y;M.x=2*w.x*E,M.y=2*w.y*S,M.z=2*w.z*O;var T,_,P,b,N,A,I,C,z,R,D,L=(1-g)*e.magnitude(t)/(.5*e.magnitude(M)),q=0;do{L-=q,P=1/(1+L*E),b=1/(1+L*S),N=1/(1+L*O),A=P*P,I=b*b,C=N*N,z=A*P,R=I*b,D=C*N,T=d*A+h*I+p*C-1,_=d*z*E+h*R*S+p*D*O;var U=-2*_;q=T/U}while(Math.abs(T)>u.EPSILON12);return n(r)?(r.x=a*P,r.y=i*b,r.z=o*N,r):new e(a*P,i*b,o*N)},c.prototype.scaleToGeocentricSurface=function(t,r){n(r)||(r=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,r)},c.prototype.transformPositionToScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},c.prototype.equals=function(t){return this===t||n(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},r=function(r,n){e(t[r])||(t[r]=!0,console.log(n))};return r}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,a,i,o){"use strict";var u=function(e){this._ellipsoid=r(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,r){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return n(r)?(r.x=i,r.y=o,r.z=u,r):new e(i,o,u)},u.prototype.unproject=function(e,r){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return n(r)?(r.longitude=i,r.latitude=o,r.height=u,r):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,r){this.start=e(t,0),this.stop=e(r,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n,a){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0),this.w=e(a,0)};i.fromElements=function(e,r,n,a,o){return t(o)?(o.x=e,o.y=r,o.z=n,o.w=a,o):new i(e,r,n,a)},i.fromColor=function(e,r){return t(r)?(r.x=e.red,r.y=e.green,r.z=e.blue,r.w=e.alpha,r):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n++]=t.z,r[n]=t.w},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n++],a.z=r[n++],a.w=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r.w=Math.min(e.w,t.w),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r.w=Math.max(e.w,t.w),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t.w=e.w/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,s);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?r.x<=r.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):r.y<=r.z?r.y<=r.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)&&a.equalsEpsilon(e.z,r.z,n,i)&&a.equalsEpsilon(e.w,r.w,n,i)},i.ZERO=n(new i(0,0,0,0)),i.UNIT_X=n(new i(1,0,0,0)),i.UNIT_Y=n(new i(0,1,0,0)),i.UNIT_Z=n(new i(0,0,1,0)),i.UNIT_W=n(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i){"use strict";function o(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function u(e){for(var t=0,r=0;3>r;++r){var n=e[c.getElementIndex(h[r],d[r])];t+=2*n*n}return Math.sqrt(t)}function s(e,t){for(var r=i.EPSILON15,n=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],d[o])]);u>n&&(a=o,n=u)}var s=1,l=0,f=d[a],p=h[a];if(Math.abs(e[c.getElementIndex(p,f)])>r){var m,y=e[c.getElementIndex(p,p)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(p,f)],w=(y-v)/2/g;m=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+m*m),l=m*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(p,p)]=s,t[c.getElementIndex(p,f)]=l,t[c.getElementIndex(f,p)]=-l,t}var c=function(e,r,n,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(r,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(n,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3],r[n++]=e[4],r[n++]=e[5],r[n++]=e[6],r[n++]=e[7],r[n++]=e[8]},c.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new c),a[0]=e[n++],a[1]=e[n++],a[2]=e[n++],a[3]=e[n++],a[4]=e[n++],a[5]=e[n++],a[6]=e[n++],a[7]=e[n++],a[8]=e[n++],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,n,a){return n=t(n,0),r(a)||(a=new c),a[0]=e[n],a[1]=e[n+1],a[2]=e[n+2],a[3]=e[n+3],a[4]=e[n+4],a[5]=e[n+5],a[6]=e[n+6],a[7]=e[n+7],a[8]=e[n+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var n=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,d=e.z*e.w,h=e.w*e.w,p=n-u-f+h,m=2*(a-d),y=2*(i+l),v=2*(a+d),g=-n+u-f+h,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-n-u+f+h;return r(t)?(t[0]=p,t[1]=v,t[2]=x,t[3]=m,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(p,m,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=a,t[6]=0,t[7]=-a,t[8]=n,t):new c(1,0,0,0,n,-a,0,a,n)},c.fromRotationY=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=n,t):new c(n,0,a,0,1,0,-a,0,n)},c.fromRotationZ=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=a,t[2]=0,t[3]=-a,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(n,-a,0,a,n,0,0,0,1)},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,r){var n=3*t,a=e[n],i=e[n+1],o=e[n+2];return r.x=a,r.y=i,r.z=o,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var a=3*t;return n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z,n},c.getRow=function(e,t,r){var n=e[t],a=e[t+3],i=e[t+6];return r.x=n,r.y=a,r.z=i,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+3]=r.y,n[t+6]=r.z,n};var l=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),r.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),r.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),r};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,r){var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},c.multiplyByVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[3]*a+e[6]*i,u=e[1]*n+e[4]*a+e[7]*i,s=e[2]*n+e[5]*a+e[8]*i;return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},c.multiplyByScale=function(e,t,r){return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.x,r[3]=e[3]*t.y,r[4]=e[4]*t.y,r[5]=e[5]*t.y,r[6]=e[6]*t.z,r[7]=e[7]*t.z,r[8]=e[8]*t.z,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var r=e[0],n=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=r,t[1]=n,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],h=[2,2,1],p=new c,m=new c;return c.computeEigenDecomposition=function(e,t){var n=i.EPSILON20,a=10,l=0,f=0;r(t)||(t={});for(var d=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=n*o(h);a>f&&u(h)>y;)s(h,p),c.transpose(p,m),c.multiply(h,p,h),c.multiply(m,h,h),c.multiply(d,p,d),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],r=e[3],n=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*n-r*c)+u*(r*o-i*n)},c.inverse=function(e,t){var r=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],d=e[7],h=e[8],p=c.determinant(e);if(Math.abs(p)<=i.EPSILON15)throw new n("matrix is not invertible");t[0]=s*h-d*l,t[1]=d*o-a*h,t[2]=a*l-s*o,t[3]=f*l-u*h,t[4]=r*h-f*o,t[5]=u*o-r*l,t[6]=u*d-f*s,t[7]=f*a-r*d,t[8]=r*s-u*a;var m=1/p;return c.multiplyByScalar(t,m,t)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,a,i,o,u,s){"use strict";var c=function(e,t,n,a,i,o,u,s,c,l,f,d,h,p,m,y){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(c,0),this[3]=r(h,0),this[4]=r(t,0),this[5]=r(o,0),this[6]=r(l,0),this[7]=r(p,0),this[8]=r(n,0),this[9]=r(u,0),this[10]=r(f,0),this[11]=r(m,0),this[12]=r(a,0),this[13]=r(s,0),this[14]=r(d,0),this[15]=r(y,0)};c.packedLength=16,c.pack=function(e,t,n){n=r(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15]},c.unpack=function(e,t,a){return t=r(t,0),n(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=r(a,e.ZERO),n(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,r,a){n(a)||(a=new c);var i=r.x,o=r.y,u=r.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,d=t.x*t.w,h=t.y*t.y,p=t.y*t.z,m=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-y+g,x=2*(l-v),E=2*(f+m),S=2*(l+v),O=-s+h-y+g,M=2*(p-d),T=2*(f-m),_=2*(p+d),P=-s-h+y+g;return a[0]=w*i,a[1]=S*i,a[2]=T*i,a[3]=0,a[4]=x*o,a[5]=O*o,a[6]=_*o,a[7]=0,a[8]=E*u,a[9]=M*u,a[10]=P*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,d=new e;c.fromCamera=function(t,r){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,d),d);var u=f.x,s=f.y,h=f.z,p=l.x,m=l.y,y=l.z,v=d.x,g=d.y,w=d.z,x=a.x,E=a.y,S=a.z,O=u*-x+s*-E+h*-S,M=v*-x+g*-E+w*-S,T=p*x+m*E+y*S;return n(r)?(r[0]=u,r[1]=v,r[2]=-p,r[3]=0,r[4]=s,r[5]=g,r[6]=-m,r[7]=0,r[8]=h,r[9]=w,r[10]=-y,r[11]=0,r[12]=O,r[13]=M,r[14]=T,r[15]=1,r):new c(u,s,h,O,v,g,w,M,-p,-m,-y,T,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,r,n,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(n+r)/(r-n),c=2*n*r/(r-n);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,r,n,a,i,o){var u=1/(t-e),s=1/(n-r),c=1/(i-a),l=-(t+e)*u,f=-(n+r)*s,d=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=d,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,r,n,a,i,o){var u=2*a/(t-e),s=2*a/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),f=-(i+a)/(i-a),d=-1,h=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=d,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,r,n,a,i){var o=2*a/(t-e),u=2*a/(n-r),s=(t+e)/(t-e),c=(n+r)/(n-r),l=-1,f=-1,d=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=d,i[15]=0,i},c.computeViewportTransformation=function(e,t,n,a){e=r(e,r.EMPTY_OBJECT);var i=r(e.x,0),o=r(e.y,0),u=r(e.width,0),s=r(e.height,0);t=r(t,0),n=r(n,1);var c=.5*u,l=.5*s,f=.5*(n-t),d=c,h=l,p=f,m=i+c,y=o+l,v=t+f,g=1;return a[0]=d,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=p,a[11]=0,a[12]=m,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,r){var n=4*t,a=e[n],i=e[n+1],o=e[n+2],u=e[n+3];return r.x=a,r.y=i,r.z=o,r.w=u,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var a=4*t;return n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z,n[a+3]=r.w,n},c.setTranslation=function(e,t,r){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=e[15],r},c.getRow=function(e,t,r){var n=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return r.x=n,r.y=a,r.z=i,r.w=o,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+4]=r.y,n[t+8]=r.z,n[t+12]=r.w,n};var h=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),r.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),r.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),r};var p=new e;c.getMaximumScale=function(t){return c.getScale(t,p),e.maximumComponent(p)},c.multiply=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],d=e[9],h=e[10],p=e[11],m=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],O=t[4],M=t[5],T=t[6],_=t[7],P=t[8],b=t[9],N=t[10],A=t[11],I=t[12],C=t[13],z=t[14],R=t[15],D=n*w+u*x+f*E+m*S,L=a*w+s*x+d*E+y*S,q=i*w+c*x+h*E+v*S,U=o*w+l*x+p*E+g*S,B=n*O+u*M+f*T+m*_,W=a*O+s*M+d*T+y*_,F=i*O+c*M+h*T+v*_,G=o*O+l*M+p*T+g*_,k=n*P+u*b+f*N+m*A,H=a*P+s*b+d*N+y*A,V=i*P+c*b+h*N+v*A,Y=o*P+l*b+p*N+g*A,j=n*I+u*C+f*z+m*R,Z=a*I+s*C+d*z+y*R,X=i*I+c*C+h*z+v*R,J=o*I+l*C+p*z+g*R;return r[0]=D,r[1]=L,r[2]=q,r[3]=U,r[4]=B,r[5]=W,r[6]=F,r[7]=G,r[8]=k,r[9]=H,r[10]=V,r[11]=Y,r[12]=j,r[13]=Z,r[14]=X,r[15]=J,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},c.multiplyTransformation=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=e[12],h=e[13],p=e[14],m=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],O=t[10],M=t[12],T=t[13],_=t[14],P=n*m+o*y+c*v,b=a*m+u*y+l*v,N=i*m+s*y+f*v,A=n*g+o*w+c*x,I=a*g+u*w+l*x,C=i*g+s*w+f*x,z=n*E+o*S+c*O,R=a*E+u*S+l*O,D=i*E+s*S+f*O,L=n*M+o*T+c*_+d,q=a*M+u*T+l*_+h,U=i*M+s*T+f*_+p;return r[0]=P,r[1]=b,r[2]=N,r[3]=0,r[4]=A,r[5]=I,r[6]=C,r[7]=0,r[8]=z,r[9]=R,r[10]=D,r[11]=0,r[12]=L,r[13]=q,r[14]=U,r[15]=1,r},c.multiplyByMatrix3=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=t[0],h=t[1],p=t[2],m=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=n*d+o*h+c*p,S=a*d+u*h+l*p,O=i*d+s*h+f*p,M=n*m+o*y+c*v,T=a*m+u*y+l*v,_=i*m+s*y+f*v,P=n*g+o*w+c*x,b=a*g+u*w+l*x,N=i*g+s*w+f*x;return r[0]=E,r[1]=S,r[2]=O,r[3]=0,r[4]=M,r[5]=T,r[6]=_,r[7]=0,r[8]=P,r[9]=b,r[10]=N,r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},c.multiplyByTranslation=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=n*e[0]+a*e[4]+i*e[8]+e[12],u=n*e[1]+a*e[5]+i*e[9]+e[13],s=n*e[2]+a*e[6]+i*e[10]+e[14];return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=o,r[13]=u,r[14]=s,r[15]=e[15],r};var m=new e;c.multiplyByUniformScale=function(e,t,r){return m.x=t,m.y=t,m.z=t,c.multiplyByScale(e,m,r)},c.multiplyByScale=function(e,t,r){var n=t.x,a=t.y,i=t.z;return 1===n&&1===a&&1===i?c.clone(e,r):(r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=0,r[4]=a*e[4],r[5]=a*e[5],r[6]=a*e[6],r[7]=0,r[8]=i*e[8],r[9]=i*e[9],r[10]=i*e[10],r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=1,r)},c.multiplyByVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*n+e[4]*a+e[8]*i+e[12]*o,s=e[1]*n+e[5]*a+e[9]*i+e[13]*o,c=e[2]*n+e[6]*a+e[10]*i+e[14]*o,l=e[3]*n+e[7]*a+e[11]*i+e[15]*o;return r.x=u,r.y=s,r.z=c,r.w=l,r},c.multiplyByPointAsVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[4]*a+e[8]*i,u=e[1]*n+e[5]*a+e[9]*i,s=e[2]*n+e[6]*a+e[10]*i;return r.x=o,r.y=u,r.z=s,r},c.multiplyByPoint=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[4]*a+e[8]*i+e[12],u=e[1]*n+e[5]*a+e[9]*i+e[13],s=e[2]*n+e[6]*a+e[10]*i+e[14];return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var r=e[1],n=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r&&Math.abs(e[9]-t[9])<=r&&Math.abs(e[10]-t[10])<=r&&Math.abs(e[11]-t[11])<=r&&Math.abs(e[12]-t[12])<=r&&Math.abs(e[13]-t[13])<=r&&Math.abs(e[14]-t[14])<=r&&Math.abs(e[15]-t[15])<=r},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,r){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=0,r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=1,r;var n=e[0],a=e[4],i=e[8],l=e[12],f=e[1],d=e[5],h=e[9],p=e[13],m=e[2],x=e[6],E=e[10],S=e[14],O=e[3],M=e[7],T=e[11],_=e[15],P=E*_,b=S*T,N=x*_,A=S*M,I=x*T,C=E*M,z=m*_,R=S*O,D=m*T,L=E*O,q=m*M,U=x*O,B=P*d+A*h+I*p-(b*d+N*h+C*p),W=b*f+z*h+L*p-(P*f+R*h+D*p),F=N*f+R*d+q*p-(A*f+z*d+U*p),G=C*f+D*d+U*h-(I*f+L*d+q*h),k=b*a+N*i+C*l-(P*a+A*i+I*l),H=P*n+R*i+D*l-(b*n+z*i+L*l),V=A*n+z*a+U*l-(N*n+R*a+q*l),Y=I*n+L*a+q*i-(C*n+D*a+U*i);P=i*p,b=l*h,N=a*p,A=l*d,I=a*h,C=i*d,z=n*p,R=l*f,D=n*h,L=i*f,q=n*d,U=a*f;var j=P*M+A*T+I*_-(b*M+N*T+C*_),Z=b*O+z*T+L*_-(P*O+R*T+D*_),X=N*O+R*M+q*_-(A*O+z*M+U*_),J=C*O+D*M+U*T-(I*O+L*M+q*T),K=N*E+C*S+b*x-(I*S+P*x+A*E),Q=D*S+P*m+R*E-(z*E+L*S+b*m),$=z*x+U*S+A*m-(q*S+N*m+R*x),et=q*E+I*m+L*x-(D*x+U*E+C*m),tt=n*B+a*W+i*F+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,r[0]=B*tt,r[1]=W*tt,r[2]=F*tt,r[3]=G*tt,r[4]=k*tt,r[5]=H*tt,r[6]=V*tt,r[7]=Y*tt,r[8]=j*tt,r[9]=Z*tt,r[10]=X*tt,r[11]=J*tt,r[12]=K*tt,r[13]=Q*tt,r[14]=$*tt,r[15]=et*tt,r},c.inverseTransformation=function(e,t){var r=e[0],n=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],d=e[13],h=e[14],p=-r*f-n*d-a*h,m=-i*f-o*d-u*h,y=-s*f-c*d-l*h;return t[0]=r,t[1]=i,t[2]=s,t[3]=0,t[4]=n,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=p,t[13]=m,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]&&e[9]===t[r+9]&&e[10]===t[r+10]&&e[11]===t[r+11]&&e[12]===t[r+12]&&e[13]===t[r+13]&&e[14]===t[r+14]&&e[15]===t[r+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var a=function(t,r){this.normal=e.clone(t),this.distance=r};a.fromPointNormal=function(r,n,i){var o=-e.dot(n,r);return t(i)?(e.clone(n,i.normal),i.distance=o,i):new a(n,o)};var i=new e;return a.fromCartesian4=function(r,n){var o=e.fromCartesian4(r,i),u=r.w;return t(n)?(e.clone(o,n.normal),n.distance=u,n):new a(o,u)},a.getPointDistance=function(t,r){return e.dot(t.normal,r)+t.distance},a.ORIGIN_XY_PLANE=n(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=n(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=n(new a(e.UNIT_Y,0)),a}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";var s=function(e,r,n,a){this.west=t(e,0),this.south=t(r,0),this.east=t(n,0),this.north=t(a,0)};n(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},s.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new s),a.west=e[n++],a.south=e[n++],a.east=e[n++],a.north=e[n],a},s.computeWidth=function(e){var t=e.east,r=e.west;return r>t&&(t+=u.TWO_PI),t-r},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,n,a,i,o){return e=u.toRadians(t(e,0)),n=u.toRadians(t(n,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),r(o)?(o.west=e,o.south=n,o.east=a,o.north=i,o):new s(e,n,a,i)},s.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];n=Math.min(n,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return r(t)?(t.west=n,t.south=i,t.east=a,t.north=o,t):new s(n,i,a,o)},s.clone=function(e,t){return r(e)?r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},s.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},s.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},s.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},s.center=function(t,n){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return r(n)?(n.longitude=o,n.latitude=s,n.height=0,n):new e(o,s)},s.intersection=function(e,t,n){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var d=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return d>=h?void 0:r(n)?(n.west=l,n.south=d,n.east=f,n.north=h,n):new s(l,d,f,h)},s.contains=function(e,t){var r=t.longitude,n=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>r&&(r+=u.TWO_PI)),(r>a||u.equalsEpsilon(r,a,u.EPSILON14))&&(i>r||u.equalsEpsilon(r,i,u.EPSILON14))&&n>=e.south&&n<=e.north};var c=new e;return s.subsample=function(e,n,a,o){n=t(n,i.WGS84),a=t(a,0),r(o)||(o=[]);var l=0,f=e.north,d=e.south,h=e.east,p=e.west,m=c;m.height=a,m.longitude=p,m.latitude=f,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.longitude=h,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.latitude=d,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.longitude=p,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.latitude=0>f?f:d>0?d:0;for(var y=1;8>y;++y)m.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,m)&&(o[l]=n.cartographicToCartesian(m,o[l]),l++);return 0===m.latitude&&(m.longitude=p,o[l]=n.cartographicToCartesian(m,o[l]),l++,m.longitude=h,o[l]=n.cartographicToCartesian(m,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,r,n,a,i,o,u,s,c,l,f,d){"use strict";var h=function(t,n){this.center=e.clone(r(t,e.ZERO)),this.radius=r(n,0)},p=new e,m=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,O=new e,M=new e,T=new e;h.fromPoints=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;for(var a=e.clone(t[0],x),i=e.clone(a,p),o=e.clone(a,m),u=e.clone(a,y),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),f=t.length,d=1;f>d;d++){e.clone(t[d],a);var _=a.x,P=a.y,b=a.z;_<i.x&&e.clone(a,i),_>s.x&&e.clone(a,s),P<o.y&&e.clone(a,o),P>c.y&&e.clone(a,c),b<u.z&&e.clone(a,u),b>l.z&&e.clone(a,l)}var N=e.magnitudeSquared(e.subtract(s,i,E)),A=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),C=i,z=s,R=N;A>R&&(R=A,C=o,z=c),I>R&&(R=I,C=u,z=l);var D=S;D.x=.5*(C.x+z.x),D.y=.5*(C.y+z.y),D.z=.5*(C.z+z.z);var L=e.magnitudeSquared(e.subtract(z,D,E)),q=Math.sqrt(L),U=O;U.x=i.x,U.y=o.y,U.z=u.z;var B=M;B.x=s.x,B.y=c.y,B.z=l.z;var W=e.multiplyByScalar(e.add(U,B,E),.5,T),F=0;for(d=0;f>d;d++){e.clone(t[d],a);var G=e.magnitude(e.subtract(a,W,E));G>F&&(F=G);var k=e.magnitudeSquared(e.subtract(a,D,E));if(k>L){var H=Math.sqrt(k);q=.5*(q+H),L=q*q;var V=H-q;D.x=(q*D.x+V*a.x)/H,D.y=(q*D.y+V*a.y)/H,D.z=(q*D.z+V*a.z)/H}}return F>q?(e.clone(D,r.center),r.radius=q):(e.clone(W,r.center),r.radius=F),r};var _=new u,P=new e,b=new e,N=new t,A=new t;h.fromRectangle2D=function(e,t,r){return h.fromRectangleWithHeights2D(e,t,0,0,r)},h.fromRectangleWithHeights2D=function(t,a,i,o,u){if(n(u)||(u=new h),!n(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=r(a,_),d.southwest(t,N),N.height=i,d.northeast(t,A),A.height=o;var s=a.project(N,P),c=a.project(A,b),l=c.x-s.x,f=c.y-s.y,p=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+p*p);var m=u.center;return m.x=s.x+.5*l,m.y=s.y+.5*f,m.z=s.z+.5*p,u};var I=[];h.fromRectangle3D=function(e,t,a,i){t=r(t,o.WGS84),a=r(a,0);var u;return n(e)&&(u=d.subsample(e,t,a,I)),h.fromPoints(u,i)},h.fromVertices=function(t,a,i,o){if(n(o)||(o=new h),!n(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=r(a,e.ZERO),i=r(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,p),c=e.clone(u,m),l=e.clone(u,y),f=e.clone(u,v),d=e.clone(u,g),_=e.clone(u,w),P=t.length,b=0;P>b;b+=i){var N=t[b]+a.x,A=t[b+1]+a.y,I=t[b+2]+a.z;u.x=N,u.y=A,u.z=I,N<s.x&&e.clone(u,s),N>f.x&&e.clone(u,f),A<c.y&&e.clone(u,c),A>d.y&&e.clone(u,d),I<l.z&&e.clone(u,l),I>_.z&&e.clone(u,_)}var C=e.magnitudeSquared(e.subtract(f,s,E)),z=e.magnitudeSquared(e.subtract(d,c,E)),R=e.magnitudeSquared(e.subtract(_,l,E)),D=s,L=f,q=C;z>q&&(q=z,D=c,L=d),R>q&&(q=R,D=l,L=_);var U=S;U.x=.5*(D.x+L.x),U.y=.5*(D.y+L.y),U.z=.5*(D.z+L.z);var B=e.magnitudeSquared(e.subtract(L,U,E)),W=Math.sqrt(B),F=O;F.x=s.x,F.y=c.y,F.z=l.z;var G=M;G.x=f.x,G.y=d.y,G.z=_.z;var k=e.multiplyByScalar(e.add(F,G,E),.5,T),H=0;for(b=0;P>b;b+=i){u.x=t[b]+a.x,u.y=t[b+1]+a.y,u.z=t[b+2]+a.z;var V=e.magnitude(e.subtract(u,k,E));V>H&&(H=V);var Y=e.magnitudeSquared(e.subtract(u,U,E));if(Y>B){var j=Math.sqrt(Y);W=.5*(W+j),B=W*W;var Z=j-W;U.x=(W*U.x+Z*u.x)/j,U.y=(W*U.y+Z*u.y)/j,U.z=(W*U.z+Z*u.z)/j}}return H>W?(e.clone(U,o.center),o.radius=W):(e.clone(k,o.center),o.radius=H),o},h.fromCornerPoints=function(t,r,a){n(a)||(a=new h);var i=a.center;return e.add(t,r,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,r),a},h.fromEllipsoid=function(t,r){return n(r)||(r=new h),e.clone(e.ZERO,r.center),r.radius=t.maximumRadius,r};var C=new e;h.fromBoundingSpheres=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var a=t.length;if(1===a)return h.clone(t[0],r);if(2===a)return h.union(t[0],t[1],r);for(var i=[],o=0;a>o;o++)i.push(t[o].center);r=h.fromPoints(i,r);var u=r.center,s=r.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,C)+c.radius)}return r.radius=s,r},h.clone=function(t,r){return n(t)?n(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,n){n=r(n,0);var a=e.center;t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n]=e.radius},h.unpack=function(e,t,a){t=r(t,0),n(a)||(a=new h);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var z=new e,R=new e;h.union=function(t,r,a){n(a)||(a=new h);var i=t.center,o=t.radius,u=r.center,s=r.radius,c=e.subtract(u,i,z),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return r.clone(a),a;var f=.5*(o+l+s),d=e.multiplyByScalar(c,(-o+f)/l,R);return e.add(d,i,d),e.clone(d,a.center),a.radius=f,a};var D=new e;h.expand=function(t,r,n){n=h.clone(t,n);var a=e.magnitude(e.subtract(r,n.center,D));return a>n.radius&&(n.radius=a),n},h.intersectPlane=function(t,r){var n=t.center,a=t.radius,i=r.normal,o=e.dot(i,n)+r.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var L=new f(new e,0);h.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var r=f.fromCartesian4(t,L);return h.intersectPlane(e,r)},h.transform=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=l.getMaximumScale(t)*e.radius,r};var q=new e;h.distanceSquaredTo=function(t,r){var n=e.subtract(t.center,r,q);return e.magnitudeSquared(n)-t.radius*t.radius},h.transformWithoutScale=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var U=new e;h.computePlaneDistances=function(t,r,a,i){n(i)||(i=new c);var o=e.subtract(t.center,r,U),u=e.multiplyByScalar(a,e.dot(a,o),U),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var B=new e,W=new e,F=new e,G=new e,k=new e,H=new t,V=new Array(8),Y=0;8>Y;++Y)V[Y]=new e;var j=new u;return h.projectTo2D=function(t,n,a){n=r(n,j);var i=n.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,W);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),d=e.negate(c,G),p=V,m=p[0];e.add(s,l,m),e.add(m,c,m),m=p[1],e.add(s,l,m),e.add(m,d,m),m=p[2],e.add(s,f,m),e.add(m,d,m),m=p[3],e.add(s,f,m),e.add(m,c,m),e.negate(s,s),m=p[4],e.add(s,l,m),e.add(m,c,m),m=p[5],e.add(s,l,m),e.add(m,d,m),m=p[6],e.add(s,f,m),e.add(m,d,m),m=p[7],e.add(s,f,m),e.add(m,c,m);for(var y=p.length,v=0;y>v;++v){var g=p[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,H);n.project(w,g)}a=h.fromPoints(p,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},h.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(n.requestFullscreen=a,r=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(n.requestFullscreen=a,r=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?n.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(n.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?n.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(n.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?n.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(n.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),n.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),n.fullscreenerror=a)}return r},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[n.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[n.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=n(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=n(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=n(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=n(e[1])))}return S}function f(){return l()&&O}function d(){if(!t(M)){M=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(M=!0,T=n(e[1]))}return M}function h(){return t(_)||(_=/Windows/i.test(navigator.appVersion)),_}function p(){return d()&&T}function m(){return t(P)||(P=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),P}var y,v,g,w,x,E,S,O,M,T,_,P,b={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:d,firefoxVersion:p,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:m};return b.supportsFullscreen=function(){return r.supportsFullscreen()},b.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},b.supportsWebWorkers=function(){return"undefined"!=typeof Worker},b}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,r,n,a){"use strict";if(!n.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new r("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,n,a,o){switch(a=e(a,0),o=e(o,(n.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(n,a,o);case i.UNSIGNED_BYTE:return new Uint8Array(n,a,o);case i.SHORT:return new Int16Array(n,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(n,a,o);case i.FLOAT:return new Float32Array(n,a,o);case i.DOUBLE:return new Float64Array(n,a,o);default:throw new r("componentDatatype is not a valid value.")}},a(i)}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,r,n,a,i,o){"use strict";var u=function(n,a,i){this.minimum=e.clone(t(n,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),r(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i};u.fromPoints=function(t,n){if(r(n)||(n=new u),!r(t)||0===t.length)return n.minimum=e.clone(e.ZERO,n.minimum),n.maximum=e.clone(e.ZERO,n.maximum),n.center=e.clone(e.ZERO,n.center),n;for(var a=t[0].x,i=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,d=1;f>d;d++){var h=t[d],p=h.x,m=h.y,y=h.z;a=Math.min(p,a),s=Math.max(p,s),i=Math.min(m,i),c=Math.max(m,c),o=Math.min(y,o),l=Math.max(y,l)}var v=n.minimum;v.x=a,v.y=i,v.z=o;var g=n.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,n.center);return e.multiplyByScalar(w,.5,w),n},u.clone=function(t,n){return r(t)?r(n)?(n.minimum=e.clone(t.minimum,n.minimum),n.maximum=e.clone(t.maximum,n.maximum),n.center=e.clone(t.center,n.center),n):new u(t.minimum,t.maximum):void 0},u.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&e.equals(t.minimum,n.minimum)&&e.equals(t.maximum,n.maximum)};var s=new e;u.intersectPlane=function(t,r){s=e.subtract(t.maximum,t.minimum,s);var n=e.multiplyByScalar(s,.5,s),a=r.normal,o=n.x*Math.abs(a.x)+n.y*Math.abs(a.y)+n.z*Math.abs(a.z),u=e.dot(t.center,a)+r.distance;return u-o>0?i.INSIDE:0>u+o?i.OUTSIDE:i.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){n("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var r=o.fromCartesian4(t,c);return u.intersectPlane(e,r)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r){this.x=e(t,0),this.y=e(r,0)};i.fromElements=function(e,r,n){return t(n)?(n.x=e,n.y=r,n):new i(e,r)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n]=t.y},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t) -},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)},i.ZERO=n(new i(0,0)),i.UNIT_X=n(new i(1,0)),i.UNIT_Y=n(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var a=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(r)))<n?0:a}var n={};return n.computeDiscriminant=function(e,t,r){var n=t*t-4*e*r;return n},n.computeRealRoots=function(e,n,a){var i;if(0===e)return 0===n?[]:[-a/n];if(0===n){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-n/e,0>i?[i,0]:[0,i];var c=n*n,l=4*e*a,f=r(c,-l,t.EPSILON14);if(0>f)return[];var d=-.5*r(n,t.sign(n)*Math.sqrt(f),t.EPSILON14);return n>0?[d/e,a/d]:[a/d,d/e]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var a,i,o=e,u=t/3,s=r/3,c=n,l=o*s,f=u*c,d=u*u,h=s*s,p=o*s-d,m=o*c-u*s,y=u*c-h,v=4*p*y-m*m;if(0>v){var g,w,x;d*f>=l*h?(g=o,w=p,x=-2*u*p+o*m):(g=c,w=y,x=-c*m+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var O=i/2,M=0>O?-Math.pow(-O,1/3):Math.pow(O,1/3),T=i===S?-M:-w/M;return a=0>=w?M+T:-x/(M*M+T*T+w),d*f>=l*h?[(a-u)/o]:[-c/(a+s)]}var _=p,P=-2*u*p+o*m,b=y,N=-c*m+2*s*y,A=Math.sqrt(v),I=Math.sqrt(3)/2,C=Math.abs(Math.atan2(o*A,-P)/3);a=2*Math.sqrt(-_);var z=Math.cos(C);i=a*z;var R=a*(-z/2-I*Math.sin(C)),D=i+R>2*u?i-u:R-u,L=o,q=D/L;C=Math.abs(Math.atan2(c*A,-N)/3),a=2*Math.sqrt(-b),z=Math.cos(C),i=a*z,R=a*(-z/2-I*Math.sin(C));var U=-c,B=2*s>i+R?i+s:R+s,W=U/B,F=L*B,G=-D*B-L*U,k=D*U,H=(s*G-u*k)/(-u*G+s*F);return H>=q?W>=q?W>=H?[q,H,W]:[q,W,H]:[W,q,H]:W>=q?[H,q,W]:W>=H?[H,W,q]:[W,H,q]}var n={};return n.computeDiscriminant=function(e,t,r,n){var a=e*e,i=t*t,o=r*r,u=n*n,s=18*e*t*r*n+i*o-27*a*u-4*(e*o*r+i*t*n);return s},n.computeRealRoots=function(e,n,a,i){var o,u;if(0===e)return t.computeRealRoots(n,a,i);if(0===n){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):r(e,0,a,i)}return 0===a?0===i?(u=-n/e,0>u?[u,0,0]:[0,0,u]):r(e,n,0,i):0===i?(o=t.computeRealRoots(e,n,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):r(e,n,a,i)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var d=-t/4,h=f[f.length-1];if(Math.abs(h)<r.EPSILON14){var p=n.computeRealRoots(1,s,l);if(2===p.length){var m,y=p[0],v=p[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[d-w,d-g,d+g,d+w]}if(y>=0&&0>v)return m=Math.sqrt(y),[d-m,d+m];if(0>y&&v>=0)return m=Math.sqrt(v),[d-m,d+m]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,O=n.computeRealRoots(1,x,E),M=n.computeRealRoots(1,-x,S);return 0!==O.length?(O[0]+=d,O[1]+=d,0!==M.length?(M[0]+=d,M[1]+=d,O[1]<=M[0]?[O[0],O[1],M[0],M[1]]:M[1]<=O[0]?[M[0],M[1],O[0],O[1]]:O[0]>=M[0]&&O[1]<=M[1]?[M[0],O[0],O[1],M[1]]:M[0]>=O[0]&&M[1]<=O[1]?[O[0],M[0],M[1],O[1]]:O[0]>M[0]&&O[0]<M[1]?[M[0],O[0],M[1],O[1]]:[O[0],M[0],O[1],M[1]]):O):0!==M.length?(M[0]+=d,M[1]+=d,M):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,f=i*t+s-4*o,d=c*o-i*a*t+u,h=e.computeRealRoots(1,l,f,d);if(h.length>0){var p,m,y=h[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),O=c-4*y,M=c+4*Math.abs(y);if(0>y||O*S>E*M){var T=Math.sqrt(O);p=T/2,m=0===T?0:(t*x-i)/T}else{var _=Math.sqrt(E);p=0===_?0:(t*x-i)/_,m=_/2}var P,b;0===w&&0===p?(P=0,b=0):r.sign(w)===r.sign(p)?(P=w+p,b=y/P):(b=w-p,P=y/b);var N,A;0===x&&0===m?(N=0,A=0):r.sign(x)===r.sign(m)?(N=x+m,A=o/N):(A=x-m,N=o/A);var I=n.computeRealRoots(1,P,N),C=n.computeRealRoots(1,b,A);if(0!==I.length)return 0!==C.length?I[1]<=C[0]?[I[0],I[1],C[0],C[1]]:C[1]<=I[0]?[C[0],C[1],I[0],I[1]]:I[0]>=C[0]&&I[1]<=C[1]?[C[0],I[0],I[1],C[1]]:C[0]>=I[0]&&C[1]<=I[1]?[I[0],C[0],C[1],I[1]]:I[0]>C[0]&&I[0]<C[1]?[C[0],I[0],C[1],I[1]]:[I[0],C[0],I[1],C[1]]:I;if(0!==C.length)return C}return[]}var o={};return o.computeDiscriminant=function(e,t,r,n,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=r*r,l=c*r,f=n*n,d=f*n,h=a*a,p=h*a,m=u*c*f-4*s*d-4*e*l*f+18*e*t*r*d-27*i*f*f+256*o*p+a*(18*s*r*n-4*u*l+16*e*c*c-80*e*t*c*n-6*e*u*f+144*i*r*f)+h*(144*e*u*r-27*u*u-128*i*c-192*i*t*n);return m},o.computeRealRoots=function(t,n,o,u,s){if(Math.abs(t)<r.EPSILON15)return e.computeRealRoots(n,o,u,s);var c=n/t,l=o/t,f=u/t,d=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>d?h+1:h){case 0:return a(c,l,f,d);case 1:return i(c,l,f,d);case 2:return i(c,l,f,d);case 3:return a(c,l,f,d);case 4:return a(c,l,f,d);case 5:return i(c,l,f,d);case 6:return a(c,l,f,d);case 7:return a(c,l,f,d);case 8:return i(c,l,f,d);case 9:return a(c,l,f,d);case 10:return a(c,l,f,d);case 11:return i(c,l,f,d);case 12:return a(c,l,f,d);case 13:return a(c,l,f,d);case 14:return a(c,l,f,d);case 15:return a(c,l,f,d);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=function(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n};return n.getPoint=function(t,n,a){return r(a)||(a=new e),a=e.multiplyByScalar(t.direction,n,a),e.add(t.origin,a,a)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(t,n,a,o,u){u=r(u,!1);var s,c,l,f,d,h=t.origin,p=t.direction,m=e.subtract(a,n,y),E=e.subtract(o,n,v),S=e.cross(p,E,g),O=e.dot(m,S);if(u){if(O<i.EPSILON6)return void 0;if(s=e.subtract(h,n,w),l=e.dot(s,S),0>l||l>O)return void 0;if(c=e.cross(s,m,x),f=e.dot(p,c),0>f||l+f>O)return void 0;d=e.dot(E,c)/O}else{if(Math.abs(O)<i.EPSILON6)return void 0;var M=1/O;if(s=e.subtract(h,n,w),l=e.dot(s,S)*M,0>l||l>1)return void 0;if(c=e.cross(s,m,x),f=e.dot(p,c)*M,0>f||l+f>1)return void 0;d=e.dot(E,c)*M}return d}function f(e,t,r,n){var a=t*t-4*e*r;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-t/(2*e);return 0===c?void 0:(n.root0=n.root1=c,n)}function d(t,r,a){n(a)||(a={});var i=t.origin,o=t.direction,u=r.center,s=r.radius*r.radius,c=e.subtract(i,u,g),l=e.dot(o,o),d=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,p=f(l,d,h,S);return n(p)?(a.start=p.root0,a.stop=p.root1,a):void 0}function h(e,t,r){var n=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))<r?0:n}function p(t,r,n,a,c){var l,f=a*a,d=c*c,p=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*d,m=c*(a*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+r.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*d+a*r.x+n,v=d*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+r.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(p,m,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],O=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-O)),w.push(new e(a,c*S,c*O))}return w}var M=g*g,T=v*v,_=p*p,P=g*v,b=_+T,N=2*(m*p+P),A=2*y*p+m*m-T+M,I=2*(y*m-P),C=y*y-M;if(0===b&&0===N&&0===A&&0===I)return w;l=s.computeRealRoots(b,N,A,I,C);var z=l.length;if(0===z)return w;for(var R=0;z>R;++R){var D,L=l[R],q=L*L,U=Math.max(1-q,0),B=Math.sqrt(U);D=i.sign(p)===i.sign(y)?h(p*q+y,m*L,i.EPSILON12):i.sign(y)===i.sign(m*L)?h(p*q,m*L+y,i.EPSILON12):h(p*q+m*L,y,i.EPSILON12);var W=h(v*L,g,i.EPSILON15),F=D*W;0>F?w.push(new e(a,c*L,c*B)):F>0?w.push(new e(a,c*L,c*-B)):0!==B?(w.push(new e(a,c*L,c*-B)),w.push(new e(a,c*L,c*B)),++R):w.push(new e(a,c*L,c*B))}return w}var m={};m.rayPlane=function(t,r,a){n(a)||(a=new e);var o=t.origin,u=t.direction,s=r.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-r.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;m.rayTriangle=function(t,r,a,i,o,u){var s=l(t,r,a,i,o);return!n(s)||0>s?void 0:(n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;m.lineSegmentTriangle=function(t,r,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(r,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,a,i,o,u);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};m.raySphere=function(e,t,r){return r=d(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var O=new c;m.lineSegmentSphere=function(t,r,a,i){var o=O;e.clone(t,o.origin);var u=e.subtract(r,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=d(o,a,i),!n(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var M=new e,T=new e;m.rayEllipsoid=function(t,r){var n,a,i,o,u,s=r.oneOverRadii,c=e.multiplyComponents(s,t.origin,M),l=e.multiplyComponents(s,t.direction,T),f=e.magnitudeSquared(c),d=e.dot(c,l);if(f>1){if(d>=0)return void 0;var h=d*d;if(n=f-1,a=e.magnitudeSquared(l),i=a*n,i>h)return void 0;if(h>i){o=d*d-i,u=-d+Math.sqrt(o);var p=u/a,m=n/u;return m>p?{start:p,stop:m}:{start:m,stop:p}}var y=Math.sqrt(n/a);return{start:y,stop:y}}return 1>f?(n=f-1,a=e.magnitudeSquared(l),i=a*n,o=d*d-i,u=-d+Math.sqrt(o),{start:0,stop:u/a}):0>d?(a=e.magnitudeSquared(l),{start:0,stop:-d/a}):void 0};var _=new e,P=new e,b=new e,N=new e,A=new e,I=new o,C=new o,z=new o,R=new o,D=new o,L=new o,q=new o,U=new e,B=new e,W=new t;m.grazingAltitudeLocation=function(t,r){var a=t.origin,u=t.direction,s=r.geodeticSurfaceNormal(a,_);if(e.dot(u,s)>=0)return a;var c=n(this.rayEllipsoid(t,r)),l=r.transformPositionToScaledSpace(u,_),f=e.normalize(l,l),d=e.mostOrthogonalAxis(l,N),h=e.normalize(e.cross(d,f,P),P),m=e.normalize(e.cross(f,h,b),b),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=m.x,y[7]=m.y,y[8]=m.z;var v=o.transpose(y,C),g=o.fromScale(r.radii,z),w=o.fromScale(r.oneOverRadii,R),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,O=o.multiply(o.multiply(v,w,L),x,L),M=o.multiply(o.multiply(O,g,q),y,q),T=o.multiplyByVector(O,a,A),F=p(M,e.negate(T,_),0,0,1),G=F.length;if(G>0){for(var k=e.clone(e.ZERO,B),H=Number.NEGATIVE_INFINITY,V=0;G>V;++V){E=o.multiplyByVector(g,o.multiplyByVector(y,F[V],U),U);var Y=e.normalize(e.subtract(E,a,N),N),j=e.dot(Y,u);j>H&&(H=j,k=e.clone(E,k))}var Z=r.cartesianToCartographic(k,W);return H=i.clamp(H,0,1),S=e.magnitude(e.subtract(k,a,N))*Math.sqrt(1-H*H),S=c?-S:S,Z.height=S,r.cartographicToCartesian(Z,new e)}return void 0};var F=new e;return m.lineSegmentPlane=function(t,r,a,o){n(o)||(o=new e);var u=e.subtract(r,t,F),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(a.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},m.trianglePlaneIntersection=function(t,r,n,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,r)+o<0,c=e.dot(i,n)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,d;if((1===l||2===l)&&(f=new e,d=new e),1===l){if(u)return m.lineSegmentPlane(t,r,a,f),m.lineSegmentPlane(t,n,a,d),{positions:[t,r,n,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(s)return m.lineSegmentPlane(r,n,a,f),m.lineSegmentPlane(r,t,a,d),{positions:[t,r,n,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return m.lineSegmentPlane(n,t,a,f),m.lineSegmentPlane(n,r,a,d),{positions:[t,r,n,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return m.lineSegmentPlane(r,t,a,f),m.lineSegmentPlane(n,t,a,d),{positions:[t,r,n,f,d],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return m.lineSegmentPlane(n,r,a,f),m.lineSegmentPlane(t,r,a,d),{positions:[t,r,n,f,d],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return m.lineSegmentPlane(t,n,a,f),m.lineSegmentPlane(r,n,a,d),{positions:[t,r,n,f,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},m}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,r,n,a){return t(e).then(r,n,a)}function t(e){var t,r;return e instanceof n?t=e:u(e)?(r=o(),e.then(function(e){r.resolve(e)},function(e){r.reject(e)},function(e){r.progress(e)}),t=r.promise):t=a(e),t}function r(t){return e(t,i)}function n(e){this.then=e}function a(e){var r=new n(function(r){try{return t(r?r(e):e)}catch(n){return i(n)}});return r}function i(e){var r=new n(function(r,n){try{return n?t(n(e)):i(e)}catch(a){return i(a)}});return r}function o(){function e(e,t,r){return d(e,t,r)}function r(e){return p(e)}function a(e){return p(i(e))}function u(e){return h(e)}var s,c,l,f,d,h,p;return c=new n(e),s={then:e,resolve:r,reject:a,progress:u,promise:c,resolver:{resolve:r,reject:a,progress:u}},l=[],f=[],d=function(e,t,r){var n,a;return n=o(),a="function"==typeof r?function(e){try{n.progress(r(e))}catch(t){n.progress(t)}}:function(e){n.progress(e)},l.push(function(r){r.then(e,t).then(n.resolve,n.reject,a)}),f.push(a),n.promise},h=function(e){return m(f,e),e},p=function(e){return e=t(e),d=e.then,p=t,h=v,m(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,r,n,a,i){return y(2,arguments),e(t,function(t){function u(e){m(e)}function s(e){p(e)}var c,l,f,d,h,p,m,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(r,g)),f=[],l=g-c+1,d=[],h=o(),c)for(y=h.progress,m=function(e){d.push(e),--l||(p=m=v,h.reject(d))},p=function(e){f.push(e),--c||(p=m=v,h.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else h.resolve(f);return h.then(n,a,i)})}function c(e,t,r,n){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,r,n)}function l(e,t,r,n){return y(1,arguments),d(e,g).then(t,r,n)}function f(){return d(arguments,g)}function d(t,r){return e(t,function(t){var n,a,i,u,s,c;if(i=a=t.length>>>0,n=[],c=o(),i)for(u=function(t,a){e(t,r).then(function(e){n[a]=e,--i||c.resolve(n)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(n);return c.promise})}function h(t,r){var n=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,n[0]=function(t,n,i){return e(t,function(t){return e(n,function(e){return r(t,e,i,a)})})},w.apply(t,n)})}function p(t,r,n){var a=arguments.length>2;return e(t,function(e){return e=a?n:e,r.resolve(e),e},function(e){return r.reject(e),i(e)},r.progress)}function m(e,t){for(var r,n=0;r=e[n++];)r(t)}function y(e,t){for(var r,n=t.length;n>e;)if(r=t[--n],null!=r&&"function"!=typeof r)throw new Error("arg "+n+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=r,e.join=f,e.all=l,e.map=d,e.reduce=h,e.any=c,e.some=s,e.chain=p,e.isPromise=u,n.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,r,n,a,i;if(i=0,t=Object(this),a=t.length>>>0,r=arguments,r.length<=1)for(;;){if(i in t){n=t[i++];break}if(++i>=a)throw new TypeError}else n=r[1];for(;a>i;++i)i in t&&(n=e(n,t[i],i,t));return n},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,r){for(var n,a,i=0,o=e.length-1;o>=i;)if(n=~~((i+o)/2),a=r(e[n],t),0>a)i=n+1;else{if(!(a>0))return n;o=n-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,r,n,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=r,this.yPoleOffset=n,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,n=t[r++],a=function(e,t,r,n){r||(r=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(r);return n?e+a:a+e},i=function(e,t,r,n,i,o){var u=n-e.length;return u>0&&(e=r||!i?a(e,n,o,r):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,r,n,o,u,s){var c=e>>>0;return r=r&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(c.toString(t),u||0,"0",!1),i(e,r,n,o,s)},u=function(e,t,r,n,a,o){return null!=n&&(e=e.slice(0,n)),i(e,"",t,r,a,o)},s=function(e,n,s,c,l,f,d){var h,p,m,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",O=s.length,M=0;s&&O>M;M++)switch(s.charAt(M)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(M+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[r++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[r++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(d)>-1?6:"d"==d?0:void 0,v=n?t[n.slice(0,-1)]:t[r++],d){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return h=+v||0,h=Math.round(h-h%1),p=0>h?"-":w,v=p+a(String(Math.abs(h)),f,"0",!1),i(v,p,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return h=+v,p=0>h?"-":w,m=["toExponential","toFixed","toPrecision"]["efg".indexOf(d.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(d)%2],v=p+Math.abs(h)[m](f),i(v,p,g,c,x)[y]();default:return e}};return n.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,r,n,a,i,o,u){this.year=e,this.month=t,this.day=r,this.hour=n,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(e,t){return N.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var r=N.leapSeconds,n=t(r,g,l);0>n&&(n=~n),n>=r.length&&(n=r.length-1);var a=r[n].offset;if(n>0){var i=N.secondsDifference(r[n].julianDate,e);i>a&&(n--,a=r[n].offset)}N.addSeconds(e,a,e)}function d(e,r){g.julianDate=e;var n=N.leapSeconds,a=t(n,g,l);if(0>a&&(a=~a),0===a)return N.addSeconds(e,-n[0].offset,r);if(a>=n.length)return N.addSeconds(e,-n[a-1].offset,r);var i=N.secondsDifference(n[a].julianDate,e);return 0===i?N.addSeconds(e,-n[a].offset,r):1>=i?void 0:N.addSeconds(e,-n[--a].offset,r)}function h(e,t,r){var n=0|t/s.SECONDS_PER_DAY;return e+=n,t-=s.SECONDS_PER_DAY*n,0>t&&(e--,t+=s.SECONDS_PER_DAY),r.dayNumber=e,r.secondsOfDay=t,r}function p(e,t,r,n,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+r-32075;n-=12,0>n&&(n+=24);var f=i+(n*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var m=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,O=/^(\d{4})-?(\d{2})-?(\d{2})$/,M=/([Z+\-])?(\d{2})?:?(\d{2})?$/,T=/^(\d{2})(\.\d+)?/.source+M.source,_=/^(\d{2}):?(\d{2})(\.\d+)?/.source+M.source,P=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+M.source,b="Invalid ISO 8601 date.",N=function(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=r(e,0),t=r(t,0),n=r(n,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,h(a,t,this),n===c.UTC&&f(this)};N.fromDate=function(e,t){var r=p(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return n(t)?(h(r[0],r[1],t),f(t),t):new N(r[0],r[1],c.UTC)},N.fromIso8601=function(e,t){e=e.replace(",",".");var r,i,u,s=e.split("T"),l=1,d=1,m=0,g=0,M=0,A=0,I=s[0],C=s[1];if(!n(I))throw new a(b);var z;if(s=I.match(O),null!==s){if(z=I.split("-").length-1,z>0&&2!==z)throw new a(b);r=+s[1],l=+s[2],d=+s[3]}else if(s=I.match(x),null!==s)r=+s[1],l=+s[2];else if(s=I.match(w),null!==s)r=+s[1];else{var R;if(s=I.match(E),null!==s){if(r=+s[1],R=+s[2],u=o(r),1>R||u&&R>366||!u&&R>365)throw new a(b)}else{if(s=I.match(S),null===s)throw new a(b);r=+s[1];var D=+s[2],L=+s[3]||0;if(z=I.split("-").length-1,z>0&&(!n(s[3])&&1!==z||n(s[3])&&2!==z))throw new a(b);var q=new Date(Date.UTC(r,0,4));R=7*D+L-q.getUTCDay()-3}i=new Date(Date.UTC(r,0,1)),i.setUTCDate(R),l=i.getUTCMonth()+1,d=i.getUTCDate()}if(u=o(r),1>l||l>12||1>d||(2!==l||!u)&&d>y[l-1]||u&&2===l&&d>v)throw new a(b);var U;if(n(C)){if(s=C.match(P),null!==s){if(z=C.split(":").length-1,z>0&&2!==z&&3!==z)throw new a(b);m=+s[1],g=+s[2],M=+s[3],A=1e3*+(s[4]||0),U=5}else if(s=C.match(_),null!==s){if(z=C.split(":").length-1,z>0&&1!==z)throw new a(b);m=+s[1],g=+s[2],M=60*+(s[3]||0),U=4}else{if(s=C.match(T),null===s)throw new a(b);m=+s[1],g=60*+(s[2]||0),U=3}if(g>=60||M>=61||m>24||24===m&&(g>0||M>0||A>0))throw new a(b);var B=s[U],W=+s[U+1],F=+(s[U+2]||0);switch(B){case"+":m-=W,g-=F;break;case"-":m+=W,g+=F;break;case"Z":break;default:g+=new Date(Date.UTC(r,l-1,d,m,g)).getTimezoneOffset()}}else g+=new Date(r,l-1,d).getTimezoneOffset();var G=60===M;for(G&&M--;g>=60;)g-=60,m++;for(;m>=24;)m-=24,d++;for(i=u&&2===l?v:y[l-1];d>i;)d-=i,l++,l>12&&(l-=12,r++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,m--;for(;0>m;)m+=24,d--;for(;1>d;)l--,1>l&&(l+=12,r--),i=u&&2===l?v:y[l-1],d+=i;var k=p(r,l,d,m,g,M,A);return n(t)?(h(k[0],k[1],t),f(t)):t=new N(k[0],k[1],c.UTC),G&&N.addSeconds(t,1,t),t},N.now=function(e){return N.fromDate(new Date,e)};var A=new N(0,0,c.TAI);return N.toGregorianDate=function(e,t){var r=!1,a=d(e,A);n(a)||(N.addSeconds(e,-1,A),a=d(A,A),r=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var h=0|80*c/2447,p=0|c-(0|2447*h/80);c=0|h/11;var m=0|h+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),r&&(x+=1),n(t)?(t.year=y,t.month=m,t.day=p,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=r,t):new i(y,m,p,v,w,x,E,r)},N.toDate=function(e){var t=N.toGregorianDate(e,m),r=t.second;return t.isLeapSecond&&(r-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,r,t.millisecond))},N.toIso8601=function(t,r){var a,i=N.toGregorianDate(t,i);return n(r)||0===i.millisecond?n(r)&&0!==r?(a=(.01*i.millisecond).toFixed(r).replace(".","").slice(0,r),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},N.clone=function(e,t){return n(e)?n(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new N(e.dayNumber,e.secondsOfDay,c.TAI):void 0},N.compare=function(e,t){var r=e.dayNumber-t.dayNumber;return 0!==r?r:e.secondsOfDay-t.secondsOfDay},N.equals=function(e,t){return e===t||n(e)&&n(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},N.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(N.secondsDifference(e,t))<=r},N.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},N.secondsDifference=function(e,t){var r=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return r+(e.secondsOfDay-t.secondsOfDay)},N.daysDifference=function(e,t){var r=e.dayNumber-t.dayNumber,n=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return r+n},N.computeTaiMinusUtc=function(e){g.julianDate=e;var r=N.leapSeconds,n=t(r,g,l);return 0>n&&(n=~n,--n,0>n&&(n=0)),r[n].offset},N.addSeconds=function(e,t,r){return h(e.dayNumber,e.secondsOfDay+t,r)},N.addMinutes=function(e,t,r){var n=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return h(e.dayNumber,n,r)},N.addHours=function(e,t,r){var n=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return h(e.dayNumber,n,r)},N.addDays=function(e,t,r){var n=e.dayNumber+t;return h(n,e.secondsOfDay,r)},N.lessThan=function(e,t){return N.compare(e,t)<0},N.lessThanOrEquals=function(e,t){return N.compare(e,t)<=0},N.greaterThan=function(e,t){return N.compare(e,t)>0},N.greaterThanOrEquals=function(e,t){return N.compare(e,t)>=0},N.prototype.clone=function(e){return N.clone(this,e)},N.prototype.equals=function(e){return N.equals(this,e)},N.prototype.equalsEpsilon=function(e,t){return N.equalsEpsilon(this,e,t)},N.prototype.toString=function(){return N.toIso8601(this)},N.leapSeconds=[new u(new N(2441317,43210,c.TAI),10),new u(new N(2441499,43211,c.TAI),11),new u(new N(2441683,43212,c.TAI),12),new u(new N(2442048,43213,c.TAI),13),new u(new N(2442413,43214,c.TAI),14),new u(new N(2442778,43215,c.TAI),15),new u(new N(2443144,43216,c.TAI),16),new u(new N(2443509,43217,c.TAI),17),new u(new N(2443874,43218,c.TAI),18),new u(new N(2444239,43219,c.TAI),19),new u(new N(2444786,43220,c.TAI),20),new u(new N(2445151,43221,c.TAI),21),new u(new N(2445516,43222,c.TAI),22),new u(new N(2446247,43223,c.TAI),23),new u(new N(2447161,43224,c.TAI),24),new u(new N(2447892,43225,c.TAI),25),new u(new N(2448257,43226,c.TAI),26),new u(new N(2448804,43227,c.TAI),27),new u(new N(2449169,43228,c.TAI),28),new u(new N(2449534,43229,c.TAI),29),new u(new N(2450083,43230,c.TAI),30),new u(new N(2450630,43231,c.TAI),31),new u(new N(2451179,43232,c.TAI),32),new u(new N(2453736,43233,c.TAI),33),new u(new N(2454832,43234,c.TAI),34),new u(new N(2456109,43235,c.TAI),35),new u(new N(2457204,43236,c.TAI),36)],N}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(r,n){if(null===r||"object"!=typeof r)return r;n=e(n,!1);var a=new r.constructor;for(var i in r)if(r.hasOwnProperty(i)){var o=r[i];n&&(o=t(o,n)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0;n<r.length;++n){var a=r[n],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var r=function(e,r,n){this.statusCode=e,this.response=r,this.responseHeaders=n,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return r.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},r}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,r,n,a,i){"use strict";function o(e,t){var r=decodeURIComponent(t);return e?atob(r):r}function u(e,t){for(var r=o(e,t),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i<r.length;i++)a[i]=r.charCodeAt(i);return n}function s(e,r){r=t(r,"");var a=e[1],i=!!e[2],s=e[3];switch(r){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s);return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new n("Unhandled responseType: "+r)}}var c=function(r){r=t(r,t.EMPTY_OBJECT);var n=r.responseType,a=t(r.method,"GET"),i=r.data,o=r.headers,u=r.overrideMimeType;return e(r.url,function(t){var r=e.defer();return c.load(t,n,a,i,o,r,u),r.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,n,o,u,c,f){var d=l.exec(e);if(null!==d)return c.resolve(s(d,t)),void 0;var h=new XMLHttpRequest;if(r(f)&&r(h.overrideMimeType)&&h.overrideMimeType(f),h.open(n,e,!0),r(u))for(var p in u)u.hasOwnProperty(p)&&h.setRequestHeader(p,u[p]);r(t)&&(h.responseType=t),h.onload=function(){200===h.status?r(h.response)?c.resolve(h.response):r(h.responseXML)&&h.responseXML.hasChildNodes()?c.resolve(h.responseXML):r(h.responseText)?c.resolve(h.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){c.reject(new a)},h.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,r){return e({url:t,headers:r})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,r,n){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(r,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,n(r,i).then(function(e){return JSON.parse(e)})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,r,n,a,i,o,u,s,c,l,f){"use strict";function d(e,t){return o.compare(e.julianDate,t)}function h(e,r){if(!n(r.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!n(r.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=r.columnNames.indexOf("modifiedJulianDateUtc"),i=r.columnNames.indexOf("xPoleWanderRadians"),s=r.columnNames.indexOf("yPoleWanderRadians"),c=r.columnNames.indexOf("ut1MinusUtcSeconds"),h=r.columnNames.indexOf("xCelestialPoleOffsetRadians"),p=r.columnNames.indexOf("yCelestialPoleOffsetRadians"),m=r.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>h||0>p||0>m)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=r.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=p,e._taiMinusUtcSecondsColumn=m,e._columnCount=r.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],O=y[x+m],M=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,T=new o(M,O,f.TAI);if(v.push(T),w){if(O!==g&&n(g)){var _=o.leapSeconds,P=t(_,T,d);if(0>P){var b=new u(T,O);_.splice(~P,0,b)}}g=O}}}function p(e,t,r,n,a){var i=r*n;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function m(e,t,r){return t+e*(r-t)}function y(e,t,r,n,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u; -var c=t[a],l=t[i];if(c.equals(l)||n.equals(c))return p(e,r,a,s,u),u;if(n.equals(l))return p(e,r,i,s,u),u;var f=o.secondsDifference(n,c)/o.secondsDifference(l,c),d=a*s,h=i*s,y=r[d+e._ut1MinusUtcSecondsColumn],v=r[h+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=r[d+e._taiMinusUtcSecondsColumn],x=r[h+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(n)?y=v:v-=x-w)}return u.xPoleWander=m(f,r[d+e._xPoleWanderRadiansColumn],r[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=m(f,r[d+e._yPoleWanderRadiansColumn],r[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=m(f,r[d+e._xCelestialPoleOffsetRadiansColumn],r[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=m(f,r[d+e._yCelestialPoleOffsetRadiansColumn],r[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=m(f,y,v),u}var v=function(t){if(t=r(t,r.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=r(t.addNewLeapSeconds,!0),n(t.data))h(this,t.data);else if(n(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){h(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return n(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,r){if(!n(this._samples)){if(n(this._dataError))throw new c(this._dataError);return void 0}if(n(r)||(r=new a(0,0,0,0,0)),0===this._samples.length)return r.xPoleWander=0,r.yPoleWander=0,r.xPoleOffset=0,r.yPoleOffset=0,r.ut1MinusUtc=0,r;var i=this._dates,u=this._lastIndex,s=0,l=0;if(n(u)){var f=i[u],d=i[u+1],h=o.lessThanOrEquals(f,e),p=!n(d),m=p||o.greaterThanOrEquals(d,e);if(h&&m)return s=u,!p&&d.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,r),r}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,r),r},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var r=n.exec(t);this.scheme=r[1],this.authority=r[2],this.path=r[3],this.query=r[4],this.fragment=r[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function r(e,t,r,n){return(t||"")+r.toLowerCase()+(n||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var n=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,r).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var r=new e;return this.scheme?(r.scheme=this.scheme,r.authority=this.authority,r.path=this.path,r.query=this.query):(r.scheme=t.scheme,this.authority?(r.authority=this.authority,r.path=this.path,r.query=this.query):(r.authority=t.authority,""==this.path?(r.path=t.path,r.query=this.query||t.query):("/"==this.path.charAt(0)?(r.path=this.path,r.removeDotSegments()):(r.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,r.removeDotSegments()),r.query=this.query))),r.fragment=this.fragment,r},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),r=[],n=""==t[0];for(n&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?r.pop():"."!=e&&r.push(e);("."==e||".."==e)&&r.push(""),n&&r.unshift(""),this.path=r.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,r,n){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,r=e.length;r>t;++t){var n=e[t].getAttribute("src"),a=f.exec(n);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var n;if(n="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(n))throw new r("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(n).resolve(new e(document.location.href))}function o(e){return n.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,d=function(e){t(c)||(c=t(n.toUrl)?o:u),t(l)||(l=document.createElement("a"));var r=c(e);return l.href=r,l.href=l.href,l.href};return d._cesiumScriptRegex=f,d.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},d}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,r){this.x=e,this.y=t,this.s=r};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,r,n,a,i,o,u){"use strict";function s(e,t,r){var n=f;return n.dayNumber=t,n.secondsOfDay=r,i.daysDifference(n,e._sampleZeroDateTT)}function c(r,a){if(r._chunkDownloadsInProgress[a])return r._chunkDownloadsInProgress[a];var i=e.defer();r._chunkDownloadsInProgress[a]=i;var u,s=r._xysFileUrlTemplate;return u=n(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){r._chunkDownloadsInProgress[a]=!1;for(var t=r._samples,n=e.samples,o=3*a*r._samplesPerXysFile,u=0,s=n.length;s>u;++u)t[o+u]=n[u];i.resolve()}),i.promise}var l=function(e){e=r(e,r.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=r(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=r(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=r(e.stepSizeDays,1),this._samplesPerXysFile=r(e.samplesPerXysFile,1e3),this._totalSamples=r(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,n=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){n[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(n[s]*=s-c);n[s]=1/n[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new i(0,0,u.TAI);return l.prototype.preload=function(t,r,n,a){var i=s(this,t,r),o=s(this,n,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,d=0|l/this._samplesPerXysFile,h=[],p=f;d>=p;++p)h.push(c(this,p));return e.all(h)},l.prototype.computeXysRadians=function(e,t,r){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var d=!1,h=this._samples;if(n(h[3*l])||(c(this,0|l/this._samplesPerXysFile),d=!0),n(h[3*f])||(c(this,0|f/this._samplesPerXysFile),d=!0),d)return void 0;n(r)?(r.x=0,r.y=0,r.s=0):r=new a(0,0,0);var p,m,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(p=0;u>=p;++p)v[p]=y-x[p];for(p=0;u>=p;++p){for(w[p]=1,m=0;u>=m;++m)m!==p&&(w[p]*=v[m]);w[p]*=g[p];var E=3*(l+p);r.x+=w[p]*h[E++],r.y+=w[p]*h[E++],r.s+=w[p]*h[E]}return r},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,r,n,a,i,o,u){"use strict";var s=function(e,r,n,a){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,n,a){var i=n/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,d=Math.cos(i);return r(a)?(a.x=u,a.y=l,a.z=f,a.w=d,a):new s(u,l,f,d)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var n,a,i,o,c,d=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],p=e[u.COLUMN2ROW2],m=d+h+p;if(m>0)n=Math.sqrt(m+1),c=.5*n,n=.5/n,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*n,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*n,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*n;else{var y=l,v=0;h>d&&(v=1),p>d&&p>h&&(v=2);var g=y[v],w=y[g];n=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*n,n=.5/n,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*n,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*n,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*n,a=-x[0],i=-x[1],o=-x[2]}return r(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var d=new s;s.fromHeadingPitchRoll=function(t,r,n,a){var i=s.fromAxisAngle(e.UNIT_X,n,d),o=s.fromAxisAngle(e.UNIT_Y,-r,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,d);return s.multiply(u,a,a)};var h=new e,p=new e,m=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.x,r[n++]=e.y,r[n++]=e.z,r[n]=e.w},s.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new s),a.x=e[n],a.y=e[n+1],a.z=e[n+2],a.w=e[n+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,r,n){s.unpack(e,4*r,v),s.conjugate(v,v);for(var a=0,i=r-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),m),s.multiply(m,v,m),m.w<0&&s.negate(m,m),s.computeAxis(m,h);var u=s.computeAngle(m);n[o]=h.x*u,n[o+1]=h.y*u,n[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,n,a,i,o){r(o)||(o=new s),e.fromArray(t,0,p);var u=e.magnitude(p);return s.unpack(n,4*i,y),0===u?s.clone(s.IDENTITY,m):s.fromAxisAngle(p,u,m),s.multiply(m,y,o)},s.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var r=1/s.magnitude(e),n=e.x*r,a=e.y*r,i=e.z*r,o=e.w*r;return t.x=n,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var r=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/r,t)},s.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},s.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,r){var n=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+n*l+a*c-i*s,d=o*s-n*c+a*l+i*u,h=o*c+n*s-a*u+i*l,p=o*l-n*u-a*s-i*c;return r.x=f,r.y=d,r.z=h,r.w=p,r},s.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},s.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},s.computeAxis=function(e,t){var r=e.w;if(Math.abs(r-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var n=1/Math.sqrt(1-r*r);return t.x=e.x*n,t.y=e.y*n,t.z=e.z*n,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,r,n){return g=s.multiplyByScalar(t,r,g),n=s.multiplyByScalar(e,1-r,n),s.add(g,n,n)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,r,n){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,r,n);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-r)*u),x),E=s.multiplyByScalar(i,Math.sin(r*u),E),n=s.add(x,E,n),s.multiplyByScalar(n,1/Math.sin(u),n)},s.log=function(t,r){var n=o.acosClamped(t.w),a=0;return 0!==n&&(a=n/Math.sin(n)),e.multiplyByScalar(t,a,r)},s.exp=function(t,r){var n=e.magnitude(t),a=0;return 0!==n&&(a=Math.sin(n)/n),r.x=t.x*a,r.y=t.y*a,r.z=t.z*a,r.w=Math.cos(n),r};var S=new e,O=new e,M=new s,T=new s;s.computeInnerQuadrangle=function(t,r,n,a){var i=s.conjugate(r,M);s.multiply(i,n,T);var o=s.log(T,S);s.multiply(i,t,T);var u=s.log(T,O);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,M),s.multiply(r,M,a)},s.squad=function(e,t,r,n,a,i){var o=s.slerp(e,t,a,M),u=s.slerp(r,n,a,T);return s.slerp(o,u,2*a*(1-a),i)};for(var _=new s,P=1.9011074535173003,b=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],A=a.supportsTypedArrays()?new Float32Array(8):[],I=a.supportsTypedArrays()?new Float32Array(8):[],C=0;7>C;++C){var z=C+1,R=2*z+1;b[C]=1/(z*R),N[C]=z/R}return b[7]=P/136,N[7]=8*P/17,s.fastSlerp=function(e,t,r,n){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-r,c=r*r,l=u*u,f=7;f>=0;--f)A[f]=(b[f]*c-N[f])*o,I[f]=(b[f]*l-N[f])*o;var d=a*r*(1+A[0]*(1+A[1]*(1+A[2]*(1+A[3]*(1+A[4]*(1+A[5]*(1+A[6]*(1+A[7])))))))),h=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),p=s.multiplyByScalar(e,h,_);return s.multiplyByScalar(t,d,n),s.add(p,n,n)},s.fastSquad=function(e,t,r,n,a,i){var o=s.fastSlerp(e,t,a,M),u=s.fastSlerp(r,n,a,T);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,p,m,y,v){"use strict";var g={},w=new r,x=new r,E=new r;g.eastNorthUpToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=0,n[1]=1,n[2]=0,n[3]=0,n[4]=-o,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=o,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=s.x,n[1]=s.y,n[2]=s.z,n[3]=0,n[4]=l.x,n[5]=l.y,n[6]=l.z,n[7]=0,n[8]=u.x,n[9]=u.y,n[10]=u.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new r,O=new r,M=new r;g.northEastDownToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=-o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-o,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=O,l=M;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=l.x,n[1]=l.y,n[2]=l.z,n[3]=0,n[4]=s.x,n[5]=s.y,n[6]=s.z,n[7]=0,n[8]=-u.x,n[9]=-u.y,n[10]=-u.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=-o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=o,n[7]=0,n[8]=0,n[9]=1,n[10]=0,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=l.x,n[1]=l.y,n[2]=l.z,n[3]=0,n[4]=u.x,n[5]=u.y,n[6]=u.z,n[7]=0,n[8]=s.x,n[9]=s.y,n[10]=s.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new m(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var T=new y,_=new r(1,1,1),P=new m;g.headingPitchRollToFixedFrame=function(e,t,n,a,i,o){var u=y.fromHeadingPitchRoll(t,n,a,T),s=m.fromTranslationQuaternionRotationScale(r.ZERO,u,_,P);return o=g.eastNorthUpToFixedFrame(e,i,o),m.multiply(o,s,o)};var b=new m,N=new p;g.headingPitchRollQuaternion=function(e,t,r,n,a,i){var o=g.headingPitchRollToFixedFrame(e,t,r,n,a,b),u=m.getRotation(o,N);return y.fromRotationMatrix(u,i)};var A=24110.54841,I=8640184.812866,C=.093104,z=-62e-7,R=1.1772758384668e-19,D=72921158553e-15,L=h.TWO_PI/86400,q=new d;g.computeTemeToPseudoFixedMatrix=function(e,t){q=d.addSeconds(e,-d.computeTaiMinusUtc(e),q);var r,n=q.dayNumber,a=q.secondsOfDay,o=n-2451545;r=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=A+r*(I+r*(C+r*z)),s=u*L%h.TWO_PI,c=D+R*(n-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,m=Math.cos(f),y=Math.sin(f);return i(t)?(t[0]=m,t[1]=-y,t[2]=0,t[3]=y,t[4]=m,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new p(m,y,0,-y,m,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var U=32.184,B=2451545;g.preloadIcrfFixed=function(t){var r=t.start.dayNumber,n=t.start.secondsOfDay+U,a=t.stop.dayNumber,i=t.stop.secondsOfDay+U,o=g.iau2006XysData.preload(r,n,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new p);var r=g.computeFixedToIcrfMatrix(e,t);return i(r)?p.transpose(r,t):void 0};var W=new f(0,0,0),F=new s(0,0,0,0,0,0),G=new p,k=new p;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new p);var r=g.earthOrientationParameters.compute(e,F);if(!i(r))return void 0;var n=e.dayNumber,a=e.secondsOfDay+U,o=g.iau2006XysData.computeXysRadians(n,a,W);if(!i(o))return void 0;var u=o.x+r.xPoleOffset,s=o.y+r.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=p.fromRotationZ(-o.s,k),m=p.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-d.computeTaiMinusUtc(e)+r.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*h.TWO_PI;var O=p.fromRotationZ(S,k),M=p.multiply(m,O,G),T=Math.cos(r.xPoleWander),_=Math.cos(r.yPoleWander),P=Math.sin(r.xPoleWander),b=Math.sin(r.yPoleWander),N=n-B+a/v.SECONDS_PER_DAY;N/=36525;var A=-47e-6*N*h.RADIANS_PER_DEGREE/3600,I=Math.cos(A),C=Math.sin(A),z=k;return z[0]=T*I,z[1]=T*C,z[2]=P,z[3]=-_*C+b*P*I,z[4]=_*I+b*P*C,z[5]=-b*T,z[6]=-b*C-_*P*I,z[7]=b*I-_*P*C,z[8]=_*T,p.multiply(M,z,t)};var H=new n;g.pointToWindowCoordinates=function(e,t,r,n){return n=g.pointToGLWindowCoordinates(e,t,r,n),n.y=2*t[5]-n.y,n},g.pointToGLWindowCoordinates=function(e,r,a,o){i(o)||(o=new t);var u=H;return m.multiplyByVector(e,n.fromElements(a.x,a.y,a.z,1,u),u),n.multiplyByScalar(u,1/u.w,u),m.multiplyByVector(r,u,u),t.fromCartesian4(u,o)};var V=new r,Y=new r,j=new r;return g.rotationMatrixFromPositionVelocity=function(e,t,n,o){var u=a(n,c.WGS84).geodeticSurfaceNormal(e,V),s=r.cross(t,u,Y);r.equalsEpsilon(s,r.ZERO,h.EPSILON6)&&(s=r.clone(r.UNIT_X,s));var l=r.cross(s,t,j);return r.cross(t,l,s),r.negate(s,s),i(o)||(o=new p),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,p){"use strict";var m=new n,y=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var n=p.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=r.fromCartesian4(f.getColumn(n,0,m)),this._yAxis=r.fromCartesian4(f.getColumn(n,1,m));var i=r.fromCartesian4(f.getColumn(n,2,m));this._plane=d.fromPointNormal(e,i)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,r){var n=e.fromPoints(t,v);return new y(n.center,r)};var g=new h,w=new r;y.prototype.projectPointOntoPlane=function(e,n){var a=g;a.origin=e,r.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,w);if(i(o)||(r.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w)),i(o)){var u=r.subtract(o,this._origin,o),s=r.dot(this._xAxis,u),l=r.dot(this._yAxis,u);return i(n)?(n.x=s,n.y=l,n):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var r=0,n=e.length,a=0;n>a;a++){var o=this.projectPointOntoPlane(e[a],t[r]);i(o)&&(t[r]=o,r++)}return t.length=r,t},y.prototype.projectPointToNearestOnPlane=function(e,n){i(n)||(n=new t);var a=g;a.origin=e,r.clone(this._plane.normal,a.direction);var o=c.rayPlane(a,this._plane,w);i(o)||(r.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w));var u=r.subtract(o,this._origin,o),s=r.dot(this._xAxis,u),l=r.dot(this._yAxis,u);return n.x=s,n.y=l,n},y.prototype.projectPointsToNearestOnPlane=function(e,t){i(t)||(t=[]);var r=e.length;t.length=r;for(var n=0;r>n;n++)t[n]=this.projectPointToNearestOnPlane(e[n],t[n]);return t};var x=new r;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var n=e.length;i(t)?t.length=n:t=new Array(n);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;n>l;++l){var f=e[l];r.multiplyByScalar(u,f.x,c),i(t[l])||(t[l]=new r);var d=r.add(o,c,t[l]);r.multiplyByScalar(s,f.y,c),r.add(d,c,d),a.scaleToGeocentricSurface(d,d)}return t},y}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,n.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var n=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(n!==o&&-1!==n)throw new r("All attribute lists must have the same number of attributes.");n=o}return n},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=n.clone(e(t.modelMatrix,n.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return a}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n,a){"use strict";var i={};i.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=t.x,n=t.y;t.x=(1-Math.abs(n))*a.signNotZero(r),t.y=(1-Math.abs(r))*a.signNotZero(n)}return t.x=a.toSNorm(t.x),t.y=a.toSNorm(t.y),t},i.octDecode=function(e,r,n){if(n.x=a.fromSNorm(e),n.y=a.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var i=n.x;n.x=(1-Math.abs(n.y))*a.signNotZero(i),n.y=(1-Math.abs(i))*a.signNotZero(n.y)}return t.normalize(n,n)},i.octPackFloat=function(e){return 256*e.x+e.y};var o=new e;return i.octEncodeFloat=function(e){return i.octEncode(e,o),i.octPackFloat(o)},i.octDecodeFloat=function(e,t){var r=e/256,n=Math.floor(r),a=256*(r-n);return i.octDecode(n,a,t)},i.octPack=function(e,t,r,n){var a=i.octEncodeFloat(e),u=i.octEncodeFloat(t),s=i.octEncode(r,o);return n.x=65536*s.x+a,n.y=65536*s.y+u,n},i.octUnpack=function(e,t,r,n){var a=e.x/65536,o=Math.floor(a),u=65536*(a-o);a=e.y/65536;var s=Math.floor(a),c=65536*(a-s);i.octDecodeFloat(u,t),i.octDecodeFloat(c,r),i.octDecode(o,s,n)},i.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,r=1===e.y?4095:0|4096*e.y;return 4096*t+r},i.decompressTextureCoordinates=function(e,t){var r=e/4096;return t.x=Math.floor(r)/4096,t.y=r-Math.floor(r),t},i}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=new t,a=new t,i=new t,o=function(o,u,s,c,l){r(l)||(l=new t);var f,d,h,p,m,y,v,g;r(u.z)?(f=t.subtract(s,u,n),d=t.subtract(c,u,a),h=t.subtract(o,u,i),p=t.dot(f,f),m=t.dot(f,d),y=t.dot(f,h),v=t.dot(d,d),g=t.dot(d,h)):(f=e.subtract(s,u,n),d=e.subtract(c,u,a),h=e.subtract(o,u,i),p=e.dot(f,f),m=e.dot(f,d),y=e.dot(f,h),v=e.dot(d,d),g=e.dot(d,h));var w=1/(p*v-m*m);return l.y=(v*y-m*g)*w,l.z=(p*g-m*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};r.encode=function(e,r){t(r)||(r={high:0,low:0});var n;return e>=0?(n=65536*Math.floor(e/65536),r.high=n,r.low=e-n):(n=65536*Math.floor(-e/65536),r.high=-n,r.low=e+n),r};var n={high:0,low:0};r.fromCartesian=function(e,a){t(a)||(a=new r);var i=a.high,o=a.low;return r.encode(e.x,n),i.x=n.high,o.x=n.low,r.encode(e.y,n),i.y=n.high,o.y=n.low,r.encode(e.z,n),i.z=n.high,o.z=n.low,a};var a=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,a);var i=a.high,o=a.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z},r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,r,a){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,a):new Uint16Array(t,r,a)},r(a)}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};return r.calculateACMR=function(r){r=e(r,e.EMPTY_OBJECT);var n=r.indices,a=r.maximumIndex,i=e(r.cacheSize,24),o=n.length;if(!t(a)){a=0;for(var u=0,s=n[u];o>u;)s>a&&(a=s),++u,s=n[u]}for(var c=[],l=0;a+1>l;l++)c[l]=0;for(var f=i+1,d=0;o>d;++d)f-c[n[d]]>i&&(c[n[d]]=f,++f);return(f-i+1)/(o/3)},r.tipsify=function(r){function n(e,t,r,n){for(;t.length>=1;){var a=t[t.length-1];if(t.splice(t.length-1,1),e[a].numLiveTriangles>0)return a}for(;n>i;){if(e[i].numLiveTriangles>0)return++i,i-1;++i}return-1}function a(e,t,r,a,i,o,u){for(var s,c=-1,l=-1,f=0;f<r.length;){var d=r[f];a[d].numLiveTriangles&&(s=0,i-a[d].timeStamp+2*a[d].numLiveTriangles<=t&&(s=i-a[d].timeStamp),(s>l||-1===l)&&(l=s,c=d)),++f}return-1===c?n(a,o,e,u):c}r=e(r,e.EMPTY_OBJECT);var i,o=r.indices,u=r.maximumIndex,s=e(r.cacheSize,24),c=o.length,l=0,f=0,d=o[f],h=c;if(t(u))l=u+1;else{for(;h>f;)d>l&&(l=d),++f,d=o[f];if(-1===l)return 0;++l}for(var p=[],m=0;l>m;m++)p[m]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var y=0;h>f;)p[o[f]].vertexTriangles.push(y),++p[o[f]].numLiveTriangles,p[o[f+1]].vertexTriangles.push(y),++p[o[f+1]].numLiveTriangles,p[o[f+2]].vertexTriangles.push(y),++p[o[f+2]].numLiveTriangles,++y,f+=3;var v=0,g=s+1;i=1;var w,x,E=[],S=[],O=0,M=[],T=c/3,_=[];for(m=0;T>m;m++)_[m]=!1;for(var P,b;-1!==v;){E=[],x=p[v],b=x.vertexTriangles.length;for(var N=0;b>N;++N)if(y=x.vertexTriangles[N],!_[y]){_[y]=!0,f=y+y+y;for(var A=0;3>A;++A)P=o[f],E.push(P),S.push(P),M[O]=P,++O,w=p[P],--w.numLiveTriangles,g-w.timeStamp>s&&(w.timeStamp=g,++g),++f}v=a(o,s,E,p,g,S,l)}return M},r}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,p,m,y,v,g,w,x,E,S,O,M,T){"use strict";function _(e,t,r,n,a){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=a,e[t++]=a,e[t]=r}function P(e){for(var t=e.length,r=6*(t/3),n=v.createTypedArray(t,r),a=0,i=0;t>i;i+=3,a+=6)_(n,a,e[i],e[i+1],e[i+2]);return n}function b(e){var t=e.length;if(t>=3){var r=6*(t-2),n=v.createTypedArray(t,r);_(n,0,e[0],e[1],e[2]);for(var a=6,i=3;t>i;++i,a+=6)_(n,a,e[i-1],e[i],e[i-2]);return n}return new Uint16Array}function N(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=v.createTypedArray(t,r),a=e[0],i=0,o=1;t>o;++o,i+=6)_(n,i,a,e[o],e[o+1]);return n}return new Uint16Array}function A(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new p({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function I(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var a=t[n],i=0;i<a.componentsPerAttribute;++i)e[n].values.push(a.values[r*a.componentsPerAttribute+i])}function C(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,it),S.multiplyByPoint(e,it,it),a.pack(it,r,i) -}function z(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,it),E.multiplyByVector(e,it,it),it=a.normalize(it,it),a.pack(it,r,i)}function R(e,t){var r,n=e.length,a={},i=e[0][t].attributes;for(r in i)if(i.hasOwnProperty(r)&&c(i[r])&&c(i[r].values)){for(var o=i[r],s=o.values.length,l=!0,f=1;n>f;++f){var d=e[f][t].attributes[r];if(!c(d)||o.componentDatatype!==d.componentDatatype||o.componentsPerAttribute!==d.componentsPerAttribute||o.normalize!==d.normalize){l=!1;break}s+=d.values.length}l&&(a[r]=new p({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return a}function D(e,t){var n,i,o,u,s=e.length;e[0].modelMatrix;var l,f,d,p=c(e[0][t].indices),m=e[0][t].primitiveType,y=R(e,t);for(n in y)if(y.hasOwnProperty(n))for(l=y[n].values,u=0,i=0;s>i;++i)for(f=e[i][t].attributes[n].values,d=f.length,o=0;d>o;++o)l[u++]=f[o];var g;if(p){var w=0;for(i=0;s>i;++i)w+=e[i][t].indices.length;var x=h.computeNumberOfVertices(new h({attributes:y,primitiveType:M.POINTS})),E=v.createTypedArray(x,w),S=0,O=0;for(i=0;s>i;++i){var T=e[i][t].indices,_=T.length;for(u=0;_>u;++u)E[S++]=O+T[u];O+=h.computeNumberOfVertices(e[i][t])}g=E}var P,b=new a,N=0;for(i=0;s>i;++i){if(P=e[i][t].boundingSphere,!c(P)){b=void 0;break}a.add(P.center,b,b)}if(c(b))for(a.divideByScalar(b,s,b),i=0;s>i;++i){P=e[i][t].boundingSphere;var A=a.magnitude(a.subtract(P.center,b,st))+P.radius;A>N&&(N=A)}return new h({attributes:y,indices:g,primitiveType:m,boundingSphere:c(b)?new r(b,N):void 0})}function L(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function q(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,a=3;t>a;++a)r[n++]=a-1,r[n++]=0,r[n++]=a;return e.indices=r,e.primitiveType=M.TRIANGLES,e}function U(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,a=3;t-1>a;a+=2)r[n++]=a,r[n++]=a-1,r[n++]=a+1,t>a+2&&(r[n++]=a,r[n++]=a+1,r[n++]=a+2);return e.indices=r,e.primitiveType=M.TRIANGLES,e}function B(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function W(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return e.indices=r,e.primitiveType=M.LINES,e}function F(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=M.LINES,e}function G(e){switch(e.primitiveType){case M.TRIANGLE_FAN:return q(e);case M.TRIANGLE_STRIP:return U(e);case M.TRIANGLES:return L(e);case M.LINE_STRIP:return W(e);case M.LINE_LOOP:return F(e);case M.LINES:return B(e)}return e}function k(e,t){Math.abs(e.y)<x.EPSILON6&&(e.y=t?-x.EPSILON6:x.EPSILON6)}function H(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return k(e,e.y<0),k(t,t.y<0),k(r,r.y<0),void 0;var n,a=Math.abs(e.y),i=Math.abs(t.y),o=Math.abs(r.y);n=a>i?a>o?x.sign(e.y):x.sign(r.y):i>o?x.sign(t.y):x.sign(r.y);var u=0>n;k(e,u),k(t,u),k(r,u)}function V(e,t,r,n){a.add(e,a.multiplyByScalar(a.subtract(t,e,xt),e.y/(e.y-t.y),xt),r),a.clone(r,n),k(r,!0),k(n,!1)}function Y(e,t,r){if(e.x>=0||t.x>=0||r.x>=0)return void 0;H(e,t,r);var n=e.y<0,a=t.y<0,i=r.y<0,o=0;o+=n?1:0,o+=a?1:0,o+=i?1:0;var u=Tt.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(V(e,t,Et,Ot),V(e,r,St,Mt),u[0]=0,u[3]=1,u[4]=2,u[6]=1):a?(V(t,r,Et,Ot),V(t,e,St,Mt),u[0]=1,u[3]=2,u[4]=0,u[6]=2):i&&(V(r,e,Et,Ot),V(r,t,St,Mt),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,n?a?i||(V(r,e,Et,Ot),V(r,t,St,Mt),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(V(t,r,Et,Ot),V(t,e,St,Mt),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(V(e,t,Et,Ot),V(e,r,St,Mt),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=Tt.positions;return s[0]=e,s[1]=t,s[2]=r,s.length=3,(1===o||2===o)&&(s[3]=Et,s[4]=St,s[5]=Ot,s[6]=Mt,s.length=7),Tt}function j(e,t){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var a in n)if(n.hasOwnProperty(a)&&c(n[a])&&c(n[a].values)){var i=n[a];i.values=u.createTypedArray(i.componentDatatype,i.values)}var o=h.computeNumberOfVertices(e);return e.indices=v.createTypedArray(o,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}function Z(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var a=t[n];r[n]=new p({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:[]})}return new h({attributes:r,indices:[],primitiveType:e.primitiveType})}function X(e,t,r){var n=c(e.geometry.boundingSphere);t=j(t,n),r=j(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function J(e,r,i,o,u,s,l,f,d,h,p){if(c(s)||c(l)||c(f)||c(d)){var m=a.fromArray(u,3*e,_t),y=a.fromArray(u,3*r,Pt),v=a.fromArray(u,3*i,bt),g=t(o,m,y,v,Nt);if(c(s)){var w=a.fromArray(s,3*e,_t),x=a.fromArray(s,3*r,Pt),E=a.fromArray(s,3*i,bt);a.multiplyByScalar(w,g.x,w),a.multiplyByScalar(x,g.y,x),a.multiplyByScalar(E,g.z,E);var S=a.add(w,x,w);a.add(S,E,S),a.normalize(S,S),a.pack(S,h.normal.values,3*p)}if(c(l)){var O=a.fromArray(l,3*e,_t),M=a.fromArray(l,3*r,Pt),T=a.fromArray(l,3*i,bt);a.multiplyByScalar(O,g.x,O),a.multiplyByScalar(M,g.y,M),a.multiplyByScalar(T,g.z,T);var _=a.add(O,M,O);a.add(_,T,_),a.normalize(_,_),a.pack(_,h.binormal.values,3*p)}if(c(f)){var P=a.fromArray(f,3*e,_t),b=a.fromArray(f,3*r,Pt),N=a.fromArray(f,3*i,bt);a.multiplyByScalar(P,g.x,P),a.multiplyByScalar(b,g.y,b),a.multiplyByScalar(N,g.z,N);var A=a.add(P,b,P);a.add(A,N,A),a.normalize(A,A),a.pack(A,h.tangent.values,3*p)}if(c(d)){var I=n.fromArray(d,2*e,At),C=n.fromArray(d,2*r,It),z=n.fromArray(d,2*i,Ct);n.multiplyByScalar(I,g.x,I),n.multiplyByScalar(C,g.y,C),n.multiplyByScalar(z,g.z,z);var R=n.add(I,C,I);n.add(R,z,R),n.pack(R,h.st.values,2*p)}}}function K(e,t,r,n,a,i){var o=e.position.values.length/3;if(-1!==a){var u=n[a],s=r[u];return-1===s?(r[u]=o,e.position.values.push(i.x,i.y,i.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(i.x,i.y,i.z),t.push(o),o}function Q(e){var t,r,n,i,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,d=c(s.binormal)?s.binormal.values:void 0,h=c(s.tangent)?s.tangent.values:void 0,p=c(s.st)?s.st.values:void 0,m=u.indices,y=Z(u),v=Z(u),g=[];g.length=l.length/3;var w=[];for(w.length=l.length/3,o=0;o<g.length;++o)g[o]=-1,w[o]=-1;var x=m.length;for(o=0;x>o;o+=3){var E=m[o],S=m[o+1],O=m[o+2],M=a.fromArray(l,3*E),T=a.fromArray(l,3*S),_=a.fromArray(l,3*O),P=Y(M,T,_);if(c(P)&&P.positions.length>3)for(var b=P.positions,N=P.indices,A=N.length,I=0;A>I;++I){var C=N[I],z=b[C];z.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=w),i=K(t,r,n,m,3>C?o+C:-1,z),J(E,S,O,z,l,f,d,h,p,t,i)}else c(P)&&(M=P.positions[0],T=P.positions[1],_=P.positions[2]),M.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=w),i=K(t,r,n,m,o,M),J(E,S,O,M,l,f,d,h,p,t,i),i=K(t,r,n,m,o+1,T),J(E,S,O,T,l,f,d,h,p,t,i),i=K(t,r,n,m,o+2,_),J(E,S,O,_,l,f,d,h,p,t,i)}X(e,v,y)}function $(e){var t,r=e.geometry,n=r.attributes,i=n.position.values,o=r.indices,u=Z(r),s=Z(r),l=o.length,f=[];f.length=i.length/3;var d=[];for(d.length=i.length/3,t=0;t<f.length;++t)f[t]=-1,d[t]=-1;for(t=0;l>t;t+=2){var h=o[t],p=o[t+1],m=a.fromArray(i,3*h,_t),y=a.fromArray(i,3*p,Pt);Math.abs(m.y)<x.EPSILON6&&(m.y=m.y<0?-x.EPSILON6:x.EPSILON6),Math.abs(y.y)<x.EPSILON6&&(y.y=y.y<0?-x.EPSILON6:x.EPSILON6);var v=u.attributes,g=u.indices,E=d,S=s.attributes,O=s.indices,M=f,T=w.lineSegmentPlane(m,y,zt,bt);if(c(T)){var _=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,Rt);m.y<0&&(a.negate(_,_),v=s.attributes,g=s.indices,E=f,S=u.attributes,O=u.indices,M=d);var P=a.add(T,_,Dt);K(v,g,E,o,t,m),K(v,g,E,o,-1,P),a.negate(_,_),a.add(T,_,P),K(S,O,M,o,-1,P),K(S,O,M,o,t+1,y)}else{var b,N,A;m.y<0?(b=s.attributes,N=s.indices,A=f):(b=u.attributes,N=u.indices,A=d),K(b,N,A,o,t,m),K(b,N,A,o,t+1,y)}}X(e,s,u)}function et(e){var t=e.geometry,r=t.attributes,o=r.position.values,u=r.prevPosition.values,s=r.nextPosition.values,l=r.expandAndWidth.values;t.indices;var f,d,h,p=c(r.st)?r.st.values:void 0,m=c(r.color)?r.color.values:void 0,y=Z(t),v=Z(t),g=o.length/3;for(f=0;g>f;f+=4){var E=f,S=f+1,O=f+2,M=f+3,T=a.fromArray(o,3*E,Ut),_=a.fromArray(o,3*S,Bt),P=a.fromArray(o,3*O,Wt),b=a.fromArray(o,3*M,Ft);Math.abs(T.y)<x.EPSILON6&&(T.y=x.EPSILON6*(P.y<0?-1:1),_.y=T.y),Math.abs(P.y)<x.EPSILON6&&(P.y=x.EPSILON6*(T.y<0?-1:1),b.y=P.y);var N=y.attributes,A=y.indices,I=v.attributes,C=v.indices,z=w.lineSegmentPlane(T,P,zt,Gt);if(c(z)){var R=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,kt);T.y<0&&(a.negate(R,R),N=v.attributes,A=v.indices,I=y.attributes,C=y.indices);var D=a.add(z,R,Ht);for(N.position.values.push(T.x,T.y,T.z,_.x,_.y,_.z),N.position.values.push(D.x,D.y,D.z),N.position.values.push(D.x,D.y,D.z),a.negate(R,R),a.add(z,R,D),I.position.values.push(D.x,D.y,D.z),I.position.values.push(D.x,D.y,D.z),I.position.values.push(P.x,P.y,P.z,b.x,b.y,b.z),d=3*E;3*E+6>d;++d)N.prevPosition.values.push(u[d]);for(N.prevPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),I.prevPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),d=3*O;3*O+6>d;++d)I.prevPosition.values.push(u[d]);for(d=3*E;3*E+6>d;++d)N.nextPosition.values.push(s[d]);for(N.nextPosition.values.push(P.x,P.y,P.z,P.x,P.y,P.z),I.nextPosition.values.push(P.x,P.y,P.z,P.x,P.y,P.z),d=3*O;3*O+6>d;++d)I.nextPosition.values.push(s[d]);var L=n.fromArray(l,2*E,Lt),q=Math.abs(L.y);N.expandAndWidth.values.push(-1,q,1,q),N.expandAndWidth.values.push(-1,-q,1,-q),I.expandAndWidth.values.push(-1,q,1,q),I.expandAndWidth.values.push(-1,-q,1,-q);var U=a.magnitudeSquared(a.subtract(z,T,Ft));if(U/=a.magnitudeSquared(a.subtract(P,T,Ft)),c(m)){var B=i.fromArray(m,4*E,Vt),W=i.fromArray(m,4*O,Vt),F=x.lerp(B.x,W.x,U),G=x.lerp(B.y,W.y,U),k=x.lerp(B.z,W.z,U),H=x.lerp(B.w,W.w,U);for(d=4*E;4*E+8>d;++d)N.color.values.push(m[d]);for(N.color.values.push(F,G,k,H),N.color.values.push(F,G,k,H),I.color.values.push(F,G,k,H),I.color.values.push(F,G,k,H),d=4*O;4*O+8>d;++d)I.color.values.push(m[d])}if(c(p)){var V=n.fromArray(p,2*E,Lt),Y=n.fromArray(p,2*(f+3),qt),j=x.lerp(V.x,Y.x,U);for(d=2*E;2*E+4>d;++d)N.st.values.push(p[d]);for(N.st.values.push(j,V.y),N.st.values.push(j,Y.y),I.st.values.push(j,V.y),I.st.values.push(j,Y.y),d=2*O;2*O+4>d;++d)I.st.values.push(p[d])}h=N.position.values.length/3-4,A.push(h,h+2,h+1),A.push(h+1,h+2,h+3),h=I.position.values.length/3-4,C.push(h,h+2,h+1),C.push(h+1,h+2,h+3)}else{var J,K;for(T.y<0?(J=v.attributes,K=v.indices):(J=y.attributes,K=y.indices),J.position.values.push(T.x,T.y,T.z),J.position.values.push(_.x,_.y,_.z),J.position.values.push(P.x,P.y,P.z),J.position.values.push(b.x,b.y,b.z),d=3*f;3*f+12>d;++d)J.prevPosition.values.push(u[d]),J.nextPosition.values.push(s[d]);for(d=2*f;2*f+8>d;++d)J.expandAndWidth.values.push(l[d]),c(p)&&J.st.values.push(p[d]);if(c(m))for(d=4*f;4*f+16>d;++d)J.color.values.push(m[d]);h=J.position.values.length/3-4,K.push(h,h+2,h+1),K.push(h+1,h+2,h+3)}}X(e,v,y)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case M.TRIANGLES:e.indices=P(t);break;case M.TRIANGLE_STRIP:e.indices=b(t);break;case M.TRIANGLE_FAN:e.indices=N(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=M.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,n){t=s(t,"normal"),n=s(n,1e4);for(var a=e.attributes.position.values,i=e.attributes[t].values,o=a.length,l=new Float64Array(2*o),f=0,d=0;o>d;d+=3)l[f++]=a[d],l[f++]=a[d+1],l[f++]=a[d+2],l[f++]=a[d]+i[d]*n,l[f++]=a[d+1]+i[d+1]*n,l[f++]=a[d+2]+i[d+2]*n;var m,y=e.boundingSphere;return c(y)&&(m=new r(y.center,y.radius+n)),new h({attributes:{position:new p({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:M.LINES,boundingSphere:m})},tt.createAttributeLocations=function(e){var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,a={},i=0,o=r.length;for(t=0;o>t;++t){var u=r[t];c(n[u])&&(a[u]=i++)}for(var s in n)n.hasOwnProperty(s)&&!c(a[s])&&(a[s]=i++);return a},tt.reorderForPreVertexCache=function(e){var t=h.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),a=0;t>a;a++)n[a]=-1;for(var i,o=r,s=o.length,l=v.createTypedArray(t,s),f=0,d=0,p=0;s>f;)i=n[o[f]],-1!==i?l[d]=i:(i=o[f],n[i]=p,l[d]=p,++p),++f,++d;e.indices=l;var m=e.attributes;for(var y in m)if(m.hasOwnProperty(y)&&c(m[y])&&c(m[y].values)){for(var g=m[y],w=g.values,x=0,E=g.componentsPerAttribute,S=u.createTypedArray(g.componentDatatype,p*E);t>x;){var O=n[x];if(-1!==O)for(a=0;E>a;a++)S[E*O+a]=w[E*x+a];++x}g.values=S}}return e},tt.reorderForPostVertexCache=function(e,t){var r=e.indices;if(e.primitiveType===M.TRIANGLES&&c(r)){for(var n=r.length,a=0,i=0;n>i;i++)r[i]>a&&(a=r[i]);e.indices=T.tipsify({indices:r,maximumIndex:a,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],r=h.computeNumberOfVertices(e);if(c(e.indices)&&r>x.SIXTY_FOUR_KILOBYTES){var n,a=[],i=[],o=0,u=A(e.attributes),s=e.indices,l=s.length;e.primitiveType===M.TRIANGLES?n=3:e.primitiveType===M.LINES?n=2:e.primitiveType===M.POINTS&&(n=1);for(var f=0;l>f;f+=n){for(var d=0;n>d;++d){var p=s[f+d],m=a[p];c(m)||(m=o++,a[p]=m,I(u,e.attributes,p)),i.push(m)}o+n>x.SIXTY_FOUR_KILOBYTES&&(t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],i=[],o=0,u=A(e.attributes))}0!==i.length&&t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var rt=new a,nt=new o;tt.projectTo2D=function(e,t,r,n,i){var o=e.attributes[t];i=c(i)?i:new d;for(var s=i.ellipsoid,f=o.values,h=new Float64Array(f.length),m=0,y=0;y<f.length;y+=3){var v=a.fromArray(f,y,rt),g=s.cartesianToCartographic(v,nt);if(!c(g))throw new l("Could not project point ("+v.x+", "+v.y+", "+v.z+") to 2D.");var w=i.project(g,rt);h[m++]=w.x,h[m++]=w.y,h[m++]=w.z}return e.attributes[r]=o,e.attributes[n]=new p({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:h}),delete e.attributes[t],e};var at={high:0,low:0};tt.encodeAttribute=function(e,t,r,n){for(var a=e.attributes[t],i=a.values,o=i.length,s=new Float32Array(o),c=new Float32Array(o),l=0;o>l;++l)f.encode(i[l],at),s[l]=at.high,c[l]=at.low;var d=a.componentsPerAttribute;return e.attributes[r]=new p({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:s}),e.attributes[n]=new p({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:c}),delete e.attributes[t],e};var it=new a,ot=new S,ut=new E;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(S.equals(t,S.IDENTITY))return e;var n=e.geometry.attributes;C(t,n.position),C(t,n.prevPosition),C(t,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(S.inverse(t,ot),S.transpose(ot,ot),S.getRotation(ot,ut),z(ut,n.normal),z(ut,n.binormal),z(ut,n.tangent));var a=e.geometry.boundingSphere;return c(a)&&(e.geometry.boundingSphere=r.transform(a,t,a)),e.modelMatrix=S.clone(S.IDENTITY),e};var st=new a;tt.combineInstances=function(e){for(var t=[],r=[],n=e.length,a=0;n>a;++a){var i=e[a];c(i.geometry)?t.push(i):r.push(i)}var o=[];return t.length>0&&o.push(D(t,"geometry")),r.length>0&&(o.push(D(r,"westHemisphereGeometry")),o.push(D(r,"eastHemisphereGeometry"))),o};var ct=new a,lt=new a,ft=new a,dt=new a;tt.computeNormal=function(e){for(var t=e.indices,r=e.attributes,n=r.position.values,i=r.position.values.length/3,o=t.length,s=new Array(i),c=new Array(o/3),l=new Array(o),f=0;i>f;f++)s[f]={indexOffset:0,count:0,currentCount:0};var d=0;for(f=0;o>f;f+=3){var h=t[f],m=t[f+1],y=t[f+2],v=3*h,g=3*m,w=3*y;lt.x=n[v],lt.y=n[v+1],lt.z=n[v+2],ft.x=n[g],ft.y=n[g+1],ft.z=n[g+2],dt.x=n[w],dt.y=n[w+1],dt.z=n[w+2],s[h].count++,s[m].count++,s[y].count++,a.subtract(ft,lt,ft),a.subtract(dt,lt,dt),c[d]=a.cross(ft,dt,new a),d++}var x=0;for(f=0;i>f;f++)s[f].indexOffset+=x,x+=s[f].count;d=0;var E;for(f=0;o>f;f+=3){E=s[t[f]];var S=E.indexOffset+E.currentCount;l[S]=d,E.currentCount++,E=s[t[f+1]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,E=s[t[f+2]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,d++}var O=new Float32Array(3*i);for(f=0;i>f;f++){var M=3*f;if(E=s[f],E.count>0){for(a.clone(a.ZERO,ct),d=0;d<E.count;d++)a.add(ct,c[l[E.indexOffset+d]],ct);a.normalize(ct,ct),O[M]=ct.x,O[M+1]=ct.y,O[M+2]=ct.z}else O[M]=0,O[M+1]=0,O[M+2]=1}return e.attributes.normal=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:O}),e};var ht=new a,pt=new a,mt=new a;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,r=e.attributes.position.values,n=e.attributes.normal.values,i=e.attributes.st.values,o=e.attributes.position.values.length/3,s=t.length,c=new Array(3*o),l=0;l<c.length;l++)c[l]=0;var f,d,h;for(l=0;s>l;l+=3){var m=t[l],y=t[l+1],v=t[l+2];f=3*m,d=3*y,h=3*v;var g=2*m,w=2*y,x=2*v,E=r[f],S=r[f+1],O=r[f+2],M=i[g],T=i[g+1],_=i[w+1]-T,P=i[x+1]-T,b=1/((i[w]-M)*P-(i[x]-M)*_),N=(P*(r[d]-E)-_*(r[h]-E))*b,A=(P*(r[d+1]-S)-_*(r[h+1]-S))*b,I=(P*(r[d+2]-O)-_*(r[h+2]-O))*b;c[f]+=N,c[f+1]+=A,c[f+2]+=I,c[d]+=N,c[d+1]+=A,c[d+2]+=I,c[h]+=N,c[h+1]+=A,c[h+2]+=I}var C=new Float32Array(3*o),z=new Float32Array(3*o);for(l=0;o>l;l++){f=3*l,d=f+1,h=f+2;var R=a.fromArray(n,f,ht),D=a.fromArray(c,f,mt),L=a.dot(R,D);a.multiplyByScalar(R,L,pt),a.normalize(a.subtract(D,pt,D),D),z[f]=D.x,z[d]=D.y,z[h]=D.z,a.normalize(a.cross(R,D,D),D),C[f]=D.x,C[d]=D.y,C[h]=D.z}return e.attributes.tangent=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:z}),e.attributes.binormal=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:C}),e};var yt=new n,vt=new a,gt=new a,wt=new a;tt.compressVertices=function(t){var r=t.attributes.normal,i=t.attributes.st;if(!c(r)&&!c(i))return t;var o,s,l,f,d=t.attributes.tangent,h=t.attributes.binormal;c(r)&&(o=r.values),c(i)&&(s=i.values),c(d)&&(l=d.values),h&&(f=h.values);var m=c(o)?o.length:s.length,y=c(o)?3:2,v=m/y,g=v,w=c(s)&&c(o)?2:1;w+=c(l)||c(f)?1:0,g*=w;for(var x=new Float32Array(g),E=0,S=0;v>S;++S){c(s)&&(n.fromArray(s,2*S,yt),x[E++]=e.compressTextureCoordinates(yt));var O=3*S;c(o)&&c(l)&&c(f)?(a.fromArray(o,O,vt),a.fromArray(l,O,gt),a.fromArray(f,O,wt),e.octPack(vt,gt,wt,yt),x[E++]=yt.x,x[E++]=yt.y):(c(o)&&(a.fromArray(o,O,vt),x[E++]=e.octEncodeFloat(vt)),c(l)&&(a.fromArray(l,O,vt),x[E++]=e.octEncodeFloat(vt)),c(f)&&(a.fromArray(f,O,vt),x[E++]=e.octEncodeFloat(vt)))}return t.attributes.compressedAttributes=new p({componentDatatype:u.FLOAT,componentsPerAttribute:w,values:x}),c(o)&&delete t.attributes.normal,c(s)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var xt=new a,Et=new a,St=new a,Ot=new a,Mt=new a,Tt={positions:new Array(7),indices:new Array(9)},_t=new a,Pt=new a,bt=new a,Nt=new a,At=new n,It=new n,Ct=new n,zt=O.fromPointNormal(a.ZERO,a.UNIT_Y),Rt=new a,Dt=new a,Lt=new n,qt=new n,Ut=new a,Bt=new a,Wt=new a,Ft=new a,Gt=new a,kt=new a,Ht=new a,Vt=new i;return new i,tt.splitLongitude=function(e){var t=e.geometry,n=t.boundingSphere;if(c(n)){var a=n.center.x-n.radius;if(a>0||r.intersectPlane(n,O.ORIGIN_ZX_PLANE)!==g.INTERSECTING)return e}if(t.geometryType!==y.NONE)switch(t.geometryType){case y.POLYLINES:et(e);break;case y.TRIANGLES:Q(e);break;case y.LINES:$(e)}else G(t),t.primitiveType===M.TRIANGLES?Q(e):t.primitiveType===M.LINES&&$(e);return e},tt}),define("Core/PolygonGeometryLibrary",["./Cartesian3","./defaultValue","./defined","./Ellipsoid"],function(e,t,r,n){"use strict";function a(t,r,n,a){return e.subtract(r,t,o),e.multiplyByScalar(o,n/a,o),e.add(t,o,o),[o.x,o.y,o.z]}var i={};i.computeHierarchyPackedLength=function(t){for(var n=0,a=[t];a.length>0;){var i=a.pop();if(r(i)){n+=2;var o=i.positions,u=i.holes;if(r(o)&&(n+=o.length*e.packedLength),r(u))for(var s=u.length,c=0;s>c;++c)a.push(u[c])}}return n},i.packPolygonHierarchy=function(t,n,a){for(var i=[t];i.length>0;){var o=i.pop();if(r(o)){var u=o.positions,s=o.holes;if(n[a++]=r(u)?u.length:0,n[a++]=r(s)?s.length:0,r(u))for(var c=u.length,l=0;c>l;++l,a+=3)e.pack(u[l],n,a);if(r(s))for(var f=s.length,d=0;f>d;++d)i.push(s[d])}}return a},i.unpackPolygonHierarchy=function(t,r){for(var n=t[r++],a=t[r++],o=new Array(n),u=a>0?new Array(a):void 0,s=0;n>s;++s,r+=e.packedLength)o[s]=e.unpack(t,r);for(var c=0;a>c;++c)u[c]=i.unpackPolygonHierarchy(t,r),r=u[c].startingIndex,delete u[c].startingIndex;return{positions:o,holes:u,startingIndex:r}};var o=new e;i.subdivideLineCount=function(t,r,n){var a=e.distance(t,r),i=a/n,o=Math.max(0,Math.ceil(Math.log(i)/Math.log(2)));return Math.pow(2,o)},i.subdivideLine=function(t,n,o,u){var s=i.subdivideLineCount(t,n,o),c=e.distance(t,n),l=c/s;r(u)||(u=[]);var f=u;f.length=3*s;for(var d=0,h=0;s>h;h++){var p=a(t,n,h*l,c);f[d++]=p[0],f[d++]=p[1],f[d++]=p[2]}return f};var u=new e,s=new e,c=new e,l=new e;return i.scaleToGeodeticHeightExtruded=function(a,i,o,f,d){f=t(f,n.WGS84);var h=u,p=s,m=c,y=l;if(r(a)&&r(a.attributes)&&r(a.attributes.position))for(var v=a.attributes.position.values,g=v.length/2,w=0;g>w;w+=3)e.fromArray(v,w,m),f.geodeticSurfaceNormal(m,h),y=f.scaleToGeodeticSurface(m,y),p=e.multiplyByScalar(h,o,p),p=e.add(y,p,p),v[w+g]=p.x,v[w+1+g]=p.y,v[w+2+g]=p.z,d&&(y=e.clone(m,y)),p=e.multiplyByScalar(h,i,p),p=e.add(y,p,p),v[w]=p.x,v[w+1]=p.y,v[w+2]=p.z;return a},i}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var r=new t,n=function(t,n,a,i){return e(t,n,a,i,r),r.x>0&&r.y>0&&r.z>0};return n}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,r,n,a,i,o,u){"use strict";function s(e){var t=e._uSquared,r=e._ellipsoid.maximumRadius,n=e._ellipsoid.minimumRadius,a=(r-n)/r,i=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-a)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,i),f=s*o,d=f*f,h=1-d,p=Math.sqrt(h),m=t/4,y=m*m,v=y*m,g=y*y,w=1+m-3*y/4+5*v/4-175*g/64,x=1-m+15*y/8-35*v/8,E=1-3*m+35*y/4,S=1-5*m,O=w*l-x*Math.sin(2*l)*m/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,M=e._constants;M.a=r,M.b=n,M.f=a,M.cosineHeading=i,M.sineHeading=o,M.tanU=u,M.cosineU=s,M.sineU=c,M.sigma=l,M.sineAlpha=f,M.sineSquaredAlpha=d,M.cosineSquaredAlpha=h,M.cosineAlpha=p,M.u2Over4=m,M.u4Over16=y,M.u6Over64=v,M.u8Over256=g,M.a0=w,M.a1=x,M.a2=E,M.a3=S,M.distanceRatio=O}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,r,n,a,i,o){var u=c(e,r);return(1-u)*e*t*(n+u*a*(o+u*i*(2*o*o-1)))}function f(e,t,r,n,a,i,o){var s,c,f,d,h,p=(t-r)/t,m=i-n,y=Math.atan((1-p)*Math.tan(a)),v=Math.atan((1-p)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,O=g*E,M=w*E,T=w*x,_=m,P=u.TWO_PI,b=Math.cos(_),N=Math.sin(_);do{b=Math.cos(_),N=Math.sin(_);var A=O-T*b;f=Math.sqrt(x*x*N*N+A*A),c=M+S*b,s=Math.atan2(f,c);var I;0===f?(I=0,d=1):(I=S*N/f,d=1-I*I),P=_,h=c-2*M/d,isNaN(h)&&(h=0),_=m+l(p,I,d,s,f,c,h)}while(Math.abs(_-P)>u.EPSILON12);var C=d*(t*t-r*r)/(r*r),z=1+C*(4096+C*(C*(320-175*C)-768))/16384,R=C*(256+C*(C*(74-47*C)-128))/1024,D=h*h,L=R*f*(h+R*(c*(2*D-1)-R*h*(4*f*f-3)*(4*D-3)/6)/4),q=r*z*(s-L),U=Math.atan2(x*N,O-T*b),B=Math.atan2(g*N,O*b-T);e._distance=q,e._startHeading=U,e._endHeading=B,e._uSquared=C}function d(r,n,a,i){e.normalize(i.cartographicToCartesian(n,p),h),e.normalize(i.cartographicToCartesian(a,p),p),f(r,i.maximumRadius,i.minimumRadius,n.longitude,n.latitude,a.longitude,a.latitude),r._start=t.clone(n,r._start),r._end=t.clone(a,r._end),r._start.height=0,r._end.height=0,s(r)}var h=new e,p=new e,m=function(e,a,i){var u=r(i,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,n(e)&&n(a)&&d(this,e,a,u)};return a(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),m.prototype.setEndPoints=function(e,t){d(this,e,t,this._ellipsoid)},m.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},m.prototype.interpolateUsingSurfaceDistance=function(e,r){var a=this._constants,i=a.distanceRatio+e/a.b,o=Math.cos(2*i),u=Math.cos(4*i),s=Math.cos(6*i),c=Math.sin(2*i),f=Math.sin(4*i),d=Math.sin(6*i),h=Math.sin(8*i),p=i*i,m=i*p,y=a.u8Over256,v=a.u2Over4,g=a.u6Over64,w=a.u4Over16,x=2*m*y*o/3+i*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*f-p*((g-11*y/2)*c+5*y*f/2)+(29*g/96-29*y/16)*d+539*y*h/1536,E=Math.asin(Math.sin(x)*a.cosineAlpha),S=Math.atan(a.a/a.b*Math.tan(E));x-=a.sigma;var O=Math.cos(2*a.sigma+x),M=Math.sin(x),T=Math.cos(x),_=a.cosineU*T,P=a.sineU*M,b=Math.atan2(M*a.sineHeading,_-P*a.cosineHeading),N=b-l(a.f,a.sineAlpha,a.cosineSquaredAlpha,x,M,T,O);return n(r)?(r.longitude=this._start.longitude+N,r.latitude=S,r.height=0,r):new t(this._start.longitude+N,S,0)},m}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,r,n,a,i,o,u,s,c,l,f){"use strict";function d(e,t,r){var n=M;n.length=e;var a;if(t===r){for(a=0;e>a;a++)n[a]=t;return n}var i=r-t,o=i/e;for(a=0;e>a;a++){var u=t+a*o;n[a]=u}return n}function h(t,r,n,a,i,o,u,s){var c=a.scaleToGeodeticSurface(t,b),l=a.scaleToGeodeticSurface(r,N),f=p.numberOfPoints(t,r,n),h=a.cartesianToCartographic(c,T),m=a.cartesianToCartographic(l,_),y=d(f,i,o);A.setEndPoints(h,m);var v=A.surfaceDistance/f,g=s;h.height=i;var w=a.cartographicToCartesian(h,P);e.pack(w,u,g),g+=3;for(var x=1;f>x;x++){var E=A.interpolateUsingSurfaceDistance(x*v,_);E.height=y[x],w=a.cartographicToCartesian(E,P),e.pack(w,u,g),g+=3}return g}var p={};p.numberOfPoints=function(t,r,n){var a=e.distance(t,r);return Math.ceil(a/n)};var m=new t;p.extractHeights=function(e,t){for(var r=e.length,n=new Array(r),a=0;r>a;a++){var i=e[a];n[a]=t.cartesianToCartographic(i,m).height}return n};var y=new l,v=new e,g=new e,w=new f(e.ZERO,0),x=new e,E=new f(e.ZERO,0),S=new e,O=new e,M=[],T=new t,_=new t,P=new e,b=new e,N=new e,A=new o;p.wrapLongitude=function(t,a){var i=[],o=[];if(n(t)&&t.length>0){a=r(a,l.IDENTITY);var s=l.inverseTransformation(a,y),c=l.multiplyByPoint(s,e.ZERO,v),d=l.multiplyByPointAsVector(s,e.UNIT_Y,g),h=f.fromPointNormal(c,d,w),p=l.multiplyByPointAsVector(s,e.UNIT_X,x),m=f.fromPointNormal(c,p,E),M=1;i.push(e.clone(t[0]));for(var T=i[0],_=t.length,P=1;_>P;++P){var b=t[P];if(f.getPointDistance(m,T)<0||f.getPointDistance(m,b)<0){var N=u.lineSegmentPlane(T,b,h,S);if(n(N)){var A=e.multiplyByScalar(d,5e-9,O);f.getPointDistance(h,T)<0&&e.negate(A,A),i.push(e.add(N,A,new e)),o.push(M+1),e.negate(A,A),i.push(e.add(N,A,new e)),M=1}}i.push(e.clone(t[P])),M++,T=b}o.push(M)}return{positions:i,lengths:o}};var I=c.EPSILON7;return p.removeDuplicates=function(t){var r=t.length;if(2>r)return t;var n,a,i;for(n=1;r>n&&(a=t[n-1],i=t[n],!e.equalsEpsilon(a,i,I));++n);if(n===r)return t;for(var o=t.slice(0,n);r>n;++n)i=t[n],e.equalsEpsilon(a,i,I)||(o.push(e.clone(i)),a=i);return o},p.generateArc=function(t){n(t)||(t={});var a=t.positions,o=a.length,u=r(t.ellipsoid,i.WGS84),l=r(t.height,0);if(1>o)return[];if(1===o){var f=u.scaleToGeodeticSurface(a[0],b);if(0!==l){var d=u.geodeticSurfaceNormal(f,P);e.multiplyByScalar(d,l,d),e.add(f,d,f)}return[f.x,f.y,f.z]}var m=t.minDistance;if(!n(m)){var y=r(t.granularity,c.RADIANS_PER_DEGREE);m=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=p.numberOfPoints(a[v],a[v+1],m);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var O=a[v],_=a[v+1],N=S?l[v]:l,A=S?l[v+1]:l;E=h(O,_,m,u,N,A,x,E)}M.length=0;var I=a[o-1],C=u.cartesianToCartographic(I,T);C.height=S?l[o-1]:l;var z=u.cartographicToCartesian(C,P);return e.pack(z,x,w-3),x},p.generateCartesianArc=function(t){for(var r=p.generateArc(t),n=r.length/3,a=new Array(n),i=0;n>i;i++)a[i]=e.unpack(r,3*i);return a},p}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,r=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,r},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,p,m){"use strict";function y(t,r,n){var a=e.subtract(r,t,L),i=e.subtract(n,r,q);return a.x*i.y-a.y*i.x>=0}function v(e){for(var t=e[0].x,r=0,n=0;n<e.length;n++)e[n].x>t&&(t=e[n].x,r=n);return r}function g(e){for(var t=e[0][0].x,r=0,n=0;n<e.length;n++){var a=e[n][v(e[n])].x;a>t&&(t=a,r=n)}return r}function w(e){for(var t=[],r=0;r<e.length;r++){var n=e[(r-1+e.length)%e.length],a=e[r],i=e[(r+1)%e.length];y(n,a,i)||t.push(a)}return t}function x(t,r){for(var n=0;n<t.length;n++)if(e.equals(r,t[n]))return n;return-1}function E(r,a,i){i=n(i,[]);var o=Number.MAX_VALUE,u=v(a),s=new e(a[u].x,r.y);i.push(u),i.push((u+1)%a.length);for(var c=a[0].x,l=c,f=1;f<a.length;++f)a[f].x<c?c=a[f].x:a[f].x>l&&(l=a[f].x);l+=l-c;var d=new t(l,r.y,0);for(f=0;f<a.length;f++){var h=a[f],p=a[(f+1)%a.length];if((h.x>=r.x||p.x>=r.x)&&(h.y>=r.y&&p.y<=r.y||h.y<=r.y&&p.y>=r.y)){var m=(p.y-h.y)*(d.x-r.x)-(p.x-h.x)*(d.y-r.y);if(0!==m){m=1/m;var y=((p.x-h.x)*(r.y-h.y)-(p.y-h.y)*(r.x-h.x))*m,g=((d.x-r.x)*(r.y-h.y)-(d.y-r.y)*(r.x-h.x))*m;if(y>=0&&1>=y&&g>=0&&1>=g){var w=new e(r.x+y*(d.x-r.x),r.y+y*(d.y-r.y)),x=e.subtract(w,r,U);m=e.magnitudeSquared(x),o>m&&(s=w,o=m,i[0]=f,i[1]=(f+1)%a.length)}}}}return s}function S(t,r){var n=g(r),a=r[n],i=v(a),o=a[i],u=[],s=E(o,t,u),c=x(t,s);if(-1!==c)return c;var d=e.magnitudeSquared(e.subtract(t[u[0]],o,B)),h=e.magnitudeSquared(e.subtract(t[u[1]],o,B)),p=h>d?t[u[0]]:t[u[1]],m=w(t),y=m.indexOf(p);-1!==y&&m.splice(y,1);for(var S=[],O=0;O<m.length;O++){var M=m[O];f(M,o,s,p)&&S.push(M)}var T=Number.MAX_VALUE;if(S.length>0){var _=e.fromElements(1,0,B);for(O=0;O<S.length;O++){var P=e.subtract(S[O],o,W),b=e.magnitude(_)*e.magnitudeSquared(P);if(0!==b){var N=Math.abs(l.acosClamped(e.dot(_,P)/b));T>N&&(T=N,p=S[O])}}}return t.indexOf(p)}function O(e,r,n){for(var a=et.computeWindingOrder2D(e),i=0;i<r.length;i++){var o=r[i];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=et.computeWindingOrder2D(o);s===a&&o.reverse()}var c=u.fromPoints(e,n),l=c.projectPointsOntoPlane(e),f=[]; -for(i=0;i<r.length;i++)f.push(c.projectPointsOntoPlane(r[i]));var d=S(l,f),h=g(f),p=v(f[h]),m=r[h],y=[];for(i=0;i<e.length;i++)y.push(e[i]);var w,x=[];if(0!==p)for(w=0;w<=m.length;w++){var E=(w+p)%m.length;0!==E&&x.push(m[E])}else for(w=0;w<m.length;w++)x.push(m[(w+p)%m.length]);var O=y.lastIndexOf(e[d]);x.push(e[O]);var M=y.slice(0,O+1),T=y.slice(O+1);return y=M.concat(x,T),r.splice(h,1),y}function M(e){var t=l.nextRandomNumber(),r=Math.floor(t*e);return r===e&&r--,r}function T(e,t,r,n){var a=n[e].position,i=n[t].position,o=n[r].position,u=o.x,s=o.y,c=a.x-u,l=a.y-s,f=i.x-u,d=i.y-s;return c*d-l*f}function _(e,t){return e.x*t.y-e.y*t.x}function P(e,t){var r=t.length,n=l.mod(e-1,r),a=l.mod(e+1,r);return 0===T(n,a,e,t)?!1:!0}function b(t,r){return e.magnitudeSquared(r)<e.magnitudeSquared(t)}function N(t,r,n){if(!P(t,n))return t;var a=n[t].position,i=n[r].position,o=n.length,u=l.mod(t-1,o);if(!P(u,n))return u;var s=l.mod(t+1,o);if(!P(s,n))return s;var c=e.subtract(n[u].position,a,k),f=e.subtract(n[s].position,a,H),d=e.subtract(i,a,V),h=_(c,d),p=_(f,d);if(0===h)return b(c,d)?F:G;if(0===p)return b(f,d)?F:G;var m=_(c,f);return 0>m?0>h&&p>0?F:G:m>0?h>0&&0>p?G:F:void 0}function A(e,t,r){return(e>t||e>r)&&(t>e||r>e)||t===r&&t===e}function I(t,r,n,a){var i=e.subtract(n,t,j),o=r.x*a.y-r.y*a.x,u=o*o,s=e.magnitudeSquared(r),c=e.magnitudeSquared(a);if(u>Y*s*c){var l=(i.x*a.y-i.y*a.x)/o;return e.add(t,e.multiplyByScalar(r,l,j),j)}return void 0}function C(t,r,n){for(var i=e.subtract(r,t,Z),o=n.length,u=0;o>u;u++){var s=n[u].position,c=n[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(r,c)||e.equals(t,c)||e.equals(r,s))){var f=e.subtract(c,s,X),d=I(t,i,s,f);if(a(d)&&!(e.equals(d,t)||e.equals(d,r)||e.equals(d,s)||e.equals(d,c))){var h=d.x,p=d.y,m=A(h,t.x,r.x)&&A(p,t.y,r.y)&&A(h,s.x,c.x)&&A(p,s.y,c.y);if(m)return!0}}}return!1}function z(t,r,n){var a=N(t,r,n);if(a>=0)return a;var i=N(r,t,n);return i>=0?i:a!==F||i!==F||C(n[t].position,n[r].position,n)||e.equals(n[t].position,n[r].position)?K:J}function R(e){return 0===T(1,2,0,e)}function D(e){var t=e.length;if(3===t)return R(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new i("Invalid polygon: must have at least three vertices.");for(var r,n,a=0,o=10*e.length,u=K;J>u&&a++<o;){for(r=M(e.length),n=r+1;Math.abs(r-n)<2||Math.abs(r-n)>e.length-2;)n=M(e.length);if(r>n){var s=r;r=n,n=s}u=z(r,n,e)}if(u===J){var c=e.splice(r,n-r+1,e[r],e[n]);return D(e).concat(D(c))}return u>=0?(e.splice(u,1),D(e)):[]}var L=new e,q=new e,U=new e,B=new e(1,0),W=new e,F=-1,G=-2,k=new t,H=new t,V=new t,Y=l.EPSILON14,j=new e;new e;var Z=new e,X=new e,J=-1,K=-2,Q=new t,$=new t,et={};et.removeDuplicates=function(e){var r=d.removeDuplicates(e);return t.equals(r[0],r[r.length-1])?r.slice(1):r},et.computeArea2D=function(e){for(var t=e.length,r=0,n=t-1,a=0;t>a;n=a++){var i=e[n],o=e[a];r+=i.x*o.y-o.x*i.y}return.5*r},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?m.COUNTER_CLOCKWISE:m.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,r=[],n=0;t>n;++n)r[n]={position:e[n],index:n};return D(r)};var tt=new t,rt=new t,nt=new t,at=new t,it=new t,ot=new t,ut=new t;return et.computeSubdivision=function(e,i,o,u){u=n(u,l.RADIANS_PER_DEGREE);var f,d=o.slice(0),p=i.length,m=new Array(3*p),y=0;for(f=0;p>f;f++){var v=i[f];m[y++]=v.x,m[y++]=v.y,m[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;d.length>0;){var O,M,T=d.pop(),_=d.pop(),P=d.pop(),b=t.fromArray(m,3*P,tt),N=t.fromArray(m,3*_,rt),A=t.fromArray(m,3*T,nt),I=t.multiplyByScalar(t.normalize(b,at),x,at),C=t.multiplyByScalar(t.normalize(N,it),x,it),z=t.multiplyByScalar(t.normalize(A,ot),x,ot),R=t.magnitudeSquared(t.subtract(I,C,ut)),D=t.magnitudeSquared(t.subtract(C,z,ut)),L=t.magnitudeSquared(t.subtract(z,I,ut)),q=Math.max(R,D,L);q>S?R===q?(O=Math.min(P,_)+" "+Math.max(P,_),f=w[O],a(f)||(M=t.add(b,N,ut),t.multiplyByScalar(M,.5,M),m.push(M.x,M.y,M.z),f=m.length/3-1,w[O]=f),d.push(P,f,T),d.push(f,_,T)):D===q?(O=Math.min(_,T)+" "+Math.max(_,T),f=w[O],a(f)||(M=t.add(N,A,ut),t.multiplyByScalar(M,.5,M),m.push(M.x,M.y,M.z),f=m.length/3-1,w[O]=f),d.push(_,f,P),d.push(f,T,P)):L===q&&(O=Math.min(T,P)+" "+Math.max(T,P),f=w[O],a(f)||(M=t.add(A,b,ut),t.multiplyByScalar(M,.5,M),m.push(M.x,M.y,M.z),f=m.length/3-1,w[O]=f),d.push(T,f,_),d.push(f,P,_)):(g.push(P),g.push(_),g.push(T))}return new s({attributes:{position:new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:m})},indices:g,primitiveType:h.TRIANGLES})},et.scaleToGeodeticHeight=function(e,r,i,u){i=n(i,o.WGS84);var s=Q,c=$;if(r=n(r,0),u=n(u,!0),a(e)&&a(e.attributes)&&a(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,d=0;f>d;d+=3)t.fromArray(l,d,c),u&&(c=i.scaleToGeodeticSurface(c,c)),s=i.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,r,s),t.add(c,s,c),l[d]=c.x,l[d+1]=c.y,l[d+2]=c.z;return e},et.eliminateHoles=function(e,r,a){a=n(a,o.WGS84);for(var i=[],u=0;u<r.length;u++){for(var s=[],c=0;c<r[u].length;c++)s.push(t.clone(r[u][c]));i.push(s)}for(var l=e;i.length>0;)l=O(l,i,a);return l},et}),define("Core/PolygonOutlineGeometry",["./BoundingSphere","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./PolygonGeometryLibrary","./PolygonPipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,p,m,y,v,g){"use strict";function w(e,r,n,a){var i=o.fromPoints(r,e),f=i.projectPointsOntoPlane(r,E),h=m.computeWindingOrder2D(f);h===g.CLOCKWISE&&(f.reverse(),r.reverse());var v,w,x=r.length,O=0;if(a)for(v=new Float64Array(3*2*x),w=0;x>w;w++){var M=r[w],T=r[(w+1)%x];v[O++]=M.x,v[O++]=M.y,v[O++]=M.z,v[O++]=T.x,v[O++]=T.y,v[O++]=T.z}else{var _=0;for(w=0;x>w;w++)_+=p.subdivideLineCount(r[w],r[(w+1)%x],n);for(v=new Float64Array(3*_),w=0;x>w;w++)for(var P=p.subdivideLine(r[w],r[(w+1)%x],n,S),b=P.length,N=0;b>N;++N)v[O++]=P[N]}x=v.length/3;var A=2*x,I=d.createTypedArray(x,A);for(O=0,w=0;x-1>w;w++)I[O++]=w,I[O++]=w+1;return I[O++]=x-1,I[O++]=0,new l({geometry:new u({attributes:new c({position:new s({componentDatatype:t.DOUBLE,componentsPerAttribute:3,values:v})}),indices:I,primitiveType:y.LINES})})}function x(e,r,n,a){var i=o.fromPoints(r,e),f=i.projectPointsOntoPlane(r,E),h=m.computeWindingOrder2D(f);h===g.CLOCKWISE&&(f.reverse(),r.reverse());var v,w,x=r.length,O=new Array(x),M=0;if(a)for(v=new Float64Array(2*3*2*x),w=0;x>w;++w){O[w]=M/3;var T=r[w],_=r[(w+1)%x];v[M++]=T.x,v[M++]=T.y,v[M++]=T.z,v[M++]=_.x,v[M++]=_.y,v[M++]=_.z}else{var P=0;for(w=0;x>w;w++)P+=p.subdivideLineCount(r[w],r[(w+1)%x],n);for(v=new Float64Array(2*3*P),w=0;x>w;++w){O[w]=M/3;for(var b=p.subdivideLine(r[w],r[(w+1)%x],n,S),N=b.length,A=0;N>A;++A)v[M++]=b[A]}}x=v.length/6;var I=O.length,C=2*(2*x+I),z=d.createTypedArray(x,C);for(M=0,w=0;x>w;++w)z[M++]=w,z[M++]=(w+1)%x,z[M++]=w+x,z[M++]=(w+1)%x+x;for(w=0;I>w;w++){var R=O[w];z[M++]=R,z[M++]=R+x}return new l({geometry:new u({attributes:new c({position:new s({componentDatatype:t.DOUBLE,componentsPerAttribute:3,values:v})}),indices:z,primitiveType:y.LINES})})}var E=[],S=[],O=function(e){var t=e.polygonHierarchy,a=r(e.ellipsoid,i.WGS84),o=r(e.granularity,h.RADIANS_PER_DEGREE),u=r(e.height,0),s=r(e.perPositionHeight,!1),c=e.extrudedHeight,l=n(c)&&(!h.equalsEpsilon(u,c,h.EPSILON6)||s);if(l){var f=c;c=Math.min(f,u),u=Math.max(f,u)}this._ellipsoid=i.clone(a),this._granularity=o,this._height=u,this._extrudedHeight=r(c,0),this._extrude=l,this._polygonHierarchy=t,this._perPositionHeight=s,this._workerName="createPolygonOutlineGeometry",this.packedLength=p.computeHierarchyPackedLength(t)+i.packedLength+6};O.pack=function(e,t,n){n=r(n,0),n=p.packPolygonHierarchy(e._polygonHierarchy,t,n),i.pack(e._ellipsoid,t,n),n+=i.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._extrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e.packedLength};var M=i.clone(i.UNIT_SPHERE),T={polygonHierarchy:{}};return O.unpack=function(e,t,a){t=r(t,0);var o=p.unpackPolygonHierarchy(e,t);t=o.startingIndex,delete o.startingIndex;var u=i.unpack(e,t,M);t+=i.packedLength;var s=e[t++],c=e[t++],l=e[t++],f=1===e[t++],d=1===e[t++],h=e[t++];return n(a)||(a=new O(T)),a._polygonHierarchy=o,a._ellipsoid=i.clone(u,a._ellipsoid),a._height=s,a._extrudedHeight=c,a._granularity=l,a._extrude=f,a._perPositionHeight=d,a.packedLength=h,a},O.fromPositions=function(e){e=r(e,r.EMPTY_OBJECT);var t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight};return new O(t)},O.createGeometry=function(t){var r=t._ellipsoid,a=t._granularity,i=t._height,o=t._extrudedHeight,s=t._extrude,c=t._polygonHierarchy,l=t._perPositionHeight,d=[],y=new v;y.enqueue(c);for(var g;0!==y.length;){var E=y.dequeue(),S=E.positions;if(S=m.removeDuplicates(S),!(S.length<3)){var O=E.holes?E.holes.length:0;for(g=0;O>g;g++){var M=E.holes[g];if(M.positions=m.removeDuplicates(M.positions),!(M.positions.length<3)){d.push(M.positions);var T=0;n(M.holes)&&(T=M.holes.length);for(var _=0;T>_;_++)y.enqueue(M.holes[_])}}d.push(S)}}if(0===d.length)return void 0;var P,b=[],N=h.chordLength(a,r.maximumRadius);if(s)for(g=0;g<d.length;g++)P=x(r,d[g],N,l),P.geometry=p.scaleToGeodeticHeightExtruded(P.geometry,i,o,r,l),b.push(P);else for(g=0;g<d.length;g++)P=w(r,d[g],N,l),P.geometry=m.scaleToGeodeticHeight(P.geometry,i,r,!l),b.push(P);P=f.combineInstances(b)[0];var A=e.fromVertices(P.attributes.position.values);return new u({attributes:P.attributes,indices:P.indices,primitiveType:P.primitiveType,boundingSphere:A})},O}),define("Workers/createPolygonOutlineGeometry",["../Core/defined","../Core/Ellipsoid","../Core/PolygonOutlineGeometry"],function(e,t,r){"use strict";function n(n,a){return e(a)&&(n=r.unpack(n,a)),n._ellipsoid=t.clone(n._ellipsoid),r.createGeometry(n)}return n})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createPolylineGeometry.js b/libs/Cesium/Workers/createPolylineGeometry.js deleted file mode 100644 index a07e923d..00000000 --- a/libs/Cesium/Workers/createPolylineGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var r=Object.freeze;return t(r)||(r=function(t){return t}),r}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var r=function(t,r){return void 0!==t?t:r};return r.EMPTY_OBJECT=t({}),r}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var r=function(t){this.name="DeveloperError",this.message=t;var r;try{throw new Error}catch(e){r=e.stack}this.stack=r};return r.prototype.toString=function(){var r=this.name+": "+this.message;return t(this.stack)&&(r+="\n"+this.stack.toString()),r},r.throwInstantiationError=function(){throw new r("This function defines an interface and should not be called directly.")},r}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,r=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var e;for(this.mti==this.N+1&&this.init_genrand(5489),e=0;e<this.N-this.M;e++)t=this.mt[e]&this.UPPER_MASK|this.mt[e+1]&this.LOWER_MASK,this.mt[e]=this.mt[e+this.M]^t>>>1^r[1&t];for(;e<this.N-1;e++)t=this.mt[e]&this.UPPER_MASK|this.mt[e+1]&this.LOWER_MASK,this.mt[e]=this.mt[e+(this.M-this.N)]^t>>>1^r[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^r[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,r){"use strict";var e={};e.EPSILON1=.1,e.EPSILON2=.01,e.EPSILON3=.001,e.EPSILON4=1e-4,e.EPSILON5=1e-5,e.EPSILON6=1e-6,e.EPSILON7=1e-7,e.EPSILON8=1e-8,e.EPSILON9=1e-9,e.EPSILON10=1e-10,e.EPSILON11=1e-11,e.EPSILON12=1e-12,e.EPSILON13=1e-13,e.EPSILON14=1e-14,e.EPSILON15=1e-15,e.EPSILON16=1e-16,e.EPSILON17=1e-17,e.EPSILON18=1e-18,e.EPSILON19=1e-19,e.EPSILON20=1e-20,e.GRAVITATIONALPARAMETER=3986004418e5,e.SOLAR_RADIUS=6955e5,e.LUNAR_RADIUS=1737400,e.SIXTY_FOUR_KILOBYTES=65536,e.sign=function(t){return t>0?1:0>t?-1:0},e.signNotZero=function(t){return 0>t?-1:1},e.toSNorm=function(t){return Math.round(255*(.5*e.clamp(t,-1,1)+.5))},e.fromSNorm=function(t){return 2*(e.clamp(t,0,255)/255)-1},e.sinh=function(t){var r=Math.pow(Math.E,t),e=Math.pow(Math.E,-1*t);return.5*(r-e)},e.cosh=function(t){var r=Math.pow(Math.E,t),e=Math.pow(Math.E,-1*t);return.5*(r+e)},e.lerp=function(t,r,e){return(1-e)*t+e*r},e.PI=Math.PI,e.ONE_OVER_PI=1/Math.PI,e.PI_OVER_TWO=.5*Math.PI,e.PI_OVER_THREE=Math.PI/3,e.PI_OVER_FOUR=Math.PI/4,e.PI_OVER_SIX=Math.PI/6,e.THREE_PI_OVER_TWO=.5*3*Math.PI,e.TWO_PI=2*Math.PI,e.ONE_OVER_TWO_PI=1/(2*Math.PI),e.RADIANS_PER_DEGREE=Math.PI/180,e.DEGREES_PER_RADIAN=180/Math.PI,e.RADIANS_PER_ARCSECOND=e.RADIANS_PER_DEGREE/3600,e.toRadians=function(t){return t*e.RADIANS_PER_DEGREE},e.toDegrees=function(t){return t*e.DEGREES_PER_RADIAN},e.convertLongitudeRange=function(t){var r=e.TWO_PI,n=t-Math.floor(t/r)*r;return n<-Math.PI?n+r:n>=Math.PI?n-r:n},e.negativePiToPi=function(t){return e.zeroToTwoPi(t+e.PI)-e.PI},e.zeroToTwoPi=function(t){var r=e.mod(t,e.TWO_PI);return Math.abs(r)<e.EPSILON14&&Math.abs(t)>e.EPSILON14?e.TWO_PI:r},e.mod=function(t,r){return(t%r+r)%r},e.equalsEpsilon=function(t,e,n,o){o=r(o,n);var i=Math.abs(t-e);return o>=i||i<=n*Math.max(Math.abs(t),Math.abs(e))};var n=[1];e.factorial=function(t){var r=n.length;if(t>=r)for(var e=n[r-1],o=r;t>=o;o++)n.push(e*o);return n[t]},e.incrementWrap=function(t,e,n){return n=r(n,0),++t,t>e&&(t=n),t},e.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},e.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},e.clamp=function(t,r,e){return r>t?r:t>e?e:t};var o=new t;return e.setRandomNumberSeed=function(r){o=new t(r)},e.nextRandomNumber=function(){return o.random()},e.acosClamped=function(t){return Math.acos(e.clamp(t,-1,1))},e.asinClamped=function(t){return Math.asin(e.clamp(t,-1,1))},e.chordLength=function(t,r){return 2*r*Math.sin(.5*t)},e}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o){"use strict";var i=function(r,e,n){this.x=t(r,0),this.y=t(e,0),this.z=t(n,0)};i.fromSpherical=function(e,n){r(n)||(n=new i);var o=e.clock,a=e.cone,s=t(e.magnitude,1),u=s*Math.sin(a);return n.x=u*Math.cos(o),n.y=u*Math.sin(o),n.z=s*Math.cos(a),n},i.fromElements=function(t,e,n,o){return r(o)?(o.x=t,o.y=e,o.z=n,o):new i(t,e,n)},i.clone=function(t,e){return r(t)?r(e)?(e.x=t.x,e.y=t.y,e.z=t.z,e):new i(t.x,t.y,t.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(r,e,n){n=t(n,0),e[n++]=r.x,e[n++]=r.y,e[n]=r.z},i.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new i),o.x=e[n++],o.y=e[n++],o.z=e[n],o},i.fromArray=i.unpack,i.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},i.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},i.minimumByComponent=function(t,r,e){return e.x=Math.min(t.x,r.x),e.y=Math.min(t.y,r.y),e.z=Math.min(t.z,r.z),e},i.maximumByComponent=function(t,r,e){return e.x=Math.max(t.x,r.x),e.y=Math.max(t.y,r.y),e.z=Math.max(t.z,r.z),e},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},i.magnitude=function(t){return Math.sqrt(i.magnitudeSquared(t))};var a=new i;i.distance=function(t,r){return i.subtract(t,r,a),i.magnitude(a)},i.distanceSquared=function(t,r){return i.subtract(t,r,a),i.magnitudeSquared(a)},i.normalize=function(t,r){var e=i.magnitude(t);return r.x=t.x/e,r.y=t.y/e,r.z=t.z/e,r},i.dot=function(t,r){return t.x*r.x+t.y*r.y+t.z*r.z},i.multiplyComponents=function(t,r,e){return e.x=t.x*r.x,e.y=t.y*r.y,e.z=t.z*r.z,e},i.add=function(t,r,e){return e.x=t.x+r.x,e.y=t.y+r.y,e.z=t.z+r.z,e},i.subtract=function(t,r,e){return e.x=t.x-r.x,e.y=t.y-r.y,e.z=t.z-r.z,e},i.multiplyByScalar=function(t,r,e){return e.x=t.x*r,e.y=t.y*r,e.z=t.z*r,e},i.divideByScalar=function(t,r,e){return e.x=t.x/r,e.y=t.y/r,e.z=t.z/r,e},i.negate=function(t,r){return r.x=-t.x,r.y=-t.y,r.z=-t.z,r},i.abs=function(t,r){return r.x=Math.abs(t.x),r.y=Math.abs(t.y),r.z=Math.abs(t.z),r};var s=new i;i.lerp=function(t,r,e,n){return i.multiplyByScalar(r,e,s),n=i.multiplyByScalar(t,1-e,n),i.add(s,n,n)};var u=new i,l=new i;i.angleBetween=function(t,r){i.normalize(t,u),i.normalize(r,l);var e=i.dot(u,l),n=i.magnitude(i.cross(u,l,u));return Math.atan2(n,e)};var c=new i;i.mostOrthogonalAxis=function(t,r){var e=i.normalize(t,c);return i.abs(e,e),r=e.x<=e.y?e.x<=e.z?i.clone(i.UNIT_X,r):i.clone(i.UNIT_Z,r):e.y<=e.z?i.clone(i.UNIT_Y,r):i.clone(i.UNIT_Z,r)},i.equals=function(t,e){return t===e||r(t)&&r(e)&&t.x===e.x&&t.y===e.y&&t.z===e.z},i.equalsArray=function(t,r,e){return t.x===r[e]&&t.y===r[e+1]&&t.z===r[e+2]},i.equalsEpsilon=function(t,e,n,i){return t===e||r(t)&&r(e)&&o.equalsEpsilon(t.x,e.x,n,i)&&o.equalsEpsilon(t.y,e.y,n,i)&&o.equalsEpsilon(t.z,e.z,n,i)},i.cross=function(t,r,e){var n=t.x,o=t.y,i=t.z,a=r.x,s=r.y,u=r.z,l=o*u-i*s,c=i*a-n*u,f=n*s-o*a;return e.x=l,e.y=c,e.z=f,e},i.fromDegrees=function(t,r,e,n,a){var s=o.toRadians(t),u=o.toRadians(r);return i.fromRadians(s,u,e,n,a)};var f=new i,h=new i,d=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(e,n,o,a,s){o=t(o,0);var u=r(a)?a.radiiSquared:d,l=Math.cos(n);f.x=l*Math.cos(e),f.y=l*Math.sin(e),f.z=Math.sin(n),f=i.normalize(f,f),i.multiplyComponents(u,f,h);var c=Math.sqrt(i.dot(f,h));return h=i.divideByScalar(h,c,h),f=i.multiplyByScalar(f,o,f),r(s)||(s=new i),i.add(h,f,s)},i.fromDegreesArray=function(t,r,e){for(var n=new Array(t.length),a=0;a<t.length;a++)n[a]=o.toRadians(t[a]);return i.fromRadiansArray(n,r,e)},i.fromRadiansArray=function(t,e,n){var o=t.length;r(n)?n.length=o/2:n=new Array(o/2);for(var a=0;o>a;a+=2){var s=t[a],u=t[a+1];n[a/2]=i.fromRadians(s,u,0,e,n[a/2])}return n},i.fromDegreesArrayHeights=function(t,r,e){for(var n=new Array(t.length),a=0;a<t.length;a+=3)n[a]=o.toRadians(t[a]),n[a+1]=o.toRadians(t[a+1]),n[a+2]=t[a+2];return i.fromRadiansArrayHeights(n,r,e)},i.fromRadiansArrayHeights=function(t,e,n){var o=t.length;r(n)?n.length=o/3:n=new Array(o/3);for(var a=0;o>a;a+=3){var s=t[a],u=t[a+1],l=t[a+2];n[a/3]=i.fromRadians(s,u,l,e,n[a/3])}return n},i.ZERO=n(new i(0,0,0)),i.UNIT_X=n(new i(1,0,0)),i.UNIT_Y=n(new i(0,1,0)),i.UNIT_Z=n(new i(0,0,1)),i.prototype.clone=function(t){return i.clone(this,t)},i.prototype.equals=function(t){return i.equals(this,t)},i.prototype.equalsEpsilon=function(t,r,e){return i.equalsEpsilon(this,t,r,e)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o){"use strict";var i=function(r,e,n){this.longitude=t(r,0),this.latitude=t(e,0),this.height=t(n,0)};return i.fromRadians=function(e,n,o,a){return o=t(o,0),r(a)?(a.longitude=e,a.latitude=n,a.height=o,a):new i(e,n,o)},i.fromDegrees=function(t,r,e,n){return t=o.toRadians(t),r=o.toRadians(r),i.fromRadians(t,r,e,n)},i.clone=function(t,e){return r(t)?r(e)?(e.longitude=t.longitude,e.latitude=t.latitude,e.height=t.height,e):new i(t.longitude,t.latitude,t.height):void 0},i.equals=function(t,e){return t===e||r(t)&&r(e)&&t.longitude===e.longitude&&t.latitude===e.latitude&&t.height===e.height},i.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t.longitude-e.longitude)<=n&&Math.abs(t.latitude-e.latitude)<=n&&Math.abs(t.height-e.height)<=n},i.ZERO=n(new i(0,0,0)),i.prototype.clone=function(t){return i.clone(this,t)},i.prototype.equals=function(t){return i.equals(this,t)},i.prototype.equalsEpsilon=function(t,r){return i.equalsEpsilon(this,t,r)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(t){"use strict";var r=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),e=Object.defineProperties;return r&&t(e)||(e=function(t){return t}),e}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o,i,a,s){"use strict";function u(r,n,o,i){n=e(n,0),o=e(o,0),i=e(i,0),r._radii=new t(n,o,i),r._radiiSquared=new t(n*n,o*o,i*i),r._radiiToTheFourth=new t(n*n*n*n,o*o*o*o,i*i*i*i),r._oneOverRadii=new t(0===n?0:1/n,0===o?0:1/o,0===i?0:1/i),r._oneOverRadiiSquared=new t(0===n?0:1/(n*n),0===o?0:1/(o*o),0===i?0:1/(i*i)),r._minimumRadius=Math.min(n,o,i),r._maximumRadius=Math.max(n,o,i),r._centerToleranceSquared=s.EPSILON1}var l=function(t,r,e){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,u(this,t,r,e)};o(l.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),l.clone=function(r,e){if(!n(r))return void 0;var o=r._radii;return n(e)?(t.clone(o,e._radii),t.clone(r._radiiSquared,e._radiiSquared),t.clone(r._radiiToTheFourth,e._radiiToTheFourth),t.clone(r._oneOverRadii,e._oneOverRadii),t.clone(r._oneOverRadiiSquared,e._oneOverRadiiSquared),e._minimumRadius=r._minimumRadius,e._maximumRadius=r._maximumRadius,e._centerToleranceSquared=r._centerToleranceSquared,e):new l(o.x,o.y,o.z)},l.fromCartesian3=function(t,r){return n(r)||(r=new l),n(t)?(u(r,t.x,t.y,t.z),r):r},l.WGS84=a(new l(6378137,6378137,6356752.314245179)),l.UNIT_SPHERE=a(new l(1,1,1)),l.MOON=a(new l(s.LUNAR_RADIUS,s.LUNAR_RADIUS,s.LUNAR_RADIUS)),l.prototype.clone=function(t){return l.clone(this,t)},l.packedLength=t.packedLength,l.pack=function(r,n,o){o=e(o,0),t.pack(r._radii,n,o)},l.unpack=function(r,n,o){n=e(n,0);var i=t.unpack(r,n);return l.fromCartesian3(i,o)},l.prototype.geocentricSurfaceNormal=t.normalize,l.prototype.geodeticSurfaceNormalCartographic=function(r,e){var o=r.longitude,i=r.latitude,a=Math.cos(i),s=a*Math.cos(o),u=a*Math.sin(o),l=Math.sin(i);return n(e)||(e=new t),e.x=s,e.y=u,e.z=l,t.normalize(e,e)},l.prototype.geodeticSurfaceNormal=function(r,e){return n(e)||(e=new t),e=t.multiplyComponents(r,this._oneOverRadiiSquared,e),t.normalize(e,e)};var c=new t,f=new t;l.prototype.cartographicToCartesian=function(r,e){var o=c,i=f;this.geodeticSurfaceNormalCartographic(r,o),t.multiplyComponents(this._radiiSquared,o,i);var a=Math.sqrt(t.dot(o,i));return t.divideByScalar(i,a,i),t.multiplyByScalar(o,r.height,o),n(e)||(e=new t),t.add(i,o,e)},l.prototype.cartographicArrayToCartesianArray=function(t,r){var e=t.length;n(r)?r.length=e:r=new Array(e);for(var o=0;e>o;o++)r[o]=this.cartographicToCartesian(t[o],r[o]);return r};var h=new t,d=new t,m=new t;l.prototype.cartesianToCartographic=function(e,o){var i=this.scaleToGeodeticSurface(e,d);if(!n(i))return void 0;var a=this.geodeticSurfaceNormal(i,h),u=t.subtract(e,i,m),l=Math.atan2(a.y,a.x),c=Math.asin(a.z),f=s.sign(t.dot(u,e))*t.magnitude(u);return n(o)?(o.longitude=l,o.latitude=c,o.height=f,o):new r(l,c,f)},l.prototype.cartesianArrayToCartographicArray=function(t,r){var e=t.length;n(r)?r.length=e:r=new Array(e);for(var o=0;e>o;++o)r[o]=this.cartesianToCartographic(t[o],r[o]);return r};var p=new t,g=new t;return l.prototype.scaleToGeodeticSurface=function(r,e){var o=r.x,i=r.y,a=r.z,u=this._oneOverRadii,l=u.x,c=u.y,f=u.z,h=o*o*l*l,d=i*i*c*c,m=a*a*f*f,E=h+d+m,y=Math.sqrt(1/E),v=t.multiplyByScalar(r,y,p);if(E<this._centerToleranceSquared)return isFinite(y)?t.clone(v,e):void 0;var S=this._oneOverRadiiSquared,C=S.x,w=S.y,M=S.z,R=g;R.x=2*v.x*C,R.y=2*v.y*w,R.z=2*v.z*M;var A,O,T,I,N,x,_,L,P,b,F,D=(1-y)*t.magnitude(r)/(.5*t.magnitude(R)),z=0;do{D-=z,T=1/(1+D*C),I=1/(1+D*w),N=1/(1+D*M),x=T*T,_=I*I,L=N*N,P=x*T,b=_*I,F=L*N,A=h*x+d*_+m*L-1,O=h*P*C+d*b*w+m*F*M;var B=-2*O;z=A/B}while(Math.abs(A)>s.EPSILON12);return n(e)?(e.x=o*T,e.y=i*I,e.z=a*N,e):new t(o*T,i*I,a*N)},l.prototype.scaleToGeocentricSurface=function(r,e){n(e)||(e=new t);var o=r.x,i=r.y,a=r.z,s=this._oneOverRadiiSquared,u=1/Math.sqrt(o*o*s.x+i*i*s.y+a*a*s.z);return t.multiplyByScalar(r,u,e)},l.prototype.transformPositionToScaledSpace=function(r,e){return n(e)||(e=new t),t.multiplyComponents(r,this._oneOverRadii,e)},l.prototype.transformPositionFromScaledSpace=function(r,e){return n(e)||(e=new t),t.multiplyComponents(r,this._radii,e)},l.prototype.equals=function(r){return this===r||n(r)&&t.equals(this._radii,r._radii)},l.prototype.toString=function(){return this._radii.toString()},l}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var r={},e=function(e,n){t(r[e])||(r[e]=!0,console.log(n))};return e}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,r,e,n,o,i,a){"use strict";var s=function(t){this._ellipsoid=e(t,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return o(s.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),s.prototype.project=function(r,e){var o=this._semimajorAxis,i=r.longitude*o,a=r.latitude*o,s=r.height;return n(e)?(e.x=i,e.y=a,e.z=s,e):new t(i,a,s)},s.prototype.unproject=function(t,e){var o=this._oneOverSemimajorAxis,i=t.x*o,a=t.y*o,s=t.z;return n(e)?(e.longitude=i,e.latitude=a,e.height=s,e):new r(i,a,s)},s}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var r={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(r)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var r=function(r,e){this.start=t(r,0),this.stop=t(e,0)};return r}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o){"use strict";var i=function(r,e,n,o){this.x=t(r,0),this.y=t(e,0),this.z=t(n,0),this.w=t(o,0)};i.fromElements=function(t,e,n,o,a){return r(a)?(a.x=t,a.y=e,a.z=n,a.w=o,a):new i(t,e,n,o)},i.fromColor=function(t,e){return r(e)?(e.x=t.red,e.y=t.green,e.z=t.blue,e.w=t.alpha,e):new i(t.red,t.green,t.blue,t.alpha)},i.clone=function(t,e){return r(t)?r(e)?(e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e):new i(t.x,t.y,t.z,t.w):void 0},i.packedLength=4,i.pack=function(r,e,n){n=t(n,0),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n]=r.w},i.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new i),o.x=e[n++],o.y=e[n++],o.z=e[n++],o.w=e[n],o},i.fromArray=i.unpack,i.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},i.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},i.minimumByComponent=function(t,r,e){return e.x=Math.min(t.x,r.x),e.y=Math.min(t.y,r.y),e.z=Math.min(t.z,r.z),e.w=Math.min(t.w,r.w),e},i.maximumByComponent=function(t,r,e){return e.x=Math.max(t.x,r.x),e.y=Math.max(t.y,r.y),e.z=Math.max(t.z,r.z),e.w=Math.max(t.w,r.w),e},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},i.magnitude=function(t){return Math.sqrt(i.magnitudeSquared(t))};var a=new i;i.distance=function(t,r){return i.subtract(t,r,a),i.magnitude(a)},i.distanceSquared=function(t,r){return i.subtract(t,r,a),i.magnitudeSquared(a)},i.normalize=function(t,r){var e=i.magnitude(t);return r.x=t.x/e,r.y=t.y/e,r.z=t.z/e,r.w=t.w/e,r},i.dot=function(t,r){return t.x*r.x+t.y*r.y+t.z*r.z+t.w*r.w},i.multiplyComponents=function(t,r,e){return e.x=t.x*r.x,e.y=t.y*r.y,e.z=t.z*r.z,e.w=t.w*r.w,e},i.add=function(t,r,e){return e.x=t.x+r.x,e.y=t.y+r.y,e.z=t.z+r.z,e.w=t.w+r.w,e},i.subtract=function(t,r,e){return e.x=t.x-r.x,e.y=t.y-r.y,e.z=t.z-r.z,e.w=t.w-r.w,e},i.multiplyByScalar=function(t,r,e){return e.x=t.x*r,e.y=t.y*r,e.z=t.z*r,e.w=t.w*r,e},i.divideByScalar=function(t,r,e){return e.x=t.x/r,e.y=t.y/r,e.z=t.z/r,e.w=t.w/r,e},i.negate=function(t,r){return r.x=-t.x,r.y=-t.y,r.z=-t.z,r.w=-t.w,r},i.abs=function(t,r){return r.x=Math.abs(t.x),r.y=Math.abs(t.y),r.z=Math.abs(t.z),r.w=Math.abs(t.w),r};var s=new i;i.lerp=function(t,r,e,n){return i.multiplyByScalar(r,e,s),n=i.multiplyByScalar(t,1-e,n),i.add(s,n,n)};var u=new i;return i.mostOrthogonalAxis=function(t,r){var e=i.normalize(t,u);return i.abs(e,e),r=e.x<=e.y?e.x<=e.z?e.x<=e.w?i.clone(i.UNIT_X,r):i.clone(i.UNIT_W,r):e.z<=e.w?i.clone(i.UNIT_Z,r):i.clone(i.UNIT_W,r):e.y<=e.z?e.y<=e.w?i.clone(i.UNIT_Y,r):i.clone(i.UNIT_W,r):e.z<=e.w?i.clone(i.UNIT_Z,r):i.clone(i.UNIT_W,r)},i.equals=function(t,e){return t===e||r(t)&&r(e)&&t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},i.equalsArray=function(t,r,e){return t.x===r[e]&&t.y===r[e+1]&&t.z===r[e+2]&&t.w===r[e+3]},i.equalsEpsilon=function(t,e,n,i){return t===e||r(t)&&r(e)&&o.equalsEpsilon(t.x,e.x,n,i)&&o.equalsEpsilon(t.y,e.y,n,i)&&o.equalsEpsilon(t.z,e.z,n,i)&&o.equalsEpsilon(t.w,e.w,n,i)},i.ZERO=n(new i(0,0,0,0)),i.UNIT_X=n(new i(1,0,0,0)),i.UNIT_Y=n(new i(0,1,0,0)),i.UNIT_Z=n(new i(0,0,1,0)),i.UNIT_W=n(new i(0,0,0,1)),i.prototype.clone=function(t){return i.clone(this,t)},i.prototype.equals=function(t){return i.equals(this,t)},i.prototype.equalsEpsilon=function(t,r,e){return i.equalsEpsilon(this,t,r,e)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o,i){"use strict";function a(t){for(var r=0,e=0;9>e;++e){var n=t[e];r+=n*n}return Math.sqrt(r)}function s(t){for(var r=0,e=0;3>e;++e){var n=t[l.getElementIndex(d[e],h[e])];r+=2*n*n}return Math.sqrt(r)}function u(t,r){for(var e=i.EPSILON15,n=0,o=1,a=0;3>a;++a){var s=Math.abs(t[l.getElementIndex(d[a],h[a])]);s>n&&(o=a,n=s)}var u=1,c=0,f=h[o],m=d[o];if(Math.abs(t[l.getElementIndex(m,f)])>e){var p,g=t[l.getElementIndex(m,m)],E=t[l.getElementIndex(f,f)],y=t[l.getElementIndex(m,f)],v=(g-E)/2/y;p=0>v?-1/(-v+Math.sqrt(1+v*v)):1/(v+Math.sqrt(1+v*v)),u=1/Math.sqrt(1+p*p),c=p*u}return r=l.clone(l.IDENTITY,r),r[l.getElementIndex(f,f)]=r[l.getElementIndex(m,m)]=u,r[l.getElementIndex(m,f)]=c,r[l.getElementIndex(f,m)]=-c,r}var l=function(t,e,n,o,i,a,s,u,l){this[0]=r(t,0),this[1]=r(o,0),this[2]=r(s,0),this[3]=r(e,0),this[4]=r(i,0),this[5]=r(u,0),this[6]=r(n,0),this[7]=r(a,0),this[8]=r(l,0)};l.packedLength=9,l.pack=function(t,e,n){n=r(n,0),e[n++]=t[0],e[n++]=t[1],e[n++]=t[2],e[n++]=t[3],e[n++]=t[4],e[n++]=t[5],e[n++]=t[6],e[n++]=t[7],e[n++]=t[8]},l.unpack=function(t,n,o){return n=r(n,0),e(o)||(o=new l),o[0]=t[n++],o[1]=t[n++],o[2]=t[n++],o[3]=t[n++],o[4]=t[n++],o[5]=t[n++],o[6]=t[n++],o[7]=t[n++],o[8]=t[n++],o},l.clone=function(t,r){return e(t)?e(r)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r):new l(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},l.fromArray=function(t,n,o){return n=r(n,0),e(o)||(o=new l),o[0]=t[n],o[1]=t[n+1],o[2]=t[n+2],o[3]=t[n+3],o[4]=t[n+4],o[5]=t[n+5],o[6]=t[n+6],o[7]=t[n+7],o[8]=t[n+8],o},l.fromColumnMajorArray=function(t,r){return l.clone(t,r)},l.fromRowMajorArray=function(t,r){return e(r)?(r[0]=t[0],r[1]=t[3],r[2]=t[6],r[3]=t[1],r[4]=t[4],r[5]=t[7],r[6]=t[2],r[7]=t[5],r[8]=t[8],r):new l(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},l.fromQuaternion=function(t,r){var n=t.x*t.x,o=t.x*t.y,i=t.x*t.z,a=t.x*t.w,s=t.y*t.y,u=t.y*t.z,c=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=n-s-f+d,p=2*(o-h),g=2*(i+c),E=2*(o+h),y=-n+s-f+d,v=2*(u-a),S=2*(i-c),C=2*(u+a),w=-n-s+f+d;return e(r)?(r[0]=m,r[1]=E,r[2]=S,r[3]=p,r[4]=y,r[5]=C,r[6]=g,r[7]=v,r[8]=w,r):new l(m,p,g,E,y,v,S,C,w)},l.fromScale=function(t,r){return e(r)?(r[0]=t.x,r[1]=0,r[2]=0,r[3]=0,r[4]=t.y,r[5]=0,r[6]=0,r[7]=0,r[8]=t.z,r):new l(t.x,0,0,0,t.y,0,0,0,t.z)},l.fromUniformScale=function(t,r){return e(r)?(r[0]=t,r[1]=0,r[2]=0,r[3]=0,r[4]=t,r[5]=0,r[6]=0,r[7]=0,r[8]=t,r):new l(t,0,0,0,t,0,0,0,t)},l.fromCrossProduct=function(t,r){return e(r)?(r[0]=0,r[1]=t.z,r[2]=-t.y,r[3]=-t.z,r[4]=0,r[5]=t.x,r[6]=t.y,r[7]=-t.x,r[8]=0,r):new l(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},l.fromRotationX=function(t,r){var n=Math.cos(t),o=Math.sin(t);return e(r)?(r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=n,r[5]=o,r[6]=0,r[7]=-o,r[8]=n,r):new l(1,0,0,0,n,-o,0,o,n)},l.fromRotationY=function(t,r){var n=Math.cos(t),o=Math.sin(t);return e(r)?(r[0]=n,r[1]=0,r[2]=-o,r[3]=0,r[4]=1,r[5]=0,r[6]=o,r[7]=0,r[8]=n,r):new l(n,0,o,0,1,0,-o,0,n)},l.fromRotationZ=function(t,r){var n=Math.cos(t),o=Math.sin(t);return e(r)?(r[0]=n,r[1]=o,r[2]=0,r[3]=-o,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r):new l(n,-o,0,o,n,0,0,0,1)},l.toArray=function(t,r){return e(r)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},l.getElementIndex=function(t,r){return 3*t+r},l.getColumn=function(t,r,e){var n=3*r,o=t[n],i=t[n+1],a=t[n+2];return e.x=o,e.y=i,e.z=a,e},l.setColumn=function(t,r,e,n){n=l.clone(t,n);var o=3*r;return n[o]=e.x,n[o+1]=e.y,n[o+2]=e.z,n},l.getRow=function(t,r,e){var n=t[r],o=t[r+3],i=t[r+6];return e.x=n,e.y=o,e.z=i,e},l.setRow=function(t,r,e,n){return n=l.clone(t,n),n[r]=e.x,n[r+3]=e.y,n[r+6]=e.z,n};var c=new t;l.getScale=function(r,e){return e.x=t.magnitude(t.fromElements(r[0],r[1],r[2],c)),e.y=t.magnitude(t.fromElements(r[3],r[4],r[5],c)),e.z=t.magnitude(t.fromElements(r[6],r[7],r[8],c)),e};var f=new t;l.getMaximumScale=function(r){return l.getScale(r,f),t.maximumComponent(f)},l.multiply=function(t,r,e){var n=t[0]*r[0]+t[3]*r[1]+t[6]*r[2],o=t[1]*r[0]+t[4]*r[1]+t[7]*r[2],i=t[2]*r[0]+t[5]*r[1]+t[8]*r[2],a=t[0]*r[3]+t[3]*r[4]+t[6]*r[5],s=t[1]*r[3]+t[4]*r[4]+t[7]*r[5],u=t[2]*r[3]+t[5]*r[4]+t[8]*r[5],l=t[0]*r[6]+t[3]*r[7]+t[6]*r[8],c=t[1]*r[6]+t[4]*r[7]+t[7]*r[8],f=t[2]*r[6]+t[5]*r[7]+t[8]*r[8];return e[0]=n,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=u,e[6]=l,e[7]=c,e[8]=f,e},l.add=function(t,r,e){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},l.subtract=function(t,r,e){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e},l.multiplyByVector=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=t[0]*n+t[3]*o+t[6]*i,s=t[1]*n+t[4]*o+t[7]*i,u=t[2]*n+t[5]*o+t[8]*i;return e.x=a,e.y=s,e.z=u,e},l.multiplyByScalar=function(t,r,e){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},l.multiplyByScale=function(t,r,e){return e[0]=t[0]*r.x,e[1]=t[1]*r.x,e[2]=t[2]*r.x,e[3]=t[3]*r.y,e[4]=t[4]*r.y,e[5]=t[5]*r.y,e[6]=t[6]*r.z,e[7]=t[7]*r.z,e[8]=t[8]*r.z,e},l.negate=function(t,r){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=-t[3],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[7]=-t[7],r[8]=-t[8],r},l.transpose=function(t,r){var e=t[0],n=t[3],o=t[6],i=t[1],a=t[4],s=t[7],u=t[2],l=t[5],c=t[8];return r[0]=e,r[1]=n,r[2]=o,r[3]=i,r[4]=a,r[5]=s,r[6]=u,r[7]=l,r[8]=c,r};var h=[1,0,0],d=[2,2,1],m=new l,p=new l;return l.computeEigenDecomposition=function(t,r){var n=i.EPSILON20,o=10,c=0,f=0;e(r)||(r={});for(var h=r.unitary=l.clone(l.IDENTITY,r.unitary),d=r.diagonal=l.clone(t,r.diagonal),g=n*a(d);o>f&&s(d)>g;)u(d,m),l.transpose(m,p),l.multiply(d,m,d),l.multiply(p,d,d),l.multiply(h,m,h),++c>2&&(++f,c=0);return r},l.abs=function(t,r){return r[0]=Math.abs(t[0]),r[1]=Math.abs(t[1]),r[2]=Math.abs(t[2]),r[3]=Math.abs(t[3]),r[4]=Math.abs(t[4]),r[5]=Math.abs(t[5]),r[6]=Math.abs(t[6]),r[7]=Math.abs(t[7]),r[8]=Math.abs(t[8]),r},l.determinant=function(t){var r=t[0],e=t[3],n=t[6],o=t[1],i=t[4],a=t[7],s=t[2],u=t[5],l=t[8];return r*(i*l-u*a)+o*(u*n-e*l)+s*(e*a-i*n)},l.inverse=function(t,r){var e=t[0],o=t[1],a=t[2],s=t[3],u=t[4],c=t[5],f=t[6],h=t[7],d=t[8],m=l.determinant(t);if(Math.abs(m)<=i.EPSILON15)throw new n("matrix is not invertible");r[0]=u*d-h*c,r[1]=h*a-o*d,r[2]=o*c-u*a,r[3]=f*c-s*d,r[4]=e*d-f*a,r[5]=s*a-e*c,r[6]=s*h-f*u,r[7]=f*o-e*h,r[8]=e*u-s*o;var p=1/m;return l.multiplyByScalar(r,p,r)},l.equals=function(t,r){return t===r||e(t)&&e(r)&&t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]&&t[3]===r[3]&&t[4]===r[4]&&t[5]===r[5]&&t[6]===r[6]&&t[7]===r[7]&&t[8]===r[8]},l.equalsEpsilon=function(t,r,n){return t===r||e(t)&&e(r)&&Math.abs(t[0]-r[0])<=n&&Math.abs(t[1]-r[1])<=n&&Math.abs(t[2]-r[2])<=n&&Math.abs(t[3]-r[3])<=n&&Math.abs(t[4]-r[4])<=n&&Math.abs(t[5]-r[5])<=n&&Math.abs(t[6]-r[6])<=n&&Math.abs(t[7]-r[7])<=n&&Math.abs(t[8]-r[8])<=n},l.IDENTITY=o(new l(1,0,0,0,1,0,0,0,1)),l.ZERO=o(new l(0,0,0,0,0,0,0,0,0)),l.COLUMN0ROW0=0,l.COLUMN0ROW1=1,l.COLUMN0ROW2=2,l.COLUMN1ROW0=3,l.COLUMN1ROW1=4,l.COLUMN1ROW2=5,l.COLUMN2ROW0=6,l.COLUMN2ROW1=7,l.COLUMN2ROW2=8,l.prototype.clone=function(t){return l.clone(this,t)},l.prototype.equals=function(t){return l.equals(this,t)},l.equalsArray=function(t,r,e){return t[0]===r[e]&&t[1]===r[e+1]&&t[2]===r[e+2]&&t[3]===r[e+3]&&t[4]===r[e+4]&&t[5]===r[e+5]&&t[6]===r[e+6]&&t[7]===r[e+7]&&t[8]===r[e+8]},l.prototype.equalsEpsilon=function(t,r){return l.equalsEpsilon(this,t,r)},l.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},l}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var r=function(t){this.name="RuntimeError",this.message=t;var r;try{throw new Error}catch(e){r=e.stack}this.stack=r};return r.prototype.toString=function(){var r=this.name+": "+this.message;return t(this.stack)&&(r+="\n"+this.stack.toString()),r},r}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,r,e,n,o,i,a,s,u){"use strict";var l=function(t,r,n,o,i,a,s,u,l,c,f,h,d,m,p,g){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(l,0),this[3]=e(d,0),this[4]=e(r,0),this[5]=e(a,0),this[6]=e(c,0),this[7]=e(m,0),this[8]=e(n,0),this[9]=e(s,0),this[10]=e(f,0),this[11]=e(p,0),this[12]=e(o,0),this[13]=e(u,0),this[14]=e(h,0),this[15]=e(g,0)};l.packedLength=16,l.pack=function(t,r,n){n=e(n,0),r[n++]=t[0],r[n++]=t[1],r[n++]=t[2],r[n++]=t[3],r[n++]=t[4],r[n++]=t[5],r[n++]=t[6],r[n++]=t[7],r[n++]=t[8],r[n++]=t[9],r[n++]=t[10],r[n++]=t[11],r[n++]=t[12],r[n++]=t[13],r[n++]=t[14],r[n]=t[15]},l.unpack=function(t,r,o){return r=e(r,0),n(o)||(o=new l),o[0]=t[r++],o[1]=t[r++],o[2]=t[r++],o[3]=t[r++],o[4]=t[r++],o[5]=t[r++],o[6]=t[r++],o[7]=t[r++],o[8]=t[r++],o[9]=t[r++],o[10]=t[r++],o[11]=t[r++],o[12]=t[r++],o[13]=t[r++],o[14]=t[r++],o[15]=t[r],o},l.clone=function(t,r){return n(t)?n(r)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r):new l(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},l.fromArray=l.unpack,l.fromColumnMajorArray=function(t,r){return l.clone(t,r)},l.fromRowMajorArray=function(t,r){return n(r)?(r[0]=t[0],r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=t[1],r[5]=t[5],r[6]=t[9],r[7]=t[13],r[8]=t[2],r[9]=t[6],r[10]=t[10],r[11]=t[14],r[12]=t[3],r[13]=t[7],r[14]=t[11],r[15]=t[15],r):new l(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},l.fromRotationTranslation=function(r,o,i){return o=e(o,t.ZERO),n(i)?(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=0,i[4]=r[3],i[5]=r[4],i[6]=r[5],i[7]=0,i[8]=r[6],i[9]=r[7],i[10]=r[8],i[11]=0,i[12]=o.x,i[13]=o.y,i[14]=o.z,i[15]=1,i):new l(r[0],r[3],r[6],o.x,r[1],r[4],r[7],o.y,r[2],r[5],r[8],o.z,0,0,0,1)},l.fromTranslationQuaternionRotationScale=function(t,r,e,o){n(o)||(o=new l);var i=e.x,a=e.y,s=e.z,u=r.x*r.x,c=r.x*r.y,f=r.x*r.z,h=r.x*r.w,d=r.y*r.y,m=r.y*r.z,p=r.y*r.w,g=r.z*r.z,E=r.z*r.w,y=r.w*r.w,v=u-d-g+y,S=2*(c-E),C=2*(f+p),w=2*(c+E),M=-u+d-g+y,R=2*(m-h),A=2*(f-p),O=2*(m+h),T=-u-d+g+y;return o[0]=v*i,o[1]=w*i,o[2]=A*i,o[3]=0,o[4]=S*a,o[5]=M*a,o[6]=O*a,o[7]=0,o[8]=C*s,o[9]=R*s,o[10]=T*s,o[11]=0,o[12]=t.x,o[13]=t.y,o[14]=t.z,o[15]=1,o},l.fromTranslation=function(t,r){return l.fromRotationTranslation(s.IDENTITY,t,r)},l.fromScale=function(t,r){return n(r)?(r[0]=t.x,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t.y,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t.z,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new l(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},l.fromUniformScale=function(t,r){return n(r)?(r[0]=t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new l(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var c=new t,f=new t,h=new t;l.fromCamera=function(r,e){var o=r.eye,i=r.target,a=r.up;t.normalize(t.subtract(i,o,c),c),t.normalize(t.cross(c,a,f),f),t.normalize(t.cross(f,c,h),h);var s=f.x,u=f.y,d=f.z,m=c.x,p=c.y,g=c.z,E=h.x,y=h.y,v=h.z,S=o.x,C=o.y,w=o.z,M=s*-S+u*-C+d*-w,R=E*-S+y*-C+v*-w,A=m*S+p*C+g*w;return n(e)?(e[0]=s,e[1]=E,e[2]=-m,e[3]=0,e[4]=u,e[5]=y,e[6]=-p,e[7]=0,e[8]=d,e[9]=v,e[10]=-g,e[11]=0,e[12]=M,e[13]=R,e[14]=A,e[15]=1,e):new l(s,u,d,M,E,y,v,R,-m,-p,-g,A,0,0,0,1)},l.computePerspectiveFieldOfView=function(t,r,e,n,o){var i=Math.tan(.5*t),a=1/i,s=a/r,u=(n+e)/(e-n),l=2*n*e/(e-n);return o[0]=s,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=u,o[11]=-1,o[12]=0,o[13]=0,o[14]=l,o[15]=0,o},l.computeOrthographicOffCenter=function(t,r,e,n,o,i,a){var s=1/(r-t),u=1/(n-e),l=1/(i-o),c=-(r+t)*s,f=-(n+e)*u,h=-(i+o)*l;return s*=2,u*=2,l*=-2,a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=l,a[11]=0,a[12]=c,a[13]=f,a[14]=h,a[15]=1,a -},l.computePerspectiveOffCenter=function(t,r,e,n,o,i,a){var s=2*o/(r-t),u=2*o/(n-e),l=(r+t)/(r-t),c=(n+e)/(n-e),f=-(i+o)/(i-o),h=-1,d=-2*i*o/(i-o);return a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=l,a[9]=c,a[10]=f,a[11]=h,a[12]=0,a[13]=0,a[14]=d,a[15]=0,a},l.computeInfinitePerspectiveOffCenter=function(t,r,e,n,o,i){var a=2*o/(r-t),s=2*o/(n-e),u=(r+t)/(r-t),l=(n+e)/(n-e),c=-1,f=-1,h=-2*o;return i[0]=a,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=u,i[9]=l,i[10]=c,i[11]=f,i[12]=0,i[13]=0,i[14]=h,i[15]=0,i},l.computeViewportTransformation=function(t,r,n,o){t=e(t,e.EMPTY_OBJECT);var i=e(t.x,0),a=e(t.y,0),s=e(t.width,0),u=e(t.height,0);r=e(r,0),n=e(n,1);var l=.5*s,c=.5*u,f=.5*(n-r),h=l,d=c,m=f,p=i+l,g=a+c,E=r+f,y=1;return o[0]=h,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=d,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=m,o[11]=0,o[12]=p,o[13]=g,o[14]=E,o[15]=y,o},l.toArray=function(t,r){return n(r)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},l.getElementIndex=function(t,r){return 4*t+r},l.getColumn=function(t,r,e){var n=4*r,o=t[n],i=t[n+1],a=t[n+2],s=t[n+3];return e.x=o,e.y=i,e.z=a,e.w=s,e},l.setColumn=function(t,r,e,n){n=l.clone(t,n);var o=4*r;return n[o]=e.x,n[o+1]=e.y,n[o+2]=e.z,n[o+3]=e.w,n},l.setTranslation=function(t,r,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=r.x,e[13]=r.y,e[14]=r.z,e[15]=t[15],e},l.getRow=function(t,r,e){var n=t[r],o=t[r+4],i=t[r+8],a=t[r+12];return e.x=n,e.y=o,e.z=i,e.w=a,e},l.setRow=function(t,r,e,n){return n=l.clone(t,n),n[r]=e.x,n[r+4]=e.y,n[r+8]=e.z,n[r+12]=e.w,n};var d=new t;l.getScale=function(r,e){return e.x=t.magnitude(t.fromElements(r[0],r[1],r[2],d)),e.y=t.magnitude(t.fromElements(r[4],r[5],r[6],d)),e.z=t.magnitude(t.fromElements(r[8],r[9],r[10],d)),e};var m=new t;l.getMaximumScale=function(r){return l.getScale(r,m),t.maximumComponent(m)},l.multiply=function(t,r,e){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],f=t[8],h=t[9],d=t[10],m=t[11],p=t[12],g=t[13],E=t[14],y=t[15],v=r[0],S=r[1],C=r[2],w=r[3],M=r[4],R=r[5],A=r[6],O=r[7],T=r[8],I=r[9],N=r[10],x=r[11],_=r[12],L=r[13],P=r[14],b=r[15],F=n*v+s*S+f*C+p*w,D=o*v+u*S+h*C+g*w,z=i*v+l*S+d*C+E*w,B=a*v+c*S+m*C+y*w,U=n*M+s*R+f*A+p*O,q=o*M+u*R+h*A+g*O,G=i*M+l*R+d*A+E*O,W=a*M+c*R+m*A+y*O,Y=n*T+s*I+f*N+p*x,H=o*T+u*I+h*N+g*x,V=i*T+l*I+d*N+E*x,k=a*T+c*I+m*N+y*x,K=n*_+s*L+f*P+p*b,j=o*_+u*L+h*P+g*b,Z=i*_+l*L+d*P+E*b,X=a*_+c*L+m*P+y*b;return e[0]=F,e[1]=D,e[2]=z,e[3]=B,e[4]=U,e[5]=q,e[6]=G,e[7]=W,e[8]=Y,e[9]=H,e[10]=V,e[11]=k,e[12]=K,e[13]=j,e[14]=Z,e[15]=X,e},l.add=function(t,r,e){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e},l.subtract=function(t,r,e){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e},l.multiplyTransformation=function(t,r,e){var n=t[0],o=t[1],i=t[2],a=t[4],s=t[5],u=t[6],l=t[8],c=t[9],f=t[10],h=t[12],d=t[13],m=t[14],p=r[0],g=r[1],E=r[2],y=r[4],v=r[5],S=r[6],C=r[8],w=r[9],M=r[10],R=r[12],A=r[13],O=r[14],T=n*p+a*g+l*E,I=o*p+s*g+c*E,N=i*p+u*g+f*E,x=n*y+a*v+l*S,_=o*y+s*v+c*S,L=i*y+u*v+f*S,P=n*C+a*w+l*M,b=o*C+s*w+c*M,F=i*C+u*w+f*M,D=n*R+a*A+l*O+h,z=o*R+s*A+c*O+d,B=i*R+u*A+f*O+m;return e[0]=T,e[1]=I,e[2]=N,e[3]=0,e[4]=x,e[5]=_,e[6]=L,e[7]=0,e[8]=P,e[9]=b,e[10]=F,e[11]=0,e[12]=D,e[13]=z,e[14]=B,e[15]=1,e},l.multiplyByMatrix3=function(t,r,e){var n=t[0],o=t[1],i=t[2],a=t[4],s=t[5],u=t[6],l=t[8],c=t[9],f=t[10],h=r[0],d=r[1],m=r[2],p=r[3],g=r[4],E=r[5],y=r[6],v=r[7],S=r[8],C=n*h+a*d+l*m,w=o*h+s*d+c*m,M=i*h+u*d+f*m,R=n*p+a*g+l*E,A=o*p+s*g+c*E,O=i*p+u*g+f*E,T=n*y+a*v+l*S,I=o*y+s*v+c*S,N=i*y+u*v+f*S;return e[0]=C,e[1]=w,e[2]=M,e[3]=0,e[4]=R,e[5]=A,e[6]=O,e[7]=0,e[8]=T,e[9]=I,e[10]=N,e[11]=0,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},l.multiplyByTranslation=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=n*t[0]+o*t[4]+i*t[8]+t[12],s=n*t[1]+o*t[5]+i*t[9]+t[13],u=n*t[2]+o*t[6]+i*t[10]+t[14];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=a,e[13]=s,e[14]=u,e[15]=t[15],e};var p=new t;l.multiplyByUniformScale=function(t,r,e){return p.x=r,p.y=r,p.z=r,l.multiplyByScale(t,p,e)},l.multiplyByScale=function(t,r,e){var n=r.x,o=r.y,i=r.z;return 1===n&&1===o&&1===i?l.clone(t,e):(e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=0,e[4]=o*t[4],e[5]=o*t[5],e[6]=o*t[6],e[7]=0,e[8]=i*t[8],e[9]=i*t[9],e[10]=i*t[10],e[11]=0,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=1,e)},l.multiplyByVector=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=r.w,s=t[0]*n+t[4]*o+t[8]*i+t[12]*a,u=t[1]*n+t[5]*o+t[9]*i+t[13]*a,l=t[2]*n+t[6]*o+t[10]*i+t[14]*a,c=t[3]*n+t[7]*o+t[11]*i+t[15]*a;return e.x=s,e.y=u,e.z=l,e.w=c,e},l.multiplyByPointAsVector=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=t[0]*n+t[4]*o+t[8]*i,s=t[1]*n+t[5]*o+t[9]*i,u=t[2]*n+t[6]*o+t[10]*i;return e.x=a,e.y=s,e.z=u,e},l.multiplyByPoint=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=t[0]*n+t[4]*o+t[8]*i+t[12],s=t[1]*n+t[5]*o+t[9]*i+t[13],u=t[2]*n+t[6]*o+t[10]*i+t[14];return e.x=a,e.y=s,e.z=u,e},l.multiplyByScalar=function(t,r,e){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e},l.negate=function(t,r){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=-t[3],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[7]=-t[7],r[8]=-t[8],r[9]=-t[9],r[10]=-t[10],r[11]=-t[11],r[12]=-t[12],r[13]=-t[13],r[14]=-t[14],r[15]=-t[15],r},l.transpose=function(t,r){var e=t[1],n=t[2],o=t[3],i=t[6],a=t[7],s=t[11];return r[0]=t[0],r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=e,r[5]=t[5],r[6]=t[9],r[7]=t[13],r[8]=n,r[9]=i,r[10]=t[10],r[11]=t[14],r[12]=o,r[13]=a,r[14]=s,r[15]=t[15],r},l.abs=function(t,r){return r[0]=Math.abs(t[0]),r[1]=Math.abs(t[1]),r[2]=Math.abs(t[2]),r[3]=Math.abs(t[3]),r[4]=Math.abs(t[4]),r[5]=Math.abs(t[5]),r[6]=Math.abs(t[6]),r[7]=Math.abs(t[7]),r[8]=Math.abs(t[8]),r[9]=Math.abs(t[9]),r[10]=Math.abs(t[10]),r[11]=Math.abs(t[11]),r[12]=Math.abs(t[12]),r[13]=Math.abs(t[13]),r[14]=Math.abs(t[14]),r[15]=Math.abs(t[15]),r},l.equals=function(t,r){return t===r||n(t)&&n(r)&&t[12]===r[12]&&t[13]===r[13]&&t[14]===r[14]&&t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]&&t[4]===r[4]&&t[5]===r[5]&&t[6]===r[6]&&t[8]===r[8]&&t[9]===r[9]&&t[10]===r[10]&&t[3]===r[3]&&t[7]===r[7]&&t[11]===r[11]&&t[15]===r[15]},l.equalsEpsilon=function(t,r,e){return t===r||n(t)&&n(r)&&Math.abs(t[0]-r[0])<=e&&Math.abs(t[1]-r[1])<=e&&Math.abs(t[2]-r[2])<=e&&Math.abs(t[3]-r[3])<=e&&Math.abs(t[4]-r[4])<=e&&Math.abs(t[5]-r[5])<=e&&Math.abs(t[6]-r[6])<=e&&Math.abs(t[7]-r[7])<=e&&Math.abs(t[8]-r[8])<=e&&Math.abs(t[9]-r[9])<=e&&Math.abs(t[10]-r[10])<=e&&Math.abs(t[11]-r[11])<=e&&Math.abs(t[12]-r[12])<=e&&Math.abs(t[13]-r[13])<=e&&Math.abs(t[14]-r[14])<=e&&Math.abs(t[15]-r[15])<=e},l.getTranslation=function(t,r){return r.x=t[12],r.y=t[13],r.z=t[14],r},l.getRotation=function(t,r){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[4],r[4]=t[5],r[5]=t[6],r[6]=t[8],r[7]=t[9],r[8]=t[10],r};var g=new s,E=new s,y=new r,v=new r(0,0,0,1);return l.inverse=function(t,e){if(s.equalsEpsilon(l.getRotation(t,g),E,a.EPSILON7)&&r.equals(l.getRow(t,3,y),v))return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=0,e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=1,e;var n=t[0],o=t[4],i=t[8],c=t[12],f=t[1],h=t[5],d=t[9],m=t[13],p=t[2],S=t[6],C=t[10],w=t[14],M=t[3],R=t[7],A=t[11],O=t[15],T=C*O,I=w*A,N=S*O,x=w*R,_=S*A,L=C*R,P=p*O,b=w*M,F=p*A,D=C*M,z=p*R,B=S*M,U=T*h+x*d+_*m-(I*h+N*d+L*m),q=I*f+P*d+D*m-(T*f+b*d+F*m),G=N*f+b*h+z*m-(x*f+P*h+B*m),W=L*f+F*h+B*d-(_*f+D*h+z*d),Y=I*o+N*i+L*c-(T*o+x*i+_*c),H=T*n+b*i+F*c-(I*n+P*i+D*c),V=x*n+P*o+B*c-(N*n+b*o+z*c),k=_*n+D*o+z*i-(L*n+F*o+B*i);T=i*m,I=c*d,N=o*m,x=c*h,_=o*d,L=i*h,P=n*m,b=c*f,F=n*d,D=i*f,z=n*h,B=o*f;var K=T*R+x*A+_*O-(I*R+N*A+L*O),j=I*M+P*A+D*O-(T*M+b*A+F*O),Z=N*M+b*R+z*O-(x*M+P*R+B*O),X=L*M+F*R+B*A-(_*M+D*R+z*A),Q=N*C+L*w+I*S-(_*w+T*S+x*C),J=F*w+T*p+b*C-(P*C+D*w+I*p),$=P*S+B*w+x*p-(z*w+N*p+b*S),tr=z*C+_*p+D*S-(F*S+B*C+L*p),rr=n*U+o*q+i*G+c*W;if(Math.abs(rr)<a.EPSILON20)throw new u("matrix is not invertible because its determinate is zero.");return rr=1/rr,e[0]=U*rr,e[1]=q*rr,e[2]=G*rr,e[3]=W*rr,e[4]=Y*rr,e[5]=H*rr,e[6]=V*rr,e[7]=k*rr,e[8]=K*rr,e[9]=j*rr,e[10]=Z*rr,e[11]=X*rr,e[12]=Q*rr,e[13]=J*rr,e[14]=$*rr,e[15]=tr*rr,e},l.inverseTransformation=function(t,r){var e=t[0],n=t[1],o=t[2],i=t[4],a=t[5],s=t[6],u=t[8],l=t[9],c=t[10],f=t[12],h=t[13],d=t[14],m=-e*f-n*h-o*d,p=-i*f-a*h-s*d,g=-u*f-l*h-c*d;return r[0]=e,r[1]=i,r[2]=u,r[3]=0,r[4]=n,r[5]=a,r[6]=l,r[7]=0,r[8]=o,r[9]=s,r[10]=c,r[11]=0,r[12]=m,r[13]=p,r[14]=g,r[15]=1,r},l.IDENTITY=i(new l(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),l.ZERO=i(new l(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),l.COLUMN0ROW0=0,l.COLUMN0ROW1=1,l.COLUMN0ROW2=2,l.COLUMN0ROW3=3,l.COLUMN1ROW0=4,l.COLUMN1ROW1=5,l.COLUMN1ROW2=6,l.COLUMN1ROW3=7,l.COLUMN2ROW0=8,l.COLUMN2ROW1=9,l.COLUMN2ROW2=10,l.COLUMN2ROW3=11,l.COLUMN3ROW0=12,l.COLUMN3ROW1=13,l.COLUMN3ROW2=14,l.COLUMN3ROW3=15,l.prototype.clone=function(t){return l.clone(this,t)},l.prototype.equals=function(t){return l.equals(this,t)},l.equalsArray=function(t,r,e){return t[0]===r[e]&&t[1]===r[e+1]&&t[2]===r[e+2]&&t[3]===r[e+3]&&t[4]===r[e+4]&&t[5]===r[e+5]&&t[6]===r[e+6]&&t[7]===r[e+7]&&t[8]===r[e+8]&&t[9]===r[e+9]&&t[10]===r[e+10]&&t[11]===r[e+11]&&t[12]===r[e+12]&&t[13]===r[e+13]&&t[14]===r[e+14]&&t[15]===r[e+15]},l.prototype.equalsEpsilon=function(t,r){return l.equalsEpsilon(this,t,r)},l.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},l}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,r,e,n){"use strict";var o=function(r,e){this.normal=t.clone(r),this.distance=e};o.fromPointNormal=function(e,n,i){var a=-t.dot(n,e);return r(i)?(t.clone(n,i.normal),i.distance=a,i):new o(n,a)};var i=new t;return o.fromCartesian4=function(e,n){var a=t.fromCartesian4(e,i),s=e.w;return r(n)?(t.clone(a,n.normal),n.distance=s,n):new o(a,s)},o.getPointDistance=function(r,e){return t.dot(r.normal,e)+r.distance},o.ORIGIN_XY_PLANE=n(new o(t.UNIT_Z,0)),o.ORIGIN_YZ_PLANE=n(new o(t.UNIT_X,0)),o.ORIGIN_ZX_PLANE=n(new o(t.UNIT_Y,0)),o}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,r,e,n,o,i,a,s){"use strict";var u=function(t,e,n,o){this.west=r(t,0),this.south=r(e,0),this.east=r(n,0),this.north=r(o,0)};n(u.prototype,{width:{get:function(){return u.computeWidth(this)}},height:{get:function(){return u.computeHeight(this)}}}),u.packedLength=4,u.pack=function(t,e,n){n=r(n,0),e[n++]=t.west,e[n++]=t.south,e[n++]=t.east,e[n]=t.north},u.unpack=function(t,n,o){return n=r(n,0),e(o)||(o=new u),o.west=t[n++],o.south=t[n++],o.east=t[n++],o.north=t[n],o},u.computeWidth=function(t){var r=t.east,e=t.west;return e>r&&(r+=s.TWO_PI),r-e},u.computeHeight=function(t){return t.north-t.south},u.fromDegrees=function(t,n,o,i,a){return t=s.toRadians(r(t,0)),n=s.toRadians(r(n,0)),o=s.toRadians(r(o,0)),i=s.toRadians(r(i,0)),e(a)?(a.west=t,a.south=n,a.east=o,a.north=i,a):new u(t,n,o,i)},u.fromCartographicArray=function(t,r){for(var n=Number.MAX_VALUE,o=-Number.MAX_VALUE,i=Number.MAX_VALUE,a=-Number.MAX_VALUE,s=0,l=t.length;l>s;s++){var c=t[s];n=Math.min(n,c.longitude),o=Math.max(o,c.longitude),i=Math.min(i,c.latitude),a=Math.max(a,c.latitude)}return e(r)?(r.west=n,r.south=i,r.east=o,r.north=a,r):new u(n,i,o,a)},u.clone=function(t,r){return e(t)?e(r)?(r.west=t.west,r.south=t.south,r.east=t.east,r.north=t.north,r):new u(t.west,t.south,t.east,t.north):void 0},u.prototype.clone=function(t){return u.clone(this,t)},u.prototype.equals=function(t){return u.equals(this,t)},u.equals=function(t,r){return t===r||e(t)&&e(r)&&t.west===r.west&&t.south===r.south&&t.east===r.east&&t.north===r.north},u.prototype.equalsEpsilon=function(t,r){return e(t)&&Math.abs(this.west-t.west)<=r&&Math.abs(this.south-t.south)<=r&&Math.abs(this.east-t.east)<=r&&Math.abs(this.north-t.north)<=r},u.validate=function(){},u.southwest=function(r,n){return e(n)?(n.longitude=r.west,n.latitude=r.south,n.height=0,n):new t(r.west,r.south)},u.northwest=function(r,n){return e(n)?(n.longitude=r.west,n.latitude=r.north,n.height=0,n):new t(r.west,r.north)},u.northeast=function(r,n){return e(n)?(n.longitude=r.east,n.latitude=r.north,n.height=0,n):new t(r.east,r.north)},u.southeast=function(r,n){return e(n)?(n.longitude=r.east,n.latitude=r.south,n.height=0,n):new t(r.east,r.south)},u.center=function(r,n){var o=r.east,i=r.west;i>o&&(o+=s.TWO_PI);var a=s.negativePiToPi(.5*(i+o)),u=.5*(r.south+r.north);return e(n)?(n.longitude=a,n.latitude=u,n.height=0,n):new t(a,u)},u.intersection=function(t,r,n){var o=t.east,i=t.west,a=r.east,l=r.west;i>o&&a>0?o+=s.TWO_PI:l>a&&o>0&&(a+=s.TWO_PI),i>o&&0>l?l+=s.TWO_PI:l>a&&0>i&&(i+=s.TWO_PI);var c=s.negativePiToPi(Math.max(i,l)),f=s.negativePiToPi(Math.min(o,a));if((t.west<t.east||r.west<r.east)&&c>=f)return void 0;var h=Math.max(t.south,r.south),d=Math.min(t.north,r.north);return h>=d?void 0:e(n)?(n.west=c,n.south=h,n.east=f,n.north=d,n):new u(c,h,f,d)},u.contains=function(t,r){var e=r.longitude,n=r.latitude,o=t.west,i=t.east;return o>i&&(i+=s.TWO_PI,0>e&&(e+=s.TWO_PI)),(e>o||s.equalsEpsilon(e,o,s.EPSILON14))&&(i>e||s.equalsEpsilon(e,i,s.EPSILON14))&&n>=t.south&&n<=t.north};var l=new t;return u.subsample=function(t,n,o,a){n=r(n,i.WGS84),o=r(o,0),e(a)||(a=[]);var c=0,f=t.north,h=t.south,d=t.east,m=t.west,p=l;p.height=o,p.longitude=m,p.latitude=f,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.longitude=d,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.latitude=h,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.longitude=m,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.latitude=0>f?f:h>0?h:0;for(var g=1;8>g;++g)p.longitude=-Math.PI+g*s.PI_OVER_TWO,u.contains(t,p)&&(a[c]=n.cartographicToCartesian(p,a[c]),c++);return 0===p.latitude&&(p.longitude=m,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.longitude=d,a[c]=n.cartographicToCartesian(p,a[c]),c++),a.length=c,a},u.MAX_VALUE=a(new u(-Math.PI,-s.PI_OVER_TWO,Math.PI,s.PI_OVER_TWO)),u}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,r,e,n,o,i,a,s,u,l,c,f,h){"use strict";var d=function(r,n){this.center=t.clone(e(r,t.ZERO)),this.radius=e(n,0)},m=new t,p=new t,g=new t,E=new t,y=new t,v=new t,S=new t,C=new t,w=new t,M=new t,R=new t,A=new t;d.fromPoints=function(r,e){if(n(e)||(e=new d),!n(r)||0===r.length)return e.center=t.clone(t.ZERO,e.center),e.radius=0,e;for(var o=t.clone(r[0],S),i=t.clone(o,m),a=t.clone(o,p),s=t.clone(o,g),u=t.clone(o,E),l=t.clone(o,y),c=t.clone(o,v),f=r.length,h=1;f>h;h++){t.clone(r[h],o);var O=o.x,T=o.y,I=o.z;O<i.x&&t.clone(o,i),O>u.x&&t.clone(o,u),T<a.y&&t.clone(o,a),T>l.y&&t.clone(o,l),I<s.z&&t.clone(o,s),I>c.z&&t.clone(o,c)}var N=t.magnitudeSquared(t.subtract(u,i,C)),x=t.magnitudeSquared(t.subtract(l,a,C)),_=t.magnitudeSquared(t.subtract(c,s,C)),L=i,P=u,b=N;x>b&&(b=x,L=a,P=l),_>b&&(b=_,L=s,P=c);var F=w;F.x=.5*(L.x+P.x),F.y=.5*(L.y+P.y),F.z=.5*(L.z+P.z);var D=t.magnitudeSquared(t.subtract(P,F,C)),z=Math.sqrt(D),B=M;B.x=i.x,B.y=a.y,B.z=s.z;var U=R;U.x=u.x,U.y=l.y,U.z=c.z;var q=t.multiplyByScalar(t.add(B,U,C),.5,A),G=0;for(h=0;f>h;h++){t.clone(r[h],o);var W=t.magnitude(t.subtract(o,q,C));W>G&&(G=W);var Y=t.magnitudeSquared(t.subtract(o,F,C));if(Y>D){var H=Math.sqrt(Y);z=.5*(z+H),D=z*z;var V=H-z;F.x=(z*F.x+V*o.x)/H,F.y=(z*F.y+V*o.y)/H,F.z=(z*F.z+V*o.z)/H}}return G>z?(t.clone(F,e.center),e.radius=z):(t.clone(q,e.center),e.radius=G),e};var O=new s,T=new t,I=new t,N=new r,x=new r;d.fromRectangle2D=function(t,r,e){return d.fromRectangleWithHeights2D(t,r,0,0,e)},d.fromRectangleWithHeights2D=function(r,o,i,a,s){if(n(s)||(s=new d),!n(r))return s.center=t.clone(t.ZERO,s.center),s.radius=0,s;o=e(o,O),h.southwest(r,N),N.height=i,h.northeast(r,x),x.height=a;var u=o.project(N,T),l=o.project(x,I),c=l.x-u.x,f=l.y-u.y,m=l.z-u.z;s.radius=.5*Math.sqrt(c*c+f*f+m*m);var p=s.center;return p.x=u.x+.5*c,p.y=u.y+.5*f,p.z=u.z+.5*m,s};var _=[];d.fromRectangle3D=function(t,r,o,i){r=e(r,a.WGS84),o=e(o,0);var s;return n(t)&&(s=h.subsample(t,r,o,_)),d.fromPoints(s,i)},d.fromVertices=function(r,o,i,a){if(n(a)||(a=new d),!n(r)||0===r.length)return a.center=t.clone(t.ZERO,a.center),a.radius=0,a;o=e(o,t.ZERO),i=e(i,3);var s=S;s.x=r[0]+o.x,s.y=r[1]+o.y,s.z=r[2]+o.z;for(var u=t.clone(s,m),l=t.clone(s,p),c=t.clone(s,g),f=t.clone(s,E),h=t.clone(s,y),O=t.clone(s,v),T=r.length,I=0;T>I;I+=i){var N=r[I]+o.x,x=r[I+1]+o.y,_=r[I+2]+o.z;s.x=N,s.y=x,s.z=_,N<u.x&&t.clone(s,u),N>f.x&&t.clone(s,f),x<l.y&&t.clone(s,l),x>h.y&&t.clone(s,h),_<c.z&&t.clone(s,c),_>O.z&&t.clone(s,O)}var L=t.magnitudeSquared(t.subtract(f,u,C)),P=t.magnitudeSquared(t.subtract(h,l,C)),b=t.magnitudeSquared(t.subtract(O,c,C)),F=u,D=f,z=L;P>z&&(z=P,F=l,D=h),b>z&&(z=b,F=c,D=O);var B=w;B.x=.5*(F.x+D.x),B.y=.5*(F.y+D.y),B.z=.5*(F.z+D.z);var U=t.magnitudeSquared(t.subtract(D,B,C)),q=Math.sqrt(U),G=M;G.x=u.x,G.y=l.y,G.z=c.z;var W=R;W.x=f.x,W.y=h.y,W.z=O.z;var Y=t.multiplyByScalar(t.add(G,W,C),.5,A),H=0;for(I=0;T>I;I+=i){s.x=r[I]+o.x,s.y=r[I+1]+o.y,s.z=r[I+2]+o.z;var V=t.magnitude(t.subtract(s,Y,C));V>H&&(H=V);var k=t.magnitudeSquared(t.subtract(s,B,C));if(k>U){var K=Math.sqrt(k);q=.5*(q+K),U=q*q;var j=K-q;B.x=(q*B.x+j*s.x)/K,B.y=(q*B.y+j*s.y)/K,B.z=(q*B.z+j*s.z)/K}}return H>q?(t.clone(B,a.center),a.radius=q):(t.clone(Y,a.center),a.radius=H),a},d.fromCornerPoints=function(r,e,o){n(o)||(o=new d);var i=o.center;return t.add(r,e,i),t.multiplyByScalar(i,.5,i),o.radius=t.distance(i,e),o},d.fromEllipsoid=function(r,e){return n(e)||(e=new d),t.clone(t.ZERO,e.center),e.radius=r.maximumRadius,e};var L=new t;d.fromBoundingSpheres=function(r,e){if(n(e)||(e=new d),!n(r)||0===r.length)return e.center=t.clone(t.ZERO,e.center),e.radius=0,e;var o=r.length;if(1===o)return d.clone(r[0],e);if(2===o)return d.union(r[0],r[1],e);for(var i=[],a=0;o>a;a++)i.push(r[a].center);e=d.fromPoints(i,e);var s=e.center,u=e.radius;for(a=0;o>a;a++){var l=r[a];u=Math.max(u,t.distance(s,l.center,L)+l.radius)}return e.radius=u,e},d.clone=function(r,e){return n(r)?n(e)?(e.center=t.clone(r.center,e.center),e.radius=r.radius,e):new d(r.center,r.radius):void 0},d.packedLength=4,d.pack=function(t,r,n){n=e(n,0);var o=t.center;r[n++]=o.x,r[n++]=o.y,r[n++]=o.z,r[n]=t.radius},d.unpack=function(t,r,o){r=e(r,0),n(o)||(o=new d);var i=o.center;return i.x=t[r++],i.y=t[r++],i.z=t[r++],o.radius=t[r],o};var P=new t,b=new t;d.union=function(r,e,o){n(o)||(o=new d);var i=r.center,a=r.radius,s=e.center,u=e.radius,l=t.subtract(s,i,P),c=t.magnitude(l);if(a>=c+u)return r.clone(o),o;if(u>=c+a)return e.clone(o),o;var f=.5*(a+c+u),h=t.multiplyByScalar(l,(-a+f)/c,b);return t.add(h,i,h),t.clone(h,o.center),o.radius=f,o};var F=new t;d.expand=function(r,e,n){n=d.clone(r,n);var o=t.magnitude(t.subtract(e,n.center,F));return o>n.radius&&(n.radius=o),n},d.intersectPlane=function(r,e){var n=r.center,o=r.radius,i=e.normal,a=t.dot(i,n)+e.distance;return-o>a?u.OUTSIDE:o>a?u.INTERSECTING:u.INSIDE};var D=new f(new t,0);d.intersect=function(t,r){o("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var e=f.fromCartesian4(r,D);return d.intersectPlane(t,e)},d.transform=function(t,r,e){return n(e)||(e=new d),e.center=c.multiplyByPoint(r,t.center,e.center),e.radius=c.getMaximumScale(r)*t.radius,e};var z=new t;d.distanceSquaredTo=function(r,e){var n=t.subtract(r.center,e,z);return t.magnitudeSquared(n)-r.radius*r.radius},d.transformWithoutScale=function(t,r,e){return n(e)||(e=new d),e.center=c.multiplyByPoint(r,t.center,e.center),e.radius=t.radius,e};var B=new t;d.computePlaneDistances=function(r,e,o,i){n(i)||(i=new l);var a=t.subtract(r.center,e,B),s=t.multiplyByScalar(o,t.dot(o,a),B),u=t.magnitude(s);return i.start=u-r.radius,i.stop=u+r.radius,i};for(var U=new t,q=new t,G=new t,W=new t,Y=new t,H=new r,V=new Array(8),k=0;8>k;++k)V[k]=new t;var K=new s;return d.projectTo2D=function(r,n,o){n=e(n,K);var i=n.ellipsoid,a=r.center,s=r.radius,u=i.geodeticSurfaceNormal(a,U),l=t.cross(t.UNIT_Z,u,q);t.normalize(l,l);var c=t.cross(u,l,G);t.normalize(c,c),t.multiplyByScalar(u,s,u),t.multiplyByScalar(c,s,c),t.multiplyByScalar(l,s,l);var f=t.negate(c,Y),h=t.negate(l,W),m=V,p=m[0];t.add(u,c,p),t.add(p,l,p),p=m[1],t.add(u,c,p),t.add(p,h,p),p=m[2],t.add(u,f,p),t.add(p,h,p),p=m[3],t.add(u,f,p),t.add(p,l,p),t.negate(u,u),p=m[4],t.add(u,c,p),t.add(p,l,p),p=m[5],t.add(u,c,p),t.add(p,h,p),p=m[6],t.add(u,f,p),t.add(p,h,p),p=m[7],t.add(u,f,p),t.add(p,l,p);for(var g=m.length,E=0;g>E;++E){var y=m[E];t.add(a,y,y);var v=i.cartesianToCartographic(y,H);n.project(v,y)}o=d.fromPoints(m,o),a=o.center;var S=a.x,C=a.y,w=a.z;return a.x=w,a.y=S,a.z=C,o},d.equals=function(r,e){return r===e||n(r)&&n(e)&&t.equals(r.center,e.center)&&r.radius===e.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,r){"use strict";var e,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},o={};return r(o,{element:{get:function(){return o.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return o.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return o.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return o.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return o.supportsFullscreen()?null!==o.element:void 0}}}),o.supportsFullscreen=function(){if(t(e))return e;e=!1;var r=document.body;if("function"==typeof r.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",e=!0;for(var o,i=["webkit","moz","o","ms","khtml"],a=0,s=i.length;s>a;++a){var u=i[a];o=u+"RequestFullscreen","function"==typeof r[o]?(n.requestFullscreen=o,e=!0):(o=u+"RequestFullScreen","function"==typeof r[o]&&(n.requestFullscreen=o,e=!0)),o=u+"ExitFullscreen","function"==typeof document[o]?n.exitFullscreen=o:(o=u+"CancelFullScreen","function"==typeof document[o]&&(n.exitFullscreen=o)),o=u+"FullscreenEnabled",t(document[o])?n.fullscreenEnabled=o:(o=u+"FullScreenEnabled",t(document[o])&&(n.fullscreenEnabled=o)),o=u+"FullscreenElement",t(document[o])?n.fullscreenElement=o:(o=u+"FullScreenElement",t(document[o])&&(n.fullscreenElement=o)),o=u+"fullscreenchange",t(document["on"+o])&&("ms"===u&&(o="MSFullscreenChange"),n.fullscreenchange=o),o=u+"fullscreenerror",t(document["on"+o])&&("ms"===u&&(o="MSFullscreenError"),n.fullscreenerror=o)}return e},o.requestFullscreen=function(t){o.supportsFullscreen()&&t[n.requestFullscreen]()},o.exitFullscreen=function(){o.supportsFullscreen()&&document[n.exitFullscreen]()},o}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,r,e){"use strict";function n(t){for(var r=t.split("."),e=0,n=r.length;n>e;++e)r[e]=parseInt(r[e],10);return r}function o(){if(!r(g)){g=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(g=!0,E=n(t[1]))}return g}function i(){return o()&&E}function a(){if(!r(y)&&(y=!1,!o()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(y=!0,v=n(t[1]))}return y}function s(){return a()&&v}function u(){if(!r(S)){S=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(S=!0,C=n(t[1]),C.isNightly=!!t[2])}return S}function l(){return u()&&C}function c(){if(!r(w)){w=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(w=!0,M=n(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(w=!0,M=n(t[1])))}return w}function f(){return c()&&M}function h(){if(!r(R)){R=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(R=!0,A=n(t[1]))}return R}function d(){return r(O)||(O=/Windows/i.test(navigator.appVersion)),O}function m(){return h()&&A}function p(){return r(T)||(T=r(window.PointerEvent)&&(!r(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var g,E,y,v,S,C,w,M,R,A,O,T,I={isChrome:o,chromeVersion:i,isSafari:a,safariVersion:s,isWebkit:u,webkitVersion:l,isInternetExplorer:c,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return I.supportsFullscreen=function(){return e.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/Color",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math"],function(t,r,e,n,o,i){"use strict";function a(t,r,e){return 0>e&&(e+=1),e>1&&(e-=1),1>6*e?t+6*(r-t)*e:1>2*e?r:2>3*e?t+6*(r-t)*(2/3-e):t}var s=function(r,e,n,o){this.red=t(r,1),this.green=t(e,1),this.blue=t(n,1),this.alpha=t(o,1)};s.fromCartesian4=function(t,e){return r(e)?(e.red=t.x,e.green=t.y,e.blue=t.z,e.alpha=t.w,e):new s(t.x,t.y,t.z,t.w)},s.fromBytes=function(e,n,o,i,a){return e=s.byteToFloat(t(e,255)),n=s.byteToFloat(t(n,255)),o=s.byteToFloat(t(o,255)),i=s.byteToFloat(t(i,255)),r(a)?(a.red=e,a.green=n,a.blue=o,a.alpha=i,a):new s(e,n,o,i)},s.fromAlpha=function(t,e,n){return r(n)?(n.red=t.red,n.green=t.green,n.blue=t.blue,n.alpha=e,n):new s(t.red,t.green,t.blue,e)};var u,l,c;n.supportsTypedArrays()&&(u=new ArrayBuffer(4),l=new Uint32Array(u),c=new Uint8Array(u)),s.fromRgba=function(t){return l[0]=t,s.fromBytes(c[0],c[1],c[2],c[3])},s.fromHsl=function(r,e,n,o){r=t(r,0)%1,e=t(e,0),n=t(n,0),o=t(o,1);var i=n,u=n,l=n;if(0!==e){var c;c=.5>n?n*(1+e):n+e-n*e;var f=2*n-c;i=a(f,c,r+1/3),u=a(f,c,r),l=a(f,c,r-1/3)}return new s(i,u,l,o)},s.fromRandom=function(e,n){e=t(e,t.EMPTY_OBJECT);var o=e.red;if(!r(o)){var a=t(e.minimumRed,0),u=t(e.maximumRed,1);o=a+i.nextRandomNumber()*(u-a)}var l=e.green;if(!r(l)){var c=t(e.minimumGreen,0),f=t(e.maximumGreen,1);l=c+i.nextRandomNumber()*(f-c)}var h=e.blue;if(!r(h)){var d=t(e.minimumBlue,0),m=t(e.maximumBlue,1);h=d+i.nextRandomNumber()*(m-d)}var p=e.alpha;if(!r(p)){var g=t(e.minimumAlpha,0),E=t(e.maximumAlpha,1);p=g+i.nextRandomNumber()*(E-g)}return r(n)?(n.red=o,n.green=l,n.blue=h,n.alpha=p,n):new s(o,l,h,p)};var f=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,h=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,d=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,m=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;return s.fromCssColorString=function(e){var n=s[e.toUpperCase()];if(r(n))return s.clone(n);var o=f.exec(e);return null!==o?new s(parseInt(o[1],16)/15,parseInt(o[2],16)/15,parseInt(o[3],16)/15):(o=h.exec(e),null!==o?new s(parseInt(o[1],16)/255,parseInt(o[2],16)/255,parseInt(o[3],16)/255):(o=d.exec(e),null!==o?new s(parseFloat(o[1])/("%"===o[1].substr(-1)?100:255),parseFloat(o[2])/("%"===o[2].substr(-1)?100:255),parseFloat(o[3])/("%"===o[3].substr(-1)?100:255),parseFloat(t(o[4],"1.0"))):(o=m.exec(e),null!==o?s.fromHsl(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,parseFloat(t(o[4],"1.0"))):void 0)))},s.packedLength=4,s.pack=function(r,e,n){n=t(n,0),e[n++]=r.red,e[n++]=r.green,e[n++]=r.blue,e[n]=r.alpha},s.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new s),o.red=e[n++],o.green=e[n++],o.blue=e[n++],o.alpha=e[n],o},s.byteToFloat=function(t){return t/255},s.floatToByte=function(t){return 1===t?255:0|256*t},s.clone=function(t,e){return r(t)?r(e)?(e.red=t.red,e.green=t.green,e.blue=t.blue,e.alpha=t.alpha,e):new s(t.red,t.green,t.blue,t.alpha):void 0},s.equals=function(t,e){return t===e||r(t)&&r(e)&&t.red===e.red&&t.green===e.green&&t.blue===e.blue&&t.alpha===e.alpha},s.equalsArray=function(t,r,e){return t.red===r[e]&&t.green===r[e+1]&&t.blue===r[e+2]&&t.alpha===r[e+3]},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.prototype.equalsEpsilon=function(t,e){return this===t||r(t)&&Math.abs(this.red-t.red)<=e&&Math.abs(this.green-t.green)<=e&&Math.abs(this.blue-t.blue)<=e&&Math.abs(this.alpha-t.alpha)<=e},s.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},s.prototype.toCssColorString=function(){var t=s.floatToByte(this.red),r=s.floatToByte(this.green),e=s.floatToByte(this.blue);return 1===this.alpha?"rgb("+t+","+r+","+e+")":"rgba("+t+","+r+","+e+","+this.alpha+")"},s.prototype.toBytes=function(t){var e=s.floatToByte(this.red),n=s.floatToByte(this.green),o=s.floatToByte(this.blue),i=s.floatToByte(this.alpha);return r(t)?(t[0]=e,t[1]=n,t[2]=o,t[3]=i,t):[e,n,o,i]},s.prototype.toRgba=function(){return c[0]=s.floatToByte(this.red),c[1]=s.floatToByte(this.green),c[2]=s.floatToByte(this.blue),c[3]=s.floatToByte(this.alpha),l[0]},s.prototype.brighten=function(t,r){return t=1-t,r.red=1-(1-this.red)*t,r.green=1-(1-this.green)*t,r.blue=1-(1-this.blue)*t,r.alpha=this.alpha,r},s.prototype.darken=function(t,r){return t=1-t,r.red=this.red*t,r.green=this.green*t,r.blue=this.blue*t,r.alpha=this.alpha,r},s.prototype.withAlpha=function(t,r){return s.fromAlpha(this,t,r)},s.ALICEBLUE=o(s.fromCssColorString("#F0F8FF")),s.ANTIQUEWHITE=o(s.fromCssColorString("#FAEBD7")),s.AQUA=o(s.fromCssColorString("#00FFFF")),s.AQUAMARINE=o(s.fromCssColorString("#7FFFD4")),s.AZURE=o(s.fromCssColorString("#F0FFFF")),s.BEIGE=o(s.fromCssColorString("#F5F5DC")),s.BISQUE=o(s.fromCssColorString("#FFE4C4")),s.BLACK=o(s.fromCssColorString("#000000")),s.BLANCHEDALMOND=o(s.fromCssColorString("#FFEBCD")),s.BLUE=o(s.fromCssColorString("#0000FF")),s.BLUEVIOLET=o(s.fromCssColorString("#8A2BE2")),s.BROWN=o(s.fromCssColorString("#A52A2A")),s.BURLYWOOD=o(s.fromCssColorString("#DEB887")),s.CADETBLUE=o(s.fromCssColorString("#5F9EA0")),s.CHARTREUSE=o(s.fromCssColorString("#7FFF00")),s.CHOCOLATE=o(s.fromCssColorString("#D2691E")),s.CORAL=o(s.fromCssColorString("#FF7F50")),s.CORNFLOWERBLUE=o(s.fromCssColorString("#6495ED")),s.CORNSILK=o(s.fromCssColorString("#FFF8DC")),s.CRIMSON=o(s.fromCssColorString("#DC143C")),s.CYAN=o(s.fromCssColorString("#00FFFF")),s.DARKBLUE=o(s.fromCssColorString("#00008B")),s.DARKCYAN=o(s.fromCssColorString("#008B8B")),s.DARKGOLDENROD=o(s.fromCssColorString("#B8860B")),s.DARKGRAY=o(s.fromCssColorString("#A9A9A9")),s.DARKGREEN=o(s.fromCssColorString("#006400")),s.DARKGREY=s.DARKGRAY,s.DARKKHAKI=o(s.fromCssColorString("#BDB76B")),s.DARKMAGENTA=o(s.fromCssColorString("#8B008B")),s.DARKOLIVEGREEN=o(s.fromCssColorString("#556B2F")),s.DARKORANGE=o(s.fromCssColorString("#FF8C00")),s.DARKORCHID=o(s.fromCssColorString("#9932CC")),s.DARKRED=o(s.fromCssColorString("#8B0000")),s.DARKSALMON=o(s.fromCssColorString("#E9967A")),s.DARKSEAGREEN=o(s.fromCssColorString("#8FBC8F")),s.DARKSLATEBLUE=o(s.fromCssColorString("#483D8B")),s.DARKSLATEGRAY=o(s.fromCssColorString("#2F4F4F")),s.DARKSLATEGREY=s.DARKSLATEGRAY,s.DARKTURQUOISE=o(s.fromCssColorString("#00CED1")),s.DARKVIOLET=o(s.fromCssColorString("#9400D3")),s.DEEPPINK=o(s.fromCssColorString("#FF1493")),s.DEEPSKYBLUE=o(s.fromCssColorString("#00BFFF")),s.DIMGRAY=o(s.fromCssColorString("#696969")),s.DIMGREY=s.DIMGRAY,s.DODGERBLUE=o(s.fromCssColorString("#1E90FF")),s.FIREBRICK=o(s.fromCssColorString("#B22222")),s.FLORALWHITE=o(s.fromCssColorString("#FFFAF0")),s.FORESTGREEN=o(s.fromCssColorString("#228B22")),s.FUSCHIA=o(s.fromCssColorString("#FF00FF")),s.GAINSBORO=o(s.fromCssColorString("#DCDCDC")),s.GHOSTWHITE=o(s.fromCssColorString("#F8F8FF")),s.GOLD=o(s.fromCssColorString("#FFD700")),s.GOLDENROD=o(s.fromCssColorString("#DAA520")),s.GRAY=o(s.fromCssColorString("#808080")),s.GREEN=o(s.fromCssColorString("#008000")),s.GREENYELLOW=o(s.fromCssColorString("#ADFF2F")),s.GREY=s.GRAY,s.HONEYDEW=o(s.fromCssColorString("#F0FFF0")),s.HOTPINK=o(s.fromCssColorString("#FF69B4")),s.INDIANRED=o(s.fromCssColorString("#CD5C5C")),s.INDIGO=o(s.fromCssColorString("#4B0082")),s.IVORY=o(s.fromCssColorString("#FFFFF0")),s.KHAKI=o(s.fromCssColorString("#F0E68C")),s.LAVENDER=o(s.fromCssColorString("#E6E6FA")),s.LAVENDAR_BLUSH=o(s.fromCssColorString("#FFF0F5")),s.LAWNGREEN=o(s.fromCssColorString("#7CFC00")),s.LEMONCHIFFON=o(s.fromCssColorString("#FFFACD")),s.LIGHTBLUE=o(s.fromCssColorString("#ADD8E6")),s.LIGHTCORAL=o(s.fromCssColorString("#F08080")),s.LIGHTCYAN=o(s.fromCssColorString("#E0FFFF")),s.LIGHTGOLDENRODYELLOW=o(s.fromCssColorString("#FAFAD2")),s.LIGHTGRAY=o(s.fromCssColorString("#D3D3D3")),s.LIGHTGREEN=o(s.fromCssColorString("#90EE90")),s.LIGHTGREY=s.LIGHTGRAY,s.LIGHTPINK=o(s.fromCssColorString("#FFB6C1")),s.LIGHTSEAGREEN=o(s.fromCssColorString("#20B2AA")),s.LIGHTSKYBLUE=o(s.fromCssColorString("#87CEFA")),s.LIGHTSLATEGRAY=o(s.fromCssColorString("#778899")),s.LIGHTSLATEGREY=s.LIGHTSLATEGRAY,s.LIGHTSTEELBLUE=o(s.fromCssColorString("#B0C4DE")),s.LIGHTYELLOW=o(s.fromCssColorString("#FFFFE0")),s.LIME=o(s.fromCssColorString("#00FF00")),s.LIMEGREEN=o(s.fromCssColorString("#32CD32")),s.LINEN=o(s.fromCssColorString("#FAF0E6")),s.MAGENTA=o(s.fromCssColorString("#FF00FF")),s.MAROON=o(s.fromCssColorString("#800000")),s.MEDIUMAQUAMARINE=o(s.fromCssColorString("#66CDAA")),s.MEDIUMBLUE=o(s.fromCssColorString("#0000CD")),s.MEDIUMORCHID=o(s.fromCssColorString("#BA55D3")),s.MEDIUMPURPLE=o(s.fromCssColorString("#9370DB")),s.MEDIUMSEAGREEN=o(s.fromCssColorString("#3CB371")),s.MEDIUMSLATEBLUE=o(s.fromCssColorString("#7B68EE")),s.MEDIUMSPRINGGREEN=o(s.fromCssColorString("#00FA9A")),s.MEDIUMTURQUOISE=o(s.fromCssColorString("#48D1CC")),s.MEDIUMVIOLETRED=o(s.fromCssColorString("#C71585")),s.MIDNIGHTBLUE=o(s.fromCssColorString("#191970")),s.MINTCREAM=o(s.fromCssColorString("#F5FFFA")),s.MISTYROSE=o(s.fromCssColorString("#FFE4E1")),s.MOCCASIN=o(s.fromCssColorString("#FFE4B5")),s.NAVAJOWHITE=o(s.fromCssColorString("#FFDEAD")),s.NAVY=o(s.fromCssColorString("#000080")),s.OLDLACE=o(s.fromCssColorString("#FDF5E6")),s.OLIVE=o(s.fromCssColorString("#808000")),s.OLIVEDRAB=o(s.fromCssColorString("#6B8E23")),s.ORANGE=o(s.fromCssColorString("#FFA500")),s.ORANGERED=o(s.fromCssColorString("#FF4500")),s.ORCHID=o(s.fromCssColorString("#DA70D6")),s.PALEGOLDENROD=o(s.fromCssColorString("#EEE8AA")),s.PALEGREEN=o(s.fromCssColorString("#98FB98")),s.PALETURQUOISE=o(s.fromCssColorString("#AFEEEE")),s.PALEVIOLETRED=o(s.fromCssColorString("#DB7093")),s.PAPAYAWHIP=o(s.fromCssColorString("#FFEFD5")),s.PEACHPUFF=o(s.fromCssColorString("#FFDAB9")),s.PERU=o(s.fromCssColorString("#CD853F")),s.PINK=o(s.fromCssColorString("#FFC0CB")),s.PLUM=o(s.fromCssColorString("#DDA0DD")),s.POWDERBLUE=o(s.fromCssColorString("#B0E0E6")),s.PURPLE=o(s.fromCssColorString("#800080")),s.RED=o(s.fromCssColorString("#FF0000")),s.ROSYBROWN=o(s.fromCssColorString("#BC8F8F")),s.ROYALBLUE=o(s.fromCssColorString("#4169E1")),s.SADDLEBROWN=o(s.fromCssColorString("#8B4513")),s.SALMON=o(s.fromCssColorString("#FA8072")),s.SANDYBROWN=o(s.fromCssColorString("#F4A460")),s.SEAGREEN=o(s.fromCssColorString("#2E8B57")),s.SEASHELL=o(s.fromCssColorString("#FFF5EE")),s.SIENNA=o(s.fromCssColorString("#A0522D")),s.SILVER=o(s.fromCssColorString("#C0C0C0")),s.SKYBLUE=o(s.fromCssColorString("#87CEEB")),s.SLATEBLUE=o(s.fromCssColorString("#6A5ACD")),s.SLATEGRAY=o(s.fromCssColorString("#708090")),s.SLATEGREY=s.SLATEGRAY,s.SNOW=o(s.fromCssColorString("#FFFAFA")),s.SPRINGGREEN=o(s.fromCssColorString("#00FF7F")),s.STEELBLUE=o(s.fromCssColorString("#4682B4")),s.TAN=o(s.fromCssColorString("#D2B48C")),s.TEAL=o(s.fromCssColorString("#008080")),s.THISTLE=o(s.fromCssColorString("#D8BFD8")),s.TOMATO=o(s.fromCssColorString("#FF6347")),s.TURQUOISE=o(s.fromCssColorString("#40E0D0")),s.VIOLET=o(s.fromCssColorString("#EE82EE")),s.WHEAT=o(s.fromCssColorString("#F5DEB3")),s.WHITE=o(s.fromCssColorString("#FFFFFF")),s.WHITESMOKE=o(s.fromCssColorString("#F5F5F5")),s.YELLOW=o(s.fromCssColorString("#FFFF00")),s.YELLOWGREEN=o(s.fromCssColorString("#9ACD32")),s.TRANSPARENT=o(new s(0,0,0,0)),s -}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,r,e,n,o){"use strict";if(!n.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(t){switch(t){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new e("componentDatatype is not a valid value.")}},i.fromTypedArray=function(t){return t instanceof Int8Array?i.BYTE:t instanceof Uint8Array?i.UNSIGNED_BYTE:t instanceof Int16Array?i.SHORT:t instanceof Uint16Array?i.UNSIGNED_SHORT:t instanceof Float32Array?i.FLOAT:t instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(t){return r(t)&&(t===i.BYTE||t===i.UNSIGNED_BYTE||t===i.SHORT||t===i.UNSIGNED_SHORT||t===i.FLOAT||t===i.DOUBLE)},i.createTypedArray=function(t,r){switch(t){case i.BYTE:return new Int8Array(r);case i.UNSIGNED_BYTE:return new Uint8Array(r);case i.SHORT:return new Int16Array(r);case i.UNSIGNED_SHORT:return new Uint16Array(r);case i.FLOAT:return new Float32Array(r);case i.DOUBLE:return new Float64Array(r);default:throw new e("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(r,n,o,a){switch(o=t(o,0),a=t(a,(n.byteLength-o)/i.getSizeInBytes(r)),r){case i.BYTE:return new Int8Array(n,o,a);case i.UNSIGNED_BYTE:return new Uint8Array(n,o,a);case i.SHORT:return new Int16Array(n,o,a);case i.UNSIGNED_SHORT:return new Uint16Array(n,o,a);case i.FLOAT:return new Float32Array(n,o,a);case i.DOUBLE:return new Float64Array(n,o,a);default:throw new e("componentDatatype is not a valid value.")}},o(i)}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var r={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(r)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var r={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===r.POINTS||t===r.LINES||t===r.LINE_LOOP||t===r.LINE_STRIP||t===r.TRIANGLES||t===r.TRIANGLE_STRIP||t===r.TRIANGLE_FAN}};return t(r)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,r,e,n,o){"use strict";var i=function(r){r=t(r,t.EMPTY_OBJECT),this.attributes=r.attributes,this.indices=r.indices,this.primitiveType=t(r.primitiveType,o.TRIANGLES),this.boundingSphere=r.boundingSphere,this.geometryType=t(r.geometryType,n.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(t){var n=-1;for(var o in t.attributes)if(t.attributes.hasOwnProperty(o)&&r(t.attributes[o])&&r(t.attributes[o].values)){var i=t.attributes[o],a=i.values.length/i.componentsPerAttribute;if(n!==a&&-1!==n)throw new e("All attribute lists must have the same number of attributes.");n=a}return n},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var r=function(r){r=t(r,t.EMPTY_OBJECT),this.componentDatatype=r.componentDatatype,this.componentsPerAttribute=r.componentsPerAttribute,this.normalize=t(r.normalize,!1),this.values=r.values};return r}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var r=function(r){r=t(r,t.EMPTY_OBJECT),this.position=r.position,this.normal=r.normal,this.st=r.st,this.binormal=r.binormal,this.tangent=r.tangent,this.color=r.color};return r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n){"use strict";var o={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return o.getSizeInBytes=function(t){switch(t){case o.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case o.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case o.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},o.validate=function(r){return t(r)&&(r===o.UNSIGNED_BYTE||r===o.UNSIGNED_SHORT||r===o.UNSIGNED_INT)},o.createTypedArray=function(t,r){return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(r):new Uint16Array(r)},o.createTypedArrayFromArrayBuffer=function(t,r,e,o){return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(r,e,o):new Uint16Array(r,e,o)},e(o)}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(t,r,e,n,o,i,a,s){"use strict";function u(t){var r=t._uSquared,e=t._ellipsoid.maximumRadius,n=t._ellipsoid.minimumRadius,o=(e-n)/e,i=Math.cos(t._startHeading),a=Math.sin(t._startHeading),s=(1-o)*Math.tan(t._start.latitude),u=1/Math.sqrt(1+s*s),l=u*s,c=Math.atan2(s,i),f=u*a,h=f*f,d=1-h,m=Math.sqrt(d),p=r/4,g=p*p,E=g*p,y=g*g,v=1+p-3*g/4+5*E/4-175*y/64,S=1-p+15*g/8-35*E/8,C=1-3*p+35*g/4,w=1-5*p,M=v*c-S*Math.sin(2*c)*p/2-C*Math.sin(4*c)*g/16-w*Math.sin(6*c)*E/48-5*Math.sin(8*c)*y/512,R=t._constants;R.a=e,R.b=n,R.f=o,R.cosineHeading=i,R.sineHeading=a,R.tanU=s,R.cosineU=u,R.sineU=l,R.sigma=c,R.sineAlpha=f,R.sineSquaredAlpha=h,R.cosineSquaredAlpha=d,R.cosineAlpha=m,R.u2Over4=p,R.u4Over16=g,R.u6Over64=E,R.u8Over256=y,R.a0=v,R.a1=S,R.a2=C,R.a3=w,R.distanceRatio=M}function l(t,r){return t*r*(4+t*(4-3*r))/16}function c(t,r,e,n,o,i,a){var s=l(t,e);return(1-s)*t*r*(n+s*o*(a+s*i*(2*a*a-1)))}function f(t,r,e,n,o,i,a){var u,l,f,h,d,m=(r-e)/r,p=i-n,g=Math.atan((1-m)*Math.tan(o)),E=Math.atan((1-m)*Math.tan(a)),y=Math.cos(g),v=Math.sin(g),S=Math.cos(E),C=Math.sin(E),w=y*S,M=y*C,R=v*C,A=v*S,O=p,T=s.TWO_PI,I=Math.cos(O),N=Math.sin(O);do{I=Math.cos(O),N=Math.sin(O);var x=M-A*I;f=Math.sqrt(S*S*N*N+x*x),l=R+w*I,u=Math.atan2(f,l);var _;0===f?(_=0,h=1):(_=w*N/f,h=1-_*_),T=O,d=l-2*R/h,isNaN(d)&&(d=0),O=p+c(m,_,h,u,f,l,d)}while(Math.abs(O-T)>s.EPSILON12);var L=h*(r*r-e*e)/(e*e),P=1+L*(4096+L*(L*(320-175*L)-768))/16384,b=L*(256+L*(L*(74-47*L)-128))/1024,F=d*d,D=b*f*(d+b*(l*(2*F-1)-b*d*(4*f*f-3)*(4*F-3)/6)/4),z=e*P*(u-D),B=Math.atan2(S*N,M-A*I),U=Math.atan2(y*N,M*I-A);t._distance=z,t._startHeading=B,t._endHeading=U,t._uSquared=L}function h(e,n,o,i){t.normalize(i.cartographicToCartesian(n,m),d),t.normalize(i.cartographicToCartesian(o,m),m),f(e,i.maximumRadius,i.minimumRadius,n.longitude,n.latitude,o.longitude,o.latitude),e._start=r.clone(n,e._start),e._end=r.clone(o,e._end),e._start.height=0,e._end.height=0,u(e)}var d=new t,m=new t,p=function(t,o,i){var s=e(i,a.WGS84);this._ellipsoid=s,this._start=new r,this._end=new r,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,n(t)&&n(o)&&h(this,t,o,s)};return o(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(t,r){h(this,t,r,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(t,r){return this.interpolateUsingSurfaceDistance(this._distance*t,r)},p.prototype.interpolateUsingSurfaceDistance=function(t,e){var o=this._constants,i=o.distanceRatio+t/o.b,a=Math.cos(2*i),s=Math.cos(4*i),u=Math.cos(6*i),l=Math.sin(2*i),f=Math.sin(4*i),h=Math.sin(6*i),d=Math.sin(8*i),m=i*i,p=i*m,g=o.u8Over256,E=o.u2Over4,y=o.u6Over64,v=o.u4Over16,S=2*p*g*a/3+i*(1-E+7*v/4-15*y/4+579*g/64-(v-15*y/4+187*g/16)*a-(5*y/4-115*g/16)*s-29*g*u/16)+(E/2-v+71*y/32-85*g/16)*l+(5*v/16-5*y/4+383*g/96)*f-m*((y-11*g/2)*l+5*g*f/2)+(29*y/96-29*g/16)*h+539*g*d/1536,C=Math.asin(Math.sin(S)*o.cosineAlpha),w=Math.atan(o.a/o.b*Math.tan(C));S-=o.sigma;var M=Math.cos(2*o.sigma+S),R=Math.sin(S),A=Math.cos(S),O=o.cosineU*A,T=o.sineU*R,I=Math.atan2(R*o.sineHeading,O-T*o.cosineHeading),N=I-c(o.f,o.sineAlpha,o.cosineSquaredAlpha,S,R,A,M);return n(e)?(e.longitude=this._start.longitude+N,e.latitude=w,e.height=0,e):new r(this._start.longitude+N,w,0)},p}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(t,r){"use strict";function e(t,e,n){var o=t+e;return r.sign(t)!==r.sign(e)&&Math.abs(o/Math.max(Math.abs(t),Math.abs(e)))<n?0:o}var n={};return n.computeDiscriminant=function(t,r,e){var n=r*r-4*t*e;return n},n.computeRealRoots=function(t,n,o){var i;if(0===t)return 0===n?[]:[-o/n];if(0===n){if(0===o)return[0,0];var a=Math.abs(o),s=Math.abs(t);if(s>a&&a/s<r.EPSILON14)return[0,0];if(a>s&&s/a<r.EPSILON14)return[];if(i=-o/t,0>i)return[];var u=Math.sqrt(i);return[-u,u]}if(0===o)return i=-n/t,0>i?[i,0]:[0,i];var l=n*n,c=4*t*o,f=e(l,-c,r.EPSILON14);if(0>f)return[];var h=-.5*e(n,r.sign(n)*Math.sqrt(f),r.EPSILON14);return n>0?[h/t,o/h]:[o/h,h/t]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(t,r){"use strict";function e(t,r,e,n){var o,i,a=t,s=r/3,u=e/3,l=n,c=a*u,f=s*l,h=s*s,d=u*u,m=a*u-h,p=a*l-s*u,g=s*l-d,E=4*m*g-p*p;if(0>E){var y,v,S;h*f>=c*d?(y=a,v=m,S=-2*s*m+a*p):(y=l,v=g,S=-l*p+2*u*g);var C=0>S?-1:1,w=-C*Math.abs(y)*Math.sqrt(-E);i=-S+w;var M=i/2,R=0>M?-Math.pow(-M,1/3):Math.pow(M,1/3),A=i===w?-R:-v/R;return o=0>=v?R+A:-S/(R*R+A*A+v),h*f>=c*d?[(o-s)/a]:[-l/(o+u)]}var O=m,T=-2*s*m+a*p,I=g,N=-l*p+2*u*g,x=Math.sqrt(E),_=Math.sqrt(3)/2,L=Math.abs(Math.atan2(a*x,-T)/3);o=2*Math.sqrt(-O);var P=Math.cos(L);i=o*P;var b=o*(-P/2-_*Math.sin(L)),F=i+b>2*s?i-s:b-s,D=a,z=F/D;L=Math.abs(Math.atan2(l*x,-N)/3),o=2*Math.sqrt(-I),P=Math.cos(L),i=o*P,b=o*(-P/2-_*Math.sin(L));var B=-l,U=2*u>i+b?i+u:b+u,q=B/U,G=D*U,W=-F*U-D*B,Y=F*B,H=(u*W-s*Y)/(-s*W+u*G);return H>=z?q>=z?q>=H?[z,H,q]:[z,q,H]:[q,z,H]:q>=z?[H,z,q]:q>=H?[H,q,z]:[q,H,z]}var n={};return n.computeDiscriminant=function(t,r,e,n){var o=t*t,i=r*r,a=e*e,s=n*n,u=18*t*r*e*n+i*a-27*o*s-4*(t*a*e+i*r*n);return u},n.computeRealRoots=function(t,n,o,i){var a,s;if(0===t)return r.computeRealRoots(n,o,i);if(0===n){if(0===o){if(0===i)return[0,0,0];s=-i/t;var u=0>s?-Math.pow(-s,1/3):Math.pow(s,1/3);return[u,u,u]}return 0===i?(a=r.computeRealRoots(t,0,o),0===a.Length?[0]:[a[0],0,a[1]]):e(t,0,o,i)}return 0===o?0===i?(s=-n/t,0>s?[s,0,0]:[0,0,s]):e(t,n,0,i):0===i?(a=r.computeRealRoots(t,n,o),0===a.length?[0]:a[1]<=0?[a[0],a[1],0]:a[0]>=0?[0,a[0],a[1]]:[a[0],0,a[1]]):e(t,n,o,i)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(t,r,e,n){"use strict";function o(r,o,i,a){var s=r*r,u=o-3*s/8,l=i-o*r/2+s*r/8,c=a-i*r/4+o*s/16-3*s*s/256,f=t.computeRealRoots(1,2*u,u*u-4*c,-l*l);if(f.length>0){var h=-r/4,d=f[f.length-1];if(Math.abs(d)<e.EPSILON14){var m=n.computeRealRoots(1,u,c);if(2===m.length){var p,g=m[0],E=m[1];if(g>=0&&E>=0){var y=Math.sqrt(g),v=Math.sqrt(E);return[h-v,h-y,h+y,h+v]}if(g>=0&&0>E)return p=Math.sqrt(g),[h-p,h+p];if(0>g&&E>=0)return p=Math.sqrt(E),[h-p,h+p]}return[]}if(d>0){var S=Math.sqrt(d),C=(u+d-l/S)/2,w=(u+d+l/S)/2,M=n.computeRealRoots(1,S,C),R=n.computeRealRoots(1,-S,w);return 0!==M.length?(M[0]+=h,M[1]+=h,0!==R.length?(R[0]+=h,R[1]+=h,M[1]<=R[0]?[M[0],M[1],R[0],R[1]]:R[1]<=M[0]?[R[0],R[1],M[0],M[1]]:M[0]>=R[0]&&M[1]<=R[1]?[R[0],M[0],M[1],R[1]]:R[0]>=M[0]&&R[1]<=M[1]?[M[0],R[0],R[1],M[1]]:M[0]>R[0]&&M[0]<R[1]?[R[0],M[0],R[1],M[1]]:[M[0],R[0],M[1],R[1]]):M):0!==R.length?(R[0]+=h,R[1]+=h,R):[]}}return[]}function i(r,o,i,a){var s=i*i,u=o*o,l=r*r,c=-2*o,f=i*r+u-4*a,h=l*a-i*o*r+s,d=t.computeRealRoots(1,c,f,h);if(d.length>0){var m,p,g=d[0],E=o-g,y=E*E,v=r/2,S=E/2,C=y-4*a,w=y+4*Math.abs(a),M=l-4*g,R=l+4*Math.abs(g);if(0>g||M*w>C*R){var A=Math.sqrt(M);m=A/2,p=0===A?0:(r*S-i)/A}else{var O=Math.sqrt(C);m=0===O?0:(r*S-i)/O,p=O/2}var T,I;0===v&&0===m?(T=0,I=0):e.sign(v)===e.sign(m)?(T=v+m,I=g/T):(I=v-m,T=g/I);var N,x;0===S&&0===p?(N=0,x=0):e.sign(S)===e.sign(p)?(N=S+p,x=a/N):(x=S-p,N=a/x);var _=n.computeRealRoots(1,T,N),L=n.computeRealRoots(1,I,x);if(0!==_.length)return 0!==L.length?_[1]<=L[0]?[_[0],_[1],L[0],L[1]]:L[1]<=_[0]?[L[0],L[1],_[0],_[1]]:_[0]>=L[0]&&_[1]<=L[1]?[L[0],_[0],_[1],L[1]]:L[0]>=_[0]&&L[1]<=_[1]?[_[0],L[0],L[1],_[1]]:_[0]>L[0]&&_[0]<L[1]?[L[0],_[0],L[1],_[1]]:[_[0],L[0],_[1],L[1]]:_;if(0!==L.length)return L}return[]}var a={};return a.computeDiscriminant=function(t,r,e,n,o){var i=t*t,a=i*t,s=r*r,u=s*r,l=e*e,c=l*e,f=n*n,h=f*n,d=o*o,m=d*o,p=s*l*f-4*u*h-4*t*c*f+18*t*r*e*h-27*i*f*f+256*a*m+o*(18*u*e*n-4*s*c+16*t*l*l-80*t*r*l*n-6*t*s*f+144*i*e*f)+d*(144*t*s*e-27*s*s-128*i*l-192*i*r*n);return p},a.computeRealRoots=function(r,n,a,s,u){if(Math.abs(r)<e.EPSILON15)return t.computeRealRoots(n,a,s,u);var l=n/r,c=a/r,f=s/r,h=u/r,d=0>l?1:0;switch(d+=0>c?d+1:d,d+=0>f?d+1:d,d+=0>h?d+1:d){case 0:return o(l,c,f,h);case 1:return i(l,c,f,h);case 2:return i(l,c,f,h);case 3:return o(l,c,f,h);case 4:return o(l,c,f,h);case 5:return i(l,c,f,h);case 6:return o(l,c,f,h);case 7:return o(l,c,f,h);case 8:return i(l,c,f,h);case 9:return o(l,c,f,h);case 10:return o(l,c,f,h);case 11:return i(l,c,f,h);case 12:return o(l,c,f,h);case 13:return o(l,c,f,h);case 14:return o(l,c,f,h);case 15:return o(l,c,f,h);default:return void 0}},a}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(t,r,e){"use strict";var n=function(e,n){n=t.clone(r(n,t.ZERO)),t.equals(n,t.ZERO)||t.normalize(n,n),this.origin=t.clone(r(e,t.ZERO)),this.direction=n};return n.getPoint=function(r,n,o){return e(o)||(o=new t),o=t.multiplyByScalar(r.direction,n,o),t.add(r.origin,o,o)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(t,r,e,n,o,i,a,s,u,l){"use strict";function c(r,n,o,a,s){s=e(s,!1);var u,l,c,f,h,d=r.origin,m=r.direction,p=t.subtract(o,n,g),C=t.subtract(a,n,E),w=t.cross(m,C,y),M=t.dot(p,w);if(s){if(M<i.EPSILON6)return void 0;if(u=t.subtract(d,n,v),c=t.dot(u,w),0>c||c>M)return void 0;if(l=t.cross(u,p,S),f=t.dot(m,l),0>f||c+f>M)return void 0;h=t.dot(C,l)/M}else{if(Math.abs(M)<i.EPSILON6)return void 0;var R=1/M;if(u=t.subtract(d,n,v),c=t.dot(u,w)*R,0>c||c>1)return void 0;if(l=t.cross(u,p,S),f=t.dot(m,l)*R,0>f||c+f>1)return void 0;h=t.dot(C,l)*R}return h}function f(t,r,e,n){var o=r*r-4*t*e;if(0>o)return void 0;if(o>0){var i=1/(2*t),a=Math.sqrt(o),s=(-r+a)*i,u=(-r-a)*i;return u>s?(n.root0=s,n.root1=u):(n.root0=u,n.root1=s),n}var l=-r/(2*t);return 0===l?void 0:(n.root0=n.root1=l,n)}function h(r,e,o){n(o)||(o={});var i=r.origin,a=r.direction,s=e.center,u=e.radius*e.radius,l=t.subtract(i,s,y),c=t.dot(a,a),h=2*t.dot(a,l),d=t.magnitudeSquared(l)-u,m=f(c,h,d,w);return n(m)?(o.start=m.root0,o.stop=m.root1,o):void 0}function d(t,r,e){var n=t+r;return i.sign(t)!==i.sign(r)&&Math.abs(n/Math.max(Math.abs(t),Math.abs(r)))<e?0:n}function m(r,e,n,o,l){var c,f=o*o,h=l*l,m=(r[a.COLUMN1ROW1]-r[a.COLUMN2ROW2])*h,p=l*(o*d(r[a.COLUMN1ROW0],r[a.COLUMN0ROW1],i.EPSILON15)+e.y),g=r[a.COLUMN0ROW0]*f+r[a.COLUMN2ROW2]*h+o*e.x+n,E=h*d(r[a.COLUMN2ROW1],r[a.COLUMN1ROW2],i.EPSILON15),y=l*(o*d(r[a.COLUMN2ROW0],r[a.COLUMN0ROW2])+e.z),v=[];if(0===y&&0===E){if(c=s.computeRealRoots(m,p,g),0===c.length)return v;var S=c[0],C=Math.sqrt(Math.max(1-S*S,0));if(v.push(new t(o,l*S,l*-C)),v.push(new t(o,l*S,l*C)),2===c.length){var w=c[1],M=Math.sqrt(Math.max(1-w*w,0));v.push(new t(o,l*w,l*-M)),v.push(new t(o,l*w,l*M))}return v}var R=y*y,A=E*E,O=m*m,T=y*E,I=O+A,N=2*(p*m+T),x=2*g*m+p*p-A+R,_=2*(g*p-T),L=g*g-R;if(0===I&&0===N&&0===x&&0===_)return v;c=u.computeRealRoots(I,N,x,_,L);var P=c.length;if(0===P)return v;for(var b=0;P>b;++b){var F,D=c[b],z=D*D,B=Math.max(1-z,0),U=Math.sqrt(B);F=i.sign(m)===i.sign(g)?d(m*z+g,p*D,i.EPSILON12):i.sign(g)===i.sign(p*D)?d(m*z,p*D+g,i.EPSILON12):d(m*z+p*D,g,i.EPSILON12);var q=d(E*D,y,i.EPSILON15),G=F*q;0>G?v.push(new t(o,l*D,l*U)):G>0?v.push(new t(o,l*D,l*-U)):0!==U?(v.push(new t(o,l*D,l*-U)),v.push(new t(o,l*D,l*U)),++b):v.push(new t(o,l*D,l*U))}return v}var p={};p.rayPlane=function(r,e,o){n(o)||(o=new t);var a=r.origin,s=r.direction,u=e.normal,l=t.dot(u,s);if(Math.abs(l)<i.EPSILON15)return void 0;var c=(-e.distance-t.dot(u,a))/l;return 0>c?void 0:(o=t.multiplyByScalar(s,c,o),t.add(a,o,o))};var g=new t,E=new t,y=new t,v=new t,S=new t;p.rayTriangle=function(r,e,o,i,a,s){var u=c(r,e,o,i,a);return!n(u)||0>u?void 0:(n(s)||(s=new t),t.multiplyByScalar(r.direction,u,s),t.add(r.origin,s,s))};var C=new l;p.lineSegmentTriangle=function(r,e,o,i,a,s,u){var l=C;t.clone(r,l.origin),t.subtract(e,r,l.direction),t.normalize(l.direction,l.direction);var f=c(l,o,i,a,s);return!n(f)||0>f||f>t.distance(r,e)?void 0:(n(u)||(u=new t),t.multiplyByScalar(l.direction,f,u),t.add(l.origin,u,u))};var w={root0:0,root1:0};p.raySphere=function(t,r,e){return e=h(t,r,e),!n(e)||e.stop<0?void 0:(e.start=Math.max(e.start,0),e)};var M=new l;p.lineSegmentSphere=function(r,e,o,i){var a=M;t.clone(r,a.origin);var s=t.subtract(e,r,a.direction),u=t.magnitude(s);return t.normalize(s,s),i=h(a,o,i),!n(i)||i.stop<0||i.start>u?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,u),i)};var R=new t,A=new t;p.rayEllipsoid=function(r,e){var n,o,i,a,s,u=e.oneOverRadii,l=t.multiplyComponents(u,r.origin,R),c=t.multiplyComponents(u,r.direction,A),f=t.magnitudeSquared(l),h=t.dot(l,c);if(f>1){if(h>=0)return void 0;var d=h*h;if(n=f-1,o=t.magnitudeSquared(c),i=o*n,i>d)return void 0;if(d>i){a=h*h-i,s=-h+Math.sqrt(a);var m=s/o,p=n/s;return p>m?{start:m,stop:p}:{start:p,stop:m}}var g=Math.sqrt(n/o);return{start:g,stop:g}}return 1>f?(n=f-1,o=t.magnitudeSquared(c),i=o*n,a=h*h-i,s=-h+Math.sqrt(a),{start:0,stop:s/o}):0>h?(o=t.magnitudeSquared(c),{start:0,stop:-h/o}):void 0};var O=new t,T=new t,I=new t,N=new t,x=new t,_=new a,L=new a,P=new a,b=new a,F=new a,D=new a,z=new a,B=new t,U=new t,q=new r;p.grazingAltitudeLocation=function(r,e){var o=r.origin,s=r.direction,u=e.geodeticSurfaceNormal(o,O);if(t.dot(s,u)>=0)return o;var l=n(this.rayEllipsoid(r,e)),c=e.transformPositionToScaledSpace(s,O),f=t.normalize(c,c),h=t.mostOrthogonalAxis(c,N),d=t.normalize(t.cross(h,f,T),T),p=t.normalize(t.cross(f,d,I),I),g=_;g[0]=f.x,g[1]=f.y,g[2]=f.z,g[3]=d.x,g[4]=d.y,g[5]=d.z,g[6]=p.x,g[7]=p.y,g[8]=p.z;var E=a.transpose(g,L),y=a.fromScale(e.radii,P),v=a.fromScale(e.oneOverRadii,b),S=F;S[0]=0,S[1]=-s.z,S[2]=s.y,S[3]=s.z,S[4]=0,S[5]=-s.x,S[6]=-s.y,S[7]=s.x,S[8]=0;var C,w,M=a.multiply(a.multiply(E,v,D),S,D),R=a.multiply(a.multiply(M,y,z),g,z),A=a.multiplyByVector(M,o,x),G=m(R,t.negate(A,O),0,0,1),W=G.length;if(W>0){for(var Y=t.clone(t.ZERO,U),H=Number.NEGATIVE_INFINITY,V=0;W>V;++V){C=a.multiplyByVector(y,a.multiplyByVector(g,G[V],B),B);var k=t.normalize(t.subtract(C,o,N),N),K=t.dot(k,s);K>H&&(H=K,Y=t.clone(C,Y))}var j=e.cartesianToCartographic(Y,q);return H=i.clamp(H,0,1),w=t.magnitude(t.subtract(Y,o,N))*Math.sqrt(1-H*H),w=l?-w:w,j.height=w,e.cartographicToCartesian(j,new t)}return void 0};var G=new t;return p.lineSegmentPlane=function(r,e,o,a){n(a)||(a=new t);var s=t.subtract(e,r,G),u=o.normal,l=t.dot(u,s);if(Math.abs(l)<i.EPSILON6)return void 0;var c=t.dot(u,r),f=-(o.distance+c)/l;return 0>f||f>1?void 0:(t.multiplyByScalar(s,f,a),t.add(r,a,a),a)},p.trianglePlaneIntersection=function(r,e,n,o){var i=o.normal,a=o.distance,s=t.dot(i,r)+a<0,u=t.dot(i,e)+a<0,l=t.dot(i,n)+a<0,c=0;c+=s?1:0,c+=u?1:0,c+=l?1:0;var f,h;if((1===c||2===c)&&(f=new t,h=new t),1===c){if(s)return p.lineSegmentPlane(r,e,o,f),p.lineSegmentPlane(r,n,o,h),{positions:[r,e,n,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(u)return p.lineSegmentPlane(e,n,o,f),p.lineSegmentPlane(e,r,o,h),{positions:[r,e,n,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(l)return p.lineSegmentPlane(n,r,o,f),p.lineSegmentPlane(n,e,o,h),{positions:[r,e,n,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===c){if(!s)return p.lineSegmentPlane(e,r,o,f),p.lineSegmentPlane(n,r,o,h),{positions:[r,e,n,f,h],indices:[1,2,4,1,4,3,0,3,4]};if(!u)return p.lineSegmentPlane(n,e,o,f),p.lineSegmentPlane(r,e,o,h),{positions:[r,e,n,f,h],indices:[2,0,4,2,4,3,1,3,4]};if(!l)return p.lineSegmentPlane(r,n,o,f),p.lineSegmentPlane(e,n,o,h),{positions:[r,e,n,f,h],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),define("Core/isArray",["./defined"],function(t){"use strict";var r=Array.isArray;return t(r)||(r=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),r}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(t,r,e,n,o,i,a,s,u,l,c,f){"use strict";function h(t,r,e){var n=R;n.length=t;var o;if(r===e){for(o=0;t>o;o++)n[o]=r;return n}var i=e-r,a=i/t;for(o=0;t>o;o++){var s=r+o*a;n[o]=s}return n}function d(r,e,n,o,i,a,s,u){var l=o.scaleToGeodeticSurface(r,I),c=o.scaleToGeodeticSurface(e,N),f=m.numberOfPoints(r,e,n),d=o.cartesianToCartographic(l,A),p=o.cartesianToCartographic(c,O),g=h(f,i,a);x.setEndPoints(d,p);var E=x.surfaceDistance/f,y=u;d.height=i;var v=o.cartographicToCartesian(d,T);t.pack(v,s,y),y+=3;for(var S=1;f>S;S++){var C=x.interpolateUsingSurfaceDistance(S*E,O);C.height=g[S],v=o.cartographicToCartesian(C,T),t.pack(v,s,y),y+=3}return y}var m={};m.numberOfPoints=function(r,e,n){var o=t.distance(r,e);return Math.ceil(o/n)};var p=new r;m.extractHeights=function(t,r){for(var e=t.length,n=new Array(e),o=0;e>o;o++){var i=t[o];n[o]=r.cartesianToCartographic(i,p).height}return n};var g=new c,E=new t,y=new t,v=new f(t.ZERO,0),S=new t,C=new f(t.ZERO,0),w=new t,M=new t,R=[],A=new r,O=new r,T=new t,I=new t,N=new t,x=new a;m.wrapLongitude=function(r,o){var i=[],a=[];if(n(r)&&r.length>0){o=e(o,c.IDENTITY);var u=c.inverseTransformation(o,g),l=c.multiplyByPoint(u,t.ZERO,E),h=c.multiplyByPointAsVector(u,t.UNIT_Y,y),d=f.fromPointNormal(l,h,v),m=c.multiplyByPointAsVector(u,t.UNIT_X,S),p=f.fromPointNormal(l,m,C),R=1;i.push(t.clone(r[0]));for(var A=i[0],O=r.length,T=1;O>T;++T){var I=r[T];if(f.getPointDistance(p,A)<0||f.getPointDistance(p,I)<0){var N=s.lineSegmentPlane(A,I,d,w);if(n(N)){var x=t.multiplyByScalar(h,5e-9,M);f.getPointDistance(d,A)<0&&t.negate(x,x),i.push(t.add(N,x,new t)),a.push(R+1),t.negate(x,x),i.push(t.add(N,x,new t)),R=1}}i.push(t.clone(r[T])),R++,A=I}a.push(R)}return{positions:i,lengths:a}};var _=l.EPSILON7;return m.removeDuplicates=function(r){var e=r.length;if(2>e)return r;var n,o,i;for(n=1;e>n&&(o=r[n-1],i=r[n],!t.equalsEpsilon(o,i,_));++n);if(n===e)return r;for(var a=r.slice(0,n);e>n;++n)i=r[n],t.equalsEpsilon(o,i,_)||(a.push(t.clone(i)),o=i);return a},m.generateArc=function(r){n(r)||(r={});var o=r.positions,a=o.length,s=e(r.ellipsoid,i.WGS84),c=e(r.height,0);if(1>a)return[];if(1===a){var f=s.scaleToGeodeticSurface(o[0],I);if(0!==c){var h=s.geodeticSurfaceNormal(f,T);t.multiplyByScalar(h,c,h),t.add(f,h,f)}return[f.x,f.y,f.z]}var p=r.minDistance;if(!n(p)){var g=e(r.granularity,l.RADIANS_PER_DEGREE);p=l.chordLength(g,s.maximumRadius)}var E,y=0;for(E=0;a-1>E;E++)y+=m.numberOfPoints(o[E],o[E+1],p);var v=3*(y+1),S=new Array(v),C=0,w=u(c);for(E=0;a-1>E;E++){var M=o[E],O=o[E+1],N=w?c[E]:c,x=w?c[E+1]:c;C=d(M,O,p,s,N,x,S,C)}R.length=0;var _=o[a-1],L=s.cartesianToCartographic(_,A);L.height=w?c[a-1]:c;var P=s.cartographicToCartesian(L,T);return t.pack(P,S,v-3),S},m.generateCartesianArc=function(r){for(var e=m.generateArc(r),n=e.length/3,o=new Array(n),i=0;n>i;i++)o[i]=t.unpack(e,3*i);return o},m}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(t,r,e,n){"use strict";var o=function(r){r=t(r,t.EMPTY_OBJECT),this.position=t(r.position,!1),this.normal=t(r.normal,!1),this.st=t(r.st,!1),this.binormal=t(r.binormal,!1),this.tangent=t(r.tangent,!1),this.color=t(r.color,!1)};return o.POSITION_ONLY=n(new o({position:!0})),o.POSITION_AND_NORMAL=n(new o({position:!0,normal:!0})),o.POSITION_NORMAL_AND_ST=n(new o({position:!0,normal:!0,st:!0})),o.POSITION_AND_ST=n(new o({position:!0,st:!0})),o.POSITION_AND_COLOR=n(new o({position:!0,color:!0})),o.ALL=n(new o({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),o.DEFAULT=o.POSITION_NORMAL_AND_ST,o.packedLength=6,o.pack=function(r,e,n){n=t(n,0),e[n++]=r.position?1:0,e[n++]=r.normal?1:0,e[n++]=r.st?1:0,e[n++]=r.binormal?1:0,e[n++]=r.tangent?1:0,e[n++]=r.color?1:0},o.unpack=function(e,n,i){return n=t(n,0),r(i)||(i=new o),i.position=1===e[n++],i.normal=1===e[n++],i.st=1===e[n++],i.binormal=1===e[n++],i.tangent=1===e[n++],i.color=1===e[n++],i},o.clone=function(t,e){return r(t)?(r(e)||(e=new o),e.position=t.position,e.normal=t.normal,e.st=t.st,e.binormal=t.binormal,e.tangent=t.tangent,e.color=t.color,e):void 0},o}),define("Core/PolylineGeometry",["./BoundingSphere","./Cartesian3","./Color","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryType","./IndexDatatype","./Math","./PolylinePipeline","./PrimitiveType","./VertexFormat"],function(t,r,e,n,o,i,a,s,u,l,c,f,h,d,m,p,g){"use strict";function E(t,r,n,o,i){var a=y;a.length=i;var s,u=n.red,l=n.green,c=n.blue,f=n.alpha,h=o.red,d=o.green,m=o.blue,p=o.alpha;if(e.equals(n,o)){for(s=0;i>s;s++)a[s]=e.clone(n);return a}var g=(h-u)/i,E=(d-l)/i,v=(m-c)/i,S=(p-f)/i;for(s=0;i>s;s++)a[s]=new e(u+s*g,l+s*E,c+s*v,f+s*S);return a}var y=[],v=function(t){t=o(t,o.EMPTY_OBJECT);var n=t.positions,a=t.colors,u=o(t.width,1),l=o(t.colorsPerVertex,!1);this._positions=n,this._colors=a,this._width=u,this._colorsPerVertex=l,this._vertexFormat=g.clone(o(t.vertexFormat,g.DEFAULT)),this._followSurface=o(t.followSurface,!0),this._granularity=o(t.granularity,d.RADIANS_PER_DEGREE),this._ellipsoid=s.clone(o(t.ellipsoid,s.WGS84)),this._workerName="createPolylineGeometry";var c=1+n.length*r.packedLength;c+=i(a)?1+a.length*e.packedLength:1,this.packedLength=c+s.packedLength+g.packedLength+4};v.pack=function(t,n,a){a=o(a,0);var u,l=t._positions,c=l.length;for(n[a++]=c,u=0;c>u;++u,a+=r.packedLength)r.pack(l[u],n,a);var f=t._colors;for(c=i(f)?f.length:0,n[a++]=c,u=0;c>u;++u,a+=e.packedLength)e.pack(f[u],n,a);s.pack(t._ellipsoid,n,a),a+=s.packedLength,g.pack(t._vertexFormat,n,a),a+=g.packedLength,n[a++]=t._width,n[a++]=t._colorsPerVertex?1:0,n[a++]=t._followSurface?1:0,n[a]=t._granularity};var S=s.clone(s.UNIT_SPHERE),C=new g,w={positions:void 0,colors:void 0,ellipsoid:S,vertexFormat:C,width:void 0,colorsPerVertex:void 0,followSurface:void 0,granularity:void 0};v.unpack=function(t,n,a){n=o(n,0);var u,l=t[n++],c=new Array(l);for(u=0;l>u;++u,n+=r.packedLength)c[u]=r.unpack(t,n);l=t[n++];var f=l>0?new Array(l):void 0;for(u=0;l>u;++u,n+=e.packedLength)f[u]=e.unpack(t,n);var h=s.unpack(t,n,S);n+=s.packedLength;var d=g.unpack(t,n,C);n+=g.packedLength;var m=t[n++],p=1===t[n++],E=1===t[n++],y=t[n];return i(a)?(a._positions=c,a._colors=f,a._ellipsoid=s.clone(h,a._ellipsoid),a._vertexFormat=g.clone(d,a._vertexFormat),a._width=m,a._colorsPerVertex=p,a._followSurface=E,a._granularity=y,a):(w.positions=c,w.colors=f,w.width=m,w.colorsPerVertex=p,w.followSurface=E,w.granularity=y,new v(w))};var M=new r,R=new r,A=new r,O=new r;return v.createGeometry=function(o){var a,s,g,v=o._width,S=o._vertexFormat,C=o._colors,w=o._colorsPerVertex,T=o._followSurface,I=o._granularity,N=o._ellipsoid,x=d.chordLength(I,N.maximumRadius),_=m.removeDuplicates(o._positions),L=_.length;if(2>L)return void 0;if(T){var P=m.extractHeights(_,N);if(i(C)){var b=1;for(a=0;L-1>a;++a)b+=m.numberOfPoints(_[a],_[a+1],x);var F=new Array(b),D=0;for(a=0;L-1>a;++a){var z=_[a],B=_[a+1],U=C[a],q=m.numberOfPoints(z,B,x);if(w&&b>a){var G=C[a+1],W=E(z,B,U,G,q),Y=W.length;for(s=0;Y>s;++s)F[D++]=W[s]}else for(s=0;q>s;++s)F[D++]=e.clone(U)}F[D]=e.clone(C[C.length-1]),C=F,y.length=0}_=m.generateCartesianArc({positions:_,minDistance:x,ellipsoid:N,height:P})}L=_.length;var H,V=4*L-4,k=new Float64Array(3*V),K=new Float64Array(3*V),j=new Float64Array(3*V),Z=new Float32Array(2*V),X=S.st?new Float32Array(2*V):void 0,Q=i(C)?new Uint8Array(4*V):void 0,J=0,$=0,tr=0,rr=0;for(s=0;L>s;++s){0===s?(H=M,r.subtract(_[0],_[1],H),r.add(_[0],H,H)):H=_[s-1],r.clone(H,A),r.clone(_[s],R),s===L-1?(H=M,r.subtract(_[L-1],_[L-2],H),r.add(_[L-1],H,H)):H=_[s+1],r.clone(H,O);var er,nr;i(Q)&&(er=0===s||w?C[s]:C[s-1],s!==L-1&&(nr=C[s]));var or=0===s?2:0,ir=s===L-1?2:4;for(g=or;ir>g;++g){r.pack(R,k,J),r.pack(A,K,J),r.pack(O,j,J),J+=3;var ar=0>g-2?-1:1;if(Z[$++]=2*(g%2)-1,Z[$++]=ar*v,S.st&&(X[tr++]=s/(L-1),X[tr++]=Math.max(Z[$-2],0)),i(Q)){var sr=2>g?er:nr;Q[rr++]=e.floatToByte(sr.red),Q[rr++]=e.floatToByte(sr.green),Q[rr++]=e.floatToByte(sr.blue),Q[rr++]=e.floatToByte(sr.alpha)}}}var ur=new c;ur.position=new l({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:k}),ur.prevPosition=new l({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:K}),ur.nextPosition=new l({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:j}),ur.expandAndWidth=new l({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:Z}),S.st&&(ur.st=new l({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:X})),i(Q)&&(ur.color=new l({componentDatatype:n.UNSIGNED_BYTE,componentsPerAttribute:4,values:Q,normalize:!0}));var lr=h.createTypedArray(V,6*L-6),cr=0,fr=0,hr=L-1;for(s=0;hr>s;++s)lr[fr++]=cr,lr[fr++]=cr+2,lr[fr++]=cr+1,lr[fr++]=cr+1,lr[fr++]=cr+2,lr[fr++]=cr+3,cr+=4;return new u({attributes:ur,indices:lr,primitiveType:p.TRIANGLES,boundingSphere:t.fromPoints(_),geometryType:f.POLYLINES})},v}),define("Workers/createPolylineGeometry",["../Core/defined","../Core/Ellipsoid","../Core/PolylineGeometry"],function(t,r,e){"use strict";function n(n,o){return t(o)&&(n=e.unpack(n,o)),n._ellipsoid=r.clone(n._ellipsoid),e.createGeometry(n)}return n})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createPolylineVolumeGeometry.js b/libs/Cesium/Workers/createPolylineVolumeGeometry.js deleted file mode 100644 index f38e146a..00000000 --- a/libs/Cesium/Workers/createPolylineVolumeGeometry.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,a){a=t(a,r);var i=Math.abs(e-n);return a>=i||i<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],a=t;e>=a;a++)r.push(n*a);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var a=new e;return n.setRandomNumberSeed=function(t){a=new e(t)},n.nextRandomNumber=function(){return a.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};i.fromSpherical=function(n,r){t(r)||(r=new i);var a=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(a),r.y=s*Math.sin(a),r.z=u*Math.cos(o),r},i.fromElements=function(e,n,r,a){return t(a)?(a.x=e,a.y=n,a.z=r,a):new i(e,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var n=i.dot(s,c),r=i.magnitude(i.cross(s,c,s));return Math.atan2(r,n)};var l=new i;i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):n.y<=n.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)},i.cross=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-r*s,f=r*u-a*o;return n.x=c,n.y=l,n.z=f,n},i.fromDegrees=function(e,t,n,r,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,n,r,o)};var f=new i,h=new i,d=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(n,r,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=i.normalize(f,f),i.multiplyComponents(s,f,h);var l=Math.sqrt(i.dot(f,h));return h=i.divideByScalar(h,l,h),f=i.multiplyByScalar(f,a,f),t(u)||(u=new i),i.add(h,f,u)},i.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=a.toRadians(e[o]);return i.fromRadiansArray(r,t,n)},i.fromRadiansArray=function(e,n,r){var a=e.length;t(r)?r.length=a/2:r=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=i.fromRadians(u,s,0,n,r[o/2])}return r},i.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=a.toRadians(e[o]),r[o+1]=a.toRadians(e[o+1]),r[o+2]=e[o+2];return i.fromRadiansArrayHeights(r,t,n)},i.fromRadiansArrayHeights=function(e,n,r){var a=e.length;t(r)?r.length=a/3:r=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=i.fromRadians(u,s,c,n,r[o/3])}return r},i.ZERO=r(new i(0,0,0)),i.UNIT_X=r(new i(1,0,0)),i.UNIT_Y=r(new i(0,1,0)),i.UNIT_Z=r(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return i.fromRadians=function(n,r,a,o){return a=e(a,0),t(o)?(o.longitude=n,o.latitude=r,o.height=a,o):new i(n,r,a)},i.fromDegrees=function(e,t,n,r){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},i.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},i.ZERO=r(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(t,r,a,i){r=n(r,0),a=n(a,0),i=n(i,0),t._radii=new e(r,a,i),t._radiiSquared=new e(r*r,a*a,i*i),t._radiiToTheFourth=new e(r*r*r*r,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===r?0:1/r,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(r,a,i),t._maximumRadius=Math.max(r,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var a=t._radii;return r(n)?(e.clone(a,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,a){a=n(a,0),e.pack(t._radii,r,a)},c.unpack=function(t,r,a){r=n(r,0);var i=e.unpack(t,r);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,n){var a=l,i=f;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),r(n)||(n=new e),e.add(i,a,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var h=new e,d=new e,p=new e;c.prototype.cartesianToCartographic=function(n,a){var i=this.scaleToGeodeticSurface(n,d);if(!r(i))return void 0;var o=this.geodeticSurfaceNormal(i,h),s=e.subtract(n,i,p),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,n))*e.magnitude(s);return r(a)?(a.longitude=c,a.latitude=l,a.height=f,a):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var m=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=a*a*c*c,d=i*i*l*l,p=o*o*f*f,v=h+d+p,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,m);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,O=x.z,T=y;T.x=2*w.x*E,T.y=2*w.y*S,T.z=2*w.z*O;var M,_,P,b,N,A,I,C,R,z,D,L=(1-g)*e.magnitude(t)/(.5*e.magnitude(T)),q=0;do{L-=q,P=1/(1+L*E),b=1/(1+L*S),N=1/(1+L*O),A=P*P,I=b*b,C=N*N,R=A*P,z=I*b,D=C*N,M=h*A+d*I+p*C-1,_=h*R*E+d*z*S+p*D*O;var U=-2*_;q=M/U}while(Math.abs(M)>u.EPSILON12);return r(n)?(n.x=a*P,n.y=i*b,n.z=o*N,n):new e(a*P,i*b,o*N)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n){this.x=e(t,0),this.y=e(n,0)};i.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new i(e,n)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)},i.ZERO=r(new i(0,0)),i.UNIT_X=r(new i(1,0)),i.UNIT_Y=r(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,a,i,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return r(n)?(n.x=i,n.y=o,n.z=u,n):new e(i,o,u)},u.prototype.unproject=function(e,n){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return r(n)?(n.longitude=i,n.latitude=o,n.height=u,n):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(a,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.west=e[r++],a.south=e[r++],a.east=e[r++],a.north=e[r],a},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,a,i,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),n(o)?(o.west=e,o.south=r,o.east=a,o.north=i,o):new s(e,r,a,i)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=i,t.east=a,t.north=o,t):new s(r,i,a,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var h=Math.max(e.south,t.south),d=Math.min(e.north,t.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>a||u.equalsEpsilon(n,a,u.EPSILON14))&&(i>n||u.equalsEpsilon(n,i,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,a,o){r=t(r,i.WGS84),a=t(a,0),n(o)||(o=[]);var l=0,f=e.north,h=e.south,d=e.east,p=e.west,m=c;m.height=a,m.longitude=p,m.latitude=f,o[l]=r.cartographicToCartesian(m,o[l]),l++,m.longitude=d,o[l]=r.cartographicToCartesian(m,o[l]),l++,m.latitude=h,o[l]=r.cartographicToCartesian(m,o[l]),l++,m.longitude=p,o[l]=r.cartographicToCartesian(m,o[l]),l++,m.latitude=0>f?f:h>0?h:0;for(var y=1;8>y;++y)m.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,m)&&(o[l]=r.cartographicToCartesian(m,o[l]),l++);return 0===m.latitude&&(m.longitude=p,o[l]=r.cartographicToCartesian(m,o[l]),l++,m.longitude=d,o[l]=r.cartographicToCartesian(m,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingRectangle",["./Cartesian2","./Cartographic","./defaultValue","./defined","./DeveloperError","./GeographicProjection","./Intersect","./Rectangle"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,t,r,a){this.x=n(e,0),this.y=n(t,0),this.width=n(r,0),this.height=n(a,0)};s.fromPoints=function(e,t){if(r(t)||(t=new s),!r(e)||0===e.length)return t.x=0,t.y=0,t.width=0,t.height=0,t;for(var n=e.length,a=e[0].x,i=e[0].y,o=e[0].x,u=e[0].y,c=1;n>c;c++){var l=e[c],f=l.x,h=l.y;a=Math.min(f,a),o=Math.max(f,o),i=Math.min(h,i),u=Math.max(h,u)}return t.x=a,t.y=i,t.width=o-a,t.height=u-i,t};var c=new i,l=new t,f=new t;return s.fromRectangle=function(t,a,i){if(r(i)||(i=new s),!r(t))return i.x=0,i.y=0,i.width=0,i.height=0,i;a=n(a,c);var o=a.project(u.southwest(t,l)),h=a.project(u.northeast(t,f));return e.subtract(h,o,h),i.x=o.x,i.y=o.y,i.width=h.x,i.height=h.y,i},s.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new s(e.x,e.y,e.width,e.height):void 0},s.union=function(e,t,n){r(n)||(n=new s);var a=Math.min(e.x,t.x),i=Math.min(e.y,t.y),o=Math.max(e.x+e.width,t.x+t.width),u=Math.max(e.y+e.height,t.y+t.height);return n.x=a,n.y=i,n.width=o-a,n.height=u-i,n},s.expand=function(e,t,n){n=s.clone(e,n);var r=t.x-n.x,a=t.y-n.y;return r>n.width?n.width=r:0>r&&(n.width-=r,n.x=t.x),a>n.height?n.height=a:0>a&&(n.height-=a,n.y=t.y),n},s.intersect=function(e,t){var n=e.x,r=e.y,a=t.x,i=t.y;return n>a+t.width||n+e.width<a||r+e.height<i||r>i+t.height?o.OUTSIDE:o.INTERSECTING},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.intersect=function(e){return s.intersect(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r,a){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(a,0)};i.fromElements=function(e,n,r,a,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=a,o):new i(e,n,r,a)},i.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r++],a.w=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,s);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):n.y<=n.z?n.y<=n.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)&&a.equalsEpsilon(e.w,n.w,r,i)},i.ZERO=r(new i(0,0,0,0)),i.UNIT_X=r(new i(1,0,0,0)),i.UNIT_Y=r(new i(0,1,0,0)),i.UNIT_Z=r(new i(0,0,1,0)),i.UNIT_W=r(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(d[n],h[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=i.EPSILON15,r=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(d[o],h[o])]);u>r&&(a=o,r=u)}var s=1,l=0,f=h[a],p=d[a];if(Math.abs(e[c.getElementIndex(p,f)])>n){var m,y=e[c.getElementIndex(p,p)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(p,f)],w=(y-v)/2/g;m=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+m*m),l=m*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(p,p)]=s,t[c.getElementIndex(p,f)]=l,t[c.getElementIndex(f,p)]=-l,t}var c=function(e,n,r,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++],a[4]=e[r++],a[5]=e[r++],a[6]=e[r++],a[7]=e[r++],a[8]=e[r++],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],a[4]=e[r+4],a[5]=e[r+5],a[6]=e[r+6],a[7]=e[r+7],a[8]=e[r+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,h=e.z*e.w,d=e.w*e.w,p=r-u-f+d,m=2*(a-h),y=2*(i+l),v=2*(a+h),g=-r+u-f+d,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-r-u+f+d;return n(t)?(t[0]=p,t[1]=v,t[2]=x,t[3]=m,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(p,m,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=a,t[6]=0,t[7]=-a,t[8]=r,t):new c(1,0,0,0,r,-a,0,a,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=r,t):new c(r,0,a,0,1,0,-a,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=a,t[2]=0,t[3]=-a,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-a,0,a,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,a=e[r],i=e[r+1],o=e[r+2];return n.x=a,n.y=i,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=3*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],a=e[t+3],i=e[t+6]; -return n.x=r,n.y=a,n.z=i,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=a,n[2]=i,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[3]*a+e[6]*i,u=e[1]*r+e[4]*a+e[7]*i,s=e[2]*r+e[5]*a+e[8]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var h=[1,0,0],d=[2,2,1],p=new c,m=new c;return c.computeEigenDecomposition=function(e,t){var r=i.EPSILON20,a=10,l=0,f=0;n(t)||(t={});for(var h=t.unitary=c.clone(c.IDENTITY,t.unitary),d=t.diagonal=c.clone(e,t.diagonal),y=r*o(d);a>f&&u(d)>y;)s(d,p),c.transpose(p,m),c.multiply(d,p,d),c.multiply(m,d,d),c.multiply(h,p,h),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*r-n*c)+u*(n*o-i*r)},c.inverse=function(e,t){var n=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],h=e[7],d=e[8],p=c.determinant(e);if(Math.abs(p)<=i.EPSILON15)throw new r("matrix is not invertible");t[0]=s*d-h*l,t[1]=h*o-a*d,t[2]=a*l-s*o,t[3]=f*l-u*d,t[4]=n*d-f*o,t[5]=u*o-n*l,t[6]=u*h-f*s,t[7]=f*a-n*h,t[8]=n*s-u*a;var m=1/p;return c.multiplyByScalar(t,m,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,a,i,o,u,s){"use strict";var c=function(e,t,r,a,i,o,u,s,c,l,f,h,d,p,m,y){this[0]=n(e,0),this[1]=n(i,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(p,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(m,0),this[12]=n(a,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=n(a,e.ZERO),r(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,a){r(a)||(a=new c);var i=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,h=t.x*t.w,d=t.y*t.y,p=t.y*t.z,m=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-d-y+g,x=2*(l-v),E=2*(f+m),S=2*(l+v),O=-s+d-y+g,T=2*(p-h),M=2*(f-m),_=2*(p+h),P=-s-d+y+g;return a[0]=w*i,a[1]=S*i,a[2]=M*i,a[3]=0,a[4]=x*o,a[5]=O*o,a[6]=_*o,a[7]=0,a[8]=E*u,a[9]=T*u,a[10]=P*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,h=new e;c.fromCamera=function(t,n){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,p=l.x,m=l.y,y=l.z,v=h.x,g=h.y,w=h.z,x=a.x,E=a.y,S=a.z,O=u*-x+s*-E+d*-S,T=v*-x+g*-E+w*-S,M=p*x+m*E+y*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-p,n[3]=0,n[4]=s,n[5]=g,n[6]=-m,n[7]=0,n[8]=d,n[9]=w,n[10]=-y,n[11]=0,n[12]=O,n[13]=T,n[14]=M,n[15]=1,n):new c(u,s,d,O,v,g,w,T,-p,-m,-y,M,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,n,r,a,i,o){var u=1/(t-e),s=1/(r-n),c=1/(i-a),l=-(t+e)*u,f=-(r+n)*s,h=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o},c.computePerspectiveOffCenter=function(e,t,n,r,a,i,o){var u=2*a/(t-e),s=2*a/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),f=-(i+a)/(i-a),h=-1,d=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,a,i){var o=2*a/(t-e),u=2*a/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,f=-1,h=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=h,i[15]=0,i},c.computeViewportTransformation=function(e,t,r,a){e=n(e,n.EMPTY_OBJECT);var i=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-t),h=c,d=l,p=f,m=i+c,y=o+l,v=t+f,g=1;return a[0]=h,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=d,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=p,a[11]=0,a[12]=m,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,a=e[r],i=e[r+1],o=e[r+2],u=e[r+3];return n.x=a,n.y=i,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=4*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r[a+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return n.x=r,n.y=a,n.z=i,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var d=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],d)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],d)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],d)),n};var p=new e;c.getMaximumScale=function(t){return c.getScale(t,p),e.maximumComponent(p)},c.multiply=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],h=e[9],d=e[10],p=e[11],m=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],O=t[4],T=t[5],M=t[6],_=t[7],P=t[8],b=t[9],N=t[10],A=t[11],I=t[12],C=t[13],R=t[14],z=t[15],D=r*w+u*x+f*E+m*S,L=a*w+s*x+h*E+y*S,q=i*w+c*x+d*E+v*S,U=o*w+l*x+p*E+g*S,B=r*O+u*T+f*M+m*_,F=a*O+s*T+h*M+y*_,W=i*O+c*T+d*M+v*_,G=o*O+l*T+p*M+g*_,k=r*P+u*b+f*N+m*A,V=a*P+s*b+h*N+y*A,Y=i*P+c*b+d*N+v*A,j=o*P+l*b+p*N+g*A,H=r*I+u*C+f*R+m*z,Z=a*I+s*C+h*R+y*z,X=i*I+c*C+d*R+v*z,J=o*I+l*C+p*R+g*z;return n[0]=D,n[1]=L,n[2]=q,n[3]=U,n[4]=B,n[5]=F,n[6]=W,n[7]=G,n[8]=k,n[9]=V,n[10]=Y,n[11]=j,n[12]=H,n[13]=Z,n[14]=X,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=e[12],d=e[13],p=e[14],m=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],O=t[10],T=t[12],M=t[13],_=t[14],P=r*m+o*y+c*v,b=a*m+u*y+l*v,N=i*m+s*y+f*v,A=r*g+o*w+c*x,I=a*g+u*w+l*x,C=i*g+s*w+f*x,R=r*E+o*S+c*O,z=a*E+u*S+l*O,D=i*E+s*S+f*O,L=r*T+o*M+c*_+h,q=a*T+u*M+l*_+d,U=i*T+s*M+f*_+p;return n[0]=P,n[1]=b,n[2]=N,n[3]=0,n[4]=A,n[5]=I,n[6]=C,n[7]=0,n[8]=R,n[9]=z,n[10]=D,n[11]=0,n[12]=L,n[13]=q,n[14]=U,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=t[0],d=t[1],p=t[2],m=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=r*h+o*d+c*p,S=a*h+u*d+l*p,O=i*h+s*d+f*p,T=r*m+o*y+c*v,M=a*m+u*y+l*v,_=i*m+s*y+f*v,P=r*g+o*w+c*x,b=a*g+u*w+l*x,N=i*g+s*w+f*x;return n[0]=E,n[1]=S,n[2]=O,n[3]=0,n[4]=T,n[5]=M,n[6]=_,n[7]=0,n[8]=P,n[9]=b,n[10]=N,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=r*e[0]+a*e[4]+i*e[8]+e[12],u=r*e[1]+a*e[5]+i*e[9]+e[13],s=r*e[2]+a*e[6]+i*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var m=new e;c.multiplyByUniformScale=function(e,t,n){return m.x=t,m.y=t,m.z=t,c.multiplyByScale(e,m,n)},c.multiplyByScale=function(e,t,n){var r=t.x,a=t.y,i=t.z;return 1===r&&1===a&&1===i?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=a*e[4],n[5]=a*e[5],n[6]=a*e[6],n[7]=0,n[8]=i*e[8],n[9]=i*e[9],n[10]=i*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*r+e[4]*a+e[8]*i+e[12]*o,s=e[1]*r+e[5]*a+e[9]*i+e[13]*o,c=e[2]*r+e[6]*a+e[10]*i+e[14]*o,l=e[3]*r+e[7]*a+e[11]*i+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i,u=e[1]*r+e[5]*a+e[9]*i,s=e[2]*r+e[6]*a+e[10]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i+e[12],u=e[1]*r+e[5]*a+e[9]*i+e[13],s=e[2]*r+e[6]*a+e[10]*i+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],a=e[4],i=e[8],l=e[12],f=e[1],h=e[5],d=e[9],p=e[13],m=e[2],x=e[6],E=e[10],S=e[14],O=e[3],T=e[7],M=e[11],_=e[15],P=E*_,b=S*M,N=x*_,A=S*T,I=x*M,C=E*T,R=m*_,z=S*O,D=m*M,L=E*O,q=m*T,U=x*O,B=P*h+A*d+I*p-(b*h+N*d+C*p),F=b*f+R*d+L*p-(P*f+z*d+D*p),W=N*f+z*h+q*p-(A*f+R*h+U*p),G=C*f+D*h+U*d-(I*f+L*h+q*d),k=b*a+N*i+C*l-(P*a+A*i+I*l),V=P*r+z*i+D*l-(b*r+R*i+L*l),Y=A*r+R*a+U*l-(N*r+z*a+q*l),j=I*r+L*a+q*i-(C*r+D*a+U*i);P=i*p,b=l*d,N=a*p,A=l*h,I=a*d,C=i*h,R=r*p,z=l*f,D=r*d,L=i*f,q=r*h,U=a*f;var H=P*T+A*M+I*_-(b*T+N*M+C*_),Z=b*O+R*M+L*_-(P*O+z*M+D*_),X=N*O+z*T+q*_-(A*O+R*T+U*_),J=C*O+D*T+U*M-(I*O+L*T+q*M),K=N*E+C*S+b*x-(I*S+P*x+A*E),Q=D*S+P*m+z*E-(R*E+L*S+b*m),$=R*x+U*S+A*m-(q*S+N*m+z*x),et=q*E+I*m+L*x-(D*x+U*E+C*m),tt=r*B+a*F+i*W+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=B*tt,n[1]=F*tt,n[2]=W*tt,n[3]=G*tt,n[4]=k*tt,n[5]=V*tt,n[6]=Y*tt,n[7]=j*tt,n[8]=H*tt,n[9]=Z*tt,n[10]=X*tt,n[11]=J*tt,n[12]=K*tt,n[13]=Q*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],h=e[13],d=e[14],p=-n*f-r*h-a*d,m=-i*f-o*h-u*d,y=-s*f-c*h-l*d;return t[0]=n,t[1]=i,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=p,t[13]=m,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t,n){this.normal=e.clone(t),this.distance=n};a.fromPointNormal=function(n,r,i){var o=-e.dot(r,n);return t(i)?(e.clone(r,i.normal),i.distance=o,i):new a(r,o)};var i=new e;return a.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,i),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new a(o,u)},a.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},a.ORIGIN_XY_PLANE=r(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=r(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=r(new a(e.UNIT_Y,0)),a}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,a,i,o,u,s,c,l,f,h){"use strict";var d=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},p=new e,m=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,O=new e,T=new e,M=new e;d.fromPoints=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var a=e.clone(t[0],x),i=e.clone(a,p),o=e.clone(a,m),u=e.clone(a,y),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),f=t.length,h=1;f>h;h++){e.clone(t[h],a);var _=a.x,P=a.y,b=a.z;_<i.x&&e.clone(a,i),_>s.x&&e.clone(a,s),P<o.y&&e.clone(a,o),P>c.y&&e.clone(a,c),b<u.z&&e.clone(a,u),b>l.z&&e.clone(a,l)}var N=e.magnitudeSquared(e.subtract(s,i,E)),A=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),C=i,R=s,z=N;A>z&&(z=A,C=o,R=c),I>z&&(z=I,C=u,R=l);var D=S;D.x=.5*(C.x+R.x),D.y=.5*(C.y+R.y),D.z=.5*(C.z+R.z);var L=e.magnitudeSquared(e.subtract(R,D,E)),q=Math.sqrt(L),U=O;U.x=i.x,U.y=o.y,U.z=u.z;var B=T;B.x=s.x,B.y=c.y,B.z=l.z;var F=e.multiplyByScalar(e.add(U,B,E),.5,M),W=0;for(h=0;f>h;h++){e.clone(t[h],a);var G=e.magnitude(e.subtract(a,F,E));G>W&&(W=G);var k=e.magnitudeSquared(e.subtract(a,D,E));if(k>L){var V=Math.sqrt(k);q=.5*(q+V),L=q*q;var Y=V-q;D.x=(q*D.x+Y*a.x)/V,D.y=(q*D.y+Y*a.y)/V,D.z=(q*D.z+Y*a.z)/V}}return W>q?(e.clone(D,n.center),n.radius=q):(e.clone(F,n.center),n.radius=W),n};var _=new u,P=new e,b=new e,N=new t,A=new t;d.fromRectangle2D=function(e,t,n){return d.fromRectangleWithHeights2D(e,t,0,0,n)},d.fromRectangleWithHeights2D=function(t,a,i,o,u){if(r(u)||(u=new d),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=n(a,_),h.southwest(t,N),N.height=i,h.northeast(t,A),A.height=o;var s=a.project(N,P),c=a.project(A,b),l=c.x-s.x,f=c.y-s.y,p=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+p*p);var m=u.center;return m.x=s.x+.5*l,m.y=s.y+.5*f,m.z=s.z+.5*p,u};var I=[];d.fromRectangle3D=function(e,t,a,i){t=n(t,o.WGS84),a=n(a,0);var u;return r(e)&&(u=h.subsample(e,t,a,I)),d.fromPoints(u,i)},d.fromVertices=function(t,a,i,o){if(r(o)||(o=new d),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=n(a,e.ZERO),i=n(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,p),c=e.clone(u,m),l=e.clone(u,y),f=e.clone(u,v),h=e.clone(u,g),_=e.clone(u,w),P=t.length,b=0;P>b;b+=i){var N=t[b]+a.x,A=t[b+1]+a.y,I=t[b+2]+a.z;u.x=N,u.y=A,u.z=I,N<s.x&&e.clone(u,s),N>f.x&&e.clone(u,f),A<c.y&&e.clone(u,c),A>h.y&&e.clone(u,h),I<l.z&&e.clone(u,l),I>_.z&&e.clone(u,_)}var C=e.magnitudeSquared(e.subtract(f,s,E)),R=e.magnitudeSquared(e.subtract(h,c,E)),z=e.magnitudeSquared(e.subtract(_,l,E)),D=s,L=f,q=C;R>q&&(q=R,D=c,L=h),z>q&&(q=z,D=l,L=_);var U=S;U.x=.5*(D.x+L.x),U.y=.5*(D.y+L.y),U.z=.5*(D.z+L.z);var B=e.magnitudeSquared(e.subtract(L,U,E)),F=Math.sqrt(B),W=O;W.x=s.x,W.y=c.y,W.z=l.z;var G=T;G.x=f.x,G.y=h.y,G.z=_.z;var k=e.multiplyByScalar(e.add(W,G,E),.5,M),V=0;for(b=0;P>b;b+=i){u.x=t[b]+a.x,u.y=t[b+1]+a.y,u.z=t[b+2]+a.z;var Y=e.magnitude(e.subtract(u,k,E));Y>V&&(V=Y);var j=e.magnitudeSquared(e.subtract(u,U,E));if(j>B){var H=Math.sqrt(j);F=.5*(F+H),B=F*F;var Z=H-F;U.x=(F*U.x+Z*u.x)/H,U.y=(F*U.y+Z*u.y)/H,U.z=(F*U.z+Z*u.z)/H}}return V>F?(e.clone(U,o.center),o.radius=F):(e.clone(k,o.center),o.radius=V),o},d.fromCornerPoints=function(t,n,a){r(a)||(a=new d);var i=a.center;return e.add(t,n,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,n),a},d.fromEllipsoid=function(t,n){return r(n)||(n=new d),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var C=new e;d.fromBoundingSpheres=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var a=t.length;if(1===a)return d.clone(t[0],n);if(2===a)return d.union(t[0],t[1],n);for(var i=[],o=0;a>o;o++)i.push(t[o].center);n=d.fromPoints(i,n);var u=n.center,s=n.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,C)+c.radius)}return n.radius=s,n},d.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new d(t.center,t.radius):void 0},d.packedLength=4,d.pack=function(e,t,r){r=n(r,0);var a=e.center;t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r]=e.radius},d.unpack=function(e,t,a){t=n(t,0),r(a)||(a=new d);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var R=new e,z=new e;d.union=function(t,n,a){r(a)||(a=new d);var i=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,i,R),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return n.clone(a),a;var f=.5*(o+l+s),h=e.multiplyByScalar(c,(-o+f)/l,z);return e.add(h,i,h),e.clone(h,a.center),a.radius=f,a};var D=new e;d.expand=function(t,n,r){r=d.clone(t,r);var a=e.magnitude(e.subtract(n,r.center,D));return a>r.radius&&(r.radius=a),r},d.intersectPlane=function(t,n){var r=t.center,a=t.radius,i=n.normal,o=e.dot(i,r)+n.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var L=new f(new e,0);d.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(t,L);return d.intersectPlane(e,n)},d.transform=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var q=new e;d.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,q);return e.magnitudeSquared(r)-t.radius*t.radius},d.transformWithoutScale=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var U=new e;d.computePlaneDistances=function(t,n,a,i){r(i)||(i=new c);var o=e.subtract(t.center,n,U),u=e.multiplyByScalar(a,e.dot(a,o),U),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var B=new e,F=new e,W=new e,G=new e,k=new e,V=new t,Y=new Array(8),j=0;8>j;++j)Y[j]=new e;var H=new u;return d.projectTo2D=function(t,r,a){r=n(r,H);var i=r.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,F);e.normalize(c,c);var l=e.cross(s,c,W);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),h=e.negate(c,G),p=Y,m=p[0];e.add(s,l,m),e.add(m,c,m),m=p[1],e.add(s,l,m),e.add(m,h,m),m=p[2],e.add(s,f,m),e.add(m,h,m),m=p[3],e.add(s,f,m),e.add(m,c,m),e.negate(s,s),m=p[4],e.add(s,l,m),e.add(m,c,m),m=p[5],e.add(s,l,m),e.add(m,h,m),m=p[6],e.add(s,f,m),e.add(m,h,m),m=p[7],e.add(s,f,m),e.add(m,c,m);for(var y=p.length,v=0;y>v;++v){var g=p[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,V);r.project(w,g)}a=d.fromPoints(p,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},d.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},d.prototype.intersectPlane=function(e){return d.intersectPlane(this,e)},d.prototype.intersect=function(e){return d.intersect(this,e)},d.prototype.equals=function(e){return d.equals(this,e)},d.prototype.clone=function(e){return d.clone(this,e)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(r.requestFullscreen=a,n=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(r.requestFullscreen=a,n=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?r.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(r.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?r.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(r.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?r.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(r.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),r.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),r.fullscreenerror=a)}return n},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[r.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[r.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=r(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=r(e[1])))}return S}function f(){return l()&&O}function h(){if(!t(T)){T=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(T=!0,M=r(e[1]))}return T}function d(){return t(_)||(_=/Windows/i.test(navigator.appVersion)),_}function p(){return h()&&M}function m(){return t(P)||(P=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),P}var y,v,g,w,x,E,S,O,T,M,_,P,b={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:p,isWindows:d,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:m};return b.supportsFullscreen=function(){return n.supportsFullscreen()},b.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},b.supportsWebWorkers=function(){return"undefined"!=typeof Worker},b}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,a){"use strict";if(!r.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,r,a,o){switch(a=e(a,0),o=e(o,(r.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(r,a,o); -case i.UNSIGNED_BYTE:return new Uint8Array(r,a,o);case i.SHORT:return new Int16Array(r,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(r,a,o);case i.FLOAT:return new Float32Array(r,a,o);case i.DOUBLE:return new Float64Array(r,a,o);default:throw new n("componentDatatype is not a valid value.")}},a(i)}),define("Core/CornerType",["./freezeObject"],function(e){"use strict";var t={ROUNDED:0,MITERED:1,BEVELED:2};return e(t)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var r=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,n,r,a){"use strict";var i={};i.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var n=t.x,r=t.y;t.x=(1-Math.abs(r))*a.signNotZero(n),t.y=(1-Math.abs(n))*a.signNotZero(r)}return t.x=a.toSNorm(t.x),t.y=a.toSNorm(t.y),t},i.octDecode=function(e,n,r){if(r.x=a.fromSNorm(e),r.y=a.fromSNorm(n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){var i=r.x;r.x=(1-Math.abs(r.y))*a.signNotZero(i),r.y=(1-Math.abs(i))*a.signNotZero(r.y)}return t.normalize(r,r)},i.octPackFloat=function(e){return 256*e.x+e.y};var o=new e;return i.octEncodeFloat=function(e){return i.octEncode(e,o),i.octPackFloat(o)},i.octDecodeFloat=function(e,t){var n=e/256,r=Math.floor(n),a=256*(n-r);return i.octDecode(r,a,t)},i.octPack=function(e,t,n,r){var a=i.octEncodeFloat(e),u=i.octEncodeFloat(t),s=i.octEncode(n,o);return r.x=65536*s.x+a,r.y=65536*s.y+u,r},i.octUnpack=function(e,t,n,r){var a=e.x/65536,o=Math.floor(a),u=65536*(a-o);a=e.y/65536;var s=Math.floor(a),c=65536*(a-s);i.octDecodeFloat(u,t),i.octDecodeFloat(c,n),i.octDecode(o,s,r)},i.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,n=1===e.y?4095:0|4096*e.y;return 4096*t+n},i.decompressTextureCoordinates=function(e,t){var n=e/4096;return t.x=Math.floor(n)/4096,t.y=n-Math.floor(n),t},i}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=new t,a=new t,i=new t,o=function(o,u,s,c,l){n(l)||(l=new t);var f,h,d,p,m,y,v,g;n(u.z)?(f=t.subtract(s,u,r),h=t.subtract(c,u,a),d=t.subtract(o,u,i),p=t.dot(f,f),m=t.dot(f,h),y=t.dot(f,d),v=t.dot(h,h),g=t.dot(h,d)):(f=e.subtract(s,u,r),h=e.subtract(c,u,a),d=e.subtract(o,u,i),p=e.dot(f,f),m=e.dot(f,h),y=e.dot(f,d),v=e.dot(h,h),g=e.dot(h,d));var w=1/(p*v-m*m);return l.y=(v*y-m*g)*w,l.z=(p*g-m*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var n=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};n.encode=function(e,n){t(n)||(n={high:0,low:0});var r;return e>=0?(r=65536*Math.floor(e/65536),n.high=r,n.low=e-r):(r=65536*Math.floor(-e/65536),n.high=-r,n.low=e+r),n};var r={high:0,low:0};n.fromCartesian=function(e,a){t(a)||(a=new n);var i=a.high,o=a.low;return n.encode(e.x,r),i.x=r.high,o.x=r.low,n.encode(e.y,r),i.y=r.high,o.y=r.low,n.encode(e.z,r),i.z=r.high,o.z=r.low,a};var a=new n;return n.writeElements=function(e,t,r){n.fromCartesian(e,a);var i=a.high,o=a.low;t[r]=i.x,t[r+1]=i.y,t[r+2]=i.z,t[r+3]=o.x,t[r+4]=o.y,t[r+5]=o.z},n}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,n,r){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=r.clone(e(t.modelMatrix,r.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return a}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,n,a){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,a):new Uint16Array(t,n,a)},n(a)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function n(e,n,r){var a=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(n)))<r?0:a}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,a){var i;if(0===e)return 0===r?[]:[-a/r];if(0===r){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-r/e,0>i?[i,0]:[0,i];var c=r*r,l=4*e*a,f=n(c,-l,t.EPSILON14);if(0>f)return[];var h=-.5*n(r,t.sign(r)*Math.sqrt(f),t.EPSILON14);return r>0?[h/e,a/h]:[a/h,h/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var a,i,o=e,u=t/3,s=n/3,c=r,l=o*s,f=u*c,h=u*u,d=s*s,p=o*s-h,m=o*c-u*s,y=u*c-d,v=4*p*y-m*m;if(0>v){var g,w,x;h*f>=l*d?(g=o,w=p,x=-2*u*p+o*m):(g=c,w=y,x=-c*m+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var O=i/2,T=0>O?-Math.pow(-O,1/3):Math.pow(O,1/3),M=i===S?-T:-w/T;return a=0>=w?T+M:-x/(T*T+M*M+w),h*f>=l*d?[(a-u)/o]:[-c/(a+s)]}var _=p,P=-2*u*p+o*m,b=y,N=-c*m+2*s*y,A=Math.sqrt(v),I=Math.sqrt(3)/2,C=Math.abs(Math.atan2(o*A,-P)/3);a=2*Math.sqrt(-_);var R=Math.cos(C);i=a*R;var z=a*(-R/2-I*Math.sin(C)),D=i+z>2*u?i-u:z-u,L=o,q=D/L;C=Math.abs(Math.atan2(c*A,-N)/3),a=2*Math.sqrt(-b),R=Math.cos(C),i=a*R,z=a*(-R/2-I*Math.sin(C));var U=-c,B=2*s>i+z?i+s:z+s,F=U/B,W=L*B,G=-D*B-L*U,k=D*U,V=(s*G-u*k)/(-u*G+s*W);return V>=q?F>=q?F>=V?[q,V,F]:[q,F,V]:[F,q,V]:F>=q?[V,q,F]:F>=V?[V,F,q]:[F,V,q]}var r={};return r.computeDiscriminant=function(e,t,n,r){var a=e*e,i=t*t,o=n*n,u=r*r,s=18*e*t*n*r+i*o-27*a*u-4*(e*o*n+i*t*r);return s},r.computeRealRoots=function(e,r,a,i){var o,u;if(0===e)return t.computeRealRoots(r,a,i);if(0===r){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,a,i)}return 0===a?0===i?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,i):0===i?(o=t.computeRealRoots(e,r,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,a,i)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var h=-t/4,d=f[f.length-1];if(Math.abs(d)<n.EPSILON14){var p=r.computeRealRoots(1,s,l);if(2===p.length){var m,y=p[0],v=p[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[h-w,h-g,h+g,h+w]}if(y>=0&&0>v)return m=Math.sqrt(y),[h-m,h+m];if(0>y&&v>=0)return m=Math.sqrt(v),[h-m,h+m]}return[]}if(d>0){var x=Math.sqrt(d),E=(s+d-c/x)/2,S=(s+d+c/x)/2,O=r.computeRealRoots(1,x,E),T=r.computeRealRoots(1,-x,S);return 0!==O.length?(O[0]+=h,O[1]+=h,0!==T.length?(T[0]+=h,T[1]+=h,O[1]<=T[0]?[O[0],O[1],T[0],T[1]]:T[1]<=O[0]?[T[0],T[1],O[0],O[1]]:O[0]>=T[0]&&O[1]<=T[1]?[T[0],O[0],O[1],T[1]]:T[0]>=O[0]&&T[1]<=O[1]?[O[0],T[0],T[1],O[1]]:O[0]>T[0]&&O[0]<T[1]?[T[0],O[0],T[1],O[1]]:[O[0],T[0],O[1],T[1]]):O):0!==T.length?(T[0]+=h,T[1]+=h,T):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,f=i*t+s-4*o,h=c*o-i*a*t+u,d=e.computeRealRoots(1,l,f,h);if(d.length>0){var p,m,y=d[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),O=c-4*y,T=c+4*Math.abs(y);if(0>y||O*S>E*T){var M=Math.sqrt(O);p=M/2,m=0===M?0:(t*x-i)/M}else{var _=Math.sqrt(E);p=0===_?0:(t*x-i)/_,m=_/2}var P,b;0===w&&0===p?(P=0,b=0):n.sign(w)===n.sign(p)?(P=w+p,b=y/P):(b=w-p,P=y/b);var N,A;0===x&&0===m?(N=0,A=0):n.sign(x)===n.sign(m)?(N=x+m,A=o/N):(A=x-m,N=o/A);var I=r.computeRealRoots(1,P,N),C=r.computeRealRoots(1,b,A);if(0!==I.length)return 0!==C.length?I[1]<=C[0]?[I[0],I[1],C[0],C[1]]:C[1]<=I[0]?[C[0],C[1],I[0],I[1]]:I[0]>=C[0]&&I[1]<=C[1]?[C[0],I[0],I[1],C[1]]:C[0]>=I[0]&&C[1]<=I[1]?[I[0],C[0],C[1],I[1]]:I[0]>C[0]&&I[0]<C[1]?[C[0],I[0],C[1],I[1]]:[I[0],C[0],I[1],C[1]]:I;if(0!==C.length)return C}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=n*n,l=c*n,f=r*r,h=f*r,d=a*a,p=d*a,m=u*c*f-4*s*h-4*e*l*f+18*e*t*n*h-27*i*f*f+256*o*p+a*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*f+144*i*n*f)+d*(144*e*u*n-27*u*u-128*i*c-192*i*t*r);return m},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,f=u/t,h=s/t,d=0>c?1:0;switch(d+=0>l?d+1:d,d+=0>f?d+1:d,d+=0>h?d+1:d){case 0:return a(c,l,f,h);case 1:return i(c,l,f,h);case 2:return i(c,l,f,h);case 3:return a(c,l,f,h);case 4:return a(c,l,f,h);case 5:return i(c,l,f,h);case 6:return a(c,l,f,h);case 7:return a(c,l,f,h);case 8:return i(c,l,f,h);case 9:return a(c,l,f,h);case 10:return a(c,l,f,h);case 11:return i(c,l,f,h);case 12:return a(c,l,f,h);case 13:return a(c,l,f,h);case 14:return a(c,l,f,h);case 15:return a(c,l,f,h);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,a){return n(a)||(a=new e),a=e.multiplyByScalar(t.direction,r,a),e.add(t.origin,a,a)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(t,r,a,o,u){u=n(u,!1);var s,c,l,f,h,d=t.origin,p=t.direction,m=e.subtract(a,r,y),E=e.subtract(o,r,v),S=e.cross(p,E,g),O=e.dot(m,S);if(u){if(O<i.EPSILON6)return void 0;if(s=e.subtract(d,r,w),l=e.dot(s,S),0>l||l>O)return void 0;if(c=e.cross(s,m,x),f=e.dot(p,c),0>f||l+f>O)return void 0;h=e.dot(E,c)/O}else{if(Math.abs(O)<i.EPSILON6)return void 0;var T=1/O;if(s=e.subtract(d,r,w),l=e.dot(s,S)*T,0>l||l>1)return void 0;if(c=e.cross(s,m,x),f=e.dot(p,c)*T,0>f||l+f>1)return void 0;h=e.dot(E,c)*T}return h}function f(e,t,n,r){var a=t*t-4*e*n;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function h(t,n,a){r(a)||(a={});var i=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(i,u,g),l=e.dot(o,o),h=2*e.dot(o,c),d=e.magnitudeSquared(c)-s,p=f(l,h,d,S);return r(p)?(a.start=p.root0,a.stop=p.root1,a):void 0}function d(e,t,n){var r=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function p(t,n,r,a,c){var l,f=a*a,h=c*c,p=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*h,m=c*(a*d(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*h+a*n.x+r,v=h*d(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*d(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(p,m,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],O=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-O)),w.push(new e(a,c*S,c*O))}return w}var T=g*g,M=v*v,_=p*p,P=g*v,b=_+M,N=2*(m*p+P),A=2*y*p+m*m-M+T,I=2*(y*m-P),C=y*y-T;if(0===b&&0===N&&0===A&&0===I)return w;l=s.computeRealRoots(b,N,A,I,C);var R=l.length;if(0===R)return w;for(var z=0;R>z;++z){var D,L=l[z],q=L*L,U=Math.max(1-q,0),B=Math.sqrt(U);D=i.sign(p)===i.sign(y)?d(p*q+y,m*L,i.EPSILON12):i.sign(y)===i.sign(m*L)?d(p*q,m*L+y,i.EPSILON12):d(p*q+m*L,y,i.EPSILON12);var F=d(v*L,g,i.EPSILON15),W=D*F;0>W?w.push(new e(a,c*L,c*B)):W>0?w.push(new e(a,c*L,c*-B)):0!==B?(w.push(new e(a,c*L,c*-B)),w.push(new e(a,c*L,c*B)),++z):w.push(new e(a,c*L,c*B))}return w}var m={};m.rayPlane=function(t,n,a){r(a)||(a=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;m.rayTriangle=function(t,n,a,i,o,u){var s=l(t,n,a,i,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;m.lineSegmentTriangle=function(t,n,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,a,i,o,u);return!r(f)||0>f||f>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};m.raySphere=function(e,t,n){return n=h(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var O=new c;m.lineSegmentSphere=function(t,n,a,i){var o=O;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=h(o,a,i),!r(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var T=new e,M=new e;m.rayEllipsoid=function(t,n){var r,a,i,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,T),l=e.multiplyComponents(s,t.direction,M),f=e.magnitudeSquared(c),h=e.dot(c,l);if(f>1){if(h>=0)return void 0;var d=h*h;if(r=f-1,a=e.magnitudeSquared(l),i=a*r,i>d)return void 0;if(d>i){o=h*h-i,u=-h+Math.sqrt(o);var p=u/a,m=r/u;return m>p?{start:p,stop:m}:{start:m,stop:p}}var y=Math.sqrt(r/a);return{start:y,stop:y}}return 1>f?(r=f-1,a=e.magnitudeSquared(l),i=a*r,o=h*h-i,u=-h+Math.sqrt(o),{start:0,stop:u/a}):0>h?(a=e.magnitudeSquared(l),{start:0,stop:-h/a}):void 0};var _=new e,P=new e,b=new e,N=new e,A=new e,I=new o,C=new o,R=new o,z=new o,D=new o,L=new o,q=new o,U=new e,B=new e,F=new t;m.grazingAltitudeLocation=function(t,n){var a=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(a,_);if(e.dot(u,s)>=0)return a;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,_),f=e.normalize(l,l),h=e.mostOrthogonalAxis(l,N),d=e.normalize(e.cross(h,f,P),P),m=e.normalize(e.cross(f,d,b),b),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=d.x,y[4]=d.y,y[5]=d.z,y[6]=m.x,y[7]=m.y,y[8]=m.z;var v=o.transpose(y,C),g=o.fromScale(n.radii,R),w=o.fromScale(n.oneOverRadii,z),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,O=o.multiply(o.multiply(v,w,L),x,L),T=o.multiply(o.multiply(O,g,q),y,q),M=o.multiplyByVector(O,a,A),W=p(T,e.negate(M,_),0,0,1),G=W.length;if(G>0){for(var k=e.clone(e.ZERO,B),V=Number.NEGATIVE_INFINITY,Y=0;G>Y;++Y){E=o.multiplyByVector(g,o.multiplyByVector(y,W[Y],U),U);var j=e.normalize(e.subtract(E,a,N),N),H=e.dot(j,u);H>V&&(V=H,k=e.clone(E,k))}var Z=n.cartesianToCartographic(k,F);return V=i.clamp(V,0,1),S=e.magnitude(e.subtract(k,a,N))*Math.sqrt(1-V*V),S=c?-S:S,Z.height=S,n.cartographicToCartesian(Z,new e)}return void 0};var W=new e;return m.lineSegmentPlane=function(t,n,a,o){r(o)||(o=new e);var u=e.subtract(n,t,W),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(a.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},m.trianglePlaneIntersection=function(t,n,r,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,n)+o<0,c=e.dot(i,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,h;if((1===l||2===l)&&(f=new e,h=new e),1===l){if(u)return m.lineSegmentPlane(t,n,a,f),m.lineSegmentPlane(t,r,a,h),{positions:[t,n,r,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(s)return m.lineSegmentPlane(n,r,a,f),m.lineSegmentPlane(n,t,a,h),{positions:[t,n,r,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return m.lineSegmentPlane(r,t,a,f),m.lineSegmentPlane(r,n,a,h),{positions:[t,n,r,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return m.lineSegmentPlane(n,t,a,f),m.lineSegmentPlane(r,t,a,h),{positions:[t,n,r,f,h],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return m.lineSegmentPlane(r,n,a,f),m.lineSegmentPlane(t,n,a,h),{positions:[t,n,r,f,h],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return m.lineSegmentPlane(t,r,a,f),m.lineSegmentPlane(n,r,a,h),{positions:[t,n,r,f,h],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},m}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};return n.calculateACMR=function(n){n=e(n,e.EMPTY_OBJECT);var r=n.indices,a=n.maximumIndex,i=e(n.cacheSize,24),o=r.length;if(!t(a)){a=0;for(var u=0,s=r[u];o>u;)s>a&&(a=s),++u,s=r[u]}for(var c=[],l=0;a+1>l;l++)c[l]=0;for(var f=i+1,h=0;o>h;++h)f-c[r[h]]>i&&(c[r[h]]=f,++f);return(f-i+1)/(o/3)},n.tipsify=function(n){function r(e,t,n,r){for(;t.length>=1;){var a=t[t.length-1];if(t.splice(t.length-1,1),e[a].numLiveTriangles>0)return a}for(;r>i;){if(e[i].numLiveTriangles>0)return++i,i-1;++i}return-1}function a(e,t,n,a,i,o,u){for(var s,c=-1,l=-1,f=0;f<n.length;){var h=n[f];a[h].numLiveTriangles&&(s=0,i-a[h].timeStamp+2*a[h].numLiveTriangles<=t&&(s=i-a[h].timeStamp),(s>l||-1===l)&&(l=s,c=h)),++f}return-1===c?r(a,o,e,u):c}n=e(n,e.EMPTY_OBJECT);var i,o=n.indices,u=n.maximumIndex,s=e(n.cacheSize,24),c=o.length,l=0,f=0,h=o[f],d=c;if(t(u))l=u+1;else{for(;d>f;)h>l&&(l=h),++f,h=o[f];if(-1===l)return 0;++l}for(var p=[],m=0;l>m;m++)p[m]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var y=0;d>f;)p[o[f]].vertexTriangles.push(y),++p[o[f]].numLiveTriangles,p[o[f+1]].vertexTriangles.push(y),++p[o[f+1]].numLiveTriangles,p[o[f+2]].vertexTriangles.push(y),++p[o[f+2]].numLiveTriangles,++y,f+=3;var v=0,g=s+1;i=1;var w,x,E=[],S=[],O=0,T=[],M=c/3,_=[];for(m=0;M>m;m++)_[m]=!1;for(var P,b;-1!==v;){E=[],x=p[v],b=x.vertexTriangles.length;for(var N=0;b>N;++N)if(y=x.vertexTriangles[N],!_[y]){_[y]=!0,f=y+y+y;for(var A=0;3>A;++A)P=o[f],E.push(P),S.push(P),T[O]=P,++O,w=p[P],--w.numLiveTriangles,g-w.timeStamp>s&&(w.timeStamp=g,++g),++f}v=a(o,s,E,p,g,S,l)}return T},n}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,p,m,y,v,g,w,x,E,S,O,T,M){"use strict";function _(e,t,n,r,a){e[t++]=n,e[t++]=r,e[t++]=r,e[t++]=a,e[t++]=a,e[t]=n}function P(e){for(var t=e.length,n=6*(t/3),r=v.createTypedArray(t,n),a=0,i=0;t>i;i+=3,a+=6)_(r,a,e[i],e[i+1],e[i+2]);return r}function b(e){var t=e.length;if(t>=3){var n=6*(t-2),r=v.createTypedArray(t,n);_(r,0,e[0],e[1],e[2]);for(var a=6,i=3;t>i;++i,a+=6)_(r,a,e[i-1],e[i],e[i-2]);return r}return new Uint16Array}function N(e){if(e.length>0){for(var t=e.length-1,n=6*(t-1),r=v.createTypedArray(t,n),a=e[0],i=0,o=1;t>o;++o,i+=6)_(r,i,a,e[o],e[o+1]);return r}return new Uint16Array}function A(e){var t={};for(var n in e)if(e.hasOwnProperty(n)&&c(e[n])&&c(e[n].values)){var r=e[n];t[n]=new p({componentDatatype:r.componentDatatype,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize,values:[]})}return t}function I(e,t,n){for(var r in t)if(t.hasOwnProperty(r)&&c(t[r])&&c(t[r].values))for(var a=t[r],i=0;i<a.componentsPerAttribute;++i)e[r].values.push(a.values[n*a.componentsPerAttribute+i])}function C(e,t){if(c(t))for(var n=t.values,r=n.length,i=0;r>i;i+=3)a.unpack(n,i,it),S.multiplyByPoint(e,it,it),a.pack(it,n,i)}function R(e,t){if(c(t))for(var n=t.values,r=n.length,i=0;r>i;i+=3)a.unpack(n,i,it),E.multiplyByVector(e,it,it),it=a.normalize(it,it),a.pack(it,n,i)}function z(e,t){var n,r=e.length,a={},i=e[0][t].attributes;for(n in i)if(i.hasOwnProperty(n)&&c(i[n])&&c(i[n].values)){for(var o=i[n],s=o.values.length,l=!0,f=1;r>f;++f){var h=e[f][t].attributes[n];if(!c(h)||o.componentDatatype!==h.componentDatatype||o.componentsPerAttribute!==h.componentsPerAttribute||o.normalize!==h.normalize){l=!1;break}s+=h.values.length}l&&(a[n]=new p({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return a}function D(e,t){var r,i,o,u,s=e.length;e[0].modelMatrix;var l,f,h,p=c(e[0][t].indices),m=e[0][t].primitiveType,y=z(e,t);for(r in y)if(y.hasOwnProperty(r))for(l=y[r].values,u=0,i=0;s>i;++i)for(f=e[i][t].attributes[r].values,h=f.length,o=0;h>o;++o)l[u++]=f[o];var g;if(p){var w=0;for(i=0;s>i;++i)w+=e[i][t].indices.length;var x=d.computeNumberOfVertices(new d({attributes:y,primitiveType:T.POINTS})),E=v.createTypedArray(x,w),S=0,O=0;for(i=0;s>i;++i){var M=e[i][t].indices,_=M.length;for(u=0;_>u;++u)E[S++]=O+M[u];O+=d.computeNumberOfVertices(e[i][t])}g=E}var P,b=new a,N=0;for(i=0;s>i;++i){if(P=e[i][t].boundingSphere,!c(P)){b=void 0;break}a.add(P.center,b,b)}if(c(b))for(a.divideByScalar(b,s,b),i=0;s>i;++i){P=e[i][t].boundingSphere;var A=a.magnitude(a.subtract(P.center,b,st))+P.radius;A>N&&(N=A)}return new d({attributes:y,indices:g,primitiveType:m,boundingSphere:c(b)?new n(b,N):void 0})}function L(e){if(c(e.indices))return e;for(var t=d.computeNumberOfVertices(e),n=v.createTypedArray(t,t),r=0;t>r;++r)n[r]=r;return e.indices=n,e}function q(e){var t=d.computeNumberOfVertices(e),n=v.createTypedArray(t,3*(t-2));n[0]=1,n[1]=0,n[2]=2;for(var r=3,a=3;t>a;++a)n[r++]=a-1,n[r++]=0,n[r++]=a;return e.indices=n,e.primitiveType=T.TRIANGLES,e}function U(e){var t=d.computeNumberOfVertices(e),n=v.createTypedArray(t,3*(t-2));n[0]=0,n[1]=1,n[2]=2,t>3&&(n[3]=0,n[4]=2,n[5]=3);for(var r=6,a=3;t-1>a;a+=2)n[r++]=a,n[r++]=a-1,n[r++]=a+1,t>a+2&&(n[r++]=a,n[r++]=a+1,n[r++]=a+2);return e.indices=n,e.primitiveType=T.TRIANGLES,e}function B(e){if(c(e.indices))return e;for(var t=d.computeNumberOfVertices(e),n=v.createTypedArray(t,t),r=0;t>r;++r)n[r]=r;return e.indices=n,e}function F(e){var t=d.computeNumberOfVertices(e),n=v.createTypedArray(t,2*(t-1));n[0]=0,n[1]=1;for(var r=2,a=2;t>a;++a)n[r++]=a-1,n[r++]=a;return e.indices=n,e.primitiveType=T.LINES,e}function W(e){var t=d.computeNumberOfVertices(e),n=v.createTypedArray(t,2*t);n[0]=0,n[1]=1;for(var r=2,a=2;t>a;++a)n[r++]=a-1,n[r++]=a;return n[r++]=t-1,n[r]=0,e.indices=n,e.primitiveType=T.LINES,e}function G(e){switch(e.primitiveType){case T.TRIANGLE_FAN:return q(e);case T.TRIANGLE_STRIP:return U(e);case T.TRIANGLES:return L(e);case T.LINE_STRIP:return F(e);case T.LINE_LOOP:return W(e);case T.LINES:return B(e)}return e}function k(e,t){Math.abs(e.y)<x.EPSILON6&&(e.y=t?-x.EPSILON6:x.EPSILON6)}function V(e,t,n){if(0!==e.y&&0!==t.y&&0!==n.y)return k(e,e.y<0),k(t,t.y<0),k(n,n.y<0),void 0;var r,a=Math.abs(e.y),i=Math.abs(t.y),o=Math.abs(n.y);r=a>i?a>o?x.sign(e.y):x.sign(n.y):i>o?x.sign(t.y):x.sign(n.y);var u=0>r;k(e,u),k(t,u),k(n,u)}function Y(e,t,n,r){a.add(e,a.multiplyByScalar(a.subtract(t,e,xt),e.y/(e.y-t.y),xt),n),a.clone(n,r),k(n,!0),k(r,!1)}function j(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return void 0;V(e,t,n);var r=e.y<0,a=t.y<0,i=n.y<0,o=0;o+=r?1:0,o+=a?1:0,o+=i?1:0;var u=Mt.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,r?(Y(e,t,Et,Ot),Y(e,n,St,Tt),u[0]=0,u[3]=1,u[4]=2,u[6]=1):a?(Y(t,n,Et,Ot),Y(t,e,St,Tt),u[0]=1,u[3]=2,u[4]=0,u[6]=2):i&&(Y(n,e,Et,Ot),Y(n,t,St,Tt),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,r?a?i||(Y(n,e,Et,Ot),Y(n,t,St,Tt),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(Y(t,n,Et,Ot),Y(t,e,St,Tt),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(Y(e,t,Et,Ot),Y(e,n,St,Tt),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=Mt.positions;return s[0]=e,s[1]=t,s[2]=n,s.length=3,(1===o||2===o)&&(s[3]=Et,s[4]=St,s[5]=Ot,s[6]=Tt,s.length=7),Mt}function H(e,t){var r=e.attributes;if(0===r.position.values.length)return void 0;for(var a in r)if(r.hasOwnProperty(a)&&c(r[a])&&c(r[a].values)){var i=r[a];i.values=u.createTypedArray(i.componentDatatype,i.values)}var o=d.computeNumberOfVertices(e);return e.indices=v.createTypedArray(o,e.indices),t&&(e.boundingSphere=n.fromVertices(r.position.values)),e}function Z(e){var t=e.attributes,n={};for(var r in t)if(t.hasOwnProperty(r)&&c(t[r])&&c(t[r].values)){var a=t[r];n[r]=new p({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:[]})}return new d({attributes:n,indices:[],primitiveType:e.primitiveType})}function X(e,t,n){var r=c(e.geometry.boundingSphere);t=H(t,r),n=H(n,r),c(n)&&!c(t)?e.geometry=n:!c(n)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function J(e,n,i,o,u,s,l,f,h,d,p){if(c(s)||c(l)||c(f)||c(h)){var m=a.fromArray(u,3*e,_t),y=a.fromArray(u,3*n,Pt),v=a.fromArray(u,3*i,bt),g=t(o,m,y,v,Nt);if(c(s)){var w=a.fromArray(s,3*e,_t),x=a.fromArray(s,3*n,Pt),E=a.fromArray(s,3*i,bt);a.multiplyByScalar(w,g.x,w),a.multiplyByScalar(x,g.y,x),a.multiplyByScalar(E,g.z,E);var S=a.add(w,x,w);a.add(S,E,S),a.normalize(S,S),a.pack(S,d.normal.values,3*p)}if(c(l)){var O=a.fromArray(l,3*e,_t),T=a.fromArray(l,3*n,Pt),M=a.fromArray(l,3*i,bt);a.multiplyByScalar(O,g.x,O),a.multiplyByScalar(T,g.y,T),a.multiplyByScalar(M,g.z,M);var _=a.add(O,T,O);a.add(_,M,_),a.normalize(_,_),a.pack(_,d.binormal.values,3*p)}if(c(f)){var P=a.fromArray(f,3*e,_t),b=a.fromArray(f,3*n,Pt),N=a.fromArray(f,3*i,bt);a.multiplyByScalar(P,g.x,P),a.multiplyByScalar(b,g.y,b),a.multiplyByScalar(N,g.z,N);var A=a.add(P,b,P);a.add(A,N,A),a.normalize(A,A),a.pack(A,d.tangent.values,3*p)}if(c(h)){var I=r.fromArray(h,2*e,At),C=r.fromArray(h,2*n,It),R=r.fromArray(h,2*i,Ct);r.multiplyByScalar(I,g.x,I),r.multiplyByScalar(C,g.y,C),r.multiplyByScalar(R,g.z,R);var z=r.add(I,C,I);r.add(z,R,z),r.pack(z,d.st.values,2*p)}}}function K(e,t,n,r,a,i){var o=e.position.values.length/3;if(-1!==a){var u=r[a],s=n[u];return-1===s?(n[u]=o,e.position.values.push(i.x,i.y,i.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(i.x,i.y,i.z),t.push(o),o}function Q(e){var t,n,r,i,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,h=c(s.binormal)?s.binormal.values:void 0,d=c(s.tangent)?s.tangent.values:void 0,p=c(s.st)?s.st.values:void 0,m=u.indices,y=Z(u),v=Z(u),g=[];g.length=l.length/3;var w=[];for(w.length=l.length/3,o=0;o<g.length;++o)g[o]=-1,w[o]=-1;var x=m.length;for(o=0;x>o;o+=3){var E=m[o],S=m[o+1],O=m[o+2],T=a.fromArray(l,3*E),M=a.fromArray(l,3*S),_=a.fromArray(l,3*O),P=j(T,M,_);if(c(P)&&P.positions.length>3)for(var b=P.positions,N=P.indices,A=N.length,I=0;A>I;++I){var C=N[I],R=b[C];R.y<0?(t=v.attributes,n=v.indices,r=g):(t=y.attributes,n=y.indices,r=w),i=K(t,n,r,m,3>C?o+C:-1,R),J(E,S,O,R,l,f,h,d,p,t,i)}else c(P)&&(T=P.positions[0],M=P.positions[1],_=P.positions[2]),T.y<0?(t=v.attributes,n=v.indices,r=g):(t=y.attributes,n=y.indices,r=w),i=K(t,n,r,m,o,T),J(E,S,O,T,l,f,h,d,p,t,i),i=K(t,n,r,m,o+1,M),J(E,S,O,M,l,f,h,d,p,t,i),i=K(t,n,r,m,o+2,_),J(E,S,O,_,l,f,h,d,p,t,i)}X(e,v,y)}function $(e){var t,n=e.geometry,r=n.attributes,i=r.position.values,o=n.indices,u=Z(n),s=Z(n),l=o.length,f=[];f.length=i.length/3;var h=[];for(h.length=i.length/3,t=0;t<f.length;++t)f[t]=-1,h[t]=-1;for(t=0;l>t;t+=2){var d=o[t],p=o[t+1],m=a.fromArray(i,3*d,_t),y=a.fromArray(i,3*p,Pt);Math.abs(m.y)<x.EPSILON6&&(m.y=m.y<0?-x.EPSILON6:x.EPSILON6),Math.abs(y.y)<x.EPSILON6&&(y.y=y.y<0?-x.EPSILON6:x.EPSILON6);var v=u.attributes,g=u.indices,E=h,S=s.attributes,O=s.indices,T=f,M=w.lineSegmentPlane(m,y,Rt,bt);if(c(M)){var _=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,zt);m.y<0&&(a.negate(_,_),v=s.attributes,g=s.indices,E=f,S=u.attributes,O=u.indices,T=h);var P=a.add(M,_,Dt);K(v,g,E,o,t,m),K(v,g,E,o,-1,P),a.negate(_,_),a.add(M,_,P),K(S,O,T,o,-1,P),K(S,O,T,o,t+1,y)}else{var b,N,A;m.y<0?(b=s.attributes,N=s.indices,A=f):(b=u.attributes,N=u.indices,A=h),K(b,N,A,o,t,m),K(b,N,A,o,t+1,y)}}X(e,s,u)}function et(e){var t=e.geometry,n=t.attributes,o=n.position.values,u=n.prevPosition.values,s=n.nextPosition.values,l=n.expandAndWidth.values;t.indices;var f,h,d,p=c(n.st)?n.st.values:void 0,m=c(n.color)?n.color.values:void 0,y=Z(t),v=Z(t),g=o.length/3;for(f=0;g>f;f+=4){var E=f,S=f+1,O=f+2,T=f+3,M=a.fromArray(o,3*E,Ut),_=a.fromArray(o,3*S,Bt),P=a.fromArray(o,3*O,Ft),b=a.fromArray(o,3*T,Wt);Math.abs(M.y)<x.EPSILON6&&(M.y=x.EPSILON6*(P.y<0?-1:1),_.y=M.y),Math.abs(P.y)<x.EPSILON6&&(P.y=x.EPSILON6*(M.y<0?-1:1),b.y=P.y);var N=y.attributes,A=y.indices,I=v.attributes,C=v.indices,R=w.lineSegmentPlane(M,P,Rt,Gt);if(c(R)){var z=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,kt);M.y<0&&(a.negate(z,z),N=v.attributes,A=v.indices,I=y.attributes,C=y.indices);var D=a.add(R,z,Vt);for(N.position.values.push(M.x,M.y,M.z,_.x,_.y,_.z),N.position.values.push(D.x,D.y,D.z),N.position.values.push(D.x,D.y,D.z),a.negate(z,z),a.add(R,z,D),I.position.values.push(D.x,D.y,D.z),I.position.values.push(D.x,D.y,D.z),I.position.values.push(P.x,P.y,P.z,b.x,b.y,b.z),h=3*E;3*E+6>h;++h)N.prevPosition.values.push(u[h]);for(N.prevPosition.values.push(M.x,M.y,M.z,M.x,M.y,M.z),I.prevPosition.values.push(M.x,M.y,M.z,M.x,M.y,M.z),h=3*O;3*O+6>h;++h)I.prevPosition.values.push(u[h]);for(h=3*E;3*E+6>h;++h)N.nextPosition.values.push(s[h]);for(N.nextPosition.values.push(P.x,P.y,P.z,P.x,P.y,P.z),I.nextPosition.values.push(P.x,P.y,P.z,P.x,P.y,P.z),h=3*O;3*O+6>h;++h)I.nextPosition.values.push(s[h]);var L=r.fromArray(l,2*E,Lt),q=Math.abs(L.y);N.expandAndWidth.values.push(-1,q,1,q),N.expandAndWidth.values.push(-1,-q,1,-q),I.expandAndWidth.values.push(-1,q,1,q),I.expandAndWidth.values.push(-1,-q,1,-q);var U=a.magnitudeSquared(a.subtract(R,M,Wt));if(U/=a.magnitudeSquared(a.subtract(P,M,Wt)),c(m)){var B=i.fromArray(m,4*E,Yt),F=i.fromArray(m,4*O,Yt),W=x.lerp(B.x,F.x,U),G=x.lerp(B.y,F.y,U),k=x.lerp(B.z,F.z,U),V=x.lerp(B.w,F.w,U);for(h=4*E;4*E+8>h;++h)N.color.values.push(m[h]);for(N.color.values.push(W,G,k,V),N.color.values.push(W,G,k,V),I.color.values.push(W,G,k,V),I.color.values.push(W,G,k,V),h=4*O;4*O+8>h;++h)I.color.values.push(m[h])}if(c(p)){var Y=r.fromArray(p,2*E,Lt),j=r.fromArray(p,2*(f+3),qt),H=x.lerp(Y.x,j.x,U);for(h=2*E;2*E+4>h;++h)N.st.values.push(p[h]);for(N.st.values.push(H,Y.y),N.st.values.push(H,j.y),I.st.values.push(H,Y.y),I.st.values.push(H,j.y),h=2*O;2*O+4>h;++h)I.st.values.push(p[h])}d=N.position.values.length/3-4,A.push(d,d+2,d+1),A.push(d+1,d+2,d+3),d=I.position.values.length/3-4,C.push(d,d+2,d+1),C.push(d+1,d+2,d+3) -}else{var J,K;for(M.y<0?(J=v.attributes,K=v.indices):(J=y.attributes,K=y.indices),J.position.values.push(M.x,M.y,M.z),J.position.values.push(_.x,_.y,_.z),J.position.values.push(P.x,P.y,P.z),J.position.values.push(b.x,b.y,b.z),h=3*f;3*f+12>h;++h)J.prevPosition.values.push(u[h]),J.nextPosition.values.push(s[h]);for(h=2*f;2*f+8>h;++h)J.expandAndWidth.values.push(l[h]),c(p)&&J.st.values.push(p[h]);if(c(m))for(h=4*f;4*f+16>h;++h)J.color.values.push(m[h]);d=J.position.values.length/3-4,K.push(d,d+2,d+1),K.push(d+1,d+2,d+3)}}X(e,v,y)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case T.TRIANGLES:e.indices=P(t);break;case T.TRIANGLE_STRIP:e.indices=b(t);break;case T.TRIANGLE_FAN:e.indices=N(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=T.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,r){t=s(t,"normal"),r=s(r,1e4);for(var a=e.attributes.position.values,i=e.attributes[t].values,o=a.length,l=new Float64Array(2*o),f=0,h=0;o>h;h+=3)l[f++]=a[h],l[f++]=a[h+1],l[f++]=a[h+2],l[f++]=a[h]+i[h]*r,l[f++]=a[h+1]+i[h+1]*r,l[f++]=a[h+2]+i[h+2]*r;var m,y=e.boundingSphere;return c(y)&&(m=new n(y.center,y.radius+r)),new d({attributes:{position:new p({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:T.LINES,boundingSphere:m})},tt.createAttributeLocations=function(e){var t,n=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],r=e.attributes,a={},i=0,o=n.length;for(t=0;o>t;++t){var u=n[t];c(r[u])&&(a[u]=i++)}for(var s in r)r.hasOwnProperty(s)&&!c(a[s])&&(a[s]=i++);return a},tt.reorderForPreVertexCache=function(e){var t=d.computeNumberOfVertices(e),n=e.indices;if(c(n)){for(var r=new Int32Array(t),a=0;t>a;a++)r[a]=-1;for(var i,o=n,s=o.length,l=v.createTypedArray(t,s),f=0,h=0,p=0;s>f;)i=r[o[f]],-1!==i?l[h]=i:(i=o[f],r[i]=p,l[h]=p,++p),++f,++h;e.indices=l;var m=e.attributes;for(var y in m)if(m.hasOwnProperty(y)&&c(m[y])&&c(m[y].values)){for(var g=m[y],w=g.values,x=0,E=g.componentsPerAttribute,S=u.createTypedArray(g.componentDatatype,p*E);t>x;){var O=r[x];if(-1!==O)for(a=0;E>a;a++)S[E*O+a]=w[E*x+a];++x}g.values=S}}return e},tt.reorderForPostVertexCache=function(e,t){var n=e.indices;if(e.primitiveType===T.TRIANGLES&&c(n)){for(var r=n.length,a=0,i=0;r>i;i++)n[i]>a&&(a=n[i]);e.indices=M.tipsify({indices:n,maximumIndex:a,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],n=d.computeNumberOfVertices(e);if(c(e.indices)&&n>x.SIXTY_FOUR_KILOBYTES){var r,a=[],i=[],o=0,u=A(e.attributes),s=e.indices,l=s.length;e.primitiveType===T.TRIANGLES?r=3:e.primitiveType===T.LINES?r=2:e.primitiveType===T.POINTS&&(r=1);for(var f=0;l>f;f+=r){for(var h=0;r>h;++h){var p=s[f+h],m=a[p];c(m)||(m=o++,a[p]=m,I(u,e.attributes,p)),i.push(m)}o+r>x.SIXTY_FOUR_KILOBYTES&&(t.push(new d({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],i=[],o=0,u=A(e.attributes))}0!==i.length&&t.push(new d({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var nt=new a,rt=new o;tt.projectTo2D=function(e,t,n,r,i){var o=e.attributes[t];i=c(i)?i:new h;for(var s=i.ellipsoid,f=o.values,d=new Float64Array(f.length),m=0,y=0;y<f.length;y+=3){var v=a.fromArray(f,y,nt),g=s.cartesianToCartographic(v,rt);if(!c(g))throw new l("Could not project point ("+v.x+", "+v.y+", "+v.z+") to 2D.");var w=i.project(g,nt);d[m++]=w.x,d[m++]=w.y,d[m++]=w.z}return e.attributes[n]=o,e.attributes[r]=new p({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:d}),delete e.attributes[t],e};var at={high:0,low:0};tt.encodeAttribute=function(e,t,n,r){for(var a=e.attributes[t],i=a.values,o=i.length,s=new Float32Array(o),c=new Float32Array(o),l=0;o>l;++l)f.encode(i[l],at),s[l]=at.high,c[l]=at.low;var h=a.componentsPerAttribute;return e.attributes[n]=new p({componentDatatype:u.FLOAT,componentsPerAttribute:h,values:s}),e.attributes[r]=new p({componentDatatype:u.FLOAT,componentsPerAttribute:h,values:c}),delete e.attributes[t],e};var it=new a,ot=new S,ut=new E;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(S.equals(t,S.IDENTITY))return e;var r=e.geometry.attributes;C(t,r.position),C(t,r.prevPosition),C(t,r.nextPosition),(c(r.normal)||c(r.binormal)||c(r.tangent))&&(S.inverse(t,ot),S.transpose(ot,ot),S.getRotation(ot,ut),R(ut,r.normal),R(ut,r.binormal),R(ut,r.tangent));var a=e.geometry.boundingSphere;return c(a)&&(e.geometry.boundingSphere=n.transform(a,t,a)),e.modelMatrix=S.clone(S.IDENTITY),e};var st=new a;tt.combineInstances=function(e){for(var t=[],n=[],r=e.length,a=0;r>a;++a){var i=e[a];c(i.geometry)?t.push(i):n.push(i)}var o=[];return t.length>0&&o.push(D(t,"geometry")),n.length>0&&(o.push(D(n,"westHemisphereGeometry")),o.push(D(n,"eastHemisphereGeometry"))),o};var ct=new a,lt=new a,ft=new a,ht=new a;tt.computeNormal=function(e){for(var t=e.indices,n=e.attributes,r=n.position.values,i=n.position.values.length/3,o=t.length,s=new Array(i),c=new Array(o/3),l=new Array(o),f=0;i>f;f++)s[f]={indexOffset:0,count:0,currentCount:0};var h=0;for(f=0;o>f;f+=3){var d=t[f],m=t[f+1],y=t[f+2],v=3*d,g=3*m,w=3*y;lt.x=r[v],lt.y=r[v+1],lt.z=r[v+2],ft.x=r[g],ft.y=r[g+1],ft.z=r[g+2],ht.x=r[w],ht.y=r[w+1],ht.z=r[w+2],s[d].count++,s[m].count++,s[y].count++,a.subtract(ft,lt,ft),a.subtract(ht,lt,ht),c[h]=a.cross(ft,ht,new a),h++}var x=0;for(f=0;i>f;f++)s[f].indexOffset+=x,x+=s[f].count;h=0;var E;for(f=0;o>f;f+=3){E=s[t[f]];var S=E.indexOffset+E.currentCount;l[S]=h,E.currentCount++,E=s[t[f+1]],S=E.indexOffset+E.currentCount,l[S]=h,E.currentCount++,E=s[t[f+2]],S=E.indexOffset+E.currentCount,l[S]=h,E.currentCount++,h++}var O=new Float32Array(3*i);for(f=0;i>f;f++){var T=3*f;if(E=s[f],E.count>0){for(a.clone(a.ZERO,ct),h=0;h<E.count;h++)a.add(ct,c[l[E.indexOffset+h]],ct);a.normalize(ct,ct),O[T]=ct.x,O[T+1]=ct.y,O[T+2]=ct.z}else O[T]=0,O[T+1]=0,O[T+2]=1}return e.attributes.normal=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:O}),e};var dt=new a,pt=new a,mt=new a;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,n=e.attributes.position.values,r=e.attributes.normal.values,i=e.attributes.st.values,o=e.attributes.position.values.length/3,s=t.length,c=new Array(3*o),l=0;l<c.length;l++)c[l]=0;var f,h,d;for(l=0;s>l;l+=3){var m=t[l],y=t[l+1],v=t[l+2];f=3*m,h=3*y,d=3*v;var g=2*m,w=2*y,x=2*v,E=n[f],S=n[f+1],O=n[f+2],T=i[g],M=i[g+1],_=i[w+1]-M,P=i[x+1]-M,b=1/((i[w]-T)*P-(i[x]-T)*_),N=(P*(n[h]-E)-_*(n[d]-E))*b,A=(P*(n[h+1]-S)-_*(n[d+1]-S))*b,I=(P*(n[h+2]-O)-_*(n[d+2]-O))*b;c[f]+=N,c[f+1]+=A,c[f+2]+=I,c[h]+=N,c[h+1]+=A,c[h+2]+=I,c[d]+=N,c[d+1]+=A,c[d+2]+=I}var C=new Float32Array(3*o),R=new Float32Array(3*o);for(l=0;o>l;l++){f=3*l,h=f+1,d=f+2;var z=a.fromArray(r,f,dt),D=a.fromArray(c,f,mt),L=a.dot(z,D);a.multiplyByScalar(z,L,pt),a.normalize(a.subtract(D,pt,D),D),R[f]=D.x,R[h]=D.y,R[d]=D.z,a.normalize(a.cross(z,D,D),D),C[f]=D.x,C[h]=D.y,C[d]=D.z}return e.attributes.tangent=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:R}),e.attributes.binormal=new p({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:C}),e};var yt=new r,vt=new a,gt=new a,wt=new a;tt.compressVertices=function(t){var n=t.attributes.normal,i=t.attributes.st;if(!c(n)&&!c(i))return t;var o,s,l,f,h=t.attributes.tangent,d=t.attributes.binormal;c(n)&&(o=n.values),c(i)&&(s=i.values),c(h)&&(l=h.values),d&&(f=d.values);var m=c(o)?o.length:s.length,y=c(o)?3:2,v=m/y,g=v,w=c(s)&&c(o)?2:1;w+=c(l)||c(f)?1:0,g*=w;for(var x=new Float32Array(g),E=0,S=0;v>S;++S){c(s)&&(r.fromArray(s,2*S,yt),x[E++]=e.compressTextureCoordinates(yt));var O=3*S;c(o)&&c(l)&&c(f)?(a.fromArray(o,O,vt),a.fromArray(l,O,gt),a.fromArray(f,O,wt),e.octPack(vt,gt,wt,yt),x[E++]=yt.x,x[E++]=yt.y):(c(o)&&(a.fromArray(o,O,vt),x[E++]=e.octEncodeFloat(vt)),c(l)&&(a.fromArray(l,O,vt),x[E++]=e.octEncodeFloat(vt)),c(f)&&(a.fromArray(f,O,vt),x[E++]=e.octEncodeFloat(vt)))}return t.attributes.compressedAttributes=new p({componentDatatype:u.FLOAT,componentsPerAttribute:w,values:x}),c(o)&&delete t.attributes.normal,c(s)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var xt=new a,Et=new a,St=new a,Ot=new a,Tt=new a,Mt={positions:new Array(7),indices:new Array(9)},_t=new a,Pt=new a,bt=new a,Nt=new a,At=new r,It=new r,Ct=new r,Rt=O.fromPointNormal(a.ZERO,a.UNIT_Y),zt=new a,Dt=new a,Lt=new r,qt=new r,Ut=new a,Bt=new a,Ft=new a,Wt=new a,Gt=new a,kt=new a,Vt=new a,Yt=new i;return new i,tt.splitLongitude=function(e){var t=e.geometry,r=t.boundingSphere;if(c(r)){var a=r.center.x-r.radius;if(a>0||n.intersectPlane(r,O.ORIGIN_ZX_PLANE)!==g.INTERSECTING)return e}if(t.geometryType!==y.NONE)switch(t.geometryType){case y.POLYLINES:et(e);break;case y.TRIANGLES:Q(e);break;case y.LINES:$(e)}else G(t),t.primitiveType===T.TRIANGLES?Q(e):t.primitiveType===T.LINES&&$(e);return e},tt}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,a,i,o){"use strict";var u=function(r,a,i){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),n(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var a=t[0].x,i=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,h=1;f>h;h++){var d=t[h],p=d.x,m=d.y,y=d.z;a=Math.min(p,a),s=Math.max(p,s),i=Math.min(m,i),c=Math.max(m,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=a,v.y=i,v.z=o;var g=r.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,r.center);return e.multiplyByScalar(w,.5,w),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),a=n.normal,o=r.x*Math.abs(a.x)+r.y*Math.abs(a.y)+r.z*Math.abs(a.z),u=e.dot(t.center,a)+n.distance;return u-o>0?i.INSIDE:0>u+o?i.OUTSIDE:i.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,a){return t(e).then(n,r,a)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=a(e),t}function n(t){return e(t,i)}function r(e){this.then=e}function a(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return i(r)}});return n}function i(e){var n=new r(function(n,r){try{return r?t(r(e)):i(e)}catch(a){return i(a)}});return n}function o(){function e(e,t,n){return h(e,t,n)}function n(e){return p(e)}function a(e){return p(i(e))}function u(e){return d(e)}var s,c,l,f,h,d,p;return c=new r(e),s={then:e,resolve:n,reject:a,progress:u,promise:c,resolver:{resolve:n,reject:a,progress:u}},l=[],f=[],h=function(e,t,n){var r,a;return r=o(),a="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,a)}),f.push(a),r.promise},d=function(e){return m(f,e),e},p=function(e){return e=t(e),h=e.then,p=t,d=v,m(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,a,i){return y(2,arguments),e(t,function(t){function u(e){m(e)}function s(e){p(e)}var c,l,f,h,d,p,m,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(n,g)),f=[],l=g-c+1,h=[],d=o(),c)for(y=d.progress,m=function(e){h.push(e),--l||(p=m=v,d.reject(h))},p=function(e){f.push(e),--c||(p=m=v,d.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else d.resolve(f);return d.then(r,a,i)})}function c(e,t,n,r){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,n,r)}function l(e,t,n,r){return y(1,arguments),h(e,g).then(t,n,r)}function f(){return h(arguments,g)}function h(t,n){return e(t,function(t){var r,a,i,u,s,c;if(i=a=t.length>>>0,r=[],c=o(),i)for(u=function(t,a){e(t,n).then(function(e){r[a]=e,--i||c.resolve(r)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(r);return c.promise})}function d(t,n){var r=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,r[0]=function(t,r,i){return e(t,function(t){return e(r,function(e){return n(t,e,i,a)})})},w.apply(t,r)})}function p(t,n,r){var a=arguments.length>2;return e(t,function(e){return e=a?r:e,n.resolve(e),e},function(e){return n.reject(e),i(e)},n.progress)}function m(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=n,e.join=f,e.all=l,e.map=h,e.reduce=d,e.any=c,e.some=s,e.chain=p,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,n,r,a,i;if(i=0,t=Object(this),a=t.length>>>0,n=arguments,n.length<=1)for(;;){if(i in t){r=t[i++];break}if(++i>=a)throw new TypeError}else r=n[1];for(;a>i;++i)i in t&&(r=e(r,t[i],i,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,a,i=0,o=e.length-1;o>=i;)if(r=~~((i+o)/2),a=n(e[r],t),0>a)i=r+1;else{if(!(a>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],a=function(e,t,n,r){n||(n=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+a:a+e},i=function(e,t,n,r,i,o){var u=r-e.length;return u>0&&(e=n||!i?a(e,r,o,n):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+a(c.toString(t),u||0,"0",!1),i(e,n,r,o,s)},u=function(e,t,n,r,a,o){return null!=r&&(e=e.slice(0,r)),i(e,"",t,n,a,o)},s=function(e,r,s,c,l,f,h){var d,p,m,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",O=s.length,T=0;s&&O>T;T++)switch(s.charAt(T)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(T+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[n++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(h)>-1?6:"d"==h?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],h){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return d=+v||0,d=Math.round(d-d%1),p=0>d?"-":w,v=p+a(String(Math.abs(d)),f,"0",!1),i(v,p,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return d=+v,p=0>d?"-":w,m=["toExponential","toFixed","toPrecision"]["efg".indexOf(h.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(h)%2],v=p+Math.abs(d)[m](f),i(v,p,g,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,a,i,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(e,t){return N.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var n=N.leapSeconds,r=t(n,g,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var a=n[r].offset;if(r>0){var i=N.secondsDifference(n[r].julianDate,e);i>a&&(r--,a=n[r].offset)}N.addSeconds(e,a,e)}function h(e,n){g.julianDate=e;var r=N.leapSeconds,a=t(r,g,l);if(0>a&&(a=~a),0===a)return N.addSeconds(e,-r[0].offset,n);if(a>=r.length)return N.addSeconds(e,-r[a-1].offset,n);var i=N.secondsDifference(r[a].julianDate,e);return 0===i?N.addSeconds(e,-r[a].offset,n):1>=i?void 0:N.addSeconds(e,-r[--a].offset,n)}function d(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function p(e,t,n,r,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var f=i+(r*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var m=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,O=/^(\d{4})-?(\d{2})-?(\d{2})$/,T=/([Z+\-])?(\d{2})?:?(\d{2})?$/,M=/^(\d{2})(\.\d+)?/.source+T.source,_=/^(\d{2}):?(\d{2})(\.\d+)?/.source+T.source,P=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+T.source,b="Invalid ISO 8601 date.",N=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,d(a,t,this),r===c.UTC&&f(this)};N.fromDate=function(e,t){var n=p(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(d(n[0],n[1],t),f(t),t):new N(n[0],n[1],c.UTC)},N.fromIso8601=function(e,t){e=e.replace(",",".");var n,i,u,s=e.split("T"),l=1,h=1,m=0,g=0,T=0,A=0,I=s[0],C=s[1];if(!r(I))throw new a(b);var R;if(s=I.match(O),null!==s){if(R=I.split("-").length-1,R>0&&2!==R)throw new a(b);n=+s[1],l=+s[2],h=+s[3]}else if(s=I.match(x),null!==s)n=+s[1],l=+s[2];else if(s=I.match(w),null!==s)n=+s[1];else{var z;if(s=I.match(E),null!==s){if(n=+s[1],z=+s[2],u=o(n),1>z||u&&z>366||!u&&z>365)throw new a(b)}else{if(s=I.match(S),null===s)throw new a(b);n=+s[1];var D=+s[2],L=+s[3]||0;if(R=I.split("-").length-1,R>0&&(!r(s[3])&&1!==R||r(s[3])&&2!==R))throw new a(b);var q=new Date(Date.UTC(n,0,4));z=7*D+L-q.getUTCDay()-3}i=new Date(Date.UTC(n,0,1)),i.setUTCDate(z),l=i.getUTCMonth()+1,h=i.getUTCDate()}if(u=o(n),1>l||l>12||1>h||(2!==l||!u)&&h>y[l-1]||u&&2===l&&h>v)throw new a(b);var U;if(r(C)){if(s=C.match(P),null!==s){if(R=C.split(":").length-1,R>0&&2!==R&&3!==R)throw new a(b);m=+s[1],g=+s[2],T=+s[3],A=1e3*+(s[4]||0),U=5}else if(s=C.match(_),null!==s){if(R=C.split(":").length-1,R>0&&1!==R)throw new a(b);m=+s[1],g=+s[2],T=60*+(s[3]||0),U=4}else{if(s=C.match(M),null===s)throw new a(b);m=+s[1],g=60*+(s[2]||0),U=3}if(g>=60||T>=61||m>24||24===m&&(g>0||T>0||A>0))throw new a(b);var B=s[U],F=+s[U+1],W=+(s[U+2]||0);switch(B){case"+":m-=F,g-=W;break;case"-":m+=F,g+=W;break;case"Z":break;default:g+=new Date(Date.UTC(n,l-1,h,m,g)).getTimezoneOffset()}}else g+=new Date(n,l-1,h).getTimezoneOffset();var G=60===T;for(G&&T--;g>=60;)g-=60,m++;for(;m>=24;)m-=24,h++;for(i=u&&2===l?v:y[l-1];h>i;)h-=i,l++,l>12&&(l-=12,n++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,m--;for(;0>m;)m+=24,h--;for(;1>h;)l--,1>l&&(l+=12,n--),i=u&&2===l?v:y[l-1],h+=i;var k=p(n,l,h,m,g,T,A);return r(t)?(d(k[0],k[1],t),f(t)):t=new N(k[0],k[1],c.UTC),G&&N.addSeconds(t,1,t),t},N.now=function(e){return N.fromDate(new Date,e)};var A=new N(0,0,c.TAI);return N.toGregorianDate=function(e,t){var n=!1,a=h(e,A);r(a)||(N.addSeconds(e,-1,A),a=h(A,A),n=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var d=0|80*c/2447,p=0|c-(0|2447*d/80);c=0|d/11;var m=0|d+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=m,t.day=p,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=n,t):new i(y,m,p,v,w,x,E,n)},N.toDate=function(e){var t=N.toGregorianDate(e,m),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},N.toIso8601=function(t,n){var a,i=N.toGregorianDate(t,i);return r(n)||0===i.millisecond?r(n)&&0!==n?(a=(.01*i.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},N.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new N(e.dayNumber,e.secondsOfDay,c.TAI):void 0},N.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},N.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},N.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(N.secondsDifference(e,t))<=n},N.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},N.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},N.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},N.computeTaiMinusUtc=function(e){g.julianDate=e;var n=N.leapSeconds,r=t(n,g,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},N.addSeconds=function(e,t,n){return d(e.dayNumber,e.secondsOfDay+t,n)},N.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return d(e.dayNumber,r,n)},N.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return d(e.dayNumber,r,n)},N.addDays=function(e,t,n){var r=e.dayNumber+t;return d(r,e.secondsOfDay,n)},N.lessThan=function(e,t){return N.compare(e,t)<0},N.lessThanOrEquals=function(e,t){return N.compare(e,t)<=0},N.greaterThan=function(e,t){return N.compare(e,t)>0},N.greaterThanOrEquals=function(e,t){return N.compare(e,t)>=0},N.prototype.clone=function(e){return N.clone(this,e)},N.prototype.equals=function(e){return N.equals(this,e)},N.prototype.equalsEpsilon=function(e,t){return N.equalsEpsilon(this,e,t)},N.prototype.toString=function(){return N.toIso8601(this)},N.leapSeconds=[new u(new N(2441317,43210,c.TAI),10),new u(new N(2441499,43211,c.TAI),11),new u(new N(2441683,43212,c.TAI),12),new u(new N(2442048,43213,c.TAI),13),new u(new N(2442413,43214,c.TAI),14),new u(new N(2442778,43215,c.TAI),15),new u(new N(2443144,43216,c.TAI),16),new u(new N(2443509,43217,c.TAI),17),new u(new N(2443874,43218,c.TAI),18),new u(new N(2444239,43219,c.TAI),19),new u(new N(2444786,43220,c.TAI),20),new u(new N(2445151,43221,c.TAI),21),new u(new N(2445516,43222,c.TAI),22),new u(new N(2446247,43223,c.TAI),23),new u(new N(2447161,43224,c.TAI),24),new u(new N(2447892,43225,c.TAI),25),new u(new N(2448257,43226,c.TAI),26),new u(new N(2448804,43227,c.TAI),27),new u(new N(2449169,43228,c.TAI),28),new u(new N(2449534,43229,c.TAI),29),new u(new N(2450083,43230,c.TAI),30),new u(new N(2450630,43231,c.TAI),31),new u(new N(2451179,43232,c.TAI),32),new u(new N(2453736,43233,c.TAI),33),new u(new N(2454832,43234,c.TAI),34),new u(new N(2456109,43235,c.TAI),35),new u(new N(2457204,43236,c.TAI),36)],N}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var a=new n.constructor;for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];r&&(o=t(o,r)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var a=n[r],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,a,i){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return r}function s(e,n){n=t(n,"");var a=e[1],i=!!e[2],s=e[3];switch(n){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s);return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,a=t(n.method,"GET"),i=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,a,i,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,f){var h=l.exec(e);if(null!==h)return c.resolve(s(h,t)),void 0;var d=new XMLHttpRequest;if(n(f)&&n(d.overrideMimeType)&&d.overrideMimeType(f),d.open(r,e,!0),n(u))for(var p in u)u.hasOwnProperty(p)&&d.setRequestHeader(p,u[p]);n(t)&&(d.responseType=t),d.onload=function(){200===d.status?n(d.response)?c.resolve(d.response):n(d.responseXML)&&d.responseXML.hasChildNodes()?c.resolve(d.responseXML):n(d.responseText)?c.resolve(d.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(d.status,d.response,d.getAllResponseHeaders()))},d.onerror=function(){c.reject(new a)},d.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(n,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,r(n,i).then(function(e){return JSON.parse(e)})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function h(e,t){return o.compare(e.julianDate,t)}function d(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=n.columnNames.indexOf("modifiedJulianDateUtc"),i=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),d=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>d||0>p||0>m)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=d,e._yCelestialPoleOffsetRadiansColumn=p,e._taiMinusUtcSecondsColumn=m,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],O=y[x+m],T=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,M=new o(T,O,f.TAI);if(v.push(M),w){if(O!==g&&r(g)){var _=o.leapSeconds,P=t(_,M,h);if(0>P){var b=new u(M,O);_.splice(~P,0,b)}}g=O}}}function p(e,t,n,r,a){var i=n*r;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function m(e,t,n){return t+e*(n-t)}function y(e,t,n,r,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[a],l=t[i];if(c.equals(l)||r.equals(c))return p(e,n,a,s,u),u;if(r.equals(l))return p(e,n,i,s,u),u;var f=o.secondsDifference(r,c)/o.secondsDifference(l,c),h=a*s,d=i*s,y=n[h+e._ut1MinusUtcSecondsColumn],v=n[d+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=n[h+e._taiMinusUtcSecondsColumn],x=n[d+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(r)?y=v:v-=x-w)}return u.xPoleWander=m(f,n[h+e._xPoleWanderRadiansColumn],n[d+e._xPoleWanderRadiansColumn]),u.yPoleWander=m(f,n[h+e._yPoleWanderRadiansColumn],n[d+e._yPoleWanderRadiansColumn]),u.xPoleOffset=m(f,n[h+e._xCelestialPoleOffsetRadiansColumn],n[d+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=m(f,n[h+e._yCelestialPoleOffsetRadiansColumn],n[d+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=m(f,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))d(this,t.data);else if(r(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){d(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"." -})}else d(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new a(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var i=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var f=i[u],h=i[u+1],d=o.lessThanOrEquals(f,e),p=!r(h),m=p||o.greaterThanOrEquals(h,e);if(d&&m)return s=u,!p&&h.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,n),n}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),a=f.exec(r);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,h=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return h._cesiumScriptRegex=f,h.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},h}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t,n){var r=f;return r.dayNumber=t,r.secondsOfDay=n,i.daysDifference(r,e._sampleZeroDateTT)}function c(n,a){if(n._chunkDownloadsInProgress[a])return n._chunkDownloadsInProgress[a];var i=e.defer();n._chunkDownloadsInProgress[a]=i;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[a]=!1;for(var t=n._samples,r=e.samples,o=3*a*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];i.resolve()}),i.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new i(0,0,u.TAI);return l.prototype.preload=function(t,n,r,a){var i=s(this,t,n),o=s(this,r,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,h=0|l/this._samplesPerXysFile,d=[],p=f;h>=p;++p)d.push(c(this,p));return e.all(d)},l.prototype.computeXysRadians=function(e,t,n){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var h=!1,d=this._samples;if(r(d[3*l])||(c(this,0|l/this._samplesPerXysFile),h=!0),r(d[3*f])||(c(this,0|f/this._samplesPerXysFile),h=!0),h)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new a(0,0,0);var p,m,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(p=0;u>=p;++p)v[p]=y-x[p];for(p=0;u>=p;++p){for(w[p]=1,m=0;u>=m;++m)m!==p&&(w[p]*=v[m]);w[p]*=g[p];var E=3*(l+p);n.x+=w[p]*d[E++],n.y+=w[p]*d[E++],n.s+=w[p]*d[E]}return n},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,r,a){var i=r/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,h=Math.cos(i);return n(a)?(a.x=u,a.y=l,a.z=f,a.w=h,a):new s(u,l,f,h)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var r,a,i,o,c,h=e[u.COLUMN0ROW0],d=e[u.COLUMN1ROW1],p=e[u.COLUMN2ROW2],m=h+d+p;if(m>0)r=Math.sqrt(m+1),c=.5*r,r=.5/r,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;d>h&&(v=1),p>h&&p>d&&(v=2);var g=y[v],w=y[g];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,a=-x[0],i=-x[1],o=-x[2]}return n(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var h=new s;s.fromHeadingPitchRoll=function(t,n,r,a){var i=s.fromAxisAngle(e.UNIT_X,r,h),o=s.fromAxisAngle(e.UNIT_Y,-n,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,h);return s.multiply(u,a,a)};var d=new e,p=new e,m=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.x=e[r],a.y=e[r+1],a.z=e[r+2],a.w=e[r+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var a=0,i=n-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),m),s.multiply(m,v,m),m.w<0&&s.negate(m,m),s.computeAxis(m,d);var u=s.computeAngle(m);r[o]=d.x*u,r[o+1]=d.y*u,r[o+2]=d.z*u}},s.unpackInterpolationResult=function(t,r,a,i,o){n(o)||(o=new s),e.fromArray(t,0,p);var u=e.magnitude(p);return s.unpack(r,4*i,y),0===u?s.clone(s.IDENTITY,m):s.fromAxisAngle(p,u,m),s.multiply(m,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,a=e.y*n,i=e.z*n,o=e.w*n;return t.x=r,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+r*l+a*c-i*s,h=o*s-r*c+a*l+i*u,d=o*c+r*s-a*u+i*l,p=o*l-r*u-a*s-i*c;return n.x=f,n.y=h,n.z=d,n.w=p,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,n,r){return g=s.multiplyByScalar(t,n,g),r=s.multiplyByScalar(e,1-n,r),s.add(g,r,r)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,n,r);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(i,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),a=0;return 0!==r&&(a=r/Math.sin(r)),e.multiplyByScalar(t,a,n)},s.exp=function(t,n){var r=e.magnitude(t),a=0;return 0!==r&&(a=Math.sin(r)/r),n.x=t.x*a,n.y=t.y*a,n.z=t.z*a,n.w=Math.cos(r),n};var S=new e,O=new e,T=new s,M=new s;s.computeInnerQuadrangle=function(t,n,r,a){var i=s.conjugate(n,T);s.multiply(i,r,M);var o=s.log(M,S);s.multiply(i,t,M);var u=s.log(M,O);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,T),s.multiply(n,T,a)},s.squad=function(e,t,n,r,a,i){var o=s.slerp(e,t,a,T),u=s.slerp(n,r,a,M);return s.slerp(o,u,2*a*(1-a),i)};for(var _=new s,P=1.9011074535173003,b=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],A=a.supportsTypedArrays()?new Float32Array(8):[],I=a.supportsTypedArrays()?new Float32Array(8):[],C=0;7>C;++C){var R=C+1,z=2*R+1;b[C]=1/(R*z),N[C]=R/z}return b[7]=P/136,N[7]=8*P/17,s.fastSlerp=function(e,t,n,r){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-n,c=n*n,l=u*u,f=7;f>=0;--f)A[f]=(b[f]*c-N[f])*o,I[f]=(b[f]*l-N[f])*o;var h=a*n*(1+A[0]*(1+A[1]*(1+A[2]*(1+A[3]*(1+A[4]*(1+A[5]*(1+A[6]*(1+A[7])))))))),d=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),p=s.multiplyByScalar(e,d,_);return s.multiplyByScalar(t,h,r),s.add(p,r,r)},s.fastSquad=function(e,t,n,r,a,i){var o=s.fastSlerp(e,t,a,T),u=s.fastSlerp(n,r,a,M);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,p,m,y,v){"use strict";var g={},w=new n,x=new n,E=new n;g.eastNorthUpToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return i(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new m(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new m(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new n,O=new n,T=new n;g.northEastDownToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new m(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=O,l=T;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new m(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new m(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new m(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var M=new y,_=new n(1,1,1),P=new m;g.headingPitchRollToFixedFrame=function(e,t,r,a,i,o){var u=y.fromHeadingPitchRoll(t,r,a,M),s=m.fromTranslationQuaternionRotationScale(n.ZERO,u,_,P);return o=g.eastNorthUpToFixedFrame(e,i,o),m.multiply(o,s,o)};var b=new m,N=new p;g.headingPitchRollQuaternion=function(e,t,n,r,a,i){var o=g.headingPitchRollToFixedFrame(e,t,n,r,a,b),u=m.getRotation(o,N);return y.fromRotationMatrix(u,i)};var A=24110.54841,I=8640184.812866,C=.093104,R=-62e-7,z=1.1772758384668e-19,D=72921158553e-15,L=d.TWO_PI/86400,q=new h;g.computeTemeToPseudoFixedMatrix=function(e,t){q=h.addSeconds(e,-h.computeTaiMinusUtc(e),q);var n,r=q.dayNumber,a=q.secondsOfDay,o=r-2451545;n=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=A+n*(I+n*(C+n*R)),s=u*L%d.TWO_PI,c=D+z*(r-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,m=Math.cos(f),y=Math.sin(f);return i(t)?(t[0]=m,t[1]=-y,t[2]=0,t[3]=y,t[4]=m,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new p(m,y,0,-y,m,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var U=32.184,B=2451545;g.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+U,a=t.stop.dayNumber,i=t.stop.secondsOfDay+U,o=g.iau2006XysData.preload(n,r,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new p);var n=g.computeFixedToIcrfMatrix(e,t);return i(n)?p.transpose(n,t):void 0};var F=new f(0,0,0),W=new s(0,0,0,0,0,0),G=new p,k=new p;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new p);var n=g.earthOrientationParameters.compute(e,W);if(!i(n))return void 0;var r=e.dayNumber,a=e.secondsOfDay+U,o=g.iau2006XysData.computeXysRadians(r,a,F);if(!i(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=p.fromRotationZ(-o.s,k),m=p.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-h.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*d.TWO_PI;var O=p.fromRotationZ(S,k),T=p.multiply(m,O,G),M=Math.cos(n.xPoleWander),_=Math.cos(n.yPoleWander),P=Math.sin(n.xPoleWander),b=Math.sin(n.yPoleWander),N=r-B+a/v.SECONDS_PER_DAY;N/=36525;var A=-47e-6*N*d.RADIANS_PER_DEGREE/3600,I=Math.cos(A),C=Math.sin(A),R=k;return R[0]=M*I,R[1]=M*C,R[2]=P,R[3]=-_*C+b*P*I,R[4]=_*I+b*P*C,R[5]=-b*M,R[6]=-b*C-_*P*I,R[7]=b*I-_*P*C,R[8]=_*M,p.multiply(T,R,t)};var V=new r;g.pointToWindowCoordinates=function(e,t,n,r){return r=g.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},g.pointToGLWindowCoordinates=function(e,n,a,o){i(o)||(o=new t);var u=V;return m.multiplyByVector(e,r.fromElements(a.x,a.y,a.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),m.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var Y=new n,j=new n,H=new n;return g.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=a(r,c.WGS84).geodeticSurfaceNormal(e,Y),s=n.cross(t,u,j);n.equalsEpsilon(s,n.ZERO,d.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,H);return n.cross(t,l,s),n.negate(s,s),i(o)||(o=new p),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,p){"use strict";var m=new r,y=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=p.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(f.getColumn(r,0,m)),this._yAxis=n.fromCartesian4(f.getColumn(r,1,m));var i=n.fromCartesian4(f.getColumn(r,2,m));this._plane=h.fromPointNormal(e,i)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var g=new d,w=new n;y.prototype.projectPointOntoPlane=function(e,r){var a=g;a.origin=e,n.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,w);if(i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w)),i(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return i(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var n=0,r=e.length,a=0;r>a;a++){var o=this.projectPointOntoPlane(e[a],t[n]);i(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){i(r)||(r=new t);var a=g;a.origin=e,n.clone(this._plane.normal,a.direction);var o=c.rayPlane(a,this._plane,w);i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){i(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;i(t)?t.length=r:t=new Array(r);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var f=e[l];n.multiplyByScalar(u,f.x,c),i(t[l])||(t[l]=new n);var h=n.add(o,c,t[l]);n.multiplyByScalar(s,f.y,c),n.add(h,c,h),a.scaleToGeocentricSurface(h,h)}return t},y}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var n=new t,r=function(t,r,a,i){return e(t,r,a,i,n),n.x>0&&n.y>0&&n.z>0};return r}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(e){var t=e._uSquared,n=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,a=(n-r)/n,i=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-a)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,i),f=s*o,h=f*f,d=1-h,p=Math.sqrt(d),m=t/4,y=m*m,v=y*m,g=y*y,w=1+m-3*y/4+5*v/4-175*g/64,x=1-m+15*y/8-35*v/8,E=1-3*m+35*y/4,S=1-5*m,O=w*l-x*Math.sin(2*l)*m/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,T=e._constants;T.a=n,T.b=r,T.f=a,T.cosineHeading=i,T.sineHeading=o,T.tanU=u,T.cosineU=s,T.sineU=c,T.sigma=l,T.sineAlpha=f,T.sineSquaredAlpha=h,T.cosineSquaredAlpha=d,T.cosineAlpha=p,T.u2Over4=m,T.u4Over16=y,T.u6Over64=v,T.u8Over256=g,T.a0=w,T.a1=x,T.a2=E,T.a3=S,T.distanceRatio=O}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,n,r,a,i,o){var u=c(e,n);return(1-u)*e*t*(r+u*a*(o+u*i*(2*o*o-1)))}function f(e,t,n,r,a,i,o){var s,c,f,h,d,p=(t-n)/t,m=i-r,y=Math.atan((1-p)*Math.tan(a)),v=Math.atan((1-p)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,O=g*E,T=w*E,M=w*x,_=m,P=u.TWO_PI,b=Math.cos(_),N=Math.sin(_);do{b=Math.cos(_),N=Math.sin(_);var A=O-M*b;f=Math.sqrt(x*x*N*N+A*A),c=T+S*b,s=Math.atan2(f,c);var I;0===f?(I=0,h=1):(I=S*N/f,h=1-I*I),P=_,d=c-2*T/h,isNaN(d)&&(d=0),_=m+l(p,I,h,s,f,c,d)}while(Math.abs(_-P)>u.EPSILON12);var C=h*(t*t-n*n)/(n*n),R=1+C*(4096+C*(C*(320-175*C)-768))/16384,z=C*(256+C*(C*(74-47*C)-128))/1024,D=d*d,L=z*f*(d+z*(c*(2*D-1)-z*d*(4*f*f-3)*(4*D-3)/6)/4),q=n*R*(s-L),U=Math.atan2(x*N,O-M*b),B=Math.atan2(g*N,O*b-M);e._distance=q,e._startHeading=U,e._endHeading=B,e._uSquared=C}function h(n,r,a,i){e.normalize(i.cartographicToCartesian(r,p),d),e.normalize(i.cartographicToCartesian(a,p),p),f(n,i.maximumRadius,i.minimumRadius,r.longitude,r.latitude,a.longitude,a.latitude),n._start=t.clone(r,n._start),n._end=t.clone(a,n._end),n._start.height=0,n._end.height=0,s(n)}var d=new e,p=new e,m=function(e,a,i){var u=n(i,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,r(e)&&r(a)&&h(this,e,a,u)};return a(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),m.prototype.setEndPoints=function(e,t){h(this,e,t,this._ellipsoid)},m.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},m.prototype.interpolateUsingSurfaceDistance=function(e,n){var a=this._constants,i=a.distanceRatio+e/a.b,o=Math.cos(2*i),u=Math.cos(4*i),s=Math.cos(6*i),c=Math.sin(2*i),f=Math.sin(4*i),h=Math.sin(6*i),d=Math.sin(8*i),p=i*i,m=i*p,y=a.u8Over256,v=a.u2Over4,g=a.u6Over64,w=a.u4Over16,x=2*m*y*o/3+i*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*f-p*((g-11*y/2)*c+5*y*f/2)+(29*g/96-29*y/16)*h+539*y*d/1536,E=Math.asin(Math.sin(x)*a.cosineAlpha),S=Math.atan(a.a/a.b*Math.tan(E));x-=a.sigma;var O=Math.cos(2*a.sigma+x),T=Math.sin(x),M=Math.cos(x),_=a.cosineU*M,P=a.sineU*T,b=Math.atan2(T*a.sineHeading,_-P*a.cosineHeading),N=b-l(a.f,a.sineAlpha,a.cosineSquaredAlpha,x,T,M,O);return r(n)?(n.longitude=this._start.longitude+N,n.latitude=S,n.height=0,n):new t(this._start.longitude+N,S,0)},m}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function h(e,t,n){var r=T;r.length=e;var a;if(t===n){for(a=0;e>a;a++)r[a]=t;return r}var i=n-t,o=i/e;for(a=0;e>a;a++){var u=t+a*o;r[a]=u}return r}function d(t,n,r,a,i,o,u,s){var c=a.scaleToGeodeticSurface(t,b),l=a.scaleToGeodeticSurface(n,N),f=p.numberOfPoints(t,n,r),d=a.cartesianToCartographic(c,M),m=a.cartesianToCartographic(l,_),y=h(f,i,o);A.setEndPoints(d,m);var v=A.surfaceDistance/f,g=s;d.height=i;var w=a.cartographicToCartesian(d,P);e.pack(w,u,g),g+=3;for(var x=1;f>x;x++){var E=A.interpolateUsingSurfaceDistance(x*v,_);E.height=y[x],w=a.cartographicToCartesian(E,P),e.pack(w,u,g),g+=3}return g}var p={};p.numberOfPoints=function(t,n,r){var a=e.distance(t,n);return Math.ceil(a/r)};var m=new t;p.extractHeights=function(e,t){for(var n=e.length,r=new Array(n),a=0;n>a;a++){var i=e[a];r[a]=t.cartesianToCartographic(i,m).height}return r};var y=new l,v=new e,g=new e,w=new f(e.ZERO,0),x=new e,E=new f(e.ZERO,0),S=new e,O=new e,T=[],M=new t,_=new t,P=new e,b=new e,N=new e,A=new o;p.wrapLongitude=function(t,a){var i=[],o=[];if(r(t)&&t.length>0){a=n(a,l.IDENTITY);var s=l.inverseTransformation(a,y),c=l.multiplyByPoint(s,e.ZERO,v),h=l.multiplyByPointAsVector(s,e.UNIT_Y,g),d=f.fromPointNormal(c,h,w),p=l.multiplyByPointAsVector(s,e.UNIT_X,x),m=f.fromPointNormal(c,p,E),T=1;i.push(e.clone(t[0]));for(var M=i[0],_=t.length,P=1;_>P;++P){var b=t[P];if(f.getPointDistance(m,M)<0||f.getPointDistance(m,b)<0){var N=u.lineSegmentPlane(M,b,d,S);if(r(N)){var A=e.multiplyByScalar(h,5e-9,O);f.getPointDistance(d,M)<0&&e.negate(A,A),i.push(e.add(N,A,new e)),o.push(T+1),e.negate(A,A),i.push(e.add(N,A,new e)),T=1}}i.push(e.clone(t[P])),T++,M=b}o.push(T)}return{positions:i,lengths:o}};var I=c.EPSILON7;return p.removeDuplicates=function(t){var n=t.length;if(2>n)return t;var r,a,i;for(r=1;n>r&&(a=t[r-1],i=t[r],!e.equalsEpsilon(a,i,I));++r);if(r===n)return t;for(var o=t.slice(0,r);n>r;++r)i=t[r],e.equalsEpsilon(a,i,I)||(o.push(e.clone(i)),a=i);return o},p.generateArc=function(t){r(t)||(t={});var a=t.positions,o=a.length,u=n(t.ellipsoid,i.WGS84),l=n(t.height,0);if(1>o)return[];if(1===o){var f=u.scaleToGeodeticSurface(a[0],b);if(0!==l){var h=u.geodeticSurfaceNormal(f,P);e.multiplyByScalar(h,l,h),e.add(f,h,f)}return[f.x,f.y,f.z]}var m=t.minDistance;if(!r(m)){var y=n(t.granularity,c.RADIANS_PER_DEGREE);m=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=p.numberOfPoints(a[v],a[v+1],m);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var O=a[v],_=a[v+1],N=S?l[v]:l,A=S?l[v+1]:l;E=d(O,_,m,u,N,A,x,E)}T.length=0;var I=a[o-1],C=u.cartesianToCartographic(I,M);C.height=S?l[o-1]:l;var R=u.cartographicToCartesian(C,P);return e.pack(R,x,w-3),x},p.generateCartesianArc=function(t){for(var n=p.generateArc(t),r=n.length/3,a=new Array(r),i=0;r>i;i++)a[i]=e.unpack(n,3*i);return a},p}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,n=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,n},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,p,m){"use strict";function y(t,n,r){var a=e.subtract(n,t,L),i=e.subtract(r,n,q);return a.x*i.y-a.y*i.x>=0}function v(e){for(var t=e[0].x,n=0,r=0;r<e.length;r++)e[r].x>t&&(t=e[r].x,n=r);return n}function g(e){for(var t=e[0][0].x,n=0,r=0;r<e.length;r++){var a=e[r][v(e[r])].x;a>t&&(t=a,n=r)}return n}function w(e){for(var t=[],n=0;n<e.length;n++){var r=e[(n-1+e.length)%e.length],a=e[n],i=e[(n+1)%e.length];y(r,a,i)||t.push(a)}return t}function x(t,n){for(var r=0;r<t.length;r++)if(e.equals(n,t[r]))return r;return-1}function E(n,a,i){i=r(i,[]);var o=Number.MAX_VALUE,u=v(a),s=new e(a[u].x,n.y);i.push(u),i.push((u+1)%a.length);for(var c=a[0].x,l=c,f=1;f<a.length;++f)a[f].x<c?c=a[f].x:a[f].x>l&&(l=a[f].x);l+=l-c;var h=new t(l,n.y,0);for(f=0;f<a.length;f++){var d=a[f],p=a[(f+1)%a.length];if((d.x>=n.x||p.x>=n.x)&&(d.y>=n.y&&p.y<=n.y||d.y<=n.y&&p.y>=n.y)){var m=(p.y-d.y)*(h.x-n.x)-(p.x-d.x)*(h.y-n.y);if(0!==m){m=1/m;var y=((p.x-d.x)*(n.y-d.y)-(p.y-d.y)*(n.x-d.x))*m,g=((h.x-n.x)*(n.y-d.y)-(h.y-n.y)*(n.x-d.x))*m;if(y>=0&&1>=y&&g>=0&&1>=g){var w=new e(n.x+y*(h.x-n.x),n.y+y*(h.y-n.y)),x=e.subtract(w,n,U);m=e.magnitudeSquared(x),o>m&&(s=w,o=m,i[0]=f,i[1]=(f+1)%a.length)}}}}return s}function S(t,n){var r=g(n),a=n[r],i=v(a),o=a[i],u=[],s=E(o,t,u),c=x(t,s);if(-1!==c)return c;var h=e.magnitudeSquared(e.subtract(t[u[0]],o,B)),d=e.magnitudeSquared(e.subtract(t[u[1]],o,B)),p=d>h?t[u[0]]:t[u[1]],m=w(t),y=m.indexOf(p);-1!==y&&m.splice(y,1);for(var S=[],O=0;O<m.length;O++){var T=m[O];f(T,o,s,p)&&S.push(T)}var M=Number.MAX_VALUE;if(S.length>0){var _=e.fromElements(1,0,B);for(O=0;O<S.length;O++){var P=e.subtract(S[O],o,F),b=e.magnitude(_)*e.magnitudeSquared(P);if(0!==b){var N=Math.abs(l.acosClamped(e.dot(_,P)/b));M>N&&(M=N,p=S[O])}}}return t.indexOf(p)}function O(e,n,r){for(var a=et.computeWindingOrder2D(e),i=0;i<n.length;i++){var o=n[i];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=et.computeWindingOrder2D(o);s===a&&o.reverse()}var c=u.fromPoints(e,r),l=c.projectPointsOntoPlane(e),f=[]; -for(i=0;i<n.length;i++)f.push(c.projectPointsOntoPlane(n[i]));var h=S(l,f),d=g(f),p=v(f[d]),m=n[d],y=[];for(i=0;i<e.length;i++)y.push(e[i]);var w,x=[];if(0!==p)for(w=0;w<=m.length;w++){var E=(w+p)%m.length;0!==E&&x.push(m[E])}else for(w=0;w<m.length;w++)x.push(m[(w+p)%m.length]);var O=y.lastIndexOf(e[h]);x.push(e[O]);var T=y.slice(0,O+1),M=y.slice(O+1);return y=T.concat(x,M),n.splice(d,1),y}function T(e){var t=l.nextRandomNumber(),n=Math.floor(t*e);return n===e&&n--,n}function M(e,t,n,r){var a=r[e].position,i=r[t].position,o=r[n].position,u=o.x,s=o.y,c=a.x-u,l=a.y-s,f=i.x-u,h=i.y-s;return c*h-l*f}function _(e,t){return e.x*t.y-e.y*t.x}function P(e,t){var n=t.length,r=l.mod(e-1,n),a=l.mod(e+1,n);return 0===M(r,a,e,t)?!1:!0}function b(t,n){return e.magnitudeSquared(n)<e.magnitudeSquared(t)}function N(t,n,r){if(!P(t,r))return t;var a=r[t].position,i=r[n].position,o=r.length,u=l.mod(t-1,o);if(!P(u,r))return u;var s=l.mod(t+1,o);if(!P(s,r))return s;var c=e.subtract(r[u].position,a,k),f=e.subtract(r[s].position,a,V),h=e.subtract(i,a,Y),d=_(c,h),p=_(f,h);if(0===d)return b(c,h)?W:G;if(0===p)return b(f,h)?W:G;var m=_(c,f);return 0>m?0>d&&p>0?W:G:m>0?d>0&&0>p?G:W:void 0}function A(e,t,n){return(e>t||e>n)&&(t>e||n>e)||t===n&&t===e}function I(t,n,r,a){var i=e.subtract(r,t,H),o=n.x*a.y-n.y*a.x,u=o*o,s=e.magnitudeSquared(n),c=e.magnitudeSquared(a);if(u>j*s*c){var l=(i.x*a.y-i.y*a.x)/o;return e.add(t,e.multiplyByScalar(n,l,H),H)}return void 0}function C(t,n,r){for(var i=e.subtract(n,t,Z),o=r.length,u=0;o>u;u++){var s=r[u].position,c=r[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(n,c)||e.equals(t,c)||e.equals(n,s))){var f=e.subtract(c,s,X),h=I(t,i,s,f);if(a(h)&&!(e.equals(h,t)||e.equals(h,n)||e.equals(h,s)||e.equals(h,c))){var d=h.x,p=h.y,m=A(d,t.x,n.x)&&A(p,t.y,n.y)&&A(d,s.x,c.x)&&A(p,s.y,c.y);if(m)return!0}}}return!1}function R(t,n,r){var a=N(t,n,r);if(a>=0)return a;var i=N(n,t,r);return i>=0?i:a!==W||i!==W||C(r[t].position,r[n].position,r)||e.equals(r[t].position,r[n].position)?K:J}function z(e){return 0===M(1,2,0,e)}function D(e){var t=e.length;if(3===t)return z(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new i("Invalid polygon: must have at least three vertices.");for(var n,r,a=0,o=10*e.length,u=K;J>u&&a++<o;){for(n=T(e.length),r=n+1;Math.abs(n-r)<2||Math.abs(n-r)>e.length-2;)r=T(e.length);if(n>r){var s=n;n=r,r=s}u=R(n,r,e)}if(u===J){var c=e.splice(n,r-n+1,e[n],e[r]);return D(e).concat(D(c))}return u>=0?(e.splice(u,1),D(e)):[]}var L=new e,q=new e,U=new e,B=new e(1,0),F=new e,W=-1,G=-2,k=new t,V=new t,Y=new t,j=l.EPSILON14,H=new e;new e;var Z=new e,X=new e,J=-1,K=-2,Q=new t,$=new t,et={};et.removeDuplicates=function(e){var n=h.removeDuplicates(e);return t.equals(n[0],n[n.length-1])?n.slice(1):n},et.computeArea2D=function(e){for(var t=e.length,n=0,r=t-1,a=0;t>a;r=a++){var i=e[r],o=e[a];n+=i.x*o.y-o.x*i.y}return.5*n},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?m.COUNTER_CLOCKWISE:m.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,n=[],r=0;t>r;++r)n[r]={position:e[r],index:r};return D(n)};var tt=new t,nt=new t,rt=new t,at=new t,it=new t,ot=new t,ut=new t;return et.computeSubdivision=function(e,i,o,u){u=r(u,l.RADIANS_PER_DEGREE);var f,h=o.slice(0),p=i.length,m=new Array(3*p),y=0;for(f=0;p>f;f++){var v=i[f];m[y++]=v.x,m[y++]=v.y,m[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;h.length>0;){var O,T,M=h.pop(),_=h.pop(),P=h.pop(),b=t.fromArray(m,3*P,tt),N=t.fromArray(m,3*_,nt),A=t.fromArray(m,3*M,rt),I=t.multiplyByScalar(t.normalize(b,at),x,at),C=t.multiplyByScalar(t.normalize(N,it),x,it),R=t.multiplyByScalar(t.normalize(A,ot),x,ot),z=t.magnitudeSquared(t.subtract(I,C,ut)),D=t.magnitudeSquared(t.subtract(C,R,ut)),L=t.magnitudeSquared(t.subtract(R,I,ut)),q=Math.max(z,D,L);q>S?z===q?(O=Math.min(P,_)+" "+Math.max(P,_),f=w[O],a(f)||(T=t.add(b,N,ut),t.multiplyByScalar(T,.5,T),m.push(T.x,T.y,T.z),f=m.length/3-1,w[O]=f),h.push(P,f,M),h.push(f,_,M)):D===q?(O=Math.min(_,M)+" "+Math.max(_,M),f=w[O],a(f)||(T=t.add(N,A,ut),t.multiplyByScalar(T,.5,T),m.push(T.x,T.y,T.z),f=m.length/3-1,w[O]=f),h.push(_,f,P),h.push(f,M,P)):L===q&&(O=Math.min(M,P)+" "+Math.max(M,P),f=w[O],a(f)||(T=t.add(A,b,ut),t.multiplyByScalar(T,.5,T),m.push(T.x,T.y,T.z),f=m.length/3-1,w[O]=f),h.push(M,f,_),h.push(f,P,_)):(g.push(P),g.push(_),g.push(M))}return new s({attributes:{position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:m})},indices:g,primitiveType:d.TRIANGLES})},et.scaleToGeodeticHeight=function(e,n,i,u){i=r(i,o.WGS84);var s=Q,c=$;if(n=r(n,0),u=r(u,!0),a(e)&&a(e.attributes)&&a(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,h=0;f>h;h+=3)t.fromArray(l,h,c),u&&(c=i.scaleToGeodeticSurface(c,c)),s=i.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,n,s),t.add(c,s,c),l[h]=c.x,l[h+1]=c.y,l[h+2]=c.z;return e},et.eliminateHoles=function(e,n,a){a=r(a,o.WGS84);for(var i=[],u=0;u<n.length;u++){for(var s=[],c=0;c<n[u].length;c++)s.push(t.clone(n[u][c]));i.push(s)}for(var l=e;i.length>0;)l=O(l,i,a);return l},et}),define("Core/PolylineVolumeGeometryLibrary",["./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./CornerType","./EllipsoidTangentPlane","./Math","./Matrix3","./Matrix4","./PolylinePipeline","./Quaternion","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function h(e,t){for(var n=new Array(e.length),r=0;r<e.length;r++){var a=e[r];z=t.cartesianToCartographic(a,z),n[r]=z.height,e[r]=t.scaleToGeodeticSurface(a,a)}return n}function d(e,n,r,a){var i,o=e[0],u=e[1],s=t.angleBetween(o,u),c=Math.ceil(s/a),l=new Array(c);if(n===r){for(i=0;c>i;i++)l[i]=n;return l.push(r),l}var f=r-n,h=f/c;for(i=1;c>i;i++){var d=n+i*h;l[i]=d}return l[0]=n,l.push(r),l}function p(n,r,a,o){var u=new i(a,o),s=u.projectPointOntoPlane(t.add(a,n,H),H),c=u.projectPointOntoPlane(t.add(a,r,Z),Z),l=e.angleBetween(s,c);return c.x*s.y-c.y*s.x>=0?-l:l}function m(e,n,r,a,i,o,c,l){var h=F,d=W;L=f.eastNorthUpToFixedFrame(e,i,L),h=s.multiplyByPointAsVector(L,D,h),h=t.normalize(h,h);var m=p(h,n,e,i);U=u.fromRotationZ(m,U),G.z=o,L=s.multiplyTransformation(L,s.fromRotationTranslation(U,G,q),L);var y=B;y[0]=c;for(var v=0;l>v;v++)for(var g=0;g<r.length;g+=3)d=t.fromArray(r,g,d),d=u.multiplyByVector(y,d,d),d=s.multiplyByPoint(L,d,d),a.push(d.x,d.y,d.z);return a}function y(e,n,r,a,i,o,u){for(var s=0;s<e.length;s+=3){var c=t.fromArray(e,s,k);a=m(c,n,r,a,i,o[s/3],u,1)}return a}function v(e,t){var n=e.length,r=new Array(6*n),a=0,i=t.x+t.width/2,o=t.y+t.height/2,u=e[0];r[a++]=u.x-i,r[a++]=0,r[a++]=u.y-o;for(var s=1;n>s;s++){u=e[s];var c=u.x-i,l=u.y-o;r[a++]=c,r[a++]=0,r[a++]=l,r[a++]=c,r[a++]=0,r[a++]=l}return u=e[0],r[a++]=u.x-i,r[a++]=0,r[a++]=u.y-o,r}function g(e,t){for(var n=e.length,r=new Array(3*n),a=0,i=t.x+t.width/2,o=t.y+t.height/2,u=0;n>u;u++)r[a++]=e[u].x-i,r[a++]=0,r[a++]=e[u].y-o;return r}function w(e,n,r,i,s,c,f,h,d,p){var y,v=t.angleBetween(t.subtract(n,e,I),t.subtract(r,e,C)),g=i===a.BEVELED?0:Math.ceil(v/o.toRadians(5));y=s?u.fromQuaternion(l.fromAxisAngle(t.negate(e,I),v/(g+1),V),j):u.fromQuaternion(l.fromAxisAngle(e,v/(g+1),V),j);var w,x;if(n=t.clone(n,Y),g>0)for(var E=p?2:1,S=0;g>S;S++)n=u.multiplyByVector(y,n,n),w=t.subtract(n,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(n,C),f=m(x,w,h,f,c,d,1,E);else w=t.subtract(n,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(n,C),f=m(x,w,h,f,c,d,1,1),r=t.clone(r,Y),w=t.subtract(r,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(r,C),f=m(x,w,h,f,c,d,1,1);return f}function x(e,t){return o.equalsEpsilon(e.latitude,t.latitude,o.EPSILON6)&&o.equalsEpsilon(e.longitude,t.longitude,o.EPSILON6)}var E=[new t,new t],S=new t,O=new t,T=new t,M=new t,_=new t,P=new t,b=new t,N=new t,A=new t,I=new t,C=new t,R={},z=new r,D=new t(-1,0,0),L=new s,q=new s,U=new u,B=u.IDENTITY.clone(),F=new t,W=new n,G=new t,k=new t,V=new l,Y=new t,j=new u;R.removeDuplicatesFromShape=function(t){for(var n=t.length,r=[],a=n-1,i=0;n>i;a=i++){var o=t[a],u=t[i];e.equals(o,u)||r.push(u)}return r};var H=new t,Z=new t;R.angleIsGreaterThanPi=function(e,n,r,a){var o=new i(r,a),u=o.projectPointOntoPlane(t.add(r,e,H),H),s=o.projectPointOntoPlane(t.add(r,n,Z),Z);return s.x*u.y-s.y*u.x>=0};var X=new r,J=new r;R.removeDuplicatesFromPositions=function(e,t){var n=e.length;if(2>n)return e.slice(0);var r=[];r.push(e[0]);for(var a=1;n>a;++a){var i=e[a-1],o=e[a],u=t.cartesianToCartographic(i,X),s=t.cartesianToCartographic(o,J);x(u,s)||r.push(o)}return r};var K=new t,Q=new t;return R.computePositions=function(e,n,r,i,u){var s=i._ellipsoid,l=h(e,s),f=i._granularity,p=i._cornerType,x=u?v(n,r):g(n,r),C=u?g(n,r):void 0,z=r.height/2,D=r.width/2,L=e.length,q=[],U=u?[]:void 0,B=S,F=O,W=T,G=M,k=_,V=P,Y=b,j=N,H=A,Z=e[0],X=e[1];G=s.geodeticSurfaceNormal(Z,G),B=t.subtract(X,Z,B),B=t.normalize(B,B),j=t.cross(G,B,j),j=t.normalize(j,j);var J=l[0],$=l[1];u&&(U=m(Z,j,C,U,s,J+z,1,1)),H=t.clone(Z,H),Z=X,F=t.negate(B,F);for(var et,tt,nt=1;L-1>nt;nt++){var rt=u?2:1;X=e[nt+1],B=t.subtract(X,Z,B),B=t.normalize(B,B),W=t.add(B,F,W),W=t.normalize(W,W),G=s.geodeticSurfaceNormal(Z,G);var at=t.multiplyByScalar(G,t.dot(B,G),K);t.subtract(B,at,at),t.normalize(at,at);var it=t.multiplyByScalar(G,t.dot(F,G),Q);t.subtract(F,it,it),t.normalize(it,it);var ot=!o.equalsEpsilon(Math.abs(t.dot(at,it)),1,o.EPSILON7);if(ot){W=t.cross(W,G,W),W=t.cross(G,W,W),W=t.normalize(W,W);var ut=1/Math.max(.25,t.magnitude(t.cross(W,F,I))),st=R.angleIsGreaterThanPi(B,F,Z,s);st?(k=t.add(Z,t.multiplyByScalar(W,ut*D,W),k),V=t.add(k,t.multiplyByScalar(j,D,V),V),E[0]=t.clone(H,E[0]),E[1]=t.clone(V,E[1]),et=d(E,J+z,$+z,f),tt=c.generateArc({positions:E,granularity:f,ellipsoid:s}),q=y(tt,j,x,q,s,et,1),j=t.cross(G,B,j),j=t.normalize(j,j),Y=t.add(k,t.multiplyByScalar(j,D,Y),Y),p===a.ROUNDED||p===a.BEVELED?w(k,V,Y,p,st,s,q,x,$+z,u):(W=t.negate(W,W),q=m(Z,W,x,q,s,$+z,ut,rt)),H=t.clone(Y,H)):(k=t.add(Z,t.multiplyByScalar(W,ut*D,W),k),V=t.add(k,t.multiplyByScalar(j,-D,V),V),E[0]=t.clone(H,E[0]),E[1]=t.clone(V,E[1]),et=d(E,J+z,$+z,f),tt=c.generateArc({positions:E,granularity:f,ellipsoid:s}),q=y(tt,j,x,q,s,et,1),j=t.cross(G,B,j),j=t.normalize(j,j),Y=t.add(k,t.multiplyByScalar(j,-D,Y),Y),p===a.ROUNDED||p===a.BEVELED?w(k,V,Y,p,st,s,q,x,$+z,u):q=m(Z,W,x,q,s,$+z,ut,rt),H=t.clone(Y,H)),F=t.negate(B,F)}else q=m(H,j,x,q,s,J+z,1,1),H=Z;J=$,$=l[nt+1],Z=X}E[0]=t.clone(H,E[0]),E[1]=t.clone(Z,E[1]),et=d(E,J+z,$+z,f),tt=c.generateArc({positions:E,granularity:f,ellipsoid:s}),q=y(tt,j,x,q,s,et,1),u&&(U=m(Z,j,C,U,s,$+z,1,1)),L=q.length;var ct=u?L+U.length:L,lt=new Float64Array(ct);return lt.set(q),u&<.set(U,L),lt},R}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return a.POSITION_ONLY=r(new a({position:!0})),a.POSITION_AND_NORMAL=r(new a({position:!0,normal:!0})),a.POSITION_NORMAL_AND_ST=r(new a({position:!0,normal:!0,st:!0})),a.POSITION_AND_ST=r(new a({position:!0,st:!0})),a.POSITION_AND_COLOR=r(new a({position:!0,color:!0})),a.ALL=r(new a({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),a.DEFAULT=a.POSITION_NORMAL_AND_ST,a.packedLength=6,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.position?1:0,n[r++]=t.normal?1:0,n[r++]=t.st?1:0,n[r++]=t.binormal?1:0,n[r++]=t.tangent?1:0,n[r++]=t.color?1:0},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.position=1===n[r++],i.normal=1===n[r++],i.st=1===n[r++],i.binormal=1===n[r++],i.tangent=1===n[r++],i.color=1===n[r++],i},a.clone=function(e,n){return t(e)?(t(n)||(n=new a),n.position=e.position,n.normal=e.normal,n.st=e.st,n.binormal=e.binormal,n.tangent=e.tangent,n.color=e.color,n):void 0},a}),define("Core/PolylineVolumeGeometry",["./BoundingRectangle","./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./CornerType","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryPipeline","./IndexDatatype","./Math","./PolygonPipeline","./PolylineVolumeGeometryLibrary","./PrimitiveType","./VertexFormat","./WindingOrder"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,p,m,y,v,g,w,x){"use strict";function E(e,n,r,i){var o=new h;i.position&&(o.position=new f({componentDatatype:a.DOUBLE,componentsPerAttribute:3,values:e}));var u,s,c,m,v,w,x=n.length,E=e.length/3,S=(E-2*x)/(2*x),O=y.triangulate(n),T=6*(S-1)*x+2*O.length,M=p.createTypedArray(E,T),_=2*x,P=0;for(u=0;S-1>u;u++){for(s=0;x-1>s;s++)c=2*s+2*u*x,w=c+_,m=c+1,v=m+_,M[P++]=m,M[P++]=c,M[P++]=v,M[P++]=v,M[P++]=c,M[P++]=w;c=2*x-2+2*u*x,m=c+1,v=m+_,w=c+_,M[P++]=m,M[P++]=c,M[P++]=v,M[P++]=v,M[P++]=c,M[P++]=w}if(i.st||i.tangent||i.binormal){var b,N,A=new Float32Array(2*E),I=1/(S-1),C=1/r.height,R=r.height/2,z=0;for(u=0;S>u;u++){for(b=u*I,N=C*(n[0].y+R),A[z++]=b,A[z++]=N,s=1;x>s;s++)N=C*(n[s].y+R),A[z++]=b,A[z++]=N,A[z++]=b,A[z++]=N;N=C*(n[0].y+R),A[z++]=b,A[z++]=N}for(s=0;x>s;s++)b=0,N=C*(n[s].y+R),A[z++]=b,A[z++]=N;for(s=0;x>s;s++)b=(S-1)*I,N=C*(n[s].y+R),A[z++]=b,A[z++]=N;o.st=new f({componentDatatype:a.FLOAT,componentsPerAttribute:2,values:new Float32Array(A)})}var D=E-2*x;for(u=0;u<O.length;u+=3){var L=O[u]+D,q=O[u+1]+D,U=O[u+2]+D;M[P++]=L,M[P++]=q,M[P++]=U,M[P++]=U+x,M[P++]=q+x,M[P++]=L+x}var B=new l({attributes:o,indices:M,boundingSphere:t.fromVertices(e),primitiveType:g.TRIANGLES});return i.normal&&(B=d.computeNormal(B)),(i.tangent||i.binormal)&&(B=d.computeBinormalAndTangent(B),i.tangent||(B.attributes.tangent=void 0),i.binormal||(B.attributes.binormal=void 0),i.st||(B.attributes.st=void 0)),B}var S=function(e){e=o(e,o.EMPTY_OBJECT);var t=e.polylinePositions,a=e.shapePositions;this._positions=t,this._shape=a,this._ellipsoid=c.clone(o(e.ellipsoid,c.WGS84)),this._cornerType=o(e.cornerType,i.ROUNDED),this._vertexFormat=w.clone(o(e.vertexFormat,w.DEFAULT)),this._granularity=o(e.granularity,m.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";var u=1+t.length*r.packedLength;u+=1+a.length*n.packedLength,this.packedLength=u+c.packedLength+w.packedLength+2};S.pack=function(e,t,a){a=o(a,0);var i,u=e._positions,s=u.length;for(t[a++]=s,i=0;s>i;++i,a+=r.packedLength)r.pack(u[i],t,a);var l=e._shape;for(s=l.length,t[a++]=s,i=0;s>i;++i,a+=n.packedLength)n.pack(l[i],t,a);c.pack(e._ellipsoid,t,a),a+=c.packedLength,w.pack(e._vertexFormat,t,a),a+=w.packedLength,t[a++]=e._cornerType,t[a]=e._granularity};var O=c.clone(c.UNIT_SPHERE),T=new w,M={polylinePositions:void 0,shapePositions:void 0,ellipsoid:O,vertexFormat:T,cornerType:void 0,granularity:void 0};S.unpack=function(e,t,a){t=o(t,0);var i,s=e[t++],l=new Array(s);for(i=0;s>i;++i,t+=r.packedLength)l[i]=r.unpack(e,t);s=e[t++];var f=new Array(s);for(i=0;s>i;++i,t+=n.packedLength)f[i]=n.unpack(e,t);var h=c.unpack(e,t,O);t+=c.packedLength;var d=w.unpack(e,t,T);t+=w.packedLength;var p=e[t++],m=e[t];return u(a)?(a._positions=l,a._shape=f,a._ellipsoid=c.clone(h,a._ellipsoid),a._vertexFormat=w.clone(d,a._vertexFormat),a._cornerType=p,a._granularity=m,a):(M.polylinePositions=l,M.shapePositions=f,M.cornerType=p,M.granularity=m,new S(M))};var _=new e;return S.createGeometry=function(t){var n=t._positions,r=v.removeDuplicatesFromPositions(n,t._ellipsoid),a=t._shape;if(a=v.removeDuplicatesFromShape(a),r.length<2||a.length<3)return void 0;y.computeWindingOrder2D(a)===x.CLOCKWISE&&a.reverse();var i=e.fromPoints(a,_),o=v.computePositions(r,a,i,t,!0);return E(o,a,i,t._vertexFormat)},S}),define("Workers/createPolylineVolumeGeometry",["../Core/defined","../Core/Ellipsoid","../Core/PolylineVolumeGeometry"],function(e,t,n){"use strict";function r(r,a){return e(a)&&(r=n.unpack(r,a)),r._ellipsoid=t.clone(r._ellipsoid),n.createGeometry(r)}return r})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createPolylineVolumeOutlineGeometry.js b/libs/Cesium/Workers/createPolylineVolumeOutlineGeometry.js deleted file mode 100644 index ec9654f9..00000000 --- a/libs/Cesium/Workers/createPolylineVolumeOutlineGeometry.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,a){a=t(a,r);var i=Math.abs(e-n);return a>=i||i<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],a=t;e>=a;a++)r.push(n*a);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var a=new e;return n.setRandomNumberSeed=function(t){a=new e(t)},n.nextRandomNumber=function(){return a.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};i.fromSpherical=function(n,r){t(r)||(r=new i);var a=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(a),r.y=s*Math.sin(a),r.z=u*Math.cos(o),r},i.fromElements=function(e,n,r,a){return t(a)?(a.x=e,a.y=n,a.z=r,a):new i(e,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var n=i.dot(s,c),r=i.magnitude(i.cross(s,c,s));return Math.atan2(r,n)};var l=new i;i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):n.y<=n.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)},i.cross=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-r*s,f=r*u-a*o;return n.x=c,n.y=l,n.z=f,n},i.fromDegrees=function(e,t,n,r,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,n,r,o)};var f=new i,h=new i,d=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(n,r,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=i.normalize(f,f),i.multiplyComponents(s,f,h);var l=Math.sqrt(i.dot(f,h));return h=i.divideByScalar(h,l,h),f=i.multiplyByScalar(f,a,f),t(u)||(u=new i),i.add(h,f,u)},i.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=a.toRadians(e[o]);return i.fromRadiansArray(r,t,n)},i.fromRadiansArray=function(e,n,r){var a=e.length;t(r)?r.length=a/2:r=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=i.fromRadians(u,s,0,n,r[o/2])}return r},i.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=a.toRadians(e[o]),r[o+1]=a.toRadians(e[o+1]),r[o+2]=e[o+2];return i.fromRadiansArrayHeights(r,t,n)},i.fromRadiansArrayHeights=function(e,n,r){var a=e.length;t(r)?r.length=a/3:r=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=i.fromRadians(u,s,c,n,r[o/3])}return r},i.ZERO=r(new i(0,0,0)),i.UNIT_X=r(new i(1,0,0)),i.UNIT_Y=r(new i(0,1,0)),i.UNIT_Z=r(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return i.fromRadians=function(n,r,a,o){return a=e(a,0),t(o)?(o.longitude=n,o.latitude=r,o.height=a,o):new i(n,r,a)},i.fromDegrees=function(e,t,n,r){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},i.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},i.ZERO=r(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(t,r,a,i){r=n(r,0),a=n(a,0),i=n(i,0),t._radii=new e(r,a,i),t._radiiSquared=new e(r*r,a*a,i*i),t._radiiToTheFourth=new e(r*r*r*r,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===r?0:1/r,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(r,a,i),t._maximumRadius=Math.max(r,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var a=t._radii;return r(n)?(e.clone(a,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,a){a=n(a,0),e.pack(t._radii,r,a)},c.unpack=function(t,r,a){r=n(r,0);var i=e.unpack(t,r);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,n){var a=l,i=f;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),r(n)||(n=new e),e.add(i,a,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var h=new e,d=new e,m=new e;c.prototype.cartesianToCartographic=function(n,a){var i=this.scaleToGeodeticSurface(n,d);if(!r(i))return void 0;var o=this.geodeticSurfaceNormal(i,h),s=e.subtract(n,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,n))*e.magnitude(s);return r(a)?(a.longitude=c,a.latitude=l,a.height=f,a):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=a*a*c*c,d=i*i*l*l,m=o*o*f*f,v=h+d+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,_=x.z,M=y;M.x=2*w.x*E,M.y=2*w.y*S,M.z=2*w.z*_;var O,P,T,R,C,N,I,z,A,b,D,q=(1-g)*e.magnitude(t)/(.5*e.magnitude(M)),U=0;do{q-=U,T=1/(1+q*E),R=1/(1+q*S),C=1/(1+q*_),N=T*T,I=R*R,z=C*C,A=N*T,b=I*R,D=z*C,O=h*N+d*I+m*z-1,P=h*A*E+d*b*S+m*D*_;var L=-2*P;U=O/L}while(Math.abs(O)>u.EPSILON12);return r(n)?(n.x=a*T,n.y=i*R,n.z=o*C,n):new e(a*T,i*R,o*C)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n){this.x=e(t,0),this.y=e(n,0)};i.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new i(e,n)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)},i.ZERO=r(new i(0,0)),i.UNIT_X=r(new i(1,0)),i.UNIT_Y=r(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,a,i,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return r(n)?(n.x=i,n.y=o,n.z=u,n):new e(i,o,u)},u.prototype.unproject=function(e,n){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return r(n)?(n.longitude=i,n.latitude=o,n.height=u,n):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(a,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.west=e[r++],a.south=e[r++],a.east=e[r++],a.north=e[r],a},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,a,i,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),n(o)?(o.west=e,o.south=r,o.east=a,o.north=i,o):new s(e,r,a,i)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=i,t.east=a,t.north=o,t):new s(r,i,a,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var h=Math.max(e.south,t.south),d=Math.min(e.north,t.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>a||u.equalsEpsilon(n,a,u.EPSILON14))&&(i>n||u.equalsEpsilon(n,i,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,a,o){r=t(r,i.WGS84),a=t(a,0),n(o)||(o=[]);var l=0,f=e.north,h=e.south,d=e.east,m=e.west,p=c;p.height=a,p.longitude=m,p.latitude=f,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=0>f?f:h>0?h:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=r.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingRectangle",["./Cartesian2","./Cartographic","./defaultValue","./defined","./DeveloperError","./GeographicProjection","./Intersect","./Rectangle"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,t,r,a){this.x=n(e,0),this.y=n(t,0),this.width=n(r,0),this.height=n(a,0)};s.fromPoints=function(e,t){if(r(t)||(t=new s),!r(e)||0===e.length)return t.x=0,t.y=0,t.width=0,t.height=0,t;for(var n=e.length,a=e[0].x,i=e[0].y,o=e[0].x,u=e[0].y,c=1;n>c;c++){var l=e[c],f=l.x,h=l.y;a=Math.min(f,a),o=Math.max(f,o),i=Math.min(h,i),u=Math.max(h,u)}return t.x=a,t.y=i,t.width=o-a,t.height=u-i,t};var c=new i,l=new t,f=new t;return s.fromRectangle=function(t,a,i){if(r(i)||(i=new s),!r(t))return i.x=0,i.y=0,i.width=0,i.height=0,i;a=n(a,c);var o=a.project(u.southwest(t,l)),h=a.project(u.northeast(t,f));return e.subtract(h,o,h),i.x=o.x,i.y=o.y,i.width=h.x,i.height=h.y,i},s.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new s(e.x,e.y,e.width,e.height):void 0},s.union=function(e,t,n){r(n)||(n=new s);var a=Math.min(e.x,t.x),i=Math.min(e.y,t.y),o=Math.max(e.x+e.width,t.x+t.width),u=Math.max(e.y+e.height,t.y+t.height);return n.x=a,n.y=i,n.width=o-a,n.height=u-i,n},s.expand=function(e,t,n){n=s.clone(e,n);var r=t.x-n.x,a=t.y-n.y;return r>n.width?n.width=r:0>r&&(n.width-=r,n.x=t.x),a>n.height?n.height=a:0>a&&(n.height-=a,n.y=t.y),n},s.intersect=function(e,t){var n=e.x,r=e.y,a=t.x,i=t.y;return n>a+t.width||n+e.width<a||r+e.height<i||r>i+t.height?o.OUTSIDE:o.INTERSECTING},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.intersect=function(e){return s.intersect(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r,a){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(a,0)};i.fromElements=function(e,n,r,a,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=a,o):new i(e,n,r,a)},i.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r++],a.w=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,s);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):n.y<=n.z?n.y<=n.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)&&a.equalsEpsilon(e.w,n.w,r,i)},i.ZERO=r(new i(0,0,0,0)),i.UNIT_X=r(new i(1,0,0,0)),i.UNIT_Y=r(new i(0,1,0,0)),i.UNIT_Z=r(new i(0,0,1,0)),i.UNIT_W=r(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(d[n],h[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=i.EPSILON15,r=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(d[o],h[o])]);u>r&&(a=o,r=u)}var s=1,l=0,f=h[a],m=d[a];if(Math.abs(e[c.getElementIndex(m,f)])>n){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,n,r,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++],a[4]=e[r++],a[5]=e[r++],a[6]=e[r++],a[7]=e[r++],a[8]=e[r++],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],a[4]=e[r+4],a[5]=e[r+5],a[6]=e[r+6],a[7]=e[r+7],a[8]=e[r+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,h=e.z*e.w,d=e.w*e.w,m=r-u-f+d,p=2*(a-h),y=2*(i+l),v=2*(a+h),g=-r+u-f+d,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-r-u+f+d;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(m,p,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=a,t[6]=0,t[7]=-a,t[8]=r,t):new c(1,0,0,0,r,-a,0,a,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=r,t):new c(r,0,a,0,1,0,-a,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=a,t[2]=0,t[3]=-a,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-a,0,a,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,a=e[r],i=e[r+1],o=e[r+2];return n.x=a,n.y=i,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=3*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],a=e[t+3],i=e[t+6]; -return n.x=r,n.y=a,n.z=i,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=a,n[2]=i,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[3]*a+e[6]*i,u=e[1]*r+e[4]*a+e[7]*i,s=e[2]*r+e[5]*a+e[8]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var h=[1,0,0],d=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var r=i.EPSILON20,a=10,l=0,f=0;n(t)||(t={});for(var h=t.unitary=c.clone(c.IDENTITY,t.unitary),d=t.diagonal=c.clone(e,t.diagonal),y=r*o(d);a>f&&u(d)>y;)s(d,m),c.transpose(m,p),c.multiply(d,m,d),c.multiply(p,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*r-n*c)+u*(n*o-i*r)},c.inverse=function(e,t){var n=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],h=e[7],d=e[8],m=c.determinant(e);if(Math.abs(m)<=i.EPSILON15)throw new r("matrix is not invertible");t[0]=s*d-h*l,t[1]=h*o-a*d,t[2]=a*l-s*o,t[3]=f*l-u*d,t[4]=n*d-f*o,t[5]=u*o-n*l,t[6]=u*h-f*s,t[7]=f*a-n*h,t[8]=n*s-u*a;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,a,i,o,u,s){"use strict";var c=function(e,t,r,a,i,o,u,s,c,l,f,h,d,m,p,y){this[0]=n(e,0),this[1]=n(i,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(p,0),this[12]=n(a,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=n(a,e.ZERO),r(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,a){r(a)||(a=new c);var i=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,h=t.x*t.w,d=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-d-y+g,x=2*(l-v),E=2*(f+p),S=2*(l+v),_=-s+d-y+g,M=2*(m-h),O=2*(f-p),P=2*(m+h),T=-s-d+y+g;return a[0]=w*i,a[1]=S*i,a[2]=O*i,a[3]=0,a[4]=x*o,a[5]=_*o,a[6]=P*o,a[7]=0,a[8]=E*u,a[9]=M*u,a[10]=T*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,h=new e;c.fromCamera=function(t,n){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,p=l.y,y=l.z,v=h.x,g=h.y,w=h.z,x=a.x,E=a.y,S=a.z,_=u*-x+s*-E+d*-S,M=v*-x+g*-E+w*-S,O=m*x+p*E+y*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=g,n[6]=-p,n[7]=0,n[8]=d,n[9]=w,n[10]=-y,n[11]=0,n[12]=_,n[13]=M,n[14]=O,n[15]=1,n):new c(u,s,d,_,v,g,w,M,-m,-p,-y,O,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,n,r,a,i,o){var u=1/(t-e),s=1/(r-n),c=1/(i-a),l=-(t+e)*u,f=-(r+n)*s,h=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o},c.computePerspectiveOffCenter=function(e,t,n,r,a,i,o){var u=2*a/(t-e),s=2*a/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),f=-(i+a)/(i-a),h=-1,d=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,a,i){var o=2*a/(t-e),u=2*a/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,f=-1,h=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=h,i[15]=0,i},c.computeViewportTransformation=function(e,t,r,a){e=n(e,n.EMPTY_OBJECT);var i=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-t),h=c,d=l,m=f,p=i+c,y=o+l,v=t+f,g=1;return a[0]=h,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=d,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=m,a[11]=0,a[12]=p,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,a=e[r],i=e[r+1],o=e[r+2],u=e[r+3];return n.x=a,n.y=i,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=4*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r[a+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return n.x=r,n.y=a,n.z=i,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var d=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],d)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],d)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],d)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],h=e[9],d=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],_=t[4],M=t[5],O=t[6],P=t[7],T=t[8],R=t[9],C=t[10],N=t[11],I=t[12],z=t[13],A=t[14],b=t[15],D=r*w+u*x+f*E+p*S,q=a*w+s*x+h*E+y*S,U=i*w+c*x+d*E+v*S,L=o*w+l*x+m*E+g*S,B=r*_+u*M+f*O+p*P,W=a*_+s*M+h*O+y*P,F=i*_+c*M+d*O+v*P,G=o*_+l*M+m*O+g*P,k=r*T+u*R+f*C+p*N,j=a*T+s*R+h*C+y*N,V=i*T+c*R+d*C+v*N,Y=o*T+l*R+m*C+g*N,H=r*I+u*z+f*A+p*b,Z=a*I+s*z+h*A+y*b,X=i*I+c*z+d*A+v*b,J=o*I+l*z+m*A+g*b;return n[0]=D,n[1]=q,n[2]=U,n[3]=L,n[4]=B,n[5]=W,n[6]=F,n[7]=G,n[8]=k,n[9]=j,n[10]=V,n[11]=Y,n[12]=H,n[13]=Z,n[14]=X,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=e[12],d=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],_=t[10],M=t[12],O=t[13],P=t[14],T=r*p+o*y+c*v,R=a*p+u*y+l*v,C=i*p+s*y+f*v,N=r*g+o*w+c*x,I=a*g+u*w+l*x,z=i*g+s*w+f*x,A=r*E+o*S+c*_,b=a*E+u*S+l*_,D=i*E+s*S+f*_,q=r*M+o*O+c*P+h,U=a*M+u*O+l*P+d,L=i*M+s*O+f*P+m;return n[0]=T,n[1]=R,n[2]=C,n[3]=0,n[4]=N,n[5]=I,n[6]=z,n[7]=0,n[8]=A,n[9]=b,n[10]=D,n[11]=0,n[12]=q,n[13]=U,n[14]=L,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=t[0],d=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=r*h+o*d+c*m,S=a*h+u*d+l*m,_=i*h+s*d+f*m,M=r*p+o*y+c*v,O=a*p+u*y+l*v,P=i*p+s*y+f*v,T=r*g+o*w+c*x,R=a*g+u*w+l*x,C=i*g+s*w+f*x;return n[0]=E,n[1]=S,n[2]=_,n[3]=0,n[4]=M,n[5]=O,n[6]=P,n[7]=0,n[8]=T,n[9]=R,n[10]=C,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=r*e[0]+a*e[4]+i*e[8]+e[12],u=r*e[1]+a*e[5]+i*e[9]+e[13],s=r*e[2]+a*e[6]+i*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var p=new e;c.multiplyByUniformScale=function(e,t,n){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,n)},c.multiplyByScale=function(e,t,n){var r=t.x,a=t.y,i=t.z;return 1===r&&1===a&&1===i?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=a*e[4],n[5]=a*e[5],n[6]=a*e[6],n[7]=0,n[8]=i*e[8],n[9]=i*e[9],n[10]=i*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*r+e[4]*a+e[8]*i+e[12]*o,s=e[1]*r+e[5]*a+e[9]*i+e[13]*o,c=e[2]*r+e[6]*a+e[10]*i+e[14]*o,l=e[3]*r+e[7]*a+e[11]*i+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i,u=e[1]*r+e[5]*a+e[9]*i,s=e[2]*r+e[6]*a+e[10]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i+e[12],u=e[1]*r+e[5]*a+e[9]*i+e[13],s=e[2]*r+e[6]*a+e[10]*i+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],a=e[4],i=e[8],l=e[12],f=e[1],h=e[5],d=e[9],m=e[13],p=e[2],x=e[6],E=e[10],S=e[14],_=e[3],M=e[7],O=e[11],P=e[15],T=E*P,R=S*O,C=x*P,N=S*M,I=x*O,z=E*M,A=p*P,b=S*_,D=p*O,q=E*_,U=p*M,L=x*_,B=T*h+N*d+I*m-(R*h+C*d+z*m),W=R*f+A*d+q*m-(T*f+b*d+D*m),F=C*f+b*h+U*m-(N*f+A*h+L*m),G=z*f+D*h+L*d-(I*f+q*h+U*d),k=R*a+C*i+z*l-(T*a+N*i+I*l),j=T*r+b*i+D*l-(R*r+A*i+q*l),V=N*r+A*a+L*l-(C*r+b*a+U*l),Y=I*r+q*a+U*i-(z*r+D*a+L*i);T=i*m,R=l*d,C=a*m,N=l*h,I=a*d,z=i*h,A=r*m,b=l*f,D=r*d,q=i*f,U=r*h,L=a*f;var H=T*M+N*O+I*P-(R*M+C*O+z*P),Z=R*_+A*O+q*P-(T*_+b*O+D*P),X=C*_+b*M+U*P-(N*_+A*M+L*P),J=z*_+D*M+L*O-(I*_+q*M+U*O),K=C*E+z*S+R*x-(I*S+T*x+N*E),Q=D*S+T*p+b*E-(A*E+q*S+R*p),$=A*x+L*S+N*p-(U*S+C*p+b*x),et=U*E+I*p+q*x-(D*x+L*E+z*p),tt=r*B+a*W+i*F+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=B*tt,n[1]=W*tt,n[2]=F*tt,n[3]=G*tt,n[4]=k*tt,n[5]=j*tt,n[6]=V*tt,n[7]=Y*tt,n[8]=H*tt,n[9]=Z*tt,n[10]=X*tt,n[11]=J*tt,n[12]=K*tt,n[13]=Q*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],h=e[13],d=e[14],m=-n*f-r*h-a*d,p=-i*f-o*h-u*d,y=-s*f-c*h-l*d;return t[0]=n,t[1]=i,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t,n){this.normal=e.clone(t),this.distance=n};a.fromPointNormal=function(n,r,i){var o=-e.dot(r,n);return t(i)?(e.clone(r,i.normal),i.distance=o,i):new a(r,o)};var i=new e;return a.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,i),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new a(o,u)},a.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},a.ORIGIN_XY_PLANE=r(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=r(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=r(new a(e.UNIT_Y,0)),a}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,a,i,o,u,s,c,l,f,h){"use strict";var d=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,_=new e,M=new e,O=new e;d.fromPoints=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var a=e.clone(t[0],x),i=e.clone(a,m),o=e.clone(a,p),u=e.clone(a,y),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),f=t.length,h=1;f>h;h++){e.clone(t[h],a);var P=a.x,T=a.y,R=a.z;P<i.x&&e.clone(a,i),P>s.x&&e.clone(a,s),T<o.y&&e.clone(a,o),T>c.y&&e.clone(a,c),R<u.z&&e.clone(a,u),R>l.z&&e.clone(a,l)}var C=e.magnitudeSquared(e.subtract(s,i,E)),N=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),z=i,A=s,b=C;N>b&&(b=N,z=o,A=c),I>b&&(b=I,z=u,A=l);var D=S;D.x=.5*(z.x+A.x),D.y=.5*(z.y+A.y),D.z=.5*(z.z+A.z);var q=e.magnitudeSquared(e.subtract(A,D,E)),U=Math.sqrt(q),L=_;L.x=i.x,L.y=o.y,L.z=u.z;var B=M;B.x=s.x,B.y=c.y,B.z=l.z;var W=e.multiplyByScalar(e.add(L,B,E),.5,O),F=0;for(h=0;f>h;h++){e.clone(t[h],a);var G=e.magnitude(e.subtract(a,W,E));G>F&&(F=G);var k=e.magnitudeSquared(e.subtract(a,D,E));if(k>q){var j=Math.sqrt(k);U=.5*(U+j),q=U*U;var V=j-U;D.x=(U*D.x+V*a.x)/j,D.y=(U*D.y+V*a.y)/j,D.z=(U*D.z+V*a.z)/j}}return F>U?(e.clone(D,n.center),n.radius=U):(e.clone(W,n.center),n.radius=F),n};var P=new u,T=new e,R=new e,C=new t,N=new t;d.fromRectangle2D=function(e,t,n){return d.fromRectangleWithHeights2D(e,t,0,0,n)},d.fromRectangleWithHeights2D=function(t,a,i,o,u){if(r(u)||(u=new d),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=n(a,P),h.southwest(t,C),C.height=i,h.northeast(t,N),N.height=o;var s=a.project(C,T),c=a.project(N,R),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*f,p.z=s.z+.5*m,u};var I=[];d.fromRectangle3D=function(e,t,a,i){t=n(t,o.WGS84),a=n(a,0);var u;return r(e)&&(u=h.subsample(e,t,a,I)),d.fromPoints(u,i)},d.fromVertices=function(t,a,i,o){if(r(o)||(o=new d),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=n(a,e.ZERO),i=n(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),f=e.clone(u,v),h=e.clone(u,g),P=e.clone(u,w),T=t.length,R=0;T>R;R+=i){var C=t[R]+a.x,N=t[R+1]+a.y,I=t[R+2]+a.z;u.x=C,u.y=N,u.z=I,C<s.x&&e.clone(u,s),C>f.x&&e.clone(u,f),N<c.y&&e.clone(u,c),N>h.y&&e.clone(u,h),I<l.z&&e.clone(u,l),I>P.z&&e.clone(u,P)}var z=e.magnitudeSquared(e.subtract(f,s,E)),A=e.magnitudeSquared(e.subtract(h,c,E)),b=e.magnitudeSquared(e.subtract(P,l,E)),D=s,q=f,U=z;A>U&&(U=A,D=c,q=h),b>U&&(U=b,D=l,q=P);var L=S;L.x=.5*(D.x+q.x),L.y=.5*(D.y+q.y),L.z=.5*(D.z+q.z);var B=e.magnitudeSquared(e.subtract(q,L,E)),W=Math.sqrt(B),F=_;F.x=s.x,F.y=c.y,F.z=l.z;var G=M;G.x=f.x,G.y=h.y,G.z=P.z;var k=e.multiplyByScalar(e.add(F,G,E),.5,O),j=0;for(R=0;T>R;R+=i){u.x=t[R]+a.x,u.y=t[R+1]+a.y,u.z=t[R+2]+a.z;var V=e.magnitude(e.subtract(u,k,E));V>j&&(j=V);var Y=e.magnitudeSquared(e.subtract(u,L,E));if(Y>B){var H=Math.sqrt(Y);W=.5*(W+H),B=W*W;var Z=H-W;L.x=(W*L.x+Z*u.x)/H,L.y=(W*L.y+Z*u.y)/H,L.z=(W*L.z+Z*u.z)/H}}return j>W?(e.clone(L,o.center),o.radius=W):(e.clone(k,o.center),o.radius=j),o},d.fromCornerPoints=function(t,n,a){r(a)||(a=new d);var i=a.center;return e.add(t,n,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,n),a},d.fromEllipsoid=function(t,n){return r(n)||(n=new d),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var z=new e;d.fromBoundingSpheres=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var a=t.length;if(1===a)return d.clone(t[0],n);if(2===a)return d.union(t[0],t[1],n);for(var i=[],o=0;a>o;o++)i.push(t[o].center);n=d.fromPoints(i,n);var u=n.center,s=n.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,z)+c.radius)}return n.radius=s,n},d.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new d(t.center,t.radius):void 0},d.packedLength=4,d.pack=function(e,t,r){r=n(r,0);var a=e.center;t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r]=e.radius},d.unpack=function(e,t,a){t=n(t,0),r(a)||(a=new d);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var A=new e,b=new e;d.union=function(t,n,a){r(a)||(a=new d);var i=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,i,A),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return n.clone(a),a;var f=.5*(o+l+s),h=e.multiplyByScalar(c,(-o+f)/l,b);return e.add(h,i,h),e.clone(h,a.center),a.radius=f,a};var D=new e;d.expand=function(t,n,r){r=d.clone(t,r);var a=e.magnitude(e.subtract(n,r.center,D));return a>r.radius&&(r.radius=a),r},d.intersectPlane=function(t,n){var r=t.center,a=t.radius,i=n.normal,o=e.dot(i,r)+n.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);d.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(t,q);return d.intersectPlane(e,n)},d.transform=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var U=new e;d.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,U);return e.magnitudeSquared(r)-t.radius*t.radius},d.transformWithoutScale=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var L=new e;d.computePlaneDistances=function(t,n,a,i){r(i)||(i=new c);var o=e.subtract(t.center,n,L),u=e.multiplyByScalar(a,e.dot(a,o),L),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var B=new e,W=new e,F=new e,G=new e,k=new e,j=new t,V=new Array(8),Y=0;8>Y;++Y)V[Y]=new e;var H=new u;return d.projectTo2D=function(t,r,a){r=n(r,H);var i=r.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,W);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),h=e.negate(c,G),m=V,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,h,p),p=m[2],e.add(s,f,p),e.add(p,h,p),p=m[3],e.add(s,f,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,h,p),p=m[6],e.add(s,f,p),e.add(p,h,p),p=m[7],e.add(s,f,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,j);r.project(w,g)}a=d.fromPoints(m,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},d.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},d.prototype.intersectPlane=function(e){return d.intersectPlane(this,e)},d.prototype.intersect=function(e){return d.intersect(this,e)},d.prototype.equals=function(e){return d.equals(this,e)},d.prototype.clone=function(e){return d.clone(this,e)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(r.requestFullscreen=a,n=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(r.requestFullscreen=a,n=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?r.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(r.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?r.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(r.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?r.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(r.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),r.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),r.fullscreenerror=a)}return n},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[r.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[r.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=r(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1])))}return S}function f(){return l()&&_}function h(){if(!t(M)){M=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(M=!0,O=r(e[1]))}return M}function d(){return t(P)||(P=/Windows/i.test(navigator.appVersion)),P}function m(){return h()&&O}function p(){return t(T)||(T=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var y,v,g,w,x,E,S,_,M,O,P,T,R={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return R.supportsFullscreen=function(){return n.supportsFullscreen()},R.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},R.supportsWebWorkers=function(){return"undefined"!=typeof Worker},R}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,a){"use strict";if(!r.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,r,a,o){switch(a=e(a,0),o=e(o,(r.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(r,a,o); -case i.UNSIGNED_BYTE:return new Uint8Array(r,a,o);case i.SHORT:return new Int16Array(r,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(r,a,o);case i.FLOAT:return new Float32Array(r,a,o);case i.DOUBLE:return new Float64Array(r,a,o);default:throw new n("componentDatatype is not a valid value.")}},a(i)}),define("Core/CornerType",["./freezeObject"],function(e){"use strict";var t={ROUNDED:0,MITERED:1,BEVELED:2};return e(t)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var r=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,n,a){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,a):new Uint16Array(t,n,a)},n(a)}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,a,i,o){"use strict";var u=function(r,a,i){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),n(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var a=t[0].x,i=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,h=1;f>h;h++){var d=t[h],m=d.x,p=d.y,y=d.z;a=Math.min(m,a),s=Math.max(m,s),i=Math.min(p,i),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=a,v.y=i,v.z=o;var g=r.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,r.center);return e.multiplyByScalar(w,.5,w),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),a=n.normal,o=r.x*Math.abs(a.x)+r.y*Math.abs(a.y)+r.z*Math.abs(a.z),u=e.dot(t.center,a)+n.distance;return u-o>0?i.INSIDE:0>u+o?i.OUTSIDE:i.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function n(e,n,r){var a=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(n)))<r?0:a}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,a){var i;if(0===e)return 0===r?[]:[-a/r];if(0===r){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-r/e,0>i?[i,0]:[0,i];var c=r*r,l=4*e*a,f=n(c,-l,t.EPSILON14);if(0>f)return[];var h=-.5*n(r,t.sign(r)*Math.sqrt(f),t.EPSILON14);return r>0?[h/e,a/h]:[a/h,h/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var a,i,o=e,u=t/3,s=n/3,c=r,l=o*s,f=u*c,h=u*u,d=s*s,m=o*s-h,p=o*c-u*s,y=u*c-d,v=4*m*y-p*p;if(0>v){var g,w,x;h*f>=l*d?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var _=i/2,M=0>_?-Math.pow(-_,1/3):Math.pow(_,1/3),O=i===S?-M:-w/M;return a=0>=w?M+O:-x/(M*M+O*O+w),h*f>=l*d?[(a-u)/o]:[-c/(a+s)]}var P=m,T=-2*u*m+o*p,R=y,C=-c*p+2*s*y,N=Math.sqrt(v),I=Math.sqrt(3)/2,z=Math.abs(Math.atan2(o*N,-T)/3);a=2*Math.sqrt(-P);var A=Math.cos(z);i=a*A;var b=a*(-A/2-I*Math.sin(z)),D=i+b>2*u?i-u:b-u,q=o,U=D/q;z=Math.abs(Math.atan2(c*N,-C)/3),a=2*Math.sqrt(-R),A=Math.cos(z),i=a*A,b=a*(-A/2-I*Math.sin(z));var L=-c,B=2*s>i+b?i+s:b+s,W=L/B,F=q*B,G=-D*B-q*L,k=D*L,j=(s*G-u*k)/(-u*G+s*F);return j>=U?W>=U?W>=j?[U,j,W]:[U,W,j]:[W,U,j]:W>=U?[j,U,W]:W>=j?[j,W,U]:[W,j,U]}var r={};return r.computeDiscriminant=function(e,t,n,r){var a=e*e,i=t*t,o=n*n,u=r*r,s=18*e*t*n*r+i*o-27*a*u-4*(e*o*n+i*t*r);return s},r.computeRealRoots=function(e,r,a,i){var o,u;if(0===e)return t.computeRealRoots(r,a,i);if(0===r){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,a,i)}return 0===a?0===i?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,i):0===i?(o=t.computeRealRoots(e,r,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,a,i)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var h=-t/4,d=f[f.length-1];if(Math.abs(d)<n.EPSILON14){var m=r.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[h-w,h-g,h+g,h+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[h-p,h+p];if(0>y&&v>=0)return p=Math.sqrt(v),[h-p,h+p]}return[]}if(d>0){var x=Math.sqrt(d),E=(s+d-c/x)/2,S=(s+d+c/x)/2,_=r.computeRealRoots(1,x,E),M=r.computeRealRoots(1,-x,S);return 0!==_.length?(_[0]+=h,_[1]+=h,0!==M.length?(M[0]+=h,M[1]+=h,_[1]<=M[0]?[_[0],_[1],M[0],M[1]]:M[1]<=_[0]?[M[0],M[1],_[0],_[1]]:_[0]>=M[0]&&_[1]<=M[1]?[M[0],_[0],_[1],M[1]]:M[0]>=_[0]&&M[1]<=_[1]?[_[0],M[0],M[1],_[1]]:_[0]>M[0]&&_[0]<M[1]?[M[0],_[0],M[1],_[1]]:[_[0],M[0],_[1],M[1]]):_):0!==M.length?(M[0]+=h,M[1]+=h,M):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,f=i*t+s-4*o,h=c*o-i*a*t+u,d=e.computeRealRoots(1,l,f,h);if(d.length>0){var m,p,y=d[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),_=c-4*y,M=c+4*Math.abs(y);if(0>y||_*S>E*M){var O=Math.sqrt(_);m=O/2,p=0===O?0:(t*x-i)/O}else{var P=Math.sqrt(E);m=0===P?0:(t*x-i)/P,p=P/2}var T,R;0===w&&0===m?(T=0,R=0):n.sign(w)===n.sign(m)?(T=w+m,R=y/T):(R=w-m,T=y/R);var C,N;0===x&&0===p?(C=0,N=0):n.sign(x)===n.sign(p)?(C=x+p,N=o/C):(N=x-p,C=o/N);var I=r.computeRealRoots(1,T,C),z=r.computeRealRoots(1,R,N);if(0!==I.length)return 0!==z.length?I[1]<=z[0]?[I[0],I[1],z[0],z[1]]:z[1]<=I[0]?[z[0],z[1],I[0],I[1]]:I[0]>=z[0]&&I[1]<=z[1]?[z[0],I[0],I[1],z[1]]:z[0]>=I[0]&&z[1]<=I[1]?[I[0],z[0],z[1],I[1]]:I[0]>z[0]&&I[0]<z[1]?[z[0],I[0],z[1],I[1]]:[I[0],z[0],I[1],z[1]]:I;if(0!==z.length)return z}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=n*n,l=c*n,f=r*r,h=f*r,d=a*a,m=d*a,p=u*c*f-4*s*h-4*e*l*f+18*e*t*n*h-27*i*f*f+256*o*m+a*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*f+144*i*n*f)+d*(144*e*u*n-27*u*u-128*i*c-192*i*t*r);return p},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,f=u/t,h=s/t,d=0>c?1:0;switch(d+=0>l?d+1:d,d+=0>f?d+1:d,d+=0>h?d+1:d){case 0:return a(c,l,f,h);case 1:return i(c,l,f,h);case 2:return i(c,l,f,h);case 3:return a(c,l,f,h);case 4:return a(c,l,f,h);case 5:return i(c,l,f,h);case 6:return a(c,l,f,h);case 7:return a(c,l,f,h);case 8:return i(c,l,f,h);case 9:return a(c,l,f,h);case 10:return a(c,l,f,h);case 11:return i(c,l,f,h);case 12:return a(c,l,f,h);case 13:return a(c,l,f,h);case 14:return a(c,l,f,h);case 15:return a(c,l,f,h);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,a){return n(a)||(a=new e),a=e.multiplyByScalar(t.direction,r,a),e.add(t.origin,a,a)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(t,r,a,o,u){u=n(u,!1);var s,c,l,f,h,d=t.origin,m=t.direction,p=e.subtract(a,r,y),E=e.subtract(o,r,v),S=e.cross(m,E,g),_=e.dot(p,S);if(u){if(_<i.EPSILON6)return void 0;if(s=e.subtract(d,r,w),l=e.dot(s,S),0>l||l>_)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c),0>f||l+f>_)return void 0;h=e.dot(E,c)/_}else{if(Math.abs(_)<i.EPSILON6)return void 0;var M=1/_;if(s=e.subtract(d,r,w),l=e.dot(s,S)*M,0>l||l>1)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c)*M,0>f||l+f>1)return void 0;h=e.dot(E,c)*M}return h}function f(e,t,n,r){var a=t*t-4*e*n;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function h(t,n,a){r(a)||(a={});var i=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(i,u,g),l=e.dot(o,o),h=2*e.dot(o,c),d=e.magnitudeSquared(c)-s,m=f(l,h,d,S);return r(m)?(a.start=m.root0,a.stop=m.root1,a):void 0}function d(e,t,n){var r=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function m(t,n,r,a,c){var l,f=a*a,h=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*h,p=c*(a*d(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*h+a*n.x+r,v=h*d(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*d(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],_=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-_)),w.push(new e(a,c*S,c*_))}return w}var M=g*g,O=v*v,P=m*m,T=g*v,R=P+O,C=2*(p*m+T),N=2*y*m+p*p-O+M,I=2*(y*p-T),z=y*y-M;if(0===R&&0===C&&0===N&&0===I)return w;l=s.computeRealRoots(R,C,N,I,z);var A=l.length;if(0===A)return w;for(var b=0;A>b;++b){var D,q=l[b],U=q*q,L=Math.max(1-U,0),B=Math.sqrt(L);D=i.sign(m)===i.sign(y)?d(m*U+y,p*q,i.EPSILON12):i.sign(y)===i.sign(p*q)?d(m*U,p*q+y,i.EPSILON12):d(m*U+p*q,y,i.EPSILON12);var W=d(v*q,g,i.EPSILON15),F=D*W;0>F?w.push(new e(a,c*q,c*B)):F>0?w.push(new e(a,c*q,c*-B)):0!==B?(w.push(new e(a,c*q,c*-B)),w.push(new e(a,c*q,c*B)),++b):w.push(new e(a,c*q,c*B))}return w}var p={};p.rayPlane=function(t,n,a){r(a)||(a=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,n,a,i,o,u){var s=l(t,n,a,i,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;p.lineSegmentTriangle=function(t,n,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,a,i,o,u);return!r(f)||0>f||f>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};p.raySphere=function(e,t,n){return n=h(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var _=new c;p.lineSegmentSphere=function(t,n,a,i){var o=_;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=h(o,a,i),!r(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var M=new e,O=new e;p.rayEllipsoid=function(t,n){var r,a,i,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,M),l=e.multiplyComponents(s,t.direction,O),f=e.magnitudeSquared(c),h=e.dot(c,l);if(f>1){if(h>=0)return void 0;var d=h*h;if(r=f-1,a=e.magnitudeSquared(l),i=a*r,i>d)return void 0;if(d>i){o=h*h-i,u=-h+Math.sqrt(o);var m=u/a,p=r/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(r/a);return{start:y,stop:y}}return 1>f?(r=f-1,a=e.magnitudeSquared(l),i=a*r,o=h*h-i,u=-h+Math.sqrt(o),{start:0,stop:u/a}):0>h?(a=e.magnitudeSquared(l),{start:0,stop:-h/a}):void 0};var P=new e,T=new e,R=new e,C=new e,N=new e,I=new o,z=new o,A=new o,b=new o,D=new o,q=new o,U=new o,L=new e,B=new e,W=new t;p.grazingAltitudeLocation=function(t,n){var a=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(a,P);if(e.dot(u,s)>=0)return a;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,P),f=e.normalize(l,l),h=e.mostOrthogonalAxis(l,C),d=e.normalize(e.cross(h,f,T),T),p=e.normalize(e.cross(f,d,R),R),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=d.x,y[4]=d.y,y[5]=d.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,z),g=o.fromScale(n.radii,A),w=o.fromScale(n.oneOverRadii,b),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,_=o.multiply(o.multiply(v,w,q),x,q),M=o.multiply(o.multiply(_,g,U),y,U),O=o.multiplyByVector(_,a,N),F=m(M,e.negate(O,P),0,0,1),G=F.length;if(G>0){for(var k=e.clone(e.ZERO,B),j=Number.NEGATIVE_INFINITY,V=0;G>V;++V){E=o.multiplyByVector(g,o.multiplyByVector(y,F[V],L),L);var Y=e.normalize(e.subtract(E,a,C),C),H=e.dot(Y,u);H>j&&(j=H,k=e.clone(E,k))}var Z=n.cartesianToCartographic(k,W);return j=i.clamp(j,0,1),S=e.magnitude(e.subtract(k,a,C))*Math.sqrt(1-j*j),S=c?-S:S,Z.height=S,n.cartographicToCartesian(Z,new e)}return void 0};var F=new e;return p.lineSegmentPlane=function(t,n,a,o){r(o)||(o=new e);var u=e.subtract(n,t,F),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(a.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,n,r,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,n)+o<0,c=e.dot(i,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,h;if((1===l||2===l)&&(f=new e,h=new e),1===l){if(u)return p.lineSegmentPlane(t,n,a,f),p.lineSegmentPlane(t,r,a,h),{positions:[t,n,r,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,a,f),p.lineSegmentPlane(n,t,a,h),{positions:[t,n,r,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,a,f),p.lineSegmentPlane(r,n,a,h),{positions:[t,n,r,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,a,f),p.lineSegmentPlane(r,t,a,h),{positions:[t,n,r,f,h],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,a,f),p.lineSegmentPlane(t,n,a,h),{positions:[t,n,r,f,h],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,a,f),p.lineSegmentPlane(n,r,a,h),{positions:[t,n,r,f,h],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,a){return t(e).then(n,r,a)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=a(e),t}function n(t){return e(t,i)}function r(e){this.then=e}function a(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return i(r)}});return n}function i(e){var n=new r(function(n,r){try{return r?t(r(e)):i(e)}catch(a){return i(a)}});return n}function o(){function e(e,t,n){return h(e,t,n)}function n(e){return m(e)}function a(e){return m(i(e))}function u(e){return d(e)}var s,c,l,f,h,d,m;return c=new r(e),s={then:e,resolve:n,reject:a,progress:u,promise:c,resolver:{resolve:n,reject:a,progress:u}},l=[],f=[],h=function(e,t,n){var r,a;return r=o(),a="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,a)}),f.push(a),r.promise},d=function(e){return p(f,e),e},m=function(e){return e=t(e),h=e.then,m=t,d=v,p(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,a,i){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,f,h,d,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(n,g)),f=[],l=g-c+1,h=[],d=o(),c)for(y=d.progress,p=function(e){h.push(e),--l||(m=p=v,d.reject(h))},m=function(e){f.push(e),--c||(m=p=v,d.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else d.resolve(f);return d.then(r,a,i)})}function c(e,t,n,r){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,n,r)}function l(e,t,n,r){return y(1,arguments),h(e,g).then(t,n,r)}function f(){return h(arguments,g)}function h(t,n){return e(t,function(t){var r,a,i,u,s,c;if(i=a=t.length>>>0,r=[],c=o(),i)for(u=function(t,a){e(t,n).then(function(e){r[a]=e,--i||c.resolve(r)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(r);return c.promise})}function d(t,n){var r=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,r[0]=function(t,r,i){return e(t,function(t){return e(r,function(e){return n(t,e,i,a)})})},w.apply(t,r)})}function m(t,n,r){var a=arguments.length>2;return e(t,function(e){return e=a?r:e,n.resolve(e),e},function(e){return n.reject(e),i(e)},n.progress)}function p(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=n,e.join=f,e.all=l,e.map=h,e.reduce=d,e.any=c,e.some=s,e.chain=m,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,n,r,a,i;if(i=0,t=Object(this),a=t.length>>>0,n=arguments,n.length<=1)for(;;){if(i in t){r=t[i++];break}if(++i>=a)throw new TypeError}else r=n[1];for(;a>i;++i)i in t&&(r=e(r,t[i],i,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,a,i=0,o=e.length-1;o>=i;)if(r=~~((i+o)/2),a=n(e[r],t),0>a)i=r+1;else{if(!(a>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],a=function(e,t,n,r){n||(n=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+a:a+e},i=function(e,t,n,r,i,o){var u=r-e.length;return u>0&&(e=n||!i?a(e,r,o,n):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+a(c.toString(t),u||0,"0",!1),i(e,n,r,o,s)},u=function(e,t,n,r,a,o){return null!=r&&(e=e.slice(0,r)),i(e,"",t,n,a,o)},s=function(e,r,s,c,l,f,h){var d,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",_=s.length,M=0;s&&_>M;M++)switch(s.charAt(M)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(M+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[n++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(h)>-1?6:"d"==h?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],h){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return d=+v||0,d=Math.round(d-d%1),m=0>d?"-":w,v=m+a(String(Math.abs(d)),f,"0",!1),i(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return d=+v,m=0>d?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(h.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(h)%2],v=m+Math.abs(d)[p](f),i(v,m,g,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,a,i,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(e,t){return C.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var n=C.leapSeconds,r=t(n,g,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var a=n[r].offset;if(r>0){var i=C.secondsDifference(n[r].julianDate,e);i>a&&(r--,a=n[r].offset)}C.addSeconds(e,a,e)}function h(e,n){g.julianDate=e;var r=C.leapSeconds,a=t(r,g,l);if(0>a&&(a=~a),0===a)return C.addSeconds(e,-r[0].offset,n);if(a>=r.length)return C.addSeconds(e,-r[a-1].offset,n);var i=C.secondsDifference(r[a].julianDate,e);return 0===i?C.addSeconds(e,-r[a].offset,n):1>=i?void 0:C.addSeconds(e,-r[--a].offset,n)}function d(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function m(e,t,n,r,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var f=i+(r*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var p=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,_=/^(\d{4})-?(\d{2})-?(\d{2})$/,M=/([Z+\-])?(\d{2})?:?(\d{2})?$/,O=/^(\d{2})(\.\d+)?/.source+M.source,P=/^(\d{2}):?(\d{2})(\.\d+)?/.source+M.source,T=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+M.source,R="Invalid ISO 8601 date.",C=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,d(a,t,this),r===c.UTC&&f(this)};C.fromDate=function(e,t){var n=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(d(n[0],n[1],t),f(t),t):new C(n[0],n[1],c.UTC)},C.fromIso8601=function(e,t){e=e.replace(",",".");var n,i,u,s=e.split("T"),l=1,h=1,p=0,g=0,M=0,N=0,I=s[0],z=s[1];if(!r(I))throw new a(R);var A;if(s=I.match(_),null!==s){if(A=I.split("-").length-1,A>0&&2!==A)throw new a(R);n=+s[1],l=+s[2],h=+s[3]}else if(s=I.match(x),null!==s)n=+s[1],l=+s[2];else if(s=I.match(w),null!==s)n=+s[1];else{var b;if(s=I.match(E),null!==s){if(n=+s[1],b=+s[2],u=o(n),1>b||u&&b>366||!u&&b>365)throw new a(R)}else{if(s=I.match(S),null===s)throw new a(R);n=+s[1];var D=+s[2],q=+s[3]||0;if(A=I.split("-").length-1,A>0&&(!r(s[3])&&1!==A||r(s[3])&&2!==A))throw new a(R);var U=new Date(Date.UTC(n,0,4));b=7*D+q-U.getUTCDay()-3}i=new Date(Date.UTC(n,0,1)),i.setUTCDate(b),l=i.getUTCMonth()+1,h=i.getUTCDate()}if(u=o(n),1>l||l>12||1>h||(2!==l||!u)&&h>y[l-1]||u&&2===l&&h>v)throw new a(R);var L;if(r(z)){if(s=z.match(T),null!==s){if(A=z.split(":").length-1,A>0&&2!==A&&3!==A)throw new a(R);p=+s[1],g=+s[2],M=+s[3],N=1e3*+(s[4]||0),L=5}else if(s=z.match(P),null!==s){if(A=z.split(":").length-1,A>0&&1!==A)throw new a(R);p=+s[1],g=+s[2],M=60*+(s[3]||0),L=4}else{if(s=z.match(O),null===s)throw new a(R);p=+s[1],g=60*+(s[2]||0),L=3}if(g>=60||M>=61||p>24||24===p&&(g>0||M>0||N>0))throw new a(R);var B=s[L],W=+s[L+1],F=+(s[L+2]||0);switch(B){case"+":p-=W,g-=F;break;case"-":p+=W,g+=F;break;case"Z":break;default:g+=new Date(Date.UTC(n,l-1,h,p,g)).getTimezoneOffset()}}else g+=new Date(n,l-1,h).getTimezoneOffset();var G=60===M;for(G&&M--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,h++;for(i=u&&2===l?v:y[l-1];h>i;)h-=i,l++,l>12&&(l-=12,n++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,h--;for(;1>h;)l--,1>l&&(l+=12,n--),i=u&&2===l?v:y[l-1],h+=i;var k=m(n,l,h,p,g,M,N);return r(t)?(d(k[0],k[1],t),f(t)):t=new C(k[0],k[1],c.UTC),G&&C.addSeconds(t,1,t),t},C.now=function(e){return C.fromDate(new Date,e)};var N=new C(0,0,c.TAI);return C.toGregorianDate=function(e,t){var n=!1,a=h(e,N);r(a)||(C.addSeconds(e,-1,N),a=h(N,N),n=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var d=0|80*c/2447,m=0|c-(0|2447*d/80);c=0|d/11;var p=0|d+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=n,t):new i(y,p,m,v,w,x,E,n)},C.toDate=function(e){var t=C.toGregorianDate(e,p),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},C.toIso8601=function(t,n){var a,i=C.toGregorianDate(t,i);return r(n)||0===i.millisecond?r(n)&&0!==n?(a=(.01*i.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},C.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new C(e.dayNumber,e.secondsOfDay,c.TAI):void 0},C.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},C.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},C.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(C.secondsDifference(e,t))<=n},C.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},C.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},C.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},C.computeTaiMinusUtc=function(e){g.julianDate=e;var n=C.leapSeconds,r=t(n,g,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},C.addSeconds=function(e,t,n){return d(e.dayNumber,e.secondsOfDay+t,n)},C.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return d(e.dayNumber,r,n)},C.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return d(e.dayNumber,r,n)},C.addDays=function(e,t,n){var r=e.dayNumber+t;return d(r,e.secondsOfDay,n)},C.lessThan=function(e,t){return C.compare(e,t)<0},C.lessThanOrEquals=function(e,t){return C.compare(e,t)<=0},C.greaterThan=function(e,t){return C.compare(e,t)>0},C.greaterThanOrEquals=function(e,t){return C.compare(e,t)>=0},C.prototype.clone=function(e){return C.clone(this,e)},C.prototype.equals=function(e){return C.equals(this,e)},C.prototype.equalsEpsilon=function(e,t){return C.equalsEpsilon(this,e,t)},C.prototype.toString=function(){return C.toIso8601(this)},C.leapSeconds=[new u(new C(2441317,43210,c.TAI),10),new u(new C(2441499,43211,c.TAI),11),new u(new C(2441683,43212,c.TAI),12),new u(new C(2442048,43213,c.TAI),13),new u(new C(2442413,43214,c.TAI),14),new u(new C(2442778,43215,c.TAI),15),new u(new C(2443144,43216,c.TAI),16),new u(new C(2443509,43217,c.TAI),17),new u(new C(2443874,43218,c.TAI),18),new u(new C(2444239,43219,c.TAI),19),new u(new C(2444786,43220,c.TAI),20),new u(new C(2445151,43221,c.TAI),21),new u(new C(2445516,43222,c.TAI),22),new u(new C(2446247,43223,c.TAI),23),new u(new C(2447161,43224,c.TAI),24),new u(new C(2447892,43225,c.TAI),25),new u(new C(2448257,43226,c.TAI),26),new u(new C(2448804,43227,c.TAI),27),new u(new C(2449169,43228,c.TAI),28),new u(new C(2449534,43229,c.TAI),29),new u(new C(2450083,43230,c.TAI),30),new u(new C(2450630,43231,c.TAI),31),new u(new C(2451179,43232,c.TAI),32),new u(new C(2453736,43233,c.TAI),33),new u(new C(2454832,43234,c.TAI),34),new u(new C(2456109,43235,c.TAI),35),new u(new C(2457204,43236,c.TAI),36)],C}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var a=new n.constructor;for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];r&&(o=t(o,r)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var a=n[r],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders)) -};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,a,i){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return r}function s(e,n){n=t(n,"");var a=e[1],i=!!e[2],s=e[3];switch(n){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s);return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,a=t(n.method,"GET"),i=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,a,i,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,f){var h=l.exec(e);if(null!==h)return c.resolve(s(h,t)),void 0;var d=new XMLHttpRequest;if(n(f)&&n(d.overrideMimeType)&&d.overrideMimeType(f),d.open(r,e,!0),n(u))for(var m in u)u.hasOwnProperty(m)&&d.setRequestHeader(m,u[m]);n(t)&&(d.responseType=t),d.onload=function(){200===d.status?n(d.response)?c.resolve(d.response):n(d.responseXML)&&d.responseXML.hasChildNodes()?c.resolve(d.responseXML):n(d.responseText)?c.resolve(d.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(d.status,d.response,d.getAllResponseHeaders()))},d.onerror=function(){c.reject(new a)},d.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(n,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,r(n,i).then(function(e){return JSON.parse(e)})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function h(e,t){return o.compare(e.julianDate,t)}function d(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=n.columnNames.indexOf("modifiedJulianDateUtc"),i=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),d=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>d||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=d,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],_=y[x+p],M=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,O=new o(M,_,f.TAI);if(v.push(O),w){if(_!==g&&r(g)){var P=o.leapSeconds,T=t(P,O,h);if(0>T){var R=new u(O,_);P.splice(~T,0,R)}}g=_}}}function m(e,t,n,r,a){var i=n*r;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function p(e,t,n){return t+e*(n-t)}function y(e,t,n,r,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[a],l=t[i];if(c.equals(l)||r.equals(c))return m(e,n,a,s,u),u;if(r.equals(l))return m(e,n,i,s,u),u;var f=o.secondsDifference(r,c)/o.secondsDifference(l,c),h=a*s,d=i*s,y=n[h+e._ut1MinusUtcSecondsColumn],v=n[d+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=n[h+e._taiMinusUtcSecondsColumn],x=n[d+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(r)?y=v:v-=x-w)}return u.xPoleWander=p(f,n[h+e._xPoleWanderRadiansColumn],n[d+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(f,n[h+e._yPoleWanderRadiansColumn],n[d+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(f,n[h+e._xCelestialPoleOffsetRadiansColumn],n[d+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(f,n[h+e._yCelestialPoleOffsetRadiansColumn],n[d+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(f,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))d(this,t.data);else if(r(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){d(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else d(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new a(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var i=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var f=i[u],h=i[u+1],d=o.lessThanOrEquals(f,e),m=!r(h),p=m||o.greaterThanOrEquals(h,e);if(d&&p)return s=u,!m&&h.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,n),n}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),a=f.exec(r);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,h=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return h._cesiumScriptRegex=f,h.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},h}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t,n){var r=f;return r.dayNumber=t,r.secondsOfDay=n,i.daysDifference(r,e._sampleZeroDateTT)}function c(n,a){if(n._chunkDownloadsInProgress[a])return n._chunkDownloadsInProgress[a];var i=e.defer();n._chunkDownloadsInProgress[a]=i;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[a]=!1;for(var t=n._samples,r=e.samples,o=3*a*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];i.resolve()}),i.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new i(0,0,u.TAI);return l.prototype.preload=function(t,n,r,a){var i=s(this,t,n),o=s(this,r,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,h=0|l/this._samplesPerXysFile,d=[],m=f;h>=m;++m)d.push(c(this,m));return e.all(d)},l.prototype.computeXysRadians=function(e,t,n){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var h=!1,d=this._samples;if(r(d[3*l])||(c(this,0|l/this._samplesPerXysFile),h=!0),r(d[3*f])||(c(this,0|f/this._samplesPerXysFile),h=!0),h)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new a(0,0,0);var m,p,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var E=3*(l+m);n.x+=w[m]*d[E++],n.y+=w[m]*d[E++],n.s+=w[m]*d[E]}return n},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,r,a){var i=r/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,h=Math.cos(i);return n(a)?(a.x=u,a.y=l,a.z=f,a.w=h,a):new s(u,l,f,h)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var r,a,i,o,c,h=e[u.COLUMN0ROW0],d=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=h+d+m;if(p>0)r=Math.sqrt(p+1),c=.5*r,r=.5/r,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;d>h&&(v=1),m>h&&m>d&&(v=2);var g=y[v],w=y[g];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,a=-x[0],i=-x[1],o=-x[2]}return n(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var h=new s;s.fromHeadingPitchRoll=function(t,n,r,a){var i=s.fromAxisAngle(e.UNIT_X,r,h),o=s.fromAxisAngle(e.UNIT_Y,-n,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,h);return s.multiply(u,a,a)};var d=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.x=e[r],a.y=e[r+1],a.z=e[r+2],a.w=e[r+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var a=0,i=n-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,d);var u=s.computeAngle(p);r[o]=d.x*u,r[o+1]=d.y*u,r[o+2]=d.z*u}},s.unpackInterpolationResult=function(t,r,a,i,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*i,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,a=e.y*n,i=e.z*n,o=e.w*n;return t.x=r,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+r*l+a*c-i*s,h=o*s-r*c+a*l+i*u,d=o*c+r*s-a*u+i*l,m=o*l-r*u-a*s-i*c;return n.x=f,n.y=h,n.z=d,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,n,r){return g=s.multiplyByScalar(t,n,g),r=s.multiplyByScalar(e,1-n,r),s.add(g,r,r)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,n,r);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(i,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),a=0;return 0!==r&&(a=r/Math.sin(r)),e.multiplyByScalar(t,a,n)},s.exp=function(t,n){var r=e.magnitude(t),a=0;return 0!==r&&(a=Math.sin(r)/r),n.x=t.x*a,n.y=t.y*a,n.z=t.z*a,n.w=Math.cos(r),n};var S=new e,_=new e,M=new s,O=new s;s.computeInnerQuadrangle=function(t,n,r,a){var i=s.conjugate(n,M);s.multiply(i,r,O);var o=s.log(O,S);s.multiply(i,t,O);var u=s.log(O,_);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,M),s.multiply(n,M,a)},s.squad=function(e,t,n,r,a,i){var o=s.slerp(e,t,a,M),u=s.slerp(n,r,a,O);return s.slerp(o,u,2*a*(1-a),i)};for(var P=new s,T=1.9011074535173003,R=a.supportsTypedArrays()?new Float32Array(8):[],C=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],I=a.supportsTypedArrays()?new Float32Array(8):[],z=0;7>z;++z){var A=z+1,b=2*A+1;R[z]=1/(A*b),C[z]=A/b}return R[7]=T/136,C[7]=8*T/17,s.fastSlerp=function(e,t,n,r){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-n,c=n*n,l=u*u,f=7;f>=0;--f)N[f]=(R[f]*c-C[f])*o,I[f]=(R[f]*l-C[f])*o;var h=a*n*(1+N[0]*(1+N[1]*(1+N[2]*(1+N[3]*(1+N[4]*(1+N[5]*(1+N[6]*(1+N[7])))))))),d=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=s.multiplyByScalar(e,d,P);return s.multiplyByScalar(t,h,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,a,i){var o=s.fastSlerp(e,t,a,M),u=s.fastSlerp(n,r,a,O);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,m,p,y,v){"use strict";var g={},w=new n,x=new n,E=new n;g.eastNorthUpToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return i(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new n,_=new n,M=new n;g.northEastDownToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=_,l=M;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var O=new y,P=new n(1,1,1),T=new p;g.headingPitchRollToFixedFrame=function(e,t,r,a,i,o){var u=y.fromHeadingPitchRoll(t,r,a,O),s=p.fromTranslationQuaternionRotationScale(n.ZERO,u,P,T);return o=g.eastNorthUpToFixedFrame(e,i,o),p.multiply(o,s,o)};var R=new p,C=new m;g.headingPitchRollQuaternion=function(e,t,n,r,a,i){var o=g.headingPitchRollToFixedFrame(e,t,n,r,a,R),u=p.getRotation(o,C);return y.fromRotationMatrix(u,i)};var N=24110.54841,I=8640184.812866,z=.093104,A=-62e-7,b=1.1772758384668e-19,D=72921158553e-15,q=d.TWO_PI/86400,U=new h;g.computeTemeToPseudoFixedMatrix=function(e,t){U=h.addSeconds(e,-h.computeTaiMinusUtc(e),U);var n,r=U.dayNumber,a=U.secondsOfDay,o=r-2451545;n=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=N+n*(I+n*(z+n*A)),s=u*q%d.TWO_PI,c=D+b*(r-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,p=Math.cos(f),y=Math.sin(f);return i(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var L=32.184,B=2451545;g.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+L,a=t.stop.dayNumber,i=t.stop.secondsOfDay+L,o=g.iau2006XysData.preload(n,r,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new m);var n=g.computeFixedToIcrfMatrix(e,t);return i(n)?m.transpose(n,t):void 0};var W=new f(0,0,0),F=new s(0,0,0,0,0,0),G=new m,k=new m;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new m);var n=g.earthOrientationParameters.compute(e,F);if(!i(n))return void 0;var r=e.dayNumber,a=e.secondsOfDay+L,o=g.iau2006XysData.computeXysRadians(r,a,W);if(!i(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=m.fromRotationZ(-o.s,k),p=m.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-h.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*d.TWO_PI;var _=m.fromRotationZ(S,k),M=m.multiply(p,_,G),O=Math.cos(n.xPoleWander),P=Math.cos(n.yPoleWander),T=Math.sin(n.xPoleWander),R=Math.sin(n.yPoleWander),C=r-B+a/v.SECONDS_PER_DAY;C/=36525;var N=-47e-6*C*d.RADIANS_PER_DEGREE/3600,I=Math.cos(N),z=Math.sin(N),A=k;return A[0]=O*I,A[1]=O*z,A[2]=T,A[3]=-P*z+R*T*I,A[4]=P*I+R*T*z,A[5]=-R*O,A[6]=-R*z-P*T*I,A[7]=R*I-P*T*z,A[8]=P*O,m.multiply(M,A,t)};var j=new r;g.pointToWindowCoordinates=function(e,t,n,r){return r=g.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},g.pointToGLWindowCoordinates=function(e,n,a,o){i(o)||(o=new t);var u=j;return p.multiplyByVector(e,r.fromElements(a.x,a.y,a.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var V=new n,Y=new n,H=new n;return g.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=a(r,c.WGS84).geodeticSurfaceNormal(e,V),s=n.cross(t,u,Y);n.equalsEpsilon(s,n.ZERO,d.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,H);return n.cross(t,l,s),n.negate(s,s),i(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,m){"use strict";var p=new r,y=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(f.getColumn(r,0,p)),this._yAxis=n.fromCartesian4(f.getColumn(r,1,p));var i=n.fromCartesian4(f.getColumn(r,2,p));this._plane=h.fromPointNormal(e,i)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var g=new d,w=new n;y.prototype.projectPointOntoPlane=function(e,r){var a=g;a.origin=e,n.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,w);if(i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w)),i(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return i(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var n=0,r=e.length,a=0;r>a;a++){var o=this.projectPointOntoPlane(e[a],t[n]);i(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){i(r)||(r=new t);var a=g;a.origin=e,n.clone(this._plane.normal,a.direction);var o=c.rayPlane(a,this._plane,w);i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){i(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;i(t)?t.length=r:t=new Array(r);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var f=e[l];n.multiplyByScalar(u,f.x,c),i(t[l])||(t[l]=new n);var h=n.add(o,c,t[l]);n.multiplyByScalar(s,f.y,c),n.add(h,c,h),a.scaleToGeocentricSurface(h,h)}return t},y}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=new t,a=new t,i=new t,o=function(o,u,s,c,l){n(l)||(l=new t);var f,h,d,m,p,y,v,g;n(u.z)?(f=t.subtract(s,u,r),h=t.subtract(c,u,a),d=t.subtract(o,u,i),m=t.dot(f,f),p=t.dot(f,h),y=t.dot(f,d),v=t.dot(h,h),g=t.dot(h,d)):(f=e.subtract(s,u,r),h=e.subtract(c,u,a),d=e.subtract(o,u,i),m=e.dot(f,f),p=e.dot(f,h),y=e.dot(f,d),v=e.dot(h,h),g=e.dot(h,d));var w=1/(m*v-p*p);return l.y=(v*y-p*g)*w,l.z=(m*g-p*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var n=new t,r=function(t,r,a,i){return e(t,r,a,i,n),n.x>0&&n.y>0&&n.z>0};return r}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(e){var t=e._uSquared,n=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,a=(n-r)/n,i=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-a)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,i),f=s*o,h=f*f,d=1-h,m=Math.sqrt(d),p=t/4,y=p*p,v=y*p,g=y*y,w=1+p-3*y/4+5*v/4-175*g/64,x=1-p+15*y/8-35*v/8,E=1-3*p+35*y/4,S=1-5*p,_=w*l-x*Math.sin(2*l)*p/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,M=e._constants;M.a=n,M.b=r,M.f=a,M.cosineHeading=i,M.sineHeading=o,M.tanU=u,M.cosineU=s,M.sineU=c,M.sigma=l,M.sineAlpha=f,M.sineSquaredAlpha=h,M.cosineSquaredAlpha=d,M.cosineAlpha=m,M.u2Over4=p,M.u4Over16=y,M.u6Over64=v,M.u8Over256=g,M.a0=w,M.a1=x,M.a2=E,M.a3=S,M.distanceRatio=_}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,n,r,a,i,o){var u=c(e,n);return(1-u)*e*t*(r+u*a*(o+u*i*(2*o*o-1)))}function f(e,t,n,r,a,i,o){var s,c,f,h,d,m=(t-n)/t,p=i-r,y=Math.atan((1-m)*Math.tan(a)),v=Math.atan((1-m)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,_=g*E,M=w*E,O=w*x,P=p,T=u.TWO_PI,R=Math.cos(P),C=Math.sin(P);do{R=Math.cos(P),C=Math.sin(P);var N=_-O*R;f=Math.sqrt(x*x*C*C+N*N),c=M+S*R,s=Math.atan2(f,c);var I;0===f?(I=0,h=1):(I=S*C/f,h=1-I*I),T=P,d=c-2*M/h,isNaN(d)&&(d=0),P=p+l(m,I,h,s,f,c,d)}while(Math.abs(P-T)>u.EPSILON12);var z=h*(t*t-n*n)/(n*n),A=1+z*(4096+z*(z*(320-175*z)-768))/16384,b=z*(256+z*(z*(74-47*z)-128))/1024,D=d*d,q=b*f*(d+b*(c*(2*D-1)-b*d*(4*f*f-3)*(4*D-3)/6)/4),U=n*A*(s-q),L=Math.atan2(x*C,_-O*R),B=Math.atan2(g*C,_*R-O);e._distance=U,e._startHeading=L,e._endHeading=B,e._uSquared=z}function h(n,r,a,i){e.normalize(i.cartographicToCartesian(r,m),d),e.normalize(i.cartographicToCartesian(a,m),m),f(n,i.maximumRadius,i.minimumRadius,r.longitude,r.latitude,a.longitude,a.latitude),n._start=t.clone(r,n._start),n._end=t.clone(a,n._end),n._start.height=0,n._end.height=0,s(n)}var d=new e,m=new e,p=function(e,a,i){var u=n(i,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,r(e)&&r(a)&&h(this,e,a,u)};return a(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(e,t){h(this,e,t,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},p.prototype.interpolateUsingSurfaceDistance=function(e,n){var a=this._constants,i=a.distanceRatio+e/a.b,o=Math.cos(2*i),u=Math.cos(4*i),s=Math.cos(6*i),c=Math.sin(2*i),f=Math.sin(4*i),h=Math.sin(6*i),d=Math.sin(8*i),m=i*i,p=i*m,y=a.u8Over256,v=a.u2Over4,g=a.u6Over64,w=a.u4Over16,x=2*p*y*o/3+i*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*f-m*((g-11*y/2)*c+5*y*f/2)+(29*g/96-29*y/16)*h+539*y*d/1536,E=Math.asin(Math.sin(x)*a.cosineAlpha),S=Math.atan(a.a/a.b*Math.tan(E));x-=a.sigma;var _=Math.cos(2*a.sigma+x),M=Math.sin(x),O=Math.cos(x),P=a.cosineU*O,T=a.sineU*M,R=Math.atan2(M*a.sineHeading,P-T*a.cosineHeading),C=R-l(a.f,a.sineAlpha,a.cosineSquaredAlpha,x,M,O,_);return r(n)?(n.longitude=this._start.longitude+C,n.latitude=S,n.height=0,n):new t(this._start.longitude+C,S,0) -},p}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function h(e,t,n){var r=M;r.length=e;var a;if(t===n){for(a=0;e>a;a++)r[a]=t;return r}var i=n-t,o=i/e;for(a=0;e>a;a++){var u=t+a*o;r[a]=u}return r}function d(t,n,r,a,i,o,u,s){var c=a.scaleToGeodeticSurface(t,R),l=a.scaleToGeodeticSurface(n,C),f=m.numberOfPoints(t,n,r),d=a.cartesianToCartographic(c,O),p=a.cartesianToCartographic(l,P),y=h(f,i,o);N.setEndPoints(d,p);var v=N.surfaceDistance/f,g=s;d.height=i;var w=a.cartographicToCartesian(d,T);e.pack(w,u,g),g+=3;for(var x=1;f>x;x++){var E=N.interpolateUsingSurfaceDistance(x*v,P);E.height=y[x],w=a.cartographicToCartesian(E,T),e.pack(w,u,g),g+=3}return g}var m={};m.numberOfPoints=function(t,n,r){var a=e.distance(t,n);return Math.ceil(a/r)};var p=new t;m.extractHeights=function(e,t){for(var n=e.length,r=new Array(n),a=0;n>a;a++){var i=e[a];r[a]=t.cartesianToCartographic(i,p).height}return r};var y=new l,v=new e,g=new e,w=new f(e.ZERO,0),x=new e,E=new f(e.ZERO,0),S=new e,_=new e,M=[],O=new t,P=new t,T=new e,R=new e,C=new e,N=new o;m.wrapLongitude=function(t,a){var i=[],o=[];if(r(t)&&t.length>0){a=n(a,l.IDENTITY);var s=l.inverseTransformation(a,y),c=l.multiplyByPoint(s,e.ZERO,v),h=l.multiplyByPointAsVector(s,e.UNIT_Y,g),d=f.fromPointNormal(c,h,w),m=l.multiplyByPointAsVector(s,e.UNIT_X,x),p=f.fromPointNormal(c,m,E),M=1;i.push(e.clone(t[0]));for(var O=i[0],P=t.length,T=1;P>T;++T){var R=t[T];if(f.getPointDistance(p,O)<0||f.getPointDistance(p,R)<0){var C=u.lineSegmentPlane(O,R,d,S);if(r(C)){var N=e.multiplyByScalar(h,5e-9,_);f.getPointDistance(d,O)<0&&e.negate(N,N),i.push(e.add(C,N,new e)),o.push(M+1),e.negate(N,N),i.push(e.add(C,N,new e)),M=1}}i.push(e.clone(t[T])),M++,O=R}o.push(M)}return{positions:i,lengths:o}};var I=c.EPSILON7;return m.removeDuplicates=function(t){var n=t.length;if(2>n)return t;var r,a,i;for(r=1;n>r&&(a=t[r-1],i=t[r],!e.equalsEpsilon(a,i,I));++r);if(r===n)return t;for(var o=t.slice(0,r);n>r;++r)i=t[r],e.equalsEpsilon(a,i,I)||(o.push(e.clone(i)),a=i);return o},m.generateArc=function(t){r(t)||(t={});var a=t.positions,o=a.length,u=n(t.ellipsoid,i.WGS84),l=n(t.height,0);if(1>o)return[];if(1===o){var f=u.scaleToGeodeticSurface(a[0],R);if(0!==l){var h=u.geodeticSurfaceNormal(f,T);e.multiplyByScalar(h,l,h),e.add(f,h,f)}return[f.x,f.y,f.z]}var p=t.minDistance;if(!r(p)){var y=n(t.granularity,c.RADIANS_PER_DEGREE);p=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=m.numberOfPoints(a[v],a[v+1],p);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var _=a[v],P=a[v+1],C=S?l[v]:l,N=S?l[v+1]:l;E=d(_,P,p,u,C,N,x,E)}M.length=0;var I=a[o-1],z=u.cartesianToCartographic(I,O);z.height=S?l[o-1]:l;var A=u.cartographicToCartesian(z,T);return e.pack(A,x,w-3),x},m.generateCartesianArc=function(t){for(var n=m.generateArc(t),r=n.length/3,a=new Array(r),i=0;r>i;i++)a[i]=e.unpack(n,3*i);return a},m}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,n=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,n},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,m,p){"use strict";function y(t,n,r){var a=e.subtract(n,t,q),i=e.subtract(r,n,U);return a.x*i.y-a.y*i.x>=0}function v(e){for(var t=e[0].x,n=0,r=0;r<e.length;r++)e[r].x>t&&(t=e[r].x,n=r);return n}function g(e){for(var t=e[0][0].x,n=0,r=0;r<e.length;r++){var a=e[r][v(e[r])].x;a>t&&(t=a,n=r)}return n}function w(e){for(var t=[],n=0;n<e.length;n++){var r=e[(n-1+e.length)%e.length],a=e[n],i=e[(n+1)%e.length];y(r,a,i)||t.push(a)}return t}function x(t,n){for(var r=0;r<t.length;r++)if(e.equals(n,t[r]))return r;return-1}function E(n,a,i){i=r(i,[]);var o=Number.MAX_VALUE,u=v(a),s=new e(a[u].x,n.y);i.push(u),i.push((u+1)%a.length);for(var c=a[0].x,l=c,f=1;f<a.length;++f)a[f].x<c?c=a[f].x:a[f].x>l&&(l=a[f].x);l+=l-c;var h=new t(l,n.y,0);for(f=0;f<a.length;f++){var d=a[f],m=a[(f+1)%a.length];if((d.x>=n.x||m.x>=n.x)&&(d.y>=n.y&&m.y<=n.y||d.y<=n.y&&m.y>=n.y)){var p=(m.y-d.y)*(h.x-n.x)-(m.x-d.x)*(h.y-n.y);if(0!==p){p=1/p;var y=((m.x-d.x)*(n.y-d.y)-(m.y-d.y)*(n.x-d.x))*p,g=((h.x-n.x)*(n.y-d.y)-(h.y-n.y)*(n.x-d.x))*p;if(y>=0&&1>=y&&g>=0&&1>=g){var w=new e(n.x+y*(h.x-n.x),n.y+y*(h.y-n.y)),x=e.subtract(w,n,L);p=e.magnitudeSquared(x),o>p&&(s=w,o=p,i[0]=f,i[1]=(f+1)%a.length)}}}}return s}function S(t,n){var r=g(n),a=n[r],i=v(a),o=a[i],u=[],s=E(o,t,u),c=x(t,s);if(-1!==c)return c;var h=e.magnitudeSquared(e.subtract(t[u[0]],o,B)),d=e.magnitudeSquared(e.subtract(t[u[1]],o,B)),m=d>h?t[u[0]]:t[u[1]],p=w(t),y=p.indexOf(m);-1!==y&&p.splice(y,1);for(var S=[],_=0;_<p.length;_++){var M=p[_];f(M,o,s,m)&&S.push(M)}var O=Number.MAX_VALUE;if(S.length>0){var P=e.fromElements(1,0,B);for(_=0;_<S.length;_++){var T=e.subtract(S[_],o,W),R=e.magnitude(P)*e.magnitudeSquared(T);if(0!==R){var C=Math.abs(l.acosClamped(e.dot(P,T)/R));O>C&&(O=C,m=S[_])}}}return t.indexOf(m)}function _(e,n,r){for(var a=et.computeWindingOrder2D(e),i=0;i<n.length;i++){var o=n[i];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=et.computeWindingOrder2D(o);s===a&&o.reverse()}var c=u.fromPoints(e,r),l=c.projectPointsOntoPlane(e),f=[];for(i=0;i<n.length;i++)f.push(c.projectPointsOntoPlane(n[i]));var h=S(l,f),d=g(f),m=v(f[d]),p=n[d],y=[];for(i=0;i<e.length;i++)y.push(e[i]);var w,x=[];if(0!==m)for(w=0;w<=p.length;w++){var E=(w+m)%p.length;0!==E&&x.push(p[E])}else for(w=0;w<p.length;w++)x.push(p[(w+m)%p.length]);var _=y.lastIndexOf(e[h]);x.push(e[_]);var M=y.slice(0,_+1),O=y.slice(_+1);return y=M.concat(x,O),n.splice(d,1),y}function M(e){var t=l.nextRandomNumber(),n=Math.floor(t*e);return n===e&&n--,n}function O(e,t,n,r){var a=r[e].position,i=r[t].position,o=r[n].position,u=o.x,s=o.y,c=a.x-u,l=a.y-s,f=i.x-u,h=i.y-s;return c*h-l*f}function P(e,t){return e.x*t.y-e.y*t.x}function T(e,t){var n=t.length,r=l.mod(e-1,n),a=l.mod(e+1,n);return 0===O(r,a,e,t)?!1:!0}function R(t,n){return e.magnitudeSquared(n)<e.magnitudeSquared(t)}function C(t,n,r){if(!T(t,r))return t;var a=r[t].position,i=r[n].position,o=r.length,u=l.mod(t-1,o);if(!T(u,r))return u;var s=l.mod(t+1,o);if(!T(s,r))return s;var c=e.subtract(r[u].position,a,k),f=e.subtract(r[s].position,a,j),h=e.subtract(i,a,V),d=P(c,h),m=P(f,h);if(0===d)return R(c,h)?F:G;if(0===m)return R(f,h)?F:G;var p=P(c,f);return 0>p?0>d&&m>0?F:G:p>0?d>0&&0>m?G:F:void 0}function N(e,t,n){return(e>t||e>n)&&(t>e||n>e)||t===n&&t===e}function I(t,n,r,a){var i=e.subtract(r,t,H),o=n.x*a.y-n.y*a.x,u=o*o,s=e.magnitudeSquared(n),c=e.magnitudeSquared(a);if(u>Y*s*c){var l=(i.x*a.y-i.y*a.x)/o;return e.add(t,e.multiplyByScalar(n,l,H),H)}return void 0}function z(t,n,r){for(var i=e.subtract(n,t,Z),o=r.length,u=0;o>u;u++){var s=r[u].position,c=r[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(n,c)||e.equals(t,c)||e.equals(n,s))){var f=e.subtract(c,s,X),h=I(t,i,s,f);if(a(h)&&!(e.equals(h,t)||e.equals(h,n)||e.equals(h,s)||e.equals(h,c))){var d=h.x,m=h.y,p=N(d,t.x,n.x)&&N(m,t.y,n.y)&&N(d,s.x,c.x)&&N(m,s.y,c.y);if(p)return!0}}}return!1}function A(t,n,r){var a=C(t,n,r);if(a>=0)return a;var i=C(n,t,r);return i>=0?i:a!==F||i!==F||z(r[t].position,r[n].position,r)||e.equals(r[t].position,r[n].position)?K:J}function b(e){return 0===O(1,2,0,e)}function D(e){var t=e.length;if(3===t)return b(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new i("Invalid polygon: must have at least three vertices.");for(var n,r,a=0,o=10*e.length,u=K;J>u&&a++<o;){for(n=M(e.length),r=n+1;Math.abs(n-r)<2||Math.abs(n-r)>e.length-2;)r=M(e.length);if(n>r){var s=n;n=r,r=s}u=A(n,r,e)}if(u===J){var c=e.splice(n,r-n+1,e[n],e[r]);return D(e).concat(D(c))}return u>=0?(e.splice(u,1),D(e)):[]}var q=new e,U=new e,L=new e,B=new e(1,0),W=new e,F=-1,G=-2,k=new t,j=new t,V=new t,Y=l.EPSILON14,H=new e;new e;var Z=new e,X=new e,J=-1,K=-2,Q=new t,$=new t,et={};et.removeDuplicates=function(e){var n=h.removeDuplicates(e);return t.equals(n[0],n[n.length-1])?n.slice(1):n},et.computeArea2D=function(e){for(var t=e.length,n=0,r=t-1,a=0;t>a;r=a++){var i=e[r],o=e[a];n+=i.x*o.y-o.x*i.y}return.5*n},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?p.COUNTER_CLOCKWISE:p.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,n=[],r=0;t>r;++r)n[r]={position:e[r],index:r};return D(n)};var tt=new t,nt=new t,rt=new t,at=new t,it=new t,ot=new t,ut=new t;return et.computeSubdivision=function(e,i,o,u){u=r(u,l.RADIANS_PER_DEGREE);var f,h=o.slice(0),m=i.length,p=new Array(3*m),y=0;for(f=0;m>f;f++){var v=i[f];p[y++]=v.x,p[y++]=v.y,p[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;h.length>0;){var _,M,O=h.pop(),P=h.pop(),T=h.pop(),R=t.fromArray(p,3*T,tt),C=t.fromArray(p,3*P,nt),N=t.fromArray(p,3*O,rt),I=t.multiplyByScalar(t.normalize(R,at),x,at),z=t.multiplyByScalar(t.normalize(C,it),x,it),A=t.multiplyByScalar(t.normalize(N,ot),x,ot),b=t.magnitudeSquared(t.subtract(I,z,ut)),D=t.magnitudeSquared(t.subtract(z,A,ut)),q=t.magnitudeSquared(t.subtract(A,I,ut)),U=Math.max(b,D,q);U>S?b===U?(_=Math.min(T,P)+" "+Math.max(T,P),f=w[_],a(f)||(M=t.add(R,C,ut),t.multiplyByScalar(M,.5,M),p.push(M.x,M.y,M.z),f=p.length/3-1,w[_]=f),h.push(T,f,O),h.push(f,P,O)):D===U?(_=Math.min(P,O)+" "+Math.max(P,O),f=w[_],a(f)||(M=t.add(C,N,ut),t.multiplyByScalar(M,.5,M),p.push(M.x,M.y,M.z),f=p.length/3-1,w[_]=f),h.push(P,f,T),h.push(f,O,T)):q===U&&(_=Math.min(O,T)+" "+Math.max(O,T),f=w[_],a(f)||(M=t.add(N,R,ut),t.multiplyByScalar(M,.5,M),p.push(M.x,M.y,M.z),f=p.length/3-1,w[_]=f),h.push(O,f,P),h.push(f,T,P)):(g.push(T),g.push(P),g.push(O))}return new s({attributes:{position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:p})},indices:g,primitiveType:d.TRIANGLES})},et.scaleToGeodeticHeight=function(e,n,i,u){i=r(i,o.WGS84);var s=Q,c=$;if(n=r(n,0),u=r(u,!0),a(e)&&a(e.attributes)&&a(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,h=0;f>h;h+=3)t.fromArray(l,h,c),u&&(c=i.scaleToGeodeticSurface(c,c)),s=i.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,n,s),t.add(c,s,c),l[h]=c.x,l[h+1]=c.y,l[h+2]=c.z;return e},et.eliminateHoles=function(e,n,a){a=r(a,o.WGS84);for(var i=[],u=0;u<n.length;u++){for(var s=[],c=0;c<n[u].length;c++)s.push(t.clone(n[u][c]));i.push(s)}for(var l=e;i.length>0;)l=_(l,i,a);return l},et}),define("Core/PolylineVolumeGeometryLibrary",["./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./CornerType","./EllipsoidTangentPlane","./Math","./Matrix3","./Matrix4","./PolylinePipeline","./Quaternion","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function h(e,t){for(var n=new Array(e.length),r=0;r<e.length;r++){var a=e[r];b=t.cartesianToCartographic(a,b),n[r]=b.height,e[r]=t.scaleToGeodeticSurface(a,a)}return n}function d(e,n,r,a){var i,o=e[0],u=e[1],s=t.angleBetween(o,u),c=Math.ceil(s/a),l=new Array(c);if(n===r){for(i=0;c>i;i++)l[i]=n;return l.push(r),l}var f=r-n,h=f/c;for(i=1;c>i;i++){var d=n+i*h;l[i]=d}return l[0]=n,l.push(r),l}function m(n,r,a,o){var u=new i(a,o),s=u.projectPointOntoPlane(t.add(a,n,H),H),c=u.projectPointOntoPlane(t.add(a,r,Z),Z),l=e.angleBetween(s,c);return c.x*s.y-c.y*s.x>=0?-l:l}function p(e,n,r,a,i,o,c,l){var h=W,d=F;q=f.eastNorthUpToFixedFrame(e,i,q),h=s.multiplyByPointAsVector(q,D,h),h=t.normalize(h,h);var p=m(h,n,e,i);L=u.fromRotationZ(p,L),G.z=o,q=s.multiplyTransformation(q,s.fromRotationTranslation(L,G,U),q);var y=B;y[0]=c;for(var v=0;l>v;v++)for(var g=0;g<r.length;g+=3)d=t.fromArray(r,g,d),d=u.multiplyByVector(y,d,d),d=s.multiplyByPoint(q,d,d),a.push(d.x,d.y,d.z);return a}function y(e,n,r,a,i,o,u){for(var s=0;s<e.length;s+=3){var c=t.fromArray(e,s,k);a=p(c,n,r,a,i,o[s/3],u,1)}return a}function v(e,t){var n=e.length,r=new Array(6*n),a=0,i=t.x+t.width/2,o=t.y+t.height/2,u=e[0];r[a++]=u.x-i,r[a++]=0,r[a++]=u.y-o;for(var s=1;n>s;s++){u=e[s];var c=u.x-i,l=u.y-o;r[a++]=c,r[a++]=0,r[a++]=l,r[a++]=c,r[a++]=0,r[a++]=l}return u=e[0],r[a++]=u.x-i,r[a++]=0,r[a++]=u.y-o,r}function g(e,t){for(var n=e.length,r=new Array(3*n),a=0,i=t.x+t.width/2,o=t.y+t.height/2,u=0;n>u;u++)r[a++]=e[u].x-i,r[a++]=0,r[a++]=e[u].y-o;return r}function w(e,n,r,i,s,c,f,h,d,m){var y,v=t.angleBetween(t.subtract(n,e,I),t.subtract(r,e,z)),g=i===a.BEVELED?0:Math.ceil(v/o.toRadians(5));y=s?u.fromQuaternion(l.fromAxisAngle(t.negate(e,I),v/(g+1),j),Y):u.fromQuaternion(l.fromAxisAngle(e,v/(g+1),j),Y);var w,x;if(n=t.clone(n,V),g>0)for(var E=m?2:1,S=0;g>S;S++)n=u.multiplyByVector(y,n,n),w=t.subtract(n,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(n,z),f=p(x,w,h,f,c,d,1,E);else w=t.subtract(n,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(n,z),f=p(x,w,h,f,c,d,1,1),r=t.clone(r,V),w=t.subtract(r,e,I),w=t.normalize(w,w),s||(w=t.negate(w,w)),x=c.scaleToGeodeticSurface(r,z),f=p(x,w,h,f,c,d,1,1);return f}function x(e,t){return o.equalsEpsilon(e.latitude,t.latitude,o.EPSILON6)&&o.equalsEpsilon(e.longitude,t.longitude,o.EPSILON6)}var E=[new t,new t],S=new t,_=new t,M=new t,O=new t,P=new t,T=new t,R=new t,C=new t,N=new t,I=new t,z=new t,A={},b=new r,D=new t(-1,0,0),q=new s,U=new s,L=new u,B=u.IDENTITY.clone(),W=new t,F=new n,G=new t,k=new t,j=new l,V=new t,Y=new u;A.removeDuplicatesFromShape=function(t){for(var n=t.length,r=[],a=n-1,i=0;n>i;a=i++){var o=t[a],u=t[i];e.equals(o,u)||r.push(u)}return r};var H=new t,Z=new t;A.angleIsGreaterThanPi=function(e,n,r,a){var o=new i(r,a),u=o.projectPointOntoPlane(t.add(r,e,H),H),s=o.projectPointOntoPlane(t.add(r,n,Z),Z);return s.x*u.y-s.y*u.x>=0};var X=new r,J=new r;A.removeDuplicatesFromPositions=function(e,t){var n=e.length;if(2>n)return e.slice(0);var r=[];r.push(e[0]);for(var a=1;n>a;++a){var i=e[a-1],o=e[a],u=t.cartesianToCartographic(i,X),s=t.cartesianToCartographic(o,J);x(u,s)||r.push(o)}return r};var K=new t,Q=new t;return A.computePositions=function(e,n,r,i,u){var s=i._ellipsoid,l=h(e,s),f=i._granularity,m=i._cornerType,x=u?v(n,r):g(n,r),z=u?g(n,r):void 0,b=r.height/2,D=r.width/2,q=e.length,U=[],L=u?[]:void 0,B=S,W=_,F=M,G=O,k=P,j=T,V=R,Y=C,H=N,Z=e[0],X=e[1];G=s.geodeticSurfaceNormal(Z,G),B=t.subtract(X,Z,B),B=t.normalize(B,B),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y);var J=l[0],$=l[1];u&&(L=p(Z,Y,z,L,s,J+b,1,1)),H=t.clone(Z,H),Z=X,W=t.negate(B,W);for(var et,tt,nt=1;q-1>nt;nt++){var rt=u?2:1;X=e[nt+1],B=t.subtract(X,Z,B),B=t.normalize(B,B),F=t.add(B,W,F),F=t.normalize(F,F),G=s.geodeticSurfaceNormal(Z,G);var at=t.multiplyByScalar(G,t.dot(B,G),K);t.subtract(B,at,at),t.normalize(at,at);var it=t.multiplyByScalar(G,t.dot(W,G),Q);t.subtract(W,it,it),t.normalize(it,it);var ot=!o.equalsEpsilon(Math.abs(t.dot(at,it)),1,o.EPSILON7);if(ot){F=t.cross(F,G,F),F=t.cross(G,F,F),F=t.normalize(F,F);var ut=1/Math.max(.25,t.magnitude(t.cross(F,W,I))),st=A.angleIsGreaterThanPi(B,W,Z,s);st?(k=t.add(Z,t.multiplyByScalar(F,ut*D,F),k),j=t.add(k,t.multiplyByScalar(Y,D,j),j),E[0]=t.clone(H,E[0]),E[1]=t.clone(j,E[1]),et=d(E,J+b,$+b,f),tt=c.generateArc({positions:E,granularity:f,ellipsoid:s}),U=y(tt,Y,x,U,s,et,1),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y),V=t.add(k,t.multiplyByScalar(Y,D,V),V),m===a.ROUNDED||m===a.BEVELED?w(k,j,V,m,st,s,U,x,$+b,u):(F=t.negate(F,F),U=p(Z,F,x,U,s,$+b,ut,rt)),H=t.clone(V,H)):(k=t.add(Z,t.multiplyByScalar(F,ut*D,F),k),j=t.add(k,t.multiplyByScalar(Y,-D,j),j),E[0]=t.clone(H,E[0]),E[1]=t.clone(j,E[1]),et=d(E,J+b,$+b,f),tt=c.generateArc({positions:E,granularity:f,ellipsoid:s}),U=y(tt,Y,x,U,s,et,1),Y=t.cross(G,B,Y),Y=t.normalize(Y,Y),V=t.add(k,t.multiplyByScalar(Y,-D,V),V),m===a.ROUNDED||m===a.BEVELED?w(k,j,V,m,st,s,U,x,$+b,u):U=p(Z,F,x,U,s,$+b,ut,rt),H=t.clone(V,H)),W=t.negate(B,W)}else U=p(H,Y,x,U,s,J+b,1,1),H=Z;J=$,$=l[nt+1],Z=X}E[0]=t.clone(H,E[0]),E[1]=t.clone(Z,E[1]),et=d(E,J+b,$+b,f),tt=c.generateArc({positions:E,granularity:f,ellipsoid:s}),U=y(tt,Y,x,U,s,et,1),u&&(L=p(Z,Y,z,L,s,$+b,1,1)),q=U.length;var ct=u?q+L.length:q,lt=new Float64Array(ct);return lt.set(U),u&<.set(L,q),lt},A}),define("Core/PolylineVolumeOutlineGeometry",["./BoundingRectangle","./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./CornerType","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolygonPipeline","./PolylineVolumeGeometryLibrary","./PrimitiveType","./WindingOrder"],function(e,t,n,r,a,i,o,u,s,c,l,f,h,d,m,p,y,v,g){"use strict";function w(e,n){var r=new h;r.position=new f({componentDatatype:a.DOUBLE,componentsPerAttribute:3,values:e});var i,o,u=n.length,s=r.position.values.length/3,c=e.length/3,m=c/u,p=d.createTypedArray(s,2*u*(m+1)),y=0;i=0;var g=i*u;for(o=0;u-1>o;o++)p[y++]=o+g,p[y++]=o+g+1;for(p[y++]=u-1+g,p[y++]=g,i=m-1,g=i*u,o=0;u-1>o;o++)p[y++]=o+g,p[y++]=o+g+1;for(p[y++]=u-1+g,p[y++]=g,i=0;m-1>i;i++){var w=u*i,x=w+u;for(o=0;u>o;o++)p[y++]=o+w,p[y++]=o+x}var E=new l({attributes:r,indices:d.createTypedArray(s,p),boundingSphere:t.fromVertices(e),primitiveType:v.LINES});return E}var x=function(e){e=o(e,o.EMPTY_OBJECT);var t=e.polylinePositions,a=e.shapePositions;this._positions=t,this._shape=a,this._ellipsoid=c.clone(o(e.ellipsoid,c.WGS84)),this._cornerType=o(e.cornerType,i.ROUNDED),this._granularity=o(e.granularity,m.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";var u=1+t.length*r.packedLength;u+=1+a.length*n.packedLength,this.packedLength=u+c.packedLength+2};x.pack=function(e,t,a){a=o(a,0);var i,u=e._positions,s=u.length;for(t[a++]=s,i=0;s>i;++i,a+=r.packedLength)r.pack(u[i],t,a);var l=e._shape;for(s=l.length,t[a++]=s,i=0;s>i;++i,a+=n.packedLength)n.pack(l[i],t,a);c.pack(e._ellipsoid,t,a),a+=c.packedLength,t[a++]=e._cornerType,t[a]=e._granularity};var E=c.clone(c.UNIT_SPHERE),S={polylinePositions:void 0,shapePositions:void 0,ellipsoid:E,height:void 0,cornerType:void 0,granularity:void 0};x.unpack=function(e,t,a){t=o(t,0);var i,s=e[t++],l=new Array(s);for(i=0;s>i;++i,t+=r.packedLength)l[i]=r.unpack(e,t);s=e[t++];var f=new Array(s);for(i=0;s>i;++i,t+=n.packedLength)f[i]=n.unpack(e,t);var h=c.unpack(e,t,E);t+=c.packedLength;var d=e[t++],m=e[t];return u(a)?(a._positions=l,a._shape=f,a._ellipsoid=c.clone(h,a._ellipsoid),a._cornerType=d,a._granularity=m,a):(S.polylinePositions=l,S.shapePositions=f,S.cornerType=d,S.granularity=m,new x(S))};var _=new e;return x.createGeometry=function(t){var n=t._positions,r=y.removeDuplicatesFromPositions(n,t._ellipsoid),a=t._shape;if(a=y.removeDuplicatesFromShape(a),r.length<2||a.length<3)return void 0;p.computeWindingOrder2D(a)===g.CLOCKWISE&&a.reverse();var i=e.fromPoints(a,_),o=y.computePositions(r,a,i,t,!1);return w(o,a)},x}),define("Workers/createPolylineVolumeOutlineGeometry",["../Core/defined","../Core/Ellipsoid","../Core/PolylineVolumeOutlineGeometry"],function(e,t,n){"use strict";function r(r,a){return e(a)&&(r=n.unpack(r,a)),r._ellipsoid=t.clone(r._ellipsoid),n.createGeometry(r)}return r})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createRectangleGeometry.js b/libs/Cesium/Workers/createRectangleGeometry.js deleted file mode 100644 index 998d3a75..00000000 --- a/libs/Cesium/Workers/createRectangleGeometry.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(e){return e>0?1:0>e?-1:0},r.signNotZero=function(e){return 0>e?-1:1},r.toSNorm=function(e){return Math.round(255*(.5*r.clamp(e,-1,1)+.5))},r.fromSNorm=function(e){return 2*(r.clamp(e,0,255)/255)-1},r.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},r.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},r.lerp=function(e,t,r){return(1-r)*e+r*t},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(e){return e*r.RADIANS_PER_DEGREE},r.toDegrees=function(e){return e*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(e){var t=r.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},r.negativePiToPi=function(e){return r.zeroToTwoPi(e+r.PI)-r.PI},r.zeroToTwoPi=function(e){var t=r.mod(e,r.TWO_PI);return Math.abs(t)<r.EPSILON14&&Math.abs(e)>r.EPSILON14?r.TWO_PI:t},r.mod=function(e,t){return(e%t+t)%t},r.equalsEpsilon=function(e,r,n,a){a=t(a,n);var i=Math.abs(e-r);return a>=i||i<=n*Math.max(Math.abs(e),Math.abs(r))};var n=[1];r.factorial=function(e){var t=n.length;if(e>=t)for(var r=n[t-1],a=t;e>=a;a++)n.push(r*a);return n[e]},r.incrementWrap=function(e,r,n){return n=t(n,0),++e,e>r&&(e=n),e},r.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},r.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},r.clamp=function(e,t,r){return t>e?t:e>r?r:e};var a=new e;return r.setRandomNumberSeed=function(t){a=new e(t)},r.nextRandomNumber=function(){return a.random()},r.acosClamped=function(e){return Math.acos(r.clamp(e,-1,1))},r.asinClamped=function(e){return Math.asin(r.clamp(e,-1,1))},r.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},r}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0)};i.fromSpherical=function(r,n){t(n)||(n=new i);var a=r.clock,o=r.cone,u=e(r.magnitude,1),s=u*Math.sin(o);return n.x=s*Math.cos(a),n.y=s*Math.sin(a),n.z=u*Math.cos(o),n},i.fromElements=function(e,r,n,a){return t(a)?(a.x=e,a.y=r,a.z=n,a):new i(e,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n]=t.z},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n++],a.z=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var r=i.dot(s,c),n=i.magnitude(i.cross(s,c,s));return Math.atan2(n,r)};var l=new i;i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):r.y<=r.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)&&a.equalsEpsilon(e.z,r.z,n,i)},i.cross=function(e,t,r){var n=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-n*s,f=n*u-a*o;return r.x=c,r.y=l,r.z=f,r},i.fromDegrees=function(e,t,r,n,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,r,n,o)};var f=new i,d=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(r,n,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(n);f.x=c*Math.cos(r),f.y=c*Math.sin(r),f.z=Math.sin(n),f=i.normalize(f,f),i.multiplyComponents(s,f,d);var l=Math.sqrt(i.dot(f,d));return d=i.divideByScalar(d,l,d),f=i.multiplyByScalar(f,a,f),t(u)||(u=new i),i.add(d,f,u)},i.fromDegreesArray=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o++)n[o]=a.toRadians(e[o]);return i.fromRadiansArray(n,t,r)},i.fromRadiansArray=function(e,r,n){var a=e.length;t(n)?n.length=a/2:n=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];n[o/2]=i.fromRadians(u,s,0,r,n[o/2])}return n},i.fromDegreesArrayHeights=function(e,t,r){for(var n=new Array(e.length),o=0;o<e.length;o+=3)n[o]=a.toRadians(e[o]),n[o+1]=a.toRadians(e[o+1]),n[o+2]=e[o+2];return i.fromRadiansArrayHeights(n,t,r)},i.fromRadiansArrayHeights=function(e,r,n){var a=e.length;t(n)?n.length=a/3:n=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];n[o/3]=i.fromRadians(u,s,c,r,n[o/3])}return n},i.ZERO=n(new i(0,0,0)),i.UNIT_X=n(new i(1,0,0)),i.UNIT_Y=n(new i(0,1,0)),i.UNIT_Z=n(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n){this.longitude=e(t,0),this.latitude=e(r,0),this.height=e(n,0)};return i.fromRadians=function(r,n,a,o){return a=e(a,0),t(o)?(o.longitude=r,o.latitude=n,o.height=a,o):new i(r,n,a)},i.fromDegrees=function(e,t,r,n){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,r,n)},i.clone=function(e,r){return t(e)?t(r)?(r.longitude=e.longitude,r.latitude=e.latitude,r.height=e.height,r):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.longitude===r.longitude&&e.latitude===r.latitude&&e.height===r.height},i.equalsEpsilon=function(e,r,n){return e===r||t(e)&&t(r)&&Math.abs(e.longitude-r.longitude)<=n&&Math.abs(e.latitude-r.latitude)<=n&&Math.abs(e.height-r.height)<=n},i.ZERO=n(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";function s(t,n,a,i){n=r(n,0),a=r(a,0),i=r(i,0),t._radii=new e(n,a,i),t._radiiSquared=new e(n*n,a*a,i*i),t._radiiToTheFourth=new e(n*n*n*n,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===n?0:1/n,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(n,a,i),t._maximumRadius=Math.max(n,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,r)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,r){if(!n(t))return void 0;var a=t._radii;return n(r)?(e.clone(a,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return n(t)||(t=new c),n(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,n,a){a=r(a,0),e.pack(t._radii,n,a)},c.unpack=function(t,n,a){n=r(n,0);var i=e.unpack(t,n);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,r){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return n(r)||(r=new e),r.x=u,r.y=s,r.z=c,e.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(t,r){return n(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,r){var a=l,i=f;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),n(r)||(r=new e),e.add(i,a,r)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var a=0;r>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var d=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(r,a){var i=this.scaleToGeodeticSurface(r,h);if(!n(i))return void 0;var o=this.geodeticSurfaceNormal(i,d),s=e.subtract(r,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,r))*e.magnitude(s);return n(a)?(a.longitude=c,a.latitude=l,a.height=f,a):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var r=e.length;n(t)?t.length=r:t=new Array(r);for(var a=0;r>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,r){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,d=a*a*c*c,h=i*i*l*l,m=o*o*f*f,v=d+h+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,r):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,O=x.z,M=y;M.x=2*w.x*E,M.y=2*w.y*S,M.z=2*w.z*O;var _,T,b,P,A,N,I,R,C,z,D,L=(1-g)*e.magnitude(t)/(.5*e.magnitude(M)),q=0;do{L-=q,b=1/(1+L*E),P=1/(1+L*S),A=1/(1+L*O),N=b*b,I=P*P,R=A*A,C=N*b,z=I*P,D=R*A,_=d*N+h*I+m*R-1,T=d*C*E+h*z*S+m*D*O;var U=-2*T;q=_/U}while(Math.abs(_)>u.EPSILON12);return n(r)?(r.x=a*b,r.y=i*P,r.z=o*A,r):new e(a*b,i*P,o*A)},c.prototype.scaleToGeocentricSurface=function(t,r){n(r)||(r=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,r)},c.prototype.transformPositionToScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(t,r){return n(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},c.prototype.equals=function(t){return this===t||n(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";var s=function(e,r,n,a){this.west=t(e,0),this.south=t(r,0),this.east=t(n,0),this.north=t(a,0)};n(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.west,r[n++]=e.south,r[n++]=e.east,r[n]=e.north},s.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new s),a.west=e[n++],a.south=e[n++],a.east=e[n++],a.north=e[n],a},s.computeWidth=function(e){var t=e.east,r=e.west;return r>t&&(t+=u.TWO_PI),t-r},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,n,a,i,o){return e=u.toRadians(t(e,0)),n=u.toRadians(t(n,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),r(o)?(o.west=e,o.south=n,o.east=a,o.north=i,o):new s(e,n,a,i)},s.fromCartographicArray=function(e,t){for(var n=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];n=Math.min(n,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return r(t)?(t.west=n,t.south=i,t.east=a,t.north=o,t):new s(n,i,a,o)},s.clone=function(e,t){return r(e)?r(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return r(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.south,n.height=0,n):new e(t.west,t.south)},s.northwest=function(t,n){return r(n)?(n.longitude=t.west,n.latitude=t.north,n.height=0,n):new e(t.west,t.north)},s.northeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.north,n.height=0,n):new e(t.east,t.north)},s.southeast=function(t,n){return r(n)?(n.longitude=t.east,n.latitude=t.south,n.height=0,n):new e(t.east,t.south)},s.center=function(t,n){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return r(n)?(n.longitude=o,n.latitude=s,n.height=0,n):new e(o,s)},s.intersection=function(e,t,n){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var d=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return d>=h?void 0:r(n)?(n.west=l,n.south=d,n.east=f,n.north=h,n):new s(l,d,f,h)},s.contains=function(e,t){var r=t.longitude,n=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>r&&(r+=u.TWO_PI)),(r>a||u.equalsEpsilon(r,a,u.EPSILON14))&&(i>r||u.equalsEpsilon(r,i,u.EPSILON14))&&n>=e.south&&n<=e.north};var c=new e;return s.subsample=function(e,n,a,o){n=t(n,i.WGS84),a=t(a,0),r(o)||(o=[]);var l=0,f=e.north,d=e.south,h=e.east,m=e.west,p=c;p.height=a,p.longitude=m,p.latitude=f,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.latitude=d,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.latitude=0>f?f:d>0?d:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=n.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=n.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=n.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},r=function(r,n){e(t[r])||(t[r]=!0,console.log(n))};return r}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,a,i,o){"use strict";var u=function(e){this._ellipsoid=r(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,r){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return n(r)?(r.x=i,r.y=o,r.z=u,r):new e(i,o,u)},u.prototype.unproject=function(e,r){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return n(r)?(r.longitude=i,r.latitude=o,r.height=u,r):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,r){this.start=e(t,0),this.stop=e(r,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r,n,a){this.x=e(t,0),this.y=e(r,0),this.z=e(n,0),this.w=e(a,0)};i.fromElements=function(e,r,n,a,o){return t(o)?(o.x=e,o.y=r,o.z=n,o.w=a,o):new i(e,r,n,a)},i.fromColor=function(e,r){return t(r)?(r.x=e.red,r.y=e.green,r.z=e.blue,r.w=e.alpha,r):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n++]=t.y,r[n++]=t.z,r[n]=t.w},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n++],a.z=r[n++],a.w=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r.z=Math.min(e.z,t.z),r.w=Math.min(e.w,t.w),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r.z=Math.max(e.z,t.z),r.w=Math.max(e.w,t.w),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t.z=e.z/r,t.w=e.w/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,s);return i.abs(r,r),t=r.x<=r.y?r.x<=r.z?r.x<=r.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):r.y<=r.z?r.y<=r.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):r.z<=r.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y&&e.z===r.z&&e.w===r.w},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)&&a.equalsEpsilon(e.z,r.z,n,i)&&a.equalsEpsilon(e.w,r.w,n,i)},i.ZERO=n(new i(0,0,0,0)),i.UNIT_X=n(new i(1,0,0,0)),i.UNIT_Y=n(new i(0,1,0,0)),i.UNIT_Z=n(new i(0,0,1,0)),i.UNIT_W=n(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i){"use strict";function o(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function u(e){for(var t=0,r=0;3>r;++r){var n=e[c.getElementIndex(h[r],d[r])];t+=2*n*n}return Math.sqrt(t)}function s(e,t){for(var r=i.EPSILON15,n=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],d[o])]);u>n&&(a=o,n=u)}var s=1,l=0,f=d[a],m=h[a];if(Math.abs(e[c.getElementIndex(m,f)])>r){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,r,n,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(r,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(n,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3],r[n++]=e[4],r[n++]=e[5],r[n++]=e[6],r[n++]=e[7],r[n++]=e[8]},c.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new c),a[0]=e[n++],a[1]=e[n++],a[2]=e[n++],a[3]=e[n++],a[4]=e[n++],a[5]=e[n++],a[6]=e[n++],a[7]=e[n++],a[8]=e[n++],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,n,a){return n=t(n,0),r(a)||(a=new c),a[0]=e[n],a[1]=e[n+1],a[2]=e[n+2],a[3]=e[n+3],a[4]=e[n+4],a[5]=e[n+5],a[6]=e[n+6],a[7]=e[n+7],a[8]=e[n+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var n=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,d=e.z*e.w,h=e.w*e.w,m=n-u-f+h,p=2*(a-d),y=2*(i+l),v=2*(a+d),g=-n+u-f+h,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-n-u+f+h;return r(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(m,p,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return r(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=a,t[6]=0,t[7]=-a,t[8]=n,t):new c(1,0,0,0,n,-a,0,a,n)},c.fromRotationY=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=n,t):new c(n,0,a,0,1,0,-a,0,n)},c.fromRotationZ=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=a,t[2]=0,t[3]=-a,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(n,-a,0,a,n,0,0,0,1)},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,r){var n=3*t,a=e[n],i=e[n+1],o=e[n+2];return r.x=a,r.y=i,r.z=o,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var a=3*t;return n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z,n},c.getRow=function(e,t,r){var n=e[t],a=e[t+3],i=e[t+6];return r.x=n,r.y=a,r.z=i,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+3]=r.y,n[t+6]=r.z,n};var l=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),r.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),r.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),r};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,r){var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},c.multiplyByVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[3]*a+e[6]*i,u=e[1]*n+e[4]*a+e[7]*i,s=e[2]*n+e[5]*a+e[8]*i;return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},c.multiplyByScale=function(e,t,r){return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.x,r[3]=e[3]*t.y,r[4]=e[4]*t.y,r[5]=e[5]*t.y,r[6]=e[6]*t.z,r[7]=e[7]*t.z,r[8]=e[8]*t.z,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var r=e[0],n=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=r,t[1]=n,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],h=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var n=i.EPSILON20,a=10,l=0,f=0;r(t)||(t={});for(var d=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=n*o(h);a>f&&u(h)>y;)s(h,m),c.transpose(m,p),c.multiply(h,m,h),c.multiply(p,h,h),c.multiply(d,m,d),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],r=e[3],n=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*n-r*c)+u*(r*o-i*n)},c.inverse=function(e,t){var r=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],d=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=i.EPSILON15)throw new n("matrix is not invertible");t[0]=s*h-d*l,t[1]=d*o-a*h,t[2]=a*l-s*o,t[3]=f*l-u*h,t[4]=r*h-f*o,t[5]=u*o-r*l,t[6]=u*d-f*s,t[7]=f*a-r*d,t[8]=r*s-u*a;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,a,i,o,u,s){"use strict"; -var c=function(e,t,n,a,i,o,u,s,c,l,f,d,h,m,p,y){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(c,0),this[3]=r(h,0),this[4]=r(t,0),this[5]=r(o,0),this[6]=r(l,0),this[7]=r(m,0),this[8]=r(n,0),this[9]=r(u,0),this[10]=r(f,0),this[11]=r(p,0),this[12]=r(a,0),this[13]=r(s,0),this[14]=r(d,0),this[15]=r(y,0)};c.packedLength=16,c.pack=function(e,t,n){n=r(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15]},c.unpack=function(e,t,a){return t=r(t,0),n(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=r(a,e.ZERO),n(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,r,a){n(a)||(a=new c);var i=r.x,o=r.y,u=r.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,d=t.x*t.w,h=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-y+g,x=2*(l-v),E=2*(f+p),S=2*(l+v),O=-s+h-y+g,M=2*(m-d),_=2*(f-p),T=2*(m+d),b=-s-h+y+g;return a[0]=w*i,a[1]=S*i,a[2]=_*i,a[3]=0,a[4]=x*o,a[5]=O*o,a[6]=T*o,a[7]=0,a[8]=E*u,a[9]=M*u,a[10]=b*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,d=new e;c.fromCamera=function(t,r){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,d),d);var u=f.x,s=f.y,h=f.z,m=l.x,p=l.y,y=l.z,v=d.x,g=d.y,w=d.z,x=a.x,E=a.y,S=a.z,O=u*-x+s*-E+h*-S,M=v*-x+g*-E+w*-S,_=m*x+p*E+y*S;return n(r)?(r[0]=u,r[1]=v,r[2]=-m,r[3]=0,r[4]=s,r[5]=g,r[6]=-p,r[7]=0,r[8]=h,r[9]=w,r[10]=-y,r[11]=0,r[12]=O,r[13]=M,r[14]=_,r[15]=1,r):new c(u,s,h,O,v,g,w,M,-m,-p,-y,_,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,r,n,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(n+r)/(r-n),c=2*n*r/(r-n);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,r,n,a,i,o){var u=1/(t-e),s=1/(n-r),c=1/(i-a),l=-(t+e)*u,f=-(n+r)*s,d=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=d,o[15]=1,o},c.computePerspectiveOffCenter=function(e,t,r,n,a,i,o){var u=2*a/(t-e),s=2*a/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),f=-(i+a)/(i-a),d=-1,h=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=d,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,r,n,a,i){var o=2*a/(t-e),u=2*a/(n-r),s=(t+e)/(t-e),c=(n+r)/(n-r),l=-1,f=-1,d=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=d,i[15]=0,i},c.computeViewportTransformation=function(e,t,n,a){e=r(e,r.EMPTY_OBJECT);var i=r(e.x,0),o=r(e.y,0),u=r(e.width,0),s=r(e.height,0);t=r(t,0),n=r(n,1);var c=.5*u,l=.5*s,f=.5*(n-t),d=c,h=l,m=f,p=i+c,y=o+l,v=t+f,g=1;return a[0]=d,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=m,a[11]=0,a[12]=p,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,r){var n=4*t,a=e[n],i=e[n+1],o=e[n+2],u=e[n+3];return r.x=a,r.y=i,r.z=o,r.w=u,r},c.setColumn=function(e,t,r,n){n=c.clone(e,n);var a=4*t;return n[a]=r.x,n[a+1]=r.y,n[a+2]=r.z,n[a+3]=r.w,n},c.setTranslation=function(e,t,r){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=e[15],r},c.getRow=function(e,t,r){var n=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return r.x=n,r.y=a,r.z=i,r.w=o,r},c.setRow=function(e,t,r,n){return n=c.clone(e,n),n[t]=r.x,n[t+4]=r.y,n[t+8]=r.z,n[t+12]=r.w,n};var h=new e;c.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),r.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),r.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),r};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],O=t[4],M=t[5],_=t[6],T=t[7],b=t[8],P=t[9],A=t[10],N=t[11],I=t[12],R=t[13],C=t[14],z=t[15],D=n*w+u*x+f*E+p*S,L=a*w+s*x+d*E+y*S,q=i*w+c*x+h*E+v*S,U=o*w+l*x+m*E+g*S,B=n*O+u*M+f*_+p*T,F=a*O+s*M+d*_+y*T,W=i*O+c*M+h*_+v*T,G=o*O+l*M+m*_+g*T,k=n*b+u*P+f*A+p*N,V=a*b+s*P+d*A+y*N,Y=i*b+c*P+h*A+v*N,j=o*b+l*P+m*A+g*N,H=n*I+u*R+f*C+p*z,Z=a*I+s*R+d*C+y*z,X=i*I+c*R+h*C+v*z,J=o*I+l*R+m*C+g*z;return r[0]=D,r[1]=L,r[2]=q,r[3]=U,r[4]=B,r[5]=F,r[6]=W,r[7]=G,r[8]=k,r[9]=V,r[10]=Y,r[11]=j,r[12]=H,r[13]=Z,r[14]=X,r[15]=J,r},c.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r},c.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r},c.multiplyTransformation=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=e[12],h=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],O=t[10],M=t[12],_=t[13],T=t[14],b=n*p+o*y+c*v,P=a*p+u*y+l*v,A=i*p+s*y+f*v,N=n*g+o*w+c*x,I=a*g+u*w+l*x,R=i*g+s*w+f*x,C=n*E+o*S+c*O,z=a*E+u*S+l*O,D=i*E+s*S+f*O,L=n*M+o*_+c*T+d,q=a*M+u*_+l*T+h,U=i*M+s*_+f*T+m;return r[0]=b,r[1]=P,r[2]=A,r[3]=0,r[4]=N,r[5]=I,r[6]=R,r[7]=0,r[8]=C,r[9]=z,r[10]=D,r[11]=0,r[12]=L,r[13]=q,r[14]=U,r[15]=1,r},c.multiplyByMatrix3=function(e,t,r){var n=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=t[0],h=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=n*d+o*h+c*m,S=a*d+u*h+l*m,O=i*d+s*h+f*m,M=n*p+o*y+c*v,_=a*p+u*y+l*v,T=i*p+s*y+f*v,b=n*g+o*w+c*x,P=a*g+u*w+l*x,A=i*g+s*w+f*x;return r[0]=E,r[1]=S,r[2]=O,r[3]=0,r[4]=M,r[5]=_,r[6]=T,r[7]=0,r[8]=b,r[9]=P,r[10]=A,r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},c.multiplyByTranslation=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=n*e[0]+a*e[4]+i*e[8]+e[12],u=n*e[1]+a*e[5]+i*e[9]+e[13],s=n*e[2]+a*e[6]+i*e[10]+e[14];return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=o,r[13]=u,r[14]=s,r[15]=e[15],r};var p=new e;c.multiplyByUniformScale=function(e,t,r){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,r)},c.multiplyByScale=function(e,t,r){var n=t.x,a=t.y,i=t.z;return 1===n&&1===a&&1===i?c.clone(e,r):(r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=0,r[4]=a*e[4],r[5]=a*e[5],r[6]=a*e[6],r[7]=0,r[8]=i*e[8],r[9]=i*e[9],r[10]=i*e[10],r[11]=0,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=1,r)},c.multiplyByVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*n+e[4]*a+e[8]*i+e[12]*o,s=e[1]*n+e[5]*a+e[9]*i+e[13]*o,c=e[2]*n+e[6]*a+e[10]*i+e[14]*o,l=e[3]*n+e[7]*a+e[11]*i+e[15]*o;return r.x=u,r.y=s,r.z=c,r.w=l,r},c.multiplyByPointAsVector=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[4]*a+e[8]*i,u=e[1]*n+e[5]*a+e[9]*i,s=e[2]*n+e[6]*a+e[10]*i;return r.x=o,r.y=u,r.z=s,r},c.multiplyByPoint=function(e,t,r){var n=t.x,a=t.y,i=t.z,o=e[0]*n+e[4]*a+e[8]*i+e[12],u=e[1]*n+e[5]*a+e[9]*i+e[13],s=e[2]*n+e[6]*a+e[10]*i+e[14];return r.x=o,r.y=u,r.z=s,r},c.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var r=e[1],n=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r&&Math.abs(e[9]-t[9])<=r&&Math.abs(e[10]-t[10])<=r&&Math.abs(e[11]-t[11])<=r&&Math.abs(e[12]-t[12])<=r&&Math.abs(e[13]-t[13])<=r&&Math.abs(e[14]-t[14])<=r&&Math.abs(e[15]-t[15])<=r},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,r){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=0,r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=1,r;var n=e[0],a=e[4],i=e[8],l=e[12],f=e[1],d=e[5],h=e[9],m=e[13],p=e[2],x=e[6],E=e[10],S=e[14],O=e[3],M=e[7],_=e[11],T=e[15],b=E*T,P=S*_,A=x*T,N=S*M,I=x*_,R=E*M,C=p*T,z=S*O,D=p*_,L=E*O,q=p*M,U=x*O,B=b*d+N*h+I*m-(P*d+A*h+R*m),F=P*f+C*h+L*m-(b*f+z*h+D*m),W=A*f+z*d+q*m-(N*f+C*d+U*m),G=R*f+D*d+U*h-(I*f+L*d+q*h),k=P*a+A*i+R*l-(b*a+N*i+I*l),V=b*n+z*i+D*l-(P*n+C*i+L*l),Y=N*n+C*a+U*l-(A*n+z*a+q*l),j=I*n+L*a+q*i-(R*n+D*a+U*i);b=i*m,P=l*h,A=a*m,N=l*d,I=a*h,R=i*d,C=n*m,z=l*f,D=n*h,L=i*f,q=n*d,U=a*f;var H=b*M+N*_+I*T-(P*M+A*_+R*T),Z=P*O+C*_+L*T-(b*O+z*_+D*T),X=A*O+z*M+q*T-(N*O+C*M+U*T),J=R*O+D*M+U*_-(I*O+L*M+q*_),K=A*E+R*S+P*x-(I*S+b*x+N*E),Q=D*S+b*p+z*E-(C*E+L*S+P*p),$=C*x+U*S+N*p-(q*S+A*p+z*x),et=q*E+I*p+L*x-(D*x+U*E+R*p),tt=n*B+a*F+i*W+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,r[0]=B*tt,r[1]=F*tt,r[2]=W*tt,r[3]=G*tt,r[4]=k*tt,r[5]=V*tt,r[6]=Y*tt,r[7]=j*tt,r[8]=H*tt,r[9]=Z*tt,r[10]=X*tt,r[11]=J*tt,r[12]=K*tt,r[13]=Q*tt,r[14]=$*tt,r[15]=et*tt,r},c.inverseTransformation=function(e,t){var r=e[0],n=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],d=e[13],h=e[14],m=-r*f-n*d-a*h,p=-i*f-o*d-u*h,y=-s*f-c*d-l*h;return t[0]=r,t[1]=i,t[2]=s,t[3]=0,t[4]=n,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]&&e[9]===t[r+9]&&e[10]===t[r+10]&&e[11]===t[r+11]&&e[12]===t[r+12]&&e[13]===t[r+13]&&e[14]===t[r+14]&&e[15]===t[r+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var a=function(t,r){this.normal=e.clone(t),this.distance=r};a.fromPointNormal=function(r,n,i){var o=-e.dot(n,r);return t(i)?(e.clone(n,i.normal),i.distance=o,i):new a(n,o)};var i=new e;return a.fromCartesian4=function(r,n){var o=e.fromCartesian4(r,i),u=r.w;return t(n)?(e.clone(o,n.normal),n.distance=u,n):new a(o,u)},a.getPointDistance=function(t,r){return e.dot(t.normal,r)+t.distance},a.ORIGIN_XY_PLANE=n(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=n(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=n(new a(e.UNIT_Y,0)),a}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,r,n,a,i,o,u,s,c,l,f,d){"use strict";var h=function(t,n){this.center=e.clone(r(t,e.ZERO)),this.radius=r(n,0)},m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,O=new e,M=new e,_=new e;h.fromPoints=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;for(var a=e.clone(t[0],x),i=e.clone(a,m),o=e.clone(a,p),u=e.clone(a,y),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),f=t.length,d=1;f>d;d++){e.clone(t[d],a);var T=a.x,b=a.y,P=a.z;T<i.x&&e.clone(a,i),T>s.x&&e.clone(a,s),b<o.y&&e.clone(a,o),b>c.y&&e.clone(a,c),P<u.z&&e.clone(a,u),P>l.z&&e.clone(a,l)}var A=e.magnitudeSquared(e.subtract(s,i,E)),N=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),R=i,C=s,z=A;N>z&&(z=N,R=o,C=c),I>z&&(z=I,R=u,C=l);var D=S;D.x=.5*(R.x+C.x),D.y=.5*(R.y+C.y),D.z=.5*(R.z+C.z);var L=e.magnitudeSquared(e.subtract(C,D,E)),q=Math.sqrt(L),U=O;U.x=i.x,U.y=o.y,U.z=u.z;var B=M;B.x=s.x,B.y=c.y,B.z=l.z;var F=e.multiplyByScalar(e.add(U,B,E),.5,_),W=0;for(d=0;f>d;d++){e.clone(t[d],a);var G=e.magnitude(e.subtract(a,F,E));G>W&&(W=G);var k=e.magnitudeSquared(e.subtract(a,D,E));if(k>L){var V=Math.sqrt(k);q=.5*(q+V),L=q*q;var Y=V-q;D.x=(q*D.x+Y*a.x)/V,D.y=(q*D.y+Y*a.y)/V,D.z=(q*D.z+Y*a.z)/V}}return W>q?(e.clone(D,r.center),r.radius=q):(e.clone(F,r.center),r.radius=W),r};var T=new u,b=new e,P=new e,A=new t,N=new t;h.fromRectangle2D=function(e,t,r){return h.fromRectangleWithHeights2D(e,t,0,0,r)},h.fromRectangleWithHeights2D=function(t,a,i,o,u){if(n(u)||(u=new h),!n(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=r(a,T),d.southwest(t,A),A.height=i,d.northeast(t,N),N.height=o;var s=a.project(A,b),c=a.project(N,P),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*f,p.z=s.z+.5*m,u};var I=[];h.fromRectangle3D=function(e,t,a,i){t=r(t,o.WGS84),a=r(a,0);var u;return n(e)&&(u=d.subsample(e,t,a,I)),h.fromPoints(u,i)},h.fromVertices=function(t,a,i,o){if(n(o)||(o=new h),!n(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=r(a,e.ZERO),i=r(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),f=e.clone(u,v),d=e.clone(u,g),T=e.clone(u,w),b=t.length,P=0;b>P;P+=i){var A=t[P]+a.x,N=t[P+1]+a.y,I=t[P+2]+a.z;u.x=A,u.y=N,u.z=I,A<s.x&&e.clone(u,s),A>f.x&&e.clone(u,f),N<c.y&&e.clone(u,c),N>d.y&&e.clone(u,d),I<l.z&&e.clone(u,l),I>T.z&&e.clone(u,T)}var R=e.magnitudeSquared(e.subtract(f,s,E)),C=e.magnitudeSquared(e.subtract(d,c,E)),z=e.magnitudeSquared(e.subtract(T,l,E)),D=s,L=f,q=R;C>q&&(q=C,D=c,L=d),z>q&&(q=z,D=l,L=T);var U=S;U.x=.5*(D.x+L.x),U.y=.5*(D.y+L.y),U.z=.5*(D.z+L.z);var B=e.magnitudeSquared(e.subtract(L,U,E)),F=Math.sqrt(B),W=O;W.x=s.x,W.y=c.y,W.z=l.z;var G=M;G.x=f.x,G.y=d.y,G.z=T.z;var k=e.multiplyByScalar(e.add(W,G,E),.5,_),V=0;for(P=0;b>P;P+=i){u.x=t[P]+a.x,u.y=t[P+1]+a.y,u.z=t[P+2]+a.z;var Y=e.magnitude(e.subtract(u,k,E));Y>V&&(V=Y);var j=e.magnitudeSquared(e.subtract(u,U,E));if(j>B){var H=Math.sqrt(j);F=.5*(F+H),B=F*F;var Z=H-F;U.x=(F*U.x+Z*u.x)/H,U.y=(F*U.y+Z*u.y)/H,U.z=(F*U.z+Z*u.z)/H}}return V>F?(e.clone(U,o.center),o.radius=F):(e.clone(k,o.center),o.radius=V),o},h.fromCornerPoints=function(t,r,a){n(a)||(a=new h);var i=a.center;return e.add(t,r,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,r),a},h.fromEllipsoid=function(t,r){return n(r)||(r=new h),e.clone(e.ZERO,r.center),r.radius=t.maximumRadius,r};var R=new e;h.fromBoundingSpheres=function(t,r){if(n(r)||(r=new h),!n(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var a=t.length;if(1===a)return h.clone(t[0],r);if(2===a)return h.union(t[0],t[1],r);for(var i=[],o=0;a>o;o++)i.push(t[o].center);r=h.fromPoints(i,r);var u=r.center,s=r.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,R)+c.radius)}return r.radius=s,r},h.clone=function(t,r){return n(t)?n(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,n){n=r(n,0);var a=e.center;t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n]=e.radius},h.unpack=function(e,t,a){t=r(t,0),n(a)||(a=new h);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var C=new e,z=new e;h.union=function(t,r,a){n(a)||(a=new h);var i=t.center,o=t.radius,u=r.center,s=r.radius,c=e.subtract(u,i,C),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return r.clone(a),a;var f=.5*(o+l+s),d=e.multiplyByScalar(c,(-o+f)/l,z);return e.add(d,i,d),e.clone(d,a.center),a.radius=f,a};var D=new e;h.expand=function(t,r,n){n=h.clone(t,n);var a=e.magnitude(e.subtract(r,n.center,D));return a>n.radius&&(n.radius=a),n},h.intersectPlane=function(t,r){var n=t.center,a=t.radius,i=r.normal,o=e.dot(i,n)+r.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var L=new f(new e,0);h.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var r=f.fromCartesian4(t,L);return h.intersectPlane(e,r)},h.transform=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=l.getMaximumScale(t)*e.radius,r};var q=new e;h.distanceSquaredTo=function(t,r){var n=e.subtract(t.center,r,q);return e.magnitudeSquared(n)-t.radius*t.radius},h.transformWithoutScale=function(e,t,r){return n(r)||(r=new h),r.center=l.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var U=new e;h.computePlaneDistances=function(t,r,a,i){n(i)||(i=new c);var o=e.subtract(t.center,r,U),u=e.multiplyByScalar(a,e.dot(a,o),U),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var B=new e,F=new e,W=new e,G=new e,k=new e,V=new t,Y=new Array(8),j=0;8>j;++j)Y[j]=new e;var H=new u;return h.projectTo2D=function(t,n,a){n=r(n,H);var i=n.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,F);e.normalize(c,c);var l=e.cross(s,c,W);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),d=e.negate(c,G),m=Y,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,d,p),p=m[2],e.add(s,f,p),e.add(p,d,p),p=m[3],e.add(s,f,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,d,p),p=m[6],e.add(s,f,p),e.add(p,d,p),p=m[7],e.add(s,f,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,V);n.project(w,g)}a=h.fromPoints(m,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},h.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";var i=function(t,r){this.x=e(t,0),this.y=e(r,0)};i.fromElements=function(e,r,n){return t(n)?(n.x=e,n.y=r,n):new i(e,r)},i.clone=function(e,r){return t(e)?t(r)?(r.x=e.x,r.y=e.y,r):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,r,n){n=e(n,0),r[n++]=t.x,r[n]=t.y},i.unpack=function(r,n,a){return n=e(n,0),t(a)||(a=new i),a.x=r[n++],a.y=r[n],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,r){return r.x=Math.min(e.x,t.x),r.y=Math.min(e.y,t.y),r},i.maximumByComponent=function(e,t,r){return r.x=Math.max(e.x,t.x),r.y=Math.max(e.y,t.y),r},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var r=i.magnitude(e);return t.x=e.x/r,t.y=e.y/r,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,r){return r.x=e.x*t.x,r.y=e.y*t.y,r},i.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r},i.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r},i.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r},i.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,r,n){return i.multiplyByScalar(t,r,u),n=i.multiplyByScalar(e,1-r,n),i.add(u,n,n)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var r=i.normalize(e,l);return i.abs(r,r),t=r.x<=r.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,r){return e===r||t(e)&&t(r)&&e.x===r.x&&e.y===r.y},i.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},i.equalsEpsilon=function(e,r,n,i){return e===r||t(e)&&t(r)&&a.equalsEpsilon(e.x,r.x,n,i)&&a.equalsEpsilon(e.y,r.y,n,i)},i.ZERO=n(new i(0,0)),i.UNIT_X=n(new i(1,0)),i.UNIT_Y=n(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,r){return i.equalsEpsilon(this,e,t,r)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(n.requestFullscreen=a,r=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(n.requestFullscreen=a,r=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?n.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(n.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?n.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(n.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?n.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(n.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),n.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),n.fullscreenerror=a)}return r},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[n.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[n.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=n(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=n(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=n(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,O=n(e[1])))}return S}function f(){return l()&&O}function d(){if(!t(M)){M=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(M=!0,_=n(e[1]))}return M}function h(){return t(T)||(T=/Windows/i.test(navigator.appVersion)),T}function m(){return d()&&_}function p(){return t(b)||(b=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),b}var y,v,g,w,x,E,S,O,M,_,T,b,P={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:d,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return P.supportsFullscreen=function(){return r.supportsFullscreen()},P.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},P.supportsWebWorkers=function(){return"undefined"!=typeof Worker},P}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,r,n,a){"use strict";if(!n.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new r("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,n,a,o){switch(a=e(a,0),o=e(o,(n.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(n,a,o);case i.UNSIGNED_BYTE:return new Uint8Array(n,a,o);case i.SHORT:return new Int16Array(n,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(n,a,o);case i.FLOAT:return new Float32Array(n,a,o);case i.DOUBLE:return new Float64Array(n,a,o);default:throw new r("componentDatatype is not a valid value.")}},a(i)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,n.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var n=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(n!==o&&-1!==n)throw new r("All attribute lists must have the same number of attributes.");n=o}return n},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color -};return t}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.geometry=t.geometry,this.modelMatrix=n.clone(e(t.modelMatrix,n.IDENTITY)),this.id=t.id,this.pickPrimitive=t.pickPrimitive,this.attributes=e(t.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return a}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n,a){"use strict";var i={};i.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=t.x,n=t.y;t.x=(1-Math.abs(n))*a.signNotZero(r),t.y=(1-Math.abs(r))*a.signNotZero(n)}return t.x=a.toSNorm(t.x),t.y=a.toSNorm(t.y),t},i.octDecode=function(e,r,n){if(n.x=a.fromSNorm(e),n.y=a.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var i=n.x;n.x=(1-Math.abs(n.y))*a.signNotZero(i),n.y=(1-Math.abs(i))*a.signNotZero(n.y)}return t.normalize(n,n)},i.octPackFloat=function(e){return 256*e.x+e.y};var o=new e;return i.octEncodeFloat=function(e){return i.octEncode(e,o),i.octPackFloat(o)},i.octDecodeFloat=function(e,t){var r=e/256,n=Math.floor(r),a=256*(r-n);return i.octDecode(n,a,t)},i.octPack=function(e,t,r,n){var a=i.octEncodeFloat(e),u=i.octEncodeFloat(t),s=i.octEncode(r,o);return n.x=65536*s.x+a,n.y=65536*s.y+u,n},i.octUnpack=function(e,t,r,n){var a=e.x/65536,o=Math.floor(a),u=65536*(a-o);a=e.y/65536;var s=Math.floor(a),c=65536*(a-s);i.octDecodeFloat(u,t),i.octDecodeFloat(c,r),i.octDecode(o,s,n)},i.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,r=1===e.y?4095:0|4096*e.y;return 4096*t+r},i.decompressTextureCoordinates=function(e,t){var r=e/4096;return t.x=Math.floor(r)/4096,t.y=r-Math.floor(r),t},i}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=new t,a=new t,i=new t,o=function(o,u,s,c,l){r(l)||(l=new t);var f,d,h,m,p,y,v,g;r(u.z)?(f=t.subtract(s,u,n),d=t.subtract(c,u,a),h=t.subtract(o,u,i),m=t.dot(f,f),p=t.dot(f,d),y=t.dot(f,h),v=t.dot(d,d),g=t.dot(d,h)):(f=e.subtract(s,u,n),d=e.subtract(c,u,a),h=e.subtract(o,u,i),m=e.dot(f,f),p=e.dot(f,d),y=e.dot(f,h),v=e.dot(d,d),g=e.dot(d,h));var w=1/(m*v-p*p);return l.y=(v*y-p*g)*w,l.z=(m*g-p*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var r=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};r.encode=function(e,r){t(r)||(r={high:0,low:0});var n;return e>=0?(n=65536*Math.floor(e/65536),r.high=n,r.low=e-n):(n=65536*Math.floor(-e/65536),r.high=-n,r.low=e+n),r};var n={high:0,low:0};r.fromCartesian=function(e,a){t(a)||(a=new r);var i=a.high,o=a.low;return r.encode(e.x,n),i.x=n.high,o.x=n.low,r.encode(e.y,n),i.y=n.high,o.y=n.low,r.encode(e.z,n),i.z=n.high,o.z=n.low,a};var a=new r;return r.writeElements=function(e,t,n){r.fromCartesian(e,a);var i=a.high,o=a.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z},r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,r,a){return e>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,a):new Uint16Array(t,r,a)},r(a)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var a=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(r)))<n?0:a}var n={};return n.computeDiscriminant=function(e,t,r){var n=t*t-4*e*r;return n},n.computeRealRoots=function(e,n,a){var i;if(0===e)return 0===n?[]:[-a/n];if(0===n){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-n/e,0>i?[i,0]:[0,i];var c=n*n,l=4*e*a,f=r(c,-l,t.EPSILON14);if(0>f)return[];var d=-.5*r(n,t.sign(n)*Math.sqrt(f),t.EPSILON14);return n>0?[d/e,a/d]:[a/d,d/e]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var a,i,o=e,u=t/3,s=r/3,c=n,l=o*s,f=u*c,d=u*u,h=s*s,m=o*s-d,p=o*c-u*s,y=u*c-h,v=4*m*y-p*p;if(0>v){var g,w,x;d*f>=l*h?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var O=i/2,M=0>O?-Math.pow(-O,1/3):Math.pow(O,1/3),_=i===S?-M:-w/M;return a=0>=w?M+_:-x/(M*M+_*_+w),d*f>=l*h?[(a-u)/o]:[-c/(a+s)]}var T=m,b=-2*u*m+o*p,P=y,A=-c*p+2*s*y,N=Math.sqrt(v),I=Math.sqrt(3)/2,R=Math.abs(Math.atan2(o*N,-b)/3);a=2*Math.sqrt(-T);var C=Math.cos(R);i=a*C;var z=a*(-C/2-I*Math.sin(R)),D=i+z>2*u?i-u:z-u,L=o,q=D/L;R=Math.abs(Math.atan2(c*N,-A)/3),a=2*Math.sqrt(-P),C=Math.cos(R),i=a*C,z=a*(-C/2-I*Math.sin(R));var U=-c,B=2*s>i+z?i+s:z+s,F=U/B,W=L*B,G=-D*B-L*U,k=D*U,V=(s*G-u*k)/(-u*G+s*W);return V>=q?F>=q?F>=V?[q,V,F]:[q,F,V]:[F,q,V]:F>=q?[V,q,F]:F>=V?[V,F,q]:[F,V,q]}var n={};return n.computeDiscriminant=function(e,t,r,n){var a=e*e,i=t*t,o=r*r,u=n*n,s=18*e*t*r*n+i*o-27*a*u-4*(e*o*r+i*t*n);return s},n.computeRealRoots=function(e,n,a,i){var o,u;if(0===e)return t.computeRealRoots(n,a,i);if(0===n){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):r(e,0,a,i)}return 0===a?0===i?(u=-n/e,0>u?[u,0,0]:[0,0,u]):r(e,n,0,i):0===i?(o=t.computeRealRoots(e,n,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):r(e,n,a,i)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var d=-t/4,h=f[f.length-1];if(Math.abs(h)<r.EPSILON14){var m=n.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[d-w,d-g,d+g,d+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[d-p,d+p];if(0>y&&v>=0)return p=Math.sqrt(v),[d-p,d+p]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,O=n.computeRealRoots(1,x,E),M=n.computeRealRoots(1,-x,S);return 0!==O.length?(O[0]+=d,O[1]+=d,0!==M.length?(M[0]+=d,M[1]+=d,O[1]<=M[0]?[O[0],O[1],M[0],M[1]]:M[1]<=O[0]?[M[0],M[1],O[0],O[1]]:O[0]>=M[0]&&O[1]<=M[1]?[M[0],O[0],O[1],M[1]]:M[0]>=O[0]&&M[1]<=O[1]?[O[0],M[0],M[1],O[1]]:O[0]>M[0]&&O[0]<M[1]?[M[0],O[0],M[1],O[1]]:[O[0],M[0],O[1],M[1]]):O):0!==M.length?(M[0]+=d,M[1]+=d,M):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,f=i*t+s-4*o,d=c*o-i*a*t+u,h=e.computeRealRoots(1,l,f,d);if(h.length>0){var m,p,y=h[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),O=c-4*y,M=c+4*Math.abs(y);if(0>y||O*S>E*M){var _=Math.sqrt(O);m=_/2,p=0===_?0:(t*x-i)/_}else{var T=Math.sqrt(E);m=0===T?0:(t*x-i)/T,p=T/2}var b,P;0===w&&0===m?(b=0,P=0):r.sign(w)===r.sign(m)?(b=w+m,P=y/b):(P=w-m,b=y/P);var A,N;0===x&&0===p?(A=0,N=0):r.sign(x)===r.sign(p)?(A=x+p,N=o/A):(N=x-p,A=o/N);var I=n.computeRealRoots(1,b,A),R=n.computeRealRoots(1,P,N);if(0!==I.length)return 0!==R.length?I[1]<=R[0]?[I[0],I[1],R[0],R[1]]:R[1]<=I[0]?[R[0],R[1],I[0],I[1]]:I[0]>=R[0]&&I[1]<=R[1]?[R[0],I[0],I[1],R[1]]:R[0]>=I[0]&&R[1]<=I[1]?[I[0],R[0],R[1],I[1]]:I[0]>R[0]&&I[0]<R[1]?[R[0],I[0],R[1],I[1]]:[I[0],R[0],I[1],R[1]]:I;if(0!==R.length)return R}return[]}var o={};return o.computeDiscriminant=function(e,t,r,n,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=r*r,l=c*r,f=n*n,d=f*n,h=a*a,m=h*a,p=u*c*f-4*s*d-4*e*l*f+18*e*t*r*d-27*i*f*f+256*o*m+a*(18*s*r*n-4*u*l+16*e*c*c-80*e*t*c*n-6*e*u*f+144*i*r*f)+h*(144*e*u*r-27*u*u-128*i*c-192*i*t*n);return p},o.computeRealRoots=function(t,n,o,u,s){if(Math.abs(t)<r.EPSILON15)return e.computeRealRoots(n,o,u,s);var c=n/t,l=o/t,f=u/t,d=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>d?h+1:h){case 0:return a(c,l,f,d);case 1:return i(c,l,f,d);case 2:return i(c,l,f,d);case 3:return a(c,l,f,d);case 4:return a(c,l,f,d);case 5:return i(c,l,f,d);case 6:return a(c,l,f,d);case 7:return a(c,l,f,d);case 8:return i(c,l,f,d);case 9:return a(c,l,f,d);case 10:return a(c,l,f,d);case 11:return i(c,l,f,d);case 12:return a(c,l,f,d);case 13:return a(c,l,f,d);case 14:return a(c,l,f,d);case 15:return a(c,l,f,d);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n=function(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n};return n.getPoint=function(t,n,a){return r(a)||(a=new e),a=e.multiplyByScalar(t.direction,n,a),e.add(t.origin,a,a)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(t,n,a,o,u){u=r(u,!1);var s,c,l,f,d,h=t.origin,m=t.direction,p=e.subtract(a,n,y),E=e.subtract(o,n,v),S=e.cross(m,E,g),O=e.dot(p,S);if(u){if(O<i.EPSILON6)return void 0;if(s=e.subtract(h,n,w),l=e.dot(s,S),0>l||l>O)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c),0>f||l+f>O)return void 0;d=e.dot(E,c)/O}else{if(Math.abs(O)<i.EPSILON6)return void 0;var M=1/O;if(s=e.subtract(h,n,w),l=e.dot(s,S)*M,0>l||l>1)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c)*M,0>f||l+f>1)return void 0;d=e.dot(E,c)*M}return d}function f(e,t,r,n){var a=t*t-4*e*r;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-t/(2*e);return 0===c?void 0:(n.root0=n.root1=c,n)}function d(t,r,a){n(a)||(a={});var i=t.origin,o=t.direction,u=r.center,s=r.radius*r.radius,c=e.subtract(i,u,g),l=e.dot(o,o),d=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=f(l,d,h,S);return n(m)?(a.start=m.root0,a.stop=m.root1,a):void 0}function h(e,t,r){var n=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))<r?0:n}function m(t,r,n,a,c){var l,f=a*a,d=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*d,p=c*(a*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+r.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*d+a*r.x+n,v=d*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+r.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],O=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-O)),w.push(new e(a,c*S,c*O))}return w}var M=g*g,_=v*v,T=m*m,b=g*v,P=T+_,A=2*(p*m+b),N=2*y*m+p*p-_+M,I=2*(y*p-b),R=y*y-M;if(0===P&&0===A&&0===N&&0===I)return w;l=s.computeRealRoots(P,A,N,I,R);var C=l.length;if(0===C)return w;for(var z=0;C>z;++z){var D,L=l[z],q=L*L,U=Math.max(1-q,0),B=Math.sqrt(U);D=i.sign(m)===i.sign(y)?h(m*q+y,p*L,i.EPSILON12):i.sign(y)===i.sign(p*L)?h(m*q,p*L+y,i.EPSILON12):h(m*q+p*L,y,i.EPSILON12);var F=h(v*L,g,i.EPSILON15),W=D*F;0>W?w.push(new e(a,c*L,c*B)):W>0?w.push(new e(a,c*L,c*-B)):0!==B?(w.push(new e(a,c*L,c*-B)),w.push(new e(a,c*L,c*B)),++z):w.push(new e(a,c*L,c*B))}return w}var p={};p.rayPlane=function(t,r,a){n(a)||(a=new e);var o=t.origin,u=t.direction,s=r.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-r.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,r,a,i,o,u){var s=l(t,r,a,i,o);return!n(s)||0>s?void 0:(n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;p.lineSegmentTriangle=function(t,r,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(r,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,a,i,o,u);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};p.raySphere=function(e,t,r){return r=d(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var O=new c;p.lineSegmentSphere=function(t,r,a,i){var o=O;e.clone(t,o.origin);var u=e.subtract(r,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=d(o,a,i),!n(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var M=new e,_=new e;p.rayEllipsoid=function(t,r){var n,a,i,o,u,s=r.oneOverRadii,c=e.multiplyComponents(s,t.origin,M),l=e.multiplyComponents(s,t.direction,_),f=e.magnitudeSquared(c),d=e.dot(c,l);if(f>1){if(d>=0)return void 0;var h=d*d;if(n=f-1,a=e.magnitudeSquared(l),i=a*n,i>h)return void 0;if(h>i){o=d*d-i,u=-d+Math.sqrt(o);var m=u/a,p=n/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(n/a);return{start:y,stop:y}}return 1>f?(n=f-1,a=e.magnitudeSquared(l),i=a*n,o=d*d-i,u=-d+Math.sqrt(o),{start:0,stop:u/a}):0>d?(a=e.magnitudeSquared(l),{start:0,stop:-d/a}):void 0};var T=new e,b=new e,P=new e,A=new e,N=new e,I=new o,R=new o,C=new o,z=new o,D=new o,L=new o,q=new o,U=new e,B=new e,F=new t;p.grazingAltitudeLocation=function(t,r){var a=t.origin,u=t.direction,s=r.geodeticSurfaceNormal(a,T);if(e.dot(u,s)>=0)return a;var c=n(this.rayEllipsoid(t,r)),l=r.transformPositionToScaledSpace(u,T),f=e.normalize(l,l),d=e.mostOrthogonalAxis(l,A),h=e.normalize(e.cross(d,f,b),b),p=e.normalize(e.cross(f,h,P),P),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,R),g=o.fromScale(r.radii,C),w=o.fromScale(r.oneOverRadii,z),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,O=o.multiply(o.multiply(v,w,L),x,L),M=o.multiply(o.multiply(O,g,q),y,q),_=o.multiplyByVector(O,a,N),W=m(M,e.negate(_,T),0,0,1),G=W.length;if(G>0){for(var k=e.clone(e.ZERO,B),V=Number.NEGATIVE_INFINITY,Y=0;G>Y;++Y){E=o.multiplyByVector(g,o.multiplyByVector(y,W[Y],U),U);var j=e.normalize(e.subtract(E,a,A),A),H=e.dot(j,u);H>V&&(V=H,k=e.clone(E,k))}var Z=r.cartesianToCartographic(k,F);return V=i.clamp(V,0,1),S=e.magnitude(e.subtract(k,a,A))*Math.sqrt(1-V*V),S=c?-S:S,Z.height=S,r.cartographicToCartesian(Z,new e)}return void 0};var W=new e;return p.lineSegmentPlane=function(t,r,a,o){n(o)||(o=new e);var u=e.subtract(r,t,W),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(a.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,r,n,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,r)+o<0,c=e.dot(i,n)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,d;if((1===l||2===l)&&(f=new e,d=new e),1===l){if(u)return p.lineSegmentPlane(t,r,a,f),p.lineSegmentPlane(t,n,a,d),{positions:[t,r,n,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(r,n,a,f),p.lineSegmentPlane(r,t,a,d),{positions:[t,r,n,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(n,t,a,f),p.lineSegmentPlane(n,r,a,d),{positions:[t,r,n,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(r,t,a,f),p.lineSegmentPlane(n,t,a,d),{positions:[t,r,n,f,d],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(n,r,a,f),p.lineSegmentPlane(t,r,a,d),{positions:[t,r,n,f,d],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,n,a,f),p.lineSegmentPlane(r,n,a,d),{positions:[t,r,n,f,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var r={};return r.calculateACMR=function(r){r=e(r,e.EMPTY_OBJECT);var n=r.indices,a=r.maximumIndex,i=e(r.cacheSize,24),o=n.length;if(!t(a)){a=0;for(var u=0,s=n[u];o>u;)s>a&&(a=s),++u,s=n[u]}for(var c=[],l=0;a+1>l;l++)c[l]=0;for(var f=i+1,d=0;o>d;++d)f-c[n[d]]>i&&(c[n[d]]=f,++f);return(f-i+1)/(o/3)},r.tipsify=function(r){function n(e,t,r,n){for(;t.length>=1;){var a=t[t.length-1];if(t.splice(t.length-1,1),e[a].numLiveTriangles>0)return a}for(;n>i;){if(e[i].numLiveTriangles>0)return++i,i-1;++i}return-1}function a(e,t,r,a,i,o,u){for(var s,c=-1,l=-1,f=0;f<r.length;){var d=r[f];a[d].numLiveTriangles&&(s=0,i-a[d].timeStamp+2*a[d].numLiveTriangles<=t&&(s=i-a[d].timeStamp),(s>l||-1===l)&&(l=s,c=d)),++f}return-1===c?n(a,o,e,u):c}r=e(r,e.EMPTY_OBJECT);var i,o=r.indices,u=r.maximumIndex,s=e(r.cacheSize,24),c=o.length,l=0,f=0,d=o[f],h=c;if(t(u))l=u+1;else{for(;h>f;)d>l&&(l=d),++f,d=o[f];if(-1===l)return 0;++l}for(var m=[],p=0;l>p;p++)m[p]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};f=0;for(var y=0;h>f;)m[o[f]].vertexTriangles.push(y),++m[o[f]].numLiveTriangles,m[o[f+1]].vertexTriangles.push(y),++m[o[f+1]].numLiveTriangles,m[o[f+2]].vertexTriangles.push(y),++m[o[f+2]].numLiveTriangles,++y,f+=3;var v=0,g=s+1;i=1;var w,x,E=[],S=[],O=0,M=[],_=c/3,T=[];for(p=0;_>p;p++)T[p]=!1;for(var b,P;-1!==v;){E=[],x=m[v],P=x.vertexTriangles.length;for(var A=0;P>A;++A)if(y=x.vertexTriangles[A],!T[y]){T[y]=!0,f=y+y+y;for(var N=0;3>N;++N)b=o[f],E.push(b),S.push(b),M[O]=b,++O,w=m[b],--w.numLiveTriangles,g-w.timeStamp>s&&(w.timeStamp=g,++g),++f}v=a(o,s,E,m,g,S,l)}return M},r}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m,p,y,v,g,w,x,E,S,O,M,_){"use strict";function T(e,t,r,n,a){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=a,e[t++]=a,e[t]=r}function b(e){for(var t=e.length,r=6*(t/3),n=v.createTypedArray(t,r),a=0,i=0;t>i;i+=3,a+=6)T(n,a,e[i],e[i+1],e[i+2]);return n}function P(e){var t=e.length;if(t>=3){var r=6*(t-2),n=v.createTypedArray(t,r);T(n,0,e[0],e[1],e[2]);for(var a=6,i=3;t>i;++i,a+=6)T(n,a,e[i-1],e[i],e[i-2]);return n}return new Uint16Array}function A(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=v.createTypedArray(t,r),a=e[0],i=0,o=1;t>o;++o,i+=6)T(n,i,a,e[o],e[o+1]);return n}return new Uint16Array}function N(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new m({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function I(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var a=t[n],i=0;i<a.componentsPerAttribute;++i)e[n].values.push(a.values[r*a.componentsPerAttribute+i])}function R(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,it),S.multiplyByPoint(e,it,it),a.pack(it,r,i)}function C(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,it),E.multiplyByVector(e,it,it),it=a.normalize(it,it),a.pack(it,r,i)}function z(e,t){var r,n=e.length,a={},i=e[0][t].attributes;for(r in i)if(i.hasOwnProperty(r)&&c(i[r])&&c(i[r].values)){for(var o=i[r],s=o.values.length,l=!0,f=1;n>f;++f){var d=e[f][t].attributes[r];if(!c(d)||o.componentDatatype!==d.componentDatatype||o.componentsPerAttribute!==d.componentsPerAttribute||o.normalize!==d.normalize){l=!1;break}s+=d.values.length}l&&(a[r]=new m({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return a}function D(e,t){var n,i,o,u,s=e.length;e[0].modelMatrix;var l,f,d,m=c(e[0][t].indices),p=e[0][t].primitiveType,y=z(e,t);for(n in y)if(y.hasOwnProperty(n))for(l=y[n].values,u=0,i=0;s>i;++i)for(f=e[i][t].attributes[n].values,d=f.length,o=0;d>o;++o)l[u++]=f[o];var g;if(m){var w=0;for(i=0;s>i;++i)w+=e[i][t].indices.length;var x=h.computeNumberOfVertices(new h({attributes:y,primitiveType:M.POINTS})),E=v.createTypedArray(x,w),S=0,O=0;for(i=0;s>i;++i){var _=e[i][t].indices,T=_.length;for(u=0;T>u;++u)E[S++]=O+_[u];O+=h.computeNumberOfVertices(e[i][t])}g=E}var b,P=new a,A=0;for(i=0;s>i;++i){if(b=e[i][t].boundingSphere,!c(b)){P=void 0;break}a.add(b.center,P,P)}if(c(P))for(a.divideByScalar(P,s,P),i=0;s>i;++i){b=e[i][t].boundingSphere;var N=a.magnitude(a.subtract(b.center,P,st))+b.radius;N>A&&(A=N)}return new h({attributes:y,indices:g,primitiveType:p,boundingSphere:c(P)?new r(P,A):void 0})}function L(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function q(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,a=3;t>a;++a)r[n++]=a-1,r[n++]=0,r[n++]=a;return e.indices=r,e.primitiveType=M.TRIANGLES,e}function U(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,a=3;t-1>a;a+=2)r[n++]=a,r[n++]=a-1,r[n++]=a+1,t>a+2&&(r[n++]=a,r[n++]=a+1,r[n++]=a+2);return e.indices=r,e.primitiveType=M.TRIANGLES,e}function B(e){if(c(e.indices))return e;for(var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function F(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return e.indices=r,e.primitiveType=M.LINES,e}function W(e){var t=h.computeNumberOfVertices(e),r=v.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=M.LINES,e}function G(e){switch(e.primitiveType){case M.TRIANGLE_FAN:return q(e);case M.TRIANGLE_STRIP:return U(e);case M.TRIANGLES:return L(e);case M.LINE_STRIP:return F(e);case M.LINE_LOOP:return W(e);case M.LINES:return B(e)}return e}function k(e,t){Math.abs(e.y)<x.EPSILON6&&(e.y=t?-x.EPSILON6:x.EPSILON6)}function V(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return k(e,e.y<0),k(t,t.y<0),k(r,r.y<0),void 0;var n,a=Math.abs(e.y),i=Math.abs(t.y),o=Math.abs(r.y);n=a>i?a>o?x.sign(e.y):x.sign(r.y):i>o?x.sign(t.y):x.sign(r.y);var u=0>n;k(e,u),k(t,u),k(r,u)}function Y(e,t,r,n){a.add(e,a.multiplyByScalar(a.subtract(t,e,xt),e.y/(e.y-t.y),xt),r),a.clone(r,n),k(r,!0),k(n,!1)}function j(e,t,r){if(e.x>=0||t.x>=0||r.x>=0)return void 0;V(e,t,r);var n=e.y<0,a=t.y<0,i=r.y<0,o=0;o+=n?1:0,o+=a?1:0,o+=i?1:0;var u=_t.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(Y(e,t,Et,Ot),Y(e,r,St,Mt),u[0]=0,u[3]=1,u[4]=2,u[6]=1):a?(Y(t,r,Et,Ot),Y(t,e,St,Mt),u[0]=1,u[3]=2,u[4]=0,u[6]=2):i&&(Y(r,e,Et,Ot),Y(r,t,St,Mt),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,n?a?i||(Y(r,e,Et,Ot),Y(r,t,St,Mt),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(Y(t,r,Et,Ot),Y(t,e,St,Mt),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(Y(e,t,Et,Ot),Y(e,r,St,Mt),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=_t.positions;return s[0]=e,s[1]=t,s[2]=r,s.length=3,(1===o||2===o)&&(s[3]=Et,s[4]=St,s[5]=Ot,s[6]=Mt,s.length=7),_t}function H(e,t){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var a in n)if(n.hasOwnProperty(a)&&c(n[a])&&c(n[a].values)){var i=n[a];i.values=u.createTypedArray(i.componentDatatype,i.values)}var o=h.computeNumberOfVertices(e);return e.indices=v.createTypedArray(o,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}function Z(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var a=t[n];r[n]=new m({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:[]})}return new h({attributes:r,indices:[],primitiveType:e.primitiveType})}function X(e,t,r){var n=c(e.geometry.boundingSphere);t=H(t,n),r=H(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function J(e,r,i,o,u,s,l,f,d,h,m){if(c(s)||c(l)||c(f)||c(d)){var p=a.fromArray(u,3*e,Tt),y=a.fromArray(u,3*r,bt),v=a.fromArray(u,3*i,Pt),g=t(o,p,y,v,At);if(c(s)){var w=a.fromArray(s,3*e,Tt),x=a.fromArray(s,3*r,bt),E=a.fromArray(s,3*i,Pt);a.multiplyByScalar(w,g.x,w),a.multiplyByScalar(x,g.y,x),a.multiplyByScalar(E,g.z,E);var S=a.add(w,x,w);a.add(S,E,S),a.normalize(S,S),a.pack(S,h.normal.values,3*m)}if(c(l)){var O=a.fromArray(l,3*e,Tt),M=a.fromArray(l,3*r,bt),_=a.fromArray(l,3*i,Pt);a.multiplyByScalar(O,g.x,O),a.multiplyByScalar(M,g.y,M),a.multiplyByScalar(_,g.z,_);var T=a.add(O,M,O);a.add(T,_,T),a.normalize(T,T),a.pack(T,h.binormal.values,3*m)}if(c(f)){var b=a.fromArray(f,3*e,Tt),P=a.fromArray(f,3*r,bt),A=a.fromArray(f,3*i,Pt);a.multiplyByScalar(b,g.x,b),a.multiplyByScalar(P,g.y,P),a.multiplyByScalar(A,g.z,A);var N=a.add(b,P,b);a.add(N,A,N),a.normalize(N,N),a.pack(N,h.tangent.values,3*m)}if(c(d)){var I=n.fromArray(d,2*e,Nt),R=n.fromArray(d,2*r,It),C=n.fromArray(d,2*i,Rt);n.multiplyByScalar(I,g.x,I),n.multiplyByScalar(R,g.y,R),n.multiplyByScalar(C,g.z,C);var z=n.add(I,R,I);n.add(z,C,z),n.pack(z,h.st.values,2*m)}}}function K(e,t,r,n,a,i){var o=e.position.values.length/3;if(-1!==a){var u=n[a],s=r[u];return-1===s?(r[u]=o,e.position.values.push(i.x,i.y,i.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(i.x,i.y,i.z),t.push(o),o}function Q(e){var t,r,n,i,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,d=c(s.binormal)?s.binormal.values:void 0,h=c(s.tangent)?s.tangent.values:void 0,m=c(s.st)?s.st.values:void 0,p=u.indices,y=Z(u),v=Z(u),g=[];g.length=l.length/3;var w=[];for(w.length=l.length/3,o=0;o<g.length;++o)g[o]=-1,w[o]=-1;var x=p.length;for(o=0;x>o;o+=3){var E=p[o],S=p[o+1],O=p[o+2],M=a.fromArray(l,3*E),_=a.fromArray(l,3*S),T=a.fromArray(l,3*O),b=j(M,_,T);if(c(b)&&b.positions.length>3)for(var P=b.positions,A=b.indices,N=A.length,I=0;N>I;++I){var R=A[I],C=P[R];C.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=w),i=K(t,r,n,p,3>R?o+R:-1,C),J(E,S,O,C,l,f,d,h,m,t,i)}else c(b)&&(M=b.positions[0],_=b.positions[1],T=b.positions[2]),M.y<0?(t=v.attributes,r=v.indices,n=g):(t=y.attributes,r=y.indices,n=w),i=K(t,r,n,p,o,M),J(E,S,O,M,l,f,d,h,m,t,i),i=K(t,r,n,p,o+1,_),J(E,S,O,_,l,f,d,h,m,t,i),i=K(t,r,n,p,o+2,T),J(E,S,O,T,l,f,d,h,m,t,i)}X(e,v,y)}function $(e){var t,r=e.geometry,n=r.attributes,i=n.position.values,o=r.indices,u=Z(r),s=Z(r),l=o.length,f=[];f.length=i.length/3;var d=[];for(d.length=i.length/3,t=0;t<f.length;++t)f[t]=-1,d[t]=-1;for(t=0;l>t;t+=2){var h=o[t],m=o[t+1],p=a.fromArray(i,3*h,Tt),y=a.fromArray(i,3*m,bt);Math.abs(p.y)<x.EPSILON6&&(p.y=p.y<0?-x.EPSILON6:x.EPSILON6),Math.abs(y.y)<x.EPSILON6&&(y.y=y.y<0?-x.EPSILON6:x.EPSILON6);var v=u.attributes,g=u.indices,E=d,S=s.attributes,O=s.indices,M=f,_=w.lineSegmentPlane(p,y,Ct,Pt);if(c(_)){var T=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,zt);p.y<0&&(a.negate(T,T),v=s.attributes,g=s.indices,E=f,S=u.attributes,O=u.indices,M=d);var b=a.add(_,T,Dt);K(v,g,E,o,t,p),K(v,g,E,o,-1,b),a.negate(T,T),a.add(_,T,b),K(S,O,M,o,-1,b),K(S,O,M,o,t+1,y)}else{var P,A,N;p.y<0?(P=s.attributes,A=s.indices,N=f):(P=u.attributes,A=u.indices,N=d),K(P,A,N,o,t,p),K(P,A,N,o,t+1,y)}}X(e,s,u)}function et(e){var t=e.geometry,r=t.attributes,o=r.position.values,u=r.prevPosition.values,s=r.nextPosition.values,l=r.expandAndWidth.values;t.indices;var f,d,h,m=c(r.st)?r.st.values:void 0,p=c(r.color)?r.color.values:void 0,y=Z(t),v=Z(t),g=o.length/3;for(f=0;g>f;f+=4){var E=f,S=f+1,O=f+2,M=f+3,_=a.fromArray(o,3*E,Ut),T=a.fromArray(o,3*S,Bt),b=a.fromArray(o,3*O,Ft),P=a.fromArray(o,3*M,Wt);Math.abs(_.y)<x.EPSILON6&&(_.y=x.EPSILON6*(b.y<0?-1:1),T.y=_.y),Math.abs(b.y)<x.EPSILON6&&(b.y=x.EPSILON6*(_.y<0?-1:1),P.y=b.y);var A=y.attributes,N=y.indices,I=v.attributes,R=v.indices,C=w.lineSegmentPlane(_,b,Ct,Gt);if(c(C)){var z=a.multiplyByScalar(a.UNIT_Y,5*x.EPSILON9,kt);_.y<0&&(a.negate(z,z),A=v.attributes,N=v.indices,I=y.attributes,R=y.indices);var D=a.add(C,z,Vt);for(A.position.values.push(_.x,_.y,_.z,T.x,T.y,T.z),A.position.values.push(D.x,D.y,D.z),A.position.values.push(D.x,D.y,D.z),a.negate(z,z),a.add(C,z,D),I.position.values.push(D.x,D.y,D.z),I.position.values.push(D.x,D.y,D.z),I.position.values.push(b.x,b.y,b.z,P.x,P.y,P.z),d=3*E;3*E+6>d;++d)A.prevPosition.values.push(u[d]);for(A.prevPosition.values.push(_.x,_.y,_.z,_.x,_.y,_.z),I.prevPosition.values.push(_.x,_.y,_.z,_.x,_.y,_.z),d=3*O;3*O+6>d;++d)I.prevPosition.values.push(u[d]);for(d=3*E;3*E+6>d;++d)A.nextPosition.values.push(s[d]);for(A.nextPosition.values.push(b.x,b.y,b.z,b.x,b.y,b.z),I.nextPosition.values.push(b.x,b.y,b.z,b.x,b.y,b.z),d=3*O;3*O+6>d;++d)I.nextPosition.values.push(s[d]);var L=n.fromArray(l,2*E,Lt),q=Math.abs(L.y);A.expandAndWidth.values.push(-1,q,1,q),A.expandAndWidth.values.push(-1,-q,1,-q),I.expandAndWidth.values.push(-1,q,1,q),I.expandAndWidth.values.push(-1,-q,1,-q);var U=a.magnitudeSquared(a.subtract(C,_,Wt));if(U/=a.magnitudeSquared(a.subtract(b,_,Wt)),c(p)){var B=i.fromArray(p,4*E,Yt),F=i.fromArray(p,4*O,Yt),W=x.lerp(B.x,F.x,U),G=x.lerp(B.y,F.y,U),k=x.lerp(B.z,F.z,U),V=x.lerp(B.w,F.w,U);for(d=4*E;4*E+8>d;++d)A.color.values.push(p[d]);for(A.color.values.push(W,G,k,V),A.color.values.push(W,G,k,V),I.color.values.push(W,G,k,V),I.color.values.push(W,G,k,V),d=4*O;4*O+8>d;++d)I.color.values.push(p[d])}if(c(m)){var Y=n.fromArray(m,2*E,Lt),j=n.fromArray(m,2*(f+3),qt),H=x.lerp(Y.x,j.x,U);for(d=2*E;2*E+4>d;++d)A.st.values.push(m[d]);for(A.st.values.push(H,Y.y),A.st.values.push(H,j.y),I.st.values.push(H,Y.y),I.st.values.push(H,j.y),d=2*O;2*O+4>d;++d)I.st.values.push(m[d])}h=A.position.values.length/3-4,N.push(h,h+2,h+1),N.push(h+1,h+2,h+3),h=I.position.values.length/3-4,R.push(h,h+2,h+1),R.push(h+1,h+2,h+3)}else{var J,K;for(_.y<0?(J=v.attributes,K=v.indices):(J=y.attributes,K=y.indices),J.position.values.push(_.x,_.y,_.z),J.position.values.push(T.x,T.y,T.z),J.position.values.push(b.x,b.y,b.z),J.position.values.push(P.x,P.y,P.z),d=3*f;3*f+12>d;++d)J.prevPosition.values.push(u[d]),J.nextPosition.values.push(s[d]);for(d=2*f;2*f+8>d;++d)J.expandAndWidth.values.push(l[d]),c(m)&&J.st.values.push(m[d]);if(c(p))for(d=4*f;4*f+16>d;++d)J.color.values.push(p[d]);h=J.position.values.length/3-4,K.push(h,h+2,h+1),K.push(h+1,h+2,h+3)}}X(e,v,y)}var tt={};tt.toWireframe=function(e){var t=e.indices;if(c(t)){switch(e.primitiveType){case M.TRIANGLES:e.indices=b(t);break;case M.TRIANGLE_STRIP:e.indices=P(t);break;case M.TRIANGLE_FAN:e.indices=A(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=M.LINES}return e},tt.createLineSegmentsForVectors=function(e,t,n){t=s(t,"normal"),n=s(n,1e4);for(var a=e.attributes.position.values,i=e.attributes[t].values,o=a.length,l=new Float64Array(2*o),f=0,d=0;o>d;d+=3)l[f++]=a[d],l[f++]=a[d+1],l[f++]=a[d+2],l[f++]=a[d]+i[d]*n,l[f++]=a[d+1]+i[d+1]*n,l[f++]=a[d+2]+i[d+2]*n;var p,y=e.boundingSphere;return c(y)&&(p=new r(y.center,y.radius+n)),new h({attributes:{position:new m({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:l})},primitiveType:M.LINES,boundingSphere:p})},tt.createAttributeLocations=function(e){var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,a={},i=0,o=r.length;for(t=0;o>t;++t){var u=r[t];c(n[u])&&(a[u]=i++)}for(var s in n)n.hasOwnProperty(s)&&!c(a[s])&&(a[s]=i++);return a},tt.reorderForPreVertexCache=function(e){var t=h.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),a=0;t>a;a++)n[a]=-1;for(var i,o=r,s=o.length,l=v.createTypedArray(t,s),f=0,d=0,m=0;s>f;)i=n[o[f]],-1!==i?l[d]=i:(i=o[f],n[i]=m,l[d]=m,++m),++f,++d;e.indices=l;var p=e.attributes;for(var y in p)if(p.hasOwnProperty(y)&&c(p[y])&&c(p[y].values)){for(var g=p[y],w=g.values,x=0,E=g.componentsPerAttribute,S=u.createTypedArray(g.componentDatatype,m*E);t>x;){var O=n[x]; -if(-1!==O)for(a=0;E>a;a++)S[E*O+a]=w[E*x+a];++x}g.values=S}}return e},tt.reorderForPostVertexCache=function(e,t){var r=e.indices;if(e.primitiveType===M.TRIANGLES&&c(r)){for(var n=r.length,a=0,i=0;n>i;i++)r[i]>a&&(a=r[i]);e.indices=_.tipsify({indices:r,maximumIndex:a,cacheSize:t})}return e},tt.fitToUnsignedShortIndices=function(e){var t=[],r=h.computeNumberOfVertices(e);if(c(e.indices)&&r>x.SIXTY_FOUR_KILOBYTES){var n,a=[],i=[],o=0,u=N(e.attributes),s=e.indices,l=s.length;e.primitiveType===M.TRIANGLES?n=3:e.primitiveType===M.LINES?n=2:e.primitiveType===M.POINTS&&(n=1);for(var f=0;l>f;f+=n){for(var d=0;n>d;++d){var m=s[f+d],p=a[m];c(p)||(p=o++,a[m]=p,I(u,e.attributes,m)),i.push(p)}o+n>x.SIXTY_FOUR_KILOBYTES&&(t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],i=[],o=0,u=N(e.attributes))}0!==i.length&&t.push(new h({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var rt=new a,nt=new o;tt.projectTo2D=function(e,t,r,n,i){var o=e.attributes[t];i=c(i)?i:new d;for(var s=i.ellipsoid,f=o.values,h=new Float64Array(f.length),p=0,y=0;y<f.length;y+=3){var v=a.fromArray(f,y,rt),g=s.cartesianToCartographic(v,nt);if(!c(g))throw new l("Could not project point ("+v.x+", "+v.y+", "+v.z+") to 2D.");var w=i.project(g,rt);h[p++]=w.x,h[p++]=w.y,h[p++]=w.z}return e.attributes[r]=o,e.attributes[n]=new m({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:h}),delete e.attributes[t],e};var at={high:0,low:0};tt.encodeAttribute=function(e,t,r,n){for(var a=e.attributes[t],i=a.values,o=i.length,s=new Float32Array(o),c=new Float32Array(o),l=0;o>l;++l)f.encode(i[l],at),s[l]=at.high,c[l]=at.low;var d=a.componentsPerAttribute;return e.attributes[r]=new m({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:s}),e.attributes[n]=new m({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:c}),delete e.attributes[t],e};var it=new a,ot=new S,ut=new E;tt.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(S.equals(t,S.IDENTITY))return e;var n=e.geometry.attributes;R(t,n.position),R(t,n.prevPosition),R(t,n.nextPosition),(c(n.normal)||c(n.binormal)||c(n.tangent))&&(S.inverse(t,ot),S.transpose(ot,ot),S.getRotation(ot,ut),C(ut,n.normal),C(ut,n.binormal),C(ut,n.tangent));var a=e.geometry.boundingSphere;return c(a)&&(e.geometry.boundingSphere=r.transform(a,t,a)),e.modelMatrix=S.clone(S.IDENTITY),e};var st=new a;tt.combineInstances=function(e){for(var t=[],r=[],n=e.length,a=0;n>a;++a){var i=e[a];c(i.geometry)?t.push(i):r.push(i)}var o=[];return t.length>0&&o.push(D(t,"geometry")),r.length>0&&(o.push(D(r,"westHemisphereGeometry")),o.push(D(r,"eastHemisphereGeometry"))),o};var ct=new a,lt=new a,ft=new a,dt=new a;tt.computeNormal=function(e){for(var t=e.indices,r=e.attributes,n=r.position.values,i=r.position.values.length/3,o=t.length,s=new Array(i),c=new Array(o/3),l=new Array(o),f=0;i>f;f++)s[f]={indexOffset:0,count:0,currentCount:0};var d=0;for(f=0;o>f;f+=3){var h=t[f],p=t[f+1],y=t[f+2],v=3*h,g=3*p,w=3*y;lt.x=n[v],lt.y=n[v+1],lt.z=n[v+2],ft.x=n[g],ft.y=n[g+1],ft.z=n[g+2],dt.x=n[w],dt.y=n[w+1],dt.z=n[w+2],s[h].count++,s[p].count++,s[y].count++,a.subtract(ft,lt,ft),a.subtract(dt,lt,dt),c[d]=a.cross(ft,dt,new a),d++}var x=0;for(f=0;i>f;f++)s[f].indexOffset+=x,x+=s[f].count;d=0;var E;for(f=0;o>f;f+=3){E=s[t[f]];var S=E.indexOffset+E.currentCount;l[S]=d,E.currentCount++,E=s[t[f+1]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,E=s[t[f+2]],S=E.indexOffset+E.currentCount,l[S]=d,E.currentCount++,d++}var O=new Float32Array(3*i);for(f=0;i>f;f++){var M=3*f;if(E=s[f],E.count>0){for(a.clone(a.ZERO,ct),d=0;d<E.count;d++)a.add(ct,c[l[E.indexOffset+d]],ct);a.normalize(ct,ct),O[M]=ct.x,O[M+1]=ct.y,O[M+2]=ct.z}else O[M]=0,O[M+1]=0,O[M+2]=1}return e.attributes.normal=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:O}),e};var ht=new a,mt=new a,pt=new a;tt.computeBinormalAndTangent=function(e){e.attributes;for(var t=e.indices,r=e.attributes.position.values,n=e.attributes.normal.values,i=e.attributes.st.values,o=e.attributes.position.values.length/3,s=t.length,c=new Array(3*o),l=0;l<c.length;l++)c[l]=0;var f,d,h;for(l=0;s>l;l+=3){var p=t[l],y=t[l+1],v=t[l+2];f=3*p,d=3*y,h=3*v;var g=2*p,w=2*y,x=2*v,E=r[f],S=r[f+1],O=r[f+2],M=i[g],_=i[g+1],T=i[w+1]-_,b=i[x+1]-_,P=1/((i[w]-M)*b-(i[x]-M)*T),A=(b*(r[d]-E)-T*(r[h]-E))*P,N=(b*(r[d+1]-S)-T*(r[h+1]-S))*P,I=(b*(r[d+2]-O)-T*(r[h+2]-O))*P;c[f]+=A,c[f+1]+=N,c[f+2]+=I,c[d]+=A,c[d+1]+=N,c[d+2]+=I,c[h]+=A,c[h+1]+=N,c[h+2]+=I}var R=new Float32Array(3*o),C=new Float32Array(3*o);for(l=0;o>l;l++){f=3*l,d=f+1,h=f+2;var z=a.fromArray(n,f,ht),D=a.fromArray(c,f,pt),L=a.dot(z,D);a.multiplyByScalar(z,L,mt),a.normalize(a.subtract(D,mt,D),D),C[f]=D.x,C[d]=D.y,C[h]=D.z,a.normalize(a.cross(z,D,D),D),R[f]=D.x,R[d]=D.y,R[h]=D.z}return e.attributes.tangent=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:C}),e.attributes.binormal=new m({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:R}),e};var yt=new n,vt=new a,gt=new a,wt=new a;tt.compressVertices=function(t){var r=t.attributes.normal,i=t.attributes.st;if(!c(r)&&!c(i))return t;var o,s,l,f,d=t.attributes.tangent,h=t.attributes.binormal;c(r)&&(o=r.values),c(i)&&(s=i.values),c(d)&&(l=d.values),h&&(f=h.values);var p=c(o)?o.length:s.length,y=c(o)?3:2,v=p/y,g=v,w=c(s)&&c(o)?2:1;w+=c(l)||c(f)?1:0,g*=w;for(var x=new Float32Array(g),E=0,S=0;v>S;++S){c(s)&&(n.fromArray(s,2*S,yt),x[E++]=e.compressTextureCoordinates(yt));var O=3*S;c(o)&&c(l)&&c(f)?(a.fromArray(o,O,vt),a.fromArray(l,O,gt),a.fromArray(f,O,wt),e.octPack(vt,gt,wt,yt),x[E++]=yt.x,x[E++]=yt.y):(c(o)&&(a.fromArray(o,O,vt),x[E++]=e.octEncodeFloat(vt)),c(l)&&(a.fromArray(l,O,vt),x[E++]=e.octEncodeFloat(vt)),c(f)&&(a.fromArray(f,O,vt),x[E++]=e.octEncodeFloat(vt)))}return t.attributes.compressedAttributes=new m({componentDatatype:u.FLOAT,componentsPerAttribute:w,values:x}),c(o)&&delete t.attributes.normal,c(s)&&delete t.attributes.st,c(l)&&delete t.attributes.tangent,c(f)&&delete t.attributes.binormal,t};var xt=new a,Et=new a,St=new a,Ot=new a,Mt=new a,_t={positions:new Array(7),indices:new Array(9)},Tt=new a,bt=new a,Pt=new a,At=new a,Nt=new n,It=new n,Rt=new n,Ct=O.fromPointNormal(a.ZERO,a.UNIT_Y),zt=new a,Dt=new a,Lt=new n,qt=new n,Ut=new a,Bt=new a,Ft=new a,Wt=new a,Gt=new a,kt=new a,Vt=new a,Yt=new i;return new i,tt.splitLongitude=function(e){var t=e.geometry,n=t.boundingSphere;if(c(n)){var a=n.center.x-n.radius;if(a>0||r.intersectPlane(n,O.ORIGIN_ZX_PLANE)!==g.INTERSECTING)return e}if(t.geometryType!==y.NONE)switch(t.geometryType){case y.POLYLINES:et(e);break;case y.TRIANGLES:Q(e);break;case y.LINES:$(e)}else G(t),t.primitiveType===M.TRIANGLES?Q(e):t.primitiveType===M.LINES&&$(e);return e},tt}),define("Core/Matrix2",["./Cartesian2","./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n,a){"use strict";var i=function(e,r,n,a){this[0]=t(e,0),this[1]=t(n,0),this[2]=t(r,0),this[3]=t(a,0)};i.packedLength=4,i.pack=function(e,r,n){n=t(n,0),r[n++]=e[0],r[n++]=e[1],r[n++]=e[2],r[n++]=e[3]},i.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new i),a[0]=e[n++],a[1]=e[n++],a[2]=e[n++],a[3]=e[n++],a},i.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new i(e[0],e[2],e[1],e[3]):void 0},i.fromArray=function(e,n,a){return n=t(n,0),r(a)||(a=new i),a[0]=e[n],a[1]=e[n+1],a[2]=e[n+2],a[3]=e[n+3],a},i.fromColumnMajorArray=function(e,t){return i.clone(e,t)},i.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new i(e[0],e[1],e[2],e[3])},i.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new i(e.x,0,0,e.y)},i.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new i(e,0,0,e)},i.fromRotation=function(e,t){var n=Math.cos(e),a=Math.sin(e);return r(t)?(t[0]=n,t[1]=a,t[2]=-a,t[3]=n,t):new i(n,-a,a,n)},i.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]},i.getElementIndex=function(e,t){return 2*e+t},i.getColumn=function(e,t,r){var n=2*t,a=e[n],i=e[n+1];return r.x=a,r.y=i,r},i.setColumn=function(e,t,r,n){n=i.clone(e,n);var a=2*t;return n[a]=r.x,n[a+1]=r.y,n},i.getRow=function(e,t,r){var n=e[t],a=e[t+2];return r.x=n,r.y=a,r},i.setRow=function(e,t,r,n){return n=i.clone(e,n),n[t]=r.x,n[t+2]=r.y,n};var o=new e;i.getScale=function(t,r){return r.x=e.magnitude(e.fromElements(t[0],t[1],o)),r.y=e.magnitude(e.fromElements(t[2],t[3],o)),r};var u=new e;return i.getMaximumScale=function(t){return i.getScale(t,u),e.maximumComponent(u)},i.multiply=function(e,t,r){var n=e[0]*t[0]+e[2]*t[1],a=e[0]*t[2]+e[2]*t[3],i=e[1]*t[0]+e[3]*t[1],o=e[1]*t[2]+e[3]*t[3];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r},i.add=function(e,t,r){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r},i.subtract=function(e,t,r){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r},i.multiplyByVector=function(e,t,r){var n=e[0]*t.x+e[2]*t.y,a=e[1]*t.x+e[3]*t.y;return r.x=n,r.y=a,r},i.multiplyByScalar=function(e,t,r){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r},i.multiplyByScale=function(e,t,r){return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.y,r[3]=e[3]*t.y,r},i.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.transpose=function(e,t){var r=e[0],n=e[2],a=e[1],i=e[3];return t[0]=r,t[1]=n,t[2]=a,t[3]=i,t},i.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},i.equals=function(e,t){return e===t||r(e)&&r(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},i.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]},i.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n},i.IDENTITY=a(new i(1,0,0,1)),i.ZERO=a(new i(0,0,0,0)),i.COLUMN0ROW0=0,i.COLUMN0ROW1=1,i.COLUMN1ROW0=2,i.COLUMN1ROW1=3,i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n"+"("+this[1]+", "+this[3]+")"},i}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,r,n,a,i,o){"use strict";var u=function(n,a,i){this.minimum=e.clone(t(n,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),r(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i};u.fromPoints=function(t,n){if(r(n)||(n=new u),!r(t)||0===t.length)return n.minimum=e.clone(e.ZERO,n.minimum),n.maximum=e.clone(e.ZERO,n.maximum),n.center=e.clone(e.ZERO,n.center),n;for(var a=t[0].x,i=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,d=1;f>d;d++){var h=t[d],m=h.x,p=h.y,y=h.z;a=Math.min(m,a),s=Math.max(m,s),i=Math.min(p,i),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=n.minimum;v.x=a,v.y=i,v.z=o;var g=n.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,n.center);return e.multiplyByScalar(w,.5,w),n},u.clone=function(t,n){return r(t)?r(n)?(n.minimum=e.clone(t.minimum,n.minimum),n.maximum=e.clone(t.maximum,n.maximum),n.center=e.clone(t.center,n.center),n):new u(t.minimum,t.maximum):void 0},u.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&e.equals(t.minimum,n.minimum)&&e.equals(t.maximum,n.maximum)};var s=new e;u.intersectPlane=function(t,r){s=e.subtract(t.maximum,t.minimum,s);var n=e.multiplyByScalar(s,.5,s),a=r.normal,o=n.x*Math.abs(a.x)+n.y*Math.abs(a.y)+n.z*Math.abs(a.z),u=e.dot(t.center,a)+r.distance;return u-o>0?i.INSIDE:0>u+o?i.OUTSIDE:i.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){n("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var r=o.fromCartesian4(t,c);return u.intersectPlane(e,r)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,r,n,a){return t(e).then(r,n,a)}function t(e){var t,r;return e instanceof n?t=e:u(e)?(r=o(),e.then(function(e){r.resolve(e)},function(e){r.reject(e)},function(e){r.progress(e)}),t=r.promise):t=a(e),t}function r(t){return e(t,i)}function n(e){this.then=e}function a(e){var r=new n(function(r){try{return t(r?r(e):e)}catch(n){return i(n)}});return r}function i(e){var r=new n(function(r,n){try{return n?t(n(e)):i(e)}catch(a){return i(a)}});return r}function o(){function e(e,t,r){return d(e,t,r)}function r(e){return m(e)}function a(e){return m(i(e))}function u(e){return h(e)}var s,c,l,f,d,h,m;return c=new n(e),s={then:e,resolve:r,reject:a,progress:u,promise:c,resolver:{resolve:r,reject:a,progress:u}},l=[],f=[],d=function(e,t,r){var n,a;return n=o(),a="function"==typeof r?function(e){try{n.progress(r(e))}catch(t){n.progress(t)}}:function(e){n.progress(e)},l.push(function(r){r.then(e,t).then(n.resolve,n.reject,a)}),f.push(a),n.promise},h=function(e){return p(f,e),e},m=function(e){return e=t(e),d=e.then,m=t,h=v,p(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,r,n,a,i){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,f,d,h,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(r,g)),f=[],l=g-c+1,d=[],h=o(),c)for(y=h.progress,p=function(e){d.push(e),--l||(m=p=v,h.reject(d))},m=function(e){f.push(e),--c||(m=p=v,h.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else h.resolve(f);return h.then(n,a,i)})}function c(e,t,r,n){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,r,n)}function l(e,t,r,n){return y(1,arguments),d(e,g).then(t,r,n)}function f(){return d(arguments,g)}function d(t,r){return e(t,function(t){var n,a,i,u,s,c;if(i=a=t.length>>>0,n=[],c=o(),i)for(u=function(t,a){e(t,r).then(function(e){n[a]=e,--i||c.resolve(n)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(n);return c.promise})}function h(t,r){var n=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,n[0]=function(t,n,i){return e(t,function(t){return e(n,function(e){return r(t,e,i,a)})})},w.apply(t,n)})}function m(t,r,n){var a=arguments.length>2;return e(t,function(e){return e=a?n:e,r.resolve(e),e},function(e){return r.reject(e),i(e)},r.progress)}function p(e,t){for(var r,n=0;r=e[n++];)r(t)}function y(e,t){for(var r,n=t.length;n>e;)if(r=t[--n],null!=r&&"function"!=typeof r)throw new Error("arg "+n+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=r,e.join=f,e.all=l,e.map=d,e.reduce=h,e.any=c,e.some=s,e.chain=m,e.isPromise=u,n.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,r,n,a,i;if(i=0,t=Object(this),a=t.length>>>0,r=arguments,r.length<=1)for(;;){if(i in t){n=t[i++];break}if(++i>=a)throw new TypeError}else n=r[1];for(;a>i;++i)i in t&&(n=e(n,t[i],i,t));return n},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,r){for(var n,a,i=0,o=e.length-1;o>=i;)if(n=~~((i+o)/2),a=r(e[n],t),0>a)i=n+1;else{if(!(a>0))return n;o=n-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,r,n,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=r,this.yPoleOffset=n,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,n=t[r++],a=function(e,t,r,n){r||(r=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(r);return n?e+a:a+e},i=function(e,t,r,n,i,o){var u=n-e.length;return u>0&&(e=r||!i?a(e,n,o,r):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,r,n,o,u,s){var c=e>>>0;return r=r&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(c.toString(t),u||0,"0",!1),i(e,r,n,o,s)},u=function(e,t,r,n,a,o){return null!=n&&(e=e.slice(0,n)),i(e,"",t,r,a,o)},s=function(e,n,s,c,l,f,d){var h,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",O=s.length,M=0;s&&O>M;M++)switch(s.charAt(M)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(M+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[r++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[r++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(d)>-1?6:"d"==d?0:void 0,v=n?t[n.slice(0,-1)]:t[r++],d){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return h=+v||0,h=Math.round(h-h%1),m=0>h?"-":w,v=m+a(String(Math.abs(h)),f,"0",!1),i(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return h=+v,m=0>h?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(d.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(d)%2],v=m+Math.abs(h)[p](f),i(v,m,g,c,x)[y]();default:return e}};return n.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,r,n,a,i,o,u){this.year=e,this.month=t,this.day=r,this.hour=n,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(e,t){return A.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var r=A.leapSeconds,n=t(r,g,l);0>n&&(n=~n),n>=r.length&&(n=r.length-1);var a=r[n].offset;if(n>0){var i=A.secondsDifference(r[n].julianDate,e);i>a&&(n--,a=r[n].offset)}A.addSeconds(e,a,e)}function d(e,r){g.julianDate=e;var n=A.leapSeconds,a=t(n,g,l);if(0>a&&(a=~a),0===a)return A.addSeconds(e,-n[0].offset,r);if(a>=n.length)return A.addSeconds(e,-n[a-1].offset,r);var i=A.secondsDifference(n[a].julianDate,e);return 0===i?A.addSeconds(e,-n[a].offset,r):1>=i?void 0:A.addSeconds(e,-n[--a].offset,r)}function h(e,t,r){var n=0|t/s.SECONDS_PER_DAY;return e+=n,t-=s.SECONDS_PER_DAY*n,0>t&&(e--,t+=s.SECONDS_PER_DAY),r.dayNumber=e,r.secondsOfDay=t,r}function m(e,t,r,n,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+r-32075;n-=12,0>n&&(n+=24);var f=i+(n*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var p=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,O=/^(\d{4})-?(\d{2})-?(\d{2})$/,M=/([Z+\-])?(\d{2})?:?(\d{2})?$/,_=/^(\d{2})(\.\d+)?/.source+M.source,T=/^(\d{2}):?(\d{2})(\.\d+)?/.source+M.source,b=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+M.source,P="Invalid ISO 8601 date.",A=function(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=r(e,0),t=r(t,0),n=r(n,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,h(a,t,this),n===c.UTC&&f(this)};A.fromDate=function(e,t){var r=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return n(t)?(h(r[0],r[1],t),f(t),t):new A(r[0],r[1],c.UTC)},A.fromIso8601=function(e,t){e=e.replace(",",".");var r,i,u,s=e.split("T"),l=1,d=1,p=0,g=0,M=0,N=0,I=s[0],R=s[1];if(!n(I))throw new a(P);var C;if(s=I.match(O),null!==s){if(C=I.split("-").length-1,C>0&&2!==C)throw new a(P);r=+s[1],l=+s[2],d=+s[3]}else if(s=I.match(x),null!==s)r=+s[1],l=+s[2];else if(s=I.match(w),null!==s)r=+s[1];else{var z;if(s=I.match(E),null!==s){if(r=+s[1],z=+s[2],u=o(r),1>z||u&&z>366||!u&&z>365)throw new a(P)}else{if(s=I.match(S),null===s)throw new a(P);r=+s[1];var D=+s[2],L=+s[3]||0;if(C=I.split("-").length-1,C>0&&(!n(s[3])&&1!==C||n(s[3])&&2!==C))throw new a(P);var q=new Date(Date.UTC(r,0,4));z=7*D+L-q.getUTCDay()-3}i=new Date(Date.UTC(r,0,1)),i.setUTCDate(z),l=i.getUTCMonth()+1,d=i.getUTCDate()}if(u=o(r),1>l||l>12||1>d||(2!==l||!u)&&d>y[l-1]||u&&2===l&&d>v)throw new a(P);var U;if(n(R)){if(s=R.match(b),null!==s){if(C=R.split(":").length-1,C>0&&2!==C&&3!==C)throw new a(P);p=+s[1],g=+s[2],M=+s[3],N=1e3*+(s[4]||0),U=5}else if(s=R.match(T),null!==s){if(C=R.split(":").length-1,C>0&&1!==C)throw new a(P);p=+s[1],g=+s[2],M=60*+(s[3]||0),U=4}else{if(s=R.match(_),null===s)throw new a(P);p=+s[1],g=60*+(s[2]||0),U=3}if(g>=60||M>=61||p>24||24===p&&(g>0||M>0||N>0))throw new a(P);var B=s[U],F=+s[U+1],W=+(s[U+2]||0);switch(B){case"+":p-=F,g-=W;break;case"-":p+=F,g+=W;break;case"Z":break;default:g+=new Date(Date.UTC(r,l-1,d,p,g)).getTimezoneOffset()}}else g+=new Date(r,l-1,d).getTimezoneOffset();var G=60===M;for(G&&M--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,d++;for(i=u&&2===l?v:y[l-1];d>i;)d-=i,l++,l>12&&(l-=12,r++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,d--;for(;1>d;)l--,1>l&&(l+=12,r--),i=u&&2===l?v:y[l-1],d+=i;var k=m(r,l,d,p,g,M,N);return n(t)?(h(k[0],k[1],t),f(t)):t=new A(k[0],k[1],c.UTC),G&&A.addSeconds(t,1,t),t},A.now=function(e){return A.fromDate(new Date,e)};var N=new A(0,0,c.TAI);return A.toGregorianDate=function(e,t){var r=!1,a=d(e,N);n(a)||(A.addSeconds(e,-1,N),a=d(N,N),r=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var h=0|80*c/2447,m=0|c-(0|2447*h/80);c=0|h/11;var p=0|h+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),r&&(x+=1),n(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=r,t):new i(y,p,m,v,w,x,E,r)},A.toDate=function(e){var t=A.toGregorianDate(e,p),r=t.second;return t.isLeapSecond&&(r-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,r,t.millisecond))},A.toIso8601=function(t,r){var a,i=A.toGregorianDate(t,i);return n(r)||0===i.millisecond?n(r)&&0!==r?(a=(.01*i.millisecond).toFixed(r).replace(".","").slice(0,r),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},A.clone=function(e,t){return n(e)?n(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new A(e.dayNumber,e.secondsOfDay,c.TAI):void 0},A.compare=function(e,t){var r=e.dayNumber-t.dayNumber;return 0!==r?r:e.secondsOfDay-t.secondsOfDay},A.equals=function(e,t){return e===t||n(e)&&n(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},A.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(A.secondsDifference(e,t))<=r},A.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},A.secondsDifference=function(e,t){var r=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return r+(e.secondsOfDay-t.secondsOfDay)},A.daysDifference=function(e,t){var r=e.dayNumber-t.dayNumber,n=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return r+n},A.computeTaiMinusUtc=function(e){g.julianDate=e;var r=A.leapSeconds,n=t(r,g,l);return 0>n&&(n=~n,--n,0>n&&(n=0)),r[n].offset},A.addSeconds=function(e,t,r){return h(e.dayNumber,e.secondsOfDay+t,r)},A.addMinutes=function(e,t,r){var n=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return h(e.dayNumber,n,r)},A.addHours=function(e,t,r){var n=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return h(e.dayNumber,n,r)},A.addDays=function(e,t,r){var n=e.dayNumber+t;return h(n,e.secondsOfDay,r)},A.lessThan=function(e,t){return A.compare(e,t)<0},A.lessThanOrEquals=function(e,t){return A.compare(e,t)<=0},A.greaterThan=function(e,t){return A.compare(e,t)>0},A.greaterThanOrEquals=function(e,t){return A.compare(e,t)>=0},A.prototype.clone=function(e){return A.clone(this,e)},A.prototype.equals=function(e){return A.equals(this,e)},A.prototype.equalsEpsilon=function(e,t){return A.equalsEpsilon(this,e,t)},A.prototype.toString=function(){return A.toIso8601(this)},A.leapSeconds=[new u(new A(2441317,43210,c.TAI),10),new u(new A(2441499,43211,c.TAI),11),new u(new A(2441683,43212,c.TAI),12),new u(new A(2442048,43213,c.TAI),13),new u(new A(2442413,43214,c.TAI),14),new u(new A(2442778,43215,c.TAI),15),new u(new A(2443144,43216,c.TAI),16),new u(new A(2443509,43217,c.TAI),17),new u(new A(2443874,43218,c.TAI),18),new u(new A(2444239,43219,c.TAI),19),new u(new A(2444786,43220,c.TAI),20),new u(new A(2445151,43221,c.TAI),21),new u(new A(2445516,43222,c.TAI),22),new u(new A(2446247,43223,c.TAI),23),new u(new A(2447161,43224,c.TAI),24),new u(new A(2447892,43225,c.TAI),25),new u(new A(2448257,43226,c.TAI),26),new u(new A(2448804,43227,c.TAI),27),new u(new A(2449169,43228,c.TAI),28),new u(new A(2449534,43229,c.TAI),29),new u(new A(2450083,43230,c.TAI),30),new u(new A(2450630,43231,c.TAI),31),new u(new A(2451179,43232,c.TAI),32),new u(new A(2453736,43233,c.TAI),33),new u(new A(2454832,43234,c.TAI),34),new u(new A(2456109,43235,c.TAI),35),new u(new A(2457204,43236,c.TAI),36)],A}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(r,n){if(null===r||"object"!=typeof r)return r;n=e(n,!1);var a=new r.constructor;for(var i in r)if(r.hasOwnProperty(i)){var o=r[i];n&&(o=t(o,n)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0;n<r.length;++n){var a=r[n],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var r=function(e,r,n){this.statusCode=e,this.response=r,this.responseHeaders=n,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return r.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},r}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,r,n,a,i){"use strict";function o(e,t){var r=decodeURIComponent(t);return e?atob(r):r}function u(e,t){for(var r=o(e,t),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i<r.length;i++)a[i]=r.charCodeAt(i);return n}function s(e,r){r=t(r,"");var a=e[1],i=!!e[2],s=e[3];switch(r){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s);return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new n("Unhandled responseType: "+r)}}var c=function(r){r=t(r,t.EMPTY_OBJECT);var n=r.responseType,a=t(r.method,"GET"),i=r.data,o=r.headers,u=r.overrideMimeType;return e(r.url,function(t){var r=e.defer();return c.load(t,n,a,i,o,r,u),r.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,n,o,u,c,f){var d=l.exec(e);if(null!==d)return c.resolve(s(d,t)),void 0;var h=new XMLHttpRequest;if(r(f)&&r(h.overrideMimeType)&&h.overrideMimeType(f),h.open(n,e,!0),r(u))for(var m in u)u.hasOwnProperty(m)&&h.setRequestHeader(m,u[m]);r(t)&&(h.responseType=t),h.onload=function(){200===h.status?r(h.response)?c.resolve(h.response):r(h.responseXML)&&h.responseXML.hasChildNodes()?c.resolve(h.responseXML):r(h.responseText)?c.resolve(h.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){c.reject(new a)},h.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,r){return e({url:t,headers:r})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,r,n){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(r,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,n(r,i).then(function(e){return JSON.parse(e)})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,r,n,a,i,o,u,s,c,l,f){"use strict";function d(e,t){return o.compare(e.julianDate,t)}function h(e,r){if(!n(r.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!n(r.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=r.columnNames.indexOf("modifiedJulianDateUtc"),i=r.columnNames.indexOf("xPoleWanderRadians"),s=r.columnNames.indexOf("yPoleWanderRadians"),c=r.columnNames.indexOf("ut1MinusUtcSeconds"),h=r.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=r.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=r.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>h||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=r.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=r.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],O=y[x+p],M=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,_=new o(M,O,f.TAI);if(v.push(_),w){if(O!==g&&n(g)){var T=o.leapSeconds,b=t(T,_,d);if(0>b){var P=new u(_,O);T.splice(~b,0,P)}}g=O}}}function m(e,t,r,n,a){var i=r*n;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function p(e,t,r){return t+e*(r-t)}function y(e,t,r,n,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[a],l=t[i];if(c.equals(l)||n.equals(c))return m(e,r,a,s,u),u;if(n.equals(l))return m(e,r,i,s,u),u;var f=o.secondsDifference(n,c)/o.secondsDifference(l,c),d=a*s,h=i*s,y=r[d+e._ut1MinusUtcSecondsColumn],v=r[h+e._ut1MinusUtcSecondsColumn],g=v-y; -if(g>.5||-.5>g){var w=r[d+e._taiMinusUtcSecondsColumn],x=r[h+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(n)?y=v:v-=x-w)}return u.xPoleWander=p(f,r[d+e._xPoleWanderRadiansColumn],r[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(f,r[d+e._yPoleWanderRadiansColumn],r[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(f,r[d+e._xCelestialPoleOffsetRadiansColumn],r[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(f,r[d+e._yCelestialPoleOffsetRadiansColumn],r[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(f,y,v),u}var v=function(t){if(t=r(t,r.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=r(t.addNewLeapSeconds,!0),n(t.data))h(this,t.data);else if(n(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){h(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return n(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,r){if(!n(this._samples)){if(n(this._dataError))throw new c(this._dataError);return void 0}if(n(r)||(r=new a(0,0,0,0,0)),0===this._samples.length)return r.xPoleWander=0,r.yPoleWander=0,r.xPoleOffset=0,r.yPoleOffset=0,r.ut1MinusUtc=0,r;var i=this._dates,u=this._lastIndex,s=0,l=0;if(n(u)){var f=i[u],d=i[u+1],h=o.lessThanOrEquals(f,e),m=!n(d),p=m||o.greaterThanOrEquals(d,e);if(h&&p)return s=u,!m&&d.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,r),r}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,r),r},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var r=n.exec(t);this.scheme=r[1],this.authority=r[2],this.path=r[3],this.query=r[4],this.fragment=r[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function r(e,t,r,n){return(t||"")+r.toLowerCase()+(n||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var n=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,r).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var r=new e;return this.scheme?(r.scheme=this.scheme,r.authority=this.authority,r.path=this.path,r.query=this.query):(r.scheme=t.scheme,this.authority?(r.authority=this.authority,r.path=this.path,r.query=this.query):(r.authority=t.authority,""==this.path?(r.path=t.path,r.query=this.query||t.query):("/"==this.path.charAt(0)?(r.path=this.path,r.removeDotSegments()):(r.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,r.removeDotSegments()),r.query=this.query))),r.fragment=this.fragment,r},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),r=[],n=""==t[0];for(n&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?r.pop():"."!=e&&r.push(e);("."==e||".."==e)&&r.push(""),n&&r.unshift(""),this.path=r.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,r,n){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,r=e.length;r>t;++t){var n=e[t].getAttribute("src"),a=f.exec(n);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var n;if(n="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(n))throw new r("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(n).resolve(new e(document.location.href))}function o(e){return n.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,d=function(e){t(c)||(c=t(n.toUrl)?o:u),t(l)||(l=document.createElement("a"));var r=c(e);return l.href=r,l.href=l.href,l.href};return d._cesiumScriptRegex=f,d.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},d}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,r){this.x=e,this.y=t,this.s=r};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,r,n,a,i,o,u){"use strict";function s(e,t,r){var n=f;return n.dayNumber=t,n.secondsOfDay=r,i.daysDifference(n,e._sampleZeroDateTT)}function c(r,a){if(r._chunkDownloadsInProgress[a])return r._chunkDownloadsInProgress[a];var i=e.defer();r._chunkDownloadsInProgress[a]=i;var u,s=r._xysFileUrlTemplate;return u=n(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){r._chunkDownloadsInProgress[a]=!1;for(var t=r._samples,n=e.samples,o=3*a*r._samplesPerXysFile,u=0,s=n.length;s>u;++u)t[o+u]=n[u];i.resolve()}),i.promise}var l=function(e){e=r(e,r.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=r(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=r(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=r(e.stepSizeDays,1),this._samplesPerXysFile=r(e.samplesPerXysFile,1e3),this._totalSamples=r(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,n=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){n[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(n[s]*=s-c);n[s]=1/n[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new i(0,0,u.TAI);return l.prototype.preload=function(t,r,n,a){var i=s(this,t,r),o=s(this,n,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,d=0|l/this._samplesPerXysFile,h=[],m=f;d>=m;++m)h.push(c(this,m));return e.all(h)},l.prototype.computeXysRadians=function(e,t,r){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var d=!1,h=this._samples;if(n(h[3*l])||(c(this,0|l/this._samplesPerXysFile),d=!0),n(h[3*f])||(c(this,0|f/this._samplesPerXysFile),d=!0),d)return void 0;n(r)?(r.x=0,r.y=0,r.s=0):r=new a(0,0,0);var m,p,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var E=3*(l+m);r.x+=w[m]*h[E++],r.y+=w[m]*h[E++],r.s+=w[m]*h[E]}return r},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,r,n,a,i,o,u){"use strict";var s=function(e,r,n,a){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,n,a){var i=n/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,d=Math.cos(i);return r(a)?(a.x=u,a.y=l,a.z=f,a.w=d,a):new s(u,l,f,d)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var n,a,i,o,c,d=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=d+h+m;if(p>0)n=Math.sqrt(p+1),c=.5*n,n=.5/n,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*n,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*n,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*n;else{var y=l,v=0;h>d&&(v=1),m>d&&m>h&&(v=2);var g=y[v],w=y[g];n=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*n,n=.5/n,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*n,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*n,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*n,a=-x[0],i=-x[1],o=-x[2]}return r(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var d=new s;s.fromHeadingPitchRoll=function(t,r,n,a){var i=s.fromAxisAngle(e.UNIT_X,n,d),o=s.fromAxisAngle(e.UNIT_Y,-r,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,d);return s.multiply(u,a,a)};var h=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,r,n){n=t(n,0),r[n++]=e.x,r[n++]=e.y,r[n++]=e.z,r[n]=e.w},s.unpack=function(e,n,a){return n=t(n,0),r(a)||(a=new s),a.x=e[n],a.y=e[n+1],a.z=e[n+2],a.w=e[n+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,r,n){s.unpack(e,4*r,v),s.conjugate(v,v);for(var a=0,i=r-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,h);var u=s.computeAngle(p);n[o]=h.x*u,n[o+1]=h.y*u,n[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,n,a,i,o){r(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(n,4*i,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var r=1/s.magnitude(e),n=e.x*r,a=e.y*r,i=e.z*r,o=e.w*r;return t.x=n,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var r=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/r,t)},s.add=function(e,t,r){return r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w,r},s.subtract=function(e,t,r){return r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w,r},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,r){var n=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+n*l+a*c-i*s,d=o*s-n*c+a*l+i*u,h=o*c+n*s-a*u+i*l,m=o*l-n*u-a*s-i*c;return r.x=f,r.y=d,r.z=h,r.w=m,r},s.multiplyByScalar=function(e,t,r){return r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t,r},s.divideByScalar=function(e,t,r){return r.x=e.x/t,r.y=e.y/t,r.z=e.z/t,r.w=e.w/t,r},s.computeAxis=function(e,t){var r=e.w;if(Math.abs(r-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var n=1/Math.sqrt(1-r*r);return t.x=e.x*n,t.y=e.y*n,t.z=e.z*n,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,r,n){return g=s.multiplyByScalar(t,r,g),n=s.multiplyByScalar(e,1-r,n),s.add(g,n,n)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,r,n){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,r,n);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-r)*u),x),E=s.multiplyByScalar(i,Math.sin(r*u),E),n=s.add(x,E,n),s.multiplyByScalar(n,1/Math.sin(u),n)},s.log=function(t,r){var n=o.acosClamped(t.w),a=0;return 0!==n&&(a=n/Math.sin(n)),e.multiplyByScalar(t,a,r)},s.exp=function(t,r){var n=e.magnitude(t),a=0;return 0!==n&&(a=Math.sin(n)/n),r.x=t.x*a,r.y=t.y*a,r.z=t.z*a,r.w=Math.cos(n),r};var S=new e,O=new e,M=new s,_=new s;s.computeInnerQuadrangle=function(t,r,n,a){var i=s.conjugate(r,M);s.multiply(i,n,_);var o=s.log(_,S);s.multiply(i,t,_);var u=s.log(_,O);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,M),s.multiply(r,M,a)},s.squad=function(e,t,r,n,a,i){var o=s.slerp(e,t,a,M),u=s.slerp(r,n,a,_);return s.slerp(o,u,2*a*(1-a),i)};for(var T=new s,b=1.9011074535173003,P=a.supportsTypedArrays()?new Float32Array(8):[],A=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],I=a.supportsTypedArrays()?new Float32Array(8):[],R=0;7>R;++R){var C=R+1,z=2*C+1;P[R]=1/(C*z),A[R]=C/z}return P[7]=b/136,A[7]=8*b/17,s.fastSlerp=function(e,t,r,n){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-r,c=r*r,l=u*u,f=7;f>=0;--f)N[f]=(P[f]*c-A[f])*o,I[f]=(P[f]*l-A[f])*o;var d=a*r*(1+N[0]*(1+N[1]*(1+N[2]*(1+N[3]*(1+N[4]*(1+N[5]*(1+N[6]*(1+N[7])))))))),h=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=s.multiplyByScalar(e,h,T);return s.multiplyByScalar(t,d,n),s.add(m,n,n)},s.fastSquad=function(e,t,r,n,a,i){var o=s.fastSlerp(e,t,a,M),u=s.fastSlerp(r,n,a,_);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m,p,y,v){"use strict";var g={},w=new r,x=new r,E=new r;g.eastNorthUpToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=0,n[1]=1,n[2]=0,n[3]=0,n[4]=-o,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=o,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=s.x,n[1]=s.y,n[2]=s.z,n[3]=0,n[4]=l.x,n[5]=l.y,n[6]=l.z,n[7]=0,n[8]=u.x,n[9]=u.y,n[10]=u.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new r,O=new r,M=new r;g.northEastDownToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=-o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-o,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=O,l=M;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=l.x,n[1]=l.y,n[2]=l.z,n[3]=0,n[4]=s.x,n[5]=s.y,n[6]=s.z,n[7]=0,n[8]=-u.x,n[9]=-u.y,n[10]=-u.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,n){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(n)?(n[0]=-o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=o,n[7]=0,n[8]=0,n[9]=1,n[10]=0,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,r.normalize(s,s),r.cross(u,s,l),i(n)?(n[0]=l.x,n[1]=l.y,n[2]=l.z,n[3]=0,n[4]=u.x,n[5]=u.y,n[6]=u.z,n[7]=0,n[8]=s.x,n[9]=s.y,n[10]=s.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,n):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var _=new y,T=new r(1,1,1),b=new p;g.headingPitchRollToFixedFrame=function(e,t,n,a,i,o){var u=y.fromHeadingPitchRoll(t,n,a,_),s=p.fromTranslationQuaternionRotationScale(r.ZERO,u,T,b);return o=g.eastNorthUpToFixedFrame(e,i,o),p.multiply(o,s,o)};var P=new p,A=new m;g.headingPitchRollQuaternion=function(e,t,r,n,a,i){var o=g.headingPitchRollToFixedFrame(e,t,r,n,a,P),u=p.getRotation(o,A);return y.fromRotationMatrix(u,i)};var N=24110.54841,I=8640184.812866,R=.093104,C=-62e-7,z=1.1772758384668e-19,D=72921158553e-15,L=h.TWO_PI/86400,q=new d;g.computeTemeToPseudoFixedMatrix=function(e,t){q=d.addSeconds(e,-d.computeTaiMinusUtc(e),q);var r,n=q.dayNumber,a=q.secondsOfDay,o=n-2451545;r=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=N+r*(I+r*(R+r*C)),s=u*L%h.TWO_PI,c=D+z*(n-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,p=Math.cos(f),y=Math.sin(f);return i(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var U=32.184,B=2451545;g.preloadIcrfFixed=function(t){var r=t.start.dayNumber,n=t.start.secondsOfDay+U,a=t.stop.dayNumber,i=t.stop.secondsOfDay+U,o=g.iau2006XysData.preload(r,n,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new m);var r=g.computeFixedToIcrfMatrix(e,t);return i(r)?m.transpose(r,t):void 0};var F=new f(0,0,0),W=new s(0,0,0,0,0,0),G=new m,k=new m;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new m);var r=g.earthOrientationParameters.compute(e,W);if(!i(r))return void 0;var n=e.dayNumber,a=e.secondsOfDay+U,o=g.iau2006XysData.computeXysRadians(n,a,F);if(!i(o))return void 0;var u=o.x+r.xPoleOffset,s=o.y+r.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=m.fromRotationZ(-o.s,k),p=m.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-d.computeTaiMinusUtc(e)+r.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*h.TWO_PI;var O=m.fromRotationZ(S,k),M=m.multiply(p,O,G),_=Math.cos(r.xPoleWander),T=Math.cos(r.yPoleWander),b=Math.sin(r.xPoleWander),P=Math.sin(r.yPoleWander),A=n-B+a/v.SECONDS_PER_DAY;A/=36525;var N=-47e-6*A*h.RADIANS_PER_DEGREE/3600,I=Math.cos(N),R=Math.sin(N),C=k;return C[0]=_*I,C[1]=_*R,C[2]=b,C[3]=-T*R+P*b*I,C[4]=T*I+P*b*R,C[5]=-P*_,C[6]=-P*R-T*b*I,C[7]=P*I-T*b*R,C[8]=T*_,m.multiply(M,C,t)};var V=new n;g.pointToWindowCoordinates=function(e,t,r,n){return n=g.pointToGLWindowCoordinates(e,t,r,n),n.y=2*t[5]-n.y,n},g.pointToGLWindowCoordinates=function(e,r,a,o){i(o)||(o=new t);var u=V;return p.multiplyByVector(e,n.fromElements(a.x,a.y,a.z,1,u),u),n.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(r,u,u),t.fromCartesian4(u,o)};var Y=new r,j=new r,H=new r;return g.rotationMatrixFromPositionVelocity=function(e,t,n,o){var u=a(n,c.WGS84).geodeticSurfaceNormal(e,Y),s=r.cross(t,u,j);r.equalsEpsilon(s,r.ZERO,h.EPSILON6)&&(s=r.clone(r.UNIT_X,s));var l=r.cross(s,t,H);return r.cross(t,l,s),r.negate(s,s),i(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m){"use strict";var p=new n,y=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var n=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=r.fromCartesian4(f.getColumn(n,0,p)),this._yAxis=r.fromCartesian4(f.getColumn(n,1,p));var i=r.fromCartesian4(f.getColumn(n,2,p));this._plane=d.fromPointNormal(e,i)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,r){var n=e.fromPoints(t,v);return new y(n.center,r)};var g=new h,w=new r;y.prototype.projectPointOntoPlane=function(e,n){var a=g;a.origin=e,r.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,w);if(i(o)||(r.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w)),i(o)){var u=r.subtract(o,this._origin,o),s=r.dot(this._xAxis,u),l=r.dot(this._yAxis,u);return i(n)?(n.x=s,n.y=l,n):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var r=0,n=e.length,a=0;n>a;a++){var o=this.projectPointOntoPlane(e[a],t[r]);i(o)&&(t[r]=o,r++)}return t.length=r,t},y.prototype.projectPointToNearestOnPlane=function(e,n){i(n)||(n=new t);var a=g;a.origin=e,r.clone(this._plane.normal,a.direction);var o=c.rayPlane(a,this._plane,w);i(o)||(r.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w));var u=r.subtract(o,this._origin,o),s=r.dot(this._xAxis,u),l=r.dot(this._yAxis,u);return n.x=s,n.y=l,n},y.prototype.projectPointsToNearestOnPlane=function(e,t){i(t)||(t=[]);var r=e.length;t.length=r;for(var n=0;r>n;n++)t[n]=this.projectPointToNearestOnPlane(e[n],t[n]);return t};var x=new r;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var n=e.length;i(t)?t.length=n:t=new Array(n);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;n>l;++l){var f=e[l];r.multiplyByScalar(u,f.x,c),i(t[l])||(t[l]=new r);var d=r.add(o,c,t[l]);r.multiplyByScalar(s,f.y,c),r.add(d,c,d),a.scaleToGeocentricSurface(d,d)}return t},y}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var r=new t,n=function(t,n,a,i){return e(t,n,a,i,r),r.x>0&&r.y>0&&r.z>0};return n}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,r,n,a,i,o,u){"use strict";function s(e){var t=e._uSquared,r=e._ellipsoid.maximumRadius,n=e._ellipsoid.minimumRadius,a=(r-n)/r,i=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-a)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,i),f=s*o,d=f*f,h=1-d,m=Math.sqrt(h),p=t/4,y=p*p,v=y*p,g=y*y,w=1+p-3*y/4+5*v/4-175*g/64,x=1-p+15*y/8-35*v/8,E=1-3*p+35*y/4,S=1-5*p,O=w*l-x*Math.sin(2*l)*p/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,M=e._constants;M.a=r,M.b=n,M.f=a,M.cosineHeading=i,M.sineHeading=o,M.tanU=u,M.cosineU=s,M.sineU=c,M.sigma=l,M.sineAlpha=f,M.sineSquaredAlpha=d,M.cosineSquaredAlpha=h,M.cosineAlpha=m,M.u2Over4=p,M.u4Over16=y,M.u6Over64=v,M.u8Over256=g,M.a0=w,M.a1=x,M.a2=E,M.a3=S,M.distanceRatio=O}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,r,n,a,i,o){var u=c(e,r);return(1-u)*e*t*(n+u*a*(o+u*i*(2*o*o-1)))}function f(e,t,r,n,a,i,o){var s,c,f,d,h,m=(t-r)/t,p=i-n,y=Math.atan((1-m)*Math.tan(a)),v=Math.atan((1-m)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,O=g*E,M=w*E,_=w*x,T=p,b=u.TWO_PI,P=Math.cos(T),A=Math.sin(T);do{P=Math.cos(T),A=Math.sin(T);var N=O-_*P;f=Math.sqrt(x*x*A*A+N*N),c=M+S*P,s=Math.atan2(f,c);var I;0===f?(I=0,d=1):(I=S*A/f,d=1-I*I),b=T,h=c-2*M/d,isNaN(h)&&(h=0),T=p+l(m,I,d,s,f,c,h)}while(Math.abs(T-b)>u.EPSILON12);var R=d*(t*t-r*r)/(r*r),C=1+R*(4096+R*(R*(320-175*R)-768))/16384,z=R*(256+R*(R*(74-47*R)-128))/1024,D=h*h,L=z*f*(h+z*(c*(2*D-1)-z*h*(4*f*f-3)*(4*D-3)/6)/4),q=r*C*(s-L),U=Math.atan2(x*A,O-_*P),B=Math.atan2(g*A,O*P-_);e._distance=q,e._startHeading=U,e._endHeading=B,e._uSquared=R}function d(r,n,a,i){e.normalize(i.cartographicToCartesian(n,m),h),e.normalize(i.cartographicToCartesian(a,m),m),f(r,i.maximumRadius,i.minimumRadius,n.longitude,n.latitude,a.longitude,a.latitude),r._start=t.clone(n,r._start),r._end=t.clone(a,r._end),r._start.height=0,r._end.height=0,s(r)}var h=new e,m=new e,p=function(e,a,i){var u=r(i,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,n(e)&&n(a)&&d(this,e,a,u)};return a(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(e,t){d(this,e,t,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},p.prototype.interpolateUsingSurfaceDistance=function(e,r){var a=this._constants,i=a.distanceRatio+e/a.b,o=Math.cos(2*i),u=Math.cos(4*i),s=Math.cos(6*i),c=Math.sin(2*i),f=Math.sin(4*i),d=Math.sin(6*i),h=Math.sin(8*i),m=i*i,p=i*m,y=a.u8Over256,v=a.u2Over4,g=a.u6Over64,w=a.u4Over16,x=2*p*y*o/3+i*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*f-m*((g-11*y/2)*c+5*y*f/2)+(29*g/96-29*y/16)*d+539*y*h/1536,E=Math.asin(Math.sin(x)*a.cosineAlpha),S=Math.atan(a.a/a.b*Math.tan(E));x-=a.sigma;var O=Math.cos(2*a.sigma+x),M=Math.sin(x),_=Math.cos(x),T=a.cosineU*_,b=a.sineU*M,P=Math.atan2(M*a.sineHeading,T-b*a.cosineHeading),A=P-l(a.f,a.sineAlpha,a.cosineSquaredAlpha,x,M,_,O);return n(r)?(r.longitude=this._start.longitude+A,r.latitude=S,r.height=0,r):new t(this._start.longitude+A,S,0)},p}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,r,n,a,i,o,u,s,c,l,f){"use strict";function d(e,t,r){var n=M;n.length=e;var a;if(t===r){for(a=0;e>a;a++)n[a]=t;return n}var i=r-t,o=i/e;for(a=0;e>a;a++){var u=t+a*o;n[a]=u}return n}function h(t,r,n,a,i,o,u,s){var c=a.scaleToGeodeticSurface(t,P),l=a.scaleToGeodeticSurface(r,A),f=m.numberOfPoints(t,r,n),h=a.cartesianToCartographic(c,_),p=a.cartesianToCartographic(l,T),y=d(f,i,o);N.setEndPoints(h,p);var v=N.surfaceDistance/f,g=s;h.height=i;var w=a.cartographicToCartesian(h,b);e.pack(w,u,g),g+=3;for(var x=1;f>x;x++){var E=N.interpolateUsingSurfaceDistance(x*v,T);E.height=y[x],w=a.cartographicToCartesian(E,b),e.pack(w,u,g),g+=3}return g}var m={};m.numberOfPoints=function(t,r,n){var a=e.distance(t,r);return Math.ceil(a/n)};var p=new t;m.extractHeights=function(e,t){for(var r=e.length,n=new Array(r),a=0;r>a;a++){var i=e[a];n[a]=t.cartesianToCartographic(i,p).height}return n};var y=new l,v=new e,g=new e,w=new f(e.ZERO,0),x=new e,E=new f(e.ZERO,0),S=new e,O=new e,M=[],_=new t,T=new t,b=new e,P=new e,A=new e,N=new o;m.wrapLongitude=function(t,a){var i=[],o=[];if(n(t)&&t.length>0){a=r(a,l.IDENTITY);var s=l.inverseTransformation(a,y),c=l.multiplyByPoint(s,e.ZERO,v),d=l.multiplyByPointAsVector(s,e.UNIT_Y,g),h=f.fromPointNormal(c,d,w),m=l.multiplyByPointAsVector(s,e.UNIT_X,x),p=f.fromPointNormal(c,m,E),M=1;i.push(e.clone(t[0]));for(var _=i[0],T=t.length,b=1;T>b;++b){var P=t[b];if(f.getPointDistance(p,_)<0||f.getPointDistance(p,P)<0){var A=u.lineSegmentPlane(_,P,h,S);if(n(A)){var N=e.multiplyByScalar(d,5e-9,O);f.getPointDistance(h,_)<0&&e.negate(N,N),i.push(e.add(A,N,new e)),o.push(M+1),e.negate(N,N),i.push(e.add(A,N,new e)),M=1}}i.push(e.clone(t[b])),M++,_=P}o.push(M)}return{positions:i,lengths:o}};var I=c.EPSILON7;return m.removeDuplicates=function(t){var r=t.length;if(2>r)return t;var n,a,i;for(n=1;r>n&&(a=t[n-1],i=t[n],!e.equalsEpsilon(a,i,I));++n);if(n===r)return t;for(var o=t.slice(0,n);r>n;++n)i=t[n],e.equalsEpsilon(a,i,I)||(o.push(e.clone(i)),a=i);return o},m.generateArc=function(t){n(t)||(t={});var a=t.positions,o=a.length,u=r(t.ellipsoid,i.WGS84),l=r(t.height,0);if(1>o)return[];if(1===o){var f=u.scaleToGeodeticSurface(a[0],P);if(0!==l){var d=u.geodeticSurfaceNormal(f,b);e.multiplyByScalar(d,l,d),e.add(f,d,f)}return[f.x,f.y,f.z]}var p=t.minDistance;if(!n(p)){var y=r(t.granularity,c.RADIANS_PER_DEGREE);p=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=m.numberOfPoints(a[v],a[v+1],p);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var O=a[v],T=a[v+1],A=S?l[v]:l,N=S?l[v+1]:l;E=h(O,T,p,u,A,N,x,E)}M.length=0;var I=a[o-1],R=u.cartesianToCartographic(I,_);R.height=S?l[o-1]:l;var C=u.cartographicToCartesian(R,b);return e.pack(C,x,w-3),x},m.generateCartesianArc=function(t){for(var r=m.generateArc(t),n=r.length/3,a=new Array(n),i=0;n>i;i++)a[i]=e.unpack(r,3*i);return a},m}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,r=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,r},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m,p){"use strict";function y(t,r,n){var a=e.subtract(r,t,L),i=e.subtract(n,r,q);return a.x*i.y-a.y*i.x>=0}function v(e){for(var t=e[0].x,r=0,n=0;n<e.length;n++)e[n].x>t&&(t=e[n].x,r=n);return r}function g(e){for(var t=e[0][0].x,r=0,n=0;n<e.length;n++){var a=e[n][v(e[n])].x;a>t&&(t=a,r=n)}return r}function w(e){for(var t=[],r=0;r<e.length;r++){var n=e[(r-1+e.length)%e.length],a=e[r],i=e[(r+1)%e.length];y(n,a,i)||t.push(a)}return t}function x(t,r){for(var n=0;n<t.length;n++)if(e.equals(r,t[n]))return n;return-1}function E(r,a,i){i=n(i,[]);var o=Number.MAX_VALUE,u=v(a),s=new e(a[u].x,r.y);i.push(u),i.push((u+1)%a.length);for(var c=a[0].x,l=c,f=1;f<a.length;++f)a[f].x<c?c=a[f].x:a[f].x>l&&(l=a[f].x);l+=l-c;var d=new t(l,r.y,0);for(f=0;f<a.length;f++){var h=a[f],m=a[(f+1)%a.length]; -if((h.x>=r.x||m.x>=r.x)&&(h.y>=r.y&&m.y<=r.y||h.y<=r.y&&m.y>=r.y)){var p=(m.y-h.y)*(d.x-r.x)-(m.x-h.x)*(d.y-r.y);if(0!==p){p=1/p;var y=((m.x-h.x)*(r.y-h.y)-(m.y-h.y)*(r.x-h.x))*p,g=((d.x-r.x)*(r.y-h.y)-(d.y-r.y)*(r.x-h.x))*p;if(y>=0&&1>=y&&g>=0&&1>=g){var w=new e(r.x+y*(d.x-r.x),r.y+y*(d.y-r.y)),x=e.subtract(w,r,U);p=e.magnitudeSquared(x),o>p&&(s=w,o=p,i[0]=f,i[1]=(f+1)%a.length)}}}}return s}function S(t,r){var n=g(r),a=r[n],i=v(a),o=a[i],u=[],s=E(o,t,u),c=x(t,s);if(-1!==c)return c;var d=e.magnitudeSquared(e.subtract(t[u[0]],o,B)),h=e.magnitudeSquared(e.subtract(t[u[1]],o,B)),m=h>d?t[u[0]]:t[u[1]],p=w(t),y=p.indexOf(m);-1!==y&&p.splice(y,1);for(var S=[],O=0;O<p.length;O++){var M=p[O];f(M,o,s,m)&&S.push(M)}var _=Number.MAX_VALUE;if(S.length>0){var T=e.fromElements(1,0,B);for(O=0;O<S.length;O++){var b=e.subtract(S[O],o,F),P=e.magnitude(T)*e.magnitudeSquared(b);if(0!==P){var A=Math.abs(l.acosClamped(e.dot(T,b)/P));_>A&&(_=A,m=S[O])}}}return t.indexOf(m)}function O(e,r,n){for(var a=et.computeWindingOrder2D(e),i=0;i<r.length;i++){var o=r[i];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=et.computeWindingOrder2D(o);s===a&&o.reverse()}var c=u.fromPoints(e,n),l=c.projectPointsOntoPlane(e),f=[];for(i=0;i<r.length;i++)f.push(c.projectPointsOntoPlane(r[i]));var d=S(l,f),h=g(f),m=v(f[h]),p=r[h],y=[];for(i=0;i<e.length;i++)y.push(e[i]);var w,x=[];if(0!==m)for(w=0;w<=p.length;w++){var E=(w+m)%p.length;0!==E&&x.push(p[E])}else for(w=0;w<p.length;w++)x.push(p[(w+m)%p.length]);var O=y.lastIndexOf(e[d]);x.push(e[O]);var M=y.slice(0,O+1),_=y.slice(O+1);return y=M.concat(x,_),r.splice(h,1),y}function M(e){var t=l.nextRandomNumber(),r=Math.floor(t*e);return r===e&&r--,r}function _(e,t,r,n){var a=n[e].position,i=n[t].position,o=n[r].position,u=o.x,s=o.y,c=a.x-u,l=a.y-s,f=i.x-u,d=i.y-s;return c*d-l*f}function T(e,t){return e.x*t.y-e.y*t.x}function b(e,t){var r=t.length,n=l.mod(e-1,r),a=l.mod(e+1,r);return 0===_(n,a,e,t)?!1:!0}function P(t,r){return e.magnitudeSquared(r)<e.magnitudeSquared(t)}function A(t,r,n){if(!b(t,n))return t;var a=n[t].position,i=n[r].position,o=n.length,u=l.mod(t-1,o);if(!b(u,n))return u;var s=l.mod(t+1,o);if(!b(s,n))return s;var c=e.subtract(n[u].position,a,k),f=e.subtract(n[s].position,a,V),d=e.subtract(i,a,Y),h=T(c,d),m=T(f,d);if(0===h)return P(c,d)?W:G;if(0===m)return P(f,d)?W:G;var p=T(c,f);return 0>p?0>h&&m>0?W:G:p>0?h>0&&0>m?G:W:void 0}function N(e,t,r){return(e>t||e>r)&&(t>e||r>e)||t===r&&t===e}function I(t,r,n,a){var i=e.subtract(n,t,H),o=r.x*a.y-r.y*a.x,u=o*o,s=e.magnitudeSquared(r),c=e.magnitudeSquared(a);if(u>j*s*c){var l=(i.x*a.y-i.y*a.x)/o;return e.add(t,e.multiplyByScalar(r,l,H),H)}return void 0}function R(t,r,n){for(var i=e.subtract(r,t,Z),o=n.length,u=0;o>u;u++){var s=n[u].position,c=n[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(r,c)||e.equals(t,c)||e.equals(r,s))){var f=e.subtract(c,s,X),d=I(t,i,s,f);if(a(d)&&!(e.equals(d,t)||e.equals(d,r)||e.equals(d,s)||e.equals(d,c))){var h=d.x,m=d.y,p=N(h,t.x,r.x)&&N(m,t.y,r.y)&&N(h,s.x,c.x)&&N(m,s.y,c.y);if(p)return!0}}}return!1}function C(t,r,n){var a=A(t,r,n);if(a>=0)return a;var i=A(r,t,n);return i>=0?i:a!==W||i!==W||R(n[t].position,n[r].position,n)||e.equals(n[t].position,n[r].position)?K:J}function z(e){return 0===_(1,2,0,e)}function D(e){var t=e.length;if(3===t)return z(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new i("Invalid polygon: must have at least three vertices.");for(var r,n,a=0,o=10*e.length,u=K;J>u&&a++<o;){for(r=M(e.length),n=r+1;Math.abs(r-n)<2||Math.abs(r-n)>e.length-2;)n=M(e.length);if(r>n){var s=r;r=n,n=s}u=C(r,n,e)}if(u===J){var c=e.splice(r,n-r+1,e[r],e[n]);return D(e).concat(D(c))}return u>=0?(e.splice(u,1),D(e)):[]}var L=new e,q=new e,U=new e,B=new e(1,0),F=new e,W=-1,G=-2,k=new t,V=new t,Y=new t,j=l.EPSILON14,H=new e;new e;var Z=new e,X=new e,J=-1,K=-2,Q=new t,$=new t,et={};et.removeDuplicates=function(e){var r=d.removeDuplicates(e);return t.equals(r[0],r[r.length-1])?r.slice(1):r},et.computeArea2D=function(e){for(var t=e.length,r=0,n=t-1,a=0;t>a;n=a++){var i=e[n],o=e[a];r+=i.x*o.y-o.x*i.y}return.5*r},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?p.COUNTER_CLOCKWISE:p.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,r=[],n=0;t>n;++n)r[n]={position:e[n],index:n};return D(r)};var tt=new t,rt=new t,nt=new t,at=new t,it=new t,ot=new t,ut=new t;return et.computeSubdivision=function(e,i,o,u){u=n(u,l.RADIANS_PER_DEGREE);var f,d=o.slice(0),m=i.length,p=new Array(3*m),y=0;for(f=0;m>f;f++){var v=i[f];p[y++]=v.x,p[y++]=v.y,p[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;d.length>0;){var O,M,_=d.pop(),T=d.pop(),b=d.pop(),P=t.fromArray(p,3*b,tt),A=t.fromArray(p,3*T,rt),N=t.fromArray(p,3*_,nt),I=t.multiplyByScalar(t.normalize(P,at),x,at),R=t.multiplyByScalar(t.normalize(A,it),x,it),C=t.multiplyByScalar(t.normalize(N,ot),x,ot),z=t.magnitudeSquared(t.subtract(I,R,ut)),D=t.magnitudeSquared(t.subtract(R,C,ut)),L=t.magnitudeSquared(t.subtract(C,I,ut)),q=Math.max(z,D,L);q>S?z===q?(O=Math.min(b,T)+" "+Math.max(b,T),f=w[O],a(f)||(M=t.add(P,A,ut),t.multiplyByScalar(M,.5,M),p.push(M.x,M.y,M.z),f=p.length/3-1,w[O]=f),d.push(b,f,_),d.push(f,T,_)):D===q?(O=Math.min(T,_)+" "+Math.max(T,_),f=w[O],a(f)||(M=t.add(A,N,ut),t.multiplyByScalar(M,.5,M),p.push(M.x,M.y,M.z),f=p.length/3-1,w[O]=f),d.push(T,f,b),d.push(f,_,b)):L===q&&(O=Math.min(_,b)+" "+Math.max(_,b),f=w[O],a(f)||(M=t.add(N,P,ut),t.multiplyByScalar(M,.5,M),p.push(M.x,M.y,M.z),f=p.length/3-1,w[O]=f),d.push(_,f,T),d.push(f,b,T)):(g.push(b),g.push(T),g.push(_))}return new s({attributes:{position:new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:p})},indices:g,primitiveType:h.TRIANGLES})},et.scaleToGeodeticHeight=function(e,r,i,u){i=n(i,o.WGS84);var s=Q,c=$;if(r=n(r,0),u=n(u,!0),a(e)&&a(e.attributes)&&a(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,d=0;f>d;d+=3)t.fromArray(l,d,c),u&&(c=i.scaleToGeodeticSurface(c,c)),s=i.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,r,s),t.add(c,s,c),l[d]=c.x,l[d+1]=c.y,l[d+2]=c.z;return e},et.eliminateHoles=function(e,r,a){a=n(a,o.WGS84);for(var i=[],u=0;u<r.length;u++){for(var s=[],c=0;c<r[u].length;c++)s.push(t.clone(r[u][c]));i.push(s)}for(var l=e;i.length>0;)l=O(l,i,a);return l},et}),define("Core/RectangleGeometryLibrary",["./Cartesian3","./Cartographic","./defined","./DeveloperError","./GeographicProjection","./Math","./Matrix2","./Rectangle"],function(e,t,r,n,a,i,o,u){"use strict";var s=Math.cos,c=Math.sin,l=Math.sqrt,f={};f.computePosition=function(e,t,n,a,i){var u=e.ellipsoid.radiiSquared,f=e.nwCorner,d=e.rectangle,h=f.latitude-e.granYCos*t+n*e.granXSin,m=s(h),p=c(h),y=u.z*p,v=f.longitude+t*e.granYSin+n*e.granXCos,g=m*s(v),w=m*c(v),x=u.x*g,E=u.y*w,S=l(x*g+E*w+y*p);a.x=x/S,a.y=E/S,a.z=y/S,r(e.vertexFormat)&&e.vertexFormat.st&&(i.x=(v-d.west)*e.lonScalar-.5,i.y=(h-d.south)*e.latScalar-.5,o.multiplyByVector(e.textureMatrix,i,i),i.x+=.5,i.y+=.5)};var d=new o,h=new e,m=new t,p=new e,y=new a;return f.computeOptions=function(t,a,s){var c,l,f,v,g,w=t._granularity,x=t._ellipsoid,E=t._surfaceHeight,S=t._rotation,O=t._extrudedHeight,M=a.east,_=a.west,T=a.north,b=a.south,P=T-b;_>M?(g=i.TWO_PI-_+M,c=Math.ceil(g/w)+1,l=Math.ceil(P/w)+1,f=g/(c-1),v=P/(l-1)):(g=M-_,c=Math.ceil(g/w)+1,l=Math.ceil(P/w)+1,f=g/(c-1),v=P/(l-1)),s=u.northwest(a,s);var A=u.center(a,m),N=v,I=f,R=0,C=0;if(r(S)){var z=Math.cos(S);N*=z,I*=z;var D=Math.sin(S);R=v*D,C=f*D,h=y.project(s,h),p=y.project(A,p),h=e.subtract(h,p,h);var L=o.fromRotation(S,d);h=o.multiplyByVector(L,h,h),h=e.add(h,p,h),s=y.unproject(h,s);var q=s.latitude,U=q+(c-1)*C,B=q-N*(l-1),F=q-N*(l-1)+(c-1)*C;T=Math.max(q,U,B,F),b=Math.min(q,U,B,F);var W=s.longitude,G=W+(c-1)*I,k=W+(l-1)*R,V=W+(l-1)*R+(c-1)*I;if(M=Math.max(W,G,k,V),_=Math.min(W,G,k,V),T<-i.PI_OVER_TWO||T>i.PI_OVER_TWO||b<-i.PI_OVER_TWO||b>i.PI_OVER_TWO)throw new n("Rotated extent is invalid.");a.north=T,a.south=b,a.east=M,a.west=_}return{granYCos:N,granYSin:R,granXCos:I,granXSin:C,ellipsoid:x,width:c,height:l,surfaceHeight:E,extrudedHeight:O,nwCorner:s,rectangle:a}},f}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return a.POSITION_ONLY=n(new a({position:!0})),a.POSITION_AND_NORMAL=n(new a({position:!0,normal:!0})),a.POSITION_NORMAL_AND_ST=n(new a({position:!0,normal:!0,st:!0})),a.POSITION_AND_ST=n(new a({position:!0,st:!0})),a.POSITION_AND_COLOR=n(new a({position:!0,color:!0})),a.ALL=n(new a({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),a.DEFAULT=a.POSITION_NORMAL_AND_ST,a.packedLength=6,a.pack=function(t,r,n){n=e(n,0),r[n++]=t.position?1:0,r[n++]=t.normal?1:0,r[n++]=t.st?1:0,r[n++]=t.binormal?1:0,r[n++]=t.tangent?1:0,r[n++]=t.color?1:0},a.unpack=function(r,n,i){return n=e(n,0),t(i)||(i=new a),i.position=1===r[n++],i.normal=1===r[n++],i.st=1===r[n++],i.binormal=1===r[n++],i.tangent=1===r[n++],i.color=1===r[n++],i},a.clone=function(e,r){return t(e)?(t(r)||(r=new a),r.position=e.position,r.normal=e.normal,r.st=e.st,r.binormal=e.binormal,r.tangent=e.tangent,r.color=e.color,r):void 0},a}),define("Core/RectangleGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix2","./Matrix3","./PolygonPipeline","./PrimitiveType","./Quaternion","./Rectangle","./RectangleGeometryLibrary","./VertexFormat"],function(e,t,r,n,a,i,o,u,s,c,l,f,d,h,m,p,y,v,g,w,x,E,S,O){"use strict";function M(e,t){var r=new c({attributes:new f,primitiveType:w.TRIANGLES});return r.attributes.position=new l({componentDatatype:a.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(r.attributes.normal=new l({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(r.attributes.tangent=new l({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.binormal&&(r.attributes.binormal=new l({componentDatatype:a.FLOAT,componentsPerAttribute:3,values:t.binormals})),r}function _(e,t,n,a){for(var i=e.length,o=t.normal?new Float32Array(i):void 0,u=t.tangent?new Float32Array(i):void 0,s=t.binormal?new Float32Array(i):void 0,c=0,l=z,f=C,d=R,h=0;i>h;h+=3){var m=r.fromArray(e,h,I),p=c+1,y=c+2;(t.normal||t.tangent||t.binormal)&&(d=n.geodeticSurfaceNormal(m,d),(t.tangent||t.binormal)&&(r.cross(r.UNIT_Z,d,f),v.multiplyByVector(a,f,f),r.normalize(f,f),t.binormal&&r.normalize(r.cross(d,f,l),l)),t.normal&&(o[c]=d.x,o[p]=d.y,o[y]=d.z),t.tangent&&(u[c]=f.x,u[p]=f.y,u[y]=f.z),t.binormal&&(s[c]=l.x,s[p]=l.y,s[y]=l.z)),c+=3}return M(t,{positions:e,normals:o,tangents:u,binormals:s})}function T(e,t,n){for(var a=e.length,i=t.normal?new Float32Array(a):void 0,o=t.tangent?new Float32Array(a):void 0,u=t.binormal?new Float32Array(a):void 0,s=0,c=0,l=0,f=!0,d=z,h=C,m=R,y=0;a>y;y+=6){var v=r.fromArray(e,y,I);if(t.normal||t.tangent||t.binormal){var g=r.fromArray(e,(y+6)%a,B);if(f){var w=r.fromArray(e,(y+3)%a,F);r.subtract(g,v,g),r.subtract(w,v,w),m=r.normalize(r.cross(w,g,m),m),f=!1}r.equalsEpsilon(g,v,p.EPSILON10)&&(f=!0),(t.tangent||t.binormal)&&(d=n.geodeticSurfaceNormal(v,d),t.tangent&&(h=r.normalize(r.cross(d,m,h),h))),t.normal&&(i[s++]=m.x,i[s++]=m.y,i[s++]=m.z,i[s++]=m.x,i[s++]=m.y,i[s++]=m.z),t.tangent&&(o[c++]=h.x,o[c++]=h.y,o[c++]=h.z,o[c++]=h.x,o[c++]=h.y,o[c++]=h.z),t.binormal&&(u[l++]=d.x,u[l++]=d.y,u[l++]=d.z,u[l++]=d.x,u[l++]=d.y,u[l++]=d.z)}}return M(t,{positions:e,normals:i,tangents:o,binormals:u})}function b(e){for(var t=e.vertexFormat,r=e.ellipsoid,n=e.size,i=e.height,o=e.width,u=t.position?new Float64Array(3*n):void 0,s=t.st?new Float32Array(2*n):void 0,c=0,f=0,d=I,h=L,p=Number.MAX_VALUE,y=Number.MAX_VALUE,v=Number.MIN_VALUE,g=Number.MIN_VALUE,w=0;i>w;++w)for(var x=0;o>x;++x)S.computePosition(e,w,x,d,h),u[c++]=d.x,u[c++]=d.y,u[c++]=d.z,t.st&&(s[f++]=h.x,s[f++]=h.y,p=Math.min(p,h.x),y=Math.min(y,h.y),v=Math.max(v,h.x),g=Math.max(g,h.y));if(t.st&&(0>p||0>y||v>1||g>1))for(var E=0;E<s.length;E+=2)s[E]=(s[E]-p)/(v-p),s[E+1]=(s[E+1]-y)/(g-y);for(var O=_(u,t,r,e.tangentRotationMatrix),M=6*(o-1)*(i-1),T=m.createTypedArray(n,M),b=0,P=0,A=0;i-1>A;++A){for(var N=0;o-1>N;++N){var R=b,C=R+o,z=C+1,D=R+1;T[P++]=R,T[P++]=C,T[P++]=D,T[P++]=D,T[P++]=C,T[P++]=z,++b}++b}return O.indices=T,t.st&&(O.attributes.st=new l({componentDatatype:a.FLOAT,componentsPerAttribute:2,values:s})),O}function P(e,t,r,n,a){return e[t++]=n[r],e[t++]=n[r+1],e[t++]=n[r+2],e[t++]=a[r],e[t++]=a[r+1],e[t++]=a[r+2],e}function A(e,t,r,n){return e[t++]=n[r],e[t++]=n[r+1],e[t++]=n[r],e[t++]=n[r+1],e}function N(e){var t,n=e.vertexFormat,i=e.surfaceHeight,o=e.extrudedHeight,u=Math.min(o,i),s=Math.max(o,i),c=e.height,f=e.width,y=e.ellipsoid,v=b(e);if(p.equalsEpsilon(u,s,.1))return v;v=g.scaleToGeodeticHeight(v,s,y,!1);var w=new Float64Array(v.attributes.position.values),x=w.length,E=2*x,S=new Float64Array(E);S.set(w),v=g.scaleToGeodeticHeight(v,u,y);var O=v.attributes.position.values;S.set(O,x),v.attributes.position.values=S;var M,_=n.normal?new Float32Array(E):void 0,N=n.tangent?new Float32Array(E):void 0,I=n.binormal?new Float32Array(E):void 0,R=n.st?new Float32Array(2*(E/3)):void 0;if(n.normal){var C=v.attributes.normal.values;for(_.set(C),t=0;x>t;t++)C[t]=-C[t];_.set(C,x),v.attributes.normal.values=_}if(n.tangent){var z=v.attributes.tangent.values;for(N.set(z),t=0;x>t;t++)z[t]=-z[t];N.set(z,x),v.attributes.tangent.values=N}if(n.binormal){var D=v.attributes.binormal.values;I.set(D),I.set(D,x),v.attributes.binormal.values=I}n.st&&(M=v.attributes.st.values,R.set(M),R.set(M,2*(x/3)),v.attributes.st.values=R);var L=v.indices,q=L.length,U=x/3,W=m.createTypedArray(E/3,2*q);for(W.set(L),t=0;q>t;t+=3)W[t+q]=L[t+2]+U,W[t+1+q]=L[t+1]+U,W[t+2+q]=L[t]+U;v.indices=W;var G=2*f+2*c-4,k=2*(G+4),V=new Float64Array(3*k),Y=n.st?new Float32Array(2*k):void 0,j=0,H=0,Z=f*c;for(t=0;Z>t;t+=f)V=P(V,j,3*t,w,O),j+=6,n.st&&(Y=A(Y,H,2*t,M),H+=4);for(t=Z-f;Z>t;t++)V=P(V,j,3*t,w,O),j+=6,n.st&&(Y=A(Y,H,2*t,M),H+=4);for(t=Z-1;t>0;t-=f)V=P(V,j,3*t,w,O),j+=6,n.st&&(Y=A(Y,H,2*t,M),H+=4);for(t=f-1;t>=0;t--)V=P(V,j,3*t,w,O),j+=6,n.st&&(Y=A(Y,H,2*t,M),H+=4);var X=T(V,n,y);n.st&&(X.attributes.st=new l({componentDatatype:a.FLOAT,componentsPerAttribute:2,values:Y}));var J,K,Q,$,et=m.createTypedArray(k,6*G);x=V.length/3;var tt=0;for(t=0;x-1>t;t+=2){J=t,$=(J+2)%x;var rt=r.fromArray(V,3*J,B),nt=r.fromArray(V,3*$,F);r.equalsEpsilon(rt,nt,p.EPSILON10)||(K=(J+1)%x,Q=(K+2)%x,et[tt++]=J,et[tt++]=K,et[tt++]=$,et[tt++]=$,et[tt++]=K,et[tt++]=Q)}return X.indices=et,X=h.combineInstances([new d({geometry:v}),new d({geometry:X})]),X[0]}var I=new r,R=new r,C=new r,z=new r,D=new E,L=new t,q=new e,U=new e,B=new r,F=new r,W=function(e){e=i(e,i.EMPTY_OBJECT);var t=e.rectangle,r=i(e.granularity,p.RADIANS_PER_DEGREE),n=i(e.ellipsoid,s.WGS84),a=i(e.height,0),u=i(e.rotation,0),c=i(e.stRotation,0),l=i(e.vertexFormat,O.DEFAULT),f=e.extrudedHeight,d=o(f)&&Math.abs(a-f)>1,h=i(e.closeTop,!0),m=i(e.closeBottom,!0);this._rectangle=t,this._granularity=r,this._ellipsoid=s.clone(n),this._surfaceHeight=a,this._rotation=u,this._stRotation=c,this._vertexFormat=O.clone(l),this._extrudedHeight=i(f,0),this._extrude=d,this._closeTop=h,this._closeBottom=m,this._workerName="createRectangleGeometry"};W.packedLength=E.packedLength+s.packedLength+O.packedLength+8,W.pack=function(e,t,r){r=i(r,0),E.pack(e._rectangle,t,r),r+=E.packedLength,s.pack(e._ellipsoid,t,r),r+=s.packedLength,O.pack(e._vertexFormat,t,r),r+=O.packedLength,t[r++]=e._granularity,t[r++]=e._surfaceHeight,t[r++]=e._rotation,t[r++]=e._stRotation,t[r++]=e._extrudedHeight,t[r++]=e._extrude?1:0,t[r++]=e._closeTop?1:0,t[r]=e._closeBottom?1:0};var G=new E,k=s.clone(s.UNIT_SPHERE),V=new O,Y={rectangle:G,ellipsoid:k,vertexFormat:V,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,closeTop:void 0,closeBottom:void 0};W.unpack=function(e,t,r){t=i(t,0);var n=E.unpack(e,t,G);t+=E.packedLength;var a=s.unpack(e,t,k);t+=s.packedLength;var u=O.unpack(e,t,V);t+=O.packedLength;var c=e[t++],l=e[t++],f=e[t++],d=e[t++],h=e[t++],m=1===e[t++],p=1===e[t++],y=1===e[t];return o(r)?(r._rectangle=E.clone(n,r._rectangle),r._ellipsoid=s.clone(a,r._ellipsoid),r._vertexFormat=O.clone(u,r._vertexFormat),r._granularity=c,r._surfaceHeight=l,r._rotation=f,r._stRotation=d,r._extrudedHeight=m?h:void 0,r._extrude=m,r._closeTop=p,r._closeBottom=y,r):(Y.granularity=c,Y.height=l,Y.rotation=f,Y.stRotation=d,Y.extrudedHeight=m?h:void 0,Y.closeTop=p,Y.closeBottom=y,new W(Y))};var j=new y,H=new v,Z=new n,X=new x,J=new n;return W.createGeometry=function(t){var n=E.clone(t._rectangle,D),a=t._ellipsoid,i=t._surfaceHeight,u=t._extrude,s=t._extrudedHeight,l=t._stRotation,d=t._vertexFormat,h=S.computeOptions(t,n,Z),m=j,p=H;if(o(l)){y.fromRotation(-l,m);var w=E.center(n,J),O=a.cartographicToCartesian(w,B);r.normalize(O,O),x.fromAxisAngle(O,-l,X),v.fromQuaternion(X,p)}else y.clone(y.IDENTITY,m),v.clone(v.IDENTITY,p);h.lonScalar=1/n.width,h.latScalar=1/n.height,h.vertexFormat=d,h.textureMatrix=m,h.tangentRotationMatrix=p,h.size=h.width*h.height;var M,_;if(n=t._rectangle,u){M=N(h);var T=e.fromRectangle3D(n,a,i,U),P=e.fromRectangle3D(n,a,s,q);_=e.union(T,P)}else M=b(h),M=g.scaleToGeodeticHeight(M,i,a,!1),_=e.fromRectangle3D(n,a,i);return d.position||delete M.attributes.position,new c({attributes:new f(M.attributes),indices:M.indices,primitiveType:M.primitiveType,boundingSphere:_})},W}),define("Workers/createRectangleGeometry",["../Core/defined","../Core/Ellipsoid","../Core/Rectangle","../Core/RectangleGeometry"],function(e,t,r,n){"use strict";function a(a,i){return e(i)&&(a=n.unpack(a,i)),a._ellipsoid=t.clone(a._ellipsoid),a._rectangle=r.clone(a._rectangle),n.createGeometry(a)}return a})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createRectangleOutlineGeometry.js b/libs/Cesium/Workers/createRectangleOutlineGeometry.js deleted file mode 100644 index b5269d06..00000000 --- a/libs/Cesium/Workers/createRectangleOutlineGeometry.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,a){a=t(a,r);var i=Math.abs(e-n);return a>=i||i<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],a=t;e>=a;a++)r.push(n*a);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var a=new e;return n.setRandomNumberSeed=function(t){a=new e(t)},n.nextRandomNumber=function(){return a.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};i.fromSpherical=function(n,r){t(r)||(r=new i);var a=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(a),r.y=s*Math.sin(a),r.z=u*Math.cos(o),r},i.fromElements=function(e,n,r,a){return t(a)?(a.x=e,a.y=n,a.z=r,a):new i(e,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var n=i.dot(s,c),r=i.magnitude(i.cross(s,c,s));return Math.atan2(r,n)};var l=new i;i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):n.y<=n.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)},i.cross=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-r*s,f=r*u-a*o;return n.x=c,n.y=l,n.z=f,n},i.fromDegrees=function(e,t,n,r,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,n,r,o)};var f=new i,d=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(n,r,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=i.normalize(f,f),i.multiplyComponents(s,f,d);var l=Math.sqrt(i.dot(f,d));return d=i.divideByScalar(d,l,d),f=i.multiplyByScalar(f,a,f),t(u)||(u=new i),i.add(d,f,u)},i.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=a.toRadians(e[o]);return i.fromRadiansArray(r,t,n)},i.fromRadiansArray=function(e,n,r){var a=e.length;t(r)?r.length=a/2:r=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=i.fromRadians(u,s,0,n,r[o/2])}return r},i.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=a.toRadians(e[o]),r[o+1]=a.toRadians(e[o+1]),r[o+2]=e[o+2];return i.fromRadiansArrayHeights(r,t,n)},i.fromRadiansArrayHeights=function(e,n,r){var a=e.length;t(r)?r.length=a/3:r=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=i.fromRadians(u,s,c,n,r[o/3])}return r},i.ZERO=r(new i(0,0,0)),i.UNIT_X=r(new i(1,0,0)),i.UNIT_Y=r(new i(0,1,0)),i.UNIT_Z=r(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return i.fromRadians=function(n,r,a,o){return a=e(a,0),t(o)?(o.longitude=n,o.latitude=r,o.height=a,o):new i(n,r,a)},i.fromDegrees=function(e,t,n,r){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},i.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},i.ZERO=r(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(t,r,a,i){r=n(r,0),a=n(a,0),i=n(i,0),t._radii=new e(r,a,i),t._radiiSquared=new e(r*r,a*a,i*i),t._radiiToTheFourth=new e(r*r*r*r,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===r?0:1/r,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(r,a,i),t._maximumRadius=Math.max(r,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var a=t._radii;return r(n)?(e.clone(a,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,a){a=n(a,0),e.pack(t._radii,r,a)},c.unpack=function(t,r,a){r=n(r,0);var i=e.unpack(t,r);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,n){var a=l,i=f;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),r(n)||(n=new e),e.add(i,a,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var d=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(n,a){var i=this.scaleToGeodeticSurface(n,h);if(!r(i))return void 0;var o=this.geodeticSurfaceNormal(i,d),s=e.subtract(n,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,n))*e.magnitude(s);return r(a)?(a.longitude=c,a.latitude=l,a.height=f,a):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,d=a*a*c*c,h=i*i*l*l,m=o*o*f*f,v=d+h+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,M=x.z,_=y;_.x=2*w.x*E,_.y=2*w.y*S,_.z=2*w.z*M;var O,T,R,P,C,N,I,z,b,A,D,q=(1-g)*e.magnitude(t)/(.5*e.magnitude(_)),U=0;do{q-=U,R=1/(1+q*E),P=1/(1+q*S),C=1/(1+q*M),N=R*R,I=P*P,z=C*C,b=N*R,A=I*P,D=z*C,O=d*N+h*I+m*z-1,T=d*b*E+h*A*S+m*D*M;var L=-2*T;U=O/L}while(Math.abs(O)>u.EPSILON12);return r(n)?(n.x=a*R,n.y=i*P,n.z=o*C,n):new e(a*R,i*P,o*C)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(a,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.west=e[r++],a.south=e[r++],a.east=e[r++],a.north=e[r],a},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,a,i,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),n(o)?(o.west=e,o.south=r,o.east=a,o.north=i,o):new s(e,r,a,i)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=i,t.east=a,t.north=o,t):new s(r,i,a,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var d=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return d>=h?void 0:n(r)?(r.west=l,r.south=d,r.east=f,r.north=h,r):new s(l,d,f,h)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>a||u.equalsEpsilon(n,a,u.EPSILON14))&&(i>n||u.equalsEpsilon(n,i,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,a,o){r=t(r,i.WGS84),a=t(a,0),n(o)||(o=[]);var l=0,f=e.north,d=e.south,h=e.east,m=e.west,p=c;p.height=a,p.longitude=m,p.latitude=f,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=0>f?f:d>0?d:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=r.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,a,i,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return r(n)?(n.x=i,n.y=o,n.z=u,n):new e(i,o,u)},u.prototype.unproject=function(e,n){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return r(n)?(n.longitude=i,n.latitude=o,n.height=u,n):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r,a){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(a,0)};i.fromElements=function(e,n,r,a,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=a,o):new i(e,n,r,a)},i.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r++],a.w=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,s);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):n.y<=n.z?n.y<=n.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)&&a.equalsEpsilon(e.w,n.w,r,i)},i.ZERO=r(new i(0,0,0,0)),i.UNIT_X=r(new i(1,0,0,0)),i.UNIT_Y=r(new i(0,1,0,0)),i.UNIT_Z=r(new i(0,0,1,0)),i.UNIT_W=r(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(h[n],d[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=i.EPSILON15,r=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],d[o])]);u>r&&(a=o,r=u)}var s=1,l=0,f=d[a],m=h[a];if(Math.abs(e[c.getElementIndex(m,f)])>n){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,n,r,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++],a[4]=e[r++],a[5]=e[r++],a[6]=e[r++],a[7]=e[r++],a[8]=e[r++],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],a[4]=e[r+4],a[5]=e[r+5],a[6]=e[r+6],a[7]=e[r+7],a[8]=e[r+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,d=e.z*e.w,h=e.w*e.w,m=r-u-f+h,p=2*(a-d),y=2*(i+l),v=2*(a+d),g=-r+u-f+h,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-r-u+f+h;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(m,p,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=a,t[6]=0,t[7]=-a,t[8]=r,t):new c(1,0,0,0,r,-a,0,a,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=r,t):new c(r,0,a,0,1,0,-a,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=a,t[2]=0,t[3]=-a,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-a,0,a,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,a=e[r],i=e[r+1],o=e[r+2];return n.x=a,n.y=i,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=3*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],a=e[t+3],i=e[t+6];return n.x=r,n.y=a,n.z=i,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=a,n[2]=i,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[3]*a+e[6]*i,u=e[1]*r+e[4]*a+e[7]*i,s=e[2]*r+e[5]*a+e[8]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],h=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var r=i.EPSILON20,a=10,l=0,f=0;n(t)||(t={});for(var d=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=r*o(h);a>f&&u(h)>y;)s(h,m),c.transpose(m,p),c.multiply(h,m,h),c.multiply(p,h,h),c.multiply(d,m,d),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*r-n*c)+u*(n*o-i*r)},c.inverse=function(e,t){var n=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],d=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=i.EPSILON15)throw new r("matrix is not invertible");t[0]=s*h-d*l,t[1]=d*o-a*h,t[2]=a*l-s*o,t[3]=f*l-u*h,t[4]=n*h-f*o,t[5]=u*o-n*l,t[6]=u*d-f*s,t[7]=f*a-n*d,t[8]=n*s-u*a;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,a,i,o,u,s){"use strict"; -var c=function(e,t,r,a,i,o,u,s,c,l,f,d,h,m,p,y){this[0]=n(e,0),this[1]=n(i,0),this[2]=n(c,0),this[3]=n(h,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(p,0),this[12]=n(a,0),this[13]=n(s,0),this[14]=n(d,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=n(a,e.ZERO),r(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,a){r(a)||(a=new c);var i=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,d=t.x*t.w,h=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-y+g,x=2*(l-v),E=2*(f+p),S=2*(l+v),M=-s+h-y+g,_=2*(m-d),O=2*(f-p),T=2*(m+d),R=-s-h+y+g;return a[0]=w*i,a[1]=S*i,a[2]=O*i,a[3]=0,a[4]=x*o,a[5]=M*o,a[6]=T*o,a[7]=0,a[8]=E*u,a[9]=_*u,a[10]=R*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,d=new e;c.fromCamera=function(t,n){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,d),d);var u=f.x,s=f.y,h=f.z,m=l.x,p=l.y,y=l.z,v=d.x,g=d.y,w=d.z,x=a.x,E=a.y,S=a.z,M=u*-x+s*-E+h*-S,_=v*-x+g*-E+w*-S,O=m*x+p*E+y*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=g,n[6]=-p,n[7]=0,n[8]=h,n[9]=w,n[10]=-y,n[11]=0,n[12]=M,n[13]=_,n[14]=O,n[15]=1,n):new c(u,s,h,M,v,g,w,_,-m,-p,-y,O,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,n,r,a,i,o){var u=1/(t-e),s=1/(r-n),c=1/(i-a),l=-(t+e)*u,f=-(r+n)*s,d=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=d,o[15]=1,o},c.computePerspectiveOffCenter=function(e,t,n,r,a,i,o){var u=2*a/(t-e),s=2*a/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),f=-(i+a)/(i-a),d=-1,h=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=d,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,a,i){var o=2*a/(t-e),u=2*a/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,f=-1,d=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=d,i[15]=0,i},c.computeViewportTransformation=function(e,t,r,a){e=n(e,n.EMPTY_OBJECT);var i=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-t),d=c,h=l,m=f,p=i+c,y=o+l,v=t+f,g=1;return a[0]=d,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=m,a[11]=0,a[12]=p,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,a=e[r],i=e[r+1],o=e[r+2],u=e[r+3];return n.x=a,n.y=i,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=4*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r[a+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return n.x=r,n.y=a,n.z=i,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var h=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],M=t[4],_=t[5],O=t[6],T=t[7],R=t[8],P=t[9],C=t[10],N=t[11],I=t[12],z=t[13],b=t[14],A=t[15],D=r*w+u*x+f*E+p*S,q=a*w+s*x+d*E+y*S,U=i*w+c*x+h*E+v*S,L=o*w+l*x+m*E+g*S,B=r*M+u*_+f*O+p*T,W=a*M+s*_+d*O+y*T,F=i*M+c*_+h*O+v*T,G=o*M+l*_+m*O+g*T,k=r*R+u*P+f*C+p*N,j=a*R+s*P+d*C+y*N,Y=i*R+c*P+h*C+v*N,H=o*R+l*P+m*C+g*N,V=r*I+u*z+f*b+p*A,X=a*I+s*z+d*b+y*A,Z=i*I+c*z+h*b+v*A,J=o*I+l*z+m*b+g*A;return n[0]=D,n[1]=q,n[2]=U,n[3]=L,n[4]=B,n[5]=W,n[6]=F,n[7]=G,n[8]=k,n[9]=j,n[10]=Y,n[11]=H,n[12]=V,n[13]=X,n[14]=Z,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=e[12],h=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],M=t[10],_=t[12],O=t[13],T=t[14],R=r*p+o*y+c*v,P=a*p+u*y+l*v,C=i*p+s*y+f*v,N=r*g+o*w+c*x,I=a*g+u*w+l*x,z=i*g+s*w+f*x,b=r*E+o*S+c*M,A=a*E+u*S+l*M,D=i*E+s*S+f*M,q=r*_+o*O+c*T+d,U=a*_+u*O+l*T+h,L=i*_+s*O+f*T+m;return n[0]=R,n[1]=P,n[2]=C,n[3]=0,n[4]=N,n[5]=I,n[6]=z,n[7]=0,n[8]=b,n[9]=A,n[10]=D,n[11]=0,n[12]=q,n[13]=U,n[14]=L,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=t[0],h=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=r*d+o*h+c*m,S=a*d+u*h+l*m,M=i*d+s*h+f*m,_=r*p+o*y+c*v,O=a*p+u*y+l*v,T=i*p+s*y+f*v,R=r*g+o*w+c*x,P=a*g+u*w+l*x,C=i*g+s*w+f*x;return n[0]=E,n[1]=S,n[2]=M,n[3]=0,n[4]=_,n[5]=O,n[6]=T,n[7]=0,n[8]=R,n[9]=P,n[10]=C,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=r*e[0]+a*e[4]+i*e[8]+e[12],u=r*e[1]+a*e[5]+i*e[9]+e[13],s=r*e[2]+a*e[6]+i*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var p=new e;c.multiplyByUniformScale=function(e,t,n){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,n)},c.multiplyByScale=function(e,t,n){var r=t.x,a=t.y,i=t.z;return 1===r&&1===a&&1===i?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=a*e[4],n[5]=a*e[5],n[6]=a*e[6],n[7]=0,n[8]=i*e[8],n[9]=i*e[9],n[10]=i*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*r+e[4]*a+e[8]*i+e[12]*o,s=e[1]*r+e[5]*a+e[9]*i+e[13]*o,c=e[2]*r+e[6]*a+e[10]*i+e[14]*o,l=e[3]*r+e[7]*a+e[11]*i+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i,u=e[1]*r+e[5]*a+e[9]*i,s=e[2]*r+e[6]*a+e[10]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i+e[12],u=e[1]*r+e[5]*a+e[9]*i+e[13],s=e[2]*r+e[6]*a+e[10]*i+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],a=e[4],i=e[8],l=e[12],f=e[1],d=e[5],h=e[9],m=e[13],p=e[2],x=e[6],E=e[10],S=e[14],M=e[3],_=e[7],O=e[11],T=e[15],R=E*T,P=S*O,C=x*T,N=S*_,I=x*O,z=E*_,b=p*T,A=S*M,D=p*O,q=E*M,U=p*_,L=x*M,B=R*d+N*h+I*m-(P*d+C*h+z*m),W=P*f+b*h+q*m-(R*f+A*h+D*m),F=C*f+A*d+U*m-(N*f+b*d+L*m),G=z*f+D*d+L*h-(I*f+q*d+U*h),k=P*a+C*i+z*l-(R*a+N*i+I*l),j=R*r+A*i+D*l-(P*r+b*i+q*l),Y=N*r+b*a+L*l-(C*r+A*a+U*l),H=I*r+q*a+U*i-(z*r+D*a+L*i);R=i*m,P=l*h,C=a*m,N=l*d,I=a*h,z=i*d,b=r*m,A=l*f,D=r*h,q=i*f,U=r*d,L=a*f;var V=R*_+N*O+I*T-(P*_+C*O+z*T),X=P*M+b*O+q*T-(R*M+A*O+D*T),Z=C*M+A*_+U*T-(N*M+b*_+L*T),J=z*M+D*_+L*O-(I*M+q*_+U*O),K=C*E+z*S+P*x-(I*S+R*x+N*E),Q=D*S+R*p+A*E-(b*E+q*S+P*p),$=b*x+L*S+N*p-(U*S+C*p+A*x),et=U*E+I*p+q*x-(D*x+L*E+z*p),tt=r*B+a*W+i*F+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=B*tt,n[1]=W*tt,n[2]=F*tt,n[3]=G*tt,n[4]=k*tt,n[5]=j*tt,n[6]=Y*tt,n[7]=H*tt,n[8]=V*tt,n[9]=X*tt,n[10]=Z*tt,n[11]=J*tt,n[12]=K*tt,n[13]=Q*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],d=e[13],h=e[14],m=-n*f-r*d-a*h,p=-i*f-o*d-u*h,y=-s*f-c*d-l*h;return t[0]=n,t[1]=i,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t,n){this.normal=e.clone(t),this.distance=n};a.fromPointNormal=function(n,r,i){var o=-e.dot(r,n);return t(i)?(e.clone(r,i.normal),i.distance=o,i):new a(r,o)};var i=new e;return a.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,i),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new a(o,u)},a.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},a.ORIGIN_XY_PLANE=r(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=r(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=r(new a(e.UNIT_Y,0)),a}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,a,i,o,u,s,c,l,f,d){"use strict";var h=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,M=new e,_=new e,O=new e;h.fromPoints=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var a=e.clone(t[0],x),i=e.clone(a,m),o=e.clone(a,p),u=e.clone(a,y),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),f=t.length,d=1;f>d;d++){e.clone(t[d],a);var T=a.x,R=a.y,P=a.z;T<i.x&&e.clone(a,i),T>s.x&&e.clone(a,s),R<o.y&&e.clone(a,o),R>c.y&&e.clone(a,c),P<u.z&&e.clone(a,u),P>l.z&&e.clone(a,l)}var C=e.magnitudeSquared(e.subtract(s,i,E)),N=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),z=i,b=s,A=C;N>A&&(A=N,z=o,b=c),I>A&&(A=I,z=u,b=l);var D=S;D.x=.5*(z.x+b.x),D.y=.5*(z.y+b.y),D.z=.5*(z.z+b.z);var q=e.magnitudeSquared(e.subtract(b,D,E)),U=Math.sqrt(q),L=M;L.x=i.x,L.y=o.y,L.z=u.z;var B=_;B.x=s.x,B.y=c.y,B.z=l.z;var W=e.multiplyByScalar(e.add(L,B,E),.5,O),F=0;for(d=0;f>d;d++){e.clone(t[d],a);var G=e.magnitude(e.subtract(a,W,E));G>F&&(F=G);var k=e.magnitudeSquared(e.subtract(a,D,E));if(k>q){var j=Math.sqrt(k);U=.5*(U+j),q=U*U;var Y=j-U;D.x=(U*D.x+Y*a.x)/j,D.y=(U*D.y+Y*a.y)/j,D.z=(U*D.z+Y*a.z)/j}}return F>U?(e.clone(D,n.center),n.radius=U):(e.clone(W,n.center),n.radius=F),n};var T=new u,R=new e,P=new e,C=new t,N=new t;h.fromRectangle2D=function(e,t,n){return h.fromRectangleWithHeights2D(e,t,0,0,n)},h.fromRectangleWithHeights2D=function(t,a,i,o,u){if(r(u)||(u=new h),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=n(a,T),d.southwest(t,C),C.height=i,d.northeast(t,N),N.height=o;var s=a.project(C,R),c=a.project(N,P),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*f,p.z=s.z+.5*m,u};var I=[];h.fromRectangle3D=function(e,t,a,i){t=n(t,o.WGS84),a=n(a,0);var u;return r(e)&&(u=d.subsample(e,t,a,I)),h.fromPoints(u,i)},h.fromVertices=function(t,a,i,o){if(r(o)||(o=new h),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=n(a,e.ZERO),i=n(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),f=e.clone(u,v),d=e.clone(u,g),T=e.clone(u,w),R=t.length,P=0;R>P;P+=i){var C=t[P]+a.x,N=t[P+1]+a.y,I=t[P+2]+a.z;u.x=C,u.y=N,u.z=I,C<s.x&&e.clone(u,s),C>f.x&&e.clone(u,f),N<c.y&&e.clone(u,c),N>d.y&&e.clone(u,d),I<l.z&&e.clone(u,l),I>T.z&&e.clone(u,T)}var z=e.magnitudeSquared(e.subtract(f,s,E)),b=e.magnitudeSquared(e.subtract(d,c,E)),A=e.magnitudeSquared(e.subtract(T,l,E)),D=s,q=f,U=z;b>U&&(U=b,D=c,q=d),A>U&&(U=A,D=l,q=T);var L=S;L.x=.5*(D.x+q.x),L.y=.5*(D.y+q.y),L.z=.5*(D.z+q.z);var B=e.magnitudeSquared(e.subtract(q,L,E)),W=Math.sqrt(B),F=M;F.x=s.x,F.y=c.y,F.z=l.z;var G=_;G.x=f.x,G.y=d.y,G.z=T.z;var k=e.multiplyByScalar(e.add(F,G,E),.5,O),j=0;for(P=0;R>P;P+=i){u.x=t[P]+a.x,u.y=t[P+1]+a.y,u.z=t[P+2]+a.z;var Y=e.magnitude(e.subtract(u,k,E));Y>j&&(j=Y);var H=e.magnitudeSquared(e.subtract(u,L,E));if(H>B){var V=Math.sqrt(H);W=.5*(W+V),B=W*W;var X=V-W;L.x=(W*L.x+X*u.x)/V,L.y=(W*L.y+X*u.y)/V,L.z=(W*L.z+X*u.z)/V}}return j>W?(e.clone(L,o.center),o.radius=W):(e.clone(k,o.center),o.radius=j),o},h.fromCornerPoints=function(t,n,a){r(a)||(a=new h);var i=a.center;return e.add(t,n,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,n),a},h.fromEllipsoid=function(t,n){return r(n)||(n=new h),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var z=new e;h.fromBoundingSpheres=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var a=t.length;if(1===a)return h.clone(t[0],n);if(2===a)return h.union(t[0],t[1],n);for(var i=[],o=0;a>o;o++)i.push(t[o].center);n=h.fromPoints(i,n);var u=n.center,s=n.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,z)+c.radius)}return n.radius=s,n},h.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,r){r=n(r,0);var a=e.center;t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r]=e.radius},h.unpack=function(e,t,a){t=n(t,0),r(a)||(a=new h);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var b=new e,A=new e;h.union=function(t,n,a){r(a)||(a=new h);var i=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,i,b),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return n.clone(a),a;var f=.5*(o+l+s),d=e.multiplyByScalar(c,(-o+f)/l,A);return e.add(d,i,d),e.clone(d,a.center),a.radius=f,a};var D=new e;h.expand=function(t,n,r){r=h.clone(t,r);var a=e.magnitude(e.subtract(n,r.center,D));return a>r.radius&&(r.radius=a),r},h.intersectPlane=function(t,n){var r=t.center,a=t.radius,i=n.normal,o=e.dot(i,r)+n.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);h.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(t,q);return h.intersectPlane(e,n)},h.transform=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var U=new e;h.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,U);return e.magnitudeSquared(r)-t.radius*t.radius},h.transformWithoutScale=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var L=new e;h.computePlaneDistances=function(t,n,a,i){r(i)||(i=new c);var o=e.subtract(t.center,n,L),u=e.multiplyByScalar(a,e.dot(a,o),L),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var B=new e,W=new e,F=new e,G=new e,k=new e,j=new t,Y=new Array(8),H=0;8>H;++H)Y[H]=new e;var V=new u;return h.projectTo2D=function(t,r,a){r=n(r,V);var i=r.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,W);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),d=e.negate(c,G),m=Y,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,d,p),p=m[2],e.add(s,f,p),e.add(p,d,p),p=m[3],e.add(s,f,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,d,p),p=m[6],e.add(s,f,p),e.add(p,d,p),p=m[7],e.add(s,f,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,j);r.project(w,g)}a=h.fromPoints(m,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},h.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(r.requestFullscreen=a,n=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(r.requestFullscreen=a,n=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?r.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(r.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?r.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(r.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?r.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(r.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),r.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),r.fullscreenerror=a)}return n},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[r.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[r.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=r(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,M=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,M=r(e[1])))}return S}function f(){return l()&&M}function d(){if(!t(_)){_=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(_=!0,O=r(e[1]))}return _}function h(){return t(T)||(T=/Windows/i.test(navigator.appVersion)),T}function m(){return d()&&O}function p(){return t(R)||(R=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),R}var y,v,g,w,x,E,S,M,_,O,T,R,P={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:d,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return P.supportsFullscreen=function(){return n.supportsFullscreen()},P.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},P.supportsWebWorkers=function(){return"undefined"!=typeof Worker},P}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,a){"use strict";if(!r.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,r,a,o){switch(a=e(a,0),o=e(o,(r.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(r,a,o);case i.UNSIGNED_BYTE:return new Uint8Array(r,a,o);case i.SHORT:return new Int16Array(r,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(r,a,o);case i.FLOAT:return new Float32Array(r,a,o);case i.DOUBLE:return new Float64Array(r,a,o);default:throw new n("componentDatatype is not a valid value.")}},a(i)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var r=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,n,a){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,a):new Uint16Array(t,n,a)},n(a)}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n){this.x=e(t,0),this.y=e(n,0)};i.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new i(e,n)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r) -};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)},i.ZERO=r(new i(0,0)),i.UNIT_X=r(new i(1,0)),i.UNIT_Y=r(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,a,i,o){"use strict";var u=function(r,a,i){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),n(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var a=t[0].x,i=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,d=1;f>d;d++){var h=t[d],m=h.x,p=h.y,y=h.z;a=Math.min(m,a),s=Math.max(m,s),i=Math.min(p,i),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=a,v.y=i,v.z=o;var g=r.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,r.center);return e.multiplyByScalar(w,.5,w),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),a=n.normal,o=r.x*Math.abs(a.x)+r.y*Math.abs(a.y)+r.z*Math.abs(a.z),u=e.dot(t.center,a)+n.distance;return u-o>0?i.INSIDE:0>u+o?i.OUTSIDE:i.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function n(e,n,r){var a=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(n)))<r?0:a}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,a){var i;if(0===e)return 0===r?[]:[-a/r];if(0===r){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-r/e,0>i?[i,0]:[0,i];var c=r*r,l=4*e*a,f=n(c,-l,t.EPSILON14);if(0>f)return[];var d=-.5*n(r,t.sign(r)*Math.sqrt(f),t.EPSILON14);return r>0?[d/e,a/d]:[a/d,d/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var a,i,o=e,u=t/3,s=n/3,c=r,l=o*s,f=u*c,d=u*u,h=s*s,m=o*s-d,p=o*c-u*s,y=u*c-h,v=4*m*y-p*p;if(0>v){var g,w,x;d*f>=l*h?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var M=i/2,_=0>M?-Math.pow(-M,1/3):Math.pow(M,1/3),O=i===S?-_:-w/_;return a=0>=w?_+O:-x/(_*_+O*O+w),d*f>=l*h?[(a-u)/o]:[-c/(a+s)]}var T=m,R=-2*u*m+o*p,P=y,C=-c*p+2*s*y,N=Math.sqrt(v),I=Math.sqrt(3)/2,z=Math.abs(Math.atan2(o*N,-R)/3);a=2*Math.sqrt(-T);var b=Math.cos(z);i=a*b;var A=a*(-b/2-I*Math.sin(z)),D=i+A>2*u?i-u:A-u,q=o,U=D/q;z=Math.abs(Math.atan2(c*N,-C)/3),a=2*Math.sqrt(-P),b=Math.cos(z),i=a*b,A=a*(-b/2-I*Math.sin(z));var L=-c,B=2*s>i+A?i+s:A+s,W=L/B,F=q*B,G=-D*B-q*L,k=D*L,j=(s*G-u*k)/(-u*G+s*F);return j>=U?W>=U?W>=j?[U,j,W]:[U,W,j]:[W,U,j]:W>=U?[j,U,W]:W>=j?[j,W,U]:[W,j,U]}var r={};return r.computeDiscriminant=function(e,t,n,r){var a=e*e,i=t*t,o=n*n,u=r*r,s=18*e*t*n*r+i*o-27*a*u-4*(e*o*n+i*t*r);return s},r.computeRealRoots=function(e,r,a,i){var o,u;if(0===e)return t.computeRealRoots(r,a,i);if(0===r){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,a,i)}return 0===a?0===i?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,i):0===i?(o=t.computeRealRoots(e,r,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,a,i)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var d=-t/4,h=f[f.length-1];if(Math.abs(h)<n.EPSILON14){var m=r.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[d-w,d-g,d+g,d+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[d-p,d+p];if(0>y&&v>=0)return p=Math.sqrt(v),[d-p,d+p]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,M=r.computeRealRoots(1,x,E),_=r.computeRealRoots(1,-x,S);return 0!==M.length?(M[0]+=d,M[1]+=d,0!==_.length?(_[0]+=d,_[1]+=d,M[1]<=_[0]?[M[0],M[1],_[0],_[1]]:_[1]<=M[0]?[_[0],_[1],M[0],M[1]]:M[0]>=_[0]&&M[1]<=_[1]?[_[0],M[0],M[1],_[1]]:_[0]>=M[0]&&_[1]<=M[1]?[M[0],_[0],_[1],M[1]]:M[0]>_[0]&&M[0]<_[1]?[_[0],M[0],_[1],M[1]]:[M[0],_[0],M[1],_[1]]):M):0!==_.length?(_[0]+=d,_[1]+=d,_):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,f=i*t+s-4*o,d=c*o-i*a*t+u,h=e.computeRealRoots(1,l,f,d);if(h.length>0){var m,p,y=h[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),M=c-4*y,_=c+4*Math.abs(y);if(0>y||M*S>E*_){var O=Math.sqrt(M);m=O/2,p=0===O?0:(t*x-i)/O}else{var T=Math.sqrt(E);m=0===T?0:(t*x-i)/T,p=T/2}var R,P;0===w&&0===m?(R=0,P=0):n.sign(w)===n.sign(m)?(R=w+m,P=y/R):(P=w-m,R=y/P);var C,N;0===x&&0===p?(C=0,N=0):n.sign(x)===n.sign(p)?(C=x+p,N=o/C):(N=x-p,C=o/N);var I=r.computeRealRoots(1,R,C),z=r.computeRealRoots(1,P,N);if(0!==I.length)return 0!==z.length?I[1]<=z[0]?[I[0],I[1],z[0],z[1]]:z[1]<=I[0]?[z[0],z[1],I[0],I[1]]:I[0]>=z[0]&&I[1]<=z[1]?[z[0],I[0],I[1],z[1]]:z[0]>=I[0]&&z[1]<=I[1]?[I[0],z[0],z[1],I[1]]:I[0]>z[0]&&I[0]<z[1]?[z[0],I[0],z[1],I[1]]:[I[0],z[0],I[1],z[1]]:I;if(0!==z.length)return z}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=n*n,l=c*n,f=r*r,d=f*r,h=a*a,m=h*a,p=u*c*f-4*s*d-4*e*l*f+18*e*t*n*d-27*i*f*f+256*o*m+a*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*f+144*i*n*f)+h*(144*e*u*n-27*u*u-128*i*c-192*i*t*r);return p},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,f=u/t,d=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>d?h+1:h){case 0:return a(c,l,f,d);case 1:return i(c,l,f,d);case 2:return i(c,l,f,d);case 3:return a(c,l,f,d);case 4:return a(c,l,f,d);case 5:return i(c,l,f,d);case 6:return a(c,l,f,d);case 7:return a(c,l,f,d);case 8:return i(c,l,f,d);case 9:return a(c,l,f,d);case 10:return a(c,l,f,d);case 11:return i(c,l,f,d);case 12:return a(c,l,f,d);case 13:return a(c,l,f,d);case 14:return a(c,l,f,d);case 15:return a(c,l,f,d);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,a){return n(a)||(a=new e),a=e.multiplyByScalar(t.direction,r,a),e.add(t.origin,a,a)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(t,r,a,o,u){u=n(u,!1);var s,c,l,f,d,h=t.origin,m=t.direction,p=e.subtract(a,r,y),E=e.subtract(o,r,v),S=e.cross(m,E,g),M=e.dot(p,S);if(u){if(M<i.EPSILON6)return void 0;if(s=e.subtract(h,r,w),l=e.dot(s,S),0>l||l>M)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c),0>f||l+f>M)return void 0;d=e.dot(E,c)/M}else{if(Math.abs(M)<i.EPSILON6)return void 0;var _=1/M;if(s=e.subtract(h,r,w),l=e.dot(s,S)*_,0>l||l>1)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c)*_,0>f||l+f>1)return void 0;d=e.dot(E,c)*_}return d}function f(e,t,n,r){var a=t*t-4*e*n;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function d(t,n,a){r(a)||(a={});var i=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(i,u,g),l=e.dot(o,o),d=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=f(l,d,h,S);return r(m)?(a.start=m.root0,a.stop=m.root1,a):void 0}function h(e,t,n){var r=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function m(t,n,r,a,c){var l,f=a*a,d=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*d,p=c*(a*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*d+a*n.x+r,v=d*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],M=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-M)),w.push(new e(a,c*S,c*M))}return w}var _=g*g,O=v*v,T=m*m,R=g*v,P=T+O,C=2*(p*m+R),N=2*y*m+p*p-O+_,I=2*(y*p-R),z=y*y-_;if(0===P&&0===C&&0===N&&0===I)return w;l=s.computeRealRoots(P,C,N,I,z);var b=l.length;if(0===b)return w;for(var A=0;b>A;++A){var D,q=l[A],U=q*q,L=Math.max(1-U,0),B=Math.sqrt(L);D=i.sign(m)===i.sign(y)?h(m*U+y,p*q,i.EPSILON12):i.sign(y)===i.sign(p*q)?h(m*U,p*q+y,i.EPSILON12):h(m*U+p*q,y,i.EPSILON12);var W=h(v*q,g,i.EPSILON15),F=D*W;0>F?w.push(new e(a,c*q,c*B)):F>0?w.push(new e(a,c*q,c*-B)):0!==B?(w.push(new e(a,c*q,c*-B)),w.push(new e(a,c*q,c*B)),++A):w.push(new e(a,c*q,c*B))}return w}var p={};p.rayPlane=function(t,n,a){r(a)||(a=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,n,a,i,o,u){var s=l(t,n,a,i,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;p.lineSegmentTriangle=function(t,n,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,a,i,o,u);return!r(f)||0>f||f>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};p.raySphere=function(e,t,n){return n=d(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var M=new c;p.lineSegmentSphere=function(t,n,a,i){var o=M;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=d(o,a,i),!r(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var _=new e,O=new e;p.rayEllipsoid=function(t,n){var r,a,i,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,_),l=e.multiplyComponents(s,t.direction,O),f=e.magnitudeSquared(c),d=e.dot(c,l);if(f>1){if(d>=0)return void 0;var h=d*d;if(r=f-1,a=e.magnitudeSquared(l),i=a*r,i>h)return void 0;if(h>i){o=d*d-i,u=-d+Math.sqrt(o);var m=u/a,p=r/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(r/a);return{start:y,stop:y}}return 1>f?(r=f-1,a=e.magnitudeSquared(l),i=a*r,o=d*d-i,u=-d+Math.sqrt(o),{start:0,stop:u/a}):0>d?(a=e.magnitudeSquared(l),{start:0,stop:-d/a}):void 0};var T=new e,R=new e,P=new e,C=new e,N=new e,I=new o,z=new o,b=new o,A=new o,D=new o,q=new o,U=new o,L=new e,B=new e,W=new t;p.grazingAltitudeLocation=function(t,n){var a=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(a,T);if(e.dot(u,s)>=0)return a;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,T),f=e.normalize(l,l),d=e.mostOrthogonalAxis(l,C),h=e.normalize(e.cross(d,f,R),R),p=e.normalize(e.cross(f,h,P),P),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,z),g=o.fromScale(n.radii,b),w=o.fromScale(n.oneOverRadii,A),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,M=o.multiply(o.multiply(v,w,q),x,q),_=o.multiply(o.multiply(M,g,U),y,U),O=o.multiplyByVector(M,a,N),F=m(_,e.negate(O,T),0,0,1),G=F.length;if(G>0){for(var k=e.clone(e.ZERO,B),j=Number.NEGATIVE_INFINITY,Y=0;G>Y;++Y){E=o.multiplyByVector(g,o.multiplyByVector(y,F[Y],L),L);var H=e.normalize(e.subtract(E,a,C),C),V=e.dot(H,u);V>j&&(j=V,k=e.clone(E,k))}var X=n.cartesianToCartographic(k,W);return j=i.clamp(j,0,1),S=e.magnitude(e.subtract(k,a,C))*Math.sqrt(1-j*j),S=c?-S:S,X.height=S,n.cartographicToCartesian(X,new e)}return void 0};var F=new e;return p.lineSegmentPlane=function(t,n,a,o){r(o)||(o=new e);var u=e.subtract(n,t,F),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(a.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,n,r,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,n)+o<0,c=e.dot(i,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,d;if((1===l||2===l)&&(f=new e,d=new e),1===l){if(u)return p.lineSegmentPlane(t,n,a,f),p.lineSegmentPlane(t,r,a,d),{positions:[t,n,r,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,a,f),p.lineSegmentPlane(n,t,a,d),{positions:[t,n,r,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,a,f),p.lineSegmentPlane(r,n,a,d),{positions:[t,n,r,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,a,f),p.lineSegmentPlane(r,t,a,d),{positions:[t,n,r,f,d],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,a,f),p.lineSegmentPlane(t,n,a,d),{positions:[t,n,r,f,d],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,a,f),p.lineSegmentPlane(n,r,a,d),{positions:[t,n,r,f,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,a){return t(e).then(n,r,a)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=a(e),t}function n(t){return e(t,i)}function r(e){this.then=e}function a(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return i(r)}});return n}function i(e){var n=new r(function(n,r){try{return r?t(r(e)):i(e)}catch(a){return i(a)}});return n}function o(){function e(e,t,n){return d(e,t,n)}function n(e){return m(e)}function a(e){return m(i(e))}function u(e){return h(e)}var s,c,l,f,d,h,m;return c=new r(e),s={then:e,resolve:n,reject:a,progress:u,promise:c,resolver:{resolve:n,reject:a,progress:u}},l=[],f=[],d=function(e,t,n){var r,a;return r=o(),a="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,a)}),f.push(a),r.promise},h=function(e){return p(f,e),e},m=function(e){return e=t(e),d=e.then,m=t,h=v,p(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,a,i){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,f,d,h,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(n,g)),f=[],l=g-c+1,d=[],h=o(),c)for(y=h.progress,p=function(e){d.push(e),--l||(m=p=v,h.reject(d))},m=function(e){f.push(e),--c||(m=p=v,h.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else h.resolve(f);return h.then(r,a,i)})}function c(e,t,n,r){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,n,r)}function l(e,t,n,r){return y(1,arguments),d(e,g).then(t,n,r)}function f(){return d(arguments,g)}function d(t,n){return e(t,function(t){var r,a,i,u,s,c;if(i=a=t.length>>>0,r=[],c=o(),i)for(u=function(t,a){e(t,n).then(function(e){r[a]=e,--i||c.resolve(r)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(r);return c.promise})}function h(t,n){var r=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,r[0]=function(t,r,i){return e(t,function(t){return e(r,function(e){return n(t,e,i,a)})})},w.apply(t,r)})}function m(t,n,r){var a=arguments.length>2;return e(t,function(e){return e=a?r:e,n.resolve(e),e},function(e){return n.reject(e),i(e)},n.progress)}function p(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=n,e.join=f,e.all=l,e.map=d,e.reduce=h,e.any=c,e.some=s,e.chain=m,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,n,r,a,i;if(i=0,t=Object(this),a=t.length>>>0,n=arguments,n.length<=1)for(;;){if(i in t){r=t[i++];break}if(++i>=a)throw new TypeError}else r=n[1];for(;a>i;++i)i in t&&(r=e(r,t[i],i,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,a,i=0,o=e.length-1;o>=i;)if(r=~~((i+o)/2),a=n(e[r],t),0>a)i=r+1;else{if(!(a>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],a=function(e,t,n,r){n||(n=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+a:a+e},i=function(e,t,n,r,i,o){var u=r-e.length;return u>0&&(e=n||!i?a(e,r,o,n):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+a(c.toString(t),u||0,"0",!1),i(e,n,r,o,s)},u=function(e,t,n,r,a,o){return null!=r&&(e=e.slice(0,r)),i(e,"",t,n,a,o)},s=function(e,r,s,c,l,f,d){var h,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",M=s.length,_=0;s&&M>_;_++)switch(s.charAt(_)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(_+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[n++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(d)>-1?6:"d"==d?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],d){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return h=+v||0,h=Math.round(h-h%1),m=0>h?"-":w,v=m+a(String(Math.abs(h)),f,"0",!1),i(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return h=+v,m=0>h?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(d.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(d)%2],v=m+Math.abs(h)[p](f),i(v,m,g,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,a,i,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(e,t){return C.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var n=C.leapSeconds,r=t(n,g,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var a=n[r].offset;if(r>0){var i=C.secondsDifference(n[r].julianDate,e);i>a&&(r--,a=n[r].offset)}C.addSeconds(e,a,e)}function d(e,n){g.julianDate=e;var r=C.leapSeconds,a=t(r,g,l);if(0>a&&(a=~a),0===a)return C.addSeconds(e,-r[0].offset,n);if(a>=r.length)return C.addSeconds(e,-r[a-1].offset,n);var i=C.secondsDifference(r[a].julianDate,e);return 0===i?C.addSeconds(e,-r[a].offset,n):1>=i?void 0:C.addSeconds(e,-r[--a].offset,n)}function h(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function m(e,t,n,r,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var f=i+(r*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var p=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,M=/^(\d{4})-?(\d{2})-?(\d{2})$/,_=/([Z+\-])?(\d{2})?:?(\d{2})?$/,O=/^(\d{2})(\.\d+)?/.source+_.source,T=/^(\d{2}):?(\d{2})(\.\d+)?/.source+_.source,R=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+_.source,P="Invalid ISO 8601 date.",C=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,h(a,t,this),r===c.UTC&&f(this)};C.fromDate=function(e,t){var n=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(h(n[0],n[1],t),f(t),t):new C(n[0],n[1],c.UTC)},C.fromIso8601=function(e,t){e=e.replace(",",".");var n,i,u,s=e.split("T"),l=1,d=1,p=0,g=0,_=0,N=0,I=s[0],z=s[1];if(!r(I))throw new a(P);var b;if(s=I.match(M),null!==s){if(b=I.split("-").length-1,b>0&&2!==b)throw new a(P);n=+s[1],l=+s[2],d=+s[3]}else if(s=I.match(x),null!==s)n=+s[1],l=+s[2];else if(s=I.match(w),null!==s)n=+s[1];else{var A;if(s=I.match(E),null!==s){if(n=+s[1],A=+s[2],u=o(n),1>A||u&&A>366||!u&&A>365)throw new a(P)}else{if(s=I.match(S),null===s)throw new a(P);n=+s[1];var D=+s[2],q=+s[3]||0;if(b=I.split("-").length-1,b>0&&(!r(s[3])&&1!==b||r(s[3])&&2!==b))throw new a(P);var U=new Date(Date.UTC(n,0,4));A=7*D+q-U.getUTCDay()-3}i=new Date(Date.UTC(n,0,1)),i.setUTCDate(A),l=i.getUTCMonth()+1,d=i.getUTCDate()}if(u=o(n),1>l||l>12||1>d||(2!==l||!u)&&d>y[l-1]||u&&2===l&&d>v)throw new a(P);var L;if(r(z)){if(s=z.match(R),null!==s){if(b=z.split(":").length-1,b>0&&2!==b&&3!==b)throw new a(P);p=+s[1],g=+s[2],_=+s[3],N=1e3*+(s[4]||0),L=5}else if(s=z.match(T),null!==s){if(b=z.split(":").length-1,b>0&&1!==b)throw new a(P);p=+s[1],g=+s[2],_=60*+(s[3]||0),L=4}else{if(s=z.match(O),null===s)throw new a(P);p=+s[1],g=60*+(s[2]||0),L=3}if(g>=60||_>=61||p>24||24===p&&(g>0||_>0||N>0))throw new a(P);var B=s[L],W=+s[L+1],F=+(s[L+2]||0);switch(B){case"+":p-=W,g-=F;break;case"-":p+=W,g+=F;break;case"Z":break;default:g+=new Date(Date.UTC(n,l-1,d,p,g)).getTimezoneOffset()}}else g+=new Date(n,l-1,d).getTimezoneOffset();var G=60===_;for(G&&_--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,d++;for(i=u&&2===l?v:y[l-1];d>i;)d-=i,l++,l>12&&(l-=12,n++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,d--;for(;1>d;)l--,1>l&&(l+=12,n--),i=u&&2===l?v:y[l-1],d+=i;var k=m(n,l,d,p,g,_,N);return r(t)?(h(k[0],k[1],t),f(t)):t=new C(k[0],k[1],c.UTC),G&&C.addSeconds(t,1,t),t},C.now=function(e){return C.fromDate(new Date,e)};var N=new C(0,0,c.TAI);return C.toGregorianDate=function(e,t){var n=!1,a=d(e,N);r(a)||(C.addSeconds(e,-1,N),a=d(N,N),n=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var h=0|80*c/2447,m=0|c-(0|2447*h/80);c=0|h/11;var p=0|h+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=n,t):new i(y,p,m,v,w,x,E,n)},C.toDate=function(e){var t=C.toGregorianDate(e,p),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},C.toIso8601=function(t,n){var a,i=C.toGregorianDate(t,i);return r(n)||0===i.millisecond?r(n)&&0!==n?(a=(.01*i.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},C.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new C(e.dayNumber,e.secondsOfDay,c.TAI):void 0},C.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},C.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},C.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(C.secondsDifference(e,t))<=n},C.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},C.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},C.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},C.computeTaiMinusUtc=function(e){g.julianDate=e;var n=C.leapSeconds,r=t(n,g,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},C.addSeconds=function(e,t,n){return h(e.dayNumber,e.secondsOfDay+t,n)},C.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return h(e.dayNumber,r,n)},C.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return h(e.dayNumber,r,n)},C.addDays=function(e,t,n){var r=e.dayNumber+t;return h(r,e.secondsOfDay,n)},C.lessThan=function(e,t){return C.compare(e,t)<0},C.lessThanOrEquals=function(e,t){return C.compare(e,t)<=0},C.greaterThan=function(e,t){return C.compare(e,t)>0},C.greaterThanOrEquals=function(e,t){return C.compare(e,t)>=0},C.prototype.clone=function(e){return C.clone(this,e)},C.prototype.equals=function(e){return C.equals(this,e)},C.prototype.equalsEpsilon=function(e,t){return C.equalsEpsilon(this,e,t)},C.prototype.toString=function(){return C.toIso8601(this)},C.leapSeconds=[new u(new C(2441317,43210,c.TAI),10),new u(new C(2441499,43211,c.TAI),11),new u(new C(2441683,43212,c.TAI),12),new u(new C(2442048,43213,c.TAI),13),new u(new C(2442413,43214,c.TAI),14),new u(new C(2442778,43215,c.TAI),15),new u(new C(2443144,43216,c.TAI),16),new u(new C(2443509,43217,c.TAI),17),new u(new C(2443874,43218,c.TAI),18),new u(new C(2444239,43219,c.TAI),19),new u(new C(2444786,43220,c.TAI),20),new u(new C(2445151,43221,c.TAI),21),new u(new C(2445516,43222,c.TAI),22),new u(new C(2446247,43223,c.TAI),23),new u(new C(2447161,43224,c.TAI),24),new u(new C(2447892,43225,c.TAI),25),new u(new C(2448257,43226,c.TAI),26),new u(new C(2448804,43227,c.TAI),27),new u(new C(2449169,43228,c.TAI),28),new u(new C(2449534,43229,c.TAI),29),new u(new C(2450083,43230,c.TAI),30),new u(new C(2450630,43231,c.TAI),31),new u(new C(2451179,43232,c.TAI),32),new u(new C(2453736,43233,c.TAI),33),new u(new C(2454832,43234,c.TAI),34),new u(new C(2456109,43235,c.TAI),35),new u(new C(2457204,43236,c.TAI),36)],C}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var a=new n.constructor;for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];r&&(o=t(o,r)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var a=n[r],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,a,i){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return r}function s(e,n){n=t(n,"");var a=e[1],i=!!e[2],s=e[3];switch(n){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s);return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,a=t(n.method,"GET"),i=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,a,i,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,f){var d=l.exec(e);if(null!==d)return c.resolve(s(d,t)),void 0;var h=new XMLHttpRequest;if(n(f)&&n(h.overrideMimeType)&&h.overrideMimeType(f),h.open(r,e,!0),n(u))for(var m in u)u.hasOwnProperty(m)&&h.setRequestHeader(m,u[m]);n(t)&&(h.responseType=t),h.onload=function(){200===h.status?n(h.response)?c.resolve(h.response):n(h.responseXML)&&h.responseXML.hasChildNodes()?c.resolve(h.responseXML):n(h.responseText)?c.resolve(h.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){c.reject(new a)},h.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(n,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,r(n,i).then(function(e){return JSON.parse(e) -})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function d(e,t){return o.compare(e.julianDate,t)}function h(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=n.columnNames.indexOf("modifiedJulianDateUtc"),i=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),h=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>h||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],M=y[x+p],_=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,O=new o(_,M,f.TAI);if(v.push(O),w){if(M!==g&&r(g)){var T=o.leapSeconds,R=t(T,O,d);if(0>R){var P=new u(O,M);T.splice(~R,0,P)}}g=M}}}function m(e,t,n,r,a){var i=n*r;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function p(e,t,n){return t+e*(n-t)}function y(e,t,n,r,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[a],l=t[i];if(c.equals(l)||r.equals(c))return m(e,n,a,s,u),u;if(r.equals(l))return m(e,n,i,s,u),u;var f=o.secondsDifference(r,c)/o.secondsDifference(l,c),d=a*s,h=i*s,y=n[d+e._ut1MinusUtcSecondsColumn],v=n[h+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=n[d+e._taiMinusUtcSecondsColumn],x=n[h+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(r)?y=v:v-=x-w)}return u.xPoleWander=p(f,n[d+e._xPoleWanderRadiansColumn],n[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(f,n[d+e._yPoleWanderRadiansColumn],n[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(f,n[d+e._xCelestialPoleOffsetRadiansColumn],n[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(f,n[d+e._yCelestialPoleOffsetRadiansColumn],n[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(f,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))h(this,t.data);else if(r(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){h(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new a(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var i=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var f=i[u],d=i[u+1],h=o.lessThanOrEquals(f,e),m=!r(d),p=m||o.greaterThanOrEquals(d,e);if(h&&p)return s=u,!m&&d.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,n),n}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),a=f.exec(r);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,d=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return d._cesiumScriptRegex=f,d.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},d}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t,n){var r=f;return r.dayNumber=t,r.secondsOfDay=n,i.daysDifference(r,e._sampleZeroDateTT)}function c(n,a){if(n._chunkDownloadsInProgress[a])return n._chunkDownloadsInProgress[a];var i=e.defer();n._chunkDownloadsInProgress[a]=i;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[a]=!1;for(var t=n._samples,r=e.samples,o=3*a*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];i.resolve()}),i.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new i(0,0,u.TAI);return l.prototype.preload=function(t,n,r,a){var i=s(this,t,n),o=s(this,r,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,d=0|l/this._samplesPerXysFile,h=[],m=f;d>=m;++m)h.push(c(this,m));return e.all(h)},l.prototype.computeXysRadians=function(e,t,n){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var d=!1,h=this._samples;if(r(h[3*l])||(c(this,0|l/this._samplesPerXysFile),d=!0),r(h[3*f])||(c(this,0|f/this._samplesPerXysFile),d=!0),d)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new a(0,0,0);var m,p,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var E=3*(l+m);n.x+=w[m]*h[E++],n.y+=w[m]*h[E++],n.s+=w[m]*h[E]}return n},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,r,a){var i=r/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,d=Math.cos(i);return n(a)?(a.x=u,a.y=l,a.z=f,a.w=d,a):new s(u,l,f,d)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var r,a,i,o,c,d=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=d+h+m;if(p>0)r=Math.sqrt(p+1),c=.5*r,r=.5/r,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;h>d&&(v=1),m>d&&m>h&&(v=2);var g=y[v],w=y[g];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,a=-x[0],i=-x[1],o=-x[2]}return n(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var d=new s;s.fromHeadingPitchRoll=function(t,n,r,a){var i=s.fromAxisAngle(e.UNIT_X,r,d),o=s.fromAxisAngle(e.UNIT_Y,-n,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,d);return s.multiply(u,a,a)};var h=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.x=e[r],a.y=e[r+1],a.z=e[r+2],a.w=e[r+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var a=0,i=n-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,h);var u=s.computeAngle(p);r[o]=h.x*u,r[o+1]=h.y*u,r[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,r,a,i,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*i,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,a=e.y*n,i=e.z*n,o=e.w*n;return t.x=r,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+r*l+a*c-i*s,d=o*s-r*c+a*l+i*u,h=o*c+r*s-a*u+i*l,m=o*l-r*u-a*s-i*c;return n.x=f,n.y=d,n.z=h,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,n,r){return g=s.multiplyByScalar(t,n,g),r=s.multiplyByScalar(e,1-n,r),s.add(g,r,r)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,n,r);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(i,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),a=0;return 0!==r&&(a=r/Math.sin(r)),e.multiplyByScalar(t,a,n)},s.exp=function(t,n){var r=e.magnitude(t),a=0;return 0!==r&&(a=Math.sin(r)/r),n.x=t.x*a,n.y=t.y*a,n.z=t.z*a,n.w=Math.cos(r),n};var S=new e,M=new e,_=new s,O=new s;s.computeInnerQuadrangle=function(t,n,r,a){var i=s.conjugate(n,_);s.multiply(i,r,O);var o=s.log(O,S);s.multiply(i,t,O);var u=s.log(O,M);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,_),s.multiply(n,_,a)},s.squad=function(e,t,n,r,a,i){var o=s.slerp(e,t,a,_),u=s.slerp(n,r,a,O);return s.slerp(o,u,2*a*(1-a),i)};for(var T=new s,R=1.9011074535173003,P=a.supportsTypedArrays()?new Float32Array(8):[],C=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],I=a.supportsTypedArrays()?new Float32Array(8):[],z=0;7>z;++z){var b=z+1,A=2*b+1;P[z]=1/(b*A),C[z]=b/A}return P[7]=R/136,C[7]=8*R/17,s.fastSlerp=function(e,t,n,r){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-n,c=n*n,l=u*u,f=7;f>=0;--f)N[f]=(P[f]*c-C[f])*o,I[f]=(P[f]*l-C[f])*o;var d=a*n*(1+N[0]*(1+N[1]*(1+N[2]*(1+N[3]*(1+N[4]*(1+N[5]*(1+N[6]*(1+N[7])))))))),h=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=s.multiplyByScalar(e,h,T);return s.multiplyByScalar(t,d,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,a,i){var o=s.fastSlerp(e,t,a,_),u=s.fastSlerp(n,r,a,O);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,a,i,o,u,s,c,l,f,d,h,m,p,y,v){"use strict";var g={},w=new n,x=new n,E=new n;g.eastNorthUpToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new n,M=new n,_=new n;g.northEastDownToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=M,l=_;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var O=new y,T=new n(1,1,1),R=new p;g.headingPitchRollToFixedFrame=function(e,t,r,a,i,o){var u=y.fromHeadingPitchRoll(t,r,a,O),s=p.fromTranslationQuaternionRotationScale(n.ZERO,u,T,R);return o=g.eastNorthUpToFixedFrame(e,i,o),p.multiply(o,s,o)};var P=new p,C=new m;g.headingPitchRollQuaternion=function(e,t,n,r,a,i){var o=g.headingPitchRollToFixedFrame(e,t,n,r,a,P),u=p.getRotation(o,C);return y.fromRotationMatrix(u,i)};var N=24110.54841,I=8640184.812866,z=.093104,b=-62e-7,A=1.1772758384668e-19,D=72921158553e-15,q=h.TWO_PI/86400,U=new d;g.computeTemeToPseudoFixedMatrix=function(e,t){U=d.addSeconds(e,-d.computeTaiMinusUtc(e),U);var n,r=U.dayNumber,a=U.secondsOfDay,o=r-2451545;n=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=N+n*(I+n*(z+n*b)),s=u*q%h.TWO_PI,c=D+A*(r-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,p=Math.cos(f),y=Math.sin(f);return i(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var L=32.184,B=2451545;g.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+L,a=t.stop.dayNumber,i=t.stop.secondsOfDay+L,o=g.iau2006XysData.preload(n,r,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new m);var n=g.computeFixedToIcrfMatrix(e,t);return i(n)?m.transpose(n,t):void 0};var W=new f(0,0,0),F=new s(0,0,0,0,0,0),G=new m,k=new m;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new m);var n=g.earthOrientationParameters.compute(e,F);if(!i(n))return void 0;var r=e.dayNumber,a=e.secondsOfDay+L,o=g.iau2006XysData.computeXysRadians(r,a,W);if(!i(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=m.fromRotationZ(-o.s,k),p=m.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-d.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*h.TWO_PI;var M=m.fromRotationZ(S,k),_=m.multiply(p,M,G),O=Math.cos(n.xPoleWander),T=Math.cos(n.yPoleWander),R=Math.sin(n.xPoleWander),P=Math.sin(n.yPoleWander),C=r-B+a/v.SECONDS_PER_DAY;C/=36525;var N=-47e-6*C*h.RADIANS_PER_DEGREE/3600,I=Math.cos(N),z=Math.sin(N),b=k;return b[0]=O*I,b[1]=O*z,b[2]=R,b[3]=-T*z+P*R*I,b[4]=T*I+P*R*z,b[5]=-P*O,b[6]=-P*z-T*R*I,b[7]=P*I-T*R*z,b[8]=T*O,m.multiply(_,b,t)};var j=new r;g.pointToWindowCoordinates=function(e,t,n,r){return r=g.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},g.pointToGLWindowCoordinates=function(e,n,a,o){i(o)||(o=new t);var u=j;return p.multiplyByVector(e,r.fromElements(a.x,a.y,a.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var Y=new n,H=new n,V=new n;return g.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=a(r,c.WGS84).geodeticSurfaceNormal(e,Y),s=n.cross(t,u,H);n.equalsEpsilon(s,n.ZERO,h.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,V);return n.cross(t,l,s),n.negate(s,s),i(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,f,d,h,m){"use strict";var p=new r,y=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(f.getColumn(r,0,p)),this._yAxis=n.fromCartesian4(f.getColumn(r,1,p));var i=n.fromCartesian4(f.getColumn(r,2,p));this._plane=d.fromPointNormal(e,i)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var g=new h,w=new n;y.prototype.projectPointOntoPlane=function(e,r){var a=g;a.origin=e,n.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,w);if(i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w)),i(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return i(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var n=0,r=e.length,a=0;r>a;a++){var o=this.projectPointOntoPlane(e[a],t[n]);i(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){i(r)||(r=new t);var a=g;a.origin=e,n.clone(this._plane.normal,a.direction);var o=c.rayPlane(a,this._plane,w);i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){i(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;i(t)?t.length=r:t=new Array(r);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var f=e[l];n.multiplyByScalar(u,f.x,c),i(t[l])||(t[l]=new n);var d=n.add(o,c,t[l]);n.multiplyByScalar(s,f.y,c),n.add(d,c,d),a.scaleToGeocentricSurface(d,d)}return t},y}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=new t,a=new t,i=new t,o=function(o,u,s,c,l){n(l)||(l=new t);var f,d,h,m,p,y,v,g;n(u.z)?(f=t.subtract(s,u,r),d=t.subtract(c,u,a),h=t.subtract(o,u,i),m=t.dot(f,f),p=t.dot(f,d),y=t.dot(f,h),v=t.dot(d,d),g=t.dot(d,h)):(f=e.subtract(s,u,r),d=e.subtract(c,u,a),h=e.subtract(o,u,i),m=e.dot(f,f),p=e.dot(f,d),y=e.dot(f,h),v=e.dot(d,d),g=e.dot(d,h));var w=1/(m*v-p*p);return l.y=(v*y-p*g)*w,l.z=(m*g-p*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var n=new t,r=function(t,r,a,i){return e(t,r,a,i,n),n.x>0&&n.y>0&&n.z>0};return r}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(e){var t=e._uSquared,n=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,a=(n-r)/n,i=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-a)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,i),f=s*o,d=f*f,h=1-d,m=Math.sqrt(h),p=t/4,y=p*p,v=y*p,g=y*y,w=1+p-3*y/4+5*v/4-175*g/64,x=1-p+15*y/8-35*v/8,E=1-3*p+35*y/4,S=1-5*p,M=w*l-x*Math.sin(2*l)*p/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,_=e._constants;_.a=n,_.b=r,_.f=a,_.cosineHeading=i,_.sineHeading=o,_.tanU=u,_.cosineU=s,_.sineU=c,_.sigma=l,_.sineAlpha=f,_.sineSquaredAlpha=d,_.cosineSquaredAlpha=h,_.cosineAlpha=m,_.u2Over4=p,_.u4Over16=y,_.u6Over64=v,_.u8Over256=g,_.a0=w,_.a1=x,_.a2=E,_.a3=S,_.distanceRatio=M}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,n,r,a,i,o){var u=c(e,n);return(1-u)*e*t*(r+u*a*(o+u*i*(2*o*o-1)))}function f(e,t,n,r,a,i,o){var s,c,f,d,h,m=(t-n)/t,p=i-r,y=Math.atan((1-m)*Math.tan(a)),v=Math.atan((1-m)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,M=g*E,_=w*E,O=w*x,T=p,R=u.TWO_PI,P=Math.cos(T),C=Math.sin(T);do{P=Math.cos(T),C=Math.sin(T);var N=M-O*P;f=Math.sqrt(x*x*C*C+N*N),c=_+S*P,s=Math.atan2(f,c);var I;0===f?(I=0,d=1):(I=S*C/f,d=1-I*I),R=T,h=c-2*_/d,isNaN(h)&&(h=0),T=p+l(m,I,d,s,f,c,h)}while(Math.abs(T-R)>u.EPSILON12);var z=d*(t*t-n*n)/(n*n),b=1+z*(4096+z*(z*(320-175*z)-768))/16384,A=z*(256+z*(z*(74-47*z)-128))/1024,D=h*h,q=A*f*(h+A*(c*(2*D-1)-A*h*(4*f*f-3)*(4*D-3)/6)/4),U=n*b*(s-q),L=Math.atan2(x*C,M-O*P),B=Math.atan2(g*C,M*P-O);e._distance=U,e._startHeading=L,e._endHeading=B,e._uSquared=z}function d(n,r,a,i){e.normalize(i.cartographicToCartesian(r,m),h),e.normalize(i.cartographicToCartesian(a,m),m),f(n,i.maximumRadius,i.minimumRadius,r.longitude,r.latitude,a.longitude,a.latitude),n._start=t.clone(r,n._start),n._end=t.clone(a,n._end),n._start.height=0,n._end.height=0,s(n)}var h=new e,m=new e,p=function(e,a,i){var u=n(i,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,r(e)&&r(a)&&d(this,e,a,u)};return a(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(e,t){d(this,e,t,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},p.prototype.interpolateUsingSurfaceDistance=function(e,n){var a=this._constants,i=a.distanceRatio+e/a.b,o=Math.cos(2*i),u=Math.cos(4*i),s=Math.cos(6*i),c=Math.sin(2*i),f=Math.sin(4*i),d=Math.sin(6*i),h=Math.sin(8*i),m=i*i,p=i*m,y=a.u8Over256,v=a.u2Over4,g=a.u6Over64,w=a.u4Over16,x=2*p*y*o/3+i*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*f-m*((g-11*y/2)*c+5*y*f/2)+(29*g/96-29*y/16)*d+539*y*h/1536,E=Math.asin(Math.sin(x)*a.cosineAlpha),S=Math.atan(a.a/a.b*Math.tan(E));x-=a.sigma;var M=Math.cos(2*a.sigma+x),_=Math.sin(x),O=Math.cos(x),T=a.cosineU*O,R=a.sineU*_,P=Math.atan2(_*a.sineHeading,T-R*a.cosineHeading),C=P-l(a.f,a.sineAlpha,a.cosineSquaredAlpha,x,_,O,M);return r(n)?(n.longitude=this._start.longitude+C,n.latitude=S,n.height=0,n):new t(this._start.longitude+C,S,0)},p}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function d(e,t,n){var r=_;r.length=e;var a;if(t===n){for(a=0;e>a;a++)r[a]=t;return r}var i=n-t,o=i/e;for(a=0;e>a;a++){var u=t+a*o;r[a]=u}return r}function h(t,n,r,a,i,o,u,s){var c=a.scaleToGeodeticSurface(t,P),l=a.scaleToGeodeticSurface(n,C),f=m.numberOfPoints(t,n,r),h=a.cartesianToCartographic(c,O),p=a.cartesianToCartographic(l,T),y=d(f,i,o);N.setEndPoints(h,p);var v=N.surfaceDistance/f,g=s;h.height=i;var w=a.cartographicToCartesian(h,R);e.pack(w,u,g),g+=3;for(var x=1;f>x;x++){var E=N.interpolateUsingSurfaceDistance(x*v,T);E.height=y[x],w=a.cartographicToCartesian(E,R),e.pack(w,u,g),g+=3}return g}var m={};m.numberOfPoints=function(t,n,r){var a=e.distance(t,n);return Math.ceil(a/r)};var p=new t;m.extractHeights=function(e,t){for(var n=e.length,r=new Array(n),a=0;n>a;a++){var i=e[a];r[a]=t.cartesianToCartographic(i,p).height}return r};var y=new l,v=new e,g=new e,w=new f(e.ZERO,0),x=new e,E=new f(e.ZERO,0),S=new e,M=new e,_=[],O=new t,T=new t,R=new e,P=new e,C=new e,N=new o;m.wrapLongitude=function(t,a){var i=[],o=[];if(r(t)&&t.length>0){a=n(a,l.IDENTITY);var s=l.inverseTransformation(a,y),c=l.multiplyByPoint(s,e.ZERO,v),d=l.multiplyByPointAsVector(s,e.UNIT_Y,g),h=f.fromPointNormal(c,d,w),m=l.multiplyByPointAsVector(s,e.UNIT_X,x),p=f.fromPointNormal(c,m,E),_=1;i.push(e.clone(t[0]));for(var O=i[0],T=t.length,R=1;T>R;++R){var P=t[R];if(f.getPointDistance(p,O)<0||f.getPointDistance(p,P)<0){var C=u.lineSegmentPlane(O,P,h,S);if(r(C)){var N=e.multiplyByScalar(d,5e-9,M);f.getPointDistance(h,O)<0&&e.negate(N,N),i.push(e.add(C,N,new e)),o.push(_+1),e.negate(N,N),i.push(e.add(C,N,new e)),_=1}}i.push(e.clone(t[R])),_++,O=P}o.push(_)}return{positions:i,lengths:o} -};var I=c.EPSILON7;return m.removeDuplicates=function(t){var n=t.length;if(2>n)return t;var r,a,i;for(r=1;n>r&&(a=t[r-1],i=t[r],!e.equalsEpsilon(a,i,I));++r);if(r===n)return t;for(var o=t.slice(0,r);n>r;++r)i=t[r],e.equalsEpsilon(a,i,I)||(o.push(e.clone(i)),a=i);return o},m.generateArc=function(t){r(t)||(t={});var a=t.positions,o=a.length,u=n(t.ellipsoid,i.WGS84),l=n(t.height,0);if(1>o)return[];if(1===o){var f=u.scaleToGeodeticSurface(a[0],P);if(0!==l){var d=u.geodeticSurfaceNormal(f,R);e.multiplyByScalar(d,l,d),e.add(f,d,f)}return[f.x,f.y,f.z]}var p=t.minDistance;if(!r(p)){var y=n(t.granularity,c.RADIANS_PER_DEGREE);p=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=m.numberOfPoints(a[v],a[v+1],p);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var M=a[v],T=a[v+1],C=S?l[v]:l,N=S?l[v+1]:l;E=h(M,T,p,u,C,N,x,E)}_.length=0;var I=a[o-1],z=u.cartesianToCartographic(I,O);z.height=S?l[o-1]:l;var b=u.cartographicToCartesian(z,R);return e.pack(b,x,w-3),x},m.generateCartesianArc=function(t){for(var n=m.generateArc(t),r=n.length/3,a=new Array(r),i=0;r>i;i++)a[i]=e.unpack(n,3*i);return a},m}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,n=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,n},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,n,r,a,i,o,u,s,c,l,f,d,h,m,p){"use strict";function y(t,n,r){var a=e.subtract(n,t,q),i=e.subtract(r,n,U);return a.x*i.y-a.y*i.x>=0}function v(e){for(var t=e[0].x,n=0,r=0;r<e.length;r++)e[r].x>t&&(t=e[r].x,n=r);return n}function g(e){for(var t=e[0][0].x,n=0,r=0;r<e.length;r++){var a=e[r][v(e[r])].x;a>t&&(t=a,n=r)}return n}function w(e){for(var t=[],n=0;n<e.length;n++){var r=e[(n-1+e.length)%e.length],a=e[n],i=e[(n+1)%e.length];y(r,a,i)||t.push(a)}return t}function x(t,n){for(var r=0;r<t.length;r++)if(e.equals(n,t[r]))return r;return-1}function E(n,a,i){i=r(i,[]);var o=Number.MAX_VALUE,u=v(a),s=new e(a[u].x,n.y);i.push(u),i.push((u+1)%a.length);for(var c=a[0].x,l=c,f=1;f<a.length;++f)a[f].x<c?c=a[f].x:a[f].x>l&&(l=a[f].x);l+=l-c;var d=new t(l,n.y,0);for(f=0;f<a.length;f++){var h=a[f],m=a[(f+1)%a.length];if((h.x>=n.x||m.x>=n.x)&&(h.y>=n.y&&m.y<=n.y||h.y<=n.y&&m.y>=n.y)){var p=(m.y-h.y)*(d.x-n.x)-(m.x-h.x)*(d.y-n.y);if(0!==p){p=1/p;var y=((m.x-h.x)*(n.y-h.y)-(m.y-h.y)*(n.x-h.x))*p,g=((d.x-n.x)*(n.y-h.y)-(d.y-n.y)*(n.x-h.x))*p;if(y>=0&&1>=y&&g>=0&&1>=g){var w=new e(n.x+y*(d.x-n.x),n.y+y*(d.y-n.y)),x=e.subtract(w,n,L);p=e.magnitudeSquared(x),o>p&&(s=w,o=p,i[0]=f,i[1]=(f+1)%a.length)}}}}return s}function S(t,n){var r=g(n),a=n[r],i=v(a),o=a[i],u=[],s=E(o,t,u),c=x(t,s);if(-1!==c)return c;var d=e.magnitudeSquared(e.subtract(t[u[0]],o,B)),h=e.magnitudeSquared(e.subtract(t[u[1]],o,B)),m=h>d?t[u[0]]:t[u[1]],p=w(t),y=p.indexOf(m);-1!==y&&p.splice(y,1);for(var S=[],M=0;M<p.length;M++){var _=p[M];f(_,o,s,m)&&S.push(_)}var O=Number.MAX_VALUE;if(S.length>0){var T=e.fromElements(1,0,B);for(M=0;M<S.length;M++){var R=e.subtract(S[M],o,W),P=e.magnitude(T)*e.magnitudeSquared(R);if(0!==P){var C=Math.abs(l.acosClamped(e.dot(T,R)/P));O>C&&(O=C,m=S[M])}}}return t.indexOf(m)}function M(e,n,r){for(var a=et.computeWindingOrder2D(e),i=0;i<n.length;i++){var o=n[i];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=et.computeWindingOrder2D(o);s===a&&o.reverse()}var c=u.fromPoints(e,r),l=c.projectPointsOntoPlane(e),f=[];for(i=0;i<n.length;i++)f.push(c.projectPointsOntoPlane(n[i]));var d=S(l,f),h=g(f),m=v(f[h]),p=n[h],y=[];for(i=0;i<e.length;i++)y.push(e[i]);var w,x=[];if(0!==m)for(w=0;w<=p.length;w++){var E=(w+m)%p.length;0!==E&&x.push(p[E])}else for(w=0;w<p.length;w++)x.push(p[(w+m)%p.length]);var M=y.lastIndexOf(e[d]);x.push(e[M]);var _=y.slice(0,M+1),O=y.slice(M+1);return y=_.concat(x,O),n.splice(h,1),y}function _(e){var t=l.nextRandomNumber(),n=Math.floor(t*e);return n===e&&n--,n}function O(e,t,n,r){var a=r[e].position,i=r[t].position,o=r[n].position,u=o.x,s=o.y,c=a.x-u,l=a.y-s,f=i.x-u,d=i.y-s;return c*d-l*f}function T(e,t){return e.x*t.y-e.y*t.x}function R(e,t){var n=t.length,r=l.mod(e-1,n),a=l.mod(e+1,n);return 0===O(r,a,e,t)?!1:!0}function P(t,n){return e.magnitudeSquared(n)<e.magnitudeSquared(t)}function C(t,n,r){if(!R(t,r))return t;var a=r[t].position,i=r[n].position,o=r.length,u=l.mod(t-1,o);if(!R(u,r))return u;var s=l.mod(t+1,o);if(!R(s,r))return s;var c=e.subtract(r[u].position,a,k),f=e.subtract(r[s].position,a,j),d=e.subtract(i,a,Y),h=T(c,d),m=T(f,d);if(0===h)return P(c,d)?F:G;if(0===m)return P(f,d)?F:G;var p=T(c,f);return 0>p?0>h&&m>0?F:G:p>0?h>0&&0>m?G:F:void 0}function N(e,t,n){return(e>t||e>n)&&(t>e||n>e)||t===n&&t===e}function I(t,n,r,a){var i=e.subtract(r,t,V),o=n.x*a.y-n.y*a.x,u=o*o,s=e.magnitudeSquared(n),c=e.magnitudeSquared(a);if(u>H*s*c){var l=(i.x*a.y-i.y*a.x)/o;return e.add(t,e.multiplyByScalar(n,l,V),V)}return void 0}function z(t,n,r){for(var i=e.subtract(n,t,X),o=r.length,u=0;o>u;u++){var s=r[u].position,c=r[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(n,c)||e.equals(t,c)||e.equals(n,s))){var f=e.subtract(c,s,Z),d=I(t,i,s,f);if(a(d)&&!(e.equals(d,t)||e.equals(d,n)||e.equals(d,s)||e.equals(d,c))){var h=d.x,m=d.y,p=N(h,t.x,n.x)&&N(m,t.y,n.y)&&N(h,s.x,c.x)&&N(m,s.y,c.y);if(p)return!0}}}return!1}function b(t,n,r){var a=C(t,n,r);if(a>=0)return a;var i=C(n,t,r);return i>=0?i:a!==F||i!==F||z(r[t].position,r[n].position,r)||e.equals(r[t].position,r[n].position)?K:J}function A(e){return 0===O(1,2,0,e)}function D(e){var t=e.length;if(3===t)return A(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new i("Invalid polygon: must have at least three vertices.");for(var n,r,a=0,o=10*e.length,u=K;J>u&&a++<o;){for(n=_(e.length),r=n+1;Math.abs(n-r)<2||Math.abs(n-r)>e.length-2;)r=_(e.length);if(n>r){var s=n;n=r,r=s}u=b(n,r,e)}if(u===J){var c=e.splice(n,r-n+1,e[n],e[r]);return D(e).concat(D(c))}return u>=0?(e.splice(u,1),D(e)):[]}var q=new e,U=new e,L=new e,B=new e(1,0),W=new e,F=-1,G=-2,k=new t,j=new t,Y=new t,H=l.EPSILON14,V=new e;new e;var X=new e,Z=new e,J=-1,K=-2,Q=new t,$=new t,et={};et.removeDuplicates=function(e){var n=d.removeDuplicates(e);return t.equals(n[0],n[n.length-1])?n.slice(1):n},et.computeArea2D=function(e){for(var t=e.length,n=0,r=t-1,a=0;t>a;r=a++){var i=e[r],o=e[a];n+=i.x*o.y-o.x*i.y}return.5*n},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?p.COUNTER_CLOCKWISE:p.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,n=[],r=0;t>r;++r)n[r]={position:e[r],index:r};return D(n)};var tt=new t,nt=new t,rt=new t,at=new t,it=new t,ot=new t,ut=new t;return et.computeSubdivision=function(e,i,o,u){u=r(u,l.RADIANS_PER_DEGREE);var f,d=o.slice(0),m=i.length,p=new Array(3*m),y=0;for(f=0;m>f;f++){var v=i[f];p[y++]=v.x,p[y++]=v.y,p[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;d.length>0;){var M,_,O=d.pop(),T=d.pop(),R=d.pop(),P=t.fromArray(p,3*R,tt),C=t.fromArray(p,3*T,nt),N=t.fromArray(p,3*O,rt),I=t.multiplyByScalar(t.normalize(P,at),x,at),z=t.multiplyByScalar(t.normalize(C,it),x,it),b=t.multiplyByScalar(t.normalize(N,ot),x,ot),A=t.magnitudeSquared(t.subtract(I,z,ut)),D=t.magnitudeSquared(t.subtract(z,b,ut)),q=t.magnitudeSquared(t.subtract(b,I,ut)),U=Math.max(A,D,q);U>S?A===U?(M=Math.min(R,T)+" "+Math.max(R,T),f=w[M],a(f)||(_=t.add(P,C,ut),t.multiplyByScalar(_,.5,_),p.push(_.x,_.y,_.z),f=p.length/3-1,w[M]=f),d.push(R,f,O),d.push(f,T,O)):D===U?(M=Math.min(T,O)+" "+Math.max(T,O),f=w[M],a(f)||(_=t.add(C,N,ut),t.multiplyByScalar(_,.5,_),p.push(_.x,_.y,_.z),f=p.length/3-1,w[M]=f),d.push(T,f,R),d.push(f,O,R)):q===U&&(M=Math.min(O,R)+" "+Math.max(O,R),f=w[M],a(f)||(_=t.add(N,P,ut),t.multiplyByScalar(_,.5,_),p.push(_.x,_.y,_.z),f=p.length/3-1,w[M]=f),d.push(O,f,T),d.push(f,R,T)):(g.push(R),g.push(T),g.push(O))}return new s({attributes:{position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:p})},indices:g,primitiveType:h.TRIANGLES})},et.scaleToGeodeticHeight=function(e,n,i,u){i=r(i,o.WGS84);var s=Q,c=$;if(n=r(n,0),u=r(u,!0),a(e)&&a(e.attributes)&&a(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,d=0;f>d;d+=3)t.fromArray(l,d,c),u&&(c=i.scaleToGeodeticSurface(c,c)),s=i.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,n,s),t.add(c,s,c),l[d]=c.x,l[d+1]=c.y,l[d+2]=c.z;return e},et.eliminateHoles=function(e,n,a){a=r(a,o.WGS84);for(var i=[],u=0;u<n.length;u++){for(var s=[],c=0;c<n[u].length;c++)s.push(t.clone(n[u][c]));i.push(s)}for(var l=e;i.length>0;)l=M(l,i,a);return l},et}),define("Core/Matrix2",["./Cartesian2","./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r,a){"use strict";var i=function(e,n,r,a){this[0]=t(e,0),this[1]=t(r,0),this[2]=t(n,0),this[3]=t(a,0)};i.packedLength=4,i.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3]},i.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new i),a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++],a},i.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new i(e[0],e[2],e[1],e[3]):void 0},i.fromArray=function(e,r,a){return r=t(r,0),n(a)||(a=new i),a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],a},i.fromColumnMajorArray=function(e,t){return i.clone(e,t)},i.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new i(e[0],e[1],e[2],e[3])},i.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new i(e.x,0,0,e.y)},i.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new i(e,0,0,e)},i.fromRotation=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=a,t[2]=-a,t[3]=r,t):new i(r,-a,a,r)},i.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]},i.getElementIndex=function(e,t){return 2*e+t},i.getColumn=function(e,t,n){var r=2*t,a=e[r],i=e[r+1];return n.x=a,n.y=i,n},i.setColumn=function(e,t,n,r){r=i.clone(e,r);var a=2*t;return r[a]=n.x,r[a+1]=n.y,r},i.getRow=function(e,t,n){var r=e[t],a=e[t+2];return n.x=r,n.y=a,n},i.setRow=function(e,t,n,r){return r=i.clone(e,r),r[t]=n.x,r[t+2]=n.y,r};var o=new e;i.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],o)),n.y=e.magnitude(e.fromElements(t[2],t[3],o)),n};var u=new e;return i.getMaximumScale=function(t){return i.getScale(t,u),e.maximumComponent(u)},i.multiply=function(e,t,n){var r=e[0]*t[0]+e[2]*t[1],a=e[0]*t[2]+e[2]*t[3],i=e[1]*t[0]+e[3]*t[1],o=e[1]*t[2]+e[3]*t[3];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n},i.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n},i.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n},i.multiplyByVector=function(e,t,n){var r=e[0]*t.x+e[2]*t.y,a=e[1]*t.x+e[3]*t.y;return n.x=r,n.y=a,n},i.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n},i.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n},i.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.transpose=function(e,t){var n=e[0],r=e[2],a=e[1],i=e[3];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t},i.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},i.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},i.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]},i.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r},i.IDENTITY=a(new i(1,0,0,1)),i.ZERO=a(new i(0,0,0,0)),i.COLUMN0ROW0=0,i.COLUMN0ROW1=1,i.COLUMN1ROW0=2,i.COLUMN1ROW1=3,i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n"+"("+this[1]+", "+this[3]+")"},i}),define("Core/RectangleGeometryLibrary",["./Cartesian3","./Cartographic","./defined","./DeveloperError","./GeographicProjection","./Math","./Matrix2","./Rectangle"],function(e,t,n,r,a,i,o,u){"use strict";var s=Math.cos,c=Math.sin,l=Math.sqrt,f={};f.computePosition=function(e,t,r,a,i){var u=e.ellipsoid.radiiSquared,f=e.nwCorner,d=e.rectangle,h=f.latitude-e.granYCos*t+r*e.granXSin,m=s(h),p=c(h),y=u.z*p,v=f.longitude+t*e.granYSin+r*e.granXCos,g=m*s(v),w=m*c(v),x=u.x*g,E=u.y*w,S=l(x*g+E*w+y*p);a.x=x/S,a.y=E/S,a.z=y/S,n(e.vertexFormat)&&e.vertexFormat.st&&(i.x=(v-d.west)*e.lonScalar-.5,i.y=(h-d.south)*e.latScalar-.5,o.multiplyByVector(e.textureMatrix,i,i),i.x+=.5,i.y+=.5)};var d=new o,h=new e,m=new t,p=new e,y=new a;return f.computeOptions=function(t,a,s){var c,l,f,v,g,w=t._granularity,x=t._ellipsoid,E=t._surfaceHeight,S=t._rotation,M=t._extrudedHeight,_=a.east,O=a.west,T=a.north,R=a.south,P=T-R;O>_?(g=i.TWO_PI-O+_,c=Math.ceil(g/w)+1,l=Math.ceil(P/w)+1,f=g/(c-1),v=P/(l-1)):(g=_-O,c=Math.ceil(g/w)+1,l=Math.ceil(P/w)+1,f=g/(c-1),v=P/(l-1)),s=u.northwest(a,s);var C=u.center(a,m),N=v,I=f,z=0,b=0;if(n(S)){var A=Math.cos(S);N*=A,I*=A;var D=Math.sin(S);z=v*D,b=f*D,h=y.project(s,h),p=y.project(C,p),h=e.subtract(h,p,h);var q=o.fromRotation(S,d);h=o.multiplyByVector(q,h,h),h=e.add(h,p,h),s=y.unproject(h,s);var U=s.latitude,L=U+(c-1)*b,B=U-N*(l-1),W=U-N*(l-1)+(c-1)*b;T=Math.max(U,L,B,W),R=Math.min(U,L,B,W);var F=s.longitude,G=F+(c-1)*I,k=F+(l-1)*z,j=F+(l-1)*z+(c-1)*I;if(_=Math.max(F,G,k,j),O=Math.min(F,G,k,j),T<-i.PI_OVER_TWO||T>i.PI_OVER_TWO||R<-i.PI_OVER_TWO||R>i.PI_OVER_TWO)throw new r("Rotated extent is invalid.");a.north=T,a.south=R,a.east=_,a.west=O}return{granYCos:N,granYSin:z,granXCos:I,granXSin:b,ellipsoid:x,width:c,height:l,surfaceHeight:E,extrudedHeight:M,nwCorner:s,rectangle:a}},f}),define("Core/RectangleOutlineGeometry",["./BoundingSphere","./Cartesian3","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolygonPipeline","./PrimitiveType","./Rectangle","./RectangleGeometryLibrary"],function(e,t,n,r,a,i,o,u,s,c,l,f,d,h,m,p,y){"use strict";function v(e){var t,n=e.size,a=e.height,i=e.width,o=new Float64Array(3*n),u=0,d=0,h=E;for(t=0;i>t;t++)y.computePosition(e,d,t,h),o[u++]=h.x,o[u++]=h.y,o[u++]=h.z;for(t=i-1,d=1;a>d;d++)y.computePosition(e,d,t,h),o[u++]=h.x,o[u++]=h.y,o[u++]=h.z;for(d=a-1,t=i-2;t>=0;t--)y.computePosition(e,d,t,h),o[u++]=h.x,o[u++]=h.y,o[u++]=h.z;for(t=0,d=a-2;d>0;d--)y.computePosition(e,d,t,h),o[u++]=h.x,o[u++]=h.y,o[u++]=h.z;for(var p=2*(o.length/3),v=f.createTypedArray(o.length/3,p),g=0,w=0;w<o.length/3-1;w++)v[g++]=w,v[g++]=w+1;v[g++]=o.length/3-1,v[g++]=0;var x=new s({attributes:new l,primitiveType:m.LINES});return x.attributes.position=new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:o}),x.indices=v,x}function g(e){var t=e.surfaceHeight,n=e.extrudedHeight,r=e.ellipsoid,a=Math.min(n,t),i=Math.max(n,t),o=v(e);if(d.equalsEpsilon(a,i,.1))return o;var u=e.height,s=e.width;o=h.scaleToGeodeticHeight(o,i,r,!1);var c=o.attributes.position.values,l=c.length,m=new Float64Array(2*l);m.set(c),o=h.scaleToGeodeticHeight(o,a,r);var p=o.attributes.position.values;m.set(p,l),o.attributes.position.values=m;var y=2*(m.length/3)+8,g=f.createTypedArray(m.length/3,y);l=m.length/6;for(var w=0,x=0;l-1>x;x++)g[w++]=x,g[w++]=x+1,g[w++]=x+l,g[w++]=x+l+1;return g[w++]=l-1,g[w++]=0,g[w++]=l+l-1,g[w++]=l,g[w++]=0,g[w++]=l,g[w++]=s-1,g[w++]=l+s-1,g[w++]=s+u-2,g[w++]=s+u-2+l,g[w++]=2*s+u-3,g[w++]=2*s+u-3+l,o.indices=g,o}var w=new e,x=new e,E=new t,S=new p,M=function(e){e=a(e,a.EMPTY_OBJECT);var t=e.rectangle,n=a(e.granularity,d.RADIANS_PER_DEGREE),r=a(e.ellipsoid,u.WGS84),i=a(e.height,0),o=a(e.rotation,0),s=e.extrudedHeight;this._rectangle=t,this._granularity=n,this._ellipsoid=r,this._surfaceHeight=i,this._rotation=o,this._extrudedHeight=s,this._workerName="createRectangleOutlineGeometry"};M.packedLength=p.packedLength+u.packedLength+5,M.pack=function(e,t,n){n=a(n,0),p.pack(e._rectangle,t,n),n+=p.packedLength,u.pack(e._ellipsoid,t,n),n+=u.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=i(e._extrudedHeight)?1:0,t[n]=a(e._extrudedHeight,0)};var _=new p,O=u.clone(u.UNIT_SPHERE),T={rectangle:_,ellipsoid:O,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0};M.unpack=function(e,t,n){t=a(t,0);var r=p.unpack(e,t,_);t+=p.packedLength;var o=u.unpack(e,t,O);t+=u.packedLength;var s=e[t++],c=e[t++],l=e[t++],f=e[t++],d=e[t];return i(n)?(n._rectangle=p.clone(r,n._rectangle),n._ellipsoid=u.clone(o,n._ellipsoid),n._surfaceHeight=c,n._rotation=l,n._extrudedHeight=f?d:void 0,n):(T.granularity=s,T.height=c,T.rotation=l,T.extrudedHeight=f?d:void 0,new M(T))};var R=new n;return M.createGeometry=function(t){var n=p.clone(t._rectangle,S),r=t._ellipsoid,a=t._surfaceHeight,o=t._extrudedHeight,u=y.computeOptions(t,n,R);u.size=2*u.width+2*u.height-4;var c,l;if(n=t._rectangle,i(o)){c=g(u);var f=e.fromRectangle3D(n,r,a,x),d=e.fromRectangle3D(n,r,o,w);l=e.union(f,d)}else c=v(u),c=h.scaleToGeodeticHeight(c,a,r,!1),l=e.fromRectangle3D(n,r,a);return new s({attributes:c.attributes,indices:c.indices,primitiveType:m.LINES,boundingSphere:l})},M}),define("Workers/createRectangleOutlineGeometry",["../Core/defined","../Core/Ellipsoid","../Core/Rectangle","../Core/RectangleOutlineGeometry"],function(e,t,n,r){"use strict";function a(a,i){return e(i)&&(a=r.unpack(a,i)),a._ellipsoid=t.clone(a._ellipsoid),a._rectangle=n.clone(a._rectangle),r.createGeometry(a)}return a})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createSimplePolylineGeometry.js b/libs/Cesium/Workers/createSimplePolylineGeometry.js deleted file mode 100644 index 6750a3bb..00000000 --- a/libs/Cesium/Workers/createSimplePolylineGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var r=Object.freeze;return t(r)||(r=function(t){return t}),r}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var r=function(t,r){return void 0!==t?t:r};return r.EMPTY_OBJECT=t({}),r}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var r=function(t){this.name="DeveloperError",this.message=t;var r;try{throw new Error}catch(e){r=e.stack}this.stack=r};return r.prototype.toString=function(){var r=this.name+": "+this.message;return t(this.stack)&&(r+="\n"+this.stack.toString()),r},r.throwInstantiationError=function(){throw new r("This function defines an interface and should not be called directly.")},r}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,r=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var e;for(this.mti==this.N+1&&this.init_genrand(5489),e=0;e<this.N-this.M;e++)t=this.mt[e]&this.UPPER_MASK|this.mt[e+1]&this.LOWER_MASK,this.mt[e]=this.mt[e+this.M]^t>>>1^r[1&t];for(;e<this.N-1;e++)t=this.mt[e]&this.UPPER_MASK|this.mt[e+1]&this.LOWER_MASK,this.mt[e]=this.mt[e+(this.M-this.N)]^t>>>1^r[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^r[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,r){"use strict";var e={};e.EPSILON1=.1,e.EPSILON2=.01,e.EPSILON3=.001,e.EPSILON4=1e-4,e.EPSILON5=1e-5,e.EPSILON6=1e-6,e.EPSILON7=1e-7,e.EPSILON8=1e-8,e.EPSILON9=1e-9,e.EPSILON10=1e-10,e.EPSILON11=1e-11,e.EPSILON12=1e-12,e.EPSILON13=1e-13,e.EPSILON14=1e-14,e.EPSILON15=1e-15,e.EPSILON16=1e-16,e.EPSILON17=1e-17,e.EPSILON18=1e-18,e.EPSILON19=1e-19,e.EPSILON20=1e-20,e.GRAVITATIONALPARAMETER=3986004418e5,e.SOLAR_RADIUS=6955e5,e.LUNAR_RADIUS=1737400,e.SIXTY_FOUR_KILOBYTES=65536,e.sign=function(t){return t>0?1:0>t?-1:0},e.signNotZero=function(t){return 0>t?-1:1},e.toSNorm=function(t){return Math.round(255*(.5*e.clamp(t,-1,1)+.5))},e.fromSNorm=function(t){return 2*(e.clamp(t,0,255)/255)-1},e.sinh=function(t){var r=Math.pow(Math.E,t),e=Math.pow(Math.E,-1*t);return.5*(r-e)},e.cosh=function(t){var r=Math.pow(Math.E,t),e=Math.pow(Math.E,-1*t);return.5*(r+e)},e.lerp=function(t,r,e){return(1-e)*t+e*r},e.PI=Math.PI,e.ONE_OVER_PI=1/Math.PI,e.PI_OVER_TWO=.5*Math.PI,e.PI_OVER_THREE=Math.PI/3,e.PI_OVER_FOUR=Math.PI/4,e.PI_OVER_SIX=Math.PI/6,e.THREE_PI_OVER_TWO=.5*3*Math.PI,e.TWO_PI=2*Math.PI,e.ONE_OVER_TWO_PI=1/(2*Math.PI),e.RADIANS_PER_DEGREE=Math.PI/180,e.DEGREES_PER_RADIAN=180/Math.PI,e.RADIANS_PER_ARCSECOND=e.RADIANS_PER_DEGREE/3600,e.toRadians=function(t){return t*e.RADIANS_PER_DEGREE},e.toDegrees=function(t){return t*e.DEGREES_PER_RADIAN},e.convertLongitudeRange=function(t){var r=e.TWO_PI,n=t-Math.floor(t/r)*r;return n<-Math.PI?n+r:n>=Math.PI?n-r:n},e.negativePiToPi=function(t){return e.zeroToTwoPi(t+e.PI)-e.PI},e.zeroToTwoPi=function(t){var r=e.mod(t,e.TWO_PI);return Math.abs(r)<e.EPSILON14&&Math.abs(t)>e.EPSILON14?e.TWO_PI:r},e.mod=function(t,r){return(t%r+r)%r},e.equalsEpsilon=function(t,e,n,o){o=r(o,n);var i=Math.abs(t-e);return o>=i||i<=n*Math.max(Math.abs(t),Math.abs(e))};var n=[1];e.factorial=function(t){var r=n.length;if(t>=r)for(var e=n[r-1],o=r;t>=o;o++)n.push(e*o);return n[t]},e.incrementWrap=function(t,e,n){return n=r(n,0),++t,t>e&&(t=n),t},e.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},e.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},e.clamp=function(t,r,e){return r>t?r:t>e?e:t};var o=new t;return e.setRandomNumberSeed=function(r){o=new t(r)},e.nextRandomNumber=function(){return o.random()},e.acosClamped=function(t){return Math.acos(e.clamp(t,-1,1))},e.asinClamped=function(t){return Math.asin(e.clamp(t,-1,1))},e.chordLength=function(t,r){return 2*r*Math.sin(.5*t)},e}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o){"use strict";var i=function(r,e,n){this.x=t(r,0),this.y=t(e,0),this.z=t(n,0)};i.fromSpherical=function(e,n){r(n)||(n=new i);var o=e.clock,a=e.cone,s=t(e.magnitude,1),u=s*Math.sin(a);return n.x=u*Math.cos(o),n.y=u*Math.sin(o),n.z=s*Math.cos(a),n},i.fromElements=function(t,e,n,o){return r(o)?(o.x=t,o.y=e,o.z=n,o):new i(t,e,n)},i.clone=function(t,e){return r(t)?r(e)?(e.x=t.x,e.y=t.y,e.z=t.z,e):new i(t.x,t.y,t.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(r,e,n){n=t(n,0),e[n++]=r.x,e[n++]=r.y,e[n]=r.z},i.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new i),o.x=e[n++],o.y=e[n++],o.z=e[n],o},i.fromArray=i.unpack,i.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},i.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},i.minimumByComponent=function(t,r,e){return e.x=Math.min(t.x,r.x),e.y=Math.min(t.y,r.y),e.z=Math.min(t.z,r.z),e},i.maximumByComponent=function(t,r,e){return e.x=Math.max(t.x,r.x),e.y=Math.max(t.y,r.y),e.z=Math.max(t.z,r.z),e},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},i.magnitude=function(t){return Math.sqrt(i.magnitudeSquared(t))};var a=new i;i.distance=function(t,r){return i.subtract(t,r,a),i.magnitude(a)},i.distanceSquared=function(t,r){return i.subtract(t,r,a),i.magnitudeSquared(a)},i.normalize=function(t,r){var e=i.magnitude(t);return r.x=t.x/e,r.y=t.y/e,r.z=t.z/e,r},i.dot=function(t,r){return t.x*r.x+t.y*r.y+t.z*r.z},i.multiplyComponents=function(t,r,e){return e.x=t.x*r.x,e.y=t.y*r.y,e.z=t.z*r.z,e},i.add=function(t,r,e){return e.x=t.x+r.x,e.y=t.y+r.y,e.z=t.z+r.z,e},i.subtract=function(t,r,e){return e.x=t.x-r.x,e.y=t.y-r.y,e.z=t.z-r.z,e},i.multiplyByScalar=function(t,r,e){return e.x=t.x*r,e.y=t.y*r,e.z=t.z*r,e},i.divideByScalar=function(t,r,e){return e.x=t.x/r,e.y=t.y/r,e.z=t.z/r,e},i.negate=function(t,r){return r.x=-t.x,r.y=-t.y,r.z=-t.z,r},i.abs=function(t,r){return r.x=Math.abs(t.x),r.y=Math.abs(t.y),r.z=Math.abs(t.z),r};var s=new i;i.lerp=function(t,r,e,n){return i.multiplyByScalar(r,e,s),n=i.multiplyByScalar(t,1-e,n),i.add(s,n,n)};var u=new i,l=new i;i.angleBetween=function(t,r){i.normalize(t,u),i.normalize(r,l);var e=i.dot(u,l),n=i.magnitude(i.cross(u,l,u));return Math.atan2(n,e)};var c=new i;i.mostOrthogonalAxis=function(t,r){var e=i.normalize(t,c);return i.abs(e,e),r=e.x<=e.y?e.x<=e.z?i.clone(i.UNIT_X,r):i.clone(i.UNIT_Z,r):e.y<=e.z?i.clone(i.UNIT_Y,r):i.clone(i.UNIT_Z,r)},i.equals=function(t,e){return t===e||r(t)&&r(e)&&t.x===e.x&&t.y===e.y&&t.z===e.z},i.equalsArray=function(t,r,e){return t.x===r[e]&&t.y===r[e+1]&&t.z===r[e+2]},i.equalsEpsilon=function(t,e,n,i){return t===e||r(t)&&r(e)&&o.equalsEpsilon(t.x,e.x,n,i)&&o.equalsEpsilon(t.y,e.y,n,i)&&o.equalsEpsilon(t.z,e.z,n,i)},i.cross=function(t,r,e){var n=t.x,o=t.y,i=t.z,a=r.x,s=r.y,u=r.z,l=o*u-i*s,c=i*a-n*u,f=n*s-o*a;return e.x=l,e.y=c,e.z=f,e},i.fromDegrees=function(t,r,e,n,a){var s=o.toRadians(t),u=o.toRadians(r);return i.fromRadians(s,u,e,n,a)};var f=new i,h=new i,d=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(e,n,o,a,s){o=t(o,0);var u=r(a)?a.radiiSquared:d,l=Math.cos(n);f.x=l*Math.cos(e),f.y=l*Math.sin(e),f.z=Math.sin(n),f=i.normalize(f,f),i.multiplyComponents(u,f,h);var c=Math.sqrt(i.dot(f,h));return h=i.divideByScalar(h,c,h),f=i.multiplyByScalar(f,o,f),r(s)||(s=new i),i.add(h,f,s)},i.fromDegreesArray=function(t,r,e){for(var n=new Array(t.length),a=0;a<t.length;a++)n[a]=o.toRadians(t[a]);return i.fromRadiansArray(n,r,e)},i.fromRadiansArray=function(t,e,n){var o=t.length;r(n)?n.length=o/2:n=new Array(o/2);for(var a=0;o>a;a+=2){var s=t[a],u=t[a+1];n[a/2]=i.fromRadians(s,u,0,e,n[a/2])}return n},i.fromDegreesArrayHeights=function(t,r,e){for(var n=new Array(t.length),a=0;a<t.length;a+=3)n[a]=o.toRadians(t[a]),n[a+1]=o.toRadians(t[a+1]),n[a+2]=t[a+2];return i.fromRadiansArrayHeights(n,r,e)},i.fromRadiansArrayHeights=function(t,e,n){var o=t.length;r(n)?n.length=o/3:n=new Array(o/3);for(var a=0;o>a;a+=3){var s=t[a],u=t[a+1],l=t[a+2];n[a/3]=i.fromRadians(s,u,l,e,n[a/3])}return n},i.ZERO=n(new i(0,0,0)),i.UNIT_X=n(new i(1,0,0)),i.UNIT_Y=n(new i(0,1,0)),i.UNIT_Z=n(new i(0,0,1)),i.prototype.clone=function(t){return i.clone(this,t)},i.prototype.equals=function(t){return i.equals(this,t)},i.prototype.equalsEpsilon=function(t,r,e){return i.equalsEpsilon(this,t,r,e)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o){"use strict";var i=function(r,e,n){this.longitude=t(r,0),this.latitude=t(e,0),this.height=t(n,0)};return i.fromRadians=function(e,n,o,a){return o=t(o,0),r(a)?(a.longitude=e,a.latitude=n,a.height=o,a):new i(e,n,o)},i.fromDegrees=function(t,r,e,n){return t=o.toRadians(t),r=o.toRadians(r),i.fromRadians(t,r,e,n)},i.clone=function(t,e){return r(t)?r(e)?(e.longitude=t.longitude,e.latitude=t.latitude,e.height=t.height,e):new i(t.longitude,t.latitude,t.height):void 0},i.equals=function(t,e){return t===e||r(t)&&r(e)&&t.longitude===e.longitude&&t.latitude===e.latitude&&t.height===e.height},i.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t.longitude-e.longitude)<=n&&Math.abs(t.latitude-e.latitude)<=n&&Math.abs(t.height-e.height)<=n},i.ZERO=n(new i(0,0,0)),i.prototype.clone=function(t){return i.clone(this,t)},i.prototype.equals=function(t){return i.equals(this,t)},i.prototype.equalsEpsilon=function(t,r){return i.equalsEpsilon(this,t,r)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(t){"use strict";var r=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),e=Object.defineProperties;return r&&t(e)||(e=function(t){return t}),e}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o,i,a,s){"use strict";function u(r,n,o,i){n=e(n,0),o=e(o,0),i=e(i,0),r._radii=new t(n,o,i),r._radiiSquared=new t(n*n,o*o,i*i),r._radiiToTheFourth=new t(n*n*n*n,o*o*o*o,i*i*i*i),r._oneOverRadii=new t(0===n?0:1/n,0===o?0:1/o,0===i?0:1/i),r._oneOverRadiiSquared=new t(0===n?0:1/(n*n),0===o?0:1/(o*o),0===i?0:1/(i*i)),r._minimumRadius=Math.min(n,o,i),r._maximumRadius=Math.max(n,o,i),r._centerToleranceSquared=s.EPSILON1}var l=function(t,r,e){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,u(this,t,r,e)};o(l.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),l.clone=function(r,e){if(!n(r))return void 0;var o=r._radii;return n(e)?(t.clone(o,e._radii),t.clone(r._radiiSquared,e._radiiSquared),t.clone(r._radiiToTheFourth,e._radiiToTheFourth),t.clone(r._oneOverRadii,e._oneOverRadii),t.clone(r._oneOverRadiiSquared,e._oneOverRadiiSquared),e._minimumRadius=r._minimumRadius,e._maximumRadius=r._maximumRadius,e._centerToleranceSquared=r._centerToleranceSquared,e):new l(o.x,o.y,o.z)},l.fromCartesian3=function(t,r){return n(r)||(r=new l),n(t)?(u(r,t.x,t.y,t.z),r):r},l.WGS84=a(new l(6378137,6378137,6356752.314245179)),l.UNIT_SPHERE=a(new l(1,1,1)),l.MOON=a(new l(s.LUNAR_RADIUS,s.LUNAR_RADIUS,s.LUNAR_RADIUS)),l.prototype.clone=function(t){return l.clone(this,t)},l.packedLength=t.packedLength,l.pack=function(r,n,o){o=e(o,0),t.pack(r._radii,n,o)},l.unpack=function(r,n,o){n=e(n,0);var i=t.unpack(r,n);return l.fromCartesian3(i,o)},l.prototype.geocentricSurfaceNormal=t.normalize,l.prototype.geodeticSurfaceNormalCartographic=function(r,e){var o=r.longitude,i=r.latitude,a=Math.cos(i),s=a*Math.cos(o),u=a*Math.sin(o),l=Math.sin(i);return n(e)||(e=new t),e.x=s,e.y=u,e.z=l,t.normalize(e,e)},l.prototype.geodeticSurfaceNormal=function(r,e){return n(e)||(e=new t),e=t.multiplyComponents(r,this._oneOverRadiiSquared,e),t.normalize(e,e)};var c=new t,f=new t;l.prototype.cartographicToCartesian=function(r,e){var o=c,i=f;this.geodeticSurfaceNormalCartographic(r,o),t.multiplyComponents(this._radiiSquared,o,i);var a=Math.sqrt(t.dot(o,i));return t.divideByScalar(i,a,i),t.multiplyByScalar(o,r.height,o),n(e)||(e=new t),t.add(i,o,e)},l.prototype.cartographicArrayToCartesianArray=function(t,r){var e=t.length;n(r)?r.length=e:r=new Array(e);for(var o=0;e>o;o++)r[o]=this.cartographicToCartesian(t[o],r[o]);return r};var h=new t,d=new t,m=new t;l.prototype.cartesianToCartographic=function(e,o){var i=this.scaleToGeodeticSurface(e,d);if(!n(i))return void 0;var a=this.geodeticSurfaceNormal(i,h),u=t.subtract(e,i,m),l=Math.atan2(a.y,a.x),c=Math.asin(a.z),f=s.sign(t.dot(u,e))*t.magnitude(u);return n(o)?(o.longitude=l,o.latitude=c,o.height=f,o):new r(l,c,f)},l.prototype.cartesianArrayToCartographicArray=function(t,r){var e=t.length;n(r)?r.length=e:r=new Array(e);for(var o=0;e>o;++o)r[o]=this.cartesianToCartographic(t[o],r[o]);return r};var p=new t,g=new t;return l.prototype.scaleToGeodeticSurface=function(r,e){var o=r.x,i=r.y,a=r.z,u=this._oneOverRadii,l=u.x,c=u.y,f=u.z,h=o*o*l*l,d=i*i*c*c,m=a*a*f*f,y=h+d+m,E=Math.sqrt(1/y),v=t.multiplyByScalar(r,E,p);if(y<this._centerToleranceSquared)return isFinite(E)?t.clone(v,e):void 0;var C=this._oneOverRadiiSquared,S=C.x,w=C.y,M=C.z,R=g;R.x=2*v.x*S,R.y=2*v.y*w,R.z=2*v.z*M;var A,O,T,I,N,x,_,L,b,P,F,z=(1-E)*t.magnitude(r)/(.5*t.magnitude(R)),D=0;do{z-=D,T=1/(1+z*S),I=1/(1+z*w),N=1/(1+z*M),x=T*T,_=I*I,L=N*N,b=x*T,P=_*I,F=L*N,A=h*x+d*_+m*L-1,O=h*b*S+d*P*w+m*F*M;var B=-2*O;D=A/B}while(Math.abs(A)>s.EPSILON12);return n(e)?(e.x=o*T,e.y=i*I,e.z=a*N,e):new t(o*T,i*I,a*N)},l.prototype.scaleToGeocentricSurface=function(r,e){n(e)||(e=new t);var o=r.x,i=r.y,a=r.z,s=this._oneOverRadiiSquared,u=1/Math.sqrt(o*o*s.x+i*i*s.y+a*a*s.z);return t.multiplyByScalar(r,u,e)},l.prototype.transformPositionToScaledSpace=function(r,e){return n(e)||(e=new t),t.multiplyComponents(r,this._oneOverRadii,e)},l.prototype.transformPositionFromScaledSpace=function(r,e){return n(e)||(e=new t),t.multiplyComponents(r,this._radii,e)},l.prototype.equals=function(r){return this===r||n(r)&&t.equals(this._radii,r._radii)},l.prototype.toString=function(){return this._radii.toString()},l}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var r={},e=function(e,n){t(r[e])||(r[e]=!0,console.log(n))};return e}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,r,e,n,o,i,a){"use strict";var s=function(t){this._ellipsoid=e(t,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return o(s.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),s.prototype.project=function(r,e){var o=this._semimajorAxis,i=r.longitude*o,a=r.latitude*o,s=r.height;return n(e)?(e.x=i,e.y=a,e.z=s,e):new t(i,a,s)},s.prototype.unproject=function(t,e){var o=this._oneOverSemimajorAxis,i=t.x*o,a=t.y*o,s=t.z;return n(e)?(e.longitude=i,e.latitude=a,e.height=s,e):new r(i,a,s)},s}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var r={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(r)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var r=function(r,e){this.start=t(r,0),this.stop=t(e,0)};return r}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o){"use strict";var i=function(r,e,n,o){this.x=t(r,0),this.y=t(e,0),this.z=t(n,0),this.w=t(o,0)};i.fromElements=function(t,e,n,o,a){return r(a)?(a.x=t,a.y=e,a.z=n,a.w=o,a):new i(t,e,n,o)},i.fromColor=function(t,e){return r(e)?(e.x=t.red,e.y=t.green,e.z=t.blue,e.w=t.alpha,e):new i(t.red,t.green,t.blue,t.alpha)},i.clone=function(t,e){return r(t)?r(e)?(e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e):new i(t.x,t.y,t.z,t.w):void 0},i.packedLength=4,i.pack=function(r,e,n){n=t(n,0),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n]=r.w},i.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new i),o.x=e[n++],o.y=e[n++],o.z=e[n++],o.w=e[n],o},i.fromArray=i.unpack,i.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},i.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},i.minimumByComponent=function(t,r,e){return e.x=Math.min(t.x,r.x),e.y=Math.min(t.y,r.y),e.z=Math.min(t.z,r.z),e.w=Math.min(t.w,r.w),e},i.maximumByComponent=function(t,r,e){return e.x=Math.max(t.x,r.x),e.y=Math.max(t.y,r.y),e.z=Math.max(t.z,r.z),e.w=Math.max(t.w,r.w),e},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},i.magnitude=function(t){return Math.sqrt(i.magnitudeSquared(t))};var a=new i;i.distance=function(t,r){return i.subtract(t,r,a),i.magnitude(a)},i.distanceSquared=function(t,r){return i.subtract(t,r,a),i.magnitudeSquared(a)},i.normalize=function(t,r){var e=i.magnitude(t);return r.x=t.x/e,r.y=t.y/e,r.z=t.z/e,r.w=t.w/e,r},i.dot=function(t,r){return t.x*r.x+t.y*r.y+t.z*r.z+t.w*r.w},i.multiplyComponents=function(t,r,e){return e.x=t.x*r.x,e.y=t.y*r.y,e.z=t.z*r.z,e.w=t.w*r.w,e},i.add=function(t,r,e){return e.x=t.x+r.x,e.y=t.y+r.y,e.z=t.z+r.z,e.w=t.w+r.w,e},i.subtract=function(t,r,e){return e.x=t.x-r.x,e.y=t.y-r.y,e.z=t.z-r.z,e.w=t.w-r.w,e},i.multiplyByScalar=function(t,r,e){return e.x=t.x*r,e.y=t.y*r,e.z=t.z*r,e.w=t.w*r,e},i.divideByScalar=function(t,r,e){return e.x=t.x/r,e.y=t.y/r,e.z=t.z/r,e.w=t.w/r,e},i.negate=function(t,r){return r.x=-t.x,r.y=-t.y,r.z=-t.z,r.w=-t.w,r},i.abs=function(t,r){return r.x=Math.abs(t.x),r.y=Math.abs(t.y),r.z=Math.abs(t.z),r.w=Math.abs(t.w),r};var s=new i;i.lerp=function(t,r,e,n){return i.multiplyByScalar(r,e,s),n=i.multiplyByScalar(t,1-e,n),i.add(s,n,n)};var u=new i;return i.mostOrthogonalAxis=function(t,r){var e=i.normalize(t,u);return i.abs(e,e),r=e.x<=e.y?e.x<=e.z?e.x<=e.w?i.clone(i.UNIT_X,r):i.clone(i.UNIT_W,r):e.z<=e.w?i.clone(i.UNIT_Z,r):i.clone(i.UNIT_W,r):e.y<=e.z?e.y<=e.w?i.clone(i.UNIT_Y,r):i.clone(i.UNIT_W,r):e.z<=e.w?i.clone(i.UNIT_Z,r):i.clone(i.UNIT_W,r)},i.equals=function(t,e){return t===e||r(t)&&r(e)&&t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},i.equalsArray=function(t,r,e){return t.x===r[e]&&t.y===r[e+1]&&t.z===r[e+2]&&t.w===r[e+3]},i.equalsEpsilon=function(t,e,n,i){return t===e||r(t)&&r(e)&&o.equalsEpsilon(t.x,e.x,n,i)&&o.equalsEpsilon(t.y,e.y,n,i)&&o.equalsEpsilon(t.z,e.z,n,i)&&o.equalsEpsilon(t.w,e.w,n,i)},i.ZERO=n(new i(0,0,0,0)),i.UNIT_X=n(new i(1,0,0,0)),i.UNIT_Y=n(new i(0,1,0,0)),i.UNIT_Z=n(new i(0,0,1,0)),i.UNIT_W=n(new i(0,0,0,1)),i.prototype.clone=function(t){return i.clone(this,t)},i.prototype.equals=function(t){return i.equals(this,t)},i.prototype.equalsEpsilon=function(t,r,e){return i.equalsEpsilon(this,t,r,e)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n,o,i){"use strict";function a(t){for(var r=0,e=0;9>e;++e){var n=t[e];r+=n*n}return Math.sqrt(r)}function s(t){for(var r=0,e=0;3>e;++e){var n=t[l.getElementIndex(d[e],h[e])];r+=2*n*n}return Math.sqrt(r)}function u(t,r){for(var e=i.EPSILON15,n=0,o=1,a=0;3>a;++a){var s=Math.abs(t[l.getElementIndex(d[a],h[a])]);s>n&&(o=a,n=s)}var u=1,c=0,f=h[o],m=d[o];if(Math.abs(t[l.getElementIndex(m,f)])>e){var p,g=t[l.getElementIndex(m,m)],y=t[l.getElementIndex(f,f)],E=t[l.getElementIndex(m,f)],v=(g-y)/2/E;p=0>v?-1/(-v+Math.sqrt(1+v*v)):1/(v+Math.sqrt(1+v*v)),u=1/Math.sqrt(1+p*p),c=p*u}return r=l.clone(l.IDENTITY,r),r[l.getElementIndex(f,f)]=r[l.getElementIndex(m,m)]=u,r[l.getElementIndex(m,f)]=c,r[l.getElementIndex(f,m)]=-c,r}var l=function(t,e,n,o,i,a,s,u,l){this[0]=r(t,0),this[1]=r(o,0),this[2]=r(s,0),this[3]=r(e,0),this[4]=r(i,0),this[5]=r(u,0),this[6]=r(n,0),this[7]=r(a,0),this[8]=r(l,0)};l.packedLength=9,l.pack=function(t,e,n){n=r(n,0),e[n++]=t[0],e[n++]=t[1],e[n++]=t[2],e[n++]=t[3],e[n++]=t[4],e[n++]=t[5],e[n++]=t[6],e[n++]=t[7],e[n++]=t[8]},l.unpack=function(t,n,o){return n=r(n,0),e(o)||(o=new l),o[0]=t[n++],o[1]=t[n++],o[2]=t[n++],o[3]=t[n++],o[4]=t[n++],o[5]=t[n++],o[6]=t[n++],o[7]=t[n++],o[8]=t[n++],o},l.clone=function(t,r){return e(t)?e(r)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r):new l(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},l.fromArray=function(t,n,o){return n=r(n,0),e(o)||(o=new l),o[0]=t[n],o[1]=t[n+1],o[2]=t[n+2],o[3]=t[n+3],o[4]=t[n+4],o[5]=t[n+5],o[6]=t[n+6],o[7]=t[n+7],o[8]=t[n+8],o},l.fromColumnMajorArray=function(t,r){return l.clone(t,r)},l.fromRowMajorArray=function(t,r){return e(r)?(r[0]=t[0],r[1]=t[3],r[2]=t[6],r[3]=t[1],r[4]=t[4],r[5]=t[7],r[6]=t[2],r[7]=t[5],r[8]=t[8],r):new l(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},l.fromQuaternion=function(t,r){var n=t.x*t.x,o=t.x*t.y,i=t.x*t.z,a=t.x*t.w,s=t.y*t.y,u=t.y*t.z,c=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=n-s-f+d,p=2*(o-h),g=2*(i+c),y=2*(o+h),E=-n+s-f+d,v=2*(u-a),C=2*(i-c),S=2*(u+a),w=-n-s+f+d;return e(r)?(r[0]=m,r[1]=y,r[2]=C,r[3]=p,r[4]=E,r[5]=S,r[6]=g,r[7]=v,r[8]=w,r):new l(m,p,g,y,E,v,C,S,w)},l.fromScale=function(t,r){return e(r)?(r[0]=t.x,r[1]=0,r[2]=0,r[3]=0,r[4]=t.y,r[5]=0,r[6]=0,r[7]=0,r[8]=t.z,r):new l(t.x,0,0,0,t.y,0,0,0,t.z)},l.fromUniformScale=function(t,r){return e(r)?(r[0]=t,r[1]=0,r[2]=0,r[3]=0,r[4]=t,r[5]=0,r[6]=0,r[7]=0,r[8]=t,r):new l(t,0,0,0,t,0,0,0,t)},l.fromCrossProduct=function(t,r){return e(r)?(r[0]=0,r[1]=t.z,r[2]=-t.y,r[3]=-t.z,r[4]=0,r[5]=t.x,r[6]=t.y,r[7]=-t.x,r[8]=0,r):new l(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},l.fromRotationX=function(t,r){var n=Math.cos(t),o=Math.sin(t);return e(r)?(r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=n,r[5]=o,r[6]=0,r[7]=-o,r[8]=n,r):new l(1,0,0,0,n,-o,0,o,n)},l.fromRotationY=function(t,r){var n=Math.cos(t),o=Math.sin(t);return e(r)?(r[0]=n,r[1]=0,r[2]=-o,r[3]=0,r[4]=1,r[5]=0,r[6]=o,r[7]=0,r[8]=n,r):new l(n,0,o,0,1,0,-o,0,n)},l.fromRotationZ=function(t,r){var n=Math.cos(t),o=Math.sin(t);return e(r)?(r[0]=n,r[1]=o,r[2]=0,r[3]=-o,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r):new l(n,-o,0,o,n,0,0,0,1)},l.toArray=function(t,r){return e(r)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},l.getElementIndex=function(t,r){return 3*t+r},l.getColumn=function(t,r,e){var n=3*r,o=t[n],i=t[n+1],a=t[n+2];return e.x=o,e.y=i,e.z=a,e},l.setColumn=function(t,r,e,n){n=l.clone(t,n);var o=3*r;return n[o]=e.x,n[o+1]=e.y,n[o+2]=e.z,n},l.getRow=function(t,r,e){var n=t[r],o=t[r+3],i=t[r+6];return e.x=n,e.y=o,e.z=i,e},l.setRow=function(t,r,e,n){return n=l.clone(t,n),n[r]=e.x,n[r+3]=e.y,n[r+6]=e.z,n};var c=new t;l.getScale=function(r,e){return e.x=t.magnitude(t.fromElements(r[0],r[1],r[2],c)),e.y=t.magnitude(t.fromElements(r[3],r[4],r[5],c)),e.z=t.magnitude(t.fromElements(r[6],r[7],r[8],c)),e};var f=new t;l.getMaximumScale=function(r){return l.getScale(r,f),t.maximumComponent(f)},l.multiply=function(t,r,e){var n=t[0]*r[0]+t[3]*r[1]+t[6]*r[2],o=t[1]*r[0]+t[4]*r[1]+t[7]*r[2],i=t[2]*r[0]+t[5]*r[1]+t[8]*r[2],a=t[0]*r[3]+t[3]*r[4]+t[6]*r[5],s=t[1]*r[3]+t[4]*r[4]+t[7]*r[5],u=t[2]*r[3]+t[5]*r[4]+t[8]*r[5],l=t[0]*r[6]+t[3]*r[7]+t[6]*r[8],c=t[1]*r[6]+t[4]*r[7]+t[7]*r[8],f=t[2]*r[6]+t[5]*r[7]+t[8]*r[8];return e[0]=n,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=u,e[6]=l,e[7]=c,e[8]=f,e},l.add=function(t,r,e){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},l.subtract=function(t,r,e){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e},l.multiplyByVector=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=t[0]*n+t[3]*o+t[6]*i,s=t[1]*n+t[4]*o+t[7]*i,u=t[2]*n+t[5]*o+t[8]*i;return e.x=a,e.y=s,e.z=u,e},l.multiplyByScalar=function(t,r,e){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},l.multiplyByScale=function(t,r,e){return e[0]=t[0]*r.x,e[1]=t[1]*r.x,e[2]=t[2]*r.x,e[3]=t[3]*r.y,e[4]=t[4]*r.y,e[5]=t[5]*r.y,e[6]=t[6]*r.z,e[7]=t[7]*r.z,e[8]=t[8]*r.z,e},l.negate=function(t,r){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=-t[3],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[7]=-t[7],r[8]=-t[8],r},l.transpose=function(t,r){var e=t[0],n=t[3],o=t[6],i=t[1],a=t[4],s=t[7],u=t[2],l=t[5],c=t[8];return r[0]=e,r[1]=n,r[2]=o,r[3]=i,r[4]=a,r[5]=s,r[6]=u,r[7]=l,r[8]=c,r};var h=[1,0,0],d=[2,2,1],m=new l,p=new l;return l.computeEigenDecomposition=function(t,r){var n=i.EPSILON20,o=10,c=0,f=0;e(r)||(r={});for(var h=r.unitary=l.clone(l.IDENTITY,r.unitary),d=r.diagonal=l.clone(t,r.diagonal),g=n*a(d);o>f&&s(d)>g;)u(d,m),l.transpose(m,p),l.multiply(d,m,d),l.multiply(p,d,d),l.multiply(h,m,h),++c>2&&(++f,c=0);return r},l.abs=function(t,r){return r[0]=Math.abs(t[0]),r[1]=Math.abs(t[1]),r[2]=Math.abs(t[2]),r[3]=Math.abs(t[3]),r[4]=Math.abs(t[4]),r[5]=Math.abs(t[5]),r[6]=Math.abs(t[6]),r[7]=Math.abs(t[7]),r[8]=Math.abs(t[8]),r},l.determinant=function(t){var r=t[0],e=t[3],n=t[6],o=t[1],i=t[4],a=t[7],s=t[2],u=t[5],l=t[8];return r*(i*l-u*a)+o*(u*n-e*l)+s*(e*a-i*n)},l.inverse=function(t,r){var e=t[0],o=t[1],a=t[2],s=t[3],u=t[4],c=t[5],f=t[6],h=t[7],d=t[8],m=l.determinant(t);if(Math.abs(m)<=i.EPSILON15)throw new n("matrix is not invertible");r[0]=u*d-h*c,r[1]=h*a-o*d,r[2]=o*c-u*a,r[3]=f*c-s*d,r[4]=e*d-f*a,r[5]=s*a-e*c,r[6]=s*h-f*u,r[7]=f*o-e*h,r[8]=e*u-s*o;var p=1/m;return l.multiplyByScalar(r,p,r)},l.equals=function(t,r){return t===r||e(t)&&e(r)&&t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]&&t[3]===r[3]&&t[4]===r[4]&&t[5]===r[5]&&t[6]===r[6]&&t[7]===r[7]&&t[8]===r[8]},l.equalsEpsilon=function(t,r,n){return t===r||e(t)&&e(r)&&Math.abs(t[0]-r[0])<=n&&Math.abs(t[1]-r[1])<=n&&Math.abs(t[2]-r[2])<=n&&Math.abs(t[3]-r[3])<=n&&Math.abs(t[4]-r[4])<=n&&Math.abs(t[5]-r[5])<=n&&Math.abs(t[6]-r[6])<=n&&Math.abs(t[7]-r[7])<=n&&Math.abs(t[8]-r[8])<=n},l.IDENTITY=o(new l(1,0,0,0,1,0,0,0,1)),l.ZERO=o(new l(0,0,0,0,0,0,0,0,0)),l.COLUMN0ROW0=0,l.COLUMN0ROW1=1,l.COLUMN0ROW2=2,l.COLUMN1ROW0=3,l.COLUMN1ROW1=4,l.COLUMN1ROW2=5,l.COLUMN2ROW0=6,l.COLUMN2ROW1=7,l.COLUMN2ROW2=8,l.prototype.clone=function(t){return l.clone(this,t)},l.prototype.equals=function(t){return l.equals(this,t)},l.equalsArray=function(t,r,e){return t[0]===r[e]&&t[1]===r[e+1]&&t[2]===r[e+2]&&t[3]===r[e+3]&&t[4]===r[e+4]&&t[5]===r[e+5]&&t[6]===r[e+6]&&t[7]===r[e+7]&&t[8]===r[e+8]},l.prototype.equalsEpsilon=function(t,r){return l.equalsEpsilon(this,t,r)},l.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},l}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var r=function(t){this.name="RuntimeError",this.message=t;var r;try{throw new Error}catch(e){r=e.stack}this.stack=r};return r.prototype.toString=function(){var r=this.name+": "+this.message;return t(this.stack)&&(r+="\n"+this.stack.toString()),r},r}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,r,e,n,o,i,a,s,u){"use strict";var l=function(t,r,n,o,i,a,s,u,l,c,f,h,d,m,p,g){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(l,0),this[3]=e(d,0),this[4]=e(r,0),this[5]=e(a,0),this[6]=e(c,0),this[7]=e(m,0),this[8]=e(n,0),this[9]=e(s,0),this[10]=e(f,0),this[11]=e(p,0),this[12]=e(o,0),this[13]=e(u,0),this[14]=e(h,0),this[15]=e(g,0)};l.packedLength=16,l.pack=function(t,r,n){n=e(n,0),r[n++]=t[0],r[n++]=t[1],r[n++]=t[2],r[n++]=t[3],r[n++]=t[4],r[n++]=t[5],r[n++]=t[6],r[n++]=t[7],r[n++]=t[8],r[n++]=t[9],r[n++]=t[10],r[n++]=t[11],r[n++]=t[12],r[n++]=t[13],r[n++]=t[14],r[n]=t[15]},l.unpack=function(t,r,o){return r=e(r,0),n(o)||(o=new l),o[0]=t[r++],o[1]=t[r++],o[2]=t[r++],o[3]=t[r++],o[4]=t[r++],o[5]=t[r++],o[6]=t[r++],o[7]=t[r++],o[8]=t[r++],o[9]=t[r++],o[10]=t[r++],o[11]=t[r++],o[12]=t[r++],o[13]=t[r++],o[14]=t[r++],o[15]=t[r],o},l.clone=function(t,r){return n(t)?n(r)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r):new l(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},l.fromArray=l.unpack,l.fromColumnMajorArray=function(t,r){return l.clone(t,r)},l.fromRowMajorArray=function(t,r){return n(r)?(r[0]=t[0],r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=t[1],r[5]=t[5],r[6]=t[9],r[7]=t[13],r[8]=t[2],r[9]=t[6],r[10]=t[10],r[11]=t[14],r[12]=t[3],r[13]=t[7],r[14]=t[11],r[15]=t[15],r):new l(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},l.fromRotationTranslation=function(r,o,i){return o=e(o,t.ZERO),n(i)?(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=0,i[4]=r[3],i[5]=r[4],i[6]=r[5],i[7]=0,i[8]=r[6],i[9]=r[7],i[10]=r[8],i[11]=0,i[12]=o.x,i[13]=o.y,i[14]=o.z,i[15]=1,i):new l(r[0],r[3],r[6],o.x,r[1],r[4],r[7],o.y,r[2],r[5],r[8],o.z,0,0,0,1)},l.fromTranslationQuaternionRotationScale=function(t,r,e,o){n(o)||(o=new l);var i=e.x,a=e.y,s=e.z,u=r.x*r.x,c=r.x*r.y,f=r.x*r.z,h=r.x*r.w,d=r.y*r.y,m=r.y*r.z,p=r.y*r.w,g=r.z*r.z,y=r.z*r.w,E=r.w*r.w,v=u-d-g+E,C=2*(c-y),S=2*(f+p),w=2*(c+y),M=-u+d-g+E,R=2*(m-h),A=2*(f-p),O=2*(m+h),T=-u-d+g+E;return o[0]=v*i,o[1]=w*i,o[2]=A*i,o[3]=0,o[4]=C*a,o[5]=M*a,o[6]=O*a,o[7]=0,o[8]=S*s,o[9]=R*s,o[10]=T*s,o[11]=0,o[12]=t.x,o[13]=t.y,o[14]=t.z,o[15]=1,o},l.fromTranslation=function(t,r){return l.fromRotationTranslation(s.IDENTITY,t,r)},l.fromScale=function(t,r){return n(r)?(r[0]=t.x,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t.y,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t.z,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new l(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},l.fromUniformScale=function(t,r){return n(r)?(r[0]=t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new l(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var c=new t,f=new t,h=new t;l.fromCamera=function(r,e){var o=r.eye,i=r.target,a=r.up;t.normalize(t.subtract(i,o,c),c),t.normalize(t.cross(c,a,f),f),t.normalize(t.cross(f,c,h),h);var s=f.x,u=f.y,d=f.z,m=c.x,p=c.y,g=c.z,y=h.x,E=h.y,v=h.z,C=o.x,S=o.y,w=o.z,M=s*-C+u*-S+d*-w,R=y*-C+E*-S+v*-w,A=m*C+p*S+g*w;return n(e)?(e[0]=s,e[1]=y,e[2]=-m,e[3]=0,e[4]=u,e[5]=E,e[6]=-p,e[7]=0,e[8]=d,e[9]=v,e[10]=-g,e[11]=0,e[12]=M,e[13]=R,e[14]=A,e[15]=1,e):new l(s,u,d,M,y,E,v,R,-m,-p,-g,A,0,0,0,1)},l.computePerspectiveFieldOfView=function(t,r,e,n,o){var i=Math.tan(.5*t),a=1/i,s=a/r,u=(n+e)/(e-n),l=2*n*e/(e-n);return o[0]=s,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=u,o[11]=-1,o[12]=0,o[13]=0,o[14]=l,o[15]=0,o},l.computeOrthographicOffCenter=function(t,r,e,n,o,i,a){var s=1/(r-t),u=1/(n-e),l=1/(i-o),c=-(r+t)*s,f=-(n+e)*u,h=-(i+o)*l;return s*=2,u*=2,l*=-2,a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=l,a[11]=0,a[12]=c,a[13]=f,a[14]=h,a[15]=1,a -},l.computePerspectiveOffCenter=function(t,r,e,n,o,i,a){var s=2*o/(r-t),u=2*o/(n-e),l=(r+t)/(r-t),c=(n+e)/(n-e),f=-(i+o)/(i-o),h=-1,d=-2*i*o/(i-o);return a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=l,a[9]=c,a[10]=f,a[11]=h,a[12]=0,a[13]=0,a[14]=d,a[15]=0,a},l.computeInfinitePerspectiveOffCenter=function(t,r,e,n,o,i){var a=2*o/(r-t),s=2*o/(n-e),u=(r+t)/(r-t),l=(n+e)/(n-e),c=-1,f=-1,h=-2*o;return i[0]=a,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=u,i[9]=l,i[10]=c,i[11]=f,i[12]=0,i[13]=0,i[14]=h,i[15]=0,i},l.computeViewportTransformation=function(t,r,n,o){t=e(t,e.EMPTY_OBJECT);var i=e(t.x,0),a=e(t.y,0),s=e(t.width,0),u=e(t.height,0);r=e(r,0),n=e(n,1);var l=.5*s,c=.5*u,f=.5*(n-r),h=l,d=c,m=f,p=i+l,g=a+c,y=r+f,E=1;return o[0]=h,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=d,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=m,o[11]=0,o[12]=p,o[13]=g,o[14]=y,o[15]=E,o},l.toArray=function(t,r){return n(r)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},l.getElementIndex=function(t,r){return 4*t+r},l.getColumn=function(t,r,e){var n=4*r,o=t[n],i=t[n+1],a=t[n+2],s=t[n+3];return e.x=o,e.y=i,e.z=a,e.w=s,e},l.setColumn=function(t,r,e,n){n=l.clone(t,n);var o=4*r;return n[o]=e.x,n[o+1]=e.y,n[o+2]=e.z,n[o+3]=e.w,n},l.setTranslation=function(t,r,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=r.x,e[13]=r.y,e[14]=r.z,e[15]=t[15],e},l.getRow=function(t,r,e){var n=t[r],o=t[r+4],i=t[r+8],a=t[r+12];return e.x=n,e.y=o,e.z=i,e.w=a,e},l.setRow=function(t,r,e,n){return n=l.clone(t,n),n[r]=e.x,n[r+4]=e.y,n[r+8]=e.z,n[r+12]=e.w,n};var d=new t;l.getScale=function(r,e){return e.x=t.magnitude(t.fromElements(r[0],r[1],r[2],d)),e.y=t.magnitude(t.fromElements(r[4],r[5],r[6],d)),e.z=t.magnitude(t.fromElements(r[8],r[9],r[10],d)),e};var m=new t;l.getMaximumScale=function(r){return l.getScale(r,m),t.maximumComponent(m)},l.multiply=function(t,r,e){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],f=t[8],h=t[9],d=t[10],m=t[11],p=t[12],g=t[13],y=t[14],E=t[15],v=r[0],C=r[1],S=r[2],w=r[3],M=r[4],R=r[5],A=r[6],O=r[7],T=r[8],I=r[9],N=r[10],x=r[11],_=r[12],L=r[13],b=r[14],P=r[15],F=n*v+s*C+f*S+p*w,z=o*v+u*C+h*S+g*w,D=i*v+l*C+d*S+y*w,B=a*v+c*C+m*S+E*w,U=n*M+s*R+f*A+p*O,q=o*M+u*R+h*A+g*O,G=i*M+l*R+d*A+y*O,W=a*M+c*R+m*A+E*O,Y=n*T+s*I+f*N+p*x,H=o*T+u*I+h*N+g*x,V=i*T+l*I+d*N+y*x,k=a*T+c*I+m*N+E*x,K=n*_+s*L+f*b+p*P,j=o*_+u*L+h*b+g*P,Z=i*_+l*L+d*b+y*P,X=a*_+c*L+m*b+E*P;return e[0]=F,e[1]=z,e[2]=D,e[3]=B,e[4]=U,e[5]=q,e[6]=G,e[7]=W,e[8]=Y,e[9]=H,e[10]=V,e[11]=k,e[12]=K,e[13]=j,e[14]=Z,e[15]=X,e},l.add=function(t,r,e){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e},l.subtract=function(t,r,e){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e},l.multiplyTransformation=function(t,r,e){var n=t[0],o=t[1],i=t[2],a=t[4],s=t[5],u=t[6],l=t[8],c=t[9],f=t[10],h=t[12],d=t[13],m=t[14],p=r[0],g=r[1],y=r[2],E=r[4],v=r[5],C=r[6],S=r[8],w=r[9],M=r[10],R=r[12],A=r[13],O=r[14],T=n*p+a*g+l*y,I=o*p+s*g+c*y,N=i*p+u*g+f*y,x=n*E+a*v+l*C,_=o*E+s*v+c*C,L=i*E+u*v+f*C,b=n*S+a*w+l*M,P=o*S+s*w+c*M,F=i*S+u*w+f*M,z=n*R+a*A+l*O+h,D=o*R+s*A+c*O+d,B=i*R+u*A+f*O+m;return e[0]=T,e[1]=I,e[2]=N,e[3]=0,e[4]=x,e[5]=_,e[6]=L,e[7]=0,e[8]=b,e[9]=P,e[10]=F,e[11]=0,e[12]=z,e[13]=D,e[14]=B,e[15]=1,e},l.multiplyByMatrix3=function(t,r,e){var n=t[0],o=t[1],i=t[2],a=t[4],s=t[5],u=t[6],l=t[8],c=t[9],f=t[10],h=r[0],d=r[1],m=r[2],p=r[3],g=r[4],y=r[5],E=r[6],v=r[7],C=r[8],S=n*h+a*d+l*m,w=o*h+s*d+c*m,M=i*h+u*d+f*m,R=n*p+a*g+l*y,A=o*p+s*g+c*y,O=i*p+u*g+f*y,T=n*E+a*v+l*C,I=o*E+s*v+c*C,N=i*E+u*v+f*C;return e[0]=S,e[1]=w,e[2]=M,e[3]=0,e[4]=R,e[5]=A,e[6]=O,e[7]=0,e[8]=T,e[9]=I,e[10]=N,e[11]=0,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},l.multiplyByTranslation=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=n*t[0]+o*t[4]+i*t[8]+t[12],s=n*t[1]+o*t[5]+i*t[9]+t[13],u=n*t[2]+o*t[6]+i*t[10]+t[14];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=a,e[13]=s,e[14]=u,e[15]=t[15],e};var p=new t;l.multiplyByUniformScale=function(t,r,e){return p.x=r,p.y=r,p.z=r,l.multiplyByScale(t,p,e)},l.multiplyByScale=function(t,r,e){var n=r.x,o=r.y,i=r.z;return 1===n&&1===o&&1===i?l.clone(t,e):(e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=0,e[4]=o*t[4],e[5]=o*t[5],e[6]=o*t[6],e[7]=0,e[8]=i*t[8],e[9]=i*t[9],e[10]=i*t[10],e[11]=0,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=1,e)},l.multiplyByVector=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=r.w,s=t[0]*n+t[4]*o+t[8]*i+t[12]*a,u=t[1]*n+t[5]*o+t[9]*i+t[13]*a,l=t[2]*n+t[6]*o+t[10]*i+t[14]*a,c=t[3]*n+t[7]*o+t[11]*i+t[15]*a;return e.x=s,e.y=u,e.z=l,e.w=c,e},l.multiplyByPointAsVector=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=t[0]*n+t[4]*o+t[8]*i,s=t[1]*n+t[5]*o+t[9]*i,u=t[2]*n+t[6]*o+t[10]*i;return e.x=a,e.y=s,e.z=u,e},l.multiplyByPoint=function(t,r,e){var n=r.x,o=r.y,i=r.z,a=t[0]*n+t[4]*o+t[8]*i+t[12],s=t[1]*n+t[5]*o+t[9]*i+t[13],u=t[2]*n+t[6]*o+t[10]*i+t[14];return e.x=a,e.y=s,e.z=u,e},l.multiplyByScalar=function(t,r,e){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e},l.negate=function(t,r){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=-t[3],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[7]=-t[7],r[8]=-t[8],r[9]=-t[9],r[10]=-t[10],r[11]=-t[11],r[12]=-t[12],r[13]=-t[13],r[14]=-t[14],r[15]=-t[15],r},l.transpose=function(t,r){var e=t[1],n=t[2],o=t[3],i=t[6],a=t[7],s=t[11];return r[0]=t[0],r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=e,r[5]=t[5],r[6]=t[9],r[7]=t[13],r[8]=n,r[9]=i,r[10]=t[10],r[11]=t[14],r[12]=o,r[13]=a,r[14]=s,r[15]=t[15],r},l.abs=function(t,r){return r[0]=Math.abs(t[0]),r[1]=Math.abs(t[1]),r[2]=Math.abs(t[2]),r[3]=Math.abs(t[3]),r[4]=Math.abs(t[4]),r[5]=Math.abs(t[5]),r[6]=Math.abs(t[6]),r[7]=Math.abs(t[7]),r[8]=Math.abs(t[8]),r[9]=Math.abs(t[9]),r[10]=Math.abs(t[10]),r[11]=Math.abs(t[11]),r[12]=Math.abs(t[12]),r[13]=Math.abs(t[13]),r[14]=Math.abs(t[14]),r[15]=Math.abs(t[15]),r},l.equals=function(t,r){return t===r||n(t)&&n(r)&&t[12]===r[12]&&t[13]===r[13]&&t[14]===r[14]&&t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]&&t[4]===r[4]&&t[5]===r[5]&&t[6]===r[6]&&t[8]===r[8]&&t[9]===r[9]&&t[10]===r[10]&&t[3]===r[3]&&t[7]===r[7]&&t[11]===r[11]&&t[15]===r[15]},l.equalsEpsilon=function(t,r,e){return t===r||n(t)&&n(r)&&Math.abs(t[0]-r[0])<=e&&Math.abs(t[1]-r[1])<=e&&Math.abs(t[2]-r[2])<=e&&Math.abs(t[3]-r[3])<=e&&Math.abs(t[4]-r[4])<=e&&Math.abs(t[5]-r[5])<=e&&Math.abs(t[6]-r[6])<=e&&Math.abs(t[7]-r[7])<=e&&Math.abs(t[8]-r[8])<=e&&Math.abs(t[9]-r[9])<=e&&Math.abs(t[10]-r[10])<=e&&Math.abs(t[11]-r[11])<=e&&Math.abs(t[12]-r[12])<=e&&Math.abs(t[13]-r[13])<=e&&Math.abs(t[14]-r[14])<=e&&Math.abs(t[15]-r[15])<=e},l.getTranslation=function(t,r){return r.x=t[12],r.y=t[13],r.z=t[14],r},l.getRotation=function(t,r){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[4],r[4]=t[5],r[5]=t[6],r[6]=t[8],r[7]=t[9],r[8]=t[10],r};var g=new s,y=new s,E=new r,v=new r(0,0,0,1);return l.inverse=function(t,e){if(s.equalsEpsilon(l.getRotation(t,g),y,a.EPSILON7)&&r.equals(l.getRow(t,3,E),v))return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=0,e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=1,e;var n=t[0],o=t[4],i=t[8],c=t[12],f=t[1],h=t[5],d=t[9],m=t[13],p=t[2],C=t[6],S=t[10],w=t[14],M=t[3],R=t[7],A=t[11],O=t[15],T=S*O,I=w*A,N=C*O,x=w*R,_=C*A,L=S*R,b=p*O,P=w*M,F=p*A,z=S*M,D=p*R,B=C*M,U=T*h+x*d+_*m-(I*h+N*d+L*m),q=I*f+b*d+z*m-(T*f+P*d+F*m),G=N*f+P*h+D*m-(x*f+b*h+B*m),W=L*f+F*h+B*d-(_*f+z*h+D*d),Y=I*o+N*i+L*c-(T*o+x*i+_*c),H=T*n+P*i+F*c-(I*n+b*i+z*c),V=x*n+b*o+B*c-(N*n+P*o+D*c),k=_*n+z*o+D*i-(L*n+F*o+B*i);T=i*m,I=c*d,N=o*m,x=c*h,_=o*d,L=i*h,b=n*m,P=c*f,F=n*d,z=i*f,D=n*h,B=o*f;var K=T*R+x*A+_*O-(I*R+N*A+L*O),j=I*M+b*A+z*O-(T*M+P*A+F*O),Z=N*M+P*R+D*O-(x*M+b*R+B*O),X=L*M+F*R+B*A-(_*M+z*R+D*A),Q=N*S+L*w+I*C-(_*w+T*C+x*S),J=F*w+T*p+P*S-(b*S+z*w+I*p),$=b*C+B*w+x*p-(D*w+N*p+P*C),tr=D*S+_*p+z*C-(F*C+B*S+L*p),rr=n*U+o*q+i*G+c*W;if(Math.abs(rr)<a.EPSILON20)throw new u("matrix is not invertible because its determinate is zero.");return rr=1/rr,e[0]=U*rr,e[1]=q*rr,e[2]=G*rr,e[3]=W*rr,e[4]=Y*rr,e[5]=H*rr,e[6]=V*rr,e[7]=k*rr,e[8]=K*rr,e[9]=j*rr,e[10]=Z*rr,e[11]=X*rr,e[12]=Q*rr,e[13]=J*rr,e[14]=$*rr,e[15]=tr*rr,e},l.inverseTransformation=function(t,r){var e=t[0],n=t[1],o=t[2],i=t[4],a=t[5],s=t[6],u=t[8],l=t[9],c=t[10],f=t[12],h=t[13],d=t[14],m=-e*f-n*h-o*d,p=-i*f-a*h-s*d,g=-u*f-l*h-c*d;return r[0]=e,r[1]=i,r[2]=u,r[3]=0,r[4]=n,r[5]=a,r[6]=l,r[7]=0,r[8]=o,r[9]=s,r[10]=c,r[11]=0,r[12]=m,r[13]=p,r[14]=g,r[15]=1,r},l.IDENTITY=i(new l(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),l.ZERO=i(new l(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),l.COLUMN0ROW0=0,l.COLUMN0ROW1=1,l.COLUMN0ROW2=2,l.COLUMN0ROW3=3,l.COLUMN1ROW0=4,l.COLUMN1ROW1=5,l.COLUMN1ROW2=6,l.COLUMN1ROW3=7,l.COLUMN2ROW0=8,l.COLUMN2ROW1=9,l.COLUMN2ROW2=10,l.COLUMN2ROW3=11,l.COLUMN3ROW0=12,l.COLUMN3ROW1=13,l.COLUMN3ROW2=14,l.COLUMN3ROW3=15,l.prototype.clone=function(t){return l.clone(this,t)},l.prototype.equals=function(t){return l.equals(this,t)},l.equalsArray=function(t,r,e){return t[0]===r[e]&&t[1]===r[e+1]&&t[2]===r[e+2]&&t[3]===r[e+3]&&t[4]===r[e+4]&&t[5]===r[e+5]&&t[6]===r[e+6]&&t[7]===r[e+7]&&t[8]===r[e+8]&&t[9]===r[e+9]&&t[10]===r[e+10]&&t[11]===r[e+11]&&t[12]===r[e+12]&&t[13]===r[e+13]&&t[14]===r[e+14]&&t[15]===r[e+15]},l.prototype.equalsEpsilon=function(t,r){return l.equalsEpsilon(this,t,r)},l.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},l}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,r,e,n){"use strict";var o=function(r,e){this.normal=t.clone(r),this.distance=e};o.fromPointNormal=function(e,n,i){var a=-t.dot(n,e);return r(i)?(t.clone(n,i.normal),i.distance=a,i):new o(n,a)};var i=new t;return o.fromCartesian4=function(e,n){var a=t.fromCartesian4(e,i),s=e.w;return r(n)?(t.clone(a,n.normal),n.distance=s,n):new o(a,s)},o.getPointDistance=function(r,e){return t.dot(r.normal,e)+r.distance},o.ORIGIN_XY_PLANE=n(new o(t.UNIT_Z,0)),o.ORIGIN_YZ_PLANE=n(new o(t.UNIT_X,0)),o.ORIGIN_ZX_PLANE=n(new o(t.UNIT_Y,0)),o}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,r,e,n,o,i,a,s){"use strict";var u=function(t,e,n,o){this.west=r(t,0),this.south=r(e,0),this.east=r(n,0),this.north=r(o,0)};n(u.prototype,{width:{get:function(){return u.computeWidth(this)}},height:{get:function(){return u.computeHeight(this)}}}),u.packedLength=4,u.pack=function(t,e,n){n=r(n,0),e[n++]=t.west,e[n++]=t.south,e[n++]=t.east,e[n]=t.north},u.unpack=function(t,n,o){return n=r(n,0),e(o)||(o=new u),o.west=t[n++],o.south=t[n++],o.east=t[n++],o.north=t[n],o},u.computeWidth=function(t){var r=t.east,e=t.west;return e>r&&(r+=s.TWO_PI),r-e},u.computeHeight=function(t){return t.north-t.south},u.fromDegrees=function(t,n,o,i,a){return t=s.toRadians(r(t,0)),n=s.toRadians(r(n,0)),o=s.toRadians(r(o,0)),i=s.toRadians(r(i,0)),e(a)?(a.west=t,a.south=n,a.east=o,a.north=i,a):new u(t,n,o,i)},u.fromCartographicArray=function(t,r){for(var n=Number.MAX_VALUE,o=-Number.MAX_VALUE,i=Number.MAX_VALUE,a=-Number.MAX_VALUE,s=0,l=t.length;l>s;s++){var c=t[s];n=Math.min(n,c.longitude),o=Math.max(o,c.longitude),i=Math.min(i,c.latitude),a=Math.max(a,c.latitude)}return e(r)?(r.west=n,r.south=i,r.east=o,r.north=a,r):new u(n,i,o,a)},u.clone=function(t,r){return e(t)?e(r)?(r.west=t.west,r.south=t.south,r.east=t.east,r.north=t.north,r):new u(t.west,t.south,t.east,t.north):void 0},u.prototype.clone=function(t){return u.clone(this,t)},u.prototype.equals=function(t){return u.equals(this,t)},u.equals=function(t,r){return t===r||e(t)&&e(r)&&t.west===r.west&&t.south===r.south&&t.east===r.east&&t.north===r.north},u.prototype.equalsEpsilon=function(t,r){return e(t)&&Math.abs(this.west-t.west)<=r&&Math.abs(this.south-t.south)<=r&&Math.abs(this.east-t.east)<=r&&Math.abs(this.north-t.north)<=r},u.validate=function(){},u.southwest=function(r,n){return e(n)?(n.longitude=r.west,n.latitude=r.south,n.height=0,n):new t(r.west,r.south)},u.northwest=function(r,n){return e(n)?(n.longitude=r.west,n.latitude=r.north,n.height=0,n):new t(r.west,r.north)},u.northeast=function(r,n){return e(n)?(n.longitude=r.east,n.latitude=r.north,n.height=0,n):new t(r.east,r.north)},u.southeast=function(r,n){return e(n)?(n.longitude=r.east,n.latitude=r.south,n.height=0,n):new t(r.east,r.south)},u.center=function(r,n){var o=r.east,i=r.west;i>o&&(o+=s.TWO_PI);var a=s.negativePiToPi(.5*(i+o)),u=.5*(r.south+r.north);return e(n)?(n.longitude=a,n.latitude=u,n.height=0,n):new t(a,u)},u.intersection=function(t,r,n){var o=t.east,i=t.west,a=r.east,l=r.west;i>o&&a>0?o+=s.TWO_PI:l>a&&o>0&&(a+=s.TWO_PI),i>o&&0>l?l+=s.TWO_PI:l>a&&0>i&&(i+=s.TWO_PI);var c=s.negativePiToPi(Math.max(i,l)),f=s.negativePiToPi(Math.min(o,a));if((t.west<t.east||r.west<r.east)&&c>=f)return void 0;var h=Math.max(t.south,r.south),d=Math.min(t.north,r.north);return h>=d?void 0:e(n)?(n.west=c,n.south=h,n.east=f,n.north=d,n):new u(c,h,f,d)},u.contains=function(t,r){var e=r.longitude,n=r.latitude,o=t.west,i=t.east;return o>i&&(i+=s.TWO_PI,0>e&&(e+=s.TWO_PI)),(e>o||s.equalsEpsilon(e,o,s.EPSILON14))&&(i>e||s.equalsEpsilon(e,i,s.EPSILON14))&&n>=t.south&&n<=t.north};var l=new t;return u.subsample=function(t,n,o,a){n=r(n,i.WGS84),o=r(o,0),e(a)||(a=[]);var c=0,f=t.north,h=t.south,d=t.east,m=t.west,p=l;p.height=o,p.longitude=m,p.latitude=f,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.longitude=d,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.latitude=h,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.longitude=m,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.latitude=0>f?f:h>0?h:0;for(var g=1;8>g;++g)p.longitude=-Math.PI+g*s.PI_OVER_TWO,u.contains(t,p)&&(a[c]=n.cartographicToCartesian(p,a[c]),c++);return 0===p.latitude&&(p.longitude=m,a[c]=n.cartographicToCartesian(p,a[c]),c++,p.longitude=d,a[c]=n.cartographicToCartesian(p,a[c]),c++),a.length=c,a},u.MAX_VALUE=a(new u(-Math.PI,-s.PI_OVER_TWO,Math.PI,s.PI_OVER_TWO)),u}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,r,e,n,o,i,a,s,u,l,c,f,h){"use strict";var d=function(r,n){this.center=t.clone(e(r,t.ZERO)),this.radius=e(n,0)},m=new t,p=new t,g=new t,y=new t,E=new t,v=new t,C=new t,S=new t,w=new t,M=new t,R=new t,A=new t;d.fromPoints=function(r,e){if(n(e)||(e=new d),!n(r)||0===r.length)return e.center=t.clone(t.ZERO,e.center),e.radius=0,e;for(var o=t.clone(r[0],C),i=t.clone(o,m),a=t.clone(o,p),s=t.clone(o,g),u=t.clone(o,y),l=t.clone(o,E),c=t.clone(o,v),f=r.length,h=1;f>h;h++){t.clone(r[h],o);var O=o.x,T=o.y,I=o.z;O<i.x&&t.clone(o,i),O>u.x&&t.clone(o,u),T<a.y&&t.clone(o,a),T>l.y&&t.clone(o,l),I<s.z&&t.clone(o,s),I>c.z&&t.clone(o,c)}var N=t.magnitudeSquared(t.subtract(u,i,S)),x=t.magnitudeSquared(t.subtract(l,a,S)),_=t.magnitudeSquared(t.subtract(c,s,S)),L=i,b=u,P=N;x>P&&(P=x,L=a,b=l),_>P&&(P=_,L=s,b=c);var F=w;F.x=.5*(L.x+b.x),F.y=.5*(L.y+b.y),F.z=.5*(L.z+b.z);var z=t.magnitudeSquared(t.subtract(b,F,S)),D=Math.sqrt(z),B=M;B.x=i.x,B.y=a.y,B.z=s.z;var U=R;U.x=u.x,U.y=l.y,U.z=c.z;var q=t.multiplyByScalar(t.add(B,U,S),.5,A),G=0;for(h=0;f>h;h++){t.clone(r[h],o);var W=t.magnitude(t.subtract(o,q,S));W>G&&(G=W);var Y=t.magnitudeSquared(t.subtract(o,F,S));if(Y>z){var H=Math.sqrt(Y);D=.5*(D+H),z=D*D;var V=H-D;F.x=(D*F.x+V*o.x)/H,F.y=(D*F.y+V*o.y)/H,F.z=(D*F.z+V*o.z)/H}}return G>D?(t.clone(F,e.center),e.radius=D):(t.clone(q,e.center),e.radius=G),e};var O=new s,T=new t,I=new t,N=new r,x=new r;d.fromRectangle2D=function(t,r,e){return d.fromRectangleWithHeights2D(t,r,0,0,e)},d.fromRectangleWithHeights2D=function(r,o,i,a,s){if(n(s)||(s=new d),!n(r))return s.center=t.clone(t.ZERO,s.center),s.radius=0,s;o=e(o,O),h.southwest(r,N),N.height=i,h.northeast(r,x),x.height=a;var u=o.project(N,T),l=o.project(x,I),c=l.x-u.x,f=l.y-u.y,m=l.z-u.z;s.radius=.5*Math.sqrt(c*c+f*f+m*m);var p=s.center;return p.x=u.x+.5*c,p.y=u.y+.5*f,p.z=u.z+.5*m,s};var _=[];d.fromRectangle3D=function(t,r,o,i){r=e(r,a.WGS84),o=e(o,0);var s;return n(t)&&(s=h.subsample(t,r,o,_)),d.fromPoints(s,i)},d.fromVertices=function(r,o,i,a){if(n(a)||(a=new d),!n(r)||0===r.length)return a.center=t.clone(t.ZERO,a.center),a.radius=0,a;o=e(o,t.ZERO),i=e(i,3);var s=C;s.x=r[0]+o.x,s.y=r[1]+o.y,s.z=r[2]+o.z;for(var u=t.clone(s,m),l=t.clone(s,p),c=t.clone(s,g),f=t.clone(s,y),h=t.clone(s,E),O=t.clone(s,v),T=r.length,I=0;T>I;I+=i){var N=r[I]+o.x,x=r[I+1]+o.y,_=r[I+2]+o.z;s.x=N,s.y=x,s.z=_,N<u.x&&t.clone(s,u),N>f.x&&t.clone(s,f),x<l.y&&t.clone(s,l),x>h.y&&t.clone(s,h),_<c.z&&t.clone(s,c),_>O.z&&t.clone(s,O)}var L=t.magnitudeSquared(t.subtract(f,u,S)),b=t.magnitudeSquared(t.subtract(h,l,S)),P=t.magnitudeSquared(t.subtract(O,c,S)),F=u,z=f,D=L;b>D&&(D=b,F=l,z=h),P>D&&(D=P,F=c,z=O);var B=w;B.x=.5*(F.x+z.x),B.y=.5*(F.y+z.y),B.z=.5*(F.z+z.z);var U=t.magnitudeSquared(t.subtract(z,B,S)),q=Math.sqrt(U),G=M;G.x=u.x,G.y=l.y,G.z=c.z;var W=R;W.x=f.x,W.y=h.y,W.z=O.z;var Y=t.multiplyByScalar(t.add(G,W,S),.5,A),H=0;for(I=0;T>I;I+=i){s.x=r[I]+o.x,s.y=r[I+1]+o.y,s.z=r[I+2]+o.z;var V=t.magnitude(t.subtract(s,Y,S));V>H&&(H=V);var k=t.magnitudeSquared(t.subtract(s,B,S));if(k>U){var K=Math.sqrt(k);q=.5*(q+K),U=q*q;var j=K-q;B.x=(q*B.x+j*s.x)/K,B.y=(q*B.y+j*s.y)/K,B.z=(q*B.z+j*s.z)/K}}return H>q?(t.clone(B,a.center),a.radius=q):(t.clone(Y,a.center),a.radius=H),a},d.fromCornerPoints=function(r,e,o){n(o)||(o=new d);var i=o.center;return t.add(r,e,i),t.multiplyByScalar(i,.5,i),o.radius=t.distance(i,e),o},d.fromEllipsoid=function(r,e){return n(e)||(e=new d),t.clone(t.ZERO,e.center),e.radius=r.maximumRadius,e};var L=new t;d.fromBoundingSpheres=function(r,e){if(n(e)||(e=new d),!n(r)||0===r.length)return e.center=t.clone(t.ZERO,e.center),e.radius=0,e;var o=r.length;if(1===o)return d.clone(r[0],e);if(2===o)return d.union(r[0],r[1],e);for(var i=[],a=0;o>a;a++)i.push(r[a].center);e=d.fromPoints(i,e);var s=e.center,u=e.radius;for(a=0;o>a;a++){var l=r[a];u=Math.max(u,t.distance(s,l.center,L)+l.radius)}return e.radius=u,e},d.clone=function(r,e){return n(r)?n(e)?(e.center=t.clone(r.center,e.center),e.radius=r.radius,e):new d(r.center,r.radius):void 0},d.packedLength=4,d.pack=function(t,r,n){n=e(n,0);var o=t.center;r[n++]=o.x,r[n++]=o.y,r[n++]=o.z,r[n]=t.radius},d.unpack=function(t,r,o){r=e(r,0),n(o)||(o=new d);var i=o.center;return i.x=t[r++],i.y=t[r++],i.z=t[r++],o.radius=t[r],o};var b=new t,P=new t;d.union=function(r,e,o){n(o)||(o=new d);var i=r.center,a=r.radius,s=e.center,u=e.radius,l=t.subtract(s,i,b),c=t.magnitude(l);if(a>=c+u)return r.clone(o),o;if(u>=c+a)return e.clone(o),o;var f=.5*(a+c+u),h=t.multiplyByScalar(l,(-a+f)/c,P);return t.add(h,i,h),t.clone(h,o.center),o.radius=f,o};var F=new t;d.expand=function(r,e,n){n=d.clone(r,n);var o=t.magnitude(t.subtract(e,n.center,F));return o>n.radius&&(n.radius=o),n},d.intersectPlane=function(r,e){var n=r.center,o=r.radius,i=e.normal,a=t.dot(i,n)+e.distance;return-o>a?u.OUTSIDE:o>a?u.INTERSECTING:u.INSIDE};var z=new f(new t,0);d.intersect=function(t,r){o("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var e=f.fromCartesian4(r,z);return d.intersectPlane(t,e)},d.transform=function(t,r,e){return n(e)||(e=new d),e.center=c.multiplyByPoint(r,t.center,e.center),e.radius=c.getMaximumScale(r)*t.radius,e};var D=new t;d.distanceSquaredTo=function(r,e){var n=t.subtract(r.center,e,D);return t.magnitudeSquared(n)-r.radius*r.radius},d.transformWithoutScale=function(t,r,e){return n(e)||(e=new d),e.center=c.multiplyByPoint(r,t.center,e.center),e.radius=t.radius,e};var B=new t;d.computePlaneDistances=function(r,e,o,i){n(i)||(i=new l);var a=t.subtract(r.center,e,B),s=t.multiplyByScalar(o,t.dot(o,a),B),u=t.magnitude(s);return i.start=u-r.radius,i.stop=u+r.radius,i};for(var U=new t,q=new t,G=new t,W=new t,Y=new t,H=new r,V=new Array(8),k=0;8>k;++k)V[k]=new t;var K=new s;return d.projectTo2D=function(r,n,o){n=e(n,K);var i=n.ellipsoid,a=r.center,s=r.radius,u=i.geodeticSurfaceNormal(a,U),l=t.cross(t.UNIT_Z,u,q);t.normalize(l,l);var c=t.cross(u,l,G);t.normalize(c,c),t.multiplyByScalar(u,s,u),t.multiplyByScalar(c,s,c),t.multiplyByScalar(l,s,l);var f=t.negate(c,Y),h=t.negate(l,W),m=V,p=m[0];t.add(u,c,p),t.add(p,l,p),p=m[1],t.add(u,c,p),t.add(p,h,p),p=m[2],t.add(u,f,p),t.add(p,h,p),p=m[3],t.add(u,f,p),t.add(p,l,p),t.negate(u,u),p=m[4],t.add(u,c,p),t.add(p,l,p),p=m[5],t.add(u,c,p),t.add(p,h,p),p=m[6],t.add(u,f,p),t.add(p,h,p),p=m[7],t.add(u,f,p),t.add(p,l,p);for(var g=m.length,y=0;g>y;++y){var E=m[y];t.add(a,E,E);var v=i.cartesianToCartographic(E,H);n.project(v,E)}o=d.fromPoints(m,o),a=o.center;var C=a.x,S=a.y,w=a.z;return a.x=w,a.y=C,a.z=S,o},d.equals=function(r,e){return r===e||n(r)&&n(e)&&t.equals(r.center,e.center)&&r.radius===e.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,r){"use strict";var e,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},o={};return r(o,{element:{get:function(){return o.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return o.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return o.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return o.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return o.supportsFullscreen()?null!==o.element:void 0}}}),o.supportsFullscreen=function(){if(t(e))return e;e=!1;var r=document.body;if("function"==typeof r.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",e=!0;for(var o,i=["webkit","moz","o","ms","khtml"],a=0,s=i.length;s>a;++a){var u=i[a];o=u+"RequestFullscreen","function"==typeof r[o]?(n.requestFullscreen=o,e=!0):(o=u+"RequestFullScreen","function"==typeof r[o]&&(n.requestFullscreen=o,e=!0)),o=u+"ExitFullscreen","function"==typeof document[o]?n.exitFullscreen=o:(o=u+"CancelFullScreen","function"==typeof document[o]&&(n.exitFullscreen=o)),o=u+"FullscreenEnabled",t(document[o])?n.fullscreenEnabled=o:(o=u+"FullScreenEnabled",t(document[o])&&(n.fullscreenEnabled=o)),o=u+"FullscreenElement",t(document[o])?n.fullscreenElement=o:(o=u+"FullScreenElement",t(document[o])&&(n.fullscreenElement=o)),o=u+"fullscreenchange",t(document["on"+o])&&("ms"===u&&(o="MSFullscreenChange"),n.fullscreenchange=o),o=u+"fullscreenerror",t(document["on"+o])&&("ms"===u&&(o="MSFullscreenError"),n.fullscreenerror=o)}return e},o.requestFullscreen=function(t){o.supportsFullscreen()&&t[n.requestFullscreen]()},o.exitFullscreen=function(){o.supportsFullscreen()&&document[n.exitFullscreen]()},o}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,r,e){"use strict";function n(t){for(var r=t.split("."),e=0,n=r.length;n>e;++e)r[e]=parseInt(r[e],10);return r}function o(){if(!r(g)){g=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(g=!0,y=n(t[1]))}return g}function i(){return o()&&y}function a(){if(!r(E)&&(E=!1,!o()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(E=!0,v=n(t[1]))}return E}function s(){return a()&&v}function u(){if(!r(C)){C=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(C=!0,S=n(t[1]),S.isNightly=!!t[2])}return C}function l(){return u()&&S}function c(){if(!r(w)){w=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(w=!0,M=n(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(w=!0,M=n(t[1])))}return w}function f(){return c()&&M}function h(){if(!r(R)){R=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(R=!0,A=n(t[1]))}return R}function d(){return r(O)||(O=/Windows/i.test(navigator.appVersion)),O}function m(){return h()&&A}function p(){return r(T)||(T=r(window.PointerEvent)&&(!r(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var g,y,E,v,C,S,w,M,R,A,O,T,I={isChrome:o,chromeVersion:i,isSafari:a,safariVersion:s,isWebkit:u,webkitVersion:l,isInternetExplorer:c,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return I.supportsFullscreen=function(){return e.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/Color",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math"],function(t,r,e,n,o,i){"use strict";function a(t,r,e){return 0>e&&(e+=1),e>1&&(e-=1),1>6*e?t+6*(r-t)*e:1>2*e?r:2>3*e?t+6*(r-t)*(2/3-e):t}var s=function(r,e,n,o){this.red=t(r,1),this.green=t(e,1),this.blue=t(n,1),this.alpha=t(o,1)};s.fromCartesian4=function(t,e){return r(e)?(e.red=t.x,e.green=t.y,e.blue=t.z,e.alpha=t.w,e):new s(t.x,t.y,t.z,t.w)},s.fromBytes=function(e,n,o,i,a){return e=s.byteToFloat(t(e,255)),n=s.byteToFloat(t(n,255)),o=s.byteToFloat(t(o,255)),i=s.byteToFloat(t(i,255)),r(a)?(a.red=e,a.green=n,a.blue=o,a.alpha=i,a):new s(e,n,o,i)},s.fromAlpha=function(t,e,n){return r(n)?(n.red=t.red,n.green=t.green,n.blue=t.blue,n.alpha=e,n):new s(t.red,t.green,t.blue,e)};var u,l,c;n.supportsTypedArrays()&&(u=new ArrayBuffer(4),l=new Uint32Array(u),c=new Uint8Array(u)),s.fromRgba=function(t){return l[0]=t,s.fromBytes(c[0],c[1],c[2],c[3])},s.fromHsl=function(r,e,n,o){r=t(r,0)%1,e=t(e,0),n=t(n,0),o=t(o,1);var i=n,u=n,l=n;if(0!==e){var c;c=.5>n?n*(1+e):n+e-n*e;var f=2*n-c;i=a(f,c,r+1/3),u=a(f,c,r),l=a(f,c,r-1/3)}return new s(i,u,l,o)},s.fromRandom=function(e,n){e=t(e,t.EMPTY_OBJECT);var o=e.red;if(!r(o)){var a=t(e.minimumRed,0),u=t(e.maximumRed,1);o=a+i.nextRandomNumber()*(u-a)}var l=e.green;if(!r(l)){var c=t(e.minimumGreen,0),f=t(e.maximumGreen,1);l=c+i.nextRandomNumber()*(f-c)}var h=e.blue;if(!r(h)){var d=t(e.minimumBlue,0),m=t(e.maximumBlue,1);h=d+i.nextRandomNumber()*(m-d)}var p=e.alpha;if(!r(p)){var g=t(e.minimumAlpha,0),y=t(e.maximumAlpha,1);p=g+i.nextRandomNumber()*(y-g)}return r(n)?(n.red=o,n.green=l,n.blue=h,n.alpha=p,n):new s(o,l,h,p)};var f=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,h=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,d=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,m=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;return s.fromCssColorString=function(e){var n=s[e.toUpperCase()];if(r(n))return s.clone(n);var o=f.exec(e);return null!==o?new s(parseInt(o[1],16)/15,parseInt(o[2],16)/15,parseInt(o[3],16)/15):(o=h.exec(e),null!==o?new s(parseInt(o[1],16)/255,parseInt(o[2],16)/255,parseInt(o[3],16)/255):(o=d.exec(e),null!==o?new s(parseFloat(o[1])/("%"===o[1].substr(-1)?100:255),parseFloat(o[2])/("%"===o[2].substr(-1)?100:255),parseFloat(o[3])/("%"===o[3].substr(-1)?100:255),parseFloat(t(o[4],"1.0"))):(o=m.exec(e),null!==o?s.fromHsl(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,parseFloat(t(o[4],"1.0"))):void 0)))},s.packedLength=4,s.pack=function(r,e,n){n=t(n,0),e[n++]=r.red,e[n++]=r.green,e[n++]=r.blue,e[n]=r.alpha},s.unpack=function(e,n,o){return n=t(n,0),r(o)||(o=new s),o.red=e[n++],o.green=e[n++],o.blue=e[n++],o.alpha=e[n],o},s.byteToFloat=function(t){return t/255},s.floatToByte=function(t){return 1===t?255:0|256*t},s.clone=function(t,e){return r(t)?r(e)?(e.red=t.red,e.green=t.green,e.blue=t.blue,e.alpha=t.alpha,e):new s(t.red,t.green,t.blue,t.alpha):void 0},s.equals=function(t,e){return t===e||r(t)&&r(e)&&t.red===e.red&&t.green===e.green&&t.blue===e.blue&&t.alpha===e.alpha},s.equalsArray=function(t,r,e){return t.red===r[e]&&t.green===r[e+1]&&t.blue===r[e+2]&&t.alpha===r[e+3]},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.prototype.equalsEpsilon=function(t,e){return this===t||r(t)&&Math.abs(this.red-t.red)<=e&&Math.abs(this.green-t.green)<=e&&Math.abs(this.blue-t.blue)<=e&&Math.abs(this.alpha-t.alpha)<=e},s.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},s.prototype.toCssColorString=function(){var t=s.floatToByte(this.red),r=s.floatToByte(this.green),e=s.floatToByte(this.blue);return 1===this.alpha?"rgb("+t+","+r+","+e+")":"rgba("+t+","+r+","+e+","+this.alpha+")"},s.prototype.toBytes=function(t){var e=s.floatToByte(this.red),n=s.floatToByte(this.green),o=s.floatToByte(this.blue),i=s.floatToByte(this.alpha);return r(t)?(t[0]=e,t[1]=n,t[2]=o,t[3]=i,t):[e,n,o,i]},s.prototype.toRgba=function(){return c[0]=s.floatToByte(this.red),c[1]=s.floatToByte(this.green),c[2]=s.floatToByte(this.blue),c[3]=s.floatToByte(this.alpha),l[0]},s.prototype.brighten=function(t,r){return t=1-t,r.red=1-(1-this.red)*t,r.green=1-(1-this.green)*t,r.blue=1-(1-this.blue)*t,r.alpha=this.alpha,r},s.prototype.darken=function(t,r){return t=1-t,r.red=this.red*t,r.green=this.green*t,r.blue=this.blue*t,r.alpha=this.alpha,r},s.prototype.withAlpha=function(t,r){return s.fromAlpha(this,t,r)},s.ALICEBLUE=o(s.fromCssColorString("#F0F8FF")),s.ANTIQUEWHITE=o(s.fromCssColorString("#FAEBD7")),s.AQUA=o(s.fromCssColorString("#00FFFF")),s.AQUAMARINE=o(s.fromCssColorString("#7FFFD4")),s.AZURE=o(s.fromCssColorString("#F0FFFF")),s.BEIGE=o(s.fromCssColorString("#F5F5DC")),s.BISQUE=o(s.fromCssColorString("#FFE4C4")),s.BLACK=o(s.fromCssColorString("#000000")),s.BLANCHEDALMOND=o(s.fromCssColorString("#FFEBCD")),s.BLUE=o(s.fromCssColorString("#0000FF")),s.BLUEVIOLET=o(s.fromCssColorString("#8A2BE2")),s.BROWN=o(s.fromCssColorString("#A52A2A")),s.BURLYWOOD=o(s.fromCssColorString("#DEB887")),s.CADETBLUE=o(s.fromCssColorString("#5F9EA0")),s.CHARTREUSE=o(s.fromCssColorString("#7FFF00")),s.CHOCOLATE=o(s.fromCssColorString("#D2691E")),s.CORAL=o(s.fromCssColorString("#FF7F50")),s.CORNFLOWERBLUE=o(s.fromCssColorString("#6495ED")),s.CORNSILK=o(s.fromCssColorString("#FFF8DC")),s.CRIMSON=o(s.fromCssColorString("#DC143C")),s.CYAN=o(s.fromCssColorString("#00FFFF")),s.DARKBLUE=o(s.fromCssColorString("#00008B")),s.DARKCYAN=o(s.fromCssColorString("#008B8B")),s.DARKGOLDENROD=o(s.fromCssColorString("#B8860B")),s.DARKGRAY=o(s.fromCssColorString("#A9A9A9")),s.DARKGREEN=o(s.fromCssColorString("#006400")),s.DARKGREY=s.DARKGRAY,s.DARKKHAKI=o(s.fromCssColorString("#BDB76B")),s.DARKMAGENTA=o(s.fromCssColorString("#8B008B")),s.DARKOLIVEGREEN=o(s.fromCssColorString("#556B2F")),s.DARKORANGE=o(s.fromCssColorString("#FF8C00")),s.DARKORCHID=o(s.fromCssColorString("#9932CC")),s.DARKRED=o(s.fromCssColorString("#8B0000")),s.DARKSALMON=o(s.fromCssColorString("#E9967A")),s.DARKSEAGREEN=o(s.fromCssColorString("#8FBC8F")),s.DARKSLATEBLUE=o(s.fromCssColorString("#483D8B")),s.DARKSLATEGRAY=o(s.fromCssColorString("#2F4F4F")),s.DARKSLATEGREY=s.DARKSLATEGRAY,s.DARKTURQUOISE=o(s.fromCssColorString("#00CED1")),s.DARKVIOLET=o(s.fromCssColorString("#9400D3")),s.DEEPPINK=o(s.fromCssColorString("#FF1493")),s.DEEPSKYBLUE=o(s.fromCssColorString("#00BFFF")),s.DIMGRAY=o(s.fromCssColorString("#696969")),s.DIMGREY=s.DIMGRAY,s.DODGERBLUE=o(s.fromCssColorString("#1E90FF")),s.FIREBRICK=o(s.fromCssColorString("#B22222")),s.FLORALWHITE=o(s.fromCssColorString("#FFFAF0")),s.FORESTGREEN=o(s.fromCssColorString("#228B22")),s.FUSCHIA=o(s.fromCssColorString("#FF00FF")),s.GAINSBORO=o(s.fromCssColorString("#DCDCDC")),s.GHOSTWHITE=o(s.fromCssColorString("#F8F8FF")),s.GOLD=o(s.fromCssColorString("#FFD700")),s.GOLDENROD=o(s.fromCssColorString("#DAA520")),s.GRAY=o(s.fromCssColorString("#808080")),s.GREEN=o(s.fromCssColorString("#008000")),s.GREENYELLOW=o(s.fromCssColorString("#ADFF2F")),s.GREY=s.GRAY,s.HONEYDEW=o(s.fromCssColorString("#F0FFF0")),s.HOTPINK=o(s.fromCssColorString("#FF69B4")),s.INDIANRED=o(s.fromCssColorString("#CD5C5C")),s.INDIGO=o(s.fromCssColorString("#4B0082")),s.IVORY=o(s.fromCssColorString("#FFFFF0")),s.KHAKI=o(s.fromCssColorString("#F0E68C")),s.LAVENDER=o(s.fromCssColorString("#E6E6FA")),s.LAVENDAR_BLUSH=o(s.fromCssColorString("#FFF0F5")),s.LAWNGREEN=o(s.fromCssColorString("#7CFC00")),s.LEMONCHIFFON=o(s.fromCssColorString("#FFFACD")),s.LIGHTBLUE=o(s.fromCssColorString("#ADD8E6")),s.LIGHTCORAL=o(s.fromCssColorString("#F08080")),s.LIGHTCYAN=o(s.fromCssColorString("#E0FFFF")),s.LIGHTGOLDENRODYELLOW=o(s.fromCssColorString("#FAFAD2")),s.LIGHTGRAY=o(s.fromCssColorString("#D3D3D3")),s.LIGHTGREEN=o(s.fromCssColorString("#90EE90")),s.LIGHTGREY=s.LIGHTGRAY,s.LIGHTPINK=o(s.fromCssColorString("#FFB6C1")),s.LIGHTSEAGREEN=o(s.fromCssColorString("#20B2AA")),s.LIGHTSKYBLUE=o(s.fromCssColorString("#87CEFA")),s.LIGHTSLATEGRAY=o(s.fromCssColorString("#778899")),s.LIGHTSLATEGREY=s.LIGHTSLATEGRAY,s.LIGHTSTEELBLUE=o(s.fromCssColorString("#B0C4DE")),s.LIGHTYELLOW=o(s.fromCssColorString("#FFFFE0")),s.LIME=o(s.fromCssColorString("#00FF00")),s.LIMEGREEN=o(s.fromCssColorString("#32CD32")),s.LINEN=o(s.fromCssColorString("#FAF0E6")),s.MAGENTA=o(s.fromCssColorString("#FF00FF")),s.MAROON=o(s.fromCssColorString("#800000")),s.MEDIUMAQUAMARINE=o(s.fromCssColorString("#66CDAA")),s.MEDIUMBLUE=o(s.fromCssColorString("#0000CD")),s.MEDIUMORCHID=o(s.fromCssColorString("#BA55D3")),s.MEDIUMPURPLE=o(s.fromCssColorString("#9370DB")),s.MEDIUMSEAGREEN=o(s.fromCssColorString("#3CB371")),s.MEDIUMSLATEBLUE=o(s.fromCssColorString("#7B68EE")),s.MEDIUMSPRINGGREEN=o(s.fromCssColorString("#00FA9A")),s.MEDIUMTURQUOISE=o(s.fromCssColorString("#48D1CC")),s.MEDIUMVIOLETRED=o(s.fromCssColorString("#C71585")),s.MIDNIGHTBLUE=o(s.fromCssColorString("#191970")),s.MINTCREAM=o(s.fromCssColorString("#F5FFFA")),s.MISTYROSE=o(s.fromCssColorString("#FFE4E1")),s.MOCCASIN=o(s.fromCssColorString("#FFE4B5")),s.NAVAJOWHITE=o(s.fromCssColorString("#FFDEAD")),s.NAVY=o(s.fromCssColorString("#000080")),s.OLDLACE=o(s.fromCssColorString("#FDF5E6")),s.OLIVE=o(s.fromCssColorString("#808000")),s.OLIVEDRAB=o(s.fromCssColorString("#6B8E23")),s.ORANGE=o(s.fromCssColorString("#FFA500")),s.ORANGERED=o(s.fromCssColorString("#FF4500")),s.ORCHID=o(s.fromCssColorString("#DA70D6")),s.PALEGOLDENROD=o(s.fromCssColorString("#EEE8AA")),s.PALEGREEN=o(s.fromCssColorString("#98FB98")),s.PALETURQUOISE=o(s.fromCssColorString("#AFEEEE")),s.PALEVIOLETRED=o(s.fromCssColorString("#DB7093")),s.PAPAYAWHIP=o(s.fromCssColorString("#FFEFD5")),s.PEACHPUFF=o(s.fromCssColorString("#FFDAB9")),s.PERU=o(s.fromCssColorString("#CD853F")),s.PINK=o(s.fromCssColorString("#FFC0CB")),s.PLUM=o(s.fromCssColorString("#DDA0DD")),s.POWDERBLUE=o(s.fromCssColorString("#B0E0E6")),s.PURPLE=o(s.fromCssColorString("#800080")),s.RED=o(s.fromCssColorString("#FF0000")),s.ROSYBROWN=o(s.fromCssColorString("#BC8F8F")),s.ROYALBLUE=o(s.fromCssColorString("#4169E1")),s.SADDLEBROWN=o(s.fromCssColorString("#8B4513")),s.SALMON=o(s.fromCssColorString("#FA8072")),s.SANDYBROWN=o(s.fromCssColorString("#F4A460")),s.SEAGREEN=o(s.fromCssColorString("#2E8B57")),s.SEASHELL=o(s.fromCssColorString("#FFF5EE")),s.SIENNA=o(s.fromCssColorString("#A0522D")),s.SILVER=o(s.fromCssColorString("#C0C0C0")),s.SKYBLUE=o(s.fromCssColorString("#87CEEB")),s.SLATEBLUE=o(s.fromCssColorString("#6A5ACD")),s.SLATEGRAY=o(s.fromCssColorString("#708090")),s.SLATEGREY=s.SLATEGRAY,s.SNOW=o(s.fromCssColorString("#FFFAFA")),s.SPRINGGREEN=o(s.fromCssColorString("#00FF7F")),s.STEELBLUE=o(s.fromCssColorString("#4682B4")),s.TAN=o(s.fromCssColorString("#D2B48C")),s.TEAL=o(s.fromCssColorString("#008080")),s.THISTLE=o(s.fromCssColorString("#D8BFD8")),s.TOMATO=o(s.fromCssColorString("#FF6347")),s.TURQUOISE=o(s.fromCssColorString("#40E0D0")),s.VIOLET=o(s.fromCssColorString("#EE82EE")),s.WHEAT=o(s.fromCssColorString("#F5DEB3")),s.WHITE=o(s.fromCssColorString("#FFFFFF")),s.WHITESMOKE=o(s.fromCssColorString("#F5F5F5")),s.YELLOW=o(s.fromCssColorString("#FFFF00")),s.YELLOWGREEN=o(s.fromCssColorString("#9ACD32")),s.TRANSPARENT=o(new s(0,0,0,0)),s -}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,r,e,n,o){"use strict";if(!n.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(t){switch(t){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new e("componentDatatype is not a valid value.")}},i.fromTypedArray=function(t){return t instanceof Int8Array?i.BYTE:t instanceof Uint8Array?i.UNSIGNED_BYTE:t instanceof Int16Array?i.SHORT:t instanceof Uint16Array?i.UNSIGNED_SHORT:t instanceof Float32Array?i.FLOAT:t instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(t){return r(t)&&(t===i.BYTE||t===i.UNSIGNED_BYTE||t===i.SHORT||t===i.UNSIGNED_SHORT||t===i.FLOAT||t===i.DOUBLE)},i.createTypedArray=function(t,r){switch(t){case i.BYTE:return new Int8Array(r);case i.UNSIGNED_BYTE:return new Uint8Array(r);case i.SHORT:return new Int16Array(r);case i.UNSIGNED_SHORT:return new Uint16Array(r);case i.FLOAT:return new Float32Array(r);case i.DOUBLE:return new Float64Array(r);default:throw new e("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(r,n,o,a){switch(o=t(o,0),a=t(a,(n.byteLength-o)/i.getSizeInBytes(r)),r){case i.BYTE:return new Int8Array(n,o,a);case i.UNSIGNED_BYTE:return new Uint8Array(n,o,a);case i.SHORT:return new Int16Array(n,o,a);case i.UNSIGNED_SHORT:return new Uint16Array(n,o,a);case i.FLOAT:return new Float32Array(n,o,a);case i.DOUBLE:return new Float64Array(n,o,a);default:throw new e("componentDatatype is not a valid value.")}},o(i)}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var r={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(r)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var r={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===r.POINTS||t===r.LINES||t===r.LINE_LOOP||t===r.LINE_STRIP||t===r.TRIANGLES||t===r.TRIANGLE_STRIP||t===r.TRIANGLE_FAN}};return t(r)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,r,e,n,o){"use strict";var i=function(r){r=t(r,t.EMPTY_OBJECT),this.attributes=r.attributes,this.indices=r.indices,this.primitiveType=t(r.primitiveType,o.TRIANGLES),this.boundingSphere=r.boundingSphere,this.geometryType=t(r.geometryType,n.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(t){var n=-1;for(var o in t.attributes)if(t.attributes.hasOwnProperty(o)&&r(t.attributes[o])&&r(t.attributes[o].values)){var i=t.attributes[o],a=i.values.length/i.componentsPerAttribute;if(n!==a&&-1!==n)throw new e("All attribute lists must have the same number of attributes.");n=a}return n},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var r=function(r){r=t(r,t.EMPTY_OBJECT),this.componentDatatype=r.componentDatatype,this.componentsPerAttribute=r.componentsPerAttribute,this.normalize=t(r.normalize,!1),this.values=r.values};return r}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var r=function(r){r=t(r,t.EMPTY_OBJECT),this.position=r.position,this.normal=r.normal,this.st=r.st,this.binormal=r.binormal,this.tangent=r.tangent,this.color=r.color};return r}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,r,e,n){"use strict";var o={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return o.getSizeInBytes=function(t){switch(t){case o.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case o.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case o.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},o.validate=function(r){return t(r)&&(r===o.UNSIGNED_BYTE||r===o.UNSIGNED_SHORT||r===o.UNSIGNED_INT)},o.createTypedArray=function(t,r){return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(r):new Uint16Array(r)},o.createTypedArrayFromArrayBuffer=function(t,r,e,o){return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(r,e,o):new Uint16Array(r,e,o)},e(o)}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(t,r,e,n,o,i,a,s){"use strict";function u(t){var r=t._uSquared,e=t._ellipsoid.maximumRadius,n=t._ellipsoid.minimumRadius,o=(e-n)/e,i=Math.cos(t._startHeading),a=Math.sin(t._startHeading),s=(1-o)*Math.tan(t._start.latitude),u=1/Math.sqrt(1+s*s),l=u*s,c=Math.atan2(s,i),f=u*a,h=f*f,d=1-h,m=Math.sqrt(d),p=r/4,g=p*p,y=g*p,E=g*g,v=1+p-3*g/4+5*y/4-175*E/64,C=1-p+15*g/8-35*y/8,S=1-3*p+35*g/4,w=1-5*p,M=v*c-C*Math.sin(2*c)*p/2-S*Math.sin(4*c)*g/16-w*Math.sin(6*c)*y/48-5*Math.sin(8*c)*E/512,R=t._constants;R.a=e,R.b=n,R.f=o,R.cosineHeading=i,R.sineHeading=a,R.tanU=s,R.cosineU=u,R.sineU=l,R.sigma=c,R.sineAlpha=f,R.sineSquaredAlpha=h,R.cosineSquaredAlpha=d,R.cosineAlpha=m,R.u2Over4=p,R.u4Over16=g,R.u6Over64=y,R.u8Over256=E,R.a0=v,R.a1=C,R.a2=S,R.a3=w,R.distanceRatio=M}function l(t,r){return t*r*(4+t*(4-3*r))/16}function c(t,r,e,n,o,i,a){var s=l(t,e);return(1-s)*t*r*(n+s*o*(a+s*i*(2*a*a-1)))}function f(t,r,e,n,o,i,a){var u,l,f,h,d,m=(r-e)/r,p=i-n,g=Math.atan((1-m)*Math.tan(o)),y=Math.atan((1-m)*Math.tan(a)),E=Math.cos(g),v=Math.sin(g),C=Math.cos(y),S=Math.sin(y),w=E*C,M=E*S,R=v*S,A=v*C,O=p,T=s.TWO_PI,I=Math.cos(O),N=Math.sin(O);do{I=Math.cos(O),N=Math.sin(O);var x=M-A*I;f=Math.sqrt(C*C*N*N+x*x),l=R+w*I,u=Math.atan2(f,l);var _;0===f?(_=0,h=1):(_=w*N/f,h=1-_*_),T=O,d=l-2*R/h,isNaN(d)&&(d=0),O=p+c(m,_,h,u,f,l,d)}while(Math.abs(O-T)>s.EPSILON12);var L=h*(r*r-e*e)/(e*e),b=1+L*(4096+L*(L*(320-175*L)-768))/16384,P=L*(256+L*(L*(74-47*L)-128))/1024,F=d*d,z=P*f*(d+P*(l*(2*F-1)-P*d*(4*f*f-3)*(4*F-3)/6)/4),D=e*b*(u-z),B=Math.atan2(C*N,M-A*I),U=Math.atan2(E*N,M*I-A);t._distance=D,t._startHeading=B,t._endHeading=U,t._uSquared=L}function h(e,n,o,i){t.normalize(i.cartographicToCartesian(n,m),d),t.normalize(i.cartographicToCartesian(o,m),m),f(e,i.maximumRadius,i.minimumRadius,n.longitude,n.latitude,o.longitude,o.latitude),e._start=r.clone(n,e._start),e._end=r.clone(o,e._end),e._start.height=0,e._end.height=0,u(e)}var d=new t,m=new t,p=function(t,o,i){var s=e(i,a.WGS84);this._ellipsoid=s,this._start=new r,this._end=new r,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,n(t)&&n(o)&&h(this,t,o,s)};return o(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(t,r){h(this,t,r,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(t,r){return this.interpolateUsingSurfaceDistance(this._distance*t,r)},p.prototype.interpolateUsingSurfaceDistance=function(t,e){var o=this._constants,i=o.distanceRatio+t/o.b,a=Math.cos(2*i),s=Math.cos(4*i),u=Math.cos(6*i),l=Math.sin(2*i),f=Math.sin(4*i),h=Math.sin(6*i),d=Math.sin(8*i),m=i*i,p=i*m,g=o.u8Over256,y=o.u2Over4,E=o.u6Over64,v=o.u4Over16,C=2*p*g*a/3+i*(1-y+7*v/4-15*E/4+579*g/64-(v-15*E/4+187*g/16)*a-(5*E/4-115*g/16)*s-29*g*u/16)+(y/2-v+71*E/32-85*g/16)*l+(5*v/16-5*E/4+383*g/96)*f-m*((E-11*g/2)*l+5*g*f/2)+(29*E/96-29*g/16)*h+539*g*d/1536,S=Math.asin(Math.sin(C)*o.cosineAlpha),w=Math.atan(o.a/o.b*Math.tan(S));C-=o.sigma;var M=Math.cos(2*o.sigma+C),R=Math.sin(C),A=Math.cos(C),O=o.cosineU*A,T=o.sineU*R,I=Math.atan2(R*o.sineHeading,O-T*o.cosineHeading),N=I-c(o.f,o.sineAlpha,o.cosineSquaredAlpha,C,R,A,M);return n(e)?(e.longitude=this._start.longitude+N,e.latitude=w,e.height=0,e):new r(this._start.longitude+N,w,0)},p}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(t,r){"use strict";function e(t,e,n){var o=t+e;return r.sign(t)!==r.sign(e)&&Math.abs(o/Math.max(Math.abs(t),Math.abs(e)))<n?0:o}var n={};return n.computeDiscriminant=function(t,r,e){var n=r*r-4*t*e;return n},n.computeRealRoots=function(t,n,o){var i;if(0===t)return 0===n?[]:[-o/n];if(0===n){if(0===o)return[0,0];var a=Math.abs(o),s=Math.abs(t);if(s>a&&a/s<r.EPSILON14)return[0,0];if(a>s&&s/a<r.EPSILON14)return[];if(i=-o/t,0>i)return[];var u=Math.sqrt(i);return[-u,u]}if(0===o)return i=-n/t,0>i?[i,0]:[0,i];var l=n*n,c=4*t*o,f=e(l,-c,r.EPSILON14);if(0>f)return[];var h=-.5*e(n,r.sign(n)*Math.sqrt(f),r.EPSILON14);return n>0?[h/t,o/h]:[o/h,h/t]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(t,r){"use strict";function e(t,r,e,n){var o,i,a=t,s=r/3,u=e/3,l=n,c=a*u,f=s*l,h=s*s,d=u*u,m=a*u-h,p=a*l-s*u,g=s*l-d,y=4*m*g-p*p;if(0>y){var E,v,C;h*f>=c*d?(E=a,v=m,C=-2*s*m+a*p):(E=l,v=g,C=-l*p+2*u*g);var S=0>C?-1:1,w=-S*Math.abs(E)*Math.sqrt(-y);i=-C+w;var M=i/2,R=0>M?-Math.pow(-M,1/3):Math.pow(M,1/3),A=i===w?-R:-v/R;return o=0>=v?R+A:-C/(R*R+A*A+v),h*f>=c*d?[(o-s)/a]:[-l/(o+u)]}var O=m,T=-2*s*m+a*p,I=g,N=-l*p+2*u*g,x=Math.sqrt(y),_=Math.sqrt(3)/2,L=Math.abs(Math.atan2(a*x,-T)/3);o=2*Math.sqrt(-O);var b=Math.cos(L);i=o*b;var P=o*(-b/2-_*Math.sin(L)),F=i+P>2*s?i-s:P-s,z=a,D=F/z;L=Math.abs(Math.atan2(l*x,-N)/3),o=2*Math.sqrt(-I),b=Math.cos(L),i=o*b,P=o*(-b/2-_*Math.sin(L));var B=-l,U=2*u>i+P?i+u:P+u,q=B/U,G=z*U,W=-F*U-z*B,Y=F*B,H=(u*W-s*Y)/(-s*W+u*G);return H>=D?q>=D?q>=H?[D,H,q]:[D,q,H]:[q,D,H]:q>=D?[H,D,q]:q>=H?[H,q,D]:[q,H,D]}var n={};return n.computeDiscriminant=function(t,r,e,n){var o=t*t,i=r*r,a=e*e,s=n*n,u=18*t*r*e*n+i*a-27*o*s-4*(t*a*e+i*r*n);return u},n.computeRealRoots=function(t,n,o,i){var a,s;if(0===t)return r.computeRealRoots(n,o,i);if(0===n){if(0===o){if(0===i)return[0,0,0];s=-i/t;var u=0>s?-Math.pow(-s,1/3):Math.pow(s,1/3);return[u,u,u]}return 0===i?(a=r.computeRealRoots(t,0,o),0===a.Length?[0]:[a[0],0,a[1]]):e(t,0,o,i)}return 0===o?0===i?(s=-n/t,0>s?[s,0,0]:[0,0,s]):e(t,n,0,i):0===i?(a=r.computeRealRoots(t,n,o),0===a.length?[0]:a[1]<=0?[a[0],a[1],0]:a[0]>=0?[0,a[0],a[1]]:[a[0],0,a[1]]):e(t,n,o,i)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(t,r,e,n){"use strict";function o(r,o,i,a){var s=r*r,u=o-3*s/8,l=i-o*r/2+s*r/8,c=a-i*r/4+o*s/16-3*s*s/256,f=t.computeRealRoots(1,2*u,u*u-4*c,-l*l);if(f.length>0){var h=-r/4,d=f[f.length-1];if(Math.abs(d)<e.EPSILON14){var m=n.computeRealRoots(1,u,c);if(2===m.length){var p,g=m[0],y=m[1];if(g>=0&&y>=0){var E=Math.sqrt(g),v=Math.sqrt(y);return[h-v,h-E,h+E,h+v]}if(g>=0&&0>y)return p=Math.sqrt(g),[h-p,h+p];if(0>g&&y>=0)return p=Math.sqrt(y),[h-p,h+p]}return[]}if(d>0){var C=Math.sqrt(d),S=(u+d-l/C)/2,w=(u+d+l/C)/2,M=n.computeRealRoots(1,C,S),R=n.computeRealRoots(1,-C,w);return 0!==M.length?(M[0]+=h,M[1]+=h,0!==R.length?(R[0]+=h,R[1]+=h,M[1]<=R[0]?[M[0],M[1],R[0],R[1]]:R[1]<=M[0]?[R[0],R[1],M[0],M[1]]:M[0]>=R[0]&&M[1]<=R[1]?[R[0],M[0],M[1],R[1]]:R[0]>=M[0]&&R[1]<=M[1]?[M[0],R[0],R[1],M[1]]:M[0]>R[0]&&M[0]<R[1]?[R[0],M[0],R[1],M[1]]:[M[0],R[0],M[1],R[1]]):M):0!==R.length?(R[0]+=h,R[1]+=h,R):[]}}return[]}function i(r,o,i,a){var s=i*i,u=o*o,l=r*r,c=-2*o,f=i*r+u-4*a,h=l*a-i*o*r+s,d=t.computeRealRoots(1,c,f,h);if(d.length>0){var m,p,g=d[0],y=o-g,E=y*y,v=r/2,C=y/2,S=E-4*a,w=E+4*Math.abs(a),M=l-4*g,R=l+4*Math.abs(g);if(0>g||M*w>S*R){var A=Math.sqrt(M);m=A/2,p=0===A?0:(r*C-i)/A}else{var O=Math.sqrt(S);m=0===O?0:(r*C-i)/O,p=O/2}var T,I;0===v&&0===m?(T=0,I=0):e.sign(v)===e.sign(m)?(T=v+m,I=g/T):(I=v-m,T=g/I);var N,x;0===C&&0===p?(N=0,x=0):e.sign(C)===e.sign(p)?(N=C+p,x=a/N):(x=C-p,N=a/x);var _=n.computeRealRoots(1,T,N),L=n.computeRealRoots(1,I,x);if(0!==_.length)return 0!==L.length?_[1]<=L[0]?[_[0],_[1],L[0],L[1]]:L[1]<=_[0]?[L[0],L[1],_[0],_[1]]:_[0]>=L[0]&&_[1]<=L[1]?[L[0],_[0],_[1],L[1]]:L[0]>=_[0]&&L[1]<=_[1]?[_[0],L[0],L[1],_[1]]:_[0]>L[0]&&_[0]<L[1]?[L[0],_[0],L[1],_[1]]:[_[0],L[0],_[1],L[1]]:_;if(0!==L.length)return L}return[]}var a={};return a.computeDiscriminant=function(t,r,e,n,o){var i=t*t,a=i*t,s=r*r,u=s*r,l=e*e,c=l*e,f=n*n,h=f*n,d=o*o,m=d*o,p=s*l*f-4*u*h-4*t*c*f+18*t*r*e*h-27*i*f*f+256*a*m+o*(18*u*e*n-4*s*c+16*t*l*l-80*t*r*l*n-6*t*s*f+144*i*e*f)+d*(144*t*s*e-27*s*s-128*i*l-192*i*r*n);return p},a.computeRealRoots=function(r,n,a,s,u){if(Math.abs(r)<e.EPSILON15)return t.computeRealRoots(n,a,s,u);var l=n/r,c=a/r,f=s/r,h=u/r,d=0>l?1:0;switch(d+=0>c?d+1:d,d+=0>f?d+1:d,d+=0>h?d+1:d){case 0:return o(l,c,f,h);case 1:return i(l,c,f,h);case 2:return i(l,c,f,h);case 3:return o(l,c,f,h);case 4:return o(l,c,f,h);case 5:return i(l,c,f,h);case 6:return o(l,c,f,h);case 7:return o(l,c,f,h);case 8:return i(l,c,f,h);case 9:return o(l,c,f,h);case 10:return o(l,c,f,h);case 11:return i(l,c,f,h);case 12:return o(l,c,f,h);case 13:return o(l,c,f,h);case 14:return o(l,c,f,h);case 15:return o(l,c,f,h);default:return void 0}},a}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(t,r,e){"use strict";var n=function(e,n){n=t.clone(r(n,t.ZERO)),t.equals(n,t.ZERO)||t.normalize(n,n),this.origin=t.clone(r(e,t.ZERO)),this.direction=n};return n.getPoint=function(r,n,o){return e(o)||(o=new t),o=t.multiplyByScalar(r.direction,n,o),t.add(r.origin,o,o)},n}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(t,r,e,n,o,i,a,s,u,l){"use strict";function c(r,n,o,a,s){s=e(s,!1);var u,l,c,f,h,d=r.origin,m=r.direction,p=t.subtract(o,n,g),S=t.subtract(a,n,y),w=t.cross(m,S,E),M=t.dot(p,w);if(s){if(M<i.EPSILON6)return void 0;if(u=t.subtract(d,n,v),c=t.dot(u,w),0>c||c>M)return void 0;if(l=t.cross(u,p,C),f=t.dot(m,l),0>f||c+f>M)return void 0;h=t.dot(S,l)/M}else{if(Math.abs(M)<i.EPSILON6)return void 0;var R=1/M;if(u=t.subtract(d,n,v),c=t.dot(u,w)*R,0>c||c>1)return void 0;if(l=t.cross(u,p,C),f=t.dot(m,l)*R,0>f||c+f>1)return void 0;h=t.dot(S,l)*R}return h}function f(t,r,e,n){var o=r*r-4*t*e;if(0>o)return void 0;if(o>0){var i=1/(2*t),a=Math.sqrt(o),s=(-r+a)*i,u=(-r-a)*i;return u>s?(n.root0=s,n.root1=u):(n.root0=u,n.root1=s),n}var l=-r/(2*t);return 0===l?void 0:(n.root0=n.root1=l,n)}function h(r,e,o){n(o)||(o={});var i=r.origin,a=r.direction,s=e.center,u=e.radius*e.radius,l=t.subtract(i,s,E),c=t.dot(a,a),h=2*t.dot(a,l),d=t.magnitudeSquared(l)-u,m=f(c,h,d,w);return n(m)?(o.start=m.root0,o.stop=m.root1,o):void 0}function d(t,r,e){var n=t+r;return i.sign(t)!==i.sign(r)&&Math.abs(n/Math.max(Math.abs(t),Math.abs(r)))<e?0:n}function m(r,e,n,o,l){var c,f=o*o,h=l*l,m=(r[a.COLUMN1ROW1]-r[a.COLUMN2ROW2])*h,p=l*(o*d(r[a.COLUMN1ROW0],r[a.COLUMN0ROW1],i.EPSILON15)+e.y),g=r[a.COLUMN0ROW0]*f+r[a.COLUMN2ROW2]*h+o*e.x+n,y=h*d(r[a.COLUMN2ROW1],r[a.COLUMN1ROW2],i.EPSILON15),E=l*(o*d(r[a.COLUMN2ROW0],r[a.COLUMN0ROW2])+e.z),v=[];if(0===E&&0===y){if(c=s.computeRealRoots(m,p,g),0===c.length)return v;var C=c[0],S=Math.sqrt(Math.max(1-C*C,0));if(v.push(new t(o,l*C,l*-S)),v.push(new t(o,l*C,l*S)),2===c.length){var w=c[1],M=Math.sqrt(Math.max(1-w*w,0));v.push(new t(o,l*w,l*-M)),v.push(new t(o,l*w,l*M))}return v}var R=E*E,A=y*y,O=m*m,T=E*y,I=O+A,N=2*(p*m+T),x=2*g*m+p*p-A+R,_=2*(g*p-T),L=g*g-R;if(0===I&&0===N&&0===x&&0===_)return v;c=u.computeRealRoots(I,N,x,_,L);var b=c.length;if(0===b)return v;for(var P=0;b>P;++P){var F,z=c[P],D=z*z,B=Math.max(1-D,0),U=Math.sqrt(B);F=i.sign(m)===i.sign(g)?d(m*D+g,p*z,i.EPSILON12):i.sign(g)===i.sign(p*z)?d(m*D,p*z+g,i.EPSILON12):d(m*D+p*z,g,i.EPSILON12);var q=d(y*z,E,i.EPSILON15),G=F*q;0>G?v.push(new t(o,l*z,l*U)):G>0?v.push(new t(o,l*z,l*-U)):0!==U?(v.push(new t(o,l*z,l*-U)),v.push(new t(o,l*z,l*U)),++P):v.push(new t(o,l*z,l*U))}return v}var p={};p.rayPlane=function(r,e,o){n(o)||(o=new t);var a=r.origin,s=r.direction,u=e.normal,l=t.dot(u,s);if(Math.abs(l)<i.EPSILON15)return void 0;var c=(-e.distance-t.dot(u,a))/l;return 0>c?void 0:(o=t.multiplyByScalar(s,c,o),t.add(a,o,o))};var g=new t,y=new t,E=new t,v=new t,C=new t;p.rayTriangle=function(r,e,o,i,a,s){var u=c(r,e,o,i,a);return!n(u)||0>u?void 0:(n(s)||(s=new t),t.multiplyByScalar(r.direction,u,s),t.add(r.origin,s,s))};var S=new l;p.lineSegmentTriangle=function(r,e,o,i,a,s,u){var l=S;t.clone(r,l.origin),t.subtract(e,r,l.direction),t.normalize(l.direction,l.direction);var f=c(l,o,i,a,s);return!n(f)||0>f||f>t.distance(r,e)?void 0:(n(u)||(u=new t),t.multiplyByScalar(l.direction,f,u),t.add(l.origin,u,u))};var w={root0:0,root1:0};p.raySphere=function(t,r,e){return e=h(t,r,e),!n(e)||e.stop<0?void 0:(e.start=Math.max(e.start,0),e)};var M=new l;p.lineSegmentSphere=function(r,e,o,i){var a=M;t.clone(r,a.origin);var s=t.subtract(e,r,a.direction),u=t.magnitude(s);return t.normalize(s,s),i=h(a,o,i),!n(i)||i.stop<0||i.start>u?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,u),i)};var R=new t,A=new t;p.rayEllipsoid=function(r,e){var n,o,i,a,s,u=e.oneOverRadii,l=t.multiplyComponents(u,r.origin,R),c=t.multiplyComponents(u,r.direction,A),f=t.magnitudeSquared(l),h=t.dot(l,c);if(f>1){if(h>=0)return void 0;var d=h*h;if(n=f-1,o=t.magnitudeSquared(c),i=o*n,i>d)return void 0;if(d>i){a=h*h-i,s=-h+Math.sqrt(a);var m=s/o,p=n/s;return p>m?{start:m,stop:p}:{start:p,stop:m}}var g=Math.sqrt(n/o);return{start:g,stop:g}}return 1>f?(n=f-1,o=t.magnitudeSquared(c),i=o*n,a=h*h-i,s=-h+Math.sqrt(a),{start:0,stop:s/o}):0>h?(o=t.magnitudeSquared(c),{start:0,stop:-h/o}):void 0};var O=new t,T=new t,I=new t,N=new t,x=new t,_=new a,L=new a,b=new a,P=new a,F=new a,z=new a,D=new a,B=new t,U=new t,q=new r;p.grazingAltitudeLocation=function(r,e){var o=r.origin,s=r.direction,u=e.geodeticSurfaceNormal(o,O);if(t.dot(s,u)>=0)return o;var l=n(this.rayEllipsoid(r,e)),c=e.transformPositionToScaledSpace(s,O),f=t.normalize(c,c),h=t.mostOrthogonalAxis(c,N),d=t.normalize(t.cross(h,f,T),T),p=t.normalize(t.cross(f,d,I),I),g=_;g[0]=f.x,g[1]=f.y,g[2]=f.z,g[3]=d.x,g[4]=d.y,g[5]=d.z,g[6]=p.x,g[7]=p.y,g[8]=p.z;var y=a.transpose(g,L),E=a.fromScale(e.radii,b),v=a.fromScale(e.oneOverRadii,P),C=F;C[0]=0,C[1]=-s.z,C[2]=s.y,C[3]=s.z,C[4]=0,C[5]=-s.x,C[6]=-s.y,C[7]=s.x,C[8]=0;var S,w,M=a.multiply(a.multiply(y,v,z),C,z),R=a.multiply(a.multiply(M,E,D),g,D),A=a.multiplyByVector(M,o,x),G=m(R,t.negate(A,O),0,0,1),W=G.length;if(W>0){for(var Y=t.clone(t.ZERO,U),H=Number.NEGATIVE_INFINITY,V=0;W>V;++V){S=a.multiplyByVector(E,a.multiplyByVector(g,G[V],B),B);var k=t.normalize(t.subtract(S,o,N),N),K=t.dot(k,s);K>H&&(H=K,Y=t.clone(S,Y))}var j=e.cartesianToCartographic(Y,q);return H=i.clamp(H,0,1),w=t.magnitude(t.subtract(Y,o,N))*Math.sqrt(1-H*H),w=l?-w:w,j.height=w,e.cartographicToCartesian(j,new t)}return void 0};var G=new t;return p.lineSegmentPlane=function(r,e,o,a){n(a)||(a=new t);var s=t.subtract(e,r,G),u=o.normal,l=t.dot(u,s);if(Math.abs(l)<i.EPSILON6)return void 0;var c=t.dot(u,r),f=-(o.distance+c)/l;return 0>f||f>1?void 0:(t.multiplyByScalar(s,f,a),t.add(r,a,a),a)},p.trianglePlaneIntersection=function(r,e,n,o){var i=o.normal,a=o.distance,s=t.dot(i,r)+a<0,u=t.dot(i,e)+a<0,l=t.dot(i,n)+a<0,c=0;c+=s?1:0,c+=u?1:0,c+=l?1:0;var f,h;if((1===c||2===c)&&(f=new t,h=new t),1===c){if(s)return p.lineSegmentPlane(r,e,o,f),p.lineSegmentPlane(r,n,o,h),{positions:[r,e,n,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(u)return p.lineSegmentPlane(e,n,o,f),p.lineSegmentPlane(e,r,o,h),{positions:[r,e,n,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(l)return p.lineSegmentPlane(n,r,o,f),p.lineSegmentPlane(n,e,o,h),{positions:[r,e,n,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===c){if(!s)return p.lineSegmentPlane(e,r,o,f),p.lineSegmentPlane(n,r,o,h),{positions:[r,e,n,f,h],indices:[1,2,4,1,4,3,0,3,4]};if(!u)return p.lineSegmentPlane(n,e,o,f),p.lineSegmentPlane(r,e,o,h),{positions:[r,e,n,f,h],indices:[2,0,4,2,4,3,1,3,4]};if(!l)return p.lineSegmentPlane(r,n,o,f),p.lineSegmentPlane(e,n,o,h),{positions:[r,e,n,f,h],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),define("Core/isArray",["./defined"],function(t){"use strict";var r=Array.isArray;return t(r)||(r=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),r}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(t,r,e,n,o,i,a,s,u,l,c,f){"use strict";function h(t,r,e){var n=R;n.length=t;var o;if(r===e){for(o=0;t>o;o++)n[o]=r;return n}var i=e-r,a=i/t;for(o=0;t>o;o++){var s=r+o*a;n[o]=s}return n}function d(r,e,n,o,i,a,s,u){var l=o.scaleToGeodeticSurface(r,I),c=o.scaleToGeodeticSurface(e,N),f=m.numberOfPoints(r,e,n),d=o.cartesianToCartographic(l,A),p=o.cartesianToCartographic(c,O),g=h(f,i,a);x.setEndPoints(d,p);var y=x.surfaceDistance/f,E=u;d.height=i;var v=o.cartographicToCartesian(d,T);t.pack(v,s,E),E+=3;for(var C=1;f>C;C++){var S=x.interpolateUsingSurfaceDistance(C*y,O);S.height=g[C],v=o.cartographicToCartesian(S,T),t.pack(v,s,E),E+=3}return E}var m={};m.numberOfPoints=function(r,e,n){var o=t.distance(r,e);return Math.ceil(o/n)};var p=new r;m.extractHeights=function(t,r){for(var e=t.length,n=new Array(e),o=0;e>o;o++){var i=t[o];n[o]=r.cartesianToCartographic(i,p).height}return n};var g=new c,y=new t,E=new t,v=new f(t.ZERO,0),C=new t,S=new f(t.ZERO,0),w=new t,M=new t,R=[],A=new r,O=new r,T=new t,I=new t,N=new t,x=new a;m.wrapLongitude=function(r,o){var i=[],a=[];if(n(r)&&r.length>0){o=e(o,c.IDENTITY);var u=c.inverseTransformation(o,g),l=c.multiplyByPoint(u,t.ZERO,y),h=c.multiplyByPointAsVector(u,t.UNIT_Y,E),d=f.fromPointNormal(l,h,v),m=c.multiplyByPointAsVector(u,t.UNIT_X,C),p=f.fromPointNormal(l,m,S),R=1;i.push(t.clone(r[0]));for(var A=i[0],O=r.length,T=1;O>T;++T){var I=r[T];if(f.getPointDistance(p,A)<0||f.getPointDistance(p,I)<0){var N=s.lineSegmentPlane(A,I,d,w);if(n(N)){var x=t.multiplyByScalar(h,5e-9,M);f.getPointDistance(d,A)<0&&t.negate(x,x),i.push(t.add(N,x,new t)),a.push(R+1),t.negate(x,x),i.push(t.add(N,x,new t)),R=1}}i.push(t.clone(r[T])),R++,A=I}a.push(R)}return{positions:i,lengths:a}};var _=l.EPSILON7;return m.removeDuplicates=function(r){var e=r.length;if(2>e)return r;var n,o,i;for(n=1;e>n&&(o=r[n-1],i=r[n],!t.equalsEpsilon(o,i,_));++n);if(n===e)return r;for(var a=r.slice(0,n);e>n;++n)i=r[n],t.equalsEpsilon(o,i,_)||(a.push(t.clone(i)),o=i);return a},m.generateArc=function(r){n(r)||(r={});var o=r.positions,a=o.length,s=e(r.ellipsoid,i.WGS84),c=e(r.height,0);if(1>a)return[];if(1===a){var f=s.scaleToGeodeticSurface(o[0],I);if(0!==c){var h=s.geodeticSurfaceNormal(f,T);t.multiplyByScalar(h,c,h),t.add(f,h,f)}return[f.x,f.y,f.z]}var p=r.minDistance;if(!n(p)){var g=e(r.granularity,l.RADIANS_PER_DEGREE);p=l.chordLength(g,s.maximumRadius)}var y,E=0;for(y=0;a-1>y;y++)E+=m.numberOfPoints(o[y],o[y+1],p);var v=3*(E+1),C=new Array(v),S=0,w=u(c);for(y=0;a-1>y;y++){var M=o[y],O=o[y+1],N=w?c[y]:c,x=w?c[y+1]:c;S=d(M,O,p,s,N,x,C,S)}R.length=0;var _=o[a-1],L=s.cartesianToCartographic(_,A);L.height=w?c[a-1]:c;var b=s.cartographicToCartesian(L,T);return t.pack(b,C,v-3),C},m.generateCartesianArc=function(r){for(var e=m.generateArc(r),n=e.length/3,o=new Array(n),i=0;n>i;i++)o[i]=t.unpack(e,3*i);return o},m}),define("Core/SimplePolylineGeometry",["./BoundingSphere","./Cartesian3","./Color","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PolylinePipeline","./PrimitiveType"],function(t,r,e,n,o,i,a,s,u,l,c,f,h,d,m){"use strict";function p(t,r,n,o,i,a,s){var u,l=d.numberOfPoints(t,r,i),c=n.red,f=n.green,h=n.blue,m=n.alpha,p=o.red,g=o.green,y=o.blue,E=o.alpha;if(e.equals(n,o)){for(u=0;l>u;u++)a[s++]=e.floatToByte(c),a[s++]=e.floatToByte(f),a[s++]=e.floatToByte(h),a[s++]=e.floatToByte(m);return s}var v=(p-c)/l,C=(g-f)/l,S=(y-h)/l,w=(E-m)/l,M=s;for(u=0;l>u;u++)a[M++]=e.floatToByte(c+u*v),a[M++]=e.floatToByte(f+u*C),a[M++]=e.floatToByte(h+u*S),a[M++]=e.floatToByte(m+u*w);return M}var g=function(t){t=o(t,o.EMPTY_OBJECT);var n=t.positions,a=t.colors,u=o(t.colorsPerVertex,!1);this._positions=n,this._colors=a,this._colorsPerVertex=u,this._followSurface=o(t.followSurface,!0),this._granularity=o(t.granularity,h.RADIANS_PER_DEGREE),this._ellipsoid=o(t.ellipsoid,s.WGS84),this._workerName="createSimplePolylineGeometry";var l=1+n.length*r.packedLength;l+=i(a)?1+a.length*e.packedLength:1,this.packedLength=l+s.packedLength+3};g.pack=function(t,n,a){a=o(a,0);var u,l=t._positions,c=l.length;for(n[a++]=c,u=0;c>u;++u,a+=r.packedLength)r.pack(l[u],n,a);var f=t._colors;for(c=i(f)?f.length:0,n[a++]=c,u=0;c>u;++u,a+=e.packedLength)e.pack(f[u],n,a);s.pack(t._ellipsoid,n,a),a+=s.packedLength,n[a++]=t._colorsPerVertex?1:0,n[a++]=t._followSurface?1:0,n[a]=t._granularity},g.unpack=function(t,n,a){n=o(n,0);var u,l=t[n++],c=new Array(l);for(u=0;l>u;++u,n+=r.packedLength)c[u]=r.unpack(t,n);l=t[n++];var f=l>0?new Array(l):void 0;for(u=0;l>u;++u,n+=e.packedLength)f[u]=e.unpack(t,n);var h=s.unpack(t,n);n+=s.packedLength;var d=1===t[n++],m=1===t[n++],p=t[n];return i(a)?(a._positions=c,a._colors=f,a._ellipsoid=h,a._colorsPerVertex=d,a._followSurface=m,a._granularity=p,a):new g({positions:c,colors:f,ellipsoid:h,colorsPerVertex:d,followSurface:m,granularity:p})};var y=new Array(2),E=new Array(2),v={positions:y,height:E,ellipsoid:void 0,minDistance:void 0};return g.createGeometry=function(o){var a,s,g,C,S,w=o._positions,M=o._colors,R=o._colorsPerVertex,A=o._followSurface,O=o._granularity,T=o._ellipsoid,I=h.chordLength(O,T.maximumRadius),N=i(M)&&!R,x=w.length,_=0;if(A){var L=d.extractHeights(w,T),b=v;if(b.minDistance=I,b.ellipsoid=T,N){var P=0;for(a=0;x-1>a;a++)P+=d.numberOfPoints(w[a],w[a+1],I)+1;s=new Float64Array(3*P),C=new Uint8Array(4*P),b.positions=y,b.height=E;var F=0;for(a=0;x-1>a;++a){y[0]=w[a],y[1]=w[a+1],E[0]=L[a],E[1]=L[a+1];var z=d.generateArc(b);if(i(M)){var D=z.length/3;S=M[a];for(var B=0;D>B;++B)C[F++]=e.floatToByte(S.red),C[F++]=e.floatToByte(S.green),C[F++]=e.floatToByte(S.blue),C[F++]=e.floatToByte(S.alpha)}s.set(z,_),_+=z.length}}else if(b.positions=w,b.height=L,s=new Float64Array(d.generateArc(b)),i(M)){for(C=new Uint8Array(4*(s.length/3)),a=0;x-1>a;++a){var U=w[a],q=w[a+1],G=M[a],W=M[a+1];_=p(U,q,G,W,I,C,_)}var Y=M[x-1];C[_++]=e.floatToByte(Y.red),C[_++]=e.floatToByte(Y.green),C[_++]=e.floatToByte(Y.blue),C[_++]=e.floatToByte(Y.alpha)}}else{g=N?2*x-2:x,s=new Float64Array(3*g),C=i(M)?new Uint8Array(4*g):void 0;var H=0,V=0;for(a=0;x>a;++a){var k=w[a];if(N&&a>0&&(r.pack(k,s,H),H+=3,S=M[a-1],C[V++]=e.floatToByte(S.red),C[V++]=e.floatToByte(S.green),C[V++]=e.floatToByte(S.blue),C[V++]=e.floatToByte(S.alpha)),N&&a===x-1)break;r.pack(k,s,H),H+=3,i(M)&&(S=M[a],C[V++]=e.floatToByte(S.red),C[V++]=e.floatToByte(S.green),C[V++]=e.floatToByte(S.blue),C[V++]=e.floatToByte(S.alpha))}}var K=new c;K.position=new l({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:s}),i(M)&&(K.color=new l({componentDatatype:n.UNSIGNED_BYTE,componentsPerAttribute:4,values:C,normalize:!0})),g=s.length/3;var j=2*(g-1),Z=f.createTypedArray(g,j),X=0;for(a=0;g-1>a;++a)Z[X++]=a,Z[X++]=a+1;return new u({attributes:K,indices:Z,primitiveType:m.LINES,boundingSphere:t.fromPoints(w)})},g}),define("Workers/createSimplePolylineGeometry",["../Core/defined","../Core/Ellipsoid","../Core/SimplePolylineGeometry"],function(t,r,e){"use strict";function n(n,o){return t(o)&&(n=e.unpack(n,o)),n._ellipsoid=r.clone(n._ellipsoid),e.createGeometry(n)}return n})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createSphereGeometry.js b/libs/Cesium/Workers/createSphereGeometry.js deleted file mode 100644 index 17d1b4ea..00000000 --- a/libs/Cesium/Workers/createSphereGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(t){return t>0?1:0>t?-1:0},n.signNotZero=function(t){return 0>t?-1:1},n.toSNorm=function(t){return Math.round(255*(.5*n.clamp(t,-1,1)+.5))},n.fromSNorm=function(t){return 2*(n.clamp(t,0,255)/255)-1},n.sinh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e-n)},n.cosh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e+n)},n.lerp=function(t,e,n){return(1-n)*t+n*e},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(t){return t*n.RADIANS_PER_DEGREE},n.toDegrees=function(t){return t*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(t){var e=n.TWO_PI,r=t-Math.floor(t/e)*e;return r<-Math.PI?r+e:r>=Math.PI?r-e:r},n.negativePiToPi=function(t){return n.zeroToTwoPi(t+n.PI)-n.PI},n.zeroToTwoPi=function(t){var e=n.mod(t,n.TWO_PI);return Math.abs(e)<n.EPSILON14&&Math.abs(t)>n.EPSILON14?n.TWO_PI:e},n.mod=function(t,e){return(t%e+e)%e},n.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return i>=a||a<=r*Math.max(Math.abs(t),Math.abs(n))};var r=[1];n.factorial=function(t){var e=r.length;if(t>=e)for(var n=r[e-1],i=e;t>=i;i++)r.push(n*i);return r[t]},n.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},n.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},n.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},n.clamp=function(t,e,n){return e>t?e:t>n?n:t};var i=new t;return n.setRandomNumberSeed=function(e){i=new t(e)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(t){return Math.acos(n.clamp(t,-1,1))},n.asinClamped=function(t){return Math.asin(n.clamp(t,-1,1))},n.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)};a.fromSpherical=function(n,r){e(r)||(r=new a);var i=n.clock,o=n.cone,u=t(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(t,n,r,i){return e(i)?(i.x=t,i.y=n,i.z=r,i):new a(t,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):n.y<=n.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)},a.cross=function(t,e,n){var r=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(t,e,n,r,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),e(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o++)r[o]=i.toRadians(t[o]);return a.fromRadiansArray(r,e,n)},a.fromRadiansArray=function(t,n,r){var i=t.length;e(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o+=3)r[o]=i.toRadians(t[o]),r[o+1]=i.toRadians(t[o+1]),r[o+2]=t[o+2];return a.fromRadiansArrayHeights(r,e,n)},a.fromRadiansArrayHeights=function(t,n,r){var i=t.length;e(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)};return a.fromRadians=function(n,r,i,o){return i=t(i,0),e(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(t,e,n,r){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},a.equalsEpsilon=function(t,n,r){return t===n||e(t)&&e(n)&&Math.abs(t.longitude-n.longitude)<=r&&Math.abs(t.latitude-n.latitude)<=r&&Math.abs(t.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var e={},n=function(n,r){t(e[n])||(e[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(e,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),e._radii=new t(r,i,a),e._radiiSquared=new t(r*r,i*i,a*a),e._radiiToTheFourth=new t(r*r*r*r,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(r,i,a),e._maximumRadius=Math.max(r,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,n){if(!r(e))return void 0;var i=e._radii;return r(n)?(t.clone(i,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return r(e)||(e=new c),r(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,r,i){i=n(i,0),t.pack(e._radii,r,i)},c.unpack=function(e,r,i){r=n(r,0);var a=t.unpack(e,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,n){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(e,n){return r(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;c.prototype.cartographicToCartesian=function(e,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),r(n)||(n=new t),t.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var h=new t,d=new t,m=new t;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=t.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(t.dot(s,n))*t.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new e(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,n){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),E=t.multiplyByScalar(e,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?t.clone(E,n):void 0;var x=this._oneOverRadiiSquared,g=x.x,S=x.y,M=x.z,_=p;_.x=2*E.x*g,_.y=2*E.y*S,_.z=2*E.z*M;var O,z,T,N,I,R,P,b,A,C,L,q=(1-w)*t.magnitude(e)/(.5*t.magnitude(_)),U=0;do{q-=U,T=1/(1+q*g),N=1/(1+q*S),I=1/(1+q*M),R=T*T,P=N*N,b=I*I,A=R*T,C=P*N,L=b*I,O=h*R+d*P+m*b-1,z=h*A*g+d*C*S+m*L*M;var D=-2*z;U=O/D}while(Math.abs(O)>u.EPSILON12);return r(n)?(n.x=i*T,n.y=a*N,n.z=o*I,n):new t(i*T,a*N,o*I)},c.prototype.scaleToGeocentricSurface=function(e,n){r(n)||(n=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,n)},c.prototype.transformPositionToScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._radii,n)},c.prototype.equals=function(e){return this===e||r(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";var u=function(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var e={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(e)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var e=function(e,n){this.start=t(e,0),this.stop=t(n,0)};return e}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)};a.fromElements=function(t,n,r,i,o){return e(o)?(o.x=t,o.y=n,o.z=r,o.w=i,o):new a(t,n,r,i)},a.fromColor=function(t,n){return e(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new a(t.red,t.green,t.blue,t.alpha)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new a(t.x,t.y,t.z,t.w):void 0},a.packedLength=4,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n.w=Math.min(t.w,e.w),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n.w=Math.max(t.w,e.w),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e.w=t.w/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n.w=t.w*e.w,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n.w=t.w+e.w,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n.w=t.w-e.w,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n.w=t.w*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n.w=t.w/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e.w=Math.abs(t.w),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,s);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]&&t.w===e[n+3]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)&&i.equalsEpsilon(t.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t){for(var e=0,n=0;9>n;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function u(t){for(var e=0,n=0;3>n;++n){var r=t[c.getElementIndex(d[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function s(t,e){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(t[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(t[c.getElementIndex(m,f)])>n){var y,p=t[c.getElementIndex(m,m)],v=t[c.getElementIndex(f,f)],w=t[c.getElementIndex(m,f)],E=(p-v)/2/w;y=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),s=1/Math.sqrt(1+y*y),l=y*s}return e=c.clone(c.IDENTITY,e),e[c.getElementIndex(f,f)]=e[c.getElementIndex(m,m)]=s,e[c.getElementIndex(m,f)]=l,e[c.getElementIndex(f,m)]=-l,e}var c=function(t,n,r,i,a,o,u,s,c){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(u,0),this[3]=e(n,0),this[4]=e(a,0),this[5]=e(s,0),this[6]=e(r,0),this[7]=e(o,0),this[8]=e(c,0)};c.packedLength=9,c.pack=function(t,n,r){r=e(r,0),n[r++]=t[0],n[r++]=t[1],n[r++]=t[2],n[r++]=t[3],n[r++]=t[4],n[r++]=t[5],n[r++]=t[6],n[r++]=t[7],n[r++]=t[8]},c.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r++],i[1]=t[r++],i[2]=t[r++],i[3]=t[r++],i[4]=t[r++],i[5]=t[r++],i[6]=t[r++],i[7]=t[r++],i[8]=t[r++],i},c.clone=function(t,e){return n(t)?n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new c(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},c.fromArray=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r],i[1]=t[r+1],i[2]=t[r+2],i[3]=t[r+3],i[4]=t[r+4],i[5]=t[r+5],i[6]=t[r+6],i[7]=t[r+7],i[8]=t[r+8],i},c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},c.fromQuaternion=function(t,e){var r=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,s=t.y*t.z,l=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,E=2*(s-o),x=2*(a-l),g=2*(s+o),S=-r-u+f+d;return n(e)?(e[0]=m,e[1]=v,e[2]=x,e[3]=y,e[4]=w,e[5]=g,e[6]=p,e[7]=E,e[8]=S,e):new c(m,y,p,v,w,E,x,g,S)},c.fromScale=function(t,e){return n(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new c(t.x,0,0,0,t.y,0,0,0,t.z)},c.fromUniformScale=function(t,e){return n(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new c(t,0,0,0,t,0,0,0,t)},c.fromCrossProduct=function(t,e){return n(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new c(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},c.fromRotationX=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=r,e[5]=i,e[6]=0,e[7]=-i,e[8]=r,e):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=r,e):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},c.getElementIndex=function(t,e){return 3*t+e},c.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;c.getMaximumScale=function(e){return c.getScale(e,f),t.maximumComponent(f)},c.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],l=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],f=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},c.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},c.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],l=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=l,e};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(t,e){var r=a.EPSILON20,i=10,l=0,f=0;n(e)||(e={});for(var h=e.unitary=c.clone(c.IDENTITY,e.unitary),d=e.diagonal=c.clone(t,e.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},c.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(t,e){var n=t[0],i=t[1],o=t[2],u=t[3],s=t[4],l=t[5],f=t[6],h=t[7],d=t[8],m=c.determinant(t);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");e[0]=s*d-h*l,e[1]=h*o-i*d,e[2]=i*l-s*o,e[3]=f*l-u*d,e[4]=n*d-f*o,e[5]=u*o-n*l,e[6]=u*h-f*s,e[7]=f*i-n*h,e[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(e,y,e)},c.equals=function(t,e){return t===e||n(t)&&n(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},c.equalsEpsilon=function(t,e,r){return t===e||n(t)&&n(e)&&Math.abs(t[0]-e[0])<=r&&Math.abs(t[1]-e[1])<=r&&Math.abs(t[2]-e[2])<=r&&Math.abs(t[3]-e[3])<=r&&Math.abs(t[4]-e[4])<=r&&Math.abs(t[5]-e[5])<=r&&Math.abs(t[6]-e[6])<=r&&Math.abs(t[7]-e[7])<=r&&Math.abs(t[8]-e[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var e=function(t){this.name="RuntimeError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,e,n,r,i,a,o,u,s){"use strict";var c=function(t,e,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(t,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(e,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(t,e,r){r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e[r++]=t[9],e[r++]=t[10],e[r++]=t[11],e[r++]=t[12],e[r++]=t[13],e[r++]=t[14],e[r]=t[15]},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},c.clone=function(t,e){return r(t)?r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):new c(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},c.fromRotationTranslation=function(e,i,a){return i=n(i,t.ZERO),r(a)?(a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=0,a[4]=e[3],a[5]=e[4],a[6]=e[5],a[7]=0,a[8]=e[6],a[9]=e[7],a[10]=e[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(e[0],e[3],e[6],i.x,e[1],e[4],e[7],i.y,e[2],e[5],e[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(t,e,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=e.x*e.x,l=e.x*e.y,f=e.x*e.z,h=e.x*e.w,d=e.y*e.y,m=e.y*e.z,y=e.y*e.w,p=e.z*e.z,v=e.z*e.w,w=e.w*e.w,E=s-d-p+w,x=2*(l-v),g=2*(f+y),S=2*(l+v),M=-s+d-p+w,_=2*(m-h),O=2*(f-y),z=2*(m+h),T=-s-d+p+w;return i[0]=E*a,i[1]=S*a,i[2]=O*a,i[3]=0,i[4]=x*o,i[5]=M*o,i[6]=z*o,i[7]=0,i[8]=g*u,i[9]=_*u,i[10]=T*u,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i},c.fromTranslation=function(t,e){return c.fromRotationTranslation(u.IDENTITY,t,e)},c.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},c.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var l=new t,f=new t,h=new t;c.fromCamera=function(e,n){var i=e.eye,a=e.target,o=e.up;t.normalize(t.subtract(a,i,l),l),t.normalize(t.cross(l,o,f),f),t.normalize(t.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,E=h.z,x=i.x,g=i.y,S=i.z,M=u*-x+s*-g+d*-S,_=v*-x+w*-g+E*-S,O=m*x+y*g+p*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=E,n[10]=-p,n[11]=0,n[12]=M,n[13]=_,n[14]=O,n[15]=1,n):new c(u,s,d,M,v,w,E,_,-m,-y,-p,O,0,0,0,1)},c.computePerspectiveFieldOfView=function(t,e,n,r,i){var a=Math.tan(.5*t),o=1/a,u=o/e,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(t,e,n,r,i,a,o){var u=1/(e-t),s=1/(r-n),c=1/(a-i),l=-(e+t)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(t,e,n,r,i,a,o){var u=2*i/(e-t),s=2*i/(r-n),c=(e+t)/(e-t),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(t,e,n,r,i,a){var o=2*i/(e-t),u=2*i/(r-n),s=(e+t)/(e-t),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(t,e,r,i){t=n(t,n.EMPTY_OBJECT);var a=n(t.x,0),o=n(t.y,0),u=n(t.width,0),s=n(t.height,0);e=n(e,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-e),h=c,d=l,m=f,y=a+c,p=o+l,v=e+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},c.getElementIndex=function(t,e){return 4*t+e},c.getColumn=function(t,e,n){var r=4*e,i=t[r],a=t[r+1],o=t[r+2],u=t[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=4*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=t[15],n},c.getRow=function(t,e,n){var r=t[e],i=t[e+4],a=t[e+8],o=t[e+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+4]=n.y,r[e+8]=n.z,r[e+12]=n.w,r};var d=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],d)),n.y=t.magnitude(t.fromElements(e[4],e[5],e[6],d)),n.z=t.magnitude(t.fromElements(e[8],e[9],e[10],d)),n};var m=new t;c.getMaximumScale=function(e){return c.getScale(e,m),t.maximumComponent(m)},c.multiply=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[3],u=t[4],s=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],p=t[13],v=t[14],w=t[15],E=e[0],x=e[1],g=e[2],S=e[3],M=e[4],_=e[5],O=e[6],z=e[7],T=e[8],N=e[9],I=e[10],R=e[11],P=e[12],b=e[13],A=e[14],C=e[15],L=r*E+u*x+f*g+y*S,q=i*E+s*x+h*g+p*S,U=a*E+c*x+d*g+v*S,D=o*E+l*x+m*g+w*S,B=r*M+u*_+f*O+y*z,F=i*M+s*_+h*O+p*z,k=a*M+c*_+d*O+v*z,W=o*M+l*_+m*O+w*z,G=r*T+u*N+f*I+y*R,V=i*T+s*N+h*I+p*R,Y=a*T+c*N+d*I+v*R,j=o*T+l*N+m*I+w*R,Z=r*P+u*b+f*A+y*C,H=i*P+s*b+h*A+p*C,X=a*P+c*b+d*A+v*C,K=o*P+l*b+m*A+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=D,n[4]=B,n[5]=F,n[6]=k,n[7]=W,n[8]=G,n[9]=V,n[10]=Y,n[11]=j,n[12]=Z,n[13]=H,n[14]=X,n[15]=K,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n[9]=t[9]+e[9],n[10]=t[10]+e[10],n[11]=t[11]+e[11],n[12]=t[12]+e[12],n[13]=t[13]+e[13],n[14]=t[14]+e[14],n[15]=t[15]+e[15],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n[9]=t[9]-e[9],n[10]=t[10]-e[10],n[11]=t[11]-e[11],n[12]=t[12]-e[12],n[13]=t[13]-e[13],n[14]=t[14]-e[14],n[15]=t[15]-e[15],n},c.multiplyTransformation=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=t[12],d=t[13],m=t[14],y=e[0],p=e[1],v=e[2],w=e[4],E=e[5],x=e[6],g=e[8],S=e[9],M=e[10],_=e[12],O=e[13],z=e[14],T=r*y+o*p+c*v,N=i*y+u*p+l*v,I=a*y+s*p+f*v,R=r*w+o*E+c*x,P=i*w+u*E+l*x,b=a*w+s*E+f*x,A=r*g+o*S+c*M,C=i*g+u*S+l*M,L=a*g+s*S+f*M,q=r*_+o*O+c*z+h,U=i*_+u*O+l*z+d,D=a*_+s*O+f*z+m;return n[0]=T,n[1]=N,n[2]=I,n[3]=0,n[4]=R,n[5]=P,n[6]=b,n[7]=0,n[8]=A,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=D,n[15]=1,n},c.multiplyByMatrix3=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=e[0],d=e[1],m=e[2],y=e[3],p=e[4],v=e[5],w=e[6],E=e[7],x=e[8],g=r*h+o*d+c*m,S=i*h+u*d+l*m,M=a*h+s*d+f*m,_=r*y+o*p+c*v,O=i*y+u*p+l*v,z=a*y+s*p+f*v,T=r*w+o*E+c*x,N=i*w+u*E+l*x,I=a*w+s*E+f*x;return n[0]=g,n[1]=S,n[2]=M,n[3]=0,n[4]=_,n[5]=O,n[6]=z,n[7]=0,n[8]=T,n[9]=N,n[10]=I,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},c.multiplyByTranslation=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=r*t[0]+i*t[4]+a*t[8]+t[12],u=r*t[1]+i*t[5]+a*t[9]+t[13],s=r*t[2]+i*t[6]+a*t[10]+t[14];return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=o,n[13]=u,n[14]=s,n[15]=t[15],n};var y=new t;c.multiplyByUniformScale=function(t,e,n){return y.x=e,y.y=e,y.z=e,c.multiplyByScale(t,y,n)},c.multiplyByScale=function(t,e,n){var r=e.x,i=e.y,a=e.z;return 1===r&&1===i&&1===a?c.clone(t,n):(n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=0,n[4]=i*t[4],n[5]=i*t[5],n[6]=i*t[6],n[7]=0,n[8]=a*t[8],n[9]=a*t[9],n[10]=a*t[10],n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=1,n)},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t[0]*r+t[4]*i+t[8]*a+t[12]*o,s=t[1]*r+t[5]*i+t[9]*a+t[13]*o,c=t[2]*r+t[6]*i+t[10]*a+t[14]*o,l=t[3]*r+t[7]*i+t[11]*a+t[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a,u=t[1]*r+t[5]*i+t[9]*a,s=t[2]*r+t[6]*i+t[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a+t[12],u=t[1]*r+t[5]*i+t[9]*a+t[13],s=t[2]*r+t[6]*i+t[10]*a+t[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n[9]=t[9]*e,n[10]=t[10]*e,n[11]=t[11]*e,n[12]=t[12]*e,n[13]=t[13]*e,n[14]=t[14]*e,n[15]=t[15]*e,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},c.transpose=function(t,e){var n=t[1],r=t[2],i=t[3],a=t[6],o=t[7],u=t[11];return e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[10]=t[10],e[11]=t[14],e[12]=i,e[13]=o,e[14]=u,e[15]=t[15],e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e[9]=Math.abs(t[9]),e[10]=Math.abs(t[10]),e[11]=Math.abs(t[11]),e[12]=Math.abs(t[12]),e[13]=Math.abs(t[13]),e[14]=Math.abs(t[14]),e[15]=Math.abs(t[15]),e},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[3]===e[3]&&t[7]===e[7]&&t[11]===e[11]&&t[15]===e[15]},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n&&Math.abs(t[9]-e[9])<=n&&Math.abs(t[10]-e[10])<=n&&Math.abs(t[11]-e[11])<=n&&Math.abs(t[12]-e[12])<=n&&Math.abs(t[13]-e[13])<=n&&Math.abs(t[14]-e[14])<=n&&Math.abs(t[15]-e[15])<=n},c.getTranslation=function(t,e){return e.x=t[12],e.y=t[13],e.z=t[14],e},c.getRotation=function(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e};var p=new u,v=new u,w=new e,E=new e(0,0,0,1);return c.inverse=function(t,n){if(u.equalsEpsilon(c.getRotation(t,p),v,o.EPSILON7)&&e.equals(c.getRow(t,3,w),E))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-t[12],n[13]=-t[13],n[14]=-t[14],n[15]=1,n;var r=t[0],i=t[4],a=t[8],l=t[12],f=t[1],h=t[5],d=t[9],m=t[13],y=t[2],x=t[6],g=t[10],S=t[14],M=t[3],_=t[7],O=t[11],z=t[15],T=g*z,N=S*O,I=x*z,R=S*_,P=x*O,b=g*_,A=y*z,C=S*M,L=y*O,q=g*M,U=y*_,D=x*M,B=T*h+R*d+P*m-(N*h+I*d+b*m),F=N*f+A*d+q*m-(T*f+C*d+L*m),k=I*f+C*h+U*m-(R*f+A*h+D*m),W=b*f+L*h+D*d-(P*f+q*h+U*d),G=N*i+I*a+b*l-(T*i+R*a+P*l),V=T*r+C*a+L*l-(N*r+A*a+q*l),Y=R*r+A*i+D*l-(I*r+C*i+U*l),j=P*r+q*i+U*a-(b*r+L*i+D*a);T=a*m,N=l*d,I=i*m,R=l*h,P=i*d,b=a*h,A=r*m,C=l*f,L=r*d,q=a*f,U=r*h,D=i*f;var Z=T*_+R*O+P*z-(N*_+I*O+b*z),H=N*M+A*O+q*z-(T*M+C*O+L*z),X=I*M+C*_+U*z-(R*M+A*_+D*z),K=b*M+L*_+D*O-(P*M+q*_+U*O),J=I*g+b*S+N*x-(P*S+T*x+R*g),Q=L*S+T*y+C*g-(A*g+q*S+N*y),$=A*x+D*S+R*y-(U*S+I*y+C*x),te=U*g+P*y+q*x-(L*x+D*g+b*y),ee=r*B+i*F+a*k+l*W;if(Math.abs(ee)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return ee=1/ee,n[0]=B*ee,n[1]=F*ee,n[2]=k*ee,n[3]=W*ee,n[4]=G*ee,n[5]=V*ee,n[6]=Y*ee,n[7]=j*ee,n[8]=Z*ee,n[9]=H*ee,n[10]=X*ee,n[11]=K*ee,n[12]=J*ee,n[13]=Q*ee,n[14]=$*ee,n[15]=te*ee,n},c.inverseTransformation=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],u=t[6],s=t[8],c=t[9],l=t[10],f=t[12],h=t[13],d=t[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return e[0]=n,e[1]=a,e[2]=s,e[3]=0,e[4]=r,e[5]=o,e[6]=c,e[7]=0,e[8]=i,e[9]=u,e[10]=l,e[11]=0,e[12]=m,e[13]=y,e[14]=p,e[15]=1,e},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]&&t[9]===e[n+9]&&t[10]===e[n+10]&&t[11]===e[n+11]&&t[12]===e[n+12]&&t[13]===e[n+13]&&t[14]===e[n+14]&&t[15]===e[n+15]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e,n){this.normal=t.clone(e),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-t.dot(r,n);return e(a)?(t.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new t;return i.fromCartesian4=function(n,r){var o=t.fromCartesian4(n,a),u=n.w;return e(r)?(t.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(e,n){return t.dot(e.normal,n)+e.distance},i.ORIGIN_XY_PLANE=r(new i(t.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(t.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(t.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";var s=function(t,n,r,i){this.west=e(t,0),this.south=e(n,0),this.east=e(r,0),this.north=e(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(t,n,r){r=e(r,0),n[r++]=t.west,n[r++]=t.south,n[r++]=t.east,n[r]=t.north},s.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new s),i.west=t[r++],i.south=t[r++],i.east=t[r++],i.north=t[r],i},s.computeWidth=function(t){var e=t.east,n=t.west;return n>e&&(e+=u.TWO_PI),e-n},s.computeHeight=function(t){return t.north-t.south},s.fromDegrees=function(t,r,i,a,o){return t=u.toRadians(e(t,0)),r=u.toRadians(e(r,0)),i=u.toRadians(e(i,0)),a=u.toRadians(e(a,0)),n(o)?(o.west=t,o.south=r,o.east=i,o.north=a,o):new s(t,r,i,a)},s.fromCartographicArray=function(t,e){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=t.length;c>u;u++){var l=t[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(e)?(e.west=r,e.south=a,e.east=i,e.north=o,e):new s(r,a,i,o)},s.clone=function(t,e){return n(t)?n(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north):void 0},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||n(t)&&n(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return n(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(){},s.southwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.south,r.height=0,r):new t(e.west,e.south)},s.northwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.north,r.height=0,r):new t(e.west,e.north)},s.northeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.north,r.height=0,r):new t(e.east,e.north)},s.southeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.south,r.height=0,r):new t(e.east,e.south)},s.center=function(e,r){var i=e.east,a=e.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(e.south+e.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new t(o,s)},s.intersection=function(t,e,r){var i=t.east,a=t.west,o=e.east,c=e.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((t.west<t.east||e.west<e.east)&&l>=f)return void 0;var h=Math.max(t.south,e.south),d=Math.min(t.north,e.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(t,e){var n=e.longitude,r=e.latitude,i=t.west,a=t.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,r,i,o){r=e(r,a.WGS84),i=e(i,0),n(o)||(o=[]);var l=0,f=t.north,h=t.south,d=t.east,m=t.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(t,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,r){this.center=t.clone(n(e,t.ZERO)),this.radius=n(r,0)},m=new t,y=new t,p=new t,v=new t,w=new t,E=new t,x=new t,g=new t,S=new t,M=new t,_=new t,O=new t;d.fromPoints=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;for(var i=t.clone(e[0],x),a=t.clone(i,m),o=t.clone(i,y),u=t.clone(i,p),s=t.clone(i,v),c=t.clone(i,w),l=t.clone(i,E),f=e.length,h=1;f>h;h++){t.clone(e[h],i);var z=i.x,T=i.y,N=i.z;z<a.x&&t.clone(i,a),z>s.x&&t.clone(i,s),T<o.y&&t.clone(i,o),T>c.y&&t.clone(i,c),N<u.z&&t.clone(i,u),N>l.z&&t.clone(i,l)}var I=t.magnitudeSquared(t.subtract(s,a,g)),R=t.magnitudeSquared(t.subtract(c,o,g)),P=t.magnitudeSquared(t.subtract(l,u,g)),b=a,A=s,C=I;R>C&&(C=R,b=o,A=c),P>C&&(C=P,b=u,A=l);var L=S;L.x=.5*(b.x+A.x),L.y=.5*(b.y+A.y),L.z=.5*(b.z+A.z);var q=t.magnitudeSquared(t.subtract(A,L,g)),U=Math.sqrt(q),D=M;D.x=a.x,D.y=o.y,D.z=u.z;var B=_;B.x=s.x,B.y=c.y,B.z=l.z;var F=t.multiplyByScalar(t.add(D,B,g),.5,O),k=0;for(h=0;f>h;h++){t.clone(e[h],i);var W=t.magnitude(t.subtract(i,F,g));W>k&&(k=W);var G=t.magnitudeSquared(t.subtract(i,L,g));if(G>q){var V=Math.sqrt(G);U=.5*(U+V),q=U*U;var Y=V-U;L.x=(U*L.x+Y*i.x)/V,L.y=(U*L.y+Y*i.y)/V,L.z=(U*L.z+Y*i.z)/V}}return k>U?(t.clone(L,n.center),n.radius=U):(t.clone(F,n.center),n.radius=k),n};var z=new u,T=new t,N=new t,I=new e,R=new e;d.fromRectangle2D=function(t,e,n){return d.fromRectangleWithHeights2D(t,e,0,0,n)},d.fromRectangleWithHeights2D=function(e,i,a,o,u){if(r(u)||(u=new d),!r(e))return u.center=t.clone(t.ZERO,u.center),u.radius=0,u;i=n(i,z),h.southwest(e,I),I.height=a,h.northeast(e,R),R.height=o;var s=i.project(I,T),c=i.project(R,N),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var P=[];d.fromRectangle3D=function(t,e,i,a){e=n(e,o.WGS84),i=n(i,0);var u;return r(t)&&(u=h.subsample(t,e,i,P)),d.fromPoints(u,a)},d.fromVertices=function(e,i,a,o){if(r(o)||(o=new d),!r(e)||0===e.length)return o.center=t.clone(t.ZERO,o.center),o.radius=0,o;i=n(i,t.ZERO),a=n(a,3);var u=x;u.x=e[0]+i.x,u.y=e[1]+i.y,u.z=e[2]+i.z;for(var s=t.clone(u,m),c=t.clone(u,y),l=t.clone(u,p),f=t.clone(u,v),h=t.clone(u,w),z=t.clone(u,E),T=e.length,N=0;T>N;N+=a){var I=e[N]+i.x,R=e[N+1]+i.y,P=e[N+2]+i.z;u.x=I,u.y=R,u.z=P,I<s.x&&t.clone(u,s),I>f.x&&t.clone(u,f),R<c.y&&t.clone(u,c),R>h.y&&t.clone(u,h),P<l.z&&t.clone(u,l),P>z.z&&t.clone(u,z)}var b=t.magnitudeSquared(t.subtract(f,s,g)),A=t.magnitudeSquared(t.subtract(h,c,g)),C=t.magnitudeSquared(t.subtract(z,l,g)),L=s,q=f,U=b;A>U&&(U=A,L=c,q=h),C>U&&(U=C,L=l,q=z);var D=S;D.x=.5*(L.x+q.x),D.y=.5*(L.y+q.y),D.z=.5*(L.z+q.z);var B=t.magnitudeSquared(t.subtract(q,D,g)),F=Math.sqrt(B),k=M;k.x=s.x,k.y=c.y,k.z=l.z;var W=_;W.x=f.x,W.y=h.y,W.z=z.z;var G=t.multiplyByScalar(t.add(k,W,g),.5,O),V=0;for(N=0;T>N;N+=a){u.x=e[N]+i.x,u.y=e[N+1]+i.y,u.z=e[N+2]+i.z;var Y=t.magnitude(t.subtract(u,G,g));Y>V&&(V=Y);var j=t.magnitudeSquared(t.subtract(u,D,g));if(j>B){var Z=Math.sqrt(j);F=.5*(F+Z),B=F*F;var H=Z-F;D.x=(F*D.x+H*u.x)/Z,D.y=(F*D.y+H*u.y)/Z,D.z=(F*D.z+H*u.z)/Z}}return V>F?(t.clone(D,o.center),o.radius=F):(t.clone(G,o.center),o.radius=V),o},d.fromCornerPoints=function(e,n,i){r(i)||(i=new d);var a=i.center;return t.add(e,n,a),t.multiplyByScalar(a,.5,a),i.radius=t.distance(a,n),i},d.fromEllipsoid=function(e,n){return r(n)||(n=new d),t.clone(t.ZERO,n.center),n.radius=e.maximumRadius,n};var b=new t;d.fromBoundingSpheres=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var i=e.length;if(1===i)return d.clone(e[0],n);if(2===i)return d.union(e[0],e[1],n);for(var a=[],o=0;i>o;o++)a.push(e[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=e[o];s=Math.max(s,t.distance(u,c.center,b)+c.radius)}return n.radius=s,n},d.clone=function(e,n){return r(e)?r(n)?(n.center=t.clone(e.center,n.center),n.radius=e.radius,n):new d(e.center,e.radius):void 0},d.packedLength=4,d.pack=function(t,e,r){r=n(r,0);var i=t.center;e[r++]=i.x,e[r++]=i.y,e[r++]=i.z,e[r]=t.radius},d.unpack=function(t,e,i){e=n(e,0),r(i)||(i=new d);var a=i.center;return a.x=t[e++],a.y=t[e++],a.z=t[e++],i.radius=t[e],i};var A=new t,C=new t;d.union=function(e,n,i){r(i)||(i=new d);var a=e.center,o=e.radius,u=n.center,s=n.radius,c=t.subtract(u,a,A),l=t.magnitude(c);if(o>=l+s)return e.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=t.multiplyByScalar(c,(-o+f)/l,C);return t.add(h,a,h),t.clone(h,i.center),i.radius=f,i};var L=new t;d.expand=function(e,n,r){r=d.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new t,0);d.intersect=function(t,e){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(e,q);return d.intersectPlane(t,n)},d.transform=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=l.getMaximumScale(e)*t.radius,n};var U=new t;d.distanceSquaredTo=function(e,n){var r=t.subtract(e.center,n,U);return t.magnitudeSquared(r)-e.radius*e.radius},d.transformWithoutScale=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=t.radius,n};var D=new t;d.computePlaneDistances=function(e,n,i,a){r(a)||(a=new c);var o=t.subtract(e.center,n,D),u=t.multiplyByScalar(i,t.dot(i,o),D),s=t.magnitude(u);return a.start=s-e.radius,a.stop=s+e.radius,a};for(var B=new t,F=new t,k=new t,W=new t,G=new t,V=new e,Y=new Array(8),j=0;8>j;++j)Y[j]=new t;var Z=new u;return d.projectTo2D=function(e,r,i){r=n(r,Z);var a=r.ellipsoid,o=e.center,u=e.radius,s=a.geodeticSurfaceNormal(o,B),c=t.cross(t.UNIT_Z,s,F);t.normalize(c,c);var l=t.cross(s,c,k);t.normalize(l,l),t.multiplyByScalar(s,u,s),t.multiplyByScalar(l,u,l),t.multiplyByScalar(c,u,c);var f=t.negate(l,G),h=t.negate(c,W),m=Y,y=m[0];t.add(s,l,y),t.add(y,c,y),y=m[1],t.add(s,l,y),t.add(y,h,y),y=m[2],t.add(s,f,y),t.add(y,h,y),y=m[3],t.add(s,f,y),t.add(y,c,y),t.negate(s,s),y=m[4],t.add(s,l,y),t.add(y,c,y),y=m[5],t.add(s,l,y),t.add(y,h,y),y=m[6],t.add(s,f,y),t.add(y,h,y),y=m[7],t.add(s,f,y),t.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];t.add(o,w,w);var E=a.cartesianToCartographic(w,V);r.project(E,w)}i=d.fromPoints(m,i),o=i.center;var x=o.x,g=o.y,S=o.z;return o.x=S,o.y=x,o.z=g,i},d.equals=function(e,n){return e===n||r(e)&&r(n)&&t.equals(e.center,n.center)&&e.radius===n.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n){this.x=t(e,0),this.y=t(n,0)};a.fromElements=function(t,n,r){return e(r)?(r.x=t,r.y=n,r):new a(t,n)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n):new a(t.x,t.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r]=e.y},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y)},a.minimumComponent=function(t){return Math.min(t.x,t.y)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){return a.normalize(t,s),a.normalize(e,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Y,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)},a.ZERO=r(new a(0,0)),a.UNIT_X=r(new a(1,0)),a.UNIT_Y=r(new a(0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,e){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return e(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(t(n))return n;n=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof e[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof e[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",t(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",t(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",t(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",t(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(t){i.supportsFullscreen()&&t[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,e,n){"use strict";function r(t){for(var e=t.split("."),n=0,r=e.length;r>n;++n)e[n]=parseInt(e[n],10);return e}function i(){if(!e(p)){p=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(p=!0,v=r(t[1]))}return p}function a(){return i()&&v}function o(){if(!e(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(w=!0,E=r(t[1]))}return w}function u(){return o()&&E}function s(){if(!e(x)){x=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(x=!0,g=r(t[1]),g.isNightly=!!t[2])}return x}function c(){return s()&&g}function l(){if(!e(S)){S=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1])))}return S}function f(){return l()&&M}function h(){if(!e(_)){_=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(_=!0,O=r(t[1]))}return _}function d(){return e(z)||(z=/Windows/i.test(navigator.appVersion)),z}function m(){return h()&&O}function y(){return e(T)||(T=e(window.PointerEvent)&&(!e(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var p,v,w,E,x,g,S,M,_,O,z,T,N={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return N.supportsFullscreen=function(){return n.supportsFullscreen()},N.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},N.supportsWebWorkers=function(){return"undefined"!=typeof Worker},N}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,e,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(t){switch(t){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(t){return t instanceof Int8Array?a.BYTE:t instanceof Uint8Array?a.UNSIGNED_BYTE:t instanceof Int16Array?a.SHORT:t instanceof Uint16Array?a.UNSIGNED_SHORT:t instanceof Float32Array?a.FLOAT:t instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(t){return e(t)&&(t===a.BYTE||t===a.UNSIGNED_BYTE||t===a.SHORT||t===a.UNSIGNED_SHORT||t===a.FLOAT||t===a.DOUBLE)},a.createTypedArray=function(t,e){switch(t){case a.BYTE:return new Int8Array(e);case a.UNSIGNED_BYTE:return new Uint8Array(e);case a.SHORT:return new Int16Array(e);case a.UNSIGNED_SHORT:return new Uint16Array(e);case a.FLOAT:return new Float32Array(e);case a.DOUBLE:return new Float64Array(e);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(e,r,i,o){switch(i=t(i,0),o=t(o,(r.byteLength-i)/a.getSizeInBytes(e)),e){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var e={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(e)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===e.POINTS||t===e.LINES||t===e.LINE_LOOP||t===e.LINE_STRIP||t===e.TRIANGLES||t===e.TRIANGLE_STRIP||t===e.TRIANGLE_FAN}};return t(e)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,e,n,r,i){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=t(e.primitiveType,i.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=t(e.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(t){var r=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&e(t.attributes[i])&&e(t.attributes[i].values)){var a=t.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=t(e.normalize,!1),this.values=e.values -};return e}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color};return e}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(t){switch(t){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(e){return t(e)&&(e===i.UNSIGNED_BYTE||e===i.UNSIGNED_SHORT||e===i.UNSIGNED_INT)},i.createTypedArray=function(t,e){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e):new Uint16Array(e)},i.createTypedArrayFromArrayBuffer=function(t,e,n,i){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e,n,i):new Uint16Array(e,n,i)},n(i)}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e){e=t(e,t.EMPTY_OBJECT),this.position=t(e.position,!1),this.normal=t(e.normal,!1),this.st=t(e.st,!1),this.binormal=t(e.binormal,!1),this.tangent=t(e.tangent,!1),this.color=t(e.color,!1)};return i.POSITION_ONLY=r(new i({position:!0})),i.POSITION_AND_NORMAL=r(new i({position:!0,normal:!0})),i.POSITION_NORMAL_AND_ST=r(new i({position:!0,normal:!0,st:!0})),i.POSITION_AND_ST=r(new i({position:!0,st:!0})),i.POSITION_AND_COLOR=r(new i({position:!0,color:!0})),i.ALL=r(new i({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),i.DEFAULT=i.POSITION_NORMAL_AND_ST,i.packedLength=6,i.pack=function(e,n,r){r=t(r,0),n[r++]=e.position?1:0,n[r++]=e.normal?1:0,n[r++]=e.st?1:0,n[r++]=e.binormal?1:0,n[r++]=e.tangent?1:0,n[r++]=e.color?1:0},i.unpack=function(n,r,a){return r=t(r,0),e(a)||(a=new i),a.position=1===n[r++],a.normal=1===n[r++],a.st=1===n[r++],a.binormal=1===n[r++],a.tangent=1===n[r++],a.color=1===n[r++],a},i.clone=function(t,n){return e(t)?(e(n)||(n=new i),n.position=t.position,n.normal=t.normal,n.st=t.st,n.binormal=t.binormal,n.tangent=t.tangent,n.color=t.color,n):void 0},i}),define("Core/EllipsoidGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./VertexFormat"],function(t,e,n,r,i,a,o,u,s,c,l,f,h,d,m){"use strict";var y=new n,p=new n,v=new n,w=new n,E=new n,x=new n(1,1,1),g=Math.cos,S=Math.sin,M=function(t){t=i(t,i.EMPTY_OBJECT);var e=i(t.radii,x),r=i(t.stackPartitions,64),a=i(t.slicePartitions,64),o=i(t.vertexFormat,m.DEFAULT);this._radii=n.clone(e),this._stackPartitions=r,this._slicePartitions=a,this._vertexFormat=m.clone(o),this._workerName="createEllipsoidGeometry"};M.packedLength=n.packedLength+m.packedLength+2,M.pack=function(t,e,r){r=i(r,0),n.pack(t._radii,e,r),r+=n.packedLength,m.pack(t._vertexFormat,e,r),r+=m.packedLength,e[r++]=t._stackPartitions,e[r]=t._slicePartitions};var _=new n,O=new m,z={radii:_,vertexFormat:O,stackPartitions:void 0,slicePartitions:void 0};return M.unpack=function(t,e,r){e=i(e,0);var o=n.unpack(t,e,_);e+=n.packedLength;var u=m.unpack(t,e,O);e+=m.packedLength;var s=t[e++],c=t[e];return a(r)?(r._radii=n.clone(o,r._radii),r._vertexFormat=m.clone(u,r._vertexFormat),r._stackPartitions=s,r._slicePartitions=c,r):(z.stackPartitions=s,z.slicePartitions=c,new M(z))},M.createGeometry=function(i){var a,o,m=i._radii,x=u.fromCartesian3(m),M=i._vertexFormat,_=i._slicePartitions+1,O=i._stackPartitions+1,z=O*_,T=new Float64Array(3*z),N=6*(_-1)*(O-1),I=f.createTypedArray(z,N),R=M.normal?new Float32Array(3*z):void 0,P=M.tangent?new Float32Array(3*z):void 0,b=M.binormal?new Float32Array(3*z):void 0,A=M.st?new Float32Array(2*z):void 0,C=new Array(_),L=new Array(_),q=0;for(a=0;_>a;a++){var U=h.TWO_PI*a/(_-1);C[a]=g(U),L[a]=S(U),T[q++]=0,T[q++]=0,T[q++]=m.z}for(a=1;O-1>a;a++){var D=Math.PI*a/(O-1),B=S(D),F=m.x*B,k=m.y*B,W=m.z*g(D);for(o=0;_>o;o++)T[q++]=C[o]*F,T[q++]=L[o]*k,T[q++]=W}for(a=0;_>a;a++)T[q++]=0,T[q++]=0,T[q++]=-m.z;var G=new l;M.position&&(G.position=new c({componentDatatype:r.DOUBLE,componentsPerAttribute:3,values:T}));var V=0,Y=0,j=0,Z=0;if(M.st||M.normal||M.tangent||M.binormal){for(a=0;z>a;a++){var H=n.fromArray(T,3*a,y),X=x.geodeticSurfaceNormal(H,p);if(M.st){var K=e.negate(X,E);e.magnitude(K)<h.EPSILON6&&(q=3*(a+_*Math.floor(.5*O)),q>T.length&&(q=3*(a-_*Math.floor(.5*O))),n.fromArray(T,q,K),x.geodeticSurfaceNormal(K,K),e.negate(K,K)),A[V++]=Math.atan2(K.y,K.x)/h.TWO_PI+.5,A[V++]=Math.asin(X.z)/Math.PI+.5}if(M.normal&&(R[Y++]=X.x,R[Y++]=X.y,R[Y++]=X.z),M.tangent||M.binormal){var J=v;if(_>a||a>z-_-1?(n.cross(n.UNIT_X,X,J),n.normalize(J,J)):(n.cross(n.UNIT_Z,X,J),n.normalize(J,J)),M.tangent&&(P[j++]=J.x,P[j++]=J.y,P[j++]=J.z),M.binormal){var Q=n.cross(X,J,w);n.normalize(Q,Q),b[Z++]=Q.x,b[Z++]=Q.y,b[Z++]=Q.z}}}M.st&&(G.st=new c({componentDatatype:r.FLOAT,componentsPerAttribute:2,values:A})),M.normal&&(G.normal=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:R})),M.tangent&&(G.tangent=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:P})),M.binormal&&(G.binormal=new c({componentDatatype:r.FLOAT,componentsPerAttribute:3,values:b}))}for(q=0,a=0;O>a;a++){var $=a*_,te=(a+1)*_;for(o=0;_-1>o;o++)I[q++]=te+o,I[q++]=te+o+1,I[q++]=$+o+1,I[q++]=te+o,I[q++]=$+o+1,I[q++]=$+o}return new s({attributes:G,indices:I,primitiveType:d.TRIANGLES,boundingSphere:t.fromEllipsoid(x)})},M}),define("Core/SphereGeometry",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./EllipsoidGeometry","./VertexFormat"],function(t,e,n,r,i,a){"use strict";var o=function(n){var r=e(n.radius,1),a=new t(r,r,r),o={radii:a,stackPartitions:n.stackPartitions,slicePartitions:n.slicePartitions,vertexFormat:n.vertexFormat};this._ellipsoidGeometry=new i(o),this._workerName="createSphereGeometry"};o.packedLength=i.packedLength,o.pack=function(t,e,n){i.pack(t._ellipsoidGeometry,e,n)};var u=new i,s={radius:void 0,radii:new t,vertexFormat:new a,stackPartitions:void 0,slicePartitions:void 0};return o.unpack=function(e,r,c){var l=i.unpack(e,r,u);return s.vertexFormat=a.clone(l._vertexFormat,s.vertexFormat),s.stackPartitions=l._stackPartitions,s.slicePartitions=l._slicePartitions,n(c)?(t.clone(l._radii,s.radii),c._ellipsoidGeometry=new i(s),c):(s.radius=l._radii.x,new o(s))},o.createGeometry=function(t){return i.createGeometry(t._ellipsoidGeometry)},o}),define("Workers/createSphereGeometry",["../Core/defined","../Core/SphereGeometry"],function(t,e){"use strict";return function(n,r){return t(r)&&(n=e.unpack(n,r)),e.createGeometry(n)}})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createSphereOutlineGeometry.js b/libs/Cesium/Workers/createSphereOutlineGeometry.js deleted file mode 100644 index 8eba0bd7..00000000 --- a/libs/Cesium/Workers/createSphereOutlineGeometry.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(t){return t>0?1:0>t?-1:0},n.signNotZero=function(t){return 0>t?-1:1},n.toSNorm=function(t){return Math.round(255*(.5*n.clamp(t,-1,1)+.5))},n.fromSNorm=function(t){return 2*(n.clamp(t,0,255)/255)-1},n.sinh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e-n)},n.cosh=function(t){var e=Math.pow(Math.E,t),n=Math.pow(Math.E,-1*t);return.5*(e+n)},n.lerp=function(t,e,n){return(1-n)*t+n*e},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(t){return t*n.RADIANS_PER_DEGREE},n.toDegrees=function(t){return t*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(t){var e=n.TWO_PI,r=t-Math.floor(t/e)*e;return r<-Math.PI?r+e:r>=Math.PI?r-e:r},n.negativePiToPi=function(t){return n.zeroToTwoPi(t+n.PI)-n.PI},n.zeroToTwoPi=function(t){var e=n.mod(t,n.TWO_PI);return Math.abs(e)<n.EPSILON14&&Math.abs(t)>n.EPSILON14?n.TWO_PI:e},n.mod=function(t,e){return(t%e+e)%e},n.equalsEpsilon=function(t,n,r,i){i=e(i,r);var a=Math.abs(t-n);return i>=a||a<=r*Math.max(Math.abs(t),Math.abs(n))};var r=[1];n.factorial=function(t){var e=r.length;if(t>=e)for(var n=r[e-1],i=e;t>=i;i++)r.push(n*i);return r[t]},n.incrementWrap=function(t,n,r){return r=e(r,0),++t,t>n&&(t=r),t},n.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},n.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},n.clamp=function(t,e,n){return e>t?e:t>n?n:t};var i=new t;return n.setRandomNumberSeed=function(e){i=new t(e)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(t){return Math.acos(n.clamp(t,-1,1))},n.asinClamped=function(t){return Math.asin(n.clamp(t,-1,1))},n.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0)};a.fromSpherical=function(n,r){e(r)||(r=new a);var i=n.clock,o=n.cone,u=t(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(t,n,r,i){return e(i)?(i.x=t,i.y=n,i.z=r,i):new a(t,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r]=e.z},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,l);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):n.y<=n.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)},a.cross=function(t,e,n){var r=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(t,e,n,r,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),e(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o++)r[o]=i.toRadians(t[o]);return a.fromRadiansArray(r,e,n)},a.fromRadiansArray=function(t,n,r){var i=t.length;e(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(t,e,n){for(var r=new Array(t.length),o=0;o<t.length;o+=3)r[o]=i.toRadians(t[o]),r[o+1]=i.toRadians(t[o+1]),r[o+2]=t[o+2];return a.fromRadiansArrayHeights(r,e,n)},a.fromRadiansArrayHeights=function(t,n,r){var i=t.length;e(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r){this.longitude=t(e,0),this.latitude=t(n,0),this.height=t(r,0)};return a.fromRadians=function(n,r,i,o){return i=t(i,0),e(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(t,e,n,r){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,n,r)},a.clone=function(t,n){return e(t)?e(n)?(n.longitude=t.longitude,n.latitude=t.latitude,n.height=t.height,n):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.longitude===n.longitude&&t.latitude===n.latitude&&t.height===n.height},a.equalsEpsilon=function(t,n,r){return t===n||e(t)&&e(n)&&Math.abs(t.longitude-n.longitude)<=r&&Math.abs(t.latitude-n.latitude)<=r&&Math.abs(t.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(t){"use strict";var e={},n=function(n,r){t(e[n])||(e[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),n=Object.defineProperties;return e&&t(n)||(n=function(t){return t}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";function s(e,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),e._radii=new t(r,i,a),e._radiiSquared=new t(r*r,i*i,a*a),e._radiiToTheFourth=new t(r*r*r*r,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(r,i,a),e._maximumRadius=Math.max(r,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,n){if(!r(e))return void 0;var i=e._radii;return r(n)?(t.clone(i,n._radii),t.clone(e._radiiSquared,n._radiiSquared),t.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.clone(e._oneOverRadii,n._oneOverRadii),t.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return r(e)||(e=new c),r(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,r,i){i=n(i,0),t.pack(e._radii,r,i)},c.unpack=function(e,r,i){r=n(r,0);var a=t.unpack(e,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,n){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new t),n.x=u,n.y=s,n.z=c,t.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(e,n){return r(n)||(n=new t),n=t.multiplyComponents(e,this._oneOverRadiiSquared,n),t.normalize(n,n)};var l=new t,f=new t;c.prototype.cartographicToCartesian=function(e,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),r(n)||(n=new t),t.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var h=new t,d=new t,m=new t;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=t.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(t.dot(s,n))*t.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new e(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var n=t.length;r(e)?e.length=n:e=new Array(n);for(var i=0;n>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,n){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,w=Math.sqrt(1/v),E=t.multiplyByScalar(e,w,y);if(v<this._centerToleranceSquared)return isFinite(w)?t.clone(E,n):void 0;var g=this._oneOverRadiiSquared,x=g.x,S=g.y,M=g.z,z=p;z.x=2*E.x*x,z.y=2*E.y*S,z.z=2*E.z*M;var _,O,T,I,N,R,P,b,A,C,L,q=(1-w)*t.magnitude(e)/(.5*t.magnitude(z)),U=0;do{q-=U,T=1/(1+q*x),I=1/(1+q*S),N=1/(1+q*M),R=T*T,P=I*I,b=N*N,A=R*T,C=P*I,L=b*N,_=h*R+d*P+m*b-1,O=h*A*x+d*C*S+m*L*M;var D=-2*O;U=_/D}while(Math.abs(_)>u.EPSILON12);return r(n)?(n.x=i*T,n.y=a*I,n.z=o*N,n):new t(i*T,a*I,o*N)},c.prototype.scaleToGeocentricSurface=function(e,n){r(n)||(n=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,n)},c.prototype.transformPositionToScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(e,n){return r(n)||(n=new t),t.multiplyComponents(e,this._radii,n)},c.prototype.equals=function(e){return this===e||r(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(t,e,n,r,i,a,o){"use strict";var u=function(t){this._ellipsoid=n(t,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(e,n){var i=this._semimajorAxis,a=e.longitude*i,o=e.latitude*i,u=e.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new t(a,o,u)},u.prototype.unproject=function(t,n){var i=this._oneOverSemimajorAxis,a=t.x*i,o=t.y*i,u=t.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new e(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(t){"use strict";var e={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return t(e)}),define("Core/Interval",["./defaultValue"],function(t){"use strict";var e=function(e,n){this.start=t(e,0),this.stop=t(n,0)};return e}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i){"use strict";var a=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)};a.fromElements=function(t,n,r,i,o){return e(o)?(o.x=t,o.y=n,o.z=r,o.w=i,o):new a(t,n,r,i)},a.fromColor=function(t,n){return e(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new a(t.red,t.green,t.blue,t.alpha)},a.clone=function(t,n){return e(t)?e(n)?(n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n):new a(t.x,t.y,t.z,t.w):void 0},a.packedLength=4,a.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},a.unpack=function(n,r,i){return r=t(r,0),e(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z,t.w)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z,t.w)},a.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n.w=Math.min(t.w,e.w),n},a.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n.w=Math.max(t.w,e.w),n},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var n=a.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e.w=t.w/n,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},a.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n.w=t.w*e.w,n},a.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n.w=t.w+e.w,n},a.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n.w=t.w-e.w,n},a.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n.w=t.w*e,n},a.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n.w=t.w/e,n},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e.w=Math.abs(t.w),e};var u=new a;a.lerp=function(t,e,n,r){return a.multiplyByScalar(e,n,u),r=a.multiplyByScalar(t,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(t,e){var n=a.normalize(t,s);return a.abs(n,n),e=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_W,e):n.z<=n.w?a.clone(a.UNIT_Z,e):a.clone(a.UNIT_W,e)},a.equals=function(t,n){return t===n||e(t)&&e(n)&&t.x===n.x&&t.y===n.y&&t.z===n.z&&t.w===n.w},a.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]&&t.w===e[n+3]},a.equalsEpsilon=function(t,n,r,a){return t===n||e(t)&&e(n)&&i.equalsEpsilon(t.x,n.x,r,a)&&i.equalsEpsilon(t.y,n.y,r,a)&&i.equalsEpsilon(t.z,n.z,r,a)&&i.equalsEpsilon(t.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,n){return a.equalsEpsilon(this,t,e,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r,i,a){"use strict";function o(t){for(var e=0,n=0;9>n;++n){var r=t[n];e+=r*r}return Math.sqrt(e)}function u(t){for(var e=0,n=0;3>n;++n){var r=t[c.getElementIndex(d[n],h[n])];e+=2*r*r}return Math.sqrt(e)}function s(t,e){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(t[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(t[c.getElementIndex(m,f)])>n){var y,p=t[c.getElementIndex(m,m)],v=t[c.getElementIndex(f,f)],w=t[c.getElementIndex(m,f)],E=(p-v)/2/w;y=0>E?-1/(-E+Math.sqrt(1+E*E)):1/(E+Math.sqrt(1+E*E)),s=1/Math.sqrt(1+y*y),l=y*s}return e=c.clone(c.IDENTITY,e),e[c.getElementIndex(f,f)]=e[c.getElementIndex(m,m)]=s,e[c.getElementIndex(m,f)]=l,e[c.getElementIndex(f,m)]=-l,e}var c=function(t,n,r,i,a,o,u,s,c){this[0]=e(t,0),this[1]=e(i,0),this[2]=e(u,0),this[3]=e(n,0),this[4]=e(a,0),this[5]=e(s,0),this[6]=e(r,0),this[7]=e(o,0),this[8]=e(c,0)};c.packedLength=9,c.pack=function(t,n,r){r=e(r,0),n[r++]=t[0],n[r++]=t[1],n[r++]=t[2],n[r++]=t[3],n[r++]=t[4],n[r++]=t[5],n[r++]=t[6],n[r++]=t[7],n[r++]=t[8]},c.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r++],i[1]=t[r++],i[2]=t[r++],i[3]=t[r++],i[4]=t[r++],i[5]=t[r++],i[6]=t[r++],i[7]=t[r++],i[8]=t[r++],i},c.clone=function(t,e){return n(t)?n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):new c(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]):void 0},c.fromArray=function(t,r,i){return r=e(r,0),n(i)||(i=new c),i[0]=t[r],i[1]=t[r+1],i[2]=t[r+2],i[3]=t[r+3],i[4]=t[r+4],i[5]=t[r+5],i[6]=t[r+6],i[7]=t[r+7],i[8]=t[r+8],i},c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},c.fromQuaternion=function(t,e){var r=t.x*t.x,i=t.x*t.y,a=t.x*t.z,o=t.x*t.w,u=t.y*t.y,s=t.y*t.z,l=t.y*t.w,f=t.z*t.z,h=t.z*t.w,d=t.w*t.w,m=r-u-f+d,y=2*(i-h),p=2*(a+l),v=2*(i+h),w=-r+u-f+d,E=2*(s-o),g=2*(a-l),x=2*(s+o),S=-r-u+f+d;return n(e)?(e[0]=m,e[1]=v,e[2]=g,e[3]=y,e[4]=w,e[5]=x,e[6]=p,e[7]=E,e[8]=S,e):new c(m,y,p,v,w,E,g,x,S)},c.fromScale=function(t,e){return n(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=t.y,e[5]=0,e[6]=0,e[7]=0,e[8]=t.z,e):new c(t.x,0,0,0,t.y,0,0,0,t.z)},c.fromUniformScale=function(t,e){return n(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=t,e):new c(t,0,0,0,t,0,0,0,t)},c.fromCrossProduct=function(t,e){return n(e)?(e[0]=0,e[1]=t.z,e[2]=-t.y,e[3]=-t.z,e[4]=0,e[5]=t.x,e[6]=t.y,e[7]=-t.x,e[8]=0,e):new c(0,-t.z,t.y,t.z,0,-t.x,-t.y,t.x,0)},c.fromRotationX=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=r,e[5]=i,e[6]=0,e[7]=-i,e[8]=r,e):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=r,e):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(t,e){var r=Math.cos(t),i=Math.sin(t);return n(e)?(e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(t,e){return n(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},c.getElementIndex=function(t,e){return 3*t+e},c.getColumn=function(t,e,n){var r=3*e,i=t[r],a=t[r+1],o=t[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=3*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(t,e,n){var r=t[e],i=t[e+3],a=t[e+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+3]=n.y,r[e+6]=n.z,r};var l=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],l)),n.y=t.magnitude(t.fromElements(e[3],e[4],e[5],l)),n.z=t.magnitude(t.fromElements(e[6],e[7],e[8],l)),n};var f=new t;c.getMaximumScale=function(e){return c.getScale(e,f),t.maximumComponent(f)},c.multiply=function(t,e,n){var r=t[0]*e[0]+t[3]*e[1]+t[6]*e[2],i=t[1]*e[0]+t[4]*e[1]+t[7]*e[2],a=t[2]*e[0]+t[5]*e[1]+t[8]*e[2],o=t[0]*e[3]+t[3]*e[4]+t[6]*e[5],u=t[1]*e[3]+t[4]*e[4]+t[7]*e[5],s=t[2]*e[3]+t[5]*e[4]+t[8]*e[5],c=t[0]*e[6]+t[3]*e[7]+t[6]*e[8],l=t[1]*e[6]+t[4]*e[7]+t[7]*e[8],f=t[2]*e[6]+t[5]*e[7]+t[8]*e[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[3]*i+t[6]*a,u=t[1]*r+t[4]*i+t[7]*a,s=t[2]*r+t[5]*i+t[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n},c.multiplyByScale=function(t,e,n){return n[0]=t[0]*e.x,n[1]=t[1]*e.x,n[2]=t[2]*e.x,n[3]=t[3]*e.y,n[4]=t[4]*e.y,n[5]=t[5]*e.y,n[6]=t[6]*e.z,n[7]=t[7]*e.z,n[8]=t[8]*e.z,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e},c.transpose=function(t,e){var n=t[0],r=t[3],i=t[6],a=t[1],o=t[4],u=t[7],s=t[2],c=t[5],l=t[8];return e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=u,e[6]=s,e[7]=c,e[8]=l,e};var h=[1,0,0],d=[2,2,1],m=new c,y=new c;return c.computeEigenDecomposition=function(t,e){var r=a.EPSILON20,i=10,l=0,f=0;n(e)||(e={});for(var h=e.unitary=c.clone(c.IDENTITY,e.unitary),d=e.diagonal=c.clone(t,e.diagonal),p=r*o(d);i>f&&u(d)>p;)s(d,m),c.transpose(m,y),c.multiply(d,m,d),c.multiply(y,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e},c.determinant=function(t){var e=t[0],n=t[3],r=t[6],i=t[1],a=t[4],o=t[7],u=t[2],s=t[5],c=t[8];return e*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(t,e){var n=t[0],i=t[1],o=t[2],u=t[3],s=t[4],l=t[5],f=t[6],h=t[7],d=t[8],m=c.determinant(t);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");e[0]=s*d-h*l,e[1]=h*o-i*d,e[2]=i*l-s*o,e[3]=f*l-u*d,e[4]=n*d-f*o,e[5]=u*o-n*l,e[6]=u*h-f*s,e[7]=f*i-n*h,e[8]=n*s-u*i;var y=1/m;return c.multiplyByScalar(e,y,e)},c.equals=function(t,e){return t===e||n(t)&&n(e)&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},c.equalsEpsilon=function(t,e,r){return t===e||n(t)&&n(e)&&Math.abs(t[0]-e[0])<=r&&Math.abs(t[1]-e[1])<=r&&Math.abs(t[2]-e[2])<=r&&Math.abs(t[3]-e[3])<=r&&Math.abs(t[4]-e[4])<=r&&Math.abs(t[5]-e[5])<=r&&Math.abs(t[6]-e[6])<=r&&Math.abs(t[7]-e[7])<=r&&Math.abs(t[8]-e[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(t){"use strict";var e=function(t){this.name="RuntimeError",this.message=t;var e;try{throw new Error}catch(n){e=n.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(t,e,n,r,i,a,o,u,s){"use strict";var c=function(t,e,r,i,a,o,u,s,c,l,f,h,d,m,y,p){this[0]=n(t,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(e,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(y,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(p,0)};c.packedLength=16,c.pack=function(t,e,r){r=n(r,0),e[r++]=t[0],e[r++]=t[1],e[r++]=t[2],e[r++]=t[3],e[r++]=t[4],e[r++]=t[5],e[r++]=t[6],e[r++]=t[7],e[r++]=t[8],e[r++]=t[9],e[r++]=t[10],e[r++]=t[11],e[r++]=t[12],e[r++]=t[13],e[r++]=t[14],e[r]=t[15]},c.unpack=function(t,e,i){return e=n(e,0),r(i)||(i=new c),i[0]=t[e++],i[1]=t[e++],i[2]=t[e++],i[3]=t[e++],i[4]=t[e++],i[5]=t[e++],i[6]=t[e++],i[7]=t[e++],i[8]=t[e++],i[9]=t[e++],i[10]=t[e++],i[11]=t[e++],i[12]=t[e++],i[13]=t[e++],i[14]=t[e++],i[15]=t[e],i},c.clone=function(t,e){return r(t)?r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):new c(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(t,e){return c.clone(t,e)},c.fromRowMajorArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15],e):new c(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},c.fromRotationTranslation=function(e,i,a){return i=n(i,t.ZERO),r(a)?(a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=0,a[4]=e[3],a[5]=e[4],a[6]=e[5],a[7]=0,a[8]=e[6],a[9]=e[7],a[10]=e[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(e[0],e[3],e[6],i.x,e[1],e[4],e[7],i.y,e[2],e[5],e[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(t,e,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=e.x*e.x,l=e.x*e.y,f=e.x*e.z,h=e.x*e.w,d=e.y*e.y,m=e.y*e.z,y=e.y*e.w,p=e.z*e.z,v=e.z*e.w,w=e.w*e.w,E=s-d-p+w,g=2*(l-v),x=2*(f+y),S=2*(l+v),M=-s+d-p+w,z=2*(m-h),_=2*(f-y),O=2*(m+h),T=-s-d+p+w;return i[0]=E*a,i[1]=S*a,i[2]=_*a,i[3]=0,i[4]=g*o,i[5]=M*o,i[6]=O*o,i[7]=0,i[8]=x*u,i[9]=z*u,i[10]=T*u,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i},c.fromTranslation=function(t,e){return c.fromRotationTranslation(u.IDENTITY,t,e)},c.fromScale=function(t,e){return r(e)?(e[0]=t.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1)},c.fromUniformScale=function(t,e){return r(e)?(e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new c(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1)};var l=new t,f=new t,h=new t;c.fromCamera=function(e,n){var i=e.eye,a=e.target,o=e.up;t.normalize(t.subtract(a,i,l),l),t.normalize(t.cross(l,o,f),f),t.normalize(t.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,y=l.y,p=l.z,v=h.x,w=h.y,E=h.z,g=i.x,x=i.y,S=i.z,M=u*-g+s*-x+d*-S,z=v*-g+w*-x+E*-S,_=m*g+y*x+p*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-y,n[7]=0,n[8]=d,n[9]=E,n[10]=-p,n[11]=0,n[12]=M,n[13]=z,n[14]=_,n[15]=1,n):new c(u,s,d,M,v,w,E,z,-m,-y,-p,_,0,0,0,1)},c.computePerspectiveFieldOfView=function(t,e,n,r,i){var a=Math.tan(.5*t),o=1/a,u=o/e,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(t,e,n,r,i,a,o){var u=1/(e-t),s=1/(r-n),c=1/(a-i),l=-(e+t)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(t,e,n,r,i,a,o){var u=2*i/(e-t),s=2*i/(r-n),c=(e+t)/(e-t),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(t,e,n,r,i,a){var o=2*i/(e-t),u=2*i/(r-n),s=(e+t)/(e-t),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(t,e,r,i){t=n(t,n.EMPTY_OBJECT);var a=n(t.x,0),o=n(t.y,0),u=n(t.width,0),s=n(t.height,0);e=n(e,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-e),h=c,d=l,m=f,y=a+c,p=o+l,v=e+f,w=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=y,i[13]=p,i[14]=v,i[15]=w,i},c.toArray=function(t,e){return r(e)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e):[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},c.getElementIndex=function(t,e){return 4*t+e},c.getColumn=function(t,e,n){var r=4*e,i=t[r],a=t[r+1],o=t[r+2],u=t[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(t,e,n,r){r=c.clone(t,r);var i=4*e;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(t,e,n){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=t[15],n},c.getRow=function(t,e,n){var r=t[e],i=t[e+4],a=t[e+8],o=t[e+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(t,e,n,r){return r=c.clone(t,r),r[e]=n.x,r[e+4]=n.y,r[e+8]=n.z,r[e+12]=n.w,r};var d=new t;c.getScale=function(e,n){return n.x=t.magnitude(t.fromElements(e[0],e[1],e[2],d)),n.y=t.magnitude(t.fromElements(e[4],e[5],e[6],d)),n.z=t.magnitude(t.fromElements(e[8],e[9],e[10],d)),n};var m=new t;c.getMaximumScale=function(e){return c.getScale(e,m),t.maximumComponent(m)},c.multiply=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[3],u=t[4],s=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],p=t[13],v=t[14],w=t[15],E=e[0],g=e[1],x=e[2],S=e[3],M=e[4],z=e[5],_=e[6],O=e[7],T=e[8],I=e[9],N=e[10],R=e[11],P=e[12],b=e[13],A=e[14],C=e[15],L=r*E+u*g+f*x+y*S,q=i*E+s*g+h*x+p*S,U=a*E+c*g+d*x+v*S,D=o*E+l*g+m*x+w*S,B=r*M+u*z+f*_+y*O,W=i*M+s*z+h*_+p*O,k=a*M+c*z+d*_+v*O,F=o*M+l*z+m*_+w*O,G=r*T+u*I+f*N+y*R,V=i*T+s*I+h*N+p*R,Y=a*T+c*I+d*N+v*R,j=o*T+l*I+m*N+w*R,H=r*P+u*b+f*A+y*C,Z=i*P+s*b+h*A+p*C,X=a*P+c*b+d*A+v*C,K=o*P+l*b+m*A+w*C;return n[0]=L,n[1]=q,n[2]=U,n[3]=D,n[4]=B,n[5]=W,n[6]=k,n[7]=F,n[8]=G,n[9]=V,n[10]=Y,n[11]=j,n[12]=H,n[13]=Z,n[14]=X,n[15]=K,n},c.add=function(t,e,n){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n[3]=t[3]+e[3],n[4]=t[4]+e[4],n[5]=t[5]+e[5],n[6]=t[6]+e[6],n[7]=t[7]+e[7],n[8]=t[8]+e[8],n[9]=t[9]+e[9],n[10]=t[10]+e[10],n[11]=t[11]+e[11],n[12]=t[12]+e[12],n[13]=t[13]+e[13],n[14]=t[14]+e[14],n[15]=t[15]+e[15],n},c.subtract=function(t,e,n){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n[3]=t[3]-e[3],n[4]=t[4]-e[4],n[5]=t[5]-e[5],n[6]=t[6]-e[6],n[7]=t[7]-e[7],n[8]=t[8]-e[8],n[9]=t[9]-e[9],n[10]=t[10]-e[10],n[11]=t[11]-e[11],n[12]=t[12]-e[12],n[13]=t[13]-e[13],n[14]=t[14]-e[14],n[15]=t[15]-e[15],n},c.multiplyTransformation=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=t[12],d=t[13],m=t[14],y=e[0],p=e[1],v=e[2],w=e[4],E=e[5],g=e[6],x=e[8],S=e[9],M=e[10],z=e[12],_=e[13],O=e[14],T=r*y+o*p+c*v,I=i*y+u*p+l*v,N=a*y+s*p+f*v,R=r*w+o*E+c*g,P=i*w+u*E+l*g,b=a*w+s*E+f*g,A=r*x+o*S+c*M,C=i*x+u*S+l*M,L=a*x+s*S+f*M,q=r*z+o*_+c*O+h,U=i*z+u*_+l*O+d,D=a*z+s*_+f*O+m;return n[0]=T,n[1]=I,n[2]=N,n[3]=0,n[4]=R,n[5]=P,n[6]=b,n[7]=0,n[8]=A,n[9]=C,n[10]=L,n[11]=0,n[12]=q,n[13]=U,n[14]=D,n[15]=1,n},c.multiplyByMatrix3=function(t,e,n){var r=t[0],i=t[1],a=t[2],o=t[4],u=t[5],s=t[6],c=t[8],l=t[9],f=t[10],h=e[0],d=e[1],m=e[2],y=e[3],p=e[4],v=e[5],w=e[6],E=e[7],g=e[8],x=r*h+o*d+c*m,S=i*h+u*d+l*m,M=a*h+s*d+f*m,z=r*y+o*p+c*v,_=i*y+u*p+l*v,O=a*y+s*p+f*v,T=r*w+o*E+c*g,I=i*w+u*E+l*g,N=a*w+s*E+f*g;return n[0]=x,n[1]=S,n[2]=M,n[3]=0,n[4]=z,n[5]=_,n[6]=O,n[7]=0,n[8]=T,n[9]=I,n[10]=N,n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},c.multiplyByTranslation=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=r*t[0]+i*t[4]+a*t[8]+t[12],u=r*t[1]+i*t[5]+a*t[9]+t[13],s=r*t[2]+i*t[6]+a*t[10]+t[14];return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=o,n[13]=u,n[14]=s,n[15]=t[15],n};var y=new t;c.multiplyByUniformScale=function(t,e,n){return y.x=e,y.y=e,y.z=e,c.multiplyByScale(t,y,n)},c.multiplyByScale=function(t,e,n){var r=e.x,i=e.y,a=e.z;return 1===r&&1===i&&1===a?c.clone(t,n):(n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=0,n[4]=i*t[4],n[5]=i*t[5],n[6]=i*t[6],n[7]=0,n[8]=a*t[8],n[9]=a*t[9],n[10]=a*t[10],n[11]=0,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=1,n)},c.multiplyByVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t[0]*r+t[4]*i+t[8]*a+t[12]*o,s=t[1]*r+t[5]*i+t[9]*a+t[13]*o,c=t[2]*r+t[6]*i+t[10]*a+t[14]*o,l=t[3]*r+t[7]*i+t[11]*a+t[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a,u=t[1]*r+t[5]*i+t[9]*a,s=t[2]*r+t[6]*i+t[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(t,e,n){var r=e.x,i=e.y,a=e.z,o=t[0]*r+t[4]*i+t[8]*a+t[12],u=t[1]*r+t[5]*i+t[9]*a+t[13],s=t[2]*r+t[6]*i+t[10]*a+t[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(t,e,n){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n[4]=t[4]*e,n[5]=t[5]*e,n[6]=t[6]*e,n[7]=t[7]*e,n[8]=t[8]*e,n[9]=t[9]*e,n[10]=t[10]*e,n[11]=t[11]*e,n[12]=t[12]*e,n[13]=t[13]*e,n[14]=t[14]*e,n[15]=t[15]*e,n},c.negate=function(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},c.transpose=function(t,e){var n=t[1],r=t[2],i=t[3],a=t[6],o=t[7],u=t[11];return e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[10]=t[10],e[11]=t[14],e[12]=i,e[13]=o,e[14]=u,e[15]=t[15],e},c.abs=function(t,e){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e[4]=Math.abs(t[4]),e[5]=Math.abs(t[5]),e[6]=Math.abs(t[6]),e[7]=Math.abs(t[7]),e[8]=Math.abs(t[8]),e[9]=Math.abs(t[9]),e[10]=Math.abs(t[10]),e[11]=Math.abs(t[11]),e[12]=Math.abs(t[12]),e[13]=Math.abs(t[13]),e[14]=Math.abs(t[14]),e[15]=Math.abs(t[15]),e},c.equals=function(t,e){return t===e||r(t)&&r(e)&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[3]===e[3]&&t[7]===e[7]&&t[11]===e[11]&&t[15]===e[15]},c.equalsEpsilon=function(t,e,n){return t===e||r(t)&&r(e)&&Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n&&Math.abs(t[4]-e[4])<=n&&Math.abs(t[5]-e[5])<=n&&Math.abs(t[6]-e[6])<=n&&Math.abs(t[7]-e[7])<=n&&Math.abs(t[8]-e[8])<=n&&Math.abs(t[9]-e[9])<=n&&Math.abs(t[10]-e[10])<=n&&Math.abs(t[11]-e[11])<=n&&Math.abs(t[12]-e[12])<=n&&Math.abs(t[13]-e[13])<=n&&Math.abs(t[14]-e[14])<=n&&Math.abs(t[15]-e[15])<=n},c.getTranslation=function(t,e){return e.x=t[12],e.y=t[13],e.z=t[14],e},c.getRotation=function(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e};var p=new u,v=new u,w=new e,E=new e(0,0,0,1);return c.inverse=function(t,n){if(u.equalsEpsilon(c.getRotation(t,p),v,o.EPSILON7)&&e.equals(c.getRow(t,3,w),E))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-t[12],n[13]=-t[13],n[14]=-t[14],n[15]=1,n;var r=t[0],i=t[4],a=t[8],l=t[12],f=t[1],h=t[5],d=t[9],m=t[13],y=t[2],g=t[6],x=t[10],S=t[14],M=t[3],z=t[7],_=t[11],O=t[15],T=x*O,I=S*_,N=g*O,R=S*z,P=g*_,b=x*z,A=y*O,C=S*M,L=y*_,q=x*M,U=y*z,D=g*M,B=T*h+R*d+P*m-(I*h+N*d+b*m),W=I*f+A*d+q*m-(T*f+C*d+L*m),k=N*f+C*h+U*m-(R*f+A*h+D*m),F=b*f+L*h+D*d-(P*f+q*h+U*d),G=I*i+N*a+b*l-(T*i+R*a+P*l),V=T*r+C*a+L*l-(I*r+A*a+q*l),Y=R*r+A*i+D*l-(N*r+C*i+U*l),j=P*r+q*i+U*a-(b*r+L*i+D*a);T=a*m,I=l*d,N=i*m,R=l*h,P=i*d,b=a*h,A=r*m,C=l*f,L=r*d,q=a*f,U=r*h,D=i*f;var H=T*z+R*_+P*O-(I*z+N*_+b*O),Z=I*M+A*_+q*O-(T*M+C*_+L*O),X=N*M+C*z+U*O-(R*M+A*z+D*O),K=b*M+L*z+D*_-(P*M+q*z+U*_),J=N*x+b*S+I*g-(P*S+T*g+R*x),Q=L*S+T*y+C*x-(A*x+q*S+I*y),$=A*g+D*S+R*y-(U*S+N*y+C*g),te=U*x+P*y+q*g-(L*g+D*x+b*y),ee=r*B+i*W+a*k+l*F;if(Math.abs(ee)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return ee=1/ee,n[0]=B*ee,n[1]=W*ee,n[2]=k*ee,n[3]=F*ee,n[4]=G*ee,n[5]=V*ee,n[6]=Y*ee,n[7]=j*ee,n[8]=H*ee,n[9]=Z*ee,n[10]=X*ee,n[11]=K*ee,n[12]=J*ee,n[13]=Q*ee,n[14]=$*ee,n[15]=te*ee,n},c.inverseTransformation=function(t,e){var n=t[0],r=t[1],i=t[2],a=t[4],o=t[5],u=t[6],s=t[8],c=t[9],l=t[10],f=t[12],h=t[13],d=t[14],m=-n*f-r*h-i*d,y=-a*f-o*h-u*d,p=-s*f-c*h-l*d;return e[0]=n,e[1]=a,e[2]=s,e[3]=0,e[4]=r,e[5]=o,e[6]=c,e[7]=0,e[8]=i,e[9]=u,e[10]=l,e[11]=0,e[12]=m,e[13]=y,e[14]=p,e[15]=1,e},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(t){return c.clone(this,t)},c.prototype.equals=function(t){return c.equals(this,t)},c.equalsArray=function(t,e,n){return t[0]===e[n]&&t[1]===e[n+1]&&t[2]===e[n+2]&&t[3]===e[n+3]&&t[4]===e[n+4]&&t[5]===e[n+5]&&t[6]===e[n+6]&&t[7]===e[n+7]&&t[8]===e[n+8]&&t[9]===e[n+9]&&t[10]===e[n+10]&&t[11]===e[n+11]&&t[12]===e[n+12]&&t[13]===e[n+13]&&t[14]===e[n+14]&&t[15]===e[n+15]},c.prototype.equalsEpsilon=function(t,e){return c.equalsEpsilon(this,t,e)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(t,e,n,r){"use strict";var i=function(e,n){this.normal=t.clone(e),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-t.dot(r,n);return e(a)?(t.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new t;return i.fromCartesian4=function(n,r){var o=t.fromCartesian4(n,a),u=n.w;return e(r)?(t.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(e,n){return t.dot(e.normal,n)+e.distance},i.ORIGIN_XY_PLANE=r(new i(t.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(t.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(t.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(t,e,n,r,i,a,o,u){"use strict";var s=function(t,n,r,i){this.west=e(t,0),this.south=e(n,0),this.east=e(r,0),this.north=e(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(t,n,r){r=e(r,0),n[r++]=t.west,n[r++]=t.south,n[r++]=t.east,n[r]=t.north},s.unpack=function(t,r,i){return r=e(r,0),n(i)||(i=new s),i.west=t[r++],i.south=t[r++],i.east=t[r++],i.north=t[r],i},s.computeWidth=function(t){var e=t.east,n=t.west;return n>e&&(e+=u.TWO_PI),e-n},s.computeHeight=function(t){return t.north-t.south},s.fromDegrees=function(t,r,i,a,o){return t=u.toRadians(e(t,0)),r=u.toRadians(e(r,0)),i=u.toRadians(e(i,0)),a=u.toRadians(e(a,0)),n(o)?(o.west=t,o.south=r,o.east=i,o.north=a,o):new s(t,r,i,a)},s.fromCartographicArray=function(t,e){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=t.length;c>u;u++){var l=t[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(e)?(e.west=r,e.south=a,e.east=i,e.north=o,e):new s(r,a,i,o)},s.clone=function(t,e){return n(t)?n(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new s(t.west,t.south,t.east,t.north):void 0},s.prototype.clone=function(t){return s.clone(this,t)},s.prototype.equals=function(t){return s.equals(this,t)},s.equals=function(t,e){return t===e||n(t)&&n(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},s.prototype.equalsEpsilon=function(t,e){return n(t)&&Math.abs(this.west-t.west)<=e&&Math.abs(this.south-t.south)<=e&&Math.abs(this.east-t.east)<=e&&Math.abs(this.north-t.north)<=e},s.validate=function(){},s.southwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.south,r.height=0,r):new t(e.west,e.south)},s.northwest=function(e,r){return n(r)?(r.longitude=e.west,r.latitude=e.north,r.height=0,r):new t(e.west,e.north)},s.northeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.north,r.height=0,r):new t(e.east,e.north)},s.southeast=function(e,r){return n(r)?(r.longitude=e.east,r.latitude=e.south,r.height=0,r):new t(e.east,e.south)},s.center=function(e,r){var i=e.east,a=e.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(e.south+e.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new t(o,s)},s.intersection=function(t,e,r){var i=t.east,a=t.west,o=e.east,c=e.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((t.west<t.east||e.west<e.east)&&l>=f)return void 0;var h=Math.max(t.south,e.south),d=Math.min(t.north,e.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(t,e){var n=e.longitude,r=e.latitude,i=t.west,a=t.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=t.south&&r<=t.north};var c=new t;return s.subsample=function(t,r,i,o){r=e(r,a.WGS84),i=e(i,0),n(o)||(o=[]);var l=0,f=t.north,h=t.south,d=t.east,m=t.west,y=c;y.height=i,y.longitude=m,y.latitude=f,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=h,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.latitude=0>f?f:h>0?h:0;for(var p=1;8>p;++p)y.longitude=-Math.PI+p*u.PI_OVER_TWO,s.contains(t,y)&&(o[l]=r.cartographicToCartesian(y,o[l]),l++);return 0===y.latitude&&(y.longitude=m,o[l]=r.cartographicToCartesian(y,o[l]),l++,y.longitude=d,o[l]=r.cartographicToCartesian(y,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,r){this.center=t.clone(n(e,t.ZERO)),this.radius=n(r,0)},m=new t,y=new t,p=new t,v=new t,w=new t,E=new t,g=new t,x=new t,S=new t,M=new t,z=new t,_=new t;d.fromPoints=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;for(var i=t.clone(e[0],g),a=t.clone(i,m),o=t.clone(i,y),u=t.clone(i,p),s=t.clone(i,v),c=t.clone(i,w),l=t.clone(i,E),f=e.length,h=1;f>h;h++){t.clone(e[h],i);var O=i.x,T=i.y,I=i.z;O<a.x&&t.clone(i,a),O>s.x&&t.clone(i,s),T<o.y&&t.clone(i,o),T>c.y&&t.clone(i,c),I<u.z&&t.clone(i,u),I>l.z&&t.clone(i,l)}var N=t.magnitudeSquared(t.subtract(s,a,x)),R=t.magnitudeSquared(t.subtract(c,o,x)),P=t.magnitudeSquared(t.subtract(l,u,x)),b=a,A=s,C=N;R>C&&(C=R,b=o,A=c),P>C&&(C=P,b=u,A=l);var L=S;L.x=.5*(b.x+A.x),L.y=.5*(b.y+A.y),L.z=.5*(b.z+A.z);var q=t.magnitudeSquared(t.subtract(A,L,x)),U=Math.sqrt(q),D=M;D.x=a.x,D.y=o.y,D.z=u.z;var B=z;B.x=s.x,B.y=c.y,B.z=l.z;var W=t.multiplyByScalar(t.add(D,B,x),.5,_),k=0;for(h=0;f>h;h++){t.clone(e[h],i);var F=t.magnitude(t.subtract(i,W,x));F>k&&(k=F);var G=t.magnitudeSquared(t.subtract(i,L,x));if(G>q){var V=Math.sqrt(G);U=.5*(U+V),q=U*U;var Y=V-U;L.x=(U*L.x+Y*i.x)/V,L.y=(U*L.y+Y*i.y)/V,L.z=(U*L.z+Y*i.z)/V}}return k>U?(t.clone(L,n.center),n.radius=U):(t.clone(W,n.center),n.radius=k),n};var O=new u,T=new t,I=new t,N=new e,R=new e;d.fromRectangle2D=function(t,e,n){return d.fromRectangleWithHeights2D(t,e,0,0,n)},d.fromRectangleWithHeights2D=function(e,i,a,o,u){if(r(u)||(u=new d),!r(e))return u.center=t.clone(t.ZERO,u.center),u.radius=0,u;i=n(i,O),h.southwest(e,N),N.height=a,h.northeast(e,R),R.height=o;var s=i.project(N,T),c=i.project(R,I),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var y=u.center;return y.x=s.x+.5*l,y.y=s.y+.5*f,y.z=s.z+.5*m,u};var P=[];d.fromRectangle3D=function(t,e,i,a){e=n(e,o.WGS84),i=n(i,0);var u;return r(t)&&(u=h.subsample(t,e,i,P)),d.fromPoints(u,a)},d.fromVertices=function(e,i,a,o){if(r(o)||(o=new d),!r(e)||0===e.length)return o.center=t.clone(t.ZERO,o.center),o.radius=0,o;i=n(i,t.ZERO),a=n(a,3);var u=g;u.x=e[0]+i.x,u.y=e[1]+i.y,u.z=e[2]+i.z;for(var s=t.clone(u,m),c=t.clone(u,y),l=t.clone(u,p),f=t.clone(u,v),h=t.clone(u,w),O=t.clone(u,E),T=e.length,I=0;T>I;I+=a){var N=e[I]+i.x,R=e[I+1]+i.y,P=e[I+2]+i.z;u.x=N,u.y=R,u.z=P,N<s.x&&t.clone(u,s),N>f.x&&t.clone(u,f),R<c.y&&t.clone(u,c),R>h.y&&t.clone(u,h),P<l.z&&t.clone(u,l),P>O.z&&t.clone(u,O)}var b=t.magnitudeSquared(t.subtract(f,s,x)),A=t.magnitudeSquared(t.subtract(h,c,x)),C=t.magnitudeSquared(t.subtract(O,l,x)),L=s,q=f,U=b;A>U&&(U=A,L=c,q=h),C>U&&(U=C,L=l,q=O);var D=S;D.x=.5*(L.x+q.x),D.y=.5*(L.y+q.y),D.z=.5*(L.z+q.z);var B=t.magnitudeSquared(t.subtract(q,D,x)),W=Math.sqrt(B),k=M;k.x=s.x,k.y=c.y,k.z=l.z;var F=z;F.x=f.x,F.y=h.y,F.z=O.z;var G=t.multiplyByScalar(t.add(k,F,x),.5,_),V=0;for(I=0;T>I;I+=a){u.x=e[I]+i.x,u.y=e[I+1]+i.y,u.z=e[I+2]+i.z;var Y=t.magnitude(t.subtract(u,G,x));Y>V&&(V=Y);var j=t.magnitudeSquared(t.subtract(u,D,x));if(j>B){var H=Math.sqrt(j);W=.5*(W+H),B=W*W;var Z=H-W;D.x=(W*D.x+Z*u.x)/H,D.y=(W*D.y+Z*u.y)/H,D.z=(W*D.z+Z*u.z)/H}}return V>W?(t.clone(D,o.center),o.radius=W):(t.clone(G,o.center),o.radius=V),o},d.fromCornerPoints=function(e,n,i){r(i)||(i=new d);var a=i.center;return t.add(e,n,a),t.multiplyByScalar(a,.5,a),i.radius=t.distance(a,n),i},d.fromEllipsoid=function(e,n){return r(n)||(n=new d),t.clone(t.ZERO,n.center),n.radius=e.maximumRadius,n};var b=new t;d.fromBoundingSpheres=function(e,n){if(r(n)||(n=new d),!r(e)||0===e.length)return n.center=t.clone(t.ZERO,n.center),n.radius=0,n;var i=e.length;if(1===i)return d.clone(e[0],n);if(2===i)return d.union(e[0],e[1],n);for(var a=[],o=0;i>o;o++)a.push(e[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=e[o];s=Math.max(s,t.distance(u,c.center,b)+c.radius)}return n.radius=s,n},d.clone=function(e,n){return r(e)?r(n)?(n.center=t.clone(e.center,n.center),n.radius=e.radius,n):new d(e.center,e.radius):void 0},d.packedLength=4,d.pack=function(t,e,r){r=n(r,0);var i=t.center;e[r++]=i.x,e[r++]=i.y,e[r++]=i.z,e[r]=t.radius},d.unpack=function(t,e,i){e=n(e,0),r(i)||(i=new d);var a=i.center;return a.x=t[e++],a.y=t[e++],a.z=t[e++],i.radius=t[e],i};var A=new t,C=new t;d.union=function(e,n,i){r(i)||(i=new d);var a=e.center,o=e.radius,u=n.center,s=n.radius,c=t.subtract(u,a,A),l=t.magnitude(c);if(o>=l+s)return e.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=t.multiplyByScalar(c,(-o+f)/l,C);return t.add(h,a,h),t.clone(h,i.center),i.radius=f,i};var L=new t;d.expand=function(e,n,r){r=d.clone(e,r);var i=t.magnitude(t.subtract(n,r.center,L));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(e,n){var r=e.center,i=e.radius,a=n.normal,o=t.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new t,0);d.intersect=function(t,e){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(e,q);return d.intersectPlane(t,n)},d.transform=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=l.getMaximumScale(e)*t.radius,n};var U=new t;d.distanceSquaredTo=function(e,n){var r=t.subtract(e.center,n,U);return t.magnitudeSquared(r)-e.radius*e.radius},d.transformWithoutScale=function(t,e,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(e,t.center,n.center),n.radius=t.radius,n};var D=new t;d.computePlaneDistances=function(e,n,i,a){r(a)||(a=new c);var o=t.subtract(e.center,n,D),u=t.multiplyByScalar(i,t.dot(i,o),D),s=t.magnitude(u);return a.start=s-e.radius,a.stop=s+e.radius,a};for(var B=new t,W=new t,k=new t,F=new t,G=new t,V=new e,Y=new Array(8),j=0;8>j;++j)Y[j]=new t;var H=new u;return d.projectTo2D=function(e,r,i){r=n(r,H);var a=r.ellipsoid,o=e.center,u=e.radius,s=a.geodeticSurfaceNormal(o,B),c=t.cross(t.UNIT_Z,s,W);t.normalize(c,c);var l=t.cross(s,c,k);t.normalize(l,l),t.multiplyByScalar(s,u,s),t.multiplyByScalar(l,u,l),t.multiplyByScalar(c,u,c);var f=t.negate(l,G),h=t.negate(c,F),m=Y,y=m[0];t.add(s,l,y),t.add(y,c,y),y=m[1],t.add(s,l,y),t.add(y,h,y),y=m[2],t.add(s,f,y),t.add(y,h,y),y=m[3],t.add(s,f,y),t.add(y,c,y),t.negate(s,s),y=m[4],t.add(s,l,y),t.add(y,c,y),y=m[5],t.add(s,l,y),t.add(y,h,y),y=m[6],t.add(s,f,y),t.add(y,h,y),y=m[7],t.add(s,f,y),t.add(y,c,y);for(var p=m.length,v=0;p>v;++v){var w=m[v];t.add(o,w,w);var E=a.cartesianToCartographic(w,V);r.project(E,w)}i=d.fromPoints(m,i),o=i.center;var g=o.x,x=o.y,S=o.z;return o.x=S,o.y=g,o.z=x,i},d.equals=function(e,n){return e===n||r(e)&&r(n)&&t.equals(e.center,n.center)&&e.radius===n.radius},d.prototype.intersectPlane=function(t){return d.intersectPlane(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},d.prototype.clone=function(t){return d.clone(this,t)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(t,e){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return e(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(t(n))return n;n=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof e[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof e[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",t(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",t(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",t(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",t(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",t(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(t){i.supportsFullscreen()&&t[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(t,e,n){"use strict";function r(t){for(var e=t.split("."),n=0,r=e.length;r>n;++n)e[n]=parseInt(e[n],10);return e}function i(){if(!e(p)){p=!1;var t=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(p=!0,v=r(t[1]))}return p}function a(){return i()&&v}function o(){if(!e(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var t=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(w=!0,E=r(t[1]))}return w}function u(){return o()&&E}function s(){if(!e(g)){g=!1;var t=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==t&&(g=!0,x=r(t[1]),x.isNightly=!!t[2])}return g}function c(){return s()&&x}function l(){if(!e(S)){S=!1;var t;"Microsoft Internet Explorer"===navigator.appName?(t=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1]))):"Netscape"===navigator.appName&&(t=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==t&&(S=!0,M=r(t[1])))}return S}function f(){return l()&&M}function h(){if(!e(z)){z=!1;var t=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==t&&(z=!0,_=r(t[1]))}return z}function d(){return e(O)||(O=/Windows/i.test(navigator.appVersion)),O}function m(){return h()&&_}function y(){return e(T)||(T=e(window.PointerEvent)&&(!e(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var p,v,w,E,g,x,S,M,z,_,O,T,I={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:t(navigator.hardwareConcurrency,3),supportsPointerEvents:y};return I.supportsFullscreen=function(){return n.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(t,e,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(t){switch(t){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(t){return t instanceof Int8Array?a.BYTE:t instanceof Uint8Array?a.UNSIGNED_BYTE:t instanceof Int16Array?a.SHORT:t instanceof Uint16Array?a.UNSIGNED_SHORT:t instanceof Float32Array?a.FLOAT:t instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(t){return e(t)&&(t===a.BYTE||t===a.UNSIGNED_BYTE||t===a.SHORT||t===a.UNSIGNED_SHORT||t===a.FLOAT||t===a.DOUBLE)},a.createTypedArray=function(t,e){switch(t){case a.BYTE:return new Int8Array(e);case a.UNSIGNED_BYTE:return new Uint8Array(e);case a.SHORT:return new Int16Array(e);case a.UNSIGNED_SHORT:return new Uint16Array(e);case a.FLOAT:return new Float32Array(e);case a.DOUBLE:return new Float64Array(e);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(e,r,i,o){switch(i=t(i,0),o=t(o,(r.byteLength-i)/a.getSizeInBytes(e)),e){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/GeometryType",["./freezeObject"],function(t){"use strict";var e={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return t(e)}),define("Core/PrimitiveType",["./freezeObject"],function(t){"use strict";var e={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(t){return t===e.POINTS||t===e.LINES||t===e.LINE_LOOP||t===e.LINE_STRIP||t===e.TRIANGLES||t===e.TRIANGLE_STRIP||t===e.TRIANGLE_FAN}};return t(e)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(t,e,n,r,i){"use strict";var a=function(e){e=t(e,t.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=t(e.primitiveType,i.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=t(e.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(t){var r=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&e(t.attributes[i])&&e(t.attributes[i].values)){var a=t.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=t(e.normalize,!1),this.values=e.values};return e}),define("Core/GeometryAttributes",["./defaultValue"],function(t){"use strict";var e=function(e){e=t(e,t.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color};return e}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(t){switch(t){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(e){return t(e)&&(e===i.UNSIGNED_BYTE||e===i.UNSIGNED_SHORT||e===i.UNSIGNED_INT)},i.createTypedArray=function(t,e){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e):new Uint16Array(e)},i.createTypedArrayFromArrayBuffer=function(t,e,n,i){return t>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(e,n,i):new Uint16Array(e,n,i)},n(i)}),define("Core/EllipsoidOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType"],function(t,e,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=new e(1,1,1),m=Math.cos,y=Math.sin,p=function(t){t=r(t,r.EMPTY_OBJECT);var n=r(t.radii,d),i=r(t.stackPartitions,10),a=r(t.slicePartitions,8),o=r(t.subdivisions,128);this._radii=e.clone(n),this._stackPartitions=i,this._slicePartitions=a,this._subdivisions=o,this._workerName="createEllipsoidOutlineGeometry"};p.packedLength=e.packedLength+3,p.pack=function(t,n,i){i=r(i,0),e.pack(t._radii,n,i),i+=e.packedLength,n[i++]=t._stackPartitions,n[i++]=t._slicePartitions,n[i]=t._subdivisions};var v=new e,w={radii:v,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};return p.unpack=function(t,n,a){n=r(n,0);var o=e.unpack(t,n,v);n+=e.packedLength;var u=t[n++],s=t[n++],c=t[n++];return i(a)?(a._radii=e.clone(o,a._radii),a._stackPartitions=u,a._slicePartitions=s,a._subdivisions=c,a):(w.stackPartitions=u,w.slicePartitions=s,w.subdivisions=c,new p(w))},p.createGeometry=function(e){var r,i,a,d,p,v,w=e._radii,E=o.fromCartesian3(w),g=e._stackPartitions,x=e._slicePartitions,S=e._subdivisions,M=S*(g+x-1),z=M-x+2,_=new Float64Array(3*z),O=l.createTypedArray(z,2*M),T=0,I=new Array(S),N=new Array(S);for(r=0;S>r;r++)a=f.TWO_PI*r/S,I[r]=m(a),N[r]=y(a);for(r=1;g>r;r++)for(d=Math.PI*r/g,p=m(d),v=y(d),i=0;S>i;i++)_[T++]=w.x*I[i]*v,_[T++]=w.y*N[i]*v,_[T++]=w.z*p; -for(I.length=x,N.length=x,r=0;x>r;r++)a=f.TWO_PI*r/x,I[r]=m(a),N[r]=y(a);for(_[T++]=0,_[T++]=0,_[T++]=w.z,r=1;S>r;r++)for(d=Math.PI*r/S,p=m(d),v=y(d),i=0;x>i;i++)_[T++]=w.x*I[i]*v,_[T++]=w.y*N[i]*v,_[T++]=w.z*p;for(_[T++]=0,_[T++]=0,_[T++]=-w.z,T=0,r=0;g-1>r;++r){var R=r*S;for(i=0;S-1>i;++i)O[T++]=R+i,O[T++]=R+i+1;O[T++]=R+S-1,O[T++]=R}var P=S*(g-1);for(i=1;x+1>i;++i)O[T++]=P,O[T++]=P+i;for(r=0;S-2>r;++r){var b=r*x+1+P,A=(r+1)*x+1+P;for(i=0;x-1>i;++i)O[T++]=A+i,O[T++]=b+i;O[T++]=A+x-1,O[T++]=b+x-1}var C=_.length/3-1;for(i=C-1;i>C-x-1;--i)O[T++]=C,O[T++]=i;var L=new c({position:new s({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:_})});return new u({attributes:L,indices:O,primitiveType:h.LINES,boundingSphere:t.fromEllipsoid(E)})},p}),define("Core/SphereOutlineGeometry",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./EllipsoidOutlineGeometry"],function(t,e,n,r,i){"use strict";var a=function(n){var r=e(n.radius,1),a=new t(r,r,r),o={radii:a,stackPartitions:n.stackPartitions,slicePartitions:n.slicePartitions,subdivisions:n.subdivisions};this._ellipsoidGeometry=new i(o),this._workerName="createSphereOutlineGeometry"};a.packedLength=i.packedLength,a.pack=function(t,e,n){i.pack(t._ellipsoidGeometry,e,n)};var o=new i,u={radius:void 0,radii:new t,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};return a.unpack=function(e,r,s){var c=i.unpack(e,r,o);return u.stackPartitions=c._stackPartitions,u.slicePartitions=c._slicePartitions,u.subdivisions=c._subdivisions,n(s)?(t.clone(c._radii,u.radii),s._ellipsoidGeometry=new i(u),s):(u.radius=c._radii.x,new a(u))},a.createGeometry=function(t){return i.createGeometry(t._ellipsoidGeometry)},a}),define("Workers/createSphereOutlineGeometry",["../Core/defined","../Core/SphereOutlineGeometry"],function(t,e){"use strict";return function(n,r){return t(r)&&(n=e.unpack(n,r)),e.createGeometry(n)}})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createVerticesFromHeightmap.js b/libs/Cesium/Workers/createVerticesFromHeightmap.js deleted file mode 100644 index 994e4991..00000000 --- a/libs/Cesium/Workers/createVerticesFromHeightmap.js +++ /dev/null @@ -1,228 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,i){i=t(i,r);var a=Math.abs(e-n);return i>=a||a<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],i=t;e>=i;i++)r.push(n*i);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var i=new e;return n.setRandomNumberSeed=function(t){i=new e(t)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};a.fromSpherical=function(n,r){t(r)||(r=new a);var i=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(e,n,r,i){return t(i)?(i.x=e,i.y=n,i.z=r,i):new a(e,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(e,t){a.normalize(e,s),a.normalize(t,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,l);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Z,t):n.y<=n.z?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_Z,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)},a.cross=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=t.x,u=t.y,s=t.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(e,t,n,r,o){var u=i.toRadians(e),s=i.toRadians(t);return a.fromRadians(u,s,n,r,o)};var f=new a,d=new a,h=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=e(i,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,d);var l=Math.sqrt(a.dot(f,d));return d=a.divideByScalar(d,l,d),f=a.multiplyByScalar(f,i,f),t(u)||(u=new a),a.add(d,f,u)},a.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=i.toRadians(e[o]);return a.fromRadiansArray(r,t,n)},a.fromRadiansArray=function(e,n,r){var i=e.length;t(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=i.toRadians(e[o]),r[o+1]=i.toRadians(e[o+1]),r[o+2]=e[o+2];return a.fromRadiansArrayHeights(r,t,n)},a.fromRadiansArrayHeights=function(e,n,r){var i=e.length;t(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return a.fromRadians=function(n,r,i,o){return i=e(i,0),t(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(e,t,n,r){return e=i.toRadians(e),t=i.toRadians(t),a.fromRadians(e,t,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new a(e.longitude,e.latitude,e.height):void 0},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},a.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t){return a.equalsEpsilon(this,e,t)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";function s(t,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),t._radii=new e(r,i,a),t._radiiSquared=new e(r*r,i*i,a*a),t._radiiToTheFourth=new e(r*r*r*r,i*i*i*i,a*a*a*a),t._oneOverRadii=new e(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),t._minimumRadius=Math.min(r,i,a),t._maximumRadius=Math.max(r,i,a),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var i=t._radii;return r(n)?(e.clone(i,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,i){i=n(i,0),e.pack(t._radii,r,i)},c.unpack=function(t,r,i){r=n(r,0);var a=e.unpack(t,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var i=t.longitude,a=t.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(t,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,t.height,i),r(n)||(n=new e),e.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var d=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,h);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,d),s=e.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,n))*e.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var i=t.x,a=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,d=i*i*c*c,h=a*a*l*l,m=o*o*f*f,v=d+h+m,w=Math.sqrt(1/v),g=e.multiplyByScalar(t,w,p);if(v<this._centerToleranceSquared)return isFinite(w)?e.clone(g,n):void 0;var x=this._oneOverRadiiSquared,S=x.x,E=x.y,M=x.z,O=y;O.x=2*g.x*S,O.y=2*g.y*E,O.z=2*g.z*M;var _,P,R,C,z,T,I,N,b,A,D,q=(1-w)*e.magnitude(t)/(.5*e.magnitude(O)),U=0;do{q-=U,R=1/(1+q*S),C=1/(1+q*E),z=1/(1+q*M),T=R*R,I=C*C,N=z*z,b=T*R,A=I*C,D=N*z,_=d*T+h*I+m*N-1,P=d*b*S+h*A*E+m*D*M;var L=-2*P;U=_/L}while(Math.abs(_)>u.EPSILON12);return r(n)?(n.x=i*R,n.y=a*C,n.z=o*z,n):new e(i*R,a*C,o*z)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var i=t.x,a=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,i,a,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var i=this._semimajorAxis,a=t.longitude*i,o=t.latitude*i,u=t.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new e(a,o,u)},u.prototype.unproject=function(e,n){var i=this._oneOverSemimajorAxis,a=e.x*i,o=e.y*i,u=e.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new t(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r,i){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(i,0)};a.fromElements=function(e,n,r,i,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=i,o):new a(e,n,r,i)},a.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,s);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)&&i.equalsEpsilon(e.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(h[n],d[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],d[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=d[i],m=h[i];if(Math.abs(e[c.getElementIndex(m,f)])>n){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],w=e[c.getElementIndex(m,f)],g=(y-v)/2/w;p=0>g?-1/(-g+Math.sqrt(1+g*g)):1/(g+Math.sqrt(1+g*g)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,n,r,i,a,o,u,s,c){this[0]=t(e,0),this[1]=t(i,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(a,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r++],i[1]=e[r++],i[2]=e[r++],i[3]=e[r++],i[4]=e[r++],i[5]=e[r++],i[6]=e[r++],i[7]=e[r++],i[8]=e[r++],i},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],i[8]=e[r+8],i},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,i=e.x*e.y,a=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,d=e.z*e.w,h=e.w*e.w,m=r-u-f+h,p=2*(i-d),y=2*(a+l),v=2*(i+d),w=-r+u-f+h,g=2*(s-o),x=2*(a-l),S=2*(s+o),E=-r-u+f+h;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=w,t[5]=S,t[6]=y,t[7]=g,t[8]=E,t):new c(m,p,y,v,w,g,x,S,E)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=i,t[6]=0,t[7]=-i,t[8]=r,t):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=r,t):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,i=e[r],a=e[r+1],o=e[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=3*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],i=e[t+3],a=e[t+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[3]*i+e[6]*a,u=e[1]*r+e[4]*i+e[7]*a,s=e[2]*r+e[5]*i+e[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],h=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var r=a.EPSILON20,i=10,l=0,f=0;n(t)||(t={});for(var d=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=r*o(h);i>f&&u(h)>y;)s(h,m),c.transpose(m,p),c.multiply(h,m,h),c.multiply(p,h,h),c.multiply(d,m,d),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],i=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(e,t){var n=e[0],i=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],d=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");t[0]=s*h-d*l,t[1]=d*o-i*h,t[2]=i*l-s*o,t[3]=f*l-u*h,t[4]=n*h-f*o,t[5]=u*o-n*l,t[6]=u*d-f*s,t[7]=f*i-n*d,t[8]=n*s-u*i;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,i,a,o,u,s){"use strict";var c=function(e,t,r,i,a,o,u,s,c,l,f,d,h,m,p,y){this[0]=n(e,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(h,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(p,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(d,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,i){return t=n(t,0),r(i)||(i=new c),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,i,a){return i=n(i,e.ZERO),r(a)?(a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=0,a[4]=t[3],a[5]=t[4],a[6]=t[5],a[7]=0,a[8]=t[6],a[9]=t[7],a[10]=t[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(t[0],t[3],t[6],i.x,t[1],t[4],t[7],i.y,t[2],t[5],t[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,d=t.x*t.w,h=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,w=t.w*t.w,g=s-h-y+w,x=2*(l-v),S=2*(f+p),E=2*(l+v),M=-s+h-y+w,O=2*(m-d),_=2*(f-p),P=2*(m+d),R=-s-h+y+w;return i[0]=g*a,i[1]=E*a,i[2]=_*a,i[3]=0,i[4]=x*o,i[5]=M*o,i[6]=P*o,i[7]=0,i[8]=S*u,i[9]=O*u,i[10]=R*u,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,d=new e;c.fromCamera=function(t,n){var i=t.eye,a=t.target,o=t.up;e.normalize(e.subtract(a,i,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,d),d);var u=f.x,s=f.y,h=f.z,m=l.x,p=l.y,y=l.z,v=d.x,w=d.y,g=d.z,x=i.x,S=i.y,E=i.z,M=u*-x+s*-S+h*-E,O=v*-x+w*-S+g*-E,_=m*x+p*S+y*E;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=w,n[6]=-p,n[7]=0,n[8]=h,n[9]=g,n[10]=-y,n[11]=0,n[12]=M,n[13]=O,n[14]=_,n[15]=1,n):new c(u,s,h,M,v,w,g,O,-m,-p,-y,_,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,i){var a=Math.tan(.5*e),o=1/a,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(e,t,n,r,i,a,o){var u=1/(t-e),s=1/(r-n),c=1/(a-i),l=-(t+e)*u,f=-(r+n)*s,d=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=d,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,n,r,i,a,o){var u=2*i/(t-e),s=2*i/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),f=-(a+i)/(a-i),d=-1,h=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=d,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,i,a){var o=2*i/(t-e),u=2*i/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,f=-1,d=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=d,a[15]=0,a},c.computeViewportTransformation=function(e,t,r,i){e=n(e,n.EMPTY_OBJECT);var a=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-t),d=c,h=l,m=f,p=a+c,y=o+l,v=t+f,w=1;return i[0]=d,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=p,i[13]=y,i[14]=v,i[15]=w,i},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,i=e[r],a=e[r+1],o=e[r+2],u=e[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=4*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],i=e[t+4],a=e[t+8],o=e[t+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var h=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],p=e[12],y=e[13],v=e[14],w=e[15],g=t[0],x=t[1],S=t[2],E=t[3],M=t[4],O=t[5],_=t[6],P=t[7],R=t[8],C=t[9],z=t[10],T=t[11],I=t[12],N=t[13],b=t[14],A=t[15],D=r*g+u*x+f*S+p*E,q=i*g+s*x+d*S+y*E,U=a*g+c*x+h*S+v*E,L=o*g+l*x+m*S+w*E,W=r*M+u*O+f*_+p*P,B=i*M+s*O+d*_+y*P,F=a*M+c*O+h*_+v*P,k=o*M+l*O+m*_+w*P,j=r*R+u*C+f*z+p*T,V=i*R+s*C+d*z+y*T,Z=a*R+c*C+h*z+v*T,H=o*R+l*C+m*z+w*T,Y=r*I+u*N+f*b+p*A,X=i*I+s*N+d*b+y*A,G=a*I+c*N+h*b+v*A,J=o*I+l*N+m*b+w*A;return n[0]=D,n[1]=q,n[2]=U,n[3]=L,n[4]=W,n[5]=B,n[6]=F,n[7]=k,n[8]=j,n[9]=V,n[10]=Z,n[11]=H,n[12]=Y,n[13]=X,n[14]=G,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=e[12],h=e[13],m=e[14],p=t[0],y=t[1],v=t[2],w=t[4],g=t[5],x=t[6],S=t[8],E=t[9],M=t[10],O=t[12],_=t[13],P=t[14],R=r*p+o*y+c*v,C=i*p+u*y+l*v,z=a*p+s*y+f*v,T=r*w+o*g+c*x,I=i*w+u*g+l*x,N=a*w+s*g+f*x,b=r*S+o*E+c*M,A=i*S+u*E+l*M,D=a*S+s*E+f*M,q=r*O+o*_+c*P+d,U=i*O+u*_+l*P+h,L=a*O+s*_+f*P+m;return n[0]=R,n[1]=C,n[2]=z,n[3]=0,n[4]=T,n[5]=I,n[6]=N,n[7]=0,n[8]=b,n[9]=A,n[10]=D,n[11]=0,n[12]=q,n[13]=U,n[14]=L,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=t[0],h=t[1],m=t[2],p=t[3],y=t[4],v=t[5],w=t[6],g=t[7],x=t[8],S=r*d+o*h+c*m,E=i*d+u*h+l*m,M=a*d+s*h+f*m,O=r*p+o*y+c*v,_=i*p+u*y+l*v,P=a*p+s*y+f*v,R=r*w+o*g+c*x,C=i*w+u*g+l*x,z=a*w+s*g+f*x;return n[0]=S,n[1]=E,n[2]=M,n[3]=0,n[4]=O,n[5]=_,n[6]=P,n[7]=0,n[8]=R,n[9]=C,n[10]=z,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=r*e[0]+i*e[4]+a*e[8]+e[12],u=r*e[1]+i*e[5]+a*e[9]+e[13],s=r*e[2]+i*e[6]+a*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var p=new e;c.multiplyByUniformScale=function(e,t,n){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,n)},c.multiplyByScale=function(e,t,n){var r=t.x,i=t.y,a=t.z;return 1===r&&1===i&&1===a?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=i*e[4],n[5]=i*e[5],n[6]=i*e[6],n[7]=0,n[8]=a*e[8],n[9]=a*e[9],n[10]=a*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=t.w,u=e[0]*r+e[4]*i+e[8]*a+e[12]*o,s=e[1]*r+e[5]*i+e[9]*a+e[13]*o,c=e[2]*r+e[6]*i+e[10]*a+e[14]*o,l=e[3]*r+e[7]*i+e[11]*a+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a,u=e[1]*r+e[5]*i+e[9]*a,s=e[2]*r+e[6]*i+e[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a+e[12],u=e[1]*r+e[5]*i+e[9]*a+e[13],s=e[2]*r+e[6]*i+e[10]*a+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],i=e[3],a=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[10]=e[10],t[11]=e[14],t[12]=i,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,w=new t,g=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,w),g))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],i=e[4],a=e[8],l=e[12],f=e[1],d=e[5],h=e[9],m=e[13],p=e[2],x=e[6],S=e[10],E=e[14],M=e[3],O=e[7],_=e[11],P=e[15],R=S*P,C=E*_,z=x*P,T=E*O,I=x*_,N=S*O,b=p*P,A=E*M,D=p*_,q=S*M,U=p*O,L=x*M,W=R*d+T*h+I*m-(C*d+z*h+N*m),B=C*f+b*h+q*m-(R*f+A*h+D*m),F=z*f+A*d+U*m-(T*f+b*d+L*m),k=N*f+D*d+L*h-(I*f+q*d+U*h),j=C*i+z*a+N*l-(R*i+T*a+I*l),V=R*r+A*a+D*l-(C*r+b*a+q*l),Z=T*r+b*i+L*l-(z*r+A*i+U*l),H=I*r+q*i+U*a-(N*r+D*i+L*a);R=a*m,C=l*h,z=i*m,T=l*d,I=i*h,N=a*d,b=r*m,A=l*f,D=r*h,q=a*f,U=r*d,L=i*f;var Y=R*O+T*_+I*P-(C*O+z*_+N*P),X=C*M+b*_+q*P-(R*M+A*_+D*P),G=z*M+A*O+U*P-(T*M+b*O+L*P),J=N*M+D*O+L*_-(I*M+q*O+U*_),Q=z*S+N*E+C*x-(I*E+R*x+T*S),$=D*E+R*p+A*S-(b*S+q*E+C*p),K=b*x+L*E+T*p-(U*E+z*p+A*x),et=U*S+I*p+q*x-(D*x+L*S+N*p),tt=r*W+i*B+a*F+l*k;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=W*tt,n[1]=B*tt,n[2]=F*tt,n[3]=k*tt,n[4]=j*tt,n[5]=V*tt,n[6]=Z*tt,n[7]=H*tt,n[8]=Y*tt,n[9]=X*tt,n[10]=G*tt,n[11]=J*tt,n[12]=Q*tt,n[13]=$*tt,n[14]=K*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],d=e[13],h=e[14],m=-n*f-r*d-i*h,p=-a*f-o*d-u*h,y=-s*f-c*d-l*h;return t[0]=n,t[1]=a,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=i,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var i=function(t,n){this.normal=e.clone(t),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-e.dot(r,n);return t(a)?(e.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new e;return i.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,a),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},i.ORIGIN_XY_PLANE=r(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(e.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.west=e[r++],i.south=e[r++],i.east=e[r++],i.north=e[r],i},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,i,a,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),i=u.toRadians(t(i,0)),a=u.toRadians(t(a,0)),n(o)?(o.west=e,o.south=r,o.east=i,o.north=a,o):new s(e,r,i,a)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=a,t.east=i,t.north=o,t):new s(r,a,i,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var i=t.east,a=t.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var i=e.east,a=e.west,o=t.east,c=t.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var d=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return d>=h?void 0:n(r)?(r.west=l,r.south=d,r.east=f,r.north=h,r):new s(l,d,f,h)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,i=e.west,a=e.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,i,o){r=t(r,a.WGS84),i=t(i,0),n(o)||(o=[]);var l=0,f=e.north,d=e.south,h=e.east,m=e.west,p=c;p.height=i,p.longitude=m,p.latitude=f,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=0>f?f:d>0?d:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=r.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,i,a,o,u,s,c,l,f,d){"use strict";var h=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,p=new e,y=new e,v=new e,w=new e,g=new e,x=new e,S=new e,E=new e,M=new e,O=new e,_=new e;h.fromPoints=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var i=e.clone(t[0],x),a=e.clone(i,m),o=e.clone(i,p),u=e.clone(i,y),s=e.clone(i,v),c=e.clone(i,w),l=e.clone(i,g),f=t.length,d=1;f>d;d++){e.clone(t[d],i);var P=i.x,R=i.y,C=i.z;P<a.x&&e.clone(i,a),P>s.x&&e.clone(i,s),R<o.y&&e.clone(i,o),R>c.y&&e.clone(i,c),C<u.z&&e.clone(i,u),C>l.z&&e.clone(i,l)}var z=e.magnitudeSquared(e.subtract(s,a,S)),T=e.magnitudeSquared(e.subtract(c,o,S)),I=e.magnitudeSquared(e.subtract(l,u,S)),N=a,b=s,A=z;T>A&&(A=T,N=o,b=c),I>A&&(A=I,N=u,b=l);var D=E;D.x=.5*(N.x+b.x),D.y=.5*(N.y+b.y),D.z=.5*(N.z+b.z);var q=e.magnitudeSquared(e.subtract(b,D,S)),U=Math.sqrt(q),L=M;L.x=a.x,L.y=o.y,L.z=u.z;var W=O;W.x=s.x,W.y=c.y,W.z=l.z;var B=e.multiplyByScalar(e.add(L,W,S),.5,_),F=0;for(d=0;f>d;d++){e.clone(t[d],i);var k=e.magnitude(e.subtract(i,B,S));k>F&&(F=k);var j=e.magnitudeSquared(e.subtract(i,D,S));if(j>q){var V=Math.sqrt(j);U=.5*(U+V),q=U*U;var Z=V-U;D.x=(U*D.x+Z*i.x)/V,D.y=(U*D.y+Z*i.y)/V,D.z=(U*D.z+Z*i.z)/V}}return F>U?(e.clone(D,n.center),n.radius=U):(e.clone(B,n.center),n.radius=F),n};var P=new u,R=new e,C=new e,z=new t,T=new t;h.fromRectangle2D=function(e,t,n){return h.fromRectangleWithHeights2D(e,t,0,0,n)},h.fromRectangleWithHeights2D=function(t,i,a,o,u){if(r(u)||(u=new h),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=n(i,P),d.southwest(t,z),z.height=a,d.northeast(t,T),T.height=o;var s=i.project(z,R),c=i.project(T,C),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*f,p.z=s.z+.5*m,u};var I=[];h.fromRectangle3D=function(e,t,i,a){t=n(t,o.WGS84),i=n(i,0);var u;return r(e)&&(u=d.subsample(e,t,i,I)),h.fromPoints(u,a)},h.fromVertices=function(t,i,a,o){if(r(o)||(o=new h),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;i=n(i,e.ZERO),a=n(a,3);var u=x;u.x=t[0]+i.x,u.y=t[1]+i.y,u.z=t[2]+i.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),f=e.clone(u,v),d=e.clone(u,w),P=e.clone(u,g),R=t.length,C=0;R>C;C+=a){var z=t[C]+i.x,T=t[C+1]+i.y,I=t[C+2]+i.z;u.x=z,u.y=T,u.z=I,z<s.x&&e.clone(u,s),z>f.x&&e.clone(u,f),T<c.y&&e.clone(u,c),T>d.y&&e.clone(u,d),I<l.z&&e.clone(u,l),I>P.z&&e.clone(u,P)}var N=e.magnitudeSquared(e.subtract(f,s,S)),b=e.magnitudeSquared(e.subtract(d,c,S)),A=e.magnitudeSquared(e.subtract(P,l,S)),D=s,q=f,U=N;b>U&&(U=b,D=c,q=d),A>U&&(U=A,D=l,q=P);var L=E;L.x=.5*(D.x+q.x),L.y=.5*(D.y+q.y),L.z=.5*(D.z+q.z);var W=e.magnitudeSquared(e.subtract(q,L,S)),B=Math.sqrt(W),F=M;F.x=s.x,F.y=c.y,F.z=l.z;var k=O;k.x=f.x,k.y=d.y,k.z=P.z;var j=e.multiplyByScalar(e.add(F,k,S),.5,_),V=0;for(C=0;R>C;C+=a){u.x=t[C]+i.x,u.y=t[C+1]+i.y,u.z=t[C+2]+i.z;var Z=e.magnitude(e.subtract(u,j,S));Z>V&&(V=Z);var H=e.magnitudeSquared(e.subtract(u,L,S));if(H>W){var Y=Math.sqrt(H);B=.5*(B+Y),W=B*B;var X=Y-B;L.x=(B*L.x+X*u.x)/Y,L.y=(B*L.y+X*u.y)/Y,L.z=(B*L.z+X*u.z)/Y}}return V>B?(e.clone(L,o.center),o.radius=B):(e.clone(j,o.center),o.radius=V),o},h.fromCornerPoints=function(t,n,i){r(i)||(i=new h);var a=i.center;return e.add(t,n,a),e.multiplyByScalar(a,.5,a),i.radius=e.distance(a,n),i},h.fromEllipsoid=function(t,n){return r(n)||(n=new h),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var N=new e;h.fromBoundingSpheres=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var i=t.length;if(1===i)return h.clone(t[0],n);if(2===i)return h.union(t[0],t[1],n);for(var a=[],o=0;i>o;o++)a.push(t[o].center);n=h.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,N)+c.radius)}return n.radius=s,n},h.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,r){r=n(r,0);var i=e.center;t[r++]=i.x,t[r++]=i.y,t[r++]=i.z,t[r]=e.radius},h.unpack=function(e,t,i){t=n(t,0),r(i)||(i=new h);var a=i.center;return a.x=e[t++],a.y=e[t++],a.z=e[t++],i.radius=e[t],i};var b=new e,A=new e;h.union=function(t,n,i){r(i)||(i=new h);var a=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,a,b),l=e.magnitude(c);if(o>=l+s)return t.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),d=e.multiplyByScalar(c,(-o+f)/l,A);return e.add(d,a,d),e.clone(d,i.center),i.radius=f,i};var D=new e;h.expand=function(t,n,r){r=h.clone(t,r);var i=e.magnitude(e.subtract(n,r.center,D));return i>r.radius&&(r.radius=i),r},h.intersectPlane=function(t,n){var r=t.center,i=t.radius,a=n.normal,o=e.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);h.intersect=function(e,t){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(t,q);return h.intersectPlane(e,n)},h.transform=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var U=new e;h.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,U);return e.magnitudeSquared(r)-t.radius*t.radius},h.transformWithoutScale=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var L=new e;h.computePlaneDistances=function(t,n,i,a){r(a)||(a=new c);var o=e.subtract(t.center,n,L),u=e.multiplyByScalar(i,e.dot(i,o),L),s=e.magnitude(u);return a.start=s-t.radius,a.stop=s+t.radius,a};for(var W=new e,B=new e,F=new e,k=new e,j=new e,V=new t,Z=new Array(8),H=0;8>H;++H)Z[H]=new e;var Y=new u;return h.projectTo2D=function(t,r,i){r=n(r,Y);var a=r.ellipsoid,o=t.center,u=t.radius,s=a.geodeticSurfaceNormal(o,W),c=e.cross(e.UNIT_Z,s,B);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,j),d=e.negate(c,k),m=Z,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,d,p),p=m[2],e.add(s,f,p),e.add(p,d,p),p=m[3],e.add(s,f,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,d,p),p=m[6],e.add(s,f,p),e.add(p,d,p),p=m[7],e.add(s,f,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var w=m[v];e.add(o,w,w);var g=a.cartesianToCartographic(w,V);r.project(g,w)}i=h.fromPoints(m,i),o=i.center;var x=o.x,S=o.y,E=o.z;return o.x=E,o.y=x,o.z=S,i},h.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/EllipsoidalOccluder",["./BoundingSphere","./Cartesian3","./defaultValue","./defined","./defineProperties","./DeveloperError","./Rectangle"],function(e,t,n,r,i,a,o){"use strict";function u(e,n,r){var i=e.transformPositionToScaledSpace(n,m),a=t.magnitudeSquared(i),o=Math.sqrt(a),u=t.divideByScalar(i,o,p);a=Math.max(1,a),o=Math.max(1,o);var s=t.dot(u,r),c=t.magnitude(t.cross(u,r,u)),l=1/o,f=Math.sqrt(a-1)*l;return 1/(s*l-c*f)}function s(e,n,r){return 0>=n||n===1/0||n!==n?void 0:t.multiplyByScalar(e,n,r)}function c(e,n){return e.transformPositionToScaledSpace(n,y),t.normalize(y,y)}var l=function(e,n){this._ellipsoid=e,this._cameraPosition=new t,this._cameraPositionInScaledSpace=new t,this._distanceToLimbInScaledSpaceSquared=0,r(n)&&(this.cameraPosition=n)};i(l.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){var n=this._ellipsoid,r=n.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),i=t.magnitudeSquared(r)-1;t.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=r,this._distanceToLimbInScaledSpaceSquared=i}}});var f=new t;l.prototype.isPointVisible=function(e){var t=this._ellipsoid,n=t.transformPositionToScaledSpace(e,f);return this.isScaledSpacePointVisible(n)},l.prototype.isScaledSpacePointVisible=function(e){var n=this._cameraPositionInScaledSpace,r=this._distanceToLimbInScaledSpaceSquared,i=t.subtract(e,n,f),a=-t.dot(i,n),o=a>r&&a*a/t.magnitudeSquared(i)>r;return!o},l.prototype.computeHorizonCullingPoint=function(e,n,i){r(i)||(i=new t);for(var a=this._ellipsoid,o=c(a,e),l=0,f=0,d=n.length;d>f;++f){var h=n[f],m=u(a,h,o);l=Math.max(l,m)}return s(o,l,i)};var d=new t;l.prototype.computeHorizonCullingPointFromVertices=function(e,i,a,o,l){r(l)||(l=new t),o=n(o,t.ZERO);for(var f=this._ellipsoid,h=c(f,e),m=0,p=0,y=i.length;y>p;p+=a){d.x=i[p]+o.x,d.y=i[p+1]+o.y,d.z=i[p+2]+o.z;var v=u(f,d,h);m=Math.max(m,v)}return s(h,m,l)};var h=[];l.prototype.computeHorizonCullingPointFromRectangle=function(n,r,i){var a=o.subsample(n,r,0,h),u=e.fromPoints(a);return t.magnitude(u.center)<.1*r.minimumRadius?void 0:this.computeHorizonCullingPoint(u.center,a,i)};var m=new t,p=new t,y=new t;return l}),define("Core/HeightmapTessellator",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./freezeObject","./Math","./Rectangle"],function(e,t,n,r,i,a,o,u){"use strict";var s={};return s.DEFAULT_STRUCTURE=a({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1}),s.computeVertices=function(r){var a,c,l,f,d=Math.cos,h=Math.sin,m=Math.sqrt,p=Math.atan,y=Math.exp,v=o.PI_OVER_TWO,w=o.toRadians,g=r.vertices,x=r.heightmap,S=r.width,E=r.height,M=r.skirtHeight,O=t(r.isGeographic,!0),_=t(r.ellipsoid,i.WGS84),P=1/_.maximumRadius,R=r.nativeRectangle,C=r.rectangle;n(C)?(a=C.west,c=C.south,l=C.east,f=C.north):O?(a=w(R.west),c=w(R.south),l=w(R.east),f=w(R.north)):(a=R.west*P,c=v-2*p(y(-R.south*P)),l=R.east*P,f=v-2*p(y(-R.north*P)));var z=t(r.relativeToCenter,e.ZERO),T=t(r.structure,s.DEFAULT_STRUCTURE),I=t(T.heightScale,s.DEFAULT_STRUCTURE.heightScale),N=t(T.heightOffset,s.DEFAULT_STRUCTURE.heightOffset),b=t(T.elementsPerHeight,s.DEFAULT_STRUCTURE.elementsPerHeight),A=t(T.stride,s.DEFAULT_STRUCTURE.stride),D=t(T.elementMultiplier,s.DEFAULT_STRUCTURE.elementMultiplier),q=t(T.isBigEndian,s.DEFAULT_STRUCTURE.isBigEndian),U=u.computeWidth(R)/(S-1),L=u.computeHeight(R)/(E-1),W=_.radiiSquared,B=W.x,F=W.y,k=W.z,j=0,V=65536,Z=-65536,H=0,Y=E,X=0,G=S;M>0&&(--H,++Y,--X,++G);for(var J=H;Y>J;++J){var Q=J;0>Q&&(Q=0),Q>=E&&(Q=E-1);var $=R.north-L*Q;$=O?w($):v-2*p(y(-$*P));for(var K=d($),et=h($),tt=k*et,nt=($-c)/(f-c),rt=X;G>rt;++rt){var it=rt;0>it&&(it=0),it>=S&&(it=S-1);var at=R.west+U*it;O?at=w(at):at*=P;var ot,ut=Q*S*A+it*A;if(1===b)ot=x[ut];else{ot=0;var st;if(q)for(st=0;b>st;++st)ot=ot*D+x[ut+st];else for(st=b-1;st>=0;--st)ot=ot*D+x[ut+st]}ot=ot*I+N,Z=Math.max(Z,ot),V=Math.min(V,ot),(rt!==it||J!==Q)&&(ot-=M);var ct=K*d(at),lt=K*h(at),ft=B*ct,dt=F*lt,ht=m(ft*ct+dt*lt+tt*et),mt=1/ht,pt=ft*mt,yt=dt*mt,vt=tt*mt;g[j++]=pt+ct*ot-z.x,g[j++]=yt+lt*ot-z.y,g[j++]=vt+et*ot-z.z,g[j++]=ot;var wt=(at-a)/(l-a);g[j++]=wt,g[j++]=nt}}return{maximumHeight:Z,minimumHeight:V}},s}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n){this.x=e(t,0),this.y=e(n,0)};a.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new a(e,n)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new a(e.x,e.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y)},a.minimumComponent=function(e){return Math.min(e.x,e.y)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(e,t){return a.normalize(e,s),a.normalize(t,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,l);return a.abs(n,n),t=n.x<=n.y?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Y,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)},a.ZERO=r(new a(0,0)),a.UNIT_X=r(new a(1,0)),a.UNIT_Y=r(new a(0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,i,a,o){"use strict";var u=function(r,i,a){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(i,e.ZERO)),n(a)?a=e.clone(a):(a=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(a,.5,a)),this.center=a};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var i=t[0].x,a=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,d=1;f>d;d++){var h=t[d],m=h.x,p=h.y,y=h.z;i=Math.min(m,i),s=Math.max(m,s),a=Math.min(p,a),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=i,v.y=a,v.z=o;var w=r.maximum;w.x=s,w.y=c,w.z=l;var g=e.add(v,w,r.center);return e.multiplyByScalar(g,.5,g),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),i=n.normal,o=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),u=e.dot(t.center,i)+n.distance;return u-o>0?a.INSIDE:0>u+o?a.OUTSIDE:a.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function n(e,n,r){var i=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(n)))<r?0:i}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,i){var a;if(0===e)return 0===r?[]:[-i/r];if(0===r){if(0===i)return[0,0];var o=Math.abs(i),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(a=-i/e,0>a)return[];var s=Math.sqrt(a);return[-s,s]}if(0===i)return a=-r/e,0>a?[a,0]:[0,a];var c=r*r,l=4*e*i,f=n(c,-l,t.EPSILON14);if(0>f)return[];var d=-.5*n(r,t.sign(r)*Math.sqrt(f),t.EPSILON14);return r>0?[d/e,i/d]:[i/d,d/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var i,a,o=e,u=t/3,s=n/3,c=r,l=o*s,f=u*c,d=u*u,h=s*s,m=o*s-d,p=o*c-u*s,y=u*c-h,v=4*m*y-p*p;if(0>v){var w,g,x;d*f>=l*h?(w=o,g=m,x=-2*u*m+o*p):(w=c,g=y,x=-c*p+2*s*y); -var S=0>x?-1:1,E=-S*Math.abs(w)*Math.sqrt(-v);a=-x+E;var M=a/2,O=0>M?-Math.pow(-M,1/3):Math.pow(M,1/3),_=a===E?-O:-g/O;return i=0>=g?O+_:-x/(O*O+_*_+g),d*f>=l*h?[(i-u)/o]:[-c/(i+s)]}var P=m,R=-2*u*m+o*p,C=y,z=-c*p+2*s*y,T=Math.sqrt(v),I=Math.sqrt(3)/2,N=Math.abs(Math.atan2(o*T,-R)/3);i=2*Math.sqrt(-P);var b=Math.cos(N);a=i*b;var A=i*(-b/2-I*Math.sin(N)),D=a+A>2*u?a-u:A-u,q=o,U=D/q;N=Math.abs(Math.atan2(c*T,-z)/3),i=2*Math.sqrt(-C),b=Math.cos(N),a=i*b,A=i*(-b/2-I*Math.sin(N));var L=-c,W=2*s>a+A?a+s:A+s,B=L/W,F=q*W,k=-D*W-q*L,j=D*L,V=(s*k-u*j)/(-u*k+s*F);return V>=U?B>=U?B>=V?[U,V,B]:[U,B,V]:[B,U,V]:B>=U?[V,U,B]:B>=V?[V,B,U]:[B,V,U]}var r={};return r.computeDiscriminant=function(e,t,n,r){var i=e*e,a=t*t,o=n*n,u=r*r,s=18*e*t*n*r+a*o-27*i*u-4*(e*o*n+a*t*r);return s},r.computeRealRoots=function(e,r,i,a){var o,u;if(0===e)return t.computeRealRoots(r,i,a);if(0===r){if(0===i){if(0===a)return[0,0,0];u=-a/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===a?(o=t.computeRealRoots(e,0,i),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,i,a)}return 0===i?0===a?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,a):0===a?(o=t.computeRealRoots(e,r,i),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,i,a)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function i(t,i,a,o){var u=t*t,s=i-3*u/8,c=a-i*t/2+u*t/8,l=o-a*t/4+i*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var d=-t/4,h=f[f.length-1];if(Math.abs(h)<n.EPSILON14){var m=r.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var w=Math.sqrt(y),g=Math.sqrt(v);return[d-g,d-w,d+w,d+g]}if(y>=0&&0>v)return p=Math.sqrt(y),[d-p,d+p];if(0>y&&v>=0)return p=Math.sqrt(v),[d-p,d+p]}return[]}if(h>0){var x=Math.sqrt(h),S=(s+h-c/x)/2,E=(s+h+c/x)/2,M=r.computeRealRoots(1,x,S),O=r.computeRealRoots(1,-x,E);return 0!==M.length?(M[0]+=d,M[1]+=d,0!==O.length?(O[0]+=d,O[1]+=d,M[1]<=O[0]?[M[0],M[1],O[0],O[1]]:O[1]<=M[0]?[O[0],O[1],M[0],M[1]]:M[0]>=O[0]&&M[1]<=O[1]?[O[0],M[0],M[1],O[1]]:O[0]>=M[0]&&O[1]<=M[1]?[M[0],O[0],O[1],M[1]]:M[0]>O[0]&&M[0]<O[1]?[O[0],M[0],O[1],M[1]]:[M[0],O[0],M[1],O[1]]):M):0!==O.length?(O[0]+=d,O[1]+=d,O):[]}}return[]}function a(t,i,a,o){var u=a*a,s=i*i,c=t*t,l=-2*i,f=a*t+s-4*o,d=c*o-a*i*t+u,h=e.computeRealRoots(1,l,f,d);if(h.length>0){var m,p,y=h[0],v=i-y,w=v*v,g=t/2,x=v/2,S=w-4*o,E=w+4*Math.abs(o),M=c-4*y,O=c+4*Math.abs(y);if(0>y||M*E>S*O){var _=Math.sqrt(M);m=_/2,p=0===_?0:(t*x-a)/_}else{var P=Math.sqrt(S);m=0===P?0:(t*x-a)/P,p=P/2}var R,C;0===g&&0===m?(R=0,C=0):n.sign(g)===n.sign(m)?(R=g+m,C=y/R):(C=g-m,R=y/C);var z,T;0===x&&0===p?(z=0,T=0):n.sign(x)===n.sign(p)?(z=x+p,T=o/z):(T=x-p,z=o/T);var I=r.computeRealRoots(1,R,z),N=r.computeRealRoots(1,C,T);if(0!==I.length)return 0!==N.length?I[1]<=N[0]?[I[0],I[1],N[0],N[1]]:N[1]<=I[0]?[N[0],N[1],I[0],I[1]]:I[0]>=N[0]&&I[1]<=N[1]?[N[0],I[0],I[1],N[1]]:N[0]>=I[0]&&N[1]<=I[1]?[I[0],N[0],N[1],I[1]]:I[0]>N[0]&&I[0]<N[1]?[N[0],I[0],N[1],I[1]]:[I[0],N[0],I[1],N[1]]:I;if(0!==N.length)return N}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,i){var a=e*e,o=a*e,u=t*t,s=u*t,c=n*n,l=c*n,f=r*r,d=f*r,h=i*i,m=h*i,p=u*c*f-4*s*d-4*e*l*f+18*e*t*n*d-27*a*f*f+256*o*m+i*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*f+144*a*n*f)+h*(144*e*u*n-27*u*u-128*a*c-192*a*t*r);return p},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,f=u/t,d=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>d?h+1:h){case 0:return i(c,l,f,d);case 1:return a(c,l,f,d);case 2:return a(c,l,f,d);case 3:return i(c,l,f,d);case 4:return i(c,l,f,d);case 5:return a(c,l,f,d);case 6:return i(c,l,f,d);case 7:return i(c,l,f,d);case 8:return a(c,l,f,d);case 9:return i(c,l,f,d);case 10:return i(c,l,f,d);case 11:return a(c,l,f,d);case 12:return i(c,l,f,d);case 13:return i(c,l,f,d);case 14:return i(c,l,f,d);case 15:return i(c,l,f,d);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,i){return n(i)||(i=new e),i=e.multiplyByScalar(t.direction,r,i),e.add(t.origin,i,i)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,i,a,o,u,s,c){"use strict";function l(t,r,i,o,u){u=n(u,!1);var s,c,l,f,d,h=t.origin,m=t.direction,p=e.subtract(i,r,y),S=e.subtract(o,r,v),E=e.cross(m,S,w),M=e.dot(p,E);if(u){if(M<a.EPSILON6)return void 0;if(s=e.subtract(h,r,g),l=e.dot(s,E),0>l||l>M)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c),0>f||l+f>M)return void 0;d=e.dot(S,c)/M}else{if(Math.abs(M)<a.EPSILON6)return void 0;var O=1/M;if(s=e.subtract(h,r,g),l=e.dot(s,E)*O,0>l||l>1)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c)*O,0>f||l+f>1)return void 0;d=e.dot(S,c)*O}return d}function f(e,t,n,r){var i=t*t-4*e*n;if(0>i)return void 0;if(i>0){var a=1/(2*e),o=Math.sqrt(i),u=(-t+o)*a,s=(-t-o)*a;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function d(t,n,i){r(i)||(i={});var a=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(a,u,w),l=e.dot(o,o),d=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=f(l,d,h,E);return r(m)?(i.start=m.root0,i.stop=m.root1,i):void 0}function h(e,t,n){var r=e+t;return a.sign(e)!==a.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function m(t,n,r,i,c){var l,f=i*i,d=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*d,p=c*(i*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],a.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*d+i*n.x+r,v=d*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],a.EPSILON15),w=c*(i*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),g=[];if(0===w&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return g;var x=l[0],S=Math.sqrt(Math.max(1-x*x,0));if(g.push(new e(i,c*x,c*-S)),g.push(new e(i,c*x,c*S)),2===l.length){var E=l[1],M=Math.sqrt(Math.max(1-E*E,0));g.push(new e(i,c*E,c*-M)),g.push(new e(i,c*E,c*M))}return g}var O=w*w,_=v*v,P=m*m,R=w*v,C=P+_,z=2*(p*m+R),T=2*y*m+p*p-_+O,I=2*(y*p-R),N=y*y-O;if(0===C&&0===z&&0===T&&0===I)return g;l=s.computeRealRoots(C,z,T,I,N);var b=l.length;if(0===b)return g;for(var A=0;b>A;++A){var D,q=l[A],U=q*q,L=Math.max(1-U,0),W=Math.sqrt(L);D=a.sign(m)===a.sign(y)?h(m*U+y,p*q,a.EPSILON12):a.sign(y)===a.sign(p*q)?h(m*U,p*q+y,a.EPSILON12):h(m*U+p*q,y,a.EPSILON12);var B=h(v*q,w,a.EPSILON15),F=D*B;0>F?g.push(new e(i,c*q,c*W)):F>0?g.push(new e(i,c*q,c*-W)):0!==W?(g.push(new e(i,c*q,c*-W)),g.push(new e(i,c*q,c*W)),++A):g.push(new e(i,c*q,c*W))}return g}var p={};p.rayPlane=function(t,n,i){r(i)||(i=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(i=e.multiplyByScalar(u,l,i),e.add(o,i,i))};var y=new e,v=new e,w=new e,g=new e,x=new e;p.rayTriangle=function(t,n,i,a,o,u){var s=l(t,n,i,a,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var S=new c;p.lineSegmentTriangle=function(t,n,i,a,o,u,s){var c=S;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,i,a,o,u);return!r(f)||0>f||f>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var E={root0:0,root1:0};p.raySphere=function(e,t,n){return n=d(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var M=new c;p.lineSegmentSphere=function(t,n,i,a){var o=M;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),a=d(o,i,a),!r(a)||a.stop<0||a.start>s?void 0:(a.start=Math.max(a.start,0),a.stop=Math.min(a.stop,s),a)};var O=new e,_=new e;p.rayEllipsoid=function(t,n){var r,i,a,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,O),l=e.multiplyComponents(s,t.direction,_),f=e.magnitudeSquared(c),d=e.dot(c,l);if(f>1){if(d>=0)return void 0;var h=d*d;if(r=f-1,i=e.magnitudeSquared(l),a=i*r,a>h)return void 0;if(h>a){o=d*d-a,u=-d+Math.sqrt(o);var m=u/i,p=r/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(r/i);return{start:y,stop:y}}return 1>f?(r=f-1,i=e.magnitudeSquared(l),a=i*r,o=d*d-a,u=-d+Math.sqrt(o),{start:0,stop:u/i}):0>d?(i=e.magnitudeSquared(l),{start:0,stop:-d/i}):void 0};var P=new e,R=new e,C=new e,z=new e,T=new e,I=new o,N=new o,b=new o,A=new o,D=new o,q=new o,U=new o,L=new e,W=new e,B=new t;p.grazingAltitudeLocation=function(t,n){var i=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(i,P);if(e.dot(u,s)>=0)return i;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,P),f=e.normalize(l,l),d=e.mostOrthogonalAxis(l,z),h=e.normalize(e.cross(d,f,R),R),p=e.normalize(e.cross(f,h,C),C),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,N),w=o.fromScale(n.radii,b),g=o.fromScale(n.oneOverRadii,A),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var S,E,M=o.multiply(o.multiply(v,g,q),x,q),O=o.multiply(o.multiply(M,w,U),y,U),_=o.multiplyByVector(M,i,T),F=m(O,e.negate(_,P),0,0,1),k=F.length;if(k>0){for(var j=e.clone(e.ZERO,W),V=Number.NEGATIVE_INFINITY,Z=0;k>Z;++Z){S=o.multiplyByVector(w,o.multiplyByVector(y,F[Z],L),L);var H=e.normalize(e.subtract(S,i,z),z),Y=e.dot(H,u);Y>V&&(V=Y,j=e.clone(S,j))}var X=n.cartesianToCartographic(j,B);return V=a.clamp(V,0,1),E=e.magnitude(e.subtract(j,i,z))*Math.sqrt(1-V*V),E=c?-E:E,X.height=E,n.cartographicToCartesian(X,new e)}return void 0};var F=new e;return p.lineSegmentPlane=function(t,n,i,o){r(o)||(o=new e);var u=e.subtract(n,t,F),s=i.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON6)return void 0;var l=e.dot(s,t),f=-(i.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,n,r,i){var a=i.normal,o=i.distance,u=e.dot(a,t)+o<0,s=e.dot(a,n)+o<0,c=e.dot(a,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,d;if((1===l||2===l)&&(f=new e,d=new e),1===l){if(u)return p.lineSegmentPlane(t,n,i,f),p.lineSegmentPlane(t,r,i,d),{positions:[t,n,r,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,i,f),p.lineSegmentPlane(n,t,i,d),{positions:[t,n,r,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,i,f),p.lineSegmentPlane(r,n,i,d),{positions:[t,n,r,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,i,f),p.lineSegmentPlane(r,t,i,d),{positions:[t,n,r,f,d],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,i,f),p.lineSegmentPlane(t,n,i,d),{positions:[t,n,r,f,d],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,i,f),p.lineSegmentPlane(n,r,i,d),{positions:[t,n,r,f,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,i){return t(e).then(n,r,i)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=i(e),t}function n(t){return e(t,a)}function r(e){this.then=e}function i(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return a(r)}});return n}function a(e){var n=new r(function(n,r){try{return r?t(r(e)):a(e)}catch(i){return a(i)}});return n}function o(){function e(e,t,n){return d(e,t,n)}function n(e){return m(e)}function i(e){return m(a(e))}function u(e){return h(e)}var s,c,l,f,d,h,m;return c=new r(e),s={then:e,resolve:n,reject:i,progress:u,promise:c,resolver:{resolve:n,reject:i,progress:u}},l=[],f=[],d=function(e,t,n){var r,i;return r=o(),i="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,i)}),f.push(i),r.promise},h=function(e){return p(f,e),e},m=function(e){return e=t(e),d=e.then,m=t,h=v,p(l,e),f=l=S,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,i,a){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,f,d,h,m,p,y,w,g;if(w=t.length>>>0,c=Math.max(0,Math.min(n,w)),f=[],l=w-c+1,d=[],h=o(),c)for(y=h.progress,p=function(e){d.push(e),--l||(m=p=v,h.reject(d))},m=function(e){f.push(e),--c||(m=p=v,h.resolve(f))},g=0;w>g;++g)g in t&&e(t[g],s,u,y);else h.resolve(f);return h.then(r,i,a)})}function c(e,t,n,r){function i(e){return t?t(e[0]):e[0]}return s(e,1,i,n,r)}function l(e,t,n,r){return y(1,arguments),d(e,w).then(t,n,r)}function f(){return d(arguments,w)}function d(t,n){return e(t,function(t){var r,i,a,u,s,c;if(a=i=t.length>>>0,r=[],c=o(),a)for(u=function(t,i){e(t,n).then(function(e){r[i]=e,--a||c.resolve(r)},c.reject)},s=0;i>s;s++)s in t?u(t[s],s):--a;else c.resolve(r);return c.promise})}function h(t,n){var r=x.call(arguments,1);return e(t,function(t){var i;return i=t.length,r[0]=function(t,r,a){return e(t,function(t){return e(r,function(e){return n(t,e,a,i)})})},g.apply(t,r)})}function m(t,n,r){var i=arguments.length>2;return e(t,function(e){return e=i?r:e,n.resolve(e),e},function(e){return n.reject(e),a(e)},n.progress)}function p(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function w(e){return e}var g,x,S;return e.defer=o,e.resolve=t,e.reject=n,e.join=f,e.all=l,e.map=d,e.reduce=h,e.any=c,e.some=s,e.chain=m,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(S,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(S,t)})})}},x=[].slice,g=[].reduce||function(e){var t,n,r,i,a;if(a=0,t=Object(this),i=t.length>>>0,n=arguments,n.length<=1)for(;;){if(a in t){r=t[a++];break}if(++a>=i)throw new TypeError}else r=n[1];for(;i>a;++a)a in t&&(r=e(r,t[a],a,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,i,a=0,o=e.length-1;o>=a;)if(r=~~((a+o)/2),i=n(e[r],t),0>i)a=r+1;else{if(!(i>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,i){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=i};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],i=function(e,t,n,r){n||(n=" ");var i=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+i:i+e},a=function(e,t,n,r,a,o){var u=r-e.length;return u>0&&(e=n||!a?i(e,r,o,n):e.slice(0,t.length)+i("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+i(c.toString(t),u||0,"0",!1),a(e,n,r,o,s)},u=function(e,t,n,r,i,o){return null!=r&&(e=e.slice(0,r)),a(e,"",t,n,i,o)},s=function(e,r,s,c,l,f,d){var h,m,p,y,v;if("%%"==e)return"%";for(var w=!1,g="",x=!1,S=!1,E=" ",M=s.length,O=0;s&&M>O;O++)switch(s.charAt(O)){case" ":g=" ";break;case"+":g="+";break;case"-":w=!0;break;case"'":E=s.charAt(O+1);break;case"0":x=!0;break;case"#":S=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,w=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[n++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(d)>-1?6:"d"==d?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],d){case"s":return u(String(v),w,c,f,x,E);case"c":return u(String.fromCharCode(+v),w,c,f,x);case"b":return o(v,2,S,w,c,f,x);case"o":return o(v,8,S,w,c,f,x);case"x":return o(v,16,S,w,c,f,x);case"X":return o(v,16,S,w,c,f,x).toUpperCase();case"u":return o(v,10,S,w,c,f,x);case"i":case"d":return h=+v||0,h=Math.round(h-h%1),m=0>h?"-":g,v=m+i(String(Math.abs(h)),f,"0",!1),a(v,m,w,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return h=+v,m=0>h?"-":g,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(d.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(d)%2],v=m+Math.abs(h)[p](f),a(v,m,w,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,i,a,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=i,this.second=a,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,i,a,o,u,s,c){"use strict";function l(e,t){return z.compare(e.julianDate,t.julianDate)}function f(e){w.julianDate=e;var n=z.leapSeconds,r=t(n,w,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var i=n[r].offset;if(r>0){var a=z.secondsDifference(n[r].julianDate,e);a>i&&(r--,i=n[r].offset)}z.addSeconds(e,i,e)}function d(e,n){w.julianDate=e;var r=z.leapSeconds,i=t(r,w,l);if(0>i&&(i=~i),0===i)return z.addSeconds(e,-r[0].offset,n);if(i>=r.length)return z.addSeconds(e,-r[i-1].offset,n);var a=z.secondsDifference(r[i].julianDate,e);return 0===a?z.addSeconds(e,-r[i].offset,n):1>=a?void 0:z.addSeconds(e,-r[--i].offset,n)}function h(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function m(e,t,n,r,i,a,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var f=a+(r*s.SECONDS_PER_HOUR+i*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var p=new a,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,w=new u,g=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,S=/^(\d{4})-?(\d{3})$/,E=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,M=/^(\d{4})-?(\d{2})-?(\d{2})$/,O=/([Z+\-])?(\d{2})?:?(\d{2})?$/,_=/^(\d{2})(\.\d+)?/.source+O.source,P=/^(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,R=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,C="Invalid ISO 8601 date.",z=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var i=0|e;t+=(e-i)*s.SECONDS_PER_DAY,h(i,t,this),r===c.UTC&&f(this)};z.fromDate=function(e,t){var n=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(h(n[0],n[1],t),f(t),t):new z(n[0],n[1],c.UTC)},z.fromIso8601=function(e,t){e=e.replace(",",".");var n,a,u,s=e.split("T"),l=1,d=1,p=0,w=0,O=0,T=0,I=s[0],N=s[1];if(!r(I))throw new i(C);var b;if(s=I.match(M),null!==s){if(b=I.split("-").length-1,b>0&&2!==b)throw new i(C);n=+s[1],l=+s[2],d=+s[3]}else if(s=I.match(x),null!==s)n=+s[1],l=+s[2];else if(s=I.match(g),null!==s)n=+s[1];else{var A;if(s=I.match(S),null!==s){if(n=+s[1],A=+s[2],u=o(n),1>A||u&&A>366||!u&&A>365)throw new i(C)}else{if(s=I.match(E),null===s)throw new i(C);n=+s[1];var D=+s[2],q=+s[3]||0;if(b=I.split("-").length-1,b>0&&(!r(s[3])&&1!==b||r(s[3])&&2!==b))throw new i(C);var U=new Date(Date.UTC(n,0,4));A=7*D+q-U.getUTCDay()-3}a=new Date(Date.UTC(n,0,1)),a.setUTCDate(A),l=a.getUTCMonth()+1,d=a.getUTCDate()}if(u=o(n),1>l||l>12||1>d||(2!==l||!u)&&d>y[l-1]||u&&2===l&&d>v)throw new i(C);var L;if(r(N)){if(s=N.match(R),null!==s){if(b=N.split(":").length-1,b>0&&2!==b&&3!==b)throw new i(C);p=+s[1],w=+s[2],O=+s[3],T=1e3*+(s[4]||0),L=5}else if(s=N.match(P),null!==s){if(b=N.split(":").length-1,b>0&&1!==b)throw new i(C);p=+s[1],w=+s[2],O=60*+(s[3]||0),L=4}else{if(s=N.match(_),null===s)throw new i(C);p=+s[1],w=60*+(s[2]||0),L=3}if(w>=60||O>=61||p>24||24===p&&(w>0||O>0||T>0))throw new i(C);var W=s[L],B=+s[L+1],F=+(s[L+2]||0);switch(W){case"+":p-=B,w-=F;break;case"-":p+=B,w+=F;break;case"Z":break;default:w+=new Date(Date.UTC(n,l-1,d,p,w)).getTimezoneOffset()}}else w+=new Date(n,l-1,d).getTimezoneOffset();var k=60===O;for(k&&O--;w>=60;)w-=60,p++;for(;p>=24;)p-=24,d++;for(a=u&&2===l?v:y[l-1];d>a;)d-=a,l++,l>12&&(l-=12,n++),a=u&&2===l?v:y[l-1];for(;0>w;)w+=60,p--;for(;0>p;)p+=24,d--;for(;1>d;)l--,1>l&&(l+=12,n--),a=u&&2===l?v:y[l-1],d+=a;var j=m(n,l,d,p,w,O,T);return r(t)?(h(j[0],j[1],t),f(t)):t=new z(j[0],j[1],c.UTC),k&&z.addSeconds(t,1,t),t},z.now=function(e){return z.fromDate(new Date,e)};var T=new z(0,0,c.TAI);return z.toGregorianDate=function(e,t){var n=!1,i=d(e,T);r(i)||(z.addSeconds(e,-1,T),i=d(T,T),n=!0);var o=i.dayNumber,u=i.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var h=0|80*c/2447,m=0|c-(0|2447*h/80);c=0|h/11;var p=0|h+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,w=u-v*s.SECONDS_PER_HOUR,g=0|w/s.SECONDS_PER_MINUTE;w-=g*s.SECONDS_PER_MINUTE;var x=0|w,S=(w-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=g,t.second=x,t.millisecond=S,t.isLeapSecond=n,t):new a(y,p,m,v,g,x,S,n)},z.toDate=function(e){var t=z.toGregorianDate(e,p),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},z.toIso8601=function(t,n){var i,a=z.toGregorianDate(t,a);return r(n)||0===a.millisecond?r(n)&&0!==n?(i=(.01*a.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",a.year,a.month,a.day,a.hour,a.minute,a.second,i)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",a.year,a.month,a.day,a.hour,a.minute,a.second):(i=(.01*a.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",a.year,a.month,a.day,a.hour,a.minute,a.second,i))},z.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new z(e.dayNumber,e.secondsOfDay,c.TAI):void 0},z.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},z.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},z.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(z.secondsDifference(e,t))<=n},z.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},z.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},z.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},z.computeTaiMinusUtc=function(e){w.julianDate=e;var n=z.leapSeconds,r=t(n,w,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},z.addSeconds=function(e,t,n){return h(e.dayNumber,e.secondsOfDay+t,n)},z.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return h(e.dayNumber,r,n)},z.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return h(e.dayNumber,r,n)},z.addDays=function(e,t,n){var r=e.dayNumber+t;return h(r,e.secondsOfDay,n)},z.lessThan=function(e,t){return z.compare(e,t)<0},z.lessThanOrEquals=function(e,t){return z.compare(e,t)<=0},z.greaterThan=function(e,t){return z.compare(e,t)>0},z.greaterThanOrEquals=function(e,t){return z.compare(e,t)>=0},z.prototype.clone=function(e){return z.clone(this,e)},z.prototype.equals=function(e){return z.equals(this,e)},z.prototype.equalsEpsilon=function(e,t){return z.equalsEpsilon(this,e,t)},z.prototype.toString=function(){return z.toIso8601(this)},z.leapSeconds=[new u(new z(2441317,43210,c.TAI),10),new u(new z(2441499,43211,c.TAI),11),new u(new z(2441683,43212,c.TAI),12),new u(new z(2442048,43213,c.TAI),13),new u(new z(2442413,43214,c.TAI),14),new u(new z(2442778,43215,c.TAI),15),new u(new z(2443144,43216,c.TAI),16),new u(new z(2443509,43217,c.TAI),17),new u(new z(2443874,43218,c.TAI),18),new u(new z(2444239,43219,c.TAI),19),new u(new z(2444786,43220,c.TAI),20),new u(new z(2445151,43221,c.TAI),21),new u(new z(2445516,43222,c.TAI),22),new u(new z(2446247,43223,c.TAI),23),new u(new z(2447161,43224,c.TAI),24),new u(new z(2447892,43225,c.TAI),25),new u(new z(2448257,43226,c.TAI),26),new u(new z(2448804,43227,c.TAI),27),new u(new z(2449169,43228,c.TAI),28),new u(new z(2449534,43229,c.TAI),29),new u(new z(2450083,43230,c.TAI),30),new u(new z(2450630,43231,c.TAI),31),new u(new z(2451179,43232,c.TAI),32),new u(new z(2453736,43233,c.TAI),33),new u(new z(2454832,43234,c.TAI),34),new u(new z(2456109,43235,c.TAI),35),new u(new z(2457204,43236,c.TAI),36)],z}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var i=new n.constructor;for(var a in n)if(n.hasOwnProperty(a)){var o=n[a];r&&(o=t(o,r)),i[a]=o}return i};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var i=n[r],a=i.indexOf(": ");if(a>0){var o=i.substring(0,a),u=i.substring(a+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,i,a){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return r}function s(e,n){n=t(n,"");var i=e[1],a=!!e[2],s=e[3];switch(n){case"":case"text":return o(a,s);case"arraybuffer":return u(a,s);case"blob":var c=u(a,s);return new Blob([c],{type:i});case"document":var l=new DOMParser;return l.parseFromString(o(a,s),i);case"json":return JSON.parse(o(a,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,i=t(n.method,"GET"),a=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,i,a,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,f){var d=l.exec(e);if(null!==d)return c.resolve(s(d,t)),void 0;var h=new XMLHttpRequest;if(n(f)&&n(h.overrideMimeType)&&h.overrideMimeType(f),h.open(r,e,!0),n(u))for(var m in u)u.hasOwnProperty(m)&&h.setRequestHeader(m,u[m]);n(t)&&(h.responseType=t),h.onload=function(){200===h.status?n(h.response)?c.resolve(h.response):n(h.responseXML)&&h.responseXML.hasChildNodes()?c.resolve(h.responseXML):n(h.responseText)?c.resolve(h.responseText):c.reject(new a("unknown XMLHttpRequest response type.")):c.reject(new i(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){c.reject(new i)},h.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var i={Accept:"application/json,*/*;q=0.01"},a=function(n,a){return t(a)?t(a.Accept)||(a=e(a),a.Accept=i.Accept):a=i,r(n,a).then(function(e){return JSON.parse(e)})};return a}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,i,a,o,u,s,c,l,f){"use strict";function d(e,t){return o.compare(e.julianDate,t)}function h(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var i=n.columnNames.indexOf("modifiedJulianDateUtc"),a=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),h=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>i||0>a||0>s||0>c||0>h||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=i,e._xPoleWanderRadiansColumn=a,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var w,g=e._addNewLeapSeconds,x=0,S=y.length;S>x;x+=e._columnCount){var E=y[x+i],M=y[x+p],O=E+l.MODIFIED_JULIAN_DATE_DIFFERENCE,_=new o(O,M,f.TAI);if(v.push(_),g){if(M!==w&&r(w)){var P=o.leapSeconds,R=t(P,_,d);if(0>R){var C=new u(_,M);P.splice(~R,0,C)}}w=M}}}function m(e,t,n,r,i){var a=n*r;i.xPoleWander=t[a+e._xPoleWanderRadiansColumn],i.yPoleWander=t[a+e._yPoleWanderRadiansColumn],i.xPoleOffset=t[a+e._xCelestialPoleOffsetRadiansColumn],i.yPoleOffset=t[a+e._yCelestialPoleOffsetRadiansColumn],i.ut1MinusUtc=t[a+e._ut1MinusUtcSecondsColumn]}function p(e,t,n){return t+e*(n-t)}function y(e,t,n,r,i,a,u){var s=e._columnCount;if(a>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[i],l=t[a];if(c.equals(l)||r.equals(c))return m(e,n,i,s,u),u;if(r.equals(l))return m(e,n,a,s,u),u;var f=o.secondsDifference(r,c)/o.secondsDifference(l,c),d=i*s,h=a*s,y=n[d+e._ut1MinusUtcSecondsColumn],v=n[h+e._ut1MinusUtcSecondsColumn],w=v-y;if(w>.5||-.5>w){var g=n[d+e._taiMinusUtcSecondsColumn],x=n[h+e._taiMinusUtcSecondsColumn];g!==x&&(l.equals(r)?y=v:v-=x-g)}return u.xPoleWander=p(f,n[d+e._xPoleWanderRadiansColumn],n[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(f,n[d+e._yPoleWanderRadiansColumn],n[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(f,n[d+e._xCelestialPoleOffsetRadiansColumn],n[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(f,n[d+e._yCelestialPoleOffsetRadiansColumn],n[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(f,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))h(this,t.data);else if(r(t.url)){var i=this;this._downloadPromise=e(s(t.url),function(e){h(i,e)},function(){i._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]}) -};return v.NONE=a({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new i(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new i(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var a=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var f=a[u],d=a[u+1],h=o.lessThanOrEquals(f,e),m=!r(d),p=m||o.greaterThanOrEquals(d,e);if(h&&p)return s=u,!m&&d.equals(e)&&++s,l=s+1,y(this,a,this._samples,e,s,l,n),n}var v=t(a,e,o.compare,this._dateColumn);return v>=0?(v<a.length-1&&a[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,a,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return a.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(i,t)),this.path&&(this.path=this.path.replace(i,t)),this.query&&(this.query=this.query.replace(i,t)),this.fragment&&(this.fragment=this.fragment.replace(i,t))};var i=/%[0-9a-z]{2}/gi,a=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function i(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),i=f.exec(r);if(null!==i)return i[1]}return void 0}function a(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:i(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(a()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,d=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return d._cesiumScriptRegex=f,d.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},d}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,i,a,o,u){"use strict";function s(e,t,n){var r=f;return r.dayNumber=t,r.secondsOfDay=n,a.daysDifference(r,e._sampleZeroDateTT)}function c(n,i){if(n._chunkDownloadsInProgress[i])return n._chunkDownloadsInProgress[i];var a=e.defer();n._chunkDownloadsInProgress[i]=a;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",i):t("Assets/IAU2006_XYS/IAU2006_XYS_"+i+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[i]=!1;for(var t=n._samples,r=e.samples,o=3*i*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];a.resolve()}),a.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new a(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,i[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new a(0,0,u.TAI);return l.prototype.preload=function(t,n,r,i){var a=s(this,t,n),o=s(this,r,i),u=0|a/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,d=0|l/this._samplesPerXysFile,h=[],m=f;d>=m;++m)h.push(c(this,m));return e.all(h)},l.prototype.computeXysRadians=function(e,t,n){var a=s(this,e,t);if(0>a)return void 0;var o=0|a/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var d=!1,h=this._samples;if(r(h[3*l])||(c(this,0|l/this._samplesPerXysFile),d=!0),r(h[3*f])||(c(this,0|f/this._samplesPerXysFile),d=!0),d)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new i(0,0,0);var m,p,y=a-l*this._stepSizeDays,v=this._work,w=this._denominators,g=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(g[m]=1,p=0;u>=p;++p)p!==m&&(g[m]*=v[p]);g[m]*=w[m];var S=3*(l+m);n.x+=g[m]*h[S++],n.y+=g[m]*h[S++],n.s+=g[m]*h[S]}return n},l}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return t(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof t[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof t[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",e(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",e(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",e(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",e(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function i(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function a(){return i()&&v}function o(){if(!t(w)&&(w=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(w=!0,g=r(e[1]))}return w}function u(){return o()&&g}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,S=r(e[1]),S.isNightly=!!e[2])}return x}function c(){return s()&&S}function l(){if(!t(E)){E=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(E=!0,M=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(E=!0,M=r(e[1])))}return E}function f(){return l()&&M}function d(){if(!t(O)){O=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(O=!0,_=r(e[1]))}return O}function h(){return t(P)||(P=/Windows/i.test(navigator.appVersion)),P}function m(){return d()&&_}function p(){return t(R)||(R=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),R}var y,v,w,g,x,S,E,M,O,_,P,R,C={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:d,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return C.supportsFullscreen=function(){return n.supportsFullscreen()},C.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},C.supportsWebWorkers=function(){return"undefined"!=typeof Worker},C}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)},c=new e;s.fromAxisAngle=function(t,r,i){var a=r/2,o=Math.sin(a);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,d=Math.cos(a);return n(i)?(i.x=u,i.y=l,i.z=f,i.w=d,i):new s(u,l,f,d)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var r,i,a,o,c,d=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=d+h+m;if(p>0)r=Math.sqrt(p+1),c=.5*r,r=.5/r,i=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,a=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;h>d&&(v=1),m>d&&m>h&&(v=2);var w=y[v],g=y[w];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(w,w)]-e[u.getElementIndex(g,g)]+1);var x=f;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(g,w)]-e[u.getElementIndex(w,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,i=-x[0],a=-x[1],o=-x[2]}return n(t)?(t.x=i,t.y=a,t.z=o,t.w=c,t):new s(i,a,o,c)};var d=new s;s.fromHeadingPitchRoll=function(t,n,r,i){var a=s.fromAxisAngle(e.UNIT_X,r,d),o=s.fromAxisAngle(e.UNIT_Y,-n,i);i=s.multiply(o,a,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,d);return s.multiply(u,i,i)};var h=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.x=e[r],i.y=e[r+1],i.z=e[r+2],i.w=e[r+3],i},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var i=0,a=n-t+1;a>i;i++){var o=3*i;s.unpack(e,4*(t+i),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,h);var u=s.computeAngle(p);r[o]=h.x*u,r[o+1]=h.y*u,r[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,r,i,a,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*a,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,i=e.y*n,a=e.z*n,o=e.w*n;return t.x=r,t.y=i,t.z=a,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+r*l+i*c-a*s,d=o*s-r*c+i*l+a*u,h=o*c+r*s-i*u+a*l,m=o*l-r*u-i*s-a*c;return n.x=f,n.y=d,n.z=h,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var w=new s;s.lerp=function(e,t,n,r){return w=s.multiplyByScalar(t,n,w),r=s.multiplyByScalar(e,1-n,r),s.add(w,r,r)};var g=new s,x=new s,S=new s;s.slerp=function(e,t,n,r){var i=s.dot(e,t),a=t;if(0>i&&(i=-i,a=g=s.negate(t,g)),1-i<o.EPSILON6)return s.lerp(e,a,n,r);var u=Math.acos(i);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),S=s.multiplyByScalar(a,Math.sin(n*u),S),r=s.add(x,S,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),i=0;return 0!==r&&(i=r/Math.sin(r)),e.multiplyByScalar(t,i,n)},s.exp=function(t,n){var r=e.magnitude(t),i=0;return 0!==r&&(i=Math.sin(r)/r),n.x=t.x*i,n.y=t.y*i,n.z=t.z*i,n.w=Math.cos(r),n};var E=new e,M=new e,O=new s,_=new s;s.computeInnerQuadrangle=function(t,n,r,i){var a=s.conjugate(n,O);s.multiply(a,r,_);var o=s.log(_,E);s.multiply(a,t,_);var u=s.log(_,M);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,O),s.multiply(n,O,i)},s.squad=function(e,t,n,r,i,a){var o=s.slerp(e,t,i,O),u=s.slerp(n,r,i,_);return s.slerp(o,u,2*i*(1-i),a)};for(var P=new s,R=1.9011074535173003,C=i.supportsTypedArrays()?new Float32Array(8):[],z=i.supportsTypedArrays()?new Float32Array(8):[],T=i.supportsTypedArrays()?new Float32Array(8):[],I=i.supportsTypedArrays()?new Float32Array(8):[],N=0;7>N;++N){var b=N+1,A=2*b+1;C[N]=1/(b*A),z[N]=b/A}return C[7]=R/136,z[7]=8*R/17,s.fastSlerp=function(e,t,n,r){var i,a=s.dot(e,t);a>=0?i=1:(i=-1,a=-a);for(var o=a-1,u=1-n,c=n*n,l=u*u,f=7;f>=0;--f)T[f]=(C[f]*c-z[f])*o,I[f]=(C[f]*l-z[f])*o;var d=i*n*(1+T[0]*(1+T[1]*(1+T[2]*(1+T[3]*(1+T[4]*(1+T[5]*(1+T[6]*(1+T[7])))))))),h=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=s.multiplyByScalar(e,h,P);return s.multiplyByScalar(t,d,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,i,a){var o=s.fastSlerp(e,t,i,O),u=s.fastSlerp(n,r,i,_);return s.fastSlerp(o,u,2*i*(1-i),a)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,i,a,o,u,s,c,l,f,d,h,m,p,y,v){"use strict";var w={},g=new n,x=new n,S=new n;w.eastNorthUpToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return a(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=g,s=x,l=S;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var E=new n,M=new n,O=new n;w.northEastDownToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return a(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=E,s=M,l=O;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},w.northUpEastToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return a(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=g,s=x,l=S;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var _=new y,P=new n(1,1,1),R=new p;w.headingPitchRollToFixedFrame=function(e,t,r,i,a,o){var u=y.fromHeadingPitchRoll(t,r,i,_),s=p.fromTranslationQuaternionRotationScale(n.ZERO,u,P,R);return o=w.eastNorthUpToFixedFrame(e,a,o),p.multiply(o,s,o)};var C=new p,z=new m;w.headingPitchRollQuaternion=function(e,t,n,r,i,a){var o=w.headingPitchRollToFixedFrame(e,t,n,r,i,C),u=p.getRotation(o,z);return y.fromRotationMatrix(u,a)};var T=24110.54841,I=8640184.812866,N=.093104,b=-62e-7,A=1.1772758384668e-19,D=72921158553e-15,q=h.TWO_PI/86400,U=new d;w.computeTemeToPseudoFixedMatrix=function(e,t){U=d.addSeconds(e,-d.computeTaiMinusUtc(e),U);var n,r=U.dayNumber,i=U.secondsOfDay,o=r-2451545;n=i>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=T+n*(I+n*(N+n*b)),s=u*q%h.TWO_PI,c=D+A*(r-2451545.5),l=(i+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,p=Math.cos(f),y=Math.sin(f);return a(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},w.iau2006XysData=new l,w.earthOrientationParameters=u.NONE;var L=32.184,W=2451545;w.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+L,i=t.stop.dayNumber,a=t.stop.secondsOfDay+L,o=w.iau2006XysData.preload(n,r,i,a),u=w.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},w.computeIcrfToFixedMatrix=function(e,t){a(t)||(t=new m);var n=w.computeFixedToIcrfMatrix(e,t);return a(n)?m.transpose(n,t):void 0};var B=new f(0,0,0),F=new s(0,0,0,0,0,0),k=new m,j=new m;w.computeFixedToIcrfMatrix=function(e,t){a(t)||(t=new m);var n=w.earthOrientationParameters.compute(e,F);if(!a(n))return void 0;var r=e.dayNumber,i=e.secondsOfDay+L,o=w.iau2006XysData.computeXysRadians(r,i,B);if(!a(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=k;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=m.fromRotationZ(-o.s,j),p=m.multiply(l,f,k),y=e.dayNumber,g=e.secondsOfDay-d.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,S=g/v.SECONDS_PER_DAY,E=.779057273264+S+.00273781191135448*(x+S);E=E%1*h.TWO_PI;var M=m.fromRotationZ(E,j),O=m.multiply(p,M,k),_=Math.cos(n.xPoleWander),P=Math.cos(n.yPoleWander),R=Math.sin(n.xPoleWander),C=Math.sin(n.yPoleWander),z=r-W+i/v.SECONDS_PER_DAY;z/=36525;var T=-47e-6*z*h.RADIANS_PER_DEGREE/3600,I=Math.cos(T),N=Math.sin(T),b=j;return b[0]=_*I,b[1]=_*N,b[2]=R,b[3]=-P*N+C*R*I,b[4]=P*I+C*R*N,b[5]=-C*_,b[6]=-C*N-P*R*I,b[7]=C*I-P*R*N,b[8]=P*_,m.multiply(O,b,t)};var V=new r;w.pointToWindowCoordinates=function(e,t,n,r){return r=w.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},w.pointToGLWindowCoordinates=function(e,n,i,o){a(o)||(o=new t);var u=V;return p.multiplyByVector(e,r.fromElements(i.x,i.y,i.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var Z=new n,H=new n,Y=new n;return w.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=i(r,c.WGS84).geodeticSurfaceNormal(e,Z),s=n.cross(t,u,H);n.equalsEpsilon(s,n.ZERO,h.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,Y);return n.cross(t,l,s),n.negate(s,s),a(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},w}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,i,a,o,u,s,c,l,f,d,h,m){"use strict";var p=new r,y=function(e,t){t=i(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(f.getColumn(r,0,p)),this._yAxis=n.fromCartesian4(f.getColumn(r,1,p));var a=n.fromCartesian4(f.getColumn(r,2,p));this._plane=d.fromPointNormal(e,a)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var w=new h,g=new n;y.prototype.projectPointOntoPlane=function(e,r){var i=w;i.origin=e,n.normalize(e,i.direction);var o=c.rayPlane(i,this._plane,g);if(a(o)||(n.negate(i.direction,i.direction),o=c.rayPlane(i,this._plane,g)),a(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return a(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){a(t)||(t=[]);for(var n=0,r=e.length,i=0;r>i;i++){var o=this.projectPointOntoPlane(e[i],t[n]);a(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){a(r)||(r=new t);var i=w;i.origin=e,n.clone(this._plane.normal,i.direction);var o=c.rayPlane(i,this._plane,g);a(o)||(n.negate(i.direction,i.direction),o=c.rayPlane(i,this._plane,g));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){a(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;a(t)?t.length=r:t=new Array(r);for(var i=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var f=e[l];n.multiplyByScalar(u,f.x,c),a(t[l])||(t[l]=new n);var d=n.add(o,c,t[l]);n.multiplyByScalar(s,f.y,c),n.add(d,c,d),i.scaleToGeocentricSurface(d,d)}return t},y}),define("Core/OrientedBoundingBox",["./Cartesian2","./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Intersect","./Plane","./Rectangle","./Math","./Matrix3"],function(e,t,n,r,i,a,o,u,s,c,l,f,d){"use strict";var h=function(e,n){this.center=t.clone(r(e,t.ZERO)),this.halfAxes=d.clone(r(n,d.ZERO))},m=new t,p=new t,y=function(e,n,r,a,o,u,s,c){i(c)||(c=new h);var l=c.halfAxes;d.setColumn(l,0,e.xAxis,l),d.setColumn(l,1,e.yAxis,l),d.setColumn(l,2,e.zAxis,l);var f=m;f.x=(n+r)/2,f.y=(a+o)/2,f.z=(u+s)/2;var y=p;y.x=(r-n)/2,y.y=(o-a)/2,y.z=(s-u)/2;var v=c.center;return f=d.multiplyByVector(l,f,f),t.add(e.origin,f,v),d.multiplyByScale(l,y,l),c},v=new n,w=new t,g=[new n,new n,new n,new n,new n,new n,new n,new n],x=[new t,new t,new t,new t,new t,new t,new t,new t],S=[new e,new e,new e,new e,new e,new e,new e,new e];return h.fromRectangle=function(e,t,n,i,a){t=r(t,0),n=r(n,0),i=r(i,o.WGS84);var s=l.center(e,v),f=i.cartographicToCartesian(s,w),d=new u(f,i),h=d.plane,m=g[0],p=g[1],E=g[2],M=g[3],O=g[4],_=g[5],P=g[6],R=g[7],C=s.longitude,z=e.south<0&&e.north>0?0:s.latitude;P.latitude=_.latitude=O.latitude=e.south,R.latitude=M.latitude=z,m.latitude=p.latitude=E.latitude=e.north,P.longitude=R.longitude=m.longitude=e.west,_.longitude=p.longitude=C,O.longitude=M.longitude=E.longitude=e.east,E.height=p.height=m.height=R.height=P.height=_.height=O.height=M.height=n,i.cartographicArrayToCartesianArray(g,x),d.projectPointsToNearestOnPlane(x,S);var T=Math.min(S[6].x,S[7].x,S[0].x),I=Math.max(S[2].x,S[3].x,S[4].x),N=Math.min(S[4].y,S[5].y,S[6].y),b=Math.max(S[0].y,S[1].y,S[2].y);E.height=m.height=O.height=P.height=t,i.cartographicArrayToCartesianArray(g,x);var A=Math.min(c.getPointDistance(h,x[0]),c.getPointDistance(h,x[2]),c.getPointDistance(h,x[4]),c.getPointDistance(h,x[6])),D=n;return y(d,T,I,N,b,A,D,a)},h.clone=function(e,n){return i(e)?i(n)?(t.clone(e.center,n.center),d.clone(e.halfAxes,n.halfAxes),n):new h(e.center,e.halfAxes):void 0},h.intersectPlane=function(e,n){var r=e.center,i=n.normal,a=e.halfAxes,o=i.x,u=i.y,c=i.z,l=Math.abs(o*a[d.COLUMN0ROW0]+u*a[d.COLUMN0ROW1]+c*a[d.COLUMN0ROW2])+Math.abs(o*a[d.COLUMN1ROW0]+u*a[d.COLUMN1ROW1]+c*a[d.COLUMN1ROW2])+Math.abs(o*a[d.COLUMN2ROW0]+u*a[d.COLUMN2ROW1]+c*a[d.COLUMN2ROW2]),f=t.dot(i,r)+n.distance;return-l>=f?s.OUTSIDE:f>=l?s.INSIDE:s.INTERSECTING},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.equals=function(e,n){return e===n||i(e)&&i(n)&&t.equals(e.center,n.center)&&d.equals(e.halfAxes,n.halfAxes)},h.prototype.clone=function(e){return h.clone(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h}),define("Core/formatError",["./defined"],function(e){"use strict";var t=function(t){var n,r=t.name,i=t.message;n=e(r)&&e(i)?r+": "+i:t.toString();var a=t.stack;return e(a)&&(n+="\n"+a),n};return t}),define("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,t,n){"use strict";var r=function(r){var i,a=[],o={id:void 0,result:void 0,error:void 0};return function(u){var s=u.data;a.length=0,o.id=s.id,o.error=void 0,o.result=void 0;try{o.result=r(s.parameters,a)}catch(c){o.error=c instanceof Error?{name:c.name,message:c.message,stack:c.stack}:c}t(i)||(i=e(self.webkitPostMessage,self.postMessage)),s.canTransferArrayBuffer||(a.length=0);try{i(o,a)}catch(c){o.result=void 0,o.error="postMessage failed with error: "+n(c)+"\n with responseMessage: "+JSON.stringify(o),i(o)}}};return r}),define("Workers/createVerticesFromHeightmap",["../Core/BoundingSphere","../Core/Ellipsoid","../Core/EllipsoidalOccluder","../Core/HeightmapTessellator","../Core/Math","../Core/OrientedBoundingBox","../Core/Rectangle","./createTaskProcessorWorker"],function(e,t,n,r,i,a,o,u){"use strict";function s(u,s){var c=6,l=u.width,f=u.height;u.skirtHeight>0&&(l+=2,f+=2);var d=new Float32Array(l*f*c);s.push(d.buffer),u.ellipsoid=t.clone(u.ellipsoid),u.rectangle=o.clone(u.rectangle),u.vertices=d;var h,m=r.computeVertices(u),p=e.fromVertices(d,u.relativeToCenter,c);u.rectangle.width<i.PI_OVER_TWO+i.EPSILON5&&(h=a.fromRectangle(u.rectangle,m.minimumHeight,m.maximumHeight,u.ellipsoid));var y=u.ellipsoid,v=new n(y),w=v.computeHorizonCullingPointFromVertices(u.relativeToCenter,d,c,u.relativeToCenter);return{vertices:d.buffer,numberOfAttributes:c,minimumHeight:m.minimumHeight,maximumHeight:m.maximumHeight,gridWidth:l,gridHeight:f,boundingSphere3D:p,orientedBoundingBox:h,occludeePointInScaledSpace:w}}return u(s)})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js b/libs/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js deleted file mode 100644 index 96d5bf20..00000000 --- a/libs/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -!function(){define("Core/defined",[],function(){"use strict";var t=function(t){return void 0!==t};return t}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";var e=function(t,e){return void 0!==t?t:e};return e.EMPTY_OBJECT=t({}),e}),define("Core/DeveloperError",["./defined"],function(t){"use strict";var e=function(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(r){e=r.stack}this.stack=e};return e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)t=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^t>>>1^e[1&t];for(;r<this.N-1;r++)t=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=2636928640&t<<7,t^=4022730752&t<<15,t^=t>>>18,t>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(t,e){"use strict";var r={};r.EPSILON1=.1,r.EPSILON2=.01,r.EPSILON3=.001,r.EPSILON4=1e-4,r.EPSILON5=1e-5,r.EPSILON6=1e-6,r.EPSILON7=1e-7,r.EPSILON8=1e-8,r.EPSILON9=1e-9,r.EPSILON10=1e-10,r.EPSILON11=1e-11,r.EPSILON12=1e-12,r.EPSILON13=1e-13,r.EPSILON14=1e-14,r.EPSILON15=1e-15,r.EPSILON16=1e-16,r.EPSILON17=1e-17,r.EPSILON18=1e-18,r.EPSILON19=1e-19,r.EPSILON20=1e-20,r.GRAVITATIONALPARAMETER=3986004418e5,r.SOLAR_RADIUS=6955e5,r.LUNAR_RADIUS=1737400,r.SIXTY_FOUR_KILOBYTES=65536,r.sign=function(t){return t>0?1:0>t?-1:0},r.signNotZero=function(t){return 0>t?-1:1},r.toSNorm=function(t){return Math.round(255*(.5*r.clamp(t,-1,1)+.5))},r.fromSNorm=function(t){return 2*(r.clamp(t,0,255)/255)-1},r.sinh=function(t){var e=Math.pow(Math.E,t),r=Math.pow(Math.E,-1*t);return.5*(e-r)},r.cosh=function(t){var e=Math.pow(Math.E,t),r=Math.pow(Math.E,-1*t);return.5*(e+r)},r.lerp=function(t,e,r){return(1-r)*t+r*e},r.PI=Math.PI,r.ONE_OVER_PI=1/Math.PI,r.PI_OVER_TWO=.5*Math.PI,r.PI_OVER_THREE=Math.PI/3,r.PI_OVER_FOUR=Math.PI/4,r.PI_OVER_SIX=Math.PI/6,r.THREE_PI_OVER_TWO=.5*3*Math.PI,r.TWO_PI=2*Math.PI,r.ONE_OVER_TWO_PI=1/(2*Math.PI),r.RADIANS_PER_DEGREE=Math.PI/180,r.DEGREES_PER_RADIAN=180/Math.PI,r.RADIANS_PER_ARCSECOND=r.RADIANS_PER_DEGREE/3600,r.toRadians=function(t){return t*r.RADIANS_PER_DEGREE},r.toDegrees=function(t){return t*r.DEGREES_PER_RADIAN},r.convertLongitudeRange=function(t){var e=r.TWO_PI,n=t-Math.floor(t/e)*e;return n<-Math.PI?n+e:n>=Math.PI?n-e:n},r.negativePiToPi=function(t){return r.zeroToTwoPi(t+r.PI)-r.PI},r.zeroToTwoPi=function(t){var e=r.mod(t,r.TWO_PI);return Math.abs(e)<r.EPSILON14&&Math.abs(t)>r.EPSILON14?r.TWO_PI:e},r.mod=function(t,e){return(t%e+e)%e},r.equalsEpsilon=function(t,r,n,i){i=e(i,n);var a=Math.abs(t-r);return i>=a||a<=n*Math.max(Math.abs(t),Math.abs(r))};var n=[1];r.factorial=function(t){var e=n.length;if(t>=e)for(var r=n[e-1],i=e;t>=i;i++)n.push(r*i);return n[t]},r.incrementWrap=function(t,r,n){return n=e(n,0),++t,t>r&&(t=n),t},r.isPowerOfTwo=function(t){return 0!==t&&0===(t&t-1)},r.nextPowerOfTwo=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t,t},r.clamp=function(t,e,r){return e>t?e:t>r?r:t};var i=new t;return r.setRandomNumberSeed=function(e){i=new t(e)},r.nextRandomNumber=function(){return i.random()},r.acosClamped=function(t){return Math.acos(r.clamp(t,-1,1))},r.asinClamped=function(t){return Math.asin(r.clamp(t,-1,1))},r.chordLength=function(t,e){return 2*e*Math.sin(.5*t)},r}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,r,n,i){"use strict";var a=function(e,r){this.x=t(e,0),this.y=t(r,0)};a.fromElements=function(t,r,n){return e(n)?(n.x=t,n.y=r,n):new a(t,r)},a.clone=function(t,r){return e(t)?e(r)?(r.x=t.x,r.y=t.y,r):new a(t.x,t.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(e,r,n){n=t(n,0),r[n++]=e.x,r[n]=e.y},a.unpack=function(r,n,i){return n=t(n,0),e(i)||(i=new a),i.x=r[n++],i.y=r[n],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y)},a.minimumComponent=function(t){return Math.min(t.x,t.y)},a.minimumByComponent=function(t,e,r){return r.x=Math.min(t.x,e.x),r.y=Math.min(t.y,e.y),r},a.maximumByComponent=function(t,e,r){return r.x=Math.max(t.x,e.x),r.y=Math.max(t.y,e.y),r},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var r=a.magnitude(t);return e.x=t.x/r,e.y=t.y/r,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y},a.multiplyComponents=function(t,e,r){return r.x=t.x*e.x,r.y=t.y*e.y,r},a.add=function(t,e,r){return r.x=t.x+e.x,r.y=t.y+e.y,r},a.subtract=function(t,e,r){return r.x=t.x-e.x,r.y=t.y-e.y,r},a.multiplyByScalar=function(t,e,r){return r.x=t.x*e,r.y=t.y*e,r},a.divideByScalar=function(t,e,r){return r.x=t.x/e,r.y=t.y/e,r},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e};var u=new a;a.lerp=function(t,e,r,n){return a.multiplyByScalar(e,r,u),n=a.multiplyByScalar(t,1-r,n),a.add(u,n,n)};var s=new a,c=new a;a.angleBetween=function(t,e){return a.normalize(t,s),a.normalize(e,c),i.acosClamped(a.dot(s,c))};var h=new a;return a.mostOrthogonalAxis=function(t,e){var r=a.normalize(t,h);return a.abs(r,r),e=r.x<=r.y?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Y,e)},a.equals=function(t,r){return t===r||e(t)&&e(r)&&t.x===r.x&&t.y===r.y},a.equalsArray=function(t,e,r){return t.x===e[r]&&t.y===e[r+1]},a.equalsEpsilon=function(t,r,n,a){return t===r||e(t)&&e(r)&&i.equalsEpsilon(t.x,r.x,n,a)&&i.equalsEpsilon(t.y,r.y,n,a)},a.ZERO=n(new a(0,0)),a.UNIT_X=n(new a(1,0)),a.UNIT_Y=n(new a(0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,r){return a.equalsEpsilon(this,t,e,r)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,r,n,i){"use strict";var a=function(e,r,n){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0)};a.fromSpherical=function(r,n){e(n)||(n=new a);var i=r.clock,o=r.cone,u=t(r.magnitude,1),s=u*Math.sin(o);return n.x=s*Math.cos(i),n.y=s*Math.sin(i),n.z=u*Math.cos(o),n},a.fromElements=function(t,r,n,i){return e(i)?(i.x=t,i.y=r,i.z=n,i):new a(t,r,n)},a.clone=function(t,r){return e(t)?e(r)?(r.x=t.x,r.y=t.y,r.z=t.z,r):new a(t.x,t.y,t.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(e,r,n){n=t(n,0),r[n++]=e.x,r[n++]=e.y,r[n]=e.z},a.unpack=function(r,n,i){return n=t(n,0),e(i)||(i=new a),i.x=r[n++],i.y=r[n++],i.z=r[n],i},a.fromArray=a.unpack,a.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},a.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},a.minimumByComponent=function(t,e,r){return r.x=Math.min(t.x,e.x),r.y=Math.min(t.y,e.y),r.z=Math.min(t.z,e.z),r},a.maximumByComponent=function(t,e,r){return r.x=Math.max(t.x,e.x),r.y=Math.max(t.y,e.y),r.z=Math.max(t.z,e.z),r},a.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},a.magnitude=function(t){return Math.sqrt(a.magnitudeSquared(t))};var o=new a;a.distance=function(t,e){return a.subtract(t,e,o),a.magnitude(o)},a.distanceSquared=function(t,e){return a.subtract(t,e,o),a.magnitudeSquared(o)},a.normalize=function(t,e){var r=a.magnitude(t);return e.x=t.x/r,e.y=t.y/r,e.z=t.z/r,e},a.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.multiplyComponents=function(t,e,r){return r.x=t.x*e.x,r.y=t.y*e.y,r.z=t.z*e.z,r},a.add=function(t,e,r){return r.x=t.x+e.x,r.y=t.y+e.y,r.z=t.z+e.z,r},a.subtract=function(t,e,r){return r.x=t.x-e.x,r.y=t.y-e.y,r.z=t.z-e.z,r},a.multiplyByScalar=function(t,e,r){return r.x=t.x*e,r.y=t.y*e,r.z=t.z*e,r},a.divideByScalar=function(t,e,r){return r.x=t.x/e,r.y=t.y/e,r.z=t.z/e,r},a.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},a.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};var u=new a;a.lerp=function(t,e,r,n){return a.multiplyByScalar(e,r,u),n=a.multiplyByScalar(t,1-r,n),a.add(u,n,n)};var s=new a,c=new a;a.angleBetween=function(t,e){a.normalize(t,s),a.normalize(e,c);var r=a.dot(s,c),n=a.magnitude(a.cross(s,c,s));return Math.atan2(n,r)};var h=new a;a.mostOrthogonalAxis=function(t,e){var r=a.normalize(t,h);return a.abs(r,r),e=r.x<=r.y?r.x<=r.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):r.y<=r.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.equals=function(t,r){return t===r||e(t)&&e(r)&&t.x===r.x&&t.y===r.y&&t.z===r.z},a.equalsArray=function(t,e,r){return t.x===e[r]&&t.y===e[r+1]&&t.z===e[r+2]},a.equalsEpsilon=function(t,r,n,a){return t===r||e(t)&&e(r)&&i.equalsEpsilon(t.x,r.x,n,a)&&i.equalsEpsilon(t.y,r.y,n,a)&&i.equalsEpsilon(t.z,r.z,n,a)},a.cross=function(t,e,r){var n=t.x,i=t.y,a=t.z,o=e.x,u=e.y,s=e.z,c=i*s-a*u,h=a*o-n*s,d=n*u-i*o;return r.x=c,r.y=h,r.z=d,r},a.fromDegrees=function(t,e,r,n,o){var u=i.toRadians(t),s=i.toRadians(e);return a.fromRadians(u,s,r,n,o)};var d=new a,f=new a,l=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(r,n,i,o,u){i=t(i,0);var s=e(o)?o.radiiSquared:l,c=Math.cos(n);d.x=c*Math.cos(r),d.y=c*Math.sin(r),d.z=Math.sin(n),d=a.normalize(d,d),a.multiplyComponents(s,d,f);var h=Math.sqrt(a.dot(d,f));return f=a.divideByScalar(f,h,f),d=a.multiplyByScalar(d,i,d),e(u)||(u=new a),a.add(f,d,u)},a.fromDegreesArray=function(t,e,r){for(var n=new Array(t.length),o=0;o<t.length;o++)n[o]=i.toRadians(t[o]);return a.fromRadiansArray(n,e,r)},a.fromRadiansArray=function(t,r,n){var i=t.length;e(n)?n.length=i/2:n=new Array(i/2);for(var o=0;i>o;o+=2){var u=t[o],s=t[o+1];n[o/2]=a.fromRadians(u,s,0,r,n[o/2])}return n},a.fromDegreesArrayHeights=function(t,e,r){for(var n=new Array(t.length),o=0;o<t.length;o+=3)n[o]=i.toRadians(t[o]),n[o+1]=i.toRadians(t[o+1]),n[o+2]=t[o+2];return a.fromRadiansArrayHeights(n,e,r)},a.fromRadiansArrayHeights=function(t,r,n){var i=t.length;e(n)?n.length=i/3:n=new Array(i/3);for(var o=0;i>o;o+=3){var u=t[o],s=t[o+1],c=t[o+2];n[o/3]=a.fromRadians(u,s,c,r,n[o/3])}return n},a.ZERO=n(new a(0,0,0)),a.UNIT_X=n(new a(1,0,0)),a.UNIT_Y=n(new a(0,1,0)),a.UNIT_Z=n(new a(0,0,1)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e,r){return a.equalsEpsilon(this,t,e,r)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(t,e,r,n,i){"use strict";var a={};a.octEncode=function(t,e){if(e.x=t.x/(Math.abs(t.x)+Math.abs(t.y)+Math.abs(t.z)),e.y=t.y/(Math.abs(t.x)+Math.abs(t.y)+Math.abs(t.z)),t.z<0){var r=e.x,n=e.y;e.x=(1-Math.abs(n))*i.signNotZero(r),e.y=(1-Math.abs(r))*i.signNotZero(n)}return e.x=i.toSNorm(e.x),e.y=i.toSNorm(e.y),e},a.octDecode=function(t,r,n){if(n.x=i.fromSNorm(t),n.y=i.fromSNorm(r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var a=n.x;n.x=(1-Math.abs(n.y))*i.signNotZero(a),n.y=(1-Math.abs(a))*i.signNotZero(n.y)}return e.normalize(n,n)},a.octPackFloat=function(t){return 256*t.x+t.y};var o=new t;return a.octEncodeFloat=function(t){return a.octEncode(t,o),a.octPackFloat(o)},a.octDecodeFloat=function(t,e){var r=t/256,n=Math.floor(r),i=256*(r-n);return a.octDecode(n,i,e)},a.octPack=function(t,e,r,n){var i=a.octEncodeFloat(t),u=a.octEncodeFloat(e),s=a.octEncode(r,o);return n.x=65536*s.x+i,n.y=65536*s.y+u,n},a.octUnpack=function(t,e,r,n){var i=t.x/65536,o=Math.floor(i),u=65536*(i-o);i=t.y/65536;var s=Math.floor(i),c=65536*(i-s);a.octDecodeFloat(u,e),a.octDecodeFloat(c,r),a.octDecode(o,s,n)},a.compressTextureCoordinates=function(t){var e=1===t.x?4095:0|4096*t.x,r=1===t.y?4095:0|4096*t.y;return 4096*e+r},a.decompressTextureCoordinates=function(t,e){var r=t/4096;return e.x=Math.floor(r)/4096,e.y=r-Math.floor(r),e},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,r,n,i){"use strict";var a=function(e,r,n){this.longitude=t(e,0),this.latitude=t(r,0),this.height=t(n,0)};return a.fromRadians=function(r,n,i,o){return i=t(i,0),e(o)?(o.longitude=r,o.latitude=n,o.height=i,o):new a(r,n,i)},a.fromDegrees=function(t,e,r,n){return t=i.toRadians(t),e=i.toRadians(e),a.fromRadians(t,e,r,n)},a.clone=function(t,r){return e(t)?e(r)?(r.longitude=t.longitude,r.latitude=t.latitude,r.height=t.height,r):new a(t.longitude,t.latitude,t.height):void 0},a.equals=function(t,r){return t===r||e(t)&&e(r)&&t.longitude===r.longitude&&t.latitude===r.latitude&&t.height===r.height},a.equalsEpsilon=function(t,r,n){return t===r||e(t)&&e(r)&&Math.abs(t.longitude-r.longitude)<=n&&Math.abs(t.latitude-r.latitude)<=n&&Math.abs(t.height-r.height)<=n},a.ZERO=n(new a(0,0,0)),a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},a.prototype.equalsEpsilon=function(t,e){return a.equalsEpsilon(this,t,e)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/defineProperties",["./defined"],function(t){"use strict";var e=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(t){return!1}}(),r=Object.defineProperties;return e&&t(r)||(r=function(t){return t}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(t,e,r,n,i,a,o,u){"use strict";function s(e,n,i,a){n=r(n,0),i=r(i,0),a=r(a,0),e._radii=new t(n,i,a),e._radiiSquared=new t(n*n,i*i,a*a),e._radiiToTheFourth=new t(n*n*n*n,i*i*i*i,a*a*a*a),e._oneOverRadii=new t(0===n?0:1/n,0===i?0:1/i,0===a?0:1/a),e._oneOverRadiiSquared=new t(0===n?0:1/(n*n),0===i?0:1/(i*i),0===a?0:1/(a*a)),e._minimumRadius=Math.min(n,i,a),e._maximumRadius=Math.max(n,i,a),e._centerToleranceSquared=u.EPSILON1}var c=function(t,e,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,t,e,r)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(e,r){if(!n(e))return void 0;var i=e._radii;return n(r)?(t.clone(i,r._radii),t.clone(e._radiiSquared,r._radiiSquared),t.clone(e._radiiToTheFourth,r._radiiToTheFourth),t.clone(e._oneOverRadii,r._oneOverRadii),t.clone(e._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=e._minimumRadius,r._maximumRadius=e._maximumRadius,r._centerToleranceSquared=e._centerToleranceSquared,r):new c(i.x,i.y,i.z)},c.fromCartesian3=function(t,e){return n(e)||(e=new c),n(t)?(s(e,t.x,t.y,t.z),e):e},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(t){return c.clone(this,t)},c.packedLength=t.packedLength,c.pack=function(e,n,i){i=r(i,0),t.pack(e._radii,n,i)},c.unpack=function(e,n,i){n=r(n,0);var a=t.unpack(e,n);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=t.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(e,r){var i=e.longitude,a=e.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return n(r)||(r=new t),r.x=u,r.y=s,r.z=c,t.normalize(r,r)},c.prototype.geodeticSurfaceNormal=function(e,r){return n(r)||(r=new t),r=t.multiplyComponents(e,this._oneOverRadiiSquared,r),t.normalize(r,r)};var h=new t,d=new t;c.prototype.cartographicToCartesian=function(e,r){var i=h,a=d;this.geodeticSurfaceNormalCartographic(e,i),t.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(t.dot(i,a));return t.divideByScalar(a,o,a),t.multiplyByScalar(i,e.height,i),n(r)||(r=new t),t.add(a,i,r)},c.prototype.cartographicArrayToCartesianArray=function(t,e){var r=t.length;n(e)?e.length=r:e=new Array(r);for(var i=0;r>i;i++)e[i]=this.cartographicToCartesian(t[i],e[i]);return e};var f=new t,l=new t,m=new t;c.prototype.cartesianToCartographic=function(r,i){var a=this.scaleToGeodeticSurface(r,l);if(!n(a))return void 0;var o=this.geodeticSurfaceNormal(a,f),s=t.subtract(r,a,m),c=Math.atan2(o.y,o.x),h=Math.asin(o.z),d=u.sign(t.dot(s,r))*t.magnitude(s);return n(i)?(i.longitude=c,i.latitude=h,i.height=d,i):new e(c,h,d)},c.prototype.cartesianArrayToCartographicArray=function(t,e){var r=t.length;n(e)?e.length=r:e=new Array(r);for(var i=0;r>i;++i)e[i]=this.cartesianToCartographic(t[i],e[i]);return e};var y=new t,p=new t;return c.prototype.scaleToGeodeticSurface=function(e,r){var i=e.x,a=e.y,o=e.z,s=this._oneOverRadii,c=s.x,h=s.y,d=s.z,f=i*i*c*c,l=a*a*h*h,m=o*o*d*d,x=f+l+m,g=Math.sqrt(1/x),v=t.multiplyByScalar(e,g,y);if(x<this._centerToleranceSquared)return isFinite(g)?t.clone(v,r):void 0;var E=this._oneOverRadiiSquared,S=E.x,_=E.y,M=E.z,I=p;I.x=2*v.x*S,I.y=2*v.y*_,I.z=2*v.z*M;var R,w,N,T,z,O,P,A,C,q,b,D=(1-g)*t.magnitude(e)/(.5*t.magnitude(I)),L=0;do{D-=L,N=1/(1+D*S),T=1/(1+D*_),z=1/(1+D*M),O=N*N,P=T*T,A=z*z,C=O*N,q=P*T,b=A*z,R=f*O+l*P+m*A-1,w=f*C*S+l*q*_+m*b*M;var U=-2*w;L=R/U}while(Math.abs(R)>u.EPSILON12);return n(r)?(r.x=i*N,r.y=a*T,r.z=o*z,r):new t(i*N,a*T,o*z)},c.prototype.scaleToGeocentricSurface=function(e,r){n(r)||(r=new t);var i=e.x,a=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return t.multiplyByScalar(e,s,r)},c.prototype.transformPositionToScaledSpace=function(e,r){return n(r)||(r=new t),t.multiplyComponents(e,this._oneOverRadii,r)},c.prototype.transformPositionFromScaledSpace=function(e,r){return n(r)||(r=new t),t.multiplyComponents(e,this._radii,r)},c.prototype.equals=function(e){return this===e||n(e)&&t.equals(this._radii,e._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(t,e,r,n){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(t){switch(t){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(e){return t(e)&&(e===i.UNSIGNED_BYTE||e===i.UNSIGNED_SHORT||e===i.UNSIGNED_INT)},i.createTypedArray=function(t,e){return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(e):new Uint16Array(e)},i.createTypedArrayFromArrayBuffer=function(t,e,r,i){return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(e,r,i):new Uint16Array(e,r,i)},r(i)}),define("Core/formatError",["./defined"],function(t){"use strict";var e=function(e){var r,n=e.name,i=e.message;r=t(n)&&t(i)?n+": "+i:e.toString();var a=e.stack;return t(a)&&(r+="\n"+a),r};return e}),define("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(t,e,r){"use strict";var n=function(n){var i,a=[],o={id:void 0,result:void 0,error:void 0};return function(u){var s=u.data;a.length=0,o.id=s.id,o.error=void 0,o.result=void 0;try{o.result=n(s.parameters,a)}catch(c){o.error=c instanceof Error?{name:c.name,message:c.message,stack:c.stack}:c}e(i)||(i=t(self.webkitPostMessage,self.postMessage)),s.canTransferArrayBuffer||(a.length=0);try{i(o,a)}catch(c){o.result=void 0,o.error="postMessage failed with error: "+r(c)+"\n with responseMessage: "+JSON.stringify(o),i(o)}}};return n}),define("Workers/createVerticesFromQuantizedTerrainMesh",["../Core/AttributeCompression","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/defined","../Core/Ellipsoid","../Core/IndexDatatype","../Core/Math","./createTaskProcessorWorker"],function(t,e,r,n,i,a,o,u,s){"use strict";function c(e,r){var n=e.quantizedVertices,s=n.length/3,c=e.octEncodedNormals,_=e.westIndices.length+e.eastIndices.length+e.southIndices.length+e.northIndices.length,M=e.minimumHeight,I=e.maximumHeight,R=e.relativeToCenter,w=e.rectangle,N=w.west,T=w.south,z=w.east,O=w.north,P=a.clone(e.ellipsoid),A=n.subarray(0,s),C=n.subarray(s,2*s),q=n.subarray(2*s,3*s),b=i(c),D=6;b&&(D+=1);for(var L=new Float32Array(s*D+_*D),U=0,k=0,B=0;s>U;++U,k+=D,B+=2){var F=A[U]/d,G=C[U]/d,W=u.lerp(M,I,q[U]/d);E.longitude=u.lerp(N,z,F),E.latitude=u.lerp(T,O,G),E.height=W,P.cartographicToCartesian(E,v),L[k+f]=v.x-R.x,L[k+l]=v.y-R.y,L[k+m]=v.z-R.z,L[k+y]=W,L[k+p]=F,L[k+x]=G,b&&(S.x=c[B],S.y=c[B+1],L[k+g]=t.octPackFloat(S))}var V=Math.max(0,2*(_-4)),Y=e.indices.length+3*V,H=o.createTypedArray(s+_,Y);H.set(e.indices,0);var K=s*D,Z=e.indices.length;return Z=h(L,K,H,Z,e.westIndices,R,P,w,e.westSkirtHeight,!0,b),K+=e.westIndices.length*D,Z=h(L,K,H,Z,e.southIndices,R,P,w,e.southSkirtHeight,!1,b),K+=e.southIndices.length*D,Z=h(L,K,H,Z,e.eastIndices,R,P,w,e.eastSkirtHeight,!1,b),K+=e.eastIndices.length*D,Z=h(L,K,H,Z,e.northIndices,R,P,w,e.northSkirtHeight,!0,b),K+=e.northIndices.length*D,r.push(L.buffer,H.buffer),{vertices:L.buffer,indices:H.buffer}}function h(t,e,n,i,a,o,s,c,h,d,f){var l,m,S,_=6;f&&(_+=1),d?(l=a.length-1,m=-1,S=-1):(l=0,m=a.length,S=1);var M=-1,I=e/_,R=c.north,w=c.south,N=c.east,T=c.west;T>N&&(N+=u.TWO_PI);for(var z=l;z!==m;z+=S){var O=a[z],P=O*_,A=t[P+p],C=t[P+x],q=t[P+y];E.longitude=u.lerp(T,N,A),E.latitude=u.lerp(w,R,C),E.height=q-h;var b=s.cartographicToCartesian(E,v);r.subtract(b,o,b),t[e++]=b.x,t[e++]=b.y,t[e++]=b.z,t[e++]=E.height,t[e++]=A,t[e++]=C,f&&(t[e++]=t[P+g]),-1!==M&&(n[i++]=M,n[i++]=I-1,n[i++]=O,n[i++]=I-1,n[i++]=I,n[i++]=O),M=O,++I}return i}var d=32767,f=0,l=1,m=2,y=3,p=4,x=5,g=6,v=new r,E=new n,S=new e;return s(c)})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createWallGeometry.js b/libs/Cesium/Workers/createWallGeometry.js deleted file mode 100644 index 5322212b..00000000 --- a/libs/Cesium/Workers/createWallGeometry.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,a){a=t(a,r);var i=Math.abs(e-n);return a>=i||i<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],a=t;e>=a;a++)r.push(n*a);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var a=new e;return n.setRandomNumberSeed=function(t){a=new e(t)},n.nextRandomNumber=function(){return a.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};i.fromSpherical=function(n,r){t(r)||(r=new i);var a=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(a),r.y=s*Math.sin(a),r.z=u*Math.cos(o),r},i.fromElements=function(e,n,r,a){return t(a)?(a.x=e,a.y=n,a.z=r,a):new i(e,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new i(e.x,e.y,e.z):void 0},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){i.normalize(e,s),i.normalize(t,c);var n=i.dot(s,c),r=i.magnitude(i.cross(s,c,s));return Math.atan2(r,n)};var l=new i;i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Z,t):n.y<=n.z?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_Z,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)},i.cross=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=t.x,u=t.y,s=t.z,c=a*s-i*u,l=i*o-r*s,f=r*u-a*o;return n.x=c,n.y=l,n.z=f,n},i.fromDegrees=function(e,t,n,r,o){var u=a.toRadians(e),s=a.toRadians(t);return i.fromRadians(u,s,n,r,o)};var f=new i,d=new i,h=new i(40680631590769,40680631590769,40408299984661.445);return i.fromRadians=function(n,r,a,o,u){a=e(a,0);var s=t(o)?o.radiiSquared:h,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=i.normalize(f,f),i.multiplyComponents(s,f,d);var l=Math.sqrt(i.dot(f,d));return d=i.divideByScalar(d,l,d),f=i.multiplyByScalar(f,a,f),t(u)||(u=new i),i.add(d,f,u)},i.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=a.toRadians(e[o]);return i.fromRadiansArray(r,t,n)},i.fromRadiansArray=function(e,n,r){var a=e.length;t(r)?r.length=a/2:r=new Array(a/2);for(var o=0;a>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=i.fromRadians(u,s,0,n,r[o/2])}return r},i.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=a.toRadians(e[o]),r[o+1]=a.toRadians(e[o+1]),r[o+2]=e[o+2];return i.fromRadiansArrayHeights(r,t,n)},i.fromRadiansArrayHeights=function(e,n,r){var a=e.length;t(r)?r.length=a/3:r=new Array(a/3);for(var o=0;a>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=i.fromRadians(u,s,c,n,r[o/3])}return r},i.ZERO=r(new i(0,0,0)),i.UNIT_X=r(new i(1,0,0)),i.UNIT_Y=r(new i(0,1,0)),i.UNIT_Z=r(new i(0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return i.fromRadians=function(n,r,a,o){return a=e(a,0),t(o)?(o.longitude=n,o.latitude=r,o.height=a,o):new i(n,r,a)},i.fromDegrees=function(e,t,n,r){return e=a.toRadians(e),t=a.toRadians(t),i.fromRadians(e,t,n,r)},i.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new i(e.longitude,e.latitude,e.height):void 0},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},i.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},i.ZERO=r(new i(0,0,0)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t){return i.equalsEpsilon(this,e,t)},i.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},i}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(t,r,a,i){r=n(r,0),a=n(a,0),i=n(i,0),t._radii=new e(r,a,i),t._radiiSquared=new e(r*r,a*a,i*i),t._radiiToTheFourth=new e(r*r*r*r,a*a*a*a,i*i*i*i),t._oneOverRadii=new e(0===r?0:1/r,0===a?0:1/a,0===i?0:1/i),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===a?0:1/(a*a),0===i?0:1/(i*i)),t._minimumRadius=Math.min(r,a,i),t._maximumRadius=Math.max(r,a,i),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};a(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var a=t._radii;return r(n)?(e.clone(a,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(a.x,a.y,a.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,a){a=n(a,0),e.pack(t._radii,r,a)},c.unpack=function(t,r,a){r=n(r,0);var i=e.unpack(t,r);return c.fromCartesian3(i,a)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var a=t.longitude,i=t.latitude,o=Math.cos(i),u=o*Math.cos(a),s=o*Math.sin(a),c=Math.sin(i);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,n){var a=l,i=f;this.geodeticSurfaceNormalCartographic(t,a),e.multiplyComponents(this._radiiSquared,a,i);var o=Math.sqrt(e.dot(a,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(a,t.height,a),r(n)||(n=new e),e.add(i,a,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;a++)t[a]=this.cartographicToCartesian(e[a],t[a]);return t};var d=new e,h=new e,m=new e;c.prototype.cartesianToCartographic=function(n,a){var i=this.scaleToGeodeticSurface(n,h);if(!r(i))return void 0;var o=this.geodeticSurfaceNormal(i,d),s=e.subtract(n,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,n))*e.magnitude(s);return r(a)?(a.longitude=c,a.latitude=l,a.height=f,a):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var a=0;n>a;++a)t[a]=this.cartesianToCartographic(e[a],t[a]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var a=t.x,i=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,d=a*a*c*c,h=i*i*l*l,m=o*o*f*f,v=d+h+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,_=x.z,O=y;O.x=2*w.x*E,O.y=2*w.y*S,O.z=2*w.z*_;var M,P,T,R,N,C,I,z,A,b,D,q=(1-g)*e.magnitude(t)/(.5*e.magnitude(O)),U=0;do{q-=U,T=1/(1+q*E),R=1/(1+q*S),N=1/(1+q*_),C=T*T,I=R*R,z=N*N,A=C*T,b=I*R,D=z*N,M=d*C+h*I+m*z-1,P=d*A*E+h*b*S+m*D*_;var L=-2*P;U=M/L}while(Math.abs(M)>u.EPSILON12);return r(n)?(n.x=a*T,n.y=i*R,n.z=o*N,n):new e(a*T,i*R,o*N)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var a=t.x,i=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+i*i*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,a,i,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return r(n)?(n.x=i,n.y=o,n.z=u,n):new e(i,o,u)},u.prototype.unproject=function(e,n){var a=this._oneOverSemimajorAxis,i=e.x*a,o=e.y*a,u=e.z;return r(n)?(n.longitude=i,n.latitude=o,n.height=u,n):new t(i,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n,r,a){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(a,0)};i.fromElements=function(e,n,r,a,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=a,o):new i(e,n,r,a)},i.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new i(e.red,e.green,e.blue,e.alpha)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new i(e.x,e.y,e.z,e.w):void 0},i.packedLength=4,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r++],a.z=n[r++],a.w=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},i.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,s);return i.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?i.clone(i.UNIT_X,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t):n.y<=n.z?n.y<=n.w?i.clone(i.UNIT_Y,t):i.clone(i.UNIT_W,t):n.z<=n.w?i.clone(i.UNIT_Z,t):i.clone(i.UNIT_W,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)&&a.equalsEpsilon(e.z,n.z,r,i)&&a.equalsEpsilon(e.w,n.w,r,i)},i.ZERO=r(new i(0,0,0,0)),i.UNIT_X=r(new i(1,0,0,0)),i.UNIT_Y=r(new i(0,1,0,0)),i.UNIT_Z=r(new i(0,0,1,0)),i.UNIT_W=r(new i(0,0,0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a,i){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(h[n],d[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=i.EPSILON15,r=0,a=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(h[o],d[o])]);u>r&&(a=o,r=u)}var s=1,l=0,f=d[a],m=h[a];if(Math.abs(e[c.getElementIndex(m,f)])>n){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,n,r,a,i,o,u,s,c){this[0]=t(e,0),this[1]=t(a,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(i,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r++],a[1]=e[r++],a[2]=e[r++],a[3]=e[r++],a[4]=e[r++],a[5]=e[r++],a[6]=e[r++],a[7]=e[r++],a[8]=e[r++],a},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,a){return r=t(r,0),n(a)||(a=new c),a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],a[4]=e[r+4],a[5]=e[r+5],a[6]=e[r+6],a[7]=e[r+7],a[8]=e[r+8],a},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,a=e.x*e.y,i=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,d=e.z*e.w,h=e.w*e.w,m=r-u-f+h,p=2*(a-d),y=2*(i+l),v=2*(a+d),g=-r+u-f+h,w=2*(s-o),x=2*(i-l),E=2*(s+o),S=-r-u+f+h;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(m,p,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=a,t[6]=0,t[7]=-a,t[8]=r,t):new c(1,0,0,0,r,-a,0,a,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-a,t[3]=0,t[4]=1,t[5]=0,t[6]=a,t[7]=0,t[8]=r,t):new c(r,0,a,0,1,0,-a,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),a=Math.sin(e);return n(t)?(t[0]=r,t[1]=a,t[2]=0,t[3]=-a,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-a,0,a,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,a=e[r],i=e[r+1],o=e[r+2];return n.x=a,n.y=i,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=3*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],a=e[t+3],i=e[t+6];return n.x=r,n.y=a,n.z=i,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],a=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],i=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=a,n[2]=i,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[3]*a+e[6]*i,u=e[1]*r+e[4]*a+e[7]*i,s=e[2]*r+e[5]*a+e[8]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=a,t[3]=i,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var d=[1,0,0],h=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var r=i.EPSILON20,a=10,l=0,f=0;n(t)||(t={});for(var d=t.unitary=c.clone(c.IDENTITY,t.unitary),h=t.diagonal=c.clone(e,t.diagonal),y=r*o(h);a>f&&u(h)>y;)s(h,m),c.transpose(m,p),c.multiply(h,m,h),c.multiply(p,h,h),c.multiply(d,m,d),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],a=e[1],i=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(i*c-s*o)+a*(s*r-n*c)+u*(n*o-i*r)},c.inverse=function(e,t){var n=e[0],a=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],d=e[7],h=e[8],m=c.determinant(e);if(Math.abs(m)<=i.EPSILON15)throw new r("matrix is not invertible");t[0]=s*h-d*l,t[1]=d*o-a*h,t[2]=a*l-s*o,t[3]=f*l-u*h,t[4]=n*h-f*o,t[5]=u*o-n*l,t[6]=u*d-f*s,t[7]=f*a-n*d,t[8]=n*s-u*a;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=a(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,a,i,o,u,s){"use strict";var c=function(e,t,r,a,i,o,u,s,c,l,f,d,h,m,p,y){this[0]=n(e,0),this[1]=n(i,0),this[2]=n(c,0),this[3]=n(h,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(p,0),this[12]=n(a,0),this[13]=n(s,0),this[14]=n(d,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,a){return t=n(t,0),r(a)||(a=new c),a[0]=e[t++],a[1]=e[t++],a[2]=e[t++],a[3]=e[t++],a[4]=e[t++],a[5]=e[t++],a[6]=e[t++],a[7]=e[t++],a[8]=e[t++],a[9]=e[t++],a[10]=e[t++],a[11]=e[t++],a[12]=e[t++],a[13]=e[t++],a[14]=e[t++],a[15]=e[t],a},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,a,i){return a=n(a,e.ZERO),r(i)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=0,i[4]=t[3],i[5]=t[4],i[6]=t[5],i[7]=0,i[8]=t[6],i[9]=t[7],i[10]=t[8],i[11]=0,i[12]=a.x,i[13]=a.y,i[14]=a.z,i[15]=1,i):new c(t[0],t[3],t[6],a.x,t[1],t[4],t[7],a.y,t[2],t[5],t[8],a.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,a){r(a)||(a=new c);var i=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,d=t.x*t.w,h=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-h-y+g,x=2*(l-v),E=2*(f+p),S=2*(l+v),_=-s+h-y+g,O=2*(m-d),M=2*(f-p),P=2*(m+d),T=-s-h+y+g;return a[0]=w*i,a[1]=S*i,a[2]=M*i,a[3]=0,a[4]=x*o,a[5]=_*o,a[6]=P*o,a[7]=0,a[8]=E*u,a[9]=O*u,a[10]=T*u,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,a},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,d=new e;c.fromCamera=function(t,n){var a=t.eye,i=t.target,o=t.up;e.normalize(e.subtract(i,a,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,d),d);var u=f.x,s=f.y,h=f.z,m=l.x,p=l.y,y=l.z,v=d.x,g=d.y,w=d.z,x=a.x,E=a.y,S=a.z,_=u*-x+s*-E+h*-S,O=v*-x+g*-E+w*-S,M=m*x+p*E+y*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=g,n[6]=-p,n[7]=0,n[8]=h,n[9]=w,n[10]=-y,n[11]=0,n[12]=_,n[13]=O,n[14]=M,n[15]=1,n):new c(u,s,h,_,v,g,w,O,-m,-p,-y,M,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,a){var i=Math.tan(.5*e),o=1/i,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return a[0]=u,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=s,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},c.computeOrthographicOffCenter=function(e,t,n,r,a,i,o){var u=1/(t-e),s=1/(r-n),c=1/(i-a),l=-(t+e)*u,f=-(r+n)*s,d=-(i+a)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=d,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,n,r,a,i,o){var u=2*a/(t-e),s=2*a/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),f=-(i+a)/(i-a),d=-1,h=-2*i*a/(i-a);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=d,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,a,i){var o=2*a/(t-e),u=2*a/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,f=-1,d=-2*a;return i[0]=o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=s,i[9]=c,i[10]=l,i[11]=f,i[12]=0,i[13]=0,i[14]=d,i[15]=0,i},c.computeViewportTransformation=function(e,t,r,a){e=n(e,n.EMPTY_OBJECT);var i=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-t),d=c,h=l,m=f,p=i+c,y=o+l,v=t+f,g=1;return a[0]=d,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=m,a[11]=0,a[12]=p,a[13]=y,a[14]=v,a[15]=g,a},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,a=e[r],i=e[r+1],o=e[r+2],u=e[r+3];return n.x=a,n.y=i,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var a=4*t;return r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z,r[a+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],a=e[t+4],i=e[t+8],o=e[t+12];return n.x=r,n.y=a,n.z=i,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var h=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],_=t[4],O=t[5],M=t[6],P=t[7],T=t[8],R=t[9],N=t[10],C=t[11],I=t[12],z=t[13],A=t[14],b=t[15],D=r*w+u*x+f*E+p*S,q=a*w+s*x+d*E+y*S,U=i*w+c*x+h*E+v*S,L=o*w+l*x+m*E+g*S,B=r*_+u*O+f*M+p*P,W=a*_+s*O+d*M+y*P,F=i*_+c*O+h*M+v*P,G=o*_+l*O+m*M+g*P,k=r*T+u*R+f*N+p*C,Y=a*T+s*R+d*N+y*C,j=i*T+c*R+h*N+v*C,H=o*T+l*R+m*N+g*C,V=r*I+u*z+f*A+p*b,Z=a*I+s*z+d*A+y*b,X=i*I+c*z+h*A+v*b,J=o*I+l*z+m*A+g*b;return n[0]=D,n[1]=q,n[2]=U,n[3]=L,n[4]=B,n[5]=W,n[6]=F,n[7]=G,n[8]=k,n[9]=Y,n[10]=j,n[11]=H,n[12]=V,n[13]=Z,n[14]=X,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=e[12],h=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],_=t[10],O=t[12],M=t[13],P=t[14],T=r*p+o*y+c*v,R=a*p+u*y+l*v,N=i*p+s*y+f*v,C=r*g+o*w+c*x,I=a*g+u*w+l*x,z=i*g+s*w+f*x,A=r*E+o*S+c*_,b=a*E+u*S+l*_,D=i*E+s*S+f*_,q=r*O+o*M+c*P+d,U=a*O+u*M+l*P+h,L=i*O+s*M+f*P+m;return n[0]=T,n[1]=R,n[2]=N,n[3]=0,n[4]=C,n[5]=I,n[6]=z,n[7]=0,n[8]=A,n[9]=b,n[10]=D,n[11]=0,n[12]=q,n[13]=U,n[14]=L,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],a=e[1],i=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],d=t[0],h=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=r*d+o*h+c*m,S=a*d+u*h+l*m,_=i*d+s*h+f*m,O=r*p+o*y+c*v,M=a*p+u*y+l*v,P=i*p+s*y+f*v,T=r*g+o*w+c*x,R=a*g+u*w+l*x,N=i*g+s*w+f*x;return n[0]=E,n[1]=S,n[2]=_,n[3]=0,n[4]=O,n[5]=M,n[6]=P,n[7]=0,n[8]=T,n[9]=R,n[10]=N,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=r*e[0]+a*e[4]+i*e[8]+e[12],u=r*e[1]+a*e[5]+i*e[9]+e[13],s=r*e[2]+a*e[6]+i*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var p=new e;c.multiplyByUniformScale=function(e,t,n){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,n)},c.multiplyByScale=function(e,t,n){var r=t.x,a=t.y,i=t.z;return 1===r&&1===a&&1===i?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=a*e[4],n[5]=a*e[5],n[6]=a*e[6],n[7]=0,n[8]=i*e[8],n[9]=i*e[9],n[10]=i*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=t.w,u=e[0]*r+e[4]*a+e[8]*i+e[12]*o,s=e[1]*r+e[5]*a+e[9]*i+e[13]*o,c=e[2]*r+e[6]*a+e[10]*i+e[14]*o,l=e[3]*r+e[7]*a+e[11]*i+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i,u=e[1]*r+e[5]*a+e[9]*i,s=e[2]*r+e[6]*a+e[10]*i;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,a=t.y,i=t.z,o=e[0]*r+e[4]*a+e[8]*i+e[12],u=e[1]*r+e[5]*a+e[9]*i+e[13],s=e[2]*r+e[6]*a+e[10]*i+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],a=e[3],i=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[10]=e[10],t[11]=e[14],t[12]=a,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],a=e[4],i=e[8],l=e[12],f=e[1],d=e[5],h=e[9],m=e[13],p=e[2],x=e[6],E=e[10],S=e[14],_=e[3],O=e[7],M=e[11],P=e[15],T=E*P,R=S*M,N=x*P,C=S*O,I=x*M,z=E*O,A=p*P,b=S*_,D=p*M,q=E*_,U=p*O,L=x*_,B=T*d+C*h+I*m-(R*d+N*h+z*m),W=R*f+A*h+q*m-(T*f+b*h+D*m),F=N*f+b*d+U*m-(C*f+A*d+L*m),G=z*f+D*d+L*h-(I*f+q*d+U*h),k=R*a+N*i+z*l-(T*a+C*i+I*l),Y=T*r+b*i+D*l-(R*r+A*i+q*l),j=C*r+A*a+L*l-(N*r+b*a+U*l),H=I*r+q*a+U*i-(z*r+D*a+L*i);T=i*m,R=l*h,N=a*m,C=l*d,I=a*h,z=i*d,A=r*m,b=l*f,D=r*h,q=i*f,U=r*d,L=a*f;var V=T*O+C*M+I*P-(R*O+N*M+z*P),Z=R*_+A*M+q*P-(T*_+b*M+D*P),X=N*_+b*O+U*P-(C*_+A*O+L*P),J=z*_+D*O+L*M-(I*_+q*O+U*M),K=N*E+z*S+R*x-(I*S+T*x+C*E),Q=D*S+T*p+b*E-(A*E+q*S+R*p),$=A*x+L*S+C*p-(U*S+N*p+b*x),et=U*E+I*p+q*x-(D*x+L*E+z*p),tt=r*B+a*W+i*F+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=B*tt,n[1]=W*tt,n[2]=F*tt,n[3]=G*tt,n[4]=k*tt,n[5]=Y*tt,n[6]=j*tt,n[7]=H*tt,n[8]=V*tt,n[9]=Z*tt,n[10]=X*tt,n[11]=J*tt,n[12]=K*tt,n[13]=Q*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],a=e[2],i=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],d=e[13],h=e[14],m=-n*f-r*d-a*h,p=-i*f-o*d-u*h,y=-s*f-c*d-l*h;return t[0]=n,t[1]=i,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=a,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=i(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t,n){this.normal=e.clone(t),this.distance=n};a.fromPointNormal=function(n,r,i){var o=-e.dot(r,n);return t(i)?(e.clone(r,i.normal),i.distance=o,i):new a(r,o)};var i=new e;return a.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,i),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new a(o,u)},a.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},a.ORIGIN_XY_PLANE=r(new a(e.UNIT_Z,0)),a.ORIGIN_YZ_PLANE=r(new a(e.UNIT_X,0)),a.ORIGIN_ZX_PLANE=r(new a(e.UNIT_Y,0)),a}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(a,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.west=e[r++],a.south=e[r++],a.east=e[r++],a.north=e[r],a},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,a,i,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),a=u.toRadians(t(a,0)),i=u.toRadians(t(i,0)),n(o)?(o.west=e,o.south=r,o.east=a,o.north=i,o):new s(e,r,a,i)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,a=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),a=Math.max(a,l.longitude),i=Math.min(i,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=i,t.east=a,t.north=o,t):new s(r,i,a,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var a=t.east,i=t.west;i>a&&(a+=u.TWO_PI);var o=u.negativePiToPi(.5*(i+a)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var a=e.east,i=e.west,o=t.east,c=t.west;i>a&&o>0?a+=u.TWO_PI:c>o&&a>0&&(o+=u.TWO_PI),i>a&&0>c?c+=u.TWO_PI:c>o&&0>i&&(i+=u.TWO_PI);var l=u.negativePiToPi(Math.max(i,c)),f=u.negativePiToPi(Math.min(a,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var d=Math.max(e.south,t.south),h=Math.min(e.north,t.north);return d>=h?void 0:n(r)?(r.west=l,r.south=d,r.east=f,r.north=h,r):new s(l,d,f,h)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,a=e.west,i=e.east;return a>i&&(i+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>a||u.equalsEpsilon(n,a,u.EPSILON14))&&(i>n||u.equalsEpsilon(n,i,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,a,o){r=t(r,i.WGS84),a=t(a,0),n(o)||(o=[]);var l=0,f=e.north,d=e.south,h=e.east,m=e.west,p=c;p.height=a,p.longitude=m,p.latitude=f,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=0>f?f:d>0?d:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=r.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,a,i,o,u,s,c,l,f,d){"use strict";var h=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,_=new e,O=new e,M=new e;h.fromPoints=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var a=e.clone(t[0],x),i=e.clone(a,m),o=e.clone(a,p),u=e.clone(a,y),s=e.clone(a,v),c=e.clone(a,g),l=e.clone(a,w),f=t.length,d=1;f>d;d++){e.clone(t[d],a);var P=a.x,T=a.y,R=a.z;P<i.x&&e.clone(a,i),P>s.x&&e.clone(a,s),T<o.y&&e.clone(a,o),T>c.y&&e.clone(a,c),R<u.z&&e.clone(a,u),R>l.z&&e.clone(a,l)}var N=e.magnitudeSquared(e.subtract(s,i,E)),C=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),z=i,A=s,b=N;C>b&&(b=C,z=o,A=c),I>b&&(b=I,z=u,A=l);var D=S;D.x=.5*(z.x+A.x),D.y=.5*(z.y+A.y),D.z=.5*(z.z+A.z);var q=e.magnitudeSquared(e.subtract(A,D,E)),U=Math.sqrt(q),L=_;L.x=i.x,L.y=o.y,L.z=u.z;var B=O;B.x=s.x,B.y=c.y,B.z=l.z;var W=e.multiplyByScalar(e.add(L,B,E),.5,M),F=0;for(d=0;f>d;d++){e.clone(t[d],a);var G=e.magnitude(e.subtract(a,W,E));G>F&&(F=G);var k=e.magnitudeSquared(e.subtract(a,D,E));if(k>q){var Y=Math.sqrt(k);U=.5*(U+Y),q=U*U;var j=Y-U;D.x=(U*D.x+j*a.x)/Y,D.y=(U*D.y+j*a.y)/Y,D.z=(U*D.z+j*a.z)/Y}}return F>U?(e.clone(D,n.center),n.radius=U):(e.clone(W,n.center),n.radius=F),n};var P=new u,T=new e,R=new e,N=new t,C=new t;h.fromRectangle2D=function(e,t,n){return h.fromRectangleWithHeights2D(e,t,0,0,n)},h.fromRectangleWithHeights2D=function(t,a,i,o,u){if(r(u)||(u=new h),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;a=n(a,P),d.southwest(t,N),N.height=i,d.northeast(t,C),C.height=o;var s=a.project(N,T),c=a.project(C,R),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*f,p.z=s.z+.5*m,u};var I=[];h.fromRectangle3D=function(e,t,a,i){t=n(t,o.WGS84),a=n(a,0);var u;return r(e)&&(u=d.subsample(e,t,a,I)),h.fromPoints(u,i)},h.fromVertices=function(t,a,i,o){if(r(o)||(o=new h),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;a=n(a,e.ZERO),i=n(i,3);var u=x;u.x=t[0]+a.x,u.y=t[1]+a.y,u.z=t[2]+a.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),f=e.clone(u,v),d=e.clone(u,g),P=e.clone(u,w),T=t.length,R=0;T>R;R+=i){var N=t[R]+a.x,C=t[R+1]+a.y,I=t[R+2]+a.z;u.x=N,u.y=C,u.z=I,N<s.x&&e.clone(u,s),N>f.x&&e.clone(u,f),C<c.y&&e.clone(u,c),C>d.y&&e.clone(u,d),I<l.z&&e.clone(u,l),I>P.z&&e.clone(u,P)}var z=e.magnitudeSquared(e.subtract(f,s,E)),A=e.magnitudeSquared(e.subtract(d,c,E)),b=e.magnitudeSquared(e.subtract(P,l,E)),D=s,q=f,U=z;A>U&&(U=A,D=c,q=d),b>U&&(U=b,D=l,q=P);var L=S;L.x=.5*(D.x+q.x),L.y=.5*(D.y+q.y),L.z=.5*(D.z+q.z);var B=e.magnitudeSquared(e.subtract(q,L,E)),W=Math.sqrt(B),F=_;F.x=s.x,F.y=c.y,F.z=l.z;var G=O;G.x=f.x,G.y=d.y,G.z=P.z;var k=e.multiplyByScalar(e.add(F,G,E),.5,M),Y=0;for(R=0;T>R;R+=i){u.x=t[R]+a.x,u.y=t[R+1]+a.y,u.z=t[R+2]+a.z;var j=e.magnitude(e.subtract(u,k,E));j>Y&&(Y=j);var H=e.magnitudeSquared(e.subtract(u,L,E));if(H>B){var V=Math.sqrt(H);W=.5*(W+V),B=W*W;var Z=V-W;L.x=(W*L.x+Z*u.x)/V,L.y=(W*L.y+Z*u.y)/V,L.z=(W*L.z+Z*u.z)/V}}return Y>W?(e.clone(L,o.center),o.radius=W):(e.clone(k,o.center),o.radius=Y),o},h.fromCornerPoints=function(t,n,a){r(a)||(a=new h);var i=a.center;return e.add(t,n,i),e.multiplyByScalar(i,.5,i),a.radius=e.distance(i,n),a},h.fromEllipsoid=function(t,n){return r(n)||(n=new h),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var z=new e;h.fromBoundingSpheres=function(t,n){if(r(n)||(n=new h),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var a=t.length;if(1===a)return h.clone(t[0],n);if(2===a)return h.union(t[0],t[1],n);for(var i=[],o=0;a>o;o++)i.push(t[o].center);n=h.fromPoints(i,n);var u=n.center,s=n.radius;for(o=0;a>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,z)+c.radius)}return n.radius=s,n},h.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new h(t.center,t.radius):void 0},h.packedLength=4,h.pack=function(e,t,r){r=n(r,0);var a=e.center;t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r]=e.radius},h.unpack=function(e,t,a){t=n(t,0),r(a)||(a=new h);var i=a.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],a.radius=e[t],a};var A=new e,b=new e;h.union=function(t,n,a){r(a)||(a=new h);var i=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,i,A),l=e.magnitude(c);if(o>=l+s)return t.clone(a),a;if(s>=l+o)return n.clone(a),a;var f=.5*(o+l+s),d=e.multiplyByScalar(c,(-o+f)/l,b);return e.add(d,i,d),e.clone(d,a.center),a.radius=f,a};var D=new e;h.expand=function(t,n,r){r=h.clone(t,r);var a=e.magnitude(e.subtract(n,r.center,D));return a>r.radius&&(r.radius=a),r},h.intersectPlane=function(t,n){var r=t.center,a=t.radius,i=n.normal,o=e.dot(i,r)+n.distance;return-a>o?s.OUTSIDE:a>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);h.intersect=function(e,t){a("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(t,q);return h.intersectPlane(e,n)},h.transform=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var U=new e;h.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,U);return e.magnitudeSquared(r)-t.radius*t.radius},h.transformWithoutScale=function(e,t,n){return r(n)||(n=new h),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var L=new e;h.computePlaneDistances=function(t,n,a,i){r(i)||(i=new c);var o=e.subtract(t.center,n,L),u=e.multiplyByScalar(a,e.dot(a,o),L),s=e.magnitude(u);return i.start=s-t.radius,i.stop=s+t.radius,i};for(var B=new e,W=new e,F=new e,G=new e,k=new e,Y=new t,j=new Array(8),H=0;8>H;++H)j[H]=new e;var V=new u;return h.projectTo2D=function(t,r,a){r=n(r,V);var i=r.ellipsoid,o=t.center,u=t.radius,s=i.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,W);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),d=e.negate(c,G),m=j,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,d,p),p=m[2],e.add(s,f,p),e.add(p,d,p),p=m[3],e.add(s,f,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,d,p),p=m[6],e.add(s,f,p),e.add(p,d,p),p=m[7],e.add(s,f,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=i.cartesianToCartographic(g,Y);r.project(w,g)}a=h.fromPoints(m,a),o=a.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,a},h.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},h.prototype.intersectPlane=function(e){return h.intersectPlane(this,e)},h.prototype.intersect=function(e){return h.intersect(this,e)},h.prototype.equals=function(e){return h.equals(this,e)},h.prototype.clone=function(e){return h.clone(this,e)},h}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(r.requestFullscreen=a,n=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(r.requestFullscreen=a,n=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?r.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(r.exitFullscreen=a)),a=s+"FullscreenEnabled",e(document[a])?r.fullscreenEnabled=a:(a=s+"FullScreenEnabled",e(document[a])&&(r.fullscreenEnabled=a)),a=s+"FullscreenElement",e(document[a])?r.fullscreenElement=a:(a=s+"FullScreenElement",e(document[a])&&(r.fullscreenElement=a)),a=s+"fullscreenchange",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenChange"),r.fullscreenchange=a),a=s+"fullscreenerror",e(document["on"+a])&&("ms"===s&&(a="MSFullscreenError"),r.fullscreenerror=a)}return n},a.requestFullscreen=function(e){a.supportsFullscreen()&&e[r.requestFullscreen]()},a.exitFullscreen=function(){a.supportsFullscreen()&&document[r.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function a(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function i(){return a()&&v}function o(){if(!t(g)&&(g=!1,!a()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=r(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1])))}return S}function f(){return l()&&_}function d(){if(!t(O)){O=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(O=!0,M=r(e[1]))}return O}function h(){return t(P)||(P=/Windows/i.test(navigator.appVersion)),P}function m(){return d()&&M}function p(){return t(T)||(T=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var y,v,g,w,x,E,S,_,O,M,P,T,R={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:d,firefoxVersion:m,isWindows:h,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return R.supportsFullscreen=function(){return n.supportsFullscreen()},R.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},R.supportsWebWorkers=function(){return"undefined"!=typeof Worker},R}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,a){"use strict";if(!r.supportsTypedArrays())return{};var i={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return i.getSizeInBytes=function(e){switch(e){case i.BYTE:return Int8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.SHORT:return Int16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case i.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},i.fromTypedArray=function(e){return e instanceof Int8Array?i.BYTE:e instanceof Uint8Array?i.UNSIGNED_BYTE:e instanceof Int16Array?i.SHORT:e instanceof Uint16Array?i.UNSIGNED_SHORT:e instanceof Float32Array?i.FLOAT:e instanceof Float64Array?i.DOUBLE:void 0},i.validate=function(e){return t(e)&&(e===i.BYTE||e===i.UNSIGNED_BYTE||e===i.SHORT||e===i.UNSIGNED_SHORT||e===i.FLOAT||e===i.DOUBLE)},i.createTypedArray=function(e,t){switch(e){case i.BYTE:return new Int8Array(t);case i.UNSIGNED_BYTE:return new Uint8Array(t);case i.SHORT:return new Int16Array(t);case i.UNSIGNED_SHORT:return new Uint16Array(t);case i.FLOAT:return new Float32Array(t);case i.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},i.createArrayBufferView=function(t,r,a,o){switch(a=e(a,0),o=e(o,(r.byteLength-a)/i.getSizeInBytes(t)),t){case i.BYTE:return new Int8Array(r,a,o);case i.UNSIGNED_BYTE:return new Uint8Array(r,a,o);case i.SHORT:return new Int16Array(r,a,o);case i.UNSIGNED_SHORT:return new Uint16Array(r,a,o);case i.FLOAT:return new Float32Array(r,a,o);case i.DOUBLE:return new Float64Array(r,a,o);default:throw new n("componentDatatype is not a valid value.")}},a(i)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,a){"use strict";var i=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,a.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return i.computeNumberOfVertices=function(e){var r=-1;for(var a in e.attributes)if(e.attributes.hasOwnProperty(a)&&t(e.attributes[a])&&t(e.attributes[a].values)){var i=e.attributes[a],o=i.values.length/i.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},i}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var a={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return a.getSizeInBytes=function(e){switch(e){case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},a.validate=function(t){return e(t)&&(t===a.UNSIGNED_BYTE||t===a.UNSIGNED_SHORT||t===a.UNSIGNED_INT)},a.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},a.createTypedArrayFromArrayBuffer=function(e,t,n,a){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,a):new Uint16Array(t,n,a)},n(a)}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.binormal=e(t.binormal,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)};return a.POSITION_ONLY=r(new a({position:!0})),a.POSITION_AND_NORMAL=r(new a({position:!0,normal:!0})),a.POSITION_NORMAL_AND_ST=r(new a({position:!0,normal:!0,st:!0})),a.POSITION_AND_ST=r(new a({position:!0,st:!0})),a.POSITION_AND_COLOR=r(new a({position:!0,color:!0})),a.ALL=r(new a({position:!0,normal:!0,st:!0,binormal:!0,tangent:!0})),a.DEFAULT=a.POSITION_NORMAL_AND_ST,a.packedLength=6,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.position?1:0,n[r++]=t.normal?1:0,n[r++]=t.st?1:0,n[r++]=t.binormal?1:0,n[r++]=t.tangent?1:0,n[r++]=t.color?1:0},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.position=1===n[r++],i.normal=1===n[r++],i.st=1===n[r++],i.binormal=1===n[r++],i.tangent=1===n[r++],i.color=1===n[r++],i},a.clone=function(e,n){return t(e)?(t(n)||(n=new a),n.position=e.position,n.normal=e.normal,n.st=e.st,n.binormal=e.binormal,n.tangent=e.tangent,n.color=e.color,n):void 0},a}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,a,i,o){"use strict";var u=function(r,a,i){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(a,e.ZERO)),n(i)?i=e.clone(i):(i=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(i,.5,i)),this.center=i -};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var a=t[0].x,i=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,d=1;f>d;d++){var h=t[d],m=h.x,p=h.y,y=h.z;a=Math.min(m,a),s=Math.max(m,s),i=Math.min(p,i),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=a,v.y=i,v.z=o;var g=r.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,r.center);return e.multiplyByScalar(w,.5,w),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),a=n.normal,o=r.x*Math.abs(a.x)+r.y*Math.abs(a.y)+r.z*Math.abs(a.z),u=e.dot(t.center,a)+n.distance;return u-o>0?i.INSIDE:0>u+o?i.OUTSIDE:i.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,a){"use strict";var i=function(t,n){this.x=e(t,0),this.y=e(n,0)};i.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new i(e,n)},i.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new i(e.x,e.y):void 0},i.fromCartesian3=i.clone,i.fromCartesian4=i.clone,i.packedLength=2,i.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},i.unpack=function(n,r,a){return r=e(r,0),t(a)||(a=new i),a.x=n[r++],a.y=n[r],a},i.fromArray=i.unpack,i.maximumComponent=function(e){return Math.max(e.x,e.y)},i.minimumComponent=function(e){return Math.min(e.x,e.y)},i.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},i.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},i.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},i.magnitude=function(e){return Math.sqrt(i.magnitudeSquared(e))};var o=new i;i.distance=function(e,t){return i.subtract(e,t,o),i.magnitude(o)},i.distanceSquared=function(e,t){return i.subtract(e,t,o),i.magnitudeSquared(o)},i.normalize=function(e,t){var n=i.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},i.dot=function(e,t){return e.x*t.x+e.y*t.y},i.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},i.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},i.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},i.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},i.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},i.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},i.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new i;i.lerp=function(e,t,n,r){return i.multiplyByScalar(t,n,u),r=i.multiplyByScalar(e,1-n,r),i.add(u,r,r)};var s=new i,c=new i;i.angleBetween=function(e,t){return i.normalize(e,s),i.normalize(t,c),a.acosClamped(i.dot(s,c))};var l=new i;return i.mostOrthogonalAxis=function(e,t){var n=i.normalize(e,l);return i.abs(n,n),t=n.x<=n.y?i.clone(i.UNIT_X,t):i.clone(i.UNIT_Y,t)},i.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},i.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},i.equalsEpsilon=function(e,n,r,i){return e===n||t(e)&&t(n)&&a.equalsEpsilon(e.x,n.x,r,i)&&a.equalsEpsilon(e.y,n.y,r,i)},i.ZERO=r(new i(0,0)),i.UNIT_X=r(new i(1,0)),i.UNIT_Y=r(new i(0,1)),i.prototype.clone=function(e){return i.clone(this,e)},i.prototype.equals=function(e){return i.equals(this,e)},i.prototype.equalsEpsilon=function(e,t,n){return i.equalsEpsilon(this,e,t,n)},i.prototype.toString=function(){return"("+this.x+", "+this.y+")"},i}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function n(e,n,r){var a=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(n)))<r?0:a}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,a){var i;if(0===e)return 0===r?[]:[-a/r];if(0===r){if(0===a)return[0,0];var o=Math.abs(a),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(i=-a/e,0>i)return[];var s=Math.sqrt(i);return[-s,s]}if(0===a)return i=-r/e,0>i?[i,0]:[0,i];var c=r*r,l=4*e*a,f=n(c,-l,t.EPSILON14);if(0>f)return[];var d=-.5*n(r,t.sign(r)*Math.sqrt(f),t.EPSILON14);return r>0?[d/e,a/d]:[a/d,d/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var a,i,o=e,u=t/3,s=n/3,c=r,l=o*s,f=u*c,d=u*u,h=s*s,m=o*s-d,p=o*c-u*s,y=u*c-h,v=4*m*y-p*p;if(0>v){var g,w,x;d*f>=l*h?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);i=-x+S;var _=i/2,O=0>_?-Math.pow(-_,1/3):Math.pow(_,1/3),M=i===S?-O:-w/O;return a=0>=w?O+M:-x/(O*O+M*M+w),d*f>=l*h?[(a-u)/o]:[-c/(a+s)]}var P=m,T=-2*u*m+o*p,R=y,N=-c*p+2*s*y,C=Math.sqrt(v),I=Math.sqrt(3)/2,z=Math.abs(Math.atan2(o*C,-T)/3);a=2*Math.sqrt(-P);var A=Math.cos(z);i=a*A;var b=a*(-A/2-I*Math.sin(z)),D=i+b>2*u?i-u:b-u,q=o,U=D/q;z=Math.abs(Math.atan2(c*C,-N)/3),a=2*Math.sqrt(-R),A=Math.cos(z),i=a*A,b=a*(-A/2-I*Math.sin(z));var L=-c,B=2*s>i+b?i+s:b+s,W=L/B,F=q*B,G=-D*B-q*L,k=D*L,Y=(s*G-u*k)/(-u*G+s*F);return Y>=U?W>=U?W>=Y?[U,Y,W]:[U,W,Y]:[W,U,Y]:W>=U?[Y,U,W]:W>=Y?[Y,W,U]:[W,Y,U]}var r={};return r.computeDiscriminant=function(e,t,n,r){var a=e*e,i=t*t,o=n*n,u=r*r,s=18*e*t*n*r+i*o-27*a*u-4*(e*o*n+i*t*r);return s},r.computeRealRoots=function(e,r,a,i){var o,u;if(0===e)return t.computeRealRoots(r,a,i);if(0===r){if(0===a){if(0===i)return[0,0,0];u=-i/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===i?(o=t.computeRealRoots(e,0,a),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,a,i)}return 0===a?0===i?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,i):0===i?(o=t.computeRealRoots(e,r,a),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,a,i)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var d=-t/4,h=f[f.length-1];if(Math.abs(h)<n.EPSILON14){var m=r.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[d-w,d-g,d+g,d+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[d-p,d+p];if(0>y&&v>=0)return p=Math.sqrt(v),[d-p,d+p]}return[]}if(h>0){var x=Math.sqrt(h),E=(s+h-c/x)/2,S=(s+h+c/x)/2,_=r.computeRealRoots(1,x,E),O=r.computeRealRoots(1,-x,S);return 0!==_.length?(_[0]+=d,_[1]+=d,0!==O.length?(O[0]+=d,O[1]+=d,_[1]<=O[0]?[_[0],_[1],O[0],O[1]]:O[1]<=_[0]?[O[0],O[1],_[0],_[1]]:_[0]>=O[0]&&_[1]<=O[1]?[O[0],_[0],_[1],O[1]]:O[0]>=_[0]&&O[1]<=_[1]?[_[0],O[0],O[1],_[1]]:_[0]>O[0]&&_[0]<O[1]?[O[0],_[0],O[1],_[1]]:[_[0],O[0],_[1],O[1]]):_):0!==O.length?(O[0]+=d,O[1]+=d,O):[]}}return[]}function i(t,a,i,o){var u=i*i,s=a*a,c=t*t,l=-2*a,f=i*t+s-4*o,d=c*o-i*a*t+u,h=e.computeRealRoots(1,l,f,d);if(h.length>0){var m,p,y=h[0],v=a-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),_=c-4*y,O=c+4*Math.abs(y);if(0>y||_*S>E*O){var M=Math.sqrt(_);m=M/2,p=0===M?0:(t*x-i)/M}else{var P=Math.sqrt(E);m=0===P?0:(t*x-i)/P,p=P/2}var T,R;0===w&&0===m?(T=0,R=0):n.sign(w)===n.sign(m)?(T=w+m,R=y/T):(R=w-m,T=y/R);var N,C;0===x&&0===p?(N=0,C=0):n.sign(x)===n.sign(p)?(N=x+p,C=o/N):(C=x-p,N=o/C);var I=r.computeRealRoots(1,T,N),z=r.computeRealRoots(1,R,C);if(0!==I.length)return 0!==z.length?I[1]<=z[0]?[I[0],I[1],z[0],z[1]]:z[1]<=I[0]?[z[0],z[1],I[0],I[1]]:I[0]>=z[0]&&I[1]<=z[1]?[z[0],I[0],I[1],z[1]]:z[0]>=I[0]&&z[1]<=I[1]?[I[0],z[0],z[1],I[1]]:I[0]>z[0]&&I[0]<z[1]?[z[0],I[0],z[1],I[1]]:[I[0],z[0],I[1],z[1]]:I;if(0!==z.length)return z}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,a){var i=e*e,o=i*e,u=t*t,s=u*t,c=n*n,l=c*n,f=r*r,d=f*r,h=a*a,m=h*a,p=u*c*f-4*s*d-4*e*l*f+18*e*t*n*d-27*i*f*f+256*o*m+a*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*f+144*i*n*f)+h*(144*e*u*n-27*u*u-128*i*c-192*i*t*r);return p},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,f=u/t,d=s/t,h=0>c?1:0;switch(h+=0>l?h+1:h,h+=0>f?h+1:h,h+=0>d?h+1:h){case 0:return a(c,l,f,d);case 1:return i(c,l,f,d);case 2:return i(c,l,f,d);case 3:return a(c,l,f,d);case 4:return a(c,l,f,d);case 5:return i(c,l,f,d);case 6:return a(c,l,f,d);case 7:return a(c,l,f,d);case 8:return i(c,l,f,d);case 9:return a(c,l,f,d);case 10:return a(c,l,f,d);case 11:return i(c,l,f,d);case 12:return a(c,l,f,d);case 13:return a(c,l,f,d);case 14:return a(c,l,f,d);case 15:return a(c,l,f,d);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,a){return n(a)||(a=new e),a=e.multiplyByScalar(t.direction,r,a),e.add(t.origin,a,a)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(t,r,a,o,u){u=n(u,!1);var s,c,l,f,d,h=t.origin,m=t.direction,p=e.subtract(a,r,y),E=e.subtract(o,r,v),S=e.cross(m,E,g),_=e.dot(p,S);if(u){if(_<i.EPSILON6)return void 0;if(s=e.subtract(h,r,w),l=e.dot(s,S),0>l||l>_)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c),0>f||l+f>_)return void 0;d=e.dot(E,c)/_}else{if(Math.abs(_)<i.EPSILON6)return void 0;var O=1/_;if(s=e.subtract(h,r,w),l=e.dot(s,S)*O,0>l||l>1)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c)*O,0>f||l+f>1)return void 0;d=e.dot(E,c)*O}return d}function f(e,t,n,r){var a=t*t-4*e*n;if(0>a)return void 0;if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function d(t,n,a){r(a)||(a={});var i=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(i,u,g),l=e.dot(o,o),d=2*e.dot(o,c),h=e.magnitudeSquared(c)-s,m=f(l,d,h,S);return r(m)?(a.start=m.root0,a.stop=m.root1,a):void 0}function h(e,t,n){var r=e+t;return i.sign(e)!==i.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function m(t,n,r,a,c){var l,f=a*a,d=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*d,p=c*(a*h(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],i.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*d+a*n.x+r,v=d*h(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],i.EPSILON15),g=c*(a*h(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(a,c*x,c*-E)),w.push(new e(a,c*x,c*E)),2===l.length){var S=l[1],_=Math.sqrt(Math.max(1-S*S,0));w.push(new e(a,c*S,c*-_)),w.push(new e(a,c*S,c*_))}return w}var O=g*g,M=v*v,P=m*m,T=g*v,R=P+M,N=2*(p*m+T),C=2*y*m+p*p-M+O,I=2*(y*p-T),z=y*y-O;if(0===R&&0===N&&0===C&&0===I)return w;l=s.computeRealRoots(R,N,C,I,z);var A=l.length;if(0===A)return w;for(var b=0;A>b;++b){var D,q=l[b],U=q*q,L=Math.max(1-U,0),B=Math.sqrt(L);D=i.sign(m)===i.sign(y)?h(m*U+y,p*q,i.EPSILON12):i.sign(y)===i.sign(p*q)?h(m*U,p*q+y,i.EPSILON12):h(m*U+p*q,y,i.EPSILON12);var W=h(v*q,g,i.EPSILON15),F=D*W;0>F?w.push(new e(a,c*q,c*B)):F>0?w.push(new e(a,c*q,c*-B)):0!==B?(w.push(new e(a,c*q,c*-B)),w.push(new e(a,c*q,c*B)),++b):w.push(new e(a,c*q,c*B))}return w}var p={};p.rayPlane=function(t,n,a){r(a)||(a=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(a=e.multiplyByScalar(u,l,a),e.add(o,a,a))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,n,a,i,o,u){var s=l(t,n,a,i,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;p.lineSegmentTriangle=function(t,n,a,i,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,a,i,o,u);return!r(f)||0>f||f>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};p.raySphere=function(e,t,n){return n=d(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var _=new c;p.lineSegmentSphere=function(t,n,a,i){var o=_;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),i=d(o,a,i),!r(i)||i.stop<0||i.start>s?void 0:(i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i)};var O=new e,M=new e;p.rayEllipsoid=function(t,n){var r,a,i,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,O),l=e.multiplyComponents(s,t.direction,M),f=e.magnitudeSquared(c),d=e.dot(c,l);if(f>1){if(d>=0)return void 0;var h=d*d;if(r=f-1,a=e.magnitudeSquared(l),i=a*r,i>h)return void 0;if(h>i){o=d*d-i,u=-d+Math.sqrt(o);var m=u/a,p=r/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(r/a);return{start:y,stop:y}}return 1>f?(r=f-1,a=e.magnitudeSquared(l),i=a*r,o=d*d-i,u=-d+Math.sqrt(o),{start:0,stop:u/a}):0>d?(a=e.magnitudeSquared(l),{start:0,stop:-d/a}):void 0};var P=new e,T=new e,R=new e,N=new e,C=new e,I=new o,z=new o,A=new o,b=new o,D=new o,q=new o,U=new o,L=new e,B=new e,W=new t;p.grazingAltitudeLocation=function(t,n){var a=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(a,P);if(e.dot(u,s)>=0)return a;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,P),f=e.normalize(l,l),d=e.mostOrthogonalAxis(l,N),h=e.normalize(e.cross(d,f,T),T),p=e.normalize(e.cross(f,h,R),R),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=h.x,y[4]=h.y,y[5]=h.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,z),g=o.fromScale(n.radii,A),w=o.fromScale(n.oneOverRadii,b),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,_=o.multiply(o.multiply(v,w,q),x,q),O=o.multiply(o.multiply(_,g,U),y,U),M=o.multiplyByVector(_,a,C),F=m(O,e.negate(M,P),0,0,1),G=F.length;if(G>0){for(var k=e.clone(e.ZERO,B),Y=Number.NEGATIVE_INFINITY,j=0;G>j;++j){E=o.multiplyByVector(g,o.multiplyByVector(y,F[j],L),L);var H=e.normalize(e.subtract(E,a,N),N),V=e.dot(H,u);V>Y&&(Y=V,k=e.clone(E,k))}var Z=n.cartesianToCartographic(k,W);return Y=i.clamp(Y,0,1),S=e.magnitude(e.subtract(k,a,N))*Math.sqrt(1-Y*Y),S=c?-S:S,Z.height=S,n.cartographicToCartesian(Z,new e)}return void 0};var F=new e;return p.lineSegmentPlane=function(t,n,a,o){r(o)||(o=new e);var u=e.subtract(n,t,F),s=a.normal,c=e.dot(s,u);if(Math.abs(c)<i.EPSILON6)return void 0;var l=e.dot(s,t),f=-(a.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,n,r,a){var i=a.normal,o=a.distance,u=e.dot(i,t)+o<0,s=e.dot(i,n)+o<0,c=e.dot(i,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,d;if((1===l||2===l)&&(f=new e,d=new e),1===l){if(u)return p.lineSegmentPlane(t,n,a,f),p.lineSegmentPlane(t,r,a,d),{positions:[t,n,r,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,a,f),p.lineSegmentPlane(n,t,a,d),{positions:[t,n,r,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,a,f),p.lineSegmentPlane(r,n,a,d),{positions:[t,n,r,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,a,f),p.lineSegmentPlane(r,t,a,d),{positions:[t,n,r,f,d],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,a,f),p.lineSegmentPlane(t,n,a,d),{positions:[t,n,r,f,d],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,a,f),p.lineSegmentPlane(n,r,a,d),{positions:[t,n,r,f,d],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,a){return t(e).then(n,r,a)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=a(e),t}function n(t){return e(t,i)}function r(e){this.then=e}function a(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return i(r)}});return n}function i(e){var n=new r(function(n,r){try{return r?t(r(e)):i(e)}catch(a){return i(a)}});return n}function o(){function e(e,t,n){return d(e,t,n)}function n(e){return m(e)}function a(e){return m(i(e))}function u(e){return h(e)}var s,c,l,f,d,h,m;return c=new r(e),s={then:e,resolve:n,reject:a,progress:u,promise:c,resolver:{resolve:n,reject:a,progress:u}},l=[],f=[],d=function(e,t,n){var r,a;return r=o(),a="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,a)}),f.push(a),r.promise},h=function(e){return p(f,e),e},m=function(e){return e=t(e),d=e.then,m=t,h=v,p(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,a,i){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,f,d,h,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(n,g)),f=[],l=g-c+1,d=[],h=o(),c)for(y=h.progress,p=function(e){d.push(e),--l||(m=p=v,h.reject(d))},m=function(e){f.push(e),--c||(m=p=v,h.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else h.resolve(f);return h.then(r,a,i)})}function c(e,t,n,r){function a(e){return t?t(e[0]):e[0]}return s(e,1,a,n,r)}function l(e,t,n,r){return y(1,arguments),d(e,g).then(t,n,r)}function f(){return d(arguments,g)}function d(t,n){return e(t,function(t){var r,a,i,u,s,c;if(i=a=t.length>>>0,r=[],c=o(),i)for(u=function(t,a){e(t,n).then(function(e){r[a]=e,--i||c.resolve(r)},c.reject)},s=0;a>s;s++)s in t?u(t[s],s):--i;else c.resolve(r);return c.promise})}function h(t,n){var r=x.call(arguments,1);return e(t,function(t){var a;return a=t.length,r[0]=function(t,r,i){return e(t,function(t){return e(r,function(e){return n(t,e,i,a)})})},w.apply(t,r)})}function m(t,n,r){var a=arguments.length>2;return e(t,function(e){return e=a?r:e,n.resolve(e),e},function(e){return n.reject(e),i(e)},n.progress)}function p(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=n,e.join=f,e.all=l,e.map=d,e.reduce=h,e.any=c,e.some=s,e.chain=m,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,n,r,a,i;if(i=0,t=Object(this),a=t.length>>>0,n=arguments,n.length<=1)for(;;){if(i in t){r=t[i++];break}if(++i>=a)throw new TypeError}else r=n[1];for(;a>i;++i)i in t&&(r=e(r,t[i],i,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,a,i=0,o=e.length-1;o>=i;)if(r=~~((i+o)/2),a=n(e[r],t),0>a)i=r+1;else{if(!(a>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,a){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=a};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],a=function(e,t,n,r){n||(n=" ");var a=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+a:a+e},i=function(e,t,n,r,i,o){var u=r-e.length;return u>0&&(e=n||!i?a(e,r,o,n):e.slice(0,t.length)+a("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+a(c.toString(t),u||0,"0",!1),i(e,n,r,o,s)},u=function(e,t,n,r,a,o){return null!=r&&(e=e.slice(0,r)),i(e,"",t,n,a,o)},s=function(e,r,s,c,l,f,d){var h,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",_=s.length,O=0;s&&_>O;O++)switch(s.charAt(O)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(O+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[n++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(d)>-1?6:"d"==d?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],d){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return h=+v||0,h=Math.round(h-h%1),m=0>h?"-":w,v=m+a(String(Math.abs(h)),f,"0",!1),i(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return h=+v,m=0>h?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(d.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(d)%2],v=m+Math.abs(h)[p](f),i(v,m,g,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,a,i,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=a,this.second=i,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c){"use strict";function l(e,t){return N.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var n=N.leapSeconds,r=t(n,g,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var a=n[r].offset;if(r>0){var i=N.secondsDifference(n[r].julianDate,e);i>a&&(r--,a=n[r].offset)}N.addSeconds(e,a,e)}function d(e,n){g.julianDate=e;var r=N.leapSeconds,a=t(r,g,l);if(0>a&&(a=~a),0===a)return N.addSeconds(e,-r[0].offset,n);if(a>=r.length)return N.addSeconds(e,-r[a-1].offset,n);var i=N.secondsDifference(r[a].julianDate,e);return 0===i?N.addSeconds(e,-r[a].offset,n):1>=i?void 0:N.addSeconds(e,-r[--a].offset,n)}function h(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function m(e,t,n,r,a,i,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var f=i+(r*s.SECONDS_PER_HOUR+a*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var p=new i,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,_=/^(\d{4})-?(\d{2})-?(\d{2})$/,O=/([Z+\-])?(\d{2})?:?(\d{2})?$/,M=/^(\d{2})(\.\d+)?/.source+O.source,P=/^(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,T=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,R="Invalid ISO 8601 date.",N=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var a=0|e;t+=(e-a)*s.SECONDS_PER_DAY,h(a,t,this),r===c.UTC&&f(this)};N.fromDate=function(e,t){var n=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(h(n[0],n[1],t),f(t),t):new N(n[0],n[1],c.UTC)},N.fromIso8601=function(e,t){e=e.replace(",",".");var n,i,u,s=e.split("T"),l=1,d=1,p=0,g=0,O=0,C=0,I=s[0],z=s[1];if(!r(I))throw new a(R);var A;if(s=I.match(_),null!==s){if(A=I.split("-").length-1,A>0&&2!==A)throw new a(R);n=+s[1],l=+s[2],d=+s[3]}else if(s=I.match(x),null!==s)n=+s[1],l=+s[2];else if(s=I.match(w),null!==s)n=+s[1];else{var b;if(s=I.match(E),null!==s){if(n=+s[1],b=+s[2],u=o(n),1>b||u&&b>366||!u&&b>365)throw new a(R)}else{if(s=I.match(S),null===s)throw new a(R);n=+s[1];var D=+s[2],q=+s[3]||0;if(A=I.split("-").length-1,A>0&&(!r(s[3])&&1!==A||r(s[3])&&2!==A))throw new a(R);var U=new Date(Date.UTC(n,0,4));b=7*D+q-U.getUTCDay()-3}i=new Date(Date.UTC(n,0,1)),i.setUTCDate(b),l=i.getUTCMonth()+1,d=i.getUTCDate()}if(u=o(n),1>l||l>12||1>d||(2!==l||!u)&&d>y[l-1]||u&&2===l&&d>v)throw new a(R);var L;if(r(z)){if(s=z.match(T),null!==s){if(A=z.split(":").length-1,A>0&&2!==A&&3!==A)throw new a(R);p=+s[1],g=+s[2],O=+s[3],C=1e3*+(s[4]||0),L=5}else if(s=z.match(P),null!==s){if(A=z.split(":").length-1,A>0&&1!==A)throw new a(R);p=+s[1],g=+s[2],O=60*+(s[3]||0),L=4}else{if(s=z.match(M),null===s)throw new a(R);p=+s[1],g=60*+(s[2]||0),L=3}if(g>=60||O>=61||p>24||24===p&&(g>0||O>0||C>0))throw new a(R);var B=s[L],W=+s[L+1],F=+(s[L+2]||0);switch(B){case"+":p-=W,g-=F;break;case"-":p+=W,g+=F;break;case"Z":break;default:g+=new Date(Date.UTC(n,l-1,d,p,g)).getTimezoneOffset()}}else g+=new Date(n,l-1,d).getTimezoneOffset();var G=60===O;for(G&&O--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,d++;for(i=u&&2===l?v:y[l-1];d>i;)d-=i,l++,l>12&&(l-=12,n++),i=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,d--;for(;1>d;)l--,1>l&&(l+=12,n--),i=u&&2===l?v:y[l-1],d+=i;var k=m(n,l,d,p,g,O,C);return r(t)?(h(k[0],k[1],t),f(t)):t=new N(k[0],k[1],c.UTC),G&&N.addSeconds(t,1,t),t},N.now=function(e){return N.fromDate(new Date,e)};var C=new N(0,0,c.TAI);return N.toGregorianDate=function(e,t){var n=!1,a=d(e,C);r(a)||(N.addSeconds(e,-1,C),a=d(C,C),n=!0);var o=a.dayNumber,u=a.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var h=0|80*c/2447,m=0|c-(0|2447*h/80);c=0|h/11;var p=0|h+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=n,t):new i(y,p,m,v,w,x,E,n)},N.toDate=function(e){var t=N.toGregorianDate(e,p),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},N.toIso8601=function(t,n){var a,i=N.toGregorianDate(t,i);return r(n)||0===i.millisecond?r(n)&&0!==n?(a=(.01*i.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",i.year,i.month,i.day,i.hour,i.minute,i.second):(a=(.01*i.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",i.year,i.month,i.day,i.hour,i.minute,i.second,a))},N.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new N(e.dayNumber,e.secondsOfDay,c.TAI):void 0},N.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},N.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},N.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(N.secondsDifference(e,t))<=n},N.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},N.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},N.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},N.computeTaiMinusUtc=function(e){g.julianDate=e;var n=N.leapSeconds,r=t(n,g,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},N.addSeconds=function(e,t,n){return h(e.dayNumber,e.secondsOfDay+t,n)},N.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return h(e.dayNumber,r,n)},N.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return h(e.dayNumber,r,n)},N.addDays=function(e,t,n){var r=e.dayNumber+t;return h(r,e.secondsOfDay,n)},N.lessThan=function(e,t){return N.compare(e,t)<0},N.lessThanOrEquals=function(e,t){return N.compare(e,t)<=0},N.greaterThan=function(e,t){return N.compare(e,t)>0},N.greaterThanOrEquals=function(e,t){return N.compare(e,t)>=0},N.prototype.clone=function(e){return N.clone(this,e)},N.prototype.equals=function(e){return N.equals(this,e)},N.prototype.equalsEpsilon=function(e,t){return N.equalsEpsilon(this,e,t)},N.prototype.toString=function(){return N.toIso8601(this)},N.leapSeconds=[new u(new N(2441317,43210,c.TAI),10),new u(new N(2441499,43211,c.TAI),11),new u(new N(2441683,43212,c.TAI),12),new u(new N(2442048,43213,c.TAI),13),new u(new N(2442413,43214,c.TAI),14),new u(new N(2442778,43215,c.TAI),15),new u(new N(2443144,43216,c.TAI),16),new u(new N(2443509,43217,c.TAI),17),new u(new N(2443874,43218,c.TAI),18),new u(new N(2444239,43219,c.TAI),19),new u(new N(2444786,43220,c.TAI),20),new u(new N(2445151,43221,c.TAI),21),new u(new N(2445516,43222,c.TAI),22),new u(new N(2446247,43223,c.TAI),23),new u(new N(2447161,43224,c.TAI),24),new u(new N(2447892,43225,c.TAI),25),new u(new N(2448257,43226,c.TAI),26),new u(new N(2448804,43227,c.TAI),27),new u(new N(2449169,43228,c.TAI),28),new u(new N(2449534,43229,c.TAI),29),new u(new N(2450083,43230,c.TAI),30),new u(new N(2450630,43231,c.TAI),31),new u(new N(2451179,43232,c.TAI),32),new u(new N(2453736,43233,c.TAI),33),new u(new N(2454832,43234,c.TAI),34),new u(new N(2456109,43235,c.TAI),35),new u(new N(2457204,43236,c.TAI),36)],N}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var a=new n.constructor;for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];r&&(o=t(o,r)),a[i]=o}return a};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var a=n[r],i=a.indexOf(": ");if(i>0){var o=a.substring(0,i),u=a.substring(i+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,a,i){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return r}function s(e,n){n=t(n,"");var a=e[1],i=!!e[2],s=e[3];switch(n){case"":case"text":return o(i,s);case"arraybuffer":return u(i,s);case"blob":var c=u(i,s); -return new Blob([c],{type:a});case"document":var l=new DOMParser;return l.parseFromString(o(i,s),a);case"json":return JSON.parse(o(i,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,a=t(n.method,"GET"),i=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,a,i,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,f){var d=l.exec(e);if(null!==d)return c.resolve(s(d,t)),void 0;var h=new XMLHttpRequest;if(n(f)&&n(h.overrideMimeType)&&h.overrideMimeType(f),h.open(r,e,!0),n(u))for(var m in u)u.hasOwnProperty(m)&&h.setRequestHeader(m,u[m]);n(t)&&(h.responseType=t),h.onload=function(){200===h.status?n(h.response)?c.resolve(h.response):n(h.responseXML)&&h.responseXML.hasChildNodes()?c.resolve(h.responseXML):n(h.responseText)?c.resolve(h.responseText):c.reject(new i("unknown XMLHttpRequest response type.")):c.reject(new a(h.status,h.response,h.getAllResponseHeaders()))},h.onerror=function(){c.reject(new a)},h.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var a={Accept:"application/json,*/*;q=0.01"},i=function(n,i){return t(i)?t(i.Accept)||(i=e(i),i.Accept=a.Accept):i=a,r(n,i).then(function(e){return JSON.parse(e)})};return i}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function d(e,t){return o.compare(e.julianDate,t)}function h(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var a=n.columnNames.indexOf("modifiedJulianDateUtc"),i=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),h=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>a||0>i||0>s||0>c||0>h||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=a,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=h,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+a],_=y[x+p],O=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,M=new o(O,_,f.TAI);if(v.push(M),w){if(_!==g&&r(g)){var P=o.leapSeconds,T=t(P,M,d);if(0>T){var R=new u(M,_);P.splice(~T,0,R)}}g=_}}}function m(e,t,n,r,a){var i=n*r;a.xPoleWander=t[i+e._xPoleWanderRadiansColumn],a.yPoleWander=t[i+e._yPoleWanderRadiansColumn],a.xPoleOffset=t[i+e._xCelestialPoleOffsetRadiansColumn],a.yPoleOffset=t[i+e._yCelestialPoleOffsetRadiansColumn],a.ut1MinusUtc=t[i+e._ut1MinusUtcSecondsColumn]}function p(e,t,n){return t+e*(n-t)}function y(e,t,n,r,a,i,u){var s=e._columnCount;if(i>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[a],l=t[i];if(c.equals(l)||r.equals(c))return m(e,n,a,s,u),u;if(r.equals(l))return m(e,n,i,s,u),u;var f=o.secondsDifference(r,c)/o.secondsDifference(l,c),d=a*s,h=i*s,y=n[d+e._ut1MinusUtcSecondsColumn],v=n[h+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=n[d+e._taiMinusUtcSecondsColumn],x=n[h+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(r)?y=v:v-=x-w)}return u.xPoleWander=p(f,n[d+e._xPoleWanderRadiansColumn],n[h+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(f,n[d+e._yPoleWanderRadiansColumn],n[h+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(f,n[d+e._xCelestialPoleOffsetRadiansColumn],n[h+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(f,n[d+e._yCelestialPoleOffsetRadiansColumn],n[h+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(f,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))h(this,t.data);else if(r(t.url)){var a=this;this._downloadPromise=e(s(t.url),function(e){h(a,e)},function(){a._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else h(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=i({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new a(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new a(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var i=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var f=i[u],d=i[u+1],h=o.lessThanOrEquals(f,e),m=!r(d),p=m||o.greaterThanOrEquals(d,e);if(h&&p)return s=u,!m&&d.equals(e)&&++s,l=s+1,y(this,i,this._samples,e,s,l,n),n}var v=t(i,e,o.compare,this._dateColumn);return v>=0?(v<i.length-1&&i[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,i,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return i.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(a,t)),this.path&&(this.path=this.path.replace(a,t)),this.query&&(this.query=this.query.replace(a,t)),this.fragment&&(this.fragment=this.fragment.replace(a,t))};var a=/%[0-9a-z]{2}/gi,i=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function a(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),a=f.exec(r);if(null!==a)return a[1]}return void 0}function i(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:a(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(i()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,d=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return d._cesiumScriptRegex=f,d.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},d}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t,n){var r=f;return r.dayNumber=t,r.secondsOfDay=n,i.daysDifference(r,e._sampleZeroDateTT)}function c(n,a){if(n._chunkDownloadsInProgress[a])return n._chunkDownloadsInProgress[a];var i=e.defer();n._chunkDownloadsInProgress[a]=i;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",a):t("Assets/IAU2006_XYS/IAU2006_XYS_"+a+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[a]=!1;for(var t=n._samples,r=e.samples,o=3*a*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];i.resolve()}),i.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new i(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),a=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,a[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new i(0,0,u.TAI);return l.prototype.preload=function(t,n,r,a){var i=s(this,t,n),o=s(this,r,a),u=0|i/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,d=0|l/this._samplesPerXysFile,h=[],m=f;d>=m;++m)h.push(c(this,m));return e.all(h)},l.prototype.computeXysRadians=function(e,t,n){var i=s(this,e,t);if(0>i)return void 0;var o=0|i/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var d=!1,h=this._samples;if(r(h[3*l])||(c(this,0|l/this._samplesPerXysFile),d=!0),r(h[3*f])||(c(this,0|f/this._samplesPerXysFile),d=!0),d)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new a(0,0,0);var m,p,y=i-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var E=3*(l+m);n.x+=w[m]*h[E++],n.y+=w[m]*h[E++],n.s+=w[m]*h[E]}return n},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,a,i,o,u){"use strict";var s=function(e,n,r,a){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(a,0)},c=new e;s.fromAxisAngle=function(t,r,a){var i=r/2,o=Math.sin(i);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,d=Math.cos(i);return n(a)?(a.x=u,a.y=l,a.z=f,a.w=d,a):new s(u,l,f,d)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var r,a,i,o,c,d=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=d+h+m;if(p>0)r=Math.sqrt(p+1),c=.5*r,r=.5/r,a=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,i=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;h>d&&(v=1),m>d&&m>h&&(v=2);var g=y[v],w=y[g];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,a=-x[0],i=-x[1],o=-x[2]}return n(t)?(t.x=a,t.y=i,t.z=o,t.w=c,t):new s(a,i,o,c)};var d=new s;s.fromHeadingPitchRoll=function(t,n,r,a){var i=s.fromAxisAngle(e.UNIT_X,r,d),o=s.fromAxisAngle(e.UNIT_Y,-n,a);a=s.multiply(o,i,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,d);return s.multiply(u,a,a)};var h=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,a){return r=t(r,0),n(a)||(a=new s),a.x=e[r],a.y=e[r+1],a.z=e[r+2],a.w=e[r+3],a},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var a=0,i=n-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,h);var u=s.computeAngle(p);r[o]=h.x*u,r[o+1]=h.y*u,r[o+2]=h.z*u}},s.unpackInterpolationResult=function(t,r,a,i,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*i,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,a=e.y*n,i=e.z*n,o=e.w*n;return t.x=r,t.y=a,t.z=i,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,a=e.y,i=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+r*l+a*c-i*s,d=o*s-r*c+a*l+i*u,h=o*c+r*s-a*u+i*l,m=o*l-r*u-a*s-i*c;return n.x=f,n.y=d,n.z=h,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,n,r){return g=s.multiplyByScalar(t,n,g),r=s.multiplyByScalar(e,1-n,r),s.add(g,r,r)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var a=s.dot(e,t),i=t;if(0>a&&(a=-a,i=w=s.negate(t,w)),1-a<o.EPSILON6)return s.lerp(e,i,n,r);var u=Math.acos(a);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(i,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),a=0;return 0!==r&&(a=r/Math.sin(r)),e.multiplyByScalar(t,a,n)},s.exp=function(t,n){var r=e.magnitude(t),a=0;return 0!==r&&(a=Math.sin(r)/r),n.x=t.x*a,n.y=t.y*a,n.z=t.z*a,n.w=Math.cos(r),n};var S=new e,_=new e,O=new s,M=new s;s.computeInnerQuadrangle=function(t,n,r,a){var i=s.conjugate(n,O);s.multiply(i,r,M);var o=s.log(M,S);s.multiply(i,t,M);var u=s.log(M,_);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,O),s.multiply(n,O,a)},s.squad=function(e,t,n,r,a,i){var o=s.slerp(e,t,a,O),u=s.slerp(n,r,a,M);return s.slerp(o,u,2*a*(1-a),i)};for(var P=new s,T=1.9011074535173003,R=a.supportsTypedArrays()?new Float32Array(8):[],N=a.supportsTypedArrays()?new Float32Array(8):[],C=a.supportsTypedArrays()?new Float32Array(8):[],I=a.supportsTypedArrays()?new Float32Array(8):[],z=0;7>z;++z){var A=z+1,b=2*A+1;R[z]=1/(A*b),N[z]=A/b}return R[7]=T/136,N[7]=8*T/17,s.fastSlerp=function(e,t,n,r){var a,i=s.dot(e,t);i>=0?a=1:(a=-1,i=-i);for(var o=i-1,u=1-n,c=n*n,l=u*u,f=7;f>=0;--f)C[f]=(R[f]*c-N[f])*o,I[f]=(R[f]*l-N[f])*o;var d=a*n*(1+C[0]*(1+C[1]*(1+C[2]*(1+C[3]*(1+C[4]*(1+C[5]*(1+C[6]*(1+C[7])))))))),h=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=s.multiplyByScalar(e,h,P);return s.multiplyByScalar(t,d,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,a,i){var o=s.fastSlerp(e,t,a,O),u=s.fastSlerp(n,r,a,M);return s.fastSlerp(o,u,2*a*(1-a),i)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,a,i,o,u,s,c,l,f,d,h,m,p,y,v){"use strict";var g={},w=new n,x=new n,E=new n;g.eastNorthUpToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new n,_=new n,O=new n;g.northEastDownToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=_,l=O;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,r){if(h.equalsEpsilon(e.x,0,h.EPSILON14)&&h.equalsEpsilon(e.y,0,h.EPSILON14)){var o=h.sign(e.z);return i(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=a(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),i(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var M=new y,P=new n(1,1,1),T=new p;g.headingPitchRollToFixedFrame=function(e,t,r,a,i,o){var u=y.fromHeadingPitchRoll(t,r,a,M),s=p.fromTranslationQuaternionRotationScale(n.ZERO,u,P,T);return o=g.eastNorthUpToFixedFrame(e,i,o),p.multiply(o,s,o)};var R=new p,N=new m;g.headingPitchRollQuaternion=function(e,t,n,r,a,i){var o=g.headingPitchRollToFixedFrame(e,t,n,r,a,R),u=p.getRotation(o,N);return y.fromRotationMatrix(u,i)};var C=24110.54841,I=8640184.812866,z=.093104,A=-62e-7,b=1.1772758384668e-19,D=72921158553e-15,q=h.TWO_PI/86400,U=new d;g.computeTemeToPseudoFixedMatrix=function(e,t){U=d.addSeconds(e,-d.computeTaiMinusUtc(e),U);var n,r=U.dayNumber,a=U.secondsOfDay,o=r-2451545;n=a>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=C+n*(I+n*(z+n*A)),s=u*q%h.TWO_PI,c=D+b*(r-2451545.5),l=(a+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,p=Math.cos(f),y=Math.sin(f);return i(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var L=32.184,B=2451545;g.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+L,a=t.stop.dayNumber,i=t.stop.secondsOfDay+L,o=g.iau2006XysData.preload(n,r,a,i),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){i(t)||(t=new m);var n=g.computeFixedToIcrfMatrix(e,t);return i(n)?m.transpose(n,t):void 0};var W=new f(0,0,0),F=new s(0,0,0,0,0,0),G=new m,k=new m;g.computeFixedToIcrfMatrix=function(e,t){i(t)||(t=new m);var n=g.earthOrientationParameters.compute(e,F);if(!i(n))return void 0;var r=e.dayNumber,a=e.secondsOfDay+L,o=g.iau2006XysData.computeXysRadians(r,a,W);if(!i(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=m.fromRotationZ(-o.s,k),p=m.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-d.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*h.TWO_PI;var _=m.fromRotationZ(S,k),O=m.multiply(p,_,G),M=Math.cos(n.xPoleWander),P=Math.cos(n.yPoleWander),T=Math.sin(n.xPoleWander),R=Math.sin(n.yPoleWander),N=r-B+a/v.SECONDS_PER_DAY;N/=36525;var C=-47e-6*N*h.RADIANS_PER_DEGREE/3600,I=Math.cos(C),z=Math.sin(C),A=k;return A[0]=M*I,A[1]=M*z,A[2]=T,A[3]=-P*z+R*T*I,A[4]=P*I+R*T*z,A[5]=-R*M,A[6]=-R*z-P*T*I,A[7]=R*I-P*T*z,A[8]=P*M,m.multiply(O,A,t)};var Y=new r;g.pointToWindowCoordinates=function(e,t,n,r){return r=g.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},g.pointToGLWindowCoordinates=function(e,n,a,o){i(o)||(o=new t);var u=Y;return p.multiplyByVector(e,r.fromElements(a.x,a.y,a.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var j=new n,H=new n,V=new n;return g.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=a(r,c.WGS84).geodeticSurfaceNormal(e,j),s=n.cross(t,u,H);n.equalsEpsilon(s,n.ZERO,h.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,V);return n.cross(t,l,s),n.negate(s,s),i(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,a,i,o,u,s,c,l,f,d,h,m){"use strict";var p=new r,y=function(e,t){t=a(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(f.getColumn(r,0,p)),this._yAxis=n.fromCartesian4(f.getColumn(r,1,p));var i=n.fromCartesian4(f.getColumn(r,2,p));this._plane=d.fromPointNormal(e,i)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var g=new h,w=new n;y.prototype.projectPointOntoPlane=function(e,r){var a=g;a.origin=e,n.normalize(e,a.direction);var o=c.rayPlane(a,this._plane,w);if(i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w)),i(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return i(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){i(t)||(t=[]);for(var n=0,r=e.length,a=0;r>a;a++){var o=this.projectPointOntoPlane(e[a],t[n]);i(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){i(r)||(r=new t);var a=g;a.origin=e,n.clone(this._plane.normal,a.direction);var o=c.rayPlane(a,this._plane,w);i(o)||(n.negate(a.direction,a.direction),o=c.rayPlane(a,this._plane,w));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){i(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;i(t)?t.length=r:t=new Array(r);for(var a=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var f=e[l];n.multiplyByScalar(u,f.x,c),i(t[l])||(t[l]=new n);var d=n.add(o,c,t[l]);n.multiplyByScalar(s,f.y,c),n.add(d,c,d),a.scaleToGeocentricSurface(d,d)}return t},y}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=new t,a=new t,i=new t,o=function(o,u,s,c,l){n(l)||(l=new t);var f,d,h,m,p,y,v,g;n(u.z)?(f=t.subtract(s,u,r),d=t.subtract(c,u,a),h=t.subtract(o,u,i),m=t.dot(f,f),p=t.dot(f,d),y=t.dot(f,h),v=t.dot(d,d),g=t.dot(d,h)):(f=e.subtract(s,u,r),d=e.subtract(c,u,a),h=e.subtract(o,u,i),m=e.dot(f,f),p=e.dot(f,d),y=e.dot(f,h),v=e.dot(d,d),g=e.dot(d,h));var w=1/(m*v-p*p);return l.y=(v*y-p*g)*w,l.z=(m*g-p*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var n=new t,r=function(t,r,a,i){return e(t,r,a,i,n),n.x>0&&n.y>0&&n.z>0};return r}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,n,r,a,i,o,u){"use strict";function s(e){var t=e._uSquared,n=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,a=(n-r)/n,i=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-a)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,i),f=s*o,d=f*f,h=1-d,m=Math.sqrt(h),p=t/4,y=p*p,v=y*p,g=y*y,w=1+p-3*y/4+5*v/4-175*g/64,x=1-p+15*y/8-35*v/8,E=1-3*p+35*y/4,S=1-5*p,_=w*l-x*Math.sin(2*l)*p/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,O=e._constants;O.a=n,O.b=r,O.f=a,O.cosineHeading=i,O.sineHeading=o,O.tanU=u,O.cosineU=s,O.sineU=c,O.sigma=l,O.sineAlpha=f,O.sineSquaredAlpha=d,O.cosineSquaredAlpha=h,O.cosineAlpha=m,O.u2Over4=p,O.u4Over16=y,O.u6Over64=v,O.u8Over256=g,O.a0=w,O.a1=x,O.a2=E,O.a3=S,O.distanceRatio=_}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,n,r,a,i,o){var u=c(e,n);return(1-u)*e*t*(r+u*a*(o+u*i*(2*o*o-1)))}function f(e,t,n,r,a,i,o){var s,c,f,d,h,m=(t-n)/t,p=i-r,y=Math.atan((1-m)*Math.tan(a)),v=Math.atan((1-m)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,_=g*E,O=w*E,M=w*x,P=p,T=u.TWO_PI,R=Math.cos(P),N=Math.sin(P);do{R=Math.cos(P),N=Math.sin(P);var C=_-M*R;f=Math.sqrt(x*x*N*N+C*C),c=O+S*R,s=Math.atan2(f,c);var I;0===f?(I=0,d=1):(I=S*N/f,d=1-I*I),T=P,h=c-2*O/d,isNaN(h)&&(h=0),P=p+l(m,I,d,s,f,c,h)}while(Math.abs(P-T)>u.EPSILON12);var z=d*(t*t-n*n)/(n*n),A=1+z*(4096+z*(z*(320-175*z)-768))/16384,b=z*(256+z*(z*(74-47*z)-128))/1024,D=h*h,q=b*f*(h+b*(c*(2*D-1)-b*h*(4*f*f-3)*(4*D-3)/6)/4),U=n*A*(s-q),L=Math.atan2(x*N,_-M*R),B=Math.atan2(g*N,_*R-M);e._distance=U,e._startHeading=L,e._endHeading=B,e._uSquared=z}function d(n,r,a,i){e.normalize(i.cartographicToCartesian(r,m),h),e.normalize(i.cartographicToCartesian(a,m),m),f(n,i.maximumRadius,i.minimumRadius,r.longitude,r.latitude,a.longitude,a.latitude),n._start=t.clone(r,n._start),n._end=t.clone(a,n._end),n._start.height=0,n._end.height=0,s(n)}var h=new e,m=new e,p=function(e,a,i){var u=n(i,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,r(e)&&r(a)&&d(this,e,a,u)};return a(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(e,t){d(this,e,t,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},p.prototype.interpolateUsingSurfaceDistance=function(e,n){var a=this._constants,i=a.distanceRatio+e/a.b,o=Math.cos(2*i),u=Math.cos(4*i),s=Math.cos(6*i),c=Math.sin(2*i),f=Math.sin(4*i),d=Math.sin(6*i),h=Math.sin(8*i),m=i*i,p=i*m,y=a.u8Over256,v=a.u2Over4,g=a.u6Over64,w=a.u4Over16,x=2*p*y*o/3+i*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*f-m*((g-11*y/2)*c+5*y*f/2)+(29*g/96-29*y/16)*d+539*y*h/1536,E=Math.asin(Math.sin(x)*a.cosineAlpha),S=Math.atan(a.a/a.b*Math.tan(E));x-=a.sigma;var _=Math.cos(2*a.sigma+x),O=Math.sin(x),M=Math.cos(x),P=a.cosineU*M,T=a.sineU*O,R=Math.atan2(O*a.sineHeading,P-T*a.cosineHeading),N=R-l(a.f,a.sineAlpha,a.cosineSquaredAlpha,x,O,M,_);return r(n)?(n.longitude=this._start.longitude+N,n.latitude=S,n.height=0,n):new t(this._start.longitude+N,S,0)},p}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,n,r,a,i,o,u,s,c,l,f){"use strict";function d(e,t,n){var r=O;r.length=e;var a;if(t===n){for(a=0;e>a;a++)r[a]=t;return r}var i=n-t,o=i/e;for(a=0;e>a;a++){var u=t+a*o;r[a]=u}return r}function h(t,n,r,a,i,o,u,s){var c=a.scaleToGeodeticSurface(t,R),l=a.scaleToGeodeticSurface(n,N),f=m.numberOfPoints(t,n,r),h=a.cartesianToCartographic(c,M),p=a.cartesianToCartographic(l,P),y=d(f,i,o); -C.setEndPoints(h,p);var v=C.surfaceDistance/f,g=s;h.height=i;var w=a.cartographicToCartesian(h,T);e.pack(w,u,g),g+=3;for(var x=1;f>x;x++){var E=C.interpolateUsingSurfaceDistance(x*v,P);E.height=y[x],w=a.cartographicToCartesian(E,T),e.pack(w,u,g),g+=3}return g}var m={};m.numberOfPoints=function(t,n,r){var a=e.distance(t,n);return Math.ceil(a/r)};var p=new t;m.extractHeights=function(e,t){for(var n=e.length,r=new Array(n),a=0;n>a;a++){var i=e[a];r[a]=t.cartesianToCartographic(i,p).height}return r};var y=new l,v=new e,g=new e,w=new f(e.ZERO,0),x=new e,E=new f(e.ZERO,0),S=new e,_=new e,O=[],M=new t,P=new t,T=new e,R=new e,N=new e,C=new o;m.wrapLongitude=function(t,a){var i=[],o=[];if(r(t)&&t.length>0){a=n(a,l.IDENTITY);var s=l.inverseTransformation(a,y),c=l.multiplyByPoint(s,e.ZERO,v),d=l.multiplyByPointAsVector(s,e.UNIT_Y,g),h=f.fromPointNormal(c,d,w),m=l.multiplyByPointAsVector(s,e.UNIT_X,x),p=f.fromPointNormal(c,m,E),O=1;i.push(e.clone(t[0]));for(var M=i[0],P=t.length,T=1;P>T;++T){var R=t[T];if(f.getPointDistance(p,M)<0||f.getPointDistance(p,R)<0){var N=u.lineSegmentPlane(M,R,h,S);if(r(N)){var C=e.multiplyByScalar(d,5e-9,_);f.getPointDistance(h,M)<0&&e.negate(C,C),i.push(e.add(N,C,new e)),o.push(O+1),e.negate(C,C),i.push(e.add(N,C,new e)),O=1}}i.push(e.clone(t[T])),O++,M=R}o.push(O)}return{positions:i,lengths:o}};var I=c.EPSILON7;return m.removeDuplicates=function(t){var n=t.length;if(2>n)return t;var r,a,i;for(r=1;n>r&&(a=t[r-1],i=t[r],!e.equalsEpsilon(a,i,I));++r);if(r===n)return t;for(var o=t.slice(0,r);n>r;++r)i=t[r],e.equalsEpsilon(a,i,I)||(o.push(e.clone(i)),a=i);return o},m.generateArc=function(t){r(t)||(t={});var a=t.positions,o=a.length,u=n(t.ellipsoid,i.WGS84),l=n(t.height,0);if(1>o)return[];if(1===o){var f=u.scaleToGeodeticSurface(a[0],R);if(0!==l){var d=u.geodeticSurfaceNormal(f,T);e.multiplyByScalar(d,l,d),e.add(f,d,f)}return[f.x,f.y,f.z]}var p=t.minDistance;if(!r(p)){var y=n(t.granularity,c.RADIANS_PER_DEGREE);p=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=m.numberOfPoints(a[v],a[v+1],p);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var _=a[v],P=a[v+1],N=S?l[v]:l,C=S?l[v+1]:l;E=h(_,P,p,u,N,C,x,E)}O.length=0;var I=a[o-1],z=u.cartesianToCartographic(I,M);z.height=S?l[o-1]:l;var A=u.cartographicToCartesian(z,T);return e.pack(A,x,w-3),x},m.generateCartesianArc=function(t){for(var n=m.generateArc(t),r=n.length/3,a=new Array(r),i=0;r>i;i++)a[i]=e.unpack(n,3*i);return a},m}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,n=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,n},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,n,r,a,i,o,u,s,c,l,f,d,h,m,p){"use strict";function y(t,n,r){var a=e.subtract(n,t,q),i=e.subtract(r,n,U);return a.x*i.y-a.y*i.x>=0}function v(e){for(var t=e[0].x,n=0,r=0;r<e.length;r++)e[r].x>t&&(t=e[r].x,n=r);return n}function g(e){for(var t=e[0][0].x,n=0,r=0;r<e.length;r++){var a=e[r][v(e[r])].x;a>t&&(t=a,n=r)}return n}function w(e){for(var t=[],n=0;n<e.length;n++){var r=e[(n-1+e.length)%e.length],a=e[n],i=e[(n+1)%e.length];y(r,a,i)||t.push(a)}return t}function x(t,n){for(var r=0;r<t.length;r++)if(e.equals(n,t[r]))return r;return-1}function E(n,a,i){i=r(i,[]);var o=Number.MAX_VALUE,u=v(a),s=new e(a[u].x,n.y);i.push(u),i.push((u+1)%a.length);for(var c=a[0].x,l=c,f=1;f<a.length;++f)a[f].x<c?c=a[f].x:a[f].x>l&&(l=a[f].x);l+=l-c;var d=new t(l,n.y,0);for(f=0;f<a.length;f++){var h=a[f],m=a[(f+1)%a.length];if((h.x>=n.x||m.x>=n.x)&&(h.y>=n.y&&m.y<=n.y||h.y<=n.y&&m.y>=n.y)){var p=(m.y-h.y)*(d.x-n.x)-(m.x-h.x)*(d.y-n.y);if(0!==p){p=1/p;var y=((m.x-h.x)*(n.y-h.y)-(m.y-h.y)*(n.x-h.x))*p,g=((d.x-n.x)*(n.y-h.y)-(d.y-n.y)*(n.x-h.x))*p;if(y>=0&&1>=y&&g>=0&&1>=g){var w=new e(n.x+y*(d.x-n.x),n.y+y*(d.y-n.y)),x=e.subtract(w,n,L);p=e.magnitudeSquared(x),o>p&&(s=w,o=p,i[0]=f,i[1]=(f+1)%a.length)}}}}return s}function S(t,n){var r=g(n),a=n[r],i=v(a),o=a[i],u=[],s=E(o,t,u),c=x(t,s);if(-1!==c)return c;var d=e.magnitudeSquared(e.subtract(t[u[0]],o,B)),h=e.magnitudeSquared(e.subtract(t[u[1]],o,B)),m=h>d?t[u[0]]:t[u[1]],p=w(t),y=p.indexOf(m);-1!==y&&p.splice(y,1);for(var S=[],_=0;_<p.length;_++){var O=p[_];f(O,o,s,m)&&S.push(O)}var M=Number.MAX_VALUE;if(S.length>0){var P=e.fromElements(1,0,B);for(_=0;_<S.length;_++){var T=e.subtract(S[_],o,W),R=e.magnitude(P)*e.magnitudeSquared(T);if(0!==R){var N=Math.abs(l.acosClamped(e.dot(P,T)/R));M>N&&(M=N,m=S[_])}}}return t.indexOf(m)}function _(e,n,r){for(var a=et.computeWindingOrder2D(e),i=0;i<n.length;i++){var o=n[i];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=et.computeWindingOrder2D(o);s===a&&o.reverse()}var c=u.fromPoints(e,r),l=c.projectPointsOntoPlane(e),f=[];for(i=0;i<n.length;i++)f.push(c.projectPointsOntoPlane(n[i]));var d=S(l,f),h=g(f),m=v(f[h]),p=n[h],y=[];for(i=0;i<e.length;i++)y.push(e[i]);var w,x=[];if(0!==m)for(w=0;w<=p.length;w++){var E=(w+m)%p.length;0!==E&&x.push(p[E])}else for(w=0;w<p.length;w++)x.push(p[(w+m)%p.length]);var _=y.lastIndexOf(e[d]);x.push(e[_]);var O=y.slice(0,_+1),M=y.slice(_+1);return y=O.concat(x,M),n.splice(h,1),y}function O(e){var t=l.nextRandomNumber(),n=Math.floor(t*e);return n===e&&n--,n}function M(e,t,n,r){var a=r[e].position,i=r[t].position,o=r[n].position,u=o.x,s=o.y,c=a.x-u,l=a.y-s,f=i.x-u,d=i.y-s;return c*d-l*f}function P(e,t){return e.x*t.y-e.y*t.x}function T(e,t){var n=t.length,r=l.mod(e-1,n),a=l.mod(e+1,n);return 0===M(r,a,e,t)?!1:!0}function R(t,n){return e.magnitudeSquared(n)<e.magnitudeSquared(t)}function N(t,n,r){if(!T(t,r))return t;var a=r[t].position,i=r[n].position,o=r.length,u=l.mod(t-1,o);if(!T(u,r))return u;var s=l.mod(t+1,o);if(!T(s,r))return s;var c=e.subtract(r[u].position,a,k),f=e.subtract(r[s].position,a,Y),d=e.subtract(i,a,j),h=P(c,d),m=P(f,d);if(0===h)return R(c,d)?F:G;if(0===m)return R(f,d)?F:G;var p=P(c,f);return 0>p?0>h&&m>0?F:G:p>0?h>0&&0>m?G:F:void 0}function C(e,t,n){return(e>t||e>n)&&(t>e||n>e)||t===n&&t===e}function I(t,n,r,a){var i=e.subtract(r,t,V),o=n.x*a.y-n.y*a.x,u=o*o,s=e.magnitudeSquared(n),c=e.magnitudeSquared(a);if(u>H*s*c){var l=(i.x*a.y-i.y*a.x)/o;return e.add(t,e.multiplyByScalar(n,l,V),V)}return void 0}function z(t,n,r){for(var i=e.subtract(n,t,Z),o=r.length,u=0;o>u;u++){var s=r[u].position,c=r[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(n,c)||e.equals(t,c)||e.equals(n,s))){var f=e.subtract(c,s,X),d=I(t,i,s,f);if(a(d)&&!(e.equals(d,t)||e.equals(d,n)||e.equals(d,s)||e.equals(d,c))){var h=d.x,m=d.y,p=C(h,t.x,n.x)&&C(m,t.y,n.y)&&C(h,s.x,c.x)&&C(m,s.y,c.y);if(p)return!0}}}return!1}function A(t,n,r){var a=N(t,n,r);if(a>=0)return a;var i=N(n,t,r);return i>=0?i:a!==F||i!==F||z(r[t].position,r[n].position,r)||e.equals(r[t].position,r[n].position)?K:J}function b(e){return 0===M(1,2,0,e)}function D(e){var t=e.length;if(3===t)return b(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new i("Invalid polygon: must have at least three vertices.");for(var n,r,a=0,o=10*e.length,u=K;J>u&&a++<o;){for(n=O(e.length),r=n+1;Math.abs(n-r)<2||Math.abs(n-r)>e.length-2;)r=O(e.length);if(n>r){var s=n;n=r,r=s}u=A(n,r,e)}if(u===J){var c=e.splice(n,r-n+1,e[n],e[r]);return D(e).concat(D(c))}return u>=0?(e.splice(u,1),D(e)):[]}var q=new e,U=new e,L=new e,B=new e(1,0),W=new e,F=-1,G=-2,k=new t,Y=new t,j=new t,H=l.EPSILON14,V=new e;new e;var Z=new e,X=new e,J=-1,K=-2,Q=new t,$=new t,et={};et.removeDuplicates=function(e){var n=d.removeDuplicates(e);return t.equals(n[0],n[n.length-1])?n.slice(1):n},et.computeArea2D=function(e){for(var t=e.length,n=0,r=t-1,a=0;t>a;r=a++){var i=e[r],o=e[a];n+=i.x*o.y-o.x*i.y}return.5*n},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?p.COUNTER_CLOCKWISE:p.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,n=[],r=0;t>r;++r)n[r]={position:e[r],index:r};return D(n)};var tt=new t,nt=new t,rt=new t,at=new t,it=new t,ot=new t,ut=new t;return et.computeSubdivision=function(e,i,o,u){u=r(u,l.RADIANS_PER_DEGREE);var f,d=o.slice(0),m=i.length,p=new Array(3*m),y=0;for(f=0;m>f;f++){var v=i[f];p[y++]=v.x,p[y++]=v.y,p[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;d.length>0;){var _,O,M=d.pop(),P=d.pop(),T=d.pop(),R=t.fromArray(p,3*T,tt),N=t.fromArray(p,3*P,nt),C=t.fromArray(p,3*M,rt),I=t.multiplyByScalar(t.normalize(R,at),x,at),z=t.multiplyByScalar(t.normalize(N,it),x,it),A=t.multiplyByScalar(t.normalize(C,ot),x,ot),b=t.magnitudeSquared(t.subtract(I,z,ut)),D=t.magnitudeSquared(t.subtract(z,A,ut)),q=t.magnitudeSquared(t.subtract(A,I,ut)),U=Math.max(b,D,q);U>S?b===U?(_=Math.min(T,P)+" "+Math.max(T,P),f=w[_],a(f)||(O=t.add(R,N,ut),t.multiplyByScalar(O,.5,O),p.push(O.x,O.y,O.z),f=p.length/3-1,w[_]=f),d.push(T,f,M),d.push(f,P,M)):D===U?(_=Math.min(P,M)+" "+Math.max(P,M),f=w[_],a(f)||(O=t.add(N,C,ut),t.multiplyByScalar(O,.5,O),p.push(O.x,O.y,O.z),f=p.length/3-1,w[_]=f),d.push(P,f,T),d.push(f,M,T)):q===U&&(_=Math.min(M,T)+" "+Math.max(M,T),f=w[_],a(f)||(O=t.add(C,R,ut),t.multiplyByScalar(O,.5,O),p.push(O.x,O.y,O.z),f=p.length/3-1,w[_]=f),d.push(M,f,P),d.push(f,T,P)):(g.push(T),g.push(P),g.push(M))}return new s({attributes:{position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:p})},indices:g,primitiveType:h.TRIANGLES})},et.scaleToGeodeticHeight=function(e,n,i,u){i=r(i,o.WGS84);var s=Q,c=$;if(n=r(n,0),u=r(u,!0),a(e)&&a(e.attributes)&&a(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,d=0;f>d;d+=3)t.fromArray(l,d,c),u&&(c=i.scaleToGeodeticSurface(c,c)),s=i.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,n,s),t.add(c,s,c),l[d]=c.x,l[d+1]=c.y,l[d+2]=c.z;return e},et.eliminateHoles=function(e,n,a){a=r(a,o.WGS84);for(var i=[],u=0;u<n.length;u++){for(var s=[],c=0;c<n[u].length;c++)s.push(t.clone(n[u][c]));i.push(s)}for(var l=e;i.length>0;)l=_(l,i,a);return l},et}),define("Core/WallGeometryLibrary",["./Cartographic","./defined","./DeveloperError","./EllipsoidTangentPlane","./Math","./PolygonPipeline","./PolylinePipeline","./WindingOrder"],function(e,t,n,r,a,i,o,u){"use strict";function s(e,t){return a.equalsEpsilon(e.latitude,t.latitude,a.EPSILON14)&&a.equalsEpsilon(e.longitude,t.longitude,a.EPSILON14)}function c(n,r,a,i){var o=r.length;if(2>o)return{positions:r};var u=t(i),c=t(a),l=new Array(o),h=new Array(o),m=new Array(o),p=r[0];l[0]=p;var y=n.cartesianToCartographic(p,f);c&&(y.height=a[0]),h[0]=y.height,m[0]=u?i[0]:0;for(var v=1,g=1;o>g;++g){var w=r[g],x=n.cartesianToCartographic(w,d);c&&(x.height=a[g]),s(y,x)?y.height<x.height&&(h[v-1]=x.height):(l[v]=w,h[v]=x.height,m[v]=u?i[g]:0,e.clone(x,y),++v)}return l.length=v,h.length=v,m.length=v,{positions:l,topHeights:h,bottomHeights:m}}var l={},f=new e,d=new e,h=new Array(2),m=new Array(2),p={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};return l.computePositions=function(e,t,n,s,l,f){var d=c(e,t,n,s);if(t=d.positions,n=d.topHeights,s=d.bottomHeights,t.length<2)return void 0;if(t.length>=3){var y=r.fromPoints(t,e),v=y.projectPointsOntoPlane(t);i.computeWindingOrder2D(v)===u.CLOCKWISE&&(t.reverse(),n.reverse(),s.reverse())}var g,w,x=t.length,E=a.chordLength(l,e.maximumRadius),S=p;if(S.minDistance=E,S.ellipsoid=e,f){var _,O=0;for(_=0;x-1>_;_++)O+=o.numberOfPoints(t[_],t[_+1],E)+1;g=new Float64Array(3*O),w=new Float64Array(3*O);var M=h,P=m;S.positions=M,S.height=P;var T=0;for(_=0;x-1>_;_++){M[0]=t[_],M[1]=t[_+1],P[0]=n[_],P[1]=n[_+1];var R=o.generateArc(S);g.set(R,T),P[0]=s[_],P[1]=s[_+1],w.set(o.generateArc(S),T),T+=R.length}}else S.positions=t,S.height=n,g=new Float64Array(o.generateArc(S)),S.height=s,w=new Float64Array(o.generateArc(S));return{bottomPositions:w,topPositions:g}},l}),define("Core/WallGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./VertexFormat","./WallGeometryLibrary"],function(e,t,n,r,a,i,o,u,s,c,l,f,d,h,m){"use strict";var p=new t,y=new t,v=new t,g=new t,w=new t,x=new t,E=new t,S=new t,_=function(e){e=r(e,r.EMPTY_OBJECT);var n=e.positions,i=e.maximumHeights,u=e.minimumHeights,s=r(e.vertexFormat,h.DEFAULT),c=r(e.granularity,f.RADIANS_PER_DEGREE),l=r(e.ellipsoid,o.WGS84);this._positions=n,this._minimumHeights=u,this._maximumHeights=i,this._vertexFormat=h.clone(s),this._granularity=c,this._ellipsoid=o.clone(l),this._workerName="createWallGeometry";var d=1+n.length*t.packedLength+2;a(u)&&(d+=u.length),a(i)&&(d+=i.length),this.packedLength=d+o.packedLength+h.packedLength+1};_.pack=function(e,n,i){i=r(i,0);var u,s=e._positions,c=s.length;for(n[i++]=c,u=0;c>u;++u,i+=t.packedLength)t.pack(s[u],n,i);var l=e._minimumHeights;if(c=a(l)?l.length:0,n[i++]=c,a(l))for(u=0;c>u;++u)n[i++]=l[u];var f=e._maximumHeights;if(c=a(f)?f.length:0,n[i++]=c,a(f))for(u=0;c>u;++u)n[i++]=f[u];o.pack(e._ellipsoid,n,i),i+=o.packedLength,h.pack(e._vertexFormat,n,i),i+=h.packedLength,n[i]=e._granularity};var O=o.clone(o.UNIT_SPHERE),M=new h,P={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:O,vertexFormat:M,granularity:void 0};return _.unpack=function(e,n,i){n=r(n,0);var u,s=e[n++],c=new Array(s);for(u=0;s>u;++u,n+=t.packedLength)c[u]=t.unpack(e,n);s=e[n++];var l;if(s>0)for(l=new Array(s),u=0;s>u;++u)l[u]=e[n++];s=e[n++];var f;if(s>0)for(f=new Array(s),u=0;s>u;++u)f[u]=e[n++];var d=o.unpack(e,n,O);n+=o.packedLength;var m=h.unpack(e,n,M);n+=h.packedLength;var p=e[n];return a(i)?(i._positions=c,i._minimumHeights=l,i._maximumHeights=f,i._ellipsoid=o.clone(d,i._ellipsoid),i._vertexFormat=h.clone(m,i._vertexFormat),i._granularity=p,i):(P.positions=c,P.minimumHeights=l,P.maximumHeights=f,P.granularity=p,new _(P))},_.fromConstantHeights=function(e){e=r(e,r.EMPTY_OBJECT);var t,n,i=e.positions,o=e.minimumHeight,u=e.maximumHeight,s=a(o),c=a(u);if(s||c){var l=i.length;t=s?new Array(l):void 0,n=c?new Array(l):void 0;for(var f=0;l>f;++f)s&&(t[f]=o),c&&(n[f]=u)}var d={positions:i,maximumHeights:n,minimumHeights:t,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat};return new _(d)},_.createGeometry=function(r){var i=r._positions,o=r._minimumHeights,h=r._maximumHeights,_=r._vertexFormat,O=r._granularity,M=r._ellipsoid,P=m.computePositions(M,i,h,o,O,!0);if(!a(P))return void 0;var T=P.bottomPositions,R=P.topPositions,N=R.length,C=2*N,I=_.position?new Float64Array(C):void 0,z=_.normal?new Float32Array(C):void 0,A=_.tangent?new Float32Array(C):void 0,b=_.binormal?new Float32Array(C):void 0,D=_.st?new Float32Array(2*(C/3)):void 0,q=0,U=0,L=0,B=0,W=0,F=S,G=E,k=x,Y=!0;N/=3;var j;for(j=0;N>j;++j){var H=3*j,V=t.fromArray(R,H,p),Z=t.fromArray(T,H,y);if(_.position&&(I[q++]=Z.x,I[q++]=Z.y,I[q++]=Z.z,I[q++]=V.x,I[q++]=V.y,I[q++]=V.z),_.normal||_.tangent||_.binormal){var X,J=t.clone(t.ZERO,w),K=M.scaleToGeodeticSurface(t.fromArray(R,H,y),y);if(N>j+1&&(X=M.scaleToGeodeticSurface(t.fromArray(R,H+3,v),v),J=t.fromArray(R,H+3,w)),Y){var Q=t.subtract(J,V,g),$=t.subtract(K,V,p);F=t.normalize(t.cross($,Q,F),F),Y=!1}t.equalsEpsilon(X,K,f.EPSILON6)?Y=!0:(_.tangent&&(G=t.normalize(t.subtract(X,K,G),G)),_.binormal&&(k=t.normalize(t.cross(F,G,k),k))),_.normal&&(z[U++]=F.x,z[U++]=F.y,z[U++]=F.z,z[U++]=F.x,z[U++]=F.y,z[U++]=F.z),_.tangent&&(A[B++]=G.x,A[B++]=G.y,A[B++]=G.z,A[B++]=G.x,A[B++]=G.y,A[B++]=G.z),_.binormal&&(b[L++]=k.x,b[L++]=k.y,b[L++]=k.z,b[L++]=k.x,b[L++]=k.y,b[L++]=k.z)}if(_.st){var et=j/(N-1);D[W++]=et,D[W++]=0,D[W++]=et,D[W++]=1}}var tt=new c;_.position&&(tt.position=new s({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:I})),_.normal&&(tt.normal=new s({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:z})),_.tangent&&(tt.tangent=new s({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:A})),_.binormal&&(tt.binormal=new s({componentDatatype:n.FLOAT,componentsPerAttribute:3,values:b})),_.st&&(tt.st=new s({componentDatatype:n.FLOAT,componentsPerAttribute:2,values:D}));var nt=C/3;C-=6;var rt=l.createTypedArray(nt,C),at=0;for(j=0;nt-2>j;j+=2){var it=j,ot=j+2,ut=t.fromArray(I,3*it,p),st=t.fromArray(I,3*ot,y);if(!t.equalsEpsilon(ut,st,f.EPSILON6)){var ct=j+1,lt=j+3;rt[at++]=ct,rt[at++]=it,rt[at++]=lt,rt[at++]=lt,rt[at++]=it,rt[at++]=ot}}return new u({attributes:tt,indices:rt,primitiveType:d.TRIANGLES,boundingSphere:new e.fromVertices(I)})},_}),define("Workers/createWallGeometry",["../Core/defined","../Core/Ellipsoid","../Core/WallGeometry"],function(e,t,n){"use strict";function r(r,a){return e(a)&&(r=n.unpack(r,a)),r._ellipsoid=t.clone(r._ellipsoid),n.createGeometry(r)}return r})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/createWallOutlineGeometry.js b/libs/Cesium/Workers/createWallOutlineGeometry.js deleted file mode 100644 index a355055f..00000000 --- a/libs/Cesium/Workers/createWallOutlineGeometry.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,i){i=t(i,r);var a=Math.abs(e-n);return i>=a||a<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],i=t;e>=i;i++)r.push(n*i);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var i=new e;return n.setRandomNumberSeed=function(t){i=new e(t)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};a.fromSpherical=function(n,r){t(r)||(r=new a);var i=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(e,n,r,i){return t(i)?(i.x=e,i.y=n,i.z=r,i):new a(e,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(e,t){a.normalize(e,s),a.normalize(t,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,l);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Z,t):n.y<=n.z?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_Z,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)},a.cross=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=t.x,u=t.y,s=t.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(e,t,n,r,o){var u=i.toRadians(e),s=i.toRadians(t);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=e(i,0);var s=t(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),t(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=i.toRadians(e[o]);return a.fromRadiansArray(r,t,n)},a.fromRadiansArray=function(e,n,r){var i=e.length;t(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=i.toRadians(e[o]),r[o+1]=i.toRadians(e[o+1]),r[o+2]=e[o+2];return a.fromRadiansArrayHeights(r,t,n)},a.fromRadiansArrayHeights=function(e,n,r){var i=e.length;t(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return a.fromRadians=function(n,r,i,o){return i=e(i,0),t(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(e,t,n,r){return e=i.toRadians(e),t=i.toRadians(t),a.fromRadians(e,t,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new a(e.longitude,e.latitude,e.height):void 0},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},a.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t){return a.equalsEpsilon(this,e,t)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";function s(t,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),t._radii=new e(r,i,a),t._radiiSquared=new e(r*r,i*i,a*a),t._radiiToTheFourth=new e(r*r*r*r,i*i*i*i,a*a*a*a),t._oneOverRadii=new e(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),t._minimumRadius=Math.min(r,i,a),t._maximumRadius=Math.max(r,i,a),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var i=t._radii;return r(n)?(e.clone(i,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,i){i=n(i,0),e.pack(t._radii,r,i)},c.unpack=function(t,r,i){r=n(r,0);var a=e.unpack(t,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var i=t.longitude,a=t.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(t,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,t.height,i),r(n)||(n=new e),e.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var h=new e,d=new e,m=new e;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=e.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,n))*e.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var i=t.x,a=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,n):void 0;var x=this._oneOverRadiiSquared,E=x.x,S=x.y,_=x.z,O=y;O.x=2*w.x*E,O.y=2*w.y*S,O.z=2*w.z*_;var M,P,T,R,C,N,I,z,A,b,D,q=(1-g)*e.magnitude(t)/(.5*e.magnitude(O)),U=0;do{q-=U,T=1/(1+q*E),R=1/(1+q*S),C=1/(1+q*_),N=T*T,I=R*R,z=C*C,A=N*T,b=I*R,D=z*C,M=h*N+d*I+m*z-1,P=h*A*E+d*b*S+m*D*_;var L=-2*P;U=M/L}while(Math.abs(M)>u.EPSILON12);return r(n)?(n.x=i*T,n.y=a*R,n.z=o*C,n):new e(i*T,a*R,o*C)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var i=t.x,a=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,i,a,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var i=this._semimajorAxis,a=t.longitude*i,o=t.latitude*i,u=t.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new e(a,o,u)},u.prototype.unproject=function(e,n){var i=this._oneOverSemimajorAxis,a=e.x*i,o=e.y*i,u=e.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new t(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r,i){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(i,0)};a.fromElements=function(e,n,r,i,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=i,o):new a(e,n,r,i)},a.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,s);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)&&i.equalsEpsilon(e.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(d[n],h[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(e[c.getElementIndex(m,f)])>n){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,n,r,i,a,o,u,s,c){this[0]=t(e,0),this[1]=t(i,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(a,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r++],i[1]=e[r++],i[2]=e[r++],i[3]=e[r++],i[4]=e[r++],i[5]=e[r++],i[6]=e[r++],i[7]=e[r++],i[8]=e[r++],i},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],i[8]=e[r+8],i},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,i=e.x*e.y,a=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,h=e.z*e.w,d=e.w*e.w,m=r-u-f+d,p=2*(i-h),y=2*(a+l),v=2*(i+h),g=-r+u-f+d,w=2*(s-o),x=2*(a-l),E=2*(s+o),S=-r-u+f+d;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=E,t[6]=y,t[7]=w,t[8]=S,t):new c(m,p,y,v,g,w,x,E,S)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=i,t[6]=0,t[7]=-i,t[8]=r,t):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=r,t):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,i=e[r],a=e[r+1],o=e[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=3*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],i=e[t+3],a=e[t+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[3]*i+e[6]*a,u=e[1]*r+e[4]*i+e[7]*a,s=e[2]*r+e[5]*i+e[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var h=[1,0,0],d=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var r=a.EPSILON20,i=10,l=0,f=0;n(t)||(t={});for(var h=t.unitary=c.clone(c.IDENTITY,t.unitary),d=t.diagonal=c.clone(e,t.diagonal),y=r*o(d);i>f&&u(d)>y;)s(d,m),c.transpose(m,p),c.multiply(d,m,d),c.multiply(p,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],i=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(e,t){var n=e[0],i=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],h=e[7],d=e[8],m=c.determinant(e);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");t[0]=s*d-h*l,t[1]=h*o-i*d,t[2]=i*l-s*o,t[3]=f*l-u*d,t[4]=n*d-f*o,t[5]=u*o-n*l,t[6]=u*h-f*s,t[7]=f*i-n*h,t[8]=n*s-u*i;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,i,a,o,u,s){"use strict";var c=function(e,t,r,i,a,o,u,s,c,l,f,h,d,m,p,y){this[0]=n(e,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(p,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,i){return t=n(t,0),r(i)||(i=new c),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,i,a){return i=n(i,e.ZERO),r(a)?(a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=0,a[4]=t[3],a[5]=t[4],a[6]=t[5],a[7]=0,a[8]=t[6],a[9]=t[7],a[10]=t[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(t[0],t[3],t[6],i.x,t[1],t[4],t[7],i.y,t[2],t[5],t[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,h=t.x*t.w,d=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-d-y+g,x=2*(l-v),E=2*(f+p),S=2*(l+v),_=-s+d-y+g,O=2*(m-h),M=2*(f-p),P=2*(m+h),T=-s-d+y+g;return i[0]=w*a,i[1]=S*a,i[2]=M*a,i[3]=0,i[4]=x*o,i[5]=_*o,i[6]=P*o,i[7]=0,i[8]=E*u,i[9]=O*u,i[10]=T*u,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,h=new e;c.fromCamera=function(t,n){var i=t.eye,a=t.target,o=t.up;e.normalize(e.subtract(a,i,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,p=l.y,y=l.z,v=h.x,g=h.y,w=h.z,x=i.x,E=i.y,S=i.z,_=u*-x+s*-E+d*-S,O=v*-x+g*-E+w*-S,M=m*x+p*E+y*S;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=g,n[6]=-p,n[7]=0,n[8]=d,n[9]=w,n[10]=-y,n[11]=0,n[12]=_,n[13]=O,n[14]=M,n[15]=1,n):new c(u,s,d,_,v,g,w,O,-m,-p,-y,M,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,i){var a=Math.tan(.5*e),o=1/a,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(e,t,n,r,i,a,o){var u=1/(t-e),s=1/(r-n),c=1/(a-i),l=-(t+e)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o -},c.computePerspectiveOffCenter=function(e,t,n,r,i,a,o){var u=2*i/(t-e),s=2*i/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,i,a){var o=2*i/(t-e),u=2*i/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(e,t,r,i){e=n(e,n.EMPTY_OBJECT);var a=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-t),h=c,d=l,m=f,p=a+c,y=o+l,v=t+f,g=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=p,i[13]=y,i[14]=v,i[15]=g,i},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,i=e[r],a=e[r+1],o=e[r+2],u=e[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=4*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],i=e[t+4],a=e[t+8],o=e[t+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var d=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],d)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],d)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],d)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],h=e[9],d=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],E=t[2],S=t[3],_=t[4],O=t[5],M=t[6],P=t[7],T=t[8],R=t[9],C=t[10],N=t[11],I=t[12],z=t[13],A=t[14],b=t[15],D=r*w+u*x+f*E+p*S,q=i*w+s*x+h*E+y*S,U=a*w+c*x+d*E+v*S,L=o*w+l*x+m*E+g*S,W=r*_+u*O+f*M+p*P,B=i*_+s*O+h*M+y*P,F=a*_+c*O+d*M+v*P,G=o*_+l*O+m*M+g*P,k=r*T+u*R+f*C+p*N,j=i*T+s*R+h*C+y*N,H=a*T+c*R+d*C+v*N,Y=o*T+l*R+m*C+g*N,V=r*I+u*z+f*A+p*b,Z=i*I+s*z+h*A+y*b,X=a*I+c*z+d*A+v*b,J=o*I+l*z+m*A+g*b;return n[0]=D,n[1]=q,n[2]=U,n[3]=L,n[4]=W,n[5]=B,n[6]=F,n[7]=G,n[8]=k,n[9]=j,n[10]=H,n[11]=Y,n[12]=V,n[13]=Z,n[14]=X,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=e[12],d=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],E=t[8],S=t[9],_=t[10],O=t[12],M=t[13],P=t[14],T=r*p+o*y+c*v,R=i*p+u*y+l*v,C=a*p+s*y+f*v,N=r*g+o*w+c*x,I=i*g+u*w+l*x,z=a*g+s*w+f*x,A=r*E+o*S+c*_,b=i*E+u*S+l*_,D=a*E+s*S+f*_,q=r*O+o*M+c*P+h,U=i*O+u*M+l*P+d,L=a*O+s*M+f*P+m;return n[0]=T,n[1]=R,n[2]=C,n[3]=0,n[4]=N,n[5]=I,n[6]=z,n[7]=0,n[8]=A,n[9]=b,n[10]=D,n[11]=0,n[12]=q,n[13]=U,n[14]=L,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=t[0],d=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],E=r*h+o*d+c*m,S=i*h+u*d+l*m,_=a*h+s*d+f*m,O=r*p+o*y+c*v,M=i*p+u*y+l*v,P=a*p+s*y+f*v,T=r*g+o*w+c*x,R=i*g+u*w+l*x,C=a*g+s*w+f*x;return n[0]=E,n[1]=S,n[2]=_,n[3]=0,n[4]=O,n[5]=M,n[6]=P,n[7]=0,n[8]=T,n[9]=R,n[10]=C,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=r*e[0]+i*e[4]+a*e[8]+e[12],u=r*e[1]+i*e[5]+a*e[9]+e[13],s=r*e[2]+i*e[6]+a*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var p=new e;c.multiplyByUniformScale=function(e,t,n){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,n)},c.multiplyByScale=function(e,t,n){var r=t.x,i=t.y,a=t.z;return 1===r&&1===i&&1===a?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=i*e[4],n[5]=i*e[5],n[6]=i*e[6],n[7]=0,n[8]=a*e[8],n[9]=a*e[9],n[10]=a*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=t.w,u=e[0]*r+e[4]*i+e[8]*a+e[12]*o,s=e[1]*r+e[5]*i+e[9]*a+e[13]*o,c=e[2]*r+e[6]*i+e[10]*a+e[14]*o,l=e[3]*r+e[7]*i+e[11]*a+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a,u=e[1]*r+e[5]*i+e[9]*a,s=e[2]*r+e[6]*i+e[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a+e[12],u=e[1]*r+e[5]*i+e[9]*a+e[13],s=e[2]*r+e[6]*i+e[10]*a+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],i=e[3],a=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[10]=e[10],t[11]=e[14],t[12]=i,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],i=e[4],a=e[8],l=e[12],f=e[1],h=e[5],d=e[9],m=e[13],p=e[2],x=e[6],E=e[10],S=e[14],_=e[3],O=e[7],M=e[11],P=e[15],T=E*P,R=S*M,C=x*P,N=S*O,I=x*M,z=E*O,A=p*P,b=S*_,D=p*M,q=E*_,U=p*O,L=x*_,W=T*h+N*d+I*m-(R*h+C*d+z*m),B=R*f+A*d+q*m-(T*f+b*d+D*m),F=C*f+b*h+U*m-(N*f+A*h+L*m),G=z*f+D*h+L*d-(I*f+q*h+U*d),k=R*i+C*a+z*l-(T*i+N*a+I*l),j=T*r+b*a+D*l-(R*r+A*a+q*l),H=N*r+A*i+L*l-(C*r+b*i+U*l),Y=I*r+q*i+U*a-(z*r+D*i+L*a);T=a*m,R=l*d,C=i*m,N=l*h,I=i*d,z=a*h,A=r*m,b=l*f,D=r*d,q=a*f,U=r*h,L=i*f;var V=T*O+N*M+I*P-(R*O+C*M+z*P),Z=R*_+A*M+q*P-(T*_+b*M+D*P),X=C*_+b*O+U*P-(N*_+A*O+L*P),J=z*_+D*O+L*M-(I*_+q*O+U*M),K=C*E+z*S+R*x-(I*S+T*x+N*E),Q=D*S+T*p+b*E-(A*E+q*S+R*p),$=A*x+L*S+N*p-(U*S+C*p+b*x),et=U*E+I*p+q*x-(D*x+L*E+z*p),tt=r*W+i*B+a*F+l*G;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=W*tt,n[1]=B*tt,n[2]=F*tt,n[3]=G*tt,n[4]=k*tt,n[5]=j*tt,n[6]=H*tt,n[7]=Y*tt,n[8]=V*tt,n[9]=Z*tt,n[10]=X*tt,n[11]=J*tt,n[12]=K*tt,n[13]=Q*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],h=e[13],d=e[14],m=-n*f-r*h-i*d,p=-a*f-o*h-u*d,y=-s*f-c*h-l*d;return t[0]=n,t[1]=a,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=i,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var i=function(t,n){this.normal=e.clone(t),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-e.dot(r,n);return t(a)?(e.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new e;return i.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,a),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},i.ORIGIN_XY_PLANE=r(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(e.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.west=e[r++],i.south=e[r++],i.east=e[r++],i.north=e[r],i},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,i,a,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),i=u.toRadians(t(i,0)),a=u.toRadians(t(a,0)),n(o)?(o.west=e,o.south=r,o.east=i,o.north=a,o):new s(e,r,i,a)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=a,t.east=i,t.north=o,t):new s(r,a,i,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var i=t.east,a=t.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var i=e.east,a=e.west,o=t.east,c=t.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var h=Math.max(e.south,t.south),d=Math.min(e.north,t.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,i=e.west,a=e.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,i,o){r=t(r,a.WGS84),i=t(i,0),n(o)||(o=[]);var l=0,f=e.north,h=e.south,d=e.east,m=e.west,p=c;p.height=i,p.longitude=m,p.latitude=f,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=0>f?f:h>0?h:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=r.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,E=new e,S=new e,_=new e,O=new e,M=new e;d.fromPoints=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var i=e.clone(t[0],x),a=e.clone(i,m),o=e.clone(i,p),u=e.clone(i,y),s=e.clone(i,v),c=e.clone(i,g),l=e.clone(i,w),f=t.length,h=1;f>h;h++){e.clone(t[h],i);var P=i.x,T=i.y,R=i.z;P<a.x&&e.clone(i,a),P>s.x&&e.clone(i,s),T<o.y&&e.clone(i,o),T>c.y&&e.clone(i,c),R<u.z&&e.clone(i,u),R>l.z&&e.clone(i,l)}var C=e.magnitudeSquared(e.subtract(s,a,E)),N=e.magnitudeSquared(e.subtract(c,o,E)),I=e.magnitudeSquared(e.subtract(l,u,E)),z=a,A=s,b=C;N>b&&(b=N,z=o,A=c),I>b&&(b=I,z=u,A=l);var D=S;D.x=.5*(z.x+A.x),D.y=.5*(z.y+A.y),D.z=.5*(z.z+A.z);var q=e.magnitudeSquared(e.subtract(A,D,E)),U=Math.sqrt(q),L=_;L.x=a.x,L.y=o.y,L.z=u.z;var W=O;W.x=s.x,W.y=c.y,W.z=l.z;var B=e.multiplyByScalar(e.add(L,W,E),.5,M),F=0;for(h=0;f>h;h++){e.clone(t[h],i);var G=e.magnitude(e.subtract(i,B,E));G>F&&(F=G);var k=e.magnitudeSquared(e.subtract(i,D,E));if(k>q){var j=Math.sqrt(k);U=.5*(U+j),q=U*U;var H=j-U;D.x=(U*D.x+H*i.x)/j,D.y=(U*D.y+H*i.y)/j,D.z=(U*D.z+H*i.z)/j}}return F>U?(e.clone(D,n.center),n.radius=U):(e.clone(B,n.center),n.radius=F),n};var P=new u,T=new e,R=new e,C=new t,N=new t;d.fromRectangle2D=function(e,t,n){return d.fromRectangleWithHeights2D(e,t,0,0,n)},d.fromRectangleWithHeights2D=function(t,i,a,o,u){if(r(u)||(u=new d),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=n(i,P),h.southwest(t,C),C.height=a,h.northeast(t,N),N.height=o;var s=i.project(C,T),c=i.project(N,R),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*f,p.z=s.z+.5*m,u};var I=[];d.fromRectangle3D=function(e,t,i,a){t=n(t,o.WGS84),i=n(i,0);var u;return r(e)&&(u=h.subsample(e,t,i,I)),d.fromPoints(u,a)},d.fromVertices=function(t,i,a,o){if(r(o)||(o=new d),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;i=n(i,e.ZERO),a=n(a,3);var u=x;u.x=t[0]+i.x,u.y=t[1]+i.y,u.z=t[2]+i.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),f=e.clone(u,v),h=e.clone(u,g),P=e.clone(u,w),T=t.length,R=0;T>R;R+=a){var C=t[R]+i.x,N=t[R+1]+i.y,I=t[R+2]+i.z;u.x=C,u.y=N,u.z=I,C<s.x&&e.clone(u,s),C>f.x&&e.clone(u,f),N<c.y&&e.clone(u,c),N>h.y&&e.clone(u,h),I<l.z&&e.clone(u,l),I>P.z&&e.clone(u,P)}var z=e.magnitudeSquared(e.subtract(f,s,E)),A=e.magnitudeSquared(e.subtract(h,c,E)),b=e.magnitudeSquared(e.subtract(P,l,E)),D=s,q=f,U=z;A>U&&(U=A,D=c,q=h),b>U&&(U=b,D=l,q=P);var L=S;L.x=.5*(D.x+q.x),L.y=.5*(D.y+q.y),L.z=.5*(D.z+q.z);var W=e.magnitudeSquared(e.subtract(q,L,E)),B=Math.sqrt(W),F=_;F.x=s.x,F.y=c.y,F.z=l.z;var G=O;G.x=f.x,G.y=h.y,G.z=P.z;var k=e.multiplyByScalar(e.add(F,G,E),.5,M),j=0;for(R=0;T>R;R+=a){u.x=t[R]+i.x,u.y=t[R+1]+i.y,u.z=t[R+2]+i.z;var H=e.magnitude(e.subtract(u,k,E));H>j&&(j=H);var Y=e.magnitudeSquared(e.subtract(u,L,E));if(Y>W){var V=Math.sqrt(Y);B=.5*(B+V),W=B*B;var Z=V-B;L.x=(B*L.x+Z*u.x)/V,L.y=(B*L.y+Z*u.y)/V,L.z=(B*L.z+Z*u.z)/V}}return j>B?(e.clone(L,o.center),o.radius=B):(e.clone(k,o.center),o.radius=j),o},d.fromCornerPoints=function(t,n,i){r(i)||(i=new d);var a=i.center;return e.add(t,n,a),e.multiplyByScalar(a,.5,a),i.radius=e.distance(a,n),i},d.fromEllipsoid=function(t,n){return r(n)||(n=new d),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var z=new e;d.fromBoundingSpheres=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var i=t.length;if(1===i)return d.clone(t[0],n);if(2===i)return d.union(t[0],t[1],n);for(var a=[],o=0;i>o;o++)a.push(t[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,z)+c.radius)}return n.radius=s,n},d.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new d(t.center,t.radius):void 0},d.packedLength=4,d.pack=function(e,t,r){r=n(r,0);var i=e.center;t[r++]=i.x,t[r++]=i.y,t[r++]=i.z,t[r]=e.radius},d.unpack=function(e,t,i){t=n(t,0),r(i)||(i=new d);var a=i.center;return a.x=e[t++],a.y=e[t++],a.z=e[t++],i.radius=e[t],i};var A=new e,b=new e;d.union=function(t,n,i){r(i)||(i=new d);var a=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,a,A),l=e.magnitude(c);if(o>=l+s)return t.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=e.multiplyByScalar(c,(-o+f)/l,b);return e.add(h,a,h),e.clone(h,i.center),i.radius=f,i};var D=new e;d.expand=function(t,n,r){r=d.clone(t,r);var i=e.magnitude(e.subtract(n,r.center,D));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(t,n){var r=t.center,i=t.radius,a=n.normal,o=e.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);d.intersect=function(e,t){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(t,q);return d.intersectPlane(e,n)},d.transform=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var U=new e;d.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,U);return e.magnitudeSquared(r)-t.radius*t.radius},d.transformWithoutScale=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var L=new e;d.computePlaneDistances=function(t,n,i,a){r(a)||(a=new c);var o=e.subtract(t.center,n,L),u=e.multiplyByScalar(i,e.dot(i,o),L),s=e.magnitude(u);return a.start=s-t.radius,a.stop=s+t.radius,a};for(var W=new e,B=new e,F=new e,G=new e,k=new e,j=new t,H=new Array(8),Y=0;8>Y;++Y)H[Y]=new e;var V=new u;return d.projectTo2D=function(t,r,i){r=n(r,V);var a=r.ellipsoid,o=t.center,u=t.radius,s=a.geodeticSurfaceNormal(o,W),c=e.cross(e.UNIT_Z,s,B);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,k),h=e.negate(c,G),m=H,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,h,p),p=m[2],e.add(s,f,p),e.add(p,h,p),p=m[3],e.add(s,f,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,h,p),p=m[6],e.add(s,f,p),e.add(p,h,p),p=m[7],e.add(s,f,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=a.cartesianToCartographic(g,j);r.project(w,g)}i=d.fromPoints(m,i),o=i.center;var x=o.x,E=o.y,S=o.z;return o.x=S,o.y=x,o.z=E,i},d.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},d.prototype.intersectPlane=function(e){return d.intersectPlane(this,e)},d.prototype.intersect=function(e){return d.intersect(this,e)},d.prototype.equals=function(e){return d.equals(this,e)},d.prototype.clone=function(e){return d.clone(this,e)},d}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return t(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof t[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof t[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",e(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",e(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",e(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",e(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function i(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function a(){return i()&&v}function o(){if(!t(g)&&(g=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=r(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,E=r(e[1]),E.isNightly=!!e[2])}return x}function c(){return s()&&E}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(S=!0,_=r(e[1])))}return S}function f(){return l()&&_}function h(){if(!t(O)){O=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(O=!0,M=r(e[1]))}return O}function d(){return t(P)||(P=/Windows/i.test(navigator.appVersion)),P}function m(){return h()&&M}function p(){return t(T)||(T=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var y,v,g,w,x,E,S,_,O,M,P,T,R={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return R.supportsFullscreen=function(){return n.supportsFullscreen()},R.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},R.supportsWebWorkers=function(){return"undefined"!=typeof Worker},R}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,t,n,r,i){"use strict";if(!r.supportsTypedArrays())return{};var a={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return a.getSizeInBytes=function(e){switch(e){case a.BYTE:return Int8Array.BYTES_PER_ELEMENT;case a.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case a.SHORT:return Int16Array.BYTES_PER_ELEMENT;case a.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case a.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case a.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new n("componentDatatype is not a valid value.")}},a.fromTypedArray=function(e){return e instanceof Int8Array?a.BYTE:e instanceof Uint8Array?a.UNSIGNED_BYTE:e instanceof Int16Array?a.SHORT:e instanceof Uint16Array?a.UNSIGNED_SHORT:e instanceof Float32Array?a.FLOAT:e instanceof Float64Array?a.DOUBLE:void 0},a.validate=function(e){return t(e)&&(e===a.BYTE||e===a.UNSIGNED_BYTE||e===a.SHORT||e===a.UNSIGNED_SHORT||e===a.FLOAT||e===a.DOUBLE)},a.createTypedArray=function(e,t){switch(e){case a.BYTE:return new Int8Array(t);case a.UNSIGNED_BYTE:return new Uint8Array(t);case a.SHORT:return new Int16Array(t);case a.UNSIGNED_SHORT:return new Uint16Array(t);case a.FLOAT:return new Float32Array(t);case a.DOUBLE:return new Float64Array(t);default:throw new n("componentDatatype is not a valid value.")}},a.createArrayBufferView=function(t,r,i,o){switch(i=e(i,0),o=e(o,(r.byteLength-i)/a.getSizeInBytes(t)),t){case a.BYTE:return new Int8Array(r,i,o);case a.UNSIGNED_BYTE:return new Uint8Array(r,i,o);case a.SHORT:return new Int16Array(r,i,o);case a.UNSIGNED_SHORT:return new Uint16Array(r,i,o);case a.FLOAT:return new Float32Array(r,i,o);case a.DOUBLE:return new Float64Array(r,i,o);default:throw new n("componentDatatype is not a valid value.")}},i(a)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,validate:function(e){return e===t.POINTS||e===t.LINES||e===t.LINE_LOOP||e===t.LINE_STRIP||e===t.TRIANGLES||e===t.TRIANGLE_STRIP||e===t.TRIANGLE_FAN}};return e(t)}),define("Core/Geometry",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,n,r,i){"use strict";var a=function(t){t=e(t,e.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=e(t.primitiveType,i.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=e(t.geometryType,r.NONE),this.boundingSphereCV=void 0};return a.computeNumberOfVertices=function(e){var r=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&t(e.attributes[i])&&t(e.attributes[i].values)){var a=e.attributes[i],o=a.values.length/a.componentsPerAttribute;if(r!==o&&-1!==r)throw new n("All attribute lists must have the same number of attributes.");r=o}return r},a}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=e(t.normalize,!1),this.values=t.values};return t}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";var t=function(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.binormal=t.binormal,this.tangent=t.tangent,this.color=t.color};return t}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(t){return e(t)&&(t===i.UNSIGNED_BYTE||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)},i.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},i.createTypedArrayFromArrayBuffer=function(e,t,n,i){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)},n(i)}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,i,a,o){"use strict";var u=function(r,i,a){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(i,e.ZERO)),n(a)?a=e.clone(a):(a=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(a,.5,a)),this.center=a};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var i=t[0].x,a=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,h=1;f>h;h++){var d=t[h],m=d.x,p=d.y,y=d.z;i=Math.min(m,i),s=Math.max(m,s),a=Math.min(p,a),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=i,v.y=a,v.z=o;var g=r.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,r.center);return e.multiplyByScalar(w,.5,w),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),i=n.normal,o=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),u=e.dot(t.center,i)+n.distance;return u-o>0?a.INSIDE:0>u+o?a.OUTSIDE:a.INTERSECTING};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead."); -var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n){this.x=e(t,0),this.y=e(n,0)};a.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new a(e,n)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new a(e.x,e.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y)},a.minimumComponent=function(e){return Math.min(e.x,e.y)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(e,t){return a.normalize(e,s),a.normalize(t,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,l);return a.abs(n,n),t=n.x<=n.y?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Y,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)},a.ZERO=r(new a(0,0)),a.UNIT_X=r(new a(1,0)),a.UNIT_Y=r(new a(0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function n(e,n,r){var i=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(n)))<r?0:i}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,i){var a;if(0===e)return 0===r?[]:[-i/r];if(0===r){if(0===i)return[0,0];var o=Math.abs(i),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(a=-i/e,0>a)return[];var s=Math.sqrt(a);return[-s,s]}if(0===i)return a=-r/e,0>a?[a,0]:[0,a];var c=r*r,l=4*e*i,f=n(c,-l,t.EPSILON14);if(0>f)return[];var h=-.5*n(r,t.sign(r)*Math.sqrt(f),t.EPSILON14);return r>0?[h/e,i/h]:[i/h,h/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var i,a,o=e,u=t/3,s=n/3,c=r,l=o*s,f=u*c,h=u*u,d=s*s,m=o*s-h,p=o*c-u*s,y=u*c-d,v=4*m*y-p*p;if(0>v){var g,w,x;h*f>=l*d?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var E=0>x?-1:1,S=-E*Math.abs(g)*Math.sqrt(-v);a=-x+S;var _=a/2,O=0>_?-Math.pow(-_,1/3):Math.pow(_,1/3),M=a===S?-O:-w/O;return i=0>=w?O+M:-x/(O*O+M*M+w),h*f>=l*d?[(i-u)/o]:[-c/(i+s)]}var P=m,T=-2*u*m+o*p,R=y,C=-c*p+2*s*y,N=Math.sqrt(v),I=Math.sqrt(3)/2,z=Math.abs(Math.atan2(o*N,-T)/3);i=2*Math.sqrt(-P);var A=Math.cos(z);a=i*A;var b=i*(-A/2-I*Math.sin(z)),D=a+b>2*u?a-u:b-u,q=o,U=D/q;z=Math.abs(Math.atan2(c*N,-C)/3),i=2*Math.sqrt(-R),A=Math.cos(z),a=i*A,b=i*(-A/2-I*Math.sin(z));var L=-c,W=2*s>a+b?a+s:b+s,B=L/W,F=q*W,G=-D*W-q*L,k=D*L,j=(s*G-u*k)/(-u*G+s*F);return j>=U?B>=U?B>=j?[U,j,B]:[U,B,j]:[B,U,j]:B>=U?[j,U,B]:B>=j?[j,B,U]:[B,j,U]}var r={};return r.computeDiscriminant=function(e,t,n,r){var i=e*e,a=t*t,o=n*n,u=r*r,s=18*e*t*n*r+a*o-27*i*u-4*(e*o*n+a*t*r);return s},r.computeRealRoots=function(e,r,i,a){var o,u;if(0===e)return t.computeRealRoots(r,i,a);if(0===r){if(0===i){if(0===a)return[0,0,0];u=-a/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===a?(o=t.computeRealRoots(e,0,i),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,i,a)}return 0===i?0===a?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,a):0===a?(o=t.computeRealRoots(e,r,i),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,i,a)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function i(t,i,a,o){var u=t*t,s=i-3*u/8,c=a-i*t/2+u*t/8,l=o-a*t/4+i*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var h=-t/4,d=f[f.length-1];if(Math.abs(d)<n.EPSILON14){var m=r.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[h-w,h-g,h+g,h+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[h-p,h+p];if(0>y&&v>=0)return p=Math.sqrt(v),[h-p,h+p]}return[]}if(d>0){var x=Math.sqrt(d),E=(s+d-c/x)/2,S=(s+d+c/x)/2,_=r.computeRealRoots(1,x,E),O=r.computeRealRoots(1,-x,S);return 0!==_.length?(_[0]+=h,_[1]+=h,0!==O.length?(O[0]+=h,O[1]+=h,_[1]<=O[0]?[_[0],_[1],O[0],O[1]]:O[1]<=_[0]?[O[0],O[1],_[0],_[1]]:_[0]>=O[0]&&_[1]<=O[1]?[O[0],_[0],_[1],O[1]]:O[0]>=_[0]&&O[1]<=_[1]?[_[0],O[0],O[1],_[1]]:_[0]>O[0]&&_[0]<O[1]?[O[0],_[0],O[1],_[1]]:[_[0],O[0],_[1],O[1]]):_):0!==O.length?(O[0]+=h,O[1]+=h,O):[]}}return[]}function a(t,i,a,o){var u=a*a,s=i*i,c=t*t,l=-2*i,f=a*t+s-4*o,h=c*o-a*i*t+u,d=e.computeRealRoots(1,l,f,h);if(d.length>0){var m,p,y=d[0],v=i-y,g=v*v,w=t/2,x=v/2,E=g-4*o,S=g+4*Math.abs(o),_=c-4*y,O=c+4*Math.abs(y);if(0>y||_*S>E*O){var M=Math.sqrt(_);m=M/2,p=0===M?0:(t*x-a)/M}else{var P=Math.sqrt(E);m=0===P?0:(t*x-a)/P,p=P/2}var T,R;0===w&&0===m?(T=0,R=0):n.sign(w)===n.sign(m)?(T=w+m,R=y/T):(R=w-m,T=y/R);var C,N;0===x&&0===p?(C=0,N=0):n.sign(x)===n.sign(p)?(C=x+p,N=o/C):(N=x-p,C=o/N);var I=r.computeRealRoots(1,T,C),z=r.computeRealRoots(1,R,N);if(0!==I.length)return 0!==z.length?I[1]<=z[0]?[I[0],I[1],z[0],z[1]]:z[1]<=I[0]?[z[0],z[1],I[0],I[1]]:I[0]>=z[0]&&I[1]<=z[1]?[z[0],I[0],I[1],z[1]]:z[0]>=I[0]&&z[1]<=I[1]?[I[0],z[0],z[1],I[1]]:I[0]>z[0]&&I[0]<z[1]?[z[0],I[0],z[1],I[1]]:[I[0],z[0],I[1],z[1]]:I;if(0!==z.length)return z}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,i){var a=e*e,o=a*e,u=t*t,s=u*t,c=n*n,l=c*n,f=r*r,h=f*r,d=i*i,m=d*i,p=u*c*f-4*s*h-4*e*l*f+18*e*t*n*h-27*a*f*f+256*o*m+i*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*f+144*a*n*f)+d*(144*e*u*n-27*u*u-128*a*c-192*a*t*r);return p},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,f=u/t,h=s/t,d=0>c?1:0;switch(d+=0>l?d+1:d,d+=0>f?d+1:d,d+=0>h?d+1:d){case 0:return i(c,l,f,h);case 1:return a(c,l,f,h);case 2:return a(c,l,f,h);case 3:return i(c,l,f,h);case 4:return i(c,l,f,h);case 5:return a(c,l,f,h);case 6:return i(c,l,f,h);case 7:return i(c,l,f,h);case 8:return a(c,l,f,h);case 9:return i(c,l,f,h);case 10:return i(c,l,f,h);case 11:return a(c,l,f,h);case 12:return i(c,l,f,h);case 13:return i(c,l,f,h);case 14:return i(c,l,f,h);case 15:return i(c,l,f,h);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,i){return n(i)||(i=new e),i=e.multiplyByScalar(t.direction,r,i),e.add(t.origin,i,i)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,i,a,o,u,s,c){"use strict";function l(t,r,i,o,u){u=n(u,!1);var s,c,l,f,h,d=t.origin,m=t.direction,p=e.subtract(i,r,y),E=e.subtract(o,r,v),S=e.cross(m,E,g),_=e.dot(p,S);if(u){if(_<a.EPSILON6)return void 0;if(s=e.subtract(d,r,w),l=e.dot(s,S),0>l||l>_)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c),0>f||l+f>_)return void 0;h=e.dot(E,c)/_}else{if(Math.abs(_)<a.EPSILON6)return void 0;var O=1/_;if(s=e.subtract(d,r,w),l=e.dot(s,S)*O,0>l||l>1)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c)*O,0>f||l+f>1)return void 0;h=e.dot(E,c)*O}return h}function f(e,t,n,r){var i=t*t-4*e*n;if(0>i)return void 0;if(i>0){var a=1/(2*e),o=Math.sqrt(i),u=(-t+o)*a,s=(-t-o)*a;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function h(t,n,i){r(i)||(i={});var a=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(a,u,g),l=e.dot(o,o),h=2*e.dot(o,c),d=e.magnitudeSquared(c)-s,m=f(l,h,d,S);return r(m)?(i.start=m.root0,i.stop=m.root1,i):void 0}function d(e,t,n){var r=e+t;return a.sign(e)!==a.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function m(t,n,r,i,c){var l,f=i*i,h=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*h,p=c*(i*d(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],a.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*h+i*n.x+r,v=h*d(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],a.EPSILON15),g=c*(i*d(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],E=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(i,c*x,c*-E)),w.push(new e(i,c*x,c*E)),2===l.length){var S=l[1],_=Math.sqrt(Math.max(1-S*S,0));w.push(new e(i,c*S,c*-_)),w.push(new e(i,c*S,c*_))}return w}var O=g*g,M=v*v,P=m*m,T=g*v,R=P+M,C=2*(p*m+T),N=2*y*m+p*p-M+O,I=2*(y*p-T),z=y*y-O;if(0===R&&0===C&&0===N&&0===I)return w;l=s.computeRealRoots(R,C,N,I,z);var A=l.length;if(0===A)return w;for(var b=0;A>b;++b){var D,q=l[b],U=q*q,L=Math.max(1-U,0),W=Math.sqrt(L);D=a.sign(m)===a.sign(y)?d(m*U+y,p*q,a.EPSILON12):a.sign(y)===a.sign(p*q)?d(m*U,p*q+y,a.EPSILON12):d(m*U+p*q,y,a.EPSILON12);var B=d(v*q,g,a.EPSILON15),F=D*B;0>F?w.push(new e(i,c*q,c*W)):F>0?w.push(new e(i,c*q,c*-W)):0!==W?(w.push(new e(i,c*q,c*-W)),w.push(new e(i,c*q,c*W)),++b):w.push(new e(i,c*q,c*W))}return w}var p={};p.rayPlane=function(t,n,i){r(i)||(i=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(i=e.multiplyByScalar(u,l,i),e.add(o,i,i))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,n,i,a,o,u){var s=l(t,n,i,a,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var E=new c;p.lineSegmentTriangle=function(t,n,i,a,o,u,s){var c=E;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,i,a,o,u);return!r(f)||0>f||f>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var S={root0:0,root1:0};p.raySphere=function(e,t,n){return n=h(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var _=new c;p.lineSegmentSphere=function(t,n,i,a){var o=_;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),a=h(o,i,a),!r(a)||a.stop<0||a.start>s?void 0:(a.start=Math.max(a.start,0),a.stop=Math.min(a.stop,s),a)};var O=new e,M=new e;p.rayEllipsoid=function(t,n){var r,i,a,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,O),l=e.multiplyComponents(s,t.direction,M),f=e.magnitudeSquared(c),h=e.dot(c,l);if(f>1){if(h>=0)return void 0;var d=h*h;if(r=f-1,i=e.magnitudeSquared(l),a=i*r,a>d)return void 0;if(d>a){o=h*h-a,u=-h+Math.sqrt(o);var m=u/i,p=r/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(r/i);return{start:y,stop:y}}return 1>f?(r=f-1,i=e.magnitudeSquared(l),a=i*r,o=h*h-a,u=-h+Math.sqrt(o),{start:0,stop:u/i}):0>h?(i=e.magnitudeSquared(l),{start:0,stop:-h/i}):void 0};var P=new e,T=new e,R=new e,C=new e,N=new e,I=new o,z=new o,A=new o,b=new o,D=new o,q=new o,U=new o,L=new e,W=new e,B=new t;p.grazingAltitudeLocation=function(t,n){var i=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(i,P);if(e.dot(u,s)>=0)return i;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,P),f=e.normalize(l,l),h=e.mostOrthogonalAxis(l,C),d=e.normalize(e.cross(h,f,T),T),p=e.normalize(e.cross(f,d,R),R),y=I;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=d.x,y[4]=d.y,y[5]=d.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,z),g=o.fromScale(n.radii,A),w=o.fromScale(n.oneOverRadii,b),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var E,S,_=o.multiply(o.multiply(v,w,q),x,q),O=o.multiply(o.multiply(_,g,U),y,U),M=o.multiplyByVector(_,i,N),F=m(O,e.negate(M,P),0,0,1),G=F.length;if(G>0){for(var k=e.clone(e.ZERO,W),j=Number.NEGATIVE_INFINITY,H=0;G>H;++H){E=o.multiplyByVector(g,o.multiplyByVector(y,F[H],L),L);var Y=e.normalize(e.subtract(E,i,C),C),V=e.dot(Y,u);V>j&&(j=V,k=e.clone(E,k))}var Z=n.cartesianToCartographic(k,B);return j=a.clamp(j,0,1),S=e.magnitude(e.subtract(k,i,C))*Math.sqrt(1-j*j),S=c?-S:S,Z.height=S,n.cartographicToCartesian(Z,new e)}return void 0};var F=new e;return p.lineSegmentPlane=function(t,n,i,o){r(o)||(o=new e);var u=e.subtract(n,t,F),s=i.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON6)return void 0;var l=e.dot(s,t),f=-(i.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,n,r,i){var a=i.normal,o=i.distance,u=e.dot(a,t)+o<0,s=e.dot(a,n)+o<0,c=e.dot(a,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,h;if((1===l||2===l)&&(f=new e,h=new e),1===l){if(u)return p.lineSegmentPlane(t,n,i,f),p.lineSegmentPlane(t,r,i,h),{positions:[t,n,r,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,i,f),p.lineSegmentPlane(n,t,i,h),{positions:[t,n,r,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,i,f),p.lineSegmentPlane(r,n,i,h),{positions:[t,n,r,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,i,f),p.lineSegmentPlane(r,t,i,h),{positions:[t,n,r,f,h],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,i,f),p.lineSegmentPlane(t,n,i,h),{positions:[t,n,r,f,h],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,i,f),p.lineSegmentPlane(n,r,i,h),{positions:[t,n,r,f,h],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,i){return t(e).then(n,r,i)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=i(e),t}function n(t){return e(t,a)}function r(e){this.then=e}function i(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return a(r)}});return n}function a(e){var n=new r(function(n,r){try{return r?t(r(e)):a(e)}catch(i){return a(i)}});return n}function o(){function e(e,t,n){return h(e,t,n)}function n(e){return m(e)}function i(e){return m(a(e))}function u(e){return d(e)}var s,c,l,f,h,d,m;return c=new r(e),s={then:e,resolve:n,reject:i,progress:u,promise:c,resolver:{resolve:n,reject:i,progress:u}},l=[],f=[],h=function(e,t,n){var r,i;return r=o(),i="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,i)}),f.push(i),r.promise},d=function(e){return p(f,e),e},m=function(e){return e=t(e),h=e.then,m=t,d=v,p(l,e),f=l=E,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,i,a){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,f,h,d,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(n,g)),f=[],l=g-c+1,h=[],d=o(),c)for(y=d.progress,p=function(e){h.push(e),--l||(m=p=v,d.reject(h))},m=function(e){f.push(e),--c||(m=p=v,d.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else d.resolve(f);return d.then(r,i,a)})}function c(e,t,n,r){function i(e){return t?t(e[0]):e[0]}return s(e,1,i,n,r)}function l(e,t,n,r){return y(1,arguments),h(e,g).then(t,n,r)}function f(){return h(arguments,g)}function h(t,n){return e(t,function(t){var r,i,a,u,s,c;if(a=i=t.length>>>0,r=[],c=o(),a)for(u=function(t,i){e(t,n).then(function(e){r[i]=e,--a||c.resolve(r)},c.reject)},s=0;i>s;s++)s in t?u(t[s],s):--a;else c.resolve(r);return c.promise})}function d(t,n){var r=x.call(arguments,1);return e(t,function(t){var i;return i=t.length,r[0]=function(t,r,a){return e(t,function(t){return e(r,function(e){return n(t,e,a,i)})})},w.apply(t,r)})}function m(t,n,r){var i=arguments.length>2;return e(t,function(e){return e=i?r:e,n.resolve(e),e},function(e){return n.reject(e),a(e)},n.progress)}function p(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function g(e){return e}var w,x,E;return e.defer=o,e.resolve=t,e.reject=n,e.join=f,e.all=l,e.map=h,e.reduce=d,e.any=c,e.some=s,e.chain=m,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(E,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(E,t)})})}},x=[].slice,w=[].reduce||function(e){var t,n,r,i,a;if(a=0,t=Object(this),i=t.length>>>0,n=arguments,n.length<=1)for(;;){if(a in t){r=t[a++];break}if(++a>=i)throw new TypeError}else r=n[1];for(;i>a;++a)a in t&&(r=e(r,t[a],a,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,i,a=0,o=e.length-1;o>=a;)if(r=~~((a+o)/2),i=n(e[r],t),0>i)a=r+1;else{if(!(i>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,i){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=i};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],i=function(e,t,n,r){n||(n=" ");var i=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+i:i+e},a=function(e,t,n,r,a,o){var u=r-e.length;return u>0&&(e=n||!a?i(e,r,o,n):e.slice(0,t.length)+i("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+i(c.toString(t),u||0,"0",!1),a(e,n,r,o,s)},u=function(e,t,n,r,i,o){return null!=r&&(e=e.slice(0,r)),a(e,"",t,n,i,o)},s=function(e,r,s,c,l,f,h){var d,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,E=!1,S=" ",_=s.length,O=0;s&&_>O;O++)switch(s.charAt(O)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":S=s.charAt(O+1);break;case"0":x=!0;break;case"#":E=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[n++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(h)>-1?6:"d"==h?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],h){case"s":return u(String(v),g,c,f,x,S);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,E,g,c,f,x);case"o":return o(v,8,E,g,c,f,x);case"x":return o(v,16,E,g,c,f,x);case"X":return o(v,16,E,g,c,f,x).toUpperCase();case"u":return o(v,10,E,g,c,f,x);case"i":case"d":return d=+v||0,d=Math.round(d-d%1),m=0>d?"-":w,v=m+i(String(Math.abs(d)),f,"0",!1),a(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return d=+v,m=0>d?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(h.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(h)%2],v=m+Math.abs(d)[p](f),a(v,m,g,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,i,a,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=i,this.second=a,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,i,a,o,u,s,c){"use strict";function l(e,t){return C.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var n=C.leapSeconds,r=t(n,g,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var i=n[r].offset;if(r>0){var a=C.secondsDifference(n[r].julianDate,e);a>i&&(r--,i=n[r].offset)}C.addSeconds(e,i,e)}function h(e,n){g.julianDate=e;var r=C.leapSeconds,i=t(r,g,l);if(0>i&&(i=~i),0===i)return C.addSeconds(e,-r[0].offset,n);if(i>=r.length)return C.addSeconds(e,-r[i-1].offset,n);var a=C.secondsDifference(r[i].julianDate,e);return 0===a?C.addSeconds(e,-r[i].offset,n):1>=a?void 0:C.addSeconds(e,-r[--i].offset,n)}function d(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function m(e,t,n,r,i,a,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var f=a+(r*s.SECONDS_PER_HOUR+i*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var p=new a,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,E=/^(\d{4})-?(\d{3})$/,S=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,_=/^(\d{4})-?(\d{2})-?(\d{2})$/,O=/([Z+\-])?(\d{2})?:?(\d{2})?$/,M=/^(\d{2})(\.\d+)?/.source+O.source,P=/^(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,T=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,R="Invalid ISO 8601 date.",C=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var i=0|e;t+=(e-i)*s.SECONDS_PER_DAY,d(i,t,this),r===c.UTC&&f(this)};C.fromDate=function(e,t){var n=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(d(n[0],n[1],t),f(t),t):new C(n[0],n[1],c.UTC)},C.fromIso8601=function(e,t){e=e.replace(",",".");var n,a,u,s=e.split("T"),l=1,h=1,p=0,g=0,O=0,N=0,I=s[0],z=s[1];if(!r(I))throw new i(R);var A;if(s=I.match(_),null!==s){if(A=I.split("-").length-1,A>0&&2!==A)throw new i(R);n=+s[1],l=+s[2],h=+s[3]}else if(s=I.match(x),null!==s)n=+s[1],l=+s[2];else if(s=I.match(w),null!==s)n=+s[1];else{var b;if(s=I.match(E),null!==s){if(n=+s[1],b=+s[2],u=o(n),1>b||u&&b>366||!u&&b>365)throw new i(R)}else{if(s=I.match(S),null===s)throw new i(R);n=+s[1];var D=+s[2],q=+s[3]||0;if(A=I.split("-").length-1,A>0&&(!r(s[3])&&1!==A||r(s[3])&&2!==A))throw new i(R);var U=new Date(Date.UTC(n,0,4));b=7*D+q-U.getUTCDay()-3}a=new Date(Date.UTC(n,0,1)),a.setUTCDate(b),l=a.getUTCMonth()+1,h=a.getUTCDate()}if(u=o(n),1>l||l>12||1>h||(2!==l||!u)&&h>y[l-1]||u&&2===l&&h>v)throw new i(R);var L;if(r(z)){if(s=z.match(T),null!==s){if(A=z.split(":").length-1,A>0&&2!==A&&3!==A)throw new i(R);p=+s[1],g=+s[2],O=+s[3],N=1e3*+(s[4]||0),L=5}else if(s=z.match(P),null!==s){if(A=z.split(":").length-1,A>0&&1!==A)throw new i(R);p=+s[1],g=+s[2],O=60*+(s[3]||0),L=4}else{if(s=z.match(M),null===s)throw new i(R);p=+s[1],g=60*+(s[2]||0),L=3}if(g>=60||O>=61||p>24||24===p&&(g>0||O>0||N>0))throw new i(R);var W=s[L],B=+s[L+1],F=+(s[L+2]||0);switch(W){case"+":p-=B,g-=F;break;case"-":p+=B,g+=F;break;case"Z":break;default:g+=new Date(Date.UTC(n,l-1,h,p,g)).getTimezoneOffset()}}else g+=new Date(n,l-1,h).getTimezoneOffset();var G=60===O;for(G&&O--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,h++;for(a=u&&2===l?v:y[l-1];h>a;)h-=a,l++,l>12&&(l-=12,n++),a=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,h--;for(;1>h;)l--,1>l&&(l+=12,n--),a=u&&2===l?v:y[l-1],h+=a;var k=m(n,l,h,p,g,O,N);return r(t)?(d(k[0],k[1],t),f(t)):t=new C(k[0],k[1],c.UTC),G&&C.addSeconds(t,1,t),t},C.now=function(e){return C.fromDate(new Date,e)};var N=new C(0,0,c.TAI);return C.toGregorianDate=function(e,t){var n=!1,i=h(e,N);r(i)||(C.addSeconds(e,-1,N),i=h(N,N),n=!0);var o=i.dayNumber,u=i.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var d=0|80*c/2447,m=0|c-(0|2447*d/80);c=0|d/11;var p=0|d+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,E=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=E,t.isLeapSecond=n,t):new a(y,p,m,v,w,x,E,n)},C.toDate=function(e){var t=C.toGregorianDate(e,p),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},C.toIso8601=function(t,n){var i,a=C.toGregorianDate(t,a);return r(n)||0===a.millisecond?r(n)&&0!==n?(i=(.01*a.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",a.year,a.month,a.day,a.hour,a.minute,a.second,i)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",a.year,a.month,a.day,a.hour,a.minute,a.second):(i=(.01*a.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",a.year,a.month,a.day,a.hour,a.minute,a.second,i))},C.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new C(e.dayNumber,e.secondsOfDay,c.TAI):void 0},C.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},C.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},C.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(C.secondsDifference(e,t))<=n},C.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},C.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},C.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},C.computeTaiMinusUtc=function(e){g.julianDate=e;var n=C.leapSeconds,r=t(n,g,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},C.addSeconds=function(e,t,n){return d(e.dayNumber,e.secondsOfDay+t,n)},C.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return d(e.dayNumber,r,n)},C.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return d(e.dayNumber,r,n)},C.addDays=function(e,t,n){var r=e.dayNumber+t;return d(r,e.secondsOfDay,n)},C.lessThan=function(e,t){return C.compare(e,t)<0},C.lessThanOrEquals=function(e,t){return C.compare(e,t)<=0},C.greaterThan=function(e,t){return C.compare(e,t)>0},C.greaterThanOrEquals=function(e,t){return C.compare(e,t)>=0},C.prototype.clone=function(e){return C.clone(this,e)},C.prototype.equals=function(e){return C.equals(this,e)},C.prototype.equalsEpsilon=function(e,t){return C.equalsEpsilon(this,e,t)},C.prototype.toString=function(){return C.toIso8601(this)},C.leapSeconds=[new u(new C(2441317,43210,c.TAI),10),new u(new C(2441499,43211,c.TAI),11),new u(new C(2441683,43212,c.TAI),12),new u(new C(2442048,43213,c.TAI),13),new u(new C(2442413,43214,c.TAI),14),new u(new C(2442778,43215,c.TAI),15),new u(new C(2443144,43216,c.TAI),16),new u(new C(2443509,43217,c.TAI),17),new u(new C(2443874,43218,c.TAI),18),new u(new C(2444239,43219,c.TAI),19),new u(new C(2444786,43220,c.TAI),20),new u(new C(2445151,43221,c.TAI),21),new u(new C(2445516,43222,c.TAI),22),new u(new C(2446247,43223,c.TAI),23),new u(new C(2447161,43224,c.TAI),24),new u(new C(2447892,43225,c.TAI),25),new u(new C(2448257,43226,c.TAI),26),new u(new C(2448804,43227,c.TAI),27),new u(new C(2449169,43228,c.TAI),28),new u(new C(2449534,43229,c.TAI),29),new u(new C(2450083,43230,c.TAI),30),new u(new C(2450630,43231,c.TAI),31),new u(new C(2451179,43232,c.TAI),32),new u(new C(2453736,43233,c.TAI),33),new u(new C(2454832,43234,c.TAI),34),new u(new C(2456109,43235,c.TAI),35),new u(new C(2457204,43236,c.TAI),36)],C}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var i=new n.constructor;for(var a in n)if(n.hasOwnProperty(a)){var o=n[a];r&&(o=t(o,r)),i[a]=o}return i};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var i=n[r],a=i.indexOf(": ");if(a>0){var o=i.substring(0,a),u=i.substring(a+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,i,a){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return r}function s(e,n){n=t(n,"");var i=e[1],a=!!e[2],s=e[3];switch(n){case"":case"text":return o(a,s);case"arraybuffer":return u(a,s);case"blob":var c=u(a,s);return new Blob([c],{type:i});case"document":var l=new DOMParser;return l.parseFromString(o(a,s),i);case"json":return JSON.parse(o(a,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,i=t(n.method,"GET"),a=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,i,a,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,f){var h=l.exec(e);if(null!==h)return c.resolve(s(h,t)),void 0;var d=new XMLHttpRequest;if(n(f)&&n(d.overrideMimeType)&&d.overrideMimeType(f),d.open(r,e,!0),n(u))for(var m in u)u.hasOwnProperty(m)&&d.setRequestHeader(m,u[m]);n(t)&&(d.responseType=t),d.onload=function(){200===d.status?n(d.response)?c.resolve(d.response):n(d.responseXML)&&d.responseXML.hasChildNodes()?c.resolve(d.responseXML):n(d.responseText)?c.resolve(d.responseText):c.reject(new a("unknown XMLHttpRequest response type.")):c.reject(new i(d.status,d.response,d.getAllResponseHeaders()))},d.onerror=function(){c.reject(new i)},d.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var i={Accept:"application/json,*/*;q=0.01"},a=function(n,a){return t(a)?t(a.Accept)||(a=e(a),a.Accept=i.Accept):a=i,r(n,a).then(function(e){return JSON.parse(e) -})};return a}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,i,a,o,u,s,c,l,f){"use strict";function h(e,t){return o.compare(e.julianDate,t)}function d(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var i=n.columnNames.indexOf("modifiedJulianDateUtc"),a=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),d=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>i||0>a||0>s||0>c||0>d||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=i,e._xPoleWanderRadiansColumn=a,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=d,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,E=y.length;E>x;x+=e._columnCount){var S=y[x+i],_=y[x+p],O=S+l.MODIFIED_JULIAN_DATE_DIFFERENCE,M=new o(O,_,f.TAI);if(v.push(M),w){if(_!==g&&r(g)){var P=o.leapSeconds,T=t(P,M,h);if(0>T){var R=new u(M,_);P.splice(~T,0,R)}}g=_}}}function m(e,t,n,r,i){var a=n*r;i.xPoleWander=t[a+e._xPoleWanderRadiansColumn],i.yPoleWander=t[a+e._yPoleWanderRadiansColumn],i.xPoleOffset=t[a+e._xCelestialPoleOffsetRadiansColumn],i.yPoleOffset=t[a+e._yCelestialPoleOffsetRadiansColumn],i.ut1MinusUtc=t[a+e._ut1MinusUtcSecondsColumn]}function p(e,t,n){return t+e*(n-t)}function y(e,t,n,r,i,a,u){var s=e._columnCount;if(a>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u;var c=t[i],l=t[a];if(c.equals(l)||r.equals(c))return m(e,n,i,s,u),u;if(r.equals(l))return m(e,n,a,s,u),u;var f=o.secondsDifference(r,c)/o.secondsDifference(l,c),h=i*s,d=a*s,y=n[h+e._ut1MinusUtcSecondsColumn],v=n[d+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=n[h+e._taiMinusUtcSecondsColumn],x=n[d+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(r)?y=v:v-=x-w)}return u.xPoleWander=p(f,n[h+e._xPoleWanderRadiansColumn],n[d+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(f,n[h+e._yPoleWanderRadiansColumn],n[d+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(f,n[h+e._xCelestialPoleOffsetRadiansColumn],n[d+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(f,n[h+e._yCelestialPoleOffsetRadiansColumn],n[d+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(f,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))d(this,t.data);else if(r(t.url)){var i=this;this._downloadPromise=e(s(t.url),function(e){d(i,e)},function(){i._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else d(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=a({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new i(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new i(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var a=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var f=a[u],h=a[u+1],d=o.lessThanOrEquals(f,e),m=!r(h),p=m||o.greaterThanOrEquals(h,e);if(d&&p)return s=u,!m&&h.equals(e)&&++s,l=s+1,y(this,a,this._samples,e,s,l,n),n}var v=t(a,e,o.compare,this._dateColumn);return v>=0?(v<a.length-1&&a[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,a,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return a.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(i,t)),this.path&&(this.path=this.path.replace(i,t)),this.query&&(this.query=this.query.replace(i,t)),this.fragment&&(this.fragment=this.fragment.replace(i,t))};var i=/%[0-9a-z]{2}/gi,a=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function i(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),i=f.exec(r);if(null!==i)return i[1]}return void 0}function a(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:i(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(a()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,h=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return h._cesiumScriptRegex=f,h.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},h}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,i,a,o,u){"use strict";function s(e,t,n){var r=f;return r.dayNumber=t,r.secondsOfDay=n,a.daysDifference(r,e._sampleZeroDateTT)}function c(n,i){if(n._chunkDownloadsInProgress[i])return n._chunkDownloadsInProgress[i];var a=e.defer();n._chunkDownloadsInProgress[i]=a;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",i):t("Assets/IAU2006_XYS/IAU2006_XYS_"+i+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[i]=!1;for(var t=n._samples,r=e.samples,o=3*i*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];a.resolve()}),a.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new a(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,i[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new a(0,0,u.TAI);return l.prototype.preload=function(t,n,r,i){var a=s(this,t,n),o=s(this,r,i),u=0|a/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,h=0|l/this._samplesPerXysFile,d=[],m=f;h>=m;++m)d.push(c(this,m));return e.all(d)},l.prototype.computeXysRadians=function(e,t,n){var a=s(this,e,t);if(0>a)return void 0;var o=0|a/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var h=!1,d=this._samples;if(r(d[3*l])||(c(this,0|l/this._samplesPerXysFile),h=!0),r(d[3*f])||(c(this,0|f/this._samplesPerXysFile),h=!0),h)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new i(0,0,0);var m,p,y=a-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var E=3*(l+m);n.x+=w[m]*d[E++],n.y+=w[m]*d[E++],n.s+=w[m]*d[E]}return n},l}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)},c=new e;s.fromAxisAngle=function(t,r,i){var a=r/2,o=Math.sin(a);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,h=Math.cos(a);return n(i)?(i.x=u,i.y=l,i.z=f,i.w=h,i):new s(u,l,f,h)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var r,i,a,o,c,h=e[u.COLUMN0ROW0],d=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=h+d+m;if(p>0)r=Math.sqrt(p+1),c=.5*r,r=.5/r,i=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,a=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;d>h&&(v=1),m>h&&m>d&&(v=2);var g=y[v],w=y[g];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,i=-x[0],a=-x[1],o=-x[2]}return n(t)?(t.x=i,t.y=a,t.z=o,t.w=c,t):new s(i,a,o,c)};var h=new s;s.fromHeadingPitchRoll=function(t,n,r,i){var a=s.fromAxisAngle(e.UNIT_X,r,h),o=s.fromAxisAngle(e.UNIT_Y,-n,i);i=s.multiply(o,a,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,h);return s.multiply(u,i,i)};var d=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.x=e[r],i.y=e[r+1],i.z=e[r+2],i.w=e[r+3],i},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var i=0,a=n-t+1;a>i;i++){var o=3*i;s.unpack(e,4*(t+i),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,d);var u=s.computeAngle(p);r[o]=d.x*u,r[o+1]=d.y*u,r[o+2]=d.z*u}},s.unpackInterpolationResult=function(t,r,i,a,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*a,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,i=e.y*n,a=e.z*n,o=e.w*n;return t.x=r,t.y=i,t.z=a,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+r*l+i*c-a*s,h=o*s-r*c+i*l+a*u,d=o*c+r*s-i*u+a*l,m=o*l-r*u-i*s-a*c;return n.x=f,n.y=h,n.z=d,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,n,r){return g=s.multiplyByScalar(t,n,g),r=s.multiplyByScalar(e,1-n,r),s.add(g,r,r)};var w=new s,x=new s,E=new s;s.slerp=function(e,t,n,r){var i=s.dot(e,t),a=t;if(0>i&&(i=-i,a=w=s.negate(t,w)),1-i<o.EPSILON6)return s.lerp(e,a,n,r);var u=Math.acos(i);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),E=s.multiplyByScalar(a,Math.sin(n*u),E),r=s.add(x,E,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),i=0;return 0!==r&&(i=r/Math.sin(r)),e.multiplyByScalar(t,i,n)},s.exp=function(t,n){var r=e.magnitude(t),i=0;return 0!==r&&(i=Math.sin(r)/r),n.x=t.x*i,n.y=t.y*i,n.z=t.z*i,n.w=Math.cos(r),n};var S=new e,_=new e,O=new s,M=new s;s.computeInnerQuadrangle=function(t,n,r,i){var a=s.conjugate(n,O);s.multiply(a,r,M);var o=s.log(M,S);s.multiply(a,t,M);var u=s.log(M,_);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,O),s.multiply(n,O,i)},s.squad=function(e,t,n,r,i,a){var o=s.slerp(e,t,i,O),u=s.slerp(n,r,i,M);return s.slerp(o,u,2*i*(1-i),a)};for(var P=new s,T=1.9011074535173003,R=i.supportsTypedArrays()?new Float32Array(8):[],C=i.supportsTypedArrays()?new Float32Array(8):[],N=i.supportsTypedArrays()?new Float32Array(8):[],I=i.supportsTypedArrays()?new Float32Array(8):[],z=0;7>z;++z){var A=z+1,b=2*A+1;R[z]=1/(A*b),C[z]=A/b}return R[7]=T/136,C[7]=8*T/17,s.fastSlerp=function(e,t,n,r){var i,a=s.dot(e,t);a>=0?i=1:(i=-1,a=-a);for(var o=a-1,u=1-n,c=n*n,l=u*u,f=7;f>=0;--f)N[f]=(R[f]*c-C[f])*o,I[f]=(R[f]*l-C[f])*o;var h=i*n*(1+N[0]*(1+N[1]*(1+N[2]*(1+N[3]*(1+N[4]*(1+N[5]*(1+N[6]*(1+N[7])))))))),d=u*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),m=s.multiplyByScalar(e,d,P);return s.multiplyByScalar(t,h,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,i,a){var o=s.fastSlerp(e,t,i,O),u=s.fastSlerp(n,r,i,M);return s.fastSlerp(o,u,2*i*(1-i),a)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,i,a,o,u,s,c,l,f,h,d,m,p,y,v){"use strict";var g={},w=new n,x=new n,E=new n;g.eastNorthUpToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var S=new n,_=new n,O=new n;g.northEastDownToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=S,s=_,l=O;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=E;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var M=new y,P=new n(1,1,1),T=new p;g.headingPitchRollToFixedFrame=function(e,t,r,i,a,o){var u=y.fromHeadingPitchRoll(t,r,i,M),s=p.fromTranslationQuaternionRotationScale(n.ZERO,u,P,T);return o=g.eastNorthUpToFixedFrame(e,a,o),p.multiply(o,s,o)};var R=new p,C=new m;g.headingPitchRollQuaternion=function(e,t,n,r,i,a){var o=g.headingPitchRollToFixedFrame(e,t,n,r,i,R),u=p.getRotation(o,C);return y.fromRotationMatrix(u,a)};var N=24110.54841,I=8640184.812866,z=.093104,A=-62e-7,b=1.1772758384668e-19,D=72921158553e-15,q=d.TWO_PI/86400,U=new h;g.computeTemeToPseudoFixedMatrix=function(e,t){U=h.addSeconds(e,-h.computeTaiMinusUtc(e),U);var n,r=U.dayNumber,i=U.secondsOfDay,o=r-2451545;n=i>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=N+n*(I+n*(z+n*A)),s=u*q%d.TWO_PI,c=D+b*(r-2451545.5),l=(i+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,p=Math.cos(f),y=Math.sin(f);return a(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var L=32.184,W=2451545;g.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+L,i=t.stop.dayNumber,a=t.stop.secondsOfDay+L,o=g.iau2006XysData.preload(n,r,i,a),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){a(t)||(t=new m);var n=g.computeFixedToIcrfMatrix(e,t);return a(n)?m.transpose(n,t):void 0};var B=new f(0,0,0),F=new s(0,0,0,0,0,0),G=new m,k=new m;g.computeFixedToIcrfMatrix=function(e,t){a(t)||(t=new m);var n=g.earthOrientationParameters.compute(e,F);if(!a(n))return void 0;var r=e.dayNumber,i=e.secondsOfDay+L,o=g.iau2006XysData.computeXysRadians(r,i,B);if(!a(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=G;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=m.fromRotationZ(-o.s,k),p=m.multiply(l,f,G),y=e.dayNumber,w=e.secondsOfDay-h.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,E=w/v.SECONDS_PER_DAY,S=.779057273264+E+.00273781191135448*(x+E);S=S%1*d.TWO_PI;var _=m.fromRotationZ(S,k),O=m.multiply(p,_,G),M=Math.cos(n.xPoleWander),P=Math.cos(n.yPoleWander),T=Math.sin(n.xPoleWander),R=Math.sin(n.yPoleWander),C=r-W+i/v.SECONDS_PER_DAY;C/=36525;var N=-47e-6*C*d.RADIANS_PER_DEGREE/3600,I=Math.cos(N),z=Math.sin(N),A=k;return A[0]=M*I,A[1]=M*z,A[2]=T,A[3]=-P*z+R*T*I,A[4]=P*I+R*T*z,A[5]=-R*M,A[6]=-R*z-P*T*I,A[7]=R*I-P*T*z,A[8]=P*M,m.multiply(O,A,t)};var j=new r;g.pointToWindowCoordinates=function(e,t,n,r){return r=g.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},g.pointToGLWindowCoordinates=function(e,n,i,o){a(o)||(o=new t);var u=j;return p.multiplyByVector(e,r.fromElements(i.x,i.y,i.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var H=new n,Y=new n,V=new n;return g.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=i(r,c.WGS84).geodeticSurfaceNormal(e,H),s=n.cross(t,u,Y);n.equalsEpsilon(s,n.ZERO,d.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,V);return n.cross(t,l,s),n.negate(s,s),a(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,i,a,o,u,s,c,l,f,h,d,m){"use strict";var p=new r,y=function(e,t){t=i(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(f.getColumn(r,0,p)),this._yAxis=n.fromCartesian4(f.getColumn(r,1,p));var a=n.fromCartesian4(f.getColumn(r,2,p));this._plane=h.fromPointNormal(e,a)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var g=new d,w=new n;y.prototype.projectPointOntoPlane=function(e,r){var i=g;i.origin=e,n.normalize(e,i.direction);var o=c.rayPlane(i,this._plane,w);if(a(o)||(n.negate(i.direction,i.direction),o=c.rayPlane(i,this._plane,w)),a(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return a(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){a(t)||(t=[]);for(var n=0,r=e.length,i=0;r>i;i++){var o=this.projectPointOntoPlane(e[i],t[n]);a(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){a(r)||(r=new t);var i=g;i.origin=e,n.clone(this._plane.normal,i.direction);var o=c.rayPlane(i,this._plane,w);a(o)||(n.negate(i.direction,i.direction),o=c.rayPlane(i,this._plane,w));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){a(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;a(t)?t.length=r:t=new Array(r);for(var i=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var f=e[l];n.multiplyByScalar(u,f.x,c),a(t[l])||(t[l]=new n);var h=n.add(o,c,t[l]);n.multiplyByScalar(s,f.y,c),n.add(h,c,h),i.scaleToGeocentricSurface(h,h)}return t},y}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=new t,i=new t,a=new t,o=function(o,u,s,c,l){n(l)||(l=new t);var f,h,d,m,p,y,v,g;n(u.z)?(f=t.subtract(s,u,r),h=t.subtract(c,u,i),d=t.subtract(o,u,a),m=t.dot(f,f),p=t.dot(f,h),y=t.dot(f,d),v=t.dot(h,h),g=t.dot(h,d)):(f=e.subtract(s,u,r),h=e.subtract(c,u,i),d=e.subtract(o,u,a),m=e.dot(f,f),p=e.dot(f,h),y=e.dot(f,d),v=e.dot(h,h),g=e.dot(h,d));var w=1/(m*v-p*p);return l.y=(v*y-p*g)*w,l.z=(m*g-p*y)*w,l.x=1-l.y-l.z,l};return o}),define("Core/pointInsideTriangle",["./barycentricCoordinates","./Cartesian3"],function(e,t){"use strict";var n=new t,r=function(t,r,i,a){return e(t,r,i,a,n),n.x>0&&n.y>0&&n.z>0};return r}),define("Core/EllipsoidGeodesic",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,t,n,r,i,a,o,u){"use strict";function s(e){var t=e._uSquared,n=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,i=(n-r)/n,a=Math.cos(e._startHeading),o=Math.sin(e._startHeading),u=(1-i)*Math.tan(e._start.latitude),s=1/Math.sqrt(1+u*u),c=s*u,l=Math.atan2(u,a),f=s*o,h=f*f,d=1-h,m=Math.sqrt(d),p=t/4,y=p*p,v=y*p,g=y*y,w=1+p-3*y/4+5*v/4-175*g/64,x=1-p+15*y/8-35*v/8,E=1-3*p+35*y/4,S=1-5*p,_=w*l-x*Math.sin(2*l)*p/2-E*Math.sin(4*l)*y/16-S*Math.sin(6*l)*v/48-5*Math.sin(8*l)*g/512,O=e._constants;O.a=n,O.b=r,O.f=i,O.cosineHeading=a,O.sineHeading=o,O.tanU=u,O.cosineU=s,O.sineU=c,O.sigma=l,O.sineAlpha=f,O.sineSquaredAlpha=h,O.cosineSquaredAlpha=d,O.cosineAlpha=m,O.u2Over4=p,O.u4Over16=y,O.u6Over64=v,O.u8Over256=g,O.a0=w,O.a1=x,O.a2=E,O.a3=S,O.distanceRatio=_}function c(e,t){return e*t*(4+e*(4-3*t))/16}function l(e,t,n,r,i,a,o){var u=c(e,n);return(1-u)*e*t*(r+u*i*(o+u*a*(2*o*o-1)))}function f(e,t,n,r,i,a,o){var s,c,f,h,d,m=(t-n)/t,p=a-r,y=Math.atan((1-m)*Math.tan(i)),v=Math.atan((1-m)*Math.tan(o)),g=Math.cos(y),w=Math.sin(y),x=Math.cos(v),E=Math.sin(v),S=g*x,_=g*E,O=w*E,M=w*x,P=p,T=u.TWO_PI,R=Math.cos(P),C=Math.sin(P);do{R=Math.cos(P),C=Math.sin(P);var N=_-M*R;f=Math.sqrt(x*x*C*C+N*N),c=O+S*R,s=Math.atan2(f,c);var I;0===f?(I=0,h=1):(I=S*C/f,h=1-I*I),T=P,d=c-2*O/h,isNaN(d)&&(d=0),P=p+l(m,I,h,s,f,c,d)}while(Math.abs(P-T)>u.EPSILON12);var z=h*(t*t-n*n)/(n*n),A=1+z*(4096+z*(z*(320-175*z)-768))/16384,b=z*(256+z*(z*(74-47*z)-128))/1024,D=d*d,q=b*f*(d+b*(c*(2*D-1)-b*d*(4*f*f-3)*(4*D-3)/6)/4),U=n*A*(s-q),L=Math.atan2(x*C,_-M*R),W=Math.atan2(g*C,_*R-M);e._distance=U,e._startHeading=L,e._endHeading=W,e._uSquared=z}function h(n,r,i,a){e.normalize(a.cartographicToCartesian(r,m),d),e.normalize(a.cartographicToCartesian(i,m),m),f(n,a.maximumRadius,a.minimumRadius,r.longitude,r.latitude,i.longitude,i.latitude),n._start=t.clone(r,n._start),n._end=t.clone(i,n._end),n._start.height=0,n._end.height=0,s(n)}var d=new e,m=new e,p=function(e,i,a){var u=n(a,o.WGS84);this._ellipsoid=u,this._start=new t,this._end=new t,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,r(e)&&r(i)&&h(this,e,i,u)};return i(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),p.prototype.setEndPoints=function(e,t){h(this,e,t,this._ellipsoid)},p.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},p.prototype.interpolateUsingSurfaceDistance=function(e,n){var i=this._constants,a=i.distanceRatio+e/i.b,o=Math.cos(2*a),u=Math.cos(4*a),s=Math.cos(6*a),c=Math.sin(2*a),f=Math.sin(4*a),h=Math.sin(6*a),d=Math.sin(8*a),m=a*a,p=a*m,y=i.u8Over256,v=i.u2Over4,g=i.u6Over64,w=i.u4Over16,x=2*p*y*o/3+a*(1-v+7*w/4-15*g/4+579*y/64-(w-15*g/4+187*y/16)*o-(5*g/4-115*y/16)*u-29*y*s/16)+(v/2-w+71*g/32-85*y/16)*c+(5*w/16-5*g/4+383*y/96)*f-m*((g-11*y/2)*c+5*y*f/2)+(29*g/96-29*y/16)*h+539*y*d/1536,E=Math.asin(Math.sin(x)*i.cosineAlpha),S=Math.atan(i.a/i.b*Math.tan(E));x-=i.sigma;var _=Math.cos(2*i.sigma+x),O=Math.sin(x),M=Math.cos(x),P=i.cosineU*M,T=i.sineU*O,R=Math.atan2(O*i.sineHeading,P-T*i.cosineHeading),C=R-l(i.f,i.sineAlpha,i.cosineSquaredAlpha,x,O,M,_);return r(n)?(n.longitude=this._start.longitude+C,n.latitude=S,n.height=0,n):new t(this._start.longitude+C,S,0)},p}),define("Core/isArray",["./defined"],function(e){"use strict";var t=Array.isArray;return e(t)||(t=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t}),define("Core/PolylinePipeline",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidGeodesic","./IntersectionTests","./isArray","./Math","./Matrix4","./Plane"],function(e,t,n,r,i,a,o,u,s,c,l,f){"use strict";function h(e,t,n){var r=O;r.length=e;var i;if(t===n){for(i=0;e>i;i++)r[i]=t;return r}var a=n-t,o=a/e;for(i=0;e>i;i++){var u=t+i*o;r[i]=u}return r}function d(t,n,r,i,a,o,u,s){var c=i.scaleToGeodeticSurface(t,R),l=i.scaleToGeodeticSurface(n,C),f=m.numberOfPoints(t,n,r),d=i.cartesianToCartographic(c,M),p=i.cartesianToCartographic(l,P),y=h(f,a,o);N.setEndPoints(d,p);var v=N.surfaceDistance/f,g=s;d.height=a;var w=i.cartographicToCartesian(d,T);e.pack(w,u,g),g+=3;for(var x=1;f>x;x++){var E=N.interpolateUsingSurfaceDistance(x*v,P);E.height=y[x],w=i.cartographicToCartesian(E,T),e.pack(w,u,g),g+=3}return g}var m={};m.numberOfPoints=function(t,n,r){var i=e.distance(t,n);return Math.ceil(i/r)};var p=new t;m.extractHeights=function(e,t){for(var n=e.length,r=new Array(n),i=0;n>i;i++){var a=e[i];r[i]=t.cartesianToCartographic(a,p).height}return r};var y=new l,v=new e,g=new e,w=new f(e.ZERO,0),x=new e,E=new f(e.ZERO,0),S=new e,_=new e,O=[],M=new t,P=new t,T=new e,R=new e,C=new e,N=new o;m.wrapLongitude=function(t,i){var a=[],o=[];if(r(t)&&t.length>0){i=n(i,l.IDENTITY);var s=l.inverseTransformation(i,y),c=l.multiplyByPoint(s,e.ZERO,v),h=l.multiplyByPointAsVector(s,e.UNIT_Y,g),d=f.fromPointNormal(c,h,w),m=l.multiplyByPointAsVector(s,e.UNIT_X,x),p=f.fromPointNormal(c,m,E),O=1;a.push(e.clone(t[0]));for(var M=a[0],P=t.length,T=1;P>T;++T){var R=t[T];if(f.getPointDistance(p,M)<0||f.getPointDistance(p,R)<0){var C=u.lineSegmentPlane(M,R,d,S);if(r(C)){var N=e.multiplyByScalar(h,5e-9,_);f.getPointDistance(d,M)<0&&e.negate(N,N),a.push(e.add(C,N,new e)),o.push(O+1),e.negate(N,N),a.push(e.add(C,N,new e)),O=1}}a.push(e.clone(t[T])),O++,M=R}o.push(O)}return{positions:a,lengths:o} -};var I=c.EPSILON7;return m.removeDuplicates=function(t){var n=t.length;if(2>n)return t;var r,i,a;for(r=1;n>r&&(i=t[r-1],a=t[r],!e.equalsEpsilon(i,a,I));++r);if(r===n)return t;for(var o=t.slice(0,r);n>r;++r)a=t[r],e.equalsEpsilon(i,a,I)||(o.push(e.clone(a)),i=a);return o},m.generateArc=function(t){r(t)||(t={});var i=t.positions,o=i.length,u=n(t.ellipsoid,a.WGS84),l=n(t.height,0);if(1>o)return[];if(1===o){var f=u.scaleToGeodeticSurface(i[0],R);if(0!==l){var h=u.geodeticSurfaceNormal(f,T);e.multiplyByScalar(h,l,h),e.add(f,h,f)}return[f.x,f.y,f.z]}var p=t.minDistance;if(!r(p)){var y=n(t.granularity,c.RADIANS_PER_DEGREE);p=c.chordLength(y,u.maximumRadius)}var v,g=0;for(v=0;o-1>v;v++)g+=m.numberOfPoints(i[v],i[v+1],p);var w=3*(g+1),x=new Array(w),E=0,S=s(l);for(v=0;o-1>v;v++){var _=i[v],P=i[v+1],C=S?l[v]:l,N=S?l[v+1]:l;E=d(_,P,p,u,C,N,x,E)}O.length=0;var I=i[o-1],z=u.cartesianToCartographic(I,M);z.height=S?l[o-1]:l;var A=u.cartographicToCartesian(z,T);return e.pack(A,x,w-3),x},m.generateCartesianArc=function(t){for(var n=m.generateArc(t),r=n.length/3,i=new Array(r),a=0;r>a;a++)i[a]=e.unpack(n,3*a);return i},m}),define("Core/Queue",[],function(){"use strict";var e=function(){this._array=[],this._offset=0,this.length=0};return e.prototype.enqueue=function(e){this._array.push(e),this.length++},e.prototype.dequeue=function(){if(0===this.length)return void 0;var e=this._array,t=this._offset,n=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this.length--,n},e.prototype.contains=function(e){return-1!==this._array.indexOf(e)},e.prototype.clear=function(){this._array.length=this._offset=this.length=0},e.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)},e}),define("Core/WindingOrder",["./freezeObject"],function(e){"use strict";var t={CLOCKWISE:2304,COUNTER_CLOCKWISE:2305,validate:function(e){return e===t.CLOCKWISE||e===t.COUNTER_CLOCKWISE}};return e(t)}),define("Core/PolygonPipeline",["./Cartesian2","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Geometry","./GeometryAttribute","./Math","./pointInsideTriangle","./PolylinePipeline","./PrimitiveType","./Queue","./WindingOrder"],function(e,t,n,r,i,a,o,u,s,c,l,f,h,d,m,p){"use strict";function y(t,n,r){var i=e.subtract(n,t,q),a=e.subtract(r,n,U);return i.x*a.y-i.y*a.x>=0}function v(e){for(var t=e[0].x,n=0,r=0;r<e.length;r++)e[r].x>t&&(t=e[r].x,n=r);return n}function g(e){for(var t=e[0][0].x,n=0,r=0;r<e.length;r++){var i=e[r][v(e[r])].x;i>t&&(t=i,n=r)}return n}function w(e){for(var t=[],n=0;n<e.length;n++){var r=e[(n-1+e.length)%e.length],i=e[n],a=e[(n+1)%e.length];y(r,i,a)||t.push(i)}return t}function x(t,n){for(var r=0;r<t.length;r++)if(e.equals(n,t[r]))return r;return-1}function E(n,i,a){a=r(a,[]);var o=Number.MAX_VALUE,u=v(i),s=new e(i[u].x,n.y);a.push(u),a.push((u+1)%i.length);for(var c=i[0].x,l=c,f=1;f<i.length;++f)i[f].x<c?c=i[f].x:i[f].x>l&&(l=i[f].x);l+=l-c;var h=new t(l,n.y,0);for(f=0;f<i.length;f++){var d=i[f],m=i[(f+1)%i.length];if((d.x>=n.x||m.x>=n.x)&&(d.y>=n.y&&m.y<=n.y||d.y<=n.y&&m.y>=n.y)){var p=(m.y-d.y)*(h.x-n.x)-(m.x-d.x)*(h.y-n.y);if(0!==p){p=1/p;var y=((m.x-d.x)*(n.y-d.y)-(m.y-d.y)*(n.x-d.x))*p,g=((h.x-n.x)*(n.y-d.y)-(h.y-n.y)*(n.x-d.x))*p;if(y>=0&&1>=y&&g>=0&&1>=g){var w=new e(n.x+y*(h.x-n.x),n.y+y*(h.y-n.y)),x=e.subtract(w,n,L);p=e.magnitudeSquared(x),o>p&&(s=w,o=p,a[0]=f,a[1]=(f+1)%i.length)}}}}return s}function S(t,n){var r=g(n),i=n[r],a=v(i),o=i[a],u=[],s=E(o,t,u),c=x(t,s);if(-1!==c)return c;var h=e.magnitudeSquared(e.subtract(t[u[0]],o,W)),d=e.magnitudeSquared(e.subtract(t[u[1]],o,W)),m=d>h?t[u[0]]:t[u[1]],p=w(t),y=p.indexOf(m);-1!==y&&p.splice(y,1);for(var S=[],_=0;_<p.length;_++){var O=p[_];f(O,o,s,m)&&S.push(O)}var M=Number.MAX_VALUE;if(S.length>0){var P=e.fromElements(1,0,W);for(_=0;_<S.length;_++){var T=e.subtract(S[_],o,B),R=e.magnitude(P)*e.magnitudeSquared(T);if(0!==R){var C=Math.abs(l.acosClamped(e.dot(P,T)/R));M>C&&(M=C,m=S[_])}}}return t.indexOf(m)}function _(e,n,r){for(var i=et.computeWindingOrder2D(e),a=0;a<n.length;a++){var o=n[a];t.equals(o[0],o[o.length-1])||o.push(o[0]);var s=et.computeWindingOrder2D(o);s===i&&o.reverse()}var c=u.fromPoints(e,r),l=c.projectPointsOntoPlane(e),f=[];for(a=0;a<n.length;a++)f.push(c.projectPointsOntoPlane(n[a]));var h=S(l,f),d=g(f),m=v(f[d]),p=n[d],y=[];for(a=0;a<e.length;a++)y.push(e[a]);var w,x=[];if(0!==m)for(w=0;w<=p.length;w++){var E=(w+m)%p.length;0!==E&&x.push(p[E])}else for(w=0;w<p.length;w++)x.push(p[(w+m)%p.length]);var _=y.lastIndexOf(e[h]);x.push(e[_]);var O=y.slice(0,_+1),M=y.slice(_+1);return y=O.concat(x,M),n.splice(d,1),y}function O(e){var t=l.nextRandomNumber(),n=Math.floor(t*e);return n===e&&n--,n}function M(e,t,n,r){var i=r[e].position,a=r[t].position,o=r[n].position,u=o.x,s=o.y,c=i.x-u,l=i.y-s,f=a.x-u,h=a.y-s;return c*h-l*f}function P(e,t){return e.x*t.y-e.y*t.x}function T(e,t){var n=t.length,r=l.mod(e-1,n),i=l.mod(e+1,n);return 0===M(r,i,e,t)?!1:!0}function R(t,n){return e.magnitudeSquared(n)<e.magnitudeSquared(t)}function C(t,n,r){if(!T(t,r))return t;var i=r[t].position,a=r[n].position,o=r.length,u=l.mod(t-1,o);if(!T(u,r))return u;var s=l.mod(t+1,o);if(!T(s,r))return s;var c=e.subtract(r[u].position,i,k),f=e.subtract(r[s].position,i,j),h=e.subtract(a,i,H),d=P(c,h),m=P(f,h);if(0===d)return R(c,h)?F:G;if(0===m)return R(f,h)?F:G;var p=P(c,f);return 0>p?0>d&&m>0?F:G:p>0?d>0&&0>m?G:F:void 0}function N(e,t,n){return(e>t||e>n)&&(t>e||n>e)||t===n&&t===e}function I(t,n,r,i){var a=e.subtract(r,t,V),o=n.x*i.y-n.y*i.x,u=o*o,s=e.magnitudeSquared(n),c=e.magnitudeSquared(i);if(u>Y*s*c){var l=(a.x*i.y-a.y*i.x)/o;return e.add(t,e.multiplyByScalar(n,l,V),V)}return void 0}function z(t,n,r){for(var a=e.subtract(n,t,Z),o=r.length,u=0;o>u;u++){var s=r[u].position,c=r[l.mod(u+1,o)].position;if(!(e.equals(t,s)||e.equals(n,c)||e.equals(t,c)||e.equals(n,s))){var f=e.subtract(c,s,X),h=I(t,a,s,f);if(i(h)&&!(e.equals(h,t)||e.equals(h,n)||e.equals(h,s)||e.equals(h,c))){var d=h.x,m=h.y,p=N(d,t.x,n.x)&&N(m,t.y,n.y)&&N(d,s.x,c.x)&&N(m,s.y,c.y);if(p)return!0}}}return!1}function A(t,n,r){var i=C(t,n,r);if(i>=0)return i;var a=C(n,t,r);return a>=0?a:i!==F||a!==F||z(r[t].position,r[n].position,r)||e.equals(r[t].position,r[n].position)?K:J}function b(e){return 0===M(1,2,0,e)}function D(e){var t=e.length;if(3===t)return b(e)?[]:[e[0].index,e[1].index,e[2].index];if(e.length<3)throw new a("Invalid polygon: must have at least three vertices.");for(var n,r,i=0,o=10*e.length,u=K;J>u&&i++<o;){for(n=O(e.length),r=n+1;Math.abs(n-r)<2||Math.abs(n-r)>e.length-2;)r=O(e.length);if(n>r){var s=n;n=r,r=s}u=A(n,r,e)}if(u===J){var c=e.splice(n,r-n+1,e[n],e[r]);return D(e).concat(D(c))}return u>=0?(e.splice(u,1),D(e)):[]}var q=new e,U=new e,L=new e,W=new e(1,0),B=new e,F=-1,G=-2,k=new t,j=new t,H=new t,Y=l.EPSILON14,V=new e;new e;var Z=new e,X=new e,J=-1,K=-2,Q=new t,$=new t,et={};et.removeDuplicates=function(e){var n=h.removeDuplicates(e);return t.equals(n[0],n[n.length-1])?n.slice(1):n},et.computeArea2D=function(e){for(var t=e.length,n=0,r=t-1,i=0;t>i;r=i++){var a=e[r],o=e[i];n+=a.x*o.y-o.x*a.y}return.5*n},et.computeWindingOrder2D=function(e){var t=et.computeArea2D(e);return t>0?p.COUNTER_CLOCKWISE:p.CLOCKWISE},et.triangulate=function(e){for(var t=e.length,n=[],r=0;t>r;++r)n[r]={position:e[r],index:r};return D(n)};var tt=new t,nt=new t,rt=new t,it=new t,at=new t,ot=new t,ut=new t;return et.computeSubdivision=function(e,a,o,u){u=r(u,l.RADIANS_PER_DEGREE);var f,h=o.slice(0),m=a.length,p=new Array(3*m),y=0;for(f=0;m>f;f++){var v=a[f];p[y++]=v.x,p[y++]=v.y,p[y++]=v.z}for(var g=[],w={},x=e.maximumRadius,E=l.chordLength(u,x),S=E*E;h.length>0;){var _,O,M=h.pop(),P=h.pop(),T=h.pop(),R=t.fromArray(p,3*T,tt),C=t.fromArray(p,3*P,nt),N=t.fromArray(p,3*M,rt),I=t.multiplyByScalar(t.normalize(R,it),x,it),z=t.multiplyByScalar(t.normalize(C,at),x,at),A=t.multiplyByScalar(t.normalize(N,ot),x,ot),b=t.magnitudeSquared(t.subtract(I,z,ut)),D=t.magnitudeSquared(t.subtract(z,A,ut)),q=t.magnitudeSquared(t.subtract(A,I,ut)),U=Math.max(b,D,q);U>S?b===U?(_=Math.min(T,P)+" "+Math.max(T,P),f=w[_],i(f)||(O=t.add(R,C,ut),t.multiplyByScalar(O,.5,O),p.push(O.x,O.y,O.z),f=p.length/3-1,w[_]=f),h.push(T,f,M),h.push(f,P,M)):D===U?(_=Math.min(P,M)+" "+Math.max(P,M),f=w[_],i(f)||(O=t.add(C,N,ut),t.multiplyByScalar(O,.5,O),p.push(O.x,O.y,O.z),f=p.length/3-1,w[_]=f),h.push(P,f,T),h.push(f,M,T)):q===U&&(_=Math.min(M,T)+" "+Math.max(M,T),f=w[_],i(f)||(O=t.add(N,R,ut),t.multiplyByScalar(O,.5,O),p.push(O.x,O.y,O.z),f=p.length/3-1,w[_]=f),h.push(M,f,P),h.push(f,T,P)):(g.push(T),g.push(P),g.push(M))}return new s({attributes:{position:new c({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:p})},indices:g,primitiveType:d.TRIANGLES})},et.scaleToGeodeticHeight=function(e,n,a,u){a=r(a,o.WGS84);var s=Q,c=$;if(n=r(n,0),u=r(u,!0),i(e)&&i(e.attributes)&&i(e.attributes.position))for(var l=e.attributes.position.values,f=l.length,h=0;f>h;h+=3)t.fromArray(l,h,c),u&&(c=a.scaleToGeodeticSurface(c,c)),s=a.geodeticSurfaceNormal(c,s),t.multiplyByScalar(s,n,s),t.add(c,s,c),l[h]=c.x,l[h+1]=c.y,l[h+2]=c.z;return e},et.eliminateHoles=function(e,n,i){i=r(i,o.WGS84);for(var a=[],u=0;u<n.length;u++){for(var s=[],c=0;c<n[u].length;c++)s.push(t.clone(n[u][c]));a.push(s)}for(var l=e;a.length>0;)l=_(l,a,i);return l},et}),define("Core/WallGeometryLibrary",["./Cartographic","./defined","./DeveloperError","./EllipsoidTangentPlane","./Math","./PolygonPipeline","./PolylinePipeline","./WindingOrder"],function(e,t,n,r,i,a,o,u){"use strict";function s(e,t){return i.equalsEpsilon(e.latitude,t.latitude,i.EPSILON14)&&i.equalsEpsilon(e.longitude,t.longitude,i.EPSILON14)}function c(n,r,i,a){var o=r.length;if(2>o)return{positions:r};var u=t(a),c=t(i),l=new Array(o),d=new Array(o),m=new Array(o),p=r[0];l[0]=p;var y=n.cartesianToCartographic(p,f);c&&(y.height=i[0]),d[0]=y.height,m[0]=u?a[0]:0;for(var v=1,g=1;o>g;++g){var w=r[g],x=n.cartesianToCartographic(w,h);c&&(x.height=i[g]),s(y,x)?y.height<x.height&&(d[v-1]=x.height):(l[v]=w,d[v]=x.height,m[v]=u?a[g]:0,e.clone(x,y),++v)}return l.length=v,d.length=v,m.length=v,{positions:l,topHeights:d,bottomHeights:m}}var l={},f=new e,h=new e,d=new Array(2),m=new Array(2),p={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};return l.computePositions=function(e,t,n,s,l,f){var h=c(e,t,n,s);if(t=h.positions,n=h.topHeights,s=h.bottomHeights,t.length<2)return void 0;if(t.length>=3){var y=r.fromPoints(t,e),v=y.projectPointsOntoPlane(t);a.computeWindingOrder2D(v)===u.CLOCKWISE&&(t.reverse(),n.reverse(),s.reverse())}var g,w,x=t.length,E=i.chordLength(l,e.maximumRadius),S=p;if(S.minDistance=E,S.ellipsoid=e,f){var _,O=0;for(_=0;x-1>_;_++)O+=o.numberOfPoints(t[_],t[_+1],E)+1;g=new Float64Array(3*O),w=new Float64Array(3*O);var M=d,P=m;S.positions=M,S.height=P;var T=0;for(_=0;x-1>_;_++){M[0]=t[_],M[1]=t[_+1],P[0]=n[_],P[1]=n[_+1];var R=o.generateArc(S);g.set(R,T),P[0]=s[_],P[1]=s[_+1],w.set(o.generateArc(S),T),T+=R.length}}else S.positions=t,S.height=n,g=new Float64Array(o.generateArc(S)),S.height=s,w=new Float64Array(o.generateArc(S));return{bottomPositions:w,topPositions:g}},l}),define("Core/WallOutlineGeometry",["./BoundingSphere","./Cartesian3","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./IndexDatatype","./Math","./PrimitiveType","./WallGeometryLibrary"],function(e,t,n,r,i,a,o,u,s,c,l,f,h,d){"use strict";var m=new t,p=new t,y=function(e){e=r(e,r.EMPTY_OBJECT);var n=e.positions,a=e.maximumHeights,u=e.minimumHeights,s=r(e.granularity,f.RADIANS_PER_DEGREE),c=r(e.ellipsoid,o.WGS84);this._positions=n,this._minimumHeights=u,this._maximumHeights=a,this._granularity=s,this._ellipsoid=o.clone(c),this._workerName="createWallOutlineGeometry";var l=1+n.length*t.packedLength+2;i(u)&&(l+=u.length),i(a)&&(l+=a.length),this.packedLength=l+o.packedLength+1};y.pack=function(e,n,a){a=r(a,0);var u,s=e._positions,c=s.length;for(n[a++]=c,u=0;c>u;++u,a+=t.packedLength)t.pack(s[u],n,a);var l=e._minimumHeights;if(c=i(l)?l.length:0,n[a++]=c,i(l))for(u=0;c>u;++u)n[a++]=l[u];var f=e._maximumHeights;if(c=i(f)?f.length:0,n[a++]=c,i(f))for(u=0;c>u;++u)n[a++]=f[u];o.pack(e._ellipsoid,n,a),a+=o.packedLength,n[a]=e._granularity};var v=o.clone(o.UNIT_SPHERE),g={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:v,granularity:void 0};return y.unpack=function(e,n,a){n=r(n,0);var u,s=e[n++],c=new Array(s);for(u=0;s>u;++u,n+=t.packedLength)c[u]=t.unpack(e,n);s=e[n++];var l;if(s>0)for(l=new Array(s),u=0;s>u;++u)l[u]=e[n++];s=e[n++];var f;if(s>0)for(f=new Array(s),u=0;s>u;++u)f[u]=e[n++];var h=o.unpack(e,n,v);n+=o.packedLength;var d=e[n];return i(a)?(a._positions=c,a._minimumHeights=l,a._maximumHeights=f,a._ellipsoid=o.clone(h,a._ellipsoid),a._granularity=d,a):(g.positions=c,g.minimumHeights=l,g.maximumHeights=f,g.granularity=d,new y(g))},y.fromConstantHeights=function(e){e=r(e,r.EMPTY_OBJECT);var t,n,a=e.positions,o=e.minimumHeight,u=e.maximumHeight,s=i(o),c=i(u);if(s||c){var l=a.length;t=s?new Array(l):void 0,n=c?new Array(l):void 0;for(var f=0;l>f;++f)s&&(t[f]=o),c&&(n[f]=u)}var h={positions:a,maximumHeights:n,minimumHeights:t,ellipsoid:e.ellipsoid};return new y(h)},y.createGeometry=function(r){var a=r._positions,o=r._minimumHeights,y=r._maximumHeights,v=r._granularity,g=r._ellipsoid,w=d.computePositions(g,a,y,o,v,!1);if(!i(w))return void 0;var x=w.bottomPositions,E=w.topPositions,S=E.length,_=2*S,O=new Float64Array(_),M=0;S/=3;var P;for(P=0;S>P;++P){var T=3*P,R=t.fromArray(E,T,m),C=t.fromArray(x,T,p);O[M++]=C.x,O[M++]=C.y,O[M++]=C.z,O[M++]=R.x,O[M++]=R.y,O[M++]=R.z}var N=new c({position:new s({componentDatatype:n.DOUBLE,componentsPerAttribute:3,values:O})}),I=_/3;_=2*I-4+I;var z=l.createTypedArray(I,_),A=0;for(P=0;I-2>P;P+=2){var b=P,D=P+2,q=t.fromArray(O,3*b,m),U=t.fromArray(O,3*D,p);if(!t.equalsEpsilon(q,U,f.EPSILON6)){var L=P+1,W=P+3;z[A++]=L,z[A++]=b,z[A++]=L,z[A++]=W,z[A++]=b,z[A++]=D}}return z[A++]=I-2,z[A++]=I-1,new u({attributes:N,indices:z,primitiveType:h.LINES,boundingSphere:new e.fromVertices(O)})},y}),define("Workers/createWallOutlineGeometry",["../Core/defined","../Core/Ellipsoid","../Core/WallOutlineGeometry"],function(e,t,n){"use strict";function r(r,i){return e(i)&&(r=n.unpack(r,i)),r._ellipsoid=t.clone(r._ellipsoid),n.createGeometry(r)}return r})}(); \ No newline at end of file diff --git a/libs/Cesium/Workers/transferTypedArrayTest.js b/libs/Cesium/Workers/transferTypedArrayTest.js deleted file mode 100644 index d38c334a..00000000 --- a/libs/Cesium/Workers/transferTypedArrayTest.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -"undefined"==typeof self&&(self={}),self.onmessage=function(e){"use strict";var s=e.data.array,a=self.webkitPostMessage||self.postMessage;try{a({array:s},[s.buffer])}catch(f){a({})}}; \ No newline at end of file diff --git a/libs/Cesium/Workers/upsampleQuantizedTerrainMesh.js b/libs/Cesium/Workers/upsampleQuantizedTerrainMesh.js deleted file mode 100644 index 4a7c3530..00000000 --- a/libs/Cesium/Workers/upsampleQuantizedTerrainMesh.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Cesium - https://github.com/AnalyticalGraphicsInc/cesium - * - * Copyright 2011-2015 Cesium Contributors - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Columbus View (Pat. Pend.) - * - * Portions licensed separately. - * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. - */ -/** -@license -mersenne-twister.js - https://gist.github.com/banksean/300494 - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - @license - when.js - https://github.com/cujojs/when - - MIT License (c) copyright B Cavalier & J Hann - - * A lightweight CommonJS Promises/A and when() implementation - * when is part of the cujo.js family of libraries (http://cujojs.com/) - * - * Licensed under the MIT License at: - * http://www.opensource.org/licenses/mit-license.php - * - * @version 1.7.1 - */ - -/** -@license -sprintf.js from the php.js project - https://github.com/kvz/phpjs -Directly from https://github.com/kvz/phpjs/blob/master/functions/strings/sprintf.js - -php.js is copyright 2012 Kevin van Zonneveld. - -Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld -(http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White -(http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jack, Jonas -Raoni Soares Silva (http://www.jsfromhell.com), Philip Peterson, Legaev -Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, -Rafa? Kukawski (http://blog.kukawski.pl), lmeyrick -(https://sourceforge.net/projects/bcmath-js/), Nate, Philippe Baumann, -Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), Carlos R. -L. Rodrigues (http://www.jsfromhell.com), Ash Searle -(http://hexmen.com/blog/), Jani Hartikainen, travc, Ole Vrijenhoek, -Erkekjetter, Michael Grier, Rafa? Kukawski (http://kukawski.pl), Johnny -Mast (http://www.phpvrouwen.nl), T.Wild, d3x, -http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, -Rafa? Kukawski (http://blog.kukawski.pl/), stag019, pilus, WebDevHobo -(http://webdevhobo.blogspot.com/), marrtins, GeekFG -(http://geekfg.blogspot.com), Andrea Giammarchi -(http://webreflection.blogspot.com), Arpad Ray (mailto:arpad@php.net), -gorthaur, Paul Smith, Tim de Koning (http://www.kingsquare.nl), Joris, Oleg -Eremeev, Steve Hilder, majak, gettimeofday, KELAN, Josh Fraser -(http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), -Marc Palau, Martin -(http://www.erlenwiese.de/), Breaking Par Consulting Inc -(http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), -Chris, Mirek Slugen, saulius, Alfonso Jimenez -(http://www.alfonsojimenez.com), Diplom@t (http://difane.com/), felix, -Mailfaker (http://www.weedem.fr/), Tyler Akins (http://rumkin.com), Caio -Ariede (http://caioariede.com), Robin, Kankrelune -(http://www.webfaktory.info/), Karol Kowalski, Imgen Tata -(http://www.myipdf.com/), mdsjack (http://www.mdsjack.bo.it), Dreamer, -Felix Geisendoerfer (http://www.debuggable.com/felix), Lars Fischer, AJ, -David, Aman Gupta, Michael White, Public Domain -(http://www.json.org/json2.js), Steven Levithan -(http://blog.stevenlevithan.com), Sakimori, Pellentesque Malesuada, -Thunder.m, Dj (http://phpjs.org/functions/htmlentities:425#comment_134018), -Steve Clay, David James, Francois, class_exists, nobbler, T. Wild, Itsacon -(http://www.itsacon.net/), date, Ole Vrijenhoek (http://www.nervous.nl/), -Fox, Raphael (Ao RUDLER), Marco, noname, Mateusz "loonquawl" Zalega, Frank -Forte, Arno, ger, mktime, john (http://www.jd-tech.net), Nick Kolosov -(http://sammy.ru), marc andreu, Scott Cariss, Douglas Crockford -(http://javascript.crockford.com), madipta, Slawomir Kaniecki, -ReverseSyntax, Nathan, Alex Wilson, kenneth, Bayron Guevara, Adam Wallner -(http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix, -Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick -(https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan, -Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H?gfeldt -(http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb, -josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren -Hansen, Eugene Bulkin (http://doubleaw.com/), Der Simon -(http://innerdom.sourceforge.net/), echo is bad, Ozh, XoraX -(http://www.xorax.info), EdorFaus, JB, J A R, Marc Jansen, Francesco, LH, -Stoyan Kyosev (http://www.svest.org/), nord_ua, omid -(http://phpjs.org/functions/380:380#comment_137122), Brad Touesnard, MeEtc -(http://yass.meetcweb.com), Peter-Paul Koch -(http://www.quirksmode.org/js/beat.html), Olivier Louvignes -(http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, Jalal Berrami, -Martin, JT, David Randall, Thomas Beaucourt (http://www.webapp.fr), taith, -vlado houba, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair -Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger -(http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner -B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong -(http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna, -Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni, -Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke -(http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski, -Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke -Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet, -sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen, -Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya -(http://www.premasolutions.com/), Philippe Jausions -(http://pear.php.net/user/jausions), Aidan Lister -(http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp, -strcmp, Taras Bogach, jpfle, Alexander Ermolaev -(http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, -dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha -(http://www.pedrotainha.com), James, Arnout Kazemier -(http://www.3rd-Eden.com), Chris McMacken, gabriel paderni, Yannoo, -FGFEmperor, baris ozdil, Tod Gentille, Greg Frazier, jakes, 3D-GRAF, Allan -Jensen (http://www.winternet.no), Howard Yeend, Benjamin Lupton, davook, -daniel airton wermann (http://wermann.com.br), Atli T¨®r, Maximusya, Ryan -W Tenney (http://ryan.10e.us), Alexander M Beedie, fearphage -(http://http/my.opera.com/fearphage/), Nathan Sepulveda, Victor, Matteo, -Billy, stensi, Cord, Manish, T.J. Leahy, Riddler -(http://www.frontierwebdev.com/), Rafa? Kukawski, FremyCompany, Matt -Bradley, Tim de Koning, Luis Salazar (http://www.freaky-media.com/), Diogo -Resende, Rival, Andrej Pavlovic, Garagoth, Le Torbi -(http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem, -Russell Walker (http://www.nbill.co.uk/), Jamie Beck -(http://www.terabit.ca/), setcookie, Michael, YUI Library: -http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at -http://hacks.bluesmoon.info/strftime/strftime.js, Ben -(http://benblume.co.uk/), DtTvB -(http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William, -meo, incidence, Cagri Ekin, Amirouche, Amir Habibi -(http://www.residence-mixte.com/), Luke Smith (http://lucassmith.name), -Kheang Hok Chin (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, -Tony, Yen-Wei Liu, Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben -Bryan - -Licensed under the MIT (MIT-LICENSE.txt) license. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES -OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @license - * - * Grauw URI utilities - * - * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js - * - * @author Laurens Holst (http://www.grauw.nl/) - * - * Copyright 2012 Laurens Holst - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -!function(){define("Core/defined",[],function(){"use strict";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var t=function(e,t){return void 0!==e?e:t};return t.EMPTY_OBJECT=e({}),t}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var t=function(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t){"use strict";var n={};n.EPSILON1=.1,n.EPSILON2=.01,n.EPSILON3=.001,n.EPSILON4=1e-4,n.EPSILON5=1e-5,n.EPSILON6=1e-6,n.EPSILON7=1e-7,n.EPSILON8=1e-8,n.EPSILON9=1e-9,n.EPSILON10=1e-10,n.EPSILON11=1e-11,n.EPSILON12=1e-12,n.EPSILON13=1e-13,n.EPSILON14=1e-14,n.EPSILON15=1e-15,n.EPSILON16=1e-16,n.EPSILON17=1e-17,n.EPSILON18=1e-18,n.EPSILON19=1e-19,n.EPSILON20=1e-20,n.GRAVITATIONALPARAMETER=3986004418e5,n.SOLAR_RADIUS=6955e5,n.LUNAR_RADIUS=1737400,n.SIXTY_FOUR_KILOBYTES=65536,n.sign=function(e){return e>0?1:0>e?-1:0},n.signNotZero=function(e){return 0>e?-1:1},n.toSNorm=function(e){return Math.round(255*(.5*n.clamp(e,-1,1)+.5))},n.fromSNorm=function(e){return 2*(n.clamp(e,0,255)/255)-1},n.sinh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t-n)},n.cosh=function(e){var t=Math.pow(Math.E,e),n=Math.pow(Math.E,-1*e);return.5*(t+n)},n.lerp=function(e,t,n){return(1-n)*e+n*t},n.PI=Math.PI,n.ONE_OVER_PI=1/Math.PI,n.PI_OVER_TWO=.5*Math.PI,n.PI_OVER_THREE=Math.PI/3,n.PI_OVER_FOUR=Math.PI/4,n.PI_OVER_SIX=Math.PI/6,n.THREE_PI_OVER_TWO=.5*3*Math.PI,n.TWO_PI=2*Math.PI,n.ONE_OVER_TWO_PI=1/(2*Math.PI),n.RADIANS_PER_DEGREE=Math.PI/180,n.DEGREES_PER_RADIAN=180/Math.PI,n.RADIANS_PER_ARCSECOND=n.RADIANS_PER_DEGREE/3600,n.toRadians=function(e){return e*n.RADIANS_PER_DEGREE},n.toDegrees=function(e){return e*n.DEGREES_PER_RADIAN},n.convertLongitudeRange=function(e){var t=n.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},n.negativePiToPi=function(e){return n.zeroToTwoPi(e+n.PI)-n.PI},n.zeroToTwoPi=function(e){var t=n.mod(e,n.TWO_PI);return Math.abs(t)<n.EPSILON14&&Math.abs(e)>n.EPSILON14?n.TWO_PI:t},n.mod=function(e,t){return(e%t+t)%t},n.equalsEpsilon=function(e,n,r,i){i=t(i,r);var a=Math.abs(e-n);return i>=a||a<=r*Math.max(Math.abs(e),Math.abs(n))};var r=[1];n.factorial=function(e){var t=r.length;if(e>=t)for(var n=r[t-1],i=t;e>=i;i++)r.push(n*i);return r[e]},n.incrementWrap=function(e,n,r){return r=t(r,0),++e,e>n&&(e=r),e},n.isPowerOfTwo=function(e){return 0!==e&&0===(e&e-1)},n.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},n.clamp=function(e,t,n){return t>e?t:e>n?n:e};var i=new e;return n.setRandomNumberSeed=function(t){i=new e(t)},n.nextRandomNumber=function(){return i.random()},n.acosClamped=function(e){return Math.acos(n.clamp(e,-1,1))},n.asinClamped=function(e){return Math.asin(n.clamp(e,-1,1))},n.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},n}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n){this.x=e(t,0),this.y=e(n,0)};a.fromElements=function(e,n,r){return t(r)?(r.x=e,r.y=n,r):new a(e,n)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n):new a(e.x,e.y):void 0},a.fromCartesian3=a.clone,a.fromCartesian4=a.clone,a.packedLength=2,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r]=t.y},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y)},a.minimumComponent=function(e){return Math.min(e.x,e.y)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(e,t){return a.normalize(e,s),a.normalize(t,c),i.acosClamped(a.dot(s,c))};var l=new a;return a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,l);return a.abs(n,n),t=n.x<=n.y?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Y,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)},a.ZERO=r(new a(0,0)),a.UNIT_X=r(new a(1,0)),a.UNIT_Y=r(new a(0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+")"},a}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0)};a.fromSpherical=function(n,r){t(r)||(r=new a);var i=n.clock,o=n.cone,u=e(n.magnitude,1),s=u*Math.sin(o);return r.x=s*Math.cos(i),r.y=s*Math.sin(i),r.z=u*Math.cos(o),r},a.fromElements=function(e,n,r,i){return t(i)?(i.x=e,i.y=n,i.z=r,i):new a(e,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new a(e.x,e.y,e.z):void 0},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r]=t.z},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a,c=new a;a.angleBetween=function(e,t){a.normalize(e,s),a.normalize(t,c);var n=a.dot(s,c),r=a.magnitude(a.cross(s,c,s));return Math.atan2(r,n)};var l=new a;a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,l);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?a.clone(a.UNIT_X,t):a.clone(a.UNIT_Z,t):n.y<=n.z?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_Z,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)},a.cross=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=t.x,u=t.y,s=t.z,c=i*s-a*u,l=a*o-r*s,f=r*u-i*o;return n.x=c,n.y=l,n.z=f,n},a.fromDegrees=function(e,t,n,r,o){var u=i.toRadians(e),s=i.toRadians(t);return a.fromRadians(u,s,n,r,o)};var f=new a,h=new a,d=new a(40680631590769,40680631590769,40408299984661.445);return a.fromRadians=function(n,r,i,o,u){i=e(i,0);var s=t(o)?o.radiiSquared:d,c=Math.cos(r);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.sin(r),f=a.normalize(f,f),a.multiplyComponents(s,f,h);var l=Math.sqrt(a.dot(f,h));return h=a.divideByScalar(h,l,h),f=a.multiplyByScalar(f,i,f),t(u)||(u=new a),a.add(h,f,u)},a.fromDegreesArray=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=i.toRadians(e[o]);return a.fromRadiansArray(r,t,n)},a.fromRadiansArray=function(e,n,r){var i=e.length;t(r)?r.length=i/2:r=new Array(i/2);for(var o=0;i>o;o+=2){var u=e[o],s=e[o+1];r[o/2]=a.fromRadians(u,s,0,n,r[o/2])}return r},a.fromDegreesArrayHeights=function(e,t,n){for(var r=new Array(e.length),o=0;o<e.length;o+=3)r[o]=i.toRadians(e[o]),r[o+1]=i.toRadians(e[o+1]),r[o+2]=e[o+2];return a.fromRadiansArrayHeights(r,t,n)},a.fromRadiansArrayHeights=function(e,n,r){var i=e.length;t(r)?r.length=i/3:r=new Array(i/3);for(var o=0;i>o;o+=3){var u=e[o],s=e[o+1],c=e[o+2];r[o/3]=a.fromRadians(u,s,c,n,r[o/3])}return r},a.ZERO=r(new a(0,0,0)),a.UNIT_X=r(new a(1,0,0)),a.UNIT_Y=r(new a(0,1,0)),a.UNIT_Z=r(new a(0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},a}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,n,r,i){"use strict";var a={};a.octEncode=function(e,t){if(t.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),t.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var n=t.x,r=t.y;t.x=(1-Math.abs(r))*i.signNotZero(n),t.y=(1-Math.abs(n))*i.signNotZero(r)}return t.x=i.toSNorm(t.x),t.y=i.toSNorm(t.y),t},a.octDecode=function(e,n,r){if(r.x=i.fromSNorm(e),r.y=i.fromSNorm(n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){var a=r.x;r.x=(1-Math.abs(r.y))*i.signNotZero(a),r.y=(1-Math.abs(a))*i.signNotZero(r.y)}return t.normalize(r,r)},a.octPackFloat=function(e){return 256*e.x+e.y};var o=new e;return a.octEncodeFloat=function(e){return a.octEncode(e,o),a.octPackFloat(o)},a.octDecodeFloat=function(e,t){var n=e/256,r=Math.floor(n),i=256*(n-r);return a.octDecode(r,i,t)},a.octPack=function(e,t,n,r){var i=a.octEncodeFloat(e),u=a.octEncodeFloat(t),s=a.octEncode(n,o);return r.x=65536*s.x+i,r.y=65536*s.y+u,r},a.octUnpack=function(e,t,n,r){var i=e.x/65536,o=Math.floor(i),u=65536*(i-o);i=e.y/65536;var s=Math.floor(i),c=65536*(i-s);a.octDecodeFloat(u,t),a.octDecodeFloat(c,n),a.octDecode(o,s,r)},a.compressTextureCoordinates=function(e){var t=1===e.x?4095:0|4096*e.x,n=1===e.y?4095:0|4096*e.y;return 4096*t+n},a.decompressTextureCoordinates=function(e,t){var n=e/4096;return t.x=Math.floor(n)/4096,t.y=n-Math.floor(n),t},a}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r){this.longitude=e(t,0),this.latitude=e(n,0),this.height=e(r,0)};return a.fromRadians=function(n,r,i,o){return i=e(i,0),t(o)?(o.longitude=n,o.latitude=r,o.height=i,o):new a(n,r,i)},a.fromDegrees=function(e,t,n,r){return e=i.toRadians(e),t=i.toRadians(t),a.fromRadians(e,t,n,r)},a.clone=function(e,n){return t(e)?t(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new a(e.longitude,e.latitude,e.height):void 0},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},a.equalsEpsilon=function(e,n,r){return e===n||t(e)&&t(n)&&Math.abs(e.longitude-n.longitude)<=r&&Math.abs(e.latitude-n.latitude)<=r&&Math.abs(e.height-n.height)<=r},a.ZERO=r(new a(0,0,0)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t){return a.equalsEpsilon(this,e,t)},a.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},a}),define("Core/deprecationWarning",["./defined","./DeveloperError"],function(e){"use strict";var t={},n=function(n,r){e(t[n])||(t[n]=!0,console.log(r))};return n}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),n=Object.defineProperties;return t&&e(n)||(n=function(e){return e}),n}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";function s(t,r,i,a){r=n(r,0),i=n(i,0),a=n(a,0),t._radii=new e(r,i,a),t._radiiSquared=new e(r*r,i*i,a*a),t._radiiToTheFourth=new e(r*r*r*r,i*i*i*i,a*a*a*a),t._oneOverRadii=new e(0===r?0:1/r,0===i?0:1/i,0===a?0:1/a),t._oneOverRadiiSquared=new e(0===r?0:1/(r*r),0===i?0:1/(i*i),0===a?0:1/(a*a)),t._minimumRadius=Math.min(r,i,a),t._maximumRadius=Math.max(r,i,a),t._centerToleranceSquared=u.EPSILON1}var c=function(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,s(this,e,t,n)};i(c.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),c.clone=function(t,n){if(!r(t))return void 0;var i=t._radii;return r(n)?(e.clone(i,n._radii),e.clone(t._radiiSquared,n._radiiSquared),e.clone(t._radiiToTheFourth,n._radiiToTheFourth),e.clone(t._oneOverRadii,n._oneOverRadii),e.clone(t._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=t._minimumRadius,n._maximumRadius=t._maximumRadius,n._centerToleranceSquared=t._centerToleranceSquared,n):new c(i.x,i.y,i.z)},c.fromCartesian3=function(e,t){return r(t)||(t=new c),r(e)?(s(t,e.x,e.y,e.z),t):t},c.WGS84=o(new c(6378137,6378137,6356752.314245179)),c.UNIT_SPHERE=o(new c(1,1,1)),c.MOON=o(new c(u.LUNAR_RADIUS,u.LUNAR_RADIUS,u.LUNAR_RADIUS)),c.prototype.clone=function(e){return c.clone(this,e)},c.packedLength=e.packedLength,c.pack=function(t,r,i){i=n(i,0),e.pack(t._radii,r,i)},c.unpack=function(t,r,i){r=n(r,0);var a=e.unpack(t,r);return c.fromCartesian3(a,i)},c.prototype.geocentricSurfaceNormal=e.normalize,c.prototype.geodeticSurfaceNormalCartographic=function(t,n){var i=t.longitude,a=t.latitude,o=Math.cos(a),u=o*Math.cos(i),s=o*Math.sin(i),c=Math.sin(a);return r(n)||(n=new e),n.x=u,n.y=s,n.z=c,e.normalize(n,n)},c.prototype.geodeticSurfaceNormal=function(t,n){return r(n)||(n=new e),n=e.multiplyComponents(t,this._oneOverRadiiSquared,n),e.normalize(n,n)};var l=new e,f=new e;c.prototype.cartographicToCartesian=function(t,n){var i=l,a=f;this.geodeticSurfaceNormalCartographic(t,i),e.multiplyComponents(this._radiiSquared,i,a);var o=Math.sqrt(e.dot(i,a));return e.divideByScalar(a,o,a),e.multiplyByScalar(i,t.height,i),r(n)||(n=new e),e.add(a,i,n)},c.prototype.cartographicArrayToCartesianArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var h=new e,d=new e,m=new e;c.prototype.cartesianToCartographic=function(n,i){var a=this.scaleToGeodeticSurface(n,d);if(!r(a))return void 0;var o=this.geodeticSurfaceNormal(a,h),s=e.subtract(n,a,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=u.sign(e.dot(s,n))*e.magnitude(s);return r(i)?(i.longitude=c,i.latitude=l,i.height=f,i):new t(c,l,f)},c.prototype.cartesianArrayToCartographicArray=function(e,t){var n=e.length;r(t)?t.length=n:t=new Array(n);for(var i=0;n>i;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};var p=new e,y=new e;return c.prototype.scaleToGeodeticSurface=function(t,n){var i=t.x,a=t.y,o=t.z,s=this._oneOverRadii,c=s.x,l=s.y,f=s.z,h=i*i*c*c,d=a*a*l*l,m=o*o*f*f,v=h+d+m,g=Math.sqrt(1/v),w=e.multiplyByScalar(t,g,p);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(w,n):void 0;var x=this._oneOverRadiiSquared,S=x.x,E=x.y,M=x.z,O=y;O.x=2*w.x*S,O.y=2*w.y*E,O.z=2*w.z*M;var _,P,C,z,R,I,N,T,b,A,D,q=(1-g)*e.magnitude(t)/(.5*e.magnitude(O)),U=0;do{q-=U,C=1/(1+q*S),z=1/(1+q*E),R=1/(1+q*M),I=C*C,N=z*z,T=R*R,b=I*C,A=N*z,D=T*R,_=h*I+d*N+m*T-1,P=h*b*S+d*A*E+m*D*M;var L=-2*P;U=_/L}while(Math.abs(_)>u.EPSILON12);return r(n)?(n.x=i*C,n.y=a*z,n.z=o*R,n):new e(i*C,a*z,o*R)},c.prototype.scaleToGeocentricSurface=function(t,n){r(n)||(n=new e);var i=t.x,a=t.y,o=t.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(i*i*u.x+a*a*u.y+o*o*u.z);return e.multiplyByScalar(t,s,n)},c.prototype.transformPositionToScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._oneOverRadii,n)},c.prototype.transformPositionFromScaledSpace=function(t,n){return r(n)||(n=new e),e.multiplyComponents(t,this._radii,n)},c.prototype.equals=function(t){return this===t||r(t)&&e.equals(this._radii,t._radii)},c.prototype.toString=function(){return this._radii.toString()},c}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,n,r,i,a,o){"use strict";var u=function(e){this._ellipsoid=n(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,n){var i=this._semimajorAxis,a=t.longitude*i,o=t.latitude*i,u=t.height;return r(n)?(n.x=a,n.y=o,n.z=u,n):new e(a,o,u)},u.prototype.unproject=function(e,n){var i=this._oneOverSemimajorAxis,a=e.x*i,o=e.y*i,u=e.z;return r(n)?(n.longitude=a,n.latitude=o,n.height=u,n):new t(a,o,u)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var t=function(t,n){this.start=e(t,0),this.stop=e(n,0)};return t}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i){"use strict";var a=function(t,n,r,i){this.x=e(t,0),this.y=e(n,0),this.z=e(r,0),this.w=e(i,0)};a.fromElements=function(e,n,r,i,o){return t(o)?(o.x=e,o.y=n,o.z=r,o.w=i,o):new a(e,n,r,i)},a.fromColor=function(e,n){return t(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new a(e.red,e.green,e.blue,e.alpha)},a.clone=function(e,n){return t(e)?t(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n.w=e.w,n):new a(e.x,e.y,e.z,e.w):void 0},a.packedLength=4,a.pack=function(t,n,r){r=e(r,0),n[r++]=t.x,n[r++]=t.y,n[r++]=t.z,n[r]=t.w},a.unpack=function(n,r,i){return r=e(r,0),t(i)||(i=new a),i.x=n[r++],i.y=n[r++],i.z=n[r++],i.w=n[r],i},a.fromArray=a.unpack,a.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},a.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},a.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},a.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},a.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},a.magnitude=function(e){return Math.sqrt(a.magnitudeSquared(e))};var o=new a;a.distance=function(e,t){return a.subtract(e,t,o),a.magnitude(o)},a.distanceSquared=function(e,t){return a.subtract(e,t,o),a.magnitudeSquared(o)},a.normalize=function(e,t){var n=a.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},a.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},a.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},a.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},a.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},a.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},a.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},a.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},a.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var u=new a;a.lerp=function(e,t,n,r){return a.multiplyByScalar(t,n,u),r=a.multiplyByScalar(e,1-n,r),a.add(u,r,r)};var s=new a;return a.mostOrthogonalAxis=function(e,t){var n=a.normalize(e,s);return a.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?a.clone(a.UNIT_X,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t):n.y<=n.z?n.y<=n.w?a.clone(a.UNIT_Y,t):a.clone(a.UNIT_W,t):n.z<=n.w?a.clone(a.UNIT_Z,t):a.clone(a.UNIT_W,t)},a.equals=function(e,n){return e===n||t(e)&&t(n)&&e.x===n.x&&e.y===n.y&&e.z===n.z&&e.w===n.w},a.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},a.equalsEpsilon=function(e,n,r,a){return e===n||t(e)&&t(n)&&i.equalsEpsilon(e.x,n.x,r,a)&&i.equalsEpsilon(e.y,n.y,r,a)&&i.equalsEpsilon(e.z,n.z,r,a)&&i.equalsEpsilon(e.w,n.w,r,a)},a.ZERO=r(new a(0,0,0,0)),a.UNIT_X=r(new a(1,0,0,0)),a.UNIT_Y=r(new a(0,1,0,0)),a.UNIT_Z=r(new a(0,0,1,0)),a.UNIT_W=r(new a(0,0,0,1)),a.prototype.clone=function(e){return a.clone(this,e)},a.prototype.equals=function(e){return a.equals(this,e)},a.prototype.equalsEpsilon=function(e,t,n){return a.equalsEpsilon(this,e,t,n)},a.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},a}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r,i,a){"use strict";function o(e){for(var t=0,n=0;9>n;++n){var r=e[n];t+=r*r}return Math.sqrt(t)}function u(e){for(var t=0,n=0;3>n;++n){var r=e[c.getElementIndex(d[n],h[n])];t+=2*r*r}return Math.sqrt(t)}function s(e,t){for(var n=a.EPSILON15,r=0,i=1,o=0;3>o;++o){var u=Math.abs(e[c.getElementIndex(d[o],h[o])]);u>r&&(i=o,r=u)}var s=1,l=0,f=h[i],m=d[i];if(Math.abs(e[c.getElementIndex(m,f)])>n){var p,y=e[c.getElementIndex(m,m)],v=e[c.getElementIndex(f,f)],g=e[c.getElementIndex(m,f)],w=(y-v)/2/g;p=0>w?-1/(-w+Math.sqrt(1+w*w)):1/(w+Math.sqrt(1+w*w)),s=1/Math.sqrt(1+p*p),l=p*s}return t=c.clone(c.IDENTITY,t),t[c.getElementIndex(f,f)]=t[c.getElementIndex(m,m)]=s,t[c.getElementIndex(m,f)]=l,t[c.getElementIndex(f,m)]=-l,t}var c=function(e,n,r,i,a,o,u,s,c){this[0]=t(e,0),this[1]=t(i,0),this[2]=t(u,0),this[3]=t(n,0),this[4]=t(a,0),this[5]=t(s,0),this[6]=t(r,0),this[7]=t(o,0),this[8]=t(c,0)};c.packedLength=9,c.pack=function(e,n,r){r=t(r,0),n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r++]=e[7],n[r++]=e[8]},c.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r++],i[1]=e[r++],i[2]=e[r++],i[3]=e[r++],i[4]=e[r++],i[5]=e[r++],i[6]=e[r++],i[7]=e[r++],i[8]=e[r++],i},c.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new c(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},c.fromArray=function(e,r,i){return r=t(r,0),n(i)||(i=new c),i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],i[8]=e[r+8],i},c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},c.fromQuaternion=function(e,t){var r=e.x*e.x,i=e.x*e.y,a=e.x*e.z,o=e.x*e.w,u=e.y*e.y,s=e.y*e.z,l=e.y*e.w,f=e.z*e.z,h=e.z*e.w,d=e.w*e.w,m=r-u-f+d,p=2*(i-h),y=2*(a+l),v=2*(i+h),g=-r+u-f+d,w=2*(s-o),x=2*(a-l),S=2*(s+o),E=-r-u+f+d;return n(t)?(t[0]=m,t[1]=v,t[2]=x,t[3]=p,t[4]=g,t[5]=S,t[6]=y,t[7]=w,t[8]=E,t):new c(m,p,y,v,g,w,x,S,E)},c.fromScale=function(e,t){return n(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new c(e.x,0,0,0,e.y,0,0,0,e.z)},c.fromUniformScale=function(e,t){return n(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new c(e,0,0,0,e,0,0,0,e)},c.fromCrossProduct=function(e,t){return n(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new c(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},c.fromRotationX=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=i,t[6]=0,t[7]=-i,t[8]=r,t):new c(1,0,0,0,r,-i,0,i,r)},c.fromRotationY=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=r,t):new c(r,0,i,0,1,0,-i,0,r)},c.fromRotationZ=function(e,t){var r=Math.cos(e),i=Math.sin(e);return n(t)?(t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new c(r,-i,0,i,r,0,0,0,1)},c.toArray=function(e,t){return n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},c.getElementIndex=function(e,t){return 3*e+t},c.getColumn=function(e,t,n){var r=3*t,i=e[r],a=e[r+1],o=e[r+2];return n.x=i,n.y=a,n.z=o,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=3*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r},c.getRow=function(e,t,n){var r=e[t],i=e[t+3],a=e[t+6];return n.x=r,n.y=i,n.z=a,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+3]=n.y,r[t+6]=n.z,r};var l=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],l)),n.y=e.magnitude(e.fromElements(t[3],t[4],t[5],l)),n.z=e.magnitude(e.fromElements(t[6],t[7],t[8],l)),n};var f=new e;c.getMaximumScale=function(t){return c.getScale(t,f),e.maximumComponent(f)},c.multiply=function(e,t,n){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],u=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],s=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],l=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=r,n[1]=i,n[2]=a,n[3]=o,n[4]=u,n[5]=s,n[6]=c,n[7]=l,n[8]=f,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[3]*i+e[6]*a,u=e[1]*r+e[4]*i+e[7]*a,s=e[2]*r+e[5]*i+e[8]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},c.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},c.transpose=function(e,t){var n=e[0],r=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=u,t[6]=s,t[7]=c,t[8]=l,t};var h=[1,0,0],d=[2,2,1],m=new c,p=new c;return c.computeEigenDecomposition=function(e,t){var r=a.EPSILON20,i=10,l=0,f=0;n(t)||(t={});for(var h=t.unitary=c.clone(c.IDENTITY,t.unitary),d=t.diagonal=c.clone(e,t.diagonal),y=r*o(d);i>f&&u(d)>y;)s(d,m),c.transpose(m,p),c.multiply(d,m,d),c.multiply(p,d,d),c.multiply(h,m,h),++l>2&&(++f,l=0);return t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},c.determinant=function(e){var t=e[0],n=e[3],r=e[6],i=e[1],a=e[4],o=e[7],u=e[2],s=e[5],c=e[8];return t*(a*c-s*o)+i*(s*r-n*c)+u*(n*o-a*r)},c.inverse=function(e,t){var n=e[0],i=e[1],o=e[2],u=e[3],s=e[4],l=e[5],f=e[6],h=e[7],d=e[8],m=c.determinant(e);if(Math.abs(m)<=a.EPSILON15)throw new r("matrix is not invertible");t[0]=s*d-h*l,t[1]=h*o-i*d,t[2]=i*l-s*o,t[3]=f*l-u*d,t[4]=n*d-f*o,t[5]=u*o-n*l,t[6]=u*h-f*s,t[7]=f*i-n*h,t[8]=n*s-u*i;var p=1/m;return c.multiplyByScalar(t,p,t)},c.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},c.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},c.IDENTITY=i(new c(1,0,0,0,1,0,0,0,1)),c.ZERO=i(new c(0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN1ROW0=3,c.COLUMN1ROW1=4,c.COLUMN1ROW2=5,c.COLUMN2ROW0=6,c.COLUMN2ROW1=7,c.COLUMN2ROW2=8,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},c}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var t=function(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(n){t=n.stack -}this.stack=t};return t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,n,r,i,a,o,u,s){"use strict";var c=function(e,t,r,i,a,o,u,s,c,l,f,h,d,m,p,y){this[0]=n(e,0),this[1]=n(a,0),this[2]=n(c,0),this[3]=n(d,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(m,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(p,0),this[12]=n(i,0),this[13]=n(s,0),this[14]=n(h,0),this[15]=n(y,0)};c.packedLength=16,c.pack=function(e,t,r){r=n(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t[r++]=e[9],t[r++]=e[10],t[r++]=e[11],t[r++]=e[12],t[r++]=e[13],t[r++]=e[14],t[r]=e[15]},c.unpack=function(e,t,i){return t=n(t,0),r(i)||(i=new c),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},c.clone=function(e,t){return r(e)?r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new c(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},c.fromArray=c.unpack,c.fromColumnMajorArray=function(e,t){return c.clone(e,t)},c.fromRowMajorArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new c(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},c.fromRotationTranslation=function(t,i,a){return i=n(i,e.ZERO),r(a)?(a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=0,a[4]=t[3],a[5]=t[4],a[6]=t[5],a[7]=0,a[8]=t[6],a[9]=t[7],a[10]=t[8],a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a):new c(t[0],t[3],t[6],i.x,t[1],t[4],t[7],i.y,t[2],t[5],t[8],i.z,0,0,0,1)},c.fromTranslationQuaternionRotationScale=function(e,t,n,i){r(i)||(i=new c);var a=n.x,o=n.y,u=n.z,s=t.x*t.x,l=t.x*t.y,f=t.x*t.z,h=t.x*t.w,d=t.y*t.y,m=t.y*t.z,p=t.y*t.w,y=t.z*t.z,v=t.z*t.w,g=t.w*t.w,w=s-d-y+g,x=2*(l-v),S=2*(f+p),E=2*(l+v),M=-s+d-y+g,O=2*(m-h),_=2*(f-p),P=2*(m+h),C=-s-d+y+g;return i[0]=w*a,i[1]=E*a,i[2]=_*a,i[3]=0,i[4]=x*o,i[5]=M*o,i[6]=P*o,i[7]=0,i[8]=S*u,i[9]=O*u,i[10]=C*u,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},c.fromTranslation=function(e,t){return c.fromRotationTranslation(u.IDENTITY,e,t)},c.fromScale=function(e,t){return r(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},c.fromUniformScale=function(e,t){return r(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new c(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,f=new e,h=new e;c.fromCamera=function(t,n){var i=t.eye,a=t.target,o=t.up;e.normalize(e.subtract(a,i,l),l),e.normalize(e.cross(l,o,f),f),e.normalize(e.cross(f,l,h),h);var u=f.x,s=f.y,d=f.z,m=l.x,p=l.y,y=l.z,v=h.x,g=h.y,w=h.z,x=i.x,S=i.y,E=i.z,M=u*-x+s*-S+d*-E,O=v*-x+g*-S+w*-E,_=m*x+p*S+y*E;return r(n)?(n[0]=u,n[1]=v,n[2]=-m,n[3]=0,n[4]=s,n[5]=g,n[6]=-p,n[7]=0,n[8]=d,n[9]=w,n[10]=-y,n[11]=0,n[12]=M,n[13]=O,n[14]=_,n[15]=1,n):new c(u,s,d,M,v,g,w,O,-m,-p,-y,_,0,0,0,1)},c.computePerspectiveFieldOfView=function(e,t,n,r,i){var a=Math.tan(.5*e),o=1/a,u=o/t,s=(r+n)/(n-r),c=2*r*n/(n-r);return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=-1,i[12]=0,i[13]=0,i[14]=c,i[15]=0,i},c.computeOrthographicOffCenter=function(e,t,n,r,i,a,o){var u=1/(t-e),s=1/(r-n),c=1/(a-i),l=-(t+e)*u,f=-(r+n)*s,h=-(a+i)*c;return u*=2,s*=2,c*=-2,o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=l,o[13]=f,o[14]=h,o[15]=1,o},c.computePerspectiveOffCenter=function(e,t,n,r,i,a,o){var u=2*i/(t-e),s=2*i/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),f=-(a+i)/(a-i),h=-1,d=-2*a*i/(a-i);return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=h,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},c.computeInfinitePerspectiveOffCenter=function(e,t,n,r,i,a){var o=2*i/(t-e),u=2*i/(r-n),s=(t+e)/(t-e),c=(r+n)/(r-n),l=-1,f=-1,h=-2*i;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=s,a[9]=c,a[10]=l,a[11]=f,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},c.computeViewportTransformation=function(e,t,r,i){e=n(e,n.EMPTY_OBJECT);var a=n(e.x,0),o=n(e.y,0),u=n(e.width,0),s=n(e.height,0);t=n(t,0),r=n(r,1);var c=.5*u,l=.5*s,f=.5*(r-t),h=c,d=l,m=f,p=a+c,y=o+l,v=t+f,g=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=m,i[11]=0,i[12]=p,i[13]=y,i[14]=v,i[15]=g,i},c.toArray=function(e,t){return r(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},c.getElementIndex=function(e,t){return 4*e+t},c.getColumn=function(e,t,n){var r=4*t,i=e[r],a=e[r+1],o=e[r+2],u=e[r+3];return n.x=i,n.y=a,n.z=o,n.w=u,n},c.setColumn=function(e,t,n,r){r=c.clone(e,r);var i=4*t;return r[i]=n.x,r[i+1]=n.y,r[i+2]=n.z,r[i+3]=n.w,r},c.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n},c.getRow=function(e,t,n){var r=e[t],i=e[t+4],a=e[t+8],o=e[t+12];return n.x=r,n.y=i,n.z=a,n.w=o,n},c.setRow=function(e,t,n,r){return r=c.clone(e,r),r[t]=n.x,r[t+4]=n.y,r[t+8]=n.z,r[t+12]=n.w,r};var d=new e;c.getScale=function(t,n){return n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],d)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],d)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],d)),n};var m=new e;c.getMaximumScale=function(t){return c.getScale(t,m),e.maximumComponent(m)},c.multiply=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[3],u=e[4],s=e[5],c=e[6],l=e[7],f=e[8],h=e[9],d=e[10],m=e[11],p=e[12],y=e[13],v=e[14],g=e[15],w=t[0],x=t[1],S=t[2],E=t[3],M=t[4],O=t[5],_=t[6],P=t[7],C=t[8],z=t[9],R=t[10],I=t[11],N=t[12],T=t[13],b=t[14],A=t[15],D=r*w+u*x+f*S+p*E,q=i*w+s*x+h*S+y*E,U=a*w+c*x+d*S+v*E,L=o*w+l*x+m*S+g*E,B=r*M+u*O+f*_+p*P,W=i*M+s*O+h*_+y*P,F=a*M+c*O+d*_+v*P,k=o*M+l*O+m*_+g*P,V=r*C+u*z+f*R+p*I,j=i*C+s*z+h*R+y*I,Y=a*C+c*z+d*R+v*I,Z=o*C+l*z+m*R+g*I,X=r*N+u*T+f*b+p*A,G=i*N+s*T+h*b+y*A,H=a*N+c*T+d*b+v*A,J=o*N+l*T+m*b+g*A;return n[0]=D,n[1]=q,n[2]=U,n[3]=L,n[4]=B,n[5]=W,n[6]=F,n[7]=k,n[8]=V,n[9]=j,n[10]=Y,n[11]=Z,n[12]=X,n[13]=G,n[14]=H,n[15]=J,n},c.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},c.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},c.multiplyTransformation=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=e[12],d=e[13],m=e[14],p=t[0],y=t[1],v=t[2],g=t[4],w=t[5],x=t[6],S=t[8],E=t[9],M=t[10],O=t[12],_=t[13],P=t[14],C=r*p+o*y+c*v,z=i*p+u*y+l*v,R=a*p+s*y+f*v,I=r*g+o*w+c*x,N=i*g+u*w+l*x,T=a*g+s*w+f*x,b=r*S+o*E+c*M,A=i*S+u*E+l*M,D=a*S+s*E+f*M,q=r*O+o*_+c*P+h,U=i*O+u*_+l*P+d,L=a*O+s*_+f*P+m;return n[0]=C,n[1]=z,n[2]=R,n[3]=0,n[4]=I,n[5]=N,n[6]=T,n[7]=0,n[8]=b,n[9]=A,n[10]=D,n[11]=0,n[12]=q,n[13]=U,n[14]=L,n[15]=1,n},c.multiplyByMatrix3=function(e,t,n){var r=e[0],i=e[1],a=e[2],o=e[4],u=e[5],s=e[6],c=e[8],l=e[9],f=e[10],h=t[0],d=t[1],m=t[2],p=t[3],y=t[4],v=t[5],g=t[6],w=t[7],x=t[8],S=r*h+o*d+c*m,E=i*h+u*d+l*m,M=a*h+s*d+f*m,O=r*p+o*y+c*v,_=i*p+u*y+l*v,P=a*p+s*y+f*v,C=r*g+o*w+c*x,z=i*g+u*w+l*x,R=a*g+s*w+f*x;return n[0]=S,n[1]=E,n[2]=M,n[3]=0,n[4]=O,n[5]=_,n[6]=P,n[7]=0,n[8]=C,n[9]=z,n[10]=R,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},c.multiplyByTranslation=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=r*e[0]+i*e[4]+a*e[8]+e[12],u=r*e[1]+i*e[5]+a*e[9]+e[13],s=r*e[2]+i*e[6]+a*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=o,n[13]=u,n[14]=s,n[15]=e[15],n};var p=new e;c.multiplyByUniformScale=function(e,t,n){return p.x=t,p.y=t,p.z=t,c.multiplyByScale(e,p,n)},c.multiplyByScale=function(e,t,n){var r=t.x,i=t.y,a=t.z;return 1===r&&1===i&&1===a?c.clone(e,n):(n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=0,n[4]=i*e[4],n[5]=i*e[5],n[6]=i*e[6],n[7]=0,n[8]=a*e[8],n[9]=a*e[9],n[10]=a*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},c.multiplyByVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=t.w,u=e[0]*r+e[4]*i+e[8]*a+e[12]*o,s=e[1]*r+e[5]*i+e[9]*a+e[13]*o,c=e[2]*r+e[6]*i+e[10]*a+e[14]*o,l=e[3]*r+e[7]*i+e[11]*a+e[15]*o;return n.x=u,n.y=s,n.z=c,n.w=l,n},c.multiplyByPointAsVector=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a,u=e[1]*r+e[5]*i+e[9]*a,s=e[2]*r+e[6]*i+e[10]*a;return n.x=o,n.y=u,n.z=s,n},c.multiplyByPoint=function(e,t,n){var r=t.x,i=t.y,a=t.z,o=e[0]*r+e[4]*i+e[8]*a+e[12],u=e[1]*r+e[5]*i+e[9]*a+e[13],s=e[2]*r+e[6]*i+e[10]*a+e[14];return n.x=o,n.y=u,n.z=s,n},c.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},c.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},c.transpose=function(e,t){var n=e[1],r=e[2],i=e[3],a=e[6],o=e[7],u=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[10]=e[10],t[11]=e[14],t[12]=i,t[13]=o,t[14]=u,t[15]=e[15],t},c.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},c.equals=function(e,t){return e===t||r(e)&&r(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},c.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},c.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},c.getRotation=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var y=new u,v=new u,g=new t,w=new t(0,0,0,1);return c.inverse=function(e,n){if(u.equalsEpsilon(c.getRotation(e,y),v,o.EPSILON7)&&t.equals(c.getRow(e,3,g),w))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0,n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var r=e[0],i=e[4],a=e[8],l=e[12],f=e[1],h=e[5],d=e[9],m=e[13],p=e[2],x=e[6],S=e[10],E=e[14],M=e[3],O=e[7],_=e[11],P=e[15],C=S*P,z=E*_,R=x*P,I=E*O,N=x*_,T=S*O,b=p*P,A=E*M,D=p*_,q=S*M,U=p*O,L=x*M,B=C*h+I*d+N*m-(z*h+R*d+T*m),W=z*f+b*d+q*m-(C*f+A*d+D*m),F=R*f+A*h+U*m-(I*f+b*h+L*m),k=T*f+D*h+L*d-(N*f+q*h+U*d),V=z*i+R*a+T*l-(C*i+I*a+N*l),j=C*r+A*a+D*l-(z*r+b*a+q*l),Y=I*r+b*i+L*l-(R*r+A*i+U*l),Z=N*r+q*i+U*a-(T*r+D*i+L*a);C=a*m,z=l*d,R=i*m,I=l*h,N=i*d,T=a*h,b=r*m,A=l*f,D=r*d,q=a*f,U=r*h,L=i*f;var X=C*O+I*_+N*P-(z*O+R*_+T*P),G=z*M+b*_+q*P-(C*M+A*_+D*P),H=R*M+A*O+U*P-(I*M+b*O+L*P),J=T*M+D*O+L*_-(N*M+q*O+U*_),K=R*S+T*E+z*x-(N*E+C*x+I*S),Q=D*E+C*p+A*S-(b*S+q*E+z*p),$=b*x+L*E+I*p-(U*E+R*p+A*x),et=U*S+N*p+q*x-(D*x+L*S+T*p),tt=r*B+i*W+a*F+l*k;if(Math.abs(tt)<o.EPSILON20)throw new s("matrix is not invertible because its determinate is zero.");return tt=1/tt,n[0]=B*tt,n[1]=W*tt,n[2]=F*tt,n[3]=k*tt,n[4]=V*tt,n[5]=j*tt,n[6]=Y*tt,n[7]=Z*tt,n[8]=X*tt,n[9]=G*tt,n[10]=H*tt,n[11]=J*tt,n[12]=K*tt,n[13]=Q*tt,n[14]=$*tt,n[15]=et*tt,n},c.inverseTransformation=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[4],o=e[5],u=e[6],s=e[8],c=e[9],l=e[10],f=e[12],h=e[13],d=e[14],m=-n*f-r*h-i*d,p=-a*f-o*h-u*d,y=-s*f-c*h-l*d;return t[0]=n,t[1]=a,t[2]=s,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=i,t[9]=u,t[10]=l,t[11]=0,t[12]=m,t[13]=p,t[14]=y,t[15]=1,t},c.IDENTITY=a(new c(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),c.ZERO=a(new c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),c.COLUMN0ROW0=0,c.COLUMN0ROW1=1,c.COLUMN0ROW2=2,c.COLUMN0ROW3=3,c.COLUMN1ROW0=4,c.COLUMN1ROW1=5,c.COLUMN1ROW2=6,c.COLUMN1ROW3=7,c.COLUMN2ROW0=8,c.COLUMN2ROW1=9,c.COLUMN2ROW2=10,c.COLUMN2ROW3=11,c.COLUMN3ROW0=12,c.COLUMN3ROW1=13,c.COLUMN3ROW2=14,c.COLUMN3ROW3=15,c.prototype.clone=function(e){return c.clone(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},c.prototype.equalsEpsilon=function(e,t){return c.equalsEpsilon(this,e,t)},c.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},c}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject"],function(e,t,n,r){"use strict";var i=function(t,n){this.normal=e.clone(t),this.distance=n};i.fromPointNormal=function(n,r,a){var o=-e.dot(r,n);return t(a)?(e.clone(r,a.normal),a.distance=o,a):new i(r,o)};var a=new e;return i.fromCartesian4=function(n,r){var o=e.fromCartesian4(n,a),u=n.w;return t(r)?(e.clone(o,r.normal),r.distance=u,r):new i(o,u)},i.getPointDistance=function(t,n){return e.dot(t.normal,n)+t.distance},i.ORIGIN_XY_PLANE=r(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=r(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=r(new i(e.UNIT_Y,0)),i}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.west=t(e,0),this.south=t(n,0),this.east=t(r,0),this.north=t(i,0)};r(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.west,n[r++]=e.south,n[r++]=e.east,n[r]=e.north},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.west=e[r++],i.south=e[r++],i.east=e[r++],i.north=e[r],i},s.computeWidth=function(e){var t=e.east,n=e.west;return n>t&&(t+=u.TWO_PI),t-n},s.computeHeight=function(e){return e.north-e.south},s.fromDegrees=function(e,r,i,a,o){return e=u.toRadians(t(e,0)),r=u.toRadians(t(r,0)),i=u.toRadians(t(i,0)),a=u.toRadians(t(a,0)),n(o)?(o.west=e,o.south=r,o.east=i,o.north=a,o):new s(e,r,i,a)},s.fromCartographicArray=function(e,t){for(var r=Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=0,c=e.length;c>u;u++){var l=e[u];r=Math.min(r,l.longitude),i=Math.max(i,l.longitude),a=Math.min(a,l.latitude),o=Math.max(o,l.latitude)}return n(t)?(t.west=r,t.south=a,t.east=i,t.north=o,t):new s(r,a,i,o)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,t){return n(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},s.validate=function(){},s.southwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.south,r.height=0,r):new e(t.west,t.south)},s.northwest=function(t,r){return n(r)?(r.longitude=t.west,r.latitude=t.north,r.height=0,r):new e(t.west,t.north)},s.northeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.north,r.height=0,r):new e(t.east,t.north)},s.southeast=function(t,r){return n(r)?(r.longitude=t.east,r.latitude=t.south,r.height=0,r):new e(t.east,t.south)},s.center=function(t,r){var i=t.east,a=t.west;a>i&&(i+=u.TWO_PI);var o=u.negativePiToPi(.5*(a+i)),s=.5*(t.south+t.north);return n(r)?(r.longitude=o,r.latitude=s,r.height=0,r):new e(o,s)},s.intersection=function(e,t,r){var i=e.east,a=e.west,o=t.east,c=t.west;a>i&&o>0?i+=u.TWO_PI:c>o&&i>0&&(o+=u.TWO_PI),a>i&&0>c?c+=u.TWO_PI:c>o&&0>a&&(a+=u.TWO_PI);var l=u.negativePiToPi(Math.max(a,c)),f=u.negativePiToPi(Math.min(i,o));if((e.west<e.east||t.west<t.east)&&l>=f)return void 0;var h=Math.max(e.south,t.south),d=Math.min(e.north,t.north);return h>=d?void 0:n(r)?(r.west=l,r.south=h,r.east=f,r.north=d,r):new s(l,h,f,d)},s.contains=function(e,t){var n=t.longitude,r=t.latitude,i=e.west,a=e.east;return i>a&&(a+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(a>n||u.equalsEpsilon(n,a,u.EPSILON14))&&r>=e.south&&r<=e.north};var c=new e;return s.subsample=function(e,r,i,o){r=t(r,a.WGS84),i=t(i,0),n(o)||(o=[]);var l=0,f=e.north,h=e.south,d=e.east,m=e.west,p=c;p.height=i,p.longitude=m,p.latitude=f,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=h,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.latitude=0>f?f:h>0?h:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*u.PI_OVER_TWO,s.contains(e,p)&&(o[l]=r.cartographicToCartesian(p,o[l]),l++);return 0===p.latitude&&(p.longitude=m,o[l]=r.cartographicToCartesian(p,o[l]),l++,p.longitude=d,o[l]=r.cartographicToCartesian(p,o[l]),l++),o.length=l,o},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Plane","./Rectangle"],function(e,t,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)},m=new e,p=new e,y=new e,v=new e,g=new e,w=new e,x=new e,S=new e,E=new e,M=new e,O=new e,_=new e;d.fromPoints=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;for(var i=e.clone(t[0],x),a=e.clone(i,m),o=e.clone(i,p),u=e.clone(i,y),s=e.clone(i,v),c=e.clone(i,g),l=e.clone(i,w),f=t.length,h=1;f>h;h++){e.clone(t[h],i);var P=i.x,C=i.y,z=i.z;P<a.x&&e.clone(i,a),P>s.x&&e.clone(i,s),C<o.y&&e.clone(i,o),C>c.y&&e.clone(i,c),z<u.z&&e.clone(i,u),z>l.z&&e.clone(i,l)}var R=e.magnitudeSquared(e.subtract(s,a,S)),I=e.magnitudeSquared(e.subtract(c,o,S)),N=e.magnitudeSquared(e.subtract(l,u,S)),T=a,b=s,A=R;I>A&&(A=I,T=o,b=c),N>A&&(A=N,T=u,b=l);var D=E;D.x=.5*(T.x+b.x),D.y=.5*(T.y+b.y),D.z=.5*(T.z+b.z);var q=e.magnitudeSquared(e.subtract(b,D,S)),U=Math.sqrt(q),L=M;L.x=a.x,L.y=o.y,L.z=u.z;var B=O;B.x=s.x,B.y=c.y,B.z=l.z;var W=e.multiplyByScalar(e.add(L,B,S),.5,_),F=0;for(h=0;f>h;h++){e.clone(t[h],i);var k=e.magnitude(e.subtract(i,W,S));k>F&&(F=k);var V=e.magnitudeSquared(e.subtract(i,D,S));if(V>q){var j=Math.sqrt(V);U=.5*(U+j),q=U*U;var Y=j-U;D.x=(U*D.x+Y*i.x)/j,D.y=(U*D.y+Y*i.y)/j,D.z=(U*D.z+Y*i.z)/j}}return F>U?(e.clone(D,n.center),n.radius=U):(e.clone(W,n.center),n.radius=F),n};var P=new u,C=new e,z=new e,R=new t,I=new t;d.fromRectangle2D=function(e,t,n){return d.fromRectangleWithHeights2D(e,t,0,0,n)},d.fromRectangleWithHeights2D=function(t,i,a,o,u){if(r(u)||(u=new d),!r(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=n(i,P),h.southwest(t,R),R.height=a,h.northeast(t,I),I.height=o;var s=i.project(R,C),c=i.project(I,z),l=c.x-s.x,f=c.y-s.y,m=c.z-s.z;u.radius=.5*Math.sqrt(l*l+f*f+m*m);var p=u.center;return p.x=s.x+.5*l,p.y=s.y+.5*f,p.z=s.z+.5*m,u};var N=[];d.fromRectangle3D=function(e,t,i,a){t=n(t,o.WGS84),i=n(i,0);var u;return r(e)&&(u=h.subsample(e,t,i,N)),d.fromPoints(u,a)},d.fromVertices=function(t,i,a,o){if(r(o)||(o=new d),!r(t)||0===t.length)return o.center=e.clone(e.ZERO,o.center),o.radius=0,o;i=n(i,e.ZERO),a=n(a,3);var u=x;u.x=t[0]+i.x,u.y=t[1]+i.y,u.z=t[2]+i.z;for(var s=e.clone(u,m),c=e.clone(u,p),l=e.clone(u,y),f=e.clone(u,v),h=e.clone(u,g),P=e.clone(u,w),C=t.length,z=0;C>z;z+=a){var R=t[z]+i.x,I=t[z+1]+i.y,N=t[z+2]+i.z;u.x=R,u.y=I,u.z=N,R<s.x&&e.clone(u,s),R>f.x&&e.clone(u,f),I<c.y&&e.clone(u,c),I>h.y&&e.clone(u,h),N<l.z&&e.clone(u,l),N>P.z&&e.clone(u,P)}var T=e.magnitudeSquared(e.subtract(f,s,S)),b=e.magnitudeSquared(e.subtract(h,c,S)),A=e.magnitudeSquared(e.subtract(P,l,S)),D=s,q=f,U=T;b>U&&(U=b,D=c,q=h),A>U&&(U=A,D=l,q=P);var L=E;L.x=.5*(D.x+q.x),L.y=.5*(D.y+q.y),L.z=.5*(D.z+q.z);var B=e.magnitudeSquared(e.subtract(q,L,S)),W=Math.sqrt(B),F=M;F.x=s.x,F.y=c.y,F.z=l.z;var k=O;k.x=f.x,k.y=h.y,k.z=P.z;var V=e.multiplyByScalar(e.add(F,k,S),.5,_),j=0;for(z=0;C>z;z+=a){u.x=t[z]+i.x,u.y=t[z+1]+i.y,u.z=t[z+2]+i.z;var Y=e.magnitude(e.subtract(u,V,S));Y>j&&(j=Y);var Z=e.magnitudeSquared(e.subtract(u,L,S));if(Z>B){var X=Math.sqrt(Z);W=.5*(W+X),B=W*W;var G=X-W;L.x=(W*L.x+G*u.x)/X,L.y=(W*L.y+G*u.y)/X,L.z=(W*L.z+G*u.z)/X}}return j>W?(e.clone(L,o.center),o.radius=W):(e.clone(V,o.center),o.radius=j),o},d.fromCornerPoints=function(t,n,i){r(i)||(i=new d);var a=i.center;return e.add(t,n,a),e.multiplyByScalar(a,.5,a),i.radius=e.distance(a,n),i},d.fromEllipsoid=function(t,n){return r(n)||(n=new d),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var T=new e;d.fromBoundingSpheres=function(t,n){if(r(n)||(n=new d),!r(t)||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var i=t.length;if(1===i)return d.clone(t[0],n);if(2===i)return d.union(t[0],t[1],n);for(var a=[],o=0;i>o;o++)a.push(t[o].center);n=d.fromPoints(a,n);var u=n.center,s=n.radius;for(o=0;i>o;o++){var c=t[o];s=Math.max(s,e.distance(u,c.center,T)+c.radius)}return n.radius=s,n},d.clone=function(t,n){return r(t)?r(n)?(n.center=e.clone(t.center,n.center),n.radius=t.radius,n):new d(t.center,t.radius):void 0},d.packedLength=4,d.pack=function(e,t,r){r=n(r,0);var i=e.center;t[r++]=i.x,t[r++]=i.y,t[r++]=i.z,t[r]=e.radius},d.unpack=function(e,t,i){t=n(t,0),r(i)||(i=new d);var a=i.center;return a.x=e[t++],a.y=e[t++],a.z=e[t++],i.radius=e[t],i};var b=new e,A=new e;d.union=function(t,n,i){r(i)||(i=new d);var a=t.center,o=t.radius,u=n.center,s=n.radius,c=e.subtract(u,a,b),l=e.magnitude(c);if(o>=l+s)return t.clone(i),i;if(s>=l+o)return n.clone(i),i;var f=.5*(o+l+s),h=e.multiplyByScalar(c,(-o+f)/l,A);return e.add(h,a,h),e.clone(h,i.center),i.radius=f,i};var D=new e;d.expand=function(t,n,r){r=d.clone(t,r);var i=e.magnitude(e.subtract(n,r.center,D));return i>r.radius&&(r.radius=i),r},d.intersectPlane=function(t,n){var r=t.center,i=t.radius,a=n.normal,o=e.dot(a,r)+n.distance;return-i>o?s.OUTSIDE:i>o?s.INTERSECTING:s.INSIDE};var q=new f(new e,0);d.intersect=function(e,t){i("BoundingSphere.intersect","BoundingSphere.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use BoundingSphere.intersectPlane() instead.");var n=f.fromCartesian4(t,q);return d.intersectPlane(e,n)},d.transform=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var U=new e;d.distanceSquaredTo=function(t,n){var r=e.subtract(t.center,n,U);return e.magnitudeSquared(r)-t.radius*t.radius},d.transformWithoutScale=function(e,t,n){return r(n)||(n=new d),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var L=new e;d.computePlaneDistances=function(t,n,i,a){r(a)||(a=new c);var o=e.subtract(t.center,n,L),u=e.multiplyByScalar(i,e.dot(i,o),L),s=e.magnitude(u);return a.start=s-t.radius,a.stop=s+t.radius,a};for(var B=new e,W=new e,F=new e,k=new e,V=new e,j=new t,Y=new Array(8),Z=0;8>Z;++Z)Y[Z]=new e;var X=new u;return d.projectTo2D=function(t,r,i){r=n(r,X);var a=r.ellipsoid,o=t.center,u=t.radius,s=a.geodeticSurfaceNormal(o,B),c=e.cross(e.UNIT_Z,s,W);e.normalize(c,c);var l=e.cross(s,c,F);e.normalize(l,l),e.multiplyByScalar(s,u,s),e.multiplyByScalar(l,u,l),e.multiplyByScalar(c,u,c);var f=e.negate(l,V),h=e.negate(c,k),m=Y,p=m[0];e.add(s,l,p),e.add(p,c,p),p=m[1],e.add(s,l,p),e.add(p,h,p),p=m[2],e.add(s,f,p),e.add(p,h,p),p=m[3],e.add(s,f,p),e.add(p,c,p),e.negate(s,s),p=m[4],e.add(s,l,p),e.add(p,c,p),p=m[5],e.add(s,l,p),e.add(p,h,p),p=m[6],e.add(s,f,p),e.add(p,h,p),p=m[7],e.add(s,f,p),e.add(p,c,p);for(var y=m.length,v=0;y>v;++v){var g=m[v];e.add(o,g,g);var w=a.cartesianToCartographic(g,j);r.project(w,g)}i=d.fromPoints(m,i),o=i.center;var x=o.x,S=o.y,E=o.z;return o.x=E,o.y=x,o.z=S,i},d.equals=function(t,n){return t===n||r(t)&&r(n)&&e.equals(t.center,n.center)&&t.radius===n.radius},d.prototype.intersectPlane=function(e){return d.intersectPlane(this,e)},d.prototype.intersect=function(e){return d.intersect(this,e)},d.prototype.equals=function(e){return d.equals(this,e)},d.prototype.clone=function(e){return d.clone(this,e)},d}),define("Core/EllipsoidalOccluder",["./BoundingSphere","./Cartesian3","./defaultValue","./defined","./defineProperties","./DeveloperError","./Rectangle"],function(e,t,n,r,i,a,o){"use strict";function u(e,n,r){var i=e.transformPositionToScaledSpace(n,m),a=t.magnitudeSquared(i),o=Math.sqrt(a),u=t.divideByScalar(i,o,p);a=Math.max(1,a),o=Math.max(1,o);var s=t.dot(u,r),c=t.magnitude(t.cross(u,r,u)),l=1/o,f=Math.sqrt(a-1)*l;return 1/(s*l-c*f)}function s(e,n,r){return 0>=n||n===1/0||n!==n?void 0:t.multiplyByScalar(e,n,r)}function c(e,n){return e.transformPositionToScaledSpace(n,y),t.normalize(y,y)}var l=function(e,n){this._ellipsoid=e,this._cameraPosition=new t,this._cameraPositionInScaledSpace=new t,this._distanceToLimbInScaledSpaceSquared=0,r(n)&&(this.cameraPosition=n)};i(l.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){var n=this._ellipsoid,r=n.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),i=t.magnitudeSquared(r)-1;t.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=r,this._distanceToLimbInScaledSpaceSquared=i}}});var f=new t;l.prototype.isPointVisible=function(e){var t=this._ellipsoid,n=t.transformPositionToScaledSpace(e,f);return this.isScaledSpacePointVisible(n)},l.prototype.isScaledSpacePointVisible=function(e){var n=this._cameraPositionInScaledSpace,r=this._distanceToLimbInScaledSpaceSquared,i=t.subtract(e,n,f),a=-t.dot(i,n),o=a>r&&a*a/t.magnitudeSquared(i)>r;return!o},l.prototype.computeHorizonCullingPoint=function(e,n,i){r(i)||(i=new t);for(var a=this._ellipsoid,o=c(a,e),l=0,f=0,h=n.length;h>f;++f){var d=n[f],m=u(a,d,o);l=Math.max(l,m)}return s(o,l,i)};var h=new t;l.prototype.computeHorizonCullingPointFromVertices=function(e,i,a,o,l){r(l)||(l=new t),o=n(o,t.ZERO);for(var f=this._ellipsoid,d=c(f,e),m=0,p=0,y=i.length;y>p;p+=a){h.x=i[p]+o.x,h.y=i[p+1]+o.y,h.z=i[p+2]+o.z;var v=u(f,h,d);m=Math.max(m,v)}return s(d,m,l)};var d=[];l.prototype.computeHorizonCullingPointFromRectangle=function(n,r,i){var a=o.subsample(n,r,0,d),u=e.fromPoints(a);return t.magnitude(u.center)<.1*r.minimumRadius?void 0:this.computeHorizonCullingPoint(u.center,a,i)};var m=new t,p=new t,y=new t;return l}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,n,r){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},i.validate=function(t){return e(t)&&(t===i.UNSIGNED_BYTE||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)},i.createTypedArray=function(e,t){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},i.createTypedArrayFromArrayBuffer=function(e,t,n,i){return e>r.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)},n(i)}),define("Core/Intersections2D",["./Cartesian3","./defined","./DeveloperError"],function(e,t){"use strict";var n={};return n.clipTriangleAtAxisAlignedThreshold=function(e,n,r,i,a,o){t(o)?o.length=0:o=[];var u,s,c;n?(u=e>r,s=e>i,c=e>a):(u=r>e,s=i>e,c=a>e);var l,f,h,d,m,p,y=u+s+c;return 1===y?u?(l=(e-r)/(i-r),f=(e-r)/(a-r),o.push(1),o.push(2),1!==f&&(o.push(-1),o.push(0),o.push(2),o.push(f)),1!==l&&(o.push(-1),o.push(0),o.push(1),o.push(l))):s?(h=(e-i)/(a-i),d=(e-i)/(r-i),o.push(2),o.push(0),1!==d&&(o.push(-1),o.push(1),o.push(0),o.push(d)),1!==h&&(o.push(-1),o.push(1),o.push(2),o.push(h))):c&&(m=(e-a)/(r-a),p=(e-a)/(i-a),o.push(0),o.push(1),1!==p&&(o.push(-1),o.push(2),o.push(1),o.push(p)),1!==m&&(o.push(-1),o.push(2),o.push(0),o.push(m))):2===y?u||r===e?s||i===e?c||a===e||(f=(e-r)/(a-r),h=(e-i)/(a-i),o.push(2),o.push(-1),o.push(0),o.push(2),o.push(f),o.push(-1),o.push(1),o.push(2),o.push(h)):(p=(e-a)/(i-a),l=(e-r)/(i-r),o.push(1),o.push(-1),o.push(2),o.push(1),o.push(p),o.push(-1),o.push(0),o.push(1),o.push(l)):(d=(e-i)/(r-i),m=(e-a)/(r-a),o.push(0),o.push(-1),o.push(1),o.push(0),o.push(d),o.push(-1),o.push(2),o.push(0),o.push(m)):3===y||(o.push(0),o.push(1),o.push(2)),o},n.computeBarycentricCoordinates=function(n,r,i,a,o,u,s,c,l){var f=i-s,h=s-o,d=u-c,m=a-c,p=1/(d*f+h*m),y=r-c,v=n-s,g=(d*v+h*y)*p,w=(-m*v+f*y)*p,x=1-g-w;return t(l)?(l.x=g,l.y=w,l.z=x,l):new e(g,w,x)},n}),define("Core/AxisAlignedBoundingBox",["./Cartesian3","./defaultValue","./defined","./deprecationWarning","./DeveloperError","./Intersect","./Plane"],function(e,t,n,r,i,a,o){"use strict";var u=function(r,i,a){this.minimum=e.clone(t(r,e.ZERO)),this.maximum=e.clone(t(i,e.ZERO)),n(a)?a=e.clone(a):(a=e.add(this.minimum,this.maximum,new e),e.multiplyByScalar(a,.5,a)),this.center=a};u.fromPoints=function(t,r){if(n(r)||(r=new u),!n(t)||0===t.length)return r.minimum=e.clone(e.ZERO,r.minimum),r.maximum=e.clone(e.ZERO,r.maximum),r.center=e.clone(e.ZERO,r.center),r;for(var i=t[0].x,a=t[0].y,o=t[0].z,s=t[0].x,c=t[0].y,l=t[0].z,f=t.length,h=1;f>h;h++){var d=t[h],m=d.x,p=d.y,y=d.z;i=Math.min(m,i),s=Math.max(m,s),a=Math.min(p,a),c=Math.max(p,c),o=Math.min(y,o),l=Math.max(y,l)}var v=r.minimum;v.x=i,v.y=a,v.z=o;var g=r.maximum;g.x=s,g.y=c,g.z=l;var w=e.add(v,g,r.center);return e.multiplyByScalar(w,.5,w),r},u.clone=function(t,r){return n(t)?n(r)?(r.minimum=e.clone(t.minimum,r.minimum),r.maximum=e.clone(t.maximum,r.maximum),r.center=e.clone(t.center,r.center),r):new u(t.minimum,t.maximum):void 0},u.equals=function(t,r){return t===r||n(t)&&n(r)&&e.equals(t.center,r.center)&&e.equals(t.minimum,r.minimum)&&e.equals(t.maximum,r.maximum)};var s=new e;u.intersectPlane=function(t,n){s=e.subtract(t.maximum,t.minimum,s);var r=e.multiplyByScalar(s,.5,s),i=n.normal,o=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),u=e.dot(t.center,i)+n.distance;return u-o>0?a.INSIDE:0>u+o?a.OUTSIDE:a.INTERSECTING -};var c=new o(new e,0);return u.intersect=function(e,t){r("AxisAlignedBoundingBox.intersect","AxisAlignedBoundingBox.intersect() was deprecated in Cesium 1.11. It will be removed in 1.12. Use AxisAlignedBoundingBox.intersectPlane() instead.");var n=o.fromCartesian4(t,c);return u.intersectPlane(e,n)},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.intersectPlane=function(e){return u.intersectPlane(this,e)},u.prototype.intersect=function(e){return u.intersect(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function n(e,n,r){var i=e+n;return t.sign(e)!==t.sign(n)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(n)))<r?0:i}var r={};return r.computeDiscriminant=function(e,t,n){var r=t*t-4*e*n;return r},r.computeRealRoots=function(e,r,i){var a;if(0===e)return 0===r?[]:[-i/r];if(0===r){if(0===i)return[0,0];var o=Math.abs(i),u=Math.abs(e);if(u>o&&o/u<t.EPSILON14)return[0,0];if(o>u&&u/o<t.EPSILON14)return[];if(a=-i/e,0>a)return[];var s=Math.sqrt(a);return[-s,s]}if(0===i)return a=-r/e,0>a?[a,0]:[0,a];var c=r*r,l=4*e*i,f=n(c,-l,t.EPSILON14);if(0>f)return[];var h=-.5*n(r,t.sign(r)*Math.sqrt(f),t.EPSILON14);return r>0?[h/e,i/h]:[i/h,h/e]},r}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function n(e,t,n,r){var i,a,o=e,u=t/3,s=n/3,c=r,l=o*s,f=u*c,h=u*u,d=s*s,m=o*s-h,p=o*c-u*s,y=u*c-d,v=4*m*y-p*p;if(0>v){var g,w,x;h*f>=l*d?(g=o,w=m,x=-2*u*m+o*p):(g=c,w=y,x=-c*p+2*s*y);var S=0>x?-1:1,E=-S*Math.abs(g)*Math.sqrt(-v);a=-x+E;var M=a/2,O=0>M?-Math.pow(-M,1/3):Math.pow(M,1/3),_=a===E?-O:-w/O;return i=0>=w?O+_:-x/(O*O+_*_+w),h*f>=l*d?[(i-u)/o]:[-c/(i+s)]}var P=m,C=-2*u*m+o*p,z=y,R=-c*p+2*s*y,I=Math.sqrt(v),N=Math.sqrt(3)/2,T=Math.abs(Math.atan2(o*I,-C)/3);i=2*Math.sqrt(-P);var b=Math.cos(T);a=i*b;var A=i*(-b/2-N*Math.sin(T)),D=a+A>2*u?a-u:A-u,q=o,U=D/q;T=Math.abs(Math.atan2(c*I,-R)/3),i=2*Math.sqrt(-z),b=Math.cos(T),a=i*b,A=i*(-b/2-N*Math.sin(T));var L=-c,B=2*s>a+A?a+s:A+s,W=L/B,F=q*B,k=-D*B-q*L,V=D*L,j=(s*k-u*V)/(-u*k+s*F);return j>=U?W>=U?W>=j?[U,j,W]:[U,W,j]:[W,U,j]:W>=U?[j,U,W]:W>=j?[j,W,U]:[W,j,U]}var r={};return r.computeDiscriminant=function(e,t,n,r){var i=e*e,a=t*t,o=n*n,u=r*r,s=18*e*t*n*r+a*o-27*i*u-4*(e*o*n+a*t*r);return s},r.computeRealRoots=function(e,r,i,a){var o,u;if(0===e)return t.computeRealRoots(r,i,a);if(0===r){if(0===i){if(0===a)return[0,0,0];u=-a/e;var s=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[s,s,s]}return 0===a?(o=t.computeRealRoots(e,0,i),0===o.Length?[0]:[o[0],0,o[1]]):n(e,0,i,a)}return 0===i?0===a?(u=-r/e,0>u?[u,0,0]:[0,0,u]):n(e,r,0,a):0===a?(o=t.computeRealRoots(e,r,i),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):n(e,r,i,a)},r}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,n,r){"use strict";function i(t,i,a,o){var u=t*t,s=i-3*u/8,c=a-i*t/2+u*t/8,l=o-a*t/4+i*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var h=-t/4,d=f[f.length-1];if(Math.abs(d)<n.EPSILON14){var m=r.computeRealRoots(1,s,l);if(2===m.length){var p,y=m[0],v=m[1];if(y>=0&&v>=0){var g=Math.sqrt(y),w=Math.sqrt(v);return[h-w,h-g,h+g,h+w]}if(y>=0&&0>v)return p=Math.sqrt(y),[h-p,h+p];if(0>y&&v>=0)return p=Math.sqrt(v),[h-p,h+p]}return[]}if(d>0){var x=Math.sqrt(d),S=(s+d-c/x)/2,E=(s+d+c/x)/2,M=r.computeRealRoots(1,x,S),O=r.computeRealRoots(1,-x,E);return 0!==M.length?(M[0]+=h,M[1]+=h,0!==O.length?(O[0]+=h,O[1]+=h,M[1]<=O[0]?[M[0],M[1],O[0],O[1]]:O[1]<=M[0]?[O[0],O[1],M[0],M[1]]:M[0]>=O[0]&&M[1]<=O[1]?[O[0],M[0],M[1],O[1]]:O[0]>=M[0]&&O[1]<=M[1]?[M[0],O[0],O[1],M[1]]:M[0]>O[0]&&M[0]<O[1]?[O[0],M[0],O[1],M[1]]:[M[0],O[0],M[1],O[1]]):M):0!==O.length?(O[0]+=h,O[1]+=h,O):[]}}return[]}function a(t,i,a,o){var u=a*a,s=i*i,c=t*t,l=-2*i,f=a*t+s-4*o,h=c*o-a*i*t+u,d=e.computeRealRoots(1,l,f,h);if(d.length>0){var m,p,y=d[0],v=i-y,g=v*v,w=t/2,x=v/2,S=g-4*o,E=g+4*Math.abs(o),M=c-4*y,O=c+4*Math.abs(y);if(0>y||M*E>S*O){var _=Math.sqrt(M);m=_/2,p=0===_?0:(t*x-a)/_}else{var P=Math.sqrt(S);m=0===P?0:(t*x-a)/P,p=P/2}var C,z;0===w&&0===m?(C=0,z=0):n.sign(w)===n.sign(m)?(C=w+m,z=y/C):(z=w-m,C=y/z);var R,I;0===x&&0===p?(R=0,I=0):n.sign(x)===n.sign(p)?(R=x+p,I=o/R):(I=x-p,R=o/I);var N=r.computeRealRoots(1,C,R),T=r.computeRealRoots(1,z,I);if(0!==N.length)return 0!==T.length?N[1]<=T[0]?[N[0],N[1],T[0],T[1]]:T[1]<=N[0]?[T[0],T[1],N[0],N[1]]:N[0]>=T[0]&&N[1]<=T[1]?[T[0],N[0],N[1],T[1]]:T[0]>=N[0]&&T[1]<=N[1]?[N[0],T[0],T[1],N[1]]:N[0]>T[0]&&N[0]<T[1]?[T[0],N[0],T[1],N[1]]:[N[0],T[0],N[1],T[1]]:N;if(0!==T.length)return T}return[]}var o={};return o.computeDiscriminant=function(e,t,n,r,i){var a=e*e,o=a*e,u=t*t,s=u*t,c=n*n,l=c*n,f=r*r,h=f*r,d=i*i,m=d*i,p=u*c*f-4*s*h-4*e*l*f+18*e*t*n*h-27*a*f*f+256*o*m+i*(18*s*n*r-4*u*l+16*e*c*c-80*e*t*c*r-6*e*u*f+144*a*n*f)+d*(144*e*u*n-27*u*u-128*a*c-192*a*t*r);return p},o.computeRealRoots=function(t,r,o,u,s){if(Math.abs(t)<n.EPSILON15)return e.computeRealRoots(r,o,u,s);var c=r/t,l=o/t,f=u/t,h=s/t,d=0>c?1:0;switch(d+=0>l?d+1:d,d+=0>f?d+1:d,d+=0>h?d+1:d){case 0:return i(c,l,f,h);case 1:return a(c,l,f,h);case 2:return a(c,l,f,h);case 3:return i(c,l,f,h);case 4:return i(c,l,f,h);case 5:return a(c,l,f,h);case 6:return i(c,l,f,h);case 7:return i(c,l,f,h);case 8:return a(c,l,f,h);case 9:return i(c,l,f,h);case 10:return i(c,l,f,h);case 11:return a(c,l,f,h);case 12:return i(c,l,f,h);case 13:return i(c,l,f,h);case 14:return i(c,l,f,h);case 15:return i(c,l,f,h);default:return void 0}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,n){"use strict";var r=function(n,r){r=e.clone(t(r,e.ZERO)),e.equals(r,e.ZERO)||e.normalize(r,r),this.origin=e.clone(t(n,e.ZERO)),this.direction=r};return r.getPoint=function(t,r,i){return n(i)||(i=new e),i=e.multiplyByScalar(t.direction,r,i),e.add(t.origin,i,i)},r}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,n,r,i,a,o,u,s,c){"use strict";function l(t,r,i,o,u){u=n(u,!1);var s,c,l,f,h,d=t.origin,m=t.direction,p=e.subtract(i,r,y),S=e.subtract(o,r,v),E=e.cross(m,S,g),M=e.dot(p,E);if(u){if(M<a.EPSILON6)return void 0;if(s=e.subtract(d,r,w),l=e.dot(s,E),0>l||l>M)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c),0>f||l+f>M)return void 0;h=e.dot(S,c)/M}else{if(Math.abs(M)<a.EPSILON6)return void 0;var O=1/M;if(s=e.subtract(d,r,w),l=e.dot(s,E)*O,0>l||l>1)return void 0;if(c=e.cross(s,p,x),f=e.dot(m,c)*O,0>f||l+f>1)return void 0;h=e.dot(S,c)*O}return h}function f(e,t,n,r){var i=t*t-4*e*n;if(0>i)return void 0;if(i>0){var a=1/(2*e),o=Math.sqrt(i),u=(-t+o)*a,s=(-t-o)*a;return s>u?(r.root0=u,r.root1=s):(r.root0=s,r.root1=u),r}var c=-t/(2*e);return 0===c?void 0:(r.root0=r.root1=c,r)}function h(t,n,i){r(i)||(i={});var a=t.origin,o=t.direction,u=n.center,s=n.radius*n.radius,c=e.subtract(a,u,g),l=e.dot(o,o),h=2*e.dot(o,c),d=e.magnitudeSquared(c)-s,m=f(l,h,d,E);return r(m)?(i.start=m.root0,i.stop=m.root1,i):void 0}function d(e,t,n){var r=e+t;return a.sign(e)!==a.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<n?0:r}function m(t,n,r,i,c){var l,f=i*i,h=c*c,m=(t[o.COLUMN1ROW1]-t[o.COLUMN2ROW2])*h,p=c*(i*d(t[o.COLUMN1ROW0],t[o.COLUMN0ROW1],a.EPSILON15)+n.y),y=t[o.COLUMN0ROW0]*f+t[o.COLUMN2ROW2]*h+i*n.x+r,v=h*d(t[o.COLUMN2ROW1],t[o.COLUMN1ROW2],a.EPSILON15),g=c*(i*d(t[o.COLUMN2ROW0],t[o.COLUMN0ROW2])+n.z),w=[];if(0===g&&0===v){if(l=u.computeRealRoots(m,p,y),0===l.length)return w;var x=l[0],S=Math.sqrt(Math.max(1-x*x,0));if(w.push(new e(i,c*x,c*-S)),w.push(new e(i,c*x,c*S)),2===l.length){var E=l[1],M=Math.sqrt(Math.max(1-E*E,0));w.push(new e(i,c*E,c*-M)),w.push(new e(i,c*E,c*M))}return w}var O=g*g,_=v*v,P=m*m,C=g*v,z=P+_,R=2*(p*m+C),I=2*y*m+p*p-_+O,N=2*(y*p-C),T=y*y-O;if(0===z&&0===R&&0===I&&0===N)return w;l=s.computeRealRoots(z,R,I,N,T);var b=l.length;if(0===b)return w;for(var A=0;b>A;++A){var D,q=l[A],U=q*q,L=Math.max(1-U,0),B=Math.sqrt(L);D=a.sign(m)===a.sign(y)?d(m*U+y,p*q,a.EPSILON12):a.sign(y)===a.sign(p*q)?d(m*U,p*q+y,a.EPSILON12):d(m*U+p*q,y,a.EPSILON12);var W=d(v*q,g,a.EPSILON15),F=D*W;0>F?w.push(new e(i,c*q,c*B)):F>0?w.push(new e(i,c*q,c*-B)):0!==B?(w.push(new e(i,c*q,c*-B)),w.push(new e(i,c*q,c*B)),++A):w.push(new e(i,c*q,c*B))}return w}var p={};p.rayPlane=function(t,n,i){r(i)||(i=new e);var o=t.origin,u=t.direction,s=n.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON15)return void 0;var l=(-n.distance-e.dot(s,o))/c;return 0>l?void 0:(i=e.multiplyByScalar(u,l,i),e.add(o,i,i))};var y=new e,v=new e,g=new e,w=new e,x=new e;p.rayTriangle=function(t,n,i,a,o,u){var s=l(t,n,i,a,o);return!r(s)||0>s?void 0:(r(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u))};var S=new c;p.lineSegmentTriangle=function(t,n,i,a,o,u,s){var c=S;e.clone(t,c.origin),e.subtract(n,t,c.direction),e.normalize(c.direction,c.direction);var f=l(c,i,a,o,u);return!r(f)||0>f||f>e.distance(t,n)?void 0:(r(s)||(s=new e),e.multiplyByScalar(c.direction,f,s),e.add(c.origin,s,s))};var E={root0:0,root1:0};p.raySphere=function(e,t,n){return n=h(e,t,n),!r(n)||n.stop<0?void 0:(n.start=Math.max(n.start,0),n)};var M=new c;p.lineSegmentSphere=function(t,n,i,a){var o=M;e.clone(t,o.origin);var u=e.subtract(n,t,o.direction),s=e.magnitude(u);return e.normalize(u,u),a=h(o,i,a),!r(a)||a.stop<0||a.start>s?void 0:(a.start=Math.max(a.start,0),a.stop=Math.min(a.stop,s),a)};var O=new e,_=new e;p.rayEllipsoid=function(t,n){var r,i,a,o,u,s=n.oneOverRadii,c=e.multiplyComponents(s,t.origin,O),l=e.multiplyComponents(s,t.direction,_),f=e.magnitudeSquared(c),h=e.dot(c,l);if(f>1){if(h>=0)return void 0;var d=h*h;if(r=f-1,i=e.magnitudeSquared(l),a=i*r,a>d)return void 0;if(d>a){o=h*h-a,u=-h+Math.sqrt(o);var m=u/i,p=r/u;return p>m?{start:m,stop:p}:{start:p,stop:m}}var y=Math.sqrt(r/i);return{start:y,stop:y}}return 1>f?(r=f-1,i=e.magnitudeSquared(l),a=i*r,o=h*h-a,u=-h+Math.sqrt(o),{start:0,stop:u/i}):0>h?(i=e.magnitudeSquared(l),{start:0,stop:-h/i}):void 0};var P=new e,C=new e,z=new e,R=new e,I=new e,N=new o,T=new o,b=new o,A=new o,D=new o,q=new o,U=new o,L=new e,B=new e,W=new t;p.grazingAltitudeLocation=function(t,n){var i=t.origin,u=t.direction,s=n.geodeticSurfaceNormal(i,P);if(e.dot(u,s)>=0)return i;var c=r(this.rayEllipsoid(t,n)),l=n.transformPositionToScaledSpace(u,P),f=e.normalize(l,l),h=e.mostOrthogonalAxis(l,R),d=e.normalize(e.cross(h,f,C),C),p=e.normalize(e.cross(f,d,z),z),y=N;y[0]=f.x,y[1]=f.y,y[2]=f.z,y[3]=d.x,y[4]=d.y,y[5]=d.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=o.transpose(y,T),g=o.fromScale(n.radii,b),w=o.fromScale(n.oneOverRadii,A),x=D;x[0]=0,x[1]=-u.z,x[2]=u.y,x[3]=u.z,x[4]=0,x[5]=-u.x,x[6]=-u.y,x[7]=u.x,x[8]=0;var S,E,M=o.multiply(o.multiply(v,w,q),x,q),O=o.multiply(o.multiply(M,g,U),y,U),_=o.multiplyByVector(M,i,I),F=m(O,e.negate(_,P),0,0,1),k=F.length;if(k>0){for(var V=e.clone(e.ZERO,B),j=Number.NEGATIVE_INFINITY,Y=0;k>Y;++Y){S=o.multiplyByVector(g,o.multiplyByVector(y,F[Y],L),L);var Z=e.normalize(e.subtract(S,i,R),R),X=e.dot(Z,u);X>j&&(j=X,V=e.clone(S,V))}var G=n.cartesianToCartographic(V,W);return j=a.clamp(j,0,1),E=e.magnitude(e.subtract(V,i,R))*Math.sqrt(1-j*j),E=c?-E:E,G.height=E,n.cartographicToCartesian(G,new e)}return void 0};var F=new e;return p.lineSegmentPlane=function(t,n,i,o){r(o)||(o=new e);var u=e.subtract(n,t,F),s=i.normal,c=e.dot(s,u);if(Math.abs(c)<a.EPSILON6)return void 0;var l=e.dot(s,t),f=-(i.distance+l)/c;return 0>f||f>1?void 0:(e.multiplyByScalar(u,f,o),e.add(t,o,o),o)},p.trianglePlaneIntersection=function(t,n,r,i){var a=i.normal,o=i.distance,u=e.dot(a,t)+o<0,s=e.dot(a,n)+o<0,c=e.dot(a,r)+o<0,l=0;l+=u?1:0,l+=s?1:0,l+=c?1:0;var f,h;if((1===l||2===l)&&(f=new e,h=new e),1===l){if(u)return p.lineSegmentPlane(t,n,i,f),p.lineSegmentPlane(t,r,i,h),{positions:[t,n,r,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(s)return p.lineSegmentPlane(n,r,i,f),p.lineSegmentPlane(n,t,i,h),{positions:[t,n,r,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return p.lineSegmentPlane(r,t,i,f),p.lineSegmentPlane(r,n,i,h),{positions:[t,n,r,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===l){if(!u)return p.lineSegmentPlane(n,t,i,f),p.lineSegmentPlane(r,t,i,h),{positions:[t,n,r,f,h],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return p.lineSegmentPlane(r,n,i,f),p.lineSegmentPlane(t,n,i,h),{positions:[t,n,r,f,h],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return p.lineSegmentPlane(t,r,i,f),p.lineSegmentPlane(n,r,i,h),{positions:[t,n,r,f,h],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},p}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,r,i){return t(e).then(n,r,i)}function t(e){var t,n;return e instanceof r?t=e:u(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=i(e),t}function n(t){return e(t,a)}function r(e){this.then=e}function i(e){var n=new r(function(n){try{return t(n?n(e):e)}catch(r){return a(r)}});return n}function a(e){var n=new r(function(n,r){try{return r?t(r(e)):a(e)}catch(i){return a(i)}});return n}function o(){function e(e,t,n){return h(e,t,n)}function n(e){return m(e)}function i(e){return m(a(e))}function u(e){return d(e)}var s,c,l,f,h,d,m;return c=new r(e),s={then:e,resolve:n,reject:i,progress:u,promise:c,resolver:{resolve:n,reject:i,progress:u}},l=[],f=[],h=function(e,t,n){var r,i;return r=o(),i="function"==typeof n?function(e){try{r.progress(n(e))}catch(t){r.progress(t)}}:function(e){r.progress(e)},l.push(function(n){n.then(e,t).then(r.resolve,r.reject,i)}),f.push(i),r.promise},d=function(e){return p(f,e),e},m=function(e){return e=t(e),h=e.then,m=t,d=v,p(l,e),f=l=S,e},s}function u(e){return e&&"function"==typeof e.then}function s(t,n,r,i,a){return y(2,arguments),e(t,function(t){function u(e){p(e)}function s(e){m(e)}var c,l,f,h,d,m,p,y,g,w;if(g=t.length>>>0,c=Math.max(0,Math.min(n,g)),f=[],l=g-c+1,h=[],d=o(),c)for(y=d.progress,p=function(e){h.push(e),--l||(m=p=v,d.reject(h))},m=function(e){f.push(e),--c||(m=p=v,d.resolve(f))},w=0;g>w;++w)w in t&&e(t[w],s,u,y);else d.resolve(f);return d.then(r,i,a)})}function c(e,t,n,r){function i(e){return t?t(e[0]):e[0]}return s(e,1,i,n,r)}function l(e,t,n,r){return y(1,arguments),h(e,g).then(t,n,r)}function f(){return h(arguments,g)}function h(t,n){return e(t,function(t){var r,i,a,u,s,c;if(a=i=t.length>>>0,r=[],c=o(),a)for(u=function(t,i){e(t,n).then(function(e){r[i]=e,--a||c.resolve(r)},c.reject)},s=0;i>s;s++)s in t?u(t[s],s):--a;else c.resolve(r);return c.promise})}function d(t,n){var r=x.call(arguments,1);return e(t,function(t){var i;return i=t.length,r[0]=function(t,r,a){return e(t,function(t){return e(r,function(e){return n(t,e,a,i)})})},w.apply(t,r)})}function m(t,n,r){var i=arguments.length>2;return e(t,function(e){return e=i?r:e,n.resolve(e),e},function(e){return n.reject(e),a(e)},n.progress)}function p(e,t){for(var n,r=0;n=e[r++];)n(t)}function y(e,t){for(var n,r=t.length;r>e;)if(n=t[--r],null!=n&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function v(){}function g(e){return e}var w,x,S;return e.defer=o,e.resolve=t,e.reject=n,e.join=f,e.all=l,e.map=h,e.reduce=d,e.any=c,e.some=s,e.chain=m,e.isPromise=u,r.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(S,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return l(t,function(t){return e.apply(S,t)})})}},x=[].slice,w=[].reduce||function(e){var t,n,r,i,a;if(a=0,t=Object(this),i=t.length>>>0,n=arguments,n.length<=1)for(;;){if(a in t){r=t[a++];break}if(++a>=i)throw new TypeError}else r=n[1];for(;i>a;++a)a in t&&(r=e(r,t[a],a,t));return r},e})}("function"==typeof define&&define.amd?define:function(e){"object"==typeof exports?module.exports=e():this.when=e()}),define("Core/binarySearch",["./defined","./DeveloperError"],function(){"use strict";var e=function(e,t,n){for(var r,i,a=0,o=e.length-1;o>=a;)if(r=~~((a+o)/2),i=n(e[r],t),0>i)a=r+1;else{if(!(i>0))return r;o=r-1}return~(o+1)};return e}),define("Core/EarthOrientationParametersSample",[],function(){"use strict";var e=function(e,t,n,r,i){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=r,this.ut1MinusUtc=i};return e}),define("ThirdParty/sprintf",[],function(){function e(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,n=0,r=t[n++],i=function(e,t,n,r){n||(n=" ");var i=e.length>=t?"":Array(1+t-e.length>>>0).join(n);return r?e+i:i+e},a=function(e,t,n,r,a,o){var u=r-e.length;return u>0&&(e=n||!a?i(e,r,o,n):e.slice(0,t.length)+i("",u,"0",!0)+e.slice(t.length)),e},o=function(e,t,n,r,o,u,s){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+i(c.toString(t),u||0,"0",!1),a(e,n,r,o,s)},u=function(e,t,n,r,i,o){return null!=r&&(e=e.slice(0,r)),a(e,"",t,n,i,o)},s=function(e,r,s,c,l,f,h){var d,m,p,y,v;if("%%"==e)return"%";for(var g=!1,w="",x=!1,S=!1,E=" ",M=s.length,O=0;s&&M>O;O++)switch(s.charAt(O)){case" ":w=" ";break;case"+":w="+";break;case"-":g=!0;break;case"'":E=s.charAt(O+1);break;case"0":x=!0;break;case"#":S=!0}if(c=c?"*"==c?+t[n++]:"*"==c.charAt(0)?+t[c.slice(1,-1)]:+c:0,0>c&&(c=-c,g=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(f=f?"*"==f?+t[n++]:"*"==f.charAt(0)?+t[f.slice(1,-1)]:+f:"fFeE".indexOf(h)>-1?6:"d"==h?0:void 0,v=r?t[r.slice(0,-1)]:t[n++],h){case"s":return u(String(v),g,c,f,x,E);case"c":return u(String.fromCharCode(+v),g,c,f,x);case"b":return o(v,2,S,g,c,f,x);case"o":return o(v,8,S,g,c,f,x);case"x":return o(v,16,S,g,c,f,x);case"X":return o(v,16,S,g,c,f,x).toUpperCase();case"u":return o(v,10,S,g,c,f,x);case"i":case"d":return d=+v||0,d=Math.round(d-d%1),m=0>d?"-":w,v=m+i(String(Math.abs(d)),f,"0",!1),a(v,m,g,c,x);case"e":case"E":case"f":case"F":case"g":case"G":return d=+v,m=0>d?"-":w,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(h.toLowerCase())],y=["toString","toUpperCase"]["eEfFgG".indexOf(h)%2],v=m+Math.abs(d)[p](f),a(v,m,g,c,x)[y]();default:return e}};return r.replace(e,s)}return e}),define("Core/GregorianDate",[],function(){"use strict";var e=function(e,t,n,r,i,a,o,u){this.year=e,this.month=t,this.day=n,this.hour=r,this.minute=i,this.second=a,this.millisecond=o,this.isLeapSecond=u};return e}),define("Core/isLeapYear",["./DeveloperError"],function(){"use strict";function e(e){return 0===e%4&&0!==e%100||0===e%400}return e}),define("Core/LeapSecond",[],function(){"use strict";var e=function(e,t){this.julianDate=e,this.offset=t};return e}),define("Core/TimeConstants",["./freezeObject"],function(e){"use strict";var t={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};return e(t)}),define("Core/TimeStandard",["./freezeObject"],function(e){"use strict";var t={UTC:0,TAI:1};return e(t)}),define("Core/JulianDate",["../ThirdParty/sprintf","./binarySearch","./defaultValue","./defined","./DeveloperError","./GregorianDate","./isLeapYear","./LeapSecond","./TimeConstants","./TimeStandard"],function(e,t,n,r,i,a,o,u,s,c){"use strict";function l(e,t){return R.compare(e.julianDate,t.julianDate)}function f(e){g.julianDate=e;var n=R.leapSeconds,r=t(n,g,l);0>r&&(r=~r),r>=n.length&&(r=n.length-1);var i=n[r].offset;if(r>0){var a=R.secondsDifference(n[r].julianDate,e);a>i&&(r--,i=n[r].offset)}R.addSeconds(e,i,e)}function h(e,n){g.julianDate=e;var r=R.leapSeconds,i=t(r,g,l);if(0>i&&(i=~i),0===i)return R.addSeconds(e,-r[0].offset,n);if(i>=r.length)return R.addSeconds(e,-r[i-1].offset,n);var a=R.secondsDifference(r[i].julianDate,e);return 0===a?R.addSeconds(e,-r[i].offset,n):1>=a?void 0:R.addSeconds(e,-r[--i].offset,n)}function d(e,t,n){var r=0|t/s.SECONDS_PER_DAY;return e+=r,t-=s.SECONDS_PER_DAY*r,0>t&&(e--,t+=s.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function m(e,t,n,r,i,a,o){var u=0|(t-14)/12,c=e+4800+u,l=(0|1461*c/4)+(0|367*(t-2-12*u)/12)-(0|3*((c+100)/100)/4)+n-32075;r-=12,0>r&&(r+=24);var f=a+(r*s.SECONDS_PER_HOUR+i*s.SECONDS_PER_MINUTE+o*s.SECONDS_PER_MILLISECOND);return f>=43200&&(l-=1),[l,f]}var p=new a,y=[31,28,31,30,31,30,31,31,30,31,30,31],v=29,g=new u,w=/^(\d{4})$/,x=/^(\d{4})-(\d{2})$/,S=/^(\d{4})-?(\d{3})$/,E=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,M=/^(\d{4})-?(\d{2})-?(\d{2})$/,O=/([Z+\-])?(\d{2})?:?(\d{2})?$/,_=/^(\d{2})(\.\d+)?/.source+O.source,P=/^(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,C=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+O.source,z="Invalid ISO 8601 date.",R=function(e,t,r){this.dayNumber=void 0,this.secondsOfDay=void 0,e=n(e,0),t=n(t,0),r=n(r,c.UTC);var i=0|e;t+=(e-i)*s.SECONDS_PER_DAY,d(i,t,this),r===c.UTC&&f(this)};R.fromDate=function(e,t){var n=m(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return r(t)?(d(n[0],n[1],t),f(t),t):new R(n[0],n[1],c.UTC)},R.fromIso8601=function(e,t){e=e.replace(",",".");var n,a,u,s=e.split("T"),l=1,h=1,p=0,g=0,O=0,I=0,N=s[0],T=s[1];if(!r(N))throw new i(z);var b;if(s=N.match(M),null!==s){if(b=N.split("-").length-1,b>0&&2!==b)throw new i(z);n=+s[1],l=+s[2],h=+s[3]}else if(s=N.match(x),null!==s)n=+s[1],l=+s[2];else if(s=N.match(w),null!==s)n=+s[1];else{var A;if(s=N.match(S),null!==s){if(n=+s[1],A=+s[2],u=o(n),1>A||u&&A>366||!u&&A>365)throw new i(z)}else{if(s=N.match(E),null===s)throw new i(z);n=+s[1];var D=+s[2],q=+s[3]||0;if(b=N.split("-").length-1,b>0&&(!r(s[3])&&1!==b||r(s[3])&&2!==b))throw new i(z);var U=new Date(Date.UTC(n,0,4));A=7*D+q-U.getUTCDay()-3}a=new Date(Date.UTC(n,0,1)),a.setUTCDate(A),l=a.getUTCMonth()+1,h=a.getUTCDate()}if(u=o(n),1>l||l>12||1>h||(2!==l||!u)&&h>y[l-1]||u&&2===l&&h>v)throw new i(z);var L;if(r(T)){if(s=T.match(C),null!==s){if(b=T.split(":").length-1,b>0&&2!==b&&3!==b)throw new i(z);p=+s[1],g=+s[2],O=+s[3],I=1e3*+(s[4]||0),L=5}else if(s=T.match(P),null!==s){if(b=T.split(":").length-1,b>0&&1!==b)throw new i(z);p=+s[1],g=+s[2],O=60*+(s[3]||0),L=4}else{if(s=T.match(_),null===s)throw new i(z);p=+s[1],g=60*+(s[2]||0),L=3}if(g>=60||O>=61||p>24||24===p&&(g>0||O>0||I>0))throw new i(z);var B=s[L],W=+s[L+1],F=+(s[L+2]||0);switch(B){case"+":p-=W,g-=F;break;case"-":p+=W,g+=F;break;case"Z":break;default:g+=new Date(Date.UTC(n,l-1,h,p,g)).getTimezoneOffset()}}else g+=new Date(n,l-1,h).getTimezoneOffset();var k=60===O;for(k&&O--;g>=60;)g-=60,p++;for(;p>=24;)p-=24,h++;for(a=u&&2===l?v:y[l-1];h>a;)h-=a,l++,l>12&&(l-=12,n++),a=u&&2===l?v:y[l-1];for(;0>g;)g+=60,p--;for(;0>p;)p+=24,h--;for(;1>h;)l--,1>l&&(l+=12,n--),a=u&&2===l?v:y[l-1],h+=a;var V=m(n,l,h,p,g,O,I);return r(t)?(d(V[0],V[1],t),f(t)):t=new R(V[0],V[1],c.UTC),k&&R.addSeconds(t,1,t),t},R.now=function(e){return R.fromDate(new Date,e)};var I=new R(0,0,c.TAI);return R.toGregorianDate=function(e,t){var n=!1,i=h(e,I);r(i)||(R.addSeconds(e,-1,I),i=h(I,I),n=!0);var o=i.dayNumber,u=i.secondsOfDay;u>=43200&&(o+=1);var c=0|o+68569,l=0|4*c/146097;c=0|c-(0|(146097*l+3)/4);var f=0|4e3*(c+1)/1461001;c=0|c-(0|1461*f/4)+31;var d=0|80*c/2447,m=0|c-(0|2447*d/80);c=0|d/11;var p=0|d+2-12*c,y=0|100*(l-49)+f+c,v=0|u/s.SECONDS_PER_HOUR,g=u-v*s.SECONDS_PER_HOUR,w=0|g/s.SECONDS_PER_MINUTE;g-=w*s.SECONDS_PER_MINUTE;var x=0|g,S=(g-x)/s.SECONDS_PER_MILLISECOND;return v+=12,v>23&&(v-=24),n&&(x+=1),r(t)?(t.year=y,t.month=p,t.day=m,t.hour=v,t.minute=w,t.second=x,t.millisecond=S,t.isLeapSecond=n,t):new a(y,p,m,v,w,x,S,n)},R.toDate=function(e){var t=R.toGregorianDate(e,p),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},R.toIso8601=function(t,n){var i,a=R.toGregorianDate(t,a);return r(n)||0===a.millisecond?r(n)&&0!==n?(i=(.01*a.millisecond).toFixed(n).replace(".","").slice(0,n),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",a.year,a.month,a.day,a.hour,a.minute,a.second,i)):e("%04d-%02d-%02dT%02d:%02d:%02dZ",a.year,a.month,a.day,a.hour,a.minute,a.second):(i=(.01*a.millisecond).toString().replace(".",""),e("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",a.year,a.month,a.day,a.hour,a.minute,a.second,i))},R.clone=function(e,t){return r(e)?r(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new R(e.dayNumber,e.secondsOfDay,c.TAI):void 0},R.compare=function(e,t){var n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},R.equals=function(e,t){return e===t||r(e)&&r(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},R.equalsEpsilon=function(e,t,n){return e===t||r(e)&&r(t)&&Math.abs(R.secondsDifference(e,t))<=n},R.totalDays=function(e){return e.dayNumber+e.secondsOfDay/s.SECONDS_PER_DAY},R.secondsDifference=function(e,t){var n=(e.dayNumber-t.dayNumber)*s.SECONDS_PER_DAY;return n+(e.secondsOfDay-t.secondsOfDay)},R.daysDifference=function(e,t){var n=e.dayNumber-t.dayNumber,r=(e.secondsOfDay-t.secondsOfDay)/s.SECONDS_PER_DAY;return n+r},R.computeTaiMinusUtc=function(e){g.julianDate=e;var n=R.leapSeconds,r=t(n,g,l);return 0>r&&(r=~r,--r,0>r&&(r=0)),n[r].offset},R.addSeconds=function(e,t,n){return d(e.dayNumber,e.secondsOfDay+t,n)},R.addMinutes=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_MINUTE;return d(e.dayNumber,r,n)},R.addHours=function(e,t,n){var r=e.secondsOfDay+t*s.SECONDS_PER_HOUR;return d(e.dayNumber,r,n)},R.addDays=function(e,t,n){var r=e.dayNumber+t;return d(r,e.secondsOfDay,n)},R.lessThan=function(e,t){return R.compare(e,t)<0},R.lessThanOrEquals=function(e,t){return R.compare(e,t)<=0},R.greaterThan=function(e,t){return R.compare(e,t)>0},R.greaterThanOrEquals=function(e,t){return R.compare(e,t)>=0},R.prototype.clone=function(e){return R.clone(this,e)},R.prototype.equals=function(e){return R.equals(this,e)},R.prototype.equalsEpsilon=function(e,t){return R.equalsEpsilon(this,e,t)},R.prototype.toString=function(){return R.toIso8601(this)},R.leapSeconds=[new u(new R(2441317,43210,c.TAI),10),new u(new R(2441499,43211,c.TAI),11),new u(new R(2441683,43212,c.TAI),12),new u(new R(2442048,43213,c.TAI),13),new u(new R(2442413,43214,c.TAI),14),new u(new R(2442778,43215,c.TAI),15),new u(new R(2443144,43216,c.TAI),16),new u(new R(2443509,43217,c.TAI),17),new u(new R(2443874,43218,c.TAI),18),new u(new R(2444239,43219,c.TAI),19),new u(new R(2444786,43220,c.TAI),20),new u(new R(2445151,43221,c.TAI),21),new u(new R(2445516,43222,c.TAI),22),new u(new R(2446247,43223,c.TAI),23),new u(new R(2447161,43224,c.TAI),24),new u(new R(2447892,43225,c.TAI),25),new u(new R(2448257,43226,c.TAI),26),new u(new R(2448804,43227,c.TAI),27),new u(new R(2449169,43228,c.TAI),28),new u(new R(2449534,43229,c.TAI),29),new u(new R(2450083,43230,c.TAI),30),new u(new R(2450630,43231,c.TAI),31),new u(new R(2451179,43232,c.TAI),32),new u(new R(2453736,43233,c.TAI),33),new u(new R(2454832,43234,c.TAI),34),new u(new R(2456109,43235,c.TAI),35),new u(new R(2457204,43236,c.TAI),36)],R}),define("Core/clone",["./defaultValue"],function(e){"use strict";var t=function(n,r){if(null===n||"object"!=typeof n)return n;r=e(r,!1);var i=new n.constructor;for(var a in n)if(n.hasOwnProperty(a)){var o=n[a];r&&(o=t(o,r)),i[a]=o}return i};return t}),define("Core/parseResponseHeaders",[],function(){"use strict";var e=function(e){var t={};if(!e)return t;for(var n=e.split("\r\n"),r=0;r<n.length;++r){var i=n[r],a=i.indexOf(": ");if(a>0){var o=i.substring(0,a),u=i.substring(a+2);t[o]=u}}return t};return e}),define("Core/RequestErrorEvent",["./defined","./parseResponseHeaders"],function(e,t){"use strict";var n=function(e,n,r){this.statusCode=e,this.response=n,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=t(this.responseHeaders))};return n.prototype.toString=function(){var t="Request has failed.";return e(this.statusCode)&&(t+=" Status Code: "+this.statusCode),t},n}),define("Core/loadWithXhr",["../ThirdParty/when","./defaultValue","./defined","./DeveloperError","./RequestErrorEvent","./RuntimeError"],function(e,t,n,r,i,a){"use strict";function o(e,t){var n=decodeURIComponent(t);return e?atob(n):n}function u(e,t){for(var n=o(e,t),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return r}function s(e,n){n=t(n,"");var i=e[1],a=!!e[2],s=e[3];switch(n){case"":case"text":return o(a,s);case"arraybuffer":return u(a,s);case"blob":var c=u(a,s);return new Blob([c],{type:i});case"document":var l=new DOMParser;return l.parseFromString(o(a,s),i);case"json":return JSON.parse(o(a,s));default:throw new r("Unhandled responseType: "+n)}}var c=function(n){n=t(n,t.EMPTY_OBJECT);var r=n.responseType,i=t(n.method,"GET"),a=n.data,o=n.headers,u=n.overrideMimeType;return e(n.url,function(t){var n=e.defer();return c.load(t,r,i,a,o,n,u),n.promise})},l=/^data:(.*?)(;base64)?,(.*)$/;return c.load=function(e,t,r,o,u,c,f){var h=l.exec(e);if(null!==h)return c.resolve(s(h,t)),void 0;var d=new XMLHttpRequest;if(n(f)&&n(d.overrideMimeType)&&d.overrideMimeType(f),d.open(r,e,!0),n(u))for(var m in u)u.hasOwnProperty(m)&&d.setRequestHeader(m,u[m]);n(t)&&(d.responseType=t),d.onload=function(){200===d.status?n(d.response)?c.resolve(d.response):n(d.responseXML)&&d.responseXML.hasChildNodes()?c.resolve(d.responseXML):n(d.responseText)?c.resolve(d.responseText):c.reject(new a("unknown XMLHttpRequest response type.")):c.reject(new i(d.status,d.response,d.getAllResponseHeaders()))},d.onerror=function(){c.reject(new i)},d.send(o)},c.defaultLoad=c.load,c}),define("Core/loadText",["./loadWithXhr"],function(e){"use strict";var t=function(t,n){return e({url:t,headers:n})};return t}),define("Core/loadJson",["./clone","./defined","./DeveloperError","./loadText"],function(e,t,n,r){"use strict";var i={Accept:"application/json,*/*;q=0.01"},a=function(n,a){return t(a)?t(a.Accept)||(a=e(a),a.Accept=i.Accept):a=i,r(n,a).then(function(e){return JSON.parse(e)})};return a}),define("Core/EarthOrientationParameters",["../ThirdParty/when","./binarySearch","./defaultValue","./defined","./EarthOrientationParametersSample","./freezeObject","./JulianDate","./LeapSecond","./loadJson","./RuntimeError","./TimeConstants","./TimeStandard"],function(e,t,n,r,i,a,o,u,s,c,l,f){"use strict";function h(e,t){return o.compare(e.julianDate,t)}function d(e,n){if(!r(n.columnNames))return e._dataError="Error in loaded EOP data: The columnNames property is required.",void 0;if(!r(n.samples))return e._dataError="Error in loaded EOP data: The samples property is required.",void 0;var i=n.columnNames.indexOf("modifiedJulianDateUtc"),a=n.columnNames.indexOf("xPoleWanderRadians"),s=n.columnNames.indexOf("yPoleWanderRadians"),c=n.columnNames.indexOf("ut1MinusUtcSeconds"),d=n.columnNames.indexOf("xCelestialPoleOffsetRadians"),m=n.columnNames.indexOf("yCelestialPoleOffsetRadians"),p=n.columnNames.indexOf("taiMinusUtcSeconds");if(0>i||0>a||0>s||0>c||0>d||0>m||0>p)return e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns",void 0;var y=e._samples=n.samples,v=e._dates=[];e._dateColumn=i,e._xPoleWanderRadiansColumn=a,e._yPoleWanderRadiansColumn=s,e._ut1MinusUtcSecondsColumn=c,e._xCelestialPoleOffsetRadiansColumn=d,e._yCelestialPoleOffsetRadiansColumn=m,e._taiMinusUtcSecondsColumn=p,e._columnCount=n.columnNames.length,e._lastIndex=void 0;for(var g,w=e._addNewLeapSeconds,x=0,S=y.length;S>x;x+=e._columnCount){var E=y[x+i],M=y[x+p],O=E+l.MODIFIED_JULIAN_DATE_DIFFERENCE,_=new o(O,M,f.TAI);if(v.push(_),w){if(M!==g&&r(g)){var P=o.leapSeconds,C=t(P,_,h);if(0>C){var z=new u(_,M);P.splice(~C,0,z)}}g=M}}}function m(e,t,n,r,i){var a=n*r;i.xPoleWander=t[a+e._xPoleWanderRadiansColumn],i.yPoleWander=t[a+e._yPoleWanderRadiansColumn],i.xPoleOffset=t[a+e._xCelestialPoleOffsetRadiansColumn],i.yPoleOffset=t[a+e._yCelestialPoleOffsetRadiansColumn],i.ut1MinusUtc=t[a+e._ut1MinusUtcSecondsColumn]}function p(e,t,n){return t+e*(n-t)}function y(e,t,n,r,i,a,u){var s=e._columnCount;if(a>t.length-1)return u.xPoleWander=0,u.yPoleWander=0,u.xPoleOffset=0,u.yPoleOffset=0,u.ut1MinusUtc=0,u; -var c=t[i],l=t[a];if(c.equals(l)||r.equals(c))return m(e,n,i,s,u),u;if(r.equals(l))return m(e,n,a,s,u),u;var f=o.secondsDifference(r,c)/o.secondsDifference(l,c),h=i*s,d=a*s,y=n[h+e._ut1MinusUtcSecondsColumn],v=n[d+e._ut1MinusUtcSecondsColumn],g=v-y;if(g>.5||-.5>g){var w=n[h+e._taiMinusUtcSecondsColumn],x=n[d+e._taiMinusUtcSecondsColumn];w!==x&&(l.equals(r)?y=v:v-=x-w)}return u.xPoleWander=p(f,n[h+e._xPoleWanderRadiansColumn],n[d+e._xPoleWanderRadiansColumn]),u.yPoleWander=p(f,n[h+e._yPoleWanderRadiansColumn],n[d+e._yPoleWanderRadiansColumn]),u.xPoleOffset=p(f,n[h+e._xCelestialPoleOffsetRadiansColumn],n[d+e._xCelestialPoleOffsetRadiansColumn]),u.yPoleOffset=p(f,n[h+e._yCelestialPoleOffsetRadiansColumn],n[d+e._yCelestialPoleOffsetRadiansColumn]),u.ut1MinusUtc=p(f,y,v),u}var v=function(t){if(t=n(t,n.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=n(t.addNewLeapSeconds,!0),r(t.data))d(this,t.data);else if(r(t.url)){var i=this;this._downloadPromise=e(s(t.url),function(e){d(i,e)},function(){i._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else d(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})};return v.NONE=a({getPromiseToLoad:function(){return e()},compute:function(e,t){return r(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new i(0,0,0,0,0),t}}),v.prototype.getPromiseToLoad=function(){return e(this._downloadPromise)},v.prototype.compute=function(e,n){if(!r(this._samples)){if(r(this._dataError))throw new c(this._dataError);return void 0}if(r(n)||(n=new i(0,0,0,0,0)),0===this._samples.length)return n.xPoleWander=0,n.yPoleWander=0,n.xPoleOffset=0,n.yPoleOffset=0,n.ut1MinusUtc=0,n;var a=this._dates,u=this._lastIndex,s=0,l=0;if(r(u)){var f=a[u],h=a[u+1],d=o.lessThanOrEquals(f,e),m=!r(h),p=m||o.greaterThanOrEquals(h,e);if(d&&p)return s=u,!m&&h.equals(e)&&++s,l=s+1,y(this,a,this._samples,e,s,l,n),n}var v=t(a,e,o.compare,this._dateColumn);return v>=0?(v<a.length-1&&a[v+1].equals(e)&&++v,s=v,l=v):(l=~v,s=l-1,0>s&&(s=0)),this._lastIndex=s,y(this,a,this._samples,e,s,l,n),n},v}),define("ThirdParty/Uri",[],function(){function e(t){if(t instanceof e)this.scheme=t.scheme,this.authority=t.authority,this.path=t.path,this.query=t.query,this.fragment=t.fragment;else if(t){var n=r.exec(t);this.scheme=n[1],this.authority=n[2],this.path=n[3],this.query=n[4],this.fragment=n[5]}}function t(e){var t=unescape(e);return a.test(t)?t:e.toUpperCase()}function n(e,t,n,r){return(t||"")+n.toLowerCase()+(r||"")}e.prototype.scheme=null,e.prototype.authority=null,e.prototype.path="",e.prototype.query=null,e.prototype.fragment=null;var r=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");e.prototype.getScheme=function(){return this.scheme},e.prototype.getAuthority=function(){return this.authority},e.prototype.getPath=function(){return this.path},e.prototype.getQuery=function(){return this.query},e.prototype.getFragment=function(){return this.fragment},e.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},e.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},e.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},e.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(o,n).replace(i,t)),this.path&&(this.path=this.path.replace(i,t)),this.query&&(this.query=this.query.replace(i,t)),this.fragment&&(this.fragment=this.fragment.replace(i,t))};var i=/%[0-9a-z]{2}/gi,a=/[a-zA-Z0-9\-\._~]/,o=/(.*@)?([^@:]*)(:.*)?/;return e.prototype.resolve=function(t){var n=new e;return this.scheme?(n.scheme=this.scheme,n.authority=this.authority,n.path=this.path,n.query=this.query):(n.scheme=t.scheme,this.authority?(n.authority=this.authority,n.path=this.path,n.query=this.query):(n.authority=t.authority,""==this.path?(n.path=t.path,n.query=this.query||t.query):("/"==this.path.charAt(0)?(n.path=this.path,n.removeDotSegments()):(n.path=t.authority&&""==t.path?"/"+this.path:t.path.substring(0,t.path.lastIndexOf("/")+1)+this.path,n.removeDotSegments()),n.query=this.query))),n.fragment=this.fragment,n},e.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),n=[],r=""==t[0];for(r&&t.shift(),""==t[0]?t.shift():null;t.length;)e=t.shift(),".."==e?n.pop():"."!=e&&n.push(e);("."==e||".."==e)&&n.push(""),r&&n.unshift(""),this.path=n.join("/")},e.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},e}),define("Core/buildModuleUrl",["../ThirdParty/Uri","./defined","./DeveloperError","require"],function(e,t,n,r){"use strict";function i(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;n>t;++t){var r=e[t].getAttribute("src"),i=f.exec(r);if(null!==i)return i[1]}return void 0}function a(){if(t(s))return s;var r;if(r="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:i(),!t(r))throw new n("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return s=new e(r).resolve(new e(document.location.href))}function o(e){return r.toUrl("../"+e)}function u(t){return new e(t).resolve(a()).toString()}var s,c,l,f=/((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i,h=function(e){t(c)||(c=t(r.toUrl)?o:u),t(l)||(l=document.createElement("a"));var n=c(e);return l.href=n,l.href=l.href,l.href};return h._cesiumScriptRegex=f,h.setBaseUrl=function(t){s=new e(t).resolve(new e(document.location.href))},h}),define("Core/Iau2006XysSample",[],function(){"use strict";var e=function(e,t,n){this.x=e,this.y=t,this.s=n};return e}),define("Core/Iau2006XysData",["../ThirdParty/when","./buildModuleUrl","./defaultValue","./defined","./Iau2006XysSample","./JulianDate","./loadJson","./TimeStandard"],function(e,t,n,r,i,a,o,u){"use strict";function s(e,t,n){var r=f;return r.dayNumber=t,r.secondsOfDay=n,a.daysDifference(r,e._sampleZeroDateTT)}function c(n,i){if(n._chunkDownloadsInProgress[i])return n._chunkDownloadsInProgress[i];var a=e.defer();n._chunkDownloadsInProgress[i]=a;var u,s=n._xysFileUrlTemplate;return u=r(s)?s.replace("{0}",i):t("Assets/IAU2006_XYS/IAU2006_XYS_"+i+".json"),e(o(u),function(e){n._chunkDownloadsInProgress[i]=!1;for(var t=n._samples,r=e.samples,o=3*i*n._samplesPerXysFile,u=0,s=r.length;s>u;++u)t[o+u]=r[u];a.resolve()}),a.promise}var l=function(e){e=n(e,n.EMPTY_OBJECT),this._xysFileUrlTemplate=e.xysFileUrlTemplate,this._interpolationOrder=n(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=n(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new a(this._sampleZeroJulianEphemerisDate,0,u.TAI),this._stepSizeDays=n(e.stepSizeDays,1),this._samplesPerXysFile=n(e.samplesPerXysFile,1e3),this._totalSamples=n(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,r=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t),s=0;t>=s;++s){r[s]=o,i[s]=s*this._stepSizeDays;for(var c=0;t>=c;++c)c!==s&&(r[s]*=s-c);r[s]=1/r[s]}this._work=new Array(t+1),this._coef=new Array(t+1)},f=new a(0,0,u.TAI);return l.prototype.preload=function(t,n,r,i){var a=s(this,t,n),o=s(this,r,i),u=0|a/this._stepSizeDays-this._interpolationOrder/2;0>u&&(u=0);var l=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;l>=this._totalSamples&&(l=this._totalSamples-1);for(var f=0|u/this._samplesPerXysFile,h=0|l/this._samplesPerXysFile,d=[],m=f;h>=m;++m)d.push(c(this,m));return e.all(d)},l.prototype.computeXysRadians=function(e,t,n){var a=s(this,e,t);if(0>a)return void 0;var o=0|a/this._stepSizeDays;if(o>=this._totalSamples)return void 0;var u=this._interpolationOrder,l=o-(0|u/2);0>l&&(l=0);var f=l+u;f>=this._totalSamples&&(f=this._totalSamples-1,l=f-u,0>l&&(l=0));var h=!1,d=this._samples;if(r(d[3*l])||(c(this,0|l/this._samplesPerXysFile),h=!0),r(d[3*f])||(c(this,0|f/this._samplesPerXysFile),h=!0),h)return void 0;r(n)?(n.x=0,n.y=0,n.s=0):n=new i(0,0,0);var m,p,y=a-l*this._stepSizeDays,v=this._work,g=this._denominators,w=this._coef,x=this._xTable;for(m=0;u>=m;++m)v[m]=y-x[m];for(m=0;u>=m;++m){for(w[m]=1,p=0;u>=p;++p)p!==m&&(w[m]*=v[p]);w[m]*=g[m];var S=3*(l+m);n.x+=w[m]*d[S++],n.y+=w[m]*d[S++],n.s+=w[m]*d[S]}return n},l}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var n,r={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return t(i,{element:{get:function(){return i.supportsFullscreen()?document[r.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?r.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[r.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(n))return n;n=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return r.requestFullscreen="requestFullscreen",r.exitFullscreen="exitFullscreen",r.fullscreenEnabled="fullscreenEnabled",r.fullscreenElement="fullscreenElement",r.fullscreenchange="fullscreenchange",r.fullscreenerror="fullscreenerror",n=!0;for(var i,a=["webkit","moz","o","ms","khtml"],o=0,u=a.length;u>o;++o){var s=a[o];i=s+"RequestFullscreen","function"==typeof t[i]?(r.requestFullscreen=i,n=!0):(i=s+"RequestFullScreen","function"==typeof t[i]&&(r.requestFullscreen=i,n=!0)),i=s+"ExitFullscreen","function"==typeof document[i]?r.exitFullscreen=i:(i=s+"CancelFullScreen","function"==typeof document[i]&&(r.exitFullscreen=i)),i=s+"FullscreenEnabled",e(document[i])?r.fullscreenEnabled=i:(i=s+"FullScreenEnabled",e(document[i])&&(r.fullscreenEnabled=i)),i=s+"FullscreenElement",e(document[i])?r.fullscreenElement=i:(i=s+"FullScreenElement",e(document[i])&&(r.fullscreenElement=i)),i=s+"fullscreenchange",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenChange"),r.fullscreenchange=i),i=s+"fullscreenerror",e(document["on"+i])&&("ms"===s&&(i="MSFullscreenError"),r.fullscreenerror=i)}return n},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[r.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[r.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,n){"use strict";function r(e){for(var t=e.split("."),n=0,r=t.length;r>n;++n)t[n]=parseInt(t[n],10);return t}function i(){if(!t(y)){y=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(y=!0,v=r(e[1]))}return y}function a(){return i()&&v}function o(){if(!t(g)&&(g=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(g=!0,w=r(e[1]))}return g}function u(){return o()&&w}function s(){if(!t(x)){x=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(x=!0,S=r(e[1]),S.isNightly=!!e[2])}return x}function c(){return s()&&S}function l(){if(!t(E)){E=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(E=!0,M=r(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(E=!0,M=r(e[1])))}return E}function f(){return l()&&M}function h(){if(!t(O)){O=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(O=!0,_=r(e[1]))}return O}function d(){return t(P)||(P=/Windows/i.test(navigator.appVersion)),P}function m(){return h()&&_}function p(){return t(C)||(C=t(window.PointerEvent)&&(!t(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),C}var y,v,g,w,x,S,E,M,O,_,P,C,z={isChrome:i,chromeVersion:a,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:p};return z.supportsFullscreen=function(){return n.supportsFullscreen()},z.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},z.supportsWebWorkers=function(){return"undefined"!=typeof Worker},z}),define("Core/Quaternion",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,n,r,i,a,o,u){"use strict";var s=function(e,n,r,i){this.x=t(e,0),this.y=t(n,0),this.z=t(r,0),this.w=t(i,0)},c=new e;s.fromAxisAngle=function(t,r,i){var a=r/2,o=Math.sin(a);c=e.normalize(t,c);var u=c.x*o,l=c.y*o,f=c.z*o,h=Math.cos(a);return n(i)?(i.x=u,i.y=l,i.z=f,i.w=h,i):new s(u,l,f,h)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,t){var r,i,a,o,c,h=e[u.COLUMN0ROW0],d=e[u.COLUMN1ROW1],m=e[u.COLUMN2ROW2],p=h+d+m;if(p>0)r=Math.sqrt(p+1),c=.5*r,r=.5/r,i=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*r,a=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*r,o=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*r;else{var y=l,v=0;d>h&&(v=1),m>h&&m>d&&(v=2);var g=y[v],w=y[g];r=Math.sqrt(e[u.getElementIndex(v,v)]-e[u.getElementIndex(g,g)]-e[u.getElementIndex(w,w)]+1);var x=f;x[v]=.5*r,r=.5/r,c=(e[u.getElementIndex(w,g)]-e[u.getElementIndex(g,w)])*r,x[g]=(e[u.getElementIndex(g,v)]+e[u.getElementIndex(v,g)])*r,x[w]=(e[u.getElementIndex(w,v)]+e[u.getElementIndex(v,w)])*r,i=-x[0],a=-x[1],o=-x[2]}return n(t)?(t.x=i,t.y=a,t.z=o,t.w=c,t):new s(i,a,o,c)};var h=new s;s.fromHeadingPitchRoll=function(t,n,r,i){var a=s.fromAxisAngle(e.UNIT_X,r,h),o=s.fromAxisAngle(e.UNIT_Y,-n,i);i=s.multiply(o,a,o);var u=s.fromAxisAngle(e.UNIT_Z,-t,h);return s.multiply(u,i,i)};var d=new e,m=new e,p=new s,y=new s,v=new s;s.packedLength=4,s.pack=function(e,n,r){r=t(r,0),n[r++]=e.x,n[r++]=e.y,n[r++]=e.z,n[r]=e.w},s.unpack=function(e,r,i){return r=t(r,0),n(i)||(i=new s),i.x=e[r],i.y=e[r+1],i.z=e[r+2],i.w=e[r+3],i},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,n,r){s.unpack(e,4*n,v),s.conjugate(v,v);for(var i=0,a=n-t+1;a>i;i++){var o=3*i;s.unpack(e,4*(t+i),p),s.multiply(p,v,p),p.w<0&&s.negate(p,p),s.computeAxis(p,d);var u=s.computeAngle(p);r[o]=d.x*u,r[o+1]=d.y*u,r[o+2]=d.z*u}},s.unpackInterpolationResult=function(t,r,i,a,o){n(o)||(o=new s),e.fromArray(t,0,m);var u=e.magnitude(m);return s.unpack(r,4*a,y),0===u?s.clone(s.IDENTITY,p):s.fromAxisAngle(m,u,p),s.multiply(p,y,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},s.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,t){var n=1/s.magnitude(e),r=e.x*n,i=e.y*n,a=e.z*n,o=e.w*n;return t.x=r,t.y=i,t.z=a,t.w=o,t},s.inverse=function(e,t){var n=s.magnitudeSquared(e);return t=s.conjugate(e,t),s.multiplyByScalar(t,1/n,t)},s.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},s.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},s.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},s.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},s.multiply=function(e,t,n){var r=e.x,i=e.y,a=e.z,o=e.w,u=t.x,s=t.y,c=t.z,l=t.w,f=o*u+r*l+i*c-a*s,h=o*s-r*c+i*l+a*u,d=o*c+r*s-i*u+a*l,m=o*l-r*u-i*s-a*c;return n.x=f,n.y=h,n.z=d,n.w=m,n},s.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},s.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},s.computeAxis=function(e,t){var n=e.w;if(Math.abs(n-1)<o.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-n*n);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},s.computeAngle=function(e){return Math.abs(e.w-1)<o.EPSILON6?0:2*Math.acos(e.w)};var g=new s;s.lerp=function(e,t,n,r){return g=s.multiplyByScalar(t,n,g),r=s.multiplyByScalar(e,1-n,r),s.add(g,r,r)};var w=new s,x=new s,S=new s;s.slerp=function(e,t,n,r){var i=s.dot(e,t),a=t;if(0>i&&(i=-i,a=w=s.negate(t,w)),1-i<o.EPSILON6)return s.lerp(e,a,n,r);var u=Math.acos(i);return x=s.multiplyByScalar(e,Math.sin((1-n)*u),x),S=s.multiplyByScalar(a,Math.sin(n*u),S),r=s.add(x,S,r),s.multiplyByScalar(r,1/Math.sin(u),r)},s.log=function(t,n){var r=o.acosClamped(t.w),i=0;return 0!==r&&(i=r/Math.sin(r)),e.multiplyByScalar(t,i,n)},s.exp=function(t,n){var r=e.magnitude(t),i=0;return 0!==r&&(i=Math.sin(r)/r),n.x=t.x*i,n.y=t.y*i,n.z=t.z*i,n.w=Math.cos(r),n};var E=new e,M=new e,O=new s,_=new s;s.computeInnerQuadrangle=function(t,n,r,i){var a=s.conjugate(n,O);s.multiply(a,r,_);var o=s.log(_,E);s.multiply(a,t,_);var u=s.log(_,M);return e.add(o,u,o),e.multiplyByScalar(o,.25,o),e.negate(o,o),s.exp(o,O),s.multiply(n,O,i)},s.squad=function(e,t,n,r,i,a){var o=s.slerp(e,t,i,O),u=s.slerp(n,r,i,_);return s.slerp(o,u,2*i*(1-i),a)};for(var P=new s,C=1.9011074535173003,z=i.supportsTypedArrays()?new Float32Array(8):[],R=i.supportsTypedArrays()?new Float32Array(8):[],I=i.supportsTypedArrays()?new Float32Array(8):[],N=i.supportsTypedArrays()?new Float32Array(8):[],T=0;7>T;++T){var b=T+1,A=2*b+1;z[T]=1/(b*A),R[T]=b/A}return z[7]=C/136,R[7]=8*C/17,s.fastSlerp=function(e,t,n,r){var i,a=s.dot(e,t);a>=0?i=1:(i=-1,a=-a);for(var o=a-1,u=1-n,c=n*n,l=u*u,f=7;f>=0;--f)I[f]=(z[f]*c-R[f])*o,N[f]=(z[f]*l-R[f])*o;var h=i*n*(1+I[0]*(1+I[1]*(1+I[2]*(1+I[3]*(1+I[4]*(1+I[5]*(1+I[6]*(1+I[7])))))))),d=u*(1+N[0]*(1+N[1]*(1+N[2]*(1+N[3]*(1+N[4]*(1+N[5]*(1+N[6]*(1+N[7])))))))),m=s.multiplyByScalar(e,d,P);return s.multiplyByScalar(t,h,r),s.add(m,r,r)},s.fastSquad=function(e,t,n,r,i,a){var o=s.fastSlerp(e,t,i,O),u=s.fastSlerp(n,r,i,_);return s.fastSlerp(o,u,2*i*(1-i),a)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,t,r){return e===t||n(e)&&n(t)&&Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r&&Math.abs(e.z-t.z)<=r&&Math.abs(e.w-t.w)<=r},s.ZERO=a(new s(0,0,0,0)),s.IDENTITY=a(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Transforms",["../ThirdParty/when","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./EarthOrientationParameters","./EarthOrientationParametersSample","./Ellipsoid","./Iau2006XysData","./Iau2006XysSample","./JulianDate","./Math","./Matrix3","./Matrix4","./Quaternion","./TimeConstants"],function(e,t,n,r,i,a,o,u,s,c,l,f,h,d,m,p,y,v){"use strict";var g={},w=new n,x=new n,S=new n;g.eastNorthUpToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(r)?(r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=-o,r[5]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(0,-o,0,e.x,1,0,0,e.y,0,0,o,e.z,0,0,0,1)}var u=w,s=x,l=S;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=s.x,r[1]=s.y,r[2]=s.z,r[3]=0,r[4]=l.x,r[5]=l.y,r[6]=l.z,r[7]=0,r[8]=u.x,r[9]=u.y,r[10]=u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(s.x,l.x,u.x,e.x,s.y,l.y,u.y,e.y,s.z,l.z,u.z,e.z,0,0,0,1)};var E=new n,M=new n,O=new n;g.northEastDownToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=-o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,1,0,e.y,0,0,-o,e.z,0,0,0,1)}var u=E,s=M,l=O;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=-u.x,r[9]=-u.y,r[10]=-u.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,s.x,-u.x,e.x,l.y,s.y,-u.y,e.y,l.z,s.z,-u.z,e.z,0,0,0,1)},g.northUpEastToFixedFrame=function(e,t,r){if(d.equalsEpsilon(e.x,0,d.EPSILON14)&&d.equalsEpsilon(e.y,0,d.EPSILON14)){var o=d.sign(e.z);return a(r)?(r[0]=-o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=o,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(-o,0,0,e.x,0,0,1,e.y,0,o,0,e.z,0,0,0,1)}var u=w,s=x,l=S;return t=i(t,c.WGS84),t.geodeticSurfaceNormal(e,u),s.x=-e.y,s.y=e.x,s.z=0,n.normalize(s,s),n.cross(u,s,l),a(r)?(r[0]=l.x,r[1]=l.y,r[2]=l.z,r[3]=0,r[4]=u.x,r[5]=u.y,r[6]=u.z,r[7]=0,r[8]=s.x,r[9]=s.y,r[10]=s.z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r):new p(l.x,u.x,s.x,e.x,l.y,u.y,s.y,e.y,l.z,u.z,s.z,e.z,0,0,0,1)};var _=new y,P=new n(1,1,1),C=new p;g.headingPitchRollToFixedFrame=function(e,t,r,i,a,o){var u=y.fromHeadingPitchRoll(t,r,i,_),s=p.fromTranslationQuaternionRotationScale(n.ZERO,u,P,C);return o=g.eastNorthUpToFixedFrame(e,a,o),p.multiply(o,s,o)};var z=new p,R=new m;g.headingPitchRollQuaternion=function(e,t,n,r,i,a){var o=g.headingPitchRollToFixedFrame(e,t,n,r,i,z),u=p.getRotation(o,R);return y.fromRotationMatrix(u,a)};var I=24110.54841,N=8640184.812866,T=.093104,b=-62e-7,A=1.1772758384668e-19,D=72921158553e-15,q=d.TWO_PI/86400,U=new h;g.computeTemeToPseudoFixedMatrix=function(e,t){U=h.addSeconds(e,-h.computeTaiMinusUtc(e),U);var n,r=U.dayNumber,i=U.secondsOfDay,o=r-2451545;n=i>=43200?(o+.5)/v.DAYS_PER_JULIAN_CENTURY:(o-.5)/v.DAYS_PER_JULIAN_CENTURY;var u=I+n*(N+n*(T+n*b)),s=u*q%d.TWO_PI,c=D+A*(r-2451545.5),l=(i+.5*v.SECONDS_PER_DAY)%v.SECONDS_PER_DAY,f=s+c*l,p=Math.cos(f),y=Math.sin(f);return a(t)?(t[0]=p,t[1]=-y,t[2]=0,t[3]=y,t[4]=p,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new m(p,y,0,-y,p,0,0,0,1)},g.iau2006XysData=new l,g.earthOrientationParameters=u.NONE;var L=32.184,B=2451545;g.preloadIcrfFixed=function(t){var n=t.start.dayNumber,r=t.start.secondsOfDay+L,i=t.stop.dayNumber,a=t.stop.secondsOfDay+L,o=g.iau2006XysData.preload(n,r,i,a),u=g.earthOrientationParameters.getPromiseToLoad();return e.all([o,u])},g.computeIcrfToFixedMatrix=function(e,t){a(t)||(t=new m);var n=g.computeFixedToIcrfMatrix(e,t);return a(n)?m.transpose(n,t):void 0};var W=new f(0,0,0),F=new s(0,0,0,0,0,0),k=new m,V=new m;g.computeFixedToIcrfMatrix=function(e,t){a(t)||(t=new m);var n=g.earthOrientationParameters.compute(e,F);if(!a(n))return void 0;var r=e.dayNumber,i=e.secondsOfDay+L,o=g.iau2006XysData.computeXysRadians(r,i,W);if(!a(o))return void 0;var u=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-u*u-s*s)),l=k;l[0]=1-c*u*u,l[3]=-c*u*s,l[6]=u,l[1]=-c*u*s,l[4]=1-c*s*s,l[7]=s,l[2]=-u,l[5]=-s,l[8]=1-c*(u*u+s*s);var f=m.fromRotationZ(-o.s,V),p=m.multiply(l,f,k),y=e.dayNumber,w=e.secondsOfDay-h.computeTaiMinusUtc(e)+n.ut1MinusUtc,x=y-2451545,S=w/v.SECONDS_PER_DAY,E=.779057273264+S+.00273781191135448*(x+S);E=E%1*d.TWO_PI;var M=m.fromRotationZ(E,V),O=m.multiply(p,M,k),_=Math.cos(n.xPoleWander),P=Math.cos(n.yPoleWander),C=Math.sin(n.xPoleWander),z=Math.sin(n.yPoleWander),R=r-B+i/v.SECONDS_PER_DAY;R/=36525;var I=-47e-6*R*d.RADIANS_PER_DEGREE/3600,N=Math.cos(I),T=Math.sin(I),b=V;return b[0]=_*N,b[1]=_*T,b[2]=C,b[3]=-P*T+z*C*N,b[4]=P*N+z*C*T,b[5]=-z*_,b[6]=-z*T-P*C*N,b[7]=z*N-P*C*T,b[8]=P*_,m.multiply(O,b,t)};var j=new r;g.pointToWindowCoordinates=function(e,t,n,r){return r=g.pointToGLWindowCoordinates(e,t,n,r),r.y=2*t[5]-r.y,r},g.pointToGLWindowCoordinates=function(e,n,i,o){a(o)||(o=new t);var u=j;return p.multiplyByVector(e,r.fromElements(i.x,i.y,i.z,1,u),u),r.multiplyByScalar(u,1/u.w,u),p.multiplyByVector(n,u,u),t.fromCartesian4(u,o)};var Y=new n,Z=new n,X=new n;return g.rotationMatrixFromPositionVelocity=function(e,t,r,o){var u=i(r,c.WGS84).geodeticSurfaceNormal(e,Y),s=n.cross(t,u,Z);n.equalsEpsilon(s,n.ZERO,d.EPSILON6)&&(s=n.clone(n.UNIT_X,s));var l=n.cross(s,t,X);return n.cross(t,l,s),n.negate(s,s),a(o)||(o=new m),o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=s.x,o[4]=s.y,o[5]=s.z,o[6]=l.x,o[7]=l.y,o[8]=l.z,o},g}),define("Core/EllipsoidTangentPlane",["./AxisAlignedBoundingBox","./Cartesian2","./Cartesian3","./Cartesian4","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./IntersectionTests","./Matrix3","./Matrix4","./Plane","./Ray","./Transforms"],function(e,t,n,r,i,a,o,u,s,c,l,f,h,d,m){"use strict";var p=new r,y=function(e,t){t=i(t,s.WGS84),e=t.scaleToGeodeticSurface(e);var r=m.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=n.fromCartesian4(f.getColumn(r,0,p)),this._yAxis=n.fromCartesian4(f.getColumn(r,1,p));var a=n.fromCartesian4(f.getColumn(r,2,p));this._plane=h.fromPointNormal(e,a)};o(y.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var v=new e;y.fromPoints=function(t,n){var r=e.fromPoints(t,v);return new y(r.center,n)};var g=new d,w=new n;y.prototype.projectPointOntoPlane=function(e,r){var i=g;i.origin=e,n.normalize(e,i.direction);var o=c.rayPlane(i,this._plane,w);if(a(o)||(n.negate(i.direction,i.direction),o=c.rayPlane(i,this._plane,w)),a(o)){var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return a(r)?(r.x=s,r.y=l,r):new t(s,l)}return void 0},y.prototype.projectPointsOntoPlane=function(e,t){a(t)||(t=[]);for(var n=0,r=e.length,i=0;r>i;i++){var o=this.projectPointOntoPlane(e[i],t[n]);a(o)&&(t[n]=o,n++)}return t.length=n,t},y.prototype.projectPointToNearestOnPlane=function(e,r){a(r)||(r=new t);var i=g;i.origin=e,n.clone(this._plane.normal,i.direction);var o=c.rayPlane(i,this._plane,w);a(o)||(n.negate(i.direction,i.direction),o=c.rayPlane(i,this._plane,w));var u=n.subtract(o,this._origin,o),s=n.dot(this._xAxis,u),l=n.dot(this._yAxis,u);return r.x=s,r.y=l,r},y.prototype.projectPointsToNearestOnPlane=function(e,t){a(t)||(t=[]);var n=e.length;t.length=n;for(var r=0;n>r;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var x=new n;return y.prototype.projectPointsOntoEllipsoid=function(e,t){var r=e.length;a(t)?t.length=r:t=new Array(r);for(var i=this._ellipsoid,o=this._origin,u=this._xAxis,s=this._yAxis,c=x,l=0;r>l;++l){var f=e[l];n.multiplyByScalar(u,f.x,c),a(t[l])||(t[l]=new n);var h=n.add(o,c,t[l]);n.multiplyByScalar(s,f.y,c),n.add(h,c,h),i.scaleToGeocentricSurface(h,h)}return t},y}),define("Core/OrientedBoundingBox",["./Cartesian2","./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./EllipsoidTangentPlane","./Intersect","./Plane","./Rectangle","./Math","./Matrix3"],function(e,t,n,r,i,a,o,u,s,c,l,f,h){"use strict";var d=function(e,n){this.center=t.clone(r(e,t.ZERO)),this.halfAxes=h.clone(r(n,h.ZERO))},m=new t,p=new t,y=function(e,n,r,a,o,u,s,c){i(c)||(c=new d);var l=c.halfAxes;h.setColumn(l,0,e.xAxis,l),h.setColumn(l,1,e.yAxis,l),h.setColumn(l,2,e.zAxis,l);var f=m;f.x=(n+r)/2,f.y=(a+o)/2,f.z=(u+s)/2;var y=p;y.x=(r-n)/2,y.y=(o-a)/2,y.z=(s-u)/2;var v=c.center;return f=h.multiplyByVector(l,f,f),t.add(e.origin,f,v),h.multiplyByScale(l,y,l),c},v=new n,g=new t,w=[new n,new n,new n,new n,new n,new n,new n,new n],x=[new t,new t,new t,new t,new t,new t,new t,new t],S=[new e,new e,new e,new e,new e,new e,new e,new e];return d.fromRectangle=function(e,t,n,i,a){t=r(t,0),n=r(n,0),i=r(i,o.WGS84);var s=l.center(e,v),f=i.cartographicToCartesian(s,g),h=new u(f,i),d=h.plane,m=w[0],p=w[1],E=w[2],M=w[3],O=w[4],_=w[5],P=w[6],C=w[7],z=s.longitude,R=e.south<0&&e.north>0?0:s.latitude;P.latitude=_.latitude=O.latitude=e.south,C.latitude=M.latitude=R,m.latitude=p.latitude=E.latitude=e.north,P.longitude=C.longitude=m.longitude=e.west,_.longitude=p.longitude=z,O.longitude=M.longitude=E.longitude=e.east,E.height=p.height=m.height=C.height=P.height=_.height=O.height=M.height=n,i.cartographicArrayToCartesianArray(w,x),h.projectPointsToNearestOnPlane(x,S);var I=Math.min(S[6].x,S[7].x,S[0].x),N=Math.max(S[2].x,S[3].x,S[4].x),T=Math.min(S[4].y,S[5].y,S[6].y),b=Math.max(S[0].y,S[1].y,S[2].y);E.height=m.height=O.height=P.height=t,i.cartographicArrayToCartesianArray(w,x);var A=Math.min(c.getPointDistance(d,x[0]),c.getPointDistance(d,x[2]),c.getPointDistance(d,x[4]),c.getPointDistance(d,x[6])),D=n;return y(h,I,N,T,b,A,D,a)},d.clone=function(e,n){return i(e)?i(n)?(t.clone(e.center,n.center),h.clone(e.halfAxes,n.halfAxes),n):new d(e.center,e.halfAxes):void 0},d.intersectPlane=function(e,n){var r=e.center,i=n.normal,a=e.halfAxes,o=i.x,u=i.y,c=i.z,l=Math.abs(o*a[h.COLUMN0ROW0]+u*a[h.COLUMN0ROW1]+c*a[h.COLUMN0ROW2])+Math.abs(o*a[h.COLUMN1ROW0]+u*a[h.COLUMN1ROW1]+c*a[h.COLUMN1ROW2])+Math.abs(o*a[h.COLUMN2ROW0]+u*a[h.COLUMN2ROW1]+c*a[h.COLUMN2ROW2]),f=t.dot(i,r)+n.distance;return-l>=f?s.OUTSIDE:f>=l?s.INSIDE:s.INTERSECTING},d.prototype.intersectPlane=function(e){return d.intersectPlane(this,e)},d.equals=function(e,n){return e===n||i(e)&&i(n)&&t.equals(e.center,n.center)&&h.equals(e.halfAxes,n.halfAxes)},d.prototype.clone=function(e){return d.clone(this,e)},d.prototype.equals=function(e){return d.equals(this,e)},d}),define("Core/formatError",["./defined"],function(e){"use strict";var t=function(t){var n,r=t.name,i=t.message;n=e(r)&&e(i)?r+": "+i:t.toString();var a=t.stack;return e(a)&&(n+="\n"+a),n};return t}),define("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,t,n){"use strict";var r=function(r){var i,a=[],o={id:void 0,result:void 0,error:void 0};return function(u){var s=u.data;a.length=0,o.id=s.id,o.error=void 0,o.result=void 0;try{o.result=r(s.parameters,a)}catch(c){o.error=c instanceof Error?{name:c.name,message:c.message,stack:c.stack}:c}t(i)||(i=e(self.webkitPostMessage,self.postMessage)),s.canTransferArrayBuffer||(a.length=0);try{i(o,a)}catch(c){o.result=void 0,o.error="postMessage failed with error: "+n(c)+"\n with responseMessage: "+JSON.stringify(o),i(o)}}};return r}),define("Workers/upsampleQuantizedTerrainMesh",["../Core/AttributeCompression","../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/defined","../Core/Ellipsoid","../Core/EllipsoidalOccluder","../Core/IndexDatatype","../Core/Intersections2D","../Core/Math","../Core/OrientedBoundingBox","./createTaskProcessorWorker"],function(e,t,n,r,i,a,o,u,s,c,l,f,h){"use strict";function d(e,n){var i=e.isEastChild,h=e.isNorthChild,d=i?g:0,p=i?v:g,T=h?g:0,b=h?v:g,A=O,D=_,q=P,U=z;A.length=0,D.length=0,q.length=0,U.length=0;var L=C;L.length=0;var B,W,F,k,V={},j=e.vertices,Y=e.encodedNormals,Z=e.indices,X=j.length/3,G=j.subarray(0,X),H=j.subarray(X,2*X),J=j.subarray(2*X,3*X),K=0,Q=a(Y);for(B=0,W=0;X>B;++B,W+=2)F=G[B],k=H[B],(i&&F>=g||!i&&g>=F)&&(h&&k>=g||!h&&g>=k)&&(V[B]=K,A.push(F),D.push(k),q.push(J[B]),Q&&(U.push(Y[W]),U.push(Y[W+1])),++K);var $=[];$.push(new m),$.push(new m),$.push(new m);var et=[];et.push(new m),et.push(new m),et.push(new m);var tt,nt;for(B=0;B<Z.length;B+=3){var rt=Z[B],it=Z[B+1],at=Z[B+2],ot=G[rt],ut=G[it],st=G[at];$[0].initializeIndexed(G,H,J,Y,rt),$[1].initializeIndexed(G,H,J,Y,it),$[2].initializeIndexed(G,H,J,Y,at);var ct=c.clipTriangleAtAxisAlignedThreshold(g,i,ot,ut,st,w);tt=0,tt>=ct.length||(tt=et[0].initializeFromClipResult(ct,tt,$),tt>=ct.length||(tt=et[1].initializeFromClipResult(ct,tt,$),tt>=ct.length||(tt=et[2].initializeFromClipResult(ct,tt,$),nt=c.clipTriangleAtAxisAlignedThreshold(g,h,et[0].getV(),et[1].getV(),et[2].getV(),x),y(A,D,q,U,L,V,nt,et,Q),tt<ct.length&&(et[2].clone(et[1]),et[2].initializeFromClipResult(ct,tt,$),nt=c.clipTriangleAtAxisAlignedThreshold(g,h,et[0].getV(),et[1].getV(),et[2].getV(),x),y(A,D,q,U,L,V,nt,et,Q))))) -}var lt=i?-v:0,ft=h?-v:0,ht=e.minimumHeight,dt=e.maximumHeight,mt=[],pt=[],yt=[],vt=[],gt=Number.MAX_VALUE,wt=-gt,xt=S;xt.length=0;var St=o.clone(e.ellipsoid),Et=e.childRectangle,Mt=Et.north,Ot=Et.south,_t=Et.east,Pt=Et.west;for(Pt>_t&&(_t+=l.TWO_PI),B=0;B<A.length;++B){F=Math.round(A[B]),d>=F?(mt.push(B),F=0):F>=p?(yt.push(B),F=v):F=2*F+lt,A[B]=F,k=Math.round(D[B]),T>=k?(pt.push(B),k=0):k>=b?(vt.push(B),k=v):k=2*k+ft,D[B]=k;var Ct=l.lerp(ht,dt,q[B]/v);gt>Ct&&(gt=Ct),Ct>wt&&(wt=Ct),q[B]=Ct,E.longitude=l.lerp(Pt,_t,F/v),E.latitude=l.lerp(Ot,Mt,k/v),E.height=Ct,St.cartographicToCartesian(E,M),xt.push(M.x),xt.push(M.y),xt.push(M.z)}var zt=t.fromVertices(xt,r.ZERO,3,I),Rt=f.fromRectangle(Et,gt,wt,St,N),It=new u(St),Nt=It.computeHorizonCullingPointFromVertices(zt.center,xt,3,zt.center,R),Tt=wt-gt,bt=new Uint16Array(A.length+D.length+q.length);for(B=0;B<A.length;++B)bt[B]=A[B];var At=A.length;for(B=0;B<D.length;++B)bt[At+B]=D[B];for(At+=D.length,B=0;B<q.length;++B)bt[At+B]=v*(q[B]-gt)/Tt;var Dt,qt=s.createTypedArray(A.length,L);if(Q){var Ut=new Uint8Array(U);n.push(bt.buffer,qt.buffer,Ut.buffer),Dt=Ut.buffer}else n.push(bt.buffer,qt.buffer);return{vertices:bt.buffer,encodedNormals:Dt,indices:qt.buffer,minimumHeight:gt,maximumHeight:wt,westIndices:mt,southIndices:pt,eastIndices:yt,northIndices:vt,boundingSphere:zt,orientedBoundingBox:Rt,horizonOcclusionPoint:Nt}}function m(){this.vertexBuffer=void 0,this.index=void 0,this.first=void 0,this.second=void 0,this.ratio=void 0}function p(t,n){++b;var i=A[b],a=D[b];return i=e.octDecode(t.first.getNormalX(),t.first.getNormalY(),i),a=e.octDecode(t.second.getNormalX(),t.second.getNormalY(),a),M=r.lerp(i,a,t.ratio,M),r.normalize(M,M),e.octEncode(M,n),--b,n}function y(e,t,n,r,i,o,u,s,c){if(0!==u.length){for(var l=0,f=0;f<u.length;)f=q[l++].initializeFromClipResult(u,f,s);for(var h=0;l>h;++h){var d=q[h];if(d.isIndexed())d.newIndex=o[d.index],d.uBuffer=e,d.vBuffer=t,d.heightBuffer=n,c&&(d.normalBuffer=r);else{var m=d.getKey();if(a(o[m]))d.newIndex=o[m];else{var p=e.length;e.push(d.getU()),t.push(d.getV()),n.push(d.getH()),c&&(r.push(d.getNormalX()),r.push(d.getNormalY())),d.newIndex=p,o[m]=p}}}3===l?(i.push(q[0].newIndex),i.push(q[1].newIndex),i.push(q[2].newIndex)):4===l&&(i.push(q[0].newIndex),i.push(q[1].newIndex),i.push(q[2].newIndex),i.push(q[0].newIndex),i.push(q[2].newIndex),i.push(q[3].newIndex))}}var v=32767,g=0|v/2,w=[],x=[],S=[],E=new i,M=new r,O=[],_=[],P=[],C=[],z=[],R=new r,I=new t,N=new f;m.prototype.clone=function(e){return a(e)||(e=new m),e.uBuffer=this.uBuffer,e.vBuffer=this.vBuffer,e.heightBuffer=this.heightBuffer,e.normalBuffer=this.normalBuffer,e.index=this.index,e.first=this.first,e.second=this.second,e.ratio=this.ratio,e},m.prototype.initializeIndexed=function(e,t,n,r,i){this.uBuffer=e,this.vBuffer=t,this.heightBuffer=n,this.normalBuffer=r,this.index=i,this.first=void 0,this.second=void 0,this.ratio=void 0},m.prototype.initializeInterpolated=function(e,t,n){this.vertexBuffer=void 0,this.index=void 0,this.newIndex=void 0,this.first=e,this.second=t,this.ratio=n},m.prototype.initializeFromClipResult=function(e,t,n){var r=t+1;return-1!==e[t]?n[e[t]].clone(this):(this.vertexBuffer=void 0,this.index=void 0,this.first=n[e[r]],++r,this.second=n[e[r]],++r,this.ratio=e[r],++r),r},m.prototype.getKey=function(){return this.isIndexed()?this.index:JSON.stringify({first:this.first.getKey(),second:this.second.getKey(),ratio:this.ratio})},m.prototype.isIndexed=function(){return a(this.index)},m.prototype.getH=function(){return a(this.index)?this.heightBuffer[this.index]:l.lerp(this.first.getH(),this.second.getH(),this.ratio)},m.prototype.getU=function(){return a(this.index)?this.uBuffer[this.index]:l.lerp(this.first.getU(),this.second.getU(),this.ratio)},m.prototype.getV=function(){return a(this.index)?this.vBuffer[this.index]:l.lerp(this.first.getV(),this.second.getV(),this.ratio)};var T=new n,b=-1,A=[new r,new r],D=[new r,new r];m.prototype.getNormalX=function(){return a(this.index)?this.normalBuffer[2*this.index]:(T=p(this,T),T.x)},m.prototype.getNormalY=function(){return a(this.index)?this.normalBuffer[2*this.index+1]:(T=p(this,T),T.y)};var q=[];return q.push(new m),q.push(new m),q.push(new m),q.push(new m),h(d)})}(); \ No newline at end of file diff --git a/libs/jquery-2.1.4/jquery-2.1.4.min.js b/libs/jquery-2.1.4/jquery-2.1.4.min.js deleted file mode 100644 index 49990d6e..00000000 --- a/libs/jquery-2.1.4/jquery-2.1.4.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){ -return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ia={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qa[0].contentDocument,b.write(),b.close(),c=sa(a,b),qa.detach()),ra[a]=c),c}var ua=/^margin/,va=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wa=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)};function xa(a,b,c){var d,e,f,g,h=a.style;return c=c||wa(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),va.test(g)&&ua.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function ya(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var za=/^(none|table(?!-c[ea]).+)/,Aa=new RegExp("^("+Q+")(.*)$","i"),Ba=new RegExp("^([+-])=("+Q+")","i"),Ca={position:"absolute",visibility:"hidden",display:"block"},Da={letterSpacing:"0",fontWeight:"400"},Ea=["Webkit","O","Moz","ms"];function Fa(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Ea.length;while(e--)if(b=Ea[e]+c,b in a)return b;return d}function Ga(a,b,c){var d=Aa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Ha(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ia(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wa(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xa(a,b,f),(0>e||null==e)&&(e=a.style[b]),va.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Ha(a,b,c||(g?"border":"content"),d,f)+"px"}function Ja(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",ta(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xa(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fa(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Ba.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fa(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xa(a,b,d)),"normal"===e&&b in Da&&(e=Da[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?za.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Ca,function(){return Ia(a,b,d)}):Ia(a,b,d):void 0},set:function(a,c,d){var e=d&&wa(a);return Ga(a,c,d?Ha(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=ya(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ua.test(a)||(n.cssHooks[a+b].set=Ga)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wa(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Ja(this,!0)},hide:function(){return Ja(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Ka(a,b,c,d,e){return new Ka.prototype.init(a,b,c,d,e)}n.Tween=Ka,Ka.prototype={constructor:Ka,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ka.propHooks[this.prop];return a&&a.get?a.get(this):Ka.propHooks._default.get(this)},run:function(a){var b,c=Ka.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ka.propHooks._default.set(this),this}},Ka.prototype.init.prototype=Ka.prototype,Ka.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Ka.propHooks.scrollTop=Ka.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Ka.prototype.init,n.fx.step={};var La,Ma,Na=/^(?:toggle|show|hide)$/,Oa=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pa=/queueHooks$/,Qa=[Va],Ra={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Oa.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Oa.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sa(){return setTimeout(function(){La=void 0}),La=n.now()}function Ta(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ua(a,b,c){for(var d,e=(Ra[b]||[]).concat(Ra["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Va(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||ta(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Na.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?ta(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ua(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wa(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xa(a,b,c){var d,e,f=0,g=Qa.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=La||Sa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:La||Sa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wa(k,j.opts.specialEasing);g>f;f++)if(d=Qa[f].call(j,a,k,j.opts))return d;return n.map(k,Ua,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xa,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Ra[c]=Ra[c]||[],Ra[c].unshift(b)},prefilter:function(a,b){b?Qa.unshift(a):Qa.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xa(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pa.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Ta(b,!0),a,d,e)}}),n.each({slideDown:Ta("show"),slideUp:Ta("hide"),slideToggle:Ta("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(La=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),La=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ma||(Ma=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Ma),Ma=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Ya,Za,$a=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Za:Ya)), -void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Za={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$a[b]||n.find.attr;$a[b]=function(a,b,d){var e,f;return d||(f=$a[b],$a[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$a[b]=f),e}});var _a=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_a.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ab=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ab," ").indexOf(b)>=0)return!0;return!1}});var bb=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cb=n.now(),db=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var eb=/#.*$/,fb=/([?&])_=[^&]*/,gb=/^(.*?):[ \t]*([^\r\n]*)$/gm,hb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ib=/^(?:GET|HEAD)$/,jb=/^\/\//,kb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lb={},mb={},nb="*/".concat("*"),ob=a.location.href,pb=kb.exec(ob.toLowerCase())||[];function qb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function rb(a,b,c,d){var e={},f=a===mb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function sb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function tb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function ub(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ob,type:"GET",isLocal:hb.test(pb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?sb(sb(a,n.ajaxSettings),b):sb(n.ajaxSettings,a)},ajaxPrefilter:qb(lb),ajaxTransport:qb(mb),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=gb.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||ob)+"").replace(eb,"").replace(jb,pb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kb.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pb[1]&&h[2]===pb[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pb[3]||("http:"===pb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rb(lb,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ib.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(db.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=fb.test(d)?d.replace(fb,"$1_="+cb++):d+(db.test(d)?"&":"?")+"_="+cb++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+nb+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=rb(mb,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=tb(k,v,f)),u=ub(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vb=/%20/g,wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&").replace(vb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bb=0,Cb={},Db={0:200,1223:204},Eb=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cb)Cb[a]()}),k.cors=!!Eb&&"withCredentials"in Eb,k.ajax=Eb=!!Eb,n.ajaxTransport(function(a){var b;return k.cors||Eb&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Cb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Db[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Cb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Fb=[],Gb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Fb.pop()||n.expando+"_"+cb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Gb.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Gb,"$1"+e):b.jsonp!==!1&&(b.url+=(db.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Fb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Hb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Hb)return Hb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Ib=a.document.documentElement;function Jb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Jb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Ib;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ib})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Jb(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=ya(k.pixelPosition,function(a,c){return c?(c=xa(a,b),va.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kb=a.jQuery,Lb=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Lb),b&&a.jQuery===n&&(a.jQuery=Kb),n},typeof b===U&&(a.jQuery=a.$=n),n}); diff --git a/libs/jquery.scrollbar-gh-pages.zip b/libs/jquery.scrollbar-gh-pages.zip deleted file mode 100644 index defcdde3..00000000 Binary files a/libs/jquery.scrollbar-gh-pages.zip and /dev/null differ diff --git a/libs/openlayers3/ol-debug.js b/libs/openlayers3/ol-debug.js deleted file mode 100644 index 1edb337a..00000000 --- a/libs/openlayers3/ol-debug.js +++ /dev/null @@ -1,133528 +0,0 @@ -// OpenLayers 3. See http://openlayers.org/ -// License: https://raw.githubusercontent.com/openlayers/ol3/master/LICENSE.md -// Version: v3.11.2 - -(function (root, factory) { - if (typeof exports === "object") { - module.exports = factory(); - } else if (typeof define === "function" && define.amd) { - define([], factory); - } else { - root.ol = factory(); - } -}(this, function () { - var OPENLAYERS = {}; - var goog = this.goog = {}; -this.CLOSURE_NO_DEPS = true; -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Bootstrap for the Google JS Library (Closure). - * - * In uncompiled mode base.js will write out Closure's deps file, unless the - * global <code>CLOSURE_NO_DEPS</code> is set to true. This allows projects to - * include their own deps file(s) from different locations. - * - * @author arv@google.com (Erik Arvidsson) - * - * @provideGoog - */ - - -/** - * @define {boolean} Overridden to true by the compiler when - * --process_closure_primitives is specified. - */ -var COMPILED = false; - - -/** - * Base namespace for the Closure library. Checks to see goog is already - * defined in the current scope before assigning to prevent clobbering if - * base.js is loaded more than once. - * - * @const - */ -var goog = goog || {}; - - -/** - * Reference to the global context. In most cases this will be 'window'. - */ -goog.global = this; - - -/** - * A hook for overriding the define values in uncompiled mode. - * - * In uncompiled mode, {@code CLOSURE_UNCOMPILED_DEFINES} may be defined before - * loading base.js. If a key is defined in {@code CLOSURE_UNCOMPILED_DEFINES}, - * {@code goog.define} will use the value instead of the default value. This - * allows flags to be overwritten without compilation (this is normally - * accomplished with the compiler's "define" flag). - * - * Example: - * <pre> - * var CLOSURE_UNCOMPILED_DEFINES = {'goog.DEBUG': false}; - * </pre> - * - * @type {Object<string, (string|number|boolean)>|undefined} - */ -goog.global.CLOSURE_UNCOMPILED_DEFINES; - - -/** - * A hook for overriding the define values in uncompiled or compiled mode, - * like CLOSURE_UNCOMPILED_DEFINES but effective in compiled code. In - * uncompiled code CLOSURE_UNCOMPILED_DEFINES takes precedence. - * - * Also unlike CLOSURE_UNCOMPILED_DEFINES the values must be number, boolean or - * string literals or the compiler will emit an error. - * - * While any @define value may be set, only those set with goog.define will be - * effective for uncompiled code. - * - * Example: - * <pre> - * var CLOSURE_DEFINES = {'goog.DEBUG': false} ; - * </pre> - * - * @type {Object<string, (string|number|boolean)>|undefined} - */ -goog.global.CLOSURE_DEFINES; - - -/** - * Returns true if the specified value is not undefined. - * WARNING: Do not use this to test if an object has a property. Use the in - * operator instead. - * - * @param {?} val Variable to test. - * @return {boolean} Whether variable is defined. - */ -goog.isDef = function(val) { - // void 0 always evaluates to undefined and hence we do not need to depend on - // the definition of the global variable named 'undefined'. - return val !== void 0; -}; - - -/** - * Builds an object structure for the provided namespace path, ensuring that - * names that already exist are not overwritten. For example: - * "a.b.c" -> a = {};a.b={};a.b.c={}; - * Used by goog.provide and goog.exportSymbol. - * @param {string} name name of the object that this file defines. - * @param {*=} opt_object the object to expose at the end of the path. - * @param {Object=} opt_objectToExportTo The object to add the path to; default - * is |goog.global|. - * @private - */ -goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) { - var parts = name.split('.'); - var cur = opt_objectToExportTo || goog.global; - - // Internet Explorer exhibits strange behavior when throwing errors from - // methods externed in this manner. See the testExportSymbolExceptions in - // base_test.html for an example. - if (!(parts[0] in cur) && cur.execScript) { - cur.execScript('var ' + parts[0]); - } - - // Certain browsers cannot parse code in the form for((a in b); c;); - // This pattern is produced by the JSCompiler when it collapses the - // statement above into the conditional loop below. To prevent this from - // happening, use a for-loop and reserve the init logic as below. - - // Parentheses added to eliminate strict JS warning in Firefox. - for (var part; parts.length && (part = parts.shift());) { - if (!parts.length && goog.isDef(opt_object)) { - // last part and we have an object; use it - cur[part] = opt_object; - } else if (cur[part]) { - cur = cur[part]; - } else { - cur = cur[part] = {}; - } - } -}; - - -/** - * Defines a named value. In uncompiled mode, the value is retrieved from - * CLOSURE_DEFINES or CLOSURE_UNCOMPILED_DEFINES if the object is defined and - * has the property specified, and otherwise used the defined defaultValue. - * When compiled the default can be overridden using the compiler - * options or the value set in the CLOSURE_DEFINES object. - * - * @param {string} name The distinguished name to provide. - * @param {string|number|boolean} defaultValue - */ -goog.define = function(name, defaultValue) { - var value = defaultValue; - if (!COMPILED) { - if (goog.global.CLOSURE_UNCOMPILED_DEFINES && - Object.prototype.hasOwnProperty.call( - goog.global.CLOSURE_UNCOMPILED_DEFINES, name)) { - value = goog.global.CLOSURE_UNCOMPILED_DEFINES[name]; - } else if (goog.global.CLOSURE_DEFINES && - Object.prototype.hasOwnProperty.call( - goog.global.CLOSURE_DEFINES, name)) { - value = goog.global.CLOSURE_DEFINES[name]; - } - } - goog.exportPath_(name, value); -}; - - -/** - * @define {boolean} DEBUG is provided as a convenience so that debugging code - * that should not be included in a production js_binary can be easily stripped - * by specifying --define goog.DEBUG=false to the JSCompiler. For example, most - * toString() methods should be declared inside an "if (goog.DEBUG)" conditional - * because they are generally used for debugging purposes and it is difficult - * for the JSCompiler to statically determine whether they are used. - */ -goog.define('goog.DEBUG', true); - - -/** - * @define {string} LOCALE defines the locale being used for compilation. It is - * used to select locale specific data to be compiled in js binary. BUILD rule - * can specify this value by "--define goog.LOCALE=<locale_name>" as JSCompiler - * option. - * - * Take into account that the locale code format is important. You should use - * the canonical Unicode format with hyphen as a delimiter. Language must be - * lowercase, Language Script - Capitalized, Region - UPPERCASE. - * There are few examples: pt-BR, en, en-US, sr-Latin-BO, zh-Hans-CN. - * - * See more info about locale codes here: - * http://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers - * - * For language codes you should use values defined by ISO 693-1. See it here - * http://www.w3.org/WAI/ER/IG/ert/iso639.htm. There is only one exception from - * this rule: the Hebrew language. For legacy reasons the old code (iw) should - * be used instead of the new code (he), see http://wiki/Main/IIISynonyms. - */ -goog.define('goog.LOCALE', 'en'); // default to en - - -/** - * @define {boolean} Whether this code is running on trusted sites. - * - * On untrusted sites, several native functions can be defined or overridden by - * external libraries like Prototype, Datejs, and JQuery and setting this flag - * to false forces closure to use its own implementations when possible. - * - * If your JavaScript can be loaded by a third party site and you are wary about - * relying on non-standard implementations, specify - * "--define goog.TRUSTED_SITE=false" to the JSCompiler. - */ -goog.define('goog.TRUSTED_SITE', true); - - -/** - * @define {boolean} Whether a project is expected to be running in strict mode. - * - * This define can be used to trigger alternate implementations compatible with - * running in EcmaScript Strict mode or warn about unavailable functionality. - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode - * - */ -goog.define('goog.STRICT_MODE_COMPATIBLE', false); - - -/** - * @define {boolean} Whether code that calls {@link goog.setTestOnly} should - * be disallowed in the compilation unit. - */ -goog.define('goog.DISALLOW_TEST_ONLY_CODE', COMPILED && !goog.DEBUG); - - -/** - * @define {boolean} Whether to use a Chrome app CSP-compliant method for - * loading scripts via goog.require. @see appendScriptSrcNode_. - */ -goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', false); - - -/** - * Defines a namespace in Closure. - * - * A namespace may only be defined once in a codebase. It may be defined using - * goog.provide() or goog.module(). - * - * The presence of one or more goog.provide() calls in a file indicates - * that the file defines the given objects/namespaces. - * Provided symbols must not be null or undefined. - * - * In addition, goog.provide() creates the object stubs for a namespace - * (for example, goog.provide("goog.foo.bar") will create the object - * goog.foo.bar if it does not already exist). - * - * Build tools also scan for provide/require/module statements - * to discern dependencies, build dependency files (see deps.js), etc. - * - * @see goog.require - * @see goog.module - * @param {string} name Namespace provided by this file in the form - * "goog.package.part". - */ -goog.provide = function(name) { - if (!COMPILED) { - // Ensure that the same namespace isn't provided twice. - // A goog.module/goog.provide maps a goog.require to a specific file - if (goog.isProvided_(name)) { - throw Error('Namespace "' + name + '" already declared.'); - } - } - - goog.constructNamespace_(name); -}; - - -/** - * @param {string} name Namespace provided by this file in the form - * "goog.package.part". - * @param {Object=} opt_obj The object to embed in the namespace. - * @private - */ -goog.constructNamespace_ = function(name, opt_obj) { - if (!COMPILED) { - delete goog.implicitNamespaces_[name]; - - var namespace = name; - while ((namespace = namespace.substring(0, namespace.lastIndexOf('.')))) { - if (goog.getObjectByName(namespace)) { - break; - } - goog.implicitNamespaces_[namespace] = true; - } - } - - goog.exportPath_(name, opt_obj); -}; - - -/** - * Module identifier validation regexp. - * Note: This is a conservative check, it is very possible to be more lenient, - * the primary exclusion here is "/" and "\" and a leading ".", these - * restrictions are intended to leave the door open for using goog.require - * with relative file paths rather than module identifiers. - * @private - */ -goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/; - - -/** - * Defines a module in Closure. - * - * Marks that this file must be loaded as a module and claims the namespace. - * - * A namespace may only be defined once in a codebase. It may be defined using - * goog.provide() or goog.module(). - * - * goog.module() has three requirements: - * - goog.module may not be used in the same file as goog.provide. - * - goog.module must be the first statement in the file. - * - only one goog.module is allowed per file. - * - * When a goog.module annotated file is loaded, it is enclosed in - * a strict function closure. This means that: - * - any variables declared in a goog.module file are private to the file - * (not global), though the compiler is expected to inline the module. - * - The code must obey all the rules of "strict" JavaScript. - * - the file will be marked as "use strict" - * - * NOTE: unlike goog.provide, goog.module does not declare any symbols by - * itself. If declared symbols are desired, use - * goog.module.declareLegacyNamespace(). - * - * - * See the public goog.module proposal: http://goo.gl/Va1hin - * - * @param {string} name Namespace provided by this file in the form - * "goog.package.part", is expected but not required. - */ -goog.module = function(name) { - if (!goog.isString(name) || - !name || - name.search(goog.VALID_MODULE_RE_) == -1) { - throw Error('Invalid module identifier'); - } - if (!goog.isInModuleLoader_()) { - throw Error('Module ' + name + ' has been loaded incorrectly.'); - } - if (goog.moduleLoaderState_.moduleName) { - throw Error('goog.module may only be called once per module.'); - } - - // Store the module name for the loader. - goog.moduleLoaderState_.moduleName = name; - if (!COMPILED) { - // Ensure that the same namespace isn't provided twice. - // A goog.module/goog.provide maps a goog.require to a specific file - if (goog.isProvided_(name)) { - throw Error('Namespace "' + name + '" already declared.'); - } - delete goog.implicitNamespaces_[name]; - } -}; - - -/** - * @param {string} name The module identifier. - * @return {?} The module exports for an already loaded module or null. - * - * Note: This is not an alternative to goog.require, it does not - * indicate a hard dependency, instead it is used to indicate - * an optional dependency or to access the exports of a module - * that has already been loaded. - * @suppress {missingProvide} - */ -goog.module.get = function(name) { - return goog.module.getInternal_(name); -}; - - -/** - * @param {string} name The module identifier. - * @return {?} The module exports for an already loaded module or null. - * @private - */ -goog.module.getInternal_ = function(name) { - if (!COMPILED) { - if (goog.isProvided_(name)) { - // goog.require only return a value with-in goog.module files. - return name in goog.loadedModules_ ? - goog.loadedModules_[name] : - goog.getObjectByName(name); - } else { - return null; - } - } -}; - - -/** - * @private {?{moduleName: (string|undefined)}} - */ -goog.moduleLoaderState_ = null; - - -/** - * @private - * @return {boolean} Whether a goog.module is currently being initialized. - */ -goog.isInModuleLoader_ = function() { - return goog.moduleLoaderState_ != null; -}; - - -/** - * Provide the module's exports as a globally accessible object under the - * module's declared name. This is intended to ease migration to goog.module - * for files that have existing usages. - * @suppress {missingProvide} - */ -goog.module.declareLegacyNamespace = function() { - if (!COMPILED && !goog.isInModuleLoader_()) { - throw new Error('goog.module.declareLegacyNamespace must be called from ' + - 'within a goog.module'); - } - if (!COMPILED && !goog.moduleLoaderState_.moduleName) { - throw Error('goog.module must be called prior to ' + - 'goog.module.declareLegacyNamespace.'); - } - goog.moduleLoaderState_.declareLegacyNamespace = true; -}; - - -/** - * Marks that the current file should only be used for testing, and never for - * live code in production. - * - * In the case of unit tests, the message may optionally be an exact namespace - * for the test (e.g. 'goog.stringTest'). The linter will then ignore the extra - * provide (if not explicitly defined in the code). - * - * @param {string=} opt_message Optional message to add to the error that's - * raised when used in production code. - */ -goog.setTestOnly = function(opt_message) { - if (goog.DISALLOW_TEST_ONLY_CODE) { - opt_message = opt_message || ''; - throw Error('Importing test-only code into non-debug environment' + - (opt_message ? ': ' + opt_message : '.')); - } -}; - - -/** - * Forward declares a symbol. This is an indication to the compiler that the - * symbol may be used in the source yet is not required and may not be provided - * in compilation. - * - * The most common usage of forward declaration is code that takes a type as a - * function parameter but does not need to require it. By forward declaring - * instead of requiring, no hard dependency is made, and (if not required - * elsewhere) the namespace may never be required and thus, not be pulled - * into the JavaScript binary. If it is required elsewhere, it will be type - * checked as normal. - * - * - * @param {string} name The namespace to forward declare in the form of - * "goog.package.part". - */ -goog.forwardDeclare = function(name) {}; - - -/** - * Forward declare type information. Used to assign types to goog.global - * referenced object that would otherwise result in unknown type references - * and thus block property disambiguation. - */ -goog.forwardDeclare('Document'); -goog.forwardDeclare('XMLHttpRequest'); - - -if (!COMPILED) { - - /** - * Check if the given name has been goog.provided. This will return false for - * names that are available only as implicit namespaces. - * @param {string} name name of the object to look for. - * @return {boolean} Whether the name has been provided. - * @private - */ - goog.isProvided_ = function(name) { - return (name in goog.loadedModules_) || - (!goog.implicitNamespaces_[name] && - goog.isDefAndNotNull(goog.getObjectByName(name))); - }; - - /** - * Namespaces implicitly defined by goog.provide. For example, - * goog.provide('goog.events.Event') implicitly declares that 'goog' and - * 'goog.events' must be namespaces. - * - * @type {!Object<string, (boolean|undefined)>} - * @private - */ - goog.implicitNamespaces_ = {'goog.module': true}; - - // NOTE: We add goog.module as an implicit namespace as goog.module is defined - // here and because the existing module package has not been moved yet out of - // the goog.module namespace. This satisifies both the debug loader and - // ahead-of-time dependency management. -} - - -/** - * Returns an object based on its fully qualified external name. The object - * is not found if null or undefined. If you are using a compilation pass that - * renames property names beware that using this function will not find renamed - * properties. - * - * @param {string} name The fully qualified name. - * @param {Object=} opt_obj The object within which to look; default is - * |goog.global|. - * @return {?} The value (object or primitive) or, if not found, null. - */ -goog.getObjectByName = function(name, opt_obj) { - var parts = name.split('.'); - var cur = opt_obj || goog.global; - for (var part; part = parts.shift(); ) { - if (goog.isDefAndNotNull(cur[part])) { - cur = cur[part]; - } else { - return null; - } - } - return cur; -}; - - -/** - * Globalizes a whole namespace, such as goog or goog.lang. - * - * @param {!Object} obj The namespace to globalize. - * @param {Object=} opt_global The object to add the properties to. - * @deprecated Properties may be explicitly exported to the global scope, but - * this should no longer be done in bulk. - */ -goog.globalize = function(obj, opt_global) { - var global = opt_global || goog.global; - for (var x in obj) { - global[x] = obj[x]; - } -}; - - -/** - * Adds a dependency from a file to the files it requires. - * @param {string} relPath The path to the js file. - * @param {!Array<string>} provides An array of strings with - * the names of the objects this file provides. - * @param {!Array<string>} requires An array of strings with - * the names of the objects this file requires. - * @param {boolean=} opt_isModule Whether this dependency must be loaded as - * a module as declared by goog.module. - */ -goog.addDependency = function(relPath, provides, requires, opt_isModule) { - if (goog.DEPENDENCIES_ENABLED) { - var provide, require; - var path = relPath.replace(/\\/g, '/'); - var deps = goog.dependencies_; - for (var i = 0; provide = provides[i]; i++) { - deps.nameToPath[provide] = path; - deps.pathIsModule[path] = !!opt_isModule; - } - for (var j = 0; require = requires[j]; j++) { - if (!(path in deps.requires)) { - deps.requires[path] = {}; - } - deps.requires[path][require] = true; - } - } -}; - - - - -// NOTE(nnaze): The debug DOM loader was included in base.js as an original way -// to do "debug-mode" development. The dependency system can sometimes be -// confusing, as can the debug DOM loader's asynchronous nature. -// -// With the DOM loader, a call to goog.require() is not blocking -- the script -// will not load until some point after the current script. If a namespace is -// needed at runtime, it needs to be defined in a previous script, or loaded via -// require() with its registered dependencies. -// User-defined namespaces may need their own deps file. See http://go/js_deps, -// http://go/genjsdeps, or, externally, DepsWriter. -// https://developers.google.com/closure/library/docs/depswriter -// -// Because of legacy clients, the DOM loader can't be easily removed from -// base.js. Work is being done to make it disableable or replaceable for -// different environments (DOM-less JavaScript interpreters like Rhino or V8, -// for example). See bootstrap/ for more information. - - -/** - * @define {boolean} Whether to enable the debug loader. - * - * If enabled, a call to goog.require() will attempt to load the namespace by - * appending a script tag to the DOM (if the namespace has been registered). - * - * If disabled, goog.require() will simply assert that the namespace has been - * provided (and depend on the fact that some outside tool correctly ordered - * the script). - */ -goog.define('goog.ENABLE_DEBUG_LOADER', true); - - -/** - * @param {string} msg - * @private - */ -goog.logToConsole_ = function(msg) { - if (goog.global.console) { - goog.global.console['error'](msg); - } -}; - - -/** - * Implements a system for the dynamic resolution of dependencies that works in - * parallel with the BUILD system. Note that all calls to goog.require will be - * stripped by the JSCompiler when the --process_closure_primitives option is - * used. - * @see goog.provide - * @param {string} name Namespace to include (as was given in goog.provide()) in - * the form "goog.package.part". - * @return {?} If called within a goog.module file, the associated namespace or - * module otherwise null. - */ -goog.require = function(name) { - // If the object already exists we do not need do do anything. - if (!COMPILED) { - if (goog.ENABLE_DEBUG_LOADER && goog.IS_OLD_IE_) { - goog.maybeProcessDeferredDep_(name); - } - - if (goog.isProvided_(name)) { - if (goog.isInModuleLoader_()) { - return goog.module.getInternal_(name); - } else { - return null; - } - } - - if (goog.ENABLE_DEBUG_LOADER) { - var path = goog.getPathFromDeps_(name); - if (path) { - goog.writeScripts_(path); - return null; - } - } - - var errorMessage = 'goog.require could not find: ' + name; - goog.logToConsole_(errorMessage); - - throw Error(errorMessage); - } -}; - - -/** - * Path for included scripts. - * @type {string} - */ -goog.basePath = ''; - - -/** - * A hook for overriding the base path. - * @type {string|undefined} - */ -goog.global.CLOSURE_BASE_PATH; - - -/** - * Whether to write out Closure's deps file. By default, the deps are written. - * @type {boolean|undefined} - */ -goog.global.CLOSURE_NO_DEPS; - - -/** - * A function to import a single script. This is meant to be overridden when - * Closure is being run in non-HTML contexts, such as web workers. It's defined - * in the global scope so that it can be set before base.js is loaded, which - * allows deps.js to be imported properly. - * - * The function is passed the script source, which is a relative URI. It should - * return true if the script was imported, false otherwise. - * @type {(function(string): boolean)|undefined} - */ -goog.global.CLOSURE_IMPORT_SCRIPT; - - -/** - * Null function used for default values of callbacks, etc. - * @return {void} Nothing. - */ -goog.nullFunction = function() {}; - - -/** - * When defining a class Foo with an abstract method bar(), you can do: - * Foo.prototype.bar = goog.abstractMethod - * - * Now if a subclass of Foo fails to override bar(), an error will be thrown - * when bar() is invoked. - * - * Note: This does not take the name of the function to override as an argument - * because that would make it more difficult to obfuscate our JavaScript code. - * - * @type {!Function} - * @throws {Error} when invoked to indicate the method should be overridden. - */ -goog.abstractMethod = function() { - throw Error('unimplemented abstract method'); -}; - - -/** - * Adds a {@code getInstance} static method that always returns the same - * instance object. - * @param {!Function} ctor The constructor for the class to add the static - * method to. - */ -goog.addSingletonGetter = function(ctor) { - ctor.getInstance = function() { - if (ctor.instance_) { - return ctor.instance_; - } - if (goog.DEBUG) { - // NOTE: JSCompiler can't optimize away Array#push. - goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor; - } - return ctor.instance_ = new ctor; - }; -}; - - -/** - * All singleton classes that have been instantiated, for testing. Don't read - * it directly, use the {@code goog.testing.singleton} module. The compiler - * removes this variable if unused. - * @type {!Array<!Function>} - * @private - */ -goog.instantiatedSingletons_ = []; - - -/** - * @define {boolean} Whether to load goog.modules using {@code eval} when using - * the debug loader. This provides a better debugging experience as the - * source is unmodified and can be edited using Chrome Workspaces or similar. - * However in some environments the use of {@code eval} is banned - * so we provide an alternative. - */ -goog.define('goog.LOAD_MODULE_USING_EVAL', true); - - -/** - * @define {boolean} Whether the exports of goog.modules should be sealed when - * possible. - */ -goog.define('goog.SEAL_MODULE_EXPORTS', goog.DEBUG); - - -/** - * The registry of initialized modules: - * the module identifier to module exports map. - * @private @const {!Object<string, ?>} - */ -goog.loadedModules_ = {}; - - -/** - * True if goog.dependencies_ is available. - * @const {boolean} - */ -goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; - - -if (goog.DEPENDENCIES_ENABLED) { - - /** - * This object is used to keep track of dependencies and other data that is - * used for loading scripts. - * @private - * @type {{ - * pathIsModule: !Object<string, boolean>, - * nameToPath: !Object<string, string>, - * requires: !Object<string, !Object<string, boolean>>, - * visited: !Object<string, boolean>, - * written: !Object<string, boolean>, - * deferred: !Object<string, string> - * }} - */ - goog.dependencies_ = { - pathIsModule: {}, // 1 to 1 - - nameToPath: {}, // 1 to 1 - - requires: {}, // 1 to many - - // Used when resolving dependencies to prevent us from visiting file twice. - visited: {}, - - written: {}, // Used to keep track of script files we have written. - - deferred: {} // Used to track deferred module evaluations in old IEs - }; - - - /** - * Tries to detect whether is in the context of an HTML document. - * @return {boolean} True if it looks like HTML document. - * @private - */ - goog.inHtmlDocument_ = function() { - /** @type {Document} */ - var doc = goog.global.document; - return typeof doc != 'undefined' && - 'write' in doc; // XULDocument misses write. - }; - - - /** - * Tries to detect the base path of base.js script that bootstraps Closure. - * @private - */ - goog.findBasePath_ = function() { - if (goog.isDef(goog.global.CLOSURE_BASE_PATH)) { - goog.basePath = goog.global.CLOSURE_BASE_PATH; - return; - } else if (!goog.inHtmlDocument_()) { - return; - } - /** @type {Document} */ - var doc = goog.global.document; - var scripts = doc.getElementsByTagName('SCRIPT'); - // Search backwards since the current script is in almost all cases the one - // that has base.js. - for (var i = scripts.length - 1; i >= 0; --i) { - var script = /** @type {!HTMLScriptElement} */ (scripts[i]); - var src = script.src; - var qmark = src.lastIndexOf('?'); - var l = qmark == -1 ? src.length : qmark; - if (src.substr(l - 7, 7) == 'base.js') { - goog.basePath = src.substr(0, l - 7); - return; - } - } - }; - - - /** - * Imports a script if, and only if, that script hasn't already been imported. - * (Must be called at execution time) - * @param {string} src Script source. - * @param {string=} opt_sourceText The optionally source text to evaluate - * @private - */ - goog.importScript_ = function(src, opt_sourceText) { - var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || - goog.writeScriptTag_; - if (importScript(src, opt_sourceText)) { - goog.dependencies_.written[src] = true; - } - }; - - - /** @const @private {boolean} */ - goog.IS_OLD_IE_ = !!(!goog.global.atob && goog.global.document && - goog.global.document.all); - - - /** - * Given a URL initiate retrieval and execution of the module. - * @param {string} src Script source URL. - * @private - */ - goog.importModule_ = function(src) { - // In an attempt to keep browsers from timing out loading scripts using - // synchronous XHRs, put each load in its own script block. - var bootstrap = 'goog.retrieveAndExecModule_("' + src + '");'; - - if (goog.importScript_('', bootstrap)) { - goog.dependencies_.written[src] = true; - } - }; - - - /** @private {!Array<string>} */ - goog.queuedModules_ = []; - - - /** - * Return an appropriate module text. Suitable to insert into - * a script tag (that is unescaped). - * @param {string} srcUrl - * @param {string} scriptText - * @return {string} - * @private - */ - goog.wrapModule_ = function(srcUrl, scriptText) { - if (!goog.LOAD_MODULE_USING_EVAL || !goog.isDef(goog.global.JSON)) { - return '' + - 'goog.loadModule(function(exports) {' + - '"use strict";' + - scriptText + - '\n' + // terminate any trailing single line comment. - ';return exports' + - '});' + - '\n//# sourceURL=' + srcUrl + '\n'; - } else { - return '' + - 'goog.loadModule(' + - goog.global.JSON.stringify( - scriptText + '\n//# sourceURL=' + srcUrl + '\n') + - ');'; - } - }; - - // On IE9 and earlier, it is necessary to handle - // deferred module loads. In later browsers, the - // code to be evaluated is simply inserted as a script - // block in the correct order. To eval deferred - // code at the right time, we piggy back on goog.require to call - // goog.maybeProcessDeferredDep_. - // - // The goog.requires are used both to bootstrap - // the loading process (when no deps are available) and - // declare that they should be available. - // - // Here we eval the sources, if all the deps are available - // either already eval'd or goog.require'd. This will - // be the case when all the dependencies have already - // been loaded, and the dependent module is loaded. - // - // But this alone isn't sufficient because it is also - // necessary to handle the case where there is no root - // that is not deferred. For that there we register for an event - // and trigger goog.loadQueuedModules_ handle any remaining deferred - // evaluations. - - /** - * Handle any remaining deferred goog.module evals. - * @private - */ - goog.loadQueuedModules_ = function() { - var count = goog.queuedModules_.length; - if (count > 0) { - var queue = goog.queuedModules_; - goog.queuedModules_ = []; - for (var i = 0; i < count; i++) { - var path = queue[i]; - goog.maybeProcessDeferredPath_(path); - } - } - }; - - - /** - * Eval the named module if its dependencies are - * available. - * @param {string} name The module to load. - * @private - */ - goog.maybeProcessDeferredDep_ = function(name) { - if (goog.isDeferredModule_(name) && - goog.allDepsAreAvailable_(name)) { - var path = goog.getPathFromDeps_(name); - goog.maybeProcessDeferredPath_(goog.basePath + path); - } - }; - - /** - * @param {string} name The module to check. - * @return {boolean} Whether the name represents a - * module whose evaluation has been deferred. - * @private - */ - goog.isDeferredModule_ = function(name) { - var path = goog.getPathFromDeps_(name); - if (path && goog.dependencies_.pathIsModule[path]) { - var abspath = goog.basePath + path; - return (abspath) in goog.dependencies_.deferred; - } - return false; - }; - - /** - * @param {string} name The module to check. - * @return {boolean} Whether the name represents a - * module whose declared dependencies have all been loaded - * (eval'd or a deferred module load) - * @private - */ - goog.allDepsAreAvailable_ = function(name) { - var path = goog.getPathFromDeps_(name); - if (path && (path in goog.dependencies_.requires)) { - for (var requireName in goog.dependencies_.requires[path]) { - if (!goog.isProvided_(requireName) && - !goog.isDeferredModule_(requireName)) { - return false; - } - } - } - return true; - }; - - - /** - * @param {string} abspath - * @private - */ - goog.maybeProcessDeferredPath_ = function(abspath) { - if (abspath in goog.dependencies_.deferred) { - var src = goog.dependencies_.deferred[abspath]; - delete goog.dependencies_.deferred[abspath]; - goog.globalEval(src); - } - }; - - - /** - * @param {function(?):?|string} moduleDef The module definition. - */ - goog.loadModule = function(moduleDef) { - // NOTE: we allow function definitions to be either in the from - // of a string to eval (which keeps the original source intact) or - // in a eval forbidden environment (CSP) we allow a function definition - // which in its body must call {@code goog.module}, and return the exports - // of the module. - var previousState = goog.moduleLoaderState_; - try { - goog.moduleLoaderState_ = {moduleName: undefined}; - var exports; - if (goog.isFunction(moduleDef)) { - exports = moduleDef.call(goog.global, {}); - } else if (goog.isString(moduleDef)) { - exports = goog.loadModuleFromSource_.call(goog.global, moduleDef); - } else { - throw Error('Invalid module definition'); - } - - var moduleName = goog.moduleLoaderState_.moduleName; - if (!goog.isString(moduleName) || !moduleName) { - throw Error('Invalid module name \"' + moduleName + '\"'); - } - - // Don't seal legacy namespaces as they may be uses as a parent of - // another namespace - if (goog.moduleLoaderState_.declareLegacyNamespace) { - goog.constructNamespace_(moduleName, exports); - } else if (goog.SEAL_MODULE_EXPORTS && Object.seal) { - Object.seal(exports); - } - - goog.loadedModules_[moduleName] = exports; - } finally { - goog.moduleLoaderState_ = previousState; - } - }; - - - /** - * @private @const {function(string):?} - * @suppress {newCheckTypes} - */ - goog.loadModuleFromSource_ = function() { - // NOTE: we avoid declaring parameters or local variables here to avoid - // masking globals or leaking values into the module definition. - 'use strict'; - var exports = {}; - eval(arguments[0]); - return exports; - }; - - - /** - * Writes a new script pointing to {@code src} directly into the DOM. - * - * NOTE: This method is not CSP-compliant. @see goog.appendScriptSrcNode_ for - * the fallback mechanism. - * - * @param {string} src The script URL. - * @private - */ - goog.writeScriptSrcNode_ = function(src) { - goog.global.document.write( - '<script type="text/javascript" src="' + src + '"></' + 'script>'); - }; - - - /** - * Appends a new script node to the DOM using a CSP-compliant mechanism. This - * method exists as a fallback for document.write (which is not allowed in a - * strict CSP context, e.g., Chrome apps). - * - * NOTE: This method is not analogous to using document.write to insert a - * <script> tag; specifically, the user agent will execute a script added by - * document.write immediately after the current script block finishes - * executing, whereas the DOM-appended script node will not be executed until - * the entire document is parsed and executed. That is to say, this script is - * added to the end of the script execution queue. - * - * The page must not attempt to call goog.required entities until after the - * document has loaded, e.g., in or after the window.onload callback. - * - * @param {string} src The script URL. - * @private - */ - goog.appendScriptSrcNode_ = function(src) { - /** @type {Document} */ - var doc = goog.global.document; - var scriptEl = doc.createElement('script'); - scriptEl.type = 'text/javascript'; - scriptEl.src = src; - scriptEl.defer = false; - scriptEl.async = false; - doc.head.appendChild(scriptEl); - }; - - - /** - * The default implementation of the import function. Writes a script tag to - * import the script. - * - * @param {string} src The script url. - * @param {string=} opt_sourceText The optionally source text to evaluate - * @return {boolean} True if the script was imported, false otherwise. - * @private - */ - goog.writeScriptTag_ = function(src, opt_sourceText) { - if (goog.inHtmlDocument_()) { - /** @type {Document} */ - var doc = goog.global.document; - - // If the user tries to require a new symbol after document load, - // something has gone terribly wrong. Doing a document.write would - // wipe out the page. This does not apply to the CSP-compliant method - // of writing script tags. - if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && - doc.readyState == 'complete') { - // Certain test frameworks load base.js multiple times, which tries - // to write deps.js each time. If that happens, just fail silently. - // These frameworks wipe the page between each load of base.js, so this - // is OK. - var isDeps = /\bdeps.js$/.test(src); - if (isDeps) { - return false; - } else { - throw Error('Cannot write "' + src + '" after document load'); - } - } - - var isOldIE = goog.IS_OLD_IE_; - - if (opt_sourceText === undefined) { - if (!isOldIE) { - if (goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING) { - goog.appendScriptSrcNode_(src); - } else { - goog.writeScriptSrcNode_(src); - } - } else { - var state = " onreadystatechange='goog.onScriptLoad_(this, " + - ++goog.lastNonModuleScriptIndex_ + ")' "; - doc.write( - '<script type="text/javascript" src="' + - src + '"' + state + '></' + 'script>'); - } - } else { - doc.write( - '<script type="text/javascript">' + - opt_sourceText + - '</' + 'script>'); - } - return true; - } else { - return false; - } - }; - - - /** @private {number} */ - goog.lastNonModuleScriptIndex_ = 0; - - - /** - * A readystatechange handler for legacy IE - * @param {!HTMLScriptElement} script - * @param {number} scriptIndex - * @return {boolean} - * @private - */ - goog.onScriptLoad_ = function(script, scriptIndex) { - // for now load the modules when we reach the last script, - // later allow more inter-mingling. - if (script.readyState == 'complete' && - goog.lastNonModuleScriptIndex_ == scriptIndex) { - goog.loadQueuedModules_(); - } - return true; - }; - - /** - * Resolves dependencies based on the dependencies added using addDependency - * and calls importScript_ in the correct order. - * @param {string} pathToLoad The path from which to start discovering - * dependencies. - * @private - */ - goog.writeScripts_ = function(pathToLoad) { - /** @type {!Array<string>} The scripts we need to write this time. */ - var scripts = []; - var seenScript = {}; - var deps = goog.dependencies_; - - /** @param {string} path */ - function visitNode(path) { - if (path in deps.written) { - return; - } - - // We have already visited this one. We can get here if we have cyclic - // dependencies. - if (path in deps.visited) { - return; - } - - deps.visited[path] = true; - - if (path in deps.requires) { - for (var requireName in deps.requires[path]) { - // If the required name is defined, we assume that it was already - // bootstrapped by other means. - if (!goog.isProvided_(requireName)) { - if (requireName in deps.nameToPath) { - visitNode(deps.nameToPath[requireName]); - } else { - throw Error('Undefined nameToPath for ' + requireName); - } - } - } - } - - if (!(path in seenScript)) { - seenScript[path] = true; - scripts.push(path); - } - } - - visitNode(pathToLoad); - - // record that we are going to load all these scripts. - for (var i = 0; i < scripts.length; i++) { - var path = scripts[i]; - goog.dependencies_.written[path] = true; - } - - // If a module is loaded synchronously then we need to - // clear the current inModuleLoader value, and restore it when we are - // done loading the current "requires". - var moduleState = goog.moduleLoaderState_; - goog.moduleLoaderState_ = null; - - for (var i = 0; i < scripts.length; i++) { - var path = scripts[i]; - if (path) { - if (!deps.pathIsModule[path]) { - goog.importScript_(goog.basePath + path); - } else { - goog.importModule_(goog.basePath + path); - } - } else { - goog.moduleLoaderState_ = moduleState; - throw Error('Undefined script input'); - } - } - - // restore the current "module loading state" - goog.moduleLoaderState_ = moduleState; - }; - - - /** - * Looks at the dependency rules and tries to determine the script file that - * fulfills a particular rule. - * @param {string} rule In the form goog.namespace.Class or project.script. - * @return {?string} Url corresponding to the rule, or null. - * @private - */ - goog.getPathFromDeps_ = function(rule) { - if (rule in goog.dependencies_.nameToPath) { - return goog.dependencies_.nameToPath[rule]; - } else { - return null; - } - }; - - goog.findBasePath_(); - - // Allow projects to manage the deps files themselves. - if (!goog.global.CLOSURE_NO_DEPS) { - goog.importScript_(goog.basePath + 'deps.js'); - } -} - - -/** - * Normalize a file path by removing redundant ".." and extraneous "." file - * path components. - * @param {string} path - * @return {string} - * @private - */ -goog.normalizePath_ = function(path) { - var components = path.split('/'); - var i = 0; - while (i < components.length) { - if (components[i] == '.') { - components.splice(i, 1); - } else if (i && components[i] == '..' && - components[i - 1] && components[i - 1] != '..') { - components.splice(--i, 2); - } else { - i++; - } - } - return components.join('/'); -}; - - -/** - * Loads file by synchronous XHR. Should not be used in production environments. - * @param {string} src Source URL. - * @return {string} File contents. - * @private - */ -goog.loadFileSync_ = function(src) { - if (goog.global.CLOSURE_LOAD_FILE_SYNC) { - return goog.global.CLOSURE_LOAD_FILE_SYNC(src); - } else { - /** @type {XMLHttpRequest} */ - var xhr = new goog.global['XMLHttpRequest'](); - xhr.open('get', src, false); - xhr.send(); - return xhr.responseText; - } -}; - - -/** - * Retrieve and execute a module. - * @param {string} src Script source URL. - * @private - */ -goog.retrieveAndExecModule_ = function(src) { - if (!COMPILED) { - // The full but non-canonicalized URL for later use. - var originalPath = src; - // Canonicalize the path, removing any /./ or /../ since Chrome's debugging - // console doesn't auto-canonicalize XHR loads as it does <script> srcs. - src = goog.normalizePath_(src); - - var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || - goog.writeScriptTag_; - - var scriptText = goog.loadFileSync_(src); - - if (scriptText != null) { - var execModuleScript = goog.wrapModule_(src, scriptText); - var isOldIE = goog.IS_OLD_IE_; - if (isOldIE) { - goog.dependencies_.deferred[originalPath] = execModuleScript; - goog.queuedModules_.push(originalPath); - } else { - importScript(src, execModuleScript); - } - } else { - throw new Error('load of ' + src + 'failed'); - } - } -}; - - -//============================================================================== -// Language Enhancements -//============================================================================== - - -/** - * This is a "fixed" version of the typeof operator. It differs from the typeof - * operator in such a way that null returns 'null' and arrays return 'array'. - * @param {*} value The value to get the type of. - * @return {string} The name of the type. - */ -goog.typeOf = function(value) { - var s = typeof value; - if (s == 'object') { - if (value) { - // Check these first, so we can avoid calling Object.prototype.toString if - // possible. - // - // IE improperly marshals tyepof across execution contexts, but a - // cross-context object will still return false for "instanceof Object". - if (value instanceof Array) { - return 'array'; - } else if (value instanceof Object) { - return s; - } - - // HACK: In order to use an Object prototype method on the arbitrary - // value, the compiler requires the value be cast to type Object, - // even though the ECMA spec explicitly allows it. - var className = Object.prototype.toString.call( - /** @type {Object} */ (value)); - // In Firefox 3.6, attempting to access iframe window objects' length - // property throws an NS_ERROR_FAILURE, so we need to special-case it - // here. - if (className == '[object Window]') { - return 'object'; - } - - // We cannot always use constructor == Array or instanceof Array because - // different frames have different Array objects. In IE6, if the iframe - // where the array was created is destroyed, the array loses its - // prototype. Then dereferencing val.splice here throws an exception, so - // we can't use goog.isFunction. Calling typeof directly returns 'unknown' - // so that will work. In this case, this function will return false and - // most array functions will still work because the array is still - // array-like (supports length and []) even though it has lost its - // prototype. - // Mark Miller noticed that Object.prototype.toString - // allows access to the unforgeable [[Class]] property. - // 15.2.4.2 Object.prototype.toString ( ) - // When the toString method is called, the following steps are taken: - // 1. Get the [[Class]] property of this object. - // 2. Compute a string value by concatenating the three strings - // "[object ", Result(1), and "]". - // 3. Return Result(2). - // and this behavior survives the destruction of the execution context. - if ((className == '[object Array]' || - // In IE all non value types are wrapped as objects across window - // boundaries (not iframe though) so we have to do object detection - // for this edge case. - typeof value.length == 'number' && - typeof value.splice != 'undefined' && - typeof value.propertyIsEnumerable != 'undefined' && - !value.propertyIsEnumerable('splice') - - )) { - return 'array'; - } - // HACK: There is still an array case that fails. - // function ArrayImpostor() {} - // ArrayImpostor.prototype = []; - // var impostor = new ArrayImpostor; - // this can be fixed by getting rid of the fast path - // (value instanceof Array) and solely relying on - // (value && Object.prototype.toString.vall(value) === '[object Array]') - // but that would require many more function calls and is not warranted - // unless closure code is receiving objects from untrusted sources. - - // IE in cross-window calls does not correctly marshal the function type - // (it appears just as an object) so we cannot use just typeof val == - // 'function'. However, if the object has a call property, it is a - // function. - if ((className == '[object Function]' || - typeof value.call != 'undefined' && - typeof value.propertyIsEnumerable != 'undefined' && - !value.propertyIsEnumerable('call'))) { - return 'function'; - } - - } else { - return 'null'; - } - - } else if (s == 'function' && typeof value.call == 'undefined') { - // In Safari typeof nodeList returns 'function', and on Firefox typeof - // behaves similarly for HTML{Applet,Embed,Object}, Elements and RegExps. We - // would like to return object for those and we can detect an invalid - // function by making sure that the function object has a call method. - return 'object'; - } - return s; -}; - - -/** - * Returns true if the specified value is null. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is null. - */ -goog.isNull = function(val) { - return val === null; -}; - - -/** - * Returns true if the specified value is defined and not null. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is defined and not null. - */ -goog.isDefAndNotNull = function(val) { - // Note that undefined == null. - return val != null; -}; - - -/** - * Returns true if the specified value is an array. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is an array. - */ -goog.isArray = function(val) { - return goog.typeOf(val) == 'array'; -}; - - -/** - * Returns true if the object looks like an array. To qualify as array like - * the value needs to be either a NodeList or an object with a Number length - * property. As a special case, a function value is not array like, because its - * length property is fixed to correspond to the number of expected arguments. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is an array. - */ -goog.isArrayLike = function(val) { - var type = goog.typeOf(val); - // We do not use goog.isObject here in order to exclude function values. - return type == 'array' || type == 'object' && typeof val.length == 'number'; -}; - - -/** - * Returns true if the object looks like a Date. To qualify as Date-like the - * value needs to be an object and have a getFullYear() function. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is a like a Date. - */ -goog.isDateLike = function(val) { - return goog.isObject(val) && typeof val.getFullYear == 'function'; -}; - - -/** - * Returns true if the specified value is a string. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is a string. - */ -goog.isString = function(val) { - return typeof val == 'string'; -}; - - -/** - * Returns true if the specified value is a boolean. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is boolean. - */ -goog.isBoolean = function(val) { - return typeof val == 'boolean'; -}; - - -/** - * Returns true if the specified value is a number. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is a number. - */ -goog.isNumber = function(val) { - return typeof val == 'number'; -}; - - -/** - * Returns true if the specified value is a function. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is a function. - */ -goog.isFunction = function(val) { - return goog.typeOf(val) == 'function'; -}; - - -/** - * Returns true if the specified value is an object. This includes arrays and - * functions. - * @param {?} val Variable to test. - * @return {boolean} Whether variable is an object. - */ -goog.isObject = function(val) { - var type = typeof val; - return type == 'object' && val != null || type == 'function'; - // return Object(val) === val also works, but is slower, especially if val is - // not an object. -}; - - -/** - * Gets a unique ID for an object. This mutates the object so that further calls - * with the same object as a parameter returns the same value. The unique ID is - * guaranteed to be unique across the current session amongst objects that are - * passed into {@code getUid}. There is no guarantee that the ID is unique or - * consistent across sessions. It is unsafe to generate unique ID for function - * prototypes. - * - * @param {Object} obj The object to get the unique ID for. - * @return {number} The unique ID for the object. - */ -goog.getUid = function(obj) { - // TODO(arv): Make the type stricter, do not accept null. - - // In Opera window.hasOwnProperty exists but always returns false so we avoid - // using it. As a consequence the unique ID generated for BaseClass.prototype - // and SubClass.prototype will be the same. - return obj[goog.UID_PROPERTY_] || - (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_); -}; - - -/** - * Whether the given object is already assigned a unique ID. - * - * This does not modify the object. - * - * @param {!Object} obj The object to check. - * @return {boolean} Whether there is an assigned unique id for the object. - */ -goog.hasUid = function(obj) { - return !!obj[goog.UID_PROPERTY_]; -}; - - -/** - * Removes the unique ID from an object. This is useful if the object was - * previously mutated using {@code goog.getUid} in which case the mutation is - * undone. - * @param {Object} obj The object to remove the unique ID field from. - */ -goog.removeUid = function(obj) { - // TODO(arv): Make the type stricter, do not accept null. - - // In IE, DOM nodes are not instances of Object and throw an exception if we - // try to delete. Instead we try to use removeAttribute. - if ('removeAttribute' in obj) { - obj.removeAttribute(goog.UID_PROPERTY_); - } - /** @preserveTry */ - try { - delete obj[goog.UID_PROPERTY_]; - } catch (ex) { - } -}; - - -/** - * Name for unique ID property. Initialized in a way to help avoid collisions - * with other closure JavaScript on the same page. - * @type {string} - * @private - */ -goog.UID_PROPERTY_ = 'closure_uid_' + ((Math.random() * 1e9) >>> 0); - - -/** - * Counter for UID. - * @type {number} - * @private - */ -goog.uidCounter_ = 0; - - -/** - * Adds a hash code field to an object. The hash code is unique for the - * given object. - * @param {Object} obj The object to get the hash code for. - * @return {number} The hash code for the object. - * @deprecated Use goog.getUid instead. - */ -goog.getHashCode = goog.getUid; - - -/** - * Removes the hash code field from an object. - * @param {Object} obj The object to remove the field from. - * @deprecated Use goog.removeUid instead. - */ -goog.removeHashCode = goog.removeUid; - - -/** - * Clones a value. The input may be an Object, Array, or basic type. Objects and - * arrays will be cloned recursively. - * - * WARNINGS: - * <code>goog.cloneObject</code> does not detect reference loops. Objects that - * refer to themselves will cause infinite recursion. - * - * <code>goog.cloneObject</code> is unaware of unique identifiers, and copies - * UIDs created by <code>getUid</code> into cloned results. - * - * @param {*} obj The value to clone. - * @return {*} A clone of the input value. - * @deprecated goog.cloneObject is unsafe. Prefer the goog.object methods. - */ -goog.cloneObject = function(obj) { - var type = goog.typeOf(obj); - if (type == 'object' || type == 'array') { - if (obj.clone) { - return obj.clone(); - } - var clone = type == 'array' ? [] : {}; - for (var key in obj) { - clone[key] = goog.cloneObject(obj[key]); - } - return clone; - } - - return obj; -}; - - -/** - * A native implementation of goog.bind. - * @param {Function} fn A function to partially apply. - * @param {Object|undefined} selfObj Specifies the object which this should - * point to when the function is run. - * @param {...*} var_args Additional arguments that are partially applied to the - * function. - * @return {!Function} A partially-applied form of the function bind() was - * invoked as a method of. - * @private - * @suppress {deprecated} The compiler thinks that Function.prototype.bind is - * deprecated because some people have declared a pure-JS version. - * Only the pure-JS version is truly deprecated. - */ -goog.bindNative_ = function(fn, selfObj, var_args) { - return /** @type {!Function} */ (fn.call.apply(fn.bind, arguments)); -}; - - -/** - * A pure-JS implementation of goog.bind. - * @param {Function} fn A function to partially apply. - * @param {Object|undefined} selfObj Specifies the object which this should - * point to when the function is run. - * @param {...*} var_args Additional arguments that are partially applied to the - * function. - * @return {!Function} A partially-applied form of the function bind() was - * invoked as a method of. - * @private - */ -goog.bindJs_ = function(fn, selfObj, var_args) { - if (!fn) { - throw new Error(); - } - - if (arguments.length > 2) { - var boundArgs = Array.prototype.slice.call(arguments, 2); - return function() { - // Prepend the bound arguments to the current arguments. - var newArgs = Array.prototype.slice.call(arguments); - Array.prototype.unshift.apply(newArgs, boundArgs); - return fn.apply(selfObj, newArgs); - }; - - } else { - return function() { - return fn.apply(selfObj, arguments); - }; - } -}; - - -/** - * Partially applies this function to a particular 'this object' and zero or - * more arguments. The result is a new function with some arguments of the first - * function pre-filled and the value of this 'pre-specified'. - * - * Remaining arguments specified at call-time are appended to the pre-specified - * ones. - * - * Also see: {@link #partial}. - * - * Usage: - * <pre>var barMethBound = goog.bind(myFunction, myObj, 'arg1', 'arg2'); - * barMethBound('arg3', 'arg4');</pre> - * - * @param {?function(this:T, ...)} fn A function to partially apply. - * @param {T} selfObj Specifies the object which this should point to when the - * function is run. - * @param {...*} var_args Additional arguments that are partially applied to the - * function. - * @return {!Function} A partially-applied form of the function goog.bind() was - * invoked as a method of. - * @template T - * @suppress {deprecated} See above. - */ -goog.bind = function(fn, selfObj, var_args) { - // TODO(nicksantos): narrow the type signature. - if (Function.prototype.bind && - // NOTE(nicksantos): Somebody pulled base.js into the default Chrome - // extension environment. This means that for Chrome extensions, they get - // the implementation of Function.prototype.bind that calls goog.bind - // instead of the native one. Even worse, we don't want to introduce a - // circular dependency between goog.bind and Function.prototype.bind, so - // we have to hack this to make sure it works correctly. - Function.prototype.bind.toString().indexOf('native code') != -1) { - goog.bind = goog.bindNative_; - } else { - goog.bind = goog.bindJs_; - } - return goog.bind.apply(null, arguments); -}; - - -/** - * Like goog.bind(), except that a 'this object' is not required. Useful when - * the target function is already bound. - * - * Usage: - * var g = goog.partial(f, arg1, arg2); - * g(arg3, arg4); - * - * @param {Function} fn A function to partially apply. - * @param {...*} var_args Additional arguments that are partially applied to fn. - * @return {!Function} A partially-applied form of the function goog.partial() - * was invoked as a method of. - */ -goog.partial = function(fn, var_args) { - var args = Array.prototype.slice.call(arguments, 1); - return function() { - // Clone the array (with slice()) and append additional arguments - // to the existing arguments. - var newArgs = args.slice(); - newArgs.push.apply(newArgs, arguments); - return fn.apply(this, newArgs); - }; -}; - - -/** - * Copies all the members of a source object to a target object. This method - * does not work on all browsers for all objects that contain keys such as - * toString or hasOwnProperty. Use goog.object.extend for this purpose. - * @param {Object} target Target. - * @param {Object} source Source. - */ -goog.mixin = function(target, source) { - for (var x in source) { - target[x] = source[x]; - } - - // For IE7 or lower, the for-in-loop does not contain any properties that are - // not enumerable on the prototype object (for example, isPrototypeOf from - // Object.prototype) but also it will not include 'replace' on objects that - // extend String and change 'replace' (not that it is common for anyone to - // extend anything except Object). -}; - - -/** - * @return {number} An integer value representing the number of milliseconds - * between midnight, January 1, 1970 and the current time. - */ -goog.now = (goog.TRUSTED_SITE && Date.now) || (function() { - // Unary plus operator converts its operand to a number which in the case of - // a date is done by calling getTime(). - return +new Date(); -}); - - -/** - * Evals JavaScript in the global scope. In IE this uses execScript, other - * browsers use goog.global.eval. If goog.global.eval does not evaluate in the - * global scope (for example, in Safari), appends a script tag instead. - * Throws an exception if neither execScript or eval is defined. - * @param {string} script JavaScript string. - */ -goog.globalEval = function(script) { - if (goog.global.execScript) { - goog.global.execScript(script, 'JavaScript'); - } else if (goog.global.eval) { - // Test to see if eval works - if (goog.evalWorksForGlobals_ == null) { - goog.global.eval('var _evalTest_ = 1;'); - if (typeof goog.global['_evalTest_'] != 'undefined') { - try { - delete goog.global['_evalTest_']; - } catch (ignore) { - // Microsoft edge fails the deletion above in strict mode. - } - goog.evalWorksForGlobals_ = true; - } else { - goog.evalWorksForGlobals_ = false; - } - } - - if (goog.evalWorksForGlobals_) { - goog.global.eval(script); - } else { - /** @type {Document} */ - var doc = goog.global.document; - var scriptElt = doc.createElement('SCRIPT'); - scriptElt.type = 'text/javascript'; - scriptElt.defer = false; - // Note(user): can't use .innerHTML since "t('<test>')" will fail and - // .text doesn't work in Safari 2. Therefore we append a text node. - scriptElt.appendChild(doc.createTextNode(script)); - doc.body.appendChild(scriptElt); - doc.body.removeChild(scriptElt); - } - } else { - throw Error('goog.globalEval not available'); - } -}; - - -/** - * Indicates whether or not we can call 'eval' directly to eval code in the - * global scope. Set to a Boolean by the first call to goog.globalEval (which - * empirically tests whether eval works for globals). @see goog.globalEval - * @type {?boolean} - * @private - */ -goog.evalWorksForGlobals_ = null; - - -/** - * Optional map of CSS class names to obfuscated names used with - * goog.getCssName(). - * @private {!Object<string, string>|undefined} - * @see goog.setCssNameMapping - */ -goog.cssNameMapping_; - - -/** - * Optional obfuscation style for CSS class names. Should be set to either - * 'BY_WHOLE' or 'BY_PART' if defined. - * @type {string|undefined} - * @private - * @see goog.setCssNameMapping - */ -goog.cssNameMappingStyle_; - - -/** - * Handles strings that are intended to be used as CSS class names. - * - * This function works in tandem with @see goog.setCssNameMapping. - * - * Without any mapping set, the arguments are simple joined with a hyphen and - * passed through unaltered. - * - * When there is a mapping, there are two possible styles in which these - * mappings are used. In the BY_PART style, each part (i.e. in between hyphens) - * of the passed in css name is rewritten according to the map. In the BY_WHOLE - * style, the full css name is looked up in the map directly. If a rewrite is - * not specified by the map, the compiler will output a warning. - * - * When the mapping is passed to the compiler, it will replace calls to - * goog.getCssName with the strings from the mapping, e.g. - * var x = goog.getCssName('foo'); - * var y = goog.getCssName(this.baseClass, 'active'); - * becomes: - * var x= 'foo'; - * var y = this.baseClass + '-active'; - * - * If one argument is passed it will be processed, if two are passed only the - * modifier will be processed, as it is assumed the first argument was generated - * as a result of calling goog.getCssName. - * - * @param {string} className The class name. - * @param {string=} opt_modifier A modifier to be appended to the class name. - * @return {string} The class name or the concatenation of the class name and - * the modifier. - */ -goog.getCssName = function(className, opt_modifier) { - var getMapping = function(cssName) { - return goog.cssNameMapping_[cssName] || cssName; - }; - - var renameByParts = function(cssName) { - // Remap all the parts individually. - var parts = cssName.split('-'); - var mapped = []; - for (var i = 0; i < parts.length; i++) { - mapped.push(getMapping(parts[i])); - } - return mapped.join('-'); - }; - - var rename; - if (goog.cssNameMapping_) { - rename = goog.cssNameMappingStyle_ == 'BY_WHOLE' ? - getMapping : renameByParts; - } else { - rename = function(a) { - return a; - }; - } - - if (opt_modifier) { - return className + '-' + rename(opt_modifier); - } else { - return rename(className); - } -}; - - -/** - * Sets the map to check when returning a value from goog.getCssName(). Example: - * <pre> - * goog.setCssNameMapping({ - * "goog": "a", - * "disabled": "b", - * }); - * - * var x = goog.getCssName('goog'); - * // The following evaluates to: "a a-b". - * goog.getCssName('goog') + ' ' + goog.getCssName(x, 'disabled') - * </pre> - * When declared as a map of string literals to string literals, the JSCompiler - * will replace all calls to goog.getCssName() using the supplied map if the - * --process_closure_primitives flag is set. - * - * @param {!Object} mapping A map of strings to strings where keys are possible - * arguments to goog.getCssName() and values are the corresponding values - * that should be returned. - * @param {string=} opt_style The style of css name mapping. There are two valid - * options: 'BY_PART', and 'BY_WHOLE'. - * @see goog.getCssName for a description. - */ -goog.setCssNameMapping = function(mapping, opt_style) { - goog.cssNameMapping_ = mapping; - goog.cssNameMappingStyle_ = opt_style; -}; - - -/** - * To use CSS renaming in compiled mode, one of the input files should have a - * call to goog.setCssNameMapping() with an object literal that the JSCompiler - * can extract and use to replace all calls to goog.getCssName(). In uncompiled - * mode, JavaScript code should be loaded before this base.js file that declares - * a global variable, CLOSURE_CSS_NAME_MAPPING, which is used below. This is - * to ensure that the mapping is loaded before any calls to goog.getCssName() - * are made in uncompiled mode. - * - * A hook for overriding the CSS name mapping. - * @type {!Object<string, string>|undefined} - */ -goog.global.CLOSURE_CSS_NAME_MAPPING; - - -if (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) { - // This does not call goog.setCssNameMapping() because the JSCompiler - // requires that goog.setCssNameMapping() be called with an object literal. - goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING; -} - - -/** - * Gets a localized message. - * - * This function is a compiler primitive. If you give the compiler a localized - * message bundle, it will replace the string at compile-time with a localized - * version, and expand goog.getMsg call to a concatenated string. - * - * Messages must be initialized in the form: - * <code> - * var MSG_NAME = goog.getMsg('Hello {$placeholder}', {'placeholder': 'world'}); - * </code> - * - * @param {string} str Translatable string, places holders in the form {$foo}. - * @param {Object<string, string>=} opt_values Maps place holder name to value. - * @return {string} message with placeholders filled. - */ -goog.getMsg = function(str, opt_values) { - if (opt_values) { - str = str.replace(/\{\$([^}]+)}/g, function(match, key) { - return key in opt_values ? opt_values[key] : match; - }); - } - return str; -}; - - -/** - * Gets a localized message. If the message does not have a translation, gives a - * fallback message. - * - * This is useful when introducing a new message that has not yet been - * translated into all languages. - * - * This function is a compiler primitive. Must be used in the form: - * <code>var x = goog.getMsgWithFallback(MSG_A, MSG_B);</code> - * where MSG_A and MSG_B were initialized with goog.getMsg. - * - * @param {string} a The preferred message. - * @param {string} b The fallback message. - * @return {string} The best translated message. - */ -goog.getMsgWithFallback = function(a, b) { - return a; -}; - - -/** - * Exposes an unobfuscated global namespace path for the given object. - * Note that fields of the exported object *will* be obfuscated, unless they are - * exported in turn via this function or goog.exportProperty. - * - * Also handy for making public items that are defined in anonymous closures. - * - * ex. goog.exportSymbol('public.path.Foo', Foo); - * - * ex. goog.exportSymbol('public.path.Foo.staticFunction', Foo.staticFunction); - * public.path.Foo.staticFunction(); - * - * ex. goog.exportSymbol('public.path.Foo.prototype.myMethod', - * Foo.prototype.myMethod); - * new public.path.Foo().myMethod(); - * - * @param {string} publicPath Unobfuscated name to export. - * @param {*} object Object the name should point to. - * @param {Object=} opt_objectToExportTo The object to add the path to; default - * is goog.global. - */ -goog.exportSymbol = function(publicPath, object, opt_objectToExportTo) { - goog.exportPath_(publicPath, object, opt_objectToExportTo); -}; - - -/** - * Exports a property unobfuscated into the object's namespace. - * ex. goog.exportProperty(Foo, 'staticFunction', Foo.staticFunction); - * ex. goog.exportProperty(Foo.prototype, 'myMethod', Foo.prototype.myMethod); - * @param {Object} object Object whose static property is being exported. - * @param {string} publicName Unobfuscated name to export. - * @param {*} symbol Object the name should point to. - */ -goog.exportProperty = function(object, publicName, symbol) { - object[publicName] = symbol; -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * Usage: - * <pre> - * function ParentClass(a, b) { } - * ParentClass.prototype.foo = function(a) { }; - * - * function ChildClass(a, b, c) { - * ChildClass.base(this, 'constructor', a, b); - * } - * goog.inherits(ChildClass, ParentClass); - * - * var child = new ChildClass('a', 'b', 'see'); - * child.foo(); // This works. - * </pre> - * - * @param {!Function} childCtor Child class. - * @param {!Function} parentCtor Parent class. - */ -goog.inherits = function(childCtor, parentCtor) { - /** @constructor */ - function tempCtor() {}; - tempCtor.prototype = parentCtor.prototype; - childCtor.superClass_ = parentCtor.prototype; - childCtor.prototype = new tempCtor(); - /** @override */ - childCtor.prototype.constructor = childCtor; - - /** - * Calls superclass constructor/method. - * - * This function is only available if you use goog.inherits to - * express inheritance relationships between classes. - * - * NOTE: This is a replacement for goog.base and for superClass_ - * property defined in childCtor. - * - * @param {!Object} me Should always be "this". - * @param {string} methodName The method name to call. Calling - * superclass constructor can be done with the special string - * 'constructor'. - * @param {...*} var_args The arguments to pass to superclass - * method/constructor. - * @return {*} The return value of the superclass method/constructor. - */ - childCtor.base = function(me, methodName, var_args) { - // Copying using loop to avoid deop due to passing arguments object to - // function. This is faster in many JS engines as of late 2014. - var args = new Array(arguments.length - 2); - for (var i = 2; i < arguments.length; i++) { - args[i - 2] = arguments[i]; - } - return parentCtor.prototype[methodName].apply(me, args); - }; -}; - - -/** - * Call up to the superclass. - * - * If this is called from a constructor, then this calls the superclass - * constructor with arguments 1-N. - * - * If this is called from a prototype method, then you must pass the name of the - * method as the second argument to this function. If you do not, you will get a - * runtime error. This calls the superclass' method with arguments 2-N. - * - * This function only works if you use goog.inherits to express inheritance - * relationships between your classes. - * - * This function is a compiler primitive. At compile-time, the compiler will do - * macro expansion to remove a lot of the extra overhead that this function - * introduces. The compiler will also enforce a lot of the assumptions that this - * function makes, and treat it as a compiler error if you break them. - * - * @param {!Object} me Should always be "this". - * @param {*=} opt_methodName The method name if calling a super method. - * @param {...*} var_args The rest of the arguments. - * @return {*} The return value of the superclass method. - * @suppress {es5Strict} This method can not be used in strict mode, but - * all Closure Library consumers must depend on this file. - */ -goog.base = function(me, opt_methodName, var_args) { - var caller = arguments.callee.caller; - - if (goog.STRICT_MODE_COMPATIBLE || (goog.DEBUG && !caller)) { - throw Error('arguments.caller not defined. goog.base() cannot be used ' + - 'with strict mode code. See ' + - 'http://www.ecma-international.org/ecma-262/5.1/#sec-C'); - } - - if (caller.superClass_) { - // Copying using loop to avoid deop due to passing arguments object to - // function. This is faster in many JS engines as of late 2014. - var ctorArgs = new Array(arguments.length - 1); - for (var i = 1; i < arguments.length; i++) { - ctorArgs[i - 1] = arguments[i]; - } - // This is a constructor. Call the superclass constructor. - return caller.superClass_.constructor.apply(me, ctorArgs); - } - - // Copying using loop to avoid deop due to passing arguments object to - // function. This is faster in many JS engines as of late 2014. - var args = new Array(arguments.length - 2); - for (var i = 2; i < arguments.length; i++) { - args[i - 2] = arguments[i]; - } - var foundCaller = false; - for (var ctor = me.constructor; - ctor; ctor = ctor.superClass_ && ctor.superClass_.constructor) { - if (ctor.prototype[opt_methodName] === caller) { - foundCaller = true; - } else if (foundCaller) { - return ctor.prototype[opt_methodName].apply(me, args); - } - } - - // If we did not find the caller in the prototype chain, then one of two - // things happened: - // 1) The caller is an instance method. - // 2) This method was not called by the right caller. - if (me[opt_methodName] === caller) { - return me.constructor.prototype[opt_methodName].apply(me, args); - } else { - throw Error( - 'goog.base called from a method of one name ' + - 'to a method of a different name'); - } -}; - - -/** - * Allow for aliasing within scope functions. This function exists for - * uncompiled code - in compiled code the calls will be inlined and the aliases - * applied. In uncompiled code the function is simply run since the aliases as - * written are valid JavaScript. - * - * - * @param {function()} fn Function to call. This function can contain aliases - * to namespaces (e.g. "var dom = goog.dom") or classes - * (e.g. "var Timer = goog.Timer"). - */ -goog.scope = function(fn) { - fn.call(goog.global); -}; - - -/* - * To support uncompiled, strict mode bundles that use eval to divide source - * like so: - * eval('someSource;//# sourceUrl sourcefile.js'); - * We need to export the globally defined symbols "goog" and "COMPILED". - * Exporting "goog" breaks the compiler optimizations, so we required that - * be defined externally. - * NOTE: We don't use goog.exportSymbol here because we don't want to trigger - * extern generation when that compiler option is enabled. - */ -if (!COMPILED) { - goog.global['COMPILED'] = COMPILED; -} - - - -//============================================================================== -// goog.defineClass implementation -//============================================================================== - - -/** - * Creates a restricted form of a Closure "class": - * - from the compiler's perspective, the instance returned from the - * constructor is sealed (no new properties may be added). This enables - * better checks. - * - the compiler will rewrite this definition to a form that is optimal - * for type checking and optimization (initially this will be a more - * traditional form). - * - * @param {Function} superClass The superclass, Object or null. - * @param {goog.defineClass.ClassDescriptor} def - * An object literal describing - * the class. It may have the following properties: - * "constructor": the constructor function - * "statics": an object literal containing methods to add to the constructor - * as "static" methods or a function that will receive the constructor - * function as its only parameter to which static properties can - * be added. - * all other properties are added to the prototype. - * @return {!Function} The class constructor. - */ -goog.defineClass = function(superClass, def) { - // TODO(johnlenz): consider making the superClass an optional parameter. - var constructor = def.constructor; - var statics = def.statics; - // Wrap the constructor prior to setting up the prototype and static methods. - if (!constructor || constructor == Object.prototype.constructor) { - constructor = function() { - throw Error('cannot instantiate an interface (no constructor defined).'); - }; - } - - var cls = goog.defineClass.createSealingConstructor_(constructor, superClass); - if (superClass) { - goog.inherits(cls, superClass); - } - - // Remove all the properties that should not be copied to the prototype. - delete def.constructor; - delete def.statics; - - goog.defineClass.applyProperties_(cls.prototype, def); - if (statics != null) { - if (statics instanceof Function) { - statics(cls); - } else { - goog.defineClass.applyProperties_(cls, statics); - } - } - - return cls; -}; - - -/** - * @typedef { - * !Object| - * {constructor:!Function}| - * {constructor:!Function, statics:(Object|function(Function):void)}} - * @suppress {missingProvide} - */ -goog.defineClass.ClassDescriptor; - - -/** - * @define {boolean} Whether the instances returned by - * goog.defineClass should be sealed when possible. - */ -goog.define('goog.defineClass.SEAL_CLASS_INSTANCES', goog.DEBUG); - - -/** - * If goog.defineClass.SEAL_CLASS_INSTANCES is enabled and Object.seal is - * defined, this function will wrap the constructor in a function that seals the - * results of the provided constructor function. - * - * @param {!Function} ctr The constructor whose results maybe be sealed. - * @param {Function} superClass The superclass constructor. - * @return {!Function} The replacement constructor. - * @private - */ -goog.defineClass.createSealingConstructor_ = function(ctr, superClass) { - if (goog.defineClass.SEAL_CLASS_INSTANCES && - Object.seal instanceof Function) { - // Don't seal subclasses of unsealable-tagged legacy classes. - if (superClass && superClass.prototype && - superClass.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]) { - return ctr; - } - /** - * @this {Object} - * @return {?} - */ - var wrappedCtr = function() { - // Don't seal an instance of a subclass when it calls the constructor of - // its super class as there is most likely still setup to do. - var instance = ctr.apply(this, arguments) || this; - instance[goog.UID_PROPERTY_] = instance[goog.UID_PROPERTY_]; - if (this.constructor === wrappedCtr) { - Object.seal(instance); - } - return instance; - }; - return wrappedCtr; - } - return ctr; -}; - - -// TODO(johnlenz): share these values with the goog.object -/** - * The names of the fields that are defined on Object.prototype. - * @type {!Array<string>} - * @private - * @const - */ -goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = [ - 'constructor', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'toLocaleString', - 'toString', - 'valueOf' -]; - - -// TODO(johnlenz): share this function with the goog.object -/** - * @param {!Object} target The object to add properties to. - * @param {!Object} source The object to copy properties from. - * @private - */ -goog.defineClass.applyProperties_ = function(target, source) { - // TODO(johnlenz): update this to support ES5 getters/setters - - var key; - for (key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - - // For IE the for-in-loop does not contain any properties that are not - // enumerable on the prototype object (for example isPrototypeOf from - // Object.prototype) and it will also not include 'replace' on objects that - // extend String and change 'replace' (not that it is common for anyone to - // extend anything except Object). - for (var i = 0; i < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; i++) { - key = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[i]; - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } -}; - - -/** - * Sealing classes breaks the older idiom of assigning properties on the - * prototype rather than in the constructor. As such, goog.defineClass - * must not seal subclasses of these old-style classes until they are fixed. - * Until then, this marks a class as "broken", instructing defineClass - * not to seal subclasses. - * @param {!Function} ctr The legacy constructor to tag as unsealable. - */ -goog.tagUnsealableClass = function(ctr) { - if (!COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES) { - ctr.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = true; - } -}; - - -/** - * Name for unsealable tag property. - * @const @private {string} - */ -goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = 'goog_defineClass_legacy_unsealable'; - -goog.provide('ol'); - - -/** - * Constants defined with the define tag cannot be changed in application - * code, but can be set at compile time. - * Some reduce the size of the build in advanced compile mode. - */ - - -/** - * @define {boolean} Assume touch. Default is `false`. - */ -ol.ASSUME_TOUCH = false; - - -/** - * TODO: rename this to something having to do with tile grids - * see https://github.com/openlayers/ol3/issues/2076 - * @define {number} Default maximum zoom for default tile grids. - */ -ol.DEFAULT_MAX_ZOOM = 42; - - -/** - * @define {number} Default min zoom level for the map view. Default is `0`. - */ -ol.DEFAULT_MIN_ZOOM = 0; - - -/** - * @define {number} Default maximum allowed threshold (in pixels) for - * reprojection triangulation. Default is `0.5`. - */ -ol.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD = 0.5; - - -/** - * @define {number} Default high water mark. - */ -ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK = 2048; - - -/** - * @define {number} Default tile size. - */ -ol.DEFAULT_TILE_SIZE = 256; - - -/** - * @define {string} Default WMS version. - */ -ol.DEFAULT_WMS_VERSION = '1.3.0'; - - -/** - * @define {number} Hysteresis pixels. - */ -ol.DRAG_BOX_HYSTERESIS_PIXELS = 8; - - -/** - * @define {boolean} Enable the Canvas renderer. Default is `true`. Setting - * this to false at compile time in advanced mode removes all code - * supporting the Canvas renderer from the build. - */ -ol.ENABLE_CANVAS = true; - - -/** - * @define {boolean} Enable the DOM renderer (used as a fallback where Canvas is - * not available). Default is `true`. Setting this to false at compile time - * in advanced mode removes all code supporting the DOM renderer from the - * build. - */ -ol.ENABLE_DOM = true; - - -/** - * @define {boolean} Enable rendering of ol.layer.Image based layers. Default - * is `true`. Setting this to false at compile time in advanced mode removes - * all code supporting Image layers from the build. - */ -ol.ENABLE_IMAGE = true; - - -/** - * @define {boolean} Enable Closure named colors (`goog.color.names`). - * Enabling these colors adds about 3KB uncompressed / 1.5KB compressed to - * the final build size. Default is `false`. This setting has no effect - * with Canvas renderer, which uses its own names, whether this is true or - * false. - */ -ol.ENABLE_NAMED_COLORS = false; - - -/** - * @define {boolean} Enable integration with the Proj4js library. Default is - * `true`. - */ -ol.ENABLE_PROJ4JS = true; - - -/** - * @define {boolean} Enable automatic reprojection of raster sources. Default is - * `true`. - */ -ol.ENABLE_RASTER_REPROJECTION = true; - - -/** - * @define {boolean} Enable rendering of ol.layer.Tile based layers. Default is - * `true`. Setting this to false at compile time in advanced mode removes - * all code supporting Tile layers from the build. - */ -ol.ENABLE_TILE = true; - - -/** - * @define {boolean} Enable rendering of ol.layer.Vector based layers. Default - * is `true`. Setting this to false at compile time in advanced mode removes - * all code supporting Vector layers from the build. - */ -ol.ENABLE_VECTOR = true; - - -/** - * @define {boolean} Enable rendering of ol.layer.VectorTile based layers. - * Default is `true`. Setting this to false at compile time in advanced mode - * removes all code supporting VectorTile layers from the build. - */ -ol.ENABLE_VECTOR_TILE = true; - - -/** - * @define {boolean} Enable the WebGL renderer. Default is `true`. Setting - * this to false at compile time in advanced mode removes all code - * supporting the WebGL renderer from the build. - */ -ol.ENABLE_WEBGL = true; - - -/** - * @define {number} The size in pixels of the first atlas image. Default is - * `256`. - */ -ol.INITIAL_ATLAS_SIZE = 256; - - -/** - * @define {number} The maximum size in pixels of atlas images. Default is - * `-1`, meaning it is not used (and `ol.WEBGL_MAX_TEXTURE_SIZE` is - * used instead). - */ -ol.MAX_ATLAS_SIZE = -1; - - -/** - * @define {number} Maximum mouse wheel delta. - */ -ol.MOUSEWHEELZOOM_MAXDELTA = 1; - - -/** - * @define {number} Mouse wheel timeout duration. - */ -ol.MOUSEWHEELZOOM_TIMEOUT_DURATION = 80; - - -/** - * @define {number} Maximum width and/or height extent ratio that determines - * when the overview map should be zoomed out. - */ -ol.OVERVIEWMAP_MAX_RATIO = 0.75; - - -/** - * @define {number} Minimum width and/or height extent ratio that determines - * when the overview map should be zoomed in. - */ -ol.OVERVIEWMAP_MIN_RATIO = 0.1; - - -/** - * @define {number} Maximum number of source tiles for raster reprojection of - * a single tile. - * If too many source tiles are determined to be loaded to create a single - * reprojected tile the browser can become unresponsive or even crash. - * This can happen if the developer defines projections improperly and/or - * with unlimited extents. - * If too many tiles are required, no tiles are loaded and - * `ol.TileState.ERROR` state is set. Default is `100`. - */ -ol.RASTER_REPROJECTION_MAX_SOURCE_TILES = 100; - - -/** - * @define {number} Maximum number of subdivision steps during raster - * reprojection triangulation. Prevents high memory usage and large - * number of proj4 calls (for certain transformations and areas). - * At most `2*(2^this)` triangles are created for each triangulated - * extent (tile/image). Default is `10`. - */ -ol.RASTER_REPROJECTION_MAX_SUBDIVISION = 10; - - -/** - * @define {number} Maximum allowed size of triangle relative to world width. - * When transforming corners of world extent between certain projections, - * the resulting triangulation seems to have zero error and no subdivision - * is performed. - * If the triangle width is more than this (relative to world width; 0-1), - * subdivison is forced (up to `ol.RASTER_REPROJECTION_MAX_SUBDIVISION`). - * Default is `0.25`. - */ -ol.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH = 0.25; - - -/** - * @define {number} Tolerance for geometry simplification in device pixels. - */ -ol.SIMPLIFY_TOLERANCE = 0.5; - - -/** - * @define {number} Texture cache high water mark. - */ -ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK = 1024; - - -/** - * The maximum supported WebGL texture size in pixels. If WebGL is not - * supported, the value is set to `undefined`. - * @const - * @type {number|undefined} - */ -ol.WEBGL_MAX_TEXTURE_SIZE; // value is set in `ol.has` - - -/** - * List of supported WebGL extensions. - * @const - * @type {Array.<string>} - */ -ol.WEBGL_EXTENSIONS; // value is set in `ol.has` - - -/** - * Inherit the prototype methods from one constructor into another. - * - * Usage: - * - * function ParentClass(a, b) { } - * ParentClass.prototype.foo = function(a) { } - * - * function ChildClass(a, b, c) { - * // Call parent constructor - * ParentClass.call(this, a, b); - * } - * ol.inherits(ChildClass, ParentClass); - * - * var child = new ChildClass('a', 'b', 'see'); - * child.foo(); // This works. - * - * In addition, a superclass' implementation of a method can be invoked as - * follows: - * - * ChildClass.prototype.foo = function(a) { - * ChildClass.base(this, 'foo', a); - * // Other code here. - * }; - * - * @param {!Function} childCtor Child constructor. - * @param {!Function} parentCtor Parent constructor. - * @function - * @api - */ -ol.inherits = - goog.inherits; -// note that the newline above is necessary to satisfy the linter - - -/** - * A reusable function, used e.g. as a default for callbacks. - * - * @return {undefined} Nothing. - */ -ol.nullFunction = function() {}; - -// FIXME factor out common code between usedTiles and wantedTiles - -goog.provide('ol.PostRenderFunction'); -goog.provide('ol.PreRenderFunction'); - - -/** - * @typedef {function(ol.Map, ?olx.FrameState): boolean} - */ -ol.PostRenderFunction; - - -/** - * Function to perform manipulations before rendering. This function is called - * with the {@link ol.Map} as first and an optional {@link olx.FrameState} as - * second argument. Return `true` to keep this function for the next frame, - * `false` to remove it. - * @typedef {function(ol.Map, ?olx.FrameState): boolean} - * @api - */ -ol.PreRenderFunction; - -// Copyright 2009 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Provides a base class for custom Error objects such that the - * stack is correctly maintained. - * - * You should never need to throw goog.debug.Error(msg) directly, Error(msg) is - * sufficient. - * - */ - -goog.provide('goog.debug.Error'); - - - -/** - * Base class for custom error objects. - * @param {*=} opt_msg The message associated with the error. - * @constructor - * @extends {Error} - */ -goog.debug.Error = function(opt_msg) { - - // Attempt to ensure there is a stack trace. - if (Error.captureStackTrace) { - Error.captureStackTrace(this, goog.debug.Error); - } else { - var stack = new Error().stack; - if (stack) { - this.stack = stack; - } - } - - if (opt_msg) { - this.message = String(opt_msg); - } - - /** - * Whether to report this error to the server. Setting this to false will - * cause the error reporter to not report the error back to the server, - * which can be useful if the client knows that the error has already been - * logged on the server. - * @type {boolean} - */ - this.reportErrorToServer = true; -}; -goog.inherits(goog.debug.Error, Error); - - -/** @override */ -goog.debug.Error.prototype.name = 'CustomError'; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Definition of goog.dom.NodeType. - */ - -goog.provide('goog.dom.NodeType'); - - -/** - * Constants for the nodeType attribute in the Node interface. - * - * These constants match those specified in the Node interface. These are - * usually present on the Node object in recent browsers, but not in older - * browsers (specifically, early IEs) and thus are given here. - * - * In some browsers (early IEs), these are not defined on the Node object, - * so they are provided here. - * - * See http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 - * @enum {number} - */ -goog.dom.NodeType = { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for string manipulation. - * @author arv@google.com (Erik Arvidsson) - */ - - -/** - * Namespace for string utilities - */ -goog.provide('goog.string'); -goog.provide('goog.string.Unicode'); - - -/** - * @define {boolean} Enables HTML escaping of lowercase letter "e" which helps - * with detection of double-escaping as this letter is frequently used. - */ -goog.define('goog.string.DETECT_DOUBLE_ESCAPING', false); - - -/** - * @define {boolean} Whether to force non-dom html unescaping. - */ -goog.define('goog.string.FORCE_NON_DOM_HTML_UNESCAPING', false); - - -/** - * Common Unicode string characters. - * @enum {string} - */ -goog.string.Unicode = { - NBSP: '\xa0' -}; - - -/** - * Fast prefix-checker. - * @param {string} str The string to check. - * @param {string} prefix A string to look for at the start of {@code str}. - * @return {boolean} True if {@code str} begins with {@code prefix}. - */ -goog.string.startsWith = function(str, prefix) { - return str.lastIndexOf(prefix, 0) == 0; -}; - - -/** - * Fast suffix-checker. - * @param {string} str The string to check. - * @param {string} suffix A string to look for at the end of {@code str}. - * @return {boolean} True if {@code str} ends with {@code suffix}. - */ -goog.string.endsWith = function(str, suffix) { - var l = str.length - suffix.length; - return l >= 0 && str.indexOf(suffix, l) == l; -}; - - -/** - * Case-insensitive prefix-checker. - * @param {string} str The string to check. - * @param {string} prefix A string to look for at the end of {@code str}. - * @return {boolean} True if {@code str} begins with {@code prefix} (ignoring - * case). - */ -goog.string.caseInsensitiveStartsWith = function(str, prefix) { - return goog.string.caseInsensitiveCompare( - prefix, str.substr(0, prefix.length)) == 0; -}; - - -/** - * Case-insensitive suffix-checker. - * @param {string} str The string to check. - * @param {string} suffix A string to look for at the end of {@code str}. - * @return {boolean} True if {@code str} ends with {@code suffix} (ignoring - * case). - */ -goog.string.caseInsensitiveEndsWith = function(str, suffix) { - return goog.string.caseInsensitiveCompare( - suffix, str.substr(str.length - suffix.length, suffix.length)) == 0; -}; - - -/** - * Case-insensitive equality checker. - * @param {string} str1 First string to check. - * @param {string} str2 Second string to check. - * @return {boolean} True if {@code str1} and {@code str2} are the same string, - * ignoring case. - */ -goog.string.caseInsensitiveEquals = function(str1, str2) { - return str1.toLowerCase() == str2.toLowerCase(); -}; - - -/** - * Does simple python-style string substitution. - * subs("foo%s hot%s", "bar", "dog") becomes "foobar hotdog". - * @param {string} str The string containing the pattern. - * @param {...*} var_args The items to substitute into the pattern. - * @return {string} A copy of {@code str} in which each occurrence of - * {@code %s} has been replaced an argument from {@code var_args}. - */ -goog.string.subs = function(str, var_args) { - var splitParts = str.split('%s'); - var returnString = ''; - - var subsArguments = Array.prototype.slice.call(arguments, 1); - while (subsArguments.length && - // Replace up to the last split part. We are inserting in the - // positions between split parts. - splitParts.length > 1) { - returnString += splitParts.shift() + subsArguments.shift(); - } - - return returnString + splitParts.join('%s'); // Join unused '%s' -}; - - -/** - * Converts multiple whitespace chars (spaces, non-breaking-spaces, new lines - * and tabs) to a single space, and strips leading and trailing whitespace. - * @param {string} str Input string. - * @return {string} A copy of {@code str} with collapsed whitespace. - */ -goog.string.collapseWhitespace = function(str) { - // Since IE doesn't include non-breaking-space (0xa0) in their \s character - // class (as required by section 7.2 of the ECMAScript spec), we explicitly - // include it in the regexp to enforce consistent cross-browser behavior. - return str.replace(/[\s\xa0]+/g, ' ').replace(/^\s+|\s+$/g, ''); -}; - - -/** - * Checks if a string is empty or contains only whitespaces. - * @param {string} str The string to check. - * @return {boolean} Whether {@code str} is empty or whitespace only. - */ -goog.string.isEmptyOrWhitespace = function(str) { - // testing length == 0 first is actually slower in all browsers (about the - // same in Opera). - // Since IE doesn't include non-breaking-space (0xa0) in their \s character - // class (as required by section 7.2 of the ECMAScript spec), we explicitly - // include it in the regexp to enforce consistent cross-browser behavior. - return /^[\s\xa0]*$/.test(str); -}; - - -/** - * Checks if a string is empty. - * @param {string} str The string to check. - * @return {boolean} Whether {@code str} is empty. - */ -goog.string.isEmptyString = function(str) { - return str.length == 0; -}; - - -/** - * Checks if a string is empty or contains only whitespaces. - * - * TODO(user): Deprecate this when clients have been switched over to - * goog.string.isEmptyOrWhitespace. - * - * @param {string} str The string to check. - * @return {boolean} Whether {@code str} is empty or whitespace only. - */ -goog.string.isEmpty = goog.string.isEmptyOrWhitespace; - - -/** - * Checks if a string is null, undefined, empty or contains only whitespaces. - * @param {*} str The string to check. - * @return {boolean} Whether {@code str} is null, undefined, empty, or - * whitespace only. - * @deprecated Use goog.string.isEmptyOrWhitespace(goog.string.makeSafe(str)) - * instead. - */ -goog.string.isEmptyOrWhitespaceSafe = function(str) { - return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(str)); -}; - - -/** - * Checks if a string is null, undefined, empty or contains only whitespaces. - * - * TODO(user): Deprecate this when clients have been switched over to - * goog.string.isEmptyOrWhitespaceSafe. - * - * @param {*} str The string to check. - * @return {boolean} Whether {@code str} is null, undefined, empty, or - * whitespace only. - */ -goog.string.isEmptySafe = goog.string.isEmptyOrWhitespaceSafe; - - -/** - * Checks if a string is all breaking whitespace. - * @param {string} str The string to check. - * @return {boolean} Whether the string is all breaking whitespace. - */ -goog.string.isBreakingWhitespace = function(str) { - return !/[^\t\n\r ]/.test(str); -}; - - -/** - * Checks if a string contains all letters. - * @param {string} str string to check. - * @return {boolean} True if {@code str} consists entirely of letters. - */ -goog.string.isAlpha = function(str) { - return !/[^a-zA-Z]/.test(str); -}; - - -/** - * Checks if a string contains only numbers. - * @param {*} str string to check. If not a string, it will be - * casted to one. - * @return {boolean} True if {@code str} is numeric. - */ -goog.string.isNumeric = function(str) { - return !/[^0-9]/.test(str); -}; - - -/** - * Checks if a string contains only numbers or letters. - * @param {string} str string to check. - * @return {boolean} True if {@code str} is alphanumeric. - */ -goog.string.isAlphaNumeric = function(str) { - return !/[^a-zA-Z0-9]/.test(str); -}; - - -/** - * Checks if a character is a space character. - * @param {string} ch Character to check. - * @return {boolean} True if {@code ch} is a space. - */ -goog.string.isSpace = function(ch) { - return ch == ' '; -}; - - -/** - * Checks if a character is a valid unicode character. - * @param {string} ch Character to check. - * @return {boolean} True if {@code ch} is a valid unicode character. - */ -goog.string.isUnicodeChar = function(ch) { - return ch.length == 1 && ch >= ' ' && ch <= '~' || - ch >= '\u0080' && ch <= '\uFFFD'; -}; - - -/** - * Takes a string and replaces newlines with a space. Multiple lines are - * replaced with a single space. - * @param {string} str The string from which to strip newlines. - * @return {string} A copy of {@code str} stripped of newlines. - */ -goog.string.stripNewlines = function(str) { - return str.replace(/(\r\n|\r|\n)+/g, ' '); -}; - - -/** - * Replaces Windows and Mac new lines with unix style: \r or \r\n with \n. - * @param {string} str The string to in which to canonicalize newlines. - * @return {string} {@code str} A copy of {@code} with canonicalized newlines. - */ -goog.string.canonicalizeNewlines = function(str) { - return str.replace(/(\r\n|\r|\n)/g, '\n'); -}; - - -/** - * Normalizes whitespace in a string, replacing all whitespace chars with - * a space. - * @param {string} str The string in which to normalize whitespace. - * @return {string} A copy of {@code str} with all whitespace normalized. - */ -goog.string.normalizeWhitespace = function(str) { - return str.replace(/\xa0|\s/g, ' '); -}; - - -/** - * Normalizes spaces in a string, replacing all consecutive spaces and tabs - * with a single space. Replaces non-breaking space with a space. - * @param {string} str The string in which to normalize spaces. - * @return {string} A copy of {@code str} with all consecutive spaces and tabs - * replaced with a single space. - */ -goog.string.normalizeSpaces = function(str) { - return str.replace(/\xa0|[ \t]+/g, ' '); -}; - - -/** - * Removes the breaking spaces from the left and right of the string and - * collapses the sequences of breaking spaces in the middle into single spaces. - * The original and the result strings render the same way in HTML. - * @param {string} str A string in which to collapse spaces. - * @return {string} Copy of the string with normalized breaking spaces. - */ -goog.string.collapseBreakingSpaces = function(str) { - return str.replace(/[\t\r\n ]+/g, ' ').replace( - /^[\t\r\n ]+|[\t\r\n ]+$/g, ''); -}; - - -/** - * Trims white spaces to the left and right of a string. - * @param {string} str The string to trim. - * @return {string} A trimmed copy of {@code str}. - */ -goog.string.trim = (goog.TRUSTED_SITE && String.prototype.trim) ? - function(str) { - return str.trim(); - } : - function(str) { - // Since IE doesn't include non-breaking-space (0xa0) in their \s - // character class (as required by section 7.2 of the ECMAScript spec), - // we explicitly include it in the regexp to enforce consistent - // cross-browser behavior. - return str.replace(/^[\s\xa0]+|[\s\xa0]+$/g, ''); - }; - - -/** - * Trims whitespaces at the left end of a string. - * @param {string} str The string to left trim. - * @return {string} A trimmed copy of {@code str}. - */ -goog.string.trimLeft = function(str) { - // Since IE doesn't include non-breaking-space (0xa0) in their \s character - // class (as required by section 7.2 of the ECMAScript spec), we explicitly - // include it in the regexp to enforce consistent cross-browser behavior. - return str.replace(/^[\s\xa0]+/, ''); -}; - - -/** - * Trims whitespaces at the right end of a string. - * @param {string} str The string to right trim. - * @return {string} A trimmed copy of {@code str}. - */ -goog.string.trimRight = function(str) { - // Since IE doesn't include non-breaking-space (0xa0) in their \s character - // class (as required by section 7.2 of the ECMAScript spec), we explicitly - // include it in the regexp to enforce consistent cross-browser behavior. - return str.replace(/[\s\xa0]+$/, ''); -}; - - -/** - * A string comparator that ignores case. - * -1 = str1 less than str2 - * 0 = str1 equals str2 - * 1 = str1 greater than str2 - * - * @param {string} str1 The string to compare. - * @param {string} str2 The string to compare {@code str1} to. - * @return {number} The comparator result, as described above. - */ -goog.string.caseInsensitiveCompare = function(str1, str2) { - var test1 = String(str1).toLowerCase(); - var test2 = String(str2).toLowerCase(); - - if (test1 < test2) { - return -1; - } else if (test1 == test2) { - return 0; - } else { - return 1; - } -}; - - -/** - * Regular expression used for splitting a string into substrings of fractional - * numbers, integers, and non-numeric characters. - * @type {RegExp} - * @private - */ -goog.string.numerateCompareRegExp_ = /(\.\d+)|(\d+)|(\D+)/g; - - -/** - * String comparison function that handles numbers in a way humans might expect. - * Using this function, the string "File 2.jpg" sorts before "File 10.jpg". The - * comparison is mostly case-insensitive, though strings that are identical - * except for case are sorted with the upper-case strings before lower-case. - * - * This comparison function is significantly slower (about 500x) than either - * the default or the case-insensitive compare. It should not be used in - * time-critical code, but should be fast enough to sort several hundred short - * strings (like filenames) with a reasonable delay. - * - * @param {string} str1 The string to compare in a numerically sensitive way. - * @param {string} str2 The string to compare {@code str1} to. - * @return {number} less than 0 if str1 < str2, 0 if str1 == str2, greater than - * 0 if str1 > str2. - */ -goog.string.numerateCompare = function(str1, str2) { - if (str1 == str2) { - return 0; - } - if (!str1) { - return -1; - } - if (!str2) { - return 1; - } - - // Using match to split the entire string ahead of time turns out to be faster - // for most inputs than using RegExp.exec or iterating over each character. - var tokens1 = str1.toLowerCase().match(goog.string.numerateCompareRegExp_); - var tokens2 = str2.toLowerCase().match(goog.string.numerateCompareRegExp_); - - var count = Math.min(tokens1.length, tokens2.length); - - for (var i = 0; i < count; i++) { - var a = tokens1[i]; - var b = tokens2[i]; - - // Compare pairs of tokens, returning if one token sorts before the other. - if (a != b) { - - // Only if both tokens are integers is a special comparison required. - // Decimal numbers are sorted as strings (e.g., '.09' < '.1'). - var num1 = parseInt(a, 10); - if (!isNaN(num1)) { - var num2 = parseInt(b, 10); - if (!isNaN(num2) && num1 - num2) { - return num1 - num2; - } - } - return a < b ? -1 : 1; - } - } - - // If one string is a substring of the other, the shorter string sorts first. - if (tokens1.length != tokens2.length) { - return tokens1.length - tokens2.length; - } - - // The two strings must be equivalent except for case (perfect equality is - // tested at the head of the function.) Revert to default ASCII-betical string - // comparison to stablize the sort. - return str1 < str2 ? -1 : 1; -}; - - -/** - * URL-encodes a string - * @param {*} str The string to url-encode. - * @return {string} An encoded copy of {@code str} that is safe for urls. - * Note that '#', ':', and other characters used to delimit portions - * of URLs *will* be encoded. - */ -goog.string.urlEncode = function(str) { - return encodeURIComponent(String(str)); -}; - - -/** - * URL-decodes the string. We need to specially handle '+'s because - * the javascript library doesn't convert them to spaces. - * @param {string} str The string to url decode. - * @return {string} The decoded {@code str}. - */ -goog.string.urlDecode = function(str) { - return decodeURIComponent(str.replace(/\+/g, ' ')); -}; - - -/** - * Converts \n to <br>s or <br />s. - * @param {string} str The string in which to convert newlines. - * @param {boolean=} opt_xml Whether to use XML compatible tags. - * @return {string} A copy of {@code str} with converted newlines. - */ -goog.string.newLineToBr = function(str, opt_xml) { - return str.replace(/(\r\n|\r|\n)/g, opt_xml ? '<br />' : '<br>'); -}; - - -/** - * Escapes double quote '"' and single quote '\'' characters in addition to - * '&', '<', and '>' so that a string can be included in an HTML tag attribute - * value within double or single quotes. - * - * It should be noted that > doesn't need to be escaped for the HTML or XML to - * be valid, but it has been decided to escape it for consistency with other - * implementations. - * - * With goog.string.DETECT_DOUBLE_ESCAPING, this function escapes also the - * lowercase letter "e". - * - * NOTE(user): - * HtmlEscape is often called during the generation of large blocks of HTML. - * Using statics for the regular expressions and strings is an optimization - * that can more than half the amount of time IE spends in this function for - * large apps, since strings and regexes both contribute to GC allocations. - * - * Testing for the presence of a character before escaping increases the number - * of function calls, but actually provides a speed increase for the average - * case -- since the average case often doesn't require the escaping of all 4 - * characters and indexOf() is much cheaper than replace(). - * The worst case does suffer slightly from the additional calls, therefore the - * opt_isLikelyToContainHtmlChars option has been included for situations - * where all 4 HTML entities are very likely to be present and need escaping. - * - * Some benchmarks (times tended to fluctuate +-0.05ms): - * FireFox IE6 - * (no chars / average (mix of cases) / all 4 chars) - * no checks 0.13 / 0.22 / 0.22 0.23 / 0.53 / 0.80 - * indexOf 0.08 / 0.17 / 0.26 0.22 / 0.54 / 0.84 - * indexOf + re test 0.07 / 0.17 / 0.28 0.19 / 0.50 / 0.85 - * - * An additional advantage of checking if replace actually needs to be called - * is a reduction in the number of object allocations, so as the size of the - * application grows the difference between the various methods would increase. - * - * @param {string} str string to be escaped. - * @param {boolean=} opt_isLikelyToContainHtmlChars Don't perform a check to see - * if the character needs replacing - use this option if you expect each of - * the characters to appear often. Leave false if you expect few html - * characters to occur in your strings, such as if you are escaping HTML. - * @return {string} An escaped copy of {@code str}. - */ -goog.string.htmlEscape = function(str, opt_isLikelyToContainHtmlChars) { - - if (opt_isLikelyToContainHtmlChars) { - str = str.replace(goog.string.AMP_RE_, '&') - .replace(goog.string.LT_RE_, '<') - .replace(goog.string.GT_RE_, '>') - .replace(goog.string.QUOT_RE_, '"') - .replace(goog.string.SINGLE_QUOTE_RE_, ''') - .replace(goog.string.NULL_RE_, '�'); - if (goog.string.DETECT_DOUBLE_ESCAPING) { - str = str.replace(goog.string.E_RE_, 'e'); - } - return str; - - } else { - // quick test helps in the case when there are no chars to replace, in - // worst case this makes barely a difference to the time taken - if (!goog.string.ALL_RE_.test(str)) return str; - - // str.indexOf is faster than regex.test in this case - if (str.indexOf('&') != -1) { - str = str.replace(goog.string.AMP_RE_, '&'); - } - if (str.indexOf('<') != -1) { - str = str.replace(goog.string.LT_RE_, '<'); - } - if (str.indexOf('>') != -1) { - str = str.replace(goog.string.GT_RE_, '>'); - } - if (str.indexOf('"') != -1) { - str = str.replace(goog.string.QUOT_RE_, '"'); - } - if (str.indexOf('\'') != -1) { - str = str.replace(goog.string.SINGLE_QUOTE_RE_, '''); - } - if (str.indexOf('\x00') != -1) { - str = str.replace(goog.string.NULL_RE_, '�'); - } - if (goog.string.DETECT_DOUBLE_ESCAPING && str.indexOf('e') != -1) { - str = str.replace(goog.string.E_RE_, 'e'); - } - return str; - } -}; - - -/** - * Regular expression that matches an ampersand, for use in escaping. - * @const {!RegExp} - * @private - */ -goog.string.AMP_RE_ = /&/g; - - -/** - * Regular expression that matches a less than sign, for use in escaping. - * @const {!RegExp} - * @private - */ -goog.string.LT_RE_ = /</g; - - -/** - * Regular expression that matches a greater than sign, for use in escaping. - * @const {!RegExp} - * @private - */ -goog.string.GT_RE_ = />/g; - - -/** - * Regular expression that matches a double quote, for use in escaping. - * @const {!RegExp} - * @private - */ -goog.string.QUOT_RE_ = /"/g; - - -/** - * Regular expression that matches a single quote, for use in escaping. - * @const {!RegExp} - * @private - */ -goog.string.SINGLE_QUOTE_RE_ = /'/g; - - -/** - * Regular expression that matches null character, for use in escaping. - * @const {!RegExp} - * @private - */ -goog.string.NULL_RE_ = /\x00/g; - - -/** - * Regular expression that matches a lowercase letter "e", for use in escaping. - * @const {!RegExp} - * @private - */ -goog.string.E_RE_ = /e/g; - - -/** - * Regular expression that matches any character that needs to be escaped. - * @const {!RegExp} - * @private - */ -goog.string.ALL_RE_ = (goog.string.DETECT_DOUBLE_ESCAPING ? - /[\x00&<>"'e]/ : - /[\x00&<>"']/); - - -/** - * Unescapes an HTML string. - * - * @param {string} str The string to unescape. - * @return {string} An unescaped copy of {@code str}. - */ -goog.string.unescapeEntities = function(str) { - if (goog.string.contains(str, '&')) { - // We are careful not to use a DOM if we do not have one or we explicitly - // requested non-DOM html unescaping. - if (!goog.string.FORCE_NON_DOM_HTML_UNESCAPING && - 'document' in goog.global) { - return goog.string.unescapeEntitiesUsingDom_(str); - } else { - // Fall back on pure XML entities - return goog.string.unescapePureXmlEntities_(str); - } - } - return str; -}; - - -/** - * Unescapes a HTML string using the provided document. - * - * @param {string} str The string to unescape. - * @param {!Document} document A document to use in escaping the string. - * @return {string} An unescaped copy of {@code str}. - */ -goog.string.unescapeEntitiesWithDocument = function(str, document) { - if (goog.string.contains(str, '&')) { - return goog.string.unescapeEntitiesUsingDom_(str, document); - } - return str; -}; - - -/** - * Unescapes an HTML string using a DOM to resolve non-XML, non-numeric - * entities. This function is XSS-safe and whitespace-preserving. - * @private - * @param {string} str The string to unescape. - * @param {Document=} opt_document An optional document to use for creating - * elements. If this is not specified then the default window.document - * will be used. - * @return {string} The unescaped {@code str} string. - */ -goog.string.unescapeEntitiesUsingDom_ = function(str, opt_document) { - /** @type {!Object<string, string>} */ - var seen = {'&': '&', '<': '<', '>': '>', '"': '"'}; - var div; - if (opt_document) { - div = opt_document.createElement('div'); - } else { - div = goog.global.document.createElement('div'); - } - // Match as many valid entity characters as possible. If the actual entity - // happens to be shorter, it will still work as innerHTML will return the - // trailing characters unchanged. Since the entity characters do not include - // open angle bracket, there is no chance of XSS from the innerHTML use. - // Since no whitespace is passed to innerHTML, whitespace is preserved. - return str.replace(goog.string.HTML_ENTITY_PATTERN_, function(s, entity) { - // Check for cached entity. - var value = seen[s]; - if (value) { - return value; - } - // Check for numeric entity. - if (entity.charAt(0) == '#') { - // Prefix with 0 so that hex entities (e.g. ) parse as hex numbers. - var n = Number('0' + entity.substr(1)); - if (!isNaN(n)) { - value = String.fromCharCode(n); - } - } - // Fall back to innerHTML otherwise. - if (!value) { - // Append a non-entity character to avoid a bug in Webkit that parses - // an invalid entity at the end of innerHTML text as the empty string. - div.innerHTML = s + ' '; - // Then remove the trailing character from the result. - value = div.firstChild.nodeValue.slice(0, -1); - } - // Cache and return. - return seen[s] = value; - }); -}; - - -/** - * Unescapes XML entities. - * @private - * @param {string} str The string to unescape. - * @return {string} An unescaped copy of {@code str}. - */ -goog.string.unescapePureXmlEntities_ = function(str) { - return str.replace(/&([^;]+);/g, function(s, entity) { - switch (entity) { - case 'amp': - return '&'; - case 'lt': - return '<'; - case 'gt': - return '>'; - case 'quot': - return '"'; - default: - if (entity.charAt(0) == '#') { - // Prefix with 0 so that hex entities (e.g. ) parse as hex. - var n = Number('0' + entity.substr(1)); - if (!isNaN(n)) { - return String.fromCharCode(n); - } - } - // For invalid entities we just return the entity - return s; - } - }); -}; - - -/** - * Regular expression that matches an HTML entity. - * See also HTML5: Tokenization / Tokenizing character references. - * @private - * @type {!RegExp} - */ -goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g; - - -/** - * Do escaping of whitespace to preserve spatial formatting. We use character - * entity #160 to make it safer for xml. - * @param {string} str The string in which to escape whitespace. - * @param {boolean=} opt_xml Whether to use XML compatible tags. - * @return {string} An escaped copy of {@code str}. - */ -goog.string.whitespaceEscape = function(str, opt_xml) { - // This doesn't use goog.string.preserveSpaces for backwards compatibility. - return goog.string.newLineToBr(str.replace(/ /g, '  '), opt_xml); -}; - - -/** - * Preserve spaces that would be otherwise collapsed in HTML by replacing them - * with non-breaking space Unicode characters. - * @param {string} str The string in which to preserve whitespace. - * @return {string} A copy of {@code str} with preserved whitespace. - */ -goog.string.preserveSpaces = function(str) { - return str.replace(/(^|[\n ]) /g, '$1' + goog.string.Unicode.NBSP); -}; - - -/** - * Strip quote characters around a string. The second argument is a string of - * characters to treat as quotes. This can be a single character or a string of - * multiple character and in that case each of those are treated as possible - * quote characters. For example: - * - * <pre> - * goog.string.stripQuotes('"abc"', '"`') --> 'abc' - * goog.string.stripQuotes('`abc`', '"`') --> 'abc' - * </pre> - * - * @param {string} str The string to strip. - * @param {string} quoteChars The quote characters to strip. - * @return {string} A copy of {@code str} without the quotes. - */ -goog.string.stripQuotes = function(str, quoteChars) { - var length = quoteChars.length; - for (var i = 0; i < length; i++) { - var quoteChar = length == 1 ? quoteChars : quoteChars.charAt(i); - if (str.charAt(0) == quoteChar && str.charAt(str.length - 1) == quoteChar) { - return str.substring(1, str.length - 1); - } - } - return str; -}; - - -/** - * Truncates a string to a certain length and adds '...' if necessary. The - * length also accounts for the ellipsis, so a maximum length of 10 and a string - * 'Hello World!' produces 'Hello W...'. - * @param {string} str The string to truncate. - * @param {number} chars Max number of characters. - * @param {boolean=} opt_protectEscapedCharacters Whether to protect escaped - * characters from being cut off in the middle. - * @return {string} The truncated {@code str} string. - */ -goog.string.truncate = function(str, chars, opt_protectEscapedCharacters) { - if (opt_protectEscapedCharacters) { - str = goog.string.unescapeEntities(str); - } - - if (str.length > chars) { - str = str.substring(0, chars - 3) + '...'; - } - - if (opt_protectEscapedCharacters) { - str = goog.string.htmlEscape(str); - } - - return str; -}; - - -/** - * Truncate a string in the middle, adding "..." if necessary, - * and favoring the beginning of the string. - * @param {string} str The string to truncate the middle of. - * @param {number} chars Max number of characters. - * @param {boolean=} opt_protectEscapedCharacters Whether to protect escaped - * characters from being cutoff in the middle. - * @param {number=} opt_trailingChars Optional number of trailing characters to - * leave at the end of the string, instead of truncating as close to the - * middle as possible. - * @return {string} A truncated copy of {@code str}. - */ -goog.string.truncateMiddle = function(str, chars, - opt_protectEscapedCharacters, opt_trailingChars) { - if (opt_protectEscapedCharacters) { - str = goog.string.unescapeEntities(str); - } - - if (opt_trailingChars && str.length > chars) { - if (opt_trailingChars > chars) { - opt_trailingChars = chars; - } - var endPoint = str.length - opt_trailingChars; - var startPoint = chars - opt_trailingChars; - str = str.substring(0, startPoint) + '...' + str.substring(endPoint); - } else if (str.length > chars) { - // Favor the beginning of the string: - var half = Math.floor(chars / 2); - var endPos = str.length - half; - half += chars % 2; - str = str.substring(0, half) + '...' + str.substring(endPos); - } - - if (opt_protectEscapedCharacters) { - str = goog.string.htmlEscape(str); - } - - return str; -}; - - -/** - * Special chars that need to be escaped for goog.string.quote. - * @private {!Object<string, string>} - */ -goog.string.specialEscapeChars_ = { - '\0': '\\0', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - '\x0B': '\\x0B', // '\v' is not supported in JScript - '"': '\\"', - '\\': '\\\\' -}; - - -/** - * Character mappings used internally for goog.string.escapeChar. - * @private {!Object<string, string>} - */ -goog.string.jsEscapeCache_ = { - '\'': '\\\'' -}; - - -/** - * Encloses a string in double quotes and escapes characters so that the - * string is a valid JS string. - * @param {string} s The string to quote. - * @return {string} A copy of {@code s} surrounded by double quotes. - */ -goog.string.quote = function(s) { - s = String(s); - if (s.quote) { - return s.quote(); - } else { - var sb = ['"']; - for (var i = 0; i < s.length; i++) { - var ch = s.charAt(i); - var cc = ch.charCodeAt(0); - sb[i + 1] = goog.string.specialEscapeChars_[ch] || - ((cc > 31 && cc < 127) ? ch : goog.string.escapeChar(ch)); - } - sb.push('"'); - return sb.join(''); - } -}; - - -/** - * Takes a string and returns the escaped string for that character. - * @param {string} str The string to escape. - * @return {string} An escaped string representing {@code str}. - */ -goog.string.escapeString = function(str) { - var sb = []; - for (var i = 0; i < str.length; i++) { - sb[i] = goog.string.escapeChar(str.charAt(i)); - } - return sb.join(''); -}; - - -/** - * Takes a character and returns the escaped string for that character. For - * example escapeChar(String.fromCharCode(15)) -> "\\x0E". - * @param {string} c The character to escape. - * @return {string} An escaped string representing {@code c}. - */ -goog.string.escapeChar = function(c) { - if (c in goog.string.jsEscapeCache_) { - return goog.string.jsEscapeCache_[c]; - } - - if (c in goog.string.specialEscapeChars_) { - return goog.string.jsEscapeCache_[c] = goog.string.specialEscapeChars_[c]; - } - - var rv = c; - var cc = c.charCodeAt(0); - if (cc > 31 && cc < 127) { - rv = c; - } else { - // tab is 9 but handled above - if (cc < 256) { - rv = '\\x'; - if (cc < 16 || cc > 256) { - rv += '0'; - } - } else { - rv = '\\u'; - if (cc < 4096) { // \u1000 - rv += '0'; - } - } - rv += cc.toString(16).toUpperCase(); - } - - return goog.string.jsEscapeCache_[c] = rv; -}; - - -/** - * Determines whether a string contains a substring. - * @param {string} str The string to search. - * @param {string} subString The substring to search for. - * @return {boolean} Whether {@code str} contains {@code subString}. - */ -goog.string.contains = function(str, subString) { - return str.indexOf(subString) != -1; -}; - - -/** - * Determines whether a string contains a substring, ignoring case. - * @param {string} str The string to search. - * @param {string} subString The substring to search for. - * @return {boolean} Whether {@code str} contains {@code subString}. - */ -goog.string.caseInsensitiveContains = function(str, subString) { - return goog.string.contains(str.toLowerCase(), subString.toLowerCase()); -}; - - -/** - * Returns the non-overlapping occurrences of ss in s. - * If either s or ss evalutes to false, then returns zero. - * @param {string} s The string to look in. - * @param {string} ss The string to look for. - * @return {number} Number of occurrences of ss in s. - */ -goog.string.countOf = function(s, ss) { - return s && ss ? s.split(ss).length - 1 : 0; -}; - - -/** - * Removes a substring of a specified length at a specific - * index in a string. - * @param {string} s The base string from which to remove. - * @param {number} index The index at which to remove the substring. - * @param {number} stringLength The length of the substring to remove. - * @return {string} A copy of {@code s} with the substring removed or the full - * string if nothing is removed or the input is invalid. - */ -goog.string.removeAt = function(s, index, stringLength) { - var resultStr = s; - // If the index is greater or equal to 0 then remove substring - if (index >= 0 && index < s.length && stringLength > 0) { - resultStr = s.substr(0, index) + - s.substr(index + stringLength, s.length - index - stringLength); - } - return resultStr; -}; - - -/** - * Removes the first occurrence of a substring from a string. - * @param {string} s The base string from which to remove. - * @param {string} ss The string to remove. - * @return {string} A copy of {@code s} with {@code ss} removed or the full - * string if nothing is removed. - */ -goog.string.remove = function(s, ss) { - var re = new RegExp(goog.string.regExpEscape(ss), ''); - return s.replace(re, ''); -}; - - -/** - * Removes all occurrences of a substring from a string. - * @param {string} s The base string from which to remove. - * @param {string} ss The string to remove. - * @return {string} A copy of {@code s} with {@code ss} removed or the full - * string if nothing is removed. - */ -goog.string.removeAll = function(s, ss) { - var re = new RegExp(goog.string.regExpEscape(ss), 'g'); - return s.replace(re, ''); -}; - - -/** - * Escapes characters in the string that are not safe to use in a RegExp. - * @param {*} s The string to escape. If not a string, it will be casted - * to one. - * @return {string} A RegExp safe, escaped copy of {@code s}. - */ -goog.string.regExpEscape = function(s) { - return String(s).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1'). - replace(/\x08/g, '\\x08'); -}; - - -/** - * Repeats a string n times. - * @param {string} string The string to repeat. - * @param {number} length The number of times to repeat. - * @return {string} A string containing {@code length} repetitions of - * {@code string}. - */ -goog.string.repeat = (String.prototype.repeat) ? - function(string, length) { - // The native method is over 100 times faster than the alternative. - return string.repeat(length); - } : - function(string, length) { - return new Array(length + 1).join(string); - }; - - -/** - * Pads number to given length and optionally rounds it to a given precision. - * For example: - * <pre>padNumber(1.25, 2, 3) -> '01.250' - * padNumber(1.25, 2) -> '01.25' - * padNumber(1.25, 2, 1) -> '01.3' - * padNumber(1.25, 0) -> '1.25'</pre> - * - * @param {number} num The number to pad. - * @param {number} length The desired length. - * @param {number=} opt_precision The desired precision. - * @return {string} {@code num} as a string with the given options. - */ -goog.string.padNumber = function(num, length, opt_precision) { - var s = goog.isDef(opt_precision) ? num.toFixed(opt_precision) : String(num); - var index = s.indexOf('.'); - if (index == -1) { - index = s.length; - } - return goog.string.repeat('0', Math.max(0, length - index)) + s; -}; - - -/** - * Returns a string representation of the given object, with - * null and undefined being returned as the empty string. - * - * @param {*} obj The object to convert. - * @return {string} A string representation of the {@code obj}. - */ -goog.string.makeSafe = function(obj) { - return obj == null ? '' : String(obj); -}; - - -/** - * Concatenates string expressions. This is useful - * since some browsers are very inefficient when it comes to using plus to - * concat strings. Be careful when using null and undefined here since - * these will not be included in the result. If you need to represent these - * be sure to cast the argument to a String first. - * For example: - * <pre>buildString('a', 'b', 'c', 'd') -> 'abcd' - * buildString(null, undefined) -> '' - * </pre> - * @param {...*} var_args A list of strings to concatenate. If not a string, - * it will be casted to one. - * @return {string} The concatenation of {@code var_args}. - */ -goog.string.buildString = function(var_args) { - return Array.prototype.join.call(arguments, ''); -}; - - -/** - * Returns a string with at least 64-bits of randomness. - * - * Doesn't trust Javascript's random function entirely. Uses a combination of - * random and current timestamp, and then encodes the string in base-36 to - * make it shorter. - * - * @return {string} A random string, e.g. sn1s7vb4gcic. - */ -goog.string.getRandomString = function() { - var x = 2147483648; - return Math.floor(Math.random() * x).toString(36) + - Math.abs(Math.floor(Math.random() * x) ^ goog.now()).toString(36); -}; - - -/** - * Compares two version numbers. - * - * @param {string|number} version1 Version of first item. - * @param {string|number} version2 Version of second item. - * - * @return {number} 1 if {@code version1} is higher. - * 0 if arguments are equal. - * -1 if {@code version2} is higher. - */ -goog.string.compareVersions = function(version1, version2) { - var order = 0; - // Trim leading and trailing whitespace and split the versions into - // subversions. - var v1Subs = goog.string.trim(String(version1)).split('.'); - var v2Subs = goog.string.trim(String(version2)).split('.'); - var subCount = Math.max(v1Subs.length, v2Subs.length); - - // Iterate over the subversions, as long as they appear to be equivalent. - for (var subIdx = 0; order == 0 && subIdx < subCount; subIdx++) { - var v1Sub = v1Subs[subIdx] || ''; - var v2Sub = v2Subs[subIdx] || ''; - - // Split the subversions into pairs of numbers and qualifiers (like 'b'). - // Two different RegExp objects are needed because they are both using - // the 'g' flag. - var v1CompParser = new RegExp('(\\d*)(\\D*)', 'g'); - var v2CompParser = new RegExp('(\\d*)(\\D*)', 'g'); - do { - var v1Comp = v1CompParser.exec(v1Sub) || ['', '', '']; - var v2Comp = v2CompParser.exec(v2Sub) || ['', '', '']; - // Break if there are no more matches. - if (v1Comp[0].length == 0 && v2Comp[0].length == 0) { - break; - } - - // Parse the numeric part of the subversion. A missing number is - // equivalent to 0. - var v1CompNum = v1Comp[1].length == 0 ? 0 : parseInt(v1Comp[1], 10); - var v2CompNum = v2Comp[1].length == 0 ? 0 : parseInt(v2Comp[1], 10); - - // Compare the subversion components. The number has the highest - // precedence. Next, if the numbers are equal, a subversion without any - // qualifier is always higher than a subversion with any qualifier. Next, - // the qualifiers are compared as strings. - order = goog.string.compareElements_(v1CompNum, v2CompNum) || - goog.string.compareElements_(v1Comp[2].length == 0, - v2Comp[2].length == 0) || - goog.string.compareElements_(v1Comp[2], v2Comp[2]); - // Stop as soon as an inequality is discovered. - } while (order == 0); - } - - return order; -}; - - -/** - * Compares elements of a version number. - * - * @param {string|number|boolean} left An element from a version number. - * @param {string|number|boolean} right An element from a version number. - * - * @return {number} 1 if {@code left} is higher. - * 0 if arguments are equal. - * -1 if {@code right} is higher. - * @private - */ -goog.string.compareElements_ = function(left, right) { - if (left < right) { - return -1; - } else if (left > right) { - return 1; - } - return 0; -}; - - -/** - * String hash function similar to java.lang.String.hashCode(). - * The hash code for a string is computed as - * s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], - * where s[i] is the ith character of the string and n is the length of - * the string. We mod the result to make it between 0 (inclusive) and 2^32 - * (exclusive). - * @param {string} str A string. - * @return {number} Hash value for {@code str}, between 0 (inclusive) and 2^32 - * (exclusive). The empty string returns 0. - */ -goog.string.hashCode = function(str) { - var result = 0; - for (var i = 0; i < str.length; ++i) { - // Normalize to 4 byte range, 0 ... 2^32. - result = (31 * result + str.charCodeAt(i)) >>> 0; - } - return result; -}; - - -/** - * The most recent unique ID. |0 is equivalent to Math.floor in this case. - * @type {number} - * @private - */ -goog.string.uniqueStringCounter_ = Math.random() * 0x80000000 | 0; - - -/** - * Generates and returns a string which is unique in the current document. - * This is useful, for example, to create unique IDs for DOM elements. - * @return {string} A unique id. - */ -goog.string.createUniqueString = function() { - return 'goog_' + goog.string.uniqueStringCounter_++; -}; - - -/** - * Converts the supplied string to a number, which may be Infinity or NaN. - * This function strips whitespace: (toNumber(' 123') === 123) - * This function accepts scientific notation: (toNumber('1e1') === 10) - * - * This is better than Javascript's built-in conversions because, sadly: - * (Number(' ') === 0) and (parseFloat('123a') === 123) - * - * @param {string} str The string to convert. - * @return {number} The number the supplied string represents, or NaN. - */ -goog.string.toNumber = function(str) { - var num = Number(str); - if (num == 0 && goog.string.isEmptyOrWhitespace(str)) { - return NaN; - } - return num; -}; - - -/** - * Returns whether the given string is lower camel case (e.g. "isFooBar"). - * - * Note that this assumes the string is entirely letters. - * @see http://en.wikipedia.org/wiki/CamelCase#Variations_and_synonyms - * - * @param {string} str String to test. - * @return {boolean} Whether the string is lower camel case. - */ -goog.string.isLowerCamelCase = function(str) { - return /^[a-z]+([A-Z][a-z]*)*$/.test(str); -}; - - -/** - * Returns whether the given string is upper camel case (e.g. "FooBarBaz"). - * - * Note that this assumes the string is entirely letters. - * @see http://en.wikipedia.org/wiki/CamelCase#Variations_and_synonyms - * - * @param {string} str String to test. - * @return {boolean} Whether the string is upper camel case. - */ -goog.string.isUpperCamelCase = function(str) { - return /^([A-Z][a-z]*)+$/.test(str); -}; - - -/** - * Converts a string from selector-case to camelCase (e.g. from - * "multi-part-string" to "multiPartString"), useful for converting - * CSS selectors and HTML dataset keys to their equivalent JS properties. - * @param {string} str The string in selector-case form. - * @return {string} The string in camelCase form. - */ -goog.string.toCamelCase = function(str) { - return String(str).replace(/\-([a-z])/g, function(all, match) { - return match.toUpperCase(); - }); -}; - - -/** - * Converts a string from camelCase to selector-case (e.g. from - * "multiPartString" to "multi-part-string"), useful for converting JS - * style and dataset properties to equivalent CSS selectors and HTML keys. - * @param {string} str The string in camelCase form. - * @return {string} The string in selector-case form. - */ -goog.string.toSelectorCase = function(str) { - return String(str).replace(/([A-Z])/g, '-$1').toLowerCase(); -}; - - -/** - * Converts a string into TitleCase. First character of the string is always - * capitalized in addition to the first letter of every subsequent word. - * Words are delimited by one or more whitespaces by default. Custom delimiters - * can optionally be specified to replace the default, which doesn't preserve - * whitespace delimiters and instead must be explicitly included if needed. - * - * Default delimiter => " ": - * goog.string.toTitleCase('oneTwoThree') => 'OneTwoThree' - * goog.string.toTitleCase('one two three') => 'One Two Three' - * goog.string.toTitleCase(' one two ') => ' One Two ' - * goog.string.toTitleCase('one_two_three') => 'One_two_three' - * goog.string.toTitleCase('one-two-three') => 'One-two-three' - * - * Custom delimiter => "_-.": - * goog.string.toTitleCase('oneTwoThree', '_-.') => 'OneTwoThree' - * goog.string.toTitleCase('one two three', '_-.') => 'One two three' - * goog.string.toTitleCase(' one two ', '_-.') => ' one two ' - * goog.string.toTitleCase('one_two_three', '_-.') => 'One_Two_Three' - * goog.string.toTitleCase('one-two-three', '_-.') => 'One-Two-Three' - * goog.string.toTitleCase('one...two...three', '_-.') => 'One...Two...Three' - * goog.string.toTitleCase('one. two. three', '_-.') => 'One. two. three' - * goog.string.toTitleCase('one-two.three', '_-.') => 'One-Two.Three' - * - * @param {string} str String value in camelCase form. - * @param {string=} opt_delimiters Custom delimiter character set used to - * distinguish words in the string value. Each character represents a - * single delimiter. When provided, default whitespace delimiter is - * overridden and must be explicitly included if needed. - * @return {string} String value in TitleCase form. - */ -goog.string.toTitleCase = function(str, opt_delimiters) { - var delimiters = goog.isString(opt_delimiters) ? - goog.string.regExpEscape(opt_delimiters) : '\\s'; - - // For IE8, we need to prevent using an empty character set. Otherwise, - // incorrect matching will occur. - delimiters = delimiters ? '|[' + delimiters + ']+' : ''; - - var regexp = new RegExp('(^' + delimiters + ')([a-z])', 'g'); - return str.replace(regexp, function(all, p1, p2) { - return p1 + p2.toUpperCase(); - }); -}; - - -/** - * Capitalizes a string, i.e. converts the first letter to uppercase - * and all other letters to lowercase, e.g.: - * - * goog.string.capitalize('one') => 'One' - * goog.string.capitalize('ONE') => 'One' - * goog.string.capitalize('one two') => 'One two' - * - * Note that this function does not trim initial whitespace. - * - * @param {string} str String value to capitalize. - * @return {string} String value with first letter in uppercase. - */ -goog.string.capitalize = function(str) { - return String(str.charAt(0)).toUpperCase() + - String(str.substr(1)).toLowerCase(); -}; - - -/** - * Parse a string in decimal or hexidecimal ('0xFFFF') form. - * - * To parse a particular radix, please use parseInt(string, radix) directly. See - * https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseInt - * - * This is a wrapper for the built-in parseInt function that will only parse - * numbers as base 10 or base 16. Some JS implementations assume strings - * starting with "0" are intended to be octal. ES3 allowed but discouraged - * this behavior. ES5 forbids it. This function emulates the ES5 behavior. - * - * For more information, see Mozilla JS Reference: http://goo.gl/8RiFj - * - * @param {string|number|null|undefined} value The value to be parsed. - * @return {number} The number, parsed. If the string failed to parse, this - * will be NaN. - */ -goog.string.parseInt = function(value) { - // Force finite numbers to strings. - if (isFinite(value)) { - value = String(value); - } - - if (goog.isString(value)) { - // If the string starts with '0x' or '-0x', parse as hex. - return /^\s*-?0x/i.test(value) ? - parseInt(value, 16) : parseInt(value, 10); - } - - return NaN; -}; - - -/** - * Splits a string on a separator a limited number of times. - * - * This implementation is more similar to Python or Java, where the limit - * parameter specifies the maximum number of splits rather than truncating - * the number of results. - * - * See http://docs.python.org/2/library/stdtypes.html#str.split - * See JavaDoc: http://goo.gl/F2AsY - * See Mozilla reference: http://goo.gl/dZdZs - * - * @param {string} str String to split. - * @param {string} separator The separator. - * @param {number} limit The limit to the number of splits. The resulting array - * will have a maximum length of limit+1. Negative numbers are the same - * as zero. - * @return {!Array<string>} The string, split. - */ - -goog.string.splitLimit = function(str, separator, limit) { - var parts = str.split(separator); - var returnVal = []; - - // Only continue doing this while we haven't hit the limit and we have - // parts left. - while (limit > 0 && parts.length) { - returnVal.push(parts.shift()); - limit--; - } - - // If there are remaining parts, append them to the end. - if (parts.length) { - returnVal.push(parts.join(separator)); - } - - return returnVal; -}; - - -/** - * Computes the Levenshtein edit distance between two strings. - * @param {string} a - * @param {string} b - * @return {number} The edit distance between the two strings. - */ -goog.string.editDistance = function(a, b) { - var v0 = []; - var v1 = []; - - if (a == b) { - return 0; - } - - if (!a.length || !b.length) { - return Math.max(a.length, b.length); - } - - for (var i = 0; i < b.length + 1; i++) { - v0[i] = i; - } - - for (var i = 0; i < a.length; i++) { - v1[0] = i + 1; - - for (var j = 0; j < b.length; j++) { - var cost = a[i] != b[j]; - // Cost for the substring is the minimum of adding one character, removing - // one character, or a swap. - v1[j + 1] = Math.min(v1[j] + 1, v0[j + 1] + 1, v0[j] + cost); - } - - for (var j = 0; j < v0.length; j++) { - v0[j] = v1[j]; - } - } - - return v1[b.length]; -}; - -// Copyright 2008 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities to check the preconditions, postconditions and - * invariants runtime. - * - * Methods in this package should be given special treatment by the compiler - * for type-inference. For example, <code>goog.asserts.assert(foo)</code> - * will restrict <code>foo</code> to a truthy value. - * - * The compiler has an option to disable asserts. So code like: - * <code> - * var x = goog.asserts.assert(foo()); goog.asserts.assert(bar()); - * </code> - * will be transformed into: - * <code> - * var x = foo(); - * </code> - * The compiler will leave in foo() (because its return value is used), - * but it will remove bar() because it assumes it does not have side-effects. - * - * @author agrieve@google.com (Andrew Grieve) - */ - -goog.provide('goog.asserts'); -goog.provide('goog.asserts.AssertionError'); - -goog.require('goog.debug.Error'); -goog.require('goog.dom.NodeType'); -goog.require('goog.string'); - - -/** - * @define {boolean} Whether to strip out asserts or to leave them in. - */ -goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG); - - - -/** - * Error object for failed assertions. - * @param {string} messagePattern The pattern that was used to form message. - * @param {!Array<*>} messageArgs The items to substitute into the pattern. - * @constructor - * @extends {goog.debug.Error} - * @final - */ -goog.asserts.AssertionError = function(messagePattern, messageArgs) { - messageArgs.unshift(messagePattern); - goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs)); - // Remove the messagePattern afterwards to avoid permanently modifying the - // passed in array. - messageArgs.shift(); - - /** - * The message pattern used to format the error message. Error handlers can - * use this to uniquely identify the assertion. - * @type {string} - */ - this.messagePattern = messagePattern; -}; -goog.inherits(goog.asserts.AssertionError, goog.debug.Error); - - -/** @override */ -goog.asserts.AssertionError.prototype.name = 'AssertionError'; - - -/** - * The default error handler. - * @param {!goog.asserts.AssertionError} e The exception to be handled. - */ -goog.asserts.DEFAULT_ERROR_HANDLER = function(e) { throw e; }; - - -/** - * The handler responsible for throwing or logging assertion errors. - * @private {function(!goog.asserts.AssertionError)} - */ -goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER; - - -/** - * Throws an exception with the given message and "Assertion failed" prefixed - * onto it. - * @param {string} defaultMessage The message to use if givenMessage is empty. - * @param {Array<*>} defaultArgs The substitution arguments for defaultMessage. - * @param {string|undefined} givenMessage Message supplied by the caller. - * @param {Array<*>} givenArgs The substitution arguments for givenMessage. - * @throws {goog.asserts.AssertionError} When the value is not a number. - * @private - */ -goog.asserts.doAssertFailure_ = - function(defaultMessage, defaultArgs, givenMessage, givenArgs) { - var message = 'Assertion failed'; - if (givenMessage) { - message += ': ' + givenMessage; - var args = givenArgs; - } else if (defaultMessage) { - message += ': ' + defaultMessage; - args = defaultArgs; - } - // The '' + works around an Opera 10 bug in the unit tests. Without it, - // a stack trace is added to var message above. With this, a stack trace is - // not added until this line (it causes the extra garbage to be added after - // the assertion message instead of in the middle of it). - var e = new goog.asserts.AssertionError('' + message, args || []); - goog.asserts.errorHandler_(e); -}; - - -/** - * Sets a custom error handler that can be used to customize the behavior of - * assertion failures, for example by turning all assertion failures into log - * messages. - * @param {function(!goog.asserts.AssertionError)} errorHandler - */ -goog.asserts.setErrorHandler = function(errorHandler) { - if (goog.asserts.ENABLE_ASSERTS) { - goog.asserts.errorHandler_ = errorHandler; - } -}; - - -/** - * Checks if the condition evaluates to true if goog.asserts.ENABLE_ASSERTS is - * true. - * @template T - * @param {T} condition The condition to check. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @return {T} The value of the condition. - * @throws {goog.asserts.AssertionError} When the condition evaluates to false. - */ -goog.asserts.assert = function(condition, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !condition) { - goog.asserts.doAssertFailure_('', null, opt_message, - Array.prototype.slice.call(arguments, 2)); - } - return condition; -}; - - -/** - * Fails if goog.asserts.ENABLE_ASSERTS is true. This function is useful in case - * when we want to add a check in the unreachable area like switch-case - * statement: - * - * <pre> - * switch(type) { - * case FOO: doSomething(); break; - * case BAR: doSomethingElse(); break; - * default: goog.assert.fail('Unrecognized type: ' + type); - * // We have only 2 types - "default:" section is unreachable code. - * } - * </pre> - * - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @throws {goog.asserts.AssertionError} Failure. - */ -goog.asserts.fail = function(opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS) { - goog.asserts.errorHandler_(new goog.asserts.AssertionError( - 'Failure' + (opt_message ? ': ' + opt_message : ''), - Array.prototype.slice.call(arguments, 1))); - } -}; - - -/** - * Checks if the value is a number if goog.asserts.ENABLE_ASSERTS is true. - * @param {*} value The value to check. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @return {number} The value, guaranteed to be a number when asserts enabled. - * @throws {goog.asserts.AssertionError} When the value is not a number. - */ -goog.asserts.assertNumber = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value)) { - goog.asserts.doAssertFailure_('Expected number but got %s: %s.', - [goog.typeOf(value), value], opt_message, - Array.prototype.slice.call(arguments, 2)); - } - return /** @type {number} */ (value); -}; - - -/** - * Checks if the value is a string if goog.asserts.ENABLE_ASSERTS is true. - * @param {*} value The value to check. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @return {string} The value, guaranteed to be a string when asserts enabled. - * @throws {goog.asserts.AssertionError} When the value is not a string. - */ -goog.asserts.assertString = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isString(value)) { - goog.asserts.doAssertFailure_('Expected string but got %s: %s.', - [goog.typeOf(value), value], opt_message, - Array.prototype.slice.call(arguments, 2)); - } - return /** @type {string} */ (value); -}; - - -/** - * Checks if the value is a function if goog.asserts.ENABLE_ASSERTS is true. - * @param {*} value The value to check. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @return {!Function} The value, guaranteed to be a function when asserts - * enabled. - * @throws {goog.asserts.AssertionError} When the value is not a function. - */ -goog.asserts.assertFunction = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value)) { - goog.asserts.doAssertFailure_('Expected function but got %s: %s.', - [goog.typeOf(value), value], opt_message, - Array.prototype.slice.call(arguments, 2)); - } - return /** @type {!Function} */ (value); -}; - - -/** - * Checks if the value is an Object if goog.asserts.ENABLE_ASSERTS is true. - * @param {*} value The value to check. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @return {!Object} The value, guaranteed to be a non-null object. - * @throws {goog.asserts.AssertionError} When the value is not an object. - */ -goog.asserts.assertObject = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) { - goog.asserts.doAssertFailure_('Expected object but got %s: %s.', - [goog.typeOf(value), value], - opt_message, Array.prototype.slice.call(arguments, 2)); - } - return /** @type {!Object} */ (value); -}; - - -/** - * Checks if the value is an Array if goog.asserts.ENABLE_ASSERTS is true. - * @param {*} value The value to check. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @return {!Array<?>} The value, guaranteed to be a non-null array. - * @throws {goog.asserts.AssertionError} When the value is not an array. - */ -goog.asserts.assertArray = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isArray(value)) { - goog.asserts.doAssertFailure_('Expected array but got %s: %s.', - [goog.typeOf(value), value], opt_message, - Array.prototype.slice.call(arguments, 2)); - } - return /** @type {!Array<?>} */ (value); -}; - - -/** - * Checks if the value is a boolean if goog.asserts.ENABLE_ASSERTS is true. - * @param {*} value The value to check. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @return {boolean} The value, guaranteed to be a boolean when asserts are - * enabled. - * @throws {goog.asserts.AssertionError} When the value is not a boolean. - */ -goog.asserts.assertBoolean = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value)) { - goog.asserts.doAssertFailure_('Expected boolean but got %s: %s.', - [goog.typeOf(value), value], opt_message, - Array.prototype.slice.call(arguments, 2)); - } - return /** @type {boolean} */ (value); -}; - - -/** - * Checks if the value is a DOM Element if goog.asserts.ENABLE_ASSERTS is true. - * @param {*} value The value to check. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @return {!Element} The value, likely to be a DOM Element when asserts are - * enabled. - * @throws {goog.asserts.AssertionError} When the value is not an Element. - */ -goog.asserts.assertElement = function(value, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && (!goog.isObject(value) || - value.nodeType != goog.dom.NodeType.ELEMENT)) { - goog.asserts.doAssertFailure_('Expected Element but got %s: %s.', - [goog.typeOf(value), value], opt_message, - Array.prototype.slice.call(arguments, 2)); - } - return /** @type {!Element} */ (value); -}; - - -/** - * Checks if the value is an instance of the user-defined type if - * goog.asserts.ENABLE_ASSERTS is true. - * - * The compiler may tighten the type returned by this function. - * - * @param {*} value The value to check. - * @param {function(new: T, ...)} type A user-defined constructor. - * @param {string=} opt_message Error message in case of failure. - * @param {...*} var_args The items to substitute into the failure message. - * @throws {goog.asserts.AssertionError} When the value is not an instance of - * type. - * @return {T} - * @template T - */ -goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) { - if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) { - goog.asserts.doAssertFailure_('Expected instanceof %s but got %s.', - [goog.asserts.getType_(type), goog.asserts.getType_(value)], - opt_message, Array.prototype.slice.call(arguments, 3)); - } - return value; -}; - - -/** - * Checks that no enumerable keys are present in Object.prototype. Such keys - * would break most code that use {@code for (var ... in ...)} loops. - */ -goog.asserts.assertObjectPrototypeIsIntact = function() { - for (var key in Object.prototype) { - goog.asserts.fail(key + ' should not be enumerable in Object.prototype.'); - } -}; - - -/** - * Returns the type of a value. If a constructor is passed, and a suitable - * string cannot be found, 'unknown type name' will be returned. - * @param {*} value A constructor, object, or primitive. - * @return {string} The best display name for the value, or 'unknown type name'. - * @private - */ -goog.asserts.getType_ = function(value) { - if (value instanceof Function) { - return value.displayName || value.name || 'unknown type name'; - } else if (value instanceof Object) { - return value.constructor.displayName || value.constructor.name || - Object.prototype.toString.call(value); - } else { - return value === null ? 'null' : typeof value; - } -}; - -goog.provide('ol.math'); - -goog.require('goog.asserts'); - - -/** - * Takes a number and clamps it to within the provided bounds. - * @param {number} value The input number. - * @param {number} min The minimum value to return. - * @param {number} max The maximum value to return. - * @return {number} The input number if it is within bounds, or the nearest - * number within the bounds. - */ -ol.math.clamp = function(value, min, max) { - return Math.min(Math.max(value, min), max); -}; - - -/** - * Return the hyperbolic cosine of a given number. The method will use the - * native `Math.cosh` function if it is available, otherwise the hyperbolic - * cosine will be calculated via the reference implementation of the Mozilla - * developer network. - * - * @param {number} x X. - * @return {number} Hyperbolic cosine of x. - */ -ol.math.cosh = (function() { - // Wrapped in a iife, to save the overhead of checking for the native - // implementation on every invocation. - var cosh; - if ('cosh' in Math) { - // The environment supports the native Math.cosh function, use it… - cosh = Math.cosh; - } else { - // … else, use the reference implementation of MDN: - cosh = function(x) { - var y = Math.exp(x); - return (y + 1 / y) / 2; - }; - } - return cosh; -}()); - - -/** - * @param {number} x X. - * @return {number} The smallest power of two greater than or equal to x. - */ -ol.math.roundUpToPowerOfTwo = function(x) { - goog.asserts.assert(0 < x, 'x should be larger than 0'); - return Math.pow(2, Math.ceil(Math.log(x) / Math.LN2)); -}; - - -/** - * Returns the square of the closest distance between the point (x, y) and the - * line segment (x1, y1) to (x2, y2). - * @param {number} x X. - * @param {number} y Y. - * @param {number} x1 X1. - * @param {number} y1 Y1. - * @param {number} x2 X2. - * @param {number} y2 Y2. - * @return {number} Squared distance. - */ -ol.math.squaredSegmentDistance = function(x, y, x1, y1, x2, y2) { - var dx = x2 - x1; - var dy = y2 - y1; - if (dx !== 0 || dy !== 0) { - var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy); - if (t > 1) { - x1 = x2; - y1 = y2; - } else if (t > 0) { - x1 += dx * t; - y1 += dy * t; - } - } - return ol.math.squaredDistance(x, y, x1, y1); -}; - - -/** - * Returns the square of the distance between the points (x1, y1) and (x2, y2). - * @param {number} x1 X1. - * @param {number} y1 Y1. - * @param {number} x2 X2. - * @param {number} y2 Y2. - * @return {number} Squared distance. - */ -ol.math.squaredDistance = function(x1, y1, x2, y2) { - var dx = x2 - x1; - var dy = y2 - y1; - return dx * dx + dy * dy; -}; - - -/** - * Solves system of linear equations using Gaussian elimination method. - * - * @param {Array.<Array.<number>>} mat Augmented matrix (n x n + 1 column) - * in row-major order. - * @return {Array.<number>} The resulting vector. - */ -ol.math.solveLinearSystem = function(mat) { - var n = mat.length; - - if (goog.asserts.ENABLE_ASSERTS) { - for (var row = 0; row < n; row++) { - goog.asserts.assert(mat[row].length == n + 1, - 'every row should have correct number of columns'); - } - } - - for (var i = 0; i < n; i++) { - // Find max in the i-th column (ignoring i - 1 first rows) - var maxRow = i; - var maxEl = Math.abs(mat[i][i]); - for (var r = i + 1; r < n; r++) { - var absValue = Math.abs(mat[r][i]); - if (absValue > maxEl) { - maxEl = absValue; - maxRow = r; - } - } - - if (maxEl === 0) { - return null; // matrix is singular - } - - // Swap max row with i-th (current) row - var tmp = mat[maxRow]; - mat[maxRow] = mat[i]; - mat[i] = tmp; - - // Subtract the i-th row to make all the remaining rows 0 in the i-th column - for (var j = i + 1; j < n; j++) { - var coef = -mat[j][i] / mat[i][i]; - for (var k = i; k < n + 1; k++) { - if (i == k) { - mat[j][k] = 0; - } else { - mat[j][k] += coef * mat[i][k]; - } - } - } - } - - // Solve Ax=b for upper triangular matrix A (mat) - var x = new Array(n); - for (var l = n - 1; l >= 0; l--) { - x[l] = mat[l][n] / mat[l][l]; - for (var m = l - 1; m >= 0; m--) { - mat[m][n] -= mat[m][l] * x[l]; - } - } - return x; -}; - - -/** - * Converts radians to to degrees. - * - * @param {number} angleInRadians Angle in radians. - * @return {number} Angle in degrees. - */ -ol.math.toDegrees = function(angleInRadians) { - return angleInRadians * 180 / Math.PI; -}; - - -/** - * Converts degrees to radians. - * - * @param {number} angleInDegrees Angle in degrees. - * @return {number} Angle in radians. - */ -ol.math.toRadians = function(angleInDegrees) { - return angleInDegrees * Math.PI / 180; -}; - -goog.provide('ol.CenterConstraint'); -goog.provide('ol.CenterConstraintType'); - -goog.require('ol.math'); - - -/** - * @typedef {function((ol.Coordinate|undefined)): (ol.Coordinate|undefined)} - */ -ol.CenterConstraintType; - - -/** - * @param {ol.Extent} extent Extent. - * @return {ol.CenterConstraintType} - */ -ol.CenterConstraint.createExtent = function(extent) { - return ( - /** - * @param {ol.Coordinate|undefined} center Center. - * @return {ol.Coordinate|undefined} Center. - */ - function(center) { - if (center) { - return [ - ol.math.clamp(center[0], extent[0], extent[2]), - ol.math.clamp(center[1], extent[1], extent[3]) - ]; - } else { - return undefined; - } - }); -}; - - -/** - * @param {ol.Coordinate|undefined} center Center. - * @return {ol.Coordinate|undefined} Center. - */ -ol.CenterConstraint.none = function(center) { - return center; -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for manipulating arrays. - * - * @author arv@google.com (Erik Arvidsson) - */ - - -goog.provide('goog.array'); -goog.provide('goog.array.ArrayLike'); - -goog.require('goog.asserts'); - - -/** - * @define {boolean} NATIVE_ARRAY_PROTOTYPES indicates whether the code should - * rely on Array.prototype functions, if available. - * - * The Array.prototype functions can be defined by external libraries like - * Prototype and setting this flag to false forces closure to use its own - * goog.array implementation. - * - * If your javascript can be loaded by a third party site and you are wary about - * relying on the prototype functions, specify - * "--define goog.NATIVE_ARRAY_PROTOTYPES=false" to the JSCompiler. - * - * Setting goog.TRUSTED_SITE to false will automatically set - * NATIVE_ARRAY_PROTOTYPES to false. - */ -goog.define('goog.NATIVE_ARRAY_PROTOTYPES', goog.TRUSTED_SITE); - - -/** - * @define {boolean} If true, JSCompiler will use the native implementation of - * array functions where appropriate (e.g., {@code Array#filter}) and remove the - * unused pure JS implementation. - */ -goog.define('goog.array.ASSUME_NATIVE_FUNCTIONS', false); - - -/** - * @typedef {Array|NodeList|Arguments|{length: number}} - */ -goog.array.ArrayLike; - - -/** - * Returns the last element in an array without removing it. - * Same as goog.array.last. - * @param {Array<T>|goog.array.ArrayLike} array The array. - * @return {T} Last item in array. - * @template T - */ -goog.array.peek = function(array) { - return array[array.length - 1]; -}; - - -/** - * Returns the last element in an array without removing it. - * Same as goog.array.peek. - * @param {Array<T>|goog.array.ArrayLike} array The array. - * @return {T} Last item in array. - * @template T - */ -goog.array.last = goog.array.peek; - - -/** - * Reference to the original {@code Array.prototype}. - * @private - */ -goog.array.ARRAY_PROTOTYPE_ = Array.prototype; - - -// NOTE(arv): Since most of the array functions are generic it allows you to -// pass an array-like object. Strings have a length and are considered array- -// like. However, the 'in' operator does not work on strings so we cannot just -// use the array path even if the browser supports indexing into strings. We -// therefore end up splitting the string. - - -/** - * Returns the index of the first element of an array with a specified value, or - * -1 if the element is not present in the array. - * - * See {@link http://tinyurl.com/developer-mozilla-org-array-indexof} - * - * @param {Array<T>|goog.array.ArrayLike} arr The array to be searched. - * @param {T} obj The object for which we are searching. - * @param {number=} opt_fromIndex The index at which to start the search. If - * omitted the search starts at index 0. - * @return {number} The index of the first matching array element. - * @template T - */ -goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.indexOf) ? - function(arr, obj, opt_fromIndex) { - goog.asserts.assert(arr.length != null); - - return goog.array.ARRAY_PROTOTYPE_.indexOf.call(arr, obj, opt_fromIndex); - } : - function(arr, obj, opt_fromIndex) { - var fromIndex = opt_fromIndex == null ? - 0 : (opt_fromIndex < 0 ? - Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex); - - if (goog.isString(arr)) { - // Array.prototype.indexOf uses === so only strings should be found. - if (!goog.isString(obj) || obj.length != 1) { - return -1; - } - return arr.indexOf(obj, fromIndex); - } - - for (var i = fromIndex; i < arr.length; i++) { - if (i in arr && arr[i] === obj) - return i; - } - return -1; - }; - - -/** - * Returns the index of the last element of an array with a specified value, or - * -1 if the element is not present in the array. - * - * See {@link http://tinyurl.com/developer-mozilla-org-array-lastindexof} - * - * @param {!Array<T>|!goog.array.ArrayLike} arr The array to be searched. - * @param {T} obj The object for which we are searching. - * @param {?number=} opt_fromIndex The index at which to start the search. If - * omitted the search starts at the end of the array. - * @return {number} The index of the last matching array element. - * @template T - */ -goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.lastIndexOf) ? - function(arr, obj, opt_fromIndex) { - goog.asserts.assert(arr.length != null); - - // Firefox treats undefined and null as 0 in the fromIndex argument which - // leads it to always return -1 - var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex; - return goog.array.ARRAY_PROTOTYPE_.lastIndexOf.call(arr, obj, fromIndex); - } : - function(arr, obj, opt_fromIndex) { - var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex; - - if (fromIndex < 0) { - fromIndex = Math.max(0, arr.length + fromIndex); - } - - if (goog.isString(arr)) { - // Array.prototype.lastIndexOf uses === so only strings should be found. - if (!goog.isString(obj) || obj.length != 1) { - return -1; - } - return arr.lastIndexOf(obj, fromIndex); - } - - for (var i = fromIndex; i >= 0; i--) { - if (i in arr && arr[i] === obj) - return i; - } - return -1; - }; - - -/** - * Calls a function for each element in an array. Skips holes in the array. - * See {@link http://tinyurl.com/developer-mozilla-org-array-foreach} - * - * @param {Array<T>|goog.array.ArrayLike} arr Array or array like object over - * which to iterate. - * @param {?function(this: S, T, number, ?): ?} f The function to call for every - * element. This function takes 3 arguments (the element, the index and the - * array). The return value is ignored. - * @param {S=} opt_obj The object to be used as the value of 'this' within f. - * @template T,S - */ -goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.forEach) ? - function(arr, f, opt_obj) { - goog.asserts.assert(arr.length != null); - - goog.array.ARRAY_PROTOTYPE_.forEach.call(arr, f, opt_obj); - } : - function(arr, f, opt_obj) { - var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; - for (var i = 0; i < l; i++) { - if (i in arr2) { - f.call(opt_obj, arr2[i], i, arr); - } - } - }; - - -/** - * Calls a function for each element in an array, starting from the last - * element rather than the first. - * - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this: S, T, number, ?): ?} f The function to call for every - * element. This function - * takes 3 arguments (the element, the index and the array). The return - * value is ignored. - * @param {S=} opt_obj The object to be used as the value of 'this' - * within f. - * @template T,S - */ -goog.array.forEachRight = function(arr, f, opt_obj) { - var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; - for (var i = l - 1; i >= 0; --i) { - if (i in arr2) { - f.call(opt_obj, arr2[i], i, arr); - } - } -}; - - -/** - * Calls a function for each element in an array, and if the function returns - * true adds the element to a new array. - * - * See {@link http://tinyurl.com/developer-mozilla-org-array-filter} - * - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?):boolean} f The function to call for - * every element. This function - * takes 3 arguments (the element, the index and the array) and must - * return a Boolean. If the return value is true the element is added to the - * result array. If it is false the element is not included. - * @param {S=} opt_obj The object to be used as the value of 'this' - * within f. - * @return {!Array<T>} a new array in which only elements that passed the test - * are present. - * @template T,S - */ -goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.filter) ? - function(arr, f, opt_obj) { - goog.asserts.assert(arr.length != null); - - return goog.array.ARRAY_PROTOTYPE_.filter.call(arr, f, opt_obj); - } : - function(arr, f, opt_obj) { - var l = arr.length; // must be fixed during loop... see docs - var res = []; - var resLength = 0; - var arr2 = goog.isString(arr) ? arr.split('') : arr; - for (var i = 0; i < l; i++) { - if (i in arr2) { - var val = arr2[i]; // in case f mutates arr2 - if (f.call(opt_obj, val, i, arr)) { - res[resLength++] = val; - } - } - } - return res; - }; - - -/** - * Calls a function for each element in an array and inserts the result into a - * new array. - * - * See {@link http://tinyurl.com/developer-mozilla-org-array-map} - * - * @param {Array<VALUE>|goog.array.ArrayLike} arr Array or array like object - * over which to iterate. - * @param {function(this:THIS, VALUE, number, ?): RESULT} f The function to call - * for every element. This function takes 3 arguments (the element, - * the index and the array) and should return something. The result will be - * inserted into a new array. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within f. - * @return {!Array<RESULT>} a new array with the results from f. - * @template THIS, VALUE, RESULT - */ -goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.map) ? - function(arr, f, opt_obj) { - goog.asserts.assert(arr.length != null); - - return goog.array.ARRAY_PROTOTYPE_.map.call(arr, f, opt_obj); - } : - function(arr, f, opt_obj) { - var l = arr.length; // must be fixed during loop... see docs - var res = new Array(l); - var arr2 = goog.isString(arr) ? arr.split('') : arr; - for (var i = 0; i < l; i++) { - if (i in arr2) { - res[i] = f.call(opt_obj, arr2[i], i, arr); - } - } - return res; - }; - - -/** - * Passes every element of an array into a function and accumulates the result. - * - * See {@link http://tinyurl.com/developer-mozilla-org-array-reduce} - * - * For example: - * var a = [1, 2, 3, 4]; - * goog.array.reduce(a, function(r, v, i, arr) {return r + v;}, 0); - * returns 10 - * - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {function(this:S, R, T, number, ?) : R} f The function to call for - * every element. This function - * takes 4 arguments (the function's previous result or the initial value, - * the value of the current array element, the current array index, and the - * array itself) - * function(previousValue, currentValue, index, array). - * @param {?} val The initial value to pass into the function on the first call. - * @param {S=} opt_obj The object to be used as the value of 'this' - * within f. - * @return {R} Result of evaluating f repeatedly across the values of the array. - * @template T,S,R - */ -goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.reduce) ? - function(arr, f, val, opt_obj) { - goog.asserts.assert(arr.length != null); - if (opt_obj) { - f = goog.bind(f, opt_obj); - } - return goog.array.ARRAY_PROTOTYPE_.reduce.call(arr, f, val); - } : - function(arr, f, val, opt_obj) { - var rval = val; - goog.array.forEach(arr, function(val, index) { - rval = f.call(opt_obj, rval, val, index, arr); - }); - return rval; - }; - - -/** - * Passes every element of an array into a function and accumulates the result, - * starting from the last element and working towards the first. - * - * See {@link http://tinyurl.com/developer-mozilla-org-array-reduceright} - * - * For example: - * var a = ['a', 'b', 'c']; - * goog.array.reduceRight(a, function(r, v, i, arr) {return r + v;}, ''); - * returns 'cba' - * - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, R, T, number, ?) : R} f The function to call for - * every element. This function - * takes 4 arguments (the function's previous result or the initial value, - * the value of the current array element, the current array index, and the - * array itself) - * function(previousValue, currentValue, index, array). - * @param {?} val The initial value to pass into the function on the first call. - * @param {S=} opt_obj The object to be used as the value of 'this' - * within f. - * @return {R} Object returned as a result of evaluating f repeatedly across the - * values of the array. - * @template T,S,R - */ -goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.reduceRight) ? - function(arr, f, val, opt_obj) { - goog.asserts.assert(arr.length != null); - if (opt_obj) { - f = goog.bind(f, opt_obj); - } - return goog.array.ARRAY_PROTOTYPE_.reduceRight.call(arr, f, val); - } : - function(arr, f, val, opt_obj) { - var rval = val; - goog.array.forEachRight(arr, function(val, index) { - rval = f.call(opt_obj, rval, val, index, arr); - }); - return rval; - }; - - -/** - * Calls f for each element of an array. If any call returns true, some() - * returns true (without checking the remaining elements). If all calls - * return false, some() returns false. - * - * See {@link http://tinyurl.com/developer-mozilla-org-array-some} - * - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?) : boolean} f The function to call for - * for every element. This function takes 3 arguments (the element, the - * index and the array) and should return a boolean. - * @param {S=} opt_obj The object to be used as the value of 'this' - * within f. - * @return {boolean} true if any element passes the test. - * @template T,S - */ -goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.some) ? - function(arr, f, opt_obj) { - goog.asserts.assert(arr.length != null); - - return goog.array.ARRAY_PROTOTYPE_.some.call(arr, f, opt_obj); - } : - function(arr, f, opt_obj) { - var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; - for (var i = 0; i < l; i++) { - if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) { - return true; - } - } - return false; - }; - - -/** - * Call f for each element of an array. If all calls return true, every() - * returns true. If any call returns false, every() returns false and - * does not continue to check the remaining elements. - * - * See {@link http://tinyurl.com/developer-mozilla-org-array-every} - * - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?) : boolean} f The function to call for - * for every element. This function takes 3 arguments (the element, the - * index and the array) and should return a boolean. - * @param {S=} opt_obj The object to be used as the value of 'this' - * within f. - * @return {boolean} false if any element fails the test. - * @template T,S - */ -goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && - (goog.array.ASSUME_NATIVE_FUNCTIONS || - goog.array.ARRAY_PROTOTYPE_.every) ? - function(arr, f, opt_obj) { - goog.asserts.assert(arr.length != null); - - return goog.array.ARRAY_PROTOTYPE_.every.call(arr, f, opt_obj); - } : - function(arr, f, opt_obj) { - var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; - for (var i = 0; i < l; i++) { - if (i in arr2 && !f.call(opt_obj, arr2[i], i, arr)) { - return false; - } - } - return true; - }; - - -/** - * Counts the array elements that fulfill the predicate, i.e. for which the - * callback function returns true. Skips holes in the array. - * - * @param {!(Array<T>|goog.array.ArrayLike)} arr Array or array like object - * over which to iterate. - * @param {function(this: S, T, number, ?): boolean} f The function to call for - * every element. Takes 3 arguments (the element, the index and the array). - * @param {S=} opt_obj The object to be used as the value of 'this' within f. - * @return {number} The number of the matching elements. - * @template T,S - */ -goog.array.count = function(arr, f, opt_obj) { - var count = 0; - goog.array.forEach(arr, function(element, index, arr) { - if (f.call(opt_obj, element, index, arr)) { - ++count; - } - }, opt_obj); - return count; -}; - - -/** - * Search an array for the first element that satisfies a given condition and - * return that element. - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?) : boolean} f The function to call - * for every element. This function takes 3 arguments (the element, the - * index and the array) and should return a boolean. - * @param {S=} opt_obj An optional "this" context for the function. - * @return {T|null} The first array element that passes the test, or null if no - * element is found. - * @template T,S - */ -goog.array.find = function(arr, f, opt_obj) { - var i = goog.array.findIndex(arr, f, opt_obj); - return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i]; -}; - - -/** - * Search an array for the first element that satisfies a given condition and - * return its index. - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?) : boolean} f The function to call for - * every element. This function - * takes 3 arguments (the element, the index and the array) and should - * return a boolean. - * @param {S=} opt_obj An optional "this" context for the function. - * @return {number} The index of the first array element that passes the test, - * or -1 if no element is found. - * @template T,S - */ -goog.array.findIndex = function(arr, f, opt_obj) { - var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; - for (var i = 0; i < l; i++) { - if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) { - return i; - } - } - return -1; -}; - - -/** - * Search an array (in reverse order) for the last element that satisfies a - * given condition and return that element. - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?) : boolean} f The function to call - * for every element. This function - * takes 3 arguments (the element, the index and the array) and should - * return a boolean. - * @param {S=} opt_obj An optional "this" context for the function. - * @return {T|null} The last array element that passes the test, or null if no - * element is found. - * @template T,S - */ -goog.array.findRight = function(arr, f, opt_obj) { - var i = goog.array.findIndexRight(arr, f, opt_obj); - return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i]; -}; - - -/** - * Search an array (in reverse order) for the last element that satisfies a - * given condition and return its index. - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?) : boolean} f The function to call - * for every element. This function - * takes 3 arguments (the element, the index and the array) and should - * return a boolean. - * @param {S=} opt_obj An optional "this" context for the function. - * @return {number} The index of the last array element that passes the test, - * or -1 if no element is found. - * @template T,S - */ -goog.array.findIndexRight = function(arr, f, opt_obj) { - var l = arr.length; // must be fixed during loop... see docs - var arr2 = goog.isString(arr) ? arr.split('') : arr; - for (var i = l - 1; i >= 0; i--) { - if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) { - return i; - } - } - return -1; -}; - - -/** - * Whether the array contains the given object. - * @param {goog.array.ArrayLike} arr The array to test for the presence of the - * element. - * @param {*} obj The object for which to test. - * @return {boolean} true if obj is present. - */ -goog.array.contains = function(arr, obj) { - return goog.array.indexOf(arr, obj) >= 0; -}; - - -/** - * Whether the array is empty. - * @param {goog.array.ArrayLike} arr The array to test. - * @return {boolean} true if empty. - */ -goog.array.isEmpty = function(arr) { - return arr.length == 0; -}; - - -/** - * Clears the array. - * @param {goog.array.ArrayLike} arr Array or array like object to clear. - */ -goog.array.clear = function(arr) { - // For non real arrays we don't have the magic length so we delete the - // indices. - if (!goog.isArray(arr)) { - for (var i = arr.length - 1; i >= 0; i--) { - delete arr[i]; - } - } - arr.length = 0; -}; - - -/** - * Pushes an item into an array, if it's not already in the array. - * @param {Array<T>} arr Array into which to insert the item. - * @param {T} obj Value to add. - * @template T - */ -goog.array.insert = function(arr, obj) { - if (!goog.array.contains(arr, obj)) { - arr.push(obj); - } -}; - - -/** - * Inserts an object at the given index of the array. - * @param {goog.array.ArrayLike} arr The array to modify. - * @param {*} obj The object to insert. - * @param {number=} opt_i The index at which to insert the object. If omitted, - * treated as 0. A negative index is counted from the end of the array. - */ -goog.array.insertAt = function(arr, obj, opt_i) { - goog.array.splice(arr, opt_i, 0, obj); -}; - - -/** - * Inserts at the given index of the array, all elements of another array. - * @param {goog.array.ArrayLike} arr The array to modify. - * @param {goog.array.ArrayLike} elementsToAdd The array of elements to add. - * @param {number=} opt_i The index at which to insert the object. If omitted, - * treated as 0. A negative index is counted from the end of the array. - */ -goog.array.insertArrayAt = function(arr, elementsToAdd, opt_i) { - goog.partial(goog.array.splice, arr, opt_i, 0).apply(null, elementsToAdd); -}; - - -/** - * Inserts an object into an array before a specified object. - * @param {Array<T>} arr The array to modify. - * @param {T} obj The object to insert. - * @param {T=} opt_obj2 The object before which obj should be inserted. If obj2 - * is omitted or not found, obj is inserted at the end of the array. - * @template T - */ -goog.array.insertBefore = function(arr, obj, opt_obj2) { - var i; - if (arguments.length == 2 || (i = goog.array.indexOf(arr, opt_obj2)) < 0) { - arr.push(obj); - } else { - goog.array.insertAt(arr, obj, i); - } -}; - - -/** - * Removes the first occurrence of a particular value from an array. - * @param {Array<T>|goog.array.ArrayLike} arr Array from which to remove - * value. - * @param {T} obj Object to remove. - * @return {boolean} True if an element was removed. - * @template T - */ -goog.array.remove = function(arr, obj) { - var i = goog.array.indexOf(arr, obj); - var rv; - if ((rv = i >= 0)) { - goog.array.removeAt(arr, i); - } - return rv; -}; - - -/** - * Removes from an array the element at index i - * @param {goog.array.ArrayLike} arr Array or array like object from which to - * remove value. - * @param {number} i The index to remove. - * @return {boolean} True if an element was removed. - */ -goog.array.removeAt = function(arr, i) { - goog.asserts.assert(arr.length != null); - - // use generic form of splice - // splice returns the removed items and if successful the length of that - // will be 1 - return goog.array.ARRAY_PROTOTYPE_.splice.call(arr, i, 1).length == 1; -}; - - -/** - * Removes the first value that satisfies the given condition. - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?) : boolean} f The function to call - * for every element. This function - * takes 3 arguments (the element, the index and the array) and should - * return a boolean. - * @param {S=} opt_obj An optional "this" context for the function. - * @return {boolean} True if an element was removed. - * @template T,S - */ -goog.array.removeIf = function(arr, f, opt_obj) { - var i = goog.array.findIndex(arr, f, opt_obj); - if (i >= 0) { - goog.array.removeAt(arr, i); - return true; - } - return false; -}; - - -/** - * Removes all values that satisfy the given condition. - * @param {Array<T>|goog.array.ArrayLike} arr Array or array - * like object over which to iterate. - * @param {?function(this:S, T, number, ?) : boolean} f The function to call - * for every element. This function - * takes 3 arguments (the element, the index and the array) and should - * return a boolean. - * @param {S=} opt_obj An optional "this" context for the function. - * @return {number} The number of items removed - * @template T,S - */ -goog.array.removeAllIf = function(arr, f, opt_obj) { - var removedCount = 0; - goog.array.forEachRight(arr, function(val, index) { - if (f.call(opt_obj, val, index, arr)) { - if (goog.array.removeAt(arr, index)) { - removedCount++; - } - } - }); - return removedCount; -}; - - -/** - * Returns a new array that is the result of joining the arguments. If arrays - * are passed then their items are added, however, if non-arrays are passed they - * will be added to the return array as is. - * - * Note that ArrayLike objects will be added as is, rather than having their - * items added. - * - * goog.array.concat([1, 2], [3, 4]) -> [1, 2, 3, 4] - * goog.array.concat(0, [1, 2]) -> [0, 1, 2] - * goog.array.concat([1, 2], null) -> [1, 2, null] - * - * There is bug in all current versions of IE (6, 7 and 8) where arrays created - * in an iframe become corrupted soon (not immediately) after the iframe is - * destroyed. This is common if loading data via goog.net.IframeIo, for example. - * This corruption only affects the concat method which will start throwing - * Catastrophic Errors (#-2147418113). - * - * See http://endoflow.com/scratch/corrupted-arrays.html for a test case. - * - * Internally goog.array should use this, so that all methods will continue to - * work on these broken array objects. - * - * @param {...*} var_args Items to concatenate. Arrays will have each item - * added, while primitives and objects will be added as is. - * @return {!Array<?>} The new resultant array. - */ -goog.array.concat = function(var_args) { - return goog.array.ARRAY_PROTOTYPE_.concat.apply( - goog.array.ARRAY_PROTOTYPE_, arguments); -}; - - -/** - * Returns a new array that contains the contents of all the arrays passed. - * @param {...!Array<T>} var_args - * @return {!Array<T>} - * @template T - */ -goog.array.join = function(var_args) { - return goog.array.ARRAY_PROTOTYPE_.concat.apply( - goog.array.ARRAY_PROTOTYPE_, arguments); -}; - - -/** - * Converts an object to an array. - * @param {Array<T>|goog.array.ArrayLike} object The object to convert to an - * array. - * @return {!Array<T>} The object converted into an array. If object has a - * length property, every property indexed with a non-negative number - * less than length will be included in the result. If object does not - * have a length property, an empty array will be returned. - * @template T - */ -goog.array.toArray = function(object) { - var length = object.length; - - // If length is not a number the following it false. This case is kept for - // backwards compatibility since there are callers that pass objects that are - // not array like. - if (length > 0) { - var rv = new Array(length); - for (var i = 0; i < length; i++) { - rv[i] = object[i]; - } - return rv; - } - return []; -}; - - -/** - * Does a shallow copy of an array. - * @param {Array<T>|goog.array.ArrayLike} arr Array or array-like object to - * clone. - * @return {!Array<T>} Clone of the input array. - * @template T - */ -goog.array.clone = goog.array.toArray; - - -/** - * Extends an array with another array, element, or "array like" object. - * This function operates 'in-place', it does not create a new Array. - * - * Example: - * var a = []; - * goog.array.extend(a, [0, 1]); - * a; // [0, 1] - * goog.array.extend(a, 2); - * a; // [0, 1, 2] - * - * @param {Array<VALUE>} arr1 The array to modify. - * @param {...(Array<VALUE>|VALUE)} var_args The elements or arrays of elements - * to add to arr1. - * @template VALUE - */ -goog.array.extend = function(arr1, var_args) { - for (var i = 1; i < arguments.length; i++) { - var arr2 = arguments[i]; - if (goog.isArrayLike(arr2)) { - var len1 = arr1.length || 0; - var len2 = arr2.length || 0; - arr1.length = len1 + len2; - for (var j = 0; j < len2; j++) { - arr1[len1 + j] = arr2[j]; - } - } else { - arr1.push(arr2); - } - } -}; - - -/** - * Adds or removes elements from an array. This is a generic version of Array - * splice. This means that it might work on other objects similar to arrays, - * such as the arguments object. - * - * @param {Array<T>|goog.array.ArrayLike} arr The array to modify. - * @param {number|undefined} index The index at which to start changing the - * array. If not defined, treated as 0. - * @param {number} howMany How many elements to remove (0 means no removal. A - * value below 0 is treated as zero and so is any other non number. Numbers - * are floored). - * @param {...T} var_args Optional, additional elements to insert into the - * array. - * @return {!Array<T>} the removed elements. - * @template T - */ -goog.array.splice = function(arr, index, howMany, var_args) { - goog.asserts.assert(arr.length != null); - - return goog.array.ARRAY_PROTOTYPE_.splice.apply( - arr, goog.array.slice(arguments, 1)); -}; - - -/** - * Returns a new array from a segment of an array. This is a generic version of - * Array slice. This means that it might work on other objects similar to - * arrays, such as the arguments object. - * - * @param {Array<T>|goog.array.ArrayLike} arr The array from - * which to copy a segment. - * @param {number} start The index of the first element to copy. - * @param {number=} opt_end The index after the last element to copy. - * @return {!Array<T>} A new array containing the specified segment of the - * original array. - * @template T - */ -goog.array.slice = function(arr, start, opt_end) { - goog.asserts.assert(arr.length != null); - - // passing 1 arg to slice is not the same as passing 2 where the second is - // null or undefined (in that case the second argument is treated as 0). - // we could use slice on the arguments object and then use apply instead of - // testing the length - if (arguments.length <= 2) { - return goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start); - } else { - return goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start, opt_end); - } -}; - - -/** - * Removes all duplicates from an array (retaining only the first - * occurrence of each array element). This function modifies the - * array in place and doesn't change the order of the non-duplicate items. - * - * For objects, duplicates are identified as having the same unique ID as - * defined by {@link goog.getUid}. - * - * Alternatively you can specify a custom hash function that returns a unique - * value for each item in the array it should consider unique. - * - * Runtime: N, - * Worstcase space: 2N (no dupes) - * - * @param {Array<T>|goog.array.ArrayLike} arr The array from which to remove - * duplicates. - * @param {Array=} opt_rv An optional array in which to return the results, - * instead of performing the removal inplace. If specified, the original - * array will remain unchanged. - * @param {function(T):string=} opt_hashFn An optional function to use to - * apply to every item in the array. This function should return a unique - * value for each item in the array it should consider unique. - * @template T - */ -goog.array.removeDuplicates = function(arr, opt_rv, opt_hashFn) { - var returnArray = opt_rv || arr; - var defaultHashFn = function(item) { - // Prefix each type with a single character representing the type to - // prevent conflicting keys (e.g. true and 'true'). - return goog.isObject(item) ? 'o' + goog.getUid(item) : - (typeof item).charAt(0) + item; - }; - var hashFn = opt_hashFn || defaultHashFn; - - var seen = {}, cursorInsert = 0, cursorRead = 0; - while (cursorRead < arr.length) { - var current = arr[cursorRead++]; - var key = hashFn(current); - if (!Object.prototype.hasOwnProperty.call(seen, key)) { - seen[key] = true; - returnArray[cursorInsert++] = current; - } - } - returnArray.length = cursorInsert; -}; - - -/** - * Searches the specified array for the specified target using the binary - * search algorithm. If no opt_compareFn is specified, elements are compared - * using <code>goog.array.defaultCompare</code>, which compares the elements - * using the built in < and > operators. This will produce the expected - * behavior for homogeneous arrays of String(s) and Number(s). The array - * specified <b>must</b> be sorted in ascending order (as defined by the - * comparison function). If the array is not sorted, results are undefined. - * If the array contains multiple instances of the specified target value, any - * of these instances may be found. - * - * Runtime: O(log n) - * - * @param {Array<VALUE>|goog.array.ArrayLike} arr The array to be searched. - * @param {TARGET} target The sought value. - * @param {function(TARGET, VALUE): number=} opt_compareFn Optional comparison - * function by which the array is ordered. Should take 2 arguments to - * compare, and return a negative number, zero, or a positive number - * depending on whether the first argument is less than, equal to, or - * greater than the second. - * @return {number} Lowest index of the target value if found, otherwise - * (-(insertion point) - 1). The insertion point is where the value should - * be inserted into arr to preserve the sorted property. Return value >= 0 - * iff target is found. - * @template TARGET, VALUE - */ -goog.array.binarySearch = function(arr, target, opt_compareFn) { - return goog.array.binarySearch_(arr, - opt_compareFn || goog.array.defaultCompare, false /* isEvaluator */, - target); -}; - - -/** - * Selects an index in the specified array using the binary search algorithm. - * The evaluator receives an element and determines whether the desired index - * is before, at, or after it. The evaluator must be consistent (formally, - * goog.array.map(goog.array.map(arr, evaluator, opt_obj), goog.math.sign) - * must be monotonically non-increasing). - * - * Runtime: O(log n) - * - * @param {Array<VALUE>|goog.array.ArrayLike} arr The array to be searched. - * @param {function(this:THIS, VALUE, number, ?): number} evaluator - * Evaluator function that receives 3 arguments (the element, the index and - * the array). Should return a negative number, zero, or a positive number - * depending on whether the desired index is before, at, or after the - * element passed to it. - * @param {THIS=} opt_obj The object to be used as the value of 'this' - * within evaluator. - * @return {number} Index of the leftmost element matched by the evaluator, if - * such exists; otherwise (-(insertion point) - 1). The insertion point is - * the index of the first element for which the evaluator returns negative, - * or arr.length if no such element exists. The return value is non-negative - * iff a match is found. - * @template THIS, VALUE - */ -goog.array.binarySelect = function(arr, evaluator, opt_obj) { - return goog.array.binarySearch_(arr, evaluator, true /* isEvaluator */, - undefined /* opt_target */, opt_obj); -}; - - -/** - * Implementation of a binary search algorithm which knows how to use both - * comparison functions and evaluators. If an evaluator is provided, will call - * the evaluator with the given optional data object, conforming to the - * interface defined in binarySelect. Otherwise, if a comparison function is - * provided, will call the comparison function against the given data object. - * - * This implementation purposefully does not use goog.bind or goog.partial for - * performance reasons. - * - * Runtime: O(log n) - * - * @param {Array<VALUE>|goog.array.ArrayLike} arr The array to be searched. - * @param {function(TARGET, VALUE): number| - * function(this:THIS, VALUE, number, ?): number} compareFn Either an - * evaluator or a comparison function, as defined by binarySearch - * and binarySelect above. - * @param {boolean} isEvaluator Whether the function is an evaluator or a - * comparison function. - * @param {TARGET=} opt_target If the function is a comparison function, then - * this is the target to binary search for. - * @param {THIS=} opt_selfObj If the function is an evaluator, this is an - * optional this object for the evaluator. - * @return {number} Lowest index of the target value if found, otherwise - * (-(insertion point) - 1). The insertion point is where the value should - * be inserted into arr to preserve the sorted property. Return value >= 0 - * iff target is found. - * @template THIS, VALUE, TARGET - * @private - */ -goog.array.binarySearch_ = function(arr, compareFn, isEvaluator, opt_target, - opt_selfObj) { - var left = 0; // inclusive - var right = arr.length; // exclusive - var found; - while (left < right) { - var middle = (left + right) >> 1; - var compareResult; - if (isEvaluator) { - compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr); - } else { - compareResult = compareFn(opt_target, arr[middle]); - } - if (compareResult > 0) { - left = middle + 1; - } else { - right = middle; - // We are looking for the lowest index so we can't return immediately. - found = !compareResult; - } - } - // left is the index if found, or the insertion point otherwise. - // ~left is a shorthand for -left - 1. - return found ? left : ~left; -}; - - -/** - * Sorts the specified array into ascending order. If no opt_compareFn is - * specified, elements are compared using - * <code>goog.array.defaultCompare</code>, which compares the elements using - * the built in < and > operators. This will produce the expected behavior - * for homogeneous arrays of String(s) and Number(s), unlike the native sort, - * but will give unpredictable results for heterogenous lists of strings and - * numbers with different numbers of digits. - * - * This sort is not guaranteed to be stable. - * - * Runtime: Same as <code>Array.prototype.sort</code> - * - * @param {Array<T>} arr The array to be sorted. - * @param {?function(T,T):number=} opt_compareFn Optional comparison - * function by which the - * array is to be ordered. Should take 2 arguments to compare, and return a - * negative number, zero, or a positive number depending on whether the - * first argument is less than, equal to, or greater than the second. - * @template T - */ -goog.array.sort = function(arr, opt_compareFn) { - // TODO(arv): Update type annotation since null is not accepted. - arr.sort(opt_compareFn || goog.array.defaultCompare); -}; - - -/** - * Sorts the specified array into ascending order in a stable way. If no - * opt_compareFn is specified, elements are compared using - * <code>goog.array.defaultCompare</code>, which compares the elements using - * the built in < and > operators. This will produce the expected behavior - * for homogeneous arrays of String(s) and Number(s). - * - * Runtime: Same as <code>Array.prototype.sort</code>, plus an additional - * O(n) overhead of copying the array twice. - * - * @param {Array<T>} arr The array to be sorted. - * @param {?function(T, T): number=} opt_compareFn Optional comparison function - * by which the array is to be ordered. Should take 2 arguments to compare, - * and return a negative number, zero, or a positive number depending on - * whether the first argument is less than, equal to, or greater than the - * second. - * @template T - */ -goog.array.stableSort = function(arr, opt_compareFn) { - for (var i = 0; i < arr.length; i++) { - arr[i] = {index: i, value: arr[i]}; - } - var valueCompareFn = opt_compareFn || goog.array.defaultCompare; - function stableCompareFn(obj1, obj2) { - return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index; - }; - goog.array.sort(arr, stableCompareFn); - for (var i = 0; i < arr.length; i++) { - arr[i] = arr[i].value; - } -}; - - -/** - * Sort the specified array into ascending order based on item keys - * returned by the specified key function. - * If no opt_compareFn is specified, the keys are compared in ascending order - * using <code>goog.array.defaultCompare</code>. - * - * Runtime: O(S(f(n)), where S is runtime of <code>goog.array.sort</code> - * and f(n) is runtime of the key function. - * - * @param {Array<T>} arr The array to be sorted. - * @param {function(T): K} keyFn Function taking array element and returning - * a key used for sorting this element. - * @param {?function(K, K): number=} opt_compareFn Optional comparison function - * by which the keys are to be ordered. Should take 2 arguments to compare, - * and return a negative number, zero, or a positive number depending on - * whether the first argument is less than, equal to, or greater than the - * second. - * @template T,K - */ -goog.array.sortByKey = function(arr, keyFn, opt_compareFn) { - var keyCompareFn = opt_compareFn || goog.array.defaultCompare; - goog.array.sort(arr, function(a, b) { - return keyCompareFn(keyFn(a), keyFn(b)); - }); -}; - - -/** - * Sorts an array of objects by the specified object key and compare - * function. If no compare function is provided, the key values are - * compared in ascending order using <code>goog.array.defaultCompare</code>. - * This won't work for keys that get renamed by the compiler. So use - * {'foo': 1, 'bar': 2} rather than {foo: 1, bar: 2}. - * @param {Array<Object>} arr An array of objects to sort. - * @param {string} key The object key to sort by. - * @param {Function=} opt_compareFn The function to use to compare key - * values. - */ -goog.array.sortObjectsByKey = function(arr, key, opt_compareFn) { - goog.array.sortByKey(arr, - function(obj) { return obj[key]; }, - opt_compareFn); -}; - - -/** - * Tells if the array is sorted. - * @param {!Array<T>} arr The array. - * @param {?function(T,T):number=} opt_compareFn Function to compare the - * array elements. - * Should take 2 arguments to compare, and return a negative number, zero, - * or a positive number depending on whether the first argument is less - * than, equal to, or greater than the second. - * @param {boolean=} opt_strict If true no equal elements are allowed. - * @return {boolean} Whether the array is sorted. - * @template T - */ -goog.array.isSorted = function(arr, opt_compareFn, opt_strict) { - var compare = opt_compareFn || goog.array.defaultCompare; - for (var i = 1; i < arr.length; i++) { - var compareResult = compare(arr[i - 1], arr[i]); - if (compareResult > 0 || compareResult == 0 && opt_strict) { - return false; - } - } - return true; -}; - - -/** - * Compares two arrays for equality. Two arrays are considered equal if they - * have the same length and their corresponding elements are equal according to - * the comparison function. - * - * @param {goog.array.ArrayLike} arr1 The first array to compare. - * @param {goog.array.ArrayLike} arr2 The second array to compare. - * @param {Function=} opt_equalsFn Optional comparison function. - * Should take 2 arguments to compare, and return true if the arguments - * are equal. Defaults to {@link goog.array.defaultCompareEquality} which - * compares the elements using the built-in '===' operator. - * @return {boolean} Whether the two arrays are equal. - */ -goog.array.equals = function(arr1, arr2, opt_equalsFn) { - if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) || - arr1.length != arr2.length) { - return false; - } - var l = arr1.length; - var equalsFn = opt_equalsFn || goog.array.defaultCompareEquality; - for (var i = 0; i < l; i++) { - if (!equalsFn(arr1[i], arr2[i])) { - return false; - } - } - return true; -}; - - -/** - * 3-way array compare function. - * @param {!Array<VALUE>|!goog.array.ArrayLike} arr1 The first array to - * compare. - * @param {!Array<VALUE>|!goog.array.ArrayLike} arr2 The second array to - * compare. - * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison - * function by which the array is to be ordered. Should take 2 arguments to - * compare, and return a negative number, zero, or a positive number - * depending on whether the first argument is less than, equal to, or - * greater than the second. - * @return {number} Negative number, zero, or a positive number depending on - * whether the first argument is less than, equal to, or greater than the - * second. - * @template VALUE - */ -goog.array.compare3 = function(arr1, arr2, opt_compareFn) { - var compare = opt_compareFn || goog.array.defaultCompare; - var l = Math.min(arr1.length, arr2.length); - for (var i = 0; i < l; i++) { - var result = compare(arr1[i], arr2[i]); - if (result != 0) { - return result; - } - } - return goog.array.defaultCompare(arr1.length, arr2.length); -}; - - -/** - * Compares its two arguments for order, using the built in < and > - * operators. - * @param {VALUE} a The first object to be compared. - * @param {VALUE} b The second object to be compared. - * @return {number} A negative number, zero, or a positive number as the first - * argument is less than, equal to, or greater than the second, - * respectively. - * @template VALUE - */ -goog.array.defaultCompare = function(a, b) { - return a > b ? 1 : a < b ? -1 : 0; -}; - - -/** - * Compares its two arguments for inverse order, using the built in < and > - * operators. - * @param {VALUE} a The first object to be compared. - * @param {VALUE} b The second object to be compared. - * @return {number} A negative number, zero, or a positive number as the first - * argument is greater than, equal to, or less than the second, - * respectively. - * @template VALUE - */ -goog.array.inverseDefaultCompare = function(a, b) { - return -goog.array.defaultCompare(a, b); -}; - - -/** - * Compares its two arguments for equality, using the built in === operator. - * @param {*} a The first object to compare. - * @param {*} b The second object to compare. - * @return {boolean} True if the two arguments are equal, false otherwise. - */ -goog.array.defaultCompareEquality = function(a, b) { - return a === b; -}; - - -/** - * Inserts a value into a sorted array. The array is not modified if the - * value is already present. - * @param {Array<VALUE>|goog.array.ArrayLike} array The array to modify. - * @param {VALUE} value The object to insert. - * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison - * function by which the array is ordered. Should take 2 arguments to - * compare, and return a negative number, zero, or a positive number - * depending on whether the first argument is less than, equal to, or - * greater than the second. - * @return {boolean} True if an element was inserted. - * @template VALUE - */ -goog.array.binaryInsert = function(array, value, opt_compareFn) { - var index = goog.array.binarySearch(array, value, opt_compareFn); - if (index < 0) { - goog.array.insertAt(array, value, -(index + 1)); - return true; - } - return false; -}; - - -/** - * Removes a value from a sorted array. - * @param {!Array<VALUE>|!goog.array.ArrayLike} array The array to modify. - * @param {VALUE} value The object to remove. - * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison - * function by which the array is ordered. Should take 2 arguments to - * compare, and return a negative number, zero, or a positive number - * depending on whether the first argument is less than, equal to, or - * greater than the second. - * @return {boolean} True if an element was removed. - * @template VALUE - */ -goog.array.binaryRemove = function(array, value, opt_compareFn) { - var index = goog.array.binarySearch(array, value, opt_compareFn); - return (index >= 0) ? goog.array.removeAt(array, index) : false; -}; - - -/** - * Splits an array into disjoint buckets according to a splitting function. - * @param {Array<T>} array The array. - * @param {function(this:S, T,number,Array<T>):?} sorter Function to call for - * every element. This takes 3 arguments (the element, the index and the - * array) and must return a valid object key (a string, number, etc), or - * undefined, if that object should not be placed in a bucket. - * @param {S=} opt_obj The object to be used as the value of 'this' within - * sorter. - * @return {!Object} An object, with keys being all of the unique return values - * of sorter, and values being arrays containing the items for - * which the splitter returned that key. - * @template T,S - */ -goog.array.bucket = function(array, sorter, opt_obj) { - var buckets = {}; - - for (var i = 0; i < array.length; i++) { - var value = array[i]; - var key = sorter.call(opt_obj, value, i, array); - if (goog.isDef(key)) { - // Push the value to the right bucket, creating it if necessary. - var bucket = buckets[key] || (buckets[key] = []); - bucket.push(value); - } - } - - return buckets; -}; - - -/** - * Creates a new object built from the provided array and the key-generation - * function. - * @param {Array<T>|goog.array.ArrayLike} arr Array or array like object over - * which to iterate whose elements will be the values in the new object. - * @param {?function(this:S, T, number, ?) : string} keyFunc The function to - * call for every element. This function takes 3 arguments (the element, the - * index and the array) and should return a string that will be used as the - * key for the element in the new object. If the function returns the same - * key for more than one element, the value for that key is - * implementation-defined. - * @param {S=} opt_obj The object to be used as the value of 'this' - * within keyFunc. - * @return {!Object<T>} The new object. - * @template T,S - */ -goog.array.toObject = function(arr, keyFunc, opt_obj) { - var ret = {}; - goog.array.forEach(arr, function(element, index) { - ret[keyFunc.call(opt_obj, element, index, arr)] = element; - }); - return ret; -}; - - -/** - * Creates a range of numbers in an arithmetic progression. - * - * Range takes 1, 2, or 3 arguments: - * <pre> - * range(5) is the same as range(0, 5, 1) and produces [0, 1, 2, 3, 4] - * range(2, 5) is the same as range(2, 5, 1) and produces [2, 3, 4] - * range(-2, -5, -1) produces [-2, -3, -4] - * range(-2, -5, 1) produces [], since stepping by 1 wouldn't ever reach -5. - * </pre> - * - * @param {number} startOrEnd The starting value of the range if an end argument - * is provided. Otherwise, the start value is 0, and this is the end value. - * @param {number=} opt_end The optional end value of the range. - * @param {number=} opt_step The step size between range values. Defaults to 1 - * if opt_step is undefined or 0. - * @return {!Array<number>} An array of numbers for the requested range. May be - * an empty array if adding the step would not converge toward the end - * value. - */ -goog.array.range = function(startOrEnd, opt_end, opt_step) { - var array = []; - var start = 0; - var end = startOrEnd; - var step = opt_step || 1; - if (opt_end !== undefined) { - start = startOrEnd; - end = opt_end; - } - - if (step * (end - start) < 0) { - // Sign mismatch: start + step will never reach the end value. - return []; - } - - if (step > 0) { - for (var i = start; i < end; i += step) { - array.push(i); - } - } else { - for (var i = start; i > end; i += step) { - array.push(i); - } - } - return array; -}; - - -/** - * Returns an array consisting of the given value repeated N times. - * - * @param {VALUE} value The value to repeat. - * @param {number} n The repeat count. - * @return {!Array<VALUE>} An array with the repeated value. - * @template VALUE - */ -goog.array.repeat = function(value, n) { - var array = []; - for (var i = 0; i < n; i++) { - array[i] = value; - } - return array; -}; - - -/** - * Returns an array consisting of every argument with all arrays - * expanded in-place recursively. - * - * @param {...*} var_args The values to flatten. - * @return {!Array<?>} An array containing the flattened values. - */ -goog.array.flatten = function(var_args) { - var CHUNK_SIZE = 8192; - - var result = []; - for (var i = 0; i < arguments.length; i++) { - var element = arguments[i]; - if (goog.isArray(element)) { - for (var c = 0; c < element.length; c += CHUNK_SIZE) { - var chunk = goog.array.slice(element, c, c + CHUNK_SIZE); - var recurseResult = goog.array.flatten.apply(null, chunk); - for (var r = 0; r < recurseResult.length; r++) { - result.push(recurseResult[r]); - } - } - } else { - result.push(element); - } - } - return result; -}; - - -/** - * Rotates an array in-place. After calling this method, the element at - * index i will be the element previously at index (i - n) % - * array.length, for all values of i between 0 and array.length - 1, - * inclusive. - * - * For example, suppose list comprises [t, a, n, k, s]. After invoking - * rotate(array, 1) (or rotate(array, -4)), array will comprise [s, t, a, n, k]. - * - * @param {!Array<T>} array The array to rotate. - * @param {number} n The amount to rotate. - * @return {!Array<T>} The array. - * @template T - */ -goog.array.rotate = function(array, n) { - goog.asserts.assert(array.length != null); - - if (array.length) { - n %= array.length; - if (n > 0) { - goog.array.ARRAY_PROTOTYPE_.unshift.apply(array, array.splice(-n, n)); - } else if (n < 0) { - goog.array.ARRAY_PROTOTYPE_.push.apply(array, array.splice(0, -n)); - } - } - return array; -}; - - -/** - * Moves one item of an array to a new position keeping the order of the rest - * of the items. Example use case: keeping a list of JavaScript objects - * synchronized with the corresponding list of DOM elements after one of the - * elements has been dragged to a new position. - * @param {!(Array|Arguments|{length:number})} arr The array to modify. - * @param {number} fromIndex Index of the item to move between 0 and - * {@code arr.length - 1}. - * @param {number} toIndex Target index between 0 and {@code arr.length - 1}. - */ -goog.array.moveItem = function(arr, fromIndex, toIndex) { - goog.asserts.assert(fromIndex >= 0 && fromIndex < arr.length); - goog.asserts.assert(toIndex >= 0 && toIndex < arr.length); - // Remove 1 item at fromIndex. - var removedItems = goog.array.ARRAY_PROTOTYPE_.splice.call(arr, fromIndex, 1); - // Insert the removed item at toIndex. - goog.array.ARRAY_PROTOTYPE_.splice.call(arr, toIndex, 0, removedItems[0]); - // We don't use goog.array.insertAt and goog.array.removeAt, because they're - // significantly slower than splice. -}; - - -/** - * Creates a new array for which the element at position i is an array of the - * ith element of the provided arrays. The returned array will only be as long - * as the shortest array provided; additional values are ignored. For example, - * the result of zipping [1, 2] and [3, 4, 5] is [[1,3], [2, 4]]. - * - * This is similar to the zip() function in Python. See {@link - * http://docs.python.org/library/functions.html#zip} - * - * @param {...!goog.array.ArrayLike} var_args Arrays to be combined. - * @return {!Array<!Array<?>>} A new array of arrays created from - * provided arrays. - */ -goog.array.zip = function(var_args) { - if (!arguments.length) { - return []; - } - var result = []; - for (var i = 0; true; i++) { - var value = []; - for (var j = 0; j < arguments.length; j++) { - var arr = arguments[j]; - // If i is larger than the array length, this is the shortest array. - if (i >= arr.length) { - return result; - } - value.push(arr[i]); - } - result.push(value); - } -}; - - -/** - * Shuffles the values in the specified array using the Fisher-Yates in-place - * shuffle (also known as the Knuth Shuffle). By default, calls Math.random() - * and so resets the state of that random number generator. Similarly, may reset - * the state of the any other specified random number generator. - * - * Runtime: O(n) - * - * @param {!Array<?>} arr The array to be shuffled. - * @param {function():number=} opt_randFn Optional random function to use for - * shuffling. - * Takes no arguments, and returns a random number on the interval [0, 1). - * Defaults to Math.random() using JavaScript's built-in Math library. - */ -goog.array.shuffle = function(arr, opt_randFn) { - var randFn = opt_randFn || Math.random; - - for (var i = arr.length - 1; i > 0; i--) { - // Choose a random array index in [0, i] (inclusive with i). - var j = Math.floor(randFn() * (i + 1)); - - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; - } -}; - - -/** - * Returns a new array of elements from arr, based on the indexes of elements - * provided by index_arr. For example, the result of index copying - * ['a', 'b', 'c'] with index_arr [1,0,0,2] is ['b', 'a', 'a', 'c']. - * - * @param {!Array<T>} arr The array to get a indexed copy from. - * @param {!Array<number>} index_arr An array of indexes to get from arr. - * @return {!Array<T>} A new array of elements from arr in index_arr order. - * @template T - */ -goog.array.copyByIndex = function(arr, index_arr) { - var result = []; - goog.array.forEach(index_arr, function(index) { - result.push(arr[index]); - }); - return result; -}; - -goog.provide('ol.array'); - -goog.require('goog.array'); -goog.require('goog.asserts'); - - -/** - * @param {Array.<number>} arr Array. - * @param {number} target Target. - * @return {number} Index. - */ -ol.array.binaryFindNearest = function(arr, target) { - var index = goog.array.binarySearch(arr, target, - /** - * @param {number} a A. - * @param {number} b B. - * @return {number} b minus a. - */ - function(a, b) { - return b - a; - }); - if (index >= 0) { - return index; - } else if (index == -1) { - return 0; - } else if (index == -arr.length - 1) { - return arr.length - 1; - } else { - var left = -index - 2; - var right = -index - 1; - if (arr[left] - target < target - arr[right]) { - return left; - } else { - return right; - } - } -}; - - -/** - * Whether the array contains the given object. - * @param {Array.<*>} arr The array to test for the presence of the element. - * @param {*} obj The object for which to test. - * @return {boolean} The object is in the array. - */ -ol.array.includes = function(arr, obj) { - return arr.indexOf(obj) >= 0; -}; - - -/** - * @param {Array.<number>} arr Array. - * @param {number} target Target. - * @param {number} direction 0 means return the nearest, > 0 - * means return the largest nearest, < 0 means return the - * smallest nearest. - * @return {number} Index. - */ -ol.array.linearFindNearest = function(arr, target, direction) { - var n = arr.length; - if (arr[0] <= target) { - return 0; - } else if (target <= arr[n - 1]) { - return n - 1; - } else { - var i; - if (direction > 0) { - for (i = 1; i < n; ++i) { - if (arr[i] < target) { - return i - 1; - } - } - } else if (direction < 0) { - for (i = 1; i < n; ++i) { - if (arr[i] <= target) { - return i; - } - } - } else { - for (i = 1; i < n; ++i) { - if (arr[i] == target) { - return i; - } else if (arr[i] < target) { - if (arr[i - 1] - target < target - arr[i]) { - return i - 1; - } else { - return i; - } - } - } - } - // We should never get here, but the compiler complains - // if it finds a path for which no number is returned. - goog.asserts.fail(); - return n - 1; - } -}; - - -/** - * @param {Array.<*>} arr Array. - * @param {number} begin Begin index. - * @param {number} end End index. - */ -ol.array.reverseSubArray = function(arr, begin, end) { - goog.asserts.assert(begin >= 0, - 'Array begin index should be equal to or greater than 0'); - goog.asserts.assert(end < arr.length, - 'Array end index should be less than the array length'); - while (begin < end) { - var tmp = arr[begin]; - arr[begin] = arr[end]; - arr[end] = tmp; - ++begin; - --end; - } -}; - -goog.provide('ol.ResolutionConstraint'); -goog.provide('ol.ResolutionConstraintType'); - -goog.require('ol.array'); -goog.require('ol.math'); - - -/** - * @typedef {function((number|undefined), number, number): (number|undefined)} - */ -ol.ResolutionConstraintType; - - -/** - * @param {Array.<number>} resolutions Resolutions. - * @return {ol.ResolutionConstraintType} Zoom function. - */ -ol.ResolutionConstraint.createSnapToResolutions = - function(resolutions) { - return ( - /** - * @param {number|undefined} resolution Resolution. - * @param {number} delta Delta. - * @param {number} direction Direction. - * @return {number|undefined} Resolution. - */ - function(resolution, delta, direction) { - if (resolution !== undefined) { - var z = - ol.array.linearFindNearest(resolutions, resolution, direction); - z = ol.math.clamp(z + delta, 0, resolutions.length - 1); - return resolutions[z]; - } else { - return undefined; - } - }); -}; - - -/** - * @param {number} power Power. - * @param {number} maxResolution Maximum resolution. - * @param {number=} opt_maxLevel Maximum level. - * @return {ol.ResolutionConstraintType} Zoom function. - */ -ol.ResolutionConstraint.createSnapToPower = - function(power, maxResolution, opt_maxLevel) { - return ( - /** - * @param {number|undefined} resolution Resolution. - * @param {number} delta Delta. - * @param {number} direction Direction. - * @return {number|undefined} Resolution. - */ - function(resolution, delta, direction) { - if (resolution !== undefined) { - var offset; - if (direction > 0) { - offset = 0; - } else if (direction < 0) { - offset = 1; - } else { - offset = 0.5; - } - var oldLevel = Math.floor( - Math.log(maxResolution / resolution) / Math.log(power) + offset); - var newLevel = Math.max(oldLevel + delta, 0); - if (opt_maxLevel !== undefined) { - newLevel = Math.min(newLevel, opt_maxLevel); - } - return maxResolution / Math.pow(power, newLevel); - } else { - return undefined; - } - }); -}; - -goog.provide('ol.RotationConstraint'); -goog.provide('ol.RotationConstraintType'); - -goog.require('ol.math'); - - -/** - * @typedef {function((number|undefined), number): (number|undefined)} - */ -ol.RotationConstraintType; - - -/** - * @param {number|undefined} rotation Rotation. - * @param {number} delta Delta. - * @return {number|undefined} Rotation. - */ -ol.RotationConstraint.disable = function(rotation, delta) { - if (rotation !== undefined) { - return 0; - } else { - return undefined; - } -}; - - -/** - * @param {number|undefined} rotation Rotation. - * @param {number} delta Delta. - * @return {number|undefined} Rotation. - */ -ol.RotationConstraint.none = function(rotation, delta) { - if (rotation !== undefined) { - return rotation + delta; - } else { - return undefined; - } -}; - - -/** - * @param {number} n N. - * @return {ol.RotationConstraintType} Rotation constraint. - */ -ol.RotationConstraint.createSnapToN = function(n) { - var theta = 2 * Math.PI / n; - return ( - /** - * @param {number|undefined} rotation Rotation. - * @param {number} delta Delta. - * @return {number|undefined} Rotation. - */ - function(rotation, delta) { - if (rotation !== undefined) { - rotation = Math.floor((rotation + delta) / theta + 0.5) * theta; - return rotation; - } else { - return undefined; - } - }); -}; - - -/** - * @param {number=} opt_tolerance Tolerance. - * @return {ol.RotationConstraintType} Rotation constraint. - */ -ol.RotationConstraint.createSnapToZero = function(opt_tolerance) { - var tolerance = opt_tolerance || ol.math.toRadians(5); - return ( - /** - * @param {number|undefined} rotation Rotation. - * @param {number} delta Delta. - * @return {number|undefined} Rotation. - */ - function(rotation, delta) { - if (rotation !== undefined) { - if (Math.abs(rotation + delta) <= tolerance) { - return 0; - } else { - return rotation + delta; - } - } else { - return undefined; - } - }); -}; - -goog.provide('ol.Constraints'); - -goog.require('ol.CenterConstraintType'); -goog.require('ol.ResolutionConstraintType'); -goog.require('ol.RotationConstraintType'); - - - -/** - * @constructor - * @param {ol.CenterConstraintType} centerConstraint Center constraint. - * @param {ol.ResolutionConstraintType} resolutionConstraint - * Resolution constraint. - * @param {ol.RotationConstraintType} rotationConstraint - * Rotation constraint. - */ -ol.Constraints = - function(centerConstraint, resolutionConstraint, rotationConstraint) { - - /** - * @type {ol.CenterConstraintType} - */ - this.center = centerConstraint; - - /** - * @type {ol.ResolutionConstraintType} - */ - this.resolution = resolutionConstraint; - - /** - * @type {ol.RotationConstraintType} - */ - this.rotation = rotationConstraint; - -}; - -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A global registry for entry points into a program, - * so that they can be instrumented. Each module should register their - * entry points with this registry. Designed to be compiled out - * if no instrumentation is requested. - * - * Entry points may be registered before or after a call to - * goog.debug.entryPointRegistry.monitorAll. If an entry point is registered - * later, the existing monitor will instrument the new entry point. - * - * @author nicksantos@google.com (Nick Santos) - */ - -goog.provide('goog.debug.EntryPointMonitor'); -goog.provide('goog.debug.entryPointRegistry'); - -goog.require('goog.asserts'); - - - -/** - * @interface - */ -goog.debug.EntryPointMonitor = function() {}; - - -/** - * Instruments a function. - * - * @param {!Function} fn A function to instrument. - * @return {!Function} The instrumented function. - */ -goog.debug.EntryPointMonitor.prototype.wrap; - - -/** - * Try to remove an instrumentation wrapper created by this monitor. - * If the function passed to unwrap is not a wrapper created by this - * monitor, then we will do nothing. - * - * Notice that some wrappers may not be unwrappable. For example, if other - * monitors have applied their own wrappers, then it will be impossible to - * unwrap them because their wrappers will have captured our wrapper. - * - * So it is important that entry points are unwrapped in the reverse - * order that they were wrapped. - * - * @param {!Function} fn A function to unwrap. - * @return {!Function} The unwrapped function, or {@code fn} if it was not - * a wrapped function created by this monitor. - */ -goog.debug.EntryPointMonitor.prototype.unwrap; - - -/** - * An array of entry point callbacks. - * @type {!Array<function(!Function)>} - * @private - */ -goog.debug.entryPointRegistry.refList_ = []; - - -/** - * Monitors that should wrap all the entry points. - * @type {!Array<!goog.debug.EntryPointMonitor>} - * @private - */ -goog.debug.entryPointRegistry.monitors_ = []; - - -/** - * Whether goog.debug.entryPointRegistry.monitorAll has ever been called. - * Checking this allows the compiler to optimize out the registrations. - * @type {boolean} - * @private - */ -goog.debug.entryPointRegistry.monitorsMayExist_ = false; - - -/** - * Register an entry point with this module. - * - * The entry point will be instrumented when a monitor is passed to - * goog.debug.entryPointRegistry.monitorAll. If this has already occurred, the - * entry point is instrumented immediately. - * - * @param {function(!Function)} callback A callback function which is called - * with a transforming function to instrument the entry point. The callback - * is responsible for wrapping the relevant entry point with the - * transforming function. - */ -goog.debug.entryPointRegistry.register = function(callback) { - // Don't use push(), so that this can be compiled out. - goog.debug.entryPointRegistry.refList_[ - goog.debug.entryPointRegistry.refList_.length] = callback; - // If no one calls monitorAll, this can be compiled out. - if (goog.debug.entryPointRegistry.monitorsMayExist_) { - var monitors = goog.debug.entryPointRegistry.monitors_; - for (var i = 0; i < monitors.length; i++) { - callback(goog.bind(monitors[i].wrap, monitors[i])); - } - } -}; - - -/** - * Configures a monitor to wrap all entry points. - * - * Entry points that have already been registered are immediately wrapped by - * the monitor. When an entry point is registered in the future, it will also - * be wrapped by the monitor when it is registered. - * - * @param {!goog.debug.EntryPointMonitor} monitor An entry point monitor. - */ -goog.debug.entryPointRegistry.monitorAll = function(monitor) { - goog.debug.entryPointRegistry.monitorsMayExist_ = true; - var transformer = goog.bind(monitor.wrap, monitor); - for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) { - goog.debug.entryPointRegistry.refList_[i](transformer); - } - goog.debug.entryPointRegistry.monitors_.push(monitor); -}; - - -/** - * Try to unmonitor all the entry points that have already been registered. If - * an entry point is registered in the future, it will not be wrapped by the - * monitor when it is registered. Note that this may fail if the entry points - * have additional wrapping. - * - * @param {!goog.debug.EntryPointMonitor} monitor The last monitor to wrap - * the entry points. - * @throws {Error} If the monitor is not the most recently configured monitor. - */ -goog.debug.entryPointRegistry.unmonitorAllIfPossible = function(monitor) { - var monitors = goog.debug.entryPointRegistry.monitors_; - goog.asserts.assert(monitor == monitors[monitors.length - 1], - 'Only the most recent monitor can be unwrapped.'); - var transformer = goog.bind(monitor.unwrap, monitor); - for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) { - goog.debug.entryPointRegistry.refList_[i](transformer); - } - monitors.length--; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities used by goog.labs.userAgent tools. These functions - * should not be used outside of goog.labs.userAgent.*. - * - * - * @author nnaze@google.com (Nathan Naze) - */ - -goog.provide('goog.labs.userAgent.util'); - -goog.require('goog.string'); - - -/** - * Gets the native userAgent string from navigator if it exists. - * If navigator or navigator.userAgent string is missing, returns an empty - * string. - * @return {string} - * @private - */ -goog.labs.userAgent.util.getNativeUserAgentString_ = function() { - var navigator = goog.labs.userAgent.util.getNavigator_(); - if (navigator) { - var userAgent = navigator.userAgent; - if (userAgent) { - return userAgent; - } - } - return ''; -}; - - -/** - * Getter for the native navigator. - * This is a separate function so it can be stubbed out in testing. - * @return {Navigator} - * @private - */ -goog.labs.userAgent.util.getNavigator_ = function() { - return goog.global.navigator; -}; - - -/** - * A possible override for applications which wish to not check - * navigator.userAgent but use a specified value for detection instead. - * @private {string} - */ -goog.labs.userAgent.util.userAgent_ = - goog.labs.userAgent.util.getNativeUserAgentString_(); - - -/** - * Applications may override browser detection on the built in - * navigator.userAgent object by setting this string. Set to null to use the - * browser object instead. - * @param {?string=} opt_userAgent The User-Agent override. - */ -goog.labs.userAgent.util.setUserAgent = function(opt_userAgent) { - goog.labs.userAgent.util.userAgent_ = opt_userAgent || - goog.labs.userAgent.util.getNativeUserAgentString_(); -}; - - -/** - * @return {string} The user agent string. - */ -goog.labs.userAgent.util.getUserAgent = function() { - return goog.labs.userAgent.util.userAgent_; -}; - - -/** - * @param {string} str - * @return {boolean} Whether the user agent contains the given string, ignoring - * case. - */ -goog.labs.userAgent.util.matchUserAgent = function(str) { - var userAgent = goog.labs.userAgent.util.getUserAgent(); - return goog.string.contains(userAgent, str); -}; - - -/** - * @param {string} str - * @return {boolean} Whether the user agent contains the given string. - */ -goog.labs.userAgent.util.matchUserAgentIgnoreCase = function(str) { - var userAgent = goog.labs.userAgent.util.getUserAgent(); - return goog.string.caseInsensitiveContains(userAgent, str); -}; - - -/** - * Parses the user agent into tuples for each section. - * @param {string} userAgent - * @return {!Array<!Array<string>>} Tuples of key, version, and the contents - * of the parenthetical. - */ -goog.labs.userAgent.util.extractVersionTuples = function(userAgent) { - // Matches each section of a user agent string. - // Example UA: - // Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) - // AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405 - // This has three version tuples: Mozilla, AppleWebKit, and Mobile. - - var versionRegExp = new RegExp( - // Key. Note that a key may have a space. - // (i.e. 'Mobile Safari' in 'Mobile Safari/5.0') - '(\\w[\\w ]+)' + - - '/' + // slash - '([^\\s]+)' + // version (i.e. '5.0b') - '\\s*' + // whitespace - '(?:\\((.*?)\\))?', // parenthetical info. parentheses not matched. - 'g'); - - var data = []; - var match; - - // Iterate and collect the version tuples. Each iteration will be the - // next regex match. - while (match = versionRegExp.exec(userAgent)) { - data.push([ - match[1], // key - match[2], // value - // || undefined as this is not undefined in IE7 and IE8 - match[3] || undefined // info - ]); - } - - return data; -}; - - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for manipulating objects/maps/hashes. - * @author arv@google.com (Erik Arvidsson) - */ - -goog.provide('goog.object'); - - -/** - * Calls a function for each element in an object/map/hash. - * - * @param {Object<K,V>} obj The object over which to iterate. - * @param {function(this:T,V,?,Object<K,V>):?} f The function to call - * for every element. This function takes 3 arguments (the value, the - * key and the object) and the return value is ignored. - * @param {T=} opt_obj This is used as the 'this' object within f. - * @template T,K,V - */ -goog.object.forEach = function(obj, f, opt_obj) { - for (var key in obj) { - f.call(opt_obj, obj[key], key, obj); - } -}; - - -/** - * Calls a function for each element in an object/map/hash. If that call returns - * true, adds the element to a new object. - * - * @param {Object<K,V>} obj The object over which to iterate. - * @param {function(this:T,V,?,Object<K,V>):boolean} f The function to call - * for every element. This - * function takes 3 arguments (the value, the key and the object) - * and should return a boolean. If the return value is true the - * element is added to the result object. If it is false the - * element is not included. - * @param {T=} opt_obj This is used as the 'this' object within f. - * @return {!Object<K,V>} a new object in which only elements that passed the - * test are present. - * @template T,K,V - */ -goog.object.filter = function(obj, f, opt_obj) { - var res = {}; - for (var key in obj) { - if (f.call(opt_obj, obj[key], key, obj)) { - res[key] = obj[key]; - } - } - return res; -}; - - -/** - * For every element in an object/map/hash calls a function and inserts the - * result into a new object. - * - * @param {Object<K,V>} obj The object over which to iterate. - * @param {function(this:T,V,?,Object<K,V>):R} f The function to call - * for every element. This function - * takes 3 arguments (the value, the key and the object) - * and should return something. The result will be inserted - * into a new object. - * @param {T=} opt_obj This is used as the 'this' object within f. - * @return {!Object<K,R>} a new object with the results from f. - * @template T,K,V,R - */ -goog.object.map = function(obj, f, opt_obj) { - var res = {}; - for (var key in obj) { - res[key] = f.call(opt_obj, obj[key], key, obj); - } - return res; -}; - - -/** - * Calls a function for each element in an object/map/hash. If any - * call returns true, returns true (without checking the rest). If - * all calls return false, returns false. - * - * @param {Object<K,V>} obj The object to check. - * @param {function(this:T,V,?,Object<K,V>):boolean} f The function to - * call for every element. This function - * takes 3 arguments (the value, the key and the object) and should - * return a boolean. - * @param {T=} opt_obj This is used as the 'this' object within f. - * @return {boolean} true if any element passes the test. - * @template T,K,V - */ -goog.object.some = function(obj, f, opt_obj) { - for (var key in obj) { - if (f.call(opt_obj, obj[key], key, obj)) { - return true; - } - } - return false; -}; - - -/** - * Calls a function for each element in an object/map/hash. If - * all calls return true, returns true. If any call returns false, returns - * false at this point and does not continue to check the remaining elements. - * - * @param {Object<K,V>} obj The object to check. - * @param {?function(this:T,V,?,Object<K,V>):boolean} f The function to - * call for every element. This function - * takes 3 arguments (the value, the key and the object) and should - * return a boolean. - * @param {T=} opt_obj This is used as the 'this' object within f. - * @return {boolean} false if any element fails the test. - * @template T,K,V - */ -goog.object.every = function(obj, f, opt_obj) { - for (var key in obj) { - if (!f.call(opt_obj, obj[key], key, obj)) { - return false; - } - } - return true; -}; - - -/** - * Returns the number of key-value pairs in the object map. - * - * @param {Object} obj The object for which to get the number of key-value - * pairs. - * @return {number} The number of key-value pairs in the object map. - */ -goog.object.getCount = function(obj) { - // JS1.5 has __count__ but it has been deprecated so it raises a warning... - // in other words do not use. Also __count__ only includes the fields on the - // actual object and not in the prototype chain. - var rv = 0; - for (var key in obj) { - rv++; - } - return rv; -}; - - -/** - * Returns one key from the object map, if any exists. - * For map literals the returned key will be the first one in most of the - * browsers (a know exception is Konqueror). - * - * @param {Object} obj The object to pick a key from. - * @return {string|undefined} The key or undefined if the object is empty. - */ -goog.object.getAnyKey = function(obj) { - for (var key in obj) { - return key; - } -}; - - -/** - * Returns one value from the object map, if any exists. - * For map literals the returned value will be the first one in most of the - * browsers (a know exception is Konqueror). - * - * @param {Object<K,V>} obj The object to pick a value from. - * @return {V|undefined} The value or undefined if the object is empty. - * @template K,V - */ -goog.object.getAnyValue = function(obj) { - for (var key in obj) { - return obj[key]; - } -}; - - -/** - * Whether the object/hash/map contains the given object as a value. - * An alias for goog.object.containsValue(obj, val). - * - * @param {Object<K,V>} obj The object in which to look for val. - * @param {V} val The object for which to check. - * @return {boolean} true if val is present. - * @template K,V - */ -goog.object.contains = function(obj, val) { - return goog.object.containsValue(obj, val); -}; - - -/** - * Returns the values of the object/map/hash. - * - * @param {Object<K,V>} obj The object from which to get the values. - * @return {!Array<V>} The values in the object/map/hash. - * @template K,V - */ -goog.object.getValues = function(obj) { - var res = []; - var i = 0; - for (var key in obj) { - res[i++] = obj[key]; - } - return res; -}; - - -/** - * Returns the keys of the object/map/hash. - * - * @param {Object} obj The object from which to get the keys. - * @return {!Array<string>} Array of property keys. - */ -goog.object.getKeys = function(obj) { - var res = []; - var i = 0; - for (var key in obj) { - res[i++] = key; - } - return res; -}; - - -/** - * Get a value from an object multiple levels deep. This is useful for - * pulling values from deeply nested objects, such as JSON responses. - * Example usage: getValueByKeys(jsonObj, 'foo', 'entries', 3) - * - * @param {!Object} obj An object to get the value from. Can be array-like. - * @param {...(string|number|!Array<number|string>)} var_args A number of keys - * (as strings, or numbers, for array-like objects). Can also be - * specified as a single array of keys. - * @return {*} The resulting value. If, at any point, the value for a key - * is undefined, returns undefined. - */ -goog.object.getValueByKeys = function(obj, var_args) { - var isArrayLike = goog.isArrayLike(var_args); - var keys = isArrayLike ? var_args : arguments; - - // Start with the 2nd parameter for the variable parameters syntax. - for (var i = isArrayLike ? 0 : 1; i < keys.length; i++) { - obj = obj[keys[i]]; - if (!goog.isDef(obj)) { - break; - } - } - - return obj; -}; - - -/** - * Whether the object/map/hash contains the given key. - * - * @param {Object} obj The object in which to look for key. - * @param {*} key The key for which to check. - * @return {boolean} true If the map contains the key. - */ -goog.object.containsKey = function(obj, key) { - return key in obj; -}; - - -/** - * Whether the object/map/hash contains the given value. This is O(n). - * - * @param {Object<K,V>} obj The object in which to look for val. - * @param {V} val The value for which to check. - * @return {boolean} true If the map contains the value. - * @template K,V - */ -goog.object.containsValue = function(obj, val) { - for (var key in obj) { - if (obj[key] == val) { - return true; - } - } - return false; -}; - - -/** - * Searches an object for an element that satisfies the given condition and - * returns its key. - * @param {Object<K,V>} obj The object to search in. - * @param {function(this:T,V,string,Object<K,V>):boolean} f The - * function to call for every element. Takes 3 arguments (the value, - * the key and the object) and should return a boolean. - * @param {T=} opt_this An optional "this" context for the function. - * @return {string|undefined} The key of an element for which the function - * returns true or undefined if no such element is found. - * @template T,K,V - */ -goog.object.findKey = function(obj, f, opt_this) { - for (var key in obj) { - if (f.call(opt_this, obj[key], key, obj)) { - return key; - } - } - return undefined; -}; - - -/** - * Searches an object for an element that satisfies the given condition and - * returns its value. - * @param {Object<K,V>} obj The object to search in. - * @param {function(this:T,V,string,Object<K,V>):boolean} f The function - * to call for every element. Takes 3 arguments (the value, the key - * and the object) and should return a boolean. - * @param {T=} opt_this An optional "this" context for the function. - * @return {V} The value of an element for which the function returns true or - * undefined if no such element is found. - * @template T,K,V - */ -goog.object.findValue = function(obj, f, opt_this) { - var key = goog.object.findKey(obj, f, opt_this); - return key && obj[key]; -}; - - -/** - * Whether the object/map/hash is empty. - * - * @param {Object} obj The object to test. - * @return {boolean} true if obj is empty. - */ -goog.object.isEmpty = function(obj) { - for (var key in obj) { - return false; - } - return true; -}; - - -/** - * Removes all key value pairs from the object/map/hash. - * - * @param {Object} obj The object to clear. - */ -goog.object.clear = function(obj) { - for (var i in obj) { - delete obj[i]; - } -}; - - -/** - * Removes a key-value pair based on the key. - * - * @param {Object} obj The object from which to remove the key. - * @param {*} key The key to remove. - * @return {boolean} Whether an element was removed. - */ -goog.object.remove = function(obj, key) { - var rv; - if ((rv = key in obj)) { - delete obj[key]; - } - return rv; -}; - - -/** - * Adds a key-value pair to the object. Throws an exception if the key is - * already in use. Use set if you want to change an existing pair. - * - * @param {Object<K,V>} obj The object to which to add the key-value pair. - * @param {string} key The key to add. - * @param {V} val The value to add. - * @template K,V - */ -goog.object.add = function(obj, key, val) { - if (key in obj) { - throw Error('The object already contains the key "' + key + '"'); - } - goog.object.set(obj, key, val); -}; - - -/** - * Returns the value for the given key. - * - * @param {Object<K,V>} obj The object from which to get the value. - * @param {string} key The key for which to get the value. - * @param {R=} opt_val The value to return if no item is found for the given - * key (default is undefined). - * @return {V|R|undefined} The value for the given key. - * @template K,V,R - */ -goog.object.get = function(obj, key, opt_val) { - if (key in obj) { - return obj[key]; - } - return opt_val; -}; - - -/** - * Adds a key-value pair to the object/map/hash. - * - * @param {Object<K,V>} obj The object to which to add the key-value pair. - * @param {string} key The key to add. - * @param {V} value The value to add. - * @template K,V - */ -goog.object.set = function(obj, key, value) { - obj[key] = value; -}; - - -/** - * Adds a key-value pair to the object/map/hash if it doesn't exist yet. - * - * @param {Object<K,V>} obj The object to which to add the key-value pair. - * @param {string} key The key to add. - * @param {V} value The value to add if the key wasn't present. - * @return {V} The value of the entry at the end of the function. - * @template K,V - */ -goog.object.setIfUndefined = function(obj, key, value) { - return key in obj ? obj[key] : (obj[key] = value); -}; - - -/** - * Sets a key and value to an object if the key is not set. The value will be - * the return value of the given function. If the key already exists, the - * object will not be changed and the function will not be called (the function - * will be lazily evaluated -- only called if necessary). - * - * This function is particularly useful for use with a map used a as a cache. - * - * @param {!Object<K,V>} obj The object to which to add the key-value pair. - * @param {string} key The key to add. - * @param {function():V} f The value to add if the key wasn't present. - * @return {V} The value of the entry at the end of the function. - * @template K,V - */ -goog.object.setWithReturnValueIfNotSet = function(obj, key, f) { - if (key in obj) { - return obj[key]; - } - - var val = f(); - obj[key] = val; - return val; -}; - - -/** - * Compares two objects for equality using === on the values. - * - * @param {!Object<K,V>} a - * @param {!Object<K,V>} b - * @return {boolean} - * @template K,V - */ -goog.object.equals = function(a, b) { - for (var k in a) { - if (!(k in b) || a[k] !== b[k]) { - return false; - } - } - for (var k in b) { - if (!(k in a)) { - return false; - } - } - return true; -}; - - -/** - * Does a flat clone of the object. - * - * @param {Object<K,V>} obj Object to clone. - * @return {!Object<K,V>} Clone of the input object. - * @template K,V - */ -goog.object.clone = function(obj) { - // We cannot use the prototype trick because a lot of methods depend on where - // the actual key is set. - - var res = {}; - for (var key in obj) { - res[key] = obj[key]; - } - return res; - // We could also use goog.mixin but I wanted this to be independent from that. -}; - - -/** - * Clones a value. The input may be an Object, Array, or basic type. Objects and - * arrays will be cloned recursively. - * - * WARNINGS: - * <code>goog.object.unsafeClone</code> does not detect reference loops. Objects - * that refer to themselves will cause infinite recursion. - * - * <code>goog.object.unsafeClone</code> is unaware of unique identifiers, and - * copies UIDs created by <code>getUid</code> into cloned results. - * - * @param {*} obj The value to clone. - * @return {*} A clone of the input value. - */ -goog.object.unsafeClone = function(obj) { - var type = goog.typeOf(obj); - if (type == 'object' || type == 'array') { - if (goog.isFunction(obj.clone)) { - return obj.clone(); - } - var clone = type == 'array' ? [] : {}; - for (var key in obj) { - clone[key] = goog.object.unsafeClone(obj[key]); - } - return clone; - } - - return obj; -}; - - -/** - * Returns a new object in which all the keys and values are interchanged - * (keys become values and values become keys). If multiple keys map to the - * same value, the chosen transposed value is implementation-dependent. - * - * @param {Object} obj The object to transpose. - * @return {!Object} The transposed object. - */ -goog.object.transpose = function(obj) { - var transposed = {}; - for (var key in obj) { - transposed[obj[key]] = key; - } - return transposed; -}; - - -/** - * The names of the fields that are defined on Object.prototype. - * @type {Array<string>} - * @private - */ -goog.object.PROTOTYPE_FIELDS_ = [ - 'constructor', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'toLocaleString', - 'toString', - 'valueOf' -]; - - -/** - * Extends an object with another object. - * This operates 'in-place'; it does not create a new Object. - * - * Example: - * var o = {}; - * goog.object.extend(o, {a: 0, b: 1}); - * o; // {a: 0, b: 1} - * goog.object.extend(o, {b: 2, c: 3}); - * o; // {a: 0, b: 2, c: 3} - * - * @param {Object} target The object to modify. Existing properties will be - * overwritten if they are also present in one of the objects in - * {@code var_args}. - * @param {...Object} var_args The objects from which values will be copied. - */ -goog.object.extend = function(target, var_args) { - var key, source; - for (var i = 1; i < arguments.length; i++) { - source = arguments[i]; - for (key in source) { - target[key] = source[key]; - } - - // For IE the for-in-loop does not contain any properties that are not - // enumerable on the prototype object (for example isPrototypeOf from - // Object.prototype) and it will also not include 'replace' on objects that - // extend String and change 'replace' (not that it is common for anyone to - // extend anything except Object). - - for (var j = 0; j < goog.object.PROTOTYPE_FIELDS_.length; j++) { - key = goog.object.PROTOTYPE_FIELDS_[j]; - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } -}; - - -/** - * Creates a new object built from the key-value pairs provided as arguments. - * @param {...*} var_args If only one argument is provided and it is an array - * then this is used as the arguments, otherwise even arguments are used as - * the property names and odd arguments are used as the property values. - * @return {!Object} The new object. - * @throws {Error} If there are uneven number of arguments or there is only one - * non array argument. - */ -goog.object.create = function(var_args) { - var argLength = arguments.length; - if (argLength == 1 && goog.isArray(arguments[0])) { - return goog.object.create.apply(null, arguments[0]); - } - - if (argLength % 2) { - throw Error('Uneven number of arguments'); - } - - var rv = {}; - for (var i = 0; i < argLength; i += 2) { - rv[arguments[i]] = arguments[i + 1]; - } - return rv; -}; - - -/** - * Creates a new object where the property names come from the arguments but - * the value is always set to true - * @param {...*} var_args If only one argument is provided and it is an array - * then this is used as the arguments, otherwise the arguments are used - * as the property names. - * @return {!Object} The new object. - */ -goog.object.createSet = function(var_args) { - var argLength = arguments.length; - if (argLength == 1 && goog.isArray(arguments[0])) { - return goog.object.createSet.apply(null, arguments[0]); - } - - var rv = {}; - for (var i = 0; i < argLength; i++) { - rv[arguments[i]] = true; - } - return rv; -}; - - -/** - * Creates an immutable view of the underlying object, if the browser - * supports immutable objects. - * - * In default mode, writes to this view will fail silently. In strict mode, - * they will throw an error. - * - * @param {!Object<K,V>} obj An object. - * @return {!Object<K,V>} An immutable view of that object, or the - * original object if this browser does not support immutables. - * @template K,V - */ -goog.object.createImmutableView = function(obj) { - var result = obj; - if (Object.isFrozen && !Object.isFrozen(obj)) { - result = Object.create(obj); - Object.freeze(result); - } - return result; -}; - - -/** - * @param {!Object} obj An object. - * @return {boolean} Whether this is an immutable view of the object. - */ -goog.object.isImmutableView = function(obj) { - return !!Object.isFrozen && Object.isFrozen(obj); -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Closure user agent detection (Browser). - * @see <a href="http://www.useragentstring.com/">User agent strings</a> - * For more information on rendering engine, platform, or device see the other - * sub-namespaces in goog.labs.userAgent, goog.labs.userAgent.platform, - * goog.labs.userAgent.device respectively.) - * - * @author martone@google.com (Andy Martone) - */ - -goog.provide('goog.labs.userAgent.browser'); - -goog.require('goog.array'); -goog.require('goog.labs.userAgent.util'); -goog.require('goog.object'); -goog.require('goog.string'); - - -// TODO(nnaze): Refactor to remove excessive exclusion logic in matching -// functions. - - -/** - * @return {boolean} Whether the user's browser is Opera. - * @private - */ -goog.labs.userAgent.browser.matchOpera_ = function() { - return goog.labs.userAgent.util.matchUserAgent('Opera') || - goog.labs.userAgent.util.matchUserAgent('OPR'); -}; - - -/** - * @return {boolean} Whether the user's browser is IE. - * @private - */ -goog.labs.userAgent.browser.matchIE_ = function() { - return goog.labs.userAgent.util.matchUserAgent('Trident') || - goog.labs.userAgent.util.matchUserAgent('MSIE'); -}; - - -/** - * @return {boolean} Whether the user's browser is Edge. - * @private - */ -goog.labs.userAgent.browser.matchEdge_ = function() { - return goog.labs.userAgent.util.matchUserAgent('Edge'); -}; - - -/** - * @return {boolean} Whether the user's browser is Firefox. - * @private - */ -goog.labs.userAgent.browser.matchFirefox_ = function() { - return goog.labs.userAgent.util.matchUserAgent('Firefox'); -}; - - -/** - * @return {boolean} Whether the user's browser is Safari. - * @private - */ -goog.labs.userAgent.browser.matchSafari_ = function() { - return goog.labs.userAgent.util.matchUserAgent('Safari') && - !(goog.labs.userAgent.browser.matchChrome_() || - goog.labs.userAgent.browser.matchCoast_() || - goog.labs.userAgent.browser.matchOpera_() || - goog.labs.userAgent.browser.matchEdge_() || - goog.labs.userAgent.browser.isSilk() || - goog.labs.userAgent.util.matchUserAgent('Android')); -}; - - -/** - * @return {boolean} Whether the user's browser is Coast (Opera's Webkit-based - * iOS browser). - * @private - */ -goog.labs.userAgent.browser.matchCoast_ = function() { - return goog.labs.userAgent.util.matchUserAgent('Coast'); -}; - - -/** - * @return {boolean} Whether the user's browser is iOS Webview. - * @private - */ -goog.labs.userAgent.browser.matchIosWebview_ = function() { - // iOS Webview does not show up as Chrome or Safari. Also check for Opera's - // WebKit-based iOS browser, Coast. - return (goog.labs.userAgent.util.matchUserAgent('iPad') || - goog.labs.userAgent.util.matchUserAgent('iPhone')) && - !goog.labs.userAgent.browser.matchSafari_() && - !goog.labs.userAgent.browser.matchChrome_() && - !goog.labs.userAgent.browser.matchCoast_() && - goog.labs.userAgent.util.matchUserAgent('AppleWebKit'); -}; - - -/** - * @return {boolean} Whether the user's browser is Chrome. - * @private - */ -goog.labs.userAgent.browser.matchChrome_ = function() { - return (goog.labs.userAgent.util.matchUserAgent('Chrome') || - goog.labs.userAgent.util.matchUserAgent('CriOS')) && - !goog.labs.userAgent.browser.matchOpera_() && - !goog.labs.userAgent.browser.matchEdge_(); -}; - - -/** - * @return {boolean} Whether the user's browser is the Android browser. - * @private - */ -goog.labs.userAgent.browser.matchAndroidBrowser_ = function() { - // Android can appear in the user agent string for Chrome on Android. - // This is not the Android standalone browser if it does. - return goog.labs.userAgent.util.matchUserAgent('Android') && - !(goog.labs.userAgent.browser.isChrome() || - goog.labs.userAgent.browser.isFirefox() || - goog.labs.userAgent.browser.isOpera() || - goog.labs.userAgent.browser.isSilk()); -}; - - -/** - * @return {boolean} Whether the user's browser is Opera. - */ -goog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_; - - -/** - * @return {boolean} Whether the user's browser is IE. - */ -goog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_; - - -/** - * @return {boolean} Whether the user's browser is Edge. - */ -goog.labs.userAgent.browser.isEdge = goog.labs.userAgent.browser.matchEdge_; - - -/** - * @return {boolean} Whether the user's browser is Firefox. - */ -goog.labs.userAgent.browser.isFirefox = - goog.labs.userAgent.browser.matchFirefox_; - - -/** - * @return {boolean} Whether the user's browser is Safari. - */ -goog.labs.userAgent.browser.isSafari = - goog.labs.userAgent.browser.matchSafari_; - - -/** - * @return {boolean} Whether the user's browser is Coast (Opera's Webkit-based - * iOS browser). - */ -goog.labs.userAgent.browser.isCoast = - goog.labs.userAgent.browser.matchCoast_; - - -/** - * @return {boolean} Whether the user's browser is iOS Webview. - */ -goog.labs.userAgent.browser.isIosWebview = - goog.labs.userAgent.browser.matchIosWebview_; - - -/** - * @return {boolean} Whether the user's browser is Chrome. - */ -goog.labs.userAgent.browser.isChrome = - goog.labs.userAgent.browser.matchChrome_; - - -/** - * @return {boolean} Whether the user's browser is the Android browser. - */ -goog.labs.userAgent.browser.isAndroidBrowser = - goog.labs.userAgent.browser.matchAndroidBrowser_; - - -/** - * For more information, see: - * http://docs.aws.amazon.com/silk/latest/developerguide/user-agent.html - * @return {boolean} Whether the user's browser is Silk. - */ -goog.labs.userAgent.browser.isSilk = function() { - return goog.labs.userAgent.util.matchUserAgent('Silk'); -}; - - -/** - * @return {string} The browser version or empty string if version cannot be - * determined. Note that for Internet Explorer, this returns the version of - * the browser, not the version of the rendering engine. (IE 8 in - * compatibility mode will return 8.0 rather than 7.0. To determine the - * rendering engine version, look at document.documentMode instead. See - * http://msdn.microsoft.com/en-us/library/cc196988(v=vs.85).aspx for more - * details.) - */ -goog.labs.userAgent.browser.getVersion = function() { - var userAgentString = goog.labs.userAgent.util.getUserAgent(); - // Special case IE since IE's version is inside the parenthesis and - // without the '/'. - if (goog.labs.userAgent.browser.isIE()) { - return goog.labs.userAgent.browser.getIEVersion_(userAgentString); - } - - var versionTuples = goog.labs.userAgent.util.extractVersionTuples( - userAgentString); - - // Construct a map for easy lookup. - var versionMap = {}; - goog.array.forEach(versionTuples, function(tuple) { - // Note that the tuple is of length three, but we only care about the - // first two. - var key = tuple[0]; - var value = tuple[1]; - versionMap[key] = value; - }); - - var versionMapHasKey = goog.partial(goog.object.containsKey, versionMap); - - // Gives the value with the first key it finds, otherwise empty string. - function lookUpValueWithKeys(keys) { - var key = goog.array.find(keys, versionMapHasKey); - return versionMap[key] || ''; - } - - // Check Opera before Chrome since Opera 15+ has "Chrome" in the string. - // See - // http://my.opera.com/ODIN/blog/2013/07/15/opera-user-agent-strings-opera-15-and-beyond - if (goog.labs.userAgent.browser.isOpera()) { - // Opera 10 has Version/10.0 but Opera/9.8, so look for "Version" first. - // Opera uses 'OPR' for more recent UAs. - return lookUpValueWithKeys(['Version', 'Opera', 'OPR']); - } - - // Check Edge before Chrome since it has Chrome in the string. - if (goog.labs.userAgent.browser.isEdge()) { - return lookUpValueWithKeys(['Edge']); - } - - if (goog.labs.userAgent.browser.isChrome()) { - return lookUpValueWithKeys(['Chrome', 'CriOS']); - } - - // Usually products browser versions are in the third tuple after "Mozilla" - // and the engine. - var tuple = versionTuples[2]; - return tuple && tuple[1] || ''; -}; - - -/** - * @param {string|number} version The version to check. - * @return {boolean} Whether the browser version is higher or the same as the - * given version. - */ -goog.labs.userAgent.browser.isVersionOrHigher = function(version) { - return goog.string.compareVersions(goog.labs.userAgent.browser.getVersion(), - version) >= 0; -}; - - -/** - * Determines IE version. More information: - * http://msdn.microsoft.com/en-us/library/ie/bg182625(v=vs.85).aspx#uaString - * http://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx - * http://blogs.msdn.com/b/ie/archive/2010/03/23/introducing-ie9-s-user-agent-string.aspx - * http://blogs.msdn.com/b/ie/archive/2009/01/09/the-internet-explorer-8-user-agent-string-updated-edition.aspx - * - * @param {string} userAgent the User-Agent. - * @return {string} - * @private - */ -goog.labs.userAgent.browser.getIEVersion_ = function(userAgent) { - // IE11 may identify itself as MSIE 9.0 or MSIE 10.0 due to an IE 11 upgrade - // bug. Example UA: - // Mozilla/5.0 (MSIE 9.0; Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) - // like Gecko. - // See http://www.whatismybrowser.com/developers/unknown-user-agent-fragments. - var rv = /rv: *([\d\.]*)/.exec(userAgent); - if (rv && rv[1]) { - return rv[1]; - } - - var version = ''; - var msie = /MSIE +([\d\.]+)/.exec(userAgent); - if (msie && msie[1]) { - // IE in compatibility mode usually identifies itself as MSIE 7.0; in this - // case, use the Trident version to determine the version of IE. For more - // details, see the links above. - var tridentVersion = /Trident\/(\d.\d)/.exec(userAgent); - if (msie[1] == '7.0') { - if (tridentVersion && tridentVersion[1]) { - switch (tridentVersion[1]) { - case '4.0': - version = '8.0'; - break; - case '5.0': - version = '9.0'; - break; - case '6.0': - version = '10.0'; - break; - case '7.0': - version = '11.0'; - break; - } - } else { - version = '7.0'; - } - } else { - version = msie[1]; - } - } - return version; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Closure user agent detection. - * @see http://en.wikipedia.org/wiki/User_agent - * For more information on browser brand, platform, or device see the other - * sub-namespaces in goog.labs.userAgent (browser, platform, and device). - * - */ - -goog.provide('goog.labs.userAgent.engine'); - -goog.require('goog.array'); -goog.require('goog.labs.userAgent.util'); -goog.require('goog.string'); - - -/** - * @return {boolean} Whether the rendering engine is Presto. - */ -goog.labs.userAgent.engine.isPresto = function() { - return goog.labs.userAgent.util.matchUserAgent('Presto'); -}; - - -/** - * @return {boolean} Whether the rendering engine is Trident. - */ -goog.labs.userAgent.engine.isTrident = function() { - // IE only started including the Trident token in IE8. - return goog.labs.userAgent.util.matchUserAgent('Trident') || - goog.labs.userAgent.util.matchUserAgent('MSIE'); -}; - - -/** - * @return {boolean} Whether the rendering engine is Edge. - */ -goog.labs.userAgent.engine.isEdge = function() { - return goog.labs.userAgent.util.matchUserAgent('Edge'); -}; - - -/** - * @return {boolean} Whether the rendering engine is WebKit. - */ -goog.labs.userAgent.engine.isWebKit = function() { - return goog.labs.userAgent.util.matchUserAgentIgnoreCase('WebKit') && - !goog.labs.userAgent.engine.isEdge(); -}; - - -/** - * @return {boolean} Whether the rendering engine is Gecko. - */ -goog.labs.userAgent.engine.isGecko = function() { - return goog.labs.userAgent.util.matchUserAgent('Gecko') && - !goog.labs.userAgent.engine.isWebKit() && - !goog.labs.userAgent.engine.isTrident() && - !goog.labs.userAgent.engine.isEdge(); -}; - - -/** - * @return {string} The rendering engine's version or empty string if version - * can't be determined. - */ -goog.labs.userAgent.engine.getVersion = function() { - var userAgentString = goog.labs.userAgent.util.getUserAgent(); - if (userAgentString) { - var tuples = goog.labs.userAgent.util.extractVersionTuples( - userAgentString); - - var engineTuple = goog.labs.userAgent.engine.getEngineTuple_(tuples); - if (engineTuple) { - // In Gecko, the version string is either in the browser info or the - // Firefox version. See Gecko user agent string reference: - // http://goo.gl/mULqa - if (engineTuple[0] == 'Gecko') { - return goog.labs.userAgent.engine.getVersionForKey_( - tuples, 'Firefox'); - } - - return engineTuple[1]; - } - - // MSIE has only one version identifier, and the Trident version is - // specified in the parenthetical. IE Edge is covered in the engine tuple - // detection. - var browserTuple = tuples[0]; - var info; - if (browserTuple && (info = browserTuple[2])) { - var match = /Trident\/([^\s;]+)/.exec(info); - if (match) { - return match[1]; - } - } - } - return ''; -}; - - -/** - * @param {!Array<!Array<string>>} tuples Extracted version tuples. - * @return {!Array<string>|undefined} The engine tuple or undefined if not - * found. - * @private - */ -goog.labs.userAgent.engine.getEngineTuple_ = function(tuples) { - if (!goog.labs.userAgent.engine.isEdge()) { - return tuples[1]; - } - for (var i = 0; i < tuples.length; i++) { - var tuple = tuples[i]; - if (tuple[0] == 'Edge') { - return tuple; - } - } -}; - - -/** - * @param {string|number} version The version to check. - * @return {boolean} Whether the rendering engine version is higher or the same - * as the given version. - */ -goog.labs.userAgent.engine.isVersionOrHigher = function(version) { - return goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(), - version) >= 0; -}; - - -/** - * @param {!Array<!Array<string>>} tuples Version tuples. - * @param {string} key The key to look for. - * @return {string} The version string of the given key, if present. - * Otherwise, the empty string. - * @private - */ -goog.labs.userAgent.engine.getVersionForKey_ = function(tuples, key) { - // TODO(nnaze): Move to util if useful elsewhere. - - var pair = goog.array.find(tuples, function(pair) { - return key == pair[0]; - }); - - return pair && pair[1] || ''; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Closure user agent platform detection. - * @see <a href="http://www.useragentstring.com/">User agent strings</a> - * For more information on browser brand, rendering engine, or device see the - * other sub-namespaces in goog.labs.userAgent (browser, engine, and device - * respectively). - * - */ - -goog.provide('goog.labs.userAgent.platform'); - -goog.require('goog.labs.userAgent.util'); -goog.require('goog.string'); - - -/** - * @return {boolean} Whether the platform is Android. - */ -goog.labs.userAgent.platform.isAndroid = function() { - return goog.labs.userAgent.util.matchUserAgent('Android'); -}; - - -/** - * @return {boolean} Whether the platform is iPod. - */ -goog.labs.userAgent.platform.isIpod = function() { - return goog.labs.userAgent.util.matchUserAgent('iPod'); -}; - - -/** - * @return {boolean} Whether the platform is iPhone. - */ -goog.labs.userAgent.platform.isIphone = function() { - return goog.labs.userAgent.util.matchUserAgent('iPhone') && - !goog.labs.userAgent.util.matchUserAgent('iPod') && - !goog.labs.userAgent.util.matchUserAgent('iPad'); -}; - - -/** - * @return {boolean} Whether the platform is iPad. - */ -goog.labs.userAgent.platform.isIpad = function() { - return goog.labs.userAgent.util.matchUserAgent('iPad'); -}; - - -/** - * @return {boolean} Whether the platform is iOS. - */ -goog.labs.userAgent.platform.isIos = function() { - return goog.labs.userAgent.platform.isIphone() || - goog.labs.userAgent.platform.isIpad() || - goog.labs.userAgent.platform.isIpod(); -}; - - -/** - * @return {boolean} Whether the platform is Mac. - */ -goog.labs.userAgent.platform.isMacintosh = function() { - return goog.labs.userAgent.util.matchUserAgent('Macintosh'); -}; - - -/** - * Note: ChromeOS is not considered to be Linux as it does not report itself - * as Linux in the user agent string. - * @return {boolean} Whether the platform is Linux. - */ -goog.labs.userAgent.platform.isLinux = function() { - return goog.labs.userAgent.util.matchUserAgent('Linux'); -}; - - -/** - * @return {boolean} Whether the platform is Windows. - */ -goog.labs.userAgent.platform.isWindows = function() { - return goog.labs.userAgent.util.matchUserAgent('Windows'); -}; - - -/** - * @return {boolean} Whether the platform is ChromeOS. - */ -goog.labs.userAgent.platform.isChromeOS = function() { - return goog.labs.userAgent.util.matchUserAgent('CrOS'); -}; - - -/** - * The version of the platform. We only determine the version for Windows, - * Mac, and Chrome OS. It doesn't make much sense on Linux. For Windows, we only - * look at the NT version. Non-NT-based versions (e.g. 95, 98, etc.) are given - * version 0.0. - * - * @return {string} The platform version or empty string if version cannot be - * determined. - */ -goog.labs.userAgent.platform.getVersion = function() { - var userAgentString = goog.labs.userAgent.util.getUserAgent(); - var version = '', re; - if (goog.labs.userAgent.platform.isWindows()) { - re = /Windows (?:NT|Phone) ([0-9.]+)/; - var match = re.exec(userAgentString); - if (match) { - version = match[1]; - } else { - version = '0.0'; - } - } else if (goog.labs.userAgent.platform.isIos()) { - re = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/; - var match = re.exec(userAgentString); - // Report the version as x.y.z and not x_y_z - version = match && match[1].replace(/_/g, '.'); - } else if (goog.labs.userAgent.platform.isMacintosh()) { - re = /Mac OS X ([0-9_.]+)/; - var match = re.exec(userAgentString); - // Note: some old versions of Camino do not report an OSX version. - // Default to 10. - version = match ? match[1].replace(/_/g, '.') : '10'; - } else if (goog.labs.userAgent.platform.isAndroid()) { - re = /Android\s+([^\);]+)(\)|;)/; - var match = re.exec(userAgentString); - version = match && match[1]; - } else if (goog.labs.userAgent.platform.isChromeOS()) { - re = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/; - var match = re.exec(userAgentString); - version = match && match[1]; - } - return version || ''; -}; - - -/** - * @param {string|number} version The version to check. - * @return {boolean} Whether the browser version is higher or the same as the - * given version. - */ -goog.labs.userAgent.platform.isVersionOrHigher = function(version) { - return goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(), - version) >= 0; -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Rendering engine detection. - * @see <a href="http://www.useragentstring.com/">User agent strings</a> - * For information on the browser brand (such as Safari versus Chrome), see - * goog.userAgent.product. - * @author arv@google.com (Erik Arvidsson) - * @see ../demos/useragent.html - */ - -goog.provide('goog.userAgent'); - -goog.require('goog.labs.userAgent.browser'); -goog.require('goog.labs.userAgent.engine'); -goog.require('goog.labs.userAgent.platform'); -goog.require('goog.labs.userAgent.util'); -goog.require('goog.string'); - - -/** - * @define {boolean} Whether we know at compile-time that the browser is IE. - */ -goog.define('goog.userAgent.ASSUME_IE', false); - - -/** - * @define {boolean} Whether we know at compile-time that the browser is EDGE. - */ -goog.define('goog.userAgent.ASSUME_EDGE', false); - - -/** - * @define {boolean} Whether we know at compile-time that the browser is GECKO. - */ -goog.define('goog.userAgent.ASSUME_GECKO', false); - - -/** - * @define {boolean} Whether we know at compile-time that the browser is WEBKIT. - */ -goog.define('goog.userAgent.ASSUME_WEBKIT', false); - - -/** - * @define {boolean} Whether we know at compile-time that the browser is a - * mobile device running WebKit e.g. iPhone or Android. - */ -goog.define('goog.userAgent.ASSUME_MOBILE_WEBKIT', false); - - -/** - * @define {boolean} Whether we know at compile-time that the browser is OPERA. - */ -goog.define('goog.userAgent.ASSUME_OPERA', false); - - -/** - * @define {boolean} Whether the - * {@code goog.userAgent.isVersionOrHigher} - * function will return true for any version. - */ -goog.define('goog.userAgent.ASSUME_ANY_VERSION', false); - - -/** - * Whether we know the browser engine at compile-time. - * @type {boolean} - * @private - */ -goog.userAgent.BROWSER_KNOWN_ = - goog.userAgent.ASSUME_IE || - goog.userAgent.ASSUME_EDGE || - goog.userAgent.ASSUME_GECKO || - goog.userAgent.ASSUME_MOBILE_WEBKIT || - goog.userAgent.ASSUME_WEBKIT || - goog.userAgent.ASSUME_OPERA; - - -/** - * Returns the userAgent string for the current browser. - * - * @return {string} The userAgent string. - */ -goog.userAgent.getUserAgentString = function() { - return goog.labs.userAgent.util.getUserAgent(); -}; - - -/** - * TODO(nnaze): Change type to "Navigator" and update compilation targets. - * @return {Object} The native navigator object. - */ -goog.userAgent.getNavigator = function() { - // Need a local navigator reference instead of using the global one, - // to avoid the rare case where they reference different objects. - // (in a WorkerPool, for example). - return goog.global['navigator'] || null; -}; - - -/** - * Whether the user agent is Opera. - * @type {boolean} - */ -goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? - goog.userAgent.ASSUME_OPERA : - goog.labs.userAgent.browser.isOpera(); - - -/** - * Whether the user agent is Internet Explorer. - * @type {boolean} - */ -goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? - goog.userAgent.ASSUME_IE : - goog.labs.userAgent.browser.isIE(); - - -/** - * Whether the user agent is Microsoft Edge. - * @type {boolean} - */ -goog.userAgent.EDGE = goog.userAgent.BROWSER_KNOWN_ ? - goog.userAgent.ASSUME_EDGE : - goog.labs.userAgent.engine.isEdge(); - - -/** - * Whether the user agent is MS Internet Explorer or MS Edge. - * @type {boolean} - */ -goog.userAgent.EDGE_OR_IE = goog.userAgent.EDGE || goog.userAgent.IE; - - -/** - * Whether the user agent is Gecko. Gecko is the rendering engine used by - * Mozilla, Firefox, and others. - * @type {boolean} - */ -goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? - goog.userAgent.ASSUME_GECKO : - goog.labs.userAgent.engine.isGecko(); - - -/** - * Whether the user agent is WebKit. WebKit is the rendering engine that - * Safari, Android and others use. - * @type {boolean} - */ -goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? - goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : - goog.labs.userAgent.engine.isWebKit(); - - -/** - * Whether the user agent is running on a mobile device. - * - * This is a separate function so that the logic can be tested. - * - * TODO(nnaze): Investigate swapping in goog.labs.userAgent.device.isMobile(). - * - * @return {boolean} Whether the user agent is running on a mobile device. - * @private - */ -goog.userAgent.isMobile_ = function() { - return goog.userAgent.WEBKIT && - goog.labs.userAgent.util.matchUserAgent('Mobile'); -}; - - -/** - * Whether the user agent is running on a mobile device. - * - * TODO(nnaze): Consider deprecating MOBILE when labs.userAgent - * is promoted as the gecko/webkit logic is likely inaccurate. - * - * @type {boolean} - */ -goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || - goog.userAgent.isMobile_(); - - -/** - * Used while transitioning code to use WEBKIT instead. - * @type {boolean} - * @deprecated Use {@link goog.userAgent.product.SAFARI} instead. - * TODO(nicksantos): Delete this from goog.userAgent. - */ -goog.userAgent.SAFARI = goog.userAgent.WEBKIT; - - -/** - * @return {string} the platform (operating system) the user agent is running - * on. Default to empty string because navigator.platform may not be defined - * (on Rhino, for example). - * @private - */ -goog.userAgent.determinePlatform_ = function() { - var navigator = goog.userAgent.getNavigator(); - return navigator && navigator.platform || ''; -}; - - -/** - * The platform (operating system) the user agent is running on. Default to - * empty string because navigator.platform may not be defined (on Rhino, for - * example). - * @type {string} - */ -goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_(); - - -/** - * @define {boolean} Whether the user agent is running on a Macintosh operating - * system. - */ -goog.define('goog.userAgent.ASSUME_MAC', false); - - -/** - * @define {boolean} Whether the user agent is running on a Windows operating - * system. - */ -goog.define('goog.userAgent.ASSUME_WINDOWS', false); - - -/** - * @define {boolean} Whether the user agent is running on a Linux operating - * system. - */ -goog.define('goog.userAgent.ASSUME_LINUX', false); - - -/** - * @define {boolean} Whether the user agent is running on a X11 windowing - * system. - */ -goog.define('goog.userAgent.ASSUME_X11', false); - - -/** - * @define {boolean} Whether the user agent is running on Android. - */ -goog.define('goog.userAgent.ASSUME_ANDROID', false); - - -/** - * @define {boolean} Whether the user agent is running on an iPhone. - */ -goog.define('goog.userAgent.ASSUME_IPHONE', false); - - -/** - * @define {boolean} Whether the user agent is running on an iPad. - */ -goog.define('goog.userAgent.ASSUME_IPAD', false); - - -/** - * @type {boolean} - * @private - */ -goog.userAgent.PLATFORM_KNOWN_ = - goog.userAgent.ASSUME_MAC || - goog.userAgent.ASSUME_WINDOWS || - goog.userAgent.ASSUME_LINUX || - goog.userAgent.ASSUME_X11 || - goog.userAgent.ASSUME_ANDROID || - goog.userAgent.ASSUME_IPHONE || - goog.userAgent.ASSUME_IPAD; - - -/** - * Whether the user agent is running on a Macintosh operating system. - * @type {boolean} - */ -goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? - goog.userAgent.ASSUME_MAC : goog.labs.userAgent.platform.isMacintosh(); - - -/** - * Whether the user agent is running on a Windows operating system. - * @type {boolean} - */ -goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? - goog.userAgent.ASSUME_WINDOWS : - goog.labs.userAgent.platform.isWindows(); - - -/** - * Whether the user agent is Linux per the legacy behavior of - * goog.userAgent.LINUX, which considered ChromeOS to also be - * Linux. - * @return {boolean} - * @private - */ -goog.userAgent.isLegacyLinux_ = function() { - return goog.labs.userAgent.platform.isLinux() || - goog.labs.userAgent.platform.isChromeOS(); -}; - - -/** - * Whether the user agent is running on a Linux operating system. - * - * Note that goog.userAgent.LINUX considers ChromeOS to be Linux, - * while goog.labs.userAgent.platform considers ChromeOS and - * Linux to be different OSes. - * - * @type {boolean} - */ -goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? - goog.userAgent.ASSUME_LINUX : - goog.userAgent.isLegacyLinux_(); - - -/** - * @return {boolean} Whether the user agent is an X11 windowing system. - * @private - */ -goog.userAgent.isX11_ = function() { - var navigator = goog.userAgent.getNavigator(); - return !!navigator && - goog.string.contains(navigator['appVersion'] || '', 'X11'); -}; - - -/** - * Whether the user agent is running on a X11 windowing system. - * @type {boolean} - */ -goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? - goog.userAgent.ASSUME_X11 : - goog.userAgent.isX11_(); - - -/** - * Whether the user agent is running on Android. - * @type {boolean} - */ -goog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ? - goog.userAgent.ASSUME_ANDROID : - goog.labs.userAgent.platform.isAndroid(); - - -/** - * Whether the user agent is running on an iPhone. - * @type {boolean} - */ -goog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ? - goog.userAgent.ASSUME_IPHONE : - goog.labs.userAgent.platform.isIphone(); - - -/** - * Whether the user agent is running on an iPad. - * @type {boolean} - */ -goog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ? - goog.userAgent.ASSUME_IPAD : - goog.labs.userAgent.platform.isIpad(); - - -/** - * @return {string} The string that describes the version number of the user - * agent. - * Assumes user agent is opera. - * @private - */ -goog.userAgent.operaVersion_ = function() { - var version = goog.global.opera.version; - try { - return version(); - } catch (e) { - return version; - } -}; - - -/** - * @return {string} The string that describes the version number of the user - * agent. - * @private - */ -goog.userAgent.determineVersion_ = function() { - // All browsers have different ways to detect the version and they all have - // different naming schemes. - - if (goog.userAgent.OPERA && goog.global['opera']) { - return goog.userAgent.operaVersion_(); - } - - // version is a string rather than a number because it may contain 'b', 'a', - // and so on. - var version = ''; - var arr = goog.userAgent.getVersionRegexResult_(); - if (arr) { - version = arr ? arr[1] : ''; - } - - if (goog.userAgent.IE) { - // IE9 can be in document mode 9 but be reporting an inconsistent user agent - // version. If it is identifying as a version lower than 9 we take the - // documentMode as the version instead. IE8 has similar behavior. - // It is recommended to set the X-UA-Compatible header to ensure that IE9 - // uses documentMode 9. - var docMode = goog.userAgent.getDocumentMode_(); - if (docMode > parseFloat(version)) { - return String(docMode); - } - } - - return version; -}; - - -/** - * @return {Array|undefined} The version regex matches from parsing the user - * agent string. These regex statements must be executed inline so they can - * be compiled out by the closure compiler with the rest of the useragent - * detection logic when ASSUME_* is specified. - * @private - */ -goog.userAgent.getVersionRegexResult_ = function() { - var userAgent = goog.userAgent.getUserAgentString(); - if (goog.userAgent.GECKO) { - return /rv\:([^\);]+)(\)|;)/.exec(userAgent); - } - if (goog.userAgent.EDGE) { - return /Edge\/([\d\.]+)/.exec(userAgent); - } - if (goog.userAgent.IE) { - return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(userAgent); - } - if (goog.userAgent.WEBKIT) { - // WebKit/125.4 - return /WebKit\/(\S+)/.exec(userAgent); - } -}; - - -/** - * @return {number|undefined} Returns the document mode (for testing). - * @private - */ -goog.userAgent.getDocumentMode_ = function() { - // NOTE(user): goog.userAgent may be used in context where there is no DOM. - var doc = goog.global['document']; - return doc ? doc['documentMode'] : undefined; -}; - - -/** - * The version of the user agent. This is a string because it might contain - * 'b' (as in beta) as well as multiple dots. - * @type {string} - */ -goog.userAgent.VERSION = goog.userAgent.determineVersion_(); - - -/** - * Compares two version numbers. - * - * @param {string} v1 Version of first item. - * @param {string} v2 Version of second item. - * - * @return {number} 1 if first argument is higher - * 0 if arguments are equal - * -1 if second argument is higher. - * @deprecated Use goog.string.compareVersions. - */ -goog.userAgent.compare = function(v1, v2) { - return goog.string.compareVersions(v1, v2); -}; - - -/** - * Cache for {@link goog.userAgent.isVersionOrHigher}. - * Calls to compareVersions are surprisingly expensive and, as a browser's - * version number is unlikely to change during a session, we cache the results. - * @const - * @private - */ -goog.userAgent.isVersionOrHigherCache_ = {}; - - -/** - * Whether the user agent version is higher or the same as the given version. - * NOTE: When checking the version numbers for Firefox and Safari, be sure to - * use the engine's version, not the browser's version number. For example, - * Firefox 3.0 corresponds to Gecko 1.9 and Safari 3.0 to Webkit 522.11. - * Opera and Internet Explorer versions match the product release number.<br> - * @see <a href="http://en.wikipedia.org/wiki/Safari_version_history"> - * Webkit</a> - * @see <a href="http://en.wikipedia.org/wiki/Gecko_engine">Gecko</a> - * - * @param {string|number} version The version to check. - * @return {boolean} Whether the user agent version is higher or the same as - * the given version. - */ -goog.userAgent.isVersionOrHigher = function(version) { - return goog.userAgent.ASSUME_ANY_VERSION || - goog.userAgent.isVersionOrHigherCache_[version] || - (goog.userAgent.isVersionOrHigherCache_[version] = - goog.string.compareVersions(goog.userAgent.VERSION, version) >= 0); -}; - - -/** - * Deprecated alias to {@code goog.userAgent.isVersionOrHigher}. - * @param {string|number} version The version to check. - * @return {boolean} Whether the user agent version is higher or the same as - * the given version. - * @deprecated Use goog.userAgent.isVersionOrHigher(). - */ -goog.userAgent.isVersion = goog.userAgent.isVersionOrHigher; - - -/** - * Whether the IE effective document mode is higher or the same as the given - * document mode version. - * NOTE: Only for IE, return false for another browser. - * - * @param {number} documentMode The document mode version to check. - * @return {boolean} Whether the IE effective document mode is higher or the - * same as the given version. - */ -goog.userAgent.isDocumentModeOrHigher = function(documentMode) { - return goog.userAgent.DOCUMENT_MODE >= documentMode; -}; - - -/** - * Deprecated alias to {@code goog.userAgent.isDocumentModeOrHigher}. - * @param {number} version The version to check. - * @return {boolean} Whether the IE effective document mode is higher or the - * same as the given version. - * @deprecated Use goog.userAgent.isDocumentModeOrHigher(). - */ -goog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher; - - -/** - * For IE version < 7, documentMode is undefined, so attempt to use the - * CSS1Compat property to see if we are in standards mode. If we are in - * standards mode, treat the browser version as the document mode. Otherwise, - * IE is emulating version 5. - * @type {number|undefined} - * @const - */ -goog.userAgent.DOCUMENT_MODE = (function() { - var doc = goog.global['document']; - var mode = goog.userAgent.getDocumentMode_(); - if (!doc || !goog.userAgent.IE) { - return undefined; - } - return mode || (doc['compatMode'] == 'CSS1Compat' ? - parseInt(goog.userAgent.VERSION, 10) : 5); -})(); - -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Browser capability checks for the events package. - * - */ - - -goog.provide('goog.events.BrowserFeature'); - -goog.require('goog.userAgent'); - - -/** - * Enum of browser capabilities. - * @enum {boolean} - */ -goog.events.BrowserFeature = { - /** - * Whether the button attribute of the event is W3C compliant. False in - * Internet Explorer prior to version 9; document-version dependent. - */ - HAS_W3C_BUTTON: !goog.userAgent.IE || - goog.userAgent.isDocumentModeOrHigher(9), - - /** - * Whether the browser supports full W3C event model. - */ - HAS_W3C_EVENT_SUPPORT: !goog.userAgent.IE || - goog.userAgent.isDocumentModeOrHigher(9), - - /** - * To prevent default in IE7-8 for certain keydown events we need set the - * keyCode to -1. - */ - SET_KEY_CODE_TO_PREVENT_DEFAULT: goog.userAgent.IE && - !goog.userAgent.isVersionOrHigher('9'), - - /** - * Whether the {@code navigator.onLine} property is supported. - */ - HAS_NAVIGATOR_ONLINE_PROPERTY: !goog.userAgent.WEBKIT || - goog.userAgent.isVersionOrHigher('528'), - - /** - * Whether HTML5 network online/offline events are supported. - */ - HAS_HTML5_NETWORK_EVENT_SUPPORT: - goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9b') || - goog.userAgent.IE && goog.userAgent.isVersionOrHigher('8') || - goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher('9.5') || - goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('528'), - - /** - * Whether HTML5 network events fire on document.body, or otherwise the - * window. - */ - HTML5_NETWORK_EVENTS_FIRE_ON_BODY: - goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher('8') || - goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9'), - - /** - * Whether touch is enabled in the browser. - */ - TOUCH_ENABLED: - ('ontouchstart' in goog.global || - !!(goog.global['document'] && - document.documentElement && - 'ontouchstart' in document.documentElement) || - // IE10 uses non-standard touch events, so it has a different check. - !!(goog.global['navigator'] && - goog.global['navigator']['msMaxTouchPoints'])) -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Definition of the disposable interface. A disposable object - * has a dispose method to to clean up references and resources. - * @author nnaze@google.com (Nathan Naze) - */ - - -goog.provide('goog.disposable.IDisposable'); - - - -/** - * Interface for a disposable object. If a instance requires cleanup - * (references COM objects, DOM notes, or other disposable objects), it should - * implement this interface (it may subclass goog.Disposable). - * @interface - */ -goog.disposable.IDisposable = function() {}; - - -/** - * Disposes of the object and its resources. - * @return {void} Nothing. - */ -goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod; - - -/** - * @return {boolean} Whether the object has been disposed of. - */ -goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod; - -// Copyright 2005 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Implements the disposable interface. The dispose method is used - * to clean up references and resources. - * @author arv@google.com (Erik Arvidsson) - */ - - -goog.provide('goog.Disposable'); -/** @suppress {extraProvide} */ -goog.provide('goog.dispose'); -/** @suppress {extraProvide} */ -goog.provide('goog.disposeAll'); - -goog.require('goog.disposable.IDisposable'); - - - -/** - * Class that provides the basic implementation for disposable objects. If your - * class holds one or more references to COM objects, DOM nodes, or other - * disposable objects, it should extend this class or implement the disposable - * interface (defined in goog.disposable.IDisposable). - * @constructor - * @implements {goog.disposable.IDisposable} - */ -goog.Disposable = function() { - if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) { - if (goog.Disposable.INCLUDE_STACK_ON_CREATION) { - this.creationStack = new Error().stack; - } - goog.Disposable.instances_[goog.getUid(this)] = this; - } - // Support sealing - this.disposed_ = this.disposed_; - this.onDisposeCallbacks_ = this.onDisposeCallbacks_; -}; - - -/** - * @enum {number} Different monitoring modes for Disposable. - */ -goog.Disposable.MonitoringMode = { - /** - * No monitoring. - */ - OFF: 0, - /** - * Creating and disposing the goog.Disposable instances is monitored. All - * disposable objects need to call the {@code goog.Disposable} base - * constructor. The PERMANENT mode must be switched on before creating any - * goog.Disposable instances. - */ - PERMANENT: 1, - /** - * INTERACTIVE mode can be switched on and off on the fly without producing - * errors. It also doesn't warn if the disposable objects don't call the - * {@code goog.Disposable} base constructor. - */ - INTERACTIVE: 2 -}; - - -/** - * @define {number} The monitoring mode of the goog.Disposable - * instances. Default is OFF. Switching on the monitoring is only - * recommended for debugging because it has a significant impact on - * performance and memory usage. If switched off, the monitoring code - * compiles down to 0 bytes. - */ -goog.define('goog.Disposable.MONITORING_MODE', 0); - - -/** - * @define {boolean} Whether to attach creation stack to each created disposable - * instance; This is only relevant for when MonitoringMode != OFF. - */ -goog.define('goog.Disposable.INCLUDE_STACK_ON_CREATION', true); - - -/** - * Maps the unique ID of every undisposed {@code goog.Disposable} object to - * the object itself. - * @type {!Object<number, !goog.Disposable>} - * @private - */ -goog.Disposable.instances_ = {}; - - -/** - * @return {!Array<!goog.Disposable>} All {@code goog.Disposable} objects that - * haven't been disposed of. - */ -goog.Disposable.getUndisposedObjects = function() { - var ret = []; - for (var id in goog.Disposable.instances_) { - if (goog.Disposable.instances_.hasOwnProperty(id)) { - ret.push(goog.Disposable.instances_[Number(id)]); - } - } - return ret; -}; - - -/** - * Clears the registry of undisposed objects but doesn't dispose of them. - */ -goog.Disposable.clearUndisposedObjects = function() { - goog.Disposable.instances_ = {}; -}; - - -/** - * Whether the object has been disposed of. - * @type {boolean} - * @private - */ -goog.Disposable.prototype.disposed_ = false; - - -/** - * Callbacks to invoke when this object is disposed. - * @type {Array<!Function>} - * @private - */ -goog.Disposable.prototype.onDisposeCallbacks_; - - -/** - * If monitoring the goog.Disposable instances is enabled, stores the creation - * stack trace of the Disposable instance. - * @const {string} - */ -goog.Disposable.prototype.creationStack; - - -/** - * @return {boolean} Whether the object has been disposed of. - * @override - */ -goog.Disposable.prototype.isDisposed = function() { - return this.disposed_; -}; - - -/** - * @return {boolean} Whether the object has been disposed of. - * @deprecated Use {@link #isDisposed} instead. - */ -goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed; - - -/** - * Disposes of the object. If the object hasn't already been disposed of, calls - * {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should - * override {@link #disposeInternal} in order to delete references to COM - * objects, DOM nodes, and other disposable objects. Reentrant. - * - * @return {void} Nothing. - * @override - */ -goog.Disposable.prototype.dispose = function() { - if (!this.disposed_) { - // Set disposed_ to true first, in case during the chain of disposal this - // gets disposed recursively. - this.disposed_ = true; - this.disposeInternal(); - if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) { - var uid = goog.getUid(this); - if (goog.Disposable.MONITORING_MODE == - goog.Disposable.MonitoringMode.PERMANENT && - !goog.Disposable.instances_.hasOwnProperty(uid)) { - throw Error(this + ' did not call the goog.Disposable base ' + - 'constructor or was disposed of after a clearUndisposedObjects ' + - 'call'); - } - delete goog.Disposable.instances_[uid]; - } - } -}; - - -/** - * Associates a disposable object with this object so that they will be disposed - * together. - * @param {goog.disposable.IDisposable} disposable that will be disposed when - * this object is disposed. - */ -goog.Disposable.prototype.registerDisposable = function(disposable) { - this.addOnDisposeCallback(goog.partial(goog.dispose, disposable)); -}; - - -/** - * Invokes a callback function when this object is disposed. Callbacks are - * invoked in the order in which they were added. If a callback is added to - * an already disposed Disposable, it will be called immediately. - * @param {function(this:T):?} callback The callback function. - * @param {T=} opt_scope An optional scope to call the callback in. - * @template T - */ -goog.Disposable.prototype.addOnDisposeCallback = function(callback, opt_scope) { - if (this.disposed_) { - callback.call(opt_scope); - return; - } - if (!this.onDisposeCallbacks_) { - this.onDisposeCallbacks_ = []; - } - - this.onDisposeCallbacks_.push( - goog.isDef(opt_scope) ? goog.bind(callback, opt_scope) : callback); -}; - - -/** - * Deletes or nulls out any references to COM objects, DOM nodes, or other - * disposable objects. Classes that extend {@code goog.Disposable} should - * override this method. - * Not reentrant. To avoid calling it twice, it must only be called from the - * subclass' {@code disposeInternal} method. Everywhere else the public - * {@code dispose} method must be used. - * For example: - * <pre> - * mypackage.MyClass = function() { - * mypackage.MyClass.base(this, 'constructor'); - * // Constructor logic specific to MyClass. - * ... - * }; - * goog.inherits(mypackage.MyClass, goog.Disposable); - * - * mypackage.MyClass.prototype.disposeInternal = function() { - * // Dispose logic specific to MyClass. - * ... - * // Call superclass's disposeInternal at the end of the subclass's, like - * // in C++, to avoid hard-to-catch issues. - * mypackage.MyClass.base(this, 'disposeInternal'); - * }; - * </pre> - * @protected - */ -goog.Disposable.prototype.disposeInternal = function() { - if (this.onDisposeCallbacks_) { - while (this.onDisposeCallbacks_.length) { - this.onDisposeCallbacks_.shift()(); - } - } -}; - - -/** - * Returns True if we can verify the object is disposed. - * Calls {@code isDisposed} on the argument if it supports it. If obj - * is not an object with an isDisposed() method, return false. - * @param {*} obj The object to investigate. - * @return {boolean} True if we can verify the object is disposed. - */ -goog.Disposable.isDisposed = function(obj) { - if (obj && typeof obj.isDisposed == 'function') { - return obj.isDisposed(); - } - return false; -}; - - -/** - * Calls {@code dispose} on the argument if it supports it. If obj is not an - * object with a dispose() method, this is a no-op. - * @param {*} obj The object to dispose of. - */ -goog.dispose = function(obj) { - if (obj && typeof obj.dispose == 'function') { - obj.dispose(); - } -}; - - -/** - * Calls {@code dispose} on each member of the list that supports it. (If the - * member is an ArrayLike, then {@code goog.disposeAll()} will be called - * recursively on each of its members.) If the member is not an object with a - * {@code dispose()} method, then it is ignored. - * @param {...*} var_args The list. - */ -goog.disposeAll = function(var_args) { - for (var i = 0, len = arguments.length; i < len; ++i) { - var disposable = arguments[i]; - if (goog.isArrayLike(disposable)) { - goog.disposeAll.apply(null, disposable); - } else { - goog.dispose(disposable); - } - } -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.events.EventId'); - - - -/** - * A templated class that is used when registering for events. Typical usage: - * <code> - * /** @type {goog.events.EventId<MyEventObj>} - * var myEventId = new goog.events.EventId( - * goog.events.getUniqueId(('someEvent')); - * - * // No need to cast or declare here since the compiler knows the correct - * // type of 'evt' (MyEventObj). - * something.listen(myEventId, function(evt) {}); - * </code> - * - * @param {string} eventId - * @template T - * @constructor - * @struct - * @final - */ -goog.events.EventId = function(eventId) { - /** @const */ this.id = eventId; -}; - - -/** - * @override - */ -goog.events.EventId.prototype.toString = function() { - return this.id; -}; - -// Copyright 2005 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A base class for event objects. - * - */ - - -goog.provide('goog.events.Event'); -goog.provide('goog.events.EventLike'); - -/** - * goog.events.Event no longer depends on goog.Disposable. Keep requiring - * goog.Disposable here to not break projects which assume this dependency. - * @suppress {extraRequire} - */ -goog.require('goog.Disposable'); -goog.require('goog.events.EventId'); - - -/** - * A typedef for event like objects that are dispatchable via the - * goog.events.dispatchEvent function. strings are treated as the type for a - * goog.events.Event. Objects are treated as an extension of a new - * goog.events.Event with the type property of the object being used as the type - * of the Event. - * @typedef {string|Object|goog.events.Event|goog.events.EventId} - */ -goog.events.EventLike; - - - -/** - * A base class for event objects, so that they can support preventDefault and - * stopPropagation. - * - * @param {string|!goog.events.EventId} type Event Type. - * @param {Object=} opt_target Reference to the object that is the target of - * this event. It has to implement the {@code EventTarget} interface - * declared at {@link http://developer.mozilla.org/en/DOM/EventTarget}. - * @constructor - */ -goog.events.Event = function(type, opt_target) { - /** - * Event type. - * @type {string} - */ - this.type = type instanceof goog.events.EventId ? String(type) : type; - - /** - * TODO(tbreisacher): The type should probably be - * EventTarget|goog.events.EventTarget. - * - * Target of the event. - * @type {Object|undefined} - */ - this.target = opt_target; - - /** - * Object that had the listener attached. - * @type {Object|undefined} - */ - this.currentTarget = this.target; - - /** - * Whether to cancel the event in internal capture/bubble processing for IE. - * @type {boolean} - * @public - * @suppress {underscore|visibility} Technically public, but referencing this - * outside this package is strongly discouraged. - */ - this.propagationStopped_ = false; - - /** - * Whether the default action has been prevented. - * This is a property to match the W3C specification at - * {@link http://www.w3.org/TR/DOM-Level-3-Events/ - * #events-event-type-defaultPrevented}. - * Must be treated as read-only outside the class. - * @type {boolean} - */ - this.defaultPrevented = false; - - /** - * Return value for in internal capture/bubble processing for IE. - * @type {boolean} - * @public - * @suppress {underscore|visibility} Technically public, but referencing this - * outside this package is strongly discouraged. - */ - this.returnValue_ = true; -}; - - -/** - * Stops event propagation. - */ -goog.events.Event.prototype.stopPropagation = function() { - this.propagationStopped_ = true; -}; - - -/** - * Prevents the default action, for example a link redirecting to a url. - */ -goog.events.Event.prototype.preventDefault = function() { - this.defaultPrevented = true; - this.returnValue_ = false; -}; - - -/** - * Stops the propagation of the event. It is equivalent to - * {@code e.stopPropagation()}, but can be used as the callback argument of - * {@link goog.events.listen} without declaring another function. - * @param {!goog.events.Event} e An event. - */ -goog.events.Event.stopPropagation = function(e) { - e.stopPropagation(); -}; - - -/** - * Prevents the default action. It is equivalent to - * {@code e.preventDefault()}, but can be used as the callback argument of - * {@link goog.events.listen} without declaring another function. - * @param {!goog.events.Event} e An event. - */ -goog.events.Event.preventDefault = function(e) { - e.preventDefault(); -}; - -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Event Types. - * - * @author arv@google.com (Erik Arvidsson) - */ - - -goog.provide('goog.events.EventType'); - -goog.require('goog.userAgent'); - - -/** - * Returns a prefixed event name for the current browser. - * @param {string} eventName The name of the event. - * @return {string} The prefixed event name. - * @suppress {missingRequire|missingProvide} - * @private - */ -goog.events.getVendorPrefixedName_ = function(eventName) { - return goog.userAgent.WEBKIT ? 'webkit' + eventName : - (goog.userAgent.OPERA ? 'o' + eventName.toLowerCase() : - eventName.toLowerCase()); -}; - - -/** - * Constants for event names. - * @enum {string} - */ -goog.events.EventType = { - // Mouse events - CLICK: 'click', - RIGHTCLICK: 'rightclick', - DBLCLICK: 'dblclick', - MOUSEDOWN: 'mousedown', - MOUSEUP: 'mouseup', - MOUSEOVER: 'mouseover', - MOUSEOUT: 'mouseout', - MOUSEMOVE: 'mousemove', - MOUSEENTER: 'mouseenter', - MOUSELEAVE: 'mouseleave', - // Select start is non-standard. - // See http://msdn.microsoft.com/en-us/library/ie/ms536969(v=vs.85).aspx. - SELECTSTART: 'selectstart', // IE, Safari, Chrome - - // Wheel events - // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents - WHEEL: 'wheel', - - // Key events - KEYPRESS: 'keypress', - KEYDOWN: 'keydown', - KEYUP: 'keyup', - - // Focus - BLUR: 'blur', - FOCUS: 'focus', - DEACTIVATE: 'deactivate', // IE only - // NOTE: The following two events are not stable in cross-browser usage. - // WebKit and Opera implement DOMFocusIn/Out. - // IE implements focusin/out. - // Gecko implements neither see bug at - // https://bugzilla.mozilla.org/show_bug.cgi?id=396927. - // The DOM Events Level 3 Draft deprecates DOMFocusIn in favor of focusin: - // http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html - // You can use FOCUS in Capture phase until implementations converge. - FOCUSIN: goog.userAgent.IE ? 'focusin' : 'DOMFocusIn', - FOCUSOUT: goog.userAgent.IE ? 'focusout' : 'DOMFocusOut', - - // Forms - CHANGE: 'change', - RESET: 'reset', - SELECT: 'select', - SUBMIT: 'submit', - INPUT: 'input', - PROPERTYCHANGE: 'propertychange', // IE only - - // Drag and drop - DRAGSTART: 'dragstart', - DRAG: 'drag', - DRAGENTER: 'dragenter', - DRAGOVER: 'dragover', - DRAGLEAVE: 'dragleave', - DROP: 'drop', - DRAGEND: 'dragend', - - // Touch events - // Note that other touch events exist, but we should follow the W3C list here. - // http://www.w3.org/TR/touch-events/#list-of-touchevent-types - TOUCHSTART: 'touchstart', - TOUCHMOVE: 'touchmove', - TOUCHEND: 'touchend', - TOUCHCANCEL: 'touchcancel', - - // Misc - BEFOREUNLOAD: 'beforeunload', - CONSOLEMESSAGE: 'consolemessage', - CONTEXTMENU: 'contextmenu', - DOMCONTENTLOADED: 'DOMContentLoaded', - ERROR: 'error', - HELP: 'help', - LOAD: 'load', - LOSECAPTURE: 'losecapture', - ORIENTATIONCHANGE: 'orientationchange', - READYSTATECHANGE: 'readystatechange', - RESIZE: 'resize', - SCROLL: 'scroll', - UNLOAD: 'unload', - - // HTML 5 History events - // See http://www.w3.org/TR/html5/browsers.html#event-definitions-0 - HASHCHANGE: 'hashchange', - PAGEHIDE: 'pagehide', - PAGESHOW: 'pageshow', - POPSTATE: 'popstate', - - // Copy and Paste - // Support is limited. Make sure it works on your favorite browser - // before using. - // http://www.quirksmode.org/dom/events/cutcopypaste.html - COPY: 'copy', - PASTE: 'paste', - CUT: 'cut', - BEFORECOPY: 'beforecopy', - BEFORECUT: 'beforecut', - BEFOREPASTE: 'beforepaste', - - // HTML5 online/offline events. - // http://www.w3.org/TR/offline-webapps/#related - ONLINE: 'online', - OFFLINE: 'offline', - - // HTML 5 worker events - MESSAGE: 'message', - CONNECT: 'connect', - - // CSS animation events. - /** @suppress {missingRequire} */ - ANIMATIONSTART: goog.events.getVendorPrefixedName_('AnimationStart'), - /** @suppress {missingRequire} */ - ANIMATIONEND: goog.events.getVendorPrefixedName_('AnimationEnd'), - /** @suppress {missingRequire} */ - ANIMATIONITERATION: goog.events.getVendorPrefixedName_('AnimationIteration'), - - // CSS transition events. Based on the browser support described at: - // https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility - /** @suppress {missingRequire} */ - TRANSITIONEND: goog.events.getVendorPrefixedName_('TransitionEnd'), - - // W3C Pointer Events - // http://www.w3.org/TR/pointerevents/ - POINTERDOWN: 'pointerdown', - POINTERUP: 'pointerup', - POINTERCANCEL: 'pointercancel', - POINTERMOVE: 'pointermove', - POINTEROVER: 'pointerover', - POINTEROUT: 'pointerout', - POINTERENTER: 'pointerenter', - POINTERLEAVE: 'pointerleave', - GOTPOINTERCAPTURE: 'gotpointercapture', - LOSTPOINTERCAPTURE: 'lostpointercapture', - - // IE specific events. - // See http://msdn.microsoft.com/en-us/library/ie/hh772103(v=vs.85).aspx - // Note: these events will be supplanted in IE11. - MSGESTURECHANGE: 'MSGestureChange', - MSGESTUREEND: 'MSGestureEnd', - MSGESTUREHOLD: 'MSGestureHold', - MSGESTURESTART: 'MSGestureStart', - MSGESTURETAP: 'MSGestureTap', - MSGOTPOINTERCAPTURE: 'MSGotPointerCapture', - MSINERTIASTART: 'MSInertiaStart', - MSLOSTPOINTERCAPTURE: 'MSLostPointerCapture', - MSPOINTERCANCEL: 'MSPointerCancel', - MSPOINTERDOWN: 'MSPointerDown', - MSPOINTERENTER: 'MSPointerEnter', - MSPOINTERHOVER: 'MSPointerHover', - MSPOINTERLEAVE: 'MSPointerLeave', - MSPOINTERMOVE: 'MSPointerMove', - MSPOINTEROUT: 'MSPointerOut', - MSPOINTEROVER: 'MSPointerOver', - MSPOINTERUP: 'MSPointerUp', - - // Native IMEs/input tools events. - TEXT: 'text', - TEXTINPUT: 'textInput', - COMPOSITIONSTART: 'compositionstart', - COMPOSITIONUPDATE: 'compositionupdate', - COMPOSITIONEND: 'compositionend', - - // Webview tag events - // See http://developer.chrome.com/dev/apps/webview_tag.html - EXIT: 'exit', - LOADABORT: 'loadabort', - LOADCOMMIT: 'loadcommit', - LOADREDIRECT: 'loadredirect', - LOADSTART: 'loadstart', - LOADSTOP: 'loadstop', - RESPONSIVE: 'responsive', - SIZECHANGED: 'sizechanged', - UNRESPONSIVE: 'unresponsive', - - // HTML5 Page Visibility API. See details at - // {@code goog.labs.dom.PageVisibilityMonitor}. - VISIBILITYCHANGE: 'visibilitychange', - - // LocalStorage event. - STORAGE: 'storage', - - // DOM Level 2 mutation events (deprecated). - DOMSUBTREEMODIFIED: 'DOMSubtreeModified', - DOMNODEINSERTED: 'DOMNodeInserted', - DOMNODEREMOVED: 'DOMNodeRemoved', - DOMNODEREMOVEDFROMDOCUMENT: 'DOMNodeRemovedFromDocument', - DOMNODEINSERTEDINTODOCUMENT: 'DOMNodeInsertedIntoDocument', - DOMATTRMODIFIED: 'DOMAttrModified', - DOMCHARACTERDATAMODIFIED: 'DOMCharacterDataModified', - - // Print events. - BEFOREPRINT: 'beforeprint', - AFTERPRINT: 'afterprint' -}; - -// Copyright 2009 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Useful compiler idioms. - * - * @author johnlenz@google.com (John Lenz) - */ - -goog.provide('goog.reflect'); - - -/** - * Syntax for object literal casts. - * @see http://go/jscompiler-renaming - * @see https://github.com/google/closure-compiler/wiki/Type-Based-Property-Renaming - * - * Use this if you have an object literal whose keys need to have the same names - * as the properties of some class even after they are renamed by the compiler. - * - * @param {!Function} type Type to cast to. - * @param {Object} object Object literal to cast. - * @return {Object} The object literal. - */ -goog.reflect.object = function(type, object) { - return object; -}; - - -/** - * To assert to the compiler that an operation is needed when it would - * otherwise be stripped. For example: - * <code> - * // Force a layout - * goog.reflect.sinkValue(dialog.offsetHeight); - * </code> - * @type {!Function} - */ -goog.reflect.sinkValue = function(x) { - goog.reflect.sinkValue[' '](x); - return x; -}; - - -/** - * The compiler should optimize this function away iff no one ever uses - * goog.reflect.sinkValue. - */ -goog.reflect.sinkValue[' '] = goog.nullFunction; - - -/** - * Check if a property can be accessed without throwing an exception. - * @param {Object} obj The owner of the property. - * @param {string} prop The property name. - * @return {boolean} Whether the property is accessible. Will also return true - * if obj is null. - */ -goog.reflect.canAccessProperty = function(obj, prop) { - /** @preserveTry */ - try { - goog.reflect.sinkValue(obj[prop]); - return true; - } catch (e) {} - return false; -}; - -// Copyright 2005 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A patched, standardized event object for browser events. - * - * <pre> - * The patched event object contains the following members: - * - type {string} Event type, e.g. 'click' - * - target {Object} The element that actually triggered the event - * - currentTarget {Object} The element the listener is attached to - * - relatedTarget {Object} For mouseover and mouseout, the previous object - * - offsetX {number} X-coordinate relative to target - * - offsetY {number} Y-coordinate relative to target - * - clientX {number} X-coordinate relative to viewport - * - clientY {number} Y-coordinate relative to viewport - * - screenX {number} X-coordinate relative to the edge of the screen - * - screenY {number} Y-coordinate relative to the edge of the screen - * - button {number} Mouse button. Use isButton() to test. - * - keyCode {number} Key-code - * - ctrlKey {boolean} Was ctrl key depressed - * - altKey {boolean} Was alt key depressed - * - shiftKey {boolean} Was shift key depressed - * - metaKey {boolean} Was meta key depressed - * - defaultPrevented {boolean} Whether the default action has been prevented - * - state {Object} History state object - * - * NOTE: The keyCode member contains the raw browser keyCode. For normalized - * key and character code use {@link goog.events.KeyHandler}. - * </pre> - * - * @author arv@google.com (Erik Arvidsson) - */ - -goog.provide('goog.events.BrowserEvent'); -goog.provide('goog.events.BrowserEvent.MouseButton'); - -goog.require('goog.events.BrowserFeature'); -goog.require('goog.events.Event'); -goog.require('goog.events.EventType'); -goog.require('goog.reflect'); -goog.require('goog.userAgent'); - - - -/** - * Accepts a browser event object and creates a patched, cross browser event - * object. - * The content of this object will not be initialized if no event object is - * provided. If this is the case, init() needs to be invoked separately. - * @param {Event=} opt_e Browser event object. - * @param {EventTarget=} opt_currentTarget Current target for event. - * @constructor - * @extends {goog.events.Event} - */ -goog.events.BrowserEvent = function(opt_e, opt_currentTarget) { - goog.events.BrowserEvent.base(this, 'constructor', opt_e ? opt_e.type : ''); - - /** - * Target that fired the event. - * @override - * @type {Node} - */ - this.target = null; - - /** - * Node that had the listener attached. - * @override - * @type {Node|undefined} - */ - this.currentTarget = null; - - /** - * For mouseover and mouseout events, the related object for the event. - * @type {Node} - */ - this.relatedTarget = null; - - /** - * X-coordinate relative to target. - * @type {number} - */ - this.offsetX = 0; - - /** - * Y-coordinate relative to target. - * @type {number} - */ - this.offsetY = 0; - - /** - * X-coordinate relative to the window. - * @type {number} - */ - this.clientX = 0; - - /** - * Y-coordinate relative to the window. - * @type {number} - */ - this.clientY = 0; - - /** - * X-coordinate relative to the monitor. - * @type {number} - */ - this.screenX = 0; - - /** - * Y-coordinate relative to the monitor. - * @type {number} - */ - this.screenY = 0; - - /** - * Which mouse button was pressed. - * @type {number} - */ - this.button = 0; - - /** - * Keycode of key press. - * @type {number} - */ - this.keyCode = 0; - - /** - * Keycode of key press. - * @type {number} - */ - this.charCode = 0; - - /** - * Whether control was pressed at time of event. - * @type {boolean} - */ - this.ctrlKey = false; - - /** - * Whether alt was pressed at time of event. - * @type {boolean} - */ - this.altKey = false; - - /** - * Whether shift was pressed at time of event. - * @type {boolean} - */ - this.shiftKey = false; - - /** - * Whether the meta key was pressed at time of event. - * @type {boolean} - */ - this.metaKey = false; - - /** - * History state object, only set for PopState events where it's a copy of the - * state object provided to pushState or replaceState. - * @type {Object} - */ - this.state = null; - - /** - * Whether the default platform modifier key was pressed at time of event. - * (This is control for all platforms except Mac, where it's Meta.) - * @type {boolean} - */ - this.platformModifierKey = false; - - /** - * The browser event object. - * @private {Event} - */ - this.event_ = null; - - if (opt_e) { - this.init(opt_e, opt_currentTarget); - } -}; -goog.inherits(goog.events.BrowserEvent, goog.events.Event); - - -/** - * Normalized button constants for the mouse. - * @enum {number} - */ -goog.events.BrowserEvent.MouseButton = { - LEFT: 0, - MIDDLE: 1, - RIGHT: 2 -}; - - -/** - * Static data for mapping mouse buttons. - * @type {!Array<number>} - */ -goog.events.BrowserEvent.IEButtonMap = [ - 1, // LEFT - 4, // MIDDLE - 2 // RIGHT -]; - - -/** - * Accepts a browser event object and creates a patched, cross browser event - * object. - * @param {Event} e Browser event object. - * @param {EventTarget=} opt_currentTarget Current target for event. - */ -goog.events.BrowserEvent.prototype.init = function(e, opt_currentTarget) { - var type = this.type = e.type; - - /** - * On touch devices use the first "changed touch" as the relevant touch. - * @type {Touch} - */ - var relevantTouch = e.changedTouches ? e.changedTouches[0] : null; - - // TODO(nicksantos): Change this.target to type EventTarget. - this.target = /** @type {Node} */ (e.target) || e.srcElement; - - // TODO(nicksantos): Change this.currentTarget to type EventTarget. - this.currentTarget = /** @type {Node} */ (opt_currentTarget); - - var relatedTarget = /** @type {Node} */ (e.relatedTarget); - if (relatedTarget) { - // There's a bug in FireFox where sometimes, relatedTarget will be a - // chrome element, and accessing any property of it will get a permission - // denied exception. See: - // https://bugzilla.mozilla.org/show_bug.cgi?id=497780 - if (goog.userAgent.GECKO) { - if (!goog.reflect.canAccessProperty(relatedTarget, 'nodeName')) { - relatedTarget = null; - } - } - // TODO(arv): Use goog.events.EventType when it has been refactored into its - // own file. - } else if (type == goog.events.EventType.MOUSEOVER) { - relatedTarget = e.fromElement; - } else if (type == goog.events.EventType.MOUSEOUT) { - relatedTarget = e.toElement; - } - - this.relatedTarget = relatedTarget; - - if (!goog.isNull(relevantTouch)) { - this.clientX = relevantTouch.clientX !== undefined ? - relevantTouch.clientX : relevantTouch.pageX; - this.clientY = relevantTouch.clientY !== undefined ? - relevantTouch.clientY : relevantTouch.pageY; - this.screenX = relevantTouch.screenX || 0; - this.screenY = relevantTouch.screenY || 0; - } else { - // Webkit emits a lame warning whenever layerX/layerY is accessed. - // http://code.google.com/p/chromium/issues/detail?id=101733 - this.offsetX = (goog.userAgent.WEBKIT || e.offsetX !== undefined) ? - e.offsetX : e.layerX; - this.offsetY = (goog.userAgent.WEBKIT || e.offsetY !== undefined) ? - e.offsetY : e.layerY; - this.clientX = e.clientX !== undefined ? e.clientX : e.pageX; - this.clientY = e.clientY !== undefined ? e.clientY : e.pageY; - this.screenX = e.screenX || 0; - this.screenY = e.screenY || 0; - } - - this.button = e.button; - - this.keyCode = e.keyCode || 0; - this.charCode = e.charCode || (type == 'keypress' ? e.keyCode : 0); - this.ctrlKey = e.ctrlKey; - this.altKey = e.altKey; - this.shiftKey = e.shiftKey; - this.metaKey = e.metaKey; - this.platformModifierKey = goog.userAgent.MAC ? e.metaKey : e.ctrlKey; - this.state = e.state; - this.event_ = e; - if (e.defaultPrevented) { - this.preventDefault(); - } -}; - - -/** - * Tests to see which button was pressed during the event. This is really only - * useful in IE and Gecko browsers. And in IE, it's only useful for - * mousedown/mouseup events, because click only fires for the left mouse button. - * - * Safari 2 only reports the left button being clicked, and uses the value '1' - * instead of 0. Opera only reports a mousedown event for the middle button, and - * no mouse events for the right button. Opera has default behavior for left and - * middle click that can only be overridden via a configuration setting. - * - * There's a nice table of this mess at http://www.unixpapa.com/js/mouse.html. - * - * @param {goog.events.BrowserEvent.MouseButton} button The button - * to test for. - * @return {boolean} True if button was pressed. - */ -goog.events.BrowserEvent.prototype.isButton = function(button) { - if (!goog.events.BrowserFeature.HAS_W3C_BUTTON) { - if (this.type == 'click') { - return button == goog.events.BrowserEvent.MouseButton.LEFT; - } else { - return !!(this.event_.button & - goog.events.BrowserEvent.IEButtonMap[button]); - } - } else { - return this.event_.button == button; - } -}; - - -/** - * Whether this has an "action"-producing mouse button. - * - * By definition, this includes left-click on windows/linux, and left-click - * without the ctrl key on Macs. - * - * @return {boolean} The result. - */ -goog.events.BrowserEvent.prototype.isMouseActionButton = function() { - // Webkit does not ctrl+click to be a right-click, so we - // normalize it to behave like Gecko and Opera. - return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT) && - !(goog.userAgent.WEBKIT && goog.userAgent.MAC && this.ctrlKey); -}; - - -/** - * @override - */ -goog.events.BrowserEvent.prototype.stopPropagation = function() { - goog.events.BrowserEvent.superClass_.stopPropagation.call(this); - if (this.event_.stopPropagation) { - this.event_.stopPropagation(); - } else { - this.event_.cancelBubble = true; - } -}; - - -/** - * @override - */ -goog.events.BrowserEvent.prototype.preventDefault = function() { - goog.events.BrowserEvent.superClass_.preventDefault.call(this); - var be = this.event_; - if (!be.preventDefault) { - be.returnValue = false; - if (goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT) { - /** @preserveTry */ - try { - // Most keys can be prevented using returnValue. Some special keys - // require setting the keyCode to -1 as well: - // - // In IE7: - // F3, F5, F10, F11, Ctrl+P, Crtl+O, Ctrl+F (these are taken from IE6) - // - // In IE8: - // Ctrl+P, Crtl+O, Ctrl+F (F1-F12 cannot be stopped through the event) - // - // We therefore do this for all function keys as well as when Ctrl key - // is pressed. - var VK_F1 = 112; - var VK_F12 = 123; - if (be.ctrlKey || be.keyCode >= VK_F1 && be.keyCode <= VK_F12) { - be.keyCode = -1; - } - } catch (ex) { - // IE throws an 'access denied' exception when trying to change - // keyCode in some situations (e.g. srcElement is input[type=file], - // or srcElement is an anchor tag rewritten by parent's innerHTML). - // Do nothing in this case. - } - } - } else { - be.preventDefault(); - } -}; - - -/** - * @return {Event} The underlying browser event object. - */ -goog.events.BrowserEvent.prototype.getBrowserEvent = function() { - return this.event_; -}; - -// Copyright 2012 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview An interface for a listenable JavaScript object. - * @author chrishenry@google.com (Chris Henry) - */ - -goog.provide('goog.events.Listenable'); -goog.provide('goog.events.ListenableKey'); - -/** @suppress {extraRequire} */ -goog.require('goog.events.EventId'); - - - -/** - * A listenable interface. A listenable is an object with the ability - * to dispatch/broadcast events to "event listeners" registered via - * listen/listenOnce. - * - * The interface allows for an event propagation mechanism similar - * to one offered by native browser event targets, such as - * capture/bubble mechanism, stopping propagation, and preventing - * default actions. Capture/bubble mechanism depends on the ancestor - * tree constructed via {@code #getParentEventTarget}; this tree - * must be directed acyclic graph. The meaning of default action(s) - * in preventDefault is specific to a particular use case. - * - * Implementations that do not support capture/bubble or can not have - * a parent listenable can simply not implement any ability to set the - * parent listenable (and have {@code #getParentEventTarget} return - * null). - * - * Implementation of this class can be used with or independently from - * goog.events. - * - * Implementation must call {@code #addImplementation(implClass)}. - * - * @interface - * @see goog.events - * @see http://www.w3.org/TR/DOM-Level-2-Events/events.html - */ -goog.events.Listenable = function() {}; - - -/** - * An expando property to indicate that an object implements - * goog.events.Listenable. - * - * See addImplementation/isImplementedBy. - * - * @type {string} - * @const - */ -goog.events.Listenable.IMPLEMENTED_BY_PROP = - 'closure_listenable_' + ((Math.random() * 1e6) | 0); - - -/** - * Marks a given class (constructor) as an implementation of - * Listenable, do that we can query that fact at runtime. The class - * must have already implemented the interface. - * @param {!Function} cls The class constructor. The corresponding - * class must have already implemented the interface. - */ -goog.events.Listenable.addImplementation = function(cls) { - cls.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP] = true; -}; - - -/** - * @param {Object} obj The object to check. - * @return {boolean} Whether a given instance implements Listenable. The - * class/superclass of the instance must call addImplementation. - */ -goog.events.Listenable.isImplementedBy = function(obj) { - return !!(obj && obj[goog.events.Listenable.IMPLEMENTED_BY_PROP]); -}; - - -/** - * Adds an event listener. A listener can only be added once to an - * object and if it is added again the key for the listener is - * returned. Note that if the existing listener is a one-off listener - * (registered via listenOnce), it will no longer be a one-off - * listener after a call to listen(). - * - * @param {string|!goog.events.EventId<EVENTOBJ>} type The event type id. - * @param {function(this:SCOPE, EVENTOBJ):(boolean|undefined)} listener Callback - * method. - * @param {boolean=} opt_useCapture Whether to fire in capture phase - * (defaults to false). - * @param {SCOPE=} opt_listenerScope Object in whose scope to call the - * listener. - * @return {goog.events.ListenableKey} Unique key for the listener. - * @template SCOPE,EVENTOBJ - */ -goog.events.Listenable.prototype.listen; - - -/** - * Adds an event listener that is removed automatically after the - * listener fired once. - * - * If an existing listener already exists, listenOnce will do - * nothing. In particular, if the listener was previously registered - * via listen(), listenOnce() will not turn the listener into a - * one-off listener. Similarly, if there is already an existing - * one-off listener, listenOnce does not modify the listeners (it is - * still a once listener). - * - * @param {string|!goog.events.EventId<EVENTOBJ>} type The event type id. - * @param {function(this:SCOPE, EVENTOBJ):(boolean|undefined)} listener Callback - * method. - * @param {boolean=} opt_useCapture Whether to fire in capture phase - * (defaults to false). - * @param {SCOPE=} opt_listenerScope Object in whose scope to call the - * listener. - * @return {goog.events.ListenableKey} Unique key for the listener. - * @template SCOPE,EVENTOBJ - */ -goog.events.Listenable.prototype.listenOnce; - - -/** - * Removes an event listener which was added with listen() or listenOnce(). - * - * @param {string|!goog.events.EventId<EVENTOBJ>} type The event type id. - * @param {function(this:SCOPE, EVENTOBJ):(boolean|undefined)} listener Callback - * method. - * @param {boolean=} opt_useCapture Whether to fire in capture phase - * (defaults to false). - * @param {SCOPE=} opt_listenerScope Object in whose scope to call - * the listener. - * @return {boolean} Whether any listener was removed. - * @template SCOPE,EVENTOBJ - */ -goog.events.Listenable.prototype.unlisten; - - -/** - * Removes an event listener which was added with listen() by the key - * returned by listen(). - * - * @param {goog.events.ListenableKey} key The key returned by - * listen() or listenOnce(). - * @return {boolean} Whether any listener was removed. - */ -goog.events.Listenable.prototype.unlistenByKey; - - -/** - * Dispatches an event (or event like object) and calls all listeners - * listening for events of this type. The type of the event is decided by the - * type property on the event object. - * - * If any of the listeners returns false OR calls preventDefault then this - * function will return false. If one of the capture listeners calls - * stopPropagation, then the bubble listeners won't fire. - * - * @param {goog.events.EventLike} e Event object. - * @return {boolean} If anyone called preventDefault on the event object (or - * if any of the listeners returns false) this will also return false. - */ -goog.events.Listenable.prototype.dispatchEvent; - - -/** - * Removes all listeners from this listenable. If type is specified, - * it will only remove listeners of the particular type. otherwise all - * registered listeners will be removed. - * - * @param {string=} opt_type Type of event to remove, default is to - * remove all types. - * @return {number} Number of listeners removed. - */ -goog.events.Listenable.prototype.removeAllListeners; - - -/** - * Returns the parent of this event target to use for capture/bubble - * mechanism. - * - * NOTE(chrishenry): The name reflects the original implementation of - * custom event target ({@code goog.events.EventTarget}). We decided - * that changing the name is not worth it. - * - * @return {goog.events.Listenable} The parent EventTarget or null if - * there is no parent. - */ -goog.events.Listenable.prototype.getParentEventTarget; - - -/** - * Fires all registered listeners in this listenable for the given - * type and capture mode, passing them the given eventObject. This - * does not perform actual capture/bubble. Only implementors of the - * interface should be using this. - * - * @param {string|!goog.events.EventId<EVENTOBJ>} type The type of the - * listeners to fire. - * @param {boolean} capture The capture mode of the listeners to fire. - * @param {EVENTOBJ} eventObject The event object to fire. - * @return {boolean} Whether all listeners succeeded without - * attempting to prevent default behavior. If any listener returns - * false or called goog.events.Event#preventDefault, this returns - * false. - * @template EVENTOBJ - */ -goog.events.Listenable.prototype.fireListeners; - - -/** - * Gets all listeners in this listenable for the given type and - * capture mode. - * - * @param {string|!goog.events.EventId} type The type of the listeners to fire. - * @param {boolean} capture The capture mode of the listeners to fire. - * @return {!Array<goog.events.ListenableKey>} An array of registered - * listeners. - * @template EVENTOBJ - */ -goog.events.Listenable.prototype.getListeners; - - -/** - * Gets the goog.events.ListenableKey for the event or null if no such - * listener is in use. - * - * @param {string|!goog.events.EventId<EVENTOBJ>} type The name of the event - * without the 'on' prefix. - * @param {function(this:SCOPE, EVENTOBJ):(boolean|undefined)} listener The - * listener function to get. - * @param {boolean} capture Whether the listener is a capturing listener. - * @param {SCOPE=} opt_listenerScope Object in whose scope to call the - * listener. - * @return {goog.events.ListenableKey} the found listener or null if not found. - * @template SCOPE,EVENTOBJ - */ -goog.events.Listenable.prototype.getListener; - - -/** - * Whether there is any active listeners matching the specified - * signature. If either the type or capture parameters are - * unspecified, the function will match on the remaining criteria. - * - * @param {string|!goog.events.EventId<EVENTOBJ>=} opt_type Event type. - * @param {boolean=} opt_capture Whether to check for capture or bubble - * listeners. - * @return {boolean} Whether there is any active listeners matching - * the requested type and/or capture phase. - * @template EVENTOBJ - */ -goog.events.Listenable.prototype.hasListener; - - - -/** - * An interface that describes a single registered listener. - * @interface - */ -goog.events.ListenableKey = function() {}; - - -/** - * Counter used to create a unique key - * @type {number} - * @private - */ -goog.events.ListenableKey.counter_ = 0; - - -/** - * Reserves a key to be used for ListenableKey#key field. - * @return {number} A number to be used to fill ListenableKey#key - * field. - */ -goog.events.ListenableKey.reserveKey = function() { - return ++goog.events.ListenableKey.counter_; -}; - - -/** - * The source event target. - * @type {!(Object|goog.events.Listenable|goog.events.EventTarget)} - */ -goog.events.ListenableKey.prototype.src; - - -/** - * The event type the listener is listening to. - * @type {string} - */ -goog.events.ListenableKey.prototype.type; - - -/** - * The listener function. - * @type {function(?):?|{handleEvent:function(?):?}|null} - */ -goog.events.ListenableKey.prototype.listener; - - -/** - * Whether the listener works on capture phase. - * @type {boolean} - */ -goog.events.ListenableKey.prototype.capture; - - -/** - * The 'this' object for the listener function's scope. - * @type {Object} - */ -goog.events.ListenableKey.prototype.handler; - - -/** - * A globally unique number to identify the key. - * @type {number} - */ -goog.events.ListenableKey.prototype.key; - -// Copyright 2005 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Listener object. - * @see ../demos/events.html - */ - -goog.provide('goog.events.Listener'); - -goog.require('goog.events.ListenableKey'); - - - -/** - * Simple class that stores information about a listener - * @param {!Function} listener Callback function. - * @param {Function} proxy Wrapper for the listener that patches the event. - * @param {EventTarget|goog.events.Listenable} src Source object for - * the event. - * @param {string} type Event type. - * @param {boolean} capture Whether in capture or bubble phase. - * @param {Object=} opt_handler Object in whose context to execute the callback. - * @implements {goog.events.ListenableKey} - * @constructor - */ -goog.events.Listener = function( - listener, proxy, src, type, capture, opt_handler) { - if (goog.events.Listener.ENABLE_MONITORING) { - this.creationStack = new Error().stack; - } - - /** - * Callback function. - * @type {Function} - */ - this.listener = listener; - - /** - * A wrapper over the original listener. This is used solely to - * handle native browser events (it is used to simulate the capture - * phase and to patch the event object). - * @type {Function} - */ - this.proxy = proxy; - - /** - * Object or node that callback is listening to - * @type {EventTarget|goog.events.Listenable} - */ - this.src = src; - - /** - * The event type. - * @const {string} - */ - this.type = type; - - /** - * Whether the listener is being called in the capture or bubble phase - * @const {boolean} - */ - this.capture = !!capture; - - /** - * Optional object whose context to execute the listener in - * @type {Object|undefined} - */ - this.handler = opt_handler; - - /** - * The key of the listener. - * @const {number} - * @override - */ - this.key = goog.events.ListenableKey.reserveKey(); - - /** - * Whether to remove the listener after it has been called. - * @type {boolean} - */ - this.callOnce = false; - - /** - * Whether the listener has been removed. - * @type {boolean} - */ - this.removed = false; -}; - - -/** - * @define {boolean} Whether to enable the monitoring of the - * goog.events.Listener instances. Switching on the monitoring is only - * recommended for debugging because it has a significant impact on - * performance and memory usage. If switched off, the monitoring code - * compiles down to 0 bytes. - */ -goog.define('goog.events.Listener.ENABLE_MONITORING', false); - - -/** - * If monitoring the goog.events.Listener instances is enabled, stores the - * creation stack trace of the Disposable instance. - * @type {string} - */ -goog.events.Listener.prototype.creationStack; - - -/** - * Marks this listener as removed. This also remove references held by - * this listener object (such as listener and event source). - */ -goog.events.Listener.prototype.markAsRemoved = function() { - this.removed = true; - this.listener = null; - this.proxy = null; - this.src = null; - this.handler = null; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A map of listeners that provides utility functions to - * deal with listeners on an event target. Used by - * {@code goog.events.EventTarget}. - * - * WARNING: Do not use this class from outside goog.events package. - * - * @visibility {//closure/goog/bin/sizetests:__pkg__} - * @visibility {//closure/goog/events:__pkg__} - * @visibility {//closure/goog/labs/events:__pkg__} - */ - -goog.provide('goog.events.ListenerMap'); - -goog.require('goog.array'); -goog.require('goog.events.Listener'); -goog.require('goog.object'); - - - -/** - * Creates a new listener map. - * @param {EventTarget|goog.events.Listenable} src The src object. - * @constructor - * @final - */ -goog.events.ListenerMap = function(src) { - /** @type {EventTarget|goog.events.Listenable} */ - this.src = src; - - /** - * Maps of event type to an array of listeners. - * @type {Object<string, !Array<!goog.events.Listener>>} - */ - this.listeners = {}; - - /** - * The count of types in this map that have registered listeners. - * @private {number} - */ - this.typeCount_ = 0; -}; - - -/** - * @return {number} The count of event types in this map that actually - * have registered listeners. - */ -goog.events.ListenerMap.prototype.getTypeCount = function() { - return this.typeCount_; -}; - - -/** - * @return {number} Total number of registered listeners. - */ -goog.events.ListenerMap.prototype.getListenerCount = function() { - var count = 0; - for (var type in this.listeners) { - count += this.listeners[type].length; - } - return count; -}; - - -/** - * Adds an event listener. A listener can only be added once to an - * object and if it is added again the key for the listener is - * returned. - * - * Note that a one-off listener will not change an existing listener, - * if any. On the other hand a normal listener will change existing - * one-off listener to become a normal listener. - * - * @param {string|!goog.events.EventId} type The listener event type. - * @param {!Function} listener This listener callback method. - * @param {boolean} callOnce Whether the listener is a one-off - * listener. - * @param {boolean=} opt_useCapture The capture mode of the listener. - * @param {Object=} opt_listenerScope Object in whose scope to call the - * listener. - * @return {goog.events.ListenableKey} Unique key for the listener. - */ -goog.events.ListenerMap.prototype.add = function( - type, listener, callOnce, opt_useCapture, opt_listenerScope) { - var typeStr = type.toString(); - var listenerArray = this.listeners[typeStr]; - if (!listenerArray) { - listenerArray = this.listeners[typeStr] = []; - this.typeCount_++; - } - - var listenerObj; - var index = goog.events.ListenerMap.findListenerIndex_( - listenerArray, listener, opt_useCapture, opt_listenerScope); - if (index > -1) { - listenerObj = listenerArray[index]; - if (!callOnce) { - // Ensure that, if there is an existing callOnce listener, it is no - // longer a callOnce listener. - listenerObj.callOnce = false; - } - } else { - listenerObj = new goog.events.Listener( - listener, null, this.src, typeStr, !!opt_useCapture, opt_listenerScope); - listenerObj.callOnce = callOnce; - listenerArray.push(listenerObj); - } - return listenerObj; -}; - - -/** - * Removes a matching listener. - * @param {string|!goog.events.EventId} type The listener event type. - * @param {!Function} listener This listener callback method. - * @param {boolean=} opt_useCapture The capture mode of the listener. - * @param {Object=} opt_listenerScope Object in whose scope to call the - * listener. - * @return {boolean} Whether any listener was removed. - */ -goog.events.ListenerMap.prototype.remove = function( - type, listener, opt_useCapture, opt_listenerScope) { - var typeStr = type.toString(); - if (!(typeStr in this.listeners)) { - return false; - } - - var listenerArray = this.listeners[typeStr]; - var index = goog.events.ListenerMap.findListenerIndex_( - listenerArray, listener, opt_useCapture, opt_listenerScope); - if (index > -1) { - var listenerObj = listenerArray[index]; - listenerObj.markAsRemoved(); - goog.array.removeAt(listenerArray, index); - if (listenerArray.length == 0) { - delete this.listeners[typeStr]; - this.typeCount_--; - } - return true; - } - return false; -}; - - -/** - * Removes the given listener object. - * @param {goog.events.ListenableKey} listener The listener to remove. - * @return {boolean} Whether the listener is removed. - */ -goog.events.ListenerMap.prototype.removeByKey = function(listener) { - var type = listener.type; - if (!(type in this.listeners)) { - return false; - } - - var removed = goog.array.remove(this.listeners[type], listener); - if (removed) { - listener.markAsRemoved(); - if (this.listeners[type].length == 0) { - delete this.listeners[type]; - this.typeCount_--; - } - } - return removed; -}; - - -/** - * Removes all listeners from this map. If opt_type is provided, only - * listeners that match the given type are removed. - * @param {string|!goog.events.EventId=} opt_type Type of event to remove. - * @return {number} Number of listeners removed. - */ -goog.events.ListenerMap.prototype.removeAll = function(opt_type) { - var typeStr = opt_type && opt_type.toString(); - var count = 0; - for (var type in this.listeners) { - if (!typeStr || type == typeStr) { - var listenerArray = this.listeners[type]; - for (var i = 0; i < listenerArray.length; i++) { - ++count; - listenerArray[i].markAsRemoved(); - } - delete this.listeners[type]; - this.typeCount_--; - } - } - return count; -}; - - -/** - * Gets all listeners that match the given type and capture mode. The - * returned array is a copy (but the listener objects are not). - * @param {string|!goog.events.EventId} type The type of the listeners - * to retrieve. - * @param {boolean} capture The capture mode of the listeners to retrieve. - * @return {!Array<goog.events.ListenableKey>} An array of matching - * listeners. - */ -goog.events.ListenerMap.prototype.getListeners = function(type, capture) { - var listenerArray = this.listeners[type.toString()]; - var rv = []; - if (listenerArray) { - for (var i = 0; i < listenerArray.length; ++i) { - var listenerObj = listenerArray[i]; - if (listenerObj.capture == capture) { - rv.push(listenerObj); - } - } - } - return rv; -}; - - -/** - * Gets the goog.events.ListenableKey for the event or null if no such - * listener is in use. - * - * @param {string|!goog.events.EventId} type The type of the listener - * to retrieve. - * @param {!Function} listener The listener function to get. - * @param {boolean} capture Whether the listener is a capturing listener. - * @param {Object=} opt_listenerScope Object in whose scope to call the - * listener. - * @return {goog.events.ListenableKey} the found listener or null if not found. - */ -goog.events.ListenerMap.prototype.getListener = function( - type, listener, capture, opt_listenerScope) { - var listenerArray = this.listeners[type.toString()]; - var i = -1; - if (listenerArray) { - i = goog.events.ListenerMap.findListenerIndex_( - listenerArray, listener, capture, opt_listenerScope); - } - return i > -1 ? listenerArray[i] : null; -}; - - -/** - * Whether there is a matching listener. If either the type or capture - * parameters are unspecified, the function will match on the - * remaining criteria. - * - * @param {string|!goog.events.EventId=} opt_type The type of the listener. - * @param {boolean=} opt_capture The capture mode of the listener. - * @return {boolean} Whether there is an active listener matching - * the requested type and/or capture phase. - */ -goog.events.ListenerMap.prototype.hasListener = function( - opt_type, opt_capture) { - var hasType = goog.isDef(opt_type); - var typeStr = hasType ? opt_type.toString() : ''; - var hasCapture = goog.isDef(opt_capture); - - return goog.object.some( - this.listeners, function(listenerArray, type) { - for (var i = 0; i < listenerArray.length; ++i) { - if ((!hasType || listenerArray[i].type == typeStr) && - (!hasCapture || listenerArray[i].capture == opt_capture)) { - return true; - } - } - - return false; - }); -}; - - -/** - * Finds the index of a matching goog.events.Listener in the given - * listenerArray. - * @param {!Array<!goog.events.Listener>} listenerArray Array of listener. - * @param {!Function} listener The listener function. - * @param {boolean=} opt_useCapture The capture flag for the listener. - * @param {Object=} opt_listenerScope The listener scope. - * @return {number} The index of the matching listener within the - * listenerArray. - * @private - */ -goog.events.ListenerMap.findListenerIndex_ = function( - listenerArray, listener, opt_useCapture, opt_listenerScope) { - for (var i = 0; i < listenerArray.length; ++i) { - var listenerObj = listenerArray[i]; - if (!listenerObj.removed && - listenerObj.listener == listener && - listenerObj.capture == !!opt_useCapture && - listenerObj.handler == opt_listenerScope) { - return i; - } - } - return -1; -}; - -// Copyright 2005 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview An event manager for both native browser event - * targets and custom JavaScript event targets - * ({@code goog.events.Listenable}). This provides an abstraction - * over browsers' event systems. - * - * It also provides a simulation of W3C event model's capture phase in - * Internet Explorer (IE 8 and below). Caveat: the simulation does not - * interact well with listeners registered directly on the elements - * (bypassing goog.events) or even with listeners registered via - * goog.events in a separate JS binary. In these cases, we provide - * no ordering guarantees. - * - * The listeners will receive a "patched" event object. Such event object - * contains normalized values for certain event properties that differs in - * different browsers. - * - * Example usage: - * <pre> - * goog.events.listen(myNode, 'click', function(e) { alert('woo') }); - * goog.events.listen(myNode, 'mouseover', mouseHandler, true); - * goog.events.unlisten(myNode, 'mouseover', mouseHandler, true); - * goog.events.removeAll(myNode); - * </pre> - * - * in IE and event object patching] - * @author arv@google.com (Erik Arvidsson) - * - * @see ../demos/events.html - * @see ../demos/event-propagation.html - * @see ../demos/stopevent.html - */ - -// IMPLEMENTATION NOTES: -// goog.events stores an auxiliary data structure on each EventTarget -// source being listened on. This allows us to take advantage of GC, -// having the data structure GC'd when the EventTarget is GC'd. This -// GC behavior is equivalent to using W3C DOM Events directly. - -goog.provide('goog.events'); -goog.provide('goog.events.CaptureSimulationMode'); -goog.provide('goog.events.Key'); -goog.provide('goog.events.ListenableType'); - -goog.require('goog.asserts'); -goog.require('goog.debug.entryPointRegistry'); -goog.require('goog.events.BrowserEvent'); -goog.require('goog.events.BrowserFeature'); -goog.require('goog.events.Listenable'); -goog.require('goog.events.ListenerMap'); - -goog.forwardDeclare('goog.debug.ErrorHandler'); -goog.forwardDeclare('goog.events.EventWrapper'); - - -/** - * @typedef {number|goog.events.ListenableKey} - */ -goog.events.Key; - - -/** - * @typedef {EventTarget|goog.events.Listenable} - */ -goog.events.ListenableType; - - -/** - * Property name on a native event target for the listener map - * associated with the event target. - * @private @const {string} - */ -goog.events.LISTENER_MAP_PROP_ = 'closure_lm_' + ((Math.random() * 1e6) | 0); - - -/** - * String used to prepend to IE event types. - * @const - * @private - */ -goog.events.onString_ = 'on'; - - -/** - * Map of computed "on<eventname>" strings for IE event types. Caching - * this removes an extra object allocation in goog.events.listen which - * improves IE6 performance. - * @const - * @dict - * @private - */ -goog.events.onStringMap_ = {}; - - -/** - * @enum {number} Different capture simulation mode for IE8-. - */ -goog.events.CaptureSimulationMode = { - /** - * Does not perform capture simulation. Will asserts in IE8- when you - * add capture listeners. - */ - OFF_AND_FAIL: 0, - - /** - * Does not perform capture simulation, silently ignore capture - * listeners. - */ - OFF_AND_SILENT: 1, - - /** - * Performs capture simulation. - */ - ON: 2 -}; - - -/** - * @define {number} The capture simulation mode for IE8-. By default, - * this is ON. - */ -goog.define('goog.events.CAPTURE_SIMULATION_MODE', 2); - - -/** - * Estimated count of total native listeners. - * @private {number} - */ -goog.events.listenerCountEstimate_ = 0; - - -/** - * Adds an event listener for a specific event on a native event - * target (such as a DOM element) or an object that has implemented - * {@link goog.events.Listenable}. A listener can only be added once - * to an object and if it is added again the key for the listener is - * returned. Note that if the existing listener is a one-off listener - * (registered via listenOnce), it will no longer be a one-off - * listener after a call to listen(). - * - * @param {EventTarget|goog.events.Listenable} src The node to listen - * to events on. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type or array of event types. - * @param {function(this:T, EVENTOBJ):?|{handleEvent:function(?):?}|null} - * listener Callback method, or an object with a handleEvent function. - * WARNING: passing an Object is now softly deprecated. - * @param {boolean=} opt_capt Whether to fire in capture phase (defaults to - * false). - * @param {T=} opt_handler Element in whose scope to call the listener. - * @return {goog.events.Key} Unique key for the listener. - * @template T,EVENTOBJ - */ -goog.events.listen = function(src, type, listener, opt_capt, opt_handler) { - if (goog.isArray(type)) { - for (var i = 0; i < type.length; i++) { - goog.events.listen(src, type[i], listener, opt_capt, opt_handler); - } - return null; - } - - listener = goog.events.wrapListener(listener); - if (goog.events.Listenable.isImplementedBy(src)) { - return src.listen( - /** @type {string|!goog.events.EventId} */ (type), - listener, opt_capt, opt_handler); - } else { - return goog.events.listen_( - /** @type {!EventTarget} */ (src), - /** @type {string|!goog.events.EventId} */ (type), - listener, /* callOnce */ false, opt_capt, opt_handler); - } -}; - - -/** - * Adds an event listener for a specific event on a native event - * target. A listener can only be added once to an object and if it - * is added again the key for the listener is returned. - * - * Note that a one-off listener will not change an existing listener, - * if any. On the other hand a normal listener will change existing - * one-off listener to become a normal listener. - * - * @param {EventTarget} src The node to listen to events on. - * @param {string|!goog.events.EventId} type Event type. - * @param {!Function} listener Callback function. - * @param {boolean} callOnce Whether the listener is a one-off - * listener or otherwise. - * @param {boolean=} opt_capt Whether to fire in capture phase (defaults to - * false). - * @param {Object=} opt_handler Element in whose scope to call the listener. - * @return {goog.events.ListenableKey} Unique key for the listener. - * @private - */ -goog.events.listen_ = function( - src, type, listener, callOnce, opt_capt, opt_handler) { - if (!type) { - throw Error('Invalid event type'); - } - - var capture = !!opt_capt; - if (capture && !goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) { - if (goog.events.CAPTURE_SIMULATION_MODE == - goog.events.CaptureSimulationMode.OFF_AND_FAIL) { - goog.asserts.fail('Can not register capture listener in IE8-.'); - return null; - } else if (goog.events.CAPTURE_SIMULATION_MODE == - goog.events.CaptureSimulationMode.OFF_AND_SILENT) { - return null; - } - } - - var listenerMap = goog.events.getListenerMap_(src); - if (!listenerMap) { - src[goog.events.LISTENER_MAP_PROP_] = listenerMap = - new goog.events.ListenerMap(src); - } - - var listenerObj = listenerMap.add( - type, listener, callOnce, opt_capt, opt_handler); - - // If the listenerObj already has a proxy, it has been set up - // previously. We simply return. - if (listenerObj.proxy) { - return listenerObj; - } - - var proxy = goog.events.getProxy(); - listenerObj.proxy = proxy; - - proxy.src = src; - proxy.listener = listenerObj; - - // Attach the proxy through the browser's API - if (src.addEventListener) { - src.addEventListener(type.toString(), proxy, capture); - } else if (src.attachEvent) { - // The else if above used to be an unconditional else. It would call - // exception on IE11, spoiling the day of some callers. The previous - // incarnation of this code, from 2007, indicates that it replaced an - // earlier still version that caused excess allocations on IE6. - src.attachEvent(goog.events.getOnString_(type.toString()), proxy); - } else { - throw Error('addEventListener and attachEvent are unavailable.'); - } - - goog.events.listenerCountEstimate_++; - return listenerObj; -}; - - -/** - * Helper function for returning a proxy function. - * @return {!Function} A new or reused function object. - */ -goog.events.getProxy = function() { - var proxyCallbackFunction = goog.events.handleBrowserEvent_; - // Use a local var f to prevent one allocation. - var f = goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT ? - function(eventObject) { - return proxyCallbackFunction.call(f.src, f.listener, eventObject); - } : - function(eventObject) { - var v = proxyCallbackFunction.call(f.src, f.listener, eventObject); - // NOTE(chrishenry): In IE, we hack in a capture phase. However, if - // there is inline event handler which tries to prevent default (for - // example <a href="..." onclick="return false">...</a>) in a - // descendant element, the prevent default will be overridden - // by this listener if this listener were to return true. Hence, we - // return undefined. - if (!v) return v; - }; - return f; -}; - - -/** - * Adds an event listener for a specific event on a native event - * target (such as a DOM element) or an object that has implemented - * {@link goog.events.Listenable}. After the event has fired the event - * listener is removed from the target. - * - * If an existing listener already exists, listenOnce will do - * nothing. In particular, if the listener was previously registered - * via listen(), listenOnce() will not turn the listener into a - * one-off listener. Similarly, if there is already an existing - * one-off listener, listenOnce does not modify the listeners (it is - * still a once listener). - * - * @param {EventTarget|goog.events.Listenable} src The node to listen - * to events on. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type or array of event types. - * @param {function(this:T, EVENTOBJ):?|{handleEvent:function(?):?}|null} - * listener Callback method. - * @param {boolean=} opt_capt Fire in capture phase?. - * @param {T=} opt_handler Element in whose scope to call the listener. - * @return {goog.events.Key} Unique key for the listener. - * @template T,EVENTOBJ - */ -goog.events.listenOnce = function(src, type, listener, opt_capt, opt_handler) { - if (goog.isArray(type)) { - for (var i = 0; i < type.length; i++) { - goog.events.listenOnce(src, type[i], listener, opt_capt, opt_handler); - } - return null; - } - - listener = goog.events.wrapListener(listener); - if (goog.events.Listenable.isImplementedBy(src)) { - return src.listenOnce( - /** @type {string|!goog.events.EventId} */ (type), - listener, opt_capt, opt_handler); - } else { - return goog.events.listen_( - /** @type {!EventTarget} */ (src), - /** @type {string|!goog.events.EventId} */ (type), - listener, /* callOnce */ true, opt_capt, opt_handler); - } -}; - - -/** - * Adds an event listener with a specific event wrapper on a DOM Node or an - * object that has implemented {@link goog.events.Listenable}. A listener can - * only be added once to an object. - * - * @param {EventTarget|goog.events.Listenable} src The target to - * listen to events on. - * @param {goog.events.EventWrapper} wrapper Event wrapper to use. - * @param {function(this:T, ?):?|{handleEvent:function(?):?}|null} listener - * Callback method, or an object with a handleEvent function. - * @param {boolean=} opt_capt Whether to fire in capture phase (defaults to - * false). - * @param {T=} opt_handler Element in whose scope to call the listener. - * @template T - */ -goog.events.listenWithWrapper = function(src, wrapper, listener, opt_capt, - opt_handler) { - wrapper.listen(src, listener, opt_capt, opt_handler); -}; - - -/** - * Removes an event listener which was added with listen(). - * - * @param {EventTarget|goog.events.Listenable} src The target to stop - * listening to events on. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type or array of event types to unlisten to. - * @param {function(?):?|{handleEvent:function(?):?}|null} listener The - * listener function to remove. - * @param {boolean=} opt_capt In DOM-compliant browsers, this determines - * whether the listener is fired during the capture or bubble phase of the - * event. - * @param {Object=} opt_handler Element in whose scope to call the listener. - * @return {?boolean} indicating whether the listener was there to remove. - * @template EVENTOBJ - */ -goog.events.unlisten = function(src, type, listener, opt_capt, opt_handler) { - if (goog.isArray(type)) { - for (var i = 0; i < type.length; i++) { - goog.events.unlisten(src, type[i], listener, opt_capt, opt_handler); - } - return null; - } - - listener = goog.events.wrapListener(listener); - if (goog.events.Listenable.isImplementedBy(src)) { - return src.unlisten( - /** @type {string|!goog.events.EventId} */ (type), - listener, opt_capt, opt_handler); - } - - if (!src) { - // TODO(chrishenry): We should tighten the API to only accept - // non-null objects, or add an assertion here. - return false; - } - - var capture = !!opt_capt; - var listenerMap = goog.events.getListenerMap_( - /** @type {!EventTarget} */ (src)); - if (listenerMap) { - var listenerObj = listenerMap.getListener( - /** @type {string|!goog.events.EventId} */ (type), - listener, capture, opt_handler); - if (listenerObj) { - return goog.events.unlistenByKey(listenerObj); - } - } - - return false; -}; - - -/** - * Removes an event listener which was added with listen() by the key - * returned by listen(). - * - * @param {goog.events.Key} key The key returned by listen() for this - * event listener. - * @return {boolean} indicating whether the listener was there to remove. - */ -goog.events.unlistenByKey = function(key) { - // TODO(chrishenry): Remove this check when tests that rely on this - // are fixed. - if (goog.isNumber(key)) { - return false; - } - - var listener = key; - if (!listener || listener.removed) { - return false; - } - - var src = listener.src; - if (goog.events.Listenable.isImplementedBy(src)) { - return src.unlistenByKey(listener); - } - - var type = listener.type; - var proxy = listener.proxy; - if (src.removeEventListener) { - src.removeEventListener(type, proxy, listener.capture); - } else if (src.detachEvent) { - src.detachEvent(goog.events.getOnString_(type), proxy); - } - goog.events.listenerCountEstimate_--; - - var listenerMap = goog.events.getListenerMap_( - /** @type {!EventTarget} */ (src)); - // TODO(chrishenry): Try to remove this conditional and execute the - // first branch always. This should be safe. - if (listenerMap) { - listenerMap.removeByKey(listener); - if (listenerMap.getTypeCount() == 0) { - // Null the src, just because this is simple to do (and useful - // for IE <= 7). - listenerMap.src = null; - // We don't use delete here because IE does not allow delete - // on a window object. - src[goog.events.LISTENER_MAP_PROP_] = null; - } - } else { - listener.markAsRemoved(); - } - - return true; -}; - - -/** - * Removes an event listener which was added with listenWithWrapper(). - * - * @param {EventTarget|goog.events.Listenable} src The target to stop - * listening to events on. - * @param {goog.events.EventWrapper} wrapper Event wrapper to use. - * @param {function(?):?|{handleEvent:function(?):?}|null} listener The - * listener function to remove. - * @param {boolean=} opt_capt In DOM-compliant browsers, this determines - * whether the listener is fired during the capture or bubble phase of the - * event. - * @param {Object=} opt_handler Element in whose scope to call the listener. - */ -goog.events.unlistenWithWrapper = function(src, wrapper, listener, opt_capt, - opt_handler) { - wrapper.unlisten(src, listener, opt_capt, opt_handler); -}; - - -/** - * Removes all listeners from an object. You can also optionally - * remove listeners of a particular type. - * - * @param {Object|undefined} obj Object to remove listeners from. Must be an - * EventTarget or a goog.events.Listenable. - * @param {string|!goog.events.EventId=} opt_type Type of event to remove. - * Default is all types. - * @return {number} Number of listeners removed. - */ -goog.events.removeAll = function(obj, opt_type) { - // TODO(chrishenry): Change the type of obj to - // (!EventTarget|!goog.events.Listenable). - - if (!obj) { - return 0; - } - - if (goog.events.Listenable.isImplementedBy(obj)) { - return obj.removeAllListeners(opt_type); - } - - var listenerMap = goog.events.getListenerMap_( - /** @type {!EventTarget} */ (obj)); - if (!listenerMap) { - return 0; - } - - var count = 0; - var typeStr = opt_type && opt_type.toString(); - for (var type in listenerMap.listeners) { - if (!typeStr || type == typeStr) { - // Clone so that we don't need to worry about unlistenByKey - // changing the content of the ListenerMap. - var listeners = listenerMap.listeners[type].concat(); - for (var i = 0; i < listeners.length; ++i) { - if (goog.events.unlistenByKey(listeners[i])) { - ++count; - } - } - } - } - return count; -}; - - -/** - * Gets the listeners for a given object, type and capture phase. - * - * @param {Object} obj Object to get listeners for. - * @param {string|!goog.events.EventId} type Event type. - * @param {boolean} capture Capture phase?. - * @return {Array<goog.events.Listener>} Array of listener objects. - */ -goog.events.getListeners = function(obj, type, capture) { - if (goog.events.Listenable.isImplementedBy(obj)) { - return obj.getListeners(type, capture); - } else { - if (!obj) { - // TODO(chrishenry): We should tighten the API to accept - // !EventTarget|goog.events.Listenable, and add an assertion here. - return []; - } - - var listenerMap = goog.events.getListenerMap_( - /** @type {!EventTarget} */ (obj)); - return listenerMap ? listenerMap.getListeners(type, capture) : []; - } -}; - - -/** - * Gets the goog.events.Listener for the event or null if no such listener is - * in use. - * - * @param {EventTarget|goog.events.Listenable} src The target from - * which to get listeners. - * @param {?string|!goog.events.EventId<EVENTOBJ>} type The type of the event. - * @param {function(EVENTOBJ):?|{handleEvent:function(?):?}|null} listener The - * listener function to get. - * @param {boolean=} opt_capt In DOM-compliant browsers, this determines - * whether the listener is fired during the - * capture or bubble phase of the event. - * @param {Object=} opt_handler Element in whose scope to call the listener. - * @return {goog.events.ListenableKey} the found listener or null if not found. - * @template EVENTOBJ - */ -goog.events.getListener = function(src, type, listener, opt_capt, opt_handler) { - // TODO(chrishenry): Change type from ?string to string, or add assertion. - type = /** @type {string} */ (type); - listener = goog.events.wrapListener(listener); - var capture = !!opt_capt; - if (goog.events.Listenable.isImplementedBy(src)) { - return src.getListener(type, listener, capture, opt_handler); - } - - if (!src) { - // TODO(chrishenry): We should tighten the API to only accept - // non-null objects, or add an assertion here. - return null; - } - - var listenerMap = goog.events.getListenerMap_( - /** @type {!EventTarget} */ (src)); - if (listenerMap) { - return listenerMap.getListener(type, listener, capture, opt_handler); - } - return null; -}; - - -/** - * Returns whether an event target has any active listeners matching the - * specified signature. If either the type or capture parameters are - * unspecified, the function will match on the remaining criteria. - * - * @param {EventTarget|goog.events.Listenable} obj Target to get - * listeners for. - * @param {string|!goog.events.EventId=} opt_type Event type. - * @param {boolean=} opt_capture Whether to check for capture or bubble-phase - * listeners. - * @return {boolean} Whether an event target has one or more listeners matching - * the requested type and/or capture phase. - */ -goog.events.hasListener = function(obj, opt_type, opt_capture) { - if (goog.events.Listenable.isImplementedBy(obj)) { - return obj.hasListener(opt_type, opt_capture); - } - - var listenerMap = goog.events.getListenerMap_( - /** @type {!EventTarget} */ (obj)); - return !!listenerMap && listenerMap.hasListener(opt_type, opt_capture); -}; - - -/** - * Provides a nice string showing the normalized event objects public members - * @param {Object} e Event Object. - * @return {string} String of the public members of the normalized event object. - */ -goog.events.expose = function(e) { - var str = []; - for (var key in e) { - if (e[key] && e[key].id) { - str.push(key + ' = ' + e[key] + ' (' + e[key].id + ')'); - } else { - str.push(key + ' = ' + e[key]); - } - } - return str.join('\n'); -}; - - -/** - * Returns a string with on prepended to the specified type. This is used for IE - * which expects "on" to be prepended. This function caches the string in order - * to avoid extra allocations in steady state. - * @param {string} type Event type. - * @return {string} The type string with 'on' prepended. - * @private - */ -goog.events.getOnString_ = function(type) { - if (type in goog.events.onStringMap_) { - return goog.events.onStringMap_[type]; - } - return goog.events.onStringMap_[type] = goog.events.onString_ + type; -}; - - -/** - * Fires an object's listeners of a particular type and phase - * - * @param {Object} obj Object whose listeners to call. - * @param {string|!goog.events.EventId} type Event type. - * @param {boolean} capture Which event phase. - * @param {Object} eventObject Event object to be passed to listener. - * @return {boolean} True if all listeners returned true else false. - */ -goog.events.fireListeners = function(obj, type, capture, eventObject) { - if (goog.events.Listenable.isImplementedBy(obj)) { - return obj.fireListeners(type, capture, eventObject); - } - - return goog.events.fireListeners_(obj, type, capture, eventObject); -}; - - -/** - * Fires an object's listeners of a particular type and phase. - * @param {Object} obj Object whose listeners to call. - * @param {string|!goog.events.EventId} type Event type. - * @param {boolean} capture Which event phase. - * @param {Object} eventObject Event object to be passed to listener. - * @return {boolean} True if all listeners returned true else false. - * @private - */ -goog.events.fireListeners_ = function(obj, type, capture, eventObject) { - /** @type {boolean} */ - var retval = true; - - var listenerMap = goog.events.getListenerMap_( - /** @type {EventTarget} */ (obj)); - if (listenerMap) { - // TODO(chrishenry): Original code avoids array creation when there - // is no listener, so we do the same. If this optimization turns - // out to be not required, we can replace this with - // listenerMap.getListeners(type, capture) instead, which is simpler. - var listenerArray = listenerMap.listeners[type.toString()]; - if (listenerArray) { - listenerArray = listenerArray.concat(); - for (var i = 0; i < listenerArray.length; i++) { - var listener = listenerArray[i]; - // We might not have a listener if the listener was removed. - if (listener && listener.capture == capture && !listener.removed) { - var result = goog.events.fireListener(listener, eventObject); - retval = retval && (result !== false); - } - } - } - } - return retval; -}; - - -/** - * Fires a listener with a set of arguments - * - * @param {goog.events.Listener} listener The listener object to call. - * @param {Object} eventObject The event object to pass to the listener. - * @return {boolean} Result of listener. - */ -goog.events.fireListener = function(listener, eventObject) { - var listenerFn = listener.listener; - var listenerHandler = listener.handler || listener.src; - - if (listener.callOnce) { - goog.events.unlistenByKey(listener); - } - return listenerFn.call(listenerHandler, eventObject); -}; - - -/** - * Gets the total number of listeners currently in the system. - * @return {number} Number of listeners. - * @deprecated This returns estimated count, now that Closure no longer - * stores a central listener registry. We still return an estimation - * to keep existing listener-related tests passing. In the near future, - * this function will be removed. - */ -goog.events.getTotalListenerCount = function() { - return goog.events.listenerCountEstimate_; -}; - - -/** - * Dispatches an event (or event like object) and calls all listeners - * listening for events of this type. The type of the event is decided by the - * type property on the event object. - * - * If any of the listeners returns false OR calls preventDefault then this - * function will return false. If one of the capture listeners calls - * stopPropagation, then the bubble listeners won't fire. - * - * @param {goog.events.Listenable} src The event target. - * @param {goog.events.EventLike} e Event object. - * @return {boolean} If anyone called preventDefault on the event object (or - * if any of the handlers returns false) this will also return false. - * If there are no handlers, or if all handlers return true, this returns - * true. - */ -goog.events.dispatchEvent = function(src, e) { - goog.asserts.assert( - goog.events.Listenable.isImplementedBy(src), - 'Can not use goog.events.dispatchEvent with ' + - 'non-goog.events.Listenable instance.'); - return src.dispatchEvent(e); -}; - - -/** - * Installs exception protection for the browser event entry point using the - * given error handler. - * - * @param {goog.debug.ErrorHandler} errorHandler Error handler with which to - * protect the entry point. - */ -goog.events.protectBrowserEventEntryPoint = function(errorHandler) { - goog.events.handleBrowserEvent_ = errorHandler.protectEntryPoint( - goog.events.handleBrowserEvent_); -}; - - -/** - * Handles an event and dispatches it to the correct listeners. This - * function is a proxy for the real listener the user specified. - * - * @param {goog.events.Listener} listener The listener object. - * @param {Event=} opt_evt Optional event object that gets passed in via the - * native event handlers. - * @return {boolean} Result of the event handler. - * @this {EventTarget} The object or Element that fired the event. - * @private - */ -goog.events.handleBrowserEvent_ = function(listener, opt_evt) { - if (listener.removed) { - return true; - } - - // Synthesize event propagation if the browser does not support W3C - // event model. - if (!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) { - var ieEvent = opt_evt || - /** @type {Event} */ (goog.getObjectByName('window.event')); - var evt = new goog.events.BrowserEvent(ieEvent, this); - /** @type {boolean} */ - var retval = true; - - if (goog.events.CAPTURE_SIMULATION_MODE == - goog.events.CaptureSimulationMode.ON) { - // If we have not marked this event yet, we should perform capture - // simulation. - if (!goog.events.isMarkedIeEvent_(ieEvent)) { - goog.events.markIeEvent_(ieEvent); - - var ancestors = []; - for (var parent = evt.currentTarget; parent; - parent = parent.parentNode) { - ancestors.push(parent); - } - - // Fire capture listeners. - var type = listener.type; - for (var i = ancestors.length - 1; !evt.propagationStopped_ && i >= 0; - i--) { - evt.currentTarget = ancestors[i]; - var result = goog.events.fireListeners_(ancestors[i], type, true, evt); - retval = retval && result; - } - - // Fire bubble listeners. - // - // We can technically rely on IE to perform bubble event - // propagation. However, it turns out that IE fires events in - // opposite order of attachEvent registration, which broke - // some code and tests that rely on the order. (While W3C DOM - // Level 2 Events TR leaves the event ordering unspecified, - // modern browsers and W3C DOM Level 3 Events Working Draft - // actually specify the order as the registration order.) - for (var i = 0; !evt.propagationStopped_ && i < ancestors.length; i++) { - evt.currentTarget = ancestors[i]; - var result = goog.events.fireListeners_(ancestors[i], type, false, evt); - retval = retval && result; - } - } - } else { - retval = goog.events.fireListener(listener, evt); - } - return retval; - } - - // Otherwise, simply fire the listener. - return goog.events.fireListener( - listener, new goog.events.BrowserEvent(opt_evt, this)); -}; - - -/** - * This is used to mark the IE event object so we do not do the Closure pass - * twice for a bubbling event. - * @param {Event} e The IE browser event. - * @private - */ -goog.events.markIeEvent_ = function(e) { - // Only the keyCode and the returnValue can be changed. We use keyCode for - // non keyboard events. - // event.returnValue is a bit more tricky. It is undefined by default. A - // boolean false prevents the default action. In a window.onbeforeunload and - // the returnValue is non undefined it will be alerted. However, we will only - // modify the returnValue for keyboard events. We can get a problem if non - // closure events sets the keyCode or the returnValue - - var useReturnValue = false; - - if (e.keyCode == 0) { - // We cannot change the keyCode in case that srcElement is input[type=file]. - // We could test that that is the case but that would allocate 3 objects. - // If we use try/catch we will only allocate extra objects in the case of a - // failure. - /** @preserveTry */ - try { - e.keyCode = -1; - return; - } catch (ex) { - useReturnValue = true; - } - } - - if (useReturnValue || - /** @type {boolean|undefined} */ (e.returnValue) == undefined) { - e.returnValue = true; - } -}; - - -/** - * This is used to check if an IE event has already been handled by the Closure - * system so we do not do the Closure pass twice for a bubbling event. - * @param {Event} e The IE browser event. - * @return {boolean} True if the event object has been marked. - * @private - */ -goog.events.isMarkedIeEvent_ = function(e) { - return e.keyCode < 0 || e.returnValue != undefined; -}; - - -/** - * Counter to create unique event ids. - * @private {number} - */ -goog.events.uniqueIdCounter_ = 0; - - -/** - * Creates a unique event id. - * - * @param {string} identifier The identifier. - * @return {string} A unique identifier. - * @idGenerator - */ -goog.events.getUniqueId = function(identifier) { - return identifier + '_' + goog.events.uniqueIdCounter_++; -}; - - -/** - * @param {EventTarget} src The source object. - * @return {goog.events.ListenerMap} A listener map for the given - * source object, or null if none exists. - * @private - */ -goog.events.getListenerMap_ = function(src) { - var listenerMap = src[goog.events.LISTENER_MAP_PROP_]; - // IE serializes the property as well (e.g. when serializing outer - // HTML). So we must check that the value is of the correct type. - return listenerMap instanceof goog.events.ListenerMap ? listenerMap : null; -}; - - -/** - * Expando property for listener function wrapper for Object with - * handleEvent. - * @private @const {string} - */ -goog.events.LISTENER_WRAPPER_PROP_ = '__closure_events_fn_' + - ((Math.random() * 1e9) >>> 0); - - -/** - * @param {Object|Function} listener The listener function or an - * object that contains handleEvent method. - * @return {!Function} Either the original function or a function that - * calls obj.handleEvent. If the same listener is passed to this - * function more than once, the same function is guaranteed to be - * returned. - */ -goog.events.wrapListener = function(listener) { - goog.asserts.assert(listener, 'Listener can not be null.'); - - if (goog.isFunction(listener)) { - return listener; - } - - goog.asserts.assert( - listener.handleEvent, 'An object listener must have handleEvent method.'); - if (!listener[goog.events.LISTENER_WRAPPER_PROP_]) { - listener[goog.events.LISTENER_WRAPPER_PROP_] = - function(e) { return listener.handleEvent(e); }; - } - return listener[goog.events.LISTENER_WRAPPER_PROP_]; -}; - - -// Register the browser event handler as an entry point, so that -// it can be monitored for exception handling, etc. -goog.debug.entryPointRegistry.register( - /** - * @param {function(!Function): !Function} transformer The transforming - * function. - */ - function(transformer) { - goog.events.handleBrowserEvent_ = transformer( - goog.events.handleBrowserEvent_); - }); - -// Copyright 2005 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A disposable implementation of a custom - * listenable/event target. See also: documentation for - * {@code goog.events.Listenable}. - * - * @author arv@google.com (Erik Arvidsson) [Original implementation] - * @see ../demos/eventtarget.html - * @see goog.events.Listenable - */ - -goog.provide('goog.events.EventTarget'); - -goog.require('goog.Disposable'); -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.events.Listenable'); -goog.require('goog.events.ListenerMap'); -goog.require('goog.object'); - - - -/** - * An implementation of {@code goog.events.Listenable} with full W3C - * EventTarget-like support (capture/bubble mechanism, stopping event - * propagation, preventing default actions). - * - * You may subclass this class to turn your class into a Listenable. - * - * Unless propagation is stopped, an event dispatched by an - * EventTarget will bubble to the parent returned by - * {@code getParentEventTarget}. To set the parent, call - * {@code setParentEventTarget}. Subclasses that don't support - * changing the parent can override the setter to throw an error. - * - * Example usage: - * <pre> - * var source = new goog.events.EventTarget(); - * function handleEvent(e) { - * alert('Type: ' + e.type + '; Target: ' + e.target); - * } - * source.listen('foo', handleEvent); - * // Or: goog.events.listen(source, 'foo', handleEvent); - * ... - * source.dispatchEvent('foo'); // will call handleEvent - * ... - * source.unlisten('foo', handleEvent); - * // Or: goog.events.unlisten(source, 'foo', handleEvent); - * </pre> - * - * @constructor - * @extends {goog.Disposable} - * @implements {goog.events.Listenable} - */ -goog.events.EventTarget = function() { - goog.Disposable.call(this); - - /** - * Maps of event type to an array of listeners. - * @private {!goog.events.ListenerMap} - */ - this.eventTargetListeners_ = new goog.events.ListenerMap(this); - - /** - * The object to use for event.target. Useful when mixing in an - * EventTarget to another object. - * @private {!Object} - */ - this.actualEventTarget_ = this; - - /** - * Parent event target, used during event bubbling. - * - * TODO(chrishenry): Change this to goog.events.Listenable. This - * currently breaks people who expect getParentEventTarget to return - * goog.events.EventTarget. - * - * @private {goog.events.EventTarget} - */ - this.parentEventTarget_ = null; -}; -goog.inherits(goog.events.EventTarget, goog.Disposable); -goog.events.Listenable.addImplementation(goog.events.EventTarget); - - -/** - * An artificial cap on the number of ancestors you can have. This is mainly - * for loop detection. - * @const {number} - * @private - */ -goog.events.EventTarget.MAX_ANCESTORS_ = 1000; - - -/** - * Returns the parent of this event target to use for bubbling. - * - * @return {goog.events.EventTarget} The parent EventTarget or null if - * there is no parent. - * @override - */ -goog.events.EventTarget.prototype.getParentEventTarget = function() { - return this.parentEventTarget_; -}; - - -/** - * Sets the parent of this event target to use for capture/bubble - * mechanism. - * @param {goog.events.EventTarget} parent Parent listenable (null if none). - */ -goog.events.EventTarget.prototype.setParentEventTarget = function(parent) { - this.parentEventTarget_ = parent; -}; - - -/** - * Adds an event listener to the event target. The same handler can only be - * added once per the type. Even if you add the same handler multiple times - * using the same type then it will only be called once when the event is - * dispatched. - * - * @param {string} type The type of the event to listen for. - * @param {function(?):?|{handleEvent:function(?):?}|null} handler The function - * to handle the event. The handler can also be an object that implements - * the handleEvent method which takes the event object as argument. - * @param {boolean=} opt_capture In DOM-compliant browsers, this determines - * whether the listener is fired during the capture or bubble phase - * of the event. - * @param {Object=} opt_handlerScope Object in whose scope to call - * the listener. - * @deprecated Use {@code #listen} instead, when possible. Otherwise, use - * {@code goog.events.listen} if you are passing Object - * (instead of Function) as handler. - */ -goog.events.EventTarget.prototype.addEventListener = function( - type, handler, opt_capture, opt_handlerScope) { - goog.events.listen(this, type, handler, opt_capture, opt_handlerScope); -}; - - -/** - * Removes an event listener from the event target. The handler must be the - * same object as the one added. If the handler has not been added then - * nothing is done. - * - * @param {string} type The type of the event to listen for. - * @param {function(?):?|{handleEvent:function(?):?}|null} handler The function - * to handle the event. The handler can also be an object that implements - * the handleEvent method which takes the event object as argument. - * @param {boolean=} opt_capture In DOM-compliant browsers, this determines - * whether the listener is fired during the capture or bubble phase - * of the event. - * @param {Object=} opt_handlerScope Object in whose scope to call - * the listener. - * @deprecated Use {@code #unlisten} instead, when possible. Otherwise, use - * {@code goog.events.unlisten} if you are passing Object - * (instead of Function) as handler. - */ -goog.events.EventTarget.prototype.removeEventListener = function( - type, handler, opt_capture, opt_handlerScope) { - goog.events.unlisten(this, type, handler, opt_capture, opt_handlerScope); -}; - - -/** @override */ -goog.events.EventTarget.prototype.dispatchEvent = function(e) { - this.assertInitialized_(); - - var ancestorsTree, ancestor = this.getParentEventTarget(); - if (ancestor) { - ancestorsTree = []; - var ancestorCount = 1; - for (; ancestor; ancestor = ancestor.getParentEventTarget()) { - ancestorsTree.push(ancestor); - goog.asserts.assert( - (++ancestorCount < goog.events.EventTarget.MAX_ANCESTORS_), - 'infinite loop'); - } - } - - return goog.events.EventTarget.dispatchEventInternal_( - this.actualEventTarget_, e, ancestorsTree); -}; - - -/** - * Removes listeners from this object. Classes that extend EventTarget may - * need to override this method in order to remove references to DOM Elements - * and additional listeners. - * @override - */ -goog.events.EventTarget.prototype.disposeInternal = function() { - goog.events.EventTarget.superClass_.disposeInternal.call(this); - - this.removeAllListeners(); - this.parentEventTarget_ = null; -}; - - -/** @override */ -goog.events.EventTarget.prototype.listen = function( - type, listener, opt_useCapture, opt_listenerScope) { - this.assertInitialized_(); - return this.eventTargetListeners_.add( - String(type), listener, false /* callOnce */, opt_useCapture, - opt_listenerScope); -}; - - -/** @override */ -goog.events.EventTarget.prototype.listenOnce = function( - type, listener, opt_useCapture, opt_listenerScope) { - return this.eventTargetListeners_.add( - String(type), listener, true /* callOnce */, opt_useCapture, - opt_listenerScope); -}; - - -/** @override */ -goog.events.EventTarget.prototype.unlisten = function( - type, listener, opt_useCapture, opt_listenerScope) { - return this.eventTargetListeners_.remove( - String(type), listener, opt_useCapture, opt_listenerScope); -}; - - -/** @override */ -goog.events.EventTarget.prototype.unlistenByKey = function(key) { - return this.eventTargetListeners_.removeByKey(key); -}; - - -/** @override */ -goog.events.EventTarget.prototype.removeAllListeners = function(opt_type) { - // TODO(chrishenry): Previously, removeAllListeners can be called on - // uninitialized EventTarget, so we preserve that behavior. We - // should remove this when usages that rely on that fact are purged. - if (!this.eventTargetListeners_) { - return 0; - } - return this.eventTargetListeners_.removeAll(opt_type); -}; - - -/** @override */ -goog.events.EventTarget.prototype.fireListeners = function( - type, capture, eventObject) { - // TODO(chrishenry): Original code avoids array creation when there - // is no listener, so we do the same. If this optimization turns - // out to be not required, we can replace this with - // getListeners(type, capture) instead, which is simpler. - var listenerArray = this.eventTargetListeners_.listeners[String(type)]; - if (!listenerArray) { - return true; - } - listenerArray = listenerArray.concat(); - - var rv = true; - for (var i = 0; i < listenerArray.length; ++i) { - var listener = listenerArray[i]; - // We might not have a listener if the listener was removed. - if (listener && !listener.removed && listener.capture == capture) { - var listenerFn = listener.listener; - var listenerHandler = listener.handler || listener.src; - - if (listener.callOnce) { - this.unlistenByKey(listener); - } - rv = listenerFn.call(listenerHandler, eventObject) !== false && rv; - } - } - - return rv && eventObject.returnValue_ != false; -}; - - -/** @override */ -goog.events.EventTarget.prototype.getListeners = function(type, capture) { - return this.eventTargetListeners_.getListeners(String(type), capture); -}; - - -/** @override */ -goog.events.EventTarget.prototype.getListener = function( - type, listener, capture, opt_listenerScope) { - return this.eventTargetListeners_.getListener( - String(type), listener, capture, opt_listenerScope); -}; - - -/** @override */ -goog.events.EventTarget.prototype.hasListener = function( - opt_type, opt_capture) { - var id = goog.isDef(opt_type) ? String(opt_type) : undefined; - return this.eventTargetListeners_.hasListener(id, opt_capture); -}; - - -/** - * Sets the target to be used for {@code event.target} when firing - * event. Mainly used for testing. For example, see - * {@code goog.testing.events.mixinListenable}. - * @param {!Object} target The target. - */ -goog.events.EventTarget.prototype.setTargetForTesting = function(target) { - this.actualEventTarget_ = target; -}; - - -/** - * Asserts that the event target instance is initialized properly. - * @private - */ -goog.events.EventTarget.prototype.assertInitialized_ = function() { - goog.asserts.assert( - this.eventTargetListeners_, - 'Event target is not initialized. Did you call the superclass ' + - '(goog.events.EventTarget) constructor?'); -}; - - -/** - * Dispatches the given event on the ancestorsTree. - * - * @param {!Object} target The target to dispatch on. - * @param {goog.events.Event|Object|string} e The event object. - * @param {Array<goog.events.Listenable>=} opt_ancestorsTree The ancestors - * tree of the target, in reverse order from the closest ancestor - * to the root event target. May be null if the target has no ancestor. - * @return {boolean} If anyone called preventDefault on the event object (or - * if any of the listeners returns false) this will also return false. - * @private - */ -goog.events.EventTarget.dispatchEventInternal_ = function( - target, e, opt_ancestorsTree) { - var type = e.type || /** @type {string} */ (e); - - // If accepting a string or object, create a custom event object so that - // preventDefault and stopPropagation work with the event. - if (goog.isString(e)) { - e = new goog.events.Event(e, target); - } else if (!(e instanceof goog.events.Event)) { - var oldEvent = e; - e = new goog.events.Event(type, target); - goog.object.extend(e, oldEvent); - } else { - e.target = e.target || target; - } - - var rv = true, currentTarget; - - // Executes all capture listeners on the ancestors, if any. - if (opt_ancestorsTree) { - for (var i = opt_ancestorsTree.length - 1; !e.propagationStopped_ && i >= 0; - i--) { - currentTarget = e.currentTarget = opt_ancestorsTree[i]; - rv = currentTarget.fireListeners(type, true, e) && rv; - } - } - - // Executes capture and bubble listeners on the target. - if (!e.propagationStopped_) { - currentTarget = e.currentTarget = target; - rv = currentTarget.fireListeners(type, true, e) && rv; - if (!e.propagationStopped_) { - rv = currentTarget.fireListeners(type, false, e) && rv; - } - } - - // Executes all bubble listeners on the ancestors, if any. - if (opt_ancestorsTree) { - for (i = 0; !e.propagationStopped_ && i < opt_ancestorsTree.length; i++) { - currentTarget = e.currentTarget = opt_ancestorsTree[i]; - rv = currentTarget.fireListeners(type, false, e) && rv; - } - } - - return rv; -}; - -goog.provide('ol.Observable'); - -goog.require('goog.events'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * An event target providing convenient methods for listener registration - * and unregistration. A generic `change` event is always available through - * {@link ol.Observable#changed}. - * - * @constructor - * @extends {goog.events.EventTarget} - * @fires change - * @struct - * @api stable - */ -ol.Observable = function() { - - goog.base(this); - - /** - * @private - * @type {number} - */ - this.revision_ = 0; - -}; -goog.inherits(ol.Observable, goog.events.EventTarget); - - -/** - * Removes an event listener using the key returned by `on()` or `once()`. - * @param {goog.events.Key} key The key returned by `on()` or `once()`. - * @api stable - */ -ol.Observable.unByKey = function(key) { - goog.events.unlistenByKey(key); -}; - - -/** - * Increases the revision counter and dispatches a 'change' event. - * @api - */ -ol.Observable.prototype.changed = function() { - ++this.revision_; - this.dispatchEvent(goog.events.EventType.CHANGE); -}; - - -/** - * Triggered when the revision counter is increased. - * @event change - * @api - */ - - -/** - * Dispatches an event and calls all listeners listening for events - * of this type. The event parameter can either be a string or an - * Object with a `type` property. - * - * @param {goog.events.EventLike} event Event object. - * @function - * @api - */ -ol.Observable.prototype.dispatchEvent; - - -/** - * Get the version number for this object. Each time the object is modified, - * its version number will be incremented. - * @return {number} Revision. - * @api - */ -ol.Observable.prototype.getRevision = function() { - return this.revision_; -}; - - -/** - * Listen for a certain type of event. - * @param {string|Array.<string>} type The event type or array of event types. - * @param {function(?): ?} listener The listener function. - * @param {Object=} opt_this The object to use as `this` in `listener`. - * @return {goog.events.Key} Unique key for the listener. - * @api stable - */ -ol.Observable.prototype.on = function(type, listener, opt_this) { - return goog.events.listen(this, type, listener, false, opt_this); -}; - - -/** - * Listen once for a certain type of event. - * @param {string|Array.<string>} type The event type or array of event types. - * @param {function(?): ?} listener The listener function. - * @param {Object=} opt_this The object to use as `this` in `listener`. - * @return {goog.events.Key} Unique key for the listener. - * @api stable - */ -ol.Observable.prototype.once = function(type, listener, opt_this) { - return goog.events.listenOnce(this, type, listener, false, opt_this); -}; - - -/** - * Unlisten for a certain type of event. - * @param {string|Array.<string>} type The event type or array of event types. - * @param {function(?): ?} listener The listener function. - * @param {Object=} opt_this The object which was used as `this` by the - * `listener`. - * @api stable - */ -ol.Observable.prototype.un = function(type, listener, opt_this) { - goog.events.unlisten(this, type, listener, false, opt_this); -}; - - -/** - * Removes an event listener using the key returned by `on()` or `once()`. - * Note that using the {@link ol.Observable.unByKey} static function is to - * be preferred. - * @param {goog.events.Key} key The key returned by `on()` or `once()`. - * @function - * @api stable - */ -ol.Observable.prototype.unByKey = ol.Observable.unByKey; - -goog.provide('ol.Object'); -goog.provide('ol.ObjectEvent'); -goog.provide('ol.ObjectEventType'); - -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('ol.Observable'); - - -/** - * @enum {string} - */ -ol.ObjectEventType = { - /** - * Triggered when a property is changed. - * @event ol.ObjectEvent#propertychange - * @api stable - */ - PROPERTYCHANGE: 'propertychange' -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.Object} instances are instances of this type. - * - * @param {string} type The event type. - * @param {string} key The property name. - * @param {*} oldValue The old value for `key`. - * @extends {goog.events.Event} - * @implements {oli.ObjectEvent} - * @constructor - */ -ol.ObjectEvent = function(type, key, oldValue) { - goog.base(this, type); - - /** - * The name of the property whose value is changing. - * @type {string} - * @api stable - */ - this.key = key; - - /** - * The old value. To get the new value use `e.target.get(e.key)` where - * `e` is the event object. - * @type {*} - * @api stable - */ - this.oldValue = oldValue; - -}; -goog.inherits(ol.ObjectEvent, goog.events.Event); - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Most non-trivial classes inherit from this. - * - * This extends {@link ol.Observable} with observable properties, where each - * property is observable as well as the object as a whole. - * - * Classes that inherit from this have pre-defined properties, to which you can - * add your owns. The pre-defined properties are listed in this documentation as - * 'Observable Properties', and have their own accessors; for example, - * {@link ol.Map} has a `target` property, accessed with `getTarget()` and - * changed with `setTarget()`. Not all properties are however settable. There - * are also general-purpose accessors `get()` and `set()`. For example, - * `get('target')` is equivalent to `getTarget()`. - * - * The `set` accessors trigger a change event, and you can monitor this by - * registering a listener. For example, {@link ol.View} has a `center` - * property, so `view.on('change:center', function(evt) {...});` would call the - * function whenever the value of the center property changes. Within the - * function, `evt.target` would be the view, so `evt.target.getCenter()` would - * return the new center. - * - * You can add your own observable properties with - * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`. - * You can listen for changes on that property value with - * `object.on('change:prop', listener)`. You can get a list of all - * properties with {@link ol.Object#getProperties object.getProperties()}. - * - * Note that the observable properties are separate from standard JS properties. - * You can, for example, give your map object a title with - * `map.title='New title'` and with `map.set('title', 'Another title')`. The - * first will be a `hasOwnProperty`; the second will appear in - * `getProperties()`. Only the second is observable. - * - * Properties can be deleted by using the unset method. E.g. - * object.unset('foo'). - * - * @constructor - * @extends {ol.Observable} - * @param {Object.<string, *>=} opt_values An object with key-value pairs. - * @fires ol.ObjectEvent - * @api - */ -ol.Object = function(opt_values) { - goog.base(this); - - // Call goog.getUid to ensure that the order of objects' ids is the same as - // the order in which they were created. This also helps to ensure that - // object properties are always added in the same order, which helps many - // JavaScript engines generate faster code. - goog.getUid(this); - - /** - * @private - * @type {!Object.<string, *>} - */ - this.values_ = {}; - - if (opt_values !== undefined) { - this.setProperties(opt_values); - } -}; -goog.inherits(ol.Object, ol.Observable); - - -/** - * @private - * @type {Object.<string, string>} - */ -ol.Object.changeEventTypeCache_ = {}; - - -/** - * @param {string} key Key name. - * @return {string} Change name. - */ -ol.Object.getChangeEventType = function(key) { - return ol.Object.changeEventTypeCache_.hasOwnProperty(key) ? - ol.Object.changeEventTypeCache_[key] : - (ol.Object.changeEventTypeCache_[key] = 'change:' + key); -}; - - -/** - * Gets a value. - * @param {string} key Key name. - * @return {*} Value. - * @api stable - */ -ol.Object.prototype.get = function(key) { - var value; - if (this.values_.hasOwnProperty(key)) { - value = this.values_[key]; - } - return value; -}; - - -/** - * Get a list of object property names. - * @return {Array.<string>} List of property names. - * @api stable - */ -ol.Object.prototype.getKeys = function() { - return Object.keys(this.values_); -}; - - -/** - * Get an object of all property names and values. - * @return {Object.<string, *>} Object. - * @api stable - */ -ol.Object.prototype.getProperties = function() { - var properties = {}; - var key; - for (key in this.values_) { - properties[key] = this.values_[key]; - } - return properties; -}; - - -/** - * @param {string} key Key name. - * @param {*} oldValue Old value. - */ -ol.Object.prototype.notify = function(key, oldValue) { - var eventType; - eventType = ol.Object.getChangeEventType(key); - this.dispatchEvent(new ol.ObjectEvent(eventType, key, oldValue)); - eventType = ol.ObjectEventType.PROPERTYCHANGE; - this.dispatchEvent(new ol.ObjectEvent(eventType, key, oldValue)); -}; - - -/** - * Sets a value. - * @param {string} key Key name. - * @param {*} value Value. - * @param {boolean=} opt_silent Update without triggering an event. - * @api stable - */ -ol.Object.prototype.set = function(key, value, opt_silent) { - if (opt_silent) { - this.values_[key] = value; - } else { - var oldValue = this.values_[key]; - this.values_[key] = value; - this.notify(key, oldValue); - } -}; - - -/** - * Sets a collection of key-value pairs. Note that this changes any existing - * properties and adds new ones (it does not remove any existing properties). - * @param {Object.<string, *>} values Values. - * @param {boolean=} opt_silent Update without triggering an event. - * @api stable - */ -ol.Object.prototype.setProperties = function(values, opt_silent) { - var key; - for (key in values) { - this.set(key, values[key], opt_silent); - } -}; - - -/** - * Unsets a property. - * @param {string} key Key name. - * @param {boolean=} opt_silent Unset without triggering an event. - * @api stable - */ -ol.Object.prototype.unset = function(key, opt_silent) { - if (key in this.values_) { - var oldValue = this.values_[key]; - delete this.values_[key]; - if (!opt_silent) { - this.notify(key, oldValue); - } - } -}; - -goog.provide('ol.Size'); -goog.provide('ol.size'); - - -goog.require('goog.asserts'); - - -/** - * An array of numbers representing a size: `[width, height]`. - * @typedef {Array.<number>} - * @api stable - */ -ol.Size; - - -/** - * Returns a buffered size. - * @param {ol.Size} size Size. - * @param {number} buffer Buffer. - * @param {ol.Size=} opt_size Optional reusable size array. - * @return {ol.Size} - */ -ol.size.buffer = function(size, buffer, opt_size) { - if (opt_size === undefined) { - opt_size = [0, 0]; - } - opt_size[0] = size[0] + 2 * buffer; - opt_size[1] = size[1] + 2 * buffer; - return opt_size; -}; - - -/** - * Compares sizes for equality. - * @param {ol.Size} a Size. - * @param {ol.Size} b Size. - * @return {boolean} Equals. - */ -ol.size.equals = function(a, b) { - return a[0] == b[0] && a[1] == b[1]; -}; - - -/** - * Determines if a size has a positive area. - * @param {ol.Size} size The size to test. - * @return {boolean} The size has a positive area. - */ -ol.size.hasArea = function(size) { - return size[0] > 0 && size[1] > 0; -}; - - -/** - * Returns a size scaled by a ratio. The result will be an array of integers. - * @param {ol.Size} size Size. - * @param {number} ratio Ratio. - * @param {ol.Size=} opt_size Optional reusable size array. - * @return {ol.Size} - */ -ol.size.scale = function(size, ratio, opt_size) { - if (opt_size === undefined) { - opt_size = [0, 0]; - } - opt_size[0] = (size[0] * ratio + 0.5) | 0; - opt_size[1] = (size[1] * ratio + 0.5) | 0; - return opt_size; -}; - - -/** - * Returns an `ol.Size` array for the passed in number (meaning: square) or - * `ol.Size` array. - * (meaning: non-square), - * @param {number|ol.Size} size Width and height. - * @param {ol.Size=} opt_size Optional reusable size array. - * @return {ol.Size} Size. - * @api stable - */ -ol.size.toSize = function(size, opt_size) { - if (goog.isArray(size)) { - return size; - } else { - goog.asserts.assert(goog.isNumber(size)); - if (opt_size === undefined) { - opt_size = [size, size]; - } else { - opt_size[0] = size; - opt_size[1] = size; - } - return opt_size; - } -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Additional mathematical functions. - */ - -goog.provide('goog.math'); - -goog.require('goog.array'); -goog.require('goog.asserts'); - - -/** - * Returns a random integer greater than or equal to 0 and less than {@code a}. - * @param {number} a The upper bound for the random integer (exclusive). - * @return {number} A random integer N such that 0 <= N < a. - */ -goog.math.randomInt = function(a) { - return Math.floor(Math.random() * a); -}; - - -/** - * Returns a random number greater than or equal to {@code a} and less than - * {@code b}. - * @param {number} a The lower bound for the random number (inclusive). - * @param {number} b The upper bound for the random number (exclusive). - * @return {number} A random number N such that a <= N < b. - */ -goog.math.uniformRandom = function(a, b) { - return a + Math.random() * (b - a); -}; - - -/** - * Takes a number and clamps it to within the provided bounds. - * @param {number} value The input number. - * @param {number} min The minimum value to return. - * @param {number} max The maximum value to return. - * @return {number} The input number if it is within bounds, or the nearest - * number within the bounds. - */ -goog.math.clamp = function(value, min, max) { - return Math.min(Math.max(value, min), max); -}; - - -/** - * The % operator in JavaScript returns the remainder of a / b, but differs from - * some other languages in that the result will have the same sign as the - * dividend. For example, -1 % 8 == -1, whereas in some other languages - * (such as Python) the result would be 7. This function emulates the more - * correct modulo behavior, which is useful for certain applications such as - * calculating an offset index in a circular list. - * - * @param {number} a The dividend. - * @param {number} b The divisor. - * @return {number} a % b where the result is between 0 and b (either 0 <= x < b - * or b < x <= 0, depending on the sign of b). - */ -goog.math.modulo = function(a, b) { - var r = a % b; - // If r and b differ in sign, add b to wrap the result to the correct sign. - return (r * b < 0) ? r + b : r; -}; - - -/** - * Performs linear interpolation between values a and b. Returns the value - * between a and b proportional to x (when x is between 0 and 1. When x is - * outside this range, the return value is a linear extrapolation). - * @param {number} a A number. - * @param {number} b A number. - * @param {number} x The proportion between a and b. - * @return {number} The interpolated value between a and b. - */ -goog.math.lerp = function(a, b, x) { - return a + x * (b - a); -}; - - -/** - * Tests whether the two values are equal to each other, within a certain - * tolerance to adjust for floating point errors. - * @param {number} a A number. - * @param {number} b A number. - * @param {number=} opt_tolerance Optional tolerance range. Defaults - * to 0.000001. If specified, should be greater than 0. - * @return {boolean} Whether {@code a} and {@code b} are nearly equal. - */ -goog.math.nearlyEquals = function(a, b, opt_tolerance) { - return Math.abs(a - b) <= (opt_tolerance || 0.000001); -}; - - -// TODO(user): Rename to normalizeAngle, retaining old name as deprecated -// alias. -/** - * Normalizes an angle to be in range [0-360). Angles outside this range will - * be normalized to be the equivalent angle with that range. - * @param {number} angle Angle in degrees. - * @return {number} Standardized angle. - */ -goog.math.standardAngle = function(angle) { - return goog.math.modulo(angle, 360); -}; - - -/** - * Normalizes an angle to be in range [0-2*PI). Angles outside this range will - * be normalized to be the equivalent angle with that range. - * @param {number} angle Angle in radians. - * @return {number} Standardized angle. - */ -goog.math.standardAngleInRadians = function(angle) { - return goog.math.modulo(angle, 2 * Math.PI); -}; - - -/** - * Converts degrees to radians. - * @param {number} angleDegrees Angle in degrees. - * @return {number} Angle in radians. - */ -goog.math.toRadians = function(angleDegrees) { - return angleDegrees * Math.PI / 180; -}; - - -/** - * Converts radians to degrees. - * @param {number} angleRadians Angle in radians. - * @return {number} Angle in degrees. - */ -goog.math.toDegrees = function(angleRadians) { - return angleRadians * 180 / Math.PI; -}; - - -/** - * For a given angle and radius, finds the X portion of the offset. - * @param {number} degrees Angle in degrees (zero points in +X direction). - * @param {number} radius Radius. - * @return {number} The x-distance for the angle and radius. - */ -goog.math.angleDx = function(degrees, radius) { - return radius * Math.cos(goog.math.toRadians(degrees)); -}; - - -/** - * For a given angle and radius, finds the Y portion of the offset. - * @param {number} degrees Angle in degrees (zero points in +X direction). - * @param {number} radius Radius. - * @return {number} The y-distance for the angle and radius. - */ -goog.math.angleDy = function(degrees, radius) { - return radius * Math.sin(goog.math.toRadians(degrees)); -}; - - -/** - * Computes the angle between two points (x1,y1) and (x2,y2). - * Angle zero points in the +X direction, 90 degrees points in the +Y - * direction (down) and from there we grow clockwise towards 360 degrees. - * @param {number} x1 x of first point. - * @param {number} y1 y of first point. - * @param {number} x2 x of second point. - * @param {number} y2 y of second point. - * @return {number} Standardized angle in degrees of the vector from - * x1,y1 to x2,y2. - */ -goog.math.angle = function(x1, y1, x2, y2) { - return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(y2 - y1, - x2 - x1))); -}; - - -/** - * Computes the difference between startAngle and endAngle (angles in degrees). - * @param {number} startAngle Start angle in degrees. - * @param {number} endAngle End angle in degrees. - * @return {number} The number of degrees that when added to - * startAngle will result in endAngle. Positive numbers mean that the - * direction is clockwise. Negative numbers indicate a counter-clockwise - * direction. - * The shortest route (clockwise vs counter-clockwise) between the angles - * is used. - * When the difference is 180 degrees, the function returns 180 (not -180) - * angleDifference(30, 40) is 10, and angleDifference(40, 30) is -10. - * angleDifference(350, 10) is 20, and angleDifference(10, 350) is -20. - */ -goog.math.angleDifference = function(startAngle, endAngle) { - var d = goog.math.standardAngle(endAngle) - - goog.math.standardAngle(startAngle); - if (d > 180) { - d = d - 360; - } else if (d <= -180) { - d = 360 + d; - } - return d; -}; - - -/** - * Returns the sign of a number as per the "sign" or "signum" function. - * @param {number} x The number to take the sign of. - * @return {number} -1 when negative, 1 when positive, 0 when 0. Preserves - * signed zeros and NaN. - */ -goog.math.sign = Math.sign || function(x) { - if (x > 0) { - return 1; - } - if (x < 0) { - return -1; - } - return x; // Preserves signed zeros and NaN. -}; - - -/** - * JavaScript implementation of Longest Common Subsequence problem. - * http://en.wikipedia.org/wiki/Longest_common_subsequence - * - * Returns the longest possible array that is subarray of both of given arrays. - * - * @param {Array<Object>} array1 First array of objects. - * @param {Array<Object>} array2 Second array of objects. - * @param {Function=} opt_compareFn Function that acts as a custom comparator - * for the array ojects. Function should return true if objects are equal, - * otherwise false. - * @param {Function=} opt_collectorFn Function used to decide what to return - * as a result subsequence. It accepts 2 arguments: index of common element - * in the first array and index in the second. The default function returns - * element from the first array. - * @return {!Array<Object>} A list of objects that are common to both arrays - * such that there is no common subsequence with size greater than the - * length of the list. - */ -goog.math.longestCommonSubsequence = function( - array1, array2, opt_compareFn, opt_collectorFn) { - - var compare = opt_compareFn || function(a, b) { - return a == b; - }; - - var collect = opt_collectorFn || function(i1, i2) { - return array1[i1]; - }; - - var length1 = array1.length; - var length2 = array2.length; - - var arr = []; - for (var i = 0; i < length1 + 1; i++) { - arr[i] = []; - arr[i][0] = 0; - } - - for (var j = 0; j < length2 + 1; j++) { - arr[0][j] = 0; - } - - for (i = 1; i <= length1; i++) { - for (j = 1; j <= length2; j++) { - if (compare(array1[i - 1], array2[j - 1])) { - arr[i][j] = arr[i - 1][j - 1] + 1; - } else { - arr[i][j] = Math.max(arr[i - 1][j], arr[i][j - 1]); - } - } - } - - // Backtracking - var result = []; - var i = length1, j = length2; - while (i > 0 && j > 0) { - if (compare(array1[i - 1], array2[j - 1])) { - result.unshift(collect(i - 1, j - 1)); - i--; - j--; - } else { - if (arr[i - 1][j] > arr[i][j - 1]) { - i--; - } else { - j--; - } - } - } - - return result; -}; - - -/** - * Returns the sum of the arguments. - * @param {...number} var_args Numbers to add. - * @return {number} The sum of the arguments (0 if no arguments were provided, - * {@code NaN} if any of the arguments is not a valid number). - */ -goog.math.sum = function(var_args) { - return /** @type {number} */ (goog.array.reduce(arguments, - function(sum, value) { - return sum + value; - }, 0)); -}; - - -/** - * Returns the arithmetic mean of the arguments. - * @param {...number} var_args Numbers to average. - * @return {number} The average of the arguments ({@code NaN} if no arguments - * were provided or any of the arguments is not a valid number). - */ -goog.math.average = function(var_args) { - return goog.math.sum.apply(null, arguments) / arguments.length; -}; - - -/** - * Returns the unbiased sample variance of the arguments. For a definition, - * see e.g. http://en.wikipedia.org/wiki/Variance - * @param {...number} var_args Number samples to analyze. - * @return {number} The unbiased sample variance of the arguments (0 if fewer - * than two samples were provided, or {@code NaN} if any of the samples is - * not a valid number). - */ -goog.math.sampleVariance = function(var_args) { - var sampleSize = arguments.length; - if (sampleSize < 2) { - return 0; - } - - var mean = goog.math.average.apply(null, arguments); - var variance = goog.math.sum.apply(null, goog.array.map(arguments, - function(val) { - return Math.pow(val - mean, 2); - })) / (sampleSize - 1); - - return variance; -}; - - -/** - * Returns the sample standard deviation of the arguments. For a definition of - * sample standard deviation, see e.g. - * http://en.wikipedia.org/wiki/Standard_deviation - * @param {...number} var_args Number samples to analyze. - * @return {number} The sample standard deviation of the arguments (0 if fewer - * than two samples were provided, or {@code NaN} if any of the samples is - * not a valid number). - */ -goog.math.standardDeviation = function(var_args) { - return Math.sqrt(goog.math.sampleVariance.apply(null, arguments)); -}; - - -/** - * Returns whether the supplied number represents an integer, i.e. that is has - * no fractional component. No range-checking is performed on the number. - * @param {number} num The number to test. - * @return {boolean} Whether {@code num} is an integer. - */ -goog.math.isInt = function(num) { - return isFinite(num) && num % 1 == 0; -}; - - -/** - * Returns whether the supplied number is finite and not NaN. - * @param {number} num The number to test. - * @return {boolean} Whether {@code num} is a finite number. - */ -goog.math.isFiniteNumber = function(num) { - return isFinite(num) && !isNaN(num); -}; - - -/** - * @param {number} num The number to test. - * @return {boolean} Whether it is negative zero. - */ -goog.math.isNegativeZero = function(num) { - return num == 0 && 1 / num < 0; -}; - - -/** - * Returns the precise value of floor(log10(num)). - * Simpler implementations didn't work because of floating point rounding - * errors. For example - * <ul> - * <li>Math.floor(Math.log(num) / Math.LN10) is off by one for num == 1e+3. - * <li>Math.floor(Math.log(num) * Math.LOG10E) is off by one for num == 1e+15. - * <li>Math.floor(Math.log10(num)) is off by one for num == 1e+15 - 1. - * </ul> - * @param {number} num A floating point number. - * @return {number} Its logarithm to base 10 rounded down to the nearest - * integer if num > 0. -Infinity if num == 0. NaN if num < 0. - */ -goog.math.log10Floor = function(num) { - if (num > 0) { - var x = Math.round(Math.log(num) * Math.LOG10E); - return x - (parseFloat('1e' + x) > num); - } - return num == 0 ? -Infinity : NaN; -}; - - -/** - * A tweaked variant of {@code Math.floor} which tolerates if the passed number - * is infinitesimally smaller than the closest integer. It often happens with - * the results of floating point calculations because of the finite precision - * of the intermediate results. For example {@code Math.floor(Math.log(1000) / - * Math.LN10) == 2}, not 3 as one would expect. - * @param {number} num A number. - * @param {number=} opt_epsilon An infinitesimally small positive number, the - * rounding error to tolerate. - * @return {number} The largest integer less than or equal to {@code num}. - */ -goog.math.safeFloor = function(num, opt_epsilon) { - goog.asserts.assert(!goog.isDef(opt_epsilon) || opt_epsilon > 0); - return Math.floor(num + (opt_epsilon || 2e-15)); -}; - - -/** - * A tweaked variant of {@code Math.ceil}. See {@code goog.math.safeFloor} for - * details. - * @param {number} num A number. - * @param {number=} opt_epsilon An infinitesimally small positive number, the - * rounding error to tolerate. - * @return {number} The smallest integer greater than or equal to {@code num}. - */ -goog.math.safeCeil = function(num, opt_epsilon) { - goog.asserts.assert(!goog.isDef(opt_epsilon) || opt_epsilon > 0); - return Math.ceil(num - (opt_epsilon || 2e-15)); -}; - -goog.provide('ol.Coordinate'); -goog.provide('ol.CoordinateFormatType'); -goog.provide('ol.coordinate'); - -goog.require('goog.math'); -goog.require('goog.string'); - - -/** - * A function that takes a {@link ol.Coordinate} and transforms it into a - * `{string}`. - * - * @typedef {function((ol.Coordinate|undefined)): string} - * @api stable - */ -ol.CoordinateFormatType; - - -/** - * An array of numbers representing an xy coordinate. Example: `[16, 48]`. - * @typedef {Array.<number>} ol.Coordinate - * @api stable - */ -ol.Coordinate; - - -/** - * Add `delta` to `coordinate`. `coordinate` is modified in place and returned - * by the function. - * - * Example: - * - * var coord = [7.85, 47.983333]; - * ol.coordinate.add(coord, [-2, 4]); - * // coord is now [5.85, 51.983333] - * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.Coordinate} delta Delta. - * @return {ol.Coordinate} The input coordinate adjusted by the given delta. - * @api stable - */ -ol.coordinate.add = function(coordinate, delta) { - coordinate[0] += delta[0]; - coordinate[1] += delta[1]; - return coordinate; -}; - - -/** - * Calculates the point closest to the passed coordinate on the passed segment. - * This is the foot of the perpendicular of the coordinate to the segment when - * the foot is on the segment, or the closest segment coordinate when the foot - * is outside the segment. - * - * @param {ol.Coordinate} coordinate The coordinate. - * @param {Array.<ol.Coordinate>} segment The two coordinates of the segment. - * @return {ol.Coordinate} The foot of the perpendicular of the coordinate to - * the segment. - */ -ol.coordinate.closestOnSegment = function(coordinate, segment) { - var x0 = coordinate[0]; - var y0 = coordinate[1]; - var start = segment[0]; - var end = segment[1]; - var x1 = start[0]; - var y1 = start[1]; - var x2 = end[0]; - var y2 = end[1]; - var dx = x2 - x1; - var dy = y2 - y1; - var along = (dx === 0 && dy === 0) ? 0 : - ((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0); - var x, y; - if (along <= 0) { - x = x1; - y = y1; - } else if (along >= 1) { - x = x2; - y = y2; - } else { - x = x1 + along * dx; - y = y1 + along * dy; - } - return [x, y]; -}; - - -/** - * Returns a {@link ol.CoordinateFormatType} function that can be used to format - * a {ol.Coordinate} to a string. - * - * Example without specifying the fractional digits: - * - * var coord = [7.85, 47.983333]; - * var stringifyFunc = ol.coordinate.createStringXY(); - * var out = stringifyFunc(coord); - * // out is now '8, 48' - * - * Example with explicitly specifying 2 fractional digits: - * - * var coord = [7.85, 47.983333]; - * var stringifyFunc = ol.coordinate.createStringXY(2); - * var out = stringifyFunc(coord); - * // out is now '7.85, 47.98' - * - * @param {number=} opt_fractionDigits The number of digits to include - * after the decimal point. Default is `0`. - * @return {ol.CoordinateFormatType} Coordinate format. - * @api stable - */ -ol.coordinate.createStringXY = function(opt_fractionDigits) { - return ( - /** - * @param {ol.Coordinate|undefined} coordinate Coordinate. - * @return {string} String XY. - */ - function(coordinate) { - return ol.coordinate.toStringXY(coordinate, opt_fractionDigits); - }); -}; - - -/** - * @private - * @param {number} degrees Degrees. - * @param {string} hemispheres Hemispheres. - * @return {string} String. - */ -ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres) { - var normalizedDegrees = goog.math.modulo(degrees + 180, 360) - 180; - var x = Math.abs(Math.round(3600 * normalizedDegrees)); - return Math.floor(x / 3600) + '\u00b0 ' + - goog.string.padNumber(Math.floor((x / 60) % 60), 2) + '\u2032 ' + - goog.string.padNumber(Math.floor(x % 60), 2) + '\u2033 ' + - hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0); -}; - - -/** - * Transforms the given {@link ol.Coordinate} to a string using the given string - * template. The strings `{x}` and `{y}` in the template will be replaced with - * the first and second coordinate values respectively. - * - * Example without specifying the fractional digits: - * - * var coord = [7.85, 47.983333]; - * var template = 'Coordinate is ({x}|{y}).'; - * var out = ol.coordinate.format(coord, template); - * // out is now 'Coordinate is (8|48).' - * - * Example explicitly specifying the fractional digits: - * - * var coord = [7.85, 47.983333]; - * var template = 'Coordinate is ({x}|{y}).'; - * var out = ol.coordinate.format(coord, template, 2); - * // out is now 'Coordinate is (7.85|47.98).' - * - * @param {ol.Coordinate|undefined} coordinate Coordinate. - * @param {string} template A template string with `{x}` and `{y}` placeholders - * that will be replaced by first and second coordinate values. - * @param {number=} opt_fractionDigits The number of digits to include - * after the decimal point. Default is `0`. - * @return {string} Formatted coordinate. - * @api stable - */ -ol.coordinate.format = function(coordinate, template, opt_fractionDigits) { - if (coordinate) { - return template - .replace('{x}', coordinate[0].toFixed(opt_fractionDigits)) - .replace('{y}', coordinate[1].toFixed(opt_fractionDigits)); - } else { - return ''; - } -}; - - -/** - * @param {ol.Coordinate} coordinate1 First coordinate. - * @param {ol.Coordinate} coordinate2 Second coordinate. - * @return {boolean} Whether the passed coordinates are equal. - */ -ol.coordinate.equals = function(coordinate1, coordinate2) { - var equals = true; - for (var i = coordinate1.length - 1; i >= 0; --i) { - if (coordinate1[i] != coordinate2[i]) { - equals = false; - break; - } - } - return equals; -}; - - -/** - * Rotate `coordinate` by `angle`. `coordinate` is modified in place and - * returned by the function. - * - * Example: - * - * var coord = [7.85, 47.983333]; - * var rotateRadians = Math.PI / 2; // 90 degrees - * ol.coordinate.rotate(coord, rotateRadians); - * // coord is now [-47.983333, 7.85] - * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} angle Angle in radian. - * @return {ol.Coordinate} Coordinate. - * @api stable - */ -ol.coordinate.rotate = function(coordinate, angle) { - var cosAngle = Math.cos(angle); - var sinAngle = Math.sin(angle); - var x = coordinate[0] * cosAngle - coordinate[1] * sinAngle; - var y = coordinate[1] * cosAngle + coordinate[0] * sinAngle; - coordinate[0] = x; - coordinate[1] = y; - return coordinate; -}; - - -/** - * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned - * by the function. - * - * Example: - * - * var coord = [7.85, 47.983333]; - * var scale = 1.2; - * ol.coordinate.scale(coord, scale); - * // coord is now [9.42, 57.5799996] - * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} scale Scale factor. - * @return {ol.Coordinate} Coordinate. - */ -ol.coordinate.scale = function(coordinate, scale) { - coordinate[0] *= scale; - coordinate[1] *= scale; - return coordinate; -}; - - -/** - * Subtract `delta` to `coordinate`. `coordinate` is modified in place and - * returned by the function. - * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.Coordinate} delta Delta. - * @return {ol.Coordinate} Coordinate. - */ -ol.coordinate.sub = function(coordinate, delta) { - coordinate[0] -= delta[0]; - coordinate[1] -= delta[1]; - return coordinate; -}; - - -/** - * @param {ol.Coordinate} coord1 First coordinate. - * @param {ol.Coordinate} coord2 Second coordinate. - * @return {number} Squared distance between coord1 and coord2. - */ -ol.coordinate.squaredDistance = function(coord1, coord2) { - var dx = coord1[0] - coord2[0]; - var dy = coord1[1] - coord2[1]; - return dx * dx + dy * dy; -}; - - -/** - * Calculate the squared distance from a coordinate to a line segment. - * - * @param {ol.Coordinate} coordinate Coordinate of the point. - * @param {Array.<ol.Coordinate>} segment Line segment (2 coordinates). - * @return {number} Squared distance from the point to the line segment. - */ -ol.coordinate.squaredDistanceToSegment = function(coordinate, segment) { - return ol.coordinate.squaredDistance(coordinate, - ol.coordinate.closestOnSegment(coordinate, segment)); -}; - - -/** - * Format a geographic coordinate with the hemisphere, degrees, minutes, and - * seconds. - * - * Example: - * - * var coord = [7.85, 47.983333]; - * var out = ol.coordinate.toStringHDMS(coord); - * // out is now '47° 59′ 0″ N 7° 51′ 0″ E' - * - * @param {ol.Coordinate|undefined} coordinate Coordinate. - * @return {string} Hemisphere, degrees, minutes and seconds. - * @api stable - */ -ol.coordinate.toStringHDMS = function(coordinate) { - if (coordinate) { - return ol.coordinate.degreesToStringHDMS_(coordinate[1], 'NS') + ' ' + - ol.coordinate.degreesToStringHDMS_(coordinate[0], 'EW'); - } else { - return ''; - } -}; - - -/** - * Format a coordinate as a comma delimited string. - * - * Example without specifying fractional digits: - * - * var coord = [7.85, 47.983333]; - * var out = ol.coordinate.toStringXY(coord); - * // out is now '8, 48' - * - * Example explicitly specifying 1 fractional digit: - * - * var coord = [7.85, 47.983333]; - * var out = ol.coordinate.toStringXY(coord, 1); - * // out is now '7.8, 48.0' - * - * @param {ol.Coordinate|undefined} coordinate Coordinate. - * @param {number=} opt_fractionDigits The number of digits to include - * after the decimal point. Default is `0`. - * @return {string} XY. - * @api stable - */ -ol.coordinate.toStringXY = function(coordinate, opt_fractionDigits) { - return ol.coordinate.format(coordinate, '{x}, {y}', opt_fractionDigits); -}; - - -/** - * Create an ol.Coordinate from an Array and take into account axis order. - * - * Examples: - * - * var northCoord = ol.coordinate.fromProjectedArray([1, 2], 'n'); - * // northCoord is now [2, 1] - * - * var eastCoord = ol.coordinate.fromProjectedArray([1, 2], 'e'); - * // eastCoord is now [1, 2] - * - * @param {Array} array The array with coordinates. - * @param {string} axis the axis info. - * @return {ol.Coordinate} The coordinate created. - */ -ol.coordinate.fromProjectedArray = function(array, axis) { - var firstAxis = axis.charAt(0); - if (firstAxis === 'n' || firstAxis === 's') { - return [array[1], array[0]]; - } else { - return array; - } -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/** - * @fileoverview Supplies a Float32Array implementation that implements - * most of the Float32Array spec and that can be used when a built-in - * implementation is not available. - * - * Note that if no existing Float32Array implementation is found then - * this class and all its public properties are exported as Float32Array. - * - * Adding support for the other TypedArray classes here does not make sense - * since this vector math library only needs Float32Array. - * - */ -goog.provide('goog.vec.Float32Array'); - - - -/** - * Constructs a new Float32Array. The new array is initialized to all zeros. - * - * @param {goog.vec.Float32Array|Array|ArrayBuffer|number} p0 - * The length of the array, or an array to initialize the contents of the - * new Float32Array. - * @constructor - * @final - */ -goog.vec.Float32Array = function(p0) { - this.length = /** @type {number} */ (p0.length || p0); - for (var i = 0; i < this.length; i++) { - this[i] = p0[i] || 0; - } -}; - - -/** - * The number of bytes in an element (as defined by the Typed Array - * specification). - * - * @type {number} - */ -goog.vec.Float32Array.BYTES_PER_ELEMENT = 4; - - -/** - * The number of bytes in an element (as defined by the Typed Array - * specification). - * - * @type {number} - */ -goog.vec.Float32Array.prototype.BYTES_PER_ELEMENT = 4; - - -/** - * Sets elements of the array. - * @param {Array<number>|Float32Array} values The array of values. - * @param {number=} opt_offset The offset in this array to start. - */ -goog.vec.Float32Array.prototype.set = function(values, opt_offset) { - opt_offset = opt_offset || 0; - for (var i = 0; i < values.length && opt_offset + i < this.length; i++) { - this[opt_offset + i] = values[i]; - } -}; - - -/** - * Creates a string representation of this array. - * @return {string} The string version of this array. - * @override - */ -goog.vec.Float32Array.prototype.toString = Array.prototype.join; - - -/** - * Note that we cannot implement the subarray() or (deprecated) slice() - * methods properly since doing so would require being able to overload - * the [] operator which is not possible in javascript. So we leave - * them unimplemented. Any attempt to call these methods will just result - * in a javascript error since we leave them undefined. - */ - - -/** - * If no existing Float32Array implementation is found then we export - * goog.vec.Float32Array as Float32Array. - */ -if (typeof Float32Array == 'undefined') { - goog.exportProperty(goog.vec.Float32Array, 'BYTES_PER_ELEMENT', - goog.vec.Float32Array.BYTES_PER_ELEMENT); - goog.exportProperty(goog.vec.Float32Array.prototype, 'BYTES_PER_ELEMENT', - goog.vec.Float32Array.prototype.BYTES_PER_ELEMENT); - goog.exportProperty(goog.vec.Float32Array.prototype, 'set', - goog.vec.Float32Array.prototype.set); - goog.exportProperty(goog.vec.Float32Array.prototype, 'toString', - goog.vec.Float32Array.prototype.toString); - goog.exportSymbol('Float32Array', goog.vec.Float32Array); -} - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/** - * @fileoverview Supplies a Float64Array implementation that implements - * most of the Float64Array spec and that can be used when a built-in - * implementation is not available. - * - * Note that if no existing Float64Array implementation is found then this - * class and all its public properties are exported as Float64Array. - * - * Adding support for the other TypedArray classes here does not make sense - * since this vector math library only needs Float32Array and Float64Array. - * - */ -goog.provide('goog.vec.Float64Array'); - - - -/** - * Constructs a new Float64Array. The new array is initialized to all zeros. - * - * @param {goog.vec.Float64Array|Array|ArrayBuffer|number} p0 - * The length of the array, or an array to initialize the contents of the - * new Float64Array. - * @constructor - * @final - */ -goog.vec.Float64Array = function(p0) { - this.length = /** @type {number} */ (p0.length || p0); - for (var i = 0; i < this.length; i++) { - this[i] = p0[i] || 0; - } -}; - - -/** - * The number of bytes in an element (as defined by the Typed Array - * specification). - * - * @type {number} - */ -goog.vec.Float64Array.BYTES_PER_ELEMENT = 8; - - -/** - * The number of bytes in an element (as defined by the Typed Array - * specification). - * - * @type {number} - */ -goog.vec.Float64Array.prototype.BYTES_PER_ELEMENT = 8; - - -/** - * Sets elements of the array. - * @param {Array<number>|Float64Array} values The array of values. - * @param {number=} opt_offset The offset in this array to start. - */ -goog.vec.Float64Array.prototype.set = function(values, opt_offset) { - opt_offset = opt_offset || 0; - for (var i = 0; i < values.length && opt_offset + i < this.length; i++) { - this[opt_offset + i] = values[i]; - } -}; - - -/** - * Creates a string representation of this array. - * @return {string} The string version of this array. - * @override - */ -goog.vec.Float64Array.prototype.toString = Array.prototype.join; - - -/** - * Note that we cannot implement the subarray() or (deprecated) slice() - * methods properly since doing so would require being able to overload - * the [] operator which is not possible in javascript. So we leave - * them unimplemented. Any attempt to call these methods will just result - * in a javascript error since we leave them undefined. - */ - - -/** - * If no existing Float64Array implementation is found then we export - * goog.vec.Float64Array as Float64Array. - */ -if (typeof Float64Array == 'undefined') { - try { - goog.exportProperty(goog.vec.Float64Array, 'BYTES_PER_ELEMENT', - goog.vec.Float64Array.BYTES_PER_ELEMENT); - } catch (float64ArrayError) { - // Do nothing. This code is in place to fix b/7225850, in which an error - // is incorrectly thrown for Google TV on an old Chrome. - // TODO(user): remove after that version is retired. - } - - goog.exportProperty(goog.vec.Float64Array.prototype, 'BYTES_PER_ELEMENT', - goog.vec.Float64Array.prototype.BYTES_PER_ELEMENT); - goog.exportProperty(goog.vec.Float64Array.prototype, 'set', - goog.vec.Float64Array.prototype.set); - goog.exportProperty(goog.vec.Float64Array.prototype, 'toString', - goog.vec.Float64Array.prototype.toString); - goog.exportSymbol('Float64Array', goog.vec.Float64Array); -} - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/** - * @fileoverview Supplies global data types and constants for the vector math - * library. - */ -goog.provide('goog.vec'); -goog.provide('goog.vec.AnyType'); -goog.provide('goog.vec.ArrayType'); -goog.provide('goog.vec.Float32'); -goog.provide('goog.vec.Float64'); -goog.provide('goog.vec.Number'); - - -/** - * On platforms that don't have native Float32Array or Float64Array support we - * use a javascript implementation so that this math library can be used on all - * platforms. - * @suppress {extraRequire} - */ -goog.require('goog.vec.Float32Array'); -/** @suppress {extraRequire} */ -goog.require('goog.vec.Float64Array'); - -// All vector and matrix operations are based upon arrays of numbers using -// either Float32Array, Float64Array, or a standard Javascript Array of -// Numbers. - - -/** @typedef {!Float32Array} */ -goog.vec.Float32; - - -/** @typedef {!Float64Array} */ -goog.vec.Float64; - - -/** @typedef {!Array<number>} */ -goog.vec.Number; - - -/** @typedef {!goog.vec.Float32|!goog.vec.Float64|!goog.vec.Number} */ -goog.vec.AnyType; - - -/** - * @deprecated Use AnyType. - * @typedef {!Float32Array|!Array<number>} - */ -goog.vec.ArrayType; - - -/** - * For graphics work, 6 decimal places of accuracy are typically all that is - * required. - * - * @type {number} - * @const - */ -goog.vec.EPSILON = 1e-6; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/** - * @fileoverview Supplies 3 element vectors that are compatible with WebGL. - * Each element is a float32 since that is typically the desired size of a - * 3-vector in the GPU. The API is structured to avoid unnecessary memory - * allocations. The last parameter will typically be the output vector and - * an object can be both an input and output parameter to all methods except - * where noted. - * - */ -goog.provide('goog.vec.Vec3'); - -/** @suppress {extraRequire} */ -goog.require('goog.vec'); - -/** @typedef {goog.vec.Float32} */ goog.vec.Vec3.Float32; -/** @typedef {goog.vec.Float64} */ goog.vec.Vec3.Float64; -/** @typedef {goog.vec.Number} */ goog.vec.Vec3.Number; -/** @typedef {goog.vec.AnyType} */ goog.vec.Vec3.AnyType; - -// The following two types are deprecated - use the above types instead. -/** @typedef {Float32Array} */ goog.vec.Vec3.Type; -/** @typedef {goog.vec.ArrayType} */ goog.vec.Vec3.Vec3Like; - - -/** - * Creates a 3 element vector of Float32. The array is initialized to zero. - * - * @return {!goog.vec.Vec3.Float32} The new 3 element array. - */ -goog.vec.Vec3.createFloat32 = function() { - return new Float32Array(3); -}; - - -/** - * Creates a 3 element vector of Float64. The array is initialized to zero. - * - * @return {!goog.vec.Vec3.Float64} The new 3 element array. - */ -goog.vec.Vec3.createFloat64 = function() { - return new Float64Array(3); -}; - - -/** - * Creates a 3 element vector of Number. The array is initialized to zero. - * - * @return {!goog.vec.Vec3.Number} The new 3 element array. - */ -goog.vec.Vec3.createNumber = function() { - var a = new Array(3); - goog.vec.Vec3.setFromValues(a, 0, 0, 0); - return a; -}; - - -/** - * Creates a 3 element vector of Float32Array. The array is initialized to zero. - * - * @deprecated Use createFloat32. - * @return {!goog.vec.Vec3.Type} The new 3 element array. - */ -goog.vec.Vec3.create = function() { - return new Float32Array(3); -}; - - -/** - * Creates a new 3 element FLoat32 vector initialized with the value from the - * given array. - * - * @param {goog.vec.Vec3.AnyType} vec The source 3 element array. - * @return {!goog.vec.Vec3.Float32} The new 3 element array. - */ -goog.vec.Vec3.createFloat32FromArray = function(vec) { - var newVec = goog.vec.Vec3.createFloat32(); - goog.vec.Vec3.setFromArray(newVec, vec); - return newVec; -}; - - -/** - * Creates a new 3 element Float32 vector initialized with the supplied values. - * - * @param {number} v0 The value for element at index 0. - * @param {number} v1 The value for element at index 1. - * @param {number} v2 The value for element at index 2. - * @return {!goog.vec.Vec3.Float32} The new vector. - */ -goog.vec.Vec3.createFloat32FromValues = function(v0, v1, v2) { - var a = goog.vec.Vec3.createFloat32(); - goog.vec.Vec3.setFromValues(a, v0, v1, v2); - return a; -}; - - -/** - * Creates a clone of the given 3 element Float32 vector. - * - * @param {goog.vec.Vec3.Float32} vec The source 3 element vector. - * @return {!goog.vec.Vec3.Float32} The new cloned vector. - */ -goog.vec.Vec3.cloneFloat32 = goog.vec.Vec3.createFloat32FromArray; - - -/** - * Creates a new 3 element Float64 vector initialized with the value from the - * given array. - * - * @param {goog.vec.Vec3.AnyType} vec The source 3 element array. - * @return {!goog.vec.Vec3.Float64} The new 3 element array. - */ -goog.vec.Vec3.createFloat64FromArray = function(vec) { - var newVec = goog.vec.Vec3.createFloat64(); - goog.vec.Vec3.setFromArray(newVec, vec); - return newVec; -}; - - -/** -* Creates a new 3 element Float64 vector initialized with the supplied values. -* -* @param {number} v0 The value for element at index 0. -* @param {number} v1 The value for element at index 1. -* @param {number} v2 The value for element at index 2. -* @return {!goog.vec.Vec3.Float64} The new vector. -*/ -goog.vec.Vec3.createFloat64FromValues = function(v0, v1, v2) { - var vec = goog.vec.Vec3.createFloat64(); - goog.vec.Vec3.setFromValues(vec, v0, v1, v2); - return vec; -}; - - -/** - * Creates a clone of the given 3 element vector. - * - * @param {goog.vec.Vec3.Float64} vec The source 3 element vector. - * @return {!goog.vec.Vec3.Float64} The new cloned vector. - */ -goog.vec.Vec3.cloneFloat64 = goog.vec.Vec3.createFloat64FromArray; - - -/** - * Creates a new 3 element vector initialized with the value from the given - * array. - * - * @deprecated Use createFloat32FromArray. - * @param {goog.vec.Vec3.Vec3Like} vec The source 3 element array. - * @return {!goog.vec.Vec3.Type} The new 3 element array. - */ -goog.vec.Vec3.createFromArray = function(vec) { - var newVec = goog.vec.Vec3.create(); - goog.vec.Vec3.setFromArray(newVec, vec); - return newVec; -}; - - -/** - * Creates a new 3 element vector initialized with the supplied values. - * - * @deprecated Use createFloat32FromValues. - * @param {number} v0 The value for element at index 0. - * @param {number} v1 The value for element at index 1. - * @param {number} v2 The value for element at index 2. - * @return {!goog.vec.Vec3.Type} The new vector. - */ -goog.vec.Vec3.createFromValues = function(v0, v1, v2) { - var vec = goog.vec.Vec3.create(); - goog.vec.Vec3.setFromValues(vec, v0, v1, v2); - return vec; -}; - - -/** - * Creates a clone of the given 3 element vector. - * - * @deprecated Use cloneFloat32. - * @param {goog.vec.Vec3.Vec3Like} vec The source 3 element vector. - * @return {!goog.vec.Vec3.Type} The new cloned vector. - */ -goog.vec.Vec3.clone = function(vec) { - var newVec = goog.vec.Vec3.create(); - goog.vec.Vec3.setFromArray(newVec, vec); - return newVec; -}; - - -/** - * Initializes the vector with the given values. - * - * @param {goog.vec.Vec3.AnyType} vec The vector to receive the values. - * @param {number} v0 The value for element at index 0. - * @param {number} v1 The value for element at index 1. - * @param {number} v2 The value for element at index 2. - * @return {!goog.vec.Vec3.AnyType} Return vec so that operations can be - * chained together. - */ -goog.vec.Vec3.setFromValues = function(vec, v0, v1, v2) { - vec[0] = v0; - vec[1] = v1; - vec[2] = v2; - return vec; -}; - - -/** - * Initializes the vector with the given array of values. - * - * @param {goog.vec.Vec3.AnyType} vec The vector to receive the - * values. - * @param {goog.vec.Vec3.AnyType} values The array of values. - * @return {!goog.vec.Vec3.AnyType} Return vec so that operations can be - * chained together. - */ -goog.vec.Vec3.setFromArray = function(vec, values) { - vec[0] = values[0]; - vec[1] = values[1]; - vec[2] = values[2]; - return vec; -}; - - -/** - * Performs a component-wise addition of vec0 and vec1 together storing the - * result into resultVec. - * - * @param {goog.vec.Vec3.AnyType} vec0 The first addend. - * @param {goog.vec.Vec3.AnyType} vec1 The second addend. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to - * receive the result. May be vec0 or vec1. - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.add = function(vec0, vec1, resultVec) { - resultVec[0] = vec0[0] + vec1[0]; - resultVec[1] = vec0[1] + vec1[1]; - resultVec[2] = vec0[2] + vec1[2]; - return resultVec; -}; - - -/** - * Performs a component-wise subtraction of vec1 from vec0 storing the - * result into resultVec. - * - * @param {goog.vec.Vec3.AnyType} vec0 The minuend. - * @param {goog.vec.Vec3.AnyType} vec1 The subtrahend. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to - * receive the result. May be vec0 or vec1. - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.subtract = function(vec0, vec1, resultVec) { - resultVec[0] = vec0[0] - vec1[0]; - resultVec[1] = vec0[1] - vec1[1]; - resultVec[2] = vec0[2] - vec1[2]; - return resultVec; -}; - - -/** - * Negates vec0, storing the result into resultVec. - * - * @param {goog.vec.Vec3.AnyType} vec0 The vector to negate. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to - * receive the result. May be vec0. - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.negate = function(vec0, resultVec) { - resultVec[0] = -vec0[0]; - resultVec[1] = -vec0[1]; - resultVec[2] = -vec0[2]; - return resultVec; -}; - - -/** - * Takes the absolute value of each component of vec0 storing the result in - * resultVec. - * - * @param {goog.vec.Vec3.AnyType} vec0 The source vector. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to receive the result. - * May be vec0. - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.abs = function(vec0, resultVec) { - resultVec[0] = Math.abs(vec0[0]); - resultVec[1] = Math.abs(vec0[1]); - resultVec[2] = Math.abs(vec0[2]); - return resultVec; -}; - - -/** - * Multiplies each component of vec0 with scalar storing the product into - * resultVec. - * - * @param {goog.vec.Vec3.AnyType} vec0 The source vector. - * @param {number} scalar The value to multiply with each component of vec0. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to - * receive the result. May be vec0. - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.scale = function(vec0, scalar, resultVec) { - resultVec[0] = vec0[0] * scalar; - resultVec[1] = vec0[1] * scalar; - resultVec[2] = vec0[2] * scalar; - return resultVec; -}; - - -/** - * Returns the magnitudeSquared of the given vector. - * - * @param {goog.vec.Vec3.AnyType} vec0 The vector. - * @return {number} The magnitude of the vector. - */ -goog.vec.Vec3.magnitudeSquared = function(vec0) { - var x = vec0[0], y = vec0[1], z = vec0[2]; - return x * x + y * y + z * z; -}; - - -/** - * Returns the magnitude of the given vector. - * - * @param {goog.vec.Vec3.AnyType} vec0 The vector. - * @return {number} The magnitude of the vector. - */ -goog.vec.Vec3.magnitude = function(vec0) { - var x = vec0[0], y = vec0[1], z = vec0[2]; - return Math.sqrt(x * x + y * y + z * z); -}; - - -/** - * Normalizes the given vector storing the result into resultVec. - * - * @param {goog.vec.Vec3.AnyType} vec0 The vector to normalize. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to - * receive the result. May be vec0. - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.normalize = function(vec0, resultVec) { - var ilen = 1 / goog.vec.Vec3.magnitude(vec0); - resultVec[0] = vec0[0] * ilen; - resultVec[1] = vec0[1] * ilen; - resultVec[2] = vec0[2] * ilen; - return resultVec; -}; - - -/** - * Returns the scalar product of vectors v0 and v1. - * - * @param {goog.vec.Vec3.AnyType} v0 The first vector. - * @param {goog.vec.Vec3.AnyType} v1 The second vector. - * @return {number} The scalar product. - */ -goog.vec.Vec3.dot = function(v0, v1) { - return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2]; -}; - - -/** - * Computes the vector (cross) product of v0 and v1 storing the result into - * resultVec. - * - * @param {goog.vec.Vec3.AnyType} v0 The first vector. - * @param {goog.vec.Vec3.AnyType} v1 The second vector. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to receive the - * results. May be either v0 or v1. - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.cross = function(v0, v1, resultVec) { - var x0 = v0[0], y0 = v0[1], z0 = v0[2]; - var x1 = v1[0], y1 = v1[1], z1 = v1[2]; - resultVec[0] = y0 * z1 - z0 * y1; - resultVec[1] = z0 * x1 - x0 * z1; - resultVec[2] = x0 * y1 - y0 * x1; - return resultVec; -}; - - -/** - * Returns the squared distance between two points. - * - * @param {goog.vec.Vec3.AnyType} vec0 First point. - * @param {goog.vec.Vec3.AnyType} vec1 Second point. - * @return {number} The squared distance between the points. - */ -goog.vec.Vec3.distanceSquared = function(vec0, vec1) { - var x = vec0[0] - vec1[0]; - var y = vec0[1] - vec1[1]; - var z = vec0[2] - vec1[2]; - return x * x + y * y + z * z; -}; - - -/** - * Returns the distance between two points. - * - * @param {goog.vec.Vec3.AnyType} vec0 First point. - * @param {goog.vec.Vec3.AnyType} vec1 Second point. - * @return {number} The distance between the points. - */ -goog.vec.Vec3.distance = function(vec0, vec1) { - return Math.sqrt(goog.vec.Vec3.distanceSquared(vec0, vec1)); -}; - - -/** - * Returns a unit vector pointing from one point to another. - * If the input points are equal then the result will be all zeros. - * - * @param {goog.vec.Vec3.AnyType} vec0 Origin point. - * @param {goog.vec.Vec3.AnyType} vec1 Target point. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to receive the - * results (may be vec0 or vec1). - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.direction = function(vec0, vec1, resultVec) { - var x = vec1[0] - vec0[0]; - var y = vec1[1] - vec0[1]; - var z = vec1[2] - vec0[2]; - var d = Math.sqrt(x * x + y * y + z * z); - if (d) { - d = 1 / d; - resultVec[0] = x * d; - resultVec[1] = y * d; - resultVec[2] = z * d; - } else { - resultVec[0] = resultVec[1] = resultVec[2] = 0; - } - return resultVec; -}; - - -/** - * Linearly interpolate from vec0 to v1 according to f. The value of f should be - * in the range [0..1] otherwise the results are undefined. - * - * @param {goog.vec.Vec3.AnyType} v0 The first vector. - * @param {goog.vec.Vec3.AnyType} v1 The second vector. - * @param {number} f The interpolation factor. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to receive the - * results (may be v0 or v1). - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.lerp = function(v0, v1, f, resultVec) { - var x = v0[0], y = v0[1], z = v0[2]; - resultVec[0] = (v1[0] - x) * f + x; - resultVec[1] = (v1[1] - y) * f + y; - resultVec[2] = (v1[2] - z) * f + z; - return resultVec; -}; - - -/** - * Compares the components of vec0 with the components of another vector or - * scalar, storing the larger values in resultVec. - * - * @param {goog.vec.Vec3.AnyType} vec0 The source vector. - * @param {goog.vec.Vec3.AnyType|number} limit The limit vector or scalar. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to receive the - * results (may be vec0 or limit). - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.max = function(vec0, limit, resultVec) { - if (goog.isNumber(limit)) { - resultVec[0] = Math.max(vec0[0], limit); - resultVec[1] = Math.max(vec0[1], limit); - resultVec[2] = Math.max(vec0[2], limit); - } else { - resultVec[0] = Math.max(vec0[0], limit[0]); - resultVec[1] = Math.max(vec0[1], limit[1]); - resultVec[2] = Math.max(vec0[2], limit[2]); - } - return resultVec; -}; - - -/** - * Compares the components of vec0 with the components of another vector or - * scalar, storing the smaller values in resultVec. - * - * @param {goog.vec.Vec3.AnyType} vec0 The source vector. - * @param {goog.vec.Vec3.AnyType|number} limit The limit vector or scalar. - * @param {goog.vec.Vec3.AnyType} resultVec The vector to receive the - * results (may be vec0 or limit). - * @return {!goog.vec.Vec3.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec3.min = function(vec0, limit, resultVec) { - if (goog.isNumber(limit)) { - resultVec[0] = Math.min(vec0[0], limit); - resultVec[1] = Math.min(vec0[1], limit); - resultVec[2] = Math.min(vec0[2], limit); - } else { - resultVec[0] = Math.min(vec0[0], limit[0]); - resultVec[1] = Math.min(vec0[1], limit[1]); - resultVec[2] = Math.min(vec0[2], limit[2]); - } - return resultVec; -}; - - -/** - * Returns true if the components of v0 are equal to the components of v1. - * - * @param {goog.vec.Vec3.AnyType} v0 The first vector. - * @param {goog.vec.Vec3.AnyType} v1 The second vector. - * @return {boolean} True if the vectors are equal, false otherwise. - */ -goog.vec.Vec3.equals = function(v0, v1) { - return v0.length == v1.length && - v0[0] == v1[0] && v0[1] == v1[1] && v0[2] == v1[2]; -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/** - * @fileoverview Supplies 4 element vectors that are compatible with WebGL. - * Each element is a float32 since that is typically the desired size of a - * 4-vector in the GPU. The API is structured to avoid unnecessary memory - * allocations. The last parameter will typically be the output vector and - * an object can be both an input and output parameter to all methods except - * where noted. - * - */ -goog.provide('goog.vec.Vec4'); - -/** @suppress {extraRequire} */ -goog.require('goog.vec'); - -/** @typedef {goog.vec.Float32} */ goog.vec.Vec4.Float32; -/** @typedef {goog.vec.Float64} */ goog.vec.Vec4.Float64; -/** @typedef {goog.vec.Number} */ goog.vec.Vec4.Number; -/** @typedef {goog.vec.AnyType} */ goog.vec.Vec4.AnyType; - -// The following two types are deprecated - use the above types instead. -/** @typedef {Float32Array} */ goog.vec.Vec4.Type; -/** @typedef {goog.vec.ArrayType} */ goog.vec.Vec4.Vec4Like; - - -/** - * Creates a 4 element vector of Float32. The array is initialized to zero. - * - * @return {!goog.vec.Vec4.Float32} The new 3 element array. - */ -goog.vec.Vec4.createFloat32 = function() { - return new Float32Array(4); -}; - - -/** - * Creates a 4 element vector of Float64. The array is initialized to zero. - * - * @return {!goog.vec.Vec4.Float64} The new 4 element array. - */ -goog.vec.Vec4.createFloat64 = function() { - return new Float64Array(4); -}; - - -/** - * Creates a 4 element vector of Number. The array is initialized to zero. - * - * @return {!goog.vec.Vec4.Number} The new 4 element array. - */ -goog.vec.Vec4.createNumber = function() { - var v = new Array(4); - goog.vec.Vec4.setFromValues(v, 0, 0, 0, 0); - return v; -}; - - -/** - * Creates a 4 element vector of Float32Array. The array is initialized to zero. - * - * @deprecated Use createFloat32. - * @return {!goog.vec.Vec4.Type} The new 4 element array. - */ -goog.vec.Vec4.create = function() { - return new Float32Array(4); -}; - - -/** - * Creates a new 4 element vector initialized with the value from the given - * array. - * - * @deprecated Use createFloat32FromArray. - * @param {goog.vec.Vec4.Vec4Like} vec The source 4 element array. - * @return {!goog.vec.Vec4.Type} The new 4 element array. - */ -goog.vec.Vec4.createFromArray = function(vec) { - var newVec = goog.vec.Vec4.create(); - goog.vec.Vec4.setFromArray(newVec, vec); - return newVec; -}; - - -/** - * Creates a new 4 element FLoat32 vector initialized with the value from the - * given array. - * - * @param {goog.vec.Vec4.AnyType} vec The source 3 element array. - * @return {!goog.vec.Vec4.Float32} The new 3 element array. - */ -goog.vec.Vec4.createFloat32FromArray = function(vec) { - var newVec = goog.vec.Vec4.createFloat32(); - goog.vec.Vec4.setFromArray(newVec, vec); - return newVec; -}; - - -/** - * Creates a new 4 element Float32 vector initialized with the supplied values. - * - * @param {number} v0 The value for element at index 0. - * @param {number} v1 The value for element at index 1. - * @param {number} v2 The value for element at index 2. - * @param {number} v3 The value for element at index 3. - * @return {!goog.vec.Vec4.Float32} The new vector. - */ -goog.vec.Vec4.createFloat32FromValues = function(v0, v1, v2, v3) { - var vec = goog.vec.Vec4.createFloat32(); - goog.vec.Vec4.setFromValues(vec, v0, v1, v2, v3); - return vec; -}; - - -/** - * Creates a clone of the given 4 element Float32 vector. - * - * @param {goog.vec.Vec4.Float32} vec The source 3 element vector. - * @return {!goog.vec.Vec4.Float32} The new cloned vector. - */ -goog.vec.Vec4.cloneFloat32 = goog.vec.Vec4.createFloat32FromArray; - - -/** - * Creates a new 4 element Float64 vector initialized with the value from the - * given array. - * - * @param {goog.vec.Vec4.AnyType} vec The source 4 element array. - * @return {!goog.vec.Vec4.Float64} The new 4 element array. - */ -goog.vec.Vec4.createFloat64FromArray = function(vec) { - var newVec = goog.vec.Vec4.createFloat64(); - goog.vec.Vec4.setFromArray(newVec, vec); - return newVec; -}; - - -/** -* Creates a new 4 element Float64 vector initialized with the supplied values. -* -* @param {number} v0 The value for element at index 0. -* @param {number} v1 The value for element at index 1. -* @param {number} v2 The value for element at index 2. -* @param {number} v3 The value for element at index 3. -* @return {!goog.vec.Vec4.Float64} The new vector. -*/ -goog.vec.Vec4.createFloat64FromValues = function(v0, v1, v2, v3) { - var vec = goog.vec.Vec4.createFloat64(); - goog.vec.Vec4.setFromValues(vec, v0, v1, v2, v3); - return vec; -}; - - -/** - * Creates a clone of the given 4 element vector. - * - * @param {goog.vec.Vec4.Float64} vec The source 4 element vector. - * @return {!goog.vec.Vec4.Float64} The new cloned vector. - */ -goog.vec.Vec4.cloneFloat64 = goog.vec.Vec4.createFloat64FromArray; - - -/** - * Creates a new 4 element vector initialized with the supplied values. - * - * @deprecated Use createFloat32FromValues. - * @param {number} v0 The value for element at index 0. - * @param {number} v1 The value for element at index 1. - * @param {number} v2 The value for element at index 2. - * @param {number} v3 The value for element at index 3. - * @return {!goog.vec.Vec4.Type} The new vector. - */ -goog.vec.Vec4.createFromValues = function(v0, v1, v2, v3) { - var vec = goog.vec.Vec4.create(); - goog.vec.Vec4.setFromValues(vec, v0, v1, v2, v3); - return vec; -}; - - -/** - * Creates a clone of the given 4 element vector. - * - * @deprecated Use cloneFloat32. - * @param {goog.vec.Vec4.Vec4Like} vec The source 4 element vector. - * @return {!goog.vec.Vec4.Type} The new cloned vector. - */ -goog.vec.Vec4.clone = goog.vec.Vec4.createFromArray; - - -/** - * Initializes the vector with the given values. - * - * @param {goog.vec.Vec4.AnyType} vec The vector to receive the values. - * @param {number} v0 The value for element at index 0. - * @param {number} v1 The value for element at index 1. - * @param {number} v2 The value for element at index 2. - * @param {number} v3 The value for element at index 3. - * @return {!goog.vec.Vec4.AnyType} Return vec so that operations can be - * chained together. - */ -goog.vec.Vec4.setFromValues = function(vec, v0, v1, v2, v3) { - vec[0] = v0; - vec[1] = v1; - vec[2] = v2; - vec[3] = v3; - return vec; -}; - - -/** - * Initializes the vector with the given array of values. - * - * @param {goog.vec.Vec4.AnyType} vec The vector to receive the - * values. - * @param {goog.vec.Vec4.AnyType} values The array of values. - * @return {!goog.vec.Vec4.AnyType} Return vec so that operations can be - * chained together. - */ -goog.vec.Vec4.setFromArray = function(vec, values) { - vec[0] = values[0]; - vec[1] = values[1]; - vec[2] = values[2]; - vec[3] = values[3]; - return vec; -}; - - -/** - * Performs a component-wise addition of vec0 and vec1 together storing the - * result into resultVec. - * - * @param {goog.vec.Vec4.AnyType} vec0 The first addend. - * @param {goog.vec.Vec4.AnyType} vec1 The second addend. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to - * receive the result. May be vec0 or vec1. - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.add = function(vec0, vec1, resultVec) { - resultVec[0] = vec0[0] + vec1[0]; - resultVec[1] = vec0[1] + vec1[1]; - resultVec[2] = vec0[2] + vec1[2]; - resultVec[3] = vec0[3] + vec1[3]; - return resultVec; -}; - - -/** - * Performs a component-wise subtraction of vec1 from vec0 storing the - * result into resultVec. - * - * @param {goog.vec.Vec4.AnyType} vec0 The minuend. - * @param {goog.vec.Vec4.AnyType} vec1 The subtrahend. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to - * receive the result. May be vec0 or vec1. - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.subtract = function(vec0, vec1, resultVec) { - resultVec[0] = vec0[0] - vec1[0]; - resultVec[1] = vec0[1] - vec1[1]; - resultVec[2] = vec0[2] - vec1[2]; - resultVec[3] = vec0[3] - vec1[3]; - return resultVec; -}; - - -/** - * Negates vec0, storing the result into resultVec. - * - * @param {goog.vec.Vec4.AnyType} vec0 The vector to negate. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to - * receive the result. May be vec0. - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.negate = function(vec0, resultVec) { - resultVec[0] = -vec0[0]; - resultVec[1] = -vec0[1]; - resultVec[2] = -vec0[2]; - resultVec[3] = -vec0[3]; - return resultVec; -}; - - -/** - * Takes the absolute value of each component of vec0 storing the result in - * resultVec. - * - * @param {goog.vec.Vec4.AnyType} vec0 The source vector. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to receive the result. - * May be vec0. - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.abs = function(vec0, resultVec) { - resultVec[0] = Math.abs(vec0[0]); - resultVec[1] = Math.abs(vec0[1]); - resultVec[2] = Math.abs(vec0[2]); - resultVec[3] = Math.abs(vec0[3]); - return resultVec; -}; - - -/** - * Multiplies each component of vec0 with scalar storing the product into - * resultVec. - * - * @param {goog.vec.Vec4.AnyType} vec0 The source vector. - * @param {number} scalar The value to multiply with each component of vec0. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to - * receive the result. May be vec0. - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.scale = function(vec0, scalar, resultVec) { - resultVec[0] = vec0[0] * scalar; - resultVec[1] = vec0[1] * scalar; - resultVec[2] = vec0[2] * scalar; - resultVec[3] = vec0[3] * scalar; - return resultVec; -}; - - -/** - * Returns the magnitudeSquared of the given vector. - * - * @param {goog.vec.Vec4.AnyType} vec0 The vector. - * @return {number} The magnitude of the vector. - */ -goog.vec.Vec4.magnitudeSquared = function(vec0) { - var x = vec0[0], y = vec0[1], z = vec0[2], w = vec0[3]; - return x * x + y * y + z * z + w * w; -}; - - -/** - * Returns the magnitude of the given vector. - * - * @param {goog.vec.Vec4.AnyType} vec0 The vector. - * @return {number} The magnitude of the vector. - */ -goog.vec.Vec4.magnitude = function(vec0) { - var x = vec0[0], y = vec0[1], z = vec0[2], w = vec0[3]; - return Math.sqrt(x * x + y * y + z * z + w * w); -}; - - -/** - * Normalizes the given vector storing the result into resultVec. - * - * @param {goog.vec.Vec4.AnyType} vec0 The vector to normalize. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to - * receive the result. May be vec0. - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.normalize = function(vec0, resultVec) { - var ilen = 1 / goog.vec.Vec4.magnitude(vec0); - resultVec[0] = vec0[0] * ilen; - resultVec[1] = vec0[1] * ilen; - resultVec[2] = vec0[2] * ilen; - resultVec[3] = vec0[3] * ilen; - return resultVec; -}; - - -/** - * Returns the scalar product of vectors v0 and v1. - * - * @param {goog.vec.Vec4.AnyType} v0 The first vector. - * @param {goog.vec.Vec4.AnyType} v1 The second vector. - * @return {number} The scalar product. - */ -goog.vec.Vec4.dot = function(v0, v1) { - return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2] + v0[3] * v1[3]; -}; - - -/** - * Linearly interpolate from v0 to v1 according to f. The value of f should be - * in the range [0..1] otherwise the results are undefined. - * - * @param {goog.vec.Vec4.AnyType} v0 The first vector. - * @param {goog.vec.Vec4.AnyType} v1 The second vector. - * @param {number} f The interpolation factor. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to receive the - * results (may be v0 or v1). - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.lerp = function(v0, v1, f, resultVec) { - var x = v0[0], y = v0[1], z = v0[2], w = v0[3]; - resultVec[0] = (v1[0] - x) * f + x; - resultVec[1] = (v1[1] - y) * f + y; - resultVec[2] = (v1[2] - z) * f + z; - resultVec[3] = (v1[3] - w) * f + w; - return resultVec; -}; - - -/** - * Compares the components of vec0 with the components of another vector or - * scalar, storing the larger values in resultVec. - * - * @param {goog.vec.Vec4.AnyType} vec0 The source vector. - * @param {goog.vec.Vec4.AnyType|number} limit The limit vector or scalar. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to receive the - * results (may be vec0 or limit). - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.max = function(vec0, limit, resultVec) { - if (goog.isNumber(limit)) { - resultVec[0] = Math.max(vec0[0], limit); - resultVec[1] = Math.max(vec0[1], limit); - resultVec[2] = Math.max(vec0[2], limit); - resultVec[3] = Math.max(vec0[3], limit); - } else { - resultVec[0] = Math.max(vec0[0], limit[0]); - resultVec[1] = Math.max(vec0[1], limit[1]); - resultVec[2] = Math.max(vec0[2], limit[2]); - resultVec[3] = Math.max(vec0[3], limit[3]); - } - return resultVec; -}; - - -/** - * Compares the components of vec0 with the components of another vector or - * scalar, storing the smaller values in resultVec. - * - * @param {goog.vec.Vec4.AnyType} vec0 The source vector. - * @param {goog.vec.Vec4.AnyType|number} limit The limit vector or scalar. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to receive the - * results (may be vec0 or limit). - * @return {!goog.vec.Vec4.AnyType} Return resultVec so that operations can be - * chained together. - */ -goog.vec.Vec4.min = function(vec0, limit, resultVec) { - if (goog.isNumber(limit)) { - resultVec[0] = Math.min(vec0[0], limit); - resultVec[1] = Math.min(vec0[1], limit); - resultVec[2] = Math.min(vec0[2], limit); - resultVec[3] = Math.min(vec0[3], limit); - } else { - resultVec[0] = Math.min(vec0[0], limit[0]); - resultVec[1] = Math.min(vec0[1], limit[1]); - resultVec[2] = Math.min(vec0[2], limit[2]); - resultVec[3] = Math.min(vec0[3], limit[3]); - } - return resultVec; -}; - - -/** - * Returns true if the components of v0 are equal to the components of v1. - * - * @param {goog.vec.Vec4.AnyType} v0 The first vector. - * @param {goog.vec.Vec4.AnyType} v1 The second vector. - * @return {boolean} True if the vectors are equal, false otherwise. - */ -goog.vec.Vec4.equals = function(v0, v1) { - return v0.length == v1.length && - v0[0] == v1[0] && v0[1] == v1[1] && v0[2] == v1[2] && v0[3] == v1[3]; -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Implements 4x4 matrices and their related functions which are - * compatible with WebGL. The API is structured to avoid unnecessary memory - * allocations. The last parameter will typically be the output vector and - * an object can be both an input and output parameter to all methods except - * where noted. Matrix operations follow the mathematical form when multiplying - * vectors as follows: resultVec = matrix * vec. - * - * The matrices are stored in column-major order. - * - */ -goog.provide('goog.vec.Mat4'); - -goog.require('goog.vec'); -goog.require('goog.vec.Vec3'); -goog.require('goog.vec.Vec4'); - - -/** @typedef {goog.vec.Float32} */ goog.vec.Mat4.Float32; -/** @typedef {goog.vec.Float64} */ goog.vec.Mat4.Float64; -/** @typedef {goog.vec.Number} */ goog.vec.Mat4.Number; -/** @typedef {goog.vec.AnyType} */ goog.vec.Mat4.AnyType; - -// The following two types are deprecated - use the above types instead. -/** @typedef {!Float32Array} */ goog.vec.Mat4.Type; -/** @typedef {goog.vec.ArrayType} */ goog.vec.Mat4.Mat4Like; - - -/** - * Creates the array representation of a 4x4 matrix of Float32. - * The use of the array directly instead of a class reduces overhead. - * The returned matrix is cleared to all zeros. - * - * @return {!goog.vec.Mat4.Float32} The new matrix. - */ -goog.vec.Mat4.createFloat32 = function() { - return new Float32Array(16); -}; - - -/** - * Creates the array representation of a 4x4 matrix of Float64. - * The returned matrix is cleared to all zeros. - * - * @return {!goog.vec.Mat4.Float64} The new matrix. - */ -goog.vec.Mat4.createFloat64 = function() { - return new Float64Array(16); -}; - - -/** - * Creates the array representation of a 4x4 matrix of Number. - * The returned matrix is cleared to all zeros. - * - * @return {!goog.vec.Mat4.Number} The new matrix. - */ -goog.vec.Mat4.createNumber = function() { - var a = new Array(16); - goog.vec.Mat4.setFromValues(a, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0); - return a; -}; - - -/** - * Creates the array representation of a 4x4 matrix of Float32. - * The returned matrix is cleared to all zeros. - * - * @deprecated Use createFloat32. - * @return {!goog.vec.Mat4.Type} The new matrix. - */ -goog.vec.Mat4.create = function() { - return goog.vec.Mat4.createFloat32(); -}; - - -/** - * Creates a 4x4 identity matrix of Float32. - * - * @return {!goog.vec.Mat4.Float32} The new 16 element array. - */ -goog.vec.Mat4.createFloat32Identity = function() { - var mat = goog.vec.Mat4.createFloat32(); - mat[0] = mat[5] = mat[10] = mat[15] = 1; - return mat; -}; - - -/** - * Creates a 4x4 identity matrix of Float64. - * - * @return {!goog.vec.Mat4.Float64} The new 16 element array. - */ -goog.vec.Mat4.createFloat64Identity = function() { - var mat = goog.vec.Mat4.createFloat64(); - mat[0] = mat[5] = mat[10] = mat[15] = 1; - return mat; -}; - - -/** - * Creates a 4x4 identity matrix of Number. - * The returned matrix is cleared to all zeros. - * - * @return {!goog.vec.Mat4.Number} The new 16 element array. - */ -goog.vec.Mat4.createNumberIdentity = function() { - var a = new Array(16); - goog.vec.Mat4.setFromValues(a, - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1); - return a; -}; - - -/** - * Creates the array representation of a 4x4 matrix of Float32. - * The returned matrix is cleared to all zeros. - * - * @deprecated Use createFloat32Identity. - * @return {!goog.vec.Mat4.Type} The new 16 element array. - */ -goog.vec.Mat4.createIdentity = function() { - return goog.vec.Mat4.createFloat32Identity(); -}; - - -/** - * Creates a 4x4 matrix of Float32 initialized from the given array. - * - * @param {goog.vec.Mat4.AnyType} matrix The array containing the - * matrix values in column major order. - * @return {!goog.vec.Mat4.Float32} The new, 16 element array. - */ -goog.vec.Mat4.createFloat32FromArray = function(matrix) { - var newMatrix = goog.vec.Mat4.createFloat32(); - goog.vec.Mat4.setFromArray(newMatrix, matrix); - return newMatrix; -}; - - -/** - * Creates a 4x4 matrix of Float32 initialized from the given values. - * - * @param {number} v00 The values at (0, 0). - * @param {number} v10 The values at (1, 0). - * @param {number} v20 The values at (2, 0). - * @param {number} v30 The values at (3, 0). - * @param {number} v01 The values at (0, 1). - * @param {number} v11 The values at (1, 1). - * @param {number} v21 The values at (2, 1). - * @param {number} v31 The values at (3, 1). - * @param {number} v02 The values at (0, 2). - * @param {number} v12 The values at (1, 2). - * @param {number} v22 The values at (2, 2). - * @param {number} v32 The values at (3, 2). - * @param {number} v03 The values at (0, 3). - * @param {number} v13 The values at (1, 3). - * @param {number} v23 The values at (2, 3). - * @param {number} v33 The values at (3, 3). - * @return {!goog.vec.Mat4.Float32} The new, 16 element array. - */ -goog.vec.Mat4.createFloat32FromValues = function( - v00, v10, v20, v30, - v01, v11, v21, v31, - v02, v12, v22, v32, - v03, v13, v23, v33) { - var newMatrix = goog.vec.Mat4.createFloat32(); - goog.vec.Mat4.setFromValues( - newMatrix, v00, v10, v20, v30, v01, v11, v21, v31, v02, v12, v22, v32, - v03, v13, v23, v33); - return newMatrix; -}; - - -/** - * Creates a clone of a 4x4 matrix of Float32. - * - * @param {goog.vec.Mat4.Float32} matrix The source 4x4 matrix. - * @return {!goog.vec.Mat4.Float32} The new 4x4 element matrix. - */ -goog.vec.Mat4.cloneFloat32 = goog.vec.Mat4.createFloat32FromArray; - - -/** - * Creates a 4x4 matrix of Float64 initialized from the given array. - * - * @param {goog.vec.Mat4.AnyType} matrix The array containing the - * matrix values in column major order. - * @return {!goog.vec.Mat4.Float64} The new, nine element array. - */ -goog.vec.Mat4.createFloat64FromArray = function(matrix) { - var newMatrix = goog.vec.Mat4.createFloat64(); - goog.vec.Mat4.setFromArray(newMatrix, matrix); - return newMatrix; -}; - - -/** - * Creates a 4x4 matrix of Float64 initialized from the given values. - * - * @param {number} v00 The values at (0, 0). - * @param {number} v10 The values at (1, 0). - * @param {number} v20 The values at (2, 0). - * @param {number} v30 The values at (3, 0). - * @param {number} v01 The values at (0, 1). - * @param {number} v11 The values at (1, 1). - * @param {number} v21 The values at (2, 1). - * @param {number} v31 The values at (3, 1). - * @param {number} v02 The values at (0, 2). - * @param {number} v12 The values at (1, 2). - * @param {number} v22 The values at (2, 2). - * @param {number} v32 The values at (3, 2). - * @param {number} v03 The values at (0, 3). - * @param {number} v13 The values at (1, 3). - * @param {number} v23 The values at (2, 3). - * @param {number} v33 The values at (3, 3). - * @return {!goog.vec.Mat4.Float64} The new, 16 element array. - */ -goog.vec.Mat4.createFloat64FromValues = function( - v00, v10, v20, v30, - v01, v11, v21, v31, - v02, v12, v22, v32, - v03, v13, v23, v33) { - var newMatrix = goog.vec.Mat4.createFloat64(); - goog.vec.Mat4.setFromValues( - newMatrix, v00, v10, v20, v30, v01, v11, v21, v31, v02, v12, v22, v32, - v03, v13, v23, v33); - return newMatrix; -}; - - -/** - * Creates a clone of a 4x4 matrix of Float64. - * - * @param {goog.vec.Mat4.Float64} matrix The source 4x4 matrix. - * @return {!goog.vec.Mat4.Float64} The new 4x4 element matrix. - */ -goog.vec.Mat4.cloneFloat64 = goog.vec.Mat4.createFloat64FromArray; - - -/** - * Creates a 4x4 matrix of Float32 initialized from the given array. - * - * @deprecated Use createFloat32FromArray. - * @param {goog.vec.Mat4.Mat4Like} matrix The array containing the - * matrix values in column major order. - * @return {!goog.vec.Mat4.Type} The new, nine element array. - */ -goog.vec.Mat4.createFromArray = function(matrix) { - var newMatrix = goog.vec.Mat4.createFloat32(); - goog.vec.Mat4.setFromArray(newMatrix, matrix); - return newMatrix; -}; - - -/** - * Creates a 4x4 matrix of Float32 initialized from the given values. - * - * @deprecated Use createFloat32FromValues. - * @param {number} v00 The values at (0, 0). - * @param {number} v10 The values at (1, 0). - * @param {number} v20 The values at (2, 0). - * @param {number} v30 The values at (3, 0). - * @param {number} v01 The values at (0, 1). - * @param {number} v11 The values at (1, 1). - * @param {number} v21 The values at (2, 1). - * @param {number} v31 The values at (3, 1). - * @param {number} v02 The values at (0, 2). - * @param {number} v12 The values at (1, 2). - * @param {number} v22 The values at (2, 2). - * @param {number} v32 The values at (3, 2). - * @param {number} v03 The values at (0, 3). - * @param {number} v13 The values at (1, 3). - * @param {number} v23 The values at (2, 3). - * @param {number} v33 The values at (3, 3). - * @return {!goog.vec.Mat4.Type} The new, 16 element array. - */ -goog.vec.Mat4.createFromValues = function( - v00, v10, v20, v30, - v01, v11, v21, v31, - v02, v12, v22, v32, - v03, v13, v23, v33) { - return goog.vec.Mat4.createFloat32FromValues( - v00, v10, v20, v30, v01, v11, v21, v31, v02, v12, v22, v32, - v03, v13, v23, v33); -}; - - -/** - * Creates a clone of a 4x4 matrix of Float32. - * - * @deprecated Use cloneFloat32. - * @param {goog.vec.Mat4.Mat4Like} matrix The source 4x4 matrix. - * @return {!goog.vec.Mat4.Type} The new 4x4 element matrix. - */ -goog.vec.Mat4.clone = goog.vec.Mat4.createFromArray; - - -/** - * Retrieves the element at the requested row and column. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix containing the - * value to retrieve. - * @param {number} row The row index. - * @param {number} column The column index. - * @return {number} The element value at the requested row, column indices. - */ -goog.vec.Mat4.getElement = function(mat, row, column) { - return mat[row + column * 4]; -}; - - -/** - * Sets the element at the requested row and column. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to set the value on. - * @param {number} row The row index. - * @param {number} column The column index. - * @param {number} value The value to set at the requested row, column. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setElement = function(mat, row, column, value) { - mat[row + column * 4] = value; - return mat; -}; - - -/** - * Initializes the matrix from the set of values. Note the values supplied are - * in column major order. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the - * values. - * @param {number} v00 The values at (0, 0). - * @param {number} v10 The values at (1, 0). - * @param {number} v20 The values at (2, 0). - * @param {number} v30 The values at (3, 0). - * @param {number} v01 The values at (0, 1). - * @param {number} v11 The values at (1, 1). - * @param {number} v21 The values at (2, 1). - * @param {number} v31 The values at (3, 1). - * @param {number} v02 The values at (0, 2). - * @param {number} v12 The values at (1, 2). - * @param {number} v22 The values at (2, 2). - * @param {number} v32 The values at (3, 2). - * @param {number} v03 The values at (0, 3). - * @param {number} v13 The values at (1, 3). - * @param {number} v23 The values at (2, 3). - * @param {number} v33 The values at (3, 3). - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setFromValues = function( - mat, v00, v10, v20, v30, v01, v11, v21, v31, v02, v12, v22, v32, - v03, v13, v23, v33) { - mat[0] = v00; - mat[1] = v10; - mat[2] = v20; - mat[3] = v30; - mat[4] = v01; - mat[5] = v11; - mat[6] = v21; - mat[7] = v31; - mat[8] = v02; - mat[9] = v12; - mat[10] = v22; - mat[11] = v32; - mat[12] = v03; - mat[13] = v13; - mat[14] = v23; - mat[15] = v33; - return mat; -}; - - -/** - * Sets the matrix from the array of values stored in column major order. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the values. - * @param {goog.vec.Mat4.AnyType} values The column major ordered - * array of values to store in the matrix. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setFromArray = function(mat, values) { - mat[0] = values[0]; - mat[1] = values[1]; - mat[2] = values[2]; - mat[3] = values[3]; - mat[4] = values[4]; - mat[5] = values[5]; - mat[6] = values[6]; - mat[7] = values[7]; - mat[8] = values[8]; - mat[9] = values[9]; - mat[10] = values[10]; - mat[11] = values[11]; - mat[12] = values[12]; - mat[13] = values[13]; - mat[14] = values[14]; - mat[15] = values[15]; - return mat; -}; - - -/** - * Sets the matrix from the array of values stored in row major order. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the values. - * @param {goog.vec.Mat4.AnyType} values The row major ordered array of - * values to store in the matrix. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setFromRowMajorArray = function(mat, values) { - mat[0] = values[0]; - mat[1] = values[4]; - mat[2] = values[8]; - mat[3] = values[12]; - - mat[4] = values[1]; - mat[5] = values[5]; - mat[6] = values[9]; - mat[7] = values[13]; - - mat[8] = values[2]; - mat[9] = values[6]; - mat[10] = values[10]; - mat[11] = values[14]; - - mat[12] = values[3]; - mat[13] = values[7]; - mat[14] = values[11]; - mat[15] = values[15]; - - return mat; -}; - - -/** - * Sets the diagonal values of the matrix from the given values. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the values. - * @param {number} v00 The values for (0, 0). - * @param {number} v11 The values for (1, 1). - * @param {number} v22 The values for (2, 2). - * @param {number} v33 The values for (3, 3). - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setDiagonalValues = function(mat, v00, v11, v22, v33) { - mat[0] = v00; - mat[5] = v11; - mat[10] = v22; - mat[15] = v33; - return mat; -}; - - -/** - * Sets the diagonal values of the matrix from the given vector. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the values. - * @param {goog.vec.Vec4.AnyType} vec The vector containing the values. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setDiagonal = function(mat, vec) { - mat[0] = vec[0]; - mat[5] = vec[1]; - mat[10] = vec[2]; - mat[15] = vec[3]; - return mat; -}; - - -/** - * Gets the diagonal values of the matrix into the given vector. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix containing the values. - * @param {goog.vec.Vec4.AnyType} vec The vector to receive the values. - * @param {number=} opt_diagonal Which diagonal to get. A value of 0 selects the - * main diagonal, a positive number selects a super diagonal and a negative - * number selects a sub diagonal. - * @return {goog.vec.Vec4.AnyType} return vec so that operations can be - * chained together. - */ -goog.vec.Mat4.getDiagonal = function(mat, vec, opt_diagonal) { - if (!opt_diagonal) { - // This is the most common case, so we avoid the for loop. - vec[0] = mat[0]; - vec[1] = mat[5]; - vec[2] = mat[10]; - vec[3] = mat[15]; - } else { - var offset = opt_diagonal > 0 ? 4 * opt_diagonal : -opt_diagonal; - for (var i = 0; i < 4 - Math.abs(opt_diagonal); i++) { - vec[i] = mat[offset + 5 * i]; - } - } - return vec; -}; - - -/** - * Sets the specified column with the supplied values. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to recieve the values. - * @param {number} column The column index to set the values on. - * @param {number} v0 The value for row 0. - * @param {number} v1 The value for row 1. - * @param {number} v2 The value for row 2. - * @param {number} v3 The value for row 3. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setColumnValues = function(mat, column, v0, v1, v2, v3) { - var i = column * 4; - mat[i] = v0; - mat[i + 1] = v1; - mat[i + 2] = v2; - mat[i + 3] = v3; - return mat; -}; - - -/** - * Sets the specified column with the value from the supplied vector. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the values. - * @param {number} column The column index to set the values on. - * @param {goog.vec.Vec4.AnyType} vec The vector of elements for the column. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setColumn = function(mat, column, vec) { - var i = column * 4; - mat[i] = vec[0]; - mat[i + 1] = vec[1]; - mat[i + 2] = vec[2]; - mat[i + 3] = vec[3]; - return mat; -}; - - -/** - * Retrieves the specified column from the matrix into the given vector. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix supplying the values. - * @param {number} column The column to get the values from. - * @param {goog.vec.Vec4.AnyType} vec The vector of elements to - * receive the column. - * @return {goog.vec.Vec4.AnyType} return vec so that operations can be - * chained together. - */ -goog.vec.Mat4.getColumn = function(mat, column, vec) { - var i = column * 4; - vec[0] = mat[i]; - vec[1] = mat[i + 1]; - vec[2] = mat[i + 2]; - vec[3] = mat[i + 3]; - return vec; -}; - - -/** - * Sets the columns of the matrix from the given vectors. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the values. - * @param {goog.vec.Vec4.AnyType} vec0 The values for column 0. - * @param {goog.vec.Vec4.AnyType} vec1 The values for column 1. - * @param {goog.vec.Vec4.AnyType} vec2 The values for column 2. - * @param {goog.vec.Vec4.AnyType} vec3 The values for column 3. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setColumns = function(mat, vec0, vec1, vec2, vec3) { - goog.vec.Mat4.setColumn(mat, 0, vec0); - goog.vec.Mat4.setColumn(mat, 1, vec1); - goog.vec.Mat4.setColumn(mat, 2, vec2); - goog.vec.Mat4.setColumn(mat, 3, vec3); - return mat; -}; - - -/** - * Retrieves the column values from the given matrix into the given vectors. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix supplying the columns. - * @param {goog.vec.Vec4.AnyType} vec0 The vector to receive column 0. - * @param {goog.vec.Vec4.AnyType} vec1 The vector to receive column 1. - * @param {goog.vec.Vec4.AnyType} vec2 The vector to receive column 2. - * @param {goog.vec.Vec4.AnyType} vec3 The vector to receive column 3. - */ -goog.vec.Mat4.getColumns = function(mat, vec0, vec1, vec2, vec3) { - goog.vec.Mat4.getColumn(mat, 0, vec0); - goog.vec.Mat4.getColumn(mat, 1, vec1); - goog.vec.Mat4.getColumn(mat, 2, vec2); - goog.vec.Mat4.getColumn(mat, 3, vec3); -}; - - -/** - * Sets the row values from the supplied values. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the values. - * @param {number} row The index of the row to receive the values. - * @param {number} v0 The value for column 0. - * @param {number} v1 The value for column 1. - * @param {number} v2 The value for column 2. - * @param {number} v3 The value for column 3. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setRowValues = function(mat, row, v0, v1, v2, v3) { - mat[row] = v0; - mat[row + 4] = v1; - mat[row + 8] = v2; - mat[row + 12] = v3; - return mat; -}; - - -/** - * Sets the row values from the supplied vector. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the row values. - * @param {number} row The index of the row. - * @param {goog.vec.Vec4.AnyType} vec The vector containing the values. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setRow = function(mat, row, vec) { - mat[row] = vec[0]; - mat[row + 4] = vec[1]; - mat[row + 8] = vec[2]; - mat[row + 12] = vec[3]; - return mat; -}; - - -/** - * Retrieves the row values into the given vector. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix supplying the values. - * @param {number} row The index of the row supplying the values. - * @param {goog.vec.Vec4.AnyType} vec The vector to receive the row. - * @return {goog.vec.Vec4.AnyType} return vec so that operations can be - * chained together. - */ -goog.vec.Mat4.getRow = function(mat, row, vec) { - vec[0] = mat[row]; - vec[1] = mat[row + 4]; - vec[2] = mat[row + 8]; - vec[3] = mat[row + 12]; - return vec; -}; - - -/** - * Sets the rows of the matrix from the supplied vectors. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to receive the values. - * @param {goog.vec.Vec4.AnyType} vec0 The values for row 0. - * @param {goog.vec.Vec4.AnyType} vec1 The values for row 1. - * @param {goog.vec.Vec4.AnyType} vec2 The values for row 2. - * @param {goog.vec.Vec4.AnyType} vec3 The values for row 3. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained together. - */ -goog.vec.Mat4.setRows = function(mat, vec0, vec1, vec2, vec3) { - goog.vec.Mat4.setRow(mat, 0, vec0); - goog.vec.Mat4.setRow(mat, 1, vec1); - goog.vec.Mat4.setRow(mat, 2, vec2); - goog.vec.Mat4.setRow(mat, 3, vec3); - return mat; -}; - - -/** - * Retrieves the rows of the matrix into the supplied vectors. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to supply the values. - * @param {goog.vec.Vec4.AnyType} vec0 The vector to receive row 0. - * @param {goog.vec.Vec4.AnyType} vec1 The vector to receive row 1. - * @param {goog.vec.Vec4.AnyType} vec2 The vector to receive row 2. - * @param {goog.vec.Vec4.AnyType} vec3 The vector to receive row 3. - */ -goog.vec.Mat4.getRows = function(mat, vec0, vec1, vec2, vec3) { - goog.vec.Mat4.getRow(mat, 0, vec0); - goog.vec.Mat4.getRow(mat, 1, vec1); - goog.vec.Mat4.getRow(mat, 2, vec2); - goog.vec.Mat4.getRow(mat, 3, vec3); -}; - - -/** - * Makes the given 4x4 matrix the zero matrix. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @return {!goog.vec.Mat4.AnyType} return mat so operations can be chained. - */ -goog.vec.Mat4.makeZero = function(mat) { - mat[0] = 0; - mat[1] = 0; - mat[2] = 0; - mat[3] = 0; - mat[4] = 0; - mat[5] = 0; - mat[6] = 0; - mat[7] = 0; - mat[8] = 0; - mat[9] = 0; - mat[10] = 0; - mat[11] = 0; - mat[12] = 0; - mat[13] = 0; - mat[14] = 0; - mat[15] = 0; - return mat; -}; - - -/** - * Makes the given 4x4 matrix the identity matrix. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @return {goog.vec.Mat4.AnyType} return mat so operations can be chained. - */ -goog.vec.Mat4.makeIdentity = function(mat) { - mat[0] = 1; - mat[1] = 0; - mat[2] = 0; - mat[3] = 0; - mat[4] = 0; - mat[5] = 1; - mat[6] = 0; - mat[7] = 0; - mat[8] = 0; - mat[9] = 0; - mat[10] = 1; - mat[11] = 0; - mat[12] = 0; - mat[13] = 0; - mat[14] = 0; - mat[15] = 1; - return mat; -}; - - -/** - * Performs a per-component addition of the matrix mat0 and mat1, storing - * the result into resultMat. - * - * @param {goog.vec.Mat4.AnyType} mat0 The first addend. - * @param {goog.vec.Mat4.AnyType} mat1 The second addend. - * @param {goog.vec.Mat4.AnyType} resultMat The matrix to - * receive the results (may be either mat0 or mat1). - * @return {goog.vec.Mat4.AnyType} return resultMat so that operations can be - * chained together. - */ -goog.vec.Mat4.addMat = function(mat0, mat1, resultMat) { - resultMat[0] = mat0[0] + mat1[0]; - resultMat[1] = mat0[1] + mat1[1]; - resultMat[2] = mat0[2] + mat1[2]; - resultMat[3] = mat0[3] + mat1[3]; - resultMat[4] = mat0[4] + mat1[4]; - resultMat[5] = mat0[5] + mat1[5]; - resultMat[6] = mat0[6] + mat1[6]; - resultMat[7] = mat0[7] + mat1[7]; - resultMat[8] = mat0[8] + mat1[8]; - resultMat[9] = mat0[9] + mat1[9]; - resultMat[10] = mat0[10] + mat1[10]; - resultMat[11] = mat0[11] + mat1[11]; - resultMat[12] = mat0[12] + mat1[12]; - resultMat[13] = mat0[13] + mat1[13]; - resultMat[14] = mat0[14] + mat1[14]; - resultMat[15] = mat0[15] + mat1[15]; - return resultMat; -}; - - -/** - * Performs a per-component subtraction of the matrix mat0 and mat1, - * storing the result into resultMat. - * - * @param {goog.vec.Mat4.AnyType} mat0 The minuend. - * @param {goog.vec.Mat4.AnyType} mat1 The subtrahend. - * @param {goog.vec.Mat4.AnyType} resultMat The matrix to receive - * the results (may be either mat0 or mat1). - * @return {goog.vec.Mat4.AnyType} return resultMat so that operations can be - * chained together. - */ -goog.vec.Mat4.subMat = function(mat0, mat1, resultMat) { - resultMat[0] = mat0[0] - mat1[0]; - resultMat[1] = mat0[1] - mat1[1]; - resultMat[2] = mat0[2] - mat1[2]; - resultMat[3] = mat0[3] - mat1[3]; - resultMat[4] = mat0[4] - mat1[4]; - resultMat[5] = mat0[5] - mat1[5]; - resultMat[6] = mat0[6] - mat1[6]; - resultMat[7] = mat0[7] - mat1[7]; - resultMat[8] = mat0[8] - mat1[8]; - resultMat[9] = mat0[9] - mat1[9]; - resultMat[10] = mat0[10] - mat1[10]; - resultMat[11] = mat0[11] - mat1[11]; - resultMat[12] = mat0[12] - mat1[12]; - resultMat[13] = mat0[13] - mat1[13]; - resultMat[14] = mat0[14] - mat1[14]; - resultMat[15] = mat0[15] - mat1[15]; - return resultMat; -}; - - -/** - * Multiplies matrix mat with the given scalar, storing the result - * into resultMat. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} scalar The scalar value to multiply to each element of mat. - * @param {goog.vec.Mat4.AnyType} resultMat The matrix to receive - * the results (may be mat). - * @return {goog.vec.Mat4.AnyType} return resultMat so that operations can be - * chained together. - */ -goog.vec.Mat4.multScalar = function(mat, scalar, resultMat) { - resultMat[0] = mat[0] * scalar; - resultMat[1] = mat[1] * scalar; - resultMat[2] = mat[2] * scalar; - resultMat[3] = mat[3] * scalar; - resultMat[4] = mat[4] * scalar; - resultMat[5] = mat[5] * scalar; - resultMat[6] = mat[6] * scalar; - resultMat[7] = mat[7] * scalar; - resultMat[8] = mat[8] * scalar; - resultMat[9] = mat[9] * scalar; - resultMat[10] = mat[10] * scalar; - resultMat[11] = mat[11] * scalar; - resultMat[12] = mat[12] * scalar; - resultMat[13] = mat[13] * scalar; - resultMat[14] = mat[14] * scalar; - resultMat[15] = mat[15] * scalar; - return resultMat; -}; - - -/** - * Multiplies the two matrices mat0 and mat1 using matrix multiplication, - * storing the result into resultMat. - * - * @param {goog.vec.Mat4.AnyType} mat0 The first (left hand) matrix. - * @param {goog.vec.Mat4.AnyType} mat1 The second (right hand) matrix. - * @param {goog.vec.Mat4.AnyType} resultMat The matrix to receive - * the results (may be either mat0 or mat1). - * @return {goog.vec.Mat4.AnyType} return resultMat so that operations can be - * chained together. - */ -goog.vec.Mat4.multMat = function(mat0, mat1, resultMat) { - var a00 = mat0[0], a10 = mat0[1], a20 = mat0[2], a30 = mat0[3]; - var a01 = mat0[4], a11 = mat0[5], a21 = mat0[6], a31 = mat0[7]; - var a02 = mat0[8], a12 = mat0[9], a22 = mat0[10], a32 = mat0[11]; - var a03 = mat0[12], a13 = mat0[13], a23 = mat0[14], a33 = mat0[15]; - - var b00 = mat1[0], b10 = mat1[1], b20 = mat1[2], b30 = mat1[3]; - var b01 = mat1[4], b11 = mat1[5], b21 = mat1[6], b31 = mat1[7]; - var b02 = mat1[8], b12 = mat1[9], b22 = mat1[10], b32 = mat1[11]; - var b03 = mat1[12], b13 = mat1[13], b23 = mat1[14], b33 = mat1[15]; - - resultMat[0] = a00 * b00 + a01 * b10 + a02 * b20 + a03 * b30; - resultMat[1] = a10 * b00 + a11 * b10 + a12 * b20 + a13 * b30; - resultMat[2] = a20 * b00 + a21 * b10 + a22 * b20 + a23 * b30; - resultMat[3] = a30 * b00 + a31 * b10 + a32 * b20 + a33 * b30; - - resultMat[4] = a00 * b01 + a01 * b11 + a02 * b21 + a03 * b31; - resultMat[5] = a10 * b01 + a11 * b11 + a12 * b21 + a13 * b31; - resultMat[6] = a20 * b01 + a21 * b11 + a22 * b21 + a23 * b31; - resultMat[7] = a30 * b01 + a31 * b11 + a32 * b21 + a33 * b31; - - resultMat[8] = a00 * b02 + a01 * b12 + a02 * b22 + a03 * b32; - resultMat[9] = a10 * b02 + a11 * b12 + a12 * b22 + a13 * b32; - resultMat[10] = a20 * b02 + a21 * b12 + a22 * b22 + a23 * b32; - resultMat[11] = a30 * b02 + a31 * b12 + a32 * b22 + a33 * b32; - - resultMat[12] = a00 * b03 + a01 * b13 + a02 * b23 + a03 * b33; - resultMat[13] = a10 * b03 + a11 * b13 + a12 * b23 + a13 * b33; - resultMat[14] = a20 * b03 + a21 * b13 + a22 * b23 + a23 * b33; - resultMat[15] = a30 * b03 + a31 * b13 + a32 * b23 + a33 * b33; - return resultMat; -}; - - -/** - * Transposes the given matrix mat storing the result into resultMat. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to transpose. - * @param {goog.vec.Mat4.AnyType} resultMat The matrix to receive - * the results (may be mat). - * @return {goog.vec.Mat4.AnyType} return resultMat so that operations can be - * chained together. - */ -goog.vec.Mat4.transpose = function(mat, resultMat) { - if (resultMat == mat) { - var a10 = mat[1], a20 = mat[2], a30 = mat[3]; - var a21 = mat[6], a31 = mat[7]; - var a32 = mat[11]; - resultMat[1] = mat[4]; - resultMat[2] = mat[8]; - resultMat[3] = mat[12]; - resultMat[4] = a10; - resultMat[6] = mat[9]; - resultMat[7] = mat[13]; - resultMat[8] = a20; - resultMat[9] = a21; - resultMat[11] = mat[14]; - resultMat[12] = a30; - resultMat[13] = a31; - resultMat[14] = a32; - } else { - resultMat[0] = mat[0]; - resultMat[1] = mat[4]; - resultMat[2] = mat[8]; - resultMat[3] = mat[12]; - - resultMat[4] = mat[1]; - resultMat[5] = mat[5]; - resultMat[6] = mat[9]; - resultMat[7] = mat[13]; - - resultMat[8] = mat[2]; - resultMat[9] = mat[6]; - resultMat[10] = mat[10]; - resultMat[11] = mat[14]; - - resultMat[12] = mat[3]; - resultMat[13] = mat[7]; - resultMat[14] = mat[11]; - resultMat[15] = mat[15]; - } - return resultMat; -}; - - -/** - * Computes the determinant of the matrix. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to compute the matrix for. - * @return {number} The determinant of the matrix. - */ -goog.vec.Mat4.determinant = function(mat) { - var m00 = mat[0], m10 = mat[1], m20 = mat[2], m30 = mat[3]; - var m01 = mat[4], m11 = mat[5], m21 = mat[6], m31 = mat[7]; - var m02 = mat[8], m12 = mat[9], m22 = mat[10], m32 = mat[11]; - var m03 = mat[12], m13 = mat[13], m23 = mat[14], m33 = mat[15]; - - var a0 = m00 * m11 - m10 * m01; - var a1 = m00 * m21 - m20 * m01; - var a2 = m00 * m31 - m30 * m01; - var a3 = m10 * m21 - m20 * m11; - var a4 = m10 * m31 - m30 * m11; - var a5 = m20 * m31 - m30 * m21; - var b0 = m02 * m13 - m12 * m03; - var b1 = m02 * m23 - m22 * m03; - var b2 = m02 * m33 - m32 * m03; - var b3 = m12 * m23 - m22 * m13; - var b4 = m12 * m33 - m32 * m13; - var b5 = m22 * m33 - m32 * m23; - - return a0 * b5 - a1 * b4 + a2 * b3 + a3 * b2 - a4 * b1 + a5 * b0; -}; - - -/** - * Computes the inverse of mat storing the result into resultMat. If the - * inverse is defined, this function returns true, false otherwise. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix to invert. - * @param {goog.vec.Mat4.AnyType} resultMat The matrix to receive - * the result (may be mat). - * @return {boolean} True if the inverse is defined. If false is returned, - * resultMat is not modified. - */ -goog.vec.Mat4.invert = function(mat, resultMat) { - var m00 = mat[0], m10 = mat[1], m20 = mat[2], m30 = mat[3]; - var m01 = mat[4], m11 = mat[5], m21 = mat[6], m31 = mat[7]; - var m02 = mat[8], m12 = mat[9], m22 = mat[10], m32 = mat[11]; - var m03 = mat[12], m13 = mat[13], m23 = mat[14], m33 = mat[15]; - - var a0 = m00 * m11 - m10 * m01; - var a1 = m00 * m21 - m20 * m01; - var a2 = m00 * m31 - m30 * m01; - var a3 = m10 * m21 - m20 * m11; - var a4 = m10 * m31 - m30 * m11; - var a5 = m20 * m31 - m30 * m21; - var b0 = m02 * m13 - m12 * m03; - var b1 = m02 * m23 - m22 * m03; - var b2 = m02 * m33 - m32 * m03; - var b3 = m12 * m23 - m22 * m13; - var b4 = m12 * m33 - m32 * m13; - var b5 = m22 * m33 - m32 * m23; - - var det = a0 * b5 - a1 * b4 + a2 * b3 + a3 * b2 - a4 * b1 + a5 * b0; - if (det == 0) { - return false; - } - - var idet = 1.0 / det; - resultMat[0] = (m11 * b5 - m21 * b4 + m31 * b3) * idet; - resultMat[1] = (-m10 * b5 + m20 * b4 - m30 * b3) * idet; - resultMat[2] = (m13 * a5 - m23 * a4 + m33 * a3) * idet; - resultMat[3] = (-m12 * a5 + m22 * a4 - m32 * a3) * idet; - resultMat[4] = (-m01 * b5 + m21 * b2 - m31 * b1) * idet; - resultMat[5] = (m00 * b5 - m20 * b2 + m30 * b1) * idet; - resultMat[6] = (-m03 * a5 + m23 * a2 - m33 * a1) * idet; - resultMat[7] = (m02 * a5 - m22 * a2 + m32 * a1) * idet; - resultMat[8] = (m01 * b4 - m11 * b2 + m31 * b0) * idet; - resultMat[9] = (-m00 * b4 + m10 * b2 - m30 * b0) * idet; - resultMat[10] = (m03 * a4 - m13 * a2 + m33 * a0) * idet; - resultMat[11] = (-m02 * a4 + m12 * a2 - m32 * a0) * idet; - resultMat[12] = (-m01 * b3 + m11 * b1 - m21 * b0) * idet; - resultMat[13] = (m00 * b3 - m10 * b1 + m20 * b0) * idet; - resultMat[14] = (-m03 * a3 + m13 * a1 - m23 * a0) * idet; - resultMat[15] = (m02 * a3 - m12 * a1 + m22 * a0) * idet; - return true; -}; - - -/** - * Returns true if the components of mat0 are equal to the components of mat1. - * - * @param {goog.vec.Mat4.AnyType} mat0 The first matrix. - * @param {goog.vec.Mat4.AnyType} mat1 The second matrix. - * @return {boolean} True if the the two matrices are equivalent. - */ -goog.vec.Mat4.equals = function(mat0, mat1) { - return mat0.length == mat1.length && - mat0[0] == mat1[0] && - mat0[1] == mat1[1] && - mat0[2] == mat1[2] && - mat0[3] == mat1[3] && - mat0[4] == mat1[4] && - mat0[5] == mat1[5] && - mat0[6] == mat1[6] && - mat0[7] == mat1[7] && - mat0[8] == mat1[8] && - mat0[9] == mat1[9] && - mat0[10] == mat1[10] && - mat0[11] == mat1[11] && - mat0[12] == mat1[12] && - mat0[13] == mat1[13] && - mat0[14] == mat1[14] && - mat0[15] == mat1[15]; -}; - - -/** - * Transforms the given vector with the given matrix storing the resulting, - * transformed vector into resultVec. The input vector is multiplied against the - * upper 3x4 matrix omitting the projective component. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix supplying the transformation. - * @param {goog.vec.Vec3.AnyType} vec The 3 element vector to transform. - * @param {goog.vec.Vec3.AnyType} resultVec The 3 element vector to - * receive the results (may be vec). - * @return {goog.vec.Vec3.AnyType} return resultVec so that operations can be - * chained together. - */ -goog.vec.Mat4.multVec3 = function(mat, vec, resultVec) { - var x = vec[0], y = vec[1], z = vec[2]; - resultVec[0] = x * mat[0] + y * mat[4] + z * mat[8] + mat[12]; - resultVec[1] = x * mat[1] + y * mat[5] + z * mat[9] + mat[13]; - resultVec[2] = x * mat[2] + y * mat[6] + z * mat[10] + mat[14]; - return resultVec; -}; - - -/** - * Transforms the given vector with the given matrix storing the resulting, - * transformed vector into resultVec. The input vector is multiplied against the - * upper 3x3 matrix omitting the projective component and translation - * components. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix supplying the transformation. - * @param {goog.vec.Vec3.AnyType} vec The 3 element vector to transform. - * @param {goog.vec.Vec3.AnyType} resultVec The 3 element vector to - * receive the results (may be vec). - * @return {goog.vec.Vec3.AnyType} return resultVec so that operations can be - * chained together. - */ -goog.vec.Mat4.multVec3NoTranslate = function(mat, vec, resultVec) { - var x = vec[0], y = vec[1], z = vec[2]; - resultVec[0] = x * mat[0] + y * mat[4] + z * mat[8]; - resultVec[1] = x * mat[1] + y * mat[5] + z * mat[9]; - resultVec[2] = x * mat[2] + y * mat[6] + z * mat[10]; - return resultVec; -}; - - -/** - * Transforms the given vector with the given matrix storing the resulting, - * transformed vector into resultVec. The input vector is multiplied against the - * full 4x4 matrix with the homogeneous divide applied to reduce the 4 element - * vector to a 3 element vector. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix supplying the transformation. - * @param {goog.vec.Vec3.AnyType} vec The 3 element vector to transform. - * @param {goog.vec.Vec3.AnyType} resultVec The 3 element vector - * to receive the results (may be vec). - * @return {goog.vec.Vec3.AnyType} return resultVec so that operations can be - * chained together. - */ -goog.vec.Mat4.multVec3Projective = function(mat, vec, resultVec) { - var x = vec[0], y = vec[1], z = vec[2]; - var invw = 1 / (x * mat[3] + y * mat[7] + z * mat[11] + mat[15]); - resultVec[0] = (x * mat[0] + y * mat[4] + z * mat[8] + mat[12]) * invw; - resultVec[1] = (x * mat[1] + y * mat[5] + z * mat[9] + mat[13]) * invw; - resultVec[2] = (x * mat[2] + y * mat[6] + z * mat[10] + mat[14]) * invw; - return resultVec; -}; - - -/** - * Transforms the given vector with the given matrix storing the resulting, - * transformed vector into resultVec. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix supplying the transformation. - * @param {goog.vec.Vec4.AnyType} vec The vector to transform. - * @param {goog.vec.Vec4.AnyType} resultVec The vector to - * receive the results (may be vec). - * @return {goog.vec.Vec4.AnyType} return resultVec so that operations can be - * chained together. - */ -goog.vec.Mat4.multVec4 = function(mat, vec, resultVec) { - var x = vec[0], y = vec[1], z = vec[2], w = vec[3]; - resultVec[0] = x * mat[0] + y * mat[4] + z * mat[8] + w * mat[12]; - resultVec[1] = x * mat[1] + y * mat[5] + z * mat[9] + w * mat[13]; - resultVec[2] = x * mat[2] + y * mat[6] + z * mat[10] + w * mat[14]; - resultVec[3] = x * mat[3] + y * mat[7] + z * mat[11] + w * mat[15]; - return resultVec; -}; - - -/** - * Makes the given 4x4 matrix a translation matrix with x, y and z - * translation factors. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} x The translation along the x axis. - * @param {number} y The translation along the y axis. - * @param {number} z The translation along the z axis. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeTranslate = function(mat, x, y, z) { - goog.vec.Mat4.makeIdentity(mat); - return goog.vec.Mat4.setColumnValues(mat, 3, x, y, z, 1); -}; - - -/** - * Makes the given 4x4 matrix as a scale matrix with x, y and z scale factors. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} x The scale along the x axis. - * @param {number} y The scale along the y axis. - * @param {number} z The scale along the z axis. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeScale = function(mat, x, y, z) { - goog.vec.Mat4.makeIdentity(mat); - return goog.vec.Mat4.setDiagonalValues(mat, x, y, z, 1); -}; - - -/** - * Makes the given 4x4 matrix a rotation matrix with the given rotation - * angle about the axis defined by the vector (ax, ay, az). - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} angle The rotation angle in radians. - * @param {number} ax The x component of the rotation axis. - * @param {number} ay The y component of the rotation axis. - * @param {number} az The z component of the rotation axis. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeRotate = function(mat, angle, ax, ay, az) { - var c = Math.cos(angle); - var d = 1 - c; - var s = Math.sin(angle); - - return goog.vec.Mat4.setFromValues(mat, - ax * ax * d + c, - ax * ay * d + az * s, - ax * az * d - ay * s, - 0, - - ax * ay * d - az * s, - ay * ay * d + c, - ay * az * d + ax * s, - 0, - - ax * az * d + ay * s, - ay * az * d - ax * s, - az * az * d + c, - 0, - - 0, 0, 0, 1); -}; - - -/** - * Makes the given 4x4 matrix a rotation matrix with the given rotation - * angle about the X axis. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} angle The rotation angle in radians. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeRotateX = function(mat, angle) { - var c = Math.cos(angle); - var s = Math.sin(angle); - return goog.vec.Mat4.setFromValues( - mat, 1, 0, 0, 0, 0, c, s, 0, 0, -s, c, 0, 0, 0, 0, 1); -}; - - -/** - * Makes the given 4x4 matrix a rotation matrix with the given rotation - * angle about the Y axis. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} angle The rotation angle in radians. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeRotateY = function(mat, angle) { - var c = Math.cos(angle); - var s = Math.sin(angle); - return goog.vec.Mat4.setFromValues( - mat, c, 0, -s, 0, 0, 1, 0, 0, s, 0, c, 0, 0, 0, 0, 1); -}; - - -/** - * Makes the given 4x4 matrix a rotation matrix with the given rotation - * angle about the Z axis. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} angle The rotation angle in radians. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeRotateZ = function(mat, angle) { - var c = Math.cos(angle); - var s = Math.sin(angle); - return goog.vec.Mat4.setFromValues( - mat, c, s, 0, 0, -s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); -}; - - -/** - * Makes the given 4x4 matrix a perspective projection matrix. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} left The coordinate of the left clipping plane. - * @param {number} right The coordinate of the right clipping plane. - * @param {number} bottom The coordinate of the bottom clipping plane. - * @param {number} top The coordinate of the top clipping plane. - * @param {number} near The distance to the near clipping plane. - * @param {number} far The distance to the far clipping plane. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeFrustum = function(mat, left, right, bottom, top, near, far) { - var x = (2 * near) / (right - left); - var y = (2 * near) / (top - bottom); - var a = (right + left) / (right - left); - var b = (top + bottom) / (top - bottom); - var c = -(far + near) / (far - near); - var d = -(2 * far * near) / (far - near); - - return goog.vec.Mat4.setFromValues(mat, - x, 0, 0, 0, - 0, y, 0, 0, - a, b, c, -1, - 0, 0, d, 0 - ); -}; - - -/** - * Makse the given 4x4 matrix perspective projection matrix given a - * field of view and aspect ratio. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} fovy The field of view along the y (vertical) axis in - * radians. - * @param {number} aspect The x (width) to y (height) aspect ratio. - * @param {number} near The distance to the near clipping plane. - * @param {number} far The distance to the far clipping plane. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makePerspective = function(mat, fovy, aspect, near, far) { - var angle = fovy / 2; - var dz = far - near; - var sinAngle = Math.sin(angle); - if (dz == 0 || sinAngle == 0 || aspect == 0) { - return mat; - } - - var cot = Math.cos(angle) / sinAngle; - return goog.vec.Mat4.setFromValues(mat, - cot / aspect, 0, 0, 0, - 0, cot, 0, 0, - 0, 0, -(far + near) / dz, -1, - 0, 0, -(2 * near * far) / dz, 0 - ); -}; - - -/** - * Makes the given 4x4 matrix an orthographic projection matrix. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} left The coordinate of the left clipping plane. - * @param {number} right The coordinate of the right clipping plane. - * @param {number} bottom The coordinate of the bottom clipping plane. - * @param {number} top The coordinate of the top clipping plane. - * @param {number} near The distance to the near clipping plane. - * @param {number} far The distance to the far clipping plane. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeOrtho = function(mat, left, right, bottom, top, near, far) { - var x = 2 / (right - left); - var y = 2 / (top - bottom); - var z = -2 / (far - near); - var a = -(right + left) / (right - left); - var b = -(top + bottom) / (top - bottom); - var c = -(far + near) / (far - near); - - return goog.vec.Mat4.setFromValues(mat, - x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - a, b, c, 1 - ); -}; - - -/** - * Makes the given 4x4 matrix a modelview matrix of a camera so that - * the camera is 'looking at' the given center point. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {goog.vec.Vec3.AnyType} eyePt The position of the eye point - * (camera origin). - * @param {goog.vec.Vec3.AnyType} centerPt The point to aim the camera at. - * @param {goog.vec.Vec3.AnyType} worldUpVec The vector that identifies - * the up direction for the camera. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeLookAt = function(mat, eyePt, centerPt, worldUpVec) { - // Compute the direction vector from the eye point to the center point and - // normalize. - var fwdVec = goog.vec.Mat4.tmpVec4_[0]; - goog.vec.Vec3.subtract(centerPt, eyePt, fwdVec); - goog.vec.Vec3.normalize(fwdVec, fwdVec); - fwdVec[3] = 0; - - // Compute the side vector from the forward vector and the input up vector. - var sideVec = goog.vec.Mat4.tmpVec4_[1]; - goog.vec.Vec3.cross(fwdVec, worldUpVec, sideVec); - goog.vec.Vec3.normalize(sideVec, sideVec); - sideVec[3] = 0; - - // Now the up vector to form the orthonormal basis. - var upVec = goog.vec.Mat4.tmpVec4_[2]; - goog.vec.Vec3.cross(sideVec, fwdVec, upVec); - goog.vec.Vec3.normalize(upVec, upVec); - upVec[3] = 0; - - // Update the view matrix with the new orthonormal basis and position the - // camera at the given eye point. - goog.vec.Vec3.negate(fwdVec, fwdVec); - goog.vec.Mat4.setRow(mat, 0, sideVec); - goog.vec.Mat4.setRow(mat, 1, upVec); - goog.vec.Mat4.setRow(mat, 2, fwdVec); - goog.vec.Mat4.setRowValues(mat, 3, 0, 0, 0, 1); - goog.vec.Mat4.translate( - mat, -eyePt[0], -eyePt[1], -eyePt[2]); - - return mat; -}; - - -/** - * Decomposes a matrix into the lookAt vectors eyePt, fwdVec and worldUpVec. - * The matrix represents the modelview matrix of a camera. It is the inverse - * of lookAt except for the output of the fwdVec instead of centerPt. - * The centerPt itself cannot be recovered from a modelview matrix. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {goog.vec.Vec3.AnyType} eyePt The position of the eye point - * (camera origin). - * @param {goog.vec.Vec3.AnyType} fwdVec The vector describing where - * the camera points to. - * @param {goog.vec.Vec3.AnyType} worldUpVec The vector that - * identifies the up direction for the camera. - * @return {boolean} True if the method succeeds, false otherwise. - * The method can only fail if the inverse of viewMatrix is not defined. - */ -goog.vec.Mat4.toLookAt = function(mat, eyePt, fwdVec, worldUpVec) { - // Get eye of the camera. - var matInverse = goog.vec.Mat4.tmpMat4_[0]; - if (!goog.vec.Mat4.invert(mat, matInverse)) { - // The input matrix does not have a valid inverse. - return false; - } - - if (eyePt) { - eyePt[0] = matInverse[12]; - eyePt[1] = matInverse[13]; - eyePt[2] = matInverse[14]; - } - - // Get forward vector from the definition of lookAt. - if (fwdVec || worldUpVec) { - if (!fwdVec) { - fwdVec = goog.vec.Mat4.tmpVec3_[0]; - } - fwdVec[0] = -mat[2]; - fwdVec[1] = -mat[6]; - fwdVec[2] = -mat[10]; - // Normalize forward vector. - goog.vec.Vec3.normalize(fwdVec, fwdVec); - } - - if (worldUpVec) { - // Get side vector from the definition of gluLookAt. - var side = goog.vec.Mat4.tmpVec3_[1]; - side[0] = mat[0]; - side[1] = mat[4]; - side[2] = mat[8]; - // Compute up vector as a up = side x forward. - goog.vec.Vec3.cross(side, fwdVec, worldUpVec); - // Normalize up vector. - goog.vec.Vec3.normalize(worldUpVec, worldUpVec); - } - return true; -}; - - -/** - * Makes the given 4x4 matrix a rotation matrix given Euler angles using - * the ZXZ convention. - * Given the euler angles [theta1, theta2, theta3], the rotation is defined as - * rotation = rotation_z(theta1) * rotation_x(theta2) * rotation_z(theta3), - * with theta1 in [0, 2 * pi], theta2 in [0, pi] and theta3 in [0, 2 * pi]. - * rotation_x(theta) means rotation around the X axis of theta radians, - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} theta1 The angle of rotation around the Z axis in radians. - * @param {number} theta2 The angle of rotation around the X axis in radians. - * @param {number} theta3 The angle of rotation around the Z axis in radians. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.makeEulerZXZ = function(mat, theta1, theta2, theta3) { - var c1 = Math.cos(theta1); - var s1 = Math.sin(theta1); - - var c2 = Math.cos(theta2); - var s2 = Math.sin(theta2); - - var c3 = Math.cos(theta3); - var s3 = Math.sin(theta3); - - mat[0] = c1 * c3 - c2 * s1 * s3; - mat[1] = c2 * c1 * s3 + c3 * s1; - mat[2] = s3 * s2; - mat[3] = 0; - - mat[4] = -c1 * s3 - c3 * c2 * s1; - mat[5] = c1 * c2 * c3 - s1 * s3; - mat[6] = c3 * s2; - mat[7] = 0; - - mat[8] = s2 * s1; - mat[9] = -c1 * s2; - mat[10] = c2; - mat[11] = 0; - - mat[12] = 0; - mat[13] = 0; - mat[14] = 0; - mat[15] = 1; - - return mat; -}; - - -/** - * Decomposes a rotation matrix into Euler angles using the ZXZ convention so - * that rotation = rotation_z(theta1) * rotation_x(theta2) * rotation_z(theta3), - * with theta1 in [0, 2 * pi], theta2 in [0, pi] and theta3 in [0, 2 * pi]. - * rotation_x(theta) means rotation around the X axis of theta radians. - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {goog.vec.Vec3.AnyType} euler The ZXZ Euler angles in - * radians as [theta1, theta2, theta3]. - * @param {boolean=} opt_theta2IsNegative Whether theta2 is in [-pi, 0] instead - * of the default [0, pi]. - * @return {goog.vec.Vec4.AnyType} return euler so that operations can be - * chained together. - */ -goog.vec.Mat4.toEulerZXZ = function(mat, euler, opt_theta2IsNegative) { - // There is an ambiguity in the sign of sinTheta2 because of the sqrt. - var sinTheta2 = Math.sqrt(mat[2] * mat[2] + mat[6] * mat[6]); - - // By default we explicitely constrain theta2 to be in [0, pi], - // so sinTheta2 is always positive. We can change the behavior and specify - // theta2 to be negative in [-pi, 0] with opt_Theta2IsNegative. - var signTheta2 = opt_theta2IsNegative ? -1 : 1; - - if (sinTheta2 > goog.vec.EPSILON) { - euler[2] = Math.atan2(mat[2] * signTheta2, mat[6] * signTheta2); - euler[1] = Math.atan2(sinTheta2 * signTheta2, mat[10]); - euler[0] = Math.atan2(mat[8] * signTheta2, -mat[9] * signTheta2); - } else { - // There is also an arbitrary choice for theta1 = 0 or theta2 = 0 here. - // We assume theta1 = 0 as some applications do not allow the camera to roll - // (i.e. have theta1 != 0). - euler[0] = 0; - euler[1] = Math.atan2(sinTheta2 * signTheta2, mat[10]); - euler[2] = Math.atan2(mat[1], mat[0]); - } - - // Atan2 outputs angles in [-pi, pi] so we bring them back to [0, 2 * pi]. - euler[0] = (euler[0] + Math.PI * 2) % (Math.PI * 2); - euler[2] = (euler[2] + Math.PI * 2) % (Math.PI * 2); - // For theta2 we want the angle to be in [0, pi] or [-pi, 0] depending on - // signTheta2. - euler[1] = ((euler[1] * signTheta2 + Math.PI * 2) % (Math.PI * 2)) * - signTheta2; - - return euler; -}; - - -/** - * Translates the given matrix by x,y,z. Equvialent to: - * goog.vec.Mat4.multMat( - * mat, - * goog.vec.Mat4.makeTranslate(goog.vec.Mat4.create(), x, y, z), - * mat); - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} x The translation along the x axis. - * @param {number} y The translation along the y axis. - * @param {number} z The translation along the z axis. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.translate = function(mat, x, y, z) { - return goog.vec.Mat4.setColumnValues( - mat, 3, - mat[0] * x + mat[4] * y + mat[8] * z + mat[12], - mat[1] * x + mat[5] * y + mat[9] * z + mat[13], - mat[2] * x + mat[6] * y + mat[10] * z + mat[14], - mat[3] * x + mat[7] * y + mat[11] * z + mat[15]); -}; - - -/** - * Scales the given matrix by x,y,z. Equivalent to: - * goog.vec.Mat4.multMat( - * mat, - * goog.vec.Mat4.makeScale(goog.vec.Mat4.create(), x, y, z), - * mat); - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} x The x scale factor. - * @param {number} y The y scale factor. - * @param {number} z The z scale factor. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.scale = function(mat, x, y, z) { - return goog.vec.Mat4.setFromValues( - mat, - mat[0] * x, mat[1] * x, mat[2] * x, mat[3] * x, - mat[4] * y, mat[5] * y, mat[6] * y, mat[7] * y, - mat[8] * z, mat[9] * z, mat[10] * z, mat[11] * z, - mat[12], mat[13], mat[14], mat[15]); -}; - - -/** - * Rotate the given matrix by angle about the x,y,z axis. Equivalent to: - * goog.vec.Mat4.multMat( - * mat, - * goog.vec.Mat4.makeRotate(goog.vec.Mat4.create(), angle, x, y, z), - * mat); - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} angle The angle in radians. - * @param {number} x The x component of the rotation axis. - * @param {number} y The y component of the rotation axis. - * @param {number} z The z component of the rotation axis. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.rotate = function(mat, angle, x, y, z) { - var m00 = mat[0], m10 = mat[1], m20 = mat[2], m30 = mat[3]; - var m01 = mat[4], m11 = mat[5], m21 = mat[6], m31 = mat[7]; - var m02 = mat[8], m12 = mat[9], m22 = mat[10], m32 = mat[11]; - var m03 = mat[12], m13 = mat[13], m23 = mat[14], m33 = mat[15]; - - var cosAngle = Math.cos(angle); - var sinAngle = Math.sin(angle); - var diffCosAngle = 1 - cosAngle; - var r00 = x * x * diffCosAngle + cosAngle; - var r10 = x * y * diffCosAngle + z * sinAngle; - var r20 = x * z * diffCosAngle - y * sinAngle; - - var r01 = x * y * diffCosAngle - z * sinAngle; - var r11 = y * y * diffCosAngle + cosAngle; - var r21 = y * z * diffCosAngle + x * sinAngle; - - var r02 = x * z * diffCosAngle + y * sinAngle; - var r12 = y * z * diffCosAngle - x * sinAngle; - var r22 = z * z * diffCosAngle + cosAngle; - - return goog.vec.Mat4.setFromValues( - mat, - m00 * r00 + m01 * r10 + m02 * r20, - m10 * r00 + m11 * r10 + m12 * r20, - m20 * r00 + m21 * r10 + m22 * r20, - m30 * r00 + m31 * r10 + m32 * r20, - - m00 * r01 + m01 * r11 + m02 * r21, - m10 * r01 + m11 * r11 + m12 * r21, - m20 * r01 + m21 * r11 + m22 * r21, - m30 * r01 + m31 * r11 + m32 * r21, - - m00 * r02 + m01 * r12 + m02 * r22, - m10 * r02 + m11 * r12 + m12 * r22, - m20 * r02 + m21 * r12 + m22 * r22, - m30 * r02 + m31 * r12 + m32 * r22, - - m03, m13, m23, m33); -}; - - -/** - * Rotate the given matrix by angle about the x axis. Equivalent to: - * goog.vec.Mat4.multMat( - * mat, - * goog.vec.Mat4.makeRotateX(goog.vec.Mat4.create(), angle), - * mat); - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} angle The angle in radians. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.rotateX = function(mat, angle) { - var m01 = mat[4], m11 = mat[5], m21 = mat[6], m31 = mat[7]; - var m02 = mat[8], m12 = mat[9], m22 = mat[10], m32 = mat[11]; - - var c = Math.cos(angle); - var s = Math.sin(angle); - - mat[4] = m01 * c + m02 * s; - mat[5] = m11 * c + m12 * s; - mat[6] = m21 * c + m22 * s; - mat[7] = m31 * c + m32 * s; - mat[8] = m01 * -s + m02 * c; - mat[9] = m11 * -s + m12 * c; - mat[10] = m21 * -s + m22 * c; - mat[11] = m31 * -s + m32 * c; - - return mat; -}; - - -/** - * Rotate the given matrix by angle about the y axis. Equivalent to: - * goog.vec.Mat4.multMat( - * mat, - * goog.vec.Mat4.makeRotateY(goog.vec.Mat4.create(), angle), - * mat); - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} angle The angle in radians. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.rotateY = function(mat, angle) { - var m00 = mat[0], m10 = mat[1], m20 = mat[2], m30 = mat[3]; - var m02 = mat[8], m12 = mat[9], m22 = mat[10], m32 = mat[11]; - - var c = Math.cos(angle); - var s = Math.sin(angle); - - mat[0] = m00 * c + m02 * -s; - mat[1] = m10 * c + m12 * -s; - mat[2] = m20 * c + m22 * -s; - mat[3] = m30 * c + m32 * -s; - mat[8] = m00 * s + m02 * c; - mat[9] = m10 * s + m12 * c; - mat[10] = m20 * s + m22 * c; - mat[11] = m30 * s + m32 * c; - - return mat; -}; - - -/** - * Rotate the given matrix by angle about the z axis. Equivalent to: - * goog.vec.Mat4.multMat( - * mat, - * goog.vec.Mat4.makeRotateZ(goog.vec.Mat4.create(), angle), - * mat); - * - * @param {goog.vec.Mat4.AnyType} mat The matrix. - * @param {number} angle The angle in radians. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.rotateZ = function(mat, angle) { - var m00 = mat[0], m10 = mat[1], m20 = mat[2], m30 = mat[3]; - var m01 = mat[4], m11 = mat[5], m21 = mat[6], m31 = mat[7]; - - var c = Math.cos(angle); - var s = Math.sin(angle); - - mat[0] = m00 * c + m01 * s; - mat[1] = m10 * c + m11 * s; - mat[2] = m20 * c + m21 * s; - mat[3] = m30 * c + m31 * s; - mat[4] = m00 * -s + m01 * c; - mat[5] = m10 * -s + m11 * c; - mat[6] = m20 * -s + m21 * c; - mat[7] = m30 * -s + m31 * c; - - return mat; -}; - - -/** - * Retrieves the translation component of the transformation matrix. - * - * @param {goog.vec.Mat4.AnyType} mat The transformation matrix. - * @param {goog.vec.Vec3.AnyType} translation The vector for storing the - * result. - * @return {goog.vec.Mat4.AnyType} return mat so that operations can be - * chained. - */ -goog.vec.Mat4.getTranslation = function(mat, translation) { - translation[0] = mat[12]; - translation[1] = mat[13]; - translation[2] = mat[14]; - return translation; -}; - - -/** - * @type {!Array<!goog.vec.Vec3.Type>} - * @private - */ -goog.vec.Mat4.tmpVec3_ = [ - goog.vec.Vec3.createFloat64(), - goog.vec.Vec3.createFloat64() -]; - - -/** - * @type {!Array<!goog.vec.Vec4.Type>} - * @private - */ -goog.vec.Mat4.tmpVec4_ = [ - goog.vec.Vec4.createFloat64(), - goog.vec.Vec4.createFloat64(), - goog.vec.Vec4.createFloat64() -]; - - -/** - * @type {!Array<!goog.vec.Mat4.Type>} - * @private - */ -goog.vec.Mat4.tmpMat4_ = [ - goog.vec.Mat4.createFloat64() -]; - -goog.provide('ol.TransformFunction'); - - -/** - * A transform function accepts an array of input coordinate values, an optional - * output array, and an optional dimension (default should be 2). The function - * transforms the input coordinate values, populates the output array, and - * returns the output array. - * - * @typedef {function(Array.<number>, Array.<number>=, number=): Array.<number>} - * @api stable - */ -ol.TransformFunction; - -goog.provide('ol.Extent'); -goog.provide('ol.extent'); -goog.provide('ol.extent.Corner'); -goog.provide('ol.extent.Relationship'); - -goog.require('goog.asserts'); -goog.require('goog.vec.Mat4'); -goog.require('ol.Coordinate'); -goog.require('ol.Size'); -goog.require('ol.TransformFunction'); - - -/** - * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. - * @typedef {Array.<number>} - * @api stable - */ -ol.Extent; - - -/** - * Extent corner. - * @enum {string} - */ -ol.extent.Corner = { - BOTTOM_LEFT: 'bottom-left', - BOTTOM_RIGHT: 'bottom-right', - TOP_LEFT: 'top-left', - TOP_RIGHT: 'top-right' -}; - - -/** - * Relationship to an extent. - * @enum {number} - */ -ol.extent.Relationship = { - UNKNOWN: 0, - INTERSECTING: 1, - ABOVE: 2, - RIGHT: 4, - BELOW: 8, - LEFT: 16 -}; - - -/** - * Build an extent that includes all given coordinates. - * - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @return {ol.Extent} Bounding extent. - * @api stable - */ -ol.extent.boundingExtent = function(coordinates) { - var extent = ol.extent.createEmpty(); - for (var i = 0, ii = coordinates.length; i < ii; ++i) { - ol.extent.extendCoordinate(extent, coordinates[i]); - } - return extent; -}; - - -/** - * @param {Array.<number>} xs Xs. - * @param {Array.<number>} ys Ys. - * @param {ol.Extent=} opt_extent Destination extent. - * @private - * @return {ol.Extent} Extent. - */ -ol.extent.boundingExtentXYs_ = function(xs, ys, opt_extent) { - goog.asserts.assert(xs.length > 0, 'xs length should be larger than 0'); - goog.asserts.assert(ys.length > 0, 'ys length should be larger than 0'); - var minX = Math.min.apply(null, xs); - var minY = Math.min.apply(null, ys); - var maxX = Math.max.apply(null, xs); - var maxY = Math.max.apply(null, ys); - return ol.extent.createOrUpdate(minX, minY, maxX, maxY, opt_extent); -}; - - -/** - * Return extent increased by the provided value. - * @param {ol.Extent} extent Extent. - * @param {number} value The amount by which the extent should be buffered. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. - * @api stable - */ -ol.extent.buffer = function(extent, value, opt_extent) { - if (opt_extent) { - opt_extent[0] = extent[0] - value; - opt_extent[1] = extent[1] - value; - opt_extent[2] = extent[2] + value; - opt_extent[3] = extent[3] + value; - return opt_extent; - } else { - return [ - extent[0] - value, - extent[1] - value, - extent[2] + value, - extent[3] + value - ]; - } -}; - - -/** - * Creates a clone of an extent. - * - * @param {ol.Extent} extent Extent to clone. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} The clone. - */ -ol.extent.clone = function(extent, opt_extent) { - if (opt_extent) { - opt_extent[0] = extent[0]; - opt_extent[1] = extent[1]; - opt_extent[2] = extent[2]; - opt_extent[3] = extent[3]; - return opt_extent; - } else { - return extent.slice(); - } -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} x X. - * @param {number} y Y. - * @return {number} Closest squared distance. - */ -ol.extent.closestSquaredDistanceXY = function(extent, x, y) { - var dx, dy; - if (x < extent[0]) { - dx = extent[0] - x; - } else if (extent[2] < x) { - dx = x - extent[2]; - } else { - dx = 0; - } - if (y < extent[1]) { - dy = extent[1] - y; - } else if (extent[3] < y) { - dy = y - extent[3]; - } else { - dy = 0; - } - return dx * dx + dy * dy; -}; - - -/** - * Check if the passed coordinate is contained or on the edge of the extent. - * - * @param {ol.Extent} extent Extent. - * @param {ol.Coordinate} coordinate Coordinate. - * @return {boolean} The coordinate is contained in the extent. - * @api stable - */ -ol.extent.containsCoordinate = function(extent, coordinate) { - return ol.extent.containsXY(extent, coordinate[0], coordinate[1]); -}; - - -/** - * Check if one extent contains another. - * - * An extent is deemed contained if it lies completely within the other extent, - * including if they share one or more edges. - * - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. - * @return {boolean} The second extent is contained by or on the edge of the - * first. - * @api stable - */ -ol.extent.containsExtent = function(extent1, extent2) { - return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] && - extent1[1] <= extent2[1] && extent2[3] <= extent1[3]; -}; - - -/** - * Check if the passed coordinate is contained or on the edge of the extent. - * - * @param {ol.Extent} extent Extent. - * @param {number} x X coordinate. - * @param {number} y Y coordinate. - * @return {boolean} The x, y values are contained in the extent. - * @api stable - */ -ol.extent.containsXY = function(extent, x, y) { - return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3]; -}; - - -/** - * Get the relationship between a coordinate and extent. - * @param {ol.Extent} extent The extent. - * @param {ol.Coordinate} coordinate The coordinate. - * @return {number} The relationship (bitwise compare with - * ol.extent.Relationship). - */ -ol.extent.coordinateRelationship = function(extent, coordinate) { - var minX = extent[0]; - var minY = extent[1]; - var maxX = extent[2]; - var maxY = extent[3]; - var x = coordinate[0]; - var y = coordinate[1]; - var relationship = ol.extent.Relationship.UNKNOWN; - if (x < minX) { - relationship = relationship | ol.extent.Relationship.LEFT; - } else if (x > maxX) { - relationship = relationship | ol.extent.Relationship.RIGHT; - } - if (y < minY) { - relationship = relationship | ol.extent.Relationship.BELOW; - } else if (y > maxY) { - relationship = relationship | ol.extent.Relationship.ABOVE; - } - if (relationship === ol.extent.Relationship.UNKNOWN) { - relationship = ol.extent.Relationship.INTERSECTING; - } - return relationship; -}; - - -/** - * Create an empty extent. - * @return {ol.Extent} Empty extent. - * @api stable - */ -ol.extent.createEmpty = function() { - return [Infinity, Infinity, -Infinity, -Infinity]; -}; - - -/** - * Create a new extent or update the provided extent. - * @param {number} minX Minimum X. - * @param {number} minY Minimum Y. - * @param {number} maxX Maximum X. - * @param {number} maxY Maximum Y. - * @param {ol.Extent=} opt_extent Destination extent. - * @return {ol.Extent} Extent. - */ -ol.extent.createOrUpdate = function(minX, minY, maxX, maxY, opt_extent) { - if (opt_extent) { - opt_extent[0] = minX; - opt_extent[1] = minY; - opt_extent[2] = maxX; - opt_extent[3] = maxY; - return opt_extent; - } else { - return [minX, minY, maxX, maxY]; - } -}; - - -/** - * Create a new empty extent or make the provided one empty. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. - */ -ol.extent.createOrUpdateEmpty = function(opt_extent) { - return ol.extent.createOrUpdate( - Infinity, Infinity, -Infinity, -Infinity, opt_extent); -}; - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. - */ -ol.extent.createOrUpdateFromCoordinate = function(coordinate, opt_extent) { - var x = coordinate[0]; - var y = coordinate[1]; - return ol.extent.createOrUpdate(x, y, x, y, opt_extent); -}; - - -/** - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. - */ -ol.extent.createOrUpdateFromCoordinates = function(coordinates, opt_extent) { - var extent = ol.extent.createOrUpdateEmpty(opt_extent); - return ol.extent.extendCoordinates(extent, coordinates); -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. - */ -ol.extent.createOrUpdateFromFlatCoordinates = - function(flatCoordinates, offset, end, stride, opt_extent) { - var extent = ol.extent.createOrUpdateEmpty(opt_extent); - return ol.extent.extendFlatCoordinates( - extent, flatCoordinates, offset, end, stride); -}; - - -/** - * @param {Array.<Array.<ol.Coordinate>>} rings Rings. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. - */ -ol.extent.createOrUpdateFromRings = function(rings, opt_extent) { - var extent = ol.extent.createOrUpdateEmpty(opt_extent); - return ol.extent.extendRings(extent, rings); -}; - - -/** - * Empty an extent in place. - * @param {ol.Extent} extent Extent. - * @return {ol.Extent} Extent. - */ -ol.extent.empty = function(extent) { - extent[0] = extent[1] = Infinity; - extent[2] = extent[3] = -Infinity; - return extent; -}; - - -/** - * Determine if two extents are equivalent. - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. - * @return {boolean} The two extents are equivalent. - * @api stable - */ -ol.extent.equals = function(extent1, extent2) { - return extent1[0] == extent2[0] && extent1[2] == extent2[2] && - extent1[1] == extent2[1] && extent1[3] == extent2[3]; -}; - - -/** - * Modify an extent to include another extent. - * @param {ol.Extent} extent1 The extent to be modified. - * @param {ol.Extent} extent2 The extent that will be included in the first. - * @return {ol.Extent} A reference to the first (extended) extent. - * @api stable - */ -ol.extent.extend = function(extent1, extent2) { - if (extent2[0] < extent1[0]) { - extent1[0] = extent2[0]; - } - if (extent2[2] > extent1[2]) { - extent1[2] = extent2[2]; - } - if (extent2[1] < extent1[1]) { - extent1[1] = extent2[1]; - } - if (extent2[3] > extent1[3]) { - extent1[3] = extent2[3]; - } - return extent1; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {ol.Coordinate} coordinate Coordinate. - */ -ol.extent.extendCoordinate = function(extent, coordinate) { - if (coordinate[0] < extent[0]) { - extent[0] = coordinate[0]; - } - if (coordinate[0] > extent[2]) { - extent[2] = coordinate[0]; - } - if (coordinate[1] < extent[1]) { - extent[1] = coordinate[1]; - } - if (coordinate[1] > extent[3]) { - extent[3] = coordinate[1]; - } -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @return {ol.Extent} Extent. - */ -ol.extent.extendCoordinates = function(extent, coordinates) { - var i, ii; - for (i = 0, ii = coordinates.length; i < ii; ++i) { - ol.extent.extendCoordinate(extent, coordinates[i]); - } - return extent; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @return {ol.Extent} Extent. - */ -ol.extent.extendFlatCoordinates = - function(extent, flatCoordinates, offset, end, stride) { - for (; offset < end; offset += stride) { - ol.extent.extendXY( - extent, flatCoordinates[offset], flatCoordinates[offset + 1]); - } - return extent; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {Array.<Array.<ol.Coordinate>>} rings Rings. - * @return {ol.Extent} Extent. - */ -ol.extent.extendRings = function(extent, rings) { - var i, ii; - for (i = 0, ii = rings.length; i < ii; ++i) { - ol.extent.extendCoordinates(extent, rings[i]); - } - return extent; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} x X. - * @param {number} y Y. - */ -ol.extent.extendXY = function(extent, x, y) { - extent[0] = Math.min(extent[0], x); - extent[1] = Math.min(extent[1], y); - extent[2] = Math.max(extent[2], x); - extent[3] = Math.max(extent[3], y); -}; - - -/** - * This function calls `callback` for each corner of the extent. If the - * callback returns a truthy value the function returns that value - * immediately. Otherwise the function returns `false`. - * @param {ol.Extent} extent Extent. - * @param {function(this:T, ol.Coordinate): S} callback Callback. - * @param {T=} opt_this Value to use as `this` when executing `callback`. - * @return {S|boolean} Value. - * @template S, T - */ -ol.extent.forEachCorner = function(extent, callback, opt_this) { - var val; - val = callback.call(opt_this, ol.extent.getBottomLeft(extent)); - if (val) { - return val; - } - val = callback.call(opt_this, ol.extent.getBottomRight(extent)); - if (val) { - return val; - } - val = callback.call(opt_this, ol.extent.getTopRight(extent)); - if (val) { - return val; - } - val = callback.call(opt_this, ol.extent.getTopLeft(extent)); - if (val) { - return val; - } - return false; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @return {number} Area. - */ -ol.extent.getArea = function(extent) { - var area = 0; - if (!ol.extent.isEmpty(extent)) { - area = ol.extent.getWidth(extent) * ol.extent.getHeight(extent); - } - return area; -}; - - -/** - * Get the bottom left coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Bottom left coordinate. - * @api stable - */ -ol.extent.getBottomLeft = function(extent) { - return [extent[0], extent[1]]; -}; - - -/** - * Get the bottom right coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Bottom right coordinate. - * @api stable - */ -ol.extent.getBottomRight = function(extent) { - return [extent[2], extent[1]]; -}; - - -/** - * Get the center coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Center. - * @api stable - */ -ol.extent.getCenter = function(extent) { - return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2]; -}; - - -/** - * Get a corner coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @param {ol.extent.Corner} corner Corner. - * @return {ol.Coordinate} Corner coordinate. - */ -ol.extent.getCorner = function(extent, corner) { - var coordinate; - if (corner === ol.extent.Corner.BOTTOM_LEFT) { - coordinate = ol.extent.getBottomLeft(extent); - } else if (corner === ol.extent.Corner.BOTTOM_RIGHT) { - coordinate = ol.extent.getBottomRight(extent); - } else if (corner === ol.extent.Corner.TOP_LEFT) { - coordinate = ol.extent.getTopLeft(extent); - } else if (corner === ol.extent.Corner.TOP_RIGHT) { - coordinate = ol.extent.getTopRight(extent); - } else { - goog.asserts.fail('Invalid corner: %s', corner); - } - goog.asserts.assert(coordinate, 'coordinate should be defined'); - return coordinate; -}; - - -/** - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. - * @return {number} Enlarged area. - */ -ol.extent.getEnlargedArea = function(extent1, extent2) { - var minX = Math.min(extent1[0], extent2[0]); - var minY = Math.min(extent1[1], extent2[1]); - var maxX = Math.max(extent1[2], extent2[2]); - var maxY = Math.max(extent1[3], extent2[3]); - return (maxX - minX) * (maxY - minY); -}; - - -/** - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {ol.Extent=} opt_extent Destination extent. - * @return {ol.Extent} Extent. - */ -ol.extent.getForViewAndSize = - function(center, resolution, rotation, size, opt_extent) { - var dx = resolution * size[0] / 2; - var dy = resolution * size[1] / 2; - var cosRotation = Math.cos(rotation); - var sinRotation = Math.sin(rotation); - /** @type {Array.<number>} */ - var xs = [-dx, -dx, dx, dx]; - /** @type {Array.<number>} */ - var ys = [-dy, dy, -dy, dy]; - var i, x, y; - for (i = 0; i < 4; ++i) { - x = xs[i]; - y = ys[i]; - xs[i] = center[0] + x * cosRotation - y * sinRotation; - ys[i] = center[1] + x * sinRotation + y * cosRotation; - } - return ol.extent.boundingExtentXYs_(xs, ys, opt_extent); -}; - - -/** - * Get the height of an extent. - * @param {ol.Extent} extent Extent. - * @return {number} Height. - * @api stable - */ -ol.extent.getHeight = function(extent) { - return extent[3] - extent[1]; -}; - - -/** - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. - * @return {number} Intersection area. - */ -ol.extent.getIntersectionArea = function(extent1, extent2) { - var intersection = ol.extent.getIntersection(extent1, extent2); - return ol.extent.getArea(intersection); -}; - - -/** - * Get the intersection of two extents. - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. - * @param {ol.Extent=} opt_extent Optional extent to populate with intersection. - * @return {ol.Extent} Intersecting extent. - * @api stable - */ -ol.extent.getIntersection = function(extent1, extent2, opt_extent) { - var intersection = opt_extent ? opt_extent : ol.extent.createEmpty(); - if (ol.extent.intersects(extent1, extent2)) { - if (extent1[0] > extent2[0]) { - intersection[0] = extent1[0]; - } else { - intersection[0] = extent2[0]; - } - if (extent1[1] > extent2[1]) { - intersection[1] = extent1[1]; - } else { - intersection[1] = extent2[1]; - } - if (extent1[2] < extent2[2]) { - intersection[2] = extent1[2]; - } else { - intersection[2] = extent2[2]; - } - if (extent1[3] < extent2[3]) { - intersection[3] = extent1[3]; - } else { - intersection[3] = extent2[3]; - } - } - return intersection; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @return {number} Margin. - */ -ol.extent.getMargin = function(extent) { - return ol.extent.getWidth(extent) + ol.extent.getHeight(extent); -}; - - -/** - * Get the size (width, height) of an extent. - * @param {ol.Extent} extent The extent. - * @return {ol.Size} The extent size. - * @api stable - */ -ol.extent.getSize = function(extent) { - return [extent[2] - extent[0], extent[3] - extent[1]]; -}; - - -/** - * Get the top left coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Top left coordinate. - * @api stable - */ -ol.extent.getTopLeft = function(extent) { - return [extent[0], extent[3]]; -}; - - -/** - * Get the top right coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Top right coordinate. - * @api stable - */ -ol.extent.getTopRight = function(extent) { - return [extent[2], extent[3]]; -}; - - -/** - * Get the width of an extent. - * @param {ol.Extent} extent Extent. - * @return {number} Width. - * @api stable - */ -ol.extent.getWidth = function(extent) { - return extent[2] - extent[0]; -}; - - -/** - * Determine if one extent intersects another. - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent. - * @return {boolean} The two extents intersect. - * @api stable - */ -ol.extent.intersects = function(extent1, extent2) { - return extent1[0] <= extent2[2] && - extent1[2] >= extent2[0] && - extent1[1] <= extent2[3] && - extent1[3] >= extent2[1]; -}; - - -/** - * Determine if an extent is empty. - * @param {ol.Extent} extent Extent. - * @return {boolean} Is empty. - * @api stable - */ -ol.extent.isEmpty = function(extent) { - return extent[2] < extent[0] || extent[3] < extent[1]; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @return {boolean} Is infinite. - */ -ol.extent.isInfinite = function(extent) { - return extent[0] == -Infinity || extent[1] == -Infinity || - extent[2] == Infinity || extent[3] == Infinity; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {ol.Coordinate} coordinate Coordinate. - * @return {ol.Coordinate} Coordinate. - */ -ol.extent.normalize = function(extent, coordinate) { - return [ - (coordinate[0] - extent[0]) / (extent[2] - extent[0]), - (coordinate[1] - extent[1]) / (extent[3] - extent[1]) - ]; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. - */ -ol.extent.returnOrUpdate = function(extent, opt_extent) { - if (opt_extent) { - opt_extent[0] = extent[0]; - opt_extent[1] = extent[1]; - opt_extent[2] = extent[2]; - opt_extent[3] = extent[3]; - return opt_extent; - } else { - return extent; - } -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} value Value. - */ -ol.extent.scaleFromCenter = function(extent, value) { - var deltaX = ((extent[2] - extent[0]) / 2) * (value - 1); - var deltaY = ((extent[3] - extent[1]) / 2) * (value - 1); - extent[0] -= deltaX; - extent[2] += deltaX; - extent[1] -= deltaY; - extent[3] += deltaY; -}; - - -/** - * Determine if the segment between two coordinates intersects (crosses, - * touches, or is contained by) the provided extent. - * @param {ol.Extent} extent The extent. - * @param {ol.Coordinate} start Segment start coordinate. - * @param {ol.Coordinate} end Segment end coordinate. - * @return {boolean} The segment intersects the extent. - */ -ol.extent.intersectsSegment = function(extent, start, end) { - var intersects = false; - var startRel = ol.extent.coordinateRelationship(extent, start); - var endRel = ol.extent.coordinateRelationship(extent, end); - if (startRel === ol.extent.Relationship.INTERSECTING || - endRel === ol.extent.Relationship.INTERSECTING) { - intersects = true; - } else { - var minX = extent[0]; - var minY = extent[1]; - var maxX = extent[2]; - var maxY = extent[3]; - var startX = start[0]; - var startY = start[1]; - var endX = end[0]; - var endY = end[1]; - var slope = (endY - startY) / (endX - startX); - var x, y; - if (!!(endRel & ol.extent.Relationship.ABOVE) && - !(startRel & ol.extent.Relationship.ABOVE)) { - // potentially intersects top - x = endX - ((endY - maxY) / slope); - intersects = x >= minX && x <= maxX; - } - if (!intersects && !!(endRel & ol.extent.Relationship.RIGHT) && - !(startRel & ol.extent.Relationship.RIGHT)) { - // potentially intersects right - y = endY - ((endX - maxX) * slope); - intersects = y >= minY && y <= maxY; - } - if (!intersects && !!(endRel & ol.extent.Relationship.BELOW) && - !(startRel & ol.extent.Relationship.BELOW)) { - // potentially intersects bottom - x = endX - ((endY - minY) / slope); - intersects = x >= minX && x <= maxX; - } - if (!intersects && !!(endRel & ol.extent.Relationship.LEFT) && - !(startRel & ol.extent.Relationship.LEFT)) { - // potentially intersects left - y = endY - ((endX - minX) * slope); - intersects = y >= minY && y <= maxY; - } - - } - return intersects; -}; - - -/** - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. - * @return {boolean} Touches. - */ -ol.extent.touches = function(extent1, extent2) { - var intersects = ol.extent.intersects(extent1, extent2); - return intersects && - (extent1[0] == extent2[2] || extent1[2] == extent2[0] || - extent1[1] == extent2[3] || extent1[3] == extent2[1]); -}; - - -/** - * Apply a transform function to the extent. - * @param {ol.Extent} extent Extent. - * @param {ol.TransformFunction} transformFn Transform function. Called with - * [minX, minY, maxX, maxY] extent coordinates. - * @param {ol.Extent=} opt_extent Destination extent. - * @return {ol.Extent} Extent. - * @api stable - */ -ol.extent.applyTransform = function(extent, transformFn, opt_extent) { - var coordinates = [ - extent[0], extent[1], - extent[0], extent[3], - extent[2], extent[1], - extent[2], extent[3] - ]; - transformFn(coordinates, coordinates, 2); - var xs = [coordinates[0], coordinates[2], coordinates[4], coordinates[6]]; - var ys = [coordinates[1], coordinates[3], coordinates[5], coordinates[7]]; - return ol.extent.boundingExtentXYs_(xs, ys, opt_extent); -}; - - -/** - * Apply a 2d transform to an extent. - * @param {ol.Extent} extent Input extent. - * @param {goog.vec.Mat4.Number} transform The transform matrix. - * @param {ol.Extent=} opt_extent Optional extent for return values. - * @return {ol.Extent} The transformed extent. - */ -ol.extent.transform2D = function(extent, transform, opt_extent) { - var dest = opt_extent ? opt_extent : []; - var m00 = goog.vec.Mat4.getElement(transform, 0, 0); - var m10 = goog.vec.Mat4.getElement(transform, 1, 0); - var m01 = goog.vec.Mat4.getElement(transform, 0, 1); - var m11 = goog.vec.Mat4.getElement(transform, 1, 1); - var m03 = goog.vec.Mat4.getElement(transform, 0, 3); - var m13 = goog.vec.Mat4.getElement(transform, 1, 3); - var xi = [0, 2, 0, 2]; - var yi = [1, 1, 3, 3]; - var xs = []; - var ys = []; - var i, x, y; - for (i = 0; i < 4; ++i) { - x = extent[xi[i]]; - y = extent[yi[i]]; - xs[i] = m00 * x + m01 * y + m03; - ys[i] = m10 * x + m11 * y + m13; - } - dest[0] = Math.min.apply(null, xs); - dest[1] = Math.min.apply(null, ys); - dest[2] = Math.max.apply(null, xs); - dest[3] = Math.max.apply(null, ys); - return dest; -}; - -// Copyright 2008 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for creating functions. Loosely inspired by the - * java classes: http://goo.gl/GM0Hmu and http://goo.gl/6k7nI8. - * - * @author nicksantos@google.com (Nick Santos) - */ - - -goog.provide('goog.functions'); - - -/** - * Creates a function that always returns the same value. - * @param {T} retValue The value to return. - * @return {function():T} The new function. - * @template T - */ -goog.functions.constant = function(retValue) { - return function() { - return retValue; - }; -}; - - -/** - * Always returns false. - * @type {function(...): boolean} - */ -goog.functions.FALSE = goog.functions.constant(false); - - -/** - * Always returns true. - * @type {function(...): boolean} - */ -goog.functions.TRUE = goog.functions.constant(true); - - -/** - * Always returns NULL. - * @type {function(...): null} - */ -goog.functions.NULL = goog.functions.constant(null); - - -/** - * A simple function that returns the first argument of whatever is passed - * into it. - * @param {T=} opt_returnValue The single value that will be returned. - * @param {...*} var_args Optional trailing arguments. These are ignored. - * @return {T} The first argument passed in, or undefined if nothing was passed. - * @template T - */ -goog.functions.identity = function(opt_returnValue, var_args) { - return opt_returnValue; -}; - - -/** - * Creates a function that always throws an error with the given message. - * @param {string} message The error message. - * @return {!Function} The error-throwing function. - */ -goog.functions.error = function(message) { - return function() { - throw Error(message); - }; -}; - - -/** - * Creates a function that throws the given object. - * @param {*} err An object to be thrown. - * @return {!Function} The error-throwing function. - */ -goog.functions.fail = function(err) { - return function() { - throw err; - } -}; - - -/** - * Given a function, create a function that keeps opt_numArgs arguments and - * silently discards all additional arguments. - * @param {Function} f The original function. - * @param {number=} opt_numArgs The number of arguments to keep. Defaults to 0. - * @return {!Function} A version of f that only keeps the first opt_numArgs - * arguments. - */ -goog.functions.lock = function(f, opt_numArgs) { - opt_numArgs = opt_numArgs || 0; - return function() { - return f.apply(this, Array.prototype.slice.call(arguments, 0, opt_numArgs)); - }; -}; - - -/** - * Creates a function that returns its nth argument. - * @param {number} n The position of the return argument. - * @return {!Function} A new function. - */ -goog.functions.nth = function(n) { - return function() { - return arguments[n]; - }; -}; - - -/** - * Given a function, create a new function that swallows its return value - * and replaces it with a new one. - * @param {Function} f A function. - * @param {T} retValue A new return value. - * @return {function(...?):T} A new function. - * @template T - */ -goog.functions.withReturnValue = function(f, retValue) { - return goog.functions.sequence(f, goog.functions.constant(retValue)); -}; - - -/** - * Creates a function that returns whether its arguement equals the given value. - * - * Example: - * var key = goog.object.findKey(obj, goog.functions.equalTo('needle')); - * - * @param {*} value The value to compare to. - * @param {boolean=} opt_useLooseComparison Whether to use a loose (==) - * comparison rather than a strict (===) one. Defaults to false. - * @return {function(*):boolean} The new function. - */ -goog.functions.equalTo = function(value, opt_useLooseComparison) { - return function(other) { - return opt_useLooseComparison ? (value == other) : (value === other); - }; -}; - - -/** - * Creates the composition of the functions passed in. - * For example, (goog.functions.compose(f, g))(a) is equivalent to f(g(a)). - * @param {function(...?):T} fn The final function. - * @param {...Function} var_args A list of functions. - * @return {function(...?):T} The composition of all inputs. - * @template T - */ -goog.functions.compose = function(fn, var_args) { - var functions = arguments; - var length = functions.length; - return function() { - var result; - if (length) { - result = functions[length - 1].apply(this, arguments); - } - - for (var i = length - 2; i >= 0; i--) { - result = functions[i].call(this, result); - } - return result; - }; -}; - - -/** - * Creates a function that calls the functions passed in in sequence, and - * returns the value of the last function. For example, - * (goog.functions.sequence(f, g))(x) is equivalent to f(x),g(x). - * @param {...Function} var_args A list of functions. - * @return {!Function} A function that calls all inputs in sequence. - */ -goog.functions.sequence = function(var_args) { - var functions = arguments; - var length = functions.length; - return function() { - var result; - for (var i = 0; i < length; i++) { - result = functions[i].apply(this, arguments); - } - return result; - }; -}; - - -/** - * Creates a function that returns true if each of its components evaluates - * to true. The components are evaluated in order, and the evaluation will be - * short-circuited as soon as a function returns false. - * For example, (goog.functions.and(f, g))(x) is equivalent to f(x) && g(x). - * @param {...Function} var_args A list of functions. - * @return {function(...?):boolean} A function that ANDs its component - * functions. - */ -goog.functions.and = function(var_args) { - var functions = arguments; - var length = functions.length; - return function() { - for (var i = 0; i < length; i++) { - if (!functions[i].apply(this, arguments)) { - return false; - } - } - return true; - }; -}; - - -/** - * Creates a function that returns true if any of its components evaluates - * to true. The components are evaluated in order, and the evaluation will be - * short-circuited as soon as a function returns true. - * For example, (goog.functions.or(f, g))(x) is equivalent to f(x) || g(x). - * @param {...Function} var_args A list of functions. - * @return {function(...?):boolean} A function that ORs its component - * functions. - */ -goog.functions.or = function(var_args) { - var functions = arguments; - var length = functions.length; - return function() { - for (var i = 0; i < length; i++) { - if (functions[i].apply(this, arguments)) { - return true; - } - } - return false; - }; -}; - - -/** - * Creates a function that returns the Boolean opposite of a provided function. - * For example, (goog.functions.not(f))(x) is equivalent to !f(x). - * @param {!Function} f The original function. - * @return {function(...?):boolean} A function that delegates to f and returns - * opposite. - */ -goog.functions.not = function(f) { - return function() { - return !f.apply(this, arguments); - }; -}; - - -/** - * Generic factory function to construct an object given the constructor - * and the arguments. Intended to be bound to create object factories. - * - * Example: - * - * var factory = goog.partial(goog.functions.create, Class); - * - * @param {function(new:T, ...)} constructor The constructor for the Object. - * @param {...*} var_args The arguments to be passed to the constructor. - * @return {T} A new instance of the class given in {@code constructor}. - * @template T - */ -goog.functions.create = function(constructor, var_args) { - /** - * @constructor - * @final - */ - var temp = function() {}; - temp.prototype = constructor.prototype; - - // obj will have constructor's prototype in its chain and - // 'obj instanceof constructor' will be true. - var obj = new temp(); - - // obj is initialized by constructor. - // arguments is only array-like so lacks shift(), but can be used with - // the Array prototype function. - constructor.apply(obj, Array.prototype.slice.call(arguments, 1)); - return obj; -}; - - -/** - * @define {boolean} Whether the return value cache should be used. - * This should only be used to disable caches when testing. - */ -goog.define('goog.functions.CACHE_RETURN_VALUE', true); - - -/** - * Gives a wrapper function that caches the return value of a parameterless - * function when first called. - * - * When called for the first time, the given function is called and its - * return value is cached (thus this is only appropriate for idempotent - * functions). Subsequent calls will return the cached return value. This - * allows the evaluation of expensive functions to be delayed until first used. - * - * To cache the return values of functions with parameters, see goog.memoize. - * - * @param {!function():T} fn A function to lazily evaluate. - * @return {!function():T} A wrapped version the function. - * @template T - */ -goog.functions.cacheReturnValue = function(fn) { - var called = false; - var value; - - return function() { - if (!goog.functions.CACHE_RETURN_VALUE) { - return fn(); - } - - if (!called) { - value = fn(); - called = true; - } - - return value; - } -}; - - -/** - * Wraps a function to allow it to be called, at most, once. All - * additional calls are no-ops. - * - * This is particularly useful for initialization functions - * that should be called, at most, once. - * - * @param {function():*} f Function to call. - * @return {function():undefined} Wrapped function. - */ -goog.functions.once = function(f) { - // Keep a reference to the function that we null out when we're done with - // it -- that way, the function can be GC'd when we're done with it. - var inner = f; - return function() { - if (inner) { - var tmp = inner; - inner = null; - tmp(); - } - }; -}; - - -/** - * Wraps a function to allow it to be called, at most, once for each sequence of - * calls fired repeatedly so long as they are fired less than a specified - * interval apart (in milliseconds). Whether it receives one signal or multiple, - * it will always wait until a full interval has elapsed since the last signal - * before performing the action. - * - * This is particularly useful for bulking up repeated user actions (e.g. only - * refreshing a view once a user finishes typing rather than updating with every - * keystroke). For more stateful debouncing with support for pausing, resuming, - * and canceling debounced actions, use {@code goog.async.Debouncer}. - * - * @param {function(this:SCOPE):*} f Function to call. - * @param {number} interval Interval over which to debounce. The function will - * only be called after the full interval has elapsed since the last call. - * @param {SCOPE=} opt_scope Object in whose scope to call the function. - * @return {function():undefined} Wrapped function. - * @template SCOPE - */ -goog.functions.debounce = function(f, interval, opt_scope) { - if (opt_scope) { - f = goog.bind(f, opt_scope); - } - var timeout = null; - return function() { - goog.global.clearTimeout(timeout); - timeout = goog.global.setTimeout(f, interval); - }; -}; - - -/** - * Wraps a function to allow it to be called, at most, once per interval - * (specified in milliseconds). If it is called multiple times while it is - * waiting, it will only perform the action once at the end of the interval. - * - * This is particularly useful for limiting repeated user requests (e.g. - * preventing a user from spamming a server with frequent view refreshes). For - * more stateful throttling with support for pausing, resuming, and canceling - * throttled actions, use {@code goog.async.Throttle}. - * - * @param {function(this:SCOPE):*} f Function to call. - * @param {number} interval Interval over which to throttle. The function can - * only be called once per interval. - * @param {SCOPE=} opt_scope Object in whose scope to call the function. - * @return {function():undefined} Wrapped function. - * @template SCOPE - */ -goog.functions.throttle = function(f, interval, opt_scope) { - if (opt_scope) { - f = goog.bind(f, opt_scope); - } - var timeout = null; - var shouldFire = false; - var fire = function() { - timeout = goog.global.setTimeout(handleTimeout, interval); - f(); - }; - var handleTimeout = function() { - timeout = null; - if (shouldFire) { - shouldFire = false; - fire(); - } - }; - - return function() { - if (!timeout) { - fire(); - } else { - shouldFire = true; - } - }; -}; - -/** - * @license - * Latitude/longitude spherical geodesy formulae taken from - * http://www.movable-type.co.uk/scripts/latlong.html - * Licensed under CC-BY-3.0. - */ - -goog.provide('ol.Sphere'); - -goog.require('ol.math'); - - - -/** - * @classdesc - * Class to create objects that can be used with {@link - * ol.geom.Polygon.circular}. - * - * For example to create a sphere whose radius is equal to the semi-major - * axis of the WGS84 ellipsoid: - * - * ```js - * var wgs84Sphere= new ol.Sphere(6378137); - * ``` - * - * @constructor - * @param {number} radius Radius. - * @api - */ -ol.Sphere = function(radius) { - - /** - * @type {number} - */ - this.radius = radius; - -}; - - -/** - * Returns the geodesic area for a list of coordinates. - * - * [Reference](http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409) - * Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for - * Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion - * Laboratory, Pasadena, CA, June 2007 - * - * @param {Array.<ol.Coordinate>} coordinates List of coordinates of a linear - * ring. If the ring is oriented clockwise, the area will be positive, - * otherwise it will be negative. - * @return {number} Area. - * @api - */ -ol.Sphere.prototype.geodesicArea = function(coordinates) { - var area = 0, len = coordinates.length; - var x1 = coordinates[len - 1][0]; - var y1 = coordinates[len - 1][1]; - for (var i = 0; i < len; i++) { - var x2 = coordinates[i][0], y2 = coordinates[i][1]; - area += ol.math.toRadians(x2 - x1) * - (2 + Math.sin(ol.math.toRadians(y1)) + - Math.sin(ol.math.toRadians(y2))); - x1 = x2; - y1 = y2; - } - return area * this.radius * this.radius / 2.0; -}; - - -/** - * Returns the distance from c1 to c2 using the haversine formula. - * - * @param {ol.Coordinate} c1 Coordinate 1. - * @param {ol.Coordinate} c2 Coordinate 2. - * @return {number} Haversine distance. - * @api - */ -ol.Sphere.prototype.haversineDistance = function(c1, c2) { - var lat1 = ol.math.toRadians(c1[1]); - var lat2 = ol.math.toRadians(c2[1]); - var deltaLatBy2 = (lat2 - lat1) / 2; - var deltaLonBy2 = ol.math.toRadians(c2[0] - c1[0]) / 2; - var a = Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) + - Math.sin(deltaLonBy2) * Math.sin(deltaLonBy2) * - Math.cos(lat1) * Math.cos(lat2); - return 2 * this.radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); -}; - - -/** - * Returns the coordinate at the given distance and bearing from `c1`. - * - * @param {ol.Coordinate} c1 The origin point (`[lon, lat]` in degrees). - * @param {number} distance The great-circle distance between the origin - * point and the target point. - * @param {number} bearing The bearing (in radians). - * @return {ol.Coordinate} The target point. - */ -ol.Sphere.prototype.offset = function(c1, distance, bearing) { - var lat1 = ol.math.toRadians(c1[1]); - var lon1 = ol.math.toRadians(c1[0]); - var dByR = distance / this.radius; - var lat = Math.asin( - Math.sin(lat1) * Math.cos(dByR) + - Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)); - var lon = lon1 + Math.atan2( - Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1), - Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)); - return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)]; -}; - -goog.provide('ol.sphere.NORMAL'); - -goog.require('ol.Sphere'); - - -/** - * The normal sphere. - * @const - * @type {ol.Sphere} - */ -ol.sphere.NORMAL = new ol.Sphere(6370997); - -goog.provide('ol.proj'); -goog.provide('ol.proj.METERS_PER_UNIT'); -goog.provide('ol.proj.Projection'); -goog.provide('ol.proj.ProjectionLike'); -goog.provide('ol.proj.Units'); - -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Extent'); -goog.require('ol.TransformFunction'); -goog.require('ol.extent'); -goog.require('ol.sphere.NORMAL'); - - -/** - * A projection as {@link ol.proj.Projection}, SRS identifier string or - * undefined. - * @typedef {ol.proj.Projection|string|undefined} ol.proj.ProjectionLike - * @api stable - */ -ol.proj.ProjectionLike; - - -/** - * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or - * `'us-ft'`. - * @enum {string} - * @api stable - */ -ol.proj.Units = { - DEGREES: 'degrees', - FEET: 'ft', - METERS: 'm', - PIXELS: 'pixels', - TILE_PIXELS: 'tile-pixels', - USFEET: 'us-ft' -}; - - -/** - * Meters per unit lookup table. - * @const - * @type {Object.<ol.proj.Units, number>} - * @api stable - */ -ol.proj.METERS_PER_UNIT = {}; -ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES] = - 2 * Math.PI * ol.sphere.NORMAL.radius / 360; -ol.proj.METERS_PER_UNIT[ol.proj.Units.FEET] = 0.3048; -ol.proj.METERS_PER_UNIT[ol.proj.Units.METERS] = 1; -ol.proj.METERS_PER_UNIT[ol.proj.Units.USFEET] = 1200 / 3937; - - - -/** - * @classdesc - * Projection definition class. One of these is created for each projection - * supported in the application and stored in the {@link ol.proj} namespace. - * You can use these in applications, but this is not required, as API params - * and options use {@link ol.proj.ProjectionLike} which means the simple string - * code will suffice. - * - * You can use {@link ol.proj.get} to retrieve the object for a particular - * projection. - * - * The library includes definitions for `EPSG:4326` and `EPSG:3857`, together - * with the following aliases: - * * `EPSG:4326`: CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, - * urn:ogc:def:crs:OGC:1.3:CRS84, urn:ogc:def:crs:OGC:2:84, - * http://www.opengis.net/gml/srs/epsg.xml#4326, - * urn:x-ogc:def:crs:EPSG:4326 - * * `EPSG:3857`: EPSG:102100, EPSG:102113, EPSG:900913, - * urn:ogc:def:crs:EPSG:6.18:3:3857, - * http://www.opengis.net/gml/srs/epsg.xml#3857 - * - * If you use proj4js, aliases can be added using `proj4.defs()`; see - * [documentation](https://github.com/proj4js/proj4js). - * - * @constructor - * @param {olx.ProjectionOptions} options Projection options. - * @struct - * @api stable - */ -ol.proj.Projection = function(options) { - - /** - * @private - * @type {string} - */ - this.code_ = options.code; - - /** - * @private - * @type {ol.proj.Units} - */ - this.units_ = /** @type {ol.proj.Units} */ (options.units); - - /** - * @private - * @type {ol.Extent} - */ - this.extent_ = options.extent !== undefined ? options.extent : null; - - /** - * @private - * @type {ol.Extent} - */ - this.worldExtent_ = options.worldExtent !== undefined ? - options.worldExtent : null; - - /** - * @private - * @type {string} - */ - this.axisOrientation_ = options.axisOrientation !== undefined ? - options.axisOrientation : 'enu'; - - /** - * @private - * @type {boolean} - */ - this.global_ = options.global !== undefined ? options.global : false; - - - /** - * @private - * @type {boolean} - */ - this.canWrapX_ = !!(this.global_ && this.extent_); - - /** - * @private - * @type {function(number, ol.Coordinate):number} - */ - this.getPointResolutionFunc_ = options.getPointResolution !== undefined ? - options.getPointResolution : this.getPointResolution_; - - /** - * @private - * @type {ol.tilegrid.TileGrid} - */ - this.defaultTileGrid_ = null; - - var projections = ol.proj.projections_; - var code = options.code; - goog.asserts.assert(code !== undefined, - 'Option "code" is required for constructing instance'); - if (ol.ENABLE_PROJ4JS && typeof proj4 == 'function' && - projections[code] === undefined) { - var def = proj4.defs(code); - if (def !== undefined) { - if (def.axis !== undefined && options.axisOrientation === undefined) { - this.axisOrientation_ = def.axis; - } - if (options.units === undefined) { - var units = def.units; - if (def.to_meter !== undefined) { - if (units === undefined || - ol.proj.METERS_PER_UNIT[units] === undefined) { - units = def.to_meter.toString(); - ol.proj.METERS_PER_UNIT[units] = def.to_meter; - } - } - this.units_ = units; - } - var currentCode, currentDef, currentProj, proj4Transform; - for (currentCode in projections) { - currentDef = proj4.defs(currentCode); - if (currentDef !== undefined) { - currentProj = ol.proj.get(currentCode); - if (currentDef === def) { - ol.proj.addEquivalentProjections([currentProj, this]); - } else { - proj4Transform = proj4(currentCode, code); - ol.proj.addCoordinateTransforms(currentProj, this, - proj4Transform.forward, proj4Transform.inverse); - } - } - } - } - } - -}; - - -/** - * @return {boolean} The projection is suitable for wrapping the x-axis - */ -ol.proj.Projection.prototype.canWrapX = function() { - return this.canWrapX_; -}; - - -/** - * Get the code for this projection, e.g. 'EPSG:4326'. - * @return {string} Code. - * @api stable - */ -ol.proj.Projection.prototype.getCode = function() { - return this.code_; -}; - - -/** - * Get the validity extent for this projection. - * @return {ol.Extent} Extent. - * @api stable - */ -ol.proj.Projection.prototype.getExtent = function() { - return this.extent_; -}; - - -/** - * Get the units of this projection. - * @return {ol.proj.Units} Units. - * @api stable - */ -ol.proj.Projection.prototype.getUnits = function() { - return this.units_; -}; - - -/** - * Get the amount of meters per unit of this projection. If the projection is - * not configured with a units identifier, the return is `undefined`. - * @return {number|undefined} Meters. - * @api stable - */ -ol.proj.Projection.prototype.getMetersPerUnit = function() { - return ol.proj.METERS_PER_UNIT[this.units_]; -}; - - -/** - * Get the world extent for this projection. - * @return {ol.Extent} Extent. - * @api - */ -ol.proj.Projection.prototype.getWorldExtent = function() { - return this.worldExtent_; -}; - - -/** - * Get the axis orientation of this projection. - * Example values are: - * enu - the default easting, northing, elevation. - * neu - northing, easting, up - useful for "lat/long" geographic coordinates, - * or south orientated transverse mercator. - * wnu - westing, northing, up - some planetary coordinate systems have - * "west positive" coordinate systems - * @return {string} Axis orientation. - */ -ol.proj.Projection.prototype.getAxisOrientation = function() { - return this.axisOrientation_; -}; - - -/** - * Is this projection a global projection which spans the whole world? - * @return {boolean} Whether the projection is global. - * @api stable - */ -ol.proj.Projection.prototype.isGlobal = function() { - return this.global_; -}; - - -/** -* Set if the projection is a global projection which spans the whole world -* @param {boolean} global Whether the projection is global. -* @api stable -*/ -ol.proj.Projection.prototype.setGlobal = function(global) { - this.global_ = global; - this.canWrapX_ = !!(global && this.extent_); -}; - - -/** - * @return {ol.tilegrid.TileGrid} The default tile grid. - */ -ol.proj.Projection.prototype.getDefaultTileGrid = function() { - return this.defaultTileGrid_; -}; - - -/** - * @param {ol.tilegrid.TileGrid} tileGrid The default tile grid. - */ -ol.proj.Projection.prototype.setDefaultTileGrid = function(tileGrid) { - this.defaultTileGrid_ = tileGrid; -}; - - -/** - * Set the validity extent for this projection. - * @param {ol.Extent} extent Extent. - * @api stable - */ -ol.proj.Projection.prototype.setExtent = function(extent) { - this.extent_ = extent; - this.canWrapX_ = !!(this.global_ && extent); -}; - - -/** - * Set the world extent for this projection. - * @param {ol.Extent} worldExtent World extent - * [minlon, minlat, maxlon, maxlat]. - * @api - */ -ol.proj.Projection.prototype.setWorldExtent = function(worldExtent) { - this.worldExtent_ = worldExtent; -}; - - -/** -* Set the getPointResolution function for this projection. -* @param {function(number, ol.Coordinate):number} func Function -* @api -*/ -ol.proj.Projection.prototype.setGetPointResolution = function(func) { - this.getPointResolutionFunc_ = func; -}; - - -/** -* Default version. -* Get the resolution of the point in degrees or distance units. -* For projections with degrees as the unit this will simply return the -* provided resolution. For other projections the point resolution is -* estimated by transforming the 'point' pixel to EPSG:4326, -* measuring its width and height on the normal sphere, -* and taking the average of the width and height. -* @param {number} resolution Nominal resolution in projection units. -* @param {ol.Coordinate} point Point to find adjusted resolution at. -* @return {number} Point resolution at point in projection units. -* @private -*/ -ol.proj.Projection.prototype.getPointResolution_ = function(resolution, point) { - var units = this.getUnits(); - if (units == ol.proj.Units.DEGREES) { - return resolution; - } else { - // Estimate point resolution by transforming the center pixel to EPSG:4326, - // measuring its width and height on the normal sphere, and taking the - // average of the width and height. - var toEPSG4326 = ol.proj.getTransformFromProjections( - this, ol.proj.get('EPSG:4326')); - var vertices = [ - point[0] - resolution / 2, point[1], - point[0] + resolution / 2, point[1], - point[0], point[1] - resolution / 2, - point[0], point[1] + resolution / 2 - ]; - vertices = toEPSG4326(vertices, vertices, 2); - var width = ol.sphere.NORMAL.haversineDistance( - vertices.slice(0, 2), vertices.slice(2, 4)); - var height = ol.sphere.NORMAL.haversineDistance( - vertices.slice(4, 6), vertices.slice(6, 8)); - var pointResolution = (width + height) / 2; - var metersPerUnit = this.getMetersPerUnit(); - if (metersPerUnit !== undefined) { - pointResolution /= metersPerUnit; - } - return pointResolution; - } -}; - - -/** - * Get the resolution of the point in degrees or distance units. - * For projections with degrees as the unit this will simply return the - * provided resolution. The default for other projections is to estimate - * the point resolution by transforming the 'point' pixel to EPSG:4326, - * measuring its width and height on the normal sphere, - * and taking the average of the width and height. - * An alternative implementation may be given when constructing a - * projection. For many local projections, - * such a custom function will return the resolution unchanged. - * @param {number} resolution Resolution in projection units. - * @param {ol.Coordinate} point Point. - * @return {number} Point resolution in projection units. - * @api - */ -ol.proj.Projection.prototype.getPointResolution = function(resolution, point) { - return this.getPointResolutionFunc_(resolution, point); -}; - - -/** - * @private - * @type {Object.<string, ol.proj.Projection>} - */ -ol.proj.projections_ = {}; - - -/** - * @private - * @type {Object.<string, Object.<string, ol.TransformFunction>>} - */ -ol.proj.transforms_ = {}; - - -/** - * Registers transformation functions that don't alter coordinates. Those allow - * to transform between projections with equal meaning. - * - * @param {Array.<ol.proj.Projection>} projections Projections. - * @api - */ -ol.proj.addEquivalentProjections = function(projections) { - ol.proj.addProjections(projections); - projections.forEach(function(source) { - projections.forEach(function(destination) { - if (source !== destination) { - ol.proj.addTransform(source, destination, ol.proj.cloneTransform); - } - }); - }); -}; - - -/** - * Registers transformation functions to convert coordinates in any projection - * in projection1 to any projection in projection2. - * - * @param {Array.<ol.proj.Projection>} projections1 Projections with equal - * meaning. - * @param {Array.<ol.proj.Projection>} projections2 Projections with equal - * meaning. - * @param {ol.TransformFunction} forwardTransform Transformation from any - * projection in projection1 to any projection in projection2. - * @param {ol.TransformFunction} inverseTransform Transform from any projection - * in projection2 to any projection in projection1.. - */ -ol.proj.addEquivalentTransforms = - function(projections1, projections2, forwardTransform, inverseTransform) { - projections1.forEach(function(projection1) { - projections2.forEach(function(projection2) { - ol.proj.addTransform(projection1, projection2, forwardTransform); - ol.proj.addTransform(projection2, projection1, inverseTransform); - }); - }); -}; - - -/** - * Add a Projection object to the list of supported projections that can be - * looked up by their code. - * - * @param {ol.proj.Projection} projection Projection instance. - * @api stable - */ -ol.proj.addProjection = function(projection) { - ol.proj.projections_[projection.getCode()] = projection; - ol.proj.addTransform(projection, projection, ol.proj.cloneTransform); -}; - - -/** - * @param {Array.<ol.proj.Projection>} projections Projections. - */ -ol.proj.addProjections = function(projections) { - var addedProjections = []; - projections.forEach(function(projection) { - addedProjections.push(ol.proj.addProjection(projection)); - }); -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.proj.clearAllProjections = function() { - ol.proj.projections_ = {}; - ol.proj.transforms_ = {}; -}; - - -/** - * @param {ol.proj.Projection|string|undefined} projection Projection. - * @param {string} defaultCode Default code. - * @return {ol.proj.Projection} Projection. - */ -ol.proj.createProjection = function(projection, defaultCode) { - if (!projection) { - return ol.proj.get(defaultCode); - } else if (goog.isString(projection)) { - return ol.proj.get(projection); - } else { - goog.asserts.assertInstanceof(projection, ol.proj.Projection, - 'projection should be an ol.proj.Projection'); - return projection; - } -}; - - -/** - * Registers a conversion function to convert coordinates from the source - * projection to the destination projection. - * - * @param {ol.proj.Projection} source Source. - * @param {ol.proj.Projection} destination Destination. - * @param {ol.TransformFunction} transformFn Transform. - */ -ol.proj.addTransform = function(source, destination, transformFn) { - var sourceCode = source.getCode(); - var destinationCode = destination.getCode(); - var transforms = ol.proj.transforms_; - if (!goog.object.containsKey(transforms, sourceCode)) { - transforms[sourceCode] = {}; - } - transforms[sourceCode][destinationCode] = transformFn; -}; - - -/** - * Registers coordinate transform functions to convert coordinates between the - * source projection and the destination projection. - * The forward and inverse functions convert coordinate pairs; this function - * converts these into the functions used internally which also handle - * extents and coordinate arrays. - * - * @param {ol.proj.ProjectionLike} source Source projection. - * @param {ol.proj.ProjectionLike} destination Destination projection. - * @param {function(ol.Coordinate): ol.Coordinate} forward The forward transform - * function (that is, from the source projection to the destination - * projection) that takes a {@link ol.Coordinate} as argument and returns - * the transformed {@link ol.Coordinate}. - * @param {function(ol.Coordinate): ol.Coordinate} inverse The inverse transform - * function (that is, from the destination projection to the source - * projection) that takes a {@link ol.Coordinate} as argument and returns - * the transformed {@link ol.Coordinate}. - * @api stable - */ -ol.proj.addCoordinateTransforms = - function(source, destination, forward, inverse) { - var sourceProj = ol.proj.get(source); - var destProj = ol.proj.get(destination); - ol.proj.addTransform(sourceProj, destProj, - ol.proj.createTransformFromCoordinateTransform(forward)); - ol.proj.addTransform(destProj, sourceProj, - ol.proj.createTransformFromCoordinateTransform(inverse)); -}; - - -/** - * Creates a {@link ol.TransformFunction} from a simple 2D coordinate transform - * function. - * @param {function(ol.Coordinate): ol.Coordinate} transform Coordinate - * transform. - * @return {ol.TransformFunction} Transform function. - */ -ol.proj.createTransformFromCoordinateTransform = function(transform) { - return ( - /** - * @param {Array.<number>} input Input. - * @param {Array.<number>=} opt_output Output. - * @param {number=} opt_dimension Dimension. - * @return {Array.<number>} Output. - */ - function(input, opt_output, opt_dimension) { - var length = input.length; - var dimension = opt_dimension !== undefined ? opt_dimension : 2; - var output = opt_output !== undefined ? opt_output : new Array(length); - var point, i, j; - for (i = 0; i < length; i += dimension) { - point = transform([input[i], input[i + 1]]); - output[i] = point[0]; - output[i + 1] = point[1]; - for (j = dimension - 1; j >= 2; --j) { - output[i + j] = input[i + j]; - } - } - return output; - }); -}; - - -/** - * Unregisters the conversion function to convert coordinates from the source - * projection to the destination projection. This method is used to clean up - * cached transforms during testing. - * - * @param {ol.proj.Projection} source Source projection. - * @param {ol.proj.Projection} destination Destination projection. - * @return {ol.TransformFunction} transformFn The unregistered transform. - */ -ol.proj.removeTransform = function(source, destination) { - var sourceCode = source.getCode(); - var destinationCode = destination.getCode(); - var transforms = ol.proj.transforms_; - goog.asserts.assert(sourceCode in transforms, - 'sourceCode should be in transforms'); - goog.asserts.assert(destinationCode in transforms[sourceCode], - 'destinationCode should be in transforms of sourceCode'); - var transform = transforms[sourceCode][destinationCode]; - delete transforms[sourceCode][destinationCode]; - if (goog.object.isEmpty(transforms[sourceCode])) { - delete transforms[sourceCode]; - } - return transform; -}; - - -/** - * Transforms a coordinate from longitude/latitude to a different projection. - * @param {ol.Coordinate} coordinate Coordinate as longitude and latitude, i.e. - * an array with longitude as 1st and latitude as 2nd element. - * @param {ol.proj.ProjectionLike=} opt_projection Target projection. The - * default is Web Mercator, i.e. 'EPSG:3857'. - * @return {ol.Coordinate} Coordinate projected to the target projection. - * @api stable - */ -ol.proj.fromLonLat = function(coordinate, opt_projection) { - return ol.proj.transform(coordinate, 'EPSG:4326', - opt_projection !== undefined ? opt_projection : 'EPSG:3857'); -}; - - -/** - * Transforms a coordinate to longitude/latitude. - * @param {ol.Coordinate} coordinate Projected coordinate. - * @param {ol.proj.ProjectionLike=} opt_projection Projection of the coordinate. - * The default is Web Mercator, i.e. 'EPSG:3857'. - * @return {ol.Coordinate} Coordinate as longitude and latitude, i.e. an array - * with longitude as 1st and latitude as 2nd element. - * @api stable - */ -ol.proj.toLonLat = function(coordinate, opt_projection) { - return ol.proj.transform(coordinate, - opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326'); -}; - - -/** - * Fetches a Projection object for the code specified. - * - * @param {ol.proj.ProjectionLike} projectionLike Either a code string which is - * a combination of authority and identifier such as "EPSG:4326", or an - * existing projection object, or undefined. - * @return {ol.proj.Projection} Projection object, or null if not in list. - * @api stable - */ -ol.proj.get = function(projectionLike) { - var projection; - if (projectionLike instanceof ol.proj.Projection) { - projection = projectionLike; - } else if (goog.isString(projectionLike)) { - var code = projectionLike; - projection = ol.proj.projections_[code]; - if (ol.ENABLE_PROJ4JS && projection === undefined && - typeof proj4 == 'function' && proj4.defs(code) !== undefined) { - projection = new ol.proj.Projection({code: code}); - ol.proj.addProjection(projection); - } - } else { - projection = null; - } - return projection; -}; - - -/** - * Checks if two projections are the same, that is every coordinate in one - * projection does represent the same geographic point as the same coordinate in - * the other projection. - * - * @param {ol.proj.Projection} projection1 Projection 1. - * @param {ol.proj.Projection} projection2 Projection 2. - * @return {boolean} Equivalent. - */ -ol.proj.equivalent = function(projection1, projection2) { - if (projection1 === projection2) { - return true; - } else if (projection1.getCode() === projection2.getCode()) { - return projection1.getUnits() === projection2.getUnits(); - } else { - var transformFn = ol.proj.getTransformFromProjections( - projection1, projection2); - return transformFn === ol.proj.cloneTransform; - } -}; - - -/** - * Given the projection-like objects, searches for a transformation - * function to convert a coordinates array from the source projection to the - * destination projection. - * - * @param {ol.proj.ProjectionLike} source Source. - * @param {ol.proj.ProjectionLike} destination Destination. - * @return {ol.TransformFunction} Transform function. - * @api stable - */ -ol.proj.getTransform = function(source, destination) { - var sourceProjection = ol.proj.get(source); - var destinationProjection = ol.proj.get(destination); - return ol.proj.getTransformFromProjections( - sourceProjection, destinationProjection); -}; - - -/** - * Searches in the list of transform functions for the function for converting - * coordinates from the source projection to the destination projection. - * - * @param {ol.proj.Projection} sourceProjection Source Projection object. - * @param {ol.proj.Projection} destinationProjection Destination Projection - * object. - * @return {ol.TransformFunction} Transform function. - */ -ol.proj.getTransformFromProjections = - function(sourceProjection, destinationProjection) { - var transforms = ol.proj.transforms_; - var sourceCode = sourceProjection.getCode(); - var destinationCode = destinationProjection.getCode(); - var transform; - if (goog.object.containsKey(transforms, sourceCode) && - goog.object.containsKey(transforms[sourceCode], destinationCode)) { - transform = transforms[sourceCode][destinationCode]; - } - if (transform === undefined) { - goog.asserts.assert(transform !== undefined, 'transform should be defined'); - transform = ol.proj.identityTransform; - } - return transform; -}; - - -/** - * @param {Array.<number>} input Input coordinate array. - * @param {Array.<number>=} opt_output Output array of coordinate values. - * @param {number=} opt_dimension Dimension. - * @return {Array.<number>} Input coordinate array (same array as input). - */ -ol.proj.identityTransform = function(input, opt_output, opt_dimension) { - if (opt_output !== undefined && input !== opt_output) { - // TODO: consider making this a warning instead - goog.asserts.fail('This should not be used internally.'); - for (var i = 0, ii = input.length; i < ii; ++i) { - opt_output[i] = input[i]; - } - input = opt_output; - } - return input; -}; - - -/** - * @param {Array.<number>} input Input coordinate array. - * @param {Array.<number>=} opt_output Output array of coordinate values. - * @param {number=} opt_dimension Dimension. - * @return {Array.<number>} Output coordinate array (new array, same coordinate - * values). - */ -ol.proj.cloneTransform = function(input, opt_output, opt_dimension) { - var output; - if (opt_output !== undefined) { - for (var i = 0, ii = input.length; i < ii; ++i) { - opt_output[i] = input[i]; - } - output = opt_output; - } else { - output = input.slice(); - } - return output; -}; - - -/** - * Transforms a coordinate from source projection to destination projection. - * This returns a new coordinate (and does not modify the original). - * - * See {@link ol.proj.transformExtent} for extent transformation. - * See the transform method of {@link ol.geom.Geometry} and its subclasses for - * geometry transforms. - * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.proj.ProjectionLike} source Source projection-like. - * @param {ol.proj.ProjectionLike} destination Destination projection-like. - * @return {ol.Coordinate} Coordinate. - * @api stable - */ -ol.proj.transform = function(coordinate, source, destination) { - var transformFn = ol.proj.getTransform(source, destination); - return transformFn(coordinate, undefined, coordinate.length); -}; - - -/** - * Transforms an extent from source projection to destination projection. This - * returns a new extent (and does not modify the original). - * - * @param {ol.Extent} extent The extent to transform. - * @param {ol.proj.ProjectionLike} source Source projection-like. - * @param {ol.proj.ProjectionLike} destination Destination projection-like. - * @return {ol.Extent} The transformed extent. - * @api stable - */ -ol.proj.transformExtent = function(extent, source, destination) { - var transformFn = ol.proj.getTransform(source, destination); - return ol.extent.applyTransform(extent, transformFn); -}; - - -/** - * Transforms the given point to the destination projection. - * - * @param {ol.Coordinate} point Point. - * @param {ol.proj.Projection} sourceProjection Source projection. - * @param {ol.proj.Projection} destinationProjection Destination projection. - * @return {ol.Coordinate} Point. - */ -ol.proj.transformWithProjections = - function(point, sourceProjection, destinationProjection) { - var transformFn = ol.proj.getTransformFromProjections( - sourceProjection, destinationProjection); - return transformFn(point); -}; - -goog.provide('ol.geom.Geometry'); -goog.provide('ol.geom.GeometryLayout'); -goog.provide('ol.geom.GeometryType'); - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('ol.Object'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.proj.Units'); - - -/** - * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`, - * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`, - * `'GeometryCollection'`, `'Circle'`. - * @enum {string} - * @api stable - */ -ol.geom.GeometryType = { - POINT: 'Point', - LINE_STRING: 'LineString', - LINEAR_RING: 'LinearRing', - POLYGON: 'Polygon', - MULTI_POINT: 'MultiPoint', - MULTI_LINE_STRING: 'MultiLineString', - MULTI_POLYGON: 'MultiPolygon', - GEOMETRY_COLLECTION: 'GeometryCollection', - CIRCLE: 'Circle' -}; - - -/** - * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z') - * or measure ('M') coordinate is available. Supported values are `'XY'`, - * `'XYZ'`, `'XYM'`, `'XYZM'`. - * @enum {string} - * @api stable - */ -ol.geom.GeometryLayout = { - XY: 'XY', - XYZ: 'XYZ', - XYM: 'XYM', - XYZM: 'XYZM' -}; - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Base class for vector geometries. - * - * To get notified of changes to the geometry, register a listener for the - * generic `change` event on your geometry instance. - * - * @constructor - * @extends {ol.Object} - * @api stable - */ -ol.geom.Geometry = function() { - - goog.base(this); - - /** - * @private - * @type {ol.Extent} - */ - this.extent_ = ol.extent.createEmpty(); - - /** - * @private - * @type {number} - */ - this.extentRevision_ = -1; - - /** - * @protected - * @type {Object.<string, ol.geom.Geometry>} - */ - this.simplifiedGeometryCache = {}; - - /** - * @protected - * @type {number} - */ - this.simplifiedGeometryMaxMinSquaredTolerance = 0; - - /** - * @protected - * @type {number} - */ - this.simplifiedGeometryRevision = 0; - -}; -goog.inherits(ol.geom.Geometry, ol.Object); - - -/** - * Make a complete copy of the geometry. - * @function - * @return {!ol.geom.Geometry} Clone. - */ -ol.geom.Geometry.prototype.clone = goog.abstractMethod; - - -/** - * @param {number} x X. - * @param {number} y Y. - * @param {ol.Coordinate} closestPoint Closest point. - * @param {number} minSquaredDistance Minimum squared distance. - * @return {number} Minimum squared distance. - */ -ol.geom.Geometry.prototype.closestPointXY = goog.abstractMethod; - - -/** - * Return the closest point of the geometry to the passed point as - * {@link ol.Coordinate coordinate}. - * @param {ol.Coordinate} point Point. - * @param {ol.Coordinate=} opt_closestPoint Closest point. - * @return {ol.Coordinate} Closest point. - * @api stable - */ -ol.geom.Geometry.prototype.getClosestPoint = function(point, opt_closestPoint) { - var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN]; - this.closestPointXY(point[0], point[1], closestPoint, Infinity); - return closestPoint; -}; - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @return {boolean} Contains coordinate. - */ -ol.geom.Geometry.prototype.containsCoordinate = function(coordinate) { - return this.containsXY(coordinate[0], coordinate[1]); -}; - - -/** - * @param {ol.Extent} extent Extent. - * @protected - * @return {ol.Extent} extent Extent. - */ -ol.geom.Geometry.prototype.computeExtent = goog.abstractMethod; - - -/** - * @param {number} x X. - * @param {number} y Y. - * @return {boolean} Contains (x, y). - */ -ol.geom.Geometry.prototype.containsXY = goog.functions.FALSE; - - -/** - * Get the extent of the geometry. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} extent Extent. - * @api stable - */ -ol.geom.Geometry.prototype.getExtent = function(opt_extent) { - if (this.extentRevision_ != this.getRevision()) { - this.extent_ = this.computeExtent(this.extent_); - this.extentRevision_ = this.getRevision(); - } - return ol.extent.returnOrUpdate(this.extent_, opt_extent); -}; - - -/** - * Create a simplified version of this geometry. For linestrings, this uses - * the the {@link - * https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm - * Douglas Peucker} algorithm. For polygons, a quantization-based - * simplification is used to preserve topology. - * @function - * @param {number} tolerance The tolerance distance for simplification. - * @return {ol.geom.Geometry} A new, simplified version of the original - * geometry. - * @api - */ -ol.geom.Geometry.prototype.simplify = function(tolerance) { - return this.getSimplifiedGeometry(tolerance * tolerance); -}; - - -/** - * Create a simplified version of this geometry using the Douglas Peucker - * algorithm. - * @see https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm - * @function - * @param {number} squaredTolerance Squared tolerance. - * @return {ol.geom.Geometry} Simplified geometry. - */ -ol.geom.Geometry.prototype.getSimplifiedGeometry = goog.abstractMethod; - - -/** - * Get the type of this geometry. - * @function - * @return {ol.geom.GeometryType} Geometry type. - */ -ol.geom.Geometry.prototype.getType = goog.abstractMethod; - - -/** - * Apply a transform function to each coordinate of the geometry. - * The geometry is modified in place. - * If you do not want the geometry modified in place, first clone() it and - * then use this function on the clone. - * @function - * @param {ol.TransformFunction} transformFn Transform. - */ -ol.geom.Geometry.prototype.applyTransform = goog.abstractMethod; - - -/** - * Test if the geometry and the passed extent intersect. - * @param {ol.Extent} extent Extent. - * @return {boolean} `true` if the geometry and the extent intersect. - * @function - */ -ol.geom.Geometry.prototype.intersectsExtent = goog.abstractMethod; - - -/** - * Translate the geometry. This modifies the geometry coordinates in place. If - * instead you want a new geometry, first `clone()` this geometry. - * @param {number} deltaX Delta X. - * @param {number} deltaY Delta Y. - * @function - */ -ol.geom.Geometry.prototype.translate = goog.abstractMethod; - - -/** - * Transform each coordinate of the geometry from one coordinate reference - * system to another. The geometry is modified in place. - * For example, a line will be transformed to a line and a circle to a circle. - * If you do not want the geometry modified in place, first clone() it and - * then use this function on the clone. - * - * @param {ol.proj.ProjectionLike} source The current projection. Can be a - * string identifier or a {@link ol.proj.Projection} object. - * @param {ol.proj.ProjectionLike} destination The desired projection. Can be a - * string identifier or a {@link ol.proj.Projection} object. - * @return {ol.geom.Geometry} This geometry. Note that original geometry is - * modified in place. - * @api stable - */ -ol.geom.Geometry.prototype.transform = function(source, destination) { - goog.asserts.assert( - ol.proj.get(source).getUnits() !== ol.proj.Units.TILE_PIXELS && - ol.proj.get(destination).getUnits() !== ol.proj.Units.TILE_PIXELS, - 'cannot transform geometries with TILE_PIXELS units'); - this.applyTransform(ol.proj.getTransform(source, destination)); - return this; -}; - -goog.provide('ol.geom.flat.transform'); - -goog.require('goog.vec.Mat4'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {Array.<number>=} opt_dest Destination. - * @return {Array.<number>} Transformed coordinates. - */ -ol.geom.flat.transform.transform2D = - function(flatCoordinates, offset, end, stride, transform, opt_dest) { - var m00 = goog.vec.Mat4.getElement(transform, 0, 0); - var m10 = goog.vec.Mat4.getElement(transform, 1, 0); - var m01 = goog.vec.Mat4.getElement(transform, 0, 1); - var m11 = goog.vec.Mat4.getElement(transform, 1, 1); - var m03 = goog.vec.Mat4.getElement(transform, 0, 3); - var m13 = goog.vec.Mat4.getElement(transform, 1, 3); - var dest = opt_dest ? opt_dest : []; - var i = 0; - var j; - for (j = offset; j < end; j += stride) { - var x = flatCoordinates[j]; - var y = flatCoordinates[j + 1]; - dest[i++] = m00 * x + m01 * y + m03; - dest[i++] = m10 * x + m11 * y + m13; - } - if (opt_dest && dest.length != i) { - dest.length = i; - } - return dest; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} deltaX Delta X. - * @param {number} deltaY Delta Y. - * @param {Array.<number>=} opt_dest Destination. - * @return {Array.<number>} Transformed coordinates. - */ -ol.geom.flat.transform.translate = - function(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) { - var dest = opt_dest ? opt_dest : []; - var i = 0; - var j, k; - for (j = offset; j < end; j += stride) { - dest[i++] = flatCoordinates[j] + deltaX; - dest[i++] = flatCoordinates[j + 1] + deltaY; - for (k = j + 2; k < j + stride; ++k) { - dest[i++] = flatCoordinates[k]; - } - } - if (opt_dest && dest.length != i) { - dest.length = i; - } - return dest; -}; - -goog.provide('ol.geom.SimpleGeometry'); - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('goog.object'); -goog.require('ol.extent'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.flat.transform'); - - - -/** - * @classdesc - * Abstract base class; only used for creating subclasses; do not instantiate - * in apps, as cannot be rendered. - * - * @constructor - * @extends {ol.geom.Geometry} - * @api stable - */ -ol.geom.SimpleGeometry = function() { - - goog.base(this); - - /** - * @protected - * @type {ol.geom.GeometryLayout} - */ - this.layout = ol.geom.GeometryLayout.XY; - - /** - * @protected - * @type {number} - */ - this.stride = 2; - - /** - * @protected - * @type {Array.<number>} - */ - this.flatCoordinates = null; - -}; -goog.inherits(ol.geom.SimpleGeometry, ol.geom.Geometry); - - -/** - * @param {number} stride Stride. - * @private - * @return {ol.geom.GeometryLayout} layout Layout. - */ -ol.geom.SimpleGeometry.getLayoutForStride_ = function(stride) { - if (stride == 2) { - return ol.geom.GeometryLayout.XY; - } else if (stride == 3) { - return ol.geom.GeometryLayout.XYZ; - } else if (stride == 4) { - return ol.geom.GeometryLayout.XYZM; - } else { - goog.asserts.fail('unsupported stride: ' + stride); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @return {number} Stride. - */ -ol.geom.SimpleGeometry.getStrideForLayout = function(layout) { - if (layout == ol.geom.GeometryLayout.XY) { - return 2; - } else if (layout == ol.geom.GeometryLayout.XYZ) { - return 3; - } else if (layout == ol.geom.GeometryLayout.XYM) { - return 3; - } else if (layout == ol.geom.GeometryLayout.XYZM) { - return 4; - } else { - goog.asserts.fail('unsupported layout: ' + layout); - } -}; - - -/** - * @inheritDoc - */ -ol.geom.SimpleGeometry.prototype.containsXY = goog.functions.FALSE; - - -/** - * @inheritDoc - */ -ol.geom.SimpleGeometry.prototype.computeExtent = function(extent) { - return ol.extent.createOrUpdateFromFlatCoordinates( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, - extent); -}; - - -/** - * @return {Array} Coordinates. - */ -ol.geom.SimpleGeometry.prototype.getCoordinates = goog.abstractMethod; - - -/** - * Return the first coordinate of the geometry. - * @return {ol.Coordinate} First coordinate. - * @api stable - */ -ol.geom.SimpleGeometry.prototype.getFirstCoordinate = function() { - return this.flatCoordinates.slice(0, this.stride); -}; - - -/** - * @return {Array.<number>} Flat coordinates. - */ -ol.geom.SimpleGeometry.prototype.getFlatCoordinates = function() { - return this.flatCoordinates; -}; - - -/** - * Return the last coordinate of the geometry. - * @return {ol.Coordinate} Last point. - * @api stable - */ -ol.geom.SimpleGeometry.prototype.getLastCoordinate = function() { - return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride); -}; - - -/** - * Return the {@link ol.geom.GeometryLayout layout} of the geometry. - * @return {ol.geom.GeometryLayout} Layout. - * @api stable - */ -ol.geom.SimpleGeometry.prototype.getLayout = function() { - return this.layout; -}; - - -/** - * @inheritDoc - */ -ol.geom.SimpleGeometry.prototype.getSimplifiedGeometry = - function(squaredTolerance) { - if (this.simplifiedGeometryRevision != this.getRevision()) { - goog.object.clear(this.simplifiedGeometryCache); - this.simplifiedGeometryMaxMinSquaredTolerance = 0; - this.simplifiedGeometryRevision = this.getRevision(); - } - // If squaredTolerance is negative or if we know that simplification will not - // have any effect then just return this. - if (squaredTolerance < 0 || - (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && - squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)) { - return this; - } - var key = squaredTolerance.toString(); - if (this.simplifiedGeometryCache.hasOwnProperty(key)) { - return this.simplifiedGeometryCache[key]; - } else { - var simplifiedGeometry = - this.getSimplifiedGeometryInternal(squaredTolerance); - var simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates(); - if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) { - this.simplifiedGeometryCache[key] = simplifiedGeometry; - return simplifiedGeometry; - } else { - // Simplification did not actually remove any coordinates. We now know - // that any calls to getSimplifiedGeometry with a squaredTolerance less - // than or equal to the current squaredTolerance will also not have any - // effect. This allows us to short circuit simplification (saving CPU - // cycles) and prevents the cache of simplified geometries from filling - // up with useless identical copies of this geometry (saving memory). - this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance; - return this; - } - } -}; - - -/** - * @param {number} squaredTolerance Squared tolerance. - * @return {ol.geom.SimpleGeometry} Simplified geometry. - * @protected - */ -ol.geom.SimpleGeometry.prototype.getSimplifiedGeometryInternal = - function(squaredTolerance) { - return this; -}; - - -/** - * @return {number} Stride. - */ -ol.geom.SimpleGeometry.prototype.getStride = function() { - return this.stride; -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @protected - */ -ol.geom.SimpleGeometry.prototype.setFlatCoordinatesInternal = - function(layout, flatCoordinates) { - this.stride = ol.geom.SimpleGeometry.getStrideForLayout(layout); - this.layout = layout; - this.flatCoordinates = flatCoordinates; -}; - - -/** - * @param {Array} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - */ -ol.geom.SimpleGeometry.prototype.setCoordinates = goog.abstractMethod; - - -/** - * @param {ol.geom.GeometryLayout|undefined} layout Layout. - * @param {Array} coordinates Coordinates. - * @param {number} nesting Nesting. - * @protected - */ -ol.geom.SimpleGeometry.prototype.setLayout = - function(layout, coordinates, nesting) { - /** @type {number} */ - var stride; - if (layout) { - stride = ol.geom.SimpleGeometry.getStrideForLayout(layout); - } else { - var i; - for (i = 0; i < nesting; ++i) { - if (coordinates.length === 0) { - this.layout = ol.geom.GeometryLayout.XY; - this.stride = 2; - return; - } else { - coordinates = /** @type {Array} */ (coordinates[0]); - } - } - stride = (/** @type {Array} */ (coordinates)).length; - layout = ol.geom.SimpleGeometry.getLayoutForStride_(stride); - } - this.layout = layout; - this.stride = stride; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) { - if (this.flatCoordinates) { - transformFn(this.flatCoordinates, this.flatCoordinates, this.stride); - this.changed(); - } -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.SimpleGeometry.prototype.translate = function(deltaX, deltaY) { - var flatCoordinates = this.getFlatCoordinates(); - if (flatCoordinates) { - var stride = this.getStride(); - ol.geom.flat.transform.translate( - flatCoordinates, 0, flatCoordinates.length, stride, - deltaX, deltaY, flatCoordinates); - this.changed(); - } -}; - - -/** - * @param {ol.geom.SimpleGeometry} simpleGeometry Simple geometry. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {Array.<number>=} opt_dest Destination. - * @return {Array.<number>} Transformed flat coordinates. - */ -ol.geom.transformSimpleGeometry2D = - function(simpleGeometry, transform, opt_dest) { - var flatCoordinates = simpleGeometry.getFlatCoordinates(); - if (!flatCoordinates) { - return null; - } else { - var stride = simpleGeometry.getStride(); - return ol.geom.flat.transform.transform2D( - flatCoordinates, 0, flatCoordinates.length, stride, - transform, opt_dest); - } -}; - -goog.provide('ol.geom.flat.area'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @return {number} Area. - */ -ol.geom.flat.area.linearRing = function(flatCoordinates, offset, end, stride) { - var twiceArea = 0; - var x1 = flatCoordinates[end - stride]; - var y1 = flatCoordinates[end - stride + 1]; - for (; offset < end; offset += stride) { - var x2 = flatCoordinates[offset]; - var y2 = flatCoordinates[offset + 1]; - twiceArea += y1 * x2 - x1 * y2; - x1 = x2; - y1 = y2; - } - return twiceArea / 2; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @return {number} Area. - */ -ol.geom.flat.area.linearRings = - function(flatCoordinates, offset, ends, stride) { - var area = 0; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - area += ol.geom.flat.area.linearRing(flatCoordinates, offset, end, stride); - offset = end; - } - return area; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @return {number} Area. - */ -ol.geom.flat.area.linearRingss = - function(flatCoordinates, offset, endss, stride) { - var area = 0; - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - area += - ol.geom.flat.area.linearRings(flatCoordinates, offset, ends, stride); - offset = ends[ends.length - 1]; - } - return area; -}; - -goog.provide('ol.geom.flat.closest'); - -goog.require('goog.asserts'); -goog.require('goog.math'); -goog.require('ol.math'); - - -/** - * Returns the point on the 2D line segment flatCoordinates[offset1] to - * flatCoordinates[offset2] that is closest to the point (x, y). Extra - * dimensions are linearly interpolated. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset1 Offset 1. - * @param {number} offset2 Offset 2. - * @param {number} stride Stride. - * @param {number} x X. - * @param {number} y Y. - * @param {Array.<number>} closestPoint Closest point. - */ -ol.geom.flat.closest.point = - function(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) { - var x1 = flatCoordinates[offset1]; - var y1 = flatCoordinates[offset1 + 1]; - var dx = flatCoordinates[offset2] - x1; - var dy = flatCoordinates[offset2 + 1] - y1; - var i, offset; - if (dx === 0 && dy === 0) { - offset = offset1; - } else { - var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy); - if (t > 1) { - offset = offset2; - } else if (t > 0) { - for (i = 0; i < stride; ++i) { - closestPoint[i] = goog.math.lerp(flatCoordinates[offset1 + i], - flatCoordinates[offset2 + i], t); - } - closestPoint.length = stride; - return; - } else { - offset = offset1; - } - } - for (i = 0; i < stride; ++i) { - closestPoint[i] = flatCoordinates[offset + i]; - } - closestPoint.length = stride; -}; - - -/** - * Return the squared of the largest distance between any pair of consecutive - * coordinates. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} maxSquaredDelta Max squared delta. - * @return {number} Max squared delta. - */ -ol.geom.flat.closest.getMaxSquaredDelta = - function(flatCoordinates, offset, end, stride, maxSquaredDelta) { - var x1 = flatCoordinates[offset]; - var y1 = flatCoordinates[offset + 1]; - for (offset += stride; offset < end; offset += stride) { - var x2 = flatCoordinates[offset]; - var y2 = flatCoordinates[offset + 1]; - var squaredDelta = ol.math.squaredDistance(x1, y1, x2, y2); - if (squaredDelta > maxSquaredDelta) { - maxSquaredDelta = squaredDelta; - } - x1 = x2; - y1 = y2; - } - return maxSquaredDelta; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {number} maxSquaredDelta Max squared delta. - * @return {number} Max squared delta. - */ -ol.geom.flat.closest.getsMaxSquaredDelta = - function(flatCoordinates, offset, ends, stride, maxSquaredDelta) { - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - maxSquaredDelta = ol.geom.flat.closest.getMaxSquaredDelta( - flatCoordinates, offset, end, stride, maxSquaredDelta); - offset = end; - } - return maxSquaredDelta; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @param {number} maxSquaredDelta Max squared delta. - * @return {number} Max squared delta. - */ -ol.geom.flat.closest.getssMaxSquaredDelta = - function(flatCoordinates, offset, endss, stride, maxSquaredDelta) { - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - maxSquaredDelta = ol.geom.flat.closest.getsMaxSquaredDelta( - flatCoordinates, offset, ends, stride, maxSquaredDelta); - offset = ends[ends.length - 1]; - } - return maxSquaredDelta; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} maxDelta Max delta. - * @param {boolean} isRing Is ring. - * @param {number} x X. - * @param {number} y Y. - * @param {Array.<number>} closestPoint Closest point. - * @param {number} minSquaredDistance Minimum squared distance. - * @param {Array.<number>=} opt_tmpPoint Temporary point object. - * @return {number} Minimum squared distance. - */ -ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end, - stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, - opt_tmpPoint) { - if (offset == end) { - return minSquaredDistance; - } - var i, squaredDistance; - if (maxDelta === 0) { - // All points are identical, so just test the first point. - squaredDistance = ol.math.squaredDistance( - x, y, flatCoordinates[offset], flatCoordinates[offset + 1]); - if (squaredDistance < minSquaredDistance) { - for (i = 0; i < stride; ++i) { - closestPoint[i] = flatCoordinates[offset + i]; - } - closestPoint.length = stride; - return squaredDistance; - } else { - return minSquaredDistance; - } - } - goog.asserts.assert(maxDelta > 0, 'maxDelta should be larger than 0'); - var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; - var index = offset + stride; - while (index < end) { - ol.geom.flat.closest.point( - flatCoordinates, index - stride, index, stride, x, y, tmpPoint); - squaredDistance = ol.math.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]); - if (squaredDistance < minSquaredDistance) { - minSquaredDistance = squaredDistance; - for (i = 0; i < stride; ++i) { - closestPoint[i] = tmpPoint[i]; - } - closestPoint.length = stride; - index += stride; - } else { - // Skip ahead multiple points, because we know that all the skipped - // points cannot be any closer than the closest point we have found so - // far. We know this because we know how close the current point is, how - // close the closest point we have found so far is, and the maximum - // distance between consecutive points. For example, if we're currently - // at distance 10, the best we've found so far is 3, and that the maximum - // distance between consecutive points is 2, then we'll need to skip at - // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of - // finding a closer point. We use Math.max(..., 1) to ensure that we - // always advance at least one point, to avoid an infinite loop. - index += stride * Math.max( - ((Math.sqrt(squaredDistance) - - Math.sqrt(minSquaredDistance)) / maxDelta) | 0, 1); - } - } - if (isRing) { - // Check the closing segment. - ol.geom.flat.closest.point( - flatCoordinates, end - stride, offset, stride, x, y, tmpPoint); - squaredDistance = ol.math.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]); - if (squaredDistance < minSquaredDistance) { - minSquaredDistance = squaredDistance; - for (i = 0; i < stride; ++i) { - closestPoint[i] = tmpPoint[i]; - } - closestPoint.length = stride; - } - } - return minSquaredDistance; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {number} maxDelta Max delta. - * @param {boolean} isRing Is ring. - * @param {number} x X. - * @param {number} y Y. - * @param {Array.<number>} closestPoint Closest point. - * @param {number} minSquaredDistance Minimum squared distance. - * @param {Array.<number>=} opt_tmpPoint Temporary point object. - * @return {number} Minimum squared distance. - */ -ol.geom.flat.closest.getsClosestPoint = function(flatCoordinates, offset, ends, - stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, - opt_tmpPoint) { - var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - minSquaredDistance = ol.geom.flat.closest.getClosestPoint( - flatCoordinates, offset, end, stride, - maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint); - offset = end; - } - return minSquaredDistance; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @param {number} maxDelta Max delta. - * @param {boolean} isRing Is ring. - * @param {number} x X. - * @param {number} y Y. - * @param {Array.<number>} closestPoint Closest point. - * @param {number} minSquaredDistance Minimum squared distance. - * @param {Array.<number>=} opt_tmpPoint Temporary point object. - * @return {number} Minimum squared distance. - */ -ol.geom.flat.closest.getssClosestPoint = function(flatCoordinates, offset, - endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, - opt_tmpPoint) { - var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - minSquaredDistance = ol.geom.flat.closest.getsClosestPoint( - flatCoordinates, offset, ends, stride, - maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint); - offset = ends[ends.length - 1]; - } - return minSquaredDistance; -}; - -goog.provide('ol.geom.flat.deflate'); - -goog.require('goog.asserts'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} stride Stride. - * @return {number} offset Offset. - */ -ol.geom.flat.deflate.coordinate = - function(flatCoordinates, offset, coordinate, stride) { - goog.asserts.assert(coordinate.length == stride, - 'length of the coordinate array should match stride'); - var i, ii; - for (i = 0, ii = coordinate.length; i < ii; ++i) { - flatCoordinates[offset++] = coordinate[i]; - } - return offset; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @param {number} stride Stride. - * @return {number} offset Offset. - */ -ol.geom.flat.deflate.coordinates = - function(flatCoordinates, offset, coordinates, stride) { - var i, ii; - for (i = 0, ii = coordinates.length; i < ii; ++i) { - var coordinate = coordinates[i]; - goog.asserts.assert(coordinate.length == stride, - 'length of coordinate array should match stride'); - var j; - for (j = 0; j < stride; ++j) { - flatCoordinates[offset++] = coordinate[j]; - } - } - return offset; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<ol.Coordinate>>} coordinatess Coordinatess. - * @param {number} stride Stride. - * @param {Array.<number>=} opt_ends Ends. - * @return {Array.<number>} Ends. - */ -ol.geom.flat.deflate.coordinatess = - function(flatCoordinates, offset, coordinatess, stride, opt_ends) { - var ends = opt_ends ? opt_ends : []; - var i = 0; - var j, jj; - for (j = 0, jj = coordinatess.length; j < jj; ++j) { - var end = ol.geom.flat.deflate.coordinates( - flatCoordinates, offset, coordinatess[j], stride); - ends[i++] = end; - offset = end; - } - ends.length = i; - return ends; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<Array.<ol.Coordinate>>>} coordinatesss Coordinatesss. - * @param {number} stride Stride. - * @param {Array.<Array.<number>>=} opt_endss Endss. - * @return {Array.<Array.<number>>} Endss. - */ -ol.geom.flat.deflate.coordinatesss = - function(flatCoordinates, offset, coordinatesss, stride, opt_endss) { - var endss = opt_endss ? opt_endss : []; - var i = 0; - var j, jj; - for (j = 0, jj = coordinatesss.length; j < jj; ++j) { - var ends = ol.geom.flat.deflate.coordinatess( - flatCoordinates, offset, coordinatesss[j], stride, endss[i]); - endss[i++] = ends; - offset = ends[ends.length - 1]; - } - endss.length = i; - return endss; -}; - -goog.provide('ol.geom.flat.inflate'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {Array.<ol.Coordinate>=} opt_coordinates Coordinates. - * @return {Array.<ol.Coordinate>} Coordinates. - */ -ol.geom.flat.inflate.coordinates = - function(flatCoordinates, offset, end, stride, opt_coordinates) { - var coordinates = opt_coordinates !== undefined ? opt_coordinates : []; - var i = 0; - var j; - for (j = offset; j < end; j += stride) { - coordinates[i++] = flatCoordinates.slice(j, j + stride); - } - coordinates.length = i; - return coordinates; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {Array.<Array.<ol.Coordinate>>=} opt_coordinatess Coordinatess. - * @return {Array.<Array.<ol.Coordinate>>} Coordinatess. - */ -ol.geom.flat.inflate.coordinatess = - function(flatCoordinates, offset, ends, stride, opt_coordinatess) { - var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : []; - var i = 0; - var j, jj; - for (j = 0, jj = ends.length; j < jj; ++j) { - var end = ends[j]; - coordinatess[i++] = ol.geom.flat.inflate.coordinates( - flatCoordinates, offset, end, stride, coordinatess[i]); - offset = end; - } - coordinatess.length = i; - return coordinatess; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @param {Array.<Array.<Array.<ol.Coordinate>>>=} opt_coordinatesss - * Coordinatesss. - * @return {Array.<Array.<Array.<ol.Coordinate>>>} Coordinatesss. - */ -ol.geom.flat.inflate.coordinatesss = - function(flatCoordinates, offset, endss, stride, opt_coordinatesss) { - var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : []; - var i = 0; - var j, jj; - for (j = 0, jj = endss.length; j < jj; ++j) { - var ends = endss[j]; - coordinatesss[i++] = ol.geom.flat.inflate.coordinatess( - flatCoordinates, offset, ends, stride, coordinatesss[i]); - offset = ends[ends.length - 1]; - } - coordinatesss.length = i; - return coordinatesss; -}; - -// Based on simplify-js https://github.com/mourner/simplify-js -// Copyright (c) 2012, Vladimir Agafonkin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -goog.provide('ol.geom.flat.simplify'); - -goog.require('ol.math'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} squaredTolerance Squared tolerance. - * @param {boolean} highQuality Highest quality. - * @param {Array.<number>=} opt_simplifiedFlatCoordinates Simplified flat - * coordinates. - * @return {Array.<number>} Simplified line string. - */ -ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end, - stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) { - var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ? - opt_simplifiedFlatCoordinates : []; - if (!highQuality) { - end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end, - stride, squaredTolerance, - simplifiedFlatCoordinates, 0); - flatCoordinates = simplifiedFlatCoordinates; - offset = 0; - stride = 2; - } - simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeucker( - flatCoordinates, offset, end, stride, squaredTolerance, - simplifiedFlatCoordinates, 0); - return simplifiedFlatCoordinates; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} squaredTolerance Squared tolerance. - * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat - * coordinates. - * @param {number} simplifiedOffset Simplified offset. - * @return {number} Simplified offset. - */ -ol.geom.flat.simplify.douglasPeucker = function(flatCoordinates, offset, end, - stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) { - var n = (end - offset) / stride; - if (n < 3) { - for (; offset < end; offset += stride) { - simplifiedFlatCoordinates[simplifiedOffset++] = - flatCoordinates[offset]; - simplifiedFlatCoordinates[simplifiedOffset++] = - flatCoordinates[offset + 1]; - } - return simplifiedOffset; - } - /** @type {Array.<number>} */ - var markers = new Array(n); - markers[0] = 1; - markers[n - 1] = 1; - /** @type {Array.<number>} */ - var stack = [offset, end - stride]; - var index = 0; - var i; - while (stack.length > 0) { - var last = stack.pop(); - var first = stack.pop(); - var maxSquaredDistance = 0; - var x1 = flatCoordinates[first]; - var y1 = flatCoordinates[first + 1]; - var x2 = flatCoordinates[last]; - var y2 = flatCoordinates[last + 1]; - for (i = first + stride; i < last; i += stride) { - var x = flatCoordinates[i]; - var y = flatCoordinates[i + 1]; - var squaredDistance = ol.math.squaredSegmentDistance( - x, y, x1, y1, x2, y2); - if (squaredDistance > maxSquaredDistance) { - index = i; - maxSquaredDistance = squaredDistance; - } - } - if (maxSquaredDistance > squaredTolerance) { - markers[(index - offset) / stride] = 1; - if (first + stride < index) { - stack.push(first, index); - } - if (index + stride < last) { - stack.push(index, last); - } - } - } - for (i = 0; i < n; ++i) { - if (markers[i]) { - simplifiedFlatCoordinates[simplifiedOffset++] = - flatCoordinates[offset + i * stride]; - simplifiedFlatCoordinates[simplifiedOffset++] = - flatCoordinates[offset + i * stride + 1]; - } - } - return simplifiedOffset; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {number} squaredTolerance Squared tolerance. - * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat - * coordinates. - * @param {number} simplifiedOffset Simplified offset. - * @param {Array.<number>} simplifiedEnds Simplified ends. - * @return {number} Simplified offset. - */ -ol.geom.flat.simplify.douglasPeuckers = function(flatCoordinates, offset, - ends, stride, squaredTolerance, simplifiedFlatCoordinates, - simplifiedOffset, simplifiedEnds) { - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - simplifiedOffset = ol.geom.flat.simplify.douglasPeucker( - flatCoordinates, offset, end, stride, squaredTolerance, - simplifiedFlatCoordinates, simplifiedOffset); - simplifiedEnds.push(simplifiedOffset); - offset = end; - } - return simplifiedOffset; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @param {number} squaredTolerance Squared tolerance. - * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat - * coordinates. - * @param {number} simplifiedOffset Simplified offset. - * @param {Array.<Array.<number>>} simplifiedEndss Simplified endss. - * @return {number} Simplified offset. - */ -ol.geom.flat.simplify.douglasPeuckerss = function( - flatCoordinates, offset, endss, stride, squaredTolerance, - simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) { - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - var simplifiedEnds = []; - simplifiedOffset = ol.geom.flat.simplify.douglasPeuckers( - flatCoordinates, offset, ends, stride, squaredTolerance, - simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds); - simplifiedEndss.push(simplifiedEnds); - offset = ends[ends.length - 1]; - } - return simplifiedOffset; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} squaredTolerance Squared tolerance. - * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat - * coordinates. - * @param {number} simplifiedOffset Simplified offset. - * @return {number} Simplified offset. - */ -ol.geom.flat.simplify.radialDistance = function(flatCoordinates, offset, end, - stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) { - if (end <= offset + stride) { - // zero or one point, no simplification possible, so copy and return - for (; offset < end; offset += stride) { - simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset]; - simplifiedFlatCoordinates[simplifiedOffset++] = - flatCoordinates[offset + 1]; - } - return simplifiedOffset; - } - var x1 = flatCoordinates[offset]; - var y1 = flatCoordinates[offset + 1]; - // copy first point - simplifiedFlatCoordinates[simplifiedOffset++] = x1; - simplifiedFlatCoordinates[simplifiedOffset++] = y1; - var x2 = x1; - var y2 = y1; - for (offset += stride; offset < end; offset += stride) { - x2 = flatCoordinates[offset]; - y2 = flatCoordinates[offset + 1]; - if (ol.math.squaredDistance(x1, y1, x2, y2) > squaredTolerance) { - // copy point at offset - simplifiedFlatCoordinates[simplifiedOffset++] = x2; - simplifiedFlatCoordinates[simplifiedOffset++] = y2; - x1 = x2; - y1 = y2; - } - } - if (x2 != x1 || y2 != y1) { - // copy last point - simplifiedFlatCoordinates[simplifiedOffset++] = x2; - simplifiedFlatCoordinates[simplifiedOffset++] = y2; - } - return simplifiedOffset; -}; - - -/** - * @param {number} value Value. - * @param {number} tolerance Tolerance. - * @return {number} Rounded value. - */ -ol.geom.flat.simplify.snap = function(value, tolerance) { - return tolerance * Math.round(value / tolerance); -}; - - -/** - * Simplifies a line string using an algorithm designed by Tim Schaub. - * Coordinates are snapped to the nearest value in a virtual grid and - * consecutive duplicate coordinates are discarded. This effectively preserves - * topology as the simplification of any subsection of a line string is - * independent of the rest of the line string. This means that, for examples, - * the common edge between two polygons will be simplified to the same line - * string independently in both polygons. This implementation uses a single - * pass over the coordinates and eliminates intermediate collinear points. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} tolerance Tolerance. - * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat - * coordinates. - * @param {number} simplifiedOffset Simplified offset. - * @return {number} Simplified offset. - */ -ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride, - tolerance, simplifiedFlatCoordinates, simplifiedOffset) { - // do nothing if the line is empty - if (offset == end) { - return simplifiedOffset; - } - // snap the first coordinate (P1) - var x1 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance); - var y1 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance); - offset += stride; - // add the first coordinate to the output - simplifiedFlatCoordinates[simplifiedOffset++] = x1; - simplifiedFlatCoordinates[simplifiedOffset++] = y1; - // find the next coordinate that does not snap to the same value as the first - // coordinate (P2) - var x2, y2; - do { - x2 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance); - y2 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance); - offset += stride; - if (offset == end) { - // all coordinates snap to the same value, the line collapses to a point - // push the last snapped value anyway to ensure that the output contains - // at least two points - // FIXME should we really return at least two points anyway? - simplifiedFlatCoordinates[simplifiedOffset++] = x2; - simplifiedFlatCoordinates[simplifiedOffset++] = y2; - return simplifiedOffset; - } - } while (x2 == x1 && y2 == y1); - while (offset < end) { - var x3, y3; - // snap the next coordinate (P3) - x3 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance); - y3 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance); - offset += stride; - // skip P3 if it is equal to P2 - if (x3 == x2 && y3 == y2) { - continue; - } - // calculate the delta between P1 and P2 - var dx1 = x2 - x1; - var dy1 = y2 - y1; - // calculate the delta between P3 and P1 - var dx2 = x3 - x1; - var dy2 = y3 - y1; - // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from - // P1 in the same direction then P2 is on the straight line between P1 and - // P3 - if ((dx1 * dy2 == dy1 * dx2) && - ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) && - ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))) { - // discard P2 and set P2 = P3 - x2 = x3; - y2 = y3; - continue; - } - // either P1, P2, and P3 are not colinear, or they are colinear but P3 is - // between P3 and P1 or on the opposite half of the line to P2. add P2, - // and continue with P1 = P2 and P2 = P3 - simplifiedFlatCoordinates[simplifiedOffset++] = x2; - simplifiedFlatCoordinates[simplifiedOffset++] = y2; - x1 = x2; - y1 = y2; - x2 = x3; - y2 = y3; - } - // add the last point (P2) - simplifiedFlatCoordinates[simplifiedOffset++] = x2; - simplifiedFlatCoordinates[simplifiedOffset++] = y2; - return simplifiedOffset; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {number} tolerance Tolerance. - * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat - * coordinates. - * @param {number} simplifiedOffset Simplified offset. - * @param {Array.<number>} simplifiedEnds Simplified ends. - * @return {number} Simplified offset. - */ -ol.geom.flat.simplify.quantizes = function( - flatCoordinates, offset, ends, stride, - tolerance, - simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) { - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - simplifiedOffset = ol.geom.flat.simplify.quantize( - flatCoordinates, offset, end, stride, - tolerance, - simplifiedFlatCoordinates, simplifiedOffset); - simplifiedEnds.push(simplifiedOffset); - offset = end; - } - return simplifiedOffset; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @param {number} tolerance Tolerance. - * @param {Array.<number>} simplifiedFlatCoordinates Simplified flat - * coordinates. - * @param {number} simplifiedOffset Simplified offset. - * @param {Array.<Array.<number>>} simplifiedEndss Simplified endss. - * @return {number} Simplified offset. - */ -ol.geom.flat.simplify.quantizess = function( - flatCoordinates, offset, endss, stride, - tolerance, - simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) { - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - var simplifiedEnds = []; - simplifiedOffset = ol.geom.flat.simplify.quantizes( - flatCoordinates, offset, ends, stride, - tolerance, - simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds); - simplifiedEndss.push(simplifiedEnds); - offset = ends[ends.length - 1]; - } - return simplifiedOffset; -}; - -goog.provide('ol.geom.LinearRing'); - -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.area'); -goog.require('ol.geom.flat.closest'); -goog.require('ol.geom.flat.deflate'); -goog.require('ol.geom.flat.inflate'); -goog.require('ol.geom.flat.simplify'); - - - -/** - * @classdesc - * Linear ring geometry. Only used as part of polygon; cannot be rendered - * on its own. - * - * @constructor - * @extends {ol.geom.SimpleGeometry} - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.LinearRing = function(coordinates, opt_layout) { - - goog.base(this); - - /** - * @private - * @type {number} - */ - this.maxDelta_ = -1; - - /** - * @private - * @type {number} - */ - this.maxDeltaRevision_ = -1; - - this.setCoordinates(coordinates, opt_layout); - -}; -goog.inherits(ol.geom.LinearRing, ol.geom.SimpleGeometry); - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.LinearRing} Clone. - * @api stable - */ -ol.geom.LinearRing.prototype.clone = function() { - var linearRing = new ol.geom.LinearRing(null); - linearRing.setFlatCoordinates(this.layout, this.flatCoordinates.slice()); - return linearRing; -}; - - -/** - * @inheritDoc - */ -ol.geom.LinearRing.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - if (minSquaredDistance < - ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) { - return minSquaredDistance; - } - if (this.maxDeltaRevision_ != this.getRevision()) { - this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getMaxSquaredDelta( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0)); - this.maxDeltaRevision_ = this.getRevision(); - } - return ol.geom.flat.closest.getClosestPoint( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, - this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); -}; - - -/** - * Return the area of the linear ring on projected plane. - * @return {number} Area (on projected plane). - * @api stable - */ -ol.geom.LinearRing.prototype.getArea = function() { - return ol.geom.flat.area.linearRing( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); -}; - - -/** - * Return the coordinates of the linear ring. - * @return {Array.<ol.Coordinate>} Coordinates. - * @api stable - */ -ol.geom.LinearRing.prototype.getCoordinates = function() { - return ol.geom.flat.inflate.coordinates( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); -}; - - -/** - * @inheritDoc - */ -ol.geom.LinearRing.prototype.getSimplifiedGeometryInternal = - function(squaredTolerance) { - var simplifiedFlatCoordinates = []; - simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeucker( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, - squaredTolerance, simplifiedFlatCoordinates, 0); - var simplifiedLinearRing = new ol.geom.LinearRing(null); - simplifiedLinearRing.setFlatCoordinates( - ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates); - return simplifiedLinearRing; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.LinearRing.prototype.getType = function() { - return ol.geom.GeometryType.LINEAR_RING; -}; - - -/** - * Set the coordinates of the linear ring. - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.LinearRing.prototype.setCoordinates = - function(coordinates, opt_layout) { - if (!coordinates) { - this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null); - } else { - this.setLayout(opt_layout, coordinates, 1); - if (!this.flatCoordinates) { - this.flatCoordinates = []; - } - this.flatCoordinates.length = ol.geom.flat.deflate.coordinates( - this.flatCoordinates, 0, coordinates, this.stride); - this.changed(); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - */ -ol.geom.LinearRing.prototype.setFlatCoordinates = - function(layout, flatCoordinates) { - this.setFlatCoordinatesInternal(layout, flatCoordinates); - this.changed(); -}; - -goog.provide('ol.geom.Point'); - -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.deflate'); -goog.require('ol.math'); - - - -/** - * @classdesc - * Point geometry. - * - * @constructor - * @extends {ol.geom.SimpleGeometry} - * @param {ol.Coordinate} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.Point = function(coordinates, opt_layout) { - goog.base(this); - this.setCoordinates(coordinates, opt_layout); -}; -goog.inherits(ol.geom.Point, ol.geom.SimpleGeometry); - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.Point} Clone. - * @api stable - */ -ol.geom.Point.prototype.clone = function() { - var point = new ol.geom.Point(null); - point.setFlatCoordinates(this.layout, this.flatCoordinates.slice()); - return point; -}; - - -/** - * @inheritDoc - */ -ol.geom.Point.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - var flatCoordinates = this.flatCoordinates; - var squaredDistance = ol.math.squaredDistance( - x, y, flatCoordinates[0], flatCoordinates[1]); - if (squaredDistance < minSquaredDistance) { - var stride = this.stride; - var i; - for (i = 0; i < stride; ++i) { - closestPoint[i] = flatCoordinates[i]; - } - closestPoint.length = stride; - return squaredDistance; - } else { - return minSquaredDistance; - } -}; - - -/** - * Return the coordinate of the point. - * @return {ol.Coordinate} Coordinates. - * @api stable - */ -ol.geom.Point.prototype.getCoordinates = function() { - return !this.flatCoordinates ? [] : this.flatCoordinates.slice(); -}; - - -/** - * @inheritDoc - */ -ol.geom.Point.prototype.computeExtent = function(extent) { - return ol.extent.createOrUpdateFromCoordinate(this.flatCoordinates, extent); -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.Point.prototype.getType = function() { - return ol.geom.GeometryType.POINT; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.Point.prototype.intersectsExtent = function(extent) { - return ol.extent.containsXY(extent, - this.flatCoordinates[0], this.flatCoordinates[1]); -}; - - -/** - * Set the coordinate of the point. - * @param {ol.Coordinate} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.Point.prototype.setCoordinates = function(coordinates, opt_layout) { - if (!coordinates) { - this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null); - } else { - this.setLayout(opt_layout, coordinates, 0); - if (!this.flatCoordinates) { - this.flatCoordinates = []; - } - this.flatCoordinates.length = ol.geom.flat.deflate.coordinate( - this.flatCoordinates, 0, coordinates, this.stride); - this.changed(); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - */ -ol.geom.Point.prototype.setFlatCoordinates = function(layout, flatCoordinates) { - this.setFlatCoordinatesInternal(layout, flatCoordinates); - this.changed(); -}; - -goog.provide('ol.geom.flat.contains'); - -goog.require('goog.asserts'); -goog.require('ol.extent'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. - * @return {boolean} Contains extent. - */ -ol.geom.flat.contains.linearRingContainsExtent = - function(flatCoordinates, offset, end, stride, extent) { - var outside = ol.extent.forEachCorner(extent, - /** - * @param {ol.Coordinate} coordinate Coordinate. - */ - function(coordinate) { - return !ol.geom.flat.contains.linearRingContainsXY(flatCoordinates, - offset, end, stride, coordinate[0], coordinate[1]); - }); - return !outside; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} x X. - * @param {number} y Y. - * @return {boolean} Contains (x, y). - */ -ol.geom.flat.contains.linearRingContainsXY = - function(flatCoordinates, offset, end, stride, x, y) { - // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html - var contains = false; - var x1 = flatCoordinates[end - stride]; - var y1 = flatCoordinates[end - stride + 1]; - for (; offset < end; offset += stride) { - var x2 = flatCoordinates[offset]; - var y2 = flatCoordinates[offset + 1]; - var intersect = ((y1 > y) != (y2 > y)) && - (x < (x2 - x1) * (y - y1) / (y2 - y1) + x1); - if (intersect) { - contains = !contains; - } - x1 = x2; - y1 = y2; - } - return contains; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {number} x X. - * @param {number} y Y. - * @return {boolean} Contains (x, y). - */ -ol.geom.flat.contains.linearRingsContainsXY = - function(flatCoordinates, offset, ends, stride, x, y) { - goog.asserts.assert(ends.length > 0, 'ends should not be an empty array'); - if (ends.length === 0) { - return false; - } - if (!ol.geom.flat.contains.linearRingContainsXY( - flatCoordinates, offset, ends[0], stride, x, y)) { - return false; - } - var i, ii; - for (i = 1, ii = ends.length; i < ii; ++i) { - if (ol.geom.flat.contains.linearRingContainsXY( - flatCoordinates, ends[i - 1], ends[i], stride, x, y)) { - return false; - } - } - return true; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @param {number} x X. - * @param {number} y Y. - * @return {boolean} Contains (x, y). - */ -ol.geom.flat.contains.linearRingssContainsXY = - function(flatCoordinates, offset, endss, stride, x, y) { - goog.asserts.assert(endss.length > 0, 'endss should not be an empty array'); - if (endss.length === 0) { - return false; - } - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - if (ol.geom.flat.contains.linearRingsContainsXY( - flatCoordinates, offset, ends, stride, x, y)) { - return true; - } - offset = ends[ends.length - 1]; - } - return false; -}; - -goog.provide('ol.geom.flat.interiorpoint'); - -goog.require('goog.asserts'); -goog.require('ol.geom.flat.contains'); - - -/** - * Calculates a point that is likely to lie in the interior of the linear rings. - * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {Array.<number>} flatCenters Flat centers. - * @param {number} flatCentersOffset Flat center offset. - * @param {Array.<number>=} opt_dest Destination. - * @return {Array.<number>} Destination. - */ -ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset, - ends, stride, flatCenters, flatCentersOffset, opt_dest) { - var i, ii, x, x1, x2, y1, y2; - var y = flatCenters[flatCentersOffset + 1]; - /** @type {Array.<number>} */ - var intersections = []; - // Calculate intersections with the horizontal line - var end = ends[0]; - x1 = flatCoordinates[end - stride]; - y1 = flatCoordinates[end - stride + 1]; - for (i = offset; i < end; i += stride) { - x2 = flatCoordinates[i]; - y2 = flatCoordinates[i + 1]; - if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) { - x = (y - y1) / (y2 - y1) * (x2 - x1) + x1; - intersections.push(x); - } - x1 = x2; - y1 = y2; - } - // Find the longest segment of the horizontal line that has its center point - // inside the linear ring. - var pointX = NaN; - var maxSegmentLength = -Infinity; - intersections.sort(); - x1 = intersections[0]; - for (i = 1, ii = intersections.length; i < ii; ++i) { - x2 = intersections[i]; - var segmentLength = Math.abs(x2 - x1); - if (segmentLength > maxSegmentLength) { - x = (x1 + x2) / 2; - if (ol.geom.flat.contains.linearRingsContainsXY( - flatCoordinates, offset, ends, stride, x, y)) { - pointX = x; - maxSegmentLength = segmentLength; - } - } - x1 = x2; - } - if (isNaN(pointX)) { - // There is no horizontal line that has its center point inside the linear - // ring. Use the center of the the linear ring's extent. - pointX = flatCenters[flatCentersOffset]; - } - if (opt_dest) { - opt_dest.push(pointX, y); - return opt_dest; - } else { - return [pointX, y]; - } -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @param {Array.<number>} flatCenters Flat centers. - * @return {Array.<number>} Interior points. - */ -ol.geom.flat.interiorpoint.linearRingss = - function(flatCoordinates, offset, endss, stride, flatCenters) { - goog.asserts.assert(2 * endss.length == flatCenters.length, - 'endss.length times 2 should be flatCenters.length'); - var interiorPoints = []; - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - interiorPoints = ol.geom.flat.interiorpoint.linearRings(flatCoordinates, - offset, ends, stride, flatCenters, 2 * i, interiorPoints); - offset = ends[ends.length - 1]; - } - return interiorPoints; -}; - -goog.provide('ol.geom.flat.segments'); - - -/** - * This function calls `callback` for each segment of the flat coordinates - * array. If the callback returns a truthy value the function returns that - * value immediately. Otherwise the function returns `false`. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {function(this: S, ol.Coordinate, ol.Coordinate): T} callback Function - * called for each segment. - * @param {S=} opt_this The object to be used as the value of 'this' - * within callback. - * @return {T|boolean} Value. - * @template T,S - */ -ol.geom.flat.segments.forEach = - function(flatCoordinates, offset, end, stride, callback, opt_this) { - var point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]]; - var point2 = []; - var ret; - for (; (offset + stride) < end; offset += stride) { - point2[0] = flatCoordinates[offset + stride]; - point2[1] = flatCoordinates[offset + stride + 1]; - ret = callback.call(opt_this, point1, point2); - if (ret) { - return ret; - } - point1[0] = point2[0]; - point1[1] = point2[1]; - } - return false; -}; - -goog.provide('ol.geom.flat.intersectsextent'); - -goog.require('goog.asserts'); -goog.require('ol.extent'); -goog.require('ol.geom.flat.contains'); -goog.require('ol.geom.flat.segments'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. - * @return {boolean} True if the geometry and the extent intersect. - */ -ol.geom.flat.intersectsextent.lineString = - function(flatCoordinates, offset, end, stride, extent) { - var coordinatesExtent = ol.extent.extendFlatCoordinates( - ol.extent.createEmpty(), flatCoordinates, offset, end, stride); - if (!ol.extent.intersects(extent, coordinatesExtent)) { - return false; - } - if (ol.extent.containsExtent(extent, coordinatesExtent)) { - return true; - } - if (coordinatesExtent[0] >= extent[0] && - coordinatesExtent[2] <= extent[2]) { - return true; - } - if (coordinatesExtent[1] >= extent[1] && - coordinatesExtent[3] <= extent[3]) { - return true; - } - return ol.geom.flat.segments.forEach(flatCoordinates, offset, end, stride, - /** - * @param {ol.Coordinate} point1 Start point. - * @param {ol.Coordinate} point2 End point. - * @return {boolean} `true` if the segment and the extent intersect, - * `false` otherwise. - */ - function(point1, point2) { - return ol.extent.intersectsSegment(extent, point1, point2); - }); -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. - * @return {boolean} True if the geometry and the extent intersect. - */ -ol.geom.flat.intersectsextent.lineStrings = - function(flatCoordinates, offset, ends, stride, extent) { - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - if (ol.geom.flat.intersectsextent.lineString( - flatCoordinates, offset, ends[i], stride, extent)) { - return true; - } - offset = ends[i]; - } - return false; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. - * @return {boolean} True if the geometry and the extent intersect. - */ -ol.geom.flat.intersectsextent.linearRing = - function(flatCoordinates, offset, end, stride, extent) { - if (ol.geom.flat.intersectsextent.lineString( - flatCoordinates, offset, end, stride, extent)) { - return true; - } - if (ol.geom.flat.contains.linearRingContainsXY( - flatCoordinates, offset, end, stride, extent[0], extent[1])) { - return true; - } - if (ol.geom.flat.contains.linearRingContainsXY( - flatCoordinates, offset, end, stride, extent[0], extent[3])) { - return true; - } - if (ol.geom.flat.contains.linearRingContainsXY( - flatCoordinates, offset, end, stride, extent[2], extent[1])) { - return true; - } - if (ol.geom.flat.contains.linearRingContainsXY( - flatCoordinates, offset, end, stride, extent[2], extent[3])) { - return true; - } - return false; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. - * @return {boolean} True if the geometry and the extent intersect. - */ -ol.geom.flat.intersectsextent.linearRings = - function(flatCoordinates, offset, ends, stride, extent) { - goog.asserts.assert(ends.length > 0, 'ends should not be an empty array'); - if (!ol.geom.flat.intersectsextent.linearRing( - flatCoordinates, offset, ends[0], stride, extent)) { - return false; - } - if (ends.length === 1) { - return true; - } - var i, ii; - for (i = 1, ii = ends.length; i < ii; ++i) { - if (ol.geom.flat.contains.linearRingContainsExtent( - flatCoordinates, ends[i - 1], ends[i], stride, extent)) { - return false; - } - } - return true; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. - * @return {boolean} True if the geometry and the extent intersect. - */ -ol.geom.flat.intersectsextent.linearRingss = - function(flatCoordinates, offset, endss, stride, extent) { - goog.asserts.assert(endss.length > 0, 'endss should not be an empty array'); - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - if (ol.geom.flat.intersectsextent.linearRings( - flatCoordinates, offset, ends, stride, extent)) { - return true; - } - offset = ends[ends.length - 1]; - } - return false; -}; - -goog.provide('ol.geom.flat.reverse'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - */ -ol.geom.flat.reverse.coordinates = - function(flatCoordinates, offset, end, stride) { - while (offset < end - stride) { - var i; - for (i = 0; i < stride; ++i) { - var tmp = flatCoordinates[offset + i]; - flatCoordinates[offset + i] = flatCoordinates[end - stride + i]; - flatCoordinates[end - stride + i] = tmp; - } - offset += stride; - end -= stride; - } -}; - -goog.provide('ol.geom.flat.orient'); - -goog.require('ol'); -goog.require('ol.geom.flat.reverse'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @return {boolean} Is clockwise. - */ -ol.geom.flat.orient.linearRingIsClockwise = - function(flatCoordinates, offset, end, stride) { - // http://tinyurl.com/clockwise-method - // https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrlinearring.cpp - var edge = 0; - var x1 = flatCoordinates[end - stride]; - var y1 = flatCoordinates[end - stride + 1]; - for (; offset < end; offset += stride) { - var x2 = flatCoordinates[offset]; - var y2 = flatCoordinates[offset + 1]; - edge += (x2 - x1) * (y2 + y1); - x1 = x2; - y1 = y2; - } - return edge > 0; -}; - - -/** - * Determines if linear rings are oriented. By default, left-hand orientation - * is tested (first ring must be clockwise, remaining rings counter-clockwise). - * To test for right-hand orientation, use the `opt_right` argument. - * - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Array of end indexes. - * @param {number} stride Stride. - * @param {boolean=} opt_right Test for right-hand orientation - * (counter-clockwise exterior ring and clockwise interior rings). - * @return {boolean} Rings are correctly oriented. - */ -ol.geom.flat.orient.linearRingsAreOriented = - function(flatCoordinates, offset, ends, stride, opt_right) { - var right = opt_right !== undefined ? opt_right : false; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - var isClockwise = ol.geom.flat.orient.linearRingIsClockwise( - flatCoordinates, offset, end, stride); - if (i === 0) { - if ((right && isClockwise) || (!right && !isClockwise)) { - return false; - } - } else { - if ((right && !isClockwise) || (!right && isClockwise)) { - return false; - } - } - offset = end; - } - return true; -}; - - -/** - * Determines if linear rings are oriented. By default, left-hand orientation - * is tested (first ring must be clockwise, remaining rings counter-clockwise). - * To test for right-hand orientation, use the `opt_right` argument. - * - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Array of array of end indexes. - * @param {number} stride Stride. - * @param {boolean=} opt_right Test for right-hand orientation - * (counter-clockwise exterior ring and clockwise interior rings). - * @return {boolean} Rings are correctly oriented. - */ -ol.geom.flat.orient.linearRingssAreOriented = - function(flatCoordinates, offset, endss, stride, opt_right) { - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - if (!ol.geom.flat.orient.linearRingsAreOriented( - flatCoordinates, offset, endss[i], stride, opt_right)) { - return false; - } - } - return true; -}; - - -/** - * Orient coordinates in a flat array of linear rings. By default, rings - * are oriented following the left-hand rule (clockwise for exterior and - * counter-clockwise for interior rings). To orient according to the - * right-hand rule, use the `opt_right` argument. - * - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {boolean=} opt_right Follow the right-hand rule for orientation. - * @return {number} End. - */ -ol.geom.flat.orient.orientLinearRings = - function(flatCoordinates, offset, ends, stride, opt_right) { - var right = opt_right !== undefined ? opt_right : false; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - var isClockwise = ol.geom.flat.orient.linearRingIsClockwise( - flatCoordinates, offset, end, stride); - var reverse = i === 0 ? - (right && isClockwise) || (!right && !isClockwise) : - (right && !isClockwise) || (!right && isClockwise); - if (reverse) { - ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride); - } - offset = end; - } - return offset; -}; - - -/** - * Orient coordinates in a flat array of linear rings. By default, rings - * are oriented following the left-hand rule (clockwise for exterior and - * counter-clockwise for interior rings). To orient according to the - * right-hand rule, use the `opt_right` argument. - * - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Array of array of end indexes. - * @param {number} stride Stride. - * @param {boolean=} opt_right Follow the right-hand rule for orientation. - * @return {number} End. - */ -ol.geom.flat.orient.orientLinearRingss = - function(flatCoordinates, offset, endss, stride, opt_right) { - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - offset = ol.geom.flat.orient.orientLinearRings( - flatCoordinates, offset, endss[i], stride, opt_right); - } - return offset; -}; - -goog.provide('ol.geom.Polygon'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.math'); -goog.require('ol'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LinearRing'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.area'); -goog.require('ol.geom.flat.closest'); -goog.require('ol.geom.flat.contains'); -goog.require('ol.geom.flat.deflate'); -goog.require('ol.geom.flat.inflate'); -goog.require('ol.geom.flat.interiorpoint'); -goog.require('ol.geom.flat.intersectsextent'); -goog.require('ol.geom.flat.orient'); -goog.require('ol.geom.flat.simplify'); - - - -/** - * @classdesc - * Polygon geometry. - * - * @constructor - * @extends {ol.geom.SimpleGeometry} - * @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.Polygon = function(coordinates, opt_layout) { - - goog.base(this); - - /** - * @type {Array.<number>} - * @private - */ - this.ends_ = []; - - /** - * @private - * @type {number} - */ - this.flatInteriorPointRevision_ = -1; - - /** - * @private - * @type {ol.Coordinate} - */ - this.flatInteriorPoint_ = null; - - /** - * @private - * @type {number} - */ - this.maxDelta_ = -1; - - /** - * @private - * @type {number} - */ - this.maxDeltaRevision_ = -1; - - /** - * @private - * @type {number} - */ - this.orientedRevision_ = -1; - - /** - * @private - * @type {Array.<number>} - */ - this.orientedFlatCoordinates_ = null; - - this.setCoordinates(coordinates, opt_layout); - -}; -goog.inherits(ol.geom.Polygon, ol.geom.SimpleGeometry); - - -/** - * Append the passed linear ring to this polygon. - * @param {ol.geom.LinearRing} linearRing Linear ring. - * @api stable - */ -ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) { - goog.asserts.assert(linearRing.getLayout() == this.layout, - 'layout of linearRing should match layout'); - if (!this.flatCoordinates) { - this.flatCoordinates = linearRing.getFlatCoordinates().slice(); - } else { - goog.array.extend(this.flatCoordinates, linearRing.getFlatCoordinates()); - } - this.ends_.push(this.flatCoordinates.length); - this.changed(); -}; - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.Polygon} Clone. - * @api stable - */ -ol.geom.Polygon.prototype.clone = function() { - var polygon = new ol.geom.Polygon(null); - polygon.setFlatCoordinates( - this.layout, this.flatCoordinates.slice(), this.ends_.slice()); - return polygon; -}; - - -/** - * @inheritDoc - */ -ol.geom.Polygon.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - if (minSquaredDistance < - ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) { - return minSquaredDistance; - } - if (this.maxDeltaRevision_ != this.getRevision()) { - this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getsMaxSquaredDelta( - this.flatCoordinates, 0, this.ends_, this.stride, 0)); - this.maxDeltaRevision_ = this.getRevision(); - } - return ol.geom.flat.closest.getsClosestPoint( - this.flatCoordinates, 0, this.ends_, this.stride, - this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); -}; - - -/** - * @inheritDoc - */ -ol.geom.Polygon.prototype.containsXY = function(x, y) { - return ol.geom.flat.contains.linearRingsContainsXY( - this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y); -}; - - -/** - * Return the area of the polygon on projected plane. - * @return {number} Area (on projected plane). - * @api stable - */ -ol.geom.Polygon.prototype.getArea = function() { - return ol.geom.flat.area.linearRings( - this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride); -}; - - -/** - * Get the coordinate array for this geometry. This array has the structure - * of a GeoJSON coordinate array for polygons. - * - * @param {boolean=} opt_right Orient coordinates according to the right-hand - * rule (counter-clockwise for exterior and clockwise for interior rings). - * If `false`, coordinates will be oriented according to the left-hand rule - * (clockwise for exterior and counter-clockwise for interior rings). - * By default, coordinate orientation will depend on how the geometry was - * constructed. - * @return {Array.<Array.<ol.Coordinate>>} Coordinates. - * @api stable - */ -ol.geom.Polygon.prototype.getCoordinates = function(opt_right) { - var flatCoordinates; - if (opt_right !== undefined) { - flatCoordinates = this.getOrientedFlatCoordinates().slice(); - ol.geom.flat.orient.orientLinearRings( - flatCoordinates, 0, this.ends_, this.stride, opt_right); - } else { - flatCoordinates = this.flatCoordinates; - } - - return ol.geom.flat.inflate.coordinatess( - flatCoordinates, 0, this.ends_, this.stride); -}; - - -/** - * @return {Array.<number>} Ends. - */ -ol.geom.Polygon.prototype.getEnds = function() { - return this.ends_; -}; - - -/** - * @return {Array.<number>} Interior point. - */ -ol.geom.Polygon.prototype.getFlatInteriorPoint = function() { - if (this.flatInteriorPointRevision_ != this.getRevision()) { - var flatCenter = ol.extent.getCenter(this.getExtent()); - this.flatInteriorPoint_ = ol.geom.flat.interiorpoint.linearRings( - this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, - flatCenter, 0); - this.flatInteriorPointRevision_ = this.getRevision(); - } - return this.flatInteriorPoint_; -}; - - -/** - * Return an interior point of the polygon. - * @return {ol.geom.Point} Interior point. - * @api stable - */ -ol.geom.Polygon.prototype.getInteriorPoint = function() { - return new ol.geom.Point(this.getFlatInteriorPoint()); -}; - - -/** - * Return the number of rings of the polygon, this includes the exterior - * ring and any interior rings. - * - * @return {number} Number of rings. - * @api - */ -ol.geom.Polygon.prototype.getLinearRingCount = function() { - return this.ends_.length; -}; - - -/** - * Return the Nth linear ring of the polygon geometry. Return `null` if the - * given index is out of range. - * The exterior linear ring is available at index `0` and the interior rings - * at index `1` and beyond. - * - * @param {number} index Index. - * @return {ol.geom.LinearRing} Linear ring. - * @api stable - */ -ol.geom.Polygon.prototype.getLinearRing = function(index) { - goog.asserts.assert(0 <= index && index < this.ends_.length, - 'index should be in between 0 and and length of this.ends_'); - if (index < 0 || this.ends_.length <= index) { - return null; - } - var linearRing = new ol.geom.LinearRing(null); - linearRing.setFlatCoordinates(this.layout, this.flatCoordinates.slice( - index === 0 ? 0 : this.ends_[index - 1], this.ends_[index])); - return linearRing; -}; - - -/** - * Return the linear rings of the polygon. - * @return {Array.<ol.geom.LinearRing>} Linear rings. - * @api stable - */ -ol.geom.Polygon.prototype.getLinearRings = function() { - var layout = this.layout; - var flatCoordinates = this.flatCoordinates; - var ends = this.ends_; - var linearRings = []; - var offset = 0; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - var linearRing = new ol.geom.LinearRing(null); - linearRing.setFlatCoordinates(layout, flatCoordinates.slice(offset, end)); - linearRings.push(linearRing); - offset = end; - } - return linearRings; -}; - - -/** - * @return {Array.<number>} Oriented flat coordinates. - */ -ol.geom.Polygon.prototype.getOrientedFlatCoordinates = function() { - if (this.orientedRevision_ != this.getRevision()) { - var flatCoordinates = this.flatCoordinates; - if (ol.geom.flat.orient.linearRingsAreOriented( - flatCoordinates, 0, this.ends_, this.stride)) { - this.orientedFlatCoordinates_ = flatCoordinates; - } else { - this.orientedFlatCoordinates_ = flatCoordinates.slice(); - this.orientedFlatCoordinates_.length = - ol.geom.flat.orient.orientLinearRings( - this.orientedFlatCoordinates_, 0, this.ends_, this.stride); - } - this.orientedRevision_ = this.getRevision(); - } - return this.orientedFlatCoordinates_; -}; - - -/** - * @inheritDoc - */ -ol.geom.Polygon.prototype.getSimplifiedGeometryInternal = - function(squaredTolerance) { - var simplifiedFlatCoordinates = []; - var simplifiedEnds = []; - simplifiedFlatCoordinates.length = ol.geom.flat.simplify.quantizes( - this.flatCoordinates, 0, this.ends_, this.stride, - Math.sqrt(squaredTolerance), - simplifiedFlatCoordinates, 0, simplifiedEnds); - var simplifiedPolygon = new ol.geom.Polygon(null); - simplifiedPolygon.setFlatCoordinates( - ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates, simplifiedEnds); - return simplifiedPolygon; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.Polygon.prototype.getType = function() { - return ol.geom.GeometryType.POLYGON; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.Polygon.prototype.intersectsExtent = function(extent) { - return ol.geom.flat.intersectsextent.linearRings( - this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent); -}; - - -/** - * Set the coordinates of the polygon. - * @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) { - if (!coordinates) { - this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.ends_); - } else { - this.setLayout(opt_layout, coordinates, 2); - if (!this.flatCoordinates) { - this.flatCoordinates = []; - } - var ends = ol.geom.flat.deflate.coordinatess( - this.flatCoordinates, 0, coordinates, this.stride, this.ends_); - this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1]; - this.changed(); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {Array.<number>} ends Ends. - */ -ol.geom.Polygon.prototype.setFlatCoordinates = - function(layout, flatCoordinates, ends) { - if (!flatCoordinates) { - goog.asserts.assert(ends && ends.length === 0, - 'ends must be an empty array'); - } else if (ends.length === 0) { - goog.asserts.assert(flatCoordinates.length === 0, - 'flatCoordinates should be an empty array'); - } else { - goog.asserts.assert(flatCoordinates.length == ends[ends.length - 1], - 'the length of flatCoordinates should be the last entry of ends'); - } - this.setFlatCoordinatesInternal(layout, flatCoordinates); - this.ends_ = ends; - this.changed(); -}; - - -/** - * Create an approximation of a circle on the surface of a sphere. - * @param {ol.Sphere} sphere The sphere. - * @param {ol.Coordinate} center Center (`[lon, lat]` in degrees). - * @param {number} radius The great-circle distance from the center to - * the polygon vertices. - * @param {number=} opt_n Optional number of vertices for the resulting - * polygon. Default is `32`. - * @return {ol.geom.Polygon} The "circular" polygon. - * @api stable - */ -ol.geom.Polygon.circular = function(sphere, center, radius, opt_n) { - var n = opt_n ? opt_n : 32; - /** @type {Array.<number>} */ - var flatCoordinates = []; - var i; - for (i = 0; i < n; ++i) { - goog.array.extend( - flatCoordinates, sphere.offset(center, radius, 2 * Math.PI * i / n)); - } - flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]); - var polygon = new ol.geom.Polygon(null); - polygon.setFlatCoordinates( - ol.geom.GeometryLayout.XY, flatCoordinates, [flatCoordinates.length]); - return polygon; -}; - - -/** - * Create a polygon from an extent. The layout used is `XY`. - * @param {ol.Extent} extent The extent. - * @return {ol.geom.Polygon} The polygon. - * @api - */ -ol.geom.Polygon.fromExtent = function(extent) { - var minX = extent[0]; - var minY = extent[1]; - var maxX = extent[2]; - var maxY = extent[3]; - var flatCoordinates = - [minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY]; - var polygon = new ol.geom.Polygon(null); - polygon.setFlatCoordinates( - ol.geom.GeometryLayout.XY, flatCoordinates, [flatCoordinates.length]); - return polygon; -}; - - -/** - * Create a regular polygon from a circle. - * @param {ol.geom.Circle} circle Circle geometry. - * @param {number=} opt_sides Number of sides of the polygon. Default is 32. - * @param {number=} opt_angle Start angle for the first vertex of the polygon in - * radians. Default is 0. - * @return {ol.geom.Polygon} Polygon geometry. - * @api - */ -ol.geom.Polygon.fromCircle = function(circle, opt_sides, opt_angle) { - var sides = opt_sides ? opt_sides : 32; - var stride = circle.getStride(); - var layout = circle.getLayout(); - var polygon = new ol.geom.Polygon(null, layout); - var flatCoordinates = goog.array.repeat(0, stride * (sides + 1)); - var ends = [flatCoordinates.length]; - polygon.setFlatCoordinates(layout, flatCoordinates, ends); - ol.geom.Polygon.makeRegular( - polygon, circle.getCenter(), circle.getRadius(), opt_angle); - return polygon; -}; - - -/** - * Modify the coordinates of a polygon to make it a regular polygon. - * @param {ol.geom.Polygon} polygon Polygon geometry. - * @param {ol.Coordinate} center Center of the regular polygon. - * @param {number} radius Radius of the regular polygon. - * @param {number=} opt_angle Start angle for the first vertex of the polygon in - * radians. Default is 0. - */ -ol.geom.Polygon.makeRegular = function(polygon, center, radius, opt_angle) { - var flatCoordinates = polygon.getFlatCoordinates(); - var layout = polygon.getLayout(); - var stride = polygon.getStride(); - var ends = polygon.getEnds(); - goog.asserts.assert(ends.length === 1, 'only 1 ring is supported'); - var sides = flatCoordinates.length / stride - 1; - var startAngle = opt_angle ? opt_angle : 0; - var angle, offset; - for (var i = 0; i <= sides; ++i) { - offset = i * stride; - angle = startAngle + (goog.math.modulo(i, sides) * 2 * Math.PI / sides); - flatCoordinates[offset] = center[0] + (radius * Math.cos(angle)); - flatCoordinates[offset + 1] = center[1] + (radius * Math.sin(angle)); - } - polygon.setFlatCoordinates(layout, flatCoordinates, ends); -}; - -goog.provide('ol.View'); -goog.provide('ol.ViewHint'); -goog.provide('ol.ViewProperty'); - -goog.require('goog.asserts'); -goog.require('ol'); -goog.require('ol.CenterConstraint'); -goog.require('ol.Constraints'); -goog.require('ol.Object'); -goog.require('ol.ResolutionConstraint'); -goog.require('ol.RotationConstraint'); -goog.require('ol.RotationConstraintType'); -goog.require('ol.Size'); -goog.require('ol.coordinate'); -goog.require('ol.extent'); -goog.require('ol.geom.Polygon'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.proj'); -goog.require('ol.proj.METERS_PER_UNIT'); -goog.require('ol.proj.Projection'); -goog.require('ol.proj.Units'); - - -/** - * @enum {string} - */ -ol.ViewProperty = { - CENTER: 'center', - RESOLUTION: 'resolution', - ROTATION: 'rotation' -}; - - -/** - * @enum {number} - */ -ol.ViewHint = { - ANIMATING: 0, - INTERACTING: 1 -}; - - - -/** - * @classdesc - * An ol.View object represents a simple 2D view of the map. - * - * This is the object to act upon to change the center, resolution, - * and rotation of the map. - * - * ### The view states - * - * An `ol.View` is determined by three states: `center`, `resolution`, - * and `rotation`. Each state has a corresponding getter and setter, e.g. - * `getCenter` and `setCenter` for the `center` state. - * - * An `ol.View` has a `projection`. The projection determines the - * coordinate system of the center, and its units determine the units of the - * resolution (projection units per pixel). The default projection is - * Spherical Mercator (EPSG:3857). - * - * ### The constraints - * - * `setCenter`, `setResolution` and `setRotation` can be used to change the - * states of the view. Any value can be passed to the setters. And the value - * that is passed to a setter will effectively be the value set in the view, - * and returned by the corresponding getter. - * - * But an `ol.View` object also has a *resolution constraint*, a - * *rotation constraint* and a *center constraint*. - * - * As said above, no constraints are applied when the setters are used to set - * new states for the view. Applying constraints is done explicitly through - * the use of the `constrain*` functions (`constrainResolution` and - * `constrainRotation` and `constrainCenter`). - * - * The main users of the constraints are the interactions and the - * controls. For example, double-clicking on the map changes the view to - * the "next" resolution. And releasing the fingers after pinch-zooming - * snaps to the closest resolution (with an animation). - * - * The *resolution constraint* snaps to specific resolutions. It is - * determined by the following options: `resolutions`, `maxResolution`, - * `maxZoom`, and `zoomFactor`. If `resolutions` is set, the other three - * options are ignored. See documentation for each option for more - * information. - * - * The *rotation constraint* snaps to specific angles. It is determined - * by the following options: `enableRotation` and `constrainRotation`. - * By default the rotation value is snapped to zero when approaching the - * horizontal. - * - * The *center constraint* is determined by the `extent` option. By - * default the center is not constrained at all. - * - * @constructor - * @extends {ol.Object} - * @param {olx.ViewOptions=} opt_options View options. - * @api stable - */ -ol.View = function(opt_options) { - goog.base(this); - var options = opt_options || {}; - - /** - * @private - * @type {Array.<number>} - */ - this.hints_ = [0, 0]; - - /** - * @type {Object.<string, *>} - */ - var properties = {}; - properties[ol.ViewProperty.CENTER] = options.center !== undefined ? - options.center : null; - - /** - * @private - * @const - * @type {ol.proj.Projection} - */ - this.projection_ = ol.proj.createProjection(options.projection, 'EPSG:3857'); - - var resolutionConstraintInfo = ol.View.createResolutionConstraint_( - options); - - /** - * @private - * @type {number} - */ - this.maxResolution_ = resolutionConstraintInfo.maxResolution; - - /** - * @private - * @type {number} - */ - this.minResolution_ = resolutionConstraintInfo.minResolution; - - /** - * @private - * @type {number} - */ - this.minZoom_ = resolutionConstraintInfo.minZoom; - - var centerConstraint = ol.View.createCenterConstraint_(options); - var resolutionConstraint = resolutionConstraintInfo.constraint; - var rotationConstraint = ol.View.createRotationConstraint_(options); - - /** - * @private - * @type {ol.Constraints} - */ - this.constraints_ = new ol.Constraints( - centerConstraint, resolutionConstraint, rotationConstraint); - - if (options.resolution !== undefined) { - properties[ol.ViewProperty.RESOLUTION] = options.resolution; - } else if (options.zoom !== undefined) { - properties[ol.ViewProperty.RESOLUTION] = this.constrainResolution( - this.maxResolution_, options.zoom - this.minZoom_); - } - properties[ol.ViewProperty.ROTATION] = - options.rotation !== undefined ? options.rotation : 0; - this.setProperties(properties); -}; -goog.inherits(ol.View, ol.Object); - - -/** - * @param {number} rotation Target rotation. - * @param {ol.Coordinate} anchor Rotation anchor. - * @return {ol.Coordinate|undefined} Center for rotation and anchor. - */ -ol.View.prototype.calculateCenterRotate = function(rotation, anchor) { - var center; - var currentCenter = this.getCenter(); - if (currentCenter !== undefined) { - center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]]; - ol.coordinate.rotate(center, rotation - this.getRotation()); - ol.coordinate.add(center, anchor); - } - return center; -}; - - -/** - * @param {number} resolution Target resolution. - * @param {ol.Coordinate} anchor Zoom anchor. - * @return {ol.Coordinate|undefined} Center for resolution and anchor. - */ -ol.View.prototype.calculateCenterZoom = function(resolution, anchor) { - var center; - var currentCenter = this.getCenter(); - var currentResolution = this.getResolution(); - if (currentCenter !== undefined && currentResolution !== undefined) { - var x = anchor[0] - - resolution * (anchor[0] - currentCenter[0]) / currentResolution; - var y = anchor[1] - - resolution * (anchor[1] - currentCenter[1]) / currentResolution; - center = [x, y]; - } - return center; -}; - - -/** - * Get the constrained center of this view. - * @param {ol.Coordinate|undefined} center Center. - * @return {ol.Coordinate|undefined} Constrained center. - * @api - */ -ol.View.prototype.constrainCenter = function(center) { - return this.constraints_.center(center); -}; - - -/** - * Get the constrained resolution of this view. - * @param {number|undefined} resolution Resolution. - * @param {number=} opt_delta Delta. Default is `0`. - * @param {number=} opt_direction Direction. Default is `0`. - * @return {number|undefined} Constrained resolution. - * @api - */ -ol.View.prototype.constrainResolution = function( - resolution, opt_delta, opt_direction) { - var delta = opt_delta || 0; - var direction = opt_direction || 0; - return this.constraints_.resolution(resolution, delta, direction); -}; - - -/** - * Get the constrained rotation of this view. - * @param {number|undefined} rotation Rotation. - * @param {number=} opt_delta Delta. Default is `0`. - * @return {number|undefined} Constrained rotation. - * @api - */ -ol.View.prototype.constrainRotation = function(rotation, opt_delta) { - var delta = opt_delta || 0; - return this.constraints_.rotation(rotation, delta); -}; - - -/** - * Get the view center. - * @return {ol.Coordinate|undefined} The center of the view. - * @observable - * @api stable - */ -ol.View.prototype.getCenter = function() { - return /** @type {ol.Coordinate|undefined} */ ( - this.get(ol.ViewProperty.CENTER)); -}; - - -/** - * @return {Array.<number>} Hint. - */ -ol.View.prototype.getHints = function() { - return this.hints_.slice(); -}; - - -/** - * Calculate the extent for the current view state and the passed size. - * The size is the pixel dimensions of the box into which the calculated extent - * should fit. In most cases you want to get the extent of the entire map, - * that is `map.getSize()`. - * @param {ol.Size} size Box pixel size. - * @return {ol.Extent} Extent. - * @api stable - */ -ol.View.prototype.calculateExtent = function(size) { - var center = this.getCenter(); - goog.asserts.assert(center, 'The view center is not defined'); - var resolution = this.getResolution(); - goog.asserts.assert(resolution !== undefined, - 'The view resolution is not defined'); - var rotation = this.getRotation(); - goog.asserts.assert(rotation !== undefined, - 'The view rotation is not defined'); - - return ol.extent.getForViewAndSize(center, resolution, rotation, size); -}; - - -/** - * Get the view projection. - * @return {ol.proj.Projection} The projection of the view. - * @api stable - */ -ol.View.prototype.getProjection = function() { - return this.projection_; -}; - - -/** - * Get the view resolution. - * @return {number|undefined} The resolution of the view. - * @observable - * @api stable - */ -ol.View.prototype.getResolution = function() { - return /** @type {number|undefined} */ ( - this.get(ol.ViewProperty.RESOLUTION)); -}; - - -/** - * Get the resolution for a provided extent (in map units) and size (in pixels). - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Box pixel size. - * @return {number} The resolution at which the provided extent will render at - * the given size. - */ -ol.View.prototype.getResolutionForExtent = function(extent, size) { - var xResolution = ol.extent.getWidth(extent) / size[0]; - var yResolution = ol.extent.getHeight(extent) / size[1]; - return Math.max(xResolution, yResolution); -}; - - -/** - * Return a function that returns a value between 0 and 1 for a - * resolution. Exponential scaling is assumed. - * @param {number=} opt_power Power. - * @return {function(number): number} Resolution for value function. - */ -ol.View.prototype.getResolutionForValueFunction = function(opt_power) { - var power = opt_power || 2; - var maxResolution = this.maxResolution_; - var minResolution = this.minResolution_; - var max = Math.log(maxResolution / minResolution) / Math.log(power); - return ( - /** - * @param {number} value Value. - * @return {number} Resolution. - */ - function(value) { - var resolution = maxResolution / Math.pow(power, value * max); - goog.asserts.assert(resolution >= minResolution && - resolution <= maxResolution, - 'calculated resolution outside allowed bounds (%s <= %s <= %s)', - minResolution, resolution, maxResolution); - return resolution; - }); -}; - - -/** - * Get the view rotation. - * @return {number} The rotation of the view in radians. - * @observable - * @api stable - */ -ol.View.prototype.getRotation = function() { - return /** @type {number} */ (this.get(ol.ViewProperty.ROTATION)); -}; - - -/** - * Return a function that returns a resolution for a value between - * 0 and 1. Exponential scaling is assumed. - * @param {number=} opt_power Power. - * @return {function(number): number} Value for resolution function. - */ -ol.View.prototype.getValueForResolutionFunction = function(opt_power) { - var power = opt_power || 2; - var maxResolution = this.maxResolution_; - var minResolution = this.minResolution_; - var max = Math.log(maxResolution / minResolution) / Math.log(power); - return ( - /** - * @param {number} resolution Resolution. - * @return {number} Value. - */ - function(resolution) { - var value = - (Math.log(maxResolution / resolution) / Math.log(power)) / max; - goog.asserts.assert(value >= 0 && value <= 1, - 'calculated value (%s) ouside allowed range (0-1)', value); - return value; - }); -}; - - -/** - * @return {olx.ViewState} View state. - */ -ol.View.prototype.getState = function() { - goog.asserts.assert(this.isDef(), - 'the view was not defined (had no center and/or resolution)'); - var center = /** @type {ol.Coordinate} */ (this.getCenter()); - var projection = this.getProjection(); - var resolution = /** @type {number} */ (this.getResolution()); - var rotation = this.getRotation(); - return /** @type {olx.ViewState} */ ({ - // Snap center to closest pixel - center: [ - Math.round(center[0] / resolution) * resolution, - Math.round(center[1] / resolution) * resolution - ], - projection: projection !== undefined ? projection : null, - resolution: resolution, - rotation: rotation - }); -}; - - -/** - * Get the current zoom level. Return undefined if the current - * resolution is undefined or not a "constrained resolution". - * @return {number|undefined} Zoom. - * @api stable - */ -ol.View.prototype.getZoom = function() { - var offset; - var resolution = this.getResolution(); - - if (resolution !== undefined) { - var res, z = 0; - do { - res = this.constrainResolution(this.maxResolution_, z); - if (res == resolution) { - offset = z; - break; - } - ++z; - } while (res > this.minResolution_); - } - - return offset !== undefined ? this.minZoom_ + offset : offset; -}; - - -/** - * Fit the given geometry or extent based on the given map size and border. - * The size is pixel dimensions of the box to fit the extent into. - * In most cases you will want to use the map size, that is `map.getSize()`. - * Takes care of the map angle. - * @param {ol.geom.SimpleGeometry|ol.Extent} geometry Geometry. - * @param {ol.Size} size Box pixel size. - * @param {olx.view.FitOptions=} opt_options Options. - * @api - */ -ol.View.prototype.fit = function(geometry, size, opt_options) { - if (!(geometry instanceof ol.geom.SimpleGeometry)) { - goog.asserts.assert(goog.isArray(geometry), - 'invalid extent or geometry'); - goog.asserts.assert(!ol.extent.isEmpty(geometry), - 'cannot fit empty extent'); - geometry = ol.geom.Polygon.fromExtent(geometry); - } - - var options = opt_options || {}; - - var padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0]; - var constrainResolution = options.constrainResolution !== undefined ? - options.constrainResolution : true; - var nearest = options.nearest !== undefined ? options.nearest : false; - var minResolution; - if (options.minResolution !== undefined) { - minResolution = options.minResolution; - } else if (options.maxZoom !== undefined) { - minResolution = this.constrainResolution( - this.maxResolution_, options.maxZoom - this.minZoom_, 0); - } else { - minResolution = 0; - } - var coords = geometry.getFlatCoordinates(); - - // calculate rotated extent - var rotation = this.getRotation(); - goog.asserts.assert(rotation !== undefined, 'rotation was not defined'); - var cosAngle = Math.cos(-rotation); - var sinAngle = Math.sin(-rotation); - var minRotX = +Infinity; - var minRotY = +Infinity; - var maxRotX = -Infinity; - var maxRotY = -Infinity; - var stride = geometry.getStride(); - for (var i = 0, ii = coords.length; i < ii; i += stride) { - var rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle; - var rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle; - minRotX = Math.min(minRotX, rotX); - minRotY = Math.min(minRotY, rotY); - maxRotX = Math.max(maxRotX, rotX); - maxRotY = Math.max(maxRotY, rotY); - } - - // calculate resolution - var resolution = this.getResolutionForExtent( - [minRotX, minRotY, maxRotX, maxRotY], - [size[0] - padding[1] - padding[3], size[1] - padding[0] - padding[2]]); - resolution = isNaN(resolution) ? minResolution : - Math.max(resolution, minResolution); - if (constrainResolution) { - var constrainedResolution = this.constrainResolution(resolution, 0, 0); - if (!nearest && constrainedResolution < resolution) { - constrainedResolution = this.constrainResolution( - constrainedResolution, -1, 0); - } - resolution = constrainedResolution; - } - this.setResolution(resolution); - - // calculate center - sinAngle = -sinAngle; // go back to original rotation - var centerRotX = (minRotX + maxRotX) / 2; - var centerRotY = (minRotY + maxRotY) / 2; - centerRotX += (padding[1] - padding[3]) / 2 * resolution; - centerRotY += (padding[0] - padding[2]) / 2 * resolution; - var centerX = centerRotX * cosAngle - centerRotY * sinAngle; - var centerY = centerRotY * cosAngle + centerRotX * sinAngle; - - this.setCenter([centerX, centerY]); -}; - - -/** - * Center on coordinate and view position. - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.Size} size Box pixel size. - * @param {ol.Pixel} position Position on the view to center on. - * @api - */ -ol.View.prototype.centerOn = function(coordinate, size, position) { - // calculate rotated position - var rotation = this.getRotation(); - var cosAngle = Math.cos(-rotation); - var sinAngle = Math.sin(-rotation); - var rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle; - var rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle; - var resolution = this.getResolution(); - rotX += (size[0] / 2 - position[0]) * resolution; - rotY += (position[1] - size[1] / 2) * resolution; - - // go back to original angle - sinAngle = -sinAngle; // go back to original rotation - var centerX = rotX * cosAngle - rotY * sinAngle; - var centerY = rotY * cosAngle + rotX * sinAngle; - - this.setCenter([centerX, centerY]); -}; - - -/** - * @return {boolean} Is defined. - */ -ol.View.prototype.isDef = function() { - return !!this.getCenter() && this.getResolution() !== undefined; -}; - - -/** - * Rotate the view around a given coordinate. - * @param {number} rotation New rotation value for the view. - * @param {ol.Coordinate=} opt_anchor The rotation center. - * @api stable - */ -ol.View.prototype.rotate = function(rotation, opt_anchor) { - if (opt_anchor !== undefined) { - var center = this.calculateCenterRotate(rotation, opt_anchor); - this.setCenter(center); - } - this.setRotation(rotation); -}; - - -/** - * Set the center of the current view. - * @param {ol.Coordinate|undefined} center The center of the view. - * @observable - * @api stable - */ -ol.View.prototype.setCenter = function(center) { - this.set(ol.ViewProperty.CENTER, center); -}; - - -/** - * @param {ol.ViewHint} hint Hint. - * @param {number} delta Delta. - * @return {number} New value. - */ -ol.View.prototype.setHint = function(hint, delta) { - goog.asserts.assert(0 <= hint && hint < this.hints_.length, - 'illegal hint (%s), must be between 0 and %s', hint, this.hints_.length); - this.hints_[hint] += delta; - goog.asserts.assert(this.hints_[hint] >= 0, - 'Hint at %s must be positive, was %s', hint, this.hints_[hint]); - return this.hints_[hint]; -}; - - -/** - * Set the resolution for this view. - * @param {number|undefined} resolution The resolution of the view. - * @observable - * @api stable - */ -ol.View.prototype.setResolution = function(resolution) { - this.set(ol.ViewProperty.RESOLUTION, resolution); -}; - - -/** - * Set the rotation for this view. - * @param {number} rotation The rotation of the view in radians. - * @observable - * @api stable - */ -ol.View.prototype.setRotation = function(rotation) { - this.set(ol.ViewProperty.ROTATION, rotation); -}; - - -/** - * Zoom to a specific zoom level. - * @param {number} zoom Zoom level. - * @api stable - */ -ol.View.prototype.setZoom = function(zoom) { - var resolution = this.constrainResolution( - this.maxResolution_, zoom - this.minZoom_, 0); - this.setResolution(resolution); -}; - - -/** - * @param {olx.ViewOptions} options View options. - * @private - * @return {ol.CenterConstraintType} - */ -ol.View.createCenterConstraint_ = function(options) { - if (options.extent !== undefined) { - return ol.CenterConstraint.createExtent(options.extent); - } else { - return ol.CenterConstraint.none; - } -}; - - -/** - * @private - * @param {olx.ViewOptions} options View options. - * @return {{constraint: ol.ResolutionConstraintType, maxResolution: number, - * minResolution: number}} - */ -ol.View.createResolutionConstraint_ = function(options) { - var resolutionConstraint; - var maxResolution; - var minResolution; - - // TODO: move these to be ol constants - // see https://github.com/openlayers/ol3/issues/2076 - var defaultMaxZoom = 28; - var defaultZoomFactor = 2; - - var minZoom = options.minZoom !== undefined ? - options.minZoom : ol.DEFAULT_MIN_ZOOM; - - var maxZoom = options.maxZoom !== undefined ? - options.maxZoom : defaultMaxZoom; - - var zoomFactor = options.zoomFactor !== undefined ? - options.zoomFactor : defaultZoomFactor; - - if (options.resolutions !== undefined) { - var resolutions = options.resolutions; - maxResolution = resolutions[0]; - minResolution = resolutions[resolutions.length - 1]; - resolutionConstraint = ol.ResolutionConstraint.createSnapToResolutions( - resolutions); - } else { - // calculate the default min and max resolution - var projection = ol.proj.createProjection(options.projection, 'EPSG:3857'); - var extent = projection.getExtent(); - var size = !extent ? - // use an extent that can fit the whole world if need be - 360 * ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES] / - ol.proj.METERS_PER_UNIT[projection.getUnits()] : - Math.max(ol.extent.getWidth(extent), ol.extent.getHeight(extent)); - - var defaultMaxResolution = size / ol.DEFAULT_TILE_SIZE / Math.pow( - defaultZoomFactor, ol.DEFAULT_MIN_ZOOM); - - var defaultMinResolution = defaultMaxResolution / Math.pow( - defaultZoomFactor, defaultMaxZoom - ol.DEFAULT_MIN_ZOOM); - - // user provided maxResolution takes precedence - maxResolution = options.maxResolution; - if (maxResolution !== undefined) { - minZoom = 0; - } else { - maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom); - } - - // user provided minResolution takes precedence - minResolution = options.minResolution; - if (minResolution === undefined) { - if (options.maxZoom !== undefined) { - if (options.maxResolution !== undefined) { - minResolution = maxResolution / Math.pow(zoomFactor, maxZoom); - } else { - minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom); - } - } else { - minResolution = defaultMinResolution; - } - } - - // given discrete zoom levels, minResolution may be different than provided - maxZoom = minZoom + Math.floor( - Math.log(maxResolution / minResolution) / Math.log(zoomFactor)); - minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom); - - resolutionConstraint = ol.ResolutionConstraint.createSnapToPower( - zoomFactor, maxResolution, maxZoom - minZoom); - } - return {constraint: resolutionConstraint, maxResolution: maxResolution, - minResolution: minResolution, minZoom: minZoom}; -}; - - -/** - * @private - * @param {olx.ViewOptions} options View options. - * @return {ol.RotationConstraintType} Rotation constraint. - */ -ol.View.createRotationConstraint_ = function(options) { - var enableRotation = options.enableRotation !== undefined ? - options.enableRotation : true; - if (enableRotation) { - var constrainRotation = options.constrainRotation; - if (constrainRotation === undefined || constrainRotation === true) { - return ol.RotationConstraint.createSnapToZero(); - } else if (constrainRotation === false) { - return ol.RotationConstraint.none; - } else if (goog.isNumber(constrainRotation)) { - return ol.RotationConstraint.createSnapToN(constrainRotation); - } else { - goog.asserts.fail( - 'illegal option for constrainRotation (%s)', constrainRotation); - return ol.RotationConstraint.none; - } - } else { - return ol.RotationConstraint.disable; - } -}; - -goog.provide('ol.easing'); - - -/** - * Start slow and speed up. - * @param {number} t Input between 0 and 1. - * @return {number} Output between 0 and 1. - * @api - */ -ol.easing.easeIn = function(t) { - return Math.pow(t, 3); -}; - - -/** - * Start fast and slow down. - * @param {number} t Input between 0 and 1. - * @return {number} Output between 0 and 1. - * @api - */ -ol.easing.easeOut = function(t) { - return 1 - ol.easing.easeIn(1 - t); -}; - - -/** - * Start slow, speed up, and then slow down again. - * @param {number} t Input between 0 and 1. - * @return {number} Output between 0 and 1. - * @api - */ -ol.easing.inAndOut = function(t) { - return 3 * t * t - 2 * t * t * t; -}; - - -/** - * Maintain a constant speed over time. - * @param {number} t Input between 0 and 1. - * @return {number} Output between 0 and 1. - * @api - */ -ol.easing.linear = function(t) { - return t; -}; - - -/** - * Start slow, speed up, and at the very end slow down again. This has the - * same general behavior as {@link ol.easing.inAndOut}, but the final slowdown - * is delayed. - * @param {number} t Input between 0 and 1. - * @return {number} Output between 0 and 1. - * @api - */ -ol.easing.upAndDown = function(t) { - if (t < 0.5) { - return ol.easing.inAndOut(2 * t); - } else { - return 1 - ol.easing.inAndOut(2 * (t - 0.5)); - } -}; - -goog.provide('ol.animation'); - -goog.require('ol'); -goog.require('ol.PreRenderFunction'); -goog.require('ol.ViewHint'); -goog.require('ol.coordinate'); -goog.require('ol.easing'); - - -/** - * Generate an animated transition that will "bounce" the resolution as it - * approaches the final value. - * @param {olx.animation.BounceOptions} options Bounce options. - * @return {ol.PreRenderFunction} Pre-render function. - * @api - */ -ol.animation.bounce = function(options) { - var resolution = options.resolution; - var start = options.start ? options.start : Date.now(); - var duration = options.duration !== undefined ? options.duration : 1000; - var easing = options.easing ? - options.easing : ol.easing.upAndDown; - return ( - /** - * @param {ol.Map} map Map. - * @param {?olx.FrameState} frameState Frame state. - */ - function(map, frameState) { - if (frameState.time < start) { - frameState.animate = true; - frameState.viewHints[ol.ViewHint.ANIMATING] += 1; - return true; - } else if (frameState.time < start + duration) { - var delta = easing((frameState.time - start) / duration); - var deltaResolution = resolution - frameState.viewState.resolution; - frameState.animate = true; - frameState.viewState.resolution += delta * deltaResolution; - frameState.viewHints[ol.ViewHint.ANIMATING] += 1; - return true; - } else { - return false; - } - }); -}; - - -/** - * Generate an animated transition while updating the view center. - * @param {olx.animation.PanOptions} options Pan options. - * @return {ol.PreRenderFunction} Pre-render function. - * @api - */ -ol.animation.pan = function(options) { - var source = options.source; - var start = options.start ? options.start : Date.now(); - var sourceX = source[0]; - var sourceY = source[1]; - var duration = options.duration !== undefined ? options.duration : 1000; - var easing = options.easing ? - options.easing : ol.easing.inAndOut; - return ( - /** - * @param {ol.Map} map Map. - * @param {?olx.FrameState} frameState Frame state. - */ - function(map, frameState) { - if (frameState.time < start) { - frameState.animate = true; - frameState.viewHints[ol.ViewHint.ANIMATING] += 1; - return true; - } else if (frameState.time < start + duration) { - var delta = 1 - easing((frameState.time - start) / duration); - var deltaX = sourceX - frameState.viewState.center[0]; - var deltaY = sourceY - frameState.viewState.center[1]; - frameState.animate = true; - frameState.viewState.center[0] += delta * deltaX; - frameState.viewState.center[1] += delta * deltaY; - frameState.viewHints[ol.ViewHint.ANIMATING] += 1; - return true; - } else { - return false; - } - }); -}; - - -/** - * Generate an animated transition while updating the view rotation. - * @param {olx.animation.RotateOptions} options Rotate options. - * @return {ol.PreRenderFunction} Pre-render function. - * @api - */ -ol.animation.rotate = function(options) { - var sourceRotation = options.rotation ? options.rotation : 0; - var start = options.start ? options.start : Date.now(); - var duration = options.duration !== undefined ? options.duration : 1000; - var easing = options.easing ? - options.easing : ol.easing.inAndOut; - var anchor = options.anchor ? - options.anchor : null; - - return ( - /** - * @param {ol.Map} map Map. - * @param {?olx.FrameState} frameState Frame state. - */ - function(map, frameState) { - if (frameState.time < start) { - frameState.animate = true; - frameState.viewHints[ol.ViewHint.ANIMATING] += 1; - return true; - } else if (frameState.time < start + duration) { - var delta = 1 - easing((frameState.time - start) / duration); - var deltaRotation = - (sourceRotation - frameState.viewState.rotation) * delta; - frameState.animate = true; - frameState.viewState.rotation += deltaRotation; - if (anchor) { - var center = frameState.viewState.center; - ol.coordinate.sub(center, anchor); - ol.coordinate.rotate(center, deltaRotation); - ol.coordinate.add(center, anchor); - } - frameState.viewHints[ol.ViewHint.ANIMATING] += 1; - return true; - } else { - return false; - } - }); -}; - - -/** - * Generate an animated transition while updating the view resolution. - * @param {olx.animation.ZoomOptions} options Zoom options. - * @return {ol.PreRenderFunction} Pre-render function. - * @api - */ -ol.animation.zoom = function(options) { - var sourceResolution = options.resolution; - var start = options.start ? options.start : Date.now(); - var duration = options.duration !== undefined ? options.duration : 1000; - var easing = options.easing ? - options.easing : ol.easing.inAndOut; - return ( - /** - * @param {ol.Map} map Map. - * @param {?olx.FrameState} frameState Frame state. - */ - function(map, frameState) { - if (frameState.time < start) { - frameState.animate = true; - frameState.viewHints[ol.ViewHint.ANIMATING] += 1; - return true; - } else if (frameState.time < start + duration) { - var delta = 1 - easing((frameState.time - start) / duration); - var deltaResolution = - sourceResolution - frameState.viewState.resolution; - frameState.animate = true; - frameState.viewState.resolution += delta * deltaResolution; - frameState.viewHints[ol.ViewHint.ANIMATING] += 1; - return true; - } else { - return false; - } - }); -}; - -goog.provide('ol.TileCoord'); -goog.provide('ol.tilecoord'); - -goog.require('goog.asserts'); -goog.require('ol.extent'); - - -/** - * An array of three numbers representing the location of a tile in a tile - * grid. The order is `z`, `x`, and `y`. `z` is the zoom level. - * @typedef {Array.<number>} ol.TileCoord - * @api - */ -ol.TileCoord; - - -/** - * @enum {number} - */ -ol.QuadKeyCharCode = { - ZERO: '0'.charCodeAt(0), - ONE: '1'.charCodeAt(0), - TWO: '2'.charCodeAt(0), - THREE: '3'.charCodeAt(0) -}; - - -/** - * @param {string} str String that follows pattern “z/x/y” where x, y and z are - * numbers. - * @return {ol.TileCoord} Tile coord. - */ -ol.tilecoord.createFromString = function(str) { - var v = str.split('/'); - goog.asserts.assert(v.length === 3, - 'must provide a string in "z/x/y" format, got "%s"', str); - return v.map(function(e) { - return parseInt(e, 10); - }); -}; - - -/** - * @param {number} z Z. - * @param {number} x X. - * @param {number} y Y. - * @param {ol.TileCoord=} opt_tileCoord Tile coordinate. - * @return {ol.TileCoord} Tile coordinate. - */ -ol.tilecoord.createOrUpdate = function(z, x, y, opt_tileCoord) { - if (opt_tileCoord !== undefined) { - opt_tileCoord[0] = z; - opt_tileCoord[1] = x; - opt_tileCoord[2] = y; - return opt_tileCoord; - } else { - return [z, x, y]; - } -}; - - -/** - * @param {number} z Z. - * @param {number} x X. - * @param {number} y Y. - * @return {string} Key. - */ -ol.tilecoord.getKeyZXY = function(z, x, y) { - return z + '/' + x + '/' + y; -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coord. - * @return {number} Hash. - */ -ol.tilecoord.hash = function(tileCoord) { - return (tileCoord[1] << tileCoord[0]) + tileCoord[2]; -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coord. - * @return {string} Quad key. - */ -ol.tilecoord.quadKey = function(tileCoord) { - var z = tileCoord[0]; - var digits = new Array(z); - var mask = 1 << (z - 1); - var i, charCode; - for (i = 0; i < z; ++i) { - charCode = ol.QuadKeyCharCode.ZERO; - if (tileCoord[1] & mask) { - charCode += 1; - } - if (tileCoord[2] & mask) { - charCode += 2; - } - digits[i] = String.fromCharCode(charCode); - mask >>= 1; - } - return digits.join(''); -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coord. - * @return {string} String. - */ -ol.tilecoord.toString = function(tileCoord) { - return ol.tilecoord.getKeyZXY(tileCoord[0], tileCoord[1], tileCoord[2]); -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @param {ol.proj.Projection} projection Projection. - * @return {ol.TileCoord} Tile coordinate. - */ -ol.tilecoord.wrapX = function(tileCoord, tileGrid, projection) { - var z = tileCoord[0]; - var center = tileGrid.getTileCoordCenter(tileCoord); - var projectionExtent = ol.tilegrid.extentFromProjection(projection); - if (!ol.extent.containsCoordinate(projectionExtent, center)) { - var worldWidth = ol.extent.getWidth(projectionExtent); - var worldsAway = Math.ceil((projectionExtent[0] - center[0]) / worldWidth); - center[0] += worldWidth * worldsAway; - return tileGrid.getTileCoordForCoordAndZ(center, z); - } else { - return tileCoord; - } -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {!ol.tilegrid.TileGrid} tileGrid Tile grid. - * @return {boolean} Tile coordinate is within extent and zoom level range. - */ -ol.tilecoord.withinExtentAndZ = function(tileCoord, tileGrid) { - var z = tileCoord[0]; - var x = tileCoord[1]; - var y = tileCoord[2]; - - if (tileGrid.getMinZoom() > z || z > tileGrid.getMaxZoom()) { - return false; - } - var extent = tileGrid.getExtent(); - var tileRange; - if (!extent) { - tileRange = tileGrid.getFullTileRange(z); - } else { - tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); - } - if (!tileRange) { - return true; - } else { - return tileRange.containsXY(x, y); - } -}; - -goog.provide('ol.TileRange'); - -goog.require('goog.asserts'); -goog.require('ol.Size'); -goog.require('ol.TileCoord'); - - - -/** - * A representation of a contiguous block of tiles. A tile range is specified - * by its min/max tile coordinates and is inclusive of coordinates. - * - * @constructor - * @param {number} minX Minimum X. - * @param {number} maxX Maximum X. - * @param {number} minY Minimum Y. - * @param {number} maxY Maximum Y. - * @struct - */ -ol.TileRange = function(minX, maxX, minY, maxY) { - - /** - * @type {number} - */ - this.minX = minX; - - /** - * @type {number} - */ - this.maxX = maxX; - - /** - * @type {number} - */ - this.minY = minY; - - /** - * @type {number} - */ - this.maxY = maxY; - -}; - - -/** - * @param {...ol.TileCoord} var_args Tile coordinates. - * @return {!ol.TileRange} Bounding tile box. - */ -ol.TileRange.boundingTileRange = function(var_args) { - var tileCoord0 = /** @type {ol.TileCoord} */ (arguments[0]); - var tileCoord0Z = tileCoord0[0]; - var tileCoord0X = tileCoord0[1]; - var tileCoord0Y = tileCoord0[2]; - var tileRange = new ol.TileRange(tileCoord0X, tileCoord0X, - tileCoord0Y, tileCoord0Y); - var i, ii, tileCoord, tileCoordX, tileCoordY, tileCoordZ; - for (i = 1, ii = arguments.length; i < ii; ++i) { - tileCoord = /** @type {ol.TileCoord} */ (arguments[i]); - tileCoordZ = tileCoord[0]; - tileCoordX = tileCoord[1]; - tileCoordY = tileCoord[2]; - goog.asserts.assert(tileCoordZ == tileCoord0Z, - 'passed tilecoords all have the same Z-value'); - tileRange.minX = Math.min(tileRange.minX, tileCoordX); - tileRange.maxX = Math.max(tileRange.maxX, tileCoordX); - tileRange.minY = Math.min(tileRange.minY, tileCoordY); - tileRange.maxY = Math.max(tileRange.maxY, tileCoordY); - } - return tileRange; -}; - - -/** - * @param {number} minX Minimum X. - * @param {number} maxX Maximum X. - * @param {number} minY Minimum Y. - * @param {number} maxY Maximum Y. - * @param {ol.TileRange|undefined} tileRange TileRange. - * @return {ol.TileRange} Tile range. - */ -ol.TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) { - if (tileRange !== undefined) { - tileRange.minX = minX; - tileRange.maxX = maxX; - tileRange.minY = minY; - tileRange.maxY = maxY; - return tileRange; - } else { - return new ol.TileRange(minX, maxX, minY, maxY); - } -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @return {boolean} Contains tile coordinate. - */ -ol.TileRange.prototype.contains = function(tileCoord) { - return this.containsXY(tileCoord[1], tileCoord[2]); -}; - - -/** - * @param {ol.TileRange} tileRange Tile range. - * @return {boolean} Contains. - */ -ol.TileRange.prototype.containsTileRange = function(tileRange) { - return this.minX <= tileRange.minX && tileRange.maxX <= this.maxX && - this.minY <= tileRange.minY && tileRange.maxY <= this.maxY; -}; - - -/** - * @param {number} x Tile coordinate x. - * @param {number} y Tile coordinate y. - * @return {boolean} Contains coordinate. - */ -ol.TileRange.prototype.containsXY = function(x, y) { - return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY; -}; - - -/** - * @param {ol.TileRange} tileRange Tile range. - * @return {boolean} Equals. - */ -ol.TileRange.prototype.equals = function(tileRange) { - return this.minX == tileRange.minX && this.minY == tileRange.minY && - this.maxX == tileRange.maxX && this.maxY == tileRange.maxY; -}; - - -/** - * @param {ol.TileRange} tileRange Tile range. - */ -ol.TileRange.prototype.extend = function(tileRange) { - if (tileRange.minX < this.minX) { - this.minX = tileRange.minX; - } - if (tileRange.maxX > this.maxX) { - this.maxX = tileRange.maxX; - } - if (tileRange.minY < this.minY) { - this.minY = tileRange.minY; - } - if (tileRange.maxY > this.maxY) { - this.maxY = tileRange.maxY; - } -}; - - -/** - * @return {number} Height. - */ -ol.TileRange.prototype.getHeight = function() { - return this.maxY - this.minY + 1; -}; - - -/** - * @return {ol.Size} Size. - */ -ol.TileRange.prototype.getSize = function() { - return [this.getWidth(), this.getHeight()]; -}; - - -/** - * @return {number} Width. - */ -ol.TileRange.prototype.getWidth = function() { - return this.maxX - this.minX + 1; -}; - - -/** - * @param {ol.TileRange} tileRange Tile range. - * @return {boolean} Intersects. - */ -ol.TileRange.prototype.intersects = function(tileRange) { - return this.minX <= tileRange.maxX && - this.maxX >= tileRange.minX && - this.minY <= tileRange.maxY && - this.maxY >= tileRange.minY; -}; - -goog.provide('ol.Attribution'); - -goog.require('goog.math'); -goog.require('ol.TileRange'); - - - -/** - * @classdesc - * An attribution for a layer source. - * - * Example: - * - * source: new ol.source.OSM({ - * attributions: [ - * new ol.Attribution({ - * html: 'All maps © ' + - * '<a href="http://www.opencyclemap.org/">OpenCycleMap</a>' - * }), - * ol.source.OSM.ATTRIBUTION - * ], - * .. - * - * @constructor - * @param {olx.AttributionOptions} options Attribution options. - * @struct - * @api stable - */ -ol.Attribution = function(options) { - - /** - * @private - * @type {string} - */ - this.html_ = options.html; - - /** - * @private - * @type {Object.<string, Array.<ol.TileRange>>} - */ - this.tileRanges_ = options.tileRanges ? options.tileRanges : null; - -}; - - -/** - * Get the attribution markup. - * @return {string} The attribution HTML. - * @api stable - */ -ol.Attribution.prototype.getHTML = function() { - return this.html_; -}; - - -/** - * @param {Object.<string, ol.TileRange>} tileRanges Tile ranges. - * @param {!ol.tilegrid.TileGrid} tileGrid Tile grid. - * @param {!ol.proj.Projection} projection Projection. - * @return {boolean} Intersects any tile range. - */ -ol.Attribution.prototype.intersectsAnyTileRange = - function(tileRanges, tileGrid, projection) { - if (!this.tileRanges_) { - return true; - } - var i, ii, tileRange, zKey; - for (zKey in tileRanges) { - if (!(zKey in this.tileRanges_)) { - continue; - } - tileRange = tileRanges[zKey]; - var testTileRange; - for (i = 0, ii = this.tileRanges_[zKey].length; i < ii; ++i) { - testTileRange = this.tileRanges_[zKey][i]; - if (testTileRange.intersects(tileRange)) { - return true; - } - var extentTileRange = tileGrid.getTileRangeForExtentAndZ( - projection.getExtent(), parseInt(zKey, 10)); - var width = extentTileRange.getWidth(); - if (tileRange.minX < extentTileRange.minX || - tileRange.maxX > extentTileRange.maxX) { - if (testTileRange.intersects(new ol.TileRange( - goog.math.modulo(tileRange.minX, width), - goog.math.modulo(tileRange.maxX, width), - tileRange.minY, tileRange.maxY))) { - return true; - } - if (tileRange.getWidth() > width && - testTileRange.intersects(extentTileRange)) { - return true; - } - } - } - } - return false; -}; - -goog.provide('ol.CanvasFunctionType'); - - -/** - * A function returning the canvas element (`{HTMLCanvasElement}`) - * used by the source as an image. The arguments passed to the function are: - * {@link ol.Extent} the image extent, `{number}` the image resolution, - * `{number}` the device pixel ratio, {@link ol.Size} the image size, and - * {@link ol.proj.Projection} the image projection. The canvas returned by - * this function is cached by the source. The this keyword inside the function - * references the {@link ol.source.ImageCanvas}. - * - * @typedef {function(this:ol.source.ImageCanvas, ol.Extent, number, - * number, ol.Size, ol.proj.Projection): HTMLCanvasElement} - * @api - */ -ol.CanvasFunctionType; - -/** - * An implementation of Google Maps' MVCArray. - * @see https://developers.google.com/maps/documentation/javascript/reference - */ - -goog.provide('ol.Collection'); -goog.provide('ol.CollectionEvent'); -goog.provide('ol.CollectionEventType'); - -goog.require('goog.array'); -goog.require('goog.events.Event'); -goog.require('ol.Object'); - - -/** - * @enum {string} - */ -ol.CollectionEventType = { - /** - * Triggered when an item is added to the collection. - * @event ol.CollectionEvent#add - * @api stable - */ - ADD: 'add', - /** - * Triggered when an item is removed from the collection. - * @event ol.CollectionEvent#remove - * @api stable - */ - REMOVE: 'remove' -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.Collection} instances are instances of this - * type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.CollectionEvent} - * @param {ol.CollectionEventType} type Type. - * @param {*=} opt_element Element. - * @param {Object=} opt_target Target. - */ -ol.CollectionEvent = function(type, opt_element, opt_target) { - - goog.base(this, type, opt_target); - - /** - * The element that is added to or removed from the collection. - * @type {*} - * @api stable - */ - this.element = opt_element; - -}; -goog.inherits(ol.CollectionEvent, goog.events.Event); - - -/** - * @enum {string} - */ -ol.CollectionProperty = { - LENGTH: 'length' -}; - - - -/** - * @classdesc - * An expanded version of standard JS Array, adding convenience methods for - * manipulation. Add and remove changes to the Collection trigger a Collection - * event. Note that this does not cover changes to the objects _within_ the - * Collection; they trigger events on the appropriate object, not on the - * Collection as a whole. - * - * @constructor - * @extends {ol.Object} - * @fires ol.CollectionEvent - * @param {!Array.<T>=} opt_array Array. - * @template T - * @api stable - */ -ol.Collection = function(opt_array) { - - goog.base(this); - - /** - * @private - * @type {!Array.<T>} - */ - this.array_ = opt_array ? opt_array : []; - - this.updateLength_(); - -}; -goog.inherits(ol.Collection, ol.Object); - - -/** - * Remove all elements from the collection. - * @api stable - */ -ol.Collection.prototype.clear = function() { - while (this.getLength() > 0) { - this.pop(); - } -}; - - -/** - * Add elements to the collection. This pushes each item in the provided array - * to the end of the collection. - * @param {!Array.<T>} arr Array. - * @return {ol.Collection.<T>} This collection. - * @api stable - */ -ol.Collection.prototype.extend = function(arr) { - var i, ii; - for (i = 0, ii = arr.length; i < ii; ++i) { - this.push(arr[i]); - } - return this; -}; - - -/** - * Iterate over each element, calling the provided callback. - * @param {function(this: S, T, number, Array.<T>): *} f The function to call - * for every element. This function takes 3 arguments (the element, the - * index and the array). The return value is ignored. - * @param {S=} opt_this The object to use as `this` in `f`. - * @template S - * @api stable - */ -ol.Collection.prototype.forEach = function(f, opt_this) { - this.array_.forEach(f, opt_this); -}; - - -/** - * Get a reference to the underlying Array object. Warning: if the array - * is mutated, no events will be dispatched by the collection, and the - * collection's "length" property won't be in sync with the actual length - * of the array. - * @return {!Array.<T>} Array. - * @api stable - */ -ol.Collection.prototype.getArray = function() { - return this.array_; -}; - - -/** - * Get the element at the provided index. - * @param {number} index Index. - * @return {T} Element. - * @api stable - */ -ol.Collection.prototype.item = function(index) { - return this.array_[index]; -}; - - -/** - * Get the length of this collection. - * @return {number} The length of the array. - * @observable - * @api stable - */ -ol.Collection.prototype.getLength = function() { - return /** @type {number} */ (this.get(ol.CollectionProperty.LENGTH)); -}; - - -/** - * Insert an element at the provided index. - * @param {number} index Index. - * @param {T} elem Element. - * @api stable - */ -ol.Collection.prototype.insertAt = function(index, elem) { - goog.array.insertAt(this.array_, elem, index); - this.updateLength_(); - this.dispatchEvent( - new ol.CollectionEvent(ol.CollectionEventType.ADD, elem, this)); -}; - - -/** - * Remove the last element of the collection and return it. - * Return `undefined` if the collection is empty. - * @return {T|undefined} Element. - * @api stable - */ -ol.Collection.prototype.pop = function() { - return this.removeAt(this.getLength() - 1); -}; - - -/** - * Insert the provided element at the end of the collection. - * @param {T} elem Element. - * @return {number} Length. - * @api stable - */ -ol.Collection.prototype.push = function(elem) { - var n = this.array_.length; - this.insertAt(n, elem); - return n; -}; - - -/** - * Remove the first occurrence of an element from the collection. - * @param {T} elem Element. - * @return {T|undefined} The removed element or undefined if none found. - * @api stable - */ -ol.Collection.prototype.remove = function(elem) { - var arr = this.array_; - var i, ii; - for (i = 0, ii = arr.length; i < ii; ++i) { - if (arr[i] === elem) { - return this.removeAt(i); - } - } - return undefined; -}; - - -/** - * Remove the element at the provided index and return it. - * Return `undefined` if the collection does not contain this index. - * @param {number} index Index. - * @return {T|undefined} Value. - * @api stable - */ -ol.Collection.prototype.removeAt = function(index) { - var prev = this.array_[index]; - goog.array.removeAt(this.array_, index); - this.updateLength_(); - this.dispatchEvent( - new ol.CollectionEvent(ol.CollectionEventType.REMOVE, prev, this)); - return prev; -}; - - -/** - * Set the element at the provided index. - * @param {number} index Index. - * @param {T} elem Element. - * @api stable - */ -ol.Collection.prototype.setAt = function(index, elem) { - var n = this.getLength(); - if (index < n) { - var prev = this.array_[index]; - this.array_[index] = elem; - this.dispatchEvent( - new ol.CollectionEvent(ol.CollectionEventType.REMOVE, prev, this)); - this.dispatchEvent( - new ol.CollectionEvent(ol.CollectionEventType.ADD, elem, this)); - } else { - var j; - for (j = n; j < index; ++j) { - this.insertAt(j, undefined); - } - this.insertAt(index, elem); - } -}; - - -/** - * @private - */ -ol.Collection.prototype.updateLength_ = function() { - this.set(ol.CollectionProperty.LENGTH, this.array_.length); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Names of standard colors with their associated hex values. - */ - -goog.provide('goog.color.names'); - - -/** - * A map that contains a lot of colors that are recognised by various browsers. - * This list is way larger than the minimal one dictated by W3C. - * The keys of this map are the lowercase "readable" names of the colors, while - * the values are the "hex" values. - * - * @type {!Object<string, string>} - */ -goog.color.names = { - 'aliceblue': '#f0f8ff', - 'antiquewhite': '#faebd7', - 'aqua': '#00ffff', - 'aquamarine': '#7fffd4', - 'azure': '#f0ffff', - 'beige': '#f5f5dc', - 'bisque': '#ffe4c4', - 'black': '#000000', - 'blanchedalmond': '#ffebcd', - 'blue': '#0000ff', - 'blueviolet': '#8a2be2', - 'brown': '#a52a2a', - 'burlywood': '#deb887', - 'cadetblue': '#5f9ea0', - 'chartreuse': '#7fff00', - 'chocolate': '#d2691e', - 'coral': '#ff7f50', - 'cornflowerblue': '#6495ed', - 'cornsilk': '#fff8dc', - 'crimson': '#dc143c', - 'cyan': '#00ffff', - 'darkblue': '#00008b', - 'darkcyan': '#008b8b', - 'darkgoldenrod': '#b8860b', - 'darkgray': '#a9a9a9', - 'darkgreen': '#006400', - 'darkgrey': '#a9a9a9', - 'darkkhaki': '#bdb76b', - 'darkmagenta': '#8b008b', - 'darkolivegreen': '#556b2f', - 'darkorange': '#ff8c00', - 'darkorchid': '#9932cc', - 'darkred': '#8b0000', - 'darksalmon': '#e9967a', - 'darkseagreen': '#8fbc8f', - 'darkslateblue': '#483d8b', - 'darkslategray': '#2f4f4f', - 'darkslategrey': '#2f4f4f', - 'darkturquoise': '#00ced1', - 'darkviolet': '#9400d3', - 'deeppink': '#ff1493', - 'deepskyblue': '#00bfff', - 'dimgray': '#696969', - 'dimgrey': '#696969', - 'dodgerblue': '#1e90ff', - 'firebrick': '#b22222', - 'floralwhite': '#fffaf0', - 'forestgreen': '#228b22', - 'fuchsia': '#ff00ff', - 'gainsboro': '#dcdcdc', - 'ghostwhite': '#f8f8ff', - 'gold': '#ffd700', - 'goldenrod': '#daa520', - 'gray': '#808080', - 'green': '#008000', - 'greenyellow': '#adff2f', - 'grey': '#808080', - 'honeydew': '#f0fff0', - 'hotpink': '#ff69b4', - 'indianred': '#cd5c5c', - 'indigo': '#4b0082', - 'ivory': '#fffff0', - 'khaki': '#f0e68c', - 'lavender': '#e6e6fa', - 'lavenderblush': '#fff0f5', - 'lawngreen': '#7cfc00', - 'lemonchiffon': '#fffacd', - 'lightblue': '#add8e6', - 'lightcoral': '#f08080', - 'lightcyan': '#e0ffff', - 'lightgoldenrodyellow': '#fafad2', - 'lightgray': '#d3d3d3', - 'lightgreen': '#90ee90', - 'lightgrey': '#d3d3d3', - 'lightpink': '#ffb6c1', - 'lightsalmon': '#ffa07a', - 'lightseagreen': '#20b2aa', - 'lightskyblue': '#87cefa', - 'lightslategray': '#778899', - 'lightslategrey': '#778899', - 'lightsteelblue': '#b0c4de', - 'lightyellow': '#ffffe0', - 'lime': '#00ff00', - 'limegreen': '#32cd32', - 'linen': '#faf0e6', - 'magenta': '#ff00ff', - 'maroon': '#800000', - 'mediumaquamarine': '#66cdaa', - 'mediumblue': '#0000cd', - 'mediumorchid': '#ba55d3', - 'mediumpurple': '#9370db', - 'mediumseagreen': '#3cb371', - 'mediumslateblue': '#7b68ee', - 'mediumspringgreen': '#00fa9a', - 'mediumturquoise': '#48d1cc', - 'mediumvioletred': '#c71585', - 'midnightblue': '#191970', - 'mintcream': '#f5fffa', - 'mistyrose': '#ffe4e1', - 'moccasin': '#ffe4b5', - 'navajowhite': '#ffdead', - 'navy': '#000080', - 'oldlace': '#fdf5e6', - 'olive': '#808000', - 'olivedrab': '#6b8e23', - 'orange': '#ffa500', - 'orangered': '#ff4500', - 'orchid': '#da70d6', - 'palegoldenrod': '#eee8aa', - 'palegreen': '#98fb98', - 'paleturquoise': '#afeeee', - 'palevioletred': '#db7093', - 'papayawhip': '#ffefd5', - 'peachpuff': '#ffdab9', - 'peru': '#cd853f', - 'pink': '#ffc0cb', - 'plum': '#dda0dd', - 'powderblue': '#b0e0e6', - 'purple': '#800080', - 'red': '#ff0000', - 'rosybrown': '#bc8f8f', - 'royalblue': '#4169e1', - 'saddlebrown': '#8b4513', - 'salmon': '#fa8072', - 'sandybrown': '#f4a460', - 'seagreen': '#2e8b57', - 'seashell': '#fff5ee', - 'sienna': '#a0522d', - 'silver': '#c0c0c0', - 'skyblue': '#87ceeb', - 'slateblue': '#6a5acd', - 'slategray': '#708090', - 'slategrey': '#708090', - 'snow': '#fffafa', - 'springgreen': '#00ff7f', - 'steelblue': '#4682b4', - 'tan': '#d2b48c', - 'teal': '#008080', - 'thistle': '#d8bfd8', - 'tomato': '#ff6347', - 'turquoise': '#40e0d0', - 'violet': '#ee82ee', - 'wheat': '#f5deb3', - 'white': '#ffffff', - 'whitesmoke': '#f5f5f5', - 'yellow': '#ffff00', - 'yellowgreen': '#9acd32' -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities related to color and color conversion. - */ - -goog.provide('goog.color'); -goog.provide('goog.color.Hsl'); -goog.provide('goog.color.Hsv'); -goog.provide('goog.color.Rgb'); - -goog.require('goog.color.names'); -goog.require('goog.math'); - - -/** - * RGB color representation. An array containing three elements [r, g, b], - * each an integer in [0, 255], representing the red, green, and blue components - * of the color respectively. - * @typedef {Array<number>} - */ -goog.color.Rgb; - - -/** - * HSV color representation. An array containing three elements [h, s, v]: - * h (hue) must be an integer in [0, 360], cyclic. - * s (saturation) must be a number in [0, 1]. - * v (value/brightness) must be an integer in [0, 255]. - * @typedef {Array<number>} - */ -goog.color.Hsv; - - -/** - * HSL color representation. An array containing three elements [h, s, l]: - * h (hue) must be an integer in [0, 360], cyclic. - * s (saturation) must be a number in [0, 1]. - * l (lightness) must be a number in [0, 1]. - * @typedef {Array<number>} - */ -goog.color.Hsl; - - -/** - * Parses a color out of a string. - * @param {string} str Color in some format. - * @return {{hex: string, type: string}} 'hex' is a string containing a hex - * representation of the color, 'type' is a string containing the type - * of color format passed in ('hex', 'rgb', 'named'). - */ -goog.color.parse = function(str) { - var result = {}; - str = String(str); - - var maybeHex = goog.color.prependHashIfNecessaryHelper(str); - if (goog.color.isValidHexColor_(maybeHex)) { - result.hex = goog.color.normalizeHex(maybeHex); - result.type = 'hex'; - return result; - } else { - var rgb = goog.color.isValidRgbColor_(str); - if (rgb.length) { - result.hex = goog.color.rgbArrayToHex(rgb); - result.type = 'rgb'; - return result; - } else if (goog.color.names) { - var hex = goog.color.names[str.toLowerCase()]; - if (hex) { - result.hex = hex; - result.type = 'named'; - return result; - } - } - } - throw Error(str + ' is not a valid color string'); -}; - - -/** - * Determines if the given string can be parsed as a color. - * {@see goog.color.parse}. - * @param {string} str Potential color string. - * @return {boolean} True if str is in a format that can be parsed to a color. - */ -goog.color.isValidColor = function(str) { - var maybeHex = goog.color.prependHashIfNecessaryHelper(str); - return !!(goog.color.isValidHexColor_(maybeHex) || - goog.color.isValidRgbColor_(str).length || - goog.color.names && goog.color.names[str.toLowerCase()]); -}; - - -/** - * Parses red, green, blue components out of a valid rgb color string. - * Throws Error if the color string is invalid. - * @param {string} str RGB representation of a color. - * {@see goog.color.isValidRgbColor_}. - * @return {!goog.color.Rgb} rgb representation of the color. - */ -goog.color.parseRgb = function(str) { - var rgb = goog.color.isValidRgbColor_(str); - if (!rgb.length) { - throw Error(str + ' is not a valid RGB color'); - } - return rgb; -}; - - -/** - * Converts a hex representation of a color to RGB. - * @param {string} hexColor Color to convert. - * @return {string} string of the form 'rgb(R,G,B)' which can be used in - * styles. - */ -goog.color.hexToRgbStyle = function(hexColor) { - return goog.color.rgbStyle_(goog.color.hexToRgb(hexColor)); -}; - - -/** - * Regular expression for extracting the digits in a hex color triplet. - * @type {RegExp} - * @private - */ -goog.color.hexTripletRe_ = /#(.)(.)(.)/; - - -/** - * Normalize an hex representation of a color - * @param {string} hexColor an hex color string. - * @return {string} hex color in the format '#rrggbb' with all lowercase - * literals. - */ -goog.color.normalizeHex = function(hexColor) { - if (!goog.color.isValidHexColor_(hexColor)) { - throw Error("'" + hexColor + "' is not a valid hex color"); - } - if (hexColor.length == 4) { // of the form #RGB - hexColor = hexColor.replace(goog.color.hexTripletRe_, '#$1$1$2$2$3$3'); - } - return hexColor.toLowerCase(); -}; - - -/** - * Converts a hex representation of a color to RGB. - * @param {string} hexColor Color to convert. - * @return {!goog.color.Rgb} rgb representation of the color. - */ -goog.color.hexToRgb = function(hexColor) { - hexColor = goog.color.normalizeHex(hexColor); - var r = parseInt(hexColor.substr(1, 2), 16); - var g = parseInt(hexColor.substr(3, 2), 16); - var b = parseInt(hexColor.substr(5, 2), 16); - - return [r, g, b]; -}; - - -/** - * Converts a color from RGB to hex representation. - * @param {number} r Amount of red, int between 0 and 255. - * @param {number} g Amount of green, int between 0 and 255. - * @param {number} b Amount of blue, int between 0 and 255. - * @return {string} hex representation of the color. - */ -goog.color.rgbToHex = function(r, g, b) { - r = Number(r); - g = Number(g); - b = Number(b); - if (isNaN(r) || r < 0 || r > 255 || - isNaN(g) || g < 0 || g > 255 || - isNaN(b) || b < 0 || b > 255) { - throw Error('"(' + r + ',' + g + ',' + b + '") is not a valid RGB color'); - } - var hexR = goog.color.prependZeroIfNecessaryHelper(r.toString(16)); - var hexG = goog.color.prependZeroIfNecessaryHelper(g.toString(16)); - var hexB = goog.color.prependZeroIfNecessaryHelper(b.toString(16)); - return '#' + hexR + hexG + hexB; -}; - - -/** - * Converts a color from RGB to hex representation. - * @param {goog.color.Rgb} rgb rgb representation of the color. - * @return {string} hex representation of the color. - */ -goog.color.rgbArrayToHex = function(rgb) { - return goog.color.rgbToHex(rgb[0], rgb[1], rgb[2]); -}; - - -/** - * Converts a color from RGB color space to HSL color space. - * Modified from {@link http://en.wikipedia.org/wiki/HLS_color_space}. - * @param {number} r Value of red, in [0, 255]. - * @param {number} g Value of green, in [0, 255]. - * @param {number} b Value of blue, in [0, 255]. - * @return {!goog.color.Hsl} hsl representation of the color. - */ -goog.color.rgbToHsl = function(r, g, b) { - // First must normalize r, g, b to be between 0 and 1. - var normR = r / 255; - var normG = g / 255; - var normB = b / 255; - var max = Math.max(normR, normG, normB); - var min = Math.min(normR, normG, normB); - var h = 0; - var s = 0; - - // Luminosity is the average of the max and min rgb color intensities. - var l = 0.5 * (max + min); - - // The hue and saturation are dependent on which color intensity is the max. - // If max and min are equal, the color is gray and h and s should be 0. - if (max != min) { - if (max == normR) { - h = 60 * (normG - normB) / (max - min); - } else if (max == normG) { - h = 60 * (normB - normR) / (max - min) + 120; - } else if (max == normB) { - h = 60 * (normR - normG) / (max - min) + 240; - } - - if (0 < l && l <= 0.5) { - s = (max - min) / (2 * l); - } else { - s = (max - min) / (2 - 2 * l); - } - } - - // Make sure the hue falls between 0 and 360. - return [Math.round(h + 360) % 360, s, l]; -}; - - -/** - * Converts a color from RGB color space to HSL color space. - * @param {goog.color.Rgb} rgb rgb representation of the color. - * @return {!goog.color.Hsl} hsl representation of the color. - */ -goog.color.rgbArrayToHsl = function(rgb) { - return goog.color.rgbToHsl(rgb[0], rgb[1], rgb[2]); -}; - - -/** - * Helper for hslToRgb. - * @param {number} v1 Helper variable 1. - * @param {number} v2 Helper variable 2. - * @param {number} vH Helper variable 3. - * @return {number} Appropriate RGB value, given the above. - * @private - */ -goog.color.hueToRgb_ = function(v1, v2, vH) { - if (vH < 0) { - vH += 1; - } else if (vH > 1) { - vH -= 1; - } - if ((6 * vH) < 1) { - return (v1 + (v2 - v1) * 6 * vH); - } else if (2 * vH < 1) { - return v2; - } else if (3 * vH < 2) { - return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6); - } - return v1; -}; - - -/** - * Converts a color from HSL color space to RGB color space. - * Modified from {@link http://www.easyrgb.com/math.html} - * @param {number} h Hue, in [0, 360]. - * @param {number} s Saturation, in [0, 1]. - * @param {number} l Luminosity, in [0, 1]. - * @return {!goog.color.Rgb} rgb representation of the color. - */ -goog.color.hslToRgb = function(h, s, l) { - var r = 0; - var g = 0; - var b = 0; - var normH = h / 360; // normalize h to fall in [0, 1] - - if (s == 0) { - r = g = b = l * 255; - } else { - var temp1 = 0; - var temp2 = 0; - if (l < 0.5) { - temp2 = l * (1 + s); - } else { - temp2 = l + s - (s * l); - } - temp1 = 2 * l - temp2; - r = 255 * goog.color.hueToRgb_(temp1, temp2, normH + (1 / 3)); - g = 255 * goog.color.hueToRgb_(temp1, temp2, normH); - b = 255 * goog.color.hueToRgb_(temp1, temp2, normH - (1 / 3)); - } - - return [Math.round(r), Math.round(g), Math.round(b)]; -}; - - -/** - * Converts a color from HSL color space to RGB color space. - * @param {goog.color.Hsl} hsl hsl representation of the color. - * @return {!goog.color.Rgb} rgb representation of the color. - */ -goog.color.hslArrayToRgb = function(hsl) { - return goog.color.hslToRgb(hsl[0], hsl[1], hsl[2]); -}; - - -/** - * Helper for isValidHexColor_. - * @type {RegExp} - * @private - */ -goog.color.validHexColorRe_ = /^#(?:[0-9a-f]{3}){1,2}$/i; - - -/** - * Checks if a string is a valid hex color. We expect strings of the format - * #RRGGBB (ex: #1b3d5f) or #RGB (ex: #3CA == #33CCAA). - * @param {string} str String to check. - * @return {boolean} Whether the string is a valid hex color. - * @private - */ -goog.color.isValidHexColor_ = function(str) { - return goog.color.validHexColorRe_.test(str); -}; - - -/** - * Helper for isNormalizedHexColor_. - * @type {RegExp} - * @private - */ -goog.color.normalizedHexColorRe_ = /^#[0-9a-f]{6}$/; - - -/** - * Checks if a string is a normalized hex color. - * We expect strings of the format #RRGGBB (ex: #1b3d5f) - * using only lowercase letters. - * @param {string} str String to check. - * @return {boolean} Whether the string is a normalized hex color. - * @private - */ -goog.color.isNormalizedHexColor_ = function(str) { - return goog.color.normalizedHexColorRe_.test(str); -}; - - -/** - * Regular expression for matching and capturing RGB style strings. Helper for - * isValidRgbColor_. - * @type {RegExp} - * @private - */ -goog.color.rgbColorRe_ = - /^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i; - - -/** - * Checks if a string is a valid rgb color. We expect strings of the format - * '(r, g, b)', or 'rgb(r, g, b)', where each color component is an int in - * [0, 255]. - * @param {string} str String to check. - * @return {!goog.color.Rgb} the rgb representation of the color if it is - * a valid color, or the empty array otherwise. - * @private - */ -goog.color.isValidRgbColor_ = function(str) { - // Each component is separate (rather than using a repeater) so we can - // capture the match. Also, we explicitly set each component to be either 0, - // or start with a non-zero, to prevent octal numbers from slipping through. - var regExpResultArray = str.match(goog.color.rgbColorRe_); - if (regExpResultArray) { - var r = Number(regExpResultArray[1]); - var g = Number(regExpResultArray[2]); - var b = Number(regExpResultArray[3]); - if (r >= 0 && r <= 255 && - g >= 0 && g <= 255 && - b >= 0 && b <= 255) { - return [r, g, b]; - } - } - return []; -}; - - -/** - * Takes a hex value and prepends a zero if it's a single digit. - * Small helper method for use by goog.color and friends. - * @param {string} hex Hex value to prepend if single digit. - * @return {string} hex value prepended with zero if it was single digit, - * otherwise the same value that was passed in. - */ -goog.color.prependZeroIfNecessaryHelper = function(hex) { - return hex.length == 1 ? '0' + hex : hex; -}; - - -/** - * Takes a string a prepends a '#' sign if one doesn't exist. - * Small helper method for use by goog.color and friends. - * @param {string} str String to check. - * @return {string} The value passed in, prepended with a '#' if it didn't - * already have one. - */ -goog.color.prependHashIfNecessaryHelper = function(str) { - return str.charAt(0) == '#' ? str : '#' + str; -}; - - -/** - * Takes an array of [r, g, b] and converts it into a string appropriate for - * CSS styles. - * @param {goog.color.Rgb} rgb rgb representation of the color. - * @return {string} string of the form 'rgb(r,g,b)'. - * @private - */ -goog.color.rgbStyle_ = function(rgb) { - return 'rgb(' + rgb.join(',') + ')'; -}; - - -/** - * Converts an HSV triplet to an RGB array. V is brightness because b is - * reserved for blue in RGB. - * @param {number} h Hue value in [0, 360]. - * @param {number} s Saturation value in [0, 1]. - * @param {number} brightness brightness in [0, 255]. - * @return {!goog.color.Rgb} rgb representation of the color. - */ -goog.color.hsvToRgb = function(h, s, brightness) { - var red = 0; - var green = 0; - var blue = 0; - if (s == 0) { - red = brightness; - green = brightness; - blue = brightness; - } else { - var sextant = Math.floor(h / 60); - var remainder = (h / 60) - sextant; - var val1 = brightness * (1 - s); - var val2 = brightness * (1 - (s * remainder)); - var val3 = brightness * (1 - (s * (1 - remainder))); - switch (sextant) { - case 1: - red = val2; - green = brightness; - blue = val1; - break; - case 2: - red = val1; - green = brightness; - blue = val3; - break; - case 3: - red = val1; - green = val2; - blue = brightness; - break; - case 4: - red = val3; - green = val1; - blue = brightness; - break; - case 5: - red = brightness; - green = val1; - blue = val2; - break; - case 6: - case 0: - red = brightness; - green = val3; - blue = val1; - break; - } - } - - return [Math.floor(red), Math.floor(green), Math.floor(blue)]; -}; - - -/** - * Converts from RGB values to an array of HSV values. - * @param {number} red Red value in [0, 255]. - * @param {number} green Green value in [0, 255]. - * @param {number} blue Blue value in [0, 255]. - * @return {!goog.color.Hsv} hsv representation of the color. - */ -goog.color.rgbToHsv = function(red, green, blue) { - - var max = Math.max(Math.max(red, green), blue); - var min = Math.min(Math.min(red, green), blue); - var hue; - var saturation; - var value = max; - if (min == max) { - hue = 0; - saturation = 0; - } else { - var delta = (max - min); - saturation = delta / max; - - if (red == max) { - hue = (green - blue) / delta; - } else if (green == max) { - hue = 2 + ((blue - red) / delta); - } else { - hue = 4 + ((red - green) / delta); - } - hue *= 60; - if (hue < 0) { - hue += 360; - } - if (hue > 360) { - hue -= 360; - } - } - - return [hue, saturation, value]; -}; - - -/** - * Converts from an array of RGB values to an array of HSV values. - * @param {goog.color.Rgb} rgb rgb representation of the color. - * @return {!goog.color.Hsv} hsv representation of the color. - */ -goog.color.rgbArrayToHsv = function(rgb) { - return goog.color.rgbToHsv(rgb[0], rgb[1], rgb[2]); -}; - - -/** - * Converts an HSV triplet to an RGB array. - * @param {goog.color.Hsv} hsv hsv representation of the color. - * @return {!goog.color.Rgb} rgb representation of the color. - */ -goog.color.hsvArrayToRgb = function(hsv) { - return goog.color.hsvToRgb(hsv[0], hsv[1], hsv[2]); -}; - - -/** - * Converts a hex representation of a color to HSL. - * @param {string} hex Color to convert. - * @return {!goog.color.Hsv} hsv representation of the color. - */ -goog.color.hexToHsl = function(hex) { - var rgb = goog.color.hexToRgb(hex); - return goog.color.rgbToHsl(rgb[0], rgb[1], rgb[2]); -}; - - -/** - * Converts from h,s,l values to a hex string - * @param {number} h Hue, in [0, 360]. - * @param {number} s Saturation, in [0, 1]. - * @param {number} l Luminosity, in [0, 1]. - * @return {string} hex representation of the color. - */ -goog.color.hslToHex = function(h, s, l) { - return goog.color.rgbArrayToHex(goog.color.hslToRgb(h, s, l)); -}; - - -/** - * Converts from an hsl array to a hex string - * @param {goog.color.Hsl} hsl hsl representation of the color. - * @return {string} hex representation of the color. - */ -goog.color.hslArrayToHex = function(hsl) { - return goog.color.rgbArrayToHex(goog.color.hslToRgb(hsl[0], hsl[1], hsl[2])); -}; - - -/** - * Converts a hex representation of a color to HSV - * @param {string} hex Color to convert. - * @return {!goog.color.Hsv} hsv representation of the color. - */ -goog.color.hexToHsv = function(hex) { - return goog.color.rgbArrayToHsv(goog.color.hexToRgb(hex)); -}; - - -/** - * Converts from h,s,v values to a hex string - * @param {number} h Hue, in [0, 360]. - * @param {number} s Saturation, in [0, 1]. - * @param {number} v Value, in [0, 255]. - * @return {string} hex representation of the color. - */ -goog.color.hsvToHex = function(h, s, v) { - return goog.color.rgbArrayToHex(goog.color.hsvToRgb(h, s, v)); -}; - - -/** - * Converts from an HSV array to a hex string - * @param {goog.color.Hsv} hsv hsv representation of the color. - * @return {string} hex representation of the color. - */ -goog.color.hsvArrayToHex = function(hsv) { - return goog.color.hsvToHex(hsv[0], hsv[1], hsv[2]); -}; - - -/** - * Calculates the Euclidean distance between two color vectors on an HSL sphere. - * A demo of the sphere can be found at: - * http://en.wikipedia.org/wiki/HSL_color_space - * In short, a vector for color (H, S, L) in this system can be expressed as - * (S*L'*cos(2*PI*H), S*L'*sin(2*PI*H), L), where L' = abs(L - 0.5), and we - * simply calculate the 1-2 distance using these coordinates - * @param {goog.color.Hsl} hsl1 First color in hsl representation. - * @param {goog.color.Hsl} hsl2 Second color in hsl representation. - * @return {number} Distance between the two colors, in the range [0, 1]. - */ -goog.color.hslDistance = function(hsl1, hsl2) { - var sl1, sl2; - if (hsl1[2] <= 0.5) { - sl1 = hsl1[1] * hsl1[2]; - } else { - sl1 = hsl1[1] * (1.0 - hsl1[2]); - } - - if (hsl2[2] <= 0.5) { - sl2 = hsl2[1] * hsl2[2]; - } else { - sl2 = hsl2[1] * (1.0 - hsl2[2]); - } - - var h1 = hsl1[0] / 360.0; - var h2 = hsl2[0] / 360.0; - var dh = (h1 - h2) * 2.0 * Math.PI; - return (hsl1[2] - hsl2[2]) * (hsl1[2] - hsl2[2]) + - sl1 * sl1 + sl2 * sl2 - 2 * sl1 * sl2 * Math.cos(dh); -}; - - -/** - * Blend two colors together, using the specified factor to indicate the weight - * given to the first color - * @param {goog.color.Rgb} rgb1 First color represented in rgb. - * @param {goog.color.Rgb} rgb2 Second color represented in rgb. - * @param {number} factor The weight to be given to rgb1 over rgb2. Values - * should be in the range [0, 1]. If less than 0, factor will be set to 0. - * If greater than 1, factor will be set to 1. - * @return {!goog.color.Rgb} Combined color represented in rgb. - */ -goog.color.blend = function(rgb1, rgb2, factor) { - factor = goog.math.clamp(factor, 0, 1); - - return [ - Math.round(factor * rgb1[0] + (1.0 - factor) * rgb2[0]), - Math.round(factor * rgb1[1] + (1.0 - factor) * rgb2[1]), - Math.round(factor * rgb1[2] + (1.0 - factor) * rgb2[2]) - ]; -}; - - -/** - * Adds black to the specified color, darkening it - * @param {goog.color.Rgb} rgb rgb representation of the color. - * @param {number} factor Number in the range [0, 1]. 0 will do nothing, while - * 1 will return black. If less than 0, factor will be set to 0. If greater - * than 1, factor will be set to 1. - * @return {!goog.color.Rgb} Combined rgb color. - */ -goog.color.darken = function(rgb, factor) { - var black = [0, 0, 0]; - return goog.color.blend(black, rgb, factor); -}; - - -/** - * Adds white to the specified color, lightening it - * @param {goog.color.Rgb} rgb rgb representation of the color. - * @param {number} factor Number in the range [0, 1]. 0 will do nothing, while - * 1 will return white. If less than 0, factor will be set to 0. If greater - * than 1, factor will be set to 1. - * @return {!goog.color.Rgb} Combined rgb color. - */ -goog.color.lighten = function(rgb, factor) { - var white = [255, 255, 255]; - return goog.color.blend(white, rgb, factor); -}; - - -/** - * Find the "best" (highest-contrast) of the suggested colors for the prime - * color. Uses W3C formula for judging readability and visual accessibility: - * http://www.w3.org/TR/AERT#color-contrast - * @param {goog.color.Rgb} prime Color represented as a rgb array. - * @param {Array<goog.color.Rgb>} suggestions Array of colors, - * each representing a rgb array. - * @return {!goog.color.Rgb} Highest-contrast color represented by an array.. - */ -goog.color.highContrast = function(prime, suggestions) { - var suggestionsWithDiff = []; - for (var i = 0; i < suggestions.length; i++) { - suggestionsWithDiff.push({ - color: suggestions[i], - diff: goog.color.yiqBrightnessDiff_(suggestions[i], prime) + - goog.color.colorDiff_(suggestions[i], prime) - }); - } - suggestionsWithDiff.sort(function(a, b) { - return b.diff - a.diff; - }); - return suggestionsWithDiff[0].color; -}; - - -/** - * Calculate brightness of a color according to YIQ formula (brightness is Y). - * More info on YIQ here: http://en.wikipedia.org/wiki/YIQ. Helper method for - * goog.color.highContrast() - * @param {goog.color.Rgb} rgb Color represented by a rgb array. - * @return {number} brightness (Y). - * @private - */ -goog.color.yiqBrightness_ = function(rgb) { - return Math.round((rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000); -}; - - -/** - * Calculate difference in brightness of two colors. Helper method for - * goog.color.highContrast() - * @param {goog.color.Rgb} rgb1 Color represented by a rgb array. - * @param {goog.color.Rgb} rgb2 Color represented by a rgb array. - * @return {number} Brightness difference. - * @private - */ -goog.color.yiqBrightnessDiff_ = function(rgb1, rgb2) { - return Math.abs(goog.color.yiqBrightness_(rgb1) - - goog.color.yiqBrightness_(rgb2)); -}; - - -/** - * Calculate color difference between two colors. Helper method for - * goog.color.highContrast() - * @param {goog.color.Rgb} rgb1 Color represented by a rgb array. - * @param {goog.color.Rgb} rgb2 Color represented by a rgb array. - * @return {number} Color difference. - * @private - */ -goog.color.colorDiff_ = function(rgb1, rgb2) { - return Math.abs(rgb1[0] - rgb2[0]) + Math.abs(rgb1[1] - rgb2[1]) + - Math.abs(rgb1[2] - rgb2[2]); -}; - -// We can't use goog.color or goog.color.alpha because they interally use a hex -// string representation that encodes each channel in a single byte. This -// causes occasional loss of precision and rounding errors, especially in the -// alpha channel. - -goog.provide('ol.Color'); -goog.provide('ol.color'); - -goog.require('goog.asserts'); -goog.require('goog.color'); -goog.require('goog.color.names'); -goog.require('goog.vec.Mat4'); -goog.require('ol'); -goog.require('ol.math'); - - -/** - * A color represented as a short array [red, green, blue, alpha]. - * red, green, and blue should be integers in the range 0..255 inclusive. - * alpha should be a float in the range 0..1 inclusive. - * @typedef {Array.<number>} - * @api - */ -ol.Color; - - -/** - * This RegExp matches # followed by 3 or 6 hex digits. - * @const - * @type {RegExp} - * @private - */ -ol.color.hexColorRe_ = /^#(?:[0-9a-f]{3}){1,2}$/i; - - -/** - * @see goog.color.rgbColorRe_ - * @const - * @type {RegExp} - * @private - */ -ol.color.rgbColorRe_ = - /^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i; - - -/** - * @see goog.color.alpha.rgbaColorRe_ - * @const - * @type {RegExp} - * @private - */ -ol.color.rgbaColorRe_ = - /^(?:rgba)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|1|0\.\d{0,10})\)$/i; - - -/** - * @param {ol.Color} dst Destination. - * @param {ol.Color} src Source. - * @param {ol.Color=} opt_color Color. - * @return {ol.Color} Color. - */ -ol.color.blend = function(dst, src, opt_color) { - // http://en.wikipedia.org/wiki/Alpha_compositing - // FIXME do we need to scale by 255? - var out = opt_color ? opt_color : []; - var dstA = dst[3]; - var srcA = src[3]; - if (dstA == 1) { - out[0] = (src[0] * srcA + dst[0] * (1 - srcA) + 0.5) | 0; - out[1] = (src[1] * srcA + dst[1] * (1 - srcA) + 0.5) | 0; - out[2] = (src[2] * srcA + dst[2] * (1 - srcA) + 0.5) | 0; - out[3] = 1; - } else if (srcA === 0) { - out[0] = dst[0]; - out[1] = dst[1]; - out[2] = dst[2]; - out[3] = dstA; - } else { - var outA = srcA + dstA * (1 - srcA); - if (outA === 0) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; - } else { - out[0] = ((src[0] * srcA + dst[0] * dstA * (1 - srcA)) / outA + 0.5) | 0; - out[1] = ((src[1] * srcA + dst[1] * dstA * (1 - srcA)) / outA + 0.5) | 0; - out[2] = ((src[2] * srcA + dst[2] * dstA * (1 - srcA)) / outA + 0.5) | 0; - out[3] = outA; - } - } - goog.asserts.assert(ol.color.isValid(out), - 'Output color of blend should be a valid color'); - return out; -}; - - -/** - * Return the color as an array. This function maintains a cache of calculated - * arrays which means the result should not be modified. - * @param {ol.Color|string} color Color. - * @return {ol.Color} Color. - * @api - */ -ol.color.asArray = function(color) { - if (goog.isArray(color)) { - return color; - } else { - goog.asserts.assert(goog.isString(color), 'Color should be a string'); - return ol.color.fromString(color); - } -}; - - -/** - * Return the color as an rgba string. - * @param {ol.Color|string} color Color. - * @return {string} Rgba string. - * @api - */ -ol.color.asString = function(color) { - if (goog.isString(color)) { - return color; - } else { - goog.asserts.assert(goog.isArray(color), 'Color should be an array'); - return ol.color.toString(color); - } -}; - - -/** - * @param {ol.Color} color1 Color1. - * @param {ol.Color} color2 Color2. - * @return {boolean} Equals. - */ -ol.color.equals = function(color1, color2) { - return color1 === color2 || ( - color1[0] == color2[0] && color1[1] == color2[1] && - color1[2] == color2[2] && color1[3] == color2[3]); -}; - - -/** - * @param {string} s String. - * @return {ol.Color} Color. - */ -ol.color.fromString = ( - /** - * @return {function(string): ol.Color} - */ - function() { - - // We maintain a small cache of parsed strings. To provide cheap LRU-like - // semantics, whenever the cache grows too large we simply delete an - // arbitrary 25% of the entries. - - /** - * @const - * @type {number} - */ - var MAX_CACHE_SIZE = 1024; - - /** - * @type {Object.<string, ol.Color>} - */ - var cache = {}; - - /** - * @type {number} - */ - var cacheSize = 0; - - return ( - /** - * @param {string} s String. - * @return {ol.Color} Color. - */ - function(s) { - var color; - if (cache.hasOwnProperty(s)) { - color = cache[s]; - } else { - if (cacheSize >= MAX_CACHE_SIZE) { - var i = 0; - var key; - for (key in cache) { - if ((i++ & 3) === 0) { - delete cache[key]; - --cacheSize; - } - } - } - color = ol.color.fromStringInternal_(s); - cache[s] = color; - ++cacheSize; - } - return color; - }); - - })(); - - -/** - * @param {string} s String. - * @private - * @return {ol.Color} Color. - */ -ol.color.fromStringInternal_ = function(s) { - - var isHex = false; - if (ol.ENABLE_NAMED_COLORS && goog.color.names.hasOwnProperty(s)) { - // goog.color.names does not have a type declaration, so add a typecast - s = /** @type {string} */ (goog.color.names[s]); - isHex = true; - } - - var r, g, b, a, color, match; - if (isHex || (match = ol.color.hexColorRe_.exec(s))) { // hex - var n = s.length - 1; // number of hex digits - goog.asserts.assert(n == 3 || n == 6, - 'Color string length should be 3 or 6'); - var d = n == 3 ? 1 : 2; // number of digits per channel - r = parseInt(s.substr(1 + 0 * d, d), 16); - g = parseInt(s.substr(1 + 1 * d, d), 16); - b = parseInt(s.substr(1 + 2 * d, d), 16); - if (d == 1) { - r = (r << 4) + r; - g = (g << 4) + g; - b = (b << 4) + b; - } - a = 1; - color = [r, g, b, a]; - goog.asserts.assert(ol.color.isValid(color), - 'Color should be a valid color'); - return color; - } else if ((match = ol.color.rgbaColorRe_.exec(s))) { // rgba() - r = Number(match[1]); - g = Number(match[2]); - b = Number(match[3]); - a = Number(match[4]); - color = [r, g, b, a]; - return ol.color.normalize(color, color); - } else if ((match = ol.color.rgbColorRe_.exec(s))) { // rgb() - r = Number(match[1]); - g = Number(match[2]); - b = Number(match[3]); - color = [r, g, b, 1]; - return ol.color.normalize(color, color); - } else { - goog.asserts.fail(s + ' is not a valid color'); - } - -}; - - -/** - * @param {ol.Color} color Color. - * @return {boolean} Is valid. - */ -ol.color.isValid = function(color) { - return 0 <= color[0] && color[0] < 256 && - 0 <= color[1] && color[1] < 256 && - 0 <= color[2] && color[2] < 256 && - 0 <= color[3] && color[3] <= 1; -}; - - -/** - * @param {ol.Color} color Color. - * @param {ol.Color=} opt_color Color. - * @return {ol.Color} Clamped color. - */ -ol.color.normalize = function(color, opt_color) { - var result = opt_color || []; - result[0] = ol.math.clamp((color[0] + 0.5) | 0, 0, 255); - result[1] = ol.math.clamp((color[1] + 0.5) | 0, 0, 255); - result[2] = ol.math.clamp((color[2] + 0.5) | 0, 0, 255); - result[3] = ol.math.clamp(color[3], 0, 1); - return result; -}; - - -/** - * @param {ol.Color} color Color. - * @return {string} String. - */ -ol.color.toString = function(color) { - var r = color[0]; - if (r != (r | 0)) { - r = (r + 0.5) | 0; - } - var g = color[1]; - if (g != (g | 0)) { - g = (g + 0.5) | 0; - } - var b = color[2]; - if (b != (b | 0)) { - b = (b + 0.5) | 0; - } - var a = color[3]; - return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; -}; - - -/** - * @param {!ol.Color} color Color. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {!ol.Color=} opt_color Color. - * @return {ol.Color} Transformed color. - */ -ol.color.transform = function(color, transform, opt_color) { - var result = opt_color ? opt_color : []; - result = goog.vec.Mat4.multVec3(transform, color, result); - goog.asserts.assert(goog.isArray(result), 'result should be an array'); - result[3] = color[3]; - return ol.color.normalize(result, result); -}; - - -/** - * @param {ol.Color|string} color1 Color2. - * @param {ol.Color|string} color2 Color2. - * @return {boolean} Equals. - */ -ol.color.stringOrColorEquals = function(color1, color2) { - if (color1 === color2 || color1 == color2) { - return true; - } - if (goog.isString(color1)) { - color1 = ol.color.fromString(color1); - } - if (goog.isString(color2)) { - color2 = ol.color.fromString(color2); - } - return ol.color.equals(color1, color2); -}; - -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Browser capability checks for the dom package. - * - */ - - -goog.provide('goog.dom.BrowserFeature'); - -goog.require('goog.userAgent'); - - -/** - * Enum of browser capabilities. - * @enum {boolean} - */ -goog.dom.BrowserFeature = { - /** - * Whether attributes 'name' and 'type' can be added to an element after it's - * created. False in Internet Explorer prior to version 9. - */ - CAN_ADD_NAME_OR_TYPE_ATTRIBUTES: !goog.userAgent.IE || - goog.userAgent.isDocumentModeOrHigher(9), - - /** - * Whether we can use element.children to access an element's Element - * children. Available since Gecko 1.9.1, IE 9. (IE<9 also includes comment - * nodes in the collection.) - */ - CAN_USE_CHILDREN_ATTRIBUTE: !goog.userAgent.GECKO && !goog.userAgent.IE || - goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) || - goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9.1'), - - /** - * Opera, Safari 3, and Internet Explorer 9 all support innerText but they - * include text nodes in script and style tags. Not document-mode-dependent. - */ - CAN_USE_INNER_TEXT: ( - goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9')), - - /** - * MSIE, Opera, and Safari>=4 support element.parentElement to access an - * element's parent if it is an Element. - */ - CAN_USE_PARENT_ELEMENT_PROPERTY: goog.userAgent.IE || goog.userAgent.OPERA || - goog.userAgent.WEBKIT, - - /** - * Whether NoScope elements need a scoped element written before them in - * innerHTML. - * MSDN: http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx#1 - */ - INNER_HTML_NEEDS_SCOPED_ELEMENT: goog.userAgent.IE, - - /** - * Whether we use legacy IE range API. - */ - LEGACY_IE_RANGES: goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9) -}; - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Defines the goog.dom.TagName enum. This enumerates - * all HTML tag names specified in either the the W3C HTML 4.01 index of - * elements or the HTML5 draft specification. - * - * References: - * http://www.w3.org/TR/html401/index/elements.html - * http://dev.w3.org/html5/spec/section-index.html - * - */ -goog.provide('goog.dom.TagName'); - - -/** - * Enum of all html tag names specified by the W3C HTML4.01 and HTML5 - * specifications. - * @enum {string} - */ -goog.dom.TagName = { - A: 'A', - ABBR: 'ABBR', - ACRONYM: 'ACRONYM', - ADDRESS: 'ADDRESS', - APPLET: 'APPLET', - AREA: 'AREA', - ARTICLE: 'ARTICLE', - ASIDE: 'ASIDE', - AUDIO: 'AUDIO', - B: 'B', - BASE: 'BASE', - BASEFONT: 'BASEFONT', - BDI: 'BDI', - BDO: 'BDO', - BIG: 'BIG', - BLOCKQUOTE: 'BLOCKQUOTE', - BODY: 'BODY', - BR: 'BR', - BUTTON: 'BUTTON', - CANVAS: 'CANVAS', - CAPTION: 'CAPTION', - CENTER: 'CENTER', - CITE: 'CITE', - CODE: 'CODE', - COL: 'COL', - COLGROUP: 'COLGROUP', - COMMAND: 'COMMAND', - DATA: 'DATA', - DATALIST: 'DATALIST', - DD: 'DD', - DEL: 'DEL', - DETAILS: 'DETAILS', - DFN: 'DFN', - DIALOG: 'DIALOG', - DIR: 'DIR', - DIV: 'DIV', - DL: 'DL', - DT: 'DT', - EM: 'EM', - EMBED: 'EMBED', - FIELDSET: 'FIELDSET', - FIGCAPTION: 'FIGCAPTION', - FIGURE: 'FIGURE', - FONT: 'FONT', - FOOTER: 'FOOTER', - FORM: 'FORM', - FRAME: 'FRAME', - FRAMESET: 'FRAMESET', - H1: 'H1', - H2: 'H2', - H3: 'H3', - H4: 'H4', - H5: 'H5', - H6: 'H6', - HEAD: 'HEAD', - HEADER: 'HEADER', - HGROUP: 'HGROUP', - HR: 'HR', - HTML: 'HTML', - I: 'I', - IFRAME: 'IFRAME', - IMG: 'IMG', - INPUT: 'INPUT', - INS: 'INS', - ISINDEX: 'ISINDEX', - KBD: 'KBD', - KEYGEN: 'KEYGEN', - LABEL: 'LABEL', - LEGEND: 'LEGEND', - LI: 'LI', - LINK: 'LINK', - MAP: 'MAP', - MARK: 'MARK', - MATH: 'MATH', - MENU: 'MENU', - META: 'META', - METER: 'METER', - NAV: 'NAV', - NOFRAMES: 'NOFRAMES', - NOSCRIPT: 'NOSCRIPT', - OBJECT: 'OBJECT', - OL: 'OL', - OPTGROUP: 'OPTGROUP', - OPTION: 'OPTION', - OUTPUT: 'OUTPUT', - P: 'P', - PARAM: 'PARAM', - PRE: 'PRE', - PROGRESS: 'PROGRESS', - Q: 'Q', - RP: 'RP', - RT: 'RT', - RUBY: 'RUBY', - S: 'S', - SAMP: 'SAMP', - SCRIPT: 'SCRIPT', - SECTION: 'SECTION', - SELECT: 'SELECT', - SMALL: 'SMALL', - SOURCE: 'SOURCE', - SPAN: 'SPAN', - STRIKE: 'STRIKE', - STRONG: 'STRONG', - STYLE: 'STYLE', - SUB: 'SUB', - SUMMARY: 'SUMMARY', - SUP: 'SUP', - SVG: 'SVG', - TABLE: 'TABLE', - TBODY: 'TBODY', - TD: 'TD', - TEMPLATE: 'TEMPLATE', - TEXTAREA: 'TEXTAREA', - TFOOT: 'TFOOT', - TH: 'TH', - THEAD: 'THEAD', - TIME: 'TIME', - TITLE: 'TITLE', - TR: 'TR', - TRACK: 'TRACK', - TT: 'TT', - U: 'U', - UL: 'UL', - VAR: 'VAR', - VIDEO: 'VIDEO', - WBR: 'WBR' -}; - -// Copyright 2014 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for HTML element tag names. - */ -goog.provide('goog.dom.tags'); - -goog.require('goog.object'); - - -/** - * The void elements specified by - * http://www.w3.org/TR/html-markup/syntax.html#void-elements. - * @const @private {!Object<string, boolean>} - */ -goog.dom.tags.VOID_TAGS_ = goog.object.createSet( - 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', - 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'); - - -/** - * Checks whether the tag is void (with no contents allowed and no legal end - * tag), for example 'br'. - * @param {string} tagName The tag name in lower case. - * @return {boolean} - */ -goog.dom.tags.isVoidTag = function(tagName) { - return goog.dom.tags.VOID_TAGS_[tagName] === true; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.string.TypedString'); - - - -/** - * Wrapper for strings that conform to a data type or language. - * - * Implementations of this interface are wrappers for strings, and typically - * associate a type contract with the wrapped string. Concrete implementations - * of this interface may choose to implement additional run-time type checking, - * see for example {@code goog.html.SafeHtml}. If available, client code that - * needs to ensure type membership of an object should use the type's function - * to assert type membership, such as {@code goog.html.SafeHtml.unwrap}. - * @interface - */ -goog.string.TypedString = function() {}; - - -/** - * Interface marker of the TypedString interface. - * - * This property can be used to determine at runtime whether or not an object - * implements this interface. All implementations of this interface set this - * property to {@code true}. - * @type {boolean} - */ -goog.string.TypedString.prototype.implementsGoogStringTypedString; - - -/** - * Retrieves this wrapped string's value. - * @return {!string} The wrapped string's value. - */ -goog.string.TypedString.prototype.getTypedStringValue; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.string.Const'); - -goog.require('goog.asserts'); -goog.require('goog.string.TypedString'); - - - -/** - * Wrapper for compile-time-constant strings. - * - * Const is a wrapper for strings that can only be created from program - * constants (i.e., string literals). This property relies on a custom Closure - * compiler check that {@code goog.string.Const.from} is only invoked on - * compile-time-constant expressions. - * - * Const is useful in APIs whose correct and secure use requires that certain - * arguments are not attacker controlled: Compile-time constants are inherently - * under the control of the application and not under control of external - * attackers, and hence are safe to use in such contexts. - * - * Instances of this type must be created via its factory method - * {@code goog.string.Const.from} and not by invoking its constructor. The - * constructor intentionally takes no parameters and the type is immutable; - * hence only a default instance corresponding to the empty string can be - * obtained via constructor invocation. - * - * @see goog.string.Const#from - * @constructor - * @final - * @struct - * @implements {goog.string.TypedString} - */ -goog.string.Const = function() { - /** - * The wrapped value of this Const object. The field has a purposely ugly - * name to make (non-compiled) code that attempts to directly access this - * field stand out. - * @private {string} - */ - this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ = ''; - - /** - * A type marker used to implement additional run-time type checking. - * @see goog.string.Const#unwrap - * @const - * @private - */ - this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ = - goog.string.Const.TYPE_MARKER_; -}; - - -/** - * @override - * @const - */ -goog.string.Const.prototype.implementsGoogStringTypedString = true; - - -/** - * Returns this Const's value a string. - * - * IMPORTANT: In code where it is security-relevant that an object's type is - * indeed {@code goog.string.Const}, use {@code goog.string.Const.unwrap} - * instead of this method. - * - * @see goog.string.Const#unwrap - * @override - */ -goog.string.Const.prototype.getTypedStringValue = function() { - return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_; -}; - - -/** - * Returns a debug-string representation of this value. - * - * To obtain the actual string value wrapped inside an object of this type, - * use {@code goog.string.Const.unwrap}. - * - * @see goog.string.Const#unwrap - * @override - */ -goog.string.Const.prototype.toString = function() { - return 'Const{' + - this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ + - '}'; -}; - - -/** - * Performs a runtime check that the provided object is indeed an instance - * of {@code goog.string.Const}, and returns its value. - * @param {!goog.string.Const} stringConst The object to extract from. - * @return {string} The Const object's contained string, unless the run-time - * type check fails. In that case, {@code unwrap} returns an innocuous - * string, or, if assertions are enabled, throws - * {@code goog.asserts.AssertionError}. - */ -goog.string.Const.unwrap = function(stringConst) { - // Perform additional run-time type-checking to ensure that stringConst is - // indeed an instance of the expected type. This provides some additional - // protection against security bugs due to application code that disables type - // checks. - if (stringConst instanceof goog.string.Const && - stringConst.constructor === goog.string.Const && - stringConst.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ === - goog.string.Const.TYPE_MARKER_) { - return stringConst. - stringConstValueWithSecurityContract__googStringSecurityPrivate_; - } else { - goog.asserts.fail('expected object of type Const, got \'' + - stringConst + '\''); - return 'type_error:Const'; - } -}; - - -/** - * Creates a Const object from a compile-time constant string. - * - * It is illegal to invoke this function on an expression whose - * compile-time-contant value cannot be determined by the Closure compiler. - * - * Correct invocations include, - * <pre> - * var s = goog.string.Const.from('hello'); - * var t = goog.string.Const.from('hello' + 'world'); - * </pre> - * - * In contrast, the following are illegal: - * <pre> - * var s = goog.string.Const.from(getHello()); - * var t = goog.string.Const.from('hello' + world); - * </pre> - * - * TODO(xtof): Compile-time checks that this function is only called - * with compile-time constant expressions. - * - * @param {string} s A constant string from which to create a Const. - * @return {!goog.string.Const} A Const object initialized to stringConst. - */ -goog.string.Const.from = function(s) { - return goog.string.Const.create__googStringSecurityPrivate_(s); -}; - - -/** - * Type marker for the Const type, used to implement additional run-time - * type checking. - * @const {!Object} - * @private - */ -goog.string.Const.TYPE_MARKER_ = {}; - - -/** - * Utility method to create Const instances. - * @param {string} s The string to initialize the Const object with. - * @return {!goog.string.Const} The initialized Const object. - * @private - */ -goog.string.Const.create__googStringSecurityPrivate_ = function(s) { - var stringConst = new goog.string.Const(); - stringConst.stringConstValueWithSecurityContract__googStringSecurityPrivate_ = - s; - return stringConst; -}; - -// Copyright 2014 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview The SafeStyle type and its builders. - * - * TODO(xtof): Link to document stating type contract. - */ - -goog.provide('goog.html.SafeStyle'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.string'); -goog.require('goog.string.Const'); -goog.require('goog.string.TypedString'); - - - -/** - * A string-like object which represents a sequence of CSS declarations - * ({@code propertyName1: propertyvalue1; propertyName2: propertyValue2; ...}) - * and that carries the security type contract that its value, as a string, - * will not cause untrusted script execution (XSS) when evaluated as CSS in a - * browser. - * - * Instances of this type must be created via the factory methods - * ({@code goog.html.SafeStyle.create} or - * {@code goog.html.SafeStyle.fromConstant}) and not by invoking its - * constructor. The constructor intentionally takes no parameters and the type - * is immutable; hence only a default instance corresponding to the empty string - * can be obtained via constructor invocation. - * - * A SafeStyle's string representation ({@link #getTypedStringValue()}) can - * safely: - * <ul> - * <li>Be interpolated as the entire content of a *quoted* HTML style - * attribute, or before already existing properties. The SafeStyle string - * *must be HTML-attribute-escaped* (where " and ' are escaped) before - * interpolation. - * <li>Be interpolated as the entire content of a {}-wrapped block within a - * stylesheet, or before already existing properties. The SafeStyle string - * should not be escaped before interpolation. SafeStyle's contract also - * guarantees that the string will not be able to introduce new properties - * or elide existing ones. - * <li>Be assigned to the style property of a DOM node. The SafeStyle string - * should not be escaped before being assigned to the property. - * </ul> - * - * A SafeStyle may never contain literal angle brackets. Otherwise, it could - * be unsafe to place a SafeStyle into a <style> tag (where it can't - * be HTML escaped). For example, if the SafeStyle containing - * "{@code font: 'foo <style/><script>evil</script>'}" were - * interpolated within a <style> tag, this would then break out of the - * style context into HTML. - * - * A SafeStyle may contain literal single or double quotes, and as such the - * entire style string must be escaped when used in a style attribute (if - * this were not the case, the string could contain a matching quote that - * would escape from the style attribute). - * - * Values of this type must be composable, i.e. for any two values - * {@code style1} and {@code style2} of this type, - * {@code goog.html.SafeStyle.unwrap(style1) + - * goog.html.SafeStyle.unwrap(style2)} must itself be a value that satisfies - * the SafeStyle type constraint. This requirement implies that for any value - * {@code style} of this type, {@code goog.html.SafeStyle.unwrap(style)} must - * not end in a "property value" or "property name" context. For example, - * a value of {@code background:url("} or {@code font-} would not satisfy the - * SafeStyle contract. This is because concatenating such strings with a - * second value that itself does not contain unsafe CSS can result in an - * overall string that does. For example, if {@code javascript:evil())"} is - * appended to {@code background:url("}, the resulting string may result in - * the execution of a malicious script. - * - * TODO(user): Consider whether we should implement UTF-8 interchange - * validity checks and blacklisting of newlines (including Unicode ones) and - * other whitespace characters (\t, \f). Document here if so and also update - * SafeStyle.fromConstant(). - * - * The following example values comply with this type's contract: - * <ul> - * <li><pre>width: 1em;</pre> - * <li><pre>height:1em;</pre> - * <li><pre>width: 1em;height: 1em;</pre> - * <li><pre>background:url('http://url');</pre> - * </ul> - * In addition, the empty string is safe for use in a CSS attribute. - * - * The following example values do NOT comply with this type's contract: - * <ul> - * <li><pre>background: red</pre> (missing a trailing semi-colon) - * <li><pre>background:</pre> (missing a value and a trailing semi-colon) - * <li><pre>1em</pre> (missing an attribute name, which provides context for - * the value) - * </ul> - * - * @see goog.html.SafeStyle#create - * @see goog.html.SafeStyle#fromConstant - * @see http://www.w3.org/TR/css3-syntax/ - * @constructor - * @final - * @struct - * @implements {goog.string.TypedString} - */ -goog.html.SafeStyle = function() { - /** - * The contained value of this SafeStyle. The field has a purposely - * ugly name to make (non-compiled) code that attempts to directly access this - * field stand out. - * @private {string} - */ - this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = ''; - - /** - * A type marker used to implement additional run-time type checking. - * @see goog.html.SafeStyle#unwrap - * @const - * @private - */ - this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = - goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - - -/** - * @override - * @const - */ -goog.html.SafeStyle.prototype.implementsGoogStringTypedString = true; - - -/** - * Type marker for the SafeStyle type, used to implement additional - * run-time type checking. - * @const {!Object} - * @private - */ -goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - - -/** - * Creates a SafeStyle object from a compile-time constant string. - * - * {@code style} should be in the format - * {@code name: value; [name: value; ...]} and must not have any < or > - * characters in it. This is so that SafeStyle's contract is preserved, - * allowing the SafeStyle to correctly be interpreted as a sequence of CSS - * declarations and without affecting the syntactic structure of any - * surrounding CSS and HTML. - * - * This method performs basic sanity checks on the format of {@code style} - * but does not constrain the format of {@code name} and {@code value}, except - * for disallowing tag characters. - * - * @param {!goog.string.Const} style A compile-time-constant string from which - * to create a SafeStyle. - * @return {!goog.html.SafeStyle} A SafeStyle object initialized to - * {@code style}. - */ -goog.html.SafeStyle.fromConstant = function(style) { - var styleString = goog.string.Const.unwrap(style); - if (styleString.length === 0) { - return goog.html.SafeStyle.EMPTY; - } - goog.html.SafeStyle.checkStyle_(styleString); - goog.asserts.assert(goog.string.endsWith(styleString, ';'), - 'Last character of style string is not \';\': ' + styleString); - goog.asserts.assert(goog.string.contains(styleString, ':'), - 'Style string must contain at least one \':\', to ' + - 'specify a "name: value" pair: ' + styleString); - return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse( - styleString); -}; - - -/** - * Checks if the style definition is valid. - * @param {string} style - * @private - */ -goog.html.SafeStyle.checkStyle_ = function(style) { - goog.asserts.assert(!/[<>]/.test(style), - 'Forbidden characters in style string: ' + style); -}; - - -/** - * Returns this SafeStyle's value as a string. - * - * IMPORTANT: In code where it is security relevant that an object's type is - * indeed {@code SafeStyle}, use {@code goog.html.SafeStyle.unwrap} instead of - * this method. If in doubt, assume that it's security relevant. In particular, - * note that goog.html functions which return a goog.html type do not guarantee - * the returned instance is of the right type. For example: - * - * <pre> - * var fakeSafeHtml = new String('fake'); - * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype; - * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml); - * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by - * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml - * // instanceof goog.html.SafeHtml. - * </pre> - * - * @see goog.html.SafeStyle#unwrap - * @override - */ -goog.html.SafeStyle.prototype.getTypedStringValue = function() { - return this.privateDoNotAccessOrElseSafeStyleWrappedValue_; -}; - - -if (goog.DEBUG) { - /** - * Returns a debug string-representation of this value. - * - * To obtain the actual string value wrapped in a SafeStyle, use - * {@code goog.html.SafeStyle.unwrap}. - * - * @see goog.html.SafeStyle#unwrap - * @override - */ - goog.html.SafeStyle.prototype.toString = function() { - return 'SafeStyle{' + - this.privateDoNotAccessOrElseSafeStyleWrappedValue_ + '}'; - }; -} - - -/** - * Performs a runtime check that the provided object is indeed a - * SafeStyle object, and returns its value. - * - * @param {!goog.html.SafeStyle} safeStyle The object to extract from. - * @return {string} The safeStyle object's contained string, unless - * the run-time type check fails. In that case, {@code unwrap} returns an - * innocuous string, or, if assertions are enabled, throws - * {@code goog.asserts.AssertionError}. - */ -goog.html.SafeStyle.unwrap = function(safeStyle) { - // Perform additional Run-time type-checking to ensure that - // safeStyle is indeed an instance of the expected type. This - // provides some additional protection against security bugs due to - // application code that disables type checks. - // Specifically, the following checks are performed: - // 1. The object is an instance of the expected type. - // 2. The object is not an instance of a subclass. - // 3. The object carries a type marker for the expected type. "Faking" an - // object requires a reference to the type marker, which has names intended - // to stand out in code reviews. - if (safeStyle instanceof goog.html.SafeStyle && - safeStyle.constructor === goog.html.SafeStyle && - safeStyle.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === - goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) { - return safeStyle.privateDoNotAccessOrElseSafeStyleWrappedValue_; - } else { - goog.asserts.fail( - 'expected object of type SafeStyle, got \'' + safeStyle + '\''); - return 'type_error:SafeStyle'; - } -}; - - -/** - * Package-internal utility method to create SafeStyle instances. - * - * @param {string} style The string to initialize the SafeStyle object with. - * @return {!goog.html.SafeStyle} The initialized SafeStyle object. - * @package - */ -goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse = - function(style) { - return new goog.html.SafeStyle().initSecurityPrivateDoNotAccessOrElse_(style); -}; - - -/** - * Called from createSafeStyleSecurityPrivateDoNotAccessOrElse(). This - * method exists only so that the compiler can dead code eliminate static - * fields (like EMPTY) when they're not accessed. - * @param {string} style - * @return {!goog.html.SafeStyle} - * @private - */ -goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_ = function( - style) { - this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = style; - return this; -}; - - -/** - * A SafeStyle instance corresponding to the empty string. - * @const {!goog.html.SafeStyle} - */ -goog.html.SafeStyle.EMPTY = - goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(''); - - -/** - * The innocuous string generated by goog.html.SafeUrl.create when passed - * an unsafe value. - * @const {string} - */ -goog.html.SafeStyle.INNOCUOUS_STRING = 'zClosurez'; - - -/** - * Mapping of property names to their values. - * @typedef {!Object<string, goog.string.Const|string>} - */ -goog.html.SafeStyle.PropertyMap; - - -/** - * Creates a new SafeStyle object from the properties specified in the map. - * @param {goog.html.SafeStyle.PropertyMap} map Mapping of property names to - * their values, for example {'margin': '1px'}. Names must consist of - * [-_a-zA-Z0-9]. Values might be strings consisting of - * [-,.'"%_!# a-zA-Z0-9], where " and ' must be properly balanced. - * Other values must be wrapped in goog.string.Const. Null value causes - * skipping the property. - * @return {!goog.html.SafeStyle} - * @throws {Error} If invalid name is provided. - * @throws {goog.asserts.AssertionError} If invalid value is provided. With - * disabled assertions, invalid value is replaced by - * goog.html.SafeStyle.INNOCUOUS_STRING. - */ -goog.html.SafeStyle.create = function(map) { - var style = ''; - for (var name in map) { - if (!/^[-_a-zA-Z0-9]+$/.test(name)) { - throw Error('Name allows only [-_a-zA-Z0-9], got: ' + name); - } - var value = map[name]; - if (value == null) { - continue; - } - if (value instanceof goog.string.Const) { - value = goog.string.Const.unwrap(value); - // These characters can be used to change context and we don't want that - // even with const values. - goog.asserts.assert(!/[{;}]/.test(value), 'Value does not allow [{;}].'); - } else if (!goog.html.SafeStyle.VALUE_RE_.test(value)) { - goog.asserts.fail( - 'String value allows only [-,."\'%_!# a-zA-Z0-9], got: ' + value); - value = goog.html.SafeStyle.INNOCUOUS_STRING; - } else if (!goog.html.SafeStyle.hasBalancedQuotes_(value)) { - goog.asserts.fail('String value requires balanced quotes, got: ' + value); - value = goog.html.SafeStyle.INNOCUOUS_STRING; - } - style += name + ':' + value + ';'; - } - if (!style) { - return goog.html.SafeStyle.EMPTY; - } - goog.html.SafeStyle.checkStyle_(style); - return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse( - style); -}; - - -/** - * Checks that quotes (" and ') are properly balanced inside a string. Assumes - * that neither escape (\) nor any other character that could result in - * breaking out of a string parsing context are allowed; - * see http://www.w3.org/TR/css3-syntax/#string-token-diagram. - * @param {string} value Untrusted CSS property value. - * @return {boolean} True if property value is safe with respect to quote - * balancedness. - * @private - */ -goog.html.SafeStyle.hasBalancedQuotes_ = function(value) { - var outsideSingle = true; - var outsideDouble = true; - for (var i = 0; i < value.length; i++) { - var c = value.charAt(i); - if (c == "'" && outsideDouble) { - outsideSingle = !outsideSingle; - } else if (c == '"' && outsideSingle) { - outsideDouble = !outsideDouble; - } - } - return outsideSingle && outsideDouble; -}; - - -// Keep in sync with the error string in create(). -/** - * Regular expression for safe values. - * - * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure - * they're balanced. - * - * ',' allows multiple values to be assigned to the same property - * (e.g. background-attachment or font-family) and hence could allow - * multiple values to get injected, but that should pose no risk of XSS. - * @const {!RegExp} - * @private - */ -goog.html.SafeStyle.VALUE_RE_ = /^[-,."'%_!# a-zA-Z0-9]+$/; - - -/** - * Creates a new SafeStyle object by concatenating the values. - * @param {...(!goog.html.SafeStyle|!Array<!goog.html.SafeStyle>)} var_args - * SafeStyles to concatenate. - * @return {!goog.html.SafeStyle} - */ -goog.html.SafeStyle.concat = function(var_args) { - var style = ''; - - /** - * @param {!goog.html.SafeStyle|!Array<!goog.html.SafeStyle>} argument - */ - var addArgument = function(argument) { - if (goog.isArray(argument)) { - goog.array.forEach(argument, addArgument); - } else { - style += goog.html.SafeStyle.unwrap(argument); - } - }; - - goog.array.forEach(arguments, addArgument); - if (!style) { - return goog.html.SafeStyle.EMPTY; - } - return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse( - style); -}; - -// Copyright 2014 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview The SafeStyleSheet type and its builders. - * - * TODO(xtof): Link to document stating type contract. - */ - -goog.provide('goog.html.SafeStyleSheet'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.string'); -goog.require('goog.string.Const'); -goog.require('goog.string.TypedString'); - - - -/** - * A string-like object which represents a CSS style sheet and that carries the - * security type contract that its value, as a string, will not cause untrusted - * script execution (XSS) when evaluated as CSS in a browser. - * - * Instances of this type must be created via the factory method - * {@code goog.html.SafeStyleSheet.fromConstant} and not by invoking its - * constructor. The constructor intentionally takes no parameters and the type - * is immutable; hence only a default instance corresponding to the empty string - * can be obtained via constructor invocation. - * - * A SafeStyleSheet's string representation can safely be interpolated as the - * content of a style element within HTML. The SafeStyleSheet string should - * not be escaped before interpolation. - * - * Values of this type must be composable, i.e. for any two values - * {@code styleSheet1} and {@code styleSheet2} of this type, - * {@code goog.html.SafeStyleSheet.unwrap(styleSheet1) + - * goog.html.SafeStyleSheet.unwrap(styleSheet2)} must itself be a value that - * satisfies the SafeStyleSheet type constraint. This requirement implies that - * for any value {@code styleSheet} of this type, - * {@code goog.html.SafeStyleSheet.unwrap(styleSheet1)} must end in - * "beginning of rule" context. - - * A SafeStyleSheet can be constructed via security-reviewed unchecked - * conversions. In this case producers of SafeStyleSheet must ensure themselves - * that the SafeStyleSheet does not contain unsafe script. Note in particular - * that {@code <} is dangerous, even when inside CSS strings, and so should - * always be forbidden or CSS-escaped in user controlled input. For example, if - * {@code </style><script>evil</script>"} were interpolated - * inside a CSS string, it would break out of the context of the original - * style element and {@code evil} would execute. Also note that within an HTML - * style (raw text) element, HTML character references, such as - * {@code &lt;}, are not allowed. See - * http://www.w3.org/TR/html5/scripting-1.html#restrictions-for-contents-of-script-elements - * (similar considerations apply to the style element). - * - * @see goog.html.SafeStyleSheet#fromConstant - * @constructor - * @final - * @struct - * @implements {goog.string.TypedString} - */ -goog.html.SafeStyleSheet = function() { - /** - * The contained value of this SafeStyleSheet. The field has a purposely - * ugly name to make (non-compiled) code that attempts to directly access this - * field stand out. - * @private {string} - */ - this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = ''; - - /** - * A type marker used to implement additional run-time type checking. - * @see goog.html.SafeStyleSheet#unwrap - * @const - * @private - */ - this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = - goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - - -/** - * @override - * @const - */ -goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString = true; - - -/** - * Type marker for the SafeStyleSheet type, used to implement additional - * run-time type checking. - * @const {!Object} - * @private - */ -goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - - -/** - * Creates a new SafeStyleSheet object by concatenating values. - * @param {...(!goog.html.SafeStyleSheet|!Array<!goog.html.SafeStyleSheet>)} - * var_args Values to concatenate. - * @return {!goog.html.SafeStyleSheet} - */ -goog.html.SafeStyleSheet.concat = function(var_args) { - var result = ''; - - /** - * @param {!goog.html.SafeStyleSheet|!Array<!goog.html.SafeStyleSheet>} - * argument - */ - var addArgument = function(argument) { - if (goog.isArray(argument)) { - goog.array.forEach(argument, addArgument); - } else { - result += goog.html.SafeStyleSheet.unwrap(argument); - } - }; - - goog.array.forEach(arguments, addArgument); - return goog.html.SafeStyleSheet - .createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(result); -}; - - -/** - * Creates a SafeStyleSheet object from a compile-time constant string. - * - * {@code styleSheet} must not have any < characters in it, so that - * the syntactic structure of the surrounding HTML is not affected. - * - * @param {!goog.string.Const} styleSheet A compile-time-constant string from - * which to create a SafeStyleSheet. - * @return {!goog.html.SafeStyleSheet} A SafeStyleSheet object initialized to - * {@code styleSheet}. - */ -goog.html.SafeStyleSheet.fromConstant = function(styleSheet) { - var styleSheetString = goog.string.Const.unwrap(styleSheet); - if (styleSheetString.length === 0) { - return goog.html.SafeStyleSheet.EMPTY; - } - // > is a valid character in CSS selectors and there's no strict need to - // block it if we already block <. - goog.asserts.assert(!goog.string.contains(styleSheetString, '<'), - "Forbidden '<' character in style sheet string: " + styleSheetString); - return goog.html.SafeStyleSheet. - createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(styleSheetString); -}; - - -/** - * Returns this SafeStyleSheet's value as a string. - * - * IMPORTANT: In code where it is security relevant that an object's type is - * indeed {@code SafeStyleSheet}, use {@code goog.html.SafeStyleSheet.unwrap} - * instead of this method. If in doubt, assume that it's security relevant. In - * particular, note that goog.html functions which return a goog.html type do - * not guarantee the returned instance is of the right type. For example: - * - * <pre> - * var fakeSafeHtml = new String('fake'); - * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype; - * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml); - * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by - * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml - * // instanceof goog.html.SafeHtml. - * </pre> - * - * @see goog.html.SafeStyleSheet#unwrap - * @override - */ -goog.html.SafeStyleSheet.prototype.getTypedStringValue = function() { - return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_; -}; - - -if (goog.DEBUG) { - /** - * Returns a debug string-representation of this value. - * - * To obtain the actual string value wrapped in a SafeStyleSheet, use - * {@code goog.html.SafeStyleSheet.unwrap}. - * - * @see goog.html.SafeStyleSheet#unwrap - * @override - */ - goog.html.SafeStyleSheet.prototype.toString = function() { - return 'SafeStyleSheet{' + - this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ + '}'; - }; -} - - -/** - * Performs a runtime check that the provided object is indeed a - * SafeStyleSheet object, and returns its value. - * - * @param {!goog.html.SafeStyleSheet} safeStyleSheet The object to extract from. - * @return {string} The safeStyleSheet object's contained string, unless - * the run-time type check fails. In that case, {@code unwrap} returns an - * innocuous string, or, if assertions are enabled, throws - * {@code goog.asserts.AssertionError}. - */ -goog.html.SafeStyleSheet.unwrap = function(safeStyleSheet) { - // Perform additional Run-time type-checking to ensure that - // safeStyleSheet is indeed an instance of the expected type. This - // provides some additional protection against security bugs due to - // application code that disables type checks. - // Specifically, the following checks are performed: - // 1. The object is an instance of the expected type. - // 2. The object is not an instance of a subclass. - // 3. The object carries a type marker for the expected type. "Faking" an - // object requires a reference to the type marker, which has names intended - // to stand out in code reviews. - if (safeStyleSheet instanceof goog.html.SafeStyleSheet && - safeStyleSheet.constructor === goog.html.SafeStyleSheet && - safeStyleSheet.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === - goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) { - return safeStyleSheet.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_; - } else { - goog.asserts.fail( - "expected object of type SafeStyleSheet, got '" + safeStyleSheet + - "'"); - return 'type_error:SafeStyleSheet'; - } -}; - - -/** - * Package-internal utility method to create SafeStyleSheet instances. - * - * @param {string} styleSheet The string to initialize the SafeStyleSheet - * object with. - * @return {!goog.html.SafeStyleSheet} The initialized SafeStyleSheet object. - * @package - */ -goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse = - function(styleSheet) { - return new goog.html.SafeStyleSheet().initSecurityPrivateDoNotAccessOrElse_( - styleSheet); -}; - - -/** - * Called from createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(). This - * method exists only so that the compiler can dead code eliminate static - * fields (like EMPTY) when they're not accessed. - * @param {string} styleSheet - * @return {!goog.html.SafeStyleSheet} - * @private - */ -goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_ = - function(styleSheet) { - this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = styleSheet; - return this; -}; - - -/** - * A SafeStyleSheet instance corresponding to the empty string. - * @const {!goog.html.SafeStyleSheet} - */ -goog.html.SafeStyleSheet.EMPTY = - goog.html.SafeStyleSheet. - createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(''); - -// Copyright 2015 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Wrapper for URL and its createObjectUrl and revokeObjectUrl - * methods that are part of the HTML5 File API. - */ - -goog.provide('goog.fs.url'); - - -/** - * Creates a blob URL for a blob object. - * Throws an error if the browser does not support Object Urls. - * - * @param {!Blob} blob The object for which to create the URL. - * @return {string} The URL for the object. - */ -goog.fs.url.createObjectUrl = function(blob) { - return goog.fs.url.getUrlObject_().createObjectURL(blob); -}; - - -/** - * Revokes a URL created by {@link goog.fs.url.createObjectUrl}. - * Throws an error if the browser does not support Object Urls. - * - * @param {string} url The URL to revoke. - */ -goog.fs.url.revokeObjectUrl = function(url) { - goog.fs.url.getUrlObject_().revokeObjectURL(url); -}; - - -/** - * @typedef {{createObjectURL: (function(!Blob): string), - * revokeObjectURL: function(string): void}} - */ -goog.fs.url.UrlObject_; - - -/** - * Get the object that has the createObjectURL and revokeObjectURL functions for - * this browser. - * - * @return {goog.fs.url.UrlObject_} The object for this browser. - * @private - */ -goog.fs.url.getUrlObject_ = function() { - var urlObject = goog.fs.url.findUrlObject_(); - if (urlObject != null) { - return urlObject; - } else { - throw Error('This browser doesn\'t seem to support blob URLs'); - } -}; - - -/** - * Finds the object that has the createObjectURL and revokeObjectURL functions - * for this browser. - * - * @return {?goog.fs.url.UrlObject_} The object for this browser or null if the - * browser does not support Object Urls. - * @suppress {unnecessaryCasts} Depending on how the code is compiled, casting - * goog.global to UrlObject_ may result in unnecessary cast warning. - * However, the cast cannot be removed because with different set of - * compiler flags, the cast is indeed necessary. As such, silencing it. - * @private - */ -goog.fs.url.findUrlObject_ = function() { - // This is what the spec says to do - // http://dev.w3.org/2006/webapi/FileAPI/#dfn-createObjectURL - if (goog.isDef(goog.global.URL) && - goog.isDef(goog.global.URL.createObjectURL)) { - return /** @type {goog.fs.url.UrlObject_} */ (goog.global.URL); - // This is what Chrome does (as of 10.0.648.6 dev) - } else if (goog.isDef(goog.global.webkitURL) && - goog.isDef(goog.global.webkitURL.createObjectURL)) { - return /** @type {goog.fs.url.UrlObject_} */ (goog.global.webkitURL); - // This is what the spec used to say to do - } else if (goog.isDef(goog.global.createObjectURL)) { - return /** @type {goog.fs.url.UrlObject_} */ (goog.global); - } else { - return null; - } -}; - - -/** - * Checks whether this browser supports Object Urls. If not, calls to - * createObjectUrl and revokeObjectUrl will result in an error. - * - * @return {boolean} True if this browser supports Object Urls. - */ -goog.fs.url.browserSupportsObjectUrls = function() { - return goog.fs.url.findUrlObject_() != null; -}; - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utility functions for supporting Bidi issues. - */ - - -/** - * Namespace for bidi supporting functions. - */ -goog.provide('goog.i18n.bidi'); -goog.provide('goog.i18n.bidi.Dir'); -goog.provide('goog.i18n.bidi.DirectionalString'); -goog.provide('goog.i18n.bidi.Format'); - - -/** - * @define {boolean} FORCE_RTL forces the {@link goog.i18n.bidi.IS_RTL} constant - * to say that the current locale is a RTL locale. This should only be used - * if you want to override the default behavior for deciding whether the - * current locale is RTL or not. - * - * {@see goog.i18n.bidi.IS_RTL} - */ -goog.define('goog.i18n.bidi.FORCE_RTL', false); - - -/** - * Constant that defines whether or not the current locale is a RTL locale. - * If {@link goog.i18n.bidi.FORCE_RTL} is not true, this constant will default - * to check that {@link goog.LOCALE} is one of a few major RTL locales. - * - * <p>This is designed to be a maximally efficient compile-time constant. For - * example, for the default goog.LOCALE, compiling - * "if (goog.i18n.bidi.IS_RTL) alert('rtl') else {}" should produce no code. It - * is this design consideration that limits the implementation to only - * supporting a few major RTL locales, as opposed to the broader repertoire of - * something like goog.i18n.bidi.isRtlLanguage. - * - * <p>Since this constant refers to the directionality of the locale, it is up - * to the caller to determine if this constant should also be used for the - * direction of the UI. - * - * {@see goog.LOCALE} - * - * @type {boolean} - * - * TODO(user): write a test that checks that this is a compile-time constant. - */ -goog.i18n.bidi.IS_RTL = goog.i18n.bidi.FORCE_RTL || - ( - (goog.LOCALE.substring(0, 2).toLowerCase() == 'ar' || - goog.LOCALE.substring(0, 2).toLowerCase() == 'fa' || - goog.LOCALE.substring(0, 2).toLowerCase() == 'he' || - goog.LOCALE.substring(0, 2).toLowerCase() == 'iw' || - goog.LOCALE.substring(0, 2).toLowerCase() == 'ps' || - goog.LOCALE.substring(0, 2).toLowerCase() == 'sd' || - goog.LOCALE.substring(0, 2).toLowerCase() == 'ug' || - goog.LOCALE.substring(0, 2).toLowerCase() == 'ur' || - goog.LOCALE.substring(0, 2).toLowerCase() == 'yi') && - (goog.LOCALE.length == 2 || - goog.LOCALE.substring(2, 3) == '-' || - goog.LOCALE.substring(2, 3) == '_') - ) || ( - goog.LOCALE.length >= 3 && - goog.LOCALE.substring(0, 3).toLowerCase() == 'ckb' && - (goog.LOCALE.length == 3 || - goog.LOCALE.substring(3, 4) == '-' || - goog.LOCALE.substring(3, 4) == '_') - ); - - -/** - * Unicode formatting characters and directionality string constants. - * @enum {string} - */ -goog.i18n.bidi.Format = { - /** Unicode "Left-To-Right Embedding" (LRE) character. */ - LRE: '\u202A', - /** Unicode "Right-To-Left Embedding" (RLE) character. */ - RLE: '\u202B', - /** Unicode "Pop Directional Formatting" (PDF) character. */ - PDF: '\u202C', - /** Unicode "Left-To-Right Mark" (LRM) character. */ - LRM: '\u200E', - /** Unicode "Right-To-Left Mark" (RLM) character. */ - RLM: '\u200F' -}; - - -/** - * Directionality enum. - * @enum {number} - */ -goog.i18n.bidi.Dir = { - /** - * Left-to-right. - */ - LTR: 1, - - /** - * Right-to-left. - */ - RTL: -1, - - /** - * Neither left-to-right nor right-to-left. - */ - NEUTRAL: 0 -}; - - -/** - * 'right' string constant. - * @type {string} - */ -goog.i18n.bidi.RIGHT = 'right'; - - -/** - * 'left' string constant. - * @type {string} - */ -goog.i18n.bidi.LEFT = 'left'; - - -/** - * 'left' if locale is RTL, 'right' if not. - * @type {string} - */ -goog.i18n.bidi.I18N_RIGHT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.LEFT : - goog.i18n.bidi.RIGHT; - - -/** - * 'right' if locale is RTL, 'left' if not. - * @type {string} - */ -goog.i18n.bidi.I18N_LEFT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.RIGHT : - goog.i18n.bidi.LEFT; - - -/** - * Convert a directionality given in various formats to a goog.i18n.bidi.Dir - * constant. Useful for interaction with different standards of directionality - * representation. - * - * @param {goog.i18n.bidi.Dir|number|boolean|null} givenDir Directionality given - * in one of the following formats: - * 1. A goog.i18n.bidi.Dir constant. - * 2. A number (positive = LTR, negative = RTL, 0 = neutral). - * 3. A boolean (true = RTL, false = LTR). - * 4. A null for unknown directionality. - * @param {boolean=} opt_noNeutral Whether a givenDir of zero or - * goog.i18n.bidi.Dir.NEUTRAL should be treated as null, i.e. unknown, in - * order to preserve legacy behavior. - * @return {?goog.i18n.bidi.Dir} A goog.i18n.bidi.Dir constant matching the - * given directionality. If given null, returns null (i.e. unknown). - */ -goog.i18n.bidi.toDir = function(givenDir, opt_noNeutral) { - if (typeof givenDir == 'number') { - // This includes the non-null goog.i18n.bidi.Dir case. - return givenDir > 0 ? goog.i18n.bidi.Dir.LTR : - givenDir < 0 ? goog.i18n.bidi.Dir.RTL : - opt_noNeutral ? null : goog.i18n.bidi.Dir.NEUTRAL; - } else if (givenDir == null) { - return null; - } else { - // Must be typeof givenDir == 'boolean'. - return givenDir ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR; - } -}; - - -/** - * A practical pattern to identify strong LTR characters. This pattern is not - * theoretically correct according to the Unicode standard. It is simplified for - * performance and small code size. - * @type {string} - * @private - */ -goog.i18n.bidi.ltrChars_ = - 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF' + - '\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF'; - - -/** - * A practical pattern to identify strong RTL character. This pattern is not - * theoretically correct according to the Unicode standard. It is simplified - * for performance and small code size. - * @type {string} - * @private - */ -goog.i18n.bidi.rtlChars_ = - '\u0591-\u06EF\u06FA-\u07FF\u200F\uFB1D-\uFDFF\uFE70-\uFEFC'; - - -/** - * Simplified regular expression for an HTML tag (opening or closing) or an HTML - * escape. We might want to skip over such expressions when estimating the text - * directionality. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.htmlSkipReg_ = /<[^>]*>|&[^;]+;/g; - - -/** - * Returns the input text with spaces instead of HTML tags or HTML escapes, if - * opt_isStripNeeded is true. Else returns the input as is. - * Useful for text directionality estimation. - * Note: the function should not be used in other contexts; it is not 100% - * correct, but rather a good-enough implementation for directionality - * estimation purposes. - * @param {string} str The given string. - * @param {boolean=} opt_isStripNeeded Whether to perform the stripping. - * Default: false (to retain consistency with calling functions). - * @return {string} The given string cleaned of HTML tags / escapes. - * @private - */ -goog.i18n.bidi.stripHtmlIfNeeded_ = function(str, opt_isStripNeeded) { - return opt_isStripNeeded ? str.replace(goog.i18n.bidi.htmlSkipReg_, '') : - str; -}; - - -/** - * Regular expression to check for RTL characters. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.rtlCharReg_ = new RegExp('[' + goog.i18n.bidi.rtlChars_ + ']'); - - -/** - * Regular expression to check for LTR characters. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.ltrCharReg_ = new RegExp('[' + goog.i18n.bidi.ltrChars_ + ']'); - - -/** - * Test whether the given string has any RTL characters in it. - * @param {string} str The given string that need to be tested. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether the string contains RTL characters. - */ -goog.i18n.bidi.hasAnyRtl = function(str, opt_isHtml) { - return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_( - str, opt_isHtml)); -}; - - -/** - * Test whether the given string has any RTL characters in it. - * @param {string} str The given string that need to be tested. - * @return {boolean} Whether the string contains RTL characters. - * @deprecated Use hasAnyRtl. - */ -goog.i18n.bidi.hasRtlChar = goog.i18n.bidi.hasAnyRtl; - - -/** - * Test whether the given string has any LTR characters in it. - * @param {string} str The given string that need to be tested. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether the string contains LTR characters. - */ -goog.i18n.bidi.hasAnyLtr = function(str, opt_isHtml) { - return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_( - str, opt_isHtml)); -}; - - -/** - * Regular expression pattern to check if the first character in the string - * is LTR. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.ltrRe_ = new RegExp('^[' + goog.i18n.bidi.ltrChars_ + ']'); - - -/** - * Regular expression pattern to check if the first character in the string - * is RTL. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.rtlRe_ = new RegExp('^[' + goog.i18n.bidi.rtlChars_ + ']'); - - -/** - * Check if the first character in the string is RTL or not. - * @param {string} str The given string that need to be tested. - * @return {boolean} Whether the first character in str is an RTL char. - */ -goog.i18n.bidi.isRtlChar = function(str) { - return goog.i18n.bidi.rtlRe_.test(str); -}; - - -/** - * Check if the first character in the string is LTR or not. - * @param {string} str The given string that need to be tested. - * @return {boolean} Whether the first character in str is an LTR char. - */ -goog.i18n.bidi.isLtrChar = function(str) { - return goog.i18n.bidi.ltrRe_.test(str); -}; - - -/** - * Check if the first character in the string is neutral or not. - * @param {string} str The given string that need to be tested. - * @return {boolean} Whether the first character in str is a neutral char. - */ -goog.i18n.bidi.isNeutralChar = function(str) { - return !goog.i18n.bidi.isLtrChar(str) && !goog.i18n.bidi.isRtlChar(str); -}; - - -/** - * Regular expressions to check if a piece of text is of LTR directionality - * on first character with strong directionality. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.ltrDirCheckRe_ = new RegExp( - '^[^' + goog.i18n.bidi.rtlChars_ + ']*[' + goog.i18n.bidi.ltrChars_ + ']'); - - -/** - * Regular expressions to check if a piece of text is of RTL directionality - * on first character with strong directionality. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.rtlDirCheckRe_ = new RegExp( - '^[^' + goog.i18n.bidi.ltrChars_ + ']*[' + goog.i18n.bidi.rtlChars_ + ']'); - - -/** - * Check whether the first strongly directional character (if any) is RTL. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether RTL directionality is detected using the first - * strongly-directional character method. - */ -goog.i18n.bidi.startsWithRtl = function(str, opt_isHtml) { - return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_( - str, opt_isHtml)); -}; - - -/** - * Check whether the first strongly directional character (if any) is RTL. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether RTL directionality is detected using the first - * strongly-directional character method. - * @deprecated Use startsWithRtl. - */ -goog.i18n.bidi.isRtlText = goog.i18n.bidi.startsWithRtl; - - -/** - * Check whether the first strongly directional character (if any) is LTR. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether LTR directionality is detected using the first - * strongly-directional character method. - */ -goog.i18n.bidi.startsWithLtr = function(str, opt_isHtml) { - return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_( - str, opt_isHtml)); -}; - - -/** - * Check whether the first strongly directional character (if any) is LTR. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether LTR directionality is detected using the first - * strongly-directional character method. - * @deprecated Use startsWithLtr. - */ -goog.i18n.bidi.isLtrText = goog.i18n.bidi.startsWithLtr; - - -/** - * Regular expression to check if a string looks like something that must - * always be LTR even in RTL text, e.g. a URL. When estimating the - * directionality of text containing these, we treat these as weakly LTR, - * like numbers. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.isRequiredLtrRe_ = /^http:\/\/.*/; - - -/** - * Check whether the input string either contains no strongly directional - * characters or looks like a url. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether neutral directionality is detected. - */ -goog.i18n.bidi.isNeutralText = function(str, opt_isHtml) { - str = goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml); - return goog.i18n.bidi.isRequiredLtrRe_.test(str) || - !goog.i18n.bidi.hasAnyLtr(str) && !goog.i18n.bidi.hasAnyRtl(str); -}; - - -/** - * Regular expressions to check if the last strongly-directional character in a - * piece of text is LTR. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.ltrExitDirCheckRe_ = new RegExp( - '[' + goog.i18n.bidi.ltrChars_ + '][^' + goog.i18n.bidi.rtlChars_ + ']*$'); - - -/** - * Regular expressions to check if the last strongly-directional character in a - * piece of text is RTL. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.rtlExitDirCheckRe_ = new RegExp( - '[' + goog.i18n.bidi.rtlChars_ + '][^' + goog.i18n.bidi.ltrChars_ + ']*$'); - - -/** - * Check if the exit directionality a piece of text is LTR, i.e. if the last - * strongly-directional character in the string is LTR. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether LTR exit directionality was detected. - */ -goog.i18n.bidi.endsWithLtr = function(str, opt_isHtml) { - return goog.i18n.bidi.ltrExitDirCheckRe_.test( - goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)); -}; - - -/** - * Check if the exit directionality a piece of text is LTR, i.e. if the last - * strongly-directional character in the string is LTR. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether LTR exit directionality was detected. - * @deprecated Use endsWithLtr. - */ -goog.i18n.bidi.isLtrExitText = goog.i18n.bidi.endsWithLtr; - - -/** - * Check if the exit directionality a piece of text is RTL, i.e. if the last - * strongly-directional character in the string is RTL. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether RTL exit directionality was detected. - */ -goog.i18n.bidi.endsWithRtl = function(str, opt_isHtml) { - return goog.i18n.bidi.rtlExitDirCheckRe_.test( - goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)); -}; - - -/** - * Check if the exit directionality a piece of text is RTL, i.e. if the last - * strongly-directional character in the string is RTL. - * @param {string} str String being checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether RTL exit directionality was detected. - * @deprecated Use endsWithRtl. - */ -goog.i18n.bidi.isRtlExitText = goog.i18n.bidi.endsWithRtl; - - -/** - * A regular expression for matching right-to-left language codes. - * See {@link #isRtlLanguage} for the design. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.rtlLocalesRe_ = new RegExp( - '^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|' + - '.*[-_](Arab|Hebr|Thaa|Nkoo|Tfng))' + - '(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)', - 'i'); - - -/** - * Check if a BCP 47 / III language code indicates an RTL language, i.e. either: - * - a language code explicitly specifying one of the right-to-left scripts, - * e.g. "az-Arab", or<p> - * - a language code specifying one of the languages normally written in a - * right-to-left script, e.g. "fa" (Farsi), except ones explicitly specifying - * Latin or Cyrillic script (which are the usual LTR alternatives).<p> - * The list of right-to-left scripts appears in the 100-199 range in - * http://www.unicode.org/iso15924/iso15924-num.html, of which Arabic and - * Hebrew are by far the most widely used. We also recognize Thaana, N'Ko, and - * Tifinagh, which also have significant modern usage. The rest (Syriac, - * Samaritan, Mandaic, etc.) seem to have extremely limited or no modern usage - * and are not recognized to save on code size. - * The languages usually written in a right-to-left script are taken as those - * with Suppress-Script: Hebr|Arab|Thaa|Nkoo|Tfng in - * http://www.iana.org/assignments/language-subtag-registry, - * as well as Central (or Sorani) Kurdish (ckb), Sindhi (sd) and Uyghur (ug). - * Other subtags of the language code, e.g. regions like EG (Egypt), are - * ignored. - * @param {string} lang BCP 47 (a.k.a III) language code. - * @return {boolean} Whether the language code is an RTL language. - */ -goog.i18n.bidi.isRtlLanguage = function(lang) { - return goog.i18n.bidi.rtlLocalesRe_.test(lang); -}; - - -/** - * Regular expression for bracket guard replacement in html. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.bracketGuardHtmlRe_ = - /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?(>)+)/g; - - -/** - * Regular expression for bracket guard replacement in text. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.bracketGuardTextRe_ = - /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g; - - -/** - * Apply bracket guard using html span tag. This is to address the problem of - * messy bracket display frequently happens in RTL layout. - * @param {string} s The string that need to be processed. - * @param {boolean=} opt_isRtlContext specifies default direction (usually - * direction of the UI). - * @return {string} The processed string, with all bracket guarded. - */ -goog.i18n.bidi.guardBracketInHtml = function(s, opt_isRtlContext) { - var useRtl = opt_isRtlContext === undefined ? - goog.i18n.bidi.hasAnyRtl(s) : opt_isRtlContext; - if (useRtl) { - return s.replace(goog.i18n.bidi.bracketGuardHtmlRe_, - '<span dir=rtl>$&</span>'); - } - return s.replace(goog.i18n.bidi.bracketGuardHtmlRe_, - '<span dir=ltr>$&</span>'); -}; - - -/** - * Apply bracket guard using LRM and RLM. This is to address the problem of - * messy bracket display frequently happens in RTL layout. - * This version works for both plain text and html. But it does not work as - * good as guardBracketInHtml in some cases. - * @param {string} s The string that need to be processed. - * @param {boolean=} opt_isRtlContext specifies default direction (usually - * direction of the UI). - * @return {string} The processed string, with all bracket guarded. - */ -goog.i18n.bidi.guardBracketInText = function(s, opt_isRtlContext) { - var useRtl = opt_isRtlContext === undefined ? - goog.i18n.bidi.hasAnyRtl(s) : opt_isRtlContext; - var mark = useRtl ? goog.i18n.bidi.Format.RLM : goog.i18n.bidi.Format.LRM; - return s.replace(goog.i18n.bidi.bracketGuardTextRe_, mark + '$&' + mark); -}; - - -/** - * Enforce the html snippet in RTL directionality regardless overall context. - * If the html piece was enclosed by tag, dir will be applied to existing - * tag, otherwise a span tag will be added as wrapper. For this reason, if - * html snippet start with with tag, this tag must enclose the whole piece. If - * the tag already has a dir specified, this new one will override existing - * one in behavior (tested on FF and IE). - * @param {string} html The string that need to be processed. - * @return {string} The processed string, with directionality enforced to RTL. - */ -goog.i18n.bidi.enforceRtlInHtml = function(html) { - if (html.charAt(0) == '<') { - return html.replace(/<\w+/, '$& dir=rtl'); - } - // '\n' is important for FF so that it won't incorrectly merge span groups - return '\n<span dir=rtl>' + html + '</span>'; -}; - - -/** - * Enforce RTL on both end of the given text piece using unicode BiDi formatting - * characters RLE and PDF. - * @param {string} text The piece of text that need to be wrapped. - * @return {string} The wrapped string after process. - */ -goog.i18n.bidi.enforceRtlInText = function(text) { - return goog.i18n.bidi.Format.RLE + text + goog.i18n.bidi.Format.PDF; -}; - - -/** - * Enforce the html snippet in RTL directionality regardless overall context. - * If the html piece was enclosed by tag, dir will be applied to existing - * tag, otherwise a span tag will be added as wrapper. For this reason, if - * html snippet start with with tag, this tag must enclose the whole piece. If - * the tag already has a dir specified, this new one will override existing - * one in behavior (tested on FF and IE). - * @param {string} html The string that need to be processed. - * @return {string} The processed string, with directionality enforced to RTL. - */ -goog.i18n.bidi.enforceLtrInHtml = function(html) { - if (html.charAt(0) == '<') { - return html.replace(/<\w+/, '$& dir=ltr'); - } - // '\n' is important for FF so that it won't incorrectly merge span groups - return '\n<span dir=ltr>' + html + '</span>'; -}; - - -/** - * Enforce LTR on both end of the given text piece using unicode BiDi formatting - * characters LRE and PDF. - * @param {string} text The piece of text that need to be wrapped. - * @return {string} The wrapped string after process. - */ -goog.i18n.bidi.enforceLtrInText = function(text) { - return goog.i18n.bidi.Format.LRE + text + goog.i18n.bidi.Format.PDF; -}; - - -/** - * Regular expression to find dimensions such as "padding: .3 0.4ex 5px 6;" - * @type {RegExp} - * @private - */ -goog.i18n.bidi.dimensionsRe_ = - /:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g; - - -/** - * Regular expression for left. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.leftRe_ = /left/gi; - - -/** - * Regular expression for right. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.rightRe_ = /right/gi; - - -/** - * Placeholder regular expression for swapping. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.tempRe_ = /%%%%/g; - - -/** - * Swap location parameters and 'left'/'right' in CSS specification. The - * processed string will be suited for RTL layout. Though this function can - * cover most cases, there are always exceptions. It is suggested to put - * those exceptions in separate group of CSS string. - * @param {string} cssStr CSS spefication string. - * @return {string} Processed CSS specification string. - */ -goog.i18n.bidi.mirrorCSS = function(cssStr) { - return cssStr. - // reverse dimensions - replace(goog.i18n.bidi.dimensionsRe_, ':$1 $4 $3 $2'). - replace(goog.i18n.bidi.leftRe_, '%%%%'). // swap left and right - replace(goog.i18n.bidi.rightRe_, goog.i18n.bidi.LEFT). - replace(goog.i18n.bidi.tempRe_, goog.i18n.bidi.RIGHT); -}; - - -/** - * Regular expression for hebrew double quote substitution, finding quote - * directly after hebrew characters. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.doubleQuoteSubstituteRe_ = /([\u0591-\u05f2])"/g; - - -/** - * Regular expression for hebrew single quote substitution, finding quote - * directly after hebrew characters. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.singleQuoteSubstituteRe_ = /([\u0591-\u05f2])'/g; - - -/** - * Replace the double and single quote directly after a Hebrew character with - * GERESH and GERSHAYIM. In such case, most likely that's user intention. - * @param {string} str String that need to be processed. - * @return {string} Processed string with double/single quote replaced. - */ -goog.i18n.bidi.normalizeHebrewQuote = function(str) { - return str. - replace(goog.i18n.bidi.doubleQuoteSubstituteRe_, '$1\u05f4'). - replace(goog.i18n.bidi.singleQuoteSubstituteRe_, '$1\u05f3'); -}; - - -/** - * Regular expression to split a string into "words" for directionality - * estimation based on relative word counts. - * @type {RegExp} - * @private - */ -goog.i18n.bidi.wordSeparatorRe_ = /\s+/; - - -/** - * Regular expression to check if a string contains any numerals. Used to - * differentiate between completely neutral strings and those containing - * numbers, which are weakly LTR. - * - * Native Arabic digits (\u0660 - \u0669) are not included because although they - * do flow left-to-right inside a number, this is the case even if the overall - * directionality is RTL, and a mathematical expression using these digits is - * supposed to flow right-to-left overall, including unary plus and minus - * appearing to the right of a number, and this does depend on the overall - * directionality being RTL. The digits used in Farsi (\u06F0 - \u06F9), on the - * other hand, are included, since Farsi math (including unary plus and minus) - * does flow left-to-right. - * - * @type {RegExp} - * @private - */ -goog.i18n.bidi.hasNumeralsRe_ = /[\d\u06f0-\u06f9]/; - - -/** - * This constant controls threshold of RTL directionality. - * @type {number} - * @private - */ -goog.i18n.bidi.rtlDetectionThreshold_ = 0.40; - - -/** - * Estimates the directionality of a string based on relative word counts. - * If the number of RTL words is above a certain percentage of the total number - * of strongly directional words, returns RTL. - * Otherwise, if any words are strongly or weakly LTR, returns LTR. - * Otherwise, returns UNKNOWN, which is used to mean "neutral". - * Numbers are counted as weakly LTR. - * @param {string} str The string to be checked. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {goog.i18n.bidi.Dir} Estimated overall directionality of {@code str}. - */ -goog.i18n.bidi.estimateDirection = function(str, opt_isHtml) { - var rtlCount = 0; - var totalCount = 0; - var hasWeaklyLtr = false; - var tokens = goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml). - split(goog.i18n.bidi.wordSeparatorRe_); - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (goog.i18n.bidi.startsWithRtl(token)) { - rtlCount++; - totalCount++; - } else if (goog.i18n.bidi.isRequiredLtrRe_.test(token)) { - hasWeaklyLtr = true; - } else if (goog.i18n.bidi.hasAnyLtr(token)) { - totalCount++; - } else if (goog.i18n.bidi.hasNumeralsRe_.test(token)) { - hasWeaklyLtr = true; - } - } - - return totalCount == 0 ? - (hasWeaklyLtr ? goog.i18n.bidi.Dir.LTR : goog.i18n.bidi.Dir.NEUTRAL) : - (rtlCount / totalCount > goog.i18n.bidi.rtlDetectionThreshold_ ? - goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR); -}; - - -/** - * Check the directionality of a piece of text, return true if the piece of - * text should be laid out in RTL direction. - * @param {string} str The piece of text that need to be detected. - * @param {boolean=} opt_isHtml Whether str is HTML / HTML-escaped. - * Default: false. - * @return {boolean} Whether this piece of text should be laid out in RTL. - */ -goog.i18n.bidi.detectRtlDirectionality = function(str, opt_isHtml) { - return goog.i18n.bidi.estimateDirection(str, opt_isHtml) == - goog.i18n.bidi.Dir.RTL; -}; - - -/** - * Sets text input element's directionality and text alignment based on a - * given directionality. Does nothing if the given directionality is unknown or - * neutral. - * @param {Element} element Input field element to set directionality to. - * @param {goog.i18n.bidi.Dir|number|boolean|null} dir Desired directionality, - * given in one of the following formats: - * 1. A goog.i18n.bidi.Dir constant. - * 2. A number (positive = LRT, negative = RTL, 0 = neutral). - * 3. A boolean (true = RTL, false = LTR). - * 4. A null for unknown directionality. - */ -goog.i18n.bidi.setElementDirAndAlign = function(element, dir) { - if (element) { - dir = goog.i18n.bidi.toDir(dir); - if (dir) { - element.style.textAlign = - dir == goog.i18n.bidi.Dir.RTL ? - goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT; - element.dir = dir == goog.i18n.bidi.Dir.RTL ? 'rtl' : 'ltr'; - } - } -}; - - -/** - * Sets element dir based on estimated directionality of the given text. - * @param {!Element} element - * @param {string} text - */ -goog.i18n.bidi.setElementDirByTextDirectionality = function(element, text) { - switch (goog.i18n.bidi.estimateDirection(text)) { - case (goog.i18n.bidi.Dir.LTR): - element.dir = 'ltr'; - break; - case (goog.i18n.bidi.Dir.RTL): - element.dir = 'rtl'; - break; - default: - // Default for no direction, inherit from document. - element.removeAttribute('dir'); - } -}; - - - -/** - * Strings that have an (optional) known direction. - * - * Implementations of this interface are string-like objects that carry an - * attached direction, if known. - * @interface - */ -goog.i18n.bidi.DirectionalString = function() {}; - - -/** - * Interface marker of the DirectionalString interface. - * - * This property can be used to determine at runtime whether or not an object - * implements this interface. All implementations of this interface set this - * property to {@code true}. - * @type {boolean} - */ -goog.i18n.bidi.DirectionalString.prototype. - implementsGoogI18nBidiDirectionalString; - - -/** - * Retrieves this object's known direction (if any). - * @return {?goog.i18n.bidi.Dir} The known direction. Null if unknown. - */ -goog.i18n.bidi.DirectionalString.prototype.getDirection; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview The SafeUrl type and its builders. - * - * TODO(xtof): Link to document stating type contract. - */ - -goog.provide('goog.html.SafeUrl'); - -goog.require('goog.asserts'); -goog.require('goog.fs.url'); -goog.require('goog.i18n.bidi.Dir'); -goog.require('goog.i18n.bidi.DirectionalString'); -goog.require('goog.string.Const'); -goog.require('goog.string.TypedString'); - - - -/** - * A string that is safe to use in URL context in DOM APIs and HTML documents. - * - * A SafeUrl is a string-like object that carries the security type contract - * that its value as a string will not cause untrusted script execution - * when evaluated as a hyperlink URL in a browser. - * - * Values of this type are guaranteed to be safe to use in URL/hyperlink - * contexts, such as, assignment to URL-valued DOM properties, or - * interpolation into a HTML template in URL context (e.g., inside a href - * attribute), in the sense that the use will not result in a - * Cross-Site-Scripting vulnerability. - * - * Note that, as documented in {@code goog.html.SafeUrl.unwrap}, this type's - * contract does not guarantee that instances are safe to interpolate into HTML - * without appropriate escaping. - * - * Note also that this type's contract does not imply any guarantees regarding - * the resource the URL refers to. In particular, SafeUrls are <b>not</b> - * safe to use in a context where the referred-to resource is interpreted as - * trusted code, e.g., as the src of a script tag. - * - * Instances of this type must be created via the factory methods - * ({@code goog.html.SafeUrl.fromConstant}, {@code goog.html.SafeUrl.sanitize}), - * etc and not by invoking its constructor. The constructor intentionally - * takes no parameters and the type is immutable; hence only a default instance - * corresponding to the empty string can be obtained via constructor invocation. - * - * @see goog.html.SafeUrl#fromConstant - * @see goog.html.SafeUrl#from - * @see goog.html.SafeUrl#sanitize - * @constructor - * @final - * @struct - * @implements {goog.i18n.bidi.DirectionalString} - * @implements {goog.string.TypedString} - */ -goog.html.SafeUrl = function() { - /** - * The contained value of this SafeUrl. The field has a purposely ugly - * name to make (non-compiled) code that attempts to directly access this - * field stand out. - * @private {string} - */ - this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = ''; - - /** - * A type marker used to implement additional run-time type checking. - * @see goog.html.SafeUrl#unwrap - * @const - * @private - */ - this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = - goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - - -/** - * The innocuous string generated by goog.html.SafeUrl.sanitize when passed - * an unsafe URL. - * - * about:invalid is registered in - * http://www.w3.org/TR/css3-values/#about-invalid. - * http://tools.ietf.org/html/rfc6694#section-2.2.1 permits about URLs to - * contain a fragment, which is not to be considered when determining if an - * about URL is well-known. - * - * Using about:invalid seems preferable to using a fixed data URL, since - * browsers might choose to not report CSP violations on it, as legitimate - * CSS function calls to attr() can result in this URL being produced. It is - * also a standard URL which matches exactly the semantics we need: - * "The about:invalid URI references a non-existent document with a generic - * error condition. It can be used when a URI is necessary, but the default - * value shouldn't be resolveable as any type of document". - * - * @const {string} - */ -goog.html.SafeUrl.INNOCUOUS_STRING = 'about:invalid#zClosurez'; - - -/** - * @override - * @const - */ -goog.html.SafeUrl.prototype.implementsGoogStringTypedString = true; - - -/** - * Returns this SafeUrl's value a string. - * - * IMPORTANT: In code where it is security relevant that an object's type is - * indeed {@code SafeUrl}, use {@code goog.html.SafeUrl.unwrap} instead of this - * method. If in doubt, assume that it's security relevant. In particular, note - * that goog.html functions which return a goog.html type do not guarantee that - * the returned instance is of the right type. For example: - * - * <pre> - * var fakeSafeHtml = new String('fake'); - * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype; - * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml); - * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by - * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml instanceof - * // goog.html.SafeHtml. - * </pre> - * - * IMPORTANT: The guarantees of the SafeUrl type contract only extend to the - * behavior of browsers when interpreting URLs. Values of SafeUrl objects MUST - * be appropriately escaped before embedding in a HTML document. Note that the - * required escaping is context-sensitive (e.g. a different escaping is - * required for embedding a URL in a style property within a style - * attribute, as opposed to embedding in a href attribute). - * - * @see goog.html.SafeUrl#unwrap - * @override - */ -goog.html.SafeUrl.prototype.getTypedStringValue = function() { - return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_; -}; - - -/** - * @override - * @const - */ -goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString = true; - - -/** - * Returns this URLs directionality, which is always {@code LTR}. - * @override - */ -goog.html.SafeUrl.prototype.getDirection = function() { - return goog.i18n.bidi.Dir.LTR; -}; - - -if (goog.DEBUG) { - /** - * Returns a debug string-representation of this value. - * - * To obtain the actual string value wrapped in a SafeUrl, use - * {@code goog.html.SafeUrl.unwrap}. - * - * @see goog.html.SafeUrl#unwrap - * @override - */ - goog.html.SafeUrl.prototype.toString = function() { - return 'SafeUrl{' + this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ + - '}'; - }; -} - - -/** - * Performs a runtime check that the provided object is indeed a SafeUrl - * object, and returns its value. - * - * IMPORTANT: The guarantees of the SafeUrl type contract only extend to the - * behavior of browsers when interpreting URLs. Values of SafeUrl objects MUST - * be appropriately escaped before embedding in a HTML document. Note that the - * required escaping is context-sensitive (e.g. a different escaping is - * required for embedding a URL in a style property within a style - * attribute, as opposed to embedding in a href attribute). - * - * @param {!goog.html.SafeUrl} safeUrl The object to extract from. - * @return {string} The SafeUrl object's contained string, unless the run-time - * type check fails. In that case, {@code unwrap} returns an innocuous - * string, or, if assertions are enabled, throws - * {@code goog.asserts.AssertionError}. - */ -goog.html.SafeUrl.unwrap = function(safeUrl) { - // Perform additional Run-time type-checking to ensure that safeUrl is indeed - // an instance of the expected type. This provides some additional protection - // against security bugs due to application code that disables type checks. - // Specifically, the following checks are performed: - // 1. The object is an instance of the expected type. - // 2. The object is not an instance of a subclass. - // 3. The object carries a type marker for the expected type. "Faking" an - // object requires a reference to the type marker, which has names intended - // to stand out in code reviews. - if (safeUrl instanceof goog.html.SafeUrl && - safeUrl.constructor === goog.html.SafeUrl && - safeUrl.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === - goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) { - return safeUrl.privateDoNotAccessOrElseSafeHtmlWrappedValue_; - } else { - goog.asserts.fail('expected object of type SafeUrl, got \'' + - safeUrl + '\''); - return 'type_error:SafeUrl'; - - } -}; - - -/** - * Creates a SafeUrl object from a compile-time constant string. - * - * Compile-time constant strings are inherently program-controlled and hence - * trusted. - * - * @param {!goog.string.Const} url A compile-time-constant string from which to - * create a SafeUrl. - * @return {!goog.html.SafeUrl} A SafeUrl object initialized to {@code url}. - */ -goog.html.SafeUrl.fromConstant = function(url) { - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse( - goog.string.Const.unwrap(url)); -}; - - -/** - * A pattern that matches Blob or data types that can have SafeUrls created - * from URL.createObjectURL(blob) or via a data: URI. Only matches image and - * video types, currently. - * @const - * @private - */ -goog.html.SAFE_MIME_TYPE_PATTERN_ = - /^(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm))$/i; - - -/** - * Creates a SafeUrl wrapping a blob URL for the given {@code blob}. - * - * The blob URL is created with {@code URL.createObjectURL}. If the MIME type - * for {@code blob} is not of a known safe image or video MIME type, then the - * SafeUrl will wrap {@link #INNOCUOUS_STRING}. - * - * @see http://www.w3.org/TR/FileAPI/#url - * @param {!Blob} blob - * @return {!goog.html.SafeUrl} The blob URL, or an innocuous string wrapped - * as a SafeUrl. - */ -goog.html.SafeUrl.fromBlob = function(blob) { - var url = goog.html.SAFE_MIME_TYPE_PATTERN_.test(blob.type) ? - goog.fs.url.createObjectUrl(blob) : goog.html.SafeUrl.INNOCUOUS_STRING; - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url); -}; - - -/** - * Matches a base-64 data URL, with the first match group being the MIME type. - * @const - * @private - */ -goog.html.DATA_URL_PATTERN_ = /^data:([^;,]*);base64,[a-z0-9+\/]+=*$/i; - - -/** - * Creates a SafeUrl wrapping a data: URL, after validating it matches a - * known-safe image or video MIME type. - * - * @param {string} dataUrl A valid base64 data URL with one of the whitelisted - * image or video MIME types. - * @return {!goog.html.SafeUrl} A matching safe URL, or {@link INNOCUOUS_STRING} - * wrapped as a SafeUrl if it does not pass. - */ -goog.html.SafeUrl.fromDataUrl = function(dataUrl) { - // There's a slight risk here that a browser sniffs the content type if it - // doesn't know the MIME type and executes HTML within the data: URL. For this - // to cause XSS it would also have to execute the HTML in the same origin - // of the page with the link. It seems unlikely that both of these will - // happen, particularly in not really old IEs. - var match = dataUrl.match(goog.html.DATA_URL_PATTERN_); - var valid = match && goog.html.SAFE_MIME_TYPE_PATTERN_.test(match[1]); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse( - valid ? dataUrl : goog.html.SafeUrl.INNOCUOUS_STRING); -}; - - -/** - * A pattern that recognizes a commonly useful subset of URLs that satisfy - * the SafeUrl contract. - * - * This regular expression matches a subset of URLs that will not cause script - * execution if used in URL context within a HTML document. Specifically, this - * regular expression matches if (comment from here on and regex copied from - * Soy's EscapingConventions): - * (1) Either a protocol in a whitelist (http, https, mailto or ftp). - * (2) or no protocol. A protocol must be followed by a colon. The below - * allows that by allowing colons only after one of the characters [/?#]. - * A colon after a hash (#) must be in the fragment. - * Otherwise, a colon after a (?) must be in a query. - * Otherwise, a colon after a single solidus (/) must be in a path. - * Otherwise, a colon after a double solidus (//) must be in the authority - * (before port). - * - * The pattern disallows &, used in HTML entity declarations before - * one of the characters in [/?#]. This disallows HTML entities used in the - * protocol name, which should never happen, e.g. "http" for "http". - * It also disallows HTML entities in the first path part of a relative path, - * e.g. "foo<bar/baz". Our existing escaping functions should not produce - * that. More importantly, it disallows masking of a colon, - * e.g. "javascript:...". - * - * @private - * @const {!RegExp} - */ -goog.html.SAFE_URL_PATTERN_ = - /^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/i; - - -/** - * Creates a SafeUrl object from {@code url}. If {@code url} is a - * goog.html.SafeUrl then it is simply returned. Otherwise the input string is - * validated to match a pattern of commonly used safe URLs. The string is - * converted to UTF-8 and non-whitelisted characters are percent-encoded. The - * string wrapped by the created SafeUrl will thus contain only ASCII printable - * characters. - * - * {@code url} may be a URL with the http, https, mailto or ftp scheme, - * or a relative URL (i.e., a URL without a scheme; specifically, a - * scheme-relative, absolute-path-relative, or path-relative URL). - * - * {@code url} is converted to UTF-8 and non-whitelisted characters are - * percent-encoded. Whitelisted characters are '%' and, from RFC 3986, - * unreserved characters and reserved characters, with the exception of '\'', - * '(' and ')'. This ensures the the SafeUrl contains only ASCII-printable - * characters and reduces the chance of security bugs were it to be - * interpolated into a specific context without the necessary escaping. - * - * If {@code url} fails validation or does not UTF-16 decode correctly - * (JavaScript strings are UTF-16 encoded), this function returns a SafeUrl - * object containing an innocuous string, goog.html.SafeUrl.INNOCUOUS_STRING. - * - * @see http://url.spec.whatwg.org/#concept-relative-url - * @param {string|!goog.string.TypedString} url The URL to validate. - * @return {!goog.html.SafeUrl} The validated URL, wrapped as a SafeUrl. - */ -goog.html.SafeUrl.sanitize = function(url) { - if (url instanceof goog.html.SafeUrl) { - return url; - } - else if (url.implementsGoogStringTypedString) { - url = url.getTypedStringValue(); - } else { - url = String(url); - } - if (!goog.html.SAFE_URL_PATTERN_.test(url)) { - url = goog.html.SafeUrl.INNOCUOUS_STRING; - } - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url); -}; - - -/** - * Type marker for the SafeUrl type, used to implement additional run-time - * type checking. - * @const {!Object} - * @private - */ -goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - - -/** - * Package-internal utility method to create SafeUrl instances. - * - * @param {string} url The string to initialize the SafeUrl object with. - * @return {!goog.html.SafeUrl} The initialized SafeUrl object. - * @package - */ -goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse = function( - url) { - var safeUrl = new goog.html.SafeUrl(); - safeUrl.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = url; - return safeUrl; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview The TrustedResourceUrl type and its builders. - * - * TODO(xtof): Link to document stating type contract. - */ - -goog.provide('goog.html.TrustedResourceUrl'); - -goog.require('goog.asserts'); -goog.require('goog.i18n.bidi.Dir'); -goog.require('goog.i18n.bidi.DirectionalString'); -goog.require('goog.string.Const'); -goog.require('goog.string.TypedString'); - - - -/** - * A URL which is under application control and from which script, CSS, and - * other resources that represent executable code, can be fetched. - * - * Given that the URL can only be constructed from strings under application - * control and is used to load resources, bugs resulting in a malformed URL - * should not have a security impact and are likely to be easily detectable - * during testing. Given the wide number of non-RFC compliant URLs in use, - * stricter validation could prevent some applications from being able to use - * this type. - * - * Instances of this type must be created via the factory method, - * ({@code goog.html.TrustedResourceUrl.fromConstant}), and not by invoking its - * constructor. The constructor intentionally takes no parameters and the type - * is immutable; hence only a default instance corresponding to the empty - * string can be obtained via constructor invocation. - * - * @see goog.html.TrustedResourceUrl#fromConstant - * @constructor - * @final - * @struct - * @implements {goog.i18n.bidi.DirectionalString} - * @implements {goog.string.TypedString} - */ -goog.html.TrustedResourceUrl = function() { - /** - * The contained value of this TrustedResourceUrl. The field has a purposely - * ugly name to make (non-compiled) code that attempts to directly access this - * field stand out. - * @private {string} - */ - this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ = ''; - - /** - * A type marker used to implement additional run-time type checking. - * @see goog.html.TrustedResourceUrl#unwrap - * @const - * @private - */ - this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = - goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - - -/** - * @override - * @const - */ -goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString = true; - - -/** - * Returns this TrustedResourceUrl's value as a string. - * - * IMPORTANT: In code where it is security relevant that an object's type is - * indeed {@code TrustedResourceUrl}, use - * {@code goog.html.TrustedResourceUrl.unwrap} instead of this method. If in - * doubt, assume that it's security relevant. In particular, note that - * goog.html functions which return a goog.html type do not guarantee that - * the returned instance is of the right type. For example: - * - * <pre> - * var fakeSafeHtml = new String('fake'); - * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype; - * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml); - * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by - * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml instanceof - * // goog.html.SafeHtml. - * </pre> - * - * @see goog.html.TrustedResourceUrl#unwrap - * @override - */ -goog.html.TrustedResourceUrl.prototype.getTypedStringValue = function() { - return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_; -}; - - -/** - * @override - * @const - */ -goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString = - true; - - -/** - * Returns this URLs directionality, which is always {@code LTR}. - * @override - */ -goog.html.TrustedResourceUrl.prototype.getDirection = function() { - return goog.i18n.bidi.Dir.LTR; -}; - - -if (goog.DEBUG) { - /** - * Returns a debug string-representation of this value. - * - * To obtain the actual string value wrapped in a TrustedResourceUrl, use - * {@code goog.html.TrustedResourceUrl.unwrap}. - * - * @see goog.html.TrustedResourceUrl#unwrap - * @override - */ - goog.html.TrustedResourceUrl.prototype.toString = function() { - return 'TrustedResourceUrl{' + - this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ + '}'; - }; -} - - -/** - * Performs a runtime check that the provided object is indeed a - * TrustedResourceUrl object, and returns its value. - * - * @param {!goog.html.TrustedResourceUrl} trustedResourceUrl The object to - * extract from. - * @return {string} The trustedResourceUrl object's contained string, unless - * the run-time type check fails. In that case, {@code unwrap} returns an - * innocuous string, or, if assertions are enabled, throws - * {@code goog.asserts.AssertionError}. - */ -goog.html.TrustedResourceUrl.unwrap = function(trustedResourceUrl) { - // Perform additional Run-time type-checking to ensure that - // trustedResourceUrl is indeed an instance of the expected type. This - // provides some additional protection against security bugs due to - // application code that disables type checks. - // Specifically, the following checks are performed: - // 1. The object is an instance of the expected type. - // 2. The object is not an instance of a subclass. - // 3. The object carries a type marker for the expected type. "Faking" an - // object requires a reference to the type marker, which has names intended - // to stand out in code reviews. - if (trustedResourceUrl instanceof goog.html.TrustedResourceUrl && - trustedResourceUrl.constructor === goog.html.TrustedResourceUrl && - trustedResourceUrl - .TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === - goog.html.TrustedResourceUrl - .TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) { - return trustedResourceUrl - .privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_; - } else { - goog.asserts.fail('expected object of type TrustedResourceUrl, got \'' + - trustedResourceUrl + '\''); - return 'type_error:TrustedResourceUrl'; - - } -}; - - -/** - * Creates a TrustedResourceUrl object from a compile-time constant string. - * - * Compile-time constant strings are inherently program-controlled and hence - * trusted. - * - * @param {!goog.string.Const} url A compile-time-constant string from which to - * create a TrustedResourceUrl. - * @return {!goog.html.TrustedResourceUrl} A TrustedResourceUrl object - * initialized to {@code url}. - */ -goog.html.TrustedResourceUrl.fromConstant = function(url) { - return goog.html.TrustedResourceUrl - .createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse( - goog.string.Const.unwrap(url)); -}; - - -/** - * Type marker for the TrustedResourceUrl type, used to implement additional - * run-time type checking. - * @const {!Object} - * @private - */ -goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - - -/** - * Package-internal utility method to create TrustedResourceUrl instances. - * - * @param {string} url The string to initialize the TrustedResourceUrl object - * with. - * @return {!goog.html.TrustedResourceUrl} The initialized TrustedResourceUrl - * object. - * @package - */ -goog.html.TrustedResourceUrl. - createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse = function(url) { - var trustedResourceUrl = new goog.html.TrustedResourceUrl(); - trustedResourceUrl.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ = - url; - return trustedResourceUrl; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/** - * @fileoverview The SafeHtml type and its builders. - * - * TODO(xtof): Link to document stating type contract. - */ - -goog.provide('goog.html.SafeHtml'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.TagName'); -goog.require('goog.dom.tags'); -goog.require('goog.html.SafeStyle'); -goog.require('goog.html.SafeStyleSheet'); -goog.require('goog.html.SafeUrl'); -goog.require('goog.html.TrustedResourceUrl'); -goog.require('goog.i18n.bidi.Dir'); -goog.require('goog.i18n.bidi.DirectionalString'); -goog.require('goog.object'); -goog.require('goog.string'); -goog.require('goog.string.Const'); -goog.require('goog.string.TypedString'); - - - -/** - * A string that is safe to use in HTML context in DOM APIs and HTML documents. - * - * A SafeHtml is a string-like object that carries the security type contract - * that its value as a string will not cause untrusted script execution when - * evaluated as HTML in a browser. - * - * Values of this type are guaranteed to be safe to use in HTML contexts, - * such as, assignment to the innerHTML DOM property, or interpolation into - * a HTML template in HTML PC_DATA context, in the sense that the use will not - * result in a Cross-Site-Scripting vulnerability. - * - * Instances of this type must be created via the factory methods - * ({@code goog.html.SafeHtml.create}, {@code goog.html.SafeHtml.htmlEscape}), - * etc and not by invoking its constructor. The constructor intentionally - * takes no parameters and the type is immutable; hence only a default instance - * corresponding to the empty string can be obtained via constructor invocation. - * - * @see goog.html.SafeHtml#create - * @see goog.html.SafeHtml#htmlEscape - * @constructor - * @final - * @struct - * @implements {goog.i18n.bidi.DirectionalString} - * @implements {goog.string.TypedString} - */ -goog.html.SafeHtml = function() { - /** - * The contained value of this SafeHtml. The field has a purposely ugly - * name to make (non-compiled) code that attempts to directly access this - * field stand out. - * @private {string} - */ - this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = ''; - - /** - * A type marker used to implement additional run-time type checking. - * @see goog.html.SafeHtml#unwrap - * @const - * @private - */ - this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = - goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; - - /** - * This SafeHtml's directionality, or null if unknown. - * @private {?goog.i18n.bidi.Dir} - */ - this.dir_ = null; -}; - - -/** - * @override - * @const - */ -goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString = true; - - -/** @override */ -goog.html.SafeHtml.prototype.getDirection = function() { - return this.dir_; -}; - - -/** - * @override - * @const - */ -goog.html.SafeHtml.prototype.implementsGoogStringTypedString = true; - - -/** - * Returns this SafeHtml's value a string. - * - * IMPORTANT: In code where it is security relevant that an object's type is - * indeed {@code SafeHtml}, use {@code goog.html.SafeHtml.unwrap} instead of - * this method. If in doubt, assume that it's security relevant. In particular, - * note that goog.html functions which return a goog.html type do not guarantee - * that the returned instance is of the right type. For example: - * - * <pre> - * var fakeSafeHtml = new String('fake'); - * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype; - * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml); - * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by - * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml - * // instanceof goog.html.SafeHtml. - * </pre> - * - * @see goog.html.SafeHtml#unwrap - * @override - */ -goog.html.SafeHtml.prototype.getTypedStringValue = function() { - return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_; -}; - - -if (goog.DEBUG) { - /** - * Returns a debug string-representation of this value. - * - * To obtain the actual string value wrapped in a SafeHtml, use - * {@code goog.html.SafeHtml.unwrap}. - * - * @see goog.html.SafeHtml#unwrap - * @override - */ - goog.html.SafeHtml.prototype.toString = function() { - return 'SafeHtml{' + this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ + - '}'; - }; -} - - -/** - * Performs a runtime check that the provided object is indeed a SafeHtml - * object, and returns its value. - * @param {!goog.html.SafeHtml} safeHtml The object to extract from. - * @return {string} The SafeHtml object's contained string, unless the run-time - * type check fails. In that case, {@code unwrap} returns an innocuous - * string, or, if assertions are enabled, throws - * {@code goog.asserts.AssertionError}. - */ -goog.html.SafeHtml.unwrap = function(safeHtml) { - // Perform additional run-time type-checking to ensure that safeHtml is indeed - // an instance of the expected type. This provides some additional protection - // against security bugs due to application code that disables type checks. - // Specifically, the following checks are performed: - // 1. The object is an instance of the expected type. - // 2. The object is not an instance of a subclass. - // 3. The object carries a type marker for the expected type. "Faking" an - // object requires a reference to the type marker, which has names intended - // to stand out in code reviews. - if (safeHtml instanceof goog.html.SafeHtml && - safeHtml.constructor === goog.html.SafeHtml && - safeHtml.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === - goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) { - return safeHtml.privateDoNotAccessOrElseSafeHtmlWrappedValue_; - } else { - goog.asserts.fail('expected object of type SafeHtml, got \'' + - safeHtml + '\''); - return 'type_error:SafeHtml'; - } -}; - - -/** - * Shorthand for union of types that can sensibly be converted to strings - * or might already be SafeHtml (as SafeHtml is a goog.string.TypedString). - * @private - * @typedef {string|number|boolean|!goog.string.TypedString| - * !goog.i18n.bidi.DirectionalString} - */ -goog.html.SafeHtml.TextOrHtml_; - - -/** - * Returns HTML-escaped text as a SafeHtml object. - * - * If text is of a type that implements - * {@code goog.i18n.bidi.DirectionalString}, the directionality of the new - * {@code SafeHtml} object is set to {@code text}'s directionality, if known. - * Otherwise, the directionality of the resulting SafeHtml is unknown (i.e., - * {@code null}). - * - * @param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text to escape. If - * the parameter is of type SafeHtml it is returned directly (no escaping - * is done). - * @return {!goog.html.SafeHtml} The escaped text, wrapped as a SafeHtml. - */ -goog.html.SafeHtml.htmlEscape = function(textOrHtml) { - if (textOrHtml instanceof goog.html.SafeHtml) { - return textOrHtml; - } - var dir = null; - if (textOrHtml.implementsGoogI18nBidiDirectionalString) { - dir = textOrHtml.getDirection(); - } - var textAsString; - if (textOrHtml.implementsGoogStringTypedString) { - textAsString = textOrHtml.getTypedStringValue(); - } else { - textAsString = String(textOrHtml); - } - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse( - goog.string.htmlEscape(textAsString), dir); -}; - - -/** - * Returns HTML-escaped text as a SafeHtml object, with newlines changed to - * <br>. - * @param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text to escape. If - * the parameter is of type SafeHtml it is returned directly (no escaping - * is done). - * @return {!goog.html.SafeHtml} The escaped text, wrapped as a SafeHtml. - */ -goog.html.SafeHtml.htmlEscapePreservingNewlines = function(textOrHtml) { - if (textOrHtml instanceof goog.html.SafeHtml) { - return textOrHtml; - } - var html = goog.html.SafeHtml.htmlEscape(textOrHtml); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse( - goog.string.newLineToBr(goog.html.SafeHtml.unwrap(html)), - html.getDirection()); -}; - - -/** - * Returns HTML-escaped text as a SafeHtml object, with newlines changed to - * <br> and escaping whitespace to preserve spatial formatting. Character - * entity #160 is used to make it safer for XML. - * @param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text to escape. If - * the parameter is of type SafeHtml it is returned directly (no escaping - * is done). - * @return {!goog.html.SafeHtml} The escaped text, wrapped as a SafeHtml. - */ -goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces = function( - textOrHtml) { - if (textOrHtml instanceof goog.html.SafeHtml) { - return textOrHtml; - } - var html = goog.html.SafeHtml.htmlEscape(textOrHtml); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse( - goog.string.whitespaceEscape(goog.html.SafeHtml.unwrap(html)), - html.getDirection()); -}; - - -/** - * Coerces an arbitrary object into a SafeHtml object. - * - * If {@code textOrHtml} is already of type {@code goog.html.SafeHtml}, the same - * object is returned. Otherwise, {@code textOrHtml} is coerced to string, and - * HTML-escaped. If {@code textOrHtml} is of a type that implements - * {@code goog.i18n.bidi.DirectionalString}, its directionality, if known, is - * preserved. - * - * @param {!goog.html.SafeHtml.TextOrHtml_} textOrHtml The text or SafeHtml to - * coerce. - * @return {!goog.html.SafeHtml} The resulting SafeHtml object. - * @deprecated Use goog.html.SafeHtml.htmlEscape. - */ -goog.html.SafeHtml.from = goog.html.SafeHtml.htmlEscape; - - -/** - * @const - * @private - */ -goog.html.SafeHtml.VALID_NAMES_IN_TAG_ = /^[a-zA-Z0-9-]+$/; - - -/** - * Set of attributes containing URL as defined at - * http://www.w3.org/TR/html5/index.html#attributes-1. - * @private @const {!Object<string,boolean>} - */ -goog.html.SafeHtml.URL_ATTRIBUTES_ = goog.object.createSet('action', 'cite', - 'data', 'formaction', 'href', 'manifest', 'poster', 'src'); - - -/** - * Tags which are unsupported via create(). They might be supported via a - * tag-specific create method. These are tags which might require a - * TrustedResourceUrl in one of their attributes or a restricted type for - * their content. - * @private @const {!Object<string,boolean>} - */ -goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_ = goog.object.createSet( - goog.dom.TagName.EMBED, goog.dom.TagName.IFRAME, goog.dom.TagName.LINK, - goog.dom.TagName.OBJECT, goog.dom.TagName.SCRIPT, goog.dom.TagName.STYLE, - goog.dom.TagName.TEMPLATE); - - -/** - * @typedef {string|number|goog.string.TypedString| - * goog.html.SafeStyle.PropertyMap} - * @private - */ -goog.html.SafeHtml.AttributeValue_; - - -/** - * Creates a SafeHtml content consisting of a tag with optional attributes and - * optional content. - * - * For convenience tag names and attribute names are accepted as regular - * strings, instead of goog.string.Const. Nevertheless, you should not pass - * user-controlled values to these parameters. Note that these parameters are - * syntactically validated at runtime, and invalid values will result in - * an exception. - * - * Example usage: - * - * goog.html.SafeHtml.create('br'); - * goog.html.SafeHtml.create('div', {'class': 'a'}); - * goog.html.SafeHtml.create('p', {}, 'a'); - * goog.html.SafeHtml.create('p', {}, goog.html.SafeHtml.create('br')); - * - * goog.html.SafeHtml.create('span', { - * 'style': {'margin': '0'} - * }); - * - * To guarantee SafeHtml's type contract is upheld there are restrictions on - * attribute values and tag names. - * - * - For attributes which contain script code (on*), a goog.string.Const is - * required. - * - For attributes which contain style (style), a goog.html.SafeStyle or a - * goog.html.SafeStyle.PropertyMap is required. - * - For attributes which are interpreted as URLs (e.g. src, href) a - * goog.html.SafeUrl, goog.string.Const or string is required. If a string - * is passed, it will be sanitized with SafeUrl.sanitize(). - * - For tags which can load code, more specific goog.html.SafeHtml.create*() - * functions must be used. Tags which can load code and are not supported by - * this function are embed, iframe, link, object, script, style, and template. - * - * @param {string} tagName The name of the tag. Only tag names consisting of - * [a-zA-Z0-9-] are allowed. Tag names documented above are disallowed. - * @param {!Object<string, goog.html.SafeHtml.AttributeValue_>=} - * opt_attributes Mapping from attribute names to their values. Only - * attribute names consisting of [a-zA-Z0-9-] are allowed. Value of null or - * undefined causes the attribute to be omitted. - * @param {!goog.html.SafeHtml.TextOrHtml_| - * !Array<!goog.html.SafeHtml.TextOrHtml_>=} opt_content Content to - * HTML-escape and put inside the tag. This must be empty for void tags - * like <br>. Array elements are concatenated. - * @return {!goog.html.SafeHtml} The SafeHtml content with the tag. - * @throws {Error} If invalid tag name, attribute name, or attribute value is - * provided. - * @throws {goog.asserts.AssertionError} If content for void tag is provided. - */ -goog.html.SafeHtml.create = function(tagName, opt_attributes, opt_content) { - if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(tagName)) { - throw Error('Invalid tag name <' + tagName + '>.'); - } - if (tagName.toUpperCase() in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_) { - throw Error('Tag name <' + tagName + '> is not allowed for SafeHtml.'); - } - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse( - tagName, opt_attributes, opt_content); -}; - - -/** - * Creates a SafeHtml representing an iframe tag. - * - * By default the sandbox attribute is set to an empty value, which is the most - * secure option, as it confers the iframe the least privileges. If this - * is too restrictive then granting individual privileges is the preferable - * option. Unsetting the attribute entirely is the least secure option and - * should never be done unless it's stricly necessary. - * - * @param {goog.html.TrustedResourceUrl=} opt_src The value of the src - * attribute. If null or undefined src will not be set. - * @param {goog.html.SafeHtml=} opt_srcdoc The value of the srcdoc attribute. - * If null or undefined srcdoc will not be set. - * @param {!Object<string, goog.html.SafeHtml.AttributeValue_>=} - * opt_attributes Mapping from attribute names to their values. Only - * attribute names consisting of [a-zA-Z0-9-] are allowed. Value of null or - * undefined causes the attribute to be omitted. - * @param {!goog.html.SafeHtml.TextOrHtml_| - * !Array<!goog.html.SafeHtml.TextOrHtml_>=} opt_content Content to - * HTML-escape and put inside the tag. Array elements are concatenated. - * @return {!goog.html.SafeHtml} The SafeHtml content with the tag. - * @throws {Error} If invalid tag name, attribute name, or attribute value is - * provided. If opt_attributes contains the src or srcdoc attributes. - */ -goog.html.SafeHtml.createIframe = function( - opt_src, opt_srcdoc, opt_attributes, opt_content) { - var fixedAttributes = {}; - fixedAttributes['src'] = opt_src || null; - fixedAttributes['srcdoc'] = opt_srcdoc || null; - var defaultAttributes = {'sandbox': ''}; - var attributes = goog.html.SafeHtml.combineAttributes( - fixedAttributes, defaultAttributes, opt_attributes); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse( - 'iframe', attributes, opt_content); -}; - - -/** - * Creates a SafeHtml representing a style tag. The type attribute is set - * to "text/css". - * @param {!goog.html.SafeStyleSheet|!Array<!goog.html.SafeStyleSheet>} - * styleSheet Content to put inside the tag. Array elements are - * concatenated. - * @param {!Object<string, goog.html.SafeHtml.AttributeValue_>=} - * opt_attributes Mapping from attribute names to their values. Only - * attribute names consisting of [a-zA-Z0-9-] are allowed. Value of null or - * undefined causes the attribute to be omitted. - * @return {!goog.html.SafeHtml} The SafeHtml content with the tag. - * @throws {Error} If invalid attribute name or attribute value is provided. If - * opt_attributes contains the type attribute. - */ -goog.html.SafeHtml.createStyle = function(styleSheet, opt_attributes) { - var fixedAttributes = {'type': 'text/css'}; - var defaultAttributes = {}; - var attributes = goog.html.SafeHtml.combineAttributes( - fixedAttributes, defaultAttributes, opt_attributes); - - var content = ''; - styleSheet = goog.array.concat(styleSheet); - for (var i = 0; i < styleSheet.length; i++) { - content += goog.html.SafeStyleSheet.unwrap(styleSheet[i]); - } - // Convert to SafeHtml so that it's not HTML-escaped. - var htmlContent = goog.html.SafeHtml - .createSafeHtmlSecurityPrivateDoNotAccessOrElse( - content, goog.i18n.bidi.Dir.NEUTRAL); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse( - 'style', attributes, htmlContent); -}; - - -/** - * @param {string} tagName The tag name. - * @param {string} name The attribute name. - * @param {!goog.html.SafeHtml.AttributeValue_} value The attribute value. - * @return {string} A "name=value" string. - * @throws {Error} If attribute value is unsafe for the given tag and attribute. - * @private - */ -goog.html.SafeHtml.getAttrNameAndValue_ = function(tagName, name, value) { - // If it's goog.string.Const, allow any valid attribute name. - if (value instanceof goog.string.Const) { - value = goog.string.Const.unwrap(value); - } else if (name.toLowerCase() == 'style') { - value = goog.html.SafeHtml.getStyleValue_(value); - } else if (/^on/i.test(name)) { - // TODO(jakubvrana): Disallow more attributes with a special meaning. - throw Error('Attribute "' + name + - '" requires goog.string.Const value, "' + value + '" given.'); - // URL attributes handled differently accroding to tag. - } else if (name.toLowerCase() in goog.html.SafeHtml.URL_ATTRIBUTES_) { - if (value instanceof goog.html.TrustedResourceUrl) { - value = goog.html.TrustedResourceUrl.unwrap(value); - } else if (value instanceof goog.html.SafeUrl) { - value = goog.html.SafeUrl.unwrap(value); - } else if (goog.isString(value)) { - value = goog.html.SafeUrl.sanitize(value).getTypedStringValue(); - } else { - throw Error('Attribute "' + name + '" on tag "' + tagName + - '" requires goog.html.SafeUrl, goog.string.Const, or string,' + - ' value "' + value + '" given.'); - } - } - - // Accept SafeUrl, TrustedResourceUrl, etc. for attributes which only require - // HTML-escaping. - if (value.implementsGoogStringTypedString) { - // Ok to call getTypedStringValue() since there's no reliance on the type - // contract for security here. - value = value.getTypedStringValue(); - } - - goog.asserts.assert(goog.isString(value) || goog.isNumber(value), - 'String or number value expected, got ' + - (typeof value) + ' with value: ' + value); - return name + '="' + goog.string.htmlEscape(String(value)) + '"'; -}; - - -/** - * Gets value allowed in "style" attribute. - * @param {goog.html.SafeHtml.AttributeValue_} value It could be SafeStyle or a - * map which will be passed to goog.html.SafeStyle.create. - * @return {string} Unwrapped value. - * @throws {Error} If string value is given. - * @private - */ -goog.html.SafeHtml.getStyleValue_ = function(value) { - if (!goog.isObject(value)) { - throw Error('The "style" attribute requires goog.html.SafeStyle or map ' + - 'of style properties, ' + (typeof value) + ' given: ' + value); - } - if (!(value instanceof goog.html.SafeStyle)) { - // Process the property bag into a style object. - value = goog.html.SafeStyle.create(value); - } - return goog.html.SafeStyle.unwrap(value); -}; - - -/** - * Creates a SafeHtml content with known directionality consisting of a tag with - * optional attributes and optional content. - * @param {!goog.i18n.bidi.Dir} dir Directionality. - * @param {string} tagName - * @param {!Object<string, goog.html.SafeHtml.AttributeValue_>=} opt_attributes - * @param {!goog.html.SafeHtml.TextOrHtml_| - * !Array<!goog.html.SafeHtml.TextOrHtml_>=} opt_content - * @return {!goog.html.SafeHtml} The SafeHtml content with the tag. - */ -goog.html.SafeHtml.createWithDir = function(dir, tagName, opt_attributes, - opt_content) { - var html = goog.html.SafeHtml.create(tagName, opt_attributes, opt_content); - html.dir_ = dir; - return html; -}; - - -/** - * Creates a new SafeHtml object by concatenating values. - * @param {...(!goog.html.SafeHtml.TextOrHtml_| - * !Array<!goog.html.SafeHtml.TextOrHtml_>)} var_args Values to concatenate. - * @return {!goog.html.SafeHtml} - */ -goog.html.SafeHtml.concat = function(var_args) { - var dir = goog.i18n.bidi.Dir.NEUTRAL; - var content = ''; - - /** - * @param {!goog.html.SafeHtml.TextOrHtml_| - * !Array<!goog.html.SafeHtml.TextOrHtml_>} argument - */ - var addArgument = function(argument) { - if (goog.isArray(argument)) { - goog.array.forEach(argument, addArgument); - } else { - var html = goog.html.SafeHtml.htmlEscape(argument); - content += goog.html.SafeHtml.unwrap(html); - var htmlDir = html.getDirection(); - if (dir == goog.i18n.bidi.Dir.NEUTRAL) { - dir = htmlDir; - } else if (htmlDir != goog.i18n.bidi.Dir.NEUTRAL && dir != htmlDir) { - dir = null; - } - } - }; - - goog.array.forEach(arguments, addArgument); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse( - content, dir); -}; - - -/** - * Creates a new SafeHtml object with known directionality by concatenating the - * values. - * @param {!goog.i18n.bidi.Dir} dir Directionality. - * @param {...(!goog.html.SafeHtml.TextOrHtml_| - * !Array<!goog.html.SafeHtml.TextOrHtml_>)} var_args Elements of array - * arguments would be processed recursively. - * @return {!goog.html.SafeHtml} - */ -goog.html.SafeHtml.concatWithDir = function(dir, var_args) { - var html = goog.html.SafeHtml.concat(goog.array.slice(arguments, 1)); - html.dir_ = dir; - return html; -}; - - -/** - * Type marker for the SafeHtml type, used to implement additional run-time - * type checking. - * @const {!Object} - * @private - */ -goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - - -/** - * Package-internal utility method to create SafeHtml instances. - * - * @param {string} html The string to initialize the SafeHtml object with. - * @param {?goog.i18n.bidi.Dir} dir The directionality of the SafeHtml to be - * constructed, or null if unknown. - * @return {!goog.html.SafeHtml} The initialized SafeHtml object. - * @package - */ -goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse = function( - html, dir) { - return new goog.html.SafeHtml().initSecurityPrivateDoNotAccessOrElse_( - html, dir); -}; - - -/** - * Called from createSafeHtmlSecurityPrivateDoNotAccessOrElse(). This - * method exists only so that the compiler can dead code eliminate static - * fields (like EMPTY) when they're not accessed. - * @param {string} html - * @param {?goog.i18n.bidi.Dir} dir - * @return {!goog.html.SafeHtml} - * @private - */ -goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_ = function( - html, dir) { - this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = html; - this.dir_ = dir; - return this; -}; - - -/** - * Like create() but does not restrict which tags can be constructed. - * - * @param {string} tagName Tag name. Set or validated by caller. - * @param {!Object<string, goog.html.SafeHtml.AttributeValue_>=} opt_attributes - * @param {(!goog.html.SafeHtml.TextOrHtml_| - * !Array<!goog.html.SafeHtml.TextOrHtml_>)=} opt_content - * @return {!goog.html.SafeHtml} - * @throws {Error} If invalid or unsafe attribute name or value is provided. - * @throws {goog.asserts.AssertionError} If content for void tag is provided. - * @package - */ -goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse = - function(tagName, opt_attributes, opt_content) { - var dir = null; - var result = '<' + tagName; - - if (opt_attributes) { - for (var name in opt_attributes) { - if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(name)) { - throw Error('Invalid attribute name "' + name + '".'); - } - var value = opt_attributes[name]; - if (!goog.isDefAndNotNull(value)) { - continue; - } - result += ' ' + - goog.html.SafeHtml.getAttrNameAndValue_(tagName, name, value); - } - } - - var content = opt_content; - if (!goog.isDefAndNotNull(content)) { - content = []; - } else if (!goog.isArray(content)) { - content = [content]; - } - - if (goog.dom.tags.isVoidTag(tagName.toLowerCase())) { - goog.asserts.assert(!content.length, - 'Void tag <' + tagName + '> does not allow content.'); - result += '>'; - } else { - var html = goog.html.SafeHtml.concat(content); - result += '>' + goog.html.SafeHtml.unwrap(html) + '</' + tagName + '>'; - dir = html.getDirection(); - } - - var dirAttribute = opt_attributes && opt_attributes['dir']; - if (dirAttribute) { - if (/^(ltr|rtl|auto)$/i.test(dirAttribute)) { - // If the tag has the "dir" attribute specified then its direction is - // neutral because it can be safely used in any context. - dir = goog.i18n.bidi.Dir.NEUTRAL; - } else { - dir = null; - } - } - - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse( - result, dir); -}; - - -/** - * @param {!Object<string, string>} fixedAttributes - * @param {!Object<string, string>} defaultAttributes - * @param {!Object<string, goog.html.SafeHtml.AttributeValue_>=} - * opt_attributes Optional attributes passed to create*(). - * @return {!Object<string, goog.html.SafeHtml.AttributeValue_>} - * @throws {Error} If opt_attributes contains an attribute with the same name - * as an attribute in fixedAttributes. - * @package - */ -goog.html.SafeHtml.combineAttributes = function( - fixedAttributes, defaultAttributes, opt_attributes) { - var combinedAttributes = {}; - var name; - - for (name in fixedAttributes) { - goog.asserts.assert(name.toLowerCase() == name, 'Must be lower case'); - combinedAttributes[name] = fixedAttributes[name]; - } - for (name in defaultAttributes) { - goog.asserts.assert(name.toLowerCase() == name, 'Must be lower case'); - combinedAttributes[name] = defaultAttributes[name]; - } - - for (name in opt_attributes) { - var nameLower = name.toLowerCase(); - if (nameLower in fixedAttributes) { - throw Error('Cannot override "' + nameLower + '" attribute, got "' + - name + '" with value "' + opt_attributes[name] + '"'); - } - if (nameLower in defaultAttributes) { - delete combinedAttributes[nameLower]; - } - combinedAttributes[name] = opt_attributes[name]; - } - - return combinedAttributes; -}; - - -/** - * A SafeHtml instance corresponding to the HTML doctype: "<!DOCTYPE html>". - * @const {!goog.html.SafeHtml} - */ -goog.html.SafeHtml.DOCTYPE_HTML = - goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse( - '<!DOCTYPE html>', goog.i18n.bidi.Dir.NEUTRAL); - - -/** - * A SafeHtml instance corresponding to the empty string. - * @const {!goog.html.SafeHtml} - */ -goog.html.SafeHtml.EMPTY = - goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse( - '', goog.i18n.bidi.Dir.NEUTRAL); - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Type-safe wrappers for unsafe DOM APIs. - * - * This file provides type-safe wrappers for DOM APIs that can result in - * cross-site scripting (XSS) vulnerabilities, if the API is supplied with - * untrusted (attacker-controlled) input. Instead of plain strings, the type - * safe wrappers consume values of types from the goog.html package whose - * contract promises that values are safe to use in the corresponding context. - * - * Hence, a program that exclusively uses the wrappers in this file (i.e., whose - * only reference to security-sensitive raw DOM APIs are in this file) is - * guaranteed to be free of XSS due to incorrect use of such DOM APIs (modulo - * correctness of code that produces values of the respective goog.html types, - * and absent code that violates type safety). - * - * For example, assigning to an element's .innerHTML property a string that is - * derived (even partially) from untrusted input typically results in an XSS - * vulnerability. The type-safe wrapper goog.html.setInnerHtml consumes a value - * of type goog.html.SafeHtml, whose contract states that using its values in a - * HTML context will not result in XSS. Hence a program that is free of direct - * assignments to any element's innerHTML property (with the exception of the - * assignment to .innerHTML in this file) is guaranteed to be free of XSS due to - * assignment of untrusted strings to the innerHTML property. - */ - -goog.provide('goog.dom.safe'); -goog.provide('goog.dom.safe.InsertAdjacentHtmlPosition'); - -goog.require('goog.asserts'); -goog.require('goog.html.SafeHtml'); -goog.require('goog.html.SafeUrl'); -goog.require('goog.html.TrustedResourceUrl'); -goog.require('goog.string'); -goog.require('goog.string.Const'); - - -/** @enum {string} */ -goog.dom.safe.InsertAdjacentHtmlPosition = { - AFTERBEGIN: 'afterbegin', - AFTEREND: 'afterend', - BEFOREBEGIN: 'beforebegin', - BEFOREEND: 'beforeend' -}; - - -/** - * Inserts known-safe HTML into a Node, at the specified position. - * @param {!Node} node The node on which to call insertAdjacentHTML. - * @param {!goog.dom.safe.InsertAdjacentHtmlPosition} position Position where - * to insert the HTML. - * @param {!goog.html.SafeHtml} html The known-safe HTML to insert. - */ -goog.dom.safe.insertAdjacentHtml = function(node, position, html) { - node.insertAdjacentHTML(position, goog.html.SafeHtml.unwrap(html)); -}; - - -/** - * Assigns known-safe HTML to an element's innerHTML property. - * @param {!Element} elem The element whose innerHTML is to be assigned to. - * @param {!goog.html.SafeHtml} html The known-safe HTML to assign. - */ -goog.dom.safe.setInnerHtml = function(elem, html) { - elem.innerHTML = goog.html.SafeHtml.unwrap(html); -}; - - -/** - * Assigns known-safe HTML to an element's outerHTML property. - * @param {!Element} elem The element whose outerHTML is to be assigned to. - * @param {!goog.html.SafeHtml} html The known-safe HTML to assign. - */ -goog.dom.safe.setOuterHtml = function(elem, html) { - elem.outerHTML = goog.html.SafeHtml.unwrap(html); -}; - - -/** - * Writes known-safe HTML to a document. - * @param {!Document} doc The document to be written to. - * @param {!goog.html.SafeHtml} html The known-safe HTML to assign. - */ -goog.dom.safe.documentWrite = function(doc, html) { - doc.write(goog.html.SafeHtml.unwrap(html)); -}; - - -/** - * Safely assigns a URL to an anchor element's href property. - * - * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to - * anchor's href property. If url is of type string however, it is first - * sanitized using goog.html.SafeUrl.sanitize. - * - * Example usage: - * goog.dom.safe.setAnchorHref(anchorEl, url); - * which is a safe alternative to - * anchorEl.href = url; - * The latter can result in XSS vulnerabilities if url is a - * user-/attacker-controlled value. - * - * @param {!HTMLAnchorElement} anchor The anchor element whose href property - * is to be assigned to. - * @param {string|!goog.html.SafeUrl} url The URL to assign. - * @see goog.html.SafeUrl#sanitize - */ -goog.dom.safe.setAnchorHref = function(anchor, url) { - /** @type {!goog.html.SafeUrl} */ - var safeUrl; - if (url instanceof goog.html.SafeUrl) { - safeUrl = url; - } else { - safeUrl = goog.html.SafeUrl.sanitize(url); - } - anchor.href = goog.html.SafeUrl.unwrap(safeUrl); -}; - - -/** - * Safely assigns a URL to an embed element's src property. - * - * Example usage: - * goog.dom.safe.setEmbedSrc(embedEl, url); - * which is a safe alternative to - * embedEl.src = url; - * The latter can result in loading untrusted code unless it is ensured that - * the URL refers to a trustworthy resource. - * - * @param {!HTMLEmbedElement} embed The embed element whose src property - * is to be assigned to. - * @param {!goog.html.TrustedResourceUrl} url The URL to assign. - */ -goog.dom.safe.setEmbedSrc = function(embed, url) { - embed.src = goog.html.TrustedResourceUrl.unwrap(url); -}; - - -/** - * Safely assigns a URL to a frame element's src property. - * - * Example usage: - * goog.dom.safe.setFrameSrc(frameEl, url); - * which is a safe alternative to - * frameEl.src = url; - * The latter can result in loading untrusted code unless it is ensured that - * the URL refers to a trustworthy resource. - * - * @param {!HTMLFrameElement} frame The frame element whose src property - * is to be assigned to. - * @param {!goog.html.TrustedResourceUrl} url The URL to assign. - */ -goog.dom.safe.setFrameSrc = function(frame, url) { - frame.src = goog.html.TrustedResourceUrl.unwrap(url); -}; - - -/** - * Safely assigns a URL to an iframe element's src property. - * - * Example usage: - * goog.dom.safe.setIframeSrc(iframeEl, url); - * which is a safe alternative to - * iframeEl.src = url; - * The latter can result in loading untrusted code unless it is ensured that - * the URL refers to a trustworthy resource. - * - * @param {!HTMLIFrameElement} iframe The iframe element whose src property - * is to be assigned to. - * @param {!goog.html.TrustedResourceUrl} url The URL to assign. - */ -goog.dom.safe.setIframeSrc = function(iframe, url) { - iframe.src = goog.html.TrustedResourceUrl.unwrap(url); -}; - - -/** - * Safely sets a link element's href and rel properties. Whether or not - * the URL assigned to href has to be a goog.html.TrustedResourceUrl - * depends on the value of the rel property. If rel contains "stylesheet" - * then a TrustedResourceUrl is required. - * - * Example usage: - * goog.dom.safe.setLinkHrefAndRel(linkEl, url, 'stylesheet'); - * which is a safe alternative to - * linkEl.rel = 'stylesheet'; - * linkEl.href = url; - * The latter can result in loading untrusted code unless it is ensured that - * the URL refers to a trustworthy resource. - * - * @param {!HTMLLinkElement} link The link element whose href property - * is to be assigned to. - * @param {string|!goog.html.SafeUrl|!goog.html.TrustedResourceUrl} url The URL - * to assign to the href property. Must be a TrustedResourceUrl if the - * value assigned to rel contains "stylesheet". A string value is - * sanitized with goog.html.SafeUrl.sanitize. - * @param {string} rel The value to assign to the rel property. - * @throws {Error} if rel contains "stylesheet" and url is not a - * TrustedResourceUrl - * @see goog.html.SafeUrl#sanitize - */ -goog.dom.safe.setLinkHrefAndRel = function(link, url, rel) { - link.rel = rel; - if (goog.string.caseInsensitiveContains(rel, 'stylesheet')) { - goog.asserts.assert( - url instanceof goog.html.TrustedResourceUrl, - 'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'); - link.href = goog.html.TrustedResourceUrl.unwrap(url); - } else if (url instanceof goog.html.TrustedResourceUrl) { - link.href = goog.html.TrustedResourceUrl.unwrap(url); - } else if (url instanceof goog.html.SafeUrl) { - link.href = goog.html.SafeUrl.unwrap(url); - } else { // string - // SafeUrl.sanitize must return legitimate SafeUrl when passed a string. - link.href = goog.html.SafeUrl.sanitize(url).getTypedStringValue(); - } -}; - - -/** - * Safely assigns a URL to an object element's data property. - * - * Example usage: - * goog.dom.safe.setObjectData(objectEl, url); - * which is a safe alternative to - * objectEl.data = url; - * The latter can result in loading untrusted code unless setit is ensured that - * the URL refers to a trustworthy resource. - * - * @param {!HTMLObjectElement} object The object element whose data property - * is to be assigned to. - * @param {!goog.html.TrustedResourceUrl} url The URL to assign. - */ -goog.dom.safe.setObjectData = function(object, url) { - object.data = goog.html.TrustedResourceUrl.unwrap(url); -}; - - -/** - * Safely assigns a URL to an iframe element's src property. - * - * Example usage: - * goog.dom.safe.setScriptSrc(scriptEl, url); - * which is a safe alternative to - * scriptEl.src = url; - * The latter can result in loading untrusted code unless it is ensured that - * the URL refers to a trustworthy resource. - * - * @param {!HTMLScriptElement} script The script element whose src property - * is to be assigned to. - * @param {!goog.html.TrustedResourceUrl} url The URL to assign. - */ -goog.dom.safe.setScriptSrc = function(script, url) { - script.src = goog.html.TrustedResourceUrl.unwrap(url); -}; - - -/** - * Safely assigns a URL to a Location object's href property. - * - * If url is of type goog.html.SafeUrl, its value is unwrapped and assigned to - * loc's href property. If url is of type string however, it is first sanitized - * using goog.html.SafeUrl.sanitize. - * - * Example usage: - * goog.dom.safe.setLocationHref(document.location, redirectUrl); - * which is a safe alternative to - * document.location.href = redirectUrl; - * The latter can result in XSS vulnerabilities if redirectUrl is a - * user-/attacker-controlled value. - * - * @param {!Location} loc The Location object whose href property is to be - * assigned to. - * @param {string|!goog.html.SafeUrl} url The URL to assign. - * @see goog.html.SafeUrl#sanitize - */ -goog.dom.safe.setLocationHref = function(loc, url) { - /** @type {!goog.html.SafeUrl} */ - var safeUrl; - if (url instanceof goog.html.SafeUrl) { - safeUrl = url; - } else { - safeUrl = goog.html.SafeUrl.sanitize(url); - } - loc.href = goog.html.SafeUrl.unwrap(safeUrl); -}; - - -/** - * Safely opens a URL in a new window (via window.open). - * - * If url is of type goog.html.SafeUrl, its value is unwrapped and passed in to - * window.open. If url is of type string however, it is first sanitized - * using goog.html.SafeUrl.sanitize. - * - * Note that this function does not prevent leakages via the referer that is - * sent by window.open. It is advised to only use this to open 1st party URLs. - * - * Example usage: - * goog.dom.safe.openInWindow(url); - * which is a safe alternative to - * window.open(url); - * The latter can result in XSS vulnerabilities if redirectUrl is a - * user-/attacker-controlled value. - * - * @param {string|!goog.html.SafeUrl} url The URL to open. - * @param {Window=} opt_openerWin Window of which to call the .open() method. - * Defaults to the global window. - * @param {!goog.string.Const=} opt_name Name of the window to open in. Can be - * _top, etc as allowed by window.open(). - * @param {string=} opt_specs Comma-separated list of specifications, same as - * in window.open(). - * @param {boolean=} opt_replace Whether to replace the current entry in browser - * history, same as in window.open(). - * @return {Window} Window the url was opened in. - */ -goog.dom.safe.openInWindow = function( - url, opt_openerWin, opt_name, opt_specs, opt_replace) { - /** @type {!goog.html.SafeUrl} */ - var safeUrl; - if (url instanceof goog.html.SafeUrl) { - safeUrl = url; - } else { - safeUrl = goog.html.SafeUrl.sanitize(url); - } - var win = opt_openerWin || window; - return win.open(goog.html.SafeUrl.unwrap(safeUrl), - // If opt_name is undefined, simply passing that in to open() causes IE to - // reuse the current window instead of opening a new one. Thus we pass '' - // in instead, which according to spec opens a new window. See - // https://html.spec.whatwg.org/multipage/browsers.html#dom-open . - opt_name ? goog.string.Const.unwrap(opt_name) : '', - opt_specs, opt_replace); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A utility class for representing two-dimensional positions. - */ - - -goog.provide('goog.math.Coordinate'); - -goog.require('goog.math'); - - - -/** - * Class for representing coordinates and positions. - * @param {number=} opt_x Left, defaults to 0. - * @param {number=} opt_y Top, defaults to 0. - * @struct - * @constructor - */ -goog.math.Coordinate = function(opt_x, opt_y) { - /** - * X-value - * @type {number} - */ - this.x = goog.isDef(opt_x) ? opt_x : 0; - - /** - * Y-value - * @type {number} - */ - this.y = goog.isDef(opt_y) ? opt_y : 0; -}; - - -/** - * Returns a new copy of the coordinate. - * @return {!goog.math.Coordinate} A clone of this coordinate. - */ -goog.math.Coordinate.prototype.clone = function() { - return new goog.math.Coordinate(this.x, this.y); -}; - - -if (goog.DEBUG) { - /** - * Returns a nice string representing the coordinate. - * @return {string} In the form (50, 73). - * @override - */ - goog.math.Coordinate.prototype.toString = function() { - return '(' + this.x + ', ' + this.y + ')'; - }; -} - - -/** - * Compares coordinates for equality. - * @param {goog.math.Coordinate} a A Coordinate. - * @param {goog.math.Coordinate} b A Coordinate. - * @return {boolean} True iff the coordinates are equal, or if both are null. - */ -goog.math.Coordinate.equals = function(a, b) { - if (a == b) { - return true; - } - if (!a || !b) { - return false; - } - return a.x == b.x && a.y == b.y; -}; - - -/** - * Returns the distance between two coordinates. - * @param {!goog.math.Coordinate} a A Coordinate. - * @param {!goog.math.Coordinate} b A Coordinate. - * @return {number} The distance between {@code a} and {@code b}. - */ -goog.math.Coordinate.distance = function(a, b) { - var dx = a.x - b.x; - var dy = a.y - b.y; - return Math.sqrt(dx * dx + dy * dy); -}; - - -/** - * Returns the magnitude of a coordinate. - * @param {!goog.math.Coordinate} a A Coordinate. - * @return {number} The distance between the origin and {@code a}. - */ -goog.math.Coordinate.magnitude = function(a) { - return Math.sqrt(a.x * a.x + a.y * a.y); -}; - - -/** - * Returns the angle from the origin to a coordinate. - * @param {!goog.math.Coordinate} a A Coordinate. - * @return {number} The angle, in degrees, clockwise from the positive X - * axis to {@code a}. - */ -goog.math.Coordinate.azimuth = function(a) { - return goog.math.angle(0, 0, a.x, a.y); -}; - - -/** - * Returns the squared distance between two coordinates. Squared distances can - * be used for comparisons when the actual value is not required. - * - * Performance note: eliminating the square root is an optimization often used - * in lower-level languages, but the speed difference is not nearly as - * pronounced in JavaScript (only a few percent.) - * - * @param {!goog.math.Coordinate} a A Coordinate. - * @param {!goog.math.Coordinate} b A Coordinate. - * @return {number} The squared distance between {@code a} and {@code b}. - */ -goog.math.Coordinate.squaredDistance = function(a, b) { - var dx = a.x - b.x; - var dy = a.y - b.y; - return dx * dx + dy * dy; -}; - - -/** - * Returns the difference between two coordinates as a new - * goog.math.Coordinate. - * @param {!goog.math.Coordinate} a A Coordinate. - * @param {!goog.math.Coordinate} b A Coordinate. - * @return {!goog.math.Coordinate} A Coordinate representing the difference - * between {@code a} and {@code b}. - */ -goog.math.Coordinate.difference = function(a, b) { - return new goog.math.Coordinate(a.x - b.x, a.y - b.y); -}; - - -/** - * Returns the sum of two coordinates as a new goog.math.Coordinate. - * @param {!goog.math.Coordinate} a A Coordinate. - * @param {!goog.math.Coordinate} b A Coordinate. - * @return {!goog.math.Coordinate} A Coordinate representing the sum of the two - * coordinates. - */ -goog.math.Coordinate.sum = function(a, b) { - return new goog.math.Coordinate(a.x + b.x, a.y + b.y); -}; - - -/** - * Rounds the x and y fields to the next larger integer values. - * @return {!goog.math.Coordinate} This coordinate with ceil'd fields. - */ -goog.math.Coordinate.prototype.ceil = function() { - this.x = Math.ceil(this.x); - this.y = Math.ceil(this.y); - return this; -}; - - -/** - * Rounds the x and y fields to the next smaller integer values. - * @return {!goog.math.Coordinate} This coordinate with floored fields. - */ -goog.math.Coordinate.prototype.floor = function() { - this.x = Math.floor(this.x); - this.y = Math.floor(this.y); - return this; -}; - - -/** - * Rounds the x and y fields to the nearest integer values. - * @return {!goog.math.Coordinate} This coordinate with rounded fields. - */ -goog.math.Coordinate.prototype.round = function() { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - return this; -}; - - -/** - * Translates this box by the given offsets. If a {@code goog.math.Coordinate} - * is given, then the x and y values are translated by the coordinate's x and y. - * Otherwise, x and y are translated by {@code tx} and {@code opt_ty} - * respectively. - * @param {number|goog.math.Coordinate} tx The value to translate x by or the - * the coordinate to translate this coordinate by. - * @param {number=} opt_ty The value to translate y by. - * @return {!goog.math.Coordinate} This coordinate after translating. - */ -goog.math.Coordinate.prototype.translate = function(tx, opt_ty) { - if (tx instanceof goog.math.Coordinate) { - this.x += tx.x; - this.y += tx.y; - } else { - this.x += tx; - if (goog.isNumber(opt_ty)) { - this.y += opt_ty; - } - } - return this; -}; - - -/** - * Scales this coordinate by the given scale factors. The x and y values are - * scaled by {@code sx} and {@code opt_sy} respectively. If {@code opt_sy} - * is not given, then {@code sx} is used for both x and y. - * @param {number} sx The scale factor to use for the x dimension. - * @param {number=} opt_sy The scale factor to use for the y dimension. - * @return {!goog.math.Coordinate} This coordinate after scaling. - */ -goog.math.Coordinate.prototype.scale = function(sx, opt_sy) { - var sy = goog.isNumber(opt_sy) ? opt_sy : sx; - this.x *= sx; - this.y *= sy; - return this; -}; - - -/** - * Rotates this coordinate clockwise about the origin (or, optionally, the given - * center) by the given angle, in radians. - * @param {number} radians The angle by which to rotate this coordinate - * clockwise about the given center, in radians. - * @param {!goog.math.Coordinate=} opt_center The center of rotation. Defaults - * to (0, 0) if not given. - */ -goog.math.Coordinate.prototype.rotateRadians = function(radians, opt_center) { - var center = opt_center || new goog.math.Coordinate(0, 0); - - var x = this.x; - var y = this.y; - var cos = Math.cos(radians); - var sin = Math.sin(radians); - - this.x = (x - center.x) * cos - (y - center.y) * sin + center.x; - this.y = (x - center.x) * sin + (y - center.y) * cos + center.y; -}; - - -/** - * Rotates this coordinate clockwise about the origin (or, optionally, the given - * center) by the given angle, in degrees. - * @param {number} degrees The angle by which to rotate this coordinate - * clockwise about the given center, in degrees. - * @param {!goog.math.Coordinate=} opt_center The center of rotation. Defaults - * to (0, 0) if not given. - */ -goog.math.Coordinate.prototype.rotateDegrees = function(degrees, opt_center) { - this.rotateRadians(goog.math.toRadians(degrees), opt_center); -}; - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A utility class for representing two-dimensional sizes. - * @author brenneman@google.com (Shawn Brenneman) - */ - - -goog.provide('goog.math.Size'); - - - -/** - * Class for representing sizes consisting of a width and height. Undefined - * width and height support is deprecated and results in compiler warning. - * @param {number} width Width. - * @param {number} height Height. - * @struct - * @constructor - */ -goog.math.Size = function(width, height) { - /** - * Width - * @type {number} - */ - this.width = width; - - /** - * Height - * @type {number} - */ - this.height = height; -}; - - -/** - * Compares sizes for equality. - * @param {goog.math.Size} a A Size. - * @param {goog.math.Size} b A Size. - * @return {boolean} True iff the sizes have equal widths and equal - * heights, or if both are null. - */ -goog.math.Size.equals = function(a, b) { - if (a == b) { - return true; - } - if (!a || !b) { - return false; - } - return a.width == b.width && a.height == b.height; -}; - - -/** - * @return {!goog.math.Size} A new copy of the Size. - */ -goog.math.Size.prototype.clone = function() { - return new goog.math.Size(this.width, this.height); -}; - - -if (goog.DEBUG) { - /** - * Returns a nice string representing size. - * @return {string} In the form (50 x 73). - * @override - */ - goog.math.Size.prototype.toString = function() { - return '(' + this.width + ' x ' + this.height + ')'; - }; -} - - -/** - * @return {number} The longer of the two dimensions in the size. - */ -goog.math.Size.prototype.getLongest = function() { - return Math.max(this.width, this.height); -}; - - -/** - * @return {number} The shorter of the two dimensions in the size. - */ -goog.math.Size.prototype.getShortest = function() { - return Math.min(this.width, this.height); -}; - - -/** - * @return {number} The area of the size (width * height). - */ -goog.math.Size.prototype.area = function() { - return this.width * this.height; -}; - - -/** - * @return {number} The perimeter of the size (width + height) * 2. - */ -goog.math.Size.prototype.perimeter = function() { - return (this.width + this.height) * 2; -}; - - -/** - * @return {number} The ratio of the size's width to its height. - */ -goog.math.Size.prototype.aspectRatio = function() { - return this.width / this.height; -}; - - -/** - * @return {boolean} True if the size has zero area, false if both dimensions - * are non-zero numbers. - */ -goog.math.Size.prototype.isEmpty = function() { - return !this.area(); -}; - - -/** - * Clamps the width and height parameters upward to integer values. - * @return {!goog.math.Size} This size with ceil'd components. - */ -goog.math.Size.prototype.ceil = function() { - this.width = Math.ceil(this.width); - this.height = Math.ceil(this.height); - return this; -}; - - -/** - * @param {!goog.math.Size} target The target size. - * @return {boolean} True if this Size is the same size or smaller than the - * target size in both dimensions. - */ -goog.math.Size.prototype.fitsInside = function(target) { - return this.width <= target.width && this.height <= target.height; -}; - - -/** - * Clamps the width and height parameters downward to integer values. - * @return {!goog.math.Size} This size with floored components. - */ -goog.math.Size.prototype.floor = function() { - this.width = Math.floor(this.width); - this.height = Math.floor(this.height); - return this; -}; - - -/** - * Rounds the width and height parameters to integer values. - * @return {!goog.math.Size} This size with rounded components. - */ -goog.math.Size.prototype.round = function() { - this.width = Math.round(this.width); - this.height = Math.round(this.height); - return this; -}; - - -/** - * Scales this size by the given scale factors. The width and height are scaled - * by {@code sx} and {@code opt_sy} respectively. If {@code opt_sy} is not - * given, then {@code sx} is used for both the width and height. - * @param {number} sx The scale factor to use for the width. - * @param {number=} opt_sy The scale factor to use for the height. - * @return {!goog.math.Size} This Size object after scaling. - */ -goog.math.Size.prototype.scale = function(sx, opt_sy) { - var sy = goog.isNumber(opt_sy) ? opt_sy : sx; - this.width *= sx; - this.height *= sy; - return this; -}; - - -/** - * Uniformly scales the size to perfectly cover the dimensions of a given size. - * If the size is already larger than the target, it will be scaled down to the - * minimum size at which it still covers the entire target. The original aspect - * ratio will be preserved. - * - * This function assumes that both Sizes contain strictly positive dimensions. - * @param {!goog.math.Size} target The target size. - * @return {!goog.math.Size} This Size object, after optional scaling. - */ -goog.math.Size.prototype.scaleToCover = function(target) { - var s = this.aspectRatio() <= target.aspectRatio() ? - target.width / this.width : - target.height / this.height; - - return this.scale(s); -}; - - -/** - * Uniformly scales the size to fit inside the dimensions of a given size. The - * original aspect ratio will be preserved. - * - * This function assumes that both Sizes contain strictly positive dimensions. - * @param {!goog.math.Size} target The target size. - * @return {!goog.math.Size} This Size object, after optional scaling. - */ -goog.math.Size.prototype.scaleToFit = function(target) { - var s = this.aspectRatio() > target.aspectRatio() ? - target.width / this.width : - target.height / this.height; - - return this.scale(s); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for manipulating the browser's Document Object Model - * Inspiration taken *heavily* from mochikit (http://mochikit.com/). - * - * You can use {@link goog.dom.DomHelper} to create new dom helpers that refer - * to a different document object. This is useful if you are working with - * frames or multiple windows. - * - * @author arv@google.com (Erik Arvidsson) - */ - - -// TODO(arv): Rename/refactor getTextContent and getRawTextContent. The problem -// is that getTextContent should mimic the DOM3 textContent. We should add a -// getInnerText (or getText) which tries to return the visible text, innerText. - - -goog.provide('goog.dom'); -goog.provide('goog.dom.Appendable'); -goog.provide('goog.dom.DomHelper'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.BrowserFeature'); -goog.require('goog.dom.NodeType'); -goog.require('goog.dom.TagName'); -goog.require('goog.dom.safe'); -goog.require('goog.html.SafeHtml'); -goog.require('goog.math.Coordinate'); -goog.require('goog.math.Size'); -goog.require('goog.object'); -goog.require('goog.string'); -goog.require('goog.string.Unicode'); -goog.require('goog.userAgent'); - - -/** - * @define {boolean} Whether we know at compile time that the browser is in - * quirks mode. - */ -goog.define('goog.dom.ASSUME_QUIRKS_MODE', false); - - -/** - * @define {boolean} Whether we know at compile time that the browser is in - * standards compliance mode. - */ -goog.define('goog.dom.ASSUME_STANDARDS_MODE', false); - - -/** - * Whether we know the compatibility mode at compile time. - * @type {boolean} - * @private - */ -goog.dom.COMPAT_MODE_KNOWN_ = - goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STANDARDS_MODE; - - -/** - * Gets the DomHelper object for the document where the element resides. - * @param {(Node|Window)=} opt_element If present, gets the DomHelper for this - * element. - * @return {!goog.dom.DomHelper} The DomHelper. - */ -goog.dom.getDomHelper = function(opt_element) { - return opt_element ? - new goog.dom.DomHelper(goog.dom.getOwnerDocument(opt_element)) : - (goog.dom.defaultDomHelper_ || - (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper())); -}; - - -/** - * Cached default DOM helper. - * @type {goog.dom.DomHelper} - * @private - */ -goog.dom.defaultDomHelper_; - - -/** - * Gets the document object being used by the dom library. - * @return {!Document} Document object. - */ -goog.dom.getDocument = function() { - return document; -}; - - -/** - * Gets an element from the current document by element id. - * - * If an Element is passed in, it is returned. - * - * @param {string|Element} element Element ID or a DOM node. - * @return {Element} The element with the given ID, or the node passed in. - */ -goog.dom.getElement = function(element) { - return goog.dom.getElementHelper_(document, element); -}; - - -/** - * Gets an element by id from the given document (if present). - * If an element is given, it is returned. - * @param {!Document} doc - * @param {string|Element} element Element ID or a DOM node. - * @return {Element} The resulting element. - * @private - */ -goog.dom.getElementHelper_ = function(doc, element) { - return goog.isString(element) ? - doc.getElementById(element) : - element; -}; - - -/** - * Gets an element by id, asserting that the element is found. - * - * This is used when an element is expected to exist, and should fail with - * an assertion error if it does not (if assertions are enabled). - * - * @param {string} id Element ID. - * @return {!Element} The element with the given ID, if it exists. - */ -goog.dom.getRequiredElement = function(id) { - return goog.dom.getRequiredElementHelper_(document, id); -}; - - -/** - * Helper function for getRequiredElementHelper functions, both static and - * on DomHelper. Asserts the element with the given id exists. - * @param {!Document} doc - * @param {string} id - * @return {!Element} The element with the given ID, if it exists. - * @private - */ -goog.dom.getRequiredElementHelper_ = function(doc, id) { - // To prevent users passing in Elements as is permitted in getElement(). - goog.asserts.assertString(id); - var element = goog.dom.getElementHelper_(doc, id); - element = goog.asserts.assertElement(element, - 'No element found with id: ' + id); - return element; -}; - - -/** - * Alias for getElement. - * @param {string|Element} element Element ID or a DOM node. - * @return {Element} The element with the given ID, or the node passed in. - * @deprecated Use {@link goog.dom.getElement} instead. - */ -goog.dom.$ = goog.dom.getElement; - - -/** - * Looks up elements by both tag and class name, using browser native functions - * ({@code querySelectorAll}, {@code getElementsByTagName} or - * {@code getElementsByClassName}) where possible. This function - * is a useful, if limited, way of collecting a list of DOM elements - * with certain characteristics. {@code goog.dom.query} offers a - * more powerful and general solution which allows matching on CSS3 - * selector expressions, but at increased cost in code size. If all you - * need is particular tags belonging to a single class, this function - * is fast and sleek. - * - * Note that tag names are case sensitive in the SVG namespace, and this - * function converts opt_tag to uppercase for comparisons. For queries in the - * SVG namespace you should use querySelector or querySelectorAll instead. - * https://bugzilla.mozilla.org/show_bug.cgi?id=963870 - * https://bugs.webkit.org/show_bug.cgi?id=83438 - * - * @see {goog.dom.query} - * - * @param {?string=} opt_tag Element tag name. - * @param {?string=} opt_class Optional class name. - * @param {(Document|Element)=} opt_el Optional element to look in. - * @return { {length: number} } Array-like list of elements (only a length - * property and numerical indices are guaranteed to exist). - */ -goog.dom.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) { - return goog.dom.getElementsByTagNameAndClass_(document, opt_tag, opt_class, - opt_el); -}; - - -/** - * Returns a static, array-like list of the elements with the provided - * className. - * @see {goog.dom.query} - * @param {string} className the name of the class to look for. - * @param {(Document|Element)=} opt_el Optional element to look in. - * @return { {length: number} } The items found with the class name provided. - */ -goog.dom.getElementsByClass = function(className, opt_el) { - var parent = opt_el || document; - if (goog.dom.canUseQuerySelector_(parent)) { - return parent.querySelectorAll('.' + className); - } - return goog.dom.getElementsByTagNameAndClass_( - document, '*', className, opt_el); -}; - - -/** - * Returns the first element with the provided className. - * @see {goog.dom.query} - * @param {string} className the name of the class to look for. - * @param {Element|Document=} opt_el Optional element to look in. - * @return {Element} The first item with the class name provided. - */ -goog.dom.getElementByClass = function(className, opt_el) { - var parent = opt_el || document; - var retVal = null; - if (parent.getElementsByClassName) { - retVal = parent.getElementsByClassName(className)[0]; - } else if (goog.dom.canUseQuerySelector_(parent)) { - retVal = parent.querySelector('.' + className); - } else { - retVal = goog.dom.getElementsByTagNameAndClass_( - document, '*', className, opt_el)[0]; - } - return retVal || null; -}; - - -/** - * Ensures an element with the given className exists, and then returns the - * first element with the provided className. - * @see {goog.dom.query} - * @param {string} className the name of the class to look for. - * @param {!Element|!Document=} opt_root Optional element or document to look - * in. - * @return {!Element} The first item with the class name provided. - * @throws {goog.asserts.AssertionError} Thrown if no element is found. - */ -goog.dom.getRequiredElementByClass = function(className, opt_root) { - var retValue = goog.dom.getElementByClass(className, opt_root); - return goog.asserts.assert(retValue, - 'No element found with className: ' + className); -}; - - -/** - * Prefer the standardized (http://www.w3.org/TR/selectors-api/), native and - * fast W3C Selectors API. - * @param {!(Element|Document)} parent The parent document object. - * @return {boolean} whether or not we can use parent.querySelector* APIs. - * @private - */ -goog.dom.canUseQuerySelector_ = function(parent) { - return !!(parent.querySelectorAll && parent.querySelector); -}; - - -/** - * Helper for {@code getElementsByTagNameAndClass}. - * @param {!Document} doc The document to get the elements in. - * @param {?string=} opt_tag Element tag name. - * @param {?string=} opt_class Optional class name. - * @param {(Document|Element)=} opt_el Optional element to look in. - * @return { {length: number} } Array-like list of elements (only a length - * property and numerical indices are guaranteed to exist). - * @private - */ -goog.dom.getElementsByTagNameAndClass_ = function(doc, opt_tag, opt_class, - opt_el) { - var parent = opt_el || doc; - var tagName = (opt_tag && opt_tag != '*') ? opt_tag.toUpperCase() : ''; - - if (goog.dom.canUseQuerySelector_(parent) && - (tagName || opt_class)) { - var query = tagName + (opt_class ? '.' + opt_class : ''); - return parent.querySelectorAll(query); - } - - // Use the native getElementsByClassName if available, under the assumption - // that even when the tag name is specified, there will be fewer elements to - // filter through when going by class than by tag name - if (opt_class && parent.getElementsByClassName) { - var els = parent.getElementsByClassName(opt_class); - - if (tagName) { - var arrayLike = {}; - var len = 0; - - // Filter for specific tags if requested. - for (var i = 0, el; el = els[i]; i++) { - if (tagName == el.nodeName) { - arrayLike[len++] = el; - } - } - arrayLike.length = len; - - return arrayLike; - } else { - return els; - } - } - - var els = parent.getElementsByTagName(tagName || '*'); - - if (opt_class) { - var arrayLike = {}; - var len = 0; - for (var i = 0, el; el = els[i]; i++) { - var className = el.className; - // Check if className has a split function since SVG className does not. - if (typeof className.split == 'function' && - goog.array.contains(className.split(/\s+/), opt_class)) { - arrayLike[len++] = el; - } - } - arrayLike.length = len; - return arrayLike; - } else { - return els; - } -}; - - -/** - * Alias for {@code getElementsByTagNameAndClass}. - * @param {?string=} opt_tag Element tag name. - * @param {?string=} opt_class Optional class name. - * @param {Element=} opt_el Optional element to look in. - * @return { {length: number} } Array-like list of elements (only a length - * property and numerical indices are guaranteed to exist). - * @deprecated Use {@link goog.dom.getElementsByTagNameAndClass} instead. - */ -goog.dom.$$ = goog.dom.getElementsByTagNameAndClass; - - -/** - * Sets multiple properties on a node. - * @param {Element} element DOM node to set properties on. - * @param {Object} properties Hash of property:value pairs. - */ -goog.dom.setProperties = function(element, properties) { - goog.object.forEach(properties, function(val, key) { - if (key == 'style') { - element.style.cssText = val; - } else if (key == 'class') { - element.className = val; - } else if (key == 'for') { - element.htmlFor = val; - } else if (goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(key)) { - element.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[key], val); - } else if (goog.string.startsWith(key, 'aria-') || - goog.string.startsWith(key, 'data-')) { - element.setAttribute(key, val); - } else { - element[key] = val; - } - }); -}; - - -/** - * Map of attributes that should be set using - * element.setAttribute(key, val) instead of element[key] = val. Used - * by goog.dom.setProperties. - * - * @private {!Object<string, string>} - * @const - */ -goog.dom.DIRECT_ATTRIBUTE_MAP_ = { - 'cellpadding': 'cellPadding', - 'cellspacing': 'cellSpacing', - 'colspan': 'colSpan', - 'frameborder': 'frameBorder', - 'height': 'height', - 'maxlength': 'maxLength', - 'role': 'role', - 'rowspan': 'rowSpan', - 'type': 'type', - 'usemap': 'useMap', - 'valign': 'vAlign', - 'width': 'width' -}; - - -/** - * Gets the dimensions of the viewport. - * - * Gecko Standards mode: - * docEl.clientWidth Width of viewport excluding scrollbar. - * win.innerWidth Width of viewport including scrollbar. - * body.clientWidth Width of body element. - * - * docEl.clientHeight Height of viewport excluding scrollbar. - * win.innerHeight Height of viewport including scrollbar. - * body.clientHeight Height of document. - * - * Gecko Backwards compatible mode: - * docEl.clientWidth Width of viewport excluding scrollbar. - * win.innerWidth Width of viewport including scrollbar. - * body.clientWidth Width of viewport excluding scrollbar. - * - * docEl.clientHeight Height of document. - * win.innerHeight Height of viewport including scrollbar. - * body.clientHeight Height of viewport excluding scrollbar. - * - * IE6/7 Standards mode: - * docEl.clientWidth Width of viewport excluding scrollbar. - * win.innerWidth Undefined. - * body.clientWidth Width of body element. - * - * docEl.clientHeight Height of viewport excluding scrollbar. - * win.innerHeight Undefined. - * body.clientHeight Height of document element. - * - * IE5 + IE6/7 Backwards compatible mode: - * docEl.clientWidth 0. - * win.innerWidth Undefined. - * body.clientWidth Width of viewport excluding scrollbar. - * - * docEl.clientHeight 0. - * win.innerHeight Undefined. - * body.clientHeight Height of viewport excluding scrollbar. - * - * Opera 9 Standards and backwards compatible mode: - * docEl.clientWidth Width of viewport excluding scrollbar. - * win.innerWidth Width of viewport including scrollbar. - * body.clientWidth Width of viewport excluding scrollbar. - * - * docEl.clientHeight Height of document. - * win.innerHeight Height of viewport including scrollbar. - * body.clientHeight Height of viewport excluding scrollbar. - * - * WebKit: - * Safari 2 - * docEl.clientHeight Same as scrollHeight. - * docEl.clientWidth Same as innerWidth. - * win.innerWidth Width of viewport excluding scrollbar. - * win.innerHeight Height of the viewport including scrollbar. - * frame.innerHeight Height of the viewport exluding scrollbar. - * - * Safari 3 (tested in 522) - * - * docEl.clientWidth Width of viewport excluding scrollbar. - * docEl.clientHeight Height of viewport excluding scrollbar in strict mode. - * body.clientHeight Height of viewport excluding scrollbar in quirks mode. - * - * @param {Window=} opt_window Optional window element to test. - * @return {!goog.math.Size} Object with values 'width' and 'height'. - */ -goog.dom.getViewportSize = function(opt_window) { - // TODO(arv): This should not take an argument - return goog.dom.getViewportSize_(opt_window || window); -}; - - -/** - * Helper for {@code getViewportSize}. - * @param {Window} win The window to get the view port size for. - * @return {!goog.math.Size} Object with values 'width' and 'height'. - * @private - */ -goog.dom.getViewportSize_ = function(win) { - var doc = win.document; - var el = goog.dom.isCss1CompatMode_(doc) ? doc.documentElement : doc.body; - return new goog.math.Size(el.clientWidth, el.clientHeight); -}; - - -/** - * Calculates the height of the document. - * - * @return {number} The height of the current document. - */ -goog.dom.getDocumentHeight = function() { - return goog.dom.getDocumentHeight_(window); -}; - - -/** - * Calculates the height of the document of the given window. - * - * Function code copied from the opensocial gadget api: - * gadgets.window.adjustHeight(opt_height) - * - * @private - * @param {!Window} win The window whose document height to retrieve. - * @return {number} The height of the document of the given window. - */ -goog.dom.getDocumentHeight_ = function(win) { - // NOTE(eae): This method will return the window size rather than the document - // size in webkit quirks mode. - var doc = win.document; - var height = 0; - - if (doc) { - // Calculating inner content height is hard and different between - // browsers rendering in Strict vs. Quirks mode. We use a combination of - // three properties within document.body and document.documentElement: - // - scrollHeight - // - offsetHeight - // - clientHeight - // These values differ significantly between browsers and rendering modes. - // But there are patterns. It just takes a lot of time and persistence - // to figure out. - - var body = doc.body; - var docEl = /** @type {!HTMLElement} */ (doc.documentElement); - if (!(docEl && body)) { - return 0; - } - - // Get the height of the viewport - var vh = goog.dom.getViewportSize_(win).height; - if (goog.dom.isCss1CompatMode_(doc) && docEl.scrollHeight) { - // In Strict mode: - // The inner content height is contained in either: - // document.documentElement.scrollHeight - // document.documentElement.offsetHeight - // Based on studying the values output by different browsers, - // use the value that's NOT equal to the viewport height found above. - height = docEl.scrollHeight != vh ? - docEl.scrollHeight : docEl.offsetHeight; - } else { - // In Quirks mode: - // documentElement.clientHeight is equal to documentElement.offsetHeight - // except in IE. In most browsers, document.documentElement can be used - // to calculate the inner content height. - // However, in other browsers (e.g. IE), document.body must be used - // instead. How do we know which one to use? - // If document.documentElement.clientHeight does NOT equal - // document.documentElement.offsetHeight, then use document.body. - var sh = docEl.scrollHeight; - var oh = docEl.offsetHeight; - if (docEl.clientHeight != oh) { - sh = body.scrollHeight; - oh = body.offsetHeight; - } - - // Detect whether the inner content height is bigger or smaller - // than the bounding box (viewport). If bigger, take the larger - // value. If smaller, take the smaller value. - if (sh > vh) { - // Content is larger - height = sh > oh ? sh : oh; - } else { - // Content is smaller - height = sh < oh ? sh : oh; - } - } - } - - return height; -}; - - -/** - * Gets the page scroll distance as a coordinate object. - * - * @param {Window=} opt_window Optional window element to test. - * @return {!goog.math.Coordinate} Object with values 'x' and 'y'. - * @deprecated Use {@link goog.dom.getDocumentScroll} instead. - */ -goog.dom.getPageScroll = function(opt_window) { - var win = opt_window || goog.global || window; - return goog.dom.getDomHelper(win.document).getDocumentScroll(); -}; - - -/** - * Gets the document scroll distance as a coordinate object. - * - * @return {!goog.math.Coordinate} Object with values 'x' and 'y'. - */ -goog.dom.getDocumentScroll = function() { - return goog.dom.getDocumentScroll_(document); -}; - - -/** - * Helper for {@code getDocumentScroll}. - * - * @param {!Document} doc The document to get the scroll for. - * @return {!goog.math.Coordinate} Object with values 'x' and 'y'. - * @private - */ -goog.dom.getDocumentScroll_ = function(doc) { - var el = goog.dom.getDocumentScrollElement_(doc); - var win = goog.dom.getWindow_(doc); - if (goog.userAgent.IE && goog.userAgent.isVersionOrHigher('10') && - win.pageYOffset != el.scrollTop) { - // The keyboard on IE10 touch devices shifts the page using the pageYOffset - // without modifying scrollTop. For this case, we want the body scroll - // offsets. - return new goog.math.Coordinate(el.scrollLeft, el.scrollTop); - } - return new goog.math.Coordinate(win.pageXOffset || el.scrollLeft, - win.pageYOffset || el.scrollTop); -}; - - -/** - * Gets the document scroll element. - * @return {!Element} Scrolling element. - */ -goog.dom.getDocumentScrollElement = function() { - return goog.dom.getDocumentScrollElement_(document); -}; - - -/** - * Helper for {@code getDocumentScrollElement}. - * @param {!Document} doc The document to get the scroll element for. - * @return {!Element} Scrolling element. - * @private - */ -goog.dom.getDocumentScrollElement_ = function(doc) { - // Old WebKit needs body.scrollLeft in both quirks mode and strict mode. We - // also default to the documentElement if the document does not have a body - // (e.g. a SVG document). - // Uses http://dev.w3.org/csswg/cssom-view/#dom-document-scrollingelement to - // avoid trying to guess about browser behavior from the UA string. - if (doc.scrollingElement) { - return doc.scrollingElement; - } - if (!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(doc)) { - return doc.documentElement; - } - return doc.body || doc.documentElement; -}; - - -/** - * Gets the window object associated with the given document. - * - * @param {Document=} opt_doc Document object to get window for. - * @return {!Window} The window associated with the given document. - */ -goog.dom.getWindow = function(opt_doc) { - // TODO(arv): This should not take an argument. - return opt_doc ? goog.dom.getWindow_(opt_doc) : window; -}; - - -/** - * Helper for {@code getWindow}. - * - * @param {!Document} doc Document object to get window for. - * @return {!Window} The window associated with the given document. - * @private - */ -goog.dom.getWindow_ = function(doc) { - return doc.parentWindow || doc.defaultView; -}; - - -/** - * Returns a dom node with a set of attributes. This function accepts varargs - * for subsequent nodes to be added. Subsequent nodes will be added to the - * first node as childNodes. - * - * So: - * <code>createDom('div', null, createDom('p'), createDom('p'));</code> - * would return a div with two child paragraphs - * - * @param {string} tagName Tag to create. - * @param {(Object|Array<string>|string)=} opt_attributes If object, then a map - * of name-value pairs for attributes. If a string, then this is the - * className of the new element. If an array, the elements will be joined - * together as the className of the new element. - * @param {...(Object|string|Array|NodeList)} var_args Further DOM nodes or - * strings for text nodes. If one of the var_args is an array or NodeList, - * its elements will be added as childNodes instead. - * @return {!Element} Reference to a DOM node. - */ -goog.dom.createDom = function(tagName, opt_attributes, var_args) { - return goog.dom.createDom_(document, arguments); -}; - - -/** - * Helper for {@code createDom}. - * @param {!Document} doc The document to create the DOM in. - * @param {!Arguments} args Argument object passed from the callers. See - * {@code goog.dom.createDom} for details. - * @return {!Element} Reference to a DOM node. - * @private - */ -goog.dom.createDom_ = function(doc, args) { - var tagName = args[0]; - var attributes = args[1]; - - // Internet Explorer is dumb: - // name: https://msdn.microsoft.com/en-us/library/ms534184(v=vs.85).aspx - // type: https://msdn.microsoft.com/en-us/library/ms534700(v=vs.85).aspx - // Also does not allow setting of 'type' attribute on 'input' or 'button'. - if (!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES && attributes && - (attributes.name || attributes.type)) { - var tagNameArr = ['<', tagName]; - if (attributes.name) { - tagNameArr.push(' name="', goog.string.htmlEscape(attributes.name), '"'); - } - if (attributes.type) { - tagNameArr.push(' type="', goog.string.htmlEscape(attributes.type), '"'); - - // Clone attributes map to remove 'type' without mutating the input. - var clone = {}; - goog.object.extend(clone, attributes); - - // JSCompiler can't see how goog.object.extend added this property, - // because it was essentially added by reflection. - // So it needs to be quoted. - delete clone['type']; - - attributes = clone; - } - tagNameArr.push('>'); - tagName = tagNameArr.join(''); - } - - var element = doc.createElement(tagName); - - if (attributes) { - if (goog.isString(attributes)) { - element.className = attributes; - } else if (goog.isArray(attributes)) { - element.className = attributes.join(' '); - } else { - goog.dom.setProperties(element, attributes); - } - } - - if (args.length > 2) { - goog.dom.append_(doc, element, args, 2); - } - - return element; -}; - - -/** - * Appends a node with text or other nodes. - * @param {!Document} doc The document to create new nodes in. - * @param {!Node} parent The node to append nodes to. - * @param {!Arguments} args The values to add. See {@code goog.dom.append}. - * @param {number} startIndex The index of the array to start from. - * @private - */ -goog.dom.append_ = function(doc, parent, args, startIndex) { - function childHandler(child) { - // TODO(user): More coercion, ala MochiKit? - if (child) { - parent.appendChild(goog.isString(child) ? - doc.createTextNode(child) : child); - } - } - - for (var i = startIndex; i < args.length; i++) { - var arg = args[i]; - // TODO(attila): Fix isArrayLike to return false for a text node. - if (goog.isArrayLike(arg) && !goog.dom.isNodeLike(arg)) { - // If the argument is a node list, not a real array, use a clone, - // because forEach can't be used to mutate a NodeList. - goog.array.forEach(goog.dom.isNodeList(arg) ? - goog.array.toArray(arg) : arg, - childHandler); - } else { - childHandler(arg); - } - } -}; - - -/** - * Alias for {@code createDom}. - * @param {string} tagName Tag to create. - * @param {(string|Object)=} opt_attributes If object, then a map of name-value - * pairs for attributes. If a string, then this is the className of the new - * element. - * @param {...(Object|string|Array|NodeList)} var_args Further DOM nodes or - * strings for text nodes. If one of the var_args is an array, its - * children will be added as childNodes instead. - * @return {!Element} Reference to a DOM node. - * @deprecated Use {@link goog.dom.createDom} instead. - */ -goog.dom.$dom = goog.dom.createDom; - - -/** - * Creates a new element. - * @param {string} name Tag name. - * @return {!Element} The new element. - */ -goog.dom.createElement = function(name) { - return document.createElement(name); -}; - - -/** - * Creates a new text node. - * @param {number|string} content Content. - * @return {!Text} The new text node. - */ -goog.dom.createTextNode = function(content) { - return document.createTextNode(String(content)); -}; - - -/** - * Create a table. - * @param {number} rows The number of rows in the table. Must be >= 1. - * @param {number} columns The number of columns in the table. Must be >= 1. - * @param {boolean=} opt_fillWithNbsp If true, fills table entries with - * {@code goog.string.Unicode.NBSP} characters. - * @return {!Element} The created table. - */ -goog.dom.createTable = function(rows, columns, opt_fillWithNbsp) { - // TODO(user): Return HTMLTableElement, also in prototype function. - // Callers need to be updated to e.g. not assign numbers to table.cellSpacing. - return goog.dom.createTable_(document, rows, columns, !!opt_fillWithNbsp); -}; - - -/** - * Create a table. - * @param {!Document} doc Document object to use to create the table. - * @param {number} rows The number of rows in the table. Must be >= 1. - * @param {number} columns The number of columns in the table. Must be >= 1. - * @param {boolean} fillWithNbsp If true, fills table entries with - * {@code goog.string.Unicode.NBSP} characters. - * @return {!HTMLTableElement} The created table. - * @private - */ -goog.dom.createTable_ = function(doc, rows, columns, fillWithNbsp) { - var table = /** @type {!HTMLTableElement} */ - (doc.createElement(goog.dom.TagName.TABLE)); - var tbody = table.appendChild(doc.createElement(goog.dom.TagName.TBODY)); - for (var i = 0; i < rows; i++) { - var tr = doc.createElement(goog.dom.TagName.TR); - for (var j = 0; j < columns; j++) { - var td = doc.createElement(goog.dom.TagName.TD); - // IE <= 9 will create a text node if we set text content to the empty - // string, so we avoid doing it unless necessary. This ensures that the - // same DOM tree is returned on all browsers. - if (fillWithNbsp) { - goog.dom.setTextContent(td, goog.string.Unicode.NBSP); - } - tr.appendChild(td); - } - tbody.appendChild(tr); - } - return table; -}; - - -/** - * Converts HTML markup into a node. - * @param {!goog.html.SafeHtml} html The HTML markup to convert. - * @return {!Node} The resulting node. - */ -goog.dom.safeHtmlToNode = function(html) { - return goog.dom.safeHtmlToNode_(document, html); -}; - - -/** - * Helper for {@code safeHtmlToNode}. - * @param {!Document} doc The document. - * @param {!goog.html.SafeHtml} html The HTML markup to convert. - * @return {!Node} The resulting node. - * @private - */ -goog.dom.safeHtmlToNode_ = function(doc, html) { - var tempDiv = doc.createElement(goog.dom.TagName.DIV); - if (goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT) { - goog.dom.safe.setInnerHtml(tempDiv, - goog.html.SafeHtml.concat(goog.html.SafeHtml.create('br'), html)); - tempDiv.removeChild(tempDiv.firstChild); - } else { - goog.dom.safe.setInnerHtml(tempDiv, html); - } - return goog.dom.childrenToNode_(doc, tempDiv); -}; - - -/** - * Converts an HTML string into a document fragment. The string must be - * sanitized in order to avoid cross-site scripting. For example - * {@code goog.dom.htmlToDocumentFragment('<img src=x onerror=alert(0)>')} - * triggers an alert in all browsers, even if the returned document fragment - * is thrown away immediately. - * - * NOTE: This method doesn't work if your htmlString contains elements that - * can't be contained in a <div>. For example, <tr>. - * - * @param {string} htmlString The HTML string to convert. - * @return {!Node} The resulting document fragment. - */ -goog.dom.htmlToDocumentFragment = function(htmlString) { - return goog.dom.htmlToDocumentFragment_(document, htmlString); -}; - - -// TODO(jakubvrana): Merge with {@code safeHtmlToNode_}. -/** - * Helper for {@code htmlToDocumentFragment}. - * - * @param {!Document} doc The document. - * @param {string} htmlString The HTML string to convert. - * @return {!Node} The resulting document fragment. - * @private - */ -goog.dom.htmlToDocumentFragment_ = function(doc, htmlString) { - var tempDiv = doc.createElement(goog.dom.TagName.DIV); - if (goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT) { - tempDiv.innerHTML = '<br>' + htmlString; - tempDiv.removeChild(tempDiv.firstChild); - } else { - tempDiv.innerHTML = htmlString; - } - return goog.dom.childrenToNode_(doc, tempDiv); -}; - - -/** - * Helper for {@code htmlToDocumentFragment_}. - * @param {!Document} doc The document. - * @param {!Node} tempDiv The input node. - * @return {!Node} The resulting node. - * @private - */ -goog.dom.childrenToNode_ = function(doc, tempDiv) { - if (tempDiv.childNodes.length == 1) { - return tempDiv.removeChild(tempDiv.firstChild); - } else { - var fragment = doc.createDocumentFragment(); - while (tempDiv.firstChild) { - fragment.appendChild(tempDiv.firstChild); - } - return fragment; - } -}; - - -/** - * Returns true if the browser is in "CSS1-compatible" (standards-compliant) - * mode, false otherwise. - * @return {boolean} True if in CSS1-compatible mode. - */ -goog.dom.isCss1CompatMode = function() { - return goog.dom.isCss1CompatMode_(document); -}; - - -/** - * Returns true if the browser is in "CSS1-compatible" (standards-compliant) - * mode, false otherwise. - * @param {!Document} doc The document to check. - * @return {boolean} True if in CSS1-compatible mode. - * @private - */ -goog.dom.isCss1CompatMode_ = function(doc) { - if (goog.dom.COMPAT_MODE_KNOWN_) { - return goog.dom.ASSUME_STANDARDS_MODE; - } - - return doc.compatMode == 'CSS1Compat'; -}; - - -/** - * Determines if the given node can contain children, intended to be used for - * HTML generation. - * - * IE natively supports node.canHaveChildren but has inconsistent behavior. - * Prior to IE8 the base tag allows children and in IE9 all nodes return true - * for canHaveChildren. - * - * In practice all non-IE browsers allow you to add children to any node, but - * the behavior is inconsistent: - * - * <pre> - * var a = document.createElement(goog.dom.TagName.BR); - * a.appendChild(document.createTextNode('foo')); - * a.appendChild(document.createTextNode('bar')); - * console.log(a.childNodes.length); // 2 - * console.log(a.innerHTML); // Chrome: "", IE9: "foobar", FF3.5: "foobar" - * </pre> - * - * For more information, see: - * http://dev.w3.org/html5/markup/syntax.html#syntax-elements - * - * TODO(user): Rename shouldAllowChildren() ? - * - * @param {Node} node The node to check. - * @return {boolean} Whether the node can contain children. - */ -goog.dom.canHaveChildren = function(node) { - if (node.nodeType != goog.dom.NodeType.ELEMENT) { - return false; - } - switch (/** @type {!Element} */ (node).tagName) { - case goog.dom.TagName.APPLET: - case goog.dom.TagName.AREA: - case goog.dom.TagName.BASE: - case goog.dom.TagName.BR: - case goog.dom.TagName.COL: - case goog.dom.TagName.COMMAND: - case goog.dom.TagName.EMBED: - case goog.dom.TagName.FRAME: - case goog.dom.TagName.HR: - case goog.dom.TagName.IMG: - case goog.dom.TagName.INPUT: - case goog.dom.TagName.IFRAME: - case goog.dom.TagName.ISINDEX: - case goog.dom.TagName.KEYGEN: - case goog.dom.TagName.LINK: - case goog.dom.TagName.NOFRAMES: - case goog.dom.TagName.NOSCRIPT: - case goog.dom.TagName.META: - case goog.dom.TagName.OBJECT: - case goog.dom.TagName.PARAM: - case goog.dom.TagName.SCRIPT: - case goog.dom.TagName.SOURCE: - case goog.dom.TagName.STYLE: - case goog.dom.TagName.TRACK: - case goog.dom.TagName.WBR: - return false; - } - return true; -}; - - -/** - * Appends a child to a node. - * @param {Node} parent Parent. - * @param {Node} child Child. - */ -goog.dom.appendChild = function(parent, child) { - parent.appendChild(child); -}; - - -/** - * Appends a node with text or other nodes. - * @param {!Node} parent The node to append nodes to. - * @param {...goog.dom.Appendable} var_args The things to append to the node. - * If this is a Node it is appended as is. - * If this is a string then a text node is appended. - * If this is an array like object then fields 0 to length - 1 are appended. - */ -goog.dom.append = function(parent, var_args) { - goog.dom.append_(goog.dom.getOwnerDocument(parent), parent, arguments, 1); -}; - - -/** - * Removes all the child nodes on a DOM node. - * @param {Node} node Node to remove children from. - */ -goog.dom.removeChildren = function(node) { - // Note: Iterations over live collections can be slow, this is the fastest - // we could find. The double parenthesis are used to prevent JsCompiler and - // strict warnings. - var child; - while ((child = node.firstChild)) { - node.removeChild(child); - } -}; - - -/** - * Inserts a new node before an existing reference node (i.e. as the previous - * sibling). If the reference node has no parent, then does nothing. - * @param {Node} newNode Node to insert. - * @param {Node} refNode Reference node to insert before. - */ -goog.dom.insertSiblingBefore = function(newNode, refNode) { - if (refNode.parentNode) { - refNode.parentNode.insertBefore(newNode, refNode); - } -}; - - -/** - * Inserts a new node after an existing reference node (i.e. as the next - * sibling). If the reference node has no parent, then does nothing. - * @param {Node} newNode Node to insert. - * @param {Node} refNode Reference node to insert after. - */ -goog.dom.insertSiblingAfter = function(newNode, refNode) { - if (refNode.parentNode) { - refNode.parentNode.insertBefore(newNode, refNode.nextSibling); - } -}; - - -/** - * Insert a child at a given index. If index is larger than the number of child - * nodes that the parent currently has, the node is inserted as the last child - * node. - * @param {Element} parent The element into which to insert the child. - * @param {Node} child The element to insert. - * @param {number} index The index at which to insert the new child node. Must - * not be negative. - */ -goog.dom.insertChildAt = function(parent, child, index) { - // Note that if the second argument is null, insertBefore - // will append the child at the end of the list of children. - parent.insertBefore(child, parent.childNodes[index] || null); -}; - - -/** - * Removes a node from its parent. - * @param {Node} node The node to remove. - * @return {Node} The node removed if removed; else, null. - */ -goog.dom.removeNode = function(node) { - return node && node.parentNode ? node.parentNode.removeChild(node) : null; -}; - - -/** - * Replaces a node in the DOM tree. Will do nothing if {@code oldNode} has no - * parent. - * @param {Node} newNode Node to insert. - * @param {Node} oldNode Node to replace. - */ -goog.dom.replaceNode = function(newNode, oldNode) { - var parent = oldNode.parentNode; - if (parent) { - parent.replaceChild(newNode, oldNode); - } -}; - - -/** - * Flattens an element. That is, removes it and replace it with its children. - * Does nothing if the element is not in the document. - * @param {Element} element The element to flatten. - * @return {Element|undefined} The original element, detached from the document - * tree, sans children; or undefined, if the element was not in the document - * to begin with. - */ -goog.dom.flattenElement = function(element) { - var child, parent = element.parentNode; - if (parent && parent.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) { - // Use IE DOM method (supported by Opera too) if available - if (element.removeNode) { - return /** @type {Element} */ (element.removeNode(false)); - } else { - // Move all children of the original node up one level. - while ((child = element.firstChild)) { - parent.insertBefore(child, element); - } - - // Detach the original element. - return /** @type {Element} */ (goog.dom.removeNode(element)); - } - } -}; - - -/** - * Returns an array containing just the element children of the given element. - * @param {Element} element The element whose element children we want. - * @return {!(Array|NodeList)} An array or array-like list of just the element - * children of the given element. - */ -goog.dom.getChildren = function(element) { - // We check if the children attribute is supported for child elements - // since IE8 misuses the attribute by also including comments. - if (goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE && - element.children != undefined) { - return element.children; - } - // Fall back to manually filtering the element's child nodes. - return goog.array.filter(element.childNodes, function(node) { - return node.nodeType == goog.dom.NodeType.ELEMENT; - }); -}; - - -/** - * Returns the first child node that is an element. - * @param {Node} node The node to get the first child element of. - * @return {Element} The first child node of {@code node} that is an element. - */ -goog.dom.getFirstElementChild = function(node) { - if (goog.isDef(node.firstElementChild)) { - return /** @type {!Element} */(node).firstElementChild; - } - return goog.dom.getNextElementNode_(node.firstChild, true); -}; - - -/** - * Returns the last child node that is an element. - * @param {Node} node The node to get the last child element of. - * @return {Element} The last child node of {@code node} that is an element. - */ -goog.dom.getLastElementChild = function(node) { - if (goog.isDef(node.lastElementChild)) { - return /** @type {!Element} */(node).lastElementChild; - } - return goog.dom.getNextElementNode_(node.lastChild, false); -}; - - -/** - * Returns the first next sibling that is an element. - * @param {Node} node The node to get the next sibling element of. - * @return {Element} The next sibling of {@code node} that is an element. - */ -goog.dom.getNextElementSibling = function(node) { - if (goog.isDef(node.nextElementSibling)) { - return /** @type {!Element} */(node).nextElementSibling; - } - return goog.dom.getNextElementNode_(node.nextSibling, true); -}; - - -/** - * Returns the first previous sibling that is an element. - * @param {Node} node The node to get the previous sibling element of. - * @return {Element} The first previous sibling of {@code node} that is - * an element. - */ -goog.dom.getPreviousElementSibling = function(node) { - if (goog.isDef(node.previousElementSibling)) { - return /** @type {!Element} */(node).previousElementSibling; - } - return goog.dom.getNextElementNode_(node.previousSibling, false); -}; - - -/** - * Returns the first node that is an element in the specified direction, - * starting with {@code node}. - * @param {Node} node The node to get the next element from. - * @param {boolean} forward Whether to look forwards or backwards. - * @return {Element} The first element. - * @private - */ -goog.dom.getNextElementNode_ = function(node, forward) { - while (node && node.nodeType != goog.dom.NodeType.ELEMENT) { - node = forward ? node.nextSibling : node.previousSibling; - } - - return /** @type {Element} */ (node); -}; - - -/** - * Returns the next node in source order from the given node. - * @param {Node} node The node. - * @return {Node} The next node in the DOM tree, or null if this was the last - * node. - */ -goog.dom.getNextNode = function(node) { - if (!node) { - return null; - } - - if (node.firstChild) { - return node.firstChild; - } - - while (node && !node.nextSibling) { - node = node.parentNode; - } - - return node ? node.nextSibling : null; -}; - - -/** - * Returns the previous node in source order from the given node. - * @param {Node} node The node. - * @return {Node} The previous node in the DOM tree, or null if this was the - * first node. - */ -goog.dom.getPreviousNode = function(node) { - if (!node) { - return null; - } - - if (!node.previousSibling) { - return node.parentNode; - } - - node = node.previousSibling; - while (node && node.lastChild) { - node = node.lastChild; - } - - return node; -}; - - -/** - * Whether the object looks like a DOM node. - * @param {?} obj The object being tested for node likeness. - * @return {boolean} Whether the object looks like a DOM node. - */ -goog.dom.isNodeLike = function(obj) { - return goog.isObject(obj) && obj.nodeType > 0; -}; - - -/** - * Whether the object looks like an Element. - * @param {?} obj The object being tested for Element likeness. - * @return {boolean} Whether the object looks like an Element. - */ -goog.dom.isElement = function(obj) { - return goog.isObject(obj) && obj.nodeType == goog.dom.NodeType.ELEMENT; -}; - - -/** - * Returns true if the specified value is a Window object. This includes the - * global window for HTML pages, and iframe windows. - * @param {?} obj Variable to test. - * @return {boolean} Whether the variable is a window. - */ -goog.dom.isWindow = function(obj) { - return goog.isObject(obj) && obj['window'] == obj; -}; - - -/** - * Returns an element's parent, if it's an Element. - * @param {Element} element The DOM element. - * @return {Element} The parent, or null if not an Element. - */ -goog.dom.getParentElement = function(element) { - var parent; - if (goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY) { - var isIe9 = goog.userAgent.IE && - goog.userAgent.isVersionOrHigher('9') && - !goog.userAgent.isVersionOrHigher('10'); - // SVG elements in IE9 can't use the parentElement property. - // goog.global['SVGElement'] is not defined in IE9 quirks mode. - if (!(isIe9 && goog.global['SVGElement'] && - element instanceof goog.global['SVGElement'])) { - parent = element.parentElement; - if (parent) { - return parent; - } - } - } - parent = element.parentNode; - return goog.dom.isElement(parent) ? /** @type {!Element} */ (parent) : null; -}; - - -/** - * Whether a node contains another node. - * @param {Node} parent The node that should contain the other node. - * @param {Node} descendant The node to test presence of. - * @return {boolean} Whether the parent node contains the descendent node. - */ -goog.dom.contains = function(parent, descendant) { - // We use browser specific methods for this if available since it is faster - // that way. - - // IE DOM - if (parent.contains && descendant.nodeType == goog.dom.NodeType.ELEMENT) { - return parent == descendant || parent.contains(descendant); - } - - // W3C DOM Level 3 - if (typeof parent.compareDocumentPosition != 'undefined') { - return parent == descendant || - Boolean(parent.compareDocumentPosition(descendant) & 16); - } - - // W3C DOM Level 1 - while (descendant && parent != descendant) { - descendant = descendant.parentNode; - } - return descendant == parent; -}; - - -/** - * Compares the document order of two nodes, returning 0 if they are the same - * node, a negative number if node1 is before node2, and a positive number if - * node2 is before node1. Note that we compare the order the tags appear in the - * document so in the tree <b><i>text</i></b> the B node is considered to be - * before the I node. - * - * @param {Node} node1 The first node to compare. - * @param {Node} node2 The second node to compare. - * @return {number} 0 if the nodes are the same node, a negative number if node1 - * is before node2, and a positive number if node2 is before node1. - */ -goog.dom.compareNodeOrder = function(node1, node2) { - // Fall out quickly for equality. - if (node1 == node2) { - return 0; - } - - // Use compareDocumentPosition where available - if (node1.compareDocumentPosition) { - // 4 is the bitmask for FOLLOWS. - return node1.compareDocumentPosition(node2) & 2 ? 1 : -1; - } - - // Special case for document nodes on IE 7 and 8. - if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) { - if (node1.nodeType == goog.dom.NodeType.DOCUMENT) { - return -1; - } - if (node2.nodeType == goog.dom.NodeType.DOCUMENT) { - return 1; - } - } - - // Process in IE using sourceIndex - we check to see if the first node has - // a source index or if its parent has one. - if ('sourceIndex' in node1 || - (node1.parentNode && 'sourceIndex' in node1.parentNode)) { - var isElement1 = node1.nodeType == goog.dom.NodeType.ELEMENT; - var isElement2 = node2.nodeType == goog.dom.NodeType.ELEMENT; - - if (isElement1 && isElement2) { - return node1.sourceIndex - node2.sourceIndex; - } else { - var parent1 = node1.parentNode; - var parent2 = node2.parentNode; - - if (parent1 == parent2) { - return goog.dom.compareSiblingOrder_(node1, node2); - } - - if (!isElement1 && goog.dom.contains(parent1, node2)) { - return -1 * goog.dom.compareParentsDescendantNodeIe_(node1, node2); - } - - - if (!isElement2 && goog.dom.contains(parent2, node1)) { - return goog.dom.compareParentsDescendantNodeIe_(node2, node1); - } - - return (isElement1 ? node1.sourceIndex : parent1.sourceIndex) - - (isElement2 ? node2.sourceIndex : parent2.sourceIndex); - } - } - - // For Safari, we compare ranges. - var doc = goog.dom.getOwnerDocument(node1); - - var range1, range2; - range1 = doc.createRange(); - range1.selectNode(node1); - range1.collapse(true); - - range2 = doc.createRange(); - range2.selectNode(node2); - range2.collapse(true); - - return range1.compareBoundaryPoints(goog.global['Range'].START_TO_END, - range2); -}; - - -/** - * Utility function to compare the position of two nodes, when - * {@code textNode}'s parent is an ancestor of {@code node}. If this entry - * condition is not met, this function will attempt to reference a null object. - * @param {!Node} textNode The textNode to compare. - * @param {Node} node The node to compare. - * @return {number} -1 if node is before textNode, +1 otherwise. - * @private - */ -goog.dom.compareParentsDescendantNodeIe_ = function(textNode, node) { - var parent = textNode.parentNode; - if (parent == node) { - // If textNode is a child of node, then node comes first. - return -1; - } - var sibling = node; - while (sibling.parentNode != parent) { - sibling = sibling.parentNode; - } - return goog.dom.compareSiblingOrder_(sibling, textNode); -}; - - -/** - * Utility function to compare the position of two nodes known to be non-equal - * siblings. - * @param {Node} node1 The first node to compare. - * @param {!Node} node2 The second node to compare. - * @return {number} -1 if node1 is before node2, +1 otherwise. - * @private - */ -goog.dom.compareSiblingOrder_ = function(node1, node2) { - var s = node2; - while ((s = s.previousSibling)) { - if (s == node1) { - // We just found node1 before node2. - return -1; - } - } - - // Since we didn't find it, node1 must be after node2. - return 1; -}; - - -/** - * Find the deepest common ancestor of the given nodes. - * @param {...Node} var_args The nodes to find a common ancestor of. - * @return {Node} The common ancestor of the nodes, or null if there is none. - * null will only be returned if two or more of the nodes are from different - * documents. - */ -goog.dom.findCommonAncestor = function(var_args) { - var i, count = arguments.length; - if (!count) { - return null; - } else if (count == 1) { - return arguments[0]; - } - - var paths = []; - var minLength = Infinity; - for (i = 0; i < count; i++) { - // Compute the list of ancestors. - var ancestors = []; - var node = arguments[i]; - while (node) { - ancestors.unshift(node); - node = node.parentNode; - } - - // Save the list for comparison. - paths.push(ancestors); - minLength = Math.min(minLength, ancestors.length); - } - var output = null; - for (i = 0; i < minLength; i++) { - var first = paths[0][i]; - for (var j = 1; j < count; j++) { - if (first != paths[j][i]) { - return output; - } - } - output = first; - } - return output; -}; - - -/** - * Returns the owner document for a node. - * @param {Node|Window} node The node to get the document for. - * @return {!Document} The document owning the node. - */ -goog.dom.getOwnerDocument = function(node) { - // TODO(nnaze): Update param signature to be non-nullable. - goog.asserts.assert(node, 'Node cannot be null or undefined.'); - return /** @type {!Document} */ ( - node.nodeType == goog.dom.NodeType.DOCUMENT ? node : - node.ownerDocument || node.document); -}; - - -/** - * Cross-browser function for getting the document element of a frame or iframe. - * @param {Element} frame Frame element. - * @return {!Document} The frame content document. - */ -goog.dom.getFrameContentDocument = function(frame) { - var doc = frame.contentDocument || frame.contentWindow.document; - return doc; -}; - - -/** - * Cross-browser function for getting the window of a frame or iframe. - * @param {Element} frame Frame element. - * @return {Window} The window associated with the given frame. - */ -goog.dom.getFrameContentWindow = function(frame) { - return frame.contentWindow || - goog.dom.getWindow(goog.dom.getFrameContentDocument(frame)); -}; - - -/** - * Sets the text content of a node, with cross-browser support. - * @param {Node} node The node to change the text content of. - * @param {string|number} text The value that should replace the node's content. - */ -goog.dom.setTextContent = function(node, text) { - goog.asserts.assert(node != null, - 'goog.dom.setTextContent expects a non-null value for node'); - - if ('textContent' in node) { - node.textContent = text; - } else if (node.nodeType == goog.dom.NodeType.TEXT) { - node.data = text; - } else if (node.firstChild && - node.firstChild.nodeType == goog.dom.NodeType.TEXT) { - // If the first child is a text node we just change its data and remove the - // rest of the children. - while (node.lastChild != node.firstChild) { - node.removeChild(node.lastChild); - } - node.firstChild.data = text; - } else { - goog.dom.removeChildren(node); - var doc = goog.dom.getOwnerDocument(node); - node.appendChild(doc.createTextNode(String(text))); - } -}; - - -/** - * Gets the outerHTML of a node, which islike innerHTML, except that it - * actually contains the HTML of the node itself. - * @param {Element} element The element to get the HTML of. - * @return {string} The outerHTML of the given element. - */ -goog.dom.getOuterHtml = function(element) { - // IE, Opera and WebKit all have outerHTML. - if ('outerHTML' in element) { - return element.outerHTML; - } else { - var doc = goog.dom.getOwnerDocument(element); - var div = doc.createElement(goog.dom.TagName.DIV); - div.appendChild(element.cloneNode(true)); - return div.innerHTML; - } -}; - - -/** - * Finds the first descendant node that matches the filter function, using - * a depth first search. This function offers the most general purpose way - * of finding a matching element. You may also wish to consider - * {@code goog.dom.query} which can express many matching criteria using - * CSS selector expressions. These expressions often result in a more - * compact representation of the desired result. - * @see goog.dom.query - * - * @param {Node} root The root of the tree to search. - * @param {function(Node) : boolean} p The filter function. - * @return {Node|undefined} The found node or undefined if none is found. - */ -goog.dom.findNode = function(root, p) { - var rv = []; - var found = goog.dom.findNodes_(root, p, rv, true); - return found ? rv[0] : undefined; -}; - - -/** - * Finds all the descendant nodes that match the filter function, using a - * a depth first search. This function offers the most general-purpose way - * of finding a set of matching elements. You may also wish to consider - * {@code goog.dom.query} which can express many matching criteria using - * CSS selector expressions. These expressions often result in a more - * compact representation of the desired result. - - * @param {Node} root The root of the tree to search. - * @param {function(Node) : boolean} p The filter function. - * @return {!Array<!Node>} The found nodes or an empty array if none are found. - */ -goog.dom.findNodes = function(root, p) { - var rv = []; - goog.dom.findNodes_(root, p, rv, false); - return rv; -}; - - -/** - * Finds the first or all the descendant nodes that match the filter function, - * using a depth first search. - * @param {Node} root The root of the tree to search. - * @param {function(Node) : boolean} p The filter function. - * @param {!Array<!Node>} rv The found nodes are added to this array. - * @param {boolean} findOne If true we exit after the first found node. - * @return {boolean} Whether the search is complete or not. True in case findOne - * is true and the node is found. False otherwise. - * @private - */ -goog.dom.findNodes_ = function(root, p, rv, findOne) { - if (root != null) { - var child = root.firstChild; - while (child) { - if (p(child)) { - rv.push(child); - if (findOne) { - return true; - } - } - if (goog.dom.findNodes_(child, p, rv, findOne)) { - return true; - } - child = child.nextSibling; - } - } - return false; -}; - - -/** - * Map of tags whose content to ignore when calculating text length. - * @private {!Object<string, number>} - * @const - */ -goog.dom.TAGS_TO_IGNORE_ = { - 'SCRIPT': 1, - 'STYLE': 1, - 'HEAD': 1, - 'IFRAME': 1, - 'OBJECT': 1 -}; - - -/** - * Map of tags which have predefined values with regard to whitespace. - * @private {!Object<string, string>} - * @const - */ -goog.dom.PREDEFINED_TAG_VALUES_ = {'IMG': ' ', 'BR': '\n'}; - - -/** - * Returns true if the element has a tab index that allows it to receive - * keyboard focus (tabIndex >= 0), false otherwise. Note that some elements - * natively support keyboard focus, even if they have no tab index. - * @param {!Element} element Element to check. - * @return {boolean} Whether the element has a tab index that allows keyboard - * focus. - * @see http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - */ -goog.dom.isFocusableTabIndex = function(element) { - return goog.dom.hasSpecifiedTabIndex_(element) && - goog.dom.isTabIndexFocusable_(element); -}; - - -/** - * Enables or disables keyboard focus support on the element via its tab index. - * Only elements for which {@link goog.dom.isFocusableTabIndex} returns true - * (or elements that natively support keyboard focus, like form elements) can - * receive keyboard focus. See http://go/tabindex for more info. - * @param {Element} element Element whose tab index is to be changed. - * @param {boolean} enable Whether to set or remove a tab index on the element - * that supports keyboard focus. - */ -goog.dom.setFocusableTabIndex = function(element, enable) { - if (enable) { - element.tabIndex = 0; - } else { - // Set tabIndex to -1 first, then remove it. This is a workaround for - // Safari (confirmed in version 4 on Windows). When removing the attribute - // without setting it to -1 first, the element remains keyboard focusable - // despite not having a tabIndex attribute anymore. - element.tabIndex = -1; - element.removeAttribute('tabIndex'); // Must be camelCase! - } -}; - - -/** - * Returns true if the element can be focused, i.e. it has a tab index that - * allows it to receive keyboard focus (tabIndex >= 0), or it is an element - * that natively supports keyboard focus. - * @param {!Element} element Element to check. - * @return {boolean} Whether the element allows keyboard focus. - */ -goog.dom.isFocusable = function(element) { - var focusable; - // Some elements can have unspecified tab index and still receive focus. - if (goog.dom.nativelySupportsFocus_(element)) { - // Make sure the element is not disabled ... - focusable = !element.disabled && - // ... and if a tab index is specified, it allows focus. - (!goog.dom.hasSpecifiedTabIndex_(element) || - goog.dom.isTabIndexFocusable_(element)); - } else { - focusable = goog.dom.isFocusableTabIndex(element); - } - - // IE requires elements to be visible in order to focus them. - return focusable && goog.userAgent.IE ? - goog.dom.hasNonZeroBoundingRect_(element) : focusable; -}; - - -/** - * Returns true if the element has a specified tab index. - * @param {!Element} element Element to check. - * @return {boolean} Whether the element has a specified tab index. - * @private - */ -goog.dom.hasSpecifiedTabIndex_ = function(element) { - // IE returns 0 for an unset tabIndex, so we must use getAttributeNode(), - // which returns an object with a 'specified' property if tabIndex is - // specified. This works on other browsers, too. - var attrNode = element.getAttributeNode('tabindex'); // Must be lowercase! - return goog.isDefAndNotNull(attrNode) && attrNode.specified; -}; - - -/** - * Returns true if the element's tab index allows the element to be focused. - * @param {!Element} element Element to check. - * @return {boolean} Whether the element's tab index allows focus. - * @private - */ -goog.dom.isTabIndexFocusable_ = function(element) { - var index = element.tabIndex; - // NOTE: IE9 puts tabIndex in 16-bit int, e.g. -2 is 65534. - return goog.isNumber(index) && index >= 0 && index < 32768; -}; - - -/** - * Returns true if the element is focusable even when tabIndex is not set. - * @param {!Element} element Element to check. - * @return {boolean} Whether the element natively supports focus. - * @private - */ -goog.dom.nativelySupportsFocus_ = function(element) { - return element.tagName == goog.dom.TagName.A || - element.tagName == goog.dom.TagName.INPUT || - element.tagName == goog.dom.TagName.TEXTAREA || - element.tagName == goog.dom.TagName.SELECT || - element.tagName == goog.dom.TagName.BUTTON; -}; - - -/** - * Returns true if the element has a bounding rectangle that would be visible - * (i.e. its width and height are greater than zero). - * @param {!Element} element Element to check. - * @return {boolean} Whether the element has a non-zero bounding rectangle. - * @private - */ -goog.dom.hasNonZeroBoundingRect_ = function(element) { - var rect = goog.isFunction(element['getBoundingClientRect']) ? - element.getBoundingClientRect() : - {'height': element.offsetHeight, 'width': element.offsetWidth}; - return goog.isDefAndNotNull(rect) && rect.height > 0 && rect.width > 0; -}; - - -/** - * Returns the text content of the current node, without markup and invisible - * symbols. New lines are stripped and whitespace is collapsed, - * such that each character would be visible. - * - * In browsers that support it, innerText is used. Other browsers attempt to - * simulate it via node traversal. Line breaks are canonicalized in IE. - * - * @param {Node} node The node from which we are getting content. - * @return {string} The text content. - */ -goog.dom.getTextContent = function(node) { - var textContent; - // Note(arv): IE9, Opera, and Safari 3 support innerText but they include - // text nodes in script tags. So we revert to use a user agent test here. - if (goog.dom.BrowserFeature.CAN_USE_INNER_TEXT && ('innerText' in node)) { - textContent = goog.string.canonicalizeNewlines(node.innerText); - // Unfortunately .innerText() returns text with ­ symbols - // We need to filter it out and then remove duplicate whitespaces - } else { - var buf = []; - goog.dom.getTextContent_(node, buf, true); - textContent = buf.join(''); - } - - // Strip ­ entities. goog.format.insertWordBreaks inserts them in Opera. - textContent = textContent.replace(/ \xAD /g, ' ').replace(/\xAD/g, ''); - // Strip ​ entities. goog.format.insertWordBreaks inserts them in IE8. - textContent = textContent.replace(/\u200B/g, ''); - - // Skip this replacement on old browsers with working innerText, which - // automatically turns   into ' ' and / +/ into ' ' when reading - // innerText. - if (!goog.dom.BrowserFeature.CAN_USE_INNER_TEXT) { - textContent = textContent.replace(/ +/g, ' '); - } - if (textContent != ' ') { - textContent = textContent.replace(/^\s*/, ''); - } - - return textContent; -}; - - -/** - * Returns the text content of the current node, without markup. - * - * Unlike {@code getTextContent} this method does not collapse whitespaces - * or normalize lines breaks. - * - * @param {Node} node The node from which we are getting content. - * @return {string} The raw text content. - */ -goog.dom.getRawTextContent = function(node) { - var buf = []; - goog.dom.getTextContent_(node, buf, false); - - return buf.join(''); -}; - - -/** - * Recursive support function for text content retrieval. - * - * @param {Node} node The node from which we are getting content. - * @param {Array<string>} buf string buffer. - * @param {boolean} normalizeWhitespace Whether to normalize whitespace. - * @private - */ -goog.dom.getTextContent_ = function(node, buf, normalizeWhitespace) { - if (node.nodeName in goog.dom.TAGS_TO_IGNORE_) { - // ignore certain tags - } else if (node.nodeType == goog.dom.NodeType.TEXT) { - if (normalizeWhitespace) { - buf.push(String(node.nodeValue).replace(/(\r\n|\r|\n)/g, '')); - } else { - buf.push(node.nodeValue); - } - } else if (node.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) { - buf.push(goog.dom.PREDEFINED_TAG_VALUES_[node.nodeName]); - } else { - var child = node.firstChild; - while (child) { - goog.dom.getTextContent_(child, buf, normalizeWhitespace); - child = child.nextSibling; - } - } -}; - - -/** - * Returns the text length of the text contained in a node, without markup. This - * is equivalent to the selection length if the node was selected, or the number - * of cursor movements to traverse the node. Images & BRs take one space. New - * lines are ignored. - * - * @param {Node} node The node whose text content length is being calculated. - * @return {number} The length of {@code node}'s text content. - */ -goog.dom.getNodeTextLength = function(node) { - return goog.dom.getTextContent(node).length; -}; - - -/** - * Returns the text offset of a node relative to one of its ancestors. The text - * length is the same as the length calculated by goog.dom.getNodeTextLength. - * - * @param {Node} node The node whose offset is being calculated. - * @param {Node=} opt_offsetParent The node relative to which the offset will - * be calculated. Defaults to the node's owner document's body. - * @return {number} The text offset. - */ -goog.dom.getNodeTextOffset = function(node, opt_offsetParent) { - var root = opt_offsetParent || goog.dom.getOwnerDocument(node).body; - var buf = []; - while (node && node != root) { - var cur = node; - while ((cur = cur.previousSibling)) { - buf.unshift(goog.dom.getTextContent(cur)); - } - node = node.parentNode; - } - // Trim left to deal with FF cases when there might be line breaks and empty - // nodes at the front of the text - return goog.string.trimLeft(buf.join('')).replace(/ +/g, ' ').length; -}; - - -/** - * Returns the node at a given offset in a parent node. If an object is - * provided for the optional third parameter, the node and the remainder of the - * offset will stored as properties of this object. - * @param {Node} parent The parent node. - * @param {number} offset The offset into the parent node. - * @param {Object=} opt_result Object to be used to store the return value. The - * return value will be stored in the form {node: Node, remainder: number} - * if this object is provided. - * @return {Node} The node at the given offset. - */ -goog.dom.getNodeAtOffset = function(parent, offset, opt_result) { - var stack = [parent], pos = 0, cur = null; - while (stack.length > 0 && pos < offset) { - cur = stack.pop(); - if (cur.nodeName in goog.dom.TAGS_TO_IGNORE_) { - // ignore certain tags - } else if (cur.nodeType == goog.dom.NodeType.TEXT) { - var text = cur.nodeValue.replace(/(\r\n|\r|\n)/g, '').replace(/ +/g, ' '); - pos += text.length; - } else if (cur.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) { - pos += goog.dom.PREDEFINED_TAG_VALUES_[cur.nodeName].length; - } else { - for (var i = cur.childNodes.length - 1; i >= 0; i--) { - stack.push(cur.childNodes[i]); - } - } - } - if (goog.isObject(opt_result)) { - opt_result.remainder = cur ? cur.nodeValue.length + offset - pos - 1 : 0; - opt_result.node = cur; - } - - return cur; -}; - - -/** - * Returns true if the object is a {@code NodeList}. To qualify as a NodeList, - * the object must have a numeric length property and an item function (which - * has type 'string' on IE for some reason). - * @param {Object} val Object to test. - * @return {boolean} Whether the object is a NodeList. - */ -goog.dom.isNodeList = function(val) { - // TODO(attila): Now the isNodeList is part of goog.dom we can use - // goog.userAgent to make this simpler. - // A NodeList must have a length property of type 'number' on all platforms. - if (val && typeof val.length == 'number') { - // A NodeList is an object everywhere except Safari, where it's a function. - if (goog.isObject(val)) { - // A NodeList must have an item function (on non-IE platforms) or an item - // property of type 'string' (on IE). - return typeof val.item == 'function' || typeof val.item == 'string'; - } else if (goog.isFunction(val)) { - // On Safari, a NodeList is a function with an item property that is also - // a function. - return typeof val.item == 'function'; - } - } - - // Not a NodeList. - return false; -}; - - -/** - * Walks up the DOM hierarchy returning the first ancestor that has the passed - * tag name and/or class name. If the passed element matches the specified - * criteria, the element itself is returned. - * @param {Node} element The DOM node to start with. - * @param {?(goog.dom.TagName|string)=} opt_tag The tag name to match (or - * null/undefined to match only based on class name). - * @param {?string=} opt_class The class name to match (or null/undefined to - * match only based on tag name). - * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the - * dom. - * @return {Element} The first ancestor that matches the passed criteria, or - * null if no match is found. - */ -goog.dom.getAncestorByTagNameAndClass = function(element, opt_tag, opt_class, - opt_maxSearchSteps) { - if (!opt_tag && !opt_class) { - return null; - } - var tagName = opt_tag ? opt_tag.toUpperCase() : null; - return /** @type {Element} */ (goog.dom.getAncestor(element, - function(node) { - return (!tagName || node.nodeName == tagName) && - (!opt_class || goog.isString(node.className) && - goog.array.contains(node.className.split(/\s+/), opt_class)); - }, true, opt_maxSearchSteps)); -}; - - -/** - * Walks up the DOM hierarchy returning the first ancestor that has the passed - * class name. If the passed element matches the specified criteria, the - * element itself is returned. - * @param {Node} element The DOM node to start with. - * @param {string} className The class name to match. - * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the - * dom. - * @return {Element} The first ancestor that matches the passed criteria, or - * null if none match. - */ -goog.dom.getAncestorByClass = function(element, className, opt_maxSearchSteps) { - return goog.dom.getAncestorByTagNameAndClass(element, null, className, - opt_maxSearchSteps); -}; - - -/** - * Walks up the DOM hierarchy returning the first ancestor that passes the - * matcher function. - * @param {Node} element The DOM node to start with. - * @param {function(Node) : boolean} matcher A function that returns true if the - * passed node matches the desired criteria. - * @param {boolean=} opt_includeNode If true, the node itself is included in - * the search (the first call to the matcher will pass startElement as - * the node to test). - * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the - * dom. - * @return {Node} DOM node that matched the matcher, or null if there was - * no match. - */ -goog.dom.getAncestor = function( - element, matcher, opt_includeNode, opt_maxSearchSteps) { - if (!opt_includeNode) { - element = element.parentNode; - } - var ignoreSearchSteps = opt_maxSearchSteps == null; - var steps = 0; - while (element && (ignoreSearchSteps || steps <= opt_maxSearchSteps)) { - goog.asserts.assert(element.name != 'parentNode'); - if (matcher(element)) { - return element; - } - element = element.parentNode; - steps++; - } - // Reached the root of the DOM without a match - return null; -}; - - -/** - * Determines the active element in the given document. - * @param {Document} doc The document to look in. - * @return {Element} The active element. - */ -goog.dom.getActiveElement = function(doc) { - try { - return doc && doc.activeElement; - } catch (e) { - // NOTE(nicksantos): Sometimes, evaluating document.activeElement in IE - // throws an exception. I'm not 100% sure why, but I suspect it chokes - // on document.activeElement if the activeElement has been recently - // removed from the DOM by a JS operation. - // - // We assume that an exception here simply means - // "there is no active element." - } - - return null; -}; - - -/** - * Gives the current devicePixelRatio. - * - * By default, this is the value of window.devicePixelRatio (which should be - * preferred if present). - * - * If window.devicePixelRatio is not present, the ratio is calculated with - * window.matchMedia, if present. Otherwise, gives 1.0. - * - * Some browsers (including Chrome) consider the browser zoom level in the pixel - * ratio, so the value may change across multiple calls. - * - * @return {number} The number of actual pixels per virtual pixel. - */ -goog.dom.getPixelRatio = function() { - var win = goog.dom.getWindow(); - if (goog.isDef(win.devicePixelRatio)) { - return win.devicePixelRatio; - } else if (win.matchMedia) { - return goog.dom.matchesPixelRatio_(.75) || - goog.dom.matchesPixelRatio_(1.5) || - goog.dom.matchesPixelRatio_(2) || - goog.dom.matchesPixelRatio_(3) || 1; - } - return 1; -}; - - -/** - * Calculates a mediaQuery to check if the current device supports the - * given actual to virtual pixel ratio. - * @param {number} pixelRatio The ratio of actual pixels to virtual pixels. - * @return {number} pixelRatio if applicable, otherwise 0. - * @private - */ -goog.dom.matchesPixelRatio_ = function(pixelRatio) { - var win = goog.dom.getWindow(); - var query = ('(-webkit-min-device-pixel-ratio: ' + pixelRatio + '),' + - '(min--moz-device-pixel-ratio: ' + pixelRatio + '),' + - '(min-resolution: ' + pixelRatio + 'dppx)'); - return win.matchMedia(query).matches ? pixelRatio : 0; -}; - - - -/** - * Create an instance of a DOM helper with a new document object. - * @param {Document=} opt_document Document object to associate with this - * DOM helper. - * @constructor - */ -goog.dom.DomHelper = function(opt_document) { - /** - * Reference to the document object to use - * @type {!Document} - * @private - */ - this.document_ = opt_document || goog.global.document || document; -}; - - -/** - * Gets the dom helper object for the document where the element resides. - * @param {Node=} opt_node If present, gets the DomHelper for this node. - * @return {!goog.dom.DomHelper} The DomHelper. - */ -goog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper; - - -/** - * Sets the document object. - * @param {!Document} document Document object. - */ -goog.dom.DomHelper.prototype.setDocument = function(document) { - this.document_ = document; -}; - - -/** - * Gets the document object being used by the dom library. - * @return {!Document} Document object. - */ -goog.dom.DomHelper.prototype.getDocument = function() { - return this.document_; -}; - - -/** - * Alias for {@code getElementById}. If a DOM node is passed in then we just - * return that. - * @param {string|Element} element Element ID or a DOM node. - * @return {Element} The element with the given ID, or the node passed in. - */ -goog.dom.DomHelper.prototype.getElement = function(element) { - return goog.dom.getElementHelper_(this.document_, element); -}; - - -/** - * Gets an element by id, asserting that the element is found. - * - * This is used when an element is expected to exist, and should fail with - * an assertion error if it does not (if assertions are enabled). - * - * @param {string} id Element ID. - * @return {!Element} The element with the given ID, if it exists. - */ -goog.dom.DomHelper.prototype.getRequiredElement = function(id) { - return goog.dom.getRequiredElementHelper_(this.document_, id); -}; - - -/** - * Alias for {@code getElement}. - * @param {string|Element} element Element ID or a DOM node. - * @return {Element} The element with the given ID, or the node passed in. - * @deprecated Use {@link goog.dom.DomHelper.prototype.getElement} instead. - */ -goog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement; - - -/** - * Looks up elements by both tag and class name, using browser native functions - * ({@code querySelectorAll}, {@code getElementsByTagName} or - * {@code getElementsByClassName}) where possible. The returned array is a live - * NodeList or a static list depending on the code path taken. - * - * @see goog.dom.query - * - * @param {?string=} opt_tag Element tag name or * for all tags. - * @param {?string=} opt_class Optional class name. - * @param {(Document|Element)=} opt_el Optional element to look in. - * @return { {length: number} } Array-like list of elements (only a length - * property and numerical indices are guaranteed to exist). - */ -goog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function(opt_tag, - opt_class, - opt_el) { - return goog.dom.getElementsByTagNameAndClass_(this.document_, opt_tag, - opt_class, opt_el); -}; - - -/** - * Returns an array of all the elements with the provided className. - * @see {goog.dom.query} - * @param {string} className the name of the class to look for. - * @param {Element|Document=} opt_el Optional element to look in. - * @return { {length: number} } The items found with the class name provided. - */ -goog.dom.DomHelper.prototype.getElementsByClass = function(className, opt_el) { - var doc = opt_el || this.document_; - return goog.dom.getElementsByClass(className, doc); -}; - - -/** - * Returns the first element we find matching the provided class name. - * @see {goog.dom.query} - * @param {string} className the name of the class to look for. - * @param {(Element|Document)=} opt_el Optional element to look in. - * @return {Element} The first item found with the class name provided. - */ -goog.dom.DomHelper.prototype.getElementByClass = function(className, opt_el) { - var doc = opt_el || this.document_; - return goog.dom.getElementByClass(className, doc); -}; - - -/** - * Ensures an element with the given className exists, and then returns the - * first element with the provided className. - * @see {goog.dom.query} - * @param {string} className the name of the class to look for. - * @param {(!Element|!Document)=} opt_root Optional element or document to look - * in. - * @return {!Element} The first item found with the class name provided. - * @throws {goog.asserts.AssertionError} Thrown if no element is found. - */ -goog.dom.DomHelper.prototype.getRequiredElementByClass = function(className, - opt_root) { - var root = opt_root || this.document_; - return goog.dom.getRequiredElementByClass(className, root); -}; - - -/** - * Alias for {@code getElementsByTagNameAndClass}. - * @deprecated Use DomHelper getElementsByTagNameAndClass. - * @see goog.dom.query - * - * @param {?string=} opt_tag Element tag name. - * @param {?string=} opt_class Optional class name. - * @param {Element=} opt_el Optional element to look in. - * @return { {length: number} } Array-like list of elements (only a length - * property and numerical indices are guaranteed to exist). - */ -goog.dom.DomHelper.prototype.$$ = - goog.dom.DomHelper.prototype.getElementsByTagNameAndClass; - - -/** - * Sets a number of properties on a node. - * @param {Element} element DOM node to set properties on. - * @param {Object} properties Hash of property:value pairs. - */ -goog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties; - - -/** - * Gets the dimensions of the viewport. - * @param {Window=} opt_window Optional window element to test. Defaults to - * the window of the Dom Helper. - * @return {!goog.math.Size} Object with values 'width' and 'height'. - */ -goog.dom.DomHelper.prototype.getViewportSize = function(opt_window) { - // TODO(arv): This should not take an argument. That breaks the rule of a - // a DomHelper representing a single frame/window/document. - return goog.dom.getViewportSize(opt_window || this.getWindow()); -}; - - -/** - * Calculates the height of the document. - * - * @return {number} The height of the document. - */ -goog.dom.DomHelper.prototype.getDocumentHeight = function() { - return goog.dom.getDocumentHeight_(this.getWindow()); -}; - - -/** - * Typedef for use with goog.dom.createDom and goog.dom.append. - * @typedef {Object|string|Array|NodeList} - */ -goog.dom.Appendable; - - -/** - * Returns a dom node with a set of attributes. This function accepts varargs - * for subsequent nodes to be added. Subsequent nodes will be added to the - * first node as childNodes. - * - * So: - * <code>createDom('div', null, createDom('p'), createDom('p'));</code> - * would return a div with two child paragraphs - * - * An easy way to move all child nodes of an existing element to a new parent - * element is: - * <code>createDom('div', null, oldElement.childNodes);</code> - * which will remove all child nodes from the old element and add them as - * child nodes of the new DIV. - * - * @param {string} tagName Tag to create. - * @param {Object|string=} opt_attributes If object, then a map of name-value - * pairs for attributes. If a string, then this is the className of the new - * element. - * @param {...goog.dom.Appendable} var_args Further DOM nodes or - * strings for text nodes. If one of the var_args is an array or - * NodeList, its elements will be added as childNodes instead. - * @return {!Element} Reference to a DOM node. - */ -goog.dom.DomHelper.prototype.createDom = function(tagName, - opt_attributes, - var_args) { - return goog.dom.createDom_(this.document_, arguments); -}; - - -/** - * Alias for {@code createDom}. - * @param {string} tagName Tag to create. - * @param {(Object|string)=} opt_attributes If object, then a map of name-value - * pairs for attributes. If a string, then this is the className of the new - * element. - * @param {...goog.dom.Appendable} var_args Further DOM nodes or strings for - * text nodes. If one of the var_args is an array, its children will be - * added as childNodes instead. - * @return {!Element} Reference to a DOM node. - * @deprecated Use {@link goog.dom.DomHelper.prototype.createDom} instead. - */ -goog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom; - - -/** - * Creates a new element. - * @param {string} name Tag name. - * @return {!Element} The new element. - */ -goog.dom.DomHelper.prototype.createElement = function(name) { - return this.document_.createElement(name); -}; - - -/** - * Creates a new text node. - * @param {number|string} content Content. - * @return {!Text} The new text node. - */ -goog.dom.DomHelper.prototype.createTextNode = function(content) { - return this.document_.createTextNode(String(content)); -}; - - -/** - * Create a table. - * @param {number} rows The number of rows in the table. Must be >= 1. - * @param {number} columns The number of columns in the table. Must be >= 1. - * @param {boolean=} opt_fillWithNbsp If true, fills table entries with - * {@code goog.string.Unicode.NBSP} characters. - * @return {!HTMLElement} The created table. - */ -goog.dom.DomHelper.prototype.createTable = function(rows, columns, - opt_fillWithNbsp) { - return goog.dom.createTable_(this.document_, rows, columns, - !!opt_fillWithNbsp); -}; - - -/** - * Converts an HTML into a node or a document fragment. A single Node is used if - * {@code html} only generates a single node. If {@code html} generates multiple - * nodes then these are put inside a {@code DocumentFragment}. - * @param {!goog.html.SafeHtml} html The HTML markup to convert. - * @return {!Node} The resulting node. - */ -goog.dom.DomHelper.prototype.safeHtmlToNode = function(html) { - return goog.dom.safeHtmlToNode_(this.document_, html); -}; - - -/** - * Converts an HTML string into a node or a document fragment. A single Node - * is used if the {@code htmlString} only generates a single node. If the - * {@code htmlString} generates multiple nodes then these are put inside a - * {@code DocumentFragment}. - * - * @param {string} htmlString The HTML string to convert. - * @return {!Node} The resulting node. - */ -goog.dom.DomHelper.prototype.htmlToDocumentFragment = function(htmlString) { - return goog.dom.htmlToDocumentFragment_(this.document_, htmlString); -}; - - -/** - * Returns true if the browser is in "CSS1-compatible" (standards-compliant) - * mode, false otherwise. - * @return {boolean} True if in CSS1-compatible mode. - */ -goog.dom.DomHelper.prototype.isCss1CompatMode = function() { - return goog.dom.isCss1CompatMode_(this.document_); -}; - - -/** - * Gets the window object associated with the document. - * @return {!Window} The window associated with the given document. - */ -goog.dom.DomHelper.prototype.getWindow = function() { - return goog.dom.getWindow_(this.document_); -}; - - -/** - * Gets the document scroll element. - * @return {!Element} Scrolling element. - */ -goog.dom.DomHelper.prototype.getDocumentScrollElement = function() { - return goog.dom.getDocumentScrollElement_(this.document_); -}; - - -/** - * Gets the document scroll distance as a coordinate object. - * @return {!goog.math.Coordinate} Object with properties 'x' and 'y'. - */ -goog.dom.DomHelper.prototype.getDocumentScroll = function() { - return goog.dom.getDocumentScroll_(this.document_); -}; - - -/** - * Determines the active element in the given document. - * @param {Document=} opt_doc The document to look in. - * @return {Element} The active element. - */ -goog.dom.DomHelper.prototype.getActiveElement = function(opt_doc) { - return goog.dom.getActiveElement(opt_doc || this.document_); -}; - - -/** - * Appends a child to a node. - * @param {Node} parent Parent. - * @param {Node} child Child. - */ -goog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild; - - -/** - * Appends a node with text or other nodes. - * @param {!Node} parent The node to append nodes to. - * @param {...goog.dom.Appendable} var_args The things to append to the node. - * If this is a Node it is appended as is. - * If this is a string then a text node is appended. - * If this is an array like object then fields 0 to length - 1 are appended. - */ -goog.dom.DomHelper.prototype.append = goog.dom.append; - - -/** - * Determines if the given node can contain children, intended to be used for - * HTML generation. - * - * @param {Node} node The node to check. - * @return {boolean} Whether the node can contain children. - */ -goog.dom.DomHelper.prototype.canHaveChildren = goog.dom.canHaveChildren; - - -/** - * Removes all the child nodes on a DOM node. - * @param {Node} node Node to remove children from. - */ -goog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren; - - -/** - * Inserts a new node before an existing reference node (i.e., as the previous - * sibling). If the reference node has no parent, then does nothing. - * @param {Node} newNode Node to insert. - * @param {Node} refNode Reference node to insert before. - */ -goog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore; - - -/** - * Inserts a new node after an existing reference node (i.e., as the next - * sibling). If the reference node has no parent, then does nothing. - * @param {Node} newNode Node to insert. - * @param {Node} refNode Reference node to insert after. - */ -goog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter; - - -/** - * Insert a child at a given index. If index is larger than the number of child - * nodes that the parent currently has, the node is inserted as the last child - * node. - * @param {Element} parent The element into which to insert the child. - * @param {Node} child The element to insert. - * @param {number} index The index at which to insert the new child node. Must - * not be negative. - */ -goog.dom.DomHelper.prototype.insertChildAt = goog.dom.insertChildAt; - - -/** - * Removes a node from its parent. - * @param {Node} node The node to remove. - * @return {Node} The node removed if removed; else, null. - */ -goog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode; - - -/** - * Replaces a node in the DOM tree. Will do nothing if {@code oldNode} has no - * parent. - * @param {Node} newNode Node to insert. - * @param {Node} oldNode Node to replace. - */ -goog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode; - - -/** - * Flattens an element. That is, removes it and replace it with its children. - * @param {Element} element The element to flatten. - * @return {Element|undefined} The original element, detached from the document - * tree, sans children, or undefined if the element was already not in the - * document. - */ -goog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement; - - -/** - * Returns an array containing just the element children of the given element. - * @param {Element} element The element whose element children we want. - * @return {!(Array|NodeList)} An array or array-like list of just the element - * children of the given element. - */ -goog.dom.DomHelper.prototype.getChildren = goog.dom.getChildren; - - -/** - * Returns the first child node that is an element. - * @param {Node} node The node to get the first child element of. - * @return {Element} The first child node of {@code node} that is an element. - */ -goog.dom.DomHelper.prototype.getFirstElementChild = - goog.dom.getFirstElementChild; - - -/** - * Returns the last child node that is an element. - * @param {Node} node The node to get the last child element of. - * @return {Element} The last child node of {@code node} that is an element. - */ -goog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild; - - -/** - * Returns the first next sibling that is an element. - * @param {Node} node The node to get the next sibling element of. - * @return {Element} The next sibling of {@code node} that is an element. - */ -goog.dom.DomHelper.prototype.getNextElementSibling = - goog.dom.getNextElementSibling; - - -/** - * Returns the first previous sibling that is an element. - * @param {Node} node The node to get the previous sibling element of. - * @return {Element} The first previous sibling of {@code node} that is - * an element. - */ -goog.dom.DomHelper.prototype.getPreviousElementSibling = - goog.dom.getPreviousElementSibling; - - -/** - * Returns the next node in source order from the given node. - * @param {Node} node The node. - * @return {Node} The next node in the DOM tree, or null if this was the last - * node. - */ -goog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode; - - -/** - * Returns the previous node in source order from the given node. - * @param {Node} node The node. - * @return {Node} The previous node in the DOM tree, or null if this was the - * first node. - */ -goog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode; - - -/** - * Whether the object looks like a DOM node. - * @param {?} obj The object being tested for node likeness. - * @return {boolean} Whether the object looks like a DOM node. - */ -goog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike; - - -/** - * Whether the object looks like an Element. - * @param {?} obj The object being tested for Element likeness. - * @return {boolean} Whether the object looks like an Element. - */ -goog.dom.DomHelper.prototype.isElement = goog.dom.isElement; - - -/** - * Returns true if the specified value is a Window object. This includes the - * global window for HTML pages, and iframe windows. - * @param {?} obj Variable to test. - * @return {boolean} Whether the variable is a window. - */ -goog.dom.DomHelper.prototype.isWindow = goog.dom.isWindow; - - -/** - * Returns an element's parent, if it's an Element. - * @param {Element} element The DOM element. - * @return {Element} The parent, or null if not an Element. - */ -goog.dom.DomHelper.prototype.getParentElement = goog.dom.getParentElement; - - -/** - * Whether a node contains another node. - * @param {Node} parent The node that should contain the other node. - * @param {Node} descendant The node to test presence of. - * @return {boolean} Whether the parent node contains the descendent node. - */ -goog.dom.DomHelper.prototype.contains = goog.dom.contains; - - -/** - * Compares the document order of two nodes, returning 0 if they are the same - * node, a negative number if node1 is before node2, and a positive number if - * node2 is before node1. Note that we compare the order the tags appear in the - * document so in the tree <b><i>text</i></b> the B node is considered to be - * before the I node. - * - * @param {Node} node1 The first node to compare. - * @param {Node} node2 The second node to compare. - * @return {number} 0 if the nodes are the same node, a negative number if node1 - * is before node2, and a positive number if node2 is before node1. - */ -goog.dom.DomHelper.prototype.compareNodeOrder = goog.dom.compareNodeOrder; - - -/** - * Find the deepest common ancestor of the given nodes. - * @param {...Node} var_args The nodes to find a common ancestor of. - * @return {Node} The common ancestor of the nodes, or null if there is none. - * null will only be returned if two or more of the nodes are from different - * documents. - */ -goog.dom.DomHelper.prototype.findCommonAncestor = goog.dom.findCommonAncestor; - - -/** - * Returns the owner document for a node. - * @param {Node} node The node to get the document for. - * @return {!Document} The document owning the node. - */ -goog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument; - - -/** - * Cross browser function for getting the document element of an iframe. - * @param {Element} iframe Iframe element. - * @return {!Document} The frame content document. - */ -goog.dom.DomHelper.prototype.getFrameContentDocument = - goog.dom.getFrameContentDocument; - - -/** - * Cross browser function for getting the window of a frame or iframe. - * @param {Element} frame Frame element. - * @return {Window} The window associated with the given frame. - */ -goog.dom.DomHelper.prototype.getFrameContentWindow = - goog.dom.getFrameContentWindow; - - -/** - * Sets the text content of a node, with cross-browser support. - * @param {Node} node The node to change the text content of. - * @param {string|number} text The value that should replace the node's content. - */ -goog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent; - - -/** - * Gets the outerHTML of a node, which islike innerHTML, except that it - * actually contains the HTML of the node itself. - * @param {Element} element The element to get the HTML of. - * @return {string} The outerHTML of the given element. - */ -goog.dom.DomHelper.prototype.getOuterHtml = goog.dom.getOuterHtml; - - -/** - * Finds the first descendant node that matches the filter function. This does - * a depth first search. - * @param {Node} root The root of the tree to search. - * @param {function(Node) : boolean} p The filter function. - * @return {Node|undefined} The found node or undefined if none is found. - */ -goog.dom.DomHelper.prototype.findNode = goog.dom.findNode; - - -/** - * Finds all the descendant nodes that matches the filter function. This does a - * depth first search. - * @param {Node} root The root of the tree to search. - * @param {function(Node) : boolean} p The filter function. - * @return {Array<Node>} The found nodes or an empty array if none are found. - */ -goog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes; - - -/** - * Returns true if the element has a tab index that allows it to receive - * keyboard focus (tabIndex >= 0), false otherwise. Note that some elements - * natively support keyboard focus, even if they have no tab index. - * @param {!Element} element Element to check. - * @return {boolean} Whether the element has a tab index that allows keyboard - * focus. - */ -goog.dom.DomHelper.prototype.isFocusableTabIndex = goog.dom.isFocusableTabIndex; - - -/** - * Enables or disables keyboard focus support on the element via its tab index. - * Only elements for which {@link goog.dom.isFocusableTabIndex} returns true - * (or elements that natively support keyboard focus, like form elements) can - * receive keyboard focus. See http://go/tabindex for more info. - * @param {Element} element Element whose tab index is to be changed. - * @param {boolean} enable Whether to set or remove a tab index on the element - * that supports keyboard focus. - */ -goog.dom.DomHelper.prototype.setFocusableTabIndex = - goog.dom.setFocusableTabIndex; - - -/** - * Returns true if the element can be focused, i.e. it has a tab index that - * allows it to receive keyboard focus (tabIndex >= 0), or it is an element - * that natively supports keyboard focus. - * @param {!Element} element Element to check. - * @return {boolean} Whether the element allows keyboard focus. - */ -goog.dom.DomHelper.prototype.isFocusable = goog.dom.isFocusable; - - -/** - * Returns the text contents of the current node, without markup. New lines are - * stripped and whitespace is collapsed, such that each character would be - * visible. - * - * In browsers that support it, innerText is used. Other browsers attempt to - * simulate it via node traversal. Line breaks are canonicalized in IE. - * - * @param {Node} node The node from which we are getting content. - * @return {string} The text content. - */ -goog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent; - - -/** - * Returns the text length of the text contained in a node, without markup. This - * is equivalent to the selection length if the node was selected, or the number - * of cursor movements to traverse the node. Images & BRs take one space. New - * lines are ignored. - * - * @param {Node} node The node whose text content length is being calculated. - * @return {number} The length of {@code node}'s text content. - */ -goog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength; - - -/** - * Returns the text offset of a node relative to one of its ancestors. The text - * length is the same as the length calculated by - * {@code goog.dom.getNodeTextLength}. - * - * @param {Node} node The node whose offset is being calculated. - * @param {Node=} opt_offsetParent Defaults to the node's owner document's body. - * @return {number} The text offset. - */ -goog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset; - - -/** - * Returns the node at a given offset in a parent node. If an object is - * provided for the optional third parameter, the node and the remainder of the - * offset will stored as properties of this object. - * @param {Node} parent The parent node. - * @param {number} offset The offset into the parent node. - * @param {Object=} opt_result Object to be used to store the return value. The - * return value will be stored in the form {node: Node, remainder: number} - * if this object is provided. - * @return {Node} The node at the given offset. - */ -goog.dom.DomHelper.prototype.getNodeAtOffset = goog.dom.getNodeAtOffset; - - -/** - * Returns true if the object is a {@code NodeList}. To qualify as a NodeList, - * the object must have a numeric length property and an item function (which - * has type 'string' on IE for some reason). - * @param {Object} val Object to test. - * @return {boolean} Whether the object is a NodeList. - */ -goog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList; - - -/** - * Walks up the DOM hierarchy returning the first ancestor that has the passed - * tag name and/or class name. If the passed element matches the specified - * criteria, the element itself is returned. - * @param {Node} element The DOM node to start with. - * @param {?(goog.dom.TagName|string)=} opt_tag The tag name to match (or - * null/undefined to match only based on class name). - * @param {?string=} opt_class The class name to match (or null/undefined to - * match only based on tag name). - * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the - * dom. - * @return {Element} The first ancestor that matches the passed criteria, or - * null if no match is found. - */ -goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass = - goog.dom.getAncestorByTagNameAndClass; - - -/** - * Walks up the DOM hierarchy returning the first ancestor that has the passed - * class name. If the passed element matches the specified criteria, the - * element itself is returned. - * @param {Node} element The DOM node to start with. - * @param {string} class The class name to match. - * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the - * dom. - * @return {Element} The first ancestor that matches the passed criteria, or - * null if none match. - */ -goog.dom.DomHelper.prototype.getAncestorByClass = - goog.dom.getAncestorByClass; - - -/** - * Walks up the DOM hierarchy returning the first ancestor that passes the - * matcher function. - * @param {Node} element The DOM node to start with. - * @param {function(Node) : boolean} matcher A function that returns true if the - * passed node matches the desired criteria. - * @param {boolean=} opt_includeNode If true, the node itself is included in - * the search (the first call to the matcher will pass startElement as - * the node to test). - * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the - * dom. - * @return {Node} DOM node that matched the matcher, or null if there was - * no match. - */ -goog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor; - -// Copyright 2012 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for detecting, adding and removing classes. Prefer - * this over goog.dom.classes for new code since it attempts to use classList - * (DOMTokenList: http://dom.spec.whatwg.org/#domtokenlist) which is faster - * and requires less code. - * - * Note: these utilities are meant to operate on HTMLElements - * and may have unexpected behavior on elements with differing interfaces - * (such as SVGElements). - */ - - -goog.provide('goog.dom.classlist'); - -goog.require('goog.array'); - - -/** - * Override this define at build-time if you know your target supports it. - * @define {boolean} Whether to use the classList property (DOMTokenList). - */ -goog.define('goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST', false); - - -/** - * Gets an array-like object of class names on an element. - * @param {Element} element DOM node to get the classes of. - * @return {!goog.array.ArrayLike} Class names on {@code element}. - */ -goog.dom.classlist.get = function(element) { - if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) { - return element.classList; - } - - var className = element.className; - // Some types of elements don't have a className in IE (e.g. iframes). - // Furthermore, in Firefox, className is not a string when the element is - // an SVG element. - return goog.isString(className) && className.match(/\S+/g) || []; -}; - - -/** - * Sets the entire class name of an element. - * @param {Element} element DOM node to set class of. - * @param {string} className Class name(s) to apply to element. - */ -goog.dom.classlist.set = function(element, className) { - element.className = className; -}; - - -/** - * Returns true if an element has a class. This method may throw a DOM - * exception for an invalid or empty class name if DOMTokenList is used. - * @param {Element} element DOM node to test. - * @param {string} className Class name to test for. - * @return {boolean} Whether element has the class. - */ -goog.dom.classlist.contains = function(element, className) { - if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) { - return element.classList.contains(className); - } - return goog.array.contains(goog.dom.classlist.get(element), className); -}; - - -/** - * Adds a class to an element. Does not add multiples of class names. This - * method may throw a DOM exception for an invalid or empty class name if - * DOMTokenList is used. - * @param {Element} element DOM node to add class to. - * @param {string} className Class name to add. - */ -goog.dom.classlist.add = function(element, className) { - if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) { - element.classList.add(className); - return; - } - - if (!goog.dom.classlist.contains(element, className)) { - // Ensure we add a space if this is not the first class name added. - element.className += element.className.length > 0 ? - (' ' + className) : className; - } -}; - - -/** - * Convenience method to add a number of class names at once. - * @param {Element} element The element to which to add classes. - * @param {goog.array.ArrayLike<string>} classesToAdd An array-like object - * containing a collection of class names to add to the element. - * This method may throw a DOM exception if classesToAdd contains invalid - * or empty class names. - */ -goog.dom.classlist.addAll = function(element, classesToAdd) { - if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) { - goog.array.forEach(classesToAdd, function(className) { - goog.dom.classlist.add(element, className); - }); - return; - } - - var classMap = {}; - - // Get all current class names into a map. - goog.array.forEach(goog.dom.classlist.get(element), - function(className) { - classMap[className] = true; - }); - - // Add new class names to the map. - goog.array.forEach(classesToAdd, - function(className) { - classMap[className] = true; - }); - - // Flatten the keys of the map into the className. - element.className = ''; - for (var className in classMap) { - element.className += element.className.length > 0 ? - (' ' + className) : className; - } -}; - - -/** - * Removes a class from an element. This method may throw a DOM exception - * for an invalid or empty class name if DOMTokenList is used. - * @param {Element} element DOM node to remove class from. - * @param {string} className Class name to remove. - */ -goog.dom.classlist.remove = function(element, className) { - if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) { - element.classList.remove(className); - return; - } - - if (goog.dom.classlist.contains(element, className)) { - // Filter out the class name. - element.className = goog.array.filter( - goog.dom.classlist.get(element), - function(c) { - return c != className; - }).join(' '); - } -}; - - -/** - * Removes a set of classes from an element. Prefer this call to - * repeatedly calling {@code goog.dom.classlist.remove} if you want to remove - * a large set of class names at once. - * @param {Element} element The element from which to remove classes. - * @param {goog.array.ArrayLike<string>} classesToRemove An array-like object - * containing a collection of class names to remove from the element. - * This method may throw a DOM exception if classesToRemove contains invalid - * or empty class names. - */ -goog.dom.classlist.removeAll = function(element, classesToRemove) { - if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) { - goog.array.forEach(classesToRemove, function(className) { - goog.dom.classlist.remove(element, className); - }); - return; - } - // Filter out those classes in classesToRemove. - element.className = goog.array.filter( - goog.dom.classlist.get(element), - function(className) { - // If this class is not one we are trying to remove, - // add it to the array of new class names. - return !goog.array.contains(classesToRemove, className); - }).join(' '); -}; - - -/** - * Adds or removes a class depending on the enabled argument. This method - * may throw a DOM exception for an invalid or empty class name if DOMTokenList - * is used. - * @param {Element} element DOM node to add or remove the class on. - * @param {string} className Class name to add or remove. - * @param {boolean} enabled Whether to add or remove the class (true adds, - * false removes). - */ -goog.dom.classlist.enable = function(element, className, enabled) { - if (enabled) { - goog.dom.classlist.add(element, className); - } else { - goog.dom.classlist.remove(element, className); - } -}; - - -/** - * Adds or removes a set of classes depending on the enabled argument. This - * method may throw a DOM exception for an invalid or empty class name if - * DOMTokenList is used. - * @param {!Element} element DOM node to add or remove the class on. - * @param {goog.array.ArrayLike<string>} classesToEnable An array-like object - * containing a collection of class names to add or remove from the element. - * @param {boolean} enabled Whether to add or remove the classes (true adds, - * false removes). - */ -goog.dom.classlist.enableAll = function(element, classesToEnable, enabled) { - var f = enabled ? goog.dom.classlist.addAll : - goog.dom.classlist.removeAll; - f(element, classesToEnable); -}; - - -/** - * Switches a class on an element from one to another without disturbing other - * classes. If the fromClass isn't removed, the toClass won't be added. This - * method may throw a DOM exception if the class names are empty or invalid. - * @param {Element} element DOM node to swap classes on. - * @param {string} fromClass Class to remove. - * @param {string} toClass Class to add. - * @return {boolean} Whether classes were switched. - */ -goog.dom.classlist.swap = function(element, fromClass, toClass) { - if (goog.dom.classlist.contains(element, fromClass)) { - goog.dom.classlist.remove(element, fromClass); - goog.dom.classlist.add(element, toClass); - return true; - } - return false; -}; - - -/** - * Removes a class if an element has it, and adds it the element doesn't have - * it. Won't affect other classes on the node. This method may throw a DOM - * exception if the class name is empty or invalid. - * @param {Element} element DOM node to toggle class on. - * @param {string} className Class to toggle. - * @return {boolean} True if class was added, false if it was removed - * (in other words, whether element has the class after this function has - * been called). - */ -goog.dom.classlist.toggle = function(element, className) { - var add = !goog.dom.classlist.contains(element, className); - goog.dom.classlist.enable(element, className, add); - return add; -}; - - -/** - * Adds and removes a class of an element. Unlike - * {@link goog.dom.classlist.swap}, this method adds the classToAdd regardless - * of whether the classToRemove was present and had been removed. This method - * may throw a DOM exception if the class names are empty or invalid. - * - * @param {Element} element DOM node to swap classes on. - * @param {string} classToRemove Class to remove. - * @param {string} classToAdd Class to add. - */ -goog.dom.classlist.addRemove = function(element, classToRemove, classToAdd) { - goog.dom.classlist.remove(element, classToRemove); - goog.dom.classlist.add(element, classToAdd); -}; - -// Copyright 2012 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Vendor prefix getters. - */ - -goog.provide('goog.dom.vendor'); - -goog.require('goog.string'); -goog.require('goog.userAgent'); - - -/** - * Returns the JS vendor prefix used in CSS properties. Different vendors - * use different methods of changing the case of the property names. - * - * @return {?string} The JS vendor prefix or null if there is none. - */ -goog.dom.vendor.getVendorJsPrefix = function() { - if (goog.userAgent.WEBKIT) { - return 'Webkit'; - } else if (goog.userAgent.GECKO) { - return 'Moz'; - } else if (goog.userAgent.IE) { - return 'ms'; - } else if (goog.userAgent.OPERA) { - return 'O'; - } - - return null; -}; - - -/** - * Returns the vendor prefix used in CSS properties. - * - * @return {?string} The vendor prefix or null if there is none. - */ -goog.dom.vendor.getVendorPrefix = function() { - if (goog.userAgent.WEBKIT) { - return '-webkit'; - } else if (goog.userAgent.GECKO) { - return '-moz'; - } else if (goog.userAgent.IE) { - return '-ms'; - } else if (goog.userAgent.OPERA) { - return '-o'; - } - - return null; -}; - - -/** - * @param {string} propertyName A property name. - * @param {!Object=} opt_object If provided, we verify if the property exists in - * the object. - * @return {?string} A vendor prefixed property name, or null if it does not - * exist. - */ -goog.dom.vendor.getPrefixedPropertyName = function(propertyName, opt_object) { - // We first check for a non-prefixed property, if available. - if (opt_object && propertyName in opt_object) { - return propertyName; - } - var prefix = goog.dom.vendor.getVendorJsPrefix(); - if (prefix) { - prefix = prefix.toLowerCase(); - var prefixedPropertyName = prefix + goog.string.toTitleCase(propertyName); - return (!goog.isDef(opt_object) || prefixedPropertyName in opt_object) ? - prefixedPropertyName : null; - } - return null; -}; - - -/** - * @param {string} eventType An event type. - * @return {string} A lower-cased vendor prefixed event type. - */ -goog.dom.vendor.getPrefixedEventType = function(eventType) { - var prefix = goog.dom.vendor.getVendorJsPrefix() || ''; - return (prefix + eventType).toLowerCase(); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A utility class for representing a numeric box. - */ - - -goog.provide('goog.math.Box'); - -goog.require('goog.math.Coordinate'); - - - -/** - * Class for representing a box. A box is specified as a top, right, bottom, - * and left. A box is useful for representing margins and padding. - * - * This class assumes 'screen coordinates': larger Y coordinates are further - * from the top of the screen. - * - * @param {number} top Top. - * @param {number} right Right. - * @param {number} bottom Bottom. - * @param {number} left Left. - * @struct - * @constructor - */ -goog.math.Box = function(top, right, bottom, left) { - /** - * Top - * @type {number} - */ - this.top = top; - - /** - * Right - * @type {number} - */ - this.right = right; - - /** - * Bottom - * @type {number} - */ - this.bottom = bottom; - - /** - * Left - * @type {number} - */ - this.left = left; -}; - - -/** - * Creates a Box by bounding a collection of goog.math.Coordinate objects - * @param {...goog.math.Coordinate} var_args Coordinates to be included inside - * the box. - * @return {!goog.math.Box} A Box containing all the specified Coordinates. - */ -goog.math.Box.boundingBox = function(var_args) { - var box = new goog.math.Box(arguments[0].y, arguments[0].x, - arguments[0].y, arguments[0].x); - for (var i = 1; i < arguments.length; i++) { - box.expandToIncludeCoordinate(arguments[i]); - } - return box; -}; - - -/** - * @return {number} width The width of this Box. - */ -goog.math.Box.prototype.getWidth = function() { - return this.right - this.left; -}; - - -/** - * @return {number} height The height of this Box. - */ -goog.math.Box.prototype.getHeight = function() { - return this.bottom - this.top; -}; - - -/** - * Creates a copy of the box with the same dimensions. - * @return {!goog.math.Box} A clone of this Box. - */ -goog.math.Box.prototype.clone = function() { - return new goog.math.Box(this.top, this.right, this.bottom, this.left); -}; - - -if (goog.DEBUG) { - /** - * Returns a nice string representing the box. - * @return {string} In the form (50t, 73r, 24b, 13l). - * @override - */ - goog.math.Box.prototype.toString = function() { - return '(' + this.top + 't, ' + this.right + 'r, ' + this.bottom + 'b, ' + - this.left + 'l)'; - }; -} - - -/** - * Returns whether the box contains a coordinate or another box. - * - * @param {goog.math.Coordinate|goog.math.Box} other A Coordinate or a Box. - * @return {boolean} Whether the box contains the coordinate or other box. - */ -goog.math.Box.prototype.contains = function(other) { - return goog.math.Box.contains(this, other); -}; - - -/** - * Expands box with the given margins. - * - * @param {number|goog.math.Box} top Top margin or box with all margins. - * @param {number=} opt_right Right margin. - * @param {number=} opt_bottom Bottom margin. - * @param {number=} opt_left Left margin. - * @return {!goog.math.Box} A reference to this Box. - */ -goog.math.Box.prototype.expand = function(top, opt_right, opt_bottom, - opt_left) { - if (goog.isObject(top)) { - this.top -= top.top; - this.right += top.right; - this.bottom += top.bottom; - this.left -= top.left; - } else { - this.top -= top; - this.right += opt_right; - this.bottom += opt_bottom; - this.left -= opt_left; - } - - return this; -}; - - -/** - * Expand this box to include another box. - * NOTE(user): This is used in code that needs to be very fast, please don't - * add functionality to this function at the expense of speed (variable - * arguments, accepting multiple argument types, etc). - * @param {goog.math.Box} box The box to include in this one. - */ -goog.math.Box.prototype.expandToInclude = function(box) { - this.left = Math.min(this.left, box.left); - this.top = Math.min(this.top, box.top); - this.right = Math.max(this.right, box.right); - this.bottom = Math.max(this.bottom, box.bottom); -}; - - -/** - * Expand this box to include the coordinate. - * @param {!goog.math.Coordinate} coord The coordinate to be included - * inside the box. - */ -goog.math.Box.prototype.expandToIncludeCoordinate = function(coord) { - this.top = Math.min(this.top, coord.y); - this.right = Math.max(this.right, coord.x); - this.bottom = Math.max(this.bottom, coord.y); - this.left = Math.min(this.left, coord.x); -}; - - -/** - * Compares boxes for equality. - * @param {goog.math.Box} a A Box. - * @param {goog.math.Box} b A Box. - * @return {boolean} True iff the boxes are equal, or if both are null. - */ -goog.math.Box.equals = function(a, b) { - if (a == b) { - return true; - } - if (!a || !b) { - return false; - } - return a.top == b.top && a.right == b.right && - a.bottom == b.bottom && a.left == b.left; -}; - - -/** - * Returns whether a box contains a coordinate or another box. - * - * @param {goog.math.Box} box A Box. - * @param {goog.math.Coordinate|goog.math.Box} other A Coordinate or a Box. - * @return {boolean} Whether the box contains the coordinate or other box. - */ -goog.math.Box.contains = function(box, other) { - if (!box || !other) { - return false; - } - - if (other instanceof goog.math.Box) { - return other.left >= box.left && other.right <= box.right && - other.top >= box.top && other.bottom <= box.bottom; - } - - // other is a Coordinate. - return other.x >= box.left && other.x <= box.right && - other.y >= box.top && other.y <= box.bottom; -}; - - -/** - * Returns the relative x position of a coordinate compared to a box. Returns - * zero if the coordinate is inside the box. - * - * @param {goog.math.Box} box A Box. - * @param {goog.math.Coordinate} coord A Coordinate. - * @return {number} The x position of {@code coord} relative to the nearest - * side of {@code box}, or zero if {@code coord} is inside {@code box}. - */ -goog.math.Box.relativePositionX = function(box, coord) { - if (coord.x < box.left) { - return coord.x - box.left; - } else if (coord.x > box.right) { - return coord.x - box.right; - } - return 0; -}; - - -/** - * Returns the relative y position of a coordinate compared to a box. Returns - * zero if the coordinate is inside the box. - * - * @param {goog.math.Box} box A Box. - * @param {goog.math.Coordinate} coord A Coordinate. - * @return {number} The y position of {@code coord} relative to the nearest - * side of {@code box}, or zero if {@code coord} is inside {@code box}. - */ -goog.math.Box.relativePositionY = function(box, coord) { - if (coord.y < box.top) { - return coord.y - box.top; - } else if (coord.y > box.bottom) { - return coord.y - box.bottom; - } - return 0; -}; - - -/** - * Returns the distance between a coordinate and the nearest corner/side of a - * box. Returns zero if the coordinate is inside the box. - * - * @param {goog.math.Box} box A Box. - * @param {goog.math.Coordinate} coord A Coordinate. - * @return {number} The distance between {@code coord} and the nearest - * corner/side of {@code box}, or zero if {@code coord} is inside - * {@code box}. - */ -goog.math.Box.distance = function(box, coord) { - var x = goog.math.Box.relativePositionX(box, coord); - var y = goog.math.Box.relativePositionY(box, coord); - return Math.sqrt(x * x + y * y); -}; - - -/** - * Returns whether two boxes intersect. - * - * @param {goog.math.Box} a A Box. - * @param {goog.math.Box} b A second Box. - * @return {boolean} Whether the boxes intersect. - */ -goog.math.Box.intersects = function(a, b) { - return (a.left <= b.right && b.left <= a.right && - a.top <= b.bottom && b.top <= a.bottom); -}; - - -/** - * Returns whether two boxes would intersect with additional padding. - * - * @param {goog.math.Box} a A Box. - * @param {goog.math.Box} b A second Box. - * @param {number} padding The additional padding. - * @return {boolean} Whether the boxes intersect. - */ -goog.math.Box.intersectsWithPadding = function(a, b, padding) { - return (a.left <= b.right + padding && b.left <= a.right + padding && - a.top <= b.bottom + padding && b.top <= a.bottom + padding); -}; - - -/** - * Rounds the fields to the next larger integer values. - * - * @return {!goog.math.Box} This box with ceil'd fields. - */ -goog.math.Box.prototype.ceil = function() { - this.top = Math.ceil(this.top); - this.right = Math.ceil(this.right); - this.bottom = Math.ceil(this.bottom); - this.left = Math.ceil(this.left); - return this; -}; - - -/** - * Rounds the fields to the next smaller integer values. - * - * @return {!goog.math.Box} This box with floored fields. - */ -goog.math.Box.prototype.floor = function() { - this.top = Math.floor(this.top); - this.right = Math.floor(this.right); - this.bottom = Math.floor(this.bottom); - this.left = Math.floor(this.left); - return this; -}; - - -/** - * Rounds the fields to nearest integer values. - * - * @return {!goog.math.Box} This box with rounded fields. - */ -goog.math.Box.prototype.round = function() { - this.top = Math.round(this.top); - this.right = Math.round(this.right); - this.bottom = Math.round(this.bottom); - this.left = Math.round(this.left); - return this; -}; - - -/** - * Translates this box by the given offsets. If a {@code goog.math.Coordinate} - * is given, then the left and right values are translated by the coordinate's - * x value and the top and bottom values are translated by the coordinate's y - * value. Otherwise, {@code tx} and {@code opt_ty} are used to translate the x - * and y dimension values. - * - * @param {number|goog.math.Coordinate} tx The value to translate the x - * dimension values by or the the coordinate to translate this box by. - * @param {number=} opt_ty The value to translate y dimension values by. - * @return {!goog.math.Box} This box after translating. - */ -goog.math.Box.prototype.translate = function(tx, opt_ty) { - if (tx instanceof goog.math.Coordinate) { - this.left += tx.x; - this.right += tx.x; - this.top += tx.y; - this.bottom += tx.y; - } else { - this.left += tx; - this.right += tx; - if (goog.isNumber(opt_ty)) { - this.top += opt_ty; - this.bottom += opt_ty; - } - } - return this; -}; - - -/** - * Scales this coordinate by the given scale factors. The x and y dimension - * values are scaled by {@code sx} and {@code opt_sy} respectively. - * If {@code opt_sy} is not given, then {@code sx} is used for both x and y. - * - * @param {number} sx The scale factor to use for the x dimension. - * @param {number=} opt_sy The scale factor to use for the y dimension. - * @return {!goog.math.Box} This box after scaling. - */ -goog.math.Box.prototype.scale = function(sx, opt_sy) { - var sy = goog.isNumber(opt_sy) ? opt_sy : sx; - this.left *= sx; - this.right *= sx; - this.top *= sy; - this.bottom *= sy; - return this; -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A utility class for representing rectangles. - */ - -goog.provide('goog.math.Rect'); - -goog.require('goog.math.Box'); -goog.require('goog.math.Coordinate'); -goog.require('goog.math.Size'); - - - -/** - * Class for representing rectangular regions. - * @param {number} x Left. - * @param {number} y Top. - * @param {number} w Width. - * @param {number} h Height. - * @struct - * @constructor - */ -goog.math.Rect = function(x, y, w, h) { - /** @type {number} */ - this.left = x; - - /** @type {number} */ - this.top = y; - - /** @type {number} */ - this.width = w; - - /** @type {number} */ - this.height = h; -}; - - -/** - * @return {!goog.math.Rect} A new copy of this Rectangle. - */ -goog.math.Rect.prototype.clone = function() { - return new goog.math.Rect(this.left, this.top, this.width, this.height); -}; - - -/** - * Returns a new Box object with the same position and dimensions as this - * rectangle. - * @return {!goog.math.Box} A new Box representation of this Rectangle. - */ -goog.math.Rect.prototype.toBox = function() { - var right = this.left + this.width; - var bottom = this.top + this.height; - return new goog.math.Box(this.top, - right, - bottom, - this.left); -}; - - -/** - * Creates a new Rect object with the position and size given. - * @param {!goog.math.Coordinate} position The top-left coordinate of the Rect - * @param {!goog.math.Size} size The size of the Rect - * @return {!goog.math.Rect} A new Rect initialized with the given position and - * size. - */ -goog.math.Rect.createFromPositionAndSize = function(position, size) { - return new goog.math.Rect(position.x, position.y, size.width, size.height); -}; - - -/** - * Creates a new Rect object with the same position and dimensions as a given - * Box. Note that this is only the inverse of toBox if left/top are defined. - * @param {goog.math.Box} box A box. - * @return {!goog.math.Rect} A new Rect initialized with the box's position - * and size. - */ -goog.math.Rect.createFromBox = function(box) { - return new goog.math.Rect(box.left, box.top, - box.right - box.left, box.bottom - box.top); -}; - - -if (goog.DEBUG) { - /** - * Returns a nice string representing size and dimensions of rectangle. - * @return {string} In the form (50, 73 - 75w x 25h). - * @override - */ - goog.math.Rect.prototype.toString = function() { - return '(' + this.left + ', ' + this.top + ' - ' + this.width + 'w x ' + - this.height + 'h)'; - }; -} - - -/** - * Compares rectangles for equality. - * @param {goog.math.Rect} a A Rectangle. - * @param {goog.math.Rect} b A Rectangle. - * @return {boolean} True iff the rectangles have the same left, top, width, - * and height, or if both are null. - */ -goog.math.Rect.equals = function(a, b) { - if (a == b) { - return true; - } - if (!a || !b) { - return false; - } - return a.left == b.left && a.width == b.width && - a.top == b.top && a.height == b.height; -}; - - -/** - * Computes the intersection of this rectangle and the rectangle parameter. If - * there is no intersection, returns false and leaves this rectangle as is. - * @param {goog.math.Rect} rect A Rectangle. - * @return {boolean} True iff this rectangle intersects with the parameter. - */ -goog.math.Rect.prototype.intersection = function(rect) { - var x0 = Math.max(this.left, rect.left); - var x1 = Math.min(this.left + this.width, rect.left + rect.width); - - if (x0 <= x1) { - var y0 = Math.max(this.top, rect.top); - var y1 = Math.min(this.top + this.height, rect.top + rect.height); - - if (y0 <= y1) { - this.left = x0; - this.top = y0; - this.width = x1 - x0; - this.height = y1 - y0; - - return true; - } - } - return false; -}; - - -/** - * Returns the intersection of two rectangles. Two rectangles intersect if they - * touch at all, for example, two zero width and height rectangles would - * intersect if they had the same top and left. - * @param {goog.math.Rect} a A Rectangle. - * @param {goog.math.Rect} b A Rectangle. - * @return {goog.math.Rect} A new intersection rect (even if width and height - * are 0), or null if there is no intersection. - */ -goog.math.Rect.intersection = function(a, b) { - // There is no nice way to do intersection via a clone, because any such - // clone might be unnecessary if this function returns null. So, we duplicate - // code from above. - - var x0 = Math.max(a.left, b.left); - var x1 = Math.min(a.left + a.width, b.left + b.width); - - if (x0 <= x1) { - var y0 = Math.max(a.top, b.top); - var y1 = Math.min(a.top + a.height, b.top + b.height); - - if (y0 <= y1) { - return new goog.math.Rect(x0, y0, x1 - x0, y1 - y0); - } - } - return null; -}; - - -/** - * Returns whether two rectangles intersect. Two rectangles intersect if they - * touch at all, for example, two zero width and height rectangles would - * intersect if they had the same top and left. - * @param {goog.math.Rect} a A Rectangle. - * @param {goog.math.Rect} b A Rectangle. - * @return {boolean} Whether a and b intersect. - */ -goog.math.Rect.intersects = function(a, b) { - return (a.left <= b.left + b.width && b.left <= a.left + a.width && - a.top <= b.top + b.height && b.top <= a.top + a.height); -}; - - -/** - * Returns whether a rectangle intersects this rectangle. - * @param {goog.math.Rect} rect A rectangle. - * @return {boolean} Whether rect intersects this rectangle. - */ -goog.math.Rect.prototype.intersects = function(rect) { - return goog.math.Rect.intersects(this, rect); -}; - - -/** - * Computes the difference regions between two rectangles. The return value is - * an array of 0 to 4 rectangles defining the remaining regions of the first - * rectangle after the second has been subtracted. - * @param {goog.math.Rect} a A Rectangle. - * @param {goog.math.Rect} b A Rectangle. - * @return {!Array<!goog.math.Rect>} An array with 0 to 4 rectangles which - * together define the difference area of rectangle a minus rectangle b. - */ -goog.math.Rect.difference = function(a, b) { - var intersection = goog.math.Rect.intersection(a, b); - if (!intersection || !intersection.height || !intersection.width) { - return [a.clone()]; - } - - var result = []; - - var top = a.top; - var height = a.height; - - var ar = a.left + a.width; - var ab = a.top + a.height; - - var br = b.left + b.width; - var bb = b.top + b.height; - - // Subtract off any area on top where A extends past B - if (b.top > a.top) { - result.push(new goog.math.Rect(a.left, a.top, a.width, b.top - a.top)); - top = b.top; - // If we're moving the top down, we also need to subtract the height diff. - height -= b.top - a.top; - } - // Subtract off any area on bottom where A extends past B - if (bb < ab) { - result.push(new goog.math.Rect(a.left, bb, a.width, ab - bb)); - height = bb - top; - } - // Subtract any area on left where A extends past B - if (b.left > a.left) { - result.push(new goog.math.Rect(a.left, top, b.left - a.left, height)); - } - // Subtract any area on right where A extends past B - if (br < ar) { - result.push(new goog.math.Rect(br, top, ar - br, height)); - } - - return result; -}; - - -/** - * Computes the difference regions between this rectangle and {@code rect}. The - * return value is an array of 0 to 4 rectangles defining the remaining regions - * of this rectangle after the other has been subtracted. - * @param {goog.math.Rect} rect A Rectangle. - * @return {!Array<!goog.math.Rect>} An array with 0 to 4 rectangles which - * together define the difference area of rectangle a minus rectangle b. - */ -goog.math.Rect.prototype.difference = function(rect) { - return goog.math.Rect.difference(this, rect); -}; - - -/** - * Expand this rectangle to also include the area of the given rectangle. - * @param {goog.math.Rect} rect The other rectangle. - */ -goog.math.Rect.prototype.boundingRect = function(rect) { - // We compute right and bottom before we change left and top below. - var right = Math.max(this.left + this.width, rect.left + rect.width); - var bottom = Math.max(this.top + this.height, rect.top + rect.height); - - this.left = Math.min(this.left, rect.left); - this.top = Math.min(this.top, rect.top); - - this.width = right - this.left; - this.height = bottom - this.top; -}; - - -/** - * Returns a new rectangle which completely contains both input rectangles. - * @param {goog.math.Rect} a A rectangle. - * @param {goog.math.Rect} b A rectangle. - * @return {goog.math.Rect} A new bounding rect, or null if either rect is - * null. - */ -goog.math.Rect.boundingRect = function(a, b) { - if (!a || !b) { - return null; - } - - var clone = a.clone(); - clone.boundingRect(b); - - return clone; -}; - - -/** - * Tests whether this rectangle entirely contains another rectangle or - * coordinate. - * - * @param {goog.math.Rect|goog.math.Coordinate} another The rectangle or - * coordinate to test for containment. - * @return {boolean} Whether this rectangle contains given rectangle or - * coordinate. - */ -goog.math.Rect.prototype.contains = function(another) { - if (another instanceof goog.math.Rect) { - return this.left <= another.left && - this.left + this.width >= another.left + another.width && - this.top <= another.top && - this.top + this.height >= another.top + another.height; - } else { // (another instanceof goog.math.Coordinate) - return another.x >= this.left && - another.x <= this.left + this.width && - another.y >= this.top && - another.y <= this.top + this.height; - } -}; - - -/** - * @param {!goog.math.Coordinate} point A coordinate. - * @return {number} The squared distance between the point and the closest - * point inside the rectangle. Returns 0 if the point is inside the - * rectangle. - */ -goog.math.Rect.prototype.squaredDistance = function(point) { - var dx = point.x < this.left ? - this.left - point.x : Math.max(point.x - (this.left + this.width), 0); - var dy = point.y < this.top ? - this.top - point.y : Math.max(point.y - (this.top + this.height), 0); - return dx * dx + dy * dy; -}; - - -/** - * @param {!goog.math.Coordinate} point A coordinate. - * @return {number} The distance between the point and the closest point - * inside the rectangle. Returns 0 if the point is inside the rectangle. - */ -goog.math.Rect.prototype.distance = function(point) { - return Math.sqrt(this.squaredDistance(point)); -}; - - -/** - * @return {!goog.math.Size} The size of this rectangle. - */ -goog.math.Rect.prototype.getSize = function() { - return new goog.math.Size(this.width, this.height); -}; - - -/** - * @return {!goog.math.Coordinate} A new coordinate for the top-left corner of - * the rectangle. - */ -goog.math.Rect.prototype.getTopLeft = function() { - return new goog.math.Coordinate(this.left, this.top); -}; - - -/** - * @return {!goog.math.Coordinate} A new coordinate for the center of the - * rectangle. - */ -goog.math.Rect.prototype.getCenter = function() { - return new goog.math.Coordinate( - this.left + this.width / 2, this.top + this.height / 2); -}; - - -/** - * @return {!goog.math.Coordinate} A new coordinate for the bottom-right corner - * of the rectangle. - */ -goog.math.Rect.prototype.getBottomRight = function() { - return new goog.math.Coordinate( - this.left + this.width, this.top + this.height); -}; - - -/** - * Rounds the fields to the next larger integer values. - * @return {!goog.math.Rect} This rectangle with ceil'd fields. - */ -goog.math.Rect.prototype.ceil = function() { - this.left = Math.ceil(this.left); - this.top = Math.ceil(this.top); - this.width = Math.ceil(this.width); - this.height = Math.ceil(this.height); - return this; -}; - - -/** - * Rounds the fields to the next smaller integer values. - * @return {!goog.math.Rect} This rectangle with floored fields. - */ -goog.math.Rect.prototype.floor = function() { - this.left = Math.floor(this.left); - this.top = Math.floor(this.top); - this.width = Math.floor(this.width); - this.height = Math.floor(this.height); - return this; -}; - - -/** - * Rounds the fields to nearest integer values. - * @return {!goog.math.Rect} This rectangle with rounded fields. - */ -goog.math.Rect.prototype.round = function() { - this.left = Math.round(this.left); - this.top = Math.round(this.top); - this.width = Math.round(this.width); - this.height = Math.round(this.height); - return this; -}; - - -/** - * Translates this rectangle by the given offsets. If a - * {@code goog.math.Coordinate} is given, then the left and top values are - * translated by the coordinate's x and y values. Otherwise, top and left are - * translated by {@code tx} and {@code opt_ty} respectively. - * @param {number|goog.math.Coordinate} tx The value to translate left by or the - * the coordinate to translate this rect by. - * @param {number=} opt_ty The value to translate top by. - * @return {!goog.math.Rect} This rectangle after translating. - */ -goog.math.Rect.prototype.translate = function(tx, opt_ty) { - if (tx instanceof goog.math.Coordinate) { - this.left += tx.x; - this.top += tx.y; - } else { - this.left += tx; - if (goog.isNumber(opt_ty)) { - this.top += opt_ty; - } - } - return this; -}; - - -/** - * Scales this rectangle by the given scale factors. The left and width values - * are scaled by {@code sx} and the top and height values are scaled by - * {@code opt_sy}. If {@code opt_sy} is not given, then all fields are scaled - * by {@code sx}. - * @param {number} sx The scale factor to use for the x dimension. - * @param {number=} opt_sy The scale factor to use for the y dimension. - * @return {!goog.math.Rect} This rectangle after scaling. - */ -goog.math.Rect.prototype.scale = function(sx, opt_sy) { - var sy = goog.isNumber(opt_sy) ? opt_sy : sx; - this.left *= sx; - this.width *= sx; - this.top *= sy; - this.height *= sy; - return this; -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for element styles. - * - * @author arv@google.com (Erik Arvidsson) - * @author eae@google.com (Emil A Eklund) - * @see ../demos/inline_block_quirks.html - * @see ../demos/inline_block_standards.html - * @see ../demos/style_viewport.html - */ - -goog.provide('goog.style'); - - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.dom.NodeType'); -goog.require('goog.dom.TagName'); -goog.require('goog.dom.vendor'); -goog.require('goog.math.Box'); -goog.require('goog.math.Coordinate'); -goog.require('goog.math.Rect'); -goog.require('goog.math.Size'); -goog.require('goog.object'); -goog.require('goog.string'); -goog.require('goog.userAgent'); - -goog.forwardDeclare('goog.events.BrowserEvent'); -goog.forwardDeclare('goog.events.Event'); - - -/** - * Sets a style value on an element. - * - * This function is not indended to patch issues in the browser's style - * handling, but to allow easy programmatic access to setting dash-separated - * style properties. An example is setting a batch of properties from a data - * object without overwriting old styles. When possible, use native APIs: - * elem.style.propertyKey = 'value' or (if obliterating old styles is fine) - * elem.style.cssText = 'property1: value1; property2: value2'. - * - * @param {Element} element The element to change. - * @param {string|Object} style If a string, a style name. If an object, a hash - * of style names to style values. - * @param {string|number|boolean=} opt_value If style was a string, then this - * should be the value. - */ -goog.style.setStyle = function(element, style, opt_value) { - if (goog.isString(style)) { - goog.style.setStyle_(element, opt_value, style); - } else { - for (var key in style) { - goog.style.setStyle_(element, style[key], key); - } - } -}; - - -/** - * Sets a style value on an element, with parameters swapped to work with - * {@code goog.object.forEach()}. Prepends a vendor-specific prefix when - * necessary. - * @param {Element} element The element to change. - * @param {string|number|boolean|undefined} value Style value. - * @param {string} style Style name. - * @private - */ -goog.style.setStyle_ = function(element, value, style) { - var propertyName = goog.style.getVendorJsStyleName_(element, style); - - if (propertyName) { - element.style[propertyName] = value; - } -}; - - -/** - * Style name cache that stores previous property name lookups. - * - * This is used by setStyle to speed up property lookups, entries look like: - * { StyleName: ActualPropertyName } - * - * @private {!Object<string, string>} - */ -goog.style.styleNameCache_ = {}; - - -/** - * Returns the style property name in camel-case. If it does not exist and a - * vendor-specific version of the property does exist, then return the vendor- - * specific property name instead. - * @param {Element} element The element to change. - * @param {string} style Style name. - * @return {string} Vendor-specific style. - * @private - */ -goog.style.getVendorJsStyleName_ = function(element, style) { - var propertyName = goog.style.styleNameCache_[style]; - if (!propertyName) { - var camelStyle = goog.string.toCamelCase(style); - propertyName = camelStyle; - - if (element.style[camelStyle] === undefined) { - var prefixedStyle = goog.dom.vendor.getVendorJsPrefix() + - goog.string.toTitleCase(camelStyle); - - if (element.style[prefixedStyle] !== undefined) { - propertyName = prefixedStyle; - } - } - goog.style.styleNameCache_[style] = propertyName; - } - - return propertyName; -}; - - -/** - * Returns the style property name in CSS notation. If it does not exist and a - * vendor-specific version of the property does exist, then return the vendor- - * specific property name instead. - * @param {Element} element The element to change. - * @param {string} style Style name. - * @return {string} Vendor-specific style. - * @private - */ -goog.style.getVendorStyleName_ = function(element, style) { - var camelStyle = goog.string.toCamelCase(style); - - if (element.style[camelStyle] === undefined) { - var prefixedStyle = goog.dom.vendor.getVendorJsPrefix() + - goog.string.toTitleCase(camelStyle); - - if (element.style[prefixedStyle] !== undefined) { - return goog.dom.vendor.getVendorPrefix() + '-' + style; - } - } - - return style; -}; - - -/** - * Retrieves an explicitly-set style value of a node. This returns '' if there - * isn't a style attribute on the element or if this style property has not been - * explicitly set in script. - * - * @param {Element} element Element to get style of. - * @param {string} property Property to get, css-style (if you have a camel-case - * property, use element.style[style]). - * @return {string} Style value. - */ -goog.style.getStyle = function(element, property) { - // element.style is '' for well-known properties which are unset. - // For for browser specific styles as 'filter' is undefined - // so we need to return '' explicitly to make it consistent across - // browsers. - var styleValue = element.style[goog.string.toCamelCase(property)]; - - // Using typeof here because of a bug in Safari 5.1, where this value - // was undefined, but === undefined returned false. - if (typeof(styleValue) !== 'undefined') { - return styleValue; - } - - return element.style[goog.style.getVendorJsStyleName_(element, property)] || - ''; -}; - - -/** - * Retrieves a computed style value of a node. It returns empty string if the - * value cannot be computed (which will be the case in Internet Explorer) or - * "none" if the property requested is an SVG one and it has not been - * explicitly set (firefox and webkit). - * - * @param {Element} element Element to get style of. - * @param {string} property Property to get (camel-case). - * @return {string} Style value. - */ -goog.style.getComputedStyle = function(element, property) { - var doc = goog.dom.getOwnerDocument(element); - if (doc.defaultView && doc.defaultView.getComputedStyle) { - var styles = doc.defaultView.getComputedStyle(element, null); - if (styles) { - // element.style[..] is undefined for browser specific styles - // as 'filter'. - return styles[property] || styles.getPropertyValue(property) || ''; - } - } - - return ''; -}; - - -/** - * Gets the cascaded style value of a node, or null if the value cannot be - * computed (only Internet Explorer can do this). - * - * @param {Element} element Element to get style of. - * @param {string} style Property to get (camel-case). - * @return {string} Style value. - */ -goog.style.getCascadedStyle = function(element, style) { - // TODO(nicksantos): This should be documented to return null. #fixTypes - return element.currentStyle ? element.currentStyle[style] : null; -}; - - -/** - * Cross-browser pseudo get computed style. It returns the computed style where - * available. If not available it tries the cascaded style value (IE - * currentStyle) and in worst case the inline style value. It shouldn't be - * called directly, see http://wiki/Main/ComputedStyleVsCascadedStyle for - * discussion. - * - * @param {Element} element Element to get style of. - * @param {string} style Property to get (must be camelCase, not css-style.). - * @return {string} Style value. - * @private - */ -goog.style.getStyle_ = function(element, style) { - return goog.style.getComputedStyle(element, style) || - goog.style.getCascadedStyle(element, style) || - (element.style && element.style[style]); -}; - - -/** - * Retrieves the computed value of the box-sizing CSS attribute. - * Browser support: http://caniuse.com/css3-boxsizing. - * @param {!Element} element The element whose box-sizing to get. - * @return {?string} 'content-box', 'border-box' or 'padding-box'. null if - * box-sizing is not supported (IE7 and below). - */ -goog.style.getComputedBoxSizing = function(element) { - return goog.style.getStyle_(element, 'boxSizing') || - goog.style.getStyle_(element, 'MozBoxSizing') || - goog.style.getStyle_(element, 'WebkitBoxSizing') || null; -}; - - -/** - * Retrieves the computed value of the position CSS attribute. - * @param {Element} element The element to get the position of. - * @return {string} Position value. - */ -goog.style.getComputedPosition = function(element) { - return goog.style.getStyle_(element, 'position'); -}; - - -/** - * Retrieves the computed background color string for a given element. The - * string returned is suitable for assigning to another element's - * background-color, but is not guaranteed to be in any particular string - * format. Accessing the color in a numeric form may not be possible in all - * browsers or with all input. - * - * If the background color for the element is defined as a hexadecimal value, - * the resulting string can be parsed by goog.color.parse in all supported - * browsers. - * - * Whether named colors like "red" or "lightblue" get translated into a - * format which can be parsed is browser dependent. Calling this function on - * transparent elements will return "transparent" in most browsers or - * "rgba(0, 0, 0, 0)" in WebKit. - * @param {Element} element The element to get the background color of. - * @return {string} The computed string value of the background color. - */ -goog.style.getBackgroundColor = function(element) { - return goog.style.getStyle_(element, 'backgroundColor'); -}; - - -/** - * Retrieves the computed value of the overflow-x CSS attribute. - * @param {Element} element The element to get the overflow-x of. - * @return {string} The computed string value of the overflow-x attribute. - */ -goog.style.getComputedOverflowX = function(element) { - return goog.style.getStyle_(element, 'overflowX'); -}; - - -/** - * Retrieves the computed value of the overflow-y CSS attribute. - * @param {Element} element The element to get the overflow-y of. - * @return {string} The computed string value of the overflow-y attribute. - */ -goog.style.getComputedOverflowY = function(element) { - return goog.style.getStyle_(element, 'overflowY'); -}; - - -/** - * Retrieves the computed value of the z-index CSS attribute. - * @param {Element} element The element to get the z-index of. - * @return {string|number} The computed value of the z-index attribute. - */ -goog.style.getComputedZIndex = function(element) { - return goog.style.getStyle_(element, 'zIndex'); -}; - - -/** - * Retrieves the computed value of the text-align CSS attribute. - * @param {Element} element The element to get the text-align of. - * @return {string} The computed string value of the text-align attribute. - */ -goog.style.getComputedTextAlign = function(element) { - return goog.style.getStyle_(element, 'textAlign'); -}; - - -/** - * Retrieves the computed value of the cursor CSS attribute. - * @param {Element} element The element to get the cursor of. - * @return {string} The computed string value of the cursor attribute. - */ -goog.style.getComputedCursor = function(element) { - return goog.style.getStyle_(element, 'cursor'); -}; - - -/** - * Retrieves the computed value of the CSS transform attribute. - * @param {Element} element The element to get the transform of. - * @return {string} The computed string representation of the transform matrix. - */ -goog.style.getComputedTransform = function(element) { - var property = goog.style.getVendorStyleName_(element, 'transform'); - return goog.style.getStyle_(element, property) || - goog.style.getStyle_(element, 'transform'); -}; - - -/** - * Sets the top/left values of an element. If no unit is specified in the - * argument then it will add px. The second argument is required if the first - * argument is a string or number and is ignored if the first argument - * is a coordinate. - * @param {Element} el Element to move. - * @param {string|number|goog.math.Coordinate} arg1 Left position or coordinate. - * @param {string|number=} opt_arg2 Top position. - */ -goog.style.setPosition = function(el, arg1, opt_arg2) { - var x, y; - - if (arg1 instanceof goog.math.Coordinate) { - x = arg1.x; - y = arg1.y; - } else { - x = arg1; - y = opt_arg2; - } - - el.style.left = goog.style.getPixelStyleValue_( - /** @type {number|string} */ (x), false); - el.style.top = goog.style.getPixelStyleValue_( - /** @type {number|string} */ (y), false); -}; - - -/** - * Gets the offsetLeft and offsetTop properties of an element and returns them - * in a Coordinate object - * @param {Element} element Element. - * @return {!goog.math.Coordinate} The position. - */ -goog.style.getPosition = function(element) { - return new goog.math.Coordinate( - /** @type {!HTMLElement} */ (element).offsetLeft, - /** @type {!HTMLElement} */ (element).offsetTop); -}; - - -/** - * Returns the viewport element for a particular document - * @param {Node=} opt_node DOM node (Document is OK) to get the viewport element - * of. - * @return {Element} document.documentElement or document.body. - */ -goog.style.getClientViewportElement = function(opt_node) { - var doc; - if (opt_node) { - doc = goog.dom.getOwnerDocument(opt_node); - } else { - doc = goog.dom.getDocument(); - } - - // In old IE versions the document.body represented the viewport - if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9) && - !goog.dom.getDomHelper(doc).isCss1CompatMode()) { - return doc.body; - } - return doc.documentElement; -}; - - -/** - * Calculates the viewport coordinates relative to the page/document - * containing the node. The viewport may be the browser viewport for - * non-iframe document, or the iframe container for iframe'd document. - * @param {!Document} doc The document to use as the reference point. - * @return {!goog.math.Coordinate} The page offset of the viewport. - */ -goog.style.getViewportPageOffset = function(doc) { - var body = doc.body; - var documentElement = doc.documentElement; - var scrollLeft = body.scrollLeft || documentElement.scrollLeft; - var scrollTop = body.scrollTop || documentElement.scrollTop; - return new goog.math.Coordinate(scrollLeft, scrollTop); -}; - - -/** - * Gets the client rectangle of the DOM element. - * - * getBoundingClientRect is part of a new CSS object model draft (with a - * long-time presence in IE), replacing the error-prone parent offset - * computation and the now-deprecated Gecko getBoxObjectFor. - * - * This utility patches common browser bugs in getBoundingClientRect. It - * will fail if getBoundingClientRect is unsupported. - * - * If the element is not in the DOM, the result is undefined, and an error may - * be thrown depending on user agent. - * - * @param {!Element} el The element whose bounding rectangle is being queried. - * @return {Object} A native bounding rectangle with numerical left, top, - * right, and bottom. Reported by Firefox to be of object type ClientRect. - * @private - */ -goog.style.getBoundingClientRect_ = function(el) { - var rect; - try { - rect = el.getBoundingClientRect(); - } catch (e) { - // In IE < 9, calling getBoundingClientRect on an orphan element raises an - // "Unspecified Error". All other browsers return zeros. - return {'left': 0, 'top': 0, 'right': 0, 'bottom': 0}; - } - - // Patch the result in IE only, so that this function can be inlined if - // compiled for non-IE. - if (goog.userAgent.IE && el.ownerDocument.body) { - - // In IE, most of the time, 2 extra pixels are added to the top and left - // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and - // IE6 standards mode, this border can be overridden by setting the - // document element's border to zero -- thus, we cannot rely on the - // offset always being 2 pixels. - - // In quirks mode, the offset can be determined by querying the body's - // clientLeft/clientTop, but in standards mode, it is found by querying - // the document element's clientLeft/clientTop. Since we already called - // getBoundingClientRect we have already forced a reflow, so it is not - // too expensive just to query them all. - - // See: http://msdn.microsoft.com/en-us/library/ms536433(VS.85).aspx - var doc = el.ownerDocument; - rect.left -= doc.documentElement.clientLeft + doc.body.clientLeft; - rect.top -= doc.documentElement.clientTop + doc.body.clientTop; - } - return rect; -}; - - -/** - * Returns the first parent that could affect the position of a given element. - * @param {Element} element The element to get the offset parent for. - * @return {Element} The first offset parent or null if one cannot be found. - */ -goog.style.getOffsetParent = function(element) { - // element.offsetParent does the right thing in IE7 and below. In other - // browsers it only includes elements with position absolute, relative or - // fixed, not elements with overflow set to auto or scroll. - if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(8)) { - return element.offsetParent; - } - - var doc = goog.dom.getOwnerDocument(element); - var positionStyle = goog.style.getStyle_(element, 'position'); - var skipStatic = positionStyle == 'fixed' || positionStyle == 'absolute'; - for (var parent = element.parentNode; parent && parent != doc; - parent = parent.parentNode) { - // Skip shadowDOM roots. - if (parent.nodeType == goog.dom.NodeType.DOCUMENT_FRAGMENT && - parent.host) { - parent = parent.host; - } - positionStyle = - goog.style.getStyle_(/** @type {!Element} */ (parent), 'position'); - skipStatic = skipStatic && positionStyle == 'static' && - parent != doc.documentElement && parent != doc.body; - if (!skipStatic && (parent.scrollWidth > parent.clientWidth || - parent.scrollHeight > parent.clientHeight || - positionStyle == 'fixed' || - positionStyle == 'absolute' || - positionStyle == 'relative')) { - return /** @type {!Element} */ (parent); - } - } - return null; -}; - - -/** - * Calculates and returns the visible rectangle for a given element. Returns a - * box describing the visible portion of the nearest scrollable offset ancestor. - * Coordinates are given relative to the document. - * - * @param {Element} element Element to get the visible rect for. - * @return {goog.math.Box} Bounding elementBox describing the visible rect or - * null if scrollable ancestor isn't inside the visible viewport. - */ -goog.style.getVisibleRectForElement = function(element) { - var visibleRect = new goog.math.Box(0, Infinity, Infinity, 0); - var dom = goog.dom.getDomHelper(element); - var body = dom.getDocument().body; - var documentElement = dom.getDocument().documentElement; - var scrollEl = dom.getDocumentScrollElement(); - - // Determine the size of the visible rect by climbing the dom accounting for - // all scrollable containers. - for (var el = element; el = goog.style.getOffsetParent(el); ) { - // clientWidth is zero for inline block elements in IE. - // on WEBKIT, body element can have clientHeight = 0 and scrollHeight > 0 - if ((!goog.userAgent.IE || el.clientWidth != 0) && - (!goog.userAgent.WEBKIT || el.clientHeight != 0 || el != body) && - // body may have overflow set on it, yet we still get the entire - // viewport. In some browsers, el.offsetParent may be - // document.documentElement, so check for that too. - (el != body && el != documentElement && - goog.style.getStyle_(el, 'overflow') != 'visible')) { - var pos = goog.style.getPageOffset(el); - var client = goog.style.getClientLeftTop(el); - pos.x += client.x; - pos.y += client.y; - - visibleRect.top = Math.max(visibleRect.top, pos.y); - visibleRect.right = Math.min(visibleRect.right, - pos.x + el.clientWidth); - visibleRect.bottom = Math.min(visibleRect.bottom, - pos.y + el.clientHeight); - visibleRect.left = Math.max(visibleRect.left, pos.x); - } - } - - // Clip by window's viewport. - var scrollX = scrollEl.scrollLeft, scrollY = scrollEl.scrollTop; - visibleRect.left = Math.max(visibleRect.left, scrollX); - visibleRect.top = Math.max(visibleRect.top, scrollY); - var winSize = dom.getViewportSize(); - visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); - visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); - return visibleRect.top >= 0 && visibleRect.left >= 0 && - visibleRect.bottom > visibleRect.top && - visibleRect.right > visibleRect.left ? - visibleRect : null; -}; - - -/** - * Calculate the scroll position of {@code container} with the minimum amount so - * that the content and the borders of the given {@code element} become visible. - * If the element is bigger than the container, its top left corner will be - * aligned as close to the container's top left corner as possible. - * - * @param {Element} element The element to make visible. - * @param {Element=} opt_container The container to scroll. If not set, then the - * document scroll element will be used. - * @param {boolean=} opt_center Whether to center the element in the container. - * Defaults to false. - * @return {!goog.math.Coordinate} The new scroll position of the container, - * in form of goog.math.Coordinate(scrollLeft, scrollTop). - */ -goog.style.getContainerOffsetToScrollInto = - function(element, opt_container, opt_center) { - var container = opt_container || goog.dom.getDocumentScrollElement(); - // Absolute position of the element's border's top left corner. - var elementPos = goog.style.getPageOffset(element); - // Absolute position of the container's border's top left corner. - var containerPos = goog.style.getPageOffset(container); - var containerBorder = goog.style.getBorderBox(container); - if (container == goog.dom.getDocumentScrollElement()) { - // The element position is calculated based on the page offset, and the - // document scroll element holds the scroll position within the page. We can - // use the scroll position to calculate the relative position from the - // element. - var relX = elementPos.x - container.scrollLeft; - var relY = elementPos.y - container.scrollTop; - if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(10)) { - // In older versions of IE getPageOffset(element) does not include the - // container border so it has to be added to accomodate. - relX += containerBorder.left; - relY += containerBorder.top; - } - } else { - // Relative pos. of the element's border box to the container's content box. - var relX = elementPos.x - containerPos.x - containerBorder.left; - var relY = elementPos.y - containerPos.y - containerBorder.top; - } - // How much the element can move in the container, i.e. the difference between - // the element's bottom-right-most and top-left-most position where it's - // fully visible. - var spaceX = container.clientWidth - - /** @type {HTMLElement} */ (element).offsetWidth; - var spaceY = container.clientHeight - - /** @type {HTMLElement} */ (element).offsetHeight; - - var scrollLeft = container.scrollLeft; - var scrollTop = container.scrollTop; - if (opt_center) { - // All browsers round non-integer scroll positions down. - scrollLeft += relX - spaceX / 2; - scrollTop += relY - spaceY / 2; - } else { - // This formula was designed to give the correct scroll values in the - // following cases: - // - element is higher than container (spaceY < 0) => scroll down by relY - // - element is not higher that container (spaceY >= 0): - // - it is above container (relY < 0) => scroll up by abs(relY) - // - it is below container (relY > spaceY) => scroll down by relY - spaceY - // - it is in the container => don't scroll - scrollLeft += Math.min(relX, Math.max(relX - spaceX, 0)); - scrollTop += Math.min(relY, Math.max(relY - spaceY, 0)); - } - return new goog.math.Coordinate(scrollLeft, scrollTop); -}; - - -/** - * Changes the scroll position of {@code container} with the minimum amount so - * that the content and the borders of the given {@code element} become visible. - * If the element is bigger than the container, its top left corner will be - * aligned as close to the container's top left corner as possible. - * - * @param {Element} element The element to make visible. - * @param {Element=} opt_container The container to scroll. If not set, then the - * document scroll element will be used. - * @param {boolean=} opt_center Whether to center the element in the container. - * Defaults to false. - */ -goog.style.scrollIntoContainerView = - function(element, opt_container, opt_center) { - var container = opt_container || goog.dom.getDocumentScrollElement(); - var offset = - goog.style.getContainerOffsetToScrollInto(element, container, opt_center); - container.scrollLeft = offset.x; - container.scrollTop = offset.y; -}; - - -/** - * Returns clientLeft (width of the left border and, if the directionality is - * right to left, the vertical scrollbar) and clientTop as a coordinate object. - * - * @param {Element} el Element to get clientLeft for. - * @return {!goog.math.Coordinate} Client left and top. - */ -goog.style.getClientLeftTop = function(el) { - return new goog.math.Coordinate(el.clientLeft, el.clientTop); -}; - - -/** - * Returns a Coordinate object relative to the top-left of the HTML document. - * Implemented as a single function to save having to do two recursive loops in - * opera and safari just to get both coordinates. If you just want one value do - * use goog.style.getPageOffsetLeft() and goog.style.getPageOffsetTop(), but - * note if you call both those methods the tree will be analysed twice. - * - * @param {Element} el Element to get the page offset for. - * @return {!goog.math.Coordinate} The page offset. - */ -goog.style.getPageOffset = function(el) { - var doc = goog.dom.getOwnerDocument(el); - // TODO(gboyer): Update the jsdoc in a way that doesn't break the universe. - goog.asserts.assertObject(el, 'Parameter is required'); - - // NOTE(arv): If element is hidden (display none or disconnected or any the - // ancestors are hidden) we get (0,0) by default but we still do the - // accumulation of scroll position. - - // TODO(arv): Should we check if the node is disconnected and in that case - // return (0,0)? - - var pos = new goog.math.Coordinate(0, 0); - var viewportElement = goog.style.getClientViewportElement(doc); - if (el == viewportElement) { - // viewport is always at 0,0 as that defined the coordinate system for this - // function - this avoids special case checks in the code below - return pos; - } - - var box = goog.style.getBoundingClientRect_(el); - // Must add the scroll coordinates in to get the absolute page offset - // of element since getBoundingClientRect returns relative coordinates to - // the viewport. - var scrollCoord = goog.dom.getDomHelper(doc).getDocumentScroll(); - pos.x = box.left + scrollCoord.x; - pos.y = box.top + scrollCoord.y; - - return pos; -}; - - -/** - * Returns the left coordinate of an element relative to the HTML document - * @param {Element} el Elements. - * @return {number} The left coordinate. - */ -goog.style.getPageOffsetLeft = function(el) { - return goog.style.getPageOffset(el).x; -}; - - -/** - * Returns the top coordinate of an element relative to the HTML document - * @param {Element} el Elements. - * @return {number} The top coordinate. - */ -goog.style.getPageOffsetTop = function(el) { - return goog.style.getPageOffset(el).y; -}; - - -/** - * Returns a Coordinate object relative to the top-left of an HTML document - * in an ancestor frame of this element. Used for measuring the position of - * an element inside a frame relative to a containing frame. - * - * @param {Element} el Element to get the page offset for. - * @param {Window} relativeWin The window to measure relative to. If relativeWin - * is not in the ancestor frame chain of the element, we measure relative to - * the top-most window. - * @return {!goog.math.Coordinate} The page offset. - */ -goog.style.getFramedPageOffset = function(el, relativeWin) { - var position = new goog.math.Coordinate(0, 0); - - // Iterate up the ancestor frame chain, keeping track of the current window - // and the current element in that window. - var currentWin = goog.dom.getWindow(goog.dom.getOwnerDocument(el)); - var currentEl = el; - do { - // if we're at the top window, we want to get the page offset. - // if we're at an inner frame, we only want to get the window position - // so that we can determine the actual page offset in the context of - // the outer window. - var offset = currentWin == relativeWin ? - goog.style.getPageOffset(currentEl) : - goog.style.getClientPositionForElement_( - goog.asserts.assert(currentEl)); - - position.x += offset.x; - position.y += offset.y; - } while (currentWin && currentWin != relativeWin && - currentWin != currentWin.parent && - (currentEl = currentWin.frameElement) && - (currentWin = currentWin.parent)); - - return position; -}; - - -/** - * Translates the specified rect relative to origBase page, for newBase page. - * If origBase and newBase are the same, this function does nothing. - * - * @param {goog.math.Rect} rect The source rectangle relative to origBase page, - * and it will have the translated result. - * @param {goog.dom.DomHelper} origBase The DomHelper for the input rectangle. - * @param {goog.dom.DomHelper} newBase The DomHelper for the resultant - * coordinate. This must be a DOM for an ancestor frame of origBase - * or the same as origBase. - */ -goog.style.translateRectForAnotherFrame = function(rect, origBase, newBase) { - if (origBase.getDocument() != newBase.getDocument()) { - var body = origBase.getDocument().body; - var pos = goog.style.getFramedPageOffset(body, newBase.getWindow()); - - // Adjust Body's margin. - pos = goog.math.Coordinate.difference(pos, goog.style.getPageOffset(body)); - - if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9) && - !origBase.isCss1CompatMode()) { - pos = goog.math.Coordinate.difference(pos, origBase.getDocumentScroll()); - } - - rect.left += pos.x; - rect.top += pos.y; - } -}; - - -/** - * Returns the position of an element relative to another element in the - * document. A relative to B - * @param {Element|Event|goog.events.Event} a Element or mouse event whose - * position we're calculating. - * @param {Element|Event|goog.events.Event} b Element or mouse event position - * is relative to. - * @return {!goog.math.Coordinate} The relative position. - */ -goog.style.getRelativePosition = function(a, b) { - var ap = goog.style.getClientPosition(a); - var bp = goog.style.getClientPosition(b); - return new goog.math.Coordinate(ap.x - bp.x, ap.y - bp.y); -}; - - -/** - * Returns the position of the event or the element's border box relative to - * the client viewport. - * @param {!Element} el Element whose position to get. - * @return {!goog.math.Coordinate} The position. - * @private - */ -goog.style.getClientPositionForElement_ = function(el) { - var box = goog.style.getBoundingClientRect_(el); - return new goog.math.Coordinate(box.left, box.top); -}; - - -/** - * Returns the position of the event or the element's border box relative to - * the client viewport. If an event is passed, and if this event is a "touch" - * event, then the position of the first changedTouches will be returned. - * @param {Element|Event|goog.events.Event} el Element or a mouse / touch event. - * @return {!goog.math.Coordinate} The position. - */ -goog.style.getClientPosition = function(el) { - goog.asserts.assert(el); - if (el.nodeType == goog.dom.NodeType.ELEMENT) { - return goog.style.getClientPositionForElement_( - /** @type {!Element} */ (el)); - } else { - var targetEvent = el.changedTouches ? el.changedTouches[0] : el; - return new goog.math.Coordinate( - targetEvent.clientX, - targetEvent.clientY); - } -}; - - -/** - * Moves an element to the given coordinates relative to the client viewport. - * @param {Element} el Absolutely positioned element to set page offset for. - * It must be in the document. - * @param {number|goog.math.Coordinate} x Left position of the element's margin - * box or a coordinate object. - * @param {number=} opt_y Top position of the element's margin box. - */ -goog.style.setPageOffset = function(el, x, opt_y) { - // Get current pageoffset - var cur = goog.style.getPageOffset(el); - - if (x instanceof goog.math.Coordinate) { - opt_y = x.y; - x = x.x; - } - - // NOTE(arv): We cannot allow strings for x and y. We could but that would - // require us to manually transform between different units - - // Work out deltas - var dx = x - cur.x; - var dy = opt_y - cur.y; - - // Set position to current left/top + delta - goog.style.setPosition(el, /** @type {!HTMLElement} */ (el).offsetLeft + dx, - /** @type {!HTMLElement} */ (el).offsetTop + dy); -}; - - -/** - * Sets the width/height values of an element. If an argument is numeric, - * or a goog.math.Size is passed, it is assumed to be pixels and will add - * 'px' after converting it to an integer in string form. (This just sets the - * CSS width and height properties so it might set content-box or border-box - * size depending on the box model the browser is using.) - * - * @param {Element} element Element to set the size of. - * @param {string|number|goog.math.Size} w Width of the element, or a - * size object. - * @param {string|number=} opt_h Height of the element. Required if w is not a - * size object. - */ -goog.style.setSize = function(element, w, opt_h) { - var h; - if (w instanceof goog.math.Size) { - h = w.height; - w = w.width; - } else { - if (opt_h == undefined) { - throw Error('missing height argument'); - } - h = opt_h; - } - - goog.style.setWidth(element, /** @type {string|number} */ (w)); - goog.style.setHeight(element, h); -}; - - -/** - * Helper function to create a string to be set into a pixel-value style - * property of an element. Can round to the nearest integer value. - * - * @param {string|number} value The style value to be used. If a number, - * 'px' will be appended, otherwise the value will be applied directly. - * @param {boolean} round Whether to round the nearest integer (if property - * is a number). - * @return {string} The string value for the property. - * @private - */ -goog.style.getPixelStyleValue_ = function(value, round) { - if (typeof value == 'number') { - value = (round ? Math.round(value) : value) + 'px'; - } - - return value; -}; - - -/** - * Set the height of an element. Sets the element's style property. - * @param {Element} element Element to set the height of. - * @param {string|number} height The height value to set. If a number, 'px' - * will be appended, otherwise the value will be applied directly. - */ -goog.style.setHeight = function(element, height) { - element.style.height = goog.style.getPixelStyleValue_(height, true); -}; - - -/** - * Set the width of an element. Sets the element's style property. - * @param {Element} element Element to set the width of. - * @param {string|number} width The width value to set. If a number, 'px' - * will be appended, otherwise the value will be applied directly. - */ -goog.style.setWidth = function(element, width) { - element.style.width = goog.style.getPixelStyleValue_(width, true); -}; - - -/** - * Gets the height and width of an element, even if its display is none. - * - * Specifically, this returns the height and width of the border box, - * irrespective of the box model in effect. - * - * Note that this function does not take CSS transforms into account. Please see - * {@code goog.style.getTransformedSize}. - * @param {Element} element Element to get size of. - * @return {!goog.math.Size} Object with width/height properties. - */ -goog.style.getSize = function(element) { - return goog.style.evaluateWithTemporaryDisplay_( - goog.style.getSizeWithDisplay_, /** @type {!Element} */ (element)); -}; - - -/** - * Call {@code fn} on {@code element} such that {@code element}'s dimensions are - * accurate when it's passed to {@code fn}. - * @param {function(!Element): T} fn Function to call with {@code element} as - * an argument after temporarily changing {@code element}'s display such - * that its dimensions are accurate. - * @param {!Element} element Element (which may have display none) to use as - * argument to {@code fn}. - * @return {T} Value returned by calling {@code fn} with {@code element}. - * @template T - * @private - */ -goog.style.evaluateWithTemporaryDisplay_ = function(fn, element) { - if (goog.style.getStyle_(element, 'display') != 'none') { - return fn(element); - } - - var style = element.style; - var originalDisplay = style.display; - var originalVisibility = style.visibility; - var originalPosition = style.position; - - style.visibility = 'hidden'; - style.position = 'absolute'; - style.display = 'inline'; - - var retVal = fn(element); - - style.display = originalDisplay; - style.position = originalPosition; - style.visibility = originalVisibility; - - return retVal; -}; - - -/** - * Gets the height and width of an element when the display is not none. - * @param {Element} element Element to get size of. - * @return {!goog.math.Size} Object with width/height properties. - * @private - */ -goog.style.getSizeWithDisplay_ = function(element) { - var offsetWidth = /** @type {!HTMLElement} */ (element).offsetWidth; - var offsetHeight = /** @type {!HTMLElement} */ (element).offsetHeight; - var webkitOffsetsZero = - goog.userAgent.WEBKIT && !offsetWidth && !offsetHeight; - if ((!goog.isDef(offsetWidth) || webkitOffsetsZero) && - element.getBoundingClientRect) { - // Fall back to calling getBoundingClientRect when offsetWidth or - // offsetHeight are not defined, or when they are zero in WebKit browsers. - // This makes sure that we return for the correct size for SVG elements, but - // will still return 0 on Webkit prior to 534.8, see - // http://trac.webkit.org/changeset/67252. - var clientRect = goog.style.getBoundingClientRect_(element); - return new goog.math.Size(clientRect.right - clientRect.left, - clientRect.bottom - clientRect.top); - } - return new goog.math.Size(offsetWidth, offsetHeight); -}; - - -/** - * Gets the height and width of an element, post transform, even if its display - * is none. - * - * This is like {@code goog.style.getSize}, except: - * <ol> - * <li>Takes webkitTransforms such as rotate and scale into account. - * <li>Will return null if {@code element} doesn't respond to - * {@code getBoundingClientRect}. - * <li>Currently doesn't make sense on non-WebKit browsers which don't support - * webkitTransforms. - * </ol> - * @param {!Element} element Element to get size of. - * @return {goog.math.Size} Object with width/height properties. - */ -goog.style.getTransformedSize = function(element) { - if (!element.getBoundingClientRect) { - return null; - } - - var clientRect = goog.style.evaluateWithTemporaryDisplay_( - goog.style.getBoundingClientRect_, element); - return new goog.math.Size(clientRect.right - clientRect.left, - clientRect.bottom - clientRect.top); -}; - - -/** - * Returns a bounding rectangle for a given element in page space. - * @param {Element} element Element to get bounds of. Must not be display none. - * @return {!goog.math.Rect} Bounding rectangle for the element. - */ -goog.style.getBounds = function(element) { - var o = goog.style.getPageOffset(element); - var s = goog.style.getSize(element); - return new goog.math.Rect(o.x, o.y, s.width, s.height); -}; - - -/** - * Converts a CSS selector in the form style-property to styleProperty. - * @param {*} selector CSS Selector. - * @return {string} Camel case selector. - * @deprecated Use goog.string.toCamelCase instead. - */ -goog.style.toCamelCase = function(selector) { - return goog.string.toCamelCase(String(selector)); -}; - - -/** - * Converts a CSS selector in the form styleProperty to style-property. - * @param {string} selector Camel case selector. - * @return {string} Selector cased. - * @deprecated Use goog.string.toSelectorCase instead. - */ -goog.style.toSelectorCase = function(selector) { - return goog.string.toSelectorCase(selector); -}; - - -/** - * Gets the opacity of a node (x-browser). This gets the inline style opacity - * of the node, and does not take into account the cascaded or the computed - * style for this node. - * @param {Element} el Element whose opacity has to be found. - * @return {number|string} Opacity between 0 and 1 or an empty string {@code ''} - * if the opacity is not set. - */ -goog.style.getOpacity = function(el) { - var style = el.style; - var result = ''; - if ('opacity' in style) { - result = style.opacity; - } else if ('MozOpacity' in style) { - result = style.MozOpacity; - } else if ('filter' in style) { - var match = style.filter.match(/alpha\(opacity=([\d.]+)\)/); - if (match) { - result = String(match[1] / 100); - } - } - return result == '' ? result : Number(result); -}; - - -/** - * Sets the opacity of a node (x-browser). - * @param {Element} el Elements whose opacity has to be set. - * @param {number|string} alpha Opacity between 0 and 1 or an empty string - * {@code ''} to clear the opacity. - */ -goog.style.setOpacity = function(el, alpha) { - var style = el.style; - if ('opacity' in style) { - style.opacity = alpha; - } else if ('MozOpacity' in style) { - style.MozOpacity = alpha; - } else if ('filter' in style) { - // TODO(arv): Overwriting the filter might have undesired side effects. - if (alpha === '') { - style.filter = ''; - } else { - style.filter = 'alpha(opacity=' + alpha * 100 + ')'; - } - } -}; - - -/** - * Sets the background of an element to a transparent image in a browser- - * independent manner. - * - * This function does not support repeating backgrounds or alternate background - * positions to match the behavior of Internet Explorer. It also does not - * support sizingMethods other than crop since they cannot be replicated in - * browsers other than Internet Explorer. - * - * @param {Element} el The element to set background on. - * @param {string} src The image source URL. - */ -goog.style.setTransparentBackgroundImage = function(el, src) { - var style = el.style; - // It is safe to use the style.filter in IE only. In Safari 'filter' is in - // style object but access to style.filter causes it to throw an exception. - // Note: IE8 supports images with an alpha channel. - if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('8')) { - // See TODO in setOpacity. - style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(' + - 'src="' + src + '", sizingMethod="crop")'; - } else { - // Set style properties individually instead of using background shorthand - // to prevent overwriting a pre-existing background color. - style.backgroundImage = 'url(' + src + ')'; - style.backgroundPosition = 'top left'; - style.backgroundRepeat = 'no-repeat'; - } -}; - - -/** - * Clears the background image of an element in a browser independent manner. - * @param {Element} el The element to clear background image for. - */ -goog.style.clearTransparentBackgroundImage = function(el) { - var style = el.style; - if ('filter' in style) { - // See TODO in setOpacity. - style.filter = ''; - } else { - // Set style properties individually instead of using background shorthand - // to prevent overwriting a pre-existing background color. - style.backgroundImage = 'none'; - } -}; - - -/** - * Shows or hides an element from the page. Hiding the element is done by - * setting the display property to "none", removing the element from the - * rendering hierarchy so it takes up no space. To show the element, the default - * inherited display property is restored (defined either in stylesheets or by - * the browser's default style rules.) - * - * Caveat 1: if the inherited display property for the element is set to "none" - * by the stylesheets, that is the property that will be restored by a call to - * showElement(), effectively toggling the display between "none" and "none". - * - * Caveat 2: if the element display style is set inline (by setting either - * element.style.display or a style attribute in the HTML), a call to - * showElement will clear that setting and defer to the inherited style in the - * stylesheet. - * @param {Element} el Element to show or hide. - * @param {*} display True to render the element in its default style, - * false to disable rendering the element. - * @deprecated Use goog.style.setElementShown instead. - */ -goog.style.showElement = function(el, display) { - goog.style.setElementShown(el, display); -}; - - -/** - * Shows or hides an element from the page. Hiding the element is done by - * setting the display property to "none", removing the element from the - * rendering hierarchy so it takes up no space. To show the element, the default - * inherited display property is restored (defined either in stylesheets or by - * the browser's default style rules). - * - * Caveat 1: if the inherited display property for the element is set to "none" - * by the stylesheets, that is the property that will be restored by a call to - * setElementShown(), effectively toggling the display between "none" and - * "none". - * - * Caveat 2: if the element display style is set inline (by setting either - * element.style.display or a style attribute in the HTML), a call to - * setElementShown will clear that setting and defer to the inherited style in - * the stylesheet. - * @param {Element} el Element to show or hide. - * @param {*} isShown True to render the element in its default style, - * false to disable rendering the element. - */ -goog.style.setElementShown = function(el, isShown) { - el.style.display = isShown ? '' : 'none'; -}; - - -/** - * Test whether the given element has been shown or hidden via a call to - * {@link #setElementShown}. - * - * Note this is strictly a companion method for a call - * to {@link #setElementShown} and the same caveats apply; in particular, this - * method does not guarantee that the return value will be consistent with - * whether or not the element is actually visible. - * - * @param {Element} el The element to test. - * @return {boolean} Whether the element has been shown. - * @see #setElementShown - */ -goog.style.isElementShown = function(el) { - return el.style.display != 'none'; -}; - - -/** - * Installs the styles string into the window that contains opt_element. If - * opt_element is null, the main window is used. - * @param {string} stylesString The style string to install. - * @param {Node=} opt_node Node whose parent document should have the - * styles installed. - * @return {Element|StyleSheet} The style element created. - */ -goog.style.installStyles = function(stylesString, opt_node) { - var dh = goog.dom.getDomHelper(opt_node); - var styleSheet = null; - - // IE < 11 requires createStyleSheet. Note that doc.createStyleSheet will be - // undefined as of IE 11. - var doc = dh.getDocument(); - if (goog.userAgent.IE && doc.createStyleSheet) { - styleSheet = doc.createStyleSheet(); - goog.style.setStyles(styleSheet, stylesString); - } else { - var head = dh.getElementsByTagNameAndClass(goog.dom.TagName.HEAD)[0]; - - // In opera documents are not guaranteed to have a head element, thus we - // have to make sure one exists before using it. - if (!head) { - var body = dh.getElementsByTagNameAndClass(goog.dom.TagName.BODY)[0]; - head = dh.createDom(goog.dom.TagName.HEAD); - body.parentNode.insertBefore(head, body); - } - styleSheet = dh.createDom(goog.dom.TagName.STYLE); - // NOTE(user): Setting styles after the style element has been appended - // to the head results in a nasty Webkit bug in certain scenarios. Please - // refer to https://bugs.webkit.org/show_bug.cgi?id=26307 for additional - // details. - goog.style.setStyles(styleSheet, stylesString); - dh.appendChild(head, styleSheet); - } - return styleSheet; -}; - - -/** - * Removes the styles added by {@link #installStyles}. - * @param {Element|StyleSheet} styleSheet The value returned by - * {@link #installStyles}. - */ -goog.style.uninstallStyles = function(styleSheet) { - var node = styleSheet.ownerNode || styleSheet.owningElement || - /** @type {Element} */ (styleSheet); - goog.dom.removeNode(node); -}; - - -/** - * Sets the content of a style element. The style element can be any valid - * style element. This element will have its content completely replaced by - * the new stylesString. - * @param {Element|StyleSheet} element A stylesheet element as returned by - * installStyles. - * @param {string} stylesString The new content of the stylesheet. - */ -goog.style.setStyles = function(element, stylesString) { - if (goog.userAgent.IE && goog.isDef(element.cssText)) { - // Adding the selectors individually caused the browser to hang if the - // selector was invalid or there were CSS comments. Setting the cssText of - // the style node works fine and ignores CSS that IE doesn't understand. - // However IE >= 11 doesn't support cssText any more, so we make sure that - // cssText is a defined property and otherwise fall back to innerHTML. - element.cssText = stylesString; - } else { - element.innerHTML = stylesString; - } -}; - - -/** - * Sets 'white-space: pre-wrap' for a node (x-browser). - * - * There are as many ways of specifying pre-wrap as there are browsers. - * - * CSS3/IE8: white-space: pre-wrap; - * Mozilla: white-space: -moz-pre-wrap; - * Opera: white-space: -o-pre-wrap; - * IE6/7: white-space: pre; word-wrap: break-word; - * - * @param {Element} el Element to enable pre-wrap for. - */ -goog.style.setPreWrap = function(el) { - var style = el.style; - if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('8')) { - style.whiteSpace = 'pre'; - style.wordWrap = 'break-word'; - } else if (goog.userAgent.GECKO) { - style.whiteSpace = '-moz-pre-wrap'; - } else { - style.whiteSpace = 'pre-wrap'; - } -}; - - -/** - * Sets 'display: inline-block' for an element (cross-browser). - * @param {Element} el Element to which the inline-block display style is to be - * applied. - * @see ../demos/inline_block_quirks.html - * @see ../demos/inline_block_standards.html - */ -goog.style.setInlineBlock = function(el) { - var style = el.style; - // Without position:relative, weirdness ensues. Just accept it and move on. - style.position = 'relative'; - - if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('8')) { - // IE8 supports inline-block so fall through to the else - // Zoom:1 forces hasLayout, display:inline gives inline behavior. - style.zoom = '1'; - style.display = 'inline'; - } else { - // Opera, Webkit, and Safari seem to do OK with the standard inline-block - // style. - style.display = 'inline-block'; - } -}; - - -/** - * Returns true if the element is using right to left (rtl) direction. - * @param {Element} el The element to test. - * @return {boolean} True for right to left, false for left to right. - */ -goog.style.isRightToLeft = function(el) { - return 'rtl' == goog.style.getStyle_(el, 'direction'); -}; - - -/** - * The CSS style property corresponding to an element being - * unselectable on the current browser platform (null if none). - * Opera and IE instead use a DOM attribute 'unselectable'. - * @type {?string} - * @private - */ -goog.style.unselectableStyle_ = - goog.userAgent.GECKO ? 'MozUserSelect' : - goog.userAgent.WEBKIT ? 'WebkitUserSelect' : - null; - - -/** - * Returns true if the element is set to be unselectable, false otherwise. - * Note that on some platforms (e.g. Mozilla), even if an element isn't set - * to be unselectable, it will behave as such if any of its ancestors is - * unselectable. - * @param {Element} el Element to check. - * @return {boolean} Whether the element is set to be unselectable. - */ -goog.style.isUnselectable = function(el) { - if (goog.style.unselectableStyle_) { - return el.style[goog.style.unselectableStyle_].toLowerCase() == 'none'; - } else if (goog.userAgent.IE || goog.userAgent.OPERA) { - return el.getAttribute('unselectable') == 'on'; - } - return false; -}; - - -/** - * Makes the element and its descendants selectable or unselectable. Note - * that on some platforms (e.g. Mozilla), even if an element isn't set to - * be unselectable, it will behave as such if any of its ancestors is - * unselectable. - * @param {Element} el The element to alter. - * @param {boolean} unselectable Whether the element and its descendants - * should be made unselectable. - * @param {boolean=} opt_noRecurse Whether to only alter the element's own - * selectable state, and leave its descendants alone; defaults to false. - */ -goog.style.setUnselectable = function(el, unselectable, opt_noRecurse) { - // TODO(attila): Do we need all of TR_DomUtil.makeUnselectable() in Closure? - var descendants = !opt_noRecurse ? el.getElementsByTagName('*') : null; - var name = goog.style.unselectableStyle_; - if (name) { - // Add/remove the appropriate CSS style to/from the element and its - // descendants. - var value = unselectable ? 'none' : ''; - // MathML elements do not have a style property. Verify before setting. - if (el.style) { - el.style[name] = value; - } - if (descendants) { - for (var i = 0, descendant; descendant = descendants[i]; i++) { - if (descendant.style) { - descendant.style[name] = value; - } - } - } - } else if (goog.userAgent.IE || goog.userAgent.OPERA) { - // Toggle the 'unselectable' attribute on the element and its descendants. - var value = unselectable ? 'on' : ''; - el.setAttribute('unselectable', value); - if (descendants) { - for (var i = 0, descendant; descendant = descendants[i]; i++) { - descendant.setAttribute('unselectable', value); - } - } - } -}; - - -/** - * Gets the border box size for an element. - * @param {Element} element The element to get the size for. - * @return {!goog.math.Size} The border box size. - */ -goog.style.getBorderBoxSize = function(element) { - return new goog.math.Size( - /** @type {!HTMLElement} */ (element).offsetWidth, - /** @type {!HTMLElement} */ (element).offsetHeight); -}; - - -/** - * Sets the border box size of an element. This is potentially expensive in IE - * if the document is CSS1Compat mode - * @param {Element} element The element to set the size on. - * @param {goog.math.Size} size The new size. - */ -goog.style.setBorderBoxSize = function(element, size) { - var doc = goog.dom.getOwnerDocument(element); - var isCss1CompatMode = goog.dom.getDomHelper(doc).isCss1CompatMode(); - - if (goog.userAgent.IE && - !goog.userAgent.isVersionOrHigher('10') && - (!isCss1CompatMode || !goog.userAgent.isVersionOrHigher('8'))) { - var style = element.style; - if (isCss1CompatMode) { - var paddingBox = goog.style.getPaddingBox(element); - var borderBox = goog.style.getBorderBox(element); - style.pixelWidth = size.width - borderBox.left - paddingBox.left - - paddingBox.right - borderBox.right; - style.pixelHeight = size.height - borderBox.top - paddingBox.top - - paddingBox.bottom - borderBox.bottom; - } else { - style.pixelWidth = size.width; - style.pixelHeight = size.height; - } - } else { - goog.style.setBoxSizingSize_(element, size, 'border-box'); - } -}; - - -/** - * Gets the content box size for an element. This is potentially expensive in - * all browsers. - * @param {Element} element The element to get the size for. - * @return {!goog.math.Size} The content box size. - */ -goog.style.getContentBoxSize = function(element) { - var doc = goog.dom.getOwnerDocument(element); - var ieCurrentStyle = goog.userAgent.IE && element.currentStyle; - if (ieCurrentStyle && - goog.dom.getDomHelper(doc).isCss1CompatMode() && - ieCurrentStyle.width != 'auto' && ieCurrentStyle.height != 'auto' && - !ieCurrentStyle.boxSizing) { - // If IE in CSS1Compat mode than just use the width and height. - // If we have a boxSizing then fall back on measuring the borders etc. - var width = goog.style.getIePixelValue_(element, ieCurrentStyle.width, - 'width', 'pixelWidth'); - var height = goog.style.getIePixelValue_(element, ieCurrentStyle.height, - 'height', 'pixelHeight'); - return new goog.math.Size(width, height); - } else { - var borderBoxSize = goog.style.getBorderBoxSize(element); - var paddingBox = goog.style.getPaddingBox(element); - var borderBox = goog.style.getBorderBox(element); - return new goog.math.Size(borderBoxSize.width - - borderBox.left - paddingBox.left - - paddingBox.right - borderBox.right, - borderBoxSize.height - - borderBox.top - paddingBox.top - - paddingBox.bottom - borderBox.bottom); - } -}; - - -/** - * Sets the content box size of an element. This is potentially expensive in IE - * if the document is BackCompat mode. - * @param {Element} element The element to set the size on. - * @param {goog.math.Size} size The new size. - */ -goog.style.setContentBoxSize = function(element, size) { - var doc = goog.dom.getOwnerDocument(element); - var isCss1CompatMode = goog.dom.getDomHelper(doc).isCss1CompatMode(); - if (goog.userAgent.IE && - !goog.userAgent.isVersionOrHigher('10') && - (!isCss1CompatMode || !goog.userAgent.isVersionOrHigher('8'))) { - var style = element.style; - if (isCss1CompatMode) { - style.pixelWidth = size.width; - style.pixelHeight = size.height; - } else { - var paddingBox = goog.style.getPaddingBox(element); - var borderBox = goog.style.getBorderBox(element); - style.pixelWidth = size.width + borderBox.left + paddingBox.left + - paddingBox.right + borderBox.right; - style.pixelHeight = size.height + borderBox.top + paddingBox.top + - paddingBox.bottom + borderBox.bottom; - } - } else { - goog.style.setBoxSizingSize_(element, size, 'content-box'); - } -}; - - -/** - * Helper function that sets the box sizing as well as the width and height - * @param {Element} element The element to set the size on. - * @param {goog.math.Size} size The new size to set. - * @param {string} boxSizing The box-sizing value. - * @private - */ -goog.style.setBoxSizingSize_ = function(element, size, boxSizing) { - var style = element.style; - if (goog.userAgent.GECKO) { - style.MozBoxSizing = boxSizing; - } else if (goog.userAgent.WEBKIT) { - style.WebkitBoxSizing = boxSizing; - } else { - // Includes IE8 and Opera 9.50+ - style.boxSizing = boxSizing; - } - - // Setting this to a negative value will throw an exception on IE - // (and doesn't do anything different than setting it to 0). - style.width = Math.max(size.width, 0) + 'px'; - style.height = Math.max(size.height, 0) + 'px'; -}; - - -/** - * IE specific function that converts a non pixel unit to pixels. - * @param {Element} element The element to convert the value for. - * @param {string} value The current value as a string. The value must not be - * ''. - * @param {string} name The CSS property name to use for the converstion. This - * should be 'left', 'top', 'width' or 'height'. - * @param {string} pixelName The CSS pixel property name to use to get the - * value in pixels. - * @return {number} The value in pixels. - * @private - */ -goog.style.getIePixelValue_ = function(element, value, name, pixelName) { - // Try if we already have a pixel value. IE does not do half pixels so we - // only check if it matches a number followed by 'px'. - if (/^\d+px?$/.test(value)) { - return parseInt(value, 10); - } else { - var oldStyleValue = element.style[name]; - var oldRuntimeValue = element.runtimeStyle[name]; - // set runtime style to prevent changes - element.runtimeStyle[name] = element.currentStyle[name]; - element.style[name] = value; - var pixelValue = element.style[pixelName]; - // restore - element.style[name] = oldStyleValue; - element.runtimeStyle[name] = oldRuntimeValue; - return pixelValue; - } -}; - - -/** - * Helper function for getting the pixel padding or margin for IE. - * @param {Element} element The element to get the padding for. - * @param {string} propName The property name. - * @return {number} The pixel padding. - * @private - */ -goog.style.getIePixelDistance_ = function(element, propName) { - var value = goog.style.getCascadedStyle(element, propName); - return value ? - goog.style.getIePixelValue_(element, value, 'left', 'pixelLeft') : 0; -}; - - -/** - * Gets the computed paddings or margins (on all sides) in pixels. - * @param {Element} element The element to get the padding for. - * @param {string} stylePrefix Pass 'padding' to retrieve the padding box, - * or 'margin' to retrieve the margin box. - * @return {!goog.math.Box} The computed paddings or margins. - * @private - */ -goog.style.getBox_ = function(element, stylePrefix) { - if (goog.userAgent.IE) { - var left = goog.style.getIePixelDistance_(element, stylePrefix + 'Left'); - var right = goog.style.getIePixelDistance_(element, stylePrefix + 'Right'); - var top = goog.style.getIePixelDistance_(element, stylePrefix + 'Top'); - var bottom = goog.style.getIePixelDistance_( - element, stylePrefix + 'Bottom'); - return new goog.math.Box(top, right, bottom, left); - } else { - // On non-IE browsers, getComputedStyle is always non-null. - var left = goog.style.getComputedStyle(element, stylePrefix + 'Left'); - var right = goog.style.getComputedStyle(element, stylePrefix + 'Right'); - var top = goog.style.getComputedStyle(element, stylePrefix + 'Top'); - var bottom = goog.style.getComputedStyle(element, stylePrefix + 'Bottom'); - - // NOTE(arv): Gecko can return floating point numbers for the computed - // style values. - return new goog.math.Box(parseFloat(top), - parseFloat(right), - parseFloat(bottom), - parseFloat(left)); - } -}; - - -/** - * Gets the computed paddings (on all sides) in pixels. - * @param {Element} element The element to get the padding for. - * @return {!goog.math.Box} The computed paddings. - */ -goog.style.getPaddingBox = function(element) { - return goog.style.getBox_(element, 'padding'); -}; - - -/** - * Gets the computed margins (on all sides) in pixels. - * @param {Element} element The element to get the margins for. - * @return {!goog.math.Box} The computed margins. - */ -goog.style.getMarginBox = function(element) { - return goog.style.getBox_(element, 'margin'); -}; - - -/** - * A map used to map the border width keywords to a pixel width. - * @type {Object} - * @private - */ -goog.style.ieBorderWidthKeywords_ = { - 'thin': 2, - 'medium': 4, - 'thick': 6 -}; - - -/** - * Helper function for IE to get the pixel border. - * @param {Element} element The element to get the pixel border for. - * @param {string} prop The part of the property name. - * @return {number} The value in pixels. - * @private - */ -goog.style.getIePixelBorder_ = function(element, prop) { - if (goog.style.getCascadedStyle(element, prop + 'Style') == 'none') { - return 0; - } - var width = goog.style.getCascadedStyle(element, prop + 'Width'); - if (width in goog.style.ieBorderWidthKeywords_) { - return goog.style.ieBorderWidthKeywords_[width]; - } - return goog.style.getIePixelValue_(element, width, 'left', 'pixelLeft'); -}; - - -/** - * Gets the computed border widths (on all sides) in pixels - * @param {Element} element The element to get the border widths for. - * @return {!goog.math.Box} The computed border widths. - */ -goog.style.getBorderBox = function(element) { - if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) { - var left = goog.style.getIePixelBorder_(element, 'borderLeft'); - var right = goog.style.getIePixelBorder_(element, 'borderRight'); - var top = goog.style.getIePixelBorder_(element, 'borderTop'); - var bottom = goog.style.getIePixelBorder_(element, 'borderBottom'); - return new goog.math.Box(top, right, bottom, left); - } else { - // On non-IE browsers, getComputedStyle is always non-null. - var left = goog.style.getComputedStyle(element, 'borderLeftWidth'); - var right = goog.style.getComputedStyle(element, 'borderRightWidth'); - var top = goog.style.getComputedStyle(element, 'borderTopWidth'); - var bottom = goog.style.getComputedStyle(element, 'borderBottomWidth'); - - return new goog.math.Box(parseFloat(top), - parseFloat(right), - parseFloat(bottom), - parseFloat(left)); - } -}; - - -/** - * Returns the font face applied to a given node. Opera and IE should return - * the font actually displayed. Firefox returns the author's most-preferred - * font (whether the browser is capable of displaying it or not.) - * @param {Element} el The element whose font family is returned. - * @return {string} The font family applied to el. - */ -goog.style.getFontFamily = function(el) { - var doc = goog.dom.getOwnerDocument(el); - var font = ''; - // The moveToElementText method from the TextRange only works if the element - // is attached to the owner document. - if (doc.body.createTextRange && goog.dom.contains(doc, el)) { - var range = doc.body.createTextRange(); - range.moveToElementText(el); - /** @preserveTry */ - try { - font = range.queryCommandValue('FontName'); - } catch (e) { - // This is a workaround for a awkward exception. - // On some IE, there is an exception coming from it. - // The error description from this exception is: - // This window has already been registered as a drop target - // This is bogus description, likely due to a bug in ie. - font = ''; - } - } - if (!font) { - // Note if for some reason IE can't derive FontName with a TextRange, we - // fallback to using currentStyle - font = goog.style.getStyle_(el, 'fontFamily'); - } - - // Firefox returns the applied font-family string (author's list of - // preferred fonts.) We want to return the most-preferred font, in lieu of - // the *actually* applied font. - var fontsArray = font.split(','); - if (fontsArray.length > 1) font = fontsArray[0]; - - // Sanitize for x-browser consistency: - // Strip quotes because browsers aren't consistent with how they're - // applied; Opera always encloses, Firefox sometimes, and IE never. - return goog.string.stripQuotes(font, '"\''); -}; - - -/** - * Regular expression used for getLengthUnits. - * @type {RegExp} - * @private - */ -goog.style.lengthUnitRegex_ = /[^\d]+$/; - - -/** - * Returns the units used for a CSS length measurement. - * @param {string} value A CSS length quantity. - * @return {?string} The units of measurement. - */ -goog.style.getLengthUnits = function(value) { - var units = value.match(goog.style.lengthUnitRegex_); - return units && units[0] || null; -}; - - -/** - * Map of absolute CSS length units - * @type {Object} - * @private - */ -goog.style.ABSOLUTE_CSS_LENGTH_UNITS_ = { - 'cm' : 1, - 'in' : 1, - 'mm' : 1, - 'pc' : 1, - 'pt' : 1 -}; - - -/** - * Map of relative CSS length units that can be accurately converted to px - * font-size values using getIePixelValue_. Only units that are defined in - * relation to a font size are convertible (%, small, etc. are not). - * @type {Object} - * @private - */ -goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_ = { - 'em' : 1, - 'ex' : 1 -}; - - -/** - * Returns the font size, in pixels, of text in an element. - * @param {Element} el The element whose font size is returned. - * @return {number} The font size (in pixels). - */ -goog.style.getFontSize = function(el) { - var fontSize = goog.style.getStyle_(el, 'fontSize'); - var sizeUnits = goog.style.getLengthUnits(fontSize); - if (fontSize && 'px' == sizeUnits) { - // NOTE(user): This could be parseFloat instead, but IE doesn't return - // decimal fractions in getStyle_ and Firefox reports the fractions, but - // ignores them when rendering. Interestingly enough, when we force the - // issue and size something to e.g., 50% of 25px, the browsers round in - // opposite directions with Firefox reporting 12px and IE 13px. I punt. - return parseInt(fontSize, 10); - } - - // In IE, we can convert absolute length units to a px value using - // goog.style.getIePixelValue_. Units defined in relation to a font size - // (em, ex) are applied relative to the element's parentNode and can also - // be converted. - if (goog.userAgent.IE) { - if (sizeUnits in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_) { - return goog.style.getIePixelValue_(el, - fontSize, - 'left', - 'pixelLeft'); - } else if (el.parentNode && - el.parentNode.nodeType == goog.dom.NodeType.ELEMENT && - sizeUnits in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_) { - // Check the parent size - if it is the same it means the relative size - // value is inherited and we therefore don't want to count it twice. If - // it is different, this element either has explicit style or has a CSS - // rule applying to it. - var parentElement = /** @type {!Element} */ (el.parentNode); - var parentSize = goog.style.getStyle_(parentElement, 'fontSize'); - return goog.style.getIePixelValue_(parentElement, - fontSize == parentSize ? - '1em' : fontSize, - 'left', - 'pixelLeft'); - } - } - - // Sometimes we can't cleanly find the font size (some units relative to a - // node's parent's font size are difficult: %, smaller et al), so we create - // an invisible, absolutely-positioned span sized to be the height of an 'M' - // rendered in its parent's (i.e., our target element's) font size. This is - // the definition of CSS's font size attribute. - var sizeElement = goog.dom.createDom( - goog.dom.TagName.SPAN, - {'style': 'visibility:hidden;position:absolute;' + - 'line-height:0;padding:0;margin:0;border:0;height:1em;'}); - goog.dom.appendChild(el, sizeElement); - fontSize = sizeElement.offsetHeight; - goog.dom.removeNode(sizeElement); - - return fontSize; -}; - - -/** - * Parses a style attribute value. Converts CSS property names to camel case. - * @param {string} value The style attribute value. - * @return {!Object} Map of CSS properties to string values. - */ -goog.style.parseStyleAttribute = function(value) { - var result = {}; - goog.array.forEach(value.split(/\s*;\s*/), function(pair) { - var keyValue = pair.match(/\s*([\w-]+)\s*\:(.+)/); - if (keyValue) { - var styleName = keyValue[1]; - var styleValue = goog.string.trim(keyValue[2]); - result[goog.string.toCamelCase(styleName.toLowerCase())] = styleValue; - } - }); - return result; -}; - - -/** - * Reverse of parseStyleAttribute; that is, takes a style object and returns the - * corresponding attribute value. Converts camel case property names to proper - * CSS selector names. - * @param {Object} obj Map of CSS properties to values. - * @return {string} The style attribute value. - */ -goog.style.toStyleAttribute = function(obj) { - var buffer = []; - goog.object.forEach(obj, function(value, key) { - buffer.push(goog.string.toSelectorCase(key), ':', value, ';'); - }); - return buffer.join(''); -}; - - -/** - * Sets CSS float property on an element. - * @param {Element} el The element to set float property on. - * @param {string} value The value of float CSS property to set on this element. - */ -goog.style.setFloat = function(el, value) { - el.style[goog.userAgent.IE ? 'styleFloat' : 'cssFloat'] = value; -}; - - -/** - * Gets value of explicitly-set float CSS property on an element. - * @param {Element} el The element to get float property of. - * @return {string} The value of explicitly-set float CSS property on this - * element. - */ -goog.style.getFloat = function(el) { - return el.style[goog.userAgent.IE ? 'styleFloat' : 'cssFloat'] || ''; -}; - - -/** - * Returns the scroll bar width (represents the width of both horizontal - * and vertical scroll). - * - * @param {string=} opt_className An optional class name (or names) to apply - * to the invisible div created to measure the scrollbar. This is necessary - * if some scrollbars are styled differently than others. - * @return {number} The scroll bar width in px. - */ -goog.style.getScrollbarWidth = function(opt_className) { - // Add two hidden divs. The child div is larger than the parent and - // forces scrollbars to appear on it. - // Using overflow:scroll does not work consistently with scrollbars that - // are styled with ::-webkit-scrollbar. - var outerDiv = goog.dom.createElement(goog.dom.TagName.DIV); - if (opt_className) { - outerDiv.className = opt_className; - } - outerDiv.style.cssText = 'overflow:auto;' + - 'position:absolute;top:0;width:100px;height:100px'; - var innerDiv = goog.dom.createElement(goog.dom.TagName.DIV); - goog.style.setSize(innerDiv, '200px', '200px'); - outerDiv.appendChild(innerDiv); - goog.dom.appendChild(goog.dom.getDocument().body, outerDiv); - var width = outerDiv.offsetWidth - outerDiv.clientWidth; - goog.dom.removeNode(outerDiv); - return width; -}; - - -/** - * Regular expression to extract x and y translation components from a CSS - * transform Matrix representation. - * - * @type {!RegExp} - * @const - * @private - */ -goog.style.MATRIX_TRANSLATION_REGEX_ = - new RegExp('matrix\\([0-9\\.\\-]+, [0-9\\.\\-]+, ' + - '[0-9\\.\\-]+, [0-9\\.\\-]+, ' + - '([0-9\\.\\-]+)p?x?, ([0-9\\.\\-]+)p?x?\\)'); - - -/** - * Returns the x,y translation component of any CSS transforms applied to the - * element, in pixels. - * - * @param {!Element} element The element to get the translation of. - * @return {!goog.math.Coordinate} The CSS translation of the element in px. - */ -goog.style.getCssTranslation = function(element) { - var transform = goog.style.getComputedTransform(element); - if (!transform) { - return new goog.math.Coordinate(0, 0); - } - var matches = transform.match(goog.style.MATRIX_TRANSLATION_REGEX_); - if (!matches) { - return new goog.math.Coordinate(0, 0); - } - return new goog.math.Coordinate(parseFloat(matches[1]), - parseFloat(matches[2])); -}; - -goog.provide('ol.MapEvent'); -goog.provide('ol.MapEventType'); - -goog.require('goog.events.Event'); - - -/** - * @enum {string} - */ -ol.MapEventType = { - - /** - * Triggered after a map frame is rendered. - * @event ol.MapEvent#postrender - * @api - */ - POSTRENDER: 'postrender', - - /** - * Triggered after the map is moved. - * @event ol.MapEvent#moveend - * @api stable - */ - MOVEEND: 'moveend' - -}; - - - -/** - * @classdesc - * Events emitted as map events are instances of this type. - * See {@link ol.Map} for which events trigger a map event. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.MapEvent} - * @param {string} type Event type. - * @param {ol.Map} map Map. - * @param {?olx.FrameState=} opt_frameState Frame state. - */ -ol.MapEvent = function(type, map, opt_frameState) { - - goog.base(this, type); - - /** - * The map where the event occurred. - * @type {ol.Map} - * @api stable - */ - this.map = map; - - /** - * The frame state at the time of the event. - * @type {?olx.FrameState} - * @api - */ - this.frameState = opt_frameState !== undefined ? opt_frameState : null; - -}; -goog.inherits(ol.MapEvent, goog.events.Event); - -goog.provide('ol.control.Control'); - -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('ol'); -goog.require('ol.MapEventType'); -goog.require('ol.Object'); - - - -/** - * @classdesc - * A control is a visible widget with a DOM element in a fixed position on the - * screen. They can involve user input (buttons), or be informational only; - * the position is determined using CSS. By default these are placed in the - * container with CSS class name `ol-overlaycontainer-stopevent`, but can use - * any outside DOM element. - * - * This is the base class for controls. You can use it for simple custom - * controls by creating the element with listeners, creating an instance: - * ```js - * var myControl = new ol.control.Control({element: myElement}); - * ``` - * and then adding this to the map. - * - * The main advantage of having this as a control rather than a simple separate - * DOM element is that preventing propagation is handled for you. Controls - * will also be `ol.Object`s in a `ol.Collection`, so you can use their - * methods. - * - * You can also extend this base for your own control class. See - * examples/custom-controls for an example of how to do this. - * - * @constructor - * @extends {ol.Object} - * @implements {oli.control.Control} - * @param {olx.control.ControlOptions} options Control options. - * @api stable - */ -ol.control.Control = function(options) { - - goog.base(this); - - /** - * @protected - * @type {Element} - */ - this.element = options.element ? options.element : null; - - /** - * @private - * @type {Element} - */ - this.target_ = null; - - /** - * @private - * @type {ol.Map} - */ - this.map_ = null; - - /** - * @protected - * @type {!Array.<?number>} - */ - this.listenerKeys = []; - - /** - * @type {function(ol.MapEvent)} - */ - this.render = options.render ? options.render : ol.nullFunction; - - if (options.target) { - this.setTarget(options.target); - } - -}; -goog.inherits(ol.control.Control, ol.Object); - - -/** - * @inheritDoc - */ -ol.control.Control.prototype.disposeInternal = function() { - goog.dom.removeNode(this.element); - goog.base(this, 'disposeInternal'); -}; - - -/** - * Get the map associated with this control. - * @return {ol.Map} Map. - * @api stable - */ -ol.control.Control.prototype.getMap = function() { - return this.map_; -}; - - -/** - * Remove the control from its current map and attach it to the new map. - * Subclasses may set up event handlers to get notified about changes to - * the map here. - * @param {ol.Map} map Map. - * @api stable - */ -ol.control.Control.prototype.setMap = function(map) { - if (this.map_) { - goog.dom.removeNode(this.element); - } - if (this.listenerKeys.length > 0) { - this.listenerKeys.forEach(goog.events.unlistenByKey); - this.listenerKeys.length = 0; - } - this.map_ = map; - if (this.map_) { - var target = this.target_ ? - this.target_ : map.getOverlayContainerStopEvent(); - target.appendChild(this.element); - if (this.render !== ol.nullFunction) { - this.listenerKeys.push(goog.events.listen(map, - ol.MapEventType.POSTRENDER, this.render, false, this)); - } - map.render(); - } -}; - - -/** - * This function is used to set a target element for the control. It has no - * effect if it is called after the control has been added to the map (i.e. - * after `setMap` is called on the control). If no `target` is set in the - * options passed to the control constructor and if `setTarget` is not called - * then the control is added to the map's overlay container. - * @param {Element|string} target Target. - * @api - */ -ol.control.Control.prototype.setTarget = function(target) { - this.target_ = goog.dom.getElement(target); -}; - -goog.provide('ol.css'); - - -/** - * The CSS class for hidden feature. - * - * @const - * @type {string} - */ -ol.css.CLASS_HIDDEN = 'ol-hidden'; - - -/** - * The CSS class that we'll give the DOM elements to have them unselectable. - * - * @const - * @type {string} - */ -ol.css.CLASS_UNSELECTABLE = 'ol-unselectable'; - - -/** - * The CSS class for unsupported feature. - * - * @const - * @type {string} - */ -ol.css.CLASS_UNSUPPORTED = 'ol-unsupported'; - - -/** - * The CSS class for controls. - * - * @const - * @type {string} - */ -ol.css.CLASS_CONTROL = 'ol-control'; - -goog.provide('ol.structs.LRUCache'); - -goog.require('goog.asserts'); -goog.require('goog.object'); - - - -/** - * Implements a Least-Recently-Used cache where the keys do not conflict with - * Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring - * items from the cache is the responsibility of the user. - * @constructor - * @struct - * @template T - */ -ol.structs.LRUCache = function() { - - /** - * @private - * @type {number} - */ - this.count_ = 0; - - /** - * @private - * @type {Object.<string, ol.structs.LRUCacheEntry>} - */ - this.entries_ = {}; - - /** - * @private - * @type {?ol.structs.LRUCacheEntry} - */ - this.oldest_ = null; - - /** - * @private - * @type {?ol.structs.LRUCacheEntry} - */ - this.newest_ = null; - -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.structs.LRUCache.prototype.assertValid = function() { - if (this.count_ === 0) { - goog.asserts.assert(goog.object.isEmpty(this.entries_), - 'entries must be an empty object (count = 0)'); - goog.asserts.assert(!this.oldest_, - 'oldest must be null (count = 0)'); - goog.asserts.assert(!this.newest_, - 'newest must be null (count = 0)'); - } else { - goog.asserts.assert(goog.object.getCount(this.entries_) == this.count_, - 'number of entries matches count'); - goog.asserts.assert(this.oldest_, - 'we have an oldest entry'); - goog.asserts.assert(!this.oldest_.older, - 'no entry is older than oldest'); - goog.asserts.assert(this.newest_, - 'we have a newest entry'); - goog.asserts.assert(!this.newest_.newer, - 'no entry is newer than newest'); - var i, entry; - var older = null; - i = 0; - for (entry = this.oldest_; entry; entry = entry.newer) { - goog.asserts.assert(entry.older === older, - 'entry.older links to correct older'); - older = entry; - ++i; - } - goog.asserts.assert(i == this.count_, 'iterated correct amount of times'); - var newer = null; - i = 0; - for (entry = this.newest_; entry; entry = entry.older) { - goog.asserts.assert(entry.newer === newer, - 'entry.newer links to correct newer'); - newer = entry; - ++i; - } - goog.asserts.assert(i == this.count_, 'iterated correct amount of times'); - } -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.structs.LRUCache.prototype.clear = function() { - this.count_ = 0; - this.entries_ = {}; - this.oldest_ = null; - this.newest_ = null; -}; - - -/** - * @param {string} key Key. - * @return {boolean} Contains key. - */ -ol.structs.LRUCache.prototype.containsKey = function(key) { - return this.entries_.hasOwnProperty(key); -}; - - -/** - * @param {function(this: S, T, string, ol.structs.LRUCache): ?} f The function - * to call for every entry from the oldest to the newer. This function takes - * 3 arguments (the entry value, the entry key and the LRUCache object). - * The return value is ignored. - * @param {S=} opt_this The object to use as `this` in `f`. - * @template S - */ -ol.structs.LRUCache.prototype.forEach = function(f, opt_this) { - var entry = this.oldest_; - while (entry) { - f.call(opt_this, entry.value_, entry.key_, this); - entry = entry.newer; - } -}; - - -/** - * @param {string} key Key. - * @return {T} Value. - */ -ol.structs.LRUCache.prototype.get = function(key) { - var entry = this.entries_[key]; - goog.asserts.assert(entry !== undefined, 'an entry exists for key %s', key); - if (entry === this.newest_) { - return entry.value_; - } else if (entry === this.oldest_) { - this.oldest_ = this.oldest_.newer; - this.oldest_.older = null; - } else { - entry.newer.older = entry.older; - entry.older.newer = entry.newer; - } - entry.newer = null; - entry.older = this.newest_; - this.newest_.newer = entry; - this.newest_ = entry; - return entry.value_; -}; - - -/** - * @return {number} Count. - */ -ol.structs.LRUCache.prototype.getCount = function() { - return this.count_; -}; - - -/** - * @return {Array.<string>} Keys. - */ -ol.structs.LRUCache.prototype.getKeys = function() { - var keys = new Array(this.count_); - var i = 0; - var entry; - for (entry = this.newest_; entry; entry = entry.older) { - keys[i++] = entry.key_; - } - goog.asserts.assert(i == this.count_, 'iterated correct number of times'); - return keys; -}; - - -/** - * @return {Array.<T>} Values. - */ -ol.structs.LRUCache.prototype.getValues = function() { - var values = new Array(this.count_); - var i = 0; - var entry; - for (entry = this.newest_; entry; entry = entry.older) { - values[i++] = entry.value_; - } - goog.asserts.assert(i == this.count_, 'iterated correct number of times'); - return values; -}; - - -/** - * @return {T} Last value. - */ -ol.structs.LRUCache.prototype.peekLast = function() { - goog.asserts.assert(this.oldest_, 'oldest must not be null'); - return this.oldest_.value_; -}; - - -/** - * @return {string} Last key. - */ -ol.structs.LRUCache.prototype.peekLastKey = function() { - goog.asserts.assert(this.oldest_, 'oldest must not be null'); - return this.oldest_.key_; -}; - - -/** - * @return {T} value Value. - */ -ol.structs.LRUCache.prototype.pop = function() { - goog.asserts.assert(this.oldest_, 'oldest must not be null'); - goog.asserts.assert(this.newest_, 'newest must not be null'); - var entry = this.oldest_; - goog.asserts.assert(entry.key_ in this.entries_, - 'oldest is indexed in entries'); - delete this.entries_[entry.key_]; - if (entry.newer) { - entry.newer.older = null; - } - this.oldest_ = entry.newer; - if (!this.oldest_) { - this.newest_ = null; - } - --this.count_; - return entry.value_; -}; - - -/** - * @param {string} key Key. - * @param {T} value Value. - */ -ol.structs.LRUCache.prototype.set = function(key, value) { - goog.asserts.assert(!(key in {}), - 'key is not a standard property of objects (e.g. "__proto__")'); - goog.asserts.assert(!(key in this.entries_), - 'key is not used already'); - var entry = { - key_: key, - newer: null, - older: this.newest_, - value_: value - }; - if (!this.newest_) { - this.oldest_ = entry; - } else { - this.newest_.newer = entry; - } - this.newest_ = entry; - this.entries_[key] = entry; - ++this.count_; -}; - - -/** - * @typedef {{key_: string, - * newer: ol.structs.LRUCacheEntry, - * older: ol.structs.LRUCacheEntry, - * value_: *}} - */ -ol.structs.LRUCacheEntry; - -goog.provide('ol.TileCache'); - -goog.require('ol'); -goog.require('ol.TileRange'); -goog.require('ol.structs.LRUCache'); -goog.require('ol.tilecoord'); - - - -/** - * @constructor - * @extends {ol.structs.LRUCache.<ol.Tile>} - * @param {number=} opt_highWaterMark High water mark. - * @struct - */ -ol.TileCache = function(opt_highWaterMark) { - - goog.base(this); - - /** - * @private - * @type {number} - */ - this.highWaterMark_ = opt_highWaterMark !== undefined ? - opt_highWaterMark : ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK; - -}; -goog.inherits(ol.TileCache, ol.structs.LRUCache); - - -/** - * @return {boolean} Can expire cache. - */ -ol.TileCache.prototype.canExpireCache = function() { - return this.getCount() > this.highWaterMark_; -}; - - -/** - * @param {Object.<string, ol.TileRange>} usedTiles Used tiles. - */ -ol.TileCache.prototype.expireCache = function(usedTiles) { - var tile, zKey; - while (this.canExpireCache()) { - tile = this.peekLast(); - zKey = tile.tileCoord[0].toString(); - if (zKey in usedTiles && usedTiles[zKey].contains(tile.tileCoord)) { - break; - } else { - this.pop().dispose(); - } - } -}; - - -/** - * Remove a tile range from the cache, e.g. to invalidate tiles. - * @param {ol.TileRange} tileRange The tile range to prune. - */ -ol.TileCache.prototype.pruneTileRange = function(tileRange) { - var i = this.getCount(), - key; - while (i--) { - key = this.peekLastKey(); - if (tileRange.contains(ol.tilecoord.createFromString(key))) { - this.pop().dispose(); - } else { - this.get(key); - } - } -}; - -goog.provide('ol.Tile'); -goog.provide('ol.TileState'); - -goog.require('goog.events'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); -goog.require('ol.TileCoord'); - - -/** - * @enum {number} - */ -ol.TileState = { - IDLE: 0, - LOADING: 1, - LOADED: 2, - ERROR: 3, - EMPTY: 4 -}; - - - -/** - * @classdesc - * Base class for tiles. - * - * @constructor - * @extends {goog.events.EventTarget} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. - */ -ol.Tile = function(tileCoord, state) { - - goog.base(this); - - /** - * @type {ol.TileCoord} - */ - this.tileCoord = tileCoord; - - /** - * @protected - * @type {ol.TileState} - */ - this.state = state; - -}; -goog.inherits(ol.Tile, goog.events.EventTarget); - - -/** - * @protected - */ -ol.Tile.prototype.changed = function() { - this.dispatchEvent(goog.events.EventType.CHANGE); -}; - - -/** - * Get the HTML image element for this tile (may be a Canvas, Image, or Video). - * @function - * @param {Object=} opt_context Object. - * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. - */ -ol.Tile.prototype.getImage = goog.abstractMethod; - - -/** - * @return {string} Key. - */ -ol.Tile.prototype.getKey = function() { - return goog.getUid(this).toString(); -}; - - -/** - * Get the tile coordinate for this tile. - * @return {ol.TileCoord} - * @api - */ -ol.Tile.prototype.getTileCoord = function() { - return this.tileCoord; -}; - - -/** - * @return {ol.TileState} State. - */ -ol.Tile.prototype.getState = function() { - return this.state; -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.Tile.prototype.load = goog.abstractMethod; - -goog.provide('ol.source.Source'); -goog.provide('ol.source.State'); - -goog.require('ol'); -goog.require('ol.Attribution'); -goog.require('ol.Object'); -goog.require('ol.proj'); - - -/** - * State of the source, one of 'undefined', 'loading', 'ready' or 'error'. - * @enum {string} - * @api - */ -ol.source.State = { - UNDEFINED: 'undefined', - LOADING: 'loading', - READY: 'ready', - ERROR: 'error' -}; - - -/** - * @typedef {{attributions: (Array.<ol.Attribution>|undefined), - * logo: (string|olx.LogoOptions|undefined), - * projection: ol.proj.ProjectionLike, - * state: (ol.source.State|undefined), - * wrapX: (boolean|undefined)}} - */ -ol.source.SourceOptions; - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Base class for {@link ol.layer.Layer} sources. - * - * A generic `change` event is triggered when the state of the source changes. - * - * @constructor - * @extends {ol.Object} - * @param {ol.source.SourceOptions} options Source options. - * @api stable - */ -ol.source.Source = function(options) { - - goog.base(this); - - /** - * @private - * @type {ol.proj.Projection} - */ - this.projection_ = ol.proj.get(options.projection); - - /** - * @private - * @type {Array.<ol.Attribution>} - */ - this.attributions_ = options.attributions !== undefined ? - options.attributions : null; - - /** - * @private - * @type {string|olx.LogoOptions|undefined} - */ - this.logo_ = options.logo; - - /** - * @private - * @type {ol.source.State} - */ - this.state_ = options.state !== undefined ? - options.state : ol.source.State.READY; - - /** - * @private - * @type {boolean} - */ - this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false; - -}; -goog.inherits(ol.source.Source, ol.Object); - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {Object.<string, boolean>} skippedFeatureUids Skipped feature uids. - * @param {function((ol.Feature|ol.render.Feature)): T} callback Feature - * callback. - * @return {T|undefined} Callback result. - * @template T - */ -ol.source.Source.prototype.forEachFeatureAtCoordinate = ol.nullFunction; - - -/** - * Get the attributions of the source. - * @return {Array.<ol.Attribution>} Attributions. - * @api stable - */ -ol.source.Source.prototype.getAttributions = function() { - return this.attributions_; -}; - - -/** - * Get the logo of the source. - * @return {string|olx.LogoOptions|undefined} Logo. - * @api stable - */ -ol.source.Source.prototype.getLogo = function() { - return this.logo_; -}; - - -/** - * Get the projection of the source. - * @return {ol.proj.Projection} Projection. - * @api - */ -ol.source.Source.prototype.getProjection = function() { - return this.projection_; -}; - - -/** - * @return {Array.<number>|undefined} Resolutions. - */ -ol.source.Source.prototype.getResolutions = goog.abstractMethod; - - -/** - * Get the state of the source, see {@link ol.source.State} for possible states. - * @return {ol.source.State} State. - * @api - */ -ol.source.Source.prototype.getState = function() { - return this.state_; -}; - - -/** - * @return {boolean|undefined} Wrap X. - */ -ol.source.Source.prototype.getWrapX = function() { - return this.wrapX_; -}; - - -/** - * Set the attributions of the source. - * @param {Array.<ol.Attribution>} attributions Attributions. - * @api - */ -ol.source.Source.prototype.setAttributions = function(attributions) { - this.attributions_ = attributions; - this.changed(); -}; - - -/** - * Set the logo of the source. - * @param {string|olx.LogoOptions|undefined} logo Logo. - */ -ol.source.Source.prototype.setLogo = function(logo) { - this.logo_ = logo; -}; - - -/** - * Set the state of the source. - * @param {ol.source.State} state State. - * @protected - */ -ol.source.Source.prototype.setState = function(state) { - this.state_ = state; - this.changed(); -}; - - -/** - * Set the projection of the source. - * @param {ol.proj.Projection} projection Projection. - */ -ol.source.Source.prototype.setProjection = function(projection) { - this.projection_ = projection; -}; - -goog.provide('ol.tilegrid.TileGrid'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Coordinate'); -goog.require('ol.TileCoord'); -goog.require('ol.TileRange'); -goog.require('ol.array'); -goog.require('ol.extent'); -goog.require('ol.extent.Corner'); -goog.require('ol.math'); -goog.require('ol.proj'); -goog.require('ol.proj.METERS_PER_UNIT'); -goog.require('ol.proj.Projection'); -goog.require('ol.proj.Units'); -goog.require('ol.size'); -goog.require('ol.tilecoord'); - - - -/** - * @classdesc - * Base class for setting the grid pattern for sources accessing tiled-image - * servers. - * - * @constructor - * @param {olx.tilegrid.TileGridOptions} options Tile grid options. - * @struct - * @api stable - */ -ol.tilegrid.TileGrid = function(options) { - - /** - * @protected - * @type {number} - */ - this.minZoom = options.minZoom !== undefined ? options.minZoom : 0; - - /** - * @private - * @type {!Array.<number>} - */ - this.resolutions_ = options.resolutions; - goog.asserts.assert(goog.array.isSorted(this.resolutions_, function(a, b) { - return b - a; - }, true), 'resolutions must be sorted in descending order'); - - /** - * @protected - * @type {number} - */ - this.maxZoom = this.resolutions_.length - 1; - - /** - * @private - * @type {ol.Coordinate} - */ - this.origin_ = options.origin !== undefined ? options.origin : null; - - /** - * @private - * @type {Array.<ol.Coordinate>} - */ - this.origins_ = null; - if (options.origins !== undefined) { - this.origins_ = options.origins; - goog.asserts.assert(this.origins_.length == this.resolutions_.length, - 'number of origins and resolutions must be equal'); - } - - var extent = options.extent; - - if (extent !== undefined && - !this.origin_ && !this.origins_) { - this.origin_ = ol.extent.getTopLeft(extent); - } - - goog.asserts.assert( - (!this.origin_ && this.origins_) || - (this.origin_ && !this.origins_), - 'either origin or origins must be configured, never both'); - - /** - * @private - * @type {Array.<number|ol.Size>} - */ - this.tileSizes_ = null; - if (options.tileSizes !== undefined) { - this.tileSizes_ = options.tileSizes; - goog.asserts.assert(this.tileSizes_.length == this.resolutions_.length, - 'number of tileSizes and resolutions must be equal'); - } - - /** - * @private - * @type {number|ol.Size} - */ - this.tileSize_ = options.tileSize !== undefined ? - options.tileSize : - !this.tileSizes_ ? ol.DEFAULT_TILE_SIZE : null; - goog.asserts.assert( - (!this.tileSize_ && this.tileSizes_) || - (this.tileSize_ && !this.tileSizes_), - 'either tileSize or tileSizes must be configured, never both'); - - /** - * @private - * @type {ol.Extent} - */ - this.extent_ = extent !== undefined ? extent : null; - - - /** - * @private - * @type {Array.<ol.TileRange>} - */ - this.fullTileRanges_ = null; - - if (options.sizes !== undefined) { - goog.asserts.assert(options.sizes.length == this.resolutions_.length, - 'number of sizes and resolutions must be equal'); - this.fullTileRanges_ = options.sizes.map(function(size, z) { - goog.asserts.assert(size[0] !== 0, 'width must not be 0'); - goog.asserts.assert(size[1] !== 0, 'height must not be 0'); - var tileRange = new ol.TileRange( - Math.min(0, size[0]), Math.max(size[0] - 1, -1), - Math.min(0, size[1]), Math.max(size[1] - 1, -1)); - if (this.minZoom <= z && z <= this.maxZoom && extent !== undefined) { - goog.asserts.assert(tileRange.containsTileRange( - this.getTileRangeForExtentAndZ(extent, z)), - 'extent tile range must not exceed tilegrid width and height'); - } - return tileRange; - }, this); - } else if (extent) { - this.calculateTileRanges_(extent); - } - - /** - * @private - * @type {ol.Size} - */ - this.tmpSize_ = [0, 0]; - -}; - - -/** - * @private - * @type {ol.TileCoord} - */ -ol.tilegrid.TileGrid.tmpTileCoord_ = [0, 0, 0]; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {function(this: T, number, ol.TileRange): boolean} callback Callback. - * @param {T=} opt_this The object to use as `this` in `callback`. - * @param {ol.TileRange=} opt_tileRange Temporary ol.TileRange object. - * @param {ol.Extent=} opt_extent Temporary ol.Extent object. - * @return {boolean} Callback succeeded. - * @template T - */ -ol.tilegrid.TileGrid.prototype.forEachTileCoordParentTileRange = - function(tileCoord, callback, opt_this, opt_tileRange, opt_extent) { - var tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent); - var z = tileCoord[0] - 1; - while (z >= this.minZoom) { - if (callback.call(opt_this, z, - this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange))) { - return true; - } - --z; - } - return false; -}; - - -/** - * Get the extent for this tile grid, if it was configured. - * @return {ol.Extent} Extent. - */ -ol.tilegrid.TileGrid.prototype.getExtent = function() { - return this.extent_; -}; - - -/** - * Get the maximum zoom level for the grid. - * @return {number} Max zoom. - * @api - */ -ol.tilegrid.TileGrid.prototype.getMaxZoom = function() { - return this.maxZoom; -}; - - -/** - * Get the minimum zoom level for the grid. - * @return {number} Min zoom. - * @api - */ -ol.tilegrid.TileGrid.prototype.getMinZoom = function() { - return this.minZoom; -}; - - -/** - * Get the origin for the grid at the given zoom level. - * @param {number} z Z. - * @return {ol.Coordinate} Origin. - * @api stable - */ -ol.tilegrid.TileGrid.prototype.getOrigin = function(z) { - if (this.origin_) { - return this.origin_; - } else { - goog.asserts.assert(this.origins_, - 'origins cannot be null if origin is null'); - goog.asserts.assert(this.minZoom <= z && z <= this.maxZoom, - 'given z is not in allowed range (%s <= %s <= %s)', - this.minZoom, z, this.maxZoom); - return this.origins_[z]; - } -}; - - -/** - * Get the resolution for the given zoom level. - * @param {number} z Z. - * @return {number} Resolution. - * @api stable - */ -ol.tilegrid.TileGrid.prototype.getResolution = function(z) { - goog.asserts.assert(this.minZoom <= z && z <= this.maxZoom, - 'given z is not in allowed range (%s <= %s <= %s)', - this.minZoom, z, this.maxZoom); - return this.resolutions_[z]; -}; - - -/** - * Get the list of resolutions for the tile grid. - * @return {Array.<number>} Resolutions. - * @api stable - */ -ol.tilegrid.TileGrid.prototype.getResolutions = function() { - return this.resolutions_; -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileRange=} opt_tileRange Temporary ol.TileRange object. - * @param {ol.Extent=} opt_extent Temporary ol.Extent object. - * @return {ol.TileRange} Tile range. - */ -ol.tilegrid.TileGrid.prototype.getTileCoordChildTileRange = - function(tileCoord, opt_tileRange, opt_extent) { - if (tileCoord[0] < this.maxZoom) { - var tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent); - return this.getTileRangeForExtentAndZ( - tileCoordExtent, tileCoord[0] + 1, opt_tileRange); - } else { - return null; - } -}; - - -/** - * @param {number} z Z. - * @param {ol.TileRange} tileRange Tile range. - * @param {ol.Extent=} opt_extent Temporary ol.Extent object. - * @return {ol.Extent} Extent. - */ -ol.tilegrid.TileGrid.prototype.getTileRangeExtent = - function(z, tileRange, opt_extent) { - var origin = this.getOrigin(z); - var resolution = this.getResolution(z); - var tileSize = ol.size.toSize(this.getTileSize(z), this.tmpSize_); - var minX = origin[0] + tileRange.minX * tileSize[0] * resolution; - var maxX = origin[0] + (tileRange.maxX + 1) * tileSize[0] * resolution; - var minY = origin[1] + tileRange.minY * tileSize[1] * resolution; - var maxY = origin[1] + (tileRange.maxY + 1) * tileSize[1] * resolution; - return ol.extent.createOrUpdate(minX, minY, maxX, maxY, opt_extent); -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @param {ol.TileRange=} opt_tileRange Temporary tile range object. - * @return {ol.TileRange} Tile range. - */ -ol.tilegrid.TileGrid.prototype.getTileRangeForExtentAndResolution = - function(extent, resolution, opt_tileRange) { - var tileCoord = ol.tilegrid.TileGrid.tmpTileCoord_; - this.getTileCoordForXYAndResolution_( - extent[0], extent[1], resolution, false, tileCoord); - var minX = tileCoord[1]; - var minY = tileCoord[2]; - this.getTileCoordForXYAndResolution_( - extent[2], extent[3], resolution, true, tileCoord); - return ol.TileRange.createOrUpdate( - minX, tileCoord[1], minY, tileCoord[2], opt_tileRange); -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} z Z. - * @param {ol.TileRange=} opt_tileRange Temporary tile range object. - * @return {ol.TileRange} Tile range. - */ -ol.tilegrid.TileGrid.prototype.getTileRangeForExtentAndZ = - function(extent, z, opt_tileRange) { - var resolution = this.getResolution(z); - return this.getTileRangeForExtentAndResolution( - extent, resolution, opt_tileRange); -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @return {ol.Coordinate} Tile center. - */ -ol.tilegrid.TileGrid.prototype.getTileCoordCenter = function(tileCoord) { - var origin = this.getOrigin(tileCoord[0]); - var resolution = this.getResolution(tileCoord[0]); - var tileSize = ol.size.toSize(this.getTileSize(tileCoord[0]), this.tmpSize_); - return [ - origin[0] + (tileCoord[1] + 0.5) * tileSize[0] * resolution, - origin[1] + (tileCoord[2] + 0.5) * tileSize[1] * resolution - ]; -}; - - -/** - * Get the extent of a tile coordinate. - * - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Extent=} opt_extent Temporary extent object. - * @return {ol.Extent} Extent. - * @api - */ -ol.tilegrid.TileGrid.prototype.getTileCoordExtent = - function(tileCoord, opt_extent) { - var origin = this.getOrigin(tileCoord[0]); - var resolution = this.getResolution(tileCoord[0]); - var tileSize = ol.size.toSize(this.getTileSize(tileCoord[0]), this.tmpSize_); - var minX = origin[0] + tileCoord[1] * tileSize[0] * resolution; - var minY = origin[1] + tileCoord[2] * tileSize[1] * resolution; - var maxX = minX + tileSize[0] * resolution; - var maxY = minY + tileSize[1] * resolution; - return ol.extent.createOrUpdate(minX, minY, maxX, maxY, opt_extent); -}; - - -/** - * Get the tile coordinate for the given map coordinate and resolution. This - * method considers that coordinates that intersect tile boundaries should be - * assigned the higher tile coordinate. - * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} resolution Resolution. - * @param {ol.TileCoord=} opt_tileCoord Destination ol.TileCoord object. - * @return {ol.TileCoord} Tile coordinate. - * @api - */ -ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolution = - function(coordinate, resolution, opt_tileCoord) { - return this.getTileCoordForXYAndResolution_( - coordinate[0], coordinate[1], resolution, false, opt_tileCoord); -}; - - -/** - * @param {number} x X. - * @param {number} y Y. - * @param {number} resolution Resolution. - * @param {boolean} reverseIntersectionPolicy Instead of letting edge - * intersections go to the higher tile coordinate, let edge intersections - * go to the lower tile coordinate. - * @param {ol.TileCoord=} opt_tileCoord Temporary ol.TileCoord object. - * @return {ol.TileCoord} Tile coordinate. - * @private - */ -ol.tilegrid.TileGrid.prototype.getTileCoordForXYAndResolution_ = function( - x, y, resolution, reverseIntersectionPolicy, opt_tileCoord) { - var z = this.getZForResolution(resolution); - var scale = resolution / this.getResolution(z); - var origin = this.getOrigin(z); - var tileSize = ol.size.toSize(this.getTileSize(z), this.tmpSize_); - - var adjustX = reverseIntersectionPolicy ? 0.5 : 0; - var adjustY = reverseIntersectionPolicy ? 0 : 0.5; - var xFromOrigin = Math.floor((x - origin[0]) / resolution + adjustX); - var yFromOrigin = Math.floor((y - origin[1]) / resolution + adjustY); - var tileCoordX = scale * xFromOrigin / tileSize[0]; - var tileCoordY = scale * yFromOrigin / tileSize[1]; - - if (reverseIntersectionPolicy) { - tileCoordX = Math.ceil(tileCoordX) - 1; - tileCoordY = Math.ceil(tileCoordY) - 1; - } else { - tileCoordX = Math.floor(tileCoordX); - tileCoordY = Math.floor(tileCoordY); - } - - return ol.tilecoord.createOrUpdate(z, tileCoordX, tileCoordY, opt_tileCoord); -}; - - -/** - * Get a tile coordinate given a map coordinate and zoom level. - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} z Zoom level. - * @param {ol.TileCoord=} opt_tileCoord Destination ol.TileCoord object. - * @return {ol.TileCoord} Tile coordinate. - * @api - */ -ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndZ = - function(coordinate, z, opt_tileCoord) { - var resolution = this.getResolution(z); - return this.getTileCoordForXYAndResolution_( - coordinate[0], coordinate[1], resolution, false, opt_tileCoord); -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @return {number} Tile resolution. - */ -ol.tilegrid.TileGrid.prototype.getTileCoordResolution = function(tileCoord) { - goog.asserts.assert( - this.minZoom <= tileCoord[0] && tileCoord[0] <= this.maxZoom, - 'z of given tilecoord is not in allowed range (%s <= %s <= %s', - this.minZoom, tileCoord[0], this.maxZoom); - return this.resolutions_[tileCoord[0]]; -}; - - -/** - * Get the tile size for a zoom level. The type of the return value matches the - * `tileSize` or `tileSizes` that the tile grid was configured with. To always - * get an `ol.Size`, run the result through `ol.size.toSize()`. - * @param {number} z Z. - * @return {number|ol.Size} Tile size. - * @api stable - */ -ol.tilegrid.TileGrid.prototype.getTileSize = function(z) { - if (this.tileSize_) { - return this.tileSize_; - } else { - goog.asserts.assert(this.tileSizes_, - 'tileSizes cannot be null if tileSize is null'); - goog.asserts.assert(this.minZoom <= z && z <= this.maxZoom, - 'z is not in allowed range (%s <= %s <= %s', - this.minZoom, z, this.maxZoom); - return this.tileSizes_[z]; - } -}; - - -/** - * @param {number} z Zoom level. - * @return {ol.TileRange} Extent tile range for the specified zoom level. - */ -ol.tilegrid.TileGrid.prototype.getFullTileRange = function(z) { - if (!this.fullTileRanges_) { - return null; - } else { - goog.asserts.assert(this.minZoom <= z && z <= this.maxZoom, - 'z is not in allowed range (%s <= %s <= %s', - this.minZoom, z, this.maxZoom); - return this.fullTileRanges_[z]; - } -}; - - -/** - * @param {number} resolution Resolution. - * @return {number} Z. - */ -ol.tilegrid.TileGrid.prototype.getZForResolution = function(resolution) { - var z = ol.array.linearFindNearest(this.resolutions_, resolution, 0); - return ol.math.clamp(z, this.minZoom, this.maxZoom); -}; - - -/** - * @param {!ol.Extent} extent Extent for this tile grid. - * @private - */ -ol.tilegrid.TileGrid.prototype.calculateTileRanges_ = function(extent) { - var length = this.resolutions_.length; - var fullTileRanges = new Array(length); - for (var z = this.minZoom; z < length; ++z) { - fullTileRanges[z] = this.getTileRangeForExtentAndZ(extent, z); - } - this.fullTileRanges_ = fullTileRanges; -}; - - -/** - * @param {ol.proj.Projection} projection Projection. - * @return {ol.tilegrid.TileGrid} Default tile grid for the passed projection. - */ -ol.tilegrid.getForProjection = function(projection) { - var tileGrid = projection.getDefaultTileGrid(); - if (!tileGrid) { - tileGrid = ol.tilegrid.createForProjection(projection); - projection.setDefaultTileGrid(tileGrid); - } - return tileGrid; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number=} opt_maxZoom Maximum zoom level (default is - * ol.DEFAULT_MAX_ZOOM). - * @param {number|ol.Size=} opt_tileSize Tile size (default uses - * ol.DEFAULT_TILE_SIZE). - * @param {ol.extent.Corner=} opt_corner Extent corner (default is - * ol.extent.Corner.TOP_LEFT). - * @return {ol.tilegrid.TileGrid} TileGrid instance. - */ -ol.tilegrid.createForExtent = - function(extent, opt_maxZoom, opt_tileSize, opt_corner) { - var corner = opt_corner !== undefined ? - opt_corner : ol.extent.Corner.TOP_LEFT; - - var resolutions = ol.tilegrid.resolutionsFromExtent( - extent, opt_maxZoom, opt_tileSize); - - return new ol.tilegrid.TileGrid({ - extent: extent, - origin: ol.extent.getCorner(extent, corner), - resolutions: resolutions, - tileSize: opt_tileSize - }); -}; - - -/** - * Creates a tile grid with a standard XYZ tiling scheme. - * @param {olx.tilegrid.XYZOptions=} opt_options Tile grid options. - * @return {ol.tilegrid.TileGrid} Tile grid instance. - * @api - */ -ol.tilegrid.createXYZ = function(opt_options) { - var options = /** @type {olx.tilegrid.TileGridOptions} */ ({}); - goog.object.extend(options, opt_options !== undefined ? - opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({})); - if (options.extent === undefined) { - options.extent = ol.proj.get('EPSG:3857').getExtent(); - } - options.resolutions = ol.tilegrid.resolutionsFromExtent( - options.extent, options.maxZoom, options.tileSize); - delete options.maxZoom; - - return new ol.tilegrid.TileGrid(options); -}; - - -/** - * Create a resolutions array from an extent. A zoom factor of 2 is assumed. - * @param {ol.Extent} extent Extent. - * @param {number=} opt_maxZoom Maximum zoom level (default is - * ol.DEFAULT_MAX_ZOOM). - * @param {number|ol.Size=} opt_tileSize Tile size (default uses - * ol.DEFAULT_TILE_SIZE). - * @return {!Array.<number>} Resolutions array. - */ -ol.tilegrid.resolutionsFromExtent = - function(extent, opt_maxZoom, opt_tileSize) { - var maxZoom = opt_maxZoom !== undefined ? - opt_maxZoom : ol.DEFAULT_MAX_ZOOM; - - var height = ol.extent.getHeight(extent); - var width = ol.extent.getWidth(extent); - - var tileSize = ol.size.toSize(opt_tileSize !== undefined ? - opt_tileSize : ol.DEFAULT_TILE_SIZE); - var maxResolution = Math.max( - width / tileSize[0], height / tileSize[1]); - - var length = maxZoom + 1; - var resolutions = new Array(length); - for (var z = 0; z < length; ++z) { - resolutions[z] = maxResolution / Math.pow(2, z); - } - return resolutions; -}; - - -/** - * @param {ol.proj.ProjectionLike} projection Projection. - * @param {number=} opt_maxZoom Maximum zoom level (default is - * ol.DEFAULT_MAX_ZOOM). - * @param {ol.Size=} opt_tileSize Tile size (default uses ol.DEFAULT_TILE_SIZE). - * @param {ol.extent.Corner=} opt_corner Extent corner (default is - * ol.extent.Corner.BOTTOM_LEFT). - * @return {ol.tilegrid.TileGrid} TileGrid instance. - */ -ol.tilegrid.createForProjection = - function(projection, opt_maxZoom, opt_tileSize, opt_corner) { - var extent = ol.tilegrid.extentFromProjection(projection); - return ol.tilegrid.createForExtent( - extent, opt_maxZoom, opt_tileSize, opt_corner); -}; - - -/** - * Generate a tile grid extent from a projection. If the projection has an - * extent, it is used. If not, a global extent is assumed. - * @param {ol.proj.ProjectionLike} projection Projection. - * @return {ol.Extent} Extent. - */ -ol.tilegrid.extentFromProjection = function(projection) { - projection = ol.proj.get(projection); - var extent = projection.getExtent(); - if (!extent) { - var half = 180 * ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES] / - projection.getMetersPerUnit(); - extent = ol.extent.createOrUpdate(-half, -half, half, half); - } - return extent; -}; - -goog.provide('ol.source.Tile'); -goog.provide('ol.source.TileEvent'); -goog.provide('ol.source.TileOptions'); - -goog.require('goog.asserts'); -goog.require('goog.events.Event'); -goog.require('ol'); -goog.require('ol.Attribution'); -goog.require('ol.Extent'); -goog.require('ol.TileCache'); -goog.require('ol.TileRange'); -goog.require('ol.TileState'); -goog.require('ol.proj'); -goog.require('ol.size'); -goog.require('ol.source.Source'); -goog.require('ol.tilecoord'); -goog.require('ol.tilegrid.TileGrid'); - - -/** - * @typedef {{attributions: (Array.<ol.Attribution>|undefined), - * cacheSize: (number|undefined), - * extent: (ol.Extent|undefined), - * logo: (string|olx.LogoOptions|undefined), - * opaque: (boolean|undefined), - * tilePixelRatio: (number|undefined), - * projection: ol.proj.ProjectionLike, - * state: (ol.source.State|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * wrapX: (boolean|undefined)}} - */ -ol.source.TileOptions; - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Base class for sources providing images divided into a tile grid. - * - * @constructor - * @extends {ol.source.Source} - * @param {ol.source.TileOptions} options Tile source options. - * @api - */ -ol.source.Tile = function(options) { - - goog.base(this, { - attributions: options.attributions, - extent: options.extent, - logo: options.logo, - projection: options.projection, - state: options.state, - wrapX: options.wrapX - }); - - /** - * @private - * @type {boolean} - */ - this.opaque_ = options.opaque !== undefined ? options.opaque : false; - - /** - * @private - * @type {number} - */ - this.tilePixelRatio_ = options.tilePixelRatio !== undefined ? - options.tilePixelRatio : 1; - - /** - * @protected - * @type {ol.tilegrid.TileGrid} - */ - this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null; - - /** - * @protected - * @type {ol.TileCache} - */ - this.tileCache = new ol.TileCache(options.cacheSize); - - /** - * @protected - * @type {ol.Size} - */ - this.tmpSize = [0, 0]; - -}; -goog.inherits(ol.source.Tile, ol.source.Source); - - -/** - * @return {boolean} Can expire cache. - */ -ol.source.Tile.prototype.canExpireCache = function() { - return this.tileCache.canExpireCache(); -}; - - -/** - * @param {ol.proj.Projection} projection Projection. - * @param {Object.<string, ol.TileRange>} usedTiles Used tiles. - */ -ol.source.Tile.prototype.expireCache = function(projection, usedTiles) { - var tileCache = this.getTileCacheForProjection(projection); - if (tileCache) { - tileCache.expireCache(usedTiles); - } -}; - - -/** - * @param {ol.proj.Projection} projection Projection. - * @param {number} z Zoom level. - * @param {ol.TileRange} tileRange Tile range. - * @param {function(ol.Tile):(boolean|undefined)} callback Called with each - * loaded tile. If the callback returns `false`, the tile will not be - * considered loaded. - * @return {boolean} The tile range is fully covered with loaded tiles. - */ -ol.source.Tile.prototype.forEachLoadedTile = - function(projection, z, tileRange, callback) { - var tileCache = this.getTileCacheForProjection(projection); - if (!tileCache) { - return false; - } - - var covered = true; - var tile, tileCoordKey, loaded; - for (var x = tileRange.minX; x <= tileRange.maxX; ++x) { - for (var y = tileRange.minY; y <= tileRange.maxY; ++y) { - tileCoordKey = this.getKeyZXY(z, x, y); - loaded = false; - if (tileCache.containsKey(tileCoordKey)) { - tile = /** @type {!ol.Tile} */ (tileCache.get(tileCoordKey)); - loaded = tile.getState() === ol.TileState.LOADED; - if (loaded) { - loaded = (callback(tile) !== false); - } - } - if (!loaded) { - covered = false; - } - } - } - return covered; -}; - - -/** - * @return {number} Gutter. - */ -ol.source.Tile.prototype.getGutter = function() { - return 0; -}; - - -/** - * @param {number} z Z. - * @param {number} x X. - * @param {number} y Y. - * @return {string} Key. - * @protected - */ -ol.source.Tile.prototype.getKeyZXY = ol.tilecoord.getKeyZXY; - - -/** - * @return {boolean} Opaque. - */ -ol.source.Tile.prototype.getOpaque = function() { - return this.opaque_; -}; - - -/** - * @inheritDoc - */ -ol.source.Tile.prototype.getResolutions = function() { - return this.tileGrid.getResolutions(); -}; - - -/** - * @param {number} z Tile coordinate z. - * @param {number} x Tile coordinate x. - * @param {number} y Tile coordinate y. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {!ol.Tile} Tile. - */ -ol.source.Tile.prototype.getTile = goog.abstractMethod; - - -/** - * Return the tile grid of the tile source. - * @return {ol.tilegrid.TileGrid} Tile grid. - * @api stable - */ -ol.source.Tile.prototype.getTileGrid = function() { - return this.tileGrid; -}; - - -/** - * @param {ol.proj.Projection} projection Projection. - * @return {ol.tilegrid.TileGrid} Tile grid. - */ -ol.source.Tile.prototype.getTileGridForProjection = function(projection) { - if (!this.tileGrid) { - return ol.tilegrid.getForProjection(projection); - } else { - return this.tileGrid; - } -}; - - -/** - * @param {ol.proj.Projection} projection Projection. - * @return {ol.TileCache} Tile cache. - * @protected - */ -ol.source.Tile.prototype.getTileCacheForProjection = function(projection) { - var thisProj = this.getProjection(); - if (thisProj && !ol.proj.equivalent(thisProj, projection)) { - return null; - } else { - return this.tileCache; - } -}; - - -/** - * @return {number} Tile pixel ratio. - */ -ol.source.Tile.prototype.getTilePixelRatio = function() { - return this.tilePixelRatio_; -}; - - -/** - * @param {number} z Z. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {ol.Size} Tile size. - */ -ol.source.Tile.prototype.getTilePixelSize = - function(z, pixelRatio, projection) { - var tileGrid = this.getTileGridForProjection(projection); - return ol.size.scale(ol.size.toSize(tileGrid.getTileSize(z), this.tmpSize), - this.tilePixelRatio_, this.tmpSize); -}; - - -/** - * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate - * is outside the resolution and extent range of the tile grid, `null` will be - * returned. - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.proj.Projection=} opt_projection Projection. - * @return {ol.TileCoord} Tile coordinate to be passed to the tileUrlFunction or - * null if no tile URL should be created for the passed `tileCoord`. - */ -ol.source.Tile.prototype.getTileCoordForTileUrlFunction = - function(tileCoord, opt_projection) { - var projection = opt_projection !== undefined ? - opt_projection : this.getProjection(); - var tileGrid = this.getTileGridForProjection(projection); - goog.asserts.assert(tileGrid, 'tile grid needed'); - if (this.getWrapX() && projection.isGlobal()) { - tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection); - } - return ol.tilecoord.withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null; -}; - - -/** - * Marks a tile coord as being used, without triggering a load. - * @param {number} z Tile coordinate z. - * @param {number} x Tile coordinate x. - * @param {number} y Tile coordinate y. - * @param {ol.proj.Projection} projection Projection. - */ -ol.source.Tile.prototype.useTile = ol.nullFunction; - - - -/** - * @classdesc - * Events emitted by {@link ol.source.Tile} instances are instances of this - * type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.source.TileEvent} - * @param {string} type Type. - * @param {ol.Tile} tile The tile. - */ -ol.source.TileEvent = function(type, tile) { - - goog.base(this, type); - - /** - * The tile related to the event. - * @type {ol.Tile} - * @api - */ - this.tile = tile; - -}; -goog.inherits(ol.source.TileEvent, goog.events.Event); - - -/** - * @enum {string} - */ -ol.source.TileEventType = { - - /** - * Triggered when a tile starts loading. - * @event ol.source.TileEvent#tileloadstart - * @api stable - */ - TILELOADSTART: 'tileloadstart', - - /** - * Triggered when a tile finishes loading. - * @event ol.source.TileEvent#tileloadend - * @api stable - */ - TILELOADEND: 'tileloadend', - - /** - * Triggered if tile loading results in an error. - * @event ol.source.TileEvent#tileloaderror - * @api stable - */ - TILELOADERROR: 'tileloaderror' - -}; - -// FIXME handle date line wrap - -goog.provide('ol.control.Attribution'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.dom.classlist'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('goog.style'); -goog.require('ol'); -goog.require('ol.Attribution'); -goog.require('ol.control.Control'); -goog.require('ol.css'); -goog.require('ol.source.Tile'); - - - -/** - * @classdesc - * Control to show all the attributions associated with the layer sources - * in the map. This control is one of the default controls included in maps. - * By default it will show in the bottom right portion of the map, but this can - * be changed by using a css selector for `.ol-attribution`. - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.AttributionOptions=} opt_options Attribution options. - * @api stable - */ -ol.control.Attribution = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {Element} - */ - this.ulElement_ = goog.dom.createElement('UL'); - - /** - * @private - * @type {Element} - */ - this.logoLi_ = goog.dom.createElement('LI'); - - this.ulElement_.appendChild(this.logoLi_); - goog.style.setElementShown(this.logoLi_, false); - - /** - * @private - * @type {boolean} - */ - this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true; - - /** - * @private - * @type {boolean} - */ - this.collapsible_ = options.collapsible !== undefined ? - options.collapsible : true; - - if (!this.collapsible_) { - this.collapsed_ = false; - } - - var className = options.className ? options.className : 'ol-attribution'; - - var tipLabel = options.tipLabel ? options.tipLabel : 'Attributions'; - - var collapseLabel = options.collapseLabel ? options.collapseLabel : '\u00BB'; - - /** - * @private - * @type {Node} - */ - this.collapseLabel_ = goog.isString(collapseLabel) ? - goog.dom.createDom('SPAN', {}, collapseLabel) : - collapseLabel; - - var label = options.label ? options.label : 'i'; - - /** - * @private - * @type {Node} - */ - this.label_ = goog.isString(label) ? - goog.dom.createDom('SPAN', {}, label) : - label; - - var activeLabel = (this.collapsible_ && !this.collapsed_) ? - this.collapseLabel_ : this.label_; - var button = goog.dom.createDom('BUTTON', { - 'type': 'button', - 'title': tipLabel - }, activeLabel); - - goog.events.listen(button, goog.events.EventType.CLICK, - this.handleClick_, false, this); - - goog.events.listen(button, [ - goog.events.EventType.MOUSEOUT, - goog.events.EventType.FOCUSOUT - ], function() { - this.blur(); - }, false); - - var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + - ol.css.CLASS_CONTROL + - (this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') + - (this.collapsible_ ? '' : ' ol-uncollapsible'); - var element = goog.dom.createDom('DIV', - cssClasses, this.ulElement_, button); - - var render = options.render ? options.render : ol.control.Attribution.render; - - goog.base(this, { - element: element, - render: render, - target: options.target - }); - - /** - * @private - * @type {boolean} - */ - this.renderedVisible_ = true; - - /** - * @private - * @type {Object.<string, Element>} - */ - this.attributionElements_ = {}; - - /** - * @private - * @type {Object.<string, boolean>} - */ - this.attributionElementRenderedVisible_ = {}; - - /** - * @private - * @type {Object.<string, Element>} - */ - this.logoElements_ = {}; - -}; -goog.inherits(ol.control.Attribution, ol.control.Control); - - -/** - * @param {?olx.FrameState} frameState Frame state. - * @return {Array.<Object.<string, ol.Attribution>>} Attributions. - */ -ol.control.Attribution.prototype.getSourceAttributions = function(frameState) { - var i, ii, j, jj, tileRanges, source, sourceAttribution, - sourceAttributionKey, sourceAttributions, sourceKey; - var intersectsTileRange; - var layerStatesArray = frameState.layerStatesArray; - /** @type {Object.<string, ol.Attribution>} */ - var attributions = goog.object.clone(frameState.attributions); - /** @type {Object.<string, ol.Attribution>} */ - var hiddenAttributions = {}; - var projection = frameState.viewState.projection; - goog.asserts.assert(projection, 'projection of viewState required'); - for (i = 0, ii = layerStatesArray.length; i < ii; i++) { - source = layerStatesArray[i].layer.getSource(); - if (!source) { - continue; - } - sourceKey = goog.getUid(source).toString(); - sourceAttributions = source.getAttributions(); - if (!sourceAttributions) { - continue; - } - for (j = 0, jj = sourceAttributions.length; j < jj; j++) { - sourceAttribution = sourceAttributions[j]; - sourceAttributionKey = goog.getUid(sourceAttribution).toString(); - if (sourceAttributionKey in attributions) { - continue; - } - tileRanges = frameState.usedTiles[sourceKey]; - if (tileRanges) { - goog.asserts.assertInstanceof(source, ol.source.Tile, - 'source should be an ol.source.Tile'); - var tileGrid = source.getTileGridForProjection(projection); - goog.asserts.assert(tileGrid, 'tileGrid required for projection'); - intersectsTileRange = sourceAttribution.intersectsAnyTileRange( - tileRanges, tileGrid, projection); - } else { - intersectsTileRange = false; - } - if (intersectsTileRange) { - if (sourceAttributionKey in hiddenAttributions) { - delete hiddenAttributions[sourceAttributionKey]; - } - attributions[sourceAttributionKey] = sourceAttribution; - } else { - hiddenAttributions[sourceAttributionKey] = sourceAttribution; - } - } - } - return [attributions, hiddenAttributions]; -}; - - -/** - * Update the attribution element. - * @param {ol.MapEvent} mapEvent Map event. - * @this {ol.control.Attribution} - * @api - */ -ol.control.Attribution.render = function(mapEvent) { - this.updateElement_(mapEvent.frameState); -}; - - -/** - * @private - * @param {?olx.FrameState} frameState Frame state. - */ -ol.control.Attribution.prototype.updateElement_ = function(frameState) { - - if (!frameState) { - if (this.renderedVisible_) { - goog.style.setElementShown(this.element, false); - this.renderedVisible_ = false; - } - return; - } - - var attributions = this.getSourceAttributions(frameState); - /** @type {Object.<string, ol.Attribution>} */ - var visibleAttributions = attributions[0]; - /** @type {Object.<string, ol.Attribution>} */ - var hiddenAttributions = attributions[1]; - - var attributionElement, attributionKey; - for (attributionKey in this.attributionElements_) { - if (attributionKey in visibleAttributions) { - if (!this.attributionElementRenderedVisible_[attributionKey]) { - goog.style.setElementShown( - this.attributionElements_[attributionKey], true); - this.attributionElementRenderedVisible_[attributionKey] = true; - } - delete visibleAttributions[attributionKey]; - } - else if (attributionKey in hiddenAttributions) { - if (this.attributionElementRenderedVisible_[attributionKey]) { - goog.style.setElementShown( - this.attributionElements_[attributionKey], false); - delete this.attributionElementRenderedVisible_[attributionKey]; - } - delete hiddenAttributions[attributionKey]; - } - else { - goog.dom.removeNode(this.attributionElements_[attributionKey]); - delete this.attributionElements_[attributionKey]; - delete this.attributionElementRenderedVisible_[attributionKey]; - } - } - for (attributionKey in visibleAttributions) { - attributionElement = goog.dom.createElement('LI'); - attributionElement.innerHTML = - visibleAttributions[attributionKey].getHTML(); - this.ulElement_.appendChild(attributionElement); - this.attributionElements_[attributionKey] = attributionElement; - this.attributionElementRenderedVisible_[attributionKey] = true; - } - for (attributionKey in hiddenAttributions) { - attributionElement = goog.dom.createElement('LI'); - attributionElement.innerHTML = - hiddenAttributions[attributionKey].getHTML(); - goog.style.setElementShown(attributionElement, false); - this.ulElement_.appendChild(attributionElement); - this.attributionElements_[attributionKey] = attributionElement; - } - - var renderVisible = - !goog.object.isEmpty(this.attributionElementRenderedVisible_) || - !goog.object.isEmpty(frameState.logos); - if (this.renderedVisible_ != renderVisible) { - goog.style.setElementShown(this.element, renderVisible); - this.renderedVisible_ = renderVisible; - } - if (renderVisible && - goog.object.isEmpty(this.attributionElementRenderedVisible_)) { - goog.dom.classlist.add(this.element, 'ol-logo-only'); - } else { - goog.dom.classlist.remove(this.element, 'ol-logo-only'); - } - - this.insertLogos_(frameState); - -}; - - -/** - * @param {?olx.FrameState} frameState Frame state. - * @private - */ -ol.control.Attribution.prototype.insertLogos_ = function(frameState) { - - var logo; - var logos = frameState.logos; - var logoElements = this.logoElements_; - - for (logo in logoElements) { - if (!(logo in logos)) { - goog.dom.removeNode(logoElements[logo]); - delete logoElements[logo]; - } - } - - var image, logoElement, logoKey; - for (logoKey in logos) { - if (!(logoKey in logoElements)) { - image = new Image(); - image.src = logoKey; - var logoValue = logos[logoKey]; - if (logoValue === '') { - logoElement = image; - } else { - logoElement = goog.dom.createDom('A', { - 'href': logoValue - }); - logoElement.appendChild(image); - } - this.logoLi_.appendChild(logoElement); - logoElements[logoKey] = logoElement; - } - } - - goog.style.setElementShown(this.logoLi_, !goog.object.isEmpty(logos)); - -}; - - -/** - * @param {goog.events.BrowserEvent} event The event to handle - * @private - */ -ol.control.Attribution.prototype.handleClick_ = function(event) { - event.preventDefault(); - this.handleToggle_(); -}; - - -/** - * @private - */ -ol.control.Attribution.prototype.handleToggle_ = function() { - goog.dom.classlist.toggle(this.element, 'ol-collapsed'); - if (this.collapsed_) { - goog.dom.replaceNode(this.collapseLabel_, this.label_); - } else { - goog.dom.replaceNode(this.label_, this.collapseLabel_); - } - this.collapsed_ = !this.collapsed_; -}; - - -/** - * Return `true` if the attribution is collapsible, `false` otherwise. - * @return {boolean} True if the widget is collapsible. - * @api stable - */ -ol.control.Attribution.prototype.getCollapsible = function() { - return this.collapsible_; -}; - - -/** - * Set whether the attribution should be collapsible. - * @param {boolean} collapsible True if the widget is collapsible. - * @api stable - */ -ol.control.Attribution.prototype.setCollapsible = function(collapsible) { - if (this.collapsible_ === collapsible) { - return; - } - this.collapsible_ = collapsible; - goog.dom.classlist.toggle(this.element, 'ol-uncollapsible'); - if (!collapsible && this.collapsed_) { - this.handleToggle_(); - } -}; - - -/** - * Collapse or expand the attribution according to the passed parameter. Will - * not do anything if the attribution isn't collapsible or if the current - * collapsed state is already the one requested. - * @param {boolean} collapsed True if the widget is collapsed. - * @api stable - */ -ol.control.Attribution.prototype.setCollapsed = function(collapsed) { - if (!this.collapsible_ || this.collapsed_ === collapsed) { - return; - } - this.handleToggle_(); -}; - - -/** - * Return `true` when the attribution is currently collapsed or `false` - * otherwise. - * @return {boolean} True if the widget is collapsed. - * @api stable - */ -ol.control.Attribution.prototype.getCollapsed = function() { - return this.collapsed_; -}; - -goog.provide('ol.control.Rotate'); - -goog.require('goog.dom'); -goog.require('goog.dom.classlist'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol'); -goog.require('ol.animation'); -goog.require('ol.control.Control'); -goog.require('ol.css'); -goog.require('ol.easing'); - - - -/** - * @classdesc - * A button control to reset rotation to 0. - * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css - * selector is added to the button when the rotation is 0. - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.RotateOptions=} opt_options Rotate options. - * @api stable - */ -ol.control.Rotate = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - var className = options.className ? - options.className : 'ol-rotate'; - - var label = options.label ? options.label : '\u21E7'; - - /** - * @type {Element} - * @private - */ - this.label_ = null; - - if (goog.isString(label)) { - this.label_ = goog.dom.createDom('SPAN', - 'ol-compass', label); - } else { - this.label_ = label; - goog.dom.classlist.add(this.label_, 'ol-compass'); - } - - var tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation'; - - var button = goog.dom.createDom('BUTTON', { - 'class': className + '-reset', - 'type' : 'button', - 'title': tipLabel - }, this.label_); - - goog.events.listen(button, goog.events.EventType.CLICK, - ol.control.Rotate.prototype.handleClick_, false, this); - - var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + - ol.css.CLASS_CONTROL; - var element = goog.dom.createDom('DIV', cssClasses, button); - - var render = options.render ? options.render : ol.control.Rotate.render; - - goog.base(this, { - element: element, - render: render, - target: options.target - }); - - /** - * @type {number} - * @private - */ - this.duration_ = options.duration ? options.duration : 250; - - /** - * @type {boolean} - * @private - */ - this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true; - - /** - * @private - * @type {number|undefined} - */ - this.rotation_ = undefined; - - if (this.autoHide_) { - goog.dom.classlist.add(this.element, ol.css.CLASS_HIDDEN); - } - -}; -goog.inherits(ol.control.Rotate, ol.control.Control); - - -/** - * @param {goog.events.BrowserEvent} event The event to handle - * @private - */ -ol.control.Rotate.prototype.handleClick_ = function(event) { - event.preventDefault(); - this.resetNorth_(); -}; - - -/** - * @private - */ -ol.control.Rotate.prototype.resetNorth_ = function() { - var map = this.getMap(); - var view = map.getView(); - if (!view) { - // the map does not have a view, so we can't act - // upon it - return; - } - var currentRotation = view.getRotation(); - if (currentRotation !== undefined) { - if (this.duration_ > 0) { - currentRotation = currentRotation % (2 * Math.PI); - if (currentRotation < -Math.PI) { - currentRotation += 2 * Math.PI; - } - if (currentRotation > Math.PI) { - currentRotation -= 2 * Math.PI; - } - map.beforeRender(ol.animation.rotate({ - rotation: currentRotation, - duration: this.duration_, - easing: ol.easing.easeOut - })); - } - view.setRotation(0); - } -}; - - -/** - * Update the rotate control element. - * @param {ol.MapEvent} mapEvent Map event. - * @this {ol.control.Rotate} - * @api - */ -ol.control.Rotate.render = function(mapEvent) { - var frameState = mapEvent.frameState; - if (!frameState) { - return; - } - var rotation = frameState.viewState.rotation; - if (rotation != this.rotation_) { - var transform = 'rotate(' + rotation + 'rad)'; - if (this.autoHide_) { - goog.dom.classlist.enable( - this.element, ol.css.CLASS_HIDDEN, rotation === 0); - } - this.label_.style.msTransform = transform; - this.label_.style.webkitTransform = transform; - this.label_.style.transform = transform; - } - this.rotation_ = rotation; -}; - -goog.provide('ol.control.Zoom'); - -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol.animation'); -goog.require('ol.control.Control'); -goog.require('ol.css'); -goog.require('ol.easing'); - - - -/** - * @classdesc - * A control with 2 buttons, one for zoom in and one for zoom out. - * This control is one of the default controls of a map. To style this control - * use css selectors `.ol-zoom-in` and `.ol-zoom-out`. - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.ZoomOptions=} opt_options Zoom options. - * @api stable - */ -ol.control.Zoom = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - var className = options.className ? options.className : 'ol-zoom'; - - var delta = options.delta ? options.delta : 1; - - var zoomInLabel = options.zoomInLabel ? options.zoomInLabel : '+'; - var zoomOutLabel = options.zoomOutLabel ? options.zoomOutLabel : '\u2212'; - - var zoomInTipLabel = options.zoomInTipLabel ? - options.zoomInTipLabel : 'Zoom in'; - var zoomOutTipLabel = options.zoomOutTipLabel ? - options.zoomOutTipLabel : 'Zoom out'; - - var inElement = goog.dom.createDom('BUTTON', { - 'class': className + '-in', - 'type' : 'button', - 'title': zoomInTipLabel - }, zoomInLabel); - - goog.events.listen(inElement, - goog.events.EventType.CLICK, goog.partial( - ol.control.Zoom.prototype.handleClick_, delta), false, this); - - var outElement = goog.dom.createDom('BUTTON', { - 'class': className + '-out', - 'type' : 'button', - 'title': zoomOutTipLabel - }, zoomOutLabel); - - goog.events.listen(outElement, - goog.events.EventType.CLICK, goog.partial( - ol.control.Zoom.prototype.handleClick_, -delta), false, this); - - var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + - ol.css.CLASS_CONTROL; - var element = goog.dom.createDom('DIV', cssClasses, inElement, - outElement); - - goog.base(this, { - element: element, - target: options.target - }); - - /** - * @type {number} - * @private - */ - this.duration_ = options.duration !== undefined ? options.duration : 250; - -}; -goog.inherits(ol.control.Zoom, ol.control.Control); - - -/** - * @param {number} delta Zoom delta. - * @param {goog.events.BrowserEvent} event The event to handle - * @private - */ -ol.control.Zoom.prototype.handleClick_ = function(delta, event) { - event.preventDefault(); - this.zoomByDelta_(delta); -}; - - -/** - * @param {number} delta Zoom delta. - * @private - */ -ol.control.Zoom.prototype.zoomByDelta_ = function(delta) { - var map = this.getMap(); - var view = map.getView(); - if (!view) { - // the map does not have a view, so we can't act - // upon it - return; - } - var currentResolution = view.getResolution(); - if (currentResolution) { - if (this.duration_ > 0) { - map.beforeRender(ol.animation.zoom({ - resolution: currentResolution, - duration: this.duration_, - easing: ol.easing.easeOut - })); - } - var newResolution = view.constrainResolution(currentResolution, delta); - view.setResolution(newResolution); - } -}; - -goog.provide('ol.control'); - -goog.require('ol'); -goog.require('ol.Collection'); -goog.require('ol.control.Attribution'); -goog.require('ol.control.Rotate'); -goog.require('ol.control.Zoom'); - - -/** - * Set of controls included in maps by default. Unless configured otherwise, - * this returns a collection containing an instance of each of the following - * controls: - * * {@link ol.control.Zoom} - * * {@link ol.control.Rotate} - * * {@link ol.control.Attribution} - * - * @param {olx.control.DefaultsOptions=} opt_options Defaults options. - * @return {ol.Collection.<ol.control.Control>} Controls. - * @api stable - */ -ol.control.defaults = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - var controls = new ol.Collection(); - - var zoomControl = options.zoom !== undefined ? options.zoom : true; - if (zoomControl) { - controls.push(new ol.control.Zoom(options.zoomOptions)); - } - - var rotateControl = options.rotate !== undefined ? options.rotate : true; - if (rotateControl) { - controls.push(new ol.control.Rotate(options.rotateOptions)); - } - - var attributionControl = options.attribution !== undefined ? - options.attribution : true; - if (attributionControl) { - controls.push(new ol.control.Attribution(options.attributionOptions)); - } - - return controls; - -}; - -// Copyright 2012 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Functions for managing full screen status of the DOM. - * - */ - -goog.provide('goog.dom.fullscreen'); -goog.provide('goog.dom.fullscreen.EventType'); - -goog.require('goog.dom'); -goog.require('goog.userAgent'); - - -/** - * Event types for full screen. - * @enum {string} - */ -goog.dom.fullscreen.EventType = { - /** Dispatched by the Document when the fullscreen status changes. */ - CHANGE: (function() { - if (goog.userAgent.WEBKIT) { - return 'webkitfullscreenchange'; - } - if (goog.userAgent.GECKO) { - return 'mozfullscreenchange'; - } - if (goog.userAgent.IE) { - return 'MSFullscreenChange'; - } - // Opera 12-14, and W3C standard (Draft): - // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html - return 'fullscreenchange'; - })() -}; - - -/** - * Determines if full screen is supported. - * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being - * queried. If not provided, use the current DOM. - * @return {boolean} True iff full screen is supported. - */ -goog.dom.fullscreen.isSupported = function(opt_domHelper) { - var doc = goog.dom.fullscreen.getDocument_(opt_domHelper); - var body = doc.body; - return !!(body.webkitRequestFullscreen || - (body.mozRequestFullScreen && doc.mozFullScreenEnabled) || - (body.msRequestFullscreen && doc.msFullscreenEnabled) || - (body.requestFullscreen && doc.fullscreenEnabled)); -}; - - -/** - * Requests putting the element in full screen. - * @param {!Element} element The element to put full screen. - */ -goog.dom.fullscreen.requestFullScreen = function(element) { - if (element.webkitRequestFullscreen) { - element.webkitRequestFullscreen(); - } else if (element.mozRequestFullScreen) { - element.mozRequestFullScreen(); - } else if (element.msRequestFullscreen) { - element.msRequestFullscreen(); - } else if (element.requestFullscreen) { - element.requestFullscreen(); - } -}; - - -/** - * Requests putting the element in full screen with full keyboard access. - * @param {!Element} element The element to put full screen. - */ -goog.dom.fullscreen.requestFullScreenWithKeys = function( - element) { - if (element.mozRequestFullScreenWithKeys) { - element.mozRequestFullScreenWithKeys(); - } else if (element.webkitRequestFullscreen) { - element.webkitRequestFullscreen(); - } else { - goog.dom.fullscreen.requestFullScreen(element); - } -}; - - -/** - * Exits full screen. - * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being - * queried. If not provided, use the current DOM. - */ -goog.dom.fullscreen.exitFullScreen = function(opt_domHelper) { - var doc = goog.dom.fullscreen.getDocument_(opt_domHelper); - if (doc.webkitCancelFullScreen) { - doc.webkitCancelFullScreen(); - } else if (doc.mozCancelFullScreen) { - doc.mozCancelFullScreen(); - } else if (doc.msExitFullscreen) { - doc.msExitFullscreen(); - } else if (doc.exitFullscreen) { - doc.exitFullscreen(); - } -}; - - -/** - * Determines if the document is full screen. - * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being - * queried. If not provided, use the current DOM. - * @return {boolean} Whether the document is full screen. - */ -goog.dom.fullscreen.isFullScreen = function(opt_domHelper) { - var doc = goog.dom.fullscreen.getDocument_(opt_domHelper); - // IE 11 doesn't have similar boolean property, so check whether - // document.msFullscreenElement is null instead. - return !!(doc.webkitIsFullScreen || doc.mozFullScreen || - doc.msFullscreenElement || doc.fullscreenElement); -}; - - -/** - * Get the root element in full screen mode. - * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being - * queried. If not provided, use the current DOM. - * @return {?Element} The root element in full screen mode. - */ -goog.dom.fullscreen.getFullScreenElement = function(opt_domHelper) { - var doc = goog.dom.fullscreen.getDocument_(opt_domHelper); - var element_list = [ - doc.webkitFullscreenElement, - doc.mozFullScreenElement, - doc.msFullscreenElement, - doc.fullscreenElement - ]; - for (var i = 0; i < element_list.length; i++) { - if (element_list[i] != null) { - return element_list[i]; - } - } - return null; -}; - - -/** - * Gets the document object of the dom. - * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being - * queried. If not provided, use the current DOM. - * @return {!Document} The dom document. - * @private - */ -goog.dom.fullscreen.getDocument_ = function(opt_domHelper) { - return opt_domHelper ? - opt_domHelper.getDocument() : - goog.dom.getDomHelper().getDocument(); -}; - -goog.provide('ol.control.FullScreen'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.dom.classlist'); -goog.require('goog.dom.fullscreen'); -goog.require('goog.dom.fullscreen.EventType'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol'); -goog.require('ol.control.Control'); -goog.require('ol.css'); - - - -/** - * @classdesc - * Provides a button that when clicked fills up the full screen with the map. - * When in full screen mode, a close button is shown to exit full screen mode. - * The [Fullscreen API](http://www.w3.org/TR/fullscreen/) is used to - * toggle the map in full screen mode. - * - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.FullScreenOptions=} opt_options Options. - * @api stable - */ -ol.control.FullScreen = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {string} - */ - this.cssClassName_ = options.className ? options.className : 'ol-full-screen'; - - var label = options.label ? options.label : '\u2194'; - - /** - * @private - * @type {Node} - */ - this.labelNode_ = goog.isString(label) ? - goog.dom.createTextNode(label) : label; - - var labelActive = options.labelActive ? options.labelActive : '\u00d7'; - - /** - * @private - * @type {Node} - */ - this.labelActiveNode_ = goog.isString(labelActive) ? - goog.dom.createTextNode(labelActive) : labelActive; - - var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen'; - var button = goog.dom.createDom('BUTTON', { - 'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen(), - 'type': 'button', - 'title': tipLabel - }, this.labelNode_); - - goog.events.listen(button, goog.events.EventType.CLICK, - this.handleClick_, false, this); - - goog.events.listen(goog.global.document, - goog.dom.fullscreen.EventType.CHANGE, - this.handleFullScreenChange_, false, this); - - var cssClasses = this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE + - ' ' + ol.css.CLASS_CONTROL + ' ' + - (!goog.dom.fullscreen.isSupported() ? ol.css.CLASS_UNSUPPORTED : ''); - var element = goog.dom.createDom('DIV', cssClasses, button); - - goog.base(this, { - element: element, - target: options.target - }); - - /** - * @private - * @type {boolean} - */ - this.keys_ = options.keys !== undefined ? options.keys : false; - -}; -goog.inherits(ol.control.FullScreen, ol.control.Control); - - -/** - * @param {goog.events.BrowserEvent} event The event to handle - * @private - */ -ol.control.FullScreen.prototype.handleClick_ = function(event) { - event.preventDefault(); - this.handleFullScreen_(); -}; - - -/** - * @private - */ -ol.control.FullScreen.prototype.handleFullScreen_ = function() { - if (!goog.dom.fullscreen.isSupported()) { - return; - } - var map = this.getMap(); - if (!map) { - return; - } - if (goog.dom.fullscreen.isFullScreen()) { - goog.dom.fullscreen.exitFullScreen(); - } else { - var target = map.getTarget(); - goog.asserts.assert(target, 'target should be defined'); - var element = goog.dom.getElement(target); - goog.asserts.assert(element, 'element should be defined'); - if (this.keys_) { - goog.dom.fullscreen.requestFullScreenWithKeys(element); - } else { - goog.dom.fullscreen.requestFullScreen(element); - } - } -}; - - -/** - * @private - */ -ol.control.FullScreen.prototype.handleFullScreenChange_ = function() { - var opened = this.cssClassName_ + '-true'; - var closed = this.cssClassName_ + '-false'; - var button = goog.dom.getFirstElementChild(this.element); - var map = this.getMap(); - if (goog.dom.fullscreen.isFullScreen()) { - goog.dom.classlist.swap(button, closed, opened); - goog.dom.replaceNode(this.labelActiveNode_, this.labelNode_); - } else { - goog.dom.classlist.swap(button, opened, closed); - goog.dom.replaceNode(this.labelNode_, this.labelActiveNode_); - } - if (map) { - map.updateSize(); - } -}; - -goog.provide('ol.Pixel'); - - -/** - * An array with two elements, representing a pixel. The first element is the - * x-coordinate, the second the y-coordinate of the pixel. - * @typedef {Array.<number>} - * @api stable - */ -ol.Pixel; - -// FIXME should listen on appropriate pane, once it is defined - -goog.provide('ol.control.MousePosition'); - -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol.CoordinateFormatType'); -goog.require('ol.Object'); -goog.require('ol.Pixel'); -goog.require('ol.TransformFunction'); -goog.require('ol.control.Control'); -goog.require('ol.proj'); -goog.require('ol.proj.Projection'); - - -/** - * @enum {string} - */ -ol.control.MousePositionProperty = { - PROJECTION: 'projection', - COORDINATE_FORMAT: 'coordinateFormat' -}; - - - -/** - * @classdesc - * A control to show the 2D coordinates of the mouse cursor. By default, these - * are in the view projection, but can be in any supported projection. - * By default the control is shown in the top right corner of the map, but this - * can be changed by using the css selector `.ol-mouse-position`. - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.MousePositionOptions=} opt_options Mouse position - * options. - * @api stable - */ -ol.control.MousePosition = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - var className = options.className ? options.className : 'ol-mouse-position'; - - var element = goog.dom.createDom('DIV', className); - - var render = options.render ? - options.render : ol.control.MousePosition.render; - - goog.base(this, { - element: element, - render: render, - target: options.target - }); - - goog.events.listen(this, - ol.Object.getChangeEventType(ol.control.MousePositionProperty.PROJECTION), - this.handleProjectionChanged_, false, this); - - if (options.coordinateFormat) { - this.setCoordinateFormat(options.coordinateFormat); - } - if (options.projection) { - this.setProjection(ol.proj.get(options.projection)); - } - - /** - * @private - * @type {string} - */ - this.undefinedHTML_ = options.undefinedHTML ? options.undefinedHTML : ''; - - /** - * @private - * @type {string} - */ - this.renderedHTML_ = element.innerHTML; - - /** - * @private - * @type {ol.proj.Projection} - */ - this.mapProjection_ = null; - - /** - * @private - * @type {?ol.TransformFunction} - */ - this.transform_ = null; - - /** - * @private - * @type {ol.Pixel} - */ - this.lastMouseMovePixel_ = null; - -}; -goog.inherits(ol.control.MousePosition, ol.control.Control); - - -/** - * Update the mouseposition element. - * @param {ol.MapEvent} mapEvent Map event. - * @this {ol.control.MousePosition} - * @api - */ -ol.control.MousePosition.render = function(mapEvent) { - var frameState = mapEvent.frameState; - if (!frameState) { - this.mapProjection_ = null; - } else { - if (this.mapProjection_ != frameState.viewState.projection) { - this.mapProjection_ = frameState.viewState.projection; - this.transform_ = null; - } - } - this.updateHTML_(this.lastMouseMovePixel_); -}; - - -/** - * @private - */ -ol.control.MousePosition.prototype.handleProjectionChanged_ = function() { - this.transform_ = null; -}; - - -/** - * Return the coordinate format type used to render the current position or - * undefined. - * @return {ol.CoordinateFormatType|undefined} The format to render the current - * position in. - * @observable - * @api stable - */ -ol.control.MousePosition.prototype.getCoordinateFormat = function() { - return /** @type {ol.CoordinateFormatType|undefined} */ ( - this.get(ol.control.MousePositionProperty.COORDINATE_FORMAT)); -}; - - -/** - * Return the projection that is used to report the mouse position. - * @return {ol.proj.Projection|undefined} The projection to report mouse - * position in. - * @observable - * @api stable - */ -ol.control.MousePosition.prototype.getProjection = function() { - return /** @type {ol.proj.Projection|undefined} */ ( - this.get(ol.control.MousePositionProperty.PROJECTION)); -}; - - -/** - * @param {goog.events.BrowserEvent} browserEvent Browser event. - * @protected - */ -ol.control.MousePosition.prototype.handleMouseMove = function(browserEvent) { - var map = this.getMap(); - this.lastMouseMovePixel_ = map.getEventPixel(browserEvent.getBrowserEvent()); - this.updateHTML_(this.lastMouseMovePixel_); -}; - - -/** - * @param {goog.events.BrowserEvent} browserEvent Browser event. - * @protected - */ -ol.control.MousePosition.prototype.handleMouseOut = function(browserEvent) { - this.updateHTML_(null); - this.lastMouseMovePixel_ = null; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.control.MousePosition.prototype.setMap = function(map) { - goog.base(this, 'setMap', map); - if (map) { - var viewport = map.getViewport(); - this.listenerKeys.push( - goog.events.listen(viewport, goog.events.EventType.MOUSEMOVE, - this.handleMouseMove, false, this), - goog.events.listen(viewport, goog.events.EventType.MOUSEOUT, - this.handleMouseOut, false, this) - ); - } -}; - - -/** - * Set the coordinate format type used to render the current position. - * @param {ol.CoordinateFormatType} format The format to render the current - * position in. - * @observable - * @api stable - */ -ol.control.MousePosition.prototype.setCoordinateFormat = function(format) { - this.set(ol.control.MousePositionProperty.COORDINATE_FORMAT, format); -}; - - -/** - * Set the projection that is used to report the mouse position. - * @param {ol.proj.Projection} projection The projection to report mouse - * position in. - * @observable - * @api stable - */ -ol.control.MousePosition.prototype.setProjection = function(projection) { - this.set(ol.control.MousePositionProperty.PROJECTION, projection); -}; - - -/** - * @param {?ol.Pixel} pixel Pixel. - * @private - */ -ol.control.MousePosition.prototype.updateHTML_ = function(pixel) { - var html = this.undefinedHTML_; - if (pixel && this.mapProjection_) { - if (!this.transform_) { - var projection = this.getProjection(); - if (projection) { - this.transform_ = ol.proj.getTransformFromProjections( - this.mapProjection_, projection); - } else { - this.transform_ = ol.proj.identityTransform; - } - } - var map = this.getMap(); - var coordinate = map.getCoordinateFromPixel(pixel); - if (coordinate) { - this.transform_(coordinate, coordinate); - var coordinateFormat = this.getCoordinateFormat(); - if (coordinateFormat) { - html = coordinateFormat(coordinate); - } else { - html = coordinate.toString(); - } - } - } - if (!this.renderedHTML_ || html != this.renderedHTML_) { - this.element.innerHTML = html; - this.renderedHTML_ = html; - } -}; - -// Copyright 2012 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A delayed callback that pegs to the next animation frame - * instead of a user-configurable timeout. - * - * @author nicksantos@google.com (Nick Santos) - */ - -goog.provide('goog.async.AnimationDelay'); - -goog.require('goog.Disposable'); -goog.require('goog.events'); -goog.require('goog.functions'); - - - -// TODO(nicksantos): Should we factor out the common code between this and -// goog.async.Delay? I'm not sure if there's enough code for this to really -// make sense. Subclassing seems like the wrong approach for a variety of -// reasons. Maybe there should be a common interface? - - - -/** - * A delayed callback that pegs to the next animation frame - * instead of a user configurable timeout. By design, this should have - * the same interface as goog.async.Delay. - * - * Uses requestAnimationFrame and friends when available, but falls - * back to a timeout of goog.async.AnimationDelay.TIMEOUT. - * - * For more on requestAnimationFrame and how you can use it to create smoother - * animations, see: - * @see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - * - * @param {function(number)} listener Function to call when the delay completes. - * Will be passed the timestamp when it's called, in unix ms. - * @param {Window=} opt_window The window object to execute the delay in. - * Defaults to the global object. - * @param {Object=} opt_handler The object scope to invoke the function in. - * @constructor - * @struct - * @extends {goog.Disposable} - * @final - */ -goog.async.AnimationDelay = function(listener, opt_window, opt_handler) { - goog.async.AnimationDelay.base(this, 'constructor'); - - /** - * Identifier of the active delay timeout, or event listener, - * or null when inactive. - * @private {goog.events.Key|number} - */ - this.id_ = null; - - /** - * If we're using dom listeners. - * @private {?boolean} - */ - this.usingListeners_ = false; - - /** - * The function that will be invoked after a delay. - * @private {function(number)} - */ - this.listener_ = listener; - - /** - * The object context to invoke the callback in. - * @private {Object|undefined} - */ - this.handler_ = opt_handler; - - /** - * @private {Window} - */ - this.win_ = opt_window || window; - - /** - * Cached callback function invoked when the delay finishes. - * @private {function()} - */ - this.callback_ = goog.bind(this.doAction_, this); -}; -goog.inherits(goog.async.AnimationDelay, goog.Disposable); - - -/** - * Default wait timeout for animations (in milliseconds). Only used for timed - * animation, which uses a timer (setTimeout) to schedule animation. - * - * @type {number} - * @const - */ -goog.async.AnimationDelay.TIMEOUT = 20; - - -/** - * Name of event received from the requestAnimationFrame in Firefox. - * - * @type {string} - * @const - * @private - */ -goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_ = 'MozBeforePaint'; - - -/** - * Starts the delay timer. The provided listener function will be called - * before the next animation frame. - */ -goog.async.AnimationDelay.prototype.start = function() { - this.stop(); - this.usingListeners_ = false; - - var raf = this.getRaf_(); - var cancelRaf = this.getCancelRaf_(); - if (raf && !cancelRaf && this.win_.mozRequestAnimationFrame) { - // Because Firefox (Gecko) runs animation in separate threads, it also saves - // time by running the requestAnimationFrame callbacks in that same thread. - // Sadly this breaks the assumption of implicit thread-safety in JS, and can - // thus create thread-based inconsistencies on counters etc. - // - // Calling cycleAnimations_ using the MozBeforePaint event instead of as - // callback fixes this. - // - // Trigger this condition only if the mozRequestAnimationFrame is available, - // but not the W3C requestAnimationFrame function (as in draft) or the - // equivalent cancel functions. - this.id_ = goog.events.listen( - this.win_, - goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_, - this.callback_); - this.win_.mozRequestAnimationFrame(null); - this.usingListeners_ = true; - } else if (raf && cancelRaf) { - this.id_ = raf.call(this.win_, this.callback_); - } else { - this.id_ = this.win_.setTimeout( - // Prior to Firefox 13, Gecko passed a non-standard parameter - // to the callback that we want to ignore. - goog.functions.lock(this.callback_), - goog.async.AnimationDelay.TIMEOUT); - } -}; - - -/** - * Stops the delay timer if it is active. No action is taken if the timer is not - * in use. - */ -goog.async.AnimationDelay.prototype.stop = function() { - if (this.isActive()) { - var raf = this.getRaf_(); - var cancelRaf = this.getCancelRaf_(); - if (raf && !cancelRaf && this.win_.mozRequestAnimationFrame) { - goog.events.unlistenByKey(this.id_); - } else if (raf && cancelRaf) { - cancelRaf.call(this.win_, /** @type {number} */ (this.id_)); - } else { - this.win_.clearTimeout(/** @type {number} */ (this.id_)); - } - } - this.id_ = null; -}; - - -/** - * Fires delay's action even if timer has already gone off or has not been - * started yet; guarantees action firing. Stops the delay timer. - */ -goog.async.AnimationDelay.prototype.fire = function() { - this.stop(); - this.doAction_(); -}; - - -/** - * Fires delay's action only if timer is currently active. Stops the delay - * timer. - */ -goog.async.AnimationDelay.prototype.fireIfActive = function() { - if (this.isActive()) { - this.fire(); - } -}; - - -/** - * @return {boolean} True if the delay is currently active, false otherwise. - */ -goog.async.AnimationDelay.prototype.isActive = function() { - return this.id_ != null; -}; - - -/** - * Invokes the callback function after the delay successfully completes. - * @private - */ -goog.async.AnimationDelay.prototype.doAction_ = function() { - if (this.usingListeners_ && this.id_) { - goog.events.unlistenByKey(this.id_); - } - this.id_ = null; - - // We are not using the timestamp returned by requestAnimationFrame - // because it may be either a Date.now-style time or a - // high-resolution time (depending on browser implementation). Using - // goog.now() will ensure that the timestamp used is consistent and - // compatible with goog.fx.Animation. - this.listener_.call(this.handler_, goog.now()); -}; - - -/** @override */ -goog.async.AnimationDelay.prototype.disposeInternal = function() { - this.stop(); - goog.async.AnimationDelay.base(this, 'disposeInternal'); -}; - - -/** - * @return {?function(function(number)): number} The requestAnimationFrame - * function, or null if not available on this browser. - * @private - */ -goog.async.AnimationDelay.prototype.getRaf_ = function() { - var win = this.win_; - return win.requestAnimationFrame || - win.webkitRequestAnimationFrame || - win.mozRequestAnimationFrame || - win.oRequestAnimationFrame || - win.msRequestAnimationFrame || - null; -}; - - -/** - * @return {?function(number): number} The cancelAnimationFrame function, - * or null if not available on this browser. - * @private - */ -goog.async.AnimationDelay.prototype.getCancelRaf_ = function() { - var win = this.win_; - return win.cancelAnimationFrame || - win.cancelRequestAnimationFrame || - win.webkitCancelRequestAnimationFrame || - win.mozCancelRequestAnimationFrame || - win.oCancelRequestAnimationFrame || - win.msCancelRequestAnimationFrame || - null; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Provides a function to schedule running a function as soon - * as possible after the current JS execution stops and yields to the event - * loop. - * - */ - -goog.provide('goog.async.nextTick'); -goog.provide('goog.async.throwException'); - -goog.require('goog.debug.entryPointRegistry'); -goog.require('goog.dom.TagName'); -goog.require('goog.functions'); -goog.require('goog.labs.userAgent.browser'); -goog.require('goog.labs.userAgent.engine'); - - -/** - * Throw an item without interrupting the current execution context. For - * example, if processing a group of items in a loop, sometimes it is useful - * to report an error while still allowing the rest of the batch to be - * processed. - * @param {*} exception - */ -goog.async.throwException = function(exception) { - // Each throw needs to be in its own context. - goog.global.setTimeout(function() { throw exception; }, 0); -}; - - -/** - * Fires the provided callbacks as soon as possible after the current JS - * execution context. setTimeout(…, 0) takes at least 4ms when called from - * within another setTimeout(…, 0) for legacy reasons. - * - * This will not schedule the callback as a microtask (i.e. a task that can - * preempt user input or networking callbacks). It is meant to emulate what - * setTimeout(_, 0) would do if it were not throttled. If you desire microtask - * behavior, use {@see goog.Promise} instead. - * - * @param {function(this:SCOPE)} callback Callback function to fire as soon as - * possible. - * @param {SCOPE=} opt_context Object in whose scope to call the listener. - * @param {boolean=} opt_useSetImmediate Avoid the IE workaround that - * ensures correctness at the cost of speed. See comments for details. - * @template SCOPE - */ -goog.async.nextTick = function(callback, opt_context, opt_useSetImmediate) { - var cb = callback; - if (opt_context) { - cb = goog.bind(callback, opt_context); - } - cb = goog.async.nextTick.wrapCallback_(cb); - // window.setImmediate was introduced and currently only supported by IE10+, - // but due to a bug in the implementation it is not guaranteed that - // setImmediate is faster than setTimeout nor that setImmediate N is before - // setImmediate N+1. That is why we do not use the native version if - // available. We do, however, call setImmediate if it is a normal function - // because that indicates that it has been replaced by goog.testing.MockClock - // which we do want to support. - // See - // http://connect.microsoft.com/IE/feedback/details/801823/setimmediate-and-messagechannel-are-broken-in-ie10 - // - // Note we do allow callers to also request setImmediate if they are willing - // to accept the possible tradeoffs of incorrectness in exchange for speed. - // The IE fallback of readystate change is much slower. - if (goog.isFunction(goog.global.setImmediate) && - // Opt in. - (opt_useSetImmediate || - // or it isn't a browser or the environment is weird - !goog.global.Window || !goog.global.Window.prototype || - // or something redefined setImmediate in which case we (YOLO) decide - // to use it (This is so that we use the mockClock setImmediate. sigh). - goog.global.Window.prototype.setImmediate != goog.global.setImmediate)) { - goog.global.setImmediate(cb); - return; - } - - // Look for and cache the custom fallback version of setImmediate. - if (!goog.async.nextTick.setImmediate_) { - goog.async.nextTick.setImmediate_ = - goog.async.nextTick.getSetImmediateEmulator_(); - } - goog.async.nextTick.setImmediate_(cb); -}; - - -/** - * Cache for the setImmediate implementation. - * @type {function(function())} - * @private - */ -goog.async.nextTick.setImmediate_; - - -/** - * Determines the best possible implementation to run a function as soon as - * the JS event loop is idle. - * @return {function(function())} The "setImmediate" implementation. - * @private - */ -goog.async.nextTick.getSetImmediateEmulator_ = function() { - // Create a private message channel and use it to postMessage empty messages - // to ourselves. - var Channel = goog.global['MessageChannel']; - // If MessageChannel is not available and we are in a browser, implement - // an iframe based polyfill in browsers that have postMessage and - // document.addEventListener. The latter excludes IE8 because it has a - // synchronous postMessage implementation. - if (typeof Channel === 'undefined' && typeof window !== 'undefined' && - window.postMessage && window.addEventListener && - // Presto (The old pre-blink Opera engine) has problems with iframes - // and contentWindow. - !goog.labs.userAgent.engine.isPresto()) { - /** @constructor */ - Channel = function() { - // Make an empty, invisible iframe. - var iframe = document.createElement(goog.dom.TagName.IFRAME); - iframe.style.display = 'none'; - iframe.src = ''; - document.documentElement.appendChild(iframe); - var win = iframe.contentWindow; - var doc = win.document; - doc.open(); - doc.write(''); - doc.close(); - // Do not post anything sensitive over this channel, as the workaround for - // pages with file: origin could allow that information to be modified or - // intercepted. - var message = 'callImmediate' + Math.random(); - // The same origin policy rejects attempts to postMessage from file: urls - // unless the origin is '*'. - // TODO(b/16335441): Use '*' origin for data: and other similar protocols. - var origin = win.location.protocol == 'file:' ? - '*' : win.location.protocol + '//' + win.location.host; - var onmessage = goog.bind(function(e) { - // Validate origin and message to make sure that this message was - // intended for us. If the origin is set to '*' (see above) only the - // message needs to match since, for example, '*' != 'file://'. Allowing - // the wildcard is ok, as we are not concerned with security here. - if ((origin != '*' && e.origin != origin) || e.data != message) { - return; - } - this['port1'].onmessage(); - }, this); - win.addEventListener('message', onmessage, false); - this['port1'] = {}; - this['port2'] = { - postMessage: function() { - win.postMessage(message, origin); - } - }; - }; - } - if (typeof Channel !== 'undefined' && - (!goog.labs.userAgent.browser.isIE())) { - // Exclude all of IE due to - // http://codeforhire.com/2013/09/21/setimmediate-and-messagechannel-broken-on-internet-explorer-10/ - // which allows starving postMessage with a busy setTimeout loop. - // This currently affects IE10 and IE11 which would otherwise be able - // to use the postMessage based fallbacks. - var channel = new Channel(); - // Use a fifo linked list to call callbacks in the right order. - var head = {}; - var tail = head; - channel['port1'].onmessage = function() { - if (goog.isDef(head.next)) { - head = head.next; - var cb = head.cb; - head.cb = null; - cb(); - } - }; - return function(cb) { - tail.next = { - cb: cb - }; - tail = tail.next; - channel['port2'].postMessage(0); - }; - } - // Implementation for IE6+: Script elements fire an asynchronous - // onreadystatechange event when inserted into the DOM. - if (typeof document !== 'undefined' && 'onreadystatechange' in - document.createElement(goog.dom.TagName.SCRIPT)) { - return function(cb) { - var script = document.createElement(goog.dom.TagName.SCRIPT); - script.onreadystatechange = function() { - // Clean up and call the callback. - script.onreadystatechange = null; - script.parentNode.removeChild(script); - script = null; - cb(); - cb = null; - }; - document.documentElement.appendChild(script); - }; - } - // Fall back to setTimeout with 0. In browsers this creates a delay of 5ms - // or more. - return function(cb) { - goog.global.setTimeout(cb, 0); - }; -}; - - -/** - * Helper function that is overrided to protect callbacks with entry point - * monitor if the application monitors entry points. - * @param {function()} callback Callback function to fire as soon as possible. - * @return {function()} The wrapped callback. - * @private - */ -goog.async.nextTick.wrapCallback_ = goog.functions.identity; - - -// Register the callback function as an entry point, so that it can be -// monitored for exception handling, etc. This has to be done in this file -// since it requires special code to handle all browsers. -goog.debug.entryPointRegistry.register( - /** - * @param {function(!Function): !Function} transformer The transforming - * function. - */ - function(transformer) { - goog.async.nextTick.wrapCallback_ = transformer; - }); - -// Copyright 2014 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview The SafeScript type and its builders. - * - * TODO(xtof): Link to document stating type contract. - */ - -goog.provide('goog.html.SafeScript'); - -goog.require('goog.asserts'); -goog.require('goog.string.Const'); -goog.require('goog.string.TypedString'); - - - -/** - * A string-like object which represents JavaScript code and that carries the - * security type contract that its value, as a string, will not cause execution - * of unconstrained attacker controlled code (XSS) when evaluated as JavaScript - * in a browser. - * - * Instances of this type must be created via the factory method - * {@code goog.html.SafeScript.fromConstant} and not by invoking its - * constructor. The constructor intentionally takes no parameters and the type - * is immutable; hence only a default instance corresponding to the empty string - * can be obtained via constructor invocation. - * - * A SafeScript's string representation can safely be interpolated as the - * content of a script element within HTML. The SafeScript string should not be - * escaped before interpolation. - * - * Note that the SafeScript might contain text that is attacker-controlled but - * that text should have been interpolated with appropriate escaping, - * sanitization and/or validation into the right location in the script, such - * that it is highly constrained in its effect (for example, it had to match a - * set of whitelisted words). - * - * A SafeScript can be constructed via security-reviewed unchecked - * conversions. In this case producers of SafeScript must ensure themselves that - * the SafeScript does not contain unsafe script. Note in particular that - * {@code <} is dangerous, even when inside JavaScript strings, and so should - * always be forbidden or JavaScript escaped in user controlled input. For - * example, if {@code </script><script>evil</script>"} were - * interpolated inside a JavaScript string, it would break out of the context - * of the original script element and {@code evil} would execute. Also note - * that within an HTML script (raw text) element, HTML character references, - * such as "<" are not allowed. See - * http://www.w3.org/TR/html5/scripting-1.html#restrictions-for-contents-of-script-elements. - * - * @see goog.html.SafeScript#fromConstant - * @constructor - * @final - * @struct - * @implements {goog.string.TypedString} - */ -goog.html.SafeScript = function() { - /** - * The contained value of this SafeScript. The field has a purposely - * ugly name to make (non-compiled) code that attempts to directly access this - * field stand out. - * @private {string} - */ - this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = ''; - - /** - * A type marker used to implement additional run-time type checking. - * @see goog.html.SafeScript#unwrap - * @const - * @private - */ - this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = - goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - - -/** - * @override - * @const - */ -goog.html.SafeScript.prototype.implementsGoogStringTypedString = true; - - -/** - * Type marker for the SafeScript type, used to implement additional - * run-time type checking. - * @const {!Object} - * @private - */ -goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - - -/** - * Creates a SafeScript object from a compile-time constant string. - * - * @param {!goog.string.Const} script A compile-time-constant string from which - * to create a SafeScript. - * @return {!goog.html.SafeScript} A SafeScript object initialized to - * {@code script}. - */ -goog.html.SafeScript.fromConstant = function(script) { - var scriptString = goog.string.Const.unwrap(script); - if (scriptString.length === 0) { - return goog.html.SafeScript.EMPTY; - } - return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse( - scriptString); -}; - - -/** - * Returns this SafeScript's value as a string. - * - * IMPORTANT: In code where it is security relevant that an object's type is - * indeed {@code SafeScript}, use {@code goog.html.SafeScript.unwrap} instead of - * this method. If in doubt, assume that it's security relevant. In particular, - * note that goog.html functions which return a goog.html type do not guarantee - * the returned instance is of the right type. For example: - * - * <pre> - * var fakeSafeHtml = new String('fake'); - * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype; - * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml); - * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by - * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml - * // instanceof goog.html.SafeHtml. - * </pre> - * - * @see goog.html.SafeScript#unwrap - * @override - */ -goog.html.SafeScript.prototype.getTypedStringValue = function() { - return this.privateDoNotAccessOrElseSafeScriptWrappedValue_; -}; - - -if (goog.DEBUG) { - /** - * Returns a debug string-representation of this value. - * - * To obtain the actual string value wrapped in a SafeScript, use - * {@code goog.html.SafeScript.unwrap}. - * - * @see goog.html.SafeScript#unwrap - * @override - */ - goog.html.SafeScript.prototype.toString = function() { - return 'SafeScript{' + - this.privateDoNotAccessOrElseSafeScriptWrappedValue_ + '}'; - }; -} - - -/** - * Performs a runtime check that the provided object is indeed a - * SafeScript object, and returns its value. - * - * @param {!goog.html.SafeScript} safeScript The object to extract from. - * @return {string} The safeScript object's contained string, unless - * the run-time type check fails. In that case, {@code unwrap} returns an - * innocuous string, or, if assertions are enabled, throws - * {@code goog.asserts.AssertionError}. - */ -goog.html.SafeScript.unwrap = function(safeScript) { - // Perform additional Run-time type-checking to ensure that - // safeScript is indeed an instance of the expected type. This - // provides some additional protection against security bugs due to - // application code that disables type checks. - // Specifically, the following checks are performed: - // 1. The object is an instance of the expected type. - // 2. The object is not an instance of a subclass. - // 3. The object carries a type marker for the expected type. "Faking" an - // object requires a reference to the type marker, which has names intended - // to stand out in code reviews. - if (safeScript instanceof goog.html.SafeScript && - safeScript.constructor === goog.html.SafeScript && - safeScript.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === - goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) { - return safeScript.privateDoNotAccessOrElseSafeScriptWrappedValue_; - } else { - goog.asserts.fail( - 'expected object of type SafeScript, got \'' + safeScript + '\''); - return 'type_error:SafeScript'; - } -}; - - -/** - * Package-internal utility method to create SafeScript instances. - * - * @param {string} script The string to initialize the SafeScript object with. - * @return {!goog.html.SafeScript} The initialized SafeScript object. - * @package - */ -goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse = - function(script) { - return new goog.html.SafeScript().initSecurityPrivateDoNotAccessOrElse_( - script); -}; - - -/** - * Called from createSafeScriptSecurityPrivateDoNotAccessOrElse(). This - * method exists only so that the compiler can dead code eliminate static - * fields (like EMPTY) when they're not accessed. - * @param {string} script - * @return {!goog.html.SafeScript} - * @private - */ -goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_ = function( - script) { - this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = script; - return this; -}; - - -/** - * A SafeScript instance corresponding to the empty string. - * @const {!goog.html.SafeScript} - */ -goog.html.SafeScript.EMPTY = - goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(''); - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Unchecked conversions to create values of goog.html types from - * plain strings. Use of these functions could potentially result in instances - * of goog.html types that violate their type contracts, and hence result in - * security vulnerabilties. - * - * Therefore, all uses of the methods herein must be carefully security - * reviewed. Avoid use of the methods in this file whenever possible; instead - * prefer to create instances of goog.html types using inherently safe builders - * or template systems. - * - * - * - * @visibility {//closure/goog/html:approved_for_unchecked_conversion} - * @visibility {//closure/goog/bin/sizetests:__pkg__} - */ - - -goog.provide('goog.html.uncheckedconversions'); - -goog.require('goog.asserts'); -goog.require('goog.html.SafeHtml'); -goog.require('goog.html.SafeScript'); -goog.require('goog.html.SafeStyle'); -goog.require('goog.html.SafeStyleSheet'); -goog.require('goog.html.SafeUrl'); -goog.require('goog.html.TrustedResourceUrl'); -goog.require('goog.string'); -goog.require('goog.string.Const'); - - -/** - * Performs an "unchecked conversion" to SafeHtml from a plain string that is - * known to satisfy the SafeHtml type contract. - * - * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure - * that the value of {@code html} satisfies the SafeHtml type contract in all - * possible program states. - * - * - * @param {!goog.string.Const} justification A constant string explaining why - * this use of this method is safe. May include a security review ticket - * number. - * @param {string} html A string that is claimed to adhere to the SafeHtml - * contract. - * @param {?goog.i18n.bidi.Dir=} opt_dir The optional directionality of the - * SafeHtml to be constructed. A null or undefined value signifies an - * unknown directionality. - * @return {!goog.html.SafeHtml} The value of html, wrapped in a SafeHtml - * object. - * @suppress {visibility} For access to SafeHtml.create... Note that this - * use is appropriate since this method is intended to be "package private" - * withing goog.html. DO NOT call SafeHtml.create... from outside this - * package; use appropriate wrappers instead. - */ -goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract = - function(justification, html, opt_dir) { - // unwrap() called inside an assert so that justification can be optimized - // away in production code. - goog.asserts.assertString(goog.string.Const.unwrap(justification), - 'must provide justification'); - goog.asserts.assert( - !goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), - 'must provide non-empty justification'); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse( - html, opt_dir || null); -}; - - -/** - * Performs an "unchecked conversion" to SafeScript from a plain string that is - * known to satisfy the SafeScript type contract. - * - * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure - * that the value of {@code script} satisfies the SafeScript type contract in - * all possible program states. - * - * - * @param {!goog.string.Const} justification A constant string explaining why - * this use of this method is safe. May include a security review ticket - * number. - * @param {string} script The string to wrap as a SafeScript. - * @return {!goog.html.SafeScript} The value of {@code script}, wrapped in a - * SafeScript object. - */ -goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract = - function(justification, script) { - // unwrap() called inside an assert so that justification can be optimized - // away in production code. - goog.asserts.assertString(goog.string.Const.unwrap(justification), - 'must provide justification'); - goog.asserts.assert( - !goog.string.isEmpty(goog.string.Const.unwrap(justification)), - 'must provide non-empty justification'); - return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse( - script); -}; - - -/** - * Performs an "unchecked conversion" to SafeStyle from a plain string that is - * known to satisfy the SafeStyle type contract. - * - * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure - * that the value of {@code style} satisfies the SafeUrl type contract in all - * possible program states. - * - * - * @param {!goog.string.Const} justification A constant string explaining why - * this use of this method is safe. May include a security review ticket - * number. - * @param {string} style The string to wrap as a SafeStyle. - * @return {!goog.html.SafeStyle} The value of {@code style}, wrapped in a - * SafeStyle object. - */ -goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract = - function(justification, style) { - // unwrap() called inside an assert so that justification can be optimized - // away in production code. - goog.asserts.assertString(goog.string.Const.unwrap(justification), - 'must provide justification'); - goog.asserts.assert( - !goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), - 'must provide non-empty justification'); - return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse( - style); -}; - - -/** - * Performs an "unchecked conversion" to SafeStyleSheet from a plain string - * that is known to satisfy the SafeStyleSheet type contract. - * - * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure - * that the value of {@code styleSheet} satisfies the SafeUrl type contract in - * all possible program states. - * - * - * @param {!goog.string.Const} justification A constant string explaining why - * this use of this method is safe. May include a security review ticket - * number. - * @param {string} styleSheet The string to wrap as a SafeStyleSheet. - * @return {!goog.html.SafeStyleSheet} The value of {@code styleSheet}, wrapped - * in a SafeStyleSheet object. - */ -goog.html.uncheckedconversions. - safeStyleSheetFromStringKnownToSatisfyTypeContract = - function(justification, styleSheet) { - // unwrap() called inside an assert so that justification can be optimized - // away in production code. - goog.asserts.assertString(goog.string.Const.unwrap(justification), - 'must provide justification'); - goog.asserts.assert( - !goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), - 'must provide non-empty justification'); - return goog.html.SafeStyleSheet. - createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(styleSheet); -}; - - -/** - * Performs an "unchecked conversion" to SafeUrl from a plain string that is - * known to satisfy the SafeUrl type contract. - * - * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure - * that the value of {@code url} satisfies the SafeUrl type contract in all - * possible program states. - * - * - * @param {!goog.string.Const} justification A constant string explaining why - * this use of this method is safe. May include a security review ticket - * number. - * @param {string} url The string to wrap as a SafeUrl. - * @return {!goog.html.SafeUrl} The value of {@code url}, wrapped in a SafeUrl - * object. - */ -goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract = - function(justification, url) { - // unwrap() called inside an assert so that justification can be optimized - // away in production code. - goog.asserts.assertString(goog.string.Const.unwrap(justification), - 'must provide justification'); - goog.asserts.assert( - !goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), - 'must provide non-empty justification'); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url); -}; - - -/** - * Performs an "unchecked conversion" to TrustedResourceUrl from a plain string - * that is known to satisfy the TrustedResourceUrl type contract. - * - * IMPORTANT: Uses of this method must be carefully security-reviewed to ensure - * that the value of {@code url} satisfies the TrustedResourceUrl type contract - * in all possible program states. - * - * - * @param {!goog.string.Const} justification A constant string explaining why - * this use of this method is safe. May include a security review ticket - * number. - * @param {string} url The string to wrap as a TrustedResourceUrl. - * @return {!goog.html.TrustedResourceUrl} The value of {@code url}, wrapped in - * a TrustedResourceUrl object. - */ -goog.html.uncheckedconversions. - trustedResourceUrlFromStringKnownToSatisfyTypeContract = - function(justification, url) { - // unwrap() called inside an assert so that justification can be optimized - // away in production code. - goog.asserts.assertString(goog.string.Const.unwrap(justification), - 'must provide justification'); - goog.asserts.assert( - !goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), - 'must provide non-empty justification'); - return goog.html.TrustedResourceUrl. - createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(url); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Generics method for collection-like classes and objects. - * - * @author arv@google.com (Erik Arvidsson) - * - * This file contains functions to work with collections. It supports using - * Map, Set, Array and Object and other classes that implement collection-like - * methods. - */ - - -goog.provide('goog.structs'); - -goog.require('goog.array'); -goog.require('goog.object'); - - -// We treat an object as a dictionary if it has getKeys or it is an object that -// isn't arrayLike. - - -/** - * Returns the number of values in the collection-like object. - * @param {Object} col The collection-like object. - * @return {number} The number of values in the collection-like object. - */ -goog.structs.getCount = function(col) { - if (typeof col.getCount == 'function') { - return col.getCount(); - } - if (goog.isArrayLike(col) || goog.isString(col)) { - return col.length; - } - return goog.object.getCount(col); -}; - - -/** - * Returns the values of the collection-like object. - * @param {Object} col The collection-like object. - * @return {!Array<?>} The values in the collection-like object. - */ -goog.structs.getValues = function(col) { - if (typeof col.getValues == 'function') { - return col.getValues(); - } - if (goog.isString(col)) { - return col.split(''); - } - if (goog.isArrayLike(col)) { - var rv = []; - var l = col.length; - for (var i = 0; i < l; i++) { - rv.push(col[i]); - } - return rv; - } - return goog.object.getValues(col); -}; - - -/** - * Returns the keys of the collection. Some collections have no notion of - * keys/indexes and this function will return undefined in those cases. - * @param {Object} col The collection-like object. - * @return {!Array|undefined} The keys in the collection. - */ -goog.structs.getKeys = function(col) { - if (typeof col.getKeys == 'function') { - return col.getKeys(); - } - // if we have getValues but no getKeys we know this is a key-less collection - if (typeof col.getValues == 'function') { - return undefined; - } - if (goog.isArrayLike(col) || goog.isString(col)) { - var rv = []; - var l = col.length; - for (var i = 0; i < l; i++) { - rv.push(i); - } - return rv; - } - - return goog.object.getKeys(col); -}; - - -/** - * Whether the collection contains the given value. This is O(n) and uses - * equals (==) to test the existence. - * @param {Object} col The collection-like object. - * @param {*} val The value to check for. - * @return {boolean} True if the map contains the value. - */ -goog.structs.contains = function(col, val) { - if (typeof col.contains == 'function') { - return col.contains(val); - } - if (typeof col.containsValue == 'function') { - return col.containsValue(val); - } - if (goog.isArrayLike(col) || goog.isString(col)) { - return goog.array.contains(/** @type {!Array<?>} */ (col), val); - } - return goog.object.containsValue(col, val); -}; - - -/** - * Whether the collection is empty. - * @param {Object} col The collection-like object. - * @return {boolean} True if empty. - */ -goog.structs.isEmpty = function(col) { - if (typeof col.isEmpty == 'function') { - return col.isEmpty(); - } - - // We do not use goog.string.isEmptyOrWhitespace because here we treat the string as - // collection and as such even whitespace matters - - if (goog.isArrayLike(col) || goog.isString(col)) { - return goog.array.isEmpty(/** @type {!Array<?>} */ (col)); - } - return goog.object.isEmpty(col); -}; - - -/** - * Removes all the elements from the collection. - * @param {Object} col The collection-like object. - */ -goog.structs.clear = function(col) { - // NOTE(arv): This should not contain strings because strings are immutable - if (typeof col.clear == 'function') { - col.clear(); - } else if (goog.isArrayLike(col)) { - goog.array.clear(/** @type {goog.array.ArrayLike} */ (col)); - } else { - goog.object.clear(col); - } -}; - - -/** - * Calls a function for each value in a collection. The function takes - * three arguments; the value, the key and the collection. - * - * NOTE: This will be deprecated soon! Please use a more specific method if - * possible, e.g. goog.array.forEach, goog.object.forEach, etc. - * - * @param {S} col The collection-like object. - * @param {function(this:T,?,?,S):?} f The function to call for every value. - * This function takes - * 3 arguments (the value, the key or undefined if the collection has no - * notion of keys, and the collection) and the return value is irrelevant. - * @param {T=} opt_obj The object to be used as the value of 'this' - * within {@code f}. - * @template T,S - */ -goog.structs.forEach = function(col, f, opt_obj) { - if (typeof col.forEach == 'function') { - col.forEach(f, opt_obj); - } else if (goog.isArrayLike(col) || goog.isString(col)) { - goog.array.forEach(/** @type {!Array<?>} */ (col), f, opt_obj); - } else { - var keys = goog.structs.getKeys(col); - var values = goog.structs.getValues(col); - var l = values.length; - for (var i = 0; i < l; i++) { - f.call(opt_obj, values[i], keys && keys[i], col); - } - } -}; - - -/** - * Calls a function for every value in the collection. When a call returns true, - * adds the value to a new collection (Array is returned by default). - * - * @param {S} col The collection-like object. - * @param {function(this:T,?,?,S):boolean} f The function to call for every - * value. This function takes - * 3 arguments (the value, the key or undefined if the collection has no - * notion of keys, and the collection) and should return a Boolean. If the - * return value is true the value is added to the result collection. If it - * is false the value is not included. - * @param {T=} opt_obj The object to be used as the value of 'this' - * within {@code f}. - * @return {!Object|!Array<?>} A new collection where the passed values are - * present. If col is a key-less collection an array is returned. If col - * has keys and values a plain old JS object is returned. - * @template T,S - */ -goog.structs.filter = function(col, f, opt_obj) { - if (typeof col.filter == 'function') { - return col.filter(f, opt_obj); - } - if (goog.isArrayLike(col) || goog.isString(col)) { - return goog.array.filter(/** @type {!Array<?>} */ (col), f, opt_obj); - } - - var rv; - var keys = goog.structs.getKeys(col); - var values = goog.structs.getValues(col); - var l = values.length; - if (keys) { - rv = {}; - for (var i = 0; i < l; i++) { - if (f.call(opt_obj, values[i], keys[i], col)) { - rv[keys[i]] = values[i]; - } - } - } else { - // We should not use goog.array.filter here since we want to make sure that - // the index is undefined as well as make sure that col is passed to the - // function. - rv = []; - for (var i = 0; i < l; i++) { - if (f.call(opt_obj, values[i], undefined, col)) { - rv.push(values[i]); - } - } - } - return rv; -}; - - -/** - * Calls a function for every value in the collection and adds the result into a - * new collection (defaults to creating a new Array). - * - * @param {S} col The collection-like object. - * @param {function(this:T,?,?,S):V} f The function to call for every value. - * This function takes 3 arguments (the value, the key or undefined if the - * collection has no notion of keys, and the collection) and should return - * something. The result will be used as the value in the new collection. - * @param {T=} opt_obj The object to be used as the value of 'this' - * within {@code f}. - * @return {!Object<V>|!Array<V>} A new collection with the new values. If - * col is a key-less collection an array is returned. If col has keys and - * values a plain old JS object is returned. - * @template T,S,V - */ -goog.structs.map = function(col, f, opt_obj) { - if (typeof col.map == 'function') { - return col.map(f, opt_obj); - } - if (goog.isArrayLike(col) || goog.isString(col)) { - return goog.array.map(/** @type {!Array<?>} */ (col), f, opt_obj); - } - - var rv; - var keys = goog.structs.getKeys(col); - var values = goog.structs.getValues(col); - var l = values.length; - if (keys) { - rv = {}; - for (var i = 0; i < l; i++) { - rv[keys[i]] = f.call(opt_obj, values[i], keys[i], col); - } - } else { - // We should not use goog.array.map here since we want to make sure that - // the index is undefined as well as make sure that col is passed to the - // function. - rv = []; - for (var i = 0; i < l; i++) { - rv[i] = f.call(opt_obj, values[i], undefined, col); - } - } - return rv; -}; - - -/** - * Calls f for each value in a collection. If any call returns true this returns - * true (without checking the rest). If all returns false this returns false. - * - * @param {S} col The collection-like object. - * @param {function(this:T,?,?,S):boolean} f The function to call for every - * value. This function takes 3 arguments (the value, the key or undefined - * if the collection has no notion of keys, and the collection) and should - * return a boolean. - * @param {T=} opt_obj The object to be used as the value of 'this' - * within {@code f}. - * @return {boolean} True if any value passes the test. - * @template T,S - */ -goog.structs.some = function(col, f, opt_obj) { - if (typeof col.some == 'function') { - return col.some(f, opt_obj); - } - if (goog.isArrayLike(col) || goog.isString(col)) { - return goog.array.some(/** @type {!Array<?>} */ (col), f, opt_obj); - } - var keys = goog.structs.getKeys(col); - var values = goog.structs.getValues(col); - var l = values.length; - for (var i = 0; i < l; i++) { - if (f.call(opt_obj, values[i], keys && keys[i], col)) { - return true; - } - } - return false; -}; - - -/** - * Calls f for each value in a collection. If all calls return true this return - * true this returns true. If any returns false this returns false at this point - * and does not continue to check the remaining values. - * - * @param {S} col The collection-like object. - * @param {function(this:T,?,?,S):boolean} f The function to call for every - * value. This function takes 3 arguments (the value, the key or - * undefined if the collection has no notion of keys, and the collection) - * and should return a boolean. - * @param {T=} opt_obj The object to be used as the value of 'this' - * within {@code f}. - * @return {boolean} True if all key-value pairs pass the test. - * @template T,S - */ -goog.structs.every = function(col, f, opt_obj) { - if (typeof col.every == 'function') { - return col.every(f, opt_obj); - } - if (goog.isArrayLike(col) || goog.isString(col)) { - return goog.array.every(/** @type {!Array<?>} */ (col), f, opt_obj); - } - var keys = goog.structs.getKeys(col); - var values = goog.structs.getValues(col); - var l = values.length; - for (var i = 0; i < l; i++) { - if (!f.call(opt_obj, values[i], keys && keys[i], col)) { - return false; - } - } - return true; -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Defines the collection interface. - * - * @author nnaze@google.com (Nathan Naze) - */ - -goog.provide('goog.structs.Collection'); - - - -/** - * An interface for a collection of values. - * @interface - * @template T - */ -goog.structs.Collection = function() {}; - - -/** - * @param {T} value Value to add to the collection. - */ -goog.structs.Collection.prototype.add; - - -/** - * @param {T} value Value to remove from the collection. - */ -goog.structs.Collection.prototype.remove; - - -/** - * @param {T} value Value to find in the collection. - * @return {boolean} Whether the collection contains the specified value. - */ -goog.structs.Collection.prototype.contains; - - -/** - * @return {number} The number of values stored in the collection. - */ -goog.structs.Collection.prototype.getCount; - - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Python style iteration utilities. - * @author arv@google.com (Erik Arvidsson) - */ - - -goog.provide('goog.iter'); -goog.provide('goog.iter.Iterable'); -goog.provide('goog.iter.Iterator'); -goog.provide('goog.iter.StopIteration'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('goog.math'); - - -/** - * @typedef {goog.iter.Iterator|{length:number}|{__iterator__}} - */ -goog.iter.Iterable; - - -/** - * Singleton Error object that is used to terminate iterations. - * @const {!Error} - */ -goog.iter.StopIteration = ('StopIteration' in goog.global) ? - // For script engines that support legacy iterators. - goog.global['StopIteration'] : - { message: 'StopIteration', stack: ''}; - - - -/** - * Class/interface for iterators. An iterator needs to implement a {@code next} - * method and it needs to throw a {@code goog.iter.StopIteration} when the - * iteration passes beyond the end. Iterators have no {@code hasNext} method. - * It is recommended to always use the helper functions to iterate over the - * iterator or in case you are only targeting JavaScript 1.7 for in loops. - * @constructor - * @template VALUE - */ -goog.iter.Iterator = function() {}; - - -/** - * Returns the next value of the iteration. This will throw the object - * {@see goog.iter#StopIteration} when the iteration passes the end. - * @return {VALUE} Any object or value. - */ -goog.iter.Iterator.prototype.next = function() { - throw goog.iter.StopIteration; -}; - - -/** - * Returns the {@code Iterator} object itself. This is used to implement - * the iterator protocol in JavaScript 1.7 - * @param {boolean=} opt_keys Whether to return the keys or values. Default is - * to only return the values. This is being used by the for-in loop (true) - * and the for-each-in loop (false). Even though the param gives a hint - * about what the iterator will return there is no guarantee that it will - * return the keys when true is passed. - * @return {!goog.iter.Iterator<VALUE>} The object itself. - */ -goog.iter.Iterator.prototype.__iterator__ = function(opt_keys) { - return this; -}; - - -/** - * Returns an iterator that knows how to iterate over the values in the object. - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable If the - * object is an iterator it will be returned as is. If the object has an - * {@code __iterator__} method that will be called to get the value - * iterator. If the object is an array-like object we create an iterator - * for that. - * @return {!goog.iter.Iterator<VALUE>} An iterator that knows how to iterate - * over the values in {@code iterable}. - * @template VALUE - */ -goog.iter.toIterator = function(iterable) { - if (iterable instanceof goog.iter.Iterator) { - return iterable; - } - if (typeof iterable.__iterator__ == 'function') { - return iterable.__iterator__(false); - } - if (goog.isArrayLike(iterable)) { - var i = 0; - var newIter = new goog.iter.Iterator; - newIter.next = function() { - while (true) { - if (i >= iterable.length) { - throw goog.iter.StopIteration; - } - // Don't include deleted elements. - if (!(i in iterable)) { - i++; - continue; - } - return iterable[i++]; - } - }; - return newIter; - } - - - // TODO(arv): Should we fall back on goog.structs.getValues()? - throw Error('Not implemented'); -}; - - -/** - * Calls a function for each element in the iterator with the element of the - * iterator passed as argument. - * - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * to iterate over. If the iterable is an object {@code toIterator} will be - * called on it. - * @param {function(this:THIS,VALUE,?,!goog.iter.Iterator<VALUE>)} f - * The function to call for every element. This function takes 3 arguments - * (the element, undefined, and the iterator) and the return value is - * irrelevant. The reason for passing undefined as the second argument is - * so that the same function can be used in {@see goog.array#forEach} as - * well as others. The third parameter is of type "number" for - * arraylike objects, undefined, otherwise. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * {@code f}. - * @template THIS, VALUE - */ -goog.iter.forEach = function(iterable, f, opt_obj) { - if (goog.isArrayLike(iterable)) { - /** @preserveTry */ - try { - // NOTES: this passes the index number to the second parameter - // of the callback contrary to the documentation above. - goog.array.forEach(/** @type {goog.array.ArrayLike} */(iterable), f, - opt_obj); - } catch (ex) { - if (ex !== goog.iter.StopIteration) { - throw ex; - } - } - } else { - iterable = goog.iter.toIterator(iterable); - /** @preserveTry */ - try { - while (true) { - f.call(opt_obj, iterable.next(), undefined, iterable); - } - } catch (ex) { - if (ex !== goog.iter.StopIteration) { - throw ex; - } - } - } -}; - - -/** - * Calls a function for every element in the iterator, and if the function - * returns true adds the element to a new iterator. - * - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * to iterate over. - * @param { - * function(this:THIS,VALUE,undefined,!goog.iter.Iterator<VALUE>):boolean} f - * The function to call for every element. This function takes 3 arguments - * (the element, undefined, and the iterator) and should return a boolean. - * If the return value is true the element will be included in the returned - * iterator. If it is false the element is not included. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * {@code f}. - * @return {!goog.iter.Iterator<VALUE>} A new iterator in which only elements - * that passed the test are present. - * @template THIS, VALUE - */ -goog.iter.filter = function(iterable, f, opt_obj) { - var iterator = goog.iter.toIterator(iterable); - var newIter = new goog.iter.Iterator; - newIter.next = function() { - while (true) { - var val = iterator.next(); - if (f.call(opt_obj, val, undefined, iterator)) { - return val; - } - } - }; - return newIter; -}; - - -/** - * Calls a function for every element in the iterator, and if the function - * returns false adds the element to a new iterator. - * - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * to iterate over. - * @param { - * function(this:THIS,VALUE,undefined,!goog.iter.Iterator<VALUE>):boolean} f - * The function to call for every element. This function takes 3 arguments - * (the element, undefined, and the iterator) and should return a boolean. - * If the return value is false the element will be included in the returned - * iterator. If it is true the element is not included. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * {@code f}. - * @return {!goog.iter.Iterator<VALUE>} A new iterator in which only elements - * that did not pass the test are present. - * @template THIS, VALUE - */ -goog.iter.filterFalse = function(iterable, f, opt_obj) { - return goog.iter.filter(iterable, goog.functions.not(f), opt_obj); -}; - - -/** - * Creates a new iterator that returns the values in a range. This function - * can take 1, 2 or 3 arguments: - * <pre> - * range(5) same as range(0, 5, 1) - * range(2, 5) same as range(2, 5, 1) - * </pre> - * - * @param {number} startOrStop The stop value if only one argument is provided. - * The start value if 2 or more arguments are provided. If only one - * argument is used the start value is 0. - * @param {number=} opt_stop The stop value. If left out then the first - * argument is used as the stop value. - * @param {number=} opt_step The number to increment with between each call to - * next. This can be negative. - * @return {!goog.iter.Iterator<number>} A new iterator that returns the values - * in the range. - */ -goog.iter.range = function(startOrStop, opt_stop, opt_step) { - var start = 0; - var stop = startOrStop; - var step = opt_step || 1; - if (arguments.length > 1) { - start = startOrStop; - stop = opt_stop; - } - if (step == 0) { - throw Error('Range step argument must not be zero'); - } - - var newIter = new goog.iter.Iterator; - newIter.next = function() { - if (step > 0 && start >= stop || step < 0 && start <= stop) { - throw goog.iter.StopIteration; - } - var rv = start; - start += step; - return rv; - }; - return newIter; -}; - - -/** - * Joins the values in a iterator with a delimiter. - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * to get the values from. - * @param {string} deliminator The text to put between the values. - * @return {string} The joined value string. - * @template VALUE - */ -goog.iter.join = function(iterable, deliminator) { - return goog.iter.toArray(iterable).join(deliminator); -}; - - -/** - * For every element in the iterator call a function and return a new iterator - * with that value. - * - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterator to iterate over. - * @param { - * function(this:THIS,VALUE,undefined,!goog.iter.Iterator<VALUE>):RESULT} f - * The function to call for every element. This function takes 3 arguments - * (the element, undefined, and the iterator) and should return a new value. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * {@code f}. - * @return {!goog.iter.Iterator<RESULT>} A new iterator that returns the - * results of applying the function to each element in the original - * iterator. - * @template THIS, VALUE, RESULT - */ -goog.iter.map = function(iterable, f, opt_obj) { - var iterator = goog.iter.toIterator(iterable); - var newIter = new goog.iter.Iterator; - newIter.next = function() { - var val = iterator.next(); - return f.call(opt_obj, val, undefined, iterator); - }; - return newIter; -}; - - -/** - * Passes every element of an iterator into a function and accumulates the - * result. - * - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * to iterate over. - * @param {function(this:THIS,VALUE,VALUE):VALUE} f The function to call for - * every element. This function takes 2 arguments (the function's previous - * result or the initial value, and the value of the current element). - * function(previousValue, currentElement) : newValue. - * @param {VALUE} val The initial value to pass into the function on the first - * call. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * f. - * @return {VALUE} Result of evaluating f repeatedly across the values of - * the iterator. - * @template THIS, VALUE - */ -goog.iter.reduce = function(iterable, f, val, opt_obj) { - var rval = val; - goog.iter.forEach(iterable, function(val) { - rval = f.call(opt_obj, rval, val); - }); - return rval; -}; - - -/** - * Goes through the values in the iterator. Calls f for each of these, and if - * any of them returns true, this returns true (without checking the rest). If - * all return false this will return false. - * - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * object. - * @param { - * function(this:THIS,VALUE,undefined,!goog.iter.Iterator<VALUE>):boolean} f - * The function to call for every value. This function takes 3 arguments - * (the value, undefined, and the iterator) and should return a boolean. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * {@code f}. - * @return {boolean} true if any value passes the test. - * @template THIS, VALUE - */ -goog.iter.some = function(iterable, f, opt_obj) { - iterable = goog.iter.toIterator(iterable); - /** @preserveTry */ - try { - while (true) { - if (f.call(opt_obj, iterable.next(), undefined, iterable)) { - return true; - } - } - } catch (ex) { - if (ex !== goog.iter.StopIteration) { - throw ex; - } - } - return false; -}; - - -/** - * Goes through the values in the iterator. Calls f for each of these and if any - * of them returns false this returns false (without checking the rest). If all - * return true this will return true. - * - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * object. - * @param { - * function(this:THIS,VALUE,undefined,!goog.iter.Iterator<VALUE>):boolean} f - * The function to call for every value. This function takes 3 arguments - * (the value, undefined, and the iterator) and should return a boolean. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * {@code f}. - * @return {boolean} true if every value passes the test. - * @template THIS, VALUE - */ -goog.iter.every = function(iterable, f, opt_obj) { - iterable = goog.iter.toIterator(iterable); - /** @preserveTry */ - try { - while (true) { - if (!f.call(opt_obj, iterable.next(), undefined, iterable)) { - return false; - } - } - } catch (ex) { - if (ex !== goog.iter.StopIteration) { - throw ex; - } - } - return true; -}; - - -/** - * Takes zero or more iterables and returns one iterator that will iterate over - * them in the order chained. - * @param {...!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} var_args Any - * number of iterable objects. - * @return {!goog.iter.Iterator<VALUE>} Returns a new iterator that will - * iterate over all the given iterables' contents. - * @template VALUE - */ -goog.iter.chain = function(var_args) { - return goog.iter.chainFromIterable(arguments); -}; - - -/** - * Takes a single iterable containing zero or more iterables and returns one - * iterator that will iterate over each one in the order given. - * @see http://docs.python.org/2/library/itertools.html#itertools.chain.from_iterable - * @param {goog.iter.Iterable} iterable The iterable of iterables to chain. - * @return {!goog.iter.Iterator<VALUE>} Returns a new iterator that will - * iterate over all the contents of the iterables contained within - * {@code iterable}. - * @template VALUE - */ -goog.iter.chainFromIterable = function(iterable) { - var iterator = goog.iter.toIterator(iterable); - var iter = new goog.iter.Iterator(); - var current = null; - - iter.next = function() { - while (true) { - if (current == null) { - var it = iterator.next(); - current = goog.iter.toIterator(it); - } - try { - return current.next(); - } catch (ex) { - if (ex !== goog.iter.StopIteration) { - throw ex; - } - current = null; - } - } - }; - - return iter; -}; - - -/** - * Builds a new iterator that iterates over the original, but skips elements as - * long as a supplied function returns true. - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * object. - * @param { - * function(this:THIS,VALUE,undefined,!goog.iter.Iterator<VALUE>):boolean} f - * The function to call for every value. This function takes 3 arguments - * (the value, undefined, and the iterator) and should return a boolean. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * {@code f}. - * @return {!goog.iter.Iterator<VALUE>} A new iterator that drops elements from - * the original iterator as long as {@code f} is true. - * @template THIS, VALUE - */ -goog.iter.dropWhile = function(iterable, f, opt_obj) { - var iterator = goog.iter.toIterator(iterable); - var newIter = new goog.iter.Iterator; - var dropping = true; - newIter.next = function() { - while (true) { - var val = iterator.next(); - if (dropping && f.call(opt_obj, val, undefined, iterator)) { - continue; - } else { - dropping = false; - } - return val; - } - }; - return newIter; -}; - - -/** - * Builds a new iterator that iterates over the original, but only as long as a - * supplied function returns true. - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * object. - * @param { - * function(this:THIS,VALUE,undefined,!goog.iter.Iterator<VALUE>):boolean} f - * The function to call for every value. This function takes 3 arguments - * (the value, undefined, and the iterator) and should return a boolean. - * @param {THIS=} opt_obj This is used as the 'this' object in f when called. - * @return {!goog.iter.Iterator<VALUE>} A new iterator that keeps elements in - * the original iterator as long as the function is true. - * @template THIS, VALUE - */ -goog.iter.takeWhile = function(iterable, f, opt_obj) { - var iterator = goog.iter.toIterator(iterable); - var iter = new goog.iter.Iterator(); - iter.next = function() { - var val = iterator.next(); - if (f.call(opt_obj, val, undefined, iterator)) { - return val; - } - throw goog.iter.StopIteration; - }; - return iter; -}; - - -/** - * Converts the iterator to an array - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterator - * to convert to an array. - * @return {!Array<VALUE>} An array of the elements the iterator iterates over. - * @template VALUE - */ -goog.iter.toArray = function(iterable) { - // Fast path for array-like. - if (goog.isArrayLike(iterable)) { - return goog.array.toArray(/** @type {!goog.array.ArrayLike} */(iterable)); - } - iterable = goog.iter.toIterator(iterable); - var array = []; - goog.iter.forEach(iterable, function(val) { - array.push(val); - }); - return array; -}; - - -/** - * Iterates over two iterables and returns true if they contain the same - * sequence of elements and have the same length. - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable1 The first - * iterable object. - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable2 The second - * iterable object. - * @param {function(VALUE,VALUE):boolean=} opt_equalsFn Optional comparison - * function. - * Should take two arguments to compare, and return true if the arguments - * are equal. Defaults to {@link goog.array.defaultCompareEquality} which - * compares the elements using the built-in '===' operator. - * @return {boolean} true if the iterables contain the same sequence of elements - * and have the same length. - * @template VALUE - */ -goog.iter.equals = function(iterable1, iterable2, opt_equalsFn) { - var fillValue = {}; - var pairs = goog.iter.zipLongest(fillValue, iterable1, iterable2); - var equalsFn = opt_equalsFn || goog.array.defaultCompareEquality; - return goog.iter.every(pairs, function(pair) { - return equalsFn(pair[0], pair[1]); - }); -}; - - -/** - * Advances the iterator to the next position, returning the given default value - * instead of throwing an exception if the iterator has no more entries. - * @param {goog.iter.Iterator<VALUE>|goog.iter.Iterable} iterable The iterable - * object. - * @param {VALUE} defaultValue The value to return if the iterator is empty. - * @return {VALUE} The next item in the iteration, or defaultValue if the - * iterator was empty. - * @template VALUE - */ -goog.iter.nextOrValue = function(iterable, defaultValue) { - try { - return goog.iter.toIterator(iterable).next(); - } catch (e) { - if (e != goog.iter.StopIteration) { - throw e; - } - return defaultValue; - } -}; - - -/** - * Cartesian product of zero or more sets. Gives an iterator that gives every - * combination of one element chosen from each set. For example, - * ([1, 2], [3, 4]) gives ([1, 3], [1, 4], [2, 3], [2, 4]). - * @see http://docs.python.org/library/itertools.html#itertools.product - * @param {...!goog.array.ArrayLike<VALUE>} var_args Zero or more sets, as - * arrays. - * @return {!goog.iter.Iterator<!Array<VALUE>>} An iterator that gives each - * n-tuple (as an array). - * @template VALUE - */ -goog.iter.product = function(var_args) { - var someArrayEmpty = goog.array.some(arguments, function(arr) { - return !arr.length; - }); - - // An empty set in a cartesian product gives an empty set. - if (someArrayEmpty || !arguments.length) { - return new goog.iter.Iterator(); - } - - var iter = new goog.iter.Iterator(); - var arrays = arguments; - - // The first indices are [0, 0, ...] - var indicies = goog.array.repeat(0, arrays.length); - - iter.next = function() { - - if (indicies) { - var retVal = goog.array.map(indicies, function(valueIndex, arrayIndex) { - return arrays[arrayIndex][valueIndex]; - }); - - // Generate the next-largest indices for the next call. - // Increase the rightmost index. If it goes over, increase the next - // rightmost (like carry-over addition). - for (var i = indicies.length - 1; i >= 0; i--) { - // Assertion prevents compiler warning below. - goog.asserts.assert(indicies); - if (indicies[i] < arrays[i].length - 1) { - indicies[i]++; - break; - } - - // We're at the last indices (the last element of every array), so - // the iteration is over on the next call. - if (i == 0) { - indicies = null; - break; - } - // Reset the index in this column and loop back to increment the - // next one. - indicies[i] = 0; - } - return retVal; - } - - throw goog.iter.StopIteration; - }; - - return iter; -}; - - -/** - * Create an iterator to cycle over the iterable's elements indefinitely. - * For example, ([1, 2, 3]) would return : 1, 2, 3, 1, 2, 3, ... - * @see: http://docs.python.org/library/itertools.html#itertools.cycle. - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable object. - * @return {!goog.iter.Iterator<VALUE>} An iterator that iterates indefinitely - * over the values in {@code iterable}. - * @template VALUE - */ -goog.iter.cycle = function(iterable) { - var baseIterator = goog.iter.toIterator(iterable); - - // We maintain a cache to store the iterable elements as we iterate - // over them. The cache is used to return elements once we have - // iterated over the iterable once. - var cache = []; - var cacheIndex = 0; - - var iter = new goog.iter.Iterator(); - - // This flag is set after the iterable is iterated over once - var useCache = false; - - iter.next = function() { - var returnElement = null; - - // Pull elements off the original iterator if not using cache - if (!useCache) { - try { - // Return the element from the iterable - returnElement = baseIterator.next(); - cache.push(returnElement); - return returnElement; - } catch (e) { - // If an exception other than StopIteration is thrown - // or if there are no elements to iterate over (the iterable was empty) - // throw an exception - if (e != goog.iter.StopIteration || goog.array.isEmpty(cache)) { - throw e; - } - // set useCache to true after we know that a 'StopIteration' exception - // was thrown and the cache is not empty (to handle the 'empty iterable' - // use case) - useCache = true; - } - } - - returnElement = cache[cacheIndex]; - cacheIndex = (cacheIndex + 1) % cache.length; - - return returnElement; - }; - - return iter; -}; - - -/** - * Creates an iterator that counts indefinitely from a starting value. - * @see http://docs.python.org/2/library/itertools.html#itertools.count - * @param {number=} opt_start The starting value. Default is 0. - * @param {number=} opt_step The number to increment with between each call to - * next. Negative and floating point numbers are allowed. Default is 1. - * @return {!goog.iter.Iterator<number>} A new iterator that returns the values - * in the series. - */ -goog.iter.count = function(opt_start, opt_step) { - var counter = opt_start || 0; - var step = goog.isDef(opt_step) ? opt_step : 1; - var iter = new goog.iter.Iterator(); - - iter.next = function() { - var returnValue = counter; - counter += step; - return returnValue; - }; - - return iter; -}; - - -/** - * Creates an iterator that returns the same object or value repeatedly. - * @param {VALUE} value Any object or value to repeat. - * @return {!goog.iter.Iterator<VALUE>} A new iterator that returns the - * repeated value. - * @template VALUE - */ -goog.iter.repeat = function(value) { - var iter = new goog.iter.Iterator(); - - iter.next = goog.functions.constant(value); - - return iter; -}; - - -/** - * Creates an iterator that returns running totals from the numbers in - * {@code iterable}. For example, the array {@code [1, 2, 3, 4, 5]} yields - * {@code 1 -> 3 -> 6 -> 10 -> 15}. - * @see http://docs.python.org/3.2/library/itertools.html#itertools.accumulate - * @param {!goog.iter.Iterable<number>} iterable The iterable of numbers to - * accumulate. - * @return {!goog.iter.Iterator<number>} A new iterator that returns the - * numbers in the series. - */ -goog.iter.accumulate = function(iterable) { - var iterator = goog.iter.toIterator(iterable); - var total = 0; - var iter = new goog.iter.Iterator(); - - iter.next = function() { - total += iterator.next(); - return total; - }; - - return iter; -}; - - -/** - * Creates an iterator that returns arrays containing the ith elements from the - * provided iterables. The returned arrays will be the same size as the number - * of iterables given in {@code var_args}. Once the shortest iterable is - * exhausted, subsequent calls to {@code next()} will throw - * {@code goog.iter.StopIteration}. - * @see http://docs.python.org/2/library/itertools.html#itertools.izip - * @param {...!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} var_args Any - * number of iterable objects. - * @return {!goog.iter.Iterator<!Array<VALUE>>} A new iterator that returns - * arrays of elements from the provided iterables. - * @template VALUE - */ -goog.iter.zip = function(var_args) { - var args = arguments; - var iter = new goog.iter.Iterator(); - - if (args.length > 0) { - var iterators = goog.array.map(args, goog.iter.toIterator); - iter.next = function() { - var arr = goog.array.map(iterators, function(it) { - return it.next(); - }); - return arr; - }; - } - - return iter; -}; - - -/** - * Creates an iterator that returns arrays containing the ith elements from the - * provided iterables. The returned arrays will be the same size as the number - * of iterables given in {@code var_args}. Shorter iterables will be extended - * with {@code fillValue}. Once the longest iterable is exhausted, subsequent - * calls to {@code next()} will throw {@code goog.iter.StopIteration}. - * @see http://docs.python.org/2/library/itertools.html#itertools.izip_longest - * @param {VALUE} fillValue The object or value used to fill shorter iterables. - * @param {...!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} var_args Any - * number of iterable objects. - * @return {!goog.iter.Iterator<!Array<VALUE>>} A new iterator that returns - * arrays of elements from the provided iterables. - * @template VALUE - */ -goog.iter.zipLongest = function(fillValue, var_args) { - var args = goog.array.slice(arguments, 1); - var iter = new goog.iter.Iterator(); - - if (args.length > 0) { - var iterators = goog.array.map(args, goog.iter.toIterator); - - iter.next = function() { - var iteratorsHaveValues = false; // false when all iterators are empty. - var arr = goog.array.map(iterators, function(it) { - var returnValue; - try { - returnValue = it.next(); - // Iterator had a value, so we've not exhausted the iterators. - // Set flag accordingly. - iteratorsHaveValues = true; - } catch (ex) { - if (ex !== goog.iter.StopIteration) { - throw ex; - } - returnValue = fillValue; - } - return returnValue; - }); - - if (!iteratorsHaveValues) { - throw goog.iter.StopIteration; - } - return arr; - }; - } - - return iter; -}; - - -/** - * Creates an iterator that filters {@code iterable} based on a series of - * {@code selectors}. On each call to {@code next()}, one item is taken from - * both the {@code iterable} and {@code selectors} iterators. If the item from - * {@code selectors} evaluates to true, the item from {@code iterable} is given. - * Otherwise, it is skipped. Once either {@code iterable} or {@code selectors} - * is exhausted, subsequent calls to {@code next()} will throw - * {@code goog.iter.StopIteration}. - * @see http://docs.python.org/2/library/itertools.html#itertools.compress - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to filter. - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} selectors An - * iterable of items to be evaluated in a boolean context to determine if - * the corresponding element in {@code iterable} should be included in the - * result. - * @return {!goog.iter.Iterator<VALUE>} A new iterator that returns the - * filtered values. - * @template VALUE - */ -goog.iter.compress = function(iterable, selectors) { - var selectorIterator = goog.iter.toIterator(selectors); - - return goog.iter.filter(iterable, function() { - return !!selectorIterator.next(); - }); -}; - - - -/** - * Implements the {@code goog.iter.groupBy} iterator. - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to group. - * @param {function(...VALUE): KEY=} opt_keyFunc Optional function for - * determining the key value for each group in the {@code iterable}. Default - * is the identity function. - * @constructor - * @extends {goog.iter.Iterator<!Array<?>>} - * @template KEY, VALUE - * @private - */ -goog.iter.GroupByIterator_ = function(iterable, opt_keyFunc) { - - /** - * The iterable to group, coerced to an iterator. - * @type {!goog.iter.Iterator} - */ - this.iterator = goog.iter.toIterator(iterable); - - /** - * A function for determining the key value for each element in the iterable. - * If no function is provided, the identity function is used and returns the - * element unchanged. - * @type {function(...VALUE): KEY} - */ - this.keyFunc = opt_keyFunc || goog.functions.identity; - - /** - * The target key for determining the start of a group. - * @type {KEY} - */ - this.targetKey; - - /** - * The current key visited during iteration. - * @type {KEY} - */ - this.currentKey; - - /** - * The current value being added to the group. - * @type {VALUE} - */ - this.currentValue; -}; -goog.inherits(goog.iter.GroupByIterator_, goog.iter.Iterator); - - -/** @override */ -goog.iter.GroupByIterator_.prototype.next = function() { - while (this.currentKey == this.targetKey) { - this.currentValue = this.iterator.next(); // Exits on StopIteration - this.currentKey = this.keyFunc(this.currentValue); - } - this.targetKey = this.currentKey; - return [this.currentKey, this.groupItems_(this.targetKey)]; -}; - - -/** - * Performs the grouping of objects using the given key. - * @param {KEY} targetKey The target key object for the group. - * @return {!Array<VALUE>} An array of grouped objects. - * @private - */ -goog.iter.GroupByIterator_.prototype.groupItems_ = function(targetKey) { - var arr = []; - while (this.currentKey == targetKey) { - arr.push(this.currentValue); - try { - this.currentValue = this.iterator.next(); - } catch (ex) { - if (ex !== goog.iter.StopIteration) { - throw ex; - } - break; - } - this.currentKey = this.keyFunc(this.currentValue); - } - return arr; -}; - - -/** - * Creates an iterator that returns arrays containing elements from the - * {@code iterable} grouped by a key value. For iterables with repeated - * elements (i.e. sorted according to a particular key function), this function - * has a {@code uniq}-like effect. For example, grouping the array: - * {@code [A, B, B, C, C, A]} produces - * {@code [A, [A]], [B, [B, B]], [C, [C, C]], [A, [A]]}. - * @see http://docs.python.org/2/library/itertools.html#itertools.groupby - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to group. - * @param {function(...VALUE): KEY=} opt_keyFunc Optional function for - * determining the key value for each group in the {@code iterable}. Default - * is the identity function. - * @return {!goog.iter.Iterator<!Array<?>>} A new iterator that returns - * arrays of consecutive key and groups. - * @template KEY, VALUE - */ -goog.iter.groupBy = function(iterable, opt_keyFunc) { - return new goog.iter.GroupByIterator_(iterable, opt_keyFunc); -}; - - -/** - * Gives an iterator that gives the result of calling the given function - * <code>f</code> with the arguments taken from the next element from - * <code>iterable</code> (the elements are expected to also be iterables). - * - * Similar to {@see goog.iter#map} but allows the function to accept multiple - * arguments from the iterable. - * - * @param {!goog.iter.Iterable<!goog.iter.Iterable>} iterable The iterable of - * iterables to iterate over. - * @param {function(this:THIS,...*):RESULT} f The function to call for every - * element. This function takes N+2 arguments, where N represents the - * number of items from the next element of the iterable. The two - * additional arguments passed to the function are undefined and the - * iterator itself. The function should return a new value. - * @param {THIS=} opt_obj The object to be used as the value of 'this' within - * {@code f}. - * @return {!goog.iter.Iterator<RESULT>} A new iterator that returns the - * results of applying the function to each element in the original - * iterator. - * @template THIS, RESULT - */ -goog.iter.starMap = function(iterable, f, opt_obj) { - var iterator = goog.iter.toIterator(iterable); - var iter = new goog.iter.Iterator(); - - iter.next = function() { - var args = goog.iter.toArray(iterator.next()); - return f.apply(opt_obj, goog.array.concat(args, undefined, iterator)); - }; - - return iter; -}; - - -/** - * Returns an array of iterators each of which can iterate over the values in - * {@code iterable} without advancing the others. - * @see http://docs.python.org/2/library/itertools.html#itertools.tee - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to tee. - * @param {number=} opt_num The number of iterators to create. Default is 2. - * @return {!Array<goog.iter.Iterator<VALUE>>} An array of iterators. - * @template VALUE - */ -goog.iter.tee = function(iterable, opt_num) { - var iterator = goog.iter.toIterator(iterable); - var num = goog.isNumber(opt_num) ? opt_num : 2; - var buffers = goog.array.map(goog.array.range(num), function() { - return []; - }); - - var addNextIteratorValueToBuffers = function() { - var val = iterator.next(); - goog.array.forEach(buffers, function(buffer) { - buffer.push(val); - }); - }; - - var createIterator = function(buffer) { - // Each tee'd iterator has an associated buffer (initially empty). When a - // tee'd iterator's buffer is empty, it calls - // addNextIteratorValueToBuffers(), adding the next value to all tee'd - // iterators' buffers, and then returns that value. This allows each - // iterator to be advanced independently. - var iter = new goog.iter.Iterator(); - - iter.next = function() { - if (goog.array.isEmpty(buffer)) { - addNextIteratorValueToBuffers(); - } - goog.asserts.assert(!goog.array.isEmpty(buffer)); - return buffer.shift(); - }; - - return iter; - }; - - return goog.array.map(buffers, createIterator); -}; - - -/** - * Creates an iterator that returns arrays containing a count and an element - * obtained from the given {@code iterable}. - * @see http://docs.python.org/2/library/functions.html#enumerate - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to enumerate. - * @param {number=} opt_start Optional starting value. Default is 0. - * @return {!goog.iter.Iterator<!Array<?>>} A new iterator containing - * count/item pairs. - * @template VALUE - */ -goog.iter.enumerate = function(iterable, opt_start) { - return goog.iter.zip(goog.iter.count(opt_start), iterable); -}; - - -/** - * Creates an iterator that returns the first {@code limitSize} elements from an - * iterable. If this number is greater than the number of elements in the - * iterable, all the elements are returned. - * @see http://goo.gl/V0sihp Inspired by the limit iterator in Guava. - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to limit. - * @param {number} limitSize The maximum number of elements to return. - * @return {!goog.iter.Iterator<VALUE>} A new iterator containing - * {@code limitSize} elements. - * @template VALUE - */ -goog.iter.limit = function(iterable, limitSize) { - goog.asserts.assert(goog.math.isInt(limitSize) && limitSize >= 0); - - var iterator = goog.iter.toIterator(iterable); - - var iter = new goog.iter.Iterator(); - var remaining = limitSize; - - iter.next = function() { - if (remaining-- > 0) { - return iterator.next(); - } - throw goog.iter.StopIteration; - }; - - return iter; -}; - - -/** - * Creates an iterator that is advanced {@code count} steps ahead. Consumed - * values are silently discarded. If {@code count} is greater than the number - * of elements in {@code iterable}, an empty iterator is returned. Subsequent - * calls to {@code next()} will throw {@code goog.iter.StopIteration}. - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to consume. - * @param {number} count The number of elements to consume from the iterator. - * @return {!goog.iter.Iterator<VALUE>} An iterator advanced zero or more steps - * ahead. - * @template VALUE - */ -goog.iter.consume = function(iterable, count) { - goog.asserts.assert(goog.math.isInt(count) && count >= 0); - - var iterator = goog.iter.toIterator(iterable); - - while (count-- > 0) { - goog.iter.nextOrValue(iterator, null); - } - - return iterator; -}; - - -/** - * Creates an iterator that returns a range of elements from an iterable. - * Similar to {@see goog.array#slice} but does not support negative indexes. - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to slice. - * @param {number} start The index of the first element to return. - * @param {number=} opt_end The index after the last element to return. If - * defined, must be greater than or equal to {@code start}. - * @return {!goog.iter.Iterator<VALUE>} A new iterator containing a slice of - * the original. - * @template VALUE - */ -goog.iter.slice = function(iterable, start, opt_end) { - goog.asserts.assert(goog.math.isInt(start) && start >= 0); - - var iterator = goog.iter.consume(iterable, start); - - if (goog.isNumber(opt_end)) { - goog.asserts.assert(goog.math.isInt(opt_end) && opt_end >= start); - iterator = goog.iter.limit(iterator, opt_end - start /* limitSize */); - } - - return iterator; -}; - - -/** - * Checks an array for duplicate elements. - * @param {Array<VALUE>|goog.array.ArrayLike} arr The array to check for - * duplicates. - * @return {boolean} True, if the array contains duplicates, false otherwise. - * @private - * @template VALUE - */ -// TODO(user): Consider moving this into goog.array as a public function. -goog.iter.hasDuplicates_ = function(arr) { - var deduped = []; - goog.array.removeDuplicates(arr, deduped); - return arr.length != deduped.length; -}; - - -/** - * Creates an iterator that returns permutations of elements in - * {@code iterable}. - * - * Permutations are obtained by taking the Cartesian product of - * {@code opt_length} iterables and filtering out those with repeated - * elements. For example, the permutations of {@code [1,2,3]} are - * {@code [[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]}. - * @see http://docs.python.org/2/library/itertools.html#itertools.permutations - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable from which to generate permutations. - * @param {number=} opt_length Length of each permutation. If omitted, defaults - * to the length of {@code iterable}. - * @return {!goog.iter.Iterator<!Array<VALUE>>} A new iterator containing the - * permutations of {@code iterable}. - * @template VALUE - */ -goog.iter.permutations = function(iterable, opt_length) { - var elements = goog.iter.toArray(iterable); - var length = goog.isNumber(opt_length) ? opt_length : elements.length; - - var sets = goog.array.repeat(elements, length); - var product = goog.iter.product.apply(undefined, sets); - - return goog.iter.filter(product, function(arr) { - return !goog.iter.hasDuplicates_(arr); - }); -}; - - -/** - * Creates an iterator that returns combinations of elements from - * {@code iterable}. - * - * Combinations are obtained by taking the {@see goog.iter#permutations} of - * {@code iterable} and filtering those whose elements appear in the order they - * are encountered in {@code iterable}. For example, the 3-length combinations - * of {@code [0,1,2,3]} are {@code [[0,1,2], [0,1,3], [0,2,3], [1,2,3]]}. - * @see http://docs.python.org/2/library/itertools.html#itertools.combinations - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable from which to generate combinations. - * @param {number} length The length of each combination. - * @return {!goog.iter.Iterator<!Array<VALUE>>} A new iterator containing - * combinations from the {@code iterable}. - * @template VALUE - */ -goog.iter.combinations = function(iterable, length) { - var elements = goog.iter.toArray(iterable); - var indexes = goog.iter.range(elements.length); - var indexIterator = goog.iter.permutations(indexes, length); - // sortedIndexIterator will now give arrays of with the given length that - // indicate what indexes into "elements" should be returned on each iteration. - var sortedIndexIterator = goog.iter.filter(indexIterator, function(arr) { - return goog.array.isSorted(arr); - }); - - var iter = new goog.iter.Iterator(); - - function getIndexFromElements(index) { - return elements[index]; - } - - iter.next = function() { - return goog.array.map(sortedIndexIterator.next(), getIndexFromElements); - }; - - return iter; -}; - - -/** - * Creates an iterator that returns combinations of elements from - * {@code iterable}, with repeated elements possible. - * - * Combinations are obtained by taking the Cartesian product of {@code length} - * iterables and filtering those whose elements appear in the order they are - * encountered in {@code iterable}. For example, the 2-length combinations of - * {@code [1,2,3]} are {@code [[1,1], [1,2], [1,3], [2,2], [2,3], [3,3]]}. - * @see http://docs.python.org/2/library/itertools.html#itertools.combinations_with_replacement - * @see http://en.wikipedia.org/wiki/Combination#Number_of_combinations_with_repetition - * @param {!goog.iter.Iterator<VALUE>|!goog.iter.Iterable} iterable The - * iterable to combine. - * @param {number} length The length of each combination. - * @return {!goog.iter.Iterator<!Array<VALUE>>} A new iterator containing - * combinations from the {@code iterable}. - * @template VALUE - */ -goog.iter.combinationsWithReplacement = function(iterable, length) { - var elements = goog.iter.toArray(iterable); - var indexes = goog.array.range(elements.length); - var sets = goog.array.repeat(indexes, length); - var indexIterator = goog.iter.product.apply(undefined, sets); - // sortedIndexIterator will now give arrays of with the given length that - // indicate what indexes into "elements" should be returned on each iteration. - var sortedIndexIterator = goog.iter.filter(indexIterator, function(arr) { - return goog.array.isSorted(arr); - }); - - var iter = new goog.iter.Iterator(); - - function getIndexFromElements(index) { - return elements[index]; - } - - iter.next = function() { - return goog.array.map( - /** @type {!Array<number>} */ - (sortedIndexIterator.next()), getIndexFromElements); - }; - - return iter; -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Datastructure: Hash Map. - * - * @author arv@google.com (Erik Arvidsson) - * - * This file contains an implementation of a Map structure. It implements a lot - * of the methods used in goog.structs so those functions work on hashes. This - * is best suited for complex key types. For simple keys such as numbers and - * strings consider using the lighter-weight utilities in goog.object. - */ - - -goog.provide('goog.structs.Map'); - -goog.require('goog.iter.Iterator'); -goog.require('goog.iter.StopIteration'); -goog.require('goog.object'); - - - -/** - * Class for Hash Map datastructure. - * @param {*=} opt_map Map or Object to initialize the map with. - * @param {...*} var_args If 2 or more arguments are present then they - * will be used as key-value pairs. - * @constructor - * @template K, V - */ -goog.structs.Map = function(opt_map, var_args) { - - /** - * Underlying JS object used to implement the map. - * @private {!Object} - */ - this.map_ = {}; - - /** - * An array of keys. This is necessary for two reasons: - * 1. Iterating the keys using for (var key in this.map_) allocates an - * object for every key in IE which is really bad for IE6 GC perf. - * 2. Without a side data structure, we would need to escape all the keys - * as that would be the only way we could tell during iteration if the - * key was an internal key or a property of the object. - * - * This array can contain deleted keys so it's necessary to check the map - * as well to see if the key is still in the map (this doesn't require a - * memory allocation in IE). - * @private {!Array<string>} - */ - this.keys_ = []; - - /** - * The number of key value pairs in the map. - * @private {number} - */ - this.count_ = 0; - - /** - * Version used to detect changes while iterating. - * @private {number} - */ - this.version_ = 0; - - var argLength = arguments.length; - - if (argLength > 1) { - if (argLength % 2) { - throw Error('Uneven number of arguments'); - } - for (var i = 0; i < argLength; i += 2) { - this.set(arguments[i], arguments[i + 1]); - } - } else if (opt_map) { - this.addAll(/** @type {Object} */ (opt_map)); - } -}; - - -/** - * @return {number} The number of key-value pairs in the map. - */ -goog.structs.Map.prototype.getCount = function() { - return this.count_; -}; - - -/** - * Returns the values of the map. - * @return {!Array<V>} The values in the map. - */ -goog.structs.Map.prototype.getValues = function() { - this.cleanupKeysArray_(); - - var rv = []; - for (var i = 0; i < this.keys_.length; i++) { - var key = this.keys_[i]; - rv.push(this.map_[key]); - } - return rv; -}; - - -/** - * Returns the keys of the map. - * @return {!Array<string>} Array of string values. - */ -goog.structs.Map.prototype.getKeys = function() { - this.cleanupKeysArray_(); - return /** @type {!Array<string>} */ (this.keys_.concat()); -}; - - -/** - * Whether the map contains the given key. - * @param {*} key The key to check for. - * @return {boolean} Whether the map contains the key. - */ -goog.structs.Map.prototype.containsKey = function(key) { - return goog.structs.Map.hasKey_(this.map_, key); -}; - - -/** - * Whether the map contains the given value. This is O(n). - * @param {V} val The value to check for. - * @return {boolean} Whether the map contains the value. - */ -goog.structs.Map.prototype.containsValue = function(val) { - for (var i = 0; i < this.keys_.length; i++) { - var key = this.keys_[i]; - if (goog.structs.Map.hasKey_(this.map_, key) && this.map_[key] == val) { - return true; - } - } - return false; -}; - - -/** - * Whether this map is equal to the argument map. - * @param {goog.structs.Map} otherMap The map against which to test equality. - * @param {function(V, V): boolean=} opt_equalityFn Optional equality function - * to test equality of values. If not specified, this will test whether - * the values contained in each map are identical objects. - * @return {boolean} Whether the maps are equal. - */ -goog.structs.Map.prototype.equals = function(otherMap, opt_equalityFn) { - if (this === otherMap) { - return true; - } - - if (this.count_ != otherMap.getCount()) { - return false; - } - - var equalityFn = opt_equalityFn || goog.structs.Map.defaultEquals; - - this.cleanupKeysArray_(); - for (var key, i = 0; key = this.keys_[i]; i++) { - if (!equalityFn(this.get(key), otherMap.get(key))) { - return false; - } - } - - return true; -}; - - -/** - * Default equality test for values. - * @param {*} a The first value. - * @param {*} b The second value. - * @return {boolean} Whether a and b reference the same object. - */ -goog.structs.Map.defaultEquals = function(a, b) { - return a === b; -}; - - -/** - * @return {boolean} Whether the map is empty. - */ -goog.structs.Map.prototype.isEmpty = function() { - return this.count_ == 0; -}; - - -/** - * Removes all key-value pairs from the map. - */ -goog.structs.Map.prototype.clear = function() { - this.map_ = {}; - this.keys_.length = 0; - this.count_ = 0; - this.version_ = 0; -}; - - -/** - * Removes a key-value pair based on the key. This is O(logN) amortized due to - * updating the keys array whenever the count becomes half the size of the keys - * in the keys array. - * @param {*} key The key to remove. - * @return {boolean} Whether object was removed. - */ -goog.structs.Map.prototype.remove = function(key) { - if (goog.structs.Map.hasKey_(this.map_, key)) { - delete this.map_[key]; - this.count_--; - this.version_++; - - // clean up the keys array if the threshhold is hit - if (this.keys_.length > 2 * this.count_) { - this.cleanupKeysArray_(); - } - - return true; - } - return false; -}; - - -/** - * Cleans up the temp keys array by removing entries that are no longer in the - * map. - * @private - */ -goog.structs.Map.prototype.cleanupKeysArray_ = function() { - if (this.count_ != this.keys_.length) { - // First remove keys that are no longer in the map. - var srcIndex = 0; - var destIndex = 0; - while (srcIndex < this.keys_.length) { - var key = this.keys_[srcIndex]; - if (goog.structs.Map.hasKey_(this.map_, key)) { - this.keys_[destIndex++] = key; - } - srcIndex++; - } - this.keys_.length = destIndex; - } - - if (this.count_ != this.keys_.length) { - // If the count still isn't correct, that means we have duplicates. This can - // happen when the same key is added and removed multiple times. Now we have - // to allocate one extra Object to remove the duplicates. This could have - // been done in the first pass, but in the common case, we can avoid - // allocating an extra object by only doing this when necessary. - var seen = {}; - var srcIndex = 0; - var destIndex = 0; - while (srcIndex < this.keys_.length) { - var key = this.keys_[srcIndex]; - if (!(goog.structs.Map.hasKey_(seen, key))) { - this.keys_[destIndex++] = key; - seen[key] = 1; - } - srcIndex++; - } - this.keys_.length = destIndex; - } -}; - - -/** - * Returns the value for the given key. If the key is not found and the default - * value is not given this will return {@code undefined}. - * @param {*} key The key to get the value for. - * @param {DEFAULT=} opt_val The value to return if no item is found for the - * given key, defaults to undefined. - * @return {V|DEFAULT} The value for the given key. - * @template DEFAULT - */ -goog.structs.Map.prototype.get = function(key, opt_val) { - if (goog.structs.Map.hasKey_(this.map_, key)) { - return this.map_[key]; - } - return opt_val; -}; - - -/** - * Adds a key-value pair to the map. - * @param {*} key The key. - * @param {V} value The value to add. - * @return {*} Some subclasses return a value. - */ -goog.structs.Map.prototype.set = function(key, value) { - if (!(goog.structs.Map.hasKey_(this.map_, key))) { - this.count_++; - this.keys_.push(key); - // Only change the version if we add a new key. - this.version_++; - } - this.map_[key] = value; -}; - - -/** - * Adds multiple key-value pairs from another goog.structs.Map or Object. - * @param {Object} map Object containing the data to add. - */ -goog.structs.Map.prototype.addAll = function(map) { - var keys, values; - if (map instanceof goog.structs.Map) { - keys = map.getKeys(); - values = map.getValues(); - } else { - keys = goog.object.getKeys(map); - values = goog.object.getValues(map); - } - // we could use goog.array.forEach here but I don't want to introduce that - // dependency just for this. - for (var i = 0; i < keys.length; i++) { - this.set(keys[i], values[i]); - } -}; - - -/** - * Calls the given function on each entry in the map. - * @param {function(this:T, V, K, goog.structs.Map<K,V>)} f - * @param {T=} opt_obj The value of "this" inside f. - * @template T - */ -goog.structs.Map.prototype.forEach = function(f, opt_obj) { - var keys = this.getKeys(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = this.get(key); - f.call(opt_obj, value, key, this); - } -}; - - -/** - * Clones a map and returns a new map. - * @return {!goog.structs.Map} A new map with the same key-value pairs. - */ -goog.structs.Map.prototype.clone = function() { - return new goog.structs.Map(this); -}; - - -/** - * Returns a new map in which all the keys and values are interchanged - * (keys become values and values become keys). If multiple keys map to the - * same value, the chosen transposed value is implementation-dependent. - * - * It acts very similarly to {goog.object.transpose(Object)}. - * - * @return {!goog.structs.Map} The transposed map. - */ -goog.structs.Map.prototype.transpose = function() { - var transposed = new goog.structs.Map(); - for (var i = 0; i < this.keys_.length; i++) { - var key = this.keys_[i]; - var value = this.map_[key]; - transposed.set(value, key); - } - - return transposed; -}; - - -/** - * @return {!Object} Object representation of the map. - */ -goog.structs.Map.prototype.toObject = function() { - this.cleanupKeysArray_(); - var obj = {}; - for (var i = 0; i < this.keys_.length; i++) { - var key = this.keys_[i]; - obj[key] = this.map_[key]; - } - return obj; -}; - - -/** - * Returns an iterator that iterates over the keys in the map. Removal of keys - * while iterating might have undesired side effects. - * @return {!goog.iter.Iterator} An iterator over the keys in the map. - */ -goog.structs.Map.prototype.getKeyIterator = function() { - return this.__iterator__(true); -}; - - -/** - * Returns an iterator that iterates over the values in the map. Removal of - * keys while iterating might have undesired side effects. - * @return {!goog.iter.Iterator} An iterator over the values in the map. - */ -goog.structs.Map.prototype.getValueIterator = function() { - return this.__iterator__(false); -}; - - -/** - * Returns an iterator that iterates over the values or the keys in the map. - * This throws an exception if the map was mutated since the iterator was - * created. - * @param {boolean=} opt_keys True to iterate over the keys. False to iterate - * over the values. The default value is false. - * @return {!goog.iter.Iterator} An iterator over the values or keys in the map. - */ -goog.structs.Map.prototype.__iterator__ = function(opt_keys) { - // Clean up keys to minimize the risk of iterating over dead keys. - this.cleanupKeysArray_(); - - var i = 0; - var version = this.version_; - var selfObj = this; - - var newIter = new goog.iter.Iterator; - newIter.next = function() { - if (version != selfObj.version_) { - throw Error('The map has changed since the iterator was created'); - } - if (i >= selfObj.keys_.length) { - throw goog.iter.StopIteration; - } - var key = selfObj.keys_[i++]; - return opt_keys ? key : selfObj.map_[key]; - }; - return newIter; -}; - - -/** - * Safe way to test for hasOwnProperty. It even allows testing for - * 'hasOwnProperty'. - * @param {Object} obj The object to test for presence of the given key. - * @param {*} key The key to check for. - * @return {boolean} Whether the object has the key. - * @private - */ -goog.structs.Map.hasKey_ = function(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Datastructure: Set. - * - * @author arv@google.com (Erik Arvidsson) - * - * This class implements a set data structure. Adding and removing is O(1). It - * supports both object and primitive values. Be careful because you can add - * both 1 and new Number(1), because these are not the same. You can even add - * multiple new Number(1) because these are not equal. - */ - - -goog.provide('goog.structs.Set'); - -goog.require('goog.structs'); -goog.require('goog.structs.Collection'); -goog.require('goog.structs.Map'); - - - -/** - * A set that can contain both primitives and objects. Adding and removing - * elements is O(1). Primitives are treated as identical if they have the same - * type and convert to the same string. Objects are treated as identical only - * if they are references to the same object. WARNING: A goog.structs.Set can - * contain both 1 and (new Number(1)), because they are not the same. WARNING: - * Adding (new Number(1)) twice will yield two distinct elements, because they - * are two different objects. WARNING: Any object that is added to a - * goog.structs.Set will be modified! Because goog.getUid() is used to - * identify objects, every object in the set will be mutated. - * @param {Array<T>|Object<?,T>=} opt_values Initial values to start with. - * @constructor - * @implements {goog.structs.Collection<T>} - * @final - * @template T - */ -goog.structs.Set = function(opt_values) { - this.map_ = new goog.structs.Map; - if (opt_values) { - this.addAll(opt_values); - } -}; - - -/** - * Obtains a unique key for an element of the set. Primitives will yield the - * same key if they have the same type and convert to the same string. Object - * references will yield the same key only if they refer to the same object. - * @param {*} val Object or primitive value to get a key for. - * @return {string} A unique key for this value/object. - * @private - */ -goog.structs.Set.getKey_ = function(val) { - var type = typeof val; - if (type == 'object' && val || type == 'function') { - return 'o' + goog.getUid(/** @type {Object} */ (val)); - } else { - return type.substr(0, 1) + val; - } -}; - - -/** - * @return {number} The number of elements in the set. - * @override - */ -goog.structs.Set.prototype.getCount = function() { - return this.map_.getCount(); -}; - - -/** - * Add a primitive or an object to the set. - * @param {T} element The primitive or object to add. - * @override - */ -goog.structs.Set.prototype.add = function(element) { - this.map_.set(goog.structs.Set.getKey_(element), element); -}; - - -/** - * Adds all the values in the given collection to this set. - * @param {Array<T>|goog.structs.Collection<T>|Object<?,T>} col A collection - * containing the elements to add. - */ -goog.structs.Set.prototype.addAll = function(col) { - var values = goog.structs.getValues(col); - var l = values.length; - for (var i = 0; i < l; i++) { - this.add(values[i]); - } -}; - - -/** - * Removes all values in the given collection from this set. - * @param {Array<T>|goog.structs.Collection<T>|Object<?,T>} col A collection - * containing the elements to remove. - */ -goog.structs.Set.prototype.removeAll = function(col) { - var values = goog.structs.getValues(col); - var l = values.length; - for (var i = 0; i < l; i++) { - this.remove(values[i]); - } -}; - - -/** - * Removes the given element from this set. - * @param {T} element The primitive or object to remove. - * @return {boolean} Whether the element was found and removed. - * @override - */ -goog.structs.Set.prototype.remove = function(element) { - return this.map_.remove(goog.structs.Set.getKey_(element)); -}; - - -/** - * Removes all elements from this set. - */ -goog.structs.Set.prototype.clear = function() { - this.map_.clear(); -}; - - -/** - * Tests whether this set is empty. - * @return {boolean} True if there are no elements in this set. - */ -goog.structs.Set.prototype.isEmpty = function() { - return this.map_.isEmpty(); -}; - - -/** - * Tests whether this set contains the given element. - * @param {T} element The primitive or object to test for. - * @return {boolean} True if this set contains the given element. - * @override - */ -goog.structs.Set.prototype.contains = function(element) { - return this.map_.containsKey(goog.structs.Set.getKey_(element)); -}; - - -/** - * Tests whether this set contains all the values in a given collection. - * Repeated elements in the collection are ignored, e.g. (new - * goog.structs.Set([1, 2])).containsAll([1, 1]) is True. - * @param {goog.structs.Collection<T>|Object} col A collection-like object. - * @return {boolean} True if the set contains all elements. - */ -goog.structs.Set.prototype.containsAll = function(col) { - return goog.structs.every(col, this.contains, this); -}; - - -/** - * Finds all values that are present in both this set and the given collection. - * @param {Array<S>|Object<?,S>} col A collection. - * @return {!goog.structs.Set<T|S>} A new set containing all the values - * (primitives or objects) present in both this set and the given - * collection. - * @template S - */ -goog.structs.Set.prototype.intersection = function(col) { - var result = new goog.structs.Set(); - - var values = goog.structs.getValues(col); - for (var i = 0; i < values.length; i++) { - var value = values[i]; - if (this.contains(value)) { - result.add(value); - } - } - - return result; -}; - - -/** - * Finds all values that are present in this set and not in the given - * collection. - * @param {Array<T>|goog.structs.Collection<T>|Object<?,T>} col A collection. - * @return {!goog.structs.Set} A new set containing all the values - * (primitives or objects) present in this set but not in the given - * collection. - */ -goog.structs.Set.prototype.difference = function(col) { - var result = this.clone(); - result.removeAll(col); - return result; -}; - - -/** - * Returns an array containing all the elements in this set. - * @return {!Array<T>} An array containing all the elements in this set. - */ -goog.structs.Set.prototype.getValues = function() { - return this.map_.getValues(); -}; - - -/** - * Creates a shallow clone of this set. - * @return {!goog.structs.Set<T>} A new set containing all the same elements as - * this set. - */ -goog.structs.Set.prototype.clone = function() { - return new goog.structs.Set(this); -}; - - -/** - * Tests whether the given collection consists of the same elements as this set, - * regardless of order, without repetition. Primitives are treated as equal if - * they have the same type and convert to the same string; objects are treated - * as equal if they are references to the same object. This operation is O(n). - * @param {goog.structs.Collection<T>|Object} col A collection. - * @return {boolean} True if the given collection consists of the same elements - * as this set, regardless of order, without repetition. - */ -goog.structs.Set.prototype.equals = function(col) { - return this.getCount() == goog.structs.getCount(col) && this.isSubsetOf(col); -}; - - -/** - * Tests whether the given collection contains all the elements in this set. - * Primitives are treated as equal if they have the same type and convert to the - * same string; objects are treated as equal if they are references to the same - * object. This operation is O(n). - * @param {goog.structs.Collection<T>|Object} col A collection. - * @return {boolean} True if this set is a subset of the given collection. - */ -goog.structs.Set.prototype.isSubsetOf = function(col) { - var colCount = goog.structs.getCount(col); - if (this.getCount() > colCount) { - return false; - } - // TODO(user) Find the minimal collection size where the conversion makes - // the contains() method faster. - if (!(col instanceof goog.structs.Set) && colCount > 5) { - // Convert to a goog.structs.Set so that goog.structs.contains runs in - // O(1) time instead of O(n) time. - col = new goog.structs.Set(col); - } - return goog.structs.every(this, function(value) { - return goog.structs.contains(col, value); - }); -}; - - -/** - * Returns an iterator that iterates over the elements in this set. - * @param {boolean=} opt_keys This argument is ignored. - * @return {!goog.iter.Iterator} An iterator over the elements in this set. - */ -goog.structs.Set.prototype.__iterator__ = function(opt_keys) { - return this.map_.__iterator__(false); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Logging and debugging utilities. - * - * @see ../demos/debug.html - */ - -goog.provide('goog.debug'); - -goog.require('goog.array'); -goog.require('goog.html.SafeHtml'); -goog.require('goog.html.SafeUrl'); -goog.require('goog.html.uncheckedconversions'); -goog.require('goog.string.Const'); -goog.require('goog.structs.Set'); -goog.require('goog.userAgent'); - - -/** @define {boolean} Whether logging should be enabled. */ -goog.define('goog.debug.LOGGING_ENABLED', goog.DEBUG); - - -/** - * Catches onerror events fired by windows and similar objects. - * @param {function(Object)} logFunc The function to call with the error - * information. - * @param {boolean=} opt_cancel Whether to stop the error from reaching the - * browser. - * @param {Object=} opt_target Object that fires onerror events. - */ -goog.debug.catchErrors = function(logFunc, opt_cancel, opt_target) { - var target = opt_target || goog.global; - var oldErrorHandler = target.onerror; - var retVal = !!opt_cancel; - - // Chrome interprets onerror return value backwards (http://crbug.com/92062) - // until it was fixed in webkit revision r94061 (Webkit 535.3). This - // workaround still needs to be skipped in Safari after the webkit change - // gets pushed out in Safari. - // See https://bugs.webkit.org/show_bug.cgi?id=67119 - if (goog.userAgent.WEBKIT && - !goog.userAgent.isVersionOrHigher('535.3')) { - retVal = !retVal; - } - - /** - * New onerror handler for this target. This onerror handler follows the spec - * according to - * http://www.whatwg.org/specs/web-apps/current-work/#runtime-script-errors - * The spec was changed in August 2013 to support receiving column information - * and an error object for all scripts on the same origin or cross origin - * scripts with the proper headers. See - * https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror - * - * @param {string} message The error message. For cross-origin errors, this - * will be scrubbed to just "Script error.". For new browsers that have - * updated to follow the latest spec, errors that come from origins that - * have proper cross origin headers will not be scrubbed. - * @param {string} url The URL of the script that caused the error. The URL - * will be scrubbed to "" for cross origin scripts unless the script has - * proper cross origin headers and the browser has updated to the latest - * spec. - * @param {number} line The line number in the script that the error - * occurred on. - * @param {number=} opt_col The optional column number that the error - * occurred on. Only browsers that have updated to the latest spec will - * include this. - * @param {Error=} opt_error The optional actual error object for this - * error that should include the stack. Only browsers that have updated - * to the latest spec will inlude this parameter. - * @return {boolean} Whether to prevent the error from reaching the browser. - */ - target.onerror = function(message, url, line, opt_col, opt_error) { - if (oldErrorHandler) { - oldErrorHandler(message, url, line, opt_col, opt_error); - } - logFunc({ - message: message, - fileName: url, - line: line, - col: opt_col, - error: opt_error - }); - return retVal; - }; -}; - - -/** - * Creates a string representing an object and all its properties. - * @param {Object|null|undefined} obj Object to expose. - * @param {boolean=} opt_showFn Show the functions as well as the properties, - * default is false. - * @return {string} The string representation of {@code obj}. - */ -goog.debug.expose = function(obj, opt_showFn) { - if (typeof obj == 'undefined') { - return 'undefined'; - } - if (obj == null) { - return 'NULL'; - } - var str = []; - - for (var x in obj) { - if (!opt_showFn && goog.isFunction(obj[x])) { - continue; - } - var s = x + ' = '; - /** @preserveTry */ - try { - s += obj[x]; - } catch (e) { - s += '*** ' + e + ' ***'; - } - str.push(s); - } - return str.join('\n'); -}; - - -/** - * Creates a string representing a given primitive or object, and for an - * object, all its properties and nested objects. WARNING: If an object is - * given, it and all its nested objects will be modified. To detect reference - * cycles, this method identifies objects using goog.getUid() which mutates the - * object. - * @param {*} obj Object to expose. - * @param {boolean=} opt_showFn Also show properties that are functions (by - * default, functions are omitted). - * @return {string} A string representation of {@code obj}. - */ -goog.debug.deepExpose = function(obj, opt_showFn) { - var str = []; - - var helper = function(obj, space, parentSeen) { - var nestspace = space + ' '; - var seen = new goog.structs.Set(parentSeen); - - var indentMultiline = function(str) { - return str.replace(/\n/g, '\n' + space); - }; - - /** @preserveTry */ - try { - if (!goog.isDef(obj)) { - str.push('undefined'); - } else if (goog.isNull(obj)) { - str.push('NULL'); - } else if (goog.isString(obj)) { - str.push('"' + indentMultiline(obj) + '"'); - } else if (goog.isFunction(obj)) { - str.push(indentMultiline(String(obj))); - } else if (goog.isObject(obj)) { - if (seen.contains(obj)) { - str.push('*** reference loop detected ***'); - } else { - seen.add(obj); - str.push('{'); - for (var x in obj) { - if (!opt_showFn && goog.isFunction(obj[x])) { - continue; - } - str.push('\n'); - str.push(nestspace); - str.push(x + ' = '); - helper(obj[x], nestspace, seen); - } - str.push('\n' + space + '}'); - } - } else { - str.push(obj); - } - } catch (e) { - str.push('*** ' + e + ' ***'); - } - }; - - helper(obj, '', new goog.structs.Set()); - return str.join(''); -}; - - -/** - * Recursively outputs a nested array as a string. - * @param {Array<?>} arr The array. - * @return {string} String representing nested array. - */ -goog.debug.exposeArray = function(arr) { - var str = []; - for (var i = 0; i < arr.length; i++) { - if (goog.isArray(arr[i])) { - str.push(goog.debug.exposeArray(arr[i])); - } else { - str.push(arr[i]); - } - } - return '[ ' + str.join(', ') + ' ]'; -}; - - -/** - * Exposes an exception that has been caught by a try...catch and outputs the - * error as HTML with a stack trace. - * @param {Object} err Error object or string. - * @param {Function=} opt_fn Optional function to start stack trace from. - * @return {string} Details of exception, as HTML. - */ -goog.debug.exposeException = function(err, opt_fn) { - var html = goog.debug.exposeExceptionAsHtml(err, opt_fn); - return goog.html.SafeHtml.unwrap(html); -}; - - -/** - * Exposes an exception that has been caught by a try...catch and outputs the - * error with a stack trace. - * @param {Object} err Error object or string. - * @param {Function=} opt_fn Optional function to start stack trace from. - * @return {!goog.html.SafeHtml} Details of exception. - */ -goog.debug.exposeExceptionAsHtml = function(err, opt_fn) { - /** @preserveTry */ - try { - var e = goog.debug.normalizeErrorObject(err); - // Create the error message - var viewSourceUrl = goog.debug.createViewSourceUrl_(e.fileName); - var error = goog.html.SafeHtml.concat( - goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces( - 'Message: ' + e.message + '\nUrl: '), - goog.html.SafeHtml.create('a', - {href: viewSourceUrl, target: '_new'}, e.fileName), - goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces( - '\nLine: ' + e.lineNumber + '\n\nBrowser stack:\n' + - e.stack + '-> ' + '[end]\n\nJS stack traversal:\n' + - goog.debug.getStacktrace(opt_fn) + '-> ')); - return error; - } catch (e2) { - return goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces( - 'Exception trying to expose exception! You win, we lose. ' + e2); - } -}; - - -/** - * @param {?string=} opt_fileName - * @return {!goog.html.SafeUrl} SafeUrl with view-source scheme, pointing at - * fileName. - * @private - */ -goog.debug.createViewSourceUrl_ = function(opt_fileName) { - if (!goog.isDefAndNotNull(opt_fileName)) { - opt_fileName = ''; - } - if (!/^https?:\/\//i.test(opt_fileName)) { - return goog.html.SafeUrl.fromConstant( - goog.string.Const.from('sanitizedviewsrc')); - } - var sanitizedFileName = goog.html.SafeUrl.sanitize(opt_fileName); - return goog.html.uncheckedconversions. - safeUrlFromStringKnownToSatisfyTypeContract( - goog.string.Const.from('view-source scheme plus HTTP/HTTPS URL'), - 'view-source:' + goog.html.SafeUrl.unwrap(sanitizedFileName)); -}; - - -/** - * Normalizes the error/exception object between browsers. - * @param {Object} err Raw error object. - * @return {!Object} Normalized error object. - */ -goog.debug.normalizeErrorObject = function(err) { - var href = goog.getObjectByName('window.location.href'); - if (goog.isString(err)) { - return { - 'message': err, - 'name': 'Unknown error', - 'lineNumber': 'Not available', - 'fileName': href, - 'stack': 'Not available' - }; - } - - var lineNumber, fileName; - var threwError = false; - - try { - lineNumber = err.lineNumber || err.line || 'Not available'; - } catch (e) { - // Firefox 2 sometimes throws an error when accessing 'lineNumber': - // Message: Permission denied to get property UnnamedClass.lineNumber - lineNumber = 'Not available'; - threwError = true; - } - - try { - fileName = err.fileName || err.filename || err.sourceURL || - // $googDebugFname may be set before a call to eval to set the filename - // that the eval is supposed to present. - goog.global['$googDebugFname'] || href; - } catch (e) { - // Firefox 2 may also throw an error when accessing 'filename'. - fileName = 'Not available'; - threwError = true; - } - - // The IE Error object contains only the name and the message. - // The Safari Error object uses the line and sourceURL fields. - if (threwError || !err.lineNumber || !err.fileName || !err.stack || - !err.message || !err.name) { - return { - 'message': err.message || 'Not available', - 'name': err.name || 'UnknownError', - 'lineNumber': lineNumber, - 'fileName': fileName, - 'stack': err.stack || 'Not available' - }; - } - - // Standards error object - return err; -}; - - -/** - * Converts an object to an Error if it's a String, - * adds a stacktrace if there isn't one, - * and optionally adds an extra message. - * @param {Error|string} err the original thrown object or string. - * @param {string=} opt_message optional additional message to add to the - * error. - * @return {!Error} If err is a string, it is used to create a new Error, - * which is enhanced and returned. Otherwise err itself is enhanced - * and returned. - */ -goog.debug.enhanceError = function(err, opt_message) { - var error; - if (typeof err == 'string') { - error = Error(err); - if (Error.captureStackTrace) { - // Trim this function off the call stack, if we can. - Error.captureStackTrace(error, goog.debug.enhanceError); - } - } else { - error = err; - } - - if (!error.stack) { - error.stack = goog.debug.getStacktrace(goog.debug.enhanceError); - } - if (opt_message) { - // find the first unoccupied 'messageX' property - var x = 0; - while (error['message' + x]) { - ++x; - } - error['message' + x] = String(opt_message); - } - return error; -}; - - -/** - * Gets the current stack trace. Simple and iterative - doesn't worry about - * catching circular references or getting the args. - * @param {number=} opt_depth Optional maximum depth to trace back to. - * @return {string} A string with the function names of all functions in the - * stack, separated by \n. - * @suppress {es5Strict} - */ -goog.debug.getStacktraceSimple = function(opt_depth) { - if (goog.STRICT_MODE_COMPATIBLE) { - var stack = goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple); - if (stack) { - return stack; - } - // NOTE: browsers that have strict mode support also have native "stack" - // properties. Fall-through for legacy browser support. - } - - var sb = []; - var fn = arguments.callee.caller; - var depth = 0; - - while (fn && (!opt_depth || depth < opt_depth)) { - sb.push(goog.debug.getFunctionName(fn)); - sb.push('()\n'); - /** @preserveTry */ - try { - fn = fn.caller; - } catch (e) { - sb.push('[exception trying to get caller]\n'); - break; - } - depth++; - if (depth >= goog.debug.MAX_STACK_DEPTH) { - sb.push('[...long stack...]'); - break; - } - } - if (opt_depth && depth >= opt_depth) { - sb.push('[...reached max depth limit...]'); - } else { - sb.push('[end]'); - } - - return sb.join(''); -}; - - -/** - * Max length of stack to try and output - * @type {number} - */ -goog.debug.MAX_STACK_DEPTH = 50; - - -/** - * @param {Function} fn The function to start getting the trace from. - * @return {?string} - * @private - */ -goog.debug.getNativeStackTrace_ = function(fn) { - var tempErr = new Error(); - if (Error.captureStackTrace) { - Error.captureStackTrace(tempErr, fn); - return String(tempErr.stack); - } else { - // IE10, only adds stack traces when an exception is thrown. - try { - throw tempErr; - } catch (e) { - tempErr = e; - } - var stack = tempErr.stack; - if (stack) { - return String(stack); - } - } - return null; -}; - - -/** - * Gets the current stack trace, either starting from the caller or starting - * from a specified function that's currently on the call stack. - * @param {Function=} opt_fn Optional function to start getting the trace from. - * If not provided, defaults to the function that called this. - * @return {string} Stack trace. - * @suppress {es5Strict} - */ -goog.debug.getStacktrace = function(opt_fn) { - var stack; - if (goog.STRICT_MODE_COMPATIBLE) { - // Try to get the stack trace from the environment if it is available. - var contextFn = opt_fn || goog.debug.getStacktrace; - stack = goog.debug.getNativeStackTrace_(contextFn); - } - if (!stack) { - // NOTE: browsers that have strict mode support also have native "stack" - // properties. This function will throw in strict mode. - stack = goog.debug.getStacktraceHelper_( - opt_fn || arguments.callee.caller, []); - } - return stack; -}; - - -/** - * Private helper for getStacktrace(). - * @param {Function} fn Function to start getting the trace from. - * @param {Array<!Function>} visited List of functions visited so far. - * @return {string} Stack trace starting from function fn. - * @suppress {es5Strict} - * @private - */ -goog.debug.getStacktraceHelper_ = function(fn, visited) { - var sb = []; - - // Circular reference, certain functions like bind seem to cause a recursive - // loop so we need to catch circular references - if (goog.array.contains(visited, fn)) { - sb.push('[...circular reference...]'); - - // Traverse the call stack until function not found or max depth is reached - } else if (fn && visited.length < goog.debug.MAX_STACK_DEPTH) { - sb.push(goog.debug.getFunctionName(fn) + '('); - var args = fn.arguments; - // Args may be null for some special functions such as host objects or eval. - for (var i = 0; args && i < args.length; i++) { - if (i > 0) { - sb.push(', '); - } - var argDesc; - var arg = args[i]; - switch (typeof arg) { - case 'object': - argDesc = arg ? 'object' : 'null'; - break; - - case 'string': - argDesc = arg; - break; - - case 'number': - argDesc = String(arg); - break; - - case 'boolean': - argDesc = arg ? 'true' : 'false'; - break; - - case 'function': - argDesc = goog.debug.getFunctionName(arg); - argDesc = argDesc ? argDesc : '[fn]'; - break; - - case 'undefined': - default: - argDesc = typeof arg; - break; - } - - if (argDesc.length > 40) { - argDesc = argDesc.substr(0, 40) + '...'; - } - sb.push(argDesc); - } - visited.push(fn); - sb.push(')\n'); - /** @preserveTry */ - try { - sb.push(goog.debug.getStacktraceHelper_(fn.caller, visited)); - } catch (e) { - sb.push('[exception trying to get caller]\n'); - } - - } else if (fn) { - sb.push('[...long stack...]'); - } else { - sb.push('[end]'); - } - return sb.join(''); -}; - - -/** - * Set a custom function name resolver. - * @param {function(Function): string} resolver Resolves functions to their - * names. - */ -goog.debug.setFunctionResolver = function(resolver) { - goog.debug.fnNameResolver_ = resolver; -}; - - -/** - * Gets a function name - * @param {Function} fn Function to get name of. - * @return {string} Function's name. - */ -goog.debug.getFunctionName = function(fn) { - if (goog.debug.fnNameCache_[fn]) { - return goog.debug.fnNameCache_[fn]; - } - if (goog.debug.fnNameResolver_) { - var name = goog.debug.fnNameResolver_(fn); - if (name) { - goog.debug.fnNameCache_[fn] = name; - return name; - } - } - - // Heuristically determine function name based on code. - var functionSource = String(fn); - if (!goog.debug.fnNameCache_[functionSource]) { - var matches = /function ([^\(]+)/.exec(functionSource); - if (matches) { - var method = matches[1]; - goog.debug.fnNameCache_[functionSource] = method; - } else { - goog.debug.fnNameCache_[functionSource] = '[Anonymous]'; - } - } - - return goog.debug.fnNameCache_[functionSource]; -}; - - -/** - * Makes whitespace visible by replacing it with printable characters. - * This is useful in finding diffrences between the expected and the actual - * output strings of a testcase. - * @param {string} string whose whitespace needs to be made visible. - * @return {string} string whose whitespace is made visible. - */ -goog.debug.makeWhitespaceVisible = function(string) { - return string.replace(/ /g, '[_]') - .replace(/\f/g, '[f]') - .replace(/\n/g, '[n]\n') - .replace(/\r/g, '[r]') - .replace(/\t/g, '[t]'); -}; - - -/** - * Returns the type of a value. If a constructor is passed, and a suitable - * string cannot be found, 'unknown type name' will be returned. - * - * <p>Forked rather than moved from {@link goog.asserts.getType_} - * to avoid adding a dependency to goog.asserts. - * @param {*} value A constructor, object, or primitive. - * @return {string} The best display name for the value, or 'unknown type name'. - */ -goog.debug.runtimeType = function(value) { - if (value instanceof Function) { - return value.displayName || value.name || 'unknown type name'; - } else if (value instanceof Object) { - return value.constructor.displayName || value.constructor.name || - Object.prototype.toString.call(value); - } else { - return value === null ? 'null' : typeof value; - } -}; - - -/** - * Hash map for storing function names that have already been looked up. - * @type {Object} - * @private - */ -goog.debug.fnNameCache_ = {}; - - -/** - * Resolves functions to their names. Resolved function names will be cached. - * @type {function(Function):string} - * @private - */ -goog.debug.fnNameResolver_; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Definition of the LogRecord class. Please minimize - * dependencies this file has on other closure classes as any dependency it - * takes won't be able to use the logging infrastructure. - * - */ - -goog.provide('goog.debug.LogRecord'); - - - -/** - * LogRecord objects are used to pass logging requests between - * the logging framework and individual log Handlers. - * @constructor - * @param {goog.debug.Logger.Level} level One of the level identifiers. - * @param {string} msg The string message. - * @param {string} loggerName The name of the source logger. - * @param {number=} opt_time Time this log record was created if other than now. - * If 0, we use #goog.now. - * @param {number=} opt_sequenceNumber Sequence number of this log record. This - * should only be passed in when restoring a log record from persistence. - */ -goog.debug.LogRecord = function(level, msg, loggerName, - opt_time, opt_sequenceNumber) { - this.reset(level, msg, loggerName, opt_time, opt_sequenceNumber); -}; - - -/** - * Time the LogRecord was created. - * @type {number} - * @private - */ -goog.debug.LogRecord.prototype.time_; - - -/** - * Level of the LogRecord - * @type {goog.debug.Logger.Level} - * @private - */ -goog.debug.LogRecord.prototype.level_; - - -/** - * Message associated with the record - * @type {string} - * @private - */ -goog.debug.LogRecord.prototype.msg_; - - -/** - * Name of the logger that created the record. - * @type {string} - * @private - */ -goog.debug.LogRecord.prototype.loggerName_; - - -/** - * Sequence number for the LogRecord. Each record has a unique sequence number - * that is greater than all log records created before it. - * @type {number} - * @private - */ -goog.debug.LogRecord.prototype.sequenceNumber_ = 0; - - -/** - * Exception associated with the record - * @type {Object} - * @private - */ -goog.debug.LogRecord.prototype.exception_ = null; - - -/** - * @define {boolean} Whether to enable log sequence numbers. - */ -goog.define('goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS', true); - - -/** - * A sequence counter for assigning increasing sequence numbers to LogRecord - * objects. - * @type {number} - * @private - */ -goog.debug.LogRecord.nextSequenceNumber_ = 0; - - -/** - * Sets all fields of the log record. - * @param {goog.debug.Logger.Level} level One of the level identifiers. - * @param {string} msg The string message. - * @param {string} loggerName The name of the source logger. - * @param {number=} opt_time Time this log record was created if other than now. - * If 0, we use #goog.now. - * @param {number=} opt_sequenceNumber Sequence number of this log record. This - * should only be passed in when restoring a log record from persistence. - */ -goog.debug.LogRecord.prototype.reset = function(level, msg, loggerName, - opt_time, opt_sequenceNumber) { - if (goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS) { - this.sequenceNumber_ = typeof opt_sequenceNumber == 'number' ? - opt_sequenceNumber : goog.debug.LogRecord.nextSequenceNumber_++; - } - - this.time_ = opt_time || goog.now(); - this.level_ = level; - this.msg_ = msg; - this.loggerName_ = loggerName; - delete this.exception_; -}; - - -/** - * Get the source Logger's name. - * - * @return {string} source logger name (may be null). - */ -goog.debug.LogRecord.prototype.getLoggerName = function() { - return this.loggerName_; -}; - - -/** - * Get the exception that is part of the log record. - * - * @return {Object} the exception. - */ -goog.debug.LogRecord.prototype.getException = function() { - return this.exception_; -}; - - -/** - * Set the exception that is part of the log record. - * - * @param {Object} exception the exception. - */ -goog.debug.LogRecord.prototype.setException = function(exception) { - this.exception_ = exception; -}; - - -/** - * Get the source Logger's name. - * - * @param {string} loggerName source logger name (may be null). - */ -goog.debug.LogRecord.prototype.setLoggerName = function(loggerName) { - this.loggerName_ = loggerName; -}; - - -/** - * Get the logging message level, for example Level.SEVERE. - * @return {goog.debug.Logger.Level} the logging message level. - */ -goog.debug.LogRecord.prototype.getLevel = function() { - return this.level_; -}; - - -/** - * Set the logging message level, for example Level.SEVERE. - * @param {goog.debug.Logger.Level} level the logging message level. - */ -goog.debug.LogRecord.prototype.setLevel = function(level) { - this.level_ = level; -}; - - -/** - * Get the "raw" log message, before localization or formatting. - * - * @return {string} the raw message string. - */ -goog.debug.LogRecord.prototype.getMessage = function() { - return this.msg_; -}; - - -/** - * Set the "raw" log message, before localization or formatting. - * - * @param {string} msg the raw message string. - */ -goog.debug.LogRecord.prototype.setMessage = function(msg) { - this.msg_ = msg; -}; - - -/** - * Get event time in milliseconds since 1970. - * - * @return {number} event time in millis since 1970. - */ -goog.debug.LogRecord.prototype.getMillis = function() { - return this.time_; -}; - - -/** - * Set event time in milliseconds since 1970. - * - * @param {number} time event time in millis since 1970. - */ -goog.debug.LogRecord.prototype.setMillis = function(time) { - this.time_ = time; -}; - - -/** - * Get the sequence number. - * <p> - * Sequence numbers are normally assigned in the LogRecord - * constructor, which assigns unique sequence numbers to - * each new LogRecord in increasing order. - * @return {number} the sequence number. - */ -goog.debug.LogRecord.prototype.getSequenceNumber = function() { - return this.sequenceNumber_; -}; - - -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A buffer for log records. The purpose of this is to improve - * logging performance by re-using old objects when the buffer becomes full and - * to eliminate the need for each app to implement their own log buffer. The - * disadvantage to doing this is that log handlers cannot maintain references to - * log records and expect that they are not overwriten at a later point. - * - * @author agrieve@google.com (Andrew Grieve) - */ - -goog.provide('goog.debug.LogBuffer'); - -goog.require('goog.asserts'); -goog.require('goog.debug.LogRecord'); - - - -/** - * Creates the log buffer. - * @constructor - * @final - */ -goog.debug.LogBuffer = function() { - goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(), - 'Cannot use goog.debug.LogBuffer without defining ' + - 'goog.debug.LogBuffer.CAPACITY.'); - this.clear(); -}; - - -/** - * A static method that always returns the same instance of LogBuffer. - * @return {!goog.debug.LogBuffer} The LogBuffer singleton instance. - */ -goog.debug.LogBuffer.getInstance = function() { - if (!goog.debug.LogBuffer.instance_) { - // This function is written with the return statement after the assignment - // to avoid the jscompiler StripCode bug described in http://b/2608064. - // After that bug is fixed this can be refactored. - goog.debug.LogBuffer.instance_ = new goog.debug.LogBuffer(); - } - return goog.debug.LogBuffer.instance_; -}; - - -/** - * @define {number} The number of log records to buffer. 0 means disable - * buffering. - */ -goog.define('goog.debug.LogBuffer.CAPACITY', 0); - - -/** - * The array to store the records. - * @type {!Array<!goog.debug.LogRecord|undefined>} - * @private - */ -goog.debug.LogBuffer.prototype.buffer_; - - -/** - * The index of the most recently added record or -1 if there are no records. - * @type {number} - * @private - */ -goog.debug.LogBuffer.prototype.curIndex_; - - -/** - * Whether the buffer is at capacity. - * @type {boolean} - * @private - */ -goog.debug.LogBuffer.prototype.isFull_; - - -/** - * Adds a log record to the buffer, possibly overwriting the oldest record. - * @param {goog.debug.Logger.Level} level One of the level identifiers. - * @param {string} msg The string message. - * @param {string} loggerName The name of the source logger. - * @return {!goog.debug.LogRecord} The log record. - */ -goog.debug.LogBuffer.prototype.addRecord = function(level, msg, loggerName) { - var curIndex = (this.curIndex_ + 1) % goog.debug.LogBuffer.CAPACITY; - this.curIndex_ = curIndex; - if (this.isFull_) { - var ret = this.buffer_[curIndex]; - ret.reset(level, msg, loggerName); - return ret; - } - this.isFull_ = curIndex == goog.debug.LogBuffer.CAPACITY - 1; - return this.buffer_[curIndex] = - new goog.debug.LogRecord(level, msg, loggerName); -}; - - -/** - * @return {boolean} Whether the log buffer is enabled. - */ -goog.debug.LogBuffer.isBufferingEnabled = function() { - return goog.debug.LogBuffer.CAPACITY > 0; -}; - - -/** - * Removes all buffered log records. - */ -goog.debug.LogBuffer.prototype.clear = function() { - this.buffer_ = new Array(goog.debug.LogBuffer.CAPACITY); - this.curIndex_ = -1; - this.isFull_ = false; -}; - - -/** - * Calls the given function for each buffered log record, starting with the - * oldest one. - * @param {function(!goog.debug.LogRecord)} func The function to call. - */ -goog.debug.LogBuffer.prototype.forEachRecord = function(func) { - var buffer = this.buffer_; - // Corner case: no records. - if (!buffer[0]) { - return; - } - var curIndex = this.curIndex_; - var i = this.isFull_ ? curIndex : -1; - do { - i = (i + 1) % goog.debug.LogBuffer.CAPACITY; - func(/** @type {!goog.debug.LogRecord} */ (buffer[i])); - } while (i != curIndex); -}; - - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Definition of the Logger class. Please minimize dependencies - * this file has on other closure classes as any dependency it takes won't be - * able to use the logging infrastructure. - * - * @see ../demos/debug.html - */ - -goog.provide('goog.debug.LogManager'); -goog.provide('goog.debug.Loggable'); -goog.provide('goog.debug.Logger'); -goog.provide('goog.debug.Logger.Level'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.debug'); -goog.require('goog.debug.LogBuffer'); -goog.require('goog.debug.LogRecord'); - - -/** - * A message value that can be handled by a Logger. - * - * Functions are treated like callbacks, but are only called when the event's - * log level is enabled. This is useful for logging messages that are expensive - * to construct. - * - * @typedef {string|function(): string} - */ -goog.debug.Loggable; - - - -/** - * The Logger is an object used for logging debug messages. Loggers are - * normally named, using a hierarchical dot-separated namespace. Logger names - * can be arbitrary strings, but they should normally be based on the package - * name or class name of the logged component, such as goog.net.BrowserChannel. - * - * The Logger object is loosely based on the java class - * java.util.logging.Logger. It supports different levels of filtering for - * different loggers. - * - * The logger object should never be instantiated by application code. It - * should always use the goog.debug.Logger.getLogger function. - * - * @constructor - * @param {string} name The name of the Logger. - * @final - */ -goog.debug.Logger = function(name) { - /** - * Name of the Logger. Generally a dot-separated namespace - * @private {string} - */ - this.name_ = name; - - /** - * Parent Logger. - * @private {goog.debug.Logger} - */ - this.parent_ = null; - - /** - * Level that this logger only filters above. Null indicates it should - * inherit from the parent. - * @private {goog.debug.Logger.Level} - */ - this.level_ = null; - - /** - * Map of children loggers. The keys are the leaf names of the children and - * the values are the child loggers. - * @private {Object} - */ - this.children_ = null; - - /** - * Handlers that are listening to this logger. - * @private {Array<Function>} - */ - this.handlers_ = null; -}; - - -/** @const */ -goog.debug.Logger.ROOT_LOGGER_NAME = ''; - - -/** - * @define {boolean} Toggles whether loggers other than the root logger can have - * log handlers attached to them and whether they can have their log level - * set. Logging is a bit faster when this is set to false. - */ -goog.define('goog.debug.Logger.ENABLE_HIERARCHY', true); - - -if (!goog.debug.Logger.ENABLE_HIERARCHY) { - /** - * @type {!Array<Function>} - * @private - */ - goog.debug.Logger.rootHandlers_ = []; - - - /** - * @type {goog.debug.Logger.Level} - * @private - */ - goog.debug.Logger.rootLevel_; -} - - - -/** - * The Level class defines a set of standard logging levels that - * can be used to control logging output. The logging Level objects - * are ordered and are specified by ordered integers. Enabling logging - * at a given level also enables logging at all higher levels. - * <p> - * Clients should normally use the predefined Level constants such - * as Level.SEVERE. - * <p> - * The levels in descending order are: - * <ul> - * <li>SEVERE (highest value) - * <li>WARNING - * <li>INFO - * <li>CONFIG - * <li>FINE - * <li>FINER - * <li>FINEST (lowest value) - * </ul> - * In addition there is a level OFF that can be used to turn - * off logging, and a level ALL that can be used to enable - * logging of all messages. - * - * @param {string} name The name of the level. - * @param {number} value The numeric value of the level. - * @constructor - * @final - */ -goog.debug.Logger.Level = function(name, value) { - /** - * The name of the level - * @type {string} - */ - this.name = name; - - /** - * The numeric value of the level - * @type {number} - */ - this.value = value; -}; - - -/** - * @return {string} String representation of the logger level. - * @override - */ -goog.debug.Logger.Level.prototype.toString = function() { - return this.name; -}; - - -/** - * OFF is a special level that can be used to turn off logging. - * This level is initialized to <CODE>Infinity</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.OFF = - new goog.debug.Logger.Level('OFF', Infinity); - - -/** - * SHOUT is a message level for extra debugging loudness. - * This level is initialized to <CODE>1200</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.SHOUT = new goog.debug.Logger.Level('SHOUT', 1200); - - -/** - * SEVERE is a message level indicating a serious failure. - * This level is initialized to <CODE>1000</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.SEVERE = new goog.debug.Logger.Level('SEVERE', 1000); - - -/** - * WARNING is a message level indicating a potential problem. - * This level is initialized to <CODE>900</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.WARNING = new goog.debug.Logger.Level('WARNING', 900); - - -/** - * INFO is a message level for informational messages. - * This level is initialized to <CODE>800</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.INFO = new goog.debug.Logger.Level('INFO', 800); - - -/** - * CONFIG is a message level for static configuration messages. - * This level is initialized to <CODE>700</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.CONFIG = new goog.debug.Logger.Level('CONFIG', 700); - - -/** - * FINE is a message level providing tracing information. - * This level is initialized to <CODE>500</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.FINE = new goog.debug.Logger.Level('FINE', 500); - - -/** - * FINER indicates a fairly detailed tracing message. - * This level is initialized to <CODE>400</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.FINER = new goog.debug.Logger.Level('FINER', 400); - -/** - * FINEST indicates a highly detailed tracing message. - * This level is initialized to <CODE>300</CODE>. - * @type {!goog.debug.Logger.Level} - */ - -goog.debug.Logger.Level.FINEST = new goog.debug.Logger.Level('FINEST', 300); - - -/** - * ALL indicates that all messages should be logged. - * This level is initialized to <CODE>0</CODE>. - * @type {!goog.debug.Logger.Level} - */ -goog.debug.Logger.Level.ALL = new goog.debug.Logger.Level('ALL', 0); - - -/** - * The predefined levels. - * @type {!Array<!goog.debug.Logger.Level>} - * @final - */ -goog.debug.Logger.Level.PREDEFINED_LEVELS = [ - goog.debug.Logger.Level.OFF, - goog.debug.Logger.Level.SHOUT, - goog.debug.Logger.Level.SEVERE, - goog.debug.Logger.Level.WARNING, - goog.debug.Logger.Level.INFO, - goog.debug.Logger.Level.CONFIG, - goog.debug.Logger.Level.FINE, - goog.debug.Logger.Level.FINER, - goog.debug.Logger.Level.FINEST, - goog.debug.Logger.Level.ALL]; - - -/** - * A lookup map used to find the level object based on the name or value of - * the level object. - * @type {Object} - * @private - */ -goog.debug.Logger.Level.predefinedLevelsCache_ = null; - - -/** - * Creates the predefined levels cache and populates it. - * @private - */ -goog.debug.Logger.Level.createPredefinedLevelsCache_ = function() { - goog.debug.Logger.Level.predefinedLevelsCache_ = {}; - for (var i = 0, level; level = goog.debug.Logger.Level.PREDEFINED_LEVELS[i]; - i++) { - goog.debug.Logger.Level.predefinedLevelsCache_[level.value] = level; - goog.debug.Logger.Level.predefinedLevelsCache_[level.name] = level; - } -}; - - -/** - * Gets the predefined level with the given name. - * @param {string} name The name of the level. - * @return {goog.debug.Logger.Level} The level, or null if none found. - */ -goog.debug.Logger.Level.getPredefinedLevel = function(name) { - if (!goog.debug.Logger.Level.predefinedLevelsCache_) { - goog.debug.Logger.Level.createPredefinedLevelsCache_(); - } - - return goog.debug.Logger.Level.predefinedLevelsCache_[name] || null; -}; - - -/** - * Gets the highest predefined level <= #value. - * @param {number} value Level value. - * @return {goog.debug.Logger.Level} The level, or null if none found. - */ -goog.debug.Logger.Level.getPredefinedLevelByValue = function(value) { - if (!goog.debug.Logger.Level.predefinedLevelsCache_) { - goog.debug.Logger.Level.createPredefinedLevelsCache_(); - } - - if (value in goog.debug.Logger.Level.predefinedLevelsCache_) { - return goog.debug.Logger.Level.predefinedLevelsCache_[value]; - } - - for (var i = 0; i < goog.debug.Logger.Level.PREDEFINED_LEVELS.length; ++i) { - var level = goog.debug.Logger.Level.PREDEFINED_LEVELS[i]; - if (level.value <= value) { - return level; - } - } - return null; -}; - - -/** - * Finds or creates a logger for a named subsystem. If a logger has already been - * created with the given name it is returned. Otherwise a new logger is - * created. If a new logger is created its log level will be configured based - * on the LogManager configuration and it will configured to also send logging - * output to its parent's handlers. It will be registered in the LogManager - * global namespace. - * - * @param {string} name A name for the logger. This should be a dot-separated - * name and should normally be based on the package name or class name of the - * subsystem, such as goog.net.BrowserChannel. - * @return {!goog.debug.Logger} The named logger. - * @deprecated use goog.log instead. http://go/goog-debug-logger-deprecated - */ -goog.debug.Logger.getLogger = function(name) { - return goog.debug.LogManager.getLogger(name); -}; - - -/** - * Logs a message to profiling tools, if available. - * {@see https://developers.google.com/web-toolkit/speedtracer/logging-api} - * {@see http://msdn.microsoft.com/en-us/library/dd433074(VS.85).aspx} - * @param {string} msg The message to log. - */ -goog.debug.Logger.logToProfilers = function(msg) { - // Using goog.global, as loggers might be used in window-less contexts. - if (goog.global['console']) { - if (goog.global['console']['timeStamp']) { - // Logs a message to Firebug, Web Inspector, SpeedTracer, etc. - goog.global['console']['timeStamp'](msg); - } else if (goog.global['console']['markTimeline']) { - // TODO(user): markTimeline is deprecated. Drop this else clause entirely - // after Chrome M14 hits stable. - goog.global['console']['markTimeline'](msg); - } - } - - if (goog.global['msWriteProfilerMark']) { - // Logs a message to the Microsoft profiler - goog.global['msWriteProfilerMark'](msg); - } -}; - - -/** - * Gets the name of this logger. - * @return {string} The name of this logger. - */ -goog.debug.Logger.prototype.getName = function() { - return this.name_; -}; - - -/** - * Adds a handler to the logger. This doesn't use the event system because - * we want to be able to add logging to the event system. - * @param {Function} handler Handler function to add. - */ -goog.debug.Logger.prototype.addHandler = function(handler) { - if (goog.debug.LOGGING_ENABLED) { - if (goog.debug.Logger.ENABLE_HIERARCHY) { - if (!this.handlers_) { - this.handlers_ = []; - } - this.handlers_.push(handler); - } else { - goog.asserts.assert(!this.name_, - 'Cannot call addHandler on a non-root logger when ' + - 'goog.debug.Logger.ENABLE_HIERARCHY is false.'); - goog.debug.Logger.rootHandlers_.push(handler); - } - } -}; - - -/** - * Removes a handler from the logger. This doesn't use the event system because - * we want to be able to add logging to the event system. - * @param {Function} handler Handler function to remove. - * @return {boolean} Whether the handler was removed. - */ -goog.debug.Logger.prototype.removeHandler = function(handler) { - if (goog.debug.LOGGING_ENABLED) { - var handlers = goog.debug.Logger.ENABLE_HIERARCHY ? this.handlers_ : - goog.debug.Logger.rootHandlers_; - return !!handlers && goog.array.remove(handlers, handler); - } else { - return false; - } -}; - - -/** - * Returns the parent of this logger. - * @return {goog.debug.Logger} The parent logger or null if this is the root. - */ -goog.debug.Logger.prototype.getParent = function() { - return this.parent_; -}; - - -/** - * Returns the children of this logger as a map of the child name to the logger. - * @return {!Object} The map where the keys are the child leaf names and the - * values are the Logger objects. - */ -goog.debug.Logger.prototype.getChildren = function() { - if (!this.children_) { - this.children_ = {}; - } - return this.children_; -}; - - -/** - * Set the log level specifying which message levels will be logged by this - * logger. Message levels lower than this value will be discarded. - * The level value Level.OFF can be used to turn off logging. If the new level - * is null, it means that this node should inherit its level from its nearest - * ancestor with a specific (non-null) level value. - * - * @param {goog.debug.Logger.Level} level The new level. - */ -goog.debug.Logger.prototype.setLevel = function(level) { - if (goog.debug.LOGGING_ENABLED) { - if (goog.debug.Logger.ENABLE_HIERARCHY) { - this.level_ = level; - } else { - goog.asserts.assert(!this.name_, - 'Cannot call setLevel() on a non-root logger when ' + - 'goog.debug.Logger.ENABLE_HIERARCHY is false.'); - goog.debug.Logger.rootLevel_ = level; - } - } -}; - - -/** - * Gets the log level specifying which message levels will be logged by this - * logger. Message levels lower than this value will be discarded. - * The level value Level.OFF can be used to turn off logging. If the level - * is null, it means that this node should inherit its level from its nearest - * ancestor with a specific (non-null) level value. - * - * @return {goog.debug.Logger.Level} The level. - */ -goog.debug.Logger.prototype.getLevel = function() { - return goog.debug.LOGGING_ENABLED ? - this.level_ : goog.debug.Logger.Level.OFF; -}; - - -/** - * Returns the effective level of the logger based on its ancestors' levels. - * @return {goog.debug.Logger.Level} The level. - */ -goog.debug.Logger.prototype.getEffectiveLevel = function() { - if (!goog.debug.LOGGING_ENABLED) { - return goog.debug.Logger.Level.OFF; - } - - if (!goog.debug.Logger.ENABLE_HIERARCHY) { - return goog.debug.Logger.rootLevel_; - } - if (this.level_) { - return this.level_; - } - if (this.parent_) { - return this.parent_.getEffectiveLevel(); - } - goog.asserts.fail('Root logger has no level set.'); - return null; -}; - - -/** - * Checks if a message of the given level would actually be logged by this - * logger. This check is based on the Loggers effective level, which may be - * inherited from its parent. - * @param {goog.debug.Logger.Level} level The level to check. - * @return {boolean} Whether the message would be logged. - */ -goog.debug.Logger.prototype.isLoggable = function(level) { - return goog.debug.LOGGING_ENABLED && - level.value >= this.getEffectiveLevel().value; -}; - - -/** - * Logs a message. If the logger is currently enabled for the - * given message level then the given message is forwarded to all the - * registered output Handler objects. - * @param {goog.debug.Logger.Level} level One of the level identifiers. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error|Object=} opt_exception An exception associated with the - * message. - */ -goog.debug.Logger.prototype.log = function(level, msg, opt_exception) { - // java caches the effective level, not sure it's necessary here - if (goog.debug.LOGGING_ENABLED && this.isLoggable(level)) { - // Message callbacks can be useful when a log message is expensive to build. - if (goog.isFunction(msg)) { - msg = msg(); - } - - this.doLogRecord_(this.getLogRecord(level, msg, opt_exception)); - } -}; - - -/** - * Creates a new log record and adds the exception (if present) to it. - * @param {goog.debug.Logger.Level} level One of the level identifiers. - * @param {string} msg The string message. - * @param {Error|Object=} opt_exception An exception associated with the - * message. - * @return {!goog.debug.LogRecord} A log record. - * @suppress {es5Strict} - */ -goog.debug.Logger.prototype.getLogRecord = function( - level, msg, opt_exception) { - if (goog.debug.LogBuffer.isBufferingEnabled()) { - var logRecord = - goog.debug.LogBuffer.getInstance().addRecord(level, msg, this.name_); - } else { - logRecord = new goog.debug.LogRecord(level, String(msg), this.name_); - } - if (opt_exception) { - logRecord.setException(opt_exception); - } - return logRecord; -}; - - -/** - * Logs a message at the Logger.Level.SHOUT level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.debug.Logger.prototype.shout = function(msg, opt_exception) { - if (goog.debug.LOGGING_ENABLED) { - this.log(goog.debug.Logger.Level.SHOUT, msg, opt_exception); - } -}; - - -/** - * Logs a message at the Logger.Level.SEVERE level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.debug.Logger.prototype.severe = function(msg, opt_exception) { - if (goog.debug.LOGGING_ENABLED) { - this.log(goog.debug.Logger.Level.SEVERE, msg, opt_exception); - } -}; - - -/** - * Logs a message at the Logger.Level.WARNING level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.debug.Logger.prototype.warning = function(msg, opt_exception) { - if (goog.debug.LOGGING_ENABLED) { - this.log(goog.debug.Logger.Level.WARNING, msg, opt_exception); - } -}; - - -/** - * Logs a message at the Logger.Level.INFO level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.debug.Logger.prototype.info = function(msg, opt_exception) { - if (goog.debug.LOGGING_ENABLED) { - this.log(goog.debug.Logger.Level.INFO, msg, opt_exception); - } -}; - - -/** - * Logs a message at the Logger.Level.CONFIG level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.debug.Logger.prototype.config = function(msg, opt_exception) { - if (goog.debug.LOGGING_ENABLED) { - this.log(goog.debug.Logger.Level.CONFIG, msg, opt_exception); - } -}; - - -/** - * Logs a message at the Logger.Level.FINE level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.debug.Logger.prototype.fine = function(msg, opt_exception) { - if (goog.debug.LOGGING_ENABLED) { - this.log(goog.debug.Logger.Level.FINE, msg, opt_exception); - } -}; - - -/** - * Logs a message at the Logger.Level.FINER level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.debug.Logger.prototype.finer = function(msg, opt_exception) { - if (goog.debug.LOGGING_ENABLED) { - this.log(goog.debug.Logger.Level.FINER, msg, opt_exception); - } -}; - - -/** - * Logs a message at the Logger.Level.FINEST level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.debug.Logger.prototype.finest = function(msg, opt_exception) { - if (goog.debug.LOGGING_ENABLED) { - this.log(goog.debug.Logger.Level.FINEST, msg, opt_exception); - } -}; - - -/** - * Logs a LogRecord. If the logger is currently enabled for the - * given message level then the given message is forwarded to all the - * registered output Handler objects. - * @param {goog.debug.LogRecord} logRecord A log record to log. - */ -goog.debug.Logger.prototype.logRecord = function(logRecord) { - if (goog.debug.LOGGING_ENABLED && this.isLoggable(logRecord.getLevel())) { - this.doLogRecord_(logRecord); - } -}; - - -/** - * Logs a LogRecord. - * @param {goog.debug.LogRecord} logRecord A log record to log. - * @private - */ -goog.debug.Logger.prototype.doLogRecord_ = function(logRecord) { - goog.debug.Logger.logToProfilers('log:' + logRecord.getMessage()); - if (goog.debug.Logger.ENABLE_HIERARCHY) { - var target = this; - while (target) { - target.callPublish_(logRecord); - target = target.getParent(); - } - } else { - for (var i = 0, handler; handler = goog.debug.Logger.rootHandlers_[i++]; ) { - handler(logRecord); - } - } -}; - - -/** - * Calls the handlers for publish. - * @param {goog.debug.LogRecord} logRecord The log record to publish. - * @private - */ -goog.debug.Logger.prototype.callPublish_ = function(logRecord) { - if (this.handlers_) { - for (var i = 0, handler; handler = this.handlers_[i]; i++) { - handler(logRecord); - } - } -}; - - -/** - * Sets the parent of this logger. This is used for setting up the logger tree. - * @param {goog.debug.Logger} parent The parent logger. - * @private - */ -goog.debug.Logger.prototype.setParent_ = function(parent) { - this.parent_ = parent; -}; - - -/** - * Adds a child to this logger. This is used for setting up the logger tree. - * @param {string} name The leaf name of the child. - * @param {goog.debug.Logger} logger The child logger. - * @private - */ -goog.debug.Logger.prototype.addChild_ = function(name, logger) { - this.getChildren()[name] = logger; -}; - - -/** - * There is a single global LogManager object that is used to maintain a set of - * shared state about Loggers and log services. This is loosely based on the - * java class java.util.logging.LogManager. - * @const - */ -goog.debug.LogManager = {}; - - -/** - * Map of logger names to logger objects. - * - * @type {!Object<string, !goog.debug.Logger>} - * @private - */ -goog.debug.LogManager.loggers_ = {}; - - -/** - * The root logger which is the root of the logger tree. - * @type {goog.debug.Logger} - * @private - */ -goog.debug.LogManager.rootLogger_ = null; - - -/** - * Initializes the LogManager if not already initialized. - */ -goog.debug.LogManager.initialize = function() { - if (!goog.debug.LogManager.rootLogger_) { - goog.debug.LogManager.rootLogger_ = new goog.debug.Logger( - goog.debug.Logger.ROOT_LOGGER_NAME); - goog.debug.LogManager.loggers_[goog.debug.Logger.ROOT_LOGGER_NAME] = - goog.debug.LogManager.rootLogger_; - goog.debug.LogManager.rootLogger_.setLevel(goog.debug.Logger.Level.CONFIG); - } -}; - - -/** - * Returns all the loggers. - * @return {!Object<string, !goog.debug.Logger>} Map of logger names to logger - * objects. - */ -goog.debug.LogManager.getLoggers = function() { - return goog.debug.LogManager.loggers_; -}; - - -/** - * Returns the root of the logger tree namespace, the logger with the empty - * string as its name. - * - * @return {!goog.debug.Logger} The root logger. - */ -goog.debug.LogManager.getRoot = function() { - goog.debug.LogManager.initialize(); - return /** @type {!goog.debug.Logger} */ (goog.debug.LogManager.rootLogger_); -}; - - -/** - * Finds a named logger. - * - * @param {string} name A name for the logger. This should be a dot-separated - * name and should normally be based on the package name or class name of the - * subsystem, such as goog.net.BrowserChannel. - * @return {!goog.debug.Logger} The named logger. - */ -goog.debug.LogManager.getLogger = function(name) { - goog.debug.LogManager.initialize(); - var ret = goog.debug.LogManager.loggers_[name]; - return ret || goog.debug.LogManager.createLogger_(name); -}; - - -/** - * Creates a function that can be passed to goog.debug.catchErrors. The function - * will log all reported errors using the given logger. - * @param {goog.debug.Logger=} opt_logger The logger to log the errors to. - * Defaults to the root logger. - * @return {function(Object)} The created function. - */ -goog.debug.LogManager.createFunctionForCatchErrors = function(opt_logger) { - return function(info) { - var logger = opt_logger || goog.debug.LogManager.getRoot(); - logger.severe('Error: ' + info.message + ' (' + info.fileName + - ' @ Line: ' + info.line + ')'); - }; -}; - - -/** - * Creates the named logger. Will also create the parents of the named logger - * if they don't yet exist. - * @param {string} name The name of the logger. - * @return {!goog.debug.Logger} The named logger. - * @private - */ -goog.debug.LogManager.createLogger_ = function(name) { - // find parent logger - var logger = new goog.debug.Logger(name); - if (goog.debug.Logger.ENABLE_HIERARCHY) { - var lastDotIndex = name.lastIndexOf('.'); - var parentName = name.substr(0, lastDotIndex); - var leafName = name.substr(lastDotIndex + 1); - var parentLogger = goog.debug.LogManager.getLogger(parentName); - - // tell the parent about the child and the child about the parent - parentLogger.addChild_(leafName, logger); - logger.setParent_(parentLogger); - } - - goog.debug.LogManager.loggers_[name] = logger; - return logger; -}; - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Definition the goog.debug.RelativeTimeProvider class. - * - */ - -goog.provide('goog.debug.RelativeTimeProvider'); - - - -/** - * A simple object to keep track of a timestamp considered the start of - * something. The main use is for the logger system to maintain a start time - * that is occasionally reset. For example, in Gmail, we reset this relative - * time at the start of a user action so that timings are offset from the - * beginning of the action. This class also provides a singleton as the default - * behavior for most use cases is to share the same start time. - * - * @constructor - * @final - */ -goog.debug.RelativeTimeProvider = function() { - /** - * The start time. - * @type {number} - * @private - */ - this.relativeTimeStart_ = goog.now(); -}; - - -/** - * Default instance. - * @type {goog.debug.RelativeTimeProvider} - * @private - */ -goog.debug.RelativeTimeProvider.defaultInstance_ = - new goog.debug.RelativeTimeProvider(); - - -/** - * Sets the start time to the specified time. - * @param {number} timeStamp The start time. - */ -goog.debug.RelativeTimeProvider.prototype.set = function(timeStamp) { - this.relativeTimeStart_ = timeStamp; -}; - - -/** - * Resets the start time to now. - */ -goog.debug.RelativeTimeProvider.prototype.reset = function() { - this.set(goog.now()); -}; - - -/** - * @return {number} The start time. - */ -goog.debug.RelativeTimeProvider.prototype.get = function() { - return this.relativeTimeStart_; -}; - - -/** - * @return {goog.debug.RelativeTimeProvider} The default instance. - */ -goog.debug.RelativeTimeProvider.getDefaultInstance = function() { - return goog.debug.RelativeTimeProvider.defaultInstance_; -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Definition of various formatters for logging. Please minimize - * dependencies this file has on other closure classes as any dependency it - * takes won't be able to use the logging infrastructure. - * - */ - -goog.provide('goog.debug.Formatter'); -goog.provide('goog.debug.HtmlFormatter'); -goog.provide('goog.debug.TextFormatter'); - -goog.require('goog.debug'); -goog.require('goog.debug.Logger'); -goog.require('goog.debug.RelativeTimeProvider'); -goog.require('goog.html.SafeHtml'); - - - -/** - * Base class for Formatters. A Formatter is used to format a LogRecord into - * something that can be displayed to the user. - * - * @param {string=} opt_prefix The prefix to place before text records. - * @constructor - */ -goog.debug.Formatter = function(opt_prefix) { - this.prefix_ = opt_prefix || ''; - - /** - * A provider that returns the relative start time. - * @type {goog.debug.RelativeTimeProvider} - * @private - */ - this.startTimeProvider_ = - goog.debug.RelativeTimeProvider.getDefaultInstance(); -}; - - -/** - * Whether to append newlines to the end of formatted log records. - * @type {boolean} - */ -goog.debug.Formatter.prototype.appendNewline = true; - - -/** - * Whether to show absolute time in the DebugWindow. - * @type {boolean} - */ -goog.debug.Formatter.prototype.showAbsoluteTime = true; - - -/** - * Whether to show relative time in the DebugWindow. - * @type {boolean} - */ -goog.debug.Formatter.prototype.showRelativeTime = true; - - -/** - * Whether to show the logger name in the DebugWindow. - * @type {boolean} - */ -goog.debug.Formatter.prototype.showLoggerName = true; - - -/** - * Whether to show the logger exception text. - * @type {boolean} - */ -goog.debug.Formatter.prototype.showExceptionText = false; - - -/** - * Whether to show the severity level. - * @type {boolean} - */ -goog.debug.Formatter.prototype.showSeverityLevel = false; - - -/** - * Formats a record. - * @param {goog.debug.LogRecord} logRecord the logRecord to format. - * @return {string} The formatted string. - */ -goog.debug.Formatter.prototype.formatRecord = goog.abstractMethod; - - -/** - * Formats a record as SafeHtml. - * @param {goog.debug.LogRecord} logRecord the logRecord to format. - * @return {!goog.html.SafeHtml} The formatted string as SafeHtml. - */ -goog.debug.Formatter.prototype.formatRecordAsHtml = goog.abstractMethod; - - -/** - * Sets the start time provider. By default, this is the default instance - * but can be changed. - * @param {goog.debug.RelativeTimeProvider} provider The provider to use. - */ -goog.debug.Formatter.prototype.setStartTimeProvider = function(provider) { - this.startTimeProvider_ = provider; -}; - - -/** - * Returns the start time provider. By default, this is the default instance - * but can be changed. - * @return {goog.debug.RelativeTimeProvider} The start time provider. - */ -goog.debug.Formatter.prototype.getStartTimeProvider = function() { - return this.startTimeProvider_; -}; - - -/** - * Resets the start relative time. - */ -goog.debug.Formatter.prototype.resetRelativeTimeStart = function() { - this.startTimeProvider_.reset(); -}; - - -/** - * Returns a string for the time/date of the LogRecord. - * @param {goog.debug.LogRecord} logRecord The record to get a time stamp for. - * @return {string} A string representation of the time/date of the LogRecord. - * @private - */ -goog.debug.Formatter.getDateTimeStamp_ = function(logRecord) { - var time = new Date(logRecord.getMillis()); - return goog.debug.Formatter.getTwoDigitString_((time.getFullYear() - 2000)) + - goog.debug.Formatter.getTwoDigitString_((time.getMonth() + 1)) + - goog.debug.Formatter.getTwoDigitString_(time.getDate()) + ' ' + - goog.debug.Formatter.getTwoDigitString_(time.getHours()) + ':' + - goog.debug.Formatter.getTwoDigitString_(time.getMinutes()) + ':' + - goog.debug.Formatter.getTwoDigitString_(time.getSeconds()) + '.' + - goog.debug.Formatter.getTwoDigitString_( - Math.floor(time.getMilliseconds() / 10)); -}; - - -/** - * Returns the number as a two-digit string, meaning it prepends a 0 if the - * number if less than 10. - * @param {number} n The number to format. - * @return {string} A two-digit string representation of {@code n}. - * @private - */ -goog.debug.Formatter.getTwoDigitString_ = function(n) { - if (n < 10) { - return '0' + n; - } - return String(n); -}; - - -/** - * Returns a string for the number of seconds relative to the start time. - * Prepads with spaces so that anything less than 1000 seconds takes up the - * same number of characters for better formatting. - * @param {goog.debug.LogRecord} logRecord The log to compare time to. - * @param {number} relativeTimeStart The start time to compare to. - * @return {string} The number of seconds of the LogRecord relative to the - * start time. - * @private - */ -goog.debug.Formatter.getRelativeTime_ = function(logRecord, - relativeTimeStart) { - var ms = logRecord.getMillis() - relativeTimeStart; - var sec = ms / 1000; - var str = sec.toFixed(3); - - var spacesToPrepend = 0; - if (sec < 1) { - spacesToPrepend = 2; - } else { - while (sec < 100) { - spacesToPrepend++; - sec *= 10; - } - } - while (spacesToPrepend-- > 0) { - str = ' ' + str; - } - return str; -}; - - - -/** - * Formatter that returns formatted html. See formatRecord for the classes - * it uses for various types of formatted output. - * - * @param {string=} opt_prefix The prefix to place before text records. - * @constructor - * @extends {goog.debug.Formatter} - */ -goog.debug.HtmlFormatter = function(opt_prefix) { - goog.debug.Formatter.call(this, opt_prefix); -}; -goog.inherits(goog.debug.HtmlFormatter, goog.debug.Formatter); - - -/** - * Whether to show the logger exception text - * @type {boolean} - * @override - */ -goog.debug.HtmlFormatter.prototype.showExceptionText = true; - - -/** - * Formats a record - * @param {goog.debug.LogRecord} logRecord the logRecord to format. - * @return {string} The formatted string as html. - * @override - */ -goog.debug.HtmlFormatter.prototype.formatRecord = function(logRecord) { - if (!logRecord) { - return ''; - } - // OK not to use goog.html.SafeHtml.unwrap() here. - return this.formatRecordAsHtml(logRecord).getTypedStringValue(); -}; - - -/** - * Formats a record. - * @param {goog.debug.LogRecord} logRecord the logRecord to format. - * @return {!goog.html.SafeHtml} The formatted string as SafeHtml. - * @override - */ -goog.debug.HtmlFormatter.prototype.formatRecordAsHtml = function(logRecord) { - if (!logRecord) { - return goog.html.SafeHtml.EMPTY; - } - - var className; - switch (logRecord.getLevel().value) { - case goog.debug.Logger.Level.SHOUT.value: - className = 'dbg-sh'; - break; - case goog.debug.Logger.Level.SEVERE.value: - className = 'dbg-sev'; - break; - case goog.debug.Logger.Level.WARNING.value: - className = 'dbg-w'; - break; - case goog.debug.Logger.Level.INFO.value: - className = 'dbg-i'; - break; - case goog.debug.Logger.Level.FINE.value: - default: - className = 'dbg-f'; - break; - } - - // HTML for user defined prefix, time, logger name, and severity. - var sb = []; - sb.push(this.prefix_, ' '); - if (this.showAbsoluteTime) { - sb.push('[', goog.debug.Formatter.getDateTimeStamp_(logRecord), '] '); - } - if (this.showRelativeTime) { - sb.push('[', - goog.debug.Formatter.getRelativeTime_( - logRecord, this.startTimeProvider_.get()), - 's] '); - } - if (this.showLoggerName) { - sb.push('[', logRecord.getLoggerName(), '] '); - } - if (this.showSeverityLevel) { - sb.push('[', logRecord.getLevel().name, '] '); - } - var fullPrefixHtml = - goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces(sb.join('')); - - // HTML for exception text and log record. - var exceptionHtml = goog.html.SafeHtml.EMPTY; - if (this.showExceptionText && logRecord.getException()) { - exceptionHtml = goog.html.SafeHtml.concat( - goog.html.SafeHtml.create('br'), - goog.debug.exposeExceptionAsHtml(logRecord.getException())); - } - var logRecordHtml = goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces( - logRecord.getMessage()); - var recordAndExceptionHtml = goog.html.SafeHtml.create( - 'span', - {'class': className}, - goog.html.SafeHtml.concat(logRecordHtml, exceptionHtml)); - - - // Combine both pieces of HTML and, if needed, append a final newline. - var html; - if (this.appendNewline) { - html = goog.html.SafeHtml.concat(fullPrefixHtml, recordAndExceptionHtml, - goog.html.SafeHtml.create('br')); - } else { - html = goog.html.SafeHtml.concat(fullPrefixHtml, recordAndExceptionHtml); - } - return html; -}; - - - -/** - * Formatter that returns formatted plain text - * - * @param {string=} opt_prefix The prefix to place before text records. - * @constructor - * @extends {goog.debug.Formatter} - * @final - */ -goog.debug.TextFormatter = function(opt_prefix) { - goog.debug.Formatter.call(this, opt_prefix); -}; -goog.inherits(goog.debug.TextFormatter, goog.debug.Formatter); - - -/** - * Formats a record as text - * @param {goog.debug.LogRecord} logRecord the logRecord to format. - * @return {string} The formatted string. - * @override - */ -goog.debug.TextFormatter.prototype.formatRecord = function(logRecord) { - var sb = []; - sb.push(this.prefix_, ' '); - if (this.showAbsoluteTime) { - sb.push('[', goog.debug.Formatter.getDateTimeStamp_(logRecord), '] '); - } - if (this.showRelativeTime) { - sb.push('[', goog.debug.Formatter.getRelativeTime_(logRecord, - this.startTimeProvider_.get()), 's] '); - } - - if (this.showLoggerName) { - sb.push('[', logRecord.getLoggerName(), '] '); - } - if (this.showSeverityLevel) { - sb.push('[', logRecord.getLevel().name, '] '); - } - sb.push(logRecord.getMessage()); - if (this.showExceptionText) { - var exception = logRecord.getException(); - if (exception) { - var exceptionText = exception instanceof Error ? - exception.message : - exception.toString(); - sb.push('\n', exceptionText); - } - } - if (this.appendNewline) { - sb.push('\n'); - } - return sb.join(''); -}; - - -/** - * Formats a record as text - * @param {goog.debug.LogRecord} logRecord the logRecord to format. - * @return {!goog.html.SafeHtml} The formatted string as SafeHtml. This is - * just an HTML-escaped version of the text obtained from formatRecord(). - * @override - */ -goog.debug.TextFormatter.prototype.formatRecordAsHtml = function(logRecord) { - return goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces( - goog.debug.TextFormatter.prototype.formatRecord(logRecord)); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Simple logger that logs to the window console if available. - * - * Has an autoInstall option which can be put into initialization code, which - * will start logging if "Debug=true" is in document.location.href - * - */ - -goog.provide('goog.debug.Console'); - -goog.require('goog.debug.LogManager'); -goog.require('goog.debug.Logger'); -goog.require('goog.debug.TextFormatter'); - - - -/** - * Create and install a log handler that logs to window.console if available - * @constructor - */ -goog.debug.Console = function() { - this.publishHandler_ = goog.bind(this.addLogRecord, this); - - /** - * Formatter for formatted output. - * @type {!goog.debug.TextFormatter} - * @private - */ - this.formatter_ = new goog.debug.TextFormatter(); - this.formatter_.showAbsoluteTime = false; - this.formatter_.showExceptionText = false; - // The console logging methods automatically append a newline. - this.formatter_.appendNewline = false; - - this.isCapturing_ = false; - this.logBuffer_ = ''; - - /** - * Loggers that we shouldn't output. - * @type {!Object<boolean>} - * @private - */ - this.filteredLoggers_ = {}; -}; - - -/** - * Returns the text formatter used by this console - * @return {!goog.debug.TextFormatter} The text formatter. - */ -goog.debug.Console.prototype.getFormatter = function() { - return this.formatter_; -}; - - -/** - * Sets whether we are currently capturing logger output. - * @param {boolean} capturing Whether to capture logger output. - */ -goog.debug.Console.prototype.setCapturing = function(capturing) { - if (capturing == this.isCapturing_) { - return; - } - - // attach or detach handler from the root logger - var rootLogger = goog.debug.LogManager.getRoot(); - if (capturing) { - rootLogger.addHandler(this.publishHandler_); - } else { - rootLogger.removeHandler(this.publishHandler_); - this.logBuffer = ''; - } - this.isCapturing_ = capturing; -}; - - -/** - * Adds a log record. - * @param {goog.debug.LogRecord} logRecord The log entry. - */ -goog.debug.Console.prototype.addLogRecord = function(logRecord) { - - // Check to see if the log record is filtered or not. - if (this.filteredLoggers_[logRecord.getLoggerName()]) { - return; - } - - var record = this.formatter_.formatRecord(logRecord); - var console = goog.debug.Console.console_; - if (console) { - switch (logRecord.getLevel()) { - case goog.debug.Logger.Level.SHOUT: - goog.debug.Console.logToConsole_(console, 'info', record); - break; - case goog.debug.Logger.Level.SEVERE: - goog.debug.Console.logToConsole_(console, 'error', record); - break; - case goog.debug.Logger.Level.WARNING: - goog.debug.Console.logToConsole_(console, 'warn', record); - break; - default: - goog.debug.Console.logToConsole_(console, 'debug', record); - break; - } - } else { - this.logBuffer_ += record; - } -}; - - -/** - * Adds a logger name to be filtered. - * @param {string} loggerName the logger name to add. - */ -goog.debug.Console.prototype.addFilter = function(loggerName) { - this.filteredLoggers_[loggerName] = true; -}; - - -/** - * Removes a logger name to be filtered. - * @param {string} loggerName the logger name to remove. - */ -goog.debug.Console.prototype.removeFilter = function(loggerName) { - delete this.filteredLoggers_[loggerName]; -}; - - -/** - * Global console logger instance - * @type {goog.debug.Console} - */ -goog.debug.Console.instance = null; - - -/** - * The console to which to log. This is a property so it can be mocked out in - * this unit test for goog.debug.Console. Using goog.global, as console might be - * used in window-less contexts. - * @type {Object} - * @private - */ -goog.debug.Console.console_ = goog.global['console']; - - -/** - * Sets the console to which to log. - * @param {!Object} console The console to which to log. - */ -goog.debug.Console.setConsole = function(console) { - goog.debug.Console.console_ = console; -}; - - -/** - * Install the console and start capturing if "Debug=true" is in the page URL - */ -goog.debug.Console.autoInstall = function() { - if (!goog.debug.Console.instance) { - goog.debug.Console.instance = new goog.debug.Console(); - } - - if (goog.global.location && - goog.global.location.href.indexOf('Debug=true') != -1) { - goog.debug.Console.instance.setCapturing(true); - } -}; - - -/** - * Show an alert with all of the captured debug information. - * Information is only captured if console is not available - */ -goog.debug.Console.show = function() { - alert(goog.debug.Console.instance.logBuffer_); -}; - - -/** - * Logs the record to the console using the given function. If the function is - * not available on the console object, the log function is used instead. - * @param {!Object} console The console object. - * @param {string} fnName The name of the function to use. - * @param {string} record The record to log. - * @private - */ -goog.debug.Console.logToConsole_ = function(console, fnName, record) { - if (console[fnName]) { - console[fnName](record); - } else { - console.log(record); - } -}; - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utility class that monitors viewport size changes. - * - * @author attila@google.com (Attila Bodis) - * @see ../demos/viewportsizemonitor.html - */ - -goog.provide('goog.dom.ViewportSizeMonitor'); - -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); -goog.require('goog.math.Size'); - - - -/** - * This class can be used to monitor changes in the viewport size. Instances - * dispatch a {@link goog.events.EventType.RESIZE} event when the viewport size - * changes. Handlers can call {@link goog.dom.ViewportSizeMonitor#getSize} to - * get the new viewport size. - * - * Use this class if you want to execute resize/reflow logic each time the - * user resizes the browser window. This class is guaranteed to only dispatch - * {@code RESIZE} events when the pixel dimensions of the viewport change. - * (Internet Explorer fires resize events if any element on the page is resized, - * even if the viewport dimensions are unchanged, which can lead to infinite - * resize loops.) - * - * Example usage: - * <pre> - * var vsm = new goog.dom.ViewportSizeMonitor(); - * goog.events.listen(vsm, goog.events.EventType.RESIZE, function(e) { - * alert('Viewport size changed to ' + vsm.getSize()); - * }); - * </pre> - * - * Manually verified on IE6, IE7, FF2, Opera 11, Safari 4 and Chrome. - * - * @param {Window=} opt_window The window to monitor; defaults to the window in - * which this code is executing. - * @constructor - * @extends {goog.events.EventTarget} - */ -goog.dom.ViewportSizeMonitor = function(opt_window) { - goog.dom.ViewportSizeMonitor.base(this, 'constructor'); - - /** - * The window to monitor. Defaults to the window in which the code is running. - * @private {Window} - */ - this.window_ = opt_window || window; - - /** - * Event listener key for window the window resize handler, as returned by - * {@link goog.events.listen}. - * @private {goog.events.Key} - */ - this.listenerKey_ = goog.events.listen(this.window_, - goog.events.EventType.RESIZE, this.handleResize_, false, this); - - /** - * The most recently recorded size of the viewport, in pixels. - * @private {goog.math.Size} - */ - this.size_ = goog.dom.getViewportSize(this.window_); -}; -goog.inherits(goog.dom.ViewportSizeMonitor, goog.events.EventTarget); - - -/** - * Returns a viewport size monitor for the given window. A new one is created - * if it doesn't exist already. This prevents the unnecessary creation of - * multiple spooling monitors for a window. - * @param {Window=} opt_window The window to monitor; defaults to the window in - * which this code is executing. - * @return {!goog.dom.ViewportSizeMonitor} Monitor for the given window. - */ -goog.dom.ViewportSizeMonitor.getInstanceForWindow = function(opt_window) { - var currentWindow = opt_window || window; - var uid = goog.getUid(currentWindow); - - return goog.dom.ViewportSizeMonitor.windowInstanceMap_[uid] = - goog.dom.ViewportSizeMonitor.windowInstanceMap_[uid] || - new goog.dom.ViewportSizeMonitor(currentWindow); -}; - - -/** - * Removes and disposes a viewport size monitor for the given window if one - * exists. - * @param {Window=} opt_window The window whose monitor should be removed; - * defaults to the window in which this code is executing. - */ -goog.dom.ViewportSizeMonitor.removeInstanceForWindow = function(opt_window) { - var uid = goog.getUid(opt_window || window); - - goog.dispose(goog.dom.ViewportSizeMonitor.windowInstanceMap_[uid]); - delete goog.dom.ViewportSizeMonitor.windowInstanceMap_[uid]; -}; - - -/** - * Map of window hash code to viewport size monitor for that window, if - * created. - * @type {Object<number,goog.dom.ViewportSizeMonitor>} - * @private - */ -goog.dom.ViewportSizeMonitor.windowInstanceMap_ = {}; - - -/** - * Returns the most recently recorded size of the viewport, in pixels. May - * return null if no window resize event has been handled yet. - * @return {goog.math.Size} The viewport dimensions, in pixels. - */ -goog.dom.ViewportSizeMonitor.prototype.getSize = function() { - // Return a clone instead of the original to preserve encapsulation. - return this.size_ ? this.size_.clone() : null; -}; - - -/** @override */ -goog.dom.ViewportSizeMonitor.prototype.disposeInternal = function() { - goog.dom.ViewportSizeMonitor.superClass_.disposeInternal.call(this); - - if (this.listenerKey_) { - goog.events.unlistenByKey(this.listenerKey_); - this.listenerKey_ = null; - } - - this.window_ = null; - this.size_ = null; -}; - - -/** - * Handles window resize events by measuring the dimensions of the - * viewport and dispatching a {@link goog.events.EventType.RESIZE} event if the - * current dimensions are different from the previous ones. - * @param {goog.events.Event} event The window resize event to handle. - * @private - */ -goog.dom.ViewportSizeMonitor.prototype.handleResize_ = function(event) { - var size = goog.dom.getViewportSize(this.window_); - if (!goog.math.Size.equals(size, this.size_)) { - this.size_ = size; - this.dispatchEvent(goog.events.EventType.RESIZE); - } -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Constant declarations for common key codes. - * - * @author eae@google.com (Emil A Eklund) - * @see ../demos/keyhandler.html - */ - -goog.provide('goog.events.KeyCodes'); - -goog.require('goog.userAgent'); - -goog.forwardDeclare('goog.events.BrowserEvent'); - - -/** - * Key codes for common characters. - * - * This list is not localized and therefore some of the key codes are not - * correct for non US keyboard layouts. See comments below. - * - * @enum {number} - */ -goog.events.KeyCodes = { - WIN_KEY_FF_LINUX: 0, - MAC_ENTER: 3, - BACKSPACE: 8, - TAB: 9, - NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac - ENTER: 13, - SHIFT: 16, - CTRL: 17, - ALT: 18, - PAUSE: 19, - CAPS_LOCK: 20, - ESC: 27, - SPACE: 32, - PAGE_UP: 33, // also NUM_NORTH_EAST - PAGE_DOWN: 34, // also NUM_SOUTH_EAST - END: 35, // also NUM_SOUTH_WEST - HOME: 36, // also NUM_NORTH_WEST - LEFT: 37, // also NUM_WEST - UP: 38, // also NUM_NORTH - RIGHT: 39, // also NUM_EAST - DOWN: 40, // also NUM_SOUTH - PLUS_SIGN: 43, // NOT numpad plus - PRINT_SCREEN: 44, - INSERT: 45, // also NUM_INSERT - DELETE: 46, // also NUM_DELETE - ZERO: 48, - ONE: 49, - TWO: 50, - THREE: 51, - FOUR: 52, - FIVE: 53, - SIX: 54, - SEVEN: 55, - EIGHT: 56, - NINE: 57, - FF_SEMICOLON: 59, // Firefox (Gecko) fires this for semicolon instead of 186 - FF_EQUALS: 61, // Firefox (Gecko) fires this for equals instead of 187 - FF_DASH: 173, // Firefox (Gecko) fires this for dash instead of 189 - QUESTION_MARK: 63, // needs localization - AT_SIGN: 64, - A: 65, - B: 66, - C: 67, - D: 68, - E: 69, - F: 70, - G: 71, - H: 72, - I: 73, - J: 74, - K: 75, - L: 76, - M: 77, - N: 78, - O: 79, - P: 80, - Q: 81, - R: 82, - S: 83, - T: 84, - U: 85, - V: 86, - W: 87, - X: 88, - Y: 89, - Z: 90, - META: 91, // WIN_KEY_LEFT - WIN_KEY_RIGHT: 92, - CONTEXT_MENU: 93, - NUM_ZERO: 96, - NUM_ONE: 97, - NUM_TWO: 98, - NUM_THREE: 99, - NUM_FOUR: 100, - NUM_FIVE: 101, - NUM_SIX: 102, - NUM_SEVEN: 103, - NUM_EIGHT: 104, - NUM_NINE: 105, - NUM_MULTIPLY: 106, - NUM_PLUS: 107, - NUM_MINUS: 109, - NUM_PERIOD: 110, - NUM_DIVISION: 111, - F1: 112, - F2: 113, - F3: 114, - F4: 115, - F5: 116, - F6: 117, - F7: 118, - F8: 119, - F9: 120, - F10: 121, - F11: 122, - F12: 123, - NUMLOCK: 144, - SCROLL_LOCK: 145, - - // OS-specific media keys like volume controls and browser controls. - FIRST_MEDIA_KEY: 166, - LAST_MEDIA_KEY: 183, - - SEMICOLON: 186, // needs localization - DASH: 189, // needs localization - EQUALS: 187, // needs localization - COMMA: 188, // needs localization - PERIOD: 190, // needs localization - SLASH: 191, // needs localization - APOSTROPHE: 192, // needs localization - TILDE: 192, // needs localization - SINGLE_QUOTE: 222, // needs localization - OPEN_SQUARE_BRACKET: 219, // needs localization - BACKSLASH: 220, // needs localization - CLOSE_SQUARE_BRACKET: 221, // needs localization - WIN_KEY: 224, - MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91 - MAC_WK_CMD_LEFT: 91, // WebKit Left Command key fired, same as META - MAC_WK_CMD_RIGHT: 93, // WebKit Right Command key fired, different from META - WIN_IME: 229, - - // "Reserved for future use". Some programs (e.g. the SlingPlayer 2.4 ActiveX - // control) fire this as a hacky way to disable screensavers. - VK_NONAME: 252, - - // We've seen users whose machines fire this keycode at regular one - // second intervals. The common thread among these users is that - // they're all using Dell Inspiron laptops, so we suspect that this - // indicates a hardware/bios problem. - // http://en.community.dell.com/support-forums/laptop/f/3518/p/19285957/19523128.aspx - PHANTOM: 255 -}; - - -/** - * Returns true if the event contains a text modifying key. - * @param {goog.events.BrowserEvent} e A key event. - * @return {boolean} Whether it's a text modifying key. - */ -goog.events.KeyCodes.isTextModifyingKeyEvent = function(e) { - if (e.altKey && !e.ctrlKey || - e.metaKey || - // Function keys don't generate text - e.keyCode >= goog.events.KeyCodes.F1 && - e.keyCode <= goog.events.KeyCodes.F12) { - return false; - } - - // The following keys are quite harmless, even in combination with - // CTRL, ALT or SHIFT. - switch (e.keyCode) { - case goog.events.KeyCodes.ALT: - case goog.events.KeyCodes.CAPS_LOCK: - case goog.events.KeyCodes.CONTEXT_MENU: - case goog.events.KeyCodes.CTRL: - case goog.events.KeyCodes.DOWN: - case goog.events.KeyCodes.END: - case goog.events.KeyCodes.ESC: - case goog.events.KeyCodes.HOME: - case goog.events.KeyCodes.INSERT: - case goog.events.KeyCodes.LEFT: - case goog.events.KeyCodes.MAC_FF_META: - case goog.events.KeyCodes.META: - case goog.events.KeyCodes.NUMLOCK: - case goog.events.KeyCodes.NUM_CENTER: - case goog.events.KeyCodes.PAGE_DOWN: - case goog.events.KeyCodes.PAGE_UP: - case goog.events.KeyCodes.PAUSE: - case goog.events.KeyCodes.PHANTOM: - case goog.events.KeyCodes.PRINT_SCREEN: - case goog.events.KeyCodes.RIGHT: - case goog.events.KeyCodes.SCROLL_LOCK: - case goog.events.KeyCodes.SHIFT: - case goog.events.KeyCodes.UP: - case goog.events.KeyCodes.VK_NONAME: - case goog.events.KeyCodes.WIN_KEY: - case goog.events.KeyCodes.WIN_KEY_RIGHT: - return false; - case goog.events.KeyCodes.WIN_KEY_FF_LINUX: - return !goog.userAgent.GECKO; - default: - return e.keyCode < goog.events.KeyCodes.FIRST_MEDIA_KEY || - e.keyCode > goog.events.KeyCodes.LAST_MEDIA_KEY; - } -}; - - -/** - * Returns true if the key fires a keypress event in the current browser. - * - * Accoridng to MSDN [1] IE only fires keypress events for the following keys: - * - Letters: A - Z (uppercase and lowercase) - * - Numerals: 0 - 9 - * - Symbols: ! @ # $ % ^ & * ( ) _ - + = < [ ] { } , . / ? \ | ' ` " ~ - * - System: ESC, SPACEBAR, ENTER - * - * That's not entirely correct though, for instance there's no distinction - * between upper and lower case letters. - * - * [1] http://msdn2.microsoft.com/en-us/library/ms536939(VS.85).aspx) - * - * Safari is similar to IE, but does not fire keypress for ESC. - * - * Additionally, IE6 does not fire keydown or keypress events for letters when - * the control or alt keys are held down and the shift key is not. IE7 does - * fire keydown in these cases, though, but not keypress. - * - * @param {number} keyCode A key code. - * @param {number=} opt_heldKeyCode Key code of a currently-held key. - * @param {boolean=} opt_shiftKey Whether the shift key is held down. - * @param {boolean=} opt_ctrlKey Whether the control key is held down. - * @param {boolean=} opt_altKey Whether the alt key is held down. - * @return {boolean} Whether it's a key that fires a keypress event. - */ -goog.events.KeyCodes.firesKeyPressEvent = function(keyCode, opt_heldKeyCode, - opt_shiftKey, opt_ctrlKey, opt_altKey) { - if (!goog.userAgent.IE && !goog.userAgent.EDGE && - !(goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('525'))) { - return true; - } - - if (goog.userAgent.MAC && opt_altKey) { - return goog.events.KeyCodes.isCharacterKey(keyCode); - } - - // Alt but not AltGr which is represented as Alt+Ctrl. - if (opt_altKey && !opt_ctrlKey) { - return false; - } - - // Saves Ctrl or Alt + key for IE and WebKit 525+, which won't fire keypress. - // Non-IE browsers and WebKit prior to 525 won't get this far so no need to - // check the user agent. - if (goog.isNumber(opt_heldKeyCode)) { - opt_heldKeyCode = goog.events.KeyCodes.normalizeKeyCode(opt_heldKeyCode); - } - if (!opt_shiftKey && - (opt_heldKeyCode == goog.events.KeyCodes.CTRL || - opt_heldKeyCode == goog.events.KeyCodes.ALT || - goog.userAgent.MAC && - opt_heldKeyCode == goog.events.KeyCodes.META)) { - return false; - } - - // Some keys with Ctrl/Shift do not issue keypress in WEBKIT. - if ((goog.userAgent.WEBKIT || goog.userAgent.EDGE) && - opt_ctrlKey && opt_shiftKey) { - switch (keyCode) { - case goog.events.KeyCodes.BACKSLASH: - case goog.events.KeyCodes.OPEN_SQUARE_BRACKET: - case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET: - case goog.events.KeyCodes.TILDE: - case goog.events.KeyCodes.SEMICOLON: - case goog.events.KeyCodes.DASH: - case goog.events.KeyCodes.EQUALS: - case goog.events.KeyCodes.COMMA: - case goog.events.KeyCodes.PERIOD: - case goog.events.KeyCodes.SLASH: - case goog.events.KeyCodes.APOSTROPHE: - case goog.events.KeyCodes.SINGLE_QUOTE: - return false; - } - } - - // When Ctrl+<somekey> is held in IE, it only fires a keypress once, but it - // continues to fire keydown events as the event repeats. - if (goog.userAgent.IE && opt_ctrlKey && opt_heldKeyCode == keyCode) { - return false; - } - - switch (keyCode) { - case goog.events.KeyCodes.ENTER: - return true; - case goog.events.KeyCodes.ESC: - return !(goog.userAgent.WEBKIT || goog.userAgent.EDGE); - } - - return goog.events.KeyCodes.isCharacterKey(keyCode); -}; - - -/** - * Returns true if the key produces a character. - * This does not cover characters on non-US keyboards (Russian, Hebrew, etc.). - * - * @param {number} keyCode A key code. - * @return {boolean} Whether it's a character key. - */ -goog.events.KeyCodes.isCharacterKey = function(keyCode) { - if (keyCode >= goog.events.KeyCodes.ZERO && - keyCode <= goog.events.KeyCodes.NINE) { - return true; - } - - if (keyCode >= goog.events.KeyCodes.NUM_ZERO && - keyCode <= goog.events.KeyCodes.NUM_MULTIPLY) { - return true; - } - - if (keyCode >= goog.events.KeyCodes.A && - keyCode <= goog.events.KeyCodes.Z) { - return true; - } - - // Safari sends zero key code for non-latin characters. - if ((goog.userAgent.WEBKIT || goog.userAgent.EDGE) && keyCode == 0) { - return true; - } - - switch (keyCode) { - case goog.events.KeyCodes.SPACE: - case goog.events.KeyCodes.PLUS_SIGN: - case goog.events.KeyCodes.QUESTION_MARK: - case goog.events.KeyCodes.AT_SIGN: - case goog.events.KeyCodes.NUM_PLUS: - case goog.events.KeyCodes.NUM_MINUS: - case goog.events.KeyCodes.NUM_PERIOD: - case goog.events.KeyCodes.NUM_DIVISION: - case goog.events.KeyCodes.SEMICOLON: - case goog.events.KeyCodes.FF_SEMICOLON: - case goog.events.KeyCodes.DASH: - case goog.events.KeyCodes.EQUALS: - case goog.events.KeyCodes.FF_EQUALS: - case goog.events.KeyCodes.COMMA: - case goog.events.KeyCodes.PERIOD: - case goog.events.KeyCodes.SLASH: - case goog.events.KeyCodes.APOSTROPHE: - case goog.events.KeyCodes.SINGLE_QUOTE: - case goog.events.KeyCodes.OPEN_SQUARE_BRACKET: - case goog.events.KeyCodes.BACKSLASH: - case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET: - return true; - default: - return false; - } -}; - - -/** - * Normalizes key codes from OS/Browser-specific value to the general one. - * @param {number} keyCode The native key code. - * @return {number} The normalized key code. - */ -goog.events.KeyCodes.normalizeKeyCode = function(keyCode) { - if (goog.userAgent.GECKO) { - return goog.events.KeyCodes.normalizeGeckoKeyCode(keyCode); - } else if (goog.userAgent.MAC && goog.userAgent.WEBKIT) { - return goog.events.KeyCodes.normalizeMacWebKitKeyCode(keyCode); - } else { - return keyCode; - } -}; - - -/** - * Normalizes key codes from their Gecko-specific value to the general one. - * @param {number} keyCode The native key code. - * @return {number} The normalized key code. - */ -goog.events.KeyCodes.normalizeGeckoKeyCode = function(keyCode) { - switch (keyCode) { - case goog.events.KeyCodes.FF_EQUALS: - return goog.events.KeyCodes.EQUALS; - case goog.events.KeyCodes.FF_SEMICOLON: - return goog.events.KeyCodes.SEMICOLON; - case goog.events.KeyCodes.FF_DASH: - return goog.events.KeyCodes.DASH; - case goog.events.KeyCodes.MAC_FF_META: - return goog.events.KeyCodes.META; - case goog.events.KeyCodes.WIN_KEY_FF_LINUX: - return goog.events.KeyCodes.WIN_KEY; - default: - return keyCode; - } -}; - - -/** - * Normalizes key codes from their Mac WebKit-specific value to the general one. - * @param {number} keyCode The native key code. - * @return {number} The normalized key code. - */ -goog.events.KeyCodes.normalizeMacWebKitKeyCode = function(keyCode) { - switch (keyCode) { - case goog.events.KeyCodes.MAC_WK_CMD_RIGHT: // 93 - return goog.events.KeyCodes.META; // 91 - default: - return keyCode; - } -}; - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview This file contains a class for working with keyboard events - * that repeat consistently across browsers and platforms. It also unifies the - * key code so that it is the same in all browsers and platforms. - * - * Different web browsers have very different keyboard event handling. Most - * importantly is that only certain browsers repeat keydown events: - * IE, Opera, FF/Win32, and Safari 3 repeat keydown events. - * FF/Mac and Safari 2 do not. - * - * For the purposes of this code, "Safari 3" means WebKit 525+, when WebKit - * decided that they should try to match IE's key handling behavior. - * Safari 3.0.4, which shipped with Leopard (WebKit 523), has the - * Safari 2 behavior. - * - * Firefox, Safari, Opera prevent on keypress - * - * IE prevents on keydown - * - * Firefox does not fire keypress for shift, ctrl, alt - * Firefox does fire keydown for shift, ctrl, alt, meta - * Firefox does not repeat keydown for shift, ctrl, alt, meta - * - * Firefox does not fire keypress for up and down in an input - * - * Opera fires keypress for shift, ctrl, alt, meta - * Opera does not repeat keypress for shift, ctrl, alt, meta - * - * Safari 2 and 3 do not fire keypress for shift, ctrl, alt - * Safari 2 does not fire keydown for shift, ctrl, alt - * Safari 3 *does* fire keydown for shift, ctrl, alt - * - * IE provides the keycode for keyup/down events and the charcode (in the - * keycode field) for keypress. - * - * Mozilla provides the keycode for keyup/down and the charcode for keypress - * unless it's a non text modifying key in which case the keycode is provided. - * - * Safari 3 provides the keycode and charcode for all events. - * - * Opera provides the keycode for keyup/down event and either the charcode or - * the keycode (in the keycode field) for keypress events. - * - * Firefox x11 doesn't fire keydown events if a another key is already held down - * until the first key is released. This can cause a key event to be fired with - * a keyCode for the first key and a charCode for the second key. - * - * Safari in keypress - * - * charCode keyCode which - * ENTER: 13 13 13 - * F1: 63236 63236 63236 - * F8: 63243 63243 63243 - * ... - * p: 112 112 112 - * P: 80 80 80 - * - * Firefox, keypress: - * - * charCode keyCode which - * ENTER: 0 13 13 - * F1: 0 112 0 - * F8: 0 119 0 - * ... - * p: 112 0 112 - * P: 80 0 80 - * - * Opera, Mac+Win32, keypress: - * - * charCode keyCode which - * ENTER: undefined 13 13 - * F1: undefined 112 0 - * F8: undefined 119 0 - * ... - * p: undefined 112 112 - * P: undefined 80 80 - * - * IE7, keydown - * - * charCode keyCode which - * ENTER: undefined 13 undefined - * F1: undefined 112 undefined - * F8: undefined 119 undefined - * ... - * p: undefined 80 undefined - * P: undefined 80 undefined - * - * @author arv@google.com (Erik Arvidsson) - * @author eae@google.com (Emil A Eklund) - * @see ../demos/keyhandler.html - */ - -goog.provide('goog.events.KeyEvent'); -goog.provide('goog.events.KeyHandler'); -goog.provide('goog.events.KeyHandler.EventType'); - -goog.require('goog.events'); -goog.require('goog.events.BrowserEvent'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); -goog.require('goog.events.KeyCodes'); -goog.require('goog.userAgent'); - - - -/** - * A wrapper around an element that you want to listen to keyboard events on. - * @param {Element|Document=} opt_element The element or document to listen on. - * @param {boolean=} opt_capture Whether to listen for browser events in - * capture phase (defaults to false). - * @constructor - * @extends {goog.events.EventTarget} - * @final - */ -goog.events.KeyHandler = function(opt_element, opt_capture) { - goog.events.EventTarget.call(this); - - if (opt_element) { - this.attach(opt_element, opt_capture); - } -}; -goog.inherits(goog.events.KeyHandler, goog.events.EventTarget); - - -/** - * This is the element that we will listen to the real keyboard events on. - * @type {Element|Document|null} - * @private - */ -goog.events.KeyHandler.prototype.element_ = null; - - -/** - * The key for the key press listener. - * @type {goog.events.Key} - * @private - */ -goog.events.KeyHandler.prototype.keyPressKey_ = null; - - -/** - * The key for the key down listener. - * @type {goog.events.Key} - * @private - */ -goog.events.KeyHandler.prototype.keyDownKey_ = null; - - -/** - * The key for the key up listener. - * @type {goog.events.Key} - * @private - */ -goog.events.KeyHandler.prototype.keyUpKey_ = null; - - -/** - * Used to detect keyboard repeat events. - * @private - * @type {number} - */ -goog.events.KeyHandler.prototype.lastKey_ = -1; - - -/** - * Keycode recorded for key down events. As most browsers don't report the - * keycode in the key press event we need to record it in the key down phase. - * @private - * @type {number} - */ -goog.events.KeyHandler.prototype.keyCode_ = -1; - - -/** - * Alt key recorded for key down events. FF on Mac does not report the alt key - * flag in the key press event, we need to record it in the key down phase. - * @type {boolean} - * @private - */ -goog.events.KeyHandler.prototype.altKey_ = false; - - -/** - * Enum type for the events fired by the key handler - * @enum {string} - */ -goog.events.KeyHandler.EventType = { - KEY: 'key' -}; - - -/** - * An enumeration of key codes that Safari 2 does incorrectly - * @type {Object} - * @private - */ -goog.events.KeyHandler.safariKey_ = { - '3': goog.events.KeyCodes.ENTER, // 13 - '12': goog.events.KeyCodes.NUMLOCK, // 144 - '63232': goog.events.KeyCodes.UP, // 38 - '63233': goog.events.KeyCodes.DOWN, // 40 - '63234': goog.events.KeyCodes.LEFT, // 37 - '63235': goog.events.KeyCodes.RIGHT, // 39 - '63236': goog.events.KeyCodes.F1, // 112 - '63237': goog.events.KeyCodes.F2, // 113 - '63238': goog.events.KeyCodes.F3, // 114 - '63239': goog.events.KeyCodes.F4, // 115 - '63240': goog.events.KeyCodes.F5, // 116 - '63241': goog.events.KeyCodes.F6, // 117 - '63242': goog.events.KeyCodes.F7, // 118 - '63243': goog.events.KeyCodes.F8, // 119 - '63244': goog.events.KeyCodes.F9, // 120 - '63245': goog.events.KeyCodes.F10, // 121 - '63246': goog.events.KeyCodes.F11, // 122 - '63247': goog.events.KeyCodes.F12, // 123 - '63248': goog.events.KeyCodes.PRINT_SCREEN, // 44 - '63272': goog.events.KeyCodes.DELETE, // 46 - '63273': goog.events.KeyCodes.HOME, // 36 - '63275': goog.events.KeyCodes.END, // 35 - '63276': goog.events.KeyCodes.PAGE_UP, // 33 - '63277': goog.events.KeyCodes.PAGE_DOWN, // 34 - '63289': goog.events.KeyCodes.NUMLOCK, // 144 - '63302': goog.events.KeyCodes.INSERT // 45 -}; - - -/** - * An enumeration of key identifiers currently part of the W3C draft for DOM3 - * and their mappings to keyCodes. - * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set - * This is currently supported in Safari and should be platform independent. - * @type {Object} - * @private - */ -goog.events.KeyHandler.keyIdentifier_ = { - 'Up': goog.events.KeyCodes.UP, // 38 - 'Down': goog.events.KeyCodes.DOWN, // 40 - 'Left': goog.events.KeyCodes.LEFT, // 37 - 'Right': goog.events.KeyCodes.RIGHT, // 39 - 'Enter': goog.events.KeyCodes.ENTER, // 13 - 'F1': goog.events.KeyCodes.F1, // 112 - 'F2': goog.events.KeyCodes.F2, // 113 - 'F3': goog.events.KeyCodes.F3, // 114 - 'F4': goog.events.KeyCodes.F4, // 115 - 'F5': goog.events.KeyCodes.F5, // 116 - 'F6': goog.events.KeyCodes.F6, // 117 - 'F7': goog.events.KeyCodes.F7, // 118 - 'F8': goog.events.KeyCodes.F8, // 119 - 'F9': goog.events.KeyCodes.F9, // 120 - 'F10': goog.events.KeyCodes.F10, // 121 - 'F11': goog.events.KeyCodes.F11, // 122 - 'F12': goog.events.KeyCodes.F12, // 123 - 'U+007F': goog.events.KeyCodes.DELETE, // 46 - 'Home': goog.events.KeyCodes.HOME, // 36 - 'End': goog.events.KeyCodes.END, // 35 - 'PageUp': goog.events.KeyCodes.PAGE_UP, // 33 - 'PageDown': goog.events.KeyCodes.PAGE_DOWN, // 34 - 'Insert': goog.events.KeyCodes.INSERT // 45 -}; - - -/** - * If true, the KeyEvent fires on keydown. Otherwise, it fires on keypress. - * - * @type {boolean} - * @private - */ -goog.events.KeyHandler.USES_KEYDOWN_ = goog.userAgent.IE || - goog.userAgent.EDGE || - goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('525'); - - -/** - * If true, the alt key flag is saved during the key down and reused when - * handling the key press. FF on Mac does not set the alt flag in the key press - * event. - * @type {boolean} - * @private - */ -goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ = goog.userAgent.MAC && - goog.userAgent.GECKO; - - -/** - * Records the keycode for browsers that only returns the keycode for key up/ - * down events. For browser/key combinations that doesn't trigger a key pressed - * event it also fires the patched key event. - * @param {goog.events.BrowserEvent} e The key down event. - * @private - */ -goog.events.KeyHandler.prototype.handleKeyDown_ = function(e) { - // Ctrl-Tab and Alt-Tab can cause the focus to be moved to another window - // before we've caught a key-up event. If the last-key was one of these we - // reset the state. - if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) { - if (this.lastKey_ == goog.events.KeyCodes.CTRL && !e.ctrlKey || - this.lastKey_ == goog.events.KeyCodes.ALT && !e.altKey || - goog.userAgent.MAC && - this.lastKey_ == goog.events.KeyCodes.META && !e.metaKey) { - this.resetState(); - } - } - - if (this.lastKey_ == -1) { - if (e.ctrlKey && e.keyCode != goog.events.KeyCodes.CTRL) { - this.lastKey_ = goog.events.KeyCodes.CTRL; - } else if (e.altKey && e.keyCode != goog.events.KeyCodes.ALT) { - this.lastKey_ = goog.events.KeyCodes.ALT; - } else if (e.metaKey && e.keyCode != goog.events.KeyCodes.META) { - this.lastKey_ = goog.events.KeyCodes.META; - } - } - - if (goog.events.KeyHandler.USES_KEYDOWN_ && - !goog.events.KeyCodes.firesKeyPressEvent(e.keyCode, - this.lastKey_, e.shiftKey, e.ctrlKey, e.altKey)) { - this.handleEvent(e); - } else { - this.keyCode_ = goog.events.KeyCodes.normalizeKeyCode(e.keyCode); - if (goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_) { - this.altKey_ = e.altKey; - } - } -}; - - -/** - * Resets the stored previous values. Needed to be called for webkit which will - * not generate a key up for meta key operations. This should only be called - * when having finished with repeat key possiblities. - */ -goog.events.KeyHandler.prototype.resetState = function() { - this.lastKey_ = -1; - this.keyCode_ = -1; -}; - - -/** - * Clears the stored previous key value, resetting the key repeat status. Uses - * -1 because the Safari 3 Windows beta reports 0 for certain keys (like Home - * and End.) - * @param {goog.events.BrowserEvent} e The keyup event. - * @private - */ -goog.events.KeyHandler.prototype.handleKeyup_ = function(e) { - this.resetState(); - this.altKey_ = e.altKey; -}; - - -/** - * Handles the events on the element. - * @param {goog.events.BrowserEvent} e The keyboard event sent from the - * browser. - */ -goog.events.KeyHandler.prototype.handleEvent = function(e) { - var be = e.getBrowserEvent(); - var keyCode, charCode; - var altKey = be.altKey; - - // IE reports the character code in the keyCode field for keypress events. - // There are two exceptions however, Enter and Escape. - if (goog.userAgent.IE && e.type == goog.events.EventType.KEYPRESS) { - keyCode = this.keyCode_; - charCode = keyCode != goog.events.KeyCodes.ENTER && - keyCode != goog.events.KeyCodes.ESC ? - be.keyCode : 0; - - // Safari reports the character code in the keyCode field for keypress - // events but also has a charCode field. - } else if ((goog.userAgent.WEBKIT || goog.userAgent.EDGE) && - e.type == goog.events.EventType.KEYPRESS) { - keyCode = this.keyCode_; - charCode = be.charCode >= 0 && be.charCode < 63232 && - goog.events.KeyCodes.isCharacterKey(keyCode) ? - be.charCode : 0; - - // Opera reports the keycode or the character code in the keyCode field. - } else if (goog.userAgent.OPERA && !goog.userAgent.WEBKIT) { - keyCode = this.keyCode_; - charCode = goog.events.KeyCodes.isCharacterKey(keyCode) ? - be.keyCode : 0; - - // Mozilla reports the character code in the charCode field. - } else { - keyCode = be.keyCode || this.keyCode_; - charCode = be.charCode || 0; - if (goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_) { - altKey = this.altKey_; - } - // On the Mac, shift-/ triggers a question mark char code and no key code - // (normalized to WIN_KEY), so we synthesize the latter. - if (goog.userAgent.MAC && - charCode == goog.events.KeyCodes.QUESTION_MARK && - keyCode == goog.events.KeyCodes.WIN_KEY) { - keyCode = goog.events.KeyCodes.SLASH; - } - } - - keyCode = goog.events.KeyCodes.normalizeKeyCode(keyCode); - var key = keyCode; - var keyIdentifier = be.keyIdentifier; - - // Correct the key value for certain browser-specific quirks. - if (keyCode) { - if (keyCode >= 63232 && keyCode in goog.events.KeyHandler.safariKey_) { - // NOTE(nicksantos): Safari 3 has fixed this problem, - // this is only needed for Safari 2. - key = goog.events.KeyHandler.safariKey_[keyCode]; - } else { - - // Safari returns 25 for Shift+Tab instead of 9. - if (keyCode == 25 && e.shiftKey) { - key = 9; - } - } - } else if (keyIdentifier && - keyIdentifier in goog.events.KeyHandler.keyIdentifier_) { - // This is needed for Safari Windows because it currently doesn't give a - // keyCode/which for non printable keys. - key = goog.events.KeyHandler.keyIdentifier_[keyIdentifier]; - } - - // If we get the same keycode as a keydown/keypress without having seen a - // keyup event, then this event was caused by key repeat. - var repeat = key == this.lastKey_; - this.lastKey_ = key; - - var event = new goog.events.KeyEvent(key, charCode, repeat, be); - event.altKey = altKey; - this.dispatchEvent(event); -}; - - -/** - * Returns the element listened on for the real keyboard events. - * @return {Element|Document|null} The element listened on for the real - * keyboard events. - */ -goog.events.KeyHandler.prototype.getElement = function() { - return this.element_; -}; - - -/** - * Adds the proper key event listeners to the element. - * @param {Element|Document} element The element to listen on. - * @param {boolean=} opt_capture Whether to listen for browser events in - * capture phase (defaults to false). - */ -goog.events.KeyHandler.prototype.attach = function(element, opt_capture) { - if (this.keyUpKey_) { - this.detach(); - } - - this.element_ = element; - - this.keyPressKey_ = goog.events.listen(this.element_, - goog.events.EventType.KEYPRESS, - this, - opt_capture); - - // Most browsers (Safari 2 being the notable exception) doesn't include the - // keyCode in keypress events (IE has the char code in the keyCode field and - // Mozilla only included the keyCode if there's no charCode). Thus we have to - // listen for keydown to capture the keycode. - this.keyDownKey_ = goog.events.listen(this.element_, - goog.events.EventType.KEYDOWN, - this.handleKeyDown_, - opt_capture, - this); - - - this.keyUpKey_ = goog.events.listen(this.element_, - goog.events.EventType.KEYUP, - this.handleKeyup_, - opt_capture, - this); -}; - - -/** - * Removes the listeners that may exist. - */ -goog.events.KeyHandler.prototype.detach = function() { - if (this.keyPressKey_) { - goog.events.unlistenByKey(this.keyPressKey_); - goog.events.unlistenByKey(this.keyDownKey_); - goog.events.unlistenByKey(this.keyUpKey_); - this.keyPressKey_ = null; - this.keyDownKey_ = null; - this.keyUpKey_ = null; - } - this.element_ = null; - this.lastKey_ = -1; - this.keyCode_ = -1; -}; - - -/** @override */ -goog.events.KeyHandler.prototype.disposeInternal = function() { - goog.events.KeyHandler.superClass_.disposeInternal.call(this); - this.detach(); -}; - - - -/** - * This class is used for the goog.events.KeyHandler.EventType.KEY event and - * it overrides the key code with the fixed key code. - * @param {number} keyCode The adjusted key code. - * @param {number} charCode The unicode character code. - * @param {boolean} repeat Whether this event was generated by keyboard repeat. - * @param {Event} browserEvent Browser event object. - * @constructor - * @extends {goog.events.BrowserEvent} - * @final - */ -goog.events.KeyEvent = function(keyCode, charCode, repeat, browserEvent) { - goog.events.BrowserEvent.call(this, browserEvent); - this.type = goog.events.KeyHandler.EventType.KEY; - - /** - * Keycode of key press. - * @type {number} - */ - this.keyCode = keyCode; - - /** - * Unicode character code. - * @type {number} - */ - this.charCode = charCode; - - /** - * True if this event was generated by keyboard auto-repeat (i.e., the user is - * holding the key down.) - * @type {boolean} - */ - this.repeat = repeat; -}; -goog.inherits(goog.events.KeyEvent, goog.events.BrowserEvent); - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview This event wrapper will dispatch an event when the user uses - * the mouse wheel to scroll an element. You can get the direction by checking - * the deltaX and deltaY properties of the event. - * - * This class aims to smooth out inconsistencies between browser platforms with - * regards to mousewheel events, but we do not cover every possible - * software/hardware combination out there, some of which occasionally produce - * very large deltas in mousewheel events. If your application wants to guard - * against extremely large deltas, use the setMaxDeltaX and setMaxDeltaY APIs - * to set maximum values that make sense for your application. - * - * @author arv@google.com (Erik Arvidsson) - * @see ../demos/mousewheelhandler.html - */ - -goog.provide('goog.events.MouseWheelEvent'); -goog.provide('goog.events.MouseWheelHandler'); -goog.provide('goog.events.MouseWheelHandler.EventType'); - -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.BrowserEvent'); -goog.require('goog.events.EventTarget'); -goog.require('goog.math'); -goog.require('goog.style'); -goog.require('goog.userAgent'); - - - -/** - * This event handler allows you to catch mouse wheel events in a consistent - * manner. - * @param {Element|Document} element The element to listen to the mouse wheel - * event on. - * @param {boolean=} opt_capture Whether to handle the mouse wheel event in - * capture phase. - * @constructor - * @extends {goog.events.EventTarget} - */ -goog.events.MouseWheelHandler = function(element, opt_capture) { - goog.events.EventTarget.call(this); - - /** - * This is the element that we will listen to the real mouse wheel events on. - * @type {Element|Document} - * @private - */ - this.element_ = element; - - var rtlElement = goog.dom.isElement(this.element_) ? - /** @type {Element} */ (this.element_) : - (this.element_ ? /** @type {Document} */ (this.element_).body : null); - - /** - * True if the element exists and is RTL, false otherwise. - * @type {boolean} - * @private - */ - this.isRtl_ = !!rtlElement && goog.style.isRightToLeft(rtlElement); - - var type = goog.userAgent.GECKO ? 'DOMMouseScroll' : 'mousewheel'; - - /** - * The key returned from the goog.events.listen. - * @type {goog.events.Key} - * @private - */ - this.listenKey_ = goog.events.listen(this.element_, type, this, opt_capture); -}; -goog.inherits(goog.events.MouseWheelHandler, goog.events.EventTarget); - - -/** - * Enum type for the events fired by the mouse wheel handler. - * @enum {string} - */ -goog.events.MouseWheelHandler.EventType = { - MOUSEWHEEL: 'mousewheel' -}; - - -/** - * Optional maximum magnitude for x delta on each mousewheel event. - * @type {number|undefined} - * @private - */ -goog.events.MouseWheelHandler.prototype.maxDeltaX_; - - -/** - * Optional maximum magnitude for y delta on each mousewheel event. - * @type {number|undefined} - * @private - */ -goog.events.MouseWheelHandler.prototype.maxDeltaY_; - - -/** - * @param {number} maxDeltaX Maximum magnitude for x delta on each mousewheel - * event. Should be non-negative. - */ -goog.events.MouseWheelHandler.prototype.setMaxDeltaX = function(maxDeltaX) { - this.maxDeltaX_ = maxDeltaX; -}; - - -/** - * @param {number} maxDeltaY Maximum magnitude for y delta on each mousewheel - * event. Should be non-negative. - */ -goog.events.MouseWheelHandler.prototype.setMaxDeltaY = function(maxDeltaY) { - this.maxDeltaY_ = maxDeltaY; -}; - - -/** - * Handles the events on the element. - * @param {goog.events.BrowserEvent} e The underlying browser event. - */ -goog.events.MouseWheelHandler.prototype.handleEvent = function(e) { - var deltaX = 0; - var deltaY = 0; - var detail = 0; - var be = e.getBrowserEvent(); - if (be.type == 'mousewheel') { - var wheelDeltaScaleFactor = 1; - if (goog.userAgent.IE || - goog.userAgent.WEBKIT && - (goog.userAgent.WINDOWS || goog.userAgent.isVersionOrHigher('532.0'))) { - // In IE we get a multiple of 120; we adjust to a multiple of 3 to - // represent number of lines scrolled (like Gecko). - // Newer versions of Webkit match IE behavior, and WebKit on - // Windows also matches IE behavior. - // See bug https://bugs.webkit.org/show_bug.cgi?id=24368 - wheelDeltaScaleFactor = 40; - } - - detail = goog.events.MouseWheelHandler.smartScale_( - -be.wheelDelta, wheelDeltaScaleFactor); - if (goog.isDef(be.wheelDeltaX)) { - // Webkit has two properties to indicate directional scroll, and - // can scroll both directions at once. - deltaX = goog.events.MouseWheelHandler.smartScale_( - -be.wheelDeltaX, wheelDeltaScaleFactor); - deltaY = goog.events.MouseWheelHandler.smartScale_( - -be.wheelDeltaY, wheelDeltaScaleFactor); - } else { - deltaY = detail; - } - - // Historical note: Opera (pre 9.5) used to negate the detail value. - } else { // Gecko - // Gecko returns multiple of 3 (representing the number of lines scrolled) - detail = be.detail; - - // Gecko sometimes returns really big values if the user changes settings to - // scroll a whole page per scroll - if (detail > 100) { - detail = 3; - } else if (detail < -100) { - detail = -3; - } - - // Firefox 3.1 adds an axis field to the event to indicate direction of - // scroll. See https://developer.mozilla.org/en/Gecko-Specific_DOM_Events - if (goog.isDef(be.axis) && be.axis === be.HORIZONTAL_AXIS) { - deltaX = detail; - } else { - deltaY = detail; - } - } - - if (goog.isNumber(this.maxDeltaX_)) { - deltaX = goog.math.clamp(deltaX, -this.maxDeltaX_, this.maxDeltaX_); - } - if (goog.isNumber(this.maxDeltaY_)) { - deltaY = goog.math.clamp(deltaY, -this.maxDeltaY_, this.maxDeltaY_); - } - // Don't clamp 'detail', since it could be ambiguous which axis it refers to - // and because it's informally deprecated anyways. - - // For horizontal scrolling we need to flip the value for RTL grids. - if (this.isRtl_) { - deltaX = -deltaX; - } - var newEvent = new goog.events.MouseWheelEvent(detail, be, deltaX, deltaY); - this.dispatchEvent(newEvent); -}; - - -/** - * Helper for scaling down a mousewheel delta by a scale factor, if appropriate. - * @param {number} mouseWheelDelta Delta from a mouse wheel event. Expected to - * be an integer. - * @param {number} scaleFactor Factor to scale the delta down by. Expected to - * be an integer. - * @return {number} Scaled-down delta value, or the original delta if the - * scaleFactor does not appear to be applicable. - * @private - */ -goog.events.MouseWheelHandler.smartScale_ = function(mouseWheelDelta, - scaleFactor) { - // The basic problem here is that in Webkit on Mac and Linux, we can get two - // very different types of mousewheel events: from continuous devices - // (touchpads, Mighty Mouse) or non-continuous devices (normal wheel mice). - // - // Non-continuous devices in Webkit get their wheel deltas scaled up to - // behave like IE. Continuous devices return much smaller unscaled values - // (which most of the time will not be cleanly divisible by the IE scale - // factor), so we should not try to normalize them down. - // - // Detailed discussion: - // https://bugs.webkit.org/show_bug.cgi?id=29601 - // http://trac.webkit.org/browser/trunk/WebKit/chromium/src/mac/WebInputEventFactory.mm#L1063 - if (goog.userAgent.WEBKIT && - (goog.userAgent.MAC || goog.userAgent.LINUX) && - (mouseWheelDelta % scaleFactor) != 0) { - return mouseWheelDelta; - } else { - return mouseWheelDelta / scaleFactor; - } -}; - - -/** @override */ -goog.events.MouseWheelHandler.prototype.disposeInternal = function() { - goog.events.MouseWheelHandler.superClass_.disposeInternal.call(this); - goog.events.unlistenByKey(this.listenKey_); - this.listenKey_ = null; -}; - - - -/** - * A base class for mouse wheel events. This is used with the - * MouseWheelHandler. - * - * @param {number} detail The number of rows the user scrolled. - * @param {Event} browserEvent Browser event object. - * @param {number} deltaX The number of rows the user scrolled in the X - * direction. - * @param {number} deltaY The number of rows the user scrolled in the Y - * direction. - * @constructor - * @extends {goog.events.BrowserEvent} - * @final - */ -goog.events.MouseWheelEvent = function(detail, browserEvent, deltaX, deltaY) { - goog.events.BrowserEvent.call(this, browserEvent); - - this.type = goog.events.MouseWheelHandler.EventType.MOUSEWHEEL; - - /** - * The number of lines the user scrolled - * @type {number} - * NOTE: Informally deprecated. Use deltaX and deltaY instead, they provide - * more information. - */ - this.detail = detail; - - /** - * The number of "lines" scrolled in the X direction. - * - * Note that not all browsers provide enough information to distinguish - * horizontal and vertical scroll events, so for these unsupported browsers, - * we will always have a deltaX of 0, even if the user scrolled their mouse - * wheel or trackpad sideways. - * - * Currently supported browsers are Webkit and Firefox 3.1 or later. - * - * @type {number} - */ - this.deltaX = deltaX; - - /** - * The number of lines scrolled in the Y direction. - * @type {number} - */ - this.deltaY = deltaY; -}; -goog.inherits(goog.events.MouseWheelEvent, goog.events.BrowserEvent); - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Basic strippable logging definitions. - * @see http://go/closurelogging - * - * @author johnlenz@google.com (John Lenz) - */ - -goog.provide('goog.log'); -goog.provide('goog.log.Level'); -goog.provide('goog.log.LogRecord'); -goog.provide('goog.log.Logger'); - -goog.require('goog.debug'); -goog.require('goog.debug.LogManager'); -goog.require('goog.debug.LogRecord'); -goog.require('goog.debug.Logger'); - - -/** @define {boolean} Whether logging is enabled. */ -goog.define('goog.log.ENABLED', goog.debug.LOGGING_ENABLED); - - -/** @const */ -goog.log.ROOT_LOGGER_NAME = goog.debug.Logger.ROOT_LOGGER_NAME; - - - -/** - * @constructor - * @final - */ -goog.log.Logger = goog.debug.Logger; - - - -/** - * @constructor - * @final - */ -goog.log.Level = goog.debug.Logger.Level; - - - -/** - * @constructor - * @final - */ -goog.log.LogRecord = goog.debug.LogRecord; - - -/** - * Finds or creates a logger for a named subsystem. If a logger has already been - * created with the given name it is returned. Otherwise a new logger is - * created. If a new logger is created its log level will be configured based - * on the goog.debug.LogManager configuration and it will configured to also - * send logging output to its parent's handlers. - * @see goog.debug.LogManager - * - * @param {string} name A name for the logger. This should be a dot-separated - * name and should normally be based on the package name or class name of - * the subsystem, such as goog.net.BrowserChannel. - * @param {goog.log.Level=} opt_level If provided, override the - * default logging level with the provided level. - * @return {goog.log.Logger} The named logger or null if logging is disabled. - */ -goog.log.getLogger = function(name, opt_level) { - if (goog.log.ENABLED) { - var logger = goog.debug.LogManager.getLogger(name); - if (opt_level && logger) { - logger.setLevel(opt_level); - } - return logger; - } else { - return null; - } -}; - - -// TODO(johnlenz): try to tighten the types to these functions. -/** - * Adds a handler to the logger. This doesn't use the event system because - * we want to be able to add logging to the event system. - * @param {goog.log.Logger} logger - * @param {Function} handler Handler function to add. - */ -goog.log.addHandler = function(logger, handler) { - if (goog.log.ENABLED && logger) { - logger.addHandler(handler); - } -}; - - -/** - * Removes a handler from the logger. This doesn't use the event system because - * we want to be able to add logging to the event system. - * @param {goog.log.Logger} logger - * @param {Function} handler Handler function to remove. - * @return {boolean} Whether the handler was removed. - */ -goog.log.removeHandler = function(logger, handler) { - if (goog.log.ENABLED && logger) { - return logger.removeHandler(handler); - } else { - return false; - } -}; - - -/** - * Logs a message. If the logger is currently enabled for the - * given message level then the given message is forwarded to all the - * registered output Handler objects. - * @param {goog.log.Logger} logger - * @param {goog.log.Level} level One of the level identifiers. - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error|Object=} opt_exception An exception associated with the - * message. - */ -goog.log.log = function(logger, level, msg, opt_exception) { - if (goog.log.ENABLED && logger) { - logger.log(level, msg, opt_exception); - } -}; - - -/** - * Logs a message at the Level.SEVERE level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.log.Logger} logger - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.log.error = function(logger, msg, opt_exception) { - if (goog.log.ENABLED && logger) { - logger.severe(msg, opt_exception); - } -}; - - -/** - * Logs a message at the Level.WARNING level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.log.Logger} logger - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.log.warning = function(logger, msg, opt_exception) { - if (goog.log.ENABLED && logger) { - logger.warning(msg, opt_exception); - } -}; - - -/** - * Logs a message at the Level.INFO level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.log.Logger} logger - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.log.info = function(logger, msg, opt_exception) { - if (goog.log.ENABLED && logger) { - logger.info(msg, opt_exception); - } -}; - - -/** - * Logs a message at the Level.Fine level. - * If the logger is currently enabled for the given message level then the - * given message is forwarded to all the registered output Handler objects. - * @param {goog.log.Logger} logger - * @param {goog.debug.Loggable} msg The message to log. - * @param {Error=} opt_exception An exception associated with the message. - */ -goog.log.fine = function(logger, msg, opt_exception) { - if (goog.log.ENABLED && logger) { - logger.fine(msg, opt_exception); - } -}; - -// Based on https://github.com/Polymer/PointerEvents - -// Copyright (c) 2013 The Polymer Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -goog.provide('ol.pointer.PointerEvent'); - - -goog.require('goog.events'); -goog.require('goog.events.Event'); - - - -/** - * A class for pointer events. - * - * This class is used as an abstraction for mouse events, - * touch events and even native pointer events. - * - * @constructor - * @extends {goog.events.Event} - * @param {string} type The type of the event to create. - * @param {goog.events.BrowserEvent} browserEvent - * @param {Object.<string, ?>=} opt_eventDict An optional dictionary of - * initial event properties. - */ -ol.pointer.PointerEvent = function(type, browserEvent, opt_eventDict) { - goog.base(this, type); - - /** - * @const - * @type {goog.events.BrowserEvent} - */ - this.browserEvent = browserEvent; - - var eventDict = opt_eventDict ? opt_eventDict : {}; - - /** - * @type {number} - */ - this.buttons = this.getButtons_(eventDict); - - /** - * @type {number} - */ - this.pressure = this.getPressure_(eventDict, this.buttons); - - // MouseEvent related properties - - /** - * @type {boolean} - */ - this.bubbles = 'bubbles' in eventDict ? eventDict['bubbles'] : false; - - /** - * @type {boolean} - */ - this.cancelable = 'cancelable' in eventDict ? eventDict['cancelable'] : false; - - /** - * @type {Object} - */ - this.view = 'view' in eventDict ? eventDict['view'] : null; - - /** - * @type {number} - */ - this.detail = 'detail' in eventDict ? eventDict['detail'] : null; - - /** - * @type {number} - */ - this.screenX = 'screenX' in eventDict ? eventDict['screenX'] : 0; - - /** - * @type {number} - */ - this.screenY = 'screenY' in eventDict ? eventDict['screenY'] : 0; - - /** - * @type {number} - */ - this.clientX = 'clientX' in eventDict ? eventDict['clientX'] : 0; - - /** - * @type {number} - */ - this.clientY = 'clientY' in eventDict ? eventDict['clientY'] : 0; - - /** - * @type {boolean} - */ - this.ctrlKey = 'ctrlKey' in eventDict ? eventDict['ctrlKey'] : false; - - /** - * @type {boolean} - */ - this.altKey = 'altKey' in eventDict ? eventDict['altKey'] : false; - - /** - * @type {boolean} - */ - this.shiftKey = 'shiftKey' in eventDict ? eventDict['shiftKey'] : false; - - /** - * @type {boolean} - */ - this.metaKey = 'metaKey' in eventDict ? eventDict['metaKey'] : false; - - /** - * @type {number} - */ - this.button = 'button' in eventDict ? eventDict['button'] : 0; - - /** - * @type {Node} - */ - this.relatedTarget = 'relatedTarget' in eventDict ? - eventDict['relatedTarget'] : null; - - // PointerEvent related properties - - /** - * @const - * @type {number} - */ - this.pointerId = 'pointerId' in eventDict ? eventDict['pointerId'] : 0; - - /** - * @type {number} - */ - this.width = 'width' in eventDict ? eventDict['width'] : 0; - - /** - * @type {number} - */ - this.height = 'height' in eventDict ? eventDict['height'] : 0; - - /** - * @type {number} - */ - this.tiltX = 'tiltX' in eventDict ? eventDict['tiltX'] : 0; - - /** - * @type {number} - */ - this.tiltY = 'tiltY' in eventDict ? eventDict['tiltY'] : 0; - - /** - * @type {string} - */ - this.pointerType = 'pointerType' in eventDict ? eventDict['pointerType'] : ''; - - /** - * @type {number} - */ - this.hwTimestamp = 'hwTimestamp' in eventDict ? eventDict['hwTimestamp'] : 0; - - /** - * @type {boolean} - */ - this.isPrimary = 'isPrimary' in eventDict ? eventDict['isPrimary'] : false; - - // keep the semantics of preventDefault - if (browserEvent.preventDefault) { - this.preventDefault = function() { - browserEvent.preventDefault(); - }; - } -}; -goog.inherits(ol.pointer.PointerEvent, goog.events.Event); - - -/** - * @private - * @param {Object.<string, ?>} eventDict - * @return {number} - */ -ol.pointer.PointerEvent.prototype.getButtons_ = function(eventDict) { - // According to the w3c spec, - // http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-button - // MouseEvent.button == 0 can mean either no mouse button depressed, or the - // left mouse button depressed. - // - // As of now, the only way to distinguish between the two states of - // MouseEvent.button is by using the deprecated MouseEvent.which property, as - // this maps mouse buttons to positive integers > 0, and uses 0 to mean that - // no mouse button is held. - // - // MouseEvent.which is derived from MouseEvent.button at MouseEvent creation, - // but initMouseEvent does not expose an argument with which to set - // MouseEvent.which. Calling initMouseEvent with a buttonArg of 0 will set - // MouseEvent.button == 0 and MouseEvent.which == 1, breaking the expectations - // of app developers. - // - // The only way to propagate the correct state of MouseEvent.which and - // MouseEvent.button to a new MouseEvent.button == 0 and MouseEvent.which == 0 - // is to call initMouseEvent with a buttonArg value of -1. - // - // This is fixed with DOM Level 4's use of buttons - var buttons; - if (eventDict.buttons || ol.pointer.PointerEvent.HAS_BUTTONS) { - buttons = eventDict.buttons; - } else { - switch (eventDict.which) { - case 1: buttons = 1; break; - case 2: buttons = 4; break; - case 3: buttons = 2; break; - default: buttons = 0; - } - } - return buttons; -}; - - -/** - * @private - * @param {Object.<string, ?>} eventDict - * @param {number} buttons - * @return {number} - */ -ol.pointer.PointerEvent.prototype.getPressure_ = function(eventDict, buttons) { - // Spec requires that pointers without pressure specified use 0.5 for down - // state and 0 for up state. - var pressure = 0; - if (eventDict.pressure) { - pressure = eventDict.pressure; - } else { - pressure = buttons ? 0.5 : 0; - } - return pressure; -}; - - -/** - * Is the `buttons` property supported? - * @type {boolean} - */ -ol.pointer.PointerEvent.HAS_BUTTONS = false; - - -/** - * Checks if the `buttons` property is supported. - */ -(function() { - try { - var ev = new MouseEvent('click', {buttons: 1}); - ol.pointer.PointerEvent.HAS_BUTTONS = ev.buttons === 1; - } catch (e) { - } -})(); - -// FIXME add tests for browser features (Modernizr?) - -goog.provide('ol.dom'); -goog.provide('ol.dom.BrowserFeature'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.userAgent'); -goog.require('goog.vec.Mat4'); -goog.require('ol'); - - -/** - * Create an html canvas element and returns its 2d context. - * @param {number=} opt_width Canvas width. - * @param {number=} opt_height Canvas height. - * @return {CanvasRenderingContext2D} - */ -ol.dom.createCanvasContext2D = function(opt_width, opt_height) { - var canvas = goog.dom.createElement('CANVAS'); - if (opt_width) { - canvas.width = opt_width; - } - if (opt_height) { - canvas.height = opt_height; - } - return canvas.getContext('2d'); -}; - - -/** - * Detect 2d transform. - * Adapted from http://stackoverflow.com/q/5661671/130442 - * http://caniuse.com/#feat=transforms2d - * @return {boolean} - */ -ol.dom.canUseCssTransform = (function() { - var canUseCssTransform; - return function() { - if (canUseCssTransform === undefined) { - goog.asserts.assert(document.body, - 'document.body should not be null'); - if (!goog.global.getComputedStyle) { - // this browser is ancient - canUseCssTransform = false; - } else { - var el = goog.dom.createElement('P'), - has2d, - transforms = { - 'webkitTransform': '-webkit-transform', - 'OTransform': '-o-transform', - 'msTransform': '-ms-transform', - 'MozTransform': '-moz-transform', - 'transform': 'transform' - }; - document.body.appendChild(el); - for (var t in transforms) { - if (t in el.style) { - el.style[t] = 'translate(1px,1px)'; - has2d = goog.global.getComputedStyle(el).getPropertyValue( - transforms[t]); - } - } - goog.dom.removeNode(el); - - canUseCssTransform = (has2d && has2d !== 'none'); - } - } - return canUseCssTransform; - }; -}()); - - -/** - * Detect 3d transform. - * Adapted from http://stackoverflow.com/q/5661671/130442 - * http://caniuse.com/#feat=transforms3d - * @return {boolean} - */ -ol.dom.canUseCssTransform3D = (function() { - var canUseCssTransform3D; - return function() { - if (canUseCssTransform3D === undefined) { - goog.asserts.assert(document.body, - 'document.body should not be null'); - if (!goog.global.getComputedStyle) { - // this browser is ancient - canUseCssTransform3D = false; - } else { - var el = goog.dom.createElement('P'), - has3d, - transforms = { - 'webkitTransform': '-webkit-transform', - 'OTransform': '-o-transform', - 'msTransform': '-ms-transform', - 'MozTransform': '-moz-transform', - 'transform': 'transform' - }; - document.body.appendChild(el); - for (var t in transforms) { - if (t in el.style) { - el.style[t] = 'translate3d(1px,1px,1px)'; - has3d = goog.global.getComputedStyle(el).getPropertyValue( - transforms[t]); - } - } - goog.dom.removeNode(el); - - canUseCssTransform3D = (has3d && has3d !== 'none'); - } - } - return canUseCssTransform3D; - }; -}()); - - -/** - * @param {Element} element Element. - * @param {string} value Value. - */ -ol.dom.setTransform = function(element, value) { - var style = element.style; - style.WebkitTransform = value; - style.MozTransform = value; - style.OTransform = value; - style.msTransform = value; - style.transform = value; - - // IE 9+ seems to assume transform-origin: 100% 100%; for some unknown reason - if (goog.userAgent.IE && goog.userAgent.isVersionOrHigher('9.0')) { - element.style.transformOrigin = '0 0'; - } -}; - - -/** - * @param {!Element} element Element. - * @param {goog.vec.Mat4.Number} transform Matrix. - * @param {number=} opt_precision Precision. - */ -ol.dom.transformElement2D = function(element, transform, opt_precision) { - // using matrix() causes gaps in Chrome and Firefox on Mac OS X, so prefer - // matrix3d() - var i; - if (ol.dom.canUseCssTransform3D()) { - var value3D; - - if (opt_precision !== undefined) { - /** @type {Array.<string>} */ - var strings3D = new Array(16); - for (i = 0; i < 16; ++i) { - strings3D[i] = transform[i].toFixed(opt_precision); - } - value3D = strings3D.join(','); - } else { - value3D = transform.join(','); - } - ol.dom.setTransform(element, 'matrix3d(' + value3D + ')'); - } else if (ol.dom.canUseCssTransform()) { - /** @type {Array.<number>} */ - var transform2D = [ - goog.vec.Mat4.getElement(transform, 0, 0), - goog.vec.Mat4.getElement(transform, 1, 0), - goog.vec.Mat4.getElement(transform, 0, 1), - goog.vec.Mat4.getElement(transform, 1, 1), - goog.vec.Mat4.getElement(transform, 0, 3), - goog.vec.Mat4.getElement(transform, 1, 3) - ]; - var value2D; - if (opt_precision !== undefined) { - /** @type {Array.<string>} */ - var strings2D = new Array(6); - for (i = 0; i < 6; ++i) { - strings2D[i] = transform2D[i].toFixed(opt_precision); - } - value2D = strings2D.join(','); - } else { - value2D = transform2D.join(','); - } - ol.dom.setTransform(element, 'matrix(' + value2D + ')'); - } else { - element.style.left = - Math.round(goog.vec.Mat4.getElement(transform, 0, 3)) + 'px'; - element.style.top = - Math.round(goog.vec.Mat4.getElement(transform, 1, 3)) + 'px'; - - // TODO: Add scaling here. This isn't quite as simple as multiplying - // width/height, because that only changes the container size, not the - // content size. - } -}; - - -/** - * Get the current computed width for the given element including margin, - * padding and border. - * Equivalent to jQuery's `$(el).outerWidth(true)`. - * @param {!Element} element Element. - * @return {number} - */ -ol.dom.outerWidth = function(element) { - var width = element.offsetWidth; - var style = element.currentStyle || window.getComputedStyle(element); - width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10); - - return width; -}; - - -/** - * Get the current computed height for the given element including margin, - * padding and border. - * Equivalent to jQuery's `$(el).outerHeight(true)`. - * @param {!Element} element Element. - * @return {number} - */ -ol.dom.outerHeight = function(element) { - var height = element.offsetHeight; - var style = element.currentStyle || window.getComputedStyle(element); - height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10); - - return height; -}; - -goog.provide('ol.webgl'); -goog.provide('ol.webgl.WebGLContextEventType'); - - -/** - * @const - * @private - * @type {Array.<string>} - */ -ol.webgl.CONTEXT_IDS_ = [ - 'experimental-webgl', - 'webgl', - 'webkit-3d', - 'moz-webgl' -]; - - -/** - * @enum {string} - */ -ol.webgl.WebGLContextEventType = { - LOST: 'webglcontextlost', - RESTORED: 'webglcontextrestored' -}; - - -/** - * @param {HTMLCanvasElement} canvas Canvas. - * @param {Object=} opt_attributes Attributes. - * @return {WebGLRenderingContext} WebGL rendering context. - */ -ol.webgl.getContext = function(canvas, opt_attributes) { - var context, i, ii = ol.webgl.CONTEXT_IDS_.length; - for (i = 0; i < ii; ++i) { - try { - context = canvas.getContext(ol.webgl.CONTEXT_IDS_[i], opt_attributes); - if (context) { - return /** @type {!WebGLRenderingContext} */ (context); - } - } catch (e) { - } - } - return null; -}; - -goog.provide('ol.has'); - -goog.require('goog.dom'); -goog.require('ol'); -goog.require('ol.dom'); -goog.require('ol.webgl'); - - -/** - * The ratio between physical pixels and device-independent pixels - * (dips) on the device (`window.devicePixelRatio`). - * @const - * @type {number} - * @api stable - */ -ol.has.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1; - - -/** - * True if the browser's Canvas implementation implements {get,set}LineDash. - * @type {boolean} - */ -ol.has.CANVAS_LINE_DASH = false; - - -/** - * True if both the library and browser support Canvas. Always `false` - * if `ol.ENABLE_CANVAS` is set to `false` at compile time. - * @const - * @type {boolean} - * @api stable - */ -ol.has.CANVAS = ol.ENABLE_CANVAS && ( - /** - * @return {boolean} Canvas supported. - */ - function() { - if (!('HTMLCanvasElement' in goog.global)) { - return false; - } - try { - var context = ol.dom.createCanvasContext2D(); - if (!context) { - return false; - } else { - if (context.setLineDash !== undefined) { - ol.has.CANVAS_LINE_DASH = true; - } - return true; - } - } catch (e) { - return false; - } - })(); - - -/** - * Indicates if DeviceOrientation is supported in the user's browser. - * @const - * @type {boolean} - * @api stable - */ -ol.has.DEVICE_ORIENTATION = 'DeviceOrientationEvent' in goog.global; - - -/** - * True if `ol.ENABLE_DOM` is set to `true` at compile time. - * @const - * @type {boolean} - */ -ol.has.DOM = ol.ENABLE_DOM; - - -/** - * Is HTML5 geolocation supported in the current browser? - * @const - * @type {boolean} - * @api stable - */ -ol.has.GEOLOCATION = 'geolocation' in goog.global.navigator; - - -/** - * True if browser supports touch events. - * @const - * @type {boolean} - * @api stable - */ -ol.has.TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in goog.global; - - -/** - * True if browser supports pointer events. - * @const - * @type {boolean} - */ -ol.has.POINTER = 'PointerEvent' in goog.global; - - -/** - * True if browser supports ms pointer events (IE 10). - * @const - * @type {boolean} - */ -ol.has.MSPOINTER = !!(goog.global.navigator.msPointerEnabled); - - -/** - * True if both OpenLayers and browser support WebGL. Always `false` - * if `ol.ENABLE_WEBGL` is set to `false` at compile time. - * @const - * @type {boolean} - * @api stable - */ -ol.has.WEBGL; - - -(function() { - if (ol.ENABLE_WEBGL) { - var hasWebGL = false; - var textureSize; - var /** @type {Array.<string>} */ extensions = []; - - if ('WebGLRenderingContext' in goog.global) { - try { - var canvas = /** @type {HTMLCanvasElement} */ - (goog.dom.createElement('CANVAS')); - var gl = ol.webgl.getContext(canvas, { - failIfMajorPerformanceCaveat: true - }); - if (gl) { - hasWebGL = true; - textureSize = /** @type {number} */ - (gl.getParameter(gl.MAX_TEXTURE_SIZE)); - extensions = gl.getSupportedExtensions(); - } - } catch (e) {} - } - ol.has.WEBGL = hasWebGL; - ol.WEBGL_EXTENSIONS = extensions; - ol.WEBGL_MAX_TEXTURE_SIZE = textureSize; - } -})(); - -goog.provide('ol.pointer.EventSource'); - -goog.require('goog.events.BrowserEvent'); - - - -/** - * @param {ol.pointer.PointerEventHandler} dispatcher - * @param {!Object.<string, function(goog.events.BrowserEvent)>} mapping - * @constructor - */ -ol.pointer.EventSource = function(dispatcher, mapping) { - /** - * @type {ol.pointer.PointerEventHandler} - */ - this.dispatcher = dispatcher; - - /** - * @private - * @const - * @type {!Object.<string, function(goog.events.BrowserEvent)>} - */ - this.mapping_ = mapping; -}; - - -/** - * List of events supported by this source. - * @return {Array.<string>} Event names - */ -ol.pointer.EventSource.prototype.getEvents = function() { - return Object.keys(this.mapping_); -}; - - -/** - * Returns a mapping between the supported event types and - * the handlers that should handle an event. - * @return {Object.<string, function(goog.events.BrowserEvent)>} - * Event/Handler mapping - */ -ol.pointer.EventSource.prototype.getMapping = function() { - return this.mapping_; -}; - - -/** - * Returns the handler that should handle a given event type. - * @param {string} eventType - * @return {function(goog.events.BrowserEvent)} Handler - */ -ol.pointer.EventSource.prototype.getHandlerForEvent = function(eventType) { - return this.mapping_[eventType]; -}; - -// Based on https://github.com/Polymer/PointerEvents - -// Copyright (c) 2013 The Polymer Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -goog.provide('ol.pointer.MouseSource'); - -goog.require('ol.pointer.EventSource'); - - - -/** - * @param {ol.pointer.PointerEventHandler} dispatcher - * @constructor - * @extends {ol.pointer.EventSource} - */ -ol.pointer.MouseSource = function(dispatcher) { - var mapping = { - 'mousedown': this.mousedown, - 'mousemove': this.mousemove, - 'mouseup': this.mouseup, - 'mouseover': this.mouseover, - 'mouseout': this.mouseout - }; - goog.base(this, dispatcher, mapping); - - /** - * @const - * @type {Object.<string, goog.events.BrowserEvent|Object>} - */ - this.pointerMap = dispatcher.pointerMap; - - /** - * @const - * @type {Array.<ol.Pixel>} - */ - this.lastTouches = []; -}; -goog.inherits(ol.pointer.MouseSource, ol.pointer.EventSource); - - -/** - * @const - * @type {number} - */ -ol.pointer.MouseSource.POINTER_ID = 1; - - -/** - * @const - * @type {string} - */ -ol.pointer.MouseSource.POINTER_TYPE = 'mouse'; - - -/** - * Radius around touchend that swallows mouse events. - * - * @const - * @type {number} - */ -ol.pointer.MouseSource.DEDUP_DIST = 25; - - -/** - * Detect if a mouse event was simulated from a touch by - * checking if previously there was a touch event at the - * same position. - * - * FIXME - Known problem with the native Android browser on - * Samsung GT-I9100 (Android 4.1.2): - * In case the page is scrolled, this function does not work - * correctly when a canvas is used (WebGL or canvas renderer). - * Mouse listeners on canvas elements (for this browser), create - * two mouse events: One 'good' and one 'bad' one (on other browsers or - * when a div is used, there is only one event). For the 'bad' one, - * clientX/clientY and also pageX/pageY are wrong when the page - * is scrolled. Because of that, this function can not detect if - * the events were simulated from a touch event. As result, a - * pointer event at a wrong position is dispatched, which confuses - * the map interactions. - * It is unclear, how one can get the correct position for the event - * or detect that the positions are invalid. - * - * @private - * @param {goog.events.BrowserEvent} inEvent - * @return {boolean} True, if the event was generated by a touch. - */ -ol.pointer.MouseSource.prototype.isEventSimulatedFromTouch_ = - function(inEvent) { - var lts = this.lastTouches; - var x = inEvent.clientX, y = inEvent.clientY; - for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) { - // simulated mouse events will be swallowed near a primary touchend - var dx = Math.abs(x - t[0]), dy = Math.abs(y - t[1]); - if (dx <= ol.pointer.MouseSource.DEDUP_DIST && - dy <= ol.pointer.MouseSource.DEDUP_DIST) { - return true; - } - } - return false; -}; - - -/** - * Creates a copy of the original event that will be used - * for the fake pointer event. - * - * @param {goog.events.BrowserEvent} inEvent - * @param {ol.pointer.PointerEventHandler} dispatcher - * @return {Object} - */ -ol.pointer.MouseSource.prepareEvent = function(inEvent, dispatcher) { - var e = dispatcher.cloneEvent(inEvent, inEvent.getBrowserEvent()); - - // forward mouse preventDefault - var pd = e.preventDefault; - e.preventDefault = function() { - inEvent.preventDefault(); - pd(); - }; - - e.pointerId = ol.pointer.MouseSource.POINTER_ID; - e.isPrimary = true; - e.pointerType = ol.pointer.MouseSource.POINTER_TYPE; - - return e; -}; - - -/** - * Handler for `mousedown`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MouseSource.prototype.mousedown = function(inEvent) { - if (!this.isEventSimulatedFromTouch_(inEvent)) { - // TODO(dfreedman) workaround for some elements not sending mouseup - // http://crbug/149091 - if (ol.pointer.MouseSource.POINTER_ID.toString() in this.pointerMap) { - this.cancel(inEvent); - } - var e = ol.pointer.MouseSource.prepareEvent(inEvent, this.dispatcher); - this.pointerMap[ol.pointer.MouseSource.POINTER_ID.toString()] = inEvent; - this.dispatcher.down(e, inEvent); - } -}; - - -/** - * Handler for `mousemove`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MouseSource.prototype.mousemove = function(inEvent) { - if (!this.isEventSimulatedFromTouch_(inEvent)) { - var e = ol.pointer.MouseSource.prepareEvent(inEvent, this.dispatcher); - this.dispatcher.move(e, inEvent); - } -}; - - -/** - * Handler for `mouseup`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MouseSource.prototype.mouseup = function(inEvent) { - if (!this.isEventSimulatedFromTouch_(inEvent)) { - var p = this.pointerMap[ol.pointer.MouseSource.POINTER_ID.toString()]; - - if (p && p.button === inEvent.button) { - var e = ol.pointer.MouseSource.prepareEvent(inEvent, this.dispatcher); - this.dispatcher.up(e, inEvent); - this.cleanupMouse(); - } - } -}; - - -/** - * Handler for `mouseover`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MouseSource.prototype.mouseover = function(inEvent) { - if (!this.isEventSimulatedFromTouch_(inEvent)) { - var e = ol.pointer.MouseSource.prepareEvent(inEvent, this.dispatcher); - this.dispatcher.enterOver(e, inEvent); - } -}; - - -/** - * Handler for `mouseout`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MouseSource.prototype.mouseout = function(inEvent) { - if (!this.isEventSimulatedFromTouch_(inEvent)) { - var e = ol.pointer.MouseSource.prepareEvent(inEvent, this.dispatcher); - this.dispatcher.leaveOut(e, inEvent); - } -}; - - -/** - * Dispatches a `pointercancel` event. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MouseSource.prototype.cancel = function(inEvent) { - var e = ol.pointer.MouseSource.prepareEvent(inEvent, this.dispatcher); - this.dispatcher.cancel(e, inEvent); - this.cleanupMouse(); -}; - - -/** - * Remove the mouse from the list of active pointers. - */ -ol.pointer.MouseSource.prototype.cleanupMouse = function() { - delete this.pointerMap[ol.pointer.MouseSource.POINTER_ID.toString()]; -}; - -// Based on https://github.com/Polymer/PointerEvents - -// Copyright (c) 2013 The Polymer Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -goog.provide('ol.pointer.MsSource'); - -goog.require('ol.pointer.EventSource'); - - - -/** - * @param {ol.pointer.PointerEventHandler} dispatcher - * @constructor - * @extends {ol.pointer.EventSource} - */ -ol.pointer.MsSource = function(dispatcher) { - var mapping = { - 'MSPointerDown': this.msPointerDown, - 'MSPointerMove': this.msPointerMove, - 'MSPointerUp': this.msPointerUp, - 'MSPointerOut': this.msPointerOut, - 'MSPointerOver': this.msPointerOver, - 'MSPointerCancel': this.msPointerCancel, - 'MSGotPointerCapture': this.msGotPointerCapture, - 'MSLostPointerCapture': this.msLostPointerCapture - }; - goog.base(this, dispatcher, mapping); - - /** - * @const - * @type {Object.<string, goog.events.BrowserEvent|Object>} - */ - this.pointerMap = dispatcher.pointerMap; - - /** - * @const - * @type {Array.<string>} - */ - this.POINTER_TYPES = [ - '', - 'unavailable', - 'touch', - 'pen', - 'mouse' - ]; -}; -goog.inherits(ol.pointer.MsSource, ol.pointer.EventSource); - - -/** - * Creates a copy of the original event that will be used - * for the fake pointer event. - * - * @private - * @param {goog.events.BrowserEvent} inEvent - * @return {Object} - */ -ol.pointer.MsSource.prototype.prepareEvent_ = function(inEvent) { - var e = inEvent; - if (goog.isNumber(inEvent.getBrowserEvent().pointerType)) { - e = this.dispatcher.cloneEvent(inEvent, inEvent.getBrowserEvent()); - e.pointerType = this.POINTER_TYPES[inEvent.getBrowserEvent().pointerType]; - } - - return e; -}; - - -/** - * Remove this pointer from the list of active pointers. - * @param {number} pointerId - */ -ol.pointer.MsSource.prototype.cleanup = function(pointerId) { - delete this.pointerMap[pointerId.toString()]; -}; - - -/** - * Handler for `msPointerDown`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MsSource.prototype.msPointerDown = function(inEvent) { - this.pointerMap[inEvent.getBrowserEvent().pointerId.toString()] = inEvent; - var e = this.prepareEvent_(inEvent); - this.dispatcher.down(e, inEvent); -}; - - -/** - * Handler for `msPointerMove`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MsSource.prototype.msPointerMove = function(inEvent) { - var e = this.prepareEvent_(inEvent); - this.dispatcher.move(e, inEvent); -}; - - -/** - * Handler for `msPointerUp`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MsSource.prototype.msPointerUp = function(inEvent) { - var e = this.prepareEvent_(inEvent); - this.dispatcher.up(e, inEvent); - this.cleanup(inEvent.getBrowserEvent().pointerId); -}; - - -/** - * Handler for `msPointerOut`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MsSource.prototype.msPointerOut = function(inEvent) { - var e = this.prepareEvent_(inEvent); - this.dispatcher.leaveOut(e, inEvent); -}; - - -/** - * Handler for `msPointerOver`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MsSource.prototype.msPointerOver = function(inEvent) { - var e = this.prepareEvent_(inEvent); - this.dispatcher.enterOver(e, inEvent); -}; - - -/** - * Handler for `msPointerCancel`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MsSource.prototype.msPointerCancel = function(inEvent) { - var e = this.prepareEvent_(inEvent); - this.dispatcher.cancel(e, inEvent); - this.cleanup(inEvent.getBrowserEvent().pointerId); -}; - - -/** - * Handler for `msLostPointerCapture`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MsSource.prototype.msLostPointerCapture = function(inEvent) { - var e = this.dispatcher.makeEvent('lostpointercapture', - inEvent.getBrowserEvent(), inEvent); - this.dispatcher.dispatchEvent(e); -}; - - -/** - * Handler for `msGotPointerCapture`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.MsSource.prototype.msGotPointerCapture = function(inEvent) { - var e = this.dispatcher.makeEvent('gotpointercapture', - inEvent.getBrowserEvent(), inEvent); - this.dispatcher.dispatchEvent(e); -}; - -// Based on https://github.com/Polymer/PointerEvents - -// Copyright (c) 2013 The Polymer Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -goog.provide('ol.pointer.NativeSource'); - -goog.require('ol.pointer.EventSource'); - - - -/** - * @param {ol.pointer.PointerEventHandler} dispatcher - * @constructor - * @extends {ol.pointer.EventSource} - */ -ol.pointer.NativeSource = function(dispatcher) { - var mapping = { - 'pointerdown': this.pointerDown, - 'pointermove': this.pointerMove, - 'pointerup': this.pointerUp, - 'pointerout': this.pointerOut, - 'pointerover': this.pointerOver, - 'pointercancel': this.pointerCancel, - 'gotpointercapture': this.gotPointerCapture, - 'lostpointercapture': this.lostPointerCapture - }; - goog.base(this, dispatcher, mapping); -}; -goog.inherits(ol.pointer.NativeSource, ol.pointer.EventSource); - - -/** - * Handler for `pointerdown`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.NativeSource.prototype.pointerDown = function(inEvent) { - this.dispatcher.fireNativeEvent(inEvent); -}; - - -/** - * Handler for `pointermove`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.NativeSource.prototype.pointerMove = function(inEvent) { - this.dispatcher.fireNativeEvent(inEvent); -}; - - -/** - * Handler for `pointerup`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.NativeSource.prototype.pointerUp = function(inEvent) { - this.dispatcher.fireNativeEvent(inEvent); -}; - - -/** - * Handler for `pointerout`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.NativeSource.prototype.pointerOut = function(inEvent) { - this.dispatcher.fireNativeEvent(inEvent); -}; - - -/** - * Handler for `pointerover`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.NativeSource.prototype.pointerOver = function(inEvent) { - this.dispatcher.fireNativeEvent(inEvent); -}; - - -/** - * Handler for `pointercancel`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.NativeSource.prototype.pointerCancel = function(inEvent) { - this.dispatcher.fireNativeEvent(inEvent); -}; - - -/** - * Handler for `lostpointercapture`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.NativeSource.prototype.lostPointerCapture = function(inEvent) { - this.dispatcher.fireNativeEvent(inEvent); -}; - - -/** - * Handler for `gotpointercapture`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.NativeSource.prototype.gotPointerCapture = function(inEvent) { - this.dispatcher.fireNativeEvent(inEvent); -}; - -// Based on https://github.com/Polymer/PointerEvents - -// Copyright (c) 2013 The Polymer Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -goog.provide('ol.pointer.TouchSource'); - -goog.require('goog.array'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.pointer.EventSource'); -goog.require('ol.pointer.MouseSource'); - - - -/** - * @constructor - * @param {ol.pointer.PointerEventHandler} dispatcher - * @param {ol.pointer.MouseSource} mouseSource - * @extends {ol.pointer.EventSource} - */ -ol.pointer.TouchSource = function(dispatcher, mouseSource) { - var mapping = { - 'touchstart': this.touchstart, - 'touchmove': this.touchmove, - 'touchend': this.touchend, - 'touchcancel': this.touchcancel - }; - goog.base(this, dispatcher, mapping); - - /** - * @const - * @type {Object.<string, goog.events.BrowserEvent|Object>} - */ - this.pointerMap = dispatcher.pointerMap; - - /** - * @const - * @type {ol.pointer.MouseSource} - */ - this.mouseSource = mouseSource; - - /** - * @private - * @type {number|undefined} - */ - this.firstTouchId_ = undefined; - - /** - * @private - * @type {number} - */ - this.clickCount_ = 0; - - /** - * @private - * @type {number|undefined} - */ - this.resetId_ = undefined; -}; -goog.inherits(ol.pointer.TouchSource, ol.pointer.EventSource); - - -/** - * Mouse event timeout: This should be long enough to - * ignore compat mouse events made by touch. - * @const - * @type {number} - */ -ol.pointer.TouchSource.DEDUP_TIMEOUT = 2500; - - -/** - * @const - * @type {number} - */ -ol.pointer.TouchSource.CLICK_COUNT_TIMEOUT = 200; - - -/** - * @const - * @type {string} - */ -ol.pointer.TouchSource.POINTER_TYPE = 'touch'; - - -/** - * @private - * @param {Touch} inTouch - * @return {boolean} True, if this is the primary touch. - */ -ol.pointer.TouchSource.prototype.isPrimaryTouch_ = function(inTouch) { - return this.firstTouchId_ === inTouch.identifier; -}; - - -/** - * Set primary touch if there are no pointers, or the only pointer is the mouse. - * @param {Touch} inTouch - * @private - */ -ol.pointer.TouchSource.prototype.setPrimaryTouch_ = function(inTouch) { - var count = goog.object.getCount(this.pointerMap); - if (count === 0 || (count === 1 && goog.object.containsKey(this.pointerMap, - ol.pointer.MouseSource.POINTER_ID.toString()))) { - this.firstTouchId_ = inTouch.identifier; - this.cancelResetClickCount_(); - } -}; - - -/** - * @private - * @param {Object} inPointer - */ -ol.pointer.TouchSource.prototype.removePrimaryPointer_ = function(inPointer) { - if (inPointer.isPrimary) { - this.firstTouchId_ = undefined; - this.resetClickCount_(); - } -}; - - -/** - * @private - */ -ol.pointer.TouchSource.prototype.resetClickCount_ = function() { - this.resetId_ = goog.global.setTimeout( - goog.bind(this.resetClickCountHandler_, this), - ol.pointer.TouchSource.CLICK_COUNT_TIMEOUT); -}; - - -/** - * @private - */ -ol.pointer.TouchSource.prototype.resetClickCountHandler_ = function() { - this.clickCount_ = 0; - this.resetId_ = undefined; -}; - - -/** - * @private - */ -ol.pointer.TouchSource.prototype.cancelResetClickCount_ = function() { - if (this.resetId_ !== undefined) { - goog.global.clearTimeout(this.resetId_); - } -}; - - -/** - * @private - * @param {goog.events.BrowserEvent} browserEvent Browser event - * @param {Touch} inTouch Touch event - * @return {Object} - */ -ol.pointer.TouchSource.prototype.touchToPointer_ = - function(browserEvent, inTouch) { - var e = this.dispatcher.cloneEvent(browserEvent, inTouch); - // Spec specifies that pointerId 1 is reserved for Mouse. - // Touch identifiers can start at 0. - // Add 2 to the touch identifier for compatibility. - e.pointerId = inTouch.identifier + 2; - // TODO: check if this is necessary? - //e.target = findTarget(e); - e.bubbles = true; - e.cancelable = true; - e.detail = this.clickCount_; - e.button = 0; - e.buttons = 1; - e.width = inTouch.webkitRadiusX || inTouch.radiusX || 0; - e.height = inTouch.webkitRadiusY || inTouch.radiusY || 0; - e.pressure = inTouch.webkitForce || inTouch.force || 0.5; - e.isPrimary = this.isPrimaryTouch_(inTouch); - e.pointerType = ol.pointer.TouchSource.POINTER_TYPE; - - // make sure that the properties that are different for - // each `Touch` object are not copied from the BrowserEvent object - e.clientX = inTouch.clientX; - e.clientY = inTouch.clientY; - e.screenX = inTouch.screenX; - e.screenY = inTouch.screenY; - - return e; -}; - - -/** - * @private - * @param {goog.events.BrowserEvent} inEvent Touch event - * @param {function(goog.events.BrowserEvent, Object)} inFunction - */ -ol.pointer.TouchSource.prototype.processTouches_ = - function(inEvent, inFunction) { - var touches = Array.prototype.slice.call( - inEvent.getBrowserEvent().changedTouches); - var count = touches.length; - function preventDefault() { - inEvent.preventDefault(); - } - var i, pointer; - for (i = 0; i < count; ++i) { - pointer = this.touchToPointer_(inEvent, touches[i]); - // forward touch preventDefaults - pointer.preventDefault = preventDefault; - inFunction.call(this, inEvent, pointer); - } -}; - - -/** - * @private - * @param {TouchList} touchList - * @param {number} searchId - * @return {boolean} True, if the `Touch` with the given id is in the list. - */ -ol.pointer.TouchSource.prototype.findTouch_ = function(touchList, searchId) { - var l = touchList.length; - var touch; - for (var i = 0; i < l; i++) { - touch = touchList[i]; - if (touch.identifier === searchId) { - return true; - } - } - return false; -}; - - -/** - * In some instances, a touchstart can happen without a touchend. This - * leaves the pointermap in a broken state. - * Therefore, on every touchstart, we remove the touches that did not fire a - * touchend event. - * To keep state globally consistent, we fire a pointercancel for - * this "abandoned" touch - * - * @private - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.TouchSource.prototype.vacuumTouches_ = function(inEvent) { - var touchList = inEvent.getBrowserEvent().touches; - // pointerMap.getCount() should be < touchList.length here, - // as the touchstart has not been processed yet. - var keys = goog.object.getKeys(this.pointerMap); - var count = keys.length; - if (count >= touchList.length) { - var d = []; - var i, key, value; - for (i = 0; i < count; ++i) { - key = keys[i]; - value = this.pointerMap[key]; - // Never remove pointerId == 1, which is mouse. - // Touch identifiers are 2 smaller than their pointerId, which is the - // index in pointermap. - if (key != ol.pointer.MouseSource.POINTER_ID && - !this.findTouch_(touchList, key - 2)) { - d.push(value.out); - } - } - for (i = 0; i < d.length; ++i) { - this.cancelOut_(inEvent, d[i]); - } - } -}; - - -/** - * Handler for `touchstart`, triggers `pointerover`, - * `pointerenter` and `pointerdown` events. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.TouchSource.prototype.touchstart = function(inEvent) { - this.vacuumTouches_(inEvent); - this.setPrimaryTouch_(inEvent.getBrowserEvent().changedTouches[0]); - this.dedupSynthMouse_(inEvent); - this.clickCount_++; - this.processTouches_(inEvent, this.overDown_); -}; - - -/** - * @private - * @param {goog.events.BrowserEvent} browserEvent - * @param {Object} inPointer - */ -ol.pointer.TouchSource.prototype.overDown_ = function(browserEvent, inPointer) { - this.pointerMap[inPointer.pointerId] = { - target: inPointer.target, - out: inPointer, - outTarget: inPointer.target - }; - this.dispatcher.over(inPointer, browserEvent); - this.dispatcher.enter(inPointer, browserEvent); - this.dispatcher.down(inPointer, browserEvent); -}; - - -/** - * Handler for `touchmove`. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.TouchSource.prototype.touchmove = function(inEvent) { - inEvent.preventDefault(); - this.processTouches_(inEvent, this.moveOverOut_); -}; - - -/** - * @private - * @param {goog.events.BrowserEvent} browserEvent - * @param {Object} inPointer - */ -ol.pointer.TouchSource.prototype.moveOverOut_ = - function(browserEvent, inPointer) { - var event = inPointer; - var pointer = this.pointerMap[event.pointerId]; - // a finger drifted off the screen, ignore it - if (!pointer) { - return; - } - var outEvent = pointer.out; - var outTarget = pointer.outTarget; - this.dispatcher.move(event, browserEvent); - if (outEvent && outTarget !== event.target) { - outEvent.relatedTarget = event.target; - event.relatedTarget = outTarget; - // recover from retargeting by shadow - outEvent.target = outTarget; - if (event.target) { - this.dispatcher.leaveOut(outEvent, browserEvent); - this.dispatcher.enterOver(event, browserEvent); - } else { - // clean up case when finger leaves the screen - event.target = outTarget; - event.relatedTarget = null; - this.cancelOut_(browserEvent, event); - } - } - pointer.out = event; - pointer.outTarget = event.target; -}; - - -/** - * Handler for `touchend`, triggers `pointerup`, - * `pointerout` and `pointerleave` events. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.TouchSource.prototype.touchend = function(inEvent) { - this.dedupSynthMouse_(inEvent); - this.processTouches_(inEvent, this.upOut_); -}; - - -/** - * @private - * @param {goog.events.BrowserEvent} browserEvent - * @param {Object} inPointer - */ -ol.pointer.TouchSource.prototype.upOut_ = function(browserEvent, inPointer) { - this.dispatcher.up(inPointer, browserEvent); - this.dispatcher.out(inPointer, browserEvent); - this.dispatcher.leave(inPointer, browserEvent); - this.cleanUpPointer_(inPointer); -}; - - -/** - * Handler for `touchcancel`, triggers `pointercancel`, - * `pointerout` and `pointerleave` events. - * - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.TouchSource.prototype.touchcancel = function(inEvent) { - this.processTouches_(inEvent, this.cancelOut_); -}; - - -/** - * @private - * @param {goog.events.BrowserEvent} browserEvent - * @param {Object} inPointer - */ -ol.pointer.TouchSource.prototype.cancelOut_ = - function(browserEvent, inPointer) { - this.dispatcher.cancel(inPointer, browserEvent); - this.dispatcher.out(inPointer, browserEvent); - this.dispatcher.leave(inPointer, browserEvent); - this.cleanUpPointer_(inPointer); -}; - - -/** - * @private - * @param {Object} inPointer - */ -ol.pointer.TouchSource.prototype.cleanUpPointer_ = function(inPointer) { - delete this.pointerMap[inPointer.pointerId]; - this.removePrimaryPointer_(inPointer); -}; - - -/** - * Prevent synth mouse events from creating pointer events. - * - * @private - * @param {goog.events.BrowserEvent} inEvent - */ -ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) { - var lts = this.mouseSource.lastTouches; - var t = inEvent.getBrowserEvent().changedTouches[0]; - // only the primary finger will synth mouse events - if (this.isPrimaryTouch_(t)) { - // remember x/y of last touch - var lt = /** @type {ol.Pixel} */ ([t.clientX, t.clientY]); - lts.push(lt); - - goog.global.setTimeout(function() { - // remove touch after timeout - goog.array.remove(lts, lt); - }, ol.pointer.TouchSource.DEDUP_TIMEOUT); - } -}; - -// Based on https://github.com/Polymer/PointerEvents - -// Copyright (c) 2013 The Polymer Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -goog.provide('ol.pointer.PointerEventHandler'); - -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.BrowserEvent'); -goog.require('goog.events.EventTarget'); - -goog.require('ol.has'); -goog.require('ol.pointer.MouseSource'); -goog.require('ol.pointer.MsSource'); -goog.require('ol.pointer.NativeSource'); -goog.require('ol.pointer.PointerEvent'); -goog.require('ol.pointer.TouchSource'); - - - -/** - * @constructor - * @extends {goog.events.EventTarget} - * @param {Element|HTMLDocument} element Viewport element. - */ -ol.pointer.PointerEventHandler = function(element) { - goog.base(this); - - /** - * @const - * @private - * @type {Element|HTMLDocument} - */ - this.element_ = element; - - /** - * @const - * @type {Object.<string, goog.events.BrowserEvent|Object>} - */ - this.pointerMap = {}; - - /** - * @type {Object.<string, function(goog.events.BrowserEvent)>} - * @private - */ - this.eventMap_ = {}; - - /** - * @type {Array.<ol.pointer.EventSource>} - * @private - */ - this.eventSourceList_ = []; - - this.registerSources(); -}; -goog.inherits(ol.pointer.PointerEventHandler, goog.events.EventTarget); - - -/** - * Set up the event sources (mouse, touch and native pointers) - * that generate pointer events. - */ -ol.pointer.PointerEventHandler.prototype.registerSources = function() { - if (ol.has.POINTER) { - this.registerSource('native', new ol.pointer.NativeSource(this)); - } else if (ol.has.MSPOINTER) { - this.registerSource('ms', new ol.pointer.MsSource(this)); - } else { - var mouseSource = new ol.pointer.MouseSource(this); - this.registerSource('mouse', mouseSource); - - if (ol.has.TOUCH) { - this.registerSource('touch', - new ol.pointer.TouchSource(this, mouseSource)); - } - } - - // register events on the viewport element - this.register_(); -}; - - -/** - * Add a new event source that will generate pointer events. - * - * @param {string} name A name for the event source - * @param {ol.pointer.EventSource} source - */ -ol.pointer.PointerEventHandler.prototype.registerSource = - function(name, source) { - var s = source; - var newEvents = s.getEvents(); - - if (newEvents) { - newEvents.forEach(function(e) { - var handler = s.getHandlerForEvent(e); - - if (handler) { - this.eventMap_[e] = goog.bind(handler, s); - } - }, this); - this.eventSourceList_.push(s); - } -}; - - -/** - * Set up the events for all registered event sources. - * @private - */ -ol.pointer.PointerEventHandler.prototype.register_ = function() { - var l = this.eventSourceList_.length; - var eventSource; - for (var i = 0; i < l; i++) { - eventSource = this.eventSourceList_[i]; - this.addEvents_(eventSource.getEvents()); - } -}; - - -/** - * Remove all registered events. - * @private - */ -ol.pointer.PointerEventHandler.prototype.unregister_ = function() { - var l = this.eventSourceList_.length; - var eventSource; - for (var i = 0; i < l; i++) { - eventSource = this.eventSourceList_[i]; - this.removeEvents_(eventSource.getEvents()); - } -}; - - -/** - * Calls the right handler for a new event. - * @private - * @param {goog.events.BrowserEvent} inEvent Browser event. - */ -ol.pointer.PointerEventHandler.prototype.eventHandler_ = function(inEvent) { - var type = inEvent.type; - var handler = this.eventMap_[type]; - if (handler) { - handler(inEvent); - } -}; - - -/** - * Setup listeners for the given events. - * @private - * @param {Array.<string>} events List of events. - */ -ol.pointer.PointerEventHandler.prototype.addEvents_ = function(events) { - events.forEach(function(eventName) { - goog.events.listen(this.element_, eventName, - this.eventHandler_, false, this); - }, this); -}; - - -/** - * Unregister listeners for the given events. - * @private - * @param {Array.<string>} events List of events. - */ -ol.pointer.PointerEventHandler.prototype.removeEvents_ = function(events) { - events.forEach(function(e) { - goog.events.unlisten(this.element_, e, - this.eventHandler_, false, this); - }, this); -}; - - -/** - * Returns a snapshot of inEvent, with writable properties. - * - * @param {goog.events.BrowserEvent} browserEvent Browser event. - * @param {Event|Touch} inEvent An event that contains - * properties to copy. - * @return {Object} An object containing shallow copies of - * `inEvent`'s properties. - */ -ol.pointer.PointerEventHandler.prototype.cloneEvent = - function(browserEvent, inEvent) { - var eventCopy = {}, p; - for (var i = 0, ii = ol.pointer.CLONE_PROPS.length; i < ii; i++) { - p = ol.pointer.CLONE_PROPS[i][0]; - eventCopy[p] = - browserEvent[p] || - inEvent[p] || - ol.pointer.CLONE_PROPS[i][1]; - } - - return eventCopy; -}; - - -// EVENTS - - -/** - * Triggers a 'pointerdown' event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.down = - function(pointerEventData, browserEvent) { - this.fireEvent(ol.pointer.EventType.POINTERDOWN, - pointerEventData, browserEvent); -}; - - -/** - * Triggers a 'pointermove' event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.move = - function(pointerEventData, browserEvent) { - this.fireEvent(ol.pointer.EventType.POINTERMOVE, - pointerEventData, browserEvent); -}; - - -/** - * Triggers a 'pointerup' event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.up = - function(pointerEventData, browserEvent) { - this.fireEvent(ol.pointer.EventType.POINTERUP, - pointerEventData, browserEvent); -}; - - -/** - * Triggers a 'pointerenter' event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.enter = - function(pointerEventData, browserEvent) { - pointerEventData.bubbles = false; - this.fireEvent(ol.pointer.EventType.POINTERENTER, - pointerEventData, browserEvent); -}; - - -/** - * Triggers a 'pointerleave' event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.leave = - function(pointerEventData, browserEvent) { - pointerEventData.bubbles = false; - this.fireEvent(ol.pointer.EventType.POINTERLEAVE, - pointerEventData, browserEvent); -}; - - -/** - * Triggers a 'pointerover' event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.over = - function(pointerEventData, browserEvent) { - pointerEventData.bubbles = true; - this.fireEvent(ol.pointer.EventType.POINTEROVER, - pointerEventData, browserEvent); -}; - - -/** - * Triggers a 'pointerout' event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.out = - function(pointerEventData, browserEvent) { - pointerEventData.bubbles = true; - this.fireEvent(ol.pointer.EventType.POINTEROUT, - pointerEventData, browserEvent); -}; - - -/** - * Triggers a 'pointercancel' event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.cancel = - function(pointerEventData, browserEvent) { - this.fireEvent(ol.pointer.EventType.POINTERCANCEL, - pointerEventData, browserEvent); -}; - - -/** - * Triggers a combination of 'pointerout' and 'pointerleave' events. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.leaveOut = - function(pointerEventData, browserEvent) { - this.out(pointerEventData, browserEvent); - if (!this.contains_( - pointerEventData.target, - pointerEventData.relatedTarget)) { - this.leave(pointerEventData, browserEvent); - } -}; - - -/** - * Triggers a combination of 'pointerover' and 'pointerevents' events. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.enterOver = - function(pointerEventData, browserEvent) { - this.over(pointerEventData, browserEvent); - if (!this.contains_( - pointerEventData.target, - pointerEventData.relatedTarget)) { - this.enter(pointerEventData, browserEvent); - } -}; - - -/** - * @private - * @param {Element} container - * @param {Element} contained - * @return {boolean} Returns true if the container element - * contains the other element. - */ -ol.pointer.PointerEventHandler.prototype.contains_ = - function(container, contained) { - if (!contained) { - return false; - } - return goog.dom.contains(container, contained); -}; - - -// EVENT CREATION AND TRACKING -/** - * Creates a new Event of type `inType`, based on the information in - * `pointerEventData`. - * - * @param {string} inType A string representing the type of event to create. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - * @return {ol.pointer.PointerEvent} A PointerEvent of type `inType`. - */ -ol.pointer.PointerEventHandler.prototype.makeEvent = - function(inType, pointerEventData, browserEvent) { - return new ol.pointer.PointerEvent(inType, browserEvent, pointerEventData); -}; - - -/** - * Make and dispatch an event in one call. - * @param {string} inType A string representing the type of event. - * @param {Object} pointerEventData - * @param {goog.events.BrowserEvent } browserEvent - */ -ol.pointer.PointerEventHandler.prototype.fireEvent = - function(inType, pointerEventData, browserEvent) { - var e = this.makeEvent(inType, pointerEventData, browserEvent); - this.dispatchEvent(e); -}; - - -/** - * Creates a pointer event from a native pointer event - * and dispatches this event. - * @param {goog.events.BrowserEvent} nativeEvent A platform event with a target. - */ -ol.pointer.PointerEventHandler.prototype.fireNativeEvent = - function(nativeEvent) { - var e = this.makeEvent(nativeEvent.type, nativeEvent.getBrowserEvent(), - nativeEvent); - this.dispatchEvent(e); -}; - - -/** - * Wrap a native mouse event into a pointer event. - * This proxy method is required for the legacy IE support. - * @param {string} eventType The pointer event type. - * @param {goog.events.BrowserEvent} browserEvent - * @return {ol.pointer.PointerEvent} - */ -ol.pointer.PointerEventHandler.prototype.wrapMouseEvent = - function(eventType, browserEvent) { - var pointerEvent = this.makeEvent( - eventType, - ol.pointer.MouseSource.prepareEvent(browserEvent, this), - browserEvent - ); - return pointerEvent; -}; - - -/** - * @inheritDoc - */ -ol.pointer.PointerEventHandler.prototype.disposeInternal = function() { - this.unregister_(); - goog.base(this, 'disposeInternal'); -}; - - -/** - * Constants for event names. - * @enum {string} - */ -ol.pointer.EventType = { - POINTERMOVE: 'pointermove', - POINTERDOWN: 'pointerdown', - POINTERUP: 'pointerup', - POINTEROVER: 'pointerover', - POINTEROUT: 'pointerout', - POINTERENTER: 'pointerenter', - POINTERLEAVE: 'pointerleave', - POINTERCANCEL: 'pointercancel' -}; - - -/** - * Properties to copy when cloning an event, with default values. - * @type {Array.<Array>} - */ -ol.pointer.CLONE_PROPS = [ - // MouseEvent - ['bubbles', false], - ['cancelable', false], - ['view', null], - ['detail', null], - ['screenX', 0], - ['screenY', 0], - ['clientX', 0], - ['clientY', 0], - ['ctrlKey', false], - ['altKey', false], - ['shiftKey', false], - ['metaKey', false], - ['button', 0], - ['relatedTarget', null], - // DOM Level 3 - ['buttons', 0], - // PointerEvent - ['pointerId', 0], - ['width', 0], - ['height', 0], - ['pressure', 0], - ['tiltX', 0], - ['tiltY', 0], - ['pointerType', ''], - ['hwTimestamp', 0], - ['isPrimary', false], - // event instance - ['type', ''], - ['target', null], - ['currentTarget', null], - ['which', 0] -]; - -goog.provide('ol.MapBrowserEvent'); -goog.provide('ol.MapBrowserEvent.EventType'); -goog.provide('ol.MapBrowserEventHandler'); -goog.provide('ol.MapBrowserPointerEvent'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.BrowserEvent'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Coordinate'); -goog.require('ol.MapEvent'); -goog.require('ol.Pixel'); -goog.require('ol.pointer.PointerEvent'); -goog.require('ol.pointer.PointerEventHandler'); - - - -/** - * @classdesc - * Events emitted as map browser events are instances of this type. - * See {@link ol.Map} for which events trigger a map browser event. - * - * @constructor - * @extends {ol.MapEvent} - * @implements {oli.MapBrowserEvent} - * @param {string} type Event type. - * @param {ol.Map} map Map. - * @param {goog.events.BrowserEvent} browserEvent Browser event. - * @param {boolean=} opt_dragging Is the map currently being dragged? - * @param {?olx.FrameState=} opt_frameState Frame state. - */ -ol.MapBrowserEvent = function(type, map, browserEvent, opt_dragging, - opt_frameState) { - - goog.base(this, type, map, opt_frameState); - - /** - * @const - * @type {goog.events.BrowserEvent} - */ - this.browserEvent = browserEvent; - - /** - * The original browser event. - * @const - * @type {Event} - * @api stable - */ - this.originalEvent = browserEvent.getBrowserEvent(); - - /** - * The pixel of the original browser event. - * @type {ol.Pixel} - * @api stable - */ - this.pixel = map.getEventPixel(this.originalEvent); - - /** - * The coordinate of the original browser event. - * @type {ol.Coordinate} - * @api stable - */ - this.coordinate = map.getCoordinateFromPixel(this.pixel); - - /** - * Indicates if the map is currently being dragged. Only set for - * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`. - * - * @type {boolean} - * @api stable - */ - this.dragging = opt_dragging !== undefined ? opt_dragging : false; - -}; -goog.inherits(ol.MapBrowserEvent, ol.MapEvent); - - -/** - * Prevents the default browser action. - * @see https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault - * @override - * @api stable - */ -ol.MapBrowserEvent.prototype.preventDefault = function() { - goog.base(this, 'preventDefault'); - this.browserEvent.preventDefault(); -}; - - -/** - * Prevents further propagation of the current event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation - * @override - * @api stable - */ -ol.MapBrowserEvent.prototype.stopPropagation = function() { - goog.base(this, 'stopPropagation'); - this.browserEvent.stopPropagation(); -}; - - - -/** - * @constructor - * @extends {ol.MapBrowserEvent} - * @param {string} type Event type. - * @param {ol.Map} map Map. - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @param {boolean=} opt_dragging Is the map currently being dragged? - * @param {?olx.FrameState=} opt_frameState Frame state. - */ -ol.MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging, - opt_frameState) { - - goog.base(this, type, map, pointerEvent.browserEvent, opt_dragging, - opt_frameState); - - /** - * @const - * @type {ol.pointer.PointerEvent} - */ - this.pointerEvent = pointerEvent; - -}; -goog.inherits(ol.MapBrowserPointerEvent, ol.MapBrowserEvent); - - - -/** - * @param {ol.Map} map The map with the viewport to listen to events on. - * @constructor - * @extends {goog.events.EventTarget} - */ -ol.MapBrowserEventHandler = function(map) { - - goog.base(this); - - /** - * This is the element that we will listen to the real events on. - * @type {ol.Map} - * @private - */ - this.map_ = map; - - /** - * @type {number} - * @private - */ - this.clickTimeoutId_ = 0; - - /** - * @type {boolean} - * @private - */ - this.dragging_ = false; - - /** - * @type {Array.<goog.events.Key>} - * @private - */ - this.dragListenerKeys_ = null; - - /** - * @type {goog.events.Key} - * @private - */ - this.pointerdownListenerKey_ = null; - - /** - * The most recent "down" type event (or null if none have occurred). - * Set on pointerdown. - * @type {ol.pointer.PointerEvent} - * @private - */ - this.down_ = null; - - var element = this.map_.getViewport(); - - /** - * @type {number} - * @private - */ - this.activePointers_ = 0; - - /** - * @type {Object.<number, boolean>} - * @private - */ - this.trackedTouches_ = {}; - - /** - * Event handler which generates pointer events for - * the viewport element. - * - * @type {ol.pointer.PointerEventHandler} - * @private - */ - this.pointerEventHandler_ = new ol.pointer.PointerEventHandler(element); - - /** - * Event handler which generates pointer events for - * the document (used when dragging). - * - * @type {ol.pointer.PointerEventHandler} - * @private - */ - this.documentPointerEventHandler_ = null; - - this.pointerdownListenerKey_ = goog.events.listen(this.pointerEventHandler_, - ol.pointer.EventType.POINTERDOWN, - this.handlePointerDown_, false, this); - - this.relayedListenerKey_ = goog.events.listen(this.pointerEventHandler_, - ol.pointer.EventType.POINTERMOVE, - this.relayEvent_, false, this); - -}; -goog.inherits(ol.MapBrowserEventHandler, goog.events.EventTarget); - - -/** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @private - */ -ol.MapBrowserEventHandler.prototype.emulateClick_ = function(pointerEvent) { - var newEvent; - newEvent = new ol.MapBrowserPointerEvent( - ol.MapBrowserEvent.EventType.CLICK, this.map_, pointerEvent); - this.dispatchEvent(newEvent); - if (this.clickTimeoutId_ !== 0) { - // double-click - goog.global.clearTimeout(this.clickTimeoutId_); - this.clickTimeoutId_ = 0; - newEvent = new ol.MapBrowserPointerEvent( - ol.MapBrowserEvent.EventType.DBLCLICK, this.map_, pointerEvent); - this.dispatchEvent(newEvent); - } else { - // click - this.clickTimeoutId_ = goog.global.setTimeout(goog.bind(function() { - this.clickTimeoutId_ = 0; - var newEvent = new ol.MapBrowserPointerEvent( - ol.MapBrowserEvent.EventType.SINGLECLICK, this.map_, pointerEvent); - this.dispatchEvent(newEvent); - }, this), 250); - } -}; - - -/** - * Keeps track on how many pointers are currently active. - * - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @private - */ -ol.MapBrowserEventHandler.prototype.updateActivePointers_ = - function(pointerEvent) { - var event = pointerEvent; - - if (event.type == ol.MapBrowserEvent.EventType.POINTERUP || - event.type == ol.MapBrowserEvent.EventType.POINTERCANCEL) { - delete this.trackedTouches_[event.pointerId]; - } else if (event.type == ol.MapBrowserEvent.EventType.POINTERDOWN) { - this.trackedTouches_[event.pointerId] = true; - } - this.activePointers_ = goog.object.getCount(this.trackedTouches_); -}; - - -/** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @private - */ -ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) { - this.updateActivePointers_(pointerEvent); - var newEvent = new ol.MapBrowserPointerEvent( - ol.MapBrowserEvent.EventType.POINTERUP, this.map_, pointerEvent); - this.dispatchEvent(newEvent); - - // We emulate click events on left mouse button click, touch contact, and pen - // contact. isMouseActionButton returns true in these cases (evt.button is set - // to 0). - // See http://www.w3.org/TR/pointerevents/#button-states - if (!this.dragging_ && this.isMouseActionButton_(pointerEvent)) { - goog.asserts.assert(this.down_, 'this.down_ must be truthy'); - this.emulateClick_(this.down_); - } - - goog.asserts.assert(this.activePointers_ >= 0, - 'this.activePointers_ should be equal to or larger than 0'); - if (this.activePointers_ === 0) { - this.dragListenerKeys_.forEach(goog.events.unlistenByKey); - this.dragListenerKeys_ = null; - this.dragging_ = false; - this.down_ = null; - goog.dispose(this.documentPointerEventHandler_); - this.documentPointerEventHandler_ = null; - } -}; - - -/** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @return {boolean} If the left mouse button was pressed. - * @private - */ -ol.MapBrowserEventHandler.prototype.isMouseActionButton_ = - function(pointerEvent) { - return pointerEvent.button === 0; -}; - - -/** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @private - */ -ol.MapBrowserEventHandler.prototype.handlePointerDown_ = - function(pointerEvent) { - this.updateActivePointers_(pointerEvent); - var newEvent = new ol.MapBrowserPointerEvent( - ol.MapBrowserEvent.EventType.POINTERDOWN, this.map_, pointerEvent); - this.dispatchEvent(newEvent); - - this.down_ = pointerEvent; - - if (!this.dragListenerKeys_) { - /* Set up a pointer event handler on the `document`, - * which is required when the pointer is moved outside - * the viewport when dragging. - */ - this.documentPointerEventHandler_ = - new ol.pointer.PointerEventHandler(document); - - this.dragListenerKeys_ = [ - goog.events.listen(this.documentPointerEventHandler_, - ol.MapBrowserEvent.EventType.POINTERMOVE, - this.handlePointerMove_, false, this), - goog.events.listen(this.documentPointerEventHandler_, - ol.MapBrowserEvent.EventType.POINTERUP, - this.handlePointerUp_, false, this), - /* Note that the listener for `pointercancel is set up on - * `pointerEventHandler_` and not `documentPointerEventHandler_` like - * the `pointerup` and `pointermove` listeners. - * - * The reason for this is the following: `TouchSource.vacuumTouches_()` - * issues `pointercancel` events, when there was no `touchend` for a - * `touchstart`. Now, let's say a first `touchstart` is registered on - * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up. - * But `documentPointerEventHandler_` doesn't know about the first - * `touchstart`. If there is no `touchend` for the `touchstart`, we can - * only receive a `touchcancel` from `pointerEventHandler_`, because it is - * only registered there. - */ - goog.events.listen(this.pointerEventHandler_, - ol.MapBrowserEvent.EventType.POINTERCANCEL, - this.handlePointerUp_, false, this) - ]; - } -}; - - -/** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @private - */ -ol.MapBrowserEventHandler.prototype.handlePointerMove_ = - function(pointerEvent) { - // Fix IE10 on windows Surface : When you tap the tablet, it triggers - // multiple pointermove events between pointerdown and pointerup with - // the exact same coordinates of the pointerdown event. To avoid a - // 'false' touchmove event to be dispatched , we test if the pointer - // effectively moved. - if (this.isMoving_(pointerEvent)) { - this.dragging_ = true; - var newEvent = new ol.MapBrowserPointerEvent( - ol.MapBrowserEvent.EventType.POINTERDRAG, this.map_, pointerEvent, - this.dragging_); - this.dispatchEvent(newEvent); - } - - // Some native android browser triggers mousemove events during small period - // of time. See: https://code.google.com/p/android/issues/detail?id=5491 or - // https://code.google.com/p/android/issues/detail?id=19827 - // ex: Galaxy Tab P3110 + Android 4.1.1 - pointerEvent.preventDefault(); -}; - - -/** - * Wrap and relay a pointer event. Note that this requires that the type - * string for the MapBrowserPointerEvent matches the PointerEvent type. - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @private - */ -ol.MapBrowserEventHandler.prototype.relayEvent_ = function(pointerEvent) { - var dragging = !!(this.down_ && this.isMoving_(pointerEvent)); - this.dispatchEvent(new ol.MapBrowserPointerEvent( - pointerEvent.type, this.map_, pointerEvent, dragging)); -}; - - -/** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. - * @return {boolean} - * @private - */ -ol.MapBrowserEventHandler.prototype.isMoving_ = function(pointerEvent) { - return pointerEvent.clientX != this.down_.clientX || - pointerEvent.clientY != this.down_.clientY; -}; - - -/** - * @inheritDoc - */ -ol.MapBrowserEventHandler.prototype.disposeInternal = function() { - if (this.relayedListenerKey_) { - goog.events.unlistenByKey(this.relayedListenerKey_); - this.relayedListenerKey_ = null; - } - if (this.pointerdownListenerKey_) { - goog.events.unlistenByKey(this.pointerdownListenerKey_); - this.pointerdownListenerKey_ = null; - } - if (this.dragListenerKeys_) { - this.dragListenerKeys_.forEach(goog.events.unlistenByKey); - this.dragListenerKeys_ = null; - } - if (this.documentPointerEventHandler_) { - goog.dispose(this.documentPointerEventHandler_); - this.documentPointerEventHandler_ = null; - } - if (this.pointerEventHandler_) { - goog.dispose(this.pointerEventHandler_); - this.pointerEventHandler_ = null; - } - goog.base(this, 'disposeInternal'); -}; - - -/** - * Constants for event names. - * @enum {string} - */ -ol.MapBrowserEvent.EventType = { - - /** - * A true single click with no dragging and no double click. Note that this - * event is delayed by 250 ms to ensure that it is not a double click. - * @event ol.MapBrowserEvent#singleclick - * @api stable - */ - SINGLECLICK: 'singleclick', - - /** - * A click with no dragging. A double click will fire two of this. - * @event ol.MapBrowserEvent#click - * @api stable - */ - CLICK: goog.events.EventType.CLICK, - - /** - * A true double click, with no dragging. - * @event ol.MapBrowserEvent#dblclick - * @api stable - */ - DBLCLICK: goog.events.EventType.DBLCLICK, - - /** - * Triggered when a pointer is dragged. - * @event ol.MapBrowserEvent#pointerdrag - * @api - */ - POINTERDRAG: 'pointerdrag', - - /** - * Triggered when a pointer is moved. Note that on touch devices this is - * triggered when the map is panned, so is not the same as mousemove. - * @event ol.MapBrowserEvent#pointermove - * @api stable - */ - POINTERMOVE: 'pointermove', - - POINTERDOWN: 'pointerdown', - POINTERUP: 'pointerup', - POINTEROVER: 'pointerover', - POINTEROUT: 'pointerout', - POINTERENTER: 'pointerenter', - POINTERLEAVE: 'pointerleave', - POINTERCANCEL: 'pointercancel' -}; - -goog.provide('ol.layer.Base'); -goog.provide('ol.layer.LayerProperty'); -goog.provide('ol.layer.LayerState'); - -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Object'); -goog.require('ol.math'); -goog.require('ol.source.State'); - - -/** - * @enum {string} - */ -ol.layer.LayerProperty = { - OPACITY: 'opacity', - VISIBLE: 'visible', - EXTENT: 'extent', - Z_INDEX: 'zIndex', - MAX_RESOLUTION: 'maxResolution', - MIN_RESOLUTION: 'minResolution', - SOURCE: 'source' -}; - - -/** - * @typedef {{layer: ol.layer.Layer, - * opacity: number, - * sourceState: ol.source.State, - * visible: boolean, - * managed: boolean, - * extent: (ol.Extent|undefined), - * zIndex: number, - * maxResolution: number, - * minResolution: number}} - */ -ol.layer.LayerState; - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Note that with `ol.layer.Base` and all its subclasses, any property set in - * the options is set as a {@link ol.Object} property on the layer object, so - * is observable, and has get/set accessors. - * - * @constructor - * @extends {ol.Object} - * @param {olx.layer.BaseOptions} options Layer options. - * @api stable - */ -ol.layer.Base = function(options) { - - goog.base(this); - - /** - * @type {Object.<string, *>} - */ - var properties = goog.object.clone(options); - properties[ol.layer.LayerProperty.OPACITY] = - options.opacity !== undefined ? options.opacity : 1; - properties[ol.layer.LayerProperty.VISIBLE] = - options.visible !== undefined ? options.visible : true; - properties[ol.layer.LayerProperty.Z_INDEX] = - options.zIndex !== undefined ? options.zIndex : 0; - properties[ol.layer.LayerProperty.MAX_RESOLUTION] = - options.maxResolution !== undefined ? options.maxResolution : Infinity; - properties[ol.layer.LayerProperty.MIN_RESOLUTION] = - options.minResolution !== undefined ? options.minResolution : 0; - - this.setProperties(properties); -}; -goog.inherits(ol.layer.Base, ol.Object); - - -/** - * @return {ol.layer.LayerState} Layer state. - */ -ol.layer.Base.prototype.getLayerState = function() { - var opacity = this.getOpacity(); - var sourceState = this.getSourceState(); - var visible = this.getVisible(); - var extent = this.getExtent(); - var zIndex = this.getZIndex(); - var maxResolution = this.getMaxResolution(); - var minResolution = this.getMinResolution(); - return { - layer: /** @type {ol.layer.Layer} */ (this), - opacity: ol.math.clamp(opacity, 0, 1), - sourceState: sourceState, - visible: visible, - managed: true, - extent: extent, - zIndex: zIndex, - maxResolution: maxResolution, - minResolution: Math.max(minResolution, 0) - }; -}; - - -/** - * @param {Array.<ol.layer.Layer>=} opt_array Array of layers (to be - * modified in place). - * @return {Array.<ol.layer.Layer>} Array of layers. - */ -ol.layer.Base.prototype.getLayersArray = goog.abstractMethod; - - -/** - * @param {Array.<ol.layer.LayerState>=} opt_states Optional list of layer - * states (to be modified in place). - * @return {Array.<ol.layer.LayerState>} List of layer states. - */ -ol.layer.Base.prototype.getLayerStatesArray = goog.abstractMethod; - - -/** - * Return the {@link ol.Extent extent} of the layer or `undefined` if it - * will be visible regardless of extent. - * @return {ol.Extent|undefined} The layer extent. - * @observable - * @api stable - */ -ol.layer.Base.prototype.getExtent = function() { - return /** @type {ol.Extent|undefined} */ ( - this.get(ol.layer.LayerProperty.EXTENT)); -}; - - -/** - * Return the maximum resolution of the layer. - * @return {number} The maximum resolution of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.getMaxResolution = function() { - return /** @type {number} */ ( - this.get(ol.layer.LayerProperty.MAX_RESOLUTION)); -}; - - -/** - * Return the minimum resolution of the layer. - * @return {number} The minimum resolution of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.getMinResolution = function() { - return /** @type {number} */ ( - this.get(ol.layer.LayerProperty.MIN_RESOLUTION)); -}; - - -/** - * Return the opacity of the layer (between 0 and 1). - * @return {number} The opacity of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.getOpacity = function() { - return /** @type {number} */ (this.get(ol.layer.LayerProperty.OPACITY)); -}; - - -/** - * @return {ol.source.State} Source state. - */ -ol.layer.Base.prototype.getSourceState = goog.abstractMethod; - - -/** - * Return the visibility of the layer (`true` or `false`). - * @return {boolean} The visibility of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.getVisible = function() { - return /** @type {boolean} */ (this.get(ol.layer.LayerProperty.VISIBLE)); -}; - - -/** - * Return the Z-index of the layer, which is used to order layers before - * rendering. The default Z-index is 0. - * @return {number} The Z-index of the layer. - * @observable - * @api - */ -ol.layer.Base.prototype.getZIndex = function() { - return /** @type {number} */ (this.get(ol.layer.LayerProperty.Z_INDEX)); -}; - - -/** - * Set the extent at which the layer is visible. If `undefined`, the layer - * will be visible at all extents. - * @param {ol.Extent|undefined} extent The extent of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.setExtent = function(extent) { - this.set(ol.layer.LayerProperty.EXTENT, extent); -}; - - -/** - * Set the maximum resolution at which the layer is visible. - * @param {number} maxResolution The maximum resolution of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.setMaxResolution = function(maxResolution) { - this.set(ol.layer.LayerProperty.MAX_RESOLUTION, maxResolution); -}; - - -/** - * Set the minimum resolution at which the layer is visible. - * @param {number} minResolution The minimum resolution of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.setMinResolution = function(minResolution) { - this.set(ol.layer.LayerProperty.MIN_RESOLUTION, minResolution); -}; - - -/** - * Set the opacity of the layer, allowed values range from 0 to 1. - * @param {number} opacity The opacity of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.setOpacity = function(opacity) { - this.set(ol.layer.LayerProperty.OPACITY, opacity); -}; - - -/** - * Set the visibility of the layer (`true` or `false`). - * @param {boolean} visible The visibility of the layer. - * @observable - * @api stable - */ -ol.layer.Base.prototype.setVisible = function(visible) { - this.set(ol.layer.LayerProperty.VISIBLE, visible); -}; - - -/** - * Set Z-index of the layer, which is used to order layers before rendering. - * The default Z-index is 0. - * @param {number} zindex The z-index of the layer. - * @observable - * @api - */ -ol.layer.Base.prototype.setZIndex = function(zindex) { - this.set(ol.layer.LayerProperty.Z_INDEX, zindex); -}; - -goog.provide('ol.render.VectorContext'); - - - -/** - * Context for drawing geometries. A vector context is available on render - * events and does not need to be constructed directly. - * @constructor - * @struct - * @api - */ -ol.render.VectorContext = function() { -}; - - -/** - * @param {number} zIndex Z index. - * @param {function(ol.render.VectorContext)} callback Callback. - */ -ol.render.VectorContext.prototype.drawAsync = goog.abstractMethod; - - -/** - * @param {ol.geom.Circle} circleGeometry Circle geometry. - * @param {ol.Feature} feature Feature, - */ -ol.render.VectorContext.prototype.drawCircleGeometry = goog.abstractMethod; - - -/** - * @param {ol.Feature} feature Feature. - * @param {ol.style.Style} style Style. - */ -ol.render.VectorContext.prototype.drawFeature = goog.abstractMethod; - - -/** - * @param {ol.geom.GeometryCollection} geometryCollectionGeometry Geometry - * collection. - * @param {ol.Feature} feature Feature. - */ -ol.render.VectorContext.prototype.drawGeometryCollectionGeometry = - goog.abstractMethod; - - -/** - * @param {ol.geom.LineString|ol.render.Feature} lineStringGeometry Line - * string geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - */ -ol.render.VectorContext.prototype.drawLineStringGeometry = - goog.abstractMethod; - - -/** - * @param {ol.geom.MultiLineString|ol.render.Feature} multiLineStringGeometry - * MultiLineString geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - */ -ol.render.VectorContext.prototype.drawMultiLineStringGeometry = - goog.abstractMethod; - - -/** - * @param {ol.geom.MultiPoint|ol.render.Feature} multiPointGeometry MultiPoint - * geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - */ -ol.render.VectorContext.prototype.drawMultiPointGeometry = goog.abstractMethod; - - -/** - * @param {ol.geom.MultiPolygon} multiPolygonGeometry MultiPolygon geometry. - * @param {ol.Feature} feature Feature. - */ -ol.render.VectorContext.prototype.drawMultiPolygonGeometry = - goog.abstractMethod; - - -/** - * @param {ol.geom.Point|ol.render.Feature} pointGeometry Point geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - */ -ol.render.VectorContext.prototype.drawPointGeometry = goog.abstractMethod; - - -/** - * @param {ol.geom.Polygon|ol.render.Feature} polygonGeometry Polygon - * geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - */ -ol.render.VectorContext.prototype.drawPolygonGeometry = goog.abstractMethod; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - */ -ol.render.VectorContext.prototype.drawText = goog.abstractMethod; - - -/** - * @param {ol.style.Fill} fillStyle Fill style. - * @param {ol.style.Stroke} strokeStyle Stroke style. - */ -ol.render.VectorContext.prototype.setFillStrokeStyle = goog.abstractMethod; - - -/** - * @param {ol.style.Image} imageStyle Image style. - */ -ol.render.VectorContext.prototype.setImageStyle = goog.abstractMethod; - - -/** - * @param {ol.style.Text} textStyle Text style. - */ -ol.render.VectorContext.prototype.setTextStyle = goog.abstractMethod; - -goog.provide('ol.render.Event'); -goog.provide('ol.render.EventType'); - -goog.require('goog.events.Event'); -goog.require('ol.render.VectorContext'); - - -/** - * @enum {string} - */ -ol.render.EventType = { - /** - * @event ol.render.Event#postcompose - * @api - */ - POSTCOMPOSE: 'postcompose', - /** - * @event ol.render.Event#precompose - * @api - */ - PRECOMPOSE: 'precompose', - /** - * @event ol.render.Event#render - * @api - */ - RENDER: 'render' -}; - - - -/** - * @constructor - * @extends {goog.events.Event} - * @implements {oli.render.Event} - * @param {ol.render.EventType} type Type. - * @param {Object=} opt_target Target. - * @param {ol.render.VectorContext=} opt_vectorContext Vector context. - * @param {olx.FrameState=} opt_frameState Frame state. - * @param {?CanvasRenderingContext2D=} opt_context Context. - * @param {?ol.webgl.Context=} opt_glContext WebGL Context. - */ -ol.render.Event = function( - type, opt_target, opt_vectorContext, opt_frameState, opt_context, - opt_glContext) { - - goog.base(this, type, opt_target); - - /** - * For canvas, this is an instance of {@link ol.render.canvas.Immediate}. - * @type {ol.render.VectorContext|undefined} - * @api - */ - this.vectorContext = opt_vectorContext; - - /** - * An object representing the current render frame state. - * @type {olx.FrameState|undefined} - * @api - */ - this.frameState = opt_frameState; - - /** - * Canvas context. Only available when a Canvas renderer is used, null - * otherwise. - * @type {CanvasRenderingContext2D|null|undefined} - * @api - */ - this.context = opt_context; - - /** - * WebGL context. Only available when a WebGL renderer is used, null - * otherwise. - * @type {ol.webgl.Context|null|undefined} - * @api - */ - this.glContext = opt_glContext; - -}; -goog.inherits(ol.render.Event, goog.events.Event); - -goog.provide('ol.layer.Layer'); - -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Object'); -goog.require('ol.layer.Base'); -goog.require('ol.layer.LayerProperty'); -goog.require('ol.render.EventType'); -goog.require('ol.source.State'); - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * A visual representation of raster or vector map data. - * Layers group together those properties that pertain to how the data is to be - * displayed, irrespective of the source of that data. - * - * Layers are usually added to a map with {@link ol.Map#addLayer}. Components - * like {@link ol.interaction.Select} use unmanaged layers internally. These - * unmanaged layers are associated with the map using - * {@link ol.layer.Layer#setMap} instead. - * - * A generic `change` event is fired when the state of the source changes. - * - * @constructor - * @extends {ol.layer.Base} - * @fires ol.render.Event - * @param {olx.layer.LayerOptions} options Layer options. - * @api stable - */ -ol.layer.Layer = function(options) { - - var baseOptions = goog.object.clone(options); - delete baseOptions.source; - - goog.base(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); - - /** - * @private - * @type {goog.events.Key} - */ - this.mapPrecomposeKey_ = null; - - /** - * @private - * @type {goog.events.Key} - */ - this.mapRenderKey_ = null; - - /** - * @private - * @type {goog.events.Key} - */ - this.sourceChangeKey_ = null; - - if (options.map) { - this.setMap(options.map); - } - - goog.events.listen(this, - ol.Object.getChangeEventType(ol.layer.LayerProperty.SOURCE), - this.handleSourcePropertyChange_, false, this); - - var source = options.source ? options.source : null; - this.setSource(source); -}; -goog.inherits(ol.layer.Layer, ol.layer.Base); - - -/** - * Return `true` if the layer is visible, and if the passed resolution is - * between the layer's minResolution and maxResolution. The comparison is - * inclusive for `minResolution` and exclusive for `maxResolution`. - * @param {ol.layer.LayerState} layerState Layer state. - * @param {number} resolution Resolution. - * @return {boolean} The layer is visible at the given resolution. - */ -ol.layer.Layer.visibleAtResolution = function(layerState, resolution) { - return layerState.visible && resolution >= layerState.minResolution && - resolution < layerState.maxResolution; -}; - - -/** - * @inheritDoc - */ -ol.layer.Layer.prototype.getLayersArray = function(opt_array) { - var array = opt_array ? opt_array : []; - array.push(this); - return array; -}; - - -/** - * @inheritDoc - */ -ol.layer.Layer.prototype.getLayerStatesArray = function(opt_states) { - var states = opt_states ? opt_states : []; - states.push(this.getLayerState()); - return states; -}; - - -/** - * Get the layer source. - * @return {ol.source.Source} The layer source (or `null` if not yet set). - * @observable - * @api stable - */ -ol.layer.Layer.prototype.getSource = function() { - var source = this.get(ol.layer.LayerProperty.SOURCE); - return /** @type {ol.source.Source} */ (source) || null; -}; - - -/** - * @inheritDoc - */ -ol.layer.Layer.prototype.getSourceState = function() { - var source = this.getSource(); - return !source ? ol.source.State.UNDEFINED : source.getState(); -}; - - -/** - * @private - */ -ol.layer.Layer.prototype.handleSourceChange_ = function() { - this.changed(); -}; - - -/** - * @private - */ -ol.layer.Layer.prototype.handleSourcePropertyChange_ = function() { - if (this.sourceChangeKey_) { - goog.events.unlistenByKey(this.sourceChangeKey_); - this.sourceChangeKey_ = null; - } - var source = this.getSource(); - if (source) { - this.sourceChangeKey_ = goog.events.listen(source, - goog.events.EventType.CHANGE, this.handleSourceChange_, false, this); - } - this.changed(); -}; - - -/** - * Sets the layer to be rendered on a map. The map will not manage this layer in - * its layers collection, layer filters in {@link ol.Map#forEachLayerAtPixel} - * will not filter the layer, and it will be rendered on top. This is useful for - * temporary layers. To remove an unmanaged layer from the map, use - * `#setMap(null)`. - * - * To add the layer to a map and have it managed by the map, use - * {@link ol.Map#addLayer} instead. - * @param {ol.Map} map Map. - * @api - */ -ol.layer.Layer.prototype.setMap = function(map) { - goog.events.unlistenByKey(this.mapPrecomposeKey_); - this.mapPrecomposeKey_ = null; - if (!map) { - this.changed(); - } - goog.events.unlistenByKey(this.mapRenderKey_); - this.mapRenderKey_ = null; - if (map) { - this.mapPrecomposeKey_ = goog.events.listen( - map, ol.render.EventType.PRECOMPOSE, function(evt) { - var layerState = this.getLayerState(); - layerState.managed = false; - layerState.zIndex = Infinity; - evt.frameState.layerStatesArray.push(layerState); - evt.frameState.layerStates[goog.getUid(this)] = layerState; - }, false, this); - this.mapRenderKey_ = goog.events.listen( - this, goog.events.EventType.CHANGE, map.render, false, map); - this.changed(); - } -}; - - -/** - * Set the layer source. - * @param {ol.source.Source} source The layer source. - * @observable - * @api stable - */ -ol.layer.Layer.prototype.setSource = function(source) { - this.set(ol.layer.LayerProperty.SOURCE, source); -}; - -goog.provide('ol.ImageBase'); -goog.provide('ol.ImageState'); - -goog.require('goog.asserts'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); -goog.require('ol.Attribution'); -goog.require('ol.Extent'); - - -/** - * @enum {number} - */ -ol.ImageState = { - IDLE: 0, - LOADING: 1, - LOADED: 2, - ERROR: 3 -}; - - - -/** - * @constructor - * @extends {goog.events.EventTarget} - * @param {ol.Extent} extent Extent. - * @param {number|undefined} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.ImageState} state State. - * @param {Array.<ol.Attribution>} attributions Attributions. - */ -ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) { - - goog.base(this); - - /** - * @private - * @type {Array.<ol.Attribution>} - */ - this.attributions_ = attributions; - - /** - * @protected - * @type {ol.Extent} - */ - this.extent = extent; - - /** - * @private - * @type {number} - */ - this.pixelRatio_ = pixelRatio; - - /** - * @protected - * @type {number|undefined} - */ - this.resolution = resolution; - - /** - * @protected - * @type {ol.ImageState} - */ - this.state = state; - -}; -goog.inherits(ol.ImageBase, goog.events.EventTarget); - - -/** - * @protected - */ -ol.ImageBase.prototype.changed = function() { - this.dispatchEvent(goog.events.EventType.CHANGE); -}; - - -/** - * @return {Array.<ol.Attribution>} Attributions. - */ -ol.ImageBase.prototype.getAttributions = function() { - return this.attributions_; -}; - - -/** - * @return {ol.Extent} Extent. - */ -ol.ImageBase.prototype.getExtent = function() { - return this.extent; -}; - - -/** - * @param {Object=} opt_context Object. - * @return {HTMLCanvasElement|Image|HTMLVideoElement} Image. - */ -ol.ImageBase.prototype.getImage = goog.abstractMethod; - - -/** - * @return {number} PixelRatio. - */ -ol.ImageBase.prototype.getPixelRatio = function() { - return this.pixelRatio_; -}; - - -/** - * @return {number} Resolution. - */ -ol.ImageBase.prototype.getResolution = function() { - goog.asserts.assert(this.resolution !== undefined, 'resolution not yet set'); - return this.resolution; -}; - - -/** - * @return {ol.ImageState} State. - */ -ol.ImageBase.prototype.getState = function() { - return this.state; -}; - - -/** - * Load not yet loaded URI. - */ -ol.ImageBase.prototype.load = goog.abstractMethod; - -goog.provide('ol.vec.Mat4'); -goog.provide('ol.vec.Mat4.Number'); - -goog.require('goog.vec.Mat4'); - - -/** - * A alias for the goog.vec.Number type. - * @typedef {goog.vec.Number} - */ -ol.vec.Mat4.Number; - - -/** - * @param {!goog.vec.Mat4.Number} mat Matrix. - * @param {number} translateX1 Translate X1. - * @param {number} translateY1 Translate Y1. - * @param {number} scaleX Scale X. - * @param {number} scaleY Scale Y. - * @param {number} rotation Rotation. - * @param {number} translateX2 Translate X2. - * @param {number} translateY2 Translate Y2. - * @return {!goog.vec.Mat4.Number} Matrix. - */ -ol.vec.Mat4.makeTransform2D = function(mat, translateX1, translateY1, - scaleX, scaleY, rotation, translateX2, translateY2) { - goog.vec.Mat4.makeIdentity(mat); - if (translateX1 !== 0 || translateY1 !== 0) { - goog.vec.Mat4.translate(mat, translateX1, translateY1, 0); - } - if (scaleX != 1 || scaleY != 1) { - goog.vec.Mat4.scale(mat, scaleX, scaleY, 1); - } - if (rotation !== 0) { - goog.vec.Mat4.rotateZ(mat, rotation); - } - if (translateX2 !== 0 || translateY2 !== 0) { - goog.vec.Mat4.translate(mat, translateX2, translateY2, 0); - } - return mat; -}; - - -/** - * Returns true if mat1 and mat2 represent the same 2D transformation. - * @param {goog.vec.Mat4.Number} mat1 Matrix 1. - * @param {goog.vec.Mat4.Number} mat2 Matrix 2. - * @return {boolean} Equal 2D. - */ -ol.vec.Mat4.equals2D = function(mat1, mat2) { - return ( - goog.vec.Mat4.getElement(mat1, 0, 0) == - goog.vec.Mat4.getElement(mat2, 0, 0) && - goog.vec.Mat4.getElement(mat1, 1, 0) == - goog.vec.Mat4.getElement(mat2, 1, 0) && - goog.vec.Mat4.getElement(mat1, 0, 1) == - goog.vec.Mat4.getElement(mat2, 0, 1) && - goog.vec.Mat4.getElement(mat1, 1, 1) == - goog.vec.Mat4.getElement(mat2, 1, 1) && - goog.vec.Mat4.getElement(mat1, 0, 3) == - goog.vec.Mat4.getElement(mat2, 0, 3) && - goog.vec.Mat4.getElement(mat1, 1, 3) == - goog.vec.Mat4.getElement(mat2, 1, 3)); -}; - - -/** - * Transforms the given vector with the given matrix storing the resulting, - * transformed vector into resultVec. The input vector is multiplied against the - * upper 2x4 matrix omitting the projective component. - * - * @param {goog.vec.Mat4.Number} mat The matrix supplying the transformation. - * @param {Array.<number>} vec The 3 element vector to transform. - * @param {Array.<number>} resultVec The 3 element vector to receive the results - * (may be vec). - * @return {Array.<number>} return resultVec so that operations can be - * chained together. - */ -ol.vec.Mat4.multVec2 = function(mat, vec, resultVec) { - var m00 = goog.vec.Mat4.getElement(mat, 0, 0); - var m10 = goog.vec.Mat4.getElement(mat, 1, 0); - var m01 = goog.vec.Mat4.getElement(mat, 0, 1); - var m11 = goog.vec.Mat4.getElement(mat, 1, 1); - var m03 = goog.vec.Mat4.getElement(mat, 0, 3); - var m13 = goog.vec.Mat4.getElement(mat, 1, 3); - var x = vec[0], y = vec[1]; - resultVec[0] = m00 * x + m01 * y + m03; - resultVec[1] = m10 * x + m11 * y + m13; - return resultVec; -}; - -goog.provide('ol.renderer.Layer'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.functions'); -goog.require('ol'); -goog.require('ol.ImageState'); -goog.require('ol.Observable'); -goog.require('ol.TileRange'); -goog.require('ol.TileState'); -goog.require('ol.layer.Layer'); -goog.require('ol.source.Source'); -goog.require('ol.source.State'); -goog.require('ol.source.Tile'); -goog.require('ol.tilecoord'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.Observable} - * @param {ol.layer.Layer} layer Layer. - * @struct - */ -ol.renderer.Layer = function(layer) { - - goog.base(this); - - /** - * @private - * @type {ol.layer.Layer} - */ - this.layer_ = layer; - - -}; -goog.inherits(ol.renderer.Layer, ol.Observable); - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {olx.FrameState} frameState Frame state. - * @param {function(this: S, (ol.Feature|ol.render.Feature), ol.layer.Layer): T} - * callback Feature callback. - * @param {S} thisArg Value to use as `this` when executing `callback`. - * @return {T|undefined} Callback result. - * @template S,T - */ -ol.renderer.Layer.prototype.forEachFeatureAtCoordinate = ol.nullFunction; - - -/** - * @param {ol.Pixel} pixel Pixel. - * @param {olx.FrameState} frameState Frame state. - * @param {function(this: S, ol.layer.Layer): T} callback Layer callback. - * @param {S} thisArg Value to use as `this` when executing `callback`. - * @return {T|undefined} Callback result. - * @template S,T - */ -ol.renderer.Layer.prototype.forEachLayerAtPixel = - function(pixel, frameState, callback, thisArg) { - var coordinate = pixel.slice(); - ol.vec.Mat4.multVec2( - frameState.pixelToCoordinateMatrix, coordinate, coordinate); - - var hasFeature = this.forEachFeatureAtCoordinate( - coordinate, frameState, goog.functions.TRUE, this); - - if (hasFeature) { - return callback.call(thisArg, this.layer_); - } else { - return undefined; - } -}; - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {olx.FrameState} frameState Frame state. - * @return {boolean} Is there a feature at the given coordinate? - */ -ol.renderer.Layer.prototype.hasFeatureAtCoordinate = goog.functions.FALSE; - - -/** - * Create a function that adds loaded tiles to the tile lookup. - * @param {ol.source.Tile} source Tile source. - * @param {ol.proj.Projection} projection Projection of the tiles. - * @param {Object.<number, Object.<string, ol.Tile>>} tiles Lookup of loaded - * tiles by zoom level. - * @return {function(number, ol.TileRange):boolean} A function that can be - * called with a zoom level and a tile range to add loaded tiles to the - * lookup. - * @protected - */ -ol.renderer.Layer.prototype.createLoadedTileFinder = - function(source, projection, tiles) { - return ( - /** - * @param {number} zoom Zoom level. - * @param {ol.TileRange} tileRange Tile range. - * @return {boolean} The tile range is fully loaded. - */ - function(zoom, tileRange) { - return source.forEachLoadedTile(projection, zoom, - tileRange, function(tile) { - if (!tiles[zoom]) { - tiles[zoom] = {}; - } - tiles[zoom][tile.tileCoord.toString()] = tile; - }); - }); -}; - - -/** - * @return {ol.layer.Layer} Layer. - */ -ol.renderer.Layer.prototype.getLayer = function() { - return this.layer_; -}; - - -/** - * Handle changes in image state. - * @param {goog.events.Event} event Image change event. - * @private - */ -ol.renderer.Layer.prototype.handleImageChange_ = function(event) { - var image = /** @type {ol.Image} */ (event.target); - if (image.getState() === ol.ImageState.LOADED) { - this.renderIfReadyAndVisible(); - } -}; - - -/** - * Load the image if not already loaded, and register the image change - * listener if needed. - * @param {ol.ImageBase} image Image. - * @return {boolean} `true` if the image is already loaded, `false` - * otherwise. - * @protected - */ -ol.renderer.Layer.prototype.loadImage = function(image) { - var imageState = image.getState(); - if (imageState != ol.ImageState.LOADED && - imageState != ol.ImageState.ERROR) { - // the image is either "idle" or "loading", register the change - // listener (a noop if the listener was already registered) - goog.asserts.assert(imageState == ol.ImageState.IDLE || - imageState == ol.ImageState.LOADING, - 'imageState is "idle" or "loading"'); - goog.events.listen(image, goog.events.EventType.CHANGE, - this.handleImageChange_, false, this); - } - if (imageState == ol.ImageState.IDLE) { - image.load(); - imageState = image.getState(); - goog.asserts.assert(imageState == ol.ImageState.LOADING || - imageState == ol.ImageState.LOADED, - 'imageState is "loading" or "loaded"'); - } - return imageState == ol.ImageState.LOADED; -}; - - -/** - * @protected - */ -ol.renderer.Layer.prototype.renderIfReadyAndVisible = function() { - var layer = this.getLayer(); - if (layer.getVisible() && layer.getSourceState() == ol.source.State.READY) { - this.changed(); - } -}; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {ol.source.Tile} tileSource Tile source. - * @protected - */ -ol.renderer.Layer.prototype.scheduleExpireCache = - function(frameState, tileSource) { - if (tileSource.canExpireCache()) { - frameState.postRenderFunctions.push( - goog.partial( - /** - * @param {ol.source.Tile} tileSource Tile source. - * @param {ol.Map} map Map. - * @param {olx.FrameState} frameState Frame state. - */ - function(tileSource, map, frameState) { - var tileSourceKey = goog.getUid(tileSource).toString(); - tileSource.expireCache(frameState.viewState.projection, - frameState.usedTiles[tileSourceKey]); - }, tileSource)); - } -}; - - -/** - * @param {Object.<string, ol.Attribution>} attributionsSet Attributions - * set (target). - * @param {Array.<ol.Attribution>} attributions Attributions (source). - * @protected - */ -ol.renderer.Layer.prototype.updateAttributions = - function(attributionsSet, attributions) { - if (attributions) { - var attribution, i, ii; - for (i = 0, ii = attributions.length; i < ii; ++i) { - attribution = attributions[i]; - attributionsSet[goog.getUid(attribution).toString()] = attribution; - } - } -}; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {ol.source.Source} source Source. - * @protected - */ -ol.renderer.Layer.prototype.updateLogos = function(frameState, source) { - var logo = source.getLogo(); - if (logo !== undefined) { - if (goog.isString(logo)) { - frameState.logos[logo] = ''; - } else if (goog.isObject(logo)) { - goog.asserts.assertString(logo.href, 'logo.href is a string'); - goog.asserts.assertString(logo.src, 'logo.src is a string'); - frameState.logos[logo.src] = logo.href; - } - } -}; - - -/** - * @param {Object.<string, Object.<string, ol.TileRange>>} usedTiles Used tiles. - * @param {ol.source.Tile} tileSource Tile source. - * @param {number} z Z. - * @param {ol.TileRange} tileRange Tile range. - * @protected - */ -ol.renderer.Layer.prototype.updateUsedTiles = - function(usedTiles, tileSource, z, tileRange) { - // FIXME should we use tilesToDrawByZ instead? - var tileSourceKey = goog.getUid(tileSource).toString(); - var zKey = z.toString(); - if (tileSourceKey in usedTiles) { - if (zKey in usedTiles[tileSourceKey]) { - usedTiles[tileSourceKey][zKey].extend(tileRange); - } else { - usedTiles[tileSourceKey][zKey] = tileRange; - } - } else { - usedTiles[tileSourceKey] = {}; - usedTiles[tileSourceKey][zKey] = tileRange; - } -}; - - -/** - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {ol.Size} size Size. - * @protected - * @return {ol.Coordinate} Snapped center. - */ -ol.renderer.Layer.prototype.snapCenterToPixel = - function(center, resolution, size) { - return [ - resolution * (Math.round(center[0] / resolution) + (size[0] % 2) / 2), - resolution * (Math.round(center[1] / resolution) + (size[1] % 2) / 2) - ]; -}; - - -/** - * Manage tile pyramid. - * This function performs a number of functions related to the tiles at the - * current zoom and lower zoom levels: - * - registers idle tiles in frameState.wantedTiles so that they are not - * discarded by the tile queue - * - enqueues missing tiles - * @param {olx.FrameState} frameState Frame state. - * @param {ol.source.Tile} tileSource Tile source. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @param {ol.Extent} extent Extent. - * @param {number} currentZ Current Z. - * @param {number} preload Load low resolution tiles up to 'preload' levels. - * @param {function(this: T, ol.Tile)=} opt_tileCallback Tile callback. - * @param {T=} opt_this Object to use as `this` in `opt_tileCallback`. - * @protected - * @template T - */ -ol.renderer.Layer.prototype.manageTilePyramid = function( - frameState, tileSource, tileGrid, pixelRatio, projection, extent, - currentZ, preload, opt_tileCallback, opt_this) { - var tileSourceKey = goog.getUid(tileSource).toString(); - if (!(tileSourceKey in frameState.wantedTiles)) { - frameState.wantedTiles[tileSourceKey] = {}; - } - var wantedTiles = frameState.wantedTiles[tileSourceKey]; - var tileQueue = frameState.tileQueue; - var minZoom = tileGrid.getMinZoom(); - var tile, tileRange, tileResolution, x, y, z; - for (z = currentZ; z >= minZoom; --z) { - tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z, tileRange); - tileResolution = tileGrid.getResolution(z); - for (x = tileRange.minX; x <= tileRange.maxX; ++x) { - for (y = tileRange.minY; y <= tileRange.maxY; ++y) { - if (currentZ - z <= preload) { - tile = tileSource.getTile(z, x, y, pixelRatio, projection); - if (tile.getState() == ol.TileState.IDLE) { - wantedTiles[ol.tilecoord.toString(tile.tileCoord)] = true; - if (!tileQueue.isKeyQueued(tile.getKey())) { - tileQueue.enqueue([tile, tileSourceKey, - tileGrid.getTileCoordCenter(tile.tileCoord), tileResolution]); - } - } - if (opt_tileCallback !== undefined) { - opt_tileCallback.call(opt_this, tile); - } - } else { - tileSource.useTile(z, x, y, projection); - } - } - } - } -}; - -goog.provide('ol.style.Image'); -goog.provide('ol.style.ImageState'); - - -/** - * @enum {number} - */ -ol.style.ImageState = { - IDLE: 0, - LOADING: 1, - LOADED: 2, - ERROR: 3 -}; - - -/** - * @typedef {{opacity: number, - * rotateWithView: boolean, - * rotation: number, - * scale: number, - * snapToPixel: boolean}} - */ -ol.style.ImageOptions; - - - -/** - * @classdesc - * A base class used for creating subclasses and not instantiated in - * apps. Base class for {@link ol.style.Icon} and {@link ol.style.Circle}. - * - * @constructor - * @param {ol.style.ImageOptions} options Options. - * @api - */ -ol.style.Image = function(options) { - - /** - * @private - * @type {number} - */ - this.opacity_ = options.opacity; - - /** - * @private - * @type {boolean} - */ - this.rotateWithView_ = options.rotateWithView; - - /** - * @private - * @type {number} - */ - this.rotation_ = options.rotation; - - /** - * @private - * @type {number} - */ - this.scale_ = options.scale; - - /** - * @private - * @type {boolean} - */ - this.snapToPixel_ = options.snapToPixel; - -}; - - -/** - * Get the symbolizer opacity. - * @return {number} Opacity. - * @api - */ -ol.style.Image.prototype.getOpacity = function() { - return this.opacity_; -}; - - -/** - * Determine whether the symbolizer rotates with the map. - * @return {boolean} Rotate with map. - * @api - */ -ol.style.Image.prototype.getRotateWithView = function() { - return this.rotateWithView_; -}; - - -/** - * Get the symoblizer rotation. - * @return {number} Rotation. - * @api - */ -ol.style.Image.prototype.getRotation = function() { - return this.rotation_; -}; - - -/** - * Get the symbolizer scale. - * @return {number} Scale. - * @api - */ -ol.style.Image.prototype.getScale = function() { - return this.scale_; -}; - - -/** - * Determine whether the symbolizer should be snapped to a pixel. - * @return {boolean} The symbolizer should snap to a pixel. - * @api - */ -ol.style.Image.prototype.getSnapToPixel = function() { - return this.snapToPixel_; -}; - - -/** - * Get the anchor point. The anchor determines the center point for the - * symbolizer. Its units are determined by `anchorXUnits` and `anchorYUnits`. - * @function - * @return {Array.<number>} Anchor. - */ -ol.style.Image.prototype.getAnchor = goog.abstractMethod; - - -/** - * Get the image element for the symbolizer. - * @function - * @param {number} pixelRatio Pixel ratio. - * @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element. - */ -ol.style.Image.prototype.getImage = goog.abstractMethod; - - -/** - * @param {number} pixelRatio Pixel ratio. - * @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element. - */ -ol.style.Image.prototype.getHitDetectionImage = goog.abstractMethod; - - -/** - * @return {ol.style.ImageState} Image state. - */ -ol.style.Image.prototype.getImageState = goog.abstractMethod; - - -/** - * @return {ol.Size} Image size. - */ -ol.style.Image.prototype.getImageSize = goog.abstractMethod; - - -/** - * @return {ol.Size} Size of the hit-detection image. - */ -ol.style.Image.prototype.getHitDetectionImageSize = goog.abstractMethod; - - -/** - * Get the origin of the symbolizer. - * @function - * @return {Array.<number>} Origin. - */ -ol.style.Image.prototype.getOrigin = goog.abstractMethod; - - -/** - * Get the size of the symbolizer (in pixels). - * @function - * @return {ol.Size} Size. - */ -ol.style.Image.prototype.getSize = goog.abstractMethod; - - -/** - * Set the opacity. - * - * @param {number} opacity Opacity. - * @api - */ -ol.style.Image.prototype.setOpacity = function(opacity) { - this.opacity_ = opacity; -}; - - -/** - * Set whether to rotate the style with the view. - * - * @param {boolean} rotateWithView Rotate with map. - */ -ol.style.Image.prototype.setRotateWithView = function(rotateWithView) { - this.rotateWithView_ = rotateWithView; -}; - - -/** - * Set the rotation. - * - * @param {number} rotation Rotation. - * @api - */ -ol.style.Image.prototype.setRotation = function(rotation) { - this.rotation_ = rotation; -}; - - -/** - * Set the scale. - * - * @param {number} scale Scale. - * @api - */ -ol.style.Image.prototype.setScale = function(scale) { - this.scale_ = scale; -}; - - -/** - * Set whether to snap the image to the closest pixel. - * - * @param {boolean} snapToPixel Snap to pixel? - */ -ol.style.Image.prototype.setSnapToPixel = function(snapToPixel) { - this.snapToPixel_ = snapToPixel; -}; - - -/** - * @param {function(this: T, goog.events.Event)} listener Listener function. - * @param {T} thisArg Value to use as `this` when executing `listener`. - * @return {goog.events.Key|undefined} Listener key. - * @template T - */ -ol.style.Image.prototype.listenImageChange = goog.abstractMethod; - - -/** - * Load not yet loaded URI. - */ -ol.style.Image.prototype.load = goog.abstractMethod; - - -/** - * @param {function(this: T, goog.events.Event)} listener Listener function. - * @param {T} thisArg Value to use as `this` when executing `listener`. - * @template T - */ -ol.style.Image.prototype.unlistenImageChange = goog.abstractMethod; - -goog.provide('ol.style.Icon'); -goog.provide('ol.style.IconAnchorUnits'); -goog.provide('ol.style.IconImageCache'); -goog.provide('ol.style.IconOrigin'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); -goog.require('ol.dom'); -goog.require('ol.style.Image'); -goog.require('ol.style.ImageState'); - - -/** - * Icon anchor units. One of 'fraction', 'pixels'. - * @enum {string} - * @api - */ -ol.style.IconAnchorUnits = { - FRACTION: 'fraction', - PIXELS: 'pixels' -}; - - -/** - * Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'. - * @enum {string} - * @api - */ -ol.style.IconOrigin = { - BOTTOM_LEFT: 'bottom-left', - BOTTOM_RIGHT: 'bottom-right', - TOP_LEFT: 'top-left', - TOP_RIGHT: 'top-right' -}; - - - -/** - * @classdesc - * Set icon style for vector features. - * - * @constructor - * @param {olx.style.IconOptions=} opt_options Options. - * @extends {ol.style.Image} - * @api - */ -ol.style.Icon = function(opt_options) { - - var options = opt_options || {}; - - /** - * @private - * @type {Array.<number>} - */ - this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5]; - - /** - * @private - * @type {Array.<number>} - */ - this.normalizedAnchor_ = null; - - /** - * @private - * @type {ol.style.IconOrigin} - */ - this.anchorOrigin_ = options.anchorOrigin !== undefined ? - options.anchorOrigin : ol.style.IconOrigin.TOP_LEFT; - - /** - * @private - * @type {ol.style.IconAnchorUnits} - */ - this.anchorXUnits_ = options.anchorXUnits !== undefined ? - options.anchorXUnits : ol.style.IconAnchorUnits.FRACTION; - - /** - * @private - * @type {ol.style.IconAnchorUnits} - */ - this.anchorYUnits_ = options.anchorYUnits !== undefined ? - options.anchorYUnits : ol.style.IconAnchorUnits.FRACTION; - - /** - * @type {?string} - */ - var crossOrigin = - options.crossOrigin !== undefined ? options.crossOrigin : null; - - /** - * @type {Image} - */ - var image = options.img !== undefined ? options.img : null; - - /** - * @type {ol.Size} - */ - var imgSize = options.imgSize !== undefined ? options.imgSize : null; - - /** - * @type {string|undefined} - */ - var src = options.src; - - goog.asserts.assert(!(src !== undefined && image), - 'image and src can not provided at the same time'); - goog.asserts.assert( - src === undefined || (src !== undefined && !imgSize), - 'imgSize should not be set when src is provided'); - goog.asserts.assert( - !image || (image && imgSize), - 'imgSize must be set when image is provided'); - - if ((src === undefined || src.length === 0) && image) { - src = image.src; - } - goog.asserts.assert(src !== undefined && src.length > 0, - 'must provide a defined and non-empty src or image'); - - /** - * @type {ol.style.ImageState} - */ - var imageState = options.src !== undefined ? - ol.style.ImageState.IDLE : ol.style.ImageState.LOADED; - - /** - * @private - * @type {ol.style.IconImage_} - */ - this.iconImage_ = ol.style.IconImage_.get( - image, src, imgSize, crossOrigin, imageState); - - /** - * @private - * @type {Array.<number>} - */ - this.offset_ = options.offset !== undefined ? options.offset : [0, 0]; - - /** - * @private - * @type {ol.style.IconOrigin} - */ - this.offsetOrigin_ = options.offsetOrigin !== undefined ? - options.offsetOrigin : ol.style.IconOrigin.TOP_LEFT; - - /** - * @private - * @type {Array.<number>} - */ - this.origin_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.size_ = options.size !== undefined ? options.size : null; - - /** - * @type {number} - */ - var opacity = options.opacity !== undefined ? options.opacity : 1; - - /** - * @type {boolean} - */ - var rotateWithView = options.rotateWithView !== undefined ? - options.rotateWithView : false; - - /** - * @type {number} - */ - var rotation = options.rotation !== undefined ? options.rotation : 0; - - /** - * @type {number} - */ - var scale = options.scale !== undefined ? options.scale : 1; - - /** - * @type {boolean} - */ - var snapToPixel = options.snapToPixel !== undefined ? - options.snapToPixel : true; - - goog.base(this, { - opacity: opacity, - rotation: rotation, - scale: scale, - snapToPixel: snapToPixel, - rotateWithView: rotateWithView - }); - -}; -goog.inherits(ol.style.Icon, ol.style.Image); - - -/** - * @inheritDoc - * @api - */ -ol.style.Icon.prototype.getAnchor = function() { - if (this.normalizedAnchor_) { - return this.normalizedAnchor_; - } - var anchor = this.anchor_; - var size = this.getSize(); - if (this.anchorXUnits_ == ol.style.IconAnchorUnits.FRACTION || - this.anchorYUnits_ == ol.style.IconAnchorUnits.FRACTION) { - if (!size) { - return null; - } - anchor = this.anchor_.slice(); - if (this.anchorXUnits_ == ol.style.IconAnchorUnits.FRACTION) { - anchor[0] *= size[0]; - } - if (this.anchorYUnits_ == ol.style.IconAnchorUnits.FRACTION) { - anchor[1] *= size[1]; - } - } - - if (this.anchorOrigin_ != ol.style.IconOrigin.TOP_LEFT) { - if (!size) { - return null; - } - if (anchor === this.anchor_) { - anchor = this.anchor_.slice(); - } - if (this.anchorOrigin_ == ol.style.IconOrigin.TOP_RIGHT || - this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) { - anchor[0] = -anchor[0] + size[0]; - } - if (this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_LEFT || - this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) { - anchor[1] = -anchor[1] + size[1]; - } - } - this.normalizedAnchor_ = anchor; - return this.normalizedAnchor_; -}; - - -/** - * Get the image icon. - * @param {number} pixelRatio Pixel ratio. - * @return {Image} Image element. - * @api - */ -ol.style.Icon.prototype.getImage = function(pixelRatio) { - return this.iconImage_.getImage(pixelRatio); -}; - - -/** - * Real Image size used. - * @return {ol.Size} Size. - */ -ol.style.Icon.prototype.getImageSize = function() { - return this.iconImage_.getSize(); -}; - - -/** - * @inheritDoc - */ -ol.style.Icon.prototype.getHitDetectionImageSize = function() { - return this.getImageSize(); -}; - - -/** - * @inheritDoc - */ -ol.style.Icon.prototype.getImageState = function() { - return this.iconImage_.getImageState(); -}; - - -/** - * @inheritDoc - */ -ol.style.Icon.prototype.getHitDetectionImage = function(pixelRatio) { - return this.iconImage_.getHitDetectionImage(pixelRatio); -}; - - -/** - * @inheritDoc - * @api - */ -ol.style.Icon.prototype.getOrigin = function() { - if (this.origin_) { - return this.origin_; - } - var offset = this.offset_; - - if (this.offsetOrigin_ != ol.style.IconOrigin.TOP_LEFT) { - var size = this.getSize(); - var iconImageSize = this.iconImage_.getSize(); - if (!size || !iconImageSize) { - return null; - } - offset = offset.slice(); - if (this.offsetOrigin_ == ol.style.IconOrigin.TOP_RIGHT || - this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) { - offset[0] = iconImageSize[0] - size[0] - offset[0]; - } - if (this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_LEFT || - this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) { - offset[1] = iconImageSize[1] - size[1] - offset[1]; - } - } - this.origin_ = offset; - return this.origin_; -}; - - -/** - * Get the image URL. - * @return {string|undefined} Image src. - * @api - */ -ol.style.Icon.prototype.getSrc = function() { - return this.iconImage_.getSrc(); -}; - - -/** - * @inheritDoc - * @api - */ -ol.style.Icon.prototype.getSize = function() { - return !this.size_ ? this.iconImage_.getSize() : this.size_; -}; - - -/** - * @inheritDoc - */ -ol.style.Icon.prototype.listenImageChange = function(listener, thisArg) { - return goog.events.listen(this.iconImage_, goog.events.EventType.CHANGE, - listener, false, thisArg); -}; - - -/** - * Load not yet loaded URI. - * When rendering a feature with an icon style, the vector renderer will - * automatically call this method. However, you might want to call this - * method yourself for preloading or other purposes. - * @api - */ -ol.style.Icon.prototype.load = function() { - this.iconImage_.load(); -}; - - -/** - * @inheritDoc - */ -ol.style.Icon.prototype.unlistenImageChange = function(listener, thisArg) { - goog.events.unlisten(this.iconImage_, goog.events.EventType.CHANGE, - listener, false, thisArg); -}; - - - -/** - * @constructor - * @param {Image} image Image. - * @param {string|undefined} src Src. - * @param {ol.Size} size Size. - * @param {?string} crossOrigin Cross origin. - * @param {ol.style.ImageState} imageState Image state. - * @extends {goog.events.EventTarget} - * @private - */ -ol.style.IconImage_ = function(image, src, size, crossOrigin, imageState) { - - goog.base(this); - - /** - * @private - * @type {Image|HTMLCanvasElement} - */ - this.hitDetectionImage_ = null; - - /** - * @private - * @type {Image} - */ - this.image_ = !image ? new Image() : image; - - if (crossOrigin !== null) { - this.image_.crossOrigin = crossOrigin; - } - - /** - * @private - * @type {Array.<goog.events.Key>} - */ - this.imageListenerKeys_ = null; - - /** - * @private - * @type {ol.style.ImageState} - */ - this.imageState_ = imageState; - - /** - * @private - * @type {ol.Size} - */ - this.size_ = size; - - /** - * @private - * @type {string|undefined} - */ - this.src_ = src; - - /** - * @private - * @type {boolean} - */ - this.tainting_ = false; - if (this.imageState_ == ol.style.ImageState.LOADED) { - this.determineTainting_(); - } - -}; -goog.inherits(ol.style.IconImage_, goog.events.EventTarget); - - -/** - * @param {Image} image Image. - * @param {string} src Src. - * @param {ol.Size} size Size. - * @param {?string} crossOrigin Cross origin. - * @param {ol.style.ImageState} imageState Image state. - * @return {ol.style.IconImage_} Icon image. - */ -ol.style.IconImage_.get = function(image, src, size, crossOrigin, imageState) { - var iconImageCache = ol.style.IconImageCache.getInstance(); - var iconImage = iconImageCache.get(src, crossOrigin); - if (!iconImage) { - iconImage = new ol.style.IconImage_( - image, src, size, crossOrigin, imageState); - iconImageCache.set(src, crossOrigin, iconImage); - } - return iconImage; -}; - - -/** - * @private - */ -ol.style.IconImage_.prototype.determineTainting_ = function() { - var context = ol.dom.createCanvasContext2D(1, 1); - try { - context.drawImage(this.image_, 0, 0); - context.getImageData(0, 0, 1, 1); - } catch (e) { - this.tainting_ = true; - } -}; - - -/** - * @private - */ -ol.style.IconImage_.prototype.dispatchChangeEvent_ = function() { - this.dispatchEvent(goog.events.EventType.CHANGE); -}; - - -/** - * @private - */ -ol.style.IconImage_.prototype.handleImageError_ = function() { - this.imageState_ = ol.style.ImageState.ERROR; - this.unlistenImage_(); - this.dispatchChangeEvent_(); -}; - - -/** - * @private - */ -ol.style.IconImage_.prototype.handleImageLoad_ = function() { - this.imageState_ = ol.style.ImageState.LOADED; - this.size_ = [this.image_.width, this.image_.height]; - this.unlistenImage_(); - this.determineTainting_(); - this.dispatchChangeEvent_(); -}; - - -/** - * @param {number} pixelRatio Pixel ratio. - * @return {Image} Image element. - */ -ol.style.IconImage_.prototype.getImage = function(pixelRatio) { - return this.image_; -}; - - -/** - * @return {ol.style.ImageState} Image state. - */ -ol.style.IconImage_.prototype.getImageState = function() { - return this.imageState_; -}; - - -/** - * @param {number} pixelRatio Pixel ratio. - * @return {Image|HTMLCanvasElement} Image element. - */ -ol.style.IconImage_.prototype.getHitDetectionImage = function(pixelRatio) { - if (!this.hitDetectionImage_) { - if (this.tainting_) { - var width = this.size_[0]; - var height = this.size_[1]; - var context = ol.dom.createCanvasContext2D(width, height); - context.fillRect(0, 0, width, height); - this.hitDetectionImage_ = context.canvas; - } else { - this.hitDetectionImage_ = this.image_; - } - } - return this.hitDetectionImage_; -}; - - -/** - * @return {ol.Size} Image size. - */ -ol.style.IconImage_.prototype.getSize = function() { - return this.size_; -}; - - -/** - * @return {string|undefined} Image src. - */ -ol.style.IconImage_.prototype.getSrc = function() { - return this.src_; -}; - - -/** - * Load not yet loaded URI. - */ -ol.style.IconImage_.prototype.load = function() { - if (this.imageState_ == ol.style.ImageState.IDLE) { - goog.asserts.assert(this.src_ !== undefined, - 'this.src_ must not be undefined'); - goog.asserts.assert(!this.imageListenerKeys_, - 'no listener keys existing'); - this.imageState_ = ol.style.ImageState.LOADING; - this.imageListenerKeys_ = [ - goog.events.listenOnce(this.image_, goog.events.EventType.ERROR, - this.handleImageError_, false, this), - goog.events.listenOnce(this.image_, goog.events.EventType.LOAD, - this.handleImageLoad_, false, this) - ]; - try { - this.image_.src = this.src_; - } catch (e) { - this.handleImageError_(); - } - } -}; - - -/** - * Discards event handlers which listen for load completion or errors. - * - * @private - */ -ol.style.IconImage_.prototype.unlistenImage_ = function() { - goog.asserts.assert(this.imageListenerKeys_, - 'we must have listeners registered'); - this.imageListenerKeys_.forEach(goog.events.unlistenByKey); - this.imageListenerKeys_ = null; -}; - - - -/** - * @constructor - */ -ol.style.IconImageCache = function() { - - /** - * @type {Object.<string, ol.style.IconImage_>} - * @private - */ - this.cache_ = {}; - - /** - * @type {number} - * @private - */ - this.cacheSize_ = 0; - - /** - * @const - * @type {number} - * @private - */ - this.maxCacheSize_ = 32; -}; -goog.addSingletonGetter(ol.style.IconImageCache); - - -/** - * @param {string} src Src. - * @param {?string} crossOrigin Cross origin. - * @return {string} Cache key. - */ -ol.style.IconImageCache.getKey = function(src, crossOrigin) { - goog.asserts.assert(crossOrigin !== undefined, - 'argument crossOrigin must be defined'); - return crossOrigin + ':' + src; -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.style.IconImageCache.prototype.clear = function() { - this.cache_ = {}; - this.cacheSize_ = 0; -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.style.IconImageCache.prototype.expire = function() { - if (this.cacheSize_ > this.maxCacheSize_) { - var i = 0; - var key, iconImage; - for (key in this.cache_) { - iconImage = this.cache_[key]; - if ((i++ & 3) === 0 && !goog.events.hasListener(iconImage)) { - delete this.cache_[key]; - --this.cacheSize_; - } - } - } -}; - - -/** - * @param {string} src Src. - * @param {?string} crossOrigin Cross origin. - * @return {ol.style.IconImage_} Icon image. - */ -ol.style.IconImageCache.prototype.get = function(src, crossOrigin) { - var key = ol.style.IconImageCache.getKey(src, crossOrigin); - return key in this.cache_ ? this.cache_[key] : null; -}; - - -/** - * @param {string} src Src. - * @param {?string} crossOrigin Cross origin. - * @param {ol.style.IconImage_} iconImage Icon image. - */ -ol.style.IconImageCache.prototype.set = function(src, crossOrigin, iconImage) { - var key = ol.style.IconImageCache.getKey(src, crossOrigin); - this.cache_[key] = iconImage; - ++this.cacheSize_; -}; - -goog.provide('ol.RendererType'); -goog.provide('ol.renderer.Map'); - -goog.require('goog.Disposable'); -goog.require('goog.asserts'); -goog.require('goog.dispose'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.functions'); -goog.require('goog.object'); -goog.require('goog.vec.Mat4'); -goog.require('ol'); -goog.require('ol.extent'); -goog.require('ol.layer.Layer'); -goog.require('ol.renderer.Layer'); -goog.require('ol.style.IconImageCache'); -goog.require('ol.vec.Mat4'); - - -/** - * Available renderers: `'canvas'`, `'dom'` or `'webgl'`. - * @enum {string} - * @api stable - */ -ol.RendererType = { - CANVAS: 'canvas', - DOM: 'dom', - WEBGL: 'webgl' -}; - - - -/** - * @constructor - * @extends {goog.Disposable} - * @param {Element} container Container. - * @param {ol.Map} map Map. - * @struct - */ -ol.renderer.Map = function(container, map) { - - goog.base(this); - - - /** - * @private - * @type {ol.Map} - */ - this.map_ = map; - - /** - * @private - * @type {Object.<string, ol.renderer.Layer>} - */ - this.layerRenderers_ = {}; - - /** - * @private - * @type {Object.<string, goog.events.Key>} - */ - this.layerRendererListeners_ = {}; - -}; -goog.inherits(ol.renderer.Map, goog.Disposable); - - -/** - * @param {olx.FrameState} frameState FrameState. - * @protected - */ -ol.renderer.Map.prototype.calculateMatrices2D = function(frameState) { - var viewState = frameState.viewState; - var coordinateToPixelMatrix = frameState.coordinateToPixelMatrix; - goog.asserts.assert(coordinateToPixelMatrix, - 'frameState has a coordinateToPixelMatrix'); - ol.vec.Mat4.makeTransform2D(coordinateToPixelMatrix, - frameState.size[0] / 2, frameState.size[1] / 2, - 1 / viewState.resolution, -1 / viewState.resolution, - -viewState.rotation, - -viewState.center[0], -viewState.center[1]); - var inverted = goog.vec.Mat4.invert( - coordinateToPixelMatrix, frameState.pixelToCoordinateMatrix); - goog.asserts.assert(inverted, 'matrix could be inverted'); -}; - - -/** - * @param {ol.layer.Layer} layer Layer. - * @protected - * @return {ol.renderer.Layer} layerRenderer Layer renderer. - */ -ol.renderer.Map.prototype.createLayerRenderer = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.renderer.Map.prototype.disposeInternal = function() { - goog.object.forEach(this.layerRenderers_, goog.dispose); - goog.base(this, 'disposeInternal'); -}; - - -/** - * @param {ol.Map} map Map. - * @param {olx.FrameState} frameState Frame state. - * @private - */ -ol.renderer.Map.expireIconCache_ = function(map, frameState) { - ol.style.IconImageCache.getInstance().expire(); -}; - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {olx.FrameState} frameState FrameState. - * @param {function(this: S, (ol.Feature|ol.render.Feature), - * ol.layer.Layer): T} callback Feature callback. - * @param {S} thisArg Value to use as `this` when executing `callback`. - * @param {function(this: U, ol.layer.Layer): boolean} layerFilter Layer filter - * function, only layers which are visible and for which this function - * returns `true` will be tested for features. By default, all visible - * layers will be tested. - * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`. - * @return {T|undefined} Callback result. - * @template S,T,U - */ -ol.renderer.Map.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg, - layerFilter, thisArg2) { - var result; - var viewState = frameState.viewState; - var viewResolution = viewState.resolution; - - /** @type {Object.<string, boolean>} */ - var features = {}; - - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function forEachFeatureAtCoordinate(feature) { - goog.asserts.assert(feature !== undefined, 'received a feature'); - var key = goog.getUid(feature).toString(); - if (!(key in features)) { - features[key] = true; - return callback.call(thisArg, feature, null); - } - } - - var projection = viewState.projection; - - var translatedCoordinate = coordinate; - if (projection.canWrapX()) { - var projectionExtent = projection.getExtent(); - var worldWidth = ol.extent.getWidth(projectionExtent); - var x = coordinate[0]; - if (x < projectionExtent[0] || x > projectionExtent[2]) { - var worldsAway = Math.ceil((projectionExtent[0] - x) / worldWidth); - translatedCoordinate = [x + worldWidth * worldsAway, coordinate[1]]; - } - } - - var layerStates = frameState.layerStatesArray; - var numLayers = layerStates.length; - var i; - for (i = numLayers - 1; i >= 0; --i) { - var layerState = layerStates[i]; - var layer = layerState.layer; - if (!layerState.managed || - (ol.layer.Layer.visibleAtResolution(layerState, viewResolution) && - layerFilter.call(thisArg2, layer))) { - var layerRenderer = this.getLayerRenderer(layer); - if (layer.getSource()) { - result = layerRenderer.forEachFeatureAtCoordinate( - layer.getSource().getWrapX() ? translatedCoordinate : coordinate, - frameState, - layerState.managed ? callback : forEachFeatureAtCoordinate, - thisArg); - } - if (result) { - return result; - } - } - } - return undefined; -}; - - -/** - * @param {ol.Pixel} pixel Pixel. - * @param {olx.FrameState} frameState FrameState. - * @param {function(this: S, ol.layer.Layer): T} callback Layer - * callback. - * @param {S} thisArg Value to use as `this` when executing `callback`. - * @param {function(this: U, ol.layer.Layer): boolean} layerFilter Layer filter - * function, only layers which are visible and for which this function - * returns `true` will be tested for features. By default, all visible - * layers will be tested. - * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`. - * @return {T|undefined} Callback result. - * @template S,T,U - */ -ol.renderer.Map.prototype.forEachLayerAtPixel = - function(pixel, frameState, callback, thisArg, - layerFilter, thisArg2) { - var result; - var viewState = frameState.viewState; - var viewResolution = viewState.resolution; - - var layerStates = frameState.layerStatesArray; - var numLayers = layerStates.length; - var i; - for (i = numLayers - 1; i >= 0; --i) { - var layerState = layerStates[i]; - var layer = layerState.layer; - if (ol.layer.Layer.visibleAtResolution(layerState, viewResolution) && - layerFilter.call(thisArg2, layer)) { - var layerRenderer = this.getLayerRenderer(layer); - result = layerRenderer.forEachLayerAtPixel( - pixel, frameState, callback, thisArg); - if (result) { - return result; - } - } - } - return undefined; -}; - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {olx.FrameState} frameState FrameState. - * @param {function(this: U, ol.layer.Layer): boolean} layerFilter Layer filter - * function, only layers which are visible and for which this function - * returns `true` will be tested for features. By default, all visible - * layers will be tested. - * @param {U} thisArg Value to use as `this` when executing `layerFilter`. - * @return {boolean} Is there a feature at the given coordinate? - * @template U - */ -ol.renderer.Map.prototype.hasFeatureAtCoordinate = - function(coordinate, frameState, layerFilter, thisArg) { - var hasFeature = this.forEachFeatureAtCoordinate( - coordinate, frameState, goog.functions.TRUE, this, layerFilter, thisArg); - - return hasFeature !== undefined; -}; - - -/** - * @param {ol.layer.Layer} layer Layer. - * @protected - * @return {ol.renderer.Layer} Layer renderer. - */ -ol.renderer.Map.prototype.getLayerRenderer = function(layer) { - var layerKey = goog.getUid(layer).toString(); - if (layerKey in this.layerRenderers_) { - return this.layerRenderers_[layerKey]; - } else { - var layerRenderer = this.createLayerRenderer(layer); - this.layerRenderers_[layerKey] = layerRenderer; - this.layerRendererListeners_[layerKey] = goog.events.listen(layerRenderer, - goog.events.EventType.CHANGE, this.handleLayerRendererChange_, - false, this); - - return layerRenderer; - } -}; - - -/** - * @param {string} layerKey Layer key. - * @protected - * @return {ol.renderer.Layer} Layer renderer. - */ -ol.renderer.Map.prototype.getLayerRendererByKey = function(layerKey) { - goog.asserts.assert(layerKey in this.layerRenderers_, - 'given layerKey (%s) exists in layerRenderers', layerKey); - return this.layerRenderers_[layerKey]; -}; - - -/** - * @protected - * @return {Object.<number, ol.renderer.Layer>} Layer renderers. - */ -ol.renderer.Map.prototype.getLayerRenderers = function() { - return this.layerRenderers_; -}; - - -/** - * @return {ol.Map} Map. - */ -ol.renderer.Map.prototype.getMap = function() { - return this.map_; -}; - - -/** - * @return {string} Type - */ -ol.renderer.Map.prototype.getType = goog.abstractMethod; - - -/** - * Handle changes in a layer renderer. - * @private - */ -ol.renderer.Map.prototype.handleLayerRendererChange_ = function() { - this.map_.render(); -}; - - -/** - * @param {string} layerKey Layer key. - * @return {ol.renderer.Layer} Layer renderer. - * @private - */ -ol.renderer.Map.prototype.removeLayerRendererByKey_ = function(layerKey) { - goog.asserts.assert(layerKey in this.layerRenderers_, - 'given layerKey (%s) exists in layerRenderers', layerKey); - var layerRenderer = this.layerRenderers_[layerKey]; - delete this.layerRenderers_[layerKey]; - - goog.asserts.assert(layerKey in this.layerRendererListeners_, - 'given layerKey (%s) exists in layerRendererListeners', layerKey); - goog.events.unlistenByKey(this.layerRendererListeners_[layerKey]); - delete this.layerRendererListeners_[layerKey]; - - return layerRenderer; -}; - - -/** - * Render. - * @param {?olx.FrameState} frameState Frame state. - */ -ol.renderer.Map.prototype.renderFrame = ol.nullFunction; - - -/** - * @param {ol.Map} map Map. - * @param {olx.FrameState} frameState Frame state. - * @private - */ -ol.renderer.Map.prototype.removeUnusedLayerRenderers_ = - function(map, frameState) { - var layerKey; - for (layerKey in this.layerRenderers_) { - if (!frameState || !(layerKey in frameState.layerStates)) { - goog.dispose(this.removeLayerRendererByKey_(layerKey)); - } - } -}; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @protected - */ -ol.renderer.Map.prototype.scheduleExpireIconCache = function(frameState) { - frameState.postRenderFunctions.push(ol.renderer.Map.expireIconCache_); -}; - - -/** - * @param {!olx.FrameState} frameState Frame state. - * @protected - */ -ol.renderer.Map.prototype.scheduleRemoveUnusedLayerRenderers = - function(frameState) { - var layerKey; - for (layerKey in this.layerRenderers_) { - if (!(layerKey in frameState.layerStates)) { - frameState.postRenderFunctions.push( - goog.bind(this.removeUnusedLayerRenderers_, this)); - return; - } - } -}; - - -/** - * @param {ol.layer.LayerState} state1 - * @param {ol.layer.LayerState} state2 - * @return {number} - */ -ol.renderer.Map.sortByZIndex = function(state1, state2) { - return state1.zIndex - state2.zIndex; -}; - -goog.provide('ol.structs.PriorityQueue'); - -goog.require('goog.asserts'); -goog.require('goog.object'); - - - -/** - * Priority queue. - * - * The implementation is inspired from the Closure Library's Heap class and - * Python's heapq module. - * - * @see http://closure-library.googlecode.com/svn/docs/closure_goog_structs_heap.js.source.html - * @see http://hg.python.org/cpython/file/2.7/Lib/heapq.py - * - * @constructor - * @param {function(T): number} priorityFunction Priority function. - * @param {function(T): string} keyFunction Key function. - * @struct - * @template T - */ -ol.structs.PriorityQueue = function(priorityFunction, keyFunction) { - - /** - * @type {function(T): number} - * @private - */ - this.priorityFunction_ = priorityFunction; - - /** - * @type {function(T): string} - * @private - */ - this.keyFunction_ = keyFunction; - - /** - * @type {Array.<T>} - * @private - */ - this.elements_ = []; - - /** - * @type {Array.<number>} - * @private - */ - this.priorities_ = []; - - /** - * @type {Object.<string, boolean>} - * @private - */ - this.queuedElements_ = {}; - -}; - - -/** - * @const - * @type {number} - */ -ol.structs.PriorityQueue.DROP = Infinity; - - -/** - * FIXME empty description for jsdoc - */ -ol.structs.PriorityQueue.prototype.assertValid = function() { - var elements = this.elements_; - var priorities = this.priorities_; - var n = elements.length; - goog.asserts.assert(priorities.length == n); - var i, priority; - for (i = 0; i < (n >> 1) - 1; ++i) { - priority = priorities[i]; - goog.asserts.assert(priority <= priorities[this.getLeftChildIndex_(i)], - 'priority smaller than or equal to priority of left child (%s <= %s)', - priority, priorities[this.getLeftChildIndex_(i)]); - goog.asserts.assert(priority <= priorities[this.getRightChildIndex_(i)], - 'priority smaller than or equal to priority of right child (%s <= %s)', - priority, priorities[this.getRightChildIndex_(i)]); - } -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.structs.PriorityQueue.prototype.clear = function() { - this.elements_.length = 0; - this.priorities_.length = 0; - goog.object.clear(this.queuedElements_); -}; - - -/** - * Remove and return the highest-priority element. O(log N). - * @return {T} Element. - */ -ol.structs.PriorityQueue.prototype.dequeue = function() { - var elements = this.elements_; - goog.asserts.assert(elements.length > 0, - 'must have elements in order to be able to dequeue'); - var priorities = this.priorities_; - var element = elements[0]; - if (elements.length == 1) { - elements.length = 0; - priorities.length = 0; - } else { - elements[0] = elements.pop(); - priorities[0] = priorities.pop(); - this.siftUp_(0); - } - var elementKey = this.keyFunction_(element); - goog.asserts.assert(elementKey in this.queuedElements_, - 'key %s is not listed as queued', elementKey); - delete this.queuedElements_[elementKey]; - return element; -}; - - -/** - * Enqueue an element. O(log N). - * @param {T} element Element. - */ -ol.structs.PriorityQueue.prototype.enqueue = function(element) { - goog.asserts.assert(!(this.keyFunction_(element) in this.queuedElements_), - 'key %s is already listed as queued', this.keyFunction_(element)); - var priority = this.priorityFunction_(element); - if (priority != ol.structs.PriorityQueue.DROP) { - this.elements_.push(element); - this.priorities_.push(priority); - this.queuedElements_[this.keyFunction_(element)] = true; - this.siftDown_(0, this.elements_.length - 1); - } -}; - - -/** - * @return {number} Count. - */ -ol.structs.PriorityQueue.prototype.getCount = function() { - return this.elements_.length; -}; - - -/** - * Gets the index of the left child of the node at the given index. - * @param {number} index The index of the node to get the left child for. - * @return {number} The index of the left child. - * @private - */ -ol.structs.PriorityQueue.prototype.getLeftChildIndex_ = function(index) { - return index * 2 + 1; -}; - - -/** - * Gets the index of the right child of the node at the given index. - * @param {number} index The index of the node to get the right child for. - * @return {number} The index of the right child. - * @private - */ -ol.structs.PriorityQueue.prototype.getRightChildIndex_ = function(index) { - return index * 2 + 2; -}; - - -/** - * Gets the index of the parent of the node at the given index. - * @param {number} index The index of the node to get the parent for. - * @return {number} The index of the parent. - * @private - */ -ol.structs.PriorityQueue.prototype.getParentIndex_ = function(index) { - return (index - 1) >> 1; -}; - - -/** - * Make this a heap. O(N). - * @private - */ -ol.structs.PriorityQueue.prototype.heapify_ = function() { - var i; - for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) { - this.siftUp_(i); - } -}; - - -/** - * @return {boolean} Is empty. - */ -ol.structs.PriorityQueue.prototype.isEmpty = function() { - return this.elements_.length === 0; -}; - - -/** - * @param {string} key Key. - * @return {boolean} Is key queued. - */ -ol.structs.PriorityQueue.prototype.isKeyQueued = function(key) { - return key in this.queuedElements_; -}; - - -/** - * @param {T} element Element. - * @return {boolean} Is queued. - */ -ol.structs.PriorityQueue.prototype.isQueued = function(element) { - return this.isKeyQueued(this.keyFunction_(element)); -}; - - -/** - * @param {number} index The index of the node to move down. - * @private - */ -ol.structs.PriorityQueue.prototype.siftUp_ = function(index) { - var elements = this.elements_; - var priorities = this.priorities_; - var count = elements.length; - var element = elements[index]; - var priority = priorities[index]; - var startIndex = index; - - while (index < (count >> 1)) { - var lIndex = this.getLeftChildIndex_(index); - var rIndex = this.getRightChildIndex_(index); - - var smallerChildIndex = rIndex < count && - priorities[rIndex] < priorities[lIndex] ? - rIndex : lIndex; - - elements[index] = elements[smallerChildIndex]; - priorities[index] = priorities[smallerChildIndex]; - index = smallerChildIndex; - } - - elements[index] = element; - priorities[index] = priority; - this.siftDown_(startIndex, index); -}; - - -/** - * @param {number} startIndex The index of the root. - * @param {number} index The index of the node to move up. - * @private - */ -ol.structs.PriorityQueue.prototype.siftDown_ = function(startIndex, index) { - var elements = this.elements_; - var priorities = this.priorities_; - var element = elements[index]; - var priority = priorities[index]; - - while (index > startIndex) { - var parentIndex = this.getParentIndex_(index); - if (priorities[parentIndex] > priority) { - elements[index] = elements[parentIndex]; - priorities[index] = priorities[parentIndex]; - index = parentIndex; - } else { - break; - } - } - elements[index] = element; - priorities[index] = priority; -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.structs.PriorityQueue.prototype.reprioritize = function() { - var priorityFunction = this.priorityFunction_; - var elements = this.elements_; - var priorities = this.priorities_; - var index = 0; - var n = elements.length; - var element, i, priority; - for (i = 0; i < n; ++i) { - element = elements[i]; - priority = priorityFunction(element); - if (priority == ol.structs.PriorityQueue.DROP) { - delete this.queuedElements_[this.keyFunction_(element)]; - } else { - priorities[index] = priority; - elements[index++] = element; - } - } - elements.length = index; - priorities.length = index; - this.heapify_(); -}; - -goog.provide('ol.TilePriorityFunction'); -goog.provide('ol.TileQueue'); - -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol.Coordinate'); -goog.require('ol.TileState'); -goog.require('ol.structs.PriorityQueue'); - - -/** - * @typedef {function(ol.Tile, string, ol.Coordinate, number): number} - */ -ol.TilePriorityFunction; - - - -/** - * @constructor - * @extends {ol.structs.PriorityQueue.<Array>} - * @param {ol.TilePriorityFunction} tilePriorityFunction - * Tile priority function. - * @param {function(): ?} tileChangeCallback - * Function called on each tile change event. - * @struct - */ -ol.TileQueue = function(tilePriorityFunction, tileChangeCallback) { - - goog.base( - this, - /** - * @param {Array} element Element. - * @return {number} Priority. - */ - function(element) { - return tilePriorityFunction.apply(null, element); - }, - /** - * @param {Array} element Element. - * @return {string} Key. - */ - function(element) { - return /** @type {ol.Tile} */ (element[0]).getKey(); - }); - - /** - * @private - * @type {function(): ?} - */ - this.tileChangeCallback_ = tileChangeCallback; - - /** - * @private - * @type {number} - */ - this.tilesLoading_ = 0; - -}; -goog.inherits(ol.TileQueue, ol.structs.PriorityQueue); - - -/** - * @return {number} Number of tiles loading. - */ -ol.TileQueue.prototype.getTilesLoading = function() { - return this.tilesLoading_; -}; - - -/** - * @param {goog.events.Event} event Event. - * @protected - */ -ol.TileQueue.prototype.handleTileChange = function(event) { - var tile = /** @type {ol.Tile} */ (event.target); - var state = tile.getState(); - if (state === ol.TileState.LOADED || state === ol.TileState.ERROR || - state === ol.TileState.EMPTY) { - goog.events.unlisten(tile, goog.events.EventType.CHANGE, - this.handleTileChange, false, this); - --this.tilesLoading_; - this.tileChangeCallback_(); - } -}; - - -/** - * @param {number} maxTotalLoading Maximum number tiles to load simultaneously. - * @param {number} maxNewLoads Maximum number of new tiles to load. - */ -ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) { - var newLoads = 0; - var tile; - while (this.tilesLoading_ < maxTotalLoading && newLoads < maxNewLoads && - this.getCount() > 0) { - tile = /** @type {ol.Tile} */ (this.dequeue()[0]); - if (tile.getState() === ol.TileState.IDLE) { - goog.events.listen(tile, goog.events.EventType.CHANGE, - this.handleTileChange, false, this); - tile.load(); - ++this.tilesLoading_; - ++newLoads; - } - } -}; - -goog.provide('ol.Kinetic'); - -goog.require('ol.Coordinate'); -goog.require('ol.PreRenderFunction'); -goog.require('ol.animation'); - - - -/** - * @classdesc - * Implementation of inertial deceleration for map movement. - * - * @constructor - * @param {number} decay Rate of decay (must be negative). - * @param {number} minVelocity Minimum velocity (pixels/millisecond). - * @param {number} delay Delay to consider to calculate the kinetic - * initial values (milliseconds). - * @struct - * @api - */ -ol.Kinetic = function(decay, minVelocity, delay) { - - /** - * @private - * @type {number} - */ - this.decay_ = decay; - - /** - * @private - * @type {number} - */ - this.minVelocity_ = minVelocity; - - /** - * @private - * @type {number} - */ - this.delay_ = delay; - - /** - * @private - * @type {Array.<number>} - */ - this.points_ = []; - - /** - * @private - * @type {number} - */ - this.angle_ = 0; - - /** - * @private - * @type {number} - */ - this.initialVelocity_ = 0; -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.Kinetic.prototype.begin = function() { - this.points_.length = 0; - this.angle_ = 0; - this.initialVelocity_ = 0; -}; - - -/** - * @param {number} x X. - * @param {number} y Y. - */ -ol.Kinetic.prototype.update = function(x, y) { - this.points_.push(x, y, Date.now()); -}; - - -/** - * @return {boolean} Whether we should do kinetic animation. - */ -ol.Kinetic.prototype.end = function() { - if (this.points_.length < 6) { - // at least 2 points are required (i.e. there must be at least 6 elements - // in the array) - return false; - } - var delay = Date.now() - this.delay_; - var lastIndex = this.points_.length - 3; - if (this.points_[lastIndex + 2] < delay) { - // the last tracked point is too old, which means that the user stopped - // panning before releasing the map - return false; - } - - // get the first point which still falls into the delay time - var firstIndex = lastIndex - 3; - while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) { - firstIndex -= 3; - } - var duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2]; - var dx = this.points_[lastIndex] - this.points_[firstIndex]; - var dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1]; - this.angle_ = Math.atan2(dy, dx); - this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration; - return this.initialVelocity_ > this.minVelocity_; -}; - - -/** - * @param {ol.Coordinate} source Source coordinate for the animation. - * @return {ol.PreRenderFunction} Pre-render function for kinetic animation. - */ -ol.Kinetic.prototype.pan = function(source) { - var decay = this.decay_; - var initialVelocity = this.initialVelocity_; - var velocity = this.minVelocity_ - initialVelocity; - var duration = this.getDuration_(); - var easingFunction = ( - /** - * @param {number} t T. - * @return {number} Easing. - */ - function(t) { - return initialVelocity * (Math.exp((decay * t) * duration) - 1) / - velocity; - }); - return ol.animation.pan({ - source: source, - duration: duration, - easing: easingFunction - }); -}; - - -/** - * @private - * @return {number} Duration of animation (milliseconds). - */ -ol.Kinetic.prototype.getDuration_ = function() { - return Math.log(this.minVelocity_ / this.initialVelocity_) / this.decay_; -}; - - -/** - * @return {number} Total distance travelled (pixels). - */ -ol.Kinetic.prototype.getDistance = function() { - return (this.minVelocity_ - this.initialVelocity_) / this.decay_; -}; - - -/** - * @return {number} Angle of the kinetic panning animation (radians). - */ -ol.Kinetic.prototype.getAngle = function() { - return this.angle_; -}; - -// FIXME factor out key precondition (shift et. al) - -goog.provide('ol.interaction.Interaction'); -goog.provide('ol.interaction.InteractionProperty'); - -goog.require('ol'); -goog.require('ol.MapBrowserEvent'); -goog.require('ol.Object'); -goog.require('ol.animation'); -goog.require('ol.easing'); - - -/** - * @enum {string} - */ -ol.interaction.InteractionProperty = { - ACTIVE: 'active' -}; - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * User actions that change the state of the map. Some are similar to controls, - * but are not associated with a DOM element. - * For example, {@link ol.interaction.KeyboardZoom} is functionally the same as - * {@link ol.control.Zoom}, but triggered by a keyboard event not a button - * element event. - * Although interactions do not have a DOM element, some of them do render - * vectors and so are visible on the screen. - * - * @constructor - * @param {olx.interaction.InteractionOptions} options Options. - * @extends {ol.Object} - * @api - */ -ol.interaction.Interaction = function(options) { - - goog.base(this); - - /** - * @private - * @type {ol.Map} - */ - this.map_ = null; - - this.setActive(true); - - /** - * @type {function(ol.MapBrowserEvent):boolean} - */ - this.handleEvent = options.handleEvent; - -}; -goog.inherits(ol.interaction.Interaction, ol.Object); - - -/** - * Return whether the interaction is currently active. - * @return {boolean} `true` if the interaction is active, `false` otherwise. - * @observable - * @api - */ -ol.interaction.Interaction.prototype.getActive = function() { - return /** @type {boolean} */ ( - this.get(ol.interaction.InteractionProperty.ACTIVE)); -}; - - -/** - * Get the map associated with this interaction. - * @return {ol.Map} Map. - */ -ol.interaction.Interaction.prototype.getMap = function() { - return this.map_; -}; - - -/** - * Activate or deactivate the interaction. - * @param {boolean} active Active. - * @observable - * @api - */ -ol.interaction.Interaction.prototype.setActive = function(active) { - this.set(ol.interaction.InteractionProperty.ACTIVE, active); -}; - - -/** - * Remove the interaction from its current map and attach it to the new map. - * Subclasses may set up event handlers to get notified about changes to - * the map here. - * @param {ol.Map} map Map. - */ -ol.interaction.Interaction.prototype.setMap = function(map) { - this.map_ = map; -}; - - -/** - * @param {ol.Map} map Map. - * @param {ol.View} view View. - * @param {ol.Coordinate} delta Delta. - * @param {number=} opt_duration Duration. - */ -ol.interaction.Interaction.pan = function(map, view, delta, opt_duration) { - var currentCenter = view.getCenter(); - if (currentCenter) { - if (opt_duration && opt_duration > 0) { - map.beforeRender(ol.animation.pan({ - source: currentCenter, - duration: opt_duration, - easing: ol.easing.linear - })); - } - var center = view.constrainCenter( - [currentCenter[0] + delta[0], currentCenter[1] + delta[1]]); - view.setCenter(center); - } -}; - - -/** - * @param {ol.Map} map Map. - * @param {ol.View} view View. - * @param {number|undefined} rotation Rotation. - * @param {ol.Coordinate=} opt_anchor Anchor coordinate. - * @param {number=} opt_duration Duration. - */ -ol.interaction.Interaction.rotate = - function(map, view, rotation, opt_anchor, opt_duration) { - rotation = view.constrainRotation(rotation, 0); - ol.interaction.Interaction.rotateWithoutConstraints( - map, view, rotation, opt_anchor, opt_duration); -}; - - -/** - * @param {ol.Map} map Map. - * @param {ol.View} view View. - * @param {number|undefined} rotation Rotation. - * @param {ol.Coordinate=} opt_anchor Anchor coordinate. - * @param {number=} opt_duration Duration. - */ -ol.interaction.Interaction.rotateWithoutConstraints = - function(map, view, rotation, opt_anchor, opt_duration) { - if (rotation !== undefined) { - var currentRotation = view.getRotation(); - var currentCenter = view.getCenter(); - if (currentRotation !== undefined && currentCenter && - opt_duration && opt_duration > 0) { - map.beforeRender(ol.animation.rotate({ - rotation: currentRotation, - duration: opt_duration, - easing: ol.easing.easeOut - })); - if (opt_anchor) { - map.beforeRender(ol.animation.pan({ - source: currentCenter, - duration: opt_duration, - easing: ol.easing.easeOut - })); - } - } - view.rotate(rotation, opt_anchor); - } -}; - - -/** - * @param {ol.Map} map Map. - * @param {ol.View} view View. - * @param {number|undefined} resolution Resolution to go to. - * @param {ol.Coordinate=} opt_anchor Anchor coordinate. - * @param {number=} opt_duration Duration. - * @param {number=} opt_direction Zooming direction; > 0 indicates - * zooming out, in which case the constraints system will select - * the largest nearest resolution; < 0 indicates zooming in, in - * which case the constraints system will select the smallest - * nearest resolution; == 0 indicates that the zooming direction - * is unknown/not relevant, in which case the constraints system - * will select the nearest resolution. If not defined 0 is - * assumed. - */ -ol.interaction.Interaction.zoom = - function(map, view, resolution, opt_anchor, opt_duration, opt_direction) { - resolution = view.constrainResolution(resolution, 0, opt_direction); - ol.interaction.Interaction.zoomWithoutConstraints( - map, view, resolution, opt_anchor, opt_duration); -}; - - -/** - * @param {ol.Map} map Map. - * @param {ol.View} view View. - * @param {number} delta Delta from previous zoom level. - * @param {ol.Coordinate=} opt_anchor Anchor coordinate. - * @param {number=} opt_duration Duration. - */ -ol.interaction.Interaction.zoomByDelta = - function(map, view, delta, opt_anchor, opt_duration) { - var currentResolution = view.getResolution(); - var resolution = view.constrainResolution(currentResolution, delta, 0); - ol.interaction.Interaction.zoomWithoutConstraints( - map, view, resolution, opt_anchor, opt_duration); -}; - - -/** - * @param {ol.Map} map Map. - * @param {ol.View} view View. - * @param {number|undefined} resolution Resolution to go to. - * @param {ol.Coordinate=} opt_anchor Anchor coordinate. - * @param {number=} opt_duration Duration. - */ -ol.interaction.Interaction.zoomWithoutConstraints = - function(map, view, resolution, opt_anchor, opt_duration) { - if (resolution) { - var currentResolution = view.getResolution(); - var currentCenter = view.getCenter(); - if (currentResolution !== undefined && currentCenter && - resolution !== currentResolution && - opt_duration && opt_duration > 0) { - map.beforeRender(ol.animation.zoom({ - resolution: currentResolution, - duration: opt_duration, - easing: ol.easing.easeOut - })); - if (opt_anchor) { - map.beforeRender(ol.animation.pan({ - source: currentCenter, - duration: opt_duration, - easing: ol.easing.easeOut - })); - } - } - if (opt_anchor) { - var center = view.calculateCenterZoom(resolution, opt_anchor); - view.setCenter(center); - } - view.setResolution(resolution); - } -}; - -goog.provide('ol.interaction.DoubleClickZoom'); - -goog.require('goog.asserts'); -goog.require('ol.MapBrowserEvent'); -goog.require('ol.MapBrowserEvent.EventType'); -goog.require('ol.interaction.Interaction'); - - - -/** - * @classdesc - * Allows the user to zoom by double-clicking on the map. - * - * @constructor - * @extends {ol.interaction.Interaction} - * @param {olx.interaction.DoubleClickZoomOptions=} opt_options Options. - * @api stable - */ -ol.interaction.DoubleClickZoom = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {number} - */ - this.delta_ = options.delta ? options.delta : 1; - - goog.base(this, { - handleEvent: ol.interaction.DoubleClickZoom.handleEvent - }); - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration ? options.duration : 250; - -}; -goog.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction); - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} (if it was a - * doubleclick) and eventually zooms the map. - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.DoubleClickZoom} - * @api - */ -ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) { - var stopEvent = false; - var browserEvent = mapBrowserEvent.browserEvent; - if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK) { - var map = mapBrowserEvent.map; - var anchor = mapBrowserEvent.coordinate; - var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_; - var view = map.getView(); - goog.asserts.assert(view, 'map must have a view'); - ol.interaction.Interaction.zoomByDelta( - map, view, delta, anchor, this.duration_); - mapBrowserEvent.preventDefault(); - stopEvent = true; - } - return !stopEvent; -}; - -goog.provide('ol.events.ConditionType'); -goog.provide('ol.events.condition'); - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('ol.MapBrowserEvent.EventType'); -goog.require('ol.MapBrowserPointerEvent'); - - -/** - * A function that takes an {@link ol.MapBrowserEvent} and returns a - * `{boolean}`. If the condition is met, true should be returned. - * - * @typedef {function(ol.MapBrowserEvent): boolean} - * @api stable - */ -ol.events.ConditionType; - - -/** - * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when - * additionally the shift-key is pressed). - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if only the alt key is pressed. - * @api stable - */ -ol.events.condition.altKeyOnly = function(mapBrowserEvent) { - var browserEvent = mapBrowserEvent.browserEvent; - return ( - browserEvent.altKey && - !browserEvent.platformModifierKey && - !browserEvent.shiftKey); -}; - - -/** - * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise - * (e.g. when additionally the platform-modifier-key is pressed). - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if only the alt and shift keys are pressed. - * @api stable - */ -ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) { - var browserEvent = mapBrowserEvent.browserEvent; - return ( - browserEvent.altKey && - !browserEvent.platformModifierKey && - browserEvent.shiftKey); -}; - - -/** - * Return always true. - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True. - * @function - * @api stable - */ -ol.events.condition.always = goog.functions.TRUE; - - -/** - * Return `true` if the event is a `click` event, `false` otherwise. - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if the event is a map `click` event. - * @api stable - */ -ol.events.condition.click = function(mapBrowserEvent) { - return mapBrowserEvent.type == ol.MapBrowserEvent.EventType.CLICK; -}; - - -/** - * Return always false. - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} False. - * @function - * @api stable - */ -ol.events.condition.never = goog.functions.FALSE; - - -/** - * Return `true` if the browser event is a `pointermove` event, `false` - * otherwise. - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if the browser event is a `pointermove` event. - * @api - */ -ol.events.condition.pointerMove = function(mapBrowserEvent) { - return mapBrowserEvent.type == 'pointermove'; -}; - - -/** - * Return `true` if the event is a map `singleclick` event, `false` otherwise. - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if the event is a map `singleclick` event. - * @api stable - */ -ol.events.condition.singleClick = function(mapBrowserEvent) { - return mapBrowserEvent.type == ol.MapBrowserEvent.EventType.SINGLECLICK; -}; - - -/** - * Return `true` if the event is a map `dblclick` event, `false` otherwise. - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if the event is a map `dblclick` event. - * @api stable - */ -ol.events.condition.doubleClick = function(mapBrowserEvent) { - return mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK; -}; - - -/** - * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is - * pressed. - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True only if there no modifier keys are pressed. - * @api stable - */ -ol.events.condition.noModifierKeys = function(mapBrowserEvent) { - var browserEvent = mapBrowserEvent.browserEvent; - return ( - !browserEvent.altKey && - !browserEvent.platformModifierKey && - !browserEvent.shiftKey); -}; - - -/** - * Return `true` if only the platform-modifier-key (the meta-key on Mac, - * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally - * the shift-key is pressed). - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if only the platform modifier key is pressed. - * @api stable - */ -ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) { - var browserEvent = mapBrowserEvent.browserEvent; - return ( - !browserEvent.altKey && - browserEvent.platformModifierKey && - !browserEvent.shiftKey); -}; - - -/** - * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when - * additionally the alt-key is pressed). - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if only the shift key is pressed. - * @api stable - */ -ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) { - var browserEvent = mapBrowserEvent.browserEvent; - return ( - !browserEvent.altKey && - !browserEvent.platformModifierKey && - browserEvent.shiftKey); -}; - - -/** - * Return `true` if the target element is not editable, i.e. not a `<input>`-, - * `<select>`- or `<textarea>`-element, `false` otherwise. - * - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} True only if the target element is not editable. - * @api - */ -ol.events.condition.targetNotEditable = function(mapBrowserEvent) { - var target = mapBrowserEvent.browserEvent.target; - goog.asserts.assertInstanceof(target, Element, - 'target should be an Element'); - var tagName = target.tagName; - return ( - tagName !== 'INPUT' && - tagName !== 'SELECT' && - tagName !== 'TEXTAREA'); -}; - - -/** - * Return `true` if the event originates from a mouse device. - * - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Map browser event. - * @return {boolean} True if the event originates from a mouse device. - * @api stable - */ -ol.events.condition.mouseOnly = function(mapBrowserEvent) { - // see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType - return mapBrowserEvent.pointerEvent.pointerType == 'mouse'; -}; - -goog.provide('ol.interaction.Pointer'); - -goog.require('goog.functions'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.MapBrowserEvent.EventType'); -goog.require('ol.MapBrowserPointerEvent'); -goog.require('ol.Pixel'); -goog.require('ol.interaction.Interaction'); - - - -/** - * @classdesc - * Base class that calls user-defined functions on `down`, `move` and `up` - * events. This class also manages "drag sequences". - * - * When the `handleDownEvent` user function returns `true` a drag sequence is - * started. During a drag sequence the `handleDragEvent` user function is - * called on `move` events. The drag sequence ends when the `handleUpEvent` - * user function is called and returns `false`. - * - * @constructor - * @param {olx.interaction.PointerOptions=} opt_options Options. - * @extends {ol.interaction.Interaction} - * @api - */ -ol.interaction.Pointer = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - var handleEvent = options.handleEvent ? - options.handleEvent : ol.interaction.Pointer.handleEvent; - - goog.base(this, { - handleEvent: handleEvent - }); - - /** - * @type {function(ol.MapBrowserPointerEvent):boolean} - * @private - */ - this.handleDownEvent_ = options.handleDownEvent ? - options.handleDownEvent : ol.interaction.Pointer.handleDownEvent; - - /** - * @type {function(ol.MapBrowserPointerEvent)} - * @private - */ - this.handleDragEvent_ = options.handleDragEvent ? - options.handleDragEvent : ol.interaction.Pointer.handleDragEvent; - - /** - * @type {function(ol.MapBrowserPointerEvent)} - * @private - */ - this.handleMoveEvent_ = options.handleMoveEvent ? - options.handleMoveEvent : ol.interaction.Pointer.handleMoveEvent; - - /** - * @type {function(ol.MapBrowserPointerEvent):boolean} - * @private - */ - this.handleUpEvent_ = options.handleUpEvent ? - options.handleUpEvent : ol.interaction.Pointer.handleUpEvent; - - /** - * @type {boolean} - * @protected - */ - this.handlingDownUpSequence = false; - - /** - * @type {Object.<number, ol.pointer.PointerEvent>} - * @private - */ - this.trackedPointers_ = {}; - - /** - * @type {Array.<ol.pointer.PointerEvent>} - * @protected - */ - this.targetPointers = []; - -}; -goog.inherits(ol.interaction.Pointer, ol.interaction.Interaction); - - -/** - * @param {Array.<ol.pointer.PointerEvent>} pointerEvents - * @return {ol.Pixel} Centroid pixel. - */ -ol.interaction.Pointer.centroid = function(pointerEvents) { - var length = pointerEvents.length; - var clientX = 0; - var clientY = 0; - for (var i = 0; i < length; i++) { - clientX += pointerEvents[i].clientX; - clientY += pointerEvents[i].clientY; - } - return [clientX / length, clientY / length]; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Whether the event is a pointerdown, pointerdrag - * or pointerup event. - * @private - */ -ol.interaction.Pointer.prototype.isPointerDraggingEvent_ = - function(mapBrowserEvent) { - var type = mapBrowserEvent.type; - return ( - type === ol.MapBrowserEvent.EventType.POINTERDOWN || - type === ol.MapBrowserEvent.EventType.POINTERDRAG || - type === ol.MapBrowserEvent.EventType.POINTERUP); -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @private - */ -ol.interaction.Pointer.prototype.updateTrackedPointers_ = - function(mapBrowserEvent) { - if (this.isPointerDraggingEvent_(mapBrowserEvent)) { - var event = mapBrowserEvent.pointerEvent; - - if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERUP) { - delete this.trackedPointers_[event.pointerId]; - } else if (mapBrowserEvent.type == - ol.MapBrowserEvent.EventType.POINTERDOWN) { - this.trackedPointers_[event.pointerId] = event; - } else if (event.pointerId in this.trackedPointers_) { - // update only when there was a pointerdown event for this pointer - this.trackedPointers_[event.pointerId] = event; - } - this.targetPointers = goog.object.getValues(this.trackedPointers_); - } -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.Pointer} - */ -ol.interaction.Pointer.handleDragEvent = ol.nullFunction; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Capture dragging. - * @this {ol.interaction.Pointer} - */ -ol.interaction.Pointer.handleUpEvent = goog.functions.FALSE; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Capture dragging. - * @this {ol.interaction.Pointer} - */ -ol.interaction.Pointer.handleDownEvent = goog.functions.FALSE; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.Pointer} - */ -ol.interaction.Pointer.handleMoveEvent = ol.nullFunction; - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} and may call into - * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are - * detected. - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.Pointer} - * @api - */ -ol.interaction.Pointer.handleEvent = function(mapBrowserEvent) { - if (!(mapBrowserEvent instanceof ol.MapBrowserPointerEvent)) { - return true; - } - - var stopEvent = false; - this.updateTrackedPointers_(mapBrowserEvent); - if (this.handlingDownUpSequence) { - if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERDRAG) { - this.handleDragEvent_(mapBrowserEvent); - } else if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERUP) { - this.handlingDownUpSequence = this.handleUpEvent_(mapBrowserEvent); - } - } - if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERDOWN) { - var handled = this.handleDownEvent_(mapBrowserEvent); - this.handlingDownUpSequence = handled; - stopEvent = this.shouldStopEvent(handled); - } else if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE) { - this.handleMoveEvent_(mapBrowserEvent); - } - return !stopEvent; -}; - - -/** - * This method is used to determine if "down" events should be propagated to - * other interactions or should be stopped. - * - * The method receives the return code of the "handleDownEvent" function. - * - * By default this function is the "identity" function. It's overidden in - * child classes. - * - * @param {boolean} handled Was the event handled by the interaction? - * @return {boolean} Should the event be stopped? - * @protected - */ -ol.interaction.Pointer.prototype.shouldStopEvent = goog.functions.identity; - -goog.provide('ol.interaction.DragPan'); - -goog.require('goog.asserts'); -goog.require('ol.Kinetic'); -goog.require('ol.Pixel'); -goog.require('ol.PreRenderFunction'); -goog.require('ol.ViewHint'); -goog.require('ol.coordinate'); -goog.require('ol.events.condition'); -goog.require('ol.interaction.Pointer'); - - - -/** - * @classdesc - * Allows the user to pan the map by dragging the map. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @param {olx.interaction.DragPanOptions=} opt_options Options. - * @api stable - */ -ol.interaction.DragPan = function(opt_options) { - - goog.base(this, { - handleDownEvent: ol.interaction.DragPan.handleDownEvent_, - handleDragEvent: ol.interaction.DragPan.handleDragEvent_, - handleUpEvent: ol.interaction.DragPan.handleUpEvent_ - }); - - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {ol.Kinetic|undefined} - */ - this.kinetic_ = options.kinetic; - - /** - * @private - * @type {?ol.PreRenderFunction} - */ - this.kineticPreRenderFn_ = null; - - /** - * @type {ol.Pixel} - */ - this.lastCentroid = null; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.condition_ = options.condition ? - options.condition : ol.events.condition.noModifierKeys; - - /** - * @private - * @type {boolean} - */ - this.noKinetic_ = false; - -}; -goog.inherits(ol.interaction.DragPan, ol.interaction.Pointer); - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.DragPan} - * @private - */ -ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) { - goog.asserts.assert(this.targetPointers.length >= 1, - 'the length of this.targetPointers should be more than 1'); - var centroid = - ol.interaction.Pointer.centroid(this.targetPointers); - if (this.kinetic_) { - this.kinetic_.update(centroid[0], centroid[1]); - } - if (this.lastCentroid) { - var deltaX = this.lastCentroid[0] - centroid[0]; - var deltaY = centroid[1] - this.lastCentroid[1]; - var map = mapBrowserEvent.map; - var view = map.getView(); - var viewState = view.getState(); - var center = [deltaX, deltaY]; - ol.coordinate.scale(center, viewState.resolution); - ol.coordinate.rotate(center, viewState.rotation); - ol.coordinate.add(center, viewState.center); - center = view.constrainCenter(center); - map.render(); - view.setCenter(center); - } - this.lastCentroid = centroid; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.DragPan} - * @private - */ -ol.interaction.DragPan.handleUpEvent_ = function(mapBrowserEvent) { - var map = mapBrowserEvent.map; - var view = map.getView(); - if (this.targetPointers.length === 0) { - if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) { - var distance = this.kinetic_.getDistance(); - var angle = this.kinetic_.getAngle(); - var center = view.getCenter(); - goog.asserts.assert(center !== undefined, 'center should be defined'); - this.kineticPreRenderFn_ = this.kinetic_.pan(center); - map.beforeRender(this.kineticPreRenderFn_); - var centerpx = map.getPixelFromCoordinate(center); - var dest = map.getCoordinateFromPixel([ - centerpx[0] - distance * Math.cos(angle), - centerpx[1] - distance * Math.sin(angle) - ]); - dest = view.constrainCenter(dest); - view.setCenter(dest); - } - view.setHint(ol.ViewHint.INTERACTING, -1); - map.render(); - return false; - } else { - this.lastCentroid = null; - return true; - } -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.DragPan} - * @private - */ -ol.interaction.DragPan.handleDownEvent_ = function(mapBrowserEvent) { - if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) { - var map = mapBrowserEvent.map; - var view = map.getView(); - this.lastCentroid = null; - if (!this.handlingDownUpSequence) { - view.setHint(ol.ViewHint.INTERACTING, 1); - } - map.render(); - if (this.kineticPreRenderFn_ && - map.removePreRenderFunction(this.kineticPreRenderFn_)) { - view.setCenter(mapBrowserEvent.frameState.viewState.center); - this.kineticPreRenderFn_ = null; - } - if (this.kinetic_) { - this.kinetic_.begin(); - } - // No kinetic as soon as more than one pointer on the screen is - // detected. This is to prevent nasty pans after pinch. - this.noKinetic_ = this.targetPointers.length > 1; - return true; - } else { - return false; - } -}; - - -/** - * @inheritDoc - */ -ol.interaction.DragPan.prototype.shouldStopEvent = goog.functions.FALSE; - -goog.provide('ol.interaction.DragRotate'); - -goog.require('ol'); -goog.require('ol.ViewHint'); -goog.require('ol.events.ConditionType'); -goog.require('ol.events.condition'); -goog.require('ol.interaction.Interaction'); -goog.require('ol.interaction.Pointer'); - - - -/** - * @classdesc - * Allows the user to rotate the map by clicking and dragging on the map, - * normally combined with an {@link ol.events.condition} that limits - * it to when the alt and shift keys are held down. - * - * This interaction is only supported for mouse devices. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @param {olx.interaction.DragRotateOptions=} opt_options Options. - * @api stable - */ -ol.interaction.DragRotate = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this, { - handleDownEvent: ol.interaction.DragRotate.handleDownEvent_, - handleDragEvent: ol.interaction.DragRotate.handleDragEvent_, - handleUpEvent: ol.interaction.DragRotate.handleUpEvent_ - }); - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.condition_ = options.condition ? - options.condition : ol.events.condition.altShiftKeysOnly; - - /** - * @private - * @type {number|undefined} - */ - this.lastAngle_ = undefined; - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration ? options.duration : 250; -}; -goog.inherits(ol.interaction.DragRotate, ol.interaction.Pointer); - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.DragRotate} - * @private - */ -ol.interaction.DragRotate.handleDragEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return; - } - - var map = mapBrowserEvent.map; - var size = map.getSize(); - var offset = mapBrowserEvent.pixel; - var theta = - Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2); - if (this.lastAngle_ !== undefined) { - var delta = theta - this.lastAngle_; - var view = map.getView(); - var rotation = view.getRotation(); - map.render(); - ol.interaction.Interaction.rotateWithoutConstraints( - map, view, rotation - delta); - } - this.lastAngle_ = theta; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.DragRotate} - * @private - */ -ol.interaction.DragRotate.handleUpEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return true; - } - - var map = mapBrowserEvent.map; - var view = map.getView(); - view.setHint(ol.ViewHint.INTERACTING, -1); - var rotation = view.getRotation(); - ol.interaction.Interaction.rotate(map, view, rotation, - undefined, this.duration_); - return false; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.DragRotate} - * @private - */ -ol.interaction.DragRotate.handleDownEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return false; - } - - var browserEvent = mapBrowserEvent.browserEvent; - if (browserEvent.isMouseActionButton() && this.condition_(mapBrowserEvent)) { - var map = mapBrowserEvent.map; - map.getView().setHint(ol.ViewHint.INTERACTING, 1); - map.render(); - this.lastAngle_ = undefined; - return true; - } else { - return false; - } -}; - - -/** - * @inheritDoc - */ -ol.interaction.DragRotate.prototype.shouldStopEvent = goog.functions.FALSE; - -// FIXME add rotation - -goog.provide('ol.render.Box'); - -goog.require('goog.Disposable'); -goog.require('goog.asserts'); -goog.require('ol.geom.Polygon'); - - - -/** - * @constructor - * @extends {goog.Disposable} - * @param {string} className CSS class name. - */ -ol.render.Box = function(className) { - - /** - * @type {ol.geom.Polygon} - * @private - */ - this.geometry_ = null; - - /** - * @type {HTMLDivElement} - * @private - */ - this.element_ = /** @type {HTMLDivElement} */ (document.createElement('div')); - this.element_.style.position = 'absolute'; - this.element_.className = 'ol-box ' + className; - - /** - * @private - * @type {ol.Map} - */ - this.map_ = null; - - /** - * @private - * @type {ol.Pixel} - */ - this.startPixel_ = null; - - /** - * @private - * @type {ol.Pixel} - */ - this.endPixel_ = null; - -}; -goog.inherits(ol.render.Box, goog.Disposable); - - -/** - * @inheritDoc - */ -ol.render.Box.prototype.disposeInternal = function() { - this.setMap(null); - goog.base(this, 'disposeInternal'); -}; - - -/** - * @private - */ -ol.render.Box.prototype.render_ = function() { - var startPixel = this.startPixel_; - var endPixel = this.endPixel_; - goog.asserts.assert(startPixel, 'this.startPixel_ must be truthy'); - goog.asserts.assert(endPixel, 'this.endPixel_ must be truthy'); - var px = 'px'; - var style = this.element_.style; - style.left = Math.min(startPixel[0], endPixel[0]) + px; - style.top = Math.min(startPixel[1], endPixel[1]) + px; - style.width = Math.abs(endPixel[0] - startPixel[0]) + px; - style.height = Math.abs(endPixel[1] - startPixel[1]) + px; -}; - - -/** - * @param {ol.Map} map Map. - */ -ol.render.Box.prototype.setMap = function(map) { - if (this.map_) { - this.map_.getOverlayContainer().removeChild(this.element_); - var style = this.element_.style; - style.left = style.top = style.width = style.height = 'inherit'; - } - this.map_ = map; - if (this.map_) { - this.map_.getOverlayContainer().appendChild(this.element_); - } -}; - - -/** - * @param {ol.Pixel} startPixel Start pixel. - * @param {ol.Pixel} endPixel End pixel. - */ -ol.render.Box.prototype.setPixels = function(startPixel, endPixel) { - this.startPixel_ = startPixel; - this.endPixel_ = endPixel; - this.createOrUpdateGeometry(); - this.render_(); -}; - - -/** - * Creates or updates the cached geometry. - */ -ol.render.Box.prototype.createOrUpdateGeometry = function() { - goog.asserts.assert(this.startPixel_, - 'this.startPixel_ must be truthy'); - goog.asserts.assert(this.endPixel_, - 'this.endPixel_ must be truthy'); - goog.asserts.assert(this.map_, 'this.map_ must be truthy'); - var startPixel = this.startPixel_; - var endPixel = this.endPixel_; - var pixels = [ - startPixel, - [startPixel[0], endPixel[1]], - endPixel, - [endPixel[0], startPixel[1]] - ]; - var coordinates = pixels.map(this.map_.getCoordinateFromPixel, this.map_); - // close the polygon - coordinates[4] = coordinates[0].slice(); - if (!this.geometry_) { - this.geometry_ = new ol.geom.Polygon([coordinates]); - } else { - this.geometry_.setCoordinates([coordinates]); - } -}; - - -/** - * @return {ol.geom.Polygon} Geometry. - */ -ol.render.Box.prototype.getGeometry = function() { - return this.geometry_; -}; - -// FIXME draw drag box -goog.provide('ol.DragBoxEvent'); -goog.provide('ol.interaction.DragBox'); - -goog.require('goog.events.Event'); -goog.require('ol'); -goog.require('ol.events.ConditionType'); -goog.require('ol.events.condition'); -goog.require('ol.interaction.Pointer'); -goog.require('ol.render.Box'); - - -/** - * @const - * @type {number} - */ -ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED = - ol.DRAG_BOX_HYSTERESIS_PIXELS * - ol.DRAG_BOX_HYSTERESIS_PIXELS; - - -/** - * @enum {string} - */ -ol.DragBoxEventType = { - /** - * Triggered upon drag box start. - * @event ol.DragBoxEvent#boxstart - * @api stable - */ - BOXSTART: 'boxstart', - /** - * Triggered upon drag box end. - * @event ol.DragBoxEvent#boxend - * @api stable - */ - BOXEND: 'boxend' -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.interaction.DragBox} instances are instances of - * this type. - * - * @param {string} type The event type. - * @param {ol.Coordinate} coordinate The event coordinate. - * @extends {goog.events.Event} - * @constructor - * @implements {oli.DragBoxEvent} - */ -ol.DragBoxEvent = function(type, coordinate) { - goog.base(this, type); - - /** - * The coordinate of the drag event. - * @const - * @type {ol.Coordinate} - * @api stable - */ - this.coordinate = coordinate; - -}; -goog.inherits(ol.DragBoxEvent, goog.events.Event); - - - -/** - * @classdesc - * Allows the user to draw a vector box by clicking and dragging on the map, - * normally combined with an {@link ol.events.condition} that limits - * it to when the shift or other key is held down. This is used, for example, - * for zooming to a specific area of the map - * (see {@link ol.interaction.DragZoom} and - * {@link ol.interaction.DragRotateAndZoom}). - * - * This interaction is only supported for mouse devices. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @fires ol.DragBoxEvent - * @param {olx.interaction.DragBoxOptions=} opt_options Options. - * @api stable - */ -ol.interaction.DragBox = function(opt_options) { - - goog.base(this, { - handleDownEvent: ol.interaction.DragBox.handleDownEvent_, - handleDragEvent: ol.interaction.DragBox.handleDragEvent_, - handleUpEvent: ol.interaction.DragBox.handleUpEvent_ - }); - - var options = opt_options ? opt_options : {}; - - /** - * @type {ol.render.Box} - * @private - */ - this.box_ = new ol.render.Box(options.className || 'ol-dragbox'); - - /** - * @type {ol.Pixel} - * @private - */ - this.startPixel_ = null; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.condition_ = options.condition ? - options.condition : ol.events.condition.always; - -}; -goog.inherits(ol.interaction.DragBox, ol.interaction.Pointer); - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.DragBox} - * @private - */ -ol.interaction.DragBox.handleDragEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return; - } - - this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); -}; - - -/** - * Returns geometry of last drawn box. - * @return {ol.geom.Polygon} Geometry. - * @api stable - */ -ol.interaction.DragBox.prototype.getGeometry = function() { - return this.box_.getGeometry(); -}; - - -/** - * To be overriden by child classes. - * FIXME: use constructor option instead of relying on overridding. - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @protected - */ -ol.interaction.DragBox.prototype.onBoxEnd = ol.nullFunction; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.DragBox} - * @private - */ -ol.interaction.DragBox.handleUpEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return true; - } - - this.box_.setMap(null); - - var deltaX = mapBrowserEvent.pixel[0] - this.startPixel_[0]; - var deltaY = mapBrowserEvent.pixel[1] - this.startPixel_[1]; - - if (deltaX * deltaX + deltaY * deltaY >= - ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED) { - this.onBoxEnd(mapBrowserEvent); - this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXEND, - mapBrowserEvent.coordinate)); - } - return false; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.DragBox} - * @private - */ -ol.interaction.DragBox.handleDownEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return false; - } - - var browserEvent = mapBrowserEvent.browserEvent; - if (browserEvent.isMouseActionButton() && this.condition_(mapBrowserEvent)) { - this.startPixel_ = mapBrowserEvent.pixel; - this.box_.setMap(mapBrowserEvent.map); - this.box_.setPixels(this.startPixel_, this.startPixel_); - this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXSTART, - mapBrowserEvent.coordinate)); - return true; - } else { - return false; - } -}; - -goog.provide('ol.interaction.DragZoom'); - -goog.require('goog.asserts'); -goog.require('ol.animation'); -goog.require('ol.easing'); -goog.require('ol.events.condition'); -goog.require('ol.extent'); -goog.require('ol.interaction.DragBox'); - - - -/** - * @classdesc - * Allows the user to zoom the map by clicking and dragging on the map, - * normally combined with an {@link ol.events.condition} that limits - * it to when a key, shift by default, is held down. - * - * To change the style of the box, use CSS and the `.ol-dragzoom` selector, or - * your custom one configured with `className`. - * - * @constructor - * @extends {ol.interaction.DragBox} - * @param {olx.interaction.DragZoomOptions=} opt_options Options. - * @api stable - */ -ol.interaction.DragZoom = function(opt_options) { - var options = opt_options ? opt_options : {}; - - var condition = options.condition ? - options.condition : ol.events.condition.shiftKeyOnly; - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration !== undefined ? options.duration : 200; - - goog.base(this, { - condition: condition, - className: options.className || 'ol-dragzoom' - }); - -}; -goog.inherits(ol.interaction.DragZoom, ol.interaction.DragBox); - - -/** - * @inheritDoc - */ -ol.interaction.DragZoom.prototype.onBoxEnd = function() { - var map = this.getMap(); - - var view = map.getView(); - goog.asserts.assert(view, 'map must have view'); - - var size = map.getSize(); - goog.asserts.assert(size !== undefined, 'size should be defined'); - - var extent = this.getGeometry().getExtent(); - - var resolution = view.constrainResolution( - view.getResolutionForExtent(extent, size)); - - var currentResolution = view.getResolution(); - goog.asserts.assert(currentResolution !== undefined, 'res should be defined'); - - var currentCenter = view.getCenter(); - goog.asserts.assert(currentCenter !== undefined, 'center should be defined'); - - map.beforeRender(ol.animation.zoom({ - resolution: currentResolution, - duration: this.duration_, - easing: ol.easing.easeOut - })); - map.beforeRender(ol.animation.pan({ - source: currentCenter, - duration: this.duration_, - easing: ol.easing.easeOut - })); - - view.setCenter(ol.extent.getCenter(extent)); - view.setResolution(resolution); -}; - -goog.provide('ol.interaction.KeyboardPan'); - -goog.require('goog.asserts'); -goog.require('goog.events.KeyCodes'); -goog.require('goog.events.KeyHandler.EventType'); -goog.require('goog.functions'); -goog.require('ol'); -goog.require('ol.coordinate'); -goog.require('ol.events.ConditionType'); -goog.require('ol.events.condition'); -goog.require('ol.interaction.Interaction'); - - - -/** - * @classdesc - * Allows the user to pan the map using keyboard arrows. - * Note that, although this interaction is by default included in maps, - * the keys can only be used when browser focus is on the element to which - * the keyboard events are attached. By default, this is the map div, - * though you can change this with the `keyboardEventTarget` in - * {@link ol.Map}. `document` never loses focus but, for any other element, - * focus will have to be on, and returned to, this element if the keys are to - * function. - * See also {@link ol.interaction.KeyboardZoom}. - * - * @constructor - * @extends {ol.interaction.Interaction} - * @param {olx.interaction.KeyboardPanOptions=} opt_options Options. - * @api stable - */ -ol.interaction.KeyboardPan = function(opt_options) { - - goog.base(this, { - handleEvent: ol.interaction.KeyboardPan.handleEvent - }); - - var options = opt_options || {}; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.condition_ = options.condition !== undefined ? - options.condition : - goog.functions.and(ol.events.condition.noModifierKeys, - ol.events.condition.targetNotEditable); - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration !== undefined ? options.duration : 100; - - /** - * @private - * @type {number} - */ - this.pixelDelta_ = options.pixelDelta !== undefined ? - options.pixelDelta : 128; - -}; -goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction); - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} if it was a - * `KeyEvent`, and decides the direction to pan to (if an arrow key was - * pressed). - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.KeyboardPan} - * @api - */ -ol.interaction.KeyboardPan.handleEvent = function(mapBrowserEvent) { - var stopEvent = false; - if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) { - var keyEvent = /** @type {goog.events.KeyEvent} */ - (mapBrowserEvent.browserEvent); - var keyCode = keyEvent.keyCode; - if (this.condition_(mapBrowserEvent) && - (keyCode == goog.events.KeyCodes.DOWN || - keyCode == goog.events.KeyCodes.LEFT || - keyCode == goog.events.KeyCodes.RIGHT || - keyCode == goog.events.KeyCodes.UP)) { - var map = mapBrowserEvent.map; - var view = map.getView(); - goog.asserts.assert(view, 'map must have view'); - var mapUnitsDelta = view.getResolution() * this.pixelDelta_; - var deltaX = 0, deltaY = 0; - if (keyCode == goog.events.KeyCodes.DOWN) { - deltaY = -mapUnitsDelta; - } else if (keyCode == goog.events.KeyCodes.LEFT) { - deltaX = -mapUnitsDelta; - } else if (keyCode == goog.events.KeyCodes.RIGHT) { - deltaX = mapUnitsDelta; - } else { - deltaY = mapUnitsDelta; - } - var delta = [deltaX, deltaY]; - ol.coordinate.rotate(delta, view.getRotation()); - ol.interaction.Interaction.pan(map, view, delta, this.duration_); - mapBrowserEvent.preventDefault(); - stopEvent = true; - } - } - return !stopEvent; -}; - -goog.provide('ol.interaction.KeyboardZoom'); - -goog.require('goog.asserts'); -goog.require('goog.events.KeyHandler.EventType'); -goog.require('ol.events.ConditionType'); -goog.require('ol.events.condition'); -goog.require('ol.interaction.Interaction'); - - - -/** - * @classdesc - * Allows the user to zoom the map using keyboard + and -. - * Note that, although this interaction is by default included in maps, - * the keys can only be used when browser focus is on the element to which - * the keyboard events are attached. By default, this is the map div, - * though you can change this with the `keyboardEventTarget` in - * {@link ol.Map}. `document` never loses focus but, for any other element, - * focus will have to be on, and returned to, this element if the keys are to - * function. - * See also {@link ol.interaction.KeyboardPan}. - * - * @constructor - * @param {olx.interaction.KeyboardZoomOptions=} opt_options Options. - * @extends {ol.interaction.Interaction} - * @api stable - */ -ol.interaction.KeyboardZoom = function(opt_options) { - - goog.base(this, { - handleEvent: ol.interaction.KeyboardZoom.handleEvent - }); - - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.condition_ = options.condition ? options.condition : - ol.events.condition.targetNotEditable; - - /** - * @private - * @type {number} - */ - this.delta_ = options.delta ? options.delta : 1; - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration !== undefined ? options.duration : 100; - -}; -goog.inherits(ol.interaction.KeyboardZoom, ol.interaction.Interaction); - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} if it was a - * `KeyEvent`, and decides whether to zoom in or out (depending on whether the - * key pressed was '+' or '-'). - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.KeyboardZoom} - * @api - */ -ol.interaction.KeyboardZoom.handleEvent = function(mapBrowserEvent) { - var stopEvent = false; - if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) { - var keyEvent = /** @type {goog.events.KeyEvent} */ - (mapBrowserEvent.browserEvent); - var charCode = keyEvent.charCode; - if (this.condition_(mapBrowserEvent) && - (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) { - var map = mapBrowserEvent.map; - var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_; - map.render(); - var view = map.getView(); - goog.asserts.assert(view, 'map must have view'); - ol.interaction.Interaction.zoomByDelta( - map, view, delta, undefined, this.duration_); - mapBrowserEvent.preventDefault(); - stopEvent = true; - } - } - return !stopEvent; -}; - -goog.provide('ol.interaction.MouseWheelZoom'); - -goog.require('goog.asserts'); -goog.require('goog.events.MouseWheelEvent'); -goog.require('goog.events.MouseWheelHandler.EventType'); -goog.require('ol'); -goog.require('ol.Coordinate'); -goog.require('ol.interaction.Interaction'); -goog.require('ol.math'); - - - -/** - * @classdesc - * Allows the user to zoom the map by scrolling the mouse wheel. - * - * @constructor - * @extends {ol.interaction.Interaction} - * @param {olx.interaction.MouseWheelZoomOptions=} opt_options Options. - * @api stable - */ -ol.interaction.MouseWheelZoom = function(opt_options) { - - goog.base(this, { - handleEvent: ol.interaction.MouseWheelZoom.handleEvent - }); - - var options = opt_options || {}; - - /** - * @private - * @type {number} - */ - this.delta_ = 0; - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration !== undefined ? options.duration : 250; - - /** - * @private - * @type {boolean} - */ - this.useAnchor_ = options.useAnchor !== undefined ? options.useAnchor : true; - - /** - * @private - * @type {?ol.Coordinate} - */ - this.lastAnchor_ = null; - - /** - * @private - * @type {number|undefined} - */ - this.startTime_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.timeoutId_ = undefined; - -}; -goog.inherits(ol.interaction.MouseWheelZoom, ol.interaction.Interaction); - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} (if it was a - * mousewheel-event) and eventually zooms the map. - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.MouseWheelZoom} - * @api - */ -ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) { - var stopEvent = false; - if (mapBrowserEvent.type == - goog.events.MouseWheelHandler.EventType.MOUSEWHEEL) { - var map = mapBrowserEvent.map; - var mouseWheelEvent = mapBrowserEvent.browserEvent; - goog.asserts.assertInstanceof(mouseWheelEvent, goog.events.MouseWheelEvent, - 'mouseWheelEvent should be of type MouseWheelEvent'); - - if (this.useAnchor_) { - this.lastAnchor_ = mapBrowserEvent.coordinate; - } - - this.delta_ += mouseWheelEvent.deltaY; - - if (this.startTime_ === undefined) { - this.startTime_ = Date.now(); - } - - var duration = ol.MOUSEWHEELZOOM_TIMEOUT_DURATION; - var timeLeft = Math.max(duration - (Date.now() - this.startTime_), 0); - - goog.global.clearTimeout(this.timeoutId_); - this.timeoutId_ = goog.global.setTimeout( - goog.bind(this.doZoom_, this, map), timeLeft); - - mapBrowserEvent.preventDefault(); - stopEvent = true; - } - return !stopEvent; -}; - - -/** - * @private - * @param {ol.Map} map Map. - */ -ol.interaction.MouseWheelZoom.prototype.doZoom_ = function(map) { - var maxDelta = ol.MOUSEWHEELZOOM_MAXDELTA; - var delta = ol.math.clamp(this.delta_, -maxDelta, maxDelta); - - var view = map.getView(); - goog.asserts.assert(view, 'map must have view'); - - map.render(); - ol.interaction.Interaction.zoomByDelta(map, view, -delta, this.lastAnchor_, - this.duration_); - - this.delta_ = 0; - this.lastAnchor_ = null; - this.startTime_ = undefined; - this.timeoutId_ = undefined; -}; - - -/** - * Enable or disable using the mouse's location as an anchor when zooming - * @param {boolean} useAnchor true to zoom to the mouse's location, false - * to zoom to the center of the map - * @api - */ -ol.interaction.MouseWheelZoom.prototype.setMouseAnchor = function(useAnchor) { - this.useAnchor_ = useAnchor; - if (!useAnchor) { - this.lastAnchor_ = null; - } -}; - -goog.provide('ol.interaction.PinchRotate'); - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('goog.style'); -goog.require('ol'); -goog.require('ol.Coordinate'); -goog.require('ol.ViewHint'); -goog.require('ol.interaction.Interaction'); -goog.require('ol.interaction.Pointer'); - - - -/** - * @classdesc - * Allows the user to rotate the map by twisting with two fingers - * on a touch screen. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @param {olx.interaction.PinchRotateOptions=} opt_options Options. - * @api stable - */ -ol.interaction.PinchRotate = function(opt_options) { - - goog.base(this, { - handleDownEvent: ol.interaction.PinchRotate.handleDownEvent_, - handleDragEvent: ol.interaction.PinchRotate.handleDragEvent_, - handleUpEvent: ol.interaction.PinchRotate.handleUpEvent_ - }); - - var options = opt_options || {}; - - /** - * @private - * @type {ol.Coordinate} - */ - this.anchor_ = null; - - /** - * @private - * @type {number|undefined} - */ - this.lastAngle_ = undefined; - - /** - * @private - * @type {boolean} - */ - this.rotating_ = false; - - /** - * @private - * @type {number} - */ - this.rotationDelta_ = 0.0; - - /** - * @private - * @type {number} - */ - this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3; - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration !== undefined ? options.duration : 250; - -}; -goog.inherits(ol.interaction.PinchRotate, ol.interaction.Pointer); - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.PinchRotate} - * @private - */ -ol.interaction.PinchRotate.handleDragEvent_ = function(mapBrowserEvent) { - goog.asserts.assert(this.targetPointers.length >= 2, - 'length of this.targetPointers should be greater than or equal to 2'); - var rotationDelta = 0.0; - - var touch0 = this.targetPointers[0]; - var touch1 = this.targetPointers[1]; - - // angle between touches - var angle = Math.atan2( - touch1.clientY - touch0.clientY, - touch1.clientX - touch0.clientX); - - if (this.lastAngle_ !== undefined) { - var delta = angle - this.lastAngle_; - this.rotationDelta_ += delta; - if (!this.rotating_ && - Math.abs(this.rotationDelta_) > this.threshold_) { - this.rotating_ = true; - } - rotationDelta = delta; - } - this.lastAngle_ = angle; - - var map = mapBrowserEvent.map; - - // rotate anchor point. - // FIXME: should be the intersection point between the lines: - // touch0,touch1 and previousTouch0,previousTouch1 - var viewportPosition = goog.style.getClientPosition(map.getViewport()); - var centroid = - ol.interaction.Pointer.centroid(this.targetPointers); - centroid[0] -= viewportPosition.x; - centroid[1] -= viewportPosition.y; - this.anchor_ = map.getCoordinateFromPixel(centroid); - - // rotate - if (this.rotating_) { - var view = map.getView(); - var rotation = view.getRotation(); - map.render(); - ol.interaction.Interaction.rotateWithoutConstraints(map, view, - rotation + rotationDelta, this.anchor_); - } -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.PinchRotate} - * @private - */ -ol.interaction.PinchRotate.handleUpEvent_ = function(mapBrowserEvent) { - if (this.targetPointers.length < 2) { - var map = mapBrowserEvent.map; - var view = map.getView(); - view.setHint(ol.ViewHint.INTERACTING, -1); - if (this.rotating_) { - var rotation = view.getRotation(); - ol.interaction.Interaction.rotate( - map, view, rotation, this.anchor_, this.duration_); - } - return false; - } else { - return true; - } -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.PinchRotate} - * @private - */ -ol.interaction.PinchRotate.handleDownEvent_ = function(mapBrowserEvent) { - if (this.targetPointers.length >= 2) { - var map = mapBrowserEvent.map; - this.anchor_ = null; - this.lastAngle_ = undefined; - this.rotating_ = false; - this.rotationDelta_ = 0.0; - if (!this.handlingDownUpSequence) { - map.getView().setHint(ol.ViewHint.INTERACTING, 1); - } - map.render(); - return true; - } else { - return false; - } -}; - - -/** - * @inheritDoc - */ -ol.interaction.PinchRotate.prototype.shouldStopEvent = goog.functions.FALSE; - -goog.provide('ol.interaction.PinchZoom'); - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('goog.style'); -goog.require('ol'); -goog.require('ol.Coordinate'); -goog.require('ol.ViewHint'); -goog.require('ol.interaction.Interaction'); -goog.require('ol.interaction.Pointer'); - - - -/** - * @classdesc - * Allows the user to zoom the map by pinching with two fingers - * on a touch screen. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @param {olx.interaction.PinchZoomOptions=} opt_options Options. - * @api stable - */ -ol.interaction.PinchZoom = function(opt_options) { - - goog.base(this, { - handleDownEvent: ol.interaction.PinchZoom.handleDownEvent_, - handleDragEvent: ol.interaction.PinchZoom.handleDragEvent_, - handleUpEvent: ol.interaction.PinchZoom.handleUpEvent_ - }); - - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {ol.Coordinate} - */ - this.anchor_ = null; - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration !== undefined ? options.duration : 400; - - /** - * @private - * @type {number|undefined} - */ - this.lastDistance_ = undefined; - - /** - * @private - * @type {number} - */ - this.lastScaleDelta_ = 1; - -}; -goog.inherits(ol.interaction.PinchZoom, ol.interaction.Pointer); - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.PinchZoom} - * @private - */ -ol.interaction.PinchZoom.handleDragEvent_ = function(mapBrowserEvent) { - goog.asserts.assert(this.targetPointers.length >= 2, - 'length of this.targetPointers should be 2 or more'); - var scaleDelta = 1.0; - - var touch0 = this.targetPointers[0]; - var touch1 = this.targetPointers[1]; - var dx = touch0.clientX - touch1.clientX; - var dy = touch0.clientY - touch1.clientY; - - // distance between touches - var distance = Math.sqrt(dx * dx + dy * dy); - - if (this.lastDistance_ !== undefined) { - scaleDelta = this.lastDistance_ / distance; - } - this.lastDistance_ = distance; - if (scaleDelta != 1.0) { - this.lastScaleDelta_ = scaleDelta; - } - - var map = mapBrowserEvent.map; - var view = map.getView(); - var resolution = view.getResolution(); - - // scale anchor point. - var viewportPosition = goog.style.getClientPosition(map.getViewport()); - var centroid = - ol.interaction.Pointer.centroid(this.targetPointers); - centroid[0] -= viewportPosition.x; - centroid[1] -= viewportPosition.y; - this.anchor_ = map.getCoordinateFromPixel(centroid); - - // scale, bypass the resolution constraint - map.render(); - ol.interaction.Interaction.zoomWithoutConstraints( - map, view, resolution * scaleDelta, this.anchor_); - -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.PinchZoom} - * @private - */ -ol.interaction.PinchZoom.handleUpEvent_ = function(mapBrowserEvent) { - if (this.targetPointers.length < 2) { - var map = mapBrowserEvent.map; - var view = map.getView(); - view.setHint(ol.ViewHint.INTERACTING, -1); - var resolution = view.getResolution(); - // Zoom to final resolution, with an animation, and provide a - // direction not to zoom out/in if user was pinching in/out. - // Direction is > 0 if pinching out, and < 0 if pinching in. - var direction = this.lastScaleDelta_ - 1; - ol.interaction.Interaction.zoom(map, view, resolution, - this.anchor_, this.duration_, direction); - return false; - } else { - return true; - } -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.PinchZoom} - * @private - */ -ol.interaction.PinchZoom.handleDownEvent_ = function(mapBrowserEvent) { - if (this.targetPointers.length >= 2) { - var map = mapBrowserEvent.map; - this.anchor_ = null; - this.lastDistance_ = undefined; - this.lastScaleDelta_ = 1; - if (!this.handlingDownUpSequence) { - map.getView().setHint(ol.ViewHint.INTERACTING, 1); - } - map.render(); - return true; - } else { - return false; - } -}; - - -/** - * @inheritDoc - */ -ol.interaction.PinchZoom.prototype.shouldStopEvent = goog.functions.FALSE; - -goog.provide('ol.interaction'); - -goog.require('ol'); -goog.require('ol.Collection'); -goog.require('ol.Kinetic'); -goog.require('ol.interaction.DoubleClickZoom'); -goog.require('ol.interaction.DragPan'); -goog.require('ol.interaction.DragRotate'); -goog.require('ol.interaction.DragZoom'); -goog.require('ol.interaction.KeyboardPan'); -goog.require('ol.interaction.KeyboardZoom'); -goog.require('ol.interaction.MouseWheelZoom'); -goog.require('ol.interaction.PinchRotate'); -goog.require('ol.interaction.PinchZoom'); - - -/** - * Set of interactions included in maps by default. Specific interactions can be - * excluded by setting the appropriate option to false in the constructor - * options, but the order of the interactions is fixed. If you want to specify - * a different order for interactions, you will need to create your own - * {@link ol.interaction.Interaction} instances and insert them into a - * {@link ol.Collection} in the order you want before creating your - * {@link ol.Map} instance. The default set of interactions, in sequence, is: - * * {@link ol.interaction.DragRotate} - * * {@link ol.interaction.DoubleClickZoom} - * * {@link ol.interaction.DragPan} - * * {@link ol.interaction.PinchRotate} - * * {@link ol.interaction.PinchZoom} - * * {@link ol.interaction.KeyboardPan} - * * {@link ol.interaction.KeyboardZoom} - * * {@link ol.interaction.MouseWheelZoom} - * * {@link ol.interaction.DragZoom} - * - * Note that DragZoom renders a box as a vector polygon, so this interaction - * should be excluded if you want a build with no vector support. - * - * @param {olx.interaction.DefaultsOptions=} opt_options Defaults options. - * @return {ol.Collection.<ol.interaction.Interaction>} A collection of - * interactions to be used with the ol.Map constructor's interactions option. - * @api stable - */ -ol.interaction.defaults = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - var interactions = new ol.Collection(); - - var kinetic = new ol.Kinetic(-0.005, 0.05, 100); - - var altShiftDragRotate = options.altShiftDragRotate !== undefined ? - options.altShiftDragRotate : true; - if (altShiftDragRotate) { - interactions.push(new ol.interaction.DragRotate()); - } - - var doubleClickZoom = options.doubleClickZoom !== undefined ? - options.doubleClickZoom : true; - if (doubleClickZoom) { - interactions.push(new ol.interaction.DoubleClickZoom({ - delta: options.zoomDelta, - duration: options.zoomDuration - })); - } - - var dragPan = options.dragPan !== undefined ? options.dragPan : true; - if (dragPan) { - interactions.push(new ol.interaction.DragPan({ - kinetic: kinetic - })); - } - - var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate : - true; - if (pinchRotate) { - interactions.push(new ol.interaction.PinchRotate()); - } - - var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true; - if (pinchZoom) { - interactions.push(new ol.interaction.PinchZoom({ - duration: options.zoomDuration - })); - } - - var keyboard = options.keyboard !== undefined ? options.keyboard : true; - if (keyboard) { - interactions.push(new ol.interaction.KeyboardPan()); - interactions.push(new ol.interaction.KeyboardZoom({ - delta: options.zoomDelta, - duration: options.zoomDuration - })); - } - - var mouseWheelZoom = options.mouseWheelZoom !== undefined ? - options.mouseWheelZoom : true; - if (mouseWheelZoom) { - interactions.push(new ol.interaction.MouseWheelZoom({ - duration: options.zoomDuration - })); - } - - var shiftDragZoom = options.shiftDragZoom !== undefined ? - options.shiftDragZoom : true; - if (shiftDragZoom) { - interactions.push(new ol.interaction.DragZoom({ - duration: options.zoomDuration - })); - } - - return interactions; - -}; - -goog.provide('ol.layer.Group'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol.Collection'); -goog.require('ol.CollectionEvent'); -goog.require('ol.CollectionEventType'); -goog.require('ol.Object'); -goog.require('ol.ObjectEventType'); -goog.require('ol.extent'); -goog.require('ol.layer.Base'); -goog.require('ol.source.State'); - - -/** - * @enum {string} - */ -ol.layer.GroupProperty = { - LAYERS: 'layers' -}; - - - -/** - * @classdesc - * A {@link ol.Collection} of layers that are handled together. - * - * A generic `change` event is triggered when the group/Collection changes. - * - * @constructor - * @extends {ol.layer.Base} - * @param {olx.layer.GroupOptions=} opt_options Layer options. - * @api stable - */ -ol.layer.Group = function(opt_options) { - - var options = opt_options || {}; - var baseOptions = /** @type {olx.layer.GroupOptions} */ - (goog.object.clone(options)); - delete baseOptions.layers; - - var layers = options.layers; - - goog.base(this, baseOptions); - - /** - * @private - * @type {Array.<goog.events.Key>} - */ - this.layersListenerKeys_ = []; - - /** - * @private - * @type {Object.<string, Array.<goog.events.Key>>} - */ - this.listenerKeys_ = {}; - - goog.events.listen(this, - ol.Object.getChangeEventType(ol.layer.GroupProperty.LAYERS), - this.handleLayersChanged_, false, this); - - if (layers) { - if (goog.isArray(layers)) { - layers = new ol.Collection(layers.slice()); - } else { - goog.asserts.assertInstanceof(layers, ol.Collection, - 'layers should be an ol.Collection'); - layers = layers; - } - } else { - layers = new ol.Collection(); - } - - this.setLayers(layers); - -}; -goog.inherits(ol.layer.Group, ol.layer.Base); - - -/** - * @private - */ -ol.layer.Group.prototype.handleLayerChange_ = function() { - if (this.getVisible()) { - this.changed(); - } -}; - - -/** - * @param {goog.events.Event} event Event. - * @private - */ -ol.layer.Group.prototype.handleLayersChanged_ = function(event) { - this.layersListenerKeys_.forEach(goog.events.unlistenByKey); - this.layersListenerKeys_.length = 0; - - var layers = this.getLayers(); - this.layersListenerKeys_.push( - goog.events.listen(layers, ol.CollectionEventType.ADD, - this.handleLayersAdd_, false, this), - goog.events.listen(layers, ol.CollectionEventType.REMOVE, - this.handleLayersRemove_, false, this)); - - goog.object.forEach(this.listenerKeys_, function(keys) { - keys.forEach(goog.events.unlistenByKey); - }); - goog.object.clear(this.listenerKeys_); - - var layersArray = layers.getArray(); - var i, ii, layer; - for (i = 0, ii = layersArray.length; i < ii; i++) { - layer = layersArray[i]; - this.listenerKeys_[goog.getUid(layer).toString()] = [ - goog.events.listen(layer, ol.ObjectEventType.PROPERTYCHANGE, - this.handleLayerChange_, false, this), - goog.events.listen(layer, goog.events.EventType.CHANGE, - this.handleLayerChange_, false, this) - ]; - } - - this.changed(); -}; - - -/** - * @param {ol.CollectionEvent} collectionEvent Collection event. - * @private - */ -ol.layer.Group.prototype.handleLayersAdd_ = function(collectionEvent) { - var layer = /** @type {ol.layer.Base} */ (collectionEvent.element); - var key = goog.getUid(layer).toString(); - goog.asserts.assert(!(key in this.listenerKeys_), - 'listeners already registered'); - this.listenerKeys_[key] = [ - goog.events.listen(layer, ol.ObjectEventType.PROPERTYCHANGE, - this.handleLayerChange_, false, this), - goog.events.listen(layer, goog.events.EventType.CHANGE, - this.handleLayerChange_, false, this) - ]; - this.changed(); -}; - - -/** - * @param {ol.CollectionEvent} collectionEvent Collection event. - * @private - */ -ol.layer.Group.prototype.handleLayersRemove_ = function(collectionEvent) { - var layer = /** @type {ol.layer.Base} */ (collectionEvent.element); - var key = goog.getUid(layer).toString(); - goog.asserts.assert(key in this.listenerKeys_, 'no listeners to unregister'); - this.listenerKeys_[key].forEach(goog.events.unlistenByKey); - delete this.listenerKeys_[key]; - this.changed(); -}; - - -/** - * Returns the {@link ol.Collection collection} of {@link ol.layer.Layer layers} - * in this group. - * @return {!ol.Collection.<ol.layer.Base>} Collection of - * {@link ol.layer.Base layers} that are part of this group. - * @observable - * @api stable - */ -ol.layer.Group.prototype.getLayers = function() { - return /** @type {!ol.Collection.<ol.layer.Base>} */ (this.get( - ol.layer.GroupProperty.LAYERS)); -}; - - -/** - * Set the {@link ol.Collection collection} of {@link ol.layer.Layer layers} - * in this group. - * @param {!ol.Collection.<ol.layer.Base>} layers Collection of - * {@link ol.layer.Base layers} that are part of this group. - * @observable - * @api stable - */ -ol.layer.Group.prototype.setLayers = function(layers) { - this.set(ol.layer.GroupProperty.LAYERS, layers); -}; - - -/** - * @inheritDoc - */ -ol.layer.Group.prototype.getLayersArray = function(opt_array) { - var array = opt_array !== undefined ? opt_array : []; - this.getLayers().forEach(function(layer) { - layer.getLayersArray(array); - }); - return array; -}; - - -/** - * @inheritDoc - */ -ol.layer.Group.prototype.getLayerStatesArray = function(opt_states) { - var states = opt_states !== undefined ? opt_states : []; - - var pos = states.length; - - this.getLayers().forEach(function(layer) { - layer.getLayerStatesArray(states); - }); - - var ownLayerState = this.getLayerState(); - var i, ii, layerState; - for (i = pos, ii = states.length; i < ii; i++) { - layerState = states[i]; - layerState.opacity *= ownLayerState.opacity; - layerState.visible = layerState.visible && ownLayerState.visible; - layerState.maxResolution = Math.min( - layerState.maxResolution, ownLayerState.maxResolution); - layerState.minResolution = Math.max( - layerState.minResolution, ownLayerState.minResolution); - if (ownLayerState.extent !== undefined) { - if (layerState.extent !== undefined) { - layerState.extent = ol.extent.getIntersection( - layerState.extent, ownLayerState.extent); - } else { - layerState.extent = ownLayerState.extent; - } - } - } - - return states; -}; - - -/** - * @inheritDoc - */ -ol.layer.Group.prototype.getSourceState = function() { - return ol.source.State.READY; -}; - -goog.provide('ol.proj.EPSG3857'); - -goog.require('goog.asserts'); -goog.require('ol.math'); -goog.require('ol.proj'); -goog.require('ol.proj.Projection'); -goog.require('ol.proj.Units'); - - - -/** - * @classdesc - * Projection object for web/spherical Mercator (EPSG:3857). - * - * @constructor - * @extends {ol.proj.Projection} - * @param {string} code Code. - * @private - */ -ol.proj.EPSG3857_ = function(code) { - goog.base(this, { - code: code, - units: ol.proj.Units.METERS, - extent: ol.proj.EPSG3857.EXTENT, - global: true, - worldExtent: ol.proj.EPSG3857.WORLD_EXTENT - }); -}; -goog.inherits(ol.proj.EPSG3857_, ol.proj.Projection); - - -/** - * @inheritDoc - */ -ol.proj.EPSG3857_.prototype.getPointResolution = function(resolution, point) { - return resolution / ol.math.cosh(point[1] / ol.proj.EPSG3857.RADIUS); -}; - - -/** - * @const - * @type {number} - */ -ol.proj.EPSG3857.RADIUS = 6378137; - - -/** - * @const - * @type {number} - */ -ol.proj.EPSG3857.HALF_SIZE = Math.PI * ol.proj.EPSG3857.RADIUS; - - -/** - * @const - * @type {ol.Extent} - */ -ol.proj.EPSG3857.EXTENT = [ - -ol.proj.EPSG3857.HALF_SIZE, -ol.proj.EPSG3857.HALF_SIZE, - ol.proj.EPSG3857.HALF_SIZE, ol.proj.EPSG3857.HALF_SIZE -]; - - -/** - * @const - * @type {ol.Extent} - */ -ol.proj.EPSG3857.WORLD_EXTENT = [-180, -85, 180, 85]; - - -/** - * Lists several projection codes with the same meaning as EPSG:3857. - * - * @type {Array.<string>} - */ -ol.proj.EPSG3857.CODES = [ - 'EPSG:3857', - 'EPSG:102100', - 'EPSG:102113', - 'EPSG:900913', - 'urn:ogc:def:crs:EPSG:6.18:3:3857', - 'urn:ogc:def:crs:EPSG::3857', - 'http://www.opengis.net/gml/srs/epsg.xml#3857' -]; - - -/** - * Projections equal to EPSG:3857. - * - * @const - * @type {Array.<ol.proj.Projection>} - */ -ol.proj.EPSG3857.PROJECTIONS = ol.proj.EPSG3857.CODES.map(function(code) { - return new ol.proj.EPSG3857_(code); -}); - - -/** - * Transformation from EPSG:4326 to EPSG:3857. - * - * @param {Array.<number>} input Input array of coordinate values. - * @param {Array.<number>=} opt_output Output array of coordinate values. - * @param {number=} opt_dimension Dimension (default is `2`). - * @return {Array.<number>} Output array of coordinate values. - */ -ol.proj.EPSG3857.fromEPSG4326 = function(input, opt_output, opt_dimension) { - var length = input.length, - dimension = opt_dimension > 1 ? opt_dimension : 2, - output = opt_output; - if (output === undefined) { - if (dimension > 2) { - // preserve values beyond second dimension - output = input.slice(); - } else { - output = new Array(length); - } - } - goog.asserts.assert(output.length % dimension === 0, - 'modulus of output.length with dimension should be 0'); - for (var i = 0; i < length; i += dimension) { - output[i] = ol.proj.EPSG3857.RADIUS * Math.PI * input[i] / 180; - output[i + 1] = ol.proj.EPSG3857.RADIUS * - Math.log(Math.tan(Math.PI * (input[i + 1] + 90) / 360)); - } - return output; -}; - - -/** - * Transformation from EPSG:3857 to EPSG:4326. - * - * @param {Array.<number>} input Input array of coordinate values. - * @param {Array.<number>=} opt_output Output array of coordinate values. - * @param {number=} opt_dimension Dimension (default is `2`). - * @return {Array.<number>} Output array of coordinate values. - */ -ol.proj.EPSG3857.toEPSG4326 = function(input, opt_output, opt_dimension) { - var length = input.length, - dimension = opt_dimension > 1 ? opt_dimension : 2, - output = opt_output; - if (output === undefined) { - if (dimension > 2) { - // preserve values beyond second dimension - output = input.slice(); - } else { - output = new Array(length); - } - } - goog.asserts.assert(output.length % dimension === 0, - 'modulus of output.length with dimension should be 0'); - for (var i = 0; i < length; i += dimension) { - output[i] = 180 * input[i] / (ol.proj.EPSG3857.RADIUS * Math.PI); - output[i + 1] = 360 * Math.atan( - Math.exp(input[i + 1] / ol.proj.EPSG3857.RADIUS)) / Math.PI - 90; - } - return output; -}; - -goog.provide('ol.proj.EPSG4326'); - -goog.require('ol.proj'); -goog.require('ol.proj.Projection'); -goog.require('ol.proj.Units'); - - - -/** - * @classdesc - * Projection object for WGS84 geographic coordinates (EPSG:4326). - * - * Note that OpenLayers does not strictly comply with the EPSG definition. - * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x). - * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates. - * - * @constructor - * @extends {ol.proj.Projection} - * @param {string} code Code. - * @param {string=} opt_axisOrientation Axis orientation. - * @private - */ -ol.proj.EPSG4326_ = function(code, opt_axisOrientation) { - goog.base(this, { - code: code, - units: ol.proj.Units.DEGREES, - extent: ol.proj.EPSG4326.EXTENT, - axisOrientation: opt_axisOrientation, - global: true, - worldExtent: ol.proj.EPSG4326.EXTENT - }); -}; -goog.inherits(ol.proj.EPSG4326_, ol.proj.Projection); - - -/** - * @inheritDoc - */ -ol.proj.EPSG4326_.prototype.getPointResolution = function(resolution, point) { - return resolution; -}; - - -/** - * Extent of the EPSG:4326 projection which is the whole world. - * - * @const - * @type {ol.Extent} - */ -ol.proj.EPSG4326.EXTENT = [-180, -90, 180, 90]; - - -/** - * Projections equal to EPSG:4326. - * - * @const - * @type {Array.<ol.proj.Projection>} - */ -ol.proj.EPSG4326.PROJECTIONS = [ - new ol.proj.EPSG4326_('CRS:84'), - new ol.proj.EPSG4326_('EPSG:4326', 'neu'), - new ol.proj.EPSG4326_('urn:ogc:def:crs:EPSG::4326', 'neu'), - new ol.proj.EPSG4326_('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'), - new ol.proj.EPSG4326_('urn:ogc:def:crs:OGC:1.3:CRS84'), - new ol.proj.EPSG4326_('urn:ogc:def:crs:OGC:2:84'), - new ol.proj.EPSG4326_('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'), - new ol.proj.EPSG4326_('urn:x-ogc:def:crs:EPSG:4326', 'neu') -]; - -goog.provide('ol.proj.common'); - -goog.require('ol.proj'); -goog.require('ol.proj.EPSG3857'); -goog.require('ol.proj.EPSG4326'); - - -/** - * FIXME empty description for jsdoc - * @api - */ -ol.proj.common.add = function() { - // Add transformations that don't alter coordinates to convert within set of - // projections with equal meaning. - ol.proj.addEquivalentProjections(ol.proj.EPSG3857.PROJECTIONS); - ol.proj.addEquivalentProjections(ol.proj.EPSG4326.PROJECTIONS); - // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like - // coordinates and back. - ol.proj.addEquivalentTransforms( - ol.proj.EPSG4326.PROJECTIONS, - ol.proj.EPSG3857.PROJECTIONS, - ol.proj.EPSG3857.fromEPSG4326, - ol.proj.EPSG3857.toEPSG4326); -}; - -goog.provide('ol.layer.Image'); - -goog.require('ol.layer.Layer'); - - - -/** - * @classdesc - * Server-rendered images that are available for arbitrary extents and - * resolutions. - * Note that any property set in the options is set as a {@link ol.Object} - * property on the layer object; for example, setting `title: 'My Title'` in the - * options means that `title` is observable, and has get/set accessors. - * - * @constructor - * @extends {ol.layer.Layer} - * @fires ol.render.Event - * @param {olx.layer.ImageOptions=} opt_options Layer options. - * @api stable - */ -ol.layer.Image = function(opt_options) { - var options = opt_options ? opt_options : {}; - goog.base(this, /** @type {olx.layer.LayerOptions} */ (options)); -}; -goog.inherits(ol.layer.Image, ol.layer.Layer); - - -/** - * Return the associated {@link ol.source.Image source} of the image layer. - * @function - * @return {ol.source.Image} Source. - * @api stable - */ -ol.layer.Image.prototype.getSource; - -goog.provide('ol.layer.Tile'); - -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.layer.Layer'); - - -/** - * @enum {string} - */ -ol.layer.TileProperty = { - PRELOAD: 'preload', - USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError' -}; - - - -/** - * @classdesc - * For layer sources that provide pre-rendered, tiled images in grids that are - * organized by zoom levels for specific resolutions. - * Note that any property set in the options is set as a {@link ol.Object} - * property on the layer object; for example, setting `title: 'My Title'` in the - * options means that `title` is observable, and has get/set accessors. - * - * @constructor - * @extends {ol.layer.Layer} - * @fires ol.render.Event - * @param {olx.layer.TileOptions=} opt_options Tile layer options. - * @api stable - */ -ol.layer.Tile = function(opt_options) { - var options = opt_options ? opt_options : {}; - - var baseOptions = goog.object.clone(options); - - delete baseOptions.preload; - delete baseOptions.useInterimTilesOnError; - goog.base(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); - - this.setPreload(options.preload !== undefined ? options.preload : 0); - this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ? - options.useInterimTilesOnError : true); -}; -goog.inherits(ol.layer.Tile, ol.layer.Layer); - - -/** - * Return the level as number to which we will preload tiles up to. - * @return {number} The level to preload tiles up to. - * @observable - * @api - */ -ol.layer.Tile.prototype.getPreload = function() { - return /** @type {number} */ (this.get(ol.layer.TileProperty.PRELOAD)); -}; - - -/** - * Return the associated {@link ol.source.Tile tilesource} of the layer. - * @function - * @return {ol.source.Tile} Source. - * @api stable - */ -ol.layer.Tile.prototype.getSource; - - -/** - * Set the level as number to which we will preload tiles up to. - * @param {number} preload The level to preload tiles up to. - * @observable - * @api - */ -ol.layer.Tile.prototype.setPreload = function(preload) { - this.set(ol.layer.TileProperty.PRELOAD, preload); -}; - - -/** - * Whether we use interim tiles on error. - * @return {boolean} Use interim tiles on error. - * @observable - * @api - */ -ol.layer.Tile.prototype.getUseInterimTilesOnError = function() { - return /** @type {boolean} */ ( - this.get(ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR)); -}; - - -/** - * Set whether we use interim tiles on error. - * @param {boolean} useInterimTilesOnError Use interim tiles on error. - * @observable - * @api - */ -ol.layer.Tile.prototype.setUseInterimTilesOnError = - function(useInterimTilesOnError) { - this.set( - ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError); -}; - -goog.provide('ol.render.canvas'); - - -/** - * @typedef {{fillStyle: string}} - */ -ol.render.canvas.FillState; - - -/** - * @typedef {{lineCap: string, - * lineDash: Array.<number>, - * lineJoin: string, - * lineWidth: number, - * miterLimit: number, - * strokeStyle: string}} - */ -ol.render.canvas.StrokeState; - - -/** - * @typedef {{font: string, - * textAlign: string, - * textBaseline: string}} - */ -ol.render.canvas.TextState; - - -/** - * @const - * @type {string} - */ -ol.render.canvas.defaultFont = '10px sans-serif'; - - -/** - * @const - * @type {ol.Color} - */ -ol.render.canvas.defaultFillStyle = [0, 0, 0, 1]; - - -/** - * @const - * @type {string} - */ -ol.render.canvas.defaultLineCap = 'round'; - - -/** - * @const - * @type {Array.<number>} - */ -ol.render.canvas.defaultLineDash = []; - - -/** - * @const - * @type {string} - */ -ol.render.canvas.defaultLineJoin = 'round'; - - -/** - * @const - * @type {number} - */ -ol.render.canvas.defaultMiterLimit = 10; - - -/** - * @const - * @type {ol.Color} - */ -ol.render.canvas.defaultStrokeStyle = [0, 0, 0, 1]; - - -/** - * @const - * @type {string} - */ -ol.render.canvas.defaultTextAlign = 'center'; - - -/** - * @const - * @type {string} - */ -ol.render.canvas.defaultTextBaseline = 'middle'; - - -/** - * @const - * @type {number} - */ -ol.render.canvas.defaultLineWidth = 1; - -goog.provide('ol.structs.IHasChecksum'); - - - -/** - * @interface - */ -ol.structs.IHasChecksum = function() { -}; - - -/** - * @return {string} The checksum. - */ -ol.structs.IHasChecksum.prototype.getChecksum = function() { -}; - -goog.provide('ol.style.Fill'); - -goog.require('ol.color'); -goog.require('ol.structs.IHasChecksum'); - - - -/** - * @classdesc - * Set fill style for vector features. - * - * @constructor - * @param {olx.style.FillOptions=} opt_options Options. - * @implements {ol.structs.IHasChecksum} - * @api - */ -ol.style.Fill = function(opt_options) { - - var options = opt_options || {}; - - /** - * @private - * @type {ol.Color|string} - */ - this.color_ = options.color !== undefined ? options.color : null; - - /** - * @private - * @type {string|undefined} - */ - this.checksum_ = undefined; -}; - - -/** - * Get the fill color. - * @return {ol.Color|string} Color. - * @api - */ -ol.style.Fill.prototype.getColor = function() { - return this.color_; -}; - - -/** - * Set the color. - * - * @param {ol.Color|string} color Color. - * @api - */ -ol.style.Fill.prototype.setColor = function(color) { - this.color_ = color; - this.checksum_ = undefined; -}; - - -/** - * @inheritDoc - */ -ol.style.Fill.prototype.getChecksum = function() { - if (this.checksum_ === undefined) { - this.checksum_ = 'f' + (this.color_ ? - ol.color.asString(this.color_) : '-'); - } - - return this.checksum_; -}; - -// Copyright 2008 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Namespace with crypto related helper functions. - */ - -goog.provide('goog.crypt'); - -goog.require('goog.array'); -goog.require('goog.asserts'); - - -/** - * Turns a string into an array of bytes; a "byte" being a JS number in the - * range 0-255. - * @param {string} str String value to arrify. - * @return {!Array<number>} Array of numbers corresponding to the - * UCS character codes of each character in str. - */ -goog.crypt.stringToByteArray = function(str) { - var output = [], p = 0; - for (var i = 0; i < str.length; i++) { - var c = str.charCodeAt(i); - while (c > 0xff) { - output[p++] = c & 0xff; - c >>= 8; - } - output[p++] = c; - } - return output; -}; - - -/** - * Turns an array of numbers into the string given by the concatenation of the - * characters to which the numbers correspond. - * @param {Array<number>} bytes Array of numbers representing characters. - * @return {string} Stringification of the array. - */ -goog.crypt.byteArrayToString = function(bytes) { - var CHUNK_SIZE = 8192; - - // Special-case the simple case for speed's sake. - if (bytes.length <= CHUNK_SIZE) { - return String.fromCharCode.apply(null, bytes); - } - - // The remaining logic splits conversion by chunks since - // Function#apply() has a maximum parameter count. - // See discussion: http://goo.gl/LrWmZ9 - - var str = ''; - for (var i = 0; i < bytes.length; i += CHUNK_SIZE) { - var chunk = goog.array.slice(bytes, i, i + CHUNK_SIZE); - str += String.fromCharCode.apply(null, chunk); - } - return str; -}; - - -/** - * Turns an array of numbers into the hex string given by the concatenation of - * the hex values to which the numbers correspond. - * @param {Uint8Array|Array<number>} array Array of numbers representing - * characters. - * @return {string} Hex string. - */ -goog.crypt.byteArrayToHex = function(array) { - return goog.array.map(array, function(numByte) { - var hexByte = numByte.toString(16); - return hexByte.length > 1 ? hexByte : '0' + hexByte; - }).join(''); -}; - - -/** - * Converts a hex string into an integer array. - * @param {string} hexString Hex string of 16-bit integers (two characters - * per integer). - * @return {!Array<number>} Array of {0,255} integers for the given string. - */ -goog.crypt.hexToByteArray = function(hexString) { - goog.asserts.assert(hexString.length % 2 == 0, - 'Key string length must be multiple of 2'); - var arr = []; - for (var i = 0; i < hexString.length; i += 2) { - arr.push(parseInt(hexString.substring(i, i + 2), 16)); - } - return arr; -}; - - -/** - * Converts a JS string to a UTF-8 "byte" array. - * @param {string} str 16-bit unicode string. - * @return {!Array<number>} UTF-8 byte array. - */ -goog.crypt.stringToUtf8ByteArray = function(str) { - // TODO(user): Use native implementations if/when available - var out = [], p = 0; - for (var i = 0; i < str.length; i++) { - var c = str.charCodeAt(i); - if (c < 128) { - out[p++] = c; - } else if (c < 2048) { - out[p++] = (c >> 6) | 192; - out[p++] = (c & 63) | 128; - } else { - out[p++] = (c >> 12) | 224; - out[p++] = ((c >> 6) & 63) | 128; - out[p++] = (c & 63) | 128; - } - } - return out; -}; - - -/** - * Converts a UTF-8 byte array to JavaScript's 16-bit Unicode. - * @param {Uint8Array|Array<number>} bytes UTF-8 byte array. - * @return {string} 16-bit Unicode string. - */ -goog.crypt.utf8ByteArrayToString = function(bytes) { - // TODO(user): Use native implementations if/when available - var out = [], pos = 0, c = 0; - while (pos < bytes.length) { - var c1 = bytes[pos++]; - if (c1 < 128) { - out[c++] = String.fromCharCode(c1); - } else if (c1 > 191 && c1 < 224) { - var c2 = bytes[pos++]; - out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63); - } else { - var c2 = bytes[pos++]; - var c3 = bytes[pos++]; - out[c++] = String.fromCharCode( - (c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63); - } - } - return out.join(''); -}; - - -/** - * XOR two byte arrays. - * @param {!ArrayBufferView|!Array<number>} bytes1 Byte array 1. - * @param {!ArrayBufferView|!Array<number>} bytes2 Byte array 2. - * @return {!Array<number>} Resulting XOR of the two byte arrays. - */ -goog.crypt.xorByteArray = function(bytes1, bytes2) { - goog.asserts.assert( - bytes1.length == bytes2.length, - 'XOR array lengths must match'); - - var result = []; - for (var i = 0; i < bytes1.length; i++) { - result.push(bytes1[i] ^ bytes2[i]); - } - return result; -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Abstract cryptographic hash interface. - * - * See goog.crypt.Sha1 and goog.crypt.Md5 for sample implementations. - * - */ - -goog.provide('goog.crypt.Hash'); - - - -/** - * Create a cryptographic hash instance. - * - * @constructor - * @struct - */ -goog.crypt.Hash = function() { - /** - * The block size for the hasher. - * @type {number} - */ - this.blockSize = -1; -}; - - -/** - * Resets the internal accumulator. - */ -goog.crypt.Hash.prototype.reset = goog.abstractMethod; - - -/** - * Adds a byte array (array with values in [0-255] range) or a string (might - * only contain 8-bit, i.e., Latin1 characters) to the internal accumulator. - * - * Many hash functions operate on blocks of data and implement optimizations - * when a full chunk of data is readily available. Hence it is often preferable - * to provide large chunks of data (a kilobyte or more) than to repeatedly - * call the update method with few tens of bytes. If this is not possible, or - * not feasible, it might be good to provide data in multiplies of hash block - * size (often 64 bytes). Please see the implementation and performance tests - * of your favourite hash. - * - * @param {Array<number>|Uint8Array|string} bytes Data used for the update. - * @param {number=} opt_length Number of bytes to use. - */ -goog.crypt.Hash.prototype.update = goog.abstractMethod; - - -/** - * @return {!Array<number>} The finalized hash computed - * from the internal accumulator. - */ -goog.crypt.Hash.prototype.digest = goog.abstractMethod; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview MD5 cryptographic hash. - * Implementation of http://tools.ietf.org/html/rfc1321 with common - * optimizations and tweaks (see http://en.wikipedia.org/wiki/MD5). - * - * Usage: - * var md5 = new goog.crypt.Md5(); - * md5.update(bytes); - * var hash = md5.digest(); - * - * Performance: - * Chrome 23 ~680 Mbit/s - * Chrome 13 (in a VM) ~250 Mbit/s - * Firefox 6.0 (in a VM) ~100 Mbit/s - * IE9 (in a VM) ~27 Mbit/s - * Firefox 3.6 ~15 Mbit/s - * IE8 (in a VM) ~13 Mbit/s - * - */ - -goog.provide('goog.crypt.Md5'); - -goog.require('goog.crypt.Hash'); - - - -/** - * MD5 cryptographic hash constructor. - * @constructor - * @extends {goog.crypt.Hash} - * @final - * @struct - */ -goog.crypt.Md5 = function() { - goog.crypt.Md5.base(this, 'constructor'); - - this.blockSize = 512 / 8; - - /** - * Holds the current values of accumulated A-D variables (MD buffer). - * @type {!Array<number>} - * @private - */ - this.chain_ = new Array(4); - - /** - * A buffer holding the data until the whole block can be processed. - * @type {!Array<number>} - * @private - */ - this.block_ = new Array(this.blockSize); - - /** - * The length of yet-unprocessed data as collected in the block. - * @type {number} - * @private - */ - this.blockLength_ = 0; - - /** - * The total length of the message so far. - * @type {number} - * @private - */ - this.totalLength_ = 0; - - this.reset(); -}; -goog.inherits(goog.crypt.Md5, goog.crypt.Hash); - - -/** - * Integer rotation constants used by the abbreviated implementation. - * They are hardcoded in the unrolled implementation, so it is left - * here commented out. - * @type {Array<number>} - * @private - * -goog.crypt.Md5.S_ = [ - 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, - 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, - 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, - 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 -]; - */ - -/** - * Sine function constants used by the abbreviated implementation. - * They are hardcoded in the unrolled implementation, so it is left - * here commented out. - * @type {Array<number>} - * @private - * -goog.crypt.Md5.T_ = [ - 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, - 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, - 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, - 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, - 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, - 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, - 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, - 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, - 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, - 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, - 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, - 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, - 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, - 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, - 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, - 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 -]; - */ - - -/** @override */ -goog.crypt.Md5.prototype.reset = function() { - this.chain_[0] = 0x67452301; - this.chain_[1] = 0xefcdab89; - this.chain_[2] = 0x98badcfe; - this.chain_[3] = 0x10325476; - - this.blockLength_ = 0; - this.totalLength_ = 0; -}; - - -/** - * Internal compress helper function. It takes a block of data (64 bytes) - * and updates the accumulator. - * @param {Array<number>|Uint8Array|string} buf The block to compress. - * @param {number=} opt_offset Offset of the block in the buffer. - * @private - */ -goog.crypt.Md5.prototype.compress_ = function(buf, opt_offset) { - if (!opt_offset) { - opt_offset = 0; - } - - // We allocate the array every time, but it's cheap in practice. - var X = new Array(16); - - // Get 16 little endian words. It is not worth unrolling this for Chrome 11. - if (goog.isString(buf)) { - for (var i = 0; i < 16; ++i) { - X[i] = (buf.charCodeAt(opt_offset++)) | - (buf.charCodeAt(opt_offset++) << 8) | - (buf.charCodeAt(opt_offset++) << 16) | - (buf.charCodeAt(opt_offset++) << 24); - } - } else { - for (var i = 0; i < 16; ++i) { - X[i] = (buf[opt_offset++]) | - (buf[opt_offset++] << 8) | - (buf[opt_offset++] << 16) | - (buf[opt_offset++] << 24); - } - } - - var A = this.chain_[0]; - var B = this.chain_[1]; - var C = this.chain_[2]; - var D = this.chain_[3]; - var sum = 0; - - /* - * This is an abbreviated implementation, it is left here commented out for - * reference purposes. See below for an unrolled version in use. - * - var f, n, tmp; - for (var i = 0; i < 64; ++i) { - - if (i < 16) { - f = (D ^ (B & (C ^ D))); - n = i; - } else if (i < 32) { - f = (C ^ (D & (B ^ C))); - n = (5 * i + 1) % 16; - } else if (i < 48) { - f = (B ^ C ^ D); - n = (3 * i + 5) % 16; - } else { - f = (C ^ (B | (~D))); - n = (7 * i) % 16; - } - - tmp = D; - D = C; - C = B; - sum = (A + f + goog.crypt.Md5.T_[i] + X[n]) & 0xffffffff; - B += ((sum << goog.crypt.Md5.S_[i]) & 0xffffffff) | - (sum >>> (32 - goog.crypt.Md5.S_[i])); - A = tmp; - } - */ - - /* - * This is an unrolled MD5 implementation, which gives ~30% speedup compared - * to the abbreviated implementation above, as measured on Chrome 11. It is - * important to keep 32-bit croppings to minimum and inline the integer - * rotation. - */ - sum = (A + (D ^ (B & (C ^ D))) + X[0] + 0xd76aa478) & 0xffffffff; - A = B + (((sum << 7) & 0xffffffff) | (sum >>> 25)); - sum = (D + (C ^ (A & (B ^ C))) + X[1] + 0xe8c7b756) & 0xffffffff; - D = A + (((sum << 12) & 0xffffffff) | (sum >>> 20)); - sum = (C + (B ^ (D & (A ^ B))) + X[2] + 0x242070db) & 0xffffffff; - C = D + (((sum << 17) & 0xffffffff) | (sum >>> 15)); - sum = (B + (A ^ (C & (D ^ A))) + X[3] + 0xc1bdceee) & 0xffffffff; - B = C + (((sum << 22) & 0xffffffff) | (sum >>> 10)); - sum = (A + (D ^ (B & (C ^ D))) + X[4] + 0xf57c0faf) & 0xffffffff; - A = B + (((sum << 7) & 0xffffffff) | (sum >>> 25)); - sum = (D + (C ^ (A & (B ^ C))) + X[5] + 0x4787c62a) & 0xffffffff; - D = A + (((sum << 12) & 0xffffffff) | (sum >>> 20)); - sum = (C + (B ^ (D & (A ^ B))) + X[6] + 0xa8304613) & 0xffffffff; - C = D + (((sum << 17) & 0xffffffff) | (sum >>> 15)); - sum = (B + (A ^ (C & (D ^ A))) + X[7] + 0xfd469501) & 0xffffffff; - B = C + (((sum << 22) & 0xffffffff) | (sum >>> 10)); - sum = (A + (D ^ (B & (C ^ D))) + X[8] + 0x698098d8) & 0xffffffff; - A = B + (((sum << 7) & 0xffffffff) | (sum >>> 25)); - sum = (D + (C ^ (A & (B ^ C))) + X[9] + 0x8b44f7af) & 0xffffffff; - D = A + (((sum << 12) & 0xffffffff) | (sum >>> 20)); - sum = (C + (B ^ (D & (A ^ B))) + X[10] + 0xffff5bb1) & 0xffffffff; - C = D + (((sum << 17) & 0xffffffff) | (sum >>> 15)); - sum = (B + (A ^ (C & (D ^ A))) + X[11] + 0x895cd7be) & 0xffffffff; - B = C + (((sum << 22) & 0xffffffff) | (sum >>> 10)); - sum = (A + (D ^ (B & (C ^ D))) + X[12] + 0x6b901122) & 0xffffffff; - A = B + (((sum << 7) & 0xffffffff) | (sum >>> 25)); - sum = (D + (C ^ (A & (B ^ C))) + X[13] + 0xfd987193) & 0xffffffff; - D = A + (((sum << 12) & 0xffffffff) | (sum >>> 20)); - sum = (C + (B ^ (D & (A ^ B))) + X[14] + 0xa679438e) & 0xffffffff; - C = D + (((sum << 17) & 0xffffffff) | (sum >>> 15)); - sum = (B + (A ^ (C & (D ^ A))) + X[15] + 0x49b40821) & 0xffffffff; - B = C + (((sum << 22) & 0xffffffff) | (sum >>> 10)); - sum = (A + (C ^ (D & (B ^ C))) + X[1] + 0xf61e2562) & 0xffffffff; - A = B + (((sum << 5) & 0xffffffff) | (sum >>> 27)); - sum = (D + (B ^ (C & (A ^ B))) + X[6] + 0xc040b340) & 0xffffffff; - D = A + (((sum << 9) & 0xffffffff) | (sum >>> 23)); - sum = (C + (A ^ (B & (D ^ A))) + X[11] + 0x265e5a51) & 0xffffffff; - C = D + (((sum << 14) & 0xffffffff) | (sum >>> 18)); - sum = (B + (D ^ (A & (C ^ D))) + X[0] + 0xe9b6c7aa) & 0xffffffff; - B = C + (((sum << 20) & 0xffffffff) | (sum >>> 12)); - sum = (A + (C ^ (D & (B ^ C))) + X[5] + 0xd62f105d) & 0xffffffff; - A = B + (((sum << 5) & 0xffffffff) | (sum >>> 27)); - sum = (D + (B ^ (C & (A ^ B))) + X[10] + 0x02441453) & 0xffffffff; - D = A + (((sum << 9) & 0xffffffff) | (sum >>> 23)); - sum = (C + (A ^ (B & (D ^ A))) + X[15] + 0xd8a1e681) & 0xffffffff; - C = D + (((sum << 14) & 0xffffffff) | (sum >>> 18)); - sum = (B + (D ^ (A & (C ^ D))) + X[4] + 0xe7d3fbc8) & 0xffffffff; - B = C + (((sum << 20) & 0xffffffff) | (sum >>> 12)); - sum = (A + (C ^ (D & (B ^ C))) + X[9] + 0x21e1cde6) & 0xffffffff; - A = B + (((sum << 5) & 0xffffffff) | (sum >>> 27)); - sum = (D + (B ^ (C & (A ^ B))) + X[14] + 0xc33707d6) & 0xffffffff; - D = A + (((sum << 9) & 0xffffffff) | (sum >>> 23)); - sum = (C + (A ^ (B & (D ^ A))) + X[3] + 0xf4d50d87) & 0xffffffff; - C = D + (((sum << 14) & 0xffffffff) | (sum >>> 18)); - sum = (B + (D ^ (A & (C ^ D))) + X[8] + 0x455a14ed) & 0xffffffff; - B = C + (((sum << 20) & 0xffffffff) | (sum >>> 12)); - sum = (A + (C ^ (D & (B ^ C))) + X[13] + 0xa9e3e905) & 0xffffffff; - A = B + (((sum << 5) & 0xffffffff) | (sum >>> 27)); - sum = (D + (B ^ (C & (A ^ B))) + X[2] + 0xfcefa3f8) & 0xffffffff; - D = A + (((sum << 9) & 0xffffffff) | (sum >>> 23)); - sum = (C + (A ^ (B & (D ^ A))) + X[7] + 0x676f02d9) & 0xffffffff; - C = D + (((sum << 14) & 0xffffffff) | (sum >>> 18)); - sum = (B + (D ^ (A & (C ^ D))) + X[12] + 0x8d2a4c8a) & 0xffffffff; - B = C + (((sum << 20) & 0xffffffff) | (sum >>> 12)); - sum = (A + (B ^ C ^ D) + X[5] + 0xfffa3942) & 0xffffffff; - A = B + (((sum << 4) & 0xffffffff) | (sum >>> 28)); - sum = (D + (A ^ B ^ C) + X[8] + 0x8771f681) & 0xffffffff; - D = A + (((sum << 11) & 0xffffffff) | (sum >>> 21)); - sum = (C + (D ^ A ^ B) + X[11] + 0x6d9d6122) & 0xffffffff; - C = D + (((sum << 16) & 0xffffffff) | (sum >>> 16)); - sum = (B + (C ^ D ^ A) + X[14] + 0xfde5380c) & 0xffffffff; - B = C + (((sum << 23) & 0xffffffff) | (sum >>> 9)); - sum = (A + (B ^ C ^ D) + X[1] + 0xa4beea44) & 0xffffffff; - A = B + (((sum << 4) & 0xffffffff) | (sum >>> 28)); - sum = (D + (A ^ B ^ C) + X[4] + 0x4bdecfa9) & 0xffffffff; - D = A + (((sum << 11) & 0xffffffff) | (sum >>> 21)); - sum = (C + (D ^ A ^ B) + X[7] + 0xf6bb4b60) & 0xffffffff; - C = D + (((sum << 16) & 0xffffffff) | (sum >>> 16)); - sum = (B + (C ^ D ^ A) + X[10] + 0xbebfbc70) & 0xffffffff; - B = C + (((sum << 23) & 0xffffffff) | (sum >>> 9)); - sum = (A + (B ^ C ^ D) + X[13] + 0x289b7ec6) & 0xffffffff; - A = B + (((sum << 4) & 0xffffffff) | (sum >>> 28)); - sum = (D + (A ^ B ^ C) + X[0] + 0xeaa127fa) & 0xffffffff; - D = A + (((sum << 11) & 0xffffffff) | (sum >>> 21)); - sum = (C + (D ^ A ^ B) + X[3] + 0xd4ef3085) & 0xffffffff; - C = D + (((sum << 16) & 0xffffffff) | (sum >>> 16)); - sum = (B + (C ^ D ^ A) + X[6] + 0x04881d05) & 0xffffffff; - B = C + (((sum << 23) & 0xffffffff) | (sum >>> 9)); - sum = (A + (B ^ C ^ D) + X[9] + 0xd9d4d039) & 0xffffffff; - A = B + (((sum << 4) & 0xffffffff) | (sum >>> 28)); - sum = (D + (A ^ B ^ C) + X[12] + 0xe6db99e5) & 0xffffffff; - D = A + (((sum << 11) & 0xffffffff) | (sum >>> 21)); - sum = (C + (D ^ A ^ B) + X[15] + 0x1fa27cf8) & 0xffffffff; - C = D + (((sum << 16) & 0xffffffff) | (sum >>> 16)); - sum = (B + (C ^ D ^ A) + X[2] + 0xc4ac5665) & 0xffffffff; - B = C + (((sum << 23) & 0xffffffff) | (sum >>> 9)); - sum = (A + (C ^ (B | (~D))) + X[0] + 0xf4292244) & 0xffffffff; - A = B + (((sum << 6) & 0xffffffff) | (sum >>> 26)); - sum = (D + (B ^ (A | (~C))) + X[7] + 0x432aff97) & 0xffffffff; - D = A + (((sum << 10) & 0xffffffff) | (sum >>> 22)); - sum = (C + (A ^ (D | (~B))) + X[14] + 0xab9423a7) & 0xffffffff; - C = D + (((sum << 15) & 0xffffffff) | (sum >>> 17)); - sum = (B + (D ^ (C | (~A))) + X[5] + 0xfc93a039) & 0xffffffff; - B = C + (((sum << 21) & 0xffffffff) | (sum >>> 11)); - sum = (A + (C ^ (B | (~D))) + X[12] + 0x655b59c3) & 0xffffffff; - A = B + (((sum << 6) & 0xffffffff) | (sum >>> 26)); - sum = (D + (B ^ (A | (~C))) + X[3] + 0x8f0ccc92) & 0xffffffff; - D = A + (((sum << 10) & 0xffffffff) | (sum >>> 22)); - sum = (C + (A ^ (D | (~B))) + X[10] + 0xffeff47d) & 0xffffffff; - C = D + (((sum << 15) & 0xffffffff) | (sum >>> 17)); - sum = (B + (D ^ (C | (~A))) + X[1] + 0x85845dd1) & 0xffffffff; - B = C + (((sum << 21) & 0xffffffff) | (sum >>> 11)); - sum = (A + (C ^ (B | (~D))) + X[8] + 0x6fa87e4f) & 0xffffffff; - A = B + (((sum << 6) & 0xffffffff) | (sum >>> 26)); - sum = (D + (B ^ (A | (~C))) + X[15] + 0xfe2ce6e0) & 0xffffffff; - D = A + (((sum << 10) & 0xffffffff) | (sum >>> 22)); - sum = (C + (A ^ (D | (~B))) + X[6] + 0xa3014314) & 0xffffffff; - C = D + (((sum << 15) & 0xffffffff) | (sum >>> 17)); - sum = (B + (D ^ (C | (~A))) + X[13] + 0x4e0811a1) & 0xffffffff; - B = C + (((sum << 21) & 0xffffffff) | (sum >>> 11)); - sum = (A + (C ^ (B | (~D))) + X[4] + 0xf7537e82) & 0xffffffff; - A = B + (((sum << 6) & 0xffffffff) | (sum >>> 26)); - sum = (D + (B ^ (A | (~C))) + X[11] + 0xbd3af235) & 0xffffffff; - D = A + (((sum << 10) & 0xffffffff) | (sum >>> 22)); - sum = (C + (A ^ (D | (~B))) + X[2] + 0x2ad7d2bb) & 0xffffffff; - C = D + (((sum << 15) & 0xffffffff) | (sum >>> 17)); - sum = (B + (D ^ (C | (~A))) + X[9] + 0xeb86d391) & 0xffffffff; - B = C + (((sum << 21) & 0xffffffff) | (sum >>> 11)); - - this.chain_[0] = (this.chain_[0] + A) & 0xffffffff; - this.chain_[1] = (this.chain_[1] + B) & 0xffffffff; - this.chain_[2] = (this.chain_[2] + C) & 0xffffffff; - this.chain_[3] = (this.chain_[3] + D) & 0xffffffff; -}; - - -/** @override */ -goog.crypt.Md5.prototype.update = function(bytes, opt_length) { - if (!goog.isDef(opt_length)) { - opt_length = bytes.length; - } - var lengthMinusBlock = opt_length - this.blockSize; - - // Copy some object properties to local variables in order to save on access - // time from inside the loop (~10% speedup was observed on Chrome 11). - var block = this.block_; - var blockLength = this.blockLength_; - var i = 0; - - // The outer while loop should execute at most twice. - while (i < opt_length) { - // When we have no data in the block to top up, we can directly process the - // input buffer (assuming it contains sufficient data). This gives ~30% - // speedup on Chrome 14 and ~70% speedup on Firefox 6.0, but requires that - // the data is provided in large chunks (or in multiples of 64 bytes). - if (blockLength == 0) { - while (i <= lengthMinusBlock) { - this.compress_(bytes, i); - i += this.blockSize; - } - } - - if (goog.isString(bytes)) { - while (i < opt_length) { - block[blockLength++] = bytes.charCodeAt(i++); - if (blockLength == this.blockSize) { - this.compress_(block); - blockLength = 0; - // Jump to the outer loop so we use the full-block optimization. - break; - } - } - } else { - while (i < opt_length) { - block[blockLength++] = bytes[i++]; - if (blockLength == this.blockSize) { - this.compress_(block); - blockLength = 0; - // Jump to the outer loop so we use the full-block optimization. - break; - } - } - } - } - - this.blockLength_ = blockLength; - this.totalLength_ += opt_length; -}; - - -/** @override */ -goog.crypt.Md5.prototype.digest = function() { - // This must accommodate at least 1 padding byte (0x80), 8 bytes of - // total bitlength, and must end at a 64-byte boundary. - var pad = new Array((this.blockLength_ < 56 ? - this.blockSize : - this.blockSize * 2) - this.blockLength_); - - // Add padding: 0x80 0x00* - pad[0] = 0x80; - for (var i = 1; i < pad.length - 8; ++i) { - pad[i] = 0; - } - // Add the total number of bits, little endian 64-bit integer. - var totalBits = this.totalLength_ * 8; - for (var i = pad.length - 8; i < pad.length; ++i) { - pad[i] = totalBits & 0xff; - totalBits /= 0x100; // Don't use bit-shifting here! - } - this.update(pad); - - var digest = new Array(16); - var n = 0; - for (var i = 0; i < 4; ++i) { - for (var j = 0; j < 32; j += 8) { - digest[n++] = (this.chain_[i] >>> j) & 0xff; - } - } - return digest; -}; - -goog.provide('ol.style.Stroke'); - -goog.require('goog.crypt'); -goog.require('goog.crypt.Md5'); -goog.require('ol.color'); -goog.require('ol.structs.IHasChecksum'); - - - -/** - * @classdesc - * Set stroke style for vector features. - * Note that the defaults given are the Canvas defaults, which will be used if - * option is not defined. The `get` functions return whatever was entered in - * the options; they will not return the default. - * - * @constructor - * @param {olx.style.StrokeOptions=} opt_options Options. - * @implements {ol.structs.IHasChecksum} - * @api - */ -ol.style.Stroke = function(opt_options) { - - var options = opt_options || {}; - - /** - * @private - * @type {ol.Color|string} - */ - this.color_ = options.color !== undefined ? options.color : null; - - /** - * @private - * @type {string|undefined} - */ - this.lineCap_ = options.lineCap; - - /** - * @private - * @type {Array.<number>} - */ - this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null; - - /** - * @private - * @type {string|undefined} - */ - this.lineJoin_ = options.lineJoin; - - /** - * @private - * @type {number|undefined} - */ - this.miterLimit_ = options.miterLimit; - - /** - * @private - * @type {number|undefined} - */ - this.width_ = options.width; - - /** - * @private - * @type {string|undefined} - */ - this.checksum_ = undefined; -}; - - -/** - * Get the stroke color. - * @return {ol.Color|string} Color. - * @api - */ -ol.style.Stroke.prototype.getColor = function() { - return this.color_; -}; - - -/** - * Get the line cap type for the stroke. - * @return {string|undefined} Line cap. - * @api - */ -ol.style.Stroke.prototype.getLineCap = function() { - return this.lineCap_; -}; - - -/** - * Get the line dash style for the stroke. - * @return {Array.<number>} Line dash. - * @api - */ -ol.style.Stroke.prototype.getLineDash = function() { - return this.lineDash_; -}; - - -/** - * Get the line join type for the stroke. - * @return {string|undefined} Line join. - * @api - */ -ol.style.Stroke.prototype.getLineJoin = function() { - return this.lineJoin_; -}; - - -/** - * Get the miter limit for the stroke. - * @return {number|undefined} Miter limit. - * @api - */ -ol.style.Stroke.prototype.getMiterLimit = function() { - return this.miterLimit_; -}; - - -/** - * Get the stroke width. - * @return {number|undefined} Width. - * @api - */ -ol.style.Stroke.prototype.getWidth = function() { - return this.width_; -}; - - -/** - * Set the color. - * - * @param {ol.Color|string} color Color. - * @api - */ -ol.style.Stroke.prototype.setColor = function(color) { - this.color_ = color; - this.checksum_ = undefined; -}; - - -/** - * Set the line cap. - * - * @param {string|undefined} lineCap Line cap. - * @api - */ -ol.style.Stroke.prototype.setLineCap = function(lineCap) { - this.lineCap_ = lineCap; - this.checksum_ = undefined; -}; - - -/** - * Set the line dash. - * - * @param {Array.<number>} lineDash Line dash. - * @api - */ -ol.style.Stroke.prototype.setLineDash = function(lineDash) { - this.lineDash_ = lineDash; - this.checksum_ = undefined; -}; - - -/** - * Set the line join. - * - * @param {string|undefined} lineJoin Line join. - * @api - */ -ol.style.Stroke.prototype.setLineJoin = function(lineJoin) { - this.lineJoin_ = lineJoin; - this.checksum_ = undefined; -}; - - -/** - * Set the miter limit. - * - * @param {number|undefined} miterLimit Miter limit. - * @api - */ -ol.style.Stroke.prototype.setMiterLimit = function(miterLimit) { - this.miterLimit_ = miterLimit; - this.checksum_ = undefined; -}; - - -/** - * Set the width. - * - * @param {number|undefined} width Width. - * @api - */ -ol.style.Stroke.prototype.setWidth = function(width) { - this.width_ = width; - this.checksum_ = undefined; -}; - - -/** - * @inheritDoc - */ -ol.style.Stroke.prototype.getChecksum = function() { - if (this.checksum_ === undefined) { - var raw = 's' + - (this.color_ ? - ol.color.asString(this.color_) : '-') + ',' + - (this.lineCap_ !== undefined ? - this.lineCap_.toString() : '-') + ',' + - (this.lineDash_ ? - this.lineDash_.toString() : '-') + ',' + - (this.lineJoin_ !== undefined ? - this.lineJoin_ : '-') + ',' + - (this.miterLimit_ !== undefined ? - this.miterLimit_.toString() : '-') + ',' + - (this.width_ !== undefined ? - this.width_.toString() : '-'); - - var md5 = new goog.crypt.Md5(); - md5.update(raw); - this.checksum_ = goog.crypt.byteArrayToString(md5.digest()); - } - - return this.checksum_; -}; - -goog.provide('ol.style.Circle'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('ol'); -goog.require('ol.color'); -goog.require('ol.has'); -goog.require('ol.render.canvas'); -goog.require('ol.structs.IHasChecksum'); -goog.require('ol.style.Fill'); -goog.require('ol.style.Image'); -goog.require('ol.style.ImageState'); -goog.require('ol.style.Stroke'); - - - -/** - * @classdesc - * Set circle style for vector features. - * - * @constructor - * @param {olx.style.CircleOptions=} opt_options Options. - * @extends {ol.style.Image} - * @implements {ol.structs.IHasChecksum} - * @api - */ -ol.style.Circle = function(opt_options) { - - var options = opt_options || {}; - - /** - * @private - * @type {Array.<string>} - */ - this.checksums_ = null; - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = null; - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.hitDetectionCanvas_ = null; - - /** - * @private - * @type {ol.style.Fill} - */ - this.fill_ = options.fill !== undefined ? options.fill : null; - - /** - * @private - * @type {ol.style.Stroke} - */ - this.stroke_ = options.stroke !== undefined ? options.stroke : null; - - /** - * @private - * @type {number} - */ - this.radius_ = options.radius; - - /** - * @private - * @type {Array.<number>} - */ - this.origin_ = [0, 0]; - - /** - * @private - * @type {Array.<number>} - */ - this.anchor_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.size_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.imageSize_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.hitDetectionImageSize_ = null; - - this.render_(options.atlasManager); - - /** - * @type {boolean} - */ - var snapToPixel = options.snapToPixel !== undefined ? - options.snapToPixel : true; - - goog.base(this, { - opacity: 1, - rotateWithView: false, - rotation: 0, - scale: 1, - snapToPixel: snapToPixel - }); - -}; -goog.inherits(ol.style.Circle, ol.style.Image); - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.getAnchor = function() { - return this.anchor_; -}; - - -/** - * Get the fill style for the circle. - * @return {ol.style.Fill} Fill style. - * @api - */ -ol.style.Circle.prototype.getFill = function() { - return this.fill_; -}; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.getHitDetectionImage = function(pixelRatio) { - return this.hitDetectionCanvas_; -}; - - -/** - * Get the image used to render the circle. - * @param {number} pixelRatio Pixel ratio. - * @return {HTMLCanvasElement} Canvas element. - * @api - */ -ol.style.Circle.prototype.getImage = function(pixelRatio) { - return this.canvas_; -}; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.getImageState = function() { - return ol.style.ImageState.LOADED; -}; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.getImageSize = function() { - return this.imageSize_; -}; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.getHitDetectionImageSize = function() { - return this.hitDetectionImageSize_; -}; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.getOrigin = function() { - return this.origin_; -}; - - -/** - * Get the circle radius. - * @return {number} Radius. - * @api - */ -ol.style.Circle.prototype.getRadius = function() { - return this.radius_; -}; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.getSize = function() { - return this.size_; -}; - - -/** - * Get the stroke style for the circle. - * @return {ol.style.Stroke} Stroke style. - * @api - */ -ol.style.Circle.prototype.getStroke = function() { - return this.stroke_; -}; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.listenImageChange = ol.nullFunction; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.load = ol.nullFunction; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.unlistenImageChange = ol.nullFunction; - - -/** - * @typedef {{strokeStyle: (string|undefined), strokeWidth: number, - * size: number, lineDash: Array.<number>}} - */ -ol.style.Circle.RenderOptions; - - -/** - * @private - * @param {ol.style.AtlasManager|undefined} atlasManager - */ -ol.style.Circle.prototype.render_ = function(atlasManager) { - var imageSize; - var lineDash = null; - var strokeStyle; - var strokeWidth = 0; - - if (this.stroke_) { - strokeStyle = ol.color.asString(this.stroke_.getColor()); - strokeWidth = this.stroke_.getWidth(); - if (strokeWidth === undefined) { - strokeWidth = ol.render.canvas.defaultLineWidth; - } - lineDash = this.stroke_.getLineDash(); - if (!ol.has.CANVAS_LINE_DASH) { - lineDash = null; - } - } - - - var size = 2 * (this.radius_ + strokeWidth) + 1; - - /** @type {ol.style.Circle.RenderOptions} */ - var renderOptions = { - strokeStyle: strokeStyle, - strokeWidth: strokeWidth, - size: size, - lineDash: lineDash - }; - - if (atlasManager === undefined) { - // no atlas manager is used, create a new canvas - this.canvas_ = /** @type {HTMLCanvasElement} */ - (goog.dom.createElement('CANVAS')); - this.canvas_.height = size; - this.canvas_.width = size; - - // canvas.width and height are rounded to the closest integer - size = this.canvas_.width; - imageSize = size; - - // draw the circle on the canvas - var context = /** @type {CanvasRenderingContext2D} */ - (this.canvas_.getContext('2d')); - this.draw_(renderOptions, context, 0, 0); - - this.createHitDetectionCanvas_(renderOptions); - } else { - // an atlas manager is used, add the symbol to an atlas - size = Math.round(size); - - var hasCustomHitDetectionImage = !this.fill_; - var renderHitDetectionCallback; - if (hasCustomHitDetectionImage) { - // render the hit-detection image into a separate atlas image - renderHitDetectionCallback = - goog.bind(this.drawHitDetectionCanvas_, this, renderOptions); - } - - var id = this.getChecksum(); - var info = atlasManager.add( - id, size, size, goog.bind(this.draw_, this, renderOptions), - renderHitDetectionCallback); - goog.asserts.assert(info, 'circle radius is too large'); - - this.canvas_ = info.image; - this.origin_ = [info.offsetX, info.offsetY]; - imageSize = info.image.width; - - if (hasCustomHitDetectionImage) { - this.hitDetectionCanvas_ = info.hitImage; - this.hitDetectionImageSize_ = - [info.hitImage.width, info.hitImage.height]; - } else { - this.hitDetectionCanvas_ = this.canvas_; - this.hitDetectionImageSize_ = [imageSize, imageSize]; - } - } - - this.anchor_ = [size / 2, size / 2]; - this.size_ = [size, size]; - this.imageSize_ = [imageSize, imageSize]; -}; - - -/** - * @private - * @param {ol.style.Circle.RenderOptions} renderOptions - * @param {CanvasRenderingContext2D} context - * @param {number} x The origin for the symbol (x). - * @param {number} y The origin for the symbol (y). - */ -ol.style.Circle.prototype.draw_ = function(renderOptions, context, x, y) { - // reset transform - context.setTransform(1, 0, 0, 1, 0, 0); - - // then move to (x, y) - context.translate(x, y); - - context.beginPath(); - context.arc( - renderOptions.size / 2, renderOptions.size / 2, - this.radius_, 0, 2 * Math.PI, true); - - if (this.fill_) { - context.fillStyle = ol.color.asString(this.fill_.getColor()); - context.fill(); - } - if (this.stroke_) { - context.strokeStyle = renderOptions.strokeStyle; - context.lineWidth = renderOptions.strokeWidth; - if (renderOptions.lineDash) { - context.setLineDash(renderOptions.lineDash); - } - context.stroke(); - } - context.closePath(); -}; - - -/** - * @private - * @param {ol.style.Circle.RenderOptions} renderOptions - */ -ol.style.Circle.prototype.createHitDetectionCanvas_ = function(renderOptions) { - this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size]; - if (this.fill_) { - this.hitDetectionCanvas_ = this.canvas_; - return; - } - - // if no fill style is set, create an extra hit-detection image with a - // default fill style - this.hitDetectionCanvas_ = /** @type {HTMLCanvasElement} */ - (goog.dom.createElement('CANVAS')); - var canvas = this.hitDetectionCanvas_; - - canvas.height = renderOptions.size; - canvas.width = renderOptions.size; - - var context = /** @type {CanvasRenderingContext2D} */ - (canvas.getContext('2d')); - this.drawHitDetectionCanvas_(renderOptions, context, 0, 0); -}; - - -/** - * @private - * @param {ol.style.Circle.RenderOptions} renderOptions - * @param {CanvasRenderingContext2D} context - * @param {number} x The origin for the symbol (x). - * @param {number} y The origin for the symbol (y). - */ -ol.style.Circle.prototype.drawHitDetectionCanvas_ = - function(renderOptions, context, x, y) { - // reset transform - context.setTransform(1, 0, 0, 1, 0, 0); - - // then move to (x, y) - context.translate(x, y); - - context.beginPath(); - context.arc( - renderOptions.size / 2, renderOptions.size / 2, - this.radius_, 0, 2 * Math.PI, true); - - context.fillStyle = ol.color.asString(ol.render.canvas.defaultFillStyle); - context.fill(); - if (this.stroke_) { - context.strokeStyle = renderOptions.strokeStyle; - context.lineWidth = renderOptions.strokeWidth; - if (renderOptions.lineDash) { - context.setLineDash(renderOptions.lineDash); - } - context.stroke(); - } - context.closePath(); -}; - - -/** - * @inheritDoc - */ -ol.style.Circle.prototype.getChecksum = function() { - var strokeChecksum = this.stroke_ ? - this.stroke_.getChecksum() : '-'; - var fillChecksum = this.fill_ ? - this.fill_.getChecksum() : '-'; - - var recalculate = !this.checksums_ || - (strokeChecksum != this.checksums_[1] || - fillChecksum != this.checksums_[2] || - this.radius_ != this.checksums_[3]); - - if (recalculate) { - var checksum = 'c' + strokeChecksum + fillChecksum + - (this.radius_ !== undefined ? this.radius_.toString() : '-'); - this.checksums_ = [checksum, strokeChecksum, fillChecksum, this.radius_]; - } - - return this.checksums_[0]; -}; - -goog.provide('ol.style.GeometryFunction'); -goog.provide('ol.style.Style'); -goog.provide('ol.style.StyleFunction'); -goog.provide('ol.style.defaultGeometryFunction'); - -goog.require('goog.asserts'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.style.Circle'); -goog.require('ol.style.Fill'); -goog.require('ol.style.Image'); -goog.require('ol.style.Stroke'); - - - -/** - * @classdesc - * Container for vector feature rendering styles. Any changes made to the style - * or its children through `set*()` methods will not take effect until the - * feature or layer that uses the style is re-rendered. - * - * @constructor - * @param {olx.style.StyleOptions=} opt_options Style options. - * @api - */ -ol.style.Style = function(opt_options) { - - var options = opt_options || {}; - - /** - * @private - * @type {string|ol.geom.Geometry|ol.style.GeometryFunction} - */ - this.geometry_ = null; - - /** - * @private - * @type {!ol.style.GeometryFunction} - */ - this.geometryFunction_ = ol.style.defaultGeometryFunction; - - if (options.geometry !== undefined) { - this.setGeometry(options.geometry); - } - - /** - * @private - * @type {ol.style.Fill} - */ - this.fill_ = options.fill !== undefined ? options.fill : null; - - /** - * @private - * @type {ol.style.Image} - */ - this.image_ = options.image !== undefined ? options.image : null; - - /** - * @private - * @type {ol.style.Stroke} - */ - this.stroke_ = options.stroke !== undefined ? options.stroke : null; - - /** - * @private - * @type {ol.style.Text} - */ - this.text_ = options.text !== undefined ? options.text : null; - - /** - * @private - * @type {number|undefined} - */ - this.zIndex_ = options.zIndex; - -}; - - -/** - * Get the geometry to be rendered. - * @return {string|ol.geom.Geometry|ol.style.GeometryFunction} - * Feature property or geometry or function that returns the geometry that will - * be rendered with this style. - * @api - */ -ol.style.Style.prototype.getGeometry = function() { - return this.geometry_; -}; - - -/** - * Get the function used to generate a geometry for rendering. - * @return {!ol.style.GeometryFunction} Function that is called with a feature - * and returns the geometry to render instead of the feature's geometry. - * @api - */ -ol.style.Style.prototype.getGeometryFunction = function() { - return this.geometryFunction_; -}; - - -/** - * Get the fill style. - * @return {ol.style.Fill} Fill style. - * @api - */ -ol.style.Style.prototype.getFill = function() { - return this.fill_; -}; - - -/** - * Get the image style. - * @return {ol.style.Image} Image style. - * @api - */ -ol.style.Style.prototype.getImage = function() { - return this.image_; -}; - - -/** - * Get the stroke style. - * @return {ol.style.Stroke} Stroke style. - * @api - */ -ol.style.Style.prototype.getStroke = function() { - return this.stroke_; -}; - - -/** - * Get the text style. - * @return {ol.style.Text} Text style. - * @api - */ -ol.style.Style.prototype.getText = function() { - return this.text_; -}; - - -/** - * Get the z-index for the style. - * @return {number|undefined} ZIndex. - * @api - */ -ol.style.Style.prototype.getZIndex = function() { - return this.zIndex_; -}; - - -/** - * Set a geometry that is rendered instead of the feature's geometry. - * - * @param {string|ol.geom.Geometry|ol.style.GeometryFunction} geometry - * Feature property or geometry or function returning a geometry to render - * for this style. - * @api - */ -ol.style.Style.prototype.setGeometry = function(geometry) { - if (goog.isFunction(geometry)) { - this.geometryFunction_ = geometry; - } else if (goog.isString(geometry)) { - this.geometryFunction_ = function(feature) { - var result = feature.get(geometry); - if (result) { - goog.asserts.assertInstanceof(result, ol.geom.Geometry, - 'feature geometry must be an ol.geom.Geometry instance'); - } - return result; - }; - } else if (!geometry) { - this.geometryFunction_ = ol.style.defaultGeometryFunction; - } else if (geometry !== undefined) { - goog.asserts.assertInstanceof(geometry, ol.geom.Geometry, - 'geometry must be an ol.geom.Geometry instance'); - this.geometryFunction_ = function() { - return geometry; - }; - } - this.geometry_ = geometry; -}; - - -/** - * Set the z-index. - * - * @param {number|undefined} zIndex ZIndex. - * @api - */ -ol.style.Style.prototype.setZIndex = function(zIndex) { - this.zIndex_ = zIndex; -}; - - -/** - * A function that takes an {@link ol.Feature} and a `{number}` representing - * the view's resolution. The function should return an array of - * {@link ol.style.Style}. This way e.g. a vector layer can be styled. - * - * @typedef {function((ol.Feature|ol.render.Feature), number): - * Array.<ol.style.Style>} - * @api - */ -ol.style.StyleFunction; - - -/** - * Convert the provided object into a style function. Functions passed through - * unchanged. Arrays of ol.style.Style or single style objects wrapped in a - * new style function. - * @param {ol.style.StyleFunction|Array.<ol.style.Style>|ol.style.Style} obj - * A style function, a single style, or an array of styles. - * @return {ol.style.StyleFunction} A style function. - */ -ol.style.createStyleFunction = function(obj) { - var styleFunction; - - if (goog.isFunction(obj)) { - styleFunction = obj; - } else { - /** - * @type {Array.<ol.style.Style>} - */ - var styles; - if (goog.isArray(obj)) { - styles = obj; - } else { - goog.asserts.assertInstanceof(obj, ol.style.Style, - 'obj geometry must be an ol.style.Style instance'); - styles = [obj]; - } - styleFunction = function() { - return styles; - }; - } - return styleFunction; -}; - - -/** - * @type {Array.<ol.style.Style>} - * @private - */ -ol.style.defaultStyle_ = null; - - -/** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @param {number} resolution Resolution. - * @return {Array.<ol.style.Style>} Style. - */ -ol.style.defaultStyleFunction = function(feature, resolution) { - // We don't use an immediately-invoked function - // and a closure so we don't get an error at script evaluation time in - // browsers that do not support Canvas. (ol.style.Circle does - // canvas.getContext('2d') at construction time, which will cause an.error - // in such browsers.) - if (!ol.style.defaultStyle_) { - var fill = new ol.style.Fill({ - color: 'rgba(255,255,255,0.4)' - }); - var stroke = new ol.style.Stroke({ - color: '#3399CC', - width: 1.25 - }); - ol.style.defaultStyle_ = [ - new ol.style.Style({ - image: new ol.style.Circle({ - fill: fill, - stroke: stroke, - radius: 5 - }), - fill: fill, - stroke: stroke - }) - ]; - } - return ol.style.defaultStyle_; -}; - - -/** - * Default styles for editing features. - * @return {Object.<ol.geom.GeometryType, Array.<ol.style.Style>>} Styles - */ -ol.style.createDefaultEditingStyles = function() { - /** @type {Object.<ol.geom.GeometryType, Array.<ol.style.Style>>} */ - var styles = {}; - var white = [255, 255, 255, 1]; - var blue = [0, 153, 255, 1]; - var width = 3; - styles[ol.geom.GeometryType.POLYGON] = [ - new ol.style.Style({ - fill: new ol.style.Fill({ - color: [255, 255, 255, 0.5] - }) - }) - ]; - styles[ol.geom.GeometryType.MULTI_POLYGON] = - styles[ol.geom.GeometryType.POLYGON]; - - styles[ol.geom.GeometryType.LINE_STRING] = [ - new ol.style.Style({ - stroke: new ol.style.Stroke({ - color: white, - width: width + 2 - }) - }), - new ol.style.Style({ - stroke: new ol.style.Stroke({ - color: blue, - width: width - }) - }) - ]; - styles[ol.geom.GeometryType.MULTI_LINE_STRING] = - styles[ol.geom.GeometryType.LINE_STRING]; - - styles[ol.geom.GeometryType.CIRCLE] = - styles[ol.geom.GeometryType.POLYGON].concat( - styles[ol.geom.GeometryType.LINE_STRING] - ); - - - styles[ol.geom.GeometryType.POINT] = [ - new ol.style.Style({ - image: new ol.style.Circle({ - radius: width * 2, - fill: new ol.style.Fill({ - color: blue - }), - stroke: new ol.style.Stroke({ - color: white, - width: width / 2 - }) - }), - zIndex: Infinity - }) - ]; - styles[ol.geom.GeometryType.MULTI_POINT] = - styles[ol.geom.GeometryType.POINT]; - - styles[ol.geom.GeometryType.GEOMETRY_COLLECTION] = - styles[ol.geom.GeometryType.POLYGON].concat( - styles[ol.geom.GeometryType.LINE_STRING], - styles[ol.geom.GeometryType.POINT] - ); - - return styles; -}; - - -/** - * A function that takes an {@link ol.Feature} as argument and returns an - * {@link ol.geom.Geometry} that will be rendered and styled for the feature. - * - * @typedef {function((ol.Feature|ol.render.Feature)): - * (ol.geom.Geometry|ol.render.Feature|undefined)} - * @api - */ -ol.style.GeometryFunction; - - -/** - * Function that is called with a feature and returns its default geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature to get the geometry - * for. - * @return {ol.geom.Geometry|ol.render.Feature|undefined} Geometry to render. - */ -ol.style.defaultGeometryFunction = function(feature) { - goog.asserts.assert(feature, 'feature must not be null'); - return feature.getGeometry(); -}; - -goog.provide('ol.layer.Vector'); - -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.layer.Layer'); -goog.require('ol.style.Style'); - - -/** - * @enum {string} - */ -ol.layer.VectorProperty = { - RENDER_ORDER: 'renderOrder' -}; - - - -/** - * @classdesc - * Vector data that is rendered client-side. - * Note that any property set in the options is set as a {@link ol.Object} - * property on the layer object; for example, setting `title: 'My Title'` in the - * options means that `title` is observable, and has get/set accessors. - * - * @constructor - * @extends {ol.layer.Layer} - * @fires ol.render.Event - * @param {olx.layer.VectorOptions=} opt_options Options. - * @api stable - */ -ol.layer.Vector = function(opt_options) { - - var options = opt_options ? - opt_options : /** @type {olx.layer.VectorOptions} */ ({}); - - goog.asserts.assert( - options.renderOrder === undefined || !options.renderOrder || - goog.isFunction(options.renderOrder), - 'renderOrder must be a comparator function'); - - var baseOptions = goog.object.clone(options); - - delete baseOptions.style; - delete baseOptions.renderBuffer; - delete baseOptions.updateWhileAnimating; - delete baseOptions.updateWhileInteracting; - goog.base(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); - - /** - * @type {number} - * @private - */ - this.renderBuffer_ = options.renderBuffer !== undefined ? - options.renderBuffer : 100; - - /** - * User provided style. - * @type {ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction} - * @private - */ - this.style_ = null; - - /** - * Style function for use within the library. - * @type {ol.style.StyleFunction|undefined} - * @private - */ - this.styleFunction_ = undefined; - - this.setStyle(options.style); - - /** - * @type {boolean} - * @private - */ - this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ? - options.updateWhileAnimating : false; - - /** - * @type {boolean} - * @private - */ - this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ? - options.updateWhileInteracting : false; - -}; -goog.inherits(ol.layer.Vector, ol.layer.Layer); - - -/** - * @return {number|undefined} Render buffer. - */ -ol.layer.Vector.prototype.getRenderBuffer = function() { - return this.renderBuffer_; -}; - - -/** - * @return {function(ol.Feature, ol.Feature): number|null|undefined} Render - * order. - */ -ol.layer.Vector.prototype.getRenderOrder = function() { - return /** @type {function(ol.Feature, ol.Feature):number|null|undefined} */ ( - this.get(ol.layer.VectorProperty.RENDER_ORDER)); -}; - - -/** - * Return the associated {@link ol.source.Vector vectorsource} of the layer. - * @function - * @return {ol.source.Vector} Source. - * @api stable - */ -ol.layer.Vector.prototype.getSource; - - -/** - * Get the style for features. This returns whatever was passed to the `style` - * option at construction or to the `setStyle` method. - * @return {ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction} - * Layer style. - * @api stable - */ -ol.layer.Vector.prototype.getStyle = function() { - return this.style_; -}; - - -/** - * Get the style function. - * @return {ol.style.StyleFunction|undefined} Layer style function. - * @api stable - */ -ol.layer.Vector.prototype.getStyleFunction = function() { - return this.styleFunction_; -}; - - -/** - * @return {boolean} Whether the rendered layer should be updated while - * animating. - */ -ol.layer.Vector.prototype.getUpdateWhileAnimating = function() { - return this.updateWhileAnimating_; -}; - - -/** - * @return {boolean} Whether the rendered layer should be updated while - * interacting. - */ -ol.layer.Vector.prototype.getUpdateWhileInteracting = function() { - return this.updateWhileInteracting_; -}; - - -/** - * @param {function(ol.Feature, ol.Feature):number|null|undefined} renderOrder - * Render order. - */ -ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) { - goog.asserts.assert( - renderOrder === undefined || !renderOrder || - goog.isFunction(renderOrder), - 'renderOrder must be a comparator function'); - this.set(ol.layer.VectorProperty.RENDER_ORDER, renderOrder); -}; - - -/** - * Set the style for features. This can be a single style object, an array - * of styles, or a function that takes a feature and resolution and returns - * an array of styles. If it is `undefined` the default style is used. If - * it is `null` the layer has no style (a `null` style), so only features - * that have their own styles will be rendered in the layer. See - * {@link ol.style} for information on the default style. - * @param {ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|null|undefined} - * style Layer style. - * @api stable - */ -ol.layer.Vector.prototype.setStyle = function(style) { - this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction; - this.styleFunction_ = style === null ? - undefined : ol.style.createStyleFunction(this.style_); - this.changed(); -}; - -goog.provide('ol.layer.VectorTile'); - -goog.require('goog.object'); -goog.require('ol.layer.Vector'); - - -/** - * @enum {string} - */ -ol.layer.VectorTileProperty = { - PRELOAD: 'preload', - USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError' -}; - - - -/** - * @classdesc - * Layer for vector tile data that is rendered client-side. - * Note that any property set in the options is set as a {@link ol.Object} - * property on the layer object; for example, setting `title: 'My Title'` in the - * options means that `title` is observable, and has get/set accessors. - * - * @constructor - * @extends {ol.layer.Vector} - * @param {olx.layer.VectorTileOptions=} opt_options Options. - * @api - */ -ol.layer.VectorTile = function(opt_options) { - var options = opt_options ? opt_options : {}; - - var baseOptions = goog.object.clone(options); - - delete baseOptions.preload; - delete baseOptions.useInterimTilesOnError; - goog.base(this, /** @type {olx.layer.VectorOptions} */ (baseOptions)); - - this.setPreload(options.preload ? options.preload : 0); - this.setUseInterimTilesOnError(options.useInterimTilesOnError ? - options.useInterimTilesOnError : true); - -}; -goog.inherits(ol.layer.VectorTile, ol.layer.Vector); - - -/** - * Return the level as number to which we will preload tiles up to. - * @return {number} The level to preload tiles up to. - * @observable - * @api - */ -ol.layer.VectorTile.prototype.getPreload = function() { - return /** @type {number} */ (this.get(ol.layer.VectorTileProperty.PRELOAD)); -}; - - -/** - * Return the associated {@link ol.source.VectorTile source} of the layer. - * @function - * @return {ol.source.VectorTile} Source. - * @api - */ -ol.layer.VectorTile.prototype.getSource; - - -/** - * Whether we use interim tiles on error. - * @return {boolean} Use interim tiles on error. - * @observable - * @api - */ -ol.layer.VectorTile.prototype.getUseInterimTilesOnError = function() { - return /** @type {boolean} */ ( - this.get(ol.layer.VectorTileProperty.USE_INTERIM_TILES_ON_ERROR)); -}; - - -/** - * Set the level as number to which we will preload tiles up to. - * @param {number} preload The level to preload tiles up to. - * @observable - * @api - */ -ol.layer.VectorTile.prototype.setPreload = function(preload) { - this.set(ol.layer.TileProperty.PRELOAD, preload); -}; - - -/** - * Set whether we use interim tiles on error. - * @param {boolean} useInterimTilesOnError Use interim tiles on error. - * @observable - * @api - */ -ol.layer.VectorTile.prototype.setUseInterimTilesOnError = - function(useInterimTilesOnError) { - this.set( - ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError); -}; - -// FIXME test, especially polygons with holes and multipolygons -// FIXME need to handle large thick features (where pixel size matters) -// FIXME add offset and end to ol.geom.flat.transform.transform2D? - -goog.provide('ol.render.canvas.Immediate'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.vec.Mat4'); -goog.require('ol.color'); -goog.require('ol.extent'); -goog.require('ol.geom.flat.transform'); -goog.require('ol.has'); -goog.require('ol.render.VectorContext'); -goog.require('ol.render.canvas'); -goog.require('ol.vec.Mat4'); - - - -/** - * @classdesc - * A concrete subclass of {@link ol.render.VectorContext} that implements - * direct rendering of features and geometries to an HTML5 Canvas context. - * Instances of this class are created internally by the library and - * provided to application code as vectorContext member of the - * {@link ol.render.Event} object associated with postcompose, precompose and - * render events emitted by layers and maps. - * - * @constructor - * @extends {ol.render.VectorContext} - * @param {CanvasRenderingContext2D} context Context. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.Extent} extent Extent. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {number} viewRotation View rotation. - * @struct - */ -ol.render.canvas.Immediate = - function(context, pixelRatio, extent, transform, viewRotation) { - - /** - * @private - * @type {!Object.<string, - * Array.<function(ol.render.canvas.Immediate)>>} - */ - this.callbacksByZIndex_ = {}; - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.context_ = context; - - /** - * @private - * @type {number} - */ - this.pixelRatio_ = pixelRatio; - - /** - * @private - * @type {ol.Extent} - */ - this.extent_ = extent; - - /** - * @private - * @type {goog.vec.Mat4.Number} - */ - this.transform_ = transform; - - /** - * @private - * @type {number} - */ - this.viewRotation_ = viewRotation; - - /** - * @private - * @type {?ol.render.canvas.FillState} - */ - this.contextFillState_ = null; - - /** - * @private - * @type {?ol.render.canvas.StrokeState} - */ - this.contextStrokeState_ = null; - - /** - * @private - * @type {?ol.render.canvas.TextState} - */ - this.contextTextState_ = null; - - /** - * @private - * @type {?ol.render.canvas.FillState} - */ - this.fillState_ = null; - - /** - * @private - * @type {?ol.render.canvas.StrokeState} - */ - this.strokeState_ = null; - - /** - * @private - * @type {HTMLCanvasElement|HTMLVideoElement|Image} - */ - this.image_ = null; - - /** - * @private - * @type {number} - */ - this.imageAnchorX_ = 0; - - /** - * @private - * @type {number} - */ - this.imageAnchorY_ = 0; - - /** - * @private - * @type {number} - */ - this.imageHeight_ = 0; - - /** - * @private - * @type {number} - */ - this.imageOpacity_ = 0; - - /** - * @private - * @type {number} - */ - this.imageOriginX_ = 0; - - /** - * @private - * @type {number} - */ - this.imageOriginY_ = 0; - - /** - * @private - * @type {boolean} - */ - this.imageRotateWithView_ = false; - - /** - * @private - * @type {number} - */ - this.imageRotation_ = 0; - - /** - * @private - * @type {number} - */ - this.imageScale_ = 0; - - /** - * @private - * @type {boolean} - */ - this.imageSnapToPixel_ = false; - - /** - * @private - * @type {number} - */ - this.imageWidth_ = 0; - - /** - * @private - * @type {string} - */ - this.text_ = ''; - - /** - * @private - * @type {number} - */ - this.textOffsetX_ = 0; - - /** - * @private - * @type {number} - */ - this.textOffsetY_ = 0; - - /** - * @private - * @type {number} - */ - this.textRotation_ = 0; - - /** - * @private - * @type {number} - */ - this.textScale_ = 0; - - /** - * @private - * @type {?ol.render.canvas.FillState} - */ - this.textFillState_ = null; - - /** - * @private - * @type {?ol.render.canvas.StrokeState} - */ - this.textStrokeState_ = null; - - /** - * @private - * @type {?ol.render.canvas.TextState} - */ - this.textState_ = null; - - /** - * @private - * @type {Array.<number>} - */ - this.pixelCoordinates_ = []; - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.tmpLocalTransform_ = goog.vec.Mat4.createNumber(); - -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @private - */ -ol.render.canvas.Immediate.prototype.drawImages_ = - function(flatCoordinates, offset, end, stride) { - if (!this.image_) { - return; - } - goog.asserts.assert(offset === 0, 'offset should be 0'); - goog.asserts.assert(end == flatCoordinates.length, - 'end should be equal to the length of flatCoordinates'); - var pixelCoordinates = ol.geom.flat.transform.transform2D( - flatCoordinates, offset, end, 2, this.transform_, - this.pixelCoordinates_); - var context = this.context_; - var localTransform = this.tmpLocalTransform_; - var alpha = context.globalAlpha; - if (this.imageOpacity_ != 1) { - context.globalAlpha = alpha * this.imageOpacity_; - } - var rotation = this.imageRotation_; - if (this.imageRotateWithView_) { - rotation += this.viewRotation_; - } - var i, ii; - for (i = 0, ii = pixelCoordinates.length; i < ii; i += 2) { - var x = pixelCoordinates[i] - this.imageAnchorX_; - var y = pixelCoordinates[i + 1] - this.imageAnchorY_; - if (this.imageSnapToPixel_) { - x = (x + 0.5) | 0; - y = (y + 0.5) | 0; - } - if (rotation !== 0 || this.imageScale_ != 1) { - var centerX = x + this.imageAnchorX_; - var centerY = y + this.imageAnchorY_; - ol.vec.Mat4.makeTransform2D(localTransform, - centerX, centerY, this.imageScale_, this.imageScale_, - rotation, -centerX, -centerY); - context.setTransform( - goog.vec.Mat4.getElement(localTransform, 0, 0), - goog.vec.Mat4.getElement(localTransform, 1, 0), - goog.vec.Mat4.getElement(localTransform, 0, 1), - goog.vec.Mat4.getElement(localTransform, 1, 1), - goog.vec.Mat4.getElement(localTransform, 0, 3), - goog.vec.Mat4.getElement(localTransform, 1, 3)); - } - context.drawImage(this.image_, this.imageOriginX_, this.imageOriginY_, - this.imageWidth_, this.imageHeight_, x, y, - this.imageWidth_, this.imageHeight_); - } - if (rotation !== 0 || this.imageScale_ != 1) { - context.setTransform(1, 0, 0, 1, 0, 0); - } - if (this.imageOpacity_ != 1) { - context.globalAlpha = alpha; - } -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @private - */ -ol.render.canvas.Immediate.prototype.drawText_ = - function(flatCoordinates, offset, end, stride) { - if (!this.textState_ || this.text_ === '') { - return; - } - if (this.textFillState_) { - this.setContextFillState_(this.textFillState_); - } - if (this.textStrokeState_) { - this.setContextStrokeState_(this.textStrokeState_); - } - this.setContextTextState_(this.textState_); - goog.asserts.assert(offset === 0, 'offset should be 0'); - goog.asserts.assert(end == flatCoordinates.length, - 'end should be equal to the length of flatCoordinates'); - var pixelCoordinates = ol.geom.flat.transform.transform2D( - flatCoordinates, offset, end, stride, this.transform_, - this.pixelCoordinates_); - var context = this.context_; - for (; offset < end; offset += stride) { - var x = pixelCoordinates[offset] + this.textOffsetX_; - var y = pixelCoordinates[offset + 1] + this.textOffsetY_; - if (this.textRotation_ !== 0 || this.textScale_ != 1) { - var localTransform = ol.vec.Mat4.makeTransform2D(this.tmpLocalTransform_, - x, y, this.textScale_, this.textScale_, this.textRotation_, -x, -y); - context.setTransform( - goog.vec.Mat4.getElement(localTransform, 0, 0), - goog.vec.Mat4.getElement(localTransform, 1, 0), - goog.vec.Mat4.getElement(localTransform, 0, 1), - goog.vec.Mat4.getElement(localTransform, 1, 1), - goog.vec.Mat4.getElement(localTransform, 0, 3), - goog.vec.Mat4.getElement(localTransform, 1, 3)); - } - if (this.textStrokeState_) { - context.strokeText(this.text_, x, y); - } - if (this.textFillState_) { - context.fillText(this.text_, x, y); - } - } - if (this.textRotation_ !== 0 || this.textScale_ != 1) { - context.setTransform(1, 0, 0, 1, 0, 0); - } -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {boolean} close Close. - * @private - * @return {number} end End. - */ -ol.render.canvas.Immediate.prototype.moveToLineTo_ = - function(flatCoordinates, offset, end, stride, close) { - var context = this.context_; - var pixelCoordinates = ol.geom.flat.transform.transform2D( - flatCoordinates, offset, end, stride, this.transform_, - this.pixelCoordinates_); - context.moveTo(pixelCoordinates[0], pixelCoordinates[1]); - var i; - for (i = 2; i < pixelCoordinates.length; i += 2) { - context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]); - } - if (close) { - context.lineTo(pixelCoordinates[0], pixelCoordinates[1]); - } - return end; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @private - * @return {number} End. - */ -ol.render.canvas.Immediate.prototype.drawRings_ = - function(flatCoordinates, offset, ends, stride) { - var context = this.context_; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - offset = this.moveToLineTo_( - flatCoordinates, offset, ends[i], stride, true); - context.closePath(); // FIXME is this needed here? - } - return offset; -}; - - -/** - * Register a function to be called for rendering at a given zIndex. The - * function will be called asynchronously. The callback will receive a - * reference to {@link ol.render.canvas.Immediate} context for drawing. - * - * @param {number} zIndex Z index. - * @param {function(ol.render.canvas.Immediate)} callback Callback. - * @api - */ -ol.render.canvas.Immediate.prototype.drawAsync = function(zIndex, callback) { - var zIndexKey = zIndex.toString(); - var callbacks = this.callbacksByZIndex_[zIndexKey]; - if (callbacks !== undefined) { - callbacks.push(callback); - } else { - this.callbacksByZIndex_[zIndexKey] = [callback]; - } -}; - - -/** - * Render a circle geometry into the canvas. Rendering is immediate and uses - * the current fill and stroke styles. - * - * @param {ol.geom.Circle} circleGeometry Circle geometry. - * @param {ol.Feature} feature Feature, - * @api - */ -ol.render.canvas.Immediate.prototype.drawCircleGeometry = - function(circleGeometry, feature) { - if (!ol.extent.intersects(this.extent_, circleGeometry.getExtent())) { - return; - } - if (this.fillState_ || this.strokeState_) { - if (this.fillState_) { - this.setContextFillState_(this.fillState_); - } - if (this.strokeState_) { - this.setContextStrokeState_(this.strokeState_); - } - var pixelCoordinates = ol.geom.transformSimpleGeometry2D( - circleGeometry, this.transform_, this.pixelCoordinates_); - var dx = pixelCoordinates[2] - pixelCoordinates[0]; - var dy = pixelCoordinates[3] - pixelCoordinates[1]; - var radius = Math.sqrt(dx * dx + dy * dy); - var context = this.context_; - context.beginPath(); - context.arc( - pixelCoordinates[0], pixelCoordinates[1], radius, 0, 2 * Math.PI); - if (this.fillState_) { - context.fill(); - } - if (this.strokeState_) { - context.stroke(); - } - } - if (this.text_ !== '') { - this.drawText_(circleGeometry.getCenter(), 0, 2, 2); - } -}; - - -/** - * Render a feature into the canvas. In order to respect the zIndex of the - * style this method draws asynchronously and thus *after* calls to - * drawXxxxGeometry have been finished, effectively drawing the feature - * *on top* of everything else. You probably should be using an - * {@link ol.layer.Vector} instead of calling this method directly. - * - * @param {ol.Feature} feature Feature. - * @param {ol.style.Style} style Style. - * @api - */ -ol.render.canvas.Immediate.prototype.drawFeature = function(feature, style) { - var geometry = style.getGeometryFunction()(feature); - if (!geometry || - !ol.extent.intersects(this.extent_, geometry.getExtent())) { - return; - } - var zIndex = style.getZIndex(); - if (zIndex === undefined) { - zIndex = 0; - } - this.drawAsync(zIndex, function(render) { - render.setFillStrokeStyle(style.getFill(), style.getStroke()); - render.setImageStyle(style.getImage()); - render.setTextStyle(style.getText()); - var renderGeometry = - ol.render.canvas.Immediate.GEOMETRY_RENDERERS_[geometry.getType()]; - goog.asserts.assert(renderGeometry !== undefined, - 'renderGeometry should be defined'); - renderGeometry.call(render, geometry, null); - }); -}; - - -/** - * Render a GeometryCollection to the canvas. Rendering is immediate and - * uses the current styles appropriate for each geometry in the collection. - * - * @param {ol.geom.GeometryCollection} geometryCollectionGeometry Geometry - * collection. - * @param {ol.Feature} feature Feature. - */ -ol.render.canvas.Immediate.prototype.drawGeometryCollectionGeometry = - function(geometryCollectionGeometry, feature) { - var geometries = geometryCollectionGeometry.getGeometriesArray(); - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - var geometry = geometries[i]; - var geometryRenderer = - ol.render.canvas.Immediate.GEOMETRY_RENDERERS_[geometry.getType()]; - goog.asserts.assert(geometryRenderer !== undefined, - 'geometryRenderer should be defined'); - geometryRenderer.call(this, geometry, feature); - } -}; - - -/** - * Render a Point geometry into the canvas. Rendering is immediate and uses - * the current style. - * - * @param {ol.geom.Point|ol.render.Feature} pointGeometry Point geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @api - */ -ol.render.canvas.Immediate.prototype.drawPointGeometry = - function(pointGeometry, feature) { - var flatCoordinates = pointGeometry.getFlatCoordinates(); - var stride = pointGeometry.getStride(); - if (this.image_) { - this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride); - } - if (this.text_ !== '') { - this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride); - } -}; - - -/** - * Render a MultiPoint geometry into the canvas. Rendering is immediate and - * uses the current style. - * - * @param {ol.geom.MultiPoint|ol.render.Feature} multiPointGeometry MultiPoint - * geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @api - */ -ol.render.canvas.Immediate.prototype.drawMultiPointGeometry = - function(multiPointGeometry, feature) { - var flatCoordinates = multiPointGeometry.getFlatCoordinates(); - var stride = multiPointGeometry.getStride(); - if (this.image_) { - this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride); - } - if (this.text_ !== '') { - this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride); - } -}; - - -/** - * Render a LineString into the canvas. Rendering is immediate and uses - * the current style. - * - * @param {ol.geom.LineString|ol.render.Feature} lineStringGeometry Line - * string geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @api - */ -ol.render.canvas.Immediate.prototype.drawLineStringGeometry = - function(lineStringGeometry, feature) { - if (!ol.extent.intersects(this.extent_, lineStringGeometry.getExtent())) { - return; - } - if (this.strokeState_) { - this.setContextStrokeState_(this.strokeState_); - var context = this.context_; - var flatCoordinates = lineStringGeometry.getFlatCoordinates(); - context.beginPath(); - this.moveToLineTo_(flatCoordinates, 0, flatCoordinates.length, - lineStringGeometry.getStride(), false); - context.stroke(); - } - if (this.text_ !== '') { - var flatMidpoint = lineStringGeometry.getFlatMidpoint(); - this.drawText_(flatMidpoint, 0, 2, 2); - } -}; - - -/** - * Render a MultiLineString geometry into the canvas. Rendering is immediate - * and uses the current style. - * - * @param {ol.geom.MultiLineString|ol.render.Feature} multiLineStringGeometry - * MultiLineString geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @api - */ -ol.render.canvas.Immediate.prototype.drawMultiLineStringGeometry = - function(multiLineStringGeometry, feature) { - var geometryExtent = multiLineStringGeometry.getExtent(); - if (!ol.extent.intersects(this.extent_, geometryExtent)) { - return; - } - if (this.strokeState_) { - this.setContextStrokeState_(this.strokeState_); - var context = this.context_; - var flatCoordinates = multiLineStringGeometry.getFlatCoordinates(); - var offset = 0; - var ends = multiLineStringGeometry.getEnds(); - var stride = multiLineStringGeometry.getStride(); - context.beginPath(); - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - offset = this.moveToLineTo_( - flatCoordinates, offset, ends[i], stride, false); - } - context.stroke(); - } - if (this.text_ !== '') { - var flatMidpoints = multiLineStringGeometry.getFlatMidpoints(); - this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2); - } -}; - - -/** - * Render a Polygon geometry into the canvas. Rendering is immediate and uses - * the current style. - * - * @param {ol.geom.Polygon|ol.render.Feature} polygonGeometry Polygon - * geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @api - */ -ol.render.canvas.Immediate.prototype.drawPolygonGeometry = - function(polygonGeometry, feature) { - if (!ol.extent.intersects(this.extent_, polygonGeometry.getExtent())) { - return; - } - if (this.strokeState_ || this.fillState_) { - if (this.fillState_) { - this.setContextFillState_(this.fillState_); - } - if (this.strokeState_) { - this.setContextStrokeState_(this.strokeState_); - } - var context = this.context_; - context.beginPath(); - this.drawRings_(polygonGeometry.getOrientedFlatCoordinates(), - 0, polygonGeometry.getEnds(), polygonGeometry.getStride()); - if (this.fillState_) { - context.fill(); - } - if (this.strokeState_) { - context.stroke(); - } - } - if (this.text_ !== '') { - var flatInteriorPoint = polygonGeometry.getFlatInteriorPoint(); - this.drawText_(flatInteriorPoint, 0, 2, 2); - } -}; - - -/** - * Render MultiPolygon geometry into the canvas. Rendering is immediate and - * uses the current style. - * @param {ol.geom.MultiPolygon} multiPolygonGeometry MultiPolygon geometry. - * @param {ol.Feature} feature Feature. - * @api - */ -ol.render.canvas.Immediate.prototype.drawMultiPolygonGeometry = - function(multiPolygonGeometry, feature) { - if (!ol.extent.intersects(this.extent_, multiPolygonGeometry.getExtent())) { - return; - } - if (this.strokeState_ || this.fillState_) { - if (this.fillState_) { - this.setContextFillState_(this.fillState_); - } - if (this.strokeState_) { - this.setContextStrokeState_(this.strokeState_); - } - var context = this.context_; - var flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates(); - var offset = 0; - var endss = multiPolygonGeometry.getEndss(); - var stride = multiPolygonGeometry.getStride(); - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - context.beginPath(); - offset = this.drawRings_(flatCoordinates, offset, ends, stride); - if (this.fillState_) { - context.fill(); - } - if (this.strokeState_) { - context.stroke(); - } - } - } - if (this.text_ !== '') { - var flatInteriorPoints = multiPolygonGeometry.getFlatInteriorPoints(); - this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2); - } -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.Immediate.prototype.drawText = goog.abstractMethod; - - -/** - * FIXME: empty description for jsdoc - */ -ol.render.canvas.Immediate.prototype.flush = function() { - /** @type {Array.<number>} */ - var zs = Object.keys(this.callbacksByZIndex_).map(Number); - goog.array.sort(zs); - var i, ii, callbacks, j, jj; - for (i = 0, ii = zs.length; i < ii; ++i) { - callbacks = this.callbacksByZIndex_[zs[i].toString()]; - for (j = 0, jj = callbacks.length; j < jj; ++j) { - callbacks[j](this); - } - } -}; - - -/** - * @param {ol.render.canvas.FillState} fillState Fill state. - * @private - */ -ol.render.canvas.Immediate.prototype.setContextFillState_ = - function(fillState) { - var context = this.context_; - var contextFillState = this.contextFillState_; - if (!contextFillState) { - context.fillStyle = fillState.fillStyle; - this.contextFillState_ = { - fillStyle: fillState.fillStyle - }; - } else { - if (contextFillState.fillStyle != fillState.fillStyle) { - contextFillState.fillStyle = context.fillStyle = fillState.fillStyle; - } - } -}; - - -/** - * @param {ol.render.canvas.StrokeState} strokeState Stroke state. - * @private - */ -ol.render.canvas.Immediate.prototype.setContextStrokeState_ = - function(strokeState) { - var context = this.context_; - var contextStrokeState = this.contextStrokeState_; - if (!contextStrokeState) { - context.lineCap = strokeState.lineCap; - if (ol.has.CANVAS_LINE_DASH) { - context.setLineDash(strokeState.lineDash); - } - context.lineJoin = strokeState.lineJoin; - context.lineWidth = strokeState.lineWidth; - context.miterLimit = strokeState.miterLimit; - context.strokeStyle = strokeState.strokeStyle; - this.contextStrokeState_ = { - lineCap: strokeState.lineCap, - lineDash: strokeState.lineDash, - lineJoin: strokeState.lineJoin, - lineWidth: strokeState.lineWidth, - miterLimit: strokeState.miterLimit, - strokeStyle: strokeState.strokeStyle - }; - } else { - if (contextStrokeState.lineCap != strokeState.lineCap) { - contextStrokeState.lineCap = context.lineCap = strokeState.lineCap; - } - if (ol.has.CANVAS_LINE_DASH) { - if (!goog.array.equals( - contextStrokeState.lineDash, strokeState.lineDash)) { - context.setLineDash(contextStrokeState.lineDash = strokeState.lineDash); - } - } - if (contextStrokeState.lineJoin != strokeState.lineJoin) { - contextStrokeState.lineJoin = context.lineJoin = strokeState.lineJoin; - } - if (contextStrokeState.lineWidth != strokeState.lineWidth) { - contextStrokeState.lineWidth = context.lineWidth = strokeState.lineWidth; - } - if (contextStrokeState.miterLimit != strokeState.miterLimit) { - contextStrokeState.miterLimit = context.miterLimit = - strokeState.miterLimit; - } - if (contextStrokeState.strokeStyle != strokeState.strokeStyle) { - contextStrokeState.strokeStyle = context.strokeStyle = - strokeState.strokeStyle; - } - } -}; - - -/** - * @param {ol.render.canvas.TextState} textState Text state. - * @private - */ -ol.render.canvas.Immediate.prototype.setContextTextState_ = - function(textState) { - var context = this.context_; - var contextTextState = this.contextTextState_; - if (!contextTextState) { - context.font = textState.font; - context.textAlign = textState.textAlign; - context.textBaseline = textState.textBaseline; - this.contextTextState_ = { - font: textState.font, - textAlign: textState.textAlign, - textBaseline: textState.textBaseline - }; - } else { - if (contextTextState.font != textState.font) { - contextTextState.font = context.font = textState.font; - } - if (contextTextState.textAlign != textState.textAlign) { - contextTextState.textAlign = context.textAlign = textState.textAlign; - } - if (contextTextState.textBaseline != textState.textBaseline) { - contextTextState.textBaseline = context.textBaseline = - textState.textBaseline; - } - } -}; - - -/** - * Set the fill and stroke style for subsequent draw operations. To clear - * either fill or stroke styles, pass null for the appropriate parameter. - * - * @param {ol.style.Fill} fillStyle Fill style. - * @param {ol.style.Stroke} strokeStyle Stroke style. - * @api - */ -ol.render.canvas.Immediate.prototype.setFillStrokeStyle = - function(fillStyle, strokeStyle) { - if (!fillStyle) { - this.fillState_ = null; - } else { - var fillStyleColor = fillStyle.getColor(); - this.fillState_ = { - fillStyle: ol.color.asString(fillStyleColor ? - fillStyleColor : ol.render.canvas.defaultFillStyle) - }; - } - if (!strokeStyle) { - this.strokeState_ = null; - } else { - var strokeStyleColor = strokeStyle.getColor(); - var strokeStyleLineCap = strokeStyle.getLineCap(); - var strokeStyleLineDash = strokeStyle.getLineDash(); - var strokeStyleLineJoin = strokeStyle.getLineJoin(); - var strokeStyleWidth = strokeStyle.getWidth(); - var strokeStyleMiterLimit = strokeStyle.getMiterLimit(); - this.strokeState_ = { - lineCap: strokeStyleLineCap !== undefined ? - strokeStyleLineCap : ol.render.canvas.defaultLineCap, - lineDash: strokeStyleLineDash ? - strokeStyleLineDash : ol.render.canvas.defaultLineDash, - lineJoin: strokeStyleLineJoin !== undefined ? - strokeStyleLineJoin : ol.render.canvas.defaultLineJoin, - lineWidth: this.pixelRatio_ * (strokeStyleWidth !== undefined ? - strokeStyleWidth : ol.render.canvas.defaultLineWidth), - miterLimit: strokeStyleMiterLimit !== undefined ? - strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit, - strokeStyle: ol.color.asString(strokeStyleColor ? - strokeStyleColor : ol.render.canvas.defaultStrokeStyle) - }; - } -}; - - -/** - * Set the image style for subsequent draw operations. Pass null to remove - * the image style. - * - * @param {ol.style.Image} imageStyle Image style. - * @api - */ -ol.render.canvas.Immediate.prototype.setImageStyle = function(imageStyle) { - if (!imageStyle) { - this.image_ = null; - } else { - var imageAnchor = imageStyle.getAnchor(); - // FIXME pixel ratio - var imageImage = imageStyle.getImage(1); - var imageOrigin = imageStyle.getOrigin(); - var imageSize = imageStyle.getSize(); - goog.asserts.assert(imageAnchor, 'imageAnchor must be truthy'); - goog.asserts.assert(imageImage, 'imageImage must be truthy'); - goog.asserts.assert(imageOrigin, 'imageOrigin must be truthy'); - goog.asserts.assert(imageSize, 'imageSize must be truthy'); - this.imageAnchorX_ = imageAnchor[0]; - this.imageAnchorY_ = imageAnchor[1]; - this.imageHeight_ = imageSize[1]; - this.image_ = imageImage; - this.imageOpacity_ = imageStyle.getOpacity(); - this.imageOriginX_ = imageOrigin[0]; - this.imageOriginY_ = imageOrigin[1]; - this.imageRotateWithView_ = imageStyle.getRotateWithView(); - this.imageRotation_ = imageStyle.getRotation(); - this.imageScale_ = imageStyle.getScale(); - this.imageSnapToPixel_ = imageStyle.getSnapToPixel(); - this.imageWidth_ = imageSize[0]; - } -}; - - -/** - * Set the text style for subsequent draw operations. Pass null to - * remove the text style. - * - * @param {ol.style.Text} textStyle Text style. - * @api - */ -ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) { - if (!textStyle) { - this.text_ = ''; - } else { - var textFillStyle = textStyle.getFill(); - if (!textFillStyle) { - this.textFillState_ = null; - } else { - var textFillStyleColor = textFillStyle.getColor(); - this.textFillState_ = { - fillStyle: ol.color.asString(textFillStyleColor ? - textFillStyleColor : ol.render.canvas.defaultFillStyle) - }; - } - var textStrokeStyle = textStyle.getStroke(); - if (!textStrokeStyle) { - this.textStrokeState_ = null; - } else { - var textStrokeStyleColor = textStrokeStyle.getColor(); - var textStrokeStyleLineCap = textStrokeStyle.getLineCap(); - var textStrokeStyleLineDash = textStrokeStyle.getLineDash(); - var textStrokeStyleLineJoin = textStrokeStyle.getLineJoin(); - var textStrokeStyleWidth = textStrokeStyle.getWidth(); - var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit(); - this.textStrokeState_ = { - lineCap: textStrokeStyleLineCap !== undefined ? - textStrokeStyleLineCap : ol.render.canvas.defaultLineCap, - lineDash: textStrokeStyleLineDash ? - textStrokeStyleLineDash : ol.render.canvas.defaultLineDash, - lineJoin: textStrokeStyleLineJoin !== undefined ? - textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin, - lineWidth: textStrokeStyleWidth !== undefined ? - textStrokeStyleWidth : ol.render.canvas.defaultLineWidth, - miterLimit: textStrokeStyleMiterLimit !== undefined ? - textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit, - strokeStyle: ol.color.asString(textStrokeStyleColor ? - textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle) - }; - } - var textFont = textStyle.getFont(); - var textOffsetX = textStyle.getOffsetX(); - var textOffsetY = textStyle.getOffsetY(); - var textRotation = textStyle.getRotation(); - var textScale = textStyle.getScale(); - var textText = textStyle.getText(); - var textTextAlign = textStyle.getTextAlign(); - var textTextBaseline = textStyle.getTextBaseline(); - this.textState_ = { - font: textFont !== undefined ? - textFont : ol.render.canvas.defaultFont, - textAlign: textTextAlign !== undefined ? - textTextAlign : ol.render.canvas.defaultTextAlign, - textBaseline: textTextBaseline !== undefined ? - textTextBaseline : ol.render.canvas.defaultTextBaseline - }; - this.text_ = textText !== undefined ? textText : ''; - this.textOffsetX_ = - textOffsetX !== undefined ? (this.pixelRatio_ * textOffsetX) : 0; - this.textOffsetY_ = - textOffsetY !== undefined ? (this.pixelRatio_ * textOffsetY) : 0; - this.textRotation_ = textRotation !== undefined ? textRotation : 0; - this.textScale_ = this.pixelRatio_ * (textScale !== undefined ? - textScale : 1); - } -}; - - -/** - * @const - * @private - * @type {Object.<ol.geom.GeometryType, - * function(this: ol.render.canvas.Immediate, - * (ol.geom.Geometry|ol.render.Feature), Object)>} - */ -ol.render.canvas.Immediate.GEOMETRY_RENDERERS_ = { - 'Point': ol.render.canvas.Immediate.prototype.drawPointGeometry, - 'LineString': ol.render.canvas.Immediate.prototype.drawLineStringGeometry, - 'Polygon': ol.render.canvas.Immediate.prototype.drawPolygonGeometry, - 'MultiPoint': ol.render.canvas.Immediate.prototype.drawMultiPointGeometry, - 'MultiLineString': - ol.render.canvas.Immediate.prototype.drawMultiLineStringGeometry, - 'MultiPolygon': ol.render.canvas.Immediate.prototype.drawMultiPolygonGeometry, - 'GeometryCollection': - ol.render.canvas.Immediate.prototype.drawGeometryCollectionGeometry, - 'Circle': ol.render.canvas.Immediate.prototype.drawCircleGeometry -}; - -goog.provide('ol.renderer.canvas.Layer'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.vec.Mat4'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.Layer'); -goog.require('ol.render.Event'); -goog.require('ol.render.EventType'); -goog.require('ol.render.canvas.Immediate'); -goog.require('ol.renderer.Layer'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.Layer} - * @param {ol.layer.Layer} layer Layer. - */ -ol.renderer.canvas.Layer = function(layer) { - - goog.base(this, layer); - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.transform_ = goog.vec.Mat4.createNumber(); - -}; -goog.inherits(ol.renderer.canvas.Layer, ol.renderer.Layer); - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {ol.layer.LayerState} layerState Layer state. - * @param {CanvasRenderingContext2D} context Context. - */ -ol.renderer.canvas.Layer.prototype.composeFrame = - function(frameState, layerState, context) { - - this.dispatchPreComposeEvent(context, frameState); - - var image = this.getImage(); - if (image) { - - // clipped rendering if layer extent is set - var extent = layerState.extent; - var clipped = extent !== undefined; - if (clipped) { - goog.asserts.assert(extent !== undefined, - 'layerState extent is defined'); - var pixelRatio = frameState.pixelRatio; - var topLeft = ol.extent.getTopLeft(extent); - var topRight = ol.extent.getTopRight(extent); - var bottomRight = ol.extent.getBottomRight(extent); - var bottomLeft = ol.extent.getBottomLeft(extent); - - ol.vec.Mat4.multVec2(frameState.coordinateToPixelMatrix, - topLeft, topLeft); - ol.vec.Mat4.multVec2(frameState.coordinateToPixelMatrix, - topRight, topRight); - ol.vec.Mat4.multVec2(frameState.coordinateToPixelMatrix, - bottomRight, bottomRight); - ol.vec.Mat4.multVec2(frameState.coordinateToPixelMatrix, - bottomLeft, bottomLeft); - - context.save(); - context.beginPath(); - context.moveTo(topLeft[0] * pixelRatio, topLeft[1] * pixelRatio); - context.lineTo(topRight[0] * pixelRatio, topRight[1] * pixelRatio); - context.lineTo(bottomRight[0] * pixelRatio, bottomRight[1] * pixelRatio); - context.lineTo(bottomLeft[0] * pixelRatio, bottomLeft[1] * pixelRatio); - context.clip(); - } - - var imageTransform = this.getImageTransform(); - // for performance reasons, context.save / context.restore is not used - // to save and restore the transformation matrix and the opacity. - // see http://jsperf.com/context-save-restore-versus-variable - var alpha = context.globalAlpha; - context.globalAlpha = layerState.opacity; - - // for performance reasons, context.setTransform is only used - // when the view is rotated. see http://jsperf.com/canvas-transform - if (frameState.viewState.rotation === 0) { - var dx = goog.vec.Mat4.getElement(imageTransform, 0, 3); - var dy = goog.vec.Mat4.getElement(imageTransform, 1, 3); - var dw = image.width * goog.vec.Mat4.getElement(imageTransform, 0, 0); - var dh = image.height * goog.vec.Mat4.getElement(imageTransform, 1, 1); - context.drawImage(image, 0, 0, +image.width, +image.height, - Math.round(dx), Math.round(dy), Math.round(dw), Math.round(dh)); - } else { - context.setTransform( - goog.vec.Mat4.getElement(imageTransform, 0, 0), - goog.vec.Mat4.getElement(imageTransform, 1, 0), - goog.vec.Mat4.getElement(imageTransform, 0, 1), - goog.vec.Mat4.getElement(imageTransform, 1, 1), - goog.vec.Mat4.getElement(imageTransform, 0, 3), - goog.vec.Mat4.getElement(imageTransform, 1, 3)); - context.drawImage(image, 0, 0); - context.setTransform(1, 0, 0, 1, 0, 0); - } - context.globalAlpha = alpha; - - if (clipped) { - context.restore(); - } - } - - this.dispatchPostComposeEvent(context, frameState); - -}; - - -/** - * @param {ol.render.EventType} type Event type. - * @param {CanvasRenderingContext2D} context Context. - * @param {olx.FrameState} frameState Frame state. - * @param {goog.vec.Mat4.Number=} opt_transform Transform. - * @private - */ -ol.renderer.canvas.Layer.prototype.dispatchComposeEvent_ = - function(type, context, frameState, opt_transform) { - var layer = this.getLayer(); - if (layer.hasListener(type)) { - var transform = opt_transform !== undefined ? - opt_transform : this.getTransform(frameState, 0); - var render = new ol.render.canvas.Immediate( - context, frameState.pixelRatio, frameState.extent, transform, - frameState.viewState.rotation); - var composeEvent = new ol.render.Event(type, layer, render, frameState, - context, null); - layer.dispatchEvent(composeEvent); - render.flush(); - } -}; - - -/** - * @param {CanvasRenderingContext2D} context Context. - * @param {olx.FrameState} frameState Frame state. - * @param {goog.vec.Mat4.Number=} opt_transform Transform. - * @protected - */ -ol.renderer.canvas.Layer.prototype.dispatchPostComposeEvent = - function(context, frameState, opt_transform) { - this.dispatchComposeEvent_(ol.render.EventType.POSTCOMPOSE, context, - frameState, opt_transform); -}; - - -/** - * @param {CanvasRenderingContext2D} context Context. - * @param {olx.FrameState} frameState Frame state. - * @param {goog.vec.Mat4.Number=} opt_transform Transform. - * @protected - */ -ol.renderer.canvas.Layer.prototype.dispatchPreComposeEvent = - function(context, frameState, opt_transform) { - this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, context, - frameState, opt_transform); -}; - - -/** - * @param {CanvasRenderingContext2D} context Context. - * @param {olx.FrameState} frameState Frame state. - * @param {goog.vec.Mat4.Number=} opt_transform Transform. - * @protected - */ -ol.renderer.canvas.Layer.prototype.dispatchRenderEvent = - function(context, frameState, opt_transform) { - this.dispatchComposeEvent_(ol.render.EventType.RENDER, context, - frameState, opt_transform); -}; - - -/** - * @return {HTMLCanvasElement|HTMLVideoElement|Image} Canvas. - */ -ol.renderer.canvas.Layer.prototype.getImage = goog.abstractMethod; - - -/** - * @return {!goog.vec.Mat4.Number} Image transform. - */ -ol.renderer.canvas.Layer.prototype.getImageTransform = goog.abstractMethod; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {number} offsetX Offset on the x-axis in view coordinates. - * @protected - * @return {!goog.vec.Mat4.Number} Transform. - */ -ol.renderer.canvas.Layer.prototype.getTransform = - function(frameState, offsetX) { - var viewState = frameState.viewState; - var pixelRatio = frameState.pixelRatio; - return ol.vec.Mat4.makeTransform2D(this.transform_, - pixelRatio * frameState.size[0] / 2, - pixelRatio * frameState.size[1] / 2, - pixelRatio / viewState.resolution, - -pixelRatio / viewState.resolution, - -viewState.rotation, - -viewState.center[0] + offsetX, - -viewState.center[1]); -}; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {ol.layer.LayerState} layerState Layer state. - * @return {boolean} whether composeFrame should be called. - */ -ol.renderer.canvas.Layer.prototype.prepareFrame = goog.abstractMethod; - - -/** - * @param {ol.Pixel} pixelOnMap Pixel. - * @param {goog.vec.Mat4.Number} imageTransformInv The transformation matrix - * to convert from a map pixel to a canvas pixel. - * @return {ol.Pixel} - * @protected - */ -ol.renderer.canvas.Layer.prototype.getPixelOnCanvas = - function(pixelOnMap, imageTransformInv) { - var pixelOnCanvas = [0, 0]; - ol.vec.Mat4.multVec2(imageTransformInv, pixelOnMap, pixelOnCanvas); - return pixelOnCanvas; -}; - - -/** - * @param {ol.Size} size Size. - * @return {boolean} True when the canvas with the current size does not exceed - * the maximum dimensions. - */ -ol.renderer.canvas.Layer.testCanvasSize = (function() { - - /** - * @type {CanvasRenderingContext2D} - */ - var context = null; - - /** - * @type {ImageData} - */ - var imageData = null; - - return function(size) { - if (!context) { - context = ol.dom.createCanvasContext2D(1, 1); - imageData = context.createImageData(1, 1); - var data = imageData.data; - data[0] = 42; - data[1] = 84; - data[2] = 126; - data[3] = 255; - } - var canvas = context.canvas; - var good = size[0] <= canvas.width && size[1] <= canvas.height; - if (!good) { - canvas.width = size[0]; - canvas.height = size[1]; - var x = size[0] - 1; - var y = size[1] - 1; - context.putImageData(imageData, x, y); - var result = context.getImageData(x, y, 1, 1); - good = goog.array.equals(imageData.data, result.data); - } - return good; - }; -})(); - -goog.provide('ol.render.IReplayGroup'); - -goog.require('ol.render.VectorContext'); - - -/** - * @enum {string} - */ -ol.render.ReplayType = { - IMAGE: 'Image', - LINE_STRING: 'LineString', - POLYGON: 'Polygon', - TEXT: 'Text' -}; - - -/** - * @const - * @type {Array.<ol.render.ReplayType>} - */ -ol.render.REPLAY_ORDER = [ - ol.render.ReplayType.POLYGON, - ol.render.ReplayType.LINE_STRING, - ol.render.ReplayType.IMAGE, - ol.render.ReplayType.TEXT -]; - - - -/** - * @interface - */ -ol.render.IReplayGroup = function() { -}; - - -/** - * @param {number|undefined} zIndex Z index. - * @param {ol.render.ReplayType} replayType Replay type. - * @return {ol.render.VectorContext} Replay. - */ -ol.render.IReplayGroup.prototype.getReplay = function(zIndex, replayType) { -}; - - -/** - * @return {boolean} Is empty. - */ -ol.render.IReplayGroup.prototype.isEmpty = function() { -}; - -// FIXME add option to apply snapToPixel to all coordinates? -// FIXME can eliminate empty set styles and strokes (when all geoms skipped) - -goog.provide('ol.render.canvas.ImageReplay'); -goog.provide('ol.render.canvas.LineStringReplay'); -goog.provide('ol.render.canvas.PolygonReplay'); -goog.provide('ol.render.canvas.Replay'); -goog.provide('ol.render.canvas.ReplayGroup'); -goog.provide('ol.render.canvas.TextReplay'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('goog.vec.Mat4'); -goog.require('ol'); -goog.require('ol.array'); -goog.require('ol.color'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.extent.Relationship'); -goog.require('ol.geom.flat.simplify'); -goog.require('ol.geom.flat.transform'); -goog.require('ol.has'); -goog.require('ol.render.IReplayGroup'); -goog.require('ol.render.VectorContext'); -goog.require('ol.render.canvas'); -goog.require('ol.vec.Mat4'); - - -/** - * @enum {number} - */ -ol.render.canvas.Instruction = { - BEGIN_GEOMETRY: 0, - BEGIN_PATH: 1, - CIRCLE: 2, - CLOSE_PATH: 3, - DRAW_IMAGE: 4, - DRAW_TEXT: 5, - END_GEOMETRY: 6, - FILL: 7, - MOVE_TO_LINE_TO: 8, - SET_FILL_STYLE: 9, - SET_STROKE_STYLE: 10, - SET_TEXT_STYLE: 11, - STROKE: 12 -}; - - - -/** - * @constructor - * @extends {ol.render.VectorContext} - * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. - * @param {number} resolution Resolution. - * @protected - * @struct - */ -ol.render.canvas.Replay = function(tolerance, maxExtent, resolution) { - goog.base(this); - - /** - * @protected - * @type {number} - */ - this.tolerance = tolerance; - - /** - * @protected - * @const - * @type {ol.Extent} - */ - this.maxExtent = maxExtent; - - /** - * @private - * @type {ol.Extent} - */ - this.bufferedMaxExtent_ = null; - - /** - * @protected - * @type {number} - */ - this.maxLineWidth = 0; - - /** - * @protected - * @const - * @type {number} - */ - this.resolution = resolution; - - /** - * @private - * @type {Array.<*>} - */ - this.beginGeometryInstruction1_ = null; - - /** - * @private - * @type {Array.<*>} - */ - this.beginGeometryInstruction2_ = null; - - /** - * @protected - * @type {Array.<*>} - */ - this.instructions = []; - - /** - * @protected - * @type {Array.<number>} - */ - this.coordinates = []; - - /** - * @private - * @type {goog.vec.Mat4.Number} - */ - this.renderedTransform_ = goog.vec.Mat4.createNumber(); - - /** - * @protected - * @type {Array.<*>} - */ - this.hitDetectionInstructions = []; - - /** - * @private - * @type {Array.<number>} - */ - this.pixelCoordinates_ = []; - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.tmpLocalTransform_ = goog.vec.Mat4.createNumber(); -}; -goog.inherits(ol.render.canvas.Replay, ol.render.VectorContext); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {boolean} close Close. - * @protected - * @return {number} My end. - */ -ol.render.canvas.Replay.prototype.appendFlatCoordinates = - function(flatCoordinates, offset, end, stride, close) { - - var myEnd = this.coordinates.length; - var extent = this.getBufferedMaxExtent(); - var lastCoord = [flatCoordinates[offset], flatCoordinates[offset + 1]]; - var nextCoord = [NaN, NaN]; - var skipped = true; - - var i, lastRel, nextRel; - for (i = offset + stride; i < end; i += stride) { - nextCoord[0] = flatCoordinates[i]; - nextCoord[1] = flatCoordinates[i + 1]; - nextRel = ol.extent.coordinateRelationship(extent, nextCoord); - if (nextRel !== lastRel) { - if (skipped) { - this.coordinates[myEnd++] = lastCoord[0]; - this.coordinates[myEnd++] = lastCoord[1]; - } - this.coordinates[myEnd++] = nextCoord[0]; - this.coordinates[myEnd++] = nextCoord[1]; - skipped = false; - } else if (nextRel === ol.extent.Relationship.INTERSECTING) { - this.coordinates[myEnd++] = nextCoord[0]; - this.coordinates[myEnd++] = nextCoord[1]; - skipped = false; - } else { - skipped = true; - } - lastCoord[0] = nextCoord[0]; - lastCoord[1] = nextCoord[1]; - lastRel = nextRel; - } - - // handle case where there is only one point to append - if (i === offset + stride) { - this.coordinates[myEnd++] = lastCoord[0]; - this.coordinates[myEnd++] = lastCoord[1]; - } - - if (close) { - this.coordinates[myEnd++] = flatCoordinates[offset]; - this.coordinates[myEnd++] = flatCoordinates[offset + 1]; - } - return myEnd; -}; - - -/** - * @protected - * @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - */ -ol.render.canvas.Replay.prototype.beginGeometry = function(geometry, feature) { - this.beginGeometryInstruction1_ = - [ol.render.canvas.Instruction.BEGIN_GEOMETRY, feature, 0]; - this.instructions.push(this.beginGeometryInstruction1_); - this.beginGeometryInstruction2_ = - [ol.render.canvas.Instruction.BEGIN_GEOMETRY, feature, 0]; - this.hitDetectionInstructions.push(this.beginGeometryInstruction2_); -}; - - -/** - * @private - * @param {CanvasRenderingContext2D} context Context. - * @param {number} pixelRatio Pixel ratio. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {number} viewRotation View rotation. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {Array.<*>} instructions Instructions array. - * @param {function((ol.Feature|ol.render.Feature)): T|undefined} - * featureCallback Feature callback. - * @param {ol.Extent=} opt_hitExtent Only check features that intersect this - * extent. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.canvas.Replay.prototype.replay_ = function( - context, pixelRatio, transform, viewRotation, skippedFeaturesHash, - instructions, featureCallback, opt_hitExtent) { - /** @type {Array.<number>} */ - var pixelCoordinates; - if (ol.vec.Mat4.equals2D(transform, this.renderedTransform_)) { - pixelCoordinates = this.pixelCoordinates_; - } else { - pixelCoordinates = ol.geom.flat.transform.transform2D( - this.coordinates, 0, this.coordinates.length, 2, - transform, this.pixelCoordinates_); - goog.vec.Mat4.setFromArray(this.renderedTransform_, transform); - goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_, - 'pixelCoordinates should be the same as this.pixelCoordinates_'); - } - var skipFeatures = !goog.object.isEmpty(skippedFeaturesHash); - var i = 0; // instruction index - var ii = instructions.length; // end of instructions - var d = 0; // data index - var dd; // end of per-instruction data - var localTransform = this.tmpLocalTransform_; - var prevX, prevY, roundX, roundY; - while (i < ii) { - var instruction = instructions[i]; - var type = /** @type {ol.render.canvas.Instruction} */ (instruction[0]); - var feature, fill, stroke, text, x, y; - switch (type) { - case ol.render.canvas.Instruction.BEGIN_GEOMETRY: - feature = /** @type {ol.Feature|ol.render.Feature} */ (instruction[1]); - if ((skipFeatures && - skippedFeaturesHash[goog.getUid(feature).toString()]) || - !feature.getGeometry()) { - i = /** @type {number} */ (instruction[2]); - } else if (opt_hitExtent !== undefined && !ol.extent.intersects( - /** @type {Array<number>} */ (opt_hitExtent), - feature.getGeometry().getExtent())) { - i = /** @type {number} */ (instruction[2]); - } else { - ++i; - } - break; - case ol.render.canvas.Instruction.BEGIN_PATH: - context.beginPath(); - ++i; - break; - case ol.render.canvas.Instruction.CIRCLE: - goog.asserts.assert(goog.isNumber(instruction[1]), - 'second instruction should be a number'); - d = /** @type {number} */ (instruction[1]); - var x1 = pixelCoordinates[d]; - var y1 = pixelCoordinates[d + 1]; - var x2 = pixelCoordinates[d + 2]; - var y2 = pixelCoordinates[d + 3]; - var dx = x2 - x1; - var dy = y2 - y1; - var r = Math.sqrt(dx * dx + dy * dy); - context.arc(x1, y1, r, 0, 2 * Math.PI, true); - ++i; - break; - case ol.render.canvas.Instruction.CLOSE_PATH: - context.closePath(); - ++i; - break; - case ol.render.canvas.Instruction.DRAW_IMAGE: - goog.asserts.assert(goog.isNumber(instruction[1]), - 'second instruction should be a number'); - d = /** @type {number} */ (instruction[1]); - goog.asserts.assert(goog.isNumber(instruction[2]), - 'third instruction should be a number'); - dd = /** @type {number} */ (instruction[2]); - var image = /** @type {HTMLCanvasElement|HTMLVideoElement|Image} */ - (instruction[3]); - // Remaining arguments in DRAW_IMAGE are in alphabetical order - var anchorX = /** @type {number} */ (instruction[4]) * pixelRatio; - var anchorY = /** @type {number} */ (instruction[5]) * pixelRatio; - var height = /** @type {number} */ (instruction[6]); - var opacity = /** @type {number} */ (instruction[7]); - var originX = /** @type {number} */ (instruction[8]); - var originY = /** @type {number} */ (instruction[9]); - var rotateWithView = /** @type {boolean} */ (instruction[10]); - var rotation = /** @type {number} */ (instruction[11]); - var scale = /** @type {number} */ (instruction[12]); - var snapToPixel = /** @type {boolean} */ (instruction[13]); - var width = /** @type {number} */ (instruction[14]); - if (rotateWithView) { - rotation += viewRotation; - } - for (; d < dd; d += 2) { - x = pixelCoordinates[d] - anchorX; - y = pixelCoordinates[d + 1] - anchorY; - if (snapToPixel) { - x = (x + 0.5) | 0; - y = (y + 0.5) | 0; - } - if (scale != 1 || rotation !== 0) { - var centerX = x + anchorX; - var centerY = y + anchorY; - ol.vec.Mat4.makeTransform2D( - localTransform, centerX, centerY, scale, scale, - rotation, -centerX, -centerY); - context.setTransform( - goog.vec.Mat4.getElement(localTransform, 0, 0), - goog.vec.Mat4.getElement(localTransform, 1, 0), - goog.vec.Mat4.getElement(localTransform, 0, 1), - goog.vec.Mat4.getElement(localTransform, 1, 1), - goog.vec.Mat4.getElement(localTransform, 0, 3), - goog.vec.Mat4.getElement(localTransform, 1, 3)); - } - var alpha = context.globalAlpha; - if (opacity != 1) { - context.globalAlpha = alpha * opacity; - } - - context.drawImage(image, originX, originY, width, height, - x, y, width * pixelRatio, height * pixelRatio); - - if (opacity != 1) { - context.globalAlpha = alpha; - } - if (scale != 1 || rotation !== 0) { - context.setTransform(1, 0, 0, 1, 0, 0); - } - } - ++i; - break; - case ol.render.canvas.Instruction.DRAW_TEXT: - goog.asserts.assert(goog.isNumber(instruction[1]), - '2nd instruction should be a number'); - d = /** @type {number} */ (instruction[1]); - goog.asserts.assert(goog.isNumber(instruction[2]), - '3rd instruction should be a number'); - dd = /** @type {number} */ (instruction[2]); - goog.asserts.assert(goog.isString(instruction[3]), - '4th instruction should be a string'); - text = /** @type {string} */ (instruction[3]); - goog.asserts.assert(goog.isNumber(instruction[4]), - '5th instruction should be a number'); - var offsetX = /** @type {number} */ (instruction[4]) * pixelRatio; - goog.asserts.assert(goog.isNumber(instruction[5]), - '6th instruction should be a number'); - var offsetY = /** @type {number} */ (instruction[5]) * pixelRatio; - goog.asserts.assert(goog.isNumber(instruction[6]), - '7th instruction should be a number'); - rotation = /** @type {number} */ (instruction[6]); - goog.asserts.assert(goog.isNumber(instruction[7]), - '8th instruction should be a number'); - scale = /** @type {number} */ (instruction[7]) * pixelRatio; - goog.asserts.assert(goog.isBoolean(instruction[8]), - '9th instruction should be a boolean'); - fill = /** @type {boolean} */ (instruction[8]); - goog.asserts.assert(goog.isBoolean(instruction[9]), - '10th instruction should be a boolean'); - stroke = /** @type {boolean} */ (instruction[9]); - for (; d < dd; d += 2) { - x = pixelCoordinates[d] + offsetX; - y = pixelCoordinates[d + 1] + offsetY; - if (scale != 1 || rotation !== 0) { - ol.vec.Mat4.makeTransform2D( - localTransform, x, y, scale, scale, rotation, -x, -y); - context.setTransform( - goog.vec.Mat4.getElement(localTransform, 0, 0), - goog.vec.Mat4.getElement(localTransform, 1, 0), - goog.vec.Mat4.getElement(localTransform, 0, 1), - goog.vec.Mat4.getElement(localTransform, 1, 1), - goog.vec.Mat4.getElement(localTransform, 0, 3), - goog.vec.Mat4.getElement(localTransform, 1, 3)); - } - if (stroke) { - context.strokeText(text, x, y); - } - if (fill) { - context.fillText(text, x, y); - } - if (scale != 1 || rotation !== 0) { - context.setTransform(1, 0, 0, 1, 0, 0); - } - } - ++i; - break; - case ol.render.canvas.Instruction.END_GEOMETRY: - if (featureCallback !== undefined) { - feature = - /** @type {ol.Feature|ol.render.Feature} */ (instruction[1]); - var result = featureCallback(feature); - if (result) { - return result; - } - } - ++i; - break; - case ol.render.canvas.Instruction.FILL: - context.fill(); - ++i; - break; - case ol.render.canvas.Instruction.MOVE_TO_LINE_TO: - goog.asserts.assert(goog.isNumber(instruction[1]), - '2nd instruction should be a number'); - d = /** @type {number} */ (instruction[1]); - goog.asserts.assert(goog.isNumber(instruction[2]), - '3rd instruction should be a number'); - dd = /** @type {number} */ (instruction[2]); - x = pixelCoordinates[d]; - y = pixelCoordinates[d + 1]; - roundX = (x + 0.5) | 0; - roundY = (y + 0.5) | 0; - if (roundX !== prevX || roundY !== prevY) { - context.moveTo(x, y); - prevX = roundX; - prevY = roundY; - } - for (d += 2; d < dd; d += 2) { - x = pixelCoordinates[d]; - y = pixelCoordinates[d + 1]; - roundX = (x + 0.5) | 0; - roundY = (y + 0.5) | 0; - if (roundX !== prevX || roundY !== prevY) { - context.lineTo(x, y); - prevX = roundX; - prevY = roundY; - } - } - ++i; - break; - case ol.render.canvas.Instruction.SET_FILL_STYLE: - goog.asserts.assert(goog.isString(instruction[1]), - '2nd instruction should be a string'); - context.fillStyle = /** @type {string} */ (instruction[1]); - ++i; - break; - case ol.render.canvas.Instruction.SET_STROKE_STYLE: - goog.asserts.assert(goog.isString(instruction[1]), - '2nd instruction should be a string'); - goog.asserts.assert(goog.isNumber(instruction[2]), - '3rd instruction should be a number'); - goog.asserts.assert(goog.isString(instruction[3]), - '4rd instruction should be a string'); - goog.asserts.assert(goog.isString(instruction[4]), - '5th instruction should be a string'); - goog.asserts.assert(goog.isNumber(instruction[5]), - '6th instruction should be a number'); - goog.asserts.assert(instruction[6], - '7th instruction should not be null'); - var usePixelRatio = instruction[7] !== undefined ? - instruction[7] : true; - var lineWidth = /** @type {number} */ (instruction[2]); - context.strokeStyle = /** @type {string} */ (instruction[1]); - context.lineWidth = usePixelRatio ? lineWidth * pixelRatio : lineWidth; - context.lineCap = /** @type {string} */ (instruction[3]); - context.lineJoin = /** @type {string} */ (instruction[4]); - context.miterLimit = /** @type {number} */ (instruction[5]); - if (ol.has.CANVAS_LINE_DASH) { - context.setLineDash(/** @type {Array.<number>} */ (instruction[6])); - } - prevX = NaN; - prevY = NaN; - ++i; - break; - case ol.render.canvas.Instruction.SET_TEXT_STYLE: - goog.asserts.assert(goog.isString(instruction[1]), - '2nd instruction should be a string'); - goog.asserts.assert(goog.isString(instruction[2]), - '3rd instruction should be a string'); - goog.asserts.assert(goog.isString(instruction[3]), - '4th instruction should be a string'); - context.font = /** @type {string} */ (instruction[1]); - context.textAlign = /** @type {string} */ (instruction[2]); - context.textBaseline = /** @type {string} */ (instruction[3]); - ++i; - break; - case ol.render.canvas.Instruction.STROKE: - context.stroke(); - ++i; - break; - default: - goog.asserts.fail('Unknown canvas render instruction'); - ++i; // consume the instruction anyway, to avoid an infinite loop - break; - } - } - // assert that all instructions were consumed - goog.asserts.assert(i == instructions.length, - 'all instructions should be consumed'); - return undefined; -}; - - -/** - * @param {CanvasRenderingContext2D} context Context. - * @param {number} pixelRatio Pixel ratio. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {number} viewRotation View rotation. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - */ -ol.render.canvas.Replay.prototype.replay = function( - context, pixelRatio, transform, viewRotation, skippedFeaturesHash) { - var instructions = this.instructions; - this.replay_(context, pixelRatio, transform, viewRotation, - skippedFeaturesHash, instructions, undefined); -}; - - -/** - * @param {CanvasRenderingContext2D} context Context. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {number} viewRotation View rotation. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function((ol.Feature|ol.render.Feature)): T=} opt_featureCallback - * Feature callback. - * @param {ol.Extent=} opt_hitExtent Only check features that intersect this - * extent. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.canvas.Replay.prototype.replayHitDetection = function( - context, transform, viewRotation, skippedFeaturesHash, - opt_featureCallback, opt_hitExtent) { - var instructions = this.hitDetectionInstructions; - return this.replay_(context, 1, transform, viewRotation, - skippedFeaturesHash, instructions, opt_featureCallback, opt_hitExtent); -}; - - -/** - * @private - */ -ol.render.canvas.Replay.prototype.reverseHitDetectionInstructions_ = - function() { - var hitDetectionInstructions = this.hitDetectionInstructions; - // step 1 - reverse array - hitDetectionInstructions.reverse(); - // step 2 - reverse instructions within geometry blocks - var i; - var n = hitDetectionInstructions.length; - var instruction; - var type; - var begin = -1; - for (i = 0; i < n; ++i) { - instruction = hitDetectionInstructions[i]; - type = /** @type {ol.render.canvas.Instruction} */ (instruction[0]); - if (type == ol.render.canvas.Instruction.END_GEOMETRY) { - goog.asserts.assert(begin == -1, 'begin should be -1'); - begin = i; - } else if (type == ol.render.canvas.Instruction.BEGIN_GEOMETRY) { - instruction[2] = i; - goog.asserts.assert(begin >= 0, - 'begin should be larger than or equal to 0'); - ol.array.reverseSubArray(this.hitDetectionInstructions, begin, i); - begin = -1; - } - } -}; - - -/** - * @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry. - * @param {ol.Feature|ol.render.Feature} feature Feature. - */ -ol.render.canvas.Replay.prototype.endGeometry = function(geometry, feature) { - goog.asserts.assert(this.beginGeometryInstruction1_, - 'this.beginGeometryInstruction1_ should not be null'); - this.beginGeometryInstruction1_[2] = this.instructions.length; - this.beginGeometryInstruction1_ = null; - goog.asserts.assert(this.beginGeometryInstruction2_, - 'this.beginGeometryInstruction2_ should not be null'); - this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length; - this.beginGeometryInstruction2_ = null; - var endGeometryInstruction = - [ol.render.canvas.Instruction.END_GEOMETRY, feature]; - this.instructions.push(endGeometryInstruction); - this.hitDetectionInstructions.push(endGeometryInstruction); -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.render.canvas.Replay.prototype.finish = ol.nullFunction; - - -/** - * Get the buffered rendering extent. Rendering will be clipped to the extent - * provided to the constructor. To account for symbolizers that may intersect - * this extent, we calculate a buffered extent (e.g. based on stroke width). - * @return {ol.Extent} The buffered rendering extent. - * @protected - */ -ol.render.canvas.Replay.prototype.getBufferedMaxExtent = function() { - return this.maxExtent; -}; - - - -/** - * @constructor - * @extends {ol.render.canvas.Replay} - * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. - * @param {number} resolution Resolution. - * @protected - * @struct - */ -ol.render.canvas.ImageReplay = function(tolerance, maxExtent, resolution) { - goog.base(this, tolerance, maxExtent, resolution); - - /** - * @private - * @type {HTMLCanvasElement|HTMLVideoElement|Image} - */ - this.hitDetectionImage_ = null; - - /** - * @private - * @type {HTMLCanvasElement|HTMLVideoElement|Image} - */ - this.image_ = null; - - /** - * @private - * @type {number|undefined} - */ - this.anchorX_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.anchorY_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.height_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.opacity_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.originX_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.originY_ = undefined; - - /** - * @private - * @type {boolean|undefined} - */ - this.rotateWithView_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.rotation_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.scale_ = undefined; - - /** - * @private - * @type {boolean|undefined} - */ - this.snapToPixel_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.width_ = undefined; - -}; -goog.inherits(ol.render.canvas.ImageReplay, ol.render.canvas.Replay); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @private - * @return {number} My end. - */ -ol.render.canvas.ImageReplay.prototype.drawCoordinates_ = - function(flatCoordinates, offset, end, stride) { - return this.appendFlatCoordinates( - flatCoordinates, offset, end, stride, false); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.ImageReplay.prototype.drawPointGeometry = - function(pointGeometry, feature) { - if (!this.image_) { - return; - } - goog.asserts.assert(this.anchorX_ !== undefined, - 'this.anchorX_ should be defined'); - goog.asserts.assert(this.anchorY_ !== undefined, - 'this.anchorY_ should be defined'); - goog.asserts.assert(this.height_ !== undefined, - 'this.height_ should be defined'); - goog.asserts.assert(this.opacity_ !== undefined, - 'this.opacity_ should be defined'); - goog.asserts.assert(this.originX_ !== undefined, - 'this.originX_ should be defined'); - goog.asserts.assert(this.originY_ !== undefined, - 'this.originY_ should be defined'); - goog.asserts.assert(this.rotateWithView_ !== undefined, - 'this.rotateWithView_ should be defined'); - goog.asserts.assert(this.rotation_ !== undefined, - 'this.rotation_ should be defined'); - goog.asserts.assert(this.scale_ !== undefined, - 'this.scale_ should be defined'); - goog.asserts.assert(this.width_ !== undefined, - 'this.width_ should be defined'); - this.beginGeometry(pointGeometry, feature); - var flatCoordinates = pointGeometry.getFlatCoordinates(); - var stride = pointGeometry.getStride(); - var myBegin = this.coordinates.length; - var myEnd = this.drawCoordinates_( - flatCoordinates, 0, flatCoordinates.length, stride); - this.instructions.push([ - ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_, - // Remaining arguments to DRAW_IMAGE are in alphabetical order - this.anchorX_, this.anchorY_, this.height_, this.opacity_, - this.originX_, this.originY_, this.rotateWithView_, this.rotation_, - this.scale_, this.snapToPixel_, this.width_ - ]); - this.hitDetectionInstructions.push([ - ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, - this.hitDetectionImage_, - // Remaining arguments to DRAW_IMAGE are in alphabetical order - this.anchorX_, this.anchorY_, this.height_, this.opacity_, - this.originX_, this.originY_, this.rotateWithView_, this.rotation_, - this.scale_, this.snapToPixel_, this.width_ - ]); - this.endGeometry(pointGeometry, feature); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.ImageReplay.prototype.drawMultiPointGeometry = - function(multiPointGeometry, feature) { - if (!this.image_) { - return; - } - goog.asserts.assert(this.anchorX_ !== undefined, - 'this.anchorX_ should be defined'); - goog.asserts.assert(this.anchorY_ !== undefined, - 'this.anchorY_ should be defined'); - goog.asserts.assert(this.height_ !== undefined, - 'this.height_ should be defined'); - goog.asserts.assert(this.opacity_ !== undefined, - 'this.opacity_ should be defined'); - goog.asserts.assert(this.originX_ !== undefined, - 'this.originX_ should be defined'); - goog.asserts.assert(this.originY_ !== undefined, - 'this.originY_ should be defined'); - goog.asserts.assert(this.rotateWithView_ !== undefined, - 'this.rotateWithView_ should be defined'); - goog.asserts.assert(this.rotation_ !== undefined, - 'this.rotation_ should be defined'); - goog.asserts.assert(this.scale_ !== undefined, - 'this.scale_ should be defined'); - goog.asserts.assert(this.width_ !== undefined, - 'this.width_ should be defined'); - this.beginGeometry(multiPointGeometry, feature); - var flatCoordinates = multiPointGeometry.getFlatCoordinates(); - var stride = multiPointGeometry.getStride(); - var myBegin = this.coordinates.length; - var myEnd = this.drawCoordinates_( - flatCoordinates, 0, flatCoordinates.length, stride); - this.instructions.push([ - ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_, - // Remaining arguments to DRAW_IMAGE are in alphabetical order - this.anchorX_, this.anchorY_, this.height_, this.opacity_, - this.originX_, this.originY_, this.rotateWithView_, this.rotation_, - this.scale_, this.snapToPixel_, this.width_ - ]); - this.hitDetectionInstructions.push([ - ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, - this.hitDetectionImage_, - // Remaining arguments to DRAW_IMAGE are in alphabetical order - this.anchorX_, this.anchorY_, this.height_, this.opacity_, - this.originX_, this.originY_, this.rotateWithView_, this.rotation_, - this.scale_, this.snapToPixel_, this.width_ - ]); - this.endGeometry(multiPointGeometry, feature); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.ImageReplay.prototype.finish = function() { - this.reverseHitDetectionInstructions_(); - // FIXME this doesn't really protect us against further calls to draw*Geometry - this.anchorX_ = undefined; - this.anchorY_ = undefined; - this.hitDetectionImage_ = null; - this.image_ = null; - this.height_ = undefined; - this.scale_ = undefined; - this.opacity_ = undefined; - this.originX_ = undefined; - this.originY_ = undefined; - this.rotateWithView_ = undefined; - this.rotation_ = undefined; - this.snapToPixel_ = undefined; - this.width_ = undefined; -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) { - goog.asserts.assert(imageStyle, 'imageStyle should not be null'); - var anchor = imageStyle.getAnchor(); - goog.asserts.assert(anchor, 'anchor should not be null'); - var size = imageStyle.getSize(); - goog.asserts.assert(size, 'size should not be null'); - var hitDetectionImage = imageStyle.getHitDetectionImage(1); - goog.asserts.assert(hitDetectionImage, - 'hitDetectionImage should not be null'); - var image = imageStyle.getImage(1); - goog.asserts.assert(image, 'image should not be null'); - var origin = imageStyle.getOrigin(); - goog.asserts.assert(origin, 'origin should not be null'); - this.anchorX_ = anchor[0]; - this.anchorY_ = anchor[1]; - this.hitDetectionImage_ = hitDetectionImage; - this.image_ = image; - this.height_ = size[1]; - this.opacity_ = imageStyle.getOpacity(); - this.originX_ = origin[0]; - this.originY_ = origin[1]; - this.rotateWithView_ = imageStyle.getRotateWithView(); - this.rotation_ = imageStyle.getRotation(); - this.scale_ = imageStyle.getScale(); - this.snapToPixel_ = imageStyle.getSnapToPixel(); - this.width_ = size[0]; -}; - - - -/** - * @constructor - * @extends {ol.render.canvas.Replay} - * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. - * @param {number} resolution Resolution. - * @protected - * @struct - */ -ol.render.canvas.LineStringReplay = function(tolerance, maxExtent, resolution) { - - goog.base(this, tolerance, maxExtent, resolution); - - /** - * @private - * @type {{currentStrokeStyle: (string|undefined), - * currentLineCap: (string|undefined), - * currentLineDash: Array.<number>, - * currentLineJoin: (string|undefined), - * currentLineWidth: (number|undefined), - * currentMiterLimit: (number|undefined), - * lastStroke: number, - * strokeStyle: (string|undefined), - * lineCap: (string|undefined), - * lineDash: Array.<number>, - * lineJoin: (string|undefined), - * lineWidth: (number|undefined), - * miterLimit: (number|undefined)}|null} - */ - this.state_ = { - currentStrokeStyle: undefined, - currentLineCap: undefined, - currentLineDash: null, - currentLineJoin: undefined, - currentLineWidth: undefined, - currentMiterLimit: undefined, - lastStroke: 0, - strokeStyle: undefined, - lineCap: undefined, - lineDash: null, - lineJoin: undefined, - lineWidth: undefined, - miterLimit: undefined - }; - -}; -goog.inherits(ol.render.canvas.LineStringReplay, ol.render.canvas.Replay); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @private - * @return {number} end. - */ -ol.render.canvas.LineStringReplay.prototype.drawFlatCoordinates_ = - function(flatCoordinates, offset, end, stride) { - var myBegin = this.coordinates.length; - var myEnd = this.appendFlatCoordinates( - flatCoordinates, offset, end, stride, false); - var moveToLineToInstruction = - [ol.render.canvas.Instruction.MOVE_TO_LINE_TO, myBegin, myEnd]; - this.instructions.push(moveToLineToInstruction); - this.hitDetectionInstructions.push(moveToLineToInstruction); - return end; -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.LineStringReplay.prototype.getBufferedMaxExtent = function() { - if (!this.bufferedMaxExtent_) { - this.bufferedMaxExtent_ = ol.extent.clone(this.maxExtent); - if (this.maxLineWidth > 0) { - var width = this.resolution * (this.maxLineWidth + 1) / 2; - ol.extent.buffer(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_); - } - } - return this.bufferedMaxExtent_; -}; - - -/** - * @private - */ -ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() { - var state = this.state_; - var strokeStyle = state.strokeStyle; - var lineCap = state.lineCap; - var lineDash = state.lineDash; - var lineJoin = state.lineJoin; - var lineWidth = state.lineWidth; - var miterLimit = state.miterLimit; - goog.asserts.assert(strokeStyle !== undefined, - 'strokeStyle should be defined'); - goog.asserts.assert(lineCap !== undefined, 'lineCap should be defined'); - goog.asserts.assert(lineDash, 'lineDash should not be null'); - goog.asserts.assert(lineJoin !== undefined, 'lineJoin should be defined'); - goog.asserts.assert(lineWidth !== undefined, 'lineWidth should be defined'); - goog.asserts.assert(miterLimit !== undefined, 'miterLimit should be defined'); - if (state.currentStrokeStyle != strokeStyle || - state.currentLineCap != lineCap || - !goog.array.equals(state.currentLineDash, lineDash) || - state.currentLineJoin != lineJoin || - state.currentLineWidth != lineWidth || - state.currentMiterLimit != miterLimit) { - if (state.lastStroke != this.coordinates.length) { - this.instructions.push( - [ol.render.canvas.Instruction.STROKE]); - state.lastStroke = this.coordinates.length; - } - this.instructions.push( - [ol.render.canvas.Instruction.SET_STROKE_STYLE, - strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash], - [ol.render.canvas.Instruction.BEGIN_PATH]); - state.currentStrokeStyle = strokeStyle; - state.currentLineCap = lineCap; - state.currentLineDash = lineDash; - state.currentLineJoin = lineJoin; - state.currentLineWidth = lineWidth; - state.currentMiterLimit = miterLimit; - } -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.LineStringReplay.prototype.drawLineStringGeometry = - function(lineStringGeometry, feature) { - var state = this.state_; - goog.asserts.assert(state, 'state should not be null'); - var strokeStyle = state.strokeStyle; - var lineWidth = state.lineWidth; - if (strokeStyle === undefined || lineWidth === undefined) { - return; - } - this.setStrokeStyle_(); - this.beginGeometry(lineStringGeometry, feature); - this.hitDetectionInstructions.push( - [ol.render.canvas.Instruction.SET_STROKE_STYLE, - state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, - state.miterLimit, state.lineDash], - [ol.render.canvas.Instruction.BEGIN_PATH]); - var flatCoordinates = lineStringGeometry.getFlatCoordinates(); - var stride = lineStringGeometry.getStride(); - this.drawFlatCoordinates_( - flatCoordinates, 0, flatCoordinates.length, stride); - this.hitDetectionInstructions.push([ol.render.canvas.Instruction.STROKE]); - this.endGeometry(lineStringGeometry, feature); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.LineStringReplay.prototype.drawMultiLineStringGeometry = - function(multiLineStringGeometry, feature) { - var state = this.state_; - goog.asserts.assert(state, 'state should not be null'); - var strokeStyle = state.strokeStyle; - var lineWidth = state.lineWidth; - if (strokeStyle === undefined || lineWidth === undefined) { - return; - } - this.setStrokeStyle_(); - this.beginGeometry(multiLineStringGeometry, feature); - this.hitDetectionInstructions.push( - [ol.render.canvas.Instruction.SET_STROKE_STYLE, - state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, - state.miterLimit, state.lineDash], - [ol.render.canvas.Instruction.BEGIN_PATH]); - var ends = multiLineStringGeometry.getEnds(); - var flatCoordinates = multiLineStringGeometry.getFlatCoordinates(); - var stride = multiLineStringGeometry.getStride(); - var offset = 0; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - offset = this.drawFlatCoordinates_( - flatCoordinates, offset, ends[i], stride); - } - this.hitDetectionInstructions.push([ol.render.canvas.Instruction.STROKE]); - this.endGeometry(multiLineStringGeometry, feature); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.LineStringReplay.prototype.finish = function() { - var state = this.state_; - goog.asserts.assert(state, 'state should not be null'); - if (state.lastStroke != this.coordinates.length) { - this.instructions.push([ol.render.canvas.Instruction.STROKE]); - } - this.reverseHitDetectionInstructions_(); - this.state_ = null; -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle = - function(fillStyle, strokeStyle) { - goog.asserts.assert(this.state_, 'this.state_ should not be null'); - goog.asserts.assert(!fillStyle, 'fillStyle should be null'); - goog.asserts.assert(strokeStyle, 'strokeStyle should not be null'); - var strokeStyleColor = strokeStyle.getColor(); - this.state_.strokeStyle = ol.color.asString(strokeStyleColor ? - strokeStyleColor : ol.render.canvas.defaultStrokeStyle); - var strokeStyleLineCap = strokeStyle.getLineCap(); - this.state_.lineCap = strokeStyleLineCap !== undefined ? - strokeStyleLineCap : ol.render.canvas.defaultLineCap; - var strokeStyleLineDash = strokeStyle.getLineDash(); - this.state_.lineDash = strokeStyleLineDash ? - strokeStyleLineDash : ol.render.canvas.defaultLineDash; - var strokeStyleLineJoin = strokeStyle.getLineJoin(); - this.state_.lineJoin = strokeStyleLineJoin !== undefined ? - strokeStyleLineJoin : ol.render.canvas.defaultLineJoin; - var strokeStyleWidth = strokeStyle.getWidth(); - this.state_.lineWidth = strokeStyleWidth !== undefined ? - strokeStyleWidth : ol.render.canvas.defaultLineWidth; - var strokeStyleMiterLimit = strokeStyle.getMiterLimit(); - this.state_.miterLimit = strokeStyleMiterLimit !== undefined ? - strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit; - - if (this.state_.lineWidth > this.maxLineWidth) { - this.maxLineWidth = this.state_.lineWidth; - // invalidate the buffered max extent cache - this.bufferedMaxExtent_ = null; - } -}; - - - -/** - * @constructor - * @extends {ol.render.canvas.Replay} - * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. - * @param {number} resolution Resolution. - * @protected - * @struct - */ -ol.render.canvas.PolygonReplay = function(tolerance, maxExtent, resolution) { - - goog.base(this, tolerance, maxExtent, resolution); - - /** - * @private - * @type {{currentFillStyle: (string|undefined), - * currentStrokeStyle: (string|undefined), - * currentLineCap: (string|undefined), - * currentLineDash: Array.<number>, - * currentLineJoin: (string|undefined), - * currentLineWidth: (number|undefined), - * currentMiterLimit: (number|undefined), - * fillStyle: (string|undefined), - * strokeStyle: (string|undefined), - * lineCap: (string|undefined), - * lineDash: Array.<number>, - * lineJoin: (string|undefined), - * lineWidth: (number|undefined), - * miterLimit: (number|undefined)}|null} - */ - this.state_ = { - currentFillStyle: undefined, - currentStrokeStyle: undefined, - currentLineCap: undefined, - currentLineDash: null, - currentLineJoin: undefined, - currentLineWidth: undefined, - currentMiterLimit: undefined, - fillStyle: undefined, - strokeStyle: undefined, - lineCap: undefined, - lineDash: null, - lineJoin: undefined, - lineWidth: undefined, - miterLimit: undefined - }; - -}; -goog.inherits(ol.render.canvas.PolygonReplay, ol.render.canvas.Replay); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @private - * @return {number} End. - */ -ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = - function(flatCoordinates, offset, ends, stride) { - var state = this.state_; - var beginPathInstruction = [ol.render.canvas.Instruction.BEGIN_PATH]; - this.instructions.push(beginPathInstruction); - this.hitDetectionInstructions.push(beginPathInstruction); - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - var myBegin = this.coordinates.length; - var myEnd = this.appendFlatCoordinates( - flatCoordinates, offset, end, stride, true); - var moveToLineToInstruction = - [ol.render.canvas.Instruction.MOVE_TO_LINE_TO, myBegin, myEnd]; - var closePathInstruction = [ol.render.canvas.Instruction.CLOSE_PATH]; - this.instructions.push(moveToLineToInstruction, closePathInstruction); - this.hitDetectionInstructions.push(moveToLineToInstruction, - closePathInstruction); - offset = end; - } - // FIXME is it quicker to fill and stroke each polygon individually, - // FIXME or all polygons together? - var fillInstruction = [ol.render.canvas.Instruction.FILL]; - this.hitDetectionInstructions.push(fillInstruction); - if (state.fillStyle !== undefined) { - this.instructions.push(fillInstruction); - } - if (state.strokeStyle !== undefined) { - goog.asserts.assert(state.lineWidth !== undefined, - 'state.lineWidth should be defined'); - var strokeInstruction = [ol.render.canvas.Instruction.STROKE]; - this.instructions.push(strokeInstruction); - this.hitDetectionInstructions.push(strokeInstruction); - } - return offset; -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry = - function(circleGeometry, feature) { - var state = this.state_; - goog.asserts.assert(state, 'state should not be null'); - var fillStyle = state.fillStyle; - var strokeStyle = state.strokeStyle; - if (fillStyle === undefined && strokeStyle === undefined) { - return; - } - if (strokeStyle !== undefined) { - goog.asserts.assert(state.lineWidth !== undefined, - 'state.lineWidth should be defined'); - } - this.setFillStrokeStyles_(); - this.beginGeometry(circleGeometry, feature); - // always fill the circle for hit detection - this.hitDetectionInstructions.push( - [ol.render.canvas.Instruction.SET_FILL_STYLE, - ol.color.asString(ol.render.canvas.defaultFillStyle)]); - if (state.strokeStyle !== undefined) { - this.hitDetectionInstructions.push( - [ol.render.canvas.Instruction.SET_STROKE_STYLE, - state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, - state.miterLimit, state.lineDash]); - } - var flatCoordinates = circleGeometry.getFlatCoordinates(); - var stride = circleGeometry.getStride(); - var myBegin = this.coordinates.length; - this.appendFlatCoordinates( - flatCoordinates, 0, flatCoordinates.length, stride, false); - var beginPathInstruction = [ol.render.canvas.Instruction.BEGIN_PATH]; - var circleInstruction = [ol.render.canvas.Instruction.CIRCLE, myBegin]; - this.instructions.push(beginPathInstruction, circleInstruction); - this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction); - var fillInstruction = [ol.render.canvas.Instruction.FILL]; - this.hitDetectionInstructions.push(fillInstruction); - if (state.fillStyle !== undefined) { - this.instructions.push(fillInstruction); - } - if (state.strokeStyle !== undefined) { - goog.asserts.assert(state.lineWidth !== undefined, - 'state.lineWidth should be defined'); - var strokeInstruction = [ol.render.canvas.Instruction.STROKE]; - this.instructions.push(strokeInstruction); - this.hitDetectionInstructions.push(strokeInstruction); - } - this.endGeometry(circleGeometry, feature); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry = - function(polygonGeometry, feature) { - var state = this.state_; - goog.asserts.assert(state, 'state should not be null'); - var fillStyle = state.fillStyle; - var strokeStyle = state.strokeStyle; - if (fillStyle === undefined && strokeStyle === undefined) { - return; - } - if (strokeStyle !== undefined) { - goog.asserts.assert(state.lineWidth !== undefined, - 'state.lineWidth should be defined'); - } - this.setFillStrokeStyles_(); - this.beginGeometry(polygonGeometry, feature); - // always fill the polygon for hit detection - this.hitDetectionInstructions.push( - [ol.render.canvas.Instruction.SET_FILL_STYLE, - ol.color.asString(ol.render.canvas.defaultFillStyle)]); - if (state.strokeStyle !== undefined) { - this.hitDetectionInstructions.push( - [ol.render.canvas.Instruction.SET_STROKE_STYLE, - state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, - state.miterLimit, state.lineDash]); - } - var ends = polygonGeometry.getEnds(); - var flatCoordinates = polygonGeometry.getOrientedFlatCoordinates(); - var stride = polygonGeometry.getStride(); - this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride); - this.endGeometry(polygonGeometry, feature); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry = - function(multiPolygonGeometry, feature) { - var state = this.state_; - goog.asserts.assert(state, 'state should not be null'); - var fillStyle = state.fillStyle; - var strokeStyle = state.strokeStyle; - if (fillStyle === undefined && strokeStyle === undefined) { - return; - } - if (strokeStyle !== undefined) { - goog.asserts.assert(state.lineWidth !== undefined, - 'state.lineWidth should be defined'); - } - this.setFillStrokeStyles_(); - this.beginGeometry(multiPolygonGeometry, feature); - // always fill the multi-polygon for hit detection - this.hitDetectionInstructions.push( - [ol.render.canvas.Instruction.SET_FILL_STYLE, - ol.color.asString(ol.render.canvas.defaultFillStyle)]); - if (state.strokeStyle !== undefined) { - this.hitDetectionInstructions.push( - [ol.render.canvas.Instruction.SET_STROKE_STYLE, - state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, - state.miterLimit, state.lineDash]); - } - var endss = multiPolygonGeometry.getEndss(); - var flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates(); - var stride = multiPolygonGeometry.getStride(); - var offset = 0; - var i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { - offset = this.drawFlatCoordinatess_( - flatCoordinates, offset, endss[i], stride); - } - this.endGeometry(multiPolygonGeometry, feature); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.PolygonReplay.prototype.finish = function() { - goog.asserts.assert(this.state_, 'this.state_ should not be null'); - this.reverseHitDetectionInstructions_(); - this.state_ = null; - // We want to preserve topology when drawing polygons. Polygons are - // simplified using quantization and point elimination. However, we might - // have received a mix of quantized and non-quantized geometries, so ensure - // that all are quantized by quantizing all coordinates in the batch. - var tolerance = this.tolerance; - if (tolerance !== 0) { - var coordinates = this.coordinates; - var i, ii; - for (i = 0, ii = coordinates.length; i < ii; ++i) { - coordinates[i] = ol.geom.flat.simplify.snap(coordinates[i], tolerance); - } - } -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.PolygonReplay.prototype.getBufferedMaxExtent = function() { - if (!this.bufferedMaxExtent_) { - this.bufferedMaxExtent_ = ol.extent.clone(this.maxExtent); - if (this.maxLineWidth > 0) { - var width = this.resolution * (this.maxLineWidth + 1) / 2; - ol.extent.buffer(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_); - } - } - return this.bufferedMaxExtent_; -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle = - function(fillStyle, strokeStyle) { - goog.asserts.assert(this.state_, 'this.state_ should not be null'); - goog.asserts.assert(fillStyle || strokeStyle, - 'fillStyle or strokeStyle should not be null'); - var state = this.state_; - if (fillStyle) { - var fillStyleColor = fillStyle.getColor(); - state.fillStyle = ol.color.asString(fillStyleColor ? - fillStyleColor : ol.render.canvas.defaultFillStyle); - } else { - state.fillStyle = undefined; - } - if (strokeStyle) { - var strokeStyleColor = strokeStyle.getColor(); - state.strokeStyle = ol.color.asString(strokeStyleColor ? - strokeStyleColor : ol.render.canvas.defaultStrokeStyle); - var strokeStyleLineCap = strokeStyle.getLineCap(); - state.lineCap = strokeStyleLineCap !== undefined ? - strokeStyleLineCap : ol.render.canvas.defaultLineCap; - var strokeStyleLineDash = strokeStyle.getLineDash(); - state.lineDash = strokeStyleLineDash ? - strokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash; - var strokeStyleLineJoin = strokeStyle.getLineJoin(); - state.lineJoin = strokeStyleLineJoin !== undefined ? - strokeStyleLineJoin : ol.render.canvas.defaultLineJoin; - var strokeStyleWidth = strokeStyle.getWidth(); - state.lineWidth = strokeStyleWidth !== undefined ? - strokeStyleWidth : ol.render.canvas.defaultLineWidth; - var strokeStyleMiterLimit = strokeStyle.getMiterLimit(); - state.miterLimit = strokeStyleMiterLimit !== undefined ? - strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit; - - if (state.lineWidth > this.maxLineWidth) { - this.maxLineWidth = state.lineWidth; - // invalidate the buffered max extent cache - this.bufferedMaxExtent_ = null; - } - } else { - state.strokeStyle = undefined; - state.lineCap = undefined; - state.lineDash = null; - state.lineJoin = undefined; - state.lineWidth = undefined; - state.miterLimit = undefined; - } -}; - - -/** - * @private - */ -ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() { - var state = this.state_; - var fillStyle = state.fillStyle; - var strokeStyle = state.strokeStyle; - var lineCap = state.lineCap; - var lineDash = state.lineDash; - var lineJoin = state.lineJoin; - var lineWidth = state.lineWidth; - var miterLimit = state.miterLimit; - if (fillStyle !== undefined && state.currentFillStyle != fillStyle) { - this.instructions.push( - [ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle]); - state.currentFillStyle = state.fillStyle; - } - if (strokeStyle !== undefined) { - goog.asserts.assert(lineCap !== undefined, 'lineCap should be defined'); - goog.asserts.assert(lineDash, 'lineDash should not be null'); - goog.asserts.assert(lineJoin !== undefined, 'lineJoin should be defined'); - goog.asserts.assert(lineWidth !== undefined, 'lineWidth should be defined'); - goog.asserts.assert(miterLimit !== undefined, - 'miterLimit should be defined'); - if (state.currentStrokeStyle != strokeStyle || - state.currentLineCap != lineCap || - state.currentLineDash != lineDash || - state.currentLineJoin != lineJoin || - state.currentLineWidth != lineWidth || - state.currentMiterLimit != miterLimit) { - this.instructions.push( - [ol.render.canvas.Instruction.SET_STROKE_STYLE, - strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash]); - state.currentStrokeStyle = strokeStyle; - state.currentLineCap = lineCap; - state.currentLineDash = lineDash; - state.currentLineJoin = lineJoin; - state.currentLineWidth = lineWidth; - state.currentMiterLimit = miterLimit; - } - } -}; - - - -/** - * @constructor - * @extends {ol.render.canvas.Replay} - * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. - * @param {number} resolution Resolution. - * @protected - * @struct - */ -ol.render.canvas.TextReplay = function(tolerance, maxExtent, resolution) { - - goog.base(this, tolerance, maxExtent, resolution); - - /** - * @private - * @type {?ol.render.canvas.FillState} - */ - this.replayFillState_ = null; - - /** - * @private - * @type {?ol.render.canvas.StrokeState} - */ - this.replayStrokeState_ = null; - - /** - * @private - * @type {?ol.render.canvas.TextState} - */ - this.replayTextState_ = null; - - /** - * @private - * @type {string} - */ - this.text_ = ''; - - /** - * @private - * @type {number} - */ - this.textOffsetX_ = 0; - - /** - * @private - * @type {number} - */ - this.textOffsetY_ = 0; - - /** - * @private - * @type {number} - */ - this.textRotation_ = 0; - - /** - * @private - * @type {number} - */ - this.textScale_ = 0; - - /** - * @private - * @type {?ol.render.canvas.FillState} - */ - this.textFillState_ = null; - - /** - * @private - * @type {?ol.render.canvas.StrokeState} - */ - this.textStrokeState_ = null; - - /** - * @private - * @type {?ol.render.canvas.TextState} - */ - this.textState_ = null; - -}; -goog.inherits(ol.render.canvas.TextReplay, ol.render.canvas.Replay); - - -/** - * @inheritDoc - */ -ol.render.canvas.TextReplay.prototype.drawText = - function(flatCoordinates, offset, end, stride, geometry, feature) { - if (this.text_ === '' || !this.textState_ || - (!this.textFillState_ && !this.textStrokeState_)) { - return; - } - if (this.textFillState_) { - this.setReplayFillState_(this.textFillState_); - } - if (this.textStrokeState_) { - this.setReplayStrokeState_(this.textStrokeState_); - } - this.setReplayTextState_(this.textState_); - this.beginGeometry(geometry, feature); - var myBegin = this.coordinates.length; - var myEnd = - this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false); - var fill = !!this.textFillState_; - var stroke = !!this.textStrokeState_; - var drawTextInstruction = [ - ol.render.canvas.Instruction.DRAW_TEXT, myBegin, myEnd, this.text_, - this.textOffsetX_, this.textOffsetY_, this.textRotation_, this.textScale_, - fill, stroke]; - this.instructions.push(drawTextInstruction); - this.hitDetectionInstructions.push(drawTextInstruction); - this.endGeometry(geometry, feature); -}; - - -/** - * @param {ol.render.canvas.FillState} fillState Fill state. - * @private - */ -ol.render.canvas.TextReplay.prototype.setReplayFillState_ = - function(fillState) { - var replayFillState = this.replayFillState_; - if (replayFillState && - replayFillState.fillStyle == fillState.fillStyle) { - return; - } - var setFillStyleInstruction = - [ol.render.canvas.Instruction.SET_FILL_STYLE, fillState.fillStyle]; - this.instructions.push(setFillStyleInstruction); - this.hitDetectionInstructions.push(setFillStyleInstruction); - if (!replayFillState) { - this.replayFillState_ = { - fillStyle: fillState.fillStyle - }; - } else { - replayFillState.fillStyle = fillState.fillStyle; - } -}; - - -/** - * @param {ol.render.canvas.StrokeState} strokeState Stroke state. - * @private - */ -ol.render.canvas.TextReplay.prototype.setReplayStrokeState_ = - function(strokeState) { - var replayStrokeState = this.replayStrokeState_; - if (replayStrokeState && - replayStrokeState.lineCap == strokeState.lineCap && - replayStrokeState.lineDash == strokeState.lineDash && - replayStrokeState.lineJoin == strokeState.lineJoin && - replayStrokeState.lineWidth == strokeState.lineWidth && - replayStrokeState.miterLimit == strokeState.miterLimit && - replayStrokeState.strokeStyle == strokeState.strokeStyle) { - return; - } - var setStrokeStyleInstruction = [ - ol.render.canvas.Instruction.SET_STROKE_STYLE, strokeState.strokeStyle, - strokeState.lineWidth, strokeState.lineCap, strokeState.lineJoin, - strokeState.miterLimit, strokeState.lineDash, false - ]; - this.instructions.push(setStrokeStyleInstruction); - this.hitDetectionInstructions.push(setStrokeStyleInstruction); - if (!replayStrokeState) { - this.replayStrokeState_ = { - lineCap: strokeState.lineCap, - lineDash: strokeState.lineDash, - lineJoin: strokeState.lineJoin, - lineWidth: strokeState.lineWidth, - miterLimit: strokeState.miterLimit, - strokeStyle: strokeState.strokeStyle - }; - } else { - replayStrokeState.lineCap = strokeState.lineCap; - replayStrokeState.lineDash = strokeState.lineDash; - replayStrokeState.lineJoin = strokeState.lineJoin; - replayStrokeState.lineWidth = strokeState.lineWidth; - replayStrokeState.miterLimit = strokeState.miterLimit; - replayStrokeState.strokeStyle = strokeState.strokeStyle; - } -}; - - -/** - * @param {ol.render.canvas.TextState} textState Text state. - * @private - */ -ol.render.canvas.TextReplay.prototype.setReplayTextState_ = - function(textState) { - var replayTextState = this.replayTextState_; - if (replayTextState && - replayTextState.font == textState.font && - replayTextState.textAlign == textState.textAlign && - replayTextState.textBaseline == textState.textBaseline) { - return; - } - var setTextStyleInstruction = [ol.render.canvas.Instruction.SET_TEXT_STYLE, - textState.font, textState.textAlign, textState.textBaseline]; - this.instructions.push(setTextStyleInstruction); - this.hitDetectionInstructions.push(setTextStyleInstruction); - if (!replayTextState) { - this.replayTextState_ = { - font: textState.font, - textAlign: textState.textAlign, - textBaseline: textState.textBaseline - }; - } else { - replayTextState.font = textState.font; - replayTextState.textAlign = textState.textAlign; - replayTextState.textBaseline = textState.textBaseline; - } -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) { - if (!textStyle) { - this.text_ = ''; - } else { - var textFillStyle = textStyle.getFill(); - if (!textFillStyle) { - this.textFillState_ = null; - } else { - var textFillStyleColor = textFillStyle.getColor(); - var fillStyle = ol.color.asString(textFillStyleColor ? - textFillStyleColor : ol.render.canvas.defaultFillStyle); - if (!this.textFillState_) { - this.textFillState_ = { - fillStyle: fillStyle - }; - } else { - var textFillState = this.textFillState_; - textFillState.fillStyle = fillStyle; - } - } - var textStrokeStyle = textStyle.getStroke(); - if (!textStrokeStyle) { - this.textStrokeState_ = null; - } else { - var textStrokeStyleColor = textStrokeStyle.getColor(); - var textStrokeStyleLineCap = textStrokeStyle.getLineCap(); - var textStrokeStyleLineDash = textStrokeStyle.getLineDash(); - var textStrokeStyleLineJoin = textStrokeStyle.getLineJoin(); - var textStrokeStyleWidth = textStrokeStyle.getWidth(); - var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit(); - var lineCap = textStrokeStyleLineCap !== undefined ? - textStrokeStyleLineCap : ol.render.canvas.defaultLineCap; - var lineDash = textStrokeStyleLineDash ? - textStrokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash; - var lineJoin = textStrokeStyleLineJoin !== undefined ? - textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin; - var lineWidth = textStrokeStyleWidth !== undefined ? - textStrokeStyleWidth : ol.render.canvas.defaultLineWidth; - var miterLimit = textStrokeStyleMiterLimit !== undefined ? - textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit; - var strokeStyle = ol.color.asString(textStrokeStyleColor ? - textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle); - if (!this.textStrokeState_) { - this.textStrokeState_ = { - lineCap: lineCap, - lineDash: lineDash, - lineJoin: lineJoin, - lineWidth: lineWidth, - miterLimit: miterLimit, - strokeStyle: strokeStyle - }; - } else { - var textStrokeState = this.textStrokeState_; - textStrokeState.lineCap = lineCap; - textStrokeState.lineDash = lineDash; - textStrokeState.lineJoin = lineJoin; - textStrokeState.lineWidth = lineWidth; - textStrokeState.miterLimit = miterLimit; - textStrokeState.strokeStyle = strokeStyle; - } - } - var textFont = textStyle.getFont(); - var textOffsetX = textStyle.getOffsetX(); - var textOffsetY = textStyle.getOffsetY(); - var textRotation = textStyle.getRotation(); - var textScale = textStyle.getScale(); - var textText = textStyle.getText(); - var textTextAlign = textStyle.getTextAlign(); - var textTextBaseline = textStyle.getTextBaseline(); - var font = textFont !== undefined ? - textFont : ol.render.canvas.defaultFont; - var textAlign = textTextAlign !== undefined ? - textTextAlign : ol.render.canvas.defaultTextAlign; - var textBaseline = textTextBaseline !== undefined ? - textTextBaseline : ol.render.canvas.defaultTextBaseline; - if (!this.textState_) { - this.textState_ = { - font: font, - textAlign: textAlign, - textBaseline: textBaseline - }; - } else { - var textState = this.textState_; - textState.font = font; - textState.textAlign = textAlign; - textState.textBaseline = textBaseline; - } - this.text_ = textText !== undefined ? textText : ''; - this.textOffsetX_ = textOffsetX !== undefined ? textOffsetX : 0; - this.textOffsetY_ = textOffsetY !== undefined ? textOffsetY : 0; - this.textRotation_ = textRotation !== undefined ? textRotation : 0; - this.textScale_ = textScale !== undefined ? textScale : 1; - } -}; - - - -/** - * @constructor - * @implements {ol.render.IReplayGroup} - * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. - * @param {number} resolution Resolution. - * @param {number=} opt_renderBuffer Optional rendering buffer. - * @struct - */ -ol.render.canvas.ReplayGroup = function( - tolerance, maxExtent, resolution, opt_renderBuffer) { - - /** - * @private - * @type {number} - */ - this.tolerance_ = tolerance; - - /** - * @private - * @type {ol.Extent} - */ - this.maxExtent_ = maxExtent; - - /** - * @private - * @type {number} - */ - this.resolution_ = resolution; - - /** - * @private - * @type {number|undefined} - */ - this.renderBuffer_ = opt_renderBuffer; - - /** - * @private - * @type {!Object.<string, - * Object.<ol.render.ReplayType, ol.render.canvas.Replay>>} - */ - this.replaysByZIndex_ = {}; - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.hitDetectionContext_ = ol.dom.createCanvasContext2D(1, 1); - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.hitDetectionTransform_ = goog.vec.Mat4.createNumber(); - -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.render.canvas.ReplayGroup.prototype.finish = function() { - var zKey; - for (zKey in this.replaysByZIndex_) { - var replays = this.replaysByZIndex_[zKey]; - var replayKey; - for (replayKey in replays) { - replays[replayKey].finish(); - } - } -}; - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function((ol.Feature|ol.render.Feature)): T} callback Feature - * callback. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.canvas.ReplayGroup.prototype.forEachFeatureAtCoordinate = function( - coordinate, resolution, rotation, skippedFeaturesHash, callback) { - - var transform = this.hitDetectionTransform_; - ol.vec.Mat4.makeTransform2D(transform, 0.5, 0.5, - 1 / resolution, -1 / resolution, -rotation, - -coordinate[0], -coordinate[1]); - - var context = this.hitDetectionContext_; - context.clearRect(0, 0, 1, 1); - - /** - * @type {ol.Extent} - */ - var hitExtent; - if (this.renderBuffer_ !== undefined) { - hitExtent = ol.extent.createEmpty(); - ol.extent.extendCoordinate(hitExtent, coordinate); - ol.extent.buffer(hitExtent, resolution * this.renderBuffer_, hitExtent); - } - - return this.replayHitDetection_(context, transform, rotation, - skippedFeaturesHash, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - var imageData = context.getImageData(0, 0, 1, 1).data; - if (imageData[3] > 0) { - var result = callback(feature); - if (result) { - return result; - } - context.clearRect(0, 0, 1, 1); - } - }, hitExtent); -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.ReplayGroup.prototype.getReplay = - function(zIndex, replayType) { - var zIndexKey = zIndex !== undefined ? zIndex.toString() : '0'; - var replays = this.replaysByZIndex_[zIndexKey]; - if (replays === undefined) { - replays = {}; - this.replaysByZIndex_[zIndexKey] = replays; - } - var replay = replays[replayType]; - if (replay === undefined) { - var Constructor = ol.render.canvas.BATCH_CONSTRUCTORS_[replayType]; - goog.asserts.assert(Constructor !== undefined, - replayType + - ' constructor missing from ol.render.canvas.BATCH_CONSTRUCTORS_'); - replay = new Constructor(this.tolerance_, this.maxExtent_, - this.resolution_); - replays[replayType] = replay; - } - return replay; -}; - - -/** - * @inheritDoc - */ -ol.render.canvas.ReplayGroup.prototype.isEmpty = function() { - return goog.object.isEmpty(this.replaysByZIndex_); -}; - - -/** - * @param {CanvasRenderingContext2D} context Context. - * @param {number} pixelRatio Pixel ratio. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {number} viewRotation View rotation. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - */ -ol.render.canvas.ReplayGroup.prototype.replay = function( - context, pixelRatio, transform, viewRotation, skippedFeaturesHash) { - - /** @type {Array.<number>} */ - var zs = Object.keys(this.replaysByZIndex_).map(Number); - goog.array.sort(zs); - - // setup clipping so that the parts of over-simplified geometries are not - // visible outside the current extent when panning - var maxExtent = this.maxExtent_; - var minX = maxExtent[0]; - var minY = maxExtent[1]; - var maxX = maxExtent[2]; - var maxY = maxExtent[3]; - var flatClipCoords = [minX, minY, minX, maxY, maxX, maxY, maxX, minY]; - ol.geom.flat.transform.transform2D( - flatClipCoords, 0, 8, 2, transform, flatClipCoords); - context.save(); - context.beginPath(); - context.moveTo(flatClipCoords[0], flatClipCoords[1]); - context.lineTo(flatClipCoords[2], flatClipCoords[3]); - context.lineTo(flatClipCoords[4], flatClipCoords[5]); - context.lineTo(flatClipCoords[6], flatClipCoords[7]); - context.closePath(); - context.clip(); - - var i, ii, j, jj, replays, replay; - for (i = 0, ii = zs.length; i < ii; ++i) { - replays = this.replaysByZIndex_[zs[i].toString()]; - for (j = 0, jj = ol.render.REPLAY_ORDER.length; j < jj; ++j) { - replay = replays[ol.render.REPLAY_ORDER[j]]; - if (replay !== undefined) { - replay.replay(context, pixelRatio, transform, viewRotation, - skippedFeaturesHash); - } - } - } - - context.restore(); -}; - - -/** - * @private - * @param {CanvasRenderingContext2D} context Context. - * @param {goog.vec.Mat4.Number} transform Transform. - * @param {number} viewRotation View rotation. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function((ol.Feature|ol.render.Feature)): T} featureCallback - * Feature callback. - * @param {ol.Extent=} opt_hitExtent Only check features that intersect this - * extent. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.canvas.ReplayGroup.prototype.replayHitDetection_ = function( - context, transform, viewRotation, skippedFeaturesHash, - featureCallback, opt_hitExtent) { - /** @type {Array.<number>} */ - var zs = Object.keys(this.replaysByZIndex_).map(Number); - goog.array.sort(zs, function(a, b) { return b - a; }); - - var i, ii, j, replays, replay, result; - for (i = 0, ii = zs.length; i < ii; ++i) { - replays = this.replaysByZIndex_[zs[i].toString()]; - for (j = ol.render.REPLAY_ORDER.length - 1; j >= 0; --j) { - replay = replays[ol.render.REPLAY_ORDER[j]]; - if (replay !== undefined) { - result = replay.replayHitDetection(context, transform, viewRotation, - skippedFeaturesHash, featureCallback, opt_hitExtent); - if (result) { - return result; - } - } - } - } - return undefined; -}; - - -/** - * @const - * @private - * @type {Object.<ol.render.ReplayType, - * function(new: ol.render.canvas.Replay, number, ol.Extent, - * number)>} - */ -ol.render.canvas.BATCH_CONSTRUCTORS_ = { - 'Image': ol.render.canvas.ImageReplay, - 'LineString': ol.render.canvas.LineStringReplay, - 'Polygon': ol.render.canvas.PolygonReplay, - 'Text': ol.render.canvas.TextReplay -}; - -goog.provide('ol.render.Feature'); - - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryType'); - - - -/** - * Lightweight, read-only, {@link ol.Feature} and {@link ol.geom.Geometry} like - * structure, optimized for rendering and styling. Geometry access through the - * API is limited to getting the type and extent of the geometry. - * - * @constructor - * @param {ol.geom.GeometryType} type Geometry type. - * @param {Array.<number>} flatCoordinates Flat coordinates. These always need - * to be right-handed for polygons. - * @param {Array.<number>|Array.<Array.<number>>} ends Ends or Endss. - * @param {Object.<string, *>} properties Properties. - */ -ol.render.Feature = function(type, flatCoordinates, ends, properties) { - - /** - * @private - * @type {ol.Extent|undefined} - */ - this.extent_; - - goog.asserts.assert(type === ol.geom.GeometryType.POINT || - type === ol.geom.GeometryType.MULTI_POINT || - type === ol.geom.GeometryType.LINE_STRING || - type === ol.geom.GeometryType.MULTI_LINE_STRING || - type === ol.geom.GeometryType.POLYGON, - 'Need a Point, MultiPoint, LineString, MultiLineString or Polygon type'); - - /** - * @private - * @type {ol.geom.GeometryType} - */ - this.type_ = type; - - /** - * @private - * @type {Array.<number>} - */ - this.flatCoordinates_ = flatCoordinates; - - /** - * @private - * @type {Array.<number>|Array.<Array.<number>>} - */ - this.ends_ = ends; - - /** - * @private - * @type {Object.<string, *>} - */ - this.properties_ = properties; - -}; - - -/** - * Get a feature property by its key. - * @param {string} key Key - * @return {*} Value for the requested key. - * @api - */ -ol.render.Feature.prototype.get = function(key) { - return this.properties_[key]; -}; - - -/** - * @return {Array.<number>|Array.<Array.<number>>} Ends or endss. - */ -ol.render.Feature.prototype.getEnds = function() { - return this.ends_; -}; - - -/** - * Get the extent of this feature's geometry. - * @return {ol.Extent} Extent. - * @api - */ -ol.render.Feature.prototype.getExtent = function() { - if (!this.extent_) { - this.extent_ = this.type_ === ol.geom.GeometryType.POINT ? - ol.extent.createOrUpdateFromCoordinate(this.flatCoordinates_) : - ol.extent.createOrUpdateFromFlatCoordinates( - this.flatCoordinates_, 0, this.flatCoordinates_.length, 2); - - } - return this.extent_; -}; - - -/** - * @return {Array.<number>} Flat coordinates. - */ -ol.render.Feature.prototype.getFlatCoordinates = - ol.render.Feature.prototype.getOrientedFlatCoordinates = function() { - return this.flatCoordinates_; -}; - - -/** - * Get the feature for working with its geometry. - * @return {ol.render.Feature} Feature. - * @api - */ -ol.render.Feature.prototype.getGeometry = function() { - return this; -}; - - -/** - * Get the feature properties. - * @return {Object.<string, *>} Feature properties. - * @api - */ -ol.render.Feature.prototype.getProperties = function() { - return this.properties_; -}; - - -/** - * Get the feature for working with its geometry. - * @return {ol.render.Feature} Feature. - */ -ol.render.Feature.prototype.getSimplifiedGeometry = - ol.render.Feature.prototype.getGeometry; - - -/** - * @return {number} Stride. - */ -ol.render.Feature.prototype.getStride = goog.functions.constant(2); - - -/** - * @return {undefined} - */ -ol.render.Feature.prototype.getStyleFunction = ol.nullFunction; - - -/** - * Get the type of this feature's geometry. - * @return {ol.geom.GeometryType} Geometry type. - * @api - */ -ol.render.Feature.prototype.getType = function() { - return this.type_; -}; - -goog.provide('ol.renderer.vector'); - -goog.require('goog.asserts'); -goog.require('ol.render.Feature'); -goog.require('ol.render.IReplayGroup'); -goog.require('ol.style.ImageState'); -goog.require('ol.style.Style'); - - -/** - * @param {ol.Feature|ol.render.Feature} feature1 Feature 1. - * @param {ol.Feature|ol.render.Feature} feature2 Feature 2. - * @return {number} Order. - */ -ol.renderer.vector.defaultOrder = function(feature1, feature2) { - return goog.getUid(feature1) - goog.getUid(feature2); -}; - - -/** - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @return {number} Squared pixel tolerance. - */ -ol.renderer.vector.getSquaredTolerance = function(resolution, pixelRatio) { - var tolerance = ol.renderer.vector.getTolerance(resolution, pixelRatio); - return tolerance * tolerance; -}; - - -/** - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @return {number} Pixel tolerance. - */ -ol.renderer.vector.getTolerance = function(resolution, pixelRatio) { - return ol.SIMPLIFY_TOLERANCE * resolution / pixelRatio; -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.geom.Circle} geometry Geometry. - * @param {ol.style.Style} style Style. - * @param {ol.Feature} feature Feature. - * @private - */ -ol.renderer.vector.renderCircleGeometry_ = - function(replayGroup, geometry, style, feature) { - var fillStyle = style.getFill(); - var strokeStyle = style.getStroke(); - if (fillStyle || strokeStyle) { - var polygonReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.POLYGON); - polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle); - polygonReplay.drawCircleGeometry(geometry, feature); - } - var textStyle = style.getText(); - if (textStyle) { - var textReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.TEXT); - textReplay.setTextStyle(textStyle); - textReplay.drawText(geometry.getCenter(), 0, 2, 2, geometry, feature); - } -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @param {ol.style.Style} style Style. - * @param {number} squaredTolerance Squared tolerance. - * @param {function(this: T, goog.events.Event)} listener Listener function. - * @param {T} thisArg Value to use as `this` when executing `listener`. - * @return {boolean} `true` if style is loading. - * @template T - */ -ol.renderer.vector.renderFeature = function( - replayGroup, feature, style, squaredTolerance, listener, thisArg) { - var loading = false; - var imageStyle, imageState; - imageStyle = style.getImage(); - if (imageStyle) { - imageState = imageStyle.getImageState(); - if (imageState == ol.style.ImageState.LOADED || - imageState == ol.style.ImageState.ERROR) { - imageStyle.unlistenImageChange(listener, thisArg); - } else { - if (imageState == ol.style.ImageState.IDLE) { - imageStyle.load(); - } - imageState = imageStyle.getImageState(); - goog.asserts.assert(imageState == ol.style.ImageState.LOADING, - 'imageState should be LOADING'); - imageStyle.listenImageChange(listener, thisArg); - loading = true; - } - } - ol.renderer.vector.renderFeature_(replayGroup, feature, style, - squaredTolerance); - return loading; -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @param {ol.style.Style} style Style. - * @param {number} squaredTolerance Squared tolerance. - * @private - */ -ol.renderer.vector.renderFeature_ = function( - replayGroup, feature, style, squaredTolerance) { - var geometry = style.getGeometryFunction()(feature); - if (!geometry) { - return; - } - var simplifiedGeometry = geometry.getSimplifiedGeometry(squaredTolerance); - var geometryRenderer = - ol.renderer.vector.GEOMETRY_RENDERERS_[simplifiedGeometry.getType()]; - goog.asserts.assert(geometryRenderer !== undefined, - 'geometryRenderer should be defined'); - geometryRenderer(replayGroup, simplifiedGeometry, style, feature); -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.geom.GeometryCollection} geometry Geometry. - * @param {ol.style.Style} style Style. - * @param {ol.Feature} feature Feature. - * @private - */ -ol.renderer.vector.renderGeometryCollectionGeometry_ = - function(replayGroup, geometry, style, feature) { - var geometries = geometry.getGeometriesArray(); - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - var geometryRenderer = - ol.renderer.vector.GEOMETRY_RENDERERS_[geometries[i].getType()]; - goog.asserts.assert(geometryRenderer !== undefined, - 'geometryRenderer should be defined'); - geometryRenderer(replayGroup, geometries[i], style, feature); - } -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.geom.LineString|ol.render.Feature} geometry Geometry. - * @param {ol.style.Style} style Style. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @private - */ -ol.renderer.vector.renderLineStringGeometry_ = - function(replayGroup, geometry, style, feature) { - var strokeStyle = style.getStroke(); - if (strokeStyle) { - var lineStringReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.LINE_STRING); - lineStringReplay.setFillStrokeStyle(null, strokeStyle); - lineStringReplay.drawLineStringGeometry(geometry, feature); - } - var textStyle = style.getText(); - if (textStyle) { - var textReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.TEXT); - textReplay.setTextStyle(textStyle); - textReplay.drawText(geometry.getFlatMidpoint(), 0, 2, 2, geometry, feature); - } -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.geom.MultiLineString|ol.render.Feature} geometry Geometry. - * @param {ol.style.Style} style Style. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @private - */ -ol.renderer.vector.renderMultiLineStringGeometry_ = - function(replayGroup, geometry, style, feature) { - var strokeStyle = style.getStroke(); - if (strokeStyle) { - var lineStringReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.LINE_STRING); - lineStringReplay.setFillStrokeStyle(null, strokeStyle); - lineStringReplay.drawMultiLineStringGeometry(geometry, feature); - } - var textStyle = style.getText(); - if (textStyle) { - var textReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.TEXT); - textReplay.setTextStyle(textStyle); - var flatMidpointCoordinates = geometry.getFlatMidpoints(); - textReplay.drawText(flatMidpointCoordinates, 0, - flatMidpointCoordinates.length, 2, geometry, feature); - } -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.geom.MultiPolygon} geometry Geometry. - * @param {ol.style.Style} style Style. - * @param {ol.Feature} feature Feature. - * @private - */ -ol.renderer.vector.renderMultiPolygonGeometry_ = - function(replayGroup, geometry, style, feature) { - var fillStyle = style.getFill(); - var strokeStyle = style.getStroke(); - if (strokeStyle || fillStyle) { - var polygonReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.POLYGON); - polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle); - polygonReplay.drawMultiPolygonGeometry(geometry, feature); - } - var textStyle = style.getText(); - if (textStyle) { - var textReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.TEXT); - textReplay.setTextStyle(textStyle); - var flatInteriorPointCoordinates = geometry.getFlatInteriorPoints(); - textReplay.drawText(flatInteriorPointCoordinates, 0, - flatInteriorPointCoordinates.length, 2, geometry, feature); - } -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.geom.Point|ol.render.Feature} geometry Geometry. - * @param {ol.style.Style} style Style. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @private - */ -ol.renderer.vector.renderPointGeometry_ = - function(replayGroup, geometry, style, feature) { - var imageStyle = style.getImage(); - if (imageStyle) { - if (imageStyle.getImageState() != ol.style.ImageState.LOADED) { - return; - } - var imageReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.IMAGE); - imageReplay.setImageStyle(imageStyle); - imageReplay.drawPointGeometry(geometry, feature); - } - var textStyle = style.getText(); - if (textStyle) { - var textReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.TEXT); - textReplay.setTextStyle(textStyle); - textReplay.drawText(geometry.getFlatCoordinates(), 0, 2, 2, geometry, - feature); - } -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.geom.MultiPoint|ol.render.Feature} geometry Geometry. - * @param {ol.style.Style} style Style. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @private - */ -ol.renderer.vector.renderMultiPointGeometry_ = - function(replayGroup, geometry, style, feature) { - var imageStyle = style.getImage(); - if (imageStyle) { - if (imageStyle.getImageState() != ol.style.ImageState.LOADED) { - return; - } - var imageReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.IMAGE); - imageReplay.setImageStyle(imageStyle); - imageReplay.drawMultiPointGeometry(geometry, feature); - } - var textStyle = style.getText(); - if (textStyle) { - var textReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.TEXT); - textReplay.setTextStyle(textStyle); - var flatCoordinates = geometry.getFlatCoordinates(); - textReplay.drawText(flatCoordinates, 0, flatCoordinates.length, - geometry.getStride(), geometry, feature); - } -}; - - -/** - * @param {ol.render.IReplayGroup} replayGroup Replay group. - * @param {ol.geom.Polygon|ol.render.Feature} geometry Geometry. - * @param {ol.style.Style} style Style. - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @private - */ -ol.renderer.vector.renderPolygonGeometry_ = - function(replayGroup, geometry, style, feature) { - var fillStyle = style.getFill(); - var strokeStyle = style.getStroke(); - if (fillStyle || strokeStyle) { - var polygonReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.POLYGON); - polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle); - polygonReplay.drawPolygonGeometry(geometry, feature); - } - var textStyle = style.getText(); - if (textStyle) { - var textReplay = replayGroup.getReplay( - style.getZIndex(), ol.render.ReplayType.TEXT); - textReplay.setTextStyle(textStyle); - textReplay.drawText( - geometry.getFlatInteriorPoint(), 0, 2, 2, geometry, feature); - } -}; - - -/** - * @const - * @private - * @type {Object.<ol.geom.GeometryType, - * function(ol.render.IReplayGroup, ol.geom.Geometry, - * ol.style.Style, Object)>} - */ -ol.renderer.vector.GEOMETRY_RENDERERS_ = { - 'Point': ol.renderer.vector.renderPointGeometry_, - 'LineString': ol.renderer.vector.renderLineStringGeometry_, - 'Polygon': ol.renderer.vector.renderPolygonGeometry_, - 'MultiPoint': ol.renderer.vector.renderMultiPointGeometry_, - 'MultiLineString': ol.renderer.vector.renderMultiLineStringGeometry_, - 'MultiPolygon': ol.renderer.vector.renderMultiPolygonGeometry_, - 'GeometryCollection': ol.renderer.vector.renderGeometryCollectionGeometry_, - 'Circle': ol.renderer.vector.renderCircleGeometry_ -}; - -goog.provide('ol.ImageCanvas'); - -goog.require('goog.asserts'); -goog.require('ol.ImageBase'); -goog.require('ol.ImageState'); - - - -/** - * @constructor - * @extends {ol.ImageBase} - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {Array.<ol.Attribution>} attributions Attributions. - * @param {HTMLCanvasElement} canvas Canvas. - * @param {ol.ImageCanvasLoader=} opt_loader Optional loader function to - * support asynchronous canvas drawing. - */ -ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions, - canvas, opt_loader) { - - /** - * Optional canvas loader function. - * @type {?ol.ImageCanvasLoader} - * @private - */ - this.loader_ = opt_loader !== undefined ? opt_loader : null; - - var state = opt_loader !== undefined ? - ol.ImageState.IDLE : ol.ImageState.LOADED; - - goog.base(this, extent, resolution, pixelRatio, state, attributions); - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = canvas; - - /** - * @private - * @type {Error} - */ - this.error_ = null; - -}; -goog.inherits(ol.ImageCanvas, ol.ImageBase); - - -/** - * Get any error associated with asynchronous rendering. - * @return {Error} Any error that occurred during rendering. - */ -ol.ImageCanvas.prototype.getError = function() { - return this.error_; -}; - - -/** - * Handle async drawing complete. - * @param {Error} err Any error during drawing. - * @private - */ -ol.ImageCanvas.prototype.handleLoad_ = function(err) { - if (err) { - this.error_ = err; - this.state = ol.ImageState.ERROR; - } else { - this.state = ol.ImageState.LOADED; - } - this.changed(); -}; - - -/** - * Trigger drawing on canvas. - */ -ol.ImageCanvas.prototype.load = function() { - if (this.state == ol.ImageState.IDLE) { - goog.asserts.assert(this.loader_, 'this.loader_ must be set'); - this.state = ol.ImageState.LOADING; - this.changed(); - this.loader_(goog.bind(this.handleLoad_, this)); - } -}; - - -/** - * @inheritDoc - */ -ol.ImageCanvas.prototype.getImage = function(opt_context) { - return this.canvas_; -}; - - -/** - * A function that is called to trigger asynchronous canvas drawing. It is - * called with a "done" callback that should be called when drawing is done. - * If any error occurs during drawing, the "done" callback should be called with - * that error. - * - * @typedef {function(function(Error))} - */ -ol.ImageCanvasLoader; - -goog.provide('ol.reproj'); - -goog.require('goog.labs.userAgent.browser'); -goog.require('goog.labs.userAgent.platform'); -goog.require('goog.math'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.math'); -goog.require('ol.proj'); - - -/** - * We need to employ more sophisticated solution - * if the web browser antialiases clipping edges on canvas. - * - * Currently only Chrome does not antialias the edges, but this is probably - * going to be "fixed" in the future: http://crbug.com/424291 - * - * @type {boolean} - * @private - */ -ol.reproj.browserAntialiasesClip_ = !goog.labs.userAgent.browser.isChrome() || - goog.labs.userAgent.platform.isIos(); - - -/** - * Calculates ideal resolution to use from the source in order to achieve - * pixel mapping as close as possible to 1:1 during reprojection. - * The resolution is calculated regardless of what resolutions - * are actually available in the dataset (TileGrid, Image, ...). - * - * @param {ol.proj.Projection} sourceProj Source projection. - * @param {ol.proj.Projection} targetProj Target projection. - * @param {ol.Coordinate} targetCenter Target center. - * @param {number} targetResolution Target resolution. - * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0. - */ -ol.reproj.calculateSourceResolution = function(sourceProj, targetProj, - targetCenter, targetResolution) { - - var sourceCenter = ol.proj.transform(targetCenter, targetProj, sourceProj); - - // calculate the ideal resolution of the source data - var sourceResolution = - targetProj.getPointResolution(targetResolution, targetCenter); - - var targetMetersPerUnit = targetProj.getMetersPerUnit(); - if (targetMetersPerUnit !== undefined) { - sourceResolution *= targetMetersPerUnit; - } - var sourceMetersPerUnit = sourceProj.getMetersPerUnit(); - if (sourceMetersPerUnit !== undefined) { - sourceResolution /= sourceMetersPerUnit; - } - - // Based on the projection properties, the point resolution at the specified - // coordinates may be slightly different. We need to reverse-compensate this - // in order to achieve optimal results. - - var compensationFactor = - sourceProj.getPointResolution(sourceResolution, sourceCenter) / - sourceResolution; - - if (goog.math.isFiniteNumber(compensationFactor) && compensationFactor > 0) { - sourceResolution /= compensationFactor; - } - - return sourceResolution; -}; - - -/** - * Enlarge the clipping triangle point by 1 pixel to ensure the edges overlap - * in order to mask gaps caused by antialiasing. - * - * @param {number} centroidX Centroid of the triangle (x coordinate in pixels). - * @param {number} centroidY Centroid of the triangle (y coordinate in pixels). - * @param {number} x X coordinate of the point (in pixels). - * @param {number} y Y coordinate of the point (in pixels). - * @return {ol.Coordinate} New point 1 px farther from the centroid. - * @private - */ -ol.reproj.enlargeClipPoint_ = function(centroidX, centroidY, x, y) { - var dX = x - centroidX, dY = y - centroidY; - var distance = Math.sqrt(dX * dX + dY * dY); - return [Math.round(x + dX / distance), Math.round(y + dY / distance)]; -}; - - -/** - * Renders the source data into new canvas based on the triangulation. - * - * @param {number} width Width of the canvas. - * @param {number} height Height of the canvas. - * @param {number} pixelRatio Pixel ratio. - * @param {number} sourceResolution Source resolution. - * @param {ol.Extent} sourceExtent Extent of the data source. - * @param {number} targetResolution Target resolution. - * @param {ol.Extent} targetExtent Target extent. - * @param {ol.reproj.Triangulation} triangulation Calculated triangulation. - * @param {Array.<{extent: ol.Extent, - * image: (HTMLCanvasElement|Image|HTMLVideoElement)}>} sources - * Array of sources. - * @param {boolean=} opt_renderEdges Render reprojection edges. - * @return {HTMLCanvasElement} Canvas with reprojected data. - */ -ol.reproj.render = function(width, height, pixelRatio, - sourceResolution, sourceExtent, targetResolution, targetExtent, - triangulation, sources, opt_renderEdges) { - - var context = ol.dom.createCanvasContext2D(Math.round(pixelRatio * width), - Math.round(pixelRatio * height)); - - if (sources.length === 0) { - return context.canvas; - } - - context.scale(pixelRatio, pixelRatio); - - var sourceDataExtent = ol.extent.createEmpty(); - sources.forEach(function(src, i, arr) { - ol.extent.extend(sourceDataExtent, src.extent); - }); - - var canvasWidthInUnits = ol.extent.getWidth(sourceDataExtent); - var canvasHeightInUnits = ol.extent.getHeight(sourceDataExtent); - var stitchContext = ol.dom.createCanvasContext2D( - Math.round(pixelRatio * canvasWidthInUnits / sourceResolution), - Math.round(pixelRatio * canvasHeightInUnits / sourceResolution)); - - stitchContext.scale(pixelRatio / sourceResolution, - pixelRatio / sourceResolution); - stitchContext.translate(-sourceDataExtent[0], sourceDataExtent[3]); - - sources.forEach(function(src, i, arr) { - var xPos = src.extent[0]; - var yPos = -src.extent[3]; - var srcWidth = ol.extent.getWidth(src.extent); - var srcHeight = ol.extent.getHeight(src.extent); - - stitchContext.drawImage(src.image, xPos, yPos, srcWidth, srcHeight); - }); - - var targetTopLeft = ol.extent.getTopLeft(targetExtent); - - triangulation.getTriangles().forEach(function(triangle, i, arr) { - /* Calculate affine transform (src -> dst) - * Resulting matrix can be used to transform coordinate - * from `sourceProjection` to destination pixels. - * - * To optimize number of context calls and increase numerical stability, - * we also do the following operations: - * trans(-topLeftExtentCorner), scale(1 / targetResolution), scale(1, -1) - * here before solving the linear system so [ui, vi] are pixel coordinates. - * - * Src points: xi, yi - * Dst points: ui, vi - * Affine coefficients: aij - * - * | x0 y0 1 0 0 0 | |a00| |u0| - * | x1 y1 1 0 0 0 | |a01| |u1| - * | x2 y2 1 0 0 0 | x |a02| = |u2| - * | 0 0 0 x0 y0 1 | |a10| |v0| - * | 0 0 0 x1 y1 1 | |a11| |v1| - * | 0 0 0 x2 y2 1 | |a12| |v2| - */ - var source = triangle.source, target = triangle.target; - var x0 = source[0][0], y0 = source[0][1], - x1 = source[1][0], y1 = source[1][1], - x2 = source[2][0], y2 = source[2][1]; - var u0 = (target[0][0] - targetTopLeft[0]) / targetResolution, - v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution; - var u1 = (target[1][0] - targetTopLeft[0]) / targetResolution, - v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution; - var u2 = (target[2][0] - targetTopLeft[0]) / targetResolution, - v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution; - - // Shift all the source points to improve numerical stability - // of all the subsequent calculations. The [x0, y0] is used here. - // This is also used to simplify the linear system. - var sourceNumericalShiftX = x0, sourceNumericalShiftY = y0; - x0 = 0; - y0 = 0; - x1 -= sourceNumericalShiftX; - y1 -= sourceNumericalShiftY; - x2 -= sourceNumericalShiftX; - y2 -= sourceNumericalShiftY; - - var augmentedMatrix = [ - [x1, y1, 0, 0, u1 - u0], - [x2, y2, 0, 0, u2 - u0], - [0, 0, x1, y1, v1 - v0], - [0, 0, x2, y2, v2 - v0] - ]; - var affineCoefs = ol.math.solveLinearSystem(augmentedMatrix); - if (!affineCoefs) { - return; - } - - context.save(); - context.beginPath(); - if (ol.reproj.browserAntialiasesClip_) { - var centroidX = (u0 + u1 + u2) / 3, centroidY = (v0 + v1 + v2) / 3; - var p0 = ol.reproj.enlargeClipPoint_(centroidX, centroidY, u0, v0); - var p1 = ol.reproj.enlargeClipPoint_(centroidX, centroidY, u1, v1); - var p2 = ol.reproj.enlargeClipPoint_(centroidX, centroidY, u2, v2); - - context.moveTo(p0[0], p0[1]); - context.lineTo(p1[0], p1[1]); - context.lineTo(p2[0], p2[1]); - } else { - context.moveTo(u0, v0); - context.lineTo(u1, v1); - context.lineTo(u2, v2); - } - context.closePath(); - context.clip(); - - context.transform( - affineCoefs[0], affineCoefs[2], affineCoefs[1], affineCoefs[3], u0, v0); - - context.translate(sourceDataExtent[0] - sourceNumericalShiftX, - sourceDataExtent[3] - sourceNumericalShiftY); - - context.scale(sourceResolution / pixelRatio, - -sourceResolution / pixelRatio); - - context.drawImage(stitchContext.canvas, 0, 0); - context.restore(); - }); - - if (opt_renderEdges) { - context.save(); - - context.strokeStyle = 'black'; - context.lineWidth = 1; - - triangulation.getTriangles().forEach(function(triangle, i, arr) { - var target = triangle.target; - var u0 = (target[0][0] - targetTopLeft[0]) / targetResolution, - v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution; - var u1 = (target[1][0] - targetTopLeft[0]) / targetResolution, - v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution; - var u2 = (target[2][0] - targetTopLeft[0]) / targetResolution, - v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution; - - context.beginPath(); - context.moveTo(u0, v0); - context.lineTo(u1, v1); - context.lineTo(u2, v2); - context.closePath(); - context.stroke(); - }); - - context.restore(); - } - return context.canvas; -}; - -goog.provide('ol.reproj.Triangulation'); - -goog.require('goog.asserts'); -goog.require('goog.math'); -goog.require('ol.extent'); -goog.require('ol.proj'); - - -/** - * Single triangle; consists of 3 source points and 3 target points. - * - * @typedef {{source: Array.<ol.Coordinate>, - * target: Array.<ol.Coordinate>}} - */ -ol.reproj.Triangle; - - - -/** - * @classdesc - * Class containing triangulation of the given target extent. - * Used for determining source data and the reprojection itself. - * - * @param {ol.proj.Projection} sourceProj Source projection. - * @param {ol.proj.Projection} targetProj Target projection. - * @param {ol.Extent} targetExtent Target extent to triangulate. - * @param {ol.Extent} maxSourceExtent Maximal source extent that can be used. - * @param {number} errorThreshold Acceptable error (in source units). - * @constructor - */ -ol.reproj.Triangulation = function(sourceProj, targetProj, targetExtent, - maxSourceExtent, errorThreshold) { - - /** - * @type {ol.proj.Projection} - * @private - */ - this.sourceProj_ = sourceProj; - - /** - * @type {ol.proj.Projection} - * @private - */ - this.targetProj_ = targetProj; - - /** @type {!Object.<string, ol.Coordinate>} */ - var transformInvCache = {}; - var transformInv = ol.proj.getTransform(this.targetProj_, this.sourceProj_); - - /** - * @param {ol.Coordinate} c - * @return {ol.Coordinate} - * @private - */ - this.transformInv_ = function(c) { - var key = c[0] + '/' + c[1]; - if (!transformInvCache[key]) { - transformInvCache[key] = transformInv(c); - } - return transformInvCache[key]; - }; - - /** - * @type {ol.Extent} - * @private - */ - this.maxSourceExtent_ = maxSourceExtent; - - /** - * @type {number} - * @private - */ - this.errorThresholdSquared_ = errorThreshold * errorThreshold; - - /** - * @type {Array.<ol.reproj.Triangle>} - * @private - */ - this.triangles_ = []; - - /** - * Indicates that the triangulation crosses edge of the source projection. - * @type {boolean} - * @private - */ - this.wrapsXInSource_ = false; - - /** - * @type {boolean} - * @private - */ - this.canWrapXInSource_ = this.sourceProj_.canWrapX() && - !!maxSourceExtent && - !!this.sourceProj_.getExtent() && - (ol.extent.getWidth(maxSourceExtent) == - ol.extent.getWidth(this.sourceProj_.getExtent())); - - /** - * @type {?number} - * @private - */ - this.sourceWorldWidth_ = this.sourceProj_.getExtent() ? - ol.extent.getWidth(this.sourceProj_.getExtent()) : null; - - /** - * @type {?number} - * @private - */ - this.targetWorldWidth_ = this.targetProj_.getExtent() ? - ol.extent.getWidth(this.targetProj_.getExtent()) : null; - - var destinationTopLeft = ol.extent.getTopLeft(targetExtent); - var destinationTopRight = ol.extent.getTopRight(targetExtent); - var destinationBottomRight = ol.extent.getBottomRight(targetExtent); - var destinationBottomLeft = ol.extent.getBottomLeft(targetExtent); - var sourceTopLeft = this.transformInv_(destinationTopLeft); - var sourceTopRight = this.transformInv_(destinationTopRight); - var sourceBottomRight = this.transformInv_(destinationBottomRight); - var sourceBottomLeft = this.transformInv_(destinationBottomLeft); - - this.addQuad_( - destinationTopLeft, destinationTopRight, - destinationBottomRight, destinationBottomLeft, - sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft, - ol.RASTER_REPROJECTION_MAX_SUBDIVISION); - - if (this.wrapsXInSource_) { - // Fix coordinates (ol.proj returns wrapped coordinates, "unwrap" here). - // This significantly simplifies the rest of the reprojection process. - - goog.asserts.assert(this.sourceWorldWidth_ !== null); - var leftBound = Infinity; - this.triangles_.forEach(function(triangle, i, arr) { - leftBound = Math.min(leftBound, - triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]); - }); - - // Shift triangles to be as close to `leftBound` as possible - // (if the distance is more than `worldWidth / 2` it can be closer. - this.triangles_.forEach(function(triangle) { - if (Math.max(triangle.source[0][0], triangle.source[1][0], - triangle.source[2][0]) - leftBound > this.sourceWorldWidth_ / 2) { - var newTriangle = [[triangle.source[0][0], triangle.source[0][1]], - [triangle.source[1][0], triangle.source[1][1]], - [triangle.source[2][0], triangle.source[2][1]]]; - if ((newTriangle[0][0] - leftBound) > this.sourceWorldWidth_ / 2) { - newTriangle[0][0] -= this.sourceWorldWidth_; - } - if ((newTriangle[1][0] - leftBound) > this.sourceWorldWidth_ / 2) { - newTriangle[1][0] -= this.sourceWorldWidth_; - } - if ((newTriangle[2][0] - leftBound) > this.sourceWorldWidth_ / 2) { - newTriangle[2][0] -= this.sourceWorldWidth_; - } - - // Rarely (if the extent contains both the dateline and prime meridian) - // the shift can in turn break some triangles. - // Detect this here and don't shift in such cases. - var minX = Math.min( - newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]); - var maxX = Math.max( - newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]); - if ((maxX - minX) < this.sourceWorldWidth_ / 2) { - triangle.source = newTriangle; - } - } - }, this); - } - - transformInvCache = {}; -}; - - -/** - * Adds triangle to the triangulation. - * @param {ol.Coordinate} a - * @param {ol.Coordinate} b - * @param {ol.Coordinate} c - * @param {ol.Coordinate} aSrc - * @param {ol.Coordinate} bSrc - * @param {ol.Coordinate} cSrc - * @private - */ -ol.reproj.Triangulation.prototype.addTriangle_ = function(a, b, c, - aSrc, bSrc, cSrc) { - this.triangles_.push({ - source: [aSrc, bSrc, cSrc], - target: [a, b, c] - }); -}; - - -/** - * Adds quad (points in clock-wise order) to the triangulation - * (and reprojects the vertices) if valid. - * Performs quad subdivision if needed to increase precision. - * - * @param {ol.Coordinate} a - * @param {ol.Coordinate} b - * @param {ol.Coordinate} c - * @param {ol.Coordinate} d - * @param {ol.Coordinate} aSrc - * @param {ol.Coordinate} bSrc - * @param {ol.Coordinate} cSrc - * @param {ol.Coordinate} dSrc - * @param {number} maxSubdivision Maximal allowed subdivision of the quad. - * @private - */ -ol.reproj.Triangulation.prototype.addQuad_ = function(a, b, c, d, - aSrc, bSrc, cSrc, dSrc, maxSubdivision) { - - var sourceQuadExtent = ol.extent.boundingExtent([aSrc, bSrc, cSrc, dSrc]); - var sourceCoverageX = this.sourceWorldWidth_ ? - ol.extent.getWidth(sourceQuadExtent) / this.sourceWorldWidth_ : null; - - // when the quad is wrapped in the source projection - // it covers most of the projection extent, but not fully - var wrapsX = this.sourceProj_.canWrapX() && - sourceCoverageX > 0.5 && sourceCoverageX < 1; - - var needsSubdivision = false; - - if (maxSubdivision > 0) { - if (this.targetProj_.isGlobal() && this.targetWorldWidth_) { - var targetQuadExtent = ol.extent.boundingExtent([a, b, c, d]); - var targetCoverageX = - ol.extent.getWidth(targetQuadExtent) / this.targetWorldWidth_; - needsSubdivision |= - targetCoverageX > ol.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH; - } - if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) { - needsSubdivision |= - sourceCoverageX > ol.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH; - } - } - - if (!needsSubdivision && this.maxSourceExtent_) { - if (!ol.extent.intersects(sourceQuadExtent, this.maxSourceExtent_)) { - // whole quad outside source projection extent -> ignore - return; - } - } - - if (!needsSubdivision) { - if (!isFinite(aSrc[0]) || !isFinite(aSrc[1]) || - !isFinite(bSrc[0]) || !isFinite(bSrc[1]) || - !isFinite(cSrc[0]) || !isFinite(cSrc[1]) || - !isFinite(dSrc[0]) || !isFinite(dSrc[1])) { - if (maxSubdivision > 0) { - needsSubdivision = true; - } else { - return; - } - } - } - - if (maxSubdivision > 0) { - if (!needsSubdivision) { - var center = [(a[0] + c[0]) / 2, (a[1] + c[1]) / 2]; - var centerSrc = this.transformInv_(center); - - var dx; - if (wrapsX) { - goog.asserts.assert(this.sourceWorldWidth_); - var centerSrcEstimX = - (goog.math.modulo(aSrc[0], this.sourceWorldWidth_) + - goog.math.modulo(cSrc[0], this.sourceWorldWidth_)) / 2; - dx = centerSrcEstimX - - goog.math.modulo(centerSrc[0], this.sourceWorldWidth_); - } else { - dx = (aSrc[0] + cSrc[0]) / 2 - centerSrc[0]; - } - var dy = (aSrc[1] + cSrc[1]) / 2 - centerSrc[1]; - var centerSrcErrorSquared = dx * dx + dy * dy; - needsSubdivision = centerSrcErrorSquared > this.errorThresholdSquared_; - } - if (needsSubdivision) { - if (Math.abs(a[0] - c[0]) <= Math.abs(a[1] - c[1])) { - // split horizontally (top & bottom) - var bc = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2]; - var bcSrc = this.transformInv_(bc); - var da = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2]; - var daSrc = this.transformInv_(da); - - this.addQuad_( - a, b, bc, da, aSrc, bSrc, bcSrc, daSrc, maxSubdivision - 1); - this.addQuad_( - da, bc, c, d, daSrc, bcSrc, cSrc, dSrc, maxSubdivision - 1); - } else { - // split vertically (left & right) - var ab = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2]; - var abSrc = this.transformInv_(ab); - var cd = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2]; - var cdSrc = this.transformInv_(cd); - - this.addQuad_( - a, ab, cd, d, aSrc, abSrc, cdSrc, dSrc, maxSubdivision - 1); - this.addQuad_( - ab, b, c, cd, abSrc, bSrc, cSrc, cdSrc, maxSubdivision - 1); - } - return; - } - } - - if (wrapsX) { - if (!this.canWrapXInSource_) { - return; - } - this.wrapsXInSource_ = true; - } - - this.addTriangle_(a, c, d, aSrc, cSrc, dSrc); - this.addTriangle_(a, b, c, aSrc, bSrc, cSrc); -}; - - -/** - * Calculates extent of the 'source' coordinates from all the triangles. - * - * @return {ol.Extent} Calculated extent. - */ -ol.reproj.Triangulation.prototype.calculateSourceExtent = function() { - var extent = ol.extent.createEmpty(); - - this.triangles_.forEach(function(triangle, i, arr) { - var src = triangle.source; - ol.extent.extendCoordinate(extent, src[0]); - ol.extent.extendCoordinate(extent, src[1]); - ol.extent.extendCoordinate(extent, src[2]); - }); - - return extent; -}; - - -/** - * @return {Array.<ol.reproj.Triangle>} Array of the calculated triangles. - */ -ol.reproj.Triangulation.prototype.getTriangles = function() { - return this.triangles_; -}; - -goog.provide('ol.reproj.Image'); -goog.provide('ol.reproj.ImageFunctionType'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol.ImageBase'); -goog.require('ol.ImageState'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.reproj'); -goog.require('ol.reproj.Triangulation'); - - -/** - * @typedef {function(ol.Extent, number, number) : ol.ImageBase} - */ -ol.reproj.ImageFunctionType; - - - -/** - * @classdesc - * Class encapsulating single reprojected image. - * See {@link ol.source.Image}. - * - * @constructor - * @extends {ol.ImageBase} - * @param {ol.proj.Projection} sourceProj Source projection (of the data). - * @param {ol.proj.Projection} targetProj Target projection. - * @param {ol.Extent} targetExtent Target extent. - * @param {number} targetResolution Target resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.reproj.ImageFunctionType} getImageFunction - * Function returning source images (extent, resolution, pixelRatio). - */ -ol.reproj.Image = function(sourceProj, targetProj, - targetExtent, targetResolution, pixelRatio, getImageFunction) { - - /** - * @private - * @type {ol.proj.Projection} - */ - this.targetProj_ = targetProj; - - /** - * @private - * @type {ol.Extent} - */ - this.maxSourceExtent_ = sourceProj.getExtent(); - var maxTargetExtent = targetProj.getExtent(); - - var limitedTargetExtent = maxTargetExtent ? - ol.extent.getIntersection(targetExtent, maxTargetExtent) : targetExtent; - - var targetCenter = ol.extent.getCenter(limitedTargetExtent); - var sourceResolution = ol.reproj.calculateSourceResolution( - sourceProj, targetProj, targetCenter, targetResolution); - - var errorThresholdInPixels = ol.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD; - - /** - * @private - * @type {!ol.reproj.Triangulation} - */ - this.triangulation_ = new ol.reproj.Triangulation( - sourceProj, targetProj, limitedTargetExtent, this.maxSourceExtent_, - sourceResolution * errorThresholdInPixels); - - /** - * @private - * @type {number} - */ - this.targetResolution_ = targetResolution; - - /** - * @private - * @type {ol.Extent} - */ - this.targetExtent_ = targetExtent; - - var sourceExtent = this.triangulation_.calculateSourceExtent(); - - /** - * @private - * @type {ol.ImageBase} - */ - this.sourceImage_ = - getImageFunction(sourceExtent, sourceResolution, pixelRatio); - - /** - * @private - * @type {number} - */ - this.sourcePixelRatio_ = - this.sourceImage_ ? this.sourceImage_.getPixelRatio() : 1; - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = null; - - /** - * @private - * @type {goog.events.Key} - */ - this.sourceListenerKey_ = null; - - - var state = ol.ImageState.LOADED; - var attributions = []; - - if (this.sourceImage_) { - state = ol.ImageState.IDLE; - attributions = this.sourceImage_.getAttributions(); - } - - goog.base(this, targetExtent, targetResolution, this.sourcePixelRatio_, - state, attributions); -}; -goog.inherits(ol.reproj.Image, ol.ImageBase); - - -/** - * @inheritDoc - */ -ol.reproj.Image.prototype.disposeInternal = function() { - if (this.state == ol.ImageState.LOADING) { - this.unlistenSource_(); - } - goog.base(this, 'disposeInternal'); -}; - - -/** - * @inheritDoc - */ -ol.reproj.Image.prototype.getImage = function(opt_context) { - return this.canvas_; -}; - - -/** - * @return {ol.proj.Projection} Projection. - */ -ol.reproj.Image.prototype.getProjection = function() { - return this.targetProj_; -}; - - -/** - * @private - */ -ol.reproj.Image.prototype.reproject_ = function() { - var sourceState = this.sourceImage_.getState(); - if (sourceState == ol.ImageState.LOADED) { - var width = ol.extent.getWidth(this.targetExtent_) / this.targetResolution_; - var height = - ol.extent.getHeight(this.targetExtent_) / this.targetResolution_; - - this.canvas_ = ol.reproj.render(width, height, this.sourcePixelRatio_, - this.sourceImage_.getResolution(), this.maxSourceExtent_, - this.targetResolution_, this.targetExtent_, this.triangulation_, [{ - extent: this.sourceImage_.getExtent(), - image: this.sourceImage_.getImage() - }]); - } - this.state = sourceState; - this.changed(); -}; - - -/** - * @inheritDoc - */ -ol.reproj.Image.prototype.load = function() { - if (this.state == ol.ImageState.IDLE) { - this.state = ol.ImageState.LOADING; - this.changed(); - - var sourceState = this.sourceImage_.getState(); - if (sourceState == ol.ImageState.LOADED || - sourceState == ol.ImageState.ERROR) { - this.reproject_(); - } else { - this.sourceListenerKey_ = this.sourceImage_.listen( - goog.events.EventType.CHANGE, function(e) { - var sourceState = this.sourceImage_.getState(); - if (sourceState == ol.ImageState.LOADED || - sourceState == ol.ImageState.ERROR) { - this.unlistenSource_(); - this.reproject_(); - } - }, false, this); - this.sourceImage_.load(); - } - } -}; - - -/** - * @private - */ -ol.reproj.Image.prototype.unlistenSource_ = function() { - goog.asserts.assert(this.sourceListenerKey_, - 'this.sourceListenerKey_ should not be null'); - goog.events.unlistenByKey(this.sourceListenerKey_); - this.sourceListenerKey_ = null; -}; - -goog.provide('ol.source.Image'); -goog.provide('ol.source.ImageEvent'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.events.Event'); -goog.require('ol.Attribution'); -goog.require('ol.ImageState'); -goog.require('ol.array'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.reproj.Image'); -goog.require('ol.source.Source'); - - -/** - * @typedef {{attributions: (Array.<ol.Attribution>|undefined), - * extent: (null|ol.Extent|undefined), - * logo: (string|olx.LogoOptions|undefined), - * projection: ol.proj.ProjectionLike, - * resolutions: (Array.<number>|undefined), - * state: (ol.source.State|undefined)}} - */ -ol.source.ImageOptions; - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Base class for sources providing a single image. - * - * @constructor - * @extends {ol.source.Source} - * @param {ol.source.ImageOptions} options Single image source options. - * @api - */ -ol.source.Image = function(options) { - - goog.base(this, { - attributions: options.attributions, - extent: options.extent, - logo: options.logo, - projection: options.projection, - state: options.state - }); - - /** - * @private - * @type {Array.<number>} - */ - this.resolutions_ = options.resolutions !== undefined ? - options.resolutions : null; - goog.asserts.assert(!this.resolutions_ || - goog.array.isSorted(this.resolutions_, - function(a, b) { - return b - a; - }, true), 'resolutions must be null or sorted in descending order'); - - - /** - * @private - * @type {ol.reproj.Image} - */ - this.reprojectedImage_ = null; - - - /** - * @private - * @type {number} - */ - this.reprojectedRevision_ = 0; - -}; -goog.inherits(ol.source.Image, ol.source.Source); - - -/** - * @return {Array.<number>} Resolutions. - */ -ol.source.Image.prototype.getResolutions = function() { - return this.resolutions_; -}; - - -/** - * @protected - * @param {number} resolution Resolution. - * @return {number} Resolution. - */ -ol.source.Image.prototype.findNearestResolution = - function(resolution) { - if (this.resolutions_) { - var idx = ol.array.linearFindNearest(this.resolutions_, resolution, 0); - resolution = this.resolutions_[idx]; - } - return resolution; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {ol.ImageBase} Single image. - */ -ol.source.Image.prototype.getImage = - function(extent, resolution, pixelRatio, projection) { - var sourceProjection = this.getProjection(); - if (!ol.ENABLE_RASTER_REPROJECTION || - !sourceProjection || - !projection || - ol.proj.equivalent(sourceProjection, projection)) { - if (sourceProjection) { - projection = sourceProjection; - } - return this.getImageInternal(extent, resolution, pixelRatio, projection); - } else { - if (this.reprojectedImage_) { - if (this.reprojectedRevision_ == this.getRevision() && - ol.proj.equivalent( - this.reprojectedImage_.getProjection(), projection) && - this.reprojectedImage_.getResolution() == resolution && - this.reprojectedImage_.getPixelRatio() == pixelRatio && - ol.extent.equals(this.reprojectedImage_.getExtent(), extent)) { - return this.reprojectedImage_; - } - this.reprojectedImage_.dispose(); - this.reprojectedImage_ = null; - } - - this.reprojectedImage_ = new ol.reproj.Image( - sourceProjection, projection, extent, resolution, pixelRatio, - goog.bind(function(extent, resolution, pixelRatio) { - return this.getImageInternal(extent, resolution, - pixelRatio, sourceProjection); - }, this)); - this.reprojectedRevision_ = this.getRevision(); - - return this.reprojectedImage_; - } -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {ol.ImageBase} Single image. - * @protected - */ -ol.source.Image.prototype.getImageInternal = goog.abstractMethod; - - -/** - * Handle image change events. - * @param {goog.events.Event} event Event. - * @protected - */ -ol.source.Image.prototype.handleImageChange = function(event) { - var image = /** @type {ol.Image} */ (event.target); - switch (image.getState()) { - case ol.ImageState.LOADING: - this.dispatchEvent( - new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADSTART, - image)); - break; - case ol.ImageState.LOADED: - this.dispatchEvent( - new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADEND, - image)); - break; - case ol.ImageState.ERROR: - this.dispatchEvent( - new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADERROR, - image)); - break; - } -}; - - -/** - * Default image load function for image sources that use ol.Image image - * instances. - * @param {ol.Image} image Image. - * @param {string} src Source. - */ -ol.source.Image.defaultImageLoadFunction = function(image, src) { - image.getImage().src = src; -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.source.Image} instances are instances of this - * type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.source.ImageEvent} - * @param {string} type Type. - * @param {ol.Image} image The image. - */ -ol.source.ImageEvent = function(type, image) { - - goog.base(this, type); - - /** - * The image related to the event. - * @type {ol.Image} - * @api - */ - this.image = image; - -}; -goog.inherits(ol.source.ImageEvent, goog.events.Event); - - -/** - * @enum {string} - */ -ol.source.ImageEventType = { - - /** - * Triggered when an image starts loading. - * @event ol.source.ImageEvent#imageloadstart - * @api - */ - IMAGELOADSTART: 'imageloadstart', - - /** - * Triggered when an image finishes loading. - * @event ol.source.ImageEvent#imageloadend - * @api - */ - IMAGELOADEND: 'imageloadend', - - /** - * Triggered if image loading results in an error. - * @event ol.source.ImageEvent#imageloaderror - * @api - */ - IMAGELOADERROR: 'imageloaderror' - -}; - -goog.provide('ol.source.ImageCanvas'); - -goog.require('ol.CanvasFunctionType'); -goog.require('ol.ImageCanvas'); -goog.require('ol.extent'); -goog.require('ol.source.Image'); - - - -/** - * @classdesc - * Base class for image sources where a canvas element is the image. - * - * @constructor - * @extends {ol.source.Image} - * @param {olx.source.ImageCanvasOptions} options - * @api - */ -ol.source.ImageCanvas = function(options) { - - goog.base(this, { - attributions: options.attributions, - logo: options.logo, - projection: options.projection, - resolutions: options.resolutions, - state: options.state !== undefined ? - /** @type {ol.source.State} */ (options.state) : undefined - }); - - /** - * @private - * @type {ol.CanvasFunctionType} - */ - this.canvasFunction_ = options.canvasFunction; - - /** - * @private - * @type {ol.ImageCanvas} - */ - this.canvas_ = null; - - /** - * @private - * @type {number} - */ - this.renderedRevision_ = 0; - - /** - * @private - * @type {number} - */ - this.ratio_ = options.ratio !== undefined ? - options.ratio : 1.5; - -}; -goog.inherits(ol.source.ImageCanvas, ol.source.Image); - - -/** - * @inheritDoc - */ -ol.source.ImageCanvas.prototype.getImageInternal = - function(extent, resolution, pixelRatio, projection) { - resolution = this.findNearestResolution(resolution); - - var canvas = this.canvas_; - if (canvas && - this.renderedRevision_ == this.getRevision() && - canvas.getResolution() == resolution && - canvas.getPixelRatio() == pixelRatio && - ol.extent.containsExtent(canvas.getExtent(), extent)) { - return canvas; - } - - extent = extent.slice(); - ol.extent.scaleFromCenter(extent, this.ratio_); - var width = ol.extent.getWidth(extent) / resolution; - var height = ol.extent.getHeight(extent) / resolution; - var size = [width * pixelRatio, height * pixelRatio]; - - var canvasElement = this.canvasFunction_( - extent, resolution, pixelRatio, size, projection); - if (canvasElement) { - canvas = new ol.ImageCanvas(extent, resolution, pixelRatio, - this.getAttributions(), canvasElement); - } - this.canvas_ = canvas; - this.renderedRevision_ = this.getRevision(); - - return canvas; -}; - -goog.provide('ol.Feature'); -goog.provide('ol.FeatureStyleFunction'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol'); -goog.require('ol.Object'); -goog.require('ol.geom.Geometry'); -goog.require('ol.style.Style'); - - - -/** - * @classdesc - * A vector object for geographic features with a geometry and other - * attribute properties, similar to the features in vector file formats like - * GeoJSON. - * - * Features can be styled individually with `setStyle`; otherwise they use the - * style of their vector layer. - * - * Note that attribute properties are set as {@link ol.Object} properties on - * the feature object, so they are observable, and have get/set accessors. - * - * Typically, a feature has a single geometry property. You can set the - * geometry using the `setGeometry` method and get it with `getGeometry`. - * It is possible to store more than one geometry on a feature using attribute - * properties. By default, the geometry used for rendering is identified by - * the property name `geometry`. If you want to use another geometry property - * for rendering, use the `setGeometryName` method to change the attribute - * property associated with the geometry for the feature. For example: - * - * ```js - * var feature = new ol.Feature({ - * geometry: new ol.geom.Polygon(polyCoords), - * labelPoint: new ol.geom.Point(labelCoords), - * name: 'My Polygon' - * }); - * - * // get the polygon geometry - * var poly = feature.getGeometry(); - * - * // Render the feature as a point using the coordinates from labelPoint - * feature.setGeometryName('labelPoint'); - * - * // get the point geometry - * var point = feature.getGeometry(); - * ``` - * - * @constructor - * @extends {ol.Object} - * @param {ol.geom.Geometry|Object.<string, *>=} opt_geometryOrProperties - * You may pass a Geometry object directly, or an object literal - * containing properties. If you pass an object literal, you may - * include a Geometry associated with a `geometry` key. - * @api stable - */ -ol.Feature = function(opt_geometryOrProperties) { - - goog.base(this); - - /** - * @private - * @type {number|string|undefined} - */ - this.id_ = undefined; - - /** - * @type {string} - * @private - */ - this.geometryName_ = 'geometry'; - - /** - * User provided style. - * @private - * @type {ol.style.Style|Array.<ol.style.Style>| - * ol.FeatureStyleFunction} - */ - this.style_ = null; - - /** - * @private - * @type {ol.FeatureStyleFunction|undefined} - */ - this.styleFunction_ = undefined; - - /** - * @private - * @type {goog.events.Key} - */ - this.geometryChangeKey_ = null; - - goog.events.listen( - this, ol.Object.getChangeEventType(this.geometryName_), - this.handleGeometryChanged_, false, this); - - if (opt_geometryOrProperties !== undefined) { - if (opt_geometryOrProperties instanceof ol.geom.Geometry || - !opt_geometryOrProperties) { - var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrProperties); - this.setGeometry(geometry); - } else { - goog.asserts.assert(goog.isObject(opt_geometryOrProperties), - 'opt_geometryOrProperties should be an Object'); - var properties = /** @type {Object.<string, *>} */ - (opt_geometryOrProperties); - this.setProperties(properties); - } - } -}; -goog.inherits(ol.Feature, ol.Object); - - -/** - * Clone this feature. If the original feature has a geometry it - * is also cloned. The feature id is not set in the clone. - * @return {ol.Feature} The clone. - * @api stable - */ -ol.Feature.prototype.clone = function() { - var clone = new ol.Feature(this.getProperties()); - clone.setGeometryName(this.getGeometryName()); - var geometry = this.getGeometry(); - if (geometry) { - clone.setGeometry(geometry.clone()); - } - var style = this.getStyle(); - if (style) { - clone.setStyle(style); - } - return clone; -}; - - -/** - * Get the feature's default geometry. A feature may have any number of named - * geometries. The "default" geometry (the one that is rendered by default) is - * set when calling {@link ol.Feature#setGeometry}. - * @return {ol.geom.Geometry|undefined} The default geometry for the feature. - * @api stable - * @observable - */ -ol.Feature.prototype.getGeometry = function() { - return /** @type {ol.geom.Geometry|undefined} */ ( - this.get(this.geometryName_)); -}; - - -/** - * Get the feature identifier. This is a stable identifier for the feature and - * is either set when reading data from a remote source or set explicitly by - * calling {@link ol.Feature#setId}. - * @return {number|string|undefined} Id. - * @api stable - * @observable - */ -ol.Feature.prototype.getId = function() { - return this.id_; -}; - - -/** - * Get the name of the feature's default geometry. By default, the default - * geometry is named `geometry`. - * @return {string} Get the property name associated with the default geometry - * for this feature. - * @api stable - */ -ol.Feature.prototype.getGeometryName = function() { - return this.geometryName_; -}; - - -/** - * Get the feature's style. This return for this method depends on what was - * provided to the {@link ol.Feature#setStyle} method. - * @return {ol.style.Style|Array.<ol.style.Style>| - * ol.FeatureStyleFunction} The feature style. - * @api stable - * @observable - */ -ol.Feature.prototype.getStyle = function() { - return this.style_; -}; - - -/** - * Get the feature's style function. - * @return {ol.FeatureStyleFunction|undefined} Return a function - * representing the current style of this feature. - * @api stable - */ -ol.Feature.prototype.getStyleFunction = function() { - return this.styleFunction_; -}; - - -/** - * @private - */ -ol.Feature.prototype.handleGeometryChange_ = function() { - this.changed(); -}; - - -/** - * @private - */ -ol.Feature.prototype.handleGeometryChanged_ = function() { - if (this.geometryChangeKey_) { - goog.events.unlistenByKey(this.geometryChangeKey_); - this.geometryChangeKey_ = null; - } - var geometry = this.getGeometry(); - if (geometry) { - this.geometryChangeKey_ = goog.events.listen(geometry, - goog.events.EventType.CHANGE, this.handleGeometryChange_, false, this); - } - this.changed(); -}; - - -/** - * Set the default geometry for the feature. This will update the property - * with the name returned by {@link ol.Feature#getGeometryName}. - * @param {ol.geom.Geometry|undefined} geometry The new geometry. - * @api stable - * @observable - */ -ol.Feature.prototype.setGeometry = function(geometry) { - this.set(this.geometryName_, geometry); -}; - - -/** - * Set the style for the feature. This can be a single style object, an array - * of styles, or a function that takes a resolution and returns an array of - * styles. If it is `null` the feature has no style (a `null` style). - * @param {ol.style.Style|Array.<ol.style.Style>| - * ol.FeatureStyleFunction} style Style for this feature. - * @api stable - * @observable - */ -ol.Feature.prototype.setStyle = function(style) { - this.style_ = style; - this.styleFunction_ = !style ? - undefined : ol.Feature.createStyleFunction(style); - this.changed(); -}; - - -/** - * Set the feature id. The feature id is considered stable and may be used when - * requesting features or comparing identifiers returned from a remote source. - * The feature id can be used with the {@link ol.source.Vector#getFeatureById} - * method. - * @param {number|string|undefined} id The feature id. - * @api stable - * @observable - */ -ol.Feature.prototype.setId = function(id) { - this.id_ = id; - this.changed(); -}; - - -/** - * Set the property name to be used when getting the feature's default geometry. - * When calling {@link ol.Feature#getGeometry}, the value of the property with - * this name will be returned. - * @param {string} name The property name of the default geometry. - * @api stable - */ -ol.Feature.prototype.setGeometryName = function(name) { - goog.events.unlisten( - this, ol.Object.getChangeEventType(this.geometryName_), - this.handleGeometryChanged_, false, this); - this.geometryName_ = name; - goog.events.listen( - this, ol.Object.getChangeEventType(this.geometryName_), - this.handleGeometryChanged_, false, this); - this.handleGeometryChanged_(); -}; - - -/** - * A function that returns an array of {@link ol.style.Style styles} given a - * resolution. The `this` keyword inside the function references the - * {@link ol.Feature} to be styled. - * - * @typedef {function(this: ol.Feature, number): Array.<ol.style.Style>} - * @api stable - */ -ol.FeatureStyleFunction; - - -/** - * Convert the provided object into a feature style function. Functions passed - * through unchanged. Arrays of ol.style.Style or single style objects wrapped - * in a new feature style function. - * @param {ol.FeatureStyleFunction|!Array.<ol.style.Style>|!ol.style.Style} obj - * A feature style function, a single style, or an array of styles. - * @return {ol.FeatureStyleFunction} A style function. - */ -ol.Feature.createStyleFunction = function(obj) { - var styleFunction; - - if (goog.isFunction(obj)) { - styleFunction = obj; - } else { - /** - * @type {Array.<ol.style.Style>} - */ - var styles; - if (goog.isArray(obj)) { - styles = obj; - } else { - goog.asserts.assertInstanceof(obj, ol.style.Style, - 'obj should be an ol.style.Style'); - styles = [obj]; - } - styleFunction = function() { - return styles; - }; - } - return styleFunction; -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Common events for the network classes. - */ - - -goog.provide('goog.net.EventType'); - - -/** - * Event names for network events - * @enum {string} - */ -goog.net.EventType = { - COMPLETE: 'complete', - SUCCESS: 'success', - ERROR: 'error', - ABORT: 'abort', - READY: 'ready', - READY_STATE_CHANGE: 'readystatechange', - TIMEOUT: 'timeout', - INCREMENTAL_DATA: 'incrementaldata', - PROGRESS: 'progress' -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.Thenable'); - - - -/** - * Provides a more strict interface for Thenables in terms of - * http://promisesaplus.com for interop with {@see goog.Promise}. - * - * @interface - * @extends {IThenable<TYPE>} - * @template TYPE - */ -goog.Thenable = function() {}; - - -/** - * Adds callbacks that will operate on the result of the Thenable, returning a - * new child Promise. - * - * If the Thenable is fulfilled, the {@code onFulfilled} callback will be - * invoked with the fulfillment value as argument, and the child Promise will - * be fulfilled with the return value of the callback. If the callback throws - * an exception, the child Promise will be rejected with the thrown value - * instead. - * - * If the Thenable is rejected, the {@code onRejected} callback will be invoked - * with the rejection reason as argument, and the child Promise will be rejected - * with the return value of the callback or thrown value. - * - * @param {?(function(this:THIS, TYPE): VALUE)=} opt_onFulfilled A - * function that will be invoked with the fulfillment value if the Promise - * is fullfilled. - * @param {?(function(this:THIS, *): *)=} opt_onRejected A function that will - * be invoked with the rejection reason if the Promise is rejected. - * @param {THIS=} opt_context An optional context object that will be the - * execution context for the callbacks. By default, functions are executed - * with the default this. - * - * @return {RESULT} A new Promise that will receive the result - * of the fulfillment or rejection callback. - * @template VALUE - * @template THIS - * - * When a Promise (or thenable) is returned from the fulfilled callback, - * the result is the payload of that promise, not the promise itself. - * - * @template RESULT := type('goog.Promise', - * cond(isUnknown(VALUE), unknown(), - * mapunion(VALUE, (V) => - * cond(isTemplatized(V) && sub(rawTypeOf(V), 'IThenable'), - * templateTypeOf(V, 0), - * cond(sub(V, 'Thenable'), - * unknown(), - * V))))) - * =: - * - */ -goog.Thenable.prototype.then = function(opt_onFulfilled, opt_onRejected, - opt_context) {}; - - -/** - * An expando property to indicate that an object implements - * {@code goog.Thenable}. - * - * {@see addImplementation}. - * - * @const - */ -goog.Thenable.IMPLEMENTED_BY_PROP = '$goog_Thenable'; - - -/** - * Marks a given class (constructor) as an implementation of Thenable, so - * that we can query that fact at runtime. The class must have already - * implemented the interface. - * Exports a 'then' method on the constructor prototype, so that the objects - * also implement the extern {@see goog.Thenable} interface for interop with - * other Promise implementations. - * @param {function(new:goog.Thenable,...?)} ctor The class constructor. The - * corresponding class must have already implemented the interface. - */ -goog.Thenable.addImplementation = function(ctor) { - goog.exportProperty(ctor.prototype, 'then', ctor.prototype.then); - if (COMPILED) { - ctor.prototype[goog.Thenable.IMPLEMENTED_BY_PROP] = true; - } else { - // Avoids dictionary access in uncompiled mode. - ctor.prototype.$goog_Thenable = true; - } -}; - - -/** - * @param {*} object - * @return {boolean} Whether a given instance implements {@code goog.Thenable}. - * The class/superclass of the instance must call {@code addImplementation}. - */ -goog.Thenable.isImplementedBy = function(object) { - if (!object) { - return false; - } - try { - if (COMPILED) { - return !!object[goog.Thenable.IMPLEMENTED_BY_PROP]; - } - return !!object.$goog_Thenable; - } catch (e) { - // Property access seems to be forbidden. - return false; - } -}; - -// Copyright 2015 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Simple freelist. - * - * An anterative to goog.structs.SimplePool, it imposes the requirement that the - * objects in the list contain a "next" property that can be used to maintain - * the pool. - */ - -goog.provide('goog.async.FreeList'); - - -/** - * @template ITEM - */ -goog.async.FreeList = goog.defineClass(null, { - /** - * @param {function():ITEM} create - * @param {function(ITEM):void} reset - * @param {number} limit - */ - constructor: function(create, reset, limit) { - /** @const {number} */ - this.limit_ = limit; - /** @const {function()} */ - this.create_ = create; - /** @const {function(ITEM):void} */ - this.reset_ = reset; - - /** @type {number} */ - this.occupants_ = 0; - /** @type {ITEM} */ - this.head_ = null; - }, - - /** - * @return {ITEM} - */ - get: function() { - var item; - if (this.occupants_ > 0) { - this.occupants_--; - item = this.head_; - this.head_ = item.next; - item.next = null; - } else { - item = this.create_(); - } - return item; - }, - - /** - * @param {ITEM} item An item available for possible future reuse. - */ - put: function(item) { - this.reset_(item); - if (this.occupants_ < this.limit_) { - this.occupants_++; - item.next = this.head_; - this.head_ = item; - } - }, - - /** - * Visible for testing. - * @package - * @return {number} - */ - occupants: function() { - return this.occupants_; - } -}); - - - - -// Copyright 2015 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.async.WorkItem'); -goog.provide('goog.async.WorkQueue'); - -goog.require('goog.asserts'); -goog.require('goog.async.FreeList'); - - -// TODO(johnlenz): generalize the WorkQueue if this is used by more -// than goog.async.run. - - - -/** - * A low GC workqueue. The key elements of this design: - * - avoids the need for goog.bind or equivalent by carrying scope - * - avoids the need for array reallocation by using a linked list - * - minimizes work entry objects allocation by recycling objects - * @constructor - * @final - * @struct - */ -goog.async.WorkQueue = function() { - this.workHead_ = null; - this.workTail_ = null; -}; - - -/** @define {number} The maximum number of entries to keep for recycling. */ -goog.define('goog.async.WorkQueue.DEFAULT_MAX_UNUSED', 100); - - -/** @const @private {goog.async.FreeList<goog.async.WorkItem>} */ -goog.async.WorkQueue.freelist_ = new goog.async.FreeList( - function() {return new goog.async.WorkItem(); }, - function(item) {item.reset()}, - goog.async.WorkQueue.DEFAULT_MAX_UNUSED); - - -/** - * @param {function()} fn - * @param {Object|null|undefined} scope - */ -goog.async.WorkQueue.prototype.add = function(fn, scope) { - var item = this.getUnusedItem_(); - item.set(fn, scope); - - if (this.workTail_) { - this.workTail_.next = item; - this.workTail_ = item; - } else { - goog.asserts.assert(!this.workHead_); - this.workHead_ = item; - this.workTail_ = item; - } -}; - - -/** - * @return {goog.async.WorkItem} - */ -goog.async.WorkQueue.prototype.remove = function() { - var item = null; - - if (this.workHead_) { - item = this.workHead_; - this.workHead_ = this.workHead_.next; - if (!this.workHead_) { - this.workTail_ = null; - } - item.next = null; - } - return item; -}; - - -/** - * @param {goog.async.WorkItem} item - */ -goog.async.WorkQueue.prototype.returnUnused = function(item) { - goog.async.WorkQueue.freelist_.put(item); -}; - - -/** - * @return {goog.async.WorkItem} - * @private - */ -goog.async.WorkQueue.prototype.getUnusedItem_ = function() { - return goog.async.WorkQueue.freelist_.get(); -}; - - - -/** - * @constructor - * @final - * @struct - */ -goog.async.WorkItem = function() { - /** @type {?function()} */ - this.fn = null; - /** @type {Object|null|undefined} */ - this.scope = null; - /** @type {?goog.async.WorkItem} */ - this.next = null; -}; - - -/** - * @param {function()} fn - * @param {Object|null|undefined} scope - */ -goog.async.WorkItem.prototype.set = function(fn, scope) { - this.fn = fn; - this.scope = scope; - this.next = null; -}; - - -/** Reset the work item so they don't prevent GC before reuse */ -goog.async.WorkItem.prototype.reset = function() { - this.fn = null; - this.scope = null; - this.next = null; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Simple notifiers for the Closure testing framework. - * - * @author johnlenz@google.com (John Lenz) - */ - -goog.provide('goog.testing.watchers'); - - -/** @private {!Array<function()>} */ -goog.testing.watchers.resetWatchers_ = []; - - -/** - * Fires clock reset watching functions. - */ -goog.testing.watchers.signalClockReset = function() { - var watchers = goog.testing.watchers.resetWatchers_; - for (var i = 0; i < watchers.length; i++) { - goog.testing.watchers.resetWatchers_[i](); - } -}; - - -/** - * Enqueues a function to be called when the clock used for setTimeout is reset. - * @param {function()} fn - */ -goog.testing.watchers.watchClockReset = function(fn) { - goog.testing.watchers.resetWatchers_.push(fn); -}; - - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.async.run'); - -goog.require('goog.async.WorkQueue'); -goog.require('goog.async.nextTick'); -goog.require('goog.async.throwException'); -goog.require('goog.testing.watchers'); - - -/** - * Fires the provided callback just before the current callstack unwinds, or as - * soon as possible after the current JS execution context. - * @param {function(this:THIS)} callback - * @param {THIS=} opt_context Object to use as the "this value" when calling - * the provided function. - * @template THIS - */ -goog.async.run = function(callback, opt_context) { - if (!goog.async.run.schedule_) { - goog.async.run.initializeRunner_(); - } - if (!goog.async.run.workQueueScheduled_) { - // Nothing is currently scheduled, schedule it now. - goog.async.run.schedule_(); - goog.async.run.workQueueScheduled_ = true; - } - - goog.async.run.workQueue_.add(callback, opt_context); -}; - - -/** - * Initializes the function to use to process the work queue. - * @private - */ -goog.async.run.initializeRunner_ = function() { - // If native Promises are available in the browser, just schedule the callback - // on a fulfilled promise, which is specified to be async, but as fast as - // possible. - if (goog.global.Promise && goog.global.Promise.resolve) { - var promise = goog.global.Promise.resolve(undefined); - goog.async.run.schedule_ = function() { - promise.then(goog.async.run.processWorkQueue); - }; - } else { - goog.async.run.schedule_ = function() { - goog.async.nextTick(goog.async.run.processWorkQueue); - }; - } -}; - - -/** - * Forces goog.async.run to use nextTick instead of Promise. - * - * This should only be done in unit tests. It's useful because MockClock - * replaces nextTick, but not the browser Promise implementation, so it allows - * Promise-based code to be tested with MockClock. - * - * However, we also want to run promises if the MockClock is no longer in - * control so we schedule a backup "setTimeout" to the unmocked timeout if - * provided. - * - * @param {function(function())=} opt_realSetTimeout - */ -goog.async.run.forceNextTick = function(opt_realSetTimeout) { - goog.async.run.schedule_ = function() { - goog.async.nextTick(goog.async.run.processWorkQueue); - if (opt_realSetTimeout) { - opt_realSetTimeout(goog.async.run.processWorkQueue); - } - }; -}; - - -/** - * The function used to schedule work asynchronousely. - * @private {function()} - */ -goog.async.run.schedule_; - - -/** @private {boolean} */ -goog.async.run.workQueueScheduled_ = false; - - -/** @private {!goog.async.WorkQueue} */ -goog.async.run.workQueue_ = new goog.async.WorkQueue(); - - -if (goog.DEBUG) { - /** - * Reset the work queue. - * @private - */ - goog.async.run.resetQueue_ = function() { - goog.async.run.workQueueScheduled_ = false; - goog.async.run.workQueue_ = new goog.async.WorkQueue(); - }; - - // If there is a clock implemenation in use for testing - // and it is reset, reset the queue. - goog.testing.watchers.watchClockReset(goog.async.run.resetQueue_); -} - - -/** - * Run any pending goog.async.run work items. This function is not intended - * for general use, but for use by entry point handlers to run items ahead of - * goog.async.nextTick. - */ -goog.async.run.processWorkQueue = function() { - // NOTE: additional work queue items may be added while processing. - var item = null; - while (item = goog.async.run.workQueue_.remove()) { - try { - item.fn.call(item.scope); - } catch (e) { - goog.async.throwException(e); - } - goog.async.run.workQueue_.returnUnused(item); - } - - // There are no more work items, allow processing to be scheduled again. - goog.async.run.workQueueScheduled_ = false; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.promise.Resolver'); - - - -/** - * Resolver interface for promises. The resolver is a convenience interface that - * bundles the promise and its associated resolve and reject functions together, - * for cases where the resolver needs to be persisted internally. - * - * @interface - * @template TYPE - */ -goog.promise.Resolver = function() {}; - - -/** - * The promise that created this resolver. - * @type {!goog.Promise<TYPE>} - */ -goog.promise.Resolver.prototype.promise; - - -/** - * Resolves this resolver with the specified value. - * @type {function((TYPE|goog.Promise<TYPE>|Thenable)=)} - */ -goog.promise.Resolver.prototype.resolve; - - -/** - * Rejects this resolver with the specified reason. - * @type {function(*=): void} - */ -goog.promise.Resolver.prototype.reject; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.Promise'); - -goog.require('goog.Thenable'); -goog.require('goog.asserts'); -goog.require('goog.async.FreeList'); -goog.require('goog.async.run'); -goog.require('goog.async.throwException'); -goog.require('goog.debug.Error'); -goog.require('goog.promise.Resolver'); - - - -/** - * Promises provide a result that may be resolved asynchronously. A Promise may - * be resolved by being fulfilled with a fulfillment value, rejected with a - * rejection reason, or blocked by another Promise. A Promise is said to be - * settled if it is either fulfilled or rejected. Once settled, the Promise - * result is immutable. - * - * Promises may represent results of any type, including undefined. Rejection - * reasons are typically Errors, but may also be of any type. Closure Promises - * allow for optional type annotations that enforce that fulfillment values are - * of the appropriate types at compile time. - * - * The result of a Promise is accessible by calling {@code then} and registering - * {@code onFulfilled} and {@code onRejected} callbacks. Once the Promise - * is settled, the relevant callbacks are invoked with the fulfillment value or - * rejection reason as argument. Callbacks are always invoked in the order they - * were registered, even when additional {@code then} calls are made from inside - * another callback. A callback is always run asynchronously sometime after the - * scope containing the registering {@code then} invocation has returned. - * - * If a Promise is resolved with another Promise, the first Promise will block - * until the second is settled, and then assumes the same result as the second - * Promise. This allows Promises to depend on the results of other Promises, - * linking together multiple asynchronous operations. - * - * This implementation is compatible with the Promises/A+ specification and - * passes that specification's conformance test suite. A Closure Promise may be - * resolved with a Promise instance (or sufficiently compatible Promise-like - * object) created by other Promise implementations. From the specification, - * Promise-like objects are known as "Thenables". - * - * @see http://promisesaplus.com/ - * - * @param {function( - * this:RESOLVER_CONTEXT, - * function((TYPE|IThenable<TYPE>|Thenable)=), - * function(*=)): void} resolver - * Initialization function that is invoked immediately with {@code resolve} - * and {@code reject} functions as arguments. The Promise is resolved or - * rejected with the first argument passed to either function. - * @param {RESOLVER_CONTEXT=} opt_context An optional context for executing the - * resolver function. If unspecified, the resolver function will be executed - * in the default scope. - * @constructor - * @struct - * @final - * @implements {goog.Thenable<TYPE>} - * @template TYPE,RESOLVER_CONTEXT - */ -goog.Promise = function(resolver, opt_context) { - /** - * The internal state of this Promise. Either PENDING, FULFILLED, REJECTED, or - * BLOCKED. - * @private {goog.Promise.State_} - */ - this.state_ = goog.Promise.State_.PENDING; - - /** - * The settled result of the Promise. Immutable once set with either a - * fulfillment value or rejection reason. - * @private {*} - */ - this.result_ = undefined; - - /** - * For Promises created by calling {@code then()}, the originating parent. - * @private {goog.Promise} - */ - this.parent_ = null; - - /** - * The linked list of {@code onFulfilled} and {@code onRejected} callbacks - * added to this Promise by calls to {@code then()}. - * @private {?goog.Promise.CallbackEntry_} - */ - this.callbackEntries_ = null; - - /** - * The tail of the linked list of {@code onFulfilled} and {@code onRejected} - * callbacks added to this Promise by calls to {@code then()}. - * @private {?goog.Promise.CallbackEntry_} - */ - this.callbackEntriesTail_ = null; - - /** - * Whether the Promise is in the queue of Promises to execute. - * @private {boolean} - */ - this.executing_ = false; - - if (goog.Promise.UNHANDLED_REJECTION_DELAY > 0) { - /** - * A timeout ID used when the {@code UNHANDLED_REJECTION_DELAY} is greater - * than 0 milliseconds. The ID is set when the Promise is rejected, and - * cleared only if an {@code onRejected} callback is invoked for the - * Promise (or one of its descendants) before the delay is exceeded. - * - * If the rejection is not handled before the timeout completes, the - * rejection reason is passed to the unhandled rejection handler. - * @private {number} - */ - this.unhandledRejectionId_ = 0; - } else if (goog.Promise.UNHANDLED_REJECTION_DELAY == 0) { - /** - * When the {@code UNHANDLED_REJECTION_DELAY} is set to 0 milliseconds, a - * boolean that is set if the Promise is rejected, and reset to false if an - * {@code onRejected} callback is invoked for the Promise (or one of its - * descendants). If the rejection is not handled before the next timestep, - * the rejection reason is passed to the unhandled rejection handler. - * @private {boolean} - */ - this.hadUnhandledRejection_ = false; - } - - if (goog.Promise.LONG_STACK_TRACES) { - /** - * A list of stack trace frames pointing to the locations where this Promise - * was created or had callbacks added to it. Saved to add additional context - * to stack traces when an exception is thrown. - * @private {!Array<string>} - */ - this.stack_ = []; - this.addStackTrace_(new Error('created')); - - /** - * Index of the most recently executed stack frame entry. - * @private {number} - */ - this.currentStep_ = 0; - } - - // As an optimization, we can skip this if resolver is goog.nullFunction. - // This value is passed internally when creating a promise which will be - // resolved through a more optimized path. - if (resolver != goog.nullFunction) { - try { - var self = this; - resolver.call( - opt_context, - function(value) { - self.resolve_(goog.Promise.State_.FULFILLED, value); - }, - function(reason) { - if (goog.DEBUG && - !(reason instanceof goog.Promise.CancellationError)) { - try { - // Promise was rejected. Step up one call frame to see why. - if (reason instanceof Error) { - throw reason; - } else { - throw new Error('Promise rejected.'); - } - } catch (e) { - // Only thrown so browser dev tools can catch rejections of - // promises when the option to break on caught exceptions is - // activated. - } - } - self.resolve_(goog.Promise.State_.REJECTED, reason); - }); - } catch (e) { - this.resolve_(goog.Promise.State_.REJECTED, e); - } - } -}; - - -/** - * @define {boolean} Whether traces of {@code then} calls should be included in - * exceptions thrown - */ -goog.define('goog.Promise.LONG_STACK_TRACES', false); - - -/** - * @define {number} The delay in milliseconds before a rejected Promise's reason - * is passed to the rejection handler. By default, the rejection handler - * rethrows the rejection reason so that it appears in the developer console or - * {@code window.onerror} handler. - * - * Rejections are rethrown as quickly as possible by default. A negative value - * disables rejection handling entirely. - */ -goog.define('goog.Promise.UNHANDLED_REJECTION_DELAY', 0); - - -/** - * The possible internal states for a Promise. These states are not directly - * observable to external callers. - * @enum {number} - * @private - */ -goog.Promise.State_ = { - /** The Promise is waiting for resolution. */ - PENDING: 0, - - /** The Promise is blocked waiting for the result of another Thenable. */ - BLOCKED: 1, - - /** The Promise has been resolved with a fulfillment value. */ - FULFILLED: 2, - - /** The Promise has been resolved with a rejection reason. */ - REJECTED: 3 -}; - - - -/** - * Entries in the callback chain. Each call to {@code then}, - * {@code thenCatch}, or {@code thenAlways} creates an entry containing the - * functions that may be invoked once the Promise is settled. - * - * @private @final @struct @constructor - */ -goog.Promise.CallbackEntry_ = function() { - /** @type {?goog.Promise} */ - this.child = null; - /** @type {Function} */ - this.onFulfilled = null; - /** @type {Function} */ - this.onRejected = null; - /** @type {?} */ - this.context = null; - /** @type {?goog.Promise.CallbackEntry_} */ - this.next = null; - - /** - * A boolean value to indicate this is a "thenAlways" callback entry. - * Unlike a normal "then/thenVoid" a "thenAlways doesn't participate - * in "cancel" considerations but is simply an observer and requires - * special handling. - * @type {boolean} - */ - this.always = false; -}; - - -/** clear the object prior to reuse */ -goog.Promise.CallbackEntry_.prototype.reset = function() { - this.child = null; - this.onFulfilled = null; - this.onRejected = null; - this.context = null; - this.always = false; -}; - - -/** - * @define {number} The number of currently unused objects to keep around for - * reuse. - */ -goog.define('goog.Promise.DEFAULT_MAX_UNUSED', 100); - - -/** @const @private {goog.async.FreeList<!goog.Promise.CallbackEntry_>} */ -goog.Promise.freelist_ = new goog.async.FreeList( - function() { - return new goog.Promise.CallbackEntry_(); - }, - function(item) { - item.reset(); - }, - goog.Promise.DEFAULT_MAX_UNUSED); - - -/** - * @param {Function} onFulfilled - * @param {Function} onRejected - * @param {?} context - * @return {!goog.Promise.CallbackEntry_} - * @private - */ -goog.Promise.getCallbackEntry_ = function(onFulfilled, onRejected, context) { - var entry = goog.Promise.freelist_.get(); - entry.onFulfilled = onFulfilled; - entry.onRejected = onRejected; - entry.context = context; - return entry; -}; - - -/** - * @param {!goog.Promise.CallbackEntry_} entry - * @private - */ -goog.Promise.returnEntry_ = function(entry) { - goog.Promise.freelist_.put(entry); -}; - - -// NOTE: this is the same template expression as is used for -// goog.IThenable.prototype.then - - -/** - * @param {VALUE=} opt_value - * @return {RESULT} A new Promise that is immediately resolved - * with the given value. If the input value is already a goog.Promise, it - * will be returned immediately without creating a new instance. - * @template VALUE - * @template RESULT := type('goog.Promise', - * cond(isUnknown(VALUE), unknown(), - * mapunion(VALUE, (V) => - * cond(isTemplatized(V) && sub(rawTypeOf(V), 'IThenable'), - * templateTypeOf(V, 0), - * cond(sub(V, 'Thenable'), - * unknown(), - * V))))) - * =: - */ -goog.Promise.resolve = function(opt_value) { - if (opt_value instanceof goog.Promise) { - // Avoid creating a new object if we already have a promise object - // of the correct type. - return opt_value; - } - - // Passing goog.nullFunction will cause the constructor to take an optimized - // path that skips calling the resolver function. - var promise = new goog.Promise(goog.nullFunction); - promise.resolve_(goog.Promise.State_.FULFILLED, opt_value); - return promise; -}; - - -/** - * @param {*=} opt_reason - * @return {!goog.Promise} A new Promise that is immediately rejected with the - * given reason. - */ -goog.Promise.reject = function(opt_reason) { - return new goog.Promise(function(resolve, reject) { - reject(opt_reason); - }); -}; - - -/** - * This is identical to - * {@code goog.Promise.resolve(value).then(onFulfilled, onRejected)}, but it - * avoids creating an unnecessary wrapper Promise when {@code value} is already - * thenable. - * - * @param {?(goog.Thenable<TYPE>|Thenable|TYPE)} value - * @param {function(TYPE): ?} onFulfilled - * @param {function(*): *} onRejected - * @template TYPE - * @private - */ -goog.Promise.resolveThen_ = function(value, onFulfilled, onRejected) { - var isThenable = goog.Promise.maybeThen_( - value, onFulfilled, onRejected, null); - if (!isThenable) { - goog.async.run(goog.partial(onFulfilled, value)); - } -}; - - -/** - * @param {!Array<?(goog.Promise<TYPE>|goog.Thenable<TYPE>|Thenable|*)>} - * promises - * @return {!goog.Promise<TYPE>} A Promise that receives the result of the - * first Promise (or Promise-like) input to settle immediately after it - * settles. - * @template TYPE - */ -goog.Promise.race = function(promises) { - return new goog.Promise(function(resolve, reject) { - if (!promises.length) { - resolve(undefined); - } - for (var i = 0, promise; i < promises.length; i++) { - promise = promises[i]; - goog.Promise.resolveThen_(promise, resolve, reject); - } - }); -}; - - -/** - * @param {!Array<?(goog.Promise<TYPE>|goog.Thenable<TYPE>|Thenable|*)>} - * promises - * @return {!goog.Promise<!Array<TYPE>>} A Promise that receives a list of - * every fulfilled value once every input Promise (or Promise-like) is - * successfully fulfilled, or is rejected with the first rejection reason - * immediately after it is rejected. - * @template TYPE - */ -goog.Promise.all = function(promises) { - return new goog.Promise(function(resolve, reject) { - var toFulfill = promises.length; - var values = []; - - if (!toFulfill) { - resolve(values); - return; - } - - var onFulfill = function(index, value) { - toFulfill--; - values[index] = value; - if (toFulfill == 0) { - resolve(values); - } - }; - - var onReject = function(reason) { - reject(reason); - }; - - for (var i = 0, promise; i < promises.length; i++) { - promise = promises[i]; - goog.Promise.resolveThen_( - promise, goog.partial(onFulfill, i), onReject); - } - }); -}; - - -/** - * @param {!Array<?(goog.Promise<TYPE>|goog.Thenable<TYPE>|Thenable|*)>} - * promises - * @return {!goog.Promise<!Array<{ - * fulfilled: boolean, - * value: (TYPE|undefined), - * reason: (*|undefined)}>>} A Promise that resolves with a list of - * result objects once all input Promises (or Promise-like) have - * settled. Each result object contains a 'fulfilled' boolean indicating - * whether an input Promise was fulfilled or rejected. For fulfilled - * Promises, the resulting value is stored in the 'value' field. For - * rejected Promises, the rejection reason is stored in the 'reason' - * field. - * @template TYPE - */ -goog.Promise.allSettled = function(promises) { - return new goog.Promise(function(resolve, reject) { - var toSettle = promises.length; - var results = []; - - if (!toSettle) { - resolve(results); - return; - } - - var onSettled = function(index, fulfilled, result) { - toSettle--; - results[index] = fulfilled ? - {fulfilled: true, value: result} : - {fulfilled: false, reason: result}; - if (toSettle == 0) { - resolve(results); - } - }; - - for (var i = 0, promise; i < promises.length; i++) { - promise = promises[i]; - goog.Promise.resolveThen_(promise, - goog.partial(onSettled, i, true /* fulfilled */), - goog.partial(onSettled, i, false /* fulfilled */)); - } - }); -}; - - -/** - * @param {!Array<?(goog.Promise<TYPE>|goog.Thenable<TYPE>|Thenable|*)>} - * promises - * @return {!goog.Promise<TYPE>} A Promise that receives the value of the first - * input to be fulfilled, or is rejected with a list of every rejection - * reason if all inputs are rejected. - * @template TYPE - */ -goog.Promise.firstFulfilled = function(promises) { - return new goog.Promise(function(resolve, reject) { - var toReject = promises.length; - var reasons = []; - - if (!toReject) { - resolve(undefined); - return; - } - - var onFulfill = function(value) { - resolve(value); - }; - - var onReject = function(index, reason) { - toReject--; - reasons[index] = reason; - if (toReject == 0) { - reject(reasons); - } - }; - - for (var i = 0, promise; i < promises.length; i++) { - promise = promises[i]; - goog.Promise.resolveThen_( - promise, onFulfill, goog.partial(onReject, i)); - } - }); -}; - - -/** - * @return {!goog.promise.Resolver<TYPE>} Resolver wrapping the promise and its - * resolve / reject functions. Resolving or rejecting the resolver - * resolves or rejects the promise. - * @template TYPE - */ -goog.Promise.withResolver = function() { - var resolve, reject; - var promise = new goog.Promise(function(rs, rj) { - resolve = rs; - reject = rj; - }); - return new goog.Promise.Resolver_(promise, resolve, reject); -}; - - -/** - * Adds callbacks that will operate on the result of the Promise, returning a - * new child Promise. - * - * If the Promise is fulfilled, the {@code onFulfilled} callback will be invoked - * with the fulfillment value as argument, and the child Promise will be - * fulfilled with the return value of the callback. If the callback throws an - * exception, the child Promise will be rejected with the thrown value instead. - * - * If the Promise is rejected, the {@code onRejected} callback will be invoked - * with the rejection reason as argument, and the child Promise will be resolved - * with the return value or rejected with the thrown value of the callback. - * - * @override - */ -goog.Promise.prototype.then = function( - opt_onFulfilled, opt_onRejected, opt_context) { - - if (opt_onFulfilled != null) { - goog.asserts.assertFunction(opt_onFulfilled, - 'opt_onFulfilled should be a function.'); - } - if (opt_onRejected != null) { - goog.asserts.assertFunction(opt_onRejected, - 'opt_onRejected should be a function. Did you pass opt_context ' + - 'as the second argument instead of the third?'); - } - - if (goog.Promise.LONG_STACK_TRACES) { - this.addStackTrace_(new Error('then')); - } - - return this.addChildPromise_( - goog.isFunction(opt_onFulfilled) ? opt_onFulfilled : null, - goog.isFunction(opt_onRejected) ? opt_onRejected : null, - opt_context); -}; -goog.Thenable.addImplementation(goog.Promise); - - -/** - * Adds callbacks that will operate on the result of the Promise without - * returning a child Promise (unlike "then"). - * - * If the Promise is fulfilled, the {@code onFulfilled} callback will be invoked - * with the fulfillment value as argument. - * - * If the Promise is rejected, the {@code onRejected} callback will be invoked - * with the rejection reason as argument. - * - * @param {?(function(this:THIS, TYPE):?)=} opt_onFulfilled A - * function that will be invoked with the fulfillment value if the Promise - * is fulfilled. - * @param {?(function(this:THIS, *): *)=} opt_onRejected A function that will - * be invoked with the rejection reason if the Promise is rejected. - * @param {THIS=} opt_context An optional context object that will be the - * execution context for the callbacks. By default, functions are executed - * with the default this. - * @package - * @template THIS - */ -goog.Promise.prototype.thenVoid = function( - opt_onFulfilled, opt_onRejected, opt_context) { - - if (opt_onFulfilled != null) { - goog.asserts.assertFunction(opt_onFulfilled, - 'opt_onFulfilled should be a function.'); - } - if (opt_onRejected != null) { - goog.asserts.assertFunction(opt_onRejected, - 'opt_onRejected should be a function. Did you pass opt_context ' + - 'as the second argument instead of the third?'); - } - - if (goog.Promise.LONG_STACK_TRACES) { - this.addStackTrace_(new Error('then')); - } - - // Note: no default rejection handler is provided here as we need to - // distinguish unhandled rejections. - this.addCallbackEntry_(goog.Promise.getCallbackEntry_( - opt_onFulfilled || goog.nullFunction, - opt_onRejected || null, - opt_context)); -}; - - -/** - * Adds a callback that will be invoked when the Promise is settled (fulfilled - * or rejected). The callback receives no argument, and no new child Promise is - * created. This is useful for ensuring that cleanup takes place after certain - * asynchronous operations. Callbacks added with {@code thenAlways} will be - * executed in the same order with other calls to {@code then}, - * {@code thenAlways}, or {@code thenCatch}. - * - * Since it does not produce a new child Promise, cancellation propagation is - * not prevented by adding callbacks with {@code thenAlways}. A Promise that has - * a cleanup handler added with {@code thenAlways} will be canceled if all of - * its children created by {@code then} (or {@code thenCatch}) are canceled. - * Additionally, since any rejections are not passed to the callback, it does - * not stop the unhandled rejection handler from running. - * - * @param {function(this:THIS): void} onSettled A function that will be invoked - * when the Promise is settled (fulfilled or rejected). - * @param {THIS=} opt_context An optional context object that will be the - * execution context for the callbacks. By default, functions are executed - * in the global scope. - * @return {!goog.Promise<TYPE>} This Promise, for chaining additional calls. - * @template THIS - */ -goog.Promise.prototype.thenAlways = function(onSettled, opt_context) { - if (goog.Promise.LONG_STACK_TRACES) { - this.addStackTrace_(new Error('thenAlways')); - } - - var entry = goog.Promise.getCallbackEntry_(onSettled, onSettled, opt_context); - entry.always = true; - this.addCallbackEntry_(entry); - return this; -}; - - -/** - * Adds a callback that will be invoked only if the Promise is rejected. This - * is equivalent to {@code then(null, onRejected)}. - * - * @param {!function(this:THIS, *): *} onRejected A function that will be - * invoked with the rejection reason if the Promise is rejected. - * @param {THIS=} opt_context An optional context object that will be the - * execution context for the callbacks. By default, functions are executed - * in the global scope. - * @return {!goog.Promise} A new Promise that will receive the result of the - * callback. - * @template THIS - */ -goog.Promise.prototype.thenCatch = function(onRejected, opt_context) { - if (goog.Promise.LONG_STACK_TRACES) { - this.addStackTrace_(new Error('thenCatch')); - } - return this.addChildPromise_(null, onRejected, opt_context); -}; - - -/** - * Cancels the Promise if it is still pending by rejecting it with a cancel - * Error. No action is performed if the Promise is already resolved. - * - * All child Promises of the canceled Promise will be rejected with the same - * cancel error, as with normal Promise rejection. If the Promise to be canceled - * is the only child of a pending Promise, the parent Promise will also be - * canceled. Cancellation may propagate upward through multiple generations. - * - * @param {string=} opt_message An optional debugging message for describing the - * cancellation reason. - */ -goog.Promise.prototype.cancel = function(opt_message) { - if (this.state_ == goog.Promise.State_.PENDING) { - goog.async.run(function() { - var err = new goog.Promise.CancellationError(opt_message); - this.cancelInternal_(err); - }, this); - } -}; - - -/** - * Cancels this Promise with the given error. - * - * @param {!Error} err The cancellation error. - * @private - */ -goog.Promise.prototype.cancelInternal_ = function(err) { - if (this.state_ == goog.Promise.State_.PENDING) { - if (this.parent_) { - // Cancel the Promise and remove it from the parent's child list. - this.parent_.cancelChild_(this, err); - this.parent_ = null; - } else { - this.resolve_(goog.Promise.State_.REJECTED, err); - } - } -}; - - -/** - * Cancels a child Promise from the list of callback entries. If the Promise has - * not already been resolved, reject it with a cancel error. If there are no - * other children in the list of callback entries, propagate the cancellation - * by canceling this Promise as well. - * - * @param {!goog.Promise} childPromise The Promise to cancel. - * @param {!Error} err The cancel error to use for rejecting the Promise. - * @private - */ -goog.Promise.prototype.cancelChild_ = function(childPromise, err) { - if (!this.callbackEntries_) { - return; - } - var childCount = 0; - var childEntry = null; - var beforeChildEntry = null; - - // Find the callback entry for the childPromise, and count whether there are - // additional child Promises. - for (var entry = this.callbackEntries_; entry; entry = entry.next) { - if (!entry.always) { - childCount++; - if (entry.child == childPromise) { - childEntry = entry; - } - if (childEntry && childCount > 1) { - break; - } - } - if (!childEntry) { - beforeChildEntry = entry; - } - } - - // Can a child entry be missing? - - // If the child Promise was the only child, cancel this Promise as well. - // Otherwise, reject only the child Promise with the cancel error. - if (childEntry) { - if (this.state_ == goog.Promise.State_.PENDING && childCount == 1) { - this.cancelInternal_(err); - } else { - if (beforeChildEntry) { - this.removeEntryAfter_(beforeChildEntry); - } else { - this.popEntry_(); - } - - this.executeCallback_( - childEntry, goog.Promise.State_.REJECTED, err); - } - } -}; - - -/** - * Adds a callback entry to the current Promise, and schedules callback - * execution if the Promise has already been settled. - * - * @param {goog.Promise.CallbackEntry_} callbackEntry Record containing - * {@code onFulfilled} and {@code onRejected} callbacks to execute after - * the Promise is settled. - * @private - */ -goog.Promise.prototype.addCallbackEntry_ = function(callbackEntry) { - if (!this.hasEntry_() && - (this.state_ == goog.Promise.State_.FULFILLED || - this.state_ == goog.Promise.State_.REJECTED)) { - this.scheduleCallbacks_(); - } - this.queueEntry_(callbackEntry); -}; - - -/** - * Creates a child Promise and adds it to the callback entry list. The result of - * the child Promise is determined by the state of the parent Promise and the - * result of the {@code onFulfilled} or {@code onRejected} callbacks as - * specified in the Promise resolution procedure. - * - * @see http://promisesaplus.com/#the__method - * - * @param {?function(this:THIS, TYPE): - * (RESULT|goog.Promise<RESULT>|Thenable)} onFulfilled A callback that - * will be invoked if the Promise is fullfilled, or null. - * @param {?function(this:THIS, *): *} onRejected A callback that will be - * invoked if the Promise is rejected, or null. - * @param {THIS=} opt_context An optional execution context for the callbacks. - * in the default calling context. - * @return {!goog.Promise} The child Promise. - * @template RESULT,THIS - * @private - */ -goog.Promise.prototype.addChildPromise_ = function( - onFulfilled, onRejected, opt_context) { - - /** @type {goog.Promise.CallbackEntry_} */ - var callbackEntry = goog.Promise.getCallbackEntry_(null, null, null); - - callbackEntry.child = new goog.Promise(function(resolve, reject) { - // Invoke onFulfilled, or resolve with the parent's value if absent. - callbackEntry.onFulfilled = onFulfilled ? function(value) { - try { - var result = onFulfilled.call(opt_context, value); - resolve(result); - } catch (err) { - reject(err); - } - } : resolve; - - // Invoke onRejected, or reject with the parent's reason if absent. - callbackEntry.onRejected = onRejected ? function(reason) { - try { - var result = onRejected.call(opt_context, reason); - if (!goog.isDef(result) && - reason instanceof goog.Promise.CancellationError) { - // Propagate cancellation to children if no other result is returned. - reject(reason); - } else { - resolve(result); - } - } catch (err) { - reject(err); - } - } : reject; - }); - - callbackEntry.child.parent_ = this; - this.addCallbackEntry_(callbackEntry); - return callbackEntry.child; -}; - - -/** - * Unblocks the Promise and fulfills it with the given value. - * - * @param {TYPE} value - * @private - */ -goog.Promise.prototype.unblockAndFulfill_ = function(value) { - goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED); - this.state_ = goog.Promise.State_.PENDING; - this.resolve_(goog.Promise.State_.FULFILLED, value); -}; - - -/** - * Unblocks the Promise and rejects it with the given rejection reason. - * - * @param {*} reason - * @private - */ -goog.Promise.prototype.unblockAndReject_ = function(reason) { - goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED); - this.state_ = goog.Promise.State_.PENDING; - this.resolve_(goog.Promise.State_.REJECTED, reason); -}; - - -/** - * Attempts to resolve a Promise with a given resolution state and value. This - * is a no-op if the given Promise has already been resolved. - * - * If the given result is a Thenable (such as another Promise), the Promise will - * be settled with the same state and result as the Thenable once it is itself - * settled. - * - * If the given result is not a Thenable, the Promise will be settled (fulfilled - * or rejected) with that result based on the given state. - * - * @see http://promisesaplus.com/#the_promise_resolution_procedure - * - * @param {goog.Promise.State_} state - * @param {*} x The result to apply to the Promise. - * @private - */ -goog.Promise.prototype.resolve_ = function(state, x) { - if (this.state_ != goog.Promise.State_.PENDING) { - return; - } - - if (this == x) { - state = goog.Promise.State_.REJECTED; - x = new TypeError('Promise cannot resolve to itself'); - } - - this.state_ = goog.Promise.State_.BLOCKED; - var isThenable = goog.Promise.maybeThen_( - x, this.unblockAndFulfill_, this.unblockAndReject_, this); - if (isThenable) { - return; - } - - this.result_ = x; - this.state_ = state; - // Since we can no longer be canceled, remove link to parent, so that the - // child promise does not keep the parent promise alive. - this.parent_ = null; - this.scheduleCallbacks_(); - - if (state == goog.Promise.State_.REJECTED && - !(x instanceof goog.Promise.CancellationError)) { - goog.Promise.addUnhandledRejection_(this, x); - } -}; - - -/** - * Invokes the "then" method of an input value if that value is a Thenable. This - * is a no-op if the value is not thenable. - * - * @param {*} value A potentially thenable value. - * @param {!Function} onFulfilled - * @param {!Function} onRejected - * @param {*} context - * @return {boolean} Whether the input value was thenable. - * @private - */ -goog.Promise.maybeThen_ = function(value, onFulfilled, onRejected, context) { - if (value instanceof goog.Promise) { - value.thenVoid(onFulfilled, onRejected, context); - return true; - } else if (goog.Thenable.isImplementedBy(value)) { - value = /** @type {!goog.Thenable} */ (value); - value.then(onFulfilled, onRejected, context); - return true; - } else if (goog.isObject(value)) { - try { - var then = value['then']; - if (goog.isFunction(then)) { - goog.Promise.tryThen_( - value, then, onFulfilled, onRejected, context); - return true; - } - } catch (e) { - onRejected.call(context, e); - return true; - } - } - - return false; -}; - - -/** - * Attempts to call the {@code then} method on an object in the hopes that it is - * a Promise-compatible instance. This allows interoperation between different - * Promise implementations, however a non-compliant object may cause a Promise - * to hang indefinitely. If the {@code then} method throws an exception, the - * dependent Promise will be rejected with the thrown value. - * - * @see http://promisesaplus.com/#point-70 - * - * @param {Thenable} thenable An object with a {@code then} method that may be - * compatible with the Promise/A+ specification. - * @param {!Function} then The {@code then} method of the Thenable object. - * @param {!Function} onFulfilled - * @param {!Function} onRejected - * @param {*} context - * @private - */ -goog.Promise.tryThen_ = function( - thenable, then, onFulfilled, onRejected, context) { - - var called = false; - var resolve = function(value) { - if (!called) { - called = true; - onFulfilled.call(context, value); - } - }; - - var reject = function(reason) { - if (!called) { - called = true; - onRejected.call(context, reason); - } - }; - - try { - then.call(thenable, resolve, reject); - } catch (e) { - reject(e); - } -}; - - -/** - * Executes the pending callbacks of a settled Promise after a timeout. - * - * Section 2.2.4 of the Promises/A+ specification requires that Promise - * callbacks must only be invoked from a call stack that only contains Promise - * implementation code, which we accomplish by invoking callback execution after - * a timeout. If {@code startExecution_} is called multiple times for the same - * Promise, the callback chain will be evaluated only once. Additional callbacks - * may be added during the evaluation phase, and will be executed in the same - * event loop. - * - * All Promises added to the waiting list during the same browser event loop - * will be executed in one batch to avoid using a separate timeout per Promise. - * - * @private - */ -goog.Promise.prototype.scheduleCallbacks_ = function() { - if (!this.executing_) { - this.executing_ = true; - goog.async.run(this.executeCallbacks_, this); - } -}; - - -/** - * @return {boolean} Whether there are any pending callbacks queued. - * @private - */ -goog.Promise.prototype.hasEntry_ = function() { - return !!this.callbackEntries_; -}; - - -/** - * @param {goog.Promise.CallbackEntry_} entry - * @private - */ -goog.Promise.prototype.queueEntry_ = function(entry) { - goog.asserts.assert(entry.onFulfilled != null); - - if (this.callbackEntriesTail_) { - this.callbackEntriesTail_.next = entry; - this.callbackEntriesTail_ = entry; - } else { - // It the work queue was empty set the head too. - this.callbackEntries_ = entry; - this.callbackEntriesTail_ = entry; - } -}; - - -/** - * @return {goog.Promise.CallbackEntry_} entry - * @private - */ -goog.Promise.prototype.popEntry_ = function() { - var entry = null; - if (this.callbackEntries_) { - entry = this.callbackEntries_; - this.callbackEntries_ = entry.next; - entry.next = null; - } - // It the work queue is empty clear the tail too. - if (!this.callbackEntries_) { - this.callbackEntriesTail_ = null; - } - - if (entry != null) { - goog.asserts.assert(entry.onFulfilled != null); - } - return entry; -}; - - -/** - * @param {goog.Promise.CallbackEntry_} previous - * @private - */ -goog.Promise.prototype.removeEntryAfter_ = function(previous) { - goog.asserts.assert(this.callbackEntries_); - goog.asserts.assert(previous != null); - // If the last entry is being removed, update the tail - if (previous.next == this.callbackEntriesTail_) { - this.callbackEntriesTail_ = previous; - } - - previous.next = previous.next.next; -}; - - -/** - * Executes all pending callbacks for this Promise. - * - * @private - */ -goog.Promise.prototype.executeCallbacks_ = function() { - var entry = null; - while (entry = this.popEntry_()) { - if (goog.Promise.LONG_STACK_TRACES) { - this.currentStep_++; - } - this.executeCallback_(entry, this.state_, this.result_); - } - this.executing_ = false; -}; - - -/** - * Executes a pending callback for this Promise. Invokes an {@code onFulfilled} - * or {@code onRejected} callback based on the settled state of the Promise. - * - * @param {!goog.Promise.CallbackEntry_} callbackEntry An entry containing the - * onFulfilled and/or onRejected callbacks for this step. - * @param {goog.Promise.State_} state The resolution status of the Promise, - * either FULFILLED or REJECTED. - * @param {*} result The settled result of the Promise. - * @private - */ -goog.Promise.prototype.executeCallback_ = function( - callbackEntry, state, result) { - // Cancel an unhandled rejection if the then/thenVoid call had an onRejected. - if (state == goog.Promise.State_.REJECTED && - callbackEntry.onRejected && !callbackEntry.always) { - this.removeUnhandledRejection_(); - } - - if (callbackEntry.child) { - // When the parent is settled, the child no longer needs to hold on to it, - // as the parent can no longer be canceled. - callbackEntry.child.parent_ = null; - goog.Promise.invokeCallback_(callbackEntry, state, result); - } else { - // Callbacks created with thenAlways or thenVoid do not have the rejection - // handling code normally set up in the child Promise. - try { - callbackEntry.always ? - callbackEntry.onFulfilled.call(callbackEntry.context) : - goog.Promise.invokeCallback_(callbackEntry, state, result); - } catch (err) { - goog.Promise.handleRejection_.call(null, err); - } - } - goog.Promise.returnEntry_(callbackEntry); -}; - - -/** - * Executes the onFulfilled or onRejected callback for a callbackEntry. - * - * @param {!goog.Promise.CallbackEntry_} callbackEntry - * @param {goog.Promise.State_} state - * @param {*} result - * @private - */ -goog.Promise.invokeCallback_ = function(callbackEntry, state, result) { - if (state == goog.Promise.State_.FULFILLED) { - callbackEntry.onFulfilled.call(callbackEntry.context, result); - } else if (callbackEntry.onRejected) { - callbackEntry.onRejected.call(callbackEntry.context, result); - } -}; - - -/** - * Records a stack trace entry for functions that call {@code then} or the - * Promise constructor. May be disabled by unsetting {@code LONG_STACK_TRACES}. - * - * @param {!Error} err An Error object created by the calling function for - * providing a stack trace. - * @private - */ -goog.Promise.prototype.addStackTrace_ = function(err) { - if (goog.Promise.LONG_STACK_TRACES && goog.isString(err.stack)) { - // Extract the third line of the stack trace, which is the entry for the - // user function that called into Promise code. - var trace = err.stack.split('\n', 4)[3]; - var message = err.message; - - // Pad the message to align the traces. - message += Array(11 - message.length).join(' '); - this.stack_.push(message + trace); - } -}; - - -/** - * Adds extra stack trace information to an exception for the list of - * asynchronous {@code then} calls that have been run for this Promise. Stack - * trace information is recorded in {@see #addStackTrace_}, and appended to - * rethrown errors when {@code LONG_STACK_TRACES} is enabled. - * - * @param {*} err An unhandled exception captured during callback execution. - * @private - */ -goog.Promise.prototype.appendLongStack_ = function(err) { - if (goog.Promise.LONG_STACK_TRACES && - err && goog.isString(err.stack) && this.stack_.length) { - var longTrace = ['Promise trace:']; - - for (var promise = this; promise; promise = promise.parent_) { - for (var i = this.currentStep_; i >= 0; i--) { - longTrace.push(promise.stack_[i]); - } - longTrace.push('Value: ' + - '[' + (promise.state_ == goog.Promise.State_.REJECTED ? - 'REJECTED' : 'FULFILLED') + '] ' + - '<' + String(promise.result_) + '>'); - } - err.stack += '\n\n' + longTrace.join('\n'); - } -}; - - -/** - * Marks this rejected Promise as having being handled. Also marks any parent - * Promises in the rejected state as handled. The rejection handler will no - * longer be invoked for this Promise (if it has not been called already). - * - * @private - */ -goog.Promise.prototype.removeUnhandledRejection_ = function() { - if (goog.Promise.UNHANDLED_REJECTION_DELAY > 0) { - for (var p = this; p && p.unhandledRejectionId_; p = p.parent_) { - goog.global.clearTimeout(p.unhandledRejectionId_); - p.unhandledRejectionId_ = 0; - } - } else if (goog.Promise.UNHANDLED_REJECTION_DELAY == 0) { - for (var p = this; p && p.hadUnhandledRejection_; p = p.parent_) { - p.hadUnhandledRejection_ = false; - } - } -}; - - -/** - * Marks this rejected Promise as unhandled. If no {@code onRejected} callback - * is called for this Promise before the {@code UNHANDLED_REJECTION_DELAY} - * expires, the reason will be passed to the unhandled rejection handler. The - * handler typically rethrows the rejection reason so that it becomes visible in - * the developer console. - * - * @param {!goog.Promise} promise The rejected Promise. - * @param {*} reason The Promise rejection reason. - * @private - */ -goog.Promise.addUnhandledRejection_ = function(promise, reason) { - if (goog.Promise.UNHANDLED_REJECTION_DELAY > 0) { - promise.unhandledRejectionId_ = goog.global.setTimeout(function() { - promise.appendLongStack_(reason); - goog.Promise.handleRejection_.call(null, reason); - }, goog.Promise.UNHANDLED_REJECTION_DELAY); - - } else if (goog.Promise.UNHANDLED_REJECTION_DELAY == 0) { - promise.hadUnhandledRejection_ = true; - goog.async.run(function() { - if (promise.hadUnhandledRejection_) { - promise.appendLongStack_(reason); - goog.Promise.handleRejection_.call(null, reason); - } - }); - } -}; - - -/** - * A method that is invoked with the rejection reasons for Promises that are - * rejected but have no {@code onRejected} callbacks registered yet. - * @type {function(*)} - * @private - */ -goog.Promise.handleRejection_ = goog.async.throwException; - - -/** - * Sets a handler that will be called with reasons from unhandled rejected - * Promises. If the rejected Promise (or one of its descendants) has an - * {@code onRejected} callback registered, the rejection will be considered - * handled, and the rejection handler will not be called. - * - * By default, unhandled rejections are rethrown so that the error may be - * captured by the developer console or a {@code window.onerror} handler. - * - * @param {function(*)} handler A function that will be called with reasons from - * rejected Promises. Defaults to {@code goog.async.throwException}. - */ -goog.Promise.setUnhandledRejectionHandler = function(handler) { - goog.Promise.handleRejection_ = handler; -}; - - - -/** - * Error used as a rejection reason for canceled Promises. - * - * @param {string=} opt_message - * @constructor - * @extends {goog.debug.Error} - * @final - */ -goog.Promise.CancellationError = function(opt_message) { - goog.Promise.CancellationError.base(this, 'constructor', opt_message); -}; -goog.inherits(goog.Promise.CancellationError, goog.debug.Error); - - -/** @override */ -goog.Promise.CancellationError.prototype.name = 'cancel'; - - - -/** - * Internal implementation of the resolver interface. - * - * @param {!goog.Promise<TYPE>} promise - * @param {function((TYPE|goog.Promise<TYPE>|Thenable)=)} resolve - * @param {function(*=): void} reject - * @implements {goog.promise.Resolver<TYPE>} - * @final @struct - * @constructor - * @private - * @template TYPE - */ -goog.Promise.Resolver_ = function(promise, resolve, reject) { - /** @const */ - this.promise = promise; - - /** @const */ - this.resolve = resolve; - - /** @const */ - this.reject = reject; -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A timer class to which other classes and objects can - * listen on. This is only an abstraction above setInterval. - * - * @see ../demos/timers.html - */ - -goog.provide('goog.Timer'); - -goog.require('goog.Promise'); -goog.require('goog.events.EventTarget'); - - - -/** - * Class for handling timing events. - * - * @param {number=} opt_interval Number of ms between ticks (Default: 1ms). - * @param {Object=} opt_timerObject An object that has setTimeout, setInterval, - * clearTimeout and clearInterval (eg Window). - * @constructor - * @extends {goog.events.EventTarget} - */ -goog.Timer = function(opt_interval, opt_timerObject) { - goog.events.EventTarget.call(this); - - /** - * Number of ms between ticks - * @type {number} - * @private - */ - this.interval_ = opt_interval || 1; - - /** - * An object that implements setTimeout, setInterval, clearTimeout and - * clearInterval. We default to the window object. Changing this on - * goog.Timer.prototype changes the object for all timer instances which can - * be useful if your environment has some other implementation of timers than - * the window object. - * @type {Object} - * @private - */ - this.timerObject_ = opt_timerObject || goog.Timer.defaultTimerObject; - - /** - * Cached tick_ bound to the object for later use in the timer. - * @type {Function} - * @private - */ - this.boundTick_ = goog.bind(this.tick_, this); - - /** - * Firefox browser often fires the timer event sooner - * (sometimes MUCH sooner) than the requested timeout. So we - * compare the time to when the event was last fired, and - * reschedule if appropriate. See also goog.Timer.intervalScale - * @type {number} - * @private - */ - this.last_ = goog.now(); -}; -goog.inherits(goog.Timer, goog.events.EventTarget); - - -/** - * Maximum timeout value. - * - * Timeout values too big to fit into a signed 32-bit integer may cause - * overflow in FF, Safari, and Chrome, resulting in the timeout being - * scheduled immediately. It makes more sense simply not to schedule these - * timeouts, since 24.8 days is beyond a reasonable expectation for the - * browser to stay open. - * - * @type {number} - * @private - */ -goog.Timer.MAX_TIMEOUT_ = 2147483647; - - -/** - * A timer ID that cannot be returned by any known implmentation of - * Window.setTimeout. Passing this value to window.clearTimeout should - * therefore be a no-op. - * - * @const {number} - * @private - */ -goog.Timer.INVALID_TIMEOUT_ID_ = -1; - - -/** - * Whether this timer is enabled - * @type {boolean} - */ -goog.Timer.prototype.enabled = false; - - -/** - * An object that implements setTimout, setInterval, clearTimeout and - * clearInterval. We default to the global object. Changing - * goog.Timer.defaultTimerObject changes the object for all timer instances - * which can be useful if your environment has some other implementation of - * timers you'd like to use. - * @type {Object} - */ -goog.Timer.defaultTimerObject = goog.global; - - -/** - * A variable that controls the timer error correction. If the - * timer is called before the requested interval times - * intervalScale, which often happens on mozilla, the timer is - * rescheduled. See also this.last_ - * @type {number} - */ -goog.Timer.intervalScale = 0.8; - - -/** - * Variable for storing the result of setInterval - * @type {?number} - * @private - */ -goog.Timer.prototype.timer_ = null; - - -/** - * Gets the interval of the timer. - * @return {number} interval Number of ms between ticks. - */ -goog.Timer.prototype.getInterval = function() { - return this.interval_; -}; - - -/** - * Sets the interval of the timer. - * @param {number} interval Number of ms between ticks. - */ -goog.Timer.prototype.setInterval = function(interval) { - this.interval_ = interval; - if (this.timer_ && this.enabled) { - // Stop and then start the timer to reset the interval. - this.stop(); - this.start(); - } else if (this.timer_) { - this.stop(); - } -}; - - -/** - * Callback for the setTimeout used by the timer - * @private - */ -goog.Timer.prototype.tick_ = function() { - if (this.enabled) { - var elapsed = goog.now() - this.last_; - if (elapsed > 0 && - elapsed < this.interval_ * goog.Timer.intervalScale) { - this.timer_ = this.timerObject_.setTimeout(this.boundTick_, - this.interval_ - elapsed); - return; - } - - // Prevents setInterval from registering a duplicate timeout when called - // in the timer event handler. - if (this.timer_) { - this.timerObject_.clearTimeout(this.timer_); - this.timer_ = null; - } - - this.dispatchTick(); - // The timer could be stopped in the timer event handler. - if (this.enabled) { - this.timer_ = this.timerObject_.setTimeout(this.boundTick_, - this.interval_); - this.last_ = goog.now(); - } - } -}; - - -/** - * Dispatches the TICK event. This is its own method so subclasses can override. - */ -goog.Timer.prototype.dispatchTick = function() { - this.dispatchEvent(goog.Timer.TICK); -}; - - -/** - * Starts the timer. - */ -goog.Timer.prototype.start = function() { - this.enabled = true; - - // If there is no interval already registered, start it now - if (!this.timer_) { - // IMPORTANT! - // window.setInterval in FireFox has a bug - it fires based on - // absolute time, rather than on relative time. What this means - // is that if a computer is sleeping/hibernating for 24 hours - // and the timer interval was configured to fire every 1000ms, - // then after the PC wakes up the timer will fire, in rapid - // succession, 3600*24 times. - // This bug is described here and is already fixed, but it will - // take time to propagate, so for now I am switching this over - // to setTimeout logic. - // https://bugzilla.mozilla.org/show_bug.cgi?id=376643 - // - this.timer_ = this.timerObject_.setTimeout(this.boundTick_, - this.interval_); - this.last_ = goog.now(); - } -}; - - -/** - * Stops the timer. - */ -goog.Timer.prototype.stop = function() { - this.enabled = false; - if (this.timer_) { - this.timerObject_.clearTimeout(this.timer_); - this.timer_ = null; - } -}; - - -/** @override */ -goog.Timer.prototype.disposeInternal = function() { - goog.Timer.superClass_.disposeInternal.call(this); - this.stop(); - delete this.timerObject_; -}; - - -/** - * Constant for the timer's event type - * @type {string} - */ -goog.Timer.TICK = 'tick'; - - -/** - * Calls the given function once, after the optional pause. - * - * The function is always called asynchronously, even if the delay is 0. This - * is a common trick to schedule a function to run after a batch of browser - * event processing. - * - * @param {function(this:SCOPE)|{handleEvent:function()}|null} listener Function - * or object that has a handleEvent method. - * @param {number=} opt_delay Milliseconds to wait; default is 0. - * @param {SCOPE=} opt_handler Object in whose scope to call the listener. - * @return {number} A handle to the timer ID. - * @template SCOPE - */ -goog.Timer.callOnce = function(listener, opt_delay, opt_handler) { - if (goog.isFunction(listener)) { - if (opt_handler) { - listener = goog.bind(listener, opt_handler); - } - } else if (listener && typeof listener.handleEvent == 'function') { - // using typeof to prevent strict js warning - listener = goog.bind(listener.handleEvent, listener); - } else { - throw Error('Invalid listener argument'); - } - - if (opt_delay > goog.Timer.MAX_TIMEOUT_) { - // Timeouts greater than MAX_INT return immediately due to integer - // overflow in many browsers. Since MAX_INT is 24.8 days, just don't - // schedule anything at all. - return goog.Timer.INVALID_TIMEOUT_ID_; - } else { - return goog.Timer.defaultTimerObject.setTimeout( - listener, opt_delay || 0); - } -}; - - -/** - * Clears a timeout initiated by callOnce - * @param {?number} timerId a timer ID. - */ -goog.Timer.clear = function(timerId) { - goog.Timer.defaultTimerObject.clearTimeout(timerId); -}; - - -/** - * @param {number} delay Milliseconds to wait. - * @param {(RESULT|goog.Thenable<RESULT>|Thenable)=} opt_result The value - * with which the promise will be resolved. - * @return {!goog.Promise<RESULT>} A promise that will be resolved after - * the specified delay, unless it is canceled first. - * @template RESULT - */ -goog.Timer.promise = function(delay, opt_result) { - var timerKey = null; - return new goog.Promise(function(resolve, reject) { - timerKey = goog.Timer.callOnce(function() { - resolve(opt_result); - }, delay); - if (timerKey == goog.Timer.INVALID_TIMEOUT_ID_) { - reject(new Error('Failed to schedule timer.')); - } - }).thenCatch(function(error) { - // Clear the timer. The most likely reason is "cancel" signal. - goog.Timer.clear(timerKey); - throw error; - }); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview JSON utility functions. - * @author arv@google.com (Erik Arvidsson) - */ - - -goog.provide('goog.json'); -goog.provide('goog.json.Replacer'); -goog.provide('goog.json.Reviver'); -goog.provide('goog.json.Serializer'); - - -/** - * @define {boolean} If true, use the native JSON parsing API. - * NOTE(ruilopes): EXPERIMENTAL, handle with care. Setting this to true might - * break your code. The default {@code goog.json.parse} implementation is able - * to handle invalid JSON, such as JSPB. - */ -goog.define('goog.json.USE_NATIVE_JSON', false); - - -/** - * Tests if a string is an invalid JSON string. This only ensures that we are - * not using any invalid characters - * @param {string} s The string to test. - * @return {boolean} True if the input is a valid JSON string. - */ -goog.json.isValid = function(s) { - // All empty whitespace is not valid. - if (/^\s*$/.test(s)) { - return false; - } - - // This is taken from http://www.json.org/json2.js which is released to the - // public domain. - // Changes: We dissallow \u2028 Line separator and \u2029 Paragraph separator - // inside strings. We also treat \u2028 and \u2029 as whitespace which they - // are in the RFC but IE and Safari does not match \s to these so we need to - // include them in the reg exps in all places where whitespace is allowed. - // We allowed \x7f inside strings because some tools don't escape it, - // e.g. http://www.json.org/java/org/json/JSONObject.java - - // Parsing happens in three stages. In the first stage, we run the text - // against regular expressions that look for non-JSON patterns. We are - // especially concerned with '()' and 'new' because they can cause invocation, - // and '=' because it can cause mutation. But just to be safe, we want to - // reject all unexpected forms. - - // We split the first stage into 4 regexp operations in order to work around - // crippling inefficiencies in IE's and Safari's regexp engines. First we - // replace all backslash pairs with '@' (a non-JSON character). Second, we - // replace all simple value tokens with ']' characters. Third, we delete all - // open brackets that follow a colon or comma or that begin the text. Finally, - // we look to see that the remaining characters are only whitespace or ']' or - // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - // Don't make these static since they have the global flag. - var backslashesRe = /\\["\\\/bfnrtu]/g; - var simpleValuesRe = - /"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; - var openBracketsRe = /(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g; - var remainderRe = /^[\],:{}\s\u2028\u2029]*$/; - - return remainderRe.test(s.replace(backslashesRe, '@'). - replace(simpleValuesRe, ']'). - replace(openBracketsRe, '')); -}; - - -/** - * Parses a JSON string and returns the result. This throws an exception if - * the string is an invalid JSON string. - * - * Note that this is very slow on large strings. If you trust the source of - * the string then you should use unsafeParse instead. - * - * @param {*} s The JSON string to parse. - * @throws Error if s is invalid JSON. - * @return {Object} The object generated from the JSON string, or null. - */ -goog.json.parse = goog.json.USE_NATIVE_JSON ? - /** @type {function(*):Object} */ (goog.global['JSON']['parse']) : - function(s) { - var o = String(s); - if (goog.json.isValid(o)) { - /** @preserveTry */ - try { - return /** @type {Object} */ (eval('(' + o + ')')); - } catch (ex) { - } - } - throw Error('Invalid JSON string: ' + o); - }; - - -/** - * Parses a JSON string and returns the result. This uses eval so it is open - * to security issues and it should only be used if you trust the source. - * - * @param {string} s The JSON string to parse. - * @return {Object} The object generated from the JSON string. - */ -goog.json.unsafeParse = goog.json.USE_NATIVE_JSON ? - /** @type {function(string):Object} */ (goog.global['JSON']['parse']) : - function(s) { - return /** @type {Object} */ (eval('(' + s + ')')); - }; - - -/** - * JSON replacer, as defined in Section 15.12.3 of the ES5 spec. - * @see http://ecma-international.org/ecma-262/5.1/#sec-15.12.3 - * - * TODO(nicksantos): Array should also be a valid replacer. - * - * @typedef {function(this:Object, string, *): *} - */ -goog.json.Replacer; - - -/** - * JSON reviver, as defined in Section 15.12.2 of the ES5 spec. - * @see http://ecma-international.org/ecma-262/5.1/#sec-15.12.3 - * - * @typedef {function(this:Object, string, *): *} - */ -goog.json.Reviver; - - -/** - * Serializes an object or a value to a JSON string. - * - * @param {*} object The object to serialize. - * @param {?goog.json.Replacer=} opt_replacer A replacer function - * called for each (key, value) pair that determines how the value - * should be serialized. By defult, this just returns the value - * and allows default serialization to kick in. - * @throws Error if there are loops in the object graph. - * @return {string} A JSON string representation of the input. - */ -goog.json.serialize = goog.json.USE_NATIVE_JSON ? - /** @type {function(*, ?goog.json.Replacer=):string} */ - (goog.global['JSON']['stringify']) : - function(object, opt_replacer) { - // NOTE(nicksantos): Currently, we never use JSON.stringify. - // - // The last time I evaluated this, JSON.stringify had subtle bugs and - // behavior differences on all browsers, and the performance win was not - // large enough to justify all the issues. This may change in the future - // as browser implementations get better. - // - // assertSerialize in json_test contains if branches for the cases - // that fail. - return new goog.json.Serializer(opt_replacer).serialize(object); - }; - - - -/** - * Class that is used to serialize JSON objects to a string. - * @param {?goog.json.Replacer=} opt_replacer Replacer. - * @constructor - */ -goog.json.Serializer = function(opt_replacer) { - /** - * @type {goog.json.Replacer|null|undefined} - * @private - */ - this.replacer_ = opt_replacer; -}; - - -/** - * Serializes an object or a value to a JSON string. - * - * @param {*} object The object to serialize. - * @throws Error if there are loops in the object graph. - * @return {string} A JSON string representation of the input. - */ -goog.json.Serializer.prototype.serialize = function(object) { - var sb = []; - this.serializeInternal(object, sb); - return sb.join(''); -}; - - -/** - * Serializes a generic value to a JSON string - * @protected - * @param {*} object The object to serialize. - * @param {Array<string>} sb Array used as a string builder. - * @throws Error if there are loops in the object graph. - */ -goog.json.Serializer.prototype.serializeInternal = function(object, sb) { - if (object == null) { - // undefined == null so this branch covers undefined as well as null - sb.push('null'); - return; - } - - if (typeof object == 'object') { - if (goog.isArray(object)) { - this.serializeArray(object, sb); - return; - } else if (object instanceof String || - object instanceof Number || - object instanceof Boolean) { - object = object.valueOf(); - // Fall through to switch below. - } else { - this.serializeObject_(/** @type {Object} */ (object), sb); - return; - } - } - - switch (typeof object) { - case 'string': - this.serializeString_(object, sb); - break; - case 'number': - this.serializeNumber_(object, sb); - break; - case 'boolean': - sb.push(object); - break; - case 'function': - sb.push('null'); - break; - default: - throw Error('Unknown type: ' + typeof object); - } -}; - - -/** - * Character mappings used internally for goog.string.quote - * @private - * @type {!Object} - */ -goog.json.Serializer.charToJsonCharCache_ = { - '\"': '\\"', - '\\': '\\\\', - '/': '\\/', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - - '\x0B': '\\u000b' // '\v' is not supported in JScript -}; - - -/** - * Regular expression used to match characters that need to be replaced. - * The S60 browser has a bug where unicode characters are not matched by - * regular expressions. The condition below detects such behaviour and - * adjusts the regular expression accordingly. - * @private - * @type {!RegExp} - */ -goog.json.Serializer.charsToReplace_ = /\uffff/.test('\uffff') ? - /[\\\"\x00-\x1f\x7f-\uffff]/g : /[\\\"\x00-\x1f\x7f-\xff]/g; - - -/** - * Serializes a string to a JSON string - * @private - * @param {string} s The string to serialize. - * @param {Array<string>} sb Array used as a string builder. - */ -goog.json.Serializer.prototype.serializeString_ = function(s, sb) { - // The official JSON implementation does not work with international - // characters. - sb.push('"', s.replace(goog.json.Serializer.charsToReplace_, function(c) { - // caching the result improves performance by a factor 2-3 - var rv = goog.json.Serializer.charToJsonCharCache_[c]; - if (!rv) { - rv = '\\u' + (c.charCodeAt(0) | 0x10000).toString(16).substr(1); - goog.json.Serializer.charToJsonCharCache_[c] = rv; - } - return rv; - }), '"'); -}; - - -/** - * Serializes a number to a JSON string - * @private - * @param {number} n The number to serialize. - * @param {Array<string>} sb Array used as a string builder. - */ -goog.json.Serializer.prototype.serializeNumber_ = function(n, sb) { - sb.push(isFinite(n) && !isNaN(n) ? n : 'null'); -}; - - -/** - * Serializes an array to a JSON string - * @param {Array<string>} arr The array to serialize. - * @param {Array<string>} sb Array used as a string builder. - * @protected - */ -goog.json.Serializer.prototype.serializeArray = function(arr, sb) { - var l = arr.length; - sb.push('['); - var sep = ''; - for (var i = 0; i < l; i++) { - sb.push(sep); - - var value = arr[i]; - this.serializeInternal( - this.replacer_ ? this.replacer_.call(arr, String(i), value) : value, - sb); - - sep = ','; - } - sb.push(']'); -}; - - -/** - * Serializes an object to a JSON string - * @private - * @param {Object} obj The object to serialize. - * @param {Array<string>} sb Array used as a string builder. - */ -goog.json.Serializer.prototype.serializeObject_ = function(obj, sb) { - sb.push('{'); - var sep = ''; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - var value = obj[key]; - // Skip functions. - if (typeof value != 'function') { - sb.push(sep); - this.serializeString_(key, sb); - sb.push(':'); - - this.serializeInternal( - this.replacer_ ? this.replacer_.call(obj, key, value) : value, - sb); - - sep = ','; - } - } - } - sb.push('}'); -}; - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Error codes shared between goog.net.IframeIo and - * goog.net.XhrIo. - */ - -goog.provide('goog.net.ErrorCode'); - - -/** - * Error codes - * @enum {number} - */ -goog.net.ErrorCode = { - - /** - * There is no error condition. - */ - NO_ERROR: 0, - - /** - * The most common error from iframeio, unfortunately, is that the browser - * responded with an error page that is classed as a different domain. The - * situations, are when a browser error page is shown -- 404, access denied, - * DNS failure, connection reset etc.) - * - */ - ACCESS_DENIED: 1, - - /** - * Currently the only case where file not found will be caused is when the - * code is running on the local file system and a non-IE browser makes a - * request to a file that doesn't exist. - */ - FILE_NOT_FOUND: 2, - - /** - * If Firefox shows a browser error page, such as a connection reset by - * server or access denied, then it will fail silently without the error or - * load handlers firing. - */ - FF_SILENT_ERROR: 3, - - /** - * Custom error provided by the client through the error check hook. - */ - CUSTOM_ERROR: 4, - - /** - * Exception was thrown while processing the request. - */ - EXCEPTION: 5, - - /** - * The Http response returned a non-successful http status code. - */ - HTTP_ERROR: 6, - - /** - * The request was aborted. - */ - ABORT: 7, - - /** - * The request timed out. - */ - TIMEOUT: 8, - - /** - * The resource is not available offline. - */ - OFFLINE: 9 -}; - - -/** - * Returns a friendly error message for an error code. These messages are for - * debugging and are not localized. - * @param {goog.net.ErrorCode} errorCode An error code. - * @return {string} A message for debugging. - */ -goog.net.ErrorCode.getDebugMessage = function(errorCode) { - switch (errorCode) { - case goog.net.ErrorCode.NO_ERROR: - return 'No Error'; - - case goog.net.ErrorCode.ACCESS_DENIED: - return 'Access denied to content document'; - - case goog.net.ErrorCode.FILE_NOT_FOUND: - return 'File not found'; - - case goog.net.ErrorCode.FF_SILENT_ERROR: - return 'Firefox silently errored'; - - case goog.net.ErrorCode.CUSTOM_ERROR: - return 'Application custom error'; - - case goog.net.ErrorCode.EXCEPTION: - return 'An exception occurred'; - - case goog.net.ErrorCode.HTTP_ERROR: - return 'Http response at 400 or 500 level'; - - case goog.net.ErrorCode.ABORT: - return 'Request was aborted'; - - case goog.net.ErrorCode.TIMEOUT: - return 'Request timed out'; - - case goog.net.ErrorCode.OFFLINE: - return 'The resource is not available offline'; - - default: - return 'Unrecognized error code'; - } -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Constants for HTTP status codes. - */ - -goog.provide('goog.net.HttpStatus'); - - -/** - * HTTP Status Codes defined in RFC 2616 and RFC 6585. - * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html - * @see http://tools.ietf.org/html/rfc6585 - * @enum {number} - */ -goog.net.HttpStatus = { - // Informational 1xx - CONTINUE: 100, - SWITCHING_PROTOCOLS: 101, - - // Successful 2xx - OK: 200, - CREATED: 201, - ACCEPTED: 202, - NON_AUTHORITATIVE_INFORMATION: 203, - NO_CONTENT: 204, - RESET_CONTENT: 205, - PARTIAL_CONTENT: 206, - - // Redirection 3xx - MULTIPLE_CHOICES: 300, - MOVED_PERMANENTLY: 301, - FOUND: 302, - SEE_OTHER: 303, - NOT_MODIFIED: 304, - USE_PROXY: 305, - TEMPORARY_REDIRECT: 307, - - // Client Error 4xx - BAD_REQUEST: 400, - UNAUTHORIZED: 401, - PAYMENT_REQUIRED: 402, - FORBIDDEN: 403, - NOT_FOUND: 404, - METHOD_NOT_ALLOWED: 405, - NOT_ACCEPTABLE: 406, - PROXY_AUTHENTICATION_REQUIRED: 407, - REQUEST_TIMEOUT: 408, - CONFLICT: 409, - GONE: 410, - LENGTH_REQUIRED: 411, - PRECONDITION_FAILED: 412, - REQUEST_ENTITY_TOO_LARGE: 413, - REQUEST_URI_TOO_LONG: 414, - UNSUPPORTED_MEDIA_TYPE: 415, - REQUEST_RANGE_NOT_SATISFIABLE: 416, - EXPECTATION_FAILED: 417, - PRECONDITION_REQUIRED: 428, - TOO_MANY_REQUESTS: 429, - REQUEST_HEADER_FIELDS_TOO_LARGE: 431, - - // Server Error 5xx - INTERNAL_SERVER_ERROR: 500, - NOT_IMPLEMENTED: 501, - BAD_GATEWAY: 502, - SERVICE_UNAVAILABLE: 503, - GATEWAY_TIMEOUT: 504, - HTTP_VERSION_NOT_SUPPORTED: 505, - NETWORK_AUTHENTICATION_REQUIRED: 511, - - /* - * IE returns this code for 204 due to its use of URLMon, which returns this - * code for 'Operation Aborted'. The status text is 'Unknown', the response - * headers are ''. Known to occur on IE 6 on XP through IE9 on Win7. - */ - QUIRK_IE_NO_CONTENT: 1223 -}; - - -/** - * Returns whether the given status should be considered successful. - * - * Successful codes are OK (200), CREATED (201), ACCEPTED (202), - * NO CONTENT (204), PARTIAL CONTENT (206), NOT MODIFIED (304), - * and IE's no content code (1223). - * - * @param {number} status The status code to test. - * @return {boolean} Whether the status code should be considered successful. - */ -goog.net.HttpStatus.isSuccess = function(status) { - switch (status) { - case goog.net.HttpStatus.OK: - case goog.net.HttpStatus.CREATED: - case goog.net.HttpStatus.ACCEPTED: - case goog.net.HttpStatus.NO_CONTENT: - case goog.net.HttpStatus.PARTIAL_CONTENT: - case goog.net.HttpStatus.NOT_MODIFIED: - case goog.net.HttpStatus.QUIRK_IE_NO_CONTENT: - return true; - - default: - return false; - } -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -goog.provide('goog.net.XhrLike'); - - - -/** - * Interface for the common parts of XMLHttpRequest. - * - * Mostly copied from externs/w3c_xml.js. - * - * @interface - * @see http://www.w3.org/TR/XMLHttpRequest/ - */ -goog.net.XhrLike = function() {}; - - -/** - * Typedef that refers to either native or custom-implemented XHR objects. - * @typedef {!goog.net.XhrLike|!XMLHttpRequest} - */ -goog.net.XhrLike.OrNative; - - -/** - * @type {function()|null|undefined} - * @see http://www.w3.org/TR/XMLHttpRequest/#handler-xhr-onreadystatechange - */ -goog.net.XhrLike.prototype.onreadystatechange; - - -/** - * @type {string} - * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsetext-attribute - */ -goog.net.XhrLike.prototype.responseText; - - -/** - * @type {Document} - * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsexml-attribute - */ -goog.net.XhrLike.prototype.responseXML; - - -/** - * @type {number} - * @see http://www.w3.org/TR/XMLHttpRequest/#readystate - */ -goog.net.XhrLike.prototype.readyState; - - -/** - * @type {number} - * @see http://www.w3.org/TR/XMLHttpRequest/#status - */ -goog.net.XhrLike.prototype.status; - - -/** - * @type {string} - * @see http://www.w3.org/TR/XMLHttpRequest/#statustext - */ -goog.net.XhrLike.prototype.statusText; - - -/** - * @param {string} method - * @param {string} url - * @param {?boolean=} opt_async - * @param {?string=} opt_user - * @param {?string=} opt_password - * @see http://www.w3.org/TR/XMLHttpRequest/#the-open()-method - */ -goog.net.XhrLike.prototype.open = function(method, url, opt_async, opt_user, - opt_password) {}; - - -/** - * @param {ArrayBuffer|ArrayBufferView|Blob|Document|FormData|string=} opt_data - * @see http://www.w3.org/TR/XMLHttpRequest/#the-send()-method - */ -goog.net.XhrLike.prototype.send = function(opt_data) {}; - - -/** - * @see http://www.w3.org/TR/XMLHttpRequest/#the-abort()-method - */ -goog.net.XhrLike.prototype.abort = function() {}; - - -/** - * @param {string} header - * @param {string} value - * @see http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader()-method - */ -goog.net.XhrLike.prototype.setRequestHeader = function(header, value) {}; - - -/** - * @param {string} header - * @return {string} - * @see http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method - */ -goog.net.XhrLike.prototype.getResponseHeader = function(header) {}; - - -/** - * @return {string} - * @see http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders()-method - */ -goog.net.XhrLike.prototype.getAllResponseHeaders = function() {}; - -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Interface for a factory for creating XMLHttpRequest objects - * and metadata about them. - * @author dbk@google.com (David Barrett-Kahn) - */ - -goog.provide('goog.net.XmlHttpFactory'); - -/** @suppress {extraRequire} Typedef. */ -goog.require('goog.net.XhrLike'); - - - -/** - * Abstract base class for an XmlHttpRequest factory. - * @constructor - */ -goog.net.XmlHttpFactory = function() { -}; - - -/** - * Cache of options - we only actually call internalGetOptions once. - * @type {Object} - * @private - */ -goog.net.XmlHttpFactory.prototype.cachedOptions_ = null; - - -/** - * @return {!goog.net.XhrLike.OrNative} A new XhrLike instance. - */ -goog.net.XmlHttpFactory.prototype.createInstance = goog.abstractMethod; - - -/** - * @return {Object} Options describing how xhr objects obtained from this - * factory should be used. - */ -goog.net.XmlHttpFactory.prototype.getOptions = function() { - return this.cachedOptions_ || - (this.cachedOptions_ = this.internalGetOptions()); -}; - - -/** - * Override this method in subclasses to preserve the caching offered by - * getOptions(). - * @return {Object} Options describing how xhr objects obtained from this - * factory should be used. - * @protected - */ -goog.net.XmlHttpFactory.prototype.internalGetOptions = goog.abstractMethod; - -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Implementation of XmlHttpFactory which allows construction from - * simple factory methods. - * @author dbk@google.com (David Barrett-Kahn) - */ - -goog.provide('goog.net.WrapperXmlHttpFactory'); - -/** @suppress {extraRequire} Typedef. */ -goog.require('goog.net.XhrLike'); -goog.require('goog.net.XmlHttpFactory'); - - - -/** - * An xhr factory subclass which can be constructed using two factory methods. - * This exists partly to allow the preservation of goog.net.XmlHttp.setFactory() - * with an unchanged signature. - * @param {function():!goog.net.XhrLike.OrNative} xhrFactory - * A function which returns a new XHR object. - * @param {function():!Object} optionsFactory A function which returns the - * options associated with xhr objects from this factory. - * @extends {goog.net.XmlHttpFactory} - * @constructor - * @final - */ -goog.net.WrapperXmlHttpFactory = function(xhrFactory, optionsFactory) { - goog.net.XmlHttpFactory.call(this); - - /** - * XHR factory method. - * @type {function() : !goog.net.XhrLike.OrNative} - * @private - */ - this.xhrFactory_ = xhrFactory; - - /** - * Options factory method. - * @type {function() : !Object} - * @private - */ - this.optionsFactory_ = optionsFactory; -}; -goog.inherits(goog.net.WrapperXmlHttpFactory, goog.net.XmlHttpFactory); - - -/** @override */ -goog.net.WrapperXmlHttpFactory.prototype.createInstance = function() { - return this.xhrFactory_(); -}; - - -/** @override */ -goog.net.WrapperXmlHttpFactory.prototype.getOptions = function() { - return this.optionsFactory_(); -}; - - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Low level handling of XMLHttpRequest. - * @author arv@google.com (Erik Arvidsson) - * @author dbk@google.com (David Barrett-Kahn) - */ - -goog.provide('goog.net.DefaultXmlHttpFactory'); -goog.provide('goog.net.XmlHttp'); -goog.provide('goog.net.XmlHttp.OptionType'); -goog.provide('goog.net.XmlHttp.ReadyState'); -goog.provide('goog.net.XmlHttpDefines'); - -goog.require('goog.asserts'); -goog.require('goog.net.WrapperXmlHttpFactory'); -goog.require('goog.net.XmlHttpFactory'); - - -/** - * Static class for creating XMLHttpRequest objects. - * @return {!goog.net.XhrLike.OrNative} A new XMLHttpRequest object. - */ -goog.net.XmlHttp = function() { - return goog.net.XmlHttp.factory_.createInstance(); -}; - - -/** - * @define {boolean} Whether to assume XMLHttpRequest exists. Setting this to - * true bypasses the ActiveX probing code. - * NOTE(ruilopes): Due to the way JSCompiler works, this define *will not* strip - * out the ActiveX probing code from binaries. To achieve this, use - * {@code goog.net.XmlHttpDefines.ASSUME_NATIVE_XHR} instead. - * TODO(ruilopes): Collapse both defines. - */ -goog.define('goog.net.XmlHttp.ASSUME_NATIVE_XHR', false); - - -/** @const */ -goog.net.XmlHttpDefines = {}; - - -/** - * @define {boolean} Whether to assume XMLHttpRequest exists. Setting this to - * true eliminates the ActiveX probing code. - */ -goog.define('goog.net.XmlHttpDefines.ASSUME_NATIVE_XHR', false); - - -/** - * Gets the options to use with the XMLHttpRequest objects obtained using - * the static methods. - * @return {Object} The options. - */ -goog.net.XmlHttp.getOptions = function() { - return goog.net.XmlHttp.factory_.getOptions(); -}; - - -/** - * Type of options that an XmlHttp object can have. - * @enum {number} - */ -goog.net.XmlHttp.OptionType = { - /** - * Whether a goog.nullFunction should be used to clear the onreadystatechange - * handler instead of null. - */ - USE_NULL_FUNCTION: 0, - - /** - * NOTE(user): In IE if send() errors on a *local* request the readystate - * is still changed to COMPLETE. We need to ignore it and allow the - * try/catch around send() to pick up the error. - */ - LOCAL_REQUEST_ERROR: 1 -}; - - -/** - * Status constants for XMLHTTP, matches: - * http://msdn.microsoft.com/library/default.asp?url=/library/ - * en-us/xmlsdk/html/0e6a34e4-f90c-489d-acff-cb44242fafc6.asp - * @enum {number} - */ -goog.net.XmlHttp.ReadyState = { - /** - * Constant for when xmlhttprequest.readyState is uninitialized - */ - UNINITIALIZED: 0, - - /** - * Constant for when xmlhttprequest.readyState is loading. - */ - LOADING: 1, - - /** - * Constant for when xmlhttprequest.readyState is loaded. - */ - LOADED: 2, - - /** - * Constant for when xmlhttprequest.readyState is in an interactive state. - */ - INTERACTIVE: 3, - - /** - * Constant for when xmlhttprequest.readyState is completed - */ - COMPLETE: 4 -}; - - -/** - * The global factory instance for creating XMLHttpRequest objects. - * @type {goog.net.XmlHttpFactory} - * @private - */ -goog.net.XmlHttp.factory_; - - -/** - * Sets the factories for creating XMLHttpRequest objects and their options. - * @param {Function} factory The factory for XMLHttpRequest objects. - * @param {Function} optionsFactory The factory for options. - * @deprecated Use setGlobalFactory instead. - */ -goog.net.XmlHttp.setFactory = function(factory, optionsFactory) { - goog.net.XmlHttp.setGlobalFactory(new goog.net.WrapperXmlHttpFactory( - goog.asserts.assert(factory), - goog.asserts.assert(optionsFactory))); -}; - - -/** - * Sets the global factory object. - * @param {!goog.net.XmlHttpFactory} factory New global factory object. - */ -goog.net.XmlHttp.setGlobalFactory = function(factory) { - goog.net.XmlHttp.factory_ = factory; -}; - - - -/** - * Default factory to use when creating xhr objects. You probably shouldn't be - * instantiating this directly, but rather using it via goog.net.XmlHttp. - * @extends {goog.net.XmlHttpFactory} - * @constructor - */ -goog.net.DefaultXmlHttpFactory = function() { - goog.net.XmlHttpFactory.call(this); -}; -goog.inherits(goog.net.DefaultXmlHttpFactory, goog.net.XmlHttpFactory); - - -/** @override */ -goog.net.DefaultXmlHttpFactory.prototype.createInstance = function() { - var progId = this.getProgId_(); - if (progId) { - return new ActiveXObject(progId); - } else { - return new XMLHttpRequest(); - } -}; - - -/** @override */ -goog.net.DefaultXmlHttpFactory.prototype.internalGetOptions = function() { - var progId = this.getProgId_(); - var options = {}; - if (progId) { - options[goog.net.XmlHttp.OptionType.USE_NULL_FUNCTION] = true; - options[goog.net.XmlHttp.OptionType.LOCAL_REQUEST_ERROR] = true; - } - return options; -}; - - -/** - * The ActiveX PROG ID string to use to create xhr's in IE. Lazily initialized. - * @type {string|undefined} - * @private - */ -goog.net.DefaultXmlHttpFactory.prototype.ieProgId_; - - -/** - * Initialize the private state used by other functions. - * @return {string} The ActiveX PROG ID string to use to create xhr's in IE. - * @private - */ -goog.net.DefaultXmlHttpFactory.prototype.getProgId_ = function() { - if (goog.net.XmlHttp.ASSUME_NATIVE_XHR || - goog.net.XmlHttpDefines.ASSUME_NATIVE_XHR) { - return ''; - } - - // The following blog post describes what PROG IDs to use to create the - // XMLHTTP object in Internet Explorer: - // http://blogs.msdn.com/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx - // However we do not (yet) fully trust that this will be OK for old versions - // of IE on Win9x so we therefore keep the last 2. - if (!this.ieProgId_ && typeof XMLHttpRequest == 'undefined' && - typeof ActiveXObject != 'undefined') { - // Candidate Active X types. - var ACTIVE_X_IDENTS = ['MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.3.0', - 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP']; - for (var i = 0; i < ACTIVE_X_IDENTS.length; i++) { - var candidate = ACTIVE_X_IDENTS[i]; - /** @preserveTry */ - try { - new ActiveXObject(candidate); - // NOTE(user): cannot assign progid and return candidate in one line - // because JSCompiler complaings: BUG 658126 - this.ieProgId_ = candidate; - return candidate; - } catch (e) { - // do nothing; try next choice - } - } - - // couldn't find any matches - throw Error('Could not create ActiveXObject. ActiveX might be disabled,' + - ' or MSXML might not be installed'); - } - - return /** @type {string} */ (this.ieProgId_); -}; - - -//Set the global factory to an instance of the default factory. -goog.net.XmlHttp.setGlobalFactory(new goog.net.DefaultXmlHttpFactory()); - -// Copyright 2008 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Simple utilities for dealing with URI strings. - * - * This is intended to be a lightweight alternative to constructing goog.Uri - * objects. Whereas goog.Uri adds several kilobytes to the binary regardless - * of how much of its functionality you use, this is designed to be a set of - * mostly-independent utilities so that the compiler includes only what is - * necessary for the task. Estimated savings of porting is 5k pre-gzip and - * 1.5k post-gzip. To ensure the savings remain, future developers should - * avoid adding new functionality to existing functions, but instead create - * new ones and factor out shared code. - * - * Many of these utilities have limited functionality, tailored to common - * cases. The query parameter utilities assume that the parameter keys are - * already encoded, since most keys are compile-time alphanumeric strings. The - * query parameter mutation utilities also do not tolerate fragment identifiers. - * - * By design, these functions can be slower than goog.Uri equivalents. - * Repeated calls to some of functions may be quadratic in behavior for IE, - * although the effect is somewhat limited given the 2kb limit. - * - * One advantage of the limited functionality here is that this approach is - * less sensitive to differences in URI encodings than goog.Uri, since these - * functions operate on strings directly, rather than decoding them and - * then re-encoding. - * - * Uses features of RFC 3986 for parsing/formatting URIs: - * http://www.ietf.org/rfc/rfc3986.txt - * - * @author gboyer@google.com (Garrett Boyer) - The "lightened" design. - */ - -goog.provide('goog.uri.utils'); -goog.provide('goog.uri.utils.ComponentIndex'); -goog.provide('goog.uri.utils.QueryArray'); -goog.provide('goog.uri.utils.QueryValue'); -goog.provide('goog.uri.utils.StandardQueryParam'); - -goog.require('goog.asserts'); -goog.require('goog.string'); - - -/** - * Character codes inlined to avoid object allocations due to charCode. - * @enum {number} - * @private - */ -goog.uri.utils.CharCode_ = { - AMPERSAND: 38, - EQUAL: 61, - HASH: 35, - QUESTION: 63 -}; - - -/** - * Builds a URI string from already-encoded parts. - * - * No encoding is performed. Any component may be omitted as either null or - * undefined. - * - * @param {?string=} opt_scheme The scheme such as 'http'. - * @param {?string=} opt_userInfo The user name before the '@'. - * @param {?string=} opt_domain The domain such as 'www.google.com', already - * URI-encoded. - * @param {(string|number|null)=} opt_port The port number. - * @param {?string=} opt_path The path, already URI-encoded. If it is not - * empty, it must begin with a slash. - * @param {?string=} opt_queryData The URI-encoded query data. - * @param {?string=} opt_fragment The URI-encoded fragment identifier. - * @return {string} The fully combined URI. - */ -goog.uri.utils.buildFromEncodedParts = function(opt_scheme, opt_userInfo, - opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { - var out = ''; - - if (opt_scheme) { - out += opt_scheme + ':'; - } - - if (opt_domain) { - out += '//'; - - if (opt_userInfo) { - out += opt_userInfo + '@'; - } - - out += opt_domain; - - if (opt_port) { - out += ':' + opt_port; - } - } - - if (opt_path) { - out += opt_path; - } - - if (opt_queryData) { - out += '?' + opt_queryData; - } - - if (opt_fragment) { - out += '#' + opt_fragment; - } - - return out; -}; - - -/** - * A regular expression for breaking a URI into its component parts. - * - * {@link http://www.ietf.org/rfc/rfc3986.txt} says in Appendix B - * As the "first-match-wins" algorithm is identical to the "greedy" - * disambiguation method used by POSIX regular expressions, it is natural and - * commonplace to use a regular expression for parsing the potential five - * components of a URI reference. - * - * The following line is the regular expression for breaking-down a - * well-formed URI reference into its components. - * - * <pre> - * ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? - * 12 3 4 5 6 7 8 9 - * </pre> - * - * The numbers in the second line above are only to assist readability; they - * indicate the reference points for each subexpression (i.e., each paired - * parenthesis). We refer to the value matched for subexpression <n> as $<n>. - * For example, matching the above expression to - * <pre> - * http://www.ics.uci.edu/pub/ietf/uri/#Related - * </pre> - * results in the following subexpression matches: - * <pre> - * $1 = http: - * $2 = http - * $3 = //www.ics.uci.edu - * $4 = www.ics.uci.edu - * $5 = /pub/ietf/uri/ - * $6 = <undefined> - * $7 = <undefined> - * $8 = #Related - * $9 = Related - * </pre> - * where <undefined> indicates that the component is not present, as is the - * case for the query component in the above example. Therefore, we can - * determine the value of the five components as - * <pre> - * scheme = $2 - * authority = $4 - * path = $5 - * query = $7 - * fragment = $9 - * </pre> - * - * The regular expression has been modified slightly to expose the - * userInfo, domain, and port separately from the authority. - * The modified version yields - * <pre> - * $1 = http scheme - * $2 = <undefined> userInfo -\ - * $3 = www.ics.uci.edu domain | authority - * $4 = <undefined> port -/ - * $5 = /pub/ietf/uri/ path - * $6 = <undefined> query without ? - * $7 = Related fragment without # - * </pre> - * @type {!RegExp} - * @private - */ -goog.uri.utils.splitRe_ = new RegExp( - '^' + - '(?:' + - '([^:/?#.]+)' + // scheme - ignore special characters - // used by other URL parts such as :, - // ?, /, #, and . - ':)?' + - '(?://' + - '(?:([^/?#]*)@)?' + // userInfo - '([^/#?]*?)' + // domain - '(?::([0-9]+))?' + // port - '(?=[/#?]|$)' + // authority-terminating character - ')?' + - '([^?#]+)?' + // path - '(?:\\?([^#]*))?' + // query - '(?:#(.*))?' + // fragment - '$'); - - -/** - * The index of each URI component in the return value of goog.uri.utils.split. - * @enum {number} - */ -goog.uri.utils.ComponentIndex = { - SCHEME: 1, - USER_INFO: 2, - DOMAIN: 3, - PORT: 4, - PATH: 5, - QUERY_DATA: 6, - FRAGMENT: 7 -}; - - -/** - * Splits a URI into its component parts. - * - * Each component can be accessed via the component indices; for example: - * <pre> - * goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA]; - * </pre> - * - * @param {string} uri The URI string to examine. - * @return {!Array<string|undefined>} Each component still URI-encoded. - * Each component that is present will contain the encoded value, whereas - * components that are not present will be undefined or empty, depending - * on the browser's regular expression implementation. Never null, since - * arbitrary strings may still look like path names. - */ -goog.uri.utils.split = function(uri) { - // See @return comment -- never null. - return /** @type {!Array<string|undefined>} */ ( - uri.match(goog.uri.utils.splitRe_)); -}; - - -/** - * @param {?string} uri A possibly null string. - * @param {boolean=} opt_preserveReserved If true, percent-encoding of RFC-3986 - * reserved characters will not be removed. - * @return {?string} The string URI-decoded, or null if uri is null. - * @private - */ -goog.uri.utils.decodeIfPossible_ = function(uri, opt_preserveReserved) { - if (!uri) { - return uri; - } - - return opt_preserveReserved ? decodeURI(uri) : decodeURIComponent(uri); -}; - - -/** - * Gets a URI component by index. - * - * It is preferred to use the getPathEncoded() variety of functions ahead, - * since they are more readable. - * - * @param {goog.uri.utils.ComponentIndex} componentIndex The component index. - * @param {string} uri The URI to examine. - * @return {?string} The still-encoded component, or null if the component - * is not present. - * @private - */ -goog.uri.utils.getComponentByIndex_ = function(componentIndex, uri) { - // Convert undefined, null, and empty string into null. - return goog.uri.utils.split(uri)[componentIndex] || null; -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The protocol or scheme, or null if none. Does not - * include trailing colons or slashes. - */ -goog.uri.utils.getScheme = function(uri) { - return goog.uri.utils.getComponentByIndex_( - goog.uri.utils.ComponentIndex.SCHEME, uri); -}; - - -/** - * Gets the effective scheme for the URL. If the URL is relative then the - * scheme is derived from the page's location. - * @param {string} uri The URI to examine. - * @return {string} The protocol or scheme, always lower case. - */ -goog.uri.utils.getEffectiveScheme = function(uri) { - var scheme = goog.uri.utils.getScheme(uri); - if (!scheme && goog.global.self && goog.global.self.location) { - var protocol = goog.global.self.location.protocol; - scheme = protocol.substr(0, protocol.length - 1); - } - // NOTE: When called from a web worker in Firefox 3.5, location maybe null. - // All other browsers with web workers support self.location from the worker. - return scheme ? scheme.toLowerCase() : ''; -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The user name still encoded, or null if none. - */ -goog.uri.utils.getUserInfoEncoded = function(uri) { - return goog.uri.utils.getComponentByIndex_( - goog.uri.utils.ComponentIndex.USER_INFO, uri); -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The decoded user info, or null if none. - */ -goog.uri.utils.getUserInfo = function(uri) { - return goog.uri.utils.decodeIfPossible_( - goog.uri.utils.getUserInfoEncoded(uri)); -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The domain name still encoded, or null if none. - */ -goog.uri.utils.getDomainEncoded = function(uri) { - return goog.uri.utils.getComponentByIndex_( - goog.uri.utils.ComponentIndex.DOMAIN, uri); -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The decoded domain, or null if none. - */ -goog.uri.utils.getDomain = function(uri) { - return goog.uri.utils.decodeIfPossible_( - goog.uri.utils.getDomainEncoded(uri), true /* opt_preserveReserved */); -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?number} The port number, or null if none. - */ -goog.uri.utils.getPort = function(uri) { - // Coerce to a number. If the result of getComponentByIndex_ is null or - // non-numeric, the number coersion yields NaN. This will then return - // null for all non-numeric cases (though also zero, which isn't a relevant - // port number). - return Number(goog.uri.utils.getComponentByIndex_( - goog.uri.utils.ComponentIndex.PORT, uri)) || null; -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The path still encoded, or null if none. Includes the - * leading slash, if any. - */ -goog.uri.utils.getPathEncoded = function(uri) { - return goog.uri.utils.getComponentByIndex_( - goog.uri.utils.ComponentIndex.PATH, uri); -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The decoded path, or null if none. Includes the leading - * slash, if any. - */ -goog.uri.utils.getPath = function(uri) { - return goog.uri.utils.decodeIfPossible_( - goog.uri.utils.getPathEncoded(uri), true /* opt_preserveReserved */); -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The query data still encoded, or null if none. Does not - * include the question mark itself. - */ -goog.uri.utils.getQueryData = function(uri) { - return goog.uri.utils.getComponentByIndex_( - goog.uri.utils.ComponentIndex.QUERY_DATA, uri); -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The fragment identifier, or null if none. Does not - * include the hash mark itself. - */ -goog.uri.utils.getFragmentEncoded = function(uri) { - // The hash mark may not appear in any other part of the URL. - var hashIndex = uri.indexOf('#'); - return hashIndex < 0 ? null : uri.substr(hashIndex + 1); -}; - - -/** - * @param {string} uri The URI to examine. - * @param {?string} fragment The encoded fragment identifier, or null if none. - * Does not include the hash mark itself. - * @return {string} The URI with the fragment set. - */ -goog.uri.utils.setFragmentEncoded = function(uri, fragment) { - return goog.uri.utils.removeFragment(uri) + (fragment ? '#' + fragment : ''); -}; - - -/** - * @param {string} uri The URI to examine. - * @return {?string} The decoded fragment identifier, or null if none. Does - * not include the hash mark. - */ -goog.uri.utils.getFragment = function(uri) { - return goog.uri.utils.decodeIfPossible_( - goog.uri.utils.getFragmentEncoded(uri)); -}; - - -/** - * Extracts everything up to the port of the URI. - * @param {string} uri The URI string. - * @return {string} Everything up to and including the port. - */ -goog.uri.utils.getHost = function(uri) { - var pieces = goog.uri.utils.split(uri); - return goog.uri.utils.buildFromEncodedParts( - pieces[goog.uri.utils.ComponentIndex.SCHEME], - pieces[goog.uri.utils.ComponentIndex.USER_INFO], - pieces[goog.uri.utils.ComponentIndex.DOMAIN], - pieces[goog.uri.utils.ComponentIndex.PORT]); -}; - - -/** - * Extracts the path of the URL and everything after. - * @param {string} uri The URI string. - * @return {string} The URI, starting at the path and including the query - * parameters and fragment identifier. - */ -goog.uri.utils.getPathAndAfter = function(uri) { - var pieces = goog.uri.utils.split(uri); - return goog.uri.utils.buildFromEncodedParts(null, null, null, null, - pieces[goog.uri.utils.ComponentIndex.PATH], - pieces[goog.uri.utils.ComponentIndex.QUERY_DATA], - pieces[goog.uri.utils.ComponentIndex.FRAGMENT]); -}; - - -/** - * Gets the URI with the fragment identifier removed. - * @param {string} uri The URI to examine. - * @return {string} Everything preceding the hash mark. - */ -goog.uri.utils.removeFragment = function(uri) { - // The hash mark may not appear in any other part of the URL. - var hashIndex = uri.indexOf('#'); - return hashIndex < 0 ? uri : uri.substr(0, hashIndex); -}; - - -/** - * Ensures that two URI's have the exact same domain, scheme, and port. - * - * Unlike the version in goog.Uri, this checks protocol, and therefore is - * suitable for checking against the browser's same-origin policy. - * - * @param {string} uri1 The first URI. - * @param {string} uri2 The second URI. - * @return {boolean} Whether they have the same scheme, domain and port. - */ -goog.uri.utils.haveSameDomain = function(uri1, uri2) { - var pieces1 = goog.uri.utils.split(uri1); - var pieces2 = goog.uri.utils.split(uri2); - return pieces1[goog.uri.utils.ComponentIndex.DOMAIN] == - pieces2[goog.uri.utils.ComponentIndex.DOMAIN] && - pieces1[goog.uri.utils.ComponentIndex.SCHEME] == - pieces2[goog.uri.utils.ComponentIndex.SCHEME] && - pieces1[goog.uri.utils.ComponentIndex.PORT] == - pieces2[goog.uri.utils.ComponentIndex.PORT]; -}; - - -/** - * Asserts that there are no fragment or query identifiers, only in uncompiled - * mode. - * @param {string} uri The URI to examine. - * @private - */ -goog.uri.utils.assertNoFragmentsOrQueries_ = function(uri) { - // NOTE: would use goog.asserts here, but jscompiler doesn't know that - // indexOf has no side effects. - if (goog.DEBUG && (uri.indexOf('#') >= 0 || uri.indexOf('?') >= 0)) { - throw Error('goog.uri.utils: Fragment or query identifiers are not ' + - 'supported: [' + uri + ']'); - } -}; - - -/** - * Supported query parameter values by the parameter serializing utilities. - * - * If a value is null or undefined, the key-value pair is skipped, as an easy - * way to omit parameters conditionally. Non-array parameters are converted - * to a string and URI encoded. Array values are expanded into multiple - * &key=value pairs, with each element stringized and URI-encoded. - * - * @typedef {*} - */ -goog.uri.utils.QueryValue; - - -/** - * An array representing a set of query parameters with alternating keys - * and values. - * - * Keys are assumed to be URI encoded already and live at even indices. See - * goog.uri.utils.QueryValue for details on how parameter values are encoded. - * - * Example: - * <pre> - * var data = [ - * // Simple param: ?name=BobBarker - * 'name', 'BobBarker', - * // Conditional param -- may be omitted entirely. - * 'specialDietaryNeeds', hasDietaryNeeds() ? getDietaryNeeds() : null, - * // Multi-valued param: &house=LosAngeles&house=NewYork&house=null - * 'house', ['LosAngeles', 'NewYork', null] - * ]; - * </pre> - * - * @typedef {!Array<string|goog.uri.utils.QueryValue>} - */ -goog.uri.utils.QueryArray; - - -/** - * Parses encoded query parameters and calls callback function for every - * parameter found in the string. - * - * Missing value of parameter (e.g. “…&key&…”) is treated as if the value was an - * empty string. Keys may be empty strings (e.g. “…&=value&…”) which also means - * that “…&=&…” and “…&&…” will result in an empty key and value. - * - * @param {string} encodedQuery Encoded query string excluding question mark at - * the beginning. - * @param {function(string, string)} callback Function called for every - * parameter found in query string. The first argument (name) will not be - * urldecoded (so the function is consistent with buildQueryData), but the - * second will. If the parameter has no value (i.e. “=” was not present) - * the second argument (value) will be an empty string. - */ -goog.uri.utils.parseQueryData = function(encodedQuery, callback) { - if (!encodedQuery) { - return; - } - var pairs = encodedQuery.split('&'); - for (var i = 0; i < pairs.length; i++) { - var indexOfEquals = pairs[i].indexOf('='); - var name = null; - var value = null; - if (indexOfEquals >= 0) { - name = pairs[i].substring(0, indexOfEquals); - value = pairs[i].substring(indexOfEquals + 1); - } else { - name = pairs[i]; - } - callback(name, value ? goog.string.urlDecode(value) : ''); - } -}; - - -/** - * Appends a URI and query data in a string buffer with special preconditions. - * - * Internal implementation utility, performing very few object allocations. - * - * @param {!Array<string|undefined>} buffer A string buffer. The first element - * must be the base URI, and may have a fragment identifier. If the array - * contains more than one element, the second element must be an ampersand, - * and may be overwritten, depending on the base URI. Undefined elements - * are treated as empty-string. - * @return {string} The concatenated URI and query data. - * @private - */ -goog.uri.utils.appendQueryData_ = function(buffer) { - if (buffer[1]) { - // At least one query parameter was added. We need to check the - // punctuation mark, which is currently an ampersand, and also make sure - // there aren't any interfering fragment identifiers. - var baseUri = /** @type {string} */ (buffer[0]); - var hashIndex = baseUri.indexOf('#'); - if (hashIndex >= 0) { - // Move the fragment off the base part of the URI into the end. - buffer.push(baseUri.substr(hashIndex)); - buffer[0] = baseUri = baseUri.substr(0, hashIndex); - } - var questionIndex = baseUri.indexOf('?'); - if (questionIndex < 0) { - // No question mark, so we need a question mark instead of an ampersand. - buffer[1] = '?'; - } else if (questionIndex == baseUri.length - 1) { - // Question mark is the very last character of the existing URI, so don't - // append an additional delimiter. - buffer[1] = undefined; - } - } - - return buffer.join(''); -}; - - -/** - * Appends key=value pairs to an array, supporting multi-valued objects. - * @param {string} key The key prefix. - * @param {goog.uri.utils.QueryValue} value The value to serialize. - * @param {!Array<string>} pairs The array to which the 'key=value' strings - * should be appended. - * @private - */ -goog.uri.utils.appendKeyValuePairs_ = function(key, value, pairs) { - if (goog.isArray(value)) { - // Convince the compiler it's an array. - goog.asserts.assertArray(value); - for (var j = 0; j < value.length; j++) { - // Convert to string explicitly, to short circuit the null and array - // logic in this function -- this ensures that null and undefined get - // written as literal 'null' and 'undefined', and arrays don't get - // expanded out but instead encoded in the default way. - goog.uri.utils.appendKeyValuePairs_(key, String(value[j]), pairs); - } - } else if (value != null) { - // Skip a top-level null or undefined entirely. - pairs.push('&', key, - // Check for empty string. Zero gets encoded into the url as literal - // strings. For empty string, skip the equal sign, to be consistent - // with UriBuilder.java. - value === '' ? '' : '=', - goog.string.urlEncode(value)); - } -}; - - -/** - * Builds a buffer of query data from a sequence of alternating keys and values. - * - * @param {!Array<string|undefined>} buffer A string buffer to append to. The - * first element appended will be an '&', and may be replaced by the caller. - * @param {!goog.uri.utils.QueryArray|!Arguments} keysAndValues An array with - * alternating keys and values -- see the typedef. - * @param {number=} opt_startIndex A start offset into the arary, defaults to 0. - * @return {!Array<string|undefined>} The buffer argument. - * @private - */ -goog.uri.utils.buildQueryDataBuffer_ = function( - buffer, keysAndValues, opt_startIndex) { - goog.asserts.assert(Math.max(keysAndValues.length - (opt_startIndex || 0), - 0) % 2 == 0, 'goog.uri.utils: Key/value lists must be even in length.'); - - for (var i = opt_startIndex || 0; i < keysAndValues.length; i += 2) { - goog.uri.utils.appendKeyValuePairs_( - keysAndValues[i], keysAndValues[i + 1], buffer); - } - - return buffer; -}; - - -/** - * Builds a query data string from a sequence of alternating keys and values. - * Currently generates "&key&" for empty args. - * - * @param {goog.uri.utils.QueryArray} keysAndValues Alternating keys and - * values. See the typedef. - * @param {number=} opt_startIndex A start offset into the arary, defaults to 0. - * @return {string} The encoded query string, in the form 'a=1&b=2'. - */ -goog.uri.utils.buildQueryData = function(keysAndValues, opt_startIndex) { - var buffer = goog.uri.utils.buildQueryDataBuffer_( - [], keysAndValues, opt_startIndex); - buffer[0] = ''; // Remove the leading ampersand. - return buffer.join(''); -}; - - -/** - * Builds a buffer of query data from a map. - * - * @param {!Array<string|undefined>} buffer A string buffer to append to. The - * first element appended will be an '&', and may be replaced by the caller. - * @param {!Object<string, goog.uri.utils.QueryValue>} map An object where keys - * are URI-encoded parameter keys, and the values conform to the contract - * specified in the goog.uri.utils.QueryValue typedef. - * @return {!Array<string|undefined>} The buffer argument. - * @private - */ -goog.uri.utils.buildQueryDataBufferFromMap_ = function(buffer, map) { - for (var key in map) { - goog.uri.utils.appendKeyValuePairs_(key, map[key], buffer); - } - - return buffer; -}; - - -/** - * Builds a query data string from a map. - * Currently generates "&key&" for empty args. - * - * @param {!Object<string, goog.uri.utils.QueryValue>} map An object where keys - * are URI-encoded parameter keys, and the values are arbitrary types - * or arrays. Keys with a null value are dropped. - * @return {string} The encoded query string, in the form 'a=1&b=2'. - */ -goog.uri.utils.buildQueryDataFromMap = function(map) { - var buffer = goog.uri.utils.buildQueryDataBufferFromMap_([], map); - buffer[0] = ''; - return buffer.join(''); -}; - - -/** - * Appends URI parameters to an existing URI. - * - * The variable arguments may contain alternating keys and values. Keys are - * assumed to be already URI encoded. The values should not be URI-encoded, - * and will instead be encoded by this function. - * <pre> - * appendParams('http://www.foo.com?existing=true', - * 'key1', 'value1', - * 'key2', 'value?willBeEncoded', - * 'key3', ['valueA', 'valueB', 'valueC'], - * 'key4', null); - * result: 'http://www.foo.com?existing=true&' + - * 'key1=value1&' + - * 'key2=value%3FwillBeEncoded&' + - * 'key3=valueA&key3=valueB&key3=valueC' - * </pre> - * - * A single call to this function will not exhibit quadratic behavior in IE, - * whereas multiple repeated calls may, although the effect is limited by - * fact that URL's generally can't exceed 2kb. - * - * @param {string} uri The original URI, which may already have query data. - * @param {...(goog.uri.utils.QueryArray|string|goog.uri.utils.QueryValue)} var_args - * An array or argument list conforming to goog.uri.utils.QueryArray. - * @return {string} The URI with all query parameters added. - */ -goog.uri.utils.appendParams = function(uri, var_args) { - return goog.uri.utils.appendQueryData_( - arguments.length == 2 ? - goog.uri.utils.buildQueryDataBuffer_([uri], arguments[1], 0) : - goog.uri.utils.buildQueryDataBuffer_([uri], arguments, 1)); -}; - - -/** - * Appends query parameters from a map. - * - * @param {string} uri The original URI, which may already have query data. - * @param {!Object<goog.uri.utils.QueryValue>} map An object where keys are - * URI-encoded parameter keys, and the values are arbitrary types or arrays. - * Keys with a null value are dropped. - * @return {string} The new parameters. - */ -goog.uri.utils.appendParamsFromMap = function(uri, map) { - return goog.uri.utils.appendQueryData_( - goog.uri.utils.buildQueryDataBufferFromMap_([uri], map)); -}; - - -/** - * Appends a single URI parameter. - * - * Repeated calls to this can exhibit quadratic behavior in IE6 due to the - * way string append works, though it should be limited given the 2kb limit. - * - * @param {string} uri The original URI, which may already have query data. - * @param {string} key The key, which must already be URI encoded. - * @param {*=} opt_value The value, which will be stringized and encoded - * (assumed not already to be encoded). If omitted, undefined, or null, the - * key will be added as a valueless parameter. - * @return {string} The URI with the query parameter added. - */ -goog.uri.utils.appendParam = function(uri, key, opt_value) { - var paramArr = [uri, '&', key]; - if (goog.isDefAndNotNull(opt_value)) { - paramArr.push('=', goog.string.urlEncode(opt_value)); - } - return goog.uri.utils.appendQueryData_(paramArr); -}; - - -/** - * Finds the next instance of a query parameter with the specified name. - * - * Does not instantiate any objects. - * - * @param {string} uri The URI to search. May contain a fragment identifier - * if opt_hashIndex is specified. - * @param {number} startIndex The index to begin searching for the key at. A - * match may be found even if this is one character after the ampersand. - * @param {string} keyEncoded The URI-encoded key. - * @param {number} hashOrEndIndex Index to stop looking at. If a hash - * mark is present, it should be its index, otherwise it should be the - * length of the string. - * @return {number} The position of the first character in the key's name, - * immediately after either a question mark or a dot. - * @private - */ -goog.uri.utils.findParam_ = function( - uri, startIndex, keyEncoded, hashOrEndIndex) { - var index = startIndex; - var keyLength = keyEncoded.length; - - // Search for the key itself and post-filter for surronuding punctuation, - // rather than expensively building a regexp. - while ((index = uri.indexOf(keyEncoded, index)) >= 0 && - index < hashOrEndIndex) { - var precedingChar = uri.charCodeAt(index - 1); - // Ensure that the preceding character is '&' or '?'. - if (precedingChar == goog.uri.utils.CharCode_.AMPERSAND || - precedingChar == goog.uri.utils.CharCode_.QUESTION) { - // Ensure the following character is '&', '=', '#', or NaN - // (end of string). - var followingChar = uri.charCodeAt(index + keyLength); - if (!followingChar || - followingChar == goog.uri.utils.CharCode_.EQUAL || - followingChar == goog.uri.utils.CharCode_.AMPERSAND || - followingChar == goog.uri.utils.CharCode_.HASH) { - return index; - } - } - index += keyLength + 1; - } - - return -1; -}; - - -/** - * Regular expression for finding a hash mark or end of string. - * @type {RegExp} - * @private - */ -goog.uri.utils.hashOrEndRe_ = /#|$/; - - -/** - * Determines if the URI contains a specific key. - * - * Performs no object instantiations. - * - * @param {string} uri The URI to process. May contain a fragment - * identifier. - * @param {string} keyEncoded The URI-encoded key. Case-sensitive. - * @return {boolean} Whether the key is present. - */ -goog.uri.utils.hasParam = function(uri, keyEncoded) { - return goog.uri.utils.findParam_(uri, 0, keyEncoded, - uri.search(goog.uri.utils.hashOrEndRe_)) >= 0; -}; - - -/** - * Gets the first value of a query parameter. - * @param {string} uri The URI to process. May contain a fragment. - * @param {string} keyEncoded The URI-encoded key. Case-sensitive. - * @return {?string} The first value of the parameter (URI-decoded), or null - * if the parameter is not found. - */ -goog.uri.utils.getParamValue = function(uri, keyEncoded) { - var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_); - var foundIndex = goog.uri.utils.findParam_( - uri, 0, keyEncoded, hashOrEndIndex); - - if (foundIndex < 0) { - return null; - } else { - var endPosition = uri.indexOf('&', foundIndex); - if (endPosition < 0 || endPosition > hashOrEndIndex) { - endPosition = hashOrEndIndex; - } - // Progress forth to the end of the "key=" or "key&" substring. - foundIndex += keyEncoded.length + 1; - // Use substr, because it (unlike substring) will return empty string - // if foundIndex > endPosition. - return goog.string.urlDecode( - uri.substr(foundIndex, endPosition - foundIndex)); - } -}; - - -/** - * Gets all values of a query parameter. - * @param {string} uri The URI to process. May contain a fragment. - * @param {string} keyEncoded The URI-encoded key. Case-sensitive. - * @return {!Array<string>} All URI-decoded values with the given key. - * If the key is not found, this will have length 0, but never be null. - */ -goog.uri.utils.getParamValues = function(uri, keyEncoded) { - var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_); - var position = 0; - var foundIndex; - var result = []; - - while ((foundIndex = goog.uri.utils.findParam_( - uri, position, keyEncoded, hashOrEndIndex)) >= 0) { - // Find where this parameter ends, either the '&' or the end of the - // query parameters. - position = uri.indexOf('&', foundIndex); - if (position < 0 || position > hashOrEndIndex) { - position = hashOrEndIndex; - } - - // Progress forth to the end of the "key=" or "key&" substring. - foundIndex += keyEncoded.length + 1; - // Use substr, because it (unlike substring) will return empty string - // if foundIndex > position. - result.push(goog.string.urlDecode(uri.substr( - foundIndex, position - foundIndex))); - } - - return result; -}; - - -/** - * Regexp to find trailing question marks and ampersands. - * @type {RegExp} - * @private - */ -goog.uri.utils.trailingQueryPunctuationRe_ = /[?&]($|#)/; - - -/** - * Removes all instances of a query parameter. - * @param {string} uri The URI to process. Must not contain a fragment. - * @param {string} keyEncoded The URI-encoded key. - * @return {string} The URI with all instances of the parameter removed. - */ -goog.uri.utils.removeParam = function(uri, keyEncoded) { - var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_); - var position = 0; - var foundIndex; - var buffer = []; - - // Look for a query parameter. - while ((foundIndex = goog.uri.utils.findParam_( - uri, position, keyEncoded, hashOrEndIndex)) >= 0) { - // Get the portion of the query string up to, but not including, the ? - // or & starting the parameter. - buffer.push(uri.substring(position, foundIndex)); - // Progress to immediately after the '&'. If not found, go to the end. - // Avoid including the hash mark. - position = Math.min((uri.indexOf('&', foundIndex) + 1) || hashOrEndIndex, - hashOrEndIndex); - } - - // Append everything that is remaining. - buffer.push(uri.substr(position)); - - // Join the buffer, and remove trailing punctuation that remains. - return buffer.join('').replace( - goog.uri.utils.trailingQueryPunctuationRe_, '$1'); -}; - - -/** - * Replaces all existing definitions of a parameter with a single definition. - * - * Repeated calls to this can exhibit quadratic behavior due to the need to - * find existing instances and reconstruct the string, though it should be - * limited given the 2kb limit. Consider using appendParams to append multiple - * parameters in bulk. - * - * @param {string} uri The original URI, which may already have query data. - * @param {string} keyEncoded The key, which must already be URI encoded. - * @param {*} value The value, which will be stringized and encoded (assumed - * not already to be encoded). - * @return {string} The URI with the query parameter added. - */ -goog.uri.utils.setParam = function(uri, keyEncoded, value) { - return goog.uri.utils.appendParam( - goog.uri.utils.removeParam(uri, keyEncoded), keyEncoded, value); -}; - - -/** - * Generates a URI path using a given URI and a path with checks to - * prevent consecutive "//". The baseUri passed in must not contain - * query or fragment identifiers. The path to append may not contain query or - * fragment identifiers. - * - * @param {string} baseUri URI to use as the base. - * @param {string} path Path to append. - * @return {string} Updated URI. - */ -goog.uri.utils.appendPath = function(baseUri, path) { - goog.uri.utils.assertNoFragmentsOrQueries_(baseUri); - - // Remove any trailing '/' - if (goog.string.endsWith(baseUri, '/')) { - baseUri = baseUri.substr(0, baseUri.length - 1); - } - // Remove any leading '/' - if (goog.string.startsWith(path, '/')) { - path = path.substr(1); - } - return goog.string.buildString(baseUri, '/', path); -}; - - -/** - * Replaces the path. - * @param {string} uri URI to use as the base. - * @param {string} path New path. - * @return {string} Updated URI. - */ -goog.uri.utils.setPath = function(uri, path) { - // Add any missing '/'. - if (!goog.string.startsWith(path, '/')) { - path = '/' + path; - } - var parts = goog.uri.utils.split(uri); - return goog.uri.utils.buildFromEncodedParts( - parts[goog.uri.utils.ComponentIndex.SCHEME], - parts[goog.uri.utils.ComponentIndex.USER_INFO], - parts[goog.uri.utils.ComponentIndex.DOMAIN], - parts[goog.uri.utils.ComponentIndex.PORT], - path, - parts[goog.uri.utils.ComponentIndex.QUERY_DATA], - parts[goog.uri.utils.ComponentIndex.FRAGMENT]); -}; - - -/** - * Standard supported query parameters. - * @enum {string} - */ -goog.uri.utils.StandardQueryParam = { - - /** Unused parameter for unique-ifying. */ - RANDOM: 'zx' -}; - - -/** - * Sets the zx parameter of a URI to a random value. - * @param {string} uri Any URI. - * @return {string} That URI with the "zx" parameter added or replaced to - * contain a random string. - */ -goog.uri.utils.makeUnique = function(uri) { - return goog.uri.utils.setParam(uri, - goog.uri.utils.StandardQueryParam.RANDOM, goog.string.getRandomString()); -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Wrapper class for handling XmlHttpRequests. - * - * One off requests can be sent through goog.net.XhrIo.send() or an - * instance can be created to send multiple requests. Each request uses its - * own XmlHttpRequest object and handles clearing of the event callback to - * ensure no leaks. - * - * XhrIo is event based, it dispatches events on success, failure, finishing, - * ready-state change, or progress. - * - * The ready-state or timeout event fires first, followed by - * a generic completed event. Then the abort, error, or success event - * is fired as appropriate. Progress events are fired as they are - * received. Lastly, the ready event will fire to indicate that the - * object may be used to make another request. - * - * The error event may also be called before completed and - * ready-state-change if the XmlHttpRequest.open() or .send() methods throw. - * - * This class does not support multiple requests, queuing, or prioritization. - * - * When progress events are supported by the browser, and progress is - * enabled via .setProgressEventsEnabled(true), the - * goog.net.EventType.PROGRESS event will be the re-dispatched browser - * progress event. - * - * Tested = IE6, FF1.5, Safari, Opera 8.5 - * - * TODO(user): Error cases aren't playing nicely in Safari. - * - */ - - -goog.provide('goog.net.XhrIo'); -goog.provide('goog.net.XhrIo.ResponseType'); - -goog.require('goog.Timer'); -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.debug.entryPointRegistry'); -goog.require('goog.events.EventTarget'); -goog.require('goog.json'); -goog.require('goog.log'); -goog.require('goog.net.ErrorCode'); -goog.require('goog.net.EventType'); -goog.require('goog.net.HttpStatus'); -goog.require('goog.net.XmlHttp'); -goog.require('goog.object'); -goog.require('goog.string'); -goog.require('goog.structs'); -goog.require('goog.structs.Map'); -goog.require('goog.uri.utils'); -goog.require('goog.userAgent'); - -goog.forwardDeclare('goog.Uri'); - - - -/** - * Basic class for handling XMLHttpRequests. - * @param {goog.net.XmlHttpFactory=} opt_xmlHttpFactory Factory to use when - * creating XMLHttpRequest objects. - * @constructor - * @extends {goog.events.EventTarget} - */ -goog.net.XhrIo = function(opt_xmlHttpFactory) { - goog.net.XhrIo.base(this, 'constructor'); - - /** - * Map of default headers to add to every request, use: - * XhrIo.headers.set(name, value) - * @type {!goog.structs.Map} - */ - this.headers = new goog.structs.Map(); - - /** - * Optional XmlHttpFactory - * @private {goog.net.XmlHttpFactory} - */ - this.xmlHttpFactory_ = opt_xmlHttpFactory || null; - - /** - * Whether XMLHttpRequest is active. A request is active from the time send() - * is called until onReadyStateChange() is complete, or error() or abort() - * is called. - * @private {boolean} - */ - this.active_ = false; - - /** - * The XMLHttpRequest object that is being used for the transfer. - * @private {?goog.net.XhrLike.OrNative} - */ - this.xhr_ = null; - - /** - * The options to use with the current XMLHttpRequest object. - * @private {Object} - */ - this.xhrOptions_ = null; - - /** - * Last URL that was requested. - * @private {string|goog.Uri} - */ - this.lastUri_ = ''; - - /** - * Method for the last request. - * @private {string} - */ - this.lastMethod_ = ''; - - /** - * Last error code. - * @private {!goog.net.ErrorCode} - */ - this.lastErrorCode_ = goog.net.ErrorCode.NO_ERROR; - - /** - * Last error message. - * @private {Error|string} - */ - this.lastError_ = ''; - - /** - * Used to ensure that we don't dispatch an multiple ERROR events. This can - * happen in IE when it does a synchronous load and one error is handled in - * the ready statte change and one is handled due to send() throwing an - * exception. - * @private {boolean} - */ - this.errorDispatched_ = false; - - /** - * Used to make sure we don't fire the complete event from inside a send call. - * @private {boolean} - */ - this.inSend_ = false; - - /** - * Used in determining if a call to {@link #onReadyStateChange_} is from - * within a call to this.xhr_.open. - * @private {boolean} - */ - this.inOpen_ = false; - - /** - * Used in determining if a call to {@link #onReadyStateChange_} is from - * within a call to this.xhr_.abort. - * @private {boolean} - */ - this.inAbort_ = false; - - /** - * Number of milliseconds after which an incomplete request will be aborted - * and a {@link goog.net.EventType.TIMEOUT} event raised; 0 means no timeout - * is set. - * @private {number} - */ - this.timeoutInterval_ = 0; - - /** - * Timer to track request timeout. - * @private {?number} - */ - this.timeoutId_ = null; - - /** - * The requested type for the response. The empty string means use the default - * XHR behavior. - * @private {goog.net.XhrIo.ResponseType} - */ - this.responseType_ = goog.net.XhrIo.ResponseType.DEFAULT; - - /** - * Whether a "credentialed" request is to be sent (one that is aware of - * cookies and authentication). This is applicable only for cross-domain - * requests and more recent browsers that support this part of the HTTP Access - * Control standard. - * - * @see http://www.w3.org/TR/XMLHttpRequest/#the-withcredentials-attribute - * - * @private {boolean} - */ - this.withCredentials_ = false; - - /** - * Whether progress events are enabled for this request. This is - * disabled by default because setting a progress event handler - * causes pre-flight OPTIONS requests to be sent for CORS requests, - * even in cases where a pre-flight request would not otherwise be - * sent. - * - * @see http://xhr.spec.whatwg.org/#security-considerations - * - * Note that this can cause problems for Firefox 22 and below, as an - * older "LSProgressEvent" will be dispatched by the browser. That - * progress event is no longer supported, and can lead to failures, - * including throwing exceptions. - * - * @see http://bugzilla.mozilla.org/show_bug.cgi?id=845631 - * @see b/23469793 - * - * @private {boolean} - */ - this.progressEventsEnabled_ = false; - - /** - * True if we can use XMLHttpRequest's timeout directly. - * @private {boolean} - */ - this.useXhr2Timeout_ = false; -}; -goog.inherits(goog.net.XhrIo, goog.events.EventTarget); - - -/** - * Response types that may be requested for XMLHttpRequests. - * @enum {string} - * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsetype-attribute - */ -goog.net.XhrIo.ResponseType = { - DEFAULT: '', - TEXT: 'text', - DOCUMENT: 'document', - // Not supported as of Chrome 10.0.612.1 dev - BLOB: 'blob', - ARRAY_BUFFER: 'arraybuffer' -}; - - -/** - * A reference to the XhrIo logger - * @private {goog.debug.Logger} - * @const - */ -goog.net.XhrIo.prototype.logger_ = - goog.log.getLogger('goog.net.XhrIo'); - - -/** - * The Content-Type HTTP header name - * @type {string} - */ -goog.net.XhrIo.CONTENT_TYPE_HEADER = 'Content-Type'; - - -/** - * The pattern matching the 'http' and 'https' URI schemes - * @type {!RegExp} - */ -goog.net.XhrIo.HTTP_SCHEME_PATTERN = /^https?$/i; - - -/** - * The methods that typically come along with form data. We set different - * headers depending on whether the HTTP action is one of these. - */ -goog.net.XhrIo.METHODS_WITH_FORM_DATA = ['POST', 'PUT']; - - -/** - * The Content-Type HTTP header value for a url-encoded form - * @type {string} - */ -goog.net.XhrIo.FORM_CONTENT_TYPE = - 'application/x-www-form-urlencoded;charset=utf-8'; - - -/** - * The XMLHttpRequest Level two timeout delay ms property name. - * - * @see http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute - * - * @private {string} - * @const - */ -goog.net.XhrIo.XHR2_TIMEOUT_ = 'timeout'; - - -/** - * The XMLHttpRequest Level two ontimeout handler property name. - * - * @see http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute - * - * @private {string} - * @const - */ -goog.net.XhrIo.XHR2_ON_TIMEOUT_ = 'ontimeout'; - - -/** - * All non-disposed instances of goog.net.XhrIo created - * by {@link goog.net.XhrIo.send} are in this Array. - * @see goog.net.XhrIo.cleanup - * @private {!Array<!goog.net.XhrIo>} - */ -goog.net.XhrIo.sendInstances_ = []; - - -/** - * Static send that creates a short lived instance of XhrIo to send the - * request. - * @see goog.net.XhrIo.cleanup - * @param {string|goog.Uri} url Uri to make request to. - * @param {?function(this:goog.net.XhrIo, ?)=} opt_callback Callback function - * for when request is complete. - * @param {string=} opt_method Send method, default: GET. - * @param {ArrayBuffer|ArrayBufferView|Blob|Document|FormData|string=} - * opt_content Body data. - * @param {Object|goog.structs.Map=} opt_headers Map of headers to add to the - * request. - * @param {number=} opt_timeoutInterval Number of milliseconds after which an - * incomplete request will be aborted; 0 means no timeout is set. - * @param {boolean=} opt_withCredentials Whether to send credentials with the - * request. Default to false. See {@link goog.net.XhrIo#setWithCredentials}. - * @return {!goog.net.XhrIo} The sent XhrIo. - */ -goog.net.XhrIo.send = function(url, opt_callback, opt_method, opt_content, - opt_headers, opt_timeoutInterval, - opt_withCredentials) { - var x = new goog.net.XhrIo(); - goog.net.XhrIo.sendInstances_.push(x); - if (opt_callback) { - x.listen(goog.net.EventType.COMPLETE, opt_callback); - } - x.listenOnce(goog.net.EventType.READY, x.cleanupSend_); - if (opt_timeoutInterval) { - x.setTimeoutInterval(opt_timeoutInterval); - } - if (opt_withCredentials) { - x.setWithCredentials(opt_withCredentials); - } - x.send(url, opt_method, opt_content, opt_headers); - return x; -}; - - -/** - * Disposes all non-disposed instances of goog.net.XhrIo created by - * {@link goog.net.XhrIo.send}. - * {@link goog.net.XhrIo.send} cleans up the goog.net.XhrIo instance - * it creates when the request completes or fails. However, if - * the request never completes, then the goog.net.XhrIo is not disposed. - * This can occur if the window is unloaded before the request completes. - * We could have {@link goog.net.XhrIo.send} return the goog.net.XhrIo - * it creates and make the client of {@link goog.net.XhrIo.send} be - * responsible for disposing it in this case. However, this makes things - * significantly more complicated for the client, and the whole point - * of {@link goog.net.XhrIo.send} is that it's simple and easy to use. - * Clients of {@link goog.net.XhrIo.send} should call - * {@link goog.net.XhrIo.cleanup} when doing final - * cleanup on window unload. - */ -goog.net.XhrIo.cleanup = function() { - var instances = goog.net.XhrIo.sendInstances_; - while (instances.length) { - instances.pop().dispose(); - } -}; - - -/** - * Installs exception protection for all entry point introduced by - * goog.net.XhrIo instances which are not protected by - * {@link goog.debug.ErrorHandler#protectWindowSetTimeout}, - * {@link goog.debug.ErrorHandler#protectWindowSetInterval}, or - * {@link goog.events.protectBrowserEventEntryPoint}. - * - * @param {goog.debug.ErrorHandler} errorHandler Error handler with which to - * protect the entry point(s). - */ -goog.net.XhrIo.protectEntryPoints = function(errorHandler) { - goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_ = - errorHandler.protectEntryPoint( - goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_); -}; - - -/** - * Disposes of the specified goog.net.XhrIo created by - * {@link goog.net.XhrIo.send} and removes it from - * {@link goog.net.XhrIo.pendingStaticSendInstances_}. - * @private - */ -goog.net.XhrIo.prototype.cleanupSend_ = function() { - this.dispose(); - goog.array.remove(goog.net.XhrIo.sendInstances_, this); -}; - - -/** - * Returns the number of milliseconds after which an incomplete request will be - * aborted, or 0 if no timeout is set. - * @return {number} Timeout interval in milliseconds. - */ -goog.net.XhrIo.prototype.getTimeoutInterval = function() { - return this.timeoutInterval_; -}; - - -/** - * Sets the number of milliseconds after which an incomplete request will be - * aborted and a {@link goog.net.EventType.TIMEOUT} event raised; 0 means no - * timeout is set. - * @param {number} ms Timeout interval in milliseconds; 0 means none. - */ -goog.net.XhrIo.prototype.setTimeoutInterval = function(ms) { - this.timeoutInterval_ = Math.max(0, ms); -}; - - -/** - * Sets the desired type for the response. At time of writing, this is only - * supported in very recent versions of WebKit (10.0.612.1 dev and later). - * - * If this is used, the response may only be accessed via {@link #getResponse}. - * - * @param {goog.net.XhrIo.ResponseType} type The desired type for the response. - */ -goog.net.XhrIo.prototype.setResponseType = function(type) { - this.responseType_ = type; -}; - - -/** - * Gets the desired type for the response. - * @return {goog.net.XhrIo.ResponseType} The desired type for the response. - */ -goog.net.XhrIo.prototype.getResponseType = function() { - return this.responseType_; -}; - - -/** - * Sets whether a "credentialed" request that is aware of cookie and - * authentication information should be made. This option is only supported by - * browsers that support HTTP Access Control. As of this writing, this option - * is not supported in IE. - * - * @param {boolean} withCredentials Whether this should be a "credentialed" - * request. - */ -goog.net.XhrIo.prototype.setWithCredentials = function(withCredentials) { - this.withCredentials_ = withCredentials; -}; - - -/** - * Gets whether a "credentialed" request is to be sent. - * @return {boolean} The desired type for the response. - */ -goog.net.XhrIo.prototype.getWithCredentials = function() { - return this.withCredentials_; -}; - - -/** - * Sets whether progress events are enabled for this request. Note - * that progress events require pre-flight OPTIONS request handling - * for CORS requests, and may cause trouble with older browsers. See - * progressEventsEnabled_ for details. - * @param {boolean} enabled Whether progress events should be enabled. - */ -goog.net.XhrIo.prototype.setProgressEventsEnabled = function(enabled) { - this.progressEventsEnabled_ = enabled; -}; - - -/** - * Gets whether progress events are enabled. - * @return {boolean} Whether progress events are enabled for this request. - */ -goog.net.XhrIo.prototype.getProgressEventsEnabled = function() { - return this.progressEventsEnabled_; -}; - - -/** - * Instance send that actually uses XMLHttpRequest to make a server call. - * @param {string|goog.Uri} url Uri to make request to. - * @param {string=} opt_method Send method, default: GET. - * @param {ArrayBuffer|ArrayBufferView|Blob|Document|FormData|string=} - * opt_content Body data. - * @param {Object|goog.structs.Map=} opt_headers Map of headers to add to the - * request. - */ -goog.net.XhrIo.prototype.send = function(url, opt_method, opt_content, - opt_headers) { - if (this.xhr_) { - throw Error('[goog.net.XhrIo] Object is active with another request=' + - this.lastUri_ + '; newUri=' + url); - } - - var method = opt_method ? opt_method.toUpperCase() : 'GET'; - - this.lastUri_ = url; - this.lastError_ = ''; - this.lastErrorCode_ = goog.net.ErrorCode.NO_ERROR; - this.lastMethod_ = method; - this.errorDispatched_ = false; - this.active_ = true; - - // Use the factory to create the XHR object and options - this.xhr_ = this.createXhr(); - this.xhrOptions_ = this.xmlHttpFactory_ ? - this.xmlHttpFactory_.getOptions() : goog.net.XmlHttp.getOptions(); - - // Set up the onreadystatechange callback - this.xhr_.onreadystatechange = goog.bind(this.onReadyStateChange_, this); - - // Set up upload/download progress events, if progress events are supported. - if (this.getProgressEventsEnabled() && 'onprogress' in this.xhr_) { - this.xhr_.onprogress = goog.bind(this.onProgressHandler_, this); - if (this.xhr_.upload) { - this.xhr_.upload.onprogress = goog.bind(this.onProgressHandler_, this); - } - } - - /** - * Try to open the XMLHttpRequest (always async), if an error occurs here it - * is generally permission denied - * @preserveTry - */ - try { - goog.log.fine(this.logger_, this.formatMsg_('Opening Xhr')); - this.inOpen_ = true; - this.xhr_.open(method, String(url), true); // Always async! - this.inOpen_ = false; - } catch (err) { - goog.log.fine(this.logger_, - this.formatMsg_('Error opening Xhr: ' + err.message)); - this.error_(goog.net.ErrorCode.EXCEPTION, err); - return; - } - - // We can't use null since this won't allow requests with form data to have a - // content length specified which will cause some proxies to return a 411 - // error. - var content = opt_content || ''; - - var headers = this.headers.clone(); - - // Add headers specific to this request - if (opt_headers) { - goog.structs.forEach(opt_headers, function(value, key) { - headers.set(key, value); - }); - } - - // Find whether a content type header is set, ignoring case. - // HTTP header names are case-insensitive. See: - // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 - var contentTypeKey = goog.array.find(headers.getKeys(), - goog.net.XhrIo.isContentTypeHeader_); - - var contentIsFormData = (goog.global['FormData'] && - (content instanceof goog.global['FormData'])); - if (goog.array.contains(goog.net.XhrIo.METHODS_WITH_FORM_DATA, method) && - !contentTypeKey && !contentIsFormData) { - // For requests typically with form data, default to the url-encoded form - // content type unless this is a FormData request. For FormData, - // the browser will automatically add a multipart/form-data content type - // with an appropriate multipart boundary. - headers.set(goog.net.XhrIo.CONTENT_TYPE_HEADER, - goog.net.XhrIo.FORM_CONTENT_TYPE); - } - - // Add the headers to the Xhr object - headers.forEach(function(value, key) { - this.xhr_.setRequestHeader(key, value); - }, this); - - if (this.responseType_) { - this.xhr_.responseType = this.responseType_; - } - - if (goog.object.containsKey(this.xhr_, 'withCredentials')) { - this.xhr_.withCredentials = this.withCredentials_; - } - - /** - * Try to send the request, or other wise report an error (404 not found). - * @preserveTry - */ - try { - this.cleanUpTimeoutTimer_(); // Paranoid, should never be running. - if (this.timeoutInterval_ > 0) { - this.useXhr2Timeout_ = goog.net.XhrIo.shouldUseXhr2Timeout_(this.xhr_); - goog.log.fine(this.logger_, this.formatMsg_('Will abort after ' + - this.timeoutInterval_ + 'ms if incomplete, xhr2 ' + - this.useXhr2Timeout_)); - if (this.useXhr2Timeout_) { - this.xhr_[goog.net.XhrIo.XHR2_TIMEOUT_] = this.timeoutInterval_; - this.xhr_[goog.net.XhrIo.XHR2_ON_TIMEOUT_] = - goog.bind(this.timeout_, this); - } else { - this.timeoutId_ = goog.Timer.callOnce(this.timeout_, - this.timeoutInterval_, this); - } - } - goog.log.fine(this.logger_, this.formatMsg_('Sending request')); - this.inSend_ = true; - this.xhr_.send(content); - this.inSend_ = false; - - } catch (err) { - goog.log.fine(this.logger_, this.formatMsg_('Send error: ' + err.message)); - this.error_(goog.net.ErrorCode.EXCEPTION, err); - } -}; - - -/** - * Determines if the argument is an XMLHttpRequest that supports the level 2 - * timeout value and event. - * - * Currently, FF 21.0 OS X has the fields but won't actually call the timeout - * handler. Perhaps the confusion in the bug referenced below hasn't - * entirely been resolved. - * - * @see http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute - * @see https://bugzilla.mozilla.org/show_bug.cgi?id=525816 - * - * @param {!goog.net.XhrLike.OrNative} xhr The request. - * @return {boolean} True if the request supports level 2 timeout. - * @private - */ -goog.net.XhrIo.shouldUseXhr2Timeout_ = function(xhr) { - return goog.userAgent.IE && - goog.userAgent.isVersionOrHigher(9) && - goog.isNumber(xhr[goog.net.XhrIo.XHR2_TIMEOUT_]) && - goog.isDef(xhr[goog.net.XhrIo.XHR2_ON_TIMEOUT_]); -}; - - -/** - * @param {string} header An HTTP header key. - * @return {boolean} Whether the key is a content type header (ignoring - * case. - * @private - */ -goog.net.XhrIo.isContentTypeHeader_ = function(header) { - return goog.string.caseInsensitiveEquals( - goog.net.XhrIo.CONTENT_TYPE_HEADER, header); -}; - - -/** - * Creates a new XHR object. - * @return {!goog.net.XhrLike.OrNative} The newly created XHR object. - * @protected - */ -goog.net.XhrIo.prototype.createXhr = function() { - return this.xmlHttpFactory_ ? - this.xmlHttpFactory_.createInstance() : goog.net.XmlHttp(); -}; - - -/** - * The request didn't complete after {@link goog.net.XhrIo#timeoutInterval_} - * milliseconds; raises a {@link goog.net.EventType.TIMEOUT} event and aborts - * the request. - * @private - */ -goog.net.XhrIo.prototype.timeout_ = function() { - if (typeof goog == 'undefined') { - // If goog is undefined then the callback has occurred as the application - // is unloading and will error. Thus we let it silently fail. - } else if (this.xhr_) { - this.lastError_ = 'Timed out after ' + this.timeoutInterval_ + - 'ms, aborting'; - this.lastErrorCode_ = goog.net.ErrorCode.TIMEOUT; - goog.log.fine(this.logger_, this.formatMsg_(this.lastError_)); - this.dispatchEvent(goog.net.EventType.TIMEOUT); - this.abort(goog.net.ErrorCode.TIMEOUT); - } -}; - - -/** - * Something errorred, so inactivate, fire error callback and clean up - * @param {goog.net.ErrorCode} errorCode The error code. - * @param {Error} err The error object. - * @private - */ -goog.net.XhrIo.prototype.error_ = function(errorCode, err) { - this.active_ = false; - if (this.xhr_) { - this.inAbort_ = true; - this.xhr_.abort(); // Ensures XHR isn't hung (FF) - this.inAbort_ = false; - } - this.lastError_ = err; - this.lastErrorCode_ = errorCode; - this.dispatchErrors_(); - this.cleanUpXhr_(); -}; - - -/** - * Dispatches COMPLETE and ERROR in case of an error. This ensures that we do - * not dispatch multiple error events. - * @private - */ -goog.net.XhrIo.prototype.dispatchErrors_ = function() { - if (!this.errorDispatched_) { - this.errorDispatched_ = true; - this.dispatchEvent(goog.net.EventType.COMPLETE); - this.dispatchEvent(goog.net.EventType.ERROR); - } -}; - - -/** - * Abort the current XMLHttpRequest - * @param {goog.net.ErrorCode=} opt_failureCode Optional error code to use - - * defaults to ABORT. - */ -goog.net.XhrIo.prototype.abort = function(opt_failureCode) { - if (this.xhr_ && this.active_) { - goog.log.fine(this.logger_, this.formatMsg_('Aborting')); - this.active_ = false; - this.inAbort_ = true; - this.xhr_.abort(); - this.inAbort_ = false; - this.lastErrorCode_ = opt_failureCode || goog.net.ErrorCode.ABORT; - this.dispatchEvent(goog.net.EventType.COMPLETE); - this.dispatchEvent(goog.net.EventType.ABORT); - this.cleanUpXhr_(); - } -}; - - -/** - * Nullifies all callbacks to reduce risks of leaks. - * @override - * @protected - */ -goog.net.XhrIo.prototype.disposeInternal = function() { - if (this.xhr_) { - // We explicitly do not call xhr_.abort() unless active_ is still true. - // This is to avoid unnecessarily aborting a successful request when - // dispose() is called in a callback triggered by a complete response, but - // in which browser cleanup has not yet finished. - // (See http://b/issue?id=1684217.) - if (this.active_) { - this.active_ = false; - this.inAbort_ = true; - this.xhr_.abort(); - this.inAbort_ = false; - } - this.cleanUpXhr_(true); - } - - goog.net.XhrIo.base(this, 'disposeInternal'); -}; - - -/** - * Internal handler for the XHR object's readystatechange event. This method - * checks the status and the readystate and fires the correct callbacks. - * If the request has ended, the handlers are cleaned up and the XHR object is - * nullified. - * @private - */ -goog.net.XhrIo.prototype.onReadyStateChange_ = function() { - if (this.isDisposed()) { - // This method is the target of an untracked goog.Timer.callOnce(). - return; - } - if (!this.inOpen_ && !this.inSend_ && !this.inAbort_) { - // Were not being called from within a call to this.xhr_.send - // this.xhr_.abort, or this.xhr_.open, so this is an entry point - this.onReadyStateChangeEntryPoint_(); - } else { - this.onReadyStateChangeHelper_(); - } -}; - - -/** - * Used to protect the onreadystatechange handler entry point. Necessary - * as {#onReadyStateChange_} maybe called from within send or abort, this - * method is only called when {#onReadyStateChange_} is called as an - * entry point. - * {@see #protectEntryPoints} - * @private - */ -goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_ = function() { - this.onReadyStateChangeHelper_(); -}; - - -/** - * Helper for {@link #onReadyStateChange_}. This is used so that - * entry point calls to {@link #onReadyStateChange_} can be routed through - * {@link #onReadyStateChangeEntryPoint_}. - * @private - */ -goog.net.XhrIo.prototype.onReadyStateChangeHelper_ = function() { - if (!this.active_) { - // can get called inside abort call - return; - } - - if (typeof goog == 'undefined') { - // NOTE(user): If goog is undefined then the callback has occurred as the - // application is unloading and will error. Thus we let it silently fail. - - } else if ( - this.xhrOptions_[goog.net.XmlHttp.OptionType.LOCAL_REQUEST_ERROR] && - this.getReadyState() == goog.net.XmlHttp.ReadyState.COMPLETE && - this.getStatus() == 2) { - // NOTE(user): In IE if send() errors on a *local* request the readystate - // is still changed to COMPLETE. We need to ignore it and allow the - // try/catch around send() to pick up the error. - goog.log.fine(this.logger_, this.formatMsg_( - 'Local request error detected and ignored')); - - } else { - - // In IE when the response has been cached we sometimes get the callback - // from inside the send call and this usually breaks code that assumes that - // XhrIo is asynchronous. If that is the case we delay the callback - // using a timer. - if (this.inSend_ && - this.getReadyState() == goog.net.XmlHttp.ReadyState.COMPLETE) { - goog.Timer.callOnce(this.onReadyStateChange_, 0, this); - return; - } - - this.dispatchEvent(goog.net.EventType.READY_STATE_CHANGE); - - // readyState indicates the transfer has finished - if (this.isComplete()) { - goog.log.fine(this.logger_, this.formatMsg_('Request complete')); - - this.active_ = false; - - try { - // Call the specific callbacks for success or failure. Only call the - // success if the status is 200 (HTTP_OK) or 304 (HTTP_CACHED) - if (this.isSuccess()) { - this.dispatchEvent(goog.net.EventType.COMPLETE); - this.dispatchEvent(goog.net.EventType.SUCCESS); - } else { - this.lastErrorCode_ = goog.net.ErrorCode.HTTP_ERROR; - this.lastError_ = - this.getStatusText() + ' [' + this.getStatus() + ']'; - this.dispatchErrors_(); - } - } finally { - this.cleanUpXhr_(); - } - } - } -}; - - -/** - * Internal handler for the XHR object's onprogress event. - * @param {!ProgressEvent} e XHR progress event. - * @private - */ -goog.net.XhrIo.prototype.onProgressHandler_ = function(e) { - goog.asserts.assert(e.type === goog.net.EventType.PROGRESS, - 'goog.net.EventType.PROGRESS is of the same type as raw XHR progress.'); - // Redispatch the progress event. - this.dispatchEvent(e); -}; - - -/** - * Remove the listener to protect against leaks, and nullify the XMLHttpRequest - * object. - * @param {boolean=} opt_fromDispose If this is from the dispose (don't want to - * fire any events). - * @private - */ -goog.net.XhrIo.prototype.cleanUpXhr_ = function(opt_fromDispose) { - if (this.xhr_) { - // Cancel any pending timeout event handler. - this.cleanUpTimeoutTimer_(); - - // Save reference so we can mark it as closed after the READY event. The - // READY event may trigger another request, thus we must nullify this.xhr_ - var xhr = this.xhr_; - var clearedOnReadyStateChange = - this.xhrOptions_[goog.net.XmlHttp.OptionType.USE_NULL_FUNCTION] ? - goog.nullFunction : null; - this.xhr_ = null; - this.xhrOptions_ = null; - - if (!opt_fromDispose) { - this.dispatchEvent(goog.net.EventType.READY); - } - - try { - // NOTE(user): Not nullifying in FireFox can still leak if the callbacks - // are defined in the same scope as the instance of XhrIo. But, IE doesn't - // allow you to set the onreadystatechange to NULL so nullFunction is - // used. - xhr.onreadystatechange = clearedOnReadyStateChange; - } catch (e) { - // This seems to occur with a Gears HTTP request. Delayed the setting of - // this onreadystatechange until after READY is sent out and catching the - // error to see if we can track down the problem. - goog.log.error(this.logger_, - 'Problem encountered resetting onreadystatechange: ' + e.message); - } - } -}; - - -/** - * Make sure the timeout timer isn't running. - * @private - */ -goog.net.XhrIo.prototype.cleanUpTimeoutTimer_ = function() { - if (this.xhr_ && this.useXhr2Timeout_) { - this.xhr_[goog.net.XhrIo.XHR2_ON_TIMEOUT_] = null; - } - if (goog.isNumber(this.timeoutId_)) { - goog.Timer.clear(this.timeoutId_); - this.timeoutId_ = null; - } -}; - - -/** - * @return {boolean} Whether there is an active request. - */ -goog.net.XhrIo.prototype.isActive = function() { - return !!this.xhr_; -}; - - -/** - * @return {boolean} Whether the request has completed. - */ -goog.net.XhrIo.prototype.isComplete = function() { - return this.getReadyState() == goog.net.XmlHttp.ReadyState.COMPLETE; -}; - - -/** - * @return {boolean} Whether the request completed with a success. - */ -goog.net.XhrIo.prototype.isSuccess = function() { - var status = this.getStatus(); - // A zero status code is considered successful for local files. - return goog.net.HttpStatus.isSuccess(status) || - status === 0 && !this.isLastUriEffectiveSchemeHttp_(); -}; - - -/** - * @return {boolean} whether the effective scheme of the last URI that was - * fetched was 'http' or 'https'. - * @private - */ -goog.net.XhrIo.prototype.isLastUriEffectiveSchemeHttp_ = function() { - var scheme = goog.uri.utils.getEffectiveScheme(String(this.lastUri_)); - return goog.net.XhrIo.HTTP_SCHEME_PATTERN.test(scheme); -}; - - -/** - * Get the readystate from the Xhr object - * Will only return correct result when called from the context of a callback - * @return {goog.net.XmlHttp.ReadyState} goog.net.XmlHttp.ReadyState.*. - */ -goog.net.XhrIo.prototype.getReadyState = function() { - return this.xhr_ ? - /** @type {goog.net.XmlHttp.ReadyState} */ (this.xhr_.readyState) : - goog.net.XmlHttp.ReadyState.UNINITIALIZED; -}; - - -/** - * Get the status from the Xhr object - * Will only return correct result when called from the context of a callback - * @return {number} Http status. - */ -goog.net.XhrIo.prototype.getStatus = function() { - /** - * IE doesn't like you checking status until the readystate is greater than 2 - * (i.e. it is receiving or complete). The try/catch is used for when the - * page is unloading and an ERROR_NOT_AVAILABLE may occur when accessing xhr_. - * @preserveTry - */ - try { - return this.getReadyState() > goog.net.XmlHttp.ReadyState.LOADED ? - this.xhr_.status : -1; - } catch (e) { - return -1; - } -}; - - -/** - * Get the status text from the Xhr object - * Will only return correct result when called from the context of a callback - * @return {string} Status text. - */ -goog.net.XhrIo.prototype.getStatusText = function() { - /** - * IE doesn't like you checking status until the readystate is greater than 2 - * (i.e. it is recieving or complete). The try/catch is used for when the - * page is unloading and an ERROR_NOT_AVAILABLE may occur when accessing xhr_. - * @preserveTry - */ - try { - return this.getReadyState() > goog.net.XmlHttp.ReadyState.LOADED ? - this.xhr_.statusText : ''; - } catch (e) { - goog.log.fine(this.logger_, 'Can not get status: ' + e.message); - return ''; - } -}; - - -/** - * Get the last Uri that was requested - * @return {string} Last Uri. - */ -goog.net.XhrIo.prototype.getLastUri = function() { - return String(this.lastUri_); -}; - - -/** - * Get the response text from the Xhr object - * Will only return correct result when called from the context of a callback. - * @return {string} Result from the server, or '' if no result available. - */ -goog.net.XhrIo.prototype.getResponseText = function() { - /** @preserveTry */ - try { - return this.xhr_ ? this.xhr_.responseText : ''; - } catch (e) { - // http://www.w3.org/TR/XMLHttpRequest/#the-responsetext-attribute - // states that responseText should return '' (and responseXML null) - // when the state is not LOADING or DONE. Instead, IE can - // throw unexpected exceptions, for example when a request is aborted - // or no data is available yet. - goog.log.fine(this.logger_, 'Can not get responseText: ' + e.message); - return ''; - } -}; - - -/** - * Get the response body from the Xhr object. This property is only available - * in IE since version 7 according to MSDN: - * http://msdn.microsoft.com/en-us/library/ie/ms534368(v=vs.85).aspx - * Will only return correct result when called from the context of a callback. - * - * One option is to construct a VBArray from the returned object and convert - * it to a JavaScript array using the toArray method: - * {@code (new window['VBArray'](xhrIo.getResponseBody())).toArray()} - * This will result in an array of numbers in the range of [0..255] - * - * Another option is to use the VBScript CStr method to convert it into a - * string as outlined in http://stackoverflow.com/questions/1919972 - * - * @return {Object} Binary result from the server or null if not available. - */ -goog.net.XhrIo.prototype.getResponseBody = function() { - /** @preserveTry */ - try { - if (this.xhr_ && 'responseBody' in this.xhr_) { - return this.xhr_['responseBody']; - } - } catch (e) { - // IE can throw unexpected exceptions, for example when a request is aborted - // or no data is yet available. - goog.log.fine(this.logger_, 'Can not get responseBody: ' + e.message); - } - return null; -}; - - -/** - * Get the response XML from the Xhr object - * Will only return correct result when called from the context of a callback. - * @return {Document} The DOM Document representing the XML file, or null - * if no result available. - */ -goog.net.XhrIo.prototype.getResponseXml = function() { - /** @preserveTry */ - try { - return this.xhr_ ? this.xhr_.responseXML : null; - } catch (e) { - goog.log.fine(this.logger_, 'Can not get responseXML: ' + e.message); - return null; - } -}; - - -/** - * Get the response and evaluates it as JSON from the Xhr object - * Will only return correct result when called from the context of a callback - * @param {string=} opt_xssiPrefix Optional XSSI prefix string to use for - * stripping of the response before parsing. This needs to be set only if - * your backend server prepends the same prefix string to the JSON response. - * @return {Object|undefined} JavaScript object. - */ -goog.net.XhrIo.prototype.getResponseJson = function(opt_xssiPrefix) { - if (!this.xhr_) { - return undefined; - } - - var responseText = this.xhr_.responseText; - if (opt_xssiPrefix && responseText.indexOf(opt_xssiPrefix) == 0) { - responseText = responseText.substring(opt_xssiPrefix.length); - } - - return goog.json.parse(responseText); -}; - - -/** - * Get the response as the type specificed by {@link #setResponseType}. At time - * of writing, this is only directly supported in very recent versions of WebKit - * (10.0.612.1 dev and later). If the field is not supported directly, we will - * try to emulate it. - * - * Emulating the response means following the rules laid out at - * http://www.w3.org/TR/XMLHttpRequest/#the-response-attribute - * - * On browsers with no support for this (Chrome < 10, Firefox < 4, etc), only - * response types of DEFAULT or TEXT may be used, and the response returned will - * be the text response. - * - * On browsers with Mozilla's draft support for array buffers (Firefox 4, 5), - * only response types of DEFAULT, TEXT, and ARRAY_BUFFER may be used, and the - * response returned will be either the text response or the Mozilla - * implementation of the array buffer response. - * - * On browsers will full support, any valid response type supported by the - * browser may be used, and the response provided by the browser will be - * returned. - * - * @return {*} The response. - */ -goog.net.XhrIo.prototype.getResponse = function() { - /** @preserveTry */ - try { - if (!this.xhr_) { - return null; - } - if ('response' in this.xhr_) { - return this.xhr_.response; - } - switch (this.responseType_) { - case goog.net.XhrIo.ResponseType.DEFAULT: - case goog.net.XhrIo.ResponseType.TEXT: - return this.xhr_.responseText; - // DOCUMENT and BLOB don't need to be handled here because they are - // introduced in the same spec that adds the .response field, and would - // have been caught above. - // ARRAY_BUFFER needs an implementation for Firefox 4, where it was - // implemented using a draft spec rather than the final spec. - case goog.net.XhrIo.ResponseType.ARRAY_BUFFER: - if ('mozResponseArrayBuffer' in this.xhr_) { - return this.xhr_.mozResponseArrayBuffer; - } - } - // Fell through to a response type that is not supported on this browser. - goog.log.error(this.logger_, - 'Response type ' + this.responseType_ + ' is not ' + - 'supported on this browser'); - return null; - } catch (e) { - goog.log.fine(this.logger_, 'Can not get response: ' + e.message); - return null; - } -}; - - -/** - * Get the value of the response-header with the given name from the Xhr object - * Will only return correct result when called from the context of a callback - * and the request has completed - * @param {string} key The name of the response-header to retrieve. - * @return {string|undefined} The value of the response-header named key. - */ -goog.net.XhrIo.prototype.getResponseHeader = function(key) { - return this.xhr_ && this.isComplete() ? - this.xhr_.getResponseHeader(key) : undefined; -}; - - -/** - * Gets the text of all the headers in the response. - * Will only return correct result when called from the context of a callback - * and the request has completed. - * @return {string} The value of the response headers or empty string. - */ -goog.net.XhrIo.prototype.getAllResponseHeaders = function() { - return this.xhr_ && this.isComplete() ? - this.xhr_.getAllResponseHeaders() : ''; -}; - - -/** - * Returns all response headers as a key-value map. - * Multiple values for the same header key can be combined into one, - * separated by a comma and a space. - * Note that the native getResponseHeader method for retrieving a single header - * does a case insensitive match on the header name. This method does not - * include any case normalization logic, it will just return a key-value - * representation of the headers. - * See: http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method - * @return {!Object<string, string>} An object with the header keys as keys - * and header values as values. - */ -goog.net.XhrIo.prototype.getResponseHeaders = function() { - var headersObject = {}; - var headersArray = this.getAllResponseHeaders().split('\r\n'); - for (var i = 0; i < headersArray.length; i++) { - if (goog.string.isEmptyOrWhitespace(headersArray[i])) { - continue; - } - var keyValue = goog.string.splitLimit(headersArray[i], ': ', 2); - if (headersObject[keyValue[0]]) { - headersObject[keyValue[0]] += ', ' + keyValue[1]; - } else { - headersObject[keyValue[0]] = keyValue[1]; - } - } - return headersObject; -}; - - -/** - * Get the last error message - * @return {goog.net.ErrorCode} Last error code. - */ -goog.net.XhrIo.prototype.getLastErrorCode = function() { - return this.lastErrorCode_; -}; - - -/** - * Get the last error message - * @return {string} Last error message. - */ -goog.net.XhrIo.prototype.getLastError = function() { - return goog.isString(this.lastError_) ? this.lastError_ : - String(this.lastError_); -}; - - -/** - * Adds the last method, status and URI to the message. This is used to add - * this information to the logging calls. - * @param {string} msg The message text that we want to add the extra text to. - * @return {string} The message with the extra text appended. - * @private - */ -goog.net.XhrIo.prototype.formatMsg_ = function(msg) { - return msg + ' [' + this.lastMethod_ + ' ' + this.lastUri_ + ' ' + - this.getStatus() + ']'; -}; - - -// Register the xhr handler as an entry point, so that -// it can be monitored for exception handling, etc. -goog.debug.entryPointRegistry.register( - /** - * @param {function(!Function): !Function} transformer The transforming - * function. - */ - function(transformer) { - goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_ = - transformer(goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_); - }); - -goog.provide('ol.format.FormatType'); - - -/** - * @enum {string} - */ -ol.format.FormatType = { - ARRAY_BUFFER: 'arraybuffer', - JSON: 'json', - TEXT: 'text', - XML: 'xml' -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview - * XML utilities. - * - */ - -goog.provide('goog.dom.xml'); - -goog.require('goog.dom'); -goog.require('goog.dom.NodeType'); -goog.require('goog.userAgent'); - - -/** - * Max XML size for MSXML2. Used to prevent potential DoS attacks. - * @type {number} - */ -goog.dom.xml.MAX_XML_SIZE_KB = 2 * 1024; // In kB - - -/** - * Max XML size for MSXML2. Used to prevent potential DoS attacks. - * @type {number} - */ -goog.dom.xml.MAX_ELEMENT_DEPTH = 256; // Same default as MSXML6. - - -/** - * Check for ActiveXObject support by the browser. - * @return {boolean} true if browser has ActiveXObject support. - * @private - */ -goog.dom.xml.hasActiveXObjectSupport_ = function() { - if (!goog.userAgent.IE) { - // Avoid raising useless exception in case code is not compiled - // and browser is not MSIE. - return false; - } - try { - // Due to lot of changes in IE 9, 10 & 11 behaviour and ActiveX being - // totally disableable using MSIE's security level, trying to create the - // ActiveXOjbect is a lot more reliable than testing for the existance of - // window.ActiveXObject - new ActiveXObject('MSXML2.DOMDocument'); - return true; - } catch (e) { - return false; - } -}; - - -/** - * True if browser has ActiveXObject support. - * Possible override if this test become wrong in coming IE versions. - * @type {boolean} - */ -goog.dom.xml.ACTIVEX_SUPPORT = - goog.userAgent.IE && goog.dom.xml.hasActiveXObjectSupport_(); - - -/** - * Creates an XML document appropriate for the current JS runtime - * @param {string=} opt_rootTagName The root tag name. - * @param {string=} opt_namespaceUri Namespace URI of the document element. - * @param {boolean=} opt_preferActiveX Whether to default to ActiveXObject to - * create Document in IE. Use this if you need xpath support in IE (e.g., - * selectSingleNode or selectNodes), but be aware that the ActiveXObject does - * not support various DOM-specific Document methods and attributes. - * @return {Document} The new document. - * @throws {Error} if browser does not support creating new documents or - * namespace is provided without a root tag name. - */ -goog.dom.xml.createDocument = function(opt_rootTagName, opt_namespaceUri, - opt_preferActiveX) { - if (opt_namespaceUri && !opt_rootTagName) { - throw Error("Can't create document with namespace and no root tag"); - } - // If document.implementation.createDocument is available and they haven't - // explicitly opted to use ActiveXObject when possible. - if (document.implementation && document.implementation.createDocument && - !(goog.dom.xml.ACTIVEX_SUPPORT && opt_preferActiveX)) { - return document.implementation.createDocument(opt_namespaceUri || '', - opt_rootTagName || '', null); - } else if (goog.dom.xml.ACTIVEX_SUPPORT) { - var doc = goog.dom.xml.createMsXmlDocument_(); - if (doc) { - if (opt_rootTagName) { - doc.appendChild(doc.createNode(goog.dom.NodeType.ELEMENT, - opt_rootTagName, - opt_namespaceUri || '')); - } - return doc; - } - } - throw Error('Your browser does not support creating new documents'); -}; - - -/** - * Creates an XML document from a string - * @param {string} xml The text. - * @param {boolean=} opt_preferActiveX Whether to default to ActiveXObject to - * create Document in IE. Use this if you need xpath support in IE (e.g., - * selectSingleNode or selectNodes), but be aware that the ActiveXObject does - * not support various DOM-specific Document methods and attributes. - * @return {Document} XML document from the text. - * @throws {Error} if browser does not support loading XML documents. - */ -goog.dom.xml.loadXml = function(xml, opt_preferActiveX) { - if (typeof DOMParser != 'undefined' && - !(goog.dom.xml.ACTIVEX_SUPPORT && opt_preferActiveX)) { - return new DOMParser().parseFromString(xml, 'application/xml'); - } else if (goog.dom.xml.ACTIVEX_SUPPORT) { - var doc = goog.dom.xml.createMsXmlDocument_(); - doc.loadXML(xml); - return doc; - } - throw Error('Your browser does not support loading xml documents'); -}; - - -/** - * Serializes an XML document or subtree to string. - * @param {Document|Element} xml The document or the root node of the subtree. - * @return {string} The serialized XML. - * @throws {Error} if browser does not support XML serialization. - */ -goog.dom.xml.serialize = function(xml) { - // Compatible with IE/ActiveXObject. - var text = xml.xml; - if (text) { - return text; - } - // Compatible with Firefox, Opera and WebKit. - if (typeof XMLSerializer != 'undefined') { - return new XMLSerializer().serializeToString(xml); - } - throw Error('Your browser does not support serializing XML documents'); -}; - - -/** - * Selects a single node using an Xpath expression and a root node - * @param {Node} node The root node. - * @param {string} path Xpath selector. - * @return {Node} The selected node, or null if no matching node. - */ -goog.dom.xml.selectSingleNode = function(node, path) { - if (typeof node.selectSingleNode != 'undefined') { - var doc = goog.dom.getOwnerDocument(node); - if (typeof doc.setProperty != 'undefined') { - doc.setProperty('SelectionLanguage', 'XPath'); - } - return node.selectSingleNode(path); - } else if (document.implementation.hasFeature('XPath', '3.0')) { - var doc = goog.dom.getOwnerDocument(node); - var resolver = doc.createNSResolver(doc.documentElement); - var result = doc.evaluate(path, node, resolver, - XPathResult.FIRST_ORDERED_NODE_TYPE, null); - return result.singleNodeValue; - } - // This browser does not support xpath for the given node. If IE, ensure XML - // Document was created using ActiveXObject - // TODO(joeltine): This should throw instead of return null. - return null; -}; - - -/** - * Selects multiple nodes using an Xpath expression and a root node - * @param {Node} node The root node. - * @param {string} path Xpath selector. - * @return {(NodeList|Array<Node>)} The selected nodes, or empty array if no - * matching nodes. - */ -goog.dom.xml.selectNodes = function(node, path) { - if (typeof node.selectNodes != 'undefined') { - var doc = goog.dom.getOwnerDocument(node); - if (typeof doc.setProperty != 'undefined') { - doc.setProperty('SelectionLanguage', 'XPath'); - } - return node.selectNodes(path); - } else if (document.implementation.hasFeature('XPath', '3.0')) { - var doc = goog.dom.getOwnerDocument(node); - var resolver = doc.createNSResolver(doc.documentElement); - var nodes = doc.evaluate(path, node, resolver, - XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); - var results = []; - var count = nodes.snapshotLength; - for (var i = 0; i < count; i++) { - results.push(nodes.snapshotItem(i)); - } - return results; - } else { - // This browser does not support xpath for the given node. If IE, ensure XML - // Document was created using ActiveXObject. - // TODO(joeltine): This should throw instead of return empty array. - return []; - } -}; - - -/** - * Sets multiple attributes on an element. Differs from goog.dom.setProperties - * in that it exclusively uses the element's setAttributes method. Use this - * when you need to ensure that the exact property is available as an attribute - * and can be read later by the native getAttribute method. - * @param {!Element} element XML or DOM element to set attributes on. - * @param {!Object<string, string>} attributes Map of property:value pairs. - */ -goog.dom.xml.setAttributes = function(element, attributes) { - for (var key in attributes) { - if (attributes.hasOwnProperty(key)) { - element.setAttribute(key, attributes[key]); - } - } -}; - - -/** - * Creates an instance of the MSXML2.DOMDocument. - * @return {Document} The new document. - * @private - */ -goog.dom.xml.createMsXmlDocument_ = function() { - var doc = new ActiveXObject('MSXML2.DOMDocument'); - if (doc) { - // Prevent potential vulnerabilities exposed by MSXML2, see - // http://b/1707300 and http://wiki/Main/ISETeamXMLAttacks for details. - doc.resolveExternals = false; - doc.validateOnParse = false; - // Add a try catch block because accessing these properties will throw an - // error on unsupported MSXML versions. This affects Windows machines - // running IE6 or IE7 that are on XP SP2 or earlier without MSXML updates. - // See http://msdn.microsoft.com/en-us/library/ms766391(VS.85).aspx for - // specific details on which MSXML versions support these properties. - try { - doc.setProperty('ProhibitDTD', true); - doc.setProperty('MaxXMLSize', goog.dom.xml.MAX_XML_SIZE_KB); - doc.setProperty('MaxElementDepth', goog.dom.xml.MAX_ELEMENT_DEPTH); - } catch (e) { - // No-op. - } - } - return doc; -}; - -goog.provide('ol.xml'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.dom.xml'); -goog.require('goog.object'); -goog.require('goog.userAgent'); - - -/** - * When using {@link ol.xml.makeChildAppender} or - * {@link ol.xml.makeSimpleNodeFactory}, the top `objectStack` item needs to - * have this structure. - * @typedef {{node:Node}} - */ -ol.xml.NodeStackItem; - - -/** - * @typedef {function(Node, Array.<*>)} - */ -ol.xml.Parser; - - -/** - * @typedef {function(Node, *, Array.<*>)} - */ -ol.xml.Serializer; - - -/** - * This document should be used when creating nodes for XML serializations. This - * document is also used by {@link ol.xml.createElementNS} and - * {@link ol.xml.setAttributeNS} - * @const - * @type {Document} - */ -ol.xml.DOCUMENT = goog.dom.xml.createDocument(); - - -/** - * @param {string} namespaceURI Namespace URI. - * @param {string} qualifiedName Qualified name. - * @return {Node} Node. - * @private - */ -ol.xml.createElementNS_ = function(namespaceURI, qualifiedName) { - return ol.xml.DOCUMENT.createElementNS(namespaceURI, qualifiedName); -}; - - -/** - * @param {string} namespaceURI Namespace URI. - * @param {string} qualifiedName Qualified name. - * @return {Node} Node. - * @private - */ -ol.xml.createElementNSActiveX_ = function(namespaceURI, qualifiedName) { - if (!namespaceURI) { - namespaceURI = ''; - } - return ol.xml.DOCUMENT.createNode(1, qualifiedName, namespaceURI); -}; - - -/** - * @param {string} namespaceURI Namespace URI. - * @param {string} qualifiedName Qualified name. - * @return {Node} Node. - */ -ol.xml.createElementNS = - (document.implementation && document.implementation.createDocument) ? - ol.xml.createElementNS_ : ol.xml.createElementNSActiveX_; - - -/** - * Recursively grab all text content of child nodes into a single string. - * @param {Node} node Node. - * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line - * breaks. - * @return {string} All text content. - * @api - */ -ol.xml.getAllTextContent = function(node, normalizeWhitespace) { - return ol.xml.getAllTextContent_(node, normalizeWhitespace, []).join(''); -}; - - -/** - * Recursively grab all text content of child nodes into a single string. - * @param {Node} node Node. - * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line - * breaks. - * @param {Array.<String|string>} accumulator Accumulator. - * @private - * @return {Array.<String|string>} Accumulator. - */ -ol.xml.getAllTextContent_ = function(node, normalizeWhitespace, accumulator) { - if (node.nodeType == goog.dom.NodeType.CDATA_SECTION || - node.nodeType == goog.dom.NodeType.TEXT) { - if (normalizeWhitespace) { - // FIXME understand why goog.dom.getTextContent_ uses String here - accumulator.push(String(node.nodeValue).replace(/(\r\n|\r|\n)/g, '')); - } else { - accumulator.push(node.nodeValue); - } - } else { - var n; - for (n = node.firstChild; n; n = n.nextSibling) { - ol.xml.getAllTextContent_(n, normalizeWhitespace, accumulator); - } - } - return accumulator; -}; - - -/** - * @param {Node} node Node. - * @private - * @return {string} Local name. - */ -ol.xml.getLocalName_ = function(node) { - return node.localName; -}; - - -/** - * @param {Node} node Node. - * @private - * @return {string} Local name. - */ -ol.xml.getLocalNameIE_ = function(node) { - var localName = node.localName; - if (localName !== undefined) { - return localName; - } - var baseName = node.baseName; - goog.asserts.assert(baseName, - 'Failed to get localName/baseName of node %s', node); - return baseName; -}; - - -/** - * @param {Node} node Node. - * @return {string} Local name. - */ -ol.xml.getLocalName = goog.userAgent.IE ? - ol.xml.getLocalNameIE_ : ol.xml.getLocalName_; - - -/** - * @param {?} value Value. - * @private - * @return {boolean} Is document. - */ -ol.xml.isDocument_ = function(value) { - return value instanceof Document; -}; - - -/** - * @param {?} value Value. - * @private - * @return {boolean} Is document. - */ -ol.xml.isDocumentIE_ = function(value) { - return goog.isObject(value) && value.nodeType == goog.dom.NodeType.DOCUMENT; -}; - - -/** - * @param {?} value Value. - * @return {boolean} Is document. - */ -ol.xml.isDocument = goog.userAgent.IE ? - ol.xml.isDocumentIE_ : ol.xml.isDocument_; - - -/** - * @param {?} value Value. - * @private - * @return {boolean} Is node. - */ -ol.xml.isNode_ = function(value) { - return value instanceof Node; -}; - - -/** - * @param {?} value Value. - * @private - * @return {boolean} Is node. - */ -ol.xml.isNodeIE_ = function(value) { - return goog.isObject(value) && value.nodeType !== undefined; -}; - - -/** - * @param {?} value Value. - * @return {boolean} Is node. - */ -ol.xml.isNode = goog.userAgent.IE ? ol.xml.isNodeIE_ : ol.xml.isNode_; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @return {string} Value - * @private - */ -ol.xml.getAttributeNS_ = function(node, namespaceURI, name) { - return node.getAttributeNS(namespaceURI, name) || ''; -}; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @return {string} Value - * @private - */ -ol.xml.getAttributeNSActiveX_ = function(node, namespaceURI, name) { - var attributeValue = ''; - var attributeNode = ol.xml.getAttributeNodeNS(node, namespaceURI, name); - if (attributeNode !== undefined) { - attributeValue = attributeNode.nodeValue; - } - return attributeValue; -}; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @return {string} Value - */ -ol.xml.getAttributeNS = - (document.implementation && document.implementation.createDocument) ? - ol.xml.getAttributeNS_ : ol.xml.getAttributeNSActiveX_; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @return {?Node} Attribute node or null if none found. - * @private - */ -ol.xml.getAttributeNodeNS_ = function(node, namespaceURI, name) { - return node.getAttributeNodeNS(namespaceURI, name); -}; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @return {?Node} Attribute node or null if none found. - * @private - */ -ol.xml.getAttributeNodeNSActiveX_ = function(node, namespaceURI, name) { - var attributeNode = null; - var attributes = node.attributes; - var potentialNode, fullName; - for (var i = 0, len = attributes.length; i < len; ++i) { - potentialNode = attributes[i]; - if (potentialNode.namespaceURI == namespaceURI) { - fullName = (potentialNode.prefix) ? - (potentialNode.prefix + ':' + name) : name; - if (fullName == potentialNode.nodeName) { - attributeNode = potentialNode; - break; - } - } - } - return attributeNode; -}; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @return {?Node} Attribute node or null if none found. - */ -ol.xml.getAttributeNodeNS = - (document.implementation && document.implementation.createDocument) ? - ol.xml.getAttributeNodeNS_ : ol.xml.getAttributeNodeNSActiveX_; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @param {string|number} value Value. - * @private - */ -ol.xml.setAttributeNS_ = function(node, namespaceURI, name, value) { - node.setAttributeNS(namespaceURI, name, value); -}; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @param {string|number} value Value. - * @private - */ -ol.xml.setAttributeNSActiveX_ = function(node, namespaceURI, name, value) { - if (namespaceURI) { - var attribute = node.ownerDocument.createNode(2, name, namespaceURI); - attribute.nodeValue = value; - node.setAttributeNode(attribute); - } else { - node.setAttribute(name, value); - } -}; - - -/** - * @param {Node} node Node. - * @param {?string} namespaceURI Namespace URI. - * @param {string} name Attribute name. - * @param {string|number} value Value. - */ -ol.xml.setAttributeNS = - (document.implementation && document.implementation.createDocument) ? - ol.xml.setAttributeNS_ : ol.xml.setAttributeNSActiveX_; - - -/** - * Parse an XML string to an XML Document. - * @param {string} xml XML. - * @return {Document} Document. - * @api - */ -ol.xml.parse = function(xml) { - return new DOMParser().parseFromString(xml, 'application/xml'); -}; - - -/** - * Make an array extender function for extending the array at the top of the - * object stack. - * @param {function(this: T, Node, Array.<*>): (Array.<*>|undefined)} - * valueReader Value reader. - * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.xml.Parser} Parser. - * @template T - */ -ol.xml.makeArrayExtender = function(valueReader, opt_this) { - return ( - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - */ - function(node, objectStack) { - var value = valueReader.call(opt_this, node, objectStack); - if (value !== undefined) { - goog.asserts.assert(goog.isArray(value), - 'valueReader function is expected to return an array of values'); - var array = /** @type {Array.<*>} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isArray(array), - 'objectStack is supposed to be an array of arrays'); - goog.array.extend(array, value); - } - }); -}; - - -/** - * Make an array pusher function for pushing to the array at the top of the - * object stack. - * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. - * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.xml.Parser} Parser. - * @template T - */ -ol.xml.makeArrayPusher = function(valueReader, opt_this) { - return ( - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - */ - function(node, objectStack) { - var value = valueReader.call(opt_this !== undefined ? opt_this : this, - node, objectStack); - if (value !== undefined) { - var array = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isArray(array), - 'objectStack is supposed to be an array of arrays'); - array.push(value); - } - }); -}; - - -/** - * Make an object stack replacer function for replacing the object at the - * top of the stack. - * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. - * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.xml.Parser} Parser. - * @template T - */ -ol.xml.makeReplacer = function(valueReader, opt_this) { - return ( - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - */ - function(node, objectStack) { - var value = valueReader.call(opt_this !== undefined ? opt_this : this, - node, objectStack); - if (value !== undefined) { - objectStack[objectStack.length - 1] = value; - } - }); -}; - - -/** - * Make an object property pusher function for adding a property to the - * object at the top of the stack. - * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. - * @param {string=} opt_property Property. - * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.xml.Parser} Parser. - * @template T - */ -ol.xml.makeObjectPropertyPusher = - function(valueReader, opt_property, opt_this) { - goog.asserts.assert(valueReader !== undefined, - 'undefined valueReader, expected function(this: T, Node, Array.<*>)'); - return ( - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - */ - function(node, objectStack) { - var value = valueReader.call(opt_this !== undefined ? opt_this : this, - node, objectStack); - if (value !== undefined) { - var object = /** @type {Object} */ - (objectStack[objectStack.length - 1]); - var property = opt_property !== undefined ? - opt_property : node.localName; - goog.asserts.assert(goog.isObject(object), - 'entity from stack was not an object'); - var array = goog.object.setIfUndefined(object, property, []); - array.push(value); - } - }); -}; - - -/** - * Make an object property setter function. - * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. - * @param {string=} opt_property Property. - * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.xml.Parser} Parser. - * @template T - */ -ol.xml.makeObjectPropertySetter = - function(valueReader, opt_property, opt_this) { - goog.asserts.assert(valueReader !== undefined, - 'undefined valueReader, expected function(this: T, Node, Array.<*>)'); - return ( - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - */ - function(node, objectStack) { - var value = valueReader.call(opt_this !== undefined ? opt_this : this, - node, objectStack); - if (value !== undefined) { - var object = /** @type {Object} */ - (objectStack[objectStack.length - 1]); - var property = opt_property !== undefined ? - opt_property : node.localName; - goog.asserts.assert(goog.isObject(object), - 'entity from stack was not an object'); - object[property] = value; - } - }); -}; - - -/** - * Create a serializer that appends nodes written by its `nodeWriter` to its - * designated parent. The parent is the `node` of the - * {@link ol.xml.NodeStackItem} at the top of the `objectStack`. - * @param {function(this: T, Node, V, Array.<*>)} - * nodeWriter Node writer. - * @param {T=} opt_this The object to use as `this` in `nodeWriter`. - * @return {ol.xml.Serializer} Serializer. - * @template T, V - */ -ol.xml.makeChildAppender = function(nodeWriter, opt_this) { - return function(node, value, objectStack) { - nodeWriter.call(opt_this !== undefined ? opt_this : this, - node, value, objectStack); - var parent = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(parent), - 'entity from stack was not an object'); - var parentNode = parent.node; - goog.asserts.assert(ol.xml.isNode(parentNode) || - ol.xml.isDocument(parentNode), - 'expected parentNode %s to be a Node or a Document', parentNode); - parentNode.appendChild(node); - }; -}; - - -/** - * Create a serializer that calls the provided `nodeWriter` from - * {@link ol.xml.serialize}. This can be used by the parent writer to have the - * 'nodeWriter' called with an array of values when the `nodeWriter` was - * designed to serialize a single item. An example would be a LineString - * geometry writer, which could be reused for writing MultiLineString - * geometries. - * @param {function(this: T, Node, V, Array.<*>)} - * nodeWriter Node writer. - * @param {T=} opt_this The object to use as `this` in `nodeWriter`. - * @return {ol.xml.Serializer} Serializer. - * @template T, V - */ -ol.xml.makeArraySerializer = function(nodeWriter, opt_this) { - var serializersNS, nodeFactory; - return function(node, value, objectStack) { - if (serializersNS === undefined) { - serializersNS = {}; - var serializers = {}; - serializers[node.localName] = nodeWriter; - serializersNS[node.namespaceURI] = serializers; - nodeFactory = ol.xml.makeSimpleNodeFactory(node.localName); - } - ol.xml.serialize(serializersNS, nodeFactory, value, objectStack); - }; -}; - - -/** - * Create a node factory which can use the `opt_keys` passed to - * {@link ol.xml.serialize} or {@link ol.xml.pushSerializeAndPop} as node names, - * or a fixed node name. The namespace of the created nodes can either be fixed, - * or the parent namespace will be used. - * @param {string=} opt_nodeName Fixed node name which will be used for all - * created nodes. If not provided, the 3rd argument to the resulting node - * factory needs to be provided and will be the nodeName. - * @param {string=} opt_namespaceURI Fixed namespace URI which will be used for - * all created nodes. If not provided, the namespace of the parent node will - * be used. - * @return {function(*, Array.<*>, string=): (Node|undefined)} Node factory. - */ -ol.xml.makeSimpleNodeFactory = function(opt_nodeName, opt_namespaceURI) { - var fixedNodeName = opt_nodeName; - return ( - /** - * @param {*} value Value. - * @param {Array.<*>} objectStack Object stack. - * @param {string=} opt_nodeName Node name. - * @return {Node} Node. - */ - function(value, objectStack, opt_nodeName) { - var context = objectStack[objectStack.length - 1]; - var node = context.node; - goog.asserts.assert(ol.xml.isNode(node) || ol.xml.isDocument(node), - 'expected node %s to be a Node or a Document', node); - var nodeName = fixedNodeName; - if (nodeName === undefined) { - nodeName = opt_nodeName; - } - var namespaceURI = opt_namespaceURI; - if (opt_namespaceURI === undefined) { - namespaceURI = node.namespaceURI; - } - goog.asserts.assert(nodeName !== undefined, 'nodeName was undefined'); - return ol.xml.createElementNS(namespaceURI, nodeName); - } - ); -}; - - -/** - * A node factory that creates a node using the parent's `namespaceURI` and the - * `nodeName` passed by {@link ol.xml.serialize} or - * {@link ol.xml.pushSerializeAndPop} to the node factory. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - */ -ol.xml.OBJECT_PROPERTY_NODE_FACTORY = ol.xml.makeSimpleNodeFactory(); - - -/** - * Create an array of `values` to be used with {@link ol.xml.serialize} or - * {@link ol.xml.pushSerializeAndPop}, where `orderedKeys` has to be provided as - * `opt_key` argument. - * @param {Object.<string, V>} object Key-value pairs for the sequence. Keys can - * be a subset of the `orderedKeys`. - * @param {Array.<string>} orderedKeys Keys in the order of the sequence. - * @return {Array.<V>} Values in the order of the sequence. The resulting array - * has the same length as the `orderedKeys` array. Values that are not - * present in `object` will be `undefined` in the resulting array. - * @template V - */ -ol.xml.makeSequence = function(object, orderedKeys) { - var length = orderedKeys.length; - var sequence = new Array(length); - for (var i = 0; i < length; ++i) { - sequence[i] = object[orderedKeys[i]]; - } - return sequence; -}; - - -/** - * Create a namespaced structure, using the same values for each namespace. - * This can be used as a starting point for versioned parsers, when only a few - * values are version specific. - * @param {Array.<string>} namespaceURIs Namespace URIs. - * @param {T} structure Structure. - * @param {Object.<string, T>=} opt_structureNS Namespaced structure to add to. - * @return {Object.<string, T>} Namespaced structure. - * @template T - */ -ol.xml.makeStructureNS = function(namespaceURIs, structure, opt_structureNS) { - /** - * @type {Object.<string, *>} - */ - var structureNS = opt_structureNS !== undefined ? opt_structureNS : {}; - var i, ii; - for (i = 0, ii = namespaceURIs.length; i < ii; ++i) { - structureNS[namespaceURIs[i]] = structure; - } - return structureNS; -}; - - -/** - * Parse a node using the parsers and object stack. - * @param {Object.<string, Object.<string, ol.xml.Parser>>} parsersNS - * Parsers by namespace. - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @param {*=} opt_this The object to use as `this`. - */ -ol.xml.parseNode = function(parsersNS, node, objectStack, opt_this) { - var n; - for (n = node.firstElementChild; n; n = n.nextElementSibling) { - var parsers = parsersNS[n.namespaceURI]; - if (parsers !== undefined) { - var parser = parsers[n.localName]; - if (parser !== undefined) { - parser.call(opt_this, n, objectStack); - } - } - } -}; - - -/** - * Push an object on top of the stack, parse and return the popped object. - * @param {T} object Object. - * @param {Object.<string, Object.<string, ol.xml.Parser>>} parsersNS - * Parsers by namespace. - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @param {*=} opt_this The object to use as `this`. - * @return {T} Object. - * @template T - */ -ol.xml.pushParseAndPop = function( - object, parsersNS, node, objectStack, opt_this) { - objectStack.push(object); - ol.xml.parseNode(parsersNS, node, objectStack, opt_this); - return objectStack.pop(); -}; - - -/** - * Walk through an array of `values` and call a serializer for each value. - * @param {Object.<string, Object.<string, ol.xml.Serializer>>} serializersNS - * Namespaced serializers. - * @param {function(this: T, *, Array.<*>, (string|undefined)): (Node|undefined)} nodeFactory - * Node factory. The `nodeFactory` creates the node whose namespace and name - * will be used to choose a node writer from `serializersNS`. This - * separation allows us to decide what kind of node to create, depending on - * the value we want to serialize. An example for this would be different - * geometry writers based on the geometry type. - * @param {Array.<*>} values Values to serialize. An example would be an array - * of {@link ol.Feature} instances. - * @param {Array.<*>} objectStack Node stack. - * @param {Array.<string>=} opt_keys Keys of the `values`. Will be passed to the - * `nodeFactory`. This is used for serializing object literals where the - * node name relates to the property key. The array length of `opt_keys` has - * to match the length of `values`. For serializing a sequence, `opt_keys` - * determines the order of the sequence. - * @param {T=} opt_this The object to use as `this` for the node factory and - * serializers. - * @template T - */ -ol.xml.serialize = function( - serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) { - var length = (opt_keys !== undefined ? opt_keys : values).length; - var value, node; - for (var i = 0; i < length; ++i) { - value = values[i]; - if (value !== undefined) { - node = nodeFactory.call(opt_this, value, objectStack, - opt_keys !== undefined ? opt_keys[i] : undefined); - if (node !== undefined) { - serializersNS[node.namespaceURI][node.localName] - .call(opt_this, node, value, objectStack); - } - } - } -}; - - -/** - * @param {O} object Object. - * @param {Object.<string, Object.<string, ol.xml.Serializer>>} serializersNS - * Namespaced serializers. - * @param {function(this: T, *, Array.<*>, (string|undefined)): (Node|undefined)} nodeFactory - * Node factory. The `nodeFactory` creates the node whose namespace and name - * will be used to choose a node writer from `serializersNS`. This - * separation allows us to decide what kind of node to create, depending on - * the value we want to serialize. An example for this would be different - * geometry writers based on the geometry type. - * @param {Array.<*>} values Values to serialize. An example would be an array - * of {@link ol.Feature} instances. - * @param {Array.<*>} objectStack Node stack. - * @param {Array.<string>=} opt_keys Keys of the `values`. Will be passed to the - * `nodeFactory`. This is used for serializing object literals where the - * node name relates to the property key. The array length of `opt_keys` has - * to match the length of `values`. For serializing a sequence, `opt_keys` - * determines the order of the sequence. - * @param {T=} opt_this The object to use as `this` for the node factory and - * serializers. - * @return {O|undefined} Object. - * @template O, T - */ -ol.xml.pushSerializeAndPop = function(object, - serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) { - objectStack.push(object); - ol.xml.serialize( - serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this); - return objectStack.pop(); -}; - -goog.provide('ol.FeatureLoader'); -goog.provide('ol.FeatureUrlFunction'); -goog.provide('ol.featureloader'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.net.EventType'); -goog.require('goog.net.XhrIo'); -goog.require('goog.net.XhrIo.ResponseType'); -goog.require('ol.TileState'); -goog.require('ol.format.FormatType'); -goog.require('ol.xml'); - - -/** - * {@link ol.source.Vector} sources use a function of this type to load - * features. - * - * This function takes an {@link ol.Extent} representing the area to be loaded, - * a `{number}` representing the resolution (map units per pixel) and an - * {@link ol.proj.Projection} for the projection as arguments. `this` within - * the function is bound to the {@link ol.source.Vector} it's called from. - * - * The function is responsible for loading the features and adding them to the - * source. - * @api - * @typedef {function(this:ol.source.Vector, ol.Extent, number, - * ol.proj.Projection)} - */ -ol.FeatureLoader; - - -/** - * {@link ol.source.Vector} sources use a function of this type to get the url - * to load features from. - * - * This function takes an {@link ol.Extent} representing the area to be loaded, - * a `{number}` representing the resolution (map units per pixel) and an - * {@link ol.proj.Projection} for the projection as arguments and returns a - * `{string}` representing the URL. - * @api - * @typedef {function(ol.Extent, number, ol.proj.Projection) : string} - */ -ol.FeatureUrlFunction; - - -/** - * @param {string|ol.FeatureUrlFunction} url Feature URL service. - * @param {ol.format.Feature} format Feature format. - * @param {function(this:ol.VectorTile, Array.<ol.Feature>, ol.proj.Projection)|function(this:ol.source.Vector, Array.<ol.Feature>)} success - * Function called with the loaded features and optionally with the data - * projection. Called with the vector tile or source as `this`. - * @param {function(this:ol.VectorTile)|function(this:ol.source.Vector)} failure - * Function called when loading failed. Called with the vector tile or - * source as `this`. - * @return {ol.FeatureLoader} The feature loader. - */ -ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) { - return ( - /** - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @param {ol.proj.Projection} projection Projection. - * @this {ol.source.Vector|ol.VectorTile} - */ - function(extent, resolution, projection) { - var xhrIo = new goog.net.XhrIo(); - xhrIo.setResponseType( - format.getType() == ol.format.FormatType.ARRAY_BUFFER ? - goog.net.XhrIo.ResponseType.ARRAY_BUFFER : - goog.net.XhrIo.ResponseType.TEXT); - goog.events.listen(xhrIo, goog.net.EventType.COMPLETE, - /** - * @param {Event} event Event. - * @private - * @this {ol.source.Vector} - */ - function(event) { - var xhrIo = event.target; - goog.asserts.assertInstanceof(xhrIo, goog.net.XhrIo, - 'event.target/xhrIo is an instance of goog.net.XhrIo'); - if (xhrIo.isSuccess()) { - var type = format.getType(); - /** @type {Document|Node|Object|string|undefined} */ - var source; - if (type == ol.format.FormatType.JSON) { - source = xhrIo.getResponseText(); - } else if (type == ol.format.FormatType.TEXT) { - source = xhrIo.getResponseText(); - } else if (type == ol.format.FormatType.XML) { - if (!goog.userAgent.IE) { - source = xhrIo.getResponseXml(); - } - if (!source) { - source = ol.xml.parse(xhrIo.getResponseText()); - } - } else if (type == ol.format.FormatType.ARRAY_BUFFER) { - source = xhrIo.getResponse(); - } else { - goog.asserts.fail('unexpected format type'); - } - if (source) { - var features = format.readFeatures(source, - {featureProjection: projection}); - if (ol.ENABLE_VECTOR_TILE && success.length == 2) { - success.call(this, features, format.readProjection(source)); - } else { - success.call(this, features); - } - } else { - goog.asserts.fail('undefined or null source'); - } - } else { - failure.call(this); - } - goog.dispose(xhrIo); - }, false, this); - if (goog.isFunction(url)) { - xhrIo.send(url(extent, resolution, projection)); - } else { - xhrIo.send(url); - } - - }); -}; - - -/** - * Create an XHR feature loader for a `url` and `format`. The feature loader - * loads features (with XHR), parses the features, and adds them to the - * vector tile. - * @param {string|ol.FeatureUrlFunction} url Feature URL service. - * @param {ol.format.Feature} format Feature format. - * @return {ol.FeatureLoader} The feature loader. - * @api - */ -ol.featureloader.tile = function(url, format) { - return ol.featureloader.loadFeaturesXhr(url, format, - /** - * @param {Array.<ol.Feature>} features The loaded features. - * @param {ol.proj.Projection} projection Data projection. - * @this {ol.VectorTile} - */ - function(features, projection) { - this.setProjection(projection); - this.setFeatures(features); - }, - /** - * @this {ol.VectorTile} - */ - function() { - this.setState(ol.TileState.ERROR); - }); -}; - - -/** - * Create an XHR feature loader for a `url` and `format`. The feature loader - * loads features (with XHR), parses the features, and adds them to the - * vector source. - * @param {string|ol.FeatureUrlFunction} url Feature URL service. - * @param {ol.format.Feature} format Feature format. - * @return {ol.FeatureLoader} The feature loader. - * @api - */ -ol.featureloader.xhr = function(url, format) { - return ol.featureloader.loadFeaturesXhr(url, format, - /** - * @param {Array.<ol.Feature>} features The loaded features. - * @this {ol.source.Vector} - */ - function(features) { - this.addFeatures(features); - }, /* FIXME handle error */ ol.nullFunction); -}; - -goog.provide('ol.LoadingStrategy'); -goog.provide('ol.loadingstrategy'); - -goog.require('ol.TileCoord'); - - -/** - * @typedef {function(ol.Extent, number): Array.<ol.Extent>} - * @api - */ -ol.LoadingStrategy; - - -/** - * Strategy function for loading all features with a single request. - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @return {Array.<ol.Extent>} Extents. - * @api - */ -ol.loadingstrategy.all = function(extent, resolution) { - return [[-Infinity, -Infinity, Infinity, Infinity]]; -}; - - -/** - * Strategy function for loading features based on the view's extent and - * resolution. - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @return {Array.<ol.Extent>} Extents. - * @api - */ -ol.loadingstrategy.bbox = function(extent, resolution) { - return [extent]; -}; - - -/** - * Creates a strategy function for loading features based on a tile grid. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @return {function(ol.Extent, number): Array.<ol.Extent>} Loading strategy. - * @api - */ -ol.loadingstrategy.tile = function(tileGrid) { - return ( - /** - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @return {Array.<ol.Extent>} Extents. - */ - function(extent, resolution) { - var z = tileGrid.getZForResolution(resolution); - var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); - /** @type {Array.<ol.Extent>} */ - var extents = []; - /** @type {ol.TileCoord} */ - var tileCoord = [z, 0, 0]; - for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX; - ++tileCoord[1]) { - for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY; - ++tileCoord[2]) { - extents.push(tileGrid.getTileCoordExtent(tileCoord)); - } - } - return extents; - }); -}; - -goog.provide('ol.ext.rbush'); -/** @typedef {function(*)} */ -ol.ext.rbush; -(function() { -var exports = {}; -var module = {exports: exports}; -var define; -/** - * @fileoverview - * @suppress {accessControls, ambiguousFunctionDecl, checkDebuggerStatement, checkRegExp, checkTypes, checkVars, const, constantProperty, deprecated, duplicate, es5Strict, fileoverviewTags, missingProperties, nonStandardJsDocs, strictModuleDepCheck, suspiciousCode, undefinedNames, undefinedVars, unknownDefines, uselessCode, visibility} - */ -/* - (c) 2015, Vladimir Agafonkin - RBush, a JavaScript library for high-performance 2D spatial indexing of points and rectangles. - https://github.com/mourner/rbush -*/ - -(function () { 'use strict'; - -function rbush(maxEntries, format) { - - // jshint newcap: false, validthis: true - if (!(this instanceof rbush)) return new rbush(maxEntries, format); - - // max entries in a node is 9 by default; min node fill is 40% for best performance - this._maxEntries = Math.max(4, maxEntries || 9); - this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)); - - if (format) { - this._initFormat(format); - } - - this.clear(); -} - -rbush.prototype = { - - all: function () { - return this._all(this.data, []); - }, - - search: function (bbox) { - - var node = this.data, - result = [], - toBBox = this.toBBox; - - if (!intersects(bbox, node.bbox)) return result; - - var nodesToSearch = [], - i, len, child, childBBox; - - while (node) { - for (i = 0, len = node.children.length; i < len; i++) { - - child = node.children[i]; - childBBox = node.leaf ? toBBox(child) : child.bbox; - - if (intersects(bbox, childBBox)) { - if (node.leaf) result.push(child); - else if (contains(bbox, childBBox)) this._all(child, result); - else nodesToSearch.push(child); - } - } - node = nodesToSearch.pop(); - } - - return result; - }, - - collides: function (bbox) { - - var node = this.data, - toBBox = this.toBBox; - - if (!intersects(bbox, node.bbox)) return false; - - var nodesToSearch = [], - i, len, child, childBBox; - - while (node) { - for (i = 0, len = node.children.length; i < len; i++) { - - child = node.children[i]; - childBBox = node.leaf ? toBBox(child) : child.bbox; - - if (intersects(bbox, childBBox)) { - if (node.leaf || contains(bbox, childBBox)) return true; - nodesToSearch.push(child); - } - } - node = nodesToSearch.pop(); - } - - return false; - }, - - load: function (data) { - if (!(data && data.length)) return this; - - if (data.length < this._minEntries) { - for (var i = 0, len = data.length; i < len; i++) { - this.insert(data[i]); - } - return this; - } - - // recursively build the tree with the given data from stratch using OMT algorithm - var node = this._build(data.slice(), 0, data.length - 1, 0); - - if (!this.data.children.length) { - // save as is if tree is empty - this.data = node; - - } else if (this.data.height === node.height) { - // split root if trees have the same height - this._splitRoot(this.data, node); - - } else { - if (this.data.height < node.height) { - // swap trees if inserted one is bigger - var tmpNode = this.data; - this.data = node; - node = tmpNode; - } - - // insert the small tree into the large tree at appropriate level - this._insert(node, this.data.height - node.height - 1, true); - } - - return this; - }, - - insert: function (item) { - if (item) this._insert(item, this.data.height - 1); - return this; - }, - - clear: function () { - this.data = { - children: [], - height: 1, - bbox: empty(), - leaf: true - }; - return this; - }, - - remove: function (item) { - if (!item) return this; - - var node = this.data, - bbox = this.toBBox(item), - path = [], - indexes = [], - i, parent, index, goingUp; - - // depth-first iterative tree traversal - while (node || path.length) { - - if (!node) { // go up - node = path.pop(); - parent = path[path.length - 1]; - i = indexes.pop(); - goingUp = true; - } - - if (node.leaf) { // check current node - index = node.children.indexOf(item); - - if (index !== -1) { - // item found, remove the item and condense tree upwards - node.children.splice(index, 1); - path.push(node); - this._condense(path); - return this; - } - } - - if (!goingUp && !node.leaf && contains(node.bbox, bbox)) { // go down - path.push(node); - indexes.push(i); - i = 0; - parent = node; - node = node.children[0]; - - } else if (parent) { // go right - i++; - node = parent.children[i]; - goingUp = false; - - } else node = null; // nothing found - } - - return this; - }, - - toBBox: function (item) { return item; }, - - compareMinX: function (a, b) { return a[0] - b[0]; }, - compareMinY: function (a, b) { return a[1] - b[1]; }, - - toJSON: function () { return this.data; }, - - fromJSON: function (data) { - this.data = data; - return this; - }, - - _all: function (node, result) { - var nodesToSearch = []; - while (node) { - if (node.leaf) result.push.apply(result, node.children); - else nodesToSearch.push.apply(nodesToSearch, node.children); - - node = nodesToSearch.pop(); - } - return result; - }, - - _build: function (items, left, right, height) { - - var N = right - left + 1, - M = this._maxEntries, - node; - - if (N <= M) { - // reached leaf level; return leaf - node = { - children: items.slice(left, right + 1), - height: 1, - bbox: null, - leaf: true - }; - calcBBox(node, this.toBBox); - return node; - } - - if (!height) { - // target height of the bulk-loaded tree - height = Math.ceil(Math.log(N) / Math.log(M)); - - // target number of root entries to maximize storage utilization - M = Math.ceil(N / Math.pow(M, height - 1)); - } - - // TODO eliminate recursion? - - node = { - children: [], - height: height, - bbox: null - }; - - // split the items into M mostly square tiles - - var N2 = Math.ceil(N / M), - N1 = N2 * Math.ceil(Math.sqrt(M)), - i, j, right2, right3; - - multiSelect(items, left, right, N1, this.compareMinX); - - for (i = left; i <= right; i += N1) { - - right2 = Math.min(i + N1 - 1, right); - - multiSelect(items, i, right2, N2, this.compareMinY); - - for (j = i; j <= right2; j += N2) { - - right3 = Math.min(j + N2 - 1, right2); - - // pack each entry recursively - node.children.push(this._build(items, j, right3, height - 1)); - } - } - - calcBBox(node, this.toBBox); - - return node; - }, - - _chooseSubtree: function (bbox, node, level, path) { - - var i, len, child, targetNode, area, enlargement, minArea, minEnlargement; - - while (true) { - path.push(node); - - if (node.leaf || path.length - 1 === level) break; - - minArea = minEnlargement = Infinity; - - for (i = 0, len = node.children.length; i < len; i++) { - child = node.children[i]; - area = bboxArea(child.bbox); - enlargement = enlargedArea(bbox, child.bbox) - area; - - // choose entry with the least area enlargement - if (enlargement < minEnlargement) { - minEnlargement = enlargement; - minArea = area < minArea ? area : minArea; - targetNode = child; - - } else if (enlargement === minEnlargement) { - // otherwise choose one with the smallest area - if (area < minArea) { - minArea = area; - targetNode = child; - } - } - } - - node = targetNode; - } - - return node; - }, - - _insert: function (item, level, isNode) { - - var toBBox = this.toBBox, - bbox = isNode ? item.bbox : toBBox(item), - insertPath = []; - - // find the best node for accommodating the item, saving all nodes along the path too - var node = this._chooseSubtree(bbox, this.data, level, insertPath); - - // put the item into the node - node.children.push(item); - extend(node.bbox, bbox); - - // split on node overflow; propagate upwards if necessary - while (level >= 0) { - if (insertPath[level].children.length > this._maxEntries) { - this._split(insertPath, level); - level--; - } else break; - } - - // adjust bboxes along the insertion path - this._adjustParentBBoxes(bbox, insertPath, level); - }, - - // split overflowed node into two - _split: function (insertPath, level) { - - var node = insertPath[level], - M = node.children.length, - m = this._minEntries; - - this._chooseSplitAxis(node, m, M); - - var splitIndex = this._chooseSplitIndex(node, m, M); - - var newNode = { - children: node.children.splice(splitIndex, node.children.length - splitIndex), - height: node.height - }; - - if (node.leaf) newNode.leaf = true; - - calcBBox(node, this.toBBox); - calcBBox(newNode, this.toBBox); - - if (level) insertPath[level - 1].children.push(newNode); - else this._splitRoot(node, newNode); - }, - - _splitRoot: function (node, newNode) { - // split root node - this.data = { - children: [node, newNode], - height: node.height + 1 - }; - calcBBox(this.data, this.toBBox); - }, - - _chooseSplitIndex: function (node, m, M) { - - var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index; - - minOverlap = minArea = Infinity; - - for (i = m; i <= M - m; i++) { - bbox1 = distBBox(node, 0, i, this.toBBox); - bbox2 = distBBox(node, i, M, this.toBBox); - - overlap = intersectionArea(bbox1, bbox2); - area = bboxArea(bbox1) + bboxArea(bbox2); - - // choose distribution with minimum overlap - if (overlap < minOverlap) { - minOverlap = overlap; - index = i; - - minArea = area < minArea ? area : minArea; - - } else if (overlap === minOverlap) { - // otherwise choose distribution with minimum area - if (area < minArea) { - minArea = area; - index = i; - } - } - } - - return index; - }, - - // sorts node children by the best axis for split - _chooseSplitAxis: function (node, m, M) { - - var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, - compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, - xMargin = this._allDistMargin(node, m, M, compareMinX), - yMargin = this._allDistMargin(node, m, M, compareMinY); - - // if total distributions margin value is minimal for x, sort by minX, - // otherwise it's already sorted by minY - if (xMargin < yMargin) node.children.sort(compareMinX); - }, - - // total margin of all possible split distributions where each node is at least m full - _allDistMargin: function (node, m, M, compare) { - - node.children.sort(compare); - - var toBBox = this.toBBox, - leftBBox = distBBox(node, 0, m, toBBox), - rightBBox = distBBox(node, M - m, M, toBBox), - margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), - i, child; - - for (i = m; i < M - m; i++) { - child = node.children[i]; - extend(leftBBox, node.leaf ? toBBox(child) : child.bbox); - margin += bboxMargin(leftBBox); - } - - for (i = M - m - 1; i >= m; i--) { - child = node.children[i]; - extend(rightBBox, node.leaf ? toBBox(child) : child.bbox); - margin += bboxMargin(rightBBox); - } - - return margin; - }, - - _adjustParentBBoxes: function (bbox, path, level) { - // adjust bboxes along the given tree path - for (var i = level; i >= 0; i--) { - extend(path[i].bbox, bbox); - } - }, - - _condense: function (path) { - // go through the path, removing empty nodes and updating bboxes - for (var i = path.length - 1, siblings; i >= 0; i--) { - if (path[i].children.length === 0) { - if (i > 0) { - siblings = path[i - 1].children; - siblings.splice(siblings.indexOf(path[i]), 1); - - } else this.clear(); - - } else calcBBox(path[i], this.toBBox); - } - }, - - _initFormat: function (format) { - // data format (minX, minY, maxX, maxY accessors) - - // uses eval-type function compilation instead of just accepting a toBBox function - // because the algorithms are very sensitive to sorting functions performance, - // so they should be dead simple and without inner calls - - // jshint evil: true - - var compareArr = ['return a', ' - b', ';']; - - this.compareMinX = new Function('a', 'b', compareArr.join(format[0])); - this.compareMinY = new Function('a', 'b', compareArr.join(format[1])); - - this.toBBox = new Function('a', 'return [a' + format.join(', a') + '];'); - } -}; - - -// calculate node's bbox from bboxes of its children -function calcBBox(node, toBBox) { - node.bbox = distBBox(node, 0, node.children.length, toBBox); -} - -// min bounding rectangle of node children from k to p-1 -function distBBox(node, k, p, toBBox) { - var bbox = empty(); - - for (var i = k, child; i < p; i++) { - child = node.children[i]; - extend(bbox, node.leaf ? toBBox(child) : child.bbox); - } - - return bbox; -} - -function empty() { return [Infinity, Infinity, -Infinity, -Infinity]; } - -function extend(a, b) { - a[0] = Math.min(a[0], b[0]); - a[1] = Math.min(a[1], b[1]); - a[2] = Math.max(a[2], b[2]); - a[3] = Math.max(a[3], b[3]); - return a; -} - -function compareNodeMinX(a, b) { return a.bbox[0] - b.bbox[0]; } -function compareNodeMinY(a, b) { return a.bbox[1] - b.bbox[1]; } - -function bboxArea(a) { return (a[2] - a[0]) * (a[3] - a[1]); } -function bboxMargin(a) { return (a[2] - a[0]) + (a[3] - a[1]); } - -function enlargedArea(a, b) { - return (Math.max(b[2], a[2]) - Math.min(b[0], a[0])) * - (Math.max(b[3], a[3]) - Math.min(b[1], a[1])); -} - -function intersectionArea(a, b) { - var minX = Math.max(a[0], b[0]), - minY = Math.max(a[1], b[1]), - maxX = Math.min(a[2], b[2]), - maxY = Math.min(a[3], b[3]); - - return Math.max(0, maxX - minX) * - Math.max(0, maxY - minY); -} - -function contains(a, b) { - return a[0] <= b[0] && - a[1] <= b[1] && - b[2] <= a[2] && - b[3] <= a[3]; -} - -function intersects(a, b) { - return b[0] <= a[2] && - b[1] <= a[3] && - b[2] >= a[0] && - b[3] >= a[1]; -} - -// sort an array so that items come in groups of n unsorted items, with groups sorted between each other; -// combines selection algorithm with binary divide & conquer approach - -function multiSelect(arr, left, right, n, compare) { - var stack = [left, right], - mid; - - while (stack.length) { - right = stack.pop(); - left = stack.pop(); - - if (right - left <= n) continue; - - mid = left + Math.ceil((right - left) / n / 2) * n; - select(arr, left, right, mid, compare); - - stack.push(left, mid, mid, right); - } -} - -// Floyd-Rivest selection algorithm: -// sort an array between left and right (inclusive) so that the smallest k elements come first (unordered) -function select(arr, left, right, k, compare) { - var n, i, z, s, sd, newLeft, newRight, t, j; - - while (right > left) { - if (right - left > 600) { - n = right - left + 1; - i = k - left + 1; - z = Math.log(n); - s = 0.5 * Math.exp(2 * z / 3); - sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (i - n / 2 < 0 ? -1 : 1); - newLeft = Math.max(left, Math.floor(k - i * s / n + sd)); - newRight = Math.min(right, Math.floor(k + (n - i) * s / n + sd)); - select(arr, newLeft, newRight, k, compare); - } - - t = arr[k]; - i = left; - j = right; - - swap(arr, left, k); - if (compare(arr[right], t) > 0) swap(arr, left, right); - - while (i < j) { - swap(arr, i, j); - i++; - j--; - while (compare(arr[i], t) < 0) i++; - while (compare(arr[j], t) > 0) j--; - } - - if (compare(arr[left], t) === 0) swap(arr, left, j); - else { - j++; - swap(arr, j, right); - } - - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } -} - -function swap(arr, i, j) { - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - - -// export as AMD/CommonJS module or global variable -if (typeof define === 'function' && define.amd) define('rbush', function() { return rbush; }); -else if (typeof module !== 'undefined') module.exports = rbush; -else if (typeof self !== 'undefined') self.rbush = rbush; -else window.rbush = rbush; - -})(); - -ol.ext.rbush = module.exports; -})(); - -goog.provide('ol.structs.RBush'); - -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol.ext.rbush'); -goog.require('ol.extent'); - - - -/** - * Wrapper around the RBush by Vladimir Agafonkin. - * - * @constructor - * @param {number=} opt_maxEntries Max entries. - * @see https://github.com/mourner/rbush - * @struct - * @template T - */ -ol.structs.RBush = function(opt_maxEntries) { - - /** - * @private - */ - this.rbush_ = ol.ext.rbush(opt_maxEntries); - - /** - * A mapping between the objects added to this rbush wrapper - * and the objects that are actually added to the internal rbush. - * @private - * @type {Object.<number, Object>} - */ - this.items_ = {}; - - if (goog.DEBUG) { - /** - * @private - * @type {number} - */ - this.readers_ = 0; - } -}; - - -/** - * Insert a value into the RBush. - * @param {ol.Extent} extent Extent. - * @param {T} value Value. - */ -ol.structs.RBush.prototype.insert = function(extent, value) { - if (goog.DEBUG && this.readers_) { - throw new Error('Can not insert value while reading'); - } - var item = [ - extent[0], - extent[1], - extent[2], - extent[3], - value - ]; - this.rbush_.insert(item); - // remember the object that was added to the internal rbush - goog.asserts.assert( - !goog.object.containsKey(this.items_, goog.getUid(value)), - 'uid (%s) of value (%s) already exists', goog.getUid(value), value); - this.items_[goog.getUid(value)] = item; -}; - - -/** - * Bulk-insert values into the RBush. - * @param {Array.<ol.Extent>} extents Extents. - * @param {Array.<T>} values Values. - */ -ol.structs.RBush.prototype.load = function(extents, values) { - if (goog.DEBUG && this.readers_) { - throw new Error('Can not insert values while reading'); - } - goog.asserts.assert(extents.length === values.length, - 'extens and values must have same length (%s === %s)', - extents.length, values.length); - - var items = new Array(values.length); - for (var i = 0, l = values.length; i < l; i++) { - var extent = extents[i]; - var value = values[i]; - - var item = [ - extent[0], - extent[1], - extent[2], - extent[3], - value - ]; - items[i] = item; - goog.asserts.assert( - !goog.object.containsKey(this.items_, goog.getUid(value)), - 'uid (%s) of value (%s) already exists', goog.getUid(value), value); - this.items_[goog.getUid(value)] = item; - } - this.rbush_.load(items); -}; - - -/** - * Remove a value from the RBush. - * @param {T} value Value. - * @return {boolean} Removed. - */ -ol.structs.RBush.prototype.remove = function(value) { - if (goog.DEBUG && this.readers_) { - throw new Error('Can not remove value while reading'); - } - var uid = goog.getUid(value); - goog.asserts.assert(goog.object.containsKey(this.items_, uid), - 'uid (%s) of value (%s) does not exist', uid, value); - - // get the object in which the value was wrapped when adding to the - // internal rbush. then use that object to do the removal. - var item = this.items_[uid]; - delete this.items_[uid]; - return this.rbush_.remove(item) !== null; -}; - - -/** - * Update the extent of a value in the RBush. - * @param {ol.Extent} extent Extent. - * @param {T} value Value. - */ -ol.structs.RBush.prototype.update = function(extent, value) { - var uid = goog.getUid(value); - goog.asserts.assert(goog.object.containsKey(this.items_, uid), - 'uid (%s) of value (%s) does not exist', uid, value); - - var item = this.items_[uid]; - if (!ol.extent.equals(item.slice(0, 4), extent)) { - if (goog.DEBUG && this.readers_) { - throw new Error('Can not update extent while reading'); - } - this.remove(value); - this.insert(extent, value); - } -}; - - -/** - * Return all values in the RBush. - * @return {Array.<T>} All. - */ -ol.structs.RBush.prototype.getAll = function() { - var items = this.rbush_.all(); - return items.map(function(item) { - return item[4]; - }); -}; - - -/** - * Return all values in the given extent. - * @param {ol.Extent} extent Extent. - * @return {Array.<T>} All in extent. - */ -ol.structs.RBush.prototype.getInExtent = function(extent) { - var items = this.rbush_.search(extent); - return items.map(function(item) { - return item[4]; - }); -}; - - -/** - * Calls a callback function with each value in the tree. - * If the callback returns a truthy value, this value is returned without - * checking the rest of the tree. - * @param {function(this: S, T): *} callback Callback. - * @param {S=} opt_this The object to use as `this` in `callback`. - * @return {*} Callback return value. - * @template S - */ -ol.structs.RBush.prototype.forEach = function(callback, opt_this) { - if (goog.DEBUG) { - ++this.readers_; - try { - return this.forEach_(this.getAll(), callback, opt_this); - } finally { - --this.readers_; - } - } else { - return this.forEach_(this.getAll(), callback, opt_this); - } -}; - - -/** - * Calls a callback function with each value in the provided extent. - * @param {ol.Extent} extent Extent. - * @param {function(this: S, T): *} callback Callback. - * @param {S=} opt_this The object to use as `this` in `callback`. - * @return {*} Callback return value. - * @template S - */ -ol.structs.RBush.prototype.forEachInExtent = - function(extent, callback, opt_this) { - if (goog.DEBUG) { - ++this.readers_; - try { - return this.forEach_(this.getInExtent(extent), callback, opt_this); - } finally { - --this.readers_; - } - } else { - return this.forEach_(this.getInExtent(extent), callback, opt_this); - } -}; - - -/** - * @param {Array.<T>} values Values. - * @param {function(this: S, T): *} callback Callback. - * @param {S=} opt_this The object to use as `this` in `callback`. - * @private - * @return {*} Callback return value. - * @template S - */ -ol.structs.RBush.prototype.forEach_ = function(values, callback, opt_this) { - var result; - for (var i = 0, l = values.length; i < l; i++) { - result = callback.call(opt_this, values[i]); - if (result) { - return result; - } - } - return result; -}; - - -/** - * @return {boolean} Is empty. - */ -ol.structs.RBush.prototype.isEmpty = function() { - return goog.object.isEmpty(this.items_); -}; - - -/** - * Remove all values from the RBush. - */ -ol.structs.RBush.prototype.clear = function() { - this.rbush_.clear(); - this.items_ = {}; -}; - - -/** - * @param {ol.Extent=} opt_extent Extent. - * @return {!ol.Extent} Extent. - */ -ol.structs.RBush.prototype.getExtent = function(opt_extent) { - // FIXME add getExtent() to rbush - return this.rbush_.data.bbox; -}; - -// FIXME bulk feature upload - suppress events -// FIXME make change-detection more refined (notably, geometry hint) - -goog.provide('ol.source.Vector'); -goog.provide('ol.source.VectorEvent'); -goog.provide('ol.source.VectorEventType'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Collection'); -goog.require('ol.CollectionEventType'); -goog.require('ol.Extent'); -goog.require('ol.Feature'); -goog.require('ol.FeatureLoader'); -goog.require('ol.LoadingStrategy'); -goog.require('ol.ObjectEventType'); -goog.require('ol.extent'); -goog.require('ol.featureloader'); -goog.require('ol.loadingstrategy'); -goog.require('ol.proj'); -goog.require('ol.source.Source'); -goog.require('ol.source.State'); -goog.require('ol.structs.RBush'); - - -/** - * @enum {string} - */ -ol.source.VectorEventType = { - /** - * Triggered when a feature is added to the source. - * @event ol.source.VectorEvent#addfeature - * @api stable - */ - ADDFEATURE: 'addfeature', - - /** - * Triggered when a feature is updated. - * @event ol.source.VectorEvent#changefeature - * @api - */ - CHANGEFEATURE: 'changefeature', - - /** - * Triggered when the clear method is called on the source. - * @event ol.source.VectorEvent#clear - * @api - */ - CLEAR: 'clear', - - /** - * Triggered when a feature is removed from the source. - * See {@link ol.source.Vector#clear source.clear()} for exceptions. - * @event ol.source.VectorEvent#removefeature - * @api stable - */ - REMOVEFEATURE: 'removefeature' -}; - - - -/** - * @classdesc - * Provides a source of features for vector layers. Vector features provided - * by this source are suitable for editing. See {@link ol.source.VectorTile} for - * vector data that is optimized for rendering. - * - * @constructor - * @extends {ol.source.Source} - * @fires ol.source.VectorEvent - * @param {olx.source.VectorOptions=} opt_options Vector source options. - * @api stable - */ -ol.source.Vector = function(opt_options) { - - var options = opt_options || {}; - - goog.base(this, { - attributions: options.attributions, - logo: options.logo, - projection: undefined, - state: ol.source.State.READY, - wrapX: options.wrapX !== undefined ? options.wrapX : true - }); - - /** - * @private - * @type {ol.FeatureLoader} - */ - this.loader_ = ol.nullFunction; - - if (options.loader !== undefined) { - this.loader_ = options.loader; - } else if (options.url !== undefined) { - goog.asserts.assert(options.format !== undefined, - 'format must be set when url is set'); - // create a XHR feature loader for "url" and "format" - this.loader_ = ol.featureloader.xhr(options.url, options.format); - } - - /** - * @private - * @type {ol.LoadingStrategy} - */ - this.strategy_ = options.strategy !== undefined ? options.strategy : - ol.loadingstrategy.all; - - var useSpatialIndex = - options.useSpatialIndex !== undefined ? options.useSpatialIndex : true; - - /** - * @private - * @type {ol.structs.RBush.<ol.Feature>} - */ - this.featuresRtree_ = useSpatialIndex ? new ol.structs.RBush() : null; - - /** - * @private - * @type {ol.structs.RBush.<{extent: ol.Extent}>} - */ - this.loadedExtentsRtree_ = new ol.structs.RBush(); - - /** - * @private - * @type {Object.<string, ol.Feature>} - */ - this.nullGeometryFeatures_ = {}; - - /** - * A lookup of features by id (the return from feature.getId()). - * @private - * @type {Object.<string, ol.Feature>} - */ - this.idIndex_ = {}; - - /** - * A lookup of features without id (keyed by goog.getUid(feature)). - * @private - * @type {Object.<string, ol.Feature>} - */ - this.undefIdIndex_ = {}; - - /** - * @private - * @type {Object.<string, Array.<goog.events.Key>>} - */ - this.featureChangeKeys_ = {}; - - /** - * @private - * @type {ol.Collection.<ol.Feature>} - */ - this.featuresCollection_ = null; - - var collection, features; - if (options.features instanceof ol.Collection) { - collection = options.features; - features = collection.getArray(); - } else if (goog.isArray(options.features)) { - features = options.features; - } - if (!useSpatialIndex && collection === undefined) { - collection = new ol.Collection(features); - } - if (features !== undefined) { - this.addFeaturesInternal(features); - } - if (collection !== undefined) { - this.bindFeaturesCollection_(collection); - } - -}; -goog.inherits(ol.source.Vector, ol.source.Source); - - -/** - * Add a single feature to the source. If you want to add a batch of features - * at once, call {@link ol.source.Vector#addFeatures source.addFeatures()} - * instead. - * @param {ol.Feature} feature Feature to add. - * @api stable - */ -ol.source.Vector.prototype.addFeature = function(feature) { - this.addFeatureInternal(feature); - this.changed(); -}; - - -/** - * Add a feature without firing a `change` event. - * @param {ol.Feature} feature Feature. - * @protected - */ -ol.source.Vector.prototype.addFeatureInternal = function(feature) { - var featureKey = goog.getUid(feature).toString(); - - if (!this.addToIndex_(featureKey, feature)) { - return; - } - - this.setupChangeEvents_(featureKey, feature); - - var geometry = feature.getGeometry(); - if (geometry) { - var extent = geometry.getExtent(); - if (this.featuresRtree_) { - this.featuresRtree_.insert(extent, feature); - } - } else { - this.nullGeometryFeatures_[featureKey] = feature; - } - - this.dispatchEvent( - new ol.source.VectorEvent(ol.source.VectorEventType.ADDFEATURE, feature)); -}; - - -/** - * @param {string} featureKey - * @param {ol.Feature} feature - * @private - */ -ol.source.Vector.prototype.setupChangeEvents_ = function(featureKey, feature) { - goog.asserts.assert(!(featureKey in this.featureChangeKeys_), - 'key (%s) not yet registered in featureChangeKey', featureKey); - this.featureChangeKeys_[featureKey] = [ - goog.events.listen(feature, - goog.events.EventType.CHANGE, - this.handleFeatureChange_, false, this), - goog.events.listen(feature, - ol.ObjectEventType.PROPERTYCHANGE, - this.handleFeatureChange_, false, this) - ]; -}; - - -/** - * @param {string} featureKey - * @param {ol.Feature} feature - * @return {boolean} `true` if the feature is "valid", in the sense that it is - * also a candidate for insertion into the Rtree, otherwise `false`. - * @private - */ -ol.source.Vector.prototype.addToIndex_ = function(featureKey, feature) { - var valid = true; - var id = feature.getId(); - if (id !== undefined) { - if (!(id.toString() in this.idIndex_)) { - this.idIndex_[id.toString()] = feature; - } else { - valid = false; - } - } else { - goog.asserts.assert(!(featureKey in this.undefIdIndex_), - 'Feature already added to the source'); - this.undefIdIndex_[featureKey] = feature; - } - return valid; -}; - - -/** - * Add a batch of features to the source. - * @param {Array.<ol.Feature>} features Features to add. - * @api stable - */ -ol.source.Vector.prototype.addFeatures = function(features) { - this.addFeaturesInternal(features); - this.changed(); -}; - - -/** - * Add features without firing a `change` event. - * @param {Array.<ol.Feature>} features Features. - * @protected - */ -ol.source.Vector.prototype.addFeaturesInternal = function(features) { - var featureKey, i, length, feature; - - var extents = []; - var newFeatures = []; - var geometryFeatures = []; - - for (i = 0, length = features.length; i < length; i++) { - feature = features[i]; - featureKey = goog.getUid(feature).toString(); - if (this.addToIndex_(featureKey, feature)) { - newFeatures.push(feature); - } - } - - for (i = 0, length = newFeatures.length; i < length; i++) { - feature = newFeatures[i]; - featureKey = goog.getUid(feature).toString(); - this.setupChangeEvents_(featureKey, feature); - - var geometry = feature.getGeometry(); - if (geometry) { - var extent = geometry.getExtent(); - extents.push(extent); - geometryFeatures.push(feature); - } else { - this.nullGeometryFeatures_[featureKey] = feature; - } - } - if (this.featuresRtree_) { - this.featuresRtree_.load(extents, geometryFeatures); - } - - for (i = 0, length = newFeatures.length; i < length; i++) { - this.dispatchEvent(new ol.source.VectorEvent( - ol.source.VectorEventType.ADDFEATURE, newFeatures[i])); - } -}; - - -/** - * @param {!ol.Collection.<ol.Feature>} collection Collection. - * @private - */ -ol.source.Vector.prototype.bindFeaturesCollection_ = function(collection) { - goog.asserts.assert(!this.featuresCollection_, - 'bindFeaturesCollection can only be called once'); - var modifyingCollection = false; - goog.events.listen(this, ol.source.VectorEventType.ADDFEATURE, - function(evt) { - if (!modifyingCollection) { - modifyingCollection = true; - collection.push(evt.feature); - modifyingCollection = false; - } - }); - goog.events.listen(this, ol.source.VectorEventType.REMOVEFEATURE, - function(evt) { - if (!modifyingCollection) { - modifyingCollection = true; - collection.remove(evt.feature); - modifyingCollection = false; - } - }); - goog.events.listen(collection, ol.CollectionEventType.ADD, - function(evt) { - if (!modifyingCollection) { - var feature = evt.element; - goog.asserts.assertInstanceof(feature, ol.Feature); - modifyingCollection = true; - this.addFeature(feature); - modifyingCollection = false; - } - }, false, this); - goog.events.listen(collection, ol.CollectionEventType.REMOVE, - function(evt) { - if (!modifyingCollection) { - var feature = evt.element; - goog.asserts.assertInstanceof(feature, ol.Feature); - modifyingCollection = true; - this.removeFeature(feature); - modifyingCollection = false; - } - }, false, this); - this.featuresCollection_ = collection; -}; - - -/** - * Remove all features from the source. - * @param {boolean=} opt_fast Skip dispatching of {@link removefeature} events. - * @api stable - */ -ol.source.Vector.prototype.clear = function(opt_fast) { - if (opt_fast) { - for (var featureId in this.featureChangeKeys_) { - var keys = this.featureChangeKeys_[featureId]; - keys.forEach(goog.events.unlistenByKey); - } - if (!this.featuresCollection_) { - this.featureChangeKeys_ = {}; - this.idIndex_ = {}; - this.undefIdIndex_ = {}; - } - } else { - var rmFeatureInternal = this.removeFeatureInternal; - if (this.featuresRtree_) { - this.featuresRtree_.forEach(rmFeatureInternal, this); - goog.object.forEach(this.nullGeometryFeatures_, rmFeatureInternal, this); - } - } - if (this.featuresCollection_) { - this.featuresCollection_.clear(); - } - goog.asserts.assert(goog.object.isEmpty(this.featureChangeKeys_), - 'featureChangeKeys is an empty object now'); - goog.asserts.assert(goog.object.isEmpty(this.idIndex_), - 'idIndex is an empty object now'); - goog.asserts.assert(goog.object.isEmpty(this.undefIdIndex_), - 'undefIdIndex is an empty object now'); - - if (this.featuresRtree_) { - this.featuresRtree_.clear(); - } - this.loadedExtentsRtree_.clear(); - this.nullGeometryFeatures_ = {}; - - var clearEvent = new ol.source.VectorEvent(ol.source.VectorEventType.CLEAR); - this.dispatchEvent(clearEvent); - this.changed(); -}; - - -/** - * Iterate through all features on the source, calling the provided callback - * with each one. If the callback returns any "truthy" value, iteration will - * stop and the function will return the same value. - * - * @param {function(this: T, ol.Feature): S} callback Called with each feature - * on the source. Return a truthy value to stop iteration. - * @param {T=} opt_this The object to use as `this` in the callback. - * @return {S|undefined} The return value from the last call to the callback. - * @template T,S - * @api stable - */ -ol.source.Vector.prototype.forEachFeature = function(callback, opt_this) { - if (this.featuresRtree_) { - return this.featuresRtree_.forEach(callback, opt_this); - } else if (this.featuresCollection_) { - return this.featuresCollection_.forEach(callback, opt_this); - } -}; - - -/** - * Iterate through all features whose geometries contain the provided - * coordinate, calling the callback with each feature. If the callback returns - * a "truthy" value, iteration will stop and the function will return the same - * value. - * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {function(this: T, ol.Feature): S} callback Called with each feature - * whose goemetry contains the provided coordinate. - * @param {T=} opt_this The object to use as `this` in the callback. - * @return {S|undefined} The return value from the last call to the callback. - * @template T,S - */ -ol.source.Vector.prototype.forEachFeatureAtCoordinateDirect = - function(coordinate, callback, opt_this) { - var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]]; - return this.forEachFeatureInExtent(extent, function(feature) { - var geometry = feature.getGeometry(); - goog.asserts.assert(geometry, 'feature geometry is defined and not null'); - if (geometry.containsCoordinate(coordinate)) { - return callback.call(opt_this, feature); - } else { - return undefined; - } - }); -}; - - -/** - * Iterate through all features whose bounding box intersects the provided - * extent (note that the feature's geometry may not intersect the extent), - * calling the callback with each feature. If the callback returns a "truthy" - * value, iteration will stop and the function will return the same value. - * - * If you are interested in features whose geometry intersects an extent, call - * the {@link ol.source.Vector#forEachFeatureIntersectingExtent - * source.forEachFeatureIntersectingExtent()} method instead. - * - * When `useSpatialIndex` is set to false, this method will loop through all - * features, equivalent to {@link ol.source.Vector#forEachFeature}. - * - * @param {ol.Extent} extent Extent. - * @param {function(this: T, ol.Feature): S} callback Called with each feature - * whose bounding box intersects the provided extent. - * @param {T=} opt_this The object to use as `this` in the callback. - * @return {S|undefined} The return value from the last call to the callback. - * @template T,S - * @api - */ -ol.source.Vector.prototype.forEachFeatureInExtent = - function(extent, callback, opt_this) { - if (this.featuresRtree_) { - return this.featuresRtree_.forEachInExtent(extent, callback, opt_this); - } else if (this.featuresCollection_) { - return this.featuresCollection_.forEach(callback, opt_this); - } -}; - - -/** - * Iterate through all features whose geometry intersects the provided extent, - * calling the callback with each feature. If the callback returns a "truthy" - * value, iteration will stop and the function will return the same value. - * - * If you only want to test for bounding box intersection, call the - * {@link ol.source.Vector#forEachFeatureInExtent - * source.forEachFeatureInExtent()} method instead. - * - * @param {ol.Extent} extent Extent. - * @param {function(this: T, ol.Feature): S} callback Called with each feature - * whose geometry intersects the provided extent. - * @param {T=} opt_this The object to use as `this` in the callback. - * @return {S|undefined} The return value from the last call to the callback. - * @template T,S - * @api - */ -ol.source.Vector.prototype.forEachFeatureIntersectingExtent = - function(extent, callback, opt_this) { - return this.forEachFeatureInExtent(extent, - /** - * @param {ol.Feature} feature Feature. - * @return {S|undefined} - * @template S - */ - function(feature) { - var geometry = feature.getGeometry(); - goog.asserts.assert(geometry, - 'feature geometry is defined and not null'); - if (geometry.intersectsExtent(extent)) { - var result = callback.call(opt_this, feature); - if (result) { - return result; - } - } - }); -}; - - -/** - * Get the features collection associated with this source. Will be `null` - * unless the source was configured with `useSpatialIndex` set to `false`, or - * with an {@link ol.Collection} as `features`. - * @return {ol.Collection.<ol.Feature>} - * @api - */ -ol.source.Vector.prototype.getFeaturesCollection = function() { - return this.featuresCollection_; -}; - - -/** - * Get all features on the source. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.source.Vector.prototype.getFeatures = function() { - var features; - if (this.featuresCollection_) { - features = this.featuresCollection_.getArray(); - } else if (this.featuresRtree_) { - features = this.featuresRtree_.getAll(); - if (!goog.object.isEmpty(this.nullGeometryFeatures_)) { - goog.array.extend( - features, goog.object.getValues(this.nullGeometryFeatures_)); - } - } - goog.asserts.assert(features !== undefined, - 'Neither featuresRtree_ nor featuresCollection_ are available'); - return features; -}; - - -/** - * Get all features whose geometry intersects the provided coordinate. - * @param {ol.Coordinate} coordinate Coordinate. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.source.Vector.prototype.getFeaturesAtCoordinate = function(coordinate) { - var features = []; - this.forEachFeatureAtCoordinateDirect(coordinate, function(feature) { - features.push(feature); - }); - return features; -}; - - -/** - * Get all features in the provided extent. Note that this returns all features - * whose bounding boxes intersect the given extent (so it may include features - * whose geometries do not intersect the extent). - * - * This method is not available when the source is configured with - * `useSpatialIndex` set to `false`. - * @param {ol.Extent} extent Extent. - * @return {Array.<ol.Feature>} Features. - * @api - */ -ol.source.Vector.prototype.getFeaturesInExtent = function(extent) { - goog.asserts.assert(this.featuresRtree_, - 'getFeaturesInExtent does not work when useSpatialIndex is set to false'); - return this.featuresRtree_.getInExtent(extent); -}; - - -/** - * Get the closest feature to the provided coordinate. - * - * This method is not available when the source is configured with - * `useSpatialIndex` set to `false`. - * @param {ol.Coordinate} coordinate Coordinate. - * @return {ol.Feature} Closest feature. - * @api stable - */ -ol.source.Vector.prototype.getClosestFeatureToCoordinate = - function(coordinate) { - // Find the closest feature using branch and bound. We start searching an - // infinite extent, and find the distance from the first feature found. This - // becomes the closest feature. We then compute a smaller extent which any - // closer feature must intersect. We continue searching with this smaller - // extent, trying to find a closer feature. Every time we find a closer - // feature, we update the extent being searched so that any even closer - // feature must intersect it. We continue until we run out of features. - var x = coordinate[0]; - var y = coordinate[1]; - var closestFeature = null; - var closestPoint = [NaN, NaN]; - var minSquaredDistance = Infinity; - var extent = [-Infinity, -Infinity, Infinity, Infinity]; - goog.asserts.assert(this.featuresRtree_, - 'getClosestFeatureToCoordinate does not work with useSpatialIndex set ' + - 'to false'); - this.featuresRtree_.forEachInExtent(extent, - /** - * @param {ol.Feature} feature Feature. - */ - function(feature) { - var geometry = feature.getGeometry(); - goog.asserts.assert(geometry, - 'feature geometry is defined and not null'); - var previousMinSquaredDistance = minSquaredDistance; - minSquaredDistance = geometry.closestPointXY( - x, y, closestPoint, minSquaredDistance); - if (minSquaredDistance < previousMinSquaredDistance) { - closestFeature = feature; - // This is sneaky. Reduce the extent that it is currently being - // searched while the R-Tree traversal using this same extent object - // is still in progress. This is safe because the new extent is - // strictly contained by the old extent. - var minDistance = Math.sqrt(minSquaredDistance); - extent[0] = x - minDistance; - extent[1] = y - minDistance; - extent[2] = x + minDistance; - extent[3] = y + minDistance; - } - }); - return closestFeature; -}; - - -/** - * Get the extent of the features currently in the source. - * - * This method is not available when the source is configured with - * `useSpatialIndex` set to `false`. - * @return {!ol.Extent} Extent. - * @api stable - */ -ol.source.Vector.prototype.getExtent = function() { - goog.asserts.assert(this.featuresRtree_, - 'getExtent does not work when useSpatialIndex is set to false'); - return this.featuresRtree_.getExtent(); -}; - - -/** - * Get a feature by its identifier (the value returned by feature.getId()). - * Note that the index treats string and numeric identifiers as the same. So - * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`. - * - * @param {string|number} id Feature identifier. - * @return {ol.Feature} The feature (or `null` if not found). - * @api stable - */ -ol.source.Vector.prototype.getFeatureById = function(id) { - var feature = this.idIndex_[id.toString()]; - return feature !== undefined ? feature : null; -}; - - -/** - * @param {goog.events.Event} event Event. - * @private - */ -ol.source.Vector.prototype.handleFeatureChange_ = function(event) { - var feature = /** @type {ol.Feature} */ (event.target); - var featureKey = goog.getUid(feature).toString(); - var geometry = feature.getGeometry(); - if (!geometry) { - if (!(featureKey in this.nullGeometryFeatures_)) { - if (this.featuresRtree_) { - this.featuresRtree_.remove(feature); - } - this.nullGeometryFeatures_[featureKey] = feature; - } - } else { - var extent = geometry.getExtent(); - if (featureKey in this.nullGeometryFeatures_) { - delete this.nullGeometryFeatures_[featureKey]; - if (this.featuresRtree_) { - this.featuresRtree_.insert(extent, feature); - } - } else { - if (this.featuresRtree_) { - this.featuresRtree_.update(extent, feature); - } - } - } - var id = feature.getId(); - var removed; - if (id !== undefined) { - var sid = id.toString(); - if (featureKey in this.undefIdIndex_) { - delete this.undefIdIndex_[featureKey]; - this.idIndex_[sid] = feature; - } else { - if (this.idIndex_[sid] !== feature) { - removed = this.removeFromIdIndex_(feature); - goog.asserts.assert(removed, - 'Expected feature to be removed from index'); - this.idIndex_[sid] = feature; - } - } - } else { - if (!(featureKey in this.undefIdIndex_)) { - removed = this.removeFromIdIndex_(feature); - goog.asserts.assert(removed, - 'Expected feature to be removed from index'); - this.undefIdIndex_[featureKey] = feature; - } else { - goog.asserts.assert(this.undefIdIndex_[featureKey] === feature, - 'feature keyed under %s in undefIdKeys', featureKey); - } - } - this.changed(); - this.dispatchEvent(new ol.source.VectorEvent( - ol.source.VectorEventType.CHANGEFEATURE, feature)); -}; - - -/** - * @return {boolean} Is empty. - */ -ol.source.Vector.prototype.isEmpty = function() { - return this.featuresRtree_.isEmpty() && - goog.object.isEmpty(this.nullGeometryFeatures_); -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @param {ol.proj.Projection} projection Projection. - */ -ol.source.Vector.prototype.loadFeatures = function( - extent, resolution, projection) { - var loadedExtentsRtree = this.loadedExtentsRtree_; - var extentsToLoad = this.strategy_(extent, resolution); - var i, ii; - for (i = 0, ii = extentsToLoad.length; i < ii; ++i) { - var extentToLoad = extentsToLoad[i]; - var alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad, - /** - * @param {{extent: ol.Extent}} object Object. - * @return {boolean} Contains. - */ - function(object) { - return ol.extent.containsExtent(object.extent, extentToLoad); - }); - if (!alreadyLoaded) { - this.loader_.call(this, extentToLoad, resolution, projection); - loadedExtentsRtree.insert(extentToLoad, {extent: extentToLoad.slice()}); - } - } -}; - - -/** - * Remove a single feature from the source. If you want to remove all features - * at once, use the {@link ol.source.Vector#clear source.clear()} method - * instead. - * @param {ol.Feature} feature Feature to remove. - * @api stable - */ -ol.source.Vector.prototype.removeFeature = function(feature) { - var featureKey = goog.getUid(feature).toString(); - if (featureKey in this.nullGeometryFeatures_) { - delete this.nullGeometryFeatures_[featureKey]; - } else { - if (this.featuresRtree_) { - this.featuresRtree_.remove(feature); - } - } - this.removeFeatureInternal(feature); - this.changed(); -}; - - -/** - * Remove feature without firing a `change` event. - * @param {ol.Feature} feature Feature. - * @protected - */ -ol.source.Vector.prototype.removeFeatureInternal = function(feature) { - var featureKey = goog.getUid(feature).toString(); - goog.asserts.assert(featureKey in this.featureChangeKeys_, - 'featureKey exists in featureChangeKeys'); - this.featureChangeKeys_[featureKey].forEach(goog.events.unlistenByKey); - delete this.featureChangeKeys_[featureKey]; - var id = feature.getId(); - if (id !== undefined) { - delete this.idIndex_[id.toString()]; - } else { - delete this.undefIdIndex_[featureKey]; - } - this.dispatchEvent(new ol.source.VectorEvent( - ol.source.VectorEventType.REMOVEFEATURE, feature)); -}; - - -/** - * Remove a feature from the id index. Called internally when the feature id - * may have changed. - * @param {ol.Feature} feature The feature. - * @return {boolean} Removed the feature from the index. - * @private - */ -ol.source.Vector.prototype.removeFromIdIndex_ = function(feature) { - var removed = false; - for (var id in this.idIndex_) { - if (this.idIndex_[id] === feature) { - delete this.idIndex_[id]; - removed = true; - break; - } - } - return removed; -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.source.Vector} instances are instances of this - * type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.source.VectorEvent} - * @param {string} type Type. - * @param {ol.Feature=} opt_feature Feature. - */ -ol.source.VectorEvent = function(type, opt_feature) { - - goog.base(this, type); - - /** - * The feature being added or removed. - * @type {ol.Feature|undefined} - * @api stable - */ - this.feature = opt_feature; - -}; -goog.inherits(ol.source.VectorEvent, goog.events.Event); - -goog.provide('ol.source.ImageVector'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.vec.Mat4'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.render.canvas.ReplayGroup'); -goog.require('ol.renderer.vector'); -goog.require('ol.source.ImageCanvas'); -goog.require('ol.source.Vector'); -goog.require('ol.style.Style'); -goog.require('ol.vec.Mat4'); - - - -/** - * @classdesc - * An image source whose images are canvas elements into which vector features - * read from a vector source (`ol.source.Vector`) are drawn. An - * `ol.source.ImageVector` object is to be used as the `source` of an image - * layer (`ol.layer.Image`). Image layers are rotated, scaled, and translated, - * as opposed to being re-rendered, during animations and interactions. So, like - * any other image layer, an image layer configured with an - * `ol.source.ImageVector` will exhibit this behaviour. This is in contrast to a - * vector layer, where vector features are re-drawn during animations and - * interactions. - * - * @constructor - * @extends {ol.source.ImageCanvas} - * @param {olx.source.ImageVectorOptions} options Options. - * @api - */ -ol.source.ImageVector = function(options) { - - /** - * @private - * @type {ol.source.Vector} - */ - this.source_ = options.source; - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.transform_ = goog.vec.Mat4.createNumber(); - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.canvasContext_ = ol.dom.createCanvasContext2D(); - - /** - * @private - * @type {ol.Size} - */ - this.canvasSize_ = [0, 0]; - - /** - * @private - * @type {ol.render.canvas.ReplayGroup} - */ - this.replayGroup_ = null; - - goog.base(this, { - attributions: options.attributions, - canvasFunction: goog.bind(this.canvasFunctionInternal_, this), - logo: options.logo, - projection: options.projection, - ratio: options.ratio, - resolutions: options.resolutions, - state: this.source_.getState() - }); - - /** - * User provided style. - * @type {ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction} - * @private - */ - this.style_ = null; - - /** - * Style function for use within the library. - * @type {ol.style.StyleFunction|undefined} - * @private - */ - this.styleFunction_ = undefined; - - this.setStyle(options.style); - - goog.events.listen(this.source_, goog.events.EventType.CHANGE, - this.handleSourceChange_, undefined, this); - -}; -goog.inherits(ol.source.ImageVector, ol.source.ImageCanvas); - - -/** - * @param {ol.Extent} extent Extent. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.Size} size Size. - * @param {ol.proj.Projection} projection Projection; - * @return {HTMLCanvasElement} Canvas element. - * @private - */ -ol.source.ImageVector.prototype.canvasFunctionInternal_ = - function(extent, resolution, pixelRatio, size, projection) { - - var replayGroup = new ol.render.canvas.ReplayGroup( - ol.renderer.vector.getTolerance(resolution, pixelRatio), extent, - resolution); - - this.source_.loadFeatures(extent, resolution, projection); - - var loading = false; - this.source_.forEachFeatureInExtent(extent, - /** - * @param {ol.Feature} feature Feature. - */ - function(feature) { - loading = loading || - this.renderFeature_(feature, resolution, pixelRatio, replayGroup); - }, this); - replayGroup.finish(); - - if (loading) { - return null; - } - - if (this.canvasSize_[0] != size[0] || this.canvasSize_[1] != size[1]) { - this.canvasContext_.canvas.width = size[0]; - this.canvasContext_.canvas.height = size[1]; - this.canvasSize_[0] = size[0]; - this.canvasSize_[1] = size[1]; - } else { - this.canvasContext_.clearRect(0, 0, size[0], size[1]); - } - - var transform = this.getTransform_(ol.extent.getCenter(extent), - resolution, pixelRatio, size); - replayGroup.replay(this.canvasContext_, pixelRatio, transform, 0, {}); - - this.replayGroup_ = replayGroup; - - return this.canvasContext_.canvas; -}; - - -/** - * @inheritDoc - */ -ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function( - coordinate, resolution, rotation, skippedFeatureUids, callback) { - if (!this.replayGroup_) { - return undefined; - } else { - /** @type {Object.<string, boolean>} */ - var features = {}; - return this.replayGroup_.forEachFeatureAtCoordinate( - coordinate, resolution, 0, skippedFeatureUids, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - goog.asserts.assert(feature !== undefined, 'passed a feature'); - var key = goog.getUid(feature).toString(); - if (!(key in features)) { - features[key] = true; - return callback(feature); - } - }); - } -}; - - -/** - * Get a reference to the wrapped source. - * @return {ol.source.Vector} Source. - * @api - */ -ol.source.ImageVector.prototype.getSource = function() { - return this.source_; -}; - - -/** - * Get the style for features. This returns whatever was passed to the `style` - * option at construction or to the `setStyle` method. - * @return {ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction} - * Layer style. - * @api stable - */ -ol.source.ImageVector.prototype.getStyle = function() { - return this.style_; -}; - - -/** - * Get the style function. - * @return {ol.style.StyleFunction|undefined} Layer style function. - * @api stable - */ -ol.source.ImageVector.prototype.getStyleFunction = function() { - return this.styleFunction_; -}; - - -/** - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.Size} size Size. - * @return {!goog.vec.Mat4.Number} Transform. - * @private - */ -ol.source.ImageVector.prototype.getTransform_ = - function(center, resolution, pixelRatio, size) { - return ol.vec.Mat4.makeTransform2D(this.transform_, - size[0] / 2, size[1] / 2, - pixelRatio / resolution, -pixelRatio / resolution, - 0, - -center[0], -center[1]); -}; - - -/** - * Handle changes in image style state. - * @param {goog.events.Event} event Image style change event. - * @private - */ -ol.source.ImageVector.prototype.handleImageChange_ = - function(event) { - this.changed(); -}; - - -/** - * @private - */ -ol.source.ImageVector.prototype.handleSourceChange_ = function() { - // setState will trigger a CHANGE event, so we always rely - // change events by calling setState. - this.setState(this.source_.getState()); -}; - - -/** - * @param {ol.Feature} feature Feature. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.render.canvas.ReplayGroup} replayGroup Replay group. - * @return {boolean} `true` if an image is loading. - * @private - */ -ol.source.ImageVector.prototype.renderFeature_ = - function(feature, resolution, pixelRatio, replayGroup) { - var styles; - var styleFunction = feature.getStyleFunction(); - if (styleFunction) { - styles = styleFunction.call(feature, resolution); - } else if (this.styleFunction_) { - styles = this.styleFunction_(feature, resolution); - } - if (!styles) { - return false; - } - var i, ii, loading = false; - for (i = 0, ii = styles.length; i < ii; ++i) { - loading = ol.renderer.vector.renderFeature( - replayGroup, feature, styles[i], - ol.renderer.vector.getSquaredTolerance(resolution, pixelRatio), - this.handleImageChange_, this) || loading; - } - return loading; -}; - - -/** - * Set the style for features. This can be a single style object, an array - * of styles, or a function that takes a feature and resolution and returns - * an array of styles. If it is `undefined` the default style is used. If - * it is `null` the layer has no style (a `null` style), so only features - * that have their own styles will be rendered in the layer. See - * {@link ol.style} for information on the default style. - * @param {ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined} - * style Layer style. - * @api stable - */ -ol.source.ImageVector.prototype.setStyle = function(style) { - this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction; - this.styleFunction_ = !style ? - undefined : ol.style.createStyleFunction(this.style_); - this.changed(); -}; - -goog.provide('ol.renderer.canvas.ImageLayer'); - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('goog.vec.Mat4'); -goog.require('ol.ImageBase'); -goog.require('ol.ViewHint'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.Image'); -goog.require('ol.proj'); -goog.require('ol.renderer.canvas.Layer'); -goog.require('ol.source.ImageVector'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.canvas.Layer} - * @param {ol.layer.Image} imageLayer Single image layer. - */ -ol.renderer.canvas.ImageLayer = function(imageLayer) { - - goog.base(this, imageLayer); - - /** - * @private - * @type {?ol.ImageBase} - */ - this.image_ = null; - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.imageTransform_ = goog.vec.Mat4.createNumber(); - - /** - * @private - * @type {?goog.vec.Mat4.Number} - */ - this.imageTransformInv_ = null; - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.hitCanvasContext_ = null; - -}; -goog.inherits(ol.renderer.canvas.ImageLayer, ol.renderer.canvas.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg) { - var layer = this.getLayer(); - var source = layer.getSource(); - var resolution = frameState.viewState.resolution; - var rotation = frameState.viewState.rotation; - var skippedFeatureUids = frameState.skippedFeatureUids; - return source.forEachFeatureAtCoordinate( - coordinate, resolution, rotation, skippedFeatureUids, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - return callback.call(thisArg, feature, layer); - }); -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel = - function(pixel, frameState, callback, thisArg) { - if (!this.getImage()) { - return undefined; - } - - if (this.getLayer().getSource() instanceof ol.source.ImageVector) { - // for ImageVector sources use the original hit-detection logic, - // so that for example also transparent polygons are detected - var coordinate = pixel.slice(); - ol.vec.Mat4.multVec2( - frameState.pixelToCoordinateMatrix, coordinate, coordinate); - var hasFeature = this.forEachFeatureAtCoordinate( - coordinate, frameState, goog.functions.TRUE, this); - - if (hasFeature) { - return callback.call(thisArg, this.getLayer()); - } else { - return undefined; - } - } else { - // for all other image sources directly check the image - if (!this.imageTransformInv_) { - this.imageTransformInv_ = goog.vec.Mat4.createNumber(); - goog.vec.Mat4.invert(this.imageTransform_, this.imageTransformInv_); - } - - var pixelOnCanvas = - this.getPixelOnCanvas(pixel, this.imageTransformInv_); - - if (!this.hitCanvasContext_) { - this.hitCanvasContext_ = ol.dom.createCanvasContext2D(1, 1); - } - - this.hitCanvasContext_.clearRect(0, 0, 1, 1); - this.hitCanvasContext_.drawImage( - this.getImage(), pixelOnCanvas[0], pixelOnCanvas[1], 1, 1, 0, 0, 1, 1); - - var imageData = this.hitCanvasContext_.getImageData(0, 0, 1, 1).data; - if (imageData[3] > 0) { - return callback.call(thisArg, this.getLayer()); - } else { - return undefined; - } - } -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.ImageLayer.prototype.getImage = function() { - return !this.image_ ? null : this.image_.getImage(); -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.ImageLayer.prototype.getImageTransform = function() { - return this.imageTransform_; -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.ImageLayer.prototype.prepareFrame = - function(frameState, layerState) { - - var pixelRatio = frameState.pixelRatio; - var viewState = frameState.viewState; - var viewCenter = viewState.center; - var viewResolution = viewState.resolution; - var viewRotation = viewState.rotation; - - var image; - var imageLayer = this.getLayer(); - goog.asserts.assertInstanceof(imageLayer, ol.layer.Image, - 'layer is an instance of ol.layer.Image'); - var imageSource = imageLayer.getSource(); - - var hints = frameState.viewHints; - - var renderedExtent = frameState.extent; - if (layerState.extent !== undefined) { - renderedExtent = ol.extent.getIntersection( - renderedExtent, layerState.extent); - } - - if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING] && - !ol.extent.isEmpty(renderedExtent)) { - var projection = viewState.projection; - if (!ol.ENABLE_RASTER_REPROJECTION) { - var sourceProjection = imageSource.getProjection(); - if (sourceProjection) { - goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection), - 'projection and sourceProjection are equivalent'); - projection = sourceProjection; - } - } - image = imageSource.getImage( - renderedExtent, viewResolution, pixelRatio, projection); - if (image) { - var loaded = this.loadImage(image); - if (loaded) { - this.image_ = image; - } - } - } - - if (this.image_) { - image = this.image_; - var imageExtent = image.getExtent(); - var imageResolution = image.getResolution(); - var imagePixelRatio = image.getPixelRatio(); - var scale = pixelRatio * imageResolution / - (viewResolution * imagePixelRatio); - ol.vec.Mat4.makeTransform2D(this.imageTransform_, - pixelRatio * frameState.size[0] / 2, - pixelRatio * frameState.size[1] / 2, - scale, scale, - viewRotation, - imagePixelRatio * (imageExtent[0] - viewCenter[0]) / imageResolution, - imagePixelRatio * (viewCenter[1] - imageExtent[3]) / imageResolution); - this.imageTransformInv_ = null; - this.updateAttributions(frameState.attributions, image.getAttributions()); - this.updateLogos(frameState, imageSource); - } - - return true; -}; - -// FIXME find correct globalCompositeOperation -// FIXME optimize :-) - -goog.provide('ol.renderer.canvas.TileLayer'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.vec.Mat4'); -goog.require('ol.Size'); -goog.require('ol.TileRange'); -goog.require('ol.TileState'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.Tile'); -goog.require('ol.renderer.canvas.Layer'); -goog.require('ol.size'); -goog.require('ol.tilecoord'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.canvas.Layer} - * @param {ol.layer.Tile} tileLayer Tile layer. - */ -ol.renderer.canvas.TileLayer = function(tileLayer) { - - goog.base(this, tileLayer); - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.canvasSize_ = null; - - /** - * @private - * @type {boolean} - */ - this.canvasTooBig_ = false; - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.context_ = null; - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.imageTransform_ = goog.vec.Mat4.createNumber(); - - /** - * @private - * @type {?goog.vec.Mat4.Number} - */ - this.imageTransformInv_ = null; - - /** - * @private - * @type {number} - */ - this.renderedCanvasZ_ = NaN; - - /** - * @private - * @type {number} - */ - this.renderedTileWidth_ = NaN; - - /** - * @private - * @type {number} - */ - this.renderedTileHeight_ = NaN; - - /** - * @private - * @type {ol.TileRange} - */ - this.renderedCanvasTileRange_ = null; - - /** - * @private - * @type {Array.<ol.Tile|undefined>} - */ - this.renderedTiles_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.tmpSize_ = [0, 0]; - -}; -goog.inherits(ol.renderer.canvas.TileLayer, ol.renderer.canvas.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.canvas.TileLayer.prototype.getImage = function() { - return this.canvas_; -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.TileLayer.prototype.getImageTransform = function() { - return this.imageTransform_; -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.TileLayer.prototype.prepareFrame = - function(frameState, layerState) { - - // - // Warning! You're entering a dangerous zone! - // - // The canvas tile layer renderering is highly optimized, hence - // the complexity of this function. For best performance we try - // to minimize the number of pixels to update on the canvas. This - // includes: - // - // - Only drawing pixels that will be visible. - // - Not re-drawing pixels/tiles that are already correct. - // - Minimizing calls to clearRect. - // - Never shrink the canvas. Just make it bigger when necessary. - // Re-sizing the canvas also clears it, which further means - // re-creating it (expensive). - // - // The various steps performed by this functions: - // - // - Create a canvas element if none has been created yet. - // - // - Make the canvas bigger if it's too small. Note that we never shrink - // the canvas, we just make it bigger when necessary, when rotating for - // example. Note also that the canvas always contains a whole number - // of tiles. - // - // - Invalidate the canvas tile range (renderedCanvasTileRange_ = null) - // if (1) the canvas has been enlarged, or (2) the zoom level changes, - // or (3) the canvas tile range doesn't contain the required tile - // range. This canvas tile range invalidation thing is related to - // an optimization where we attempt to redraw as few pixels as - // possible on each prepareFrame call. - // - // - If the canvas tile range has been invalidated we reset - // renderedCanvasTileRange_ and reset the renderedTiles_ array. - // The renderedTiles_ array is the structure used to determine - // the canvas pixels that need not be redrawn from one prepareFrame - // call to another. It records while tile has been rendered at - // which position in the canvas. - // - // - We then determine the tiles to draw on the canvas. Tiles for - // the target resolution may not be loaded yet. In that case we - // use low-resolution/interim tiles if loaded already. And, if - // for a non-yet-loaded tile we haven't found a corresponding - // low-resolution tile we indicate that the pixels for that - // tile must be cleared on the canvas. Note: determining the - // interim tiles is based on tile extents instead of tile - // coords, this is to be able to handler irregular tile grids. - // - // - We're now ready to render. We start by calling clearRect - // for the tiles that aren't loaded yet and are not fully covered - // by a low-resolution tile (if they're loaded, we'll draw them; - // if they're fully covered by a low-resolution tile then there's - // no need to clear). We then render the tiles "back to front", - // i.e. starting with the low-resolution tiles. - // - // - After rendering some bookkeeping is performed (updateUsedTiles, - // etc.). manageTilePyramid is what enqueue tiles in the tile - // queue for loading. - // - // - The last step involves updating the image transform matrix, - // which will be used by the map renderer for the final - // composition and positioning. - // - - var pixelRatio = frameState.pixelRatio; - var viewState = frameState.viewState; - var projection = viewState.projection; - - var tileLayer = this.getLayer(); - goog.asserts.assertInstanceof(tileLayer, ol.layer.Tile, - 'layer is an instance of ol.layer.Tile'); - var tileSource = tileLayer.getSource(); - var tileGrid = tileSource.getTileGridForProjection(projection); - var tileGutter = tileSource.getGutter(); - var z = tileGrid.getZForResolution(viewState.resolution); - var tilePixelSize = - tileSource.getTilePixelSize(z, frameState.pixelRatio, projection); - var tilePixelRatio = tilePixelSize[0] / - ol.size.toSize(tileGrid.getTileSize(z), this.tmpSize_)[0]; - var tileResolution = tileGrid.getResolution(z); - var tilePixelResolution = tileResolution / tilePixelRatio; - var center = viewState.center; - var extent; - if (tileResolution == viewState.resolution) { - center = this.snapCenterToPixel(center, tileResolution, frameState.size); - extent = ol.extent.getForViewAndSize( - center, tileResolution, viewState.rotation, frameState.size); - } else { - extent = frameState.extent; - } - - if (layerState.extent !== undefined) { - extent = ol.extent.getIntersection(extent, layerState.extent); - } - if (ol.extent.isEmpty(extent)) { - // Return false to prevent the rendering of the layer. - return false; - } - - var tileRange = tileGrid.getTileRangeForExtentAndResolution( - extent, tileResolution); - - var canvasWidth = tilePixelSize[0] * tileRange.getWidth(); - var canvasHeight = tilePixelSize[1] * tileRange.getHeight(); - - var canvas, context; - if (!this.canvas_) { - goog.asserts.assert(!this.canvasSize_, - 'canvasSize is null (because canvas is null)'); - goog.asserts.assert(!this.context_, - 'context is null (because canvas is null)'); - goog.asserts.assert(!this.renderedCanvasTileRange_, - 'renderedCanvasTileRange is null (because canvas is null)'); - context = ol.dom.createCanvasContext2D(canvasWidth, canvasHeight); - this.canvas_ = context.canvas; - this.canvasSize_ = [canvasWidth, canvasHeight]; - this.context_ = context; - this.canvasTooBig_ = - !ol.renderer.canvas.Layer.testCanvasSize(this.canvasSize_); - } else { - goog.asserts.assert(this.canvasSize_, - 'non-null canvasSize (because canvas is not null)'); - goog.asserts.assert(this.context_, - 'non-null context (because canvas is not null)'); - canvas = this.canvas_; - context = this.context_; - if (this.canvasSize_[0] < canvasWidth || - this.canvasSize_[1] < canvasHeight || - this.renderedTileWidth_ !== tilePixelSize[0] || - this.renderedTileHeight_ !== tilePixelSize[1] || - (this.canvasTooBig_ && (this.canvasSize_[0] > canvasWidth || - this.canvasSize_[1] > canvasHeight))) { - // Canvas is too small or tileSize has changed, resize it. - // We never shrink the canvas, unless - // we know that the current canvas size exceeds the maximum size - canvas.width = canvasWidth; - canvas.height = canvasHeight; - this.canvasSize_ = [canvasWidth, canvasHeight]; - this.canvasTooBig_ = - !ol.renderer.canvas.Layer.testCanvasSize(this.canvasSize_); - this.renderedCanvasTileRange_ = null; - } else { - canvasWidth = this.canvasSize_[0]; - canvasHeight = this.canvasSize_[1]; - if (z != this.renderedCanvasZ_ || - !this.renderedCanvasTileRange_.containsTileRange(tileRange)) { - this.renderedCanvasTileRange_ = null; - } - } - } - - var canvasTileRange, canvasTileRangeWidth, minX, minY; - if (!this.renderedCanvasTileRange_) { - canvasTileRangeWidth = canvasWidth / tilePixelSize[0]; - var canvasTileRangeHeight = canvasHeight / tilePixelSize[1]; - minX = tileRange.minX - - Math.floor((canvasTileRangeWidth - tileRange.getWidth()) / 2); - minY = tileRange.minY - - Math.floor((canvasTileRangeHeight - tileRange.getHeight()) / 2); - this.renderedCanvasZ_ = z; - this.renderedTileWidth_ = tilePixelSize[0]; - this.renderedTileHeight_ = tilePixelSize[1]; - this.renderedCanvasTileRange_ = new ol.TileRange( - minX, minX + canvasTileRangeWidth - 1, - minY, minY + canvasTileRangeHeight - 1); - this.renderedTiles_ = - new Array(canvasTileRangeWidth * canvasTileRangeHeight); - canvasTileRange = this.renderedCanvasTileRange_; - } else { - canvasTileRange = this.renderedCanvasTileRange_; - canvasTileRangeWidth = canvasTileRange.getWidth(); - } - - goog.asserts.assert(canvasTileRange.containsTileRange(tileRange), - 'tileRange is contained in canvasTileRange'); - - /** - * @type {Object.<number, Object.<string, ol.Tile>>} - */ - var tilesToDrawByZ = {}; - tilesToDrawByZ[z] = {}; - /** @type {Array.<ol.Tile>} */ - var tilesToClear = []; - - var findLoadedTiles = this.createLoadedTileFinder( - tileSource, projection, tilesToDrawByZ); - - var useInterimTilesOnError = tileLayer.getUseInterimTilesOnError(); - - var tmpExtent = ol.extent.createEmpty(); - var tmpTileRange = new ol.TileRange(0, 0, 0, 0); - var childTileRange, fullyLoaded, tile, tileState, x, y; - for (x = tileRange.minX; x <= tileRange.maxX; ++x) { - for (y = tileRange.minY; y <= tileRange.maxY; ++y) { - - tile = tileSource.getTile(z, x, y, pixelRatio, projection); - tileState = tile.getState(); - if (tileState == ol.TileState.LOADED || - tileState == ol.TileState.EMPTY || - (tileState == ol.TileState.ERROR && !useInterimTilesOnError)) { - tilesToDrawByZ[z][ol.tilecoord.toString(tile.tileCoord)] = tile; - continue; - } - - fullyLoaded = tileGrid.forEachTileCoordParentTileRange( - tile.tileCoord, findLoadedTiles, null, tmpTileRange, tmpExtent); - if (!fullyLoaded) { - // FIXME we do not need to clear the tile if it is fully covered by its - // children - tilesToClear.push(tile); - childTileRange = tileGrid.getTileCoordChildTileRange( - tile.tileCoord, tmpTileRange, tmpExtent); - if (childTileRange) { - findLoadedTiles(z + 1, childTileRange); - } - } - - } - } - - var i, ii; - for (i = 0, ii = tilesToClear.length; i < ii; ++i) { - tile = tilesToClear[i]; - x = tilePixelSize[0] * (tile.tileCoord[1] - canvasTileRange.minX); - y = tilePixelSize[1] * (canvasTileRange.maxY - tile.tileCoord[2]); - context.clearRect(x, y, tilePixelSize[0], tilePixelSize[1]); - } - - /** @type {Array.<number>} */ - var zs = Object.keys(tilesToDrawByZ).map(Number); - goog.array.sort(zs); - var opaque = tileSource.getOpaque(); - var origin = ol.extent.getTopLeft(tileGrid.getTileCoordExtent( - [z, canvasTileRange.minX, canvasTileRange.maxY], - tmpExtent)); - var currentZ, index, scale, tileCoordKey, tileExtent, tilesToDraw; - var ix, iy, interimTileRange, maxX, maxY; - var height, width; - for (i = 0, ii = zs.length; i < ii; ++i) { - currentZ = zs[i]; - tilePixelSize = - tileSource.getTilePixelSize(currentZ, pixelRatio, projection); - tilesToDraw = tilesToDrawByZ[currentZ]; - if (currentZ == z) { - for (tileCoordKey in tilesToDraw) { - tile = tilesToDraw[tileCoordKey]; - index = - (tile.tileCoord[2] - canvasTileRange.minY) * canvasTileRangeWidth + - (tile.tileCoord[1] - canvasTileRange.minX); - if (this.renderedTiles_[index] != tile) { - x = tilePixelSize[0] * (tile.tileCoord[1] - canvasTileRange.minX); - y = tilePixelSize[1] * (canvasTileRange.maxY - tile.tileCoord[2]); - tileState = tile.getState(); - if (tileState == ol.TileState.EMPTY || - (tileState == ol.TileState.ERROR && !useInterimTilesOnError) || - !opaque) { - context.clearRect(x, y, tilePixelSize[0], tilePixelSize[1]); - } - if (tileState == ol.TileState.LOADED) { - context.drawImage(tile.getImage(), - tileGutter, tileGutter, tilePixelSize[0], tilePixelSize[1], - x, y, tilePixelSize[0], tilePixelSize[1]); - } - this.renderedTiles_[index] = tile; - } - } - } else { - scale = tileGrid.getResolution(currentZ) / tileResolution; - for (tileCoordKey in tilesToDraw) { - tile = tilesToDraw[tileCoordKey]; - tileExtent = tileGrid.getTileCoordExtent(tile.tileCoord, tmpExtent); - x = (tileExtent[0] - origin[0]) / tilePixelResolution; - y = (origin[1] - tileExtent[3]) / tilePixelResolution; - width = scale * tilePixelSize[0]; - height = scale * tilePixelSize[1]; - tileState = tile.getState(); - if (tileState == ol.TileState.EMPTY || !opaque) { - context.clearRect(x, y, width, height); - } - if (tileState == ol.TileState.LOADED) { - context.drawImage(tile.getImage(), - tileGutter, tileGutter, tilePixelSize[0], tilePixelSize[1], - x, y, width, height); - } - interimTileRange = - tileGrid.getTileRangeForExtentAndZ(tileExtent, z, tmpTileRange); - minX = Math.max(interimTileRange.minX, canvasTileRange.minX); - maxX = Math.min(interimTileRange.maxX, canvasTileRange.maxX); - minY = Math.max(interimTileRange.minY, canvasTileRange.minY); - maxY = Math.min(interimTileRange.maxY, canvasTileRange.maxY); - for (ix = minX; ix <= maxX; ++ix) { - for (iy = minY; iy <= maxY; ++iy) { - index = (iy - canvasTileRange.minY) * canvasTileRangeWidth + - (ix - canvasTileRange.minX); - this.renderedTiles_[index] = undefined; - } - } - } - } - } - - this.updateUsedTiles(frameState.usedTiles, tileSource, z, tileRange); - this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio, - projection, extent, z, tileLayer.getPreload()); - this.scheduleExpireCache(frameState, tileSource); - this.updateLogos(frameState, tileSource); - - ol.vec.Mat4.makeTransform2D(this.imageTransform_, - pixelRatio * frameState.size[0] / 2, - pixelRatio * frameState.size[1] / 2, - pixelRatio * tilePixelResolution / viewState.resolution, - pixelRatio * tilePixelResolution / viewState.resolution, - viewState.rotation, - (origin[0] - center[0]) / tilePixelResolution, - (center[1] - origin[1]) / tilePixelResolution); - this.imageTransformInv_ = null; - - return true; -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.TileLayer.prototype.forEachLayerAtPixel = - function(pixel, frameState, callback, thisArg) { - if (!this.context_) { - return undefined; - } - - if (!this.imageTransformInv_) { - this.imageTransformInv_ = goog.vec.Mat4.createNumber(); - goog.vec.Mat4.invert(this.imageTransform_, this.imageTransformInv_); - } - - var pixelOnCanvas = - this.getPixelOnCanvas(pixel, this.imageTransformInv_); - - var imageData = this.context_.getImageData( - pixelOnCanvas[0], pixelOnCanvas[1], 1, 1).data; - - if (imageData[3] > 0) { - return callback.call(thisArg, this.getLayer()); - } else { - return undefined; - } -}; - -goog.provide('ol.renderer.canvas.VectorLayer'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('ol.ViewHint'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.Vector'); -goog.require('ol.render.EventType'); -goog.require('ol.render.canvas.ReplayGroup'); -goog.require('ol.renderer.canvas.Layer'); -goog.require('ol.renderer.vector'); -goog.require('ol.source.Vector'); - - - -/** - * @constructor - * @extends {ol.renderer.canvas.Layer} - * @param {ol.layer.Vector} vectorLayer Vector layer. - */ -ol.renderer.canvas.VectorLayer = function(vectorLayer) { - - goog.base(this, vectorLayer); - - /** - * @private - * @type {boolean} - */ - this.dirty_ = false; - - /** - * @private - * @type {number} - */ - this.renderedRevision_ = -1; - - /** - * @private - * @type {number} - */ - this.renderedResolution_ = NaN; - - /** - * @private - * @type {ol.Extent} - */ - this.renderedExtent_ = ol.extent.createEmpty(); - - /** - * @private - * @type {function(ol.Feature, ol.Feature): number|null} - */ - this.renderedRenderOrder_ = null; - - /** - * @private - * @type {ol.render.canvas.ReplayGroup} - */ - this.replayGroup_ = null; - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.context_ = ol.dom.createCanvasContext2D(); - -}; -goog.inherits(ol.renderer.canvas.VectorLayer, ol.renderer.canvas.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.canvas.VectorLayer.prototype.composeFrame = - function(frameState, layerState, context) { - - var extent = frameState.extent; - var pixelRatio = frameState.pixelRatio; - var skippedFeatureUids = layerState.managed ? - frameState.skippedFeatureUids : {}; - var viewState = frameState.viewState; - var projection = viewState.projection; - var rotation = viewState.rotation; - var projectionExtent = projection.getExtent(); - var vectorSource = this.getLayer().getSource(); - goog.asserts.assertInstanceof(vectorSource, ol.source.Vector); - - var transform = this.getTransform(frameState, 0); - - this.dispatchPreComposeEvent(context, frameState, transform); - - var replayGroup = this.replayGroup_; - if (replayGroup && !replayGroup.isEmpty()) { - var layer = this.getLayer(); - var replayContext; - if (layer.hasListener(ol.render.EventType.RENDER)) { - // resize and clear - this.context_.canvas.width = context.canvas.width; - this.context_.canvas.height = context.canvas.height; - replayContext = this.context_; - } else { - replayContext = context; - } - // for performance reasons, context.save / context.restore is not used - // to save and restore the transformation matrix and the opacity. - // see http://jsperf.com/context-save-restore-versus-variable - var alpha = replayContext.globalAlpha; - replayContext.globalAlpha = layerState.opacity; - - replayGroup.replay(replayContext, pixelRatio, transform, rotation, - skippedFeatureUids); - if (vectorSource.getWrapX() && projection.canWrapX() && - !ol.extent.containsExtent(projectionExtent, extent)) { - var startX = extent[0]; - var worldWidth = ol.extent.getWidth(projectionExtent); - var world = 0; - var offsetX; - while (startX < projectionExtent[0]) { - --world; - offsetX = worldWidth * world; - transform = this.getTransform(frameState, offsetX); - replayGroup.replay(replayContext, pixelRatio, transform, rotation, - skippedFeatureUids); - startX += worldWidth; - } - world = 0; - startX = extent[2]; - while (startX > projectionExtent[2]) { - ++world; - offsetX = worldWidth * world; - transform = this.getTransform(frameState, offsetX); - replayGroup.replay(replayContext, pixelRatio, transform, rotation, - skippedFeatureUids); - startX -= worldWidth; - } - // restore original transform for render and compose events - transform = this.getTransform(frameState, 0); - } - - if (replayContext != context) { - this.dispatchRenderEvent(replayContext, frameState, transform); - context.drawImage(replayContext.canvas, 0, 0); - } - replayContext.globalAlpha = alpha; - } - - this.dispatchPostComposeEvent(context, frameState, transform); - -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg) { - if (!this.replayGroup_) { - return undefined; - } else { - var resolution = frameState.viewState.resolution; - var rotation = frameState.viewState.rotation; - var layer = this.getLayer(); - var layerState = frameState.layerStates[goog.getUid(layer)]; - /** @type {Object.<string, boolean>} */ - var features = {}; - return this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, - rotation, layerState.managed ? frameState.skippedFeatureUids : {}, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - goog.asserts.assert(feature !== undefined, 'received a feature'); - var key = goog.getUid(feature).toString(); - if (!(key in features)) { - features[key] = true; - return callback.call(thisArg, feature, layer); - } - }); - } -}; - - -/** - * Handle changes in image style state. - * @param {goog.events.Event} event Image style change event. - * @private - */ -ol.renderer.canvas.VectorLayer.prototype.handleStyleImageChange_ = - function(event) { - this.renderIfReadyAndVisible(); -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.VectorLayer.prototype.prepareFrame = - function(frameState, layerState) { - - var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer()); - goog.asserts.assertInstanceof(vectorLayer, ol.layer.Vector, - 'layer is an instance of ol.layer.Vector'); - var vectorSource = vectorLayer.getSource(); - - this.updateAttributions( - frameState.attributions, vectorSource.getAttributions()); - this.updateLogos(frameState, vectorSource); - - var animating = frameState.viewHints[ol.ViewHint.ANIMATING]; - var interacting = frameState.viewHints[ol.ViewHint.INTERACTING]; - var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating(); - var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting(); - - if (!this.dirty_ && (!updateWhileAnimating && animating) || - (!updateWhileInteracting && interacting)) { - return true; - } - - var frameStateExtent = frameState.extent; - var viewState = frameState.viewState; - var projection = viewState.projection; - var resolution = viewState.resolution; - var pixelRatio = frameState.pixelRatio; - var vectorLayerRevision = vectorLayer.getRevision(); - var vectorLayerRenderBuffer = vectorLayer.getRenderBuffer(); - var vectorLayerRenderOrder = vectorLayer.getRenderOrder(); - - if (vectorLayerRenderOrder === undefined) { - vectorLayerRenderOrder = ol.renderer.vector.defaultOrder; - } - - var extent = ol.extent.buffer(frameStateExtent, - vectorLayerRenderBuffer * resolution); - var projectionExtent = viewState.projection.getExtent(); - - if (vectorSource.getWrapX() && viewState.projection.canWrapX() && - !ol.extent.containsExtent(projectionExtent, frameState.extent)) { - // For the replay group, we need an extent that intersects the real world - // (-180° to +180°). To support geometries in a coordinate range from -540° - // to +540°, we add at least 1 world width on each side of the projection - // extent. If the viewport is wider than the world, we need to add half of - // the viewport width to make sure we cover the whole viewport. - var worldWidth = ol.extent.getWidth(projectionExtent); - var buffer = Math.max(ol.extent.getWidth(extent) / 2, worldWidth); - extent[0] = projectionExtent[0] - buffer; - extent[2] = projectionExtent[2] + buffer; - } - - if (!this.dirty_ && - this.renderedResolution_ == resolution && - this.renderedRevision_ == vectorLayerRevision && - this.renderedRenderOrder_ == vectorLayerRenderOrder && - ol.extent.containsExtent(this.renderedExtent_, extent)) { - return true; - } - - // FIXME dispose of old replayGroup in post render - goog.dispose(this.replayGroup_); - this.replayGroup_ = null; - - this.dirty_ = false; - - var replayGroup = - new ol.render.canvas.ReplayGroup( - ol.renderer.vector.getTolerance(resolution, pixelRatio), extent, - resolution, vectorLayer.getRenderBuffer()); - vectorSource.loadFeatures(extent, resolution, projection); - var renderFeature = - /** - * @param {ol.Feature} feature Feature. - * @this {ol.renderer.canvas.VectorLayer} - */ - function(feature) { - var styles; - var styleFunction = feature.getStyleFunction(); - if (styleFunction) { - styles = styleFunction.call(feature, resolution); - } else { - styleFunction = vectorLayer.getStyleFunction(); - if (styleFunction) { - styles = styleFunction(feature, resolution); - } - } - if (styles) { - var dirty = this.renderFeature( - feature, resolution, pixelRatio, styles, replayGroup); - this.dirty_ = this.dirty_ || dirty; - } - }; - if (vectorLayerRenderOrder) { - /** @type {Array.<ol.Feature>} */ - var features = []; - vectorSource.forEachFeatureInExtent(extent, - /** - * @param {ol.Feature} feature Feature. - */ - function(feature) { - features.push(feature); - }, this); - goog.array.sort(features, vectorLayerRenderOrder); - features.forEach(renderFeature, this); - } else { - vectorSource.forEachFeatureInExtent(extent, renderFeature, this); - } - replayGroup.finish(); - - this.renderedResolution_ = resolution; - this.renderedRevision_ = vectorLayerRevision; - this.renderedRenderOrder_ = vectorLayerRenderOrder; - this.renderedExtent_ = extent; - this.replayGroup_ = replayGroup; - - return true; -}; - - -/** - * @param {ol.Feature} feature Feature. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {Array.<ol.style.Style>} styles Array of styles - * @param {ol.render.canvas.ReplayGroup} replayGroup Replay group. - * @return {boolean} `true` if an image is loading. - */ -ol.renderer.canvas.VectorLayer.prototype.renderFeature = - function(feature, resolution, pixelRatio, styles, replayGroup) { - if (!styles) { - return false; - } - var i, ii, loading = false; - for (i = 0, ii = styles.length; i < ii; ++i) { - loading = ol.renderer.vector.renderFeature( - replayGroup, feature, styles[i], - ol.renderer.vector.getSquaredTolerance(resolution, pixelRatio), - this.handleStyleImageChange_, this) || loading; - } - return loading; -}; - -goog.provide('ol.TileLoadFunctionType'); -goog.provide('ol.TileVectorLoadFunctionType'); - - -/** - * A function that takes an {@link ol.Tile} for the tile and a - * `{string}` for the url as arguments. - * - * @typedef {function(ol.Tile, string)} - * @api - */ -ol.TileLoadFunctionType; - - -/** - * A function that is called with a tile url for the features to load and - * a callback that takes the loaded features as argument. - * - * @typedef {function(string, function(Array.<ol.Feature>))} - * @api - */ -ol.TileVectorLoadFunctionType; - -goog.provide('ol.VectorTile'); - -goog.require('ol.Tile'); -goog.require('ol.TileCoord'); -goog.require('ol.TileLoadFunctionType'); -goog.require('ol.TileState'); - - -/** - * @typedef {{ - * dirty: boolean, - * renderedRenderOrder: (null|function(ol.Feature, ol.Feature):number), - * renderedRevision: number, - * replayGroup: ol.render.IReplayGroup}} - */ -ol.TileReplayState; - - - -/** - * @constructor - * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. - * @param {string} src Data source url. - * @param {ol.format.Feature} format Feature format. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. - */ -ol.VectorTile = function(tileCoord, state, src, format, tileLoadFunction) { - - goog.base(this, tileCoord, state); - - /** - * @private - * @type {ol.format.Feature} - */ - this.format_ = format; - - /** - * @private - * @type {Array.<ol.Feature>} - */ - this.features_ = null; - - /** - * @private - * @type {ol.FeatureLoader} - */ - this.loader_; - - /** - * @private - * @type {ol.proj.Projection} - */ - this.projection_ = null; - - /** - * @private - * @type {ol.TileReplayState} - */ - this.replayState_ = { - dirty: false, - renderedRenderOrder: null, - renderedRevision: -1, - replayGroup: null - }; - - /** - * @private - * @type {ol.TileLoadFunctionType} - */ - this.tileLoadFunction_ = tileLoadFunction; - - /** - * @private - * @type {string} - */ - this.url_ = src; - -}; -goog.inherits(ol.VectorTile, ol.Tile); - - -/** - * @inheritDoc - */ -ol.VectorTile.prototype.disposeInternal = function() { - goog.base(this, 'disposeInternal'); -}; - - -/** - * Get the feature format assigned for reading this tile's features. - * @return {ol.format.Feature} Feature format. - * @api - */ -ol.VectorTile.prototype.getFormat = function() { - return this.format_; -}; - - -/** - * @return {Array.<ol.Feature>} Features. - */ -ol.VectorTile.prototype.getFeatures = function() { - return this.features_; -}; - - -/** - * @return {ol.TileReplayState} - */ -ol.VectorTile.prototype.getReplayState = function() { - return this.replayState_; -}; - - -/** - * @inheritDoc - */ -ol.VectorTile.prototype.getKey = function() { - return this.url_; -}; - - -/** - * @return {ol.proj.Projection} Projection. - */ -ol.VectorTile.prototype.getProjection = function() { - return this.projection_; -}; - - -/** - * Load the tile. - */ -ol.VectorTile.prototype.load = function() { - if (this.state == ol.TileState.IDLE) { - this.setState(ol.TileState.LOADING); - this.tileLoadFunction_(this, this.url_); - this.loader_(null, NaN, null); - } -}; - - -/** - * @param {Array.<ol.Feature>} features Features. - */ -ol.VectorTile.prototype.setFeatures = function(features) { - this.features_ = features; - this.setState(ol.TileState.LOADED); -}; - - -/** - * @param {ol.proj.Projection} projection Projection. - */ -ol.VectorTile.prototype.setProjection = function(projection) { - this.projection_ = projection; -}; - - -/** - * @param {ol.TileState} tileState Tile state. - */ -ol.VectorTile.prototype.setState = function(tileState) { - this.state = tileState; - this.changed(); -}; - - -/** - * Set the feature loader for reading this tile's features. - * @param {ol.FeatureLoader} loader Feature loader. - * @api - */ -ol.VectorTile.prototype.setLoader = function(loader) { - this.loader_ = loader; -}; - -goog.provide('ol.TileUrlFunction'); -goog.provide('ol.TileUrlFunctionType'); - -goog.require('goog.asserts'); -goog.require('goog.math'); -goog.require('ol.TileCoord'); -goog.require('ol.tilecoord'); - - -/** - * {@link ol.source.Tile} sources use a function of this type to get the url - * that provides a tile for a given tile coordinate. - * - * This function takes an {@link ol.TileCoord} for the tile coordinate, a - * `{number}` representing the pixel ratio and an {@link ol.proj.Projection} for - * the projection as arguments and returns a `{string}` representing the tile - * URL, or undefined if no tile should be requested for the passed tile - * coordinate. - * - * @typedef {function(ol.TileCoord, number, - * ol.proj.Projection): (string|undefined)} - * @api - */ -ol.TileUrlFunctionType; - - -/** - * @typedef {function(ol.TileCoord, ol.proj.Projection, ol.TileCoord=): - * ol.TileCoord} - */ -ol.TileCoordTransformType; - - -/** - * @param {string} template Template. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @return {ol.TileUrlFunctionType} Tile URL function. - */ -ol.TileUrlFunction.createFromTemplate = function(template, tileGrid) { - var zRegEx = /\{z\}/g; - var xRegEx = /\{x\}/g; - var yRegEx = /\{y\}/g; - var dashYRegEx = /\{-y\}/g; - return ( - /** - * @param {ol.TileCoord} tileCoord Tile Coordinate. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} Tile URL. - */ - function(tileCoord, pixelRatio, projection) { - if (!tileCoord) { - return undefined; - } else { - return template.replace(zRegEx, tileCoord[0].toString()) - .replace(xRegEx, tileCoord[1].toString()) - .replace(yRegEx, function() { - var y = -tileCoord[2] - 1; - return y.toString(); - }) - .replace(dashYRegEx, function() { - var z = tileCoord[0]; - var range = tileGrid.getFullTileRange(z); - goog.asserts.assert(range, - 'The {-y} template requires a tile grid with extent'); - var y = range.getHeight() + tileCoord[2]; - return y.toString(); - }); - } - }); -}; - - -/** - * @param {Array.<string>} templates Templates. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @return {ol.TileUrlFunctionType} Tile URL function. - */ -ol.TileUrlFunction.createFromTemplates = function(templates, tileGrid) { - var len = templates.length; - var tileUrlFunctions = new Array(len); - for (var i = 0; i < len; ++i) { - tileUrlFunctions[i] = ol.TileUrlFunction.createFromTemplate( - templates[i], tileGrid); - } - return ol.TileUrlFunction.createFromTileUrlFunctions(tileUrlFunctions); -}; - - -/** - * @param {Array.<ol.TileUrlFunctionType>} tileUrlFunctions Tile URL Functions. - * @return {ol.TileUrlFunctionType} Tile URL function. - */ -ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) { - goog.asserts.assert(tileUrlFunctions.length > 0, - 'Length of tile url functions should be greater than 0'); - if (tileUrlFunctions.length === 1) { - return tileUrlFunctions[0]; - } - return ( - /** - * @param {ol.TileCoord} tileCoord Tile Coordinate. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} Tile URL. - */ - function(tileCoord, pixelRatio, projection) { - if (!tileCoord) { - return undefined; - } else { - var h = ol.tilecoord.hash(tileCoord); - var index = goog.math.modulo(h, tileUrlFunctions.length); - return tileUrlFunctions[index](tileCoord, pixelRatio, projection); - } - }); -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} Tile URL. - */ -ol.TileUrlFunction.nullTileUrlFunction = - function(tileCoord, pixelRatio, projection) { - return undefined; -}; - - -/** - * @param {string} url URL. - * @return {Array.<string>} Array of urls. - */ -ol.TileUrlFunction.expandUrl = function(url) { - var urls = []; - var match = /\{(\d)-(\d)\}/.exec(url) || /\{([a-z])-([a-z])\}/.exec(url); - if (match) { - var startCharCode = match[1].charCodeAt(0); - var stopCharCode = match[2].charCodeAt(0); - var charCode; - for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) { - urls.push(url.replace(match[0], String.fromCharCode(charCode))); - } - } else { - urls.push(url); - } - return urls; -}; - -goog.provide('ol.source.UrlTile'); - -goog.require('goog.events'); -goog.require('ol.TileLoadFunctionType'); -goog.require('ol.TileState'); -goog.require('ol.TileUrlFunction'); -goog.require('ol.TileUrlFunctionType'); -goog.require('ol.proj'); -goog.require('ol.source.Tile'); -goog.require('ol.source.TileEvent'); - - -/** - * @typedef {{attributions: (Array.<ol.Attribution>|undefined), - * extent: (ol.Extent|undefined), - * logo: (string|olx.LogoOptions|undefined), - * opaque: (boolean|undefined), - * projection: ol.proj.ProjectionLike, - * state: (ol.source.State|string|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * tileLoadFunction: ol.TileLoadFunctionType, - * tilePixelRatio: (number|undefined), - * tileUrlFunction: (ol.TileUrlFunctionType|undefined), - * url: (string|undefined), - * urls: (Array.<string>|undefined), - * wrapX: (boolean|undefined)}} - */ -ol.source.UrlTileOptions; - - - -/** - * @classdesc - * Base class for sources providing tiles divided into a tile grid over http. - * - * @constructor - * @fires ol.source.TileEvent - * @extends {ol.source.Tile} - * @param {ol.source.UrlTileOptions} options Image tile options. - */ -ol.source.UrlTile = function(options) { - - goog.base(this, { - attributions: options.attributions, - cacheSize: options.cacheSize, - extent: options.extent, - logo: options.logo, - opaque: options.opaque, - projection: options.projection, - state: options.state ? - /** @type {ol.source.State} */ (options.state) : undefined, - tileGrid: options.tileGrid, - tilePixelRatio: options.tilePixelRatio, - wrapX: options.wrapX - }); - - /** - * @protected - * @type {ol.TileLoadFunctionType} - */ - this.tileLoadFunction = options.tileLoadFunction; - - /** - * @protected - * @type {ol.TileUrlFunctionType} - */ - this.tileUrlFunction = options.tileUrlFunction ? - options.tileUrlFunction : - ol.TileUrlFunction.nullTileUrlFunction; - - /** - * @protected - * @type {!Array.<string>|null} - */ - this.urls = null; - - if (options.urls) { - if (options.tileUrlFunction) { - this.urls = options.urls; - } else { - this.setUrls(options.urls); - } - } else if (options.url) { - this.setUrl(options.url); - } - if (options.tileUrlFunction) { - this.setTileUrlFunction(options.tileUrlFunction); - } - -}; -goog.inherits(ol.source.UrlTile, ol.source.Tile); - - -/** - * Return the tile load function of the source. - * @return {ol.TileLoadFunctionType} TileLoadFunction - * @api - */ -ol.source.UrlTile.prototype.getTileLoadFunction = function() { - return this.tileLoadFunction; -}; - - -/** - * Return the tile URL function of the source. - * @return {ol.TileUrlFunctionType} TileUrlFunction - * @api - */ -ol.source.UrlTile.prototype.getTileUrlFunction = function() { - return this.tileUrlFunction; -}; - - -/** - * Return the URLs used for this source. - * When a tileUrlFunction is used instead of url or urls, - * null will be returned. - * @return {!Array.<string>|null} URLs. - * @api - */ -ol.source.UrlTile.prototype.getUrls = function() { - return this.urls; -}; - - -/** - * Handle tile change events. - * @param {goog.events.Event} event Event. - * @protected - */ -ol.source.UrlTile.prototype.handleTileChange = function(event) { - var tile = /** @type {ol.Tile} */ (event.target); - switch (tile.getState()) { - case ol.TileState.LOADING: - this.dispatchEvent( - new ol.source.TileEvent(ol.source.TileEventType.TILELOADSTART, tile)); - break; - case ol.TileState.LOADED: - this.dispatchEvent( - new ol.source.TileEvent(ol.source.TileEventType.TILELOADEND, tile)); - break; - case ol.TileState.ERROR: - this.dispatchEvent( - new ol.source.TileEvent(ol.source.TileEventType.TILELOADERROR, tile)); - break; - } -}; - - -/** - * Set the tile load function of the source. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. - * @api - */ -ol.source.UrlTile.prototype.setTileLoadFunction = function(tileLoadFunction) { - this.tileCache.clear(); - this.tileLoadFunction = tileLoadFunction; - this.changed(); -}; - - -/** - * Set the tile URL function of the source. - * @param {ol.TileUrlFunctionType} tileUrlFunction Tile URL function. - * @api - */ -ol.source.UrlTile.prototype.setTileUrlFunction = function(tileUrlFunction) { - // FIXME It should be possible to be more intelligent and avoid clearing the - // FIXME cache. The tile URL function would need to be incorporated into the - // FIXME cache key somehow. - this.tileCache.clear(); - this.tileUrlFunction = tileUrlFunction; - this.changed(); -}; - - -/** - * Set the URL to use for requests. - * @param {string} url URL. - * @api stable - */ -ol.source.UrlTile.prototype.setUrl = function(url) { - this.setTileUrlFunction(ol.TileUrlFunction.createFromTemplates( - ol.TileUrlFunction.expandUrl(url), this.tileGrid)); - this.urls = [url]; -}; - - -/** - * Set the URLs to use for requests. - * @param {Array.<string>} urls URLs. - * @api stable - */ -ol.source.UrlTile.prototype.setUrls = function(urls) { - this.setTileUrlFunction(ol.TileUrlFunction.createFromTemplates( - urls, this.tileGrid)); - this.urls = urls; -}; - - -/** - * @inheritDoc - */ -ol.source.UrlTile.prototype.useTile = function(z, x, y) { - var tileCoordKey = this.getKeyZXY(z, x, y); - if (this.tileCache.containsKey(tileCoordKey)) { - this.tileCache.get(tileCoordKey); - } -}; - -goog.provide('ol.source.VectorTile'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol.TileState'); -goog.require('ol.VectorTile'); -goog.require('ol.featureloader'); -goog.require('ol.source.UrlTile'); - - - -/** - * @classdesc - * Class for layer sources providing vector data divided into a tile grid, to be - * used with {@link ol.layer.VectorTile}. Although this source receives tiles - * with vector features from the server, it is not meant for feature editing. - * Features are optimized for rendering, their geometries are clipped at or near - * tile boundaries and simplified for a view resolution. See - * {@link ol.source.Vector} for vector sources that are suitable for feature - * editing. - * - * @constructor - * @fires ol.source.TileEvent - * @extends {ol.source.UrlTile} - * @param {olx.source.VectorTileOptions} options Vector tile options. - * @api - */ -ol.source.VectorTile = function(options) { - - goog.base(this, { - attributions: options.attributions, - cacheSize: ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK / 16, - extent: options.extent, - logo: options.logo, - opaque: options.opaque, - projection: options.projection, - state: options.state ? - /** @type {ol.source.State} */ (options.state) : undefined, - tileGrid: options.tileGrid, - tileLoadFunction: options.tileLoadFunction ? - options.tileLoadFunction : ol.source.VectorTile.defaultTileLoadFunction, - tileUrlFunction: options.tileUrlFunction, - tilePixelRatio: options.tilePixelRatio, - url: options.url, - urls: options.urls, - wrapX: options.wrapX === undefined ? true : options.wrapX - }); - - /** - * @private - * @type {ol.format.Feature} - */ - this.format_ = options.format ? options.format : null; - - /** - * @protected - * @type {function(new: ol.VectorTile, ol.TileCoord, ol.TileState, string, - * ol.format.Feature, ol.TileLoadFunctionType)} - */ - this.tileClass = options.tileClass ? options.tileClass : ol.VectorTile; - -}; -goog.inherits(ol.source.VectorTile, ol.source.UrlTile); - - -/** - * @inheritDoc - */ -ol.source.VectorTile.prototype.getTile = - function(z, x, y, pixelRatio, projection) { - var tileCoordKey = this.getKeyZXY(z, x, y); - if (this.tileCache.containsKey(tileCoordKey)) { - return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey)); - } else { - goog.asserts.assert(projection, 'argument projection is truthy'); - var tileCoord = [z, x, y]; - var urlTileCoord = this.getTileCoordForTileUrlFunction( - tileCoord, projection); - var tileUrl = urlTileCoord ? - this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined; - var tile = new this.tileClass( - tileCoord, - tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY, - tileUrl !== undefined ? tileUrl : '', - this.format_, - this.tileLoadFunction); - goog.events.listen(tile, goog.events.EventType.CHANGE, - this.handleTileChange, false, this); - - this.tileCache.set(tileCoordKey, tile); - return tile; - } -}; - - -/** - * @param {ol.VectorTile} vectorTile Vector tile. - * @param {string} url URL. - */ -ol.source.VectorTile.defaultTileLoadFunction = function(vectorTile, url) { - vectorTile.setLoader(ol.featureloader.tile(url, vectorTile.getFormat())); -}; - -goog.provide('ol.renderer.canvas.VectorTileLayer'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.vec.Mat4'); -goog.require('ol.Feature'); -goog.require('ol.TileRange'); -goog.require('ol.TileState'); -goog.require('ol.VectorTile'); -goog.require('ol.ViewHint'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.VectorTile'); -goog.require('ol.proj.Units'); -goog.require('ol.render.EventType'); -goog.require('ol.render.canvas.ReplayGroup'); -goog.require('ol.renderer.canvas.Layer'); -goog.require('ol.renderer.vector'); -goog.require('ol.size'); -goog.require('ol.source.VectorTile'); -goog.require('ol.tilecoord'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.canvas.Layer} - * @param {ol.layer.VectorTile} layer VectorTile layer. - */ -ol.renderer.canvas.VectorTileLayer = function(layer) { - - goog.base(this, layer); - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.context_ = ol.dom.createCanvasContext2D(); - - /** - * @private - * @type {boolean} - */ - this.dirty_ = false; - - /** - * @private - * @type {Array.<ol.VectorTile>} - */ - this.renderedTiles_ = []; - - /** - * @private - * @type {ol.Extent} - */ - this.tmpExtent_ = ol.extent.createEmpty(); - - /** - * @private - * @type {ol.Size} - */ - this.tmpSize_ = [NaN, NaN]; - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.tmpTransform_ = goog.vec.Mat4.createNumber(); - -}; -goog.inherits(ol.renderer.canvas.VectorTileLayer, ol.renderer.canvas.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.canvas.VectorTileLayer.prototype.composeFrame = - function(frameState, layerState, context) { - - var pixelRatio = frameState.pixelRatio; - var skippedFeatureUids = layerState.managed ? - frameState.skippedFeatureUids : {}; - var viewState = frameState.viewState; - var center = viewState.center; - var projection = viewState.projection; - var resolution = viewState.resolution; - var rotation = viewState.rotation; - var layer = this.getLayer(); - var source = layer.getSource(); - goog.asserts.assertInstanceof(source, ol.source.VectorTile, - 'Source is an ol.source.VectorTile'); - - var transform = this.getTransform(frameState, 0); - - this.dispatchPreComposeEvent(context, frameState, transform); - - var replayContext; - if (layer.hasListener(ol.render.EventType.RENDER)) { - // resize and clear - this.context_.canvas.width = context.canvas.width; - this.context_.canvas.height = context.canvas.height; - replayContext = this.context_; - } else { - replayContext = context; - } - // for performance reasons, context.save / context.restore is not used - // to save and restore the transformation matrix and the opacity. - // see http://jsperf.com/context-save-restore-versus-variable - var alpha = replayContext.globalAlpha; - replayContext.globalAlpha = layerState.opacity; - - var tilesToDraw = this.renderedTiles_; - var tileGrid = source.getTileGrid(); - - var currentZ, i, ii, origin, scale, tile, tileExtent, tileSize; - var tilePixelRatio, tilePixelResolution, tilePixelSize, tileResolution; - for (i = 0, ii = tilesToDraw.length; i < ii; ++i) { - tile = tilesToDraw[i]; - currentZ = tile.getTileCoord()[0]; - tileSize = tileGrid.getTileSize(currentZ); - tilePixelSize = source.getTilePixelSize(currentZ, pixelRatio, projection); - tilePixelRatio = tilePixelSize[0] / - ol.size.toSize(tileSize, this.tmpSize_)[0]; - tileResolution = tileGrid.getResolution(currentZ); - tilePixelResolution = tileResolution / tilePixelRatio; - if (tile.getProjection().getUnits() == ol.proj.Units.TILE_PIXELS) { - origin = ol.extent.getTopLeft(tileGrid.getTileCoordExtent( - tile.getTileCoord(), this.tmpExtent_)); - transform = ol.vec.Mat4.makeTransform2D(this.tmpTransform_, - pixelRatio * frameState.size[0] / 2, - pixelRatio * frameState.size[1] / 2, - pixelRatio * tilePixelResolution / resolution, - pixelRatio * tilePixelResolution / resolution, - viewState.rotation, - (origin[0] - center[0]) / tilePixelResolution, - (center[1] - origin[1]) / tilePixelResolution); - } - tile.getReplayState().replayGroup.replay(replayContext, pixelRatio, - transform, rotation, skippedFeatureUids); - } - - transform = this.getTransform(frameState, 0); - - if (replayContext != context) { - this.dispatchRenderEvent(replayContext, frameState, transform); - context.drawImage(replayContext.canvas, 0, 0); - } - replayContext.globalAlpha = alpha; - - this.dispatchPostComposeEvent(context, frameState, transform); -}; - - -/** - * @param {ol.VectorTile} tile Tile. - * @param {ol.layer.VectorTile} layer Vector tile layer. - * @param {number} pixelRatio Pixel ratio. - */ -ol.renderer.canvas.VectorTileLayer.prototype.createReplayGroup = function(tile, - layer, pixelRatio) { - var revision = layer.getRevision(); - var renderOrder = layer.getRenderOrder() || null; - - var replayState = tile.getReplayState(); - if (!replayState.dirty && replayState.renderedRevision == revision && - replayState.renderedRenderOrder == renderOrder) { - return; - } - - // FIXME dispose of old replayGroup in post render - goog.dispose(replayState.replayGroup); - replayState.replayGroup = null; - replayState.dirty = false; - - var source = layer.getSource(); - goog.asserts.assertInstanceof(source, ol.source.VectorTile, - 'Source is an ol.source.VectorTile'); - var tileGrid = source.getTileGrid(); - var tileCoord = tile.getTileCoord(); - var pixelSpace = tile.getProjection().getUnits() == ol.proj.Units.TILE_PIXELS; - var extent; - if (pixelSpace) { - var tilePixelSize = source.getTilePixelSize(tileCoord[0], pixelRatio, - tile.getProjection()); - extent = [0, 0, tilePixelSize[0], tilePixelSize[1]]; - } else { - extent = tileGrid.getTileCoordExtent(tileCoord); - } - var resolution = tileGrid.getResolution(tileCoord[0]); - var tileResolution = pixelSpace ? source.getTilePixelRatio() : resolution; - replayState.dirty = false; - var replayGroup = new ol.render.canvas.ReplayGroup(0, extent, - tileResolution, layer.getRenderBuffer()); - var squaredTolerance = ol.renderer.vector.getSquaredTolerance( - tileResolution, pixelRatio); - - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @this {ol.renderer.canvas.VectorTileLayer} - */ - function renderFeature(feature) { - var styles; - if (feature.getStyleFunction()) { - goog.asserts.assertInstanceof(feature, ol.Feature, 'Got an ol.Feature'); - styles = feature.getStyleFunction().call(feature, resolution); - } else if (layer.getStyleFunction()) { - styles = layer.getStyleFunction()(feature, resolution); - } - if (styles) { - var dirty = this.renderFeature(feature, squaredTolerance, styles, - replayGroup); - this.dirty_ = this.dirty_ || dirty; - replayState.dirty = replayState.dirty || dirty; - } - } - - var features = tile.getFeatures(); - if (renderOrder && renderOrder !== replayState.renderedRenderOrder) { - features.sort(renderOrder); - } - features.forEach(renderFeature, this); - - replayGroup.finish(); - - replayState.renderedRevision = revision; - replayState.renderedRenderOrder = renderOrder; - replayState.replayGroup = replayGroup; -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.VectorTileLayer.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg) { - var resolution = frameState.viewState.resolution; - var rotation = frameState.viewState.rotation; - var layer = this.getLayer(); - var layerState = frameState.layerStates[goog.getUid(layer)]; - /** @type {Object.<string, boolean>} */ - var features = {}; - - var replayables = this.renderedTiles_; - var source = layer.getSource(); - goog.asserts.assertInstanceof(source, ol.source.VectorTile, - 'Source is an ol.source.VectorTile'); - var tileGrid = source.getTileGrid(); - var found, tileSpaceCoordinate; - var i, ii, origin, replayGroup; - var tile, tileCoord, tileExtent, tilePixelRatio, tileResolution, tileSize; - for (i = 0, ii = replayables.length; i < ii; ++i) { - tile = replayables[i]; - tileCoord = tile.getTileCoord(); - tileExtent = source.getTileGrid().getTileCoordExtent(tileCoord, - this.tmpExtent_); - if (!ol.extent.containsCoordinate(tileExtent, coordinate)) { - continue; - } - if (tile.getProjection().getUnits() === ol.proj.Units.TILE_PIXELS) { - origin = ol.extent.getTopLeft(tileExtent); - tilePixelRatio = source.getTilePixelRatio(); - tileResolution = tileGrid.getResolution(tileCoord[0]) / tilePixelRatio; - tileSize = ol.size.toSize(tileGrid.getTileSize(tileCoord[0])); - tileSpaceCoordinate = [ - (coordinate[0] - origin[0]) / tileResolution, - (origin[1] - coordinate[1]) / tileResolution - ]; - resolution = tilePixelRatio; - } else { - tileSpaceCoordinate = coordinate; - } - replayGroup = tile.getReplayState().replayGroup; - found = found || replayGroup.forEachFeatureAtCoordinate( - tileSpaceCoordinate, resolution, rotation, - layerState.managed ? frameState.skippedFeatureUids : {}, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - goog.asserts.assert(feature, 'received a feature'); - var key = goog.getUid(feature).toString(); - if (!(key in features)) { - features[key] = true; - return callback.call(thisArg, feature, layer); - } - }); - } - return found; -}; - - -/** - * Handle changes in image style state. - * @param {goog.events.Event} event Image style change event. - * @private - */ -ol.renderer.canvas.VectorTileLayer.prototype.handleStyleImageChange_ = - function(event) { - this.renderIfReadyAndVisible(); -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.VectorTileLayer.prototype.prepareFrame = - function(frameState, layerState) { - var layer = /** @type {ol.layer.Vector} */ (this.getLayer()); - goog.asserts.assertInstanceof(layer, ol.layer.VectorTile, - 'layer is an instance of ol.layer.VectorTile'); - var source = layer.getSource(); - goog.asserts.assertInstanceof(source, ol.source.VectorTile, - 'Source is an ol.source.VectorTile'); - - this.updateAttributions( - frameState.attributions, source.getAttributions()); - this.updateLogos(frameState, source); - - var animating = frameState.viewHints[ol.ViewHint.ANIMATING]; - var interacting = frameState.viewHints[ol.ViewHint.INTERACTING]; - var updateWhileAnimating = layer.getUpdateWhileAnimating(); - var updateWhileInteracting = layer.getUpdateWhileInteracting(); - - if (!this.dirty_ && (!updateWhileAnimating && animating) || - (!updateWhileInteracting && interacting)) { - return true; - } - - var extent = frameState.extent; - if (layerState.extent) { - extent = ol.extent.getIntersection(extent, layerState.extent); - } - if (ol.extent.isEmpty(extent)) { - // Return false to prevent the rendering of the layer. - return false; - } - - var viewState = frameState.viewState; - var projection = viewState.projection; - var resolution = viewState.resolution; - var pixelRatio = frameState.pixelRatio; - - var tileGrid = source.getTileGrid(); - var resolutions = tileGrid.getResolutions(); - var z = resolutions.length - 1; - while (z > 0 && resolutions[z] < resolution) { - --z; - } - var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); - this.updateUsedTiles(frameState.usedTiles, source, z, tileRange); - this.manageTilePyramid(frameState, source, tileGrid, pixelRatio, - projection, extent, z, layer.getPreload()); - this.scheduleExpireCache(frameState, source); - - /** - * @type {Object.<number, Object.<string, ol.VectorTile>>} - */ - var tilesToDrawByZ = {}; - tilesToDrawByZ[z] = {}; - - var findLoadedTiles = this.createLoadedTileFinder(source, projection, - tilesToDrawByZ); - - var useInterimTilesOnError = layer.getUseInterimTilesOnError(); - - var tmpExtent = this.tmpExtent_; - var tmpTileRange = new ol.TileRange(0, 0, 0, 0); - var childTileRange, fullyLoaded, tile, tileState, x, y; - for (x = tileRange.minX; x <= tileRange.maxX; ++x) { - for (y = tileRange.minY; y <= tileRange.maxY; ++y) { - - tile = source.getTile(z, x, y, pixelRatio, projection); - goog.asserts.assertInstanceof(tile, ol.VectorTile, - 'Tile is an ol.VectorTile'); - tileState = tile.getState(); - if (tileState == ol.TileState.LOADED || - tileState == ol.TileState.EMPTY || - (tileState == ol.TileState.ERROR && !useInterimTilesOnError)) { - tilesToDrawByZ[z][ol.tilecoord.toString(tile.tileCoord)] = tile; - continue; - } - - fullyLoaded = tileGrid.forEachTileCoordParentTileRange( - tile.tileCoord, findLoadedTiles, null, tmpTileRange, tmpExtent); - if (!fullyLoaded) { - childTileRange = tileGrid.getTileCoordChildTileRange( - tile.tileCoord, tmpTileRange, tmpExtent); - if (childTileRange) { - findLoadedTiles(z + 1, childTileRange); - } - } - - } - } - - this.dirty_ = false; - - /** @type {Array.<number>} */ - var zs = Object.keys(tilesToDrawByZ).map(Number); - zs.sort(); - var replayables = []; - var i, ii, currentZ, tileCoordKey, tilesToDraw; - for (i = 0, ii = zs.length; i < ii; ++i) { - currentZ = zs[i]; - tilesToDraw = tilesToDrawByZ[currentZ]; - for (tileCoordKey in tilesToDraw) { - tile = tilesToDraw[tileCoordKey]; - if (tile.getState() == ol.TileState.LOADED) { - replayables.push(tile); - this.createReplayGroup(tile, layer, pixelRatio); - } - } - } - - this.renderedTiles_ = replayables; - - return true; -}; - - -/** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @param {number} squaredTolerance Squared tolerance. - * @param {Array.<ol.style.Style>} styles Array of styles - * @param {ol.render.canvas.ReplayGroup} replayGroup Replay group. - * @return {boolean} `true` if an image is loading. - */ -ol.renderer.canvas.VectorTileLayer.prototype.renderFeature = - function(feature, squaredTolerance, styles, replayGroup) { - if (!styles) { - return false; - } - var i, ii, loading = false; - for (i = 0, ii = styles.length; i < ii; ++i) { - loading = ol.renderer.vector.renderFeature( - replayGroup, feature, styles[i], squaredTolerance, - this.handleStyleImageChange_, this) || loading; - } - return loading; -}; - -// FIXME offset panning - -goog.provide('ol.renderer.canvas.Map'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.style'); -goog.require('goog.vec.Mat4'); -goog.require('ol'); -goog.require('ol.RendererType'); -goog.require('ol.css'); -goog.require('ol.dom'); -goog.require('ol.layer.Image'); -goog.require('ol.layer.Layer'); -goog.require('ol.layer.Tile'); -goog.require('ol.layer.Vector'); -goog.require('ol.layer.VectorTile'); -goog.require('ol.render.Event'); -goog.require('ol.render.EventType'); -goog.require('ol.render.canvas.Immediate'); -goog.require('ol.renderer.Map'); -goog.require('ol.renderer.canvas.ImageLayer'); -goog.require('ol.renderer.canvas.Layer'); -goog.require('ol.renderer.canvas.TileLayer'); -goog.require('ol.renderer.canvas.VectorLayer'); -goog.require('ol.renderer.canvas.VectorTileLayer'); -goog.require('ol.source.State'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.Map} - * @param {Element} container Container. - * @param {ol.Map} map Map. - */ -ol.renderer.canvas.Map = function(container, map) { - - goog.base(this, container, map); - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.context_ = ol.dom.createCanvasContext2D(); - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = this.context_.canvas; - - this.canvas_.style.width = '100%'; - this.canvas_.style.height = '100%'; - this.canvas_.className = ol.css.CLASS_UNSELECTABLE; - goog.dom.insertChildAt(container, this.canvas_, 0); - - /** - * @private - * @type {boolean} - */ - this.renderedVisible_ = true; - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.transform_ = goog.vec.Mat4.createNumber(); - -}; -goog.inherits(ol.renderer.canvas.Map, ol.renderer.Map); - - -/** - * @inheritDoc - */ -ol.renderer.canvas.Map.prototype.createLayerRenderer = function(layer) { - if (ol.ENABLE_IMAGE && layer instanceof ol.layer.Image) { - return new ol.renderer.canvas.ImageLayer(layer); - } else if (ol.ENABLE_TILE && layer instanceof ol.layer.Tile) { - return new ol.renderer.canvas.TileLayer(layer); - } else if (ol.ENABLE_VECTOR_TILE && layer instanceof ol.layer.VectorTile) { - return new ol.renderer.canvas.VectorTileLayer(layer); - } else if (ol.ENABLE_VECTOR && layer instanceof ol.layer.Vector) { - return new ol.renderer.canvas.VectorLayer(layer); - } else { - goog.asserts.fail('unexpected layer configuration'); - return null; - } -}; - - -/** - * @param {ol.render.EventType} type Event type. - * @param {olx.FrameState} frameState Frame state. - * @private - */ -ol.renderer.canvas.Map.prototype.dispatchComposeEvent_ = - function(type, frameState) { - var map = this.getMap(); - var context = this.context_; - if (map.hasListener(type)) { - var extent = frameState.extent; - var pixelRatio = frameState.pixelRatio; - var viewState = frameState.viewState; - var rotation = viewState.rotation; - - var transform = this.getTransform(frameState); - - var vectorContext = new ol.render.canvas.Immediate(context, pixelRatio, - extent, transform, rotation); - var composeEvent = new ol.render.Event(type, map, vectorContext, - frameState, context, null); - map.dispatchEvent(composeEvent); - - vectorContext.flush(); - } -}; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @protected - * @return {!goog.vec.Mat4.Number} Transform. - */ -ol.renderer.canvas.Map.prototype.getTransform = function(frameState) { - var pixelRatio = frameState.pixelRatio; - var viewState = frameState.viewState; - var resolution = viewState.resolution; - return ol.vec.Mat4.makeTransform2D(this.transform_, - this.canvas_.width / 2, this.canvas_.height / 2, - pixelRatio / resolution, -pixelRatio / resolution, - -viewState.rotation, - -viewState.center[0], -viewState.center[1]); -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.Map.prototype.getType = function() { - return ol.RendererType.CANVAS; -}; - - -/** - * @inheritDoc - */ -ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) { - - if (!frameState) { - if (this.renderedVisible_) { - goog.style.setElementShown(this.canvas_, false); - this.renderedVisible_ = false; - } - return; - } - - var context = this.context_; - var width = frameState.size[0] * frameState.pixelRatio; - var height = frameState.size[1] * frameState.pixelRatio; - if (this.canvas_.width != width || this.canvas_.height != height) { - this.canvas_.width = width; - this.canvas_.height = height; - } else { - context.clearRect(0, 0, this.canvas_.width, this.canvas_.height); - } - - this.calculateMatrices2D(frameState); - - this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, frameState); - - var layerStatesArray = frameState.layerStatesArray; - goog.array.stableSort(layerStatesArray, ol.renderer.Map.sortByZIndex); - - var viewResolution = frameState.viewState.resolution; - var i, ii, layer, layerRenderer, layerState; - for (i = 0, ii = layerStatesArray.length; i < ii; ++i) { - layerState = layerStatesArray[i]; - layer = layerState.layer; - layerRenderer = this.getLayerRenderer(layer); - goog.asserts.assertInstanceof(layerRenderer, ol.renderer.canvas.Layer, - 'layerRenderer is an instance of ol.renderer.canvas.Layer'); - if (!ol.layer.Layer.visibleAtResolution(layerState, viewResolution) || - layerState.sourceState != ol.source.State.READY) { - continue; - } - if (layerRenderer.prepareFrame(frameState, layerState)) { - layerRenderer.composeFrame(frameState, layerState, context); - } - } - - this.dispatchComposeEvent_( - ol.render.EventType.POSTCOMPOSE, frameState); - - if (!this.renderedVisible_) { - goog.style.setElementShown(this.canvas_, true); - this.renderedVisible_ = true; - } - - this.scheduleRemoveUnusedLayerRenderers(frameState); - this.scheduleExpireIconCache(frameState); -}; - -goog.provide('ol.renderer.dom.Layer'); - -goog.require('ol'); -goog.require('ol.layer.Layer'); -goog.require('ol.renderer.Layer'); - - - -/** - * @constructor - * @extends {ol.renderer.Layer} - * @param {ol.layer.Layer} layer Layer. - * @param {!Element} target Target. - */ -ol.renderer.dom.Layer = function(layer, target) { - - goog.base(this, layer); - - /** - * @type {!Element} - * @protected - */ - this.target = target; - -}; -goog.inherits(ol.renderer.dom.Layer, ol.renderer.Layer); - - -/** - * Clear rendered elements. - */ -ol.renderer.dom.Layer.prototype.clearFrame = ol.nullFunction; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {ol.layer.LayerState} layerState Layer state. - */ -ol.renderer.dom.Layer.prototype.composeFrame = ol.nullFunction; - - -/** - * @return {!Element} Target. - */ -ol.renderer.dom.Layer.prototype.getTarget = function() { - return this.target; -}; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {ol.layer.LayerState} layerState Layer state. - * @return {boolean} whether composeFrame should be called. - */ -ol.renderer.dom.Layer.prototype.prepareFrame = goog.abstractMethod; - -goog.provide('ol.renderer.dom.ImageLayer'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.vec.Mat4'); -goog.require('ol.ImageBase'); -goog.require('ol.ViewHint'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.Image'); -goog.require('ol.proj'); -goog.require('ol.renderer.dom.Layer'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.dom.Layer} - * @param {ol.layer.Image} imageLayer Image layer. - */ -ol.renderer.dom.ImageLayer = function(imageLayer) { - var target = goog.dom.createElement('DIV'); - target.style.position = 'absolute'; - - goog.base(this, imageLayer, target); - - /** - * The last rendered image. - * @private - * @type {?ol.ImageBase} - */ - this.image_ = null; - - /** - * @private - * @type {goog.vec.Mat4.Number} - */ - this.transform_ = goog.vec.Mat4.createNumberIdentity(); - -}; -goog.inherits(ol.renderer.dom.ImageLayer, ol.renderer.dom.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.dom.ImageLayer.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg) { - var layer = this.getLayer(); - var source = layer.getSource(); - var resolution = frameState.viewState.resolution; - var rotation = frameState.viewState.rotation; - var skippedFeatureUids = frameState.skippedFeatureUids; - return source.forEachFeatureAtCoordinate( - coordinate, resolution, rotation, skippedFeatureUids, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - return callback.call(thisArg, feature, layer); - }); -}; - - -/** - * @inheritDoc - */ -ol.renderer.dom.ImageLayer.prototype.clearFrame = function() { - goog.dom.removeChildren(this.target); - this.image_ = null; -}; - - -/** - * @inheritDoc - */ -ol.renderer.dom.ImageLayer.prototype.prepareFrame = - function(frameState, layerState) { - - var viewState = frameState.viewState; - var viewCenter = viewState.center; - var viewResolution = viewState.resolution; - var viewRotation = viewState.rotation; - - var image = this.image_; - var imageLayer = this.getLayer(); - goog.asserts.assertInstanceof(imageLayer, ol.layer.Image, - 'layer is an instance of ol.layer.Image'); - var imageSource = imageLayer.getSource(); - - var hints = frameState.viewHints; - - var renderedExtent = frameState.extent; - if (layerState.extent !== undefined) { - renderedExtent = ol.extent.getIntersection( - renderedExtent, layerState.extent); - } - - if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING] && - !ol.extent.isEmpty(renderedExtent)) { - var projection = viewState.projection; - if (!ol.ENABLE_RASTER_REPROJECTION) { - var sourceProjection = imageSource.getProjection(); - if (sourceProjection) { - goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection), - 'projection and sourceProjection are equivalent'); - projection = sourceProjection; - } - } - var image_ = imageSource.getImage(renderedExtent, viewResolution, - frameState.pixelRatio, projection); - if (image_) { - var loaded = this.loadImage(image_); - if (loaded) { - image = image_; - } - } - } - - if (image) { - var imageExtent = image.getExtent(); - var imageResolution = image.getResolution(); - var transform = goog.vec.Mat4.createNumber(); - ol.vec.Mat4.makeTransform2D(transform, - frameState.size[0] / 2, frameState.size[1] / 2, - imageResolution / viewResolution, imageResolution / viewResolution, - viewRotation, - (imageExtent[0] - viewCenter[0]) / imageResolution, - (viewCenter[1] - imageExtent[3]) / imageResolution); - if (image != this.image_) { - var imageElement = image.getImage(this); - // Bootstrap sets the style max-width: 100% for all images, which breaks - // prevents the image from being displayed in FireFox. Workaround by - // overriding the max-width style. - imageElement.style.maxWidth = 'none'; - imageElement.style.position = 'absolute'; - goog.dom.removeChildren(this.target); - this.target.appendChild(imageElement); - this.image_ = image; - } - this.setTransform_(transform); - this.updateAttributions(frameState.attributions, image.getAttributions()); - this.updateLogos(frameState, imageSource); - } - - return true; -}; - - -/** - * @param {goog.vec.Mat4.Number} transform Transform. - * @private - */ -ol.renderer.dom.ImageLayer.prototype.setTransform_ = function(transform) { - if (!ol.vec.Mat4.equals2D(transform, this.transform_)) { - ol.dom.transformElement2D(this.target, transform, 6); - goog.vec.Mat4.setFromArray(this.transform_, transform); - } -}; - -// FIXME probably need to reset TileLayerZ if offsets get too large -// FIXME when zooming out, preserve higher Z divs to avoid white flash - -goog.provide('ol.renderer.dom.TileLayer'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.style'); -goog.require('goog.vec.Mat4'); -goog.require('ol'); -goog.require('ol.Coordinate'); -goog.require('ol.TileCoord'); -goog.require('ol.TileRange'); -goog.require('ol.TileState'); -goog.require('ol.ViewHint'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.Tile'); -goog.require('ol.renderer.dom.Layer'); -goog.require('ol.size'); -goog.require('ol.tilecoord'); -goog.require('ol.tilegrid.TileGrid'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.dom.Layer} - * @param {ol.layer.Tile} tileLayer Tile layer. - */ -ol.renderer.dom.TileLayer = function(tileLayer) { - - var target = goog.dom.createElement('DIV'); - target.style.position = 'absolute'; - - goog.base(this, tileLayer, target); - - /** - * @private - * @type {boolean} - */ - this.renderedVisible_ = true; - - /** - * @private - * @type {number} - */ - this.renderedOpacity_ = 1; - - /** - * @private - * @type {number} - */ - this.renderedRevision_ = 0; - - /** - * @private - * @type {!Object.<number, ol.renderer.dom.TileLayerZ_>} - */ - this.tileLayerZs_ = {}; - -}; -goog.inherits(ol.renderer.dom.TileLayer, ol.renderer.dom.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.dom.TileLayer.prototype.clearFrame = function() { - goog.dom.removeChildren(this.target); - this.renderedRevision_ = 0; -}; - - -/** - * @inheritDoc - */ -ol.renderer.dom.TileLayer.prototype.prepareFrame = - function(frameState, layerState) { - - if (!layerState.visible) { - if (this.renderedVisible_) { - goog.style.setElementShown(this.target, false); - this.renderedVisible_ = false; - } - return true; - } - - var pixelRatio = frameState.pixelRatio; - var viewState = frameState.viewState; - var projection = viewState.projection; - - var tileLayer = this.getLayer(); - goog.asserts.assertInstanceof(tileLayer, ol.layer.Tile, - 'layer is an instance of ol.layer.Tile'); - var tileSource = tileLayer.getSource(); - var tileGrid = tileSource.getTileGridForProjection(projection); - var tileGutter = tileSource.getGutter(); - var z = tileGrid.getZForResolution(viewState.resolution); - var tileResolution = tileGrid.getResolution(z); - var center = viewState.center; - var extent; - if (tileResolution == viewState.resolution) { - center = this.snapCenterToPixel(center, tileResolution, frameState.size); - extent = ol.extent.getForViewAndSize( - center, tileResolution, viewState.rotation, frameState.size); - } else { - extent = frameState.extent; - } - - if (layerState.extent !== undefined) { - extent = ol.extent.getIntersection(extent, layerState.extent); - } - - var tileRange = tileGrid.getTileRangeForExtentAndResolution( - extent, tileResolution); - - /** @type {Object.<number, Object.<string, ol.Tile>>} */ - var tilesToDrawByZ = {}; - tilesToDrawByZ[z] = {}; - - var findLoadedTiles = this.createLoadedTileFinder( - tileSource, projection, tilesToDrawByZ); - - var useInterimTilesOnError = tileLayer.getUseInterimTilesOnError(); - - var tmpExtent = ol.extent.createEmpty(); - var tmpTileRange = new ol.TileRange(0, 0, 0, 0); - var childTileRange, fullyLoaded, tile, tileState, x, y; - for (x = tileRange.minX; x <= tileRange.maxX; ++x) { - for (y = tileRange.minY; y <= tileRange.maxY; ++y) { - - tile = tileSource.getTile(z, x, y, pixelRatio, projection); - tileState = tile.getState(); - if (tileState == ol.TileState.LOADED) { - tilesToDrawByZ[z][ol.tilecoord.toString(tile.tileCoord)] = tile; - continue; - } else if (tileState == ol.TileState.EMPTY || - (tileState == ol.TileState.ERROR && - !useInterimTilesOnError)) { - continue; - } - - fullyLoaded = tileGrid.forEachTileCoordParentTileRange( - tile.tileCoord, findLoadedTiles, null, tmpTileRange, tmpExtent); - if (!fullyLoaded) { - childTileRange = tileGrid.getTileCoordChildTileRange( - tile.tileCoord, tmpTileRange, tmpExtent); - if (childTileRange) { - findLoadedTiles(z + 1, childTileRange); - } - } - - } - - } - - // If the tile source revision changes, we destroy the existing DOM structure - // so that a new one will be created. It would be more efficient to modify - // the existing structure. - var tileLayerZ, tileLayerZKey; - if (this.renderedRevision_ != tileSource.getRevision()) { - for (tileLayerZKey in this.tileLayerZs_) { - tileLayerZ = this.tileLayerZs_[+tileLayerZKey]; - goog.dom.removeNode(tileLayerZ.target); - } - this.tileLayerZs_ = {}; - this.renderedRevision_ = tileSource.getRevision(); - } - - /** @type {Array.<number>} */ - var zs = Object.keys(tilesToDrawByZ).map(Number); - goog.array.sort(zs); - - /** @type {Object.<number, boolean>} */ - var newTileLayerZKeys = {}; - - var iz, iziz, tileCoordKey, tileCoordOrigin, tilesToDraw; - for (iz = 0, iziz = zs.length; iz < iziz; ++iz) { - tileLayerZKey = zs[iz]; - if (tileLayerZKey in this.tileLayerZs_) { - tileLayerZ = this.tileLayerZs_[tileLayerZKey]; - } else { - tileCoordOrigin = - tileGrid.getTileCoordForCoordAndZ(center, tileLayerZKey); - tileLayerZ = new ol.renderer.dom.TileLayerZ_(tileGrid, tileCoordOrigin); - newTileLayerZKeys[tileLayerZKey] = true; - this.tileLayerZs_[tileLayerZKey] = tileLayerZ; - } - tilesToDraw = tilesToDrawByZ[tileLayerZKey]; - for (tileCoordKey in tilesToDraw) { - tileLayerZ.addTile(tilesToDraw[tileCoordKey], tileGutter); - } - tileLayerZ.finalizeAddTiles(); - } - - /** @type {Array.<number>} */ - var tileLayerZKeys = Object.keys(this.tileLayerZs_).map(Number); - goog.array.sort(tileLayerZKeys); - - var i, ii, j, origin, resolution; - var transform = goog.vec.Mat4.createNumber(); - for (i = 0, ii = tileLayerZKeys.length; i < ii; ++i) { - tileLayerZKey = tileLayerZKeys[i]; - tileLayerZ = this.tileLayerZs_[tileLayerZKey]; - if (!(tileLayerZKey in tilesToDrawByZ)) { - goog.dom.removeNode(tileLayerZ.target); - delete this.tileLayerZs_[tileLayerZKey]; - continue; - } - resolution = tileLayerZ.getResolution(); - origin = tileLayerZ.getOrigin(); - ol.vec.Mat4.makeTransform2D(transform, - frameState.size[0] / 2, frameState.size[1] / 2, - resolution / viewState.resolution, - resolution / viewState.resolution, - viewState.rotation, - (origin[0] - center[0]) / resolution, - (center[1] - origin[1]) / resolution); - tileLayerZ.setTransform(transform); - if (tileLayerZKey in newTileLayerZKeys) { - for (j = tileLayerZKey - 1; j >= 0; --j) { - if (j in this.tileLayerZs_) { - goog.dom.insertSiblingAfter( - tileLayerZ.target, this.tileLayerZs_[j].target); - break; - } - } - if (j < 0) { - goog.dom.insertChildAt(this.target, tileLayerZ.target, 0); - } - } else { - if (!frameState.viewHints[ol.ViewHint.ANIMATING] && - !frameState.viewHints[ol.ViewHint.INTERACTING]) { - tileLayerZ.removeTilesOutsideExtent(extent, tmpTileRange); - } - } - } - - if (layerState.opacity != this.renderedOpacity_) { - this.target.style.opacity = layerState.opacity; - this.renderedOpacity_ = layerState.opacity; - } - - if (layerState.visible && !this.renderedVisible_) { - goog.style.setElementShown(this.target, true); - this.renderedVisible_ = true; - } - - this.updateUsedTiles(frameState.usedTiles, tileSource, z, tileRange); - this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio, - projection, extent, z, tileLayer.getPreload()); - this.scheduleExpireCache(frameState, tileSource); - this.updateLogos(frameState, tileSource); - - return true; -}; - - - -/** - * @constructor - * @private - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @param {ol.TileCoord} tileCoordOrigin Tile coord origin. - */ -ol.renderer.dom.TileLayerZ_ = function(tileGrid, tileCoordOrigin) { - - /** - * @type {!Element} - */ - this.target = goog.dom.createElement('DIV'); - this.target.style.position = 'absolute'; - this.target.style.width = '100%'; - this.target.style.height = '100%'; - - /** - * @private - * @type {ol.tilegrid.TileGrid} - */ - this.tileGrid_ = tileGrid; - - /** - * @private - * @type {ol.TileCoord} - */ - this.tileCoordOrigin_ = tileCoordOrigin; - - /** - * @private - * @type {ol.Coordinate} - */ - this.origin_ = - ol.extent.getTopLeft(tileGrid.getTileCoordExtent(tileCoordOrigin)); - - /** - * @private - * @type {number} - */ - this.resolution_ = tileGrid.getResolution(tileCoordOrigin[0]); - - /** - * @private - * @type {Object.<string, ol.Tile>} - */ - this.tiles_ = {}; - - /** - * @private - * @type {DocumentFragment} - */ - this.documentFragment_ = null; - - /** - * @private - * @type {goog.vec.Mat4.Number} - */ - this.transform_ = goog.vec.Mat4.createNumberIdentity(); - - /** - * @private - * @type {ol.Size} - */ - this.tmpSize_ = [0, 0]; - -}; - - -/** - * @param {ol.Tile} tile Tile. - * @param {number} tileGutter Tile gutter. - */ -ol.renderer.dom.TileLayerZ_.prototype.addTile = function(tile, tileGutter) { - var tileCoord = tile.tileCoord; - var tileCoordZ = tileCoord[0]; - var tileCoordX = tileCoord[1]; - var tileCoordY = tileCoord[2]; - goog.asserts.assert(tileCoordZ == this.tileCoordOrigin_[0], - 'tileCoordZ matches z of tileCoordOrigin'); - var tileCoordKey = ol.tilecoord.toString(tileCoord); - if (tileCoordKey in this.tiles_) { - return; - } - var tileSize = ol.size.toSize( - this.tileGrid_.getTileSize(tileCoordZ), this.tmpSize_); - var image = tile.getImage(this); - var imageStyle = image.style; - // Bootstrap sets the style max-width: 100% for all images, which - // prevents the tile from being displayed in FireFox. Workaround - // by overriding the max-width style. - imageStyle.maxWidth = 'none'; - var tileElement; - var tileElementStyle; - if (tileGutter > 0) { - tileElement = goog.dom.createElement('DIV'); - tileElementStyle = tileElement.style; - tileElementStyle.overflow = 'hidden'; - tileElementStyle.width = tileSize[0] + 'px'; - tileElementStyle.height = tileSize[1] + 'px'; - imageStyle.position = 'absolute'; - imageStyle.left = -tileGutter + 'px'; - imageStyle.top = -tileGutter + 'px'; - imageStyle.width = (tileSize[0] + 2 * tileGutter) + 'px'; - imageStyle.height = (tileSize[1] + 2 * tileGutter) + 'px'; - tileElement.appendChild(image); - } else { - imageStyle.width = tileSize[0] + 'px'; - imageStyle.height = tileSize[1] + 'px'; - tileElement = image; - tileElementStyle = imageStyle; - } - tileElementStyle.position = 'absolute'; - tileElementStyle.left = - ((tileCoordX - this.tileCoordOrigin_[1]) * tileSize[0]) + 'px'; - tileElementStyle.top = - ((this.tileCoordOrigin_[2] - tileCoordY) * tileSize[1]) + 'px'; - if (!this.documentFragment_) { - this.documentFragment_ = document.createDocumentFragment(); - } - this.documentFragment_.appendChild(tileElement); - this.tiles_[tileCoordKey] = tile; -}; - - -/** - * FIXME empty description for jsdoc - */ -ol.renderer.dom.TileLayerZ_.prototype.finalizeAddTiles = function() { - if (this.documentFragment_) { - this.target.appendChild(this.documentFragment_); - this.documentFragment_ = null; - } -}; - - -/** - * @return {ol.Coordinate} Origin. - */ -ol.renderer.dom.TileLayerZ_.prototype.getOrigin = function() { - return this.origin_; -}; - - -/** - * @return {number} Resolution. - */ -ol.renderer.dom.TileLayerZ_.prototype.getResolution = function() { - return this.resolution_; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {ol.TileRange=} opt_tileRange Temporary ol.TileRange object. - */ -ol.renderer.dom.TileLayerZ_.prototype.removeTilesOutsideExtent = - function(extent, opt_tileRange) { - var tileRange = this.tileGrid_.getTileRangeForExtentAndZ( - extent, this.tileCoordOrigin_[0], opt_tileRange); - /** @type {Array.<ol.Tile>} */ - var tilesToRemove = []; - var tile, tileCoordKey; - for (tileCoordKey in this.tiles_) { - tile = this.tiles_[tileCoordKey]; - if (!tileRange.contains(tile.tileCoord)) { - tilesToRemove.push(tile); - } - } - var i, ii; - for (i = 0, ii = tilesToRemove.length; i < ii; ++i) { - tile = tilesToRemove[i]; - tileCoordKey = ol.tilecoord.toString(tile.tileCoord); - goog.dom.removeNode(tile.getImage(this)); - delete this.tiles_[tileCoordKey]; - } -}; - - -/** - * @param {goog.vec.Mat4.Number} transform Transform. - */ -ol.renderer.dom.TileLayerZ_.prototype.setTransform = function(transform) { - if (!ol.vec.Mat4.equals2D(transform, this.transform_)) { - ol.dom.transformElement2D(this.target, transform, 6); - goog.vec.Mat4.setFromArray(this.transform_, transform); - } -}; - -goog.provide('ol.renderer.dom.VectorLayer'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.vec.Mat4'); -goog.require('ol.ViewHint'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.Vector'); -goog.require('ol.render.Event'); -goog.require('ol.render.EventType'); -goog.require('ol.render.canvas.Immediate'); -goog.require('ol.render.canvas.ReplayGroup'); -goog.require('ol.renderer.dom.Layer'); -goog.require('ol.renderer.vector'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.dom.Layer} - * @param {ol.layer.Vector} vectorLayer Vector layer. - */ -ol.renderer.dom.VectorLayer = function(vectorLayer) { - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.context_ = ol.dom.createCanvasContext2D(); - - var target = this.context_.canvas; - // Bootstrap sets the style max-width: 100% for all images, which breaks - // prevents the image from being displayed in FireFox. Workaround by - // overriding the max-width style. - target.style.maxWidth = 'none'; - target.style.position = 'absolute'; - - goog.base(this, vectorLayer, target); - - /** - * @private - * @type {boolean} - */ - this.dirty_ = false; - - /** - * @private - * @type {number} - */ - this.renderedRevision_ = -1; - - /** - * @private - * @type {number} - */ - this.renderedResolution_ = NaN; - - /** - * @private - * @type {ol.Extent} - */ - this.renderedExtent_ = ol.extent.createEmpty(); - - /** - * @private - * @type {function(ol.Feature, ol.Feature): number|null} - */ - this.renderedRenderOrder_ = null; - - /** - * @private - * @type {ol.render.canvas.ReplayGroup} - */ - this.replayGroup_ = null; - - /** - * @private - * @type {goog.vec.Mat4.Number} - */ - this.transform_ = goog.vec.Mat4.createNumber(); - - /** - * @private - * @type {goog.vec.Mat4.Number} - */ - this.elementTransform_ = goog.vec.Mat4.createNumber(); - -}; -goog.inherits(ol.renderer.dom.VectorLayer, ol.renderer.dom.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.dom.VectorLayer.prototype.composeFrame = - function(frameState, layerState) { - - var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer()); - goog.asserts.assertInstanceof(vectorLayer, ol.layer.Vector, - 'layer is an instance of ol.layer.Vector'); - - var viewState = frameState.viewState; - var viewCenter = viewState.center; - var viewRotation = viewState.rotation; - var viewResolution = viewState.resolution; - var pixelRatio = frameState.pixelRatio; - var viewWidth = frameState.size[0]; - var viewHeight = frameState.size[1]; - var imageWidth = viewWidth * pixelRatio; - var imageHeight = viewHeight * pixelRatio; - - var transform = ol.vec.Mat4.makeTransform2D(this.transform_, - pixelRatio * viewWidth / 2, - pixelRatio * viewHeight / 2, - pixelRatio / viewResolution, - -pixelRatio / viewResolution, - -viewRotation, - -viewCenter[0], -viewCenter[1]); - - var context = this.context_; - - // Clear the canvas and set the correct size - context.canvas.width = imageWidth; - context.canvas.height = imageHeight; - - var elementTransform = ol.vec.Mat4.makeTransform2D(this.elementTransform_, - 0, 0, - 1 / pixelRatio, 1 / pixelRatio, - 0, - -(imageWidth - viewWidth) / 2 * pixelRatio, - -(imageHeight - viewHeight) / 2 * pixelRatio); - ol.dom.transformElement2D(context.canvas, elementTransform, 6); - - this.dispatchEvent_(ol.render.EventType.PRECOMPOSE, frameState, transform); - - var replayGroup = this.replayGroup_; - - if (replayGroup && !replayGroup.isEmpty()) { - - context.globalAlpha = layerState.opacity; - replayGroup.replay(context, pixelRatio, transform, viewRotation, - layerState.managed ? frameState.skippedFeatureUids : {}); - - this.dispatchEvent_(ol.render.EventType.RENDER, frameState, transform); - } - - this.dispatchEvent_(ol.render.EventType.POSTCOMPOSE, frameState, transform); -}; - - -/** - * @param {ol.render.EventType} type Event type. - * @param {olx.FrameState} frameState Frame state. - * @param {goog.vec.Mat4.Number} transform Transform. - * @private - */ -ol.renderer.dom.VectorLayer.prototype.dispatchEvent_ = - function(type, frameState, transform) { - var context = this.context_; - var layer = this.getLayer(); - if (layer.hasListener(type)) { - var render = new ol.render.canvas.Immediate( - context, frameState.pixelRatio, frameState.extent, transform, - frameState.viewState.rotation); - var event = new ol.render.Event(type, layer, render, frameState, - context, null); - layer.dispatchEvent(event); - render.flush(); - } -}; - - -/** - * @inheritDoc - */ -ol.renderer.dom.VectorLayer.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg) { - if (!this.replayGroup_) { - return undefined; - } else { - var resolution = frameState.viewState.resolution; - var rotation = frameState.viewState.rotation; - var layer = this.getLayer(); - var layerState = frameState.layerStates[goog.getUid(layer)]; - /** @type {Object.<string, boolean>} */ - var features = {}; - return this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, - rotation, layerState.managed ? frameState.skippedFeatureUids : {}, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - goog.asserts.assert(feature !== undefined, 'received a feature'); - var key = goog.getUid(feature).toString(); - if (!(key in features)) { - features[key] = true; - return callback.call(thisArg, feature, layer); - } - }); - } -}; - - -/** - * Handle changes in image style state. - * @param {goog.events.Event} event Image style change event. - * @private - */ -ol.renderer.dom.VectorLayer.prototype.handleStyleImageChange_ = - function(event) { - this.renderIfReadyAndVisible(); -}; - - -/** - * @inheritDoc - */ -ol.renderer.dom.VectorLayer.prototype.prepareFrame = - function(frameState, layerState) { - - var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer()); - goog.asserts.assertInstanceof(vectorLayer, ol.layer.Vector, - 'layer is an instance of ol.layer.Vector'); - var vectorSource = vectorLayer.getSource(); - - this.updateAttributions( - frameState.attributions, vectorSource.getAttributions()); - this.updateLogos(frameState, vectorSource); - - var animating = frameState.viewHints[ol.ViewHint.ANIMATING]; - var interacting = frameState.viewHints[ol.ViewHint.INTERACTING]; - var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating(); - var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting(); - - if (!this.dirty_ && (!updateWhileAnimating && animating) || - (!updateWhileInteracting && interacting)) { - return true; - } - - var frameStateExtent = frameState.extent; - var viewState = frameState.viewState; - var projection = viewState.projection; - var resolution = viewState.resolution; - var pixelRatio = frameState.pixelRatio; - var vectorLayerRevision = vectorLayer.getRevision(); - var vectorLayerRenderBuffer = vectorLayer.getRenderBuffer(); - var vectorLayerRenderOrder = vectorLayer.getRenderOrder(); - - if (vectorLayerRenderOrder === undefined) { - vectorLayerRenderOrder = ol.renderer.vector.defaultOrder; - } - - var extent = ol.extent.buffer(frameStateExtent, - vectorLayerRenderBuffer * resolution); - - if (!this.dirty_ && - this.renderedResolution_ == resolution && - this.renderedRevision_ == vectorLayerRevision && - this.renderedRenderOrder_ == vectorLayerRenderOrder && - ol.extent.containsExtent(this.renderedExtent_, extent)) { - return true; - } - - // FIXME dispose of old replayGroup in post render - goog.dispose(this.replayGroup_); - this.replayGroup_ = null; - - this.dirty_ = false; - - var replayGroup = - new ol.render.canvas.ReplayGroup( - ol.renderer.vector.getTolerance(resolution, pixelRatio), extent, - resolution, vectorLayer.getRenderBuffer()); - vectorSource.loadFeatures(extent, resolution, projection); - var renderFeature = - /** - * @param {ol.Feature} feature Feature. - * @this {ol.renderer.dom.VectorLayer} - */ - function(feature) { - var styles; - var styleFunction = feature.getStyleFunction(); - if (styleFunction) { - styles = styleFunction.call(feature, resolution); - } else { - styleFunction = vectorLayer.getStyleFunction(); - if (styleFunction) { - styles = styleFunction(feature, resolution); - } - } - if (styles) { - var dirty = this.renderFeature( - feature, resolution, pixelRatio, styles, replayGroup); - this.dirty_ = this.dirty_ || dirty; - } - }; - if (vectorLayerRenderOrder) { - /** @type {Array.<ol.Feature>} */ - var features = []; - vectorSource.forEachFeatureInExtent(extent, - /** - * @param {ol.Feature} feature Feature. - */ - function(feature) { - features.push(feature); - }, this); - goog.array.sort(features, vectorLayerRenderOrder); - features.forEach(renderFeature, this); - } else { - vectorSource.forEachFeatureInExtent(extent, renderFeature, this); - } - replayGroup.finish(); - - this.renderedResolution_ = resolution; - this.renderedRevision_ = vectorLayerRevision; - this.renderedRenderOrder_ = vectorLayerRenderOrder; - this.renderedExtent_ = extent; - this.replayGroup_ = replayGroup; - - return true; -}; - - -/** - * @param {ol.Feature} feature Feature. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {Array.<ol.style.Style>} styles Array of styles - * @param {ol.render.canvas.ReplayGroup} replayGroup Replay group. - * @return {boolean} `true` if an image is loading. - */ -ol.renderer.dom.VectorLayer.prototype.renderFeature = - function(feature, resolution, pixelRatio, styles, replayGroup) { - if (!styles) { - return false; - } - var i, ii, loading = false; - for (i = 0, ii = styles.length; i < ii; ++i) { - loading = ol.renderer.vector.renderFeature( - replayGroup, feature, styles[i], - ol.renderer.vector.getSquaredTolerance(resolution, pixelRatio), - this.handleStyleImageChange_, this) || loading; - } - return loading; -}; - -goog.provide('ol.renderer.dom.Map'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.events.EventType'); -goog.require('goog.style'); -goog.require('goog.vec.Mat4'); -goog.require('ol'); -goog.require('ol.RendererType'); -goog.require('ol.css'); -goog.require('ol.dom'); -goog.require('ol.layer.Image'); -goog.require('ol.layer.Layer'); -goog.require('ol.layer.Tile'); -goog.require('ol.layer.Vector'); -goog.require('ol.render.Event'); -goog.require('ol.render.EventType'); -goog.require('ol.render.canvas.Immediate'); -goog.require('ol.renderer.Map'); -goog.require('ol.renderer.dom.ImageLayer'); -goog.require('ol.renderer.dom.Layer'); -goog.require('ol.renderer.dom.TileLayer'); -goog.require('ol.renderer.dom.VectorLayer'); -goog.require('ol.source.State'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.Map} - * @param {Element} container Container. - * @param {ol.Map} map Map. - */ -ol.renderer.dom.Map = function(container, map) { - - goog.base(this, container, map); - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.context_ = ol.dom.createCanvasContext2D(); - var canvas = this.context_.canvas; - canvas.style.position = 'absolute'; - canvas.style.width = '100%'; - canvas.style.height = '100%'; - canvas.className = ol.css.CLASS_UNSELECTABLE; - goog.dom.insertChildAt(container, canvas, 0); - - /** - * @private - * @type {!goog.vec.Mat4.Number} - */ - this.transform_ = goog.vec.Mat4.createNumber(); - - /** - * @type {!Element} - * @private - */ - this.layersPane_ = goog.dom.createElement('DIV'); - this.layersPane_.className = ol.css.CLASS_UNSELECTABLE; - var style = this.layersPane_.style; - style.position = 'absolute'; - style.width = '100%'; - style.height = '100%'; - - // prevent the img context menu on mobile devices - goog.events.listen(this.layersPane_, goog.events.EventType.TOUCHSTART, - goog.events.Event.preventDefault); - - goog.dom.insertChildAt(container, this.layersPane_, 0); - - /** - * @private - * @type {boolean} - */ - this.renderedVisible_ = true; - -}; -goog.inherits(ol.renderer.dom.Map, ol.renderer.Map); - - -/** - * @inheritDoc - */ -ol.renderer.dom.Map.prototype.disposeInternal = function() { - goog.dom.removeNode(this.layersPane_); - goog.base(this, 'disposeInternal'); -}; - - -/** - * @inheritDoc - */ -ol.renderer.dom.Map.prototype.createLayerRenderer = function(layer) { - var layerRenderer; - if (ol.ENABLE_IMAGE && layer instanceof ol.layer.Image) { - layerRenderer = new ol.renderer.dom.ImageLayer(layer); - } else if (ol.ENABLE_TILE && layer instanceof ol.layer.Tile) { - layerRenderer = new ol.renderer.dom.TileLayer(layer); - } else if (ol.ENABLE_VECTOR && layer instanceof ol.layer.Vector) { - layerRenderer = new ol.renderer.dom.VectorLayer(layer); - } else { - goog.asserts.fail('unexpected layer configuration'); - return null; - } - return layerRenderer; -}; - - -/** - * @param {ol.render.EventType} type Event type. - * @param {olx.FrameState} frameState Frame state. - * @private - */ -ol.renderer.dom.Map.prototype.dispatchComposeEvent_ = - function(type, frameState) { - var map = this.getMap(); - if (map.hasListener(type)) { - var extent = frameState.extent; - var pixelRatio = frameState.pixelRatio; - var viewState = frameState.viewState; - var rotation = viewState.rotation; - var context = this.context_; - var canvas = context.canvas; - - ol.vec.Mat4.makeTransform2D(this.transform_, - canvas.width / 2, - canvas.height / 2, - pixelRatio / viewState.resolution, - -pixelRatio / viewState.resolution, - -viewState.rotation, - -viewState.center[0], -viewState.center[1]); - var vectorContext = new ol.render.canvas.Immediate(context, pixelRatio, - extent, this.transform_, rotation); - var composeEvent = new ol.render.Event(type, map, vectorContext, - frameState, context, null); - map.dispatchEvent(composeEvent); - vectorContext.flush(); - } -}; - - -/** - * @inheritDoc - */ -ol.renderer.dom.Map.prototype.getType = function() { - return ol.RendererType.DOM; -}; - - -/** - * @inheritDoc - */ -ol.renderer.dom.Map.prototype.renderFrame = function(frameState) { - - if (!frameState) { - if (this.renderedVisible_) { - goog.style.setElementShown(this.layersPane_, false); - this.renderedVisible_ = false; - } - return; - } - - var map = this.getMap(); - if (map.hasListener(ol.render.EventType.PRECOMPOSE) || - map.hasListener(ol.render.EventType.POSTCOMPOSE)) { - var canvas = this.context_.canvas; - var pixelRatio = frameState.pixelRatio; - canvas.width = frameState.size[0] * pixelRatio; - canvas.height = frameState.size[1] * pixelRatio; - } - - this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, frameState); - - var layerStatesArray = frameState.layerStatesArray; - goog.array.stableSort(layerStatesArray, ol.renderer.Map.sortByZIndex); - - var viewResolution = frameState.viewState.resolution; - var i, ii, layer, layerRenderer, layerState; - for (i = 0, ii = layerStatesArray.length; i < ii; ++i) { - layerState = layerStatesArray[i]; - layer = layerState.layer; - layerRenderer = /** @type {ol.renderer.dom.Layer} */ ( - this.getLayerRenderer(layer)); - goog.asserts.assertInstanceof(layerRenderer, ol.renderer.dom.Layer, - 'renderer is an instance of ol.renderer.dom.Layer'); - goog.dom.insertChildAt(this.layersPane_, layerRenderer.getTarget(), i); - if (ol.layer.Layer.visibleAtResolution(layerState, viewResolution) && - layerState.sourceState == ol.source.State.READY) { - if (layerRenderer.prepareFrame(frameState, layerState)) { - layerRenderer.composeFrame(frameState, layerState); - } - } else { - layerRenderer.clearFrame(); - } - } - - var layerStates = frameState.layerStates; - var layerKey; - for (layerKey in this.getLayerRenderers()) { - if (!(layerKey in layerStates)) { - layerRenderer = this.getLayerRendererByKey(layerKey); - goog.asserts.assertInstanceof(layerRenderer, ol.renderer.dom.Layer, - 'renderer is an instance of ol.renderer.dom.Layer'); - goog.dom.removeNode(layerRenderer.getTarget()); - } - } - - if (!this.renderedVisible_) { - goog.style.setElementShown(this.layersPane_, true); - this.renderedVisible_ = true; - } - - this.calculateMatrices2D(frameState); - this.scheduleRemoveUnusedLayerRenderers(frameState); - this.scheduleExpireIconCache(frameState); - - this.dispatchComposeEvent_(ol.render.EventType.POSTCOMPOSE, frameState); -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/** - * @fileoverview Constants used by the WebGL rendering, including all of the - * constants used from the WebGL context. For example, instead of using - * context.ARRAY_BUFFER, your code can use - * goog.webgl.ARRAY_BUFFER. The benefits for doing this include allowing - * the compiler to optimize your code so that the compiled code does not have to - * contain large strings to reference these properties, and reducing runtime - * property access. - * - * Values are taken from the WebGL Spec: - * https://www.khronos.org/registry/webgl/specs/1.0/#WEBGLRENDERINGCONTEXT - */ - -goog.provide('goog.webgl'); - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_BUFFER_BIT = 0x00000100; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BUFFER_BIT = 0x00000400; - - -/** - * @const - * @type {number} - */ -goog.webgl.COLOR_BUFFER_BIT = 0x00004000; - - -/** - * @const - * @type {number} - */ -goog.webgl.POINTS = 0x0000; - - -/** - * @const - * @type {number} - */ -goog.webgl.LINES = 0x0001; - - -/** - * @const - * @type {number} - */ -goog.webgl.LINE_LOOP = 0x0002; - - -/** - * @const - * @type {number} - */ -goog.webgl.LINE_STRIP = 0x0003; - - -/** - * @const - * @type {number} - */ -goog.webgl.TRIANGLES = 0x0004; - - -/** - * @const - * @type {number} - */ -goog.webgl.TRIANGLE_STRIP = 0x0005; - - -/** - * @const - * @type {number} - */ -goog.webgl.TRIANGLE_FAN = 0x0006; - - -/** - * @const - * @type {number} - */ -goog.webgl.ZERO = 0; - - -/** - * @const - * @type {number} - */ -goog.webgl.ONE = 1; - - -/** - * @const - * @type {number} - */ -goog.webgl.SRC_COLOR = 0x0300; - - -/** - * @const - * @type {number} - */ -goog.webgl.ONE_MINUS_SRC_COLOR = 0x0301; - - -/** - * @const - * @type {number} - */ -goog.webgl.SRC_ALPHA = 0x0302; - - -/** - * @const - * @type {number} - */ -goog.webgl.ONE_MINUS_SRC_ALPHA = 0x0303; - - -/** - * @const - * @type {number} - */ -goog.webgl.DST_ALPHA = 0x0304; - - -/** - * @const - * @type {number} - */ -goog.webgl.ONE_MINUS_DST_ALPHA = 0x0305; - - -/** - * @const - * @type {number} - */ -goog.webgl.DST_COLOR = 0x0306; - - -/** - * @const - * @type {number} - */ -goog.webgl.ONE_MINUS_DST_COLOR = 0x0307; - - -/** - * @const - * @type {number} - */ -goog.webgl.SRC_ALPHA_SATURATE = 0x0308; - - -/** - * @const - * @type {number} - */ -goog.webgl.FUNC_ADD = 0x8006; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLEND_EQUATION = 0x8009; - - -/** - * Same as BLEND_EQUATION - * @const - * @type {number} - */ -goog.webgl.BLEND_EQUATION_RGB = 0x8009; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLEND_EQUATION_ALPHA = 0x883D; - - -/** - * @const - * @type {number} - */ -goog.webgl.FUNC_SUBTRACT = 0x800A; - - -/** - * @const - * @type {number} - */ -goog.webgl.FUNC_REVERSE_SUBTRACT = 0x800B; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLEND_DST_RGB = 0x80C8; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLEND_SRC_RGB = 0x80C9; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLEND_DST_ALPHA = 0x80CA; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLEND_SRC_ALPHA = 0x80CB; - - -/** - * @const - * @type {number} - */ -goog.webgl.CONSTANT_COLOR = 0x8001; - - -/** - * @const - * @type {number} - */ -goog.webgl.ONE_MINUS_CONSTANT_COLOR = 0x8002; - - -/** - * @const - * @type {number} - */ -goog.webgl.CONSTANT_ALPHA = 0x8003; - - -/** - * @const - * @type {number} - */ -goog.webgl.ONE_MINUS_CONSTANT_ALPHA = 0x8004; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLEND_COLOR = 0x8005; - - -/** - * @const - * @type {number} - */ -goog.webgl.ARRAY_BUFFER = 0x8892; - - -/** - * @const - * @type {number} - */ -goog.webgl.ELEMENT_ARRAY_BUFFER = 0x8893; - - -/** - * @const - * @type {number} - */ -goog.webgl.ARRAY_BUFFER_BINDING = 0x8894; - - -/** - * @const - * @type {number} - */ -goog.webgl.ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; - - -/** - * @const - * @type {number} - */ -goog.webgl.STREAM_DRAW = 0x88E0; - - -/** - * @const - * @type {number} - */ -goog.webgl.STATIC_DRAW = 0x88E4; - - -/** - * @const - * @type {number} - */ -goog.webgl.DYNAMIC_DRAW = 0x88E8; - - -/** - * @const - * @type {number} - */ -goog.webgl.BUFFER_SIZE = 0x8764; - - -/** - * @const - * @type {number} - */ -goog.webgl.BUFFER_USAGE = 0x8765; - - -/** - * @const - * @type {number} - */ -goog.webgl.CURRENT_VERTEX_ATTRIB = 0x8626; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRONT = 0x0404; - - -/** - * @const - * @type {number} - */ -goog.webgl.BACK = 0x0405; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRONT_AND_BACK = 0x0408; - - -/** - * @const - * @type {number} - */ -goog.webgl.CULL_FACE = 0x0B44; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLEND = 0x0BE2; - - -/** - * @const - * @type {number} - */ -goog.webgl.DITHER = 0x0BD0; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_TEST = 0x0B90; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_TEST = 0x0B71; - - -/** - * @const - * @type {number} - */ -goog.webgl.SCISSOR_TEST = 0x0C11; - - -/** - * @const - * @type {number} - */ -goog.webgl.POLYGON_OFFSET_FILL = 0x8037; - - -/** - * @const - * @type {number} - */ -goog.webgl.SAMPLE_ALPHA_TO_COVERAGE = 0x809E; - - -/** - * @const - * @type {number} - */ -goog.webgl.SAMPLE_COVERAGE = 0x80A0; - - -/** - * @const - * @type {number} - */ -goog.webgl.NO_ERROR = 0; - - -/** - * @const - * @type {number} - */ -goog.webgl.INVALID_ENUM = 0x0500; - - -/** - * @const - * @type {number} - */ -goog.webgl.INVALID_VALUE = 0x0501; - - -/** - * @const - * @type {number} - */ -goog.webgl.INVALID_OPERATION = 0x0502; - - -/** - * @const - * @type {number} - */ -goog.webgl.OUT_OF_MEMORY = 0x0505; - - -/** - * @const - * @type {number} - */ -goog.webgl.CW = 0x0900; - - -/** - * @const - * @type {number} - */ -goog.webgl.CCW = 0x0901; - - -/** - * @const - * @type {number} - */ -goog.webgl.LINE_WIDTH = 0x0B21; - - -/** - * @const - * @type {number} - */ -goog.webgl.ALIASED_POINT_SIZE_RANGE = 0x846D; - - -/** - * @const - * @type {number} - */ -goog.webgl.ALIASED_LINE_WIDTH_RANGE = 0x846E; - - -/** - * @const - * @type {number} - */ -goog.webgl.CULL_FACE_MODE = 0x0B45; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRONT_FACE = 0x0B46; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_RANGE = 0x0B70; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_WRITEMASK = 0x0B72; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_CLEAR_VALUE = 0x0B73; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_FUNC = 0x0B74; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_CLEAR_VALUE = 0x0B91; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_FUNC = 0x0B92; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_FAIL = 0x0B94; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_PASS_DEPTH_FAIL = 0x0B95; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_PASS_DEPTH_PASS = 0x0B96; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_REF = 0x0B97; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_VALUE_MASK = 0x0B93; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_WRITEMASK = 0x0B98; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BACK_FUNC = 0x8800; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BACK_FAIL = 0x8801; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BACK_REF = 0x8CA3; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BACK_VALUE_MASK = 0x8CA4; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BACK_WRITEMASK = 0x8CA5; - - -/** - * @const - * @type {number} - */ -goog.webgl.VIEWPORT = 0x0BA2; - - -/** - * @const - * @type {number} - */ -goog.webgl.SCISSOR_BOX = 0x0C10; - - -/** - * @const - * @type {number} - */ -goog.webgl.COLOR_CLEAR_VALUE = 0x0C22; - - -/** - * @const - * @type {number} - */ -goog.webgl.COLOR_WRITEMASK = 0x0C23; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNPACK_ALIGNMENT = 0x0CF5; - - -/** - * @const - * @type {number} - */ -goog.webgl.PACK_ALIGNMENT = 0x0D05; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_TEXTURE_SIZE = 0x0D33; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_VIEWPORT_DIMS = 0x0D3A; - - -/** - * @const - * @type {number} - */ -goog.webgl.SUBPIXEL_BITS = 0x0D50; - - -/** - * @const - * @type {number} - */ -goog.webgl.RED_BITS = 0x0D52; - - -/** - * @const - * @type {number} - */ -goog.webgl.GREEN_BITS = 0x0D53; - - -/** - * @const - * @type {number} - */ -goog.webgl.BLUE_BITS = 0x0D54; - - -/** - * @const - * @type {number} - */ -goog.webgl.ALPHA_BITS = 0x0D55; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_BITS = 0x0D56; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_BITS = 0x0D57; - - -/** - * @const - * @type {number} - */ -goog.webgl.POLYGON_OFFSET_UNITS = 0x2A00; - - -/** - * @const - * @type {number} - */ -goog.webgl.POLYGON_OFFSET_FACTOR = 0x8038; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_BINDING_2D = 0x8069; - - -/** - * @const - * @type {number} - */ -goog.webgl.SAMPLE_BUFFERS = 0x80A8; - - -/** - * @const - * @type {number} - */ -goog.webgl.SAMPLES = 0x80A9; - - -/** - * @const - * @type {number} - */ -goog.webgl.SAMPLE_COVERAGE_VALUE = 0x80AA; - - -/** - * @const - * @type {number} - */ -goog.webgl.SAMPLE_COVERAGE_INVERT = 0x80AB; - - -/** - * @const - * @type {number} - */ -goog.webgl.COMPRESSED_TEXTURE_FORMATS = 0x86A3; - - -/** - * @const - * @type {number} - */ -goog.webgl.DONT_CARE = 0x1100; - - -/** - * @const - * @type {number} - */ -goog.webgl.FASTEST = 0x1101; - - -/** - * @const - * @type {number} - */ -goog.webgl.NICEST = 0x1102; - - -/** - * @const - * @type {number} - */ -goog.webgl.GENERATE_MIPMAP_HINT = 0x8192; - - -/** - * @const - * @type {number} - */ -goog.webgl.BYTE = 0x1400; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNSIGNED_BYTE = 0x1401; - - -/** - * @const - * @type {number} - */ -goog.webgl.SHORT = 0x1402; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNSIGNED_SHORT = 0x1403; - - -/** - * @const - * @type {number} - */ -goog.webgl.INT = 0x1404; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNSIGNED_INT = 0x1405; - - -/** - * @const - * @type {number} - */ -goog.webgl.FLOAT = 0x1406; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_COMPONENT = 0x1902; - - -/** - * @const - * @type {number} - */ -goog.webgl.ALPHA = 0x1906; - - -/** - * @const - * @type {number} - */ -goog.webgl.RGB = 0x1907; - - -/** - * @const - * @type {number} - */ -goog.webgl.RGBA = 0x1908; - - -/** - * @const - * @type {number} - */ -goog.webgl.LUMINANCE = 0x1909; - - -/** - * @const - * @type {number} - */ -goog.webgl.LUMINANCE_ALPHA = 0x190A; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNSIGNED_SHORT_4_4_4_4 = 0x8033; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNSIGNED_SHORT_5_5_5_1 = 0x8034; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNSIGNED_SHORT_5_6_5 = 0x8363; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAGMENT_SHADER = 0x8B30; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERTEX_SHADER = 0x8B31; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_VERTEX_ATTRIBS = 0x8869; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_VARYING_VECTORS = 0x8DFC; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_TEXTURE_IMAGE_UNITS = 0x8872; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; - - -/** - * @const - * @type {number} - */ -goog.webgl.SHADER_TYPE = 0x8B4F; - - -/** - * @const - * @type {number} - */ -goog.webgl.DELETE_STATUS = 0x8B80; - - -/** - * @const - * @type {number} - */ -goog.webgl.LINK_STATUS = 0x8B82; - - -/** - * @const - * @type {number} - */ -goog.webgl.VALIDATE_STATUS = 0x8B83; - - -/** - * @const - * @type {number} - */ -goog.webgl.ATTACHED_SHADERS = 0x8B85; - - -/** - * @const - * @type {number} - */ -goog.webgl.ACTIVE_UNIFORMS = 0x8B86; - - -/** - * @const - * @type {number} - */ -goog.webgl.ACTIVE_ATTRIBUTES = 0x8B89; - - -/** - * @const - * @type {number} - */ -goog.webgl.SHADING_LANGUAGE_VERSION = 0x8B8C; - - -/** - * @const - * @type {number} - */ -goog.webgl.CURRENT_PROGRAM = 0x8B8D; - - -/** - * @const - * @type {number} - */ -goog.webgl.NEVER = 0x0200; - - -/** - * @const - * @type {number} - */ -goog.webgl.LESS = 0x0201; - - -/** - * @const - * @type {number} - */ -goog.webgl.EQUAL = 0x0202; - - -/** - * @const - * @type {number} - */ -goog.webgl.LEQUAL = 0x0203; - - -/** - * @const - * @type {number} - */ -goog.webgl.GREATER = 0x0204; - - -/** - * @const - * @type {number} - */ -goog.webgl.NOTEQUAL = 0x0205; - - -/** - * @const - * @type {number} - */ -goog.webgl.GEQUAL = 0x0206; - - -/** - * @const - * @type {number} - */ -goog.webgl.ALWAYS = 0x0207; - - -/** - * @const - * @type {number} - */ -goog.webgl.KEEP = 0x1E00; - - -/** - * @const - * @type {number} - */ -goog.webgl.REPLACE = 0x1E01; - - -/** - * @const - * @type {number} - */ -goog.webgl.INCR = 0x1E02; - - -/** - * @const - * @type {number} - */ -goog.webgl.DECR = 0x1E03; - - -/** - * @const - * @type {number} - */ -goog.webgl.INVERT = 0x150A; - - -/** - * @const - * @type {number} - */ -goog.webgl.INCR_WRAP = 0x8507; - - -/** - * @const - * @type {number} - */ -goog.webgl.DECR_WRAP = 0x8508; - - -/** - * @const - * @type {number} - */ -goog.webgl.VENDOR = 0x1F00; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERER = 0x1F01; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERSION = 0x1F02; - - -/** - * @const - * @type {number} - */ -goog.webgl.NEAREST = 0x2600; - - -/** - * @const - * @type {number} - */ -goog.webgl.LINEAR = 0x2601; - - -/** - * @const - * @type {number} - */ -goog.webgl.NEAREST_MIPMAP_NEAREST = 0x2700; - - -/** - * @const - * @type {number} - */ -goog.webgl.LINEAR_MIPMAP_NEAREST = 0x2701; - - -/** - * @const - * @type {number} - */ -goog.webgl.NEAREST_MIPMAP_LINEAR = 0x2702; - - -/** - * @const - * @type {number} - */ -goog.webgl.LINEAR_MIPMAP_LINEAR = 0x2703; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_MAG_FILTER = 0x2800; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_MIN_FILTER = 0x2801; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_WRAP_S = 0x2802; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_WRAP_T = 0x2803; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_2D = 0x0DE1; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE = 0x1702; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_CUBE_MAP = 0x8513; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_BINDING_CUBE_MAP = 0x8514; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE0 = 0x84C0; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE1 = 0x84C1; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE2 = 0x84C2; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE3 = 0x84C3; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE4 = 0x84C4; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE5 = 0x84C5; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE6 = 0x84C6; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE7 = 0x84C7; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE8 = 0x84C8; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE9 = 0x84C9; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE10 = 0x84CA; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE11 = 0x84CB; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE12 = 0x84CC; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE13 = 0x84CD; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE14 = 0x84CE; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE15 = 0x84CF; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE16 = 0x84D0; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE17 = 0x84D1; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE18 = 0x84D2; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE19 = 0x84D3; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE20 = 0x84D4; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE21 = 0x84D5; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE22 = 0x84D6; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE23 = 0x84D7; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE24 = 0x84D8; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE25 = 0x84D9; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE26 = 0x84DA; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE27 = 0x84DB; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE28 = 0x84DC; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE29 = 0x84DD; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE30 = 0x84DE; - - -/** - * @const - * @type {number} - */ -goog.webgl.TEXTURE31 = 0x84DF; - - -/** - * @const - * @type {number} - */ -goog.webgl.ACTIVE_TEXTURE = 0x84E0; - - -/** - * @const - * @type {number} - */ -goog.webgl.REPEAT = 0x2901; - - -/** - * @const - * @type {number} - */ -goog.webgl.CLAMP_TO_EDGE = 0x812F; - - -/** - * @const - * @type {number} - */ -goog.webgl.MIRRORED_REPEAT = 0x8370; - - -/** - * @const - * @type {number} - */ -goog.webgl.FLOAT_VEC2 = 0x8B50; - - -/** - * @const - * @type {number} - */ -goog.webgl.FLOAT_VEC3 = 0x8B51; - - -/** - * @const - * @type {number} - */ -goog.webgl.FLOAT_VEC4 = 0x8B52; - - -/** - * @const - * @type {number} - */ -goog.webgl.INT_VEC2 = 0x8B53; - - -/** - * @const - * @type {number} - */ -goog.webgl.INT_VEC3 = 0x8B54; - - -/** - * @const - * @type {number} - */ -goog.webgl.INT_VEC4 = 0x8B55; - - -/** - * @const - * @type {number} - */ -goog.webgl.BOOL = 0x8B56; - - -/** - * @const - * @type {number} - */ -goog.webgl.BOOL_VEC2 = 0x8B57; - - -/** - * @const - * @type {number} - */ -goog.webgl.BOOL_VEC3 = 0x8B58; - - -/** - * @const - * @type {number} - */ -goog.webgl.BOOL_VEC4 = 0x8B59; - - -/** - * @const - * @type {number} - */ -goog.webgl.FLOAT_MAT2 = 0x8B5A; - - -/** - * @const - * @type {number} - */ -goog.webgl.FLOAT_MAT3 = 0x8B5B; - - -/** - * @const - * @type {number} - */ -goog.webgl.FLOAT_MAT4 = 0x8B5C; - - -/** - * @const - * @type {number} - */ -goog.webgl.SAMPLER_2D = 0x8B5E; - - -/** - * @const - * @type {number} - */ -goog.webgl.SAMPLER_CUBE = 0x8B60; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; - - -/** - * @const - * @type {number} - */ -goog.webgl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; - - -/** - * @const - * @type {number} - */ -goog.webgl.COMPILE_STATUS = 0x8B81; - - -/** - * @const - * @type {number} - */ -goog.webgl.LOW_FLOAT = 0x8DF0; - - -/** - * @const - * @type {number} - */ -goog.webgl.MEDIUM_FLOAT = 0x8DF1; - - -/** - * @const - * @type {number} - */ -goog.webgl.HIGH_FLOAT = 0x8DF2; - - -/** - * @const - * @type {number} - */ -goog.webgl.LOW_INT = 0x8DF3; - - -/** - * @const - * @type {number} - */ -goog.webgl.MEDIUM_INT = 0x8DF4; - - -/** - * @const - * @type {number} - */ -goog.webgl.HIGH_INT = 0x8DF5; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER = 0x8D40; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER = 0x8D41; - - -/** - * @const - * @type {number} - */ -goog.webgl.RGBA4 = 0x8056; - - -/** - * @const - * @type {number} - */ -goog.webgl.RGB5_A1 = 0x8057; - - -/** - * @const - * @type {number} - */ -goog.webgl.RGB565 = 0x8D62; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_COMPONENT16 = 0x81A5; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_INDEX = 0x1901; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_INDEX8 = 0x8D48; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_STENCIL = 0x84F9; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_WIDTH = 0x8D42; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_HEIGHT = 0x8D43; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_RED_SIZE = 0x8D50; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_GREEN_SIZE = 0x8D51; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_BLUE_SIZE = 0x8D52; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_ALPHA_SIZE = 0x8D53; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_DEPTH_SIZE = 0x8D54; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_STENCIL_SIZE = 0x8D55; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; - - -/** - * @const - * @type {number} - */ -goog.webgl.COLOR_ATTACHMENT0 = 0x8CE0; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_ATTACHMENT = 0x8D00; - - -/** - * @const - * @type {number} - */ -goog.webgl.STENCIL_ATTACHMENT = 0x8D20; - - -/** - * @const - * @type {number} - */ -goog.webgl.DEPTH_STENCIL_ATTACHMENT = 0x821A; - - -/** - * @const - * @type {number} - */ -goog.webgl.NONE = 0; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_COMPLETE = 0x8CD5; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_UNSUPPORTED = 0x8CDD; - - -/** - * @const - * @type {number} - */ -goog.webgl.FRAMEBUFFER_BINDING = 0x8CA6; - - -/** - * @const - * @type {number} - */ -goog.webgl.RENDERBUFFER_BINDING = 0x8CA7; - - -/** - * @const - * @type {number} - */ -goog.webgl.MAX_RENDERBUFFER_SIZE = 0x84E8; - - -/** - * @const - * @type {number} - */ -goog.webgl.INVALID_FRAMEBUFFER_OPERATION = 0x0506; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNPACK_FLIP_Y_WEBGL = 0x9240; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; - - -/** - * @const - * @type {number} - */ -goog.webgl.CONTEXT_LOST_WEBGL = 0x9242; - - -/** - * @const - * @type {number} - */ -goog.webgl.UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; - - -/** - * @const - * @type {number} - */ -goog.webgl.BROWSER_DEFAULT_WEBGL = 0x9244; - - -/** - * From the OES_texture_half_float extension. - * http://www.khronos.org/registry/webgl/extensions/OES_texture_half_float/ - * @const - * @type {number} - */ -goog.webgl.HALF_FLOAT_OES = 0x8D61; - - -/** - * From the OES_standard_derivatives extension. - * http://www.khronos.org/registry/webgl/extensions/OES_standard_derivatives/ - * @const - * @type {number} - */ -goog.webgl.FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; - - -/** - * From the OES_vertex_array_object extension. - * http://www.khronos.org/registry/webgl/extensions/OES_vertex_array_object/ - * @const - * @type {number} - */ -goog.webgl.VERTEX_ARRAY_BINDING_OES = 0x85B5; - - -/** - * From the WEBGL_debug_renderer_info extension. - * http://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/ - * @const - * @type {number} - */ -goog.webgl.UNMASKED_VENDOR_WEBGL = 0x9245; - - -/** - * From the WEBGL_debug_renderer_info extension. - * http://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/ - * @const - * @type {number} - */ -goog.webgl.UNMASKED_RENDERER_WEBGL = 0x9246; - - -/** - * From the WEBGL_compressed_texture_s3tc extension. - * http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ - * @const - * @type {number} - */ -goog.webgl.COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; - - -/** - * From the WEBGL_compressed_texture_s3tc extension. - * http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ - * @const - * @type {number} - */ -goog.webgl.COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; - - -/** - * From the WEBGL_compressed_texture_s3tc extension. - * http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ - * @const - * @type {number} - */ -goog.webgl.COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; - - -/** - * From the WEBGL_compressed_texture_s3tc extension. - * http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ - * @const - * @type {number} - */ -goog.webgl.COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; - - -/** - * From the EXT_texture_filter_anisotropic extension. - * http://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotropic/ - * @const - * @type {number} - */ -goog.webgl.TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; - - -/** - * From the EXT_texture_filter_anisotropic extension. - * http://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotropic/ - * @const - * @type {number} - */ -goog.webgl.MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; - -goog.provide('ol.webgl.Fragment'); -goog.provide('ol.webgl.Shader'); -goog.provide('ol.webgl.Vertex'); -goog.provide('ol.webgl.shader'); - -goog.require('goog.functions'); -goog.require('goog.webgl'); -goog.require('ol.webgl'); - - - -/** - * @constructor - * @param {string} source Source. - * @struct - */ -ol.webgl.Shader = function(source) { - - /** - * @private - * @type {string} - */ - this.source_ = source; - -}; - - -/** - * @return {number} Type. - */ -ol.webgl.Shader.prototype.getType = goog.abstractMethod; - - -/** - * @return {string} Source. - */ -ol.webgl.Shader.prototype.getSource = function() { - return this.source_; -}; - - -/** - * @return {boolean} Is animated? - */ -ol.webgl.Shader.prototype.isAnimated = goog.functions.FALSE; - - - -/** - * @constructor - * @extends {ol.webgl.Shader} - * @param {string} source Source. - * @struct - */ -ol.webgl.shader.Fragment = function(source) { - goog.base(this, source); -}; -goog.inherits(ol.webgl.shader.Fragment, ol.webgl.Shader); - - -/** - * @inheritDoc - */ -ol.webgl.shader.Fragment.prototype.getType = function() { - return goog.webgl.FRAGMENT_SHADER; -}; - - - -/** - * @constructor - * @extends {ol.webgl.Shader} - * @param {string} source Source. - * @struct - */ -ol.webgl.shader.Vertex = function(source) { - goog.base(this, source); -}; -goog.inherits(ol.webgl.shader.Vertex, ol.webgl.Shader); - - -/** - * @inheritDoc - */ -ol.webgl.shader.Vertex.prototype.getType = function() { - return goog.webgl.VERTEX_SHADER; -}; - -// This file is automatically generated, do not edit -goog.provide('ol.render.webgl.imagereplay.shader.Default'); -goog.provide('ol.render.webgl.imagereplay.shader.Default.Locations'); -goog.provide('ol.render.webgl.imagereplay.shader.DefaultFragment'); -goog.provide('ol.render.webgl.imagereplay.shader.DefaultVertex'); - -goog.require('ol.webgl.shader'); - - - -/** - * @constructor - * @extends {ol.webgl.shader.Fragment} - * @struct - */ -ol.render.webgl.imagereplay.shader.DefaultFragment = function() { - goog.base(this, ol.render.webgl.imagereplay.shader.DefaultFragment.SOURCE); -}; -goog.inherits(ol.render.webgl.imagereplay.shader.DefaultFragment, ol.webgl.shader.Fragment); -goog.addSingletonGetter(ol.render.webgl.imagereplay.shader.DefaultFragment); - - -/** - * @const - * @type {string} - */ -ol.render.webgl.imagereplay.shader.DefaultFragment.DEBUG_SOURCE = 'precision mediump float;\nvarying vec2 v_texCoord;\nvarying float v_opacity;\n\nuniform float u_opacity;\nuniform sampler2D u_image;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n float alpha = texColor.a * v_opacity * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n'; - - -/** - * @const - * @type {string} - */ -ol.render.webgl.imagereplay.shader.DefaultFragment.OPTIMIZED_SOURCE = 'precision mediump float;varying vec2 a;varying float b;uniform float k;uniform sampler2D l;void main(void){vec4 texColor=texture2D(l,a);gl_FragColor.rgb=texColor.rgb;float alpha=texColor.a*b*k;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}'; - - -/** - * @const - * @type {string} - */ -ol.render.webgl.imagereplay.shader.DefaultFragment.SOURCE = goog.DEBUG ? - ol.render.webgl.imagereplay.shader.DefaultFragment.DEBUG_SOURCE : - ol.render.webgl.imagereplay.shader.DefaultFragment.OPTIMIZED_SOURCE; - - - -/** - * @constructor - * @extends {ol.webgl.shader.Vertex} - * @struct - */ -ol.render.webgl.imagereplay.shader.DefaultVertex = function() { - goog.base(this, ol.render.webgl.imagereplay.shader.DefaultVertex.SOURCE); -}; -goog.inherits(ol.render.webgl.imagereplay.shader.DefaultVertex, ol.webgl.shader.Vertex); -goog.addSingletonGetter(ol.render.webgl.imagereplay.shader.DefaultVertex); - - -/** - * @const - * @type {string} - */ -ol.render.webgl.imagereplay.shader.DefaultVertex.DEBUG_SOURCE = 'varying vec2 v_texCoord;\nvarying float v_opacity;\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec2 a_offsets;\nattribute float a_opacity;\nattribute float a_rotateWithView;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n if (a_rotateWithView == 1.0) {\n offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n }\n vec4 offsets = offsetMatrix * vec4(a_offsets, 0., 0.);\n gl_Position = u_projectionMatrix * vec4(a_position, 0., 1.) + offsets;\n v_texCoord = a_texCoord;\n v_opacity = a_opacity;\n}\n\n\n'; - - -/** - * @const - * @type {string} - */ -ol.render.webgl.imagereplay.shader.DefaultVertex.OPTIMIZED_SOURCE = 'varying vec2 a;varying float b;attribute vec2 c;attribute vec2 d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;void main(void){mat4 offsetMatrix=i;if(g==1.0){offsetMatrix=i*j;}vec4 offsets=offsetMatrix*vec4(e,0.,0.);gl_Position=h*vec4(c,0.,1.)+offsets;a=d;b=f;}'; - - -/** - * @const - * @type {string} - */ -ol.render.webgl.imagereplay.shader.DefaultVertex.SOURCE = goog.DEBUG ? - ol.render.webgl.imagereplay.shader.DefaultVertex.DEBUG_SOURCE : - ol.render.webgl.imagereplay.shader.DefaultVertex.OPTIMIZED_SOURCE; - - - -/** - * @constructor - * @param {WebGLRenderingContext} gl GL. - * @param {WebGLProgram} program Program. - * @struct - */ -ol.render.webgl.imagereplay.shader.Default.Locations = function(gl, program) { - - /** - * @type {WebGLUniformLocation} - */ - this.u_image = gl.getUniformLocation( - program, goog.DEBUG ? 'u_image' : 'l'); - - /** - * @type {WebGLUniformLocation} - */ - this.u_offsetRotateMatrix = gl.getUniformLocation( - program, goog.DEBUG ? 'u_offsetRotateMatrix' : 'j'); - - /** - * @type {WebGLUniformLocation} - */ - this.u_offsetScaleMatrix = gl.getUniformLocation( - program, goog.DEBUG ? 'u_offsetScaleMatrix' : 'i'); - - /** - * @type {WebGLUniformLocation} - */ - this.u_opacity = gl.getUniformLocation( - program, goog.DEBUG ? 'u_opacity' : 'k'); - - /** - * @type {WebGLUniformLocation} - */ - this.u_projectionMatrix = gl.getUniformLocation( - program, goog.DEBUG ? 'u_projectionMatrix' : 'h'); - - /** - * @type {number} - */ - this.a_offsets = gl.getAttribLocation( - program, goog.DEBUG ? 'a_offsets' : 'e'); - - /** - * @type {number} - */ - this.a_opacity = gl.getAttribLocation( - program, goog.DEBUG ? 'a_opacity' : 'f'); - - /** - * @type {number} - */ - this.a_position = gl.getAttribLocation( - program, goog.DEBUG ? 'a_position' : 'c'); - - /** - * @type {number} - */ - this.a_rotateWithView = gl.getAttribLocation( - program, goog.DEBUG ? 'a_rotateWithView' : 'g'); - - /** - * @type {number} - */ - this.a_texCoord = gl.getAttribLocation( - program, goog.DEBUG ? 'a_texCoord' : 'd'); -}; - -goog.provide('ol.webgl.Buffer'); - -goog.require('goog.webgl'); -goog.require('ol'); - - -/** - * @enum {number} - */ -ol.webgl.BufferUsage = { - STATIC_DRAW: goog.webgl.STATIC_DRAW, - STREAM_DRAW: goog.webgl.STREAM_DRAW, - DYNAMIC_DRAW: goog.webgl.DYNAMIC_DRAW -}; - - - -/** - * @constructor - * @param {Array.<number>=} opt_arr Array. - * @param {number=} opt_usage Usage. - * @struct - */ -ol.webgl.Buffer = function(opt_arr, opt_usage) { - - /** - * @private - * @type {Array.<number>} - */ - this.arr_ = opt_arr !== undefined ? opt_arr : []; - - /** - * @private - * @type {number} - */ - this.usage_ = opt_usage !== undefined ? - opt_usage : ol.webgl.BufferUsage.STATIC_DRAW; - -}; - - -/** - * @return {Array.<number>} Array. - */ -ol.webgl.Buffer.prototype.getArray = function() { - return this.arr_; -}; - - -/** - * @return {number} Usage. - */ -ol.webgl.Buffer.prototype.getUsage = function() { - return this.usage_; -}; - -goog.provide('ol.webgl.Context'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.log'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.array'); -goog.require('ol.webgl.Buffer'); -goog.require('ol.webgl.WebGLContextEventType'); - - -/** - * @typedef {{buf: ol.webgl.Buffer, - * buffer: WebGLBuffer}} - */ -ol.webgl.BufferCacheEntry; - - - -/** - * @classdesc - * A WebGL context for accessing low-level WebGL capabilities. - * - * @constructor - * @extends {goog.events.EventTarget} - * @param {HTMLCanvasElement} canvas Canvas. - * @param {WebGLRenderingContext} gl GL. - */ -ol.webgl.Context = function(canvas, gl) { - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = canvas; - - /** - * @private - * @type {WebGLRenderingContext} - */ - this.gl_ = gl; - - /** - * @private - * @type {Object.<number, ol.webgl.BufferCacheEntry>} - */ - this.bufferCache_ = {}; - - /** - * @private - * @type {Object.<number, WebGLShader>} - */ - this.shaderCache_ = {}; - - /** - * @private - * @type {Object.<string, WebGLProgram>} - */ - this.programCache_ = {}; - - /** - * @private - * @type {WebGLProgram} - */ - this.currentProgram_ = null; - - /** - * @private - * @type {WebGLFramebuffer} - */ - this.hitDetectionFramebuffer_ = null; - - /** - * @private - * @type {WebGLTexture} - */ - this.hitDetectionTexture_ = null; - - /** - * @private - * @type {WebGLRenderbuffer} - */ - this.hitDetectionRenderbuffer_ = null; - - /** - * @type {boolean} - */ - this.hasOESElementIndexUint = ol.array.includes( - ol.WEBGL_EXTENSIONS, 'OES_element_index_uint'); - - // use the OES_element_index_uint extension if available - if (this.hasOESElementIndexUint) { - var ext = gl.getExtension('OES_element_index_uint'); - goog.asserts.assert(ext, - 'Failed to get extension "OES_element_index_uint"'); - } - - goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.LOST, - this.handleWebGLContextLost, false, this); - goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.RESTORED, - this.handleWebGLContextRestored, false, this); - -}; - - -/** - * Just bind the buffer if it's in the cache. Otherwise create - * the WebGL buffer, bind it, populate it, and add an entry to - * the cache. - * @param {number} target Target. - * @param {ol.webgl.Buffer} buf Buffer. - */ -ol.webgl.Context.prototype.bindBuffer = function(target, buf) { - var gl = this.getGL(); - var arr = buf.getArray(); - var bufferKey = goog.getUid(buf); - if (bufferKey in this.bufferCache_) { - var bufferCacheEntry = this.bufferCache_[bufferKey]; - gl.bindBuffer(target, bufferCacheEntry.buffer); - } else { - var buffer = gl.createBuffer(); - gl.bindBuffer(target, buffer); - goog.asserts.assert(target == goog.webgl.ARRAY_BUFFER || - target == goog.webgl.ELEMENT_ARRAY_BUFFER, - 'target is supposed to be an ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER'); - var /** @type {ArrayBufferView} */ arrayBuffer; - if (target == goog.webgl.ARRAY_BUFFER) { - arrayBuffer = new Float32Array(arr); - } else if (target == goog.webgl.ELEMENT_ARRAY_BUFFER) { - arrayBuffer = this.hasOESElementIndexUint ? - new Uint32Array(arr) : new Uint16Array(arr); - } else { - goog.asserts.fail(); - } - gl.bufferData(target, arrayBuffer, buf.getUsage()); - this.bufferCache_[bufferKey] = { - buf: buf, - buffer: buffer - }; - } -}; - - -/** - * @param {ol.webgl.Buffer} buf Buffer. - */ -ol.webgl.Context.prototype.deleteBuffer = function(buf) { - var gl = this.getGL(); - var bufferKey = goog.getUid(buf); - goog.asserts.assert(bufferKey in this.bufferCache_, - 'attempted to delete uncached buffer'); - var bufferCacheEntry = this.bufferCache_[bufferKey]; - if (!gl.isContextLost()) { - gl.deleteBuffer(bufferCacheEntry.buffer); - } - delete this.bufferCache_[bufferKey]; -}; - - -/** - * @inheritDoc - */ -ol.webgl.Context.prototype.disposeInternal = function() { - var gl = this.getGL(); - if (!gl.isContextLost()) { - goog.object.forEach(this.bufferCache_, function(bufferCacheEntry) { - gl.deleteBuffer(bufferCacheEntry.buffer); - }); - goog.object.forEach(this.programCache_, function(program) { - gl.deleteProgram(program); - }); - goog.object.forEach(this.shaderCache_, function(shader) { - gl.deleteShader(shader); - }); - // delete objects for hit-detection - gl.deleteFramebuffer(this.hitDetectionFramebuffer_); - gl.deleteRenderbuffer(this.hitDetectionRenderbuffer_); - gl.deleteTexture(this.hitDetectionTexture_); - } -}; - - -/** - * @return {HTMLCanvasElement} Canvas. - */ -ol.webgl.Context.prototype.getCanvas = function() { - return this.canvas_; -}; - - -/** - * Get the WebGL rendering context - * @return {WebGLRenderingContext} The rendering context. - * @api - */ -ol.webgl.Context.prototype.getGL = function() { - return this.gl_; -}; - - -/** - * Get the frame buffer for hit detection. - * @return {WebGLFramebuffer} The hit detection frame buffer. - */ -ol.webgl.Context.prototype.getHitDetectionFramebuffer = function() { - if (!this.hitDetectionFramebuffer_) { - this.initHitDetectionFramebuffer_(); - } - return this.hitDetectionFramebuffer_; -}; - - -/** - * Get shader from the cache if it's in the cache. Otherwise, create - * the WebGL shader, compile it, and add entry to cache. - * @param {ol.webgl.Shader} shaderObject Shader object. - * @return {WebGLShader} Shader. - */ -ol.webgl.Context.prototype.getShader = function(shaderObject) { - var shaderKey = goog.getUid(shaderObject); - if (shaderKey in this.shaderCache_) { - return this.shaderCache_[shaderKey]; - } else { - var gl = this.getGL(); - var shader = gl.createShader(shaderObject.getType()); - gl.shaderSource(shader, shaderObject.getSource()); - gl.compileShader(shader); - if (goog.DEBUG) { - if (!gl.getShaderParameter(shader, goog.webgl.COMPILE_STATUS) && - !gl.isContextLost()) { - goog.log.error(this.logger_, gl.getShaderInfoLog(shader)); - } - } - goog.asserts.assert( - gl.getShaderParameter(shader, goog.webgl.COMPILE_STATUS) || - gl.isContextLost(), - 'illegal state, shader not compiled or context lost'); - this.shaderCache_[shaderKey] = shader; - return shader; - } -}; - - -/** - * Get the program from the cache if it's in the cache. Otherwise create - * the WebGL program, attach the shaders to it, and add an entry to the - * cache. - * @param {ol.webgl.shader.Fragment} fragmentShaderObject Fragment shader. - * @param {ol.webgl.shader.Vertex} vertexShaderObject Vertex shader. - * @return {WebGLProgram} Program. - */ -ol.webgl.Context.prototype.getProgram = function( - fragmentShaderObject, vertexShaderObject) { - var programKey = - goog.getUid(fragmentShaderObject) + '/' + goog.getUid(vertexShaderObject); - if (programKey in this.programCache_) { - return this.programCache_[programKey]; - } else { - var gl = this.getGL(); - var program = gl.createProgram(); - gl.attachShader(program, this.getShader(fragmentShaderObject)); - gl.attachShader(program, this.getShader(vertexShaderObject)); - gl.linkProgram(program); - if (goog.DEBUG) { - if (!gl.getProgramParameter(program, goog.webgl.LINK_STATUS) && - !gl.isContextLost()) { - goog.log.error(this.logger_, gl.getProgramInfoLog(program)); - } - } - goog.asserts.assert( - gl.getProgramParameter(program, goog.webgl.LINK_STATUS) || - gl.isContextLost(), - 'illegal state, shader not linked or context lost'); - this.programCache_[programKey] = program; - return program; - } -}; - - -/** - * FIXME empy description for jsdoc - */ -ol.webgl.Context.prototype.handleWebGLContextLost = function() { - goog.object.clear(this.bufferCache_); - goog.object.clear(this.shaderCache_); - goog.object.clear(this.programCache_); - this.currentProgram_ = null; - this.hitDetectionFramebuffer_ = null; - this.hitDetectionTexture_ = null; - this.hitDetectionRenderbuffer_ = null; -}; - - -/** - * FIXME empy description for jsdoc - */ -ol.webgl.Context.prototype.handleWebGLContextRestored = function() { -}; - - -/** - * Creates a 1x1 pixel framebuffer for the hit-detection. - * @private - */ -ol.webgl.Context.prototype.initHitDetectionFramebuffer_ = function() { - var gl = this.gl_; - var framebuffer = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - - var texture = ol.webgl.Context.createEmptyTexture(gl, 1, 1); - var renderbuffer = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, 1, 1); - gl.framebufferTexture2D( - gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, - gl.RENDERBUFFER, renderbuffer); - - gl.bindTexture(gl.TEXTURE_2D, null); - gl.bindRenderbuffer(gl.RENDERBUFFER, null); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - - this.hitDetectionFramebuffer_ = framebuffer; - this.hitDetectionTexture_ = texture; - this.hitDetectionRenderbuffer_ = renderbuffer; -}; - - -/** - * Use a program. If the program is already in use, this will return `false`. - * @param {WebGLProgram} program Program. - * @return {boolean} Changed. - * @api - */ -ol.webgl.Context.prototype.useProgram = function(program) { - if (program == this.currentProgram_) { - return false; - } else { - var gl = this.getGL(); - gl.useProgram(program); - this.currentProgram_ = program; - return true; - } -}; - - -/** - * @private - * @type {goog.log.Logger} - */ -ol.webgl.Context.prototype.logger_ = goog.log.getLogger('ol.webgl.Context'); - - -/** - * @param {WebGLRenderingContext} gl WebGL rendering context. - * @param {number=} opt_wrapS wrapS. - * @param {number=} opt_wrapT wrapT. - * @return {WebGLTexture} - * @private - */ -ol.webgl.Context.createTexture_ = function(gl, opt_wrapS, opt_wrapT) { - var texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - - if (opt_wrapS !== undefined) { - gl.texParameteri( - goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_S, opt_wrapS); - } - if (opt_wrapT !== undefined) { - gl.texParameteri( - goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_T, opt_wrapT); - } - - return texture; -}; - - -/** - * @param {WebGLRenderingContext} gl WebGL rendering context. - * @param {number} width Width. - * @param {number} height Height. - * @param {number=} opt_wrapS wrapS. - * @param {number=} opt_wrapT wrapT. - * @return {WebGLTexture} - */ -ol.webgl.Context.createEmptyTexture = function( - gl, width, height, opt_wrapS, opt_wrapT) { - var texture = ol.webgl.Context.createTexture_(gl, opt_wrapS, opt_wrapT); - gl.texImage2D( - gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, - null); - - return texture; -}; - - -/** - * @param {WebGLRenderingContext} gl WebGL rendering context. - * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image. - * @param {number=} opt_wrapS wrapS. - * @param {number=} opt_wrapT wrapT. - * @return {WebGLTexture} - */ -ol.webgl.Context.createTexture = function(gl, image, opt_wrapS, opt_wrapT) { - var texture = ol.webgl.Context.createTexture_(gl, opt_wrapS, opt_wrapT); - gl.texImage2D( - gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - - return texture; -}; - -goog.provide('ol.render.webgl.ImageReplay'); -goog.provide('ol.render.webgl.ReplayGroup'); - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('goog.object'); -goog.require('goog.vec.Mat4'); -goog.require('ol.extent'); -goog.require('ol.render.IReplayGroup'); -goog.require('ol.render.VectorContext'); -goog.require('ol.render.webgl.imagereplay.shader.Default'); -goog.require('ol.render.webgl.imagereplay.shader.Default.Locations'); -goog.require('ol.render.webgl.imagereplay.shader.DefaultFragment'); -goog.require('ol.render.webgl.imagereplay.shader.DefaultVertex'); -goog.require('ol.vec.Mat4'); -goog.require('ol.webgl.Buffer'); -goog.require('ol.webgl.Context'); - - - -/** - * @constructor - * @extends {ol.render.VectorContext} - * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. - * @protected - * @struct - */ -ol.render.webgl.ImageReplay = function(tolerance, maxExtent) { - goog.base(this); - - /** - * @type {number|undefined} - * @private - */ - this.anchorX_ = undefined; - - /** - * @type {number|undefined} - * @private - */ - this.anchorY_ = undefined; - - /** - * The origin of the coordinate system for the point coordinates sent to - * the GPU. To eliminate jitter caused by precision problems in the GPU - * we use the "Rendering Relative to Eye" technique described in the "3D - * Engine Design for Virtual Globes" book. - * @private - * @type {ol.Coordinate} - */ - this.origin_ = ol.extent.getCenter(maxExtent); - - /** - * @type {Array.<number>} - * @private - */ - this.groupIndices_ = []; - - /** - * @type {Array.<number>} - * @private - */ - this.hitDetectionGroupIndices_ = []; - - /** - * @type {number|undefined} - * @private - */ - this.height_ = undefined; - - /** - * @type {Array.<HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>} - * @private - */ - this.images_ = []; - - /** - * @type {Array.<HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>} - * @private - */ - this.hitDetectionImages_ = []; - - /** - * @type {number|undefined} - * @private - */ - this.imageHeight_ = undefined; - - /** - * @type {number|undefined} - * @private - */ - this.imageWidth_ = undefined; - - /** - * @type {Array.<number>} - * @private - */ - this.indices_ = []; - - /** - * @type {ol.webgl.Buffer} - * @private - */ - this.indicesBuffer_ = null; - - /** - * @private - * @type {ol.render.webgl.imagereplay.shader.Default.Locations} - */ - this.defaultLocations_ = null; - - /** - * @private - * @type {number|undefined} - */ - this.opacity_ = undefined; - - /** - * @type {!goog.vec.Mat4.Number} - * @private - */ - this.offsetRotateMatrix_ = goog.vec.Mat4.createNumberIdentity(); - - /** - * @type {!goog.vec.Mat4.Number} - * @private - */ - this.offsetScaleMatrix_ = goog.vec.Mat4.createNumberIdentity(); - - /** - * @type {number|undefined} - * @private - */ - this.originX_ = undefined; - - /** - * @type {number|undefined} - * @private - */ - this.originY_ = undefined; - - /** - * @type {!goog.vec.Mat4.Number} - * @private - */ - this.projectionMatrix_ = goog.vec.Mat4.createNumberIdentity(); - - /** - * @private - * @type {boolean|undefined} - */ - this.rotateWithView_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.rotation_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.scale_ = undefined; - - /** - * @type {Array.<WebGLTexture>} - * @private - */ - this.textures_ = []; - - /** - * @type {Array.<WebGLTexture>} - * @private - */ - this.hitDetectionTextures_ = []; - - /** - * @type {Array.<number>} - * @private - */ - this.vertices_ = []; - - /** - * @type {ol.webgl.Buffer} - * @private - */ - this.verticesBuffer_ = null; - - /** - * Start index per feature (the index). - * @type {Array.<number>} - * @private - */ - this.startIndices_ = []; - - /** - * Start index per feature (the feature). - * @type {Array.<ol.Feature>} - * @private - */ - this.startIndicesFeature_ = []; - - /** - * @type {number|undefined} - * @private - */ - this.width_ = undefined; -}; -goog.inherits(ol.render.webgl.ImageReplay, ol.render.VectorContext); - - -/** - * @param {ol.webgl.Context} context WebGL context. - * @return {function()} Delete resources function. - */ -ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = - function(context) { - // We only delete our stuff here. The shaders and the program may - // be used by other ImageReplay instances (for other layers). And - // they will be deleted when disposing of the ol.webgl.Context - // object. - goog.asserts.assert(this.verticesBuffer_, - 'verticesBuffer must not be null'); - goog.asserts.assert(this.indicesBuffer_, - 'indicesBuffer must not be null'); - var verticesBuffer = this.verticesBuffer_; - var indicesBuffer = this.indicesBuffer_; - var textures = this.textures_; - var hitDetectionTextures = this.hitDetectionTextures_; - var gl = context.getGL(); - return function() { - if (!gl.isContextLost()) { - var i, ii; - for (i = 0, ii = textures.length; i < ii; ++i) { - gl.deleteTexture(textures[i]); - } - for (i = 0, ii = hitDetectionTextures.length; i < ii; ++i) { - gl.deleteTexture(hitDetectionTextures[i]); - } - } - context.deleteBuffer(verticesBuffer); - context.deleteBuffer(indicesBuffer); - }; -}; - - -/** - * @inheritDoc - */ -ol.render.webgl.ImageReplay.prototype.drawAsync = goog.abstractMethod; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @return {number} My end. - * @private - */ -ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = - function(flatCoordinates, offset, end, stride) { - goog.asserts.assert(this.anchorX_ !== undefined, 'anchorX is defined'); - goog.asserts.assert(this.anchorY_ !== undefined, 'anchorY is defined'); - goog.asserts.assert(this.height_ !== undefined, 'height is defined'); - goog.asserts.assert(this.imageHeight_ !== undefined, - 'imageHeight is defined'); - goog.asserts.assert(this.imageWidth_ !== undefined, 'imageWidth is defined'); - goog.asserts.assert(this.opacity_ !== undefined, 'opacity is defined'); - goog.asserts.assert(this.originX_ !== undefined, 'originX is defined'); - goog.asserts.assert(this.originY_ !== undefined, 'originY is defined'); - goog.asserts.assert(this.rotateWithView_ !== undefined, - 'rotateWithView is defined'); - goog.asserts.assert(this.rotation_ !== undefined, 'rotation is defined'); - goog.asserts.assert(this.scale_ !== undefined, 'scale is defined'); - goog.asserts.assert(this.width_ !== undefined, 'width is defined'); - var anchorX = this.anchorX_; - var anchorY = this.anchorY_; - var height = this.height_; - var imageHeight = this.imageHeight_; - var imageWidth = this.imageWidth_; - var opacity = this.opacity_; - var originX = this.originX_; - var originY = this.originY_; - var rotateWithView = this.rotateWithView_ ? 1.0 : 0.0; - var rotation = this.rotation_; - var scale = this.scale_; - var width = this.width_; - var cos = Math.cos(rotation); - var sin = Math.sin(rotation); - var numIndices = this.indices_.length; - var numVertices = this.vertices_.length; - var i, n, offsetX, offsetY, x, y; - for (i = offset; i < end; i += stride) { - x = flatCoordinates[i] - this.origin_[0]; - y = flatCoordinates[i + 1] - this.origin_[1]; - - // There are 4 vertices per [x, y] point, one for each corner of the - // rectangle we're going to draw. We'd use 1 vertex per [x, y] point if - // WebGL supported Geometry Shaders (which can emit new vertices), but that - // is not currently the case. - // - // And each vertex includes 8 values: the x and y coordinates, the x and - // y offsets used to calculate the position of the corner, the u and - // v texture coordinates for the corner, the opacity, and whether the - // the image should be rotated with the view (rotateWithView). - - n = numVertices / 8; - - // bottom-left corner - offsetX = -scale * anchorX; - offsetY = -scale * (height - anchorY); - this.vertices_[numVertices++] = x; - this.vertices_[numVertices++] = y; - this.vertices_[numVertices++] = offsetX * cos - offsetY * sin; - this.vertices_[numVertices++] = offsetX * sin + offsetY * cos; - this.vertices_[numVertices++] = originX / imageWidth; - this.vertices_[numVertices++] = (originY + height) / imageHeight; - this.vertices_[numVertices++] = opacity; - this.vertices_[numVertices++] = rotateWithView; - - // bottom-right corner - offsetX = scale * (width - anchorX); - offsetY = -scale * (height - anchorY); - this.vertices_[numVertices++] = x; - this.vertices_[numVertices++] = y; - this.vertices_[numVertices++] = offsetX * cos - offsetY * sin; - this.vertices_[numVertices++] = offsetX * sin + offsetY * cos; - this.vertices_[numVertices++] = (originX + width) / imageWidth; - this.vertices_[numVertices++] = (originY + height) / imageHeight; - this.vertices_[numVertices++] = opacity; - this.vertices_[numVertices++] = rotateWithView; - - // top-right corner - offsetX = scale * (width - anchorX); - offsetY = scale * anchorY; - this.vertices_[numVertices++] = x; - this.vertices_[numVertices++] = y; - this.vertices_[numVertices++] = offsetX * cos - offsetY * sin; - this.vertices_[numVertices++] = offsetX * sin + offsetY * cos; - this.vertices_[numVertices++] = (originX + width) / imageWidth; - this.vertices_[numVertices++] = originY / imageHeight; - this.vertices_[numVertices++] = opacity; - this.vertices_[numVertices++] = rotateWithView; - - // top-left corner - offsetX = -scale * anchorX; - offsetY = scale * anchorY; - this.vertices_[numVertices++] = x; - this.vertices_[numVertices++] = y; - this.vertices_[numVertices++] = offsetX * cos - offsetY * sin; - this.vertices_[numVertices++] = offsetX * sin + offsetY * cos; - this.vertices_[numVertices++] = originX / imageWidth; - this.vertices_[numVertices++] = originY / imageHeight; - this.vertices_[numVertices++] = opacity; - this.vertices_[numVertices++] = rotateWithView; - - this.indices_[numIndices++] = n; - this.indices_[numIndices++] = n + 1; - this.indices_[numIndices++] = n + 2; - this.indices_[numIndices++] = n; - this.indices_[numIndices++] = n + 2; - this.indices_[numIndices++] = n + 3; - } - - return numVertices; -}; - - -/** - * @inheritDoc - */ -ol.render.webgl.ImageReplay.prototype.drawMultiPointGeometry = - function(multiPointGeometry, feature) { - this.startIndices_.push(this.indices_.length); - this.startIndicesFeature_.push(feature); - var flatCoordinates = multiPointGeometry.getFlatCoordinates(); - var stride = multiPointGeometry.getStride(); - this.drawCoordinates_( - flatCoordinates, 0, flatCoordinates.length, stride); -}; - - -/** - * @inheritDoc - */ -ol.render.webgl.ImageReplay.prototype.drawPointGeometry = - function(pointGeometry, feature) { - this.startIndices_.push(this.indices_.length); - this.startIndicesFeature_.push(feature); - var flatCoordinates = pointGeometry.getFlatCoordinates(); - var stride = pointGeometry.getStride(); - this.drawCoordinates_( - flatCoordinates, 0, flatCoordinates.length, stride); -}; - - -/** - * @param {ol.webgl.Context} context Context. - */ -ol.render.webgl.ImageReplay.prototype.finish = function(context) { - var gl = context.getGL(); - - this.groupIndices_.push(this.indices_.length); - goog.asserts.assert(this.images_.length === this.groupIndices_.length, - 'number of images and groupIndices match'); - this.hitDetectionGroupIndices_.push(this.indices_.length); - goog.asserts.assert(this.hitDetectionImages_.length === - this.hitDetectionGroupIndices_.length, - 'number of hitDetectionImages and hitDetectionGroupIndices match'); - - // create, bind, and populate the vertices buffer - this.verticesBuffer_ = new ol.webgl.Buffer(this.vertices_); - context.bindBuffer(goog.webgl.ARRAY_BUFFER, this.verticesBuffer_); - - var indices = this.indices_; - var bits = context.hasOESElementIndexUint ? 32 : 16; - goog.asserts.assert(indices[indices.length - 1] < Math.pow(2, bits), - 'Too large element index detected [%s] (OES_element_index_uint "%s")', - indices[indices.length - 1], context.hasOESElementIndexUint); - - // create, bind, and populate the indices buffer - this.indicesBuffer_ = new ol.webgl.Buffer(indices); - context.bindBuffer(goog.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer_); - - // create textures - /** @type {Object.<string, WebGLTexture>} */ - var texturePerImage = {}; - - this.createTextures_(this.textures_, this.images_, texturePerImage, gl); - goog.asserts.assert(this.textures_.length === this.groupIndices_.length, - 'number of textures and groupIndices match'); - - this.createTextures_(this.hitDetectionTextures_, this.hitDetectionImages_, - texturePerImage, gl); - goog.asserts.assert(this.hitDetectionTextures_.length === - this.hitDetectionGroupIndices_.length, - 'number of hitDetectionTextures and hitDetectionGroupIndices match'); - - this.anchorX_ = undefined; - this.anchorY_ = undefined; - this.height_ = undefined; - this.images_ = null; - this.hitDetectionImages_ = null; - this.imageHeight_ = undefined; - this.imageWidth_ = undefined; - this.indices_ = null; - this.opacity_ = undefined; - this.originX_ = undefined; - this.originY_ = undefined; - this.rotateWithView_ = undefined; - this.rotation_ = undefined; - this.scale_ = undefined; - this.vertices_ = null; - this.width_ = undefined; -}; - - -/** - * @private - * @param {Array.<WebGLTexture>} textures Textures. - * @param {Array.<HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>} images - * Images. - * @param {Object.<string, WebGLTexture>} texturePerImage Texture cache. - * @param {WebGLRenderingContext} gl Gl. - */ -ol.render.webgl.ImageReplay.prototype.createTextures_ = - function(textures, images, texturePerImage, gl) { - goog.asserts.assert(textures.length === 0, - 'upon creation, textures is empty'); - - var texture, image, uid, i; - var ii = images.length; - for (i = 0; i < ii; ++i) { - image = images[i]; - - uid = goog.getUid(image).toString(); - if (goog.object.containsKey(texturePerImage, uid)) { - texture = texturePerImage[uid]; - } else { - texture = ol.webgl.Context.createTexture( - gl, image, goog.webgl.CLAMP_TO_EDGE, goog.webgl.CLAMP_TO_EDGE); - texturePerImage[uid] = texture; - } - textures[i] = texture; - } -}; - - -/** - * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {number} pixelRatio Pixel ratio. - * @param {number} opacity Global opacity. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function(ol.Feature): T|undefined} featureCallback Feature callback. - * @param {boolean} oneByOne Draw features one-by-one for the hit-detecion. - * @param {ol.Extent=} opt_hitExtent Hit extent: Only features intersecting - * this extent are checked. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.webgl.ImageReplay.prototype.replay = function(context, - center, resolution, rotation, size, pixelRatio, - opacity, skippedFeaturesHash, - featureCallback, oneByOne, opt_hitExtent) { - var gl = context.getGL(); - - // bind the vertices buffer - goog.asserts.assert(this.verticesBuffer_, - 'verticesBuffer must not be null'); - context.bindBuffer(goog.webgl.ARRAY_BUFFER, this.verticesBuffer_); - - // bind the indices buffer - goog.asserts.assert(this.indicesBuffer_, - 'indecesBuffer must not be null'); - context.bindBuffer(goog.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer_); - - // get the program - var fragmentShader = - ol.render.webgl.imagereplay.shader.DefaultFragment.getInstance(); - var vertexShader = - ol.render.webgl.imagereplay.shader.DefaultVertex.getInstance(); - var program = context.getProgram(fragmentShader, vertexShader); - - // get the locations - var locations; - if (!this.defaultLocations_) { - locations = - new ol.render.webgl.imagereplay.shader.Default.Locations(gl, program); - this.defaultLocations_ = locations; - } else { - locations = this.defaultLocations_; - } - - // use the program (FIXME: use the return value) - context.useProgram(program); - - // enable the vertex attrib arrays - gl.enableVertexAttribArray(locations.a_position); - gl.vertexAttribPointer(locations.a_position, 2, goog.webgl.FLOAT, - false, 32, 0); - - gl.enableVertexAttribArray(locations.a_offsets); - gl.vertexAttribPointer(locations.a_offsets, 2, goog.webgl.FLOAT, - false, 32, 8); - - gl.enableVertexAttribArray(locations.a_texCoord); - gl.vertexAttribPointer(locations.a_texCoord, 2, goog.webgl.FLOAT, - false, 32, 16); - - gl.enableVertexAttribArray(locations.a_opacity); - gl.vertexAttribPointer(locations.a_opacity, 1, goog.webgl.FLOAT, - false, 32, 24); - - gl.enableVertexAttribArray(locations.a_rotateWithView); - gl.vertexAttribPointer(locations.a_rotateWithView, 1, goog.webgl.FLOAT, - false, 32, 28); - - // set the "uniform" values - var projectionMatrix = this.projectionMatrix_; - ol.vec.Mat4.makeTransform2D(projectionMatrix, - 0.0, 0.0, - 2 / (resolution * size[0]), - 2 / (resolution * size[1]), - -rotation, - -(center[0] - this.origin_[0]), -(center[1] - this.origin_[1])); - - var offsetScaleMatrix = this.offsetScaleMatrix_; - goog.vec.Mat4.makeScale(offsetScaleMatrix, 2 / size[0], 2 / size[1], 1); - - var offsetRotateMatrix = this.offsetRotateMatrix_; - goog.vec.Mat4.makeIdentity(offsetRotateMatrix); - if (rotation !== 0) { - goog.vec.Mat4.rotateZ(offsetRotateMatrix, -rotation); - } - - gl.uniformMatrix4fv(locations.u_projectionMatrix, false, projectionMatrix); - gl.uniformMatrix4fv(locations.u_offsetScaleMatrix, false, offsetScaleMatrix); - gl.uniformMatrix4fv(locations.u_offsetRotateMatrix, false, - offsetRotateMatrix); - gl.uniform1f(locations.u_opacity, opacity); - - // draw! - var result; - if (featureCallback === undefined) { - this.drawReplay_(gl, context, skippedFeaturesHash, - this.textures_, this.groupIndices_); - } else { - // draw feature by feature for the hit-detection - result = this.drawHitDetectionReplay_(gl, context, skippedFeaturesHash, - featureCallback, oneByOne, opt_hitExtent); - } - - // disable the vertex attrib arrays - gl.disableVertexAttribArray(locations.a_position); - gl.disableVertexAttribArray(locations.a_offsets); - gl.disableVertexAttribArray(locations.a_texCoord); - gl.disableVertexAttribArray(locations.a_opacity); - gl.disableVertexAttribArray(locations.a_rotateWithView); - - return result; -}; - - -/** - * @private - * @param {WebGLRenderingContext} gl gl. - * @param {ol.webgl.Context} context Context. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {Array.<WebGLTexture>} textures Textures. - * @param {Array.<number>} groupIndices Texture group indices. - */ -ol.render.webgl.ImageReplay.prototype.drawReplay_ = - function(gl, context, skippedFeaturesHash, textures, groupIndices) { - goog.asserts.assert(textures.length === groupIndices.length, - 'number of textures and groupIndeces match'); - var elementType = context.hasOESElementIndexUint ? - goog.webgl.UNSIGNED_INT : goog.webgl.UNSIGNED_SHORT; - var elementSize = context.hasOESElementIndexUint ? 4 : 2; - - if (!goog.object.isEmpty(skippedFeaturesHash)) { - this.drawReplaySkipping_( - gl, skippedFeaturesHash, textures, groupIndices, - elementType, elementSize); - } else { - var i, ii, start; - for (i = 0, ii = textures.length, start = 0; i < ii; ++i) { - gl.bindTexture(goog.webgl.TEXTURE_2D, textures[i]); - var end = groupIndices[i]; - this.drawElements_(gl, start, end, elementType, elementSize); - start = end; - } - } -}; - - -/** - * Draw the replay while paying attention to skipped features. - * - * This functions creates groups of features that can be drawn to together, - * so that the number of `drawElements` calls is minimized. - * - * For example given the following texture groups: - * - * Group 1: A B C - * Group 2: D [E] F G - * - * If feature E should be skipped, the following `drawElements` calls will be - * made: - * - * drawElements with feature A, B and C - * drawElements with feature D - * drawElements with feature F and G - * - * @private - * @param {WebGLRenderingContext} gl gl. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {Array.<WebGLTexture>} textures Textures. - * @param {Array.<number>} groupIndices Texture group indices. - * @param {number} elementType Element type. - * @param {number} elementSize Element Size. - */ -ol.render.webgl.ImageReplay.prototype.drawReplaySkipping_ = - function(gl, skippedFeaturesHash, textures, groupIndices, - elementType, elementSize) { - var featureIndex = 0; - - var i, ii; - for (i = 0, ii = textures.length; i < ii; ++i) { - gl.bindTexture(goog.webgl.TEXTURE_2D, textures[i]); - var groupStart = (i > 0) ? groupIndices[i - 1] : 0; - var groupEnd = groupIndices[i]; - - var start = groupStart; - var end = groupStart; - while (featureIndex < this.startIndices_.length && - this.startIndices_[featureIndex] <= groupEnd) { - var feature = this.startIndicesFeature_[featureIndex]; - - var featureUid = goog.getUid(feature).toString(); - if (skippedFeaturesHash[featureUid] !== undefined) { - // feature should be skipped - if (start !== end) { - // draw the features so far - this.drawElements_(gl, start, end, elementType, elementSize); - } - // continue with the next feature - start = (featureIndex === this.startIndices_.length - 1) ? - groupEnd : this.startIndices_[featureIndex + 1]; - end = start; - } else { - // the feature is not skipped, augment the end index - end = (featureIndex === this.startIndices_.length - 1) ? - groupEnd : this.startIndices_[featureIndex + 1]; - } - featureIndex++; - } - - if (start !== end) { - // draw the remaining features (in case there was no skipped feature - // in this texture group, all features of a group are drawn together) - this.drawElements_(gl, start, end, elementType, elementSize); - } - } -}; - - -/** - * @private - * @param {WebGLRenderingContext} gl gl. - * @param {number} start Start index. - * @param {number} end End index. - * @param {number} elementType Element type. - * @param {number} elementSize Element Size. - */ -ol.render.webgl.ImageReplay.prototype.drawElements_ = function( - gl, start, end, elementType, elementSize) { - var numItems = end - start; - var offsetInBytes = start * elementSize; - gl.drawElements(goog.webgl.TRIANGLES, numItems, elementType, offsetInBytes); -}; - - -/** - * @private - * @param {WebGLRenderingContext} gl gl. - * @param {ol.webgl.Context} context Context. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function(ol.Feature): T|undefined} featureCallback Feature callback. - * @param {boolean} oneByOne Draw features one-by-one for the hit-detecion. - * @param {ol.Extent=} opt_hitExtent Hit extent: Only features intersecting - * this extent are checked. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplay_ = - function(gl, context, skippedFeaturesHash, featureCallback, oneByOne, - opt_hitExtent) { - if (!oneByOne) { - // draw all hit-detection features in "once" (by texture group) - return this.drawHitDetectionReplayAll_(gl, context, - skippedFeaturesHash, featureCallback); - } else { - // draw hit-detection features one by one - return this.drawHitDetectionReplayOneByOne_(gl, context, - skippedFeaturesHash, featureCallback, opt_hitExtent); - } -}; - - -/** - * @private - * @param {WebGLRenderingContext} gl gl. - * @param {ol.webgl.Context} context Context. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function(ol.Feature): T|undefined} featureCallback Feature callback. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayAll_ = - function(gl, context, skippedFeaturesHash, featureCallback) { - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); - this.drawReplay_(gl, context, skippedFeaturesHash, - this.hitDetectionTextures_, this.hitDetectionGroupIndices_); - - var result = featureCallback(null); - if (result) { - return result; - } else { - return undefined; - } -}; - - -/** - * @private - * @param {WebGLRenderingContext} gl gl. - * @param {ol.webgl.Context} context Context. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function(ol.Feature): T|undefined} featureCallback Feature callback. - * @param {ol.Extent=} opt_hitExtent Hit extent: Only features intersecting - * this extent are checked. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne_ = - function(gl, context, skippedFeaturesHash, featureCallback, - opt_hitExtent) { - goog.asserts.assert(this.hitDetectionTextures_.length === - this.hitDetectionGroupIndices_.length, - 'number of hitDetectionTextures and hitDetectionGroupIndices match'); - var elementType = context.hasOESElementIndexUint ? - goog.webgl.UNSIGNED_INT : goog.webgl.UNSIGNED_SHORT; - var elementSize = context.hasOESElementIndexUint ? 4 : 2; - - var i, groupStart, start, end, feature, featureUid; - var featureIndex = this.startIndices_.length - 1; - for (i = this.hitDetectionTextures_.length - 1; i >= 0; --i) { - gl.bindTexture(goog.webgl.TEXTURE_2D, this.hitDetectionTextures_[i]); - groupStart = (i > 0) ? this.hitDetectionGroupIndices_[i - 1] : 0; - end = this.hitDetectionGroupIndices_[i]; - - // draw all features for this texture group - while (featureIndex >= 0 && - this.startIndices_[featureIndex] >= groupStart) { - start = this.startIndices_[featureIndex]; - feature = this.startIndicesFeature_[featureIndex]; - featureUid = goog.getUid(feature).toString(); - - if (skippedFeaturesHash[featureUid] === undefined && - feature.getGeometry() && - (opt_hitExtent === undefined || ol.extent.intersects( - /** @type {Array<number>} */ (opt_hitExtent), - feature.getGeometry().getExtent()))) { - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); - this.drawElements_(gl, start, end, elementType, elementSize); - - var result = featureCallback(feature); - if (result) { - return result; - } - } - - end = start; - featureIndex--; - } - } - return undefined; -}; - - -/** - * @inheritDoc - */ -ol.render.webgl.ImageReplay.prototype.setFillStrokeStyle = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) { - var anchor = imageStyle.getAnchor(); - var image = imageStyle.getImage(1); - var imageSize = imageStyle.getImageSize(); - var hitDetectionImage = imageStyle.getHitDetectionImage(1); - var hitDetectionImageSize = imageStyle.getHitDetectionImageSize(); - var opacity = imageStyle.getOpacity(); - var origin = imageStyle.getOrigin(); - var rotateWithView = imageStyle.getRotateWithView(); - var rotation = imageStyle.getRotation(); - var size = imageStyle.getSize(); - var scale = imageStyle.getScale(); - goog.asserts.assert(anchor, 'imageStyle anchor is not null'); - goog.asserts.assert(image, 'imageStyle image is not null'); - goog.asserts.assert(imageSize, - 'imageStyle imageSize is not null'); - goog.asserts.assert(hitDetectionImage, - 'imageStyle hitDetectionImage is not null'); - goog.asserts.assert(hitDetectionImageSize, - 'imageStyle hitDetectionImageSize is not null'); - goog.asserts.assert(opacity !== undefined, 'imageStyle opacity is defined'); - goog.asserts.assert(origin, 'imageStyle origin is not null'); - goog.asserts.assert(rotateWithView !== undefined, - 'imageStyle rotateWithView is defined'); - goog.asserts.assert(rotation !== undefined, 'imageStyle rotation is defined'); - goog.asserts.assert(size, 'imageStyle size is not null'); - goog.asserts.assert(scale !== undefined, 'imageStyle scale is defined'); - - var currentImage; - if (this.images_.length === 0) { - this.images_.push(image); - } else { - currentImage = this.images_[this.images_.length - 1]; - if (goog.getUid(currentImage) != goog.getUid(image)) { - this.groupIndices_.push(this.indices_.length); - goog.asserts.assert(this.groupIndices_.length === this.images_.length, - 'number of groupIndices and images match'); - this.images_.push(image); - } - } - - if (this.hitDetectionImages_.length === 0) { - this.hitDetectionImages_.push(hitDetectionImage); - } else { - currentImage = - this.hitDetectionImages_[this.hitDetectionImages_.length - 1]; - if (goog.getUid(currentImage) != goog.getUid(hitDetectionImage)) { - this.hitDetectionGroupIndices_.push(this.indices_.length); - goog.asserts.assert(this.hitDetectionGroupIndices_.length === - this.hitDetectionImages_.length, - 'number of hitDetectionGroupIndices and hitDetectionImages match'); - this.hitDetectionImages_.push(hitDetectionImage); - } - } - - this.anchorX_ = anchor[0]; - this.anchorY_ = anchor[1]; - this.height_ = size[1]; - this.imageHeight_ = imageSize[1]; - this.imageWidth_ = imageSize[0]; - this.opacity_ = opacity; - this.originX_ = origin[0]; - this.originY_ = origin[1]; - this.rotation_ = rotation; - this.rotateWithView_ = rotateWithView; - this.scale_ = scale; - this.width_ = size[0]; -}; - - - -/** - * @constructor - * @implements {ol.render.IReplayGroup} - * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. - * @param {number=} opt_renderBuffer Render buffer. - * @struct - */ -ol.render.webgl.ReplayGroup = function( - tolerance, maxExtent, opt_renderBuffer) { - - /** - * @type {ol.Extent} - * @private - */ - this.maxExtent_ = maxExtent; - - /** - * @type {number} - * @private - */ - this.tolerance_ = tolerance; - - /** - * @type {number|undefined} - * @private - */ - this.renderBuffer_ = opt_renderBuffer; - - /** - * ImageReplay only is supported at this point. - * @type {Object.<ol.render.ReplayType, ol.render.webgl.ImageReplay>} - * @private - */ - this.replays_ = {}; - -}; - - -/** - * @param {ol.webgl.Context} context WebGL context. - * @return {function()} Delete resources function. - */ -ol.render.webgl.ReplayGroup.prototype.getDeleteResourcesFunction = - function(context) { - var functions = []; - var replayKey; - for (replayKey in this.replays_) { - functions.push( - this.replays_[replayKey].getDeleteResourcesFunction(context)); - } - return goog.functions.sequence.apply(null, functions); -}; - - -/** - * @param {ol.webgl.Context} context Context. - */ -ol.render.webgl.ReplayGroup.prototype.finish = function(context) { - var replayKey; - for (replayKey in this.replays_) { - this.replays_[replayKey].finish(context); - } -}; - - -/** - * @inheritDoc - */ -ol.render.webgl.ReplayGroup.prototype.getReplay = - function(zIndex, replayType) { - var replay = this.replays_[replayType]; - if (replay === undefined) { - var constructor = ol.render.webgl.BATCH_CONSTRUCTORS_[replayType]; - goog.asserts.assert(constructor !== undefined, - replayType + - ' constructor missing from ol.render.webgl.BATCH_CONSTRUCTORS_'); - replay = new constructor(this.tolerance_, this.maxExtent_); - this.replays_[replayType] = replay; - } - return replay; -}; - - -/** - * @inheritDoc - */ -ol.render.webgl.ReplayGroup.prototype.isEmpty = function() { - return goog.object.isEmpty(this.replays_); -}; - - -/** - * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {number} pixelRatio Pixel ratio. - * @param {number} opacity Global opacity. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - */ -ol.render.webgl.ReplayGroup.prototype.replay = function(context, - center, resolution, rotation, size, pixelRatio, - opacity, skippedFeaturesHash) { - var i, ii, replay; - for (i = 0, ii = ol.render.REPLAY_ORDER.length; i < ii; ++i) { - replay = this.replays_[ol.render.REPLAY_ORDER[i]]; - if (replay !== undefined) { - replay.replay(context, - center, resolution, rotation, size, pixelRatio, - opacity, skippedFeaturesHash, - undefined, false); - } - } -}; - - -/** - * @private - * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {number} pixelRatio Pixel ratio. - * @param {number} opacity Global opacity. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function(ol.Feature): T|undefined} featureCallback Feature callback. - * @param {boolean} oneByOne Draw features one-by-one for the hit-detecion. - * @param {ol.Extent=} opt_hitExtent Hit extent: Only features intersecting - * this extent are checked. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context, - center, resolution, rotation, size, pixelRatio, opacity, - skippedFeaturesHash, featureCallback, oneByOne, opt_hitExtent) { - var i, replay, result; - for (i = ol.render.REPLAY_ORDER.length - 1; i >= 0; --i) { - replay = this.replays_[ol.render.REPLAY_ORDER[i]]; - if (replay !== undefined) { - result = replay.replay(context, - center, resolution, rotation, size, pixelRatio, opacity, - skippedFeaturesHash, featureCallback, oneByOne, opt_hitExtent); - if (result) { - return result; - } - } - } - return undefined; -}; - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {number} pixelRatio Pixel ratio. - * @param {number} opacity Global opacity. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @param {function(ol.Feature): T|undefined} callback Feature callback. - * @return {T|undefined} Callback result. - * @template T - */ -ol.render.webgl.ReplayGroup.prototype.forEachFeatureAtCoordinate = function( - coordinate, context, center, resolution, rotation, size, pixelRatio, - opacity, skippedFeaturesHash, - callback) { - var gl = context.getGL(); - gl.bindFramebuffer( - gl.FRAMEBUFFER, context.getHitDetectionFramebuffer()); - - - /** - * @type {ol.Extent} - */ - var hitExtent; - if (this.renderBuffer_ !== undefined) { - // build an extent around the coordinate, so that only features that - // intersect this extent are checked - hitExtent = ol.extent.buffer( - ol.extent.createOrUpdateFromCoordinate(coordinate), - resolution * this.renderBuffer_); - } - - return this.replayHitDetection_(context, - coordinate, resolution, rotation, ol.render.webgl.HIT_DETECTION_SIZE_, - pixelRatio, opacity, skippedFeaturesHash, - /** - * @param {ol.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - var imageData = new Uint8Array(4); - gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, imageData); - - if (imageData[3] > 0) { - var result = callback(feature); - if (result) { - return result; - } - } - }, true, hitExtent); -}; - - -/** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {number} pixelRatio Pixel ratio. - * @param {number} opacity Global opacity. - * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features - * to skip. - * @return {boolean} Is there a feature at the given coordinate? - */ -ol.render.webgl.ReplayGroup.prototype.hasFeatureAtCoordinate = function( - coordinate, context, center, resolution, rotation, size, pixelRatio, - opacity, skippedFeaturesHash) { - var gl = context.getGL(); - gl.bindFramebuffer( - gl.FRAMEBUFFER, context.getHitDetectionFramebuffer()); - - var hasFeature = this.replayHitDetection_(context, - coordinate, resolution, rotation, ol.render.webgl.HIT_DETECTION_SIZE_, - pixelRatio, opacity, skippedFeaturesHash, - /** - * @param {ol.Feature} feature Feature. - * @return {boolean} Is there a feature? - */ - function(feature) { - var imageData = new Uint8Array(4); - gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, imageData); - return imageData[3] > 0; - }, false); - - return hasFeature !== undefined; -}; - - -/** - * @const - * @private - * @type {Object.<ol.render.ReplayType, - * function(new: ol.render.webgl.ImageReplay, number, - * ol.Extent)>} - */ -ol.render.webgl.BATCH_CONSTRUCTORS_ = { - 'Image': ol.render.webgl.ImageReplay -}; - - -/** - * @const - * @private - * @type {Array.<number>} - */ -ol.render.webgl.HIT_DETECTION_SIZE_ = [1, 1]; - -goog.provide('ol.render.webgl.Immediate'); -goog.require('goog.array'); -goog.require('ol.extent'); -goog.require('ol.render.VectorContext'); -goog.require('ol.render.webgl.ImageReplay'); -goog.require('ol.render.webgl.ReplayGroup'); - - - -/** - * @constructor - * @extends {ol.render.VectorContext} - * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {ol.Extent} extent Extent. - * @param {number} pixelRatio Pixel ratio. - * @struct - */ -ol.render.webgl.Immediate = function(context, - center, resolution, rotation, size, extent, pixelRatio) { - goog.base(this); - - /** - * @private - */ - this.context_ = context; - - /** - * @private - */ - this.center_ = center; - - /** - * @private - */ - this.extent_ = extent; - - /** - * @private - */ - this.pixelRatio_ = pixelRatio; - - /** - * @private - */ - this.size_ = size; - - /** - * @private - */ - this.rotation_ = rotation; - - /** - * @private - */ - this.resolution_ = resolution; - - /** - * @private - * @type {ol.style.Image} - */ - this.imageStyle_ = null; - - /** - * @private - * @type {!Object.<string, - * Array.<function(ol.render.webgl.Immediate)>>} - */ - this.callbacksByZIndex_ = {}; -}; -goog.inherits(ol.render.webgl.Immediate, ol.render.VectorContext); - - -/** - * FIXME: empty description for jsdoc - */ -ol.render.webgl.Immediate.prototype.flush = function() { - /** @type {Array.<number>} */ - var zs = Object.keys(this.callbacksByZIndex_).map(Number); - goog.array.sort(zs); - var i, ii, callbacks, j, jj; - for (i = 0, ii = zs.length; i < ii; ++i) { - callbacks = this.callbacksByZIndex_[zs[i].toString()]; - for (j = 0, jj = callbacks.length; j < jj; ++j) { - callbacks[j](this); - } - } -}; - - -/** - * Register a function to be called for rendering at a given zIndex. The - * function will be called asynchronously. The callback will receive a - * reference to {@link ol.render.canvas.Immediate} context for drawing. - * @param {number} zIndex Z index. - * @param {function(ol.render.webgl.Immediate)} callback Callback. - * @api - */ -ol.render.webgl.Immediate.prototype.drawAsync = function(zIndex, callback) { - var zIndexKey = zIndex.toString(); - var callbacks = this.callbacksByZIndex_[zIndexKey]; - if (callbacks !== undefined) { - callbacks.push(callback); - } else { - this.callbacksByZIndex_[zIndexKey] = [callback]; - } -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawCircleGeometry = - function(circleGeometry, data) { -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawFeature = function(feature, style) { - var geometry = style.getGeometryFunction()(feature); - if (!geometry || - !ol.extent.intersects(this.extent_, geometry.getExtent())) { - return; - } - var zIndex = style.getZIndex(); - if (zIndex === undefined) { - zIndex = 0; - } - this.drawAsync(zIndex, function(render) { - render.setFillStrokeStyle(style.getFill(), style.getStroke()); - render.setImageStyle(style.getImage()); - render.setTextStyle(style.getText()); - var type = geometry.getType(); - var renderGeometry = ol.render.webgl.Immediate.GEOMETRY_RENDERERS_[type]; - // Do not assert since all kinds of geometries are not handled yet. - // In spite, render what we support. - if (renderGeometry) { - renderGeometry.call(render, geometry, null); - } - }); -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawGeometryCollectionGeometry = - function(geometryCollectionGeometry, data) { - var geometries = geometryCollectionGeometry.getGeometriesArray(); - var renderers = ol.render.webgl.Immediate.GEOMETRY_RENDERERS_; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - var geometry = geometries[i]; - var geometryRenderer = renderers[geometry.getType()]; - // Do not assert since all kinds of geometries are not handled yet. - // In order to support hierarchies, delegate instead what we can to - // valid renderers. - if (geometryRenderer) { - geometryRenderer.call(this, geometry, data); - } - } -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawPointGeometry = - function(pointGeometry, data) { - var context = this.context_; - var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); - var replay = /** @type {ol.render.webgl.ImageReplay} */ ( - replayGroup.getReplay(0, ol.render.ReplayType.IMAGE)); - replay.setImageStyle(this.imageStyle_); - replay.drawPointGeometry(pointGeometry, data); - replay.finish(context); - // default colors - var opacity = 1; - var skippedFeatures = {}; - var featureCallback; - var oneByOne = false; - replay.replay(this.context_, this.center_, this.resolution_, this.rotation_, - this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback, - oneByOne); - replay.getDeleteResourcesFunction(context)(); -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawLineStringGeometry = - function(lineStringGeometry, data) { -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawMultiLineStringGeometry = - function(multiLineStringGeometry, data) { -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawMultiPointGeometry = - function(multiPointGeometry, data) { - var context = this.context_; - var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); - var replay = /** @type {ol.render.webgl.ImageReplay} */ ( - replayGroup.getReplay(0, ol.render.ReplayType.IMAGE)); - replay.setImageStyle(this.imageStyle_); - replay.drawMultiPointGeometry(multiPointGeometry, data); - replay.finish(context); - var opacity = 1; - var skippedFeatures = {}; - var featureCallback; - var oneByOne = false; - replay.replay(this.context_, this.center_, this.resolution_, this.rotation_, - this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback, - oneByOne); - replay.getDeleteResourcesFunction(context)(); -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawMultiPolygonGeometry = - function(multiPolygonGeometry, data) { -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawPolygonGeometry = - function(polygonGeometry, data) { -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.drawText = - function(flatCoordinates, offset, end, stride, geometry, data) { -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.setFillStrokeStyle = - function(fillStyle, strokeStyle) { -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.setImageStyle = function(imageStyle) { - this.imageStyle_ = imageStyle; -}; - - -/** - * @inheritDoc - * @api - */ -ol.render.webgl.Immediate.prototype.setTextStyle = function(textStyle) { -}; - - -/** - * @const - * @private - * @type {Object.<ol.geom.GeometryType, - * function(this: ol.render.webgl.Immediate, - * (ol.geom.Geometry|ol.render.Feature), Object)>} - */ -ol.render.webgl.Immediate.GEOMETRY_RENDERERS_ = { - 'Point': ol.render.webgl.Immediate.prototype.drawPointGeometry, - 'MultiPoint': ol.render.webgl.Immediate.prototype.drawMultiPointGeometry, - 'GeometryCollection': - ol.render.webgl.Immediate.prototype.drawGeometryCollectionGeometry -}; - -// This file is automatically generated, do not edit -goog.provide('ol.renderer.webgl.map.shader.Default'); -goog.provide('ol.renderer.webgl.map.shader.Default.Locations'); -goog.provide('ol.renderer.webgl.map.shader.DefaultFragment'); -goog.provide('ol.renderer.webgl.map.shader.DefaultVertex'); - -goog.require('ol.webgl.shader'); - - - -/** - * @constructor - * @extends {ol.webgl.shader.Fragment} - * @struct - */ -ol.renderer.webgl.map.shader.DefaultFragment = function() { - goog.base(this, ol.renderer.webgl.map.shader.DefaultFragment.SOURCE); -}; -goog.inherits(ol.renderer.webgl.map.shader.DefaultFragment, ol.webgl.shader.Fragment); -goog.addSingletonGetter(ol.renderer.webgl.map.shader.DefaultFragment); - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.map.shader.DefaultFragment.DEBUG_SOURCE = 'precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform float u_opacity;\nuniform sampler2D u_texture;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_texture, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n gl_FragColor.a = texColor.a * u_opacity;\n}\n'; - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.map.shader.DefaultFragment.OPTIMIZED_SOURCE = 'precision mediump float;varying vec2 a;uniform float f;uniform sampler2D g;void main(void){vec4 texColor=texture2D(g,a);gl_FragColor.rgb=texColor.rgb;gl_FragColor.a=texColor.a*f;}'; - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.map.shader.DefaultFragment.SOURCE = goog.DEBUG ? - ol.renderer.webgl.map.shader.DefaultFragment.DEBUG_SOURCE : - ol.renderer.webgl.map.shader.DefaultFragment.OPTIMIZED_SOURCE; - - - -/** - * @constructor - * @extends {ol.webgl.shader.Vertex} - * @struct - */ -ol.renderer.webgl.map.shader.DefaultVertex = function() { - goog.base(this, ol.renderer.webgl.map.shader.DefaultVertex.SOURCE); -}; -goog.inherits(ol.renderer.webgl.map.shader.DefaultVertex, ol.webgl.shader.Vertex); -goog.addSingletonGetter(ol.renderer.webgl.map.shader.DefaultVertex); - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.map.shader.DefaultVertex.DEBUG_SOURCE = 'varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\n\nuniform mat4 u_texCoordMatrix;\nuniform mat4 u_projectionMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0., 1.);\n v_texCoord = (u_texCoordMatrix * vec4(a_texCoord, 0., 1.)).st;\n}\n\n\n'; - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.map.shader.DefaultVertex.OPTIMIZED_SOURCE = 'varying vec2 a;attribute vec2 b;attribute vec2 c;uniform mat4 d;uniform mat4 e;void main(void){gl_Position=e*vec4(b,0.,1.);a=(d*vec4(c,0.,1.)).st;}'; - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.map.shader.DefaultVertex.SOURCE = goog.DEBUG ? - ol.renderer.webgl.map.shader.DefaultVertex.DEBUG_SOURCE : - ol.renderer.webgl.map.shader.DefaultVertex.OPTIMIZED_SOURCE; - - - -/** - * @constructor - * @param {WebGLRenderingContext} gl GL. - * @param {WebGLProgram} program Program. - * @struct - */ -ol.renderer.webgl.map.shader.Default.Locations = function(gl, program) { - - /** - * @type {WebGLUniformLocation} - */ - this.u_opacity = gl.getUniformLocation( - program, goog.DEBUG ? 'u_opacity' : 'f'); - - /** - * @type {WebGLUniformLocation} - */ - this.u_projectionMatrix = gl.getUniformLocation( - program, goog.DEBUG ? 'u_projectionMatrix' : 'e'); - - /** - * @type {WebGLUniformLocation} - */ - this.u_texCoordMatrix = gl.getUniformLocation( - program, goog.DEBUG ? 'u_texCoordMatrix' : 'd'); - - /** - * @type {WebGLUniformLocation} - */ - this.u_texture = gl.getUniformLocation( - program, goog.DEBUG ? 'u_texture' : 'g'); - - /** - * @type {number} - */ - this.a_position = gl.getAttribLocation( - program, goog.DEBUG ? 'a_position' : 'b'); - - /** - * @type {number} - */ - this.a_texCoord = gl.getAttribLocation( - program, goog.DEBUG ? 'a_texCoord' : 'c'); -}; - -goog.provide('ol.renderer.webgl.Layer'); - -goog.require('goog.vec.Mat4'); -goog.require('goog.webgl'); -goog.require('ol.layer.Layer'); -goog.require('ol.render.Event'); -goog.require('ol.render.EventType'); -goog.require('ol.render.webgl.Immediate'); -goog.require('ol.renderer.Layer'); -goog.require('ol.renderer.webgl.map.shader.Default'); -goog.require('ol.renderer.webgl.map.shader.Default.Locations'); -goog.require('ol.renderer.webgl.map.shader.DefaultFragment'); -goog.require('ol.renderer.webgl.map.shader.DefaultVertex'); -goog.require('ol.webgl.Buffer'); -goog.require('ol.webgl.Context'); - - - -/** - * @constructor - * @extends {ol.renderer.Layer} - * @param {ol.renderer.webgl.Map} mapRenderer Map renderer. - * @param {ol.layer.Layer} layer Layer. - */ -ol.renderer.webgl.Layer = function(mapRenderer, layer) { - - goog.base(this, layer); - - /** - * @protected - * @type {ol.renderer.webgl.Map} - */ - this.mapRenderer = mapRenderer; - - /** - * @private - * @type {ol.webgl.Buffer} - */ - this.arrayBuffer_ = new ol.webgl.Buffer([ - -1, -1, 0, 0, - 1, -1, 1, 0, - -1, 1, 0, 1, - 1, 1, 1, 1 - ]); - - /** - * @protected - * @type {WebGLTexture} - */ - this.texture = null; - - /** - * @protected - * @type {WebGLFramebuffer} - */ - this.framebuffer = null; - - /** - * @protected - * @type {number|undefined} - */ - this.framebufferDimension = undefined; - - /** - * @protected - * @type {!goog.vec.Mat4.Number} - */ - this.texCoordMatrix = goog.vec.Mat4.createNumber(); - - /** - * @protected - * @type {!goog.vec.Mat4.Number} - */ - this.projectionMatrix = goog.vec.Mat4.createNumberIdentity(); - - /** - * @private - * @type {ol.renderer.webgl.map.shader.Default.Locations} - */ - this.defaultLocations_ = null; - -}; -goog.inherits(ol.renderer.webgl.Layer, ol.renderer.Layer); - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {number} framebufferDimension Framebuffer dimension. - * @protected - */ -ol.renderer.webgl.Layer.prototype.bindFramebuffer = - function(frameState, framebufferDimension) { - - var gl = this.mapRenderer.getGL(); - - if (this.framebufferDimension === undefined || - this.framebufferDimension != framebufferDimension) { - - frameState.postRenderFunctions.push( - goog.partial( - /** - * @param {WebGLRenderingContext} gl GL. - * @param {WebGLFramebuffer} framebuffer Framebuffer. - * @param {WebGLTexture} texture Texture. - */ - function(gl, framebuffer, texture) { - if (!gl.isContextLost()) { - gl.deleteFramebuffer(framebuffer); - gl.deleteTexture(texture); - } - }, gl, this.framebuffer, this.texture)); - - var texture = ol.webgl.Context.createEmptyTexture( - gl, framebufferDimension, framebufferDimension); - - var framebuffer = gl.createFramebuffer(); - gl.bindFramebuffer(goog.webgl.FRAMEBUFFER, framebuffer); - gl.framebufferTexture2D(goog.webgl.FRAMEBUFFER, - goog.webgl.COLOR_ATTACHMENT0, goog.webgl.TEXTURE_2D, texture, 0); - - this.texture = texture; - this.framebuffer = framebuffer; - this.framebufferDimension = framebufferDimension; - - } else { - gl.bindFramebuffer(goog.webgl.FRAMEBUFFER, this.framebuffer); - } - -}; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {ol.layer.LayerState} layerState Layer state. - * @param {ol.webgl.Context} context Context. - */ -ol.renderer.webgl.Layer.prototype.composeFrame = - function(frameState, layerState, context) { - - this.dispatchComposeEvent_( - ol.render.EventType.PRECOMPOSE, context, frameState); - - context.bindBuffer(goog.webgl.ARRAY_BUFFER, this.arrayBuffer_); - - var gl = context.getGL(); - - var fragmentShader = - ol.renderer.webgl.map.shader.DefaultFragment.getInstance(); - var vertexShader = ol.renderer.webgl.map.shader.DefaultVertex.getInstance(); - - var program = context.getProgram(fragmentShader, vertexShader); - - var locations; - if (!this.defaultLocations_) { - locations = - new ol.renderer.webgl.map.shader.Default.Locations(gl, program); - this.defaultLocations_ = locations; - } else { - locations = this.defaultLocations_; - } - - if (context.useProgram(program)) { - gl.enableVertexAttribArray(locations.a_position); - gl.vertexAttribPointer( - locations.a_position, 2, goog.webgl.FLOAT, false, 16, 0); - gl.enableVertexAttribArray(locations.a_texCoord); - gl.vertexAttribPointer( - locations.a_texCoord, 2, goog.webgl.FLOAT, false, 16, 8); - gl.uniform1i(locations.u_texture, 0); - } - - gl.uniformMatrix4fv( - locations.u_texCoordMatrix, false, this.getTexCoordMatrix()); - gl.uniformMatrix4fv(locations.u_projectionMatrix, false, - this.getProjectionMatrix()); - gl.uniform1f(locations.u_opacity, layerState.opacity); - gl.bindTexture(goog.webgl.TEXTURE_2D, this.getTexture()); - gl.drawArrays(goog.webgl.TRIANGLE_STRIP, 0, 4); - - this.dispatchComposeEvent_( - ol.render.EventType.POSTCOMPOSE, context, frameState); - -}; - - -/** - * @param {ol.render.EventType} type Event type. - * @param {ol.webgl.Context} context WebGL context. - * @param {olx.FrameState} frameState Frame state. - * @private - */ -ol.renderer.webgl.Layer.prototype.dispatchComposeEvent_ = - function(type, context, frameState) { - var layer = this.getLayer(); - if (layer.hasListener(type)) { - var viewState = frameState.viewState; - var resolution = viewState.resolution; - var pixelRatio = frameState.pixelRatio; - var extent = frameState.extent; - var center = viewState.center; - var rotation = viewState.rotation; - var size = frameState.size; - - var render = new ol.render.webgl.Immediate( - context, center, resolution, rotation, size, extent, pixelRatio); - var composeEvent = new ol.render.Event( - type, layer, render, frameState, null, context); - layer.dispatchEvent(composeEvent); - } -}; - - -/** - * @return {!goog.vec.Mat4.Number} Matrix. - */ -ol.renderer.webgl.Layer.prototype.getTexCoordMatrix = function() { - return this.texCoordMatrix; -}; - - -/** - * @return {WebGLTexture} Texture. - */ -ol.renderer.webgl.Layer.prototype.getTexture = function() { - return this.texture; -}; - - -/** - * @return {!goog.vec.Mat4.Number} Matrix. - */ -ol.renderer.webgl.Layer.prototype.getProjectionMatrix = function() { - return this.projectionMatrix; -}; - - -/** - * Handle webglcontextlost. - */ -ol.renderer.webgl.Layer.prototype.handleWebGLContextLost = function() { - this.texture = null; - this.framebuffer = null; - this.framebufferDimension = undefined; -}; - - -/** - * @param {olx.FrameState} frameState Frame state. - * @param {ol.layer.LayerState} layerState Layer state. - * @param {ol.webgl.Context} context Context. - * @return {boolean} whether composeFrame should be called. - */ -ol.renderer.webgl.Layer.prototype.prepareFrame = goog.abstractMethod; - -goog.provide('ol.renderer.webgl.ImageLayer'); - -goog.require('goog.asserts'); -goog.require('goog.functions'); -goog.require('goog.vec.Mat4'); -goog.require('goog.webgl'); -goog.require('ol.Coordinate'); -goog.require('ol.Extent'); -goog.require('ol.ImageBase'); -goog.require('ol.ViewHint'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.layer.Image'); -goog.require('ol.proj'); -goog.require('ol.renderer.webgl.Layer'); -goog.require('ol.source.ImageVector'); -goog.require('ol.vec.Mat4'); -goog.require('ol.webgl.Context'); - - - -/** - * @constructor - * @extends {ol.renderer.webgl.Layer} - * @param {ol.renderer.webgl.Map} mapRenderer Map renderer. - * @param {ol.layer.Image} imageLayer Tile layer. - */ -ol.renderer.webgl.ImageLayer = function(mapRenderer, imageLayer) { - - goog.base(this, mapRenderer, imageLayer); - - /** - * The last rendered image. - * @private - * @type {?ol.ImageBase} - */ - this.image_ = null; - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.hitCanvasContext_ = null; - - /** - * @private - * @type {?goog.vec.Mat4.Number} - */ - this.hitTransformationMatrix_ = null; - -}; -goog.inherits(ol.renderer.webgl.ImageLayer, ol.renderer.webgl.Layer); - - -/** - * @param {ol.ImageBase} image Image. - * @private - * @return {WebGLTexture} Texture. - */ -ol.renderer.webgl.ImageLayer.prototype.createTexture_ = function(image) { - - // We meet the conditions to work with non-power of two textures. - // http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#Non-Power_of_Two_Texture_Support - // http://learningwebgl.com/blog/?p=2101 - - var imageElement = image.getImage(); - var gl = this.mapRenderer.getGL(); - - return ol.webgl.Context.createTexture( - gl, imageElement, goog.webgl.CLAMP_TO_EDGE, goog.webgl.CLAMP_TO_EDGE); -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg) { - var layer = this.getLayer(); - var source = layer.getSource(); - var resolution = frameState.viewState.resolution; - var rotation = frameState.viewState.rotation; - var skippedFeatureUids = frameState.skippedFeatureUids; - return source.forEachFeatureAtCoordinate( - coordinate, resolution, rotation, skippedFeatureUids, - - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - return callback.call(thisArg, feature, layer); - }); -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.ImageLayer.prototype.prepareFrame = - function(frameState, layerState, context) { - - var gl = this.mapRenderer.getGL(); - - var pixelRatio = frameState.pixelRatio; - var viewState = frameState.viewState; - var viewCenter = viewState.center; - var viewResolution = viewState.resolution; - var viewRotation = viewState.rotation; - - var image = this.image_; - var texture = this.texture; - var imageLayer = this.getLayer(); - goog.asserts.assertInstanceof(imageLayer, ol.layer.Image, - 'layer is an instance of ol.layer.Image'); - var imageSource = imageLayer.getSource(); - - var hints = frameState.viewHints; - - var renderedExtent = frameState.extent; - if (layerState.extent !== undefined) { - renderedExtent = ol.extent.getIntersection( - renderedExtent, layerState.extent); - } - if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING] && - !ol.extent.isEmpty(renderedExtent)) { - var projection = viewState.projection; - if (!ol.ENABLE_RASTER_REPROJECTION) { - var sourceProjection = imageSource.getProjection(); - if (sourceProjection) { - goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection), - 'projection and sourceProjection are equivalent'); - projection = sourceProjection; - } - } - var image_ = imageSource.getImage(renderedExtent, viewResolution, - pixelRatio, projection); - if (image_) { - var loaded = this.loadImage(image_); - if (loaded) { - image = image_; - texture = this.createTexture_(image_); - if (this.texture) { - frameState.postRenderFunctions.push( - goog.partial( - /** - * @param {WebGLRenderingContext} gl GL. - * @param {WebGLTexture} texture Texture. - */ - function(gl, texture) { - if (!gl.isContextLost()) { - gl.deleteTexture(texture); - } - }, gl, this.texture)); - } - } - } - } - - if (image) { - goog.asserts.assert(texture, 'texture is truthy'); - - var canvas = this.mapRenderer.getContext().getCanvas(); - - this.updateProjectionMatrix_(canvas.width, canvas.height, - pixelRatio, viewCenter, viewResolution, viewRotation, - image.getExtent()); - this.hitTransformationMatrix_ = null; - - // Translate and scale to flip the Y coord. - var texCoordMatrix = this.texCoordMatrix; - goog.vec.Mat4.makeIdentity(texCoordMatrix); - goog.vec.Mat4.scale(texCoordMatrix, 1, -1, 1); - goog.vec.Mat4.translate(texCoordMatrix, 0, -1, 0); - - this.image_ = image; - this.texture = texture; - - this.updateAttributions(frameState.attributions, image.getAttributions()); - this.updateLogos(frameState, imageSource); - } - - return true; -}; - - -/** - * @param {number} canvasWidth Canvas width. - * @param {number} canvasHeight Canvas height. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.Coordinate} viewCenter View center. - * @param {number} viewResolution View resolution. - * @param {number} viewRotation View rotation. - * @param {ol.Extent} imageExtent Image extent. - * @private - */ -ol.renderer.webgl.ImageLayer.prototype.updateProjectionMatrix_ = - function(canvasWidth, canvasHeight, pixelRatio, - viewCenter, viewResolution, viewRotation, imageExtent) { - - var canvasExtentWidth = canvasWidth * viewResolution; - var canvasExtentHeight = canvasHeight * viewResolution; - - var projectionMatrix = this.projectionMatrix; - goog.vec.Mat4.makeIdentity(projectionMatrix); - goog.vec.Mat4.scale(projectionMatrix, - pixelRatio * 2 / canvasExtentWidth, - pixelRatio * 2 / canvasExtentHeight, 1); - goog.vec.Mat4.rotateZ(projectionMatrix, -viewRotation); - goog.vec.Mat4.translate(projectionMatrix, - imageExtent[0] - viewCenter[0], - imageExtent[1] - viewCenter[1], - 0); - goog.vec.Mat4.scale(projectionMatrix, - (imageExtent[2] - imageExtent[0]) / 2, - (imageExtent[3] - imageExtent[1]) / 2, - 1); - goog.vec.Mat4.translate(projectionMatrix, 1, 1, 0); - -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.ImageLayer.prototype.hasFeatureAtCoordinate = - function(coordinate, frameState) { - var hasFeature = this.forEachFeatureAtCoordinate( - coordinate, frameState, goog.functions.TRUE, this); - return hasFeature !== undefined; -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel = - function(pixel, frameState, callback, thisArg) { - if (!this.image_ || !this.image_.getImage()) { - return undefined; - } - - if (this.getLayer().getSource() instanceof ol.source.ImageVector) { - // for ImageVector sources use the original hit-detection logic, - // so that for example also transparent polygons are detected - var coordinate = pixel.slice(); - ol.vec.Mat4.multVec2( - frameState.pixelToCoordinateMatrix, coordinate, coordinate); - var hasFeature = this.forEachFeatureAtCoordinate( - coordinate, frameState, goog.functions.TRUE, this); - - if (hasFeature) { - return callback.call(thisArg, this.getLayer()); - } else { - return undefined; - } - } else { - var imageSize = - [this.image_.getImage().width, this.image_.getImage().height]; - - if (!this.hitTransformationMatrix_) { - this.hitTransformationMatrix_ = this.getHitTransformationMatrix_( - frameState.size, imageSize); - } - - var pixelOnFrameBuffer = [0, 0]; - ol.vec.Mat4.multVec2( - this.hitTransformationMatrix_, pixel, pixelOnFrameBuffer); - - if (pixelOnFrameBuffer[0] < 0 || pixelOnFrameBuffer[0] > imageSize[0] || - pixelOnFrameBuffer[1] < 0 || pixelOnFrameBuffer[1] > imageSize[1]) { - // outside the image, no need to check - return undefined; - } - - if (!this.hitCanvasContext_) { - this.hitCanvasContext_ = ol.dom.createCanvasContext2D(1, 1); - } - - this.hitCanvasContext_.clearRect(0, 0, 1, 1); - this.hitCanvasContext_.drawImage(this.image_.getImage(), - pixelOnFrameBuffer[0], pixelOnFrameBuffer[1], 1, 1, 0, 0, 1, 1); - - var imageData = this.hitCanvasContext_.getImageData(0, 0, 1, 1).data; - if (imageData[3] > 0) { - return callback.call(thisArg, this.getLayer()); - } else { - return undefined; - } - } -}; - - -/** - * The transformation matrix to get the pixel on the image for a - * pixel on the map. - * @param {ol.Size} mapSize - * @param {ol.Size} imageSize - * @return {goog.vec.Mat4.Number} - * @private - */ -ol.renderer.webgl.ImageLayer.prototype.getHitTransformationMatrix_ = - function(mapSize, imageSize) { - // the first matrix takes a map pixel, flips the y-axis and scales to - // a range between -1 ... 1 - var mapCoordMatrix = goog.vec.Mat4.createNumber(); - goog.vec.Mat4.makeIdentity(mapCoordMatrix); - goog.vec.Mat4.translate(mapCoordMatrix, -1, -1, 0); - goog.vec.Mat4.scale(mapCoordMatrix, 2 / mapSize[0], 2 / mapSize[1], 1); - goog.vec.Mat4.translate(mapCoordMatrix, 0, mapSize[1], 0); - goog.vec.Mat4.scale(mapCoordMatrix, 1, -1, 1); - - // the second matrix is the inverse of the projection matrix used in the - // shader for drawing - var projectionMatrixInv = goog.vec.Mat4.createNumber(); - goog.vec.Mat4.invert(this.projectionMatrix, projectionMatrixInv); - - // the third matrix scales to the image dimensions and flips the y-axis again - var imageCoordMatrix = goog.vec.Mat4.createNumber(); - goog.vec.Mat4.makeIdentity(imageCoordMatrix); - goog.vec.Mat4.translate(imageCoordMatrix, 0, imageSize[1], 0); - goog.vec.Mat4.scale(imageCoordMatrix, 1, -1, 1); - goog.vec.Mat4.scale(imageCoordMatrix, imageSize[0] / 2, imageSize[1] / 2, 1); - goog.vec.Mat4.translate(imageCoordMatrix, 1, 1, 0); - - var transformMatrix = goog.vec.Mat4.createNumber(); - goog.vec.Mat4.multMat( - imageCoordMatrix, projectionMatrixInv, transformMatrix); - goog.vec.Mat4.multMat( - transformMatrix, mapCoordMatrix, transformMatrix); - - return transformMatrix; -}; - -// This file is automatically generated, do not edit -goog.provide('ol.renderer.webgl.tilelayer.shader'); -goog.provide('ol.renderer.webgl.tilelayer.shader.Locations'); -goog.provide('ol.renderer.webgl.tilelayer.shader.Fragment'); -goog.provide('ol.renderer.webgl.tilelayer.shader.Vertex'); - -goog.require('ol.webgl.shader'); - - - -/** - * @constructor - * @extends {ol.webgl.shader.Fragment} - * @struct - */ -ol.renderer.webgl.tilelayer.shader.Fragment = function() { - goog.base(this, ol.renderer.webgl.tilelayer.shader.Fragment.SOURCE); -}; -goog.inherits(ol.renderer.webgl.tilelayer.shader.Fragment, ol.webgl.shader.Fragment); -goog.addSingletonGetter(ol.renderer.webgl.tilelayer.shader.Fragment); - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.tilelayer.shader.Fragment.DEBUG_SOURCE = 'precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform sampler2D u_texture;\n\nvoid main(void) {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n}\n'; - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.tilelayer.shader.Fragment.OPTIMIZED_SOURCE = 'precision mediump float;varying vec2 a;uniform sampler2D e;void main(void){gl_FragColor=texture2D(e,a);}'; - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.tilelayer.shader.Fragment.SOURCE = goog.DEBUG ? - ol.renderer.webgl.tilelayer.shader.Fragment.DEBUG_SOURCE : - ol.renderer.webgl.tilelayer.shader.Fragment.OPTIMIZED_SOURCE; - - - -/** - * @constructor - * @extends {ol.webgl.shader.Vertex} - * @struct - */ -ol.renderer.webgl.tilelayer.shader.Vertex = function() { - goog.base(this, ol.renderer.webgl.tilelayer.shader.Vertex.SOURCE); -}; -goog.inherits(ol.renderer.webgl.tilelayer.shader.Vertex, ol.webgl.shader.Vertex); -goog.addSingletonGetter(ol.renderer.webgl.tilelayer.shader.Vertex); - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.tilelayer.shader.Vertex.DEBUG_SOURCE = 'varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nuniform vec4 u_tileOffset;\n\nvoid main(void) {\n gl_Position = vec4(a_position * u_tileOffset.xy + u_tileOffset.zw, 0., 1.);\n v_texCoord = a_texCoord;\n}\n\n\n'; - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.tilelayer.shader.Vertex.OPTIMIZED_SOURCE = 'varying vec2 a;attribute vec2 b;attribute vec2 c;uniform vec4 d;void main(void){gl_Position=vec4(b*d.xy+d.zw,0.,1.);a=c;}'; - - -/** - * @const - * @type {string} - */ -ol.renderer.webgl.tilelayer.shader.Vertex.SOURCE = goog.DEBUG ? - ol.renderer.webgl.tilelayer.shader.Vertex.DEBUG_SOURCE : - ol.renderer.webgl.tilelayer.shader.Vertex.OPTIMIZED_SOURCE; - - - -/** - * @constructor - * @param {WebGLRenderingContext} gl GL. - * @param {WebGLProgram} program Program. - * @struct - */ -ol.renderer.webgl.tilelayer.shader.Locations = function(gl, program) { - - /** - * @type {WebGLUniformLocation} - */ - this.u_texture = gl.getUniformLocation( - program, goog.DEBUG ? 'u_texture' : 'e'); - - /** - * @type {WebGLUniformLocation} - */ - this.u_tileOffset = gl.getUniformLocation( - program, goog.DEBUG ? 'u_tileOffset' : 'd'); - - /** - * @type {number} - */ - this.a_position = gl.getAttribLocation( - program, goog.DEBUG ? 'a_position' : 'b'); - - /** - * @type {number} - */ - this.a_texCoord = gl.getAttribLocation( - program, goog.DEBUG ? 'a_texCoord' : 'c'); -}; - -// FIXME large resolutions lead to too large framebuffers :-( -// FIXME animated shaders! check in redraw - -goog.provide('ol.renderer.webgl.TileLayer'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.vec.Mat4'); -goog.require('goog.vec.Vec4'); -goog.require('goog.webgl'); -goog.require('ol.TileRange'); -goog.require('ol.TileState'); -goog.require('ol.extent'); -goog.require('ol.layer.Tile'); -goog.require('ol.math'); -goog.require('ol.renderer.webgl.Layer'); -goog.require('ol.renderer.webgl.tilelayer.shader.Fragment'); -goog.require('ol.renderer.webgl.tilelayer.shader.Locations'); -goog.require('ol.renderer.webgl.tilelayer.shader.Vertex'); -goog.require('ol.size'); -goog.require('ol.tilecoord'); -goog.require('ol.vec.Mat4'); -goog.require('ol.webgl.Buffer'); - - - -/** - * @constructor - * @extends {ol.renderer.webgl.Layer} - * @param {ol.renderer.webgl.Map} mapRenderer Map renderer. - * @param {ol.layer.Tile} tileLayer Tile layer. - */ -ol.renderer.webgl.TileLayer = function(mapRenderer, tileLayer) { - - goog.base(this, mapRenderer, tileLayer); - - /** - * @private - * @type {ol.webgl.shader.Fragment} - */ - this.fragmentShader_ = - ol.renderer.webgl.tilelayer.shader.Fragment.getInstance(); - - /** - * @private - * @type {ol.webgl.shader.Vertex} - */ - this.vertexShader_ = ol.renderer.webgl.tilelayer.shader.Vertex.getInstance(); - - /** - * @private - * @type {ol.renderer.webgl.tilelayer.shader.Locations} - */ - this.locations_ = null; - - /** - * @private - * @type {ol.webgl.Buffer} - */ - this.renderArrayBuffer_ = new ol.webgl.Buffer([ - 0, 0, 0, 1, - 1, 0, 1, 1, - 0, 1, 0, 0, - 1, 1, 1, 0 - ]); - - /** - * @private - * @type {ol.TileRange} - */ - this.renderedTileRange_ = null; - - /** - * @private - * @type {ol.Extent} - */ - this.renderedFramebufferExtent_ = null; - - /** - * @private - * @type {number} - */ - this.renderedRevision_ = -1; - - /** - * @private - * @type {ol.Size} - */ - this.tmpSize_ = [0, 0]; - -}; -goog.inherits(ol.renderer.webgl.TileLayer, ol.renderer.webgl.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.webgl.TileLayer.prototype.disposeInternal = function() { - var context = this.mapRenderer.getContext(); - context.deleteBuffer(this.renderArrayBuffer_); - goog.base(this, 'disposeInternal'); -}; - - -/** - * Create a function that adds loaded tiles to the tile lookup. - * @param {ol.source.Tile} source Tile source. - * @param {ol.proj.Projection} projection Projection of the tiles. - * @param {Object.<number, Object.<string, ol.Tile>>} tiles Lookup of loaded - * tiles by zoom level. - * @return {function(number, ol.TileRange):boolean} A function that can be - * called with a zoom level and a tile range to add loaded tiles to the - * lookup. - * @protected - */ -ol.renderer.webgl.TileLayer.prototype.createLoadedTileFinder = - function(source, projection, tiles) { - var mapRenderer = this.mapRenderer; - - return ( - /** - * @param {number} zoom Zoom level. - * @param {ol.TileRange} tileRange Tile range. - * @return {boolean} The tile range is fully loaded. - */ - function(zoom, tileRange) { - return source.forEachLoadedTile(projection, zoom, - tileRange, function(tile) { - var loaded = mapRenderer.isTileTextureLoaded(tile); - if (loaded) { - if (!tiles[zoom]) { - tiles[zoom] = {}; - } - tiles[zoom][tile.tileCoord.toString()] = tile; - } - return loaded; - }); - }); -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.TileLayer.prototype.handleWebGLContextLost = function() { - goog.base(this, 'handleWebGLContextLost'); - this.locations_ = null; -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.TileLayer.prototype.prepareFrame = - function(frameState, layerState, context) { - - var mapRenderer = this.mapRenderer; - var gl = context.getGL(); - - var viewState = frameState.viewState; - var projection = viewState.projection; - - var tileLayer = this.getLayer(); - goog.asserts.assertInstanceof(tileLayer, ol.layer.Tile, - 'layer is an instance of ol.layer.Tile'); - var tileSource = tileLayer.getSource(); - var tileGrid = tileSource.getTileGridForProjection(projection); - var z = tileGrid.getZForResolution(viewState.resolution); - var tileResolution = tileGrid.getResolution(z); - - var tilePixelSize = - tileSource.getTilePixelSize(z, frameState.pixelRatio, projection); - var pixelRatio = tilePixelSize[0] / - ol.size.toSize(tileGrid.getTileSize(z), this.tmpSize_)[0]; - var tilePixelResolution = tileResolution / pixelRatio; - var tileGutter = tileSource.getGutter(); - - var center = viewState.center; - var extent; - if (tileResolution == viewState.resolution) { - center = this.snapCenterToPixel(center, tileResolution, frameState.size); - extent = ol.extent.getForViewAndSize( - center, tileResolution, viewState.rotation, frameState.size); - } else { - extent = frameState.extent; - } - var tileRange = tileGrid.getTileRangeForExtentAndResolution( - extent, tileResolution); - - var framebufferExtent; - if (this.renderedTileRange_ && - this.renderedTileRange_.equals(tileRange) && - this.renderedRevision_ == tileSource.getRevision()) { - framebufferExtent = this.renderedFramebufferExtent_; - } else { - - var tileRangeSize = tileRange.getSize(); - - var maxDimension = Math.max( - tileRangeSize[0] * tilePixelSize[0], - tileRangeSize[1] * tilePixelSize[1]); - var framebufferDimension = ol.math.roundUpToPowerOfTwo(maxDimension); - var framebufferExtentDimension = tilePixelResolution * framebufferDimension; - var origin = tileGrid.getOrigin(z); - var minX = origin[0] + - tileRange.minX * tilePixelSize[0] * tilePixelResolution; - var minY = origin[1] + - tileRange.minY * tilePixelSize[1] * tilePixelResolution; - framebufferExtent = [ - minX, minY, - minX + framebufferExtentDimension, minY + framebufferExtentDimension - ]; - - this.bindFramebuffer(frameState, framebufferDimension); - gl.viewport(0, 0, framebufferDimension, framebufferDimension); - - gl.clearColor(0, 0, 0, 0); - gl.clear(goog.webgl.COLOR_BUFFER_BIT); - gl.disable(goog.webgl.BLEND); - - var program = context.getProgram(this.fragmentShader_, this.vertexShader_); - context.useProgram(program); - if (!this.locations_) { - this.locations_ = - new ol.renderer.webgl.tilelayer.shader.Locations(gl, program); - } - - context.bindBuffer(goog.webgl.ARRAY_BUFFER, this.renderArrayBuffer_); - gl.enableVertexAttribArray(this.locations_.a_position); - gl.vertexAttribPointer( - this.locations_.a_position, 2, goog.webgl.FLOAT, false, 16, 0); - gl.enableVertexAttribArray(this.locations_.a_texCoord); - gl.vertexAttribPointer( - this.locations_.a_texCoord, 2, goog.webgl.FLOAT, false, 16, 8); - gl.uniform1i(this.locations_.u_texture, 0); - - /** - * @type {Object.<number, Object.<string, ol.Tile>>} - */ - var tilesToDrawByZ = {}; - tilesToDrawByZ[z] = {}; - - var findLoadedTiles = this.createLoadedTileFinder( - tileSource, projection, tilesToDrawByZ); - - var useInterimTilesOnError = tileLayer.getUseInterimTilesOnError(); - var allTilesLoaded = true; - var tmpExtent = ol.extent.createEmpty(); - var tmpTileRange = new ol.TileRange(0, 0, 0, 0); - var childTileRange, fullyLoaded, tile, tileState, x, y, tileExtent; - for (x = tileRange.minX; x <= tileRange.maxX; ++x) { - for (y = tileRange.minY; y <= tileRange.maxY; ++y) { - - tile = tileSource.getTile(z, x, y, pixelRatio, projection); - if (layerState.extent !== undefined) { - // ignore tiles outside layer extent - tileExtent = tileGrid.getTileCoordExtent(tile.tileCoord, tmpExtent); - if (!ol.extent.intersects(tileExtent, layerState.extent)) { - continue; - } - } - tileState = tile.getState(); - if (tileState == ol.TileState.LOADED) { - if (mapRenderer.isTileTextureLoaded(tile)) { - tilesToDrawByZ[z][ol.tilecoord.toString(tile.tileCoord)] = tile; - continue; - } - } else if (tileState == ol.TileState.EMPTY || - (tileState == ol.TileState.ERROR && - !useInterimTilesOnError)) { - continue; - } - - allTilesLoaded = false; - fullyLoaded = tileGrid.forEachTileCoordParentTileRange( - tile.tileCoord, findLoadedTiles, null, tmpTileRange, tmpExtent); - if (!fullyLoaded) { - childTileRange = tileGrid.getTileCoordChildTileRange( - tile.tileCoord, tmpTileRange, tmpExtent); - if (childTileRange) { - findLoadedTiles(z + 1, childTileRange); - } - } - - } - - } - - /** @type {Array.<number>} */ - var zs = Object.keys(tilesToDrawByZ).map(Number); - goog.array.sort(zs); - var u_tileOffset = goog.vec.Vec4.createFloat32(); - var i, ii, sx, sy, tileKey, tilesToDraw, tx, ty; - for (i = 0, ii = zs.length; i < ii; ++i) { - tilesToDraw = tilesToDrawByZ[zs[i]]; - for (tileKey in tilesToDraw) { - tile = tilesToDraw[tileKey]; - tileExtent = tileGrid.getTileCoordExtent(tile.tileCoord, tmpExtent); - sx = 2 * (tileExtent[2] - tileExtent[0]) / - framebufferExtentDimension; - sy = 2 * (tileExtent[3] - tileExtent[1]) / - framebufferExtentDimension; - tx = 2 * (tileExtent[0] - framebufferExtent[0]) / - framebufferExtentDimension - 1; - ty = 2 * (tileExtent[1] - framebufferExtent[1]) / - framebufferExtentDimension - 1; - goog.vec.Vec4.setFromValues(u_tileOffset, sx, sy, tx, ty); - gl.uniform4fv(this.locations_.u_tileOffset, u_tileOffset); - mapRenderer.bindTileTexture(tile, tilePixelSize, - tileGutter * pixelRatio, goog.webgl.LINEAR, goog.webgl.LINEAR); - gl.drawArrays(goog.webgl.TRIANGLE_STRIP, 0, 4); - } - } - - if (allTilesLoaded) { - this.renderedTileRange_ = tileRange; - this.renderedFramebufferExtent_ = framebufferExtent; - this.renderedRevision_ = tileSource.getRevision(); - } else { - this.renderedTileRange_ = null; - this.renderedFramebufferExtent_ = null; - this.renderedRevision_ = -1; - frameState.animate = true; - } - - } - - this.updateUsedTiles(frameState.usedTiles, tileSource, z, tileRange); - var tileTextureQueue = mapRenderer.getTileTextureQueue(); - this.manageTilePyramid( - frameState, tileSource, tileGrid, pixelRatio, projection, extent, z, - tileLayer.getPreload(), - /** - * @param {ol.Tile} tile Tile. - */ - function(tile) { - if (tile.getState() == ol.TileState.LOADED && - !mapRenderer.isTileTextureLoaded(tile) && - !tileTextureQueue.isKeyQueued(tile.getKey())) { - tileTextureQueue.enqueue([ - tile, - tileGrid.getTileCoordCenter(tile.tileCoord), - tileGrid.getResolution(tile.tileCoord[0]), - tilePixelSize, tileGutter * pixelRatio - ]); - } - }, this); - this.scheduleExpireCache(frameState, tileSource); - this.updateLogos(frameState, tileSource); - - var texCoordMatrix = this.texCoordMatrix; - goog.vec.Mat4.makeIdentity(texCoordMatrix); - goog.vec.Mat4.translate(texCoordMatrix, - (center[0] - framebufferExtent[0]) / - (framebufferExtent[2] - framebufferExtent[0]), - (center[1] - framebufferExtent[1]) / - (framebufferExtent[3] - framebufferExtent[1]), - 0); - if (viewState.rotation !== 0) { - goog.vec.Mat4.rotateZ(texCoordMatrix, viewState.rotation); - } - goog.vec.Mat4.scale(texCoordMatrix, - frameState.size[0] * viewState.resolution / - (framebufferExtent[2] - framebufferExtent[0]), - frameState.size[1] * viewState.resolution / - (framebufferExtent[3] - framebufferExtent[1]), - 1); - goog.vec.Mat4.translate(texCoordMatrix, - -0.5, - -0.5, - 0); - - return true; -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.TileLayer.prototype.forEachLayerAtPixel = - function(pixel, frameState, callback, thisArg) { - if (!this.framebuffer) { - return undefined; - } - - var pixelOnMapScaled = [ - pixel[0] / frameState.size[0], - (frameState.size[1] - pixel[1]) / frameState.size[1]]; - - var pixelOnFrameBufferScaled = [0, 0]; - ol.vec.Mat4.multVec2( - this.texCoordMatrix, pixelOnMapScaled, pixelOnFrameBufferScaled); - var pixelOnFrameBuffer = [ - pixelOnFrameBufferScaled[0] * this.framebufferDimension, - pixelOnFrameBufferScaled[1] * this.framebufferDimension]; - - var gl = this.mapRenderer.getContext().getGL(); - gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer); - var imageData = new Uint8Array(4); - gl.readPixels(pixelOnFrameBuffer[0], pixelOnFrameBuffer[1], 1, 1, - gl.RGBA, gl.UNSIGNED_BYTE, imageData); - - if (imageData[3] > 0) { - return callback.call(thisArg, this.getLayer()); - } else { - return undefined; - } -}; - -goog.provide('ol.renderer.webgl.VectorLayer'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('ol.ViewHint'); -goog.require('ol.extent'); -goog.require('ol.layer.Vector'); -goog.require('ol.render.webgl.ReplayGroup'); -goog.require('ol.renderer.vector'); -goog.require('ol.renderer.webgl.Layer'); -goog.require('ol.vec.Mat4'); - - - -/** - * @constructor - * @extends {ol.renderer.webgl.Layer} - * @param {ol.renderer.webgl.Map} mapRenderer Map renderer. - * @param {ol.layer.Vector} vectorLayer Vector layer. - */ -ol.renderer.webgl.VectorLayer = function(mapRenderer, vectorLayer) { - - goog.base(this, mapRenderer, vectorLayer); - - /** - * @private - * @type {boolean} - */ - this.dirty_ = false; - - /** - * @private - * @type {number} - */ - this.renderedRevision_ = -1; - - /** - * @private - * @type {number} - */ - this.renderedResolution_ = NaN; - - /** - * @private - * @type {ol.Extent} - */ - this.renderedExtent_ = ol.extent.createEmpty(); - - /** - * @private - * @type {function(ol.Feature, ol.Feature): number|null} - */ - this.renderedRenderOrder_ = null; - - /** - * @private - * @type {ol.render.webgl.ReplayGroup} - */ - this.replayGroup_ = null; - - /** - * The last layer state. - * @private - * @type {?ol.layer.LayerState} - */ - this.layerState_ = null; - -}; -goog.inherits(ol.renderer.webgl.VectorLayer, ol.renderer.webgl.Layer); - - -/** - * @inheritDoc - */ -ol.renderer.webgl.VectorLayer.prototype.composeFrame = - function(frameState, layerState, context) { - this.layerState_ = layerState; - var viewState = frameState.viewState; - var replayGroup = this.replayGroup_; - if (replayGroup && !replayGroup.isEmpty()) { - replayGroup.replay(context, - viewState.center, viewState.resolution, viewState.rotation, - frameState.size, frameState.pixelRatio, layerState.opacity, - layerState.managed ? frameState.skippedFeatureUids : {}); - } - -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.VectorLayer.prototype.disposeInternal = function() { - var replayGroup = this.replayGroup_; - if (replayGroup) { - var context = this.mapRenderer.getContext(); - replayGroup.getDeleteResourcesFunction(context)(); - this.replayGroup_ = null; - } - goog.base(this, 'disposeInternal'); -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg) { - if (!this.replayGroup_ || !this.layerState_) { - return undefined; - } else { - var context = this.mapRenderer.getContext(); - var viewState = frameState.viewState; - var layer = this.getLayer(); - var layerState = this.layerState_; - /** @type {Object.<string, boolean>} */ - var features = {}; - return this.replayGroup_.forEachFeatureAtCoordinate(coordinate, - context, viewState.center, viewState.resolution, viewState.rotation, - frameState.size, frameState.pixelRatio, layerState.opacity, - layerState.managed ? frameState.skippedFeatureUids : {}, - /** - * @param {ol.Feature} feature Feature. - * @return {?} Callback result. - */ - function(feature) { - goog.asserts.assert(feature !== undefined, 'received a feature'); - var key = goog.getUid(feature).toString(); - if (!(key in features)) { - features[key] = true; - return callback.call(thisArg, feature, layer); - } - }); - } -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.VectorLayer.prototype.hasFeatureAtCoordinate = - function(coordinate, frameState) { - if (!this.replayGroup_ || !this.layerState_) { - return false; - } else { - var context = this.mapRenderer.getContext(); - var viewState = frameState.viewState; - var layerState = this.layerState_; - return this.replayGroup_.hasFeatureAtCoordinate(coordinate, - context, viewState.center, viewState.resolution, viewState.rotation, - frameState.size, frameState.pixelRatio, layerState.opacity, - frameState.skippedFeatureUids); - } -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.VectorLayer.prototype.forEachLayerAtPixel = - function(pixel, frameState, callback, thisArg) { - var coordinate = pixel.slice(); - ol.vec.Mat4.multVec2( - frameState.pixelToCoordinateMatrix, coordinate, coordinate); - var hasFeature = this.hasFeatureAtCoordinate(coordinate, frameState); - - if (hasFeature) { - return callback.call(thisArg, this.getLayer()); - } else { - return undefined; - } -}; - - -/** - * Handle changes in image style state. - * @param {goog.events.Event} event Image style change event. - * @private - */ -ol.renderer.webgl.VectorLayer.prototype.handleStyleImageChange_ = - function(event) { - this.renderIfReadyAndVisible(); -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.VectorLayer.prototype.prepareFrame = - function(frameState, layerState, context) { - - var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer()); - goog.asserts.assertInstanceof(vectorLayer, ol.layer.Vector, - 'layer is an instance of ol.layer.Vector'); - var vectorSource = vectorLayer.getSource(); - - this.updateAttributions( - frameState.attributions, vectorSource.getAttributions()); - this.updateLogos(frameState, vectorSource); - - var animating = frameState.viewHints[ol.ViewHint.ANIMATING]; - var interacting = frameState.viewHints[ol.ViewHint.INTERACTING]; - var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating(); - var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting(); - - if (!this.dirty_ && (!updateWhileAnimating && animating) || - (!updateWhileInteracting && interacting)) { - return true; - } - - var frameStateExtent = frameState.extent; - var viewState = frameState.viewState; - var projection = viewState.projection; - var resolution = viewState.resolution; - var pixelRatio = frameState.pixelRatio; - var vectorLayerRevision = vectorLayer.getRevision(); - var vectorLayerRenderBuffer = vectorLayer.getRenderBuffer(); - var vectorLayerRenderOrder = vectorLayer.getRenderOrder(); - - if (vectorLayerRenderOrder === undefined) { - vectorLayerRenderOrder = ol.renderer.vector.defaultOrder; - } - - var extent = ol.extent.buffer(frameStateExtent, - vectorLayerRenderBuffer * resolution); - - if (!this.dirty_ && - this.renderedResolution_ == resolution && - this.renderedRevision_ == vectorLayerRevision && - this.renderedRenderOrder_ == vectorLayerRenderOrder && - ol.extent.containsExtent(this.renderedExtent_, extent)) { - return true; - } - - if (this.replayGroup_) { - frameState.postRenderFunctions.push( - this.replayGroup_.getDeleteResourcesFunction(context)); - } - - this.dirty_ = false; - - var replayGroup = new ol.render.webgl.ReplayGroup( - ol.renderer.vector.getTolerance(resolution, pixelRatio), - extent, vectorLayer.getRenderBuffer()); - vectorSource.loadFeatures(extent, resolution, projection); - var renderFeature = - /** - * @param {ol.Feature} feature Feature. - * @this {ol.renderer.webgl.VectorLayer} - */ - function(feature) { - var styles; - var styleFunction = feature.getStyleFunction(); - if (styleFunction) { - styles = styleFunction.call(feature, resolution); - } else { - styleFunction = vectorLayer.getStyleFunction(); - if (styleFunction) { - styles = styleFunction(feature, resolution); - } - } - if (styles) { - var dirty = this.renderFeature( - feature, resolution, pixelRatio, styles, replayGroup); - this.dirty_ = this.dirty_ || dirty; - } - }; - if (vectorLayerRenderOrder) { - /** @type {Array.<ol.Feature>} */ - var features = []; - vectorSource.forEachFeatureInExtent(extent, - /** - * @param {ol.Feature} feature Feature. - */ - function(feature) { - features.push(feature); - }, this); - goog.array.sort(features, vectorLayerRenderOrder); - features.forEach(renderFeature, this); - } else { - vectorSource.forEachFeatureInExtent(extent, renderFeature, this); - } - replayGroup.finish(context); - - this.renderedResolution_ = resolution; - this.renderedRevision_ = vectorLayerRevision; - this.renderedRenderOrder_ = vectorLayerRenderOrder; - this.renderedExtent_ = extent; - this.replayGroup_ = replayGroup; - - return true; -}; - - -/** - * @param {ol.Feature} feature Feature. - * @param {number} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {Array.<ol.style.Style>} styles Array of styles - * @param {ol.render.webgl.ReplayGroup} replayGroup Replay group. - * @return {boolean} `true` if an image is loading. - */ -ol.renderer.webgl.VectorLayer.prototype.renderFeature = - function(feature, resolution, pixelRatio, styles, replayGroup) { - if (!styles) { - return false; - } - var i, ii, loading = false; - for (i = 0, ii = styles.length; i < ii; ++i) { - loading = ol.renderer.vector.renderFeature( - replayGroup, feature, styles[i], - ol.renderer.vector.getSquaredTolerance(resolution, pixelRatio), - this.handleStyleImageChange_, this) || loading; - } - return loading; -}; - -// FIXME check against gl.getParameter(webgl.MAX_TEXTURE_SIZE) - -goog.provide('ol.renderer.webgl.Map'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.log'); -goog.require('goog.log.Logger'); -goog.require('goog.object'); -goog.require('goog.style'); -goog.require('goog.webgl'); -goog.require('ol'); -goog.require('ol.RendererType'); -goog.require('ol.css'); -goog.require('ol.dom'); -goog.require('ol.layer.Image'); -goog.require('ol.layer.Layer'); -goog.require('ol.layer.Tile'); -goog.require('ol.layer.Vector'); -goog.require('ol.render.Event'); -goog.require('ol.render.EventType'); -goog.require('ol.render.webgl.Immediate'); -goog.require('ol.renderer.Map'); -goog.require('ol.renderer.webgl.ImageLayer'); -goog.require('ol.renderer.webgl.Layer'); -goog.require('ol.renderer.webgl.TileLayer'); -goog.require('ol.renderer.webgl.VectorLayer'); -goog.require('ol.source.State'); -goog.require('ol.structs.LRUCache'); -goog.require('ol.structs.PriorityQueue'); -goog.require('ol.webgl'); -goog.require('ol.webgl.Context'); -goog.require('ol.webgl.WebGLContextEventType'); - - -/** - * @typedef {{magFilter: number, minFilter: number, texture: WebGLTexture}} - */ -ol.renderer.webgl.TextureCacheEntry; - - - -/** - * @constructor - * @extends {ol.renderer.Map} - * @param {Element} container Container. - * @param {ol.Map} map Map. - */ -ol.renderer.webgl.Map = function(container, map) { - - goog.base(this, container, map); - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = /** @type {HTMLCanvasElement} */ - (goog.dom.createElement('CANVAS')); - this.canvas_.style.width = '100%'; - this.canvas_.style.height = '100%'; - this.canvas_.className = ol.css.CLASS_UNSELECTABLE; - goog.dom.insertChildAt(container, this.canvas_, 0); - - /** - * @private - * @type {number} - */ - this.clipTileCanvasWidth_ = 0; - - /** - * @private - * @type {number} - */ - this.clipTileCanvasHeight_ = 0; - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.clipTileContext_ = ol.dom.createCanvasContext2D(); - - /** - * @private - * @type {boolean} - */ - this.renderedVisible_ = true; - - /** - * @private - * @type {WebGLRenderingContext} - */ - this.gl_ = ol.webgl.getContext(this.canvas_, { - antialias: true, - depth: false, - failIfMajorPerformanceCaveat: true, - preserveDrawingBuffer: false, - stencil: true - }); - goog.asserts.assert(this.gl_, 'got a WebGLRenderingContext'); - - /** - * @private - * @type {ol.webgl.Context} - */ - this.context_ = new ol.webgl.Context(this.canvas_, this.gl_); - - goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.LOST, - this.handleWebGLContextLost, false, this); - goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.RESTORED, - this.handleWebGLContextRestored, false, this); - - /** - * @private - * @type {ol.structs.LRUCache.<ol.renderer.webgl.TextureCacheEntry|null>} - */ - this.textureCache_ = new ol.structs.LRUCache(); - - /** - * @private - * @type {ol.Coordinate} - */ - this.focus_ = null; - - /** - * @private - * @type {ol.structs.PriorityQueue.<Array>} - */ - this.tileTextureQueue_ = new ol.structs.PriorityQueue( - goog.bind( - /** - * @param {Array.<*>} element Element. - * @return {number} Priority. - * @this {ol.renderer.webgl.Map} - */ - function(element) { - var tileCenter = /** @type {ol.Coordinate} */ (element[1]); - var tileResolution = /** @type {number} */ (element[2]); - var deltaX = tileCenter[0] - this.focus_[0]; - var deltaY = tileCenter[1] - this.focus_[1]; - return 65536 * Math.log(tileResolution) + - Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution; - }, this), - /** - * @param {Array.<*>} element Element. - * @return {string} Key. - */ - function(element) { - return /** @type {ol.Tile} */ (element[0]).getKey(); - }); - - /** - * @private - * @type {ol.PostRenderFunction} - */ - this.loadNextTileTexture_ = goog.bind( - function(map, frameState) { - if (!this.tileTextureQueue_.isEmpty()) { - this.tileTextureQueue_.reprioritize(); - var element = this.tileTextureQueue_.dequeue(); - var tile = /** @type {ol.Tile} */ (element[0]); - var tileSize = /** @type {ol.Size} */ (element[3]); - var tileGutter = /** @type {number} */ (element[4]); - this.bindTileTexture( - tile, tileSize, tileGutter, goog.webgl.LINEAR, goog.webgl.LINEAR); - } - }, this); - - /** - * @private - * @type {number} - */ - this.textureCacheFrameMarkerCount_ = 0; - - this.initializeGL_(); - -}; -goog.inherits(ol.renderer.webgl.Map, ol.renderer.Map); - - -/** - * @param {ol.Tile} tile Tile. - * @param {ol.Size} tileSize Tile size. - * @param {number} tileGutter Tile gutter. - * @param {number} magFilter Mag filter. - * @param {number} minFilter Min filter. - */ -ol.renderer.webgl.Map.prototype.bindTileTexture = - function(tile, tileSize, tileGutter, magFilter, minFilter) { - var gl = this.getGL(); - var tileKey = tile.getKey(); - if (this.textureCache_.containsKey(tileKey)) { - var textureCacheEntry = this.textureCache_.get(tileKey); - goog.asserts.assert(textureCacheEntry, - 'a texture cache entry exists for key %s', tileKey); - gl.bindTexture(goog.webgl.TEXTURE_2D, textureCacheEntry.texture); - if (textureCacheEntry.magFilter != magFilter) { - gl.texParameteri( - goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_MAG_FILTER, magFilter); - textureCacheEntry.magFilter = magFilter; - } - if (textureCacheEntry.minFilter != minFilter) { - gl.texParameteri( - goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_MAG_FILTER, minFilter); - textureCacheEntry.minFilter = minFilter; - } - } else { - var texture = gl.createTexture(); - gl.bindTexture(goog.webgl.TEXTURE_2D, texture); - if (tileGutter > 0) { - var clipTileCanvas = this.clipTileContext_.canvas; - var clipTileContext = this.clipTileContext_; - if (this.clipTileCanvasWidth_ !== tileSize[0] || - this.clipTileCanvasHeight_ !== tileSize[1]) { - clipTileCanvas.width = tileSize[0]; - clipTileCanvas.height = tileSize[1]; - this.clipTileCanvasWidth_ = tileSize[0]; - this.clipTileCanvasHeight_ = tileSize[1]; - } else { - clipTileContext.clearRect(0, 0, tileSize[0], tileSize[1]); - } - clipTileContext.drawImage(tile.getImage(), tileGutter, tileGutter, - tileSize[0], tileSize[1], 0, 0, tileSize[0], tileSize[1]); - gl.texImage2D(goog.webgl.TEXTURE_2D, 0, - goog.webgl.RGBA, goog.webgl.RGBA, - goog.webgl.UNSIGNED_BYTE, clipTileCanvas); - } else { - gl.texImage2D(goog.webgl.TEXTURE_2D, 0, - goog.webgl.RGBA, goog.webgl.RGBA, - goog.webgl.UNSIGNED_BYTE, tile.getImage()); - } - gl.texParameteri( - goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_MAG_FILTER, magFilter); - gl.texParameteri( - goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_MIN_FILTER, minFilter); - gl.texParameteri(goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_S, - goog.webgl.CLAMP_TO_EDGE); - gl.texParameteri(goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_T, - goog.webgl.CLAMP_TO_EDGE); - this.textureCache_.set(tileKey, { - texture: texture, - magFilter: magFilter, - minFilter: minFilter - }); - } -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.Map.prototype.createLayerRenderer = function(layer) { - if (ol.ENABLE_IMAGE && layer instanceof ol.layer.Image) { - return new ol.renderer.webgl.ImageLayer(this, layer); - } else if (ol.ENABLE_TILE && layer instanceof ol.layer.Tile) { - return new ol.renderer.webgl.TileLayer(this, layer); - } else if (ol.ENABLE_VECTOR && layer instanceof ol.layer.Vector) { - return new ol.renderer.webgl.VectorLayer(this, layer); - } else { - goog.asserts.fail('unexpected layer configuration'); - return null; - } -}; - - -/** - * @param {ol.render.EventType} type Event type. - * @param {olx.FrameState} frameState Frame state. - * @private - */ -ol.renderer.webgl.Map.prototype.dispatchComposeEvent_ = - function(type, frameState) { - var map = this.getMap(); - if (map.hasListener(type)) { - var context = this.context_; - - var extent = frameState.extent; - var size = frameState.size; - var viewState = frameState.viewState; - var pixelRatio = frameState.pixelRatio; - - var resolution = viewState.resolution; - var center = viewState.center; - var rotation = viewState.rotation; - - var vectorContext = new ol.render.webgl.Immediate(context, - center, resolution, rotation, size, extent, pixelRatio); - var composeEvent = new ol.render.Event(type, map, vectorContext, - frameState, null, context); - map.dispatchEvent(composeEvent); - - vectorContext.flush(); - } -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.Map.prototype.disposeInternal = function() { - var gl = this.getGL(); - if (!gl.isContextLost()) { - this.textureCache_.forEach( - /** - * @param {?ol.renderer.webgl.TextureCacheEntry} textureCacheEntry - * Texture cache entry. - */ - function(textureCacheEntry) { - if (textureCacheEntry) { - gl.deleteTexture(textureCacheEntry.texture); - } - }); - } - goog.dispose(this.context_); - goog.base(this, 'disposeInternal'); -}; - - -/** - * @param {ol.Map} map Map. - * @param {olx.FrameState} frameState Frame state. - * @private - */ -ol.renderer.webgl.Map.prototype.expireCache_ = function(map, frameState) { - var gl = this.getGL(); - var textureCacheEntry; - while (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ > - ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) { - textureCacheEntry = this.textureCache_.peekLast(); - if (!textureCacheEntry) { - if (+this.textureCache_.peekLastKey() == frameState.index) { - break; - } else { - --this.textureCacheFrameMarkerCount_; - } - } else { - gl.deleteTexture(textureCacheEntry.texture); - } - this.textureCache_.pop(); - } -}; - - -/** - * @return {ol.webgl.Context} - */ -ol.renderer.webgl.Map.prototype.getContext = function() { - return this.context_; -}; - - -/** - * @return {WebGLRenderingContext} GL. - */ -ol.renderer.webgl.Map.prototype.getGL = function() { - return this.gl_; -}; - - -/** - * @return {ol.structs.PriorityQueue.<Array>} Tile texture queue. - */ -ol.renderer.webgl.Map.prototype.getTileTextureQueue = function() { - return this.tileTextureQueue_; -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.Map.prototype.getType = function() { - return ol.RendererType.WEBGL; -}; - - -/** - * @param {goog.events.Event} event Event. - * @protected - */ -ol.renderer.webgl.Map.prototype.handleWebGLContextLost = function(event) { - event.preventDefault(); - this.textureCache_.clear(); - this.textureCacheFrameMarkerCount_ = 0; - goog.object.forEach(this.getLayerRenderers(), - /** - * @param {ol.renderer.Layer} layerRenderer Layer renderer. - * @param {string} key Key. - * @param {Object.<string, ol.renderer.Layer>} object Object. - */ - function(layerRenderer, key, object) { - goog.asserts.assertInstanceof(layerRenderer, ol.renderer.webgl.Layer, - 'renderer is an instance of ol.renderer.webgl.Layer'); - layerRenderer.handleWebGLContextLost(); - }); -}; - - -/** - * @protected - */ -ol.renderer.webgl.Map.prototype.handleWebGLContextRestored = function() { - this.initializeGL_(); - this.getMap().render(); -}; - - -/** - * @private - */ -ol.renderer.webgl.Map.prototype.initializeGL_ = function() { - var gl = this.gl_; - gl.activeTexture(goog.webgl.TEXTURE0); - gl.blendFuncSeparate( - goog.webgl.SRC_ALPHA, goog.webgl.ONE_MINUS_SRC_ALPHA, - goog.webgl.ONE, goog.webgl.ONE_MINUS_SRC_ALPHA); - gl.disable(goog.webgl.CULL_FACE); - gl.disable(goog.webgl.DEPTH_TEST); - gl.disable(goog.webgl.SCISSOR_TEST); - gl.disable(goog.webgl.STENCIL_TEST); -}; - - -/** - * @param {ol.Tile} tile Tile. - * @return {boolean} Is tile texture loaded. - */ -ol.renderer.webgl.Map.prototype.isTileTextureLoaded = function(tile) { - return this.textureCache_.containsKey(tile.getKey()); -}; - - -/** - * @private - * @type {goog.log.Logger} - */ -ol.renderer.webgl.Map.prototype.logger_ = - goog.log.getLogger('ol.renderer.webgl.Map'); - - -/** - * @inheritDoc - */ -ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) { - - var context = this.getContext(); - var gl = this.getGL(); - - if (gl.isContextLost()) { - return false; - } - - if (!frameState) { - if (this.renderedVisible_) { - goog.style.setElementShown(this.canvas_, false); - this.renderedVisible_ = false; - } - return false; - } - - this.focus_ = frameState.focus; - - this.textureCache_.set((-frameState.index).toString(), null); - ++this.textureCacheFrameMarkerCount_; - - this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, frameState); - - /** @type {Array.<ol.layer.LayerState>} */ - var layerStatesToDraw = []; - var layerStatesArray = frameState.layerStatesArray; - goog.array.stableSort(layerStatesArray, ol.renderer.Map.sortByZIndex); - - var viewResolution = frameState.viewState.resolution; - var i, ii, layerRenderer, layerState; - for (i = 0, ii = layerStatesArray.length; i < ii; ++i) { - layerState = layerStatesArray[i]; - if (ol.layer.Layer.visibleAtResolution(layerState, viewResolution) && - layerState.sourceState == ol.source.State.READY) { - layerRenderer = this.getLayerRenderer(layerState.layer); - goog.asserts.assertInstanceof(layerRenderer, ol.renderer.webgl.Layer, - 'renderer is an instance of ol.renderer.webgl.Layer'); - if (layerRenderer.prepareFrame(frameState, layerState, context)) { - layerStatesToDraw.push(layerState); - } - } - } - - var width = frameState.size[0] * frameState.pixelRatio; - var height = frameState.size[1] * frameState.pixelRatio; - if (this.canvas_.width != width || this.canvas_.height != height) { - this.canvas_.width = width; - this.canvas_.height = height; - } - - gl.bindFramebuffer(goog.webgl.FRAMEBUFFER, null); - - gl.clearColor(0, 0, 0, 0); - gl.clear(goog.webgl.COLOR_BUFFER_BIT); - gl.enable(goog.webgl.BLEND); - gl.viewport(0, 0, this.canvas_.width, this.canvas_.height); - - for (i = 0, ii = layerStatesToDraw.length; i < ii; ++i) { - layerState = layerStatesToDraw[i]; - layerRenderer = this.getLayerRenderer(layerState.layer); - goog.asserts.assertInstanceof(layerRenderer, ol.renderer.webgl.Layer, - 'renderer is an instance of ol.renderer.webgl.Layer'); - layerRenderer.composeFrame(frameState, layerState, context); - } - - if (!this.renderedVisible_) { - goog.style.setElementShown(this.canvas_, true); - this.renderedVisible_ = true; - } - - this.calculateMatrices2D(frameState); - - if (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ > - ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) { - frameState.postRenderFunctions.push(goog.bind(this.expireCache_, this)); - } - - if (!this.tileTextureQueue_.isEmpty()) { - frameState.postRenderFunctions.push(this.loadNextTileTexture_); - frameState.animate = true; - } - - this.dispatchComposeEvent_(ol.render.EventType.POSTCOMPOSE, frameState); - - this.scheduleRemoveUnusedLayerRenderers(frameState); - this.scheduleExpireIconCache(frameState); - -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.Map.prototype.forEachFeatureAtCoordinate = - function(coordinate, frameState, callback, thisArg, - layerFilter, thisArg2) { - var result; - - if (this.getGL().isContextLost()) { - return false; - } - - var viewState = frameState.viewState; - - var layerStates = frameState.layerStatesArray; - var numLayers = layerStates.length; - var i; - for (i = numLayers - 1; i >= 0; --i) { - var layerState = layerStates[i]; - var layer = layerState.layer; - if (ol.layer.Layer.visibleAtResolution(layerState, viewState.resolution) && - layerFilter.call(thisArg2, layer)) { - var layerRenderer = this.getLayerRenderer(layer); - result = layerRenderer.forEachFeatureAtCoordinate( - coordinate, frameState, callback, thisArg); - if (result) { - return result; - } - } - } - return undefined; -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.Map.prototype.hasFeatureAtCoordinate = - function(coordinate, frameState, layerFilter, thisArg) { - var hasFeature = false; - - if (this.getGL().isContextLost()) { - return false; - } - - var viewState = frameState.viewState; - - var layerStates = frameState.layerStatesArray; - var numLayers = layerStates.length; - var i; - for (i = numLayers - 1; i >= 0; --i) { - var layerState = layerStates[i]; - var layer = layerState.layer; - if (ol.layer.Layer.visibleAtResolution(layerState, viewState.resolution) && - layerFilter.call(thisArg, layer)) { - var layerRenderer = this.getLayerRenderer(layer); - hasFeature = - layerRenderer.hasFeatureAtCoordinate(coordinate, frameState); - if (hasFeature) { - return true; - } - } - } - return hasFeature; -}; - - -/** - * @inheritDoc - */ -ol.renderer.webgl.Map.prototype.forEachLayerAtPixel = - function(pixel, frameState, callback, thisArg, - layerFilter, thisArg2) { - if (this.getGL().isContextLost()) { - return false; - } - - var viewState = frameState.viewState; - var result; - - var layerStates = frameState.layerStatesArray; - var numLayers = layerStates.length; - var i; - for (i = numLayers - 1; i >= 0; --i) { - var layerState = layerStates[i]; - var layer = layerState.layer; - if (ol.layer.Layer.visibleAtResolution(layerState, viewState.resolution) && - layerFilter.call(thisArg, layer)) { - var layerRenderer = this.getLayerRenderer(layer); - result = layerRenderer.forEachLayerAtPixel( - pixel, frameState, callback, thisArg); - if (result) { - return result; - } - } - } - return undefined; -}; - -// FIXME recheck layer/map projection compatibility when projection changes -// FIXME layer renderers should skip when they can't reproject -// FIXME add tilt and height? - -goog.provide('ol.Map'); -goog.provide('ol.MapProperty'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.async.AnimationDelay'); -goog.require('goog.async.nextTick'); -goog.require('goog.debug.Console'); -goog.require('goog.dom'); -goog.require('goog.dom.ViewportSizeMonitor'); -goog.require('goog.dom.classlist'); -goog.require('goog.events'); -goog.require('goog.events.BrowserEvent'); -goog.require('goog.events.Event'); -goog.require('goog.events.EventType'); -goog.require('goog.events.KeyHandler'); -goog.require('goog.events.KeyHandler.EventType'); -goog.require('goog.events.MouseWheelHandler'); -goog.require('goog.events.MouseWheelHandler.EventType'); -goog.require('goog.functions'); -goog.require('goog.log'); -goog.require('goog.log.Level'); -goog.require('goog.object'); -goog.require('goog.style'); -goog.require('goog.vec.Mat4'); -goog.require('ol.Collection'); -goog.require('ol.CollectionEventType'); -goog.require('ol.MapBrowserEvent'); -goog.require('ol.MapBrowserEvent.EventType'); -goog.require('ol.MapBrowserEventHandler'); -goog.require('ol.MapEvent'); -goog.require('ol.MapEventType'); -goog.require('ol.Object'); -goog.require('ol.ObjectEvent'); -goog.require('ol.ObjectEventType'); -goog.require('ol.Pixel'); -goog.require('ol.PostRenderFunction'); -goog.require('ol.PreRenderFunction'); -goog.require('ol.RendererType'); -goog.require('ol.Size'); -goog.require('ol.TileQueue'); -goog.require('ol.View'); -goog.require('ol.ViewHint'); -goog.require('ol.control'); -goog.require('ol.extent'); -goog.require('ol.has'); -goog.require('ol.interaction'); -goog.require('ol.layer.Base'); -goog.require('ol.layer.Group'); -goog.require('ol.proj'); -goog.require('ol.proj.common'); -goog.require('ol.renderer.Map'); -goog.require('ol.renderer.canvas.Map'); -goog.require('ol.renderer.dom.Map'); -goog.require('ol.renderer.webgl.Map'); -goog.require('ol.size'); -goog.require('ol.structs.PriorityQueue'); -goog.require('ol.tilecoord'); -goog.require('ol.vec.Mat4'); - - -/** - * @const - * @type {string} - */ -ol.OL3_URL = 'http://openlayers.org/'; - - -/** - * @const - * @type {string} - */ -ol.OL3_LOGO_URL = 'data:image/png;base64,' + - 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBI' + - 'WXMAAAHGAAABxgEXwfpGAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAA' + - 'AhNQTFRF////AP//AICAgP//AFVVQECA////K1VVSbbbYL/fJ05idsTYJFtbbcjbJllmZszW' + - 'WMTOIFhoHlNiZszTa9DdUcHNHlNlV8XRIVdiasrUHlZjIVZjaMnVH1RlIFRkH1RkH1ZlasvY' + - 'asvXVsPQH1VkacnVa8vWIVZjIFRjVMPQa8rXIVVkXsXRsNveIFVkIFZlIVVj3eDeh6GmbMvX' + - 'H1ZkIFRka8rWbMvXIFVkIFVjIFVkbMvWH1VjbMvWIFVlbcvWIFVla8vVIFVkbMvWbMvVH1Vk' + - 'bMvWIFVlbcvWIFVkbcvVbMvWjNPbIFVkU8LPwMzNIFVkbczWIFVkbsvWbMvXIFVkRnB8bcvW' + - '2+TkW8XRIFVkIlZlJVloJlpoKlxrLl9tMmJwOWd0Omh1RXF8TneCT3iDUHiDU8LPVMLPVcLP' + - 'VcPQVsPPVsPQV8PQWMTQWsTQW8TQXMXSXsXRX4SNX8bSYMfTYcfTYsfTY8jUZcfSZsnUaIqT' + - 'acrVasrVa8jTa8rWbI2VbMvWbcvWdJObdcvUdszUd8vVeJaee87Yfc3WgJyjhqGnitDYjaar' + - 'ldPZnrK2oNbborW5o9bbo9fbpLa6q9ndrL3ArtndscDDutzfu8fJwN7gwt7gxc/QyuHhy+Hi' + - 'zeHi0NfX0+Pj19zb1+Tj2uXk29/e3uLg3+Lh3+bl4uXj4ufl4+fl5Ofl5ufl5ujm5+jmySDn' + - 'BAAAAFp0Uk5TAAECAgMEBAYHCA0NDg4UGRogIiMmKSssLzU7PkJJT1JTVFliY2hrdHZ3foSF' + - 'hYeJjY2QkpugqbG1tre5w8zQ09XY3uXn6+zx8vT09vf4+Pj5+fr6/P39/f3+gz7SsAAAAVVJ' + - 'REFUOMtjYKA7EBDnwCPLrObS1BRiLoJLnte6CQy8FLHLCzs2QUG4FjZ5GbcmBDDjxJBXDWxC' + - 'Brb8aM4zbkIDzpLYnAcE9VXlJSWlZRU13koIeW57mGx5XjoMZEUqwxWYQaQbSzLSkYGfKFSe' + - '0QMsX5WbjgY0YS4MBplemI4BdGBW+DQ11eZiymfqQuXZIjqwyadPNoSZ4L+0FVM6e+oGI6g8' + - 'a9iKNT3o8kVzNkzRg5lgl7p4wyRUL9Yt2jAxVh6mQCogae6GmflI8p0r13VFWTHBQ0rWPW7a' + - 'hgWVcPm+9cuLoyy4kCJDzCm6d8PSFoh0zvQNC5OjDJhQopPPJqph1doJBUD5tnkbZiUEqaCn' + - 'B3bTqLTFG1bPn71kw4b+GFdpLElKIzRxxgYgWNYc5SCENVHKeUaltHdXx0dZ8uBI1hJ2UUDg' + - 'q82CM2MwKeibqAvSO7MCABq0wXEPiqWEAAAAAElFTkSuQmCC'; - - -/** - * @type {Array.<ol.RendererType>} - * @const - */ -ol.DEFAULT_RENDERER_TYPES = [ - ol.RendererType.CANVAS, - ol.RendererType.WEBGL, - ol.RendererType.DOM -]; - - -/** - * @enum {string} - */ -ol.MapProperty = { - LAYERGROUP: 'layergroup', - SIZE: 'size', - TARGET: 'target', - VIEW: 'view' -}; - - - -/** - * @classdesc - * The map is the core component of OpenLayers. For a map to render, a view, - * one or more layers, and a target container are needed: - * - * var map = new ol.Map({ - * view: new ol.View({ - * center: [0, 0], - * zoom: 1 - * }), - * layers: [ - * new ol.layer.Tile({ - * source: new ol.source.MapQuest({layer: 'osm'}) - * }) - * ], - * target: 'map' - * }); - * - * The above snippet creates a map using a {@link ol.layer.Tile} to display - * {@link ol.source.MapQuest} OSM data and render it to a DOM element with the - * id `map`. - * - * The constructor places a viewport container (with CSS class name - * `ol-viewport`) in the target element (see `getViewport()`), and then two - * further elements within the viewport: one with CSS class name - * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with - * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent` - * option of {@link ol.Overlay} for the difference). The map itself is placed in - * a further element within the viewport, either DOM or Canvas, depending on the - * renderer. - * - * Layers are stored as a `ol.Collection` in layerGroups. A top-level group is - * provided by the library. This is what is accessed by `getLayerGroup` and - * `setLayerGroup`. Layers entered in the options are added to this group, and - * `addLayer` and `removeLayer` change the layer collection in the group. - * `getLayers` is a convenience function for `getLayerGroup().getLayers()`. - * Note that `ol.layer.Group` is a subclass of `ol.layer.Base`, so layers - * entered in the options or added with `addLayer` can be groups, which can - * contain further groups, and so on. - * - * @constructor - * @extends {ol.Object} - * @param {olx.MapOptions} options Map options. - * @fires ol.MapBrowserEvent - * @fires ol.MapEvent - * @fires ol.render.Event#postcompose - * @fires ol.render.Event#precompose - * @api stable - */ -ol.Map = function(options) { - - goog.base(this); - - var optionsInternal = ol.Map.createOptionsInternal(options); - - /** - * @type {boolean} - * @private - */ - this.loadTilesWhileAnimating_ = - options.loadTilesWhileAnimating !== undefined ? - options.loadTilesWhileAnimating : false; - - /** - * @type {boolean} - * @private - */ - this.loadTilesWhileInteracting_ = - options.loadTilesWhileInteracting !== undefined ? - options.loadTilesWhileInteracting : false; - - /** - * @private - * @type {number} - */ - this.pixelRatio_ = options.pixelRatio !== undefined ? - options.pixelRatio : ol.has.DEVICE_PIXEL_RATIO; - - /** - * @private - * @type {Object.<string, string>} - */ - this.logos_ = optionsInternal.logos; - - /** - * @private - * @type {goog.async.AnimationDelay} - */ - this.animationDelay_ = - new goog.async.AnimationDelay(this.renderFrame_, undefined, this); - this.registerDisposable(this.animationDelay_); - - /** - * @private - * @type {goog.vec.Mat4.Number} - */ - this.coordinateToPixelMatrix_ = goog.vec.Mat4.createNumber(); - - /** - * @private - * @type {goog.vec.Mat4.Number} - */ - this.pixelToCoordinateMatrix_ = goog.vec.Mat4.createNumber(); - - /** - * @private - * @type {number} - */ - this.frameIndex_ = 0; - - /** - * @private - * @type {?olx.FrameState} - */ - this.frameState_ = null; - - /** - * The extent at the previous 'moveend' event. - * @private - * @type {ol.Extent} - */ - this.previousExtent_ = ol.extent.createEmpty(); - - /** - * @private - * @type {goog.events.Key} - */ - this.viewPropertyListenerKey_ = null; - - /** - * @private - * @type {Array.<goog.events.Key>} - */ - this.layerGroupPropertyListenerKeys_ = null; - - /** - * @private - * @type {Element} - */ - this.viewport_ = goog.dom.createDom('DIV', 'ol-viewport'); - this.viewport_.style.position = 'relative'; - this.viewport_.style.overflow = 'hidden'; - this.viewport_.style.width = '100%'; - this.viewport_.style.height = '100%'; - // prevent page zoom on IE >= 10 browsers - this.viewport_.style.msTouchAction = 'none'; - this.viewport_.style.touchAction = 'none'; - if (ol.has.TOUCH) { - goog.dom.classlist.add(this.viewport_, 'ol-touch'); - } - - /** - * @private - * @type {Element} - */ - this.overlayContainer_ = goog.dom.createDom('DIV', - 'ol-overlaycontainer'); - this.viewport_.appendChild(this.overlayContainer_); - - /** - * @private - * @type {Element} - */ - this.overlayContainerStopEvent_ = goog.dom.createDom('DIV', - 'ol-overlaycontainer-stopevent'); - goog.events.listen(this.overlayContainerStopEvent_, [ - goog.events.EventType.CLICK, - goog.events.EventType.DBLCLICK, - goog.events.EventType.MOUSEDOWN, - goog.events.EventType.TOUCHSTART, - goog.events.EventType.MSPOINTERDOWN, - ol.MapBrowserEvent.EventType.POINTERDOWN, - goog.userAgent.GECKO ? 'DOMMouseScroll' : 'mousewheel' - ], goog.events.Event.stopPropagation); - this.viewport_.appendChild(this.overlayContainerStopEvent_); - - var mapBrowserEventHandler = new ol.MapBrowserEventHandler(this); - goog.events.listen(mapBrowserEventHandler, - goog.object.getValues(ol.MapBrowserEvent.EventType), - this.handleMapBrowserEvent, false, this); - this.registerDisposable(mapBrowserEventHandler); - - /** - * @private - * @type {Element|Document} - */ - this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget; - - /** - * @private - * @type {goog.events.KeyHandler} - */ - this.keyHandler_ = new goog.events.KeyHandler(); - goog.events.listen(this.keyHandler_, goog.events.KeyHandler.EventType.KEY, - this.handleBrowserEvent, false, this); - this.registerDisposable(this.keyHandler_); - - var mouseWheelHandler = new goog.events.MouseWheelHandler(this.viewport_); - goog.events.listen(mouseWheelHandler, - goog.events.MouseWheelHandler.EventType.MOUSEWHEEL, - this.handleBrowserEvent, false, this); - this.registerDisposable(mouseWheelHandler); - - /** - * @type {ol.Collection.<ol.control.Control>} - * @private - */ - this.controls_ = optionsInternal.controls; - - /** - * @type {ol.Collection.<ol.interaction.Interaction>} - * @private - */ - this.interactions_ = optionsInternal.interactions; - - /** - * @type {ol.Collection.<ol.Overlay>} - * @private - */ - this.overlays_ = optionsInternal.overlays; - - /** - * A lookup of overlays by id. - * @private - * @type {Object.<string, ol.Overlay>} - */ - this.overlayIdIndex_ = {}; - - /** - * @type {ol.renderer.Map} - * @private - */ - this.renderer_ = - new optionsInternal.rendererConstructor(this.viewport_, this); - this.registerDisposable(this.renderer_); - - /** - * @type {goog.dom.ViewportSizeMonitor} - * @private - */ - this.viewportSizeMonitor_ = new goog.dom.ViewportSizeMonitor(); - this.registerDisposable(this.viewportSizeMonitor_); - - /** - * @type {goog.events.Key} - * @private - */ - this.viewportResizeListenerKey_ = null; - - /** - * @private - * @type {ol.Coordinate} - */ - this.focus_ = null; - - /** - * @private - * @type {Array.<ol.PreRenderFunction>} - */ - this.preRenderFunctions_ = []; - - /** - * @private - * @type {Array.<ol.PostRenderFunction>} - */ - this.postRenderFunctions_ = []; - - /** - * @private - * @type {ol.TileQueue} - */ - this.tileQueue_ = new ol.TileQueue( - goog.bind(this.getTilePriority, this), - goog.bind(this.handleTileChange_, this)); - - /** - * Uids of features to skip at rendering time. - * @type {Object.<string, boolean>} - * @private - */ - this.skippedFeatureUids_ = {}; - - goog.events.listen( - this, ol.Object.getChangeEventType(ol.MapProperty.LAYERGROUP), - this.handleLayerGroupChanged_, false, this); - goog.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.VIEW), - this.handleViewChanged_, false, this); - goog.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.SIZE), - this.handleSizeChanged_, false, this); - goog.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.TARGET), - this.handleTargetChanged_, false, this); - - // setProperties will trigger the rendering of the map if the map - // is "defined" already. - this.setProperties(optionsInternal.values); - - this.controls_.forEach( - /** - * @param {ol.control.Control} control Control. - * @this {ol.Map} - */ - function(control) { - control.setMap(this); - }, this); - - goog.events.listen(this.controls_, ol.CollectionEventType.ADD, - /** - * @param {ol.CollectionEvent} event Collection event. - */ - function(event) { - event.element.setMap(this); - }, false, this); - - goog.events.listen(this.controls_, ol.CollectionEventType.REMOVE, - /** - * @param {ol.CollectionEvent} event Collection event. - */ - function(event) { - event.element.setMap(null); - }, false, this); - - this.interactions_.forEach( - /** - * @param {ol.interaction.Interaction} interaction Interaction. - * @this {ol.Map} - */ - function(interaction) { - interaction.setMap(this); - }, this); - - goog.events.listen(this.interactions_, ol.CollectionEventType.ADD, - /** - * @param {ol.CollectionEvent} event Collection event. - */ - function(event) { - event.element.setMap(this); - }, false, this); - - goog.events.listen(this.interactions_, ol.CollectionEventType.REMOVE, - /** - * @param {ol.CollectionEvent} event Collection event. - */ - function(event) { - event.element.setMap(null); - }, false, this); - - this.overlays_.forEach(this.addOverlayInternal_, this); - - goog.events.listen(this.overlays_, ol.CollectionEventType.ADD, - /** - * @param {ol.CollectionEvent} event Collection event. - */ - function(event) { - this.addOverlayInternal_(/** @type {ol.Overlay} */ (event.element)); - }, false, this); - - goog.events.listen(this.overlays_, ol.CollectionEventType.REMOVE, - /** - * @param {ol.CollectionEvent} event Collection event. - */ - function(event) { - var id = event.element.getId(); - if (id !== undefined) { - delete this.overlayIdIndex_[id.toString()]; - } - event.element.setMap(null); - }, false, this); - -}; -goog.inherits(ol.Map, ol.Object); - - -/** - * Add the given control to the map. - * @param {ol.control.Control} control Control. - * @api stable - */ -ol.Map.prototype.addControl = function(control) { - var controls = this.getControls(); - goog.asserts.assert(controls !== undefined, 'controls should be defined'); - controls.push(control); -}; - - -/** - * Add the given interaction to the map. - * @param {ol.interaction.Interaction} interaction Interaction to add. - * @api stable - */ -ol.Map.prototype.addInteraction = function(interaction) { - var interactions = this.getInteractions(); - goog.asserts.assert(interactions !== undefined, - 'interactions should be defined'); - interactions.push(interaction); -}; - - -/** - * Adds the given layer to the top of this map. If you want to add a layer - * elsewhere in the stack, use `getLayers()` and the methods available on - * {@link ol.Collection}. - * @param {ol.layer.Base} layer Layer. - * @api stable - */ -ol.Map.prototype.addLayer = function(layer) { - var layers = this.getLayerGroup().getLayers(); - layers.push(layer); -}; - - -/** - * Add the given overlay to the map. - * @param {ol.Overlay} overlay Overlay. - * @api stable - */ -ol.Map.prototype.addOverlay = function(overlay) { - var overlays = this.getOverlays(); - goog.asserts.assert(overlays !== undefined, 'overlays should be defined'); - overlays.push(overlay); -}; - - -/** - * This deals with map's overlay collection changes. - * @param {ol.Overlay} overlay Overlay. - * @private - */ -ol.Map.prototype.addOverlayInternal_ = function(overlay) { - var id = overlay.getId(); - if (id !== undefined) { - this.overlayIdIndex_[id.toString()] = overlay; - } - overlay.setMap(this); -}; - - -/** - * Add functions to be called before rendering. This can be used for attaching - * animations before updating the map's view. The {@link ol.animation} - * namespace provides several static methods for creating prerender functions. - * @param {...ol.PreRenderFunction} var_args Any number of pre-render functions. - * @api - */ -ol.Map.prototype.beforeRender = function(var_args) { - this.render(); - Array.prototype.push.apply(this.preRenderFunctions_, arguments); -}; - - -/** - * @param {ol.PreRenderFunction} preRenderFunction Pre-render function. - * @return {boolean} Whether the preRenderFunction has been found and removed. - */ -ol.Map.prototype.removePreRenderFunction = function(preRenderFunction) { - return goog.array.remove(this.preRenderFunctions_, preRenderFunction); -}; - - -/** - * - * @inheritDoc - */ -ol.Map.prototype.disposeInternal = function() { - goog.dom.removeNode(this.viewport_); - goog.base(this, 'disposeInternal'); -}; - - -/** - * Detect features that intersect a pixel on the viewport, and execute a - * callback with each intersecting feature. Layers included in the detection can - * be configured through `opt_layerFilter`. - * @param {ol.Pixel} pixel Pixel. - * @param {function(this: S, (ol.Feature|ol.render.Feature), - * ol.layer.Layer): T} callback Feature callback. The callback will be - * called with two arguments. The first argument is one - * {@link ol.Feature feature} or - * {@link ol.render.Feature render feature} at the pixel, the second is - * the {@link ol.layer.Layer layer} of the feature and will be null for - * unmanaged layers. To stop detection, callback functions can return a - * truthy value. - * @param {S=} opt_this Value to use as `this` when executing `callback`. - * @param {(function(this: U, ol.layer.Layer): boolean)=} opt_layerFilter Layer - * filter function. The filter function will receive one argument, the - * {@link ol.layer.Layer layer-candidate} and it should return a boolean - * value. Only layers which are visible and for which this function returns - * `true` will be tested for features. By default, all visible layers will - * be tested. - * @param {U=} opt_this2 Value to use as `this` when executing `layerFilter`. - * @return {T|undefined} Callback result, i.e. the return value of last - * callback execution, or the first truthy callback return value. - * @template S,T,U - * @api stable - */ -ol.Map.prototype.forEachFeatureAtPixel = - function(pixel, callback, opt_this, opt_layerFilter, opt_this2) { - if (!this.frameState_) { - return; - } - var coordinate = this.getCoordinateFromPixel(pixel); - var thisArg = opt_this !== undefined ? opt_this : null; - var layerFilter = opt_layerFilter !== undefined ? - opt_layerFilter : goog.functions.TRUE; - var thisArg2 = opt_this2 !== undefined ? opt_this2 : null; - return this.renderer_.forEachFeatureAtCoordinate( - coordinate, this.frameState_, callback, thisArg, - layerFilter, thisArg2); -}; - - -/** - * Detect layers that have a color value at a pixel on the viewport, and - * execute a callback with each matching layer. Layers included in the - * detection can be configured through `opt_layerFilter`. - * @param {ol.Pixel} pixel Pixel. - * @param {function(this: S, ol.layer.Layer): T} callback Layer - * callback. Will receive one argument, the {@link ol.layer.Layer layer} - * that contains the color pixel. To stop detection, callback functions can - * return a truthy value. - * @param {S=} opt_this Value to use as `this` when executing `callback`. - * @param {(function(this: U, ol.layer.Layer): boolean)=} opt_layerFilter Layer - * filter function. The filter function will receive one argument, the - * {@link ol.layer.Layer layer-candidate} and it should return a boolean - * value. Only layers which are visible and for which this function returns - * `true` will be tested for features. By default, all visible layers will - * be tested. - * @param {U=} opt_this2 Value to use as `this` when executing `layerFilter`. - * @return {T|undefined} Callback result, i.e. the return value of last - * callback execution, or the first truthy callback return value. - * @template S,T,U - * @api stable - */ -ol.Map.prototype.forEachLayerAtPixel = - function(pixel, callback, opt_this, opt_layerFilter, opt_this2) { - if (!this.frameState_) { - return; - } - var thisArg = opt_this !== undefined ? opt_this : null; - var layerFilter = opt_layerFilter !== undefined ? - opt_layerFilter : goog.functions.TRUE; - var thisArg2 = opt_this2 !== undefined ? opt_this2 : null; - return this.renderer_.forEachLayerAtPixel( - pixel, this.frameState_, callback, thisArg, - layerFilter, thisArg2); -}; - - -/** - * Detect if features intersect a pixel on the viewport. Layers included in the - * detection can be configured through `opt_layerFilter`. - * @param {ol.Pixel} pixel Pixel. - * @param {(function(this: U, ol.layer.Layer): boolean)=} opt_layerFilter Layer - * filter function. The filter function will receive one argument, the - * {@link ol.layer.Layer layer-candidate} and it should return a boolean - * value. Only layers which are visible and for which this function returns - * `true` will be tested for features. By default, all visible layers will - * be tested. - * @param {U=} opt_this Value to use as `this` when executing `layerFilter`. - * @return {boolean} Is there a feature at the given pixel? - * @template U - * @api - */ -ol.Map.prototype.hasFeatureAtPixel = - function(pixel, opt_layerFilter, opt_this) { - if (!this.frameState_) { - return false; - } - var coordinate = this.getCoordinateFromPixel(pixel); - var layerFilter = opt_layerFilter !== undefined ? - opt_layerFilter : goog.functions.TRUE; - var thisArg = opt_this !== undefined ? opt_this : null; - return this.renderer_.hasFeatureAtCoordinate( - coordinate, this.frameState_, layerFilter, thisArg); -}; - - -/** - * Returns the geographical coordinate for a browser event. - * @param {Event} event Event. - * @return {ol.Coordinate} Coordinate. - * @api stable - */ -ol.Map.prototype.getEventCoordinate = function(event) { - return this.getCoordinateFromPixel(this.getEventPixel(event)); -}; - - -/** - * Returns the map pixel position for a browser event relative to the viewport. - * @param {Event} event Event. - * @return {ol.Pixel} Pixel. - * @api stable - */ -ol.Map.prototype.getEventPixel = function(event) { - var eventPosition = goog.style.getRelativePosition(event, this.viewport_); - return [eventPosition.x, eventPosition.y]; -}; - - -/** - * Get the target in which this map is rendered. - * Note that this returns what is entered as an option or in setTarget: - * if that was an element, it returns an element; if a string, it returns that. - * @return {Element|string|undefined} The Element or id of the Element that the - * map is rendered in. - * @observable - * @api stable - */ -ol.Map.prototype.getTarget = function() { - return /** @type {Element|string|undefined} */ ( - this.get(ol.MapProperty.TARGET)); -}; - - -/** - * Get the DOM element into which this map is rendered. In contrast to - * `getTarget` this method always return an `Element`, or `null` if the - * map has no target. - * @return {Element} The element that the map is rendered in. - * @api - */ -ol.Map.prototype.getTargetElement = function() { - var target = this.getTarget(); - return target !== undefined ? goog.dom.getElement(target) : null; -}; - - -/** - * Get the coordinate for a given pixel. This returns a coordinate in the - * map view projection. - * @param {ol.Pixel} pixel Pixel position in the map viewport. - * @return {ol.Coordinate} The coordinate for the pixel position. - * @api stable - */ -ol.Map.prototype.getCoordinateFromPixel = function(pixel) { - var frameState = this.frameState_; - if (!frameState) { - return null; - } else { - var vec2 = pixel.slice(); - return ol.vec.Mat4.multVec2(frameState.pixelToCoordinateMatrix, vec2, vec2); - } -}; - - -/** - * Get the map controls. Modifying this collection changes the controls - * associated with the map. - * @return {ol.Collection.<ol.control.Control>} Controls. - * @api stable - */ -ol.Map.prototype.getControls = function() { - return this.controls_; -}; - - -/** - * Get the map overlays. Modifying this collection changes the overlays - * associated with the map. - * @return {ol.Collection.<ol.Overlay>} Overlays. - * @api stable - */ -ol.Map.prototype.getOverlays = function() { - return this.overlays_; -}; - - -/** - * Get an overlay by its identifier (the value returned by overlay.getId()). - * Note that the index treats string and numeric identifiers as the same. So - * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`. - * @param {string|number} id Overlay identifier. - * @return {ol.Overlay} Overlay. - * @api - */ -ol.Map.prototype.getOverlayById = function(id) { - var overlay = this.overlayIdIndex_[id.toString()]; - return overlay !== undefined ? overlay : null; -}; - - -/** - * Get the map interactions. Modifying this collection changes the interactions - * associated with the map. - * - * Interactions are used for e.g. pan, zoom and rotate. - * @return {ol.Collection.<ol.interaction.Interaction>} Interactions. - * @api stable - */ -ol.Map.prototype.getInteractions = function() { - return this.interactions_; -}; - - -/** - * Get the layergroup associated with this map. - * @return {ol.layer.Group} A layer group containing the layers in this map. - * @observable - * @api stable - */ -ol.Map.prototype.getLayerGroup = function() { - return /** @type {ol.layer.Group} */ (this.get(ol.MapProperty.LAYERGROUP)); -}; - - -/** - * Get the collection of layers associated with this map. - * @return {!ol.Collection.<ol.layer.Base>} Layers. - * @api stable - */ -ol.Map.prototype.getLayers = function() { - var layers = this.getLayerGroup().getLayers(); - return layers; -}; - - -/** - * Get the pixel for a coordinate. This takes a coordinate in the map view - * projection and returns the corresponding pixel. - * @param {ol.Coordinate} coordinate A map coordinate. - * @return {ol.Pixel} A pixel position in the map viewport. - * @api stable - */ -ol.Map.prototype.getPixelFromCoordinate = function(coordinate) { - var frameState = this.frameState_; - if (!frameState) { - return null; - } else { - var vec2 = coordinate.slice(0, 2); - return ol.vec.Mat4.multVec2(frameState.coordinateToPixelMatrix, vec2, vec2); - } -}; - - -/** - * Get the map renderer. - * @return {ol.renderer.Map} Renderer - */ -ol.Map.prototype.getRenderer = function() { - return this.renderer_; -}; - - -/** - * Get the size of this map. - * @return {ol.Size|undefined} The size in pixels of the map in the DOM. - * @observable - * @api stable - */ -ol.Map.prototype.getSize = function() { - return /** @type {ol.Size|undefined} */ (this.get(ol.MapProperty.SIZE)); -}; - - -/** - * Get the view associated with this map. A view manages properties such as - * center and resolution. - * @return {ol.View} The view that controls this map. - * @observable - * @api stable - */ -ol.Map.prototype.getView = function() { - return /** @type {ol.View} */ (this.get(ol.MapProperty.VIEW)); -}; - - -/** - * Get the element that serves as the map viewport. - * @return {Element} Viewport. - * @api stable - */ -ol.Map.prototype.getViewport = function() { - return this.viewport_; -}; - - -/** - * Get the element that serves as the container for overlays. Elements added to - * this container will let mousedown and touchstart events through to the map, - * so clicks and gestures on an overlay will trigger {@link ol.MapBrowserEvent} - * events. - * @return {Element} The map's overlay container. - */ -ol.Map.prototype.getOverlayContainer = function() { - return this.overlayContainer_; -}; - - -/** - * Get the element that serves as a container for overlays that don't allow - * event propagation. Elements added to this container won't let mousedown and - * touchstart events through to the map, so clicks and gestures on an overlay - * don't trigger any {@link ol.MapBrowserEvent}. - * @return {Element} The map's overlay container that stops events. - */ -ol.Map.prototype.getOverlayContainerStopEvent = function() { - return this.overlayContainerStopEvent_; -}; - - -/** - * @param {ol.Tile} tile Tile. - * @param {string} tileSourceKey Tile source key. - * @param {ol.Coordinate} tileCenter Tile center. - * @param {number} tileResolution Tile resolution. - * @return {number} Tile priority. - */ -ol.Map.prototype.getTilePriority = - function(tile, tileSourceKey, tileCenter, tileResolution) { - // Filter out tiles at higher zoom levels than the current zoom level, or that - // are outside the visible extent. - var frameState = this.frameState_; - if (!frameState || !(tileSourceKey in frameState.wantedTiles)) { - return ol.structs.PriorityQueue.DROP; - } - var coordKey = ol.tilecoord.toString(tile.tileCoord); - if (!frameState.wantedTiles[tileSourceKey][coordKey]) { - return ol.structs.PriorityQueue.DROP; - } - // Prioritize the highest zoom level tiles closest to the focus. - // Tiles at higher zoom levels are prioritized using Math.log(tileResolution). - // Within a zoom level, tiles are prioritized by the distance in pixels - // between the center of the tile and the focus. The factor of 65536 means - // that the prioritization should behave as desired for tiles up to - // 65536 * Math.log(2) = 45426 pixels from the focus. - var deltaX = tileCenter[0] - frameState.focus[0]; - var deltaY = tileCenter[1] - frameState.focus[1]; - return 65536 * Math.log(tileResolution) + - Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution; -}; - - -/** - * @param {goog.events.BrowserEvent} browserEvent Browser event. - * @param {string=} opt_type Type. - */ -ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) { - var type = opt_type || browserEvent.type; - var mapBrowserEvent = new ol.MapBrowserEvent(type, this, browserEvent); - this.handleMapBrowserEvent(mapBrowserEvent); -}; - - -/** - * @param {ol.MapBrowserEvent} mapBrowserEvent The event to handle. - */ -ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) { - if (!this.frameState_) { - // With no view defined, we cannot translate pixels into geographical - // coordinates so interactions cannot be used. - return; - } - this.focus_ = mapBrowserEvent.coordinate; - mapBrowserEvent.frameState = this.frameState_; - var interactions = this.getInteractions(); - goog.asserts.assert(interactions !== undefined, - 'interactions should be defined'); - var interactionsArray = interactions.getArray(); - var i; - if (this.dispatchEvent(mapBrowserEvent) !== false) { - for (i = interactionsArray.length - 1; i >= 0; i--) { - var interaction = interactionsArray[i]; - if (!interaction.getActive()) { - continue; - } - var cont = interaction.handleEvent(mapBrowserEvent); - if (!cont) { - break; - } - } - } -}; - - -/** - * @protected - */ -ol.Map.prototype.handlePostRender = function() { - - var frameState = this.frameState_; - - // Manage the tile queue - // Image loads are expensive and a limited resource, so try to use them - // efficiently: - // * When the view is static we allow a large number of parallel tile loads - // to complete the frame as quickly as possible. - // * When animating or interacting, image loads can cause janks, so we reduce - // the maximum number of loads per frame and limit the number of parallel - // tile loads to remain reactive to view changes and to reduce the chance of - // loading tiles that will quickly disappear from view. - var tileQueue = this.tileQueue_; - if (!tileQueue.isEmpty()) { - var maxTotalLoading = 16; - var maxNewLoads = maxTotalLoading; - var tileSourceCount = 0; - if (frameState) { - var hints = frameState.viewHints; - if (hints[ol.ViewHint.ANIMATING]) { - maxTotalLoading = this.loadTilesWhileAnimating_ ? 8 : 0; - maxNewLoads = 2; - } - if (hints[ol.ViewHint.INTERACTING]) { - maxTotalLoading = this.loadTilesWhileInteracting_ ? 8 : 0; - maxNewLoads = 2; - } - tileSourceCount = goog.object.getCount(frameState.wantedTiles); - } - maxTotalLoading *= tileSourceCount; - maxNewLoads *= tileSourceCount; - if (tileQueue.getTilesLoading() < maxTotalLoading) { - tileQueue.reprioritize(); // FIXME only call if view has changed - tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads); - } - } - - var postRenderFunctions = this.postRenderFunctions_; - var i, ii; - for (i = 0, ii = postRenderFunctions.length; i < ii; ++i) { - postRenderFunctions[i](this, frameState); - } - postRenderFunctions.length = 0; -}; - - -/** - * @private - */ -ol.Map.prototype.handleSizeChanged_ = function() { - this.render(); -}; - - -/** - * @private - */ -ol.Map.prototype.handleTargetChanged_ = function() { - // target may be undefined, null, a string or an Element. - // If it's a string we convert it to an Element before proceeding. - // If it's not now an Element we remove the viewport from the DOM. - // If it's an Element we append the viewport element to it. - - var targetElement = this.getTargetElement(); - - this.keyHandler_.detach(); - - if (!targetElement) { - goog.dom.removeNode(this.viewport_); - if (this.viewportResizeListenerKey_) { - goog.events.unlistenByKey(this.viewportResizeListenerKey_); - this.viewportResizeListenerKey_ = null; - } - } else { - targetElement.appendChild(this.viewport_); - - var keyboardEventTarget = !this.keyboardEventTarget_ ? - targetElement : this.keyboardEventTarget_; - this.keyHandler_.attach(keyboardEventTarget); - - if (!this.viewportResizeListenerKey_) { - this.viewportResizeListenerKey_ = goog.events.listen( - this.viewportSizeMonitor_, goog.events.EventType.RESIZE, - this.updateSize, false, this); - } - } - - this.updateSize(); - // updateSize calls setSize, so no need to call this.render - // ourselves here. -}; - - -/** - * @private - */ -ol.Map.prototype.handleTileChange_ = function() { - this.render(); -}; - - -/** - * @private - */ -ol.Map.prototype.handleViewPropertyChanged_ = function() { - this.render(); -}; - - -/** - * @private - */ -ol.Map.prototype.handleViewChanged_ = function() { - if (this.viewPropertyListenerKey_) { - goog.events.unlistenByKey(this.viewPropertyListenerKey_); - this.viewPropertyListenerKey_ = null; - } - var view = this.getView(); - if (view) { - this.viewPropertyListenerKey_ = goog.events.listen( - view, ol.ObjectEventType.PROPERTYCHANGE, - this.handleViewPropertyChanged_, false, this); - } - this.render(); -}; - - -/** - * @param {goog.events.Event} event Event. - * @private - */ -ol.Map.prototype.handleLayerGroupMemberChanged_ = function(event) { - goog.asserts.assertInstanceof(event, goog.events.Event, - 'event should be an Event'); - this.render(); -}; - - -/** - * @param {ol.ObjectEvent} event Event. - * @private - */ -ol.Map.prototype.handleLayerGroupPropertyChanged_ = function(event) { - goog.asserts.assertInstanceof(event, ol.ObjectEvent, - 'event should be an ol.ObjectEvent'); - this.render(); -}; - - -/** - * @private - */ -ol.Map.prototype.handleLayerGroupChanged_ = function() { - if (this.layerGroupPropertyListenerKeys_) { - this.layerGroupPropertyListenerKeys_.forEach(goog.events.unlistenByKey); - this.layerGroupPropertyListenerKeys_ = null; - } - var layerGroup = this.getLayerGroup(); - if (layerGroup) { - this.layerGroupPropertyListenerKeys_ = [ - goog.events.listen( - layerGroup, ol.ObjectEventType.PROPERTYCHANGE, - this.handleLayerGroupPropertyChanged_, false, this), - goog.events.listen( - layerGroup, goog.events.EventType.CHANGE, - this.handleLayerGroupMemberChanged_, false, this) - ]; - } - this.render(); -}; - - -/** - * Returns `true` if the map is defined, `false` otherwise. The map is defined - * if it is contained in `document`, visible, has non-zero height and width, and - * has a defined view. - * @return {boolean} Is defined. - */ -ol.Map.prototype.isDef = function() { - if (!goog.dom.contains(document, this.viewport_)) { - return false; - } - if (!goog.style.isElementShown(this.viewport_)) { - return false; - } - var size = this.getSize(); - if (!size || size[0] <= 0 || size[1] <= 0) { - return false; - } - var view = this.getView(); - if (!view || !view.isDef()) { - return false; - } - return true; -}; - - -/** - * @return {boolean} Is rendered. - */ -ol.Map.prototype.isRendered = function() { - return !!this.frameState_; -}; - - -/** - * Requests an immediate render in a synchronous manner. - * @api stable - */ -ol.Map.prototype.renderSync = function() { - this.animationDelay_.fire(); -}; - - -/** - * Request a map rendering (at the next animation frame). - * @api stable - */ -ol.Map.prototype.render = function() { - if (!this.animationDelay_.isActive()) { - this.animationDelay_.start(); - } -}; - - -/** - * Remove the given control from the map. - * @param {ol.control.Control} control Control. - * @return {ol.control.Control|undefined} The removed control (or undefined - * if the control was not found). - * @api stable - */ -ol.Map.prototype.removeControl = function(control) { - var controls = this.getControls(); - goog.asserts.assert(controls !== undefined, 'controls should be defined'); - return controls.remove(control); -}; - - -/** - * Remove the given interaction from the map. - * @param {ol.interaction.Interaction} interaction Interaction to remove. - * @return {ol.interaction.Interaction|undefined} The removed interaction (or - * undefined if the interaction was not found). - * @api stable - */ -ol.Map.prototype.removeInteraction = function(interaction) { - var interactions = this.getInteractions(); - goog.asserts.assert(interactions !== undefined, - 'interactions should be defined'); - return interactions.remove(interaction); -}; - - -/** - * Removes the given layer from the map. - * @param {ol.layer.Base} layer Layer. - * @return {ol.layer.Base|undefined} The removed layer (or undefined if the - * layer was not found). - * @api stable - */ -ol.Map.prototype.removeLayer = function(layer) { - var layers = this.getLayerGroup().getLayers(); - return layers.remove(layer); -}; - - -/** - * Remove the given overlay from the map. - * @param {ol.Overlay} overlay Overlay. - * @return {ol.Overlay|undefined} The removed overlay (or undefined - * if the overlay was not found). - * @api stable - */ -ol.Map.prototype.removeOverlay = function(overlay) { - var overlays = this.getOverlays(); - goog.asserts.assert(overlays !== undefined, 'overlays should be defined'); - return overlays.remove(overlay); -}; - - -/** - * @param {number} time Time. - * @private - */ -ol.Map.prototype.renderFrame_ = function(time) { - - var i, ii, viewState; - - var size = this.getSize(); - var view = this.getView(); - /** @type {?olx.FrameState} */ - var frameState = null; - if (size !== undefined && ol.size.hasArea(size) && - view && view.isDef()) { - var viewHints = view.getHints(); - var layerStatesArray = this.getLayerGroup().getLayerStatesArray(); - var layerStates = {}; - for (i = 0, ii = layerStatesArray.length; i < ii; ++i) { - layerStates[goog.getUid(layerStatesArray[i].layer)] = layerStatesArray[i]; - } - viewState = view.getState(); - frameState = /** @type {olx.FrameState} */ ({ - animate: false, - attributions: {}, - coordinateToPixelMatrix: this.coordinateToPixelMatrix_, - extent: null, - focus: !this.focus_ ? viewState.center : this.focus_, - index: this.frameIndex_++, - layerStates: layerStates, - layerStatesArray: layerStatesArray, - logos: goog.object.clone(this.logos_), - pixelRatio: this.pixelRatio_, - pixelToCoordinateMatrix: this.pixelToCoordinateMatrix_, - postRenderFunctions: [], - size: size, - skippedFeatureUids: this.skippedFeatureUids_, - tileQueue: this.tileQueue_, - time: time, - usedTiles: {}, - viewState: viewState, - viewHints: viewHints, - wantedTiles: {} - }); - } - - if (frameState) { - var preRenderFunctions = this.preRenderFunctions_; - var n = 0, preRenderFunction; - for (i = 0, ii = preRenderFunctions.length; i < ii; ++i) { - preRenderFunction = preRenderFunctions[i]; - if (preRenderFunction(this, frameState)) { - preRenderFunctions[n++] = preRenderFunction; - } - } - preRenderFunctions.length = n; - - frameState.extent = ol.extent.getForViewAndSize(viewState.center, - viewState.resolution, viewState.rotation, frameState.size); - } - - this.frameState_ = frameState; - this.renderer_.renderFrame(frameState); - - if (frameState) { - if (frameState.animate) { - this.render(); - } - Array.prototype.push.apply( - this.postRenderFunctions_, frameState.postRenderFunctions); - - var idle = this.preRenderFunctions_.length === 0 && - !frameState.viewHints[ol.ViewHint.ANIMATING] && - !frameState.viewHints[ol.ViewHint.INTERACTING] && - !ol.extent.equals(frameState.extent, this.previousExtent_); - - if (idle) { - this.dispatchEvent( - new ol.MapEvent(ol.MapEventType.MOVEEND, this, frameState)); - ol.extent.clone(frameState.extent, this.previousExtent_); - } - } - - this.dispatchEvent( - new ol.MapEvent(ol.MapEventType.POSTRENDER, this, frameState)); - - goog.async.nextTick(this.handlePostRender, this); - -}; - - -/** - * Sets the layergroup of this map. - * @param {ol.layer.Group} layerGroup A layer group containing the layers in - * this map. - * @observable - * @api stable - */ -ol.Map.prototype.setLayerGroup = function(layerGroup) { - this.set(ol.MapProperty.LAYERGROUP, layerGroup); -}; - - -/** - * Set the size of this map. - * @param {ol.Size|undefined} size The size in pixels of the map in the DOM. - * @observable - * @api - */ -ol.Map.prototype.setSize = function(size) { - this.set(ol.MapProperty.SIZE, size); -}; - - -/** - * Set the target element to render this map into. - * @param {Element|string|undefined} target The Element or id of the Element - * that the map is rendered in. - * @observable - * @api stable - */ -ol.Map.prototype.setTarget = function(target) { - this.set(ol.MapProperty.TARGET, target); -}; - - -/** - * Set the view for this map. - * @param {ol.View} view The view that controls this map. - * @observable - * @api stable - */ -ol.Map.prototype.setView = function(view) { - this.set(ol.MapProperty.VIEW, view); -}; - - -/** - * @param {ol.Feature} feature Feature. - */ -ol.Map.prototype.skipFeature = function(feature) { - var featureUid = goog.getUid(feature).toString(); - this.skippedFeatureUids_[featureUid] = true; - this.render(); -}; - - -/** - * Force a recalculation of the map viewport size. This should be called when - * third-party code changes the size of the map viewport. - * @api stable - */ -ol.Map.prototype.updateSize = function() { - var targetElement = this.getTargetElement(); - - if (!targetElement) { - this.setSize(undefined); - } else { - var size = goog.style.getContentBoxSize(targetElement); - this.setSize([size.width, size.height]); - } -}; - - -/** - * @param {ol.Feature} feature Feature. - */ -ol.Map.prototype.unskipFeature = function(feature) { - var featureUid = goog.getUid(feature).toString(); - delete this.skippedFeatureUids_[featureUid]; - this.render(); -}; - - -/** - * @typedef {{controls: ol.Collection.<ol.control.Control>, - * interactions: ol.Collection.<ol.interaction.Interaction>, - * keyboardEventTarget: (Element|Document), - * logos: Object.<string, string>, - * overlays: ol.Collection.<ol.Overlay>, - * rendererConstructor: - * function(new: ol.renderer.Map, Element, ol.Map), - * values: Object.<string, *>}} - */ -ol.MapOptionsInternal; - - -/** - * @param {olx.MapOptions} options Map options. - * @return {ol.MapOptionsInternal} Internal map options. - */ -ol.Map.createOptionsInternal = function(options) { - - /** - * @type {Element|Document} - */ - var keyboardEventTarget = null; - if (options.keyboardEventTarget !== undefined) { - // cannot use goog.dom.getElement because its argument cannot be - // of type Document - keyboardEventTarget = goog.isString(options.keyboardEventTarget) ? - document.getElementById(options.keyboardEventTarget) : - options.keyboardEventTarget; - } - - /** - * @type {Object.<string, *>} - */ - var values = {}; - - var logos = {}; - if (options.logo === undefined || - (goog.isBoolean(options.logo) && options.logo)) { - logos[ol.OL3_LOGO_URL] = ol.OL3_URL; - } else { - var logo = options.logo; - if (goog.isString(logo)) { - logos[logo] = ''; - } else if (goog.isObject(logo)) { - goog.asserts.assertString(logo.href, 'logo.href should be a string'); - goog.asserts.assertString(logo.src, 'logo.src should be a string'); - logos[logo.src] = logo.href; - } - } - - var layerGroup = (options.layers instanceof ol.layer.Group) ? - options.layers : new ol.layer.Group({layers: options.layers}); - values[ol.MapProperty.LAYERGROUP] = layerGroup; - - values[ol.MapProperty.TARGET] = options.target; - - values[ol.MapProperty.VIEW] = options.view !== undefined ? - options.view : new ol.View(); - - /** - * @type {function(new: ol.renderer.Map, Element, ol.Map)} - */ - var rendererConstructor = ol.renderer.Map; - - /** - * @type {Array.<ol.RendererType>} - */ - var rendererTypes; - if (options.renderer !== undefined) { - if (goog.isArray(options.renderer)) { - rendererTypes = options.renderer; - } else if (goog.isString(options.renderer)) { - rendererTypes = [options.renderer]; - } else { - goog.asserts.fail('Incorrect format for renderer option'); - } - } else { - rendererTypes = ol.DEFAULT_RENDERER_TYPES; - } - - var i, ii; - for (i = 0, ii = rendererTypes.length; i < ii; ++i) { - /** @type {ol.RendererType} */ - var rendererType = rendererTypes[i]; - if (ol.ENABLE_CANVAS && rendererType == ol.RendererType.CANVAS) { - if (ol.has.CANVAS) { - rendererConstructor = ol.renderer.canvas.Map; - break; - } - } else if (ol.ENABLE_DOM && rendererType == ol.RendererType.DOM) { - if (ol.has.DOM) { - rendererConstructor = ol.renderer.dom.Map; - break; - } - } else if (ol.ENABLE_WEBGL && rendererType == ol.RendererType.WEBGL) { - if (ol.has.WEBGL) { - rendererConstructor = ol.renderer.webgl.Map; - break; - } - } - } - - var controls; - if (options.controls !== undefined) { - if (goog.isArray(options.controls)) { - controls = new ol.Collection(options.controls.slice()); - } else { - goog.asserts.assertInstanceof(options.controls, ol.Collection, - 'options.controls should be an ol.Collection'); - controls = options.controls; - } - } else { - controls = ol.control.defaults(); - } - - var interactions; - if (options.interactions !== undefined) { - if (goog.isArray(options.interactions)) { - interactions = new ol.Collection(options.interactions.slice()); - } else { - goog.asserts.assertInstanceof(options.interactions, ol.Collection, - 'options.interactions should be an ol.Collection'); - interactions = options.interactions; - } - } else { - interactions = ol.interaction.defaults(); - } - - var overlays; - if (options.overlays !== undefined) { - if (goog.isArray(options.overlays)) { - overlays = new ol.Collection(options.overlays.slice()); - } else { - goog.asserts.assertInstanceof(options.overlays, ol.Collection, - 'options.overlays should be an ol.Collection'); - overlays = options.overlays; - } - } else { - overlays = new ol.Collection(); - } - - return { - controls: controls, - interactions: interactions, - keyboardEventTarget: keyboardEventTarget, - logos: logos, - overlays: overlays, - rendererConstructor: rendererConstructor, - values: values - }; - -}; - - -ol.proj.common.add(); - - -if (goog.DEBUG) { - (function() { - goog.debug.Console.autoInstall(); - var logger = goog.log.getLogger('ol'); - logger.setLevel(goog.log.Level.FINEST); - })(); -} - -goog.provide('ol.Overlay'); -goog.provide('ol.OverlayPositioning'); -goog.provide('ol.OverlayProperty'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.style'); -goog.require('ol.Coordinate'); -goog.require('ol.Map'); -goog.require('ol.MapEventType'); -goog.require('ol.Object'); -goog.require('ol.animation'); -goog.require('ol.dom'); -goog.require('ol.extent'); - - -/** - * @enum {string} - */ -ol.OverlayProperty = { - ELEMENT: 'element', - MAP: 'map', - OFFSET: 'offset', - POSITION: 'position', - POSITIONING: 'positioning' -}; - - -/** - * Overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`, - * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`, - * `'top-center'`, `'top-right'` - * @enum {string} - * @api stable - */ -ol.OverlayPositioning = { - BOTTOM_LEFT: 'bottom-left', - BOTTOM_CENTER: 'bottom-center', - BOTTOM_RIGHT: 'bottom-right', - CENTER_LEFT: 'center-left', - CENTER_CENTER: 'center-center', - CENTER_RIGHT: 'center-right', - TOP_LEFT: 'top-left', - TOP_CENTER: 'top-center', - TOP_RIGHT: 'top-right' -}; - - - -/** - * @classdesc - * An element to be displayed over the map and attached to a single map - * location. Like {@link ol.control.Control}, Overlays are visible widgets. - * Unlike Controls, they are not in a fixed position on the screen, but are tied - * to a geographical coordinate, so panning the map will move an Overlay but not - * a Control. - * - * Example: - * - * var popup = new ol.Overlay({ - * element: document.getElementById('popup') - * }); - * popup.setPosition(coordinate); - * map.addOverlay(popup); - * - * @constructor - * @extends {ol.Object} - * @param {olx.OverlayOptions} options Overlay options. - * @api stable - */ -ol.Overlay = function(options) { - - goog.base(this); - - /** - * @private - * @type {number|string|undefined} - */ - this.id_ = options.id; - - /** - * @private - * @type {boolean} - */ - this.insertFirst_ = options.insertFirst !== undefined ? - options.insertFirst : true; - - /** - * @private - * @type {boolean} - */ - this.stopEvent_ = options.stopEvent !== undefined ? options.stopEvent : true; - - /** - * @private - * @type {Element} - */ - this.element_ = goog.dom.createDom('DIV', { - 'class': 'ol-overlay-container' - }); - this.element_.style.position = 'absolute'; - - /** - * @protected - * @type {boolean} - */ - this.autoPan = options.autoPan !== undefined ? options.autoPan : false; - - /** - * @private - * @type {olx.animation.PanOptions} - */ - this.autoPanAnimation_ = options.autoPanAnimation !== undefined ? - options.autoPanAnimation : /** @type {olx.animation.PanOptions} */ ({}); - - /** - * @private - * @type {number} - */ - this.autoPanMargin_ = options.autoPanMargin !== undefined ? - options.autoPanMargin : 20; - - /** - * @private - * @type {{bottom_: string, - * left_: string, - * right_: string, - * top_: string, - * visible: boolean}} - */ - this.rendered_ = { - bottom_: '', - left_: '', - right_: '', - top_: '', - visible: true - }; - - /** - * @private - * @type {goog.events.Key} - */ - this.mapPostrenderListenerKey_ = null; - - goog.events.listen( - this, ol.Object.getChangeEventType(ol.OverlayProperty.ELEMENT), - this.handleElementChanged, false, this); - - goog.events.listen( - this, ol.Object.getChangeEventType(ol.OverlayProperty.MAP), - this.handleMapChanged, false, this); - - goog.events.listen( - this, ol.Object.getChangeEventType(ol.OverlayProperty.OFFSET), - this.handleOffsetChanged, false, this); - - goog.events.listen( - this, ol.Object.getChangeEventType(ol.OverlayProperty.POSITION), - this.handlePositionChanged, false, this); - - goog.events.listen( - this, ol.Object.getChangeEventType(ol.OverlayProperty.POSITIONING), - this.handlePositioningChanged, false, this); - - if (options.element !== undefined) { - this.setElement(options.element); - } - - this.setOffset(options.offset !== undefined ? options.offset : [0, 0]); - - this.setPositioning(options.positioning !== undefined ? - /** @type {ol.OverlayPositioning} */ (options.positioning) : - ol.OverlayPositioning.TOP_LEFT); - - if (options.position !== undefined) { - this.setPosition(options.position); - } - -}; -goog.inherits(ol.Overlay, ol.Object); - - -/** - * Get the DOM element of this overlay. - * @return {Element|undefined} The Element containing the overlay. - * @observable - * @api stable - */ -ol.Overlay.prototype.getElement = function() { - return /** @type {Element|undefined} */ ( - this.get(ol.OverlayProperty.ELEMENT)); -}; - - -/** - * Get the overlay identifier which is set on constructor. - * @return {number|string|undefined} Id. - * @api - */ -ol.Overlay.prototype.getId = function() { - return this.id_; -}; - - -/** - * Get the map associated with this overlay. - * @return {ol.Map|undefined} The map that the overlay is part of. - * @observable - * @api stable - */ -ol.Overlay.prototype.getMap = function() { - return /** @type {ol.Map|undefined} */ ( - this.get(ol.OverlayProperty.MAP)); -}; - - -/** - * Get the offset of this overlay. - * @return {Array.<number>} The offset. - * @observable - * @api stable - */ -ol.Overlay.prototype.getOffset = function() { - return /** @type {Array.<number>} */ ( - this.get(ol.OverlayProperty.OFFSET)); -}; - - -/** - * Get the current position of this overlay. - * @return {ol.Coordinate|undefined} The spatial point that the overlay is - * anchored at. - * @observable - * @api stable - */ -ol.Overlay.prototype.getPosition = function() { - return /** @type {ol.Coordinate|undefined} */ ( - this.get(ol.OverlayProperty.POSITION)); -}; - - -/** - * Get the current positioning of this overlay. - * @return {ol.OverlayPositioning} How the overlay is positioned - * relative to its point on the map. - * @observable - * @api stable - */ -ol.Overlay.prototype.getPositioning = function() { - return /** @type {ol.OverlayPositioning} */ ( - this.get(ol.OverlayProperty.POSITIONING)); -}; - - -/** - * @protected - */ -ol.Overlay.prototype.handleElementChanged = function() { - goog.dom.removeChildren(this.element_); - var element = this.getElement(); - if (element) { - goog.dom.append(/** @type {!Node} */ (this.element_), element); - } -}; - - -/** - * @protected - */ -ol.Overlay.prototype.handleMapChanged = function() { - if (this.mapPostrenderListenerKey_) { - goog.dom.removeNode(this.element_); - goog.events.unlistenByKey(this.mapPostrenderListenerKey_); - this.mapPostrenderListenerKey_ = null; - } - var map = this.getMap(); - if (map) { - this.mapPostrenderListenerKey_ = goog.events.listen(map, - ol.MapEventType.POSTRENDER, this.render, false, this); - this.updatePixelPosition(); - var container = this.stopEvent_ ? - map.getOverlayContainerStopEvent() : map.getOverlayContainer(); - if (this.insertFirst_) { - goog.dom.insertChildAt(/** @type {!Element} */ ( - container), this.element_, 0); - } else { - goog.dom.append(/** @type {!Node} */ (container), this.element_); - } - } -}; - - -/** - * @protected - */ -ol.Overlay.prototype.render = function() { - this.updatePixelPosition(); -}; - - -/** - * @protected - */ -ol.Overlay.prototype.handleOffsetChanged = function() { - this.updatePixelPosition(); -}; - - -/** - * @protected - */ -ol.Overlay.prototype.handlePositionChanged = function() { - this.updatePixelPosition(); - if (this.get(ol.OverlayProperty.POSITION) !== undefined && this.autoPan) { - this.panIntoView_(); - } -}; - - -/** - * @protected - */ -ol.Overlay.prototype.handlePositioningChanged = function() { - this.updatePixelPosition(); -}; - - -/** - * Set the DOM element to be associated with this overlay. - * @param {Element|undefined} element The Element containing the overlay. - * @observable - * @api stable - */ -ol.Overlay.prototype.setElement = function(element) { - this.set(ol.OverlayProperty.ELEMENT, element); -}; - - -/** - * Set the map to be associated with this overlay. - * @param {ol.Map|undefined} map The map that the overlay is part of. - * @observable - * @api stable - */ -ol.Overlay.prototype.setMap = function(map) { - this.set(ol.OverlayProperty.MAP, map); -}; - - -/** - * Set the offset for this overlay. - * @param {Array.<number>} offset Offset. - * @observable - * @api stable - */ -ol.Overlay.prototype.setOffset = function(offset) { - this.set(ol.OverlayProperty.OFFSET, offset); -}; - - -/** - * Set the position for this overlay. If the position is `undefined` the - * overlay is hidden. - * @param {ol.Coordinate|undefined} position The spatial point that the overlay - * is anchored at. - * @observable - * @api stable - */ -ol.Overlay.prototype.setPosition = function(position) { - this.set(ol.OverlayProperty.POSITION, position); -}; - - -/** - * Pan the map so that the overlay is entirely visible in the current viewport - * (if necessary). - * @private - */ -ol.Overlay.prototype.panIntoView_ = function() { - goog.asserts.assert(this.autoPan, 'this.autoPan should be true'); - var map = this.getMap(); - - if (map === undefined || !map.getTargetElement()) { - return; - } - - var mapRect = this.getRect_(map.getTargetElement(), map.getSize()); - var element = this.getElement(); - goog.asserts.assert(element, 'element should be defined'); - var overlayRect = this.getRect_(element, - [ol.dom.outerWidth(element), ol.dom.outerHeight(element)]); - - var margin = this.autoPanMargin_; - if (!ol.extent.containsExtent(mapRect, overlayRect)) { - // the overlay is not completely inside the viewport, so pan the map - var offsetLeft = overlayRect[0] - mapRect[0]; - var offsetRight = mapRect[2] - overlayRect[2]; - var offsetTop = overlayRect[1] - mapRect[1]; - var offsetBottom = mapRect[3] - overlayRect[3]; - - var delta = [0, 0]; - if (offsetLeft < 0) { - // move map to the left - delta[0] = offsetLeft - margin; - } else if (offsetRight < 0) { - // move map to the right - delta[0] = Math.abs(offsetRight) + margin; - } - if (offsetTop < 0) { - // move map up - delta[1] = offsetTop - margin; - } else if (offsetBottom < 0) { - // move map down - delta[1] = Math.abs(offsetBottom) + margin; - } - - if (delta[0] !== 0 || delta[1] !== 0) { - var center = map.getView().getCenter(); - goog.asserts.assert(center !== undefined, 'center should be defined'); - var centerPx = map.getPixelFromCoordinate(center); - var newCenterPx = [ - centerPx[0] + delta[0], - centerPx[1] + delta[1] - ]; - - if (this.autoPanAnimation_) { - this.autoPanAnimation_.source = center; - map.beforeRender(ol.animation.pan(this.autoPanAnimation_)); - } - map.getView().setCenter(map.getCoordinateFromPixel(newCenterPx)); - } - } -}; - - -/** - * Get the extent of an element relative to the document - * @param {Element|undefined} element The element. - * @param {ol.Size|undefined} size The size of the element. - * @return {ol.Extent} - * @private - */ -ol.Overlay.prototype.getRect_ = function(element, size) { - goog.asserts.assert(element, 'element should be defined'); - goog.asserts.assert(size !== undefined, 'size should be defined'); - - var offset = goog.style.getPageOffset(element); - return [ - offset.x, - offset.y, - offset.x + size[0], - offset.y + size[1] - ]; -}; - - -/** - * Set the positioning for this overlay. - * @param {ol.OverlayPositioning} positioning how the overlay is - * positioned relative to its point on the map. - * @observable - * @api stable - */ -ol.Overlay.prototype.setPositioning = function(positioning) { - this.set(ol.OverlayProperty.POSITIONING, positioning); -}; - - -/** - * Modify the visibility of the element. - * @param {boolean} visible - * @protected - */ -ol.Overlay.prototype.setVisible = function(visible) { - if (this.rendered_.visible !== visible) { - goog.style.setElementShown(this.element_, visible); - this.rendered_.visible = visible; - } -}; - - -/** - * Update pixel position. - * @protected - */ -ol.Overlay.prototype.updatePixelPosition = function() { - var map = this.getMap(); - var position = this.getPosition(); - if (map === undefined || !map.isRendered() || position === undefined) { - this.setVisible(false); - return; - } - - var pixel = map.getPixelFromCoordinate(position); - var mapSize = map.getSize(); - this.updateRenderedPosition(pixel, mapSize); -}; - - -/** - * @param {ol.Pixel} pixel - * @param {ol.Size|undefined} mapSize - * @protected - */ -ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) { - goog.asserts.assert(pixel, 'pixel should not be null'); - goog.asserts.assert(mapSize !== undefined, 'mapSize should be defined'); - var style = this.element_.style; - var offset = this.getOffset(); - goog.asserts.assert(goog.isArray(offset), 'offset should be an array'); - - var positioning = this.getPositioning(); - goog.asserts.assert(positioning !== undefined, - 'positioning should be defined'); - - var offsetX = offset[0]; - var offsetY = offset[1]; - if (positioning == ol.OverlayPositioning.BOTTOM_RIGHT || - positioning == ol.OverlayPositioning.CENTER_RIGHT || - positioning == ol.OverlayPositioning.TOP_RIGHT) { - if (this.rendered_.left_ !== '') { - this.rendered_.left_ = style.left = ''; - } - var right = Math.round(mapSize[0] - pixel[0] - offsetX) + 'px'; - if (this.rendered_.right_ != right) { - this.rendered_.right_ = style.right = right; - } - } else { - if (this.rendered_.right_ !== '') { - this.rendered_.right_ = style.right = ''; - } - if (positioning == ol.OverlayPositioning.BOTTOM_CENTER || - positioning == ol.OverlayPositioning.CENTER_CENTER || - positioning == ol.OverlayPositioning.TOP_CENTER) { - offsetX -= goog.style.getSize(this.element_).width / 2; - } - var left = Math.round(pixel[0] + offsetX) + 'px'; - if (this.rendered_.left_ != left) { - this.rendered_.left_ = style.left = left; - } - } - if (positioning == ol.OverlayPositioning.BOTTOM_LEFT || - positioning == ol.OverlayPositioning.BOTTOM_CENTER || - positioning == ol.OverlayPositioning.BOTTOM_RIGHT) { - if (this.rendered_.top_ !== '') { - this.rendered_.top_ = style.top = ''; - } - var bottom = Math.round(mapSize[1] - pixel[1] - offsetY) + 'px'; - if (this.rendered_.bottom_ != bottom) { - this.rendered_.bottom_ = style.bottom = bottom; - } - } else { - if (this.rendered_.bottom_ !== '') { - this.rendered_.bottom_ = style.bottom = ''; - } - if (positioning == ol.OverlayPositioning.CENTER_LEFT || - positioning == ol.OverlayPositioning.CENTER_CENTER || - positioning == ol.OverlayPositioning.CENTER_RIGHT) { - offsetY -= goog.style.getSize(this.element_).height / 2; - } - var top = Math.round(pixel[1] + offsetY) + 'px'; - if (this.rendered_.top_ != top) { - this.rendered_.top_ = style.top = top; - } - } - - this.setVisible(true); -}; - -goog.provide('ol.control.OverviewMap'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.dom.classlist'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.math.Size'); -goog.require('goog.style'); -goog.require('ol'); -goog.require('ol.Collection'); -goog.require('ol.Map'); -goog.require('ol.MapEventType'); -goog.require('ol.Object'); -goog.require('ol.ObjectEventType'); -goog.require('ol.Overlay'); -goog.require('ol.OverlayPositioning'); -goog.require('ol.View'); -goog.require('ol.ViewProperty'); -goog.require('ol.control.Control'); -goog.require('ol.coordinate'); -goog.require('ol.css'); -goog.require('ol.extent'); - - - -/** - * Create a new control with a map acting as an overview map for an other - * defined map. - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.OverviewMapOptions=} opt_options OverviewMap options. - * @api - */ -ol.control.OverviewMap = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - /** - * @type {boolean} - * @private - */ - this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true; - - /** - * @private - * @type {boolean} - */ - this.collapsible_ = options.collapsible !== undefined ? - options.collapsible : true; - - if (!this.collapsible_) { - this.collapsed_ = false; - } - - var className = options.className ? options.className : 'ol-overviewmap'; - - var tipLabel = options.tipLabel ? options.tipLabel : 'Overview map'; - - var collapseLabel = options.collapseLabel ? options.collapseLabel : '\u00AB'; - - /** - * @private - * @type {Node} - */ - this.collapseLabel_ = goog.isString(collapseLabel) ? - goog.dom.createDom('SPAN', {}, collapseLabel) : - collapseLabel; - - var label = options.label ? options.label : '\u00BB'; - - /** - * @private - * @type {Node} - */ - this.label_ = goog.isString(label) ? - goog.dom.createDom('SPAN', {}, label) : - label; - - var activeLabel = (this.collapsible_ && !this.collapsed_) ? - this.collapseLabel_ : this.label_; - var button = goog.dom.createDom('BUTTON', { - 'type': 'button', - 'title': tipLabel - }, activeLabel); - - goog.events.listen(button, goog.events.EventType.CLICK, - this.handleClick_, false, this); - - var ovmapDiv = goog.dom.createDom('DIV', 'ol-overviewmap-map'); - - /** - * @type {ol.Map} - * @private - */ - this.ovmap_ = new ol.Map({ - controls: new ol.Collection(), - interactions: new ol.Collection(), - target: ovmapDiv, - view: options.view - }); - var ovmap = this.ovmap_; - - if (options.layers) { - options.layers.forEach( - /** - * @param {ol.layer.Layer} layer Layer. - */ - function(layer) { - ovmap.addLayer(layer); - }, this); - } - - var box = goog.dom.createDom('DIV', 'ol-overviewmap-box'); - - /** - * @type {ol.Overlay} - * @private - */ - this.boxOverlay_ = new ol.Overlay({ - position: [0, 0], - positioning: ol.OverlayPositioning.BOTTOM_LEFT, - element: box - }); - this.ovmap_.addOverlay(this.boxOverlay_); - - var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + - ol.css.CLASS_CONTROL + - (this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') + - (this.collapsible_ ? '' : ' ol-uncollapsible'); - var element = goog.dom.createDom('DIV', - cssClasses, ovmapDiv, button); - - var render = options.render ? options.render : ol.control.OverviewMap.render; - - goog.base(this, { - element: element, - render: render, - target: options.target - }); -}; -goog.inherits(ol.control.OverviewMap, ol.control.Control); - - -/** - * @inheritDoc - * @api - */ -ol.control.OverviewMap.prototype.setMap = function(map) { - var oldMap = this.getMap(); - if (map === oldMap) { - return; - } - if (oldMap) { - var oldView = oldMap.getView(); - if (oldView) { - this.unbindView_(oldView); - } - } - goog.base(this, 'setMap', map); - - if (map) { - this.listenerKeys.push(goog.events.listen( - map, ol.ObjectEventType.PROPERTYCHANGE, - this.handleMapPropertyChange_, false, this)); - - // TODO: to really support map switching, this would need to be reworked - if (this.ovmap_.getLayers().getLength() === 0) { - this.ovmap_.setLayerGroup(map.getLayerGroup()); - } - - var view = map.getView(); - if (view) { - this.bindView_(view); - if (view.isDef()) { - this.ovmap_.updateSize(); - this.resetExtent_(); - } - } - } -}; - - -/** - * Handle map property changes. This only deals with changes to the map's view. - * @param {ol.ObjectEvent} event The propertychange event. - * @private - */ -ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) { - if (event.key === ol.MapProperty.VIEW) { - var oldView = /** @type {ol.View} */ (event.oldValue); - if (oldView) { - this.unbindView_(oldView); - } - var newView = this.getMap().getView(); - this.bindView_(newView); - } -}; - - -/** - * Register listeners for view property changes. - * @param {ol.View} view The view. - * @private - */ -ol.control.OverviewMap.prototype.bindView_ = function(view) { - goog.events.listen(view, - ol.Object.getChangeEventType(ol.ViewProperty.ROTATION), - this.handleRotationChanged_, false, this); -}; - - -/** - * Unregister listeners for view property changes. - * @param {ol.View} view The view. - * @private - */ -ol.control.OverviewMap.prototype.unbindView_ = function(view) { - goog.events.unlisten(view, - ol.Object.getChangeEventType(ol.ViewProperty.ROTATION), - this.handleRotationChanged_, false, this); -}; - - -/** - * Handle rotation changes to the main map. - * TODO: This should rotate the extent rectrangle instead of the - * overview map's view. - * @private - */ -ol.control.OverviewMap.prototype.handleRotationChanged_ = function() { - this.ovmap_.getView().setRotation(this.getMap().getView().getRotation()); -}; - - -/** - * Update the overview map element. - * @param {ol.MapEvent} mapEvent Map event. - * @this {ol.control.OverviewMap} - * @api - */ -ol.control.OverviewMap.render = function(mapEvent) { - this.validateExtent_(); - this.updateBox_(); -}; - - -/** - * Reset the overview map extent if the box size (width or - * height) is less than the size of the overview map size times minRatio - * or is greater than the size of the overview size times maxRatio. - * - * If the map extent was not reset, the box size can fits in the defined - * ratio sizes. This method then checks if is contained inside the overview - * map current extent. If not, recenter the overview map to the current - * main map center location. - * @private - */ -ol.control.OverviewMap.prototype.validateExtent_ = function() { - var map = this.getMap(); - var ovmap = this.ovmap_; - - if (!map.isRendered() || !ovmap.isRendered()) { - return; - } - - var mapSize = map.getSize(); - goog.asserts.assertArray(mapSize, 'mapSize should be an array'); - - var view = map.getView(); - goog.asserts.assert(view, 'view should be defined'); - var extent = view.calculateExtent(mapSize); - - var ovmapSize = ovmap.getSize(); - goog.asserts.assertArray(ovmapSize, 'ovmapSize should be an array'); - - var ovview = ovmap.getView(); - goog.asserts.assert(ovview, 'ovview should be defined'); - var ovextent = ovview.calculateExtent(ovmapSize); - - var topLeftPixel = - ovmap.getPixelFromCoordinate(ol.extent.getTopLeft(extent)); - var bottomRightPixel = - ovmap.getPixelFromCoordinate(ol.extent.getBottomRight(extent)); - var boxSize = new goog.math.Size( - Math.abs(topLeftPixel[0] - bottomRightPixel[0]), - Math.abs(topLeftPixel[1] - bottomRightPixel[1])); - - var ovmapWidth = ovmapSize[0]; - var ovmapHeight = ovmapSize[1]; - - if (boxSize.width < ovmapWidth * ol.OVERVIEWMAP_MIN_RATIO || - boxSize.height < ovmapHeight * ol.OVERVIEWMAP_MIN_RATIO || - boxSize.width > ovmapWidth * ol.OVERVIEWMAP_MAX_RATIO || - boxSize.height > ovmapHeight * ol.OVERVIEWMAP_MAX_RATIO) { - this.resetExtent_(); - } else if (!ol.extent.containsExtent(ovextent, extent)) { - this.recenter_(); - } -}; - - -/** - * Reset the overview map extent to half calculated min and max ratio times - * the extent of the main map. - * @private - */ -ol.control.OverviewMap.prototype.resetExtent_ = function() { - if (ol.OVERVIEWMAP_MAX_RATIO === 0 || ol.OVERVIEWMAP_MIN_RATIO === 0) { - return; - } - - var map = this.getMap(); - var ovmap = this.ovmap_; - - var mapSize = map.getSize(); - goog.asserts.assertArray(mapSize, 'mapSize should be an array'); - - var view = map.getView(); - goog.asserts.assert(view, 'view should be defined'); - var extent = view.calculateExtent(mapSize); - - var ovmapSize = ovmap.getSize(); - goog.asserts.assertArray(ovmapSize, 'ovmapSize should be an array'); - - var ovview = ovmap.getView(); - goog.asserts.assert(ovview, 'ovview should be defined'); - - // get how many times the current map overview could hold different - // box sizes using the min and max ratio, pick the step in the middle used - // to calculate the extent from the main map to set it to the overview map, - var steps = Math.log( - ol.OVERVIEWMAP_MAX_RATIO / ol.OVERVIEWMAP_MIN_RATIO) / Math.LN2; - var ratio = 1 / (Math.pow(2, steps / 2) * ol.OVERVIEWMAP_MIN_RATIO); - ol.extent.scaleFromCenter(extent, ratio); - ovview.fit(extent, ovmapSize); -}; - - -/** - * Set the center of the overview map to the map center without changing its - * resolution. - * @private - */ -ol.control.OverviewMap.prototype.recenter_ = function() { - var map = this.getMap(); - var ovmap = this.ovmap_; - - var view = map.getView(); - goog.asserts.assert(view, 'view should be defined'); - - var ovview = ovmap.getView(); - goog.asserts.assert(ovview, 'ovview should be defined'); - - ovview.setCenter(view.getCenter()); -}; - - -/** - * Update the box using the main map extent - * @private - */ -ol.control.OverviewMap.prototype.updateBox_ = function() { - var map = this.getMap(); - var ovmap = this.ovmap_; - - if (!map.isRendered() || !ovmap.isRendered()) { - return; - } - - var mapSize = map.getSize(); - goog.asserts.assertArray(mapSize, 'mapSize should be an array'); - - var view = map.getView(); - goog.asserts.assert(view, 'view should be defined'); - - var ovview = ovmap.getView(); - goog.asserts.assert(ovview, 'ovview should be defined'); - - var ovmapSize = ovmap.getSize(); - goog.asserts.assertArray(ovmapSize, 'ovmapSize should be an array'); - - var rotation = view.getRotation(); - goog.asserts.assert(rotation !== undefined, 'rotation should be defined'); - - var overlay = this.boxOverlay_; - var box = this.boxOverlay_.getElement(); - var extent = view.calculateExtent(mapSize); - var ovresolution = ovview.getResolution(); - var bottomLeft = ol.extent.getBottomLeft(extent); - var topRight = ol.extent.getTopRight(extent); - - // set position using bottom left coordinates - var rotateBottomLeft = this.calculateCoordinateRotate_(rotation, bottomLeft); - overlay.setPosition(rotateBottomLeft); - - // set box size calculated from map extent size and overview map resolution - if (box) { - var boxWidth = Math.abs((bottomLeft[0] - topRight[0]) / ovresolution); - var boxHeight = Math.abs((topRight[1] - bottomLeft[1]) / ovresolution); - goog.style.setBorderBoxSize(box, new goog.math.Size( - boxWidth, boxHeight)); - } -}; - - -/** - * @param {number} rotation Target rotation. - * @param {ol.Coordinate} coordinate Coordinate. - * @return {ol.Coordinate|undefined} Coordinate for rotation and center anchor. - * @private - */ -ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function( - rotation, coordinate) { - var coordinateRotate; - - var map = this.getMap(); - var view = map.getView(); - goog.asserts.assert(view, 'view should be defined'); - - var currentCenter = view.getCenter(); - - if (currentCenter) { - coordinateRotate = [ - coordinate[0] - currentCenter[0], - coordinate[1] - currentCenter[1] - ]; - ol.coordinate.rotate(coordinateRotate, rotation); - ol.coordinate.add(coordinateRotate, currentCenter); - } - return coordinateRotate; -}; - - -/** - * @param {goog.events.BrowserEvent} event The event to handle - * @private - */ -ol.control.OverviewMap.prototype.handleClick_ = function(event) { - event.preventDefault(); - this.handleToggle_(); -}; - - -/** - * @private - */ -ol.control.OverviewMap.prototype.handleToggle_ = function() { - goog.dom.classlist.toggle(this.element, 'ol-collapsed'); - if (this.collapsed_) { - goog.dom.replaceNode(this.collapseLabel_, this.label_); - } else { - goog.dom.replaceNode(this.label_, this.collapseLabel_); - } - this.collapsed_ = !this.collapsed_; - - // manage overview map if it had not been rendered before and control - // is expanded - var ovmap = this.ovmap_; - if (!this.collapsed_ && !ovmap.isRendered()) { - ovmap.updateSize(); - this.resetExtent_(); - goog.events.listenOnce(ovmap, ol.MapEventType.POSTRENDER, - function(event) { - this.updateBox_(); - }, - false, this); - } -}; - - -/** - * Return `true` if the overview map is collapsible, `false` otherwise. - * @return {boolean} True if the widget is collapsible. - * @api stable - */ -ol.control.OverviewMap.prototype.getCollapsible = function() { - return this.collapsible_; -}; - - -/** - * Set whether the overview map should be collapsible. - * @param {boolean} collapsible True if the widget is collapsible. - * @api stable - */ -ol.control.OverviewMap.prototype.setCollapsible = function(collapsible) { - if (this.collapsible_ === collapsible) { - return; - } - this.collapsible_ = collapsible; - goog.dom.classlist.toggle(this.element, 'ol-uncollapsible'); - if (!collapsible && this.collapsed_) { - this.handleToggle_(); - } -}; - - -/** - * Collapse or expand the overview map according to the passed parameter. Will - * not do anything if the overview map isn't collapsible or if the current - * collapsed state is already the one requested. - * @param {boolean} collapsed True if the widget is collapsed. - * @api stable - */ -ol.control.OverviewMap.prototype.setCollapsed = function(collapsed) { - if (!this.collapsible_ || this.collapsed_ === collapsed) { - return; - } - this.handleToggle_(); -}; - - -/** - * Determine if the overview map is collapsed. - * @return {boolean} The overview map is collapsed. - * @api stable - */ -ol.control.OverviewMap.prototype.getCollapsed = function() { - return this.collapsed_; -}; - - -/** - * Return the overview map. - * @return {ol.Map} Overview map. - * @api - */ -ol.control.OverviewMap.prototype.getOverviewMap = function() { - return this.ovmap_; -}; - -goog.provide('ol.control.ScaleLine'); -goog.provide('ol.control.ScaleLineProperty'); -goog.provide('ol.control.ScaleLineUnits'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.style'); -goog.require('ol'); -goog.require('ol.Object'); -goog.require('ol.TransformFunction'); -goog.require('ol.control.Control'); -goog.require('ol.css'); -goog.require('ol.math'); -goog.require('ol.proj'); -goog.require('ol.proj.METERS_PER_UNIT'); -goog.require('ol.proj.Units'); -goog.require('ol.sphere.NORMAL'); - - -/** - * @enum {string} - */ -ol.control.ScaleLineProperty = { - UNITS: 'units' -}; - - -/** - * Units for the scale line. Supported values are `'degrees'`, `'imperial'`, - * `'nautical'`, `'metric'`, `'us'`. - * @enum {string} - * @api stable - */ -ol.control.ScaleLineUnits = { - DEGREES: 'degrees', - IMPERIAL: 'imperial', - NAUTICAL: 'nautical', - METRIC: 'metric', - US: 'us' -}; - - - -/** - * @classdesc - * A control displaying rough x-axis distances, calculated for the center of the - * viewport. - * No scale line will be shown when the x-axis distance cannot be calculated in - * the view projection (e.g. at or beyond the poles in EPSG:4326). - * By default the scale line will show in the bottom left portion of the map, - * but this can be changed by using the css selector `.ol-scale-line`. - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.ScaleLineOptions=} opt_options Scale line options. - * @api stable - */ -ol.control.ScaleLine = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - var className = options.className ? options.className : 'ol-scale-line'; - - /** - * @private - * @type {Element} - */ - this.innerElement_ = goog.dom.createDom('DIV', - className + '-inner'); - - /** - * @private - * @type {Element} - */ - this.element_ = goog.dom.createDom('DIV', - className + ' ' + ol.css.CLASS_UNSELECTABLE, this.innerElement_); - - /** - * @private - * @type {?olx.ViewState} - */ - this.viewState_ = null; - - /** - * @private - * @type {number} - */ - this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64; - - /** - * @private - * @type {boolean} - */ - this.renderedVisible_ = false; - - /** - * @private - * @type {number|undefined} - */ - this.renderedWidth_ = undefined; - - /** - * @private - * @type {string} - */ - this.renderedHTML_ = ''; - - /** - * @private - * @type {?ol.TransformFunction} - */ - this.toEPSG4326_ = null; - - var render = options.render ? options.render : ol.control.ScaleLine.render; - - goog.base(this, { - element: this.element_, - render: render, - target: options.target - }); - - goog.events.listen( - this, ol.Object.getChangeEventType(ol.control.ScaleLineProperty.UNITS), - this.handleUnitsChanged_, false, this); - - this.setUnits(/** @type {ol.control.ScaleLineUnits} */ (options.units) || - ol.control.ScaleLineUnits.METRIC); - -}; -goog.inherits(ol.control.ScaleLine, ol.control.Control); - - -/** - * @const - * @type {Array.<number>} - */ -ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5]; - - -/** - * Return the units to use in the scale line. - * @return {ol.control.ScaleLineUnits|undefined} The units to use in the scale - * line. - * @observable - * @api stable - */ -ol.control.ScaleLine.prototype.getUnits = function() { - return /** @type {ol.control.ScaleLineUnits|undefined} */ ( - this.get(ol.control.ScaleLineProperty.UNITS)); -}; - - -/** - * Update the scale line element. - * @param {ol.MapEvent} mapEvent Map event. - * @this {ol.control.ScaleLine} - * @api - */ -ol.control.ScaleLine.render = function(mapEvent) { - var frameState = mapEvent.frameState; - if (!frameState) { - this.viewState_ = null; - } else { - this.viewState_ = frameState.viewState; - } - this.updateElement_(); -}; - - -/** - * @private - */ -ol.control.ScaleLine.prototype.handleUnitsChanged_ = function() { - this.updateElement_(); -}; - - -/** - * Set the units to use in the scale line. - * @param {ol.control.ScaleLineUnits} units The units to use in the scale line. - * @observable - * @api stable - */ -ol.control.ScaleLine.prototype.setUnits = function(units) { - this.set(ol.control.ScaleLineProperty.UNITS, units); -}; - - -/** - * @private - */ -ol.control.ScaleLine.prototype.updateElement_ = function() { - var viewState = this.viewState_; - - if (!viewState) { - if (this.renderedVisible_) { - goog.style.setElementShown(this.element_, false); - this.renderedVisible_ = false; - } - return; - } - - var center = viewState.center; - var projection = viewState.projection; - var pointResolution = - projection.getPointResolution(viewState.resolution, center); - var projectionUnits = projection.getUnits(); - - var cosLatitude; - var units = this.getUnits(); - if (projectionUnits == ol.proj.Units.DEGREES && - (units == ol.control.ScaleLineUnits.METRIC || - units == ol.control.ScaleLineUnits.IMPERIAL || - units == ol.control.ScaleLineUnits.US || - units == ol.control.ScaleLineUnits.NAUTICAL)) { - - // Convert pointResolution from degrees to meters - this.toEPSG4326_ = null; - cosLatitude = Math.cos(ol.math.toRadians(center[1])); - pointResolution *= Math.PI * cosLatitude * ol.sphere.NORMAL.radius / 180; - projectionUnits = ol.proj.Units.METERS; - - } else if (projectionUnits != ol.proj.Units.DEGREES && - units == ol.control.ScaleLineUnits.DEGREES) { - - // Convert pointResolution from other units to degrees - if (!this.toEPSG4326_) { - this.toEPSG4326_ = ol.proj.getTransformFromProjections( - projection, ol.proj.get('EPSG:4326')); - } - cosLatitude = Math.cos(ol.math.toRadians(this.toEPSG4326_(center)[1])); - var radius = ol.sphere.NORMAL.radius; - goog.asserts.assert(ol.proj.METERS_PER_UNIT[projectionUnits], - 'Meters per unit should be defined for the projection unit'); - radius /= ol.proj.METERS_PER_UNIT[projectionUnits]; - pointResolution *= 180 / (Math.PI * cosLatitude * radius); - projectionUnits = ol.proj.Units.DEGREES; - - } else { - this.toEPSG4326_ = null; - } - - goog.asserts.assert( - ((units == ol.control.ScaleLineUnits.METRIC || - units == ol.control.ScaleLineUnits.IMPERIAL || - units == ol.control.ScaleLineUnits.US || - units == ol.control.ScaleLineUnits.NAUTICAL) && - projectionUnits == ol.proj.Units.METERS) || - (units == ol.control.ScaleLineUnits.DEGREES && - projectionUnits == ol.proj.Units.DEGREES), - 'Scale line units and projection units should match'); - - var nominalCount = this.minWidth_ * pointResolution; - var suffix = ''; - if (units == ol.control.ScaleLineUnits.DEGREES) { - if (nominalCount < 1 / 60) { - suffix = '\u2033'; // seconds - pointResolution *= 3600; - } else if (nominalCount < 1) { - suffix = '\u2032'; // minutes - pointResolution *= 60; - } else { - suffix = '\u00b0'; // degrees - } - } else if (units == ol.control.ScaleLineUnits.IMPERIAL) { - if (nominalCount < 0.9144) { - suffix = 'in'; - pointResolution /= 0.0254; - } else if (nominalCount < 1609.344) { - suffix = 'ft'; - pointResolution /= 0.3048; - } else { - suffix = 'mi'; - pointResolution /= 1609.344; - } - } else if (units == ol.control.ScaleLineUnits.NAUTICAL) { - pointResolution /= 1852; - suffix = 'nm'; - } else if (units == ol.control.ScaleLineUnits.METRIC) { - if (nominalCount < 1) { - suffix = 'mm'; - pointResolution *= 1000; - } else if (nominalCount < 1000) { - suffix = 'm'; - } else { - suffix = 'km'; - pointResolution /= 1000; - } - } else if (units == ol.control.ScaleLineUnits.US) { - if (nominalCount < 0.9144) { - suffix = 'in'; - pointResolution *= 39.37; - } else if (nominalCount < 1609.344) { - suffix = 'ft'; - pointResolution /= 0.30480061; - } else { - suffix = 'mi'; - pointResolution /= 1609.3472; - } - } else { - goog.asserts.fail('Scale line element cannot be updated'); - } - - var i = 3 * Math.floor( - Math.log(this.minWidth_ * pointResolution) / Math.log(10)); - var count, width; - while (true) { - count = ol.control.ScaleLine.LEADING_DIGITS[i % 3] * - Math.pow(10, Math.floor(i / 3)); - width = Math.round(count / pointResolution); - if (isNaN(width)) { - goog.style.setElementShown(this.element_, false); - this.renderedVisible_ = false; - return; - } else if (width >= this.minWidth_) { - break; - } - ++i; - } - - var html = count + ' ' + suffix; - if (this.renderedHTML_ != html) { - this.innerElement_.innerHTML = html; - this.renderedHTML_ = html; - } - - if (this.renderedWidth_ != width) { - this.innerElement_.style.width = width + 'px'; - this.renderedWidth_ = width; - } - - if (!this.renderedVisible_) { - goog.style.setElementShown(this.element_, true); - this.renderedVisible_ = true; - } - -}; - -// Copyright 2005 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Class to create objects which want to handle multiple events - * and have their listeners easily cleaned up via a dispose method. - * - * Example: - * <pre> - * function Something() { - * Something.base(this); - * - * ... set up object ... - * - * // Add event listeners - * this.listen(this.starEl, goog.events.EventType.CLICK, this.handleStar); - * this.listen(this.headerEl, goog.events.EventType.CLICK, this.expand); - * this.listen(this.collapseEl, goog.events.EventType.CLICK, this.collapse); - * this.listen(this.infoEl, goog.events.EventType.MOUSEOVER, this.showHover); - * this.listen(this.infoEl, goog.events.EventType.MOUSEOUT, this.hideHover); - * } - * goog.inherits(Something, goog.events.EventHandler); - * - * Something.prototype.disposeInternal = function() { - * Something.base(this, 'disposeInternal'); - * goog.dom.removeNode(this.container); - * }; - * - * - * // Then elsewhere: - * - * var activeSomething = null; - * function openSomething() { - * activeSomething = new Something(); - * } - * - * function closeSomething() { - * if (activeSomething) { - * activeSomething.dispose(); // Remove event listeners - * activeSomething = null; - * } - * } - * </pre> - * - */ - -goog.provide('goog.events.EventHandler'); - -goog.require('goog.Disposable'); -goog.require('goog.events'); -goog.require('goog.object'); - -goog.forwardDeclare('goog.events.EventWrapper'); - - - -/** - * Super class for objects that want to easily manage a number of event - * listeners. It allows a short cut to listen and also provides a quick way - * to remove all events listeners belonging to this object. - * @param {SCOPE=} opt_scope Object in whose scope to call the listeners. - * @constructor - * @extends {goog.Disposable} - * @template SCOPE - */ -goog.events.EventHandler = function(opt_scope) { - goog.Disposable.call(this); - // TODO(mknichel): Rename this to this.scope_ and fix the classes in google3 - // that access this private variable. :( - this.handler_ = opt_scope; - - /** - * Keys for events that are being listened to. - * @type {!Object<!goog.events.Key>} - * @private - */ - this.keys_ = {}; -}; -goog.inherits(goog.events.EventHandler, goog.Disposable); - - -/** - * Utility array used to unify the cases of listening for an array of types - * and listening for a single event, without using recursion or allocating - * an array each time. - * @type {!Array<string>} - * @const - * @private - */ -goog.events.EventHandler.typeArray_ = []; - - -/** - * Listen to an event on a Listenable. If the function is omitted then the - * EventHandler's handleEvent method will be used. - * @param {goog.events.ListenableType} src Event source. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type to listen for or array of event types. - * @param {function(this:SCOPE, EVENTOBJ):?|{handleEvent:function(?):?}|null=} - * opt_fn Optional callback function to be used as the listener or an object - * with handleEvent function. - * @param {boolean=} opt_capture Optional whether to use capture phase. - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - * @template EVENTOBJ - */ -goog.events.EventHandler.prototype.listen = function( - src, type, opt_fn, opt_capture) { - return this.listen_(src, type, opt_fn, opt_capture); -}; - - -/** - * Listen to an event on a Listenable. If the function is omitted then the - * EventHandler's handleEvent method will be used. - * @param {goog.events.ListenableType} src Event source. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type to listen for or array of event types. - * @param {function(this:T, EVENTOBJ):?|{handleEvent:function(this:T, ?):?}| - * null|undefined} fn Optional callback function to be used as the - * listener or an object with handleEvent function. - * @param {boolean|undefined} capture Optional whether to use capture phase. - * @param {T} scope Object in whose scope to call the listener. - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - * @template T,EVENTOBJ - */ -goog.events.EventHandler.prototype.listenWithScope = function( - src, type, fn, capture, scope) { - // TODO(mknichel): Deprecate this function. - return this.listen_(src, type, fn, capture, scope); -}; - - -/** - * Listen to an event on a Listenable. If the function is omitted then the - * EventHandler's handleEvent method will be used. - * @param {goog.events.ListenableType} src Event source. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type to listen for or array of event types. - * @param {function(EVENTOBJ):?|{handleEvent:function(?):?}|null=} opt_fn - * Optional callback function to be used as the listener or an object with - * handleEvent function. - * @param {boolean=} opt_capture Optional whether to use capture phase. - * @param {Object=} opt_scope Object in whose scope to call the listener. - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - * @template EVENTOBJ - * @private - */ -goog.events.EventHandler.prototype.listen_ = function(src, type, opt_fn, - opt_capture, - opt_scope) { - if (!goog.isArray(type)) { - if (type) { - goog.events.EventHandler.typeArray_[0] = type.toString(); - } - type = goog.events.EventHandler.typeArray_; - } - for (var i = 0; i < type.length; i++) { - var listenerObj = goog.events.listen( - src, type[i], opt_fn || this.handleEvent, - opt_capture || false, - opt_scope || this.handler_ || this); - - if (!listenerObj) { - // When goog.events.listen run on OFF_AND_FAIL or OFF_AND_SILENT - // (goog.events.CaptureSimulationMode) in IE8-, it will return null - // value. - return this; - } - - var key = listenerObj.key; - this.keys_[key] = listenerObj; - } - - return this; -}; - - -/** - * Listen to an event on a Listenable. If the function is omitted, then the - * EventHandler's handleEvent method will be used. After the event has fired the - * event listener is removed from the target. If an array of event types is - * provided, each event type will be listened to once. - * @param {goog.events.ListenableType} src Event source. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type to listen for or array of event types. - * @param {function(this:SCOPE, EVENTOBJ):?|{handleEvent:function(?):?}|null=} opt_fn - * Optional callback function to be used as the listener or an object with - * handleEvent function. - * @param {boolean=} opt_capture Optional whether to use capture phase. - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - * @template EVENTOBJ - */ -goog.events.EventHandler.prototype.listenOnce = function( - src, type, opt_fn, opt_capture) { - return this.listenOnce_(src, type, opt_fn, opt_capture); -}; - - -/** - * Listen to an event on a Listenable. If the function is omitted, then the - * EventHandler's handleEvent method will be used. After the event has fired the - * event listener is removed from the target. If an array of event types is - * provided, each event type will be listened to once. - * @param {goog.events.ListenableType} src Event source. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type to listen for or array of event types. - * @param {function(this:T, EVENTOBJ):?|{handleEvent:function(this:T, ?):?}| - * null|undefined} fn Optional callback function to be used as the - * listener or an object with handleEvent function. - * @param {boolean|undefined} capture Optional whether to use capture phase. - * @param {T} scope Object in whose scope to call the listener. - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - * @template T,EVENTOBJ - */ -goog.events.EventHandler.prototype.listenOnceWithScope = function( - src, type, fn, capture, scope) { - // TODO(mknichel): Deprecate this function. - return this.listenOnce_(src, type, fn, capture, scope); -}; - - -/** - * Listen to an event on a Listenable. If the function is omitted, then the - * EventHandler's handleEvent method will be used. After the event has fired - * the event listener is removed from the target. If an array of event types is - * provided, each event type will be listened to once. - * @param {goog.events.ListenableType} src Event source. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type to listen for or array of event types. - * @param {function(EVENTOBJ):?|{handleEvent:function(?):?}|null=} opt_fn - * Optional callback function to be used as the listener or an object with - * handleEvent function. - * @param {boolean=} opt_capture Optional whether to use capture phase. - * @param {Object=} opt_scope Object in whose scope to call the listener. - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - * @template EVENTOBJ - * @private - */ -goog.events.EventHandler.prototype.listenOnce_ = function( - src, type, opt_fn, opt_capture, opt_scope) { - if (goog.isArray(type)) { - for (var i = 0; i < type.length; i++) { - this.listenOnce_(src, type[i], opt_fn, opt_capture, opt_scope); - } - } else { - var listenerObj = goog.events.listenOnce( - src, type, opt_fn || this.handleEvent, opt_capture, - opt_scope || this.handler_ || this); - if (!listenerObj) { - // When goog.events.listen run on OFF_AND_FAIL or OFF_AND_SILENT - // (goog.events.CaptureSimulationMode) in IE8-, it will return null - // value. - return this; - } - - var key = listenerObj.key; - this.keys_[key] = listenerObj; - } - - return this; -}; - - -/** - * Adds an event listener with a specific event wrapper on a DOM Node or an - * object that has implemented {@link goog.events.EventTarget}. A listener can - * only be added once to an object. - * - * @param {EventTarget|goog.events.EventTarget} src The node to listen to - * events on. - * @param {goog.events.EventWrapper} wrapper Event wrapper to use. - * @param {function(this:SCOPE, ?):?|{handleEvent:function(?):?}|null} listener - * Callback method, or an object with a handleEvent function. - * @param {boolean=} opt_capt Whether to fire in capture phase (defaults to - * false). - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - */ -goog.events.EventHandler.prototype.listenWithWrapper = function( - src, wrapper, listener, opt_capt) { - // TODO(mknichel): Remove the opt_scope from this function and then - // templatize it. - return this.listenWithWrapper_(src, wrapper, listener, opt_capt); -}; - - -/** - * Adds an event listener with a specific event wrapper on a DOM Node or an - * object that has implemented {@link goog.events.EventTarget}. A listener can - * only be added once to an object. - * - * @param {EventTarget|goog.events.EventTarget} src The node to listen to - * events on. - * @param {goog.events.EventWrapper} wrapper Event wrapper to use. - * @param {function(this:T, ?):?|{handleEvent:function(this:T, ?):?}|null} - * listener Optional callback function to be used as the - * listener or an object with handleEvent function. - * @param {boolean|undefined} capture Optional whether to use capture phase. - * @param {T} scope Object in whose scope to call the listener. - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - * @template T - */ -goog.events.EventHandler.prototype.listenWithWrapperAndScope = function( - src, wrapper, listener, capture, scope) { - // TODO(mknichel): Deprecate this function. - return this.listenWithWrapper_(src, wrapper, listener, capture, scope); -}; - - -/** - * Adds an event listener with a specific event wrapper on a DOM Node or an - * object that has implemented {@link goog.events.EventTarget}. A listener can - * only be added once to an object. - * - * @param {EventTarget|goog.events.EventTarget} src The node to listen to - * events on. - * @param {goog.events.EventWrapper} wrapper Event wrapper to use. - * @param {function(?):?|{handleEvent:function(?):?}|null} listener Callback - * method, or an object with a handleEvent function. - * @param {boolean=} opt_capt Whether to fire in capture phase (defaults to - * false). - * @param {Object=} opt_scope Element in whose scope to call the listener. - * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for - * chaining of calls. - * @private - */ -goog.events.EventHandler.prototype.listenWithWrapper_ = function( - src, wrapper, listener, opt_capt, opt_scope) { - wrapper.listen(src, listener, opt_capt, opt_scope || this.handler_ || this, - this); - return this; -}; - - -/** - * @return {number} Number of listeners registered by this handler. - */ -goog.events.EventHandler.prototype.getListenerCount = function() { - var count = 0; - for (var key in this.keys_) { - if (Object.prototype.hasOwnProperty.call(this.keys_, key)) { - count++; - } - } - return count; -}; - - -/** - * Unlistens on an event. - * @param {goog.events.ListenableType} src Event source. - * @param {string|Array<string>| - * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>} - * type Event type or array of event types to unlisten to. - * @param {function(EVENTOBJ):?|{handleEvent:function(?):?}|null=} opt_fn - * Optional callback function to be used as the listener or an object with - * handleEvent function. - * @param {boolean=} opt_capture Optional whether to use capture phase. - * @param {Object=} opt_scope Object in whose scope to call the listener. - * @return {!goog.events.EventHandler} This object, allowing for chaining of - * calls. - * @template EVENTOBJ - */ -goog.events.EventHandler.prototype.unlisten = function(src, type, opt_fn, - opt_capture, - opt_scope) { - if (goog.isArray(type)) { - for (var i = 0; i < type.length; i++) { - this.unlisten(src, type[i], opt_fn, opt_capture, opt_scope); - } - } else { - var listener = goog.events.getListener(src, type, - opt_fn || this.handleEvent, - opt_capture, opt_scope || this.handler_ || this); - - if (listener) { - goog.events.unlistenByKey(listener); - delete this.keys_[listener.key]; - } - } - - return this; -}; - - -/** - * Removes an event listener which was added with listenWithWrapper(). - * - * @param {EventTarget|goog.events.EventTarget} src The target to stop - * listening to events on. - * @param {goog.events.EventWrapper} wrapper Event wrapper to use. - * @param {function(?):?|{handleEvent:function(?):?}|null} listener The - * listener function to remove. - * @param {boolean=} opt_capt In DOM-compliant browsers, this determines - * whether the listener is fired during the capture or bubble phase of the - * event. - * @param {Object=} opt_scope Element in whose scope to call the listener. - * @return {!goog.events.EventHandler} This object, allowing for chaining of - * calls. - */ -goog.events.EventHandler.prototype.unlistenWithWrapper = function(src, wrapper, - listener, opt_capt, opt_scope) { - wrapper.unlisten(src, listener, opt_capt, - opt_scope || this.handler_ || this, this); - return this; -}; - - -/** - * Unlistens to all events. - */ -goog.events.EventHandler.prototype.removeAll = function() { - goog.object.forEach(this.keys_, function(listenerObj, key) { - if (this.keys_.hasOwnProperty(key)) { - goog.events.unlistenByKey(listenerObj); - } - }, this); - - this.keys_ = {}; -}; - - -/** - * Disposes of this EventHandler and removes all listeners that it registered. - * @override - * @protected - */ -goog.events.EventHandler.prototype.disposeInternal = function() { - goog.events.EventHandler.superClass_.disposeInternal.call(this); - this.removeAll(); -}; - - -/** - * Default event handler - * @param {goog.events.Event} e Event object. - */ -goog.events.EventHandler.prototype.handleEvent = function(e) { - throw Error('EventHandler.handleEvent not implemented'); -}; - -// Copyright 2012 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Bidi utility functions. - * - */ - -goog.provide('goog.style.bidi'); - -goog.require('goog.dom'); -goog.require('goog.style'); -goog.require('goog.userAgent'); - - -/** - * Returns the normalized scrollLeft position for a scrolled element. - * @param {Element} element The scrolled element. - * @return {number} The number of pixels the element is scrolled. 0 indicates - * that the element is not scrolled at all (which, in general, is the - * left-most position in ltr and the right-most position in rtl). - */ -goog.style.bidi.getScrollLeft = function(element) { - var isRtl = goog.style.isRightToLeft(element); - if (isRtl && goog.userAgent.GECKO) { - // ScrollLeft starts at 0 and then goes negative as the element is scrolled - // towards the left. - return -element.scrollLeft; - } else if (isRtl && - !(goog.userAgent.IE && goog.userAgent.isVersionOrHigher('8'))) { - // ScrollLeft starts at the maximum positive value and decreases towards - // 0 as the element is scrolled towards the left. However, for overflow - // visible, there is no scrollLeft and the value always stays correctly at 0 - var overflowX = goog.style.getComputedOverflowX(element); - if (overflowX == 'visible') { - return element.scrollLeft; - } else { - return element.scrollWidth - element.clientWidth - element.scrollLeft; - } - } - // ScrollLeft behavior is identical in rtl and ltr, it starts at 0 and - // increases as the element is scrolled away from the start. - return element.scrollLeft; -}; - - -/** - * Returns the "offsetStart" of an element, analagous to offsetLeft but - * normalized for right-to-left environments and various browser - * inconsistencies. This value returned can always be passed to setScrollOffset - * to scroll to an element's left edge in a left-to-right offsetParent or - * right edge in a right-to-left offsetParent. - * - * For example, here offsetStart is 10px in an LTR environment and 5px in RTL: - * - * <pre> - * | xxxxxxxxxx | - * ^^^^^^^^^^ ^^^^ ^^^^^ - * 10px elem 5px - * </pre> - * - * If an element is positioned before the start of its offsetParent, the - * startOffset may be negative. This can be used with setScrollOffset to - * reliably scroll to an element: - * - * <pre> - * var scrollOffset = goog.style.bidi.getOffsetStart(element); - * goog.style.bidi.setScrollOffset(element.offsetParent, scrollOffset); - * </pre> - * - * @see setScrollOffset - * - * @param {Element} element The element for which we need to determine the - * offsetStart position. - * @return {number} The offsetStart for that element. - */ -goog.style.bidi.getOffsetStart = function(element) { - element = /** @type {!HTMLElement} */ (element); - var offsetLeftForReal = element.offsetLeft; - - // The element might not have an offsetParent. - // For example, the node might not be attached to the DOM tree, - // and position:fixed children do not have an offset parent. - // Just try to do the best we can with what we have. - var bestParent = element.offsetParent; - - if (!bestParent && goog.style.getComputedPosition(element) == 'fixed') { - bestParent = goog.dom.getOwnerDocument(element).documentElement; - } - - // Just give up in this case. - if (!bestParent) { - return offsetLeftForReal; - } - - if (goog.userAgent.GECKO) { - // When calculating an element's offsetLeft, Firefox erroneously subtracts - // the border width from the actual distance. So we need to add it back. - var borderWidths = goog.style.getBorderBox(bestParent); - offsetLeftForReal += borderWidths.left; - } else if (goog.userAgent.isDocumentModeOrHigher(8) && - !goog.userAgent.isDocumentModeOrHigher(9)) { - // When calculating an element's offsetLeft, IE8/9-Standards Mode - // erroneously adds the border width to the actual distance. So we need to - // subtract it. - var borderWidths = goog.style.getBorderBox(bestParent); - offsetLeftForReal -= borderWidths.left; - } - - if (goog.style.isRightToLeft(bestParent)) { - // Right edge of the element relative to the left edge of its parent. - var elementRightOffset = offsetLeftForReal + element.offsetWidth; - - // Distance from the parent's right edge to the element's right edge. - return bestParent.clientWidth - elementRightOffset; - } - - return offsetLeftForReal; -}; - - -/** - * Sets the element's scrollLeft attribute so it is correctly scrolled by - * offsetStart pixels. This takes into account whether the element is RTL and - * the nuances of different browsers. To scroll to the "beginning" of an - * element use getOffsetStart to obtain the element's offsetStart value and then - * pass the value to setScrollOffset. - * @see getOffsetStart - * @param {Element} element The element to set scrollLeft on. - * @param {number} offsetStart The number of pixels to scroll the element. - * If this value is < 0, 0 is used. - */ -goog.style.bidi.setScrollOffset = function(element, offsetStart) { - offsetStart = Math.max(offsetStart, 0); - // In LTR and in "mirrored" browser RTL (such as IE), we set scrollLeft to - // the number of pixels to scroll. - // Otherwise, in RTL, we need to account for different browser behavior. - if (!goog.style.isRightToLeft(element)) { - element.scrollLeft = offsetStart; - } else if (goog.userAgent.GECKO) { - // Negative scroll-left positions in RTL. - element.scrollLeft = -offsetStart; - } else if (!(goog.userAgent.IE && goog.userAgent.isVersionOrHigher('8'))) { - // Take the current scrollLeft value and move to the right by the - // offsetStart to get to the left edge of the element, and then by - // the clientWidth of the element to get to the right edge. - element.scrollLeft = - element.scrollWidth - offsetStart - element.clientWidth; - } else { - element.scrollLeft = offsetStart; - } -}; - - -/** - * Sets the element's left style attribute in LTR or right style attribute in - * RTL. Also clears the left attribute in RTL and the right attribute in LTR. - * @param {Element} elem The element to position. - * @param {number} left The left position in LTR; will be set as right in RTL. - * @param {?number} top The top position. If null only the left/right is set. - * @param {boolean} isRtl Whether we are in RTL mode. - */ -goog.style.bidi.setPosition = function(elem, left, top, isRtl) { - if (!goog.isNull(top)) { - elem.style.top = top + 'px'; - } - if (isRtl) { - elem.style.right = left + 'px'; - elem.style.left = ''; - } else { - elem.style.left = left + 'px'; - elem.style.right = ''; - } -}; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Drag Utilities. - * - * Provides extensible functionality for drag & drop behaviour. - * - * @see ../demos/drag.html - * @see ../demos/dragger.html - */ - - -goog.provide('goog.fx.DragEvent'); -goog.provide('goog.fx.Dragger'); -goog.provide('goog.fx.Dragger.EventType'); - -goog.require('goog.dom'); -goog.require('goog.dom.TagName'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.events.EventHandler'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); -goog.require('goog.math.Coordinate'); -goog.require('goog.math.Rect'); -goog.require('goog.style'); -goog.require('goog.style.bidi'); -goog.require('goog.userAgent'); - - - -/** - * A class that allows mouse or touch-based dragging (moving) of an element - * - * @param {Element} target The element that will be dragged. - * @param {Element=} opt_handle An optional handle to control the drag, if null - * the target is used. - * @param {goog.math.Rect=} opt_limits Object containing left, top, width, - * and height. - * - * @extends {goog.events.EventTarget} - * @constructor - * @struct - */ -goog.fx.Dragger = function(target, opt_handle, opt_limits) { - goog.fx.Dragger.base(this, 'constructor'); - - /** - * Reference to drag target element. - * @type {?Element} - */ - this.target = target; - - /** - * Reference to the handler that initiates the drag. - * @type {?Element} - */ - this.handle = opt_handle || target; - - /** - * Object representing the limits of the drag region. - * @type {goog.math.Rect} - */ - this.limits = opt_limits || new goog.math.Rect(NaN, NaN, NaN, NaN); - - /** - * Reference to a document object to use for the events. - * @private {Document} - */ - this.document_ = goog.dom.getOwnerDocument(target); - - /** @private {!goog.events.EventHandler} */ - this.eventHandler_ = new goog.events.EventHandler(this); - this.registerDisposable(this.eventHandler_); - - /** - * Whether the element is rendered right-to-left. We initialize this lazily. - * @private {boolean|undefined}} - */ - this.rightToLeft_; - - /** - * Current x position of mouse or touch relative to viewport. - * @type {number} - */ - this.clientX = 0; - - /** - * Current y position of mouse or touch relative to viewport. - * @type {number} - */ - this.clientY = 0; - - /** - * Current x position of mouse or touch relative to screen. Deprecated because - * it doesn't take into affect zoom level or pixel density. - * @type {number} - * @deprecated Consider switching to clientX instead. - */ - this.screenX = 0; - - /** - * Current y position of mouse or touch relative to screen. Deprecated because - * it doesn't take into affect zoom level or pixel density. - * @type {number} - * @deprecated Consider switching to clientY instead. - */ - this.screenY = 0; - - /** - * The x position where the first mousedown or touchstart occurred. - * @type {number} - */ - this.startX = 0; - - /** - * The y position where the first mousedown or touchstart occurred. - * @type {number} - */ - this.startY = 0; - - /** - * Current x position of drag relative to target's parent. - * @type {number} - */ - this.deltaX = 0; - - /** - * Current y position of drag relative to target's parent. - * @type {number} - */ - this.deltaY = 0; - - /** - * The current page scroll value. - * @type {?goog.math.Coordinate} - */ - this.pageScroll; - - /** - * Whether dragging is currently enabled. - * @private {boolean} - */ - this.enabled_ = true; - - /** - * Whether object is currently being dragged. - * @private {boolean} - */ - this.dragging_ = false; - - /** - * Whether mousedown should be default prevented. - * @private {boolean} - **/ - this.preventMouseDown_ = true; - - /** - * The amount of distance, in pixels, after which a mousedown or touchstart is - * considered a drag. - * @private {number} - */ - this.hysteresisDistanceSquared_ = 0; - - /** - * The SCROLL event target used to make drag element follow scrolling. - * @private {?EventTarget} - */ - this.scrollTarget_; - - /** - * Whether IE drag events cancelling is on. - * @private {boolean} - */ - this.ieDragStartCancellingOn_ = false; - - /** - * Whether the dragger implements the changes described in http://b/6324964, - * making it truly RTL. This is a temporary flag to allow clients to - * transition to the new behavior at their convenience. At some point it will - * be the default. - * @private {boolean} - */ - this.useRightPositioningForRtl_ = false; - - // Add listener. Do not use the event handler here since the event handler is - // used for listeners added and removed during the drag operation. - goog.events.listen(this.handle, - [goog.events.EventType.TOUCHSTART, goog.events.EventType.MOUSEDOWN], - this.startDrag, false, this); -}; -goog.inherits(goog.fx.Dragger, goog.events.EventTarget); -// Dragger is meant to be extended, but defines most properties on its -// prototype, thus making it unsuitable for sealing. -goog.tagUnsealableClass(goog.fx.Dragger); - - -/** - * Whether setCapture is supported by the browser. - * @type {boolean} - * @private - */ -goog.fx.Dragger.HAS_SET_CAPTURE_ = - // IE and Gecko after 1.9.3 has setCapture - // WebKit does not yet: https://bugs.webkit.org/show_bug.cgi?id=27330 - goog.userAgent.IE || - goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9.3'); - - -/** - * Creates copy of node being dragged. This is a utility function to be used - * wherever it is inappropriate for the original source to follow the mouse - * cursor itself. - * - * @param {Element} sourceEl Element to copy. - * @return {!Element} The clone of {@code sourceEl}. - */ -goog.fx.Dragger.cloneNode = function(sourceEl) { - var clonedEl = /** @type {Element} */ (sourceEl.cloneNode(true)), - origTexts = sourceEl.getElementsByTagName(goog.dom.TagName.TEXTAREA), - dragTexts = clonedEl.getElementsByTagName(goog.dom.TagName.TEXTAREA); - // Cloning does not copy the current value of textarea elements, so correct - // this manually. - for (var i = 0; i < origTexts.length; i++) { - dragTexts[i].value = origTexts[i].value; - } - switch (sourceEl.tagName) { - case goog.dom.TagName.TR: - return goog.dom.createDom(goog.dom.TagName.TABLE, null, - goog.dom.createDom(goog.dom.TagName.TBODY, - null, clonedEl)); - case goog.dom.TagName.TD: - case goog.dom.TagName.TH: - return goog.dom.createDom( - goog.dom.TagName.TABLE, null, goog.dom.createDom( - goog.dom.TagName.TBODY, null, goog.dom.createDom( - goog.dom.TagName.TR, null, clonedEl))); - case goog.dom.TagName.TEXTAREA: - clonedEl.value = sourceEl.value; - default: - return clonedEl; - } -}; - - -/** - * Constants for event names. - * @enum {string} - */ -goog.fx.Dragger.EventType = { - // The drag action was canceled before the START event. Possible reasons: - // disabled dragger, dragging with the right mouse button or releasing the - // button before reaching the hysteresis distance. - EARLY_CANCEL: 'earlycancel', - START: 'start', - BEFOREDRAG: 'beforedrag', - DRAG: 'drag', - END: 'end' -}; - - -/** - * Turns on/off true RTL behavior. This should be called immediately after - * construction. This is a temporary flag to allow clients to transition - * to the new component at their convenience. At some point true will be the - * default. - * @param {boolean} useRightPositioningForRtl True if "right" should be used for - * positioning, false if "left" should be used for positioning. - */ -goog.fx.Dragger.prototype.enableRightPositioningForRtl = - function(useRightPositioningForRtl) { - this.useRightPositioningForRtl_ = useRightPositioningForRtl; -}; - - -/** - * Returns the event handler, intended for subclass use. - * @return {!goog.events.EventHandler<T>} The event handler. - * @this {T} - * @template T - */ -goog.fx.Dragger.prototype.getHandler = function() { - // TODO(user): templated "this" values currently result in "this" being - // "unknown" in the body of the function. - var self = /** @type {goog.fx.Dragger} */ (this); - return self.eventHandler_; -}; - - -/** - * Sets (or reset) the Drag limits after a Dragger is created. - * @param {goog.math.Rect?} limits Object containing left, top, width, - * height for new Dragger limits. If target is right-to-left and - * enableRightPositioningForRtl(true) is called, then rect is interpreted as - * right, top, width, and height. - */ -goog.fx.Dragger.prototype.setLimits = function(limits) { - this.limits = limits || new goog.math.Rect(NaN, NaN, NaN, NaN); -}; - - -/** - * Sets the distance the user has to drag the element before a drag operation is - * started. - * @param {number} distance The number of pixels after which a mousedown and - * move is considered a drag. - */ -goog.fx.Dragger.prototype.setHysteresis = function(distance) { - this.hysteresisDistanceSquared_ = Math.pow(distance, 2); -}; - - -/** - * Gets the distance the user has to drag the element before a drag operation is - * started. - * @return {number} distance The number of pixels after which a mousedown and - * move is considered a drag. - */ -goog.fx.Dragger.prototype.getHysteresis = function() { - return Math.sqrt(this.hysteresisDistanceSquared_); -}; - - -/** - * Sets the SCROLL event target to make drag element follow scrolling. - * - * @param {EventTarget} scrollTarget The event target that dispatches SCROLL - * events. - */ -goog.fx.Dragger.prototype.setScrollTarget = function(scrollTarget) { - this.scrollTarget_ = scrollTarget; -}; - - -/** - * Enables cancelling of built-in IE drag events. - * @param {boolean} cancelIeDragStart Whether to enable cancelling of IE - * dragstart event. - */ -goog.fx.Dragger.prototype.setCancelIeDragStart = function(cancelIeDragStart) { - this.ieDragStartCancellingOn_ = cancelIeDragStart; -}; - - -/** - * @return {boolean} Whether the dragger is enabled. - */ -goog.fx.Dragger.prototype.getEnabled = function() { - return this.enabled_; -}; - - -/** - * Set whether dragger is enabled - * @param {boolean} enabled Whether dragger is enabled. - */ -goog.fx.Dragger.prototype.setEnabled = function(enabled) { - this.enabled_ = enabled; -}; - - -/** - * Set whether mousedown should be default prevented. - * @param {boolean} preventMouseDown Whether mousedown should be default - * prevented. - */ -goog.fx.Dragger.prototype.setPreventMouseDown = function(preventMouseDown) { - this.preventMouseDown_ = preventMouseDown; -}; - - -/** @override */ -goog.fx.Dragger.prototype.disposeInternal = function() { - goog.fx.Dragger.superClass_.disposeInternal.call(this); - goog.events.unlisten(this.handle, - [goog.events.EventType.TOUCHSTART, goog.events.EventType.MOUSEDOWN], - this.startDrag, false, this); - this.cleanUpAfterDragging_(); - - this.target = null; - this.handle = null; -}; - - -/** - * Whether the DOM element being manipulated is rendered right-to-left. - * @return {boolean} True if the DOM element is rendered right-to-left, false - * otherwise. - * @private - */ -goog.fx.Dragger.prototype.isRightToLeft_ = function() { - if (!goog.isDef(this.rightToLeft_)) { - this.rightToLeft_ = goog.style.isRightToLeft(this.target); - } - return this.rightToLeft_; -}; - - -/** - * Event handler that is used to start the drag - * @param {goog.events.BrowserEvent} e Event object. - */ -goog.fx.Dragger.prototype.startDrag = function(e) { - var isMouseDown = e.type == goog.events.EventType.MOUSEDOWN; - - // Dragger.startDrag() can be called by AbstractDragDrop with a mousemove - // event and IE does not report pressed mouse buttons on mousemove. Also, - // it does not make sense to check for the button if the user is already - // dragging. - - if (this.enabled_ && !this.dragging_ && - (!isMouseDown || e.isMouseActionButton())) { - if (this.hysteresisDistanceSquared_ == 0) { - if (this.fireDragStart_(e)) { - this.dragging_ = true; - if (this.preventMouseDown_) { - e.preventDefault(); - } - } else { - // If the start drag is cancelled, don't setup for a drag. - return; - } - } else if (this.preventMouseDown_) { - // Need to preventDefault for hysteresis to prevent page getting selected. - e.preventDefault(); - } - this.setupDragHandlers(); - - this.clientX = this.startX = e.clientX; - this.clientY = this.startY = e.clientY; - this.screenX = e.screenX; - this.screenY = e.screenY; - this.computeInitialPosition(); - this.pageScroll = goog.dom.getDomHelper(this.document_).getDocumentScroll(); - } else { - this.dispatchEvent(goog.fx.Dragger.EventType.EARLY_CANCEL); - } -}; - - -/** - * Sets up event handlers when dragging starts. - * @protected - */ -goog.fx.Dragger.prototype.setupDragHandlers = function() { - var doc = this.document_; - var docEl = doc.documentElement; - // Use bubbling when we have setCapture since we got reports that IE has - // problems with the capturing events in combination with setCapture. - var useCapture = !goog.fx.Dragger.HAS_SET_CAPTURE_; - - this.eventHandler_.listen(doc, - [goog.events.EventType.TOUCHMOVE, goog.events.EventType.MOUSEMOVE], - this.handleMove_, useCapture); - this.eventHandler_.listen(doc, - [goog.events.EventType.TOUCHEND, goog.events.EventType.MOUSEUP], - this.endDrag, useCapture); - - if (goog.fx.Dragger.HAS_SET_CAPTURE_) { - docEl.setCapture(false); - this.eventHandler_.listen(docEl, - goog.events.EventType.LOSECAPTURE, - this.endDrag); - } else { - // Make sure we stop the dragging if the window loses focus. - // Don't use capture in this listener because we only want to end the drag - // if the actual window loses focus. Since blur events do not bubble we use - // a bubbling listener on the window. - this.eventHandler_.listen(goog.dom.getWindow(doc), - goog.events.EventType.BLUR, - this.endDrag); - } - - if (goog.userAgent.IE && this.ieDragStartCancellingOn_) { - // Cancel IE's 'ondragstart' event. - this.eventHandler_.listen(doc, goog.events.EventType.DRAGSTART, - goog.events.Event.preventDefault); - } - - if (this.scrollTarget_) { - this.eventHandler_.listen(this.scrollTarget_, goog.events.EventType.SCROLL, - this.onScroll_, useCapture); - } -}; - - -/** - * Fires a goog.fx.Dragger.EventType.START event. - * @param {goog.events.BrowserEvent} e Browser event that triggered the drag. - * @return {boolean} False iff preventDefault was called on the DragEvent. - * @private - */ -goog.fx.Dragger.prototype.fireDragStart_ = function(e) { - return this.dispatchEvent(new goog.fx.DragEvent( - goog.fx.Dragger.EventType.START, this, e.clientX, e.clientY, e)); -}; - - -/** - * Unregisters the event handlers that are only active during dragging, and - * releases mouse capture. - * @private - */ -goog.fx.Dragger.prototype.cleanUpAfterDragging_ = function() { - this.eventHandler_.removeAll(); - if (goog.fx.Dragger.HAS_SET_CAPTURE_) { - this.document_.releaseCapture(); - } -}; - - -/** - * Event handler that is used to end the drag. - * @param {goog.events.BrowserEvent} e Event object. - * @param {boolean=} opt_dragCanceled Whether the drag has been canceled. - */ -goog.fx.Dragger.prototype.endDrag = function(e, opt_dragCanceled) { - this.cleanUpAfterDragging_(); - - if (this.dragging_) { - this.dragging_ = false; - - var x = this.limitX(this.deltaX); - var y = this.limitY(this.deltaY); - var dragCanceled = opt_dragCanceled || - e.type == goog.events.EventType.TOUCHCANCEL; - this.dispatchEvent(new goog.fx.DragEvent( - goog.fx.Dragger.EventType.END, this, e.clientX, e.clientY, e, x, y, - dragCanceled)); - } else { - this.dispatchEvent(goog.fx.Dragger.EventType.EARLY_CANCEL); - } -}; - - -/** - * Event handler that is used to end the drag by cancelling it. - * @param {goog.events.BrowserEvent} e Event object. - */ -goog.fx.Dragger.prototype.endDragCancel = function(e) { - this.endDrag(e, true); -}; - - -/** - * Event handler that is used on mouse / touch move to update the drag - * @param {goog.events.BrowserEvent} e Event object. - * @private - */ -goog.fx.Dragger.prototype.handleMove_ = function(e) { - if (this.enabled_) { - // dx in right-to-left cases is relative to the right. - var sign = this.useRightPositioningForRtl_ && - this.isRightToLeft_() ? -1 : 1; - var dx = sign * (e.clientX - this.clientX); - var dy = e.clientY - this.clientY; - this.clientX = e.clientX; - this.clientY = e.clientY; - this.screenX = e.screenX; - this.screenY = e.screenY; - - if (!this.dragging_) { - var diffX = this.startX - this.clientX; - var diffY = this.startY - this.clientY; - var distance = diffX * diffX + diffY * diffY; - if (distance > this.hysteresisDistanceSquared_) { - if (this.fireDragStart_(e)) { - this.dragging_ = true; - } else { - // DragListGroup disposes of the dragger if BEFOREDRAGSTART is - // canceled. - if (!this.isDisposed()) { - this.endDrag(e); - } - return; - } - } - } - - var pos = this.calculatePosition_(dx, dy); - var x = pos.x; - var y = pos.y; - - if (this.dragging_) { - - var rv = this.dispatchEvent(new goog.fx.DragEvent( - goog.fx.Dragger.EventType.BEFOREDRAG, this, e.clientX, e.clientY, - e, x, y)); - - // Only do the defaultAction and dispatch drag event if predrag didn't - // prevent default - if (rv) { - this.doDrag(e, x, y, false); - e.preventDefault(); - } - } - } -}; - - -/** - * Calculates the drag position. - * - * @param {number} dx The horizontal movement delta. - * @param {number} dy The vertical movement delta. - * @return {!goog.math.Coordinate} The newly calculated drag element position. - * @private - */ -goog.fx.Dragger.prototype.calculatePosition_ = function(dx, dy) { - // Update the position for any change in body scrolling - var pageScroll = goog.dom.getDomHelper(this.document_).getDocumentScroll(); - dx += pageScroll.x - this.pageScroll.x; - dy += pageScroll.y - this.pageScroll.y; - this.pageScroll = pageScroll; - - this.deltaX += dx; - this.deltaY += dy; - - var x = this.limitX(this.deltaX); - var y = this.limitY(this.deltaY); - return new goog.math.Coordinate(x, y); -}; - - -/** - * Event handler for scroll target scrolling. - * @param {goog.events.BrowserEvent} e The event. - * @private - */ -goog.fx.Dragger.prototype.onScroll_ = function(e) { - var pos = this.calculatePosition_(0, 0); - e.clientX = this.clientX; - e.clientY = this.clientY; - this.doDrag(e, pos.x, pos.y, true); -}; - - -/** - * @param {goog.events.BrowserEvent} e The closure object - * representing the browser event that caused a drag event. - * @param {number} x The new horizontal position for the drag element. - * @param {number} y The new vertical position for the drag element. - * @param {boolean} dragFromScroll Whether dragging was caused by scrolling - * the associated scroll target. - * @protected - */ -goog.fx.Dragger.prototype.doDrag = function(e, x, y, dragFromScroll) { - this.defaultAction(x, y); - this.dispatchEvent(new goog.fx.DragEvent( - goog.fx.Dragger.EventType.DRAG, this, e.clientX, e.clientY, e, x, y)); -}; - - -/** - * Returns the 'real' x after limits are applied (allows for some - * limits to be undefined). - * @param {number} x X-coordinate to limit. - * @return {number} The 'real' X-coordinate after limits are applied. - */ -goog.fx.Dragger.prototype.limitX = function(x) { - var rect = this.limits; - var left = !isNaN(rect.left) ? rect.left : null; - var width = !isNaN(rect.width) ? rect.width : 0; - var maxX = left != null ? left + width : Infinity; - var minX = left != null ? left : -Infinity; - return Math.min(maxX, Math.max(minX, x)); -}; - - -/** - * Returns the 'real' y after limits are applied (allows for some - * limits to be undefined). - * @param {number} y Y-coordinate to limit. - * @return {number} The 'real' Y-coordinate after limits are applied. - */ -goog.fx.Dragger.prototype.limitY = function(y) { - var rect = this.limits; - var top = !isNaN(rect.top) ? rect.top : null; - var height = !isNaN(rect.height) ? rect.height : 0; - var maxY = top != null ? top + height : Infinity; - var minY = top != null ? top : -Infinity; - return Math.min(maxY, Math.max(minY, y)); -}; - - -/** - * Overridable function for computing the initial position of the target - * before dragging begins. - * @protected - */ -goog.fx.Dragger.prototype.computeInitialPosition = function() { - this.deltaX = this.useRightPositioningForRtl_ ? - goog.style.bidi.getOffsetStart(this.target) : - /** @type {!HTMLElement} */ (this.target).offsetLeft; - this.deltaY = /** @type {!HTMLElement} */ (this.target).offsetTop; -}; - - -/** - * Overridable function for handling the default action of the drag behaviour. - * Normally this is simply moving the element to x,y though in some cases it - * might be used to resize the layer. This is basically a shortcut to - * implementing a default ondrag event handler. - * @param {number} x X-coordinate for target element. In right-to-left, x this - * is the number of pixels the target should be moved to from the right. - * @param {number} y Y-coordinate for target element. - */ -goog.fx.Dragger.prototype.defaultAction = function(x, y) { - if (this.useRightPositioningForRtl_ && this.isRightToLeft_()) { - this.target.style.right = x + 'px'; - } else { - this.target.style.left = x + 'px'; - } - this.target.style.top = y + 'px'; -}; - - -/** - * @return {boolean} Whether the dragger is currently in the midst of a drag. - */ -goog.fx.Dragger.prototype.isDragging = function() { - return this.dragging_; -}; - - - -/** - * Object representing a drag event - * @param {string} type Event type. - * @param {goog.fx.Dragger} dragobj Drag object initiating event. - * @param {number} clientX X-coordinate relative to the viewport. - * @param {number} clientY Y-coordinate relative to the viewport. - * @param {goog.events.BrowserEvent} browserEvent The closure object - * representing the browser event that caused this drag event. - * @param {number=} opt_actX Optional actual x for drag if it has been limited. - * @param {number=} opt_actY Optional actual y for drag if it has been limited. - * @param {boolean=} opt_dragCanceled Whether the drag has been canceled. - * @constructor - * @struct - * @extends {goog.events.Event} - */ -goog.fx.DragEvent = function(type, dragobj, clientX, clientY, browserEvent, - opt_actX, opt_actY, opt_dragCanceled) { - goog.events.Event.call(this, type); - - /** - * X-coordinate relative to the viewport - * @type {number} - */ - this.clientX = clientX; - - /** - * Y-coordinate relative to the viewport - * @type {number} - */ - this.clientY = clientY; - - /** - * The closure object representing the browser event that caused this drag - * event. - * @type {goog.events.BrowserEvent} - */ - this.browserEvent = browserEvent; - - /** - * The real x-position of the drag if it has been limited - * @type {number} - */ - this.left = goog.isDef(opt_actX) ? opt_actX : dragobj.deltaX; - - /** - * The real y-position of the drag if it has been limited - * @type {number} - */ - this.top = goog.isDef(opt_actY) ? opt_actY : dragobj.deltaY; - - /** - * Reference to the drag object for this event - * @type {goog.fx.Dragger} - */ - this.dragger = dragobj; - - /** - * Whether drag was canceled with this event. Used to differentiate between - * a legitimate drag END that can result in an action and a drag END which is - * a result of a drag cancelation. For now it can happen 1) with drag END - * event on FireFox when user drags the mouse out of the window, 2) with - * drag END event on IE7 which is generated on MOUSEMOVE event when user - * moves the mouse into the document after the mouse button has been - * released, 3) when TOUCHCANCEL is raised instead of TOUCHEND (on touch - * events). - * @type {boolean} - */ - this.dragCanceled = !!opt_dragCanceled; -}; -goog.inherits(goog.fx.DragEvent, goog.events.Event); - -// FIXME should possibly show tooltip when dragging? - -goog.provide('ol.control.ZoomSlider'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.events.EventType'); -goog.require('goog.fx.DragEvent'); -goog.require('goog.fx.Dragger'); -goog.require('goog.fx.Dragger.EventType'); -goog.require('goog.math.Rect'); -goog.require('goog.style'); -goog.require('ol.Size'); -goog.require('ol.ViewHint'); -goog.require('ol.animation'); -goog.require('ol.control.Control'); -goog.require('ol.css'); -goog.require('ol.easing'); -goog.require('ol.math'); - - - -/** - * @classdesc - * A slider type of control for zooming. - * - * Example: - * - * map.addControl(new ol.control.ZoomSlider()); - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.ZoomSliderOptions=} opt_options Zoom slider options. - * @api stable - */ -ol.control.ZoomSlider = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - /** - * Will hold the current resolution of the view. - * - * @type {number|undefined} - * @private - */ - this.currentResolution_ = undefined; - - /** - * The direction of the slider. Will be determined from actual display of the - * container and defaults to ol.control.ZoomSlider.direction.VERTICAL. - * - * @type {ol.control.ZoomSlider.direction} - * @private - */ - this.direction_ = ol.control.ZoomSlider.direction.VERTICAL; - - /** - * The calculated thumb size (border box plus margins). Set when initSlider_ - * is called. - * @type {ol.Size} - * @private - */ - this.thumbSize_ = null; - - /** - * Whether the slider is initialized. - * @type {boolean} - * @private - */ - this.sliderInitialized_ = false; - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration ? options.duration : 200; - - var className = options.className ? options.className : 'ol-zoomslider'; - var thumbElement = goog.dom.createDom('BUTTON', { - 'type': 'button', - 'class': className + '-thumb ' + ol.css.CLASS_UNSELECTABLE - }); - var containerElement = goog.dom.createDom('DIV', - [className, ol.css.CLASS_UNSELECTABLE, ol.css.CLASS_CONTROL], - thumbElement); - - /** - * @type {goog.fx.Dragger} - * @private - */ - this.dragger_ = new goog.fx.Dragger(thumbElement); - this.registerDisposable(this.dragger_); - - goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.START, - this.handleDraggerStart_, false, this); - goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.DRAG, - this.handleDraggerDrag_, false, this); - goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.END, - this.handleDraggerEnd_, false, this); - - goog.events.listen(containerElement, goog.events.EventType.CLICK, - this.handleContainerClick_, false, this); - goog.events.listen(thumbElement, goog.events.EventType.CLICK, - goog.events.Event.stopPropagation); - - var render = options.render ? options.render : ol.control.ZoomSlider.render; - - goog.base(this, { - element: containerElement, - render: render - }); -}; -goog.inherits(ol.control.ZoomSlider, ol.control.Control); - - -/** - * The enum for available directions. - * - * @enum {number} - */ -ol.control.ZoomSlider.direction = { - VERTICAL: 0, - HORIZONTAL: 1 -}; - - -/** - * @inheritDoc - */ -ol.control.ZoomSlider.prototype.setMap = function(map) { - goog.base(this, 'setMap', map); - if (map) { - map.render(); - } -}; - - -/** - * Initializes the slider element. This will determine and set this controls - * direction_ and also constrain the dragging of the thumb to always be within - * the bounds of the container. - * - * @private - */ -ol.control.ZoomSlider.prototype.initSlider_ = function() { - var container = this.element; - var containerSize = goog.style.getSize(container); - - var thumb = goog.dom.getFirstElementChild(container); - var thumbMargins = goog.style.getMarginBox(thumb); - var thumbBorderBoxSize = goog.style.getBorderBoxSize(thumb); - var thumbWidth = thumbBorderBoxSize.width + - thumbMargins.right + thumbMargins.left; - var thumbHeight = thumbBorderBoxSize.height + - thumbMargins.top + thumbMargins.bottom; - this.thumbSize_ = [thumbWidth, thumbHeight]; - - var width = containerSize.width - thumbWidth; - var height = containerSize.height - thumbHeight; - - var limits; - if (containerSize.width > containerSize.height) { - this.direction_ = ol.control.ZoomSlider.direction.HORIZONTAL; - limits = new goog.math.Rect(0, 0, width, 0); - } else { - this.direction_ = ol.control.ZoomSlider.direction.VERTICAL; - limits = new goog.math.Rect(0, 0, 0, height); - } - this.dragger_.setLimits(limits); - this.sliderInitialized_ = true; -}; - - -/** - * Update the zoomslider element. - * @param {ol.MapEvent} mapEvent Map event. - * @this {ol.control.ZoomSlider} - * @api - */ -ol.control.ZoomSlider.render = function(mapEvent) { - if (!mapEvent.frameState) { - return; - } - goog.asserts.assert(mapEvent.frameState.viewState, - 'viewState should be defined'); - if (!this.sliderInitialized_) { - this.initSlider_(); - } - var res = mapEvent.frameState.viewState.resolution; - if (res !== this.currentResolution_) { - this.currentResolution_ = res; - this.setThumbPosition_(res); - } -}; - - -/** - * @param {goog.events.BrowserEvent} browserEvent The browser event to handle. - * @private - */ -ol.control.ZoomSlider.prototype.handleContainerClick_ = function(browserEvent) { - var map = this.getMap(); - var view = map.getView(); - var currentResolution = view.getResolution(); - goog.asserts.assert(currentResolution, - 'currentResolution should be defined'); - map.beforeRender(ol.animation.zoom({ - resolution: currentResolution, - duration: this.duration_, - easing: ol.easing.easeOut - })); - var relativePosition = this.getRelativePosition_( - browserEvent.offsetX - this.thumbSize_[0] / 2, - browserEvent.offsetY - this.thumbSize_[1] / 2); - var resolution = this.getResolutionForPosition_(relativePosition); - view.setResolution(view.constrainResolution(resolution)); -}; - - -/** - * Handle dragger start events. - * @param {goog.fx.DragEvent} event The drag event. - * @private - */ -ol.control.ZoomSlider.prototype.handleDraggerStart_ = function(event) { - this.getMap().getView().setHint(ol.ViewHint.INTERACTING, 1); -}; - - -/** - * Handle dragger drag events. - * - * @param {goog.fx.DragEvent} event The drag event. - * @private - */ -ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) { - var relativePosition = this.getRelativePosition_(event.left, event.top); - this.currentResolution_ = this.getResolutionForPosition_(relativePosition); - this.getMap().getView().setResolution(this.currentResolution_); -}; - - -/** - * Handle dragger end events. - * @param {goog.fx.DragEvent} event The drag event. - * @private - */ -ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) { - var map = this.getMap(); - var view = map.getView(); - view.setHint(ol.ViewHint.INTERACTING, -1); - goog.asserts.assert(this.currentResolution_, - 'this.currentResolution_ should be defined'); - map.beforeRender(ol.animation.zoom({ - resolution: this.currentResolution_, - duration: this.duration_, - easing: ol.easing.easeOut - })); - var resolution = view.constrainResolution(this.currentResolution_); - view.setResolution(resolution); -}; - - -/** - * Positions the thumb inside its container according to the given resolution. - * - * @param {number} res The res. - * @private - */ -ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) { - var position = this.getPositionForResolution_(res); - var dragger = this.dragger_; - var thumb = goog.dom.getFirstElementChild(this.element); - - if (this.direction_ == ol.control.ZoomSlider.direction.HORIZONTAL) { - var left = dragger.limits.left + dragger.limits.width * position; - goog.style.setPosition(thumb, left); - } else { - var top = dragger.limits.top + dragger.limits.height * position; - goog.style.setPosition(thumb, dragger.limits.left, top); - } -}; - - -/** - * Calculates the relative position of the thumb given x and y offsets. The - * relative position scales from 0 to 1. The x and y offsets are assumed to be - * in pixel units within the dragger limits. - * - * @param {number} x Pixel position relative to the left of the slider. - * @param {number} y Pixel position relative to the top of the slider. - * @return {number} The relative position of the thumb. - * @private - */ -ol.control.ZoomSlider.prototype.getRelativePosition_ = function(x, y) { - var draggerLimits = this.dragger_.limits; - var amount; - if (this.direction_ === ol.control.ZoomSlider.direction.HORIZONTAL) { - amount = (x - draggerLimits.left) / draggerLimits.width; - } else { - amount = (y - draggerLimits.top) / draggerLimits.height; - } - return ol.math.clamp(amount, 0, 1); -}; - - -/** - * Calculates the corresponding resolution of the thumb given its relative - * position (where 0 is the minimum and 1 is the maximum). - * - * @param {number} position The relative position of the thumb. - * @return {number} The corresponding resolution. - * @private - */ -ol.control.ZoomSlider.prototype.getResolutionForPosition_ = function(position) { - var fn = this.getMap().getView().getResolutionForValueFunction(); - return fn(1 - position); -}; - - -/** - * Determines the relative position of the slider for the given resolution. A - * relative position of 0 corresponds to the minimum view resolution. A - * relative position of 1 corresponds to the maximum view resolution. - * - * @param {number} res The resolution. - * @return {number} The relative position value (between 0 and 1). - * @private - */ -ol.control.ZoomSlider.prototype.getPositionForResolution_ = function(res) { - var fn = this.getMap().getView().getValueForResolutionFunction(); - return 1 - fn(res); -}; - -goog.provide('ol.control.ZoomToExtent'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol.control.Control'); -goog.require('ol.css'); - - - -/** - * @classdesc - * A button control which, when pressed, changes the map view to a specific - * extent. To style this control use the css selector `.ol-zoom-extent`. - * - * @constructor - * @extends {ol.control.Control} - * @param {olx.control.ZoomToExtentOptions=} opt_options Options. - * @api stable - */ -ol.control.ZoomToExtent = function(opt_options) { - var options = opt_options ? opt_options : {}; - - /** - * @type {ol.Extent} - * @private - */ - this.extent_ = options.extent ? options.extent : null; - - var className = options.className ? options.className : - 'ol-zoom-extent'; - - var label = options.label ? options.label : 'E'; - var tipLabel = options.tipLabel ? - options.tipLabel : 'Fit to extent'; - var button = goog.dom.createDom('BUTTON', { - 'type': 'button', - 'title': tipLabel - }, label); - - goog.events.listen(button, goog.events.EventType.CLICK, - this.handleClick_, false, this); - - var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + - ol.css.CLASS_CONTROL; - var element = goog.dom.createDom('DIV', cssClasses, button); - - goog.base(this, { - element: element, - target: options.target - }); -}; -goog.inherits(ol.control.ZoomToExtent, ol.control.Control); - - -/** - * @param {goog.events.BrowserEvent} event The event to handle - * @private - */ -ol.control.ZoomToExtent.prototype.handleClick_ = function(event) { - event.preventDefault(); - this.handleZoomToExtent_(); -}; - - -/** - * @private - */ -ol.control.ZoomToExtent.prototype.handleZoomToExtent_ = function() { - var map = this.getMap(); - var view = map.getView(); - var extent = !this.extent_ ? - view.getProjection().getExtent() : this.extent_; - var size = map.getSize(); - goog.asserts.assert(size, 'size should be defined'); - view.fit(extent, size); -}; - -goog.provide('ol.DeviceOrientation'); -goog.provide('ol.DeviceOrientationProperty'); - -goog.require('goog.events'); -goog.require('ol'); -goog.require('ol.Object'); -goog.require('ol.has'); -goog.require('ol.math'); - - -/** - * @enum {string} - */ -ol.DeviceOrientationProperty = { - ALPHA: 'alpha', - BETA: 'beta', - GAMMA: 'gamma', - HEADING: 'heading', - TRACKING: 'tracking' -}; - - - -/** - * @classdesc - * The ol.DeviceOrientation class provides access to information from - * DeviceOrientation events. See the [HTML 5 DeviceOrientation Specification]( - * http://www.w3.org/TR/orientation-event/) for more details. - * - * Many new computers, and especially mobile phones - * and tablets, provide hardware support for device orientation. Web - * developers targeting mobile devices will be especially interested in this - * class. - * - * Device orientation data are relative to a common starting point. For mobile - * devices, the starting point is to lay your phone face up on a table with the - * top of the phone pointing north. This represents the zero state. All - * angles are then relative to this state. For computers, it is the same except - * the screen is open at 90 degrees. - * - * Device orientation is reported as three angles - `alpha`, `beta`, and - * `gamma` - relative to the starting position along the three planar axes X, Y - * and Z. The X axis runs from the left edge to the right edge through the - * middle of the device. Similarly, the Y axis runs from the bottom to the top - * of the device through the middle. The Z axis runs from the back to the front - * through the middle. In the starting position, the X axis points to the - * right, the Y axis points away from you and the Z axis points straight up - * from the device lying flat. - * - * The three angles representing the device orientation are relative to the - * three axes. `alpha` indicates how much the device has been rotated around the - * Z axis, which is commonly interpreted as the compass heading (see note - * below). `beta` indicates how much the device has been rotated around the X - * axis, or how much it is tilted from front to back. `gamma` indicates how - * much the device has been rotated around the Y axis, or how much it is tilted - * from left to right. - * - * For most browsers, the `alpha` value returns the compass heading so if the - * device points north, it will be 0. With Safari on iOS, the 0 value of - * `alpha` is calculated from when device orientation was first requested. - * ol.DeviceOrientation provides the `heading` property which normalizes this - * behavior across all browsers for you. - * - * It is important to note that the HTML 5 DeviceOrientation specification - * indicates that `alpha`, `beta` and `gamma` are in degrees while the - * equivalent properties in ol.DeviceOrientation are in radians for consistency - * with all other uses of angles throughout OpenLayers. - * - * @see http://www.w3.org/TR/orientation-event/ - * - * To get notified of device orientation changes, register a listener for the - * generic `change` event on your `ol.DeviceOrientation` instance. - * - * @constructor - * @extends {ol.Object} - * @param {olx.DeviceOrientationOptions=} opt_options Options. - * @api - */ -ol.DeviceOrientation = function(opt_options) { - - goog.base(this); - - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {goog.events.Key} - */ - this.listenerKey_ = null; - - goog.events.listen(this, - ol.Object.getChangeEventType(ol.DeviceOrientationProperty.TRACKING), - this.handleTrackingChanged_, false, this); - - this.setTracking(options.tracking !== undefined ? options.tracking : false); - -}; -goog.inherits(ol.DeviceOrientation, ol.Object); - - -/** - * @inheritDoc - */ -ol.DeviceOrientation.prototype.disposeInternal = function() { - this.setTracking(false); - goog.base(this, 'disposeInternal'); -}; - - -/** - * @private - * @param {goog.events.BrowserEvent} browserEvent Event. - */ -ol.DeviceOrientation.prototype.orientationChange_ = function(browserEvent) { - var event = /** @type {DeviceOrientationEvent} */ - (browserEvent.getBrowserEvent()); - if (event.alpha !== null) { - var alpha = ol.math.toRadians(event.alpha); - this.set(ol.DeviceOrientationProperty.ALPHA, alpha); - // event.absolute is undefined in iOS. - if (goog.isBoolean(event.absolute) && event.absolute) { - this.set(ol.DeviceOrientationProperty.HEADING, alpha); - } else if (goog.isNumber(event.webkitCompassHeading) && - event.webkitCompassAccuracy != -1) { - var heading = ol.math.toRadians(event.webkitCompassHeading); - this.set(ol.DeviceOrientationProperty.HEADING, heading); - } - } - if (event.beta !== null) { - this.set(ol.DeviceOrientationProperty.BETA, - ol.math.toRadians(event.beta)); - } - if (event.gamma !== null) { - this.set(ol.DeviceOrientationProperty.GAMMA, - ol.math.toRadians(event.gamma)); - } - this.changed(); -}; - - -/** - * Rotation around the device z-axis (in radians). - * @return {number|undefined} The euler angle in radians of the device from the - * standard Z axis. - * @observable - * @api - */ -ol.DeviceOrientation.prototype.getAlpha = function() { - return /** @type {number|undefined} */ ( - this.get(ol.DeviceOrientationProperty.ALPHA)); -}; - - -/** - * Rotation around the device x-axis (in radians). - * @return {number|undefined} The euler angle in radians of the device from the - * planar X axis. - * @observable - * @api - */ -ol.DeviceOrientation.prototype.getBeta = function() { - return /** @type {number|undefined} */ ( - this.get(ol.DeviceOrientationProperty.BETA)); -}; - - -/** - * Rotation around the device y-axis (in radians). - * @return {number|undefined} The euler angle in radians of the device from the - * planar Y axis. - * @observable - * @api - */ -ol.DeviceOrientation.prototype.getGamma = function() { - return /** @type {number|undefined} */ ( - this.get(ol.DeviceOrientationProperty.GAMMA)); -}; - - -/** - * The heading of the device relative to north (in radians). - * @return {number|undefined} The heading of the device relative to north, in - * radians, normalizing for different browser behavior. - * @observable - * @api - */ -ol.DeviceOrientation.prototype.getHeading = function() { - return /** @type {number|undefined} */ ( - this.get(ol.DeviceOrientationProperty.HEADING)); -}; - - -/** - * Determine if orientation is being tracked. - * @return {boolean} Changes in device orientation are being tracked. - * @observable - * @api - */ -ol.DeviceOrientation.prototype.getTracking = function() { - return /** @type {boolean} */ ( - this.get(ol.DeviceOrientationProperty.TRACKING)); -}; - - -/** - * @private - */ -ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() { - if (ol.has.DEVICE_ORIENTATION) { - var tracking = this.getTracking(); - if (tracking && !this.listenerKey_) { - this.listenerKey_ = goog.events.listen(goog.global, 'deviceorientation', - this.orientationChange_, false, this); - } else if (!tracking && this.listenerKey_) { - goog.events.unlistenByKey(this.listenerKey_); - this.listenerKey_ = null; - } - } -}; - - -/** - * Enable or disable tracking of device orientation events. - * @param {boolean} tracking The status of tracking changes to alpha, beta and - * gamma. If true, changes are tracked and reported immediately. - * @observable - * @api - */ -ol.DeviceOrientation.prototype.setTracking = function(tracking) { - this.set(ol.DeviceOrientationProperty.TRACKING, tracking); -}; - -goog.provide('ol.format.Feature'); - -goog.require('ol.geom.Geometry'); -goog.require('ol.proj'); - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Base class for feature formats. - * {ol.format.Feature} subclasses provide the ability to decode and encode - * {@link ol.Feature} objects from a variety of commonly used geospatial - * file formats. See the documentation for each format for more details. - * - * @constructor - * @api stable - */ -ol.format.Feature = function() { - - /** - * @protected - * @type {ol.proj.Projection} - */ - this.defaultDataProjection = null; - -}; - - -/** - * @return {Array.<string>} Extensions. - */ -ol.format.Feature.prototype.getExtensions = goog.abstractMethod; - - -/** - * Adds the data projection to the read options. - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. - * @return {olx.format.ReadOptions|undefined} Options. - * @protected - */ -ol.format.Feature.prototype.getReadOptions = function(source, opt_options) { - var options; - if (opt_options) { - options = { - dataProjection: opt_options.dataProjection ? - opt_options.dataProjection : this.readProjection(source), - featureProjection: opt_options.featureProjection - }; - } - return this.adaptOptions(options); -}; - - -/** - * Sets the `defaultDataProjection` on the options, if no `dataProjection` - * is set. - * @param {olx.format.WriteOptions|olx.format.ReadOptions|undefined} options - * Options. - * @protected - * @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined} - * Updated options. - */ -ol.format.Feature.prototype.adaptOptions = function(options) { - var updatedOptions; - if (options) { - updatedOptions = { - featureProjection: options.featureProjection, - dataProjection: options.dataProjection ? - options.dataProjection : this.defaultDataProjection, - rightHanded: options.rightHanded - }; - } - return updatedOptions; -}; - - -/** - * @return {ol.format.FormatType} Format. - */ -ol.format.Feature.prototype.getType = goog.abstractMethod; - - -/** - * Read a single feature from a source. - * - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - */ -ol.format.Feature.prototype.readFeature = goog.abstractMethod; - - -/** - * Read all features from a source. - * - * @param {Document|Node|ArrayBuffer|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - */ -ol.format.Feature.prototype.readFeatures = goog.abstractMethod; - - -/** - * Read a single geometry from a source. - * - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.Feature.prototype.readGeometry = goog.abstractMethod; - - -/** - * Read the projection from a source. - * - * @param {Document|Node|Object|string} source Source. - * @return {ol.proj.Projection} Projection. - */ -ol.format.Feature.prototype.readProjection = goog.abstractMethod; - - -/** - * Encode a feature in this format. - * - * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} Result. - */ -ol.format.Feature.prototype.writeFeature = goog.abstractMethod; - - -/** - * Encode an array of features in this format. - * - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} Result. - */ -ol.format.Feature.prototype.writeFeatures = goog.abstractMethod; - - -/** - * Write a single geometry in this format. - * - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} Result. - */ -ol.format.Feature.prototype.writeGeometry = goog.abstractMethod; - - -/** - * @param {ol.geom.Geometry|ol.Extent} geometry Geometry. - * @param {boolean} write Set to true for writing, false for reading. - * @param {(olx.format.WriteOptions|olx.format.ReadOptions)=} opt_options - * Options. - * @return {ol.geom.Geometry|ol.Extent} Transformed geometry. - * @protected - */ -ol.format.Feature.transformWithOptions = function( - geometry, write, opt_options) { - var featureProjection = opt_options ? - ol.proj.get(opt_options.featureProjection) : null; - var dataProjection = opt_options ? - ol.proj.get(opt_options.dataProjection) : null; - if (featureProjection && dataProjection && - !ol.proj.equivalent(featureProjection, dataProjection)) { - if (geometry instanceof ol.geom.Geometry) { - return (write ? geometry.clone() : geometry).transform( - write ? featureProjection : dataProjection, - write ? dataProjection : featureProjection); - } else { - // FIXME this is necessary because ol.format.GML treats extents - // as geometries - return ol.proj.transformExtent( - write ? geometry.slice() : geometry, - write ? featureProjection : dataProjection, - write ? dataProjection : featureProjection); - } - } else { - return geometry; - } -}; - -goog.provide('ol.format.JSONFeature'); - -goog.require('goog.asserts'); -goog.require('goog.json'); -goog.require('ol.format.Feature'); -goog.require('ol.format.FormatType'); - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Base class for JSON feature formats. - * - * @constructor - * @extends {ol.format.Feature} - */ -ol.format.JSONFeature = function() { - goog.base(this); -}; -goog.inherits(ol.format.JSONFeature, ol.format.Feature); - - -/** - * @param {Document|Node|Object|string} source Source. - * @private - * @return {Object} Object. - */ -ol.format.JSONFeature.prototype.getObject_ = function(source) { - if (goog.isObject(source)) { - return source; - } else if (goog.isString(source)) { - var object = goog.json.parse(source); - return object ? object : null; - } else { - goog.asserts.fail(); - return null; - } -}; - - -/** - * @inheritDoc - */ -ol.format.JSONFeature.prototype.getType = function() { - return ol.format.FormatType.JSON; -}; - - -/** - * @inheritDoc - */ -ol.format.JSONFeature.prototype.readFeature = function(source, opt_options) { - return this.readFeatureFromObject( - this.getObject_(source), this.getReadOptions(source, opt_options)); -}; - - -/** - * @inheritDoc - */ -ol.format.JSONFeature.prototype.readFeatures = function(source, opt_options) { - return this.readFeaturesFromObject( - this.getObject_(source), this.getReadOptions(source, opt_options)); -}; - - -/** - * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @protected - * @return {ol.Feature} Feature. - */ -ol.format.JSONFeature.prototype.readFeatureFromObject = goog.abstractMethod; - - -/** - * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @protected - * @return {Array.<ol.Feature>} Features. - */ -ol.format.JSONFeature.prototype.readFeaturesFromObject = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.JSONFeature.prototype.readGeometry = function(source, opt_options) { - return this.readGeometryFromObject( - this.getObject_(source), this.getReadOptions(source, opt_options)); -}; - - -/** - * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @protected - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.JSONFeature.prototype.readGeometryFromObject = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.JSONFeature.prototype.readProjection = function(source) { - return this.readProjectionFromObject(this.getObject_(source)); -}; - - -/** - * @param {Object} object Object. - * @protected - * @return {ol.proj.Projection} Projection. - */ -ol.format.JSONFeature.prototype.readProjectionFromObject = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.JSONFeature.prototype.writeFeature = function(feature, opt_options) { - return goog.json.serialize(this.writeFeatureObject(feature, opt_options)); -}; - - -/** - * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {Object} Object. - */ -ol.format.JSONFeature.prototype.writeFeatureObject = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.JSONFeature.prototype.writeFeatures = function( - features, opt_options) { - return goog.json.serialize(this.writeFeaturesObject(features, opt_options)); -}; - - -/** - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {Object} Object. - */ -ol.format.JSONFeature.prototype.writeFeaturesObject = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.JSONFeature.prototype.writeGeometry = function( - geometry, opt_options) { - return goog.json.serialize(this.writeGeometryObject(geometry, opt_options)); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {Object} Object. - */ -ol.format.JSONFeature.prototype.writeGeometryObject = goog.abstractMethod; - -goog.provide('ol.geom.flat.interpolate'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.math'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} fraction Fraction. - * @param {Array.<number>=} opt_dest Destination. - * @return {Array.<number>} Destination. - */ -ol.geom.flat.interpolate.lineString = - function(flatCoordinates, offset, end, stride, fraction, opt_dest) { - // FIXME interpolate extra dimensions - goog.asserts.assert(0 <= fraction && fraction <= 1, - 'fraction should be in between 0 and 1'); - var pointX = NaN; - var pointY = NaN; - var n = (end - offset) / stride; - if (n === 0) { - goog.asserts.fail('n cannot be 0'); - } else if (n == 1) { - pointX = flatCoordinates[offset]; - pointY = flatCoordinates[offset + 1]; - } else if (n == 2) { - pointX = (1 - fraction) * flatCoordinates[offset] + - fraction * flatCoordinates[offset + stride]; - pointY = (1 - fraction) * flatCoordinates[offset + 1] + - fraction * flatCoordinates[offset + stride + 1]; - } else { - var x1 = flatCoordinates[offset]; - var y1 = flatCoordinates[offset + 1]; - var length = 0; - var cumulativeLengths = [0]; - var i; - for (i = offset + stride; i < end; i += stride) { - var x2 = flatCoordinates[i]; - var y2 = flatCoordinates[i + 1]; - length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); - cumulativeLengths.push(length); - x1 = x2; - y1 = y2; - } - var target = fraction * length; - var index = goog.array.binarySearch(cumulativeLengths, target); - if (index < 0) { - var t = (target - cumulativeLengths[-index - 2]) / - (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]); - var o = offset + (-index - 2) * stride; - pointX = goog.math.lerp( - flatCoordinates[o], flatCoordinates[o + stride], t); - pointY = goog.math.lerp( - flatCoordinates[o + 1], flatCoordinates[o + stride + 1], t); - } else { - pointX = flatCoordinates[offset + index * stride]; - pointY = flatCoordinates[offset + index * stride + 1]; - } - } - if (opt_dest) { - opt_dest[0] = pointX; - opt_dest[1] = pointY; - return opt_dest; - } else { - return [pointX, pointY]; - } -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {number} m M. - * @param {boolean} extrapolate Extrapolate. - * @return {ol.Coordinate} Coordinate. - */ -ol.geom.flat.lineStringCoordinateAtM = - function(flatCoordinates, offset, end, stride, m, extrapolate) { - if (end == offset) { - return null; - } - var coordinate; - if (m < flatCoordinates[offset + stride - 1]) { - if (extrapolate) { - coordinate = flatCoordinates.slice(offset, offset + stride); - coordinate[stride - 1] = m; - return coordinate; - } else { - return null; - } - } else if (flatCoordinates[end - 1] < m) { - if (extrapolate) { - coordinate = flatCoordinates.slice(end - stride, end); - coordinate[stride - 1] = m; - return coordinate; - } else { - return null; - } - } - // FIXME use O(1) search - if (m == flatCoordinates[offset + stride - 1]) { - return flatCoordinates.slice(offset, offset + stride); - } - var lo = offset / stride; - var hi = end / stride; - while (lo < hi) { - var mid = (lo + hi) >> 1; - if (m < flatCoordinates[(mid + 1) * stride - 1]) { - hi = mid; - } else { - lo = mid + 1; - } - } - var m0 = flatCoordinates[lo * stride - 1]; - if (m == m0) { - return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride); - } - var m1 = flatCoordinates[(lo + 1) * stride - 1]; - goog.asserts.assert(m0 < m, 'm0 should be less than m'); - goog.asserts.assert(m <= m1, 'm should be less than or equal to m1'); - var t = (m - m0) / (m1 - m0); - coordinate = []; - var i; - for (i = 0; i < stride - 1; ++i) { - coordinate.push(goog.math.lerp(flatCoordinates[(lo - 1) * stride + i], - flatCoordinates[lo * stride + i], t)); - } - coordinate.push(m); - goog.asserts.assert(coordinate.length == stride, - 'length of coordinate array should match stride'); - return coordinate; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<number>} ends Ends. - * @param {number} stride Stride. - * @param {number} m M. - * @param {boolean} extrapolate Extrapolate. - * @param {boolean} interpolate Interpolate. - * @return {ol.Coordinate} Coordinate. - */ -ol.geom.flat.lineStringsCoordinateAtM = function( - flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) { - if (interpolate) { - return ol.geom.flat.lineStringCoordinateAtM( - flatCoordinates, offset, ends[ends.length - 1], stride, m, extrapolate); - } - var coordinate; - if (m < flatCoordinates[stride - 1]) { - if (extrapolate) { - coordinate = flatCoordinates.slice(0, stride); - coordinate[stride - 1] = m; - return coordinate; - } else { - return null; - } - } - if (flatCoordinates[flatCoordinates.length - 1] < m) { - if (extrapolate) { - coordinate = flatCoordinates.slice(flatCoordinates.length - stride); - coordinate[stride - 1] = m; - return coordinate; - } else { - return null; - } - } - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - if (offset == end) { - continue; - } - if (m < flatCoordinates[offset + stride - 1]) { - return null; - } else if (m <= flatCoordinates[end - 1]) { - return ol.geom.flat.lineStringCoordinateAtM( - flatCoordinates, offset, end, stride, m, false); - } - offset = end; - } - goog.asserts.fail( - 'ol.geom.flat.lineStringsCoordinateAtM should have returned'); - return null; -}; - -goog.provide('ol.geom.flat.length'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @return {number} Length. - */ -ol.geom.flat.length.lineString = - function(flatCoordinates, offset, end, stride) { - var x1 = flatCoordinates[offset]; - var y1 = flatCoordinates[offset + 1]; - var length = 0; - var i; - for (i = offset + stride; i < end; i += stride) { - var x2 = flatCoordinates[i]; - var y2 = flatCoordinates[i + 1]; - length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); - x1 = x2; - y1 = y2; - } - return length; -}; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @return {number} Perimeter. - */ -ol.geom.flat.length.linearRing = - function(flatCoordinates, offset, end, stride) { - var perimeter = - ol.geom.flat.length.lineString(flatCoordinates, offset, end, stride); - var dx = flatCoordinates[end - stride] - flatCoordinates[offset]; - var dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1]; - perimeter += Math.sqrt(dx * dx + dy * dy); - return perimeter; -}; - -goog.provide('ol.geom.LineString'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('ol'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.closest'); -goog.require('ol.geom.flat.deflate'); -goog.require('ol.geom.flat.inflate'); -goog.require('ol.geom.flat.interpolate'); -goog.require('ol.geom.flat.intersectsextent'); -goog.require('ol.geom.flat.length'); -goog.require('ol.geom.flat.segments'); -goog.require('ol.geom.flat.simplify'); - - - -/** - * @classdesc - * Linestring geometry. - * - * @constructor - * @extends {ol.geom.SimpleGeometry} - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.LineString = function(coordinates, opt_layout) { - - goog.base(this); - - /** - * @private - * @type {ol.Coordinate} - */ - this.flatMidpoint_ = null; - - /** - * @private - * @type {number} - */ - this.flatMidpointRevision_ = -1; - - /** - * @private - * @type {number} - */ - this.maxDelta_ = -1; - - /** - * @private - * @type {number} - */ - this.maxDeltaRevision_ = -1; - - this.setCoordinates(coordinates, opt_layout); - -}; -goog.inherits(ol.geom.LineString, ol.geom.SimpleGeometry); - - -/** - * Append the passed coordinate to the coordinates of the linestring. - * @param {ol.Coordinate} coordinate Coordinate. - * @api stable - */ -ol.geom.LineString.prototype.appendCoordinate = function(coordinate) { - goog.asserts.assert(coordinate.length == this.stride, - 'length of coordinate array should match stride'); - if (!this.flatCoordinates) { - this.flatCoordinates = coordinate.slice(); - } else { - goog.array.extend(this.flatCoordinates, coordinate); - } - this.changed(); -}; - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.LineString} Clone. - * @api stable - */ -ol.geom.LineString.prototype.clone = function() { - var lineString = new ol.geom.LineString(null); - lineString.setFlatCoordinates(this.layout, this.flatCoordinates.slice()); - return lineString; -}; - - -/** - * @inheritDoc - */ -ol.geom.LineString.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - if (minSquaredDistance < - ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) { - return minSquaredDistance; - } - if (this.maxDeltaRevision_ != this.getRevision()) { - this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getMaxSquaredDelta( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0)); - this.maxDeltaRevision_ = this.getRevision(); - } - return ol.geom.flat.closest.getClosestPoint( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, - this.maxDelta_, false, x, y, closestPoint, minSquaredDistance); -}; - - -/** - * Iterate over each segment, calling the provided callback. - * If the callback returns a truthy value the function returns that - * value immediately. Otherwise the function returns `false`. - * - * @param {function(this: S, ol.Coordinate, ol.Coordinate): T} callback Function - * called for each segment. - * @param {S=} opt_this The object to be used as the value of 'this' - * within callback. - * @return {T|boolean} Value. - * @template T,S - * @api - */ -ol.geom.LineString.prototype.forEachSegment = function(callback, opt_this) { - return ol.geom.flat.segments.forEach(this.flatCoordinates, 0, - this.flatCoordinates.length, this.stride, callback, opt_this); -}; - - -/** - * Returns the coordinate at `m` using linear interpolation, or `null` if no - * such coordinate exists. - * - * `opt_extrapolate` controls extrapolation beyond the range of Ms in the - * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first - * M will return the first coordinate and Ms greater than the last M will - * return the last coordinate. - * - * @param {number} m M. - * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`. - * @return {ol.Coordinate} Coordinate. - * @api stable - */ -ol.geom.LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) { - if (this.layout != ol.geom.GeometryLayout.XYM && - this.layout != ol.geom.GeometryLayout.XYZM) { - return null; - } - var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false; - return ol.geom.flat.lineStringCoordinateAtM(this.flatCoordinates, 0, - this.flatCoordinates.length, this.stride, m, extrapolate); -}; - - -/** - * Return the coordinates of the linestring. - * @return {Array.<ol.Coordinate>} Coordinates. - * @api stable - */ -ol.geom.LineString.prototype.getCoordinates = function() { - return ol.geom.flat.inflate.coordinates( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); -}; - - -/** - * Return the length of the linestring on projected plane. - * @return {number} Length (on projected plane). - * @api stable - */ -ol.geom.LineString.prototype.getLength = function() { - return ol.geom.flat.length.lineString( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); -}; - - -/** - * @return {Array.<number>} Flat midpoint. - */ -ol.geom.LineString.prototype.getFlatMidpoint = function() { - if (this.flatMidpointRevision_ != this.getRevision()) { - this.flatMidpoint_ = ol.geom.flat.interpolate.lineString( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, - 0.5, this.flatMidpoint_); - this.flatMidpointRevision_ = this.getRevision(); - } - return this.flatMidpoint_; -}; - - -/** - * @inheritDoc - */ -ol.geom.LineString.prototype.getSimplifiedGeometryInternal = - function(squaredTolerance) { - var simplifiedFlatCoordinates = []; - simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeucker( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, - squaredTolerance, simplifiedFlatCoordinates, 0); - var simplifiedLineString = new ol.geom.LineString(null); - simplifiedLineString.setFlatCoordinates( - ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates); - return simplifiedLineString; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.LineString.prototype.getType = function() { - return ol.geom.GeometryType.LINE_STRING; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.LineString.prototype.intersectsExtent = function(extent) { - return ol.geom.flat.intersectsextent.lineString( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, - extent); -}; - - -/** - * Set the coordinates of the linestring. - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.LineString.prototype.setCoordinates = - function(coordinates, opt_layout) { - if (!coordinates) { - this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null); - } else { - this.setLayout(opt_layout, coordinates, 1); - if (!this.flatCoordinates) { - this.flatCoordinates = []; - } - this.flatCoordinates.length = ol.geom.flat.deflate.coordinates( - this.flatCoordinates, 0, coordinates, this.stride); - this.changed(); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - */ -ol.geom.LineString.prototype.setFlatCoordinates = - function(layout, flatCoordinates) { - this.setFlatCoordinatesInternal(layout, flatCoordinates); - this.changed(); -}; - -goog.provide('ol.geom.MultiLineString'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('ol'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.closest'); -goog.require('ol.geom.flat.deflate'); -goog.require('ol.geom.flat.inflate'); -goog.require('ol.geom.flat.interpolate'); -goog.require('ol.geom.flat.intersectsextent'); -goog.require('ol.geom.flat.simplify'); - - - -/** - * @classdesc - * Multi-linestring geometry. - * - * @constructor - * @extends {ol.geom.SimpleGeometry} - * @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.MultiLineString = function(coordinates, opt_layout) { - - goog.base(this); - - /** - * @type {Array.<number>} - * @private - */ - this.ends_ = []; - - /** - * @private - * @type {number} - */ - this.maxDelta_ = -1; - - /** - * @private - * @type {number} - */ - this.maxDeltaRevision_ = -1; - - this.setCoordinates(coordinates, opt_layout); - -}; -goog.inherits(ol.geom.MultiLineString, ol.geom.SimpleGeometry); - - -/** - * Append the passed linestring to the multilinestring. - * @param {ol.geom.LineString} lineString LineString. - * @api stable - */ -ol.geom.MultiLineString.prototype.appendLineString = function(lineString) { - goog.asserts.assert(lineString.getLayout() == this.layout, - 'layout of lineString should match the layout'); - if (!this.flatCoordinates) { - this.flatCoordinates = lineString.getFlatCoordinates().slice(); - } else { - goog.array.extend( - this.flatCoordinates, lineString.getFlatCoordinates().slice()); - } - this.ends_.push(this.flatCoordinates.length); - this.changed(); -}; - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.MultiLineString} Clone. - * @api stable - */ -ol.geom.MultiLineString.prototype.clone = function() { - var multiLineString = new ol.geom.MultiLineString(null); - multiLineString.setFlatCoordinates( - this.layout, this.flatCoordinates.slice(), this.ends_.slice()); - return multiLineString; -}; - - -/** - * @inheritDoc - */ -ol.geom.MultiLineString.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - if (minSquaredDistance < - ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) { - return minSquaredDistance; - } - if (this.maxDeltaRevision_ != this.getRevision()) { - this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getsMaxSquaredDelta( - this.flatCoordinates, 0, this.ends_, this.stride, 0)); - this.maxDeltaRevision_ = this.getRevision(); - } - return ol.geom.flat.closest.getsClosestPoint( - this.flatCoordinates, 0, this.ends_, this.stride, - this.maxDelta_, false, x, y, closestPoint, minSquaredDistance); -}; - - -/** - * Returns the coordinate at `m` using linear interpolation, or `null` if no - * such coordinate exists. - * - * `opt_extrapolate` controls extrapolation beyond the range of Ms in the - * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first - * M will return the first coordinate and Ms greater than the last M will - * return the last coordinate. - * - * `opt_interpolate` controls interpolation between consecutive LineStrings - * within the MultiLineString. If `opt_interpolate` is `true` the coordinates - * will be linearly interpolated between the last coordinate of one LineString - * and the first coordinate of the next LineString. If `opt_interpolate` is - * `false` then the function will return `null` for Ms falling between - * LineStrings. - * - * @param {number} m M. - * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`. - * @param {boolean=} opt_interpolate Interpolate. Default is `false`. - * @return {ol.Coordinate} Coordinate. - * @api stable - */ -ol.geom.MultiLineString.prototype.getCoordinateAtM = - function(m, opt_extrapolate, opt_interpolate) { - if ((this.layout != ol.geom.GeometryLayout.XYM && - this.layout != ol.geom.GeometryLayout.XYZM) || - this.flatCoordinates.length === 0) { - return null; - } - var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false; - var interpolate = opt_interpolate !== undefined ? opt_interpolate : false; - return ol.geom.flat.lineStringsCoordinateAtM(this.flatCoordinates, 0, - this.ends_, this.stride, m, extrapolate, interpolate); -}; - - -/** - * Return the coordinates of the multilinestring. - * @return {Array.<Array.<ol.Coordinate>>} Coordinates. - * @api stable - */ -ol.geom.MultiLineString.prototype.getCoordinates = function() { - return ol.geom.flat.inflate.coordinatess( - this.flatCoordinates, 0, this.ends_, this.stride); -}; - - -/** - * @return {Array.<number>} Ends. - */ -ol.geom.MultiLineString.prototype.getEnds = function() { - return this.ends_; -}; - - -/** - * Return the linestring at the specified index. - * @param {number} index Index. - * @return {ol.geom.LineString} LineString. - * @api stable - */ -ol.geom.MultiLineString.prototype.getLineString = function(index) { - goog.asserts.assert(0 <= index && index < this.ends_.length, - 'index should be in between 0 and length of the this.ends_ array'); - if (index < 0 || this.ends_.length <= index) { - return null; - } - var lineString = new ol.geom.LineString(null); - lineString.setFlatCoordinates(this.layout, this.flatCoordinates.slice( - index === 0 ? 0 : this.ends_[index - 1], this.ends_[index])); - return lineString; -}; - - -/** - * Return the linestrings of this multilinestring. - * @return {Array.<ol.geom.LineString>} LineStrings. - * @api stable - */ -ol.geom.MultiLineString.prototype.getLineStrings = function() { - var flatCoordinates = this.flatCoordinates; - var ends = this.ends_; - var layout = this.layout; - /** @type {Array.<ol.geom.LineString>} */ - var lineStrings = []; - var offset = 0; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - var lineString = new ol.geom.LineString(null); - lineString.setFlatCoordinates(layout, flatCoordinates.slice(offset, end)); - lineStrings.push(lineString); - offset = end; - } - return lineStrings; -}; - - -/** - * @return {Array.<number>} Flat midpoints. - */ -ol.geom.MultiLineString.prototype.getFlatMidpoints = function() { - var midpoints = []; - var flatCoordinates = this.flatCoordinates; - var offset = 0; - var ends = this.ends_; - var stride = this.stride; - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - var end = ends[i]; - var midpoint = ol.geom.flat.interpolate.lineString( - flatCoordinates, offset, end, stride, 0.5); - goog.array.extend(midpoints, midpoint); - offset = end; - } - return midpoints; -}; - - -/** - * @inheritDoc - */ -ol.geom.MultiLineString.prototype.getSimplifiedGeometryInternal = - function(squaredTolerance) { - var simplifiedFlatCoordinates = []; - var simplifiedEnds = []; - simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeuckers( - this.flatCoordinates, 0, this.ends_, this.stride, squaredTolerance, - simplifiedFlatCoordinates, 0, simplifiedEnds); - var simplifiedMultiLineString = new ol.geom.MultiLineString(null); - simplifiedMultiLineString.setFlatCoordinates( - ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates, simplifiedEnds); - return simplifiedMultiLineString; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.MultiLineString.prototype.getType = function() { - return ol.geom.GeometryType.MULTI_LINE_STRING; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.MultiLineString.prototype.intersectsExtent = function(extent) { - return ol.geom.flat.intersectsextent.lineStrings( - this.flatCoordinates, 0, this.ends_, this.stride, extent); -}; - - -/** - * Set the coordinates of the multilinestring. - * @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.MultiLineString.prototype.setCoordinates = - function(coordinates, opt_layout) { - if (!coordinates) { - this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.ends_); - } else { - this.setLayout(opt_layout, coordinates, 2); - if (!this.flatCoordinates) { - this.flatCoordinates = []; - } - var ends = ol.geom.flat.deflate.coordinatess( - this.flatCoordinates, 0, coordinates, this.stride, this.ends_); - this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1]; - this.changed(); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {Array.<number>} ends Ends. - */ -ol.geom.MultiLineString.prototype.setFlatCoordinates = - function(layout, flatCoordinates, ends) { - if (!flatCoordinates) { - goog.asserts.assert(ends && ends.length === 0, - 'ends must be truthy and ends.length should be 0'); - } else if (ends.length === 0) { - goog.asserts.assert(flatCoordinates.length === 0, - 'flatCoordinates should be an empty array'); - } else { - goog.asserts.assert(flatCoordinates.length == ends[ends.length - 1], - 'length of flatCoordinates array should match the last value of ends'); - } - this.setFlatCoordinatesInternal(layout, flatCoordinates); - this.ends_ = ends; - this.changed(); -}; - - -/** - * @param {Array.<ol.geom.LineString>} lineStrings LineStrings. - */ -ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) { - var layout = this.getLayout(); - var flatCoordinates = []; - var ends = []; - var i, ii; - for (i = 0, ii = lineStrings.length; i < ii; ++i) { - var lineString = lineStrings[i]; - if (i === 0) { - layout = lineString.getLayout(); - } else { - // FIXME better handle the case of non-matching layouts - goog.asserts.assert(lineString.getLayout() == layout, - 'layout of lineString should match layout'); - } - goog.array.extend(flatCoordinates, lineString.getFlatCoordinates()); - ends.push(flatCoordinates.length); - } - this.setFlatCoordinates(layout, flatCoordinates, ends); -}; - -goog.provide('ol.geom.MultiPoint'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.deflate'); -goog.require('ol.geom.flat.inflate'); -goog.require('ol.math'); - - - -/** - * @classdesc - * Multi-point geometry. - * - * @constructor - * @extends {ol.geom.SimpleGeometry} - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.MultiPoint = function(coordinates, opt_layout) { - goog.base(this); - this.setCoordinates(coordinates, opt_layout); -}; -goog.inherits(ol.geom.MultiPoint, ol.geom.SimpleGeometry); - - -/** - * Append the passed point to this multipoint. - * @param {ol.geom.Point} point Point. - * @api stable - */ -ol.geom.MultiPoint.prototype.appendPoint = function(point) { - goog.asserts.assert(point.getLayout() == this.layout, - 'the layout of point should match layout'); - if (!this.flatCoordinates) { - this.flatCoordinates = point.getFlatCoordinates().slice(); - } else { - goog.array.extend(this.flatCoordinates, point.getFlatCoordinates()); - } - this.changed(); -}; - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.MultiPoint} Clone. - * @api stable - */ -ol.geom.MultiPoint.prototype.clone = function() { - var multiPoint = new ol.geom.MultiPoint(null); - multiPoint.setFlatCoordinates(this.layout, this.flatCoordinates.slice()); - return multiPoint; -}; - - -/** - * @inheritDoc - */ -ol.geom.MultiPoint.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - if (minSquaredDistance < - ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) { - return minSquaredDistance; - } - var flatCoordinates = this.flatCoordinates; - var stride = this.stride; - var i, ii, j; - for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) { - var squaredDistance = ol.math.squaredDistance( - x, y, flatCoordinates[i], flatCoordinates[i + 1]); - if (squaredDistance < minSquaredDistance) { - minSquaredDistance = squaredDistance; - for (j = 0; j < stride; ++j) { - closestPoint[j] = flatCoordinates[i + j]; - } - closestPoint.length = stride; - } - } - return minSquaredDistance; -}; - - -/** - * Return the coordinates of the multipoint. - * @return {Array.<ol.Coordinate>} Coordinates. - * @api stable - */ -ol.geom.MultiPoint.prototype.getCoordinates = function() { - return ol.geom.flat.inflate.coordinates( - this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); -}; - - -/** - * Return the point at the specified index. - * @param {number} index Index. - * @return {ol.geom.Point} Point. - * @api stable - */ -ol.geom.MultiPoint.prototype.getPoint = function(index) { - var n = !this.flatCoordinates ? - 0 : this.flatCoordinates.length / this.stride; - goog.asserts.assert(0 <= index && index < n, - 'index should be in between 0 and n'); - if (index < 0 || n <= index) { - return null; - } - var point = new ol.geom.Point(null); - point.setFlatCoordinates(this.layout, this.flatCoordinates.slice( - index * this.stride, (index + 1) * this.stride)); - return point; -}; - - -/** - * Return the points of this multipoint. - * @return {Array.<ol.geom.Point>} Points. - * @api stable - */ -ol.geom.MultiPoint.prototype.getPoints = function() { - var flatCoordinates = this.flatCoordinates; - var layout = this.layout; - var stride = this.stride; - /** @type {Array.<ol.geom.Point>} */ - var points = []; - var i, ii; - for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) { - var point = new ol.geom.Point(null); - point.setFlatCoordinates(layout, flatCoordinates.slice(i, i + stride)); - points.push(point); - } - return points; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.MultiPoint.prototype.getType = function() { - return ol.geom.GeometryType.MULTI_POINT; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.MultiPoint.prototype.intersectsExtent = function(extent) { - var flatCoordinates = this.flatCoordinates; - var stride = this.stride; - var i, ii, x, y; - for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) { - x = flatCoordinates[i]; - y = flatCoordinates[i + 1]; - if (ol.extent.containsXY(extent, x, y)) { - return true; - } - } - return false; -}; - - -/** - * Set the coordinates of the multipoint. - * @param {Array.<ol.Coordinate>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.MultiPoint.prototype.setCoordinates = - function(coordinates, opt_layout) { - if (!coordinates) { - this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null); - } else { - this.setLayout(opt_layout, coordinates, 1); - if (!this.flatCoordinates) { - this.flatCoordinates = []; - } - this.flatCoordinates.length = ol.geom.flat.deflate.coordinates( - this.flatCoordinates, 0, coordinates, this.stride); - this.changed(); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - */ -ol.geom.MultiPoint.prototype.setFlatCoordinates = - function(layout, flatCoordinates) { - this.setFlatCoordinatesInternal(layout, flatCoordinates); - this.changed(); -}; - -goog.provide('ol.geom.flat.center'); - -goog.require('ol.extent'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {Array.<Array.<number>>} endss Endss. - * @param {number} stride Stride. - * @return {Array.<number>} Flat centers. - */ -ol.geom.flat.center.linearRingss = - function(flatCoordinates, offset, endss, stride) { - var flatCenters = []; - var i, ii; - var extent = ol.extent.createEmpty(); - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i]; - extent = ol.extent.createOrUpdateFromFlatCoordinates( - flatCoordinates, offset, ends[0], stride); - flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2); - offset = ends[ends.length - 1]; - } - return flatCenters; -}; - -goog.provide('ol.geom.MultiPolygon'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.Polygon'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.area'); -goog.require('ol.geom.flat.center'); -goog.require('ol.geom.flat.closest'); -goog.require('ol.geom.flat.contains'); -goog.require('ol.geom.flat.deflate'); -goog.require('ol.geom.flat.inflate'); -goog.require('ol.geom.flat.interiorpoint'); -goog.require('ol.geom.flat.intersectsextent'); -goog.require('ol.geom.flat.orient'); -goog.require('ol.geom.flat.simplify'); - - - -/** - * @classdesc - * Multi-polygon geometry. - * - * @constructor - * @extends {ol.geom.SimpleGeometry} - * @param {Array.<Array.<Array.<ol.Coordinate>>>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.MultiPolygon = function(coordinates, opt_layout) { - - goog.base(this); - - /** - * @type {Array.<Array.<number>>} - * @private - */ - this.endss_ = []; - - /** - * @private - * @type {number} - */ - this.flatInteriorPointsRevision_ = -1; - - /** - * @private - * @type {Array.<number>} - */ - this.flatInteriorPoints_ = null; - - /** - * @private - * @type {number} - */ - this.maxDelta_ = -1; - - /** - * @private - * @type {number} - */ - this.maxDeltaRevision_ = -1; - - /** - * @private - * @type {number} - */ - this.orientedRevision_ = -1; - - /** - * @private - * @type {Array.<number>} - */ - this.orientedFlatCoordinates_ = null; - - this.setCoordinates(coordinates, opt_layout); - -}; -goog.inherits(ol.geom.MultiPolygon, ol.geom.SimpleGeometry); - - -/** - * Append the passed polygon to this multipolygon. - * @param {ol.geom.Polygon} polygon Polygon. - * @api stable - */ -ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) { - goog.asserts.assert(polygon.getLayout() == this.layout, - 'layout of polygon should match layout'); - /** @type {Array.<number>} */ - var ends; - if (!this.flatCoordinates) { - this.flatCoordinates = polygon.getFlatCoordinates().slice(); - ends = polygon.getEnds().slice(); - this.endss_.push(); - } else { - var offset = this.flatCoordinates.length; - goog.array.extend(this.flatCoordinates, polygon.getFlatCoordinates()); - ends = polygon.getEnds().slice(); - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - ends[i] += offset; - } - } - this.endss_.push(ends); - this.changed(); -}; - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.MultiPolygon} Clone. - * @api stable - */ -ol.geom.MultiPolygon.prototype.clone = function() { - var multiPolygon = new ol.geom.MultiPolygon(null); - var newEndss = /** @type {Array.<Array.<number>>} */ - (goog.object.unsafeClone(this.endss_)); - multiPolygon.setFlatCoordinates( - this.layout, this.flatCoordinates.slice(), newEndss); - return multiPolygon; -}; - - -/** - * @inheritDoc - */ -ol.geom.MultiPolygon.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - if (minSquaredDistance < - ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) { - return minSquaredDistance; - } - if (this.maxDeltaRevision_ != this.getRevision()) { - this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getssMaxSquaredDelta( - this.flatCoordinates, 0, this.endss_, this.stride, 0)); - this.maxDeltaRevision_ = this.getRevision(); - } - return ol.geom.flat.closest.getssClosestPoint( - this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, - this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); -}; - - -/** - * @inheritDoc - */ -ol.geom.MultiPolygon.prototype.containsXY = function(x, y) { - return ol.geom.flat.contains.linearRingssContainsXY( - this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, x, y); -}; - - -/** - * Return the area of the multipolygon on projected plane. - * @return {number} Area (on projected plane). - * @api stable - */ -ol.geom.MultiPolygon.prototype.getArea = function() { - return ol.geom.flat.area.linearRingss( - this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride); -}; - - -/** - * Get the coordinate array for this geometry. This array has the structure - * of a GeoJSON coordinate array for multi-polygons. - * - * @param {boolean=} opt_right Orient coordinates according to the right-hand - * rule (counter-clockwise for exterior and clockwise for interior rings). - * If `false`, coordinates will be oriented according to the left-hand rule - * (clockwise for exterior and counter-clockwise for interior rings). - * By default, coordinate orientation will depend on how the geometry was - * constructed. - * @return {Array.<Array.<Array.<ol.Coordinate>>>} Coordinates. - * @api stable - */ -ol.geom.MultiPolygon.prototype.getCoordinates = function(opt_right) { - var flatCoordinates; - if (opt_right !== undefined) { - flatCoordinates = this.getOrientedFlatCoordinates().slice(); - ol.geom.flat.orient.orientLinearRingss( - flatCoordinates, 0, this.endss_, this.stride, opt_right); - } else { - flatCoordinates = this.flatCoordinates; - } - - return ol.geom.flat.inflate.coordinatesss( - flatCoordinates, 0, this.endss_, this.stride); -}; - - -/** - * @return {Array.<Array.<number>>} Endss. - */ -ol.geom.MultiPolygon.prototype.getEndss = function() { - return this.endss_; -}; - - -/** - * @return {Array.<number>} Flat interior points. - */ -ol.geom.MultiPolygon.prototype.getFlatInteriorPoints = function() { - if (this.flatInteriorPointsRevision_ != this.getRevision()) { - var flatCenters = ol.geom.flat.center.linearRingss( - this.flatCoordinates, 0, this.endss_, this.stride); - this.flatInteriorPoints_ = ol.geom.flat.interiorpoint.linearRingss( - this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, - flatCenters); - this.flatInteriorPointsRevision_ = this.getRevision(); - } - return this.flatInteriorPoints_; -}; - - -/** - * Return the interior points as {@link ol.geom.MultiPoint multipoint}. - * @return {ol.geom.MultiPoint} Interior points. - * @api stable - */ -ol.geom.MultiPolygon.prototype.getInteriorPoints = function() { - var interiorPoints = new ol.geom.MultiPoint(null); - interiorPoints.setFlatCoordinates(ol.geom.GeometryLayout.XY, - this.getFlatInteriorPoints().slice()); - return interiorPoints; -}; - - -/** - * @return {Array.<number>} Oriented flat coordinates. - */ -ol.geom.MultiPolygon.prototype.getOrientedFlatCoordinates = function() { - if (this.orientedRevision_ != this.getRevision()) { - var flatCoordinates = this.flatCoordinates; - if (ol.geom.flat.orient.linearRingssAreOriented( - flatCoordinates, 0, this.endss_, this.stride)) { - this.orientedFlatCoordinates_ = flatCoordinates; - } else { - this.orientedFlatCoordinates_ = flatCoordinates.slice(); - this.orientedFlatCoordinates_.length = - ol.geom.flat.orient.orientLinearRingss( - this.orientedFlatCoordinates_, 0, this.endss_, this.stride); - } - this.orientedRevision_ = this.getRevision(); - } - return this.orientedFlatCoordinates_; -}; - - -/** - * @inheritDoc - */ -ol.geom.MultiPolygon.prototype.getSimplifiedGeometryInternal = - function(squaredTolerance) { - var simplifiedFlatCoordinates = []; - var simplifiedEndss = []; - simplifiedFlatCoordinates.length = ol.geom.flat.simplify.quantizess( - this.flatCoordinates, 0, this.endss_, this.stride, - Math.sqrt(squaredTolerance), - simplifiedFlatCoordinates, 0, simplifiedEndss); - var simplifiedMultiPolygon = new ol.geom.MultiPolygon(null); - simplifiedMultiPolygon.setFlatCoordinates( - ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates, simplifiedEndss); - return simplifiedMultiPolygon; -}; - - -/** - * Return the polygon at the specified index. - * @param {number} index Index. - * @return {ol.geom.Polygon} Polygon. - * @api stable - */ -ol.geom.MultiPolygon.prototype.getPolygon = function(index) { - goog.asserts.assert(0 <= index && index < this.endss_.length, - 'index should be in between 0 and the length of this.endss_'); - if (index < 0 || this.endss_.length <= index) { - return null; - } - var offset; - if (index === 0) { - offset = 0; - } else { - var prevEnds = this.endss_[index - 1]; - offset = prevEnds[prevEnds.length - 1]; - } - var ends = this.endss_[index].slice(); - var end = ends[ends.length - 1]; - if (offset !== 0) { - var i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { - ends[i] -= offset; - } - } - var polygon = new ol.geom.Polygon(null); - polygon.setFlatCoordinates( - this.layout, this.flatCoordinates.slice(offset, end), ends); - return polygon; -}; - - -/** - * Return the polygons of this multipolygon. - * @return {Array.<ol.geom.Polygon>} Polygons. - * @api stable - */ -ol.geom.MultiPolygon.prototype.getPolygons = function() { - var layout = this.layout; - var flatCoordinates = this.flatCoordinates; - var endss = this.endss_; - var polygons = []; - var offset = 0; - var i, ii, j, jj; - for (i = 0, ii = endss.length; i < ii; ++i) { - var ends = endss[i].slice(); - var end = ends[ends.length - 1]; - if (offset !== 0) { - for (j = 0, jj = ends.length; j < jj; ++j) { - ends[j] -= offset; - } - } - var polygon = new ol.geom.Polygon(null); - polygon.setFlatCoordinates( - layout, flatCoordinates.slice(offset, end), ends); - polygons.push(polygon); - offset = end; - } - return polygons; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.MultiPolygon.prototype.getType = function() { - return ol.geom.GeometryType.MULTI_POLYGON; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.MultiPolygon.prototype.intersectsExtent = function(extent) { - return ol.geom.flat.intersectsextent.linearRingss( - this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, extent); -}; - - -/** - * Set the coordinates of the multipolygon. - * @param {Array.<Array.<Array.<ol.Coordinate>>>} coordinates Coordinates. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api stable - */ -ol.geom.MultiPolygon.prototype.setCoordinates = - function(coordinates, opt_layout) { - if (!coordinates) { - this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.endss_); - } else { - this.setLayout(opt_layout, coordinates, 3); - if (!this.flatCoordinates) { - this.flatCoordinates = []; - } - var endss = ol.geom.flat.deflate.coordinatesss( - this.flatCoordinates, 0, coordinates, this.stride, this.endss_); - if (endss.length === 0) { - this.flatCoordinates.length = 0; - } else { - var lastEnds = endss[endss.length - 1]; - this.flatCoordinates.length = lastEnds.length === 0 ? - 0 : lastEnds[lastEnds.length - 1]; - } - this.changed(); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {Array.<Array.<number>>} endss Endss. - */ -ol.geom.MultiPolygon.prototype.setFlatCoordinates = - function(layout, flatCoordinates, endss) { - goog.asserts.assert(endss, 'endss must be truthy'); - if (!flatCoordinates || flatCoordinates.length === 0) { - goog.asserts.assert(endss.length === 0, 'the length of endss should be 0'); - } else { - goog.asserts.assert(endss.length > 0, 'endss cannot be an empty array'); - var ends = endss[endss.length - 1]; - goog.asserts.assert(flatCoordinates.length == ends[ends.length - 1], - 'the length of flatCoordinates should be the last value of ends'); - } - this.setFlatCoordinatesInternal(layout, flatCoordinates); - this.endss_ = endss; - this.changed(); -}; - - -/** - * @param {Array.<ol.geom.Polygon>} polygons Polygons. - */ -ol.geom.MultiPolygon.prototype.setPolygons = function(polygons) { - var layout = this.getLayout(); - var flatCoordinates = []; - var endss = []; - var i, ii, ends; - for (i = 0, ii = polygons.length; i < ii; ++i) { - var polygon = polygons[i]; - if (i === 0) { - layout = polygon.getLayout(); - } else { - // FIXME better handle the case of non-matching layouts - goog.asserts.assert(polygon.getLayout() == layout, - 'layout of polygon should be layout'); - } - var offset = flatCoordinates.length; - ends = polygon.getEnds(); - var j, jj; - for (j = 0, jj = ends.length; j < jj; ++j) { - ends[j] += offset; - } - goog.array.extend(flatCoordinates, polygon.getFlatCoordinates()); - endss.push(ends); - } - this.setFlatCoordinates(layout, flatCoordinates, endss); -}; - -goog.provide('ol.format.EsriJSON'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol.Feature'); -goog.require('ol.extent'); -goog.require('ol.format.Feature'); -goog.require('ol.format.JSONFeature'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.LinearRing'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.geom.flat.orient'); -goog.require('ol.proj'); - - - -/** - * @classdesc - * Feature format for reading and writing data in the EsriJSON format. - * - * @constructor - * @extends {ol.format.JSONFeature} - * @param {olx.format.EsriJSONOptions=} opt_options Options. - * @api - */ -ol.format.EsriJSON = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this); - - /** - * Name of the geometry attribute for features. - * @type {string|undefined} - * @private - */ - this.geometryName_ = options.geometryName; - -}; -goog.inherits(ol.format.EsriJSON, ol.format.JSONFeature); - - -/** - * @param {EsriJSONGeometry} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @private - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.EsriJSON.readGeometry_ = function(object, opt_options) { - if (!object) { - return null; - } - var type; - if (goog.isNumber(object.x) && goog.isNumber(object.y)) { - type = ol.geom.GeometryType.POINT; - } else if (object.points) { - type = ol.geom.GeometryType.MULTI_POINT; - } else if (object.paths) { - if (object.paths.length === 1) { - type = ol.geom.GeometryType.LINE_STRING; - } else { - type = ol.geom.GeometryType.MULTI_LINE_STRING; - } - } else if (object.rings) { - var layout = ol.format.EsriJSON.getGeometryLayout_(object); - var rings = ol.format.EsriJSON.convertRings_(object.rings, layout); - object = /** @type {EsriJSONGeometry} */(goog.object.clone(object)); - if (rings.length === 1) { - type = ol.geom.GeometryType.POLYGON; - object.rings = rings[0]; - } else { - type = ol.geom.GeometryType.MULTI_POLYGON; - object.rings = rings; - } - } - goog.asserts.assert(type, 'geometry type should be defined'); - var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type]; - goog.asserts.assert(geometryReader, - 'geometryReader should be defined'); - return /** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions( - geometryReader(object), false, opt_options)); -}; - - -/** - * Determines inner and outer rings. - * Checks if any polygons in this array contain any other polygons in this - * array. It is used for checking for holes. - * Logic inspired by: https://github.com/Esri/terraformer-arcgis-parser - * @param {Array.<!Array.<!Array.<number>>>} rings Rings. - * @param {ol.geom.GeometryLayout} layout Geometry layout. - * @private - * @return {Array.<!Array.<!Array.<number>>>} Transoformed rings. - */ -ol.format.EsriJSON.convertRings_ = function(rings, layout) { - var outerRings = []; - var holes = []; - var i, ii; - for (i = 0, ii = rings.length; i < ii; ++i) { - var flatRing = goog.array.flatten(rings[i]); - // is this ring an outer ring? is it clockwise? - var clockwise = ol.geom.flat.orient.linearRingIsClockwise(flatRing, 0, - flatRing.length, layout.length); - if (clockwise) { - outerRings.push([rings[i]]); - } else { - holes.push(rings[i]); - } - } - while (holes.length) { - var hole = holes.shift(); - var matched = false; - // loop over all outer rings and see if they contain our hole. - for (i = outerRings.length - 1; i >= 0; i--) { - var outerRing = outerRings[i][0]; - if (ol.extent.containsExtent(new ol.geom.LinearRing( - outerRing).getExtent(), - new ol.geom.LinearRing(hole).getExtent())) { - // the hole is contained push it into our polygon - outerRings[i].push(hole); - matched = true; - break; - } - } - if (!matched) { - // no outer rings contain this hole turn it into and outer - // ring (reverse it) - outerRings.push([hole.reverse()]); - } - } - return outerRings; -}; - - -/** - * @param {EsriJSONGeometry} object Object. - * @private - * @return {ol.geom.Geometry} Point. - */ -ol.format.EsriJSON.readPointGeometry_ = function(object) { - goog.asserts.assert(goog.isNumber(object.x), 'object.x should be number'); - goog.asserts.assert(goog.isNumber(object.y), 'object.y should be number'); - var point; - if (object.m !== undefined && object.z !== undefined) { - point = new ol.geom.Point([object.x, object.y, object.z, object.m], - ol.geom.GeometryLayout.XYZM); - } else if (object.z !== undefined) { - point = new ol.geom.Point([object.x, object.y, object.z], - ol.geom.GeometryLayout.XYZ); - } else if (object.m !== undefined) { - point = new ol.geom.Point([object.x, object.y, object.m], - ol.geom.GeometryLayout.XYM); - } else { - point = new ol.geom.Point([object.x, object.y]); - } - return point; -}; - - -/** - * @param {EsriJSONGeometry} object Object. - * @private - * @return {ol.geom.Geometry} LineString. - */ -ol.format.EsriJSON.readLineStringGeometry_ = function(object) { - goog.asserts.assert(goog.isArray(object.paths), - 'object.paths should be an array'); - goog.asserts.assert(object.paths.length === 1, - 'object.paths array length should be 1'); - var layout = ol.format.EsriJSON.getGeometryLayout_(object); - return new ol.geom.LineString(object.paths[0], layout); -}; - - -/** - * @param {EsriJSONGeometry} object Object. - * @private - * @return {ol.geom.Geometry} MultiLineString. - */ -ol.format.EsriJSON.readMultiLineStringGeometry_ = function(object) { - goog.asserts.assert(goog.isArray(object.paths), - 'object.paths should be an array'); - goog.asserts.assert(object.paths.length > 1, - 'object.paths array length should be more than 1'); - var layout = ol.format.EsriJSON.getGeometryLayout_(object); - return new ol.geom.MultiLineString(object.paths, layout); -}; - - -/** - * @param {EsriJSONGeometry} object Object. - * @private - * @return {ol.geom.GeometryLayout} The geometry layout to use. - */ -ol.format.EsriJSON.getGeometryLayout_ = function(object) { - var layout = ol.geom.GeometryLayout.XY; - if (object.hasZ === true && object.hasM === true) { - layout = ol.geom.GeometryLayout.XYZM; - } else if (object.hasZ === true) { - layout = ol.geom.GeometryLayout.XYZ; - } else if (object.hasM === true) { - layout = ol.geom.GeometryLayout.XYM; - } - return layout; -}; - - -/** - * @param {EsriJSONGeometry} object Object. - * @private - * @return {ol.geom.Geometry} MultiPoint. - */ -ol.format.EsriJSON.readMultiPointGeometry_ = function(object) { - goog.asserts.assert(object.points, 'object.points should be defined'); - var layout = ol.format.EsriJSON.getGeometryLayout_(object); - return new ol.geom.MultiPoint(object.points, layout); -}; - - -/** - * @param {EsriJSONGeometry} object Object. - * @private - * @return {ol.geom.Geometry} MultiPolygon. - */ -ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) { - goog.asserts.assert(object.rings); - goog.asserts.assert(object.rings.length > 1, - 'object.rings should have length larger than 1'); - var layout = ol.format.EsriJSON.getGeometryLayout_(object); - return new ol.geom.MultiPolygon( - /** @type {Array.<Array.<Array.<Array.<number>>>>} */(object.rings), - layout); -}; - - -/** - * @param {EsriJSONGeometry} object Object. - * @private - * @return {ol.geom.Geometry} Polygon. - */ -ol.format.EsriJSON.readPolygonGeometry_ = function(object) { - goog.asserts.assert(object.rings); - var layout = ol.format.EsriJSON.getGeometryLayout_(object); - return new ol.geom.Polygon(object.rings, layout); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {EsriJSONGeometry} EsriJSON geometry. - */ -ol.format.EsriJSON.writePointGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.Point, - 'geometry should be an ol.geom.Point'); - var coordinates = geometry.getCoordinates(); - var layout = geometry.getLayout(); - if (layout === ol.geom.GeometryLayout.XYZ) { - return /** @type {EsriJSONPoint} */ ({ - x: coordinates[0], - y: coordinates[1], - z: coordinates[2] - }); - } else if (layout === ol.geom.GeometryLayout.XYM) { - return /** @type {EsriJSONPoint} */ ({ - x: coordinates[0], - y: coordinates[1], - m: coordinates[2] - }); - } else if (layout === ol.geom.GeometryLayout.XYZM) { - return /** @type {EsriJSONPoint} */ ({ - x: coordinates[0], - y: coordinates[1], - z: coordinates[2], - m: coordinates[3] - }); - } else if (layout === ol.geom.GeometryLayout.XY) { - return /** @type {EsriJSONPoint} */ ({ - x: coordinates[0], - y: coordinates[1] - }); - } else { - goog.asserts.fail('Unknown geometry layout'); - } -}; - - -/** - * @param {ol.geom.SimpleGeometry} geometry Geometry. - * @private - * @return {Object} Object with boolean hasZ and hasM keys. - */ -ol.format.EsriJSON.getHasZM_ = function(geometry) { - var layout = geometry.getLayout(); - return { - hasZ: (layout === ol.geom.GeometryLayout.XYZ || - layout === ol.geom.GeometryLayout.XYZM), - hasM: (layout === ol.geom.GeometryLayout.XYM || - layout === ol.geom.GeometryLayout.XYZM) - }; -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {EsriJSONPolyline} EsriJSON geometry. - */ -ol.format.EsriJSON.writeLineStringGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.LineString, - 'geometry should be an ol.geom.LineString'); - var hasZM = ol.format.EsriJSON.getHasZM_(geometry); - return /** @type {EsriJSONPolyline} */ ({ - hasZ: hasZM.hasZ, - hasM: hasZM.hasM, - paths: [geometry.getCoordinates()] - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {EsriJSONPolygon} EsriJSON geometry. - */ -ol.format.EsriJSON.writePolygonGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.Polygon, - 'geometry should be an ol.geom.Polygon'); - // Esri geometries use the left-hand rule - var hasZM = ol.format.EsriJSON.getHasZM_(geometry); - return /** @type {EsriJSONPolygon} */ ({ - hasZ: hasZM.hasZ, - hasM: hasZM.hasM, - rings: geometry.getCoordinates(false) - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {EsriJSONPolyline} EsriJSON geometry. - */ -ol.format.EsriJSON.writeMultiLineStringGeometry_ = - function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString, - 'geometry should be an ol.geom.MultiLineString'); - var hasZM = ol.format.EsriJSON.getHasZM_(geometry); - return /** @type {EsriJSONPolyline} */ ({ - hasZ: hasZM.hasZ, - hasM: hasZM.hasM, - paths: geometry.getCoordinates() - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {EsriJSONMultipoint} EsriJSON geometry. - */ -ol.format.EsriJSON.writeMultiPointGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.MultiPoint, - 'geometry should be an ol.geom.MultiPoint'); - var hasZM = ol.format.EsriJSON.getHasZM_(geometry); - return /** @type {EsriJSONMultipoint} */ ({ - hasZ: hasZM.hasZ, - hasM: hasZM.hasM, - points: geometry.getCoordinates() - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {EsriJSONPolygon} EsriJSON geometry. - */ -ol.format.EsriJSON.writeMultiPolygonGeometry_ = function(geometry, - opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.MultiPolygon, - 'geometry should be an ol.geom.MultiPolygon'); - var hasZM = ol.format.EsriJSON.getHasZM_(geometry); - var coordinates = geometry.getCoordinates(false); - var output = []; - for (var i = 0; i < coordinates.length; i++) { - for (var x = coordinates[i].length - 1; x >= 0; x--) { - output.push(coordinates[i][x]); - } - } - return /** @type {EsriJSONPolygon} */ ({ - hasZ: hasZM.hasZ, - hasM: hasZM.hasM, - rings: output - }); -}; - - -/** - * @const - * @private - * @type {Object.<ol.geom.GeometryType, function(EsriJSONGeometry): ol.geom.Geometry>} - */ -ol.format.EsriJSON.GEOMETRY_READERS_ = {}; -ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.POINT] = - ol.format.EsriJSON.readPointGeometry_; -ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.LINE_STRING] = - ol.format.EsriJSON.readLineStringGeometry_; -ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.POLYGON] = - ol.format.EsriJSON.readPolygonGeometry_; -ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_POINT] = - ol.format.EsriJSON.readMultiPointGeometry_; -ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_LINE_STRING] = - ol.format.EsriJSON.readMultiLineStringGeometry_; -ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_POLYGON] = - ol.format.EsriJSON.readMultiPolygonGeometry_; - - -/** - * @const - * @private - * @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (EsriJSONGeometry)>} - */ -ol.format.EsriJSON.GEOMETRY_WRITERS_ = {}; -ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.POINT] = - ol.format.EsriJSON.writePointGeometry_; -ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.LINE_STRING] = - ol.format.EsriJSON.writeLineStringGeometry_; -ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.POLYGON] = - ol.format.EsriJSON.writePolygonGeometry_; -ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_POINT] = - ol.format.EsriJSON.writeMultiPointGeometry_; -ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_LINE_STRING] = - ol.format.EsriJSON.writeMultiLineStringGeometry_; -ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_POLYGON] = - ol.format.EsriJSON.writeMultiPolygonGeometry_; - - -/** - * Read a feature from a EsriJSON Feature source. Only works for Feature, - * use `readFeatures` to read FeatureCollection source. - * - * @function - * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - * @api - */ -ol.format.EsriJSON.prototype.readFeature; - - -/** - * Read all features from a EsriJSON source. Works with both Feature and - * FeatureCollection sources. - * - * @function - * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api - */ -ol.format.EsriJSON.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.EsriJSON.prototype.readFeatureFromObject = function( - object, opt_options) { - var esriJSONFeature = /** @type {EsriJSONFeature} */ (object); - goog.asserts.assert(esriJSONFeature.geometry || - esriJSONFeature.attributes, - 'geometry or attributes should be defined'); - var geometry = ol.format.EsriJSON.readGeometry_(esriJSONFeature.geometry, - opt_options); - var feature = new ol.Feature(); - if (this.geometryName_) { - feature.setGeometryName(this.geometryName_); - } - feature.setGeometry(geometry); - if (opt_options && opt_options.idField && - esriJSONFeature.attributes[opt_options.idField]) { - goog.asserts.assert( - goog.isNumber(esriJSONFeature.attributes[opt_options.idField]), - 'objectIdFieldName value should be a number'); - feature.setId(/** @type {number} */( - esriJSONFeature.attributes[opt_options.idField])); - } - if (esriJSONFeature.attributes) { - feature.setProperties(esriJSONFeature.attributes); - } - return feature; -}; - - -/** - * @inheritDoc - */ -ol.format.EsriJSON.prototype.readFeaturesFromObject = function( - object, opt_options) { - var esriJSONObject = /** @type {EsriJSONObject} */ (object); - var options = opt_options ? opt_options : {}; - if (esriJSONObject.features) { - var esriJSONFeatureCollection = /** @type {EsriJSONFeatureCollection} */ - (object); - /** @type {Array.<ol.Feature>} */ - var features = []; - var esriJSONFeatures = esriJSONFeatureCollection.features; - var i, ii; - options.idField = object.objectIdFieldName; - for (i = 0, ii = esriJSONFeatures.length; i < ii; ++i) { - features.push(this.readFeatureFromObject(esriJSONFeatures[i], - options)); - } - return features; - } else { - return [this.readFeatureFromObject(object, options)]; - } -}; - - -/** - * Read a geometry from a EsriJSON source. - * - * @function - * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.geom.Geometry} Geometry. - * @api - */ -ol.format.EsriJSON.prototype.readGeometry; - - -/** - * @inheritDoc - */ -ol.format.EsriJSON.prototype.readGeometryFromObject = function( - object, opt_options) { - return ol.format.EsriJSON.readGeometry_( - /** @type {EsriJSONGeometry} */ (object), opt_options); -}; - - -/** - * Read the projection from a EsriJSON source. - * - * @function - * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @return {ol.proj.Projection} Projection. - * @api - */ -ol.format.EsriJSON.prototype.readProjection; - - -/** - * @inheritDoc - */ -ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) { - var esriJSONObject = /** @type {EsriJSONObject} */ (object); - if (esriJSONObject.spatialReference && esriJSONObject.spatialReference.wkid) { - var crs = esriJSONObject.spatialReference.wkid; - return ol.proj.get('EPSG:' + crs); - } else { - return null; - } -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {EsriJSONGeometry} EsriJSON geometry. - */ -ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) { - var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()]; - goog.asserts.assert(geometryWriter, 'geometryWriter should be defined'); - return geometryWriter(/** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions(geometry, true, opt_options)), - opt_options); -}; - - -/** - * Encode a geometry as a EsriJSON string. - * - * @function - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} EsriJSON. - * @api - */ -ol.format.EsriJSON.prototype.writeGeometry; - - -/** - * Encode a geometry as a EsriJSON object. - * - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {EsriJSONGeometry} Object. - * @api - */ -ol.format.EsriJSON.prototype.writeGeometryObject = function(geometry, - opt_options) { - return ol.format.EsriJSON.writeGeometry_(geometry, - this.adaptOptions(opt_options)); -}; - - -/** - * Encode a feature as a EsriJSON Feature string. - * - * @function - * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} EsriJSON. - * @api - */ -ol.format.EsriJSON.prototype.writeFeature; - - -/** - * Encode a feature as a esriJSON Feature object. - * - * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {Object} Object. - * @api - */ -ol.format.EsriJSON.prototype.writeFeatureObject = function( - feature, opt_options) { - opt_options = this.adaptOptions(opt_options); - var object = {}; - var geometry = feature.getGeometry(); - if (geometry) { - object['geometry'] = - ol.format.EsriJSON.writeGeometry_(geometry, opt_options); - } - var properties = feature.getProperties(); - delete properties[feature.getGeometryName()]; - if (!goog.object.isEmpty(properties)) { - object['attributes'] = properties; - } else { - object['attributes'] = {}; - } - if (opt_options && opt_options.featureProjection) { - object['spatialReference'] = /** @type {EsriJSONCRS} */({ - wkid: ol.proj.get( - opt_options.featureProjection).getCode().split(':').pop() - }); - } - return object; -}; - - -/** - * Encode an array of features as EsriJSON. - * - * @function - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} EsriJSON. - * @api - */ -ol.format.EsriJSON.prototype.writeFeatures; - - -/** - * Encode an array of features as a EsriJSON object. - * - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {Object} EsriJSON Object. - * @api - */ -ol.format.EsriJSON.prototype.writeFeaturesObject = - function(features, opt_options) { - opt_options = this.adaptOptions(opt_options); - var objects = []; - var i, ii; - for (i = 0, ii = features.length; i < ii; ++i) { - objects.push(this.writeFeatureObject(features[i], opt_options)); - } - return /** @type {EsriJSONFeatureCollection} */ ({ - 'features': objects - }); -}; - -goog.provide('ol.geom.GeometryCollection'); - -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol.extent'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryType'); - - - -/** - * @classdesc - * An array of {@link ol.geom.Geometry} objects. - * - * @constructor - * @extends {ol.geom.Geometry} - * @param {Array.<ol.geom.Geometry>=} opt_geometries Geometries. - * @api stable - */ -ol.geom.GeometryCollection = function(opt_geometries) { - - goog.base(this); - - /** - * @private - * @type {Array.<ol.geom.Geometry>} - */ - this.geometries_ = opt_geometries ? opt_geometries : null; - - this.listenGeometriesChange_(); -}; -goog.inherits(ol.geom.GeometryCollection, ol.geom.Geometry); - - -/** - * @param {Array.<ol.geom.Geometry>} geometries Geometries. - * @private - * @return {Array.<ol.geom.Geometry>} Cloned geometries. - */ -ol.geom.GeometryCollection.cloneGeometries_ = function(geometries) { - var clonedGeometries = []; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - clonedGeometries.push(geometries[i].clone()); - } - return clonedGeometries; -}; - - -/** - * @private - */ -ol.geom.GeometryCollection.prototype.unlistenGeometriesChange_ = function() { - var i, ii; - if (!this.geometries_) { - return; - } - for (i = 0, ii = this.geometries_.length; i < ii; ++i) { - goog.events.unlisten( - this.geometries_[i], goog.events.EventType.CHANGE, - this.changed, false, this); - } -}; - - -/** - * @private - */ -ol.geom.GeometryCollection.prototype.listenGeometriesChange_ = function() { - var i, ii; - if (!this.geometries_) { - return; - } - for (i = 0, ii = this.geometries_.length; i < ii; ++i) { - goog.events.listen( - this.geometries_[i], goog.events.EventType.CHANGE, - this.changed, false, this); - } -}; - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.GeometryCollection} Clone. - * @api stable - */ -ol.geom.GeometryCollection.prototype.clone = function() { - var geometryCollection = new ol.geom.GeometryCollection(null); - geometryCollection.setGeometries(this.geometries_); - return geometryCollection; -}; - - -/** - * @inheritDoc - */ -ol.geom.GeometryCollection.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - if (minSquaredDistance < - ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) { - return minSquaredDistance; - } - var geometries = this.geometries_; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - minSquaredDistance = geometries[i].closestPointXY( - x, y, closestPoint, minSquaredDistance); - } - return minSquaredDistance; -}; - - -/** - * @inheritDoc - */ -ol.geom.GeometryCollection.prototype.containsXY = function(x, y) { - var geometries = this.geometries_; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - if (geometries[i].containsXY(x, y)) { - return true; - } - } - return false; -}; - - -/** - * @inheritDoc - */ -ol.geom.GeometryCollection.prototype.computeExtent = function(extent) { - ol.extent.createOrUpdateEmpty(extent); - var geometries = this.geometries_; - for (var i = 0, ii = geometries.length; i < ii; ++i) { - ol.extent.extend(extent, geometries[i].getExtent()); - } - return extent; -}; - - -/** - * Return the geometries that make up this geometry collection. - * @return {Array.<ol.geom.Geometry>} Geometries. - * @api stable - */ -ol.geom.GeometryCollection.prototype.getGeometries = function() { - return ol.geom.GeometryCollection.cloneGeometries_(this.geometries_); -}; - - -/** - * @return {Array.<ol.geom.Geometry>} Geometries. - */ -ol.geom.GeometryCollection.prototype.getGeometriesArray = function() { - return this.geometries_; -}; - - -/** - * @inheritDoc - */ -ol.geom.GeometryCollection.prototype.getSimplifiedGeometry = - function(squaredTolerance) { - if (this.simplifiedGeometryRevision != this.getRevision()) { - goog.object.clear(this.simplifiedGeometryCache); - this.simplifiedGeometryMaxMinSquaredTolerance = 0; - this.simplifiedGeometryRevision = this.getRevision(); - } - if (squaredTolerance < 0 || - (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && - squaredTolerance < this.simplifiedGeometryMaxMinSquaredTolerance)) { - return this; - } - var key = squaredTolerance.toString(); - if (this.simplifiedGeometryCache.hasOwnProperty(key)) { - return this.simplifiedGeometryCache[key]; - } else { - var simplifiedGeometries = []; - var geometries = this.geometries_; - var simplified = false; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - var geometry = geometries[i]; - var simplifiedGeometry = geometry.getSimplifiedGeometry(squaredTolerance); - simplifiedGeometries.push(simplifiedGeometry); - if (simplifiedGeometry !== geometry) { - simplified = true; - } - } - if (simplified) { - var simplifiedGeometryCollection = new ol.geom.GeometryCollection(null); - simplifiedGeometryCollection.setGeometriesArray(simplifiedGeometries); - this.simplifiedGeometryCache[key] = simplifiedGeometryCollection; - return simplifiedGeometryCollection; - } else { - this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance; - return this; - } - } -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.GeometryCollection.prototype.getType = function() { - return ol.geom.GeometryType.GEOMETRY_COLLECTION; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.GeometryCollection.prototype.intersectsExtent = function(extent) { - var geometries = this.geometries_; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - if (geometries[i].intersectsExtent(extent)) { - return true; - } - } - return false; -}; - - -/** - * @return {boolean} Is empty. - */ -ol.geom.GeometryCollection.prototype.isEmpty = function() { - return this.geometries_.length === 0; -}; - - -/** - * Set the geometries that make up this geometry collection. - * @param {Array.<ol.geom.Geometry>} geometries Geometries. - * @api stable - */ -ol.geom.GeometryCollection.prototype.setGeometries = function(geometries) { - this.setGeometriesArray( - ol.geom.GeometryCollection.cloneGeometries_(geometries)); -}; - - -/** - * @param {Array.<ol.geom.Geometry>} geometries Geometries. - */ -ol.geom.GeometryCollection.prototype.setGeometriesArray = function(geometries) { - this.unlistenGeometriesChange_(); - this.geometries_ = geometries; - this.listenGeometriesChange_(); - this.changed(); -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.GeometryCollection.prototype.applyTransform = function(transformFn) { - var geometries = this.geometries_; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - geometries[i].applyTransform(transformFn); - } - this.changed(); -}; - - -/** - * Translate the geometry. - * @param {number} deltaX Delta X. - * @param {number} deltaY Delta Y. - * @api - */ -ol.geom.GeometryCollection.prototype.translate = function(deltaX, deltaY) { - var geometries = this.geometries_; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - geometries[i].translate(deltaX, deltaY); - } - this.changed(); -}; - - -/** - * @inheritDoc - */ -ol.geom.GeometryCollection.prototype.disposeInternal = function() { - this.unlistenGeometriesChange_(); - goog.base(this, 'disposeInternal'); -}; - -// TODO: serialize dataProjection as crs member when writing -// see https://github.com/openlayers/ol3/issues/2078 - -goog.provide('ol.format.GeoJSON'); - -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol.Feature'); -goog.require('ol.format.Feature'); -goog.require('ol.format.JSONFeature'); -goog.require('ol.geom.GeometryCollection'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.proj'); - - - -/** - * @classdesc - * Feature format for reading and writing data in the GeoJSON format. - * - * @constructor - * @extends {ol.format.JSONFeature} - * @param {olx.format.GeoJSONOptions=} opt_options Options. - * @api stable - */ -ol.format.GeoJSON = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this); - - /** - * @inheritDoc - */ - this.defaultDataProjection = ol.proj.get( - options.defaultDataProjection ? - options.defaultDataProjection : 'EPSG:4326'); - - - /** - * Name of the geometry attribute for features. - * @type {string|undefined} - * @private - */ - this.geometryName_ = options.geometryName; - -}; -goog.inherits(ol.format.GeoJSON, ol.format.JSONFeature); - - -/** - * @const - * @type {Array.<string>} - * @private - */ -ol.format.GeoJSON.EXTENSIONS_ = ['.geojson']; - - -/** - * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @private - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.GeoJSON.readGeometry_ = function(object, opt_options) { - if (!object) { - return null; - } - var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type]; - goog.asserts.assert(geometryReader, 'geometryReader should be defined'); - return /** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions( - geometryReader(object), false, opt_options)); -}; - - -/** - * @param {GeoJSONGeometryCollection} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @private - * @return {ol.geom.GeometryCollection} Geometry collection. - */ -ol.format.GeoJSON.readGeometryCollectionGeometry_ = function( - object, opt_options) { - goog.asserts.assert(object.type == 'GeometryCollection', - 'object.type should be GeometryCollection'); - var geometries = object.geometries.map( - /** - * @param {GeoJSONGeometry} geometry Geometry. - * @return {ol.geom.Geometry} geometry Geometry. - */ - function(geometry) { - return ol.format.GeoJSON.readGeometry_(geometry, opt_options); - }); - return new ol.geom.GeometryCollection(geometries); -}; - - -/** - * @param {GeoJSONGeometry} object Object. - * @private - * @return {ol.geom.Point} Point. - */ -ol.format.GeoJSON.readPointGeometry_ = function(object) { - goog.asserts.assert(object.type == 'Point', - 'object.type should be Point'); - return new ol.geom.Point(object.coordinates); -}; - - -/** - * @param {GeoJSONGeometry} object Object. - * @private - * @return {ol.geom.LineString} LineString. - */ -ol.format.GeoJSON.readLineStringGeometry_ = function(object) { - goog.asserts.assert(object.type == 'LineString', - 'object.type should be LineString'); - return new ol.geom.LineString(object.coordinates); -}; - - -/** - * @param {GeoJSONGeometry} object Object. - * @private - * @return {ol.geom.MultiLineString} MultiLineString. - */ -ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) { - goog.asserts.assert(object.type == 'MultiLineString', - 'object.type should be MultiLineString'); - return new ol.geom.MultiLineString(object.coordinates); -}; - - -/** - * @param {GeoJSONGeometry} object Object. - * @private - * @return {ol.geom.MultiPoint} MultiPoint. - */ -ol.format.GeoJSON.readMultiPointGeometry_ = function(object) { - goog.asserts.assert(object.type == 'MultiPoint', - 'object.type should be MultiPoint'); - return new ol.geom.MultiPoint(object.coordinates); -}; - - -/** - * @param {GeoJSONGeometry} object Object. - * @private - * @return {ol.geom.MultiPolygon} MultiPolygon. - */ -ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) { - goog.asserts.assert(object.type == 'MultiPolygon', - 'object.type should be MultiPolygon'); - return new ol.geom.MultiPolygon(object.coordinates); -}; - - -/** - * @param {GeoJSONGeometry} object Object. - * @private - * @return {ol.geom.Polygon} Polygon. - */ -ol.format.GeoJSON.readPolygonGeometry_ = function(object) { - goog.asserts.assert(object.type == 'Polygon', - 'object.type should be Polygon'); - return new ol.geom.Polygon(object.coordinates); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry. - */ -ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) { - var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()]; - goog.asserts.assert(geometryWriter, 'geometryWriter should be defined'); - return geometryWriter(/** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions(geometry, true, opt_options)), - opt_options); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @private - * @return {GeoJSONGeometryCollection} Empty GeoJSON geometry collection. - */ -ol.format.GeoJSON.writeEmptyGeometryCollectionGeometry_ = function(geometry) { - return /** @type {GeoJSONGeometryCollection} */ ({ - type: 'GeometryCollection', - geometries: [] - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {GeoJSONGeometryCollection} GeoJSON geometry collection. - */ -ol.format.GeoJSON.writeGeometryCollectionGeometry_ = function( - geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.GeometryCollection, - 'geometry should be an ol.geom.GeometryCollection'); - var geometries = geometry.getGeometriesArray().map(function(geometry) { - return ol.format.GeoJSON.writeGeometry_(geometry, opt_options); - }); - return /** @type {GeoJSONGeometryCollection} */ ({ - type: 'GeometryCollection', - geometries: geometries - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {GeoJSONGeometry} GeoJSON geometry. - */ -ol.format.GeoJSON.writeLineStringGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.LineString, - 'geometry should be an ol.geom.LineString'); - return /** @type {GeoJSONGeometry} */ ({ - type: 'LineString', - coordinates: geometry.getCoordinates() - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {GeoJSONGeometry} GeoJSON geometry. - */ -ol.format.GeoJSON.writeMultiLineStringGeometry_ = - function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString, - 'geometry should be an ol.geom.MultiLineString'); - return /** @type {GeoJSONGeometry} */ ({ - type: 'MultiLineString', - coordinates: geometry.getCoordinates() - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {GeoJSONGeometry} GeoJSON geometry. - */ -ol.format.GeoJSON.writeMultiPointGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.MultiPoint, - 'geometry should be an ol.geom.MultiPoint'); - return /** @type {GeoJSONGeometry} */ ({ - type: 'MultiPoint', - coordinates: geometry.getCoordinates() - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {GeoJSONGeometry} GeoJSON geometry. - */ -ol.format.GeoJSON.writeMultiPolygonGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.MultiPolygon, - 'geometry should be an ol.geom.MultiPolygon'); - var right; - if (opt_options) { - right = opt_options.rightHanded; - } - return /** @type {GeoJSONGeometry} */ ({ - type: 'MultiPolygon', - coordinates: geometry.getCoordinates(right) - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {GeoJSONGeometry} GeoJSON geometry. - */ -ol.format.GeoJSON.writePointGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.Point, - 'geometry should be an ol.geom.Point'); - return /** @type {GeoJSONGeometry} */ ({ - type: 'Point', - coordinates: geometry.getCoordinates() - }); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @private - * @return {GeoJSONGeometry} GeoJSON geometry. - */ -ol.format.GeoJSON.writePolygonGeometry_ = function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.Polygon, - 'geometry should be an ol.geom.Polygon'); - var right; - if (opt_options) { - right = opt_options.rightHanded; - } - return /** @type {GeoJSONGeometry} */ ({ - type: 'Polygon', - coordinates: geometry.getCoordinates(right) - }); -}; - - -/** - * @const - * @private - * @type {Object.<string, function(GeoJSONObject): ol.geom.Geometry>} - */ -ol.format.GeoJSON.GEOMETRY_READERS_ = { - 'Point': ol.format.GeoJSON.readPointGeometry_, - 'LineString': ol.format.GeoJSON.readLineStringGeometry_, - 'Polygon': ol.format.GeoJSON.readPolygonGeometry_, - 'MultiPoint': ol.format.GeoJSON.readMultiPointGeometry_, - 'MultiLineString': ol.format.GeoJSON.readMultiLineStringGeometry_, - 'MultiPolygon': ol.format.GeoJSON.readMultiPolygonGeometry_, - 'GeometryCollection': ol.format.GeoJSON.readGeometryCollectionGeometry_ -}; - - -/** - * @const - * @private - * @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>} - */ -ol.format.GeoJSON.GEOMETRY_WRITERS_ = { - 'Point': ol.format.GeoJSON.writePointGeometry_, - 'LineString': ol.format.GeoJSON.writeLineStringGeometry_, - 'Polygon': ol.format.GeoJSON.writePolygonGeometry_, - 'MultiPoint': ol.format.GeoJSON.writeMultiPointGeometry_, - 'MultiLineString': ol.format.GeoJSON.writeMultiLineStringGeometry_, - 'MultiPolygon': ol.format.GeoJSON.writeMultiPolygonGeometry_, - 'GeometryCollection': ol.format.GeoJSON.writeGeometryCollectionGeometry_, - 'Circle': ol.format.GeoJSON.writeEmptyGeometryCollectionGeometry_ -}; - - -/** - * @inheritDoc - */ -ol.format.GeoJSON.prototype.getExtensions = function() { - return ol.format.GeoJSON.EXTENSIONS_; -}; - - -/** - * Read a feature from a GeoJSON Feature source. Only works for Feature, - * use `readFeatures` to read FeatureCollection source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - * @api stable - */ -ol.format.GeoJSON.prototype.readFeature; - - -/** - * Read all features from a GeoJSON source. Works with both Feature and - * FeatureCollection sources. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.GeoJSON.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.GeoJSON.prototype.readFeatureFromObject = function( - object, opt_options) { - var geoJSONFeature = /** @type {GeoJSONFeature} */ (object); - goog.asserts.assert(geoJSONFeature.type == 'Feature', - 'geoJSONFeature.type should be Feature'); - var geometry = ol.format.GeoJSON.readGeometry_(geoJSONFeature.geometry, - opt_options); - var feature = new ol.Feature(); - if (this.geometryName_) { - feature.setGeometryName(this.geometryName_); - } - feature.setGeometry(geometry); - if (geoJSONFeature.id !== undefined) { - feature.setId(geoJSONFeature.id); - } - if (geoJSONFeature.properties) { - feature.setProperties(geoJSONFeature.properties); - } - return feature; -}; - - -/** - * @inheritDoc - */ -ol.format.GeoJSON.prototype.readFeaturesFromObject = function( - object, opt_options) { - var geoJSONObject = /** @type {GeoJSONObject} */ (object); - if (geoJSONObject.type == 'Feature') { - return [this.readFeatureFromObject(object, opt_options)]; - } else if (geoJSONObject.type == 'FeatureCollection') { - var geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ - (object); - /** @type {Array.<ol.Feature>} */ - var features = []; - var geoJSONFeatures = geoJSONFeatureCollection.features; - var i, ii; - for (i = 0, ii = geoJSONFeatures.length; i < ii; ++i) { - features.push(this.readFeatureFromObject(geoJSONFeatures[i], - opt_options)); - } - return features; - } else { - goog.asserts.fail('Unknown geoJSONObject.type: ' + geoJSONObject.type); - return []; - } -}; - - -/** - * Read a geometry from a GeoJSON source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.geom.Geometry} Geometry. - * @api stable - */ -ol.format.GeoJSON.prototype.readGeometry; - - -/** - * @inheritDoc - */ -ol.format.GeoJSON.prototype.readGeometryFromObject = function( - object, opt_options) { - return ol.format.GeoJSON.readGeometry_( - /** @type {GeoJSONGeometry} */ (object), opt_options); -}; - - -/** - * Read the projection from a GeoJSON source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {ol.proj.Projection} Projection. - * @api stable - */ -ol.format.GeoJSON.prototype.readProjection; - - -/** - * @inheritDoc - */ -ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) { - var geoJSONObject = /** @type {GeoJSONObject} */ (object); - var crs = geoJSONObject.crs; - if (crs) { - if (crs.type == 'name') { - return ol.proj.get(crs.properties.name); - } else if (crs.type == 'EPSG') { - // 'EPSG' is not part of the GeoJSON specification, but is generated by - // GeoServer. - // TODO: remove this when http://jira.codehaus.org/browse/GEOS-5996 - // is fixed and widely deployed. - return ol.proj.get('EPSG:' + crs.properties.code); - } else { - goog.asserts.fail('Unknown crs.type: ' + crs.type); - return null; - } - } else { - return this.defaultDataProjection; - } -}; - - -/** - * Encode a feature as a GeoJSON Feature string. - * - * @function - * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} GeoJSON. - * @api stable - */ -ol.format.GeoJSON.prototype.writeFeature; - - -/** - * Encode a feature as a GeoJSON Feature object. - * - * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {Object} Object. - * @api stable - */ -ol.format.GeoJSON.prototype.writeFeatureObject = function( - feature, opt_options) { - opt_options = this.adaptOptions(opt_options); - var object = { - 'type': 'Feature' - }; - var id = feature.getId(); - if (id !== undefined) { - object['id'] = id; - } - var geometry = feature.getGeometry(); - if (geometry) { - object['geometry'] = - ol.format.GeoJSON.writeGeometry_(geometry, opt_options); - } else { - object['geometry'] = null; - } - var properties = feature.getProperties(); - delete properties[feature.getGeometryName()]; - if (!goog.object.isEmpty(properties)) { - object['properties'] = properties; - } else { - object['properties'] = null; - } - return object; -}; - - -/** - * Encode an array of features as GeoJSON. - * - * @function - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} GeoJSON. - * @api stable - */ -ol.format.GeoJSON.prototype.writeFeatures; - - -/** - * Encode an array of features as a GeoJSON object. - * - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {Object} GeoJSON Object. - * @api stable - */ -ol.format.GeoJSON.prototype.writeFeaturesObject = - function(features, opt_options) { - opt_options = this.adaptOptions(opt_options); - var objects = []; - var i, ii; - for (i = 0, ii = features.length; i < ii; ++i) { - objects.push(this.writeFeatureObject(features[i], opt_options)); - } - return /** @type {GeoJSONFeatureCollection} */ ({ - type: 'FeatureCollection', - features: objects - }); -}; - - -/** - * Encode a geometry as a GeoJSON string. - * - * @function - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} GeoJSON. - * @api stable - */ -ol.format.GeoJSON.prototype.writeGeometry; - - -/** - * Encode a geometry as a GeoJSON object. - * - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object. - * @api stable - */ -ol.format.GeoJSON.prototype.writeGeometryObject = function(geometry, - opt_options) { - return ol.format.GeoJSON.writeGeometry_(geometry, - this.adaptOptions(opt_options)); -}; - -goog.provide('ol.format.XMLFeature'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.dom.xml'); -goog.require('ol.format.Feature'); -goog.require('ol.format.FormatType'); -goog.require('ol.proj'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Base class for XML feature formats. - * - * @constructor - * @extends {ol.format.Feature} - */ -ol.format.XMLFeature = function() { - goog.base(this); -}; -goog.inherits(ol.format.XMLFeature, ol.format.Feature); - - -/** - * @inheritDoc - */ -ol.format.XMLFeature.prototype.getType = function() { - return ol.format.FormatType.XML; -}; - - -/** - * @inheritDoc - */ -ol.format.XMLFeature.prototype.readFeature = function(source, opt_options) { - if (ol.xml.isDocument(source)) { - return this.readFeatureFromDocument( - /** @type {Document} */ (source), opt_options); - } else if (ol.xml.isNode(source)) { - return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - return this.readFeatureFromDocument(doc, opt_options); - } else { - goog.asserts.fail('Unknown source type'); - return null; - } -}; - - -/** - * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. - * @return {ol.Feature} Feature. - */ -ol.format.XMLFeature.prototype.readFeatureFromDocument = function( - doc, opt_options) { - var features = this.readFeaturesFromDocument(doc, opt_options); - if (features.length > 0) { - return features[0]; - } else { - return null; - } -}; - - -/** - * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. - * @return {ol.Feature} Feature. - */ -ol.format.XMLFeature.prototype.readFeatureFromNode = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.XMLFeature.prototype.readFeatures = function(source, opt_options) { - if (ol.xml.isDocument(source)) { - return this.readFeaturesFromDocument( - /** @type {Document} */ (source), opt_options); - } else if (ol.xml.isNode(source)) { - return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - return this.readFeaturesFromDocument(doc, opt_options); - } else { - goog.asserts.fail('Unknown source type'); - return []; - } -}; - - -/** - * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. - * @protected - * @return {Array.<ol.Feature>} Features. - */ -ol.format.XMLFeature.prototype.readFeaturesFromDocument = function( - doc, opt_options) { - /** @type {Array.<ol.Feature>} */ - var features = []; - var n; - for (n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - goog.array.extend(features, this.readFeaturesFromNode(n, opt_options)); - } - } - return features; -}; - - -/** - * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. - * @protected - * @return {Array.<ol.Feature>} Features. - */ -ol.format.XMLFeature.prototype.readFeaturesFromNode = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) { - if (ol.xml.isDocument(source)) { - return this.readGeometryFromDocument( - /** @type {Document} */ (source), opt_options); - } else if (ol.xml.isNode(source)) { - return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - return this.readGeometryFromDocument(doc, opt_options); - } else { - goog.asserts.fail('Unknown source type'); - return null; - } -}; - - -/** - * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. - * @protected - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.XMLFeature.prototype.readGeometryFromDocument = goog.abstractMethod; - - -/** - * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. - * @protected - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.XMLFeature.prototype.readGeometryFromNode = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.XMLFeature.prototype.readProjection = function(source) { - if (ol.xml.isDocument(source)) { - return this.readProjectionFromDocument(/** @type {Document} */ (source)); - } else if (ol.xml.isNode(source)) { - return this.readProjectionFromNode(/** @type {Node} */ (source)); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - return this.readProjectionFromDocument(doc); - } else { - goog.asserts.fail('Unknown source type'); - return null; - } -}; - - -/** - * @param {Document} doc Document. - * @protected - * @return {ol.proj.Projection} Projection. - */ -ol.format.XMLFeature.prototype.readProjectionFromDocument = function(doc) { - return this.defaultDataProjection; -}; - - -/** - * @param {Node} node Node. - * @protected - * @return {ol.proj.Projection} Projection. - */ -ol.format.XMLFeature.prototype.readProjectionFromNode = function(node) { - return this.defaultDataProjection; -}; - - -/** - * @inheritDoc - */ -ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) { - var node = this.writeFeatureNode(feature, opt_options); - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - return goog.dom.xml.serialize(/** @type {Element} */(node)); -}; - - -/** - * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Options. - * @protected - * @return {Node} Node. - */ -ol.format.XMLFeature.prototype.writeFeatureNode = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) { - var node = this.writeFeaturesNode(features, opt_options); - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - return goog.dom.xml.serialize(/** @type {Element} */(node)); -}; - - -/** - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {Node} Node. - */ -ol.format.XMLFeature.prototype.writeFeaturesNode = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) { - var node = this.writeGeometryNode(geometry, opt_options); - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - return goog.dom.xml.serialize(/** @type {Element} */(node)); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {Node} Node. - */ -ol.format.XMLFeature.prototype.writeGeometryNode = goog.abstractMethod; - -// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part -// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect -// envelopes/extents, only geometries! -goog.provide('ol.format.GMLBase'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.object'); -goog.require('goog.string'); -goog.require('ol.Feature'); -goog.require('ol.format.Feature'); -goog.require('ol.format.XMLFeature'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.LinearRing'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.proj'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Feature base format for reading and writing data in the GML format. - * This class cannot be instantiated, it contains only base content that - * is shared with versioned format classes ol.format.GML2 and - * ol.format.GML3. - * - * @constructor - * @param {olx.format.GMLOptions=} opt_options - * Optional configuration object. - * @extends {ol.format.XMLFeature} - */ -ol.format.GMLBase = function(opt_options) { - var options = /** @type {olx.format.GMLOptions} */ - (opt_options ? opt_options : {}); - - /** - * @protected - * @type {Array.<string>|string|undefined} - */ - this.featureType = options.featureType; - - /** - * @protected - * @type {Object.<string, string>|string|undefined} - */ - this.featureNS = options.featureNS; - - /** - * @protected - * @type {string} - */ - this.srsName = options.srsName; - - /** - * @protected - * @type {string} - */ - this.schemaLocation = ''; - - /** - * @type {Object.<string, Object.<string, Object>>} - */ - this.FEATURE_COLLECTION_PARSERS = {}; - this.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS] = { - 'featureMember': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readFeaturesInternal), - 'featureMembers': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readFeaturesInternal) - }; - - goog.base(this); -}; -goog.inherits(ol.format.GMLBase, ol.format.XMLFeature); - - -/** - * @const - * @type {string} - */ -ol.format.GMLBase.GMLNS = 'http://www.opengis.net/gml'; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Array.<ol.Feature>} Features. - */ -ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - var localName = ol.xml.getLocalName(node); - var features; - if (localName == 'FeatureCollection') { - if (node.namespaceURI === 'http://www.opengis.net/wfs') { - features = ol.xml.pushParseAndPop([], - this.FEATURE_COLLECTION_PARSERS, node, - objectStack, this); - } else { - features = ol.xml.pushParseAndPop(null, - this.FEATURE_COLLECTION_PARSERS, node, - objectStack, this); - } - } else if (localName == 'featureMembers' || localName == 'featureMember') { - var context = objectStack[0]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var featureType = context['featureType']; - var featureNS = context['featureNS']; - var i, ii, prefix = 'p', defaultPrefix = 'p0'; - if (!featureType && node.childNodes) { - featureType = [], featureNS = {}; - for (i = 0, ii = node.childNodes.length; i < ii; ++i) { - var child = node.childNodes[i]; - if (child.nodeType === 1) { - var ft = child.nodeName.split(':').pop(); - if (featureType.indexOf(ft) === -1) { - var key; - if (!goog.object.contains(featureNS, child.namespaceURI)) { - key = prefix + goog.object.getCount(featureNS); - featureNS[key] = child.namespaceURI; - } else { - key = goog.object.findKey(featureNS, function(value) { - return value === child.namespaceURI; - }); - } - featureType.push(key + ':' + ft); - } - } - } - context['featureType'] = featureType; - context['featureNS'] = featureNS; - } - if (goog.isString(featureNS)) { - var ns = featureNS; - featureNS = {}; - featureNS[defaultPrefix] = ns; - } - var parsersNS = {}; - var featureTypes = goog.isArray(featureType) ? featureType : [featureType]; - for (var p in featureNS) { - var parsers = {}; - for (i = 0, ii = featureTypes.length; i < ii; ++i) { - var featurePrefix = featureTypes[i].indexOf(':') === -1 ? - defaultPrefix : featureTypes[i].split(':')[0]; - if (featurePrefix === p) { - parsers[featureTypes[i].split(':').pop()] = - (localName == 'featureMembers') ? - ol.xml.makeArrayPusher(this.readFeatureElement, this) : - ol.xml.makeReplacer(this.readFeatureElement, this); - } - } - parsersNS[featureNS[p]] = parsers; - } - features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack); - } - if (!features) { - features = []; - } - return features; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.geom.Geometry|undefined} Geometry. - */ -ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) { - var context = objectStack[0]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - context['srsName'] = node.firstElementChild.getAttribute('srsName'); - var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null), - this.GEOMETRY_PARSERS_, node, objectStack, this); - if (geometry) { - return /** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions(geometry, false, context)); - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.Feature} Feature. - */ -ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) { - var n; - var fid = node.getAttribute('fid') || - ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id'); - var values = {}, geometryName; - for (n = node.firstElementChild; n; n = n.nextElementSibling) { - var localName = ol.xml.getLocalName(n); - // Assume attribute elements have one child node and that the child - // is a text or CDATA node (to be treated as text). - // Otherwise assume it is a geometry node. - if (n.childNodes.length === 0 || - (n.childNodes.length === 1 && - (n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) { - var value = ol.xml.getAllTextContent(n, false); - if (goog.string.isEmpty(value)) { - value = undefined; - } - values[localName] = value; - } else { - // boundedBy is an extent and must not be considered as a geometry - if (localName !== 'boundedBy') { - geometryName = localName; - } - values[localName] = this.readGeometryElement(n, objectStack); - } - } - var feature = new ol.Feature(values); - if (geometryName) { - feature.setGeometryName(geometryName); - } - if (fid) { - feature.setId(fid); - } - return feature; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.geom.Point|undefined} Point. - */ -ol.format.GMLBase.prototype.readPoint = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Point', 'localName should be Point'); - var flatCoordinates = - this.readFlatCoordinatesFromNode_(node, objectStack); - if (flatCoordinates) { - var point = new ol.geom.Point(null); - goog.asserts.assert(flatCoordinates.length == 3, - 'flatCoordinates should have a length of 3'); - point.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); - return point; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.geom.MultiPoint|undefined} MultiPoint. - */ -ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'MultiPoint', - 'localName should be MultiPoint'); - var coordinates = ol.xml.pushParseAndPop( - /** @type {Array.<Array.<number>>} */ ([]), - this.MULTIPOINT_PARSERS_, node, objectStack, this); - if (coordinates) { - return new ol.geom.MultiPoint(coordinates); - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.geom.MultiLineString|undefined} MultiLineString. - */ -ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'MultiLineString', - 'localName should be MultiLineString'); - var lineStrings = ol.xml.pushParseAndPop( - /** @type {Array.<ol.geom.LineString>} */ ([]), - this.MULTILINESTRING_PARSERS_, node, objectStack, this); - if (lineStrings) { - var multiLineString = new ol.geom.MultiLineString(null); - multiLineString.setLineStrings(lineStrings); - return multiLineString; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.geom.MultiPolygon|undefined} MultiPolygon. - */ -ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'MultiPolygon', - 'localName should be MultiPolygon'); - var polygons = ol.xml.pushParseAndPop( - /** @type {Array.<ol.geom.Polygon>} */ ([]), - this.MULTIPOLYGON_PARSERS_, node, objectStack, this); - if (polygons) { - var multiPolygon = new ol.geom.MultiPolygon(null); - multiPolygon.setPolygons(polygons); - return multiPolygon; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'pointMember' || - node.localName == 'pointMembers', - 'localName should be pointMember or pointMembers'); - ol.xml.parseNode(this.POINTMEMBER_PARSERS_, - node, objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GMLBase.prototype.lineStringMemberParser_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'lineStringMember' || - node.localName == 'lineStringMembers', - 'localName should be LineStringMember or LineStringMembers'); - ol.xml.parseNode(this.LINESTRINGMEMBER_PARSERS_, - node, objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GMLBase.prototype.polygonMemberParser_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'polygonMember' || - node.localName == 'polygonMembers', - 'localName should be polygonMember or polygonMembers'); - ol.xml.parseNode(this.POLYGONMEMBER_PARSERS_, node, - objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.geom.LineString|undefined} LineString. - */ -ol.format.GMLBase.prototype.readLineString = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LineString', - 'localName should be LineString'); - var flatCoordinates = - this.readFlatCoordinatesFromNode_(node, objectStack); - if (flatCoordinates) { - var lineString = new ol.geom.LineString(null); - lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); - return lineString; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>|undefined} LinearRing flat coordinates. - */ -ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LinearRing', - 'localName should be LinearRing'); - var ring = ol.xml.pushParseAndPop(/** @type {Array.<number>} */(null), - this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, - objectStack, this); - if (ring) { - return ring; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.geom.LinearRing|undefined} LinearRing. - */ -ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LinearRing', - 'localName should be LinearRing'); - var flatCoordinates = - this.readFlatCoordinatesFromNode_(node, objectStack); - if (flatCoordinates) { - var ring = new ol.geom.LinearRing(null); - ring.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); - return ring; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.geom.Polygon|undefined} Polygon. - */ -ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Polygon', - 'localName should be Polygon'); - var flatLinearRings = ol.xml.pushParseAndPop( - /** @type {Array.<Array.<number>>} */ ([null]), - this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); - if (flatLinearRings && flatLinearRings[0]) { - var polygon = new ol.geom.Polygon(null); - var flatCoordinates = flatLinearRings[0]; - var ends = [flatCoordinates.length]; - var i, ii; - for (i = 1, ii = flatLinearRings.length; i < ii; ++i) { - goog.array.extend(flatCoordinates, flatLinearRings[i]); - ends.push(flatCoordinates.length); - } - polygon.setFlatCoordinates( - ol.geom.GeometryLayout.XYZ, flatCoordinates, ends); - return polygon; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>} Flat coordinates. - */ -ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop( - null, - this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, - objectStack, this)); -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'pointMember': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.pointMemberParser_), - 'pointMembers': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.pointMemberParser_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'lineStringMember': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.lineStringMemberParser_), - 'lineStringMembers': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.lineStringMemberParser_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'polygonMember': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.polygonMemberParser_), - 'polygonMembers': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.polygonMemberParser_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'Point': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'LineString': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.readLineString) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'Polygon': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.readPolygon) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @protected - */ -ol.format.GMLBase.prototype.RING_PARSERS = Object({ - 'http://www.opengis.net/gml' : { - 'LinearRing': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readFlatLinearRing_) - } -}); - - -/** - * @inheritDoc - */ -ol.format.GMLBase.prototype.readGeometryFromNode = - function(node, opt_options) { - var geometry = this.readGeometryElement(node, - [this.getReadOptions(node, opt_options ? opt_options : {})]); - return geometry ? geometry : null; -}; - - -/** - * Read all features from a GML FeatureCollection. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.GMLBase.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.GMLBase.prototype.readFeaturesFromNode = - function(node, opt_options) { - var options = { - featureType: this.featureType, - featureNS: this.featureNS - }; - if (opt_options) { - goog.object.extend(options, this.getReadOptions(node, opt_options)); - } - return this.readFeaturesInternal(node, [options]); -}; - - -/** - * @inheritDoc - */ -ol.format.GMLBase.prototype.readProjectionFromNode = function(node) { - return ol.proj.get(this.srsName_ ? this.srsName_ : - node.firstElementChild.getAttribute('srsName')); -}; - -goog.provide('ol.format.XSD'); - -goog.require('goog.asserts'); -goog.require('goog.string'); -goog.require('ol'); -goog.require('ol.xml'); - - -/** - * @const - * @type {string} - */ -ol.format.XSD.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema'; - - -/** - * @param {Node} node Node. - * @return {boolean|undefined} Boolean. - */ -ol.format.XSD.readBoolean = function(node) { - var s = ol.xml.getAllTextContent(node, false); - return ol.format.XSD.readBooleanString(s); -}; - - -/** - * @param {string} string String. - * @return {boolean|undefined} Boolean. - */ -ol.format.XSD.readBooleanString = function(string) { - var m = /^\s*(true|1)|(false|0)\s*$/.exec(string); - if (m) { - return m[1] !== undefined || false; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @return {number|undefined} DateTime in seconds. - */ -ol.format.XSD.readDateTime = function(node) { - var s = ol.xml.getAllTextContent(node, false); - var re = - /^\s*(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|(?:([+\-])(\d{2})(?::(\d{2}))?))\s*$/; - var m = re.exec(s); - if (m) { - var year = parseInt(m[1], 10); - var month = parseInt(m[2], 10) - 1; - var day = parseInt(m[3], 10); - var hour = parseInt(m[4], 10); - var minute = parseInt(m[5], 10); - var second = parseInt(m[6], 10); - var dateTime = Date.UTC(year, month, day, hour, minute, second) / 1000; - if (m[7] != 'Z') { - var sign = m[8] == '-' ? -1 : 1; - dateTime += sign * 60 * parseInt(m[9], 10); - if (m[10] !== undefined) { - dateTime += sign * 60 * 60 * parseInt(m[10], 10); - } - } - return dateTime; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @return {number|undefined} Decimal. - */ -ol.format.XSD.readDecimal = function(node) { - var s = ol.xml.getAllTextContent(node, false); - return ol.format.XSD.readDecimalString(s); -}; - - -/** - * @param {string} string String. - * @return {number|undefined} Decimal. - */ -ol.format.XSD.readDecimalString = function(string) { - // FIXME check spec - var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string); - if (m) { - return parseFloat(m[1]); - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @return {number|undefined} Non negative integer. - */ -ol.format.XSD.readNonNegativeInteger = function(node) { - var s = ol.xml.getAllTextContent(node, false); - return ol.format.XSD.readNonNegativeIntegerString(s); -}; - - -/** - * @param {string} string String. - * @return {number|undefined} Non negative integer. - */ -ol.format.XSD.readNonNegativeIntegerString = function(string) { - var m = /^\s*(\d+)\s*$/.exec(string); - if (m) { - return parseInt(m[1], 10); - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @return {string|undefined} String. - */ -ol.format.XSD.readString = function(node) { - return ol.xml.getAllTextContent(node, false).trim(); -}; - - -/** - * @param {Node} node Node to append a TextNode with the boolean to. - * @param {boolean} bool Boolean. - */ -ol.format.XSD.writeBooleanTextNode = function(node, bool) { - ol.format.XSD.writeStringTextNode(node, (bool) ? '1' : '0'); -}; - - -/** - * @param {Node} node Node to append a TextNode with the dateTime to. - * @param {number} dateTime DateTime in seconds. - */ -ol.format.XSD.writeDateTimeTextNode = function(node, dateTime) { - var date = new Date(dateTime * 1000); - var string = date.getUTCFullYear() + '-' + - goog.string.padNumber(date.getUTCMonth() + 1, 2) + '-' + - goog.string.padNumber(date.getUTCDate(), 2) + 'T' + - goog.string.padNumber(date.getUTCHours(), 2) + ':' + - goog.string.padNumber(date.getUTCMinutes(), 2) + ':' + - goog.string.padNumber(date.getUTCSeconds(), 2) + 'Z'; - node.appendChild(ol.xml.DOCUMENT.createTextNode(string)); -}; - - -/** - * @param {Node} node Node to append a TextNode with the decimal to. - * @param {number} decimal Decimal. - */ -ol.format.XSD.writeDecimalTextNode = function(node, decimal) { - var string = decimal.toPrecision(); - node.appendChild(ol.xml.DOCUMENT.createTextNode(string)); -}; - - -/** - * @param {Node} node Node to append a TextNode with the decimal to. - * @param {number} nonNegativeInteger Non negative integer. - */ -ol.format.XSD.writeNonNegativeIntegerTextNode = - function(node, nonNegativeInteger) { - goog.asserts.assert(nonNegativeInteger >= 0, 'value should be more than 0'); - goog.asserts.assert(nonNegativeInteger == (nonNegativeInteger | 0), - 'value should be an integer value'); - var string = nonNegativeInteger.toString(); - node.appendChild(ol.xml.DOCUMENT.createTextNode(string)); -}; - - -/** - * @param {Node} node Node to append a TextNode with the string to. - * @param {string} string String. - */ -ol.format.XSD.writeStringTextNode = function(node, string) { - node.appendChild(ol.xml.DOCUMENT.createTextNode(string)); -}; - -goog.provide('ol.format.GML2'); - -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('ol.extent'); -goog.require('ol.format.GMLBase'); -goog.require('ol.format.XSD'); -goog.require('ol.proj'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Feature format for reading and writing data in the GML format, - * version 2.1.2. - * - * @constructor - * @param {olx.format.GMLOptions=} opt_options Optional configuration object. - * @extends {ol.format.GMLBase} - * @api - */ -ol.format.GML2 = function(opt_options) { - var options = /** @type {olx.format.GMLOptions} */ - (opt_options ? opt_options : {}); - - goog.base(this, options); - - this.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS][ - 'featureMember'] = - ol.xml.makeArrayPusher(ol.format.GMLBase.prototype.readFeaturesInternal); - - /** - * @inheritDoc - */ - this.schemaLocation = options.schemaLocation ? - options.schemaLocation : ol.format.GML2.schemaLocation_; - -}; -goog.inherits(ol.format.GML2, ol.format.GMLBase); - - -/** - * @const - * @type {string} - * @private - */ -ol.format.GML2.schemaLocation_ = ol.format.GMLBase.GMLNS + - ' http://schemas.opengis.net/gml/2.1.2/feature.xsd'; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>|undefined} Flat coordinates. - */ -ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) { - var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); - var context = objectStack[0]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var containerSrs = context['srsName']; - var containerDimension = node.parentNode.getAttribute('srsDimension'); - var axisOrientation = 'enu'; - if (containerSrs) { - var proj = ol.proj.get(containerSrs); - axisOrientation = proj.getAxisOrientation(); - } - var coords = s.split(/[\s,]+/); - // The "dimension" attribute is from the GML 3.0.1 spec. - var dim = 2; - if (node.getAttribute('srsDimension')) { - dim = ol.format.XSD.readNonNegativeIntegerString( - node.getAttribute('srsDimension')); - } else if (node.getAttribute('dimension')) { - dim = ol.format.XSD.readNonNegativeIntegerString( - node.getAttribute('dimension')); - } else if (containerDimension) { - dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension); - } - var x, y, z; - var flatCoordinates = []; - for (var i = 0, ii = coords.length; i < ii; i += dim) { - x = parseFloat(coords[i]); - y = parseFloat(coords[i + 1]); - z = (dim === 3) ? parseFloat(coords[i + 2]) : 0; - if (axisOrientation.substr(0, 2) === 'en') { - flatCoordinates.push(x, y, z); - } else { - flatCoordinates.push(y, x, z); - } - } - return flatCoordinates; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.Extent|undefined} Envelope. - */ -ol.format.GML2.prototype.readBox_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Box', 'localName should be Box'); - var flatCoordinates = ol.xml.pushParseAndPop( - /** @type {Array.<number>} */ ([null]), - this.BOX_PARSERS_, node, objectStack, this); - return ol.extent.createOrUpdate(flatCoordinates[1][0], - flatCoordinates[1][1], flatCoordinates[1][3], - flatCoordinates[1][4]); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GML2.prototype.innerBoundaryIsParser_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'innerBoundaryIs', - 'localName should be innerBoundaryIs'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.<number>|undefined} */ (undefined), - this.RING_PARSERS, node, objectStack, this); - if (flatLinearRing) { - var flatLinearRings = /** @type {Array.<Array.<number>>} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isArray(flatLinearRings), - 'flatLinearRings should be an array'); - goog.asserts.assert(flatLinearRings.length > 0, - 'flatLinearRings should have an array length larger than 0'); - flatLinearRings.push(flatLinearRing); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GML2.prototype.outerBoundaryIsParser_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'outerBoundaryIs', - 'localName should be outerBoundaryIs'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.<number>|undefined} */ (undefined), - this.RING_PARSERS, node, objectStack, this); - if (flatLinearRing) { - var flatLinearRings = /** @type {Array.<Array.<number>>} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isArray(flatLinearRings), - 'flatLinearRings should be an array'); - goog.asserts.assert(flatLinearRings.length > 0, - 'flatLinearRings should have an array length larger than 0'); - flatLinearRings[0] = flatLinearRing; - } -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'coordinates': ol.xml.makeReplacer( - ol.format.GML2.prototype.readFlatCoordinates_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'innerBoundaryIs': ol.format.GML2.prototype.innerBoundaryIsParser_, - 'outerBoundaryIs': ol.format.GML2.prototype.outerBoundaryIsParser_ - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML2.prototype.BOX_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'coordinates': ol.xml.makeArrayPusher( - ol.format.GML2.prototype.readFlatCoordinates_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML2.prototype.GEOMETRY_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint), - 'MultiPoint': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readMultiPoint), - 'LineString': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readLineString), - 'MultiLineString': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readMultiLineString), - 'LinearRing' : ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readLinearRing), - 'Polygon': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPolygon), - 'MultiPolygon': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readMultiPolygon), - 'Box': ol.xml.makeReplacer(ol.format.GML2.prototype.readBox_) - } -}); - -goog.provide('ol.format.GML'); -goog.provide('ol.format.GML3'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Feature'); -goog.require('ol.extent'); -goog.require('ol.format.Feature'); -goog.require('ol.format.GMLBase'); -goog.require('ol.format.XSD'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.LinearRing'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.proj'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Feature format for reading and writing data in the GML format - * version 3.1.1. - * Currently only supports GML 3.1.1 Simple Features profile. - * - * @constructor - * @param {olx.format.GMLOptions=} opt_options - * Optional configuration object. - * @extends {ol.format.GMLBase} - * @api - */ -ol.format.GML3 = function(opt_options) { - var options = /** @type {olx.format.GMLOptions} */ - (opt_options ? opt_options : {}); - - goog.base(this, options); - - /** - * @private - * @type {boolean} - */ - this.surface_ = options.surface !== undefined ? options.surface : false; - - /** - * @private - * @type {boolean} - */ - this.curve_ = options.curve !== undefined ? options.curve : false; - - /** - * @private - * @type {boolean} - */ - this.multiCurve_ = options.multiCurve !== undefined ? - options.multiCurve : true; - - /** - * @private - * @type {boolean} - */ - this.multiSurface_ = options.multiSurface !== undefined ? - options.multiSurface : true; - - /** - * @inheritDoc - */ - this.schemaLocation = options.schemaLocation ? - options.schemaLocation : ol.format.GML3.schemaLocation_; - -}; -goog.inherits(ol.format.GML3, ol.format.GMLBase); - - -/** - * @const - * @type {string} - * @private - */ -ol.format.GML3.schemaLocation_ = ol.format.GMLBase.GMLNS + - ' http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' + - '1.0.0/gmlsf.xsd'; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.MultiLineString|undefined} MultiLineString. - */ -ol.format.GML3.prototype.readMultiCurve_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'MultiCurve', - 'localName should be MultiCurve'); - var lineStrings = ol.xml.pushParseAndPop( - /** @type {Array.<ol.geom.LineString>} */ ([]), - this.MULTICURVE_PARSERS_, node, objectStack, this); - if (lineStrings) { - var multiLineString = new ol.geom.MultiLineString(null); - multiLineString.setLineStrings(lineStrings); - return multiLineString; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.MultiPolygon|undefined} MultiPolygon. - */ -ol.format.GML3.prototype.readMultiSurface_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'MultiSurface', - 'localName should be MultiSurface'); - var polygons = ol.xml.pushParseAndPop( - /** @type {Array.<ol.geom.Polygon>} */ ([]), - this.MULTISURFACE_PARSERS_, node, objectStack, this); - if (polygons) { - var multiPolygon = new ol.geom.MultiPolygon(null); - multiPolygon.setPolygons(polygons); - return multiPolygon; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GML3.prototype.curveMemberParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'curveMember' || - node.localName == 'curveMembers', - 'localName should be curveMember or curveMembers'); - ol.xml.parseNode(this.CURVEMEMBER_PARSERS_, node, objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GML3.prototype.surfaceMemberParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'surfaceMember' || - node.localName == 'surfaceMembers', - 'localName should be surfaceMember or surfaceMembers'); - ol.xml.parseNode(this.SURFACEMEMBER_PARSERS_, - node, objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<(Array.<number>)>|undefined} flat coordinates. - */ -ol.format.GML3.prototype.readPatch_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'patches', - 'localName should be patches'); - return ol.xml.pushParseAndPop( - /** @type {Array.<Array.<number>>} */ ([null]), - this.PATCHES_PARSERS_, node, objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>|undefined} flat coordinates. - */ -ol.format.GML3.prototype.readSegment_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'segments', - 'localName should be segments'); - return ol.xml.pushParseAndPop( - /** @type {Array.<number>} */ ([null]), - this.SEGMENTS_PARSERS_, node, objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<(Array.<number>)>|undefined} flat coordinates. - */ -ol.format.GML3.prototype.readPolygonPatch_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'npde.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'PolygonPatch', - 'localName should be PolygonPatch'); - return ol.xml.pushParseAndPop( - /** @type {Array.<Array.<number>>} */ ([null]), - this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>|undefined} flat coordinates. - */ -ol.format.GML3.prototype.readLineStringSegment_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LineStringSegment', - 'localName should be LineStringSegment'); - return ol.xml.pushParseAndPop( - /** @type {Array.<number>} */ ([null]), - this.GEOMETRY_FLAT_COORDINATES_PARSERS_, - node, objectStack, this); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'interior', - 'localName should be interior'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.<number>|undefined} */ (undefined), - this.RING_PARSERS, node, objectStack, this); - if (flatLinearRing) { - var flatLinearRings = /** @type {Array.<Array.<number>>} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isArray(flatLinearRings), - 'flatLinearRings should be an array'); - goog.asserts.assert(flatLinearRings.length > 0, - 'flatLinearRings should have an array length of 1 or more'); - flatLinearRings.push(flatLinearRing); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'exterior', - 'localName should be exterior'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.<number>|undefined} */ (undefined), - this.RING_PARSERS, node, objectStack, this); - if (flatLinearRing) { - var flatLinearRings = /** @type {Array.<Array.<number>>} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isArray(flatLinearRings), - 'flatLinearRings should be an array'); - goog.asserts.assert(flatLinearRings.length > 0, - 'flatLinearRings should have an array length of 1 or more'); - flatLinearRings[0] = flatLinearRing; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.Polygon|undefined} Polygon. - */ -ol.format.GML3.prototype.readSurface_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Surface', - 'localName should be Surface'); - var flatLinearRings = ol.xml.pushParseAndPop( - /** @type {Array.<Array.<number>>} */ ([null]), - this.SURFACE_PARSERS_, node, objectStack, this); - if (flatLinearRings && flatLinearRings[0]) { - var polygon = new ol.geom.Polygon(null); - var flatCoordinates = flatLinearRings[0]; - var ends = [flatCoordinates.length]; - var i, ii; - for (i = 1, ii = flatLinearRings.length; i < ii; ++i) { - goog.array.extend(flatCoordinates, flatLinearRings[i]); - ends.push(flatCoordinates.length); - } - polygon.setFlatCoordinates( - ol.geom.GeometryLayout.XYZ, flatCoordinates, ends); - return polygon; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.LineString|undefined} LineString. - */ -ol.format.GML3.prototype.readCurve_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Curve', 'localName should be Curve'); - var flatCoordinates = ol.xml.pushParseAndPop( - /** @type {Array.<number>} */ ([null]), - this.CURVE_PARSERS_, node, objectStack, this); - if (flatCoordinates) { - var lineString = new ol.geom.LineString(null); - lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); - return lineString; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.Extent|undefined} Envelope. - */ -ol.format.GML3.prototype.readEnvelope_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Envelope', - 'localName should be Envelope'); - var flatCoordinates = ol.xml.pushParseAndPop( - /** @type {Array.<number>} */ ([null]), - this.ENVELOPE_PARSERS_, node, objectStack, this); - return ol.extent.createOrUpdate(flatCoordinates[1][0], - flatCoordinates[1][1], flatCoordinates[2][0], - flatCoordinates[2][1]); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>|undefined} Flat coordinates. - */ -ol.format.GML3.prototype.readFlatPos_ = function(node, objectStack) { - var s = ol.xml.getAllTextContent(node, false); - var re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/; - /** @type {Array.<number>} */ - var flatCoordinates = []; - var m; - while ((m = re.exec(s))) { - flatCoordinates.push(parseFloat(m[1])); - s = s.substr(m[0].length); - } - if (s !== '') { - return undefined; - } - var context = objectStack[0]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var containerSrs = context['srsName']; - var axisOrientation = 'enu'; - if (containerSrs) { - var proj = ol.proj.get(containerSrs); - axisOrientation = proj.getAxisOrientation(); - } - if (axisOrientation === 'neu') { - var i, ii; - for (i = 0, ii = flatCoordinates.length; i < ii; i += 3) { - var y = flatCoordinates[i]; - var x = flatCoordinates[i + 1]; - flatCoordinates[i] = x; - flatCoordinates[i + 1] = y; - } - } - var len = flatCoordinates.length; - if (len == 2) { - flatCoordinates.push(0); - } - if (len === 0) { - return undefined; - } - return flatCoordinates; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>|undefined} Flat coordinates. - */ -ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) { - var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); - var context = objectStack[0]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var containerSrs = context['srsName']; - var containerDimension = node.parentNode.getAttribute('srsDimension'); - var axisOrientation = 'enu'; - if (containerSrs) { - var proj = ol.proj.get(containerSrs); - axisOrientation = proj.getAxisOrientation(); - } - var coords = s.split(/\s+/); - // The "dimension" attribute is from the GML 3.0.1 spec. - var dim = 2; - if (node.getAttribute('srsDimension')) { - dim = ol.format.XSD.readNonNegativeIntegerString( - node.getAttribute('srsDimension')); - } else if (node.getAttribute('dimension')) { - dim = ol.format.XSD.readNonNegativeIntegerString( - node.getAttribute('dimension')); - } else if (containerDimension) { - dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension); - } - var x, y, z; - var flatCoordinates = []; - for (var i = 0, ii = coords.length; i < ii; i += dim) { - x = parseFloat(coords[i]); - y = parseFloat(coords[i + 1]); - z = (dim === 3) ? parseFloat(coords[i + 2]) : 0; - if (axisOrientation.substr(0, 2) === 'en') { - flatCoordinates.push(x, y, z); - } else { - flatCoordinates.push(y, x, z); - } - } - return flatCoordinates; -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'pos': ol.xml.makeReplacer(ol.format.GML3.prototype.readFlatPos_), - 'posList': ol.xml.makeReplacer(ol.format.GML3.prototype.readFlatPosList_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'interior': ol.format.GML3.prototype.interiorParser_, - 'exterior': ol.format.GML3.prototype.exteriorParser_ - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.GEOMETRY_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint), - 'MultiPoint': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readMultiPoint), - 'LineString': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readLineString), - 'MultiLineString': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readMultiLineString), - 'LinearRing' : ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readLinearRing), - 'Polygon': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPolygon), - 'MultiPolygon': ol.xml.makeReplacer( - ol.format.GMLBase.prototype.readMultiPolygon), - 'Surface': ol.xml.makeReplacer(ol.format.GML3.prototype.readSurface_), - 'MultiSurface': ol.xml.makeReplacer( - ol.format.GML3.prototype.readMultiSurface_), - 'Curve': ol.xml.makeReplacer(ol.format.GML3.prototype.readCurve_), - 'MultiCurve': ol.xml.makeReplacer( - ol.format.GML3.prototype.readMultiCurve_), - 'Envelope': ol.xml.makeReplacer(ol.format.GML3.prototype.readEnvelope_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.MULTICURVE_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'curveMember': ol.xml.makeArrayPusher( - ol.format.GML3.prototype.curveMemberParser_), - 'curveMembers': ol.xml.makeArrayPusher( - ol.format.GML3.prototype.curveMemberParser_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.MULTISURFACE_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'surfaceMember': ol.xml.makeArrayPusher( - ol.format.GML3.prototype.surfaceMemberParser_), - 'surfaceMembers': ol.xml.makeArrayPusher( - ol.format.GML3.prototype.surfaceMemberParser_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.CURVEMEMBER_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'LineString': ol.xml.makeArrayPusher( - ol.format.GMLBase.prototype.readLineString), - 'Curve': ol.xml.makeArrayPusher(ol.format.GML3.prototype.readCurve_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.SURFACEMEMBER_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'Polygon': ol.xml.makeArrayPusher(ol.format.GMLBase.prototype.readPolygon), - 'Surface': ol.xml.makeArrayPusher(ol.format.GML3.prototype.readSurface_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.SURFACE_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'patches': ol.xml.makeReplacer(ol.format.GML3.prototype.readPatch_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.CURVE_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'segments': ol.xml.makeReplacer(ol.format.GML3.prototype.readSegment_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.ENVELOPE_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'lowerCorner': ol.xml.makeArrayPusher( - ol.format.GML3.prototype.readFlatPosList_), - 'upperCorner': ol.xml.makeArrayPusher( - ol.format.GML3.prototype.readFlatPosList_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.PATCHES_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'PolygonPatch': ol.xml.makeReplacer( - ol.format.GML3.prototype.readPolygonPatch_) - } -}); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GML3.prototype.SEGMENTS_PARSERS_ = Object({ - 'http://www.opengis.net/gml' : { - 'LineStringSegment': ol.xml.makeReplacer( - ol.format.GML3.prototype.readLineStringSegment_) - } -}); - - -/** - * @param {Node} node Node. - * @param {ol.geom.Point} value Point geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - var axisOrientation = 'enu'; - if (srsName) { - axisOrientation = ol.proj.get(srsName).getAxisOrientation(); - } - var point = value.getCoordinates(); - var coords; - // only 2d for simple features profile - if (axisOrientation.substr(0, 2) === 'en') { - coords = (point[0] + ' ' + point[1]); - } else { - coords = (point[1] + ' ' + point[0]); - } - ol.format.XSD.writeStringTextNode(node, coords); -}; - - -/** - * @param {Array.<number>} point Point geometry. - * @param {string=} opt_srsName Optional srsName - * @return {string} - * @private - */ -ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) { - var axisOrientation = 'enu'; - if (opt_srsName) { - axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation(); - } - return ((axisOrientation.substr(0, 2) === 'en') ? - point[0] + ' ' + point[1] : - point[1] + ' ' + point[0]); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.LineString|ol.geom.LinearRing} value Geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - // only 2d for simple features profile - var points = value.getCoordinates(); - var len = points.length; - var parts = new Array(len); - var point; - for (var i = 0; i < len; ++i) { - point = points[i]; - parts[i] = this.getCoords_(point, srsName); - } - ol.format.XSD.writeStringTextNode(node, parts.join(' ')); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.Point} geometry Point geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writePoint_ = function(node, geometry, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - if (srsName) { - node.setAttribute('srsName', srsName); - } - var pos = ol.xml.createElementNS(node.namespaceURI, 'pos'); - node.appendChild(pos); - this.writePos_(pos, geometry, objectStack); -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GML3.ENVELOPE_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'lowerCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'upperCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode) - } -}; - - -/** - * @param {Node} node Node. - * @param {ol.Extent} extent Extent. - * @param {Array.<*>} objectStack Node stack. - */ -ol.format.GML3.prototype.writeEnvelope = function(node, extent, objectStack) { - goog.asserts.assert(extent.length == 4, 'extent should have 4 items'); - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - if (srsName) { - node.setAttribute('srsName', srsName); - } - var keys = ['lowerCorner', 'upperCorner']; - var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ - ({node: node}), ol.format.GML3.ENVELOPE_SERIALIZERS_, - ol.xml.OBJECT_PROPERTY_NODE_FACTORY, - values, - objectStack, keys, this); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.LinearRing} geometry LinearRing geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeLinearRing_ = - function(node, geometry, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - if (srsName) { - node.setAttribute('srsName', srsName); - } - var posList = ol.xml.createElementNS(node.namespaceURI, 'posList'); - node.appendChild(posList); - this.writePosList_(posList, geometry, objectStack); -}; - - -/** - * @param {*} value Value. - * @param {Array.<*>} objectStack Object stack. - * @param {string=} opt_nodeName Node name. - * @return {Node} Node. - * @private - */ -ol.format.GML3.prototype.RING_NODE_FACTORY_ = - function(value, objectStack, opt_nodeName) { - var context = objectStack[objectStack.length - 1]; - var parentNode = context.node; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var exteriorWritten = context['exteriorWritten']; - if (exteriorWritten === undefined) { - context['exteriorWritten'] = true; - } - return ol.xml.createElementNS(parentNode.namespaceURI, - exteriorWritten !== undefined ? 'interior' : 'exterior'); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.Polygon} geometry Polygon geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeSurfaceOrPolygon_ = - function(node, geometry, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - if (node.nodeName !== 'PolygonPatch' && srsName) { - node.setAttribute('srsName', srsName); - } - if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') { - var rings = geometry.getLinearRings(); - ol.xml.pushSerializeAndPop( - {node: node, srsName: srsName}, - ol.format.GML3.RING_SERIALIZERS_, - this.RING_NODE_FACTORY_, - rings, objectStack, undefined, this); - } else if (node.nodeName === 'Surface') { - var patches = ol.xml.createElementNS(node.namespaceURI, 'patches'); - node.appendChild(patches); - this.writeSurfacePatches_( - patches, geometry, objectStack); - } -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.LineString} geometry LineString geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeCurveOrLineString_ = - function(node, geometry, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - if (node.nodeName !== 'LineStringSegment' && srsName) { - node.setAttribute('srsName', srsName); - } - if (node.nodeName === 'LineString' || - node.nodeName === 'LineStringSegment') { - var posList = ol.xml.createElementNS(node.namespaceURI, 'posList'); - node.appendChild(posList); - this.writePosList_(posList, geometry, objectStack); - } else if (node.nodeName === 'Curve') { - var segments = ol.xml.createElementNS(node.namespaceURI, 'segments'); - node.appendChild(segments); - this.writeCurveSegments_(segments, - geometry, objectStack); - } -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.MultiPolygon} geometry MultiPolygon geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ = - function(node, geometry, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - var surface = context['surface']; - if (srsName) { - node.setAttribute('srsName', srsName); - } - var polygons = geometry.getPolygons(); - ol.xml.pushSerializeAndPop({node: node, srsName: srsName, surface: surface}, - ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_, - this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, - objectStack, undefined, this); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.MultiPoint} geometry MultiPoint geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry, - objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - if (srsName) { - node.setAttribute('srsName', srsName); - } - var points = geometry.getPoints(); - ol.xml.pushSerializeAndPop({node: node, srsName: srsName}, - ol.format.GML3.POINTMEMBER_SERIALIZERS_, - ol.xml.makeSimpleNodeFactory('pointMember'), points, - objectStack, undefined, this); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.MultiLineString} geometry MultiLineString geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeMultiCurveOrLineString_ = - function(node, geometry, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var srsName = context['srsName']; - var curve = context['curve']; - if (srsName) { - node.setAttribute('srsName', srsName); - } - var lines = geometry.getLineStrings(); - ol.xml.pushSerializeAndPop({node: node, srsName: srsName, curve: curve}, - ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_, - this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, - objectStack, undefined, this); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.LinearRing} ring LinearRing geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeRing_ = function(node, ring, objectStack) { - var linearRing = ol.xml.createElementNS(node.namespaceURI, 'LinearRing'); - node.appendChild(linearRing); - this.writeLinearRing_(linearRing, ring, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.Polygon} polygon Polygon geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeSurfaceOrPolygonMember_ = - function(node, polygon, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var child = this.GEOMETRY_NODE_FACTORY_( - polygon, objectStack); - if (child) { - node.appendChild(child); - this.writeSurfaceOrPolygon_(child, polygon, objectStack); - } -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.Point} point Point geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writePointMember_ = - function(node, point, objectStack) { - var child = ol.xml.createElementNS(node.namespaceURI, 'Point'); - node.appendChild(child); - this.writePoint_(child, point, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.LineString} line LineString geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeLineStringOrCurveMember_ = - function(node, line, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); - if (child) { - node.appendChild(child); - this.writeCurveOrLineString_(child, line, objectStack); - } -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.Polygon} polygon Polygon geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeSurfacePatches_ = - function(node, polygon, objectStack) { - var child = ol.xml.createElementNS(node.namespaceURI, 'PolygonPatch'); - node.appendChild(child); - this.writeSurfaceOrPolygon_(child, polygon, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.LineString} line LineString geometry. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeCurveSegments_ = - function(node, line, objectStack) { - var child = ol.xml.createElementNS(node.namespaceURI, - 'LineStringSegment'); - node.appendChild(child); - this.writeCurveOrLineString_(child, line, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.Geometry|ol.Extent} geometry Geometry. - * @param {Array.<*>} objectStack Node stack. - */ -ol.format.GML3.prototype.writeGeometryElement = - function(node, geometry, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var item = goog.object.clone(context); - item.node = node; - var value; - if (goog.isArray(geometry)) { - if (context.dataProjection) { - value = ol.proj.transformExtent( - geometry, context.featureProjection, context.dataProjection); - } else { - value = geometry; - } - } else { - goog.asserts.assertInstanceof(geometry, ol.geom.Geometry, - 'geometry should be an ol.geom.Geometry'); - value = - ol.format.Feature.transformWithOptions(geometry, true, context); - } - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ - (item), ol.format.GML3.GEOMETRY_SERIALIZERS_, - this.GEOMETRY_NODE_FACTORY_, [value], - objectStack, undefined, this); -}; - - -/** - * @param {Node} node Node. - * @param {ol.Feature} feature Feature. - * @param {Array.<*>} objectStack Node stack. - */ -ol.format.GML3.prototype.writeFeatureElement = - function(node, feature, objectStack) { - var fid = feature.getId(); - if (fid) { - node.setAttribute('fid', fid); - } - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var featureNS = context['featureNS']; - var geometryName = feature.getGeometryName(); - if (!context.serializers) { - context.serializers = {}; - context.serializers[featureNS] = {}; - } - var properties = feature.getProperties(); - var keys = [], values = []; - for (var key in properties) { - var value = properties[key]; - if (value !== null) { - keys.push(key); - values.push(value); - if (key == geometryName || value instanceof ol.geom.Geometry) { - if (!(key in context.serializers[featureNS])) { - context.serializers[featureNS][key] = ol.xml.makeChildAppender( - this.writeGeometryElement, this); - } - } else { - if (!(key in context.serializers[featureNS])) { - context.serializers[featureNS][key] = ol.xml.makeChildAppender( - ol.format.XSD.writeStringTextNode); - } - } - } - } - var item = goog.object.clone(context); - item.node = node; - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ - (item), context.serializers, - ol.xml.makeSimpleNodeFactory(undefined, featureNS), - values, - objectStack, keys); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<ol.Feature>} features Features. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GML3.prototype.writeFeatureMembers_ = - function(node, features, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var featureType = context['featureType']; - var featureNS = context['featureNS']; - var serializers = {}; - serializers[featureNS] = {}; - serializers[featureNS][featureType] = ol.xml.makeChildAppender( - this.writeFeatureElement, this); - var item = goog.object.clone(context); - item.node = node; - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ - (item), - serializers, - ol.xml.makeSimpleNodeFactory(featureType, featureNS), features, - objectStack); -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'surfaceMember': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeSurfaceOrPolygonMember_), - 'polygonMember': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeSurfaceOrPolygonMember_) - } -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GML3.POINTMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'pointMember': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writePointMember_) - } -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'lineStringMember': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeLineStringOrCurveMember_), - 'curveMember': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeLineStringOrCurveMember_) - } -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GML3.RING_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'exterior': ol.xml.makeChildAppender(ol.format.GML3.prototype.writeRing_), - 'interior': ol.xml.makeChildAppender(ol.format.GML3.prototype.writeRing_) - } -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GML3.GEOMETRY_SERIALIZERS_ = { - 'http://www.opengis.net/gml': { - 'Curve': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeCurveOrLineString_), - 'MultiCurve': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeMultiCurveOrLineString_), - 'Point': ol.xml.makeChildAppender(ol.format.GML3.prototype.writePoint_), - 'MultiPoint': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeMultiPoint_), - 'LineString': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeCurveOrLineString_), - 'MultiLineString': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeMultiCurveOrLineString_), - 'LinearRing': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeLinearRing_), - 'Polygon': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeSurfaceOrPolygon_), - 'MultiPolygon': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_), - 'Surface': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeSurfaceOrPolygon_), - 'MultiSurface': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_), - 'Envelope': ol.xml.makeChildAppender( - ol.format.GML3.prototype.writeEnvelope) - } -}; - - -/** - * @const - * @type {Object.<string, string>} - * @private - */ -ol.format.GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { - 'MultiLineString': 'lineStringMember', - 'MultiCurve': 'curveMember', - 'MultiPolygon': 'polygonMember', - 'MultiSurface': 'surfaceMember' -}; - - -/** - * @const - * @param {*} value Value. - * @param {Array.<*>} objectStack Object stack. - * @param {string=} opt_nodeName Node name. - * @return {Node|undefined} Node. - * @private - */ -ol.format.GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = - function(value, objectStack, opt_nodeName) { - var parentNode = objectStack[objectStack.length - 1].node; - goog.asserts.assert(ol.xml.isNode(parentNode), - 'parentNode should be a node'); - return ol.xml.createElementNS('http://www.opengis.net/gml', - ol.format.GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]); -}; - - -/** - * @const - * @param {*} value Value. - * @param {Array.<*>} objectStack Object stack. - * @param {string=} opt_nodeName Node name. - * @return {Node|undefined} Node. - * @private - */ -ol.format.GML3.prototype.GEOMETRY_NODE_FACTORY_ = - function(value, objectStack, opt_nodeName) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var multiSurface = context['multiSurface']; - var surface = context['surface']; - var curve = context['curve']; - var multiCurve = context['multiCurve']; - var parentNode = objectStack[objectStack.length - 1].node; - goog.asserts.assert(ol.xml.isNode(parentNode), - 'parentNode should be a node'); - var nodeName; - if (!goog.isArray(value)) { - goog.asserts.assertInstanceof(value, ol.geom.Geometry, - 'value should be an ol.geom.Geometry'); - nodeName = value.getType(); - if (nodeName === 'MultiPolygon' && multiSurface === true) { - nodeName = 'MultiSurface'; - } else if (nodeName === 'Polygon' && surface === true) { - nodeName = 'Surface'; - } else if (nodeName === 'LineString' && curve === true) { - nodeName = 'Curve'; - } else if (nodeName === 'MultiLineString' && multiCurve === true) { - nodeName = 'MultiCurve'; - } - } else { - nodeName = 'Envelope'; - } - return ol.xml.createElementNS('http://www.opengis.net/gml', - nodeName); -}; - - -/** - * Encode a geometry in GML 3.1.1 Simple Features. - * - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {Node} Node. - * @api - */ -ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) { - opt_options = this.adaptOptions(opt_options); - var geom = ol.xml.createElementNS('http://www.opengis.net/gml', 'geom'); - var context = {node: geom, srsName: this.srsName, - curve: this.curve_, surface: this.surface_, - multiSurface: this.multiSurface_, multiCurve: this.multiCurve_}; - if (opt_options) { - goog.object.extend(context, opt_options); - } - this.writeGeometryElement(geom, geometry, [context]); - return geom; -}; - - -/** - * Encode an array of features in GML 3.1.1 Simple Features. - * - * @function - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {string} Result. - * @api stable - */ -ol.format.GML3.prototype.writeFeatures; - - -/** - * Encode an array of features in the GML 3.1.1 format as an XML node. - * - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {Node} Node. - * @api - */ -ol.format.GML3.prototype.writeFeaturesNode = function(features, opt_options) { - opt_options = this.adaptOptions(opt_options); - var node = ol.xml.createElementNS('http://www.opengis.net/gml', - 'featureMembers'); - ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:schemaLocation', this.schemaLocation); - var context = { - srsName: this.srsName, - curve: this.curve_, - surface: this.surface_, - multiSurface: this.multiSurface_, - multiCurve: this.multiCurve_, - featureNS: this.featureNS, - featureType: this.featureType - }; - if (opt_options) { - goog.object.extend(context, opt_options); - } - this.writeFeatureMembers_(node, features, [context]); - return node; -}; - - - -/** - * @classdesc - * Feature format for reading and writing data in the GML format - * version 3.1.1. - * Currently only supports GML 3.1.1 Simple Features profile. - * - * @constructor - * @param {olx.format.GMLOptions=} opt_options - * Optional configuration object. - * @extends {ol.format.GMLBase} - * @api stable - */ -ol.format.GML = ol.format.GML3; - - -/** - * Encode an array of features in GML 3.1.1 Simple Features. - * - * @function - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {string} Result. - * @api stable - */ -ol.format.GML.prototype.writeFeatures; - - -/** - * Encode an array of features in the GML 3.1.1 format as an XML node. - * - * @function - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {Node} Node. - * @api - */ -ol.format.GML.prototype.writeFeaturesNode; - -goog.provide('ol.format.GPX'); - -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('ol.Feature'); -goog.require('ol.array'); -goog.require('ol.format.Feature'); -goog.require('ol.format.XMLFeature'); -goog.require('ol.format.XSD'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.Point'); -goog.require('ol.proj'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Feature format for reading and writing data in the GPX format. - * - * @constructor - * @extends {ol.format.XMLFeature} - * @param {olx.format.GPXOptions=} opt_options Options. - * @api stable - */ -ol.format.GPX = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this); - - /** - * @inheritDoc - */ - this.defaultDataProjection = ol.proj.get('EPSG:4326'); - - /** - * @type {function(ol.Feature, Node)|undefined} - * @private - */ - this.readExtensions_ = options.readExtensions; -}; -goog.inherits(ol.format.GPX, ol.format.XMLFeature); - - -/** - * @const - * @private - * @type {Array.<string>} - */ -ol.format.GPX.NAMESPACE_URIS_ = [ - null, - 'http://www.topografix.com/GPX/1/0', - 'http://www.topografix.com/GPX/1/1' -]; - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {Node} node Node. - * @param {Object} values Values. - * @private - * @return {Array.<number>} Flat coordinates. - */ -ol.format.GPX.appendCoordinate_ = function(flatCoordinates, node, values) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - flatCoordinates.push( - parseFloat(node.getAttribute('lon')), - parseFloat(node.getAttribute('lat'))); - if ('ele' in values) { - flatCoordinates.push(/** @type {number} */ (values['ele'])); - delete values['ele']; - } else { - flatCoordinates.push(0); - } - if ('time' in values) { - flatCoordinates.push(/** @type {number} */ (values['time'])); - delete values['time']; - } else { - flatCoordinates.push(0); - } - return flatCoordinates; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.parseLink_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'link', 'localName should be link'); - var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); - var href = node.getAttribute('href'); - if (href !== null) { - values['link'] = href; - } - ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.parseExtensions_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'extensions', - 'localName should be extensions'); - var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); - values['extensionsNode_'] = node; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.parseRtePt_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'rtept', 'localName should be rtept'); - var values = ol.xml.pushParseAndPop( - {}, ol.format.GPX.RTEPT_PARSERS_, node, objectStack); - if (values) { - var rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]); - var flatCoordinates = /** @type {Array.<number>} */ - (rteValues['flatCoordinates']); - ol.format.GPX.appendCoordinate_(flatCoordinates, node, values); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.parseTrkPt_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'trkpt', 'localName should be trkpt'); - var values = ol.xml.pushParseAndPop( - {}, ol.format.GPX.TRKPT_PARSERS_, node, objectStack); - if (values) { - var trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]); - var flatCoordinates = /** @type {Array.<number>} */ - (trkValues['flatCoordinates']); - ol.format.GPX.appendCoordinate_(flatCoordinates, node, values); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.parseTrkSeg_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'trkseg', - 'localName should be trkseg'); - var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); - ol.xml.parseNode(ol.format.GPX.TRKSEG_PARSERS_, node, objectStack); - var flatCoordinates = /** @type {Array.<number>} */ - (values['flatCoordinates']); - var ends = /** @type {Array.<number>} */ (values['ends']); - ends.push(flatCoordinates.length); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.Feature|undefined} Track. - */ -ol.format.GPX.readRte_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'rte', 'localName should be rte'); - var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); - var values = ol.xml.pushParseAndPop({ - 'flatCoordinates': [] - }, ol.format.GPX.RTE_PARSERS_, node, objectStack); - if (!values) { - return undefined; - } - var flatCoordinates = /** @type {Array.<number>} */ - (values['flatCoordinates']); - delete values['flatCoordinates']; - var geometry = new ol.geom.LineString(null); - geometry.setFlatCoordinates(ol.geom.GeometryLayout.XYZM, flatCoordinates); - ol.format.Feature.transformWithOptions(geometry, false, options); - var feature = new ol.Feature(geometry); - feature.setProperties(values); - return feature; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.Feature|undefined} Track. - */ -ol.format.GPX.readTrk_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'trk', 'localName should be trk'); - var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); - var values = ol.xml.pushParseAndPop({ - 'flatCoordinates': [], - 'ends': [] - }, ol.format.GPX.TRK_PARSERS_, node, objectStack); - if (!values) { - return undefined; - } - var flatCoordinates = /** @type {Array.<number>} */ - (values['flatCoordinates']); - delete values['flatCoordinates']; - var ends = /** @type {Array.<number>} */ (values['ends']); - delete values['ends']; - var geometry = new ol.geom.MultiLineString(null); - geometry.setFlatCoordinates( - ol.geom.GeometryLayout.XYZM, flatCoordinates, ends); - ol.format.Feature.transformWithOptions(geometry, false, options); - var feature = new ol.Feature(geometry); - feature.setProperties(values); - return feature; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.Feature|undefined} Waypoint. - */ -ol.format.GPX.readWpt_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'wpt', 'localName should be wpt'); - var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); - var values = ol.xml.pushParseAndPop( - {}, ol.format.GPX.WPT_PARSERS_, node, objectStack); - if (!values) { - return undefined; - } - var coordinates = ol.format.GPX.appendCoordinate_([], node, values); - var geometry = new ol.geom.Point( - coordinates, ol.geom.GeometryLayout.XYZM); - ol.format.Feature.transformWithOptions(geometry, false, options); - var feature = new ol.Feature(geometry); - feature.setProperties(values); - return feature; -}; - - -/** - * @const - * @type {Object.<string, function(Node, Array.<*>): (ol.Feature|undefined)>} - * @private - */ -ol.format.GPX.FEATURE_READER_ = { - 'rte': ol.format.GPX.readRte_, - 'trk': ol.format.GPX.readTrk_, - 'wpt': ol.format.GPX.readWpt_ -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GPX.GPX_PARSERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'rte': ol.xml.makeArrayPusher(ol.format.GPX.readRte_), - 'trk': ol.xml.makeArrayPusher(ol.format.GPX.readTrk_), - 'wpt': ol.xml.makeArrayPusher(ol.format.GPX.readWpt_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GPX.LINK_PARSERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'text': - ol.xml.makeObjectPropertySetter(ol.format.XSD.readString, 'linkText'), - 'type': - ol.xml.makeObjectPropertySetter(ol.format.XSD.readString, 'linkType') - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GPX.RTE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'link': ol.format.GPX.parseLink_, - 'number': - ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger), - 'extensions': ol.format.GPX.parseExtensions_, - 'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'rtept': ol.format.GPX.parseRtePt_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GPX.RTEPT_PARSERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GPX.TRK_PARSERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'link': ol.format.GPX.parseLink_, - 'number': - ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger), - 'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'extensions': ol.format.GPX.parseExtensions_, - 'trkseg': ol.format.GPX.parseTrkSeg_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GPX.TRKSEG_PARSERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'trkpt': ol.format.GPX.parseTrkPt_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GPX.TRKPT_PARSERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime), - 'magvar': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'geoidheight': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'link': ol.format.GPX.parseLink_, - 'sym': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'fix': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'sat': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger), - 'hdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'vdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'pdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'ageofdgpsdata': - ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'dgpsid': - ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger), - 'extensions': ol.format.GPX.parseExtensions_ - }); - - -/** - * @param {Array.<ol.Feature>} features - * @private - */ -ol.format.GPX.prototype.handleReadExtensions_ = function(features) { - if (!features) { - features = []; - } - for (var i = 0, ii = features.length; i < ii; ++i) { - var feature = features[i]; - if (this.readExtensions_) { - var extensionsNode = feature.get('extensionsNode_') || null; - this.readExtensions_(feature, extensionsNode); - } - feature.set('extensionsNode_', undefined); - } -}; - - -/** - * Read the first feature from a GPX source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - * @api stable - */ -ol.format.GPX.prototype.readFeature; - - -/** - * @inheritDoc - */ -ol.format.GPX.prototype.readFeatureFromNode = function(node, opt_options) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - if (!ol.array.includes(ol.format.GPX.NAMESPACE_URIS_, node.namespaceURI)) { - return null; - } - var featureReader = ol.format.GPX.FEATURE_READER_[node.localName]; - if (!featureReader) { - return null; - } - var feature = featureReader(node, [this.getReadOptions(node, opt_options)]); - if (!feature) { - return null; - } - this.handleReadExtensions_([feature]); - return feature; -}; - - -/** - * Read all features from a GPX source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.GPX.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - if (!ol.array.includes(ol.format.GPX.NAMESPACE_URIS_, node.namespaceURI)) { - return []; - } - if (node.localName == 'gpx') { - var features = ol.xml.pushParseAndPop( - /** @type {Array.<ol.Feature>} */ ([]), ol.format.GPX.GPX_PARSERS_, - node, [this.getReadOptions(node, opt_options)]); - if (features) { - this.handleReadExtensions_(features); - return features; - } else { - return []; - } - } - return []; -}; - - -/** - * Read the projection from a GPX source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {ol.proj.Projection} Projection. - * @api stable - */ -ol.format.GPX.prototype.readProjection; - - -/** - * @param {Node} node Node. - * @param {string} value Value for the link's `href` attribute. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.GPX.writeLink_ = function(node, value, objectStack) { - node.setAttribute('href', value); - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var properties = context['properties']; - var link = [ - properties['linkText'], - properties['linkType'] - ]; - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ ({node: node}), - ol.format.GPX.LINK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY, - link, objectStack, ol.format.GPX.LINK_SEQUENCE_); -}; - - -/** - * @param {Node} node Node. - * @param {ol.Coordinate} coordinate Coordinate. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var parentNode = context.node; - goog.asserts.assert(ol.xml.isNode(parentNode), - 'parentNode should be an XML node'); - var namespaceURI = parentNode.namespaceURI; - var properties = context['properties']; - //FIXME Projection handling - ol.xml.setAttributeNS(node, null, 'lat', coordinate[1]); - ol.xml.setAttributeNS(node, null, 'lon', coordinate[0]); - var geometryLayout = context['geometryLayout']; - /* jshint -W086 */ - switch (geometryLayout) { - case ol.geom.GeometryLayout.XYZM: - if (coordinate[3] !== 0) { - properties['time'] = coordinate[3]; - } - case ol.geom.GeometryLayout.XYZ: - if (coordinate[2] !== 0) { - properties['ele'] = coordinate[2]; - } - break; - case ol.geom.GeometryLayout.XYM: - if (coordinate[2] !== 0) { - properties['time'] = coordinate[2]; - } - } - /* jshint +W086 */ - var orderedKeys = ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ - ({node: node, 'properties': properties}), - ol.format.GPX.WPT_TYPE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY, - values, objectStack, orderedKeys); -}; - - -/** - * @param {Node} node Node. - * @param {ol.Feature} feature Feature. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.writeRte_ = function(node, feature, objectStack) { - var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); - var properties = feature.getProperties(); - var context = {node: node, 'properties': properties}; - var geometry = feature.getGeometry(); - if (geometry) { - goog.asserts.assertInstanceof(geometry, ol.geom.LineString, - 'geometry should be an ol.geom.LineString'); - geometry = /** @type {ol.geom.LineString} */ - (ol.format.Feature.transformWithOptions(geometry, true, options)); - context['geometryLayout'] = geometry.getLayout(); - properties['rtept'] = geometry.getCoordinates(); - } - var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = ol.format.GPX.RTE_SEQUENCE_[parentNode.namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context), - ol.format.GPX.RTE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY, - values, objectStack, orderedKeys); -}; - - -/** - * @param {Node} node Node. - * @param {ol.Feature} feature Feature. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.writeTrk_ = function(node, feature, objectStack) { - var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); - var properties = feature.getProperties(); - var context = {node: node, 'properties': properties}; - var geometry = feature.getGeometry(); - if (geometry) { - goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString, - 'geometry should be an ol.geom.MultiLineString'); - geometry = /** @type {ol.geom.MultiLineString} */ - (ol.format.Feature.transformWithOptions(geometry, true, options)); - properties['trkseg'] = geometry.getLineStrings(); - } - var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = ol.format.GPX.TRK_SEQUENCE_[parentNode.namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context), - ol.format.GPX.TRK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY, - values, objectStack, orderedKeys); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.LineString} lineString LineString. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) { - var context = {node: node, 'geometryLayout': lineString.getLayout(), - 'properties': {}}; - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context), - ol.format.GPX.TRKSEG_SERIALIZERS_, ol.format.GPX.TRKSEG_NODE_FACTORY_, - lineString.getCoordinates(), objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.Feature} feature Feature. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.GPX.writeWpt_ = function(node, feature, objectStack) { - var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - context['properties'] = feature.getProperties(); - var geometry = feature.getGeometry(); - if (geometry) { - goog.asserts.assertInstanceof(geometry, ol.geom.Point, - 'geometry should be an ol.geom.Point'); - geometry = /** @type {ol.geom.Point} */ - (ol.format.Feature.transformWithOptions(geometry, true, options)); - context['geometryLayout'] = geometry.getLayout(); - ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack); - } -}; - - -/** - * @const - * @type {Array.<string>} - * @private - */ -ol.format.GPX.LINK_SEQUENCE_ = ['text', 'type']; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GPX.LINK_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'text': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode) - }); - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.GPX.RTE_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, [ - 'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'rtept' - ]); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GPX.RTE_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_), - 'number': ol.xml.makeChildAppender( - ol.format.XSD.writeNonNegativeIntegerTextNode), - 'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'rtept': ol.xml.makeArraySerializer(ol.xml.makeChildAppender( - ol.format.GPX.writeWptType_)) - }); - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.GPX.TRK_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, [ - 'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'trkseg' - ]); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GPX.TRK_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_), - 'number': ol.xml.makeChildAppender( - ol.format.XSD.writeNonNegativeIntegerTextNode), - 'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'trkseg': ol.xml.makeArraySerializer(ol.xml.makeChildAppender( - ol.format.GPX.writeTrkSeg_)) - }); - - -/** - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.GPX.TRKSEG_NODE_FACTORY_ = ol.xml.makeSimpleNodeFactory('trkpt'); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GPX.TRKSEG_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'trkpt': ol.xml.makeChildAppender(ol.format.GPX.writeWptType_) - }); - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.GPX.WPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, [ - 'ele', 'time', 'magvar', 'geoidheight', 'name', 'cmt', 'desc', 'src', - 'link', 'sym', 'type', 'fix', 'sat', 'hdop', 'vdop', 'pdop', - 'ageofdgpsdata', 'dgpsid' - ]); - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GPX.WPT_TYPE_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'ele': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'time': ol.xml.makeChildAppender(ol.format.XSD.writeDateTimeTextNode), - 'magvar': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'geoidheight': ol.xml.makeChildAppender( - ol.format.XSD.writeDecimalTextNode), - 'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_), - 'sym': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'fix': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'sat': ol.xml.makeChildAppender( - ol.format.XSD.writeNonNegativeIntegerTextNode), - 'hdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'vdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'pdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'ageofdgpsdata': ol.xml.makeChildAppender( - ol.format.XSD.writeDecimalTextNode), - 'dgpsid': ol.xml.makeChildAppender( - ol.format.XSD.writeNonNegativeIntegerTextNode) - }); - - -/** - * @const - * @type {Object.<string, string>} - * @private - */ -ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_ = { - 'Point': 'wpt', - 'LineString': 'rte', - 'MultiLineString': 'trk' -}; - - -/** - * @const - * @param {*} value Value. - * @param {Array.<*>} objectStack Object stack. - * @param {string=} opt_nodeName Node name. - * @return {Node|undefined} Node. - * @private - */ -ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { - goog.asserts.assertInstanceof(value, ol.Feature, - 'value should be an ol.Feature'); - var geometry = value.getGeometry(); - if (geometry) { - var nodeName = ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()]; - if (nodeName) { - var parentNode = objectStack[objectStack.length - 1].node; - goog.asserts.assert(ol.xml.isNode(parentNode), - 'parentNode should be an XML node'); - return ol.xml.createElementNS(parentNode.namespaceURI, nodeName); - } - } -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.GPX.GPX_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.GPX.NAMESPACE_URIS_, { - 'rte': ol.xml.makeChildAppender(ol.format.GPX.writeRte_), - 'trk': ol.xml.makeChildAppender(ol.format.GPX.writeTrk_), - 'wpt': ol.xml.makeChildAppender(ol.format.GPX.writeWpt_) - }); - - -/** - * Encode an array of features in the GPX format. - * - * @function - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} Result. - * @api stable - */ -ol.format.GPX.prototype.writeFeatures; - - -/** - * Encode an array of features in the GPX format as an XML node. - * - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {Node} Node. - * @api - */ -ol.format.GPX.prototype.writeFeaturesNode = function(features, opt_options) { - opt_options = this.adaptOptions(opt_options); - //FIXME Serialize metadata - var gpx = ol.xml.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx'); - - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ - ({node: gpx}), ol.format.GPX.GPX_SERIALIZERS_, - ol.format.GPX.GPX_NODE_FACTORY_, features, [opt_options]); - return gpx; -}; - -// Copyright 2013 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Utilities for string newlines. - * @author nnaze@google.com (Nathan Naze) - */ - - -/** - * Namespace for string utilities - */ -goog.provide('goog.string.newlines'); -goog.provide('goog.string.newlines.Line'); - -goog.require('goog.array'); - - -/** - * Splits a string into lines, properly handling universal newlines. - * @param {string} str String to split. - * @param {boolean=} opt_keepNewlines Whether to keep the newlines in the - * resulting strings. Defaults to false. - * @return {!Array<string>} String split into lines. - */ -goog.string.newlines.splitLines = function(str, opt_keepNewlines) { - var lines = goog.string.newlines.getLines(str); - return goog.array.map(lines, function(line) { - return opt_keepNewlines ? line.getFullLine() : line.getContent(); - }); -}; - - - -/** - * Line metadata class that records the start/end indicies of lines - * in a string. Can be used to implement common newline use cases such as - * splitLines() or determining line/column of an index in a string. - * Also implements methods to get line contents. - * - * Indexes are expressed as string indicies into string.substring(), inclusive - * at the start, exclusive at the end. - * - * Create an array of these with goog.string.newlines.getLines(). - * @param {string} string The original string. - * @param {number} startLineIndex The index of the start of the line. - * @param {number} endContentIndex The index of the end of the line, excluding - * newlines. - * @param {number} endLineIndex The index of the end of the line, index - * newlines. - * @constructor - * @struct - * @final - */ -goog.string.newlines.Line = function(string, startLineIndex, - endContentIndex, endLineIndex) { - /** - * The original string. - * @type {string} - */ - this.string = string; - - /** - * Index of the start of the line. - * @type {number} - */ - this.startLineIndex = startLineIndex; - - /** - * Index of the end of the line, excluding any newline characters. - * Index is the first character after the line, suitable for - * String.substring(). - * @type {number} - */ - this.endContentIndex = endContentIndex; - - /** - * Index of the end of the line, excluding any newline characters. - * Index is the first character after the line, suitable for - * String.substring(). - * @type {number} - */ - - this.endLineIndex = endLineIndex; -}; - - -/** - * @return {string} The content of the line, excluding any newline characters. - */ -goog.string.newlines.Line.prototype.getContent = function() { - return this.string.substring(this.startLineIndex, this.endContentIndex); -}; - - -/** - * @return {string} The full line, including any newline characters. - */ -goog.string.newlines.Line.prototype.getFullLine = function() { - return this.string.substring(this.startLineIndex, this.endLineIndex); -}; - - -/** - * @return {string} The newline characters, if any ('\n', \r', '\r\n', '', etc). - */ -goog.string.newlines.Line.prototype.getNewline = function() { - return this.string.substring(this.endContentIndex, this.endLineIndex); -}; - - -/** - * Splits a string into an array of line metadata. - * @param {string} str String to split. - * @return {!Array<!goog.string.newlines.Line>} Array of line metadata. - */ -goog.string.newlines.getLines = function(str) { - // We use the constructor because literals are evaluated only once in - // < ES 3.1. - // See http://www.mail-archive.com/es-discuss@mozilla.org/msg01796.html - var re = RegExp('\r\n|\r|\n', 'g'); - var sliceIndex = 0; - var result; - var lines = []; - - while (result = re.exec(str)) { - var line = new goog.string.newlines.Line( - str, sliceIndex, result.index, result.index + result[0].length); - lines.push(line); - - // remember where to start the slice from - sliceIndex = re.lastIndex; - } - - // If the string does not end with a newline, add the last line. - if (sliceIndex < str.length) { - var line = new goog.string.newlines.Line( - str, sliceIndex, str.length, str.length); - lines.push(line); - } - - return lines; -}; - -goog.provide('ol.format.TextFeature'); - -goog.require('goog.asserts'); -goog.require('ol.format.Feature'); -goog.require('ol.format.FormatType'); - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Base class for text feature formats. - * - * @constructor - * @extends {ol.format.Feature} - */ -ol.format.TextFeature = function() { - goog.base(this); -}; -goog.inherits(ol.format.TextFeature, ol.format.Feature); - - -/** - * @param {Document|Node|Object|string} source Source. - * @private - * @return {string} Text. - */ -ol.format.TextFeature.prototype.getText_ = function(source) { - if (goog.isString(source)) { - return source; - } else { - goog.asserts.fail(); - return ''; - } -}; - - -/** - * @inheritDoc - */ -ol.format.TextFeature.prototype.getType = function() { - return ol.format.FormatType.TEXT; -}; - - -/** - * @inheritDoc - */ -ol.format.TextFeature.prototype.readFeature = function(source, opt_options) { - return this.readFeatureFromText( - this.getText_(source), this.adaptOptions(opt_options)); -}; - - -/** - * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @protected - * @return {ol.Feature} Feature. - */ -ol.format.TextFeature.prototype.readFeatureFromText = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.TextFeature.prototype.readFeatures = function(source, opt_options) { - return this.readFeaturesFromText( - this.getText_(source), this.adaptOptions(opt_options)); -}; - - -/** - * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @protected - * @return {Array.<ol.Feature>} Features. - */ -ol.format.TextFeature.prototype.readFeaturesFromText = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.TextFeature.prototype.readGeometry = function(source, opt_options) { - return this.readGeometryFromText( - this.getText_(source), this.adaptOptions(opt_options)); -}; - - -/** - * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @protected - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.TextFeature.prototype.readGeometryFromText = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.TextFeature.prototype.readProjection = function(source) { - return this.readProjectionFromText(this.getText_(source)); -}; - - -/** - * @param {string} text Text. - * @protected - * @return {ol.proj.Projection} Projection. - */ -ol.format.TextFeature.prototype.readProjectionFromText = function(text) { - return this.defaultDataProjection; -}; - - -/** - * @inheritDoc - */ -ol.format.TextFeature.prototype.writeFeature = function(feature, opt_options) { - return this.writeFeatureText(feature, this.adaptOptions(opt_options)); -}; - - -/** - * @param {ol.Feature} feature Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @protected - * @return {string} Text. - */ -ol.format.TextFeature.prototype.writeFeatureText = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.TextFeature.prototype.writeFeatures = function( - features, opt_options) { - return this.writeFeaturesText(features, this.adaptOptions(opt_options)); -}; - - -/** - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @protected - * @return {string} Text. - */ -ol.format.TextFeature.prototype.writeFeaturesText = goog.abstractMethod; - - -/** - * @inheritDoc - */ -ol.format.TextFeature.prototype.writeGeometry = function( - geometry, opt_options) { - return this.writeGeometryText(geometry, this.adaptOptions(opt_options)); -}; - - -/** - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @protected - * @return {string} Text. - */ -ol.format.TextFeature.prototype.writeGeometryText = goog.abstractMethod; - -goog.provide('ol.format.IGC'); -goog.provide('ol.format.IGCZ'); - -goog.require('goog.asserts'); -goog.require('goog.string'); -goog.require('goog.string.newlines'); -goog.require('ol.Feature'); -goog.require('ol.format.Feature'); -goog.require('ol.format.TextFeature'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.LineString'); -goog.require('ol.proj'); - - -/** - * IGC altitude/z. One of 'barometric', 'gps', 'none'. - * @enum {string} - * @api - */ -ol.format.IGCZ = { - BAROMETRIC: 'barometric', - GPS: 'gps', - NONE: 'none' -}; - - - -/** - * @classdesc - * Feature format for `*.igc` flight recording files. - * - * @constructor - * @extends {ol.format.TextFeature} - * @param {olx.format.IGCOptions=} opt_options Options. - * @api - */ -ol.format.IGC = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this); - - /** - * @inheritDoc - */ - this.defaultDataProjection = ol.proj.get('EPSG:4326'); - - /** - * @private - * @type {ol.format.IGCZ} - */ - this.altitudeMode_ = options.altitudeMode ? - options.altitudeMode : ol.format.IGCZ.NONE; - -}; -goog.inherits(ol.format.IGC, ol.format.TextFeature); - - -/** - * @const - * @type {Array.<string>} - * @private - */ -ol.format.IGC.EXTENSIONS_ = ['.igc']; - - -/** - * @const - * @type {RegExp} - * @private - */ -ol.format.IGC.B_RECORD_RE_ = - /^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/; - - -/** - * @const - * @type {RegExp} - * @private - */ -ol.format.IGC.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/; - - -/** - * @const - * @type {RegExp} - * @private - */ -ol.format.IGC.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/; - - -/** - * @inheritDoc - */ -ol.format.IGC.prototype.getExtensions = function() { - return ol.format.IGC.EXTENSIONS_; -}; - - -/** - * Read the feature from the IGC source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - * @api - */ -ol.format.IGC.prototype.readFeature; - - -/** - * @inheritDoc - */ -ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) { - var altitudeMode = this.altitudeMode_; - var lines = goog.string.newlines.splitLines(text); - /** @type {Object.<string, string>} */ - var properties = {}; - var flatCoordinates = []; - var year = 2000; - var month = 0; - var day = 1; - var i, ii; - for (i = 0, ii = lines.length; i < ii; ++i) { - var line = lines[i]; - var m; - if (line.charAt(0) == 'B') { - m = ol.format.IGC.B_RECORD_RE_.exec(line); - if (m) { - var hour = parseInt(m[1], 10); - var minute = parseInt(m[2], 10); - var second = parseInt(m[3], 10); - var y = parseInt(m[4], 10) + parseInt(m[5], 10) / 60000; - if (m[6] == 'S') { - y = -y; - } - var x = parseInt(m[7], 10) + parseInt(m[8], 10) / 60000; - if (m[9] == 'W') { - x = -x; - } - flatCoordinates.push(x, y); - if (altitudeMode != ol.format.IGCZ.NONE) { - var z; - if (altitudeMode == ol.format.IGCZ.GPS) { - z = parseInt(m[11], 10); - } else if (altitudeMode == ol.format.IGCZ.BAROMETRIC) { - z = parseInt(m[12], 10); - } else { - goog.asserts.fail(); - z = 0; - } - flatCoordinates.push(z); - } - var dateTime = Date.UTC(year, month, day, hour, minute, second); - flatCoordinates.push(dateTime / 1000); - } - } else if (line.charAt(0) == 'H') { - m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line); - if (m) { - day = parseInt(m[1], 10); - month = parseInt(m[2], 10) - 1; - year = 2000 + parseInt(m[3], 10); - } else { - m = ol.format.IGC.H_RECORD_RE_.exec(line); - if (m) { - properties[m[1]] = m[2].trim(); - m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line); - } - } - } - } - if (flatCoordinates.length === 0) { - return null; - } - var lineString = new ol.geom.LineString(null); - var layout = altitudeMode == ol.format.IGCZ.NONE ? - ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM; - lineString.setFlatCoordinates(layout, flatCoordinates); - var feature = new ol.Feature(ol.format.Feature.transformWithOptions( - lineString, false, opt_options)); - feature.setProperties(properties); - return feature; -}; - - -/** - * Read the feature from the source. As IGC sources contain a single - * feature, this will return the feature in an array. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api - */ -ol.format.IGC.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) { - var feature = this.readFeatureFromText(text, opt_options); - if (feature) { - return [feature]; - } else { - return []; - } -}; - - -/** - * Read the projection from the IGC source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {ol.proj.Projection} Projection. - * @api - */ -ol.format.IGC.prototype.readProjection; - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Class for parsing and formatting URIs. - * - * Use goog.Uri(string) to parse a URI string. Use goog.Uri.create(...) to - * create a new instance of the goog.Uri object from Uri parts. - * - * e.g: <code>var myUri = new goog.Uri(window.location);</code> - * - * Implements RFC 3986 for parsing/formatting URIs. - * http://www.ietf.org/rfc/rfc3986.txt - * - * Some changes have been made to the interface (more like .NETs), though the - * internal representation is now of un-encoded parts, this will change the - * behavior slightly. - * - */ - -goog.provide('goog.Uri'); -goog.provide('goog.Uri.QueryData'); - -goog.require('goog.array'); -goog.require('goog.string'); -goog.require('goog.structs'); -goog.require('goog.structs.Map'); -goog.require('goog.uri.utils'); -goog.require('goog.uri.utils.ComponentIndex'); -goog.require('goog.uri.utils.StandardQueryParam'); - - - -/** - * This class contains setters and getters for the parts of the URI. - * The <code>getXyz</code>/<code>setXyz</code> methods return the decoded part - * -- so<code>goog.Uri.parse('/foo%20bar').getPath()</code> will return the - * decoded path, <code>/foo bar</code>. - * - * Reserved characters (see RFC 3986 section 2.2) can be present in - * their percent-encoded form in scheme, domain, and path URI components and - * will not be auto-decoded. For example: - * <code>goog.Uri.parse('rel%61tive/path%2fto/resource').getPath()</code> will - * return <code>relative/path%2fto/resource</code>. - * - * The constructor accepts an optional unparsed, raw URI string. The parser - * is relaxed, so special characters that aren't escaped but don't cause - * ambiguities will not cause parse failures. - * - * All setters return <code>this</code> and so may be chained, a la - * <code>goog.Uri.parse('/foo').setFragment('part').toString()</code>. - * - * @param {*=} opt_uri Optional string URI to parse - * (use goog.Uri.create() to create a URI from parts), or if - * a goog.Uri is passed, a clone is created. - * @param {boolean=} opt_ignoreCase If true, #getParameterValue will ignore - * the case of the parameter name. - * - * @throws URIError If opt_uri is provided and URI is malformed (that is, - * if decodeURIComponent fails on any of the URI components). - * @constructor - * @struct - */ -goog.Uri = function(opt_uri, opt_ignoreCase) { - /** - * Scheme such as "http". - * @private {string} - */ - this.scheme_ = ''; - - /** - * User credentials in the form "username:password". - * @private {string} - */ - this.userInfo_ = ''; - - /** - * Domain part, e.g. "www.google.com". - * @private {string} - */ - this.domain_ = ''; - - /** - * Port, e.g. 8080. - * @private {?number} - */ - this.port_ = null; - - /** - * Path, e.g. "/tests/img.png". - * @private {string} - */ - this.path_ = ''; - - /** - * The fragment without the #. - * @private {string} - */ - this.fragment_ = ''; - - /** - * Whether or not this Uri should be treated as Read Only. - * @private {boolean} - */ - this.isReadOnly_ = false; - - /** - * Whether or not to ignore case when comparing query params. - * @private {boolean} - */ - this.ignoreCase_ = false; - - /** - * Object representing query data. - * @private {!goog.Uri.QueryData} - */ - this.queryData_; - - // Parse in the uri string - var m; - if (opt_uri instanceof goog.Uri) { - this.ignoreCase_ = goog.isDef(opt_ignoreCase) ? - opt_ignoreCase : opt_uri.getIgnoreCase(); - this.setScheme(opt_uri.getScheme()); - this.setUserInfo(opt_uri.getUserInfo()); - this.setDomain(opt_uri.getDomain()); - this.setPort(opt_uri.getPort()); - this.setPath(opt_uri.getPath()); - this.setQueryData(opt_uri.getQueryData().clone()); - this.setFragment(opt_uri.getFragment()); - } else if (opt_uri && (m = goog.uri.utils.split(String(opt_uri)))) { - this.ignoreCase_ = !!opt_ignoreCase; - - // Set the parts -- decoding as we do so. - // COMPATABILITY NOTE - In IE, unmatched fields may be empty strings, - // whereas in other browsers they will be undefined. - this.setScheme(m[goog.uri.utils.ComponentIndex.SCHEME] || '', true); - this.setUserInfo(m[goog.uri.utils.ComponentIndex.USER_INFO] || '', true); - this.setDomain(m[goog.uri.utils.ComponentIndex.DOMAIN] || '', true); - this.setPort(m[goog.uri.utils.ComponentIndex.PORT]); - this.setPath(m[goog.uri.utils.ComponentIndex.PATH] || '', true); - this.setQueryData(m[goog.uri.utils.ComponentIndex.QUERY_DATA] || '', true); - this.setFragment(m[goog.uri.utils.ComponentIndex.FRAGMENT] || '', true); - - } else { - this.ignoreCase_ = !!opt_ignoreCase; - this.queryData_ = new goog.Uri.QueryData(null, null, this.ignoreCase_); - } -}; - - -/** - * If true, we preserve the type of query parameters set programmatically. - * - * This means that if you set a parameter to a boolean, and then call - * getParameterValue, you will get a boolean back. - * - * If false, we will coerce parameters to strings, just as they would - * appear in real URIs. - * - * TODO(nicksantos): Remove this once people have time to fix all tests. - * - * @type {boolean} - */ -goog.Uri.preserveParameterTypesCompatibilityFlag = false; - - -/** - * Parameter name added to stop caching. - * @type {string} - */ -goog.Uri.RANDOM_PARAM = goog.uri.utils.StandardQueryParam.RANDOM; - - -/** - * @return {string} The string form of the url. - * @override - */ -goog.Uri.prototype.toString = function() { - var out = []; - - var scheme = this.getScheme(); - if (scheme) { - out.push(goog.Uri.encodeSpecialChars_( - scheme, goog.Uri.reDisallowedInSchemeOrUserInfo_, true), ':'); - } - - var domain = this.getDomain(); - if (domain || scheme == 'file') { - out.push('//'); - - var userInfo = this.getUserInfo(); - if (userInfo) { - out.push(goog.Uri.encodeSpecialChars_( - userInfo, goog.Uri.reDisallowedInSchemeOrUserInfo_, true), '@'); - } - - out.push(goog.Uri.removeDoubleEncoding_(goog.string.urlEncode(domain))); - - var port = this.getPort(); - if (port != null) { - out.push(':', String(port)); - } - } - - var path = this.getPath(); - if (path) { - if (this.hasDomain() && path.charAt(0) != '/') { - out.push('/'); - } - out.push(goog.Uri.encodeSpecialChars_( - path, - path.charAt(0) == '/' ? - goog.Uri.reDisallowedInAbsolutePath_ : - goog.Uri.reDisallowedInRelativePath_, - true)); - } - - var query = this.getEncodedQuery(); - if (query) { - out.push('?', query); - } - - var fragment = this.getFragment(); - if (fragment) { - out.push('#', goog.Uri.encodeSpecialChars_( - fragment, goog.Uri.reDisallowedInFragment_)); - } - return out.join(''); -}; - - -/** - * Resolves the given relative URI (a goog.Uri object), using the URI - * represented by this instance as the base URI. - * - * There are several kinds of relative URIs:<br> - * 1. foo - replaces the last part of the path, the whole query and fragment<br> - * 2. /foo - replaces the the path, the query and fragment<br> - * 3. //foo - replaces everything from the domain on. foo is a domain name<br> - * 4. ?foo - replace the query and fragment<br> - * 5. #foo - replace the fragment only - * - * Additionally, if relative URI has a non-empty path, all ".." and "." - * segments will be resolved, as described in RFC 3986. - * - * @param {!goog.Uri} relativeUri The relative URI to resolve. - * @return {!goog.Uri} The resolved URI. - */ -goog.Uri.prototype.resolve = function(relativeUri) { - - var absoluteUri = this.clone(); - - // we satisfy these conditions by looking for the first part of relativeUri - // that is not blank and applying defaults to the rest - - var overridden = relativeUri.hasScheme(); - - if (overridden) { - absoluteUri.setScheme(relativeUri.getScheme()); - } else { - overridden = relativeUri.hasUserInfo(); - } - - if (overridden) { - absoluteUri.setUserInfo(relativeUri.getUserInfo()); - } else { - overridden = relativeUri.hasDomain(); - } - - if (overridden) { - absoluteUri.setDomain(relativeUri.getDomain()); - } else { - overridden = relativeUri.hasPort(); - } - - var path = relativeUri.getPath(); - if (overridden) { - absoluteUri.setPort(relativeUri.getPort()); - } else { - overridden = relativeUri.hasPath(); - if (overridden) { - // resolve path properly - if (path.charAt(0) != '/') { - // path is relative - if (this.hasDomain() && !this.hasPath()) { - // RFC 3986, section 5.2.3, case 1 - path = '/' + path; - } else { - // RFC 3986, section 5.2.3, case 2 - var lastSlashIndex = absoluteUri.getPath().lastIndexOf('/'); - if (lastSlashIndex != -1) { - path = absoluteUri.getPath().substr(0, lastSlashIndex + 1) + path; - } - } - } - path = goog.Uri.removeDotSegments(path); - } - } - - if (overridden) { - absoluteUri.setPath(path); - } else { - overridden = relativeUri.hasQuery(); - } - - if (overridden) { - absoluteUri.setQueryData(relativeUri.getDecodedQuery()); - } else { - overridden = relativeUri.hasFragment(); - } - - if (overridden) { - absoluteUri.setFragment(relativeUri.getFragment()); - } - - return absoluteUri; -}; - - -/** - * Clones the URI instance. - * @return {!goog.Uri} New instance of the URI object. - */ -goog.Uri.prototype.clone = function() { - return new goog.Uri(this); -}; - - -/** - * @return {string} The encoded scheme/protocol for the URI. - */ -goog.Uri.prototype.getScheme = function() { - return this.scheme_; -}; - - -/** - * Sets the scheme/protocol. - * @throws URIError If opt_decode is true and newScheme is malformed (that is, - * if decodeURIComponent fails). - * @param {string} newScheme New scheme value. - * @param {boolean=} opt_decode Optional param for whether to decode new value. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setScheme = function(newScheme, opt_decode) { - this.enforceReadOnly(); - this.scheme_ = opt_decode ? goog.Uri.decodeOrEmpty_(newScheme, true) : - newScheme; - - // remove an : at the end of the scheme so somebody can pass in - // window.location.protocol - if (this.scheme_) { - this.scheme_ = this.scheme_.replace(/:$/, ''); - } - return this; -}; - - -/** - * @return {boolean} Whether the scheme has been set. - */ -goog.Uri.prototype.hasScheme = function() { - return !!this.scheme_; -}; - - -/** - * @return {string} The decoded user info. - */ -goog.Uri.prototype.getUserInfo = function() { - return this.userInfo_; -}; - - -/** - * Sets the userInfo. - * @throws URIError If opt_decode is true and newUserInfo is malformed (that is, - * if decodeURIComponent fails). - * @param {string} newUserInfo New userInfo value. - * @param {boolean=} opt_decode Optional param for whether to decode new value. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setUserInfo = function(newUserInfo, opt_decode) { - this.enforceReadOnly(); - this.userInfo_ = opt_decode ? goog.Uri.decodeOrEmpty_(newUserInfo) : - newUserInfo; - return this; -}; - - -/** - * @return {boolean} Whether the user info has been set. - */ -goog.Uri.prototype.hasUserInfo = function() { - return !!this.userInfo_; -}; - - -/** - * @return {string} The decoded domain. - */ -goog.Uri.prototype.getDomain = function() { - return this.domain_; -}; - - -/** - * Sets the domain. - * @throws URIError If opt_decode is true and newDomain is malformed (that is, - * if decodeURIComponent fails). - * @param {string} newDomain New domain value. - * @param {boolean=} opt_decode Optional param for whether to decode new value. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setDomain = function(newDomain, opt_decode) { - this.enforceReadOnly(); - this.domain_ = opt_decode ? goog.Uri.decodeOrEmpty_(newDomain, true) : - newDomain; - return this; -}; - - -/** - * @return {boolean} Whether the domain has been set. - */ -goog.Uri.prototype.hasDomain = function() { - return !!this.domain_; -}; - - -/** - * @return {?number} The port number. - */ -goog.Uri.prototype.getPort = function() { - return this.port_; -}; - - -/** - * Sets the port number. - * @param {*} newPort Port number. Will be explicitly casted to a number. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setPort = function(newPort) { - this.enforceReadOnly(); - - if (newPort) { - newPort = Number(newPort); - if (isNaN(newPort) || newPort < 0) { - throw Error('Bad port number ' + newPort); - } - this.port_ = newPort; - } else { - this.port_ = null; - } - - return this; -}; - - -/** - * @return {boolean} Whether the port has been set. - */ -goog.Uri.prototype.hasPort = function() { - return this.port_ != null; -}; - - -/** - * @return {string} The decoded path. - */ -goog.Uri.prototype.getPath = function() { - return this.path_; -}; - - -/** - * Sets the path. - * @throws URIError If opt_decode is true and newPath is malformed (that is, - * if decodeURIComponent fails). - * @param {string} newPath New path value. - * @param {boolean=} opt_decode Optional param for whether to decode new value. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setPath = function(newPath, opt_decode) { - this.enforceReadOnly(); - this.path_ = opt_decode ? goog.Uri.decodeOrEmpty_(newPath, true) : newPath; - return this; -}; - - -/** - * @return {boolean} Whether the path has been set. - */ -goog.Uri.prototype.hasPath = function() { - return !!this.path_; -}; - - -/** - * @return {boolean} Whether the query string has been set. - */ -goog.Uri.prototype.hasQuery = function() { - return this.queryData_.toString() !== ''; -}; - - -/** - * Sets the query data. - * @param {goog.Uri.QueryData|string|undefined} queryData QueryData object. - * @param {boolean=} opt_decode Optional param for whether to decode new value. - * Applies only if queryData is a string. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setQueryData = function(queryData, opt_decode) { - this.enforceReadOnly(); - - if (queryData instanceof goog.Uri.QueryData) { - this.queryData_ = queryData; - this.queryData_.setIgnoreCase(this.ignoreCase_); - } else { - if (!opt_decode) { - // QueryData accepts encoded query string, so encode it if - // opt_decode flag is not true. - queryData = goog.Uri.encodeSpecialChars_(queryData, - goog.Uri.reDisallowedInQuery_); - } - this.queryData_ = new goog.Uri.QueryData(queryData, null, this.ignoreCase_); - } - - return this; -}; - - -/** - * Sets the URI query. - * @param {string} newQuery New query value. - * @param {boolean=} opt_decode Optional param for whether to decode new value. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setQuery = function(newQuery, opt_decode) { - return this.setQueryData(newQuery, opt_decode); -}; - - -/** - * @return {string} The encoded URI query, not including the ?. - */ -goog.Uri.prototype.getEncodedQuery = function() { - return this.queryData_.toString(); -}; - - -/** - * @return {string} The decoded URI query, not including the ?. - */ -goog.Uri.prototype.getDecodedQuery = function() { - return this.queryData_.toDecodedString(); -}; - - -/** - * Returns the query data. - * @return {!goog.Uri.QueryData} QueryData object. - */ -goog.Uri.prototype.getQueryData = function() { - return this.queryData_; -}; - - -/** - * @return {string} The encoded URI query, not including the ?. - * - * Warning: This method, unlike other getter methods, returns encoded - * value, instead of decoded one. - */ -goog.Uri.prototype.getQuery = function() { - return this.getEncodedQuery(); -}; - - -/** - * Sets the value of the named query parameters, clearing previous values for - * that key. - * - * @param {string} key The parameter to set. - * @param {*} value The new value. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setParameterValue = function(key, value) { - this.enforceReadOnly(); - this.queryData_.set(key, value); - return this; -}; - - -/** - * Sets the values of the named query parameters, clearing previous values for - * that key. Not new values will currently be moved to the end of the query - * string. - * - * So, <code>goog.Uri.parse('foo?a=b&c=d&e=f').setParameterValues('c', ['new']) - * </code> yields <tt>foo?a=b&e=f&c=new</tt>.</p> - * - * @param {string} key The parameter to set. - * @param {*} values The new values. If values is a single - * string then it will be treated as the sole value. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setParameterValues = function(key, values) { - this.enforceReadOnly(); - - if (!goog.isArray(values)) { - values = [String(values)]; - } - - this.queryData_.setValues(key, values); - - return this; -}; - - -/** - * Returns the value<b>s</b> for a given cgi parameter as a list of decoded - * query parameter values. - * @param {string} name The parameter to get values for. - * @return {!Array<?>} The values for a given cgi parameter as a list of - * decoded query parameter values. - */ -goog.Uri.prototype.getParameterValues = function(name) { - return this.queryData_.getValues(name); -}; - - -/** - * Returns the first value for a given cgi parameter or undefined if the given - * parameter name does not appear in the query string. - * @param {string} paramName Unescaped parameter name. - * @return {string|undefined} The first value for a given cgi parameter or - * undefined if the given parameter name does not appear in the query - * string. - */ -goog.Uri.prototype.getParameterValue = function(paramName) { - // NOTE(nicksantos): This type-cast is a lie when - // preserveParameterTypesCompatibilityFlag is set to true. - // But this should only be set to true in tests. - return /** @type {string|undefined} */ (this.queryData_.get(paramName)); -}; - - -/** - * @return {string} The URI fragment, not including the #. - */ -goog.Uri.prototype.getFragment = function() { - return this.fragment_; -}; - - -/** - * Sets the URI fragment. - * @throws URIError If opt_decode is true and newFragment is malformed (that is, - * if decodeURIComponent fails). - * @param {string} newFragment New fragment value. - * @param {boolean=} opt_decode Optional param for whether to decode new value. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.setFragment = function(newFragment, opt_decode) { - this.enforceReadOnly(); - this.fragment_ = opt_decode ? goog.Uri.decodeOrEmpty_(newFragment) : - newFragment; - return this; -}; - - -/** - * @return {boolean} Whether the URI has a fragment set. - */ -goog.Uri.prototype.hasFragment = function() { - return !!this.fragment_; -}; - - -/** - * Returns true if this has the same domain as that of uri2. - * @param {!goog.Uri} uri2 The URI object to compare to. - * @return {boolean} true if same domain; false otherwise. - */ -goog.Uri.prototype.hasSameDomainAs = function(uri2) { - return ((!this.hasDomain() && !uri2.hasDomain()) || - this.getDomain() == uri2.getDomain()) && - ((!this.hasPort() && !uri2.hasPort()) || - this.getPort() == uri2.getPort()); -}; - - -/** - * Adds a random parameter to the Uri. - * @return {!goog.Uri} Reference to this Uri object. - */ -goog.Uri.prototype.makeUnique = function() { - this.enforceReadOnly(); - this.setParameterValue(goog.Uri.RANDOM_PARAM, goog.string.getRandomString()); - - return this; -}; - - -/** - * Removes the named query parameter. - * - * @param {string} key The parameter to remove. - * @return {!goog.Uri} Reference to this URI object. - */ -goog.Uri.prototype.removeParameter = function(key) { - this.enforceReadOnly(); - this.queryData_.remove(key); - return this; -}; - - -/** - * Sets whether Uri is read only. If this goog.Uri is read-only, - * enforceReadOnly_ will be called at the start of any function that may modify - * this Uri. - * @param {boolean} isReadOnly whether this goog.Uri should be read only. - * @return {!goog.Uri} Reference to this Uri object. - */ -goog.Uri.prototype.setReadOnly = function(isReadOnly) { - this.isReadOnly_ = isReadOnly; - return this; -}; - - -/** - * @return {boolean} Whether the URI is read only. - */ -goog.Uri.prototype.isReadOnly = function() { - return this.isReadOnly_; -}; - - -/** - * Checks if this Uri has been marked as read only, and if so, throws an error. - * This should be called whenever any modifying function is called. - */ -goog.Uri.prototype.enforceReadOnly = function() { - if (this.isReadOnly_) { - throw Error('Tried to modify a read-only Uri'); - } -}; - - -/** - * Sets whether to ignore case. - * NOTE: If there are already key/value pairs in the QueryData, and - * ignoreCase_ is set to false, the keys will all be lower-cased. - * @param {boolean} ignoreCase whether this goog.Uri should ignore case. - * @return {!goog.Uri} Reference to this Uri object. - */ -goog.Uri.prototype.setIgnoreCase = function(ignoreCase) { - this.ignoreCase_ = ignoreCase; - if (this.queryData_) { - this.queryData_.setIgnoreCase(ignoreCase); - } - return this; -}; - - -/** - * @return {boolean} Whether to ignore case. - */ -goog.Uri.prototype.getIgnoreCase = function() { - return this.ignoreCase_; -}; - - -//============================================================================== -// Static members -//============================================================================== - - -/** - * Creates a uri from the string form. Basically an alias of new goog.Uri(). - * If a Uri object is passed to parse then it will return a clone of the object. - * - * @throws URIError If parsing the URI is malformed. The passed URI components - * should all be parseable by decodeURIComponent. - * @param {*} uri Raw URI string or instance of Uri - * object. - * @param {boolean=} opt_ignoreCase Whether to ignore the case of parameter - * names in #getParameterValue. - * @return {!goog.Uri} The new URI object. - */ -goog.Uri.parse = function(uri, opt_ignoreCase) { - return uri instanceof goog.Uri ? - uri.clone() : new goog.Uri(uri, opt_ignoreCase); -}; - - -/** - * Creates a new goog.Uri object from unencoded parts. - * - * @param {?string=} opt_scheme Scheme/protocol or full URI to parse. - * @param {?string=} opt_userInfo username:password. - * @param {?string=} opt_domain www.google.com. - * @param {?number=} opt_port 9830. - * @param {?string=} opt_path /some/path/to/a/file.html. - * @param {string|goog.Uri.QueryData=} opt_query a=1&b=2. - * @param {?string=} opt_fragment The fragment without the #. - * @param {boolean=} opt_ignoreCase Whether to ignore parameter name case in - * #getParameterValue. - * - * @return {!goog.Uri} The new URI object. - */ -goog.Uri.create = function(opt_scheme, opt_userInfo, opt_domain, opt_port, - opt_path, opt_query, opt_fragment, opt_ignoreCase) { - - var uri = new goog.Uri(null, opt_ignoreCase); - - // Only set the parts if they are defined and not empty strings. - opt_scheme && uri.setScheme(opt_scheme); - opt_userInfo && uri.setUserInfo(opt_userInfo); - opt_domain && uri.setDomain(opt_domain); - opt_port && uri.setPort(opt_port); - opt_path && uri.setPath(opt_path); - opt_query && uri.setQueryData(opt_query); - opt_fragment && uri.setFragment(opt_fragment); - - return uri; -}; - - -/** - * Resolves a relative Uri against a base Uri, accepting both strings and - * Uri objects. - * - * @param {*} base Base Uri. - * @param {*} rel Relative Uri. - * @return {!goog.Uri} Resolved uri. - */ -goog.Uri.resolve = function(base, rel) { - if (!(base instanceof goog.Uri)) { - base = goog.Uri.parse(base); - } - - if (!(rel instanceof goog.Uri)) { - rel = goog.Uri.parse(rel); - } - - return base.resolve(rel); -}; - - -/** - * Removes dot segments in given path component, as described in - * RFC 3986, section 5.2.4. - * - * @param {string} path A non-empty path component. - * @return {string} Path component with removed dot segments. - */ -goog.Uri.removeDotSegments = function(path) { - if (path == '..' || path == '.') { - return ''; - - } else if (!goog.string.contains(path, './') && - !goog.string.contains(path, '/.')) { - // This optimization detects uris which do not contain dot-segments, - // and as a consequence do not require any processing. - return path; - - } else { - var leadingSlash = goog.string.startsWith(path, '/'); - var segments = path.split('/'); - var out = []; - - for (var pos = 0; pos < segments.length; ) { - var segment = segments[pos++]; - - if (segment == '.') { - if (leadingSlash && pos == segments.length) { - out.push(''); - } - } else if (segment == '..') { - if (out.length > 1 || out.length == 1 && out[0] != '') { - out.pop(); - } - if (leadingSlash && pos == segments.length) { - out.push(''); - } - } else { - out.push(segment); - leadingSlash = true; - } - } - - return out.join('/'); - } -}; - - -/** - * Decodes a value or returns the empty string if it isn't defined or empty. - * @throws URIError If decodeURIComponent fails to decode val. - * @param {string|undefined} val Value to decode. - * @param {boolean=} opt_preserveReserved If true, restricted characters will - * not be decoded. - * @return {string} Decoded value. - * @private - */ -goog.Uri.decodeOrEmpty_ = function(val, opt_preserveReserved) { - // Don't use UrlDecode() here because val is not a query parameter. - if (!val) { - return ''; - } - - // decodeURI has the same output for '%2f' and '%252f'. We double encode %25 - // so that we can distinguish between the 2 inputs. This is later undone by - // removeDoubleEncoding_. - return opt_preserveReserved ? - decodeURI(val.replace(/%25/g, '%2525')) : decodeURIComponent(val); -}; - - -/** - * If unescapedPart is non null, then escapes any characters in it that aren't - * valid characters in a url and also escapes any special characters that - * appear in extra. - * - * @param {*} unescapedPart The string to encode. - * @param {RegExp} extra A character set of characters in [\01-\177]. - * @param {boolean=} opt_removeDoubleEncoding If true, remove double percent - * encoding. - * @return {?string} null iff unescapedPart == null. - * @private - */ -goog.Uri.encodeSpecialChars_ = function(unescapedPart, extra, - opt_removeDoubleEncoding) { - if (goog.isString(unescapedPart)) { - var encoded = encodeURI(unescapedPart). - replace(extra, goog.Uri.encodeChar_); - if (opt_removeDoubleEncoding) { - // encodeURI double-escapes %XX sequences used to represent restricted - // characters in some URI components, remove the double escaping here. - encoded = goog.Uri.removeDoubleEncoding_(encoded); - } - return encoded; - } - return null; -}; - - -/** - * Converts a character in [\01-\177] to its unicode character equivalent. - * @param {string} ch One character string. - * @return {string} Encoded string. - * @private - */ -goog.Uri.encodeChar_ = function(ch) { - var n = ch.charCodeAt(0); - return '%' + ((n >> 4) & 0xf).toString(16) + (n & 0xf).toString(16); -}; - - -/** - * Removes double percent-encoding from a string. - * @param {string} doubleEncodedString String - * @return {string} String with double encoding removed. - * @private - */ -goog.Uri.removeDoubleEncoding_ = function(doubleEncodedString) { - return doubleEncodedString.replace(/%25([0-9a-fA-F]{2})/g, '%$1'); -}; - - -/** - * Regular expression for characters that are disallowed in the scheme or - * userInfo part of the URI. - * @type {RegExp} - * @private - */ -goog.Uri.reDisallowedInSchemeOrUserInfo_ = /[#\/\?@]/g; - - -/** - * Regular expression for characters that are disallowed in a relative path. - * Colon is included due to RFC 3986 3.3. - * @type {RegExp} - * @private - */ -goog.Uri.reDisallowedInRelativePath_ = /[\#\?:]/g; - - -/** - * Regular expression for characters that are disallowed in an absolute path. - * @type {RegExp} - * @private - */ -goog.Uri.reDisallowedInAbsolutePath_ = /[\#\?]/g; - - -/** - * Regular expression for characters that are disallowed in the query. - * @type {RegExp} - * @private - */ -goog.Uri.reDisallowedInQuery_ = /[\#\?@]/g; - - -/** - * Regular expression for characters that are disallowed in the fragment. - * @type {RegExp} - * @private - */ -goog.Uri.reDisallowedInFragment_ = /#/g; - - -/** - * Checks whether two URIs have the same domain. - * @param {string} uri1String First URI string. - * @param {string} uri2String Second URI string. - * @return {boolean} true if the two URIs have the same domain; false otherwise. - */ -goog.Uri.haveSameDomain = function(uri1String, uri2String) { - // Differs from goog.uri.utils.haveSameDomain, since this ignores scheme. - // TODO(gboyer): Have this just call goog.uri.util.haveSameDomain. - var pieces1 = goog.uri.utils.split(uri1String); - var pieces2 = goog.uri.utils.split(uri2String); - return pieces1[goog.uri.utils.ComponentIndex.DOMAIN] == - pieces2[goog.uri.utils.ComponentIndex.DOMAIN] && - pieces1[goog.uri.utils.ComponentIndex.PORT] == - pieces2[goog.uri.utils.ComponentIndex.PORT]; -}; - - - -/** - * Class used to represent URI query parameters. It is essentially a hash of - * name-value pairs, though a name can be present more than once. - * - * Has the same interface as the collections in goog.structs. - * - * @param {?string=} opt_query Optional encoded query string to parse into - * the object. - * @param {goog.Uri=} opt_uri Optional uri object that should have its - * cache invalidated when this object updates. Deprecated -- this - * is no longer required. - * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter - * name in #get. - * @constructor - * @struct - * @final - */ -goog.Uri.QueryData = function(opt_query, opt_uri, opt_ignoreCase) { - /** - * The map containing name/value or name/array-of-values pairs. - * May be null if it requires parsing from the query string. - * - * We need to use a Map because we cannot guarantee that the key names will - * not be problematic for IE. - * - * @private {goog.structs.Map<string, !Array<*>>} - */ - this.keyMap_ = null; - - /** - * The number of params, or null if it requires computing. - * @private {?number} - */ - this.count_ = null; - - /** - * Encoded query string, or null if it requires computing from the key map. - * @private {?string} - */ - this.encodedQuery_ = opt_query || null; - - /** - * If true, ignore the case of the parameter name in #get. - * @private {boolean} - */ - this.ignoreCase_ = !!opt_ignoreCase; -}; - - -/** - * If the underlying key map is not yet initialized, it parses the - * query string and fills the map with parsed data. - * @private - */ -goog.Uri.QueryData.prototype.ensureKeyMapInitialized_ = function() { - if (!this.keyMap_) { - this.keyMap_ = new goog.structs.Map(); - this.count_ = 0; - if (this.encodedQuery_) { - var self = this; - goog.uri.utils.parseQueryData(this.encodedQuery_, function(name, value) { - self.add(goog.string.urlDecode(name), value); - }); - } - } -}; - - -/** - * Creates a new query data instance from a map of names and values. - * - * @param {!goog.structs.Map<string, ?>|!Object} map Map of string parameter - * names to parameter value. If parameter value is an array, it is - * treated as if the key maps to each individual value in the - * array. - * @param {goog.Uri=} opt_uri URI object that should have its cache - * invalidated when this object updates. - * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter - * name in #get. - * @return {!goog.Uri.QueryData} The populated query data instance. - */ -goog.Uri.QueryData.createFromMap = function(map, opt_uri, opt_ignoreCase) { - var keys = goog.structs.getKeys(map); - if (typeof keys == 'undefined') { - throw Error('Keys are undefined'); - } - - var queryData = new goog.Uri.QueryData(null, null, opt_ignoreCase); - var values = goog.structs.getValues(map); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = values[i]; - if (!goog.isArray(value)) { - queryData.add(key, value); - } else { - queryData.setValues(key, value); - } - } - return queryData; -}; - - -/** - * Creates a new query data instance from parallel arrays of parameter names - * and values. Allows for duplicate parameter names. Throws an error if the - * lengths of the arrays differ. - * - * @param {!Array<string>} keys Parameter names. - * @param {!Array<?>} values Parameter values. - * @param {goog.Uri=} opt_uri URI object that should have its cache - * invalidated when this object updates. - * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter - * name in #get. - * @return {!goog.Uri.QueryData} The populated query data instance. - */ -goog.Uri.QueryData.createFromKeysValues = function( - keys, values, opt_uri, opt_ignoreCase) { - if (keys.length != values.length) { - throw Error('Mismatched lengths for keys/values'); - } - var queryData = new goog.Uri.QueryData(null, null, opt_ignoreCase); - for (var i = 0; i < keys.length; i++) { - queryData.add(keys[i], values[i]); - } - return queryData; -}; - - -/** - * @return {?number} The number of parameters. - */ -goog.Uri.QueryData.prototype.getCount = function() { - this.ensureKeyMapInitialized_(); - return this.count_; -}; - - -/** - * Adds a key value pair. - * @param {string} key Name. - * @param {*} value Value. - * @return {!goog.Uri.QueryData} Instance of this object. - */ -goog.Uri.QueryData.prototype.add = function(key, value) { - this.ensureKeyMapInitialized_(); - this.invalidateCache_(); - - key = this.getKeyName_(key); - var values = this.keyMap_.get(key); - if (!values) { - this.keyMap_.set(key, (values = [])); - } - values.push(value); - this.count_++; - return this; -}; - - -/** - * Removes all the params with the given key. - * @param {string} key Name. - * @return {boolean} Whether any parameter was removed. - */ -goog.Uri.QueryData.prototype.remove = function(key) { - this.ensureKeyMapInitialized_(); - - key = this.getKeyName_(key); - if (this.keyMap_.containsKey(key)) { - this.invalidateCache_(); - - // Decrement parameter count. - this.count_ -= this.keyMap_.get(key).length; - return this.keyMap_.remove(key); - } - return false; -}; - - -/** - * Clears the parameters. - */ -goog.Uri.QueryData.prototype.clear = function() { - this.invalidateCache_(); - this.keyMap_ = null; - this.count_ = 0; -}; - - -/** - * @return {boolean} Whether we have any parameters. - */ -goog.Uri.QueryData.prototype.isEmpty = function() { - this.ensureKeyMapInitialized_(); - return this.count_ == 0; -}; - - -/** - * Whether there is a parameter with the given name - * @param {string} key The parameter name to check for. - * @return {boolean} Whether there is a parameter with the given name. - */ -goog.Uri.QueryData.prototype.containsKey = function(key) { - this.ensureKeyMapInitialized_(); - key = this.getKeyName_(key); - return this.keyMap_.containsKey(key); -}; - - -/** - * Whether there is a parameter with the given value. - * @param {*} value The value to check for. - * @return {boolean} Whether there is a parameter with the given value. - */ -goog.Uri.QueryData.prototype.containsValue = function(value) { - // NOTE(arv): This solution goes through all the params even if it was the - // first param. We can get around this by not reusing code or by switching to - // iterators. - var vals = this.getValues(); - return goog.array.contains(vals, value); -}; - - -/** - * Returns all the keys of the parameters. If a key is used multiple times - * it will be included multiple times in the returned array - * @return {!Array<string>} All the keys of the parameters. - */ -goog.Uri.QueryData.prototype.getKeys = function() { - this.ensureKeyMapInitialized_(); - // We need to get the values to know how many keys to add. - var vals = /** @type {!Array<*>} */ (this.keyMap_.getValues()); - var keys = this.keyMap_.getKeys(); - var rv = []; - for (var i = 0; i < keys.length; i++) { - var val = vals[i]; - for (var j = 0; j < val.length; j++) { - rv.push(keys[i]); - } - } - return rv; -}; - - -/** - * Returns all the values of the parameters with the given name. If the query - * data has no such key this will return an empty array. If no key is given - * all values wil be returned. - * @param {string=} opt_key The name of the parameter to get the values for. - * @return {!Array<?>} All the values of the parameters with the given name. - */ -goog.Uri.QueryData.prototype.getValues = function(opt_key) { - this.ensureKeyMapInitialized_(); - var rv = []; - if (goog.isString(opt_key)) { - if (this.containsKey(opt_key)) { - rv = goog.array.concat(rv, this.keyMap_.get(this.getKeyName_(opt_key))); - } - } else { - // Return all values. - var values = this.keyMap_.getValues(); - for (var i = 0; i < values.length; i++) { - rv = goog.array.concat(rv, values[i]); - } - } - return rv; -}; - - -/** - * Sets a key value pair and removes all other keys with the same value. - * - * @param {string} key Name. - * @param {*} value Value. - * @return {!goog.Uri.QueryData} Instance of this object. - */ -goog.Uri.QueryData.prototype.set = function(key, value) { - this.ensureKeyMapInitialized_(); - this.invalidateCache_(); - - // TODO(chrishenry): This could be better written as - // this.remove(key), this.add(key, value), but that would reorder - // the key (since the key is first removed and then added at the - // end) and we would have to fix unit tests that depend on key - // ordering. - key = this.getKeyName_(key); - if (this.containsKey(key)) { - this.count_ -= this.keyMap_.get(key).length; - } - this.keyMap_.set(key, [value]); - this.count_++; - return this; -}; - - -/** - * Returns the first value associated with the key. If the query data has no - * such key this will return undefined or the optional default. - * @param {string} key The name of the parameter to get the value for. - * @param {*=} opt_default The default value to return if the query data - * has no such key. - * @return {*} The first string value associated with the key, or opt_default - * if there's no value. - */ -goog.Uri.QueryData.prototype.get = function(key, opt_default) { - var values = key ? this.getValues(key) : []; - if (goog.Uri.preserveParameterTypesCompatibilityFlag) { - return values.length > 0 ? values[0] : opt_default; - } else { - return values.length > 0 ? String(values[0]) : opt_default; - } -}; - - -/** - * Sets the values for a key. If the key already exists, this will - * override all of the existing values that correspond to the key. - * @param {string} key The key to set values for. - * @param {!Array<?>} values The values to set. - */ -goog.Uri.QueryData.prototype.setValues = function(key, values) { - this.remove(key); - - if (values.length > 0) { - this.invalidateCache_(); - this.keyMap_.set(this.getKeyName_(key), goog.array.clone(values)); - this.count_ += values.length; - } -}; - - -/** - * @return {string} Encoded query string. - * @override - */ -goog.Uri.QueryData.prototype.toString = function() { - if (this.encodedQuery_) { - return this.encodedQuery_; - } - - if (!this.keyMap_) { - return ''; - } - - var sb = []; - - // In the past, we use this.getKeys() and this.getVals(), but that - // generates a lot of allocations as compared to simply iterating - // over the keys. - var keys = this.keyMap_.getKeys(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var encodedKey = goog.string.urlEncode(key); - var val = this.getValues(key); - for (var j = 0; j < val.length; j++) { - var param = encodedKey; - // Ensure that null and undefined are encoded into the url as - // literal strings. - if (val[j] !== '') { - param += '=' + goog.string.urlEncode(val[j]); - } - sb.push(param); - } - } - - return this.encodedQuery_ = sb.join('&'); -}; - - -/** - * @throws URIError If URI is malformed (that is, if decodeURIComponent fails on - * any of the URI components). - * @return {string} Decoded query string. - */ -goog.Uri.QueryData.prototype.toDecodedString = function() { - return goog.Uri.decodeOrEmpty_(this.toString()); -}; - - -/** - * Invalidate the cache. - * @private - */ -goog.Uri.QueryData.prototype.invalidateCache_ = function() { - this.encodedQuery_ = null; -}; - - -/** - * Removes all keys that are not in the provided list. (Modifies this object.) - * @param {Array<string>} keys The desired keys. - * @return {!goog.Uri.QueryData} a reference to this object. - */ -goog.Uri.QueryData.prototype.filterKeys = function(keys) { - this.ensureKeyMapInitialized_(); - this.keyMap_.forEach( - function(value, key) { - if (!goog.array.contains(keys, key)) { - this.remove(key); - } - }, this); - return this; -}; - - -/** - * Clone the query data instance. - * @return {!goog.Uri.QueryData} New instance of the QueryData object. - */ -goog.Uri.QueryData.prototype.clone = function() { - var rv = new goog.Uri.QueryData(); - rv.encodedQuery_ = this.encodedQuery_; - if (this.keyMap_) { - rv.keyMap_ = this.keyMap_.clone(); - rv.count_ = this.count_; - } - return rv; -}; - - -/** - * Helper function to get the key name from a JavaScript object. Converts - * the object to a string, and to lower case if necessary. - * @private - * @param {*} arg The object to get a key name from. - * @return {string} valid key name which can be looked up in #keyMap_. - */ -goog.Uri.QueryData.prototype.getKeyName_ = function(arg) { - var keyName = String(arg); - if (this.ignoreCase_) { - keyName = keyName.toLowerCase(); - } - return keyName; -}; - - -/** - * Ignore case in parameter names. - * NOTE: If there are already key/value pairs in the QueryData, and - * ignoreCase_ is set to false, the keys will all be lower-cased. - * @param {boolean} ignoreCase whether this goog.Uri should ignore case. - */ -goog.Uri.QueryData.prototype.setIgnoreCase = function(ignoreCase) { - var resetKeys = ignoreCase && !this.ignoreCase_; - if (resetKeys) { - this.ensureKeyMapInitialized_(); - this.invalidateCache_(); - this.keyMap_.forEach( - function(value, key) { - var lowerCase = key.toLowerCase(); - if (key != lowerCase) { - this.remove(key); - this.setValues(lowerCase, value); - } - }, this); - } - this.ignoreCase_ = ignoreCase; -}; - - -/** - * Extends a query data object with another query data or map like object. This - * operates 'in-place', it does not create a new QueryData object. - * - * @param {...(goog.Uri.QueryData|goog.structs.Map<?, ?>|Object)} var_args - * The object from which key value pairs will be copied. - */ -goog.Uri.QueryData.prototype.extend = function(var_args) { - for (var i = 0; i < arguments.length; i++) { - var data = arguments[i]; - goog.structs.forEach(data, - /** @this {goog.Uri.QueryData} */ - function(value, key) { - this.add(key, value); - }, this); - } -}; - -goog.provide('ol.style.Text'); - - -goog.require('ol.style.Fill'); - - - -/** - * @classdesc - * Set text style for vector features. - * - * @constructor - * @param {olx.style.TextOptions=} opt_options Options. - * @api - */ -ol.style.Text = function(opt_options) { - - var options = opt_options || {}; - - /** - * @private - * @type {string|undefined} - */ - this.font_ = options.font; - - /** - * @private - * @type {number|undefined} - */ - this.rotation_ = options.rotation; - - /** - * @private - * @type {number|undefined} - */ - this.scale_ = options.scale; - - /** - * @private - * @type {string|undefined} - */ - this.text_ = options.text; - - /** - * @private - * @type {string|undefined} - */ - this.textAlign_ = options.textAlign; - - /** - * @private - * @type {string|undefined} - */ - this.textBaseline_ = options.textBaseline; - - /** - * @private - * @type {ol.style.Fill} - */ - this.fill_ = options.fill !== undefined ? options.fill : - new ol.style.Fill({color: ol.style.Text.DEFAULT_FILL_COLOR_}); - - /** - * @private - * @type {ol.style.Stroke} - */ - this.stroke_ = options.stroke !== undefined ? options.stroke : null; - - /** - * @private - * @type {number} - */ - this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0; - - /** - * @private - * @type {number} - */ - this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0; -}; - - -/** - * The default fill color to use if no fill was set at construction time; a - * blackish `#333`. - * - * @const {string} - * @private - */ -ol.style.Text.DEFAULT_FILL_COLOR_ = '#333'; - - -/** - * Get the font name. - * @return {string|undefined} Font. - * @api - */ -ol.style.Text.prototype.getFont = function() { - return this.font_; -}; - - -/** - * Get the x-offset for the text. - * @return {number} Horizontal text offset. - * @api - */ -ol.style.Text.prototype.getOffsetX = function() { - return this.offsetX_; -}; - - -/** - * Get the y-offset for the text. - * @return {number} Vertical text offset. - * @api - */ -ol.style.Text.prototype.getOffsetY = function() { - return this.offsetY_; -}; - - -/** - * Get the fill style for the text. - * @return {ol.style.Fill} Fill style. - * @api - */ -ol.style.Text.prototype.getFill = function() { - return this.fill_; -}; - - -/** - * Get the text rotation. - * @return {number|undefined} Rotation. - * @api - */ -ol.style.Text.prototype.getRotation = function() { - return this.rotation_; -}; - - -/** - * Get the text scale. - * @return {number|undefined} Scale. - * @api - */ -ol.style.Text.prototype.getScale = function() { - return this.scale_; -}; - - -/** - * Get the stroke style for the text. - * @return {ol.style.Stroke} Stroke style. - * @api - */ -ol.style.Text.prototype.getStroke = function() { - return this.stroke_; -}; - - -/** - * Get the text to be rendered. - * @return {string|undefined} Text. - * @api - */ -ol.style.Text.prototype.getText = function() { - return this.text_; -}; - - -/** - * Get the text alignment. - * @return {string|undefined} Text align. - * @api - */ -ol.style.Text.prototype.getTextAlign = function() { - return this.textAlign_; -}; - - -/** - * Get the text baseline. - * @return {string|undefined} Text baseline. - * @api - */ -ol.style.Text.prototype.getTextBaseline = function() { - return this.textBaseline_; -}; - - -/** - * Set the font. - * - * @param {string|undefined} font Font. - * @api - */ -ol.style.Text.prototype.setFont = function(font) { - this.font_ = font; -}; - - -/** - * Set the x offset. - * - * @param {number} offsetX Horizontal text offset. - * @api - */ -ol.style.Text.prototype.setOffsetX = function(offsetX) { - this.offsetX_ = offsetX; -}; - - -/** - * Set the y offset. - * - * @param {number} offsetY Vertical text offset. - * @api - */ -ol.style.Text.prototype.setOffsetY = function(offsetY) { - this.offsetY_ = offsetY; -}; - - -/** - * Set the fill. - * - * @param {ol.style.Fill} fill Fill style. - * @api - */ -ol.style.Text.prototype.setFill = function(fill) { - this.fill_ = fill; -}; - - -/** - * Set the rotation. - * - * @param {number|undefined} rotation Rotation. - * @api - */ -ol.style.Text.prototype.setRotation = function(rotation) { - this.rotation_ = rotation; -}; - - -/** - * Set the scale. - * - * @param {number|undefined} scale Scale. - * @api - */ -ol.style.Text.prototype.setScale = function(scale) { - this.scale_ = scale; -}; - - -/** - * Set the stroke. - * - * @param {ol.style.Stroke} stroke Stroke style. - * @api - */ -ol.style.Text.prototype.setStroke = function(stroke) { - this.stroke_ = stroke; -}; - - -/** - * Set the text. - * - * @param {string|undefined} text Text. - * @api - */ -ol.style.Text.prototype.setText = function(text) { - this.text_ = text; -}; - - -/** - * Set the text alignment. - * - * @param {string|undefined} textAlign Text align. - * @api - */ -ol.style.Text.prototype.setTextAlign = function(textAlign) { - this.textAlign_ = textAlign; -}; - - -/** - * Set the text baseline. - * - * @param {string|undefined} textBaseline Text baseline. - * @api - */ -ol.style.Text.prototype.setTextBaseline = function(textBaseline) { - this.textBaseline_ = textBaseline; -}; - -// FIXME http://earth.google.com/kml/1.0 namespace? -// FIXME why does node.getAttribute return an unknown type? -// FIXME text -// FIXME serialize arbitrary feature properties -// FIXME don't parse style if extractStyles is false - -goog.provide('ol.format.KML'); - -goog.require('goog.Uri'); -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Feature'); -goog.require('ol.FeatureStyleFunction'); -goog.require('ol.array'); -goog.require('ol.color'); -goog.require('ol.format.Feature'); -goog.require('ol.format.XMLFeature'); -goog.require('ol.format.XSD'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryCollection'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.LinearRing'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.math'); -goog.require('ol.proj'); -goog.require('ol.style.Fill'); -goog.require('ol.style.Icon'); -goog.require('ol.style.IconAnchorUnits'); -goog.require('ol.style.IconOrigin'); -goog.require('ol.style.Image'); -goog.require('ol.style.Stroke'); -goog.require('ol.style.Style'); -goog.require('ol.style.Text'); -goog.require('ol.xml'); - - -/** - * @typedef {{x: number, xunits: (ol.style.IconAnchorUnits|undefined), - * y: number, yunits: (ol.style.IconAnchorUnits|undefined)}} - */ -ol.format.KMLVec2_; - - -/** - * @typedef {{flatCoordinates: Array.<number>, - * whens: Array.<number>}} - */ -ol.format.KMLGxTrackObject_; - - - -/** - * @classdesc - * Feature format for reading and writing data in the KML format. - * - * @constructor - * @extends {ol.format.XMLFeature} - * @param {olx.format.KMLOptions=} opt_options Options. - * @api stable - */ -ol.format.KML = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this); - - /** - * @inheritDoc - */ - this.defaultDataProjection = ol.proj.get('EPSG:4326'); - - /** - * @private - * @type {Array.<ol.style.Style>} - */ - this.defaultStyle_ = options.defaultStyle ? - options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_; - - /** - * @private - * @type {boolean} - */ - this.extractStyles_ = options.extractStyles !== undefined ? - options.extractStyles : true; - - /** - * @private - * @type {boolean} - */ - this.writeStyles_ = options.writeStyles !== undefined ? - options.writeStyles : true; - - /** - * @private - * @type {Object.<string, (Array.<ol.style.Style>|string)>} - */ - this.sharedStyles_ = {}; - - /** - * @private - * @type {boolean} - */ - this.showPointNames_ = options.showPointNames !== undefined ? - options.showPointNames : true; - -}; -goog.inherits(ol.format.KML, ol.format.XMLFeature); - - -/** - * @const - * @type {Array.<string>} - * @private - */ -ol.format.KML.EXTENSIONS_ = ['.kml']; - - -/** - * @const - * @type {Array.<string>} - * @private - */ -ol.format.KML.GX_NAMESPACE_URIS_ = [ - 'http://www.google.com/kml/ext/2.2' -]; - - -/** - * @const - * @type {Array.<string>} - * @private - */ -ol.format.KML.NAMESPACE_URIS_ = [ - null, - 'http://earth.google.com/kml/2.0', - 'http://earth.google.com/kml/2.1', - 'http://earth.google.com/kml/2.2', - 'http://www.opengis.net/kml/2.2' -]; - - -/** - * @const - * @type {string} - * @private - */ -ol.format.KML.SCHEMA_LOCATION_ = 'http://www.opengis.net/kml/2.2 ' + - 'https://developers.google.com/kml/schema/kml22gx.xsd'; - - -/** - * @const - * @type {ol.Color} - * @private - */ -ol.format.KML.DEFAULT_COLOR_ = [255, 255, 255, 1]; - - -/** - * @const - * @type {ol.style.Fill} - * @private - */ -ol.format.KML.DEFAULT_FILL_STYLE_ = new ol.style.Fill({ - color: ol.format.KML.DEFAULT_COLOR_ -}); - - -/** - * @const - * @type {ol.Size} - * @private - */ -ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_ = [20, 2]; // FIXME maybe [8, 32] ? - - -/** - * @const - * @type {ol.style.IconAnchorUnits} - * @private - */ -ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ = - ol.style.IconAnchorUnits.PIXELS; - - -/** - * @const - * @type {ol.style.IconAnchorUnits} - * @private - */ -ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ = - ol.style.IconAnchorUnits.PIXELS; - - -/** - * @const - * @type {ol.Size} - * @private - */ -ol.format.KML.DEFAULT_IMAGE_STYLE_SIZE_ = [64, 64]; - - -/** - * @const - * @type {string} - * @private - */ -ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_ = - 'https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png'; - - -/** - * @const - * @type {number} - * @private - */ -ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_ = 0.5; - - -/** - * @const - * @type {ol.style.Image} - * @private - */ -ol.format.KML.DEFAULT_IMAGE_STYLE_ = new ol.style.Icon({ - anchor: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_, - anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT, - anchorXUnits: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_, - anchorYUnits: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_, - crossOrigin: 'anonymous', - rotation: 0, - scale: ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_, - size: ol.format.KML.DEFAULT_IMAGE_STYLE_SIZE_, - src: ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_ -}); - - -/** - * @const - * @type {ol.style.Stroke} - * @private - */ -ol.format.KML.DEFAULT_STROKE_STYLE_ = new ol.style.Stroke({ - color: ol.format.KML.DEFAULT_COLOR_, - width: 1 -}); - - -/** - * @const - * @type {ol.style.Stroke} - * @private - */ -ol.format.KML.DEFAULT_TEXT_STROKE_STYLE_ = new ol.style.Stroke({ - color: [51, 51, 51, 1], - width: 2 -}); - - -/** - * @const - * @type {ol.style.Text} - * @private - */ -ol.format.KML.DEFAULT_TEXT_STYLE_ = new ol.style.Text({ - font: 'bold 16px Helvetica', - fill: ol.format.KML.DEFAULT_FILL_STYLE_, - stroke: ol.format.KML.DEFAULT_TEXT_STROKE_STYLE_, - scale: 0.8 -}); - - -/** - * @const - * @type {ol.style.Style} - * @private - */ -ol.format.KML.DEFAULT_STYLE_ = new ol.style.Style({ - fill: ol.format.KML.DEFAULT_FILL_STYLE_, - image: ol.format.KML.DEFAULT_IMAGE_STYLE_, - text: ol.format.KML.DEFAULT_TEXT_STYLE_, - stroke: ol.format.KML.DEFAULT_STROKE_STYLE_, - zIndex: 0 -}); - - -/** - * @const - * @type {Array.<ol.style.Style>} - * @private - */ -ol.format.KML.DEFAULT_STYLE_ARRAY_ = [ol.format.KML.DEFAULT_STYLE_]; - - -/** - * @const - * @type {Object.<string, ol.style.IconAnchorUnits>} - * @private - */ -ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = { - 'fraction': ol.style.IconAnchorUnits.FRACTION, - 'pixels': ol.style.IconAnchorUnits.PIXELS -}; - - -/** - * @param {ol.style.Style|undefined} foundStyle Style. - * @param {string} name Name. - * @return {ol.style.Style} style Style. - * @private - */ -ol.format.KML.createNameStyleFunction_ = function(foundStyle, name) { - /** @type {?ol.style.Text} */ - var textStyle = null; - var textOffset = [0, 0]; - var textAlign = 'start'; - if (foundStyle.getImage()) { - var imageSize = foundStyle.getImage().getImageSize(); - if (imageSize && imageSize.length == 2) { - // Offset the label to be centered to the right of the icon, if there is - // one. - textOffset[0] = foundStyle.getImage().getScale() * imageSize[0] / 2; - textOffset[1] = -foundStyle.getImage().getScale() * imageSize[1] / 2; - textAlign = 'left'; - } - } - if (!goog.object.isEmpty(foundStyle.getText())) { - textStyle = /** @type {ol.style.Text} */ - (goog.object.clone(foundStyle.getText())); - textStyle.setText(name); - textStyle.setTextAlign(textAlign); - textStyle.setOffsetX(textOffset[0]); - textStyle.setOffsetY(textOffset[1]); - } else { - textStyle = new ol.style.Text({ - text: name, - offsetX: textOffset[0], - offsetY: textOffset[1], - textAlign: textAlign - }); - } - var nameStyle = new ol.style.Style({ - text: textStyle - }); - return nameStyle; -}; - - -/** - * @param {Array.<ol.style.Style>|undefined} style Style. - * @param {string} styleUrl Style URL. - * @param {Array.<ol.style.Style>} defaultStyle Default style. - * @param {Object.<string, (Array.<ol.style.Style>|string)>} sharedStyles Shared - * styles. - * @param {boolean|undefined} showPointNames true to show names for point - * placemarks. - * @return {ol.FeatureStyleFunction} Feature style function. - * @private - */ -ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl, - defaultStyle, sharedStyles, showPointNames) { - - return ( - /** - * @param {number} resolution Resolution. - * @return {Array.<ol.style.Style>} Style. - * @this {ol.Feature} - */ - function(resolution) { - var drawName = showPointNames; - /** @type {ol.style.Style|undefined} */ - var nameStyle; - /** @type {string} */ - var name = ''; - if (drawName) { - if (this.getGeometry()) { - drawName = (this.getGeometry().getType() === - ol.geom.GeometryType.POINT); - } - } - - if (drawName) { - name = /** @type {string} */ (this.getProperties()['name']); - drawName = drawName && name; - } - - if (style) { - if (drawName) { - nameStyle = ol.format.KML.createNameStyleFunction_(style[0], - name); - return style.concat(nameStyle); - } - return style; - } - if (styleUrl) { - var foundStyle = ol.format.KML.findStyle_(styleUrl, defaultStyle, - sharedStyles); - if (drawName) { - nameStyle = ol.format.KML.createNameStyleFunction_(foundStyle[0], - name); - return foundStyle.concat(nameStyle); - } - return foundStyle; - } - if (drawName) { - nameStyle = ol.format.KML.createNameStyleFunction_(defaultStyle[0], - name); - return defaultStyle.concat(nameStyle); - } - return defaultStyle; - }); -}; - - -/** - * @param {Array.<ol.style.Style>|string|undefined} styleValue Style value. - * @param {Array.<ol.style.Style>} defaultStyle Default style. - * @param {Object.<string, (Array.<ol.style.Style>|string)>} sharedStyles - * Shared styles. - * @return {Array.<ol.style.Style>} Style. - * @private - */ -ol.format.KML.findStyle_ = function(styleValue, defaultStyle, sharedStyles) { - if (goog.isArray(styleValue)) { - return styleValue; - } else if (goog.isString(styleValue)) { - // KML files in the wild occasionally forget the leading `#` on styleUrls - // defined in the same document. Add a leading `#` if it enables to find - // a style. - if (!(styleValue in sharedStyles) && ('#' + styleValue in sharedStyles)) { - styleValue = '#' + styleValue; - } - return ol.format.KML.findStyle_( - sharedStyles[styleValue], defaultStyle, sharedStyles); - } else { - return defaultStyle; - } -}; - - -/** - * @param {Node} node Node. - * @private - * @return {ol.Color|undefined} Color. - */ -ol.format.KML.readColor_ = function(node) { - var s = ol.xml.getAllTextContent(node, false); - // The KML specification states that colors should not include a leading `#` - // but we tolerate them. - var m = /^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(s); - if (m) { - var hexColor = m[1]; - return [ - parseInt(hexColor.substr(6, 2), 16), - parseInt(hexColor.substr(4, 2), 16), - parseInt(hexColor.substr(2, 2), 16), - parseInt(hexColor.substr(0, 2), 16) / 255 - ]; - - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @private - * @return {Array.<number>|undefined} Flat coordinates. - */ -ol.format.KML.readFlatCoordinates_ = function(node) { - var s = ol.xml.getAllTextContent(node, false); - var flatCoordinates = []; - // The KML specification states that coordinate tuples should not include - // spaces, but we tolerate them. - var re = - /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i; - var m; - while ((m = re.exec(s))) { - var x = parseFloat(m[1]); - var y = parseFloat(m[2]); - var z = m[3] ? parseFloat(m[3]) : 0; - flatCoordinates.push(x, y, z); - s = s.substr(m[0].length); - } - if (s !== '') { - return undefined; - } - return flatCoordinates; -}; - - -/** - * @param {Node} node Node. - * @private - * @return {string|undefined} Style URL. - */ -ol.format.KML.readStyleUrl_ = function(node) { - var s = ol.xml.getAllTextContent(node, false).trim(); - if (node.baseURI) { - return goog.Uri.resolve(node.baseURI, s).toString(); - } else { - return s; - } - -}; - - -/** - * @param {Node} node Node. - * @private - * @return {string} URI. - */ -ol.format.KML.readURI_ = function(node) { - var s = ol.xml.getAllTextContent(node, false); - if (node.baseURI) { - return goog.Uri.resolve(node.baseURI, s.trim()).toString(); - } else { - return s.trim(); - } -}; - - -/** - * @param {Node} node Node. - * @private - * @return {ol.format.KMLVec2_} Vec2. - */ -ol.format.KML.readVec2_ = function(node) { - var xunits = node.getAttribute('xunits'); - var yunits = node.getAttribute('yunits'); - return { - x: parseFloat(node.getAttribute('x')), - xunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[xunits], - y: parseFloat(node.getAttribute('y')), - yunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[yunits] - }; -}; - - -/** - * @param {Node} node Node. - * @private - * @return {number|undefined} Scale. - */ -ol.format.KML.readScale_ = function(node) { - var number = ol.format.XSD.readDecimal(node); - if (number !== undefined) { - return Math.sqrt(number); - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<ol.style.Style>|string|undefined} StyleMap. - */ -ol.format.KML.readStyleMapValue_ = function(node, objectStack) { - return ol.xml.pushParseAndPop( - /** @type {Array.<ol.style.Style>|string|undefined} */ (undefined), - ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.IconStyleParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be an ELEMENT'); - goog.asserts.assert(node.localName == 'IconStyle', - 'localName should be IconStyle'); - // FIXME refreshMode - // FIXME refreshInterval - // FIXME viewRefreshTime - // FIXME viewBoundScale - // FIXME viewFormat - // FIXME httpQuery - var object = ol.xml.pushParseAndPop( - {}, ol.format.KML.ICON_STYLE_PARSERS_, node, objectStack); - if (!object) { - return; - } - var styleObject = /** @type {Object} */ (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isObject(styleObject), - 'styleObject should be an Object'); - var IconObject = 'Icon' in object ? object['Icon'] : {}; - var src; - var href = /** @type {string|undefined} */ - (IconObject['href']); - if (href) { - src = href; - } else { - src = ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_; - } - var anchor, anchorXUnits, anchorYUnits; - var hotSpot = /** @type {ol.format.KMLVec2_|undefined} */ - (object['hotSpot']); - if (hotSpot) { - anchor = [hotSpot.x, hotSpot.y]; - anchorXUnits = hotSpot.xunits; - anchorYUnits = hotSpot.yunits; - } else if (src === ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) { - anchor = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_; - anchorXUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_; - anchorYUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_; - } else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) { - anchor = [0.5, 0]; - anchorXUnits = ol.style.IconAnchorUnits.FRACTION; - anchorYUnits = ol.style.IconAnchorUnits.FRACTION; - } - - var offset; - var x = /** @type {number|undefined} */ - (IconObject['x']); - var y = /** @type {number|undefined} */ - (IconObject['y']); - if (x !== undefined && y !== undefined) { - offset = [x, y]; - } - - var size; - var w = /** @type {number|undefined} */ - (IconObject['w']); - var h = /** @type {number|undefined} */ - (IconObject['h']); - if (w !== undefined && h !== undefined) { - size = [w, h]; - } - - var rotation; - var heading = /** @type {number} */ - (object['heading']); - if (heading !== undefined) { - rotation = ol.math.toRadians(heading); - } - - var scale = /** @type {number|undefined} */ - (object['scale']); - if (src == ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) { - size = ol.format.KML.DEFAULT_IMAGE_STYLE_SIZE_; - if (scale === undefined) { - scale = ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_; - } - } - - var imageStyle = new ol.style.Icon({ - anchor: anchor, - anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT, - anchorXUnits: anchorXUnits, - anchorYUnits: anchorYUnits, - crossOrigin: 'anonymous', // FIXME should this be configurable? - offset: offset, - offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT, - rotation: rotation, - scale: scale, - size: size, - src: src - }); - styleObject['imageStyle'] = imageStyle; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.LabelStyleParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LabelStyle', - 'localName should be LabelStyle'); - // FIXME colorMode - var object = ol.xml.pushParseAndPop( - {}, ol.format.KML.LABEL_STYLE_PARSERS_, node, objectStack); - if (!object) { - return; - } - var styleObject = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(styleObject), - 'styleObject should be an Object'); - var textStyle = new ol.style.Text({ - fill: new ol.style.Fill({ - color: /** @type {ol.Color} */ - ('color' in object ? object['color'] : ol.format.KML.DEFAULT_COLOR_) - }), - scale: /** @type {number|undefined} */ - (object['scale']) - }); - styleObject['textStyle'] = textStyle; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.LineStyleParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LineStyle', - 'localName should be LineStyle'); - // FIXME colorMode - // FIXME gx:outerColor - // FIXME gx:outerWidth - // FIXME gx:physicalWidth - // FIXME gx:labelVisibility - var object = ol.xml.pushParseAndPop( - {}, ol.format.KML.LINE_STYLE_PARSERS_, node, objectStack); - if (!object) { - return; - } - var styleObject = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(styleObject), - 'styleObject should be an Object'); - var strokeStyle = new ol.style.Stroke({ - color: /** @type {ol.Color} */ - ('color' in object ? object['color'] : ol.format.KML.DEFAULT_COLOR_), - width: /** @type {number} */ ('width' in object ? object['width'] : 1) - }); - styleObject['strokeStyle'] = strokeStyle; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.PolyStyleParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'PolyStyle', - 'localName should be PolyStyle'); - // FIXME colorMode - var object = ol.xml.pushParseAndPop( - {}, ol.format.KML.POLY_STYLE_PARSERS_, node, objectStack); - if (!object) { - return; - } - var styleObject = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(styleObject), - 'styleObject should be an Object'); - var fillStyle = new ol.style.Fill({ - color: /** @type {ol.Color} */ - ('color' in object ? object['color'] : ol.format.KML.DEFAULT_COLOR_) - }); - styleObject['fillStyle'] = fillStyle; - var fill = /** @type {boolean|undefined} */ (object['fill']); - if (fill !== undefined) { - styleObject['fill'] = fill; - } - var outline = - /** @type {boolean|undefined} */ (object['outline']); - if (outline !== undefined) { - styleObject['outline'] = outline; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>} LinearRing flat coordinates. - */ -ol.format.KML.readFlatLinearRing_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LinearRing', - 'localName should be LinearRing'); - return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop( - null, ol.format.KML.FLAT_LINEAR_RING_PARSERS_, node, objectStack)); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.gxCoordParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(ol.array.includes( - ol.format.KML.GX_NAMESPACE_URIS_, node.namespaceURI), - 'namespaceURI of the node should be known to the KML parser'); - goog.asserts.assert(node.localName == 'coord', 'localName should be coord'); - var gxTrackObject = /** @type {ol.format.KMLGxTrackObject_} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isObject(gxTrackObject), - 'gxTrackObject should be an Object'); - var flatCoordinates = gxTrackObject.flatCoordinates; - var s = ol.xml.getAllTextContent(node, false); - var re = - /^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i; - var m = re.exec(s); - if (m) { - var x = parseFloat(m[1]); - var y = parseFloat(m[2]); - var z = parseFloat(m[3]); - flatCoordinates.push(x, y, z, 0); - } else { - flatCoordinates.push(0, 0, 0, 0); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.MultiLineString|undefined} MultiLineString. - */ -ol.format.KML.readGxMultiTrack_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(ol.array.includes( - ol.format.KML.GX_NAMESPACE_URIS_, node.namespaceURI), - 'namespaceURI of the node should be known to the KML parser'); - goog.asserts.assert(node.localName == 'MultiTrack', - 'localName should be MultiTrack'); - var lineStrings = ol.xml.pushParseAndPop( - /** @type {Array.<ol.geom.LineString>} */ ([]), - ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_, node, objectStack); - if (!lineStrings) { - return undefined; - } - var multiLineString = new ol.geom.MultiLineString(null); - multiLineString.setLineStrings(lineStrings); - return multiLineString; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.LineString|undefined} LineString. - */ -ol.format.KML.readGxTrack_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(ol.array.includes( - ol.format.KML.GX_NAMESPACE_URIS_, node.namespaceURI), - 'namespaceURI of the node should be known to the KML parser'); - goog.asserts.assert(node.localName == 'Track', 'localName should be Track'); - var gxTrackObject = ol.xml.pushParseAndPop( - /** @type {ol.format.KMLGxTrackObject_} */ ({ - flatCoordinates: [], - whens: [] - }), ol.format.KML.GX_TRACK_PARSERS_, node, objectStack); - if (!gxTrackObject) { - return undefined; - } - var flatCoordinates = gxTrackObject.flatCoordinates; - var whens = gxTrackObject.whens; - goog.asserts.assert(flatCoordinates.length / 4 == whens.length, - 'the length of the flatCoordinates array divided by 4 should be the ' + - 'length of the whens array'); - var i, ii; - for (i = 0, ii = Math.min(flatCoordinates.length, whens.length); i < ii; - ++i) { - flatCoordinates[4 * i + 3] = whens[i]; - } - var lineString = new ol.geom.LineString(null); - lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZM, flatCoordinates); - return lineString; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object} Icon object. - */ -ol.format.KML.readIcon_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Icon', 'localName should be Icon'); - var iconObject = ol.xml.pushParseAndPop( - {}, ol.format.KML.ICON_PARSERS_, node, objectStack); - if (iconObject) { - return iconObject; - } else { - return null; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<number>} Flat coordinates. - */ -ol.format.KML.readFlatCoordinatesFromNode_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(null, - ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack)); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.LineString|undefined} LineString. - */ -ol.format.KML.readLineString_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LineString', - 'localName should be LineString'); - var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}), - ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, - objectStack); - var flatCoordinates = - ol.format.KML.readFlatCoordinatesFromNode_(node, objectStack); - if (flatCoordinates) { - var lineString = new ol.geom.LineString(null); - lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); - lineString.setProperties(properties); - return lineString; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.Polygon|undefined} Polygon. - */ -ol.format.KML.readLinearRing_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'LinearRing', - 'localName should be LinearRing'); - var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}), - ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, - objectStack); - var flatCoordinates = - ol.format.KML.readFlatCoordinatesFromNode_(node, objectStack); - if (flatCoordinates) { - var polygon = new ol.geom.Polygon(null); - polygon.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates, - [flatCoordinates.length]); - polygon.setProperties(properties); - return polygon; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.KML.readMultiGeometry_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'MultiGeometry', - 'localName should be MultiGeometry'); - var geometries = ol.xml.pushParseAndPop( - /** @type {Array.<ol.geom.Geometry>} */ ([]), - ol.format.KML.MULTI_GEOMETRY_PARSERS_, node, objectStack); - if (!geometries) { - return null; - } - if (geometries.length === 0) { - return new ol.geom.GeometryCollection(geometries); - } - var homogeneous = true; - var type = geometries[0].getType(); - var geometry, i, ii; - for (i = 1, ii = geometries.length; i < ii; ++i) { - geometry = geometries[i]; - if (geometry.getType() != type) { - homogeneous = false; - break; - } - } - if (homogeneous) { - /** @type {ol.geom.GeometryLayout} */ - var layout; - /** @type {Array.<number>} */ - var flatCoordinates; - if (type == ol.geom.GeometryType.POINT) { - var point = geometries[0]; - goog.asserts.assertInstanceof(point, ol.geom.Point, - 'point should be an ol.geom.Point'); - layout = point.getLayout(); - flatCoordinates = point.getFlatCoordinates(); - for (i = 1, ii = geometries.length; i < ii; ++i) { - geometry = geometries[i]; - goog.asserts.assertInstanceof(geometry, ol.geom.Point, - 'geometry should be an ol.geom.Point'); - goog.asserts.assert(geometry.getLayout() == layout, - 'geometry layout should be consistent'); - goog.array.extend(flatCoordinates, geometry.getFlatCoordinates()); - } - var multiPoint = new ol.geom.MultiPoint(null); - multiPoint.setFlatCoordinates(layout, flatCoordinates); - ol.format.KML.setCommonGeometryProperties_(multiPoint, geometries); - return multiPoint; - } else if (type == ol.geom.GeometryType.LINE_STRING) { - var multiLineString = new ol.geom.MultiLineString(null); - multiLineString.setLineStrings(geometries); - ol.format.KML.setCommonGeometryProperties_(multiLineString, geometries); - return multiLineString; - } else if (type == ol.geom.GeometryType.POLYGON) { - var multiPolygon = new ol.geom.MultiPolygon(null); - multiPolygon.setPolygons(geometries); - ol.format.KML.setCommonGeometryProperties_(multiPolygon, geometries); - return multiPolygon; - } else if (type == ol.geom.GeometryType.GEOMETRY_COLLECTION) { - return new ol.geom.GeometryCollection(geometries); - } else { - goog.asserts.fail('Unexpected type: ' + type); - return null; - } - } else { - return new ol.geom.GeometryCollection(geometries); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.Point|undefined} Point. - */ -ol.format.KML.readPoint_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Point', 'localName should be Point'); - var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}), - ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, - objectStack); - var flatCoordinates = - ol.format.KML.readFlatCoordinatesFromNode_(node, objectStack); - if (flatCoordinates) { - var point = new ol.geom.Point(null); - goog.asserts.assert(flatCoordinates.length == 3, - 'flatCoordinates should have a length of 3'); - point.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); - point.setProperties(properties); - return point; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.geom.Polygon|undefined} Polygon. - */ -ol.format.KML.readPolygon_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Polygon', - 'localName should be Polygon'); - var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}), - ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, - objectStack); - var flatLinearRings = ol.xml.pushParseAndPop( - /** @type {Array.<Array.<number>>} */ ([null]), - ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack); - if (flatLinearRings && flatLinearRings[0]) { - var polygon = new ol.geom.Polygon(null); - var flatCoordinates = flatLinearRings[0]; - var ends = [flatCoordinates.length]; - var i, ii; - for (i = 1, ii = flatLinearRings.length; i < ii; ++i) { - goog.array.extend(flatCoordinates, flatLinearRings[i]); - ends.push(flatCoordinates.length); - } - polygon.setFlatCoordinates( - ol.geom.GeometryLayout.XYZ, flatCoordinates, ends); - polygon.setProperties(properties); - return polygon; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<ol.style.Style>} Style. - */ -ol.format.KML.readStyle_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Style', 'localName should be Style'); - var styleObject = ol.xml.pushParseAndPop( - {}, ol.format.KML.STYLE_PARSERS_, node, objectStack); - if (!styleObject) { - return null; - } - var fillStyle = /** @type {ol.style.Fill} */ - ('fillStyle' in styleObject ? - styleObject['fillStyle'] : ol.format.KML.DEFAULT_FILL_STYLE_); - var fill = /** @type {boolean|undefined} */ (styleObject['fill']); - if (fill !== undefined && !fill) { - fillStyle = null; - } - var imageStyle = /** @type {ol.style.Image} */ - ('imageStyle' in styleObject ? - styleObject['imageStyle'] : ol.format.KML.DEFAULT_IMAGE_STYLE_); - var textStyle = /** @type {ol.style.Text} */ - ('textStyle' in styleObject ? - styleObject['textStyle'] : ol.format.KML.DEFAULT_TEXT_STYLE_); - var strokeStyle = /** @type {ol.style.Stroke} */ - ('strokeStyle' in styleObject ? - styleObject['strokeStyle'] : ol.format.KML.DEFAULT_STROKE_STYLE_); - var outline = /** @type {boolean|undefined} */ - (styleObject['outline']); - if (outline !== undefined && !outline) { - strokeStyle = null; - } - return [new ol.style.Style({ - fill: fillStyle, - image: imageStyle, - stroke: strokeStyle, - text: textStyle, - zIndex: undefined // FIXME - })]; -}; - - -/** - * Reads an array of geometries and creates arrays for common geometry - * properties. Then sets them to the multi geometry. - * @param {ol.geom.MultiPoint|ol.geom.MultiLineString|ol.geom.MultiPolygon} - * multiGeometry - * @param {Array.<ol.geom.Geometry>} geometries - * @private - */ -ol.format.KML.setCommonGeometryProperties_ = function(multiGeometry, - geometries) { - var ii = geometries.length; - var extrudes = new Array(geometries.length); - var altitudeModes = new Array(geometries.length); - var geometry, i, hasExtrude, hasAltitudeMode; - hasExtrude = hasAltitudeMode = false; - for (i = 0; i < ii; ++i) { - geometry = geometries[i]; - extrudes[i] = geometry.get('extrude'); - altitudeModes[i] = geometry.get('altitudeMode'); - hasExtrude = hasExtrude || extrudes[i] !== undefined; - hasAltitudeMode = hasAltitudeMode || altitudeModes[i]; - } - if (hasExtrude) { - multiGeometry.set('extrude', extrudes); - } - if (hasAltitudeMode) { - multiGeometry.set('altitudeMode', altitudeModes); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.DataParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Data', 'localName should be Data'); - var name = node.getAttribute('name'); - if (name !== null) { - var data = ol.xml.pushParseAndPop( - undefined, ol.format.KML.DATA_PARSERS_, node, objectStack); - if (data) { - var featureObject = - /** @type {Object} */ (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isObject(featureObject), - 'featureObject should be an Object'); - featureObject[name] = data; - } - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.ExtendedDataParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'ExtendedData', - 'localName should be ExtendedData'); - ol.xml.parseNode(ol.format.KML.EXTENDED_DATA_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.PairDataParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Pair', 'localName should be Pair'); - var pairObject = ol.xml.pushParseAndPop( - {}, ol.format.KML.PAIR_PARSERS_, node, objectStack); - if (!pairObject) { - return; - } - var key = /** @type {string|undefined} */ - (pairObject['key']); - if (key && key == 'normal') { - var styleUrl = /** @type {string|undefined} */ - (pairObject['styleUrl']); - if (styleUrl) { - objectStack[objectStack.length - 1] = styleUrl; - } - var Style = /** @type {ol.style.Style} */ - (pairObject['Style']); - if (Style) { - objectStack[objectStack.length - 1] = Style; - } - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.PlacemarkStyleMapParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'StyleMap', - 'localName should be StyleMap'); - var styleMapValue = ol.format.KML.readStyleMapValue_(node, objectStack); - if (!styleMapValue) { - return; - } - var placemarkObject = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(placemarkObject), - 'placemarkObject should be an Object'); - if (goog.isArray(styleMapValue)) { - placemarkObject['Style'] = styleMapValue; - } else if (goog.isString(styleMapValue)) { - placemarkObject['styleUrl'] = styleMapValue; - } else { - goog.asserts.fail('styleMapValue has an unknown type'); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.SchemaDataParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'SchemaData', - 'localName should be SchemaData'); - ol.xml.parseNode(ol.format.KML.SCHEMA_DATA_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.SimpleDataParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'SimpleData', - 'localName should be SimpleData'); - var name = node.getAttribute('name'); - if (name !== null) { - var data = ol.format.XSD.readString(node); - var featureObject = - /** @type {Object} */ (objectStack[objectStack.length - 1]); - featureObject[name] = data; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.innerBoundaryIsParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'innerBoundaryIs', - 'localName should be innerBoundaryIs'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.<number>|undefined} */ (undefined), - ol.format.KML.INNER_BOUNDARY_IS_PARSERS_, node, objectStack); - if (flatLinearRing) { - var flatLinearRings = /** @type {Array.<Array.<number>>} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isArray(flatLinearRings), - 'flatLinearRings should be an array'); - goog.asserts.assert(flatLinearRings.length > 0, - 'flatLinearRings array should not be empty'); - flatLinearRings.push(flatLinearRing); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.outerBoundaryIsParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'outerBoundaryIs', - 'localName should be outerBoundaryIs'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.<number>|undefined} */ (undefined), - ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_, node, objectStack); - if (flatLinearRing) { - var flatLinearRings = /** @type {Array.<Array.<number>>} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isArray(flatLinearRings), - 'flatLinearRings should be an array'); - goog.asserts.assert(flatLinearRings.length > 0, - 'flatLinearRings array should not be empty'); - flatLinearRings[0] = flatLinearRing; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.LinkParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Link', 'localName should be Link'); - ol.xml.parseNode(ol.format.KML.LINK_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.whenParser_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'when', 'localName should be when'); - var gxTrackObject = /** @type {ol.format.KMLGxTrackObject_} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isObject(gxTrackObject), - 'gxTrackObject should be an Object'); - var whens = gxTrackObject.whens; - var s = ol.xml.getAllTextContent(node, false); - var re = - /^\s*(\d{4})($|-(\d{2})($|-(\d{2})($|T(\d{2}):(\d{2}):(\d{2})(Z|(?:([+\-])(\d{2})(?::(\d{2}))?)))))\s*$/; - var m = re.exec(s); - if (m) { - var year = parseInt(m[1], 10); - var month = m[3] ? parseInt(m[3], 10) - 1 : 0; - var day = m[5] ? parseInt(m[5], 10) : 1; - var hour = m[7] ? parseInt(m[7], 10) : 0; - var minute = m[8] ? parseInt(m[8], 10) : 0; - var second = m[9] ? parseInt(m[9], 10) : 0; - var when = Date.UTC(year, month, day, hour, minute, second); - if (m[10] && m[10] != 'Z') { - var sign = m[11] == '-' ? -1 : 1; - when += sign * 60 * parseInt(m[12], 10); - if (m[13]) { - when += sign * 60 * 60 * parseInt(m[13], 10); - } - } - whens.push(when); - } else { - whens.push(0); - } -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.DATA_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'value': ol.xml.makeReplacer(ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.EXTENDED_DATA_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'Data': ol.format.KML.DataParser_, - 'SchemaData': ol.format.KML.SchemaDataParser_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'extrude': ol.xml.makeObjectPropertySetter(ol.format.XSD.readBoolean), - 'altitudeMode': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.FLAT_LINEAR_RING_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'coordinates': ol.xml.makeReplacer(ol.format.KML.readFlatCoordinates_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'innerBoundaryIs': ol.format.KML.innerBoundaryIsParser_, - 'outerBoundaryIs': ol.format.KML.outerBoundaryIsParser_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.GX_TRACK_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'when': ol.format.KML.whenParser_ - }, ol.xml.makeStructureNS( - ol.format.KML.GX_NAMESPACE_URIS_, { - 'coord': ol.format.KML.gxCoordParser_ - })); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'coordinates': ol.xml.makeReplacer(ol.format.KML.readFlatCoordinates_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.ICON_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'href': ol.xml.makeObjectPropertySetter(ol.format.KML.readURI_) - }, ol.xml.makeStructureNS( - ol.format.KML.GX_NAMESPACE_URIS_, { - 'x': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'y': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'w': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'h': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal) - })); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.ICON_STYLE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'Icon': ol.xml.makeObjectPropertySetter(ol.format.KML.readIcon_), - 'heading': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal), - 'hotSpot': ol.xml.makeObjectPropertySetter(ol.format.KML.readVec2_), - 'scale': ol.xml.makeObjectPropertySetter(ol.format.KML.readScale_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.INNER_BOUNDARY_IS_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'LinearRing': ol.xml.makeReplacer(ol.format.KML.readFlatLinearRing_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.LABEL_STYLE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'color': ol.xml.makeObjectPropertySetter(ol.format.KML.readColor_), - 'scale': ol.xml.makeObjectPropertySetter(ol.format.KML.readScale_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.LINE_STYLE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'color': ol.xml.makeObjectPropertySetter(ol.format.KML.readColor_), - 'width': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.MULTI_GEOMETRY_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'LineString': ol.xml.makeArrayPusher(ol.format.KML.readLineString_), - 'LinearRing': ol.xml.makeArrayPusher(ol.format.KML.readLinearRing_), - 'MultiGeometry': ol.xml.makeArrayPusher(ol.format.KML.readMultiGeometry_), - 'Point': ol.xml.makeArrayPusher(ol.format.KML.readPoint_), - 'Polygon': ol.xml.makeArrayPusher(ol.format.KML.readPolygon_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.GX_NAMESPACE_URIS_, { - 'Track': ol.xml.makeArrayPusher(ol.format.KML.readGxTrack_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.NETWORK_LINK_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'ExtendedData': ol.format.KML.ExtendedDataParser_, - 'Link': ol.format.KML.LinkParser_, - 'address': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'description': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'open': ol.xml.makeObjectPropertySetter(ol.format.XSD.readBoolean), - 'phoneNumber': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'visibility': ol.xml.makeObjectPropertySetter(ol.format.XSD.readBoolean) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.LINK_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'href': ol.xml.makeObjectPropertySetter(ol.format.KML.readURI_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'LinearRing': ol.xml.makeReplacer(ol.format.KML.readFlatLinearRing_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.PAIR_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'Style': ol.xml.makeObjectPropertySetter(ol.format.KML.readStyle_), - 'key': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'styleUrl': ol.xml.makeObjectPropertySetter(ol.format.KML.readStyleUrl_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.PLACEMARK_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'ExtendedData': ol.format.KML.ExtendedDataParser_, - 'MultiGeometry': ol.xml.makeObjectPropertySetter( - ol.format.KML.readMultiGeometry_, 'geometry'), - 'LineString': ol.xml.makeObjectPropertySetter( - ol.format.KML.readLineString_, 'geometry'), - 'LinearRing': ol.xml.makeObjectPropertySetter( - ol.format.KML.readLinearRing_, 'geometry'), - 'Point': ol.xml.makeObjectPropertySetter( - ol.format.KML.readPoint_, 'geometry'), - 'Polygon': ol.xml.makeObjectPropertySetter( - ol.format.KML.readPolygon_, 'geometry'), - 'Style': ol.xml.makeObjectPropertySetter(ol.format.KML.readStyle_), - 'StyleMap': ol.format.KML.PlacemarkStyleMapParser_, - 'address': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'description': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'open': ol.xml.makeObjectPropertySetter(ol.format.XSD.readBoolean), - 'phoneNumber': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'styleUrl': ol.xml.makeObjectPropertySetter(ol.format.KML.readURI_), - 'visibility': ol.xml.makeObjectPropertySetter(ol.format.XSD.readBoolean) - }, ol.xml.makeStructureNS( - ol.format.KML.GX_NAMESPACE_URIS_, { - 'MultiTrack': ol.xml.makeObjectPropertySetter( - ol.format.KML.readGxMultiTrack_, 'geometry'), - 'Track': ol.xml.makeObjectPropertySetter( - ol.format.KML.readGxTrack_, 'geometry') - } - )); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.POLY_STYLE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'color': ol.xml.makeObjectPropertySetter(ol.format.KML.readColor_), - 'fill': ol.xml.makeObjectPropertySetter(ol.format.XSD.readBoolean), - 'outline': ol.xml.makeObjectPropertySetter(ol.format.XSD.readBoolean) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.SCHEMA_DATA_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'SimpleData': ol.format.KML.SimpleDataParser_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.STYLE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'IconStyle': ol.format.KML.IconStyleParser_, - 'LabelStyle': ol.format.KML.LabelStyleParser_, - 'LineStyle': ol.format.KML.LineStyleParser_, - 'PolyStyle': ol.format.KML.PolyStyleParser_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.KML.STYLE_MAP_PARSERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'Pair': ol.format.KML.PairDataParser_ - }); - - -/** - * @inheritDoc - */ -ol.format.KML.prototype.getExtensions = function() { - return ol.format.KML.EXTENSIONS_; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<ol.Feature>|undefined} Features. - */ -ol.format.KML.prototype.readDocumentOrFolder_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - var localName = ol.xml.getLocalName(node); - goog.asserts.assert(localName == 'Document' || localName == 'Folder', - 'localName should be Document or Folder'); - // FIXME use scope somehow - var parsersNS = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'Document': ol.xml.makeArrayExtender(this.readDocumentOrFolder_, this), - 'Folder': ol.xml.makeArrayExtender(this.readDocumentOrFolder_, this), - 'Placemark': ol.xml.makeArrayPusher(this.readPlacemark_, this), - 'Style': goog.bind(this.readSharedStyle_, this), - 'StyleMap': goog.bind(this.readSharedStyleMap_, this) - }); - var features = ol.xml.pushParseAndPop(/** @type {Array.<ol.Feature>} */ ([]), - parsersNS, node, objectStack, this); - if (features) { - return features; - } else { - return undefined; - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.Feature|undefined} Feature. - */ -ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Placemark', - 'localName should be Placemark'); - var object = ol.xml.pushParseAndPop({'geometry': null}, - ol.format.KML.PLACEMARK_PARSERS_, node, objectStack); - if (!object) { - return undefined; - } - var feature = new ol.Feature(); - var id = node.getAttribute('id'); - if (id !== null) { - feature.setId(id); - } - var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); - - var geometry = object['geometry']; - if (geometry) { - ol.format.Feature.transformWithOptions(geometry, false, options); - } - feature.setGeometry(geometry); - delete object['geometry']; - - if (this.extractStyles_) { - var style = object['Style']; - var styleUrl = object['styleUrl']; - var styleFunction = ol.format.KML.createFeatureStyleFunction_( - style, styleUrl, this.defaultStyle_, this.sharedStyles_, - this.showPointNames_); - feature.setStyle(styleFunction); - } - delete object['Style']; - // we do not remove the styleUrl property from the object, so it - // gets stored on feature when setProperties is called - - feature.setProperties(object); - - return feature; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Style', 'localName should be Style'); - var id = node.getAttribute('id'); - if (id !== null) { - var style = ol.format.KML.readStyle_(node, objectStack); - if (style) { - var styleUri; - if (node.baseURI) { - styleUri = goog.Uri.resolve(node.baseURI, '#' + id).toString(); - } else { - styleUri = '#' + id; - } - this.sharedStyles_[styleUri] = style; - } - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'StyleMap', - 'localName should be StyleMap'); - var id = node.getAttribute('id'); - if (id === null) { - return; - } - var styleMapValue = ol.format.KML.readStyleMapValue_(node, objectStack); - if (!styleMapValue) { - return; - } - var styleUri; - if (node.baseURI) { - styleUri = goog.Uri.resolve(node.baseURI, '#' + id).toString(); - } else { - styleUri = '#' + id; - } - this.sharedStyles_[styleUri] = styleMapValue; -}; - - -/** - * Read the first feature from a KML source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - * @api stable - */ -ol.format.KML.prototype.readFeature; - - -/** - * @inheritDoc - */ -ol.format.KML.prototype.readFeatureFromNode = function(node, opt_options) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - if (!ol.array.includes(ol.format.KML.NAMESPACE_URIS_, node.namespaceURI)) { - return null; - } - goog.asserts.assert(node.localName == 'Placemark', - 'localName should be Placemark'); - var feature = this.readPlacemark_( - node, [this.getReadOptions(node, opt_options)]); - if (feature) { - return feature; - } else { - return null; - } -}; - - -/** - * Read all features from a KML source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.KML.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.KML.prototype.readFeaturesFromNode = function(node, opt_options) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - if (!ol.array.includes(ol.format.KML.NAMESPACE_URIS_, node.namespaceURI)) { - return []; - } - var features; - var localName = ol.xml.getLocalName(node); - if (localName == 'Document' || localName == 'Folder') { - features = this.readDocumentOrFolder_( - node, [this.getReadOptions(node, opt_options)]); - if (features) { - return features; - } else { - return []; - } - } else if (localName == 'Placemark') { - var feature = this.readPlacemark_( - node, [this.getReadOptions(node, opt_options)]); - if (feature) { - return [feature]; - } else { - return []; - } - } else if (localName == 'kml') { - features = []; - var n; - for (n = node.firstElementChild; n; n = n.nextElementSibling) { - var fs = this.readFeaturesFromNode(n, opt_options); - if (fs) { - goog.array.extend(features, fs); - } - } - return features; - } else { - return []; - } -}; - - -/** - * Read the name of the KML. - * - * @param {Document|Node|string} source Souce. - * @return {string|undefined} Name. - * @api stable - */ -ol.format.KML.prototype.readName = function(source) { - if (ol.xml.isDocument(source)) { - return this.readNameFromDocument(/** @type {Document} */ (source)); - } else if (ol.xml.isNode(source)) { - return this.readNameFromNode(/** @type {Node} */ (source)); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - return this.readNameFromDocument(doc); - } else { - goog.asserts.fail('Unknown type for source'); - return undefined; - } -}; - - -/** - * @param {Document} doc Document. - * @return {string|undefined} Name. - */ -ol.format.KML.prototype.readNameFromDocument = function(doc) { - var n; - for (n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - var name = this.readNameFromNode(n); - if (name) { - return name; - } - } - } - return undefined; -}; - - -/** - * @param {Node} node Node. - * @return {string|undefined} Name. - */ -ol.format.KML.prototype.readNameFromNode = function(node) { - var n; - for (n = node.firstElementChild; n; n = n.nextElementSibling) { - if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) && - n.localName == 'name') { - return ol.format.XSD.readString(n); - } - } - for (n = node.firstElementChild; n; n = n.nextElementSibling) { - var localName = ol.xml.getLocalName(n); - if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) && - (localName == 'Document' || - localName == 'Folder' || - localName == 'Placemark' || - localName == 'kml')) { - var name = this.readNameFromNode(n); - if (name) { - return name; - } - } - } - return undefined; -}; - - -/** - * Read the network links of the KML. - * - * @param {Document|Node|string} source Source. - * @return {Array.<Object>} Network links. - * @api - */ -ol.format.KML.prototype.readNetworkLinks = function(source) { - var networkLinks = []; - if (ol.xml.isDocument(source)) { - goog.array.extend(networkLinks, this.readNetworkLinksFromDocument( - /** @type {Document} */ (source))); - } else if (ol.xml.isNode(source)) { - goog.array.extend(networkLinks, this.readNetworkLinksFromNode( - /** @type {Node} */ (source))); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - goog.array.extend(networkLinks, this.readNetworkLinksFromDocument(doc)); - } else { - goog.asserts.fail('unknown type for source'); - } - return networkLinks; -}; - - -/** - * @param {Document} doc Document. - * @return {Array.<Object>} Network links. - */ -ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) { - var n, networkLinks = []; - for (n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - goog.array.extend(networkLinks, this.readNetworkLinksFromNode(n)); - } - } - return networkLinks; -}; - - -/** - * @param {Node} node Node. - * @return {Array.<Object>} Network links. - */ -ol.format.KML.prototype.readNetworkLinksFromNode = function(node) { - var n, networkLinks = []; - for (n = node.firstElementChild; n; n = n.nextElementSibling) { - if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) && - n.localName == 'NetworkLink') { - var obj = ol.xml.pushParseAndPop({}, ol.format.KML.NETWORK_LINK_PARSERS_, - n, []); - networkLinks.push(obj); - } - } - for (n = node.firstElementChild; n; n = n.nextElementSibling) { - var localName = ol.xml.getLocalName(n); - if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) && - (localName == 'Document' || - localName == 'Folder' || - localName == 'kml')) { - goog.array.extend(networkLinks, this.readNetworkLinksFromNode(n)); - } - } - return networkLinks; -}; - - -/** - * Read the projection from a KML source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {ol.proj.Projection} Projection. - * @api stable - */ -ol.format.KML.prototype.readProjection; - - -/** - * @param {Node} node Node to append a TextNode with the color to. - * @param {ol.Color|string} color Color. - * @private - */ -ol.format.KML.writeColorTextNode_ = function(node, color) { - var rgba = ol.color.asArray(color); - var opacity = (rgba.length == 4) ? rgba[3] : 1; - var abgr = [opacity * 255, rgba[2], rgba[1], rgba[0]]; - var i; - for (i = 0; i < 4; ++i) { - var hex = parseInt(abgr[i], 10).toString(16); - abgr[i] = (hex.length == 1) ? '0' + hex : hex; - } - ol.format.XSD.writeStringTextNode(node, abgr.join('')); -}; - - -/** - * @param {Node} node Node to append a TextNode with the coordinates to. - * @param {Array.<number>} coordinates Coordinates. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writeCoordinatesTextNode_ = - function(node, coordinates, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - - var layout = context['layout']; - var stride = context['stride']; - - var dimension; - if (layout == ol.geom.GeometryLayout.XY || - layout == ol.geom.GeometryLayout.XYM) { - dimension = 2; - } else if (layout == ol.geom.GeometryLayout.XYZ || - layout == ol.geom.GeometryLayout.XYZM) { - dimension = 3; - } else { - goog.asserts.fail('Unknown geometry layout'); - } - - var d, i; - var ii = coordinates.length; - var text = ''; - if (ii > 0) { - text += coordinates[0]; - for (d = 1; d < dimension; ++d) { - text += ',' + coordinates[d]; - } - for (i = stride; i < ii; i += stride) { - text += ' ' + coordinates[i]; - for (d = 1; d < dimension; ++d) { - text += ',' + coordinates[i + d]; - } - } - } - ol.format.XSD.writeStringTextNode(node, text); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<ol.Feature>} features Features. - * @param {Array.<*>} objectStack Object stack. - * @this {ol.format.KML} - * @private - */ -ol.format.KML.writeDocument_ = function(node, features, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - ol.xml.pushSerializeAndPop(context, ol.format.KML.DOCUMENT_SERIALIZERS_, - ol.format.KML.DOCUMENT_NODE_FACTORY_, features, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Object} icon Icon object. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writeIcon_ = function(node, icon, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = ol.format.KML.ICON_SEQUENCE_[parentNode.namespaceURI]; - var values = ol.xml.makeSequence(icon, orderedKeys); - ol.xml.pushSerializeAndPop(context, - ol.format.KML.ICON_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY, - values, objectStack, orderedKeys); - orderedKeys = - ol.format.KML.ICON_SEQUENCE_[ol.format.KML.GX_NAMESPACE_URIS_[0]]; - values = ol.xml.makeSequence(icon, orderedKeys); - ol.xml.pushSerializeAndPop(context, ol.format.KML.ICON_SERIALIZERS_, - ol.format.KML.GX_NODE_FACTORY_, values, objectStack, orderedKeys); -}; - - -/** - * @param {Node} node Node. - * @param {ol.style.Icon} style Icon style. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writeIconStyle_ = function(node, style, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - var properties = {}; - var src = style.getSrc(); - var size = style.getSize(); - var iconImageSize = style.getImageSize(); - var iconProperties = { - 'href': src - }; - - if (size) { - iconProperties['w'] = size[0]; - iconProperties['h'] = size[1]; - var anchor = style.getAnchor(); // top-left - var origin = style.getOrigin(); // top-left - - if (origin && iconImageSize && origin[0] !== 0 && origin[1] !== size[1]) { - iconProperties['x'] = origin[0]; - iconProperties['y'] = iconImageSize[1] - (origin[1] + size[1]); - } - - if (anchor && anchor[0] !== 0 && anchor[1] !== size[1]) { - var /** @type {ol.format.KMLVec2_} */ hotSpot = { - x: anchor[0], - xunits: ol.style.IconAnchorUnits.PIXELS, - y: size[1] - anchor[1], - yunits: ol.style.IconAnchorUnits.PIXELS - }; - properties['hotSpot'] = hotSpot; - } - } - - properties['Icon'] = iconProperties; - - var scale = style.getScale(); - if (scale !== 1) { - properties['scale'] = scale; - } - - var rotation = style.getRotation(); - if (rotation !== 0) { - properties['heading'] = rotation; // 0-360 - } - - var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = ol.format.KML.ICON_STYLE_SEQUENCE_[parentNode.namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(context, ol.format.KML.ICON_STYLE_SERIALIZERS_, - ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); -}; - - -/** - * @param {Node} node Node. - * @param {ol.style.Text} style style. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writeLabelStyle_ = function(node, style, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - var properties = {}; - var fill = style.getFill(); - if (fill) { - properties['color'] = fill.getColor(); - } - var scale = style.getScale(); - if (scale && scale !== 1) { - properties['scale'] = scale; - } - var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = - ol.format.KML.LABEL_STYLE_SEQUENCE_[parentNode.namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(context, ol.format.KML.LABEL_STYLE_SERIALIZERS_, - ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); -}; - - -/** - * @param {Node} node Node. - * @param {ol.style.Stroke} style style. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writeLineStyle_ = function(node, style, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - var properties = { - 'color': style.getColor(), - 'width': style.getWidth() - }; - var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = ol.format.KML.LINE_STYLE_SEQUENCE_[parentNode.namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(context, ol.format.KML.LINE_STYLE_SERIALIZERS_, - ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.Geometry} geometry Geometry. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writeMultiGeometry_ = - function(node, geometry, objectStack) { - goog.asserts.assert( - (geometry instanceof ol.geom.MultiPoint) || - (geometry instanceof ol.geom.MultiLineString) || - (geometry instanceof ol.geom.MultiPolygon), - 'geometry should be one of: ol.geom.MultiPoint, ' + - 'ol.geom.MultiLineString or ol.geom.MultiPolygon'); - /** @type {ol.xml.NodeStackItem} */ - var context = {node: node}; - var type = geometry.getType(); - /** @type {Array.<ol.geom.Geometry>} */ - var geometries; - /** @type {function(*, Array.<*>, string=): (Node|undefined)} */ - var factory; - if (type == ol.geom.GeometryType.MULTI_POINT) { - geometries = - (/** @type {ol.geom.MultiPoint} */ (geometry)).getPoints(); - factory = ol.format.KML.POINT_NODE_FACTORY_; - } else if (type == ol.geom.GeometryType.MULTI_LINE_STRING) { - geometries = - (/** @type {ol.geom.MultiLineString} */ (geometry)).getLineStrings(); - factory = ol.format.KML.LINE_STRING_NODE_FACTORY_; - } else if (type == ol.geom.GeometryType.MULTI_POLYGON) { - geometries = - (/** @type {ol.geom.MultiPolygon} */ (geometry)).getPolygons(); - factory = ol.format.KML.POLYGON_NODE_FACTORY_; - } else { - goog.asserts.fail('Unknown geometry type: ' + type); - } - ol.xml.pushSerializeAndPop(context, - ol.format.KML.MULTI_GEOMETRY_SERIALIZERS_, factory, - geometries, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.LinearRing} linearRing Linear ring. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writeBoundaryIs_ = function(node, linearRing, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - ol.xml.pushSerializeAndPop(context, - ol.format.KML.BOUNDARY_IS_SERIALIZERS_, - ol.format.KML.LINEAR_RING_NODE_FACTORY_, [linearRing], objectStack); -}; - - -/** - * FIXME currently we do serialize arbitrary/custom feature properties - * (ExtendedData). - * @param {Node} node Node. - * @param {ol.Feature} feature Feature. - * @param {Array.<*>} objectStack Object stack. - * @this {ol.format.KML} - * @private - */ -ol.format.KML.writePlacemark_ = function(node, feature, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - - // set id - if (feature.getId()) { - node.setAttribute('id', feature.getId()); - } - - // serialize properties (properties unknown to KML are not serialized) - var properties = feature.getProperties(); - - var styleFunction = feature.getStyleFunction(); - if (styleFunction) { - // FIXME the styles returned by the style function are supposed to be - // resolution-independent here - var styles = styleFunction.call(feature, 0); - if (styles && styles.length > 0) { - var style = styles[0]; - if (this.writeStyles_) { - properties['Style'] = styles[0]; - } - var textStyle = style.getText(); - if (textStyle) { - properties['name'] = textStyle.getText(); - } - } - } - var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = ol.format.KML.PLACEMARK_SEQUENCE_[parentNode.namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_, - ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); - - // serialize geometry - var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); - var geometry = feature.getGeometry(); - if (geometry) { - geometry = - ol.format.Feature.transformWithOptions(geometry, true, options); - } - ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_, - ol.format.KML.GEOMETRY_NODE_FACTORY_, [geometry], objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.SimpleGeometry} geometry Geometry. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writePrimitiveGeometry_ = function(node, geometry, objectStack) { - goog.asserts.assert( - (geometry instanceof ol.geom.Point) || - (geometry instanceof ol.geom.LineString) || - (geometry instanceof ol.geom.LinearRing), - 'geometry should be one of ol.geom.Point, ol.geom.LineString ' + - 'or ol.geom.LinearRing'); - var flatCoordinates = geometry.getFlatCoordinates(); - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - context['layout'] = geometry.getLayout(); - context['stride'] = geometry.getStride(); - ol.xml.pushSerializeAndPop(context, - ol.format.KML.PRIMITIVE_GEOMETRY_SERIALIZERS_, - ol.format.KML.COORDINATES_NODE_FACTORY_, - [flatCoordinates], objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.geom.Polygon} polygon Polygon. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writePolygon_ = function(node, polygon, objectStack) { - goog.asserts.assertInstanceof(polygon, ol.geom.Polygon, - 'polygon should be an ol.geom.Polygon'); - var linearRings = polygon.getLinearRings(); - goog.asserts.assert(linearRings.length > 0, - 'linearRings should not be empty'); - var outerRing = linearRings.shift(); - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - // inner rings - ol.xml.pushSerializeAndPop(context, - ol.format.KML.POLYGON_SERIALIZERS_, - ol.format.KML.INNER_BOUNDARY_NODE_FACTORY_, - linearRings, objectStack); - // outer ring - ol.xml.pushSerializeAndPop(context, - ol.format.KML.POLYGON_SERIALIZERS_, - ol.format.KML.OUTER_BOUNDARY_NODE_FACTORY_, - [outerRing], objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {ol.style.Fill} style Style. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writePolyStyle_ = function(node, style, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - ol.xml.pushSerializeAndPop(context, ol.format.KML.POLY_STYLE_SERIALIZERS_, - ol.format.KML.COLOR_NODE_FACTORY_, [style.getColor()], objectStack); -}; - - -/** - * @param {Node} node Node to append a TextNode with the scale to. - * @param {number|undefined} scale Scale. - * @private - */ -ol.format.KML.writeScaleTextNode_ = function(node, scale) { - ol.format.XSD.writeDecimalTextNode(node, scale * scale); -}; - - -/** - * @param {Node} node Node. - * @param {ol.style.Style} style Style. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.KML.writeStyle_ = function(node, style, objectStack) { - var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; - var properties = {}; - var fillStyle = style.getFill(); - var strokeStyle = style.getStroke(); - var imageStyle = style.getImage(); - var textStyle = style.getText(); - if (imageStyle instanceof ol.style.Icon) { - properties['IconStyle'] = imageStyle; - } - if (textStyle) { - properties['LabelStyle'] = textStyle; - } - if (strokeStyle) { - properties['LineStyle'] = strokeStyle; - } - if (fillStyle) { - properties['PolyStyle'] = fillStyle; - } - var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = ol.format.KML.STYLE_SEQUENCE_[parentNode.namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(context, ol.format.KML.STYLE_SERIALIZERS_, - ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); -}; - - -/** - * @param {Node} node Node to append a TextNode with the Vec2 to. - * @param {ol.format.KMLVec2_} vec2 Vec2. - * @private - */ -ol.format.KML.writeVec2_ = function(node, vec2) { - node.setAttribute('x', vec2.x); - node.setAttribute('y', vec2.y); - node.setAttribute('xunits', vec2.xunits); - node.setAttribute('yunits', vec2.yunits); -}; - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.KML.KML_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, [ - 'Document', 'Placemark' - ]); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.KML_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'Document': ol.xml.makeChildAppender(ol.format.KML.writeDocument_), - 'Placemark': ol.xml.makeChildAppender(ol.format.KML.writePlacemark_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.DOCUMENT_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'Placemark': ol.xml.makeChildAppender(ol.format.KML.writePlacemark_) - }); - - -/** - * @const - * @type {Object.<string, string>} - * @private - */ -ol.format.KML.GEOMETRY_TYPE_TO_NODENAME_ = { - 'Point': 'Point', - 'LineString': 'LineString', - 'LinearRing': 'LinearRing', - 'Polygon': 'Polygon', - 'MultiPoint': 'MultiGeometry', - 'MultiLineString': 'MultiGeometry', - 'MultiPolygon': 'MultiGeometry' -}; - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.KML.ICON_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, [ - 'href' - ], - ol.xml.makeStructureNS( - ol.format.KML.GX_NAMESPACE_URIS_, [ - 'x', 'y', 'w', 'h' - ])); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.ICON_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'href': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode) - }, ol.xml.makeStructureNS( - ol.format.KML.GX_NAMESPACE_URIS_, { - 'x': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'y': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'w': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'h': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode) - })); - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.KML.ICON_STYLE_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, [ - 'scale', 'heading', 'Icon', 'hotSpot' - ]); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.ICON_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'Icon': ol.xml.makeChildAppender(ol.format.KML.writeIcon_), - 'heading': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode), - 'hotSpot': ol.xml.makeChildAppender(ol.format.KML.writeVec2_), - 'scale': ol.xml.makeChildAppender(ol.format.KML.writeScaleTextNode_) - }); - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.KML.LABEL_STYLE_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, [ - 'color', 'scale' - ]); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.LABEL_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'color': ol.xml.makeChildAppender(ol.format.KML.writeColorTextNode_), - 'scale': ol.xml.makeChildAppender(ol.format.KML.writeScaleTextNode_) - }); - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.KML.LINE_STYLE_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, [ - 'color', 'width' - ]); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.LINE_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'color': ol.xml.makeChildAppender(ol.format.KML.writeColorTextNode_), - 'width': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.BOUNDARY_IS_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'LinearRing': ol.xml.makeChildAppender( - ol.format.KML.writePrimitiveGeometry_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.MULTI_GEOMETRY_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'LineString': ol.xml.makeChildAppender( - ol.format.KML.writePrimitiveGeometry_), - 'Point': ol.xml.makeChildAppender( - ol.format.KML.writePrimitiveGeometry_), - 'Polygon': ol.xml.makeChildAppender(ol.format.KML.writePolygon_) - }); - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.KML.PLACEMARK_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, [ - 'name', 'open', 'visibility', 'address', 'phoneNumber', 'description', - 'styleUrl', 'Style' - ]); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.PLACEMARK_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'MultiGeometry': ol.xml.makeChildAppender( - ol.format.KML.writeMultiGeometry_), - 'LineString': ol.xml.makeChildAppender( - ol.format.KML.writePrimitiveGeometry_), - 'LinearRing': ol.xml.makeChildAppender( - ol.format.KML.writePrimitiveGeometry_), - 'Point': ol.xml.makeChildAppender( - ol.format.KML.writePrimitiveGeometry_), - 'Polygon': ol.xml.makeChildAppender(ol.format.KML.writePolygon_), - 'Style': ol.xml.makeChildAppender(ol.format.KML.writeStyle_), - 'address': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'description': ol.xml.makeChildAppender( - ol.format.XSD.writeStringTextNode), - 'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'open': ol.xml.makeChildAppender(ol.format.XSD.writeBooleanTextNode), - 'phoneNumber': ol.xml.makeChildAppender( - ol.format.XSD.writeStringTextNode), - 'styleUrl': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode), - 'visibility': ol.xml.makeChildAppender( - ol.format.XSD.writeBooleanTextNode) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.PRIMITIVE_GEOMETRY_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'coordinates': ol.xml.makeChildAppender( - ol.format.KML.writeCoordinatesTextNode_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.POLYGON_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'outerBoundaryIs': ol.xml.makeChildAppender( - ol.format.KML.writeBoundaryIs_), - 'innerBoundaryIs': ol.xml.makeChildAppender( - ol.format.KML.writeBoundaryIs_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.POLY_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'color': ol.xml.makeChildAppender(ol.format.KML.writeColorTextNode_) - }); - - -/** - * @const - * @type {Object.<string, Array.<string>>} - * @private - */ -ol.format.KML.STYLE_SEQUENCE_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, [ - 'IconStyle', 'LabelStyle', 'LineStyle', 'PolyStyle' - ]); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.KML.STYLE_SERIALIZERS_ = ol.xml.makeStructureNS( - ol.format.KML.NAMESPACE_URIS_, { - 'IconStyle': ol.xml.makeChildAppender(ol.format.KML.writeIconStyle_), - 'LabelStyle': ol.xml.makeChildAppender(ol.format.KML.writeLabelStyle_), - 'LineStyle': ol.xml.makeChildAppender(ol.format.KML.writeLineStyle_), - 'PolyStyle': ol.xml.makeChildAppender(ol.format.KML.writePolyStyle_) - }); - - -/** - * @const - * @param {*} value Value. - * @param {Array.<*>} objectStack Object stack. - * @param {string=} opt_nodeName Node name. - * @return {Node|undefined} Node. - * @private - */ -ol.format.KML.GX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { - return ol.xml.createElementNS(ol.format.KML.GX_NAMESPACE_URIS_[0], - 'gx:' + opt_nodeName); -}; - - -/** - * @const - * @param {*} value Value. - * @param {Array.<*>} objectStack Object stack. - * @param {string=} opt_nodeName Node name. - * @return {Node|undefined} Node. - * @private - */ -ol.format.KML.DOCUMENT_NODE_FACTORY_ = function(value, objectStack, - opt_nodeName) { - goog.asserts.assertInstanceof(value, ol.Feature, - 'value should be an ol.Feature'); - var parentNode = objectStack[objectStack.length - 1].node; - goog.asserts.assert(ol.xml.isNode(parentNode), - 'parentNode should be an XML node'); - return ol.xml.createElementNS(parentNode.namespaceURI, 'Placemark'); -}; - - -/** - * @const - * @param {*} value Value. - * @param {Array.<*>} objectStack Object stack. - * @param {string=} opt_nodeName Node name. - * @return {Node|undefined} Node. - * @private - */ -ol.format.KML.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, - opt_nodeName) { - if (value) { - goog.asserts.assertInstanceof(value, ol.geom.Geometry, - 'value should be an ol.geom.Geometry'); - var parentNode = objectStack[objectStack.length - 1].node; - goog.asserts.assert(ol.xml.isNode(parentNode), - 'parentNode should be an XML node'); - return ol.xml.createElementNS(parentNode.namespaceURI, - ol.format.KML.GEOMETRY_TYPE_TO_NODENAME_[value.getType()]); - } -}; - - -/** - * A factory for creating coordinates nodes. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.KML.COLOR_NODE_FACTORY_ = ol.xml.makeSimpleNodeFactory('color'); - - -/** - * A factory for creating coordinates nodes. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.KML.COORDINATES_NODE_FACTORY_ = - ol.xml.makeSimpleNodeFactory('coordinates'); - - -/** - * A factory for creating innerBoundaryIs nodes. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.KML.INNER_BOUNDARY_NODE_FACTORY_ = - ol.xml.makeSimpleNodeFactory('innerBoundaryIs'); - - -/** - * A factory for creating Point nodes. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.KML.POINT_NODE_FACTORY_ = - ol.xml.makeSimpleNodeFactory('Point'); - - -/** - * A factory for creating LineString nodes. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.KML.LINE_STRING_NODE_FACTORY_ = - ol.xml.makeSimpleNodeFactory('LineString'); - - -/** - * A factory for creating LinearRing nodes. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.KML.LINEAR_RING_NODE_FACTORY_ = - ol.xml.makeSimpleNodeFactory('LinearRing'); - - -/** - * A factory for creating Polygon nodes. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.KML.POLYGON_NODE_FACTORY_ = - ol.xml.makeSimpleNodeFactory('Polygon'); - - -/** - * A factory for creating outerBoundaryIs nodes. - * @const - * @type {function(*, Array.<*>, string=): (Node|undefined)} - * @private - */ -ol.format.KML.OUTER_BOUNDARY_NODE_FACTORY_ = - ol.xml.makeSimpleNodeFactory('outerBoundaryIs'); - - -/** - * Encode an array of features in the KML format. - * - * @function - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {string} Result. - * @api stable - */ -ol.format.KML.prototype.writeFeatures; - - -/** - * Encode an array of features in the KML format as an XML node. - * - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. - * @return {Node} Node. - * @api - */ -ol.format.KML.prototype.writeFeaturesNode = function(features, opt_options) { - opt_options = this.adaptOptions(opt_options); - var kml = ol.xml.createElementNS(ol.format.KML.NAMESPACE_URIS_[4], 'kml'); - var xmlnsUri = 'http://www.w3.org/2000/xmlns/'; - var xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance'; - ol.xml.setAttributeNS(kml, xmlnsUri, 'xmlns:gx', - ol.format.KML.GX_NAMESPACE_URIS_[0]); - ol.xml.setAttributeNS(kml, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri); - ol.xml.setAttributeNS(kml, xmlSchemaInstanceUri, 'xsi:schemaLocation', - ol.format.KML.SCHEMA_LOCATION_); - - var /** @type {ol.xml.NodeStackItem} */ context = {node: kml}; - var properties = {}; - if (features.length > 1) { - properties['Document'] = features; - } else if (features.length == 1) { - properties['Placemark'] = features[0]; - } - var orderedKeys = ol.format.KML.KML_SEQUENCE_[kml.namespaceURI]; - var values = ol.xml.makeSequence(properties, orderedKeys); - ol.xml.pushSerializeAndPop(context, ol.format.KML.KML_SERIALIZERS_, - ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, [opt_options], orderedKeys, - this); - return kml; -}; - -goog.provide('ol.ext.pbf'); -/** @typedef {function(*)} */ -ol.ext.pbf; -(function() { -var exports = {}; -var module = {exports: exports}; -var define; -/** - * @fileoverview - * @suppress {accessControls, ambiguousFunctionDecl, checkDebuggerStatement, checkRegExp, checkTypes, checkVars, const, constantProperty, deprecated, duplicate, es5Strict, fileoverviewTags, missingProperties, nonStandardJsDocs, strictModuleDepCheck, suspiciousCode, undefinedNames, undefinedVars, unknownDefines, uselessCode, visibility} - */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pbf = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],2:[function(_dereq_,module,exports){ -'use strict'; - -// lightweight Buffer shim for pbf browser build -// based on code from github.com/feross/buffer (MIT-licensed) - -module.exports = Buffer; - -var ieee754 = _dereq_('ieee754'); - -var BufferMethods; - -function Buffer(length) { - var arr; - if (length && length.length) { - arr = length; - length = arr.length; - } - var buf = new Uint8Array(length || 0); - if (arr) buf.set(arr); - - buf.readUInt32LE = BufferMethods.readUInt32LE; - buf.writeUInt32LE = BufferMethods.writeUInt32LE; - buf.readInt32LE = BufferMethods.readInt32LE; - buf.writeInt32LE = BufferMethods.writeInt32LE; - buf.readFloatLE = BufferMethods.readFloatLE; - buf.writeFloatLE = BufferMethods.writeFloatLE; - buf.readDoubleLE = BufferMethods.readDoubleLE; - buf.writeDoubleLE = BufferMethods.writeDoubleLE; - buf.toString = BufferMethods.toString; - buf.write = BufferMethods.write; - buf.slice = BufferMethods.slice; - buf.copy = BufferMethods.copy; - - buf._isBuffer = true; - return buf; -} - -var lastStr, lastStrEncoded; - -BufferMethods = { - readUInt32LE: function(pos) { - return ((this[pos]) | - (this[pos + 1] << 8) | - (this[pos + 2] << 16)) + - (this[pos + 3] * 0x1000000); - }, - - writeUInt32LE: function(val, pos) { - this[pos] = val; - this[pos + 1] = (val >>> 8); - this[pos + 2] = (val >>> 16); - this[pos + 3] = (val >>> 24); - }, - - readInt32LE: function(pos) { - return ((this[pos]) | - (this[pos + 1] << 8) | - (this[pos + 2] << 16)) + - (this[pos + 3] << 24); - }, - - readFloatLE: function(pos) { return ieee754.read(this, pos, true, 23, 4); }, - readDoubleLE: function(pos) { return ieee754.read(this, pos, true, 52, 8); }, - - writeFloatLE: function(val, pos) { return ieee754.write(this, val, pos, true, 23, 4); }, - writeDoubleLE: function(val, pos) { return ieee754.write(this, val, pos, true, 52, 8); }, - - toString: function(encoding, start, end) { - var str = '', - tmp = ''; - - start = start || 0; - end = Math.min(this.length, end || this.length); - - for (var i = start; i < end; i++) { - var ch = this[i]; - if (ch <= 0x7F) { - str += decodeURIComponent(tmp) + String.fromCharCode(ch); - tmp = ''; - } else { - tmp += '%' + ch.toString(16); - } - } - - str += decodeURIComponent(tmp); - - return str; - }, - - write: function(str, pos) { - var bytes = str === lastStr ? lastStrEncoded : encodeString(str); - for (var i = 0; i < bytes.length; i++) { - this[pos + i] = bytes[i]; - } - }, - - slice: function(start, end) { - return this.subarray(start, end); - }, - - copy: function(buf, pos) { - pos = pos || 0; - for (var i = 0; i < this.length; i++) { - buf[pos + i] = this[i]; - } - } -}; - -BufferMethods.writeInt32LE = BufferMethods.writeUInt32LE; - -Buffer.byteLength = function(str) { - lastStr = str; - lastStrEncoded = encodeString(str); - return lastStrEncoded.length; -}; - -Buffer.isBuffer = function(buf) { - return !!(buf && buf._isBuffer); -}; - -function encodeString(str) { - var length = str.length, - bytes = []; - - for (var i = 0, c, lead; i < length; i++) { - c = str.charCodeAt(i); // code point - - if (c > 0xD7FF && c < 0xE000) { - - if (lead) { - if (c < 0xDC00) { - bytes.push(0xEF, 0xBF, 0xBD); - lead = c; - continue; - - } else { - c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000; - lead = null; - } - - } else { - if (c > 0xDBFF || (i + 1 === length)) bytes.push(0xEF, 0xBF, 0xBD); - else lead = c; - - continue; - } - - } else if (lead) { - bytes.push(0xEF, 0xBF, 0xBD); - lead = null; - } - - if (c < 0x80) bytes.push(c); - else if (c < 0x800) bytes.push(c >> 0x6 | 0xC0, c & 0x3F | 0x80); - else if (c < 0x10000) bytes.push(c >> 0xC | 0xE0, c >> 0x6 & 0x3F | 0x80, c & 0x3F | 0x80); - else bytes.push(c >> 0x12 | 0xF0, c >> 0xC & 0x3F | 0x80, c >> 0x6 & 0x3F | 0x80, c & 0x3F | 0x80); - } - return bytes; -} - -},{"ieee754":1}],3:[function(_dereq_,module,exports){ -(function (global){ -'use strict'; - -module.exports = Pbf; - -var Buffer = global.Buffer || _dereq_('./buffer'); - -function Pbf(buf) { - this.buf = !Buffer.isBuffer(buf) ? new Buffer(buf || 0) : buf; - this.pos = 0; - this.length = this.buf.length; -} - -Pbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum -Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64 -Pbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields -Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32 - -var SHIFT_LEFT_32 = (1 << 16) * (1 << 16), - SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32, - POW_2_63 = Math.pow(2, 63); - -Pbf.prototype = { - - destroy: function() { - this.buf = null; - }, - - // === READING ================================================================= - - readFields: function(readField, result, end) { - end = end || this.length; - - while (this.pos < end) { - var val = this.readVarint(), - tag = val >> 3, - startPos = this.pos; - - readField(tag, result, this); - - if (this.pos === startPos) this.skip(val); - } - return result; - }, - - readMessage: function(readField, result) { - return this.readFields(readField, result, this.readVarint() + this.pos); - }, - - readFixed32: function() { - var val = this.buf.readUInt32LE(this.pos); - this.pos += 4; - return val; - }, - - readSFixed32: function() { - var val = this.buf.readInt32LE(this.pos); - this.pos += 4; - return val; - }, - - // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed) - - readFixed64: function() { - var val = this.buf.readUInt32LE(this.pos) + this.buf.readUInt32LE(this.pos + 4) * SHIFT_LEFT_32; - this.pos += 8; - return val; - }, - - readSFixed64: function() { - var val = this.buf.readUInt32LE(this.pos) + this.buf.readInt32LE(this.pos + 4) * SHIFT_LEFT_32; - this.pos += 8; - return val; - }, - - readFloat: function() { - var val = this.buf.readFloatLE(this.pos); - this.pos += 4; - return val; - }, - - readDouble: function() { - var val = this.buf.readDoubleLE(this.pos); - this.pos += 8; - return val; - }, - - readVarint: function() { - var buf = this.buf, - val, b, b0, b1, b2, b3; - - b0 = buf[this.pos++]; if (b0 < 0x80) return b0; b0 = b0 & 0x7f; - b1 = buf[this.pos++]; if (b1 < 0x80) return b0 | b1 << 7; b1 = (b1 & 0x7f) << 7; - b2 = buf[this.pos++]; if (b2 < 0x80) return b0 | b1 | b2 << 14; b2 = (b2 & 0x7f) << 14; - b3 = buf[this.pos++]; if (b3 < 0x80) return b0 | b1 | b2 | b3 << 21; - - val = b0 | b1 | b2 | (b3 & 0x7f) << 21; - - b = buf[this.pos++]; val += (b & 0x7f) * 0x10000000; if (b < 0x80) return val; - b = buf[this.pos++]; val += (b & 0x7f) * 0x800000000; if (b < 0x80) return val; - b = buf[this.pos++]; val += (b & 0x7f) * 0x40000000000; if (b < 0x80) return val; - b = buf[this.pos++]; val += (b & 0x7f) * 0x2000000000000; if (b < 0x80) return val; - b = buf[this.pos++]; val += (b & 0x7f) * 0x100000000000000; if (b < 0x80) return val; - b = buf[this.pos++]; val += (b & 0x7f) * 0x8000000000000000; if (b < 0x80) return val; - - throw new Error('Expected varint not more than 10 bytes'); - }, - - readVarint64: function() { - var startPos = this.pos, - val = this.readVarint(); - - if (val < POW_2_63) return val; - - var pos = this.pos - 2; - while (this.buf[pos] === 0xff) pos--; - if (pos < startPos) pos = startPos; - - val = 0; - for (var i = 0; i < pos - startPos + 1; i++) { - var b = ~this.buf[startPos + i] & 0x7f; - val += i < 4 ? b << i * 7 : b * Math.pow(2, i * 7); - } - - return -val - 1; - }, - - readSVarint: function() { - var num = this.readVarint(); - return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding - }, - - readBoolean: function() { - return Boolean(this.readVarint()); - }, - - readString: function() { - var end = this.readVarint() + this.pos, - str = this.buf.toString('utf8', this.pos, end); - this.pos = end; - return str; - }, - - readBytes: function() { - var end = this.readVarint() + this.pos, - buffer = this.buf.slice(this.pos, end); - this.pos = end; - return buffer; - }, - - // verbose for performance reasons; doesn't affect gzipped size - - readPackedVarint: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readVarint()); - return arr; - }, - readPackedSVarint: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readSVarint()); - return arr; - }, - readPackedBoolean: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readBoolean()); - return arr; - }, - readPackedFloat: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readFloat()); - return arr; - }, - readPackedDouble: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readDouble()); - return arr; - }, - readPackedFixed32: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readFixed32()); - return arr; - }, - readPackedSFixed32: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readSFixed32()); - return arr; - }, - readPackedFixed64: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readFixed64()); - return arr; - }, - readPackedSFixed64: function() { - var end = this.readVarint() + this.pos, arr = []; - while (this.pos < end) arr.push(this.readSFixed64()); - return arr; - }, - - skip: function(val) { - var type = val & 0x7; - if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {} - else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos; - else if (type === Pbf.Fixed32) this.pos += 4; - else if (type === Pbf.Fixed64) this.pos += 8; - else throw new Error('Unimplemented type: ' + type); - }, - - // === WRITING ================================================================= - - writeTag: function(tag, type) { - this.writeVarint((tag << 3) | type); - }, - - realloc: function(min) { - var length = this.length || 16; - - while (length < this.pos + min) length *= 2; - - if (length !== this.length) { - var buf = new Buffer(length); - this.buf.copy(buf); - this.buf = buf; - this.length = length; - } - }, - - finish: function() { - this.length = this.pos; - this.pos = 0; - return this.buf.slice(0, this.length); - }, - - writeFixed32: function(val) { - this.realloc(4); - this.buf.writeUInt32LE(val, this.pos); - this.pos += 4; - }, - - writeSFixed32: function(val) { - this.realloc(4); - this.buf.writeInt32LE(val, this.pos); - this.pos += 4; - }, - - writeFixed64: function(val) { - this.realloc(8); - this.buf.writeInt32LE(val & -1, this.pos); - this.buf.writeUInt32LE(Math.floor(val * SHIFT_RIGHT_32), this.pos + 4); - this.pos += 8; - }, - - writeSFixed64: function(val) { - this.realloc(8); - this.buf.writeInt32LE(val & -1, this.pos); - this.buf.writeInt32LE(Math.floor(val * SHIFT_RIGHT_32), this.pos + 4); - this.pos += 8; - }, - - writeVarint: function(val) { - val = +val; - - if (val <= 0x7f) { - this.realloc(1); - this.buf[this.pos++] = val; - - } else if (val <= 0x3fff) { - this.realloc(2); - this.buf[this.pos++] = ((val >>> 0) & 0x7f) | 0x80; - this.buf[this.pos++] = ((val >>> 7) & 0x7f); - - } else if (val <= 0x1fffff) { - this.realloc(3); - this.buf[this.pos++] = ((val >>> 0) & 0x7f) | 0x80; - this.buf[this.pos++] = ((val >>> 7) & 0x7f) | 0x80; - this.buf[this.pos++] = ((val >>> 14) & 0x7f); - - } else if (val <= 0xfffffff) { - this.realloc(4); - this.buf[this.pos++] = ((val >>> 0) & 0x7f) | 0x80; - this.buf[this.pos++] = ((val >>> 7) & 0x7f) | 0x80; - this.buf[this.pos++] = ((val >>> 14) & 0x7f) | 0x80; - this.buf[this.pos++] = ((val >>> 21) & 0x7f); - - } else { - var pos = this.pos; - while (val >= 0x80) { - this.realloc(1); - this.buf[this.pos++] = (val & 0xff) | 0x80; - val /= 0x80; - } - this.realloc(1); - this.buf[this.pos++] = val | 0; - if (this.pos - pos > 10) throw new Error('Given varint doesn\'t fit into 10 bytes'); - } - }, - - writeSVarint: function(val) { - this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2); - }, - - writeBoolean: function(val) { - this.writeVarint(Boolean(val)); - }, - - writeString: function(str) { - str = String(str); - var bytes = Buffer.byteLength(str); - this.writeVarint(bytes); - this.realloc(bytes); - this.buf.write(str, this.pos); - this.pos += bytes; - }, - - writeFloat: function(val) { - this.realloc(4); - this.buf.writeFloatLE(val, this.pos); - this.pos += 4; - }, - - writeDouble: function(val) { - this.realloc(8); - this.buf.writeDoubleLE(val, this.pos); - this.pos += 8; - }, - - writeBytes: function(buffer) { - var len = buffer.length; - this.writeVarint(len); - this.realloc(len); - for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i]; - }, - - writeRawMessage: function(fn, obj) { - this.pos++; // reserve 1 byte for short message length - - // write the message directly to the buffer and see how much was written - var startPos = this.pos; - fn(obj, this); - var len = this.pos - startPos; - - var varintLen = - len <= 0x7f ? 1 : - len <= 0x3fff ? 2 : - len <= 0x1fffff ? 3 : - len <= 0xfffffff ? 4 : Math.ceil(Math.log(len) / (Math.LN2 * 7)); - - // if 1 byte isn't enough for encoding message length, shift the data to the right - if (varintLen > 1) { - this.realloc(varintLen - 1); - for (var i = this.pos - 1; i >= startPos; i--) this.buf[i + varintLen - 1] = this.buf[i]; - } - - // finally, write the message length in the reserved place and restore the position - this.pos = startPos - 1; - this.writeVarint(len); - this.pos += len; - }, - - writeMessage: function(tag, fn, obj) { - this.writeTag(tag, Pbf.Bytes); - this.writeRawMessage(fn, obj); - }, - - writePackedVarint: function(tag, arr) { this.writeMessage(tag, writePackedVarint, arr); }, - writePackedSVarint: function(tag, arr) { this.writeMessage(tag, writePackedSVarint, arr); }, - writePackedBoolean: function(tag, arr) { this.writeMessage(tag, writePackedBoolean, arr); }, - writePackedFloat: function(tag, arr) { this.writeMessage(tag, writePackedFloat, arr); }, - writePackedDouble: function(tag, arr) { this.writeMessage(tag, writePackedDouble, arr); }, - writePackedFixed32: function(tag, arr) { this.writeMessage(tag, writePackedFixed32, arr); }, - writePackedSFixed32: function(tag, arr) { this.writeMessage(tag, writePackedSFixed32, arr); }, - writePackedFixed64: function(tag, arr) { this.writeMessage(tag, writePackedFixed64, arr); }, - writePackedSFixed64: function(tag, arr) { this.writeMessage(tag, writePackedSFixed64, arr); }, - - writeBytesField: function(tag, buffer) { - this.writeTag(tag, Pbf.Bytes); - this.writeBytes(buffer); - }, - writeFixed32Field: function(tag, val) { - this.writeTag(tag, Pbf.Fixed32); - this.writeFixed32(val); - }, - writeSFixed32Field: function(tag, val) { - this.writeTag(tag, Pbf.Fixed32); - this.writeSFixed32(val); - }, - writeFixed64Field: function(tag, val) { - this.writeTag(tag, Pbf.Fixed64); - this.writeFixed64(val); - }, - writeSFixed64Field: function(tag, val) { - this.writeTag(tag, Pbf.Fixed64); - this.writeSFixed64(val); - }, - writeVarintField: function(tag, val) { - this.writeTag(tag, Pbf.Varint); - this.writeVarint(val); - }, - writeSVarintField: function(tag, val) { - this.writeTag(tag, Pbf.Varint); - this.writeSVarint(val); - }, - writeStringField: function(tag, str) { - this.writeTag(tag, Pbf.Bytes); - this.writeString(str); - }, - writeFloatField: function(tag, val) { - this.writeTag(tag, Pbf.Fixed32); - this.writeFloat(val); - }, - writeDoubleField: function(tag, val) { - this.writeTag(tag, Pbf.Fixed64); - this.writeDouble(val); - }, - writeBooleanField: function(tag, val) { - this.writeVarintField(tag, Boolean(val)); - } -}; - -function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); } -function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); } -function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); } -function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); } -function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); } -function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); } -function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); } -function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); } -function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); } - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./buffer":2}]},{},[3])(3) -}); -ol.ext.pbf = module.exports; -})(); - -goog.provide('ol.ext.vectortile'); -/** @typedef {function(*)} */ -ol.ext.vectortile; -(function() { -var exports = {}; -var module = {exports: exports}; -var define; -/** - * @fileoverview - * @suppress {accessControls, ambiguousFunctionDecl, checkDebuggerStatement, checkRegExp, checkTypes, checkVars, const, constantProperty, deprecated, duplicate, es5Strict, fileoverviewTags, missingProperties, nonStandardJsDocs, strictModuleDepCheck, suspiciousCode, undefinedNames, undefinedVars, unknownDefines, uselessCode, visibility} - */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.vectortile = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ -'use strict'; - -module.exports = Point; - -function Point(x, y) { - this.x = x; - this.y = y; -} - -Point.prototype = { - clone: function() { return new Point(this.x, this.y); }, - - add: function(p) { return this.clone()._add(p); }, - sub: function(p) { return this.clone()._sub(p); }, - mult: function(k) { return this.clone()._mult(k); }, - div: function(k) { return this.clone()._div(k); }, - rotate: function(a) { return this.clone()._rotate(a); }, - matMult: function(m) { return this.clone()._matMult(m); }, - unit: function() { return this.clone()._unit(); }, - perp: function() { return this.clone()._perp(); }, - round: function() { return this.clone()._round(); }, - - mag: function() { - return Math.sqrt(this.x * this.x + this.y * this.y); - }, - - equals: function(p) { - return this.x === p.x && - this.y === p.y; - }, - - dist: function(p) { - return Math.sqrt(this.distSqr(p)); - }, - - distSqr: function(p) { - var dx = p.x - this.x, - dy = p.y - this.y; - return dx * dx + dy * dy; - }, - - angle: function() { - return Math.atan2(this.y, this.x); - }, - - angleTo: function(b) { - return Math.atan2(this.y - b.y, this.x - b.x); - }, - - angleWith: function(b) { - return this.angleWithSep(b.x, b.y); - }, - - // Find the angle of the two vectors, solving the formula for the cross product a x b = |a||b|sin(θ) for θ. - angleWithSep: function(x, y) { - return Math.atan2( - this.x * y - this.y * x, - this.x * x + this.y * y); - }, - - _matMult: function(m) { - var x = m[0] * this.x + m[1] * this.y, - y = m[2] * this.x + m[3] * this.y; - this.x = x; - this.y = y; - return this; - }, - - _add: function(p) { - this.x += p.x; - this.y += p.y; - return this; - }, - - _sub: function(p) { - this.x -= p.x; - this.y -= p.y; - return this; - }, - - _mult: function(k) { - this.x *= k; - this.y *= k; - return this; - }, - - _div: function(k) { - this.x /= k; - this.y /= k; - return this; - }, - - _unit: function() { - this._div(this.mag()); - return this; - }, - - _perp: function() { - var y = this.y; - this.y = this.x; - this.x = -y; - return this; - }, - - _rotate: function(angle) { - var cos = Math.cos(angle), - sin = Math.sin(angle), - x = cos * this.x - sin * this.y, - y = sin * this.x + cos * this.y; - this.x = x; - this.y = y; - return this; - }, - - _round: function() { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - return this; - } -}; - -// constructs Point from an array if necessary -Point.convert = function (a) { - if (a instanceof Point) { - return a; - } - if (Array.isArray(a)) { - return new Point(a[0], a[1]); - } - return a; -}; - -},{}],2:[function(_dereq_,module,exports){ -module.exports.VectorTile = _dereq_('./lib/vectortile.js'); -module.exports.VectorTileFeature = _dereq_('./lib/vectortilefeature.js'); -module.exports.VectorTileLayer = _dereq_('./lib/vectortilelayer.js'); - -},{"./lib/vectortile.js":3,"./lib/vectortilefeature.js":4,"./lib/vectortilelayer.js":5}],3:[function(_dereq_,module,exports){ -'use strict'; - -var VectorTileLayer = _dereq_('./vectortilelayer'); - -module.exports = VectorTile; - -function VectorTile(pbf, end) { - this.layers = pbf.readFields(readTile, {}, end); -} - -function readTile(tag, layers, pbf) { - if (tag === 3) { - var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos); - if (layer.length) layers[layer.name] = layer; - } -} - - -},{"./vectortilelayer":5}],4:[function(_dereq_,module,exports){ -'use strict'; - -var Point = _dereq_('point-geometry'); - -module.exports = VectorTileFeature; - -function VectorTileFeature(pbf, end, extent, keys, values) { - // Public - this.properties = {}; - this.extent = extent; - this.type = 0; - - // Private - this._pbf = pbf; - this._geometry = -1; - this._keys = keys; - this._values = values; - - pbf.readFields(readFeature, this, end); -} - -function readFeature(tag, feature, pbf) { - if (tag == 1) feature._id = pbf.readVarint(); - else if (tag == 2) readTag(pbf, feature); - else if (tag == 3) feature.type = pbf.readVarint(); - else if (tag == 4) feature._geometry = pbf.pos; -} - -function readTag(pbf, feature) { - var end = pbf.readVarint() + pbf.pos; - - while (pbf.pos < end) { - var key = feature._keys[pbf.readVarint()], - value = feature._values[pbf.readVarint()]; - feature.properties[key] = value; - } -} - -VectorTileFeature.types = ['Unknown', 'Point', 'LineString', 'Polygon']; - -VectorTileFeature.prototype.loadGeometry = function() { - var pbf = this._pbf; - pbf.pos = this._geometry; - - var end = pbf.readVarint() + pbf.pos, - cmd = 1, - length = 0, - x = 0, - y = 0, - lines = [], - line; - - while (pbf.pos < end) { - if (!length) { - var cmdLen = pbf.readVarint(); - cmd = cmdLen & 0x7; - length = cmdLen >> 3; - } - - length--; - - if (cmd === 1 || cmd === 2) { - x += pbf.readSVarint(); - y += pbf.readSVarint(); - - if (cmd === 1) { // moveTo - if (line) lines.push(line); - line = []; - } - - line.push(new Point(x, y)); - - } else if (cmd === 7) { - - // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90 - if (line) { - line.push(line[0].clone()); // closePolygon - } - - } else { - throw new Error('unknown command ' + cmd); - } - } - - if (line) lines.push(line); - - return lines; -}; - -VectorTileFeature.prototype.bbox = function() { - var pbf = this._pbf; - pbf.pos = this._geometry; - - var end = pbf.readVarint() + pbf.pos, - cmd = 1, - length = 0, - x = 0, - y = 0, - x1 = Infinity, - x2 = -Infinity, - y1 = Infinity, - y2 = -Infinity; - - while (pbf.pos < end) { - if (!length) { - var cmdLen = pbf.readVarint(); - cmd = cmdLen & 0x7; - length = cmdLen >> 3; - } - - length--; - - if (cmd === 1 || cmd === 2) { - x += pbf.readSVarint(); - y += pbf.readSVarint(); - if (x < x1) x1 = x; - if (x > x2) x2 = x; - if (y < y1) y1 = y; - if (y > y2) y2 = y; - - } else if (cmd !== 7) { - throw new Error('unknown command ' + cmd); - } - } - - return [x1, y1, x2, y2]; -}; - -VectorTileFeature.prototype.toGeoJSON = function(x, y, z) { - var size = this.extent * Math.pow(2, z), - x0 = this.extent * x, - y0 = this.extent * y, - coords = this.loadGeometry(), - type = VectorTileFeature.types[this.type]; - - for (var i = 0; i < coords.length; i++) { - var line = coords[i]; - for (var j = 0; j < line.length; j++) { - var p = line[j], y2 = 180 - (p.y + y0) * 360 / size; - line[j] = [ - (p.x + x0) * 360 / size - 180, - 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90 - ]; - } - } - - if (type === 'Point' && coords.length === 1) { - coords = coords[0][0]; - } else if (type === 'Point') { - coords = coords[0]; - type = 'MultiPoint'; - } else if (type === 'LineString' && coords.length === 1) { - coords = coords[0]; - } else if (type === 'LineString') { - type = 'MultiLineString'; - } - - return { - type: "Feature", - geometry: { - type: type, - coordinates: coords - }, - properties: this.properties - }; -}; - -},{"point-geometry":1}],5:[function(_dereq_,module,exports){ -'use strict'; - -var VectorTileFeature = _dereq_('./vectortilefeature.js'); - -module.exports = VectorTileLayer; - -function VectorTileLayer(pbf, end) { - // Public - this.version = 1; - this.name = null; - this.extent = 4096; - this.length = 0; - - // Private - this._pbf = pbf; - this._keys = []; - this._values = []; - this._features = []; - - pbf.readFields(readLayer, this, end); - - this.length = this._features.length; -} - -function readLayer(tag, layer, pbf) { - if (tag === 15) layer.version = pbf.readVarint(); - else if (tag === 1) layer.name = pbf.readString(); - else if (tag === 5) layer.extent = pbf.readVarint(); - else if (tag === 2) layer._features.push(pbf.pos); - else if (tag === 3) layer._keys.push(pbf.readString()); - else if (tag === 4) layer._values.push(readValueMessage(pbf)); -} - -function readValueMessage(pbf) { - var value = null, - end = pbf.readVarint() + pbf.pos; - - while (pbf.pos < end) { - var tag = pbf.readVarint() >> 3; - - value = tag === 1 ? pbf.readString() : - tag === 2 ? pbf.readFloat() : - tag === 3 ? pbf.readDouble() : - tag === 4 ? pbf.readVarint64() : - tag === 5 ? pbf.readVarint() : - tag === 6 ? pbf.readSVarint() : - tag === 7 ? pbf.readBoolean() : null; - } - - return value; -} - -// return feature `i` from this layer as a `VectorTileFeature` -VectorTileLayer.prototype.feature = function(i) { - if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds'); - - this._pbf.pos = this._features[i]; - - var end = this._pbf.readVarint() + this._pbf.pos; - return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values); -}; - -},{"./vectortilefeature.js":4}]},{},[2])(2) -}); -ol.ext.vectortile = module.exports; -})(); - -//FIXME Implement projection handling - -goog.provide('ol.format.MVT'); - -goog.require('goog.asserts'); -goog.require('ol.Feature'); -goog.require('ol.ext.pbf'); -goog.require('ol.ext.vectortile'); -goog.require('ol.format.Feature'); -goog.require('ol.format.FormatType'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.proj'); -goog.require('ol.proj.Projection'); -goog.require('ol.proj.Units'); -goog.require('ol.render.Feature'); - - - -/** - * @classdesc - * Feature format for reading data in the Mapbox MVT format. - * - * @constructor - * @extends {ol.format.Feature} - * @param {olx.format.MVTOptions=} opt_options Options. - * @api - */ -ol.format.MVT = function(opt_options) { - - goog.base(this); - - var options = opt_options ? opt_options : {}; - - /** - * @type {ol.proj.Projection} - */ - this.defaultDataProjection = new ol.proj.Projection({ - code: 'EPSG:3857', - units: ol.proj.Units.TILE_PIXELS - }); - - /** - * @private - * @type {function((ol.geom.Geometry|Object.<string, *>)=)| - * function(ol.geom.GeometryType,Array.<number>, - * (Array.<number>|Array.<Array.<number>>),Object.<string, *>)} - */ - this.featureClass_ = options.featureClass ? - options.featureClass : ol.render.Feature; - - /** - * @private - * @type {string} - */ - this.geometryName_ = options.geometryName ? - options.geometryName : 'geometry'; - - /** - * @private - * @type {string} - */ - this.layerName_ = options.layerName ? options.layerName : 'layer'; - - /** - * @private - * @type {Array.<string>} - */ - this.layers_ = options.layers ? options.layers : null; - -}; -goog.inherits(ol.format.MVT, ol.format.Feature); - - -/** - * @inheritDoc - */ -ol.format.MVT.prototype.getType = function() { - return ol.format.FormatType.ARRAY_BUFFER; -}; - - -/** - * @private - * @param {Object} rawFeature Raw Mapbox feature. - * @param {string} layer Layer. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - */ -ol.format.MVT.prototype.readFeature_ = function( - rawFeature, layer, opt_options) { - var feature = new this.featureClass_(); - var values = rawFeature.properties; - values[this.layerName_] = layer; - var geometry = ol.format.Feature.transformWithOptions( - ol.format.MVT.readGeometry_(rawFeature), false, - this.adaptOptions(opt_options)); - if (geometry) { - goog.asserts.assertInstanceof(geometry, ol.geom.Geometry); - values[this.geometryName_] = geometry; - } - feature.setProperties(values); - feature.setGeometryName(this.geometryName_); - return feature; -}; - - -/** - * @private - * @param {Object} rawFeature Raw Mapbox feature. - * @param {string} layer Layer. - * @return {ol.render.Feature} Feature. - */ -ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) { - var coords = rawFeature.loadGeometry(); - var ends = []; - var flatCoordinates = []; - ol.format.MVT.calculateFlatCoordinates_(coords, flatCoordinates, ends); - - var type = rawFeature.type; - /** @type {ol.geom.GeometryType} */ - var geometryType; - if (type === 1) { - geometryType = coords.length === 1 ? - ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT; - } else if (type === 2) { - if (coords.length === 1) { - geometryType = ol.geom.GeometryType.LINE_STRING; - } else { - geometryType = ol.geom.GeometryType.MULTI_LINE_STRING; - } - } else if (type === 3) { - geometryType = ol.geom.GeometryType.POLYGON; - } - - var values = rawFeature.properties; - values[this.layerName_] = layer; - - return new this.featureClass_(geometryType, flatCoordinates, ends, values); -}; - - -/** - * @inheritDoc - */ -ol.format.MVT.prototype.readFeatures = function(source, opt_options) { - goog.asserts.assertInstanceof(source, ArrayBuffer); - - var layers = this.layers_; - - var pbf = new ol.ext.pbf(source); - var tile = new ol.ext.vectortile.VectorTile(pbf); - var features = []; - var featureClass = this.featureClass_; - var layer, feature; - for (var name in tile.layers) { - if (layers && layers.indexOf(name) == -1) { - continue; - } - layer = tile.layers[name]; - - for (var i = 0, ii = layer.length; i < ii; ++i) { - if (featureClass === ol.render.Feature) { - feature = this.readRenderFeature_(layer.feature(i), name); - } else { - feature = this.readFeature_(layer.feature(i), name, opt_options); - } - features.push(feature); - } - } - - return features; -}; - - -/** - * @inheritDoc - */ -ol.format.MVT.prototype.readProjection = function(source) { - return this.defaultDataProjection; -}; - - -/** - * Sets the layers that features will be read from. - * @param {Array.<string>} layers Layers. - * @api - */ -ol.format.MVT.prototype.setLayers = function(layers) { - this.layers_ = layers; -}; - - -/** - * @private - * @param {Object} coords Raw feature coordinates. - * @param {Array.<number>} flatCoordinates Flat coordinates to be populated by - * this function. - * @param {Array.<number>} ends Ends to be populated by this function. - */ -ol.format.MVT.calculateFlatCoordinates_ = function( - coords, flatCoordinates, ends) { - var end = 0; - var line, coord; - for (var i = 0, ii = coords.length; i < ii; ++i) { - line = coords[i]; - for (var j = 0, jj = line.length; j < jj; ++j) { - coord = line[j]; - // Non-tilespace coords can be calculated here when a TileGrid and - // TileCoord are known. - flatCoordinates.push(coord.x, coord.y); - } - end += 2 * j; - ends.push(end); - } -}; - - -/** - * @private - * @param {Object} rawFeature Raw Mapbox feature. - * @return {ol.geom.Geometry} Geometry. - */ -ol.format.MVT.readGeometry_ = function(rawFeature) { - var type = rawFeature.type; - if (type === 0) { - return null; - } - - var coords = rawFeature.loadGeometry(); - var ends = []; - var flatCoordinates = []; - ol.format.MVT.calculateFlatCoordinates_(coords, flatCoordinates, ends); - - var geom; - if (type === 1) { - geom = coords.length === 1 ? - new ol.geom.Point(null) : new ol.geom.MultiPoint(null); - } else if (type === 2) { - if (coords.length === 1) { - geom = new ol.geom.LineString(null); - } else { - geom = new ol.geom.MultiLineString(null); - } - } else if (type === 3) { - geom = new ol.geom.Polygon(null); - } - - geom.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates, - ends); - - return geom; -}; - -// FIXME add typedef for stack state objects -goog.provide('ol.format.OSMXML'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.object'); -goog.require('ol.Feature'); -goog.require('ol.format.Feature'); -goog.require('ol.format.XMLFeature'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.proj'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Feature format for reading data in the - * [OSMXML format](http://wiki.openstreetmap.org/wiki/OSM_XML). - * - * @constructor - * @extends {ol.format.XMLFeature} - * @api stable - */ -ol.format.OSMXML = function() { - goog.base(this); - - /** - * @inheritDoc - */ - this.defaultDataProjection = ol.proj.get('EPSG:4326'); -}; -goog.inherits(ol.format.OSMXML, ol.format.XMLFeature); - - -/** - * @const - * @type {Array.<string>} - * @private - */ -ol.format.OSMXML.EXTENSIONS_ = ['.osm']; - - -/** - * @inheritDoc - */ -ol.format.OSMXML.prototype.getExtensions = function() { - return ol.format.OSMXML.EXTENSIONS_; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.OSMXML.readNode_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'node', 'localName should be node'); - var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); - var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); - var id = node.getAttribute('id'); - var coordinates = /** @type {Array.<number>} */ ([ - parseFloat(node.getAttribute('lon')), - parseFloat(node.getAttribute('lat')) - ]); - state.nodes[id] = coordinates; - - var values = ol.xml.pushParseAndPop({ - tags: {} - }, ol.format.OSMXML.NODE_PARSERS_, node, objectStack); - if (!goog.object.isEmpty(values.tags)) { - var geometry = new ol.geom.Point(coordinates); - ol.format.Feature.transformWithOptions(geometry, false, options); - var feature = new ol.Feature(geometry); - feature.setId(id); - feature.setProperties(values.tags); - state.features.push(feature); - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.OSMXML.readWay_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'way', 'localName should be way'); - var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); - var id = node.getAttribute('id'); - var values = ol.xml.pushParseAndPop({ - ndrefs: [], - tags: {} - }, ol.format.OSMXML.WAY_PARSERS_, node, objectStack); - var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); - var flatCoordinates = /** @type {Array.<number>} */ ([]); - for (var i = 0, ii = values.ndrefs.length; i < ii; i++) { - var point = state.nodes[values.ndrefs[i]]; - goog.array.extend(flatCoordinates, point); - } - var geometry; - if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) { - // closed way - geometry = new ol.geom.Polygon(null); - geometry.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates, - [flatCoordinates.length]); - } else { - geometry = new ol.geom.LineString(null); - geometry.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates); - } - ol.format.Feature.transformWithOptions(geometry, false, options); - var feature = new ol.Feature(geometry); - feature.setId(id); - feature.setProperties(values.tags); - state.features.push(feature); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.Feature|undefined} Track. - */ -ol.format.OSMXML.readNd_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'nd', 'localName should be nd'); - var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); - values.ndrefs.push(node.getAttribute('ref')); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {ol.Feature|undefined} Track. - */ -ol.format.OSMXML.readTag_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'tag', 'localName should be tag'); - var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); - values.tags[node.getAttribute('k')] = node.getAttribute('v'); -}; - - -/** - * @const - * @private - * @type {Array.<string>} - */ -ol.format.OSMXML.NAMESPACE_URIS_ = [ - null -]; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OSMXML.WAY_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OSMXML.NAMESPACE_URIS_, { - 'nd': ol.format.OSMXML.readNd_, - 'tag': ol.format.OSMXML.readTag_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OSMXML.PARSERS_ = ol.xml.makeStructureNS( - ol.format.OSMXML.NAMESPACE_URIS_, { - 'node': ol.format.OSMXML.readNode_, - 'way': ol.format.OSMXML.readWay_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OSMXML.NODE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OSMXML.NAMESPACE_URIS_, { - 'tag': ol.format.OSMXML.readTag_ - }); - - -/** - * Read all features from an OSM source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.OSMXML.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - var options = this.getReadOptions(node, opt_options); - if (node.localName == 'osm') { - var state = ol.xml.pushParseAndPop({ - nodes: {}, - features: [] - }, ol.format.OSMXML.PARSERS_, node, [options]); - if (state.features) { - return state.features; - } - } - return []; -}; - - -/** - * Read the projection from an OSM source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {ol.proj.Projection} Projection. - * @api stable - */ -ol.format.OSMXML.prototype.readProjection; - -goog.provide('ol.format.XLink'); - - -/** - * @const - * @type {string} - */ -ol.format.XLink.NAMESPACE_URI = 'http://www.w3.org/1999/xlink'; - - -/** - * @param {Node} node Node. - * @return {boolean|undefined} Boolean. - */ -ol.format.XLink.readHref = function(node) { - return node.getAttributeNS(ol.format.XLink.NAMESPACE_URI, 'href'); -}; - -goog.provide('ol.format.XML'); - -goog.require('goog.asserts'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Generic format for reading non-feature XML data - * - * @constructor - */ -ol.format.XML = function() { -}; - - -/** - * @param {Document|Node|string} source Source. - * @return {Object} - */ -ol.format.XML.prototype.read = function(source) { - if (ol.xml.isDocument(source)) { - return this.readFromDocument(/** @type {Document} */ (source)); - } else if (ol.xml.isNode(source)) { - return this.readFromNode(/** @type {Node} */ (source)); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - return this.readFromDocument(doc); - } else { - goog.asserts.fail(); - return null; - } -}; - - -/** - * @param {Document} doc Document. - * @return {Object} - */ -ol.format.XML.prototype.readFromDocument = goog.abstractMethod; - - -/** - * @param {Node} node Node. - * @return {Object} - */ -ol.format.XML.prototype.readFromNode = goog.abstractMethod; - -goog.provide('ol.format.OWS'); - -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('ol.format.XLink'); -goog.require('ol.format.XML'); -goog.require('ol.format.XSD'); -goog.require('ol.xml'); - - - -/** - * @constructor - * @extends {ol.format.XML} - */ -ol.format.OWS = function() { - goog.base(this); -}; -goog.inherits(ol.format.OWS, ol.format.XML); - - -/** - * @param {Document} doc Document. - * @return {Object} OWS object. - */ -ol.format.OWS.prototype.readFromDocument = function(doc) { - goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, - 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - return this.readFromNode(n); - } - } - return null; -}; - - -/** - * @param {Node} node Node. - * @return {Object} OWS object. - */ -ol.format.OWS.prototype.readFromNode = function(node) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - var owsObject = ol.xml.pushParseAndPop({}, - ol.format.OWS.PARSERS_, node, []); - return owsObject ? owsObject : null; -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readAddress_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Address', - 'localName should be Address'); - return ol.xml.pushParseAndPop({}, - ol.format.OWS.ADDRESS_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readAllowedValues_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'AllowedValues', - 'localName should be AllowedValues'); - return ol.xml.pushParseAndPop({}, - ol.format.OWS.ALLOWED_VALUES_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readConstraint_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Constraint', - 'localName should be Constraint'); - var name = node.getAttribute('name'); - if (!name) { - return undefined; - } - return ol.xml.pushParseAndPop({'name': name}, - ol.format.OWS.CONSTRAINT_PARSERS_, node, - objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readContactInfo_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'ContactInfo', - 'localName should be ContactInfo'); - return ol.xml.pushParseAndPop({}, - ol.format.OWS.CONTACT_INFO_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readDcp_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'DCP', 'localName should be DCP'); - return ol.xml.pushParseAndPop({}, - ol.format.OWS.DCP_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readGet_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Get', 'localName should be Get'); - var href = ol.format.XLink.readHref(node); - if (!href) { - return undefined; - } - return ol.xml.pushParseAndPop({'href': href}, - ol.format.OWS.REQUEST_METHOD_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readHttp_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'HTTP', 'localName should be HTTP'); - return ol.xml.pushParseAndPop({}, ol.format.OWS.HTTP_PARSERS_, - node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readOperation_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Operation', - 'localName should be Operation'); - var name = node.getAttribute('name'); - var value = ol.xml.pushParseAndPop({}, - ol.format.OWS.OPERATION_PARSERS_, node, objectStack); - if (!value) { - return undefined; - } - var object = /** @type {Object} */ - (objectStack[objectStack.length - 1]); - goog.asserts.assert(goog.isObject(object), 'object should be an Object'); - object[name] = value; - -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readOperationsMetadata_ = function(node, - objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'OperationsMetadata', - 'localName should be OperationsMetadata'); - return ol.xml.pushParseAndPop({}, - ol.format.OWS.OPERATIONS_METADATA_PARSERS_, node, - objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readPhone_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Phone', 'localName should be Phone'); - return ol.xml.pushParseAndPop({}, - ol.format.OWS.PHONE_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readServiceIdentification_ = function(node, - objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'ServiceIdentification', - 'localName should be ServiceIdentification'); - return ol.xml.pushParseAndPop( - {}, ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_, node, - objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readServiceContact_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'ServiceContact', - 'localName should be ServiceContact'); - return ol.xml.pushParseAndPop( - {}, ol.format.OWS.SERVICE_CONTACT_PARSERS_, node, - objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} - */ -ol.format.OWS.readServiceProvider_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'ServiceProvider', - 'localName should be ServiceProvider'); - return ol.xml.pushParseAndPop( - {}, ol.format.OWS.SERVICE_PROVIDER_PARSERS_, node, - objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {string|undefined} - */ -ol.format.OWS.readValue_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Value', 'localName should be Value'); - return ol.format.XSD.readString(node); -}; - - -/** - * @const - * @type {Array.<string>} - * @private - */ -ol.format.OWS.NAMESPACE_URIS_ = [ - null, - 'http://www.opengis.net/ows/1.1' -]; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'ServiceIdentification': ol.xml.makeObjectPropertySetter( - ol.format.OWS.readServiceIdentification_), - 'ServiceProvider': ol.xml.makeObjectPropertySetter( - ol.format.OWS.readServiceProvider_), - 'OperationsMetadata': ol.xml.makeObjectPropertySetter( - ol.format.OWS.readOperationsMetadata_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.ADDRESS_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'DeliveryPoint': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'City': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'AdministrativeArea': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'PostalCode': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Country': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'ElectronicMailAddress': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.ALLOWED_VALUES_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'Value': ol.xml.makeObjectPropertyPusher(ol.format.OWS.readValue_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.CONSTRAINT_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'AllowedValues': ol.xml.makeObjectPropertySetter( - ol.format.OWS.readAllowedValues_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.CONTACT_INFO_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'Phone': ol.xml.makeObjectPropertySetter(ol.format.OWS.readPhone_), - 'Address': ol.xml.makeObjectPropertySetter(ol.format.OWS.readAddress_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.DCP_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'HTTP': ol.xml.makeObjectPropertySetter(ol.format.OWS.readHttp_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.HTTP_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'Get': ol.xml.makeObjectPropertyPusher(ol.format.OWS.readGet_), - 'Post': undefined // TODO - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.OPERATION_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'DCP': ol.xml.makeObjectPropertySetter(ol.format.OWS.readDcp_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.OPERATIONS_METADATA_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'Operation': ol.format.OWS.readOperation_ - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.PHONE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'Voice': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Facsimile': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'Constraint': ol.xml.makeObjectPropertyPusher( - ol.format.OWS.readConstraint_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.SERVICE_CONTACT_PARSERS_ = - ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'IndividualName': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'ContactInfo': ol.xml.makeObjectPropertySetter( - ol.format.OWS.readContactInfo_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ = - ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'ServiceTypeVersion': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.OWS.SERVICE_PROVIDER_PARSERS_ = - ol.xml.makeStructureNS( - ol.format.OWS.NAMESPACE_URIS_, { - 'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref), - 'ServiceContact': ol.xml.makeObjectPropertySetter( - ol.format.OWS.readServiceContact_) - }); - -goog.provide('ol.geom.flat.flip'); - -goog.require('goog.asserts'); - - -/** - * @param {Array.<number>} flatCoordinates Flat coordinates. - * @param {number} offset Offset. - * @param {number} end End. - * @param {number} stride Stride. - * @param {Array.<number>=} opt_dest Destination. - * @param {number=} opt_destOffset Destination offset. - * @return {Array.<number>} Flat coordinates. - */ -ol.geom.flat.flip.flipXY = - function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) { - var dest, destOffset; - if (opt_dest !== undefined) { - dest = opt_dest; - destOffset = opt_destOffset !== undefined ? opt_destOffset : 0; - } else { - goog.asserts.assert(opt_destOffset === undefined, - 'opt_destOffSet should be defined'); - dest = []; - destOffset = 0; - } - var j, k; - for (j = offset; j < end; ) { - var x = flatCoordinates[j++]; - dest[destOffset++] = flatCoordinates[j++]; - dest[destOffset++] = x; - for (k = 2; k < stride; ++k) { - dest[destOffset++] = flatCoordinates[j++]; - } - } - dest.length = destOffset; - return dest; -}; - -goog.provide('ol.format.Polyline'); - -goog.require('goog.asserts'); -goog.require('ol.Feature'); -goog.require('ol.format.Feature'); -goog.require('ol.format.TextFeature'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.flip'); -goog.require('ol.geom.flat.inflate'); -goog.require('ol.proj'); - - - -/** - * @classdesc - * Feature format for reading and writing data in the Encoded - * Polyline Algorithm Format. - * - * @constructor - * @extends {ol.format.TextFeature} - * @param {olx.format.PolylineOptions=} opt_options - * Optional configuration object. - * @api stable - */ -ol.format.Polyline = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this); - - /** - * @inheritDoc - */ - this.defaultDataProjection = ol.proj.get('EPSG:4326'); - - /** - * @private - * @type {number} - */ - this.factor_ = options.factor ? options.factor : 1e5; - - /** - * @private - * @type {ol.geom.GeometryLayout} - */ - this.geometryLayout_ = options.geometryLayout ? - options.geometryLayout : ol.geom.GeometryLayout.XY; -}; -goog.inherits(ol.format.Polyline, ol.format.TextFeature); - - -/** - * Encode a list of n-dimensional points and return an encoded string - * - * Attention: This function will modify the passed array! - * - * @param {Array.<number>} numbers A list of n-dimensional points. - * @param {number} stride The number of dimension of the points in the list. - * @param {number=} opt_factor The factor by which the numbers will be - * multiplied. The remaining decimal places will get rounded away. - * Default is `1e5`. - * @return {string} The encoded string. - * @api - */ -ol.format.Polyline.encodeDeltas = function(numbers, stride, opt_factor) { - var factor = opt_factor ? opt_factor : 1e5; - var d; - - var lastNumbers = new Array(stride); - for (d = 0; d < stride; ++d) { - lastNumbers[d] = 0; - } - - var i, ii; - for (i = 0, ii = numbers.length; i < ii;) { - for (d = 0; d < stride; ++d, ++i) { - var num = numbers[i]; - var delta = num - lastNumbers[d]; - lastNumbers[d] = num; - - numbers[i] = delta; - } - } - - return ol.format.Polyline.encodeFloats(numbers, factor); -}; - - -/** - * Decode a list of n-dimensional points from an encoded string - * - * @param {string} encoded An encoded string. - * @param {number} stride The number of dimension of the points in the - * encoded string. - * @param {number=} opt_factor The factor by which the resulting numbers will - * be divided. Default is `1e5`. - * @return {Array.<number>} A list of n-dimensional points. - * @api - */ -ol.format.Polyline.decodeDeltas = function(encoded, stride, opt_factor) { - var factor = opt_factor ? opt_factor : 1e5; - var d; - - /** @type {Array.<number>} */ - var lastNumbers = new Array(stride); - for (d = 0; d < stride; ++d) { - lastNumbers[d] = 0; - } - - var numbers = ol.format.Polyline.decodeFloats(encoded, factor); - - var i, ii; - for (i = 0, ii = numbers.length; i < ii;) { - for (d = 0; d < stride; ++d, ++i) { - lastNumbers[d] += numbers[i]; - - numbers[i] = lastNumbers[d]; - } - } - - return numbers; -}; - - -/** - * Encode a list of floating point numbers and return an encoded string - * - * Attention: This function will modify the passed array! - * - * @param {Array.<number>} numbers A list of floating point numbers. - * @param {number=} opt_factor The factor by which the numbers will be - * multiplied. The remaining decimal places will get rounded away. - * Default is `1e5`. - * @return {string} The encoded string. - * @api - */ -ol.format.Polyline.encodeFloats = function(numbers, opt_factor) { - var factor = opt_factor ? opt_factor : 1e5; - var i, ii; - for (i = 0, ii = numbers.length; i < ii; ++i) { - numbers[i] = Math.round(numbers[i] * factor); - } - - return ol.format.Polyline.encodeSignedIntegers(numbers); -}; - - -/** - * Decode a list of floating point numbers from an encoded string - * - * @param {string} encoded An encoded string. - * @param {number=} opt_factor The factor by which the result will be divided. - * Default is `1e5`. - * @return {Array.<number>} A list of floating point numbers. - * @api - */ -ol.format.Polyline.decodeFloats = function(encoded, opt_factor) { - var factor = opt_factor ? opt_factor : 1e5; - var numbers = ol.format.Polyline.decodeSignedIntegers(encoded); - var i, ii; - for (i = 0, ii = numbers.length; i < ii; ++i) { - numbers[i] /= factor; - } - return numbers; -}; - - -/** - * Encode a list of signed integers and return an encoded string - * - * Attention: This function will modify the passed array! - * - * @param {Array.<number>} numbers A list of signed integers. - * @return {string} The encoded string. - */ -ol.format.Polyline.encodeSignedIntegers = function(numbers) { - var i, ii; - for (i = 0, ii = numbers.length; i < ii; ++i) { - var num = numbers[i]; - numbers[i] = (num < 0) ? ~(num << 1) : (num << 1); - } - return ol.format.Polyline.encodeUnsignedIntegers(numbers); -}; - - -/** - * Decode a list of signed integers from an encoded string - * - * @param {string} encoded An encoded string. - * @return {Array.<number>} A list of signed integers. - */ -ol.format.Polyline.decodeSignedIntegers = function(encoded) { - var numbers = ol.format.Polyline.decodeUnsignedIntegers(encoded); - var i, ii; - for (i = 0, ii = numbers.length; i < ii; ++i) { - var num = numbers[i]; - numbers[i] = (num & 1) ? ~(num >> 1) : (num >> 1); - } - return numbers; -}; - - -/** - * Encode a list of unsigned integers and return an encoded string - * - * @param {Array.<number>} numbers A list of unsigned integers. - * @return {string} The encoded string. - */ -ol.format.Polyline.encodeUnsignedIntegers = function(numbers) { - var encoded = ''; - var i, ii; - for (i = 0, ii = numbers.length; i < ii; ++i) { - encoded += ol.format.Polyline.encodeUnsignedInteger(numbers[i]); - } - return encoded; -}; - - -/** - * Decode a list of unsigned integers from an encoded string - * - * @param {string} encoded An encoded string. - * @return {Array.<number>} A list of unsigned integers. - */ -ol.format.Polyline.decodeUnsignedIntegers = function(encoded) { - var numbers = []; - var current = 0; - var shift = 0; - var i, ii; - for (i = 0, ii = encoded.length; i < ii; ++i) { - var b = encoded.charCodeAt(i) - 63; - current |= (b & 0x1f) << shift; - if (b < 0x20) { - numbers.push(current); - current = 0; - shift = 0; - } else { - shift += 5; - } - } - return numbers; -}; - - -/** - * Encode one single unsigned integer and return an encoded string - * - * @param {number} num Unsigned integer that should be encoded. - * @return {string} The encoded string. - */ -ol.format.Polyline.encodeUnsignedInteger = function(num) { - var value, encoded = ''; - while (num >= 0x20) { - value = (0x20 | (num & 0x1f)) + 63; - encoded += String.fromCharCode(value); - num >>= 5; - } - value = num + 63; - encoded += String.fromCharCode(value); - return encoded; -}; - - -/** - * Read the feature from the Polyline source. The coordinates are assumed to be - * in two dimensions and in latitude, longitude order. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - * @api stable - */ -ol.format.Polyline.prototype.readFeature; - - -/** - * @inheritDoc - */ -ol.format.Polyline.prototype.readFeatureFromText = function(text, opt_options) { - var geometry = this.readGeometryFromText(text, opt_options); - return new ol.Feature(geometry); -}; - - -/** - * Read the feature from the source. As Polyline sources contain a single - * feature, this will return the feature in an array. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.Polyline.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.Polyline.prototype.readFeaturesFromText = - function(text, opt_options) { - var feature = this.readFeatureFromText(text, opt_options); - return [feature]; -}; - - -/** - * Read the geometry from the source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.geom.Geometry} Geometry. - * @api stable - */ -ol.format.Polyline.prototype.readGeometry; - - -/** - * @inheritDoc - */ -ol.format.Polyline.prototype.readGeometryFromText = - function(text, opt_options) { - var stride = ol.geom.SimpleGeometry.getStrideForLayout(this.geometryLayout_); - var flatCoordinates = ol.format.Polyline.decodeDeltas( - text, stride, this.factor_); - ol.geom.flat.flip.flipXY( - flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates); - var coordinates = ol.geom.flat.inflate.coordinates( - flatCoordinates, 0, flatCoordinates.length, stride); - - return /** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions( - new ol.geom.LineString(coordinates, this.geometryLayout_), false, - this.adaptOptions(opt_options))); -}; - - -/** - * Read the projection from a Polyline source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {ol.proj.Projection} Projection. - * @api stable - */ -ol.format.Polyline.prototype.readProjection; - - -/** - * @inheritDoc - */ -ol.format.Polyline.prototype.writeFeatureText = function(feature, opt_options) { - var geometry = feature.getGeometry(); - if (geometry) { - return this.writeGeometryText(geometry, opt_options); - } else { - goog.asserts.fail('geometry needs to be defined'); - return ''; - } -}; - - -/** - * @inheritDoc - */ -ol.format.Polyline.prototype.writeFeaturesText = - function(features, opt_options) { - goog.asserts.assert(features.length == 1, - 'features array should have 1 item'); - return this.writeFeatureText(features[0], opt_options); -}; - - -/** - * Write a single geometry in Polyline format. - * - * @function - * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} Geometry. - * @api stable - */ -ol.format.Polyline.prototype.writeGeometry; - - -/** - * @inheritDoc - */ -ol.format.Polyline.prototype.writeGeometryText = - function(geometry, opt_options) { - goog.asserts.assertInstanceof(geometry, ol.geom.LineString, - 'geometry should be an ol.geom.LineString'); - geometry = /** @type {ol.geom.LineString} */ - (ol.format.Feature.transformWithOptions( - geometry, true, this.adaptOptions(opt_options))); - var flatCoordinates = geometry.getFlatCoordinates(); - var stride = geometry.getStride(); - ol.geom.flat.flip.flipXY( - flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates); - return ol.format.Polyline.encodeDeltas(flatCoordinates, stride, this.factor_); -}; - -goog.provide('ol.format.TopoJSON'); - -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol.Feature'); -goog.require('ol.format.Feature'); -goog.require('ol.format.JSONFeature'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.proj'); - - - -/** - * @classdesc - * Feature format for reading data in the TopoJSON format. - * - * @constructor - * @extends {ol.format.JSONFeature} - * @param {olx.format.TopoJSONOptions=} opt_options Options. - * @api stable - */ -ol.format.TopoJSON = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this); - - /** - * @inheritDoc - */ - this.defaultDataProjection = ol.proj.get( - options.defaultDataProjection ? - options.defaultDataProjection : 'EPSG:4326'); - -}; -goog.inherits(ol.format.TopoJSON, ol.format.JSONFeature); - - -/** - * @const {Array.<string>} - * @private - */ -ol.format.TopoJSON.EXTENSIONS_ = ['.topojson']; - - -/** - * Concatenate arcs into a coordinate array. - * @param {Array.<number>} indices Indices of arcs to concatenate. Negative - * values indicate arcs need to be reversed. - * @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs (already - * transformed). - * @return {Array.<ol.Coordinate>} Coordinates array. - * @private - */ -ol.format.TopoJSON.concatenateArcs_ = function(indices, arcs) { - /** @type {Array.<ol.Coordinate>} */ - var coordinates = []; - var index, arc; - var i, ii; - var j, jj; - for (i = 0, ii = indices.length; i < ii; ++i) { - index = indices[i]; - if (i > 0) { - // splicing together arcs, discard last point - coordinates.pop(); - } - if (index >= 0) { - // forward arc - arc = arcs[index]; - } else { - // reverse arc - arc = arcs[~index].slice().reverse(); - } - coordinates.push.apply(coordinates, arc); - } - // provide fresh copies of coordinate arrays - for (j = 0, jj = coordinates.length; j < jj; ++j) { - coordinates[j] = coordinates[j].slice(); - } - return coordinates; -}; - - -/** - * Create a point from a TopoJSON geometry object. - * - * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.<number>} scale Scale for each dimension. - * @param {Array.<number>} translate Translation for each dimension. - * @return {ol.geom.Point} Geometry. - * @private - */ -ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) { - var coordinates = object.coordinates; - if (scale && translate) { - ol.format.TopoJSON.transformVertex_(coordinates, scale, translate); - } - return new ol.geom.Point(coordinates); -}; - - -/** - * Create a multi-point from a TopoJSON geometry object. - * - * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.<number>} scale Scale for each dimension. - * @param {Array.<number>} translate Translation for each dimension. - * @return {ol.geom.MultiPoint} Geometry. - * @private - */ -ol.format.TopoJSON.readMultiPointGeometry_ = function(object, scale, - translate) { - var coordinates = object.coordinates; - var i, ii; - if (scale && translate) { - for (i = 0, ii = coordinates.length; i < ii; ++i) { - ol.format.TopoJSON.transformVertex_(coordinates[i], scale, translate); - } - } - return new ol.geom.MultiPoint(coordinates); -}; - - -/** - * Create a linestring from a TopoJSON geometry object. - * - * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs. - * @return {ol.geom.LineString} Geometry. - * @private - */ -ol.format.TopoJSON.readLineStringGeometry_ = function(object, arcs) { - var coordinates = ol.format.TopoJSON.concatenateArcs_(object.arcs, arcs); - return new ol.geom.LineString(coordinates); -}; - - -/** - * Create a multi-linestring from a TopoJSON geometry object. - * - * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs. - * @return {ol.geom.MultiLineString} Geometry. - * @private - */ -ol.format.TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) { - var coordinates = []; - var i, ii; - for (i = 0, ii = object.arcs.length; i < ii; ++i) { - coordinates[i] = ol.format.TopoJSON.concatenateArcs_(object.arcs[i], arcs); - } - return new ol.geom.MultiLineString(coordinates); -}; - - -/** - * Create a polygon from a TopoJSON geometry object. - * - * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs. - * @return {ol.geom.Polygon} Geometry. - * @private - */ -ol.format.TopoJSON.readPolygonGeometry_ = function(object, arcs) { - var coordinates = []; - var i, ii; - for (i = 0, ii = object.arcs.length; i < ii; ++i) { - coordinates[i] = ol.format.TopoJSON.concatenateArcs_(object.arcs[i], arcs); - } - return new ol.geom.Polygon(coordinates); -}; - - -/** - * Create a multi-polygon from a TopoJSON geometry object. - * - * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs. - * @return {ol.geom.MultiPolygon} Geometry. - * @private - */ -ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) { - var coordinates = []; - var polyArray, ringCoords, j, jj; - var i, ii; - for (i = 0, ii = object.arcs.length; i < ii; ++i) { - // for each polygon - polyArray = object.arcs[i]; - ringCoords = []; - for (j = 0, jj = polyArray.length; j < jj; ++j) { - // for each ring - ringCoords[j] = ol.format.TopoJSON.concatenateArcs_(polyArray[j], arcs); - } - coordinates[i] = ringCoords; - } - return new ol.geom.MultiPolygon(coordinates); -}; - - -/** - * @inheritDoc - */ -ol.format.TopoJSON.prototype.getExtensions = function() { - return ol.format.TopoJSON.EXTENSIONS_; -}; - - -/** - * Create features from a TopoJSON GeometryCollection object. - * - * @param {TopoJSONGeometryCollection} collection TopoJSON Geometry - * object. - * @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs. - * @param {Array.<number>} scale Scale for each dimension. - * @param {Array.<number>} translate Translation for each dimension. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Array of features. - * @private - */ -ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function( - collection, arcs, scale, translate, opt_options) { - var geometries = collection.geometries; - var features = []; - var i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { - features[i] = ol.format.TopoJSON.readFeatureFromGeometry_( - geometries[i], arcs, scale, translate, opt_options); - } - return features; -}; - - -/** - * Create a feature from a TopoJSON geometry object. - * - * @param {TopoJSONGeometry} object TopoJSON geometry object. - * @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs. - * @param {Array.<number>} scale Scale for each dimension. - * @param {Array.<number>} translate Translation for each dimension. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - * @private - */ -ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs, - scale, translate, opt_options) { - var geometry; - var type = object.type; - var geometryReader = ol.format.TopoJSON.GEOMETRY_READERS_[type]; - goog.asserts.assert(geometryReader, 'geometryReader should be defined'); - if ((type === 'Point') || (type === 'MultiPoint')) { - geometry = geometryReader(object, scale, translate); - } else { - geometry = geometryReader(object, arcs); - } - var feature = new ol.Feature(); - feature.setGeometry(/** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions(geometry, false, opt_options))); - if (object.id !== undefined) { - feature.setId(object.id); - } - if (object.properties) { - feature.setProperties(object.properties); - } - return feature; -}; - - -/** - * Read all features from a TopoJSON source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.TopoJSON.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.TopoJSON.prototype.readFeaturesFromObject = function( - object, opt_options) { - if (object.type == 'Topology') { - var topoJSONTopology = /** @type {TopoJSONTopology} */ (object); - var transform, scale = null, translate = null; - if (topoJSONTopology.transform) { - transform = topoJSONTopology.transform; - scale = transform.scale; - translate = transform.translate; - } - var arcs = topoJSONTopology.arcs; - if (transform) { - ol.format.TopoJSON.transformArcs_(arcs, scale, translate); - } - /** @type {Array.<ol.Feature>} */ - var features = []; - var topoJSONFeatures = goog.object.getValues(topoJSONTopology.objects); - var i, ii; - var feature; - for (i = 0, ii = topoJSONFeatures.length; i < ii; ++i) { - if (topoJSONFeatures[i].type === 'GeometryCollection') { - feature = /** @type {TopoJSONGeometryCollection} */ - (topoJSONFeatures[i]); - features.push.apply(features, - ol.format.TopoJSON.readFeaturesFromGeometryCollection_( - feature, arcs, scale, translate, opt_options)); - } else { - feature = /** @type {TopoJSONGeometry} */ - (topoJSONFeatures[i]); - features.push(ol.format.TopoJSON.readFeatureFromGeometry_( - feature, arcs, scale, translate, opt_options)); - } - } - return features; - } else { - return []; - } -}; - - -/** - * Apply a linear transform to array of arcs. The provided array of arcs is - * modified in place. - * - * @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs. - * @param {Array.<number>} scale Scale for each dimension. - * @param {Array.<number>} translate Translation for each dimension. - * @private - */ -ol.format.TopoJSON.transformArcs_ = function(arcs, scale, translate) { - var i, ii; - for (i = 0, ii = arcs.length; i < ii; ++i) { - ol.format.TopoJSON.transformArc_(arcs[i], scale, translate); - } -}; - - -/** - * Apply a linear transform to an arc. The provided arc is modified in place. - * - * @param {Array.<ol.Coordinate>} arc Arc. - * @param {Array.<number>} scale Scale for each dimension. - * @param {Array.<number>} translate Translation for each dimension. - * @private - */ -ol.format.TopoJSON.transformArc_ = function(arc, scale, translate) { - var x = 0; - var y = 0; - var vertex; - var i, ii; - for (i = 0, ii = arc.length; i < ii; ++i) { - vertex = arc[i]; - x += vertex[0]; - y += vertex[1]; - vertex[0] = x; - vertex[1] = y; - ol.format.TopoJSON.transformVertex_(vertex, scale, translate); - } -}; - - -/** - * Apply a linear transform to a vertex. The provided vertex is modified in - * place. - * - * @param {ol.Coordinate} vertex Vertex. - * @param {Array.<number>} scale Scale for each dimension. - * @param {Array.<number>} translate Translation for each dimension. - * @private - */ -ol.format.TopoJSON.transformVertex_ = function(vertex, scale, translate) { - vertex[0] = vertex[0] * scale[0] + translate[0]; - vertex[1] = vertex[1] * scale[1] + translate[1]; -}; - - -/** - * Read the projection from a TopoJSON source. - * - * @function - * @param {Document|Node|Object|string} object Source. - * @return {ol.proj.Projection} Projection. - * @api stable - */ -ol.format.TopoJSON.prototype.readProjection = function(object) { - return this.defaultDataProjection; -}; - - -/** - * @const - * @private - * @type {Object.<string, function(TopoJSONGeometry, Array, ...Array): ol.geom.Geometry>} - */ -ol.format.TopoJSON.GEOMETRY_READERS_ = { - 'Point': ol.format.TopoJSON.readPointGeometry_, - 'LineString': ol.format.TopoJSON.readLineStringGeometry_, - 'Polygon': ol.format.TopoJSON.readPolygonGeometry_, - 'MultiPoint': ol.format.TopoJSON.readMultiPointGeometry_, - 'MultiLineString': ol.format.TopoJSON.readMultiLineStringGeometry_, - 'MultiPolygon': ol.format.TopoJSON.readMultiPolygonGeometry_ -}; - -goog.provide('ol.format.WFS'); - -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.format.GML3'); -goog.require('ol.format.GMLBase'); -goog.require('ol.format.XMLFeature'); -goog.require('ol.format.XSD'); -goog.require('ol.geom.Geometry'); -goog.require('ol.proj'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Feature format for reading and writing data in the WFS format. - * By default, supports WFS version 1.1.0. You can pass a GML format - * as option if you want to read a WFS that contains GML2 (WFS 1.0.0). - * Also see {@link ol.format.GMLBase} which is used by this format. - * - * @constructor - * @param {olx.format.WFSOptions=} opt_options - * Optional configuration object. - * @extends {ol.format.XMLFeature} - * @api stable - */ -ol.format.WFS = function(opt_options) { - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {Array.<string>|string|undefined} - */ - this.featureType_ = options.featureType; - - /** - * @private - * @type {Object.<string, string>|string|undefined} - */ - this.featureNS_ = options.featureNS; - - /** - * @private - * @type {ol.format.GMLBase} - */ - this.gmlFormat_ = options.gmlFormat ? - options.gmlFormat : new ol.format.GML3(); - - /** - * @private - * @type {string} - */ - this.schemaLocation_ = options.schemaLocation ? - options.schemaLocation : ol.format.WFS.SCHEMA_LOCATION; - - goog.base(this); -}; -goog.inherits(ol.format.WFS, ol.format.XMLFeature); - - -/** - * @const - * @type {string} - */ -ol.format.WFS.FEATURE_PREFIX = 'feature'; - - -/** - * @const - * @type {string} - */ -ol.format.WFS.XMLNS = 'http://www.w3.org/2000/xmlns/'; - - -/** - * Number of features; bounds/extent. - * @typedef {{numberOfFeatures: number, - * bounds: ol.Extent}} - * @api stable - */ -ol.format.WFS.FeatureCollectionMetadata; - - -/** - * Total deleted; total inserted; total updated; array of insert ids. - * @typedef {{totalDeleted: number, - * totalInserted: number, - * totalUpdated: number, - * insertIds: Array.<string>}} - * @api stable - */ -ol.format.WFS.TransactionResponse; - - -/** - * @const - * @type {string} - */ -ol.format.WFS.SCHEMA_LOCATION = 'http://www.opengis.net/wfs ' + - 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd'; - - -/** - * Read all features from a WFS FeatureCollection. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.WFS.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) { - var context = { - 'featureType': this.featureType_, - 'featureNS': this.featureNS_ - }; - goog.object.extend(context, this.getReadOptions(node, - opt_options ? opt_options : {})); - var objectStack = [context]; - this.gmlFormat_.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS][ - 'featureMember'] = - ol.xml.makeArrayPusher(ol.format.GMLBase.prototype.readFeaturesInternal); - var features = ol.xml.pushParseAndPop([], - this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node, - objectStack, this.gmlFormat_); - if (!features) { - features = []; - } - return features; -}; - - -/** - * Read transaction response of the source. - * - * @param {Document|Node|Object|string} source Source. - * @return {ol.format.WFS.TransactionResponse|undefined} Transaction response. - * @api stable - */ -ol.format.WFS.prototype.readTransactionResponse = function(source) { - if (ol.xml.isDocument(source)) { - return this.readTransactionResponseFromDocument( - /** @type {Document} */ (source)); - } else if (ol.xml.isNode(source)) { - return this.readTransactionResponseFromNode(/** @type {Node} */ (source)); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - return this.readTransactionResponseFromDocument(doc); - } else { - goog.asserts.fail('Unknown source type'); - return undefined; - } -}; - - -/** - * Read feature collection metadata of the source. - * - * @param {Document|Node|Object|string} source Source. - * @return {ol.format.WFS.FeatureCollectionMetadata|undefined} - * FeatureCollection metadata. - * @api stable - */ -ol.format.WFS.prototype.readFeatureCollectionMetadata = function(source) { - if (ol.xml.isDocument(source)) { - return this.readFeatureCollectionMetadataFromDocument( - /** @type {Document} */ (source)); - } else if (ol.xml.isNode(source)) { - return this.readFeatureCollectionMetadataFromNode( - /** @type {Node} */ (source)); - } else if (goog.isString(source)) { - var doc = ol.xml.parse(source); - return this.readFeatureCollectionMetadataFromDocument(doc); - } else { - goog.asserts.fail('Unknown source type'); - return undefined; - } -}; - - -/** - * @param {Document} doc Document. - * @return {ol.format.WFS.FeatureCollectionMetadata|undefined} - * FeatureCollection metadata. - */ -ol.format.WFS.prototype.readFeatureCollectionMetadataFromDocument = - function(doc) { - goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, - 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - return this.readFeatureCollectionMetadataFromNode(n); - } - } - return undefined; -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WFS.FEATURE_COLLECTION_PARSERS_ = { - 'http://www.opengis.net/gml': { - 'boundedBy': ol.xml.makeObjectPropertySetter( - ol.format.GMLBase.prototype.readGeometryElement, 'bounds') - } -}; - - -/** - * @param {Node} node Node. - * @return {ol.format.WFS.FeatureCollectionMetadata|undefined} - * FeatureCollection metadata. - */ -ol.format.WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'FeatureCollection', - 'localName should be FeatureCollection'); - var result = {}; - var value = ol.format.XSD.readNonNegativeIntegerString( - node.getAttribute('numberOfFeatures')); - result['numberOfFeatures'] = value; - return ol.xml.pushParseAndPop( - /** @type {ol.format.WFS.FeatureCollectionMetadata} */ (result), - ol.format.WFS.FEATURE_COLLECTION_PARSERS_, node, [], this.gmlFormat_); -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WFS.TRANSACTION_SUMMARY_PARSERS_ = { - 'http://www.opengis.net/wfs': { - 'totalInserted': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger), - 'totalUpdated': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger), - 'totalDeleted': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger) - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Transaction Summary. - * @private - */ -ol.format.WFS.readTransactionSummary_ = function(node, objectStack) { - return ol.xml.pushParseAndPop( - {}, ol.format.WFS.TRANSACTION_SUMMARY_PARSERS_, node, objectStack); -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WFS.OGC_FID_PARSERS_ = { - 'http://www.opengis.net/ogc': { - 'FeatureId': ol.xml.makeArrayPusher(function(node, objectStack) { - return node.getAttribute('fid'); - }) - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - */ -ol.format.WFS.fidParser_ = function(node, objectStack) { - ol.xml.parseNode(ol.format.WFS.OGC_FID_PARSERS_, node, objectStack); -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WFS.INSERT_RESULTS_PARSERS_ = { - 'http://www.opengis.net/wfs': { - 'Feature': ol.format.WFS.fidParser_ - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Array.<string>|undefined} Insert results. - * @private - */ -ol.format.WFS.readInsertResults_ = function(node, objectStack) { - return ol.xml.pushParseAndPop( - [], ol.format.WFS.INSERT_RESULTS_PARSERS_, node, objectStack); -}; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WFS.TRANSACTION_RESPONSE_PARSERS_ = { - 'http://www.opengis.net/wfs': { - 'TransactionSummary': ol.xml.makeObjectPropertySetter( - ol.format.WFS.readTransactionSummary_, 'transactionSummary'), - 'InsertResults': ol.xml.makeObjectPropertySetter( - ol.format.WFS.readInsertResults_, 'insertIds') - } -}; - - -/** - * @param {Document} doc Document. - * @return {ol.format.WFS.TransactionResponse|undefined} Transaction response. - */ -ol.format.WFS.prototype.readTransactionResponseFromDocument = function(doc) { - goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, - 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - return this.readTransactionResponseFromNode(n); - } - } - return undefined; -}; - - -/** - * @param {Node} node Node. - * @return {ol.format.WFS.TransactionResponse|undefined} Transaction response. - */ -ol.format.WFS.prototype.readTransactionResponseFromNode = function(node) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'TransactionResponse', - 'localName should be TransactionResponse'); - return ol.xml.pushParseAndPop( - /** @type {ol.format.WFS.TransactionResponse} */({}), - ol.format.WFS.TRANSACTION_RESPONSE_PARSERS_, node, []); -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.WFS.QUERY_SERIALIZERS_ = { - 'http://www.opengis.net/wfs': { - 'PropertyName': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode) - } -}; - - -/** - * @param {Node} node Node. - * @param {ol.Feature} feature Feature. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeFeature_ = function(node, feature, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var featureType = context['featureType']; - var featureNS = context['featureNS']; - var child = ol.xml.createElementNS(featureNS, featureType); - node.appendChild(child); - ol.format.GML3.prototype.writeFeatureElement(child, feature, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {number|string} fid Feature identifier. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeOgcFidFilter_ = function(node, fid, objectStack) { - var filter = ol.xml.createElementNS('http://www.opengis.net/ogc', 'Filter'); - var child = ol.xml.createElementNS('http://www.opengis.net/ogc', 'FeatureId'); - filter.appendChild(child); - child.setAttribute('fid', fid); - node.appendChild(filter); -}; - - -/** - * @param {Node} node Node. - * @param {ol.Feature} feature Feature. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeDelete_ = function(node, feature, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var featureType = context['featureType']; - var featurePrefix = context['featurePrefix']; - featurePrefix = featurePrefix ? featurePrefix : - ol.format.WFS.FEATURE_PREFIX; - var featureNS = context['featureNS']; - node.setAttribute('typeName', featurePrefix + ':' + featureType); - ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix, - featureNS); - var fid = feature.getId(); - if (fid) { - ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack); - } -}; - - -/** - * @param {Node} node Node. - * @param {ol.Feature} feature Feature. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var featureType = context['featureType']; - var featurePrefix = context['featurePrefix']; - featurePrefix = featurePrefix ? featurePrefix : - ol.format.WFS.FEATURE_PREFIX; - var featureNS = context['featureNS']; - node.setAttribute('typeName', featurePrefix + ':' + featureType); - ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix, - featureNS); - var fid = feature.getId(); - if (fid) { - var keys = feature.getKeys(); - var values = []; - for (var i = 0, ii = keys.length; i < ii; i++) { - var value = feature.get(keys[i]); - if (value !== undefined) { - values.push({name: keys[i], value: value}); - } - } - ol.xml.pushSerializeAndPop({node: node, srsName: - context['srsName']}, - ol.format.WFS.TRANSACTION_SERIALIZERS_, - ol.xml.makeSimpleNodeFactory('Property'), values, - objectStack); - ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack); - } -}; - - -/** - * @param {Node} node Node. - * @param {Object} pair Property name and value. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeProperty_ = function(node, pair, objectStack) { - var name = ol.xml.createElementNS('http://www.opengis.net/wfs', 'Name'); - node.appendChild(name); - ol.format.XSD.writeStringTextNode(name, pair.name); - if (pair.value !== undefined && pair.value !== null) { - var value = ol.xml.createElementNS('http://www.opengis.net/wfs', 'Value'); - node.appendChild(value); - if (pair.value instanceof ol.geom.Geometry) { - ol.format.GML3.prototype.writeGeometryElement(value, - pair.value, objectStack); - } else { - ol.format.XSD.writeStringTextNode(value, pair.value); - } - } -}; - - -/** - * @param {Node} node Node. - * @param {{vendorId: string, safeToIgnore: boolean, value: string}} - * nativeElement The native element. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeNative_ = function(node, nativeElement, objectStack) { - if (nativeElement.vendorId) { - node.setAttribute('vendorId', nativeElement.vendorId); - } - if (nativeElement.safeToIgnore !== undefined) { - node.setAttribute('safeToIgnore', nativeElement.safeToIgnore); - } - if (nativeElement.value !== undefined) { - ol.format.XSD.writeStringTextNode(node, nativeElement.value); - } -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.WFS.TRANSACTION_SERIALIZERS_ = { - 'http://www.opengis.net/wfs': { - 'Insert': ol.xml.makeChildAppender(ol.format.WFS.writeFeature_), - 'Update': ol.xml.makeChildAppender(ol.format.WFS.writeUpdate_), - 'Delete': ol.xml.makeChildAppender(ol.format.WFS.writeDelete_), - 'Property': ol.xml.makeChildAppender(ol.format.WFS.writeProperty_), - 'Native': ol.xml.makeChildAppender(ol.format.WFS.writeNative_) - } -}; - - -/** - * @param {Node} node Node. - * @param {string} featureType Feature type. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var featurePrefix = context['featurePrefix']; - var featureNS = context['featureNS']; - var propertyNames = context['propertyNames']; - var srsName = context['srsName']; - var prefix = featurePrefix ? featurePrefix + ':' : ''; - node.setAttribute('typeName', prefix + featureType); - if (srsName) { - node.setAttribute('srsName', srsName); - } - if (featureNS) { - ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix, - featureNS); - } - var item = goog.object.clone(context); - item.node = node; - ol.xml.pushSerializeAndPop(item, - ol.format.WFS.QUERY_SERIALIZERS_, - ol.xml.makeSimpleNodeFactory('PropertyName'), propertyNames, - objectStack); - var bbox = context['bbox']; - if (bbox) { - var child = ol.xml.createElementNS('http://www.opengis.net/ogc', 'Filter'); - ol.format.WFS.writeOgcBBOX_(child, bbox, objectStack); - node.appendChild(child); - } -}; - - -/** - * @param {Node} node Node. - * @param {string} value PropertyName value. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeOgcPropertyName_ = function(node, value, objectStack) { - var property = ol.xml.createElementNS('http://www.opengis.net/ogc', - 'PropertyName'); - ol.format.XSD.writeStringTextNode(property, value); - node.appendChild(property); -}; - - -/** - * @param {Node} node Node. - * @param {ol.Extent} bbox Bounding box. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeOgcBBOX_ = function(node, bbox, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var geometryName = context['geometryName']; - var bboxNode = ol.xml.createElementNS('http://www.opengis.net/ogc', 'BBOX'); - node.appendChild(bboxNode); - ol.format.WFS.writeOgcPropertyName_(bboxNode, geometryName, objectStack); - ol.format.GML3.prototype.writeGeometryElement(bboxNode, bbox, objectStack); -}; - - -/** - * @type {Object.<string, Object.<string, ol.xml.Serializer>>} - * @private - */ -ol.format.WFS.GETFEATURE_SERIALIZERS_ = { - 'http://www.opengis.net/wfs': { - 'Query': ol.xml.makeChildAppender( - ol.format.WFS.writeQuery_) - } -}; - - -/** - * @param {Node} node Node. - * @param {Array.<{string}>} featureTypes Feature types. - * @param {Array.<*>} objectStack Node stack. - * @private - */ -ol.format.WFS.writeGetFeature_ = function(node, featureTypes, objectStack) { - var context = objectStack[objectStack.length - 1]; - goog.asserts.assert(goog.isObject(context), 'context should be an Object'); - var item = goog.object.clone(context); - item.node = node; - ol.xml.pushSerializeAndPop(item, - ol.format.WFS.GETFEATURE_SERIALIZERS_, - ol.xml.makeSimpleNodeFactory('Query'), featureTypes, - objectStack); -}; - - -/** - * Encode format as WFS `GetFeature` and return the Node. - * - * @param {olx.format.WFSWriteGetFeatureOptions} options Options. - * @return {Node} Result. - * @api stable - */ -ol.format.WFS.prototype.writeGetFeature = function(options) { - var node = ol.xml.createElementNS('http://www.opengis.net/wfs', - 'GetFeature'); - node.setAttribute('service', 'WFS'); - node.setAttribute('version', '1.1.0'); - if (options) { - if (options.handle) { - node.setAttribute('handle', options.handle); - } - if (options.outputFormat) { - node.setAttribute('outputFormat', options.outputFormat); - } - if (options.maxFeatures !== undefined) { - node.setAttribute('maxFeatures', options.maxFeatures); - } - if (options.resultType) { - node.setAttribute('resultType', options.resultType); - } - if (options.startIndex !== undefined) { - node.setAttribute('startIndex', options.startIndex); - } - if (options.count !== undefined) { - node.setAttribute('count', options.count); - } - } - ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:schemaLocation', this.schemaLocation_); - var context = { - node: node, - srsName: options.srsName, - featureNS: options.featureNS ? options.featureNS : this.featureNS_, - featurePrefix: options.featurePrefix, - geometryName: options.geometryName, - bbox: options.bbox, - propertyNames: options.propertyNames ? options.propertyNames : [] - }; - goog.asserts.assert(goog.isArray(options.featureTypes), - 'options.featureTypes should be an array'); - ol.format.WFS.writeGetFeature_(node, options.featureTypes, [context]); - return node; -}; - - -/** - * Encode format as WFS `Transaction` and return the Node. - * - * @param {Array.<ol.Feature>} inserts The features to insert. - * @param {Array.<ol.Feature>} updates The features to update. - * @param {Array.<ol.Feature>} deletes The features to delete. - * @param {olx.format.WFSWriteTransactionOptions} options Write options. - * @return {Node} Result. - * @api stable - */ -ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes, - options) { - var objectStack = []; - var node = ol.xml.createElementNS('http://www.opengis.net/wfs', - 'Transaction'); - node.setAttribute('service', 'WFS'); - node.setAttribute('version', '1.1.0'); - var baseObj, obj; - if (options) { - baseObj = options.gmlOptions ? options.gmlOptions : {}; - if (options.handle) { - node.setAttribute('handle', options.handle); - } - } - ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:schemaLocation', this.schemaLocation_); - if (inserts) { - obj = {node: node, featureNS: options.featureNS, - featureType: options.featureType, featurePrefix: options.featurePrefix}; - goog.object.extend(obj, baseObj); - ol.xml.pushSerializeAndPop(obj, - ol.format.WFS.TRANSACTION_SERIALIZERS_, - ol.xml.makeSimpleNodeFactory('Insert'), inserts, - objectStack); - } - if (updates) { - obj = {node: node, featureNS: options.featureNS, - featureType: options.featureType, featurePrefix: options.featurePrefix}; - goog.object.extend(obj, baseObj); - ol.xml.pushSerializeAndPop(obj, - ol.format.WFS.TRANSACTION_SERIALIZERS_, - ol.xml.makeSimpleNodeFactory('Update'), updates, - objectStack); - } - if (deletes) { - ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS, - featureType: options.featureType, featurePrefix: options.featurePrefix}, - ol.format.WFS.TRANSACTION_SERIALIZERS_, - ol.xml.makeSimpleNodeFactory('Delete'), deletes, - objectStack); - } - if (options.nativeElements) { - ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS, - featureType: options.featureType, featurePrefix: options.featurePrefix}, - ol.format.WFS.TRANSACTION_SERIALIZERS_, - ol.xml.makeSimpleNodeFactory('Native'), options.nativeElements, - objectStack); - } - return node; -}; - - -/** - * Read the projection from a WFS source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {?ol.proj.Projection} Projection. - * @api stable - */ -ol.format.WFS.prototype.readProjection; - - -/** - * @inheritDoc - */ -ol.format.WFS.prototype.readProjectionFromDocument = function(doc) { - goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, - 'doc.nodeType should be a DOCUMENT'); - for (var n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - return this.readProjectionFromNode(n); - } - } - return null; -}; - - -/** - * @inheritDoc - */ -ol.format.WFS.prototype.readProjectionFromNode = function(node) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'FeatureCollection', - 'localName should be FeatureCollection'); - - if (node.firstElementChild && - node.firstElementChild.firstElementChild) { - node = node.firstElementChild.firstElementChild; - for (var n = node.firstElementChild; n; n = n.nextElementSibling) { - if (!(n.childNodes.length === 0 || - (n.childNodes.length === 1 && - n.firstChild.nodeType === 3))) { - var objectStack = [{}]; - this.gmlFormat_.readGeometryElement(n, objectStack); - return ol.proj.get(objectStack.pop().srsName); - } - } - } - - return null; -}; - -goog.provide('ol.format.WKT'); - -goog.require('goog.asserts'); -goog.require('ol'); -goog.require('ol.Feature'); -goog.require('ol.format.Feature'); -goog.require('ol.format.TextFeature'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryCollection'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); - - - -/** - * @classdesc - * Geometry format for reading and writing data in the `WellKnownText` (WKT) - * format. - * - * @constructor - * @extends {ol.format.TextFeature} - * @param {olx.format.WKTOptions=} opt_options Options. - * @api stable - */ -ol.format.WKT = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this); - - /** - * Split GeometryCollection into multiple features. - * @type {boolean} - * @private - */ - this.splitCollection_ = options.splitCollection !== undefined ? - options.splitCollection : false; - -}; -goog.inherits(ol.format.WKT, ol.format.TextFeature); - - -/** - * @const - * @type {string} - */ -ol.format.WKT.EMPTY = 'EMPTY'; - - -/** - * @param {ol.geom.Point} geom Point geometry. - * @return {string} Coordinates part of Point as WKT. - * @private - */ -ol.format.WKT.encodePointGeometry_ = function(geom) { - var coordinates = geom.getCoordinates(); - if (coordinates.length === 0) { - return ''; - } - return coordinates[0] + ' ' + coordinates[1]; -}; - - -/** - * @param {ol.geom.MultiPoint} geom MultiPoint geometry. - * @return {string} Coordinates part of MultiPoint as WKT. - * @private - */ -ol.format.WKT.encodeMultiPointGeometry_ = function(geom) { - var array = []; - var components = geom.getPoints(); - for (var i = 0, ii = components.length; i < ii; ++i) { - array.push('(' + ol.format.WKT.encodePointGeometry_(components[i]) + ')'); - } - return array.join(','); -}; - - -/** - * @param {ol.geom.GeometryCollection} geom GeometryCollection geometry. - * @return {string} Coordinates part of GeometryCollection as WKT. - * @private - */ -ol.format.WKT.encodeGeometryCollectionGeometry_ = function(geom) { - var array = []; - var geoms = geom.getGeometries(); - for (var i = 0, ii = geoms.length; i < ii; ++i) { - array.push(ol.format.WKT.encode_(geoms[i])); - } - return array.join(','); -}; - - -/** - * @param {ol.geom.LineString|ol.geom.LinearRing} geom LineString geometry. - * @return {string} Coordinates part of LineString as WKT. - * @private - */ -ol.format.WKT.encodeLineStringGeometry_ = function(geom) { - var coordinates = geom.getCoordinates(); - var array = []; - for (var i = 0, ii = coordinates.length; i < ii; ++i) { - array.push(coordinates[i][0] + ' ' + coordinates[i][1]); - } - return array.join(','); -}; - - -/** - * @param {ol.geom.MultiLineString} geom MultiLineString geometry. - * @return {string} Coordinates part of MultiLineString as WKT. - * @private - */ -ol.format.WKT.encodeMultiLineStringGeometry_ = function(geom) { - var array = []; - var components = geom.getLineStrings(); - for (var i = 0, ii = components.length; i < ii; ++i) { - array.push('(' + ol.format.WKT.encodeLineStringGeometry_( - components[i]) + ')'); - } - return array.join(','); -}; - - -/** - * @param {ol.geom.Polygon} geom Polygon geometry. - * @return {string} Coordinates part of Polygon as WKT. - * @private - */ -ol.format.WKT.encodePolygonGeometry_ = function(geom) { - var array = []; - var rings = geom.getLinearRings(); - for (var i = 0, ii = rings.length; i < ii; ++i) { - array.push('(' + ol.format.WKT.encodeLineStringGeometry_( - rings[i]) + ')'); - } - return array.join(','); -}; - - -/** - * @param {ol.geom.MultiPolygon} geom MultiPolygon geometry. - * @return {string} Coordinates part of MultiPolygon as WKT. - * @private - */ -ol.format.WKT.encodeMultiPolygonGeometry_ = function(geom) { - var array = []; - var components = geom.getPolygons(); - for (var i = 0, ii = components.length; i < ii; ++i) { - array.push('(' + ol.format.WKT.encodePolygonGeometry_( - components[i]) + ')'); - } - return array.join(','); -}; - - -/** - * Encode a geometry as WKT. - * @param {ol.geom.Geometry} geom The geometry to encode. - * @return {string} WKT string for the geometry. - * @private - */ -ol.format.WKT.encode_ = function(geom) { - var type = geom.getType(); - var geometryEncoder = ol.format.WKT.GeometryEncoder_[type]; - goog.asserts.assert(geometryEncoder, 'geometryEncoder should be defined'); - var enc = geometryEncoder(geom); - type = type.toUpperCase(); - if (enc.length === 0) { - return type + ' ' + ol.format.WKT.EMPTY; - } - return type + '(' + enc + ')'; -}; - - -/** - * @const - * @type {Object.<string, function(ol.geom.Geometry): string>} - * @private - */ -ol.format.WKT.GeometryEncoder_ = { - 'Point': ol.format.WKT.encodePointGeometry_, - 'LineString': ol.format.WKT.encodeLineStringGeometry_, - 'Polygon': ol.format.WKT.encodePolygonGeometry_, - 'MultiPoint': ol.format.WKT.encodeMultiPointGeometry_, - 'MultiLineString': ol.format.WKT.encodeMultiLineStringGeometry_, - 'MultiPolygon': ol.format.WKT.encodeMultiPolygonGeometry_, - 'GeometryCollection': ol.format.WKT.encodeGeometryCollectionGeometry_ -}; - - -/** - * Parse a WKT string. - * @param {string} wkt WKT string. - * @return {ol.geom.Geometry|ol.geom.GeometryCollection|undefined} - * The geometry created. - * @private - */ -ol.format.WKT.prototype.parse_ = function(wkt) { - var lexer = new ol.format.WKT.Lexer(wkt); - var parser = new ol.format.WKT.Parser(lexer); - return parser.parse(); -}; - - -/** - * Read a feature from a WKT source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.Feature} Feature. - * @api stable - */ -ol.format.WKT.prototype.readFeature; - - -/** - * @inheritDoc - */ -ol.format.WKT.prototype.readFeatureFromText = function(text, opt_options) { - var geom = this.readGeometryFromText(text, opt_options); - if (geom) { - var feature = new ol.Feature(); - feature.setGeometry(geom); - return feature; - } - return null; -}; - - -/** - * Read all features from a WKT source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.WKT.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.WKT.prototype.readFeaturesFromText = function(text, opt_options) { - var geometries = []; - var geometry = this.readGeometryFromText(text, opt_options); - if (this.splitCollection_ && - geometry.getType() == ol.geom.GeometryType.GEOMETRY_COLLECTION) { - geometries = (/** @type {ol.geom.GeometryCollection} */ (geometry)) - .getGeometriesArray(); - } else { - geometries = [geometry]; - } - var feature, features = []; - for (var i = 0, ii = geometries.length; i < ii; ++i) { - feature = new ol.Feature(); - feature.setGeometry(geometries[i]); - features.push(feature); - } - return features; -}; - - -/** - * Read a single geometry from a WKT source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. - * @return {ol.geom.Geometry} Geometry. - * @api stable - */ -ol.format.WKT.prototype.readGeometry; - - -/** - * @inheritDoc - */ -ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) { - var geometry = this.parse_(text); - if (geometry) { - return /** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions(geometry, false, opt_options)); - } else { - return null; - } -}; - - -/** - * Encode a feature as a WKT string. - * - * @function - * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} WKT string. - * @api stable - */ -ol.format.WKT.prototype.writeFeature; - - -/** - * @inheritDoc - */ -ol.format.WKT.prototype.writeFeatureText = function(feature, opt_options) { - var geometry = feature.getGeometry(); - if (geometry) { - return this.writeGeometryText(geometry, opt_options); - } - return ''; -}; - - -/** - * Encode an array of features as a WKT string. - * - * @function - * @param {Array.<ol.Feature>} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. - * @return {string} WKT string. - * @api stable - */ -ol.format.WKT.prototype.writeFeatures; - - -/** - * @inheritDoc - */ -ol.format.WKT.prototype.writeFeaturesText = function(features, opt_options) { - if (features.length == 1) { - return this.writeFeatureText(features[0], opt_options); - } - var geometries = []; - for (var i = 0, ii = features.length; i < ii; ++i) { - geometries.push(features[i].getGeometry()); - } - var collection = new ol.geom.GeometryCollection(geometries); - return this.writeGeometryText(collection, opt_options); -}; - - -/** - * Write a single geometry as a WKT string. - * - * @function - * @param {ol.geom.Geometry} geometry Geometry. - * @return {string} WKT string. - * @api stable - */ -ol.format.WKT.prototype.writeGeometry; - - -/** - * @inheritDoc - */ -ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) { - return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ ( - ol.format.Feature.transformWithOptions(geometry, true, opt_options))); -}; - - -/** - * @typedef {{type: number, value: (number|string|undefined), position: number}} - */ -ol.format.WKT.Token; - - -/** - * @const - * @enum {number} - */ -ol.format.WKT.TokenType = { - TEXT: 1, - LEFT_PAREN: 2, - RIGHT_PAREN: 3, - NUMBER: 4, - COMMA: 5, - EOF: 6 -}; - - - -/** - * Class to tokenize a WKT string. - * @param {string} wkt WKT string. - * @constructor - * @protected - */ -ol.format.WKT.Lexer = function(wkt) { - - /** - * @type {string} - */ - this.wkt = wkt; - - /** - * @type {number} - * @private - */ - this.index_ = -1; -}; - - -/** - * @param {string} c Character. - * @return {boolean} Whether the character is alphabetic. - * @private - */ -ol.format.WKT.Lexer.prototype.isAlpha_ = function(c) { - return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z'; -}; - - -/** - * @param {string} c Character. - * @param {boolean=} opt_decimal Whether the string number - * contains a dot, i.e. is a decimal number. - * @return {boolean} Whether the character is numeric. - * @private - */ -ol.format.WKT.Lexer.prototype.isNumeric_ = function(c, opt_decimal) { - var decimal = opt_decimal !== undefined ? opt_decimal : false; - return c >= '0' && c <= '9' || c == '.' && !decimal; -}; - - -/** - * @param {string} c Character. - * @return {boolean} Whether the character is whitespace. - * @private - */ -ol.format.WKT.Lexer.prototype.isWhiteSpace_ = function(c) { - return c == ' ' || c == '\t' || c == '\r' || c == '\n'; -}; - - -/** - * @return {string} Next string character. - * @private - */ -ol.format.WKT.Lexer.prototype.nextChar_ = function() { - return this.wkt.charAt(++this.index_); -}; - - -/** - * Fetch and return the next token. - * @return {!ol.format.WKT.Token} Next string token. - */ -ol.format.WKT.Lexer.prototype.nextToken = function() { - var c = this.nextChar_(); - var token = {position: this.index_, value: c}; - - if (c == '(') { - token.type = ol.format.WKT.TokenType.LEFT_PAREN; - } else if (c == ',') { - token.type = ol.format.WKT.TokenType.COMMA; - } else if (c == ')') { - token.type = ol.format.WKT.TokenType.RIGHT_PAREN; - } else if (this.isNumeric_(c) || c == '-') { - token.type = ol.format.WKT.TokenType.NUMBER; - token.value = this.readNumber_(); - } else if (this.isAlpha_(c)) { - token.type = ol.format.WKT.TokenType.TEXT; - token.value = this.readText_(); - } else if (this.isWhiteSpace_(c)) { - return this.nextToken(); - } else if (c === '') { - token.type = ol.format.WKT.TokenType.EOF; - } else { - throw new Error('Unexpected character: ' + c); - } - - return token; -}; - - -/** - * @return {number} Numeric token value. - * @private - */ -ol.format.WKT.Lexer.prototype.readNumber_ = function() { - var c, index = this.index_; - var decimal = false; - var scientificNotation = false; - do { - if (c == '.') { - decimal = true; - } else if (c == 'e' || c == 'E') { - scientificNotation = true; - } - c = this.nextChar_(); - } while ( - this.isNumeric_(c, decimal) || - // if we haven't detected a scientific number before, 'e' or 'E' - // hint that we should continue to read - !scientificNotation && (c == 'e' || c == 'E') || - // once we know that we have a scientific number, both '-' and '+' - // are allowed - scientificNotation && (c == '-' || c == '+') - ); - return parseFloat(this.wkt.substring(index, this.index_--)); -}; - - -/** - * @return {string} String token value. - * @private - */ -ol.format.WKT.Lexer.prototype.readText_ = function() { - var c, index = this.index_; - do { - c = this.nextChar_(); - } while (this.isAlpha_(c)); - return this.wkt.substring(index, this.index_--).toUpperCase(); -}; - - - -/** - * Class to parse the tokens from the WKT string. - * @param {ol.format.WKT.Lexer} lexer - * @constructor - * @protected - */ -ol.format.WKT.Parser = function(lexer) { - - /** - * @type {ol.format.WKT.Lexer} - * @private - */ - this.lexer_ = lexer; - - /** - * @type {ol.format.WKT.Token} - * @private - */ - this.token_; - - /** - * @type {number} - * @private - */ - this.dimension_ = 2; -}; - - -/** - * Fetch the next token form the lexer and replace the active token. - * @private - */ -ol.format.WKT.Parser.prototype.consume_ = function() { - this.token_ = this.lexer_.nextToken(); -}; - - -/** - * If the given type matches the current token, consume it. - * @param {ol.format.WKT.TokenType.<number>} type Token type. - * @return {boolean} Whether the token matches the given type. - */ -ol.format.WKT.Parser.prototype.match = function(type) { - var isMatch = this.token_.type == type; - if (isMatch) { - this.consume_(); - } - return isMatch; -}; - - -/** - * Try to parse the tokens provided by the lexer. - * @return {ol.geom.Geometry|ol.geom.GeometryCollection} The geometry. - */ -ol.format.WKT.Parser.prototype.parse = function() { - this.consume_(); - var geometry = this.parseGeometry_(); - goog.asserts.assert(this.token_.type == ol.format.WKT.TokenType.EOF, - 'token type should be end of file'); - return geometry; -}; - - -/** - * @return {!(ol.geom.Geometry|ol.geom.GeometryCollection)} The geometry. - * @private - */ -ol.format.WKT.Parser.prototype.parseGeometry_ = function() { - var token = this.token_; - if (this.match(ol.format.WKT.TokenType.TEXT)) { - var geomType = token.value; - if (geomType == ol.geom.GeometryType.GEOMETRY_COLLECTION.toUpperCase()) { - var geometries = this.parseGeometryCollectionText_(); - return new ol.geom.GeometryCollection(geometries); - } else { - var parser = ol.format.WKT.Parser.GeometryParser_[geomType]; - var ctor = ol.format.WKT.Parser.GeometryConstructor_[geomType]; - if (!parser || !ctor) { - throw new Error('Invalid geometry type: ' + geomType); - } - var coordinates = parser.call(this); - return new ctor(coordinates); - } - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {!Array.<ol.geom.Geometry>} A collection of geometries. - * @private - */ -ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() { - if (this.match(ol.format.WKT.TokenType.LEFT_PAREN)) { - var geometries = []; - do { - geometries.push(this.parseGeometry_()); - } while (this.match(ol.format.WKT.TokenType.COMMA)); - if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) { - return geometries; - } - } else if (this.isEmptyGeometry_()) { - return []; - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {Array.<number>} All values in a point. - * @private - */ -ol.format.WKT.Parser.prototype.parsePointText_ = function() { - if (this.match(ol.format.WKT.TokenType.LEFT_PAREN)) { - var coordinates = this.parsePoint_(); - if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) { - return coordinates; - } - } else if (this.isEmptyGeometry_()) { - return null; - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {!Array.<!Array.<number>>} All points in a linestring. - * @private - */ -ol.format.WKT.Parser.prototype.parseLineStringText_ = function() { - if (this.match(ol.format.WKT.TokenType.LEFT_PAREN)) { - var coordinates = this.parsePointList_(); - if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) { - return coordinates; - } - } else if (this.isEmptyGeometry_()) { - return []; - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {!Array.<!Array.<number>>} All points in a polygon. - * @private - */ -ol.format.WKT.Parser.prototype.parsePolygonText_ = function() { - if (this.match(ol.format.WKT.TokenType.LEFT_PAREN)) { - var coordinates = this.parseLineStringTextList_(); - if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) { - return coordinates; - } - } else if (this.isEmptyGeometry_()) { - return []; - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {!Array.<!Array.<number>>} All points in a multipoint. - * @private - */ -ol.format.WKT.Parser.prototype.parseMultiPointText_ = function() { - if (this.match(ol.format.WKT.TokenType.LEFT_PAREN)) { - var coordinates; - if (this.token_.type == ol.format.WKT.TokenType.LEFT_PAREN) { - coordinates = this.parsePointTextList_(); - } else { - coordinates = this.parsePointList_(); - } - if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) { - return coordinates; - } - } else if (this.isEmptyGeometry_()) { - return []; - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {!Array.<!Array.<number>>} All linestring points - * in a multilinestring. - * @private - */ -ol.format.WKT.Parser.prototype.parseMultiLineStringText_ = function() { - if (this.match(ol.format.WKT.TokenType.LEFT_PAREN)) { - var coordinates = this.parseLineStringTextList_(); - if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) { - return coordinates; - } - } else if (this.isEmptyGeometry_()) { - return []; - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {!Array.<!Array.<number>>} All polygon points in a multipolygon. - * @private - */ -ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() { - if (this.match(ol.format.WKT.TokenType.LEFT_PAREN)) { - var coordinates = this.parsePolygonTextList_(); - if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) { - return coordinates; - } - } else if (this.isEmptyGeometry_()) { - return []; - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {!Array.<number>} A point. - * @private - */ -ol.format.WKT.Parser.prototype.parsePoint_ = function() { - var coordinates = []; - for (var i = 0; i < this.dimension_; ++i) { - var token = this.token_; - if (this.match(ol.format.WKT.TokenType.NUMBER)) { - coordinates.push(token.value); - } else { - break; - } - } - if (coordinates.length == this.dimension_) { - return coordinates; - } - throw new Error(this.formatErrorMessage_()); -}; - - -/** - * @return {!Array.<!Array.<number>>} An array of points. - * @private - */ -ol.format.WKT.Parser.prototype.parsePointList_ = function() { - var coordinates = [this.parsePoint_()]; - while (this.match(ol.format.WKT.TokenType.COMMA)) { - coordinates.push(this.parsePoint_()); - } - return coordinates; -}; - - -/** - * @return {!Array.<!Array.<number>>} An array of points. - * @private - */ -ol.format.WKT.Parser.prototype.parsePointTextList_ = function() { - var coordinates = [this.parsePointText_()]; - while (this.match(ol.format.WKT.TokenType.COMMA)) { - coordinates.push(this.parsePointText_()); - } - return coordinates; -}; - - -/** - * @return {!Array.<!Array.<number>>} An array of points. - * @private - */ -ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() { - var coordinates = [this.parseLineStringText_()]; - while (this.match(ol.format.WKT.TokenType.COMMA)) { - coordinates.push(this.parseLineStringText_()); - } - return coordinates; -}; - - -/** - * @return {!Array.<!Array.<number>>} An array of points. - * @private - */ -ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() { - var coordinates = [this.parsePolygonText_()]; - while (this.match(ol.format.WKT.TokenType.COMMA)) { - coordinates.push(this.parsePolygonText_()); - } - return coordinates; -}; - - -/** - * @return {boolean} Whether the token implies an empty geometry. - * @private - */ -ol.format.WKT.Parser.prototype.isEmptyGeometry_ = function() { - var isEmpty = this.token_.type == ol.format.WKT.TokenType.TEXT && - this.token_.value == ol.format.WKT.EMPTY; - if (isEmpty) { - this.consume_(); - } - return isEmpty; -}; - - -/** - * Create an error message for an unexpected token error. - * @return {string} Error message. - * @private - */ -ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() { - return 'Unexpected `' + this.token_.value + '` at position ' + - this.token_.position + ' in `' + this.lexer_.wkt + '`'; -}; - - -/** - * @enum {function (new:ol.geom.Geometry, Array, ol.geom.GeometryLayout.<string>=)} - * @private - */ -ol.format.WKT.Parser.GeometryConstructor_ = { - 'POINT': ol.geom.Point, - 'LINESTRING': ol.geom.LineString, - 'POLYGON': ol.geom.Polygon, - 'MULTIPOINT': ol.geom.MultiPoint, - 'MULTILINESTRING': ol.geom.MultiLineString, - 'MULTIPOLYGON': ol.geom.MultiPolygon -}; - - -/** - * @enum {(function(): Array)} - * @private - */ -ol.format.WKT.Parser.GeometryParser_ = { - 'POINT': ol.format.WKT.Parser.prototype.parsePointText_, - 'LINESTRING': ol.format.WKT.Parser.prototype.parseLineStringText_, - 'POLYGON': ol.format.WKT.Parser.prototype.parsePolygonText_, - 'MULTIPOINT': ol.format.WKT.Parser.prototype.parseMultiPointText_, - 'MULTILINESTRING': ol.format.WKT.Parser.prototype.parseMultiLineStringText_, - 'MULTIPOLYGON': ol.format.WKT.Parser.prototype.parseMultiPolygonText_ -}; - -goog.provide('ol.format.WMSCapabilities'); - -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.format.XLink'); -goog.require('ol.format.XML'); -goog.require('ol.format.XSD'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Format for reading WMS capabilities data - * - * @constructor - * @extends {ol.format.XML} - * @api - */ -ol.format.WMSCapabilities = function() { - - goog.base(this); - - /** - * @type {string|undefined} - */ - this.version = undefined; -}; -goog.inherits(ol.format.WMSCapabilities, ol.format.XML); - - -/** - * Read a WMS capabilities document. - * - * @function - * @param {Document|Node|string} source The XML source. - * @return {Object} An object representing the WMS capabilities. - * @api - */ -ol.format.WMSCapabilities.prototype.read; - - -/** - * @param {Document} doc Document. - * @return {Object} WMS Capability object. - */ -ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) { - goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, - 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - return this.readFromNode(n); - } - } - return null; -}; - - -/** - * @param {Node} node Node. - * @return {Object} WMS Capability object. - */ -ol.format.WMSCapabilities.prototype.readFromNode = function(node) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'WMS_Capabilities' || - node.localName == 'WMT_MS_Capabilities', - 'localName should be WMS_Capabilities or WMT_MS_Capabilities'); - this.version = node.getAttribute('version').trim(); - goog.asserts.assertString(this.version, 'this.version should be a string'); - var wmsCapabilityObject = ol.xml.pushParseAndPop({ - 'version': this.version - }, ol.format.WMSCapabilities.PARSERS_, node, []); - return wmsCapabilityObject ? wmsCapabilityObject : null; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Attribution object. - */ -ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Attribution', - 'localName should be Attribution'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object} Bounding box object. - */ -ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'BoundingBox', - 'localName should be BoundingBox'); - - var extent = [ - ol.format.XSD.readDecimalString(node.getAttribute('minx')), - ol.format.XSD.readDecimalString(node.getAttribute('miny')), - ol.format.XSD.readDecimalString(node.getAttribute('maxx')), - ol.format.XSD.readDecimalString(node.getAttribute('maxy')) - ]; - - var resolutions = [ - ol.format.XSD.readDecimalString(node.getAttribute('resx')), - ol.format.XSD.readDecimalString(node.getAttribute('resy')) - ]; - - return { - 'crs': node.getAttribute('CRS'), - 'extent': extent, - 'res': resolutions - }; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.Extent|undefined} Bounding box object. - */ -ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'EX_GeographicBoundingBox', - 'localName should be EX_GeographicBoundingBox'); - var geographicBoundingBox = ol.xml.pushParseAndPop( - {}, - ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_, - node, objectStack); - if (!geographicBoundingBox) { - return undefined; - } - var westBoundLongitude = /** @type {number|undefined} */ - (geographicBoundingBox['westBoundLongitude']); - var southBoundLatitude = /** @type {number|undefined} */ - (geographicBoundingBox['southBoundLatitude']); - var eastBoundLongitude = /** @type {number|undefined} */ - (geographicBoundingBox['eastBoundLongitude']); - var northBoundLatitude = /** @type {number|undefined} */ - (geographicBoundingBox['northBoundLatitude']); - if (westBoundLongitude === undefined || southBoundLatitude === undefined || - eastBoundLongitude === undefined || northBoundLatitude === undefined) { - return undefined; - } - return /** @type {ol.Extent} */ ([ - westBoundLongitude, southBoundLatitude, - eastBoundLongitude, northBoundLatitude - ]); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Capability object. - */ -ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Capability', - 'localName should be Capability'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Service object. - */ -ol.format.WMSCapabilities.readService_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Service', - 'localName should be Service'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Contact information object. - */ -ol.format.WMSCapabilities.readContactInformation_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType shpuld be ELEMENT'); - goog.asserts.assert(node.localName == 'ContactInformation', - 'localName should be ContactInformation'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_, - node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Contact person object. - */ -ol.format.WMSCapabilities.readContactPersonPrimary_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'ContactPersonPrimary', - 'localName should be ContactPersonPrimary'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_, - node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Contact address object. - */ -ol.format.WMSCapabilities.readContactAddress_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'ContactAddress', - 'localName should be ContactAddress'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_, - node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.<string>|undefined} Format array. - */ -ol.format.WMSCapabilities.readException_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Exception', - 'localName should be Exception'); - return ol.xml.pushParseAndPop( - [], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack); -}; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Layer object. - */ -ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Layer', 'localName should be Layer'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Layer object. - */ -ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Layer', 'localName should be Layer'); - var parentLayerObject = /** @type {Object.<string,*>} */ - (objectStack[objectStack.length - 1]); - - var layerObject = /** @type {Object.<string,*>} */ (ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack)); - - if (!layerObject) { - return undefined; - } - var queryable = - ol.format.XSD.readBooleanString(node.getAttribute('queryable')); - if (queryable === undefined) { - queryable = parentLayerObject['queryable']; - } - layerObject['queryable'] = queryable !== undefined ? queryable : false; - - var cascaded = ol.format.XSD.readNonNegativeIntegerString( - node.getAttribute('cascaded')); - if (cascaded === undefined) { - cascaded = parentLayerObject['cascaded']; - } - layerObject['cascaded'] = cascaded; - - var opaque = ol.format.XSD.readBooleanString(node.getAttribute('opaque')); - if (opaque === undefined) { - opaque = parentLayerObject['opaque']; - } - layerObject['opaque'] = opaque !== undefined ? opaque : false; - - var noSubsets = - ol.format.XSD.readBooleanString(node.getAttribute('noSubsets')); - if (noSubsets === undefined) { - noSubsets = parentLayerObject['noSubsets']; - } - layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false; - - var fixedWidth = - ol.format.XSD.readDecimalString(node.getAttribute('fixedWidth')); - if (!fixedWidth) { - fixedWidth = parentLayerObject['fixedWidth']; - } - layerObject['fixedWidth'] = fixedWidth; - - var fixedHeight = - ol.format.XSD.readDecimalString(node.getAttribute('fixedHeight')); - if (!fixedHeight) { - fixedHeight = parentLayerObject['fixedHeight']; - } - layerObject['fixedHeight'] = fixedHeight; - - // See 7.2.4.8 - var addKeys = ['Style', 'CRS', 'AuthorityURL']; - addKeys.forEach(function(key) { - if (key in parentLayerObject) { - var childValue = goog.object.setIfUndefined(layerObject, key, []); - childValue = childValue.concat(parentLayerObject[key]); - layerObject[key] = childValue; - } - }); - - var replaceKeys = ['EX_GeographicBoundingBox', 'BoundingBox', 'Dimension', - 'Attribution', 'MinScaleDenominator', 'MaxScaleDenominator']; - replaceKeys.forEach(function(key) { - if (!(key in layerObject)) { - var parentValue = parentLayerObject[key]; - layerObject[key] = parentValue; - } - }); - - return layerObject; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object} Dimension object. - */ -ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Dimension', - 'localName should be Dimension'); - var dimensionObject = { - 'name': node.getAttribute('name'), - 'units': node.getAttribute('units'), - 'unitSymbol': node.getAttribute('unitSymbol'), - 'default': node.getAttribute('default'), - 'multipleValues': ol.format.XSD.readBooleanString( - node.getAttribute('multipleValues')), - 'nearestValue': ol.format.XSD.readBooleanString( - node.getAttribute('nearestValue')), - 'current': ol.format.XSD.readBooleanString(node.getAttribute('current')), - 'values': ol.format.XSD.readString(node) - }; - return dimensionObject; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Online resource object. - */ -ol.format.WMSCapabilities.readFormatOnlineresource_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_, - node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Request object. - */ -ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Request', - 'localName should be Request'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} DCP type object. - */ -ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'DCPType', - 'localName should be DCPType'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} HTTP object. - */ -ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'HTTP', 'localName should be HTTP'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Operation type object. - */ -ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Online resource object. - */ -ol.format.WMSCapabilities.readSizedFormatOnlineresource_ = - function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - var formatOnlineresource = - ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack); - if (formatOnlineresource) { - var size = [ - ol.format.XSD.readNonNegativeIntegerString(node.getAttribute('width')), - ol.format.XSD.readNonNegativeIntegerString(node.getAttribute('height')) - ]; - formatOnlineresource['size'] = size; - return formatOnlineresource; - } - return undefined; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Authority URL object. - */ -ol.format.WMSCapabilities.readAuthorityURL_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'AuthorityURL', - 'localName should be AuthorityURL'); - var authorityObject = - ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack); - if (authorityObject) { - authorityObject['name'] = node.getAttribute('name'); - return authorityObject; - } - return undefined; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Metadata URL object. - */ -ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'MetadataURL', - 'localName should be MetadataURL'); - var metadataObject = - ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack); - if (metadataObject) { - metadataObject['type'] = node.getAttribute('type'); - return metadataObject; - } - return undefined; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Style object. - */ -ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Style', 'localName should be Style'); - return ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Array.<string>|undefined} Keyword list. - */ -ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'KeywordList', - 'localName should be KeywordList'); - return ol.xml.pushParseAndPop( - [], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack); -}; - - -/** - * @const - * @private - * @type {Array.<string>} - */ -ol.format.WMSCapabilities.NAMESPACE_URIS_ = [ - null, - 'http://www.opengis.net/wms' -]; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Service': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readService_), - 'Capability': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readCapability_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.CAPABILITY_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Request': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readRequest_), - 'Exception': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readException_), - 'Layer': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readCapabilityLayer_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.SERVICE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'KeywordList': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readKeywordList_), - 'OnlineResource': ol.xml.makeObjectPropertySetter( - ol.format.XLink.readHref), - 'ContactInformation': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readContactInformation_), - 'Fees': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'AccessConstraints': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'LayerLimit': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger), - 'MaxWidth': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger), - 'MaxHeight': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'ContactPersonPrimary': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readContactPersonPrimary_), - 'ContactPosition': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'ContactAddress': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readContactAddress_), - 'ContactVoiceTelephone': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'ContactFacsimileTelephone': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'ContactElectronicMailAddress': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'ContactPerson': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'ContactOrganization': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'AddressType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Address': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'City': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'StateOrProvince': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'PostCode': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Country': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.EXCEPTION_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Format': ol.xml.makeArrayPusher(ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'KeywordList': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readKeywordList_), - 'CRS': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString), - 'EX_GeographicBoundingBox': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readEXGeographicBoundingBox_), - 'BoundingBox': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readBoundingBox_), - 'Dimension': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readDimension_), - 'Attribution': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readAttribution_), - 'AuthorityURL': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readAuthorityURL_), - 'Identifier': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString), - 'MetadataURL': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readMetadataURL_), - 'DataURL': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readFormatOnlineresource_), - 'FeatureListURL': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readFormatOnlineresource_), - 'Style': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readStyle_), - 'MinScaleDenominator': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readDecimal), - 'MaxScaleDenominator': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readDecimal), - 'Layer': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readLayer_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'OnlineResource': ol.xml.makeObjectPropertySetter( - ol.format.XLink.readHref), - 'LogoURL': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readSizedFormatOnlineresource_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ = - ol.xml.makeStructureNS(ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'westBoundLongitude': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readDecimal), - 'eastBoundLongitude': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readDecimal), - 'southBoundLatitude': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readDecimal), - 'northBoundLatitude': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readDecimal) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.REQUEST_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'GetCapabilities': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readOperationType_), - 'GetMap': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readOperationType_), - 'GetFeatureInfo': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readOperationType_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Format': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString), - 'DCPType': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readDCPType_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.DCPTYPE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'HTTP': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readHTTP_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.HTTP_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Get': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readFormatOnlineresource_), - 'Post': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readFormatOnlineresource_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'LegendURL': ol.xml.makeObjectPropertyPusher( - ol.format.WMSCapabilities.readSizedFormatOnlineresource_), - 'StyleSheetURL': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readFormatOnlineresource_), - 'StyleURL': ol.xml.makeObjectPropertySetter( - ol.format.WMSCapabilities.readFormatOnlineresource_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ = - ol.xml.makeStructureNS(ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Format': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), - 'OnlineResource': ol.xml.makeObjectPropertySetter( - ol.format.XLink.readHref) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMSCapabilities.NAMESPACE_URIS_, { - 'Keyword': ol.xml.makeArrayPusher(ol.format.XSD.readString) - }); - -goog.provide('ol.format.WMSGetFeatureInfo'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('goog.object'); -goog.require('ol.format.GML2'); -goog.require('ol.format.XMLFeature'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Format for reading WMSGetFeatureInfo format. It uses - * {@link ol.format.GML2} to read features. - * - * @constructor - * @extends {ol.format.XMLFeature} - * @api - */ -ol.format.WMSGetFeatureInfo = function() { - - /** - * @private - * @type {string} - */ - this.featureNS_ = 'http://mapserver.gis.umn.edu/mapserver'; - - - /** - * @private - * @type {ol.format.GML2} - */ - this.gmlFormat_ = new ol.format.GML2(); - - goog.base(this); -}; -goog.inherits(ol.format.WMSGetFeatureInfo, ol.format.XMLFeature); - - -/** - * @const - * @type {string} - * @private - */ -ol.format.WMSGetFeatureInfo.featureIdentifier_ = '_feature'; - - -/** - * @const - * @type {string} - * @private - */ -ol.format.WMSGetFeatureInfo.layerIdentifier_ = '_layer'; - - -/** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Array.<ol.Feature>} Features. - * @private - */ -ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = - function(node, objectStack) { - - node.namespaceURI = this.featureNS_; - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - var localName = ol.xml.getLocalName(node); - /** @type {Array.<ol.Feature>} */ - var features = []; - if (node.childNodes.length === 0) { - return features; - } - if (localName == 'msGMLOutput') { - for (var i = 0, ii = node.childNodes.length; i < ii; i++) { - var layer = node.childNodes[i]; - if (layer.nodeType !== goog.dom.NodeType.ELEMENT) { - continue; - } - var context = objectStack[0]; - goog.asserts.assert(goog.isObject(context), - 'context should be an Object'); - - goog.asserts.assert(layer.localName.indexOf( - ol.format.WMSGetFeatureInfo.layerIdentifier_) >= 0, - 'localName of layer node should match layerIdentifier'); - - var toRemove = ol.format.WMSGetFeatureInfo.layerIdentifier_; - var featureType = layer.localName.replace(toRemove, '') + - ol.format.WMSGetFeatureInfo.featureIdentifier_; - - context['featureType'] = featureType; - context['featureNS'] = this.featureNS_; - - var parsers = {}; - parsers[featureType] = ol.xml.makeArrayPusher( - this.gmlFormat_.readFeatureElement, this.gmlFormat_); - var parsersNS = ol.xml.makeStructureNS( - [context['featureNS'], null], parsers); - layer.namespaceURI = this.featureNS_; - var layerFeatures = ol.xml.pushParseAndPop( - [], parsersNS, layer, objectStack, this.gmlFormat_); - if (layerFeatures) { - goog.array.extend(features, layerFeatures); - } - } - } - if (localName == 'FeatureCollection') { - var gmlFeatures = ol.xml.pushParseAndPop([], - this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node, - [{}], this.gmlFormat_); - if (gmlFeatures) { - features = gmlFeatures; - } - } - return features; -}; - - -/** - * Read all features from a WMSGetFeatureInfo response. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. - * @return {Array.<ol.Feature>} Features. - * @api stable - */ -ol.format.WMSGetFeatureInfo.prototype.readFeatures; - - -/** - * @inheritDoc - */ -ol.format.WMSGetFeatureInfo.prototype.readFeaturesFromNode = - function(node, opt_options) { - var options = { - 'featureType': this.featureType, - 'featureNS': this.featureNS - }; - if (opt_options) { - goog.object.extend(options, this.getReadOptions(node, opt_options)); - } - return this.readFeatures_(node, [options]); -}; - -goog.provide('ol.format.WMTSCapabilities'); - -goog.require('goog.asserts'); -goog.require('goog.dom.NodeType'); -goog.require('ol.extent'); -goog.require('ol.format.OWS'); -goog.require('ol.format.XLink'); -goog.require('ol.format.XML'); -goog.require('ol.format.XSD'); -goog.require('ol.xml'); - - - -/** - * @classdesc - * Format for reading WMTS capabilities data. - * - * @constructor - * @extends {ol.format.XML} - * @api - */ -ol.format.WMTSCapabilities = function() { - goog.base(this); - - /** - * @type {ol.format.OWS} - * @private - */ - this.owsParser_ = new ol.format.OWS(); -}; -goog.inherits(ol.format.WMTSCapabilities, ol.format.XML); - - -/** - * Read a WMTS capabilities document. - * - * @function - * @param {Document|Node|string} source The XML source. - * @return {Object} An object representing the WMTS capabilities. - * @api - */ -ol.format.WMTSCapabilities.prototype.read; - - -/** - * @param {Document} doc Document. - * @return {Object} WMTS Capability object. - */ -ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) { - goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT, - 'doc.nodeType should be DOCUMENT'); - for (var n = doc.firstChild; n; n = n.nextSibling) { - if (n.nodeType == goog.dom.NodeType.ELEMENT) { - return this.readFromNode(n); - } - } - return null; -}; - - -/** - * @param {Node} node Node. - * @return {Object} WMTS Capability object. - */ -ol.format.WMTSCapabilities.prototype.readFromNode = function(node) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Capabilities', - 'localName should be Capabilities'); - this.version = node.getAttribute('version').trim(); - goog.asserts.assertString(this.version, 'this.version should be a string'); - var WMTSCapabilityObject = this.owsParser_.readFromNode(node); - if (!WMTSCapabilityObject) { - return null; - } - WMTSCapabilityObject['version'] = this.version; - WMTSCapabilityObject = ol.xml.pushParseAndPop(WMTSCapabilityObject, - ol.format.WMTSCapabilities.PARSERS_, node, []); - return WMTSCapabilityObject ? WMTSCapabilityObject : null; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Attribution object. - */ -ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Contents', - 'localName should be Contents'); - - return ol.xml.pushParseAndPop({}, - ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Layers object. - */ -ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) { - goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, - 'node.nodeType should be ELEMENT'); - goog.asserts.assert(node.localName == 'Layer', 'localName should be Layer'); - return ol.xml.pushParseAndPop({}, - ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Tile Matrix Set object. - */ -ol.format.WMTSCapabilities.readTileMatrixSet_ = function(node, objectStack) { - return ol.xml.pushParseAndPop({}, - ol.format.WMTSCapabilities.TMS_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Style object. - */ -ol.format.WMTSCapabilities.readStyle_ = function(node, objectStack) { - var style = ol.xml.pushParseAndPop({}, - ol.format.WMTSCapabilities.STYLE_PARSERS_, node, objectStack); - if (!style) { - return undefined; - } - var isDefault = node.getAttribute('isDefault') === 'true'; - style['isDefault'] = isDefault; - return style; - -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Tile Matrix Set Link object. - */ -ol.format.WMTSCapabilities.readTileMatrixSetLink_ = function(node, - objectStack) { - return ol.xml.pushParseAndPop({}, - ol.format.WMTSCapabilities.TMS_LINKS_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Dimension object. - */ -ol.format.WMTSCapabilities.readDimensions_ = function(node, objectStack) { - return ol.xml.pushParseAndPop({}, - ol.format.WMTSCapabilities.DIMENSION_PARSERS_, node, objectStack); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Resource URL object. - */ -ol.format.WMTSCapabilities.readResourceUrl_ = function(node, objectStack) { - var format = node.getAttribute('format'); - var template = node.getAttribute('template'); - var resourceType = node.getAttribute('resourceType'); - var resource = {}; - if (format) { - resource['format'] = format; - } - if (template) { - resource['template'] = template; - } - if (resourceType) { - resource['resourceType'] = resourceType; - } - return resource; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} WGS84 BBox object. - */ -ol.format.WMTSCapabilities.readWgs84BoundingBox_ = function(node, objectStack) { - var coordinates = ol.xml.pushParseAndPop([], - ol.format.WMTSCapabilities.WGS84_BBOX_READERS_, node, objectStack); - if (coordinates.length != 2) { - return undefined; - } - return ol.extent.boundingExtent(coordinates); -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Legend object. - */ -ol.format.WMTSCapabilities.readLegendUrl_ = function(node, objectStack) { - var legend = {}; - legend['format'] = node.getAttribute('format'); - legend['href'] = ol.format.XLink.readHref(node); - return legend; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Coordinates object. - */ -ol.format.WMTSCapabilities.readCoordinates_ = function(node, objectStack) { - var coordinates = ol.format.XSD.readString(node).split(' '); - if (!coordinates || coordinates.length != 2) { - return undefined; - } - var x = +coordinates[0]; - var y = +coordinates[1]; - if (isNaN(x) || isNaN(y)) { - return undefined; - } - return [x, y]; -}; - - -/** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} TileMatrix object. - */ -ol.format.WMTSCapabilities.readTileMatrix_ = function(node, objectStack) { - return ol.xml.pushParseAndPop({}, - ol.format.WMTSCapabilities.TM_PARSERS_, node, objectStack); -}; - - -/** - * @const - * @private - * @type {Array.<string>} - */ -ol.format.WMTSCapabilities.NAMESPACE_URIS_ = [ - null, - 'http://www.opengis.net/wmts/1.0' -]; - - -/** - * @const - * @private - * @type {Array.<string>} - */ -ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_ = [ - null, - 'http://www.opengis.net/ows/1.1' -]; - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.NAMESPACE_URIS_, { - 'Contents': ol.xml.makeObjectPropertySetter( - ol.format.WMTSCapabilities.readContents_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.CONTENTS_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.NAMESPACE_URIS_, { - 'Layer': ol.xml.makeObjectPropertyPusher( - ol.format.WMTSCapabilities.readLayer_), - 'TileMatrixSet': ol.xml.makeObjectPropertyPusher( - ol.format.WMTSCapabilities.readTileMatrixSet_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.NAMESPACE_URIS_, { - 'Style': ol.xml.makeObjectPropertyPusher( - ol.format.WMTSCapabilities.readStyle_), - 'Format': ol.xml.makeObjectPropertyPusher( - ol.format.XSD.readString), - 'TileMatrixSetLink': ol.xml.makeObjectPropertyPusher( - ol.format.WMTSCapabilities.readTileMatrixSetLink_), - 'Dimension': ol.xml.makeObjectPropertyPusher( - ol.format.WMTSCapabilities.readDimensions_), - 'ResourceURL': ol.xml.makeObjectPropertyPusher( - ol.format.WMTSCapabilities.readResourceUrl_) - }, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, { - 'Title': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'Abstract': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'WGS84BoundingBox': ol.xml.makeObjectPropertySetter( - ol.format.WMTSCapabilities.readWgs84BoundingBox_), - 'Identifier': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - })); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.NAMESPACE_URIS_, { - 'LegendURL': ol.xml.makeObjectPropertyPusher( - ol.format.WMTSCapabilities.readLegendUrl_) - }, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, { - 'Title': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'Identifier': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - })); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.TMS_LINKS_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.NAMESPACE_URIS_, { - 'TileMatrixSet': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.DIMENSION_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.NAMESPACE_URIS_, { - 'Default': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'Value': ol.xml.makeObjectPropertyPusher( - ol.format.XSD.readString) - }, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, { - 'Identifier': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - })); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.WGS84_BBOX_READERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, { - 'LowerCorner': ol.xml.makeArrayPusher( - ol.format.WMTSCapabilities.readCoordinates_), - 'UpperCorner': ol.xml.makeArrayPusher( - ol.format.WMTSCapabilities.readCoordinates_) - }); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.TMS_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.NAMESPACE_URIS_, { - 'WellKnownScaleSet': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'TileMatrix': ol.xml.makeObjectPropertyPusher( - ol.format.WMTSCapabilities.readTileMatrix_) - }, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, { - 'SupportedCRS': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString), - 'Identifier': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - })); - - -/** - * @const - * @type {Object.<string, Object.<string, ol.xml.Parser>>} - * @private - */ -ol.format.WMTSCapabilities.TM_PARSERS_ = ol.xml.makeStructureNS( - ol.format.WMTSCapabilities.NAMESPACE_URIS_, { - 'TopLeftCorner': ol.xml.makeObjectPropertySetter( - ol.format.WMTSCapabilities.readCoordinates_), - 'ScaleDenominator': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readDecimal), - 'TileWidth': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger), - 'TileHeight': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger), - 'MatrixWidth': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger), - 'MatrixHeight': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readNonNegativeInteger) - }, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, { - 'Identifier': ol.xml.makeObjectPropertySetter( - ol.format.XSD.readString) - })); - -goog.provide('ol.sphere.WGS84'); - -goog.require('ol.Sphere'); - - -/** - * A sphere with radius equal to the semi-major axis of the WGS84 ellipsoid. - * @const - * @type {ol.Sphere} - */ -ol.sphere.WGS84 = new ol.Sphere(6378137); - -// FIXME handle geolocation not supported - -goog.provide('ol.Geolocation'); -goog.provide('ol.GeolocationProperty'); - -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol.Coordinate'); -goog.require('ol.Object'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.Polygon'); -goog.require('ol.has'); -goog.require('ol.math'); -goog.require('ol.proj'); -goog.require('ol.sphere.WGS84'); - - -/** - * @enum {string} - */ -ol.GeolocationProperty = { - ACCURACY: 'accuracy', - ACCURACY_GEOMETRY: 'accuracyGeometry', - ALTITUDE: 'altitude', - ALTITUDE_ACCURACY: 'altitudeAccuracy', - HEADING: 'heading', - POSITION: 'position', - PROJECTION: 'projection', - SPEED: 'speed', - TRACKING: 'tracking', - TRACKING_OPTIONS: 'trackingOptions' -}; - - - -/** - * @classdesc - * Helper class for providing HTML5 Geolocation capabilities. - * The [Geolocation API](http://www.w3.org/TR/geolocation-API/) - * is used to locate a user's position. - * - * To get notified of position changes, register a listener for the generic - * `change` event on your instance of `ol.Geolocation`. - * - * Example: - * - * var geolocation = new ol.Geolocation({ - * // take the projection to use from the map's view - * projection: view.getProjection() - * }); - * // listen to changes in position - * geolocation.on('change', function(evt) { - * window.console.log(geolocation.getPosition()); - * }); - * - * @constructor - * @extends {ol.Object} - * @param {olx.GeolocationOptions=} opt_options Options. - * @api stable - */ -ol.Geolocation = function(opt_options) { - - goog.base(this); - - var options = opt_options || {}; - - /** - * The unprojected (EPSG:4326) device position. - * @private - * @type {ol.Coordinate} - */ - this.position_ = null; - - /** - * @private - * @type {ol.TransformFunction} - */ - this.transform_ = ol.proj.identityTransform; - - /** - * @private - * @type {number|undefined} - */ - this.watchId_ = undefined; - - goog.events.listen( - this, ol.Object.getChangeEventType(ol.GeolocationProperty.PROJECTION), - this.handleProjectionChanged_, false, this); - goog.events.listen( - this, ol.Object.getChangeEventType(ol.GeolocationProperty.TRACKING), - this.handleTrackingChanged_, false, this); - - if (options.projection !== undefined) { - this.setProjection(ol.proj.get(options.projection)); - } - if (options.trackingOptions !== undefined) { - this.setTrackingOptions(options.trackingOptions); - } - - this.setTracking(options.tracking !== undefined ? options.tracking : false); - -}; -goog.inherits(ol.Geolocation, ol.Object); - - -/** - * @inheritDoc - */ -ol.Geolocation.prototype.disposeInternal = function() { - this.setTracking(false); - goog.base(this, 'disposeInternal'); -}; - - -/** - * @private - */ -ol.Geolocation.prototype.handleProjectionChanged_ = function() { - var projection = this.getProjection(); - if (projection) { - this.transform_ = ol.proj.getTransformFromProjections( - ol.proj.get('EPSG:4326'), projection); - if (this.position_) { - this.set( - ol.GeolocationProperty.POSITION, this.transform_(this.position_)); - } - } -}; - - -/** - * @private - */ -ol.Geolocation.prototype.handleTrackingChanged_ = function() { - if (ol.has.GEOLOCATION) { - var tracking = this.getTracking(); - if (tracking && this.watchId_ === undefined) { - this.watchId_ = goog.global.navigator.geolocation.watchPosition( - goog.bind(this.positionChange_, this), - goog.bind(this.positionError_, this), - this.getTrackingOptions()); - } else if (!tracking && this.watchId_ !== undefined) { - goog.global.navigator.geolocation.clearWatch(this.watchId_); - this.watchId_ = undefined; - } - } -}; - - -/** - * @private - * @param {GeolocationPosition} position position event. - */ -ol.Geolocation.prototype.positionChange_ = function(position) { - var coords = position.coords; - this.set(ol.GeolocationProperty.ACCURACY, coords.accuracy); - this.set(ol.GeolocationProperty.ALTITUDE, - coords.altitude === null ? undefined : coords.altitude); - this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY, - coords.altitudeAccuracy === null ? - undefined : coords.altitudeAccuracy); - this.set(ol.GeolocationProperty.HEADING, coords.heading === null ? - undefined : ol.math.toRadians(coords.heading)); - if (!this.position_) { - this.position_ = [coords.longitude, coords.latitude]; - } else { - this.position_[0] = coords.longitude; - this.position_[1] = coords.latitude; - } - var projectedPosition = this.transform_(this.position_); - this.set(ol.GeolocationProperty.POSITION, projectedPosition); - this.set(ol.GeolocationProperty.SPEED, - coords.speed === null ? undefined : coords.speed); - var geometry = ol.geom.Polygon.circular( - ol.sphere.WGS84, this.position_, coords.accuracy); - geometry.applyTransform(this.transform_); - this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry); - this.changed(); -}; - - -/** - * @private - * @param {GeolocationPositionError} error error object. - */ -ol.Geolocation.prototype.positionError_ = function(error) { - error.type = goog.events.EventType.ERROR; - this.setTracking(false); - this.dispatchEvent(error); -}; - - -/** - * Get the accuracy of the position in meters. - * @return {number|undefined} The accuracy of the position measurement in - * meters. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getAccuracy = function() { - return /** @type {number|undefined} */ ( - this.get(ol.GeolocationProperty.ACCURACY)); -}; - - -/** - * Get a geometry of the position accuracy. - * @return {?ol.geom.Geometry} A geometry of the position accuracy. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getAccuracyGeometry = function() { - return /** @type {?ol.geom.Geometry} */ ( - this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null); -}; - - -/** - * Get the altitude associated with the position. - * @return {number|undefined} The altitude of the position in meters above mean - * sea level. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getAltitude = function() { - return /** @type {number|undefined} */ ( - this.get(ol.GeolocationProperty.ALTITUDE)); -}; - - -/** - * Get the altitude accuracy of the position. - * @return {number|undefined} The accuracy of the altitude measurement in - * meters. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getAltitudeAccuracy = function() { - return /** @type {number|undefined} */ ( - this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY)); -}; - - -/** - * Get the heading as radians clockwise from North. - * @return {number|undefined} The heading of the device in radians from north. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getHeading = function() { - return /** @type {number|undefined} */ ( - this.get(ol.GeolocationProperty.HEADING)); -}; - - -/** - * Get the position of the device. - * @return {ol.Coordinate|undefined} The current position of the device reported - * in the current projection. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getPosition = function() { - return /** @type {ol.Coordinate|undefined} */ ( - this.get(ol.GeolocationProperty.POSITION)); -}; - - -/** - * Get the projection associated with the position. - * @return {ol.proj.Projection|undefined} The projection the position is - * reported in. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getProjection = function() { - return /** @type {ol.proj.Projection|undefined} */ ( - this.get(ol.GeolocationProperty.PROJECTION)); -}; - - -/** - * Get the speed in meters per second. - * @return {number|undefined} The instantaneous speed of the device in meters - * per second. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getSpeed = function() { - return /** @type {number|undefined} */ ( - this.get(ol.GeolocationProperty.SPEED)); -}; - - -/** - * Determine if the device location is being tracked. - * @return {boolean} The device location is being tracked. - * @observable - * @api stable - */ -ol.Geolocation.prototype.getTracking = function() { - return /** @type {boolean} */ ( - this.get(ol.GeolocationProperty.TRACKING)); -}; - - -/** - * Get the tracking options. - * @see http://www.w3.org/TR/geolocation-API/#position-options - * @return {GeolocationPositionOptions|undefined} PositionOptions as defined by - * the [HTML5 Geolocation spec - * ](http://www.w3.org/TR/geolocation-API/#position_options_interface). - * @observable - * @api stable - */ -ol.Geolocation.prototype.getTrackingOptions = function() { - return /** @type {GeolocationPositionOptions|undefined} */ ( - this.get(ol.GeolocationProperty.TRACKING_OPTIONS)); -}; - - -/** - * Set the projection to use for transforming the coordinates. - * @param {ol.proj.Projection} projection The projection the position is - * reported in. - * @observable - * @api stable - */ -ol.Geolocation.prototype.setProjection = function(projection) { - this.set(ol.GeolocationProperty.PROJECTION, projection); -}; - - -/** - * Enable or disable tracking. - * @param {boolean} tracking Enable tracking. - * @observable - * @api stable - */ -ol.Geolocation.prototype.setTracking = function(tracking) { - this.set(ol.GeolocationProperty.TRACKING, tracking); -}; - - -/** - * Set the tracking options. - * @see http://www.w3.org/TR/geolocation-API/#position-options - * @param {GeolocationPositionOptions} options PositionOptions as defined by the - * [HTML5 Geolocation spec - * ](http://www.w3.org/TR/geolocation-API/#position_options_interface). - * @observable - * @api stable - */ -ol.Geolocation.prototype.setTrackingOptions = function(options) { - this.set(ol.GeolocationProperty.TRACKING_OPTIONS, options); -}; - -goog.provide('ol.geom.Circle'); - -goog.require('goog.asserts'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.geom.flat.deflate'); -goog.require('ol.proj'); - - - -/** - * @classdesc - * Circle geometry. - * - * @constructor - * @extends {ol.geom.SimpleGeometry} - * @param {ol.Coordinate} center Center. - * @param {number=} opt_radius Radius. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api - */ -ol.geom.Circle = function(center, opt_radius, opt_layout) { - goog.base(this); - var radius = opt_radius ? opt_radius : 0; - this.setCenterAndRadius(center, radius, opt_layout); -}; -goog.inherits(ol.geom.Circle, ol.geom.SimpleGeometry); - - -/** - * Make a complete copy of the geometry. - * @return {!ol.geom.Circle} Clone. - * @api - */ -ol.geom.Circle.prototype.clone = function() { - var circle = new ol.geom.Circle(null); - circle.setFlatCoordinates(this.layout, this.flatCoordinates.slice()); - return circle; -}; - - -/** - * @inheritDoc - */ -ol.geom.Circle.prototype.closestPointXY = - function(x, y, closestPoint, minSquaredDistance) { - var flatCoordinates = this.flatCoordinates; - var dx = x - flatCoordinates[0]; - var dy = y - flatCoordinates[1]; - var squaredDistance = dx * dx + dy * dy; - if (squaredDistance < minSquaredDistance) { - var i; - if (squaredDistance === 0) { - for (i = 0; i < this.stride; ++i) { - closestPoint[i] = flatCoordinates[i]; - } - } else { - var delta = this.getRadius() / Math.sqrt(squaredDistance); - closestPoint[0] = flatCoordinates[0] + delta * dx; - closestPoint[1] = flatCoordinates[1] + delta * dy; - for (i = 2; i < this.stride; ++i) { - closestPoint[i] = flatCoordinates[i]; - } - } - closestPoint.length = this.stride; - return squaredDistance; - } else { - return minSquaredDistance; - } -}; - - -/** - * @inheritDoc - */ -ol.geom.Circle.prototype.containsXY = function(x, y) { - var flatCoordinates = this.flatCoordinates; - var dx = x - flatCoordinates[0]; - var dy = y - flatCoordinates[1]; - return dx * dx + dy * dy <= this.getRadiusSquared_(); -}; - - -/** - * Return the center of the circle as {@link ol.Coordinate coordinate}. - * @return {ol.Coordinate} Center. - * @api - */ -ol.geom.Circle.prototype.getCenter = function() { - return this.flatCoordinates.slice(0, this.stride); -}; - - -/** - * @inheritDoc - */ -ol.geom.Circle.prototype.computeExtent = function(extent) { - var flatCoordinates = this.flatCoordinates; - var radius = flatCoordinates[this.stride] - flatCoordinates[0]; - return ol.extent.createOrUpdate( - flatCoordinates[0] - radius, flatCoordinates[1] - radius, - flatCoordinates[0] + radius, flatCoordinates[1] + radius, - extent); -}; - - -/** - * Return the radius of the circle. - * @return {number} Radius. - * @api - */ -ol.geom.Circle.prototype.getRadius = function() { - return Math.sqrt(this.getRadiusSquared_()); -}; - - -/** - * @private - * @return {number} Radius squared. - */ -ol.geom.Circle.prototype.getRadiusSquared_ = function() { - var dx = this.flatCoordinates[this.stride] - this.flatCoordinates[0]; - var dy = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1]; - return dx * dx + dy * dy; -}; - - -/** - * @inheritDoc - * @api - */ -ol.geom.Circle.prototype.getType = function() { - return ol.geom.GeometryType.CIRCLE; -}; - - -/** - * @inheritDoc - * @api stable - */ -ol.geom.Circle.prototype.intersectsExtent = function(extent) { - var circleExtent = this.getExtent(); - if (ol.extent.intersects(extent, circleExtent)) { - var center = this.getCenter(); - - if (extent[0] <= center[0] && extent[2] >= center[0]) { - return true; - } - if (extent[1] <= center[1] && extent[3] >= center[1]) { - return true; - } - - return ol.extent.forEachCorner(extent, this.containsCoordinate, this); - } - return false; - -}; - - -/** - * Set the center of the circle as {@link ol.Coordinate coordinate}. - * @param {ol.Coordinate} center Center. - * @api - */ -ol.geom.Circle.prototype.setCenter = function(center) { - var stride = this.stride; - goog.asserts.assert(center.length == stride, - 'center array length should match stride'); - var radius = this.flatCoordinates[stride] - this.flatCoordinates[0]; - var flatCoordinates = center.slice(); - flatCoordinates[stride] = flatCoordinates[0] + radius; - var i; - for (i = 1; i < stride; ++i) { - flatCoordinates[stride + i] = center[i]; - } - this.setFlatCoordinates(this.layout, flatCoordinates); -}; - - -/** - * Set the center (as {@link ol.Coordinate coordinate}) and the radius (as - * number) of the circle. - * @param {ol.Coordinate} center Center. - * @param {number} radius Radius. - * @param {ol.geom.GeometryLayout=} opt_layout Layout. - * @api - */ -ol.geom.Circle.prototype.setCenterAndRadius = - function(center, radius, opt_layout) { - if (!center) { - this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null); - } else { - this.setLayout(opt_layout, center, 0); - if (!this.flatCoordinates) { - this.flatCoordinates = []; - } - /** @type {Array.<number>} */ - var flatCoordinates = this.flatCoordinates; - var offset = ol.geom.flat.deflate.coordinate( - flatCoordinates, 0, center, this.stride); - flatCoordinates[offset++] = flatCoordinates[0] + radius; - var i, ii; - for (i = 1, ii = this.stride; i < ii; ++i) { - flatCoordinates[offset++] = flatCoordinates[i]; - } - flatCoordinates.length = offset; - this.changed(); - } -}; - - -/** - * @param {ol.geom.GeometryLayout} layout Layout. - * @param {Array.<number>} flatCoordinates Flat coordinates. - */ -ol.geom.Circle.prototype.setFlatCoordinates = - function(layout, flatCoordinates) { - this.setFlatCoordinatesInternal(layout, flatCoordinates); - this.changed(); -}; - - -/** - * Set the radius of the circle. The radius is in the units of the projection. - * @param {number} radius Radius. - * @api - */ -ol.geom.Circle.prototype.setRadius = function(radius) { - goog.asserts.assert(this.flatCoordinates, - 'truthy this.flatCoordinates expected'); - this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius; - this.changed(); -}; - - -/** - * Transform each coordinate of the circle from one coordinate reference system - * to another. The geometry is modified in place. - * If you do not want the geometry modified in place, first clone() it and - * then use this function on the clone. - * - * Internally a circle is currently represented by two points: the center of - * the circle `[cx, cy]`, and the point to the right of the circle - * `[cx + r, cy]`. This `transform` function just transforms these two points. - * So the resulting geometry is also a circle, and that circle does not - * correspond to the shape that would be obtained by transforming every point - * of the original circle. - * - * @param {ol.proj.ProjectionLike} source The current projection. Can be a - * string identifier or a {@link ol.proj.Projection} object. - * @param {ol.proj.ProjectionLike} destination The desired projection. Can be a - * string identifier or a {@link ol.proj.Projection} object. - * @return {ol.geom.Circle} This geometry. Note that original geometry is - * modified in place. - * @function - * @api stable - */ -ol.geom.Circle.prototype.transform; - -goog.provide('ol.geom.flat.geodesic'); - -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('ol.TransformFunction'); -goog.require('ol.math'); -goog.require('ol.proj'); - - -/** - * @private - * @param {function(number): ol.Coordinate} interpolate Interpolate function. - * @param {ol.TransformFunction} transform Transform from longitude/latitude to - * projected coordinates. - * @param {number} squaredTolerance Squared tolerance. - * @return {Array.<number>} Flat coordinates. - */ -ol.geom.flat.geodesic.line_ = - function(interpolate, transform, squaredTolerance) { - // FIXME reduce garbage generation - // FIXME optimize stack operations - - /** @type {Array.<number>} */ - var flatCoordinates = []; - - var geoA = interpolate(0); - var geoB = interpolate(1); - - var a = transform(geoA); - var b = transform(geoB); - - /** @type {Array.<ol.Coordinate>} */ - var geoStack = [geoB, geoA]; - /** @type {Array.<ol.Coordinate>} */ - var stack = [b, a]; - /** @type {Array.<number>} */ - var fractionStack = [1, 0]; - - /** @type {Object.<string, boolean>} */ - var fractions = {}; - - var maxIterations = 1e5; - var geoM, m, fracA, fracB, fracM, key; - - while (--maxIterations > 0 && fractionStack.length > 0) { - // Pop the a coordinate off the stack - fracA = fractionStack.pop(); - geoA = geoStack.pop(); - a = stack.pop(); - // Add the a coordinate if it has not been added yet - key = fracA.toString(); - if (!goog.object.containsKey(fractions, key)) { - flatCoordinates.push(a[0], a[1]); - fractions[key] = true; - } - // Pop the b coordinate off the stack - fracB = fractionStack.pop(); - geoB = geoStack.pop(); - b = stack.pop(); - // Find the m point between the a and b coordinates - fracM = (fracA + fracB) / 2; - geoM = interpolate(fracM); - m = transform(geoM); - if (ol.math.squaredSegmentDistance(m[0], m[1], a[0], a[1], - b[0], b[1]) < squaredTolerance) { - // If the m point is sufficiently close to the straight line, then we - // discard it. Just use the b coordinate and move on to the next line - // segment. - flatCoordinates.push(b[0], b[1]); - key = fracB.toString(); - goog.asserts.assert(!goog.object.containsKey(fractions, key), - 'fractions object should contain key : ' + key); - fractions[key] = true; - } else { - // Otherwise, we need to subdivide the current line segment. Split it - // into two and push the two line segments onto the stack. - fractionStack.push(fracB, fracM, fracM, fracA); - stack.push(b, m, m, a); - geoStack.push(geoB, geoM, geoM, geoA); - } - } - goog.asserts.assert(maxIterations > 0, - 'maxIterations should be more than 0'); - - return flatCoordinates; -}; - - -/** -* Generate a great-circle arcs between two lat/lon points. -* @param {number} lon1 Longitude 1 in degrees. -* @param {number} lat1 Latitude 1 in degrees. -* @param {number} lon2 Longitude 2 in degrees. -* @param {number} lat2 Latitude 2 in degrees. - * @param {ol.proj.Projection} projection Projection. -* @param {number} squaredTolerance Squared tolerance. -* @return {Array.<number>} Flat coordinates. -*/ -ol.geom.flat.geodesic.greatCircleArc = function( - lon1, lat1, lon2, lat2, projection, squaredTolerance) { - - var geoProjection = ol.proj.get('EPSG:4326'); - - var cosLat1 = Math.cos(ol.math.toRadians(lat1)); - var sinLat1 = Math.sin(ol.math.toRadians(lat1)); - var cosLat2 = Math.cos(ol.math.toRadians(lat2)); - var sinLat2 = Math.sin(ol.math.toRadians(lat2)); - var cosDeltaLon = Math.cos(ol.math.toRadians(lon2 - lon1)); - var sinDeltaLon = Math.sin(ol.math.toRadians(lon2 - lon1)); - var d = sinLat1 * sinLat2 + cosLat1 * cosLat2 * cosDeltaLon; - - return ol.geom.flat.geodesic.line_( - /** - * @param {number} frac Fraction. - * @return {ol.Coordinate} Coordinate. - */ - function(frac) { - if (1 <= d) { - return [lon2, lat2]; - } - var D = frac * Math.acos(d); - var cosD = Math.cos(D); - var sinD = Math.sin(D); - var y = sinDeltaLon * cosLat2; - var x = cosLat1 * sinLat2 - sinLat1 * cosLat2 * cosDeltaLon; - var theta = Math.atan2(y, x); - var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta)); - var lon = ol.math.toRadians(lon1) + - Math.atan2(Math.sin(theta) * sinD * cosLat1, - cosD - sinLat1 * Math.sin(lat)); - return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)]; - }, ol.proj.getTransform(geoProjection, projection), squaredTolerance); -}; - - -/** - * Generate a meridian (line at constant longitude). - * @param {number} lon Longitude. - * @param {number} lat1 Latitude 1. - * @param {number} lat2 Latitude 2. - * @param {ol.proj.Projection} projection Projection. - * @param {number} squaredTolerance Squared tolerance. - * @return {Array.<number>} Flat coordinates. - */ -ol.geom.flat.geodesic.meridian = - function(lon, lat1, lat2, projection, squaredTolerance) { - var epsg4326Projection = ol.proj.get('EPSG:4326'); - return ol.geom.flat.geodesic.line_( - /** - * @param {number} frac Fraction. - * @return {ol.Coordinate} Coordinate. - */ - function(frac) { - return [lon, lat1 + ((lat2 - lat1) * frac)]; - }, - ol.proj.getTransform(epsg4326Projection, projection), squaredTolerance); -}; - - -/** - * Generate a parallel (line at constant latitude). - * @param {number} lat Latitude. - * @param {number} lon1 Longitude 1. - * @param {number} lon2 Longitude 2. - * @param {ol.proj.Projection} projection Projection. - * @param {number} squaredTolerance Squared tolerance. - * @return {Array.<number>} Flat coordinates. - */ -ol.geom.flat.geodesic.parallel = - function(lat, lon1, lon2, projection, squaredTolerance) { - var epsg4326Projection = ol.proj.get('EPSG:4326'); - return ol.geom.flat.geodesic.line_( - /** - * @param {number} frac Fraction. - * @return {ol.Coordinate} Coordinate. - */ - function(frac) { - return [lon1 + ((lon2 - lon1) * frac), lat]; - }, - ol.proj.getTransform(epsg4326Projection, projection), squaredTolerance); -}; - -goog.provide('ol.Graticule'); - -goog.require('goog.asserts'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.flat.geodesic'); -goog.require('ol.math'); -goog.require('ol.proj'); -goog.require('ol.render.EventType'); -goog.require('ol.style.Stroke'); - - - -/** - * Render a grid for a coordinate system on a map. - * @constructor - * @param {olx.GraticuleOptions=} opt_options Options. - * @api - */ -ol.Graticule = function(opt_options) { - - var options = opt_options || {}; - - /** - * @type {ol.Map} - * @private - */ - this.map_ = null; - - /** - * @type {ol.proj.Projection} - * @private - */ - this.projection_ = null; - - /** - * @type {number} - * @private - */ - this.maxLat_ = Infinity; - - /** - * @type {number} - * @private - */ - this.maxLon_ = Infinity; - - /** - * @type {number} - * @private - */ - this.minLat_ = -Infinity; - - /** - * @type {number} - * @private - */ - this.minLon_ = -Infinity; - - /** - * @type {number} - * @private - */ - this.maxLatP_ = Infinity; - - /** - * @type {number} - * @private - */ - this.maxLonP_ = Infinity; - - /** - * @type {number} - * @private - */ - this.minLatP_ = -Infinity; - - /** - * @type {number} - * @private - */ - this.minLonP_ = -Infinity; - - /** - * @type {number} - * @private - */ - this.targetSize_ = options.targetSize !== undefined ? - options.targetSize : 100; - - /** - * @type {number} - * @private - */ - this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100; - goog.asserts.assert(this.maxLines_ > 0, - 'this.maxLines_ should be more than 0'); - - /** - * @type {Array.<ol.geom.LineString>} - * @private - */ - this.meridians_ = []; - - /** - * @type {Array.<ol.geom.LineString>} - * @private - */ - this.parallels_ = []; - - /** - * @type {ol.style.Stroke} - * @private - */ - this.strokeStyle_ = options.strokeStyle !== undefined ? - options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_; - - /** - * @type {ol.TransformFunction|undefined} - * @private - */ - this.fromLonLatTransform_ = undefined; - - /** - * @type {ol.TransformFunction|undefined} - * @private - */ - this.toLonLatTransform_ = undefined; - - /** - * @type {ol.Coordinate} - * @private - */ - this.projectionCenterLonLat_ = null; - - this.setMap(options.map !== undefined ? options.map : null); -}; - - -/** - * @type {ol.style.Stroke} - * @private - * @const - */ -ol.Graticule.DEFAULT_STROKE_STYLE_ = new ol.style.Stroke({ - color: 'rgba(0,0,0,0.2)' -}); - - -/** - * TODO can be configurable - * @type {Array.<number>} - * @private - */ -ol.Graticule.intervals_ = [90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, - 0.01, 0.005, 0.002, 0.001]; - - -/** - * @param {number} lon Longitude. - * @param {number} minLat Minimal latitude. - * @param {number} maxLat Maximal latitude. - * @param {number} squaredTolerance Squared tolerance. - * @param {ol.Extent} extent Extent. - * @param {number} index Index. - * @return {number} Index. - * @private - */ -ol.Graticule.prototype.addMeridian_ = - function(lon, minLat, maxLat, squaredTolerance, extent, index) { - var lineString = this.getMeridian_(lon, minLat, maxLat, - squaredTolerance, index); - if (ol.extent.intersects(lineString.getExtent(), extent)) { - this.meridians_[index++] = lineString; - } - return index; -}; - - -/** - * @param {number} lat Latitude. - * @param {number} minLon Minimal longitude. - * @param {number} maxLon Maximal longitude. - * @param {number} squaredTolerance Squared tolerance. - * @param {ol.Extent} extent Extent. - * @param {number} index Index. - * @return {number} Index. - * @private - */ -ol.Graticule.prototype.addParallel_ = - function(lat, minLon, maxLon, squaredTolerance, extent, index) { - var lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance, - index); - if (ol.extent.intersects(lineString.getExtent(), extent)) { - this.parallels_[index++] = lineString; - } - return index; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {ol.Coordinate} center Center. - * @param {number} resolution Resolution. - * @param {number} squaredTolerance Squared tolerance. - * @private - */ -ol.Graticule.prototype.createGraticule_ = - function(extent, center, resolution, squaredTolerance) { - - var interval = this.getInterval_(resolution); - if (interval == -1) { - this.meridians_.length = this.parallels_.length = 0; - return; - } - - var centerLonLat = this.toLonLatTransform_(center); - var centerLon = centerLonLat[0]; - var centerLat = centerLonLat[1]; - var maxLines = this.maxLines_; - var cnt, idx, lat, lon; - - var validExtent = [ - Math.max(extent[0], this.minLonP_), - Math.max(extent[1], this.minLatP_), - Math.min(extent[2], this.maxLonP_), - Math.min(extent[3], this.maxLatP_) - ]; - - validExtent = ol.proj.transformExtent(validExtent, this.projection_, - 'EPSG:4326'); - var maxLat = validExtent[3]; - var maxLon = validExtent[2]; - var minLat = validExtent[1]; - var minLon = validExtent[0]; - - // Create meridians - - centerLon = Math.floor(centerLon / interval) * interval; - lon = ol.math.clamp(centerLon, this.minLon_, this.maxLon_); - - idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, 0); - - cnt = 0; - while (lon != this.minLon_ && cnt++ < maxLines) { - lon = Math.max(lon - interval, this.minLon_); - idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx); - } - - lon = ol.math.clamp(centerLon, this.minLon_, this.maxLon_); - - cnt = 0; - while (lon != this.maxLon_ && cnt++ < maxLines) { - lon = Math.min(lon + interval, this.maxLon_); - idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx); - } - - this.meridians_.length = idx; - - // Create parallels - - centerLat = Math.floor(centerLat / interval) * interval; - lat = ol.math.clamp(centerLat, this.minLat_, this.maxLat_); - - idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, 0); - - cnt = 0; - while (lat != this.minLat_ && cnt++ < maxLines) { - lat = Math.max(lat - interval, this.minLat_); - idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, idx); - } - - lat = ol.math.clamp(centerLat, this.minLat_, this.maxLat_); - - cnt = 0; - while (lat != this.maxLat_ && cnt++ < maxLines) { - lat = Math.min(lat + interval, this.maxLat_); - idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, idx); - } - - this.parallels_.length = idx; - -}; - - -/** - * @param {number} resolution Resolution. - * @return {number} The interval in degrees. - * @private - */ -ol.Graticule.prototype.getInterval_ = function(resolution) { - var centerLon = this.projectionCenterLonLat_[0]; - var centerLat = this.projectionCenterLonLat_[1]; - var interval = -1; - var i, ii, delta, dist; - var target = Math.pow(this.targetSize_ * resolution, 2); - /** @type {Array.<number>} **/ - var p1 = []; - /** @type {Array.<number>} **/ - var p2 = []; - for (i = 0, ii = ol.Graticule.intervals_.length; i < ii; ++i) { - delta = ol.Graticule.intervals_[i] / 2; - p1[0] = centerLon - delta; - p1[1] = centerLat - delta; - p2[0] = centerLon + delta; - p2[1] = centerLat + delta; - this.fromLonLatTransform_(p1, p1); - this.fromLonLatTransform_(p2, p2); - dist = Math.pow(p2[0] - p1[0], 2) + Math.pow(p2[1] - p1[1], 2); - if (dist <= target) { - break; - } - interval = ol.Graticule.intervals_[i]; - } - return interval; -}; - - -/** - * Get the map associated with this graticule. - * @return {ol.Map} The map. - * @api - */ -ol.Graticule.prototype.getMap = function() { - return this.map_; -}; - - -/** - * @param {number} lon Longitude. - * @param {number} minLat Minimal latitude. - * @param {number} maxLat Maximal latitude. - * @param {number} squaredTolerance Squared tolerance. - * @return {ol.geom.LineString} The meridian line string. - * @param {number} index Index. - * @private - */ -ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat, - squaredTolerance, index) { - goog.asserts.assert(lon >= this.minLon_, - 'lon should be larger than or equal to this.minLon_'); - goog.asserts.assert(lon <= this.maxLon_, - 'lon should be smaller than or equal to this.maxLon_'); - var flatCoordinates = ol.geom.flat.geodesic.meridian(lon, - minLat, maxLat, this.projection_, squaredTolerance); - goog.asserts.assert(flatCoordinates.length > 0, - 'flatCoordinates cannot be empty'); - var lineString = this.meridians_[index] !== undefined ? - this.meridians_[index] : new ol.geom.LineString(null); - lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates); - return lineString; -}; - - -/** - * Get the list of meridians. Meridians are lines of equal longitude. - * @return {Array.<ol.geom.LineString>} The meridians. - * @api - */ -ol.Graticule.prototype.getMeridians = function() { - return this.meridians_; -}; - - -/** - * @param {number} lat Latitude. - * @param {number} minLon Minimal longitude. - * @param {number} maxLon Maximal longitude. - * @param {number} squaredTolerance Squared tolerance. - * @return {ol.geom.LineString} The parallel line string. - * @param {number} index Index. - * @private - */ -ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon, - squaredTolerance, index) { - goog.asserts.assert(lat >= this.minLat_, - 'lat should be larger than or equal to this.minLat_'); - goog.asserts.assert(lat <= this.maxLat_, - 'lat should be smaller than or equal to this.maxLat_'); - var flatCoordinates = ol.geom.flat.geodesic.parallel(lat, - this.minLon_, this.maxLon_, this.projection_, squaredTolerance); - goog.asserts.assert(flatCoordinates.length > 0, - 'flatCoordinates cannot be empty'); - var lineString = this.parallels_[index] !== undefined ? - this.parallels_[index] : new ol.geom.LineString(null); - lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates); - return lineString; -}; - - -/** - * Get the list of parallels. Pallels are lines of equal latitude. - * @return {Array.<ol.geom.LineString>} The parallels. - * @api - */ -ol.Graticule.prototype.getParallels = function() { - return this.parallels_; -}; - - -/** - * @param {ol.render.Event} e Event. - * @private - */ -ol.Graticule.prototype.handlePostCompose_ = function(e) { - var vectorContext = e.vectorContext; - var frameState = e.frameState; - var extent = frameState.extent; - var viewState = frameState.viewState; - var center = viewState.center; - var projection = viewState.projection; - var resolution = viewState.resolution; - var pixelRatio = frameState.pixelRatio; - var squaredTolerance = - resolution * resolution / (4 * pixelRatio * pixelRatio); - - var updateProjectionInfo = !this.projection_ || - !ol.proj.equivalent(this.projection_, projection); - - if (updateProjectionInfo) { - this.updateProjectionInfo_(projection); - } - - //Fix the extent if wrapped. - //(note: this is the same extent as vectorContext.extent_) - var offsetX = 0; - if (projection.canWrapX()) { - var projectionExtent = projection.getExtent(); - var worldWidth = ol.extent.getWidth(projectionExtent); - var x = frameState.focus[0]; - if (x < projectionExtent[0] || x > projectionExtent[2]) { - var worldsAway = Math.ceil((projectionExtent[0] - x) / worldWidth); - offsetX = worldWidth * worldsAway; - extent = [ - extent[0] + offsetX, extent[1], - extent[2] + offsetX, extent[3] - ]; - } - } - - this.createGraticule_(extent, center, resolution, squaredTolerance); - - // Draw the lines - vectorContext.setFillStrokeStyle(null, this.strokeStyle_); - var i, l, line; - for (i = 0, l = this.meridians_.length; i < l; ++i) { - line = this.meridians_[i]; - vectorContext.drawLineStringGeometry(line, null); - } - for (i = 0, l = this.parallels_.length; i < l; ++i) { - line = this.parallels_[i]; - vectorContext.drawLineStringGeometry(line, null); - } -}; - - -/** - * @param {ol.proj.Projection} projection Projection. - * @private - */ -ol.Graticule.prototype.updateProjectionInfo_ = function(projection) { - goog.asserts.assert(projection, 'projection cannot be null'); - - var epsg4326Projection = ol.proj.get('EPSG:4326'); - - var extent = projection.getExtent(); - var worldExtent = projection.getWorldExtent(); - var worldExtentP = ol.proj.transformExtent(worldExtent, - epsg4326Projection, projection); - - var maxLat = worldExtent[3]; - var maxLon = worldExtent[2]; - var minLat = worldExtent[1]; - var minLon = worldExtent[0]; - - var maxLatP = worldExtentP[3]; - var maxLonP = worldExtentP[2]; - var minLatP = worldExtentP[1]; - var minLonP = worldExtentP[0]; - - goog.asserts.assert(extent, 'extent cannot be null'); - goog.asserts.assert(maxLat !== undefined, 'maxLat should be defined'); - goog.asserts.assert(maxLon !== undefined, 'maxLon should be defined'); - goog.asserts.assert(minLat !== undefined, 'minLat should be defined'); - goog.asserts.assert(minLon !== undefined, 'minLon should be defined'); - - goog.asserts.assert(maxLatP !== undefined, - 'projected maxLat should be defined'); - goog.asserts.assert(maxLonP !== undefined, - 'projected maxLon should be defined'); - goog.asserts.assert(minLatP !== undefined, - 'projected minLat should be defined'); - goog.asserts.assert(minLonP !== undefined, - 'projected minLon should be defined'); - - this.maxLat_ = maxLat; - this.maxLon_ = maxLon; - this.minLat_ = minLat; - this.minLon_ = minLon; - - this.maxLatP_ = maxLatP; - this.maxLonP_ = maxLonP; - this.minLatP_ = minLatP; - this.minLonP_ = minLonP; - - - this.fromLonLatTransform_ = ol.proj.getTransform( - epsg4326Projection, projection); - - this.toLonLatTransform_ = ol.proj.getTransform( - projection, epsg4326Projection); - - this.projectionCenterLonLat_ = this.toLonLatTransform_( - ol.extent.getCenter(extent)); - - this.projection_ = projection; -}; - - -/** - * Set the map for this graticule. The graticule will be rendered on the - * provided map. - * @param {ol.Map} map Map. - * @api - */ -ol.Graticule.prototype.setMap = function(map) { - if (this.map_) { - this.map_.un(ol.render.EventType.POSTCOMPOSE, - this.handlePostCompose_, this); - this.map_.render(); - } - if (map) { - map.on(ol.render.EventType.POSTCOMPOSE, - this.handlePostCompose_, this); - map.render(); - } - this.map_ = map; -}; - -goog.provide('ol.Image'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol.ImageBase'); -goog.require('ol.ImageState'); -goog.require('ol.extent'); - - - -/** - * @constructor - * @extends {ol.ImageBase} - * @param {ol.Extent} extent Extent. - * @param {number|undefined} resolution Resolution. - * @param {number} pixelRatio Pixel ratio. - * @param {Array.<ol.Attribution>} attributions Attributions. - * @param {string} src Image source URI. - * @param {?string} crossOrigin Cross origin. - * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. - */ -ol.Image = function(extent, resolution, pixelRatio, attributions, src, - crossOrigin, imageLoadFunction) { - - goog.base(this, extent, resolution, pixelRatio, ol.ImageState.IDLE, - attributions); - - /** - * @private - * @type {string} - */ - this.src_ = src; - - /** - * @private - * @type {Image} - */ - this.image_ = new Image(); - if (crossOrigin !== null) { - this.image_.crossOrigin = crossOrigin; - } - - /** - * @private - * @type {Object.<number, Image>} - */ - this.imageByContext_ = {}; - - /** - * @private - * @type {Array.<goog.events.Key>} - */ - this.imageListenerKeys_ = null; - - /** - * @protected - * @type {ol.ImageState} - */ - this.state = ol.ImageState.IDLE; - - /** - * @private - * @type {ol.ImageLoadFunctionType} - */ - this.imageLoadFunction_ = imageLoadFunction; - -}; -goog.inherits(ol.Image, ol.ImageBase); - - -/** - * Get the HTML image element (may be a Canvas, Image, or Video). - * @param {Object=} opt_context Object. - * @return {HTMLCanvasElement|Image|HTMLVideoElement} Image. - * @api - */ -ol.Image.prototype.getImage = function(opt_context) { - if (opt_context !== undefined) { - var image; - var key = goog.getUid(opt_context); - if (key in this.imageByContext_) { - return this.imageByContext_[key]; - } else if (goog.object.isEmpty(this.imageByContext_)) { - image = this.image_; - } else { - image = /** @type {Image} */ (this.image_.cloneNode(false)); - } - this.imageByContext_[key] = image; - return image; - } else { - return this.image_; - } -}; - - -/** - * Tracks loading or read errors. - * - * @private - */ -ol.Image.prototype.handleImageError_ = function() { - this.state = ol.ImageState.ERROR; - this.unlistenImage_(); - this.changed(); -}; - - -/** - * Tracks successful image load. - * - * @private - */ -ol.Image.prototype.handleImageLoad_ = function() { - if (this.resolution === undefined) { - this.resolution = ol.extent.getHeight(this.extent) / this.image_.height; - } - this.state = ol.ImageState.LOADED; - this.unlistenImage_(); - this.changed(); -}; - - -/** - * Load not yet loaded URI. - */ -ol.Image.prototype.load = function() { - if (this.state == ol.ImageState.IDLE) { - this.state = ol.ImageState.LOADING; - this.changed(); - goog.asserts.assert(!this.imageListenerKeys_, - 'this.imageListenerKeys_ should be null'); - this.imageListenerKeys_ = [ - goog.events.listenOnce(this.image_, goog.events.EventType.ERROR, - this.handleImageError_, false, this), - goog.events.listenOnce(this.image_, goog.events.EventType.LOAD, - this.handleImageLoad_, false, this) - ]; - this.imageLoadFunction_(this, this.src_); - } -}; - - -/** - * Discards event handlers which listen for load completion or errors. - * - * @private - */ -ol.Image.prototype.unlistenImage_ = function() { - goog.asserts.assert(this.imageListenerKeys_, - 'this.imageListenerKeys_ should not be null'); - this.imageListenerKeys_.forEach(goog.events.unlistenByKey); - this.imageListenerKeys_ = null; -}; - -goog.provide('ol.ImageLoadFunctionType'); - - -/** - * A function that takes an {@link ol.Image} for the image and a `{string}` for - * the src as arguments. It is supposed to make it so the underlying image - * {@link ol.Image#getImage} is assigned the content specified by the src. If - * not specified, the default is - * - * function(image, src) { - * image.getImage().src = src; - * } - * - * Providing a custom `imageLoadFunction` can be useful to load images with - * post requests or - in general - through XHR requests, where the src of the - * image element would be set to a data URI when the content is loaded. - * - * @typedef {function(ol.Image, string)} - * @api - */ -ol.ImageLoadFunctionType; - -goog.provide('ol.ImageTile'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol.Tile'); -goog.require('ol.TileCoord'); -goog.require('ol.TileLoadFunctionType'); -goog.require('ol.TileState'); - - - -/** - * @constructor - * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. - * @param {string} src Image source URI. - * @param {?string} crossOrigin Cross origin. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. - */ -ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction) { - - goog.base(this, tileCoord, state); - - /** - * Image URI - * - * @private - * @type {string} - */ - this.src_ = src; - - /** - * @private - * @type {Image} - */ - this.image_ = new Image(); - if (crossOrigin !== null) { - this.image_.crossOrigin = crossOrigin; - } - - /** - * @private - * @type {Object.<number, Image>} - */ - this.imageByContext_ = {}; - - /** - * @private - * @type {Array.<goog.events.Key>} - */ - this.imageListenerKeys_ = null; - - /** - * @private - * @type {ol.TileLoadFunctionType} - */ - this.tileLoadFunction_ = tileLoadFunction; - -}; -goog.inherits(ol.ImageTile, ol.Tile); - - -/** - * @inheritDoc - */ -ol.ImageTile.prototype.disposeInternal = function() { - if (this.state == ol.TileState.LOADING) { - this.unlistenImage_(); - } - goog.base(this, 'disposeInternal'); -}; - - -/** - * Get the image element for this tile. - * @inheritDoc - * @api - */ -ol.ImageTile.prototype.getImage = function(opt_context) { - if (opt_context !== undefined) { - var image; - var key = goog.getUid(opt_context); - if (key in this.imageByContext_) { - return this.imageByContext_[key]; - } else if (goog.object.isEmpty(this.imageByContext_)) { - image = this.image_; - } else { - image = /** @type {Image} */ (this.image_.cloneNode(false)); - } - this.imageByContext_[key] = image; - return image; - } else { - return this.image_; - } -}; - - -/** - * @inheritDoc - */ -ol.ImageTile.prototype.getKey = function() { - return this.src_; -}; - - -/** - * Tracks loading or read errors. - * - * @private - */ -ol.ImageTile.prototype.handleImageError_ = function() { - this.state = ol.TileState.ERROR; - this.unlistenImage_(); - this.changed(); -}; - - -/** - * Tracks successful image load. - * - * @private - */ -ol.ImageTile.prototype.handleImageLoad_ = function() { - if (this.image_.naturalWidth && this.image_.naturalHeight) { - this.state = ol.TileState.LOADED; - } else { - this.state = ol.TileState.EMPTY; - } - this.unlistenImage_(); - this.changed(); -}; - - -/** - * Load not yet loaded URI. - */ -ol.ImageTile.prototype.load = function() { - if (this.state == ol.TileState.IDLE) { - this.state = ol.TileState.LOADING; - this.changed(); - goog.asserts.assert(!this.imageListenerKeys_, - 'this.imageListenerKeys_ should be null'); - this.imageListenerKeys_ = [ - goog.events.listenOnce(this.image_, goog.events.EventType.ERROR, - this.handleImageError_, false, this), - goog.events.listenOnce(this.image_, goog.events.EventType.LOAD, - this.handleImageLoad_, false, this) - ]; - this.tileLoadFunction_(this, this.src_); - } -}; - - -/** - * Discards event handlers which listen for load completion or errors. - * - * @private - */ -ol.ImageTile.prototype.unlistenImage_ = function() { - goog.asserts.assert(this.imageListenerKeys_, - 'this.imageListenerKeys_ should not be null'); - this.imageListenerKeys_.forEach(goog.events.unlistenByKey); - this.imageListenerKeys_ = null; -}; - -goog.provide('ol.ImageUrlFunction'); -goog.provide('ol.ImageUrlFunctionType'); - -goog.require('ol.Size'); - - -/** - * @typedef {function(this:ol.source.Image, ol.Extent, ol.Size, - * ol.proj.Projection): (string|undefined)} - */ -ol.ImageUrlFunctionType; - - -/** - * @param {string} baseUrl Base URL (may have query data). - * @param {Object.<string,*>} params to encode in the URL. - * @param {function(string, Object.<string,*>, ol.Extent, ol.Size, - * ol.proj.Projection): (string|undefined)} paramsFunction params function. - * @return {ol.ImageUrlFunctionType} Image URL function. - */ -ol.ImageUrlFunction.createFromParamsFunction = - function(baseUrl, params, paramsFunction) { - return ( - /** - * @this {ol.source.Image} - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Size. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} URL. - */ - function(extent, size, projection) { - return paramsFunction(baseUrl, params, extent, size, projection); - }); -}; - - -/** - * @this {ol.source.Image} - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Size. - * @return {string|undefined} Image URL. - */ -ol.ImageUrlFunction.nullImageUrlFunction = - function(extent, size) { - return undefined; -}; - -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Provides a files drag and drop event detector. It works on - * HTML5 browsers. - * - * @see ../demos/filedrophandler.html - */ - -goog.provide('goog.events.FileDropHandler'); -goog.provide('goog.events.FileDropHandler.EventType'); - -goog.require('goog.array'); -goog.require('goog.dom'); -goog.require('goog.events.BrowserEvent'); -goog.require('goog.events.EventHandler'); -goog.require('goog.events.EventTarget'); -goog.require('goog.events.EventType'); -goog.require('goog.log'); -goog.require('goog.log.Level'); - - - -/** - * A files drag and drop event detector. Gets an {@code element} as parameter - * and fires {@code goog.events.FileDropHandler.EventType.DROP} event when files - * are dropped in the {@code element}. - * - * @param {Element|Document} element The element or document to listen on. - * @param {boolean=} opt_preventDropOutside Whether to prevent a drop on the - * area outside the {@code element}. Default false. - * @constructor - * @extends {goog.events.EventTarget} - * @final - */ -goog.events.FileDropHandler = function(element, opt_preventDropOutside) { - goog.events.EventTarget.call(this); - - /** - * Handler for drag/drop events. - * @type {!goog.events.EventHandler<!goog.events.FileDropHandler>} - * @private - */ - this.eventHandler_ = new goog.events.EventHandler(this); - - var doc = element; - if (opt_preventDropOutside) { - doc = goog.dom.getOwnerDocument(element); - } - - // Add dragenter listener to the owner document of the element. - this.eventHandler_.listen(doc, - goog.events.EventType.DRAGENTER, - this.onDocDragEnter_); - - // Add dragover listener to the owner document of the element only if the - // document is not the element itself. - if (doc != element) { - this.eventHandler_.listen(doc, - goog.events.EventType.DRAGOVER, - this.onDocDragOver_); - } - - // Add dragover and drop listeners to the element. - this.eventHandler_.listen(element, - goog.events.EventType.DRAGOVER, - this.onElemDragOver_); - this.eventHandler_.listen(element, - goog.events.EventType.DROP, - this.onElemDrop_); -}; -goog.inherits(goog.events.FileDropHandler, goog.events.EventTarget); - - -/** - * Whether the drag event contains files. It is initialized only in the - * dragenter event. It is used in all the drag events to prevent default actions - * only if the drag contains files. Preventing default actions is necessary to - * go from dragenter to dragover and from dragover to drop. However we do not - * always want to prevent default actions, e.g. when the user drags text or - * links on a text area we should not prevent the browser default action that - * inserts the text in the text area. It is also necessary to stop propagation - * when handling drag events on the element to prevent them from propagating - * to the document. - * @private - * @type {boolean} - */ -goog.events.FileDropHandler.prototype.dndContainsFiles_ = false; - - -/** - * A logger, used to help us debug the algorithm. - * @type {goog.log.Logger} - * @private - */ -goog.events.FileDropHandler.prototype.logger_ = - goog.log.getLogger('goog.events.FileDropHandler'); - - -/** - * The types of events fired by this class. - * @enum {string} - */ -goog.events.FileDropHandler.EventType = { - DROP: goog.events.EventType.DROP -}; - - -/** @override */ -goog.events.FileDropHandler.prototype.disposeInternal = function() { - goog.events.FileDropHandler.superClass_.disposeInternal.call(this); - this.eventHandler_.dispose(); -}; - - -/** - * Dispatches the DROP event. - * @param {goog.events.BrowserEvent} e The underlying browser event. - * @private - */ -goog.events.FileDropHandler.prototype.dispatch_ = function(e) { - goog.log.fine(this.logger_, 'Firing DROP event...'); - var event = new goog.events.BrowserEvent(e.getBrowserEvent()); - event.type = goog.events.FileDropHandler.EventType.DROP; - this.dispatchEvent(event); -}; - - -/** - * Handles dragenter on the document. - * @param {goog.events.BrowserEvent} e The dragenter event. - * @private - */ -goog.events.FileDropHandler.prototype.onDocDragEnter_ = function(e) { - goog.log.log(this.logger_, goog.log.Level.FINER, - '"' + e.target.id + '" (' + e.target + ') dispatched: ' + e.type); - var dt = e.getBrowserEvent().dataTransfer; - // Check whether the drag event contains files. - this.dndContainsFiles_ = !!(dt && - ((dt.types && - (goog.array.contains(dt.types, 'Files') || - goog.array.contains(dt.types, 'public.file-url'))) || - (dt.files && dt.files.length > 0))); - // If it does - if (this.dndContainsFiles_) { - // Prevent default actions. - e.preventDefault(); - } - goog.log.log(this.logger_, goog.log.Level.FINER, - 'dndContainsFiles_: ' + this.dndContainsFiles_); -}; - - -/** - * Handles dragging something over the document. - * @param {goog.events.BrowserEvent} e The dragover event. - * @private - */ -goog.events.FileDropHandler.prototype.onDocDragOver_ = function(e) { - goog.log.log(this.logger_, goog.log.Level.FINEST, - '"' + e.target.id + '" (' + e.target + ') dispatched: ' + e.type); - if (this.dndContainsFiles_) { - // Prevent default actions. - e.preventDefault(); - // Disable the drop on the document outside the drop zone. - var dt = e.getBrowserEvent().dataTransfer; - dt.dropEffect = 'none'; - } -}; - - -/** - * Handles dragging something over the element (drop zone). - * @param {goog.events.BrowserEvent} e The dragover event. - * @private - */ -goog.events.FileDropHandler.prototype.onElemDragOver_ = function(e) { - goog.log.log(this.logger_, goog.log.Level.FINEST, - '"' + e.target.id + '" (' + e.target + ') dispatched: ' + e.type); - if (this.dndContainsFiles_) { - // Prevent default actions and stop the event from propagating further to - // the document. Both lines are needed! (See comment above). - e.preventDefault(); - e.stopPropagation(); - // Allow the drop on the drop zone. - var dt = e.getBrowserEvent().dataTransfer; - - // IE bug #811625 (https://goo.gl/UWuxX0) will throw error SCRIPT65535 - // when attempting to set property effectAllowed on IE10+. - // See more: https://github.com/google/closure-library/issues/485. - try { - dt.effectAllowed = 'all'; - } catch (err) { - } - dt.dropEffect = 'copy'; - } -}; - - -/** - * Handles dropping something onto the element (drop zone). - * @param {goog.events.BrowserEvent} e The drop event. - * @private - */ -goog.events.FileDropHandler.prototype.onElemDrop_ = function(e) { - goog.log.log(this.logger_, goog.log.Level.FINER, - '"' + e.target.id + '" (' + e.target + ') dispatched: ' + e.type); - // If the drag and drop event contains files. - if (this.dndContainsFiles_) { - // Prevent default actions and stop the event from propagating further to - // the document. Both lines are needed! (See comment above). - e.preventDefault(); - e.stopPropagation(); - // Dispatch DROP event. - this.dispatch_(e); - } -}; - -// Copyright 2007 Bob Ippolito. All Rights Reserved. -// Modifications Copyright 2009 The Closure Library Authors. All Rights -// Reserved. - -/** - * @license Portions of this code are from MochiKit, received by - * The Closure Authors under the MIT license. All other code is Copyright - * 2005-2009 The Closure Authors. All Rights Reserved. - */ - -/** - * @fileoverview Classes for tracking asynchronous operations and handling the - * results. The Deferred object here is patterned after the Deferred object in - * the Twisted python networking framework. - * - * See: http://twistedmatrix.com/projects/core/documentation/howto/defer.html - * - * Based on the Dojo code which in turn is based on the MochiKit code. - * - * @author arv@google.com (Erik Arvidsson) - * @author brenneman@google.com (Shawn Brenneman) - */ - -goog.provide('goog.async.Deferred'); -goog.provide('goog.async.Deferred.AlreadyCalledError'); -goog.provide('goog.async.Deferred.CanceledError'); - -goog.require('goog.Promise'); -goog.require('goog.Thenable'); -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.debug.Error'); - - - -/** - * A Deferred represents the result of an asynchronous operation. A Deferred - * instance has no result when it is created, and is "fired" (given an initial - * result) by calling {@code callback} or {@code errback}. - * - * Once fired, the result is passed through a sequence of callback functions - * registered with {@code addCallback} or {@code addErrback}. The functions may - * mutate the result before it is passed to the next function in the sequence. - * - * Callbacks and errbacks may be added at any time, including after the Deferred - * has been "fired". If there are no pending actions in the execution sequence - * of a fired Deferred, any new callback functions will be called with the last - * computed result. Adding a callback function is the only way to access the - * result of the Deferred. - * - * If a Deferred operation is canceled, an optional user-provided cancellation - * function is invoked which may perform any special cleanup, followed by firing - * the Deferred's errback sequence with a {@code CanceledError}. If the - * Deferred has already fired, cancellation is ignored. - * - * Deferreds may be templated to a specific type they produce using generics - * with syntax such as: - * <code> - * /** @type {goog.async.Deferred<string>} */ - * var d = new goog.async.Deferred(); - * // Compiler can infer that foo is a string. - * d.addCallback(function(foo) {...}); - * d.callback('string'); // Checked to be passed a string - * </code> - * Since deferreds are often used to produce different values across a chain, - * the type information is not propagated across chains, but rather only - * associated with specifically cast objects. - * - * @param {Function=} opt_onCancelFunction A function that will be called if the - * Deferred is canceled. If provided, this function runs before the - * Deferred is fired with a {@code CanceledError}. - * @param {Object=} opt_defaultScope The default object context to call - * callbacks and errbacks in. - * @constructor - * @implements {goog.Thenable<VALUE>} - * @template VALUE - */ -goog.async.Deferred = function(opt_onCancelFunction, opt_defaultScope) { - /** - * Entries in the sequence are arrays containing a callback, an errback, and - * an optional scope. The callback or errback in an entry may be null. - * @type {!Array<!Array>} - * @private - */ - this.sequence_ = []; - - /** - * Optional function that will be called if the Deferred is canceled. - * @type {Function|undefined} - * @private - */ - this.onCancelFunction_ = opt_onCancelFunction; - - /** - * The default scope to execute callbacks and errbacks in. - * @type {Object} - * @private - */ - this.defaultScope_ = opt_defaultScope || null; - - /** - * Whether the Deferred has been fired. - * @type {boolean} - * @private - */ - this.fired_ = false; - - /** - * Whether the last result in the execution sequence was an error. - * @type {boolean} - * @private - */ - this.hadError_ = false; - - /** - * The current Deferred result, updated as callbacks and errbacks are - * executed. - * @type {*} - * @private - */ - this.result_ = undefined; - - /** - * Whether the Deferred is blocked waiting on another Deferred to fire. If a - * callback or errback returns a Deferred as a result, the execution sequence - * is blocked until that Deferred result becomes available. - * @type {boolean} - * @private - */ - this.blocked_ = false; - - /** - * Whether this Deferred is blocking execution of another Deferred. If this - * instance was returned as a result in another Deferred's execution - * sequence,that other Deferred becomes blocked until this instance's - * execution sequence completes. No additional callbacks may be added to a - * Deferred once it is blocking another instance. - * @type {boolean} - * @private - */ - this.blocking_ = false; - - /** - * Whether the Deferred has been canceled without having a custom cancel - * function. - * @type {boolean} - * @private - */ - this.silentlyCanceled_ = false; - - /** - * If an error is thrown during Deferred execution with no errback to catch - * it, the error is rethrown after a timeout. Reporting the error after a - * timeout allows execution to continue in the calling context (empty when - * no error is scheduled). - * @type {number} - * @private - */ - this.unhandledErrorId_ = 0; - - /** - * If this Deferred was created by branch(), this will be the "parent" - * Deferred. - * @type {goog.async.Deferred} - * @private - */ - this.parent_ = null; - - /** - * The number of Deferred objects that have been branched off this one. This - * will be decremented whenever a branch is fired or canceled. - * @type {number} - * @private - */ - this.branches_ = 0; - - if (goog.async.Deferred.LONG_STACK_TRACES) { - /** - * Holds the stack trace at time of deferred creation if the JS engine - * provides the Error.captureStackTrace API. - * @private {?string} - */ - this.constructorStack_ = null; - if (Error.captureStackTrace) { - var target = { stack: '' }; - Error.captureStackTrace(target, goog.async.Deferred); - // Check if Error.captureStackTrace worked. It fails in gjstest. - if (typeof target.stack == 'string') { - // Remove first line and force stringify to prevent memory leak due to - // holding on to actual stack frames. - this.constructorStack_ = target.stack.replace(/^[^\n]*\n/, ''); - } - } - } -}; - - -/** - * @define {boolean} Whether unhandled errors should always get rethrown to the - * global scope. Defaults to the value of goog.DEBUG. - */ -goog.define('goog.async.Deferred.STRICT_ERRORS', false); - - -/** - * @define {boolean} Whether to attempt to make stack traces long. Defaults to - * the value of goog.DEBUG. - */ -goog.define('goog.async.Deferred.LONG_STACK_TRACES', false); - - -/** - * Cancels a Deferred that has not yet been fired, or is blocked on another - * deferred operation. If this Deferred is waiting for a blocking Deferred to - * fire, the blocking Deferred will also be canceled. - * - * If this Deferred was created by calling branch() on a parent Deferred with - * opt_propagateCancel set to true, the parent may also be canceled. If - * opt_deepCancel is set, cancel() will be called on the parent (as well as any - * other ancestors if the parent is also a branch). If one or more branches were - * created with opt_propagateCancel set to true, the parent will be canceled if - * cancel() is called on all of those branches. - * - * @param {boolean=} opt_deepCancel If true, cancels this Deferred's parent even - * if cancel() hasn't been called on some of the parent's branches. Has no - * effect on a branch without opt_propagateCancel set to true. - */ -goog.async.Deferred.prototype.cancel = function(opt_deepCancel) { - if (!this.hasFired()) { - if (this.parent_) { - // Get rid of the parent reference before potentially running the parent's - // canceler function to ensure that this cancellation isn't - // double-counted. - var parent = this.parent_; - delete this.parent_; - if (opt_deepCancel) { - parent.cancel(opt_deepCancel); - } else { - parent.branchCancel_(); - } - } - - if (this.onCancelFunction_) { - // Call in user-specified scope. - this.onCancelFunction_.call(this.defaultScope_, this); - } else { - this.silentlyCanceled_ = true; - } - if (!this.hasFired()) { - this.errback(new goog.async.Deferred.CanceledError(this)); - } - } else if (this.result_ instanceof goog.async.Deferred) { - this.result_.cancel(); - } -}; - - -/** - * Handle a single branch being canceled. Once all branches are canceled, this - * Deferred will be canceled as well. - * - * @private - */ -goog.async.Deferred.prototype.branchCancel_ = function() { - this.branches_--; - if (this.branches_ <= 0) { - this.cancel(); - } -}; - - -/** - * Called after a blocking Deferred fires. Unblocks this Deferred and resumes - * its execution sequence. - * - * @param {boolean} isSuccess Whether the result is a success or an error. - * @param {*} res The result of the blocking Deferred. - * @private - */ -goog.async.Deferred.prototype.continue_ = function(isSuccess, res) { - this.blocked_ = false; - this.updateResult_(isSuccess, res); -}; - - -/** - * Updates the current result based on the success or failure of the last action - * in the execution sequence. - * - * @param {boolean} isSuccess Whether the new result is a success or an error. - * @param {*} res The result. - * @private - */ -goog.async.Deferred.prototype.updateResult_ = function(isSuccess, res) { - this.fired_ = true; - this.result_ = res; - this.hadError_ = !isSuccess; - this.fire_(); -}; - - -/** - * Verifies that the Deferred has not yet been fired. - * - * @private - * @throws {Error} If this has already been fired. - */ -goog.async.Deferred.prototype.check_ = function() { - if (this.hasFired()) { - if (!this.silentlyCanceled_) { - throw new goog.async.Deferred.AlreadyCalledError(this); - } - this.silentlyCanceled_ = false; - } -}; - - -/** - * Fire the execution sequence for this Deferred by passing the starting result - * to the first registered callback. - * @param {VALUE=} opt_result The starting result. - */ -goog.async.Deferred.prototype.callback = function(opt_result) { - this.check_(); - this.assertNotDeferred_(opt_result); - this.updateResult_(true /* isSuccess */, opt_result); -}; - - -/** - * Fire the execution sequence for this Deferred by passing the starting error - * result to the first registered errback. - * @param {*=} opt_result The starting error. - */ -goog.async.Deferred.prototype.errback = function(opt_result) { - this.check_(); - this.assertNotDeferred_(opt_result); - this.makeStackTraceLong_(opt_result); - this.updateResult_(false /* isSuccess */, opt_result); -}; - - -/** - * Attempt to make the error's stack trace be long in that it contains the - * stack trace from the point where the deferred was created on top of the - * current stack trace to give additional context. - * @param {*} error - * @private - */ -goog.async.Deferred.prototype.makeStackTraceLong_ = function(error) { - if (!goog.async.Deferred.LONG_STACK_TRACES) { - return; - } - if (this.constructorStack_ && goog.isObject(error) && error.stack && - // Stack looks like it was system generated. See - // https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - (/^[^\n]+(\n [^\n]+)+/).test(error.stack)) { - error.stack = error.stack + '\nDEFERRED OPERATION:\n' + - this.constructorStack_; - } -}; - - -/** - * Asserts that an object is not a Deferred. - * @param {*} obj The object to test. - * @throws {Error} Throws an exception if the object is a Deferred. - * @private - */ -goog.async.Deferred.prototype.assertNotDeferred_ = function(obj) { - goog.asserts.assert( - !(obj instanceof goog.async.Deferred), - 'An execution sequence may not be initiated with a blocking Deferred.'); -}; - - -/** - * Register a callback function to be called with a successful result. If no - * value is returned by the callback function, the result value is unchanged. If - * a new value is returned, it becomes the Deferred result and will be passed to - * the next callback in the execution sequence. - * - * If the function throws an error, the error becomes the new result and will be - * passed to the next errback in the execution chain. - * - * If the function returns a Deferred, the execution sequence will be blocked - * until that Deferred fires. Its result will be passed to the next callback (or - * errback if it is an error result) in this Deferred's execution sequence. - * - * @param {!function(this:T,VALUE):?} cb The function to be called with a - * successful result. - * @param {T=} opt_scope An optional scope to call the callback in. - * @return {!goog.async.Deferred} This Deferred. - * @template T - */ -goog.async.Deferred.prototype.addCallback = function(cb, opt_scope) { - return this.addCallbacks(cb, null, opt_scope); -}; - - -/** - * Register a callback function to be called with an error result. If no value - * is returned by the function, the error result is unchanged. If a new error - * value is returned or thrown, that error becomes the Deferred result and will - * be passed to the next errback in the execution sequence. - * - * If the errback function handles the error by returning a non-error value, - * that result will be passed to the next normal callback in the sequence. - * - * If the function returns a Deferred, the execution sequence will be blocked - * until that Deferred fires. Its result will be passed to the next callback (or - * errback if it is an error result) in this Deferred's execution sequence. - * - * @param {!function(this:T,?):?} eb The function to be called on an - * unsuccessful result. - * @param {T=} opt_scope An optional scope to call the errback in. - * @return {!goog.async.Deferred<VALUE>} This Deferred. - * @template T - */ -goog.async.Deferred.prototype.addErrback = function(eb, opt_scope) { - return this.addCallbacks(null, eb, opt_scope); -}; - - -/** - * Registers one function as both a callback and errback. - * - * @param {!function(this:T,?):?} f The function to be called on any result. - * @param {T=} opt_scope An optional scope to call the function in. - * @return {!goog.async.Deferred} This Deferred. - * @template T - */ -goog.async.Deferred.prototype.addBoth = function(f, opt_scope) { - return this.addCallbacks(f, f, opt_scope); -}; - - -/** - * Like addBoth, but propagates uncaught exceptions in the errback. - * - * @param {function(this:T,?):?} f The function to be called on any result. - * @param {T=} opt_scope An optional scope to call the function in. - * @return {!goog.async.Deferred<VALUE>} This Deferred. - * @template T - */ -goog.async.Deferred.prototype.addFinally = function(f, opt_scope) { - var self = this; - return this.addCallbacks(f, function(err) { - var result = f.call(self, err); - if (!goog.isDef(result)) { - throw err; - } - return result; - }, opt_scope); -}; - - -/** - * Registers a callback function and an errback function at the same position - * in the execution sequence. Only one of these functions will execute, - * depending on the error state during the execution sequence. - * - * NOTE: This is not equivalent to {@code def.addCallback().addErrback()}! If - * the callback is invoked, the errback will be skipped, and vice versa. - * - * @param {?(function(this:T,VALUE):?)} cb The function to be called on a - * successful result. - * @param {?(function(this:T,?):?)} eb The function to be called on an - * unsuccessful result. - * @param {T=} opt_scope An optional scope to call the functions in. - * @return {!goog.async.Deferred} This Deferred. - * @template T - */ -goog.async.Deferred.prototype.addCallbacks = function(cb, eb, opt_scope) { - goog.asserts.assert(!this.blocking_, 'Blocking Deferreds can not be re-used'); - this.sequence_.push([cb, eb, opt_scope]); - if (this.hasFired()) { - this.fire_(); - } - return this; -}; - - -/** - * Implements {@see goog.Thenable} for seamless integration with - * {@see goog.Promise}. - * Deferred results are mutable and may represent multiple values over - * their lifetime. Calling {@code then} on a Deferred returns a Promise - * with the result of the Deferred at that point in its callback chain. - * Note that if the Deferred result is never mutated, and only - * {@code then} calls are made, the Deferred will behave like a Promise. - * - * @override - */ -goog.async.Deferred.prototype.then = function(opt_onFulfilled, opt_onRejected, - opt_context) { - var resolve, reject; - var promise = new goog.Promise(function(res, rej) { - // Copying resolvers to outer scope, so that they are available when the - // deferred callback fires (which may be synchronous). - resolve = res; - reject = rej; - }); - this.addCallbacks(resolve, function(reason) { - if (reason instanceof goog.async.Deferred.CanceledError) { - promise.cancel(); - } else { - reject(reason); - } - }); - return promise.then(opt_onFulfilled, opt_onRejected, opt_context); -}; -goog.Thenable.addImplementation(goog.async.Deferred); - - -/** - * Links another Deferred to the end of this Deferred's execution sequence. The - * result of this execution sequence will be passed as the starting result for - * the chained Deferred, invoking either its first callback or errback. - * - * @param {!goog.async.Deferred} otherDeferred The Deferred to chain. - * @return {!goog.async.Deferred} This Deferred. - */ -goog.async.Deferred.prototype.chainDeferred = function(otherDeferred) { - this.addCallbacks( - otherDeferred.callback, otherDeferred.errback, otherDeferred); - return this; -}; - - -/** - * Makes this Deferred wait for another Deferred's execution sequence to - * complete before continuing. - * - * This is equivalent to adding a callback that returns {@code otherDeferred}, - * but doesn't prevent additional callbacks from being added to - * {@code otherDeferred}. - * - * @param {!goog.async.Deferred|!goog.Thenable} otherDeferred The Deferred - * to wait for. - * @return {!goog.async.Deferred} This Deferred. - */ -goog.async.Deferred.prototype.awaitDeferred = function(otherDeferred) { - if (!(otherDeferred instanceof goog.async.Deferred)) { - // The Thenable case. - return this.addCallback(function() { - return otherDeferred; - }); - } - return this.addCallback(goog.bind(otherDeferred.branch, otherDeferred)); -}; - - -/** - * Creates a branch off this Deferred's execution sequence, and returns it as a - * new Deferred. The branched Deferred's starting result will be shared with the - * parent at the point of the branch, even if further callbacks are added to the - * parent. - * - * All branches at the same stage in the execution sequence will receive the - * same starting value. - * - * @param {boolean=} opt_propagateCancel If cancel() is called on every child - * branch created with opt_propagateCancel, the parent will be canceled as - * well. - * @return {!goog.async.Deferred<VALUE>} A Deferred that will be started with - * the computed result from this stage in the execution sequence. - */ -goog.async.Deferred.prototype.branch = function(opt_propagateCancel) { - var d = new goog.async.Deferred(); - this.chainDeferred(d); - if (opt_propagateCancel) { - d.parent_ = this; - this.branches_++; - } - return d; -}; - - -/** - * @return {boolean} Whether the execution sequence has been started on this - * Deferred by invoking {@code callback} or {@code errback}. - */ -goog.async.Deferred.prototype.hasFired = function() { - return this.fired_; -}; - - -/** - * @param {*} res The latest result in the execution sequence. - * @return {boolean} Whether the current result is an error that should cause - * the next errback to fire. May be overridden by subclasses to handle - * special error types. - * @protected - */ -goog.async.Deferred.prototype.isError = function(res) { - return res instanceof Error; -}; - - -/** - * @return {boolean} Whether an errback exists in the remaining sequence. - * @private - */ -goog.async.Deferred.prototype.hasErrback_ = function() { - return goog.array.some(this.sequence_, function(sequenceRow) { - // The errback is the second element in the array. - return goog.isFunction(sequenceRow[1]); - }); -}; - - -/** - * Exhausts the execution sequence while a result is available. The result may - * be modified by callbacks or errbacks, and execution will block if the - * returned result is an incomplete Deferred. - * - * @private - */ -goog.async.Deferred.prototype.fire_ = function() { - if (this.unhandledErrorId_ && this.hasFired() && this.hasErrback_()) { - // It is possible to add errbacks after the Deferred has fired. If a new - // errback is added immediately after the Deferred encountered an unhandled - // error, but before that error is rethrown, the error is unscheduled. - goog.async.Deferred.unscheduleError_(this.unhandledErrorId_); - this.unhandledErrorId_ = 0; - } - - if (this.parent_) { - this.parent_.branches_--; - delete this.parent_; - } - - var res = this.result_; - var unhandledException = false; - var isNewlyBlocked = false; - - while (this.sequence_.length && !this.blocked_) { - var sequenceEntry = this.sequence_.shift(); - - var callback = sequenceEntry[0]; - var errback = sequenceEntry[1]; - var scope = sequenceEntry[2]; - - var f = this.hadError_ ? errback : callback; - if (f) { - /** @preserveTry */ - try { - var ret = f.call(scope || this.defaultScope_, res); - - // If no result, then use previous result. - if (goog.isDef(ret)) { - // Bubble up the error as long as the return value hasn't changed. - this.hadError_ = this.hadError_ && (ret == res || this.isError(ret)); - this.result_ = res = ret; - } - - if (goog.Thenable.isImplementedBy(res) || - (typeof goog.global['Promise'] === 'function' && - res instanceof goog.global['Promise'])) { - isNewlyBlocked = true; - this.blocked_ = true; - } - - } catch (ex) { - res = ex; - this.hadError_ = true; - this.makeStackTraceLong_(res); - - if (!this.hasErrback_()) { - // If an error is thrown with no additional errbacks in the queue, - // prepare to rethrow the error. - unhandledException = true; - } - } - } - } - - this.result_ = res; - - if (isNewlyBlocked) { - var onCallback = goog.bind(this.continue_, this, true /* isSuccess */); - var onErrback = goog.bind(this.continue_, this, false /* isSuccess */); - - if (res instanceof goog.async.Deferred) { - res.addCallbacks(onCallback, onErrback); - res.blocking_ = true; - } else { - res.then(onCallback, onErrback); - } - } else if (goog.async.Deferred.STRICT_ERRORS && this.isError(res) && - !(res instanceof goog.async.Deferred.CanceledError)) { - this.hadError_ = true; - unhandledException = true; - } - - if (unhandledException) { - // Rethrow the unhandled error after a timeout. Execution will continue, but - // the error will be seen by global handlers and the user. The throw will - // be canceled if another errback is appended before the timeout executes. - // The error's original stack trace is preserved where available. - this.unhandledErrorId_ = goog.async.Deferred.scheduleError_(res); - } -}; - - -/** - * Creates a Deferred that has an initial result. - * - * @param {*=} opt_result The result. - * @return {!goog.async.Deferred} The new Deferred. - */ -goog.async.Deferred.succeed = function(opt_result) { - var d = new goog.async.Deferred(); - d.callback(opt_result); - return d; -}; - - -/** - * Creates a Deferred that fires when the given promise resolves. - * Use only during migration to Promises. - * - * @param {!goog.Promise<T>} promise - * @return {!goog.async.Deferred<T>} The new Deferred. - * @template T - */ -goog.async.Deferred.fromPromise = function(promise) { - var d = new goog.async.Deferred(); - d.callback(); - d.addCallback(function() { - return promise; - }); - return d; -}; - - -/** - * Creates a Deferred that has an initial error result. - * - * @param {*} res The error result. - * @return {!goog.async.Deferred} The new Deferred. - */ -goog.async.Deferred.fail = function(res) { - var d = new goog.async.Deferred(); - d.errback(res); - return d; -}; - - -/** - * Creates a Deferred that has already been canceled. - * - * @return {!goog.async.Deferred} The new Deferred. - */ -goog.async.Deferred.canceled = function() { - var d = new goog.async.Deferred(); - d.cancel(); - return d; -}; - - -/** - * Normalizes values that may or may not be Deferreds. - * - * If the input value is a Deferred, the Deferred is branched (so the original - * execution sequence is not modified) and the input callback added to the new - * branch. The branch is returned to the caller. - * - * If the input value is not a Deferred, the callback will be executed - * immediately and an already firing Deferred will be returned to the caller. - * - * In the following (contrived) example, if <code>isImmediate</code> is true - * then 3 is alerted immediately, otherwise 6 is alerted after a 2-second delay. - * - * <pre> - * var value; - * if (isImmediate) { - * value = 3; - * } else { - * value = new goog.async.Deferred(); - * setTimeout(function() { value.callback(6); }, 2000); - * } - * - * var d = goog.async.Deferred.when(value, alert); - * </pre> - * - * @param {*} value Deferred or normal value to pass to the callback. - * @param {!function(this:T, ?):?} callback The callback to execute. - * @param {T=} opt_scope An optional scope to call the callback in. - * @return {!goog.async.Deferred} A new Deferred that will call the input - * callback with the input value. - * @template T - */ -goog.async.Deferred.when = function(value, callback, opt_scope) { - if (value instanceof goog.async.Deferred) { - return value.branch(true).addCallback(callback, opt_scope); - } else { - return goog.async.Deferred.succeed(value).addCallback(callback, opt_scope); - } -}; - - - -/** - * An error sub class that is used when a Deferred has already been called. - * @param {!goog.async.Deferred} deferred The Deferred. - * - * @constructor - * @extends {goog.debug.Error} - */ -goog.async.Deferred.AlreadyCalledError = function(deferred) { - goog.debug.Error.call(this); - - /** - * The Deferred that raised this error. - * @type {goog.async.Deferred} - */ - this.deferred = deferred; -}; -goog.inherits(goog.async.Deferred.AlreadyCalledError, goog.debug.Error); - - -/** @override */ -goog.async.Deferred.AlreadyCalledError.prototype.message = - 'Deferred has already fired'; - - -/** @override */ -goog.async.Deferred.AlreadyCalledError.prototype.name = 'AlreadyCalledError'; - - - -/** - * An error sub class that is used when a Deferred is canceled. - * - * @param {!goog.async.Deferred} deferred The Deferred object. - * @constructor - * @extends {goog.debug.Error} - */ -goog.async.Deferred.CanceledError = function(deferred) { - goog.debug.Error.call(this); - - /** - * The Deferred that raised this error. - * @type {goog.async.Deferred} - */ - this.deferred = deferred; -}; -goog.inherits(goog.async.Deferred.CanceledError, goog.debug.Error); - - -/** @override */ -goog.async.Deferred.CanceledError.prototype.message = 'Deferred was canceled'; - - -/** @override */ -goog.async.Deferred.CanceledError.prototype.name = 'CanceledError'; - - - -/** - * Wrapper around errors that are scheduled to be thrown by failing deferreds - * after a timeout. - * - * @param {*} error Error from a failing deferred. - * @constructor - * @final - * @private - * @struct - */ -goog.async.Deferred.Error_ = function(error) { - /** @const @private {number} */ - this.id_ = goog.global.setTimeout(goog.bind(this.throwError, this), 0); - - /** @const @private {*} */ - this.error_ = error; -}; - - -/** - * Actually throws the error and removes it from the list of pending - * deferred errors. - */ -goog.async.Deferred.Error_.prototype.throwError = function() { - goog.asserts.assert(goog.async.Deferred.errorMap_[this.id_], - 'Cannot throw an error that is not scheduled.'); - delete goog.async.Deferred.errorMap_[this.id_]; - throw this.error_; -}; - - -/** - * Resets the error throw timer. - */ -goog.async.Deferred.Error_.prototype.resetTimer = function() { - goog.global.clearTimeout(this.id_); -}; - - -/** - * Map of unhandled errors scheduled to be rethrown in a future timestep. - * @private {!Object<number|string, goog.async.Deferred.Error_>} - */ -goog.async.Deferred.errorMap_ = {}; - - -/** - * Schedules an error to be thrown after a delay. - * @param {*} error Error from a failing deferred. - * @return {number} Id of the error. - * @private - */ -goog.async.Deferred.scheduleError_ = function(error) { - var deferredError = new goog.async.Deferred.Error_(error); - goog.async.Deferred.errorMap_[deferredError.id_] = deferredError; - return deferredError.id_; -}; - - -/** - * Unschedules an error from being thrown. - * @param {number} id Id of the deferred error to unschedule. - * @private - */ -goog.async.Deferred.unscheduleError_ = function(id) { - var error = goog.async.Deferred.errorMap_[id]; - if (error) { - error.resetTimer(); - delete goog.async.Deferred.errorMap_[id]; - } -}; - - -/** - * Asserts that there are no pending deferred errors. If there are any - * scheduled errors, one will be thrown immediately to make this function fail. - */ -goog.async.Deferred.assertNoErrors = function() { - var map = goog.async.Deferred.errorMap_; - for (var key in map) { - var error = map[key]; - error.resetTimer(); - error.throwError(); - } -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A wrapper for the HTML5 FileError object. - * - */ - -goog.provide('goog.fs.Error'); -goog.provide('goog.fs.Error.ErrorCode'); - -goog.require('goog.debug.Error'); -goog.require('goog.object'); -goog.require('goog.string'); - - - -/** - * A filesystem error. Since the filesystem API is asynchronous, stack traces - * are less useful for identifying where errors come from, so this includes a - * large amount of metadata in the message. - * - * @param {!DOMError} error - * @param {string} action The action being undertaken when the error was raised. - * @constructor - * @extends {goog.debug.Error} - * @final - */ -goog.fs.Error = function(error, action) { - /** @type {string} */ - this.name; - - /** - * @type {goog.fs.Error.ErrorCode} - * @deprecated Use the 'name' or 'message' field instead. - */ - this.code; - - if (goog.isDef(error.name)) { - this.name = error.name; - // TODO(user): Remove warning suppression after JSCompiler stops - // firing a spurious warning here. - /** @suppress {deprecated} */ - this.code = goog.fs.Error.getCodeFromName_(error.name); - } else { - this.code = error.code; - this.name = goog.fs.Error.getNameFromCode_(error.code); - } - goog.fs.Error.base(this, 'constructor', - goog.string.subs('%s %s', this.name, action)); -}; -goog.inherits(goog.fs.Error, goog.debug.Error); - - -/** - * Names of errors that may be thrown by the File API, the File System API, or - * the File Writer API. - * - * @see http://dev.w3.org/2006/webapi/FileAPI/#ErrorAndException - * @see http://www.w3.org/TR/file-system-api/#definitions - * @see http://dev.w3.org/2009/dap/file-system/file-writer.html#definitions - * @enum {string} - */ -goog.fs.Error.ErrorName = { - ABORT: 'AbortError', - ENCODING: 'EncodingError', - INVALID_MODIFICATION: 'InvalidModificationError', - INVALID_STATE: 'InvalidStateError', - NOT_FOUND: 'NotFoundError', - NOT_READABLE: 'NotReadableError', - NO_MODIFICATION_ALLOWED: 'NoModificationAllowedError', - PATH_EXISTS: 'PathExistsError', - QUOTA_EXCEEDED: 'QuotaExceededError', - SECURITY: 'SecurityError', - SYNTAX: 'SyntaxError', - TYPE_MISMATCH: 'TypeMismatchError' -}; - - -/** - * Error codes for file errors. - * @see http://www.w3.org/TR/file-system-api/#idl-def-FileException - * - * @enum {number} - * @deprecated Use the 'name' or 'message' attribute instead. - */ -goog.fs.Error.ErrorCode = { - NOT_FOUND: 1, - SECURITY: 2, - ABORT: 3, - NOT_READABLE: 4, - ENCODING: 5, - NO_MODIFICATION_ALLOWED: 6, - INVALID_STATE: 7, - SYNTAX: 8, - INVALID_MODIFICATION: 9, - QUOTA_EXCEEDED: 10, - TYPE_MISMATCH: 11, - PATH_EXISTS: 12 -}; - - -/** - * @param {goog.fs.Error.ErrorCode} code - * @return {string} name - * @private - */ -goog.fs.Error.getNameFromCode_ = function(code) { - var name = goog.object.findKey(goog.fs.Error.NameToCodeMap_, function(c) { - return code == c; - }); - if (!goog.isDef(name)) { - throw new Error('Invalid code: ' + code); - } - return name; -}; - - -/** - * Returns the code that corresponds to the given name. - * @param {string} name - * @return {goog.fs.Error.ErrorCode} code - * @private - */ -goog.fs.Error.getCodeFromName_ = function(name) { - return goog.fs.Error.NameToCodeMap_[name]; -}; - - -/** - * Mapping from error names to values from the ErrorCode enum. - * @see http://www.w3.org/TR/file-system-api/#definitions. - * @private {!Object<string, goog.fs.Error.ErrorCode>} - */ -goog.fs.Error.NameToCodeMap_ = goog.object.create( - goog.fs.Error.ErrorName.ABORT, - goog.fs.Error.ErrorCode.ABORT, - - goog.fs.Error.ErrorName.ENCODING, - goog.fs.Error.ErrorCode.ENCODING, - - goog.fs.Error.ErrorName.INVALID_MODIFICATION, - goog.fs.Error.ErrorCode.INVALID_MODIFICATION, - - goog.fs.Error.ErrorName.INVALID_STATE, - goog.fs.Error.ErrorCode.INVALID_STATE, - - goog.fs.Error.ErrorName.NOT_FOUND, - goog.fs.Error.ErrorCode.NOT_FOUND, - - goog.fs.Error.ErrorName.NOT_READABLE, - goog.fs.Error.ErrorCode.NOT_READABLE, - - goog.fs.Error.ErrorName.NO_MODIFICATION_ALLOWED, - goog.fs.Error.ErrorCode.NO_MODIFICATION_ALLOWED, - - goog.fs.Error.ErrorName.PATH_EXISTS, - goog.fs.Error.ErrorCode.PATH_EXISTS, - - goog.fs.Error.ErrorName.QUOTA_EXCEEDED, - goog.fs.Error.ErrorCode.QUOTA_EXCEEDED, - - goog.fs.Error.ErrorName.SECURITY, - goog.fs.Error.ErrorCode.SECURITY, - - goog.fs.Error.ErrorName.SYNTAX, - goog.fs.Error.ErrorCode.SYNTAX, - - goog.fs.Error.ErrorName.TYPE_MISMATCH, - goog.fs.Error.ErrorCode.TYPE_MISMATCH); - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A wrapper for the HTML5 File ProgressEvent objects. - * - */ -goog.provide('goog.fs.ProgressEvent'); - -goog.require('goog.events.Event'); - - - -/** - * A wrapper for the progress events emitted by the File APIs. - * - * @param {!ProgressEvent} event The underlying event object. - * @param {!Object} target The file access object emitting the event. - * @extends {goog.events.Event} - * @constructor - * @final - */ -goog.fs.ProgressEvent = function(event, target) { - goog.fs.ProgressEvent.base(this, 'constructor', event.type, target); - - /** - * The underlying event object. - * @type {!ProgressEvent} - * @private - */ - this.event_ = event; -}; -goog.inherits(goog.fs.ProgressEvent, goog.events.Event); - - -/** - * @return {boolean} Whether or not the total size of the of the file being - * saved is known. - */ -goog.fs.ProgressEvent.prototype.isLengthComputable = function() { - return this.event_.lengthComputable; -}; - - -/** - * @return {number} The number of bytes saved so far. - */ -goog.fs.ProgressEvent.prototype.getLoaded = function() { - return this.event_.loaded; -}; - - -/** - * @return {number} The total number of bytes in the file being saved. - */ -goog.fs.ProgressEvent.prototype.getTotal = function() { - return this.event_.total; -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A wrapper for the HTML5 FileReader object. - * - */ - -goog.provide('goog.fs.FileReader'); -goog.provide('goog.fs.FileReader.EventType'); -goog.provide('goog.fs.FileReader.ReadyState'); - -goog.require('goog.async.Deferred'); -goog.require('goog.events.EventTarget'); -goog.require('goog.fs.Error'); -goog.require('goog.fs.ProgressEvent'); - - - -/** - * An object for monitoring the reading of files. This emits ProgressEvents of - * the types listed in {@link goog.fs.FileReader.EventType}. - * - * @constructor - * @extends {goog.events.EventTarget} - * @final - */ -goog.fs.FileReader = function() { - goog.fs.FileReader.base(this, 'constructor'); - - /** - * The underlying FileReader object. - * - * @type {!FileReader} - * @private - */ - this.reader_ = new FileReader(); - - this.reader_.onloadstart = goog.bind(this.dispatchProgressEvent_, this); - this.reader_.onprogress = goog.bind(this.dispatchProgressEvent_, this); - this.reader_.onload = goog.bind(this.dispatchProgressEvent_, this); - this.reader_.onabort = goog.bind(this.dispatchProgressEvent_, this); - this.reader_.onerror = goog.bind(this.dispatchProgressEvent_, this); - this.reader_.onloadend = goog.bind(this.dispatchProgressEvent_, this); -}; -goog.inherits(goog.fs.FileReader, goog.events.EventTarget); - - -/** - * Possible states for a FileReader. - * - * @enum {number} - */ -goog.fs.FileReader.ReadyState = { - /** - * The object has been constructed, but there is no pending read. - */ - INIT: 0, - /** - * Data is being read. - */ - LOADING: 1, - /** - * The data has been read from the file, the read was aborted, or an error - * occurred. - */ - DONE: 2 -}; - - -/** - * Events emitted by a FileReader. - * - * @enum {string} - */ -goog.fs.FileReader.EventType = { - /** - * Emitted when the reading begins. readyState will be LOADING. - */ - LOAD_START: 'loadstart', - /** - * Emitted when progress has been made in reading the file. readyState will be - * LOADING. - */ - PROGRESS: 'progress', - /** - * Emitted when the data has been successfully read. readyState will be - * LOADING. - */ - LOAD: 'load', - /** - * Emitted when the reading has been aborted. readyState will be LOADING. - */ - ABORT: 'abort', - /** - * Emitted when an error is encountered or the reading has been aborted. - * readyState will be LOADING. - */ - ERROR: 'error', - /** - * Emitted when the reading is finished, whether successfully or not. - * readyState will be DONE. - */ - LOAD_END: 'loadend' -}; - - -/** - * Abort the reading of the file. - */ -goog.fs.FileReader.prototype.abort = function() { - try { - this.reader_.abort(); - } catch (e) { - throw new goog.fs.Error(e, 'aborting read'); - } -}; - - -/** - * @return {goog.fs.FileReader.ReadyState} The current state of the FileReader. - */ -goog.fs.FileReader.prototype.getReadyState = function() { - return /** @type {goog.fs.FileReader.ReadyState} */ (this.reader_.readyState); -}; - - -/** - * @return {*} The result of the file read. - */ -goog.fs.FileReader.prototype.getResult = function() { - return this.reader_.result; -}; - - -/** - * @return {goog.fs.Error} The error encountered while reading, if any. - */ -goog.fs.FileReader.prototype.getError = function() { - return this.reader_.error && - new goog.fs.Error(this.reader_.error, 'reading file'); -}; - - -/** - * Wrap a progress event emitted by the underlying file reader and re-emit it. - * - * @param {!ProgressEvent} event The underlying event. - * @private - */ -goog.fs.FileReader.prototype.dispatchProgressEvent_ = function(event) { - this.dispatchEvent(new goog.fs.ProgressEvent(event, this)); -}; - - -/** @override */ -goog.fs.FileReader.prototype.disposeInternal = function() { - goog.fs.FileReader.base(this, 'disposeInternal'); - delete this.reader_; -}; - - -/** - * Starts reading a blob as a binary string. - * @param {!Blob} blob The blob to read. - */ -goog.fs.FileReader.prototype.readAsBinaryString = function(blob) { - this.reader_.readAsBinaryString(blob); -}; - - -/** - * Reads a blob as a binary string. - * @param {!Blob} blob The blob to read. - * @return {!goog.async.Deferred} The deferred Blob contents as a binary string. - * If an error occurs, the errback is called with a {@link goog.fs.Error}. - */ -goog.fs.FileReader.readAsBinaryString = function(blob) { - var reader = new goog.fs.FileReader(); - var d = goog.fs.FileReader.createDeferred_(reader); - reader.readAsBinaryString(blob); - return d; -}; - - -/** - * Starts reading a blob as an array buffer. - * @param {!Blob} blob The blob to read. - */ -goog.fs.FileReader.prototype.readAsArrayBuffer = function(blob) { - this.reader_.readAsArrayBuffer(blob); -}; - - -/** - * Reads a blob as an array buffer. - * @param {!Blob} blob The blob to read. - * @return {!goog.async.Deferred} The deferred Blob contents as an array buffer. - * If an error occurs, the errback is called with a {@link goog.fs.Error}. - */ -goog.fs.FileReader.readAsArrayBuffer = function(blob) { - var reader = new goog.fs.FileReader(); - var d = goog.fs.FileReader.createDeferred_(reader); - reader.readAsArrayBuffer(blob); - return d; -}; - - -/** - * Starts reading a blob as text. - * @param {!Blob} blob The blob to read. - * @param {string=} opt_encoding The name of the encoding to use. - */ -goog.fs.FileReader.prototype.readAsText = function(blob, opt_encoding) { - this.reader_.readAsText(blob, opt_encoding); -}; - - -/** - * Reads a blob as text. - * @param {!Blob} blob The blob to read. - * @param {string=} opt_encoding The name of the encoding to use. - * @return {!goog.async.Deferred} The deferred Blob contents as text. - * If an error occurs, the errback is called with a {@link goog.fs.Error}. - */ -goog.fs.FileReader.readAsText = function(blob, opt_encoding) { - var reader = new goog.fs.FileReader(); - var d = goog.fs.FileReader.createDeferred_(reader); - reader.readAsText(blob, opt_encoding); - return d; -}; - - -/** - * Starts reading a blob as a data URL. - * @param {!Blob} blob The blob to read. - */ -goog.fs.FileReader.prototype.readAsDataUrl = function(blob) { - this.reader_.readAsDataURL(blob); -}; - - -/** - * Reads a blob as a data URL. - * @param {!Blob} blob The blob to read. - * @return {!goog.async.Deferred} The deferred Blob contents as a data URL. - * If an error occurs, the errback is called with a {@link goog.fs.Error}. - */ -goog.fs.FileReader.readAsDataUrl = function(blob) { - var reader = new goog.fs.FileReader(); - var d = goog.fs.FileReader.createDeferred_(reader); - reader.readAsDataUrl(blob); - return d; -}; - - -/** - * Creates a new deferred object for the results of a read method. - * @param {goog.fs.FileReader} reader The reader to create a deferred for. - * @return {!goog.async.Deferred} The deferred results. - * @private - */ -goog.fs.FileReader.createDeferred_ = function(reader) { - var deferred = new goog.async.Deferred(); - reader.listen(goog.fs.FileReader.EventType.LOAD_END, - goog.partial(function(d, r, e) { - var result = r.getResult(); - var error = r.getError(); - if (result != null && !error) { - d.callback(result); - } else { - d.errback(error); - } - r.dispose(); - }, deferred, reader)); - return deferred; -}; - -// FIXME should handle all geo-referenced data, not just vector data - -goog.provide('ol.interaction.DragAndDrop'); -goog.provide('ol.interaction.DragAndDropEvent'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.events.FileDropHandler'); -goog.require('goog.events.FileDropHandler.EventType'); -goog.require('goog.fs.FileReader'); -goog.require('goog.functions'); -goog.require('ol.interaction.Interaction'); -goog.require('ol.proj'); - - - -/** - * @classdesc - * Handles input of vector data by drag and drop. - * - * @constructor - * @extends {ol.interaction.Interaction} - * @fires ol.interaction.DragAndDropEvent - * @param {olx.interaction.DragAndDropOptions=} opt_options Options. - * @api stable - */ -ol.interaction.DragAndDrop = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this, { - handleEvent: ol.interaction.DragAndDrop.handleEvent - }); - - /** - * @private - * @type {Array.<function(new: ol.format.Feature)>} - */ - this.formatConstructors_ = options.formatConstructors ? - options.formatConstructors : []; - - /** - * @private - * @type {ol.proj.Projection} - */ - this.projection_ = options.projection ? - ol.proj.get(options.projection) : null; - - /** - * @private - * @type {goog.events.FileDropHandler} - */ - this.fileDropHandler_ = null; - - /** - * @private - * @type {goog.events.Key|undefined} - */ - this.dropListenKey_ = undefined; - -}; -goog.inherits(ol.interaction.DragAndDrop, ol.interaction.Interaction); - - -/** - * @inheritDoc - */ -ol.interaction.DragAndDrop.prototype.disposeInternal = function() { - if (this.dropListenKey_) { - goog.events.unlistenByKey(this.dropListenKey_); - } - goog.base(this, 'disposeInternal'); -}; - - -/** - * @param {goog.events.BrowserEvent} event Event. - * @private - */ -ol.interaction.DragAndDrop.prototype.handleDrop_ = function(event) { - var files = event.getBrowserEvent().dataTransfer.files; - var i, ii, file; - for (i = 0, ii = files.length; i < ii; ++i) { - file = files[i]; - // The empty string param is a workaround for - // https://code.google.com/p/closure-library/issues/detail?id=524 - var reader = goog.fs.FileReader.readAsText(file, ''); - reader.addCallback(goog.partial(this.handleResult_, file), this); - } -}; - - -/** - * @param {File} file File. - * @param {string} result Result. - * @private - */ -ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, result) { - var map = this.getMap(); - goog.asserts.assert(map, 'map must be set'); - var projection = this.projection_; - if (!projection) { - var view = map.getView(); - goog.asserts.assert(view, 'map must have view'); - projection = view.getProjection(); - goog.asserts.assert(projection !== undefined, - 'projection should be defined'); - } - var formatConstructors = this.formatConstructors_; - var features = []; - var i, ii; - for (i = 0, ii = formatConstructors.length; i < ii; ++i) { - var formatConstructor = formatConstructors[i]; - var format = new formatConstructor(); - var readFeatures = this.tryReadFeatures_(format, result); - if (readFeatures) { - var featureProjection = format.readProjection(result); - var transform = ol.proj.getTransform(featureProjection, projection); - var j, jj; - for (j = 0, jj = readFeatures.length; j < jj; ++j) { - var feature = readFeatures[j]; - var geometry = feature.getGeometry(); - if (geometry) { - geometry.applyTransform(transform); - } - features.push(feature); - } - } - } - this.dispatchEvent( - new ol.interaction.DragAndDropEvent( - ol.interaction.DragAndDropEventType.ADD_FEATURES, this, file, - features, projection)); -}; - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} unconditionally and - * neither prevents the browser default nor stops event propagation. - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.DragAndDrop} - * @api - */ -ol.interaction.DragAndDrop.handleEvent = goog.functions.TRUE; - - -/** - * @inheritDoc - */ -ol.interaction.DragAndDrop.prototype.setMap = function(map) { - if (this.dropListenKey_) { - goog.events.unlistenByKey(this.dropListenKey_); - this.dropListenKey_ = undefined; - } - if (this.fileDropHandler_) { - goog.dispose(this.fileDropHandler_); - this.fileDropHandler_ = null; - } - goog.asserts.assert(this.dropListenKey_ === undefined, - 'this.dropListenKey_ should be undefined'); - goog.base(this, 'setMap', map); - if (map) { - this.fileDropHandler_ = new goog.events.FileDropHandler(map.getViewport()); - this.dropListenKey_ = goog.events.listen( - this.fileDropHandler_, goog.events.FileDropHandler.EventType.DROP, - this.handleDrop_, false, this); - } -}; - - -/** - * @param {ol.format.Feature} format Format. - * @param {string} text Text. - * @private - * @return {Array.<ol.Feature>} Features. - */ -ol.interaction.DragAndDrop.prototype.tryReadFeatures_ = function(format, text) { - try { - return format.readFeatures(text); - } catch (e) { - return null; - } -}; - - -/** - * @enum {string} - */ -ol.interaction.DragAndDropEventType = { - /** - * Triggered when features are added - * @event ol.interaction.DragAndDropEvent#addfeatures - * @api stable - */ - ADD_FEATURES: 'addfeatures' -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.interaction.DragAndDrop} instances are instances - * of this type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.interaction.DragAndDropEvent} - * @param {ol.interaction.DragAndDropEventType} type Type. - * @param {Object} target Target. - * @param {File} file File. - * @param {Array.<ol.Feature>=} opt_features Features. - * @param {ol.proj.Projection=} opt_projection Projection. - */ -ol.interaction.DragAndDropEvent = - function(type, target, file, opt_features, opt_projection) { - - goog.base(this, type, target); - - /** - * The features parsed from dropped data. - * @type {Array.<ol.Feature>|undefined} - * @api stable - */ - this.features = opt_features; - - /** - * The dropped file. - * @type {File} - * @api stable - */ - this.file = file; - - /** - * The feature projection. - * @type {ol.proj.Projection|undefined} - * @api - */ - this.projection = opt_projection; - -}; -goog.inherits(ol.interaction.DragAndDropEvent, goog.events.Event); - -// Copyright 2007 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview Defines a 2-element vector class that can be used for - * coordinate math, useful for animation systems and point manipulation. - * - * Vec2 objects inherit from goog.math.Coordinate and may be used wherever a - * Coordinate is required. Where appropriate, Vec2 functions accept both Vec2 - * and Coordinate objects as input. - * - * @author brenneman@google.com (Shawn Brenneman) - */ - -goog.provide('goog.math.Vec2'); - -goog.require('goog.math'); -goog.require('goog.math.Coordinate'); - - - -/** - * Class for a two-dimensional vector object and assorted functions useful for - * manipulating points. - * - * @param {number} x The x coordinate for the vector. - * @param {number} y The y coordinate for the vector. - * @struct - * @constructor - * @extends {goog.math.Coordinate} - */ -goog.math.Vec2 = function(x, y) { - /** - * X-value - * @type {number} - */ - this.x = x; - - /** - * Y-value - * @type {number} - */ - this.y = y; -}; -goog.inherits(goog.math.Vec2, goog.math.Coordinate); - - -/** - * @return {!goog.math.Vec2} A random unit-length vector. - */ -goog.math.Vec2.randomUnit = function() { - var angle = Math.random() * Math.PI * 2; - return new goog.math.Vec2(Math.cos(angle), Math.sin(angle)); -}; - - -/** - * @return {!goog.math.Vec2} A random vector inside the unit-disc. - */ -goog.math.Vec2.random = function() { - var mag = Math.sqrt(Math.random()); - var angle = Math.random() * Math.PI * 2; - - return new goog.math.Vec2(Math.cos(angle) * mag, Math.sin(angle) * mag); -}; - - -/** - * Returns a new Vec2 object from a given coordinate. - * @param {!goog.math.Coordinate} a The coordinate. - * @return {!goog.math.Vec2} A new vector object. - */ -goog.math.Vec2.fromCoordinate = function(a) { - return new goog.math.Vec2(a.x, a.y); -}; - - -/** - * @return {!goog.math.Vec2} A new vector with the same coordinates as this one. - * @override - */ -goog.math.Vec2.prototype.clone = function() { - return new goog.math.Vec2(this.x, this.y); -}; - - -/** - * Returns the magnitude of the vector measured from the origin. - * @return {number} The length of the vector. - */ -goog.math.Vec2.prototype.magnitude = function() { - return Math.sqrt(this.x * this.x + this.y * this.y); -}; - - -/** - * Returns the squared magnitude of the vector measured from the origin. - * NOTE(brenneman): Leaving out the square root is not a significant - * optimization in JavaScript. - * @return {number} The length of the vector, squared. - */ -goog.math.Vec2.prototype.squaredMagnitude = function() { - return this.x * this.x + this.y * this.y; -}; - - -/** - * @return {!goog.math.Vec2} This coordinate after scaling. - * @override - */ -goog.math.Vec2.prototype.scale = - /** @type {function(number, number=):!goog.math.Vec2} */ - (goog.math.Coordinate.prototype.scale); - - -/** - * Reverses the sign of the vector. Equivalent to scaling the vector by -1. - * @return {!goog.math.Vec2} The inverted vector. - */ -goog.math.Vec2.prototype.invert = function() { - this.x = -this.x; - this.y = -this.y; - return this; -}; - - -/** - * Normalizes the current vector to have a magnitude of 1. - * @return {!goog.math.Vec2} The normalized vector. - */ -goog.math.Vec2.prototype.normalize = function() { - return this.scale(1 / this.magnitude()); -}; - - -/** - * Adds another vector to this vector in-place. - * @param {!goog.math.Coordinate} b The vector to add. - * @return {!goog.math.Vec2} This vector with {@code b} added. - */ -goog.math.Vec2.prototype.add = function(b) { - this.x += b.x; - this.y += b.y; - return this; -}; - - -/** - * Subtracts another vector from this vector in-place. - * @param {!goog.math.Coordinate} b The vector to subtract. - * @return {!goog.math.Vec2} This vector with {@code b} subtracted. - */ -goog.math.Vec2.prototype.subtract = function(b) { - this.x -= b.x; - this.y -= b.y; - return this; -}; - - -/** - * Rotates this vector in-place by a given angle, specified in radians. - * @param {number} angle The angle, in radians. - * @return {!goog.math.Vec2} This vector rotated {@code angle} radians. - */ -goog.math.Vec2.prototype.rotate = function(angle) { - var cos = Math.cos(angle); - var sin = Math.sin(angle); - var newX = this.x * cos - this.y * sin; - var newY = this.y * cos + this.x * sin; - this.x = newX; - this.y = newY; - return this; -}; - - -/** - * Rotates a vector by a given angle, specified in radians, relative to a given - * axis rotation point. The returned vector is a newly created instance - no - * in-place changes are done. - * @param {!goog.math.Vec2} v A vector. - * @param {!goog.math.Vec2} axisPoint The rotation axis point. - * @param {number} angle The angle, in radians. - * @return {!goog.math.Vec2} The rotated vector in a newly created instance. - */ -goog.math.Vec2.rotateAroundPoint = function(v, axisPoint, angle) { - var res = v.clone(); - return res.subtract(axisPoint).rotate(angle).add(axisPoint); -}; - - -/** - * Compares this vector with another for equality. - * @param {!goog.math.Vec2} b The other vector. - * @return {boolean} Whether this vector has the same x and y as the given - * vector. - */ -goog.math.Vec2.prototype.equals = function(b) { - return this == b || !!b && this.x == b.x && this.y == b.y; -}; - - -/** - * Returns the distance between two vectors. - * @param {!goog.math.Coordinate} a The first vector. - * @param {!goog.math.Coordinate} b The second vector. - * @return {number} The distance. - */ -goog.math.Vec2.distance = goog.math.Coordinate.distance; - - -/** - * Returns the squared distance between two vectors. - * @param {!goog.math.Coordinate} a The first vector. - * @param {!goog.math.Coordinate} b The second vector. - * @return {number} The squared distance. - */ -goog.math.Vec2.squaredDistance = goog.math.Coordinate.squaredDistance; - - -/** - * Compares vectors for equality. - * @param {!goog.math.Coordinate} a The first vector. - * @param {!goog.math.Coordinate} b The second vector. - * @return {boolean} Whether the vectors have the same x and y coordinates. - */ -goog.math.Vec2.equals = goog.math.Coordinate.equals; - - -/** - * Returns the sum of two vectors as a new Vec2. - * @param {!goog.math.Coordinate} a The first vector. - * @param {!goog.math.Coordinate} b The second vector. - * @return {!goog.math.Vec2} The sum vector. - */ -goog.math.Vec2.sum = function(a, b) { - return new goog.math.Vec2(a.x + b.x, a.y + b.y); -}; - - -/** - * Returns the difference between two vectors as a new Vec2. - * @param {!goog.math.Coordinate} a The first vector. - * @param {!goog.math.Coordinate} b The second vector. - * @return {!goog.math.Vec2} The difference vector. - */ -goog.math.Vec2.difference = function(a, b) { - return new goog.math.Vec2(a.x - b.x, a.y - b.y); -}; - - -/** - * Returns the dot-product of two vectors. - * @param {!goog.math.Coordinate} a The first vector. - * @param {!goog.math.Coordinate} b The second vector. - * @return {number} The dot-product of the two vectors. - */ -goog.math.Vec2.dot = function(a, b) { - return a.x * b.x + a.y * b.y; -}; - - -/** - * Returns the determinant of two vectors. - * @param {!goog.math.Vec2} a The first vector. - * @param {!goog.math.Vec2} b The second vector. - * @return {number} The determinant of the two vectors. - */ -goog.math.Vec2.determinant = function(a, b) { - return a.x * b.y - a.y * b.x; -}; - - -/** - * Returns a new Vec2 that is the linear interpolant between vectors a and b at - * scale-value x. - * @param {!goog.math.Coordinate} a Vector a. - * @param {!goog.math.Coordinate} b Vector b. - * @param {number} x The proportion between a and b. - * @return {!goog.math.Vec2} The interpolated vector. - */ -goog.math.Vec2.lerp = function(a, b, x) { - return new goog.math.Vec2(goog.math.lerp(a.x, b.x, x), - goog.math.lerp(a.y, b.y, x)); -}; - -goog.provide('ol.interaction.DragRotateAndZoom'); - -goog.require('goog.math.Vec2'); -goog.require('ol'); -goog.require('ol.ViewHint'); -goog.require('ol.events.ConditionType'); -goog.require('ol.events.condition'); -goog.require('ol.interaction.Interaction'); -goog.require('ol.interaction.Pointer'); - - - -/** - * @classdesc - * Allows the user to zoom and rotate the map by clicking and dragging - * on the map. By default, this interaction is limited to when the shift - * key is held down. - * - * This interaction is only supported for mouse devices. - * - * And this interaction is not included in the default interactions. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @param {olx.interaction.DragRotateAndZoomOptions=} opt_options Options. - * @api stable - */ -ol.interaction.DragRotateAndZoom = function(opt_options) { - - var options = opt_options ? opt_options : {}; - - goog.base(this, { - handleDownEvent: ol.interaction.DragRotateAndZoom.handleDownEvent_, - handleDragEvent: ol.interaction.DragRotateAndZoom.handleDragEvent_, - handleUpEvent: ol.interaction.DragRotateAndZoom.handleUpEvent_ - }); - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.condition_ = options.condition ? - options.condition : ol.events.condition.shiftKeyOnly; - - /** - * @private - * @type {number|undefined} - */ - this.lastAngle_ = undefined; - - /** - * @private - * @type {number|undefined} - */ - this.lastMagnitude_ = undefined; - - /** - * @private - * @type {number} - */ - this.lastScaleDelta_ = 0; - - /** - * @private - * @type {number} - */ - this.duration_ = options.duration ? options.duration : 400; - -}; -goog.inherits(ol.interaction.DragRotateAndZoom, ol.interaction.Pointer); - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.DragRotateAndZoom} - * @private - */ -ol.interaction.DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return; - } - - var map = mapBrowserEvent.map; - var size = map.getSize(); - var offset = mapBrowserEvent.pixel; - var delta = new goog.math.Vec2( - offset[0] - size[0] / 2, - size[1] / 2 - offset[1]); - var theta = Math.atan2(delta.y, delta.x); - var magnitude = delta.magnitude(); - var view = map.getView(); - map.render(); - if (this.lastAngle_ !== undefined) { - var angleDelta = theta - this.lastAngle_; - ol.interaction.Interaction.rotateWithoutConstraints( - map, view, view.getRotation() - angleDelta); - } - this.lastAngle_ = theta; - if (this.lastMagnitude_ !== undefined) { - var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude); - ol.interaction.Interaction.zoomWithoutConstraints(map, view, resolution); - } - if (this.lastMagnitude_ !== undefined) { - this.lastScaleDelta_ = this.lastMagnitude_ / magnitude; - } - this.lastMagnitude_ = magnitude; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.DragRotateAndZoom} - * @private - */ -ol.interaction.DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return true; - } - - var map = mapBrowserEvent.map; - var view = map.getView(); - view.setHint(ol.ViewHint.INTERACTING, -1); - var direction = this.lastScaleDelta_ - 1; - ol.interaction.Interaction.rotate(map, view, view.getRotation()); - ol.interaction.Interaction.zoom(map, view, view.getResolution(), - undefined, this.duration_, direction); - this.lastScaleDelta_ = 0; - return false; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.DragRotateAndZoom} - * @private - */ -ol.interaction.DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) { - if (!ol.events.condition.mouseOnly(mapBrowserEvent)) { - return false; - } - - if (this.condition_(mapBrowserEvent)) { - mapBrowserEvent.map.getView().setHint(ol.ViewHint.INTERACTING, 1); - this.lastAngle_ = undefined; - this.lastMagnitude_ = undefined; - return true; - } else { - return false; - } -}; - -goog.provide('ol.interaction.Draw'); -goog.provide('ol.interaction.DrawEvent'); -goog.provide('ol.interaction.DrawEventType'); -goog.provide('ol.interaction.DrawGeometryFunctionType'); -goog.provide('ol.interaction.DrawMode'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('ol.Collection'); -goog.require('ol.Coordinate'); -goog.require('ol.Feature'); -goog.require('ol.MapBrowserEvent'); -goog.require('ol.MapBrowserEvent.EventType'); -goog.require('ol.Object'); -goog.require('ol.coordinate'); -goog.require('ol.events.condition'); -goog.require('ol.geom.Circle'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.interaction.InteractionProperty'); -goog.require('ol.interaction.Pointer'); -goog.require('ol.layer.Vector'); -goog.require('ol.source.Vector'); - - -/** - * @enum {string} - */ -ol.interaction.DrawEventType = { - /** - * Triggered upon feature draw start - * @event ol.interaction.DrawEvent#drawstart - * @api stable - */ - DRAWSTART: 'drawstart', - /** - * Triggered upon feature draw end - * @event ol.interaction.DrawEvent#drawend - * @api stable - */ - DRAWEND: 'drawend' -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.interaction.Draw} instances are instances of - * this type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.DrawEvent} - * @param {ol.interaction.DrawEventType} type Type. - * @param {ol.Feature} feature The feature drawn. - */ -ol.interaction.DrawEvent = function(type, feature) { - - goog.base(this, type); - - /** - * The feature being drawn. - * @type {ol.Feature} - * @api stable - */ - this.feature = feature; - -}; -goog.inherits(ol.interaction.DrawEvent, goog.events.Event); - - - -/** - * @classdesc - * Interaction for drawing feature geometries. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @fires ol.interaction.DrawEvent - * @param {olx.interaction.DrawOptions} options Options. - * @api stable - */ -ol.interaction.Draw = function(options) { - - goog.base(this, { - handleDownEvent: ol.interaction.Draw.handleDownEvent_, - handleEvent: ol.interaction.Draw.handleEvent, - handleUpEvent: ol.interaction.Draw.handleUpEvent_ - }); - - /** - * @type {ol.Pixel} - * @private - */ - this.downPx_ = null; - - /** - * @type {boolean} - * @private - */ - this.freehand_ = false; - - /** - * Target source for drawn features. - * @type {ol.source.Vector} - * @private - */ - this.source_ = options.source ? options.source : null; - - /** - * Target collection for drawn features. - * @type {ol.Collection.<ol.Feature>} - * @private - */ - this.features_ = options.features ? options.features : null; - - /** - * Pixel distance for snapping. - * @type {number} - * @private - */ - this.snapTolerance_ = options.snapTolerance ? options.snapTolerance : 12; - - /** - * Geometry type. - * @type {ol.geom.GeometryType} - * @private - */ - this.type_ = options.type; - - /** - * Drawing mode (derived from geometry type. - * @type {ol.interaction.DrawMode} - * @private - */ - this.mode_ = ol.interaction.Draw.getMode_(this.type_); - - /** - * The number of points that must be drawn before a polygon ring or line - * string can be finished. The default is 3 for polygon rings and 2 for - * line strings. - * @type {number} - * @private - */ - this.minPoints_ = options.minPoints ? - options.minPoints : - (this.mode_ === ol.interaction.DrawMode.POLYGON ? 3 : 2); - - /** - * The number of points that can be drawn before a polygon ring or line string - * is finished. The default is no restriction. - * @type {number} - * @private - */ - this.maxPoints_ = options.maxPoints ? options.maxPoints : Infinity; - - var geometryFunction = options.geometryFunction; - if (!geometryFunction) { - if (this.type_ === ol.geom.GeometryType.CIRCLE) { - /** - * @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates - * @param {ol.geom.SimpleGeometry=} opt_geometry - * @return {ol.geom.SimpleGeometry} - */ - geometryFunction = function(coordinates, opt_geometry) { - var circle = opt_geometry ? opt_geometry : - new ol.geom.Circle([NaN, NaN]); - goog.asserts.assertInstanceof(circle, ol.geom.Circle, - 'geometry must be an ol.geom.Circle'); - var squaredLength = ol.coordinate.squaredDistance( - coordinates[0], coordinates[1]); - circle.setCenterAndRadius(coordinates[0], Math.sqrt(squaredLength)); - return circle; - }; - } else { - var Constructor; - var mode = this.mode_; - if (mode === ol.interaction.DrawMode.POINT) { - Constructor = ol.geom.Point; - } else if (mode === ol.interaction.DrawMode.LINE_STRING) { - Constructor = ol.geom.LineString; - } else if (mode === ol.interaction.DrawMode.POLYGON) { - Constructor = ol.geom.Polygon; - } - /** - * @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates - * @param {ol.geom.SimpleGeometry=} opt_geometry - * @return {ol.geom.SimpleGeometry} - */ - geometryFunction = function(coordinates, opt_geometry) { - var geometry = opt_geometry; - if (geometry) { - geometry.setCoordinates(coordinates); - } else { - geometry = new Constructor(coordinates); - } - return geometry; - }; - } - } - - /** - * @type {ol.interaction.DrawGeometryFunctionType} - * @private - */ - this.geometryFunction_ = geometryFunction; - - /** - * Finish coordinate for the feature (first point for polygons, last point for - * linestrings). - * @type {ol.Coordinate} - * @private - */ - this.finishCoordinate_ = null; - - /** - * Sketch feature. - * @type {ol.Feature} - * @private - */ - this.sketchFeature_ = null; - - /** - * Sketch point. - * @type {ol.Feature} - * @private - */ - this.sketchPoint_ = null; - - /** - * Sketch coordinates. Used when drawing a line or polygon. - * @type {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} - * @private - */ - this.sketchCoords_ = null; - - /** - * Sketch line. Used when drawing polygon. - * @type {ol.Feature} - * @private - */ - this.sketchLine_ = null; - - /** - * Sketch line coordinates. Used when drawing a polygon or circle. - * @type {Array.<ol.Coordinate>} - * @private - */ - this.sketchLineCoords_ = null; - - /** - * Squared tolerance for handling up events. If the squared distance - * between a down and up event is greater than this tolerance, up events - * will not be handled. - * @type {number} - * @private - */ - this.squaredClickTolerance_ = options.clickTolerance ? - options.clickTolerance * options.clickTolerance : 36; - - /** - * Draw overlay where our sketch features are drawn. - * @type {ol.layer.Vector} - * @private - */ - this.overlay_ = new ol.layer.Vector({ - source: new ol.source.Vector({ - useSpatialIndex: false, - wrapX: options.wrapX ? options.wrapX : false - }), - style: options.style ? options.style : - ol.interaction.Draw.getDefaultStyleFunction() - }); - - /** - * Name of the geometry attribute for newly created features. - * @type {string|undefined} - * @private - */ - this.geometryName_ = options.geometryName; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.condition_ = options.condition ? - options.condition : ol.events.condition.noModifierKeys; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.freehandCondition_ = options.freehandCondition ? - options.freehandCondition : ol.events.condition.shiftKeyOnly; - - goog.events.listen(this, - ol.Object.getChangeEventType(ol.interaction.InteractionProperty.ACTIVE), - this.updateState_, false, this); - -}; -goog.inherits(ol.interaction.Draw, ol.interaction.Pointer); - - -/** - * @return {ol.style.StyleFunction} Styles. - */ -ol.interaction.Draw.getDefaultStyleFunction = function() { - var styles = ol.style.createDefaultEditingStyles(); - return function(feature, resolution) { - return styles[feature.getGeometry().getType()]; - }; -}; - - -/** - * @inheritDoc - */ -ol.interaction.Draw.prototype.setMap = function(map) { - goog.base(this, 'setMap', map); - this.updateState_(); -}; - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} and may actually - * draw or finish the drawing. - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.Draw} - * @api - */ -ol.interaction.Draw.handleEvent = function(mapBrowserEvent) { - var pass = !this.freehand_; - if (this.freehand_ && - mapBrowserEvent.type === ol.MapBrowserEvent.EventType.POINTERDRAG) { - this.addToDrawing_(mapBrowserEvent); - pass = false; - } else if (mapBrowserEvent.type === - ol.MapBrowserEvent.EventType.POINTERMOVE) { - pass = this.handlePointerMove_(mapBrowserEvent); - } else if (mapBrowserEvent.type === ol.MapBrowserEvent.EventType.DBLCLICK) { - pass = false; - } - return ol.interaction.Pointer.handleEvent.call(this, mapBrowserEvent) && pass; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} event Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.Draw} - * @private - */ -ol.interaction.Draw.handleDownEvent_ = function(event) { - if (this.condition_(event)) { - this.downPx_ = event.pixel; - return true; - } else if ((this.mode_ === ol.interaction.DrawMode.LINE_STRING || - this.mode_ === ol.interaction.DrawMode.POLYGON) && - this.freehandCondition_(event)) { - this.downPx_ = event.pixel; - this.freehand_ = true; - if (!this.finishCoordinate_) { - this.startDrawing_(event); - } - return true; - } else { - return false; - } -}; - - -/** - * @param {ol.MapBrowserPointerEvent} event Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.Draw} - * @private - */ -ol.interaction.Draw.handleUpEvent_ = function(event) { - this.freehand_ = false; - var downPx = this.downPx_; - var clickPx = event.pixel; - var dx = downPx[0] - clickPx[0]; - var dy = downPx[1] - clickPx[1]; - var squaredDistance = dx * dx + dy * dy; - var pass = true; - if (squaredDistance <= this.squaredClickTolerance_) { - this.handlePointerMove_(event); - if (!this.finishCoordinate_) { - this.startDrawing_(event); - if (this.mode_ === ol.interaction.DrawMode.POINT) { - this.finishDrawing(); - } - } else if (this.mode_ === ol.interaction.DrawMode.CIRCLE) { - this.finishDrawing(); - } else if (this.atFinish_(event)) { - this.finishDrawing(); - } else { - this.addToDrawing_(event); - } - pass = false; - } - return pass; -}; - - -/** - * Handle move events. - * @param {ol.MapBrowserEvent} event A move event. - * @return {boolean} Pass the event to other interactions. - * @private - */ -ol.interaction.Draw.prototype.handlePointerMove_ = function(event) { - if (this.finishCoordinate_) { - this.modifyDrawing_(event); - } else { - this.createOrUpdateSketchPoint_(event); - } - return true; -}; - - -/** - * Determine if an event is within the snapping tolerance of the start coord. - * @param {ol.MapBrowserEvent} event Event. - * @return {boolean} The event is within the snapping tolerance of the start. - * @private - */ -ol.interaction.Draw.prototype.atFinish_ = function(event) { - var at = false; - if (this.sketchFeature_) { - var potentiallyDone = false; - var potentiallyFinishCoordinates = [this.finishCoordinate_]; - if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) { - potentiallyDone = this.sketchCoords_.length > this.minPoints_; - } else if (this.mode_ === ol.interaction.DrawMode.POLYGON) { - potentiallyDone = this.sketchCoords_[0].length > - this.minPoints_; - potentiallyFinishCoordinates = [this.sketchCoords_[0][0], - this.sketchCoords_[0][this.sketchCoords_[0].length - 2]]; - } - if (potentiallyDone) { - var map = event.map; - for (var i = 0, ii = potentiallyFinishCoordinates.length; i < ii; i++) { - var finishCoordinate = potentiallyFinishCoordinates[i]; - var finishPixel = map.getPixelFromCoordinate(finishCoordinate); - var pixel = event.pixel; - var dx = pixel[0] - finishPixel[0]; - var dy = pixel[1] - finishPixel[1]; - var freehand = this.freehand_ && this.freehandCondition_(event); - var snapTolerance = freehand ? 1 : this.snapTolerance_; - at = Math.sqrt(dx * dx + dy * dy) <= snapTolerance; - if (at) { - this.finishCoordinate_ = finishCoordinate; - break; - } - } - } - } - return at; -}; - - -/** - * @param {ol.MapBrowserEvent} event Event. - * @private - */ -ol.interaction.Draw.prototype.createOrUpdateSketchPoint_ = function(event) { - var coordinates = event.coordinate.slice(); - if (!this.sketchPoint_) { - this.sketchPoint_ = new ol.Feature(new ol.geom.Point(coordinates)); - this.updateSketchFeatures_(); - } else { - var sketchPointGeom = this.sketchPoint_.getGeometry(); - goog.asserts.assertInstanceof(sketchPointGeom, ol.geom.Point, - 'sketchPointGeom should be an ol.geom.Point'); - sketchPointGeom.setCoordinates(coordinates); - } -}; - - -/** - * Start the drawing. - * @param {ol.MapBrowserEvent} event Event. - * @private - */ -ol.interaction.Draw.prototype.startDrawing_ = function(event) { - var start = event.coordinate; - this.finishCoordinate_ = start; - if (this.mode_ === ol.interaction.DrawMode.POINT) { - this.sketchCoords_ = start.slice(); - } else if (this.mode_ === ol.interaction.DrawMode.POLYGON) { - this.sketchCoords_ = [[start.slice(), start.slice()]]; - this.sketchLineCoords_ = this.sketchCoords_[0]; - } else { - this.sketchCoords_ = [start.slice(), start.slice()]; - if (this.mode_ === ol.interaction.DrawMode.CIRCLE) { - this.sketchLineCoords_ = this.sketchCoords_; - } - } - if (this.sketchLineCoords_) { - this.sketchLine_ = new ol.Feature( - new ol.geom.LineString(this.sketchLineCoords_)); - } - var geometry = this.geometryFunction_(this.sketchCoords_); - goog.asserts.assert(geometry !== undefined, 'geometry should be defined'); - this.sketchFeature_ = new ol.Feature(); - if (this.geometryName_) { - this.sketchFeature_.setGeometryName(this.geometryName_); - } - this.sketchFeature_.setGeometry(geometry); - this.updateSketchFeatures_(); - this.dispatchEvent(new ol.interaction.DrawEvent( - ol.interaction.DrawEventType.DRAWSTART, this.sketchFeature_)); -}; - - -/** - * Modify the drawing. - * @param {ol.MapBrowserEvent} event Event. - * @private - */ -ol.interaction.Draw.prototype.modifyDrawing_ = function(event) { - var coordinate = event.coordinate; - var geometry = this.sketchFeature_.getGeometry(); - goog.asserts.assertInstanceof(geometry, ol.geom.SimpleGeometry, - 'geometry should be ol.geom.SimpleGeometry or subclass'); - var coordinates, last; - if (this.mode_ === ol.interaction.DrawMode.POINT) { - last = this.sketchCoords_; - } else if (this.mode_ === ol.interaction.DrawMode.POLYGON) { - coordinates = this.sketchCoords_[0]; - last = coordinates[coordinates.length - 1]; - if (this.atFinish_(event)) { - // snap to finish - coordinate = this.finishCoordinate_.slice(); - } - } else { - coordinates = this.sketchCoords_; - last = coordinates[coordinates.length - 1]; - } - last[0] = coordinate[0]; - last[1] = coordinate[1]; - goog.asserts.assert(this.sketchCoords_, 'sketchCoords_ expected'); - this.geometryFunction_(this.sketchCoords_, geometry); - if (this.sketchPoint_) { - var sketchPointGeom = this.sketchPoint_.getGeometry(); - goog.asserts.assertInstanceof(sketchPointGeom, ol.geom.Point, - 'sketchPointGeom should be an ol.geom.Point'); - sketchPointGeom.setCoordinates(coordinate); - } - var sketchLineGeom; - if (geometry instanceof ol.geom.Polygon && - this.mode_ !== ol.interaction.DrawMode.POLYGON) { - if (!this.sketchLine_) { - this.sketchLine_ = new ol.Feature(new ol.geom.LineString(null)); - } - var ring = geometry.getLinearRing(0); - sketchLineGeom = this.sketchLine_.getGeometry(); - goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString, - 'sketchLineGeom must be an ol.geom.LineString'); - sketchLineGeom.setFlatCoordinates( - ring.getLayout(), ring.getFlatCoordinates()); - } else if (this.sketchLineCoords_) { - sketchLineGeom = this.sketchLine_.getGeometry(); - goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString, - 'sketchLineGeom must be an ol.geom.LineString'); - sketchLineGeom.setCoordinates(this.sketchLineCoords_); - } - this.updateSketchFeatures_(); -}; - - -/** - * Add a new coordinate to the drawing. - * @param {ol.MapBrowserEvent} event Event. - * @private - */ -ol.interaction.Draw.prototype.addToDrawing_ = function(event) { - var coordinate = event.coordinate; - var geometry = this.sketchFeature_.getGeometry(); - goog.asserts.assertInstanceof(geometry, ol.geom.SimpleGeometry, - 'geometry must be an ol.geom.SimpleGeometry'); - var done; - var coordinates; - if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) { - this.finishCoordinate_ = coordinate.slice(); - coordinates = this.sketchCoords_; - coordinates.push(coordinate.slice()); - done = coordinates.length > this.maxPoints_; - this.geometryFunction_(coordinates, geometry); - } else if (this.mode_ === ol.interaction.DrawMode.POLYGON) { - coordinates = this.sketchCoords_[0]; - coordinates.push(coordinate.slice()); - done = coordinates.length > this.maxPoints_; - if (done) { - this.finishCoordinate_ = coordinates[0]; - } - this.geometryFunction_(this.sketchCoords_, geometry); - } - this.updateSketchFeatures_(); - if (done) { - this.finishDrawing(); - } -}; - - -/** - * Remove last point of the feature currently being drawn. - * @api - */ -ol.interaction.Draw.prototype.removeLastPoint = function() { - var geometry = this.sketchFeature_.getGeometry(); - goog.asserts.assertInstanceof(geometry, ol.geom.SimpleGeometry, - 'geometry must be an ol.geom.SimpleGeometry'); - var coordinates, sketchLineGeom; - if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) { - coordinates = this.sketchCoords_; - coordinates.splice(-2, 1); - this.geometryFunction_(coordinates, geometry); - } else if (this.mode_ === ol.interaction.DrawMode.POLYGON) { - coordinates = this.sketchCoords_[0]; - coordinates.splice(-2, 1); - sketchLineGeom = this.sketchLine_.getGeometry(); - goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString, - 'sketchLineGeom must be an ol.geom.LineString'); - sketchLineGeom.setCoordinates(coordinates); - this.geometryFunction_(this.sketchCoords_, geometry); - } - - if (coordinates.length === 0) { - this.finishCoordinate_ = null; - } - - this.updateSketchFeatures_(); -}; - - -/** - * Stop drawing and add the sketch feature to the target layer. - * The {@link ol.interaction.DrawEventType.DRAWEND} event is dispatched before - * inserting the feature. - * @api - */ -ol.interaction.Draw.prototype.finishDrawing = function() { - var sketchFeature = this.abortDrawing_(); - goog.asserts.assert(sketchFeature, 'sketchFeature expected to be truthy'); - var coordinates = this.sketchCoords_; - var geometry = sketchFeature.getGeometry(); - goog.asserts.assertInstanceof(geometry, ol.geom.SimpleGeometry, - 'geometry must be an ol.geom.SimpleGeometry'); - if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) { - // remove the redundant last point - coordinates.pop(); - this.geometryFunction_(coordinates, geometry); - } else if (this.mode_ === ol.interaction.DrawMode.POLYGON) { - // When we finish drawing a polygon on the last point, - // the last coordinate is duplicated as for LineString - // we force the replacement by the first point - coordinates[0].pop(); - coordinates[0].push(coordinates[0][0]); - this.geometryFunction_(coordinates, geometry); - } - - // cast multi-part geometries - if (this.type_ === ol.geom.GeometryType.MULTI_POINT) { - sketchFeature.setGeometry(new ol.geom.MultiPoint([coordinates])); - } else if (this.type_ === ol.geom.GeometryType.MULTI_LINE_STRING) { - sketchFeature.setGeometry(new ol.geom.MultiLineString([coordinates])); - } else if (this.type_ === ol.geom.GeometryType.MULTI_POLYGON) { - sketchFeature.setGeometry(new ol.geom.MultiPolygon([coordinates])); - } - - // First dispatch event to allow full set up of feature - this.dispatchEvent(new ol.interaction.DrawEvent( - ol.interaction.DrawEventType.DRAWEND, sketchFeature)); - - // Then insert feature - if (this.features_) { - this.features_.push(sketchFeature); - } - if (this.source_) { - this.source_.addFeature(sketchFeature); - } -}; - - -/** - * Stop drawing without adding the sketch feature to the target layer. - * @return {ol.Feature} The sketch feature (or null if none). - * @private - */ -ol.interaction.Draw.prototype.abortDrawing_ = function() { - this.finishCoordinate_ = null; - var sketchFeature = this.sketchFeature_; - if (sketchFeature) { - this.sketchFeature_ = null; - this.sketchPoint_ = null; - this.sketchLine_ = null; - this.overlay_.getSource().clear(true); - } - return sketchFeature; -}; - - -/** - * Extend an existing geometry by adding additional points. This only works - * on features with `LineString` geometries, where the interaction will - * extend lines by adding points to the end of the coordinates array. - * @param {!ol.Feature} feature Feature to be extended. - * @api - */ -ol.interaction.Draw.prototype.extend = function(feature) { - var geometry = feature.getGeometry(); - goog.asserts.assert(this.mode_ == ol.interaction.DrawMode.LINE_STRING, - 'interaction mode must be "line"'); - goog.asserts.assert(geometry, 'feature must have a geometry'); - goog.asserts.assert(geometry.getType() == ol.geom.GeometryType.LINE_STRING, - 'feature geometry must be a line string'); - var lineString = /** @type {ol.geom.LineString} */ (geometry); - this.sketchFeature_ = feature; - this.sketchCoords_ = lineString.getCoordinates(); - var last = this.sketchCoords_[this.sketchCoords_.length - 1]; - this.finishCoordinate_ = last.slice(); - this.sketchCoords_.push(last.slice()); - this.updateSketchFeatures_(); - this.dispatchEvent(new ol.interaction.DrawEvent( - ol.interaction.DrawEventType.DRAWSTART, this.sketchFeature_)); -}; - - -/** - * @inheritDoc - */ -ol.interaction.Draw.prototype.shouldStopEvent = goog.functions.FALSE; - - -/** - * Redraw the sketch features. - * @private - */ -ol.interaction.Draw.prototype.updateSketchFeatures_ = function() { - var sketchFeatures = []; - if (this.sketchFeature_) { - sketchFeatures.push(this.sketchFeature_); - } - if (this.sketchLine_) { - sketchFeatures.push(this.sketchLine_); - } - if (this.sketchPoint_) { - sketchFeatures.push(this.sketchPoint_); - } - var overlaySource = this.overlay_.getSource(); - overlaySource.clear(true); - overlaySource.addFeatures(sketchFeatures); -}; - - -/** - * @private - */ -ol.interaction.Draw.prototype.updateState_ = function() { - var map = this.getMap(); - var active = this.getActive(); - if (!map || !active) { - this.abortDrawing_(); - } - this.overlay_.setMap(active ? map : null); -}; - - -/** - * Create a `geometryFunction` for `mode: 'Circle'` that will create a regular - * polygon with a user specified number of sides and start angle instead of an - * `ol.geom.Circle` geometry. - * @param {number=} opt_sides Number of sides of the regular polygon. Default is - * 32. - * @param {number=} opt_angle Angle of the first point in radians. 0 means East. - * Default is the angle defined by the heading from the center of the - * regular polygon to the current pointer position. - * @return {ol.interaction.DrawGeometryFunctionType} Function that draws a - * polygon. - * @api - */ -ol.interaction.Draw.createRegularPolygon = function(opt_sides, opt_angle) { - return ( - /** - * @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates - * @param {ol.geom.SimpleGeometry=} opt_geometry - * @return {ol.geom.SimpleGeometry} - */ - function(coordinates, opt_geometry) { - var center = coordinates[0]; - var end = coordinates[1]; - var radius = Math.sqrt( - ol.coordinate.squaredDistance(center, end)); - var geometry = opt_geometry ? opt_geometry : - ol.geom.Polygon.fromCircle(new ol.geom.Circle(center), opt_sides); - goog.asserts.assertInstanceof(geometry, ol.geom.Polygon, - 'geometry must be a polygon'); - var angle = opt_angle ? opt_angle : - Math.atan((end[1] - center[1]) / (end[0] - center[0])); - ol.geom.Polygon.makeRegular(geometry, center, radius, angle); - return geometry; - } - ); -}; - - -/** - * Get the drawing mode. The mode for mult-part geometries is the same as for - * their single-part cousins. - * @param {ol.geom.GeometryType} type Geometry type. - * @return {ol.interaction.DrawMode} Drawing mode. - * @private - */ -ol.interaction.Draw.getMode_ = function(type) { - var mode; - if (type === ol.geom.GeometryType.POINT || - type === ol.geom.GeometryType.MULTI_POINT) { - mode = ol.interaction.DrawMode.POINT; - } else if (type === ol.geom.GeometryType.LINE_STRING || - type === ol.geom.GeometryType.MULTI_LINE_STRING) { - mode = ol.interaction.DrawMode.LINE_STRING; - } else if (type === ol.geom.GeometryType.POLYGON || - type === ol.geom.GeometryType.MULTI_POLYGON) { - mode = ol.interaction.DrawMode.POLYGON; - } else if (type === ol.geom.GeometryType.CIRCLE) { - mode = ol.interaction.DrawMode.CIRCLE; - } - goog.asserts.assert(mode !== undefined, 'mode should be defined'); - return mode; -}; - - -/** - * Function that takes coordinates and an optional existing geometry as - * arguments, and returns a geometry. The optional existing geometry is the - * geometry that is returned when the function is called without a second - * argument. - * @typedef {function(!(ol.Coordinate|Array.<ol.Coordinate>| - * Array.<Array.<ol.Coordinate>>), ol.geom.SimpleGeometry=): - * ol.geom.SimpleGeometry} - * @api - */ -ol.interaction.DrawGeometryFunctionType; - - -/** - * Draw mode. This collapses multi-part geometry types with their single-part - * cousins. - * @enum {string} - */ -ol.interaction.DrawMode = { - POINT: 'Point', - LINE_STRING: 'LineString', - POLYGON: 'Polygon', - CIRCLE: 'Circle' -}; - -goog.provide('ol.interaction.Modify'); -goog.provide('ol.interaction.ModifyEvent'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.events.EventType'); -goog.require('goog.functions'); -goog.require('ol'); -goog.require('ol.Collection'); -goog.require('ol.CollectionEventType'); -goog.require('ol.Feature'); -goog.require('ol.MapBrowserEvent.EventType'); -goog.require('ol.MapBrowserPointerEvent'); -goog.require('ol.ViewHint'); -goog.require('ol.coordinate'); -goog.require('ol.events.condition'); -goog.require('ol.extent'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.interaction.Pointer'); -goog.require('ol.layer.Vector'); -goog.require('ol.source.Vector'); -goog.require('ol.structs.RBush'); - - -/** - * @enum {string} - */ -ol.ModifyEventType = { - /** - * Triggered upon feature modification start - * @event ol.interaction.ModifyEvent#modifystart - * @api - */ - MODIFYSTART: 'modifystart', - /** - * Triggered upon feature modification end - * @event ol.interaction.ModifyEvent#modifyend - * @api - */ - MODIFYEND: 'modifyend' -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.interaction.Modify} instances are instances of - * this type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.ModifyEvent} - * @param {ol.ModifyEventType} type Type. - * @param {ol.Collection.<ol.Feature>} features The features modified. - * @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Associated - * {@link ol.MapBrowserPointerEvent}. - */ -ol.interaction.ModifyEvent = function(type, features, mapBrowserPointerEvent) { - - goog.base(this, type); - - /** - * The features being modified. - * @type {ol.Collection.<ol.Feature>} - * @api - */ - this.features = features; - - /** - * Associated {@link ol.MapBrowserPointerEvent}. - * @type {ol.MapBrowserPointerEvent} - * @api - */ - this.mapBrowserPointerEvent = mapBrowserPointerEvent; -}; -goog.inherits(ol.interaction.ModifyEvent, goog.events.Event); - - -/** - * @typedef {{depth: (Array.<number>|undefined), - * feature: ol.Feature, - * geometry: ol.geom.SimpleGeometry, - * index: (number|undefined), - * segment: Array.<ol.Extent>}} - */ -ol.interaction.SegmentDataType; - - - -/** - * @classdesc - * Interaction for modifying feature geometries. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @param {olx.interaction.ModifyOptions} options Options. - * @fires ol.interaction.ModifyEvent - * @api - */ -ol.interaction.Modify = function(options) { - - goog.base(this, { - handleDownEvent: ol.interaction.Modify.handleDownEvent_, - handleDragEvent: ol.interaction.Modify.handleDragEvent_, - handleEvent: ol.interaction.Modify.handleEvent, - handleUpEvent: ol.interaction.Modify.handleUpEvent_ - }); - - /** - * @type {ol.events.ConditionType} - * @private - */ - this.deleteCondition_ = options.deleteCondition ? - options.deleteCondition : - /** @type {ol.events.ConditionType} */ (goog.functions.and( - ol.events.condition.noModifierKeys, - ol.events.condition.singleClick)); - - /** - * Editing vertex. - * @type {ol.Feature} - * @private - */ - this.vertexFeature_ = null; - - /** - * Segments intersecting {@link this.vertexFeature_} by segment uid. - * @type {Object.<string, boolean>} - * @private - */ - this.vertexSegments_ = null; - - /** - * @type {ol.Pixel} - * @private - */ - this.lastPixel_ = [0, 0]; - - /** - * Tracks if the next `singleclick` event should be ignored to prevent - * accidental deletion right after vertex creation. - * @type {boolean} - * @private - */ - this.ignoreNextSingleClick_ = false; - - /** - * @type {boolean} - * @private - */ - this.modified_ = false; - - /** - * Segment RTree for each layer - * @type {ol.structs.RBush.<ol.interaction.SegmentDataType>} - * @private - */ - this.rBush_ = new ol.structs.RBush(); - - /** - * @type {number} - * @private - */ - this.pixelTolerance_ = options.pixelTolerance !== undefined ? - options.pixelTolerance : 10; - - /** - * @type {boolean} - * @private - */ - this.snappedToVertex_ = false; - - /** - * Indicate whether the interaction is currently changing a feature's - * coordinates. - * @type {boolean} - * @private - */ - this.changingFeature_ = false; - - /** - * @type {Array} - * @private - */ - this.dragSegments_ = null; - - /** - * Draw overlay where sketch features are drawn. - * @type {ol.layer.Vector} - * @private - */ - this.overlay_ = new ol.layer.Vector({ - source: new ol.source.Vector({ - useSpatialIndex: false, - wrapX: !!options.wrapX - }), - style: options.style ? options.style : - ol.interaction.Modify.getDefaultStyleFunction(), - updateWhileAnimating: true, - updateWhileInteracting: true - }); - - /** - * @const - * @private - * @type {Object.<string, function(ol.Feature, ol.geom.Geometry)> } - */ - this.SEGMENT_WRITERS_ = { - 'Point': this.writePointGeometry_, - 'LineString': this.writeLineStringGeometry_, - 'LinearRing': this.writeLineStringGeometry_, - 'Polygon': this.writePolygonGeometry_, - 'MultiPoint': this.writeMultiPointGeometry_, - 'MultiLineString': this.writeMultiLineStringGeometry_, - 'MultiPolygon': this.writeMultiPolygonGeometry_, - 'GeometryCollection': this.writeGeometryCollectionGeometry_ - }; - - /** - * @type {ol.Collection.<ol.Feature>} - * @private - */ - this.features_ = options.features; - - this.features_.forEach(this.addFeature_, this); - goog.events.listen(this.features_, ol.CollectionEventType.ADD, - this.handleFeatureAdd_, false, this); - goog.events.listen(this.features_, ol.CollectionEventType.REMOVE, - this.handleFeatureRemove_, false, this); - -}; -goog.inherits(ol.interaction.Modify, ol.interaction.Pointer); - - -/** - * @param {ol.Feature} feature Feature. - * @private - */ -ol.interaction.Modify.prototype.addFeature_ = function(feature) { - var geometry = feature.getGeometry(); - if (geometry.getType() in this.SEGMENT_WRITERS_) { - this.SEGMENT_WRITERS_[geometry.getType()].call(this, feature, geometry); - } - var map = this.getMap(); - if (map) { - this.handlePointerAtPixel_(this.lastPixel_, map); - } - goog.events.listen(feature, goog.events.EventType.CHANGE, - this.handleFeatureChange_, false, this); -}; - - -/** - * @param {ol.MapBrowserPointerEvent} evt Map browser event - * @private - */ -ol.interaction.Modify.prototype.willModifyFeatures_ = function(evt) { - if (!this.modified_) { - this.modified_ = true; - this.dispatchEvent(new ol.interaction.ModifyEvent( - ol.ModifyEventType.MODIFYSTART, this.features_, evt)); - } -}; - - -/** - * @param {ol.Feature} feature Feature. - * @private - */ -ol.interaction.Modify.prototype.removeFeature_ = function(feature) { - this.removeFeatureSegmentData_(feature); - // Remove the vertex feature if the collection of canditate features - // is empty. - if (this.vertexFeature_ && this.features_.getLength() === 0) { - this.overlay_.getSource().removeFeature(this.vertexFeature_); - this.vertexFeature_ = null; - } - goog.events.unlisten(feature, goog.events.EventType.CHANGE, - this.handleFeatureChange_, false, this); -}; - - -/** - * @param {ol.Feature} feature Feature. - * @private - */ -ol.interaction.Modify.prototype.removeFeatureSegmentData_ = function(feature) { - var rBush = this.rBush_; - var /** @type {Array.<ol.interaction.SegmentDataType>} */ nodesToRemove = []; - rBush.forEach( - /** - * @param {ol.interaction.SegmentDataType} node RTree node. - */ - function(node) { - if (feature === node.feature) { - nodesToRemove.push(node); - } - }); - for (var i = nodesToRemove.length - 1; i >= 0; --i) { - rBush.remove(nodesToRemove[i]); - } -}; - - -/** - * @inheritDoc - */ -ol.interaction.Modify.prototype.setMap = function(map) { - this.overlay_.setMap(map); - goog.base(this, 'setMap', map); -}; - - -/** - * @param {ol.CollectionEvent} evt Event. - * @private - */ -ol.interaction.Modify.prototype.handleFeatureAdd_ = function(evt) { - var feature = evt.element; - goog.asserts.assertInstanceof(feature, ol.Feature, - 'feature should be an ol.Feature'); - this.addFeature_(feature); -}; - - -/** - * @param {goog.events.Event} evt Event. - * @private - */ -ol.interaction.Modify.prototype.handleFeatureChange_ = function(evt) { - if (!this.changingFeature_) { - var feature = /** @type {ol.Feature} */ (evt.target); - this.removeFeature_(feature); - this.addFeature_(feature); - } -}; - - -/** - * @param {ol.CollectionEvent} evt Event. - * @private - */ -ol.interaction.Modify.prototype.handleFeatureRemove_ = function(evt) { - var feature = /** @type {ol.Feature} */ (evt.element); - this.removeFeature_(feature); -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.Point} geometry Geometry. - * @private - */ -ol.interaction.Modify.prototype.writePointGeometry_ = - function(feature, geometry) { - var coordinates = geometry.getCoordinates(); - var segmentData = /** @type {ol.interaction.SegmentDataType} */ ({ - feature: feature, - geometry: geometry, - segment: [coordinates, coordinates] - }); - this.rBush_.insert(geometry.getExtent(), segmentData); -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.MultiPoint} geometry Geometry. - * @private - */ -ol.interaction.Modify.prototype.writeMultiPointGeometry_ = - function(feature, geometry) { - var points = geometry.getCoordinates(); - var coordinates, i, ii, segmentData; - for (i = 0, ii = points.length; i < ii; ++i) { - coordinates = points[i]; - segmentData = /** @type {ol.interaction.SegmentDataType} */ ({ - feature: feature, - geometry: geometry, - depth: [i], - index: i, - segment: [coordinates, coordinates] - }); - this.rBush_.insert(geometry.getExtent(), segmentData); - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.LineString} geometry Geometry. - * @private - */ -ol.interaction.Modify.prototype.writeLineStringGeometry_ = - function(feature, geometry) { - var coordinates = geometry.getCoordinates(); - var i, ii, segment, segmentData; - for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { - segment = coordinates.slice(i, i + 2); - segmentData = /** @type {ol.interaction.SegmentDataType} */ ({ - feature: feature, - geometry: geometry, - index: i, - segment: segment - }); - this.rBush_.insert(ol.extent.boundingExtent(segment), segmentData); - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.MultiLineString} geometry Geometry. - * @private - */ -ol.interaction.Modify.prototype.writeMultiLineStringGeometry_ = - function(feature, geometry) { - var lines = geometry.getCoordinates(); - var coordinates, i, ii, j, jj, segment, segmentData; - for (j = 0, jj = lines.length; j < jj; ++j) { - coordinates = lines[j]; - for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { - segment = coordinates.slice(i, i + 2); - segmentData = /** @type {ol.interaction.SegmentDataType} */ ({ - feature: feature, - geometry: geometry, - depth: [j], - index: i, - segment: segment - }); - this.rBush_.insert(ol.extent.boundingExtent(segment), segmentData); - } - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.Polygon} geometry Geometry. - * @private - */ -ol.interaction.Modify.prototype.writePolygonGeometry_ = - function(feature, geometry) { - var rings = geometry.getCoordinates(); - var coordinates, i, ii, j, jj, segment, segmentData; - for (j = 0, jj = rings.length; j < jj; ++j) { - coordinates = rings[j]; - for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { - segment = coordinates.slice(i, i + 2); - segmentData = /** @type {ol.interaction.SegmentDataType} */ ({ - feature: feature, - geometry: geometry, - depth: [j], - index: i, - segment: segment - }); - this.rBush_.insert(ol.extent.boundingExtent(segment), segmentData); - } - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.MultiPolygon} geometry Geometry. - * @private - */ -ol.interaction.Modify.prototype.writeMultiPolygonGeometry_ = - function(feature, geometry) { - var polygons = geometry.getCoordinates(); - var coordinates, i, ii, j, jj, k, kk, rings, segment, segmentData; - for (k = 0, kk = polygons.length; k < kk; ++k) { - rings = polygons[k]; - for (j = 0, jj = rings.length; j < jj; ++j) { - coordinates = rings[j]; - for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { - segment = coordinates.slice(i, i + 2); - segmentData = /** @type {ol.interaction.SegmentDataType} */ ({ - feature: feature, - geometry: geometry, - depth: [j, k], - index: i, - segment: segment - }); - this.rBush_.insert(ol.extent.boundingExtent(segment), segmentData); - } - } - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.GeometryCollection} geometry Geometry. - * @private - */ -ol.interaction.Modify.prototype.writeGeometryCollectionGeometry_ = - function(feature, geometry) { - var i, geometries = geometry.getGeometriesArray(); - for (i = 0; i < geometries.length; ++i) { - this.SEGMENT_WRITERS_[geometries[i].getType()].call( - this, feature, geometries[i]); - } -}; - - -/** - * @param {ol.Coordinate} coordinates Coordinates. - * @return {ol.Feature} Vertex feature. - * @private - */ -ol.interaction.Modify.prototype.createOrUpdateVertexFeature_ = - function(coordinates) { - var vertexFeature = this.vertexFeature_; - if (!vertexFeature) { - vertexFeature = new ol.Feature(new ol.geom.Point(coordinates)); - this.vertexFeature_ = vertexFeature; - this.overlay_.getSource().addFeature(vertexFeature); - } else { - var geometry = /** @type {ol.geom.Point} */ (vertexFeature.getGeometry()); - geometry.setCoordinates(coordinates); - } - return vertexFeature; -}; - - -/** - * @param {ol.interaction.SegmentDataType} a - * @param {ol.interaction.SegmentDataType} b - * @return {number} - * @private - */ -ol.interaction.Modify.compareIndexes_ = function(a, b) { - return a.index - b.index; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} evt Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.Modify} - * @private - */ -ol.interaction.Modify.handleDownEvent_ = function(evt) { - this.handlePointerAtPixel_(evt.pixel, evt.map); - this.dragSegments_ = []; - this.modified_ = false; - var vertexFeature = this.vertexFeature_; - if (vertexFeature) { - var insertVertices = []; - var geometry = /** @type {ol.geom.Point} */ (vertexFeature.getGeometry()); - var vertex = geometry.getCoordinates(); - var vertexExtent = ol.extent.boundingExtent([vertex]); - var segmentDataMatches = this.rBush_.getInExtent(vertexExtent); - var componentSegments = {}; - segmentDataMatches.sort(ol.interaction.Modify.compareIndexes_); - for (var i = 0, ii = segmentDataMatches.length; i < ii; ++i) { - var segmentDataMatch = segmentDataMatches[i]; - var segment = segmentDataMatch.segment; - var uid = goog.getUid(segmentDataMatch.feature); - var depth = segmentDataMatch.depth; - if (depth) { - uid += '-' + depth.join('-'); // separate feature components - } - if (!componentSegments[uid]) { - componentSegments[uid] = new Array(2); - } - if (ol.coordinate.equals(segment[0], vertex) && - !componentSegments[uid][0]) { - this.dragSegments_.push([segmentDataMatch, 0]); - componentSegments[uid][0] = segmentDataMatch; - } else if (ol.coordinate.equals(segment[1], vertex) && - !componentSegments[uid][1]) { - - // prevent dragging closed linestrings by the connecting node - if ((segmentDataMatch.geometry.getType() === - ol.geom.GeometryType.LINE_STRING || - segmentDataMatch.geometry.getType() === - ol.geom.GeometryType.MULTI_LINE_STRING) && - componentSegments[uid][0] && - componentSegments[uid][0].index === 0) { - continue; - } - - this.dragSegments_.push([segmentDataMatch, 1]); - componentSegments[uid][1] = segmentDataMatch; - } else if (goog.getUid(segment) in this.vertexSegments_ && - (!componentSegments[uid][0] && !componentSegments[uid][1])) { - insertVertices.push([segmentDataMatch, vertex]); - } - } - if (insertVertices.length) { - this.willModifyFeatures_(evt); - } - for (i = insertVertices.length - 1; i >= 0; --i) { - this.insertVertex_.apply(this, insertVertices[i]); - } - } - return !!this.vertexFeature_; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} evt Event. - * @this {ol.interaction.Modify} - * @private - */ -ol.interaction.Modify.handleDragEvent_ = function(evt) { - this.ignoreNextSingleClick_ = false; - this.willModifyFeatures_(evt); - - var vertex = evt.coordinate; - for (var i = 0, ii = this.dragSegments_.length; i < ii; ++i) { - var dragSegment = this.dragSegments_[i]; - var segmentData = dragSegment[0]; - var depth = segmentData.depth; - var geometry = segmentData.geometry; - var coordinates = geometry.getCoordinates(); - var segment = segmentData.segment; - var index = dragSegment[1]; - - while (vertex.length < geometry.getStride()) { - vertex.push(0); - } - - switch (geometry.getType()) { - case ol.geom.GeometryType.POINT: - coordinates = vertex; - segment[0] = segment[1] = vertex; - break; - case ol.geom.GeometryType.MULTI_POINT: - coordinates[segmentData.index] = vertex; - segment[0] = segment[1] = vertex; - break; - case ol.geom.GeometryType.LINE_STRING: - coordinates[segmentData.index + index] = vertex; - segment[index] = vertex; - break; - case ol.geom.GeometryType.MULTI_LINE_STRING: - coordinates[depth[0]][segmentData.index + index] = vertex; - segment[index] = vertex; - break; - case ol.geom.GeometryType.POLYGON: - coordinates[depth[0]][segmentData.index + index] = vertex; - segment[index] = vertex; - break; - case ol.geom.GeometryType.MULTI_POLYGON: - coordinates[depth[1]][depth[0]][segmentData.index + index] = vertex; - segment[index] = vertex; - break; - } - - this.setGeometryCoordinates_(geometry, coordinates); - } - this.createOrUpdateVertexFeature_(vertex); -}; - - -/** - * @param {ol.MapBrowserPointerEvent} evt Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.Modify} - * @private - */ -ol.interaction.Modify.handleUpEvent_ = function(evt) { - var segmentData; - for (var i = this.dragSegments_.length - 1; i >= 0; --i) { - segmentData = this.dragSegments_[i][0]; - this.rBush_.update(ol.extent.boundingExtent(segmentData.segment), - segmentData); - } - if (this.modified_) { - this.dispatchEvent(new ol.interaction.ModifyEvent( - ol.ModifyEventType.MODIFYEND, this.features_, evt)); - this.modified_ = false; - } - return false; -}; - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} and may modify the - * geometry. - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.Modify} - * @api - */ -ol.interaction.Modify.handleEvent = function(mapBrowserEvent) { - if (!(mapBrowserEvent instanceof ol.MapBrowserPointerEvent)) { - return true; - } - - var handled; - if (!mapBrowserEvent.map.getView().getHints()[ol.ViewHint.INTERACTING] && - mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE && - !this.handlingDownUpSequence) { - this.handlePointerMove_(mapBrowserEvent); - } - if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) { - if (mapBrowserEvent.type != ol.MapBrowserEvent.EventType.SINGLECLICK || - !this.ignoreNextSingleClick_) { - var geometry = this.vertexFeature_.getGeometry(); - goog.asserts.assertInstanceof(geometry, ol.geom.Point, - 'geometry should be an ol.geom.Point'); - this.willModifyFeatures_(mapBrowserEvent); - handled = this.removeVertex_(); - this.dispatchEvent(new ol.interaction.ModifyEvent( - ol.ModifyEventType.MODIFYEND, this.features_, mapBrowserEvent)); - this.modified_ = false; - } else { - handled = true; - } - } - - if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.SINGLECLICK) { - this.ignoreNextSingleClick_ = false; - } - - return ol.interaction.Pointer.handleEvent.call(this, mapBrowserEvent) && - !handled; -}; - - -/** - * @param {ol.MapBrowserEvent} evt Event. - * @private - */ -ol.interaction.Modify.prototype.handlePointerMove_ = function(evt) { - this.lastPixel_ = evt.pixel; - this.handlePointerAtPixel_(evt.pixel, evt.map); -}; - - -/** - * @param {ol.Pixel} pixel Pixel - * @param {ol.Map} map Map. - * @private - */ -ol.interaction.Modify.prototype.handlePointerAtPixel_ = function(pixel, map) { - var pixelCoordinate = map.getCoordinateFromPixel(pixel); - var sortByDistance = function(a, b) { - return ol.coordinate.squaredDistanceToSegment(pixelCoordinate, a.segment) - - ol.coordinate.squaredDistanceToSegment(pixelCoordinate, b.segment); - }; - - var lowerLeft = map.getCoordinateFromPixel( - [pixel[0] - this.pixelTolerance_, pixel[1] + this.pixelTolerance_]); - var upperRight = map.getCoordinateFromPixel( - [pixel[0] + this.pixelTolerance_, pixel[1] - this.pixelTolerance_]); - var box = ol.extent.boundingExtent([lowerLeft, upperRight]); - - var rBush = this.rBush_; - var nodes = rBush.getInExtent(box); - if (nodes.length > 0) { - nodes.sort(sortByDistance); - var node = nodes[0]; - var closestSegment = node.segment; - var vertex = (ol.coordinate.closestOnSegment(pixelCoordinate, - closestSegment)); - var vertexPixel = map.getPixelFromCoordinate(vertex); - if (Math.sqrt(ol.coordinate.squaredDistance(pixel, vertexPixel)) <= - this.pixelTolerance_) { - var pixel1 = map.getPixelFromCoordinate(closestSegment[0]); - var pixel2 = map.getPixelFromCoordinate(closestSegment[1]); - var squaredDist1 = ol.coordinate.squaredDistance(vertexPixel, pixel1); - var squaredDist2 = ol.coordinate.squaredDistance(vertexPixel, pixel2); - var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2)); - this.snappedToVertex_ = dist <= this.pixelTolerance_; - if (this.snappedToVertex_) { - vertex = squaredDist1 > squaredDist2 ? - closestSegment[1] : closestSegment[0]; - } - this.createOrUpdateVertexFeature_(vertex); - var vertexSegments = {}; - vertexSegments[goog.getUid(closestSegment)] = true; - var segment; - for (var i = 1, ii = nodes.length; i < ii; ++i) { - segment = nodes[i].segment; - if ((ol.coordinate.equals(closestSegment[0], segment[0]) && - ol.coordinate.equals(closestSegment[1], segment[1]) || - (ol.coordinate.equals(closestSegment[0], segment[1]) && - ol.coordinate.equals(closestSegment[1], segment[0])))) { - vertexSegments[goog.getUid(segment)] = true; - } else { - break; - } - } - this.vertexSegments_ = vertexSegments; - return; - } - } - if (this.vertexFeature_) { - this.overlay_.getSource().removeFeature(this.vertexFeature_); - this.vertexFeature_ = null; - } -}; - - -/** - * @param {ol.interaction.SegmentDataType} segmentData Segment data. - * @param {ol.Coordinate} vertex Vertex. - * @private - */ -ol.interaction.Modify.prototype.insertVertex_ = function(segmentData, vertex) { - var segment = segmentData.segment; - var feature = segmentData.feature; - var geometry = segmentData.geometry; - var depth = segmentData.depth; - var index = segmentData.index; - var coordinates; - - while (vertex.length < geometry.getStride()) { - vertex.push(0); - } - - switch (geometry.getType()) { - case ol.geom.GeometryType.MULTI_LINE_STRING: - goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString, - 'geometry should be an ol.geom.MultiLineString'); - coordinates = geometry.getCoordinates(); - coordinates[depth[0]].splice(index + 1, 0, vertex); - break; - case ol.geom.GeometryType.POLYGON: - goog.asserts.assertInstanceof(geometry, ol.geom.Polygon, - 'geometry should be an ol.geom.Polygon'); - coordinates = geometry.getCoordinates(); - coordinates[depth[0]].splice(index + 1, 0, vertex); - break; - case ol.geom.GeometryType.MULTI_POLYGON: - goog.asserts.assertInstanceof(geometry, ol.geom.MultiPolygon, - 'geometry should be an ol.geom.MultiPolygon'); - coordinates = geometry.getCoordinates(); - coordinates[depth[1]][depth[0]].splice(index + 1, 0, vertex); - break; - case ol.geom.GeometryType.LINE_STRING: - goog.asserts.assertInstanceof(geometry, ol.geom.LineString, - 'geometry should be an ol.geom.LineString'); - coordinates = geometry.getCoordinates(); - coordinates.splice(index + 1, 0, vertex); - break; - default: - return; - } - - this.setGeometryCoordinates_(geometry, coordinates); - var rTree = this.rBush_; - goog.asserts.assert(segment !== undefined, 'segment should be defined'); - rTree.remove(segmentData); - goog.asserts.assert(index !== undefined, 'index should be defined'); - this.updateSegmentIndices_(geometry, index, depth, 1); - var newSegmentData = /** @type {ol.interaction.SegmentDataType} */ ({ - segment: [segment[0], vertex], - feature: feature, - geometry: geometry, - depth: depth, - index: index - }); - rTree.insert(ol.extent.boundingExtent(newSegmentData.segment), - newSegmentData); - this.dragSegments_.push([newSegmentData, 1]); - - var newSegmentData2 = /** @type {ol.interaction.SegmentDataType} */ ({ - segment: [vertex, segment[1]], - feature: feature, - geometry: geometry, - depth: depth, - index: index + 1 - }); - rTree.insert(ol.extent.boundingExtent(newSegmentData2.segment), - newSegmentData2); - this.dragSegments_.push([newSegmentData2, 0]); - this.ignoreNextSingleClick_ = true; -}; - - -/** - * Removes a vertex from all matching features. - * @return {boolean} True when a vertex was removed. - * @private - */ -ol.interaction.Modify.prototype.removeVertex_ = function() { - var dragSegments = this.dragSegments_; - var segmentsByFeature = {}; - var component, coordinates, dragSegment, geometry, i, index, left; - var newIndex, newSegment, right, segmentData, uid, deleted; - for (i = dragSegments.length - 1; i >= 0; --i) { - dragSegment = dragSegments[i]; - segmentData = dragSegment[0]; - geometry = segmentData.geometry; - coordinates = geometry.getCoordinates(); - uid = goog.getUid(segmentData.feature); - if (segmentData.depth) { - // separate feature components - uid += '-' + segmentData.depth.join('-'); - } - left = right = index = undefined; - if (dragSegment[1] === 0) { - right = segmentData; - index = segmentData.index; - } else if (dragSegment[1] == 1) { - left = segmentData; - index = segmentData.index + 1; - } - if (!(uid in segmentsByFeature)) { - segmentsByFeature[uid] = [left, right, index]; - } - newSegment = segmentsByFeature[uid]; - if (left !== undefined) { - newSegment[0] = left; - } - if (right !== undefined) { - newSegment[1] = right; - } - if (newSegment[0] !== undefined && newSegment[1] !== undefined) { - component = coordinates; - deleted = false; - newIndex = index - 1; - switch (geometry.getType()) { - case ol.geom.GeometryType.MULTI_LINE_STRING: - coordinates[segmentData.depth[0]].splice(index, 1); - deleted = true; - break; - case ol.geom.GeometryType.LINE_STRING: - coordinates.splice(index, 1); - deleted = true; - break; - case ol.geom.GeometryType.MULTI_POLYGON: - component = component[segmentData.depth[1]]; - /* falls through */ - case ol.geom.GeometryType.POLYGON: - component = component[segmentData.depth[0]]; - if (component.length > 4) { - if (index == component.length - 1) { - index = 0; - } - component.splice(index, 1); - deleted = true; - if (index === 0) { - // close the ring again - component.pop(); - component.push(component[0]); - newIndex = component.length - 1; - } - } - break; - } - - if (deleted) { - this.rBush_.remove(newSegment[0]); - this.rBush_.remove(newSegment[1]); - this.setGeometryCoordinates_(geometry, coordinates); - goog.asserts.assert(newIndex >= 0, 'newIndex should be larger than 0'); - var newSegmentData = /** @type {ol.interaction.SegmentDataType} */ ({ - depth: segmentData.depth, - feature: segmentData.feature, - geometry: segmentData.geometry, - index: newIndex, - segment: [newSegment[0].segment[0], newSegment[1].segment[1]] - }); - this.rBush_.insert(ol.extent.boundingExtent(newSegmentData.segment), - newSegmentData); - this.updateSegmentIndices_(geometry, index, segmentData.depth, -1); - - if (this.vertexFeature_) { - this.overlay_.getSource().removeFeature(this.vertexFeature_); - this.vertexFeature_ = null; - } - } - } - } - return true; -}; - - -/** - * @param {ol.geom.SimpleGeometry} geometry Geometry. - * @param {Array} coordinates Coordinates. - * @private - */ -ol.interaction.Modify.prototype.setGeometryCoordinates_ = - function(geometry, coordinates) { - this.changingFeature_ = true; - geometry.setCoordinates(coordinates); - this.changingFeature_ = false; -}; - - -/** - * @param {ol.geom.SimpleGeometry} geometry Geometry. - * @param {number} index Index. - * @param {Array.<number>|undefined} depth Depth. - * @param {number} delta Delta (1 or -1). - * @private - */ -ol.interaction.Modify.prototype.updateSegmentIndices_ = function( - geometry, index, depth, delta) { - this.rBush_.forEachInExtent(geometry.getExtent(), function(segmentDataMatch) { - if (segmentDataMatch.geometry === geometry && - (depth === undefined || segmentDataMatch.depth === undefined || - goog.array.equals( - /** @type {null|{length: number}} */ (segmentDataMatch.depth), - depth)) && - segmentDataMatch.index > index) { - segmentDataMatch.index += delta; - } - }); -}; - - -/** - * @return {ol.style.StyleFunction} Styles. - */ -ol.interaction.Modify.getDefaultStyleFunction = function() { - var style = ol.style.createDefaultEditingStyles(); - return function(feature, resolution) { - return style[ol.geom.GeometryType.POINT]; - }; -}; - -goog.provide('ol.interaction.Select'); -goog.provide('ol.interaction.SelectEvent'); -goog.provide('ol.interaction.SelectEventType'); -goog.provide('ol.interaction.SelectFilterFunction'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.functions'); -goog.require('goog.object'); -goog.require('ol.CollectionEventType'); -goog.require('ol.Feature'); -goog.require('ol.array'); -goog.require('ol.events.condition'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.interaction.Interaction'); -goog.require('ol.layer.Vector'); -goog.require('ol.source.Vector'); - - -/** - * @enum {string} - */ -ol.interaction.SelectEventType = { - /** - * Triggered when feature(s) has been (de)selected. - * @event ol.interaction.SelectEvent#select - * @api - */ - SELECT: 'select' -}; - - -/** - * A function that takes an {@link ol.Feature} or {@link ol.render.Feature} and - * an {@link ol.layer.Layer} and returns `true` if the feature may be selected - * or `false` otherwise. - * @typedef {function((ol.Feature|ol.render.Feature), ol.layer.Layer): - * boolean} - * @api - */ -ol.interaction.SelectFilterFunction; - - - -/** - * @classdesc - * Events emitted by {@link ol.interaction.Select} instances are instances of - * this type. - * - * @param {string} type The event type. - * @param {Array.<ol.Feature>} selected Selected features. - * @param {Array.<ol.Feature>} deselected Deselected features. - * @param {ol.MapBrowserEvent} mapBrowserEvent Associated - * {@link ol.MapBrowserEvent}. - * @implements {oli.SelectEvent} - * @extends {goog.events.Event} - * @constructor - */ -ol.interaction.SelectEvent = - function(type, selected, deselected, mapBrowserEvent) { - goog.base(this, type); - - /** - * Selected features array. - * @type {Array.<ol.Feature>} - * @api - */ - this.selected = selected; - - /** - * Deselected features array. - * @type {Array.<ol.Feature>} - * @api - */ - this.deselected = deselected; - - /** - * Associated {@link ol.MapBrowserEvent}. - * @type {ol.MapBrowserEvent} - * @api - */ - this.mapBrowserEvent = mapBrowserEvent; -}; -goog.inherits(ol.interaction.SelectEvent, goog.events.Event); - - - -/** - * @classdesc - * Interaction for selecting vector features. By default, selected features are - * styled differently, so this interaction can be used for visual highlighting, - * as well as selecting features for other actions, such as modification or - * output. There are three ways of controlling which features are selected: - * using the browser event as defined by the `condition` and optionally the - * `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a - * further feature filter using the `filter` option. - * - * Selected features are added to an internal unmanaged layer. - * - * @constructor - * @extends {ol.interaction.Interaction} - * @param {olx.interaction.SelectOptions=} opt_options Options. - * @fires ol.interaction.SelectEvent - * @api stable - */ -ol.interaction.Select = function(opt_options) { - - goog.base(this, { - handleEvent: ol.interaction.Select.handleEvent - }); - - var options = opt_options ? opt_options : {}; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.condition_ = options.condition ? - options.condition : ol.events.condition.singleClick; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.addCondition_ = options.addCondition ? - options.addCondition : ol.events.condition.never; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.removeCondition_ = options.removeCondition ? - options.removeCondition : ol.events.condition.never; - - /** - * @private - * @type {ol.events.ConditionType} - */ - this.toggleCondition_ = options.toggleCondition ? - options.toggleCondition : ol.events.condition.shiftKeyOnly; - - /** - * @private - * @type {boolean} - */ - this.multi_ = options.multi ? options.multi : false; - - /** - * @private - * @type {ol.interaction.SelectFilterFunction} - */ - this.filter_ = options.filter ? options.filter : - goog.functions.TRUE; - - var layerFilter; - if (options.layers) { - if (goog.isFunction(options.layers)) { - layerFilter = options.layers; - } else { - var layers = options.layers; - layerFilter = - /** - * @param {ol.layer.Layer} layer Layer. - * @return {boolean} Include. - */ - function(layer) { - return ol.array.includes(layers, layer); - }; - } - } else { - layerFilter = goog.functions.TRUE; - } - - /** - * @private - * @type {function(ol.layer.Layer): boolean} - */ - this.layerFilter_ = layerFilter; - - /** - * An association between selected feature (key) - * and layer (value) - * @private - * @type {Object.<number, ol.layer.Layer>} - */ - this.featureLayerAssociation_ = {}; - - /** - * @private - * @type {ol.layer.Vector} - */ - this.featureOverlay_ = new ol.layer.Vector({ - source: new ol.source.Vector({ - useSpatialIndex: false, - features: options.features, - wrapX: options.wrapX - }), - style: options.style ? options.style : - ol.interaction.Select.getDefaultStyleFunction(), - updateWhileAnimating: true, - updateWhileInteracting: true - }); - - var features = this.featureOverlay_.getSource().getFeaturesCollection(); - goog.events.listen(features, ol.CollectionEventType.ADD, - this.addFeature_, false, this); - goog.events.listen(features, ol.CollectionEventType.REMOVE, - this.removeFeature_, false, this); - -}; -goog.inherits(ol.interaction.Select, ol.interaction.Interaction); - - -/** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @param {ol.layer.Layer} layer Layer. - * @private - */ -ol.interaction.Select.prototype.addFeatureLayerAssociation_ = - function(feature, layer) { - var key = goog.getUid(feature); - this.featureLayerAssociation_[key] = layer; -}; - - -/** - * Get the selected features. - * @return {ol.Collection.<ol.Feature>} Features collection. - * @api stable - */ -ol.interaction.Select.prototype.getFeatures = function() { - return this.featureOverlay_.getSource().getFeaturesCollection(); -}; - - -/** - * Returns the associated {@link ol.layer.Vector vectorlayer} of - * the (last) selected feature. Note that this will not work with any - * programmatic method like pushing features to - * {@link ol.interaction.Select#getFeatures collection}. - * @param {ol.Feature|ol.render.Feature} feature Feature - * @return {ol.layer.Vector} Layer. - * @api - */ -ol.interaction.Select.prototype.getLayer = function(feature) { - goog.asserts.assertInstanceof(feature, ol.Feature, - 'feature should be an ol.Feature'); - var key = goog.getUid(feature); - return /** @type {ol.layer.Vector} */ (this.featureLayerAssociation_[key]); -}; - - -/** - * Handles the {@link ol.MapBrowserEvent map browser event} and may change the - * selected state of features. - * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. - * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.Select} - * @api - */ -ol.interaction.Select.handleEvent = function(mapBrowserEvent) { - if (!this.condition_(mapBrowserEvent)) { - return true; - } - var add = this.addCondition_(mapBrowserEvent); - var remove = this.removeCondition_(mapBrowserEvent); - var toggle = this.toggleCondition_(mapBrowserEvent); - var set = !add && !remove && !toggle; - var map = mapBrowserEvent.map; - var features = this.featureOverlay_.getSource().getFeaturesCollection(); - var /** @type {!Array.<ol.Feature>} */ deselected = []; - var /** @type {!Array.<ol.Feature>} */ selected = []; - var change = false; - if (set) { - // Replace the currently selected feature(s) with the feature(s) at the - // pixel, or clear the selected feature(s) if there is no feature at - // the pixel. - map.forEachFeatureAtPixel(mapBrowserEvent.pixel, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @param {ol.layer.Layer} layer Layer. - */ - function(feature, layer) { - if (!layer || this.filter_(feature, layer)) { - selected.push(feature); - this.addFeatureLayerAssociation_(feature, layer); - return !this.multi_; - } - }, this, this.layerFilter_); - if (selected.length > 0 && features.getLength() == 1 && - features.item(0) == selected[0]) { - // No change - } else { - change = true; - if (features.getLength() !== 0) { - deselected = Array.prototype.concat(features.getArray()); - features.clear(); - } - features.extend(selected); - // Modify object this.featureLayerAssociation_ - if (selected.length === 0) { - goog.object.clear(this.featureLayerAssociation_); - } else { - if (deselected.length > 0) { - deselected.forEach(function(feature) { - this.removeFeatureLayerAssociation_(feature); - }, this); - } - } - } - } else { - // Modify the currently selected feature(s). - map.forEachFeatureAtPixel(mapBrowserEvent.pixel, - /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @param {ol.layer.Layer} layer Layer. - */ - function(feature, layer) { - if (!ol.array.includes(features.getArray(), feature)) { - if (add || toggle) { - if (this.filter_(feature, layer)) { - selected.push(feature); - this.addFeatureLayerAssociation_(feature, layer); - } - } - } else { - if (remove || toggle) { - deselected.push(feature); - this.removeFeatureLayerAssociation_(feature); - } - } - }, this, this.layerFilter_); - var i; - for (i = deselected.length - 1; i >= 0; --i) { - features.remove(deselected[i]); - } - features.extend(selected); - if (selected.length > 0 || deselected.length > 0) { - change = true; - } - } - if (change) { - this.dispatchEvent( - new ol.interaction.SelectEvent(ol.interaction.SelectEventType.SELECT, - selected, deselected, mapBrowserEvent)); - } - return ol.events.condition.pointerMove(mapBrowserEvent); -}; - - -/** - * Remove the interaction from its current map, if any, and attach it to a new - * map, if any. Pass `null` to just remove the interaction from the current map. - * @param {ol.Map} map Map. - * @api stable - */ -ol.interaction.Select.prototype.setMap = function(map) { - var currentMap = this.getMap(); - var selectedFeatures = - this.featureOverlay_.getSource().getFeaturesCollection(); - if (!goog.isNull(currentMap)) { - selectedFeatures.forEach(currentMap.unskipFeature, currentMap); - } - goog.base(this, 'setMap', map); - this.featureOverlay_.setMap(map); - if (!goog.isNull(map)) { - selectedFeatures.forEach(map.skipFeature, map); - } -}; - - -/** - * @return {ol.style.StyleFunction} Styles. - */ -ol.interaction.Select.getDefaultStyleFunction = function() { - var styles = ol.style.createDefaultEditingStyles(); - goog.array.extend(styles[ol.geom.GeometryType.POLYGON], - styles[ol.geom.GeometryType.LINE_STRING]); - goog.array.extend(styles[ol.geom.GeometryType.GEOMETRY_COLLECTION], - styles[ol.geom.GeometryType.LINE_STRING]); - - return function(feature, resolution) { - return styles[feature.getGeometry().getType()]; - }; -}; - - -/** - * @param {ol.CollectionEvent} evt Event. - * @private - */ -ol.interaction.Select.prototype.addFeature_ = function(evt) { - var feature = evt.element; - var map = this.getMap(); - goog.asserts.assertInstanceof(feature, ol.Feature, - 'feature should be an ol.Feature'); - if (!goog.isNull(map)) { - map.skipFeature(feature); - } -}; - - -/** - * @param {ol.CollectionEvent} evt Event. - * @private - */ -ol.interaction.Select.prototype.removeFeature_ = function(evt) { - var feature = evt.element; - var map = this.getMap(); - goog.asserts.assertInstanceof(feature, ol.Feature, - 'feature should be an ol.Feature'); - if (!goog.isNull(map)) { - map.unskipFeature(feature); - } -}; - - -/** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @private - */ -ol.interaction.Select.prototype.removeFeatureLayerAssociation_ = - function(feature) { - var key = goog.getUid(feature); - delete this.featureLayerAssociation_[key]; -}; - -goog.provide('ol.interaction.Snap'); -goog.provide('ol.interaction.SnapProperty'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Collection'); -goog.require('ol.CollectionEvent'); -goog.require('ol.CollectionEventType'); -goog.require('ol.Extent'); -goog.require('ol.Feature'); -goog.require('ol.Object'); -goog.require('ol.Observable'); -goog.require('ol.coordinate'); -goog.require('ol.extent'); -goog.require('ol.geom.Geometry'); -goog.require('ol.interaction.Pointer'); -goog.require('ol.source.Vector'); -goog.require('ol.source.VectorEvent'); -goog.require('ol.source.VectorEventType'); -goog.require('ol.structs.RBush'); - - - -/** - * @classdesc - * Handles snapping of vector features while modifying or drawing them. The - * features can come from a {@link ol.source.Vector} or {@link ol.Collection} - * Any interaction object that allows the user to interact - * with the features using the mouse can benefit from the snapping, as long - * as it is added before. - * - * The snap interaction modifies map browser event `coordinate` and `pixel` - * properties to force the snap to occur to any interaction that them. - * - * Example: - * - * var snap = new ol.interaction.Snap({ - * source: source - * }); - * - * @constructor - * @extends {ol.interaction.Pointer} - * @param {olx.interaction.SnapOptions=} opt_options Options. - * @api - */ -ol.interaction.Snap = function(opt_options) { - - goog.base(this, { - handleEvent: ol.interaction.Snap.handleEvent_, - handleDownEvent: goog.functions.TRUE, - handleUpEvent: ol.interaction.Snap.handleUpEvent_ - }); - - var options = opt_options ? opt_options : {}; - - /** - * @type {ol.source.Vector} - * @private - */ - this.source_ = options.source ? options.source : null; - - /** - * @type {ol.Collection.<ol.Feature>} - * @private - */ - this.features_ = options.features ? options.features : null; - - /** - * @type {Array.<goog.events.Key>} - * @private - */ - this.featuresListenerKeys_ = []; - - /** - * @type {Object.<number, goog.events.Key>} - * @private - */ - this.geometryChangeListenerKeys_ = {}; - - /** - * @type {Object.<number, goog.events.Key>} - * @private - */ - this.geometryModifyListenerKeys_ = {}; - - /** - * Extents are preserved so indexed segment can be quickly removed - * when its feature geometry changes - * @type {Object.<number, ol.Extent>} - * @private - */ - this.indexedFeaturesExtents_ = {}; - - /** - * If a feature geometry changes while a pointer drag|move event occurs, the - * feature doesn't get updated right away. It will be at the next 'pointerup' - * event fired. - * @type {Object.<number, ol.Feature>} - * @private - */ - this.pendingFeatures_ = {}; - - /** - * Used for distance sorting in sortByDistance_ - * @type {ol.Coordinate} - * @private - */ - this.pixelCoordinate_ = null; - - /** - * @type {number} - * @private - */ - this.pixelTolerance_ = options.pixelTolerance !== undefined ? - options.pixelTolerance : 10; - - /** - * @type {function(ol.interaction.Snap.SegmentDataType, ol.interaction.Snap.SegmentDataType): number} - * @private - */ - this.sortByDistance_ = goog.bind(ol.interaction.Snap.sortByDistance, this); - - - /** - * Segment RTree for each layer - * @type {ol.structs.RBush.<ol.interaction.Snap.SegmentDataType>} - * @private - */ - this.rBush_ = new ol.structs.RBush(); - - - /** - * @const - * @private - * @type {Object.<string, function(ol.Feature, ol.geom.Geometry)> } - */ - this.SEGMENT_WRITERS_ = { - 'Point': this.writePointGeometry_, - 'LineString': this.writeLineStringGeometry_, - 'LinearRing': this.writeLineStringGeometry_, - 'Polygon': this.writePolygonGeometry_, - 'MultiPoint': this.writeMultiPointGeometry_, - 'MultiLineString': this.writeMultiLineStringGeometry_, - 'MultiPolygon': this.writeMultiPolygonGeometry_, - 'GeometryCollection': this.writeGeometryCollectionGeometry_ - }; -}; -goog.inherits(ol.interaction.Snap, ol.interaction.Pointer); - - -/** - * Add a feature to the collection of features that we may snap to. - * @param {ol.Feature} feature Feature. - * @param {boolean=} opt_listen Whether to listen to the geometry change or not - * Defaults to `true`. - * @api - */ -ol.interaction.Snap.prototype.addFeature = function(feature, opt_listen) { - var listen = opt_listen !== undefined ? opt_listen : true; - var geometry = feature.getGeometry(); - var segmentWriter = this.SEGMENT_WRITERS_[geometry.getType()]; - if (segmentWriter) { - var feature_uid = goog.getUid(feature); - this.indexedFeaturesExtents_[feature_uid] = geometry.getExtent( - ol.extent.createEmpty()); - segmentWriter.call(this, feature, geometry); - - if (listen) { - this.geometryModifyListenerKeys_[feature_uid] = geometry.on( - goog.events.EventType.CHANGE, - goog.bind(this.handleGeometryModify_, this, feature), - this); - this.geometryChangeListenerKeys_[feature_uid] = feature.on( - ol.Object.getChangeEventType(feature.getGeometryName()), - this.handleGeometryChange_, this); - } - } -}; - - -/** - * @param {ol.Feature} feature Feature. - * @private - */ -ol.interaction.Snap.prototype.forEachFeatureAdd_ = function(feature) { - this.addFeature(feature); -}; - - -/** - * @param {ol.Feature} feature Feature. - * @private - */ -ol.interaction.Snap.prototype.forEachFeatureRemove_ = function(feature) { - this.removeFeature(feature); -}; - - -/** - * @return {ol.Collection.<ol.Feature>|Array.<ol.Feature>} - * @private - */ -ol.interaction.Snap.prototype.getFeatures_ = function() { - var features; - if (this.features_) { - features = this.features_; - } else if (this.source_) { - features = this.source_.getFeatures(); - } - goog.asserts.assert(features !== undefined, 'features should be defined'); - return features; -}; - - -/** - * @param {ol.source.VectorEvent|ol.CollectionEvent} evt Event. - * @private - */ -ol.interaction.Snap.prototype.handleFeatureAdd_ = function(evt) { - var feature; - if (evt instanceof ol.source.VectorEvent) { - feature = evt.feature; - } else if (evt instanceof ol.CollectionEvent) { - feature = evt.element; - } - goog.asserts.assertInstanceof(feature, ol.Feature, - 'feature should be an ol.Feature'); - this.addFeature(feature); -}; - - -/** - * @param {ol.source.VectorEvent|ol.CollectionEvent} evt Event. - * @private - */ -ol.interaction.Snap.prototype.handleFeatureRemove_ = function(evt) { - var feature; - if (evt instanceof ol.source.VectorEvent) { - feature = evt.feature; - } else if (evt instanceof ol.CollectionEvent) { - feature = evt.element; - } - goog.asserts.assertInstanceof(feature, ol.Feature, - 'feature should be an ol.Feature'); - this.removeFeature(feature); -}; - - -/** - * @param {goog.events.Event} evt Event. - * @private - */ -ol.interaction.Snap.prototype.handleGeometryChange_ = function(evt) { - var feature = evt.currentTarget; - goog.asserts.assertInstanceof(feature, ol.Feature); - this.removeFeature(feature, true); - this.addFeature(feature, true); -}; - - -/** - * @param {ol.Feature} feature Feature which geometry was modified. - * @param {goog.events.Event} evt Event. - * @private - */ -ol.interaction.Snap.prototype.handleGeometryModify_ = function(feature, evt) { - if (this.handlingDownUpSequence) { - var uid = goog.getUid(feature); - if (!(uid in this.pendingFeatures_)) { - this.pendingFeatures_[uid] = feature; - } - } else { - this.updateFeature_(feature); - } -}; - - -/** - * Remove a feature from the collection of features that we may snap to. - * @param {ol.Feature} feature Feature - * @param {boolean=} opt_unlisten Whether to unlisten to the geometry change - * or not. Defaults to `true`. - * @api - */ -ol.interaction.Snap.prototype.removeFeature = function(feature, opt_unlisten) { - var unlisten = opt_unlisten !== undefined ? opt_unlisten : true; - var feature_uid = goog.getUid(feature); - var extent = this.indexedFeaturesExtents_[feature_uid]; - if (extent) { - var rBush = this.rBush_; - var i, nodesToRemove = []; - rBush.forEachInExtent(extent, function(node) { - if (feature === node.feature) { - nodesToRemove.push(node); - } - }); - for (i = nodesToRemove.length - 1; i >= 0; --i) { - rBush.remove(nodesToRemove[i]); - } - if (unlisten) { - ol.Observable.unByKey(this.geometryModifyListenerKeys_[feature_uid]); - delete this.geometryModifyListenerKeys_[feature_uid]; - - ol.Observable.unByKey(this.geometryChangeListenerKeys_[feature_uid]); - delete this.geometryChangeListenerKeys_[feature_uid]; - } - } -}; - - -/** - * @inheritDoc - */ -ol.interaction.Snap.prototype.setMap = function(map) { - var currentMap = this.getMap(); - var keys = this.featuresListenerKeys_; - var features = this.getFeatures_(); - - if (currentMap) { - keys.forEach(ol.Observable.unByKey); - keys.length = 0; - features.forEach(this.forEachFeatureRemove_, this); - } - - goog.base(this, 'setMap', map); - - if (map) { - if (this.features_) { - keys.push(this.features_.on(ol.CollectionEventType.ADD, - this.handleFeatureAdd_, this)); - keys.push(this.features_.on(ol.CollectionEventType.REMOVE, - this.handleFeatureRemove_, this)); - } else if (this.source_) { - keys.push(this.source_.on(ol.source.VectorEventType.ADDFEATURE, - this.handleFeatureAdd_, this)); - keys.push(this.source_.on(ol.source.VectorEventType.REMOVEFEATURE, - this.handleFeatureRemove_, this)); - } - features.forEach(this.forEachFeatureAdd_, this); - } -}; - - -/** - * @inheritDoc - */ -ol.interaction.Snap.prototype.shouldStopEvent = goog.functions.FALSE; - - -/** - * @param {ol.Pixel} pixel Pixel - * @param {ol.Coordinate} pixelCoordinate Coordinate - * @param {ol.Map} map Map. - * @return {ol.interaction.Snap.ResultType} Snap result - */ -ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) { - - var lowerLeft = map.getCoordinateFromPixel( - [pixel[0] - this.pixelTolerance_, pixel[1] + this.pixelTolerance_]); - var upperRight = map.getCoordinateFromPixel( - [pixel[0] + this.pixelTolerance_, pixel[1] - this.pixelTolerance_]); - var box = ol.extent.boundingExtent([lowerLeft, upperRight]); - - var segments = this.rBush_.getInExtent(box); - var snappedToVertex = false; - var snapped = false; - var vertex = null; - var vertexPixel = null; - if (segments.length > 0) { - this.pixelCoordinate_ = pixelCoordinate; - segments.sort(this.sortByDistance_); - var closestSegment = segments[0].segment; - vertex = (ol.coordinate.closestOnSegment(pixelCoordinate, - closestSegment)); - vertexPixel = map.getPixelFromCoordinate(vertex); - if (Math.sqrt(ol.coordinate.squaredDistance(pixel, vertexPixel)) <= - this.pixelTolerance_) { - snapped = true; - var pixel1 = map.getPixelFromCoordinate(closestSegment[0]); - var pixel2 = map.getPixelFromCoordinate(closestSegment[1]); - var squaredDist1 = ol.coordinate.squaredDistance(vertexPixel, pixel1); - var squaredDist2 = ol.coordinate.squaredDistance(vertexPixel, pixel2); - var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2)); - snappedToVertex = dist <= this.pixelTolerance_; - if (snappedToVertex) { - vertex = squaredDist1 > squaredDist2 ? - closestSegment[1] : closestSegment[0]; - vertexPixel = map.getPixelFromCoordinate(vertex); - vertexPixel = [Math.round(vertexPixel[0]), Math.round(vertexPixel[1])]; - } - } - } - return /** @type {ol.interaction.Snap.ResultType} */ ({ - snapped: snapped, - vertex: vertex, - vertexPixel: vertexPixel - }); -}; - - -/** - * @param {ol.Feature} feature Feature - * @private - */ -ol.interaction.Snap.prototype.updateFeature_ = function(feature) { - this.removeFeature(feature, false); - this.addFeature(feature, false); -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.GeometryCollection} geometry Geometry. - * @private - */ -ol.interaction.Snap.prototype.writeGeometryCollectionGeometry_ = - function(feature, geometry) { - var i, geometries = geometry.getGeometriesArray(); - for (i = 0; i < geometries.length; ++i) { - this.SEGMENT_WRITERS_[geometries[i].getType()].call( - this, feature, geometries[i]); - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.LineString} geometry Geometry. - * @private - */ -ol.interaction.Snap.prototype.writeLineStringGeometry_ = - function(feature, geometry) { - var coordinates = geometry.getCoordinates(); - var i, ii, segment, segmentData; - for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { - segment = coordinates.slice(i, i + 2); - segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({ - feature: feature, - segment: segment - }); - this.rBush_.insert(ol.extent.boundingExtent(segment), segmentData); - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.MultiLineString} geometry Geometry. - * @private - */ -ol.interaction.Snap.prototype.writeMultiLineStringGeometry_ = - function(feature, geometry) { - var lines = geometry.getCoordinates(); - var coordinates, i, ii, j, jj, segment, segmentData; - for (j = 0, jj = lines.length; j < jj; ++j) { - coordinates = lines[j]; - for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { - segment = coordinates.slice(i, i + 2); - segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({ - feature: feature, - segment: segment - }); - this.rBush_.insert(ol.extent.boundingExtent(segment), segmentData); - } - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.MultiPoint} geometry Geometry. - * @private - */ -ol.interaction.Snap.prototype.writeMultiPointGeometry_ = - function(feature, geometry) { - var points = geometry.getCoordinates(); - var coordinates, i, ii, segmentData; - for (i = 0, ii = points.length; i < ii; ++i) { - coordinates = points[i]; - segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({ - feature: feature, - segment: [coordinates, coordinates] - }); - this.rBush_.insert(geometry.getExtent(), segmentData); - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.MultiPolygon} geometry Geometry. - * @private - */ -ol.interaction.Snap.prototype.writeMultiPolygonGeometry_ = - function(feature, geometry) { - var polygons = geometry.getCoordinates(); - var coordinates, i, ii, j, jj, k, kk, rings, segment, segmentData; - for (k = 0, kk = polygons.length; k < kk; ++k) { - rings = polygons[k]; - for (j = 0, jj = rings.length; j < jj; ++j) { - coordinates = rings[j]; - for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { - segment = coordinates.slice(i, i + 2); - segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({ - feature: feature, - segment: segment - }); - this.rBush_.insert(ol.extent.boundingExtent(segment), segmentData); - } - } - } -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.Point} geometry Geometry. - * @private - */ -ol.interaction.Snap.prototype.writePointGeometry_ = - function(feature, geometry) { - var coordinates = geometry.getCoordinates(); - var segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({ - feature: feature, - segment: [coordinates, coordinates] - }); - this.rBush_.insert(geometry.getExtent(), segmentData); -}; - - -/** - * @param {ol.Feature} feature Feature - * @param {ol.geom.Polygon} geometry Geometry. - * @private - */ -ol.interaction.Snap.prototype.writePolygonGeometry_ = - function(feature, geometry) { - var rings = geometry.getCoordinates(); - var coordinates, i, ii, j, jj, segment, segmentData; - for (j = 0, jj = rings.length; j < jj; ++j) { - coordinates = rings[j]; - for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { - segment = coordinates.slice(i, i + 2); - segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({ - feature: feature, - segment: segment - }); - this.rBush_.insert(ol.extent.boundingExtent(segment), segmentData); - } - } -}; - - -/** - * @typedef {{ - * snapped: {boolean}, - * vertex: (ol.Coordinate|null), - * vertexPixel: (ol.Pixel|null) - * }} - */ -ol.interaction.Snap.ResultType; - - -/** - * @typedef {{ - * feature: ol.Feature, - * segment: Array.<ol.Coordinate> - * }} - */ -ol.interaction.Snap.SegmentDataType; - - -/** - * Handle all pointer events events. - * @param {ol.MapBrowserEvent} evt A move event. - * @return {boolean} Pass the event to other interactions. - * @this {ol.interaction.Snap} - * @private - */ -ol.interaction.Snap.handleEvent_ = function(evt) { - var result = this.snapTo(evt.pixel, evt.coordinate, evt.map); - if (result.snapped) { - evt.coordinate = result.vertex.slice(0, 2); - evt.pixel = result.vertexPixel; - } - return ol.interaction.Pointer.handleEvent.call(this, evt); -}; - - -/** - * @param {ol.MapBrowserPointerEvent} evt Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.Snap} - * @private - */ -ol.interaction.Snap.handleUpEvent_ = function(evt) { - var featuresToUpdate = goog.object.getValues(this.pendingFeatures_); - if (featuresToUpdate.length) { - featuresToUpdate.forEach(this.updateFeature_, this); - this.pendingFeatures_ = {}; - } - return false; -}; - - -/** - * Sort segments by distance, helper function - * @param {ol.interaction.Snap.SegmentDataType} a - * @param {ol.interaction.Snap.SegmentDataType} b - * @return {number} - * @this {ol.interaction.Snap} - */ -ol.interaction.Snap.sortByDistance = function(a, b) { - return ol.coordinate.squaredDistanceToSegment( - this.pixelCoordinate_, a.segment) - - ol.coordinate.squaredDistanceToSegment( - this.pixelCoordinate_, b.segment); -}; - -goog.provide('ol.interaction.Translate'); -goog.provide('ol.interaction.TranslateEvent'); - -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('ol.array'); -goog.require('ol.interaction.Pointer'); - - -/** - * @enum {string} - */ -ol.interaction.TranslateEventType = { - /** - * Triggered upon feature translation start. - * @event ol.interaction.TranslateEvent#translatestart - * @api - */ - TRANSLATESTART: 'translatestart', - /** - * Triggered upon feature translation. - * @event ol.interaction.TranslateEvent#translating - * @api - */ - TRANSLATING: 'translating', - /** - * Triggered upon feature translation end. - * @event ol.interaction.TranslateEvent#translateend - * @api - */ - TRANSLATEEND: 'translateend' -}; - - - -/** - * @classdesc - * Events emitted by {@link ol.interaction.Translate} instances are instances of - * this type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.interaction.TranslateEvent} - * @param {ol.interaction.TranslateEventType} type Type. - * @param {ol.Collection.<ol.Feature>} features The features translated. - * @param {ol.Coordinate} coordinate The event coordinate. - */ -ol.interaction.TranslateEvent = function(type, features, coordinate) { - - goog.base(this, type); - - /** - * The features being translated. - * @type {ol.Collection.<ol.Feature>} - * @api - */ - this.features = features; - - /** - * The coordinate of the drag event. - * @const - * @type {ol.Coordinate} - * @api - */ - this.coordinate = coordinate; -}; -goog.inherits(ol.interaction.TranslateEvent, goog.events.Event); - - - -/** - * @classdesc - * Interaction for translating (moving) features. - * - * @constructor - * @extends {ol.interaction.Pointer} - * @fires ol.interaction.TranslateEvent - * @param {olx.interaction.TranslateOptions} options Options. - * @api - */ -ol.interaction.Translate = function(options) { - goog.base(this, { - handleDownEvent: ol.interaction.Translate.handleDownEvent_, - handleDragEvent: ol.interaction.Translate.handleDragEvent_, - handleMoveEvent: ol.interaction.Translate.handleMoveEvent_, - handleUpEvent: ol.interaction.Translate.handleUpEvent_ - }); - - - /** - * @type {string|undefined} - * @private - */ - this.previousCursor_ = undefined; - - - /** - * The last position we translated to. - * @type {ol.Coordinate} - * @private - */ - this.lastCoordinate_ = null; - - - /** - * @type {ol.Collection.<ol.Feature>} - * @private - */ - this.features_ = options.features !== undefined ? options.features : null; - - /** - * @type {ol.Feature} - * @private - */ - this.lastFeature_ = null; -}; -goog.inherits(ol.interaction.Translate, ol.interaction.Pointer); - - -/** - * @param {ol.MapBrowserPointerEvent} event Event. - * @return {boolean} Start drag sequence? - * @this {ol.interaction.Translate} - * @private - */ -ol.interaction.Translate.handleDownEvent_ = function(event) { - this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map); - if (!this.lastCoordinate_ && this.lastFeature_) { - this.lastCoordinate_ = event.coordinate; - ol.interaction.Translate.handleMoveEvent_.call(this, event); - this.dispatchEvent( - new ol.interaction.TranslateEvent( - ol.interaction.TranslateEventType.TRANSLATESTART, this.features_, - event.coordinate)); - return true; - } - return false; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} event Event. - * @return {boolean} Stop drag sequence? - * @this {ol.interaction.Translate} - * @private - */ -ol.interaction.Translate.handleUpEvent_ = function(event) { - if (this.lastCoordinate_) { - this.lastCoordinate_ = null; - ol.interaction.Translate.handleMoveEvent_.call(this, event); - this.dispatchEvent( - new ol.interaction.TranslateEvent( - ol.interaction.TranslateEventType.TRANSLATEEND, this.features_, - event.coordinate)); - return true; - } - return false; -}; - - -/** - * @param {ol.MapBrowserPointerEvent} event Event. - * @this {ol.interaction.Translate} - * @private - */ -ol.interaction.Translate.handleDragEvent_ = function(event) { - if (this.lastCoordinate_) { - var newCoordinate = event.coordinate; - var deltaX = newCoordinate[0] - this.lastCoordinate_[0]; - var deltaY = newCoordinate[1] - this.lastCoordinate_[1]; - - if (this.features_) { - this.features_.forEach(function(feature) { - var geom = feature.getGeometry(); - geom.translate(deltaX, deltaY); - feature.setGeometry(geom); - }); - } else if (this.lastFeature_) { - var geom = this.lastFeature_.getGeometry(); - geom.translate(deltaX, deltaY); - this.lastFeature_.setGeometry(geom); - } - - this.lastCoordinate_ = newCoordinate; - this.dispatchEvent( - new ol.interaction.TranslateEvent( - ol.interaction.TranslateEventType.TRANSLATING, this.features_, - newCoordinate)); - } -}; - - -/** - * @param {ol.MapBrowserEvent} event Event. - * @this {ol.interaction.Translate} - * @private - */ -ol.interaction.Translate.handleMoveEvent_ = function(event) - { - var elem = event.map.getTargetElement(); - var intersectingFeature = event.map.forEachFeatureAtPixel(event.pixel, - function(feature) { - return feature; - }); - - if (intersectingFeature) { - var isSelected = false; - - if (this.features_ && - ol.array.includes(this.features_.getArray(), intersectingFeature)) { - isSelected = true; - } - - this.previousCursor_ = elem.style.cursor; - - // WebKit browsers don't support the grab icons without a prefix - elem.style.cursor = this.lastCoordinate_ ? - '-webkit-grabbing' : (isSelected ? '-webkit-grab' : 'pointer'); - - // Thankfully, attempting to set the standard ones will silently fail, - // keeping the prefixed icons - elem.style.cursor = !this.lastCoordinate_ ? - 'grabbing' : (isSelected ? 'grab' : 'pointer'); - - } else { - elem.style.cursor = this.previousCursor_ !== undefined ? - this.previousCursor_ : ''; - this.previousCursor_ = undefined; - } -}; - - -/** - * Tests to see if the given coordinates intersects any of our selected - * features. - * @param {ol.Pixel} pixel Pixel coordinate to test for intersection. - * @param {ol.Map} map Map to test the intersection on. - * @return {ol.Feature} Returns the feature found at the specified pixel - * coordinates. - * @private - */ -ol.interaction.Translate.prototype.featuresAtPixel_ = function(pixel, map) { - var found = null; - - var intersectingFeature = map.forEachFeatureAtPixel(pixel, - function(feature) { - return feature; - }); - - if (this.features_ && - ol.array.includes(this.features_.getArray(), intersectingFeature)) { - found = intersectingFeature; - } - - return found; -}; - -goog.provide('ol.layer.Heatmap'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.object'); -goog.require('ol'); -goog.require('ol.Object'); -goog.require('ol.dom'); -goog.require('ol.layer.Vector'); -goog.require('ol.math'); -goog.require('ol.render.EventType'); -goog.require('ol.style.Icon'); -goog.require('ol.style.Style'); - - -/** - * @enum {string} - */ -ol.layer.HeatmapLayerProperty = { - BLUR: 'blur', - GRADIENT: 'gradient', - RADIUS: 'radius' -}; - - - -/** - * @classdesc - * Layer for rendering vector data as a heatmap. - * Note that any property set in the options is set as a {@link ol.Object} - * property on the layer object; for example, setting `title: 'My Title'` in the - * options means that `title` is observable, and has get/set accessors. - * - * @constructor - * @extends {ol.layer.Vector} - * @fires ol.render.Event - * @param {olx.layer.HeatmapOptions=} opt_options Options. - * @api - */ -ol.layer.Heatmap = function(opt_options) { - var options = opt_options ? opt_options : {}; - - var baseOptions = goog.object.clone(options); - - delete baseOptions.gradient; - delete baseOptions.radius; - delete baseOptions.blur; - delete baseOptions.shadow; - delete baseOptions.weight; - goog.base(this, /** @type {olx.layer.VectorOptions} */ (baseOptions)); - - /** - * @private - * @type {Uint8ClampedArray} - */ - this.gradient_ = null; - - /** - * @private - * @type {number} - */ - this.shadow_ = options.shadow !== undefined ? options.shadow : 250; - - /** - * @private - * @type {string|undefined} - */ - this.circleImage_ = undefined; - - /** - * @private - * @type {Array.<Array.<ol.style.Style>>} - */ - this.styleCache_ = null; - - goog.events.listen(this, - ol.Object.getChangeEventType(ol.layer.HeatmapLayerProperty.GRADIENT), - this.handleGradientChanged_, false, this); - - this.setGradient(options.gradient ? - options.gradient : ol.layer.Heatmap.DEFAULT_GRADIENT); - - this.setBlur(options.blur !== undefined ? options.blur : 15); - - this.setRadius(options.radius !== undefined ? options.radius : 8); - - goog.events.listen(this, [ - ol.Object.getChangeEventType(ol.layer.HeatmapLayerProperty.BLUR), - ol.Object.getChangeEventType(ol.layer.HeatmapLayerProperty.RADIUS) - ], this.handleStyleChanged_, false, this); - - this.handleStyleChanged_(); - - var weight = options.weight ? options.weight : 'weight'; - var weightFunction; - if (goog.isString(weight)) { - weightFunction = function(feature) { - return feature.get(weight); - }; - } else { - weightFunction = weight; - } - goog.asserts.assert(goog.isFunction(weightFunction), - 'weightFunction should be a function'); - - this.setStyle(goog.bind(function(feature, resolution) { - goog.asserts.assert(this.styleCache_, 'this.styleCache_ expected'); - goog.asserts.assert(this.circleImage_ !== undefined, - 'this.circleImage_ should be defined'); - var weight = weightFunction(feature); - var opacity = weight !== undefined ? ol.math.clamp(weight, 0, 1) : 1; - // cast to 8 bits - var index = (255 * opacity) | 0; - var style = this.styleCache_[index]; - if (!style) { - style = [ - new ol.style.Style({ - image: new ol.style.Icon({ - opacity: opacity, - src: this.circleImage_ - }) - }) - ]; - this.styleCache_[index] = style; - } - return style; - }, this)); - - // For performance reasons, don't sort the features before rendering. - // The render order is not relevant for a heatmap representation. - this.setRenderOrder(null); - - goog.events.listen(this, ol.render.EventType.RENDER, - this.handleRender_, false, this); - -}; -goog.inherits(ol.layer.Heatmap, ol.layer.Vector); - - -/** - * @const - * @type {Array.<string>} - */ -ol.layer.Heatmap.DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00']; - - -/** - * @param {Array.<string>} colors - * @return {Uint8ClampedArray} - * @private - */ -ol.layer.Heatmap.createGradient_ = function(colors) { - var width = 1; - var height = 256; - var context = ol.dom.createCanvasContext2D(width, height); - - var gradient = context.createLinearGradient(0, 0, width, height); - var step = 1 / (colors.length - 1); - for (var i = 0, ii = colors.length; i < ii; ++i) { - gradient.addColorStop(i * step, colors[i]); - } - - context.fillStyle = gradient; - context.fillRect(0, 0, width, height); - - return context.getImageData(0, 0, width, height).data; -}; - - -/** - * @return {string} - * @private - */ -ol.layer.Heatmap.prototype.createCircle_ = function() { - var radius = this.getRadius(); - var blur = this.getBlur(); - goog.asserts.assert(radius !== undefined && blur !== undefined, - 'radius and blur should be defined'); - var halfSize = radius + blur + 1; - var size = 2 * halfSize; - var context = ol.dom.createCanvasContext2D(size, size); - context.shadowOffsetX = context.shadowOffsetY = this.shadow_; - context.shadowBlur = blur; - context.shadowColor = '#000'; - context.beginPath(); - var center = halfSize - this.shadow_; - context.arc(center, center, radius, 0, Math.PI * 2, true); - context.fill(); - return context.canvas.toDataURL(); -}; - - -/** - * Return the blur size in pixels. - * @return {number} Blur size in pixels. - * @api - * @observable - */ -ol.layer.Heatmap.prototype.getBlur = function() { - return /** @type {number} */ (this.get(ol.layer.HeatmapLayerProperty.BLUR)); -}; - - -/** - * Return the gradient colors as array of strings. - * @return {Array.<string>} Colors. - * @api - * @observable - */ -ol.layer.Heatmap.prototype.getGradient = function() { - return /** @type {Array.<string>} */ ( - this.get(ol.layer.HeatmapLayerProperty.GRADIENT)); -}; - - -/** - * Return the size of the radius in pixels. - * @return {number} Radius size in pixel. - * @api - * @observable - */ -ol.layer.Heatmap.prototype.getRadius = function() { - return /** @type {number} */ (this.get(ol.layer.HeatmapLayerProperty.RADIUS)); -}; - - -/** - * @private - */ -ol.layer.Heatmap.prototype.handleGradientChanged_ = function() { - this.gradient_ = ol.layer.Heatmap.createGradient_(this.getGradient()); -}; - - -/** - * @private - */ -ol.layer.Heatmap.prototype.handleStyleChanged_ = function() { - this.circleImage_ = this.createCircle_(); - this.styleCache_ = new Array(256); - this.changed(); -}; - - -/** - * @param {ol.render.Event} event Post compose event - * @private - */ -ol.layer.Heatmap.prototype.handleRender_ = function(event) { - goog.asserts.assert(event.type == ol.render.EventType.RENDER, - 'event.type should be RENDER'); - goog.asserts.assert(this.gradient_, 'this.gradient_ expected'); - var context = event.context; - var canvas = context.canvas; - var image = context.getImageData(0, 0, canvas.width, canvas.height); - var view8 = image.data; - var i, ii, alpha; - for (i = 0, ii = view8.length; i < ii; i += 4) { - alpha = view8[i + 3] * 4; - if (alpha) { - view8[i] = this.gradient_[alpha]; - view8[i + 1] = this.gradient_[alpha + 1]; - view8[i + 2] = this.gradient_[alpha + 2]; - } - } - context.putImageData(image, 0, 0); -}; - - -/** - * Set the blur size in pixels. - * @param {number} blur Blur size in pixels. - * @api - * @observable - */ -ol.layer.Heatmap.prototype.setBlur = function(blur) { - this.set(ol.layer.HeatmapLayerProperty.BLUR, blur); -}; - - -/** - * Set the gradient colors as array of strings. - * @param {Array.<string>} colors Gradient. - * @api - * @observable - */ -ol.layer.Heatmap.prototype.setGradient = function(colors) { - this.set(ol.layer.HeatmapLayerProperty.GRADIENT, colors); -}; - - -/** - * Set the size of the radius in pixels. - * @param {number} radius Radius size in pixel. - * @api - * @observable - */ -ol.layer.Heatmap.prototype.setRadius = function(radius) { - this.set(ol.layer.HeatmapLayerProperty.RADIUS, radius); -}; - -goog.provide('ol.raster.Operation'); -goog.provide('ol.raster.OperationType'); - - -/** - * Raster operation type. Supported values are `'pixel'` and `'image'`. - * @enum {string} - * @api - */ -ol.raster.OperationType = { - PIXEL: 'pixel', - IMAGE: 'image' -}; - - -/** - * A function that takes an array of input data, performs some operation, and - * returns an array of ouput data. For `'pixel'` type operations, functions - * will be called with an array of {@link ol.raster.Pixel} data and should - * return an array of the same. For `'image'` type operations, functions will - * be called with an array of {@link ImageData - * https://developer.mozilla.org/en-US/docs/Web/API/ImageData} and should return - * an array of the same. The operations are called with a second "data" - * argument, which can be used for storage. The data object is accessible - * from raster events, where it can be initialized in "beforeoperations" and - * accessed again in "afteroperations". - * - * @typedef {function((Array.<ol.raster.Pixel>|Array.<ImageData>), Object): - * (Array.<ol.raster.Pixel>|Array.<ImageData>)} - * @api - */ -ol.raster.Operation; - -goog.provide('ol.raster.Pixel'); - - -/** - * An array of numbers representing pixel values. - * @typedef {Array.<number>} ol.raster.Pixel - * @api - */ -ol.raster.Pixel; - -goog.provide('ol.reproj.Tile'); -goog.provide('ol.reproj.TileFunctionType'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.math'); -goog.require('goog.object'); -goog.require('ol.Tile'); -goog.require('ol.TileState'); -goog.require('ol.extent'); -goog.require('ol.math'); -goog.require('ol.proj'); -goog.require('ol.reproj'); -goog.require('ol.reproj.Triangulation'); - - -/** - * @typedef {function(number, number, number, number) : ol.Tile} - */ -ol.reproj.TileFunctionType; - - - -/** - * @classdesc - * Class encapsulating single reprojected tile. - * See {@link ol.source.TileImage}. - * - * @constructor - * @extends {ol.Tile} - * @param {ol.proj.Projection} sourceProj Source projection. - * @param {ol.tilegrid.TileGrid} sourceTileGrid Source tile grid. - * @param {ol.proj.Projection} targetProj Target projection. - * @param {ol.tilegrid.TileGrid} targetTileGrid Target tile grid. - * @param {number} z Zoom level. - * @param {number} x X. - * @param {number} y Y. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.reproj.TileFunctionType} getTileFunction - * Function returning source tiles (z, x, y, pixelRatio). - * @param {number=} opt_errorThreshold Acceptable reprojection error (in px). - * @param {boolean=} opt_renderEdges Render reprojection edges. - */ -ol.reproj.Tile = function(sourceProj, sourceTileGrid, - targetProj, targetTileGrid, z, x, y, pixelRatio, getTileFunction, - opt_errorThreshold, - opt_renderEdges) { - goog.base(this, [z, x, y], ol.TileState.IDLE); - - /** - * @private - * @type {boolean} - */ - this.renderEdges_ = opt_renderEdges !== undefined ? opt_renderEdges : false; - - /** - * @private - * @type {number} - */ - this.pixelRatio_ = pixelRatio; - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = null; - - /** - * @private - * @type {Object.<number, HTMLCanvasElement>} - */ - this.canvasByContext_ = {}; - - /** - * @private - * @type {ol.tilegrid.TileGrid} - */ - this.sourceTileGrid_ = sourceTileGrid; - - /** - * @private - * @type {ol.tilegrid.TileGrid} - */ - this.targetTileGrid_ = targetTileGrid; - - /** - * @private - * @type {!Array.<ol.Tile>} - */ - this.sourceTiles_ = []; - - /** - * @private - * @type {Array.<goog.events.Key>} - */ - this.sourcesListenerKeys_ = null; - - /** - * @private - * @type {number} - */ - this.sourceZ_ = 0; - - var targetExtent = targetTileGrid.getTileCoordExtent(this.getTileCoord()); - var maxTargetExtent = this.targetTileGrid_.getExtent(); - var maxSourceExtent = this.sourceTileGrid_.getExtent(); - - var limitedTargetExtent = maxTargetExtent ? - ol.extent.getIntersection(targetExtent, maxTargetExtent) : targetExtent; - - if (ol.extent.getArea(limitedTargetExtent) === 0) { - // Tile is completely outside range -> EMPTY - // TODO: is it actually correct that the source even creates the tile ? - this.state = ol.TileState.EMPTY; - return; - } - - var sourceProjExtent = sourceProj.getExtent(); - if (sourceProjExtent) { - if (!maxSourceExtent) { - maxSourceExtent = sourceProjExtent; - } else { - maxSourceExtent = ol.extent.getIntersection( - maxSourceExtent, sourceProjExtent); - } - } - - var targetResolution = targetTileGrid.getResolution(z); - - var targetCenter = ol.extent.getCenter(limitedTargetExtent); - var sourceResolution = ol.reproj.calculateSourceResolution( - sourceProj, targetProj, targetCenter, targetResolution); - - if (!goog.math.isFiniteNumber(sourceResolution) || sourceResolution <= 0) { - // invalid sourceResolution -> EMPTY - // probably edges of the projections when no extent is defined - this.state = ol.TileState.EMPTY; - return; - } - - var errorThresholdInPixels = opt_errorThreshold !== undefined ? - opt_errorThreshold : ol.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD; - - /** - * @private - * @type {!ol.reproj.Triangulation} - */ - this.triangulation_ = new ol.reproj.Triangulation( - sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, - sourceResolution * errorThresholdInPixels); - - if (this.triangulation_.getTriangles().length === 0) { - // no valid triangles -> EMPTY - this.state = ol.TileState.EMPTY; - return; - } - - this.sourceZ_ = sourceTileGrid.getZForResolution(sourceResolution); - var sourceExtent = this.triangulation_.calculateSourceExtent(); - - if (maxSourceExtent) { - if (sourceProj.canWrapX()) { - sourceExtent[1] = ol.math.clamp( - sourceExtent[1], maxSourceExtent[1], maxSourceExtent[3]); - sourceExtent[3] = ol.math.clamp( - sourceExtent[3], maxSourceExtent[1], maxSourceExtent[3]); - } else { - sourceExtent = ol.extent.getIntersection(sourceExtent, maxSourceExtent); - } - } - - if (!ol.extent.getArea(sourceExtent)) { - this.state = ol.TileState.EMPTY; - } else { - var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ( - sourceExtent, this.sourceZ_); - - var tilesRequired = sourceRange.getWidth() * sourceRange.getHeight(); - if (!goog.asserts.assert( - tilesRequired < ol.RASTER_REPROJECTION_MAX_SOURCE_TILES, - 'reasonable number of tiles is required')) { - this.state = ol.TileState.ERROR; - return; - } - for (var srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) { - for (var srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) { - var tile = getTileFunction(this.sourceZ_, srcX, srcY, pixelRatio); - if (tile) { - this.sourceTiles_.push(tile); - } - } - } - - if (this.sourceTiles_.length === 0) { - this.state = ol.TileState.EMPTY; - } - } -}; -goog.inherits(ol.reproj.Tile, ol.Tile); - - -/** - * @inheritDoc - */ -ol.reproj.Tile.prototype.disposeInternal = function() { - if (this.state == ol.TileState.LOADING) { - this.unlistenSources_(); - } - goog.base(this, 'disposeInternal'); -}; - - -/** - * @inheritDoc - */ -ol.reproj.Tile.prototype.getImage = function(opt_context) { - if (opt_context !== undefined) { - var image; - var key = goog.getUid(opt_context); - if (key in this.canvasByContext_) { - return this.canvasByContext_[key]; - } else if (goog.object.isEmpty(this.canvasByContext_)) { - image = this.canvas_; - } else { - image = /** @type {HTMLCanvasElement} */ (this.canvas_.cloneNode(false)); - } - this.canvasByContext_[key] = image; - return image; - } else { - return this.canvas_; - } -}; - - -/** - * @private - */ -ol.reproj.Tile.prototype.reproject_ = function() { - var sources = []; - this.sourceTiles_.forEach(function(tile, i, arr) { - if (tile && tile.getState() == ol.TileState.LOADED) { - sources.push({ - extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord), - image: tile.getImage() - }); - } - }, this); - this.sourceTiles_.length = 0; - - var tileCoord = this.getTileCoord(); - var z = tileCoord[0]; - var size = this.targetTileGrid_.getTileSize(z); - var width = goog.isNumber(size) ? size : size[0]; - var height = goog.isNumber(size) ? size : size[1]; - var targetResolution = this.targetTileGrid_.getResolution(z); - var sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_); - - var targetExtent = this.targetTileGrid_.getTileCoordExtent(tileCoord); - this.canvas_ = ol.reproj.render(width, height, this.pixelRatio_, - sourceResolution, this.sourceTileGrid_.getExtent(), - targetResolution, targetExtent, this.triangulation_, sources, - this.renderEdges_); - - this.state = ol.TileState.LOADED; - this.changed(); -}; - - -/** - * @inheritDoc - */ -ol.reproj.Tile.prototype.load = function() { - if (this.state == ol.TileState.IDLE) { - this.state = ol.TileState.LOADING; - this.changed(); - - var leftToLoad = 0; - - goog.asserts.assert(!this.sourcesListenerKeys_, - 'this.sourcesListenerKeys_ should be null'); - - this.sourcesListenerKeys_ = []; - this.sourceTiles_.forEach(function(tile, i, arr) { - var state = tile.getState(); - if (state == ol.TileState.IDLE || state == ol.TileState.LOADING) { - leftToLoad++; - - var sourceListenKey; - sourceListenKey = tile.listen(goog.events.EventType.CHANGE, - function(e) { - var state = tile.getState(); - if (state == ol.TileState.LOADED || - state == ol.TileState.ERROR || - state == ol.TileState.EMPTY) { - goog.events.unlistenByKey(sourceListenKey); - leftToLoad--; - goog.asserts.assert(leftToLoad >= 0, - 'leftToLoad should not be negative'); - if (leftToLoad === 0) { - this.unlistenSources_(); - this.reproject_(); - } - } - }, false, this); - this.sourcesListenerKeys_.push(sourceListenKey); - } - }, this); - - this.sourceTiles_.forEach(function(tile, i, arr) { - var state = tile.getState(); - if (state == ol.TileState.IDLE) { - tile.load(); - } - }); - - if (leftToLoad === 0) { - this.reproject_(); - } - } -}; - - -/** - * @private - */ -ol.reproj.Tile.prototype.unlistenSources_ = function() { - goog.asserts.assert(this.sourcesListenerKeys_, - 'this.sourcesListenerKeys_ should not be null'); - this.sourcesListenerKeys_.forEach(goog.events.unlistenByKey); - this.sourcesListenerKeys_ = null; -}; - -// Copyright 2011 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview A utility to load JavaScript files via DOM script tags. - * Refactored from goog.net.Jsonp. Works cross-domain. - * - */ - -goog.provide('goog.net.jsloader'); -goog.provide('goog.net.jsloader.Error'); -goog.provide('goog.net.jsloader.ErrorCode'); -goog.provide('goog.net.jsloader.Options'); - -goog.require('goog.array'); -goog.require('goog.async.Deferred'); -goog.require('goog.debug.Error'); -goog.require('goog.dom'); -goog.require('goog.dom.TagName'); -goog.require('goog.object'); - - -/** - * The name of the property of goog.global under which the JavaScript - * verification object is stored by the loaded script. - * @private {string} - */ -goog.net.jsloader.GLOBAL_VERIFY_OBJS_ = 'closure_verification'; - - -/** - * The default length of time, in milliseconds, we are prepared to wait for a - * load request to complete. - * @type {number} - */ -goog.net.jsloader.DEFAULT_TIMEOUT = 5000; - - -/** - * Optional parameters for goog.net.jsloader.send. - * timeout: The length of time, in milliseconds, we are prepared to wait - * for a load request to complete. Default it 5 seconds. - * document: The HTML document under which to load the JavaScript. Default is - * the current document. - * cleanupWhenDone: If true clean up the script tag after script completes to - * load. This is important if you just want to read data from the JavaScript - * and then throw it away. Default is false. - * attributes: Additional attributes to set on the script tag. - * - * @typedef {{ - * timeout: (number|undefined), - * document: (HTMLDocument|undefined), - * cleanupWhenDone: (boolean|undefined), - * attributes: (!Object<string, string>|undefined) - * }} - */ -goog.net.jsloader.Options; - - -/** - * Scripts (URIs) waiting to be loaded. - * @private {!Array<string>} - */ -goog.net.jsloader.scriptsToLoad_ = []; - - -/** - * The deferred result of loading the URIs in scriptsToLoad_. - * We need to return this to a caller that wants to load URIs while - * a deferred is already working on them. - * @private {!goog.async.Deferred<null>} - */ -goog.net.jsloader.scriptLoadingDeferred_; - - -/** - * Loads and evaluates the JavaScript files at the specified URIs, guaranteeing - * the order of script loads. - * - * Because we have to load the scripts in serial (load script 1, exec script 1, - * load script 2, exec script 2, and so on), this will be slower than doing - * the network fetches in parallel. - * - * If you need to load a large number of scripts but dependency order doesn't - * matter, you should just call goog.net.jsloader.load N times. - * - * If you need to load a large number of scripts on the same domain, - * you may want to use goog.module.ModuleLoader. - * - * @param {Array<string>} uris The URIs to load. - * @param {goog.net.jsloader.Options=} opt_options Optional parameters. See - * goog.net.jsloader.options documentation for details. - * @return {!goog.async.Deferred} The deferred result, that may be used to add - * callbacks - */ -goog.net.jsloader.loadMany = function(uris, opt_options) { - // Loading the scripts in serial introduces asynchronosity into the flow. - // Therefore, there are race conditions where client A can kick off the load - // sequence for client B, even though client A's scripts haven't all been - // loaded yet. - // - // To work around this issue, all module loads share a queue. - if (!uris.length) { - return goog.async.Deferred.succeed(null); - } - - var isAnotherModuleLoading = goog.net.jsloader.scriptsToLoad_.length; - goog.array.extend(goog.net.jsloader.scriptsToLoad_, uris); - if (isAnotherModuleLoading) { - // jsloader is still loading some other scripts. - // In order to prevent the race condition noted above, we just add - // these URIs to the end of the scripts' queue and return the deferred - // result of the ongoing script load, so the caller knows when they - // finish loading. - return goog.net.jsloader.scriptLoadingDeferred_; - } - - uris = goog.net.jsloader.scriptsToLoad_; - var popAndLoadNextScript = function() { - var uri = uris.shift(); - var deferred = goog.net.jsloader.load(uri, opt_options); - if (uris.length) { - deferred.addBoth(popAndLoadNextScript); - } - return deferred; - }; - goog.net.jsloader.scriptLoadingDeferred_ = popAndLoadNextScript(); - return goog.net.jsloader.scriptLoadingDeferred_; -}; - - -/** - * Loads and evaluates a JavaScript file. - * When the script loads, a user callback is called. - * It is the client's responsibility to verify that the script ran successfully. - * - * @param {string} uri The URI of the JavaScript. - * @param {goog.net.jsloader.Options=} opt_options Optional parameters. See - * goog.net.jsloader.Options documentation for details. - * @return {!goog.async.Deferred} The deferred result, that may be used to add - * callbacks and/or cancel the transmission. - * The error callback will be called with a single goog.net.jsloader.Error - * parameter. - */ -goog.net.jsloader.load = function(uri, opt_options) { - var options = opt_options || {}; - var doc = options.document || document; - - var script = goog.dom.createElement(goog.dom.TagName.SCRIPT); - var request = {script_: script, timeout_: undefined}; - var deferred = new goog.async.Deferred(goog.net.jsloader.cancel_, request); - - // Set a timeout. - var timeout = null; - var timeoutDuration = goog.isDefAndNotNull(options.timeout) ? - options.timeout : goog.net.jsloader.DEFAULT_TIMEOUT; - if (timeoutDuration > 0) { - timeout = window.setTimeout(function() { - goog.net.jsloader.cleanup_(script, true); - deferred.errback(new goog.net.jsloader.Error( - goog.net.jsloader.ErrorCode.TIMEOUT, - 'Timeout reached for loading script ' + uri)); - }, timeoutDuration); - request.timeout_ = timeout; - } - - // Hang the user callback to be called when the script completes to load. - // NOTE(user): This callback will be called in IE even upon error. In any - // case it is the client's responsibility to verify that the script ran - // successfully. - script.onload = script.onreadystatechange = function() { - if (!script.readyState || script.readyState == 'loaded' || - script.readyState == 'complete') { - var removeScriptNode = options.cleanupWhenDone || false; - goog.net.jsloader.cleanup_(script, removeScriptNode, timeout); - deferred.callback(null); - } - }; - - // Add an error callback. - // NOTE(user): Not supported in IE. - script.onerror = function() { - goog.net.jsloader.cleanup_(script, true, timeout); - deferred.errback(new goog.net.jsloader.Error( - goog.net.jsloader.ErrorCode.LOAD_ERROR, - 'Error while loading script ' + uri)); - }; - - var properties = options.attributes || {}; - goog.object.extend(properties, { - 'type': 'text/javascript', - 'charset': 'UTF-8', - // NOTE(user): Safari never loads the script if we don't set - // the src attribute before appending. - 'src': uri - }); - goog.dom.setProperties(script, properties); - var scriptParent = goog.net.jsloader.getScriptParentElement_(doc); - scriptParent.appendChild(script); - - return deferred; -}; - - -/** - * Loads a JavaScript file and verifies it was evaluated successfully, using a - * verification object. - * The verification object is set by the loaded JavaScript at the end of the - * script. - * We verify this object was set and return its value in the success callback. - * If the object is not defined we trigger an error callback. - * - * @param {string} uri The URI of the JavaScript. - * @param {string} verificationObjName The name of the verification object that - * the loaded script should set. - * @param {goog.net.jsloader.Options} options Optional parameters. See - * goog.net.jsloader.Options documentation for details. - * @return {!goog.async.Deferred} The deferred result, that may be used to add - * callbacks and/or cancel the transmission. - * The success callback will be called with a single parameter containing - * the value of the verification object. - * The error callback will be called with a single goog.net.jsloader.Error - * parameter. - */ -goog.net.jsloader.loadAndVerify = function(uri, verificationObjName, options) { - // Define the global objects variable. - if (!goog.global[goog.net.jsloader.GLOBAL_VERIFY_OBJS_]) { - goog.global[goog.net.jsloader.GLOBAL_VERIFY_OBJS_] = {}; - } - var verifyObjs = goog.global[goog.net.jsloader.GLOBAL_VERIFY_OBJS_]; - - // Verify that the expected object does not exist yet. - if (goog.isDef(verifyObjs[verificationObjName])) { - // TODO(user): Error or reset variable? - return goog.async.Deferred.fail(new goog.net.jsloader.Error( - goog.net.jsloader.ErrorCode.VERIFY_OBJECT_ALREADY_EXISTS, - 'Verification object ' + verificationObjName + ' already defined.')); - } - - // Send request to load the JavaScript. - var sendDeferred = goog.net.jsloader.load(uri, options); - - // Create a deferred object wrapping the send result. - var deferred = new goog.async.Deferred( - goog.bind(sendDeferred.cancel, sendDeferred)); - - // Call user back with object that was set by the script. - sendDeferred.addCallback(function() { - var result = verifyObjs[verificationObjName]; - if (goog.isDef(result)) { - deferred.callback(result); - delete verifyObjs[verificationObjName]; - } else { - // Error: script was not loaded properly. - deferred.errback(new goog.net.jsloader.Error( - goog.net.jsloader.ErrorCode.VERIFY_ERROR, - 'Script ' + uri + ' loaded, but verification object ' + - verificationObjName + ' was not defined.')); - } - }); - - // Pass error to new deferred object. - sendDeferred.addErrback(function(error) { - if (goog.isDef(verifyObjs[verificationObjName])) { - delete verifyObjs[verificationObjName]; - } - deferred.errback(error); - }); - - return deferred; -}; - - -/** - * Gets the DOM element under which we should add new script elements. - * How? Take the first head element, and if not found take doc.documentElement, - * which always exists. - * - * @param {!HTMLDocument} doc The relevant document. - * @return {!Element} The script parent element. - * @private - */ -goog.net.jsloader.getScriptParentElement_ = function(doc) { - var headElements = doc.getElementsByTagName(goog.dom.TagName.HEAD); - if (!headElements || goog.array.isEmpty(headElements)) { - return doc.documentElement; - } else { - return headElements[0]; - } -}; - - -/** - * Cancels a given request. - * @this {{script_: Element, timeout_: number}} The request context. - * @private - */ -goog.net.jsloader.cancel_ = function() { - var request = this; - if (request && request.script_) { - var scriptNode = request.script_; - if (scriptNode && scriptNode.tagName == goog.dom.TagName.SCRIPT) { - goog.net.jsloader.cleanup_(scriptNode, true, request.timeout_); - } - } -}; - - -/** - * Removes the script node and the timeout. - * - * @param {Node} scriptNode The node to be cleaned up. - * @param {boolean} removeScriptNode If true completely remove the script node. - * @param {?number=} opt_timeout The timeout handler to cleanup. - * @private - */ -goog.net.jsloader.cleanup_ = function(scriptNode, removeScriptNode, - opt_timeout) { - if (goog.isDefAndNotNull(opt_timeout)) { - goog.global.clearTimeout(opt_timeout); - } - - scriptNode.onload = goog.nullFunction; - scriptNode.onerror = goog.nullFunction; - scriptNode.onreadystatechange = goog.nullFunction; - - // Do this after a delay (removing the script node of a running script can - // confuse older IEs). - if (removeScriptNode) { - window.setTimeout(function() { - goog.dom.removeNode(scriptNode); - }, 0); - } -}; - - -/** - * Possible error codes for jsloader. - * @enum {number} - */ -goog.net.jsloader.ErrorCode = { - LOAD_ERROR: 0, - TIMEOUT: 1, - VERIFY_ERROR: 2, - VERIFY_OBJECT_ALREADY_EXISTS: 3 -}; - - - -/** - * A jsloader error. - * - * @param {goog.net.jsloader.ErrorCode} code The error code. - * @param {string=} opt_message Additional message. - * @constructor - * @extends {goog.debug.Error} - * @final - */ -goog.net.jsloader.Error = function(code, opt_message) { - var msg = 'Jsloader error (code #' + code + ')'; - if (opt_message) { - msg += ': ' + opt_message; - } - goog.net.jsloader.Error.base(this, 'constructor', msg); - - /** - * The code for this error. - * - * @type {goog.net.jsloader.ErrorCode} - */ - this.code = code; -}; -goog.inherits(goog.net.jsloader.Error, goog.debug.Error); - -// Copyright 2006 The Closure Library Authors. All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// The original file lives here: http://go/cross_domain_channel.js - -/** - * @fileoverview Implements a cross-domain communication channel. A - * typical web page is prevented by browser security from sending - * request, such as a XMLHttpRequest, to other servers than the ones - * from which it came. The Jsonp class provides a workaround by - * using dynamically generated script tags. Typical usage:. - * - * var jsonp = new goog.net.Jsonp(new goog.Uri('http://my.host.com/servlet')); - * var payload = { 'foo': 1, 'bar': true }; - * jsonp.send(payload, function(reply) { alert(reply) }); - * - * This script works in all browsers that are currently supported by - * the Google Maps API, which is IE 6.0+, Firefox 0.8+, Safari 1.2.4+, - * Netscape 7.1+, Mozilla 1.4+, Opera 8.02+. - * - */ - -goog.provide('goog.net.Jsonp'); - -goog.require('goog.Uri'); -goog.require('goog.net.jsloader'); - -// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -// -// This class allows us (Google) to send data from non-Google and thus -// UNTRUSTED pages to our servers. Under NO CIRCUMSTANCES return -// anything sensitive, such as session or cookie specific data. Return -// only data that you want parties external to Google to have. Also -// NEVER use this method to send data from web pages to untrusted -// servers, or redirects to unknown servers (www.google.com/cache, -// /q=xx&btnl, /url, www.googlepages.com, etc.) -// -// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - - - -/** - * Creates a new cross domain channel that sends data to the specified - * host URL. By default, if no reply arrives within 5s, the channel - * assumes the call failed to complete successfully. - * - * @param {goog.Uri|string} uri The Uri of the server side code that receives - * data posted through this channel (e.g., - * "http://maps.google.com/maps/geo"). - * - * @param {string=} opt_callbackParamName The parameter name that is used to - * specify the callback. Defaults to "callback". - * - * @constructor - * @final - */ -goog.net.Jsonp = function(uri, opt_callbackParamName) { - /** - * The uri_ object will be used to encode the payload that is sent to the - * server. - * @type {goog.Uri} - * @private - */ - this.uri_ = new goog.Uri(uri); - - /** - * This is the callback parameter name that is added to the uri. - * @type {string} - * @private - */ - this.callbackParamName_ = opt_callbackParamName ? - opt_callbackParamName : 'callback'; - - /** - * The length of time, in milliseconds, this channel is prepared - * to wait for for a request to complete. The default value is 5 seconds. - * @type {number} - * @private - */ - this.timeout_ = 5000; -}; - - -/** - * The name of the property of goog.global under which the callback is - * stored. - */ -goog.net.Jsonp.CALLBACKS = '_callbacks_'; - - -/** - * Used to generate unique callback IDs. The counter must be global because - * all channels share a common callback object. - * @private - */ -goog.net.Jsonp.scriptCounter_ = 0; - - -/** - * Sets the length of time, in milliseconds, this channel is prepared - * to wait for for a request to complete. If the call is not competed - * within the set time span, it is assumed to have failed. To wait - * indefinitely for a request to complete set the timout to a negative - * number. - * - * @param {number} timeout The length of time before calls are - * interrupted. - */ -goog.net.Jsonp.prototype.setRequestTimeout = function(timeout) { - this.timeout_ = timeout; -}; - - -/** - * Returns the current timeout value, in milliseconds. - * - * @return {number} The timeout value. - */ -goog.net.Jsonp.prototype.getRequestTimeout = function() { - return this.timeout_; -}; - - -/** - * Sends the given payload to the URL specified at the construction - * time. The reply is delivered to the given replyCallback. If the - * errorCallback is specified and the reply does not arrive within the - * timeout period set on this channel, the errorCallback is invoked - * with the original payload. - * - * If no reply callback is specified, then the response is expected to - * consist of calls to globally registered functions. No &callback= - * URL parameter will be sent in the request, and the script element - * will be cleaned up after the timeout. - * - * @param {Object=} opt_payload Name-value pairs. If given, these will be - * added as parameters to the supplied URI as GET parameters to the - * given server URI. - * - * @param {Function=} opt_replyCallback A function expecting one - * argument, called when the reply arrives, with the response data. - * - * @param {Function=} opt_errorCallback A function expecting one - * argument, called on timeout, with the payload (if given), otherwise - * null. - * - * @param {string=} opt_callbackParamValue Value to be used as the - * parameter value for the callback parameter (callbackParamName). - * To be used when the value needs to be fixed by the client for a - * particular request, to make use of the cached responses for the request. - * NOTE: If multiple requests are made with the same - * opt_callbackParamValue, only the last call will work whenever the - * response comes back. - * - * @return {!Object} A request descriptor that may be used to cancel this - * transmission, or null, if the message may not be cancelled. - */ -goog.net.Jsonp.prototype.send = function(opt_payload, - opt_replyCallback, - opt_errorCallback, - opt_callbackParamValue) { - - var payload = opt_payload || null; - - var id = opt_callbackParamValue || - '_' + (goog.net.Jsonp.scriptCounter_++).toString(36) + - goog.now().toString(36); - - if (!goog.global[goog.net.Jsonp.CALLBACKS]) { - goog.global[goog.net.Jsonp.CALLBACKS] = {}; - } - - // Create a new Uri object onto which this payload will be added - var uri = this.uri_.clone(); - if (payload) { - goog.net.Jsonp.addPayloadToUri_(payload, uri); - } - - if (opt_replyCallback) { - var reply = goog.net.Jsonp.newReplyHandler_(id, opt_replyCallback); - goog.global[goog.net.Jsonp.CALLBACKS][id] = reply; - - uri.setParameterValues(this.callbackParamName_, - goog.net.Jsonp.CALLBACKS + '.' + id); - } - - var deferred = goog.net.jsloader.load(uri.toString(), - {timeout: this.timeout_, cleanupWhenDone: true}); - var error = goog.net.Jsonp.newErrorHandler_(id, payload, opt_errorCallback); - deferred.addErrback(error); - - return {id_: id, deferred_: deferred}; -}; - - -/** - * Cancels a given request. The request must be exactly the object returned by - * the send method. - * - * @param {Object} request The request object returned by the send method. - */ -goog.net.Jsonp.prototype.cancel = function(request) { - if (request) { - if (request.deferred_) { - request.deferred_.cancel(); - } - if (request.id_) { - goog.net.Jsonp.cleanup_(request.id_, false); - } - } -}; - - -/** - * Creates a timeout callback that calls the given timeoutCallback with the - * original payload. - * - * @param {string} id The id of the script node. - * @param {Object} payload The payload that was sent to the server. - * @param {Function=} opt_errorCallback The function called on timeout. - * @return {!Function} A zero argument function that handles callback duties. - * @private - */ -goog.net.Jsonp.newErrorHandler_ = function(id, - payload, - opt_errorCallback) { - /** - * When we call across domains with a request, this function is the - * timeout handler. Once it's done executing the user-specified - * error-handler, it removes the script node and original function. - */ - return function() { - goog.net.Jsonp.cleanup_(id, false); - if (opt_errorCallback) { - opt_errorCallback(payload); - } - }; -}; - - -/** - * Creates a reply callback that calls the given replyCallback with data - * returned by the server. - * - * @param {string} id The id of the script node. - * @param {Function} replyCallback The function called on reply. - * @return {!Function} A reply callback function. - * @private - */ -goog.net.Jsonp.newReplyHandler_ = function(id, replyCallback) { - /** - * This function is the handler for the all-is-well response. It - * clears the error timeout handler, calls the user's handler, then - * removes the script node and itself. - * - * @param {...Object} var_args The response data sent from the server. - */ - var handler = function(var_args) { - goog.net.Jsonp.cleanup_(id, true); - replyCallback.apply(undefined, arguments); - }; - return handler; -}; - - -/** - * Removes the script node and reply handler with the given id. - * - * @param {string} id The id of the script node to be removed. - * @param {boolean} deleteReplyHandler If true, delete the reply handler - * instead of setting it to nullFunction (if we know the callback could - * never be called again). - * @private - */ -goog.net.Jsonp.cleanup_ = function(id, deleteReplyHandler) { - if (goog.global[goog.net.Jsonp.CALLBACKS][id]) { - if (deleteReplyHandler) { - delete goog.global[goog.net.Jsonp.CALLBACKS][id]; - } else { - // Removing the script tag doesn't necessarily prevent the script - // from firing, so we make the callback a noop. - goog.global[goog.net.Jsonp.CALLBACKS][id] = goog.nullFunction; - } - } -}; - - -/** - * Returns URL encoded payload. The payload should be a map of name-value - * pairs, in the form {"foo": 1, "bar": true, ...}. If the map is empty, - * the URI will be unchanged. - * - * <p>The method uses hasOwnProperty() to assure the properties are on the - * object, not on its prototype. - * - * @param {!Object} payload A map of value name pairs to be encoded. - * A value may be specified as an array, in which case a query parameter - * will be created for each value, e.g.: - * {"foo": [1,2]} will encode to "foo=1&foo=2". - * - * @param {!goog.Uri} uri A Uri object onto which the payload key value pairs - * will be encoded. - * - * @return {!goog.Uri} A reference to the Uri sent as a parameter. - * @private - */ -goog.net.Jsonp.addPayloadToUri_ = function(payload, uri) { - for (var name in payload) { - // NOTE(user): Safari/1.3 doesn't have hasOwnProperty(). In that - // case, we iterate over all properties as a very lame workaround. - if (!payload.hasOwnProperty || payload.hasOwnProperty(name)) { - uri.setParameterValues(name, payload[name]); - } - } - return uri; -}; - - -// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -// -// This class allows us (Google) to send data from non-Google and thus -// UNTRUSTED pages to our servers. Under NO CIRCUMSTANCES return -// anything sensitive, such as session or cookie specific data. Return -// only data that you want parties external to Google to have. Also -// NEVER use this method to send data from web pages to untrusted -// servers, or redirects to unknown servers (www.google.com/cache, -// /q=xx&btnl, /url, www.googlepages.com, etc.) -// -// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - -goog.provide('ol.source.TileImage'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol.ImageTile'); -goog.require('ol.TileCache'); -goog.require('ol.TileState'); -goog.require('ol.proj'); -goog.require('ol.reproj.Tile'); -goog.require('ol.source.UrlTile'); - - - -/** - * @classdesc - * Base class for sources providing images divided into a tile grid. - * - * @constructor - * @fires ol.source.TileEvent - * @extends {ol.source.UrlTile} - * @param {olx.source.TileImageOptions} options Image tile options. - * @api - */ -ol.source.TileImage = function(options) { - - goog.base(this, { - attributions: options.attributions, - extent: options.extent, - logo: options.logo, - opaque: options.opaque, - projection: options.projection, - state: options.state !== undefined ? - /** @type {ol.source.State} */ (options.state) : undefined, - tileGrid: options.tileGrid, - tileLoadFunction: options.tileLoadFunction ? - options.tileLoadFunction : ol.source.TileImage.defaultTileLoadFunction, - tilePixelRatio: options.tilePixelRatio, - tileUrlFunction: options.tileUrlFunction, - url: options.url, - urls: options.urls, - wrapX: options.wrapX - }); - - /** - * @protected - * @type {?string} - */ - this.crossOrigin = - options.crossOrigin !== undefined ? options.crossOrigin : null; - - /** - * @protected - * @type {function(new: ol.ImageTile, ol.TileCoord, ol.TileState, string, - * ?string, ol.TileLoadFunctionType)} - */ - this.tileClass = options.tileClass !== undefined ? - options.tileClass : ol.ImageTile; - - /** - * @protected - * @type {Object.<string, ol.TileCache>} - */ - this.tileCacheForProjection = {}; - - /** - * @protected - * @type {Object.<string, ol.tilegrid.TileGrid>} - */ - this.tileGridForProjection = {}; - - /** - * @private - * @type {number|undefined} - */ - this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold; - - /** - * @private - * @type {boolean} - */ - this.renderReprojectionEdges_ = false; -}; -goog.inherits(ol.source.TileImage, ol.source.UrlTile); - - -/** - * @inheritDoc - */ -ol.source.TileImage.prototype.canExpireCache = function() { - if (!ol.ENABLE_RASTER_REPROJECTION) { - return goog.base(this, 'canExpireCache'); - } - var canExpire = this.tileCache.canExpireCache(); - if (canExpire) { - return true; - } else { - return goog.object.some(this.tileCacheForProjection, function(tileCache) { - return tileCache.canExpireCache(); - }); - } -}; - - -/** - * @inheritDoc - */ -ol.source.TileImage.prototype.expireCache = function(projection, usedTiles) { - if (!ol.ENABLE_RASTER_REPROJECTION) { - goog.base(this, 'expireCache', projection, usedTiles); - return; - } - var usedTileCache = this.getTileCacheForProjection(projection); - - this.tileCache.expireCache(this.tileCache == usedTileCache ? usedTiles : {}); - goog.object.forEach(this.tileCacheForProjection, function(tileCache) { - tileCache.expireCache(tileCache == usedTileCache ? usedTiles : {}); - }); -}; - - -/** - * @inheritDoc - */ -ol.source.TileImage.prototype.getTileGridForProjection = function(projection) { - if (!ol.ENABLE_RASTER_REPROJECTION) { - return goog.base(this, 'getTileGridForProjection', projection); - } - var thisProj = this.getProjection(); - if (this.tileGrid && - (!thisProj || ol.proj.equivalent(thisProj, projection))) { - return this.tileGrid; - } else { - var projKey = goog.getUid(projection).toString(); - if (!(projKey in this.tileGridForProjection)) { - this.tileGridForProjection[projKey] = - ol.tilegrid.getForProjection(projection); - } - return this.tileGridForProjection[projKey]; - } -}; - - -/** - * @inheritDoc - */ -ol.source.TileImage.prototype.getTileCacheForProjection = function(projection) { - if (!ol.ENABLE_RASTER_REPROJECTION) { - return goog.base(this, 'getTileCacheForProjection', projection); - } - var thisProj = this.getProjection(); - if (!thisProj || ol.proj.equivalent(thisProj, projection)) { - return this.tileCache; - } else { - var projKey = goog.getUid(projection).toString(); - if (!(projKey in this.tileCacheForProjection)) { - this.tileCacheForProjection[projKey] = new ol.TileCache(); - } - return this.tileCacheForProjection[projKey]; - } -}; - - -/** - * @inheritDoc - */ -ol.source.TileImage.prototype.getTile = - function(z, x, y, pixelRatio, projection) { - if (!ol.ENABLE_RASTER_REPROJECTION || - !this.getProjection() || - !projection || - ol.proj.equivalent(this.getProjection(), projection)) { - return this.getTileInternal(z, x, y, pixelRatio, projection); - } else { - var cache = this.getTileCacheForProjection(projection); - var tileCoordKey = this.getKeyZXY(z, x, y); - if (cache.containsKey(tileCoordKey)) { - return /** @type {!ol.Tile} */(cache.get(tileCoordKey)); - } else { - var sourceProjection = this.getProjection(); - var sourceTileGrid = this.getTileGridForProjection(sourceProjection); - var targetTileGrid = this.getTileGridForProjection(projection); - var tile = new ol.reproj.Tile( - sourceProjection, sourceTileGrid, - projection, targetTileGrid, - z, x, y, this.getTilePixelRatio(), - goog.bind(function(z, x, y, pixelRatio) { - return this.getTileInternal(z, x, y, pixelRatio, sourceProjection); - }, this), this.reprojectionErrorThreshold_, - this.renderReprojectionEdges_); - - cache.set(tileCoordKey, tile); - return tile; - } - } -}; - - -/** - * @param {number} z Tile coordinate z. - * @param {number} x Tile coordinate x. - * @param {number} y Tile coordinate y. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {!ol.Tile} Tile. - * @protected - */ -ol.source.TileImage.prototype.getTileInternal = - function(z, x, y, pixelRatio, projection) { - var tileCoordKey = this.getKeyZXY(z, x, y); - if (this.tileCache.containsKey(tileCoordKey)) { - return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey)); - } else { - goog.asserts.assert(projection, 'argument projection is truthy'); - var tileCoord = [z, x, y]; - var urlTileCoord = this.getTileCoordForTileUrlFunction( - tileCoord, projection); - var tileUrl = !urlTileCoord ? undefined : - this.tileUrlFunction(urlTileCoord, pixelRatio, projection); - var tile = new this.tileClass( - tileCoord, - tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY, - tileUrl !== undefined ? tileUrl : '', - this.crossOrigin, - this.tileLoadFunction); - goog.events.listen(tile, goog.events.EventType.CHANGE, - this.handleTileChange, false, this); - - this.tileCache.set(tileCoordKey, tile); - return tile; - } -}; - - -/** - * Sets whether to render reprojection edges or not (usually for debugging). - * @param {boolean} render Render the edges. - * @api - */ -ol.source.TileImage.prototype.setRenderReprojectionEdges = function(render) { - if (!ol.ENABLE_RASTER_REPROJECTION || - this.renderReprojectionEdges_ == render) { - return; - } - this.renderReprojectionEdges_ = render; - goog.object.forEach(this.tileCacheForProjection, function(tileCache) { - tileCache.clear(); - }); - this.changed(); -}; - - -/** - * Sets the tile grid to use when reprojecting the tiles to the given - * projection instead of the default tile grid for the projection. - * - * This can be useful when the default tile grid cannot be created - * (e.g. projection has no extent defined) or - * for optimization reasons (custom tile size, resolutions, ...). - * - * @param {ol.proj.ProjectionLike} projection Projection. - * @param {ol.tilegrid.TileGrid} tilegrid Tile grid to use for the projection. - * @api - */ -ol.source.TileImage.prototype.setTileGridForProjection = - function(projection, tilegrid) { - if (ol.ENABLE_RASTER_REPROJECTION) { - var proj = ol.proj.get(projection); - if (proj) { - var projKey = goog.getUid(proj).toString(); - if (!(projKey in this.tileGridForProjection)) { - this.tileGridForProjection[projKey] = tilegrid; - } - } - } -}; - - -/** - * @param {ol.ImageTile} imageTile Image tile. - * @param {string} src Source. - */ -ol.source.TileImage.defaultTileLoadFunction = function(imageTile, src) { - imageTile.getImage().src = src; -}; - -goog.provide('ol.source.BingMaps'); - -goog.require('goog.Uri'); -goog.require('goog.asserts'); -goog.require('goog.net.Jsonp'); -goog.require('ol.Attribution'); -goog.require('ol.TileRange'); -goog.require('ol.TileUrlFunction'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.source.State'); -goog.require('ol.source.TileImage'); -goog.require('ol.tilecoord'); - - - -/** - * @classdesc - * Layer source for Bing Maps tile data. - * - * @constructor - * @extends {ol.source.TileImage} - * @param {olx.source.BingMapsOptions} options Bing Maps options. - * @api stable - */ -ol.source.BingMaps = function(options) { - - goog.base(this, { - crossOrigin: 'anonymous', - opaque: true, - projection: ol.proj.get('EPSG:3857'), - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - state: ol.source.State.LOADING, - tileLoadFunction: options.tileLoadFunction, - wrapX: options.wrapX !== undefined ? options.wrapX : true - }); - - /** - * @private - * @type {string} - */ - this.culture_ = options.culture !== undefined ? options.culture : 'en-us'; - - /** - * @private - * @type {number} - */ - this.maxZoom_ = options.maxZoom !== undefined ? options.maxZoom : -1; - - var uri = new goog.Uri( - 'https://dev.virtualearth.net/REST/v1/Imagery/Metadata/' + - options.imagerySet); - - var jsonp = new goog.net.Jsonp(uri, 'jsonp'); - jsonp.send({ - 'include': 'ImageryProviders', - 'uriScheme': 'https', - 'key': options.key - }, goog.bind(this.handleImageryMetadataResponse, this)); - -}; -goog.inherits(ol.source.BingMaps, ol.source.TileImage); - - -/** - * The attribution containing a link to the Microsoft® Bing™ Maps Platform APIs’ - * Terms Of Use. - * @const - * @type {ol.Attribution} - * @api - */ -ol.source.BingMaps.TOS_ATTRIBUTION = new ol.Attribution({ - html: '<a class="ol-attribution-bing-tos" ' + - 'href="http://www.microsoft.com/maps/product/terms.html">' + - 'Terms of Use</a>' -}); - - -/** - * @param {BingMapsImageryMetadataResponse} response Response. - */ -ol.source.BingMaps.prototype.handleImageryMetadataResponse = - function(response) { - - if (response.statusCode != 200 || - response.statusDescription != 'OK' || - response.authenticationResultCode != 'ValidCredentials' || - response.resourceSets.length != 1 || - response.resourceSets[0].resources.length != 1) { - this.setState(ol.source.State.ERROR); - return; - } - - var brandLogoUri = response.brandLogoUri; - if (brandLogoUri.indexOf('https') == -1) { - brandLogoUri = brandLogoUri.replace('http', 'https'); - } - //var copyright = response.copyright; // FIXME do we need to display this? - var resource = response.resourceSets[0].resources[0]; - goog.asserts.assert(resource.imageWidth == resource.imageHeight, - 'resource has imageWidth equal to imageHeight, i.e. is square'); - var maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_; - - var sourceProjection = this.getProjection(); - var extent = ol.tilegrid.extentFromProjection(sourceProjection); - var tileSize = resource.imageWidth == resource.imageHeight ? - resource.imageWidth : [resource.imageWidth, resource.imageHeight]; - var tileGrid = ol.tilegrid.createXYZ({ - extent: extent, - minZoom: resource.zoomMin, - maxZoom: maxZoom, - tileSize: tileSize - }); - this.tileGrid = tileGrid; - - var culture = this.culture_; - this.tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions( - resource.imageUrlSubdomains.map(function(subdomain) { - var quadKeyTileCoord = [0, 0, 0]; - var imageUrl = resource.imageUrl - .replace('{subdomain}', subdomain) - .replace('{culture}', culture); - return ( - /** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} Tile URL. - */ - function(tileCoord, pixelRatio, projection) { - goog.asserts.assert(ol.proj.equivalent( - projection, sourceProjection), - 'projections are equivalent'); - if (!tileCoord) { - return undefined; - } else { - ol.tilecoord.createOrUpdate(tileCoord[0], tileCoord[1], - -tileCoord[2] - 1, quadKeyTileCoord); - return imageUrl.replace('{quadkey}', ol.tilecoord.quadKey( - quadKeyTileCoord)); - } - }); - })); - - if (resource.imageryProviders) { - var transform = ol.proj.getTransformFromProjections( - ol.proj.get('EPSG:4326'), this.getProjection()); - - var attributions = resource.imageryProviders.map(function(imageryProvider) { - var html = imageryProvider.attribution; - /** @type {Object.<string, Array.<ol.TileRange>>} */ - var tileRanges = {}; - imageryProvider.coverageAreas.forEach(function(coverageArea) { - var minZ = coverageArea.zoomMin; - var maxZ = Math.min(coverageArea.zoomMax, maxZoom); - var bbox = coverageArea.bbox; - var epsg4326Extent = [bbox[1], bbox[0], bbox[3], bbox[2]]; - var extent = ol.extent.applyTransform(epsg4326Extent, transform); - var tileRange, z, zKey; - for (z = minZ; z <= maxZ; ++z) { - zKey = z.toString(); - tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); - if (zKey in tileRanges) { - tileRanges[zKey].push(tileRange); - } else { - tileRanges[zKey] = [tileRange]; - } - } - }); - return new ol.Attribution({html: html, tileRanges: tileRanges}); - }); - attributions.push(ol.source.BingMaps.TOS_ATTRIBUTION); - this.setAttributions(attributions); - } - - this.setLogo(brandLogoUri); - - this.setState(ol.source.State.READY); - -}; - -// FIXME keep cluster cache by resolution ? -// FIXME distance not respected because of the centroid - -goog.provide('ol.source.Cluster'); - -goog.require('goog.asserts'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('ol.Feature'); -goog.require('ol.coordinate'); -goog.require('ol.extent'); -goog.require('ol.geom.Point'); -goog.require('ol.source.Vector'); - - - -/** - * @classdesc - * Layer source to cluster vector data. - * - * @constructor - * @param {olx.source.ClusterOptions} options - * @extends {ol.source.Vector} - * @api - */ -ol.source.Cluster = function(options) { - goog.base(this, { - attributions: options.attributions, - extent: options.extent, - logo: options.logo, - projection: options.projection, - wrapX: options.wrapX - }); - - /** - * @type {number|undefined} - * @private - */ - this.resolution_ = undefined; - - /** - * @type {number} - * @private - */ - this.distance_ = options.distance !== undefined ? options.distance : 20; - - /** - * @type {Array.<ol.Feature>} - * @private - */ - this.features_ = []; - - /** - * @type {ol.source.Vector} - * @private - */ - this.source_ = options.source; - - this.source_.on(goog.events.EventType.CHANGE, - ol.source.Cluster.prototype.onSourceChange_, this); -}; -goog.inherits(ol.source.Cluster, ol.source.Vector); - - -/** - * Get a reference to the wrapped source. - * @return {ol.source.Vector} Source. - * @api - */ -ol.source.Cluster.prototype.getSource = function() { - return this.source_; -}; - - -/** - * @inheritDoc - */ -ol.source.Cluster.prototype.loadFeatures = function(extent, resolution, - projection) { - this.source_.loadFeatures(extent, resolution, projection); - if (resolution !== this.resolution_) { - this.clear(); - this.resolution_ = resolution; - this.cluster_(); - this.addFeatures(this.features_); - } -}; - - -/** - * handle the source changing - * @private - */ -ol.source.Cluster.prototype.onSourceChange_ = function() { - this.clear(); - this.cluster_(); - this.addFeatures(this.features_); - this.changed(); -}; - - -/** - * @private - */ -ol.source.Cluster.prototype.cluster_ = function() { - if (this.resolution_ === undefined) { - return; - } - this.features_.length = 0; - var extent = ol.extent.createEmpty(); - var mapDistance = this.distance_ * this.resolution_; - var features = this.source_.getFeatures(); - - /** - * @type {Object.<string, boolean>} - */ - var clustered = {}; - - for (var i = 0, ii = features.length; i < ii; i++) { - var feature = features[i]; - if (!goog.object.containsKey(clustered, goog.getUid(feature).toString())) { - var geometry = feature.getGeometry(); - goog.asserts.assert(geometry instanceof ol.geom.Point, - 'feature geometry is a ol.geom.Point instance'); - var coordinates = geometry.getCoordinates(); - ol.extent.createOrUpdateFromCoordinate(coordinates, extent); - ol.extent.buffer(extent, mapDistance, extent); - - var neighbors = this.source_.getFeaturesInExtent(extent); - goog.asserts.assert(neighbors.length >= 1, 'at least one neighbor found'); - neighbors = neighbors.filter(function(neighbor) { - var uid = goog.getUid(neighbor).toString(); - if (!goog.object.containsKey(clustered, uid)) { - clustered[uid] = true; - return true; - } else { - return false; - } - }); - this.features_.push(this.createCluster_(neighbors)); - } - } - goog.asserts.assert( - goog.object.getCount(clustered) == this.source_.getFeatures().length, - 'number of clustered equals number of features in the source'); -}; - - -/** - * @param {Array.<ol.Feature>} features Features - * @return {ol.Feature} - * @private - */ -ol.source.Cluster.prototype.createCluster_ = function(features) { - var length = features.length; - var centroid = [0, 0]; - for (var i = 0; i < length; i++) { - var geometry = features[i].getGeometry(); - goog.asserts.assert(geometry instanceof ol.geom.Point, - 'feature geometry is a ol.geom.Point instance'); - var coordinates = geometry.getCoordinates(); - ol.coordinate.add(centroid, coordinates); - } - ol.coordinate.scale(centroid, 1 / length); - - var cluster = new ol.Feature(new ol.geom.Point(centroid)); - cluster.set('features', features); - return cluster; -}; - -goog.provide('ol.source.ImageMapGuide'); - -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('goog.uri.utils'); -goog.require('ol.Image'); -goog.require('ol.ImageLoadFunctionType'); -goog.require('ol.ImageUrlFunction'); -goog.require('ol.extent'); -goog.require('ol.source.Image'); - - - -/** - * @classdesc - * Source for images from Mapguide servers - * - * @constructor - * @fires ol.source.ImageEvent - * @extends {ol.source.Image} - * @param {olx.source.ImageMapGuideOptions} options Options. - * @api stable - */ -ol.source.ImageMapGuide = function(options) { - - goog.base(this, { - projection: options.projection, - resolutions: options.resolutions - }); - - /** - * @private - * @type {?string} - */ - this.crossOrigin_ = - options.crossOrigin !== undefined ? options.crossOrigin : null; - - /** - * @private - * @type {number} - */ - this.displayDpi_ = options.displayDpi !== undefined ? - options.displayDpi : 96; - - /** - * @private - * @type {Object} - */ - this.params_ = options.params !== undefined ? options.params : {}; - - var imageUrlFunction; - if (options.url !== undefined) { - imageUrlFunction = ol.ImageUrlFunction.createFromParamsFunction( - options.url, this.params_, goog.bind(this.getUrl, this)); - } else { - imageUrlFunction = ol.ImageUrlFunction.nullImageUrlFunction; - } - - /** - * @private - * @type {ol.ImageUrlFunctionType} - */ - this.imageUrlFunction_ = imageUrlFunction; - - /** - * @private - * @type {ol.ImageLoadFunctionType} - */ - this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction; - - /** - * @private - * @type {boolean} - */ - this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true; - - /** - * @private - * @type {number} - */ - this.metersPerUnit_ = options.metersPerUnit !== undefined ? - options.metersPerUnit : 1; - - /** - * @private - * @type {number} - */ - this.ratio_ = options.ratio !== undefined ? options.ratio : 1; - - /** - * @private - * @type {boolean} - */ - this.useOverlay_ = options.useOverlay !== undefined ? - options.useOverlay : false; - - /** - * @private - * @type {ol.Image} - */ - this.image_ = null; - - /** - * @private - * @type {number} - */ - this.renderedRevision_ = 0; - -}; -goog.inherits(ol.source.ImageMapGuide, ol.source.Image); - - -/** - * Get the user-provided params, i.e. those passed to the constructor through - * the "params" option, and possibly updated using the updateParams method. - * @return {Object} Params. - * @api stable - */ -ol.source.ImageMapGuide.prototype.getParams = function() { - return this.params_; -}; - - -/** - * @inheritDoc - */ -ol.source.ImageMapGuide.prototype.getImageInternal = - function(extent, resolution, pixelRatio, projection) { - resolution = this.findNearestResolution(resolution); - pixelRatio = this.hidpi_ ? pixelRatio : 1; - - var image = this.image_; - if (image && - this.renderedRevision_ == this.getRevision() && - image.getResolution() == resolution && - image.getPixelRatio() == pixelRatio && - ol.extent.containsExtent(image.getExtent(), extent)) { - return image; - } - - if (this.ratio_ != 1) { - extent = extent.slice(); - ol.extent.scaleFromCenter(extent, this.ratio_); - } - var width = ol.extent.getWidth(extent) / resolution; - var height = ol.extent.getHeight(extent) / resolution; - var size = [width * pixelRatio, height * pixelRatio]; - - var imageUrl = this.imageUrlFunction_(extent, size, projection); - if (imageUrl !== undefined) { - image = new ol.Image(extent, resolution, pixelRatio, - this.getAttributions(), imageUrl, this.crossOrigin_, - this.imageLoadFunction_); - goog.events.listen(image, goog.events.EventType.CHANGE, - this.handleImageChange, false, this); - } else { - image = null; - } - this.image_ = image; - this.renderedRevision_ = this.getRevision(); - - return image; -}; - - -/** - * Return the image load function of the source. - * @return {ol.ImageLoadFunctionType} The image load function. - * @api - */ -ol.source.ImageMapGuide.prototype.getImageLoadFunction = function() { - return this.imageLoadFunction_; -}; - - -/** - * @param {ol.Extent} extent The map extents. - * @param {ol.Size} size The viewport size. - * @param {number} metersPerUnit The meters-per-unit value. - * @param {number} dpi The display resolution. - * @return {number} The computed map scale. - */ -ol.source.ImageMapGuide.getScale = function(extent, size, metersPerUnit, dpi) { - var mcsW = ol.extent.getWidth(extent); - var mcsH = ol.extent.getHeight(extent); - var devW = size[0]; - var devH = size[1]; - var mpp = 0.0254 / dpi; - if (devH * mcsW > devW * mcsH) { - return mcsW * metersPerUnit / (devW * mpp); // width limited - } else { - return mcsH * metersPerUnit / (devH * mpp); // height limited - } -}; - - -/** - * Update the user-provided params. - * @param {Object} params Params. - * @api stable - */ -ol.source.ImageMapGuide.prototype.updateParams = function(params) { - goog.object.extend(this.params_, params); - this.changed(); -}; - - -/** - * @param {string} baseUrl The mapagent url. - * @param {Object.<string, string|number>} params Request parameters. - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Size. - * @param {ol.proj.Projection} projection Projection. - * @return {string} The mapagent map image request URL. - */ -ol.source.ImageMapGuide.prototype.getUrl = - function(baseUrl, params, extent, size, projection) { - var scale = ol.source.ImageMapGuide.getScale(extent, size, - this.metersPerUnit_, this.displayDpi_); - var center = ol.extent.getCenter(extent); - var baseParams = { - 'OPERATION': this.useOverlay_ ? 'GETDYNAMICMAPOVERLAYIMAGE' : 'GETMAPIMAGE', - 'VERSION': '2.0.0', - 'LOCALE': 'en', - 'CLIENTAGENT': 'ol.source.ImageMapGuide source', - 'CLIP': '1', - 'SETDISPLAYDPI': this.displayDpi_, - 'SETDISPLAYWIDTH': Math.round(size[0]), - 'SETDISPLAYHEIGHT': Math.round(size[1]), - 'SETVIEWSCALE': scale, - 'SETVIEWCENTERX': center[0], - 'SETVIEWCENTERY': center[1] - }; - goog.object.extend(baseParams, params); - return goog.uri.utils.appendParamsFromMap(baseUrl, baseParams); -}; - - -/** - * Set the image load function of the MapGuide source. - * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. - * @api - */ -ol.source.ImageMapGuide.prototype.setImageLoadFunction = function( - imageLoadFunction) { - this.image_ = null; - this.imageLoadFunction_ = imageLoadFunction; - this.changed(); -}; - -goog.provide('ol.source.ImageStatic'); - -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('ol.Image'); -goog.require('ol.ImageLoadFunctionType'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.source.Image'); - - - -/** - * @classdesc - * A layer source for displaying a single, static image. - * - * @constructor - * @extends {ol.source.Image} - * @param {olx.source.ImageStaticOptions} options Options. - * @api stable - */ -ol.source.ImageStatic = function(options) { - - var attributions = options.attributions !== undefined ? - options.attributions : null; - - var imageExtent = options.imageExtent; - - var resolution, resolutions; - if (options.imageSize !== undefined) { - resolution = ol.extent.getHeight(imageExtent) / options.imageSize[1]; - resolutions = [resolution]; - } - - var crossOrigin = options.crossOrigin !== undefined ? - options.crossOrigin : null; - - var /** @type {ol.ImageLoadFunctionType} */ imageLoadFunction = - options.imageLoadFunction !== undefined ? - options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction; - - goog.base(this, { - attributions: attributions, - logo: options.logo, - projection: ol.proj.get(options.projection), - resolutions: resolutions - }); - - /** - * @private - * @type {ol.Image} - */ - this.image_ = new ol.Image(imageExtent, resolution, 1, attributions, - options.url, crossOrigin, imageLoadFunction); - goog.events.listen(this.image_, goog.events.EventType.CHANGE, - this.handleImageChange, false, this); - -}; -goog.inherits(ol.source.ImageStatic, ol.source.Image); - - -/** - * @inheritDoc - */ -ol.source.ImageStatic.prototype.getImageInternal = - function(extent, resolution, pixelRatio, projection) { - if (ol.extent.intersects(extent, this.image_.getExtent())) { - return this.image_; - } - return null; -}; - -goog.provide('ol.source.wms'); -goog.provide('ol.source.wms.ServerType'); - - -/** - * Available server types: `'carmentaserver'`, `'geoserver'`, `'mapserver'`, - * `'qgis'`. These are servers that have vendor parameters beyond the WMS - * specification that OpenLayers can make use of. - * @enum {string} - * @api - */ -ol.source.wms.ServerType = { - CARMENTA_SERVER: 'carmentaserver', - GEOSERVER: 'geoserver', - MAPSERVER: 'mapserver', - QGIS: 'qgis' -}; - -// FIXME cannot be shared between maps with different projections - -goog.provide('ol.source.ImageWMS'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('goog.string'); -goog.require('goog.uri.utils'); -goog.require('ol'); -goog.require('ol.Image'); -goog.require('ol.ImageLoadFunctionType'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.source.Image'); -goog.require('ol.source.wms'); -goog.require('ol.source.wms.ServerType'); - - - -/** - * @classdesc - * Source for WMS servers providing single, untiled images. - * - * @constructor - * @fires ol.source.ImageEvent - * @extends {ol.source.Image} - * @param {olx.source.ImageWMSOptions=} opt_options Options. - * @api stable - */ -ol.source.ImageWMS = function(opt_options) { - - var options = opt_options || {}; - - goog.base(this, { - attributions: options.attributions, - logo: options.logo, - projection: options.projection, - resolutions: options.resolutions - }); - - /** - * @private - * @type {?string} - */ - this.crossOrigin_ = - options.crossOrigin !== undefined ? options.crossOrigin : null; - - /** - * @private - * @type {string|undefined} - */ - this.url_ = options.url; - - /** - * @private - * @type {ol.ImageLoadFunctionType} - */ - this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction; - - /** - * @private - * @type {Object} - */ - this.params_ = options.params; - - /** - * @private - * @type {boolean} - */ - this.v13_ = true; - this.updateV13_(); - - /** - * @private - * @type {ol.source.wms.ServerType|undefined} - */ - this.serverType_ = - /** @type {ol.source.wms.ServerType|undefined} */ (options.serverType); - - /** - * @private - * @type {boolean} - */ - this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true; - - /** - * @private - * @type {ol.Image} - */ - this.image_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.imageSize_ = [0, 0]; - - /** - * @private - * @type {number} - */ - this.renderedRevision_ = 0; - - /** - * @private - * @type {number} - */ - this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5; - -}; -goog.inherits(ol.source.ImageWMS, ol.source.Image); - - -/** - * @const - * @type {ol.Size} - * @private - */ -ol.source.ImageWMS.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101]; - - -/** - * Return the GetFeatureInfo URL for the passed coordinate, resolution, and - * projection. Return `undefined` if the GetFeatureInfo URL cannot be - * constructed. - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} resolution Resolution. - * @param {ol.proj.ProjectionLike} projection Projection. - * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should - * be provided. If `QUERY_LAYERS` is not provided then the layers specified - * in the `LAYERS` parameter will be used. `VERSION` should not be - * specified here. - * @return {string|undefined} GetFeatureInfo URL. - * @api stable - */ -ol.source.ImageWMS.prototype.getGetFeatureInfoUrl = - function(coordinate, resolution, projection, params) { - - goog.asserts.assert(!('VERSION' in params), - 'key VERSION is not allowed in params'); - - if (this.url_ === undefined) { - return undefined; - } - - var extent = ol.extent.getForViewAndSize( - coordinate, resolution, 0, - ol.source.ImageWMS.GETFEATUREINFO_IMAGE_SIZE_); - - var baseParams = { - 'SERVICE': 'WMS', - 'VERSION': ol.DEFAULT_WMS_VERSION, - 'REQUEST': 'GetFeatureInfo', - 'FORMAT': 'image/png', - 'TRANSPARENT': true, - 'QUERY_LAYERS': this.params_['LAYERS'] - }; - goog.object.extend(baseParams, this.params_, params); - - var x = Math.floor((coordinate[0] - extent[0]) / resolution); - var y = Math.floor((extent[3] - coordinate[1]) / resolution); - baseParams[this.v13_ ? 'I' : 'X'] = x; - baseParams[this.v13_ ? 'J' : 'Y'] = y; - - return this.getRequestUrl_( - extent, ol.source.ImageWMS.GETFEATUREINFO_IMAGE_SIZE_, - 1, ol.proj.get(projection), baseParams); -}; - - -/** - * Get the user-provided params, i.e. those passed to the constructor through - * the "params" option, and possibly updated using the updateParams method. - * @return {Object} Params. - * @api stable - */ -ol.source.ImageWMS.prototype.getParams = function() { - return this.params_; -}; - - -/** - * @inheritDoc - */ -ol.source.ImageWMS.prototype.getImageInternal = - function(extent, resolution, pixelRatio, projection) { - - if (this.url_ === undefined) { - return null; - } - - resolution = this.findNearestResolution(resolution); - - if (pixelRatio != 1 && (!this.hidpi_ || this.serverType_ === undefined)) { - pixelRatio = 1; - } - - extent = extent.slice(); - var centerX = (extent[0] + extent[2]) / 2; - var centerY = (extent[1] + extent[3]) / 2; - - var imageResolution = resolution / pixelRatio; - var imageWidth = ol.extent.getWidth(extent) / imageResolution; - var imageHeight = ol.extent.getHeight(extent) / imageResolution; - - var image = this.image_; - if (image && - this.renderedRevision_ == this.getRevision() && - image.getResolution() == resolution && - image.getPixelRatio() == pixelRatio && - ol.extent.containsExtent(image.getExtent(), extent)) { - return image; - } - - if (this.ratio_ != 1) { - var halfWidth = this.ratio_ * ol.extent.getWidth(extent) / 2; - var halfHeight = this.ratio_ * ol.extent.getHeight(extent) / 2; - extent[0] = centerX - halfWidth; - extent[1] = centerY - halfHeight; - extent[2] = centerX + halfWidth; - extent[3] = centerY + halfHeight; - } - - var params = { - 'SERVICE': 'WMS', - 'VERSION': ol.DEFAULT_WMS_VERSION, - 'REQUEST': 'GetMap', - 'FORMAT': 'image/png', - 'TRANSPARENT': true - }; - goog.object.extend(params, this.params_); - - this.imageSize_[0] = Math.ceil(imageWidth * this.ratio_); - this.imageSize_[1] = Math.ceil(imageHeight * this.ratio_); - - var url = this.getRequestUrl_(extent, this.imageSize_, pixelRatio, - projection, params); - - this.image_ = new ol.Image(extent, resolution, pixelRatio, - this.getAttributions(), url, this.crossOrigin_, this.imageLoadFunction_); - - this.renderedRevision_ = this.getRevision(); - - goog.events.listen(this.image_, goog.events.EventType.CHANGE, - this.handleImageChange, false, this); - - return this.image_; - -}; - - -/** - * Return the image load function of the source. - * @return {ol.ImageLoadFunctionType} The image load function. - * @api - */ -ol.source.ImageWMS.prototype.getImageLoadFunction = function() { - return this.imageLoadFunction_; -}; - - -/** - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Size. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @param {Object} params Params. - * @return {string} Request URL. - * @private - */ -ol.source.ImageWMS.prototype.getRequestUrl_ = - function(extent, size, pixelRatio, projection, params) { - - goog.asserts.assert(this.url_ !== undefined, 'url is defined'); - - params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode(); - - if (!('STYLES' in this.params_)) { - /* jshint -W053 */ - params['STYLES'] = new String(''); - /* jshint +W053 */ - } - - if (pixelRatio != 1) { - switch (this.serverType_) { - case ol.source.wms.ServerType.GEOSERVER: - var dpi = (90 * pixelRatio + 0.5) | 0; - if ('FORMAT_OPTIONS' in params) { - params['FORMAT_OPTIONS'] += ';dpi:' + dpi; - } else { - params['FORMAT_OPTIONS'] = 'dpi:' + dpi; - } - break; - case ol.source.wms.ServerType.MAPSERVER: - params['MAP_RESOLUTION'] = 90 * pixelRatio; - break; - case ol.source.wms.ServerType.CARMENTA_SERVER: - case ol.source.wms.ServerType.QGIS: - params['DPI'] = 90 * pixelRatio; - break; - default: - goog.asserts.fail('unknown serverType configured'); - break; - } - } - - params['WIDTH'] = size[0]; - params['HEIGHT'] = size[1]; - - var axisOrientation = projection.getAxisOrientation(); - var bbox; - if (this.v13_ && axisOrientation.substr(0, 2) == 'ne') { - bbox = [extent[1], extent[0], extent[3], extent[2]]; - } else { - bbox = extent; - } - params['BBOX'] = bbox.join(','); - - return goog.uri.utils.appendParamsFromMap(this.url_, params); -}; - - -/** - * Return the URL used for this WMS source. - * @return {string|undefined} URL. - * @api stable - */ -ol.source.ImageWMS.prototype.getUrl = function() { - return this.url_; -}; - - -/** - * Set the image load function of the source. - * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. - * @api - */ -ol.source.ImageWMS.prototype.setImageLoadFunction = function( - imageLoadFunction) { - this.image_ = null; - this.imageLoadFunction_ = imageLoadFunction; - this.changed(); -}; - - -/** - * Set the URL to use for requests. - * @param {string|undefined} url URL. - * @api stable - */ -ol.source.ImageWMS.prototype.setUrl = function(url) { - if (url != this.url_) { - this.url_ = url; - this.image_ = null; - this.changed(); - } -}; - - -/** - * Update the user-provided params. - * @param {Object} params Params. - * @api stable - */ -ol.source.ImageWMS.prototype.updateParams = function(params) { - goog.object.extend(this.params_, params); - this.updateV13_(); - this.image_ = null; - this.changed(); -}; - - -/** - * @private - */ -ol.source.ImageWMS.prototype.updateV13_ = function() { - var version = - goog.object.get(this.params_, 'VERSION', ol.DEFAULT_WMS_VERSION); - this.v13_ = goog.string.compareVersions(version, '1.3') >= 0; -}; - -goog.provide('ol.source.XYZ'); - -goog.require('ol.source.TileImage'); - - - -/** - * @classdesc - * Layer source for tile data with URLs in a set XYZ format that are - * defined in a URL template. By default, this follows the widely-used - * Google grid where `x` 0 and `y` 0 are in the top left. Grids like - * TMS where `x` 0 and `y` 0 are in the bottom left can be used by - * using the `{-y}` placeholder in the URL template, so long as the - * source does not have a custom tile grid. In this case, - * {@link ol.source.TileImage} can be used with a `tileUrlFunction` - * such as: - * - * tileUrlFunction: function(coordinate) { - * return 'http://mapserver.com/' + coordinate[0] + '/' + - * coordinate[1] + '/' + coordinate[2] + '.png'; - * } - * - * - * @constructor - * @extends {ol.source.TileImage} - * @param {olx.source.XYZOptions} options XYZ options. - * @api stable - */ -ol.source.XYZ = function(options) { - var projection = options.projection !== undefined ? - options.projection : 'EPSG:3857'; - - var tileGrid = options.tileGrid !== undefined ? options.tileGrid : - ol.tilegrid.createXYZ({ - extent: ol.tilegrid.extentFromProjection(projection), - maxZoom: options.maxZoom, - tileSize: options.tileSize - }); - - goog.base(this, { - attributions: options.attributions, - crossOrigin: options.crossOrigin, - logo: options.logo, - projection: projection, - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - tileGrid: tileGrid, - tileLoadFunction: options.tileLoadFunction, - tilePixelRatio: options.tilePixelRatio, - tileUrlFunction: options.tileUrlFunction, - url: options.url, - urls: options.urls, - wrapX: options.wrapX !== undefined ? options.wrapX : true - }); - -}; -goog.inherits(ol.source.XYZ, ol.source.TileImage); - -goog.provide('ol.source.OSM'); - -goog.require('ol.Attribution'); -goog.require('ol.source.XYZ'); - - - -/** - * @classdesc - * Layer source for the OpenStreetMap tile server. - * - * @constructor - * @extends {ol.source.XYZ} - * @param {olx.source.OSMOptions=} opt_options Open Street Map options. - * @api stable - */ -ol.source.OSM = function(opt_options) { - - var options = opt_options || {}; - - var attributions; - if (options.attributions !== undefined) { - attributions = options.attributions; - } else { - attributions = [ol.source.OSM.ATTRIBUTION]; - } - - var crossOrigin = options.crossOrigin !== undefined ? - options.crossOrigin : 'anonymous'; - - var url = options.url !== undefined ? - options.url : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'; - - goog.base(this, { - attributions: attributions, - crossOrigin: crossOrigin, - opaque: true, - maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19, - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - tileLoadFunction: options.tileLoadFunction, - url: url, - wrapX: options.wrapX - }); - -}; -goog.inherits(ol.source.OSM, ol.source.XYZ); - - -/** - * The attribution containing a link to the OpenStreetMap Copyright and License - * page. - * @const - * @type {ol.Attribution} - * @api - */ -ol.source.OSM.ATTRIBUTION = new ol.Attribution({ - html: '© ' + - '<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> ' + - 'contributors.' -}); - -goog.provide('ol.source.MapQuest'); - -goog.require('goog.asserts'); -goog.require('ol.Attribution'); -goog.require('ol.source.OSM'); -goog.require('ol.source.XYZ'); - - - -/** - * @classdesc - * Layer source for the MapQuest tile server. - * - * @constructor - * @extends {ol.source.XYZ} - * @param {olx.source.MapQuestOptions=} opt_options MapQuest options. - * @api stable - */ -ol.source.MapQuest = function(opt_options) { - - var options = opt_options || {}; - goog.asserts.assert(options.layer in ol.source.MapQuestConfig, - 'known layer configured'); - - var layerConfig = ol.source.MapQuestConfig[options.layer]; - - /** - * Layer. Possible values are `osm`, `sat`, and `hyb`. - * @type {string} - * @private - */ - this.layer_ = options.layer; - - var url = options.url !== undefined ? options.url : - 'https://otile{1-4}-s.mqcdn.com/tiles/1.0.0/' + - this.layer_ + '/{z}/{x}/{y}.jpg'; - - goog.base(this, { - attributions: layerConfig.attributions, - crossOrigin: 'anonymous', - logo: 'https://developer.mapquest.com/content/osm/mq_logo.png', - maxZoom: layerConfig.maxZoom, - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - opaque: true, - tileLoadFunction: options.tileLoadFunction, - url: url - }); - -}; -goog.inherits(ol.source.MapQuest, ol.source.XYZ); - - -/** - * @const - * @type {ol.Attribution} - */ -ol.source.MapQuest.TILE_ATTRIBUTION = new ol.Attribution({ - html: 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a>' -}); - - -/** - * @type {Object.<string, {maxZoom: number, attributions: (Array.<ol.Attribution>)}>} - */ -ol.source.MapQuestConfig = { - 'osm': { - maxZoom: 19, - attributions: [ - ol.source.MapQuest.TILE_ATTRIBUTION, - ol.source.OSM.ATTRIBUTION - ] - }, - 'sat': { - maxZoom: 18, - attributions: [ - ol.source.MapQuest.TILE_ATTRIBUTION, - new ol.Attribution({ - html: 'Portions Courtesy NASA/JPL-Caltech and ' + - 'U.S. Depart. of Agriculture, Farm Service Agency' - }) - ] - }, - 'hyb': { - maxZoom: 18, - attributions: [ - ol.source.MapQuest.TILE_ATTRIBUTION, - ol.source.OSM.ATTRIBUTION - ] - } -}; - - -/** - * Get the layer of the source, either `osm`, `sat`, or `hyb`. - * @return {string} Layer. - * @api - */ -ol.source.MapQuest.prototype.getLayer = function() { - return this.layer_; -}; - -goog.provide('ol.ext.pixelworks'); -/** @typedef {function(*)} */ -ol.ext.pixelworks; -(function() { -var exports = {}; -var module = {exports: exports}; -var define; -/** - * @fileoverview - * @suppress {accessControls, ambiguousFunctionDecl, checkDebuggerStatement, checkRegExp, checkTypes, checkVars, const, constantProperty, deprecated, duplicate, es5Strict, fileoverviewTags, missingProperties, nonStandardJsDocs, strictModuleDepCheck, suspiciousCode, undefinedNames, undefinedVars, unknownDefines, uselessCode, visibility} - */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pixelworks = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ -var Processor = _dereq_('./processor'); - -exports.Processor = Processor; - -},{"./processor":2}],2:[function(_dereq_,module,exports){ -/* eslint-disable dot-notation */ - -/** - * Create a function for running operations. - * @param {function(Array, Object):*} operation The operation. - * @return {function(Object):ArrayBuffer} A function that takes an object with - * buffers, meta, imageOps, width, and height properties and returns an array - * buffer. - */ -function createMinion(operation) { - return function(data) { - // bracket notation for minification support - var buffers = data['buffers']; - var meta = data['meta']; - var imageOps = data['imageOps']; - var width = data['width']; - var height = data['height']; - - var numBuffers = buffers.length; - var numBytes = buffers[0].byteLength; - var output, b; - - if (imageOps) { - var images = new Array(numBuffers); - for (b = 0; b < numBuffers; ++b) { - images[b] = new ImageData( - new Uint8ClampedArray(buffers[b]), width, height); - } - output = operation(images, meta).data; - } else { - output = new Uint8ClampedArray(numBytes); - var arrays = new Array(numBuffers); - var pixels = new Array(numBuffers); - for (b = 0; b < numBuffers; ++b) { - arrays[b] = new Uint8ClampedArray(buffers[b]); - pixels[b] = [0, 0, 0, 0]; - } - for (var i = 0; i < numBytes; i += 4) { - for (var j = 0; j < numBuffers; ++j) { - var array = arrays[j]; - pixels[j][0] = array[i]; - pixels[j][1] = array[i + 1]; - pixels[j][2] = array[i + 2]; - pixels[j][3] = array[i + 3]; - } - var pixel = operation(pixels, meta); - output[i] = pixel[0]; - output[i + 1] = pixel[1]; - output[i + 2] = pixel[2]; - output[i + 3] = pixel[3]; - } - } - return output.buffer; - }; -} - -/** - * Create a worker for running operations. - * @param {Object} config Configuration. - * @param {function(Object)} onMessage Called with a message event. - * @return {Worker} The worker. - */ -function createWorker(config, onMessage) { - var lib = Object.keys(config.lib || {}).map(function(name) { - return 'var ' + name + ' = ' + config.lib[name].toString() + ';'; - }); - - var lines = lib.concat([ - 'var __minion__ = (' + createMinion.toString() + ')(', - config.operation.toString(), - ');', - 'self.addEventListener("message", function(__event__) {', - 'var buffer = __minion__(__event__.data);', - 'self.postMessage({buffer: buffer, meta: __event__.data.meta}, [buffer]);', - '});' - ]); - - var blob = new Blob(lines, {type: 'text/javascript'}); - var source = URL.createObjectURL(blob); - var worker = new Worker(source); - worker.addEventListener('message', onMessage); - return worker; -} - -/** - * Create a faux worker for running operations. - * @param {Object} config Configuration. - * @param {function(Object)} onMessage Called with a message event. - * @return {Object} The faux worker. - */ -function createFauxWorker(config, onMessage) { - var minion = createMinion(config.operation); - return { - postMessage: function(data) { - setTimeout(function() { - onMessage({data: {buffer: minion(data), meta: data.meta}}); - }, 0); - } - }; -} - -/** - * A processor runs pixel or image operations in workers. - * @param {Object} config Configuration. - */ -function Processor(config) { - this._imageOps = !!config.imageOps; - var threads; - if (config.threads === 0) { - threads = 0; - } else if (this._imageOps) { - threads = 1; - } else { - threads = config.threads || 1; - } - var workers = []; - if (threads) { - for (var i = 0; i < threads; ++i) { - workers[i] = createWorker(config, this._onWorkerMessage.bind(this, i)); - } - } else { - workers[0] = createFauxWorker(config, this._onWorkerMessage.bind(this, 0)); - } - this._workers = workers; - this._queue = []; - this._maxQueueLength = config.queue || Infinity; - this._running = 0; - this._dataLookup = {}; - this._job = null; -} - -/** - * Run operation on input data. - * @param {Array.<Array|ImageData>} inputs Array of pixels or image data - * (depending on the operation type). - * @param {Object} meta A user data object. This is passed to all operations - * and must be serializable. - * @param {function(Error, ImageData, Object)} callback Called when work - * completes. The first argument is any error. The second is the ImageData - * generated by operations. The third is the user data object. - */ -Processor.prototype.process = function(inputs, meta, callback) { - this._enqueue({ - inputs: inputs, - meta: meta, - callback: callback - }); - this._dispatch(); -}; - -/** - * Stop responding to any completed work and destroy the processor. - */ -Processor.prototype.destroy = function() { - for (var key in this) { - this[key] = null; - } - this._destroyed = true; -}; - -/** - * Add a job to the queue. - * @param {Object} job The job. - */ -Processor.prototype._enqueue = function(job) { - this._queue.push(job); - while (this._queue.length > this._maxQueueLength) { - this._queue.shift().callback(null, null); - } -}; - -/** - * Dispatch a job. - */ -Processor.prototype._dispatch = function() { - if (this._running === 0 && this._queue.length > 0) { - var job = this._job = this._queue.shift(); - var width = job.inputs[0].width; - var height = job.inputs[0].height; - var buffers = job.inputs.map(function(input) { - return input.data.buffer; - }); - var threads = this._workers.length; - this._running = threads; - if (threads === 1) { - this._workers[0].postMessage({ - 'buffers': buffers, - 'meta': job.meta, - 'imageOps': this._imageOps, - 'width': width, - 'height': height - }, buffers); - } else { - var length = job.inputs[0].data.length; - var segmentLength = 4 * Math.ceil(length / 4 / threads); - for (var i = 0; i < threads; ++i) { - var offset = i * segmentLength; - var slices = []; - for (var j = 0, jj = buffers.length; j < jj; ++j) { - slices.push(buffers[i].slice(offset, offset + segmentLength)); - } - this._workers[i].postMessage({ - 'buffers': slices, - 'meta': job.meta, - 'imageOps': this._imageOps, - 'width': width, - 'height': height - }, slices); - } - } - } -}; - -/** - * Handle messages from the worker. - * @param {number} index The worker index. - * @param {Object} event The message event. - */ -Processor.prototype._onWorkerMessage = function(index, event) { - if (this._destroyed) { - return; - } - this._dataLookup[index] = event.data; - --this._running; - if (this._running === 0) { - this._resolveJob(); - } -}; - -/** - * Resolve a job. If there are no more worker threads, the processor callback - * will be called. - */ -Processor.prototype._resolveJob = function() { - var job = this._job; - var threads = this._workers.length; - var data, meta; - if (threads === 1) { - data = new Uint8ClampedArray(this._dataLookup[0]['buffer']); - meta = this._dataLookup[0]['meta']; - } else { - var length = job.inputs[0].data.length; - data = new Uint8ClampedArray(length); - meta = new Array(length); - var segmentLength = 4 * Math.ceil(length / 4 / threads); - for (var i = 0; i < threads; ++i) { - var buffer = this._dataLookup[i]['buffer']; - var offset = i * segmentLength; - data.set(new Uint8ClampedArray(buffer), offset); - meta[i] = this._dataLookup[i]['meta']; - } - } - this._job = null; - this._dataLookup = {}; - job.callback(null, - new ImageData(data, job.inputs[0].width, job.inputs[0].height), meta); - this._dispatch(); -}; - -module.exports = Processor; - -},{}]},{},[1])(1) -}); -ol.ext.pixelworks = module.exports; -})(); - -goog.provide('ol.source.Raster'); -goog.provide('ol.source.RasterEvent'); -goog.provide('ol.source.RasterEventType'); - -goog.require('goog.asserts'); -goog.require('goog.events'); -goog.require('goog.events.Event'); -goog.require('goog.events.EventType'); -goog.require('goog.object'); -goog.require('goog.vec.Mat4'); -goog.require('ol.ImageCanvas'); -goog.require('ol.TileQueue'); -goog.require('ol.dom'); -goog.require('ol.ext.pixelworks'); -goog.require('ol.extent'); -goog.require('ol.layer.Image'); -goog.require('ol.layer.Tile'); -goog.require('ol.raster.OperationType'); -goog.require('ol.renderer.canvas.ImageLayer'); -goog.require('ol.renderer.canvas.TileLayer'); -goog.require('ol.source.Image'); -goog.require('ol.source.State'); -goog.require('ol.source.Tile'); - - - -/** - * @classdesc - * A source that transforms data from any number of input sources using an array - * of {@link ol.raster.Operation} functions to transform input pixel values into - * output pixel values. - * - * @constructor - * @extends {ol.source.Image} - * @param {olx.source.RasterOptions} options Options. - * @api - */ -ol.source.Raster = function(options) { - - /** - * @private - * @type {*} - */ - this.worker_ = null; - - /** - * @private - * @type {ol.raster.OperationType} - */ - this.operationType_ = options.operationType !== undefined ? - options.operationType : ol.raster.OperationType.PIXEL; - - /** - * @private - * @type {number} - */ - this.threads_ = options.threads !== undefined ? options.threads : 1; - - /** - * @private - * @type {Array.<ol.renderer.canvas.Layer>} - */ - this.renderers_ = ol.source.Raster.createRenderers_(options.sources); - - for (var r = 0, rr = this.renderers_.length; r < rr; ++r) { - goog.events.listen(this.renderers_[r], goog.events.EventType.CHANGE, - this.changed, false, this); - } - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.canvasContext_ = ol.dom.createCanvasContext2D(); - - /** - * @private - * @type {ol.TileQueue} - */ - this.tileQueue_ = new ol.TileQueue( - function() { return 1; }, - goog.bind(this.changed, this)); - - var layerStatesArray = ol.source.Raster.getLayerStatesArray_(this.renderers_); - var layerStates = {}; - for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) { - layerStates[goog.getUid(layerStatesArray[i].layer)] = layerStatesArray[i]; - } - - /** - * The most recently rendered state. - * @type {?ol.source.Raster.RenderedState} - * @private - */ - this.renderedState_ = null; - - /** - * The most recently rendered image canvas. - * @type {ol.ImageCanvas} - * @private - */ - this.renderedImageCanvas_ = null; - - /** - * @private - * @type {olx.FrameState} - */ - this.frameState_ = { - animate: false, - attributions: {}, - coordinateToPixelMatrix: goog.vec.Mat4.createNumber(), - extent: null, - focus: null, - index: 0, - layerStates: layerStates, - layerStatesArray: layerStatesArray, - logos: {}, - pixelRatio: 1, - pixelToCoordinateMatrix: goog.vec.Mat4.createNumber(), - postRenderFunctions: [], - size: [0, 0], - skippedFeatureUids: {}, - tileQueue: this.tileQueue_, - time: Date.now(), - usedTiles: {}, - viewState: /** @type {olx.ViewState} */ ({ - rotation: 0 - }), - viewHints: [], - wantedTiles: {} - }; - - goog.base(this, {}); - - if (options.operation !== undefined) { - this.setOperation(options.operation, options.lib); - } - -}; -goog.inherits(ol.source.Raster, ol.source.Image); - - -/** - * Set the operation. - * @param {ol.raster.Operation} operation New operation. - * @param {Object=} opt_lib Functions that will be available to operations run - * in a worker. - * @api - */ -ol.source.Raster.prototype.setOperation = function(operation, opt_lib) { - this.worker_ = new ol.ext.pixelworks.Processor({ - operation: operation, - imageOps: this.operationType_ === ol.raster.OperationType.IMAGE, - queue: 1, - lib: opt_lib, - threads: this.threads_ - }); - this.changed(); -}; - - -/** - * Update the stored frame state. - * @param {ol.Extent} extent The view extent (in map units). - * @param {number} resolution The view resolution. - * @param {ol.proj.Projection} projection The view projection. - * @return {olx.FrameState} The updated frame state. - * @private - */ -ol.source.Raster.prototype.updateFrameState_ = - function(extent, resolution, projection) { - - var frameState = /** @type {olx.FrameState} */ ( - goog.object.clone(this.frameState_)); - - frameState.viewState = /** @type {olx.ViewState} */ ( - goog.object.clone(frameState.viewState)); - - var center = ol.extent.getCenter(extent); - var width = Math.round(ol.extent.getWidth(extent) / resolution); - var height = Math.round(ol.extent.getHeight(extent) / resolution); - - frameState.extent = extent; - frameState.focus = ol.extent.getCenter(extent); - frameState.size[0] = width; - frameState.size[1] = height; - - var viewState = frameState.viewState; - viewState.center = center; - viewState.projection = projection; - viewState.resolution = resolution; - return frameState; -}; - - -/** - * Determine if the most recently rendered image canvas is dirty. - * @param {ol.Extent} extent The requested extent. - * @param {number} resolution The requested resolution. - * @return {boolean} The image is dirty. - * @private - */ -ol.source.Raster.prototype.isDirty_ = function(extent, resolution) { - var state = this.renderedState_; - return !state || - this.getRevision() !== state.revision || - resolution !== state.resolution || - !ol.extent.equals(extent, state.extent); -}; - - -/** - * @inheritDoc - */ -ol.source.Raster.prototype.getImage = - function(extent, resolution, pixelRatio, projection) { - - if (!this.allSourcesReady_()) { - return null; - } - - if (!this.isDirty_(extent, resolution)) { - return this.renderedImageCanvas_; - } - - var context = this.canvasContext_; - var canvas = context.canvas; - - var width = Math.round(ol.extent.getWidth(extent) / resolution); - var height = Math.round(ol.extent.getHeight(extent) / resolution); - - if (width !== canvas.width || - height !== canvas.height) { - canvas.width = width; - canvas.height = height; - } - - var frameState = this.updateFrameState_(extent, resolution, projection); - - var imageCanvas = new ol.ImageCanvas( - extent, resolution, 1, this.getAttributions(), canvas, - this.composeFrame_.bind(this, frameState)); - - this.renderedImageCanvas_ = imageCanvas; - - this.renderedState_ = { - extent: extent, - resolution: resolution, - revision: this.getRevision() - }; - - return imageCanvas; -}; - - -/** - * Determine if all sources are ready. - * @return {boolean} All sources are ready. - * @private - */ -ol.source.Raster.prototype.allSourcesReady_ = function() { - var ready = true; - var source; - for (var i = 0, ii = this.renderers_.length; i < ii; ++i) { - source = this.renderers_[i].getLayer().getSource(); - if (source.getState() !== ol.source.State.READY) { - ready = false; - break; - } - } - return ready; -}; - - -/** - * Compose the frame. This renders data from all sources, runs pixel-wise - * operations, and renders the result to the stored canvas context. - * @param {olx.FrameState} frameState The frame state. - * @param {function(Error)} callback Called when composition is complete. - * @private - */ -ol.source.Raster.prototype.composeFrame_ = function(frameState, callback) { - var len = this.renderers_.length; - var imageDatas = new Array(len); - for (var i = 0; i < len; ++i) { - var imageData = ol.source.Raster.getImageData_( - this.renderers_[i], frameState, frameState.layerStatesArray[i]); - if (imageData) { - imageDatas[i] = imageData; - } else { - // image not yet ready - return; - } - } - - var data = {}; - this.dispatchEvent(new ol.source.RasterEvent( - ol.source.RasterEventType.BEFOREOPERATIONS, frameState, data)); - - this.worker_.process(imageDatas, data, - this.onWorkerComplete_.bind(this, frameState, callback)); - - frameState.tileQueue.loadMoreTiles(16, 16); -}; - - -/** - * Called when pixel processing is complete. - * @param {olx.FrameState} frameState The frame state. - * @param {function(Error)} callback Called when rendering is complete. - * @param {Error} err Any error during processing. - * @param {ImageData} output The output image data. - * @param {Object} data The user data. - * @private - */ -ol.source.Raster.prototype.onWorkerComplete_ = - function(frameState, callback, err, output, data) { - if (err) { - callback(err); - return; - } - if (!output) { - // job aborted - return; - } - - this.dispatchEvent(new ol.source.RasterEvent( - ol.source.RasterEventType.AFTEROPERATIONS, frameState, data)); - - var resolution = frameState.viewState.resolution / frameState.pixelRatio; - if (!this.isDirty_(frameState.extent, resolution)) { - this.canvasContext_.putImageData(output, 0, 0); - } - - callback(null); -}; - - -/** - * Get image data from a renderer. - * @param {ol.renderer.canvas.Layer} renderer Layer renderer. - * @param {olx.FrameState} frameState The frame state. - * @param {ol.layer.LayerState} layerState The layer state. - * @return {ImageData} The image data. - * @private - */ -ol.source.Raster.getImageData_ = function(renderer, frameState, layerState) { - renderer.prepareFrame(frameState, layerState); - // We should be able to call renderer.composeFrame(), but this is inefficient - // for tiled sources (we've already rendered to an intermediate canvas in the - // prepareFrame call and we don't need to render again to the output canvas). - // TODO: make all canvas renderers render to a single canvas - var image = renderer.getImage(); - if (!image) { - return null; - } - var imageTransform = renderer.getImageTransform(); - var dx = Math.round(goog.vec.Mat4.getElement(imageTransform, 0, 3)); - var dy = Math.round(goog.vec.Mat4.getElement(imageTransform, 1, 3)); - var width = frameState.size[0]; - var height = frameState.size[1]; - if (image instanceof Image) { - if (!ol.source.Raster.context_) { - ol.source.Raster.context_ = ol.dom.createCanvasContext2D(width, height); - } else { - var canvas = ol.source.Raster.context_.canvas; - if (canvas.width !== width || canvas.height !== height) { - ol.source.Raster.context_ = ol.dom.createCanvasContext2D(width, height); - } else { - ol.source.Raster.context_.clearRect(0, 0, width, height); - } - } - var dw = Math.round( - image.width * goog.vec.Mat4.getElement(imageTransform, 0, 0)); - var dh = Math.round( - image.height * goog.vec.Mat4.getElement(imageTransform, 1, 1)); - ol.source.Raster.context_.drawImage(image, dx, dy, dw, dh); - return ol.source.Raster.context_.getImageData(0, 0, width, height); - } else { - return image.getContext('2d').getImageData(-dx, -dy, width, height); - } -}; - - -/** - * A reusable canvas context. - * @type {CanvasRenderingContext2D} - * @private - */ -ol.source.Raster.context_ = null; - - -/** - * Get a list of layer states from a list of renderers. - * @param {Array.<ol.renderer.canvas.Layer>} renderers Layer renderers. - * @return {Array.<ol.layer.LayerState>} The layer states. - * @private - */ -ol.source.Raster.getLayerStatesArray_ = function(renderers) { - return renderers.map(function(renderer) { - return renderer.getLayer().getLayerState(); - }); -}; - - -/** - * Create renderers for all sources. - * @param {Array.<ol.source.Source>} sources The sources. - * @return {Array.<ol.renderer.canvas.Layer>} Array of layer renderers. - * @private - */ -ol.source.Raster.createRenderers_ = function(sources) { - var len = sources.length; - var renderers = new Array(len); - for (var i = 0; i < len; ++i) { - renderers[i] = ol.source.Raster.createRenderer_(sources[i]); - } - return renderers; -}; - - -/** - * Create a renderer for the provided source. - * @param {ol.source.Source} source The source. - * @return {ol.renderer.canvas.Layer} The renderer. - * @private - */ -ol.source.Raster.createRenderer_ = function(source) { - var renderer = null; - if (source instanceof ol.source.Tile) { - renderer = ol.source.Raster.createTileRenderer_(source); - } else if (source instanceof ol.source.Image) { - renderer = ol.source.Raster.createImageRenderer_(source); - } else { - goog.asserts.fail('Unsupported source type: ' + source); - } - return renderer; -}; - - -/** - * Create an image renderer for the provided source. - * @param {ol.source.Image} source The source. - * @return {ol.renderer.canvas.Layer} The renderer. - * @private - */ -ol.source.Raster.createImageRenderer_ = function(source) { - var layer = new ol.layer.Image({source: source}); - return new ol.renderer.canvas.ImageLayer(layer); -}; - - -/** - * Create a tile renderer for the provided source. - * @param {ol.source.Tile} source The source. - * @return {ol.renderer.canvas.Layer} The renderer. - * @private - */ -ol.source.Raster.createTileRenderer_ = function(source) { - var layer = new ol.layer.Tile({source: source}); - return new ol.renderer.canvas.TileLayer(layer); -}; - - -/** - * @typedef {{revision: number, - * resolution: number, - * extent: ol.Extent}} - */ -ol.source.Raster.RenderedState; - - - -/** - * @classdesc - * Events emitted by {@link ol.source.Raster} instances are instances of this - * type. - * - * @constructor - * @extends {goog.events.Event} - * @implements {oli.source.RasterEvent} - * @param {string} type Type. - * @param {olx.FrameState} frameState The frame state. - * @param {Object} data An object made available to operations. - */ -ol.source.RasterEvent = function(type, frameState, data) { - goog.base(this, type); - - /** - * The raster extent. - * @type {ol.Extent} - * @api - */ - this.extent = frameState.extent; - - /** - * The pixel resolution (map units per pixel). - * @type {number} - * @api - */ - this.resolution = frameState.viewState.resolution / frameState.pixelRatio; - - /** - * An object made available to all operations. This can be used by operations - * as a storage object (e.g. for calculating statistics). - * @type {Object} - * @api - */ - this.data = data; - -}; -goog.inherits(ol.source.RasterEvent, goog.events.Event); - - -/** - * @enum {string} - */ -ol.source.RasterEventType = { - /** - * Triggered before operations are run. - * @event ol.source.RasterEvent#beforeoperations - * @api - */ - BEFOREOPERATIONS: 'beforeoperations', - - /** - * Triggered after operations are run. - * @event ol.source.RasterEvent#afteroperations - * @api - */ - AFTEROPERATIONS: 'afteroperations' -}; - -goog.provide('ol.source.Stamen'); - -goog.require('goog.asserts'); -goog.require('ol.Attribution'); -goog.require('ol.source.OSM'); -goog.require('ol.source.XYZ'); - - -/** - * @type {Object.<string, {extension: string, opaque: boolean}>} - */ -ol.source.StamenLayerConfig = { - 'terrain': { - extension: 'jpg', - opaque: true - }, - 'terrain-background': { - extension: 'jpg', - opaque: true - }, - 'terrain-labels': { - extension: 'png', - opaque: false - }, - 'terrain-lines': { - extension: 'png', - opaque: false - }, - 'toner-background': { - extension: 'png', - opaque: true - }, - 'toner': { - extension: 'png', - opaque: true - }, - 'toner-hybrid': { - extension: 'png', - opaque: false - }, - 'toner-labels': { - extension: 'png', - opaque: false - }, - 'toner-lines': { - extension: 'png', - opaque: false - }, - 'toner-lite': { - extension: 'png', - opaque: true - }, - 'watercolor': { - extension: 'jpg', - opaque: true - } -}; - - -/** - * @type {Object.<string, {minZoom: number, maxZoom: number}>} - */ -ol.source.StamenProviderConfig = { - 'terrain': { - minZoom: 4, - maxZoom: 18 - }, - 'toner': { - minZoom: 0, - maxZoom: 20 - }, - 'watercolor': { - minZoom: 3, - maxZoom: 16 - } -}; - - - -/** - * @classdesc - * Layer source for the Stamen tile server. - * - * @constructor - * @extends {ol.source.XYZ} - * @param {olx.source.StamenOptions} options Stamen options. - * @api stable - */ -ol.source.Stamen = function(options) { - - var i = options.layer.indexOf('-'); - var provider = i == -1 ? options.layer : options.layer.slice(0, i); - goog.asserts.assert(provider in ol.source.StamenProviderConfig, - 'known provider configured'); - var providerConfig = ol.source.StamenProviderConfig[provider]; - - goog.asserts.assert(options.layer in ol.source.StamenLayerConfig, - 'known layer configured'); - var layerConfig = ol.source.StamenLayerConfig[options.layer]; - - var url = options.url !== undefined ? options.url : - 'https://stamen-tiles-{a-d}.a.ssl.fastly.net/' + options.layer + - '/{z}/{x}/{y}.' + layerConfig.extension; - - goog.base(this, { - attributions: ol.source.Stamen.ATTRIBUTIONS, - crossOrigin: 'anonymous', - maxZoom: providerConfig.maxZoom, - // FIXME uncomment the following when tilegrid supports minZoom - //minZoom: providerConfig.minZoom, - opaque: layerConfig.opaque, - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - tileLoadFunction: options.tileLoadFunction, - url: url - }); - -}; -goog.inherits(ol.source.Stamen, ol.source.XYZ); - - -/** - * @const - * @type {Array.<ol.Attribution>} - */ -ol.source.Stamen.ATTRIBUTIONS = [ - new ol.Attribution({ - html: 'Map tiles by <a href="http://stamen.com/">Stamen Design</a>, ' + - 'under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY' + - ' 3.0</a>.' - }), - ol.source.OSM.ATTRIBUTION -]; - -goog.provide('ol.source.TileArcGISRest'); - -goog.require('goog.asserts'); -goog.require('goog.math'); -goog.require('goog.object'); -goog.require('goog.string'); -goog.require('goog.uri.utils'); -goog.require('ol'); -goog.require('ol.TileCoord'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.size'); -goog.require('ol.source.TileImage'); -goog.require('ol.tilecoord'); - - - -/** - * @classdesc - * Layer source for tile data from ArcGIS Rest services. Map and Image - * Services are supported. - * - * For cached ArcGIS services, better performance is available using the - * {@link ol.source.XYZ} data source. - * - * @constructor - * @extends {ol.source.TileImage} - * @param {olx.source.TileArcGISRestOptions=} opt_options Tile ArcGIS Rest - * options. - * @api - */ -ol.source.TileArcGISRest = function(opt_options) { - - var options = opt_options || {}; - - var params = options.params !== undefined ? options.params : {}; - - goog.base(this, { - attributions: options.attributions, - crossOrigin: options.crossOrigin, - logo: options.logo, - projection: options.projection, - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - tileGrid: options.tileGrid, - tileLoadFunction: options.tileLoadFunction, - tileUrlFunction: goog.bind(this.tileUrlFunction_, this), - url: options.url, - urls: options.urls, - wrapX: options.wrapX !== undefined ? options.wrapX : true - }); - - /** - * @private - * @type {Object} - */ - this.params_ = params; - - /** - * @private - * @type {ol.Extent} - */ - this.tmpExtent_ = ol.extent.createEmpty(); - -}; -goog.inherits(ol.source.TileArcGISRest, ol.source.TileImage); - - -/** - * Get the user-provided params, i.e. those passed to the constructor through - * the "params" option, and possibly updated using the updateParams method. - * @return {Object} Params. - * @api - */ -ol.source.TileArcGISRest.prototype.getParams = function() { - return this.params_; -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Size} tileSize Tile size. - * @param {ol.Extent} tileExtent Tile extent. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @param {Object} params Params. - * @return {string|undefined} Request URL. - * @private - */ -ol.source.TileArcGISRest.prototype.getRequestUrl_ = - function(tileCoord, tileSize, tileExtent, - pixelRatio, projection, params) { - - var urls = this.urls; - if (!urls) { - return undefined; - } - - // ArcGIS Server only wants the numeric portion of the projection ID. - var srid = projection.getCode().split(':').pop(); - - params['SIZE'] = tileSize[0] + ',' + tileSize[1]; - params['BBOX'] = tileExtent.join(','); - params['BBOXSR'] = srid; - params['IMAGESR'] = srid; - params['DPI'] = Math.round(90 * pixelRatio); - - var url; - if (urls.length == 1) { - url = urls[0]; - } else { - var index = goog.math.modulo(ol.tilecoord.hash(tileCoord), urls.length); - url = urls[index]; - } - - if (!goog.string.endsWith(url, '/')) { - url = url + '/'; - } - - // If a MapServer, use export. If an ImageServer, use exportImage. - if (goog.string.endsWith(url, 'MapServer/')) { - url = url + 'export'; - } - else if (goog.string.endsWith(url, 'ImageServer/')) { - url = url + 'exportImage'; - } - else { - goog.asserts.fail('Unknown Rest Service', url); - } - - return goog.uri.utils.appendParamsFromMap(url, params); -}; - - -/** - * @param {number} z Z. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {ol.Size} Size. - */ -ol.source.TileArcGISRest.prototype.getTilePixelSize = - function(z, pixelRatio, projection) { - var tileSize = goog.base(this, 'getTilePixelSize', z, pixelRatio, projection); - if (pixelRatio == 1) { - return tileSize; - } else { - return ol.size.scale(tileSize, pixelRatio, this.tmpSize); - } -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} Tile URL. - * @private - */ -ol.source.TileArcGISRest.prototype.tileUrlFunction_ = - function(tileCoord, pixelRatio, projection) { - - var tileGrid = this.getTileGrid(); - if (!tileGrid) { - tileGrid = this.getTileGridForProjection(projection); - } - - if (tileGrid.getResolutions().length <= tileCoord[0]) { - return undefined; - } - - var tileExtent = tileGrid.getTileCoordExtent( - tileCoord, this.tmpExtent_); - var tileSize = ol.size.toSize( - tileGrid.getTileSize(tileCoord[0]), this.tmpSize); - - if (pixelRatio != 1) { - tileSize = ol.size.scale(tileSize, pixelRatio, this.tmpSize); - } - - // Apply default params and override with user specified values. - var baseParams = { - 'F': 'image', - 'FORMAT': 'PNG32', - 'TRANSPARENT': true - }; - goog.object.extend(baseParams, this.params_); - - return this.getRequestUrl_(tileCoord, tileSize, tileExtent, - pixelRatio, projection, baseParams); -}; - - -/** - * Update the user-provided params. - * @param {Object} params Params. - * @api stable - */ -ol.source.TileArcGISRest.prototype.updateParams = function(params) { - goog.object.extend(this.params_, params); - this.changed(); -}; - -goog.provide('ol.source.TileDebug'); - -goog.require('ol.Tile'); -goog.require('ol.TileCoord'); -goog.require('ol.TileState'); -goog.require('ol.dom'); -goog.require('ol.size'); -goog.require('ol.source.Tile'); -goog.require('ol.tilecoord'); - - - -/** - * @constructor - * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Size} tileSize Tile size. - * @param {string} text Text. - * @private - */ -ol.DebugTile_ = function(tileCoord, tileSize, text) { - - goog.base(this, tileCoord, ol.TileState.LOADED); - - /** - * @private - * @type {ol.Size} - */ - this.tileSize_ = tileSize; - - /** - * @private - * @type {string} - */ - this.text_ = text; - - /** - * @private - * @type {Object.<number, HTMLCanvasElement>} - */ - this.canvasByContext_ = {}; - -}; -goog.inherits(ol.DebugTile_, ol.Tile); - - -/** - * Get the image element for this tile. - * @param {Object=} opt_context Optional context. Only used by the DOM - * renderer. - * @return {HTMLCanvasElement} Image. - */ -ol.DebugTile_.prototype.getImage = function(opt_context) { - var key = opt_context !== undefined ? goog.getUid(opt_context) : -1; - if (key in this.canvasByContext_) { - return this.canvasByContext_[key]; - } else { - - var tileSize = this.tileSize_; - var context = ol.dom.createCanvasContext2D(tileSize[0], tileSize[1]); - - context.strokeStyle = 'black'; - context.strokeRect(0.5, 0.5, tileSize[0] + 0.5, tileSize[1] + 0.5); - - context.fillStyle = 'black'; - context.textAlign = 'center'; - context.textBaseline = 'middle'; - context.font = '24px sans-serif'; - context.fillText(this.text_, tileSize[0] / 2, tileSize[1] / 2); - - this.canvasByContext_[key] = context.canvas; - return context.canvas; - - } -}; - - - -/** - * @classdesc - * A pseudo tile source, which does not fetch tiles from a server, but renders - * a grid outline for the tile grid/projection along with the coordinates for - * each tile. See examples/canvas-tiles for an example. - * - * Uses Canvas context2d, so requires Canvas support. - * - * @constructor - * @extends {ol.source.Tile} - * @param {olx.source.TileDebugOptions} options Debug tile options. - * @api - */ -ol.source.TileDebug = function(options) { - - goog.base(this, { - opaque: false, - projection: options.projection, - tileGrid: options.tileGrid, - wrapX: options.wrapX !== undefined ? options.wrapX : true - }); - -}; -goog.inherits(ol.source.TileDebug, ol.source.Tile); - - -/** - * @inheritDoc - */ -ol.source.TileDebug.prototype.getTile = function(z, x, y) { - var tileCoordKey = this.getKeyZXY(z, x, y); - if (this.tileCache.containsKey(tileCoordKey)) { - return /** @type {!ol.DebugTile_} */ (this.tileCache.get(tileCoordKey)); - } else { - var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z)); - var tileCoord = [z, x, y]; - var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord); - var text = !textTileCoord ? '' : ol.tilecoord.toString( - this.getTileCoordForTileUrlFunction(textTileCoord)); - var tile = new ol.DebugTile_(tileCoord, tileSize, text); - this.tileCache.set(tileCoordKey, tile); - return tile; - } -}; - -// FIXME check order of async callbacks - -/** - * @see http://mapbox.com/developers/api/ - */ - -goog.provide('ol.source.TileJSON'); -goog.provide('ol.tilejson'); - -goog.require('goog.asserts'); -goog.require('goog.net.Jsonp'); -goog.require('ol.Attribution'); -goog.require('ol.TileRange'); -goog.require('ol.TileUrlFunction'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.source.State'); -goog.require('ol.source.TileImage'); - - - -/** - * @classdesc - * Layer source for tile data in TileJSON format. - * - * @constructor - * @extends {ol.source.TileImage} - * @param {olx.source.TileJSONOptions} options TileJSON options. - * @api stable - */ -ol.source.TileJSON = function(options) { - - goog.base(this, { - attributions: options.attributions, - crossOrigin: options.crossOrigin, - projection: ol.proj.get('EPSG:3857'), - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - state: ol.source.State.LOADING, - tileLoadFunction: options.tileLoadFunction, - wrapX: options.wrapX !== undefined ? options.wrapX : true - }); - - var request = new goog.net.Jsonp(options.url); - request.send(undefined, goog.bind(this.handleTileJSONResponse, this), - goog.bind(this.handleTileJSONError, this)); - -}; -goog.inherits(ol.source.TileJSON, ol.source.TileImage); - - -/** - * @protected - * @param {TileJSON} tileJSON Tile JSON. - */ -ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) { - - var epsg4326Projection = ol.proj.get('EPSG:4326'); - - var sourceProjection = this.getProjection(); - var extent; - if (tileJSON.bounds !== undefined) { - var transform = ol.proj.getTransformFromProjections( - epsg4326Projection, sourceProjection); - extent = ol.extent.applyTransform(tileJSON.bounds, transform); - } - - if (tileJSON.scheme !== undefined) { - goog.asserts.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"'); - } - var minZoom = tileJSON.minzoom || 0; - var maxZoom = tileJSON.maxzoom || 22; - var tileGrid = ol.tilegrid.createXYZ({ - extent: ol.tilegrid.extentFromProjection(sourceProjection), - maxZoom: maxZoom, - minZoom: minZoom - }); - this.tileGrid = tileGrid; - - this.tileUrlFunction = - ol.TileUrlFunction.createFromTemplates(tileJSON.tiles, tileGrid); - - if (tileJSON.attribution !== undefined && !this.getAttributions()) { - var attributionExtent = extent !== undefined ? - extent : epsg4326Projection.getExtent(); - /** @type {Object.<string, Array.<ol.TileRange>>} */ - var tileRanges = {}; - var z, zKey; - for (z = minZoom; z <= maxZoom; ++z) { - zKey = z.toString(); - tileRanges[zKey] = - [tileGrid.getTileRangeForExtentAndZ(attributionExtent, z)]; - } - this.setAttributions([ - new ol.Attribution({ - html: tileJSON.attribution, - tileRanges: tileRanges - }) - ]); - } - - this.setState(ol.source.State.READY); - -}; - - -/** - * @protected - */ -ol.source.TileJSON.prototype.handleTileJSONError = function() { - this.setState(ol.source.State.ERROR); -}; - -goog.provide('ol.source.TileUTFGrid'); - -goog.require('goog.asserts'); -goog.require('goog.async.nextTick'); -goog.require('goog.events'); -goog.require('goog.events.EventType'); -goog.require('goog.net.Jsonp'); -goog.require('ol.Attribution'); -goog.require('ol.Tile'); -goog.require('ol.TileState'); -goog.require('ol.TileUrlFunction'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.source.State'); -goog.require('ol.source.Tile'); - - - -/** - * @classdesc - * Layer source for UTFGrid interaction data loaded from TileJSON format. - * - * @constructor - * @extends {ol.source.Tile} - * @param {olx.source.TileUTFGridOptions} options Source options. - * @api - */ -ol.source.TileUTFGrid = function(options) { - goog.base(this, { - projection: ol.proj.get('EPSG:3857'), - state: ol.source.State.LOADING - }); - - /** - * @private - * @type {boolean} - */ - this.preemptive_ = options.preemptive !== undefined ? - options.preemptive : true; - - /** - * @private - * @type {!ol.TileUrlFunctionType} - */ - this.tileUrlFunction_ = ol.TileUrlFunction.nullTileUrlFunction; - - /** - * @private - * @type {string|undefined} - */ - this.template_ = undefined; - - var request = new goog.net.Jsonp(options.url); - request.send(undefined, goog.bind(this.handleTileJSONResponse, this)); -}; -goog.inherits(ol.source.TileUTFGrid, ol.source.Tile); - - -/** - * Return the template from TileJSON. - * @return {string|undefined} The template from TileJSON. - * @api - */ -ol.source.TileUTFGrid.prototype.getTemplate = function() { - return this.template_; -}; - - -/** - * Calls the callback (synchronously by default) with the available data - * for given coordinate and resolution (or `null` if not yet loaded or - * in case of an error). - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} resolution Resolution. - * @param {function(this: T, Object)} callback Callback. - * @param {T=} opt_this The object to use as `this` in the callback. - * @param {boolean=} opt_request If `true` the callback is always async. - * The tile data is requested if not yet loaded. - * @template T - * @api - */ -ol.source.TileUTFGrid.prototype.forDataAtCoordinateAndResolution = function( - coordinate, resolution, callback, opt_this, opt_request) { - if (this.tileGrid) { - var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution( - coordinate, resolution); - var tile = /** @type {!ol.source.TileUTFGridTile_} */(this.getTile( - tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection())); - tile.forDataAtCoordinate(coordinate, callback, opt_this, opt_request); - } else { - if (opt_request === true) { - goog.async.nextTick(function() { - callback.call(opt_this, null); - }); - } else { - callback.call(opt_this, null); - } - } -}; - - -/** - * TODO: very similar to ol.source.TileJSON#handleTileJSONResponse - * @protected - * @param {TileJSON} tileJSON Tile JSON. - */ -ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) { - - var epsg4326Projection = ol.proj.get('EPSG:4326'); - - var sourceProjection = this.getProjection(); - var extent; - if (tileJSON.bounds !== undefined) { - var transform = ol.proj.getTransformFromProjections( - epsg4326Projection, sourceProjection); - extent = ol.extent.applyTransform(tileJSON.bounds, transform); - } - - if (tileJSON.scheme !== undefined) { - goog.asserts.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"'); - } - var minZoom = tileJSON.minzoom || 0; - var maxZoom = tileJSON.maxzoom || 22; - var tileGrid = ol.tilegrid.createXYZ({ - extent: ol.tilegrid.extentFromProjection(sourceProjection), - maxZoom: maxZoom, - minZoom: minZoom - }); - this.tileGrid = tileGrid; - - this.template_ = tileJSON.template; - - var grids = tileJSON.grids; - if (!grids) { - this.setState(ol.source.State.ERROR); - return; - } - - this.tileUrlFunction_ = - ol.TileUrlFunction.createFromTemplates(grids, tileGrid); - - if (tileJSON.attribution !== undefined) { - var attributionExtent = extent !== undefined ? - extent : epsg4326Projection.getExtent(); - /** @type {Object.<string, Array.<ol.TileRange>>} */ - var tileRanges = {}; - var z, zKey; - for (z = minZoom; z <= maxZoom; ++z) { - zKey = z.toString(); - tileRanges[zKey] = - [tileGrid.getTileRangeForExtentAndZ(attributionExtent, z)]; - } - this.setAttributions([ - new ol.Attribution({ - html: tileJSON.attribution, - tileRanges: tileRanges - }) - ]); - } - - this.setState(ol.source.State.READY); - -}; - - -/** - * @inheritDoc - */ -ol.source.TileUTFGrid.prototype.getTile = - function(z, x, y, pixelRatio, projection) { - var tileCoordKey = this.getKeyZXY(z, x, y); - if (this.tileCache.containsKey(tileCoordKey)) { - return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey)); - } else { - goog.asserts.assert(projection, 'argument projection is truthy'); - var tileCoord = [z, x, y]; - var urlTileCoord = - this.getTileCoordForTileUrlFunction(tileCoord, projection); - var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection); - var tile = new ol.source.TileUTFGridTile_( - tileCoord, - tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY, - tileUrl !== undefined ? tileUrl : '', - this.tileGrid.getTileCoordExtent(tileCoord), - this.preemptive_); - this.tileCache.set(tileCoordKey, tile); - return tile; - } -}; - - -/** - * @inheritDoc - */ -ol.source.TileUTFGrid.prototype.useTile = function(z, x, y) { - var tileCoordKey = this.getKeyZXY(z, x, y); - if (this.tileCache.containsKey(tileCoordKey)) { - this.tileCache.get(tileCoordKey); - } -}; - - - -/** - * @constructor - * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. - * @param {string} src Image source URI. - * @param {ol.Extent} extent Extent of the tile. - * @param {boolean} preemptive Load the tile when visible (before it's needed). - * @private - */ -ol.source.TileUTFGridTile_ = - function(tileCoord, state, src, extent, preemptive) { - - goog.base(this, tileCoord, state); - - /** - * @private - * @type {string} - */ - this.src_ = src; - - /** - * @private - * @type {ol.Extent} - */ - this.extent_ = extent; - - /** - * @private - * @type {boolean} - */ - this.preemptive_ = preemptive; - - /** - * @private - * @type {Array.<string>} - */ - this.grid_ = null; - - /** - * @private - * @type {Array.<string>} - */ - this.keys_ = null; - - /** - * @private - * @type {Object.<string, Object>|undefined} - */ - this.data_ = null; -}; -goog.inherits(ol.source.TileUTFGridTile_, ol.Tile); - - -/** - * Get the image element for this tile. - * @param {Object=} opt_context Optional context. Only used for the DOM - * renderer. - * @return {Image} Image. - */ -ol.source.TileUTFGridTile_.prototype.getImage = function(opt_context) { - return null; -}; - - -/** - * Synchronously returns data at given coordinate (if available). - * @param {ol.Coordinate} coordinate Coordinate. - * @return {Object} - */ -ol.source.TileUTFGridTile_.prototype.getData = function(coordinate) { - if (!this.grid_ || !this.keys_ || !this.data_) { - return null; - } - var xRelative = (coordinate[0] - this.extent_[0]) / - (this.extent_[2] - this.extent_[0]); - var yRelative = (coordinate[1] - this.extent_[1]) / - (this.extent_[3] - this.extent_[1]); - - var row = this.grid_[Math.floor((1 - yRelative) * this.grid_.length)]; - - if (!goog.isString(row)) { - return null; - } - - var code = row.charCodeAt(Math.floor(xRelative * row.length)); - if (code >= 93) { - code--; - } - if (code >= 35) { - code--; - } - code -= 32; - - return (code in this.keys_) ? this.data_[this.keys_[code]] : null; -}; - - -/** - * Calls the callback (synchronously by default) with the available data - * for given coordinate (or `null` if not yet loaded). - * @param {ol.Coordinate} coordinate Coordinate. - * @param {function(this: T, Object)} callback Callback. - * @param {T=} opt_this The object to use as `this` in the callback. - * @param {boolean=} opt_request If `true` the callback is always async. - * The tile data is requested if not yet loaded. - * @template T - */ -ol.source.TileUTFGridTile_.prototype.forDataAtCoordinate = - function(coordinate, callback, opt_this, opt_request) { - if (this.state == ol.TileState.IDLE && opt_request === true) { - goog.events.listenOnce(this, goog.events.EventType.CHANGE, function(e) { - callback.call(opt_this, this.getData(coordinate)); - }, false, this); - this.loadInternal_(); - } else { - if (opt_request === true) { - goog.async.nextTick(function() { - callback.call(opt_this, this.getData(coordinate)); - }, this); - } else { - callback.call(opt_this, this.getData(coordinate)); - } - } -}; - - -/** - * @inheritDoc - */ -ol.source.TileUTFGridTile_.prototype.getKey = function() { - return this.src_; -}; - - -/** - * @private - */ -ol.source.TileUTFGridTile_.prototype.handleError_ = function() { - this.state = ol.TileState.ERROR; - this.changed(); -}; - - -/** - * @param {!UTFGridJSON} json - * @private - */ -ol.source.TileUTFGridTile_.prototype.handleLoad_ = function(json) { - this.grid_ = json.grid; - this.keys_ = json.keys; - this.data_ = json.data; - - this.state = ol.TileState.EMPTY; - this.changed(); -}; - - -/** - * @private - */ -ol.source.TileUTFGridTile_.prototype.loadInternal_ = function() { - if (this.state == ol.TileState.IDLE) { - this.state = ol.TileState.LOADING; - var request = new goog.net.Jsonp(this.src_); - request.send(undefined, goog.bind(this.handleLoad_, this), - goog.bind(this.handleError_, this)); - } -}; - - -/** - * Load not yet loaded URI. - */ -ol.source.TileUTFGridTile_.prototype.load = function() { - if (this.preemptive_) { - this.loadInternal_(); - } -}; - -// FIXME add minZoom support -// FIXME add date line wrap (tile coord transform) -// FIXME cannot be shared between maps with different projections - -goog.provide('ol.source.TileWMS'); - -goog.require('goog.asserts'); -goog.require('goog.math'); -goog.require('goog.object'); -goog.require('goog.string'); -goog.require('goog.uri.utils'); -goog.require('ol'); -goog.require('ol.TileCoord'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.size'); -goog.require('ol.source.TileImage'); -goog.require('ol.source.wms'); -goog.require('ol.source.wms.ServerType'); -goog.require('ol.tilecoord'); - - - -/** - * @classdesc - * Layer source for tile data from WMS servers. - * - * @constructor - * @extends {ol.source.TileImage} - * @param {olx.source.TileWMSOptions=} opt_options Tile WMS options. - * @api stable - */ -ol.source.TileWMS = function(opt_options) { - - var options = opt_options || {}; - - var params = options.params !== undefined ? options.params : {}; - - var transparent = goog.object.get(params, 'TRANSPARENT', true); - - goog.base(this, { - attributions: options.attributions, - crossOrigin: options.crossOrigin, - logo: options.logo, - opaque: !transparent, - projection: options.projection, - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - tileGrid: options.tileGrid, - tileLoadFunction: options.tileLoadFunction, - tileUrlFunction: goog.bind(this.tileUrlFunction_, this), - url: options.url, - urls: options.urls, - wrapX: options.wrapX !== undefined ? options.wrapX : true - }); - - /** - * @private - * @type {number} - */ - this.gutter_ = options.gutter !== undefined ? options.gutter : 0; - - /** - * @private - * @type {Object} - */ - this.params_ = params; - - /** - * @private - * @type {boolean} - */ - this.v13_ = true; - - /** - * @private - * @type {ol.source.wms.ServerType|undefined} - */ - this.serverType_ = - /** @type {ol.source.wms.ServerType|undefined} */ (options.serverType); - - /** - * @private - * @type {boolean} - */ - this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true; - - /** - * @private - * @type {string} - */ - this.coordKeyPrefix_ = ''; - this.resetCoordKeyPrefix_(); - - /** - * @private - * @type {ol.Extent} - */ - this.tmpExtent_ = ol.extent.createEmpty(); - - this.updateV13_(); - -}; -goog.inherits(ol.source.TileWMS, ol.source.TileImage); - - -/** - * Return the GetFeatureInfo URL for the passed coordinate, resolution, and - * projection. Return `undefined` if the GetFeatureInfo URL cannot be - * constructed. - * @param {ol.Coordinate} coordinate Coordinate. - * @param {number} resolution Resolution. - * @param {ol.proj.ProjectionLike} projection Projection. - * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should - * be provided. If `QUERY_LAYERS` is not provided then the layers specified - * in the `LAYERS` parameter will be used. `VERSION` should not be - * specified here. - * @return {string|undefined} GetFeatureInfo URL. - * @api stable - */ -ol.source.TileWMS.prototype.getGetFeatureInfoUrl = - function(coordinate, resolution, projection, params) { - - goog.asserts.assert(!('VERSION' in params), - 'key VERSION is not allowed in params'); - - var projectionObj = ol.proj.get(projection); - - var tileGrid = this.getTileGrid(); - if (!tileGrid) { - tileGrid = this.getTileGridForProjection(projectionObj); - } - - var tileCoord = tileGrid.getTileCoordForCoordAndResolution( - coordinate, resolution); - - if (tileGrid.getResolutions().length <= tileCoord[0]) { - return undefined; - } - - var tileResolution = tileGrid.getResolution(tileCoord[0]); - var tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_); - var tileSize = ol.size.toSize( - tileGrid.getTileSize(tileCoord[0]), this.tmpSize); - - var gutter = this.gutter_; - if (gutter !== 0) { - tileSize = ol.size.buffer(tileSize, gutter, this.tmpSize); - tileExtent = ol.extent.buffer(tileExtent, - tileResolution * gutter, tileExtent); - } - - var baseParams = { - 'SERVICE': 'WMS', - 'VERSION': ol.DEFAULT_WMS_VERSION, - 'REQUEST': 'GetFeatureInfo', - 'FORMAT': 'image/png', - 'TRANSPARENT': true, - 'QUERY_LAYERS': this.params_['LAYERS'] - }; - goog.object.extend(baseParams, this.params_, params); - - var x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution); - var y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution); - - baseParams[this.v13_ ? 'I' : 'X'] = x; - baseParams[this.v13_ ? 'J' : 'Y'] = y; - - return this.getRequestUrl_(tileCoord, tileSize, tileExtent, - 1, projectionObj, baseParams); -}; - - -/** - * @inheritDoc - */ -ol.source.TileWMS.prototype.getGutter = function() { - return this.gutter_; -}; - - -/** - * @inheritDoc - */ -ol.source.TileWMS.prototype.getKeyZXY = function(z, x, y) { - return this.coordKeyPrefix_ + goog.base(this, 'getKeyZXY', z, x, y); -}; - - -/** - * Get the user-provided params, i.e. those passed to the constructor through - * the "params" option, and possibly updated using the updateParams method. - * @return {Object} Params. - * @api stable - */ -ol.source.TileWMS.prototype.getParams = function() { - return this.params_; -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Size} tileSize Tile size. - * @param {ol.Extent} tileExtent Tile extent. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @param {Object} params Params. - * @return {string|undefined} Request URL. - * @private - */ -ol.source.TileWMS.prototype.getRequestUrl_ = - function(tileCoord, tileSize, tileExtent, - pixelRatio, projection, params) { - - var urls = this.urls; - if (!urls) { - return undefined; - } - - params['WIDTH'] = tileSize[0]; - params['HEIGHT'] = tileSize[1]; - - params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode(); - - if (!('STYLES' in this.params_)) { - /* jshint -W053 */ - params['STYLES'] = new String(''); - /* jshint +W053 */ - } - - if (pixelRatio != 1) { - switch (this.serverType_) { - case ol.source.wms.ServerType.GEOSERVER: - var dpi = (90 * pixelRatio + 0.5) | 0; - if ('FORMAT_OPTIONS' in params) { - params['FORMAT_OPTIONS'] += ';dpi:' + dpi; - } else { - params['FORMAT_OPTIONS'] = 'dpi:' + dpi; - } - break; - case ol.source.wms.ServerType.MAPSERVER: - params['MAP_RESOLUTION'] = 90 * pixelRatio; - break; - case ol.source.wms.ServerType.CARMENTA_SERVER: - case ol.source.wms.ServerType.QGIS: - params['DPI'] = 90 * pixelRatio; - break; - default: - goog.asserts.fail('unknown serverType configured'); - break; - } - } - - var axisOrientation = projection.getAxisOrientation(); - var bbox = tileExtent; - if (this.v13_ && axisOrientation.substr(0, 2) == 'ne') { - var tmp; - tmp = tileExtent[0]; - bbox[0] = tileExtent[1]; - bbox[1] = tmp; - tmp = tileExtent[2]; - bbox[2] = tileExtent[3]; - bbox[3] = tmp; - } - params['BBOX'] = bbox.join(','); - - var url; - if (urls.length == 1) { - url = urls[0]; - } else { - var index = goog.math.modulo(ol.tilecoord.hash(tileCoord), urls.length); - url = urls[index]; - } - return goog.uri.utils.appendParamsFromMap(url, params); -}; - - -/** - * @param {number} z Z. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {ol.Size} Size. - */ -ol.source.TileWMS.prototype.getTilePixelSize = - function(z, pixelRatio, projection) { - var tileSize = goog.base(this, 'getTilePixelSize', z, pixelRatio, projection); - if (pixelRatio == 1 || !this.hidpi_ || this.serverType_ === undefined) { - return tileSize; - } else { - return ol.size.scale(tileSize, pixelRatio, this.tmpSize); - } -}; - - -/** - * @private - */ -ol.source.TileWMS.prototype.resetCoordKeyPrefix_ = function() { - var i = 0; - var res = []; - - if (this.urls) { - var j, jj; - for (j = 0, jj = this.urls.length; j < jj; ++j) { - res[i++] = this.urls[j]; - } - } - - var key; - for (key in this.params_) { - res[i++] = key + '-' + this.params_[key]; - } - - this.coordKeyPrefix_ = res.join('#'); -}; - - -/** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} Tile URL. - * @private - */ -ol.source.TileWMS.prototype.tileUrlFunction_ = - function(tileCoord, pixelRatio, projection) { - - var tileGrid = this.getTileGrid(); - if (!tileGrid) { - tileGrid = this.getTileGridForProjection(projection); - } - - if (tileGrid.getResolutions().length <= tileCoord[0]) { - return undefined; - } - - if (pixelRatio != 1 && (!this.hidpi_ || this.serverType_ === undefined)) { - pixelRatio = 1; - } - - var tileResolution = tileGrid.getResolution(tileCoord[0]); - var tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_); - var tileSize = ol.size.toSize( - tileGrid.getTileSize(tileCoord[0]), this.tmpSize); - - var gutter = this.gutter_; - if (gutter !== 0) { - tileSize = ol.size.buffer(tileSize, gutter, this.tmpSize); - tileExtent = ol.extent.buffer(tileExtent, - tileResolution * gutter, tileExtent); - } - - if (pixelRatio != 1) { - tileSize = ol.size.scale(tileSize, pixelRatio, this.tmpSize); - } - - var baseParams = { - 'SERVICE': 'WMS', - 'VERSION': ol.DEFAULT_WMS_VERSION, - 'REQUEST': 'GetMap', - 'FORMAT': 'image/png', - 'TRANSPARENT': true - }; - goog.object.extend(baseParams, this.params_); - - return this.getRequestUrl_(tileCoord, tileSize, tileExtent, - pixelRatio, projection, baseParams); -}; - - -/** - * Update the user-provided params. - * @param {Object} params Params. - * @api stable - */ -ol.source.TileWMS.prototype.updateParams = function(params) { - goog.object.extend(this.params_, params); - this.resetCoordKeyPrefix_(); - this.updateV13_(); - this.changed(); -}; - - -/** - * @private - */ -ol.source.TileWMS.prototype.updateV13_ = function() { - var version = - goog.object.get(this.params_, 'VERSION', ol.DEFAULT_WMS_VERSION); - this.v13_ = goog.string.compareVersions(version, '1.3') >= 0; -}; - -goog.provide('ol.tilegrid.WMTS'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('ol.proj'); -goog.require('ol.tilegrid.TileGrid'); - - - -/** - * @classdesc - * Set the grid pattern for sources accessing WMTS tiled-image servers. - * - * @constructor - * @extends {ol.tilegrid.TileGrid} - * @param {olx.tilegrid.WMTSOptions} options WMTS options. - * @struct - * @api - */ -ol.tilegrid.WMTS = function(options) { - - goog.asserts.assert( - options.resolutions.length == options.matrixIds.length, - 'options resolutions and matrixIds must have equal length (%s == %s)', - options.resolutions.length, options.matrixIds.length); - - /** - * @private - * @type {!Array.<string>} - */ - this.matrixIds_ = options.matrixIds; - // FIXME: should the matrixIds become optionnal? - - goog.base(this, { - extent: options.extent, - origin: options.origin, - origins: options.origins, - resolutions: options.resolutions, - tileSize: options.tileSize, - tileSizes: options.tileSizes, - sizes: options.sizes - }); - -}; -goog.inherits(ol.tilegrid.WMTS, ol.tilegrid.TileGrid); - - -/** - * @param {number} z Z. - * @return {string} MatrixId.. - */ -ol.tilegrid.WMTS.prototype.getMatrixId = function(z) { - goog.asserts.assert(0 <= z && z < this.matrixIds_.length, - 'attempted to retrive matrixId for illegal z (%s)', z); - return this.matrixIds_[z]; -}; - - -/** - * Get the list of matrix identifiers. - * @return {Array.<string>} MatrixIds. - * @api - */ -ol.tilegrid.WMTS.prototype.getMatrixIds = function() { - return this.matrixIds_; -}; - - -/** - * Create a tile grid from a WMTS capabilities matrix set. - * @param {Object} matrixSet An object representing a matrixSet in the - * capabilities document. - * @param {ol.Extent=} opt_extent An optional extent to restrict the tile - * ranges the server provides. - * @return {ol.tilegrid.WMTS} WMTS tileGrid instance. - * @api - */ -ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet = - function(matrixSet, opt_extent) { - - /** @type {!Array.<number>} */ - var resolutions = []; - /** @type {!Array.<string>} */ - var matrixIds = []; - /** @type {!Array.<ol.Coordinate>} */ - var origins = []; - /** @type {!Array.<ol.Size>} */ - var tileSizes = []; - /** @type {!Array.<ol.Size>} */ - var sizes = []; - - var supportedCRSPropName = 'SupportedCRS'; - var matrixIdsPropName = 'TileMatrix'; - var identifierPropName = 'Identifier'; - var scaleDenominatorPropName = 'ScaleDenominator'; - var topLeftCornerPropName = 'TopLeftCorner'; - var tileWidthPropName = 'TileWidth'; - var tileHeightPropName = 'TileHeight'; - - var projection; - projection = ol.proj.get(matrixSet[supportedCRSPropName].replace( - /urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')); - var metersPerUnit = projection.getMetersPerUnit(); - // swap origin x and y coordinates if axis orientation is lat/long - var switchOriginXY = projection.getAxisOrientation().substr(0, 2) == 'ne'; - - goog.array.sort(matrixSet[matrixIdsPropName], function(a, b) { - return b[scaleDenominatorPropName] - a[scaleDenominatorPropName]; - }); - - matrixSet[matrixIdsPropName].forEach(function(elt, index, array) { - matrixIds.push(elt[identifierPropName]); - var resolution = elt[scaleDenominatorPropName] * 0.28E-3 / metersPerUnit; - var tileWidth = elt[tileWidthPropName]; - var tileHeight = elt[tileHeightPropName]; - if (switchOriginXY) { - origins.push([elt[topLeftCornerPropName][1], - elt[topLeftCornerPropName][0]]); - } else { - origins.push(elt[topLeftCornerPropName]); - } - resolutions.push(resolution); - tileSizes.push(tileWidth == tileHeight ? - tileWidth : [tileWidth, tileHeight]); - // top-left origin, so height is negative - sizes.push([elt['MatrixWidth'], -elt['MatrixHeight']]); - }); - - return new ol.tilegrid.WMTS({ - extent: opt_extent, - origins: origins, - resolutions: resolutions, - matrixIds: matrixIds, - tileSizes: tileSizes, - sizes: sizes - }); -}; - -goog.provide('ol.source.WMTS'); -goog.provide('ol.source.WMTSRequestEncoding'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.object'); -goog.require('goog.uri.utils'); -goog.require('ol.TileUrlFunction'); -goog.require('ol.TileUrlFunctionType'); -goog.require('ol.array'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.source.TileImage'); -goog.require('ol.tilegrid.WMTS'); - - -/** - * Request encoding. One of 'KVP', 'REST'. - * @enum {string} - * @api - */ -ol.source.WMTSRequestEncoding = { - KVP: 'KVP', // see spec §8 - REST: 'REST' // see spec §10 -}; - - - -/** - * @classdesc - * Layer source for tile data from WMTS servers. - * - * @constructor - * @extends {ol.source.TileImage} - * @param {olx.source.WMTSOptions} options WMTS options. - * @api stable - */ -ol.source.WMTS = function(options) { - - // TODO: add support for TileMatrixLimits - - /** - * @private - * @type {string} - */ - this.version_ = options.version !== undefined ? options.version : '1.0.0'; - - /** - * @private - * @type {string} - */ - this.format_ = options.format !== undefined ? options.format : 'image/jpeg'; - - /** - * @private - * @type {Object} - */ - this.dimensions_ = options.dimensions !== undefined ? options.dimensions : {}; - - /** - * @private - * @type {string} - */ - this.coordKeyPrefix_ = ''; - this.resetCoordKeyPrefix_(); - - /** - * @private - * @type {string} - */ - this.layer_ = options.layer; - - /** - * @private - * @type {string} - */ - this.matrixSet_ = options.matrixSet; - - /** - * @private - * @type {string} - */ - this.style_ = options.style; - - var urls = options.urls; - if (urls === undefined && options.url !== undefined) { - urls = ol.TileUrlFunction.expandUrl(options.url); - } - - // FIXME: should we guess this requestEncoding from options.url(s) - // structure? that would mean KVP only if a template is not provided. - - /** - * @private - * @type {ol.source.WMTSRequestEncoding} - */ - this.requestEncoding_ = options.requestEncoding !== undefined ? - /** @type {ol.source.WMTSRequestEncoding} */ (options.requestEncoding) : - ol.source.WMTSRequestEncoding.KVP; - - var requestEncoding = this.requestEncoding_; - - // FIXME: should we create a default tileGrid? - // we could issue a getCapabilities xhr to retrieve missing configuration - var tileGrid = options.tileGrid; - - // context property names are lower case to allow for a case insensitive - // replacement as some services use different naming conventions - var context = { - 'layer': this.layer_, - 'style': this.style_, - 'tilematrixset': this.matrixSet_ - }; - - if (requestEncoding == ol.source.WMTSRequestEncoding.KVP) { - goog.object.extend(context, { - 'Service': 'WMTS', - 'Request': 'GetTile', - 'Version': this.version_, - 'Format': this.format_ - }); - } - - var dimensions = this.dimensions_; - - /** - * @param {string} template Template. - * @return {ol.TileUrlFunctionType} Tile URL function. - */ - function createFromWMTSTemplate(template) { - - // TODO: we may want to create our own appendParams function so that params - // order conforms to wmts spec guidance, and so that we can avoid to escape - // special template params - - template = (requestEncoding == ol.source.WMTSRequestEncoding.KVP) ? - goog.uri.utils.appendParamsFromMap(template, context) : - template.replace(/\{(\w+?)\}/g, function(m, p) { - return (p.toLowerCase() in context) ? context[p.toLowerCase()] : m; - }); - - return ( - /** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} Tile URL. - */ - function(tileCoord, pixelRatio, projection) { - if (!tileCoord) { - return undefined; - } else { - var localContext = { - 'TileMatrix': tileGrid.getMatrixId(tileCoord[0]), - 'TileCol': tileCoord[1], - 'TileRow': -tileCoord[2] - 1 - }; - goog.object.extend(localContext, dimensions); - var url = template; - if (requestEncoding == ol.source.WMTSRequestEncoding.KVP) { - url = goog.uri.utils.appendParamsFromMap(url, localContext); - } else { - url = url.replace(/\{(\w+?)\}/g, function(m, p) { - return localContext[p]; - }); - } - return url; - } - }); - } - - var tileUrlFunction = (urls && urls.length > 0) ? - ol.TileUrlFunction.createFromTileUrlFunctions( - urls.map(createFromWMTSTemplate)) : - ol.TileUrlFunction.nullTileUrlFunction; - - goog.base(this, { - attributions: options.attributions, - crossOrigin: options.crossOrigin, - logo: options.logo, - projection: options.projection, - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - tileClass: options.tileClass, - tileGrid: tileGrid, - tileLoadFunction: options.tileLoadFunction, - tilePixelRatio: options.tilePixelRatio, - tileUrlFunction: tileUrlFunction, - urls: urls, - wrapX: options.wrapX !== undefined ? options.wrapX : false - }); - -}; -goog.inherits(ol.source.WMTS, ol.source.TileImage); - - -/** - * Get the dimensions, i.e. those passed to the constructor through the - * "dimensions" option, and possibly updated using the updateDimensions - * method. - * @return {Object} Dimensions. - * @api - */ -ol.source.WMTS.prototype.getDimensions = function() { - return this.dimensions_; -}; - - -/** - * Return the image format of the WMTS source. - * @return {string} Format. - * @api - */ -ol.source.WMTS.prototype.getFormat = function() { - return this.format_; -}; - - -/** - * @inheritDoc - */ -ol.source.WMTS.prototype.getKeyZXY = function(z, x, y) { - return this.coordKeyPrefix_ + goog.base(this, 'getKeyZXY', z, x, y); -}; - - -/** - * Return the layer of the WMTS source. - * @return {string} Layer. - * @api - */ -ol.source.WMTS.prototype.getLayer = function() { - return this.layer_; -}; - - -/** - * Return the matrix set of the WMTS source. - * @return {string} MatrixSet. - * @api - */ -ol.source.WMTS.prototype.getMatrixSet = function() { - return this.matrixSet_; -}; - - -/** - * Return the request encoding, either "KVP" or "REST". - * @return {ol.source.WMTSRequestEncoding} Request encoding. - * @api - */ -ol.source.WMTS.prototype.getRequestEncoding = function() { - return this.requestEncoding_; -}; - - -/** - * Return the style of the WMTS source. - * @return {string} Style. - * @api - */ -ol.source.WMTS.prototype.getStyle = function() { - return this.style_; -}; - - -/** - * Return the version of the WMTS source. - * @return {string} Version. - * @api - */ -ol.source.WMTS.prototype.getVersion = function() { - return this.version_; -}; - - -/** - * @private - */ -ol.source.WMTS.prototype.resetCoordKeyPrefix_ = function() { - var i = 0; - var res = []; - for (var key in this.dimensions_) { - res[i++] = key + '-' + this.dimensions_[key]; - } - this.coordKeyPrefix_ = res.join('/'); -}; - - -/** - * Update the dimensions. - * @param {Object} dimensions Dimensions. - * @api - */ -ol.source.WMTS.prototype.updateDimensions = function(dimensions) { - goog.object.extend(this.dimensions_, dimensions); - this.resetCoordKeyPrefix_(); - this.changed(); -}; - - -/** - * Generate source options from a capabilities object. - * @param {Object} wmtsCap An object representing the capabilities document. - * @param {Object} config Configuration properties for the layer. Defaults for - * the layer will apply if not provided. - * - * Required config properties: - * layer - {String} The layer identifier. - * - * Optional config properties: - * matrixSet - {String} The matrix set identifier, required if there is - * more than one matrix set in the layer capabilities. - * projection - {String} The desired CRS when no matrixSet is specified. - * eg: "EPSG:3857". If the desired projection is not available, - * an error is thrown. - * requestEncoding - {String} url encoding format for the layer. Default is the - * first tile url format found in the GetCapabilities response. - * style - {String} The name of the style - * format - {String} Image format for the layer. Default is the first - * format returned in the GetCapabilities response. - * @return {olx.source.WMTSOptions} WMTS source options object. - * @api - */ -ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) { - - // TODO: add support for TileMatrixLimits - goog.asserts.assert(config['layer'], - 'config "layer" must not be null'); - - var layers = wmtsCap['Contents']['Layer']; - var l = goog.array.find(layers, function(elt, index, array) { - return elt['Identifier'] == config['layer']; - }); - goog.asserts.assert(l, 'found a matching layer in Contents/Layer'); - - goog.asserts.assert(l['TileMatrixSetLink'].length > 0, - 'layer has TileMatrixSetLink'); - var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet']; - var idx, matrixSet; - if (l['TileMatrixSetLink'].length > 1) { - if ('projection' in config) { - idx = goog.array.findIndex(l['TileMatrixSetLink'], - function(elt, index, array) { - var tileMatrixSet = goog.array.find(tileMatrixSets, function(el) { - return el['Identifier'] == elt['TileMatrixSet']; - }); - return tileMatrixSet['SupportedCRS'].replace( - /urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3' - ) == config['projection']; - }); - } else { - idx = goog.array.findIndex(l['TileMatrixSetLink'], - function(elt, index, array) { - return elt['TileMatrixSet'] == config['matrixSet']; - }); - } - } else { - idx = 0; - } - if (idx < 0) { - idx = 0; - } - matrixSet = /** @type {string} */ - (l['TileMatrixSetLink'][idx]['TileMatrixSet']); - - goog.asserts.assert(matrixSet, 'TileMatrixSet must not be null'); - - var format = /** @type {string} */ (l['Format'][0]); - if ('format' in config) { - format = config['format']; - } - idx = goog.array.findIndex(l['Style'], function(elt, index, array) { - if ('style' in config) { - return elt['Title'] == config['style']; - } else { - return elt['isDefault']; - } - }); - if (idx < 0) { - idx = 0; - } - var style = /** @type {string} */ (l['Style'][idx]['Identifier']); - - var dimensions = {}; - if ('Dimension' in l) { - l['Dimension'].forEach(function(elt, index, array) { - var key = elt['Identifier']; - var value = elt['Default']; - if (value !== undefined) { - goog.asserts.assert(ol.array.includes(elt['Value'], value), - 'default value contained in values'); - } else { - value = elt['Value'][0]; - } - goog.asserts.assert(value !== undefined, 'value could be found'); - dimensions[key] = value; - }); - } - - var matrixSets = wmtsCap['Contents']['TileMatrixSet']; - var matrixSetObj = goog.array.find(matrixSets, function(elt, index, array) { - return elt['Identifier'] == matrixSet; - }); - goog.asserts.assert(matrixSetObj, - 'found matrixSet in Contents/TileMatrixSet'); - - var projection; - if ('projection' in config) { - projection = ol.proj.get(config['projection']); - } else { - projection = ol.proj.get(matrixSetObj['SupportedCRS'].replace( - /urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')); - } - - var wgs84BoundingBox = l['WGS84BoundingBox']; - var extent, wrapX; - if (wgs84BoundingBox !== undefined) { - var wgs84ProjectionExtent = ol.proj.get('EPSG:4326').getExtent(); - wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] && - wgs84BoundingBox[2] == wgs84ProjectionExtent[2]); - extent = ol.proj.transformExtent( - wgs84BoundingBox, 'EPSG:4326', projection); - var projectionExtent = projection.getExtent(); - if (projectionExtent) { - // If possible, do a sanity check on the extent - it should never be - // bigger than the validity extent of the projection of a matrix set. - if (!ol.extent.containsExtent(projectionExtent, extent)) { - extent = undefined; - } - } - } - - var tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet( - matrixSetObj, extent); - - /** @type {!Array.<string>} */ - var urls = []; - var requestEncoding = config['requestEncoding']; - requestEncoding = requestEncoding !== undefined ? requestEncoding : ''; - - goog.asserts.assert( - ol.array.includes(['REST', 'RESTful', 'KVP', ''], requestEncoding), - 'requestEncoding (%s) is one of "REST", "RESTful", "KVP" or ""', - requestEncoding); - - if (!wmtsCap.hasOwnProperty('OperationsMetadata') || - !wmtsCap['OperationsMetadata'].hasOwnProperty('GetTile') || - requestEncoding.indexOf('REST') === 0) { - // Add REST tile resource url - requestEncoding = ol.source.WMTSRequestEncoding.REST; - l['ResourceURL'].forEach(function(elt, index, array) { - if (elt['resourceType'] == 'tile') { - format = elt['format']; - urls.push(/** @type {string} */ (elt['template'])); - } - }); - } else { - var gets = wmtsCap['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get']; - - for (var i = 0, ii = gets.length; i < ii; ++i) { - var constraint = goog.array.find(gets[i]['Constraint'], - function(elt, index, array) { - return elt['name'] == 'GetEncoding'; - }); - var encodings = constraint['AllowedValues']['Value']; - if (encodings.length > 0 && ol.array.includes(encodings, 'KVP')) { - requestEncoding = ol.source.WMTSRequestEncoding.KVP; - urls.push(/** @type {string} */ (gets[i]['href'])); - } - } - } - goog.asserts.assert(urls.length > 0, 'At least one URL found'); - - return { - urls: urls, - layer: config['layer'], - matrixSet: matrixSet, - format: format, - projection: projection, - requestEncoding: requestEncoding, - tileGrid: tileGrid, - style: style, - dimensions: dimensions, - wrapX: wrapX - }; - -}; - -goog.provide('ol.source.Zoomify'); - -goog.require('goog.asserts'); -goog.require('ol'); -goog.require('ol.ImageTile'); -goog.require('ol.TileCoord'); -goog.require('ol.TileState'); -goog.require('ol.dom'); -goog.require('ol.extent'); -goog.require('ol.proj'); -goog.require('ol.source.TileImage'); -goog.require('ol.tilegrid.TileGrid'); - - -/** - * @enum {string} - */ -ol.source.ZoomifyTierSizeCalculation = { - DEFAULT: 'default', - TRUNCATED: 'truncated' -}; - - - -/** - * @classdesc - * Layer source for tile data in Zoomify format. - * - * @constructor - * @extends {ol.source.TileImage} - * @param {olx.source.ZoomifyOptions=} opt_options Options. - * @api stable - */ -ol.source.Zoomify = function(opt_options) { - - var options = opt_options || {}; - - var size = options.size; - var tierSizeCalculation = options.tierSizeCalculation !== undefined ? - options.tierSizeCalculation : - ol.source.ZoomifyTierSizeCalculation.DEFAULT; - - var imageWidth = size[0]; - var imageHeight = size[1]; - var tierSizeInTiles = []; - var tileSize = ol.DEFAULT_TILE_SIZE; - - switch (tierSizeCalculation) { - case ol.source.ZoomifyTierSizeCalculation.DEFAULT: - while (imageWidth > tileSize || imageHeight > tileSize) { - tierSizeInTiles.push([ - Math.ceil(imageWidth / tileSize), - Math.ceil(imageHeight / tileSize) - ]); - tileSize += tileSize; - } - break; - case ol.source.ZoomifyTierSizeCalculation.TRUNCATED: - var width = imageWidth; - var height = imageHeight; - while (width > tileSize || height > tileSize) { - tierSizeInTiles.push([ - Math.ceil(width / tileSize), - Math.ceil(height / tileSize) - ]); - width >>= 1; - height >>= 1; - } - break; - default: - goog.asserts.fail(); - break; - } - - tierSizeInTiles.push([1, 1]); - tierSizeInTiles.reverse(); - - var resolutions = [1]; - var tileCountUpToTier = [0]; - var i, ii; - for (i = 1, ii = tierSizeInTiles.length; i < ii; i++) { - resolutions.push(1 << i); - tileCountUpToTier.push( - tierSizeInTiles[i - 1][0] * tierSizeInTiles[i - 1][1] + - tileCountUpToTier[i - 1] - ); - } - resolutions.reverse(); - - var extent = [0, -size[1], size[0], 0]; - var tileGrid = new ol.tilegrid.TileGrid({ - extent: extent, - origin: ol.extent.getTopLeft(extent), - resolutions: resolutions - }); - - var url = options.url; - - /** - * @this {ol.source.TileImage} - * @param {ol.TileCoord} tileCoord Tile Coordinate. - * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @return {string|undefined} Tile URL. - */ - function tileUrlFunction(tileCoord, pixelRatio, projection) { - if (!tileCoord) { - return undefined; - } else { - var tileCoordZ = tileCoord[0]; - var tileCoordX = tileCoord[1]; - var tileCoordY = -tileCoord[2] - 1; - var tileIndex = - tileCoordX + - tileCoordY * tierSizeInTiles[tileCoordZ][0] + - tileCountUpToTier[tileCoordZ]; - var tileGroup = (tileIndex / ol.DEFAULT_TILE_SIZE) | 0; - return url + 'TileGroup' + tileGroup + '/' + - tileCoordZ + '-' + tileCoordX + '-' + tileCoordY + '.jpg'; - } - } - - goog.base(this, { - attributions: options.attributions, - crossOrigin: options.crossOrigin, - logo: options.logo, - reprojectionErrorThreshold: options.reprojectionErrorThreshold, - tileClass: ol.source.ZoomifyTile_, - tileGrid: tileGrid, - tileUrlFunction: tileUrlFunction - }); - -}; -goog.inherits(ol.source.Zoomify, ol.source.TileImage); - - - -/** - * @constructor - * @extends {ol.ImageTile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. - * @param {string} src Image source URI. - * @param {?string} crossOrigin Cross origin. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. - * @private - */ -ol.source.ZoomifyTile_ = function( - tileCoord, state, src, crossOrigin, tileLoadFunction) { - - goog.base(this, tileCoord, state, src, crossOrigin, tileLoadFunction); - - /** - * @private - * @type {Object.<string, - * HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>} - */ - this.zoomifyImageByContext_ = {}; - -}; -goog.inherits(ol.source.ZoomifyTile_, ol.ImageTile); - - -/** - * @inheritDoc - */ -ol.source.ZoomifyTile_.prototype.getImage = function(opt_context) { - var tileSize = ol.DEFAULT_TILE_SIZE; - var key = opt_context !== undefined ? - goog.getUid(opt_context).toString() : ''; - if (key in this.zoomifyImageByContext_) { - return this.zoomifyImageByContext_[key]; - } else { - var image = goog.base(this, 'getImage', opt_context); - if (this.state == ol.TileState.LOADED) { - if (image.width == tileSize && image.height == tileSize) { - this.zoomifyImageByContext_[key] = image; - return image; - } else { - var context = ol.dom.createCanvasContext2D(tileSize, tileSize); - context.drawImage(image, 0, 0); - this.zoomifyImageByContext_[key] = context.canvas; - return context.canvas; - } - } else { - return image; - } - } -}; - -goog.provide('ol.style.Atlas'); -goog.provide('ol.style.AtlasManager'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('goog.functions'); -goog.require('goog.object'); -goog.require('ol'); - - -/** - * Provides information for an image inside an atlas manager. - * `offsetX` and `offsetY` is the position of the image inside - * the atlas image `image` and the position of the hit-detection image - * inside the hit-detection atlas image `hitImage`. - * @typedef {{offsetX: number, offsetY: number, image: HTMLCanvasElement, - * hitImage: HTMLCanvasElement}} - */ -ol.style.AtlasManagerInfo; - - - -/** - * Manages the creation of image atlases. - * - * Images added to this manager will be inserted into an atlas, which - * will be used for rendering. - * The `size` given in the constructor is the size for the first - * atlas. After that, when new atlases are created, they will have - * twice the size as the latest atlas (until `maxSize` is reached). - * - * If an application uses many images or very large images, it is recommended - * to set a higher `size` value to avoid the creation of too many atlases. - * - * @constructor - * @struct - * @api - * @param {olx.style.AtlasManagerOptions=} opt_options Options. - */ -ol.style.AtlasManager = function(opt_options) { - - var options = opt_options || {}; - - /** - * The size in pixels of the latest atlas image. - * @private - * @type {number} - */ - this.currentSize_ = options.initialSize !== undefined ? - options.initialSize : ol.INITIAL_ATLAS_SIZE; - - /** - * The maximum size in pixels of atlas images. - * @private - * @type {number} - */ - this.maxSize_ = options.maxSize !== undefined ? - options.maxSize : ol.MAX_ATLAS_SIZE != -1 ? - ol.MAX_ATLAS_SIZE : ol.WEBGL_MAX_TEXTURE_SIZE !== undefined ? - ol.WEBGL_MAX_TEXTURE_SIZE : 2048; - - /** - * The size in pixels between images. - * @private - * @type {number} - */ - this.space_ = options.space !== undefined ? options.space : 1; - - /** - * @private - * @type {Array.<ol.style.Atlas>} - */ - this.atlases_ = [new ol.style.Atlas(this.currentSize_, this.space_)]; - - /** - * The size in pixels of the latest atlas image for hit-detection images. - * @private - * @type {number} - */ - this.currentHitSize_ = this.currentSize_; - - /** - * @private - * @type {Array.<ol.style.Atlas>} - */ - this.hitAtlases_ = [new ol.style.Atlas(this.currentHitSize_, this.space_)]; -}; - - -/** - * @param {string} id The identifier of the entry to check. - * @return {?ol.style.AtlasManagerInfo} The position and atlas image for the - * entry, or `null` if the entry is not part of the atlas manager. - */ -ol.style.AtlasManager.prototype.getInfo = function(id) { - /** @type {?ol.style.AtlasInfo} */ - var info = this.getInfo_(this.atlases_, id); - - if (!info) { - return null; - } - /** @type {?ol.style.AtlasInfo} */ - var hitInfo = this.getInfo_(this.hitAtlases_, id); - goog.asserts.assert(hitInfo, 'hitInfo must not be null'); - - return this.mergeInfos_(info, hitInfo); -}; - - -/** - * @private - * @param {Array.<ol.style.Atlas>} atlases The atlases to search. - * @param {string} id The identifier of the entry to check. - * @return {?ol.style.AtlasInfo} The position and atlas image for the entry, - * or `null` if the entry is not part of the atlases. - */ -ol.style.AtlasManager.prototype.getInfo_ = function(atlases, id) { - var atlas, info, i, ii; - for (i = 0, ii = atlases.length; i < ii; ++i) { - atlas = atlases[i]; - info = atlas.get(id); - if (info) { - return info; - } - } - return null; -}; - - -/** - * @private - * @param {ol.style.AtlasInfo} info The info for the real image. - * @param {ol.style.AtlasInfo} hitInfo The info for the hit-detection - * image. - * @return {?ol.style.AtlasManagerInfo} The position and atlas image for the - * entry, or `null` if the entry is not part of the atlases. - */ -ol.style.AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) { - goog.asserts.assert(info.offsetX === hitInfo.offsetX, - 'in order to merge, offsetX of info and hitInfo must be equal'); - goog.asserts.assert(info.offsetY === hitInfo.offsetY, - 'in order to merge, offsetY of info and hitInfo must be equal'); - return /** @type {ol.style.AtlasManagerInfo} */ ({ - offsetX: info.offsetX, - offsetY: info.offsetY, - image: info.image, - hitImage: hitInfo.image - }); -}; - - -/** - * Add an image to the atlas manager. - * - * If an entry for the given id already exists, the entry will - * be overridden (but the space on the atlas graphic will not be freed). - * - * If `renderHitCallback` is provided, the image (or the hit-detection version - * of the image) will be rendered into a separate hit-detection atlas image. - * - * @param {string} id The identifier of the entry to add. - * @param {number} width The width. - * @param {number} height The height. - * @param {function(CanvasRenderingContext2D, number, number)} renderCallback - * Called to render the new image onto an atlas image. - * @param {function(CanvasRenderingContext2D, number, number)=} - * opt_renderHitCallback Called to render a hit-detection image onto a hit - * detection atlas image. - * @param {Object=} opt_this Value to use as `this` when executing - * `renderCallback` and `renderHitCallback`. - * @return {?ol.style.AtlasManagerInfo} The position and atlas image for the - * entry, or `null` if the image is too big. - */ -ol.style.AtlasManager.prototype.add = - function(id, width, height, - renderCallback, opt_renderHitCallback, opt_this) { - if (width + this.space_ > this.maxSize_ || - height + this.space_ > this.maxSize_) { - return null; - } - - /** @type {?ol.style.AtlasInfo} */ - var info = this.add_(false, - id, width, height, renderCallback, opt_this); - if (!info) { - return null; - } - - // even if no hit-detection entry is requested, we insert a fake entry into - // the hit-detection atlas, to make sure that the offset is the same for - // the original image and the hit-detection image. - var renderHitCallback = opt_renderHitCallback !== undefined ? - opt_renderHitCallback : goog.functions.NULL; - - /** @type {?ol.style.AtlasInfo} */ - var hitInfo = this.add_(true, - id, width, height, renderHitCallback, opt_this); - goog.asserts.assert(hitInfo, 'hitInfo must not be null'); - - return this.mergeInfos_(info, hitInfo); -}; - - -/** - * @private - * @param {boolean} isHitAtlas If the hit-detection atlases are used. - * @param {string} id The identifier of the entry to add. - * @param {number} width The width. - * @param {number} height The height. - * @param {function(CanvasRenderingContext2D, number, number)} renderCallback - * Called to render the new image onto an atlas image. - * @param {Object=} opt_this Value to use as `this` when executing - * `renderCallback` and `renderHitCallback`. - * @return {?ol.style.AtlasInfo} The position and atlas image for the entry, - * or `null` if the image is too big. - */ -ol.style.AtlasManager.prototype.add_ = - function(isHitAtlas, id, width, height, - renderCallback, opt_this) { - var atlases = (isHitAtlas) ? this.hitAtlases_ : this.atlases_; - var atlas, info, i, ii; - for (i = 0, ii = atlases.length; i < ii; ++i) { - atlas = atlases[i]; - info = atlas.add(id, width, height, renderCallback, opt_this); - if (info) { - return info; - } else if (!info && i === ii - 1) { - // the entry could not be added to one of the existing atlases, - // create a new atlas that is twice as big and try to add to this one. - var size; - if (isHitAtlas) { - size = Math.min(this.currentHitSize_ * 2, this.maxSize_); - this.currentHitSize_ = size; - } else { - size = Math.min(this.currentSize_ * 2, this.maxSize_); - this.currentSize_ = size; - } - atlas = new ol.style.Atlas(size, this.space_); - atlases.push(atlas); - // run the loop another time - ++ii; - } - } - goog.asserts.fail('Failed to add to atlasmanager'); -}; - - -/** - * Provides information for an image inside an atlas. - * `offsetX` and `offsetY` are the position of the image inside - * the atlas image `image`. - * @typedef {{offsetX: number, offsetY: number, image: HTMLCanvasElement}} - */ -ol.style.AtlasInfo; - - - -/** - * This class facilitates the creation of image atlases. - * - * Images added to an atlas will be rendered onto a single - * atlas canvas. The distribution of images on the canvas is - * managed with the bin packing algorithm described in: - * http://www.blackpawn.com/texts/lightmaps/ - * - * @constructor - * @struct - * @param {number} size The size in pixels of the sprite image. - * @param {number} space The space in pixels between images. - * Because texture coordinates are float values, the edges of - * images might not be completely correct (in a way that the - * edges overlap when being rendered). To avoid this we add a - * padding around each image. - */ -ol.style.Atlas = function(size, space) { - - /** - * @private - * @type {number} - */ - this.space_ = space; - - /** - * @private - * @type {Array.<ol.style.Atlas.Block>} - */ - this.emptyBlocks_ = [{x: 0, y: 0, width: size, height: size}]; - - /** - * @private - * @type {Object.<string, ol.style.AtlasInfo>} - */ - this.entries_ = {}; - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = /** @type {HTMLCanvasElement} */ - (goog.dom.createElement('CANVAS')); - this.canvas_.width = size; - this.canvas_.height = size; - - /** - * @private - * @type {CanvasRenderingContext2D} - */ - this.context_ = /** @type {CanvasRenderingContext2D} */ - (this.canvas_.getContext('2d')); -}; - - -/** - * @param {string} id The identifier of the entry to check. - * @return {?ol.style.AtlasInfo} - */ -ol.style.Atlas.prototype.get = function(id) { - return /** @type {?ol.style.AtlasInfo} */ ( - goog.object.get(this.entries_, id, null)); -}; - - -/** - * @param {string} id The identifier of the entry to add. - * @param {number} width The width. - * @param {number} height The height. - * @param {function(CanvasRenderingContext2D, number, number)} renderCallback - * Called to render the new image onto an atlas image. - * @param {Object=} opt_this Value to use as `this` when executing - * `renderCallback`. - * @return {?ol.style.AtlasInfo} The position and atlas image for the entry. - */ -ol.style.Atlas.prototype.add = - function(id, width, height, renderCallback, opt_this) { - var block, i, ii; - for (i = 0, ii = this.emptyBlocks_.length; i < ii; ++i) { - block = this.emptyBlocks_[i]; - if (block.width >= width + this.space_ && - block.height >= height + this.space_) { - // we found a block that is big enough for our entry - var entry = { - offsetX: block.x + this.space_, - offsetY: block.y + this.space_, - image: this.canvas_ - }; - this.entries_[id] = entry; - - // render the image on the atlas image - renderCallback.call(opt_this, this.context_, - block.x + this.space_, block.y + this.space_); - - // split the block after the insertion, either horizontally or vertically - this.split_(i, block, width + this.space_, height + this.space_); - - return entry; - } - } - - // there is no space for the new entry in this atlas - return null; -}; - - -/** - * @private - * @param {number} index The index of the block. - * @param {ol.style.Atlas.Block} block The block to split. - * @param {number} width The width of the entry to insert. - * @param {number} height The height of the entry to insert. - */ -ol.style.Atlas.prototype.split_ = - function(index, block, width, height) { - var deltaWidth = block.width - width; - var deltaHeight = block.height - height; - - /** @type {ol.style.Atlas.Block} */ - var newBlock1; - /** @type {ol.style.Atlas.Block} */ - var newBlock2; - - if (deltaWidth > deltaHeight) { - // split vertically - // block right of the inserted entry - newBlock1 = { - x: block.x + width, - y: block.y, - width: block.width - width, - height: block.height - }; - - // block below the inserted entry - newBlock2 = { - x: block.x, - y: block.y + height, - width: width, - height: block.height - height - }; - this.updateBlocks_(index, newBlock1, newBlock2); - } else { - // split horizontally - // block right of the inserted entry - newBlock1 = { - x: block.x + width, - y: block.y, - width: block.width - width, - height: height - }; - - // block below the inserted entry - newBlock2 = { - x: block.x, - y: block.y + height, - width: block.width, - height: block.height - height - }; - this.updateBlocks_(index, newBlock1, newBlock2); - } -}; - - -/** - * Remove the old block and insert new blocks at the same array position. - * The new blocks are inserted at the same position, so that splitted - * blocks (that are potentially smaller) are filled first. - * @private - * @param {number} index The index of the block to remove. - * @param {ol.style.Atlas.Block} newBlock1 The 1st block to add. - * @param {ol.style.Atlas.Block} newBlock2 The 2nd block to add. - */ -ol.style.Atlas.prototype.updateBlocks_ = - function(index, newBlock1, newBlock2) { - var args = [index, 1]; - if (newBlock1.width > 0 && newBlock1.height > 0) { - args.push(newBlock1); - } - if (newBlock2.width > 0 && newBlock2.height > 0) { - args.push(newBlock2); - } - this.emptyBlocks_.splice.apply(this.emptyBlocks_, args); -}; - - -/** - * @typedef {{x: number, y: number, width: number, height: number}} - */ -ol.style.Atlas.Block; - -goog.provide('ol.style.RegularShape'); - -goog.require('goog.asserts'); -goog.require('goog.dom'); -goog.require('ol'); -goog.require('ol.color'); -goog.require('ol.has'); -goog.require('ol.render.canvas'); -goog.require('ol.structs.IHasChecksum'); -goog.require('ol.style.AtlasManager'); -goog.require('ol.style.Fill'); -goog.require('ol.style.Image'); -goog.require('ol.style.ImageState'); -goog.require('ol.style.Stroke'); - - - -/** - * @classdesc - * Set regular shape style for vector features. The resulting shape will be - * a regular polygon when `radius` is provided, or a star when `radius1` and - * `radius2` are provided. - * - * @constructor - * @param {olx.style.RegularShapeOptions} options Options. - * @extends {ol.style.Image} - * @implements {ol.structs.IHasChecksum} - * @api - */ -ol.style.RegularShape = function(options) { - - goog.asserts.assert( - options.radius !== undefined || options.radius1 !== undefined, - 'must provide either "radius" or "radius1"'); - - /** - * @private - * @type {Array.<string>} - */ - this.checksums_ = null; - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.canvas_ = null; - - /** - * @private - * @type {HTMLCanvasElement} - */ - this.hitDetectionCanvas_ = null; - - /** - * @private - * @type {ol.style.Fill} - */ - this.fill_ = options.fill !== undefined ? options.fill : null; - - /** - * @private - * @type {Array.<number>} - */ - this.origin_ = [0, 0]; - - /** - * @private - * @type {number} - */ - this.points_ = options.points; - - /** - * @private - * @type {number} - */ - this.radius_ = /** @type {number} */ (options.radius !== undefined ? - options.radius : options.radius1); - - /** - * @private - * @type {number} - */ - this.radius2_ = - options.radius2 !== undefined ? options.radius2 : this.radius_; - - /** - * @private - * @type {number} - */ - this.angle_ = options.angle !== undefined ? options.angle : 0; - - /** - * @private - * @type {ol.style.Stroke} - */ - this.stroke_ = options.stroke !== undefined ? options.stroke : null; - - /** - * @private - * @type {Array.<number>} - */ - this.anchor_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.size_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.imageSize_ = null; - - /** - * @private - * @type {ol.Size} - */ - this.hitDetectionImageSize_ = null; - - this.render_(options.atlasManager); - - /** - * @type {boolean} - */ - var snapToPixel = options.snapToPixel !== undefined ? - options.snapToPixel : true; - - goog.base(this, { - opacity: 1, - rotateWithView: false, - rotation: options.rotation !== undefined ? options.rotation : 0, - scale: 1, - snapToPixel: snapToPixel - }); - -}; -goog.inherits(ol.style.RegularShape, ol.style.Image); - - -/** - * @inheritDoc - * @api - */ -ol.style.RegularShape.prototype.getAnchor = function() { - return this.anchor_; -}; - - -/** - * Get the angle used in generating the shape. - * @return {number} Shape's rotation in radians. - * @api - */ -ol.style.RegularShape.prototype.getAngle = function() { - return this.angle_; -}; - - -/** - * Get the fill style for the shape. - * @return {ol.style.Fill} Fill style. - * @api - */ -ol.style.RegularShape.prototype.getFill = function() { - return this.fill_; -}; - - -/** - * @inheritDoc - */ -ol.style.RegularShape.prototype.getHitDetectionImage = function(pixelRatio) { - return this.hitDetectionCanvas_; -}; - - -/** - * @inheritDoc - * @api - */ -ol.style.RegularShape.prototype.getImage = function(pixelRatio) { - return this.canvas_; -}; - - -/** - * @inheritDoc - */ -ol.style.RegularShape.prototype.getImageSize = function() { - return this.imageSize_; -}; - - -/** - * @inheritDoc - */ -ol.style.RegularShape.prototype.getHitDetectionImageSize = function() { - return this.hitDetectionImageSize_; -}; - - -/** - * @inheritDoc - */ -ol.style.RegularShape.prototype.getImageState = function() { - return ol.style.ImageState.LOADED; -}; - - -/** - * @inheritDoc - * @api - */ -ol.style.RegularShape.prototype.getOrigin = function() { - return this.origin_; -}; - - -/** - * Get the number of points for generating the shape. - * @return {number} Number of points for stars and regular polygons. - * @api - */ -ol.style.RegularShape.prototype.getPoints = function() { - return this.points_; -}; - - -/** - * Get the (primary) radius for the shape. - * @return {number} Radius. - * @api - */ -ol.style.RegularShape.prototype.getRadius = function() { - return this.radius_; -}; - - -/** - * Get the secondary radius for the shape. - * @return {number} Radius2. - * @api - */ -ol.style.RegularShape.prototype.getRadius2 = function() { - return this.radius2_; -}; - - -/** - * @inheritDoc - * @api - */ -ol.style.RegularShape.prototype.getSize = function() { - return this.size_; -}; - - -/** - * Get the stroke style for the shape. - * @return {ol.style.Stroke} Stroke style. - * @api - */ -ol.style.RegularShape.prototype.getStroke = function() { - return this.stroke_; -}; - - -/** - * @inheritDoc - */ -ol.style.RegularShape.prototype.listenImageChange = ol.nullFunction; - - -/** - * @inheritDoc - */ -ol.style.RegularShape.prototype.load = ol.nullFunction; - - -/** - * @inheritDoc - */ -ol.style.RegularShape.prototype.unlistenImageChange = ol.nullFunction; - - -/** - * @typedef {{ - * strokeStyle: (string|undefined), - * strokeWidth: number, - * size: number, - * lineCap: string, - * lineDash: Array.<number>, - * lineJoin: string, - * miterLimit: number - * }} - */ -ol.style.RegularShape.RenderOptions; - - -/** - * @private - * @param {ol.style.AtlasManager|undefined} atlasManager - */ -ol.style.RegularShape.prototype.render_ = function(atlasManager) { - var imageSize; - var lineCap = ''; - var lineJoin = ''; - var miterLimit = 0; - var lineDash = null; - var strokeStyle; - var strokeWidth = 0; - - if (this.stroke_) { - strokeStyle = ol.color.asString(this.stroke_.getColor()); - strokeWidth = this.stroke_.getWidth(); - if (strokeWidth === undefined) { - strokeWidth = ol.render.canvas.defaultLineWidth; - } - lineDash = this.stroke_.getLineDash(); - if (!ol.has.CANVAS_LINE_DASH) { - lineDash = null; - } - lineJoin = this.stroke_.getLineJoin(); - if (lineJoin === undefined) { - lineJoin = ol.render.canvas.defaultLineJoin; - } - lineCap = this.stroke_.getLineCap(); - if (lineCap === undefined) { - lineCap = ol.render.canvas.defaultLineCap; - } - miterLimit = this.stroke_.getMiterLimit(); - if (miterLimit === undefined) { - miterLimit = ol.render.canvas.defaultMiterLimit; - } - } - - var size = 2 * (this.radius_ + strokeWidth) + 1; - - /** @type {ol.style.RegularShape.RenderOptions} */ - var renderOptions = { - strokeStyle: strokeStyle, - strokeWidth: strokeWidth, - size: size, - lineCap: lineCap, - lineDash: lineDash, - lineJoin: lineJoin, - miterLimit: miterLimit - }; - - if (atlasManager === undefined) { - // no atlas manager is used, create a new canvas - this.canvas_ = /** @type {HTMLCanvasElement} */ - (goog.dom.createElement('CANVAS')); - - this.canvas_.height = size; - this.canvas_.width = size; - - // canvas.width and height are rounded to the closest integer - size = this.canvas_.width; - imageSize = size; - - var context = /** @type {CanvasRenderingContext2D} */ - (this.canvas_.getContext('2d')); - this.draw_(renderOptions, context, 0, 0); - - this.createHitDetectionCanvas_(renderOptions); - } else { - // an atlas manager is used, add the symbol to an atlas - size = Math.round(size); - - var hasCustomHitDetectionImage = !this.fill_; - var renderHitDetectionCallback; - if (hasCustomHitDetectionImage) { - // render the hit-detection image into a separate atlas image - renderHitDetectionCallback = - goog.bind(this.drawHitDetectionCanvas_, this, renderOptions); - } - - var id = this.getChecksum(); - var info = atlasManager.add( - id, size, size, goog.bind(this.draw_, this, renderOptions), - renderHitDetectionCallback); - goog.asserts.assert(info, 'shape size is too large'); - - this.canvas_ = info.image; - this.origin_ = [info.offsetX, info.offsetY]; - imageSize = info.image.width; - - if (hasCustomHitDetectionImage) { - this.hitDetectionCanvas_ = info.hitImage; - this.hitDetectionImageSize_ = - [info.hitImage.width, info.hitImage.height]; - } else { - this.hitDetectionCanvas_ = this.canvas_; - this.hitDetectionImageSize_ = [imageSize, imageSize]; - } - } - - this.anchor_ = [size / 2, size / 2]; - this.size_ = [size, size]; - this.imageSize_ = [imageSize, imageSize]; -}; - - -/** - * @private - * @param {ol.style.RegularShape.RenderOptions} renderOptions - * @param {CanvasRenderingContext2D} context - * @param {number} x The origin for the symbol (x). - * @param {number} y The origin for the symbol (y). - */ -ol.style.RegularShape.prototype.draw_ = function(renderOptions, context, x, y) { - var i, angle0, radiusC; - // reset transform - context.setTransform(1, 0, 0, 1, 0, 0); - - // then move to (x, y) - context.translate(x, y); - - context.beginPath(); - if (this.radius2_ !== this.radius_) { - this.points_ = 2 * this.points_; - } - for (i = 0; i <= this.points_; i++) { - angle0 = i * 2 * Math.PI / this.points_ - Math.PI / 2 + this.angle_; - radiusC = i % 2 === 0 ? this.radius_ : this.radius2_; - context.lineTo(renderOptions.size / 2 + radiusC * Math.cos(angle0), - renderOptions.size / 2 + radiusC * Math.sin(angle0)); - } - - if (this.fill_) { - context.fillStyle = ol.color.asString(this.fill_.getColor()); - context.fill(); - } - if (this.stroke_) { - context.strokeStyle = renderOptions.strokeStyle; - context.lineWidth = renderOptions.strokeWidth; - if (renderOptions.lineDash) { - context.setLineDash(renderOptions.lineDash); - } - context.lineCap = renderOptions.lineCap; - context.lineJoin = renderOptions.lineJoin; - context.miterLimit = renderOptions.miterLimit; - context.stroke(); - } - context.closePath(); -}; - - -/** - * @private - * @param {ol.style.RegularShape.RenderOptions} renderOptions - */ -ol.style.RegularShape.prototype.createHitDetectionCanvas_ = - function(renderOptions) { - this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size]; - if (this.fill_) { - this.hitDetectionCanvas_ = this.canvas_; - return; - } - - // if no fill style is set, create an extra hit-detection image with a - // default fill style - this.hitDetectionCanvas_ = /** @type {HTMLCanvasElement} */ - (goog.dom.createElement('CANVAS')); - var canvas = this.hitDetectionCanvas_; - - canvas.height = renderOptions.size; - canvas.width = renderOptions.size; - - var context = /** @type {CanvasRenderingContext2D} */ - (canvas.getContext('2d')); - this.drawHitDetectionCanvas_(renderOptions, context, 0, 0); -}; - - -/** - * @private - * @param {ol.style.RegularShape.RenderOptions} renderOptions - * @param {CanvasRenderingContext2D} context - * @param {number} x The origin for the symbol (x). - * @param {number} y The origin for the symbol (y). - */ -ol.style.RegularShape.prototype.drawHitDetectionCanvas_ = - function(renderOptions, context, x, y) { - // reset transform - context.setTransform(1, 0, 0, 1, 0, 0); - - // then move to (x, y) - context.translate(x, y); - - context.beginPath(); - if (this.radius2_ !== this.radius_) { - this.points_ = 2 * this.points_; - } - var i, radiusC, angle0; - for (i = 0; i <= this.points_; i++) { - angle0 = i * 2 * Math.PI / this.points_ - Math.PI / 2 + this.angle_; - radiusC = i % 2 === 0 ? this.radius_ : this.radius2_; - context.lineTo(renderOptions.size / 2 + radiusC * Math.cos(angle0), - renderOptions.size / 2 + radiusC * Math.sin(angle0)); - } - - context.fillStyle = ol.render.canvas.defaultFillStyle; - context.fill(); - if (this.stroke_) { - context.strokeStyle = renderOptions.strokeStyle; - context.lineWidth = renderOptions.strokeWidth; - if (renderOptions.lineDash) { - context.setLineDash(renderOptions.lineDash); - } - context.stroke(); - } - context.closePath(); -}; - - -/** - * @inheritDoc - */ -ol.style.RegularShape.prototype.getChecksum = function() { - var strokeChecksum = this.stroke_ ? - this.stroke_.getChecksum() : '-'; - var fillChecksum = this.fill_ ? - this.fill_.getChecksum() : '-'; - - var recalculate = !this.checksums_ || - (strokeChecksum != this.checksums_[1] || - fillChecksum != this.checksums_[2] || - this.radius_ != this.checksums_[3] || - this.radius2_ != this.checksums_[4] || - this.angle_ != this.checksums_[5] || - this.points_ != this.checksums_[6]); - - if (recalculate) { - var checksum = 'r' + strokeChecksum + fillChecksum + - (this.radius_ !== undefined ? this.radius_.toString() : '-') + - (this.radius2_ !== undefined ? this.radius2_.toString() : '-') + - (this.angle_ !== undefined ? this.angle_.toString() : '-') + - (this.points_ !== undefined ? this.points_.toString() : '-'); - this.checksums_ = [checksum, strokeChecksum, fillChecksum, - this.radius_, this.radius2_, this.angle_, this.points_]; - } - - return this.checksums_[0]; -}; - -// Copyright 2009 The Closure Library Authors. -// All Rights Reserved. -// -// 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 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS-IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// This file has been auto-generated by GenJsDeps, please do not edit. - -goog.addDependency('demos/editor/equationeditor.js', ['goog.demos.editor.EquationEditor'], ['goog.ui.equation.EquationEditorDialog']); -goog.addDependency('demos/editor/helloworld.js', ['goog.demos.editor.HelloWorld'], ['goog.dom', 'goog.dom.TagName', 'goog.editor.Plugin']); -goog.addDependency('demos/editor/helloworlddialog.js', ['goog.demos.editor.HelloWorldDialog', 'goog.demos.editor.HelloWorldDialog.OkEvent'], ['goog.dom.TagName', 'goog.events.Event', 'goog.string', 'goog.ui.editor.AbstractDialog', 'goog.ui.editor.AbstractDialog.Builder', 'goog.ui.editor.AbstractDialog.EventType']); -goog.addDependency('demos/editor/helloworlddialogplugin.js', ['goog.demos.editor.HelloWorldDialogPlugin', 'goog.demos.editor.HelloWorldDialogPlugin.Command'], ['goog.demos.editor.HelloWorldDialog', 'goog.dom.TagName', 'goog.editor.plugins.AbstractDialogPlugin', 'goog.editor.range', 'goog.functions', 'goog.ui.editor.AbstractDialog.EventType']); - -/** - * @fileoverview Custom exports file. - * @suppress {checkVars,extraRequire} - */ - -goog.require('ol'); -goog.require('ol.Attribution'); -goog.require('ol.Collection'); -goog.require('ol.CollectionEvent'); -goog.require('ol.CollectionEventType'); -goog.require('ol.Color'); -goog.require('ol.Coordinate'); -goog.require('ol.CoordinateFormatType'); -goog.require('ol.DeviceOrientation'); -goog.require('ol.DeviceOrientationProperty'); -goog.require('ol.DragBoxEvent'); -goog.require('ol.Extent'); -goog.require('ol.Feature'); -goog.require('ol.FeatureLoader'); -goog.require('ol.FeatureStyleFunction'); -goog.require('ol.FeatureUrlFunction'); -goog.require('ol.Geolocation'); -goog.require('ol.GeolocationProperty'); -goog.require('ol.Graticule'); -goog.require('ol.Image'); -goog.require('ol.ImageTile'); -goog.require('ol.Kinetic'); -goog.require('ol.LoadingStrategy'); -goog.require('ol.Map'); -goog.require('ol.MapBrowserEvent'); -goog.require('ol.MapBrowserEvent.EventType'); -goog.require('ol.MapBrowserEventHandler'); -goog.require('ol.MapBrowserPointerEvent'); -goog.require('ol.MapEvent'); -goog.require('ol.MapEventType'); -goog.require('ol.MapProperty'); -goog.require('ol.Object'); -goog.require('ol.ObjectEvent'); -goog.require('ol.ObjectEventType'); -goog.require('ol.Observable'); -goog.require('ol.Overlay'); -goog.require('ol.OverlayPositioning'); -goog.require('ol.OverlayProperty'); -goog.require('ol.Size'); -goog.require('ol.Sphere'); -goog.require('ol.Tile'); -goog.require('ol.TileState'); -goog.require('ol.VectorTile'); -goog.require('ol.View'); -goog.require('ol.ViewHint'); -goog.require('ol.ViewProperty'); -goog.require('ol.animation'); -goog.require('ol.color'); -goog.require('ol.control'); -goog.require('ol.control.Attribution'); -goog.require('ol.control.Control'); -goog.require('ol.control.FullScreen'); -goog.require('ol.control.MousePosition'); -goog.require('ol.control.OverviewMap'); -goog.require('ol.control.Rotate'); -goog.require('ol.control.ScaleLine'); -goog.require('ol.control.ScaleLineProperty'); -goog.require('ol.control.ScaleLineUnits'); -goog.require('ol.control.Zoom'); -goog.require('ol.control.ZoomSlider'); -goog.require('ol.control.ZoomToExtent'); -goog.require('ol.coordinate'); -goog.require('ol.easing'); -goog.require('ol.events.ConditionType'); -goog.require('ol.events.condition'); -goog.require('ol.extent'); -goog.require('ol.extent.Corner'); -goog.require('ol.extent.Relationship'); -goog.require('ol.featureloader'); -goog.require('ol.format.EsriJSON'); -goog.require('ol.format.Feature'); -goog.require('ol.format.GML'); -goog.require('ol.format.GML2'); -goog.require('ol.format.GML3'); -goog.require('ol.format.GMLBase'); -goog.require('ol.format.GPX'); -goog.require('ol.format.GeoJSON'); -goog.require('ol.format.IGC'); -goog.require('ol.format.IGCZ'); -goog.require('ol.format.KML'); -goog.require('ol.format.MVT'); -goog.require('ol.format.OSMXML'); -goog.require('ol.format.Polyline'); -goog.require('ol.format.TopoJSON'); -goog.require('ol.format.WFS'); -goog.require('ol.format.WKT'); -goog.require('ol.format.WMSCapabilities'); -goog.require('ol.format.WMSGetFeatureInfo'); -goog.require('ol.format.WMTSCapabilities'); -goog.require('ol.geom.Circle'); -goog.require('ol.geom.Geometry'); -goog.require('ol.geom.GeometryCollection'); -goog.require('ol.geom.GeometryLayout'); -goog.require('ol.geom.GeometryType'); -goog.require('ol.geom.LineString'); -goog.require('ol.geom.LinearRing'); -goog.require('ol.geom.MultiLineString'); -goog.require('ol.geom.MultiPoint'); -goog.require('ol.geom.MultiPolygon'); -goog.require('ol.geom.Point'); -goog.require('ol.geom.Polygon'); -goog.require('ol.geom.SimpleGeometry'); -goog.require('ol.has'); -goog.require('ol.interaction'); -goog.require('ol.interaction.DoubleClickZoom'); -goog.require('ol.interaction.DragAndDrop'); -goog.require('ol.interaction.DragAndDropEvent'); -goog.require('ol.interaction.DragBox'); -goog.require('ol.interaction.DragPan'); -goog.require('ol.interaction.DragRotate'); -goog.require('ol.interaction.DragRotateAndZoom'); -goog.require('ol.interaction.DragZoom'); -goog.require('ol.interaction.Draw'); -goog.require('ol.interaction.DrawEvent'); -goog.require('ol.interaction.DrawEventType'); -goog.require('ol.interaction.DrawGeometryFunctionType'); -goog.require('ol.interaction.DrawMode'); -goog.require('ol.interaction.Interaction'); -goog.require('ol.interaction.InteractionProperty'); -goog.require('ol.interaction.KeyboardPan'); -goog.require('ol.interaction.KeyboardZoom'); -goog.require('ol.interaction.Modify'); -goog.require('ol.interaction.ModifyEvent'); -goog.require('ol.interaction.MouseWheelZoom'); -goog.require('ol.interaction.PinchRotate'); -goog.require('ol.interaction.PinchZoom'); -goog.require('ol.interaction.Pointer'); -goog.require('ol.interaction.Select'); -goog.require('ol.interaction.SelectEvent'); -goog.require('ol.interaction.SelectEventType'); -goog.require('ol.interaction.SelectFilterFunction'); -goog.require('ol.interaction.Snap'); -goog.require('ol.interaction.SnapProperty'); -goog.require('ol.interaction.Translate'); -goog.require('ol.interaction.TranslateEvent'); -goog.require('ol.layer.Base'); -goog.require('ol.layer.Group'); -goog.require('ol.layer.Heatmap'); -goog.require('ol.layer.Image'); -goog.require('ol.layer.Layer'); -goog.require('ol.layer.LayerProperty'); -goog.require('ol.layer.LayerState'); -goog.require('ol.layer.Tile'); -goog.require('ol.layer.Vector'); -goog.require('ol.layer.VectorTile'); -goog.require('ol.loadingstrategy'); -goog.require('ol.proj'); -goog.require('ol.proj.METERS_PER_UNIT'); -goog.require('ol.proj.Projection'); -goog.require('ol.proj.ProjectionLike'); -goog.require('ol.proj.Units'); -goog.require('ol.proj.common'); -goog.require('ol.render.Event'); -goog.require('ol.render.EventType'); -goog.require('ol.render.Feature'); -goog.require('ol.render.VectorContext'); -goog.require('ol.render.canvas.Immediate'); -goog.require('ol.render.webgl.Immediate'); -goog.require('ol.size'); -goog.require('ol.source.BingMaps'); -goog.require('ol.source.Cluster'); -goog.require('ol.source.Image'); -goog.require('ol.source.ImageCanvas'); -goog.require('ol.source.ImageEvent'); -goog.require('ol.source.ImageMapGuide'); -goog.require('ol.source.ImageStatic'); -goog.require('ol.source.ImageVector'); -goog.require('ol.source.ImageWMS'); -goog.require('ol.source.MapQuest'); -goog.require('ol.source.OSM'); -goog.require('ol.source.Raster'); -goog.require('ol.source.RasterEvent'); -goog.require('ol.source.RasterEventType'); -goog.require('ol.source.Source'); -goog.require('ol.source.Stamen'); -goog.require('ol.source.State'); -goog.require('ol.source.Tile'); -goog.require('ol.source.TileArcGISRest'); -goog.require('ol.source.TileDebug'); -goog.require('ol.source.TileEvent'); -goog.require('ol.source.TileImage'); -goog.require('ol.source.TileJSON'); -goog.require('ol.source.TileOptions'); -goog.require('ol.source.TileUTFGrid'); -goog.require('ol.source.TileWMS'); -goog.require('ol.source.UrlTile'); -goog.require('ol.source.Vector'); -goog.require('ol.source.VectorEvent'); -goog.require('ol.source.VectorEventType'); -goog.require('ol.source.VectorTile'); -goog.require('ol.source.WMTS'); -goog.require('ol.source.WMTSRequestEncoding'); -goog.require('ol.source.XYZ'); -goog.require('ol.source.Zoomify'); -goog.require('ol.style.Atlas'); -goog.require('ol.style.AtlasManager'); -goog.require('ol.style.Circle'); -goog.require('ol.style.Fill'); -goog.require('ol.style.GeometryFunction'); -goog.require('ol.style.Icon'); -goog.require('ol.style.IconAnchorUnits'); -goog.require('ol.style.IconImageCache'); -goog.require('ol.style.IconOrigin'); -goog.require('ol.style.Image'); -goog.require('ol.style.ImageState'); -goog.require('ol.style.RegularShape'); -goog.require('ol.style.Stroke'); -goog.require('ol.style.Style'); -goog.require('ol.style.StyleFunction'); -goog.require('ol.style.Text'); -goog.require('ol.style.defaultGeometryFunction'); -goog.require('ol.tilegrid.TileGrid'); -goog.require('ol.tilegrid.WMTS'); -goog.require('ol.tilejson'); -goog.require('ol.webgl.Context'); -goog.require('ol.xml'); - - -goog.exportSymbol( - 'ol.animation.bounce', - ol.animation.bounce, - OPENLAYERS); - -goog.exportSymbol( - 'ol.animation.pan', - ol.animation.pan, - OPENLAYERS); - -goog.exportSymbol( - 'ol.animation.rotate', - ol.animation.rotate, - OPENLAYERS); - -goog.exportSymbol( - 'ol.animation.zoom', - ol.animation.zoom, - OPENLAYERS); - -goog.exportSymbol( - 'ol.Attribution', - ol.Attribution, - OPENLAYERS); - -goog.exportProperty( - ol.Attribution.prototype, - 'getHTML', - ol.Attribution.prototype.getHTML); - -goog.exportProperty( - ol.CollectionEvent.prototype, - 'element', - ol.CollectionEvent.prototype.element); - -goog.exportSymbol( - 'ol.Collection', - ol.Collection, - OPENLAYERS); - -goog.exportProperty( - ol.Collection.prototype, - 'clear', - ol.Collection.prototype.clear); - -goog.exportProperty( - ol.Collection.prototype, - 'extend', - ol.Collection.prototype.extend); - -goog.exportProperty( - ol.Collection.prototype, - 'forEach', - ol.Collection.prototype.forEach); - -goog.exportProperty( - ol.Collection.prototype, - 'getArray', - ol.Collection.prototype.getArray); - -goog.exportProperty( - ol.Collection.prototype, - 'item', - ol.Collection.prototype.item); - -goog.exportProperty( - ol.Collection.prototype, - 'getLength', - ol.Collection.prototype.getLength); - -goog.exportProperty( - ol.Collection.prototype, - 'insertAt', - ol.Collection.prototype.insertAt); - -goog.exportProperty( - ol.Collection.prototype, - 'pop', - ol.Collection.prototype.pop); - -goog.exportProperty( - ol.Collection.prototype, - 'push', - ol.Collection.prototype.push); - -goog.exportProperty( - ol.Collection.prototype, - 'remove', - ol.Collection.prototype.remove); - -goog.exportProperty( - ol.Collection.prototype, - 'removeAt', - ol.Collection.prototype.removeAt); - -goog.exportProperty( - ol.Collection.prototype, - 'setAt', - ol.Collection.prototype.setAt); - -goog.exportSymbol( - 'ol.coordinate.add', - ol.coordinate.add, - OPENLAYERS); - -goog.exportSymbol( - 'ol.coordinate.createStringXY', - ol.coordinate.createStringXY, - OPENLAYERS); - -goog.exportSymbol( - 'ol.coordinate.format', - ol.coordinate.format, - OPENLAYERS); - -goog.exportSymbol( - 'ol.coordinate.rotate', - ol.coordinate.rotate, - OPENLAYERS); - -goog.exportSymbol( - 'ol.coordinate.toStringHDMS', - ol.coordinate.toStringHDMS, - OPENLAYERS); - -goog.exportSymbol( - 'ol.coordinate.toStringXY', - ol.coordinate.toStringXY, - OPENLAYERS); - -goog.exportSymbol( - 'ol.DeviceOrientation', - ol.DeviceOrientation, - OPENLAYERS); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'getAlpha', - ol.DeviceOrientation.prototype.getAlpha); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'getBeta', - ol.DeviceOrientation.prototype.getBeta); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'getGamma', - ol.DeviceOrientation.prototype.getGamma); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'getHeading', - ol.DeviceOrientation.prototype.getHeading); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'getTracking', - ol.DeviceOrientation.prototype.getTracking); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'setTracking', - ol.DeviceOrientation.prototype.setTracking); - -goog.exportSymbol( - 'ol.easing.easeIn', - ol.easing.easeIn, - OPENLAYERS); - -goog.exportSymbol( - 'ol.easing.easeOut', - ol.easing.easeOut, - OPENLAYERS); - -goog.exportSymbol( - 'ol.easing.inAndOut', - ol.easing.inAndOut, - OPENLAYERS); - -goog.exportSymbol( - 'ol.easing.linear', - ol.easing.linear, - OPENLAYERS); - -goog.exportSymbol( - 'ol.easing.upAndDown', - ol.easing.upAndDown, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.boundingExtent', - ol.extent.boundingExtent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.buffer', - ol.extent.buffer, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.containsCoordinate', - ol.extent.containsCoordinate, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.containsExtent', - ol.extent.containsExtent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.containsXY', - ol.extent.containsXY, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.createEmpty', - ol.extent.createEmpty, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.equals', - ol.extent.equals, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.extend', - ol.extent.extend, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getBottomLeft', - ol.extent.getBottomLeft, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getBottomRight', - ol.extent.getBottomRight, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getCenter', - ol.extent.getCenter, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getHeight', - ol.extent.getHeight, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getIntersection', - ol.extent.getIntersection, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getSize', - ol.extent.getSize, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getTopLeft', - ol.extent.getTopLeft, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getTopRight', - ol.extent.getTopRight, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.getWidth', - ol.extent.getWidth, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.intersects', - ol.extent.intersects, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.isEmpty', - ol.extent.isEmpty, - OPENLAYERS); - -goog.exportSymbol( - 'ol.extent.applyTransform', - ol.extent.applyTransform, - OPENLAYERS); - -goog.exportSymbol( - 'ol.Feature', - ol.Feature, - OPENLAYERS); - -goog.exportProperty( - ol.Feature.prototype, - 'clone', - ol.Feature.prototype.clone); - -goog.exportProperty( - ol.Feature.prototype, - 'getGeometry', - ol.Feature.prototype.getGeometry); - -goog.exportProperty( - ol.Feature.prototype, - 'getId', - ol.Feature.prototype.getId); - -goog.exportProperty( - ol.Feature.prototype, - 'getGeometryName', - ol.Feature.prototype.getGeometryName); - -goog.exportProperty( - ol.Feature.prototype, - 'getStyle', - ol.Feature.prototype.getStyle); - -goog.exportProperty( - ol.Feature.prototype, - 'getStyleFunction', - ol.Feature.prototype.getStyleFunction); - -goog.exportProperty( - ol.Feature.prototype, - 'setGeometry', - ol.Feature.prototype.setGeometry); - -goog.exportProperty( - ol.Feature.prototype, - 'setStyle', - ol.Feature.prototype.setStyle); - -goog.exportProperty( - ol.Feature.prototype, - 'setId', - ol.Feature.prototype.setId); - -goog.exportProperty( - ol.Feature.prototype, - 'setGeometryName', - ol.Feature.prototype.setGeometryName); - -goog.exportSymbol( - 'ol.featureloader.tile', - ol.featureloader.tile, - OPENLAYERS); - -goog.exportSymbol( - 'ol.featureloader.xhr', - ol.featureloader.xhr, - OPENLAYERS); - -goog.exportSymbol( - 'ol.Geolocation', - ol.Geolocation, - OPENLAYERS); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getAccuracy', - ol.Geolocation.prototype.getAccuracy); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getAccuracyGeometry', - ol.Geolocation.prototype.getAccuracyGeometry); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getAltitude', - ol.Geolocation.prototype.getAltitude); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getAltitudeAccuracy', - ol.Geolocation.prototype.getAltitudeAccuracy); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getHeading', - ol.Geolocation.prototype.getHeading); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getPosition', - ol.Geolocation.prototype.getPosition); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getProjection', - ol.Geolocation.prototype.getProjection); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getSpeed', - ol.Geolocation.prototype.getSpeed); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getTracking', - ol.Geolocation.prototype.getTracking); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getTrackingOptions', - ol.Geolocation.prototype.getTrackingOptions); - -goog.exportProperty( - ol.Geolocation.prototype, - 'setProjection', - ol.Geolocation.prototype.setProjection); - -goog.exportProperty( - ol.Geolocation.prototype, - 'setTracking', - ol.Geolocation.prototype.setTracking); - -goog.exportProperty( - ol.Geolocation.prototype, - 'setTrackingOptions', - ol.Geolocation.prototype.setTrackingOptions); - -goog.exportSymbol( - 'ol.Graticule', - ol.Graticule, - OPENLAYERS); - -goog.exportProperty( - ol.Graticule.prototype, - 'getMap', - ol.Graticule.prototype.getMap); - -goog.exportProperty( - ol.Graticule.prototype, - 'getMeridians', - ol.Graticule.prototype.getMeridians); - -goog.exportProperty( - ol.Graticule.prototype, - 'getParallels', - ol.Graticule.prototype.getParallels); - -goog.exportProperty( - ol.Graticule.prototype, - 'setMap', - ol.Graticule.prototype.setMap); - -goog.exportSymbol( - 'ol.has.DEVICE_PIXEL_RATIO', - ol.has.DEVICE_PIXEL_RATIO, - OPENLAYERS); - -goog.exportSymbol( - 'ol.has.CANVAS', - ol.has.CANVAS, - OPENLAYERS); - -goog.exportSymbol( - 'ol.has.DEVICE_ORIENTATION', - ol.has.DEVICE_ORIENTATION, - OPENLAYERS); - -goog.exportSymbol( - 'ol.has.GEOLOCATION', - ol.has.GEOLOCATION, - OPENLAYERS); - -goog.exportSymbol( - 'ol.has.TOUCH', - ol.has.TOUCH, - OPENLAYERS); - -goog.exportSymbol( - 'ol.has.WEBGL', - ol.has.WEBGL, - OPENLAYERS); - -goog.exportProperty( - ol.Image.prototype, - 'getImage', - ol.Image.prototype.getImage); - -goog.exportProperty( - ol.ImageTile.prototype, - 'getImage', - ol.ImageTile.prototype.getImage); - -goog.exportSymbol( - 'ol.Kinetic', - ol.Kinetic, - OPENLAYERS); - -goog.exportSymbol( - 'ol.loadingstrategy.all', - ol.loadingstrategy.all, - OPENLAYERS); - -goog.exportSymbol( - 'ol.loadingstrategy.bbox', - ol.loadingstrategy.bbox, - OPENLAYERS); - -goog.exportSymbol( - 'ol.loadingstrategy.tile', - ol.loadingstrategy.tile, - OPENLAYERS); - -goog.exportSymbol( - 'ol.Map', - ol.Map, - OPENLAYERS); - -goog.exportProperty( - ol.Map.prototype, - 'addControl', - ol.Map.prototype.addControl); - -goog.exportProperty( - ol.Map.prototype, - 'addInteraction', - ol.Map.prototype.addInteraction); - -goog.exportProperty( - ol.Map.prototype, - 'addLayer', - ol.Map.prototype.addLayer); - -goog.exportProperty( - ol.Map.prototype, - 'addOverlay', - ol.Map.prototype.addOverlay); - -goog.exportProperty( - ol.Map.prototype, - 'beforeRender', - ol.Map.prototype.beforeRender); - -goog.exportProperty( - ol.Map.prototype, - 'forEachFeatureAtPixel', - ol.Map.prototype.forEachFeatureAtPixel); - -goog.exportProperty( - ol.Map.prototype, - 'forEachLayerAtPixel', - ol.Map.prototype.forEachLayerAtPixel); - -goog.exportProperty( - ol.Map.prototype, - 'hasFeatureAtPixel', - ol.Map.prototype.hasFeatureAtPixel); - -goog.exportProperty( - ol.Map.prototype, - 'getEventCoordinate', - ol.Map.prototype.getEventCoordinate); - -goog.exportProperty( - ol.Map.prototype, - 'getEventPixel', - ol.Map.prototype.getEventPixel); - -goog.exportProperty( - ol.Map.prototype, - 'getTarget', - ol.Map.prototype.getTarget); - -goog.exportProperty( - ol.Map.prototype, - 'getTargetElement', - ol.Map.prototype.getTargetElement); - -goog.exportProperty( - ol.Map.prototype, - 'getCoordinateFromPixel', - ol.Map.prototype.getCoordinateFromPixel); - -goog.exportProperty( - ol.Map.prototype, - 'getControls', - ol.Map.prototype.getControls); - -goog.exportProperty( - ol.Map.prototype, - 'getOverlays', - ol.Map.prototype.getOverlays); - -goog.exportProperty( - ol.Map.prototype, - 'getOverlayById', - ol.Map.prototype.getOverlayById); - -goog.exportProperty( - ol.Map.prototype, - 'getInteractions', - ol.Map.prototype.getInteractions); - -goog.exportProperty( - ol.Map.prototype, - 'getLayerGroup', - ol.Map.prototype.getLayerGroup); - -goog.exportProperty( - ol.Map.prototype, - 'getLayers', - ol.Map.prototype.getLayers); - -goog.exportProperty( - ol.Map.prototype, - 'getPixelFromCoordinate', - ol.Map.prototype.getPixelFromCoordinate); - -goog.exportProperty( - ol.Map.prototype, - 'getSize', - ol.Map.prototype.getSize); - -goog.exportProperty( - ol.Map.prototype, - 'getView', - ol.Map.prototype.getView); - -goog.exportProperty( - ol.Map.prototype, - 'getViewport', - ol.Map.prototype.getViewport); - -goog.exportProperty( - ol.Map.prototype, - 'renderSync', - ol.Map.prototype.renderSync); - -goog.exportProperty( - ol.Map.prototype, - 'render', - ol.Map.prototype.render); - -goog.exportProperty( - ol.Map.prototype, - 'removeControl', - ol.Map.prototype.removeControl); - -goog.exportProperty( - ol.Map.prototype, - 'removeInteraction', - ol.Map.prototype.removeInteraction); - -goog.exportProperty( - ol.Map.prototype, - 'removeLayer', - ol.Map.prototype.removeLayer); - -goog.exportProperty( - ol.Map.prototype, - 'removeOverlay', - ol.Map.prototype.removeOverlay); - -goog.exportProperty( - ol.Map.prototype, - 'setLayerGroup', - ol.Map.prototype.setLayerGroup); - -goog.exportProperty( - ol.Map.prototype, - 'setSize', - ol.Map.prototype.setSize); - -goog.exportProperty( - ol.Map.prototype, - 'setTarget', - ol.Map.prototype.setTarget); - -goog.exportProperty( - ol.Map.prototype, - 'setView', - ol.Map.prototype.setView); - -goog.exportProperty( - ol.Map.prototype, - 'updateSize', - ol.Map.prototype.updateSize); - -goog.exportProperty( - ol.MapBrowserEvent.prototype, - 'originalEvent', - ol.MapBrowserEvent.prototype.originalEvent); - -goog.exportProperty( - ol.MapBrowserEvent.prototype, - 'pixel', - ol.MapBrowserEvent.prototype.pixel); - -goog.exportProperty( - ol.MapBrowserEvent.prototype, - 'coordinate', - ol.MapBrowserEvent.prototype.coordinate); - -goog.exportProperty( - ol.MapBrowserEvent.prototype, - 'dragging', - ol.MapBrowserEvent.prototype.dragging); - -goog.exportProperty( - ol.MapBrowserEvent.prototype, - 'preventDefault', - ol.MapBrowserEvent.prototype.preventDefault); - -goog.exportProperty( - ol.MapBrowserEvent.prototype, - 'stopPropagation', - ol.MapBrowserEvent.prototype.stopPropagation); - -goog.exportProperty( - ol.MapEvent.prototype, - 'map', - ol.MapEvent.prototype.map); - -goog.exportProperty( - ol.MapEvent.prototype, - 'frameState', - ol.MapEvent.prototype.frameState); - -goog.exportProperty( - ol.ObjectEvent.prototype, - 'key', - ol.ObjectEvent.prototype.key); - -goog.exportProperty( - ol.ObjectEvent.prototype, - 'oldValue', - ol.ObjectEvent.prototype.oldValue); - -goog.exportSymbol( - 'ol.Object', - ol.Object, - OPENLAYERS); - -goog.exportProperty( - ol.Object.prototype, - 'get', - ol.Object.prototype.get); - -goog.exportProperty( - ol.Object.prototype, - 'getKeys', - ol.Object.prototype.getKeys); - -goog.exportProperty( - ol.Object.prototype, - 'getProperties', - ol.Object.prototype.getProperties); - -goog.exportProperty( - ol.Object.prototype, - 'set', - ol.Object.prototype.set); - -goog.exportProperty( - ol.Object.prototype, - 'setProperties', - ol.Object.prototype.setProperties); - -goog.exportProperty( - ol.Object.prototype, - 'unset', - ol.Object.prototype.unset); - -goog.exportSymbol( - 'ol.Observable', - ol.Observable, - OPENLAYERS); - -goog.exportSymbol( - 'ol.Observable.unByKey', - ol.Observable.unByKey, - OPENLAYERS); - -goog.exportProperty( - ol.Observable.prototype, - 'changed', - ol.Observable.prototype.changed); - -goog.exportProperty( - ol.Observable.prototype, - 'dispatchEvent', - ol.Observable.prototype.dispatchEvent); - -goog.exportProperty( - ol.Observable.prototype, - 'getRevision', - ol.Observable.prototype.getRevision); - -goog.exportProperty( - ol.Observable.prototype, - 'on', - ol.Observable.prototype.on); - -goog.exportProperty( - ol.Observable.prototype, - 'once', - ol.Observable.prototype.once); - -goog.exportProperty( - ol.Observable.prototype, - 'un', - ol.Observable.prototype.un); - -goog.exportProperty( - ol.Observable.prototype, - 'unByKey', - ol.Observable.prototype.unByKey); - -goog.exportSymbol( - 'ol.inherits', - ol.inherits, - OPENLAYERS); - -goog.exportSymbol( - 'ol.Overlay', - ol.Overlay, - OPENLAYERS); - -goog.exportProperty( - ol.Overlay.prototype, - 'getElement', - ol.Overlay.prototype.getElement); - -goog.exportProperty( - ol.Overlay.prototype, - 'getId', - ol.Overlay.prototype.getId); - -goog.exportProperty( - ol.Overlay.prototype, - 'getMap', - ol.Overlay.prototype.getMap); - -goog.exportProperty( - ol.Overlay.prototype, - 'getOffset', - ol.Overlay.prototype.getOffset); - -goog.exportProperty( - ol.Overlay.prototype, - 'getPosition', - ol.Overlay.prototype.getPosition); - -goog.exportProperty( - ol.Overlay.prototype, - 'getPositioning', - ol.Overlay.prototype.getPositioning); - -goog.exportProperty( - ol.Overlay.prototype, - 'setElement', - ol.Overlay.prototype.setElement); - -goog.exportProperty( - ol.Overlay.prototype, - 'setMap', - ol.Overlay.prototype.setMap); - -goog.exportProperty( - ol.Overlay.prototype, - 'setOffset', - ol.Overlay.prototype.setOffset); - -goog.exportProperty( - ol.Overlay.prototype, - 'setPosition', - ol.Overlay.prototype.setPosition); - -goog.exportProperty( - ol.Overlay.prototype, - 'setPositioning', - ol.Overlay.prototype.setPositioning); - -goog.exportSymbol( - 'ol.size.toSize', - ol.size.toSize, - OPENLAYERS); - -goog.exportProperty( - ol.Tile.prototype, - 'getTileCoord', - ol.Tile.prototype.getTileCoord); - -goog.exportProperty( - ol.VectorTile.prototype, - 'getFormat', - ol.VectorTile.prototype.getFormat); - -goog.exportProperty( - ol.VectorTile.prototype, - 'setLoader', - ol.VectorTile.prototype.setLoader); - -goog.exportSymbol( - 'ol.View', - ol.View, - OPENLAYERS); - -goog.exportProperty( - ol.View.prototype, - 'constrainCenter', - ol.View.prototype.constrainCenter); - -goog.exportProperty( - ol.View.prototype, - 'constrainResolution', - ol.View.prototype.constrainResolution); - -goog.exportProperty( - ol.View.prototype, - 'constrainRotation', - ol.View.prototype.constrainRotation); - -goog.exportProperty( - ol.View.prototype, - 'getCenter', - ol.View.prototype.getCenter); - -goog.exportProperty( - ol.View.prototype, - 'calculateExtent', - ol.View.prototype.calculateExtent); - -goog.exportProperty( - ol.View.prototype, - 'getProjection', - ol.View.prototype.getProjection); - -goog.exportProperty( - ol.View.prototype, - 'getResolution', - ol.View.prototype.getResolution); - -goog.exportProperty( - ol.View.prototype, - 'getRotation', - ol.View.prototype.getRotation); - -goog.exportProperty( - ol.View.prototype, - 'getZoom', - ol.View.prototype.getZoom); - -goog.exportProperty( - ol.View.prototype, - 'fit', - ol.View.prototype.fit); - -goog.exportProperty( - ol.View.prototype, - 'centerOn', - ol.View.prototype.centerOn); - -goog.exportProperty( - ol.View.prototype, - 'rotate', - ol.View.prototype.rotate); - -goog.exportProperty( - ol.View.prototype, - 'setCenter', - ol.View.prototype.setCenter); - -goog.exportProperty( - ol.View.prototype, - 'setResolution', - ol.View.prototype.setResolution); - -goog.exportProperty( - ol.View.prototype, - 'setRotation', - ol.View.prototype.setRotation); - -goog.exportProperty( - ol.View.prototype, - 'setZoom', - ol.View.prototype.setZoom); - -goog.exportSymbol( - 'ol.xml.getAllTextContent', - ol.xml.getAllTextContent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.xml.parse', - ol.xml.parse, - OPENLAYERS); - -goog.exportProperty( - ol.webgl.Context.prototype, - 'getGL', - ol.webgl.Context.prototype.getGL); - -goog.exportProperty( - ol.webgl.Context.prototype, - 'useProgram', - ol.webgl.Context.prototype.useProgram); - -goog.exportSymbol( - 'ol.tilegrid.TileGrid', - ol.tilegrid.TileGrid, - OPENLAYERS); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getMaxZoom', - ol.tilegrid.TileGrid.prototype.getMaxZoom); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getMinZoom', - ol.tilegrid.TileGrid.prototype.getMinZoom); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getOrigin', - ol.tilegrid.TileGrid.prototype.getOrigin); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getResolution', - ol.tilegrid.TileGrid.prototype.getResolution); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getResolutions', - ol.tilegrid.TileGrid.prototype.getResolutions); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getTileCoordExtent', - ol.tilegrid.TileGrid.prototype.getTileCoordExtent); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getTileCoordForCoordAndResolution', - ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolution); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getTileCoordForCoordAndZ', - ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndZ); - -goog.exportProperty( - ol.tilegrid.TileGrid.prototype, - 'getTileSize', - ol.tilegrid.TileGrid.prototype.getTileSize); - -goog.exportSymbol( - 'ol.tilegrid.createXYZ', - ol.tilegrid.createXYZ, - OPENLAYERS); - -goog.exportSymbol( - 'ol.tilegrid.WMTS', - ol.tilegrid.WMTS, - OPENLAYERS); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getMatrixIds', - ol.tilegrid.WMTS.prototype.getMatrixIds); - -goog.exportSymbol( - 'ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet', - ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet, - OPENLAYERS); - -goog.exportSymbol( - 'ol.style.AtlasManager', - ol.style.AtlasManager, - OPENLAYERS); - -goog.exportSymbol( - 'ol.style.Circle', - ol.style.Circle, - OPENLAYERS); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getFill', - ol.style.Circle.prototype.getFill); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getImage', - ol.style.Circle.prototype.getImage); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getRadius', - ol.style.Circle.prototype.getRadius); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getStroke', - ol.style.Circle.prototype.getStroke); - -goog.exportSymbol( - 'ol.style.Fill', - ol.style.Fill, - OPENLAYERS); - -goog.exportProperty( - ol.style.Fill.prototype, - 'getColor', - ol.style.Fill.prototype.getColor); - -goog.exportProperty( - ol.style.Fill.prototype, - 'setColor', - ol.style.Fill.prototype.setColor); - -goog.exportSymbol( - 'ol.style.Icon', - ol.style.Icon, - OPENLAYERS); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getAnchor', - ol.style.Icon.prototype.getAnchor); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getImage', - ol.style.Icon.prototype.getImage); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getOrigin', - ol.style.Icon.prototype.getOrigin); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getSrc', - ol.style.Icon.prototype.getSrc); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getSize', - ol.style.Icon.prototype.getSize); - -goog.exportProperty( - ol.style.Icon.prototype, - 'load', - ol.style.Icon.prototype.load); - -goog.exportSymbol( - 'ol.style.Image', - ol.style.Image, - OPENLAYERS); - -goog.exportProperty( - ol.style.Image.prototype, - 'getOpacity', - ol.style.Image.prototype.getOpacity); - -goog.exportProperty( - ol.style.Image.prototype, - 'getRotateWithView', - ol.style.Image.prototype.getRotateWithView); - -goog.exportProperty( - ol.style.Image.prototype, - 'getRotation', - ol.style.Image.prototype.getRotation); - -goog.exportProperty( - ol.style.Image.prototype, - 'getScale', - ol.style.Image.prototype.getScale); - -goog.exportProperty( - ol.style.Image.prototype, - 'getSnapToPixel', - ol.style.Image.prototype.getSnapToPixel); - -goog.exportProperty( - ol.style.Image.prototype, - 'setOpacity', - ol.style.Image.prototype.setOpacity); - -goog.exportProperty( - ol.style.Image.prototype, - 'setRotation', - ol.style.Image.prototype.setRotation); - -goog.exportProperty( - ol.style.Image.prototype, - 'setScale', - ol.style.Image.prototype.setScale); - -goog.exportSymbol( - 'ol.style.RegularShape', - ol.style.RegularShape, - OPENLAYERS); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getAnchor', - ol.style.RegularShape.prototype.getAnchor); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getAngle', - ol.style.RegularShape.prototype.getAngle); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getFill', - ol.style.RegularShape.prototype.getFill); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getImage', - ol.style.RegularShape.prototype.getImage); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getOrigin', - ol.style.RegularShape.prototype.getOrigin); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getPoints', - ol.style.RegularShape.prototype.getPoints); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getRadius', - ol.style.RegularShape.prototype.getRadius); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getRadius2', - ol.style.RegularShape.prototype.getRadius2); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getSize', - ol.style.RegularShape.prototype.getSize); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getStroke', - ol.style.RegularShape.prototype.getStroke); - -goog.exportSymbol( - 'ol.style.Stroke', - ol.style.Stroke, - OPENLAYERS); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'getColor', - ol.style.Stroke.prototype.getColor); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'getLineCap', - ol.style.Stroke.prototype.getLineCap); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'getLineDash', - ol.style.Stroke.prototype.getLineDash); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'getLineJoin', - ol.style.Stroke.prototype.getLineJoin); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'getMiterLimit', - ol.style.Stroke.prototype.getMiterLimit); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'getWidth', - ol.style.Stroke.prototype.getWidth); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'setColor', - ol.style.Stroke.prototype.setColor); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'setLineCap', - ol.style.Stroke.prototype.setLineCap); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'setLineDash', - ol.style.Stroke.prototype.setLineDash); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'setLineJoin', - ol.style.Stroke.prototype.setLineJoin); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'setMiterLimit', - ol.style.Stroke.prototype.setMiterLimit); - -goog.exportProperty( - ol.style.Stroke.prototype, - 'setWidth', - ol.style.Stroke.prototype.setWidth); - -goog.exportSymbol( - 'ol.style.Style', - ol.style.Style, - OPENLAYERS); - -goog.exportProperty( - ol.style.Style.prototype, - 'getGeometry', - ol.style.Style.prototype.getGeometry); - -goog.exportProperty( - ol.style.Style.prototype, - 'getGeometryFunction', - ol.style.Style.prototype.getGeometryFunction); - -goog.exportProperty( - ol.style.Style.prototype, - 'getFill', - ol.style.Style.prototype.getFill); - -goog.exportProperty( - ol.style.Style.prototype, - 'getImage', - ol.style.Style.prototype.getImage); - -goog.exportProperty( - ol.style.Style.prototype, - 'getStroke', - ol.style.Style.prototype.getStroke); - -goog.exportProperty( - ol.style.Style.prototype, - 'getText', - ol.style.Style.prototype.getText); - -goog.exportProperty( - ol.style.Style.prototype, - 'getZIndex', - ol.style.Style.prototype.getZIndex); - -goog.exportProperty( - ol.style.Style.prototype, - 'setGeometry', - ol.style.Style.prototype.setGeometry); - -goog.exportProperty( - ol.style.Style.prototype, - 'setZIndex', - ol.style.Style.prototype.setZIndex); - -goog.exportSymbol( - 'ol.style.Text', - ol.style.Text, - OPENLAYERS); - -goog.exportProperty( - ol.style.Text.prototype, - 'getFont', - ol.style.Text.prototype.getFont); - -goog.exportProperty( - ol.style.Text.prototype, - 'getOffsetX', - ol.style.Text.prototype.getOffsetX); - -goog.exportProperty( - ol.style.Text.prototype, - 'getOffsetY', - ol.style.Text.prototype.getOffsetY); - -goog.exportProperty( - ol.style.Text.prototype, - 'getFill', - ol.style.Text.prototype.getFill); - -goog.exportProperty( - ol.style.Text.prototype, - 'getRotation', - ol.style.Text.prototype.getRotation); - -goog.exportProperty( - ol.style.Text.prototype, - 'getScale', - ol.style.Text.prototype.getScale); - -goog.exportProperty( - ol.style.Text.prototype, - 'getStroke', - ol.style.Text.prototype.getStroke); - -goog.exportProperty( - ol.style.Text.prototype, - 'getText', - ol.style.Text.prototype.getText); - -goog.exportProperty( - ol.style.Text.prototype, - 'getTextAlign', - ol.style.Text.prototype.getTextAlign); - -goog.exportProperty( - ol.style.Text.prototype, - 'getTextBaseline', - ol.style.Text.prototype.getTextBaseline); - -goog.exportProperty( - ol.style.Text.prototype, - 'setFont', - ol.style.Text.prototype.setFont); - -goog.exportProperty( - ol.style.Text.prototype, - 'setOffsetX', - ol.style.Text.prototype.setOffsetX); - -goog.exportProperty( - ol.style.Text.prototype, - 'setOffsetY', - ol.style.Text.prototype.setOffsetY); - -goog.exportProperty( - ol.style.Text.prototype, - 'setFill', - ol.style.Text.prototype.setFill); - -goog.exportProperty( - ol.style.Text.prototype, - 'setRotation', - ol.style.Text.prototype.setRotation); - -goog.exportProperty( - ol.style.Text.prototype, - 'setScale', - ol.style.Text.prototype.setScale); - -goog.exportProperty( - ol.style.Text.prototype, - 'setStroke', - ol.style.Text.prototype.setStroke); - -goog.exportProperty( - ol.style.Text.prototype, - 'setText', - ol.style.Text.prototype.setText); - -goog.exportProperty( - ol.style.Text.prototype, - 'setTextAlign', - ol.style.Text.prototype.setTextAlign); - -goog.exportProperty( - ol.style.Text.prototype, - 'setTextBaseline', - ol.style.Text.prototype.setTextBaseline); - -goog.exportSymbol( - 'ol.Sphere', - ol.Sphere, - OPENLAYERS); - -goog.exportProperty( - ol.Sphere.prototype, - 'geodesicArea', - ol.Sphere.prototype.geodesicArea); - -goog.exportProperty( - ol.Sphere.prototype, - 'haversineDistance', - ol.Sphere.prototype.haversineDistance); - -goog.exportSymbol( - 'ol.source.BingMaps', - ol.source.BingMaps, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.BingMaps.TOS_ATTRIBUTION', - ol.source.BingMaps.TOS_ATTRIBUTION, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.Cluster', - ol.source.Cluster, - OPENLAYERS); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getSource', - ol.source.Cluster.prototype.getSource); - -goog.exportSymbol( - 'ol.source.ImageCanvas', - ol.source.ImageCanvas, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.ImageMapGuide', - ol.source.ImageMapGuide, - OPENLAYERS); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getParams', - ol.source.ImageMapGuide.prototype.getParams); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getImageLoadFunction', - ol.source.ImageMapGuide.prototype.getImageLoadFunction); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'updateParams', - ol.source.ImageMapGuide.prototype.updateParams); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'setImageLoadFunction', - ol.source.ImageMapGuide.prototype.setImageLoadFunction); - -goog.exportSymbol( - 'ol.source.Image', - ol.source.Image, - OPENLAYERS); - -goog.exportProperty( - ol.source.ImageEvent.prototype, - 'image', - ol.source.ImageEvent.prototype.image); - -goog.exportSymbol( - 'ol.source.ImageStatic', - ol.source.ImageStatic, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.ImageVector', - ol.source.ImageVector, - OPENLAYERS); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getSource', - ol.source.ImageVector.prototype.getSource); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getStyle', - ol.source.ImageVector.prototype.getStyle); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getStyleFunction', - ol.source.ImageVector.prototype.getStyleFunction); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'setStyle', - ol.source.ImageVector.prototype.setStyle); - -goog.exportSymbol( - 'ol.source.ImageWMS', - ol.source.ImageWMS, - OPENLAYERS); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getGetFeatureInfoUrl', - ol.source.ImageWMS.prototype.getGetFeatureInfoUrl); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getParams', - ol.source.ImageWMS.prototype.getParams); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getImageLoadFunction', - ol.source.ImageWMS.prototype.getImageLoadFunction); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getUrl', - ol.source.ImageWMS.prototype.getUrl); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'setImageLoadFunction', - ol.source.ImageWMS.prototype.setImageLoadFunction); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'setUrl', - ol.source.ImageWMS.prototype.setUrl); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'updateParams', - ol.source.ImageWMS.prototype.updateParams); - -goog.exportSymbol( - 'ol.source.MapQuest', - ol.source.MapQuest, - OPENLAYERS); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getLayer', - ol.source.MapQuest.prototype.getLayer); - -goog.exportSymbol( - 'ol.source.OSM', - ol.source.OSM, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.OSM.ATTRIBUTION', - ol.source.OSM.ATTRIBUTION, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.Raster', - ol.source.Raster, - OPENLAYERS); - -goog.exportProperty( - ol.source.Raster.prototype, - 'setOperation', - ol.source.Raster.prototype.setOperation); - -goog.exportProperty( - ol.source.RasterEvent.prototype, - 'extent', - ol.source.RasterEvent.prototype.extent); - -goog.exportProperty( - ol.source.RasterEvent.prototype, - 'resolution', - ol.source.RasterEvent.prototype.resolution); - -goog.exportProperty( - ol.source.RasterEvent.prototype, - 'data', - ol.source.RasterEvent.prototype.data); - -goog.exportSymbol( - 'ol.source.Source', - ol.source.Source, - OPENLAYERS); - -goog.exportProperty( - ol.source.Source.prototype, - 'getAttributions', - ol.source.Source.prototype.getAttributions); - -goog.exportProperty( - ol.source.Source.prototype, - 'getLogo', - ol.source.Source.prototype.getLogo); - -goog.exportProperty( - ol.source.Source.prototype, - 'getProjection', - ol.source.Source.prototype.getProjection); - -goog.exportProperty( - ol.source.Source.prototype, - 'getState', - ol.source.Source.prototype.getState); - -goog.exportProperty( - ol.source.Source.prototype, - 'setAttributions', - ol.source.Source.prototype.setAttributions); - -goog.exportSymbol( - 'ol.source.Stamen', - ol.source.Stamen, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.TileArcGISRest', - ol.source.TileArcGISRest, - OPENLAYERS); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getParams', - ol.source.TileArcGISRest.prototype.getParams); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'updateParams', - ol.source.TileArcGISRest.prototype.updateParams); - -goog.exportSymbol( - 'ol.source.TileDebug', - ol.source.TileDebug, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.TileImage', - ol.source.TileImage, - OPENLAYERS); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'setRenderReprojectionEdges', - ol.source.TileImage.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'setTileGridForProjection', - ol.source.TileImage.prototype.setTileGridForProjection); - -goog.exportSymbol( - 'ol.source.TileJSON', - ol.source.TileJSON, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.Tile', - ol.source.Tile, - OPENLAYERS); - -goog.exportProperty( - ol.source.Tile.prototype, - 'getTileGrid', - ol.source.Tile.prototype.getTileGrid); - -goog.exportProperty( - ol.source.TileEvent.prototype, - 'tile', - ol.source.TileEvent.prototype.tile); - -goog.exportSymbol( - 'ol.source.TileUTFGrid', - ol.source.TileUTFGrid, - OPENLAYERS); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getTemplate', - ol.source.TileUTFGrid.prototype.getTemplate); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'forDataAtCoordinateAndResolution', - ol.source.TileUTFGrid.prototype.forDataAtCoordinateAndResolution); - -goog.exportSymbol( - 'ol.source.TileWMS', - ol.source.TileWMS, - OPENLAYERS); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getGetFeatureInfoUrl', - ol.source.TileWMS.prototype.getGetFeatureInfoUrl); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getParams', - ol.source.TileWMS.prototype.getParams); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'updateParams', - ol.source.TileWMS.prototype.updateParams); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getTileLoadFunction', - ol.source.UrlTile.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getTileUrlFunction', - ol.source.UrlTile.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getUrls', - ol.source.UrlTile.prototype.getUrls); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'setTileLoadFunction', - ol.source.UrlTile.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'setTileUrlFunction', - ol.source.UrlTile.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'setUrl', - ol.source.UrlTile.prototype.setUrl); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'setUrls', - ol.source.UrlTile.prototype.setUrls); - -goog.exportSymbol( - 'ol.source.Vector', - ol.source.Vector, - OPENLAYERS); - -goog.exportProperty( - ol.source.Vector.prototype, - 'addFeature', - ol.source.Vector.prototype.addFeature); - -goog.exportProperty( - ol.source.Vector.prototype, - 'addFeatures', - ol.source.Vector.prototype.addFeatures); - -goog.exportProperty( - ol.source.Vector.prototype, - 'clear', - ol.source.Vector.prototype.clear); - -goog.exportProperty( - ol.source.Vector.prototype, - 'forEachFeature', - ol.source.Vector.prototype.forEachFeature); - -goog.exportProperty( - ol.source.Vector.prototype, - 'forEachFeatureInExtent', - ol.source.Vector.prototype.forEachFeatureInExtent); - -goog.exportProperty( - ol.source.Vector.prototype, - 'forEachFeatureIntersectingExtent', - ol.source.Vector.prototype.forEachFeatureIntersectingExtent); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getFeaturesCollection', - ol.source.Vector.prototype.getFeaturesCollection); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getFeatures', - ol.source.Vector.prototype.getFeatures); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getFeaturesAtCoordinate', - ol.source.Vector.prototype.getFeaturesAtCoordinate); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getFeaturesInExtent', - ol.source.Vector.prototype.getFeaturesInExtent); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getClosestFeatureToCoordinate', - ol.source.Vector.prototype.getClosestFeatureToCoordinate); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getExtent', - ol.source.Vector.prototype.getExtent); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getFeatureById', - ol.source.Vector.prototype.getFeatureById); - -goog.exportProperty( - ol.source.Vector.prototype, - 'removeFeature', - ol.source.Vector.prototype.removeFeature); - -goog.exportProperty( - ol.source.VectorEvent.prototype, - 'feature', - ol.source.VectorEvent.prototype.feature); - -goog.exportSymbol( - 'ol.source.VectorTile', - ol.source.VectorTile, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.WMTS', - ol.source.WMTS, - OPENLAYERS); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getDimensions', - ol.source.WMTS.prototype.getDimensions); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getFormat', - ol.source.WMTS.prototype.getFormat); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getLayer', - ol.source.WMTS.prototype.getLayer); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getMatrixSet', - ol.source.WMTS.prototype.getMatrixSet); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getRequestEncoding', - ol.source.WMTS.prototype.getRequestEncoding); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getStyle', - ol.source.WMTS.prototype.getStyle); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getVersion', - ol.source.WMTS.prototype.getVersion); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'updateDimensions', - ol.source.WMTS.prototype.updateDimensions); - -goog.exportSymbol( - 'ol.source.WMTS.optionsFromCapabilities', - ol.source.WMTS.optionsFromCapabilities, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.XYZ', - ol.source.XYZ, - OPENLAYERS); - -goog.exportSymbol( - 'ol.source.Zoomify', - ol.source.Zoomify, - OPENLAYERS); - -goog.exportProperty( - ol.render.Event.prototype, - 'vectorContext', - ol.render.Event.prototype.vectorContext); - -goog.exportProperty( - ol.render.Event.prototype, - 'frameState', - ol.render.Event.prototype.frameState); - -goog.exportProperty( - ol.render.Event.prototype, - 'context', - ol.render.Event.prototype.context); - -goog.exportProperty( - ol.render.Event.prototype, - 'glContext', - ol.render.Event.prototype.glContext); - -goog.exportProperty( - ol.render.Feature.prototype, - 'get', - ol.render.Feature.prototype.get); - -goog.exportProperty( - ol.render.Feature.prototype, - 'getExtent', - ol.render.Feature.prototype.getExtent); - -goog.exportProperty( - ol.render.Feature.prototype, - 'getGeometry', - ol.render.Feature.prototype.getGeometry); - -goog.exportProperty( - ol.render.Feature.prototype, - 'getProperties', - ol.render.Feature.prototype.getProperties); - -goog.exportProperty( - ol.render.Feature.prototype, - 'getType', - ol.render.Feature.prototype.getType); - -goog.exportSymbol( - 'ol.render.VectorContext', - ol.render.VectorContext, - OPENLAYERS); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawAsync', - ol.render.webgl.Immediate.prototype.drawAsync); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawCircleGeometry', - ol.render.webgl.Immediate.prototype.drawCircleGeometry); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawFeature', - ol.render.webgl.Immediate.prototype.drawFeature); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawGeometryCollectionGeometry', - ol.render.webgl.Immediate.prototype.drawGeometryCollectionGeometry); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawPointGeometry', - ol.render.webgl.Immediate.prototype.drawPointGeometry); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawLineStringGeometry', - ol.render.webgl.Immediate.prototype.drawLineStringGeometry); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawMultiLineStringGeometry', - ol.render.webgl.Immediate.prototype.drawMultiLineStringGeometry); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawMultiPointGeometry', - ol.render.webgl.Immediate.prototype.drawMultiPointGeometry); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawMultiPolygonGeometry', - ol.render.webgl.Immediate.prototype.drawMultiPolygonGeometry); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawPolygonGeometry', - ol.render.webgl.Immediate.prototype.drawPolygonGeometry); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'drawText', - ol.render.webgl.Immediate.prototype.drawText); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'setFillStrokeStyle', - ol.render.webgl.Immediate.prototype.setFillStrokeStyle); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'setImageStyle', - ol.render.webgl.Immediate.prototype.setImageStyle); - -goog.exportProperty( - ol.render.webgl.Immediate.prototype, - 'setTextStyle', - ol.render.webgl.Immediate.prototype.setTextStyle); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawAsync', - ol.render.canvas.Immediate.prototype.drawAsync); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawCircleGeometry', - ol.render.canvas.Immediate.prototype.drawCircleGeometry); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawFeature', - ol.render.canvas.Immediate.prototype.drawFeature); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawPointGeometry', - ol.render.canvas.Immediate.prototype.drawPointGeometry); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawMultiPointGeometry', - ol.render.canvas.Immediate.prototype.drawMultiPointGeometry); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawLineStringGeometry', - ol.render.canvas.Immediate.prototype.drawLineStringGeometry); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawMultiLineStringGeometry', - ol.render.canvas.Immediate.prototype.drawMultiLineStringGeometry); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawPolygonGeometry', - ol.render.canvas.Immediate.prototype.drawPolygonGeometry); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'drawMultiPolygonGeometry', - ol.render.canvas.Immediate.prototype.drawMultiPolygonGeometry); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'setFillStrokeStyle', - ol.render.canvas.Immediate.prototype.setFillStrokeStyle); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'setImageStyle', - ol.render.canvas.Immediate.prototype.setImageStyle); - -goog.exportProperty( - ol.render.canvas.Immediate.prototype, - 'setTextStyle', - ol.render.canvas.Immediate.prototype.setTextStyle); - -goog.exportSymbol( - 'ol.proj.common.add', - ol.proj.common.add, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.METERS_PER_UNIT', - ol.proj.METERS_PER_UNIT, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.Projection', - ol.proj.Projection, - OPENLAYERS); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'getCode', - ol.proj.Projection.prototype.getCode); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'getExtent', - ol.proj.Projection.prototype.getExtent); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'getUnits', - ol.proj.Projection.prototype.getUnits); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'getMetersPerUnit', - ol.proj.Projection.prototype.getMetersPerUnit); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'getWorldExtent', - ol.proj.Projection.prototype.getWorldExtent); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'isGlobal', - ol.proj.Projection.prototype.isGlobal); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'setGlobal', - ol.proj.Projection.prototype.setGlobal); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'setExtent', - ol.proj.Projection.prototype.setExtent); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'setWorldExtent', - ol.proj.Projection.prototype.setWorldExtent); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'setGetPointResolution', - ol.proj.Projection.prototype.setGetPointResolution); - -goog.exportProperty( - ol.proj.Projection.prototype, - 'getPointResolution', - ol.proj.Projection.prototype.getPointResolution); - -goog.exportSymbol( - 'ol.proj.addEquivalentProjections', - ol.proj.addEquivalentProjections, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.addProjection', - ol.proj.addProjection, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.addCoordinateTransforms', - ol.proj.addCoordinateTransforms, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.fromLonLat', - ol.proj.fromLonLat, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.toLonLat', - ol.proj.toLonLat, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.get', - ol.proj.get, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.getTransform', - ol.proj.getTransform, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.transform', - ol.proj.transform, - OPENLAYERS); - -goog.exportSymbol( - 'ol.proj.transformExtent', - ol.proj.transformExtent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.layer.Heatmap', - ol.layer.Heatmap, - OPENLAYERS); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getBlur', - ol.layer.Heatmap.prototype.getBlur); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getGradient', - ol.layer.Heatmap.prototype.getGradient); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getRadius', - ol.layer.Heatmap.prototype.getRadius); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setBlur', - ol.layer.Heatmap.prototype.setBlur); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setGradient', - ol.layer.Heatmap.prototype.setGradient); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setRadius', - ol.layer.Heatmap.prototype.setRadius); - -goog.exportSymbol( - 'ol.layer.Image', - ol.layer.Image, - OPENLAYERS); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getSource', - ol.layer.Image.prototype.getSource); - -goog.exportSymbol( - 'ol.layer.Layer', - ol.layer.Layer, - OPENLAYERS); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getSource', - ol.layer.Layer.prototype.getSource); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setMap', - ol.layer.Layer.prototype.setMap); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setSource', - ol.layer.Layer.prototype.setSource); - -goog.exportSymbol( - 'ol.layer.Base', - ol.layer.Base, - OPENLAYERS); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getExtent', - ol.layer.Base.prototype.getExtent); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getMaxResolution', - ol.layer.Base.prototype.getMaxResolution); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getMinResolution', - ol.layer.Base.prototype.getMinResolution); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getOpacity', - ol.layer.Base.prototype.getOpacity); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getVisible', - ol.layer.Base.prototype.getVisible); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getZIndex', - ol.layer.Base.prototype.getZIndex); - -goog.exportProperty( - ol.layer.Base.prototype, - 'setExtent', - ol.layer.Base.prototype.setExtent); - -goog.exportProperty( - ol.layer.Base.prototype, - 'setMaxResolution', - ol.layer.Base.prototype.setMaxResolution); - -goog.exportProperty( - ol.layer.Base.prototype, - 'setMinResolution', - ol.layer.Base.prototype.setMinResolution); - -goog.exportProperty( - ol.layer.Base.prototype, - 'setOpacity', - ol.layer.Base.prototype.setOpacity); - -goog.exportProperty( - ol.layer.Base.prototype, - 'setVisible', - ol.layer.Base.prototype.setVisible); - -goog.exportProperty( - ol.layer.Base.prototype, - 'setZIndex', - ol.layer.Base.prototype.setZIndex); - -goog.exportSymbol( - 'ol.layer.Group', - ol.layer.Group, - OPENLAYERS); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getLayers', - ol.layer.Group.prototype.getLayers); - -goog.exportProperty( - ol.layer.Group.prototype, - 'setLayers', - ol.layer.Group.prototype.setLayers); - -goog.exportSymbol( - 'ol.layer.Tile', - ol.layer.Tile, - OPENLAYERS); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getPreload', - ol.layer.Tile.prototype.getPreload); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getSource', - ol.layer.Tile.prototype.getSource); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setPreload', - ol.layer.Tile.prototype.setPreload); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getUseInterimTilesOnError', - ol.layer.Tile.prototype.getUseInterimTilesOnError); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setUseInterimTilesOnError', - ol.layer.Tile.prototype.setUseInterimTilesOnError); - -goog.exportSymbol( - 'ol.layer.Vector', - ol.layer.Vector, - OPENLAYERS); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getSource', - ol.layer.Vector.prototype.getSource); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getStyle', - ol.layer.Vector.prototype.getStyle); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getStyleFunction', - ol.layer.Vector.prototype.getStyleFunction); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setStyle', - ol.layer.Vector.prototype.setStyle); - -goog.exportSymbol( - 'ol.layer.VectorTile', - ol.layer.VectorTile, - OPENLAYERS); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getPreload', - ol.layer.VectorTile.prototype.getPreload); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getSource', - ol.layer.VectorTile.prototype.getSource); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getUseInterimTilesOnError', - ol.layer.VectorTile.prototype.getUseInterimTilesOnError); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setPreload', - ol.layer.VectorTile.prototype.setPreload); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setUseInterimTilesOnError', - ol.layer.VectorTile.prototype.setUseInterimTilesOnError); - -goog.exportSymbol( - 'ol.interaction.DoubleClickZoom', - ol.interaction.DoubleClickZoom, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.DoubleClickZoom.handleEvent', - ol.interaction.DoubleClickZoom.handleEvent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.DragAndDrop', - ol.interaction.DragAndDrop, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.DragAndDrop.handleEvent', - ol.interaction.DragAndDrop.handleEvent, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.DragAndDropEvent.prototype, - 'features', - ol.interaction.DragAndDropEvent.prototype.features); - -goog.exportProperty( - ol.interaction.DragAndDropEvent.prototype, - 'file', - ol.interaction.DragAndDropEvent.prototype.file); - -goog.exportProperty( - ol.interaction.DragAndDropEvent.prototype, - 'projection', - ol.interaction.DragAndDropEvent.prototype.projection); - -goog.exportProperty( - ol.DragBoxEvent.prototype, - 'coordinate', - ol.DragBoxEvent.prototype.coordinate); - -goog.exportSymbol( - 'ol.interaction.DragBox', - ol.interaction.DragBox, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'getGeometry', - ol.interaction.DragBox.prototype.getGeometry); - -goog.exportSymbol( - 'ol.interaction.DragPan', - ol.interaction.DragPan, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.DragRotateAndZoom', - ol.interaction.DragRotateAndZoom, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.DragRotate', - ol.interaction.DragRotate, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.DragZoom', - ol.interaction.DragZoom, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.DrawEvent.prototype, - 'feature', - ol.interaction.DrawEvent.prototype.feature); - -goog.exportSymbol( - 'ol.interaction.Draw', - ol.interaction.Draw, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.Draw.handleEvent', - ol.interaction.Draw.handleEvent, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'removeLastPoint', - ol.interaction.Draw.prototype.removeLastPoint); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'finishDrawing', - ol.interaction.Draw.prototype.finishDrawing); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'extend', - ol.interaction.Draw.prototype.extend); - -goog.exportSymbol( - 'ol.interaction.Draw.createRegularPolygon', - ol.interaction.Draw.createRegularPolygon, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.Interaction', - ol.interaction.Interaction, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'getActive', - ol.interaction.Interaction.prototype.getActive); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'setActive', - ol.interaction.Interaction.prototype.setActive); - -goog.exportSymbol( - 'ol.interaction.defaults', - ol.interaction.defaults, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.KeyboardPan', - ol.interaction.KeyboardPan, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.KeyboardPan.handleEvent', - ol.interaction.KeyboardPan.handleEvent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.KeyboardZoom', - ol.interaction.KeyboardZoom, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.KeyboardZoom.handleEvent', - ol.interaction.KeyboardZoom.handleEvent, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.ModifyEvent.prototype, - 'features', - ol.interaction.ModifyEvent.prototype.features); - -goog.exportProperty( - ol.interaction.ModifyEvent.prototype, - 'mapBrowserPointerEvent', - ol.interaction.ModifyEvent.prototype.mapBrowserPointerEvent); - -goog.exportSymbol( - 'ol.interaction.Modify', - ol.interaction.Modify, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.Modify.handleEvent', - ol.interaction.Modify.handleEvent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.MouseWheelZoom', - ol.interaction.MouseWheelZoom, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.MouseWheelZoom.handleEvent', - ol.interaction.MouseWheelZoom.handleEvent, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'setMouseAnchor', - ol.interaction.MouseWheelZoom.prototype.setMouseAnchor); - -goog.exportSymbol( - 'ol.interaction.PinchRotate', - ol.interaction.PinchRotate, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.PinchZoom', - ol.interaction.PinchZoom, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.Pointer', - ol.interaction.Pointer, - OPENLAYERS); - -goog.exportSymbol( - 'ol.interaction.Pointer.handleEvent', - ol.interaction.Pointer.handleEvent, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.SelectEvent.prototype, - 'selected', - ol.interaction.SelectEvent.prototype.selected); - -goog.exportProperty( - ol.interaction.SelectEvent.prototype, - 'deselected', - ol.interaction.SelectEvent.prototype.deselected); - -goog.exportProperty( - ol.interaction.SelectEvent.prototype, - 'mapBrowserEvent', - ol.interaction.SelectEvent.prototype.mapBrowserEvent); - -goog.exportSymbol( - 'ol.interaction.Select', - ol.interaction.Select, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'getFeatures', - ol.interaction.Select.prototype.getFeatures); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'getLayer', - ol.interaction.Select.prototype.getLayer); - -goog.exportSymbol( - 'ol.interaction.Select.handleEvent', - ol.interaction.Select.handleEvent, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'setMap', - ol.interaction.Select.prototype.setMap); - -goog.exportSymbol( - 'ol.interaction.Snap', - ol.interaction.Snap, - OPENLAYERS); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'addFeature', - ol.interaction.Snap.prototype.addFeature); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'removeFeature', - ol.interaction.Snap.prototype.removeFeature); - -goog.exportProperty( - ol.interaction.TranslateEvent.prototype, - 'features', - ol.interaction.TranslateEvent.prototype.features); - -goog.exportProperty( - ol.interaction.TranslateEvent.prototype, - 'coordinate', - ol.interaction.TranslateEvent.prototype.coordinate); - -goog.exportSymbol( - 'ol.interaction.Translate', - ol.interaction.Translate, - OPENLAYERS); - -goog.exportSymbol( - 'ol.geom.Circle', - ol.geom.Circle, - OPENLAYERS); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'clone', - ol.geom.Circle.prototype.clone); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getCenter', - ol.geom.Circle.prototype.getCenter); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getRadius', - ol.geom.Circle.prototype.getRadius); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getType', - ol.geom.Circle.prototype.getType); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'intersectsExtent', - ol.geom.Circle.prototype.intersectsExtent); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'setCenter', - ol.geom.Circle.prototype.setCenter); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'setCenterAndRadius', - ol.geom.Circle.prototype.setCenterAndRadius); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'setRadius', - ol.geom.Circle.prototype.setRadius); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'transform', - ol.geom.Circle.prototype.transform); - -goog.exportSymbol( - 'ol.geom.Geometry', - ol.geom.Geometry, - OPENLAYERS); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'getClosestPoint', - ol.geom.Geometry.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'getExtent', - ol.geom.Geometry.prototype.getExtent); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'simplify', - ol.geom.Geometry.prototype.simplify); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'transform', - ol.geom.Geometry.prototype.transform); - -goog.exportSymbol( - 'ol.geom.GeometryCollection', - ol.geom.GeometryCollection, - OPENLAYERS); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'clone', - ol.geom.GeometryCollection.prototype.clone); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'getGeometries', - ol.geom.GeometryCollection.prototype.getGeometries); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'getType', - ol.geom.GeometryCollection.prototype.getType); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'intersectsExtent', - ol.geom.GeometryCollection.prototype.intersectsExtent); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'setGeometries', - ol.geom.GeometryCollection.prototype.setGeometries); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'applyTransform', - ol.geom.GeometryCollection.prototype.applyTransform); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'translate', - ol.geom.GeometryCollection.prototype.translate); - -goog.exportSymbol( - 'ol.geom.LinearRing', - ol.geom.LinearRing, - OPENLAYERS); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'clone', - ol.geom.LinearRing.prototype.clone); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getArea', - ol.geom.LinearRing.prototype.getArea); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getCoordinates', - ol.geom.LinearRing.prototype.getCoordinates); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getType', - ol.geom.LinearRing.prototype.getType); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'setCoordinates', - ol.geom.LinearRing.prototype.setCoordinates); - -goog.exportSymbol( - 'ol.geom.LineString', - ol.geom.LineString, - OPENLAYERS); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'appendCoordinate', - ol.geom.LineString.prototype.appendCoordinate); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'clone', - ol.geom.LineString.prototype.clone); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'forEachSegment', - ol.geom.LineString.prototype.forEachSegment); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getCoordinateAtM', - ol.geom.LineString.prototype.getCoordinateAtM); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getCoordinates', - ol.geom.LineString.prototype.getCoordinates); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getLength', - ol.geom.LineString.prototype.getLength); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getType', - ol.geom.LineString.prototype.getType); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'intersectsExtent', - ol.geom.LineString.prototype.intersectsExtent); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'setCoordinates', - ol.geom.LineString.prototype.setCoordinates); - -goog.exportSymbol( - 'ol.geom.MultiLineString', - ol.geom.MultiLineString, - OPENLAYERS); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'appendLineString', - ol.geom.MultiLineString.prototype.appendLineString); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'clone', - ol.geom.MultiLineString.prototype.clone); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getCoordinateAtM', - ol.geom.MultiLineString.prototype.getCoordinateAtM); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getCoordinates', - ol.geom.MultiLineString.prototype.getCoordinates); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getLineString', - ol.geom.MultiLineString.prototype.getLineString); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getLineStrings', - ol.geom.MultiLineString.prototype.getLineStrings); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getType', - ol.geom.MultiLineString.prototype.getType); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'intersectsExtent', - ol.geom.MultiLineString.prototype.intersectsExtent); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'setCoordinates', - ol.geom.MultiLineString.prototype.setCoordinates); - -goog.exportSymbol( - 'ol.geom.MultiPoint', - ol.geom.MultiPoint, - OPENLAYERS); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'appendPoint', - ol.geom.MultiPoint.prototype.appendPoint); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'clone', - ol.geom.MultiPoint.prototype.clone); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getCoordinates', - ol.geom.MultiPoint.prototype.getCoordinates); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getPoint', - ol.geom.MultiPoint.prototype.getPoint); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getPoints', - ol.geom.MultiPoint.prototype.getPoints); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getType', - ol.geom.MultiPoint.prototype.getType); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'intersectsExtent', - ol.geom.MultiPoint.prototype.intersectsExtent); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'setCoordinates', - ol.geom.MultiPoint.prototype.setCoordinates); - -goog.exportSymbol( - 'ol.geom.MultiPolygon', - ol.geom.MultiPolygon, - OPENLAYERS); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'appendPolygon', - ol.geom.MultiPolygon.prototype.appendPolygon); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'clone', - ol.geom.MultiPolygon.prototype.clone); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getArea', - ol.geom.MultiPolygon.prototype.getArea); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getCoordinates', - ol.geom.MultiPolygon.prototype.getCoordinates); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getInteriorPoints', - ol.geom.MultiPolygon.prototype.getInteriorPoints); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getPolygon', - ol.geom.MultiPolygon.prototype.getPolygon); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getPolygons', - ol.geom.MultiPolygon.prototype.getPolygons); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getType', - ol.geom.MultiPolygon.prototype.getType); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'intersectsExtent', - ol.geom.MultiPolygon.prototype.intersectsExtent); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'setCoordinates', - ol.geom.MultiPolygon.prototype.setCoordinates); - -goog.exportSymbol( - 'ol.geom.Point', - ol.geom.Point, - OPENLAYERS); - -goog.exportProperty( - ol.geom.Point.prototype, - 'clone', - ol.geom.Point.prototype.clone); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getCoordinates', - ol.geom.Point.prototype.getCoordinates); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getType', - ol.geom.Point.prototype.getType); - -goog.exportProperty( - ol.geom.Point.prototype, - 'intersectsExtent', - ol.geom.Point.prototype.intersectsExtent); - -goog.exportProperty( - ol.geom.Point.prototype, - 'setCoordinates', - ol.geom.Point.prototype.setCoordinates); - -goog.exportSymbol( - 'ol.geom.Polygon', - ol.geom.Polygon, - OPENLAYERS); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'appendLinearRing', - ol.geom.Polygon.prototype.appendLinearRing); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'clone', - ol.geom.Polygon.prototype.clone); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getArea', - ol.geom.Polygon.prototype.getArea); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getCoordinates', - ol.geom.Polygon.prototype.getCoordinates); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getInteriorPoint', - ol.geom.Polygon.prototype.getInteriorPoint); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getLinearRingCount', - ol.geom.Polygon.prototype.getLinearRingCount); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getLinearRing', - ol.geom.Polygon.prototype.getLinearRing); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getLinearRings', - ol.geom.Polygon.prototype.getLinearRings); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getType', - ol.geom.Polygon.prototype.getType); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'intersectsExtent', - ol.geom.Polygon.prototype.intersectsExtent); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'setCoordinates', - ol.geom.Polygon.prototype.setCoordinates); - -goog.exportSymbol( - 'ol.geom.Polygon.circular', - ol.geom.Polygon.circular, - OPENLAYERS); - -goog.exportSymbol( - 'ol.geom.Polygon.fromExtent', - ol.geom.Polygon.fromExtent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.geom.Polygon.fromCircle', - ol.geom.Polygon.fromCircle, - OPENLAYERS); - -goog.exportSymbol( - 'ol.geom.SimpleGeometry', - ol.geom.SimpleGeometry, - OPENLAYERS); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'getFirstCoordinate', - ol.geom.SimpleGeometry.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'getLastCoordinate', - ol.geom.SimpleGeometry.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'getLayout', - ol.geom.SimpleGeometry.prototype.getLayout); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'applyTransform', - ol.geom.SimpleGeometry.prototype.applyTransform); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'translate', - ol.geom.SimpleGeometry.prototype.translate); - -goog.exportSymbol( - 'ol.format.EsriJSON', - ol.format.EsriJSON, - OPENLAYERS); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'readFeature', - ol.format.EsriJSON.prototype.readFeature); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'readFeatures', - ol.format.EsriJSON.prototype.readFeatures); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'readGeometry', - ol.format.EsriJSON.prototype.readGeometry); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'readProjection', - ol.format.EsriJSON.prototype.readProjection); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'writeGeometry', - ol.format.EsriJSON.prototype.writeGeometry); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'writeGeometryObject', - ol.format.EsriJSON.prototype.writeGeometryObject); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'writeFeature', - ol.format.EsriJSON.prototype.writeFeature); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'writeFeatureObject', - ol.format.EsriJSON.prototype.writeFeatureObject); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'writeFeatures', - ol.format.EsriJSON.prototype.writeFeatures); - -goog.exportProperty( - ol.format.EsriJSON.prototype, - 'writeFeaturesObject', - ol.format.EsriJSON.prototype.writeFeaturesObject); - -goog.exportSymbol( - 'ol.format.Feature', - ol.format.Feature, - OPENLAYERS); - -goog.exportSymbol( - 'ol.format.GeoJSON', - ol.format.GeoJSON, - OPENLAYERS); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'readFeature', - ol.format.GeoJSON.prototype.readFeature); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'readFeatures', - ol.format.GeoJSON.prototype.readFeatures); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'readGeometry', - ol.format.GeoJSON.prototype.readGeometry); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'readProjection', - ol.format.GeoJSON.prototype.readProjection); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'writeFeature', - ol.format.GeoJSON.prototype.writeFeature); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'writeFeatureObject', - ol.format.GeoJSON.prototype.writeFeatureObject); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'writeFeatures', - ol.format.GeoJSON.prototype.writeFeatures); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'writeFeaturesObject', - ol.format.GeoJSON.prototype.writeFeaturesObject); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'writeGeometry', - ol.format.GeoJSON.prototype.writeGeometry); - -goog.exportProperty( - ol.format.GeoJSON.prototype, - 'writeGeometryObject', - ol.format.GeoJSON.prototype.writeGeometryObject); - -goog.exportSymbol( - 'ol.format.GPX', - ol.format.GPX, - OPENLAYERS); - -goog.exportProperty( - ol.format.GPX.prototype, - 'readFeature', - ol.format.GPX.prototype.readFeature); - -goog.exportProperty( - ol.format.GPX.prototype, - 'readFeatures', - ol.format.GPX.prototype.readFeatures); - -goog.exportProperty( - ol.format.GPX.prototype, - 'readProjection', - ol.format.GPX.prototype.readProjection); - -goog.exportProperty( - ol.format.GPX.prototype, - 'writeFeatures', - ol.format.GPX.prototype.writeFeatures); - -goog.exportProperty( - ol.format.GPX.prototype, - 'writeFeaturesNode', - ol.format.GPX.prototype.writeFeaturesNode); - -goog.exportSymbol( - 'ol.format.IGC', - ol.format.IGC, - OPENLAYERS); - -goog.exportProperty( - ol.format.IGC.prototype, - 'readFeature', - ol.format.IGC.prototype.readFeature); - -goog.exportProperty( - ol.format.IGC.prototype, - 'readFeatures', - ol.format.IGC.prototype.readFeatures); - -goog.exportProperty( - ol.format.IGC.prototype, - 'readProjection', - ol.format.IGC.prototype.readProjection); - -goog.exportSymbol( - 'ol.format.KML', - ol.format.KML, - OPENLAYERS); - -goog.exportProperty( - ol.format.KML.prototype, - 'readFeature', - ol.format.KML.prototype.readFeature); - -goog.exportProperty( - ol.format.KML.prototype, - 'readFeatures', - ol.format.KML.prototype.readFeatures); - -goog.exportProperty( - ol.format.KML.prototype, - 'readName', - ol.format.KML.prototype.readName); - -goog.exportProperty( - ol.format.KML.prototype, - 'readNetworkLinks', - ol.format.KML.prototype.readNetworkLinks); - -goog.exportProperty( - ol.format.KML.prototype, - 'readProjection', - ol.format.KML.prototype.readProjection); - -goog.exportProperty( - ol.format.KML.prototype, - 'writeFeatures', - ol.format.KML.prototype.writeFeatures); - -goog.exportProperty( - ol.format.KML.prototype, - 'writeFeaturesNode', - ol.format.KML.prototype.writeFeaturesNode); - -goog.exportSymbol( - 'ol.format.MVT', - ol.format.MVT, - OPENLAYERS); - -goog.exportProperty( - ol.format.MVT.prototype, - 'setLayers', - ol.format.MVT.prototype.setLayers); - -goog.exportSymbol( - 'ol.format.OSMXML', - ol.format.OSMXML, - OPENLAYERS); - -goog.exportProperty( - ol.format.OSMXML.prototype, - 'readFeatures', - ol.format.OSMXML.prototype.readFeatures); - -goog.exportProperty( - ol.format.OSMXML.prototype, - 'readProjection', - ol.format.OSMXML.prototype.readProjection); - -goog.exportSymbol( - 'ol.format.Polyline', - ol.format.Polyline, - OPENLAYERS); - -goog.exportSymbol( - 'ol.format.Polyline.encodeDeltas', - ol.format.Polyline.encodeDeltas, - OPENLAYERS); - -goog.exportSymbol( - 'ol.format.Polyline.decodeDeltas', - ol.format.Polyline.decodeDeltas, - OPENLAYERS); - -goog.exportSymbol( - 'ol.format.Polyline.encodeFloats', - ol.format.Polyline.encodeFloats, - OPENLAYERS); - -goog.exportSymbol( - 'ol.format.Polyline.decodeFloats', - ol.format.Polyline.decodeFloats, - OPENLAYERS); - -goog.exportProperty( - ol.format.Polyline.prototype, - 'readFeature', - ol.format.Polyline.prototype.readFeature); - -goog.exportProperty( - ol.format.Polyline.prototype, - 'readFeatures', - ol.format.Polyline.prototype.readFeatures); - -goog.exportProperty( - ol.format.Polyline.prototype, - 'readGeometry', - ol.format.Polyline.prototype.readGeometry); - -goog.exportProperty( - ol.format.Polyline.prototype, - 'readProjection', - ol.format.Polyline.prototype.readProjection); - -goog.exportProperty( - ol.format.Polyline.prototype, - 'writeGeometry', - ol.format.Polyline.prototype.writeGeometry); - -goog.exportSymbol( - 'ol.format.TopoJSON', - ol.format.TopoJSON, - OPENLAYERS); - -goog.exportProperty( - ol.format.TopoJSON.prototype, - 'readFeatures', - ol.format.TopoJSON.prototype.readFeatures); - -goog.exportProperty( - ol.format.TopoJSON.prototype, - 'readProjection', - ol.format.TopoJSON.prototype.readProjection); - -goog.exportSymbol( - 'ol.format.WFS', - ol.format.WFS, - OPENLAYERS); - -goog.exportProperty( - ol.format.WFS.prototype, - 'readFeatures', - ol.format.WFS.prototype.readFeatures); - -goog.exportProperty( - ol.format.WFS.prototype, - 'readTransactionResponse', - ol.format.WFS.prototype.readTransactionResponse); - -goog.exportProperty( - ol.format.WFS.prototype, - 'readFeatureCollectionMetadata', - ol.format.WFS.prototype.readFeatureCollectionMetadata); - -goog.exportProperty( - ol.format.WFS.prototype, - 'writeGetFeature', - ol.format.WFS.prototype.writeGetFeature); - -goog.exportProperty( - ol.format.WFS.prototype, - 'writeTransaction', - ol.format.WFS.prototype.writeTransaction); - -goog.exportProperty( - ol.format.WFS.prototype, - 'readProjection', - ol.format.WFS.prototype.readProjection); - -goog.exportSymbol( - 'ol.format.WKT', - ol.format.WKT, - OPENLAYERS); - -goog.exportProperty( - ol.format.WKT.prototype, - 'readFeature', - ol.format.WKT.prototype.readFeature); - -goog.exportProperty( - ol.format.WKT.prototype, - 'readFeatures', - ol.format.WKT.prototype.readFeatures); - -goog.exportProperty( - ol.format.WKT.prototype, - 'readGeometry', - ol.format.WKT.prototype.readGeometry); - -goog.exportProperty( - ol.format.WKT.prototype, - 'writeFeature', - ol.format.WKT.prototype.writeFeature); - -goog.exportProperty( - ol.format.WKT.prototype, - 'writeFeatures', - ol.format.WKT.prototype.writeFeatures); - -goog.exportProperty( - ol.format.WKT.prototype, - 'writeGeometry', - ol.format.WKT.prototype.writeGeometry); - -goog.exportSymbol( - 'ol.format.WMSCapabilities', - ol.format.WMSCapabilities, - OPENLAYERS); - -goog.exportProperty( - ol.format.WMSCapabilities.prototype, - 'read', - ol.format.WMSCapabilities.prototype.read); - -goog.exportSymbol( - 'ol.format.WMSGetFeatureInfo', - ol.format.WMSGetFeatureInfo, - OPENLAYERS); - -goog.exportProperty( - ol.format.WMSGetFeatureInfo.prototype, - 'readFeatures', - ol.format.WMSGetFeatureInfo.prototype.readFeatures); - -goog.exportSymbol( - 'ol.format.WMTSCapabilities', - ol.format.WMTSCapabilities, - OPENLAYERS); - -goog.exportProperty( - ol.format.WMTSCapabilities.prototype, - 'read', - ol.format.WMTSCapabilities.prototype.read); - -goog.exportSymbol( - 'ol.format.GML2', - ol.format.GML2, - OPENLAYERS); - -goog.exportSymbol( - 'ol.format.GML3', - ol.format.GML3, - OPENLAYERS); - -goog.exportProperty( - ol.format.GML3.prototype, - 'writeGeometryNode', - ol.format.GML3.prototype.writeGeometryNode); - -goog.exportProperty( - ol.format.GML3.prototype, - 'writeFeatures', - ol.format.GML3.prototype.writeFeatures); - -goog.exportProperty( - ol.format.GML3.prototype, - 'writeFeaturesNode', - ol.format.GML3.prototype.writeFeaturesNode); - -goog.exportSymbol( - 'ol.format.GML', - ol.format.GML, - OPENLAYERS); - -goog.exportProperty( - ol.format.GML.prototype, - 'writeFeatures', - ol.format.GML.prototype.writeFeatures); - -goog.exportProperty( - ol.format.GML.prototype, - 'writeFeaturesNode', - ol.format.GML.prototype.writeFeaturesNode); - -goog.exportProperty( - ol.format.GMLBase.prototype, - 'readFeatures', - ol.format.GMLBase.prototype.readFeatures); - -goog.exportSymbol( - 'ol.events.condition.altKeyOnly', - ol.events.condition.altKeyOnly, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.altShiftKeysOnly', - ol.events.condition.altShiftKeysOnly, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.always', - ol.events.condition.always, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.click', - ol.events.condition.click, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.never', - ol.events.condition.never, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.pointerMove', - ol.events.condition.pointerMove, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.singleClick', - ol.events.condition.singleClick, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.doubleClick', - ol.events.condition.doubleClick, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.noModifierKeys', - ol.events.condition.noModifierKeys, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.platformModifierKeyOnly', - ol.events.condition.platformModifierKeyOnly, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.shiftKeyOnly', - ol.events.condition.shiftKeyOnly, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.targetNotEditable', - ol.events.condition.targetNotEditable, - OPENLAYERS); - -goog.exportSymbol( - 'ol.events.condition.mouseOnly', - ol.events.condition.mouseOnly, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.Attribution', - ol.control.Attribution, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.Attribution.render', - ol.control.Attribution.render, - OPENLAYERS); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'getCollapsible', - ol.control.Attribution.prototype.getCollapsible); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'setCollapsible', - ol.control.Attribution.prototype.setCollapsible); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'setCollapsed', - ol.control.Attribution.prototype.setCollapsed); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'getCollapsed', - ol.control.Attribution.prototype.getCollapsed); - -goog.exportSymbol( - 'ol.control.Control', - ol.control.Control, - OPENLAYERS); - -goog.exportProperty( - ol.control.Control.prototype, - 'getMap', - ol.control.Control.prototype.getMap); - -goog.exportProperty( - ol.control.Control.prototype, - 'setMap', - ol.control.Control.prototype.setMap); - -goog.exportProperty( - ol.control.Control.prototype, - 'setTarget', - ol.control.Control.prototype.setTarget); - -goog.exportSymbol( - 'ol.control.defaults', - ol.control.defaults, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.FullScreen', - ol.control.FullScreen, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.MousePosition', - ol.control.MousePosition, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.MousePosition.render', - ol.control.MousePosition.render, - OPENLAYERS); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'getCoordinateFormat', - ol.control.MousePosition.prototype.getCoordinateFormat); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'getProjection', - ol.control.MousePosition.prototype.getProjection); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'setCoordinateFormat', - ol.control.MousePosition.prototype.setCoordinateFormat); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'setProjection', - ol.control.MousePosition.prototype.setProjection); - -goog.exportSymbol( - 'ol.control.OverviewMap', - ol.control.OverviewMap, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.OverviewMap.render', - ol.control.OverviewMap.render, - OPENLAYERS); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'getCollapsible', - ol.control.OverviewMap.prototype.getCollapsible); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'setCollapsible', - ol.control.OverviewMap.prototype.setCollapsible); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'setCollapsed', - ol.control.OverviewMap.prototype.setCollapsed); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'getCollapsed', - ol.control.OverviewMap.prototype.getCollapsed); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'getOverviewMap', - ol.control.OverviewMap.prototype.getOverviewMap); - -goog.exportSymbol( - 'ol.control.Rotate', - ol.control.Rotate, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.Rotate.render', - ol.control.Rotate.render, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.ScaleLine', - ol.control.ScaleLine, - OPENLAYERS); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'getUnits', - ol.control.ScaleLine.prototype.getUnits); - -goog.exportSymbol( - 'ol.control.ScaleLine.render', - ol.control.ScaleLine.render, - OPENLAYERS); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'setUnits', - ol.control.ScaleLine.prototype.setUnits); - -goog.exportSymbol( - 'ol.control.Zoom', - ol.control.Zoom, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.ZoomSlider', - ol.control.ZoomSlider, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.ZoomSlider.render', - ol.control.ZoomSlider.render, - OPENLAYERS); - -goog.exportSymbol( - 'ol.control.ZoomToExtent', - ol.control.ZoomToExtent, - OPENLAYERS); - -goog.exportSymbol( - 'ol.color.asArray', - ol.color.asArray, - OPENLAYERS); - -goog.exportSymbol( - 'ol.color.asString', - ol.color.asString, - OPENLAYERS); - -goog.exportProperty( - ol.Object.prototype, - 'changed', - ol.Object.prototype.changed); - -goog.exportProperty( - ol.Object.prototype, - 'dispatchEvent', - ol.Object.prototype.dispatchEvent); - -goog.exportProperty( - ol.Object.prototype, - 'getRevision', - ol.Object.prototype.getRevision); - -goog.exportProperty( - ol.Object.prototype, - 'on', - ol.Object.prototype.on); - -goog.exportProperty( - ol.Object.prototype, - 'once', - ol.Object.prototype.once); - -goog.exportProperty( - ol.Object.prototype, - 'un', - ol.Object.prototype.un); - -goog.exportProperty( - ol.Object.prototype, - 'unByKey', - ol.Object.prototype.unByKey); - -goog.exportProperty( - ol.Collection.prototype, - 'get', - ol.Collection.prototype.get); - -goog.exportProperty( - ol.Collection.prototype, - 'getKeys', - ol.Collection.prototype.getKeys); - -goog.exportProperty( - ol.Collection.prototype, - 'getProperties', - ol.Collection.prototype.getProperties); - -goog.exportProperty( - ol.Collection.prototype, - 'set', - ol.Collection.prototype.set); - -goog.exportProperty( - ol.Collection.prototype, - 'setProperties', - ol.Collection.prototype.setProperties); - -goog.exportProperty( - ol.Collection.prototype, - 'unset', - ol.Collection.prototype.unset); - -goog.exportProperty( - ol.Collection.prototype, - 'changed', - ol.Collection.prototype.changed); - -goog.exportProperty( - ol.Collection.prototype, - 'dispatchEvent', - ol.Collection.prototype.dispatchEvent); - -goog.exportProperty( - ol.Collection.prototype, - 'getRevision', - ol.Collection.prototype.getRevision); - -goog.exportProperty( - ol.Collection.prototype, - 'on', - ol.Collection.prototype.on); - -goog.exportProperty( - ol.Collection.prototype, - 'once', - ol.Collection.prototype.once); - -goog.exportProperty( - ol.Collection.prototype, - 'un', - ol.Collection.prototype.un); - -goog.exportProperty( - ol.Collection.prototype, - 'unByKey', - ol.Collection.prototype.unByKey); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'get', - ol.DeviceOrientation.prototype.get); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'getKeys', - ol.DeviceOrientation.prototype.getKeys); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'getProperties', - ol.DeviceOrientation.prototype.getProperties); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'set', - ol.DeviceOrientation.prototype.set); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'setProperties', - ol.DeviceOrientation.prototype.setProperties); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'unset', - ol.DeviceOrientation.prototype.unset); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'changed', - ol.DeviceOrientation.prototype.changed); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'dispatchEvent', - ol.DeviceOrientation.prototype.dispatchEvent); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'getRevision', - ol.DeviceOrientation.prototype.getRevision); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'on', - ol.DeviceOrientation.prototype.on); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'once', - ol.DeviceOrientation.prototype.once); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'un', - ol.DeviceOrientation.prototype.un); - -goog.exportProperty( - ol.DeviceOrientation.prototype, - 'unByKey', - ol.DeviceOrientation.prototype.unByKey); - -goog.exportProperty( - ol.Feature.prototype, - 'get', - ol.Feature.prototype.get); - -goog.exportProperty( - ol.Feature.prototype, - 'getKeys', - ol.Feature.prototype.getKeys); - -goog.exportProperty( - ol.Feature.prototype, - 'getProperties', - ol.Feature.prototype.getProperties); - -goog.exportProperty( - ol.Feature.prototype, - 'set', - ol.Feature.prototype.set); - -goog.exportProperty( - ol.Feature.prototype, - 'setProperties', - ol.Feature.prototype.setProperties); - -goog.exportProperty( - ol.Feature.prototype, - 'unset', - ol.Feature.prototype.unset); - -goog.exportProperty( - ol.Feature.prototype, - 'changed', - ol.Feature.prototype.changed); - -goog.exportProperty( - ol.Feature.prototype, - 'dispatchEvent', - ol.Feature.prototype.dispatchEvent); - -goog.exportProperty( - ol.Feature.prototype, - 'getRevision', - ol.Feature.prototype.getRevision); - -goog.exportProperty( - ol.Feature.prototype, - 'on', - ol.Feature.prototype.on); - -goog.exportProperty( - ol.Feature.prototype, - 'once', - ol.Feature.prototype.once); - -goog.exportProperty( - ol.Feature.prototype, - 'un', - ol.Feature.prototype.un); - -goog.exportProperty( - ol.Feature.prototype, - 'unByKey', - ol.Feature.prototype.unByKey); - -goog.exportProperty( - ol.Geolocation.prototype, - 'get', - ol.Geolocation.prototype.get); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getKeys', - ol.Geolocation.prototype.getKeys); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getProperties', - ol.Geolocation.prototype.getProperties); - -goog.exportProperty( - ol.Geolocation.prototype, - 'set', - ol.Geolocation.prototype.set); - -goog.exportProperty( - ol.Geolocation.prototype, - 'setProperties', - ol.Geolocation.prototype.setProperties); - -goog.exportProperty( - ol.Geolocation.prototype, - 'unset', - ol.Geolocation.prototype.unset); - -goog.exportProperty( - ol.Geolocation.prototype, - 'changed', - ol.Geolocation.prototype.changed); - -goog.exportProperty( - ol.Geolocation.prototype, - 'dispatchEvent', - ol.Geolocation.prototype.dispatchEvent); - -goog.exportProperty( - ol.Geolocation.prototype, - 'getRevision', - ol.Geolocation.prototype.getRevision); - -goog.exportProperty( - ol.Geolocation.prototype, - 'on', - ol.Geolocation.prototype.on); - -goog.exportProperty( - ol.Geolocation.prototype, - 'once', - ol.Geolocation.prototype.once); - -goog.exportProperty( - ol.Geolocation.prototype, - 'un', - ol.Geolocation.prototype.un); - -goog.exportProperty( - ol.Geolocation.prototype, - 'unByKey', - ol.Geolocation.prototype.unByKey); - -goog.exportProperty( - ol.ImageTile.prototype, - 'getTileCoord', - ol.ImageTile.prototype.getTileCoord); - -goog.exportProperty( - ol.Map.prototype, - 'get', - ol.Map.prototype.get); - -goog.exportProperty( - ol.Map.prototype, - 'getKeys', - ol.Map.prototype.getKeys); - -goog.exportProperty( - ol.Map.prototype, - 'getProperties', - ol.Map.prototype.getProperties); - -goog.exportProperty( - ol.Map.prototype, - 'set', - ol.Map.prototype.set); - -goog.exportProperty( - ol.Map.prototype, - 'setProperties', - ol.Map.prototype.setProperties); - -goog.exportProperty( - ol.Map.prototype, - 'unset', - ol.Map.prototype.unset); - -goog.exportProperty( - ol.Map.prototype, - 'changed', - ol.Map.prototype.changed); - -goog.exportProperty( - ol.Map.prototype, - 'dispatchEvent', - ol.Map.prototype.dispatchEvent); - -goog.exportProperty( - ol.Map.prototype, - 'getRevision', - ol.Map.prototype.getRevision); - -goog.exportProperty( - ol.Map.prototype, - 'on', - ol.Map.prototype.on); - -goog.exportProperty( - ol.Map.prototype, - 'once', - ol.Map.prototype.once); - -goog.exportProperty( - ol.Map.prototype, - 'un', - ol.Map.prototype.un); - -goog.exportProperty( - ol.Map.prototype, - 'unByKey', - ol.Map.prototype.unByKey); - -goog.exportProperty( - ol.MapBrowserEvent.prototype, - 'map', - ol.MapBrowserEvent.prototype.map); - -goog.exportProperty( - ol.MapBrowserEvent.prototype, - 'frameState', - ol.MapBrowserEvent.prototype.frameState); - -goog.exportProperty( - ol.MapBrowserPointerEvent.prototype, - 'originalEvent', - ol.MapBrowserPointerEvent.prototype.originalEvent); - -goog.exportProperty( - ol.MapBrowserPointerEvent.prototype, - 'pixel', - ol.MapBrowserPointerEvent.prototype.pixel); - -goog.exportProperty( - ol.MapBrowserPointerEvent.prototype, - 'coordinate', - ol.MapBrowserPointerEvent.prototype.coordinate); - -goog.exportProperty( - ol.MapBrowserPointerEvent.prototype, - 'dragging', - ol.MapBrowserPointerEvent.prototype.dragging); - -goog.exportProperty( - ol.MapBrowserPointerEvent.prototype, - 'preventDefault', - ol.MapBrowserPointerEvent.prototype.preventDefault); - -goog.exportProperty( - ol.MapBrowserPointerEvent.prototype, - 'stopPropagation', - ol.MapBrowserPointerEvent.prototype.stopPropagation); - -goog.exportProperty( - ol.MapBrowserPointerEvent.prototype, - 'map', - ol.MapBrowserPointerEvent.prototype.map); - -goog.exportProperty( - ol.MapBrowserPointerEvent.prototype, - 'frameState', - ol.MapBrowserPointerEvent.prototype.frameState); - -goog.exportProperty( - ol.Overlay.prototype, - 'get', - ol.Overlay.prototype.get); - -goog.exportProperty( - ol.Overlay.prototype, - 'getKeys', - ol.Overlay.prototype.getKeys); - -goog.exportProperty( - ol.Overlay.prototype, - 'getProperties', - ol.Overlay.prototype.getProperties); - -goog.exportProperty( - ol.Overlay.prototype, - 'set', - ol.Overlay.prototype.set); - -goog.exportProperty( - ol.Overlay.prototype, - 'setProperties', - ol.Overlay.prototype.setProperties); - -goog.exportProperty( - ol.Overlay.prototype, - 'unset', - ol.Overlay.prototype.unset); - -goog.exportProperty( - ol.Overlay.prototype, - 'changed', - ol.Overlay.prototype.changed); - -goog.exportProperty( - ol.Overlay.prototype, - 'dispatchEvent', - ol.Overlay.prototype.dispatchEvent); - -goog.exportProperty( - ol.Overlay.prototype, - 'getRevision', - ol.Overlay.prototype.getRevision); - -goog.exportProperty( - ol.Overlay.prototype, - 'on', - ol.Overlay.prototype.on); - -goog.exportProperty( - ol.Overlay.prototype, - 'once', - ol.Overlay.prototype.once); - -goog.exportProperty( - ol.Overlay.prototype, - 'un', - ol.Overlay.prototype.un); - -goog.exportProperty( - ol.Overlay.prototype, - 'unByKey', - ol.Overlay.prototype.unByKey); - -goog.exportProperty( - ol.VectorTile.prototype, - 'getTileCoord', - ol.VectorTile.prototype.getTileCoord); - -goog.exportProperty( - ol.View.prototype, - 'get', - ol.View.prototype.get); - -goog.exportProperty( - ol.View.prototype, - 'getKeys', - ol.View.prototype.getKeys); - -goog.exportProperty( - ol.View.prototype, - 'getProperties', - ol.View.prototype.getProperties); - -goog.exportProperty( - ol.View.prototype, - 'set', - ol.View.prototype.set); - -goog.exportProperty( - ol.View.prototype, - 'setProperties', - ol.View.prototype.setProperties); - -goog.exportProperty( - ol.View.prototype, - 'unset', - ol.View.prototype.unset); - -goog.exportProperty( - ol.View.prototype, - 'changed', - ol.View.prototype.changed); - -goog.exportProperty( - ol.View.prototype, - 'dispatchEvent', - ol.View.prototype.dispatchEvent); - -goog.exportProperty( - ol.View.prototype, - 'getRevision', - ol.View.prototype.getRevision); - -goog.exportProperty( - ol.View.prototype, - 'on', - ol.View.prototype.on); - -goog.exportProperty( - ol.View.prototype, - 'once', - ol.View.prototype.once); - -goog.exportProperty( - ol.View.prototype, - 'un', - ol.View.prototype.un); - -goog.exportProperty( - ol.View.prototype, - 'unByKey', - ol.View.prototype.unByKey); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getMaxZoom', - ol.tilegrid.WMTS.prototype.getMaxZoom); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getMinZoom', - ol.tilegrid.WMTS.prototype.getMinZoom); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getOrigin', - ol.tilegrid.WMTS.prototype.getOrigin); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getResolution', - ol.tilegrid.WMTS.prototype.getResolution); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getResolutions', - ol.tilegrid.WMTS.prototype.getResolutions); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getTileCoordExtent', - ol.tilegrid.WMTS.prototype.getTileCoordExtent); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getTileCoordForCoordAndResolution', - ol.tilegrid.WMTS.prototype.getTileCoordForCoordAndResolution); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getTileCoordForCoordAndZ', - ol.tilegrid.WMTS.prototype.getTileCoordForCoordAndZ); - -goog.exportProperty( - ol.tilegrid.WMTS.prototype, - 'getTileSize', - ol.tilegrid.WMTS.prototype.getTileSize); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getOpacity', - ol.style.Circle.prototype.getOpacity); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getRotateWithView', - ol.style.Circle.prototype.getRotateWithView); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getRotation', - ol.style.Circle.prototype.getRotation); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getScale', - ol.style.Circle.prototype.getScale); - -goog.exportProperty( - ol.style.Circle.prototype, - 'getSnapToPixel', - ol.style.Circle.prototype.getSnapToPixel); - -goog.exportProperty( - ol.style.Circle.prototype, - 'setOpacity', - ol.style.Circle.prototype.setOpacity); - -goog.exportProperty( - ol.style.Circle.prototype, - 'setRotation', - ol.style.Circle.prototype.setRotation); - -goog.exportProperty( - ol.style.Circle.prototype, - 'setScale', - ol.style.Circle.prototype.setScale); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getOpacity', - ol.style.Icon.prototype.getOpacity); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getRotateWithView', - ol.style.Icon.prototype.getRotateWithView); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getRotation', - ol.style.Icon.prototype.getRotation); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getScale', - ol.style.Icon.prototype.getScale); - -goog.exportProperty( - ol.style.Icon.prototype, - 'getSnapToPixel', - ol.style.Icon.prototype.getSnapToPixel); - -goog.exportProperty( - ol.style.Icon.prototype, - 'setOpacity', - ol.style.Icon.prototype.setOpacity); - -goog.exportProperty( - ol.style.Icon.prototype, - 'setRotation', - ol.style.Icon.prototype.setRotation); - -goog.exportProperty( - ol.style.Icon.prototype, - 'setScale', - ol.style.Icon.prototype.setScale); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getOpacity', - ol.style.RegularShape.prototype.getOpacity); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getRotateWithView', - ol.style.RegularShape.prototype.getRotateWithView); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getRotation', - ol.style.RegularShape.prototype.getRotation); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getScale', - ol.style.RegularShape.prototype.getScale); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'getSnapToPixel', - ol.style.RegularShape.prototype.getSnapToPixel); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'setOpacity', - ol.style.RegularShape.prototype.setOpacity); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'setRotation', - ol.style.RegularShape.prototype.setRotation); - -goog.exportProperty( - ol.style.RegularShape.prototype, - 'setScale', - ol.style.RegularShape.prototype.setScale); - -goog.exportProperty( - ol.source.Source.prototype, - 'get', - ol.source.Source.prototype.get); - -goog.exportProperty( - ol.source.Source.prototype, - 'getKeys', - ol.source.Source.prototype.getKeys); - -goog.exportProperty( - ol.source.Source.prototype, - 'getProperties', - ol.source.Source.prototype.getProperties); - -goog.exportProperty( - ol.source.Source.prototype, - 'set', - ol.source.Source.prototype.set); - -goog.exportProperty( - ol.source.Source.prototype, - 'setProperties', - ol.source.Source.prototype.setProperties); - -goog.exportProperty( - ol.source.Source.prototype, - 'unset', - ol.source.Source.prototype.unset); - -goog.exportProperty( - ol.source.Source.prototype, - 'changed', - ol.source.Source.prototype.changed); - -goog.exportProperty( - ol.source.Source.prototype, - 'dispatchEvent', - ol.source.Source.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.Source.prototype, - 'getRevision', - ol.source.Source.prototype.getRevision); - -goog.exportProperty( - ol.source.Source.prototype, - 'on', - ol.source.Source.prototype.on); - -goog.exportProperty( - ol.source.Source.prototype, - 'once', - ol.source.Source.prototype.once); - -goog.exportProperty( - ol.source.Source.prototype, - 'un', - ol.source.Source.prototype.un); - -goog.exportProperty( - ol.source.Source.prototype, - 'unByKey', - ol.source.Source.prototype.unByKey); - -goog.exportProperty( - ol.source.Tile.prototype, - 'getAttributions', - ol.source.Tile.prototype.getAttributions); - -goog.exportProperty( - ol.source.Tile.prototype, - 'getLogo', - ol.source.Tile.prototype.getLogo); - -goog.exportProperty( - ol.source.Tile.prototype, - 'getProjection', - ol.source.Tile.prototype.getProjection); - -goog.exportProperty( - ol.source.Tile.prototype, - 'getState', - ol.source.Tile.prototype.getState); - -goog.exportProperty( - ol.source.Tile.prototype, - 'setAttributions', - ol.source.Tile.prototype.setAttributions); - -goog.exportProperty( - ol.source.Tile.prototype, - 'get', - ol.source.Tile.prototype.get); - -goog.exportProperty( - ol.source.Tile.prototype, - 'getKeys', - ol.source.Tile.prototype.getKeys); - -goog.exportProperty( - ol.source.Tile.prototype, - 'getProperties', - ol.source.Tile.prototype.getProperties); - -goog.exportProperty( - ol.source.Tile.prototype, - 'set', - ol.source.Tile.prototype.set); - -goog.exportProperty( - ol.source.Tile.prototype, - 'setProperties', - ol.source.Tile.prototype.setProperties); - -goog.exportProperty( - ol.source.Tile.prototype, - 'unset', - ol.source.Tile.prototype.unset); - -goog.exportProperty( - ol.source.Tile.prototype, - 'changed', - ol.source.Tile.prototype.changed); - -goog.exportProperty( - ol.source.Tile.prototype, - 'dispatchEvent', - ol.source.Tile.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.Tile.prototype, - 'getRevision', - ol.source.Tile.prototype.getRevision); - -goog.exportProperty( - ol.source.Tile.prototype, - 'on', - ol.source.Tile.prototype.on); - -goog.exportProperty( - ol.source.Tile.prototype, - 'once', - ol.source.Tile.prototype.once); - -goog.exportProperty( - ol.source.Tile.prototype, - 'un', - ol.source.Tile.prototype.un); - -goog.exportProperty( - ol.source.Tile.prototype, - 'unByKey', - ol.source.Tile.prototype.unByKey); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getTileGrid', - ol.source.UrlTile.prototype.getTileGrid); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getAttributions', - ol.source.UrlTile.prototype.getAttributions); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getLogo', - ol.source.UrlTile.prototype.getLogo); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getProjection', - ol.source.UrlTile.prototype.getProjection); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getState', - ol.source.UrlTile.prototype.getState); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'setAttributions', - ol.source.UrlTile.prototype.setAttributions); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'get', - ol.source.UrlTile.prototype.get); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getKeys', - ol.source.UrlTile.prototype.getKeys); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getProperties', - ol.source.UrlTile.prototype.getProperties); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'set', - ol.source.UrlTile.prototype.set); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'setProperties', - ol.source.UrlTile.prototype.setProperties); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'unset', - ol.source.UrlTile.prototype.unset); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'changed', - ol.source.UrlTile.prototype.changed); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'dispatchEvent', - ol.source.UrlTile.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'getRevision', - ol.source.UrlTile.prototype.getRevision); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'on', - ol.source.UrlTile.prototype.on); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'once', - ol.source.UrlTile.prototype.once); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'un', - ol.source.UrlTile.prototype.un); - -goog.exportProperty( - ol.source.UrlTile.prototype, - 'unByKey', - ol.source.UrlTile.prototype.unByKey); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getTileLoadFunction', - ol.source.TileImage.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getTileUrlFunction', - ol.source.TileImage.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getUrls', - ol.source.TileImage.prototype.getUrls); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'setTileLoadFunction', - ol.source.TileImage.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'setTileUrlFunction', - ol.source.TileImage.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'setUrl', - ol.source.TileImage.prototype.setUrl); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'setUrls', - ol.source.TileImage.prototype.setUrls); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getTileGrid', - ol.source.TileImage.prototype.getTileGrid); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getAttributions', - ol.source.TileImage.prototype.getAttributions); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getLogo', - ol.source.TileImage.prototype.getLogo); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getProjection', - ol.source.TileImage.prototype.getProjection); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getState', - ol.source.TileImage.prototype.getState); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'setAttributions', - ol.source.TileImage.prototype.setAttributions); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'get', - ol.source.TileImage.prototype.get); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getKeys', - ol.source.TileImage.prototype.getKeys); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getProperties', - ol.source.TileImage.prototype.getProperties); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'set', - ol.source.TileImage.prototype.set); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'setProperties', - ol.source.TileImage.prototype.setProperties); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'unset', - ol.source.TileImage.prototype.unset); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'changed', - ol.source.TileImage.prototype.changed); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'dispatchEvent', - ol.source.TileImage.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'getRevision', - ol.source.TileImage.prototype.getRevision); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'on', - ol.source.TileImage.prototype.on); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'once', - ol.source.TileImage.prototype.once); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'un', - ol.source.TileImage.prototype.un); - -goog.exportProperty( - ol.source.TileImage.prototype, - 'unByKey', - ol.source.TileImage.prototype.unByKey); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'setRenderReprojectionEdges', - ol.source.BingMaps.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'setTileGridForProjection', - ol.source.BingMaps.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getTileLoadFunction', - ol.source.BingMaps.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getTileUrlFunction', - ol.source.BingMaps.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getUrls', - ol.source.BingMaps.prototype.getUrls); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'setTileLoadFunction', - ol.source.BingMaps.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'setTileUrlFunction', - ol.source.BingMaps.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'setUrl', - ol.source.BingMaps.prototype.setUrl); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'setUrls', - ol.source.BingMaps.prototype.setUrls); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getTileGrid', - ol.source.BingMaps.prototype.getTileGrid); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getAttributions', - ol.source.BingMaps.prototype.getAttributions); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getLogo', - ol.source.BingMaps.prototype.getLogo); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getProjection', - ol.source.BingMaps.prototype.getProjection); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getState', - ol.source.BingMaps.prototype.getState); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'setAttributions', - ol.source.BingMaps.prototype.setAttributions); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'get', - ol.source.BingMaps.prototype.get); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getKeys', - ol.source.BingMaps.prototype.getKeys); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getProperties', - ol.source.BingMaps.prototype.getProperties); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'set', - ol.source.BingMaps.prototype.set); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'setProperties', - ol.source.BingMaps.prototype.setProperties); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'unset', - ol.source.BingMaps.prototype.unset); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'changed', - ol.source.BingMaps.prototype.changed); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'dispatchEvent', - ol.source.BingMaps.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'getRevision', - ol.source.BingMaps.prototype.getRevision); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'on', - ol.source.BingMaps.prototype.on); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'once', - ol.source.BingMaps.prototype.once); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'un', - ol.source.BingMaps.prototype.un); - -goog.exportProperty( - ol.source.BingMaps.prototype, - 'unByKey', - ol.source.BingMaps.prototype.unByKey); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getAttributions', - ol.source.Vector.prototype.getAttributions); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getLogo', - ol.source.Vector.prototype.getLogo); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getProjection', - ol.source.Vector.prototype.getProjection); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getState', - ol.source.Vector.prototype.getState); - -goog.exportProperty( - ol.source.Vector.prototype, - 'setAttributions', - ol.source.Vector.prototype.setAttributions); - -goog.exportProperty( - ol.source.Vector.prototype, - 'get', - ol.source.Vector.prototype.get); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getKeys', - ol.source.Vector.prototype.getKeys); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getProperties', - ol.source.Vector.prototype.getProperties); - -goog.exportProperty( - ol.source.Vector.prototype, - 'set', - ol.source.Vector.prototype.set); - -goog.exportProperty( - ol.source.Vector.prototype, - 'setProperties', - ol.source.Vector.prototype.setProperties); - -goog.exportProperty( - ol.source.Vector.prototype, - 'unset', - ol.source.Vector.prototype.unset); - -goog.exportProperty( - ol.source.Vector.prototype, - 'changed', - ol.source.Vector.prototype.changed); - -goog.exportProperty( - ol.source.Vector.prototype, - 'dispatchEvent', - ol.source.Vector.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.Vector.prototype, - 'getRevision', - ol.source.Vector.prototype.getRevision); - -goog.exportProperty( - ol.source.Vector.prototype, - 'on', - ol.source.Vector.prototype.on); - -goog.exportProperty( - ol.source.Vector.prototype, - 'once', - ol.source.Vector.prototype.once); - -goog.exportProperty( - ol.source.Vector.prototype, - 'un', - ol.source.Vector.prototype.un); - -goog.exportProperty( - ol.source.Vector.prototype, - 'unByKey', - ol.source.Vector.prototype.unByKey); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'addFeature', - ol.source.Cluster.prototype.addFeature); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'addFeatures', - ol.source.Cluster.prototype.addFeatures); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'clear', - ol.source.Cluster.prototype.clear); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'forEachFeature', - ol.source.Cluster.prototype.forEachFeature); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'forEachFeatureInExtent', - ol.source.Cluster.prototype.forEachFeatureInExtent); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'forEachFeatureIntersectingExtent', - ol.source.Cluster.prototype.forEachFeatureIntersectingExtent); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getFeaturesCollection', - ol.source.Cluster.prototype.getFeaturesCollection); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getFeatures', - ol.source.Cluster.prototype.getFeatures); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getFeaturesAtCoordinate', - ol.source.Cluster.prototype.getFeaturesAtCoordinate); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getFeaturesInExtent', - ol.source.Cluster.prototype.getFeaturesInExtent); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getClosestFeatureToCoordinate', - ol.source.Cluster.prototype.getClosestFeatureToCoordinate); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getExtent', - ol.source.Cluster.prototype.getExtent); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getFeatureById', - ol.source.Cluster.prototype.getFeatureById); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'removeFeature', - ol.source.Cluster.prototype.removeFeature); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getAttributions', - ol.source.Cluster.prototype.getAttributions); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getLogo', - ol.source.Cluster.prototype.getLogo); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getProjection', - ol.source.Cluster.prototype.getProjection); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getState', - ol.source.Cluster.prototype.getState); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'setAttributions', - ol.source.Cluster.prototype.setAttributions); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'get', - ol.source.Cluster.prototype.get); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getKeys', - ol.source.Cluster.prototype.getKeys); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getProperties', - ol.source.Cluster.prototype.getProperties); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'set', - ol.source.Cluster.prototype.set); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'setProperties', - ol.source.Cluster.prototype.setProperties); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'unset', - ol.source.Cluster.prototype.unset); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'changed', - ol.source.Cluster.prototype.changed); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'dispatchEvent', - ol.source.Cluster.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'getRevision', - ol.source.Cluster.prototype.getRevision); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'on', - ol.source.Cluster.prototype.on); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'once', - ol.source.Cluster.prototype.once); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'un', - ol.source.Cluster.prototype.un); - -goog.exportProperty( - ol.source.Cluster.prototype, - 'unByKey', - ol.source.Cluster.prototype.unByKey); - -goog.exportProperty( - ol.source.Image.prototype, - 'getAttributions', - ol.source.Image.prototype.getAttributions); - -goog.exportProperty( - ol.source.Image.prototype, - 'getLogo', - ol.source.Image.prototype.getLogo); - -goog.exportProperty( - ol.source.Image.prototype, - 'getProjection', - ol.source.Image.prototype.getProjection); - -goog.exportProperty( - ol.source.Image.prototype, - 'getState', - ol.source.Image.prototype.getState); - -goog.exportProperty( - ol.source.Image.prototype, - 'setAttributions', - ol.source.Image.prototype.setAttributions); - -goog.exportProperty( - ol.source.Image.prototype, - 'get', - ol.source.Image.prototype.get); - -goog.exportProperty( - ol.source.Image.prototype, - 'getKeys', - ol.source.Image.prototype.getKeys); - -goog.exportProperty( - ol.source.Image.prototype, - 'getProperties', - ol.source.Image.prototype.getProperties); - -goog.exportProperty( - ol.source.Image.prototype, - 'set', - ol.source.Image.prototype.set); - -goog.exportProperty( - ol.source.Image.prototype, - 'setProperties', - ol.source.Image.prototype.setProperties); - -goog.exportProperty( - ol.source.Image.prototype, - 'unset', - ol.source.Image.prototype.unset); - -goog.exportProperty( - ol.source.Image.prototype, - 'changed', - ol.source.Image.prototype.changed); - -goog.exportProperty( - ol.source.Image.prototype, - 'dispatchEvent', - ol.source.Image.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.Image.prototype, - 'getRevision', - ol.source.Image.prototype.getRevision); - -goog.exportProperty( - ol.source.Image.prototype, - 'on', - ol.source.Image.prototype.on); - -goog.exportProperty( - ol.source.Image.prototype, - 'once', - ol.source.Image.prototype.once); - -goog.exportProperty( - ol.source.Image.prototype, - 'un', - ol.source.Image.prototype.un); - -goog.exportProperty( - ol.source.Image.prototype, - 'unByKey', - ol.source.Image.prototype.unByKey); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'getAttributions', - ol.source.ImageCanvas.prototype.getAttributions); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'getLogo', - ol.source.ImageCanvas.prototype.getLogo); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'getProjection', - ol.source.ImageCanvas.prototype.getProjection); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'getState', - ol.source.ImageCanvas.prototype.getState); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'setAttributions', - ol.source.ImageCanvas.prototype.setAttributions); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'get', - ol.source.ImageCanvas.prototype.get); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'getKeys', - ol.source.ImageCanvas.prototype.getKeys); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'getProperties', - ol.source.ImageCanvas.prototype.getProperties); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'set', - ol.source.ImageCanvas.prototype.set); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'setProperties', - ol.source.ImageCanvas.prototype.setProperties); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'unset', - ol.source.ImageCanvas.prototype.unset); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'changed', - ol.source.ImageCanvas.prototype.changed); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'dispatchEvent', - ol.source.ImageCanvas.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'getRevision', - ol.source.ImageCanvas.prototype.getRevision); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'on', - ol.source.ImageCanvas.prototype.on); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'once', - ol.source.ImageCanvas.prototype.once); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'un', - ol.source.ImageCanvas.prototype.un); - -goog.exportProperty( - ol.source.ImageCanvas.prototype, - 'unByKey', - ol.source.ImageCanvas.prototype.unByKey); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getAttributions', - ol.source.ImageMapGuide.prototype.getAttributions); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getLogo', - ol.source.ImageMapGuide.prototype.getLogo); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getProjection', - ol.source.ImageMapGuide.prototype.getProjection); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getState', - ol.source.ImageMapGuide.prototype.getState); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'setAttributions', - ol.source.ImageMapGuide.prototype.setAttributions); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'get', - ol.source.ImageMapGuide.prototype.get); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getKeys', - ol.source.ImageMapGuide.prototype.getKeys); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getProperties', - ol.source.ImageMapGuide.prototype.getProperties); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'set', - ol.source.ImageMapGuide.prototype.set); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'setProperties', - ol.source.ImageMapGuide.prototype.setProperties); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'unset', - ol.source.ImageMapGuide.prototype.unset); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'changed', - ol.source.ImageMapGuide.prototype.changed); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'dispatchEvent', - ol.source.ImageMapGuide.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'getRevision', - ol.source.ImageMapGuide.prototype.getRevision); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'on', - ol.source.ImageMapGuide.prototype.on); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'once', - ol.source.ImageMapGuide.prototype.once); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'un', - ol.source.ImageMapGuide.prototype.un); - -goog.exportProperty( - ol.source.ImageMapGuide.prototype, - 'unByKey', - ol.source.ImageMapGuide.prototype.unByKey); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'getAttributions', - ol.source.ImageStatic.prototype.getAttributions); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'getLogo', - ol.source.ImageStatic.prototype.getLogo); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'getProjection', - ol.source.ImageStatic.prototype.getProjection); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'getState', - ol.source.ImageStatic.prototype.getState); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'setAttributions', - ol.source.ImageStatic.prototype.setAttributions); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'get', - ol.source.ImageStatic.prototype.get); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'getKeys', - ol.source.ImageStatic.prototype.getKeys); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'getProperties', - ol.source.ImageStatic.prototype.getProperties); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'set', - ol.source.ImageStatic.prototype.set); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'setProperties', - ol.source.ImageStatic.prototype.setProperties); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'unset', - ol.source.ImageStatic.prototype.unset); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'changed', - ol.source.ImageStatic.prototype.changed); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'dispatchEvent', - ol.source.ImageStatic.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'getRevision', - ol.source.ImageStatic.prototype.getRevision); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'on', - ol.source.ImageStatic.prototype.on); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'once', - ol.source.ImageStatic.prototype.once); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'un', - ol.source.ImageStatic.prototype.un); - -goog.exportProperty( - ol.source.ImageStatic.prototype, - 'unByKey', - ol.source.ImageStatic.prototype.unByKey); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getAttributions', - ol.source.ImageVector.prototype.getAttributions); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getLogo', - ol.source.ImageVector.prototype.getLogo); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getProjection', - ol.source.ImageVector.prototype.getProjection); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getState', - ol.source.ImageVector.prototype.getState); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'setAttributions', - ol.source.ImageVector.prototype.setAttributions); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'get', - ol.source.ImageVector.prototype.get); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getKeys', - ol.source.ImageVector.prototype.getKeys); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getProperties', - ol.source.ImageVector.prototype.getProperties); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'set', - ol.source.ImageVector.prototype.set); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'setProperties', - ol.source.ImageVector.prototype.setProperties); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'unset', - ol.source.ImageVector.prototype.unset); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'changed', - ol.source.ImageVector.prototype.changed); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'dispatchEvent', - ol.source.ImageVector.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'getRevision', - ol.source.ImageVector.prototype.getRevision); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'on', - ol.source.ImageVector.prototype.on); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'once', - ol.source.ImageVector.prototype.once); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'un', - ol.source.ImageVector.prototype.un); - -goog.exportProperty( - ol.source.ImageVector.prototype, - 'unByKey', - ol.source.ImageVector.prototype.unByKey); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getAttributions', - ol.source.ImageWMS.prototype.getAttributions); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getLogo', - ol.source.ImageWMS.prototype.getLogo); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getProjection', - ol.source.ImageWMS.prototype.getProjection); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getState', - ol.source.ImageWMS.prototype.getState); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'setAttributions', - ol.source.ImageWMS.prototype.setAttributions); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'get', - ol.source.ImageWMS.prototype.get); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getKeys', - ol.source.ImageWMS.prototype.getKeys); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getProperties', - ol.source.ImageWMS.prototype.getProperties); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'set', - ol.source.ImageWMS.prototype.set); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'setProperties', - ol.source.ImageWMS.prototype.setProperties); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'unset', - ol.source.ImageWMS.prototype.unset); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'changed', - ol.source.ImageWMS.prototype.changed); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'dispatchEvent', - ol.source.ImageWMS.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'getRevision', - ol.source.ImageWMS.prototype.getRevision); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'on', - ol.source.ImageWMS.prototype.on); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'once', - ol.source.ImageWMS.prototype.once); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'un', - ol.source.ImageWMS.prototype.un); - -goog.exportProperty( - ol.source.ImageWMS.prototype, - 'unByKey', - ol.source.ImageWMS.prototype.unByKey); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'setRenderReprojectionEdges', - ol.source.XYZ.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'setTileGridForProjection', - ol.source.XYZ.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getTileLoadFunction', - ol.source.XYZ.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getTileUrlFunction', - ol.source.XYZ.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getUrls', - ol.source.XYZ.prototype.getUrls); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'setTileLoadFunction', - ol.source.XYZ.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'setTileUrlFunction', - ol.source.XYZ.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'setUrl', - ol.source.XYZ.prototype.setUrl); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'setUrls', - ol.source.XYZ.prototype.setUrls); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getTileGrid', - ol.source.XYZ.prototype.getTileGrid); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getAttributions', - ol.source.XYZ.prototype.getAttributions); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getLogo', - ol.source.XYZ.prototype.getLogo); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getProjection', - ol.source.XYZ.prototype.getProjection); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getState', - ol.source.XYZ.prototype.getState); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'setAttributions', - ol.source.XYZ.prototype.setAttributions); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'get', - ol.source.XYZ.prototype.get); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getKeys', - ol.source.XYZ.prototype.getKeys); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getProperties', - ol.source.XYZ.prototype.getProperties); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'set', - ol.source.XYZ.prototype.set); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'setProperties', - ol.source.XYZ.prototype.setProperties); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'unset', - ol.source.XYZ.prototype.unset); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'changed', - ol.source.XYZ.prototype.changed); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'dispatchEvent', - ol.source.XYZ.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'getRevision', - ol.source.XYZ.prototype.getRevision); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'on', - ol.source.XYZ.prototype.on); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'once', - ol.source.XYZ.prototype.once); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'un', - ol.source.XYZ.prototype.un); - -goog.exportProperty( - ol.source.XYZ.prototype, - 'unByKey', - ol.source.XYZ.prototype.unByKey); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'setRenderReprojectionEdges', - ol.source.MapQuest.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'setTileGridForProjection', - ol.source.MapQuest.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getTileLoadFunction', - ol.source.MapQuest.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getTileUrlFunction', - ol.source.MapQuest.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getUrls', - ol.source.MapQuest.prototype.getUrls); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'setTileLoadFunction', - ol.source.MapQuest.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'setTileUrlFunction', - ol.source.MapQuest.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'setUrl', - ol.source.MapQuest.prototype.setUrl); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'setUrls', - ol.source.MapQuest.prototype.setUrls); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getTileGrid', - ol.source.MapQuest.prototype.getTileGrid); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getAttributions', - ol.source.MapQuest.prototype.getAttributions); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getLogo', - ol.source.MapQuest.prototype.getLogo); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getProjection', - ol.source.MapQuest.prototype.getProjection); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getState', - ol.source.MapQuest.prototype.getState); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'setAttributions', - ol.source.MapQuest.prototype.setAttributions); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'get', - ol.source.MapQuest.prototype.get); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getKeys', - ol.source.MapQuest.prototype.getKeys); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getProperties', - ol.source.MapQuest.prototype.getProperties); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'set', - ol.source.MapQuest.prototype.set); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'setProperties', - ol.source.MapQuest.prototype.setProperties); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'unset', - ol.source.MapQuest.prototype.unset); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'changed', - ol.source.MapQuest.prototype.changed); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'dispatchEvent', - ol.source.MapQuest.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'getRevision', - ol.source.MapQuest.prototype.getRevision); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'on', - ol.source.MapQuest.prototype.on); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'once', - ol.source.MapQuest.prototype.once); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'un', - ol.source.MapQuest.prototype.un); - -goog.exportProperty( - ol.source.MapQuest.prototype, - 'unByKey', - ol.source.MapQuest.prototype.unByKey); - -goog.exportProperty( - ol.source.OSM.prototype, - 'setRenderReprojectionEdges', - ol.source.OSM.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.OSM.prototype, - 'setTileGridForProjection', - ol.source.OSM.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getTileLoadFunction', - ol.source.OSM.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getTileUrlFunction', - ol.source.OSM.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getUrls', - ol.source.OSM.prototype.getUrls); - -goog.exportProperty( - ol.source.OSM.prototype, - 'setTileLoadFunction', - ol.source.OSM.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.OSM.prototype, - 'setTileUrlFunction', - ol.source.OSM.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.OSM.prototype, - 'setUrl', - ol.source.OSM.prototype.setUrl); - -goog.exportProperty( - ol.source.OSM.prototype, - 'setUrls', - ol.source.OSM.prototype.setUrls); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getTileGrid', - ol.source.OSM.prototype.getTileGrid); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getAttributions', - ol.source.OSM.prototype.getAttributions); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getLogo', - ol.source.OSM.prototype.getLogo); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getProjection', - ol.source.OSM.prototype.getProjection); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getState', - ol.source.OSM.prototype.getState); - -goog.exportProperty( - ol.source.OSM.prototype, - 'setAttributions', - ol.source.OSM.prototype.setAttributions); - -goog.exportProperty( - ol.source.OSM.prototype, - 'get', - ol.source.OSM.prototype.get); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getKeys', - ol.source.OSM.prototype.getKeys); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getProperties', - ol.source.OSM.prototype.getProperties); - -goog.exportProperty( - ol.source.OSM.prototype, - 'set', - ol.source.OSM.prototype.set); - -goog.exportProperty( - ol.source.OSM.prototype, - 'setProperties', - ol.source.OSM.prototype.setProperties); - -goog.exportProperty( - ol.source.OSM.prototype, - 'unset', - ol.source.OSM.prototype.unset); - -goog.exportProperty( - ol.source.OSM.prototype, - 'changed', - ol.source.OSM.prototype.changed); - -goog.exportProperty( - ol.source.OSM.prototype, - 'dispatchEvent', - ol.source.OSM.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.OSM.prototype, - 'getRevision', - ol.source.OSM.prototype.getRevision); - -goog.exportProperty( - ol.source.OSM.prototype, - 'on', - ol.source.OSM.prototype.on); - -goog.exportProperty( - ol.source.OSM.prototype, - 'once', - ol.source.OSM.prototype.once); - -goog.exportProperty( - ol.source.OSM.prototype, - 'un', - ol.source.OSM.prototype.un); - -goog.exportProperty( - ol.source.OSM.prototype, - 'unByKey', - ol.source.OSM.prototype.unByKey); - -goog.exportProperty( - ol.source.Raster.prototype, - 'getAttributions', - ol.source.Raster.prototype.getAttributions); - -goog.exportProperty( - ol.source.Raster.prototype, - 'getLogo', - ol.source.Raster.prototype.getLogo); - -goog.exportProperty( - ol.source.Raster.prototype, - 'getProjection', - ol.source.Raster.prototype.getProjection); - -goog.exportProperty( - ol.source.Raster.prototype, - 'getState', - ol.source.Raster.prototype.getState); - -goog.exportProperty( - ol.source.Raster.prototype, - 'setAttributions', - ol.source.Raster.prototype.setAttributions); - -goog.exportProperty( - ol.source.Raster.prototype, - 'get', - ol.source.Raster.prototype.get); - -goog.exportProperty( - ol.source.Raster.prototype, - 'getKeys', - ol.source.Raster.prototype.getKeys); - -goog.exportProperty( - ol.source.Raster.prototype, - 'getProperties', - ol.source.Raster.prototype.getProperties); - -goog.exportProperty( - ol.source.Raster.prototype, - 'set', - ol.source.Raster.prototype.set); - -goog.exportProperty( - ol.source.Raster.prototype, - 'setProperties', - ol.source.Raster.prototype.setProperties); - -goog.exportProperty( - ol.source.Raster.prototype, - 'unset', - ol.source.Raster.prototype.unset); - -goog.exportProperty( - ol.source.Raster.prototype, - 'changed', - ol.source.Raster.prototype.changed); - -goog.exportProperty( - ol.source.Raster.prototype, - 'dispatchEvent', - ol.source.Raster.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.Raster.prototype, - 'getRevision', - ol.source.Raster.prototype.getRevision); - -goog.exportProperty( - ol.source.Raster.prototype, - 'on', - ol.source.Raster.prototype.on); - -goog.exportProperty( - ol.source.Raster.prototype, - 'once', - ol.source.Raster.prototype.once); - -goog.exportProperty( - ol.source.Raster.prototype, - 'un', - ol.source.Raster.prototype.un); - -goog.exportProperty( - ol.source.Raster.prototype, - 'unByKey', - ol.source.Raster.prototype.unByKey); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'setRenderReprojectionEdges', - ol.source.Stamen.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'setTileGridForProjection', - ol.source.Stamen.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getTileLoadFunction', - ol.source.Stamen.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getTileUrlFunction', - ol.source.Stamen.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getUrls', - ol.source.Stamen.prototype.getUrls); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'setTileLoadFunction', - ol.source.Stamen.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'setTileUrlFunction', - ol.source.Stamen.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'setUrl', - ol.source.Stamen.prototype.setUrl); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'setUrls', - ol.source.Stamen.prototype.setUrls); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getTileGrid', - ol.source.Stamen.prototype.getTileGrid); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getAttributions', - ol.source.Stamen.prototype.getAttributions); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getLogo', - ol.source.Stamen.prototype.getLogo); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getProjection', - ol.source.Stamen.prototype.getProjection); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getState', - ol.source.Stamen.prototype.getState); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'setAttributions', - ol.source.Stamen.prototype.setAttributions); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'get', - ol.source.Stamen.prototype.get); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getKeys', - ol.source.Stamen.prototype.getKeys); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getProperties', - ol.source.Stamen.prototype.getProperties); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'set', - ol.source.Stamen.prototype.set); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'setProperties', - ol.source.Stamen.prototype.setProperties); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'unset', - ol.source.Stamen.prototype.unset); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'changed', - ol.source.Stamen.prototype.changed); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'dispatchEvent', - ol.source.Stamen.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'getRevision', - ol.source.Stamen.prototype.getRevision); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'on', - ol.source.Stamen.prototype.on); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'once', - ol.source.Stamen.prototype.once); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'un', - ol.source.Stamen.prototype.un); - -goog.exportProperty( - ol.source.Stamen.prototype, - 'unByKey', - ol.source.Stamen.prototype.unByKey); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'setRenderReprojectionEdges', - ol.source.TileArcGISRest.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'setTileGridForProjection', - ol.source.TileArcGISRest.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getTileLoadFunction', - ol.source.TileArcGISRest.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getTileUrlFunction', - ol.source.TileArcGISRest.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getUrls', - ol.source.TileArcGISRest.prototype.getUrls); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'setTileLoadFunction', - ol.source.TileArcGISRest.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'setTileUrlFunction', - ol.source.TileArcGISRest.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'setUrl', - ol.source.TileArcGISRest.prototype.setUrl); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'setUrls', - ol.source.TileArcGISRest.prototype.setUrls); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getTileGrid', - ol.source.TileArcGISRest.prototype.getTileGrid); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getAttributions', - ol.source.TileArcGISRest.prototype.getAttributions); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getLogo', - ol.source.TileArcGISRest.prototype.getLogo); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getProjection', - ol.source.TileArcGISRest.prototype.getProjection); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getState', - ol.source.TileArcGISRest.prototype.getState); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'setAttributions', - ol.source.TileArcGISRest.prototype.setAttributions); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'get', - ol.source.TileArcGISRest.prototype.get); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getKeys', - ol.source.TileArcGISRest.prototype.getKeys); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getProperties', - ol.source.TileArcGISRest.prototype.getProperties); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'set', - ol.source.TileArcGISRest.prototype.set); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'setProperties', - ol.source.TileArcGISRest.prototype.setProperties); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'unset', - ol.source.TileArcGISRest.prototype.unset); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'changed', - ol.source.TileArcGISRest.prototype.changed); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'dispatchEvent', - ol.source.TileArcGISRest.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'getRevision', - ol.source.TileArcGISRest.prototype.getRevision); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'on', - ol.source.TileArcGISRest.prototype.on); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'once', - ol.source.TileArcGISRest.prototype.once); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'un', - ol.source.TileArcGISRest.prototype.un); - -goog.exportProperty( - ol.source.TileArcGISRest.prototype, - 'unByKey', - ol.source.TileArcGISRest.prototype.unByKey); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'getTileGrid', - ol.source.TileDebug.prototype.getTileGrid); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'getAttributions', - ol.source.TileDebug.prototype.getAttributions); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'getLogo', - ol.source.TileDebug.prototype.getLogo); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'getProjection', - ol.source.TileDebug.prototype.getProjection); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'getState', - ol.source.TileDebug.prototype.getState); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'setAttributions', - ol.source.TileDebug.prototype.setAttributions); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'get', - ol.source.TileDebug.prototype.get); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'getKeys', - ol.source.TileDebug.prototype.getKeys); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'getProperties', - ol.source.TileDebug.prototype.getProperties); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'set', - ol.source.TileDebug.prototype.set); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'setProperties', - ol.source.TileDebug.prototype.setProperties); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'unset', - ol.source.TileDebug.prototype.unset); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'changed', - ol.source.TileDebug.prototype.changed); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'dispatchEvent', - ol.source.TileDebug.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'getRevision', - ol.source.TileDebug.prototype.getRevision); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'on', - ol.source.TileDebug.prototype.on); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'once', - ol.source.TileDebug.prototype.once); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'un', - ol.source.TileDebug.prototype.un); - -goog.exportProperty( - ol.source.TileDebug.prototype, - 'unByKey', - ol.source.TileDebug.prototype.unByKey); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'setRenderReprojectionEdges', - ol.source.TileJSON.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'setTileGridForProjection', - ol.source.TileJSON.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getTileLoadFunction', - ol.source.TileJSON.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getTileUrlFunction', - ol.source.TileJSON.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getUrls', - ol.source.TileJSON.prototype.getUrls); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'setTileLoadFunction', - ol.source.TileJSON.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'setTileUrlFunction', - ol.source.TileJSON.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'setUrl', - ol.source.TileJSON.prototype.setUrl); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'setUrls', - ol.source.TileJSON.prototype.setUrls); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getTileGrid', - ol.source.TileJSON.prototype.getTileGrid); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getAttributions', - ol.source.TileJSON.prototype.getAttributions); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getLogo', - ol.source.TileJSON.prototype.getLogo); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getProjection', - ol.source.TileJSON.prototype.getProjection); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getState', - ol.source.TileJSON.prototype.getState); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'setAttributions', - ol.source.TileJSON.prototype.setAttributions); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'get', - ol.source.TileJSON.prototype.get); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getKeys', - ol.source.TileJSON.prototype.getKeys); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getProperties', - ol.source.TileJSON.prototype.getProperties); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'set', - ol.source.TileJSON.prototype.set); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'setProperties', - ol.source.TileJSON.prototype.setProperties); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'unset', - ol.source.TileJSON.prototype.unset); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'changed', - ol.source.TileJSON.prototype.changed); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'dispatchEvent', - ol.source.TileJSON.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'getRevision', - ol.source.TileJSON.prototype.getRevision); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'on', - ol.source.TileJSON.prototype.on); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'once', - ol.source.TileJSON.prototype.once); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'un', - ol.source.TileJSON.prototype.un); - -goog.exportProperty( - ol.source.TileJSON.prototype, - 'unByKey', - ol.source.TileJSON.prototype.unByKey); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getTileGrid', - ol.source.TileUTFGrid.prototype.getTileGrid); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getAttributions', - ol.source.TileUTFGrid.prototype.getAttributions); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getLogo', - ol.source.TileUTFGrid.prototype.getLogo); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getProjection', - ol.source.TileUTFGrid.prototype.getProjection); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getState', - ol.source.TileUTFGrid.prototype.getState); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'setAttributions', - ol.source.TileUTFGrid.prototype.setAttributions); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'get', - ol.source.TileUTFGrid.prototype.get); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getKeys', - ol.source.TileUTFGrid.prototype.getKeys); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getProperties', - ol.source.TileUTFGrid.prototype.getProperties); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'set', - ol.source.TileUTFGrid.prototype.set); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'setProperties', - ol.source.TileUTFGrid.prototype.setProperties); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'unset', - ol.source.TileUTFGrid.prototype.unset); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'changed', - ol.source.TileUTFGrid.prototype.changed); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'dispatchEvent', - ol.source.TileUTFGrid.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'getRevision', - ol.source.TileUTFGrid.prototype.getRevision); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'on', - ol.source.TileUTFGrid.prototype.on); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'once', - ol.source.TileUTFGrid.prototype.once); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'un', - ol.source.TileUTFGrid.prototype.un); - -goog.exportProperty( - ol.source.TileUTFGrid.prototype, - 'unByKey', - ol.source.TileUTFGrid.prototype.unByKey); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'setRenderReprojectionEdges', - ol.source.TileWMS.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'setTileGridForProjection', - ol.source.TileWMS.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getTileLoadFunction', - ol.source.TileWMS.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getTileUrlFunction', - ol.source.TileWMS.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getUrls', - ol.source.TileWMS.prototype.getUrls); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'setTileLoadFunction', - ol.source.TileWMS.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'setTileUrlFunction', - ol.source.TileWMS.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'setUrl', - ol.source.TileWMS.prototype.setUrl); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'setUrls', - ol.source.TileWMS.prototype.setUrls); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getTileGrid', - ol.source.TileWMS.prototype.getTileGrid); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getAttributions', - ol.source.TileWMS.prototype.getAttributions); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getLogo', - ol.source.TileWMS.prototype.getLogo); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getProjection', - ol.source.TileWMS.prototype.getProjection); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getState', - ol.source.TileWMS.prototype.getState); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'setAttributions', - ol.source.TileWMS.prototype.setAttributions); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'get', - ol.source.TileWMS.prototype.get); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getKeys', - ol.source.TileWMS.prototype.getKeys); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getProperties', - ol.source.TileWMS.prototype.getProperties); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'set', - ol.source.TileWMS.prototype.set); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'setProperties', - ol.source.TileWMS.prototype.setProperties); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'unset', - ol.source.TileWMS.prototype.unset); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'changed', - ol.source.TileWMS.prototype.changed); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'dispatchEvent', - ol.source.TileWMS.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'getRevision', - ol.source.TileWMS.prototype.getRevision); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'on', - ol.source.TileWMS.prototype.on); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'once', - ol.source.TileWMS.prototype.once); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'un', - ol.source.TileWMS.prototype.un); - -goog.exportProperty( - ol.source.TileWMS.prototype, - 'unByKey', - ol.source.TileWMS.prototype.unByKey); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getTileLoadFunction', - ol.source.VectorTile.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getTileUrlFunction', - ol.source.VectorTile.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getUrls', - ol.source.VectorTile.prototype.getUrls); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'setTileLoadFunction', - ol.source.VectorTile.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'setTileUrlFunction', - ol.source.VectorTile.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'setUrl', - ol.source.VectorTile.prototype.setUrl); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'setUrls', - ol.source.VectorTile.prototype.setUrls); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getTileGrid', - ol.source.VectorTile.prototype.getTileGrid); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getAttributions', - ol.source.VectorTile.prototype.getAttributions); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getLogo', - ol.source.VectorTile.prototype.getLogo); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getProjection', - ol.source.VectorTile.prototype.getProjection); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getState', - ol.source.VectorTile.prototype.getState); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'setAttributions', - ol.source.VectorTile.prototype.setAttributions); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'get', - ol.source.VectorTile.prototype.get); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getKeys', - ol.source.VectorTile.prototype.getKeys); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getProperties', - ol.source.VectorTile.prototype.getProperties); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'set', - ol.source.VectorTile.prototype.set); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'setProperties', - ol.source.VectorTile.prototype.setProperties); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'unset', - ol.source.VectorTile.prototype.unset); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'changed', - ol.source.VectorTile.prototype.changed); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'dispatchEvent', - ol.source.VectorTile.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'getRevision', - ol.source.VectorTile.prototype.getRevision); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'on', - ol.source.VectorTile.prototype.on); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'once', - ol.source.VectorTile.prototype.once); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'un', - ol.source.VectorTile.prototype.un); - -goog.exportProperty( - ol.source.VectorTile.prototype, - 'unByKey', - ol.source.VectorTile.prototype.unByKey); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'setRenderReprojectionEdges', - ol.source.WMTS.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'setTileGridForProjection', - ol.source.WMTS.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getTileLoadFunction', - ol.source.WMTS.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getTileUrlFunction', - ol.source.WMTS.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getUrls', - ol.source.WMTS.prototype.getUrls); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'setTileLoadFunction', - ol.source.WMTS.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'setTileUrlFunction', - ol.source.WMTS.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'setUrl', - ol.source.WMTS.prototype.setUrl); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'setUrls', - ol.source.WMTS.prototype.setUrls); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getTileGrid', - ol.source.WMTS.prototype.getTileGrid); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getAttributions', - ol.source.WMTS.prototype.getAttributions); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getLogo', - ol.source.WMTS.prototype.getLogo); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getProjection', - ol.source.WMTS.prototype.getProjection); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getState', - ol.source.WMTS.prototype.getState); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'setAttributions', - ol.source.WMTS.prototype.setAttributions); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'get', - ol.source.WMTS.prototype.get); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getKeys', - ol.source.WMTS.prototype.getKeys); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getProperties', - ol.source.WMTS.prototype.getProperties); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'set', - ol.source.WMTS.prototype.set); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'setProperties', - ol.source.WMTS.prototype.setProperties); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'unset', - ol.source.WMTS.prototype.unset); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'changed', - ol.source.WMTS.prototype.changed); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'dispatchEvent', - ol.source.WMTS.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'getRevision', - ol.source.WMTS.prototype.getRevision); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'on', - ol.source.WMTS.prototype.on); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'once', - ol.source.WMTS.prototype.once); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'un', - ol.source.WMTS.prototype.un); - -goog.exportProperty( - ol.source.WMTS.prototype, - 'unByKey', - ol.source.WMTS.prototype.unByKey); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'setRenderReprojectionEdges', - ol.source.Zoomify.prototype.setRenderReprojectionEdges); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'setTileGridForProjection', - ol.source.Zoomify.prototype.setTileGridForProjection); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getTileLoadFunction', - ol.source.Zoomify.prototype.getTileLoadFunction); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getTileUrlFunction', - ol.source.Zoomify.prototype.getTileUrlFunction); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getUrls', - ol.source.Zoomify.prototype.getUrls); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'setTileLoadFunction', - ol.source.Zoomify.prototype.setTileLoadFunction); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'setTileUrlFunction', - ol.source.Zoomify.prototype.setTileUrlFunction); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'setUrl', - ol.source.Zoomify.prototype.setUrl); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'setUrls', - ol.source.Zoomify.prototype.setUrls); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getTileGrid', - ol.source.Zoomify.prototype.getTileGrid); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getAttributions', - ol.source.Zoomify.prototype.getAttributions); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getLogo', - ol.source.Zoomify.prototype.getLogo); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getProjection', - ol.source.Zoomify.prototype.getProjection); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getState', - ol.source.Zoomify.prototype.getState); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'setAttributions', - ol.source.Zoomify.prototype.setAttributions); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'get', - ol.source.Zoomify.prototype.get); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getKeys', - ol.source.Zoomify.prototype.getKeys); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getProperties', - ol.source.Zoomify.prototype.getProperties); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'set', - ol.source.Zoomify.prototype.set); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'setProperties', - ol.source.Zoomify.prototype.setProperties); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'unset', - ol.source.Zoomify.prototype.unset); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'changed', - ol.source.Zoomify.prototype.changed); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'dispatchEvent', - ol.source.Zoomify.prototype.dispatchEvent); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'getRevision', - ol.source.Zoomify.prototype.getRevision); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'on', - ol.source.Zoomify.prototype.on); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'once', - ol.source.Zoomify.prototype.once); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'un', - ol.source.Zoomify.prototype.un); - -goog.exportProperty( - ol.source.Zoomify.prototype, - 'unByKey', - ol.source.Zoomify.prototype.unByKey); - -goog.exportProperty( - ol.reproj.Tile.prototype, - 'getTileCoord', - ol.reproj.Tile.prototype.getTileCoord); - -goog.exportProperty( - ol.renderer.Layer.prototype, - 'changed', - ol.renderer.Layer.prototype.changed); - -goog.exportProperty( - ol.renderer.Layer.prototype, - 'dispatchEvent', - ol.renderer.Layer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.Layer.prototype, - 'getRevision', - ol.renderer.Layer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.Layer.prototype, - 'on', - ol.renderer.Layer.prototype.on); - -goog.exportProperty( - ol.renderer.Layer.prototype, - 'once', - ol.renderer.Layer.prototype.once); - -goog.exportProperty( - ol.renderer.Layer.prototype, - 'un', - ol.renderer.Layer.prototype.un); - -goog.exportProperty( - ol.renderer.Layer.prototype, - 'unByKey', - ol.renderer.Layer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.webgl.Layer.prototype, - 'changed', - ol.renderer.webgl.Layer.prototype.changed); - -goog.exportProperty( - ol.renderer.webgl.Layer.prototype, - 'dispatchEvent', - ol.renderer.webgl.Layer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.webgl.Layer.prototype, - 'getRevision', - ol.renderer.webgl.Layer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.webgl.Layer.prototype, - 'on', - ol.renderer.webgl.Layer.prototype.on); - -goog.exportProperty( - ol.renderer.webgl.Layer.prototype, - 'once', - ol.renderer.webgl.Layer.prototype.once); - -goog.exportProperty( - ol.renderer.webgl.Layer.prototype, - 'un', - ol.renderer.webgl.Layer.prototype.un); - -goog.exportProperty( - ol.renderer.webgl.Layer.prototype, - 'unByKey', - ol.renderer.webgl.Layer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.webgl.ImageLayer.prototype, - 'changed', - ol.renderer.webgl.ImageLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.webgl.ImageLayer.prototype, - 'dispatchEvent', - ol.renderer.webgl.ImageLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.webgl.ImageLayer.prototype, - 'getRevision', - ol.renderer.webgl.ImageLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.webgl.ImageLayer.prototype, - 'on', - ol.renderer.webgl.ImageLayer.prototype.on); - -goog.exportProperty( - ol.renderer.webgl.ImageLayer.prototype, - 'once', - ol.renderer.webgl.ImageLayer.prototype.once); - -goog.exportProperty( - ol.renderer.webgl.ImageLayer.prototype, - 'un', - ol.renderer.webgl.ImageLayer.prototype.un); - -goog.exportProperty( - ol.renderer.webgl.ImageLayer.prototype, - 'unByKey', - ol.renderer.webgl.ImageLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.webgl.TileLayer.prototype, - 'changed', - ol.renderer.webgl.TileLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.webgl.TileLayer.prototype, - 'dispatchEvent', - ol.renderer.webgl.TileLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.webgl.TileLayer.prototype, - 'getRevision', - ol.renderer.webgl.TileLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.webgl.TileLayer.prototype, - 'on', - ol.renderer.webgl.TileLayer.prototype.on); - -goog.exportProperty( - ol.renderer.webgl.TileLayer.prototype, - 'once', - ol.renderer.webgl.TileLayer.prototype.once); - -goog.exportProperty( - ol.renderer.webgl.TileLayer.prototype, - 'un', - ol.renderer.webgl.TileLayer.prototype.un); - -goog.exportProperty( - ol.renderer.webgl.TileLayer.prototype, - 'unByKey', - ol.renderer.webgl.TileLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.webgl.VectorLayer.prototype, - 'changed', - ol.renderer.webgl.VectorLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.webgl.VectorLayer.prototype, - 'dispatchEvent', - ol.renderer.webgl.VectorLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.webgl.VectorLayer.prototype, - 'getRevision', - ol.renderer.webgl.VectorLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.webgl.VectorLayer.prototype, - 'on', - ol.renderer.webgl.VectorLayer.prototype.on); - -goog.exportProperty( - ol.renderer.webgl.VectorLayer.prototype, - 'once', - ol.renderer.webgl.VectorLayer.prototype.once); - -goog.exportProperty( - ol.renderer.webgl.VectorLayer.prototype, - 'un', - ol.renderer.webgl.VectorLayer.prototype.un); - -goog.exportProperty( - ol.renderer.webgl.VectorLayer.prototype, - 'unByKey', - ol.renderer.webgl.VectorLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.dom.Layer.prototype, - 'changed', - ol.renderer.dom.Layer.prototype.changed); - -goog.exportProperty( - ol.renderer.dom.Layer.prototype, - 'dispatchEvent', - ol.renderer.dom.Layer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.dom.Layer.prototype, - 'getRevision', - ol.renderer.dom.Layer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.dom.Layer.prototype, - 'on', - ol.renderer.dom.Layer.prototype.on); - -goog.exportProperty( - ol.renderer.dom.Layer.prototype, - 'once', - ol.renderer.dom.Layer.prototype.once); - -goog.exportProperty( - ol.renderer.dom.Layer.prototype, - 'un', - ol.renderer.dom.Layer.prototype.un); - -goog.exportProperty( - ol.renderer.dom.Layer.prototype, - 'unByKey', - ol.renderer.dom.Layer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.dom.ImageLayer.prototype, - 'changed', - ol.renderer.dom.ImageLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.dom.ImageLayer.prototype, - 'dispatchEvent', - ol.renderer.dom.ImageLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.dom.ImageLayer.prototype, - 'getRevision', - ol.renderer.dom.ImageLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.dom.ImageLayer.prototype, - 'on', - ol.renderer.dom.ImageLayer.prototype.on); - -goog.exportProperty( - ol.renderer.dom.ImageLayer.prototype, - 'once', - ol.renderer.dom.ImageLayer.prototype.once); - -goog.exportProperty( - ol.renderer.dom.ImageLayer.prototype, - 'un', - ol.renderer.dom.ImageLayer.prototype.un); - -goog.exportProperty( - ol.renderer.dom.ImageLayer.prototype, - 'unByKey', - ol.renderer.dom.ImageLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.dom.TileLayer.prototype, - 'changed', - ol.renderer.dom.TileLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.dom.TileLayer.prototype, - 'dispatchEvent', - ol.renderer.dom.TileLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.dom.TileLayer.prototype, - 'getRevision', - ol.renderer.dom.TileLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.dom.TileLayer.prototype, - 'on', - ol.renderer.dom.TileLayer.prototype.on); - -goog.exportProperty( - ol.renderer.dom.TileLayer.prototype, - 'once', - ol.renderer.dom.TileLayer.prototype.once); - -goog.exportProperty( - ol.renderer.dom.TileLayer.prototype, - 'un', - ol.renderer.dom.TileLayer.prototype.un); - -goog.exportProperty( - ol.renderer.dom.TileLayer.prototype, - 'unByKey', - ol.renderer.dom.TileLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.dom.VectorLayer.prototype, - 'changed', - ol.renderer.dom.VectorLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.dom.VectorLayer.prototype, - 'dispatchEvent', - ol.renderer.dom.VectorLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.dom.VectorLayer.prototype, - 'getRevision', - ol.renderer.dom.VectorLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.dom.VectorLayer.prototype, - 'on', - ol.renderer.dom.VectorLayer.prototype.on); - -goog.exportProperty( - ol.renderer.dom.VectorLayer.prototype, - 'once', - ol.renderer.dom.VectorLayer.prototype.once); - -goog.exportProperty( - ol.renderer.dom.VectorLayer.prototype, - 'un', - ol.renderer.dom.VectorLayer.prototype.un); - -goog.exportProperty( - ol.renderer.dom.VectorLayer.prototype, - 'unByKey', - ol.renderer.dom.VectorLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.canvas.Layer.prototype, - 'changed', - ol.renderer.canvas.Layer.prototype.changed); - -goog.exportProperty( - ol.renderer.canvas.Layer.prototype, - 'dispatchEvent', - ol.renderer.canvas.Layer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.canvas.Layer.prototype, - 'getRevision', - ol.renderer.canvas.Layer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.canvas.Layer.prototype, - 'on', - ol.renderer.canvas.Layer.prototype.on); - -goog.exportProperty( - ol.renderer.canvas.Layer.prototype, - 'once', - ol.renderer.canvas.Layer.prototype.once); - -goog.exportProperty( - ol.renderer.canvas.Layer.prototype, - 'un', - ol.renderer.canvas.Layer.prototype.un); - -goog.exportProperty( - ol.renderer.canvas.Layer.prototype, - 'unByKey', - ol.renderer.canvas.Layer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.canvas.ImageLayer.prototype, - 'changed', - ol.renderer.canvas.ImageLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.canvas.ImageLayer.prototype, - 'dispatchEvent', - ol.renderer.canvas.ImageLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.canvas.ImageLayer.prototype, - 'getRevision', - ol.renderer.canvas.ImageLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.canvas.ImageLayer.prototype, - 'on', - ol.renderer.canvas.ImageLayer.prototype.on); - -goog.exportProperty( - ol.renderer.canvas.ImageLayer.prototype, - 'once', - ol.renderer.canvas.ImageLayer.prototype.once); - -goog.exportProperty( - ol.renderer.canvas.ImageLayer.prototype, - 'un', - ol.renderer.canvas.ImageLayer.prototype.un); - -goog.exportProperty( - ol.renderer.canvas.ImageLayer.prototype, - 'unByKey', - ol.renderer.canvas.ImageLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.canvas.TileLayer.prototype, - 'changed', - ol.renderer.canvas.TileLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.canvas.TileLayer.prototype, - 'dispatchEvent', - ol.renderer.canvas.TileLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.canvas.TileLayer.prototype, - 'getRevision', - ol.renderer.canvas.TileLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.canvas.TileLayer.prototype, - 'on', - ol.renderer.canvas.TileLayer.prototype.on); - -goog.exportProperty( - ol.renderer.canvas.TileLayer.prototype, - 'once', - ol.renderer.canvas.TileLayer.prototype.once); - -goog.exportProperty( - ol.renderer.canvas.TileLayer.prototype, - 'un', - ol.renderer.canvas.TileLayer.prototype.un); - -goog.exportProperty( - ol.renderer.canvas.TileLayer.prototype, - 'unByKey', - ol.renderer.canvas.TileLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.canvas.VectorLayer.prototype, - 'changed', - ol.renderer.canvas.VectorLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.canvas.VectorLayer.prototype, - 'dispatchEvent', - ol.renderer.canvas.VectorLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.canvas.VectorLayer.prototype, - 'getRevision', - ol.renderer.canvas.VectorLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.canvas.VectorLayer.prototype, - 'on', - ol.renderer.canvas.VectorLayer.prototype.on); - -goog.exportProperty( - ol.renderer.canvas.VectorLayer.prototype, - 'once', - ol.renderer.canvas.VectorLayer.prototype.once); - -goog.exportProperty( - ol.renderer.canvas.VectorLayer.prototype, - 'un', - ol.renderer.canvas.VectorLayer.prototype.un); - -goog.exportProperty( - ol.renderer.canvas.VectorLayer.prototype, - 'unByKey', - ol.renderer.canvas.VectorLayer.prototype.unByKey); - -goog.exportProperty( - ol.renderer.canvas.VectorTileLayer.prototype, - 'changed', - ol.renderer.canvas.VectorTileLayer.prototype.changed); - -goog.exportProperty( - ol.renderer.canvas.VectorTileLayer.prototype, - 'dispatchEvent', - ol.renderer.canvas.VectorTileLayer.prototype.dispatchEvent); - -goog.exportProperty( - ol.renderer.canvas.VectorTileLayer.prototype, - 'getRevision', - ol.renderer.canvas.VectorTileLayer.prototype.getRevision); - -goog.exportProperty( - ol.renderer.canvas.VectorTileLayer.prototype, - 'on', - ol.renderer.canvas.VectorTileLayer.prototype.on); - -goog.exportProperty( - ol.renderer.canvas.VectorTileLayer.prototype, - 'once', - ol.renderer.canvas.VectorTileLayer.prototype.once); - -goog.exportProperty( - ol.renderer.canvas.VectorTileLayer.prototype, - 'un', - ol.renderer.canvas.VectorTileLayer.prototype.un); - -goog.exportProperty( - ol.renderer.canvas.VectorTileLayer.prototype, - 'unByKey', - ol.renderer.canvas.VectorTileLayer.prototype.unByKey); - -goog.exportProperty( - ol.layer.Base.prototype, - 'get', - ol.layer.Base.prototype.get); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getKeys', - ol.layer.Base.prototype.getKeys); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getProperties', - ol.layer.Base.prototype.getProperties); - -goog.exportProperty( - ol.layer.Base.prototype, - 'set', - ol.layer.Base.prototype.set); - -goog.exportProperty( - ol.layer.Base.prototype, - 'setProperties', - ol.layer.Base.prototype.setProperties); - -goog.exportProperty( - ol.layer.Base.prototype, - 'unset', - ol.layer.Base.prototype.unset); - -goog.exportProperty( - ol.layer.Base.prototype, - 'changed', - ol.layer.Base.prototype.changed); - -goog.exportProperty( - ol.layer.Base.prototype, - 'dispatchEvent', - ol.layer.Base.prototype.dispatchEvent); - -goog.exportProperty( - ol.layer.Base.prototype, - 'getRevision', - ol.layer.Base.prototype.getRevision); - -goog.exportProperty( - ol.layer.Base.prototype, - 'on', - ol.layer.Base.prototype.on); - -goog.exportProperty( - ol.layer.Base.prototype, - 'once', - ol.layer.Base.prototype.once); - -goog.exportProperty( - ol.layer.Base.prototype, - 'un', - ol.layer.Base.prototype.un); - -goog.exportProperty( - ol.layer.Base.prototype, - 'unByKey', - ol.layer.Base.prototype.unByKey); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getExtent', - ol.layer.Layer.prototype.getExtent); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getMaxResolution', - ol.layer.Layer.prototype.getMaxResolution); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getMinResolution', - ol.layer.Layer.prototype.getMinResolution); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getOpacity', - ol.layer.Layer.prototype.getOpacity); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getVisible', - ol.layer.Layer.prototype.getVisible); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getZIndex', - ol.layer.Layer.prototype.getZIndex); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setExtent', - ol.layer.Layer.prototype.setExtent); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setMaxResolution', - ol.layer.Layer.prototype.setMaxResolution); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setMinResolution', - ol.layer.Layer.prototype.setMinResolution); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setOpacity', - ol.layer.Layer.prototype.setOpacity); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setVisible', - ol.layer.Layer.prototype.setVisible); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setZIndex', - ol.layer.Layer.prototype.setZIndex); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'get', - ol.layer.Layer.prototype.get); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getKeys', - ol.layer.Layer.prototype.getKeys); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getProperties', - ol.layer.Layer.prototype.getProperties); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'set', - ol.layer.Layer.prototype.set); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'setProperties', - ol.layer.Layer.prototype.setProperties); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'unset', - ol.layer.Layer.prototype.unset); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'changed', - ol.layer.Layer.prototype.changed); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'dispatchEvent', - ol.layer.Layer.prototype.dispatchEvent); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'getRevision', - ol.layer.Layer.prototype.getRevision); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'on', - ol.layer.Layer.prototype.on); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'once', - ol.layer.Layer.prototype.once); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'un', - ol.layer.Layer.prototype.un); - -goog.exportProperty( - ol.layer.Layer.prototype, - 'unByKey', - ol.layer.Layer.prototype.unByKey); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setMap', - ol.layer.Vector.prototype.setMap); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setSource', - ol.layer.Vector.prototype.setSource); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getExtent', - ol.layer.Vector.prototype.getExtent); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getMaxResolution', - ol.layer.Vector.prototype.getMaxResolution); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getMinResolution', - ol.layer.Vector.prototype.getMinResolution); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getOpacity', - ol.layer.Vector.prototype.getOpacity); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getVisible', - ol.layer.Vector.prototype.getVisible); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getZIndex', - ol.layer.Vector.prototype.getZIndex); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setExtent', - ol.layer.Vector.prototype.setExtent); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setMaxResolution', - ol.layer.Vector.prototype.setMaxResolution); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setMinResolution', - ol.layer.Vector.prototype.setMinResolution); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setOpacity', - ol.layer.Vector.prototype.setOpacity); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setVisible', - ol.layer.Vector.prototype.setVisible); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setZIndex', - ol.layer.Vector.prototype.setZIndex); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'get', - ol.layer.Vector.prototype.get); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getKeys', - ol.layer.Vector.prototype.getKeys); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getProperties', - ol.layer.Vector.prototype.getProperties); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'set', - ol.layer.Vector.prototype.set); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'setProperties', - ol.layer.Vector.prototype.setProperties); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'unset', - ol.layer.Vector.prototype.unset); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'changed', - ol.layer.Vector.prototype.changed); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'dispatchEvent', - ol.layer.Vector.prototype.dispatchEvent); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'getRevision', - ol.layer.Vector.prototype.getRevision); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'on', - ol.layer.Vector.prototype.on); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'once', - ol.layer.Vector.prototype.once); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'un', - ol.layer.Vector.prototype.un); - -goog.exportProperty( - ol.layer.Vector.prototype, - 'unByKey', - ol.layer.Vector.prototype.unByKey); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getSource', - ol.layer.Heatmap.prototype.getSource); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getStyle', - ol.layer.Heatmap.prototype.getStyle); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getStyleFunction', - ol.layer.Heatmap.prototype.getStyleFunction); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setStyle', - ol.layer.Heatmap.prototype.setStyle); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setMap', - ol.layer.Heatmap.prototype.setMap); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setSource', - ol.layer.Heatmap.prototype.setSource); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getExtent', - ol.layer.Heatmap.prototype.getExtent); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getMaxResolution', - ol.layer.Heatmap.prototype.getMaxResolution); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getMinResolution', - ol.layer.Heatmap.prototype.getMinResolution); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getOpacity', - ol.layer.Heatmap.prototype.getOpacity); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getVisible', - ol.layer.Heatmap.prototype.getVisible); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getZIndex', - ol.layer.Heatmap.prototype.getZIndex); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setExtent', - ol.layer.Heatmap.prototype.setExtent); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setMaxResolution', - ol.layer.Heatmap.prototype.setMaxResolution); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setMinResolution', - ol.layer.Heatmap.prototype.setMinResolution); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setOpacity', - ol.layer.Heatmap.prototype.setOpacity); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setVisible', - ol.layer.Heatmap.prototype.setVisible); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setZIndex', - ol.layer.Heatmap.prototype.setZIndex); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'get', - ol.layer.Heatmap.prototype.get); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getKeys', - ol.layer.Heatmap.prototype.getKeys); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getProperties', - ol.layer.Heatmap.prototype.getProperties); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'set', - ol.layer.Heatmap.prototype.set); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'setProperties', - ol.layer.Heatmap.prototype.setProperties); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'unset', - ol.layer.Heatmap.prototype.unset); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'changed', - ol.layer.Heatmap.prototype.changed); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'dispatchEvent', - ol.layer.Heatmap.prototype.dispatchEvent); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'getRevision', - ol.layer.Heatmap.prototype.getRevision); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'on', - ol.layer.Heatmap.prototype.on); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'once', - ol.layer.Heatmap.prototype.once); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'un', - ol.layer.Heatmap.prototype.un); - -goog.exportProperty( - ol.layer.Heatmap.prototype, - 'unByKey', - ol.layer.Heatmap.prototype.unByKey); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setMap', - ol.layer.Image.prototype.setMap); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setSource', - ol.layer.Image.prototype.setSource); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getExtent', - ol.layer.Image.prototype.getExtent); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getMaxResolution', - ol.layer.Image.prototype.getMaxResolution); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getMinResolution', - ol.layer.Image.prototype.getMinResolution); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getOpacity', - ol.layer.Image.prototype.getOpacity); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getVisible', - ol.layer.Image.prototype.getVisible); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getZIndex', - ol.layer.Image.prototype.getZIndex); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setExtent', - ol.layer.Image.prototype.setExtent); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setMaxResolution', - ol.layer.Image.prototype.setMaxResolution); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setMinResolution', - ol.layer.Image.prototype.setMinResolution); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setOpacity', - ol.layer.Image.prototype.setOpacity); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setVisible', - ol.layer.Image.prototype.setVisible); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setZIndex', - ol.layer.Image.prototype.setZIndex); - -goog.exportProperty( - ol.layer.Image.prototype, - 'get', - ol.layer.Image.prototype.get); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getKeys', - ol.layer.Image.prototype.getKeys); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getProperties', - ol.layer.Image.prototype.getProperties); - -goog.exportProperty( - ol.layer.Image.prototype, - 'set', - ol.layer.Image.prototype.set); - -goog.exportProperty( - ol.layer.Image.prototype, - 'setProperties', - ol.layer.Image.prototype.setProperties); - -goog.exportProperty( - ol.layer.Image.prototype, - 'unset', - ol.layer.Image.prototype.unset); - -goog.exportProperty( - ol.layer.Image.prototype, - 'changed', - ol.layer.Image.prototype.changed); - -goog.exportProperty( - ol.layer.Image.prototype, - 'dispatchEvent', - ol.layer.Image.prototype.dispatchEvent); - -goog.exportProperty( - ol.layer.Image.prototype, - 'getRevision', - ol.layer.Image.prototype.getRevision); - -goog.exportProperty( - ol.layer.Image.prototype, - 'on', - ol.layer.Image.prototype.on); - -goog.exportProperty( - ol.layer.Image.prototype, - 'once', - ol.layer.Image.prototype.once); - -goog.exportProperty( - ol.layer.Image.prototype, - 'un', - ol.layer.Image.prototype.un); - -goog.exportProperty( - ol.layer.Image.prototype, - 'unByKey', - ol.layer.Image.prototype.unByKey); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getExtent', - ol.layer.Group.prototype.getExtent); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getMaxResolution', - ol.layer.Group.prototype.getMaxResolution); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getMinResolution', - ol.layer.Group.prototype.getMinResolution); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getOpacity', - ol.layer.Group.prototype.getOpacity); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getVisible', - ol.layer.Group.prototype.getVisible); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getZIndex', - ol.layer.Group.prototype.getZIndex); - -goog.exportProperty( - ol.layer.Group.prototype, - 'setExtent', - ol.layer.Group.prototype.setExtent); - -goog.exportProperty( - ol.layer.Group.prototype, - 'setMaxResolution', - ol.layer.Group.prototype.setMaxResolution); - -goog.exportProperty( - ol.layer.Group.prototype, - 'setMinResolution', - ol.layer.Group.prototype.setMinResolution); - -goog.exportProperty( - ol.layer.Group.prototype, - 'setOpacity', - ol.layer.Group.prototype.setOpacity); - -goog.exportProperty( - ol.layer.Group.prototype, - 'setVisible', - ol.layer.Group.prototype.setVisible); - -goog.exportProperty( - ol.layer.Group.prototype, - 'setZIndex', - ol.layer.Group.prototype.setZIndex); - -goog.exportProperty( - ol.layer.Group.prototype, - 'get', - ol.layer.Group.prototype.get); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getKeys', - ol.layer.Group.prototype.getKeys); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getProperties', - ol.layer.Group.prototype.getProperties); - -goog.exportProperty( - ol.layer.Group.prototype, - 'set', - ol.layer.Group.prototype.set); - -goog.exportProperty( - ol.layer.Group.prototype, - 'setProperties', - ol.layer.Group.prototype.setProperties); - -goog.exportProperty( - ol.layer.Group.prototype, - 'unset', - ol.layer.Group.prototype.unset); - -goog.exportProperty( - ol.layer.Group.prototype, - 'changed', - ol.layer.Group.prototype.changed); - -goog.exportProperty( - ol.layer.Group.prototype, - 'dispatchEvent', - ol.layer.Group.prototype.dispatchEvent); - -goog.exportProperty( - ol.layer.Group.prototype, - 'getRevision', - ol.layer.Group.prototype.getRevision); - -goog.exportProperty( - ol.layer.Group.prototype, - 'on', - ol.layer.Group.prototype.on); - -goog.exportProperty( - ol.layer.Group.prototype, - 'once', - ol.layer.Group.prototype.once); - -goog.exportProperty( - ol.layer.Group.prototype, - 'un', - ol.layer.Group.prototype.un); - -goog.exportProperty( - ol.layer.Group.prototype, - 'unByKey', - ol.layer.Group.prototype.unByKey); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setMap', - ol.layer.Tile.prototype.setMap); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setSource', - ol.layer.Tile.prototype.setSource); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getExtent', - ol.layer.Tile.prototype.getExtent); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getMaxResolution', - ol.layer.Tile.prototype.getMaxResolution); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getMinResolution', - ol.layer.Tile.prototype.getMinResolution); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getOpacity', - ol.layer.Tile.prototype.getOpacity); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getVisible', - ol.layer.Tile.prototype.getVisible); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getZIndex', - ol.layer.Tile.prototype.getZIndex); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setExtent', - ol.layer.Tile.prototype.setExtent); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setMaxResolution', - ol.layer.Tile.prototype.setMaxResolution); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setMinResolution', - ol.layer.Tile.prototype.setMinResolution); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setOpacity', - ol.layer.Tile.prototype.setOpacity); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setVisible', - ol.layer.Tile.prototype.setVisible); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setZIndex', - ol.layer.Tile.prototype.setZIndex); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'get', - ol.layer.Tile.prototype.get); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getKeys', - ol.layer.Tile.prototype.getKeys); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getProperties', - ol.layer.Tile.prototype.getProperties); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'set', - ol.layer.Tile.prototype.set); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'setProperties', - ol.layer.Tile.prototype.setProperties); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'unset', - ol.layer.Tile.prototype.unset); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'changed', - ol.layer.Tile.prototype.changed); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'dispatchEvent', - ol.layer.Tile.prototype.dispatchEvent); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'getRevision', - ol.layer.Tile.prototype.getRevision); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'on', - ol.layer.Tile.prototype.on); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'once', - ol.layer.Tile.prototype.once); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'un', - ol.layer.Tile.prototype.un); - -goog.exportProperty( - ol.layer.Tile.prototype, - 'unByKey', - ol.layer.Tile.prototype.unByKey); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getStyle', - ol.layer.VectorTile.prototype.getStyle); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getStyleFunction', - ol.layer.VectorTile.prototype.getStyleFunction); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setStyle', - ol.layer.VectorTile.prototype.setStyle); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setMap', - ol.layer.VectorTile.prototype.setMap); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setSource', - ol.layer.VectorTile.prototype.setSource); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getExtent', - ol.layer.VectorTile.prototype.getExtent); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getMaxResolution', - ol.layer.VectorTile.prototype.getMaxResolution); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getMinResolution', - ol.layer.VectorTile.prototype.getMinResolution); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getOpacity', - ol.layer.VectorTile.prototype.getOpacity); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getVisible', - ol.layer.VectorTile.prototype.getVisible); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getZIndex', - ol.layer.VectorTile.prototype.getZIndex); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setExtent', - ol.layer.VectorTile.prototype.setExtent); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setMaxResolution', - ol.layer.VectorTile.prototype.setMaxResolution); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setMinResolution', - ol.layer.VectorTile.prototype.setMinResolution); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setOpacity', - ol.layer.VectorTile.prototype.setOpacity); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setVisible', - ol.layer.VectorTile.prototype.setVisible); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setZIndex', - ol.layer.VectorTile.prototype.setZIndex); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'get', - ol.layer.VectorTile.prototype.get); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getKeys', - ol.layer.VectorTile.prototype.getKeys); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getProperties', - ol.layer.VectorTile.prototype.getProperties); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'set', - ol.layer.VectorTile.prototype.set); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'setProperties', - ol.layer.VectorTile.prototype.setProperties); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'unset', - ol.layer.VectorTile.prototype.unset); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'changed', - ol.layer.VectorTile.prototype.changed); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'dispatchEvent', - ol.layer.VectorTile.prototype.dispatchEvent); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'getRevision', - ol.layer.VectorTile.prototype.getRevision); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'on', - ol.layer.VectorTile.prototype.on); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'once', - ol.layer.VectorTile.prototype.once); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'un', - ol.layer.VectorTile.prototype.un); - -goog.exportProperty( - ol.layer.VectorTile.prototype, - 'unByKey', - ol.layer.VectorTile.prototype.unByKey); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'get', - ol.interaction.Interaction.prototype.get); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'getKeys', - ol.interaction.Interaction.prototype.getKeys); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'getProperties', - ol.interaction.Interaction.prototype.getProperties); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'set', - ol.interaction.Interaction.prototype.set); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'setProperties', - ol.interaction.Interaction.prototype.setProperties); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'unset', - ol.interaction.Interaction.prototype.unset); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'changed', - ol.interaction.Interaction.prototype.changed); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'dispatchEvent', - ol.interaction.Interaction.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'getRevision', - ol.interaction.Interaction.prototype.getRevision); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'on', - ol.interaction.Interaction.prototype.on); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'once', - ol.interaction.Interaction.prototype.once); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'un', - ol.interaction.Interaction.prototype.un); - -goog.exportProperty( - ol.interaction.Interaction.prototype, - 'unByKey', - ol.interaction.Interaction.prototype.unByKey); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'getActive', - ol.interaction.DoubleClickZoom.prototype.getActive); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'setActive', - ol.interaction.DoubleClickZoom.prototype.setActive); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'get', - ol.interaction.DoubleClickZoom.prototype.get); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'getKeys', - ol.interaction.DoubleClickZoom.prototype.getKeys); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'getProperties', - ol.interaction.DoubleClickZoom.prototype.getProperties); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'set', - ol.interaction.DoubleClickZoom.prototype.set); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'setProperties', - ol.interaction.DoubleClickZoom.prototype.setProperties); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'unset', - ol.interaction.DoubleClickZoom.prototype.unset); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'changed', - ol.interaction.DoubleClickZoom.prototype.changed); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'dispatchEvent', - ol.interaction.DoubleClickZoom.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'getRevision', - ol.interaction.DoubleClickZoom.prototype.getRevision); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'on', - ol.interaction.DoubleClickZoom.prototype.on); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'once', - ol.interaction.DoubleClickZoom.prototype.once); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'un', - ol.interaction.DoubleClickZoom.prototype.un); - -goog.exportProperty( - ol.interaction.DoubleClickZoom.prototype, - 'unByKey', - ol.interaction.DoubleClickZoom.prototype.unByKey); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'getActive', - ol.interaction.DragAndDrop.prototype.getActive); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'setActive', - ol.interaction.DragAndDrop.prototype.setActive); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'get', - ol.interaction.DragAndDrop.prototype.get); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'getKeys', - ol.interaction.DragAndDrop.prototype.getKeys); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'getProperties', - ol.interaction.DragAndDrop.prototype.getProperties); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'set', - ol.interaction.DragAndDrop.prototype.set); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'setProperties', - ol.interaction.DragAndDrop.prototype.setProperties); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'unset', - ol.interaction.DragAndDrop.prototype.unset); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'changed', - ol.interaction.DragAndDrop.prototype.changed); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'dispatchEvent', - ol.interaction.DragAndDrop.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'getRevision', - ol.interaction.DragAndDrop.prototype.getRevision); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'on', - ol.interaction.DragAndDrop.prototype.on); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'once', - ol.interaction.DragAndDrop.prototype.once); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'un', - ol.interaction.DragAndDrop.prototype.un); - -goog.exportProperty( - ol.interaction.DragAndDrop.prototype, - 'unByKey', - ol.interaction.DragAndDrop.prototype.unByKey); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'getActive', - ol.interaction.Pointer.prototype.getActive); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'setActive', - ol.interaction.Pointer.prototype.setActive); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'get', - ol.interaction.Pointer.prototype.get); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'getKeys', - ol.interaction.Pointer.prototype.getKeys); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'getProperties', - ol.interaction.Pointer.prototype.getProperties); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'set', - ol.interaction.Pointer.prototype.set); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'setProperties', - ol.interaction.Pointer.prototype.setProperties); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'unset', - ol.interaction.Pointer.prototype.unset); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'changed', - ol.interaction.Pointer.prototype.changed); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'dispatchEvent', - ol.interaction.Pointer.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'getRevision', - ol.interaction.Pointer.prototype.getRevision); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'on', - ol.interaction.Pointer.prototype.on); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'once', - ol.interaction.Pointer.prototype.once); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'un', - ol.interaction.Pointer.prototype.un); - -goog.exportProperty( - ol.interaction.Pointer.prototype, - 'unByKey', - ol.interaction.Pointer.prototype.unByKey); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'getActive', - ol.interaction.DragBox.prototype.getActive); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'setActive', - ol.interaction.DragBox.prototype.setActive); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'get', - ol.interaction.DragBox.prototype.get); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'getKeys', - ol.interaction.DragBox.prototype.getKeys); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'getProperties', - ol.interaction.DragBox.prototype.getProperties); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'set', - ol.interaction.DragBox.prototype.set); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'setProperties', - ol.interaction.DragBox.prototype.setProperties); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'unset', - ol.interaction.DragBox.prototype.unset); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'changed', - ol.interaction.DragBox.prototype.changed); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'dispatchEvent', - ol.interaction.DragBox.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'getRevision', - ol.interaction.DragBox.prototype.getRevision); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'on', - ol.interaction.DragBox.prototype.on); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'once', - ol.interaction.DragBox.prototype.once); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'un', - ol.interaction.DragBox.prototype.un); - -goog.exportProperty( - ol.interaction.DragBox.prototype, - 'unByKey', - ol.interaction.DragBox.prototype.unByKey); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'getActive', - ol.interaction.DragPan.prototype.getActive); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'setActive', - ol.interaction.DragPan.prototype.setActive); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'get', - ol.interaction.DragPan.prototype.get); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'getKeys', - ol.interaction.DragPan.prototype.getKeys); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'getProperties', - ol.interaction.DragPan.prototype.getProperties); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'set', - ol.interaction.DragPan.prototype.set); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'setProperties', - ol.interaction.DragPan.prototype.setProperties); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'unset', - ol.interaction.DragPan.prototype.unset); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'changed', - ol.interaction.DragPan.prototype.changed); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'dispatchEvent', - ol.interaction.DragPan.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'getRevision', - ol.interaction.DragPan.prototype.getRevision); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'on', - ol.interaction.DragPan.prototype.on); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'once', - ol.interaction.DragPan.prototype.once); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'un', - ol.interaction.DragPan.prototype.un); - -goog.exportProperty( - ol.interaction.DragPan.prototype, - 'unByKey', - ol.interaction.DragPan.prototype.unByKey); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'getActive', - ol.interaction.DragRotateAndZoom.prototype.getActive); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'setActive', - ol.interaction.DragRotateAndZoom.prototype.setActive); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'get', - ol.interaction.DragRotateAndZoom.prototype.get); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'getKeys', - ol.interaction.DragRotateAndZoom.prototype.getKeys); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'getProperties', - ol.interaction.DragRotateAndZoom.prototype.getProperties); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'set', - ol.interaction.DragRotateAndZoom.prototype.set); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'setProperties', - ol.interaction.DragRotateAndZoom.prototype.setProperties); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'unset', - ol.interaction.DragRotateAndZoom.prototype.unset); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'changed', - ol.interaction.DragRotateAndZoom.prototype.changed); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'dispatchEvent', - ol.interaction.DragRotateAndZoom.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'getRevision', - ol.interaction.DragRotateAndZoom.prototype.getRevision); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'on', - ol.interaction.DragRotateAndZoom.prototype.on); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'once', - ol.interaction.DragRotateAndZoom.prototype.once); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'un', - ol.interaction.DragRotateAndZoom.prototype.un); - -goog.exportProperty( - ol.interaction.DragRotateAndZoom.prototype, - 'unByKey', - ol.interaction.DragRotateAndZoom.prototype.unByKey); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'getActive', - ol.interaction.DragRotate.prototype.getActive); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'setActive', - ol.interaction.DragRotate.prototype.setActive); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'get', - ol.interaction.DragRotate.prototype.get); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'getKeys', - ol.interaction.DragRotate.prototype.getKeys); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'getProperties', - ol.interaction.DragRotate.prototype.getProperties); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'set', - ol.interaction.DragRotate.prototype.set); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'setProperties', - ol.interaction.DragRotate.prototype.setProperties); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'unset', - ol.interaction.DragRotate.prototype.unset); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'changed', - ol.interaction.DragRotate.prototype.changed); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'dispatchEvent', - ol.interaction.DragRotate.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'getRevision', - ol.interaction.DragRotate.prototype.getRevision); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'on', - ol.interaction.DragRotate.prototype.on); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'once', - ol.interaction.DragRotate.prototype.once); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'un', - ol.interaction.DragRotate.prototype.un); - -goog.exportProperty( - ol.interaction.DragRotate.prototype, - 'unByKey', - ol.interaction.DragRotate.prototype.unByKey); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'getGeometry', - ol.interaction.DragZoom.prototype.getGeometry); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'getActive', - ol.interaction.DragZoom.prototype.getActive); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'setActive', - ol.interaction.DragZoom.prototype.setActive); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'get', - ol.interaction.DragZoom.prototype.get); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'getKeys', - ol.interaction.DragZoom.prototype.getKeys); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'getProperties', - ol.interaction.DragZoom.prototype.getProperties); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'set', - ol.interaction.DragZoom.prototype.set); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'setProperties', - ol.interaction.DragZoom.prototype.setProperties); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'unset', - ol.interaction.DragZoom.prototype.unset); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'changed', - ol.interaction.DragZoom.prototype.changed); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'dispatchEvent', - ol.interaction.DragZoom.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'getRevision', - ol.interaction.DragZoom.prototype.getRevision); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'on', - ol.interaction.DragZoom.prototype.on); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'once', - ol.interaction.DragZoom.prototype.once); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'un', - ol.interaction.DragZoom.prototype.un); - -goog.exportProperty( - ol.interaction.DragZoom.prototype, - 'unByKey', - ol.interaction.DragZoom.prototype.unByKey); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'getActive', - ol.interaction.Draw.prototype.getActive); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'setActive', - ol.interaction.Draw.prototype.setActive); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'get', - ol.interaction.Draw.prototype.get); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'getKeys', - ol.interaction.Draw.prototype.getKeys); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'getProperties', - ol.interaction.Draw.prototype.getProperties); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'set', - ol.interaction.Draw.prototype.set); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'setProperties', - ol.interaction.Draw.prototype.setProperties); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'unset', - ol.interaction.Draw.prototype.unset); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'changed', - ol.interaction.Draw.prototype.changed); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'dispatchEvent', - ol.interaction.Draw.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'getRevision', - ol.interaction.Draw.prototype.getRevision); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'on', - ol.interaction.Draw.prototype.on); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'once', - ol.interaction.Draw.prototype.once); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'un', - ol.interaction.Draw.prototype.un); - -goog.exportProperty( - ol.interaction.Draw.prototype, - 'unByKey', - ol.interaction.Draw.prototype.unByKey); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'getActive', - ol.interaction.KeyboardPan.prototype.getActive); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'setActive', - ol.interaction.KeyboardPan.prototype.setActive); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'get', - ol.interaction.KeyboardPan.prototype.get); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'getKeys', - ol.interaction.KeyboardPan.prototype.getKeys); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'getProperties', - ol.interaction.KeyboardPan.prototype.getProperties); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'set', - ol.interaction.KeyboardPan.prototype.set); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'setProperties', - ol.interaction.KeyboardPan.prototype.setProperties); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'unset', - ol.interaction.KeyboardPan.prototype.unset); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'changed', - ol.interaction.KeyboardPan.prototype.changed); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'dispatchEvent', - ol.interaction.KeyboardPan.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'getRevision', - ol.interaction.KeyboardPan.prototype.getRevision); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'on', - ol.interaction.KeyboardPan.prototype.on); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'once', - ol.interaction.KeyboardPan.prototype.once); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'un', - ol.interaction.KeyboardPan.prototype.un); - -goog.exportProperty( - ol.interaction.KeyboardPan.prototype, - 'unByKey', - ol.interaction.KeyboardPan.prototype.unByKey); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'getActive', - ol.interaction.KeyboardZoom.prototype.getActive); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'setActive', - ol.interaction.KeyboardZoom.prototype.setActive); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'get', - ol.interaction.KeyboardZoom.prototype.get); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'getKeys', - ol.interaction.KeyboardZoom.prototype.getKeys); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'getProperties', - ol.interaction.KeyboardZoom.prototype.getProperties); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'set', - ol.interaction.KeyboardZoom.prototype.set); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'setProperties', - ol.interaction.KeyboardZoom.prototype.setProperties); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'unset', - ol.interaction.KeyboardZoom.prototype.unset); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'changed', - ol.interaction.KeyboardZoom.prototype.changed); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'dispatchEvent', - ol.interaction.KeyboardZoom.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'getRevision', - ol.interaction.KeyboardZoom.prototype.getRevision); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'on', - ol.interaction.KeyboardZoom.prototype.on); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'once', - ol.interaction.KeyboardZoom.prototype.once); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'un', - ol.interaction.KeyboardZoom.prototype.un); - -goog.exportProperty( - ol.interaction.KeyboardZoom.prototype, - 'unByKey', - ol.interaction.KeyboardZoom.prototype.unByKey); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'getActive', - ol.interaction.Modify.prototype.getActive); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'setActive', - ol.interaction.Modify.prototype.setActive); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'get', - ol.interaction.Modify.prototype.get); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'getKeys', - ol.interaction.Modify.prototype.getKeys); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'getProperties', - ol.interaction.Modify.prototype.getProperties); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'set', - ol.interaction.Modify.prototype.set); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'setProperties', - ol.interaction.Modify.prototype.setProperties); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'unset', - ol.interaction.Modify.prototype.unset); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'changed', - ol.interaction.Modify.prototype.changed); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'dispatchEvent', - ol.interaction.Modify.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'getRevision', - ol.interaction.Modify.prototype.getRevision); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'on', - ol.interaction.Modify.prototype.on); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'once', - ol.interaction.Modify.prototype.once); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'un', - ol.interaction.Modify.prototype.un); - -goog.exportProperty( - ol.interaction.Modify.prototype, - 'unByKey', - ol.interaction.Modify.prototype.unByKey); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'getActive', - ol.interaction.MouseWheelZoom.prototype.getActive); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'setActive', - ol.interaction.MouseWheelZoom.prototype.setActive); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'get', - ol.interaction.MouseWheelZoom.prototype.get); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'getKeys', - ol.interaction.MouseWheelZoom.prototype.getKeys); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'getProperties', - ol.interaction.MouseWheelZoom.prototype.getProperties); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'set', - ol.interaction.MouseWheelZoom.prototype.set); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'setProperties', - ol.interaction.MouseWheelZoom.prototype.setProperties); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'unset', - ol.interaction.MouseWheelZoom.prototype.unset); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'changed', - ol.interaction.MouseWheelZoom.prototype.changed); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'dispatchEvent', - ol.interaction.MouseWheelZoom.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'getRevision', - ol.interaction.MouseWheelZoom.prototype.getRevision); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'on', - ol.interaction.MouseWheelZoom.prototype.on); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'once', - ol.interaction.MouseWheelZoom.prototype.once); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'un', - ol.interaction.MouseWheelZoom.prototype.un); - -goog.exportProperty( - ol.interaction.MouseWheelZoom.prototype, - 'unByKey', - ol.interaction.MouseWheelZoom.prototype.unByKey); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'getActive', - ol.interaction.PinchRotate.prototype.getActive); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'setActive', - ol.interaction.PinchRotate.prototype.setActive); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'get', - ol.interaction.PinchRotate.prototype.get); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'getKeys', - ol.interaction.PinchRotate.prototype.getKeys); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'getProperties', - ol.interaction.PinchRotate.prototype.getProperties); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'set', - ol.interaction.PinchRotate.prototype.set); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'setProperties', - ol.interaction.PinchRotate.prototype.setProperties); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'unset', - ol.interaction.PinchRotate.prototype.unset); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'changed', - ol.interaction.PinchRotate.prototype.changed); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'dispatchEvent', - ol.interaction.PinchRotate.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'getRevision', - ol.interaction.PinchRotate.prototype.getRevision); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'on', - ol.interaction.PinchRotate.prototype.on); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'once', - ol.interaction.PinchRotate.prototype.once); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'un', - ol.interaction.PinchRotate.prototype.un); - -goog.exportProperty( - ol.interaction.PinchRotate.prototype, - 'unByKey', - ol.interaction.PinchRotate.prototype.unByKey); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'getActive', - ol.interaction.PinchZoom.prototype.getActive); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'setActive', - ol.interaction.PinchZoom.prototype.setActive); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'get', - ol.interaction.PinchZoom.prototype.get); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'getKeys', - ol.interaction.PinchZoom.prototype.getKeys); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'getProperties', - ol.interaction.PinchZoom.prototype.getProperties); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'set', - ol.interaction.PinchZoom.prototype.set); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'setProperties', - ol.interaction.PinchZoom.prototype.setProperties); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'unset', - ol.interaction.PinchZoom.prototype.unset); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'changed', - ol.interaction.PinchZoom.prototype.changed); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'dispatchEvent', - ol.interaction.PinchZoom.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'getRevision', - ol.interaction.PinchZoom.prototype.getRevision); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'on', - ol.interaction.PinchZoom.prototype.on); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'once', - ol.interaction.PinchZoom.prototype.once); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'un', - ol.interaction.PinchZoom.prototype.un); - -goog.exportProperty( - ol.interaction.PinchZoom.prototype, - 'unByKey', - ol.interaction.PinchZoom.prototype.unByKey); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'getActive', - ol.interaction.Select.prototype.getActive); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'setActive', - ol.interaction.Select.prototype.setActive); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'get', - ol.interaction.Select.prototype.get); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'getKeys', - ol.interaction.Select.prototype.getKeys); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'getProperties', - ol.interaction.Select.prototype.getProperties); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'set', - ol.interaction.Select.prototype.set); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'setProperties', - ol.interaction.Select.prototype.setProperties); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'unset', - ol.interaction.Select.prototype.unset); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'changed', - ol.interaction.Select.prototype.changed); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'dispatchEvent', - ol.interaction.Select.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'getRevision', - ol.interaction.Select.prototype.getRevision); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'on', - ol.interaction.Select.prototype.on); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'once', - ol.interaction.Select.prototype.once); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'un', - ol.interaction.Select.prototype.un); - -goog.exportProperty( - ol.interaction.Select.prototype, - 'unByKey', - ol.interaction.Select.prototype.unByKey); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'getActive', - ol.interaction.Snap.prototype.getActive); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'setActive', - ol.interaction.Snap.prototype.setActive); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'get', - ol.interaction.Snap.prototype.get); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'getKeys', - ol.interaction.Snap.prototype.getKeys); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'getProperties', - ol.interaction.Snap.prototype.getProperties); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'set', - ol.interaction.Snap.prototype.set); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'setProperties', - ol.interaction.Snap.prototype.setProperties); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'unset', - ol.interaction.Snap.prototype.unset); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'changed', - ol.interaction.Snap.prototype.changed); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'dispatchEvent', - ol.interaction.Snap.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'getRevision', - ol.interaction.Snap.prototype.getRevision); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'on', - ol.interaction.Snap.prototype.on); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'once', - ol.interaction.Snap.prototype.once); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'un', - ol.interaction.Snap.prototype.un); - -goog.exportProperty( - ol.interaction.Snap.prototype, - 'unByKey', - ol.interaction.Snap.prototype.unByKey); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'getActive', - ol.interaction.Translate.prototype.getActive); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'setActive', - ol.interaction.Translate.prototype.setActive); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'get', - ol.interaction.Translate.prototype.get); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'getKeys', - ol.interaction.Translate.prototype.getKeys); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'getProperties', - ol.interaction.Translate.prototype.getProperties); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'set', - ol.interaction.Translate.prototype.set); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'setProperties', - ol.interaction.Translate.prototype.setProperties); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'unset', - ol.interaction.Translate.prototype.unset); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'changed', - ol.interaction.Translate.prototype.changed); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'dispatchEvent', - ol.interaction.Translate.prototype.dispatchEvent); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'getRevision', - ol.interaction.Translate.prototype.getRevision); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'on', - ol.interaction.Translate.prototype.on); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'once', - ol.interaction.Translate.prototype.once); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'un', - ol.interaction.Translate.prototype.un); - -goog.exportProperty( - ol.interaction.Translate.prototype, - 'unByKey', - ol.interaction.Translate.prototype.unByKey); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'get', - ol.geom.Geometry.prototype.get); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'getKeys', - ol.geom.Geometry.prototype.getKeys); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'getProperties', - ol.geom.Geometry.prototype.getProperties); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'set', - ol.geom.Geometry.prototype.set); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'setProperties', - ol.geom.Geometry.prototype.setProperties); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'unset', - ol.geom.Geometry.prototype.unset); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'changed', - ol.geom.Geometry.prototype.changed); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'dispatchEvent', - ol.geom.Geometry.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'getRevision', - ol.geom.Geometry.prototype.getRevision); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'on', - ol.geom.Geometry.prototype.on); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'once', - ol.geom.Geometry.prototype.once); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'un', - ol.geom.Geometry.prototype.un); - -goog.exportProperty( - ol.geom.Geometry.prototype, - 'unByKey', - ol.geom.Geometry.prototype.unByKey); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'getClosestPoint', - ol.geom.SimpleGeometry.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'getExtent', - ol.geom.SimpleGeometry.prototype.getExtent); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'simplify', - ol.geom.SimpleGeometry.prototype.simplify); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'transform', - ol.geom.SimpleGeometry.prototype.transform); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'get', - ol.geom.SimpleGeometry.prototype.get); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'getKeys', - ol.geom.SimpleGeometry.prototype.getKeys); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'getProperties', - ol.geom.SimpleGeometry.prototype.getProperties); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'set', - ol.geom.SimpleGeometry.prototype.set); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'setProperties', - ol.geom.SimpleGeometry.prototype.setProperties); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'unset', - ol.geom.SimpleGeometry.prototype.unset); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'changed', - ol.geom.SimpleGeometry.prototype.changed); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'dispatchEvent', - ol.geom.SimpleGeometry.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'getRevision', - ol.geom.SimpleGeometry.prototype.getRevision); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'on', - ol.geom.SimpleGeometry.prototype.on); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'once', - ol.geom.SimpleGeometry.prototype.once); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'un', - ol.geom.SimpleGeometry.prototype.un); - -goog.exportProperty( - ol.geom.SimpleGeometry.prototype, - 'unByKey', - ol.geom.SimpleGeometry.prototype.unByKey); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getFirstCoordinate', - ol.geom.Circle.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getLastCoordinate', - ol.geom.Circle.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getLayout', - ol.geom.Circle.prototype.getLayout); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getClosestPoint', - ol.geom.Circle.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getExtent', - ol.geom.Circle.prototype.getExtent); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'simplify', - ol.geom.Circle.prototype.simplify); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'get', - ol.geom.Circle.prototype.get); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getKeys', - ol.geom.Circle.prototype.getKeys); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getProperties', - ol.geom.Circle.prototype.getProperties); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'set', - ol.geom.Circle.prototype.set); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'setProperties', - ol.geom.Circle.prototype.setProperties); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'unset', - ol.geom.Circle.prototype.unset); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'changed', - ol.geom.Circle.prototype.changed); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'dispatchEvent', - ol.geom.Circle.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'getRevision', - ol.geom.Circle.prototype.getRevision); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'on', - ol.geom.Circle.prototype.on); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'once', - ol.geom.Circle.prototype.once); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'un', - ol.geom.Circle.prototype.un); - -goog.exportProperty( - ol.geom.Circle.prototype, - 'unByKey', - ol.geom.Circle.prototype.unByKey); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'getClosestPoint', - ol.geom.GeometryCollection.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'getExtent', - ol.geom.GeometryCollection.prototype.getExtent); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'simplify', - ol.geom.GeometryCollection.prototype.simplify); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'transform', - ol.geom.GeometryCollection.prototype.transform); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'get', - ol.geom.GeometryCollection.prototype.get); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'getKeys', - ol.geom.GeometryCollection.prototype.getKeys); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'getProperties', - ol.geom.GeometryCollection.prototype.getProperties); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'set', - ol.geom.GeometryCollection.prototype.set); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'setProperties', - ol.geom.GeometryCollection.prototype.setProperties); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'unset', - ol.geom.GeometryCollection.prototype.unset); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'changed', - ol.geom.GeometryCollection.prototype.changed); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'dispatchEvent', - ol.geom.GeometryCollection.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'getRevision', - ol.geom.GeometryCollection.prototype.getRevision); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'on', - ol.geom.GeometryCollection.prototype.on); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'once', - ol.geom.GeometryCollection.prototype.once); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'un', - ol.geom.GeometryCollection.prototype.un); - -goog.exportProperty( - ol.geom.GeometryCollection.prototype, - 'unByKey', - ol.geom.GeometryCollection.prototype.unByKey); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getFirstCoordinate', - ol.geom.LinearRing.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getLastCoordinate', - ol.geom.LinearRing.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getLayout', - ol.geom.LinearRing.prototype.getLayout); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getClosestPoint', - ol.geom.LinearRing.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getExtent', - ol.geom.LinearRing.prototype.getExtent); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'simplify', - ol.geom.LinearRing.prototype.simplify); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'transform', - ol.geom.LinearRing.prototype.transform); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'get', - ol.geom.LinearRing.prototype.get); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getKeys', - ol.geom.LinearRing.prototype.getKeys); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getProperties', - ol.geom.LinearRing.prototype.getProperties); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'set', - ol.geom.LinearRing.prototype.set); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'setProperties', - ol.geom.LinearRing.prototype.setProperties); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'unset', - ol.geom.LinearRing.prototype.unset); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'changed', - ol.geom.LinearRing.prototype.changed); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'dispatchEvent', - ol.geom.LinearRing.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'getRevision', - ol.geom.LinearRing.prototype.getRevision); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'on', - ol.geom.LinearRing.prototype.on); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'once', - ol.geom.LinearRing.prototype.once); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'un', - ol.geom.LinearRing.prototype.un); - -goog.exportProperty( - ol.geom.LinearRing.prototype, - 'unByKey', - ol.geom.LinearRing.prototype.unByKey); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getFirstCoordinate', - ol.geom.LineString.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getLastCoordinate', - ol.geom.LineString.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getLayout', - ol.geom.LineString.prototype.getLayout); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getClosestPoint', - ol.geom.LineString.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getExtent', - ol.geom.LineString.prototype.getExtent); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'simplify', - ol.geom.LineString.prototype.simplify); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'transform', - ol.geom.LineString.prototype.transform); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'get', - ol.geom.LineString.prototype.get); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getKeys', - ol.geom.LineString.prototype.getKeys); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getProperties', - ol.geom.LineString.prototype.getProperties); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'set', - ol.geom.LineString.prototype.set); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'setProperties', - ol.geom.LineString.prototype.setProperties); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'unset', - ol.geom.LineString.prototype.unset); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'changed', - ol.geom.LineString.prototype.changed); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'dispatchEvent', - ol.geom.LineString.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'getRevision', - ol.geom.LineString.prototype.getRevision); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'on', - ol.geom.LineString.prototype.on); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'once', - ol.geom.LineString.prototype.once); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'un', - ol.geom.LineString.prototype.un); - -goog.exportProperty( - ol.geom.LineString.prototype, - 'unByKey', - ol.geom.LineString.prototype.unByKey); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getFirstCoordinate', - ol.geom.MultiLineString.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getLastCoordinate', - ol.geom.MultiLineString.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getLayout', - ol.geom.MultiLineString.prototype.getLayout); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getClosestPoint', - ol.geom.MultiLineString.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getExtent', - ol.geom.MultiLineString.prototype.getExtent); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'simplify', - ol.geom.MultiLineString.prototype.simplify); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'transform', - ol.geom.MultiLineString.prototype.transform); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'get', - ol.geom.MultiLineString.prototype.get); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getKeys', - ol.geom.MultiLineString.prototype.getKeys); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getProperties', - ol.geom.MultiLineString.prototype.getProperties); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'set', - ol.geom.MultiLineString.prototype.set); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'setProperties', - ol.geom.MultiLineString.prototype.setProperties); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'unset', - ol.geom.MultiLineString.prototype.unset); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'changed', - ol.geom.MultiLineString.prototype.changed); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'dispatchEvent', - ol.geom.MultiLineString.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'getRevision', - ol.geom.MultiLineString.prototype.getRevision); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'on', - ol.geom.MultiLineString.prototype.on); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'once', - ol.geom.MultiLineString.prototype.once); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'un', - ol.geom.MultiLineString.prototype.un); - -goog.exportProperty( - ol.geom.MultiLineString.prototype, - 'unByKey', - ol.geom.MultiLineString.prototype.unByKey); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getFirstCoordinate', - ol.geom.MultiPoint.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getLastCoordinate', - ol.geom.MultiPoint.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getLayout', - ol.geom.MultiPoint.prototype.getLayout); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getClosestPoint', - ol.geom.MultiPoint.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getExtent', - ol.geom.MultiPoint.prototype.getExtent); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'simplify', - ol.geom.MultiPoint.prototype.simplify); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'transform', - ol.geom.MultiPoint.prototype.transform); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'get', - ol.geom.MultiPoint.prototype.get); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getKeys', - ol.geom.MultiPoint.prototype.getKeys); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getProperties', - ol.geom.MultiPoint.prototype.getProperties); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'set', - ol.geom.MultiPoint.prototype.set); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'setProperties', - ol.geom.MultiPoint.prototype.setProperties); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'unset', - ol.geom.MultiPoint.prototype.unset); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'changed', - ol.geom.MultiPoint.prototype.changed); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'dispatchEvent', - ol.geom.MultiPoint.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'getRevision', - ol.geom.MultiPoint.prototype.getRevision); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'on', - ol.geom.MultiPoint.prototype.on); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'once', - ol.geom.MultiPoint.prototype.once); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'un', - ol.geom.MultiPoint.prototype.un); - -goog.exportProperty( - ol.geom.MultiPoint.prototype, - 'unByKey', - ol.geom.MultiPoint.prototype.unByKey); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getFirstCoordinate', - ol.geom.MultiPolygon.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getLastCoordinate', - ol.geom.MultiPolygon.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getLayout', - ol.geom.MultiPolygon.prototype.getLayout); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getClosestPoint', - ol.geom.MultiPolygon.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getExtent', - ol.geom.MultiPolygon.prototype.getExtent); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'simplify', - ol.geom.MultiPolygon.prototype.simplify); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'transform', - ol.geom.MultiPolygon.prototype.transform); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'get', - ol.geom.MultiPolygon.prototype.get); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getKeys', - ol.geom.MultiPolygon.prototype.getKeys); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getProperties', - ol.geom.MultiPolygon.prototype.getProperties); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'set', - ol.geom.MultiPolygon.prototype.set); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'setProperties', - ol.geom.MultiPolygon.prototype.setProperties); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'unset', - ol.geom.MultiPolygon.prototype.unset); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'changed', - ol.geom.MultiPolygon.prototype.changed); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'dispatchEvent', - ol.geom.MultiPolygon.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'getRevision', - ol.geom.MultiPolygon.prototype.getRevision); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'on', - ol.geom.MultiPolygon.prototype.on); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'once', - ol.geom.MultiPolygon.prototype.once); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'un', - ol.geom.MultiPolygon.prototype.un); - -goog.exportProperty( - ol.geom.MultiPolygon.prototype, - 'unByKey', - ol.geom.MultiPolygon.prototype.unByKey); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getFirstCoordinate', - ol.geom.Point.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getLastCoordinate', - ol.geom.Point.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getLayout', - ol.geom.Point.prototype.getLayout); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getClosestPoint', - ol.geom.Point.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getExtent', - ol.geom.Point.prototype.getExtent); - -goog.exportProperty( - ol.geom.Point.prototype, - 'simplify', - ol.geom.Point.prototype.simplify); - -goog.exportProperty( - ol.geom.Point.prototype, - 'transform', - ol.geom.Point.prototype.transform); - -goog.exportProperty( - ol.geom.Point.prototype, - 'get', - ol.geom.Point.prototype.get); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getKeys', - ol.geom.Point.prototype.getKeys); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getProperties', - ol.geom.Point.prototype.getProperties); - -goog.exportProperty( - ol.geom.Point.prototype, - 'set', - ol.geom.Point.prototype.set); - -goog.exportProperty( - ol.geom.Point.prototype, - 'setProperties', - ol.geom.Point.prototype.setProperties); - -goog.exportProperty( - ol.geom.Point.prototype, - 'unset', - ol.geom.Point.prototype.unset); - -goog.exportProperty( - ol.geom.Point.prototype, - 'changed', - ol.geom.Point.prototype.changed); - -goog.exportProperty( - ol.geom.Point.prototype, - 'dispatchEvent', - ol.geom.Point.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.Point.prototype, - 'getRevision', - ol.geom.Point.prototype.getRevision); - -goog.exportProperty( - ol.geom.Point.prototype, - 'on', - ol.geom.Point.prototype.on); - -goog.exportProperty( - ol.geom.Point.prototype, - 'once', - ol.geom.Point.prototype.once); - -goog.exportProperty( - ol.geom.Point.prototype, - 'un', - ol.geom.Point.prototype.un); - -goog.exportProperty( - ol.geom.Point.prototype, - 'unByKey', - ol.geom.Point.prototype.unByKey); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getFirstCoordinate', - ol.geom.Polygon.prototype.getFirstCoordinate); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getLastCoordinate', - ol.geom.Polygon.prototype.getLastCoordinate); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getLayout', - ol.geom.Polygon.prototype.getLayout); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getClosestPoint', - ol.geom.Polygon.prototype.getClosestPoint); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getExtent', - ol.geom.Polygon.prototype.getExtent); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'simplify', - ol.geom.Polygon.prototype.simplify); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'transform', - ol.geom.Polygon.prototype.transform); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'get', - ol.geom.Polygon.prototype.get); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getKeys', - ol.geom.Polygon.prototype.getKeys); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getProperties', - ol.geom.Polygon.prototype.getProperties); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'set', - ol.geom.Polygon.prototype.set); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'setProperties', - ol.geom.Polygon.prototype.setProperties); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'unset', - ol.geom.Polygon.prototype.unset); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'changed', - ol.geom.Polygon.prototype.changed); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'dispatchEvent', - ol.geom.Polygon.prototype.dispatchEvent); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'getRevision', - ol.geom.Polygon.prototype.getRevision); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'on', - ol.geom.Polygon.prototype.on); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'once', - ol.geom.Polygon.prototype.once); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'un', - ol.geom.Polygon.prototype.un); - -goog.exportProperty( - ol.geom.Polygon.prototype, - 'unByKey', - ol.geom.Polygon.prototype.unByKey); - -goog.exportProperty( - ol.format.GML2.prototype, - 'readFeatures', - ol.format.GML2.prototype.readFeatures); - -goog.exportProperty( - ol.format.GML3.prototype, - 'readFeatures', - ol.format.GML3.prototype.readFeatures); - -goog.exportProperty( - ol.format.GML.prototype, - 'readFeatures', - ol.format.GML.prototype.readFeatures); - -goog.exportProperty( - ol.control.Control.prototype, - 'get', - ol.control.Control.prototype.get); - -goog.exportProperty( - ol.control.Control.prototype, - 'getKeys', - ol.control.Control.prototype.getKeys); - -goog.exportProperty( - ol.control.Control.prototype, - 'getProperties', - ol.control.Control.prototype.getProperties); - -goog.exportProperty( - ol.control.Control.prototype, - 'set', - ol.control.Control.prototype.set); - -goog.exportProperty( - ol.control.Control.prototype, - 'setProperties', - ol.control.Control.prototype.setProperties); - -goog.exportProperty( - ol.control.Control.prototype, - 'unset', - ol.control.Control.prototype.unset); - -goog.exportProperty( - ol.control.Control.prototype, - 'changed', - ol.control.Control.prototype.changed); - -goog.exportProperty( - ol.control.Control.prototype, - 'dispatchEvent', - ol.control.Control.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.Control.prototype, - 'getRevision', - ol.control.Control.prototype.getRevision); - -goog.exportProperty( - ol.control.Control.prototype, - 'on', - ol.control.Control.prototype.on); - -goog.exportProperty( - ol.control.Control.prototype, - 'once', - ol.control.Control.prototype.once); - -goog.exportProperty( - ol.control.Control.prototype, - 'un', - ol.control.Control.prototype.un); - -goog.exportProperty( - ol.control.Control.prototype, - 'unByKey', - ol.control.Control.prototype.unByKey); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'getMap', - ol.control.Attribution.prototype.getMap); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'setMap', - ol.control.Attribution.prototype.setMap); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'setTarget', - ol.control.Attribution.prototype.setTarget); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'get', - ol.control.Attribution.prototype.get); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'getKeys', - ol.control.Attribution.prototype.getKeys); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'getProperties', - ol.control.Attribution.prototype.getProperties); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'set', - ol.control.Attribution.prototype.set); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'setProperties', - ol.control.Attribution.prototype.setProperties); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'unset', - ol.control.Attribution.prototype.unset); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'changed', - ol.control.Attribution.prototype.changed); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'dispatchEvent', - ol.control.Attribution.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'getRevision', - ol.control.Attribution.prototype.getRevision); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'on', - ol.control.Attribution.prototype.on); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'once', - ol.control.Attribution.prototype.once); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'un', - ol.control.Attribution.prototype.un); - -goog.exportProperty( - ol.control.Attribution.prototype, - 'unByKey', - ol.control.Attribution.prototype.unByKey); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'getMap', - ol.control.FullScreen.prototype.getMap); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'setMap', - ol.control.FullScreen.prototype.setMap); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'setTarget', - ol.control.FullScreen.prototype.setTarget); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'get', - ol.control.FullScreen.prototype.get); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'getKeys', - ol.control.FullScreen.prototype.getKeys); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'getProperties', - ol.control.FullScreen.prototype.getProperties); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'set', - ol.control.FullScreen.prototype.set); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'setProperties', - ol.control.FullScreen.prototype.setProperties); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'unset', - ol.control.FullScreen.prototype.unset); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'changed', - ol.control.FullScreen.prototype.changed); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'dispatchEvent', - ol.control.FullScreen.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'getRevision', - ol.control.FullScreen.prototype.getRevision); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'on', - ol.control.FullScreen.prototype.on); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'once', - ol.control.FullScreen.prototype.once); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'un', - ol.control.FullScreen.prototype.un); - -goog.exportProperty( - ol.control.FullScreen.prototype, - 'unByKey', - ol.control.FullScreen.prototype.unByKey); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'getMap', - ol.control.MousePosition.prototype.getMap); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'setMap', - ol.control.MousePosition.prototype.setMap); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'setTarget', - ol.control.MousePosition.prototype.setTarget); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'get', - ol.control.MousePosition.prototype.get); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'getKeys', - ol.control.MousePosition.prototype.getKeys); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'getProperties', - ol.control.MousePosition.prototype.getProperties); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'set', - ol.control.MousePosition.prototype.set); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'setProperties', - ol.control.MousePosition.prototype.setProperties); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'unset', - ol.control.MousePosition.prototype.unset); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'changed', - ol.control.MousePosition.prototype.changed); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'dispatchEvent', - ol.control.MousePosition.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'getRevision', - ol.control.MousePosition.prototype.getRevision); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'on', - ol.control.MousePosition.prototype.on); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'once', - ol.control.MousePosition.prototype.once); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'un', - ol.control.MousePosition.prototype.un); - -goog.exportProperty( - ol.control.MousePosition.prototype, - 'unByKey', - ol.control.MousePosition.prototype.unByKey); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'getMap', - ol.control.OverviewMap.prototype.getMap); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'setMap', - ol.control.OverviewMap.prototype.setMap); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'setTarget', - ol.control.OverviewMap.prototype.setTarget); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'get', - ol.control.OverviewMap.prototype.get); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'getKeys', - ol.control.OverviewMap.prototype.getKeys); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'getProperties', - ol.control.OverviewMap.prototype.getProperties); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'set', - ol.control.OverviewMap.prototype.set); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'setProperties', - ol.control.OverviewMap.prototype.setProperties); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'unset', - ol.control.OverviewMap.prototype.unset); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'changed', - ol.control.OverviewMap.prototype.changed); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'dispatchEvent', - ol.control.OverviewMap.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'getRevision', - ol.control.OverviewMap.prototype.getRevision); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'on', - ol.control.OverviewMap.prototype.on); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'once', - ol.control.OverviewMap.prototype.once); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'un', - ol.control.OverviewMap.prototype.un); - -goog.exportProperty( - ol.control.OverviewMap.prototype, - 'unByKey', - ol.control.OverviewMap.prototype.unByKey); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'getMap', - ol.control.Rotate.prototype.getMap); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'setMap', - ol.control.Rotate.prototype.setMap); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'setTarget', - ol.control.Rotate.prototype.setTarget); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'get', - ol.control.Rotate.prototype.get); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'getKeys', - ol.control.Rotate.prototype.getKeys); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'getProperties', - ol.control.Rotate.prototype.getProperties); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'set', - ol.control.Rotate.prototype.set); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'setProperties', - ol.control.Rotate.prototype.setProperties); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'unset', - ol.control.Rotate.prototype.unset); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'changed', - ol.control.Rotate.prototype.changed); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'dispatchEvent', - ol.control.Rotate.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'getRevision', - ol.control.Rotate.prototype.getRevision); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'on', - ol.control.Rotate.prototype.on); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'once', - ol.control.Rotate.prototype.once); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'un', - ol.control.Rotate.prototype.un); - -goog.exportProperty( - ol.control.Rotate.prototype, - 'unByKey', - ol.control.Rotate.prototype.unByKey); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'getMap', - ol.control.ScaleLine.prototype.getMap); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'setMap', - ol.control.ScaleLine.prototype.setMap); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'setTarget', - ol.control.ScaleLine.prototype.setTarget); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'get', - ol.control.ScaleLine.prototype.get); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'getKeys', - ol.control.ScaleLine.prototype.getKeys); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'getProperties', - ol.control.ScaleLine.prototype.getProperties); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'set', - ol.control.ScaleLine.prototype.set); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'setProperties', - ol.control.ScaleLine.prototype.setProperties); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'unset', - ol.control.ScaleLine.prototype.unset); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'changed', - ol.control.ScaleLine.prototype.changed); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'dispatchEvent', - ol.control.ScaleLine.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'getRevision', - ol.control.ScaleLine.prototype.getRevision); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'on', - ol.control.ScaleLine.prototype.on); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'once', - ol.control.ScaleLine.prototype.once); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'un', - ol.control.ScaleLine.prototype.un); - -goog.exportProperty( - ol.control.ScaleLine.prototype, - 'unByKey', - ol.control.ScaleLine.prototype.unByKey); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'getMap', - ol.control.Zoom.prototype.getMap); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'setMap', - ol.control.Zoom.prototype.setMap); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'setTarget', - ol.control.Zoom.prototype.setTarget); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'get', - ol.control.Zoom.prototype.get); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'getKeys', - ol.control.Zoom.prototype.getKeys); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'getProperties', - ol.control.Zoom.prototype.getProperties); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'set', - ol.control.Zoom.prototype.set); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'setProperties', - ol.control.Zoom.prototype.setProperties); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'unset', - ol.control.Zoom.prototype.unset); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'changed', - ol.control.Zoom.prototype.changed); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'dispatchEvent', - ol.control.Zoom.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'getRevision', - ol.control.Zoom.prototype.getRevision); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'on', - ol.control.Zoom.prototype.on); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'once', - ol.control.Zoom.prototype.once); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'un', - ol.control.Zoom.prototype.un); - -goog.exportProperty( - ol.control.Zoom.prototype, - 'unByKey', - ol.control.Zoom.prototype.unByKey); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'getMap', - ol.control.ZoomSlider.prototype.getMap); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'setMap', - ol.control.ZoomSlider.prototype.setMap); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'setTarget', - ol.control.ZoomSlider.prototype.setTarget); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'get', - ol.control.ZoomSlider.prototype.get); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'getKeys', - ol.control.ZoomSlider.prototype.getKeys); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'getProperties', - ol.control.ZoomSlider.prototype.getProperties); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'set', - ol.control.ZoomSlider.prototype.set); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'setProperties', - ol.control.ZoomSlider.prototype.setProperties); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'unset', - ol.control.ZoomSlider.prototype.unset); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'changed', - ol.control.ZoomSlider.prototype.changed); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'dispatchEvent', - ol.control.ZoomSlider.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'getRevision', - ol.control.ZoomSlider.prototype.getRevision); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'on', - ol.control.ZoomSlider.prototype.on); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'once', - ol.control.ZoomSlider.prototype.once); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'un', - ol.control.ZoomSlider.prototype.un); - -goog.exportProperty( - ol.control.ZoomSlider.prototype, - 'unByKey', - ol.control.ZoomSlider.prototype.unByKey); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'getMap', - ol.control.ZoomToExtent.prototype.getMap); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'setMap', - ol.control.ZoomToExtent.prototype.setMap); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'setTarget', - ol.control.ZoomToExtent.prototype.setTarget); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'get', - ol.control.ZoomToExtent.prototype.get); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'getKeys', - ol.control.ZoomToExtent.prototype.getKeys); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'getProperties', - ol.control.ZoomToExtent.prototype.getProperties); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'set', - ol.control.ZoomToExtent.prototype.set); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'setProperties', - ol.control.ZoomToExtent.prototype.setProperties); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'unset', - ol.control.ZoomToExtent.prototype.unset); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'changed', - ol.control.ZoomToExtent.prototype.changed); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'dispatchEvent', - ol.control.ZoomToExtent.prototype.dispatchEvent); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'getRevision', - ol.control.ZoomToExtent.prototype.getRevision); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'on', - ol.control.ZoomToExtent.prototype.on); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'once', - ol.control.ZoomToExtent.prototype.once); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'un', - ol.control.ZoomToExtent.prototype.un); - -goog.exportProperty( - ol.control.ZoomToExtent.prototype, - 'unByKey', - ol.control.ZoomToExtent.prototype.unByKey); -OPENLAYERS.ol = ol; - - return OPENLAYERS.ol; -})); diff --git a/libs/perfect-scrollbar.zip b/libs/perfect-scrollbar.zip deleted file mode 100644 index 07f3a5f5..00000000 Binary files a/libs/perfect-scrollbar.zip and /dev/null differ diff --git a/libs/plasio/js/client.js b/libs/plasio/js/client.js deleted file mode 100644 index cadfc6c0..00000000 --- a/libs/plasio/js/client.js +++ /dev/null @@ -1,112 +0,0 @@ -// client.js -// Client side stuffs for greyhound web viewer -// - -// Import all modules here even if we don't want to use them -// so that browserify can pick them up -var $ = require('jquery'), - render = require('./render'), - ui = require('./ui'), - laslaz = require('./laslaz'); - - -function endsWith(str, s) { - return str.indexOf(s) === (str.length - s.length); -} - -(function(w) { - "use strict"; - - // The NACL module calls method on the window, make sure the laslaz module - // can see messages sent by NACL - // - window.handleMessage = laslaz.handleMessage; - - // show an error message to the user - // - var errorOut = function(msg) { - $("#messages").html("<p class='error'>" + msg + "</p>"); - console.log('Error : ' + msg); - }; - - // show a status message to the user - var message = function(msg) { - $("#messages").html("<p class='message'>" + msg + "</p>"); - console.log('Status: ' + msg); - }; - - $(document).on("plasio.start", function() { - render.startRenderer($("#container").get(0), message); - }); - -})(window); - -$(function() { - setTimeout(function() { - var isWebGLSupported = function() { - if ("WebGLRenderingContext" in window) { - // might have support - // - var e = document.createElement("canvas"); - var webgl = e.getContext("webgl"); - var experimental = false; - if (webgl === null) { - webgl = e.getContext("experimental-webgl"); - experimental = true; - } - - return [webgl !== null, experimental]; - } - - return false; - }; - - // if we're good to go, trigger the plasio.start event, all initializers - // should be hooked to this event, and not DOMContentLoaded - // - var r = isWebGLSupported(); - var supported = r[0]; - var experimental = r[1]; - if(supported) { - $(".fullscreen").fadeOut(200); - // we need to intialize the UI first, before we initialize everything else, - // since UI has to show results and statuses about things as they initialize - // - $.event.trigger({ - type: "plasio.startUI" - }); - - $.event.trigger({ - type: "plasio.start" - }); - - if (experimental) { - $.event.trigger({ - type: "plasio.webglIsExperimental" - }); - } - - var parseURL = function(qs) { - var name = qs.match(/\?s=(\S+)/); - return name ? name[1] : null; - }; - - - // If a URL is specified, load that now - var query = window.location.search; - if (query) { - query = parseURL(query); - if (query && query.length > 0) { - $.event.trigger({ - type: "plasio.loadfiles.remote", - url: query, - name: query - }); - } - } - } - else { - $("#no-support").css("opacity", 1.0); - } - }, 1000); -}); diff --git a/libs/plasio/js/common.js b/libs/plasio/js/common.js deleted file mode 100644 index f9a9f6bb..00000000 --- a/libs/plasio/js/common.js +++ /dev/null @@ -1,482 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Set to true when the Document is loaded IFF "test=true" is in the query -// string. -var isTest = false; - -// Set to true when loading a "Release" NaCl module, false when loading a -// "Debug" NaCl module. -var isRelease = true; - -// Javascript module pattern: -// see http://en.wikipedia.org/wiki/Unobtrusive_JavaScript#Namespaces -// In essence, we define an anonymous function which is immediately called and -// returns a new object. The new object contains only the exported definitions; -// all other definitions in the anonymous function are inaccessible to external -// code. -var common = (function() { - - function isHostToolchain(tool) { - return tool == 'win' || tool == 'linux' || tool == 'mac'; - } - - /** - * Return the mime type for NaCl plugin. - * - * @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc. - * @return {string} The mime-type for the kind of NaCl plugin matching - * the given toolchain. - */ - function mimeTypeForTool(tool) { - // For NaCl modules use application/x-nacl. - var mimetype = 'application/x-pnacl'; - if (isHostToolchain(tool)) { - // For non-NaCl PPAPI plugins use the x-ppapi-debug/release - // mime type. - if (isRelease) - mimetype = 'application/x-ppapi-release'; - else - mimetype = 'application/x-ppapi-debug'; - } else if (tool == 'pnacl' && isRelease) { - mimetype = 'application/x-pnacl'; - } - return mimetype; - } - - /** - * Check if the browser supports NaCl plugins. - * - * @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc. - * @return {bool} True if the browser supports the type of NaCl plugin - * produced by the given toolchain. - */ - function browserSupportsNaCl(tool) { - // Assume host toolchains always work with the given browser. - // The below mime-type checking might not work with - // --register-pepper-plugins. - if (isHostToolchain(tool)) { - return true; - } - var mimetype = mimeTypeForTool(tool); - return navigator.mimeTypes[mimetype] !== undefined; - } - - /** - * Inject a script into the DOM, and call a callback when it is loaded. - * - * @param {string} url The url of the script to load. - * @param {Function} onload The callback to call when the script is loaded. - * @param {Function} onerror The callback to call if the script fails to load. - */ - function injectScript(url, onload, onerror) { - var scriptEl = document.createElement('script'); - scriptEl.type = 'text/javascript'; - scriptEl.src = url; - scriptEl.onload = onload; - if (onerror) { - scriptEl.addEventListener('error', onerror, false); - } - document.head.appendChild(scriptEl); - } - - /** - * Run all tests for this example. - * - * @param {Object} moduleEl The module DOM element. - */ - function runTests(moduleEl) { - console.log('runTests()'); - common.tester = new Tester(); - - // All NaCl SDK examples are OK if the example exits cleanly; (i.e. the - // NaCl module returns 0 or calls exit(0)). - // - // Without this exception, the browser_tester thinks that the module - // has crashed. - common.tester.exitCleanlyIsOK(); - - common.tester.addAsyncTest('loaded', function(test) { - test.pass(); - }); - - if (typeof window.addTests !== 'undefined') { - window.addTests(); - } - - common.tester.waitFor(moduleEl); - common.tester.run(); - } - - /** - * Create the Native Client <embed> element as a child of the DOM element - * named "listener". - * - * @param {string} name The name of the example. - * @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc. - * @param {string} path Directory name where .nmf file can be found. - * @param {number} width The width to create the plugin. - * @param {number} height The height to create the plugin. - * @param {Object} attrs Dictionary of attributes to set on the module. - */ - function createNaClModule(name, tool, path, width, height, attrs) { - var mimetype = mimeTypeForTool(tool); - - var moduleEl = document.createElement('embed'); - moduleEl.setAttribute('name', 'nacl_module'); - moduleEl.setAttribute('id', 'nacl_module'); - moduleEl.setAttribute('width', width); - moduleEl.setAttribute('height', height); - moduleEl.setAttribute('path', path); - moduleEl.setAttribute('src', path + '/' + name + '.nmf'); - - - // Add any optional arguments - if (attrs) { - for (var key in attrs) { - moduleEl.setAttribute(key, attrs[key]); - } - } - - moduleEl.setAttribute('type', mimetype); - - - // The <EMBED> element is wrapped inside a <DIV>, which has both a 'load' - // and a 'message' event listener attached. This wrapping method is used - // instead of attaching the event listeners directly to the <EMBED> element - // to ensure that the listeners are active before the NaCl module 'load' - // event fires. - var listenerDiv = document.getElementById('listener'); - listenerDiv.appendChild(moduleEl); - - // Host plugins don't send a moduleDidLoad message. We'll fake it here. - var isHost = isHostToolchain(tool); - if (isHost) { - window.setTimeout(function() { - moduleEl.readyState = 1; - moduleEl.dispatchEvent(new CustomEvent('loadstart')); - moduleEl.readyState = 4; - moduleEl.dispatchEvent(new CustomEvent('load')); - moduleEl.dispatchEvent(new CustomEvent('loadend')); - }, 100); // 100 ms - } - - // This is code that is only used to test the SDK. - if (isTest) { - var loadNaClTest = function() { - injectScript('nacltest.js', function() { - runTests(moduleEl); - }); - }; - - // Try to load test.js for the example. Whether or not it exists, load - // nacltest.js. - injectScript('test.js', loadNaClTest, loadNaClTest); - } - } - - /** - * Add the default "load" and "message" event listeners to the element with - * id "listener". - * - * The "load" event is sent when the module is successfully loaded. The - * "message" event is sent when the naclModule posts a message using - * PPB_Messaging.PostMessage() (in C) or pp::Instance().PostMessage() (in - * C++). - */ - function attachDefaultListeners() { - var listenerDiv = document.getElementById('listener'); - listenerDiv.addEventListener('load', moduleDidLoad, true); - listenerDiv.addEventListener('message', handleMessage, true); - listenerDiv.addEventListener('error', handleError, true); - listenerDiv.addEventListener('crash', handleCrash, true); - if (typeof window.attachListeners !== 'undefined') { - window.attachListeners(); - } - } - - /** - * Called when the NaCl module fails to load. - * - * This event listener is registered in createNaClModule above. - */ - function handleError(event) { - // We can't use common.naclModule yet because the module has not been - // loaded. - var moduleEl = document.getElementById('nacl_module'); - updateStatus('ERROR [' + moduleEl.lastError + ']'); - - $.event.trigger({ - type: "plasio.nacl.error", - message: moduleEl.lastError - }); - } - - /** - * Called when the Browser can not communicate with the Module - * - * This event listener is registered in attachDefaultListeners above. - */ - function handleCrash(event) { - var msg = "Unknown Error"; - if (common.naclModule.exitStatus == -1) { - updateStatus('CRASHED'); - msg = "The module has crashed"; - } else { - updateStatus('EXITED [' + common.naclModule.exitStatus + ']'); - msg = "The module has exited"; - } - if (typeof window.handleCrash !== 'undefined') { - window.handleCrash(common.naclModule.lastError); - msg = common.naclModule.lastError; - } - - $.event.trigger({ - type: "plasio.nacl.error", - message: msg - }); - } - - /** - * Called when the NaCl module is loaded. - * - * This event listener is registered in attachDefaultListeners above. - */ - function moduleDidLoad() { - common.naclModule = document.getElementById('nacl_module'); - updateStatus('RUNNING'); - - hideModule(); - $.event.trigger({ - type: "plasio.nacl.available" - }); - } - - /** - * Hide the NaCl module's embed element. - * - * We don't want to hide by default; if we do, it is harder to determine that - * a plugin failed to load. Instead, call this function inside the example's - * "moduleDidLoad" function. - * - */ - function hideModule() { - // Setting common.naclModule.style.display = "None" doesn't work; the - // module will no longer be able to receive postMessages. - common.naclModule.style.height = '0'; - } - - /** - * Remove the NaCl module from the page. - */ - function removeModule() { - common.naclModule.parentNode.removeChild(common.naclModule); - common.naclModule = null; - } - - /** - * Return true when |s| starts with the string |prefix|. - * - * @param {string} s The string to search. - * @param {string} prefix The prefix to search for in |s|. - */ - function startsWith(s, prefix) { - // indexOf would search the entire string, lastIndexOf(p, 0) only checks at - // the first index. See: http://stackoverflow.com/a/4579228 - return s.lastIndexOf(prefix, 0) === 0; - } - - /** Maximum length of logMessageArray. */ - var kMaxLogMessageLength = 20; - - /** An array of messages to display in the element with id "log". */ - var logMessageArray = []; - - /** - * Add a message to an element with id "log". - * - * This function is used by the default "log:" message handler. - * - * @param {string} message The message to log. - */ - function logMessage(message) { - console.log(message); - } - - /** - */ - var defaultMessageTypes = { - 'alert': alert, - 'log': logMessage - }; - - /** - * Called when the NaCl module sends a message to JavaScript (via - * PPB_Messaging.PostMessage()) - * - * This event listener is registered in createNaClModule above. - * - * @param {Event} message_event A message event. message_event.data contains - * the data sent from the NaCl module. - */ - function handleMessage(message_event) { - console.log(JSON.stringify(message_event.data)); - if (typeof message_event.data === 'string') { - for (var type in defaultMessageTypes) { - if (defaultMessageTypes.hasOwnProperty(type)) { - if (startsWith(message_event.data, type + ':')) { - func = defaultMessageTypes[type]; - func(message_event.data.slice(type.length + 1)); - return; - } - } - } - } - - if (typeof window.handleMessage !== 'undefined') { - window.handleMessage(message_event); - return; - } - - logMessage('Unhandled message: ' + message_event.data); - } - - /** - * Called when the DOM content has loaded; i.e. the page's document is fully - * parsed. At this point, we can safely query any elements in the document via - * document.querySelector, document.getElementById, etc. - * - * @param {string} name The name of the example. - * @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc. - * @param {string} path Directory name where .nmf file can be found. - * @param {number} width The width to create the plugin. - * @param {number} height The height to create the plugin. - * @param {Object} attrs Optional dictionary of additional attributes. - */ - function startNaCl(name, tool, path, width, height, attrs) { - // If the page loads before the Native Client module loads, then set the - // status message indicating that the module is still loading. Otherwise, - // do not change the status message. - updateStatus('Page loaded.'); - if (!browserSupportsNaCl(tool)) { - updateStatus( - 'Browser does not support NaCl (' + tool + '), or NaCl is disabled'); - } else if (common.naclModule === null) { - updateStatus('Creating embed: ' + tool); - - // We use a non-zero sized embed to give Chrome space to place the bad - // plug-in graphic, if there is a problem. - width = typeof width !== 'undefined' ? width : 200; - height = typeof height !== 'undefined' ? height : 200; - attachDefaultListeners(); - createNaClModule(name, tool, path, width, height, attrs); - } else { - // It's possible that the Native Client module onload event fired - // before the page's onload event. In this case, the status message - // will reflect 'SUCCESS', but won't be displayed. This call will - // display the current message. - updateStatus('Waiting.'); - } - } - - /** Saved text to display in the element with id 'statusField'. */ - var statusText = 'NO-STATUSES'; - - /** - * Set the global status message. If the element with id 'statusField' - * exists, then set its HTML to the status message as well. - * - * @param {string} opt_message The message to set. If null or undefined, then - * set element 'statusField' to the message from the last call to - * updateStatus. - */ - function updateStatus(opt_message) { - console.log(opt_message); - } - - // The symbols to export. - return { - /** A reference to the NaCl module, once it is loaded. */ - naclModule: null, - - attachDefaultListeners: attachDefaultListeners, - startNaCl: startNaCl, - createNaClModule: createNaClModule, - hideModule: hideModule, - removeModule: removeModule, - logMessage: logMessage, - updateStatus: updateStatus, - browserSupportsNaCl: browserSupportsNaCl - }; - -}()); - -module.exports = common; - -// listen to the plasio start notification to trigger NaCl stuff -// -$(document).on("plasio.start", function() { - var body = document.body; - - // The data-* attributes on the body can be referenced via body.dataset. - if (body.dataset) { - var loadFunction; - if (!body.dataset.customLoad) { - loadFunction = common.startNaCl; - } else if (typeof window.startNaCl !== 'undefined') { - loadFunction = window.startNaCl; - } - - // From https://developer.mozilla.org/en-US/docs/DOM/window.location - var searchVars = {}; - if (window.location.search.length > 1) { - var pairs = window.location.search.substr(1).split('&'); - for (var key_ix = 0; key_ix < pairs.length; key_ix++) { - var keyValue = pairs[key_ix].split('='); - searchVars[unescape(keyValue[0])] = - keyValue.length > 1 ? unescape(keyValue[1]) : ''; - } - } - - if (loadFunction) { - var toolchains = body.dataset.tools.split(' '); - var configs = body.dataset.configs.split(' '); - - var attrs = {}; - if (body.dataset.attrs) { - var attr_list = body.dataset.attrs.split(' '); - for (var key in attr_list) { - var attr = attr_list[key].split('='); - var k = attr[0]; - var value = attr[1]; - attrs[k] = value; - } - } - - var tc = toolchains.indexOf(searchVars.tc) !== -1 ? - searchVars.tc : toolchains[0]; - - // If the config value is included in the search vars, use that. - // Otherwise default to Release if it is valid, or the first value if - // Release is not valid. - var config; - if (configs.indexOf(searchVars.config) !== -1) - config = searchVars.config; - else if (configs.indexOf('Release') !== -1) - config = 'Release'; - else - config = configs[0]; - - var pathFormat = body.dataset.path; - var path = pathFormat.replace('{tc}', tc).replace('{config}', config); - - isTest = searchVars.test === 'true'; - isRelease = path.toLowerCase().indexOf('release') != -1; - - loadFunction(body.dataset.name, tc, path, body.dataset.width, - body.dataset.height, attrs); - } - } -}); - diff --git a/libs/plasio/js/render.js b/libs/plasio/js/render.js deleted file mode 100644 index 973e4756..00000000 --- a/libs/plasio/js/render.js +++ /dev/null @@ -1,1842 +0,0 @@ -// render.js -// Rendering functions -// - -var THREE = require("three"), - $ = require('jquery'), - _ = require('lodash'); - - require("trackball-controls"); - require("binary-loader"); - -(function(w) { - "use strict"; - - var container, stats; - var camera, controls, scene, renderer; - var activeCamera, orthoCamera, topViewCamera; - - var offscreen = null; - var toggleActivate = false; - - var cross; - - var mensurationMode = false; - - function RegionsController() { - this.regions = []; - this.scaleFactor = 100.0; - } - - RegionsController.TypeRibbon = 1; - RegionsController.TypeAA = 2; - - RegionsController.prototype.add = function(p1, p2, color) { - var region = { - start: p1, - end: p2, - type: RegionsController.TypeRibbon, - widthScale: 3, - heightScale: 3, - color: color, - active: true - }; - - console.log('Adding new region!'); - - this.regions.push(region); - - $.event.trigger({ - type: 'plasio.regions.new', - region: region - }); - - needRefresh = true; - }; - - RegionsController.prototype.toPoints = function(region) { - // take a region and generate the 8 points - // first 4 points are on the starting side, top-left, top-right, bottom-right, bottom-left - // the next 4 points are on the ending side, same order - // - var points = []; - if (region.type === RegionsController.TypeRibbon) { - var dir = new THREE.Vector3(), - up = new THREE.Vector3(0, 1, 0), - right = new THREE.Vector3(), - v = new THREE.Vector3(); - - dir.copy(region.end).sub(region.start).normalize(); - right.crossVectors(dir, up); - up.crossVectors(right, dir); - - right.multiplyScalar(this.scaleFactor * region.widthScale * 0.5); - up.multiplyScalar(this.scaleFactor * region.heightScale * 0.5); - - // near quad - points.push(v.copy(region.start).add(up).sub(right).clone()); - points.push(v.copy(region.start).add(up).add(right).clone()); - points.push(v.copy(region.start).sub(up).add(right).clone()); - points.push(v.copy(region.start).sub(up).sub(right).clone()); - - // far quad - points.push(v.copy(region.end).add(up).sub(right).clone()); - points.push(v.copy(region.end).add(up).add(right).clone()); - points.push(v.copy(region.end).sub(up).add(right).clone()); - points.push(v.copy(region.end).sub(up).sub(right).clone()); - } - else { - // this should mantain the same order as the - var make = function(a, b, c) { - var af = a ? Math.max : Math.min; - var bf = b ? Math.max : Math.min; - var cf = c ? Math.max : Math.min; - - return new THREE.Vector3( - af(region.start.x, region.end.x), - bf(region.start.y, region.end.y), - cf(region.start.z, region.end.z)); - }; - - // near face, c = 0; - points.push(make(0, 0, 0)); - points.push(make(1, 0, 0)); - points.push(make(1, 1, 0)); - points.push(make(0, 1, 0)); - - // far face, c = 1; - points.push(make(0, 0, 1)); - points.push(make(1, 0, 1)); - points.push(make(1, 1, 1)); - points.push(make(0, 1, 1)); - } - - return points; - }; - - RegionsController.prototype.makePlanes = function(region) { - var points = this.toPoints(region); - var v = new THREE.Plane(); - - region.planes = [ - v.setFromCoplanarPoints(points[0], points[1], points[2]).clone(), // back - v.setFromCoplanarPoints(points[7], points[4], points[0]).clone(), // left - v.setFromCoplanarPoints(points[2], points[1], points[5]).clone(), // right - v.setFromCoplanarPoints(points[2], points[7], points[3]).clone(), // bottom - v.setFromCoplanarPoints(points[5], points[0], points[4]).clone(), // top - v.setFromCoplanarPoints(points[6], points[5], points[4]).clone() // far - ]; - }; - - RegionsController.prototype.updatePlanes = function() { - this.regions.forEach(this.makePlanes, this); - }; - - RegionsController.prototype.drawRegions = function(renderer, camera, target, forceClear) { - // draw the regions - // - var geom = new THREE.CubeGeometry(1, 1, 1); - var v = new THREE.Vector3(); - var vmid = new THREE.Vector3(); - - var o = this; - - this.regions.forEach(function(region) { - var scene = new THREE.Scene(); - var mat = new THREE.MeshBasicMaterial({ color: region.color.getHex(), transparent: true, opacity: 0.5 }); - var m = new THREE.Mesh(geom, mat); - - v.copy(region.end).sub(region.start); - vmid.copy(v).multiplyScalar(0.5); - - - if (region.type === RegionsController.TypeAA) { - m.position.copy(region.start).add(vmid); - m.scale.copy(v); - } - else { - m.position.copy(region.start).add(vmid); - m.scale.set(region.widthScale * o.scaleFactor, region.heightScale * o.scaleFactor, v.length()); - m.lookAt(region.end); - } - - scene.add(m); - renderer.render(scene, camera, target, forceClear); - }); - }; - - RegionsController.prototype.reset = function() { - this.regions = []; - - needRefresh = true; - }; - - RegionsController.prototype.remove = function(r) { - console.log('removing region', this.regions.length); - this.regions = _.without(this.regions, r); - - console.log('removing region', this.regions.length); - - needRefresh = true; - }; - - var getRegionsController = (function() { - var rc = null; - return function() { - if (rc === null) - rc = new RegionsController(); - return rc; - }; - })(); - - function CameraControl(container) { - this.container = container; - this.cameras = {}; - - this.active = null; - } - - CameraControl.prototype.addCamera = function(name, camera, noRotate, noPan, noZoom) { - var controls = new THREE.TrackballControls(camera, this.container); - - controls.noRotate = (noRotate === undefined ? false : noRotate); - controls.noPan = (noPan === undefined ? false : noPan); - controls.noZoom = (noZoom === undefined ? false : noZoom); - - controls.rotateSpeed = 1.0; - controls.zoomSpeed = 1.2; - controls.panSpeed = 0.8; - - - controls.dynamicDampingFactor = 0.3; - controls.enabled = false; - - console.log(controls); - - // if the camera being set is of orthographic type, we never want the trackball control - // doing the zooming - if (camera instanceof THREE.OrthographicCamera) { - controls.noZoomWasRequested = controls.noZoom; - controls.noZoom = true; - controls.__zoomLevel = 1.0; - } - - this.cameras[name] = [camera, controls]; - if (this.cameras.length === 1) - this.makeActive(name); - - this.onchange = function() {}; - - var o = this; - controls.addEventListener( 'change', function() { - o.onchange(); - }); - - }; - - CameraControl.prototype._attachHandlers = function(on) { - var o = this; - var $e = $(this.container || document); - - var mousewheel = function(e) { - e.preventDefault(); - - if (o.activeControls.noZoomWasRequested) - return; - - - var delta = 0; - - if ( event.wheelDelta ) { // WebKit / Opera / Explorer 9 - delta = event.wheelDelta / 40; - } else if ( event.detail ) { // Firefox - delta = - event.detail / 3; - } - - var newZoom = Math.min(2.0, Math.max(o.activeControls.__zoomLevel - delta * 0.01, 0.01)); - o.activeControls.__zoomLevel = newZoom; - o.updateForZoom(o.activeCamera, o.activeControls); - - needRefresh = true; - }; - - if (on) { - $e.on('mousewheel.plasio.orthoZoom', mousewheel); - $e.on('DOMMouseScroll.plasio.orthoZoom', mousewheel); - - console.log('Handlers attached!'); - } - else { - $e.off('mousewheel.plasio.orthoZoom'); - $e.off('DOMMouseScroll.plasio.orthoZoom'); - - console.log('Handlers dettached!'); - } - }; - - CameraControl.prototype.reset = function() { - for (var k in this.cameras) { - this.cameras[k][1].reset(); - } - }; - - CameraControl.prototype.eachCamera = function(cb, type) { - // iterate through each camera and call the cb, the cb should return - // an array with two elements, first being the position, the second being - // the target - for(var k in this.cameras) { - var cc = this.cameras[k]; - if (type === undefined) - cb.apply(null, [cc[0], cc[1], k]); - else if (cc[0] instanceof type) - cb.apply(null, [cc[0], cc[1], k]); - } - }; - - CameraControl.prototype._setCameraPlanes = function(c, cnt) { - if (!(c instanceof THREE.OrthographicCamera)) - throw new Error("Need an orthographic camera"); - - // make sure we have all the things before we try to change projection - if (!c.planes || !c.viewportWidth || !c.viewportHeight) - return; - - var planes = c.planes; - - var left = planes[0], - right = planes[1], - top = planes[2], - bottom = planes[3]; - - c.left = left * cnt.__zoomLevel; - c.right = right * cnt.__zoomLevel; - c.top = top * cnt.__zoomLevel; - c.bottom = bottom * cnt.__zoomLevel; - - var aspect = c.viewportWidth / c.viewportHeight; - c.left *= aspect; - c.right *= aspect; - - c.updateProjectionMatrix(); - }; - - CameraControl.prototype.updateForZoom = function(camera, controls) { - this._setCameraPlanes(camera, controls); - }; - - CameraControl.prototype.setPlanes = function(cb) { - var o = this; - this.eachCamera(function(c, cnt, name) { - c.planes = cb.apply(null, [c, cnt, name]); - o._setCameraPlanes(c, cnt); - }, THREE.OrthographicCamera); - }; - - CameraControl.prototype.updateProjectionMatrix = function() { - this.eachCamera(function(c) { - c.updateProjectionMatrix(); - }); - }; - - CameraControl.prototype.makeActive = function(name) { - this.eachCamera(function(camera, controls) { - controls.enabled = false; - }); - - this._attachHandlers(false); - - this.activeControls = this.cameras[name][1]; - this.activeCamera = this.cameras[name][0]; - - this.activeControls.enabled = true; - - if (this.activeCamera instanceof THREE.OrthographicCamera) - this._attachHandlers(true); - }; - - CameraControl.prototype.update = function() { - // only update the active camera, and leave all cameras in their current states - this.activeControls.update(); - }; - - CameraControl.prototype.resize = function(w, h) { - // Perspective cameras need their aspects changed - var o = this; - this.eachCamera(function(camera, control) { - camera.viewportWidth = w; - camera.viewportHeight = h; - - o._setCameraPlanes(camera, control); - - control.handleResize(); - }, THREE.OrthographicCamera); - - this.eachCamera(function(camera, control) { - camera.aspect = w / h; - camera.updateProjectionMatrix(); - - control.handleResize(); - }, THREE.PerspectiveCamera); - }; - - CameraControl.prototype.setFov = function(fov) { - // Our FOV only applies to perspective cameras - this.eachCamera(function(camera, control) { - camera.fov = fov; - camera.updateProjectionMatrix(); - }, THREE.PerspectiveCamera); - }; - - - CameraControl.prototype.setNearFar = function(near, far) { - for(var v in this.cameras) { - this.cameras[v][0].near = near; - this.cameras[v][0].far = far; - - this.cameras[v][0].updateProjectionMatrix(); - } - }; - - var getCameraControl = (function() { - var cc = null; - return function(container) { - if (cc === null) { - cc = new CameraControl(container || document); - } - return cc; - }; - })(); - - function RegionClipper() { - } - - RegionClipper.prototype.render = function(region, renderer, scene, camera, target, forceClear) { - var mat = getMaterial(); - - mat.uniforms.do_plane_clipping.value = 1; // enable clipping - - mat.uniforms.planes.value = region.planes.map(function(p) { - return new THREE.Vector4(p.normal.x, p.normal.y, p.normal.z, p.constant); - }); - - renderer.render(scene, camera, target, forceClear); - - mat.uniforms.do_plane_clipping.value = 0; // disable clipping - }; - - var getRegionClipper = (function() { - var rc = null; - return function() { - if (rc === null) - rc = new RegionClipper(); - return rc; - }; - })(); - - function XYZRenderer() { - this.off = null; - this.downBy = 1; - this.textureHeight = 0; - - this.uniforms = { - pointSize: {type: 'f', value: currentPointSize() }, - xyzScale: { type: 'v3', value: new THREE.Vector3(1, 1, 1) }, - zrange: { type: 'v2', value: new THREE.Vector2(0, 0) }, - offsets: { type: 'v3', value: new THREE.Vector3(0, 0, 0) }, - which: { type: 'v3', value: new THREE.Vector3(0, 0, 0) } - }; - - this.mat = new THREE.ShaderMaterial({ - blending: THREE.CustomBlending, - blendSrc: THREE.OneFactor, - blendDst: THREE.ZeroFactor, - /*jshint multistr: true */ - vertexShader: '\ - uniform float pointSize; \n\ - uniform vec3 xyzScale; \n\ - uniform vec2 zrange; \n\ - uniform vec3 offsets; \n\ - uniform vec3 which; \n\ - varying vec3 xyz; \n\ - void main() { \n\ - vec3 fpos = ((position.xyz - offsets) * xyzScale).xzy * vec3(-1, 1, 1); \n\ - vec4 mvPosition = modelViewMatrix * vec4(fpos, 1.0); \n\ - gl_Position = projectionMatrix * mvPosition; \n\ - gl_PointSize = pointSize; \n\ - xyz = which * fpos; \n\ - }', - fragmentShader:'\n\ - varying vec3 xyz; \n\ - float shift_right(float v, float amt) {\ - v = floor(v) + 0.5;\ - return floor(v / exp2(amt));\ - }\ - float shift_left(float v, float amt) {\ - return floor(v * exp2(amt) + 0.5);\ - }\ - \ - float mask_last(float v, float bits) {\ - return mod(v, shift_left(1.0, bits));\ - }\ - float extract_bits(float num, float from, float to) {\ - from = floor(from + 0.5);\ - to = floor(to + 0.5);\ - return mask_last(shift_right(num, from), to - from);\ - }\ - vec4 encode_float(float val) {\ - if (val == 0.0)\ - return vec4(0, 0, 0, 0);\ - float sign = val > 0.0 ? 0.0 : 1.0;\ - val = abs(val);\ - float exponent = floor(log2(val));\ - float biased_exponent = exponent + 127.0;\ - float fraction = ((val / exp2(exponent)) - 1.0) * 8388608.0;\ - \ - float t = biased_exponent / 2.0;\ - float last_bit_of_biased_exponent = fract(t) * 2.0;\ - float remaining_bits_of_biased_exponent = floor(t);\ - \ - float byte4 = extract_bits(fraction, 0.0, 8.0) / 255.0;\ - float byte3 = extract_bits(fraction, 8.0, 16.0) / 255.0;\ - float byte2 = (last_bit_of_biased_exponent * 128.0 + extract_bits(fraction, 16.0, 23.0)) / 255.0;\ - float byte1 = (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0;\ - return vec4(byte4, byte3, byte2, byte1);\ - }\ - void main() { \n\ - float s = xyz.x + xyz.y + xyz.z; \ - gl_FragColor = encode_float(s); }', - uniforms: this.uniforms - }); - } - - XYZRenderer.prototype.resize = function(width, height) { - this.off = new THREE.WebGLRenderTarget(width/this.downBy, height/this.downBy, { - stencilBuffer: false, - magFilter: THREE.NearestFilter, - minFilter: THREE.NearestFilter - }); - - this.off.generateMipmaps = false; - - this.textureHeight = height / this.downBy; - console.log('texture height:', this.textureHeight); - }; - - var decodeFloat = function(input) { - var fa = new Float32Array(input.buffer); - return fa[0]; - }; - - XYZRenderer.prototype._debugRender = function(renderer, scene, camera, x, y, z) { - var prev = scene.overrideMaterial; - scene.overrideMaterial = this.mat; - - this.uniforms.which.value = new THREE.Vector3(x, y, z); - renderer.render(scene, camera); - - scene.overrideMaterial = prev; - }; - - XYZRenderer.prototype.pick = function(renderer, scene, camera, x, y) { - if (this.X === null || - this.Y === null || - this.Z === null) - return; - - var o = this; - - o.uniforms.pointSize.value = 10.0; // draw points with super size bloat - - renderer.setClearColor("#000", 0); - var gl = renderer.getContext(); - - - var rx = x / this.downBy, - ry = y / this.downBy; - - var renderWith = function(x, y, z) { - o.uniforms.which.value = new THREE.Vector3(x, y, z); - renderer.render(scene, camera, o.off, true); - - var tx = rx, ty = o.textureHeight - ry; - - var pixelBuffer = new Uint8Array(4); - gl.readPixels(tx, ty, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixelBuffer); - - return pixelBuffer; - }; - - var ox = 0.0, oy = 0.0, oz = 0.0; - - var prev = scene.overrideMaterial; - scene.overrideMaterial = this.mat; - - ox = decodeFloat(renderWith(1, 0, 0)); - oy = decodeFloat(renderWith(0, 1, 0)); - oz = decodeFloat(renderWith(0, 0, 1)); - - scene.overrideMaterial = prev; - - - return new THREE.Vector3(ox, oy, oz); - }; - - - var getXYZRenderer = (function() { - var xyz = null; - return function() { - if (xyz === null) - xyz = new XYZRenderer(); - return xyz; - }; - })(); - - function PointCollector(domElement) { - this.points = []; - this.domElement = domElement || window; - - this.fromCamera = null; - this.size = [0, 0]; - - var o = this; - THREE.ImageUtils.loadTexture("/assets/circle.png", undefined, function(map) { - o.mat = new THREE.SpriteMaterial({ - map: map, - color: 0xffffff, - fog: false, - }); - }); - - this._sprites = []; - this.orthoScene = new THREE.Scene(); - this.orthoCamera = new THREE.OrthographicCamera(-1, 1.0, 1.0, -1.0, 1, 10); - this.orthoCamera.position.z = 10; - } - - PointCollector.prototype._2dProj = function(p, proj) { - proj = proj || (new THREE.Projector()); - var ndc = p.clone(); - proj.projectVector(ndc, this.fromCamera); - - var screen = new THREE.Vector2(this.size[0] * (ndc.x + 1) / 2, this.size[1] - this.size[1] * (ndc.y + 1) / 2); - var ortho = new THREE.Vector3(ndc.x * this.size[0] / 2, ndc.y * this.size[1] / 2, 1.0); - - return [screen, ortho]; - }; - - - PointCollector.prototype.push = function(x, y, p, isNew) { - var newPos = new THREE.Vector2(x, y); - for (var i = 0; i < this.points.length ; i ++) { - if (newPos.distanceTo(this.points[i].screenPos) < 16.0) { - // the user clicked on one of the points - var thisPoint = this.points[i]; - - this.orthoScene.remove(this.points[i].sprite); - this.points.splice(i, 1); - - $.event.trigger({ - type: 'plasio.mensuration.pointRemoved', - point: thisPoint - }); - - needRefresh = true; - return; - } - } - - if (p.x === 0.0 && p.y === 0.0 && p.z === 0.0) - return; // didn't click on a point - - if (this.points.length === 0) // first point starts with id == 1. - p.id = 1; - else if (isNew) { // if a new id increment, or use the parents - p.id = this.points[this.points.length - 1].id + 1; - } - else { - p.id = this.points[this.points.length - 1].id; - } - - - // the user intends to add a new point - p.sprite = null; - p.screenPos = newPos; - p.color = new THREE.Color(); - p.color.setHSL(Math.random(), 0.8, 0.8); - - this.points.push(p); - - $.event.trigger({ - type: 'plasio.mensuration.pointAdded', - point: p - }); - - needRefresh = true; - }; - - PointCollector.prototype.clearPoints = function() { - for (var i = 0 ; i < this.points.length ; i ++) { - this.orthoScene.remove(this.points[i].sprite); - } - - this.points = []; - }; - - PointCollector.prototype._updateSpritePositions = function() { - var width = this.size[0]; - var height = this.size[1]; - - var proj = new THREE.Projector(); - - // http://stackoverflow.com/questions/10858599/how-to-determine-if-plane-is-in-three-js-camera-frustum - // - this.fromCamera.updateMatrix(); // make sure camera's local matrix is updated - this.fromCamera.updateMatrixWorld(); // make sure camera's world matrix is updated - this.fromCamera.matrixWorldInverse.getInverse( this.fromCamera.matrixWorld ); - - var frustum = new THREE.Frustum(); - frustum.setFromMatrix( new THREE.Matrix4().multiplyMatrices(this.fromCamera.projectionMatrix, - this.fromCamera.matrixWorldInverse ) ); - - for (var i = 0, il = this.points.length ; i < il ; i ++) { - var p = this.points[i]; - - if (!p.sprite) { - p.sprite = new THREE.Sprite(this.mat); - p.sprite.scale.set(16, 16, 1); - this.orthoScene.add(p.sprite); - } - - var ps = this._2dProj(p, proj); - var ndc = ps[1]; - p.sprite.position.set(ndc.x, ndc.y, ndc.z); - p.screenPos = ps[0]; - - p.sprite.visible = frustum.containsPoint(p); - } - }; - - PointCollector.prototype.reset = function() { - this.points = []; - }; - - var getPointCollector = (function() { - var pc = null; - - return function() { - if (pc === null && renderer && renderer.domElement) - pc = new PointCollector(renderer.domElement); - return pc; - }; - })(); - - PointCollector.prototype.update = function() { - var $e = $(this.domElement); - var width = $e.width(), - height = $e.height(); - - - var ac = getCameraControl().activeCamera; - - if (this.fromCamera != ac || - width !== this.size[0] || height !== this.size[1]) { - // needs to be revalidated - this.size = [width, height]; - this.fromCamera = ac; - - this.orthoCamera.left = -width / 2; - this.orthoCamera.right = width / 2; - this.orthoCamera.top = height / 2; - this.orthoCamera.bottom = -height / 2; - - this.orthoCamera.updateProjectionMatrix(); - this._updateSpritePositions(); - - needRefresh = true; - } - }; - - PointCollector.prototype.render = function(renderer, target, forceClear) { - this._updateSpritePositions(); - - //renderer.clearDepth(); - renderer.render(this.orthoScene, this.orthoCamera, target, forceClear); - }; - - - function OffscreenRenderer(w, h) { - this.resize(w, h); - } - - OffscreenRenderer.prototype.resize = function(w, h) { - this.off = new THREE.WebGLRenderTarget(w, h, { - stencilBuffer: false, - }); - - this.off.generateMipmaps = false; - - this.width = w; - this.height = h; - - this.camera = new THREE.OrthographicCamera(0, w, h, 0, 1, 10); - this.scene = new THREE.Scene(); - - this.camera.position.z = 5; - - var mat = new THREE.MeshBasicMaterial({ - map: this.off, - color: 0xffffff, - side: THREE.DoubleSide - }); - var g = new THREE.PlaneGeometry(w / 4, h / 4); - var m = new THREE.Mesh(g, mat); - - var matbg = new THREE.MeshBasicMaterial({ - color: 0xffffff, - side: THREE.DoubleSide - }); - var gbg = new THREE.PlaneGeometry(w / 4, h / 4); - var mbg = new THREE.Mesh(g, matbg); - - m.position.set(w - (w / 4) + (w / 8) - 10, ( h / 4) - (h / 8) + 10, 0); // much math to account for plane having its origin right in the middle - mbg.position.set(w - (w / 4) + (w / 8) - 10, ( h / 4) - (h / 8) + 10, -1); // much math to account for plane having its origin right in the middle - - m.scale.set(0.99, 0.99, 1.0); - - this.scene.add(m); - this.scene.add(mbg); - - - console.log(this.camera, this.scene, this.off, this.width, this.height); - console.log('offscreen was resized!'); - }; - - OffscreenRenderer.prototype.render = function(renderer) { - if (!this.scene) - return; - - renderer.clearDepth(); - renderer.render(this.scene, this.camera); - }; - - OffscreenRenderer.prototype.getRenderTarget = function() { - return this.off; - }; - - function ModelCache() { - this.models = {}; - this.inprogress = {}; - } - - ModelCache.prototype.getModel = function(url, cb) { - var o = this; - if (this.models[url]) - return setTimeout(function() { - var m = o.models[url]; - cb(m[0], m[1]); - }, 0); - - if (this.inprogress[url]) { - // this download is in progress right now, so we'd wait till its done and then invoke user's callback - // - return this.inprogress[url].push(cb); - } - - // this URL is neither loaded nor has it been queued, queue it - this.inprogress[url] = [cb]; - - $.event.trigger({ - type: 'plasio.progress.start' - }); - - var loader = new THREE.BinaryLoader(); - loader.load(url, function(geometry, materials) { - console.log('Done loading object'); - - $.event.trigger({ - type: 'plasio.progress.end' - }); - - for (var i = 0 ; i < materials.length ; i ++) { - materials[i].ambient = new THREE.Color(1, 1, 1); - materials[i].color = new THREE.Color(1, 1, 1); - } - - o.models[url] = [geometry, materials]; - - setTimeout(function() { - var cbs = o.inprogress[url]; - delete o.inprogress[url]; - - for (var k in cbs) { - cbs[k](geometry, materials); - } - }, 0); - }, - undefined, undefined, - function(e) { - $.event.trigger({ - type: "plasio.progress.progress", - percent: (100 * e.loaded / e.total) - }); - }); - }; - - var getModelCache = (function() { - var cache = null; - return function() { - if (cache === null) - cache = new ModelCache(); - return cache; - }; - })(); - - - function InundationPlane () { - this.h = 0.0; - this.m = new THREE.MeshBasicMaterial({color: 0x437DE8, side: THREE.DoubleSide, transparent: true, opacity: 0.5}); - } - - var getInundationPlane = (function() { - var plane = null; - return function() { - if (plane === null) - plane = new InundationPlane(); - return plane; - }; - })(); - - - InundationPlane.prototype.setDimensions = function(heightRange, spanX, spanY) { - if (this.plane) { - scene.remove(this.plane); - } - - var r = heightRange[1] - heightRange[0]; - this.range = [heightRange[0] - r * 0.1, heightRange[1] + r * 0.1]; - - var g = new THREE.PlaneGeometry(spanX * 2.5, spanY * 2.5); - - this.plane = new THREE.Mesh(g, this.m); - this.plane.visible = this.wasVisible; - this.plane.rotation.set(Math.PI/2, 0, 0); - scene.add(this.plane); - this.place(this.h * 1000.0); - }; - - InundationPlane.prototype.place = function(h) { - // h should be in range 0 -> 1000 - this.h = h / 1000; - - if (this.plane) { - this.plane.position.set(0, this.range[0] + this.h * (this.range[1] - this.range[0]), 0); - } - }; - - InundationPlane.prototype.setOpacity = function(o) { - this.m.opacity = o; - }; - - InundationPlane.prototype.show = function() { - this.wasVisible = true; - if (this.plane) - this.plane.visible = true; - }; - - InundationPlane.prototype.hide = function() { - this.wasVisible = false; - if (this.plane) - this.plane.visible = false; - }; - - w.startRenderer = function(render_container, status_cb) { - init(render_container); - animate(); - - if(status_cb) { - var vendor = - renderer.context.getParameter(renderer.context.VERSION) + ", Provider: " + - renderer.context.getParameter(renderer.context.VENDOR); - status_cb(vendor); - } - }; - - w.rendererDOMElement = function() { - return renderer.domElement; - }; - - - w.getCurrentPoints = function() { - // we may not have the point collector yet - if (!getPointCollector()) - return []; - - return getPointCollector().points; - }; - - w.enableMensuration = function() { - if (!mensurationMode) { - mensurationMode = true; - controls.enabled = false; - - getMensurationControls().setVisible(true); - needRefresh = true; - } - }; - - w.disableMensuration = function() { - if (mensurationMode) { - mensurationMode = false; - controls.enabled = true; - - getMensurationControls().setVisible(false); - needRefresh = true; - } - }; - - w.createNewRegion = function(p1, p2, color) { - getRegionsController().add(p1, p2, color); - }; - - function removeBatcher(b) { - // if the provided batcher is an array, remove all elements from the scene - if( Object.prototype.toString.call(b) === '[object Array]' ) { - for (var i in b) { - b[i].removeFromScene(scene); - } - } - else - b.removeFromScene(scene); - } - - function addBatcher(b) { - // if the provided batcher is an array, add all elements to the scene - if( Object.prototype.toString.call(b) === '[object Array]' ) { - for (var i in b) { - b[i].addToScene(scene); - } - } - else - b.addToScene(scene); - } - - function determineBatcherProps(b) { - if( Object.prototype.toString.call(b) !== '[object Array]' ) { - return [ - b.mn, b.mx, b.cg, b.scale - ]; - } - - // the scale in all should be the same, so we don't touch it - var mx = null, mn = null, cg = null; - for(var i in b) { - if (mx === null) mx = b[i].mx.clone(); - else mx.set(Math.max(mx.x, b[i].mx.x), - Math.max(mx.y, b[i].mx.y), - Math.max(mx.z, b[i].mx.z)); - - if (mn === null) mn = b[i].mn.clone(); - else mn.set(Math.min(mn.x, b[i].mn.x), - Math.min(mn.y, b[i].mn.y), - Math.min(mn.z, b[i].mn.z)); - - if (cg === null) cg = b[i].cg.clone(); - else mn.set((cg.x * i + b[i].cg.x) / (i+1), - (cg.y * i + b[i].cg.y) / (i+1), - (cg.z * i + b[i].cg.z) / (i+1)); - } - - return [mx, mn, cg, b[0].scale]; - } - - - var oldBatcher = null; // the particle system which is already loaded - var restorePoint = []; - w.loadBatcher = function(batcher, resetCamera) { - if (oldBatcher !== null) - removeBatcher(oldBatcher); - - addBatcher(batcher); - oldBatcher = batcher; - - var batcherProps = determineBatcherProps(batcher); - console.log('Batcher props:', batcherProps); - var mn = batcherProps[0], - mx = batcherProps[1], - cg = batcherProps[2], - scale = batcherProps[3]; - - if (resetCamera === true) { - setupView(mn, mx, cg, scale); - restorePoint = [mn, mx, cg, scale]; - } - - // update some of the fields - var zrange = new THREE.Vector2(0, mx.z - mn.z); - - var cgToUse = batcher.correctiveOffset || cg; - - // trigger signals for setting offsets - $.event.trigger({ - type: 'plasio.offsetsChanged', - offsets: cgToUse - }); - - // z-range - $.event.trigger({ - type: 'plasio.zrangeChanged', - zrange: zrange - }); - - // trigger a signal which will cause the intenisty range to update - $.event.trigger({ - type: 'plasio.intensityClampChanged' - }); - - // change scale - $.event.trigger({ - type: 'plasio.scaleChanged', - scale: scale - }); - }; - - var setupView = function(mins, maxs, cg, scale) { - getCameraControl().reset(); - - // make sure the projection and camera is setup correctly to view the loaded data - // - var range = [ - (maxs.x - mins.x) * scale.x, - (maxs.y - mins.y) * scale.y, - (maxs.z - mins.z) * scale.z - ]; - - var farPlaneDist = Math.max(range[0], range[1], range[2]); - var limits = Math.ceil(Math.sqrt(2*farPlaneDist*farPlaneDist)); - - console.log('Data range', range); - console.log('Far plane', farPlaneDist); - console.log('Limits', limits); - - - getCameraControl().setNearFar(1.0, farPlaneDist * 4); - - var zero = new THREE.Vector3(0, 0, 0); - getCameraControl().eachCamera(function(camera, controls, name) { - if (name === 'top') { - camera.position.set(0, farPlaneDist / 2, 0); - camera.lookAt(zero); - } - else { - camera.position.set(-range[0]/2, 2*range[2], -range[1]/2); - camera.lookAt(zero); - } - - console.log('setup', camera.position); - }); - - getCameraControl().eachCamera(function(camera, controls) { - controls.__zoomLevel = 1.0; - }, THREE.OrthographicCamera); - - getCameraControl().setPlanes(function(camera, controls, name) { - return [-farPlaneDist/2, farPlaneDist/2, farPlaneDist/2, -farPlaneDist/2]; - }); - - - // Also set the scales on the regions controller, this determines how much the volume changes when we - // change the sliders - // - getRegionsController().scaleFactor = farPlaneDist / 100.0; - - - // Setup inundation plane stuff - getInundationPlane().setDimensions([(mins.z - cg.z) * scale.z - range[2] * 0.1, (maxs.z - cg.z) * scale.z + range[2] * 0.1], - range[0]/2, range[1]/2); - getInundationPlane().place(currentInundationLevel()); - - }; - - var numberWithCommas = function(x) { - return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); - }; - - function createOffScreenBuffer(w, h) { - return THREE.WebGLRenderTarget(w, h, { - stencilBuffer: false - }); - } - - var needRefresh = false; // whenever a scene re-render is needed - function init(render_container) { - var container = $(render_container); - var w = container.width(), - h = container.height(); - - // world - scene = new THREE.Scene(); - - // ambiently light our scale objects - var l = new THREE.AmbientLight(0xffffff); - scene.add(l); - - renderer = new THREE.WebGLRenderer( { antialias: false } ); - renderer.setSize(w, h); - renderer.autoClear = false; - - // instantiate camera control instance with the container we'd like it to use - getCameraControl(render_container); - - // setup cameras - getCameraControl().addCamera("perspective", new THREE.PerspectiveCamera(60, w/h, 1, 10000)); - getCameraControl().addCamera("ortho", new THREE.OrthographicCamera(-w/2, w/2, h/2, -h/2, 1, 10000)); - getCameraControl().addCamera("top", new THREE.OrthographicCamera(-w/2, w/2, h/2, -h/2, 1, 10000), true, true, true); - - getCameraControl().onchange = function() { - needRefresh = true; - }; - - getCameraControl().makeActive("perspective"); - getCameraControl().resize(w, h); - - getXYZRenderer().resize(w, h); - - - // Prepare the offscreen buffer for rendering the secondary buffer to - // - offscreen = new OffscreenRenderer(w, h); - - container.append( renderer.domElement ); - - window.addEventListener( 'resize', onWindowResize, false ); - - $("#pointCount").html("No Points"); - $("#stats").show(); - - $(document).on("plasio.cameraFOVChanged", function() { - getCameraControl().eachCamera(function(c) { - c.fov = currentFOV(); - c.updateProjectionMatrix(); - }, THREE.PerspectiveCamera); - }); - - $(document).on("plasio.camera.perspective", function() { - getCameraControl().makeActive("perspective"); - }); - - $(document).on("plasio.camera.ortho", function() { - getCameraControl().makeActive("ortho"); - }); - - $(document).on("plasio.camera.topView", function() { - getCameraControl().makeActive("top"); - }); - - $(document).on("plasio.camera.reset", function() { - // reset the perspective camera controls - if (restorePoint.length > 0) - setupView(restorePoint[0], restorePoint[1], restorePoint[2], restorePoint[3]); - }); - - $(document).on('plasio.renderer.needRefresh', function() { - needRefresh = true; - }); - - $(document).on('plasio.mensuration.pointsReset', function() { - getPointCollector().clearPoints(); - needRefresh = true; - }); - - $(document).on('plasio.regions.reset', function() { - if (getRegionsController()) - getRegionsController().reset(); - }); - - $(document).on('plasio.regions.remove', function(e) { - if (getRegionsController()) - getRegionsController().remove(e.region); - }); - - $(document).on('plasio.mensuration.addPoint', function(d) { - // Don't allow addition of mensuration points if we're in toggle mode and - // have some active region (we're seeing clipped area) - if (toggleActivate && _.some(getRegionsController().regions, 'active')) - return; - - var point = getXYZRenderer().pick(renderer, scene, getCameraControl().activeCamera, d.x, d.y); - getPointCollector().push(d.x, d.y, point, d.startNew); - - console.log('Point added:', d.x, d.y, ' -> ', point); - }); - - var scaleObjects = []; - $(document).on('plasio.scalegeoms.place', function(d) { - var placeWhere = getXYZRenderer().pick(renderer, scene, getCameraControl().activeCamera, d.x, d.y); - if (placeWhere.x === 0.0 && placeWhere.y === 0.0 && placeWhere.z === 0.0) - return; - - var scale = d.scale || 1.0; - - getModelCache().getModel(d.url, function(geometry, materials) { - var m = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials)); - m.position.set(placeWhere.x, placeWhere.y, placeWhere.z); - - m.scale.set(scale, scale, scale); - - scaleObjects.push(m); - scene.add(m); - - needRefresh = true; - - - // FIXME: I am not sure how to counter the black building yet, so we just queue - // renders for next 2 seconds - var count = 0; - var rerenderStuff = function() { - setTimeout(function() { - needRefresh = true; - - if (count < 10) - rerenderStuff(); - count ++; - }, 200); - }; - - rerenderStuff(); - }); - }); - - $(document).on('plasio.scalegeoms.reset', function(d) { - for (var i = 0, il = scaleObjects.length ; i < il ; i ++) { - scene.remove(scaleObjects[i]); - } - scaleObjects = []; - - needRefresh = true; - }); - - $(document).on('plasio.scalegeoms.scale', function(d) { - for (var i = 0, il = scaleObjects.length ; i < il ; i ++) { - scaleObjects[i].scale.set(d.scale, d.scale, d.scale); - } - }); - - - $(document).on('plasio.render.toggleClip', function(e) { - console.log('toggling'); - toggleActivate = !toggleActivate; - }); - - - $(document).on('plasio.inundationEnable', function(e) { - console.log(e, e.enable); - if (e.enable) - getInundationPlane().show(); - else - getInundationPlane().hide(); - }); - - $(document).on('plasio.inundationChanged', function(e) { - var l = currentInundationLevel(); - getInundationPlane().place(l); - }); - - $(document).on('plasio.inundationOpacityChanged', function() { - var o = currentInundationOpacity(); - getInundationPlane().setOpacity(o/100.0); - }); - } - - function onWindowResize() { - var container = $("#container"); - - var w = container.width(); - var h = container.height(); - - getCameraControl().resize(w, h); - renderer.setSize(w, h); - - getXYZRenderer().resize(w, h); - - - offscreen.resize(w, h); - - render(); - } - - w.doRenderResize = onWindowResize; - - function animate() { - requestAnimationFrame(animate); - - getCameraControl().update(); - getPointCollector().update(); - - if (needRefresh) { - render(); - needRefresh = false; - } - } - - var renderCollectorLines = function(r, c, target, clear) { - var scene = new THREE.Scene(); - - var points = getPointCollector().points; - for (var i = 0 ; i < points.length - 1 ; i ++) { - var p = points[i], - n = points[i+1]; - - if (p.id !== n.id) - continue; // don't connect if they belong to different segments - - var g = new THREE.Geometry(); - g.vertices.push(p); - g.vertices.push(n); - - var m = new THREE.LineBasicMaterial({ - color: p.color.getHex(), - linewidth: 5, - blending: THREE.NoBlending, - depthTest: false, - depthWrite: false - }); - - var l = new THREE.Line(g, m); - scene.add(l); - } - - r.render(scene, c, target, clear); - }; - - - function render() { - renderer.clear(); - var camera = getCameraControl().activeCamera; - - // regions we have right now - var regions = getRegionsController().regions; - var needOverlay = _.some(regions, 'active'); // only need overlay when we have active regions - - // make sure all plaes are updated - getRegionsController().updatePlanes(); - - var renderRegions = function(target) { - var activeRegions = _.filter(regions, 'active'); - - var first = true; - activeRegions.forEach(function(r) { - getRegionClipper().render(r, renderer, scene, camera, target, first); - if (first) first = false; - }); - }; - - var renderEverything = function(target) { - renderer.render(scene, camera, target, true); - - // Render the regions as quads - getRegionsController().drawRegions(renderer, camera, target); - - // render collector lines - renderCollectorLines(renderer, camera, target); - getPointCollector().render(renderer, target); - }; - - if (needOverlay && toggleActivate) { - // there is an active overlay and it has been toggled, we need to render regions stuff to main area - // and point cloud to offscreen - renderRegions(); - renderEverything(offscreen.getRenderTarget()); - - offscreen.render(renderer); - } - else if (needOverlay) { - // the toggle hasn't been activated but an overlay is active - // - renderEverything(); - renderRegions(offscreen.getRenderTarget()); - - offscreen.render(renderer); - } - else { - // no overlay, no toggle - renderEverything(); - } - } - - function updateColorUniformsForSource(uniforms, source) { - uniforms.rgb_f.value = 0.0; - uniforms.class_f.value = 0.0; - uniforms.map_f.value = 0.0; - uniforms.imap_f.value = 0.0; - - switch(source) { - case "rgb": uniforms.rgb_f.value = 1.0; break; - case "classification": uniforms.class_f.value = 1.0; break; - case "heightmap-color": uniforms.map_f.value = 1.0; break; - case "heightmap-color-inv": uniforms.imap_f.value = 1.0; break; - } - } - - function updateIntensityUniformsForSource(uniforms, source) { - uniforms.intensity_f.value = 0.0; - uniforms.height_f.value = 0.0; - uniforms.iheight_f.value = 0.0; - - switch(source) { - case "intensity": uniforms.intensity_f.value = 1.0; break; - case "heightmap": uniforms.height_f.value = 1.0; break; - case "heightmap-inv": uniforms.iheight_f.value = 1.0; break; - } - } - - function updateIntensityClampingForBatcher(uniforms, batcher) { - var range = currentIntensityClamp(); - var n, x; - if( Object.prototype.toString.call(batcher) !== '[object Array]' ) { - n = batcher.in_n; - x = batcher.in_x; - } - else { - n = 9999999999; x = -9999999999; - for (var i in batcher) { - n = Math.min(n, batcher[i].in_n); - x = Math.max(x, batcher[i].in_x); - } - } - - var f = function(v) { - var vf = v / 100.0; - return n + (x - n) * vf; - }; - - var lower = f(parseFloat(range[0])); - var higher = f(parseFloat(range[1])); - - uniforms.clampLower.value = lower; - uniforms.clampHigher.value = Math.max(higher, lower + 0.001); - } - - - function updateColorClamping(uniforms) { - var range = currentColorClamp(); - uniforms.colorClampLower.value = range[0]; - uniforms.colorClampHigher.value = Math.max(range[1], range[0] + 0.001); - - console.log(uniforms.colorClampLower.value, - uniforms.colorClampHigher.value); - } - - var shaderMaterial = null; - function getMaterial(vs, fs) { - if (shaderMaterial !== null) - return shaderMaterial; - - if (vs === undefined || fs === undefined) - throw new Error('Cannot create shader material without vertex and fragment shaders'); - - var attributes = { - color: { type: 'c', value: null }, - intensity: { type: 'f', value: null }, - classification: { type: 'f', value: null } - }; - - var iblend = currentIntensityClamp(); - var cclamp = currentColorClamp(); - - var uniforms = { - pointSize: { type: 'f', value: currentPointSize() }, - intensityBlend: { type: 'f', value: currentIntensityBlend() / 100.0 }, - maxColorComponent: { type: 'f', value: 1.0 }, - - // colors - rgb_f: { type: 'f', value: 1.0 }, - class_f: { type: 'f', value: 0.0 }, - map_f: { type: 'f', value: 0.0 }, - imap_f: { type: 'f', value: 0.0 }, - - // intensity - intensity_f: { type: 'f', value: 0.0 }, - height_f: { type: 'f', value: 0.0 }, - iheight_f: { type: 'f', value: 0.0 }, - - xyzScale: { type: 'v3', value: new THREE.Vector3(1, 1, 1) }, - - clampLower: { type: 'f', value: iblend[0] }, - clampHigher: { type: 'f', value: iblend[1] }, - - colorClampLower: { type: 'f', value: cclamp[0] }, - colorClampHigher: { type: 'f', value: cclamp[1] }, - - zrange: { type: 'v2', value: new THREE.Vector2(0, 0) }, - offsets: { type: 'v3', value: new THREE.Vector3(0, 0, 0) }, - map: { type: 't', value: THREE.ImageUtils.loadTexture(currentColorMap())}, - - // clipping controls - do_plane_clipping: { type: 'i', value: 0 }, - planes: { type: 'v4v', value: _.times(6, function() { return new THREE.Vector4(); }) } - }; - - updateColorUniformsForSource(uniforms, currentColorSource()); - updateIntensityUniformsForSource(uniforms, currentIntensitySource()); - if (oldBatcher !== null) - updateIntensityClampingForBatcher(uniforms, oldBatcher); - - updateColorClamping(uniforms); - - shaderMaterial = new THREE.ShaderMaterial({ - vertexShader: vs, - fragmentShader: fs, - attriutes: attributes, - uniforms: uniforms - }); - - // attach handlers for notifications - $(document).on("plasio.colormapChanged", function() { - var colormap = currentColorMap(); - - console.log('Colormap changed to:', colormap); - - THREE.ImageUtils.loadTexture(colormap, undefined, function(tex) { - uniforms.map.value = tex; - uniforms.map.needsUpdate = true; - }); - }); - - $(document).on("plasio.colorsourceChanged", function() { - updateColorUniformsForSource(uniforms, currentColorSource()); - }); - - $(document).on("plasio.intensitysourceChanged", function() { - updateIntensityUniformsForSource(uniforms, currentIntensitySource()); - }); - - $(document).on("plasio.intensityClampChanged", function() { - if (oldBatcher !== null) - updateIntensityClampingForBatcher(uniforms, oldBatcher); - }); - - $(document).on("plasio.colorClampChanged", function() { - updateColorClamping(uniforms); - }); - - $(document).on("plasio.intensityBlendChanged", function() { - var f = currentIntensityBlend(); - uniforms.intensityBlend.value = f / 100.0; - - }); - - $(document).on("plasio.pointSizeChanged", function() { - var f = currentPointSize(); - getXYZRenderer().uniforms.pointSize.value = f; - uniforms.pointSize.value = f; - }); - - $(document).on("plasio.maxColorComponent", function(e) { - uniforms.maxColorComponent.value = Math.max(0.0001, e.maxColorComponent); - }); - - $(document).on("plasio.offsetsChanged", function(e) { - getXYZRenderer().uniforms.offsets.value = e.offsets; - uniforms.offsets.value = e.offsets; - }); - - $(document).on("plasio.zrangeChanged", function(e) { - getXYZRenderer().uniforms.zrange.value = e.zrange; - uniforms.zrange.value = e.zrange; - }); - - $(document).on("plasio.scaleChanged", function(e) { - getXYZRenderer().uniforms.xyzScale.value = e.scale; - uniforms.xyzScale.value = e.scale; - }); - - - shaderMaterial.uniforms = uniforms; - shaderMaterial.attributes = attributes; - - return shaderMaterial; - } - - // An object that manages a bunch of particle systems - var ParticleSystemBatcher = function(vs, fs) { - this.material = getMaterial(vs, fs); - - this.pss = []; // particle systems in use - - this.mx = null; - this.mn = null; - this.cg = null; - this.cn = null; - this.cx = null; - this.in_x = null; - this.in_y = null; - this.pointsSoFar = 0; - }; - - ParticleSystemBatcher.prototype.push = function(lasBuffer) { - var geometry = new THREE.BufferGeometry(); - var count = lasBuffer.pointsCount; - - geometry.addAttribute( 'position', Float32Array, count, 3 ); - geometry.addAttribute( 'color', Float32Array, count, 3 ); - geometry.addAttribute( 'intensity', Float32Array, count, 1 ); - geometry.addAttribute( 'classification', Float32Array, count, 1 ); - - var positions = geometry.attributes.position.array; - var colors = geometry.attributes.color.array; - var intensity = geometry.attributes.intensity.array; - var classification = geometry.attributes.classification.array; - - // the running average of cg - var cg = null; - var mx = null; - var mn = null; - var cn = null, cx = null; - var in_x = null, in_n = null; - - this.corrective = new THREE.Vector3(lasBuffer.mins[0], - lasBuffer.mins[1], - lasBuffer.mins[2]); - - for ( var i = 0; i < count; i ++) { - var p = lasBuffer.getPoint(i); - - var x = p.position[0] * lasBuffer.scale[0] + lasBuffer.offset[0]; - var y = p.position[1] * lasBuffer.scale[1] + lasBuffer.offset[1]; - var z = p.position[2] * lasBuffer.scale[2] + lasBuffer.offset[2]; - - - if (cg === null) - cg = new THREE.Vector3(x, y, z); - else - cg.set((cg.x * i + x) / (i+1), - (cg.y * i + y) / (i+1), - (cg.z * i + z) / (i+1)); - - if (mx === null) - mx = new THREE.Vector3(x, y, z); - else - mx.set(Math.max(mx.x, x), - Math.max(mx.y, y), - Math.max(mx.z, z)); - - if (mn === null) - mn = new THREE.Vector3(x, y, z); - else - mn.set(Math.min(mn.x, x), - Math.min(mn.y, y), - Math.min(mn.z, z)); - - // get the color component out - var r, g, b; - if (p.color) { - r = p.color[0] / 255.0; - g = p.color[1] / 255.0; - b = p.color[2] / 255.0; - } - else { - r = g = b = 0; - } - - if (cn === null) { - cn = new THREE.Color(); - cn.r = r; cn.g = g; cn.b = b; - } - else { - cn.r = Math.min(cn.r, r); - cn.g = Math.min(cn.g, g); - cn.b = Math.min(cn.b, b); - } - - if (cx === null) { - cx = new THREE.Color(); - cx.r = r; cx.g = g; cx.b = b; - } - else { - cx.r = Math.max(cx.r, r); - cx.g = Math.max(cx.g, g); - cx.b = Math.max(cx.b, b); - } - - in_n = (in_n === null)? p.intensity : Math.min(in_n, p.intensity); - in_x = (in_x === null)? p.intensity : Math.max(in_x, p.intensity); - - positions[ 3*i ] = p.position[0] * lasBuffer.scale[0] + (lasBuffer.offset[0] - this.corrective.x); - positions[ 3*i + 1 ] = p.position[1] * lasBuffer.scale[1] + (lasBuffer.offset[1] - this.corrective.y); - positions[ 3*i + 2 ] = p.position[2] * lasBuffer.scale[2] + (lasBuffer.offset[2] - this.corrective.z); - - colors[ 3*i ] = r; - colors[ 3*i + 1 ] = g; - colors[ 3*i + 2 ] = b; - - intensity[i] = p.intensity; - classification[i] = p.classification; - } - - if (this.cg === null) this.cg = cg; - else this.cg.set( - (this.cg.x * this.pointsSoFar + cg.x * count) / (this.pointsSoFar + count), - (this.cg.y * this.pointsSoFar + cg.y * count) / (this.pointsSoFar + count), - (this.cg.z * this.pointsSoFar + cg.z * count) / (this.pointsSoFar + count)); - - if (this.mx === null) this.mx = mx; - else this.mx.set( - Math.max(mx.x, this.mx.x), - Math.max(mx.y, this.mx.y), - Math.max(mx.z, this.mx.z)); - - if (this.mn === null) this.mn = mn; - else this.mn.set( - Math.min(mn.x, this.mn.x), - Math.min(mn.y, this.mn.y), - Math.min(mn.z, this.mn.z)); - - if (this.cn === null) this.cn = cn; - else { - this.cn.r = Math.min(this.cn.r, cn.r); - this.cn.g = Math.min(this.cn.g, cn.g); - this.cn.b = Math.min(this.cn.b, cn.b); - } - - if (this.cx === null) this.cx = cx; - else { - this.cx.r = Math.max(this.cx.r, cx.r); - this.cx.g = Math.max(this.cx.g, cx.g); - this.cx.b = Math.max(this.cx.b, cx.b); - } - - this.in_n = (this.in_n === null)? in_n : Math.min(in_n, this.in_y); - this.in_x = (this.in_x === null)? in_x : Math.max(in_x, this.in_x); - - var ps = new THREE.ParticleSystem(geometry, this.material); - this.pss.push(ps); - - this.pointsSoFar += count; - }; - - ParticleSystemBatcher.prototype.normalizePositionsWithOffset = function(offset) { - var o = this; - - console.log("offset: ", offset, "corrective:", o.corrective); - - this.correctiveOffset = offset.clone().sub(o.corrective); - this.cg.sub(offset); - this.mn.sub(offset); - this.mx.sub(offset); - }; - - - ParticleSystemBatcher.prototype.addToScene = function(scene) { - for (var i = 0, il = this.pss.length ; i < il ; i ++) { - scene.add(this.pss[i]); - } - }; - - ParticleSystemBatcher.prototype.removeFromScene = function(scene) { - for (var i = 0, il = this.pss.length ; i < il ; i ++) { - scene.remove(this.pss[i]); - } - }; - - w.ParticleSystemBatcher = ParticleSystemBatcher; -})(module.exports); diff --git a/libs/plasio/js/ui.js b/libs/plasio/js/ui.js deleted file mode 100644 index 290c7a1f..00000000 --- a/libs/plasio/js/ui.js +++ /dev/null @@ -1,1675 +0,0 @@ -// ui.js -// All UI stuff goes here -// - -var Promise = require("bluebird"), - $ = require('jquery'), - render = require("./render"), - laslaz = require('./laslaz'), - React = require('react'), - _ = require('lodash'); - - require("jqueryui"); - require("jquery-layout"); - require("jquery-nouislider"); - require("bootstrap"); - -(function(scope) { - "use strict"; - - function ColormapRange(canvasElement) { - this.img = null; - this.range = [0.0, 1.0]; - this.canvas = $(canvasElement); - - console.log('Drawing'); - this._refresh(); - - var o = this; - $(scope).on('broadcast.resize resize', function(e) { - console.log('Canvas resized'); - o._refresh(); - }); - } - - ColormapRange.prototype.setImage = function(img, cb) { - this.img = new Image(256, 1); - this.img.src = img; - - var o = this; - this.img.onload = function() { - o._refresh(); - if (cb) cb(); // since this is a delayed function, we may to trigger re-draw - }; - }; - - ColormapRange.prototype.setRange = function(n, x) { - this.range = [n, x]; - this._refresh(); - }; - - ColormapRange.prototype._refresh = function() { - // refresh all the things - var w = this.canvas.width(), - h = this.canvas.height(); - - var domCanvas = this.canvas.get(0); - - domCanvas.width = w; - domCanvas.height = h; - - console.log(w, h); - var ctx = domCanvas.getContext('2d'); - - // first clear background - // - ctx.fillStyle = "#fff"; - ctx.fillRect(0, 0, w, h); - - // Draw image if need be - if (this.img) { - // Draw first column - var f1 = Math.floor(this.range[0] * w); - var f2 = Math.floor(this.range[1] * w); - - console.log(this.img.width, this.img.height); - - console.log(f1, f2); - - var y = 0, - yh = h; - - // first band - ctx.drawImage(this.img, 0, 0, 1, 1, 0, y, f1, yh); - // second band - ctx.drawImage(this.img, 1, 0, this.img.width-2, 1, f1, y, f2 - f1, yh); - // third band - ctx.drawImage(this.img, this.img.width-1, 0, 1, 1, f2, y, w - f2, yh); - } - }; - - var colormapRange = new ColormapRange(document.getElementById('colorCanvasObject')); - - var withRefresh = function(f) { - // return f wrapped around with a call to renderer.needRefresh - return function() { - var r = f.apply(this, arguments); - $.event.trigger({ - type: 'plasio.renderer.needRefresh' - }); - - return r; - }; - }; - - // convert from array like object to an array - var toArray = function(m) { - var a = []; - for (var i = 0, il = m.length ; i < il ; i ++) { - a.push(m[i]); - } - return a; - }; - - - - // some globals we need - // - var fileLoadInProgress = false; - var allBatches = []; // all the loaded batches - - // Start UI - $(document).on("plasio.startUI", function() { - var layout = $("body").layout({ - applyDefaultStyles: true, - east: { - resizable: true, - resize: true, - togglerContent_open: "›", - togglerContent_closed: "‹", - minSize: 200, - maxSize: 600, - size: 400 - }, - - onresize: function() { - render.doRenderResize(); - $.event.trigger({ - type: 'broadcast.resize' - }); - }}); - - - // TODO: Evaluate if its a good idea to have plane based projection - setupKeyboardHooks(); - setupProgressHandlers(); - setupFileOpenHandlers(); - setupSliders(); - setupComboBoxActions(); - setupCameraActions(); - setupNaclErrorHandler(); - setupWebGLStateErrorHandler(); - setupDragHandlers(); - makePanelsSlidable(); - setupLoadHandlers(); - setupProjectionHandlers(); - setupMensurationHandlers(); - setupScaleObjectsHandlers(); - setupRegionHandlers(); - setupDocHandlers(); - - - // get the currently selected image - var imgElement = $("#colorSwatches a:first img"); - colormapRange.setImage(imgElement.attr("src")); - }); - - // some progress events arrive after hideProgress since certain operations are not - // completely cancellable. - // - var setupProgressHandlers = function() { - var inProgress = false; - var startProgress = function() { - $("#progressBar").width('0%').show(); - inProgress = true; - }; - - var showProgress = function(percent, msg) { - if (inProgress) { - console.log('showing progress', percent); - $("#progressBar").width(Math.round(percent) + '%'); - - if (msg) - $("#loadingStatus").html(msg); - } - }; - - var hideProgress = function() { - $("#progressBar").hide(); - $("#loadingStatus").html(""); - - inProgress = false; - }; - - $(document).on('plasio.progress.start', startProgress); - $(document).on('plasio.progress.progress', function(d) { - showProgress(d.percent, d.message); - }); - $(document).on('plasio.progress.end', hideProgress); - }; - - var numberWithCommas = function(x) { - return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); - }; - - var getBinary = function(url, cb) { - var oReq = new XMLHttpRequest(); - return new Promise(function(resolve, reject) { - oReq.open("GET", url, true); - oReq.responseType = "arraybuffer"; - - oReq.onprogress = function(e) { - cb(e.loaded / e.total); - }; - - oReq.onload = function(oEvent) { - if (oReq.status == 200) { - console.log(oReq.getAllResponseHeaders()); - return resolve(oReq.response); - } - reject(new Error("Could not get binary data")); - }; - - oReq.onerror = function(err) { - reject(err); - }; - - oReq.send(); - }).cancellable().catch(Promise.CancellationError, function(e) { - oReq.abort(); - throw e; - }); - }; - - var getBinaryLocal = function(file, cb) { - var fr = new FileReader(); - var p = Promise.defer(); - - fr.onprogress = function(e) { - cb(e.loaded / e.total); - }; - fr.onload = function(e) { - p.resolve(e.target.result); - }; - - fr.readAsArrayBuffer(file); - - return p.promise.cancellable().catch(Promise.CancellationError, function(e) { - fr.abort(); - throw e; - }); - }; - - var loadFileInformation = function(header) { - $(".props table").html( - "<tr><td>Name</td><td>" + header.name + "</td></tr>" + - "<tr><td>File Version</td><td>" + header.versionAsString + "</td></tr>" + - "<tr><td>Compressed?</td><td>" + (header.isCompressed ? "Yes" : "No") + "</td></tr>" + - //"<tr><td>Color?</td><td>" + (batcherHasColor ? "Yes" : "No") + "</td></tr>" + - //"<tr><td>Intensity?</td><td>" + (batcherHasIntensity ? "Yes" : "No") + "</td></tr>" + - "<tr><td>Total Points</td><td>" + numberWithCommas(header.pointsCount) + " (" + - numberWithCommas(header.totalRead) + ") " + "</td></tr>" + - "<tr><td>Point Format ID</td><td>" + header.pointsFormatId + "</td></tr>" + - "<tr><td>Point Record Size</td><td>" + header.pointsStructSize + "</td></tr>").show(); - }; - - var setupLoadHandlers = function() { - // setup handlers which listens for notifications on how to do things - // - // Actions to trigger file loading - // - $(document).on("plasio.loadfiles.local", function(e) { - cancellableLoad(getBinaryLocal, e.files, e.name); - }); - - $(document).on("plasio.loadfiles.remote", function(e) { - cancellableLoad(getBinary, [e.url], e.name); - }); - - $(document).on("plasio.load.started", function() { - scope.stopAllPlayback(); - $.event.trigger({ - type: 'plasio.progress.start' - }); - - $.event.trigger({ - type: 'plasio.progress.progress', - percent: 0 - }); - - $("#loadError").html("").hide(); - $("#browse button").attr("disabled", true); - $("#browse").hide(); - $("#browseCancel").show(); - - fileLoadInProgress = true; - }); - - $(document).on("plasio.load.progress", function(e) { - $.event.trigger({ - type: 'plasio.progress.progress', - percent: e.percent, - message: e.message - }); - }); - - var cleanup = function() { - $.event.trigger({ - type: 'plasio.progress.end' - }); - - $("#browseCancel").hide(); - $("#browse button").attr("disabled", false); - $("#browse").show(); - fileLoadInProgress = false; - }; - - var getScaleFromUser = function() { - var p = Promise.defer(); - var $modal = $("#scalesPage"); - - $modal.modal(); - $modal.on('hidden.bs.modal', function (e) { - var chosen = $modal.attr("data-selection"); - var proj = null; - switch(chosen) { - case "0": proj = new THREE.Vector3(1, 1, 1); break; - case "1": proj = new THREE.Vector3(111000, 111000, 1); break; - case "2": proj = new THREE.Vector3(111000, 111000, 3.28084); break; - } - - return p.resolve(proj); - }); - - return p.promise; - }; - - $(document).on("plasio.load.completed", function(e) { - console.log(e.batches); - - console.log('Loaded batches:', e.batches); - var batcherHasColor = false, - batcherHasIntensity = false, - batcherInSmallRange = false; - - for (var i = 0, il = e.batches.length ; i < il; i ++) { - var batcher = e.batches[i].batcher; - - batcherHasColor = batcherHasColor || - (batcher.cx.r - batcher.cn.r) > 0.0 || - (batcher.cx.g - batcher.cn.g) > 0.0 || - (batcher.cx.b - batcher.cn.b) > 0.0; - - batcherHasIntensity = batcherHasIntensity || - (batcher.in_x - batcher.in_y) > 0.0; - - batcherInSmallRange = batcherInSmallRange || - (batcher.mn.x > -180.0 && batcher.mx.x < 180.0) && - (batcher.mn.y > -180.0 && batcher.mx.y < 180.0); - } - - console.log('Has color:', batcherHasColor); - console.log('Has intensity:', batcherHasIntensity); - console.log('Has in range:', batcherInSmallRange); - - var p = batcherInSmallRange ? getScaleFromUser() : Promise.resolve(new THREE.Vector3(1, 1, 1)); - - p.then(function(scale) { - // load the batcher - // - var maxColorComponent = 0.0; - - var b = []; - for (var i = 0, il = e.batches.length ; i < il ; i ++) { - var batcher = e.batches[i].batcher; - var header = e.batches[i].header; - - console.log('Loading batch:', batcher); - maxColorComponent = Math.max(maxColorComponent, - batcher.cx.r, batcher.cx.g, batcher.cx.b); - batcher.scale = scale; - b.push({ - batcher: batcher, - header: header - }); - } - - allBatches = b; - if (batcherHasColor && batcherHasIntensity) { - // enable both intensity and color, and set blend to 50 - $("#rgb").trigger("click"); - $("#intensity").trigger("click"); - $("#blending").val(50, true); - } - else if (batcherHasColor && !batcherHasIntensity) { - $("#rgb").trigger("click"); - $("#blending").val(0, true); - } - else if (!batcherHasColor && batcherHasIntensity) { - $("#intensity").click(); - $("#blending").val(100, true); - } - else { - // no color, no intensity - $(".default-if-no-color").trigger("click"); - $("#blending").val(0, true); - } - - console.log('Max color component', maxColorComponent); - - $.event.trigger({ - type: "plasio.maxColorComponent", - maxColorComponent: maxColorComponent - }); - - $.event.trigger({ - type: "plasio.mensuration.pointsReset" - }); - - $.event.trigger({ - type: "plasio.scalegeoms.reset" - }); - - $.event.trigger({ - type: "plasio.regions.reset" - }); - - $.event.trigger({ - type: "plasio.newBatches" - }); - }).finally(cleanup); - }); - - $(document).on("plasio.load.cancelled", function(e) { - $("#loadError").html( - '<div class="alert alert-info alert-dismissable">' + - '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' + - 'The file load operation was cancelled' + - '</div>').show(); - - console.log("Operation cancelled!!"); - cleanup(); - }); - - $(document).on("plasio.load.failed", function(e) { - $("#loadError").html( - '<div class="alert alert-danger alert-dismissable">' + - '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' + - '<strong>Error!</strong> ' + e.error + - '</div>').show(); - - cleanup(); - }); - }; - - - var loadData = function(buffer, progressCB) { - var lf = new laslaz.LASFile(buffer); - - return Promise.resolve(lf).cancellable().then(function(lf) { - return lf.open().then(function() { - lf.isOpen = true; - return lf; - }) - .catch(Promise.CancellationError, function(e) { - // open message was sent at this point, but then handler was not called - // because the operation was cancelled, explicitly close the file - return lf.close().then(function() { - throw e; - }); - }); - }).then(function(lf) { - console.log("getting header"); - return lf.getHeader().then(function(h) { - console.log("got header", h); - return [lf, h]; - }); - }).then(function(v) { - var lf = v[0]; - var header = v[1]; - - var batcher = new render.ParticleSystemBatcher( - $("#vertexshader").text(), - $("#fragmentshader").text()); - - var skip = Math.round((10 - currentLoadFidelity())); - var totalRead = 0; - var totalToRead = (skip <= 1 ? header.pointsCount : header.pointsCount / skip); - var reader = function() { - var p = lf.readData(1000000, 0, skip); - return p.then(function(data) { - console.log(header); - batcher.push(new laslaz.LASDecoder(data.buffer, - header.pointsFormatId, - header.pointsStructSize, - data.count, - header.scale, - header.offset, - header.mins, header.maxs)); - - totalRead += data.count; - progressCB(totalRead / totalToRead); - - if (data.hasMoreData) - return reader(); - else { - - header.totalRead = totalRead; - header.versionAsString = lf.versionAsString; - header.isCompressed = lf.isCompressed; - return [lf, header, batcher]; - } - }); - }; - - // return the lead reader - return reader(); - }).then(function(v) { - var lf = v[0]; - // we're done loading this file - // - progressCB(1); - - // Close it - return lf.close().then(function() { - lf.isOpen = false; - // Delay this a bit so that the user sees 100% completion - // - return Promise.delay(200).cancellable(); - }).then(function() { - // trim off the first element (our LASFile which we don't really want to pass to the user) - // - return v.slice(1); - }); - }).catch(Promise.CancellationError, function(e) { - // If there was a cancellation, make sure the file is closed, if the file is open - // close and then fail - if (lf.isOpen) - return lf.close().then(function() { - lf.isOpen = false; - console.log("File was closed"); - throw e; - }); - throw e; - }); - }; - - var setupFileOpenHandlers = function() { - $("#browseCancel button").on("click", withRefresh(function() { - $.event.trigger({ - type: "plasio.load.cancel" - }); - })); - - $(".btn-file").on("click", function(e) { - e.preventDefault(); - console.log("Doing shit!"); - console.log($("#filebrowser")); - $("#filebrowser").click(); - }); - - - $(document).on('change', '#filebrowser', withRefresh(function(e) { - e.preventDefault(); - - console.log("Selected a file"); - - var input = $(this); - var files = input.get(0).files; - - $.event.trigger({ - type: "plasio.loadfiles.local", - files: toArray(files), - name: files.length === 1 ? files[0].name : 'Multiple Files' - }); - })); - - $("#browse").on("click", "a", withRefresh(function(e) { - e.preventDefault(); - - var target = $(this).attr("href"); - - // if we don't have LAZ available, we download the LAS version - // - console.log("Will load", target); - - var name = target.substring(target.lastIndexOf('/')+1); - - $.event.trigger({ - type: "plasio.loadfiles.remote", - url: target, - name: name - }); - })); - }; - - var cancellableLoad = function(fDataLoader, files, name) { - // fDataLoader should be a function that when called returns a promise which - // can be cancelled, the fDataLoader should resolve to an array buffer of loaded file - // and should correctly handle cancel requets. - // - var progress = function(pc, msg) { - console.log("progress: ", pc, msg); - var obj = { - type: "plasio.load.progress", - percent: Math.round(pc * 100) - }; - - if (msg !== undefined) obj.message = msg; - $.event.trigger(obj); - }; - - var loaderPromise = null; - $(document).on("plasio.load.cancel", function() { - if (loaderPromise === null) return; - var a = loaderPromise; - loaderPromise = null; - - progress(1, "Cancelling..."); - setTimeout(function() { - a.cancel(); - console.log('Cancellation done!'); - }, 0); - }); - - $.event.trigger({ - type: "plasio.load.started" - }); - - progress(0, "Fetching " + name + "..."); - - var currentLoadIndex = 0; - var maxLoadIndex = files.length; - - var sofar = []; - - var pfuncDataLoad = function(p, msg) { - progress((currentLoadIndex + p*0.5) / maxLoadIndex, msg); - }; - - var pfuncDecompress = function(p, msg) { - progress((currentLoadIndex + 0.5 + p*0.5) / maxLoadIndex, msg); - }; - - var cur = Promise.resolve().cancellable(); - - files.forEach(function(fname) { - cur = cur.then(function() { - return fDataLoader(fname, pfuncDataLoad).then(function(data) { - console.log(fname.name, 'Done loading file, loading data...'); - return loadData(data, pfuncDecompress); - }) - .then(function(r) { - console.log(fname.name, 'Done loading data...'); - var ret = { - header: r[0], - batcher: r[1] - }; - - // TODO: This needs to be fixed for mutliple URLs - // - ret.header.name = fname.name || name; - currentLoadIndex ++; - sofar.push(ret); - }); - }); - }); - - loaderPromise = cur.then(function() { - $.event.trigger({ - type: "plasio.load.completed", - batches: sofar - }); - }) - .catch(Promise.CancellationError, function(e) { - console.log(e, e.stack); - - $.event.trigger({ - type: "plasio.load.cancelled", - }); - }) - .catch(function(e) { - console.log(e, e.stack); - - $.event.trigger({ - type: "plasio.load.failed", - error: "Failed to load file" - }); - }) - .finally(function() { - progress(1); - - loaderPromise = null; - }); - }; - - var setupSliders = function() { - // setup any react classes we may need - // - var InundationControls = React.createClass({ - getInitialState: function() { - return { enabled: false, - slider: false, - opacity: 50, - value: 0}; - }, - - componentDidMount: function() { - }, - - componentDidUpdate: function() { - // if we have #inun, make it into a slider - if (!this.state.slider) { - var n = $("#inun").get(0); - var m = $("#inun-opacity").get(0); - - var o = this; - - $(n).noUiSlider({ - range:[0, 1000], - start: o.state.value, - handles: 1, - connect: "lower", - slide: withRefresh(function() { - $.event.trigger({ - type: 'plasio.inundationChanged' - }); - - o.setState({value: $(n).val()}); - }) - }); - - $(m).noUiSlider({ - range:[0, 100], - start: o.state.opacity, - handles: 1, - connect: "lower", - slide: withRefresh(function() { - $.event.trigger({ - type: 'plasio.inundationOpacityChanged' - }); - - o.setState({opacity: $(m).val()}); - }) - }); - - o.setState({slider: true}); - } - }, - - render: function() { - var classes = React.addons.classSet({ - 'btn btn-block btn-sm': true, - 'btn-default': !this.state.enabled, - 'btn-success active': this.state.enabled - }); - - return React.DOM.div(null, [ - React.DOM.button({ - type: "button", - className: classes, - style: {marginBottom: '15px'}, - onClick: withRefresh(this.toggle), - }, this.state.enabled ? "Disable" : "Enable"), - this.state.enabled ? React.DOM.div({id: "inun"}) : null, - this.state.enabled ? React.DOM.h5({className:"not-first"}, "Adjust opacity of inundation plane") : null, - this.state.enabled ? React.DOM.div({id: "inun-opacity"}) : null - ]); - }, - - toggle: function() { - var nextEnabled = !this.state.enabled; - this.setState({enabled: nextEnabled, - slider: false}); - - $.event.trigger({ - type: 'plasio.inundationEnable', - enable: nextEnabled - }); - } - }); - - // Mount any React components - React.renderComponent(InundationControls(), $("#inun-container").get(0)); - - // Setup UI sliders - $("#loadFidelity").noUiSlider({ - range: [1, 9], - start: 5, - handles: 1, - connect: "lower", - step: 1 - }); - - $("#fov").noUiSlider({ - range: [30, 110], - start: 60, - handles: 1, - connect: "lower", - slide: withRefresh(function() { - $.event.trigger({ - type: 'plasio.cameraFOVChanged' - }); - }) - }); - - $("#intensity").noUiSlider({ - range: [0, 100], - start: [0, 100], - connect: true, - slide: withRefresh(function() { - $.event.trigger({ - type: 'plasio.intensityClampChanged' - }); - }) - }); - - var $pbfps = $("#playback-fps"); - var $pbr = $("#playback-rate"); - - var currentPlaybackRate = function() { - return ($pbr.val() - 6) * 5; - }; - - var handlePlaybackRateChange = function() { - $pbfps.html(currentPlaybackRate() + "fps"); - $.event.trigger({ - type: 'plasio.playRateChanged' - }); - }; - - $pbr.noUiSlider({ - range: [0, 12], - start: 6, - handles: 1, - step: 1, - connect: false, - slide: handlePlaybackRateChange, - }); - - $pbfps.html(currentPlaybackRate() + "fps"); - - var setCurrentBatcher = function(index, resetCamera) { - console.log('Setting active batcher at index:', index); - - var b = allBatches[index]; - render.loadBatcher(b.batcher, resetCamera); - loadFileInformation(b.header); - - $.event.trigger({ - type: "plasio.needRefresh" - }); - }; - - var pbTimeout = null; - var setBatchPlayAtRate = function(rate, sliderToUpdate) { - console.log('Setting play rate at:', rate); - if (pbTimeout !== null) { - clearTimeout(pbTimeout); - pbTimeout = 0; - } - - if (rate === 0) - return; - - if (!allBatches || allBatches.length === 0) - return; - - var frames = []; - for (var i = 0, il = allBatches.length ; i < il ; i ++) { - frames.push(rate > 0 ? i : (il - i - 1)); - } - - var freq = 1000 / Math.abs(rate); - var index = 0; - - var nextFrame = function() { - var thisIndex = frames[index]; - setCurrentBatcher(thisIndex, false); - if (sliderToUpdate !== undefined && sliderToUpdate.length > 0) { - sliderToUpdate.val(thisIndex); - } - - index ++; - if (index > frames.length - 1) - index = 0; - - pbTimeout = setTimeout(nextFrame, freq); - }; - - pbTimeout = setTimeout(nextFrame, freq); - }; - - var stopAllPlayback = function() { - setBatchPlayAtRate(0); - $pbr.val(6); - $pbfps.html("0fps"); - }; - - var $sliderToUpdate = null; - $(document).on("plasio.newBatches", function() { - // New batches have arrived, set the range accordingly on our slider and - // set start to 0 - console.log('Got new batches!'); - - var $h5 = $(".switch-inst"); - $h5.html("Some information about the loaded data."); - $("#multi-files").html(""); - $(".auto-play").hide(); - - - if (allBatches.length > 1) { - $("#multi-files").html("<div></div>"); - var $slider = $("#multi-files div"); - - $h5.html("Use slider to switch between data sets and view their properties."); - - $sliderToUpdate = $slider; - var correctedCG = allBatches[0].batcher.cg.clone(); - - // renormlize all batchers with the given CG - // - allBatches.forEach(function(b) { - b.batcher.normalizePositionsWithOffset(correctedCG); - }); - - // renormalization means that we use no offsets in our shaders - $slider.noUiSlider({ - range: [0, allBatches.length - 1], - start: 0, - handles: 1, - step: 1, - slide: function() { - stopAllPlayback(); - setCurrentBatcher(parseInt($slider.val()), false); - }, - }); - - $(".auto-play").show(); - - } - else { - // still normalize stuff to our cg - allBatches[0].batcher.normalizePositionsWithOffset(allBatches[0].batcher.cg); - } - - setCurrentBatcher(0, true); - $(".props").show(); - }); - - $(document).on("plasio.playRateChanged", function() { - setBatchPlayAtRate(currentPlaybackRate(), $sliderToUpdate); - }); - - var blendUpdate = function() { - $.event.trigger({ - type: 'plasio.intensityBlendChanged' - }); - }; - - $("#blending").noUiSlider({ - range: [0, 100], - start: 0, - handles: 1, - slide: withRefresh(blendUpdate), - set: withRefresh(blendUpdate) - }); - - $("#pointsize").noUiSlider({ - range: [1, 15], - start: 3, - handles: 1, - step: 1, - slide: withRefresh(function() { - $.event.trigger({ - type: 'plasio.pointSizeChanged' - }); - }) - }); - - var $colormapClamp = $("#colormapClamp"); - var currentColorClamp = function() { - var val = $("#colormapClamp").val(); - var n = parseInt(val[0]) / 100.0, - x = parseInt(val[1]) / 100.0; - - return [n, x]; - }; - - $("#colormapClamp").noUiSlider({ - range: [0, 100], - start: [0, 100], - handles: 2, - connect: true, - slide: withRefresh(function() { - var r = currentColorClamp(); - colormapRange.setRange(r[0], r[1]); - - $.event.trigger({ - type: 'plasio.colorClampChanged' - }); - }) - }); - - scope.currentFOV = function() { - return $("#fov").val(); - }; - - scope.currentInundationLevel = function() { - var $n = $("#inun"); - if ($n.length === 0) - return 0.0; - - return $n.val(); - }; - - scope.currentInundationOpacity = function() { - var $n = $("#inun-opacity"); - if ($n.length === 0) - return 0.0; - - return $n.val(); - }; - - scope.currentLoadFidelity = function() { - return $("#loadFidelity").val(); - }; - - scope.currentIntensityClamp = function() { - return $("#intensity").val(); - }; - - scope.currentIntensityBlend = function() { - return $("#blending").val(); - }; - - scope.currentPointSize = function() { - return $("#pointsize").val(); - }; - - scope.currentColorClamp = currentColorClamp; - scope.currentPlaybackRate = currentPlaybackRate; - scope.stopAllPlayback = stopAllPlayback; - }; - - var setupComboBoxActions = function() { - $("#colorsource").on("click", "a", withRefresh(function(e) { - e.preventDefault(); - var $a = $(this); - console.log($a); - - var option = $a.text(); - var target = $a.attr("href").substring(1); - $("#colorsource").find("button") - .html(option + " <span class='caret'></span>") - .attr("target", target); - - $.event.trigger({ - type: "plasio.colorsourceChanged" - }); - })); - - $("#intensitysource").on("click", "a", withRefresh(function(e) { - e.preventDefault(); - var $a = $(this); - console.log($a); - - var option = $a.text(); - var target = $a.attr("href").substring(1); - $("#intensitysource").find("button") - .html(option + " <span class='caret'></span>") - .attr("target", target); - - $.event.trigger({ - type: "plasio.intensitysourceChanged" - }); - })); - - - var activeColorMap = "colormaps/blue-red.png"; - $("#colorSwatches").on("click", "a", function(e) { - e.preventDefault(); - - var $a = $(this); - var $img = $a.find('img'); - var imgUrl = $img.attr('src'); - - activeColorMap = imgUrl; - colormapRange.setImage(imgUrl, withRefresh(function() { - $.event.trigger({ - type: "plasio.colormapChanged" - }); - })); - }); - - colormapRange.setImage(activeColorMap); - - scope.currentColorSource = function() { - var source = $("#colorsource button").attr('target'); - return source; - }; - - scope.currentIntensitySource = function() { - var source = $("#intensitysource button").attr('target'); - return source; - }; - - scope.currentColorMap = function() { - return activeColorMap; - }; - }; - - var setupCameraActions = function() { - $("#perspective").on("click", withRefresh(function() { - $.event.trigger({ - type: 'plasio.camera.perspective' - }); - })); - - $("#ortho").on("click", withRefresh(function() { - $.event.trigger({ - type: 'plasio.camera.ortho' - }); - })); - - $("#top-view").on("click", withRefresh(function() { - $.event.trigger({ - type: 'plasio.camera.topView' - }); - })); - - $("#camera-reset").on("click", withRefresh(function() { - $.event.trigger({ - type: 'plasio.camera.reset' - }); - })); - - }; - - var setupNaclErrorHandler = function() { - $(document).on("plasio.nacl.error", function(err) { - console.log(err); - }); - }; - - var setupWebGLStateErrorHandler = function() { - $(document).on("plasio.webglIsExperimental", function() { - $("#webglinfo").html("<div class='alert alert-warning'>" + - "<span class='glyphicon glyphicon-info-sign'></span> " + - "<strong>Experimental WebGL!</strong><br>" + - "Your browser reports that its WebGL support is experimental." + - " You may experience rendering problems.</div>"); - $("#webglinfo").show(); - }); - }; - - var setupDragHandlers = function() { - var ignore = function(e) { - e.originalEvent.stopPropagation(); - e.originalEvent.preventDefault(); - }; - - var dragEnter = function() { - $(".drag-and-drop").show(); - }; - - var dragLeave = function() { - $(".drag-and-drop").hide(); - }; - - var hideto = null; - $("body").on("dragover", function(e) { - ignore(e); - - // no drag drop indication when file load is in progress - if (fileLoadInProgress) - return; - - if (hideto === null) - dragEnter(); - else - clearTimeout(hideto); - - hideto = setTimeout(function() { - dragLeave(); - hideto = null; - }, 100); - }); - - $("body").on("dragenter", ignore); - $("body").on("dragleave", ignore); - - $("body").on("drop", withRefresh(function(e) { - ignore(e); - if (fileLoadInProgress) - return; - - var dt = e.originalEvent.dataTransfer; - var droppedFiles = dt.files; - - $.event.trigger({ - type: "plasio.loadfiles.local", - files: toArray(droppedFiles), - name: (droppedFiles.length === 1? droppedFiles[0].name : "Multiple Files") - }); - })); - }; - - var makePanelsSlidable = function() { - var totalPanels = $(".section").length; - var colors = _.times(totalPanels, function(i) { - return "hsl(" + Math.floor((i + 1) * 360 / totalPanels) + ", 40%, 95%)"; - }); - - $(".section").each(function(index, e) { - var $e = $(e); - $e.attr('target-bg-color', colors[index]); - $e.find('.labeled-controls').css('background-color', colors[index]); - }); - - // find all panel headers and add make them into slidable widgets - // - $(".p-head") - .addClass("clearfix p-collapse-open") - .css("cursor", "pointer") - .append("<div class='toggle-control'>" + - "<span class='glyphicon glyphicon-chevron-up'></span></div>"); - $(".p-head h3").css("float", "left"); - - $("body").on("click", ".p-head", function() { - var $control = $(this); - var isOpen = $control.hasClass("p-collapse-open"); - var $scroller = $control.next(".p-body"); - var $span = $control.find(".toggle-control span"); - var bgcolor = $control.closest('.section').attr('target-bg-color'); - if (isOpen) - $scroller.slideUp(200, function() { - $control - .removeClass("p-collapse-open") - .addClass("p-collapse-close") - .css('background-color', bgcolor); - - $span.attr("class", "glyphicon glyphicon-chevron-down"); - }); - else { - // when scrolling down appply styles first, for awesomeness effect - $control - .removeClass("p-collapse-close") - .addClass("p-collapse-open") - .css('background-color', ''); - - $span.attr("class", "glyphicon glyphicon-chevron-up"); - $scroller.slideDown(200); - } - }); - }; - - var setupProjectionHandlers = function() { - $("#scalesPage").on("click", "button", function(e) { - e.preventDefault(); - - var $button = $(this); - var $modal = $(this).closest(".modal"); - - $modal.attr("data-selection", $button.attr("data-value")); - $modal.modal('hide'); - }); - }; - - var setupKeyboardHooks = function() { - $(document).on('keypress', withRefresh(function(e) { - console.log('Keypress', e); - - var keyCode = e.key || e.which || e.keyCode; - - // we hold the space down to get into mensuration mode - // - if (keyCode === 84 || keyCode === 116) { - e.preventDefault(); - e.stopPropagation(); - - $.event.trigger({ - type: 'plasio.render.toggleClip' - }); - } - })); - }; - - var setupMensurationHandlers = function() { - $("#mensuration-reset").on("click", function(e) { - e.preventDefault(); - $.event.trigger({ - type: 'plasio.mensuration.pointsReset' - }); - }); - - // TODO: This information should come down from somewhere, the UI module - // should not assume that we know where the renderer is. The render module has - // a function to query this, but the renderer hasn't been initialized yet - // - $("#container").on("dblclick", function(e) { - if (!e.altKey) { - e.preventDefault(); - - $.event.trigger({ - type: 'plasio.mensuration.addPoint', - x: e.clientX, y: e.clientY, - startNew: e.shiftKey - }); - } - }); - - var LineSegment = React.createClass({ - render: function() { - return React.DOM.tr({ - style: { backgroundColor: '#' + this.props.start.color.getHexString() } }, [ - React.DOM.td(null, this.props.lineIndex), - React.DOM.td({style: {textAlign: 'right'}}, this.props.start.distanceTo(this.props.end).toFixed(1)), - React.DOM.td(null, React.DOM.a({ href: "#", onClick: this.addRegion }, React.DOM.span({className: "glyphicon glyphicon-picture"}, ''))) - ]); - }, - addRegion: function(e) { - render.createNewRegion(this.props.start, this.props.end, this.props.start.color); - } - }); - - var LineSegmentsBox = React.createClass({ - getInitialState: function() { - return { points: [] }; - }, - componentWillMount: function() { - var c = this; - $(document).on('plasio.mensuration.pointAdded', function(e) { - c.setState({ points: c.state.points.concat([e.point])}); - }); - - $(document).on('plasio.mensuration.pointRemoved', function(e) { - c.setState({ points: _.without(c.state.points, e.point) }); - }); - - $(document).on('plasio.mensuration.pointsReset', function(e) { - console.log("Resetting all points"); - c.setState({ points: [] }); - }); - }, - render: function() { - var lines = []; - var index = 0; - for (var i = 0 ; i < this.state.points.length - 1 ; i ++) { - var p1 = this.state.points[i], - p2 = this.state.points[i+1]; - if (p1.id === p2.id) { - lines.push(LineSegment({ lineIndex: index+1, start: p1, end: p2 })); - index ++; - } - } - - if (lines.length === 0) - return React.DOM.div({ className: "its-empty" }, - "No Measurement Segments"); - return React.DOM.table({ - class: "table" - }, [ - React.DOM.thead(null, [ - React.DOM.tr(null, [ - React.DOM.td(null, 'Index'), - React.DOM.td({style: {textAlign: 'right'}}, 'Length'), - React.DOM.td(null, '') - ]) - ]), - React.DOM.tbody(null, lines) - ]); - } - }); - - React.renderComponent(LineSegmentsBox({}), $("#points-list-table").get(0)); - }; - - function nameToScale(name) { - var scale = 1.0; - switch(name) { - case "meters": scale = 1.0; break; - case "feet": scale = 3.28; break; - case "inches": scale = 39.37; break; - } - - return scale; - } - - var setupScaleObjectsHandlers = function() { - // TODO: Don't assume where the renderer is running - // - $("#container").on('dblclick', function(e) { - console.log('dbl-click', e); - if (e.altKey) { - e.preventDefault(); - - var scale = $("#scale-geoms-scale button").attr("target"); - - $.event.trigger({ - type: 'plasio.scalegeoms.place', - url: '/scale-objects/EmpireStateBuilding/EmpireStateBuilding.js', - x: e.clientX, - y: e.clientY, - scale: nameToScale(scale) - }); - } - }); - - $("#scale-geoms-clear").on('click', function(e) { - e.preventDefault(); - - $.event.trigger({ - type: 'plasio.scalegeoms.reset' - }); - }); - - $("#scale-geoms-scale").on("click", "a", withRefresh(function(e) { - e.preventDefault(); - var $a = $(this); - console.log($a); - - var option = $a.text(); - var target = $a.attr("href").substring(1); - $("#scale-geoms-scale").find("button") - .html(option + " <span class='caret'></span>") - .attr("target", target); - - var scale = nameToScale(target); - console.log('Setting scale to:', scale); - $.event.trigger({ - type: "plasio.scalegeoms.scale", - scale: nameToScale(target) - }); - })); - }; - - var setupRegionHandlers = function() { - $(document).on('click', 'a.make-region', function(e) { - e.preventDefault(); - - var index = parseInt($(this).attr('href').substring(1)); - console.log('Making a region out of segment out of index', index); - - var currentPoints = render.getCurrentPoints(); - var p1 = currentPoints[index]; - var p2 = currentPoints[index+1]; - - render.createNewRegion(p1, p2); - }); - - var RegionViewport = React.createClass({ - render: function() { - var classes = React.addons.classSet({ - 'btn btn-block btn-sm': true, - 'btn-default': !this.props.region.active, - 'btn-success active': this.props.region.active - }); - return React.DOM.button({ - className: classes, - onClick: this.props.toggle - }, - this.props.region.active ? "Deactivate" : "Activate"); - } - }); - - var RegionSizeSlider = React.createClass({ - componentDidMount: function() { - var a = this.getDOMNode(); - $(a).noUiSlider({ - range: [1, 10], - start: Math.round(this.props.startScale), - step: 1, - handles: 1, - connect: false, - slide: this.setSize - }); - }, - render: function() { - return React.DOM.div({style: { marginBottom: '15px' }}); - }, - setSize: function() { - var v = $(this.getDOMNode()).val(); - this.props.setSize(v); - }, - }); - - var Region = React.createClass({ - render: function() { - var cx = React.addons.classSet; - var classesFor = function(active) { - return cx({ - 'btn': true, - 'btn-default': true, - 'btn-sm': true, - 'active': active }); - }; - - console.log('Rendering'); - - return React.DOM.div({ style: { - borderLeft: '10px solid #' + this.props.region.color.getHexString(), - marginBottom: '5px', - paddingLeft: '5px', - boxSizing: 'border-box' - }}, [ - React.DOM.div({ - style: { float: 'right', padding: '0px' }, - className: "btn btn-link btn-sm", - onClick: _.partial(this.props.remove, this.props.index), - type: "button" }, React.DOM.span({ className: "glyphicon glyphicon-remove"})), - React.DOM.div({ className: "btn-group btn-group-justified", style: { marginBottom: '10px' }}, [ - React.DOM.div({ - className: classesFor(this.props.region.type == 1), - onClick: _.partial(this.props.setRibbon, this.props.index), - type: "button" }, "Ribbon"), - React.DOM.div({ - className: classesFor(this.props.region.type == 2), - onClick: _.partial(this.props.setAxisAligned, this.props.index), - type: "button" }, "Axis-Aligned") - ]), - this.props.region.type === 1 ? RegionSizeSlider({ - region: this.props.region, - startScale: this.props.region.widthScale, - setSize: _.partial(this.props.setWidth, this.props.index) - }) : '', - this.props.region.type === 1 ? RegionSizeSlider({ - region: this.props.region, - startScale: this.props.region.heightScale, - setSize: _.partial(this.props.setHeight, this.props.index) - }) : '', - RegionViewport({ - region: this.props.region, - toggle: _.partial(this.props.toggle, this.props.index) - }) - ]); - }, - }); - - var RegionsBox = React.createClass({ - getInitialState: function() { - return { regions: [] }; - }, - componentWillMount: function() { - var o = this; - $(document).on("plasio.regions.new", function(e) { - o.setState({ regions: o.state.regions.concat(e.region) }); - }); - - $(document).on("plasio.regions.reset", function() { - o.setState({ regions: [] }); - }); - - }, - render: function() { - if (this.state.regions.length === 0) - return React.DOM.div({ className: 'its-empty' }, 'No regions defined'); - - var o = this; - var resetButton = React.DOM.button({ - className: 'btn btn-info btn-sm btn-block', - style: { marginBottom: '10px' }, - onClick: withRefresh(function() { $.event.trigger({ type: 'plasio.render.toggleClip' }); }) - }, 'Toggle Regions View (T)'); - - return React.DOM.div({ - class: "all-regions" }, - [resetButton].concat( - _.times(this.state.regions.length, function(i) { - var r = o.state.regions[i]; - return Region({ - index: i, - region: o.state.regions[i], - setRibbon: o.setRibbon, - setAxisAligned: o.setAxisAligned, - setWidth: o.setWidth, - setHeight: o.setHeight, - remove: o.remove, - toggle: o.toggle }); - }))); - }, - - setRibbon: withRefresh(function(i) { - this.state.regions[i].type = 1; - this.setState({ regions: this.state.regions }); - }), - setAxisAligned: withRefresh(function(i) { - this.state.regions[i].type = 2; - this.setState({ regions: this.state.regions }); - }), - - setWidth: withRefresh(function(i, w) { - this.state.regions[i].widthScale = w; - this.setState({ regions: this.state.regions }); - }), - - setHeight: withRefresh(function(i, h) { - this.state.regions[i].heightScale = h; - - this.setState({ regions: this.state.regions }); - }), - - remove: withRefresh(function(i) { - console.log('Removing region'); - var r = this.state.regions[i]; - this.setState({ regions: _.without(this.state.regions, r) }); - - $.event.trigger({ - type: 'plasio.regions.remove', - region: r - }); - }), - toggle: withRefresh(function(i) { - this.state.regions[i].active = !this.state.regions[i].active; - this.setState({ regions: this.state.regions }); - }) - }); - - React.renderComponent(RegionsBox({}), $("#clipping-regions").get(0)); - }; - - var setupDocHandlers = function() { - var $modal = $("#docsPage"); - - var url = null; - $(document).on('click', 'a.doc-tag', function(e) { - e.preventDefault(); - - url = $(this).attr('href'); - $modal.modal('show'); - }); - - $modal.on('click', '.tags button', function(e) { - e.preventDefault(); - - var offset = parseInt($(this).attr('data-offset')); - var video = $(".modal-body video").get(0); - - if (video) - video.currentTime = offset; - }); - - $modal.on('hidden.bs.modal', function() { - var $title = $modal.find('.modal-title'); - var $body = $modal.find('.modal-body'); - - $title.html('plasio Documentation'); - $body.html(''); - }); - - - $modal.on('shown.bs.modal', function() { - $.get(url, function(data) { - var $title = $modal.find('.modal-title'); - var $body = $modal.find('.modal-body'); - - $title.text(data.title); - - $body. - html(''). - append( - $('<p>').html(data.summary), - $('<video>', { controls: true, autoplay: true, style: 'width:100%;height:auto;' }).append( - $('<source>', { src: data.video, type: 'video/webm' }), - "Your player does not support HTML5 video, you can still download the video from <a href='" + data.video + "'>here</a>" - ), - $('<div>', { class: 'tags' }).append( - $('<p>').text('Tags'), - data.tags.map(function(t) { - return $('<button>', { type: 'button', class:'btn btn-sm btn-default', 'data-offset': t.offset}).text(t.title); - }))); - }); - }); - }; -})(window); - diff --git a/libs/plasio/vendor/bootstrap.min.js b/libs/plasio/vendor/bootstrap.min.js deleted file mode 100644 index b04a0e82..00000000 --- a/libs/plasio/vendor/bootstrap.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Bootstrap v3.1.1 (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ -if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown",h),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=" li:not(.divider):visible a",i=f.find("[role=menu]"+h+", [role=listbox]"+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu], [role=listbox]",f.prototype.keydown)}(jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this,d=this.tip();this.setContent(),this.options.animation&&d.addClass("fade");var e="function"==typeof this.options.placement?this.options.placement.call(this,d[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,g=f.test(e);g&&(e=e.replace(f,"")||"top"),d.detach().css({top:0,left:0,display:"block"}).addClass(e),this.options.container?d.appendTo(this.options.container):d.insertAfter(this.$element);var h=this.getPosition(),i=d[0].offsetWidth,j=d[0].offsetHeight;if(g){var k=this.$element.parent(),l=e,m=document.documentElement.scrollTop||document.body.scrollTop,n="body"==this.options.container?window.innerWidth:k.outerWidth(),o="body"==this.options.container?window.innerHeight:k.outerHeight(),p="body"==this.options.container?0:k.offset().left;e="bottom"==e&&h.top+h.height+j-m>o?"top":"top"==e&&h.top-m-j<0?"bottom":"right"==e&&h.right+i>n?"left":"left"==e&&h.left-i<p?"right":e,d.removeClass(l).addClass(e)}var q=this.getCalculatedOffset(e,h,i,j);this.applyPlacement(q,e),this.hoverState=null;var r=function(){c.$element.trigger("shown.bs."+c.type)};a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,r).emulateTransitionEnd(150):r()}},b.prototype.applyPlacement=function(b,c){var d,e=this.tip(),f=e[0].offsetWidth,g=e[0].offsetHeight,h=parseInt(e.css("margin-top"),10),i=parseInt(e.css("margin-left"),10);isNaN(h)&&(h=0),isNaN(i)&&(i=0),b.top=b.top+h,b.left=b.left+i,a.offset.setOffset(e[0],a.extend({using:function(a){e.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),e.addClass("in");var j=e[0].offsetWidth,k=e[0].offsetHeight;if("top"==c&&k!=g&&(d=!0,b.top=b.top+g-k),/bottom|top/.test(c)){var l=0;b.left<0&&(l=-2*b.left,b.left=0,e.offset(b),j=e[0].offsetWidth,k=e[0].offsetHeight),this.replaceArrow(l-f+j,j,"left")}else this.replaceArrow(k-g,k,"top");d&&e.offset(b)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); \ No newline at end of file diff --git a/libs/plasio/vendor/controls/TrackballControls.js b/libs/plasio/vendor/controls/TrackballControls.js deleted file mode 100644 index 45f20987..00000000 --- a/libs/plasio/vendor/controls/TrackballControls.js +++ /dev/null @@ -1,591 +0,0 @@ -/** - * @author Eberhard Graether / http://egraether.com/ - * @author Mark Lundin / http://mark-lundin.com - */ - -THREE.TrackballControls = function ( object, domElement ) { - - var _this = this; - var STATE = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM: 4, TOUCH_PAN: 5 }; - - this.object = object; - this.domElement = ( domElement !== undefined ) ? domElement : document; - - // API - - this.enabled = true; - - this.screen = { left: 0, top: 0, width: 0, height: 0 }; - - this.rotateSpeed = 1.0; - this.zoomSpeed = 1.2; - this.panSpeed = 0.3; - - this.noRotate = false; - this.noZoom = false; - this.noPan = false; - this.noRoll = false; - - this.staticMoving = true; - this.dynamicDampingFactor = 0.2; - - this.minDistance = 0; - this.maxDistance = Infinity; - - this.keys = [ 65 /*A*/, 83 /*S*/, 68 /*D*/ ]; - - // internals - - this.target = new THREE.Vector3(); - - var lastPosition = new THREE.Vector3(); - - var _state = STATE.NONE, - _prevState = STATE.NONE, - - _eye = new THREE.Vector3(), - - _rotateStart = new THREE.Vector3(), - _rotateEnd = new THREE.Vector3(), - - _zoomStart = new THREE.Vector2(), - _zoomEnd = new THREE.Vector2(), - - _touchZoomDistanceStart = 0, - _touchZoomDistanceEnd = 0, - - _panStart = new THREE.Vector2(), - _panEnd = new THREE.Vector2(); - - // for reset - - this.target0 = this.target.clone(); - this.position0 = this.object.position.clone(); - this.up0 = this.object.up.clone(); - - // events - - var changeEvent = { type: 'change' }; - var startEvent = { type: 'start'}; - var endEvent = { type: 'end'}; - - - // methods - - this.handleResize = function () { - - if ( this.domElement === document ) { - - this.screen.left = 0; - this.screen.top = 0; - this.screen.width = window.innerWidth; - this.screen.height = window.innerHeight; - - } else { - - this.screen = this.domElement.getBoundingClientRect(); - // adjustments come from similar code in the jquery offset() function - var d = this.domElement.ownerDocument.documentElement - this.screen.left += window.pageXOffset - d.clientLeft - this.screen.top += window.pageYOffset - d.clientTop - - } - - }; - - this.handleEvent = function ( event ) { - - if ( typeof this[ event.type ] == 'function' ) { - - this[ event.type ]( event ); - - } - - }; - - this.getMouseOnScreen = function ( pageX, pageY, optionalTarget ) { - - return ( optionalTarget || new THREE.Vector2() ).set( - ( pageX - _this.screen.left ) / _this.screen.width, - ( pageY - _this.screen.top ) / _this.screen.height - ); - - }; - - this.getMouseProjectionOnBall = (function(){ - - var objectUp = new THREE.Vector3(); - - - return function ( pageX, pageY, projection ) { - - var mouseOnBall = new THREE.Vector3( - ( pageX - _this.screen.width * 0.5 - _this.screen.left ) / (_this.screen.width*.5), - ( _this.screen.height * 0.5 + _this.screen.top - pageY ) / (_this.screen.height*.5), - 0.0 - ); - - var length = mouseOnBall.length(); - - if ( _this.noRoll ) { - - if ( length < Math.SQRT1_2 ) { - - mouseOnBall.z = Math.sqrt( 1.0 - length*length ); - - } else { - - mouseOnBall.z = .5 / length; - - } - - } else if ( length > 1.0 ) { - - mouseOnBall.normalize(); - - } else { - - mouseOnBall.z = Math.sqrt( 1.0 - length * length ); - - } - - _eye.copy( _this.object.position ).sub( _this.target ); - - projection.copy( _this.object.up ).setLength( mouseOnBall.y ) - projection.add( objectUp.copy( _this.object.up ).cross( _eye ).setLength( mouseOnBall.x ) ); - projection.add( _eye.setLength( mouseOnBall.z ) ); - - return projection; - } - - }()); - - this.rotateCamera = (function(){ - - var axis = new THREE.Vector3(), - quaternion = new THREE.Quaternion(); - - - return function () { - - var angle = Math.acos( _rotateStart.dot( _rotateEnd ) / _rotateStart.length() / _rotateEnd.length() ); - - if ( angle ) { - - axis.crossVectors( _rotateStart, _rotateEnd ).normalize(); - - angle *= _this.rotateSpeed; - - quaternion.setFromAxisAngle( axis, -angle ); - - _eye.applyQuaternion( quaternion ); - _this.object.up.applyQuaternion( quaternion ); - - _rotateEnd.applyQuaternion( quaternion ); - - if ( _this.staticMoving ) { - - _rotateStart.copy( _rotateEnd ); - - } else { - - quaternion.setFromAxisAngle( axis, angle * ( _this.dynamicDampingFactor - 1.0 ) ); - _rotateStart.applyQuaternion( quaternion ); - - } - - } - } - - }()); - - this.zoomCamera = function () { - - if ( _state === STATE.TOUCH_ZOOM ) { - - var factor = _touchZoomDistanceStart / _touchZoomDistanceEnd; - _touchZoomDistanceStart = _touchZoomDistanceEnd; - _eye.multiplyScalar( factor ); - - } else { - - var factor = 1.0 + ( _zoomEnd.y - _zoomStart.y ) * _this.zoomSpeed; - - if ( factor !== 1.0 && factor > 0.0 ) { - - _eye.multiplyScalar( factor ); - - if ( _this.staticMoving ) { - - _zoomStart.copy( _zoomEnd ); - - } else { - - _zoomStart.y += ( _zoomEnd.y - _zoomStart.y ) * this.dynamicDampingFactor; - - } - - } - - } - - }; - - this.panCamera = (function(){ - - var mouseChange = new THREE.Vector2(), - objectUp = new THREE.Vector3(), - pan = new THREE.Vector3(); - - return function () { - - mouseChange.copy( _panEnd ).sub( _panStart ); - - if ( mouseChange.lengthSq() ) { - - mouseChange.multiplyScalar( _eye.length() * _this.panSpeed ); - - pan.copy( _eye ).cross( _this.object.up ).setLength( mouseChange.x ); - pan.add( objectUp.copy( _this.object.up ).setLength( mouseChange.y ) ); - - _this.object.position.add( pan ); - _this.target.add( pan ); - - if ( _this.staticMoving ) { - - _panStart.copy( _panEnd ); - - } else { - - _panStart.add( mouseChange.subVectors( _panEnd, _panStart ).multiplyScalar( _this.dynamicDampingFactor ) ); - - } - - } - } - - }()); - - this.checkDistances = function () { - - if ( !_this.noZoom || !_this.noPan ) { - - if ( _eye.lengthSq() > _this.maxDistance * _this.maxDistance ) { - - _this.object.position.addVectors( _this.target, _eye.setLength( _this.maxDistance ) ); - - } - - if ( _eye.lengthSq() < _this.minDistance * _this.minDistance ) { - - _this.object.position.addVectors( _this.target, _eye.setLength( _this.minDistance ) ); - - } - - } - - }; - - this.update = function () { - - _eye.subVectors( _this.object.position, _this.target ); - - if ( !_this.noRotate ) { - - _this.rotateCamera(); - - } - - if ( !_this.noZoom ) { - - _this.zoomCamera(); - - } - - if ( !_this.noPan ) { - - _this.panCamera(); - - } - - _this.object.position.addVectors( _this.target, _eye ); - - _this.checkDistances(); - - _this.object.lookAt( _this.target ); - - if ( lastPosition.distanceToSquared( _this.object.position ) > 0 ) { - - _this.dispatchEvent( changeEvent ); - - lastPosition.copy( _this.object.position ); - - } - - }; - - this.reset = function () { - - _state = STATE.NONE; - _prevState = STATE.NONE; - - _this.target.copy( _this.target0 ); - _this.object.position.copy( _this.position0 ); - _this.object.up.copy( _this.up0 ); - - _eye.subVectors( _this.object.position, _this.target ); - - _this.object.lookAt( _this.target ); - - _this.dispatchEvent( changeEvent ); - - lastPosition.copy( _this.object.position ); - - }; - - // listeners - - function keydown( event ) { - - if ( _this.enabled === false ) return; - - window.removeEventListener( 'keydown', keydown ); - - _prevState = _state; - - if ( _state !== STATE.NONE ) { - - return; - - } else if ( event.keyCode === _this.keys[ STATE.ROTATE ] && !_this.noRotate ) { - - _state = STATE.ROTATE; - - } else if ( event.keyCode === _this.keys[ STATE.ZOOM ] && !_this.noZoom ) { - - _state = STATE.ZOOM; - - } else if ( event.keyCode === _this.keys[ STATE.PAN ] && !_this.noPan ) { - - _state = STATE.PAN; - - } - - } - - function keyup( event ) { - - if ( _this.enabled === false ) return; - - _state = _prevState; - - window.addEventListener( 'keydown', keydown, false ); - - } - - function mousedown( event ) { - - if ( _this.enabled === false ) return; - - event.preventDefault(); - event.stopPropagation(); - - if ( _state === STATE.NONE ) { - - _state = event.button; - - } - - if ( _state === STATE.ROTATE && !_this.noRotate ) { - - _rotateStart = _this.getMouseProjectionOnBall( event.pageX, event.pageY, _rotateStart ); - _rotateEnd.copy(_rotateStart) - - } else if ( _state === STATE.ZOOM && !_this.noZoom ) { - - _zoomStart = _this.getMouseOnScreen( event.pageX, event.pageY, _zoomStart ); - _zoomEnd.copy(_zoomStart); - - } else if ( _state === STATE.PAN && !_this.noPan ) { - - _panStart = _this.getMouseOnScreen( event.pageX, event.pageY, _panStart); - _panEnd.copy(_panStart) - - } - - document.addEventListener( 'mousemove', mousemove, false ); - document.addEventListener( 'mouseup', mouseup, false ); - _this.dispatchEvent( startEvent ); - - - } - - function mousemove( event ) { - - if ( _this.enabled === false ) return; - - event.preventDefault(); - event.stopPropagation(); - - if ( _state === STATE.ROTATE && !_this.noRotate ) { - - _rotateEnd = _this.getMouseProjectionOnBall( event.pageX, event.pageY, _rotateEnd ); - - } else if ( _state === STATE.ZOOM && !_this.noZoom ) { - - _zoomEnd = _this.getMouseOnScreen( event.pageX, event.pageY, _zoomEnd ); - - } else if ( _state === STATE.PAN && !_this.noPan ) { - - _panEnd = _this.getMouseOnScreen( event.pageX, event.pageY, _panEnd ); - - } - - } - - function mouseup( event ) { - - if ( _this.enabled === false ) return; - - event.preventDefault(); - event.stopPropagation(); - - _state = STATE.NONE; - - document.removeEventListener( 'mousemove', mousemove ); - document.removeEventListener( 'mouseup', mouseup ); - _this.dispatchEvent( endEvent ); - - } - - function mousewheel( event ) { - - if ( _this.enabled === false ) return; - - event.preventDefault(); - event.stopPropagation(); - - var delta = 0; - - if ( event.wheelDelta ) { // WebKit / Opera / Explorer 9 - - delta = event.wheelDelta / 40; - - } else if ( event.detail ) { // Firefox - - delta = - event.detail / 3; - - } - - _zoomStart.y += delta * 0.01; - _this.dispatchEvent( startEvent ); - _this.dispatchEvent( endEvent ); - - } - - function touchstart( event ) { - - if ( _this.enabled === false ) return; - - switch ( event.touches.length ) { - - case 1: - _state = STATE.TOUCH_ROTATE; - _rotateEnd.copy( _this.getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _rotateStart )); - break; - - case 2: - _state = STATE.TOUCH_ZOOM; - var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; - var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; - _touchZoomDistanceEnd = _touchZoomDistanceStart = Math.sqrt( dx * dx + dy * dy ); - break; - - case 3: - _state = STATE.TOUCH_PAN; - _panEnd.copy( _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _panStart )); - break; - - default: - _state = STATE.NONE; - - } - _this.dispatchEvent( startEvent ); - - - } - - function touchmove( event ) { - - if ( _this.enabled === false ) return; - - event.preventDefault(); - event.stopPropagation(); - - switch ( event.touches.length ) { - - case 1: - _rotateEnd = _this.getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _rotateEnd ); - break; - - case 2: - var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; - var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; - _touchZoomDistanceEnd = Math.sqrt( dx * dx + dy * dy ) - break; - - case 3: - _panEnd = _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _panEnd ); - break; - - default: - _state = STATE.NONE; - - } - - } - - function touchend( event ) { - - if ( _this.enabled === false ) return; - - switch ( event.touches.length ) { - - case 1: - _rotateStart.copy( _this.getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _rotateEnd )); - break; - - case 2: - _touchZoomDistanceStart = _touchZoomDistanceEnd = 0; - break; - - case 3: - _panStart.copy( _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _panEnd )); - break; - - } - - _state = STATE.NONE; - _this.dispatchEvent( endEvent ); - - } - - this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false ); - - this.domElement.addEventListener( 'mousedown', mousedown, false ); - - this.domElement.addEventListener( 'mousewheel', mousewheel, false ); - this.domElement.addEventListener( 'DOMMouseScroll', mousewheel, false ); // firefox - - this.domElement.addEventListener( 'touchstart', touchstart, false ); - this.domElement.addEventListener( 'touchend', touchend, false ); - this.domElement.addEventListener( 'touchmove', touchmove, false ); - - window.addEventListener( 'keydown', keydown, false ); - window.addEventListener( 'keyup', keyup, false ); - - this.handleResize(); - -}; - -THREE.TrackballControls.prototype = Object.create( THREE.EventDispatcher.prototype ); diff --git a/libs/plasio/vendor/jquery.js b/libs/plasio/vendor/jquery.js deleted file mode 100644 index c5c64825..00000000 --- a/libs/plasio/vendor/jquery.js +++ /dev/null @@ -1,9789 +0,0 @@ -/*! - * jQuery JavaScript Library v1.10.2 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-07-03T13:48Z - */ -(function( window, undefined ) { - -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -//"use strict"; -var - // The deferred used on DOM ready - readyList, - - // A central reference to the root jQuery(document) - rootjQuery, - - // Support: IE<10 - // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined` - core_strundefined = typeof undefined, - - // Use the correct document accordingly with window argument (sandbox) - location = window.location, - document = window.document, - docElem = document.documentElement, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "1.10.2", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - /* jshint eqeqeq: false */ - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - var key; - - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Support: IE<9 - // Handle iteration over inherited properties before own properties. - if ( jQuery.support.ownLast ) { - for ( key in obj ) { - return core_hasOwn.call( obj, key ); - } - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations. - // Note: this method belongs to the css module but it's needed here for the support module. - // If support gets modularized, this method should be moved back to the css module. - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -/*! - * Sizzle CSS Selector Engine v1.10.2 - * http://sizzlejs.com/ - * - * Copyright 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-07-03 - */ -(function( window, undefined ) { - -var i, - support, - cachedruns, - Expr, - getText, - isXML, - compile, - outermostContext, - sortInput, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - hasDuplicate = false, - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - return 0; - }, - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rsibling = new RegExp( whitespace + "*[+~]" ), - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( documentIsHTML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // QSA path - if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - nid = old = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = attrs.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.defaultView; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsHTML = !isXML( doc ); - - // Support: IE>8 - // If iframe document is assigned to "document" variable and if iframe has been reloaded, - // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 - // IE6-8 do not support the defaultView property so parent will be undefined - if ( parent && parent.attachEvent && parent !== parent.top ) { - parent.attachEvent( "onbeforeunload", function() { - setDocument(); - }); - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if getElementsByClassName can be trusted - support.getElementsByClassName = assert(function( div ) { - div.innerHTML = "<div class='a'></div><div class='a i'></div>"; - - // Support: Safari<4 - // Catch class over-caching - div.firstChild.className = "i"; - // Support: Opera<10 - // Catch gEBCN failure to find non-leading classes - return div.getElementsByClassName("i").length === 2; - }); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !doc.getElementsByName || !doc.getElementsByName( expando ).length; - }); - - // ID find and filter - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = "<select><option selected=''></option></select>"; - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Support: Opera 10-12/IE8 - // ^= $= *= and empty values - // Should not select anything - // Support: Windows 8 Native Apps - // The type attribute is restricted during .innerHTML assignment - var input = doc.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "t", "" ); - - if ( div.querySelectorAll("[t^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); - - if ( compare ) { - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === doc || contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } - - // Not directly comparable, sort on existence of method - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return doc; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val === undefined ? - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null : - val; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - } - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - !documentIsHTML, - results, - rsibling.test( selector ) - ); - return results; -} - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome<14 -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( div1 ) { - // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( document.createElement("div") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( div ) { - div.innerHTML = "<a href='#'></a>"; - return div.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = "<input/>"; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - elem[ name ] === true ? name.toLowerCase() : null; - } - }); -} - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - firingLength = 0; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( list && ( !fired || stack ) ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function( support ) { - - var all, a, input, select, fragment, opt, eventName, isSupported, i, - div = document.createElement("div"); - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; - - // Finish early in limited (non-browser) environments - all = div.getElementsByTagName("*") || []; - a = div.getElementsByTagName("a")[ 0 ]; - if ( !a || !a.style || !all.length ) { - return support; - } - - // First batch of tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - a.style.cssText = "top:1px;float:left;opacity:.5"; - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - support.getSetAttribute = div.className !== "t"; - - // IE strips leading whitespace when .innerHTML is used - support.leadingWhitespace = div.firstChild.nodeType === 3; - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - support.tbody = !div.getElementsByTagName("tbody").length; - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - support.htmlSerialize = !!div.getElementsByTagName("link").length; - - // Get the style information from getAttribute - // (IE uses .cssText instead) - support.style = /top/.test( a.getAttribute("style") ); - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - support.hrefNormalized = a.getAttribute("href") === "/a"; - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - support.opacity = /^0.5/.test( a.style.opacity ); - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - support.cssFloat = !!a.style.cssFloat; - - // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) - support.checkOn = !!input.value; - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - support.optSelected = opt.selected; - - // Tests for enctype support on a form (#6743) - support.enctype = !!document.createElement("form").enctype; - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>"; - - // Will be defined later - support.inlineBlockNeedsLayout = false; - support.shrinkWrapBlocks = false; - support.pixelPosition = false; - support.deleteExpando = true; - support.noCloneEvent = true; - support.reliableMarginRight = true; - support.boxSizingReliable = true; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Support: IE<9 - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - // Check if we can trust getAttribute("value") - input = document.createElement("input"); - input.setAttribute( "value", "" ); - support.input = input.getAttribute( "value" ) === ""; - - // Check if an input maintains its value after becoming a radio - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment = document.createDocumentFragment(); - fragment.appendChild( input ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) - for ( i in { submit: true, change: true, focusin: true }) { - div.setAttribute( eventName = "on" + i, "t" ); - - support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; - } - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Support: IE<9 - // Iteration over object's inherited properties before its own. - for ( i in jQuery( support ) ) { - break; - } - support.ownLast = i !== "0"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, tds, - divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - body.appendChild( container ).appendChild( div ); - - // Support: IE8 - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Support: IE8 - // Check if empty table cells still have offsetWidth/Height - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior. - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - - // Workaround failing boxSizing test due to offsetWidth returning wrong value - // with some non-1 values of body zoom, ticket #13543 - jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { - support.boxSizing = div.offsetWidth === 4; - }); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== core_strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Support: IE6 - // Check if elements with layout shrink-wrap their children - div.style.display = "block"; - div.innerHTML = "<div></div>"; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - if ( support.inlineBlockNeedsLayout ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); - - // Null elements to avoid leaks in IE - container = div = tds = marginDiv = null; - }); - - // Null elements to avoid leaks in IE - all = select = fragment = opt = a = input = null; - - return support; -})({}); - -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -function internalData( elem, name, data, pvt /* Internal Use Only */ ){ - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var ret, thisCache, - internalKey = jQuery.expando, - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - // Avoid exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( typeof name === "string" ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - i = name.length; - while ( i-- ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - /* jshint eqeqeq: false */ - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - /* jshint eqeqeq: true */ - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "applet": true, - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - // Do not set data on non-element because it will not be cleared (#8335). - if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { - return false; - } - - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var attrs, name, - data = null, - i = 0, - elem = this[0]; - - // Special expections of .data basically thwart jQuery.access, - // so implement the relevant behavior ourselves - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[i].name; - - if ( name.indexOf("data-") === 0 ) { - name = jQuery.camelCase( name.slice(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return arguments.length > 1 ? - - // Sets one value - this.each(function() { - jQuery.data( this, key, value ); - }) : - - // Gets one value - // Try to fetch any internally stored data first - elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, - rclass = /[\t\r\n\f]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button|object)$/i, - rclickable = /^(?:a|area)$/i, - ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - getSetInput = jQuery.support.input; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value; - - if ( typeof stateVal === "boolean" && type === "string" ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var ret, hooks, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // Use proper attribute retrieval(#6932, #12072) - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { - optionSet = true; - } - } - - // force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( jQuery.expr.match.bool.test( name ) ) { - // Set corresponding property to false - if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - elem[ propName ] = false; - // Support: IE<9 - // Also clear defaultChecked/defaultSelected (if appropriate) - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = - elem[ propName ] = false; - } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); - } - - elem.removeAttribute( getSetAttribute ? name : propName ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? - ret : - ( elem[ name ] = value ); - - } else { - return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? - ret : - elem[ name ]; - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - return tabindex ? - parseInt( tabindex, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - -1; - } - } - } -}); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); - - // Use defaultChecked and defaultSelected for oldIE - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; - } - - return name; - } -}; -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; - - jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? - function( elem, name, isXML ) { - var fn = jQuery.expr.attrHandle[ name ], - ret = isXML ? - undefined : - /* jshint eqeqeq: false */ - (jQuery.expr.attrHandle[ name ] = undefined) != - getter( elem, name, isXML ) ? - - name.toLowerCase() : - null; - jQuery.expr.attrHandle[ name ] = fn; - return ret; - } : - function( elem, name, isXML ) { - return isXML ? - undefined : - elem[ jQuery.camelCase( "default-" + name ) ] ? - name.toLowerCase() : - null; - }; -}); - -// fix oldIE attroperties -if ( !getSetInput || !getSetAttribute ) { - jQuery.attrHooks.value = { - set: function( elem, value, name ) { - if ( jQuery.nodeName( elem, "input" ) ) { - // Does not return so that setAttribute is also used - elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = { - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - return name === "value" || value === elem.getAttribute( name ) ? - value : - undefined; - } - }; - jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords = - // Some attributes are constructed with empty-string values when not defined - function( elem, name, isXML ) { - var ret; - return isXML ? - undefined : - (ret = elem.getAttributeNode( name )) && ret.value !== "" ? - ret.value : - null; - }; - jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return ret && ret.specified ? - ret.value : - undefined; - }, - set: nodeHook.set - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }; - }); -} - - -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !jQuery.support.hrefNormalized ) { - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Note: IE uppercases css property names, but if we were to .toLowerCase() - // .cssText, that would destroy case senstitivity in URL's, like in "background" - return elem.style.cssText || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }; -} - -jQuery.each([ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -}); - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }; - if ( !jQuery.support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - // Support: Webkit - // "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - }; - } -}); -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && - jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = core_slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG <use> instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - /* jshint eqeqeq: false */ - for ( ; cur != this; cur = cur.parentNode || this ) { - /* jshint eqeqeq: true */ - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === core_strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -var isSimple = /^.[^:#\[\.,]*$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, - ret = [], - self = this, - len = self.length; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); - }, - - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && (pos ? - pos.index(cur) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector(cur, selectors)) ) { - - cur = ret.push( cur ); - break; - } - } - } - - return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - if ( this.length > 1 ) { - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - ret = jQuery.unique( ret ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - })); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - }); - - } - - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - }); - - } - - if ( typeof qualifier === "string" ) { - if ( isSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); - } - - return jQuery.grep( elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /<tbody/i, - rhtml = /<|&#?\w+;/, - rnoInnerhtml = /<(?:script|style|link)/i, - manipulation_rcheckableType = /^(?:checkbox|radio)$/i, - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /^$|\/(?:java|ecma)script/i, - rscriptTypeMasked = /^true\/(.*)/, - rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "<select multiple='multiple'>", "</select>" ], - legend: [ 1, "<fieldset>", "</fieldset>" ], - area: [ 1, "<map>", "</map>" ], - param: [ 1, "<object>", "</object>" ], - thead: [ 1, "<table>", "</table>" ], - tr: [ 2, "<table><tbody>", "</tbody></table>" ], - col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], - td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1></$2>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var - // Snapshot the DOM in case .domManip sweeps something relevant into its fragment - args = jQuery.map( this, function( elem ) { - return [ elem.nextSibling, elem.parentNode ]; - }), - i = 0; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - var next = args[ i++ ], - parent = args[ i++ ]; - - if ( parent ) { - // Don't use the snapshot next if it has moved (#13810) - if ( next && next.parentNode !== parent ) { - next = this.nextSibling; - } - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - // Allow new content to include elements from the context set - }, true ); - - // Force removal if there was no new content (e.g., from empty arguments) - return i ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback, allowIntersection ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, self.html() ); - } - self.domManip( args, callback, allowIntersection ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[i], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery._evalUrl( node.src ); - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -// Support: IE<8 -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( manipulation_rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted <tbody> from table fragments - if ( !jQuery.support.tbody ) { - - // String was a <table>, *may* have spurious <tbody> - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare <thead> or <tfoot> - wrap[1] === "<table>" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== core_strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - core_deletedIds.push( id ); - } - } - } - } - }, - - _evalUrl: function( url ) { - return jQuery.ajax({ - url: url, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } -}); -jQuery.fn.extend({ - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - } -}); -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each(function() { - if ( isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery("<iframe frameborder='0' width='0' height='0'/>") - .css( "cssText", "display:block !important" ) - ).appendTo( doc.documentElement ); - - // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse - doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document; - doc.write("<!doctype html><html><body>"); - doc.close(); - - display = actualDisplay( nodeName, doc ); - iframe.detach(); - } - - // Store the correct default display - elemdisplay[ nodeName ] = display; - } - - return display; -} - -// Called ONLY from within css_defaultDisplay -function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - display = jQuery.css( elem[0], "display" ); - elem.remove(); - return display; -} - -jQuery.each([ "height", "width" ], function( i, name ) { - jQuery.cssHooks[ name ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - // certain elements can have dimension info if we invisibly show them - // however, it must have a current display style that would benefit from this - return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? - jQuery.swap( elem, cssShow, function() { - return getWidthOrHeight( elem, name, extra ); - }) : - getWidthOrHeight( elem, name, extra ); - } - }, - - set: function( elem, value, extra ) { - var styles = extra && getStyles( elem ); - return setPositiveNumber( elem, value, extra ? - augmentWidthOrHeight( - elem, - name, - extra, - jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - styles - ) : 0 - ); - } - }; -}); - -if ( !jQuery.support.opacity ) { - jQuery.cssHooks.opacity = { - get: function( elem, computed ) { - // IE uses filters for opacity - return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? - ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : - computed ? "1" : ""; - }, - - set: function( elem, value ) { - var style = elem.style, - currentStyle = elem.currentStyle, - opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", - filter = currentStyle && currentStyle.filter || style.filter || ""; - - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; - - // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 - // if value === "", then remove inline opacity #12685 - if ( ( value >= 1 || value === "" ) && - jQuery.trim( filter.replace( ralpha, "" ) ) === "" && - style.removeAttribute ) { - - // Setting style.filter to null, "" & " " still leave "filter:" in the cssText - // if "filter:" is present at all, clearType is disabled, we want to avoid this - // style.removeAttribute is IE Only, but so apparently is this code path... - style.removeAttribute( "filter" ); - - // if there is no filter style applied in a css rule or unset inline opacity, we are done - if ( value === "" || currentStyle && !currentStyle.filter ) { - return; - } - } - - // otherwise, set new filter values - style.filter = ralpha.test( filter ) ? - filter.replace( ralpha, opacity ) : - filter + " " + opacity; - } - }; -} - -// These hooks cannot be added until DOM ready because the support test -// for it is not run until after DOM ready -jQuery(function() { - if ( !jQuery.support.reliableMarginRight ) { - jQuery.cssHooks.marginRight = { - get: function( elem, computed ) { - if ( computed ) { - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // Work around by temporarily setting element display to inline-block - return jQuery.swap( elem, { "display": "inline-block" }, - curCSS, [ elem, "marginRight" ] ); - } - } - }; - } - - // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 - // getComputedStyle returns percent when specified for top/left/bottom/right - // rather than make the css module depend on the offset module, we just check for it here - if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { - jQuery.each( [ "top", "left" ], function( i, prop ) { - jQuery.cssHooks[ prop ] = { - get: function( elem, computed ) { - if ( computed ) { - computed = curCSS( elem, prop ); - // if curCSS returns percentage, fallback to offset - return rnumnonpx.test( computed ) ? - jQuery( elem ).position()[ prop ] + "px" : - computed; - } - } - }; - }); - } - -}); - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.hidden = function( elem ) { - // Support: Opera <= 12.12 - // Opera reports offsetWidths and offsetHeights less than zero on some elements - return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || - (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); - }; - - jQuery.expr.filters.visible = function( elem ) { - return !jQuery.expr.filters.hidden( elem ); - }; -} - -// These hooks are used by animate to expand properties -jQuery.each({ - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // assumes a single number if not a string - parts = typeof value === "string" ? value.split(" ") : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( !rmargin.test( prefix ) ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -}); -var r20 = /%20/g, - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -jQuery.fn.extend({ - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map(function(){ - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - }) - .filter(function(){ - var type = this.type; - // Use .is(":disabled") so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !manipulation_rcheckableType.test( type ) ); - }) - .map(function( i, elem ){ - var val = jQuery( this ).val(); - - return val == null ? - null : - jQuery.isArray( val ) ? - jQuery.map( val, function( val ){ - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }) : - { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }).get(); - } -}); - -//Serialize an array of form elements or a set of -//key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); - s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); - }; - - // Set traditional to true for jQuery <= 1.3.2 behavior. - if ( traditional === undefined ) { - traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - }); - - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ).replace( r20, "+" ); -}; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( jQuery.isArray( obj ) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - // Item is non-scalar (array or object), encode its numeric index. - buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); - } - }); - - } else if ( !traditional && jQuery.type( obj ) === "object" ) { - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - // Serialize scalar item. - add( prefix, obj ); - } -} -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; -}); - -jQuery.fn.extend({ - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); - } -}); -var - // Document location - ajaxLocParts, - ajaxLocation, - ajax_nonce = jQuery.now(), - - ajax_rquery = /\?/, - rhash = /#.*$/, - rts = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, - - // Keep a copy of the old load method - _load = jQuery.fn.load, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat("*"); - -// #8138, IE may throw an exception when accessing -// a field from window.location if document.domain has been set -try { - ajaxLocation = location.href; -} catch( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement( "a" ); - ajaxLocation.href = ""; - ajaxLocation = ajaxLocation.href; -} - -// Segment location into parts -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; - - if ( jQuery.isFunction( func ) ) { - // For each dataType in the dataTypeExpression - while ( (dataType = dataTypes[i++]) ) { - // Prepend if requested - if ( dataType[0] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); - - // Otherwise append - } else { - (structure[ dataType ] = structure[ dataType ] || []).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - }); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var deep, key, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -jQuery.fn.load = function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); - } - - var selector, response, type, - self = this, - off = url.indexOf(" "); - - if ( off >= 0 ) { - selector = url.slice( off, url.length ); - url = url.slice( 0, off ); - } - - // If it's a function - if ( jQuery.isFunction( params ) ) { - - // We assume that it's the callback - callback = params; - params = undefined; - - // Otherwise, build a param string - } else if ( params && typeof params === "object" ) { - type = "POST"; - } - - // If we have elements to modify, make the request - if ( self.length > 0 ) { - jQuery.ajax({ - url: url, - - // if "type" variable is undefined, then "GET" method will be used - type: type, - dataType: "html", - data: params - }).done(function( responseText ) { - - // Save response for use in complete callback - response = arguments; - - self.html( selector ? - - // If a selector was specified, locate the right elements in a dummy div - // Exclude scripts to avoid IE 'Permission Denied' errors - jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : - - // Otherwise use the full result - responseText ); - - }).complete( callback && function( jqXHR, status ) { - self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); - }); - } - - return this; -}; - -// Attach a bunch of functions for handling common AJAX events -jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){ - jQuery.fn[ type ] = function( fn ){ - return this.on( type, fn ); - }; -}); - -jQuery.extend({ - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: ajaxLocation, - type: "GET", - isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /xml/, - html: /html/, - json: /json/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": jQuery.parseJSON, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var // Cross-domain detection vars - parts, - // Loop variable - i, - // URL without anti-cache param - cacheURL, - // Response headers as string - responseHeadersString, - // timeout handle - timeoutTimer, - - // To know if global events are to be dispatched - fireGlobals, - - transport, - // Response headers - responseHeaders, - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - // Callbacks context - callbackContext = s.context || s, - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks("once memory"), - // Status-dependent callbacks - statusCode = s.statusCode || {}, - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - // The jqXHR state - state = 0, - // Default abort message - strAbort = "canceled", - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( state === 2 ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( (match = rheaders.exec( responseHeadersString )) ) { - responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match == null ? null : match; - }, - - // Raw string - getAllResponseHeaders: function() { - return state === 2 ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - var lname = name.toLowerCase(); - if ( !state ) { - name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( !state ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( state < 2 ) { - for ( code in map ) { - // Lazy-add the new callback in a way that preserves old ones - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } else { - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ).complete = completeDeferred.add; - jqXHR.success = jqXHR.done; - jqXHR.error = jqXHR.fail; - - // Remove hash character (#7531: and string promotion) - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""]; - - // A cross-domain request is in order when we have a protocol:host:port mismatch - if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ); - s.crossDomain = !!( parts && - ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || - ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== - ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) - ); - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( state === 2 ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - fireGlobals = s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger("ajaxStart"); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - cacheURL = s.url; - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // If data is available, append data to url - if ( s.data ) { - cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add anti-cache in url if needed - if ( s.cache === false ) { - s.url = rts.test( cacheURL ) ? - - // If there is already a '_' parameter, set its value - cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) : - - // Otherwise add one to the end - cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++; - } - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { - // Abort if not done already and return - return jqXHR.abort(); - } - - // aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - for ( i in { success: 1, error: 1, complete: 1 } ) { - jqXHR[ i ]( s[ i ] ); - } - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = setTimeout(function() { - jqXHR.abort("timeout"); - }, s.timeout ); - } - - try { - state = 1; - transport.send( requestHeaders, done ); - } catch ( e ) { - // Propagate exception as error if not done - if ( state < 2 ) { - done( -1, e ); - // Simply rethrow otherwise - } else { - throw e; - } - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Called once - if ( state === 2 ) { - return; - } - - // State is "done" now - state = 2; - - // Clear timeout if it exists - if ( timeoutTimer ) { - clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader("Last-Modified"); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader("etag"); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - // We extract error from statusText - // then normalize statusText and status for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger("ajaxStop"); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -}); - -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - // shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - return jQuery.ajax({ - url: url, - type: method, - dataType: type, - data: data, - success: callback - }); - }; -}); - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - var firstDataType, ct, finalDataType, type, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s[ "throws" ] ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} -// Install script dataType -jQuery.ajaxSetup({ - accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /(?:java|ecma)script/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -}); - -// Handle cache's special case and global -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; - } -}); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function(s) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - - var script, - head = document.head || jQuery("head")[0] || document.documentElement; - - return { - - send: function( _, callback ) { - - script = document.createElement("script"); - - script.async = true; - - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - script.src = s.url; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { - - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - - // Remove the script - if ( script.parentNode ) { - script.parentNode.removeChild( script ); - } - - // Dereference the script - script = null; - - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - - // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending - // Use native DOM manipulation to avoid our domManip AJAX trickery - head.insertBefore( script, head.firstChild ); - }, - - abort: function() { - if ( script ) { - script.onload( undefined, true ); - } - } - }; - } -}); -var oldCallbacks = [], - rjsonp = /(=)\?(?=&|$)|\?\?/; - -// Default jsonp settings -jQuery.ajaxSetup({ - jsonp: "callback", - jsonpCallback: function() { - var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) ); - this[ callback ] = true; - return callback; - } -}); - -// Detect, normalize options and install callbacks for jsonp requests -jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - - var callbackName, overwritten, responseContainer, - jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? - "url" : - typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" - ); - - // Handle iff the expected data type is "jsonp" or we have a parameter to set - if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { - - // Get callback name, remembering preexisting value associated with it - callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? - s.jsonpCallback() : - s.jsonpCallback; - - // Insert callback into url or form data - if ( jsonProp ) { - s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); - } else if ( s.jsonp !== false ) { - s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; - } - - // Use data converter to retrieve json after script execution - s.converters["script json"] = function() { - if ( !responseContainer ) { - jQuery.error( callbackName + " was not called" ); - } - return responseContainer[ 0 ]; - }; - - // force json dataType - s.dataTypes[ 0 ] = "json"; - - // Install callback - overwritten = window[ callbackName ]; - window[ callbackName ] = function() { - responseContainer = arguments; - }; - - // Clean-up function (fires after converters) - jqXHR.always(function() { - // Restore preexisting value - window[ callbackName ] = overwritten; - - // Save back as free - if ( s[ callbackName ] ) { - // make sure that re-using the options doesn't screw things around - s.jsonpCallback = originalSettings.jsonpCallback; - - // save the callback name for future use - oldCallbacks.push( callbackName ); - } - - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( overwritten ) ) { - overwritten( responseContainer[ 0 ] ); - } - - responseContainer = overwritten = undefined; - }); - - // Delegate to script - return "script"; - } -}); -var xhrCallbacks, xhrSupported, - xhrId = 0, - // #5280: Internet Explorer will keep connections alive if we don't abort on unload - xhrOnUnloadAbort = window.ActiveXObject && function() { - // Abort all pending requests - var key; - for ( key in xhrCallbacks ) { - xhrCallbacks[ key ]( undefined, true ); - } - }; - -// Functions to create xhrs -function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch( e ) {} -} - -function createActiveXHR() { - try { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } catch( e ) {} -} - -// Create the request object -// (This is still attached to ajaxSettings for backward compatibility) -jQuery.ajaxSettings.xhr = window.ActiveXObject ? - /* Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ - function() { - return !this.isLocal && createStandardXHR() || createActiveXHR(); - } : - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; - -// Determine support properties -xhrSupported = jQuery.ajaxSettings.xhr(); -jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -xhrSupported = jQuery.support.ajax = !!xhrSupported; - -// Create transport if the browser can provide an xhr -if ( xhrSupported ) { - - jQuery.ajaxTransport(function( s ) { - // Cross domain only allowed if supported through XMLHttpRequest - if ( !s.crossDomain || jQuery.support.cors ) { - - var callback; - - return { - send: function( headers, complete ) { - - // Get a new xhr - var handle, i, - xhr = s.xhr(); - - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open( s.type, s.url, s.async, s.username, s.password ); - } else { - xhr.open( s.type, s.url, s.async ); - } - - // Apply custom fields if provided - if ( s.xhrFields ) { - for ( i in s.xhrFields ) { - xhr[ i ] = s.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( s.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( s.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !s.crossDomain && !headers["X-Requested-With"] ) { - headers["X-Requested-With"] = "XMLHttpRequest"; - } - - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - } catch( err ) {} - - // Do send the request - // This may raise an exception which is actually - // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( s.hasContent && s.data ) || null ); - - // Listener - callback = function( _, isAbort ) { - var status, responseHeaders, statusText, responses; - - // Firefox throws exceptions when accessing properties - // of an xhr when a network error occurred - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) - try { - - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - - // Only called once - callback = undefined; - - // Do not keep as active anymore - if ( handle ) { - xhr.onreadystatechange = jQuery.noop; - if ( xhrOnUnloadAbort ) { - delete xhrCallbacks[ handle ]; - } - } - - // If it's an abort - if ( isAbort ) { - // Abort it manually if needed - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - responses = {}; - status = xhr.status; - responseHeaders = xhr.getAllResponseHeaders(); - - // When requesting binary data, IE6-9 will throw an exception - // on any attempt to access responseText (#11426) - if ( typeof xhr.responseText === "string" ) { - responses.text = xhr.responseText; - } - - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch( e ) { - // We normalize with Webkit giving an empty statusText - statusText = ""; - } - - // Filter status for non standard behaviors - - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && s.isLocal && !s.crossDomain ) { - status = responses.text ? 200 : 404; - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } - } - } - } catch( firefoxAccessException ) { - if ( !isAbort ) { - complete( -1, firefoxAccessException ); - } - } - - // Call complete if needed - if ( responses ) { - complete( status, statusText, responses, responseHeaders ); - } - }; - - if ( !s.async ) { - // if we're in sync mode we fire the callback - callback(); - } else if ( xhr.readyState === 4 ) { - // (IE6 & IE7) if it's in cache and has been - // retrieved directly we need to fire the callback - setTimeout( callback ); - } else { - handle = ++xhrId; - if ( xhrOnUnloadAbort ) { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - jQuery( window ).unload( xhrOnUnloadAbort ); - } - // Add to list of active xhrs callbacks - xhrCallbacks[ handle ] = callback; - } - xhr.onreadystatechange = callback; - } - }, - - abort: function() { - if ( callback ) { - callback( undefined, true ); - } - } - }; - } - }); -} -var fxNow, timerId, - rfxtypes = /^(?:toggle|show|hide)$/, - rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), - rrun = /queueHooks$/, - animationPrefilters = [ defaultPrefilter ], - tweeners = { - "*": [function( prop, value ) { - var tween = this.createTween( prop, value ), - target = tween.cur(), - parts = rfxnum.exec( value ), - unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && - rfxnum.exec( jQuery.css( tween.elem, prop ) ), - scale = 1, - maxIterations = 20; - - if ( start && start[ 3 ] !== unit ) { - // Trust units reported by jQuery.css - unit = unit || start[ 3 ]; - - // Make sure we update the tween properties later on - parts = parts || []; - - // Iteratively approximate from a nonzero starting point - start = +target || 1; - - do { - // If previous iteration zeroed out, double until we get *something* - // Use a string for doubling factor so we don't accidentally see scale as unchanged below - scale = scale || ".5"; - - // Adjust and apply - start = start / scale; - jQuery.style( tween.elem, prop, start + unit ); - - // Update scale, tolerating zero or NaN from tween.cur() - // And breaking the loop if scale is unchanged or perfect, or if we've just had enough - } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); - } - - // Update tween properties - if ( parts ) { - start = tween.start = +start || +target || 0; - tween.unit = unit; - // If a +=/-= token was provided, we're doing a relative animation - tween.end = parts[ 1 ] ? - start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : - +parts[ 2 ]; - } - - return tween; - }] - }; - -// Animations created synchronously will run synchronously -function createFxNow() { - setTimeout(function() { - fxNow = undefined; - }); - return ( fxNow = jQuery.now() ); -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( (tween = collection[ index ].call( animation, prop, value )) ) { - - // we're done with this property - return tween; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = animationPrefilters.length, - deferred = jQuery.Deferred().always( function() { - // don't match elem in the :animated selector - delete tick.elem; - }), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ]); - - if ( percent < 1 && length ) { - return remaining; - } else { - deferred.resolveWith( elem, [ animation ] ); - return false; - } - }, - animation = deferred.promise({ - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { specialEasing: {} }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - // if we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // resolve when we played the last frame - // otherwise, reject - if ( gotoEnd ) { - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - }), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length ; index++ ) { - result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( jQuery.isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - }) - ); - - // attach callbacks from options - return animation.progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = jQuery.camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( jQuery.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // not quite $.extend, this wont overwrite keys already present. - // also - reusing 'index' from above because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweener: function( props, callback ) { - if ( jQuery.isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.split(" "); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length ; index++ ) { - prop = props[ index ]; - tweeners[ prop ] = tweeners[ prop ] || []; - tweeners[ prop ].unshift( callback ); - } - }, - - prefilter: function( callback, prepend ) { - if ( prepend ) { - animationPrefilters.unshift( callback ); - } else { - animationPrefilters.push( callback ); - } - } -}); - -function defaultPrefilter( elem, props, opts ) { - /* jshint validthis: true */ - var prop, value, toggle, tween, hooks, oldfire, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHidden( elem ), - dataShow = jQuery._data( elem, "fxshow" ); - - // handle queue: false promises - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always(function() { - // doing this makes sure that the complete handler will be called - // before this completes - anim.always(function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - }); - }); - } - - // height/width overflow pass - if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { - // Make sure that nothing sneaks out - // Record all 3 overflow attributes because IE does not - // change the overflow attribute when overflowX and - // overflowY are set to the same value - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Set display property to inline-block for height/width - // animations on inline elements that are having width/height animated - if ( jQuery.css( elem, "display" ) === "inline" && - jQuery.css( elem, "float" ) === "none" ) { - - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { - style.display = "inline-block"; - - } else { - style.zoom = 1; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - if ( !jQuery.support.shrinkWrapBlocks ) { - anim.always(function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - }); - } - } - - - // show/hide pass - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.exec( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - continue; - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - if ( !jQuery.isEmptyObject( orig ) ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = jQuery._data( elem, "fxshow", {} ); - } - - // store state if its toggle - enables .stop().toggle() to "reverse" - if ( toggle ) { - dataShow.hidden = !hidden; - } - if ( hidden ) { - jQuery( elem ).show(); - } else { - anim.done(function() { - jQuery( elem ).hide(); - }); - } - anim.done(function() { - var prop; - jQuery._removeData( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - }); - for ( prop in orig ) { - tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = tween.start; - if ( hidden ) { - tween.end = tween.start; - tween.start = prop === "width" || prop === "height" ? 1 : 0; - } - } - } - } -} - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || "swing"; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - if ( tween.elem[ tween.prop ] != null && - (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { - return tween.elem[ tween.prop ]; - } - - // passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails - // so, simple values such as "10px" are parsed to Float. - // complex values such as "rotate(1rad)" are returned as is. - result = jQuery.css( tween.elem, tween.prop, "" ); - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - // use step hook for back compat - use cssHook if its there - use .style if its - // available and use plain properties where available - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 -// Panic based approach to setting things on disconnected nodes - -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -}); - -jQuery.fn.extend({ - fadeTo: function( speed, to, easing, callback ) { - - // show any hidden elements after setting opacity to 0 - return this.filter( isHidden ).css( "opacity", 0 ).show() - - // animate to the value specified - .end().animate({ opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || jQuery._data( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } - - return this.each(function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = jQuery._data( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // start the next in the queue if the last step wasn't forced - // timers currently will call their complete callbacks, which will dequeue - // but only if they were gotoEnd - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - }); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each(function() { - var index, - data = jQuery._data( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // enable finishing flag on private data - data.finish = true; - - // empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // turn off finishing flag - delete data.finish; - }); - } -}); - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - attrs = { height: type }, - i = 0; - - // if we include width, step value is 1 to do all cssExpand values, - // if we don't include width, step value is 2 to skip over Left and Right - includeWidth = includeWidth? 1 : 0; - for( ; i < 4 ; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -// Generate shortcuts for custom animations -jQuery.each({ - slideDown: genFx("show"), - slideUp: genFx("hide"), - slideToggle: genFx("toggle"), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -}); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing - }; - - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; - - // normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p*Math.PI ) / 2; - } -}; - -jQuery.timers = []; -jQuery.fx = Tween.prototype.init; -jQuery.fx.tick = function() { - var timer, - timers = jQuery.timers, - i = 0; - - fxNow = jQuery.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - // Checks the timer has not already been removed - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - if ( timer() && jQuery.timers.push( timer ) ) { - jQuery.fx.start(); - } -}; - -jQuery.fx.interval = 13; - -jQuery.fx.start = function() { - if ( !timerId ) { - timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); - } -}; - -jQuery.fx.stop = function() { - clearInterval( timerId ); - timerId = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - // Default speed - _default: 400 -}; - -// Back Compat <1.8 extension point -jQuery.fx.step = {}; - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function( elem ) { - return jQuery.grep(jQuery.timers, function( fn ) { - return elem === fn.elem; - }).length; - }; -} -jQuery.fn.offset = function( options ) { - if ( arguments.length ) { - return options === undefined ? - this : - this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } - - var docElem, win, - box = { top: 0, left: 0 }, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; - - if ( !doc ) { - return; - } - - docElem = doc.documentElement; - - // Make sure it's not a disconnected DOM node - if ( !jQuery.contains( docElem, elem ) ) { - return box; - } - - // If we don't have gBCR, just use 0,0 rather than error - // BlackBerry 5, iOS 3 (original iPhone) - if ( typeof elem.getBoundingClientRect !== core_strundefined ) { - box = elem.getBoundingClientRect(); - } - win = getWindow( doc ); - return { - top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), - left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) - }; -}; - -jQuery.offset = { - - setOffset: function( elem, options, i ) { - var position = jQuery.css( elem, "position" ); - - // set position first, in-case top/left are set even on static elem - if ( position === "static" ) { - elem.style.position = "relative"; - } - - var curElem = jQuery( elem ), - curOffset = curElem.offset(), - curCSSTop = jQuery.css( elem, "top" ), - curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, - props = {}, curPosition = {}, curTop, curLeft; - - // need to be able to calculate position if either top or left is auto and position is either absolute or fixed - if ( calculatePosition ) { - curPosition = curElem.position(); - curTop = curPosition.top; - curLeft = curPosition.left; - } else { - curTop = parseFloat( curCSSTop ) || 0; - curLeft = parseFloat( curCSSLeft ) || 0; - } - - if ( jQuery.isFunction( options ) ) { - options = options.call( elem, i, curOffset ); - } - - if ( options.top != null ) { - props.top = ( options.top - curOffset.top ) + curTop; - } - if ( options.left != null ) { - props.left = ( options.left - curOffset.left ) + curLeft; - } - - if ( "using" in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - } -}; - - -jQuery.fn.extend({ - - position: function() { - if ( !this[ 0 ] ) { - return; - } - - var offsetParent, offset, - parentOffset = { top: 0, left: 0 }, - elem = this[ 0 ]; - - // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent - if ( jQuery.css( elem, "position" ) === "fixed" ) { - // we assume that getBoundingClientRect is available when computed position is fixed - offset = elem.getBoundingClientRect(); - } else { - // Get *real* offsetParent - offsetParent = this.offsetParent(); - - // Get correct offsets - offset = this.offset(); - if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { - parentOffset = offsetParent.offset(); - } - - // Add offsetParent borders - parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); - parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); - } - - // Subtract parent offsets and element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - return { - top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), - left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) - }; - }, - - offsetParent: function() { - return this.map(function() { - var offsetParent = this.offsetParent || docElem; - while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) { - offsetParent = offsetParent.offsetParent; - } - return offsetParent || docElem; - }); - } -}); - - -// Create scrollLeft and scrollTop methods -jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { - var top = /Y/.test( prop ); - - jQuery.fn[ method ] = function( val ) { - return jQuery.access( this, function( elem, method, val ) { - var win = getWindow( elem ); - - if ( val === undefined ) { - return win ? (prop in win) ? win[ prop ] : - win.document.documentElement[ method ] : - elem[ method ]; - } - - if ( win ) { - win.scrollTo( - !top ? val : jQuery( win ).scrollLeft(), - top ? val : jQuery( win ).scrollTop() - ); - - } else { - elem[ method ] = val; - } - }, method, val, arguments.length, null ); - }; -}); - -function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; -} -// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods -jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { - jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { - // margin is only for outerHeight, outerWidth - jQuery.fn[ funcName ] = function( margin, value ) { - var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), - extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); - - return jQuery.access( this, function( elem, type, value ) { - var doc; - - if ( jQuery.isWindow( elem ) ) { - // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there - // isn't a whole lot we can do. See pull request at this URL for discussion: - // https://github.com/jquery/jquery/pull/764 - return elem.document.documentElement[ "client" + name ]; - } - - // Get document width or height - if ( elem.nodeType === 9 ) { - doc = elem.documentElement; - - // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest - // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. - return Math.max( - elem.body[ "scroll" + name ], doc[ "scroll" + name ], - elem.body[ "offset" + name ], doc[ "offset" + name ], - doc[ "client" + name ] - ); - } - - return value === undefined ? - // Get width or height on the element, requesting but not forcing parseFloat - jQuery.css( elem, type, extra ) : - - // Set width or height on the element - jQuery.style( elem, type, value, extra ); - }, type, chainable ? margin : undefined, chainable, null ); - }; - }); -}); -// Limit scope pollution from any deprecated API -// (function() { - -// The number of elements contained in the matched element set -jQuery.fn.size = function() { - return this.length; -}; - -jQuery.fn.andSelf = jQuery.fn.addBack; - -// })(); -if ( typeof module === "object" && module && typeof module.exports === "object" ) { - // Expose jQuery as module.exports in loaders that implement the Node - // module pattern (including browserify). Do not create the global, since - // the user will be storing it themselves locally, and globals are frowned - // upon in the Node module world. - module.exports = jQuery; -} else { - // Otherwise expose jQuery to the global object as usual - window.jQuery = window.$ = jQuery; - - // Register as a named AMD module, since jQuery can be concatenated with other - // files that may use define, but not via a proper concatenation script that - // understands anonymous AMD modules. A named AMD is safest and most robust - // way to register. Lowercase jquery is used because AMD module names are - // derived from file names, and jQuery is normally delivered in a lowercase - // file name. Do this after creating the global so that if an AMD module wants - // to call noConflict to hide this version of jQuery, it will work. - if ( typeof define === "function" && define.amd ) { - define( "jquery", [], function () { return jQuery; } ); - } -} - -})( window ); diff --git a/libs/plasio/vendor/jquery.layout.js b/libs/plasio/vendor/jquery.layout.js deleted file mode 100644 index 3f0dfea4..00000000 --- a/libs/plasio/vendor/jquery.layout.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - jquery.layout 1.3.0 - Release Candidate 30.79 - $Date: 2013-01-01 08:00:00 (Tue, 1 Jan 2013) $ - $Rev: 303007 $ - - Copyright (c) 2013 Kevin Dalman (http://allpro.net) - Based on work by Fabrizio Balliano (http://www.fabrizioballiano.net) - - Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) - and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. - - SEE: http://layout.jquery-dev.net/LICENSE.txt - - Changelog: http://layout.jquery-dev.net/changelog.cfm#1.3.0.rc30.79 - - Docs: http://layout.jquery-dev.net/documentation.html - Tips: http://layout.jquery-dev.net/tips.html - Help: http://groups.google.com/group/jquery-ui-layout -*/ -(function(b){var a=Math.min,d=Math.max,c=Math.floor,f=function(a){return"string"===b.type(a)},j=function(a,d){if(b.isArray(d))for(var c=0,j=d.length;c<j;c++){var h=d[c];try{f(h)&&(h=eval(h)),b.isFunction(h)&&h(a)}catch(k){}}};b.layout={version:"1.3.rc30.79",revision:0.033007,browser:{},effects:{slide:{all:{duration:"fast"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},drop:{all:{duration:"slow"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"}, -west:{direction:"left"}},scale:{all:{duration:"fast"}},blind:{},clip:{},explode:{},fade:{},fold:{},puff:{},size:{all:{easing:"swing"}}},config:{optionRootKeys:"effects panes north south west east center".split(" "),allPanes:["north","south","west","east","center"],borderPanes:["north","south","west","east"],oppositeEdge:{north:"south",south:"north",east:"west",west:"east"},offscreenCSS:{left:"-99999px",right:"auto"},offscreenReset:"offscreenReset",hidden:{visibility:"hidden"},visible:{visibility:"visible"}, -resizers:{cssReq:{position:"absolute",padding:0,margin:0,fontSize:"1px",textAlign:"left",overflow:"hidden"},cssDemo:{background:"#DDD",border:"none"}},togglers:{cssReq:{position:"absolute",display:"block",padding:0,margin:0,overflow:"hidden",textAlign:"center",fontSize:"1px",cursor:"pointer",zIndex:1},cssDemo:{background:"#AAA"}},content:{cssReq:{position:"relative"},cssDemo:{overflow:"auto",padding:"10px"},cssDemoPane:{overflow:"hidden",padding:0}},panes:{cssReq:{position:"absolute",margin:0},cssDemo:{padding:"10px", -background:"#FFF",border:"1px solid #BBB",overflow:"auto"}},north:{side:"top",sizeType:"Height",dir:"horz",cssReq:{top:0,bottom:"auto",left:0,right:0,width:"auto"}},south:{side:"bottom",sizeType:"Height",dir:"horz",cssReq:{top:"auto",bottom:0,left:0,right:0,width:"auto"}},east:{side:"right",sizeType:"Width",dir:"vert",cssReq:{left:"auto",right:0,top:"auto",bottom:"auto",height:"auto"}},west:{side:"left",sizeType:"Width",dir:"vert",cssReq:{left:0,right:"auto",top:"auto",bottom:"auto",height:"auto"}}, -center:{dir:"center",cssReq:{left:"auto",right:"auto",top:"auto",bottom:"auto",height:"auto",width:"auto"}}},callbacks:{},getParentPaneElem:function(a){a=b(a);if(a=a.data("layout")||a.data("parentLayout")){a=a.container;if(a.data("layoutPane"))return a;a=a.closest("."+b.layout.defaults.panes.paneClass);if(a.data("layoutPane"))return a}return null},getParentPaneInstance:function(a){return(a=b.layout.getParentPaneElem(a))?a.data("layoutPane"):null},getParentLayoutInstance:function(a){return(a=b.layout.getParentPaneElem(a))? -a.data("parentLayout"):null},getEventObject:function(b){return"object"===typeof b&&b.stopPropagation?b:null},parsePaneName:function(a){var d=b.layout.getEventObject(a);d&&(d.stopPropagation(),a=b(this).data("layoutEdge"));a&&!/^(west|east|north|south|center)$/.test(a)&&(b.layout.msg('LAYOUT ERROR - Invalid pane-name: "'+a+'"'),a="error");return a},plugins:{draggable:!!b.fn.draggable,effects:{core:!!b.effects,slide:b.effects&&(b.effects.slide||b.effects.effect&&b.effects.effect.slide)}},onCreate:[], -onLoad:[],onReady:[],onDestroy:[],onUnload:[],afterOpen:[],afterClose:[],scrollbarWidth:function(){return window.scrollbarWidth||b.layout.getScrollbarSize("width")},scrollbarHeight:function(){return window.scrollbarHeight||b.layout.getScrollbarSize("height")},getScrollbarSize:function(a){var d=b('<div style="position: absolute; top: -10000px; left: -10000px; width: 100px; height: 100px; overflow: scroll;"></div>').appendTo("body"),c={width:d.css("width")-d[0].clientWidth,height:d.height()-d[0].clientHeight}; -d.remove();window.scrollbarWidth=c.width;window.scrollbarHeight=c.height;return a.match(/^(width|height)$/)?c[a]:c},showInvisibly:function(b,a){if(b&&b.length&&(a||"none"===b.css("display"))){var d=b[0].style,d={display:d.display||"",visibility:d.visibility||""};b.css({display:"block",visibility:"hidden"});return d}return{}},getElementDimensions:function(a,c){var f={css:{},inset:{}},j=f.css,h={bottom:0},k=b.layout.cssNum,p=a.offset(),O,R,D;f.offsetLeft=p.left;f.offsetTop=p.top;c||(c={});b.each(["Left", -"Right","Top","Bottom"],function(d,k){O=j["border"+k]=b.layout.borderWidth(a,k);R=j["padding"+k]=b.layout.cssNum(a,"padding"+k);D=k.toLowerCase();f.inset[D]=0<=c[D]?c[D]:R;h[D]=f.inset[D]+O});j.width=a.width();j.height=a.height();j.top=k(a,"top",!0);j.bottom=k(a,"bottom",!0);j.left=k(a,"left",!0);j.right=k(a,"right",!0);f.outerWidth=a.outerWidth();f.outerHeight=a.outerHeight();f.innerWidth=d(0,f.outerWidth-h.left-h.right);f.innerHeight=d(0,f.outerHeight-h.top-h.bottom);f.layoutWidth=a.innerWidth(); -f.layoutHeight=a.innerHeight();return f},getElementStyles:function(b,a){var d={},c=b[0].style,f=a.split(","),k=["Top","Bottom","Left","Right"],j=["Color","Style","Width"],h,p,D,x,A,r;for(x=0;x<f.length;x++)if(h=f[x],h.match(/(border|padding|margin)$/))for(A=0;4>A;A++)if(p=k[A],"border"===h)for(r=0;3>r;r++)D=j[r],d[h+p+D]=c[h+p+D];else d[h+p]=c[h+p];else d[h]=c[h];return d},cssWidth:function(a,c){if(0>=c)return 0;var f=!b.layout.browser.boxModel?"border-box":b.support.boxSizing?a.css("boxSizing"): -"content-box",j=b.layout.borderWidth,h=b.layout.cssNum,k=c;"border-box"!==f&&(k-=j(a,"Left")+j(a,"Right"));"content-box"===f&&(k-=h(a,"paddingLeft")+h(a,"paddingRight"));return d(0,k)},cssHeight:function(a,c){if(0>=c)return 0;var f=!b.layout.browser.boxModel?"border-box":b.support.boxSizing?a.css("boxSizing"):"content-box",j=b.layout.borderWidth,h=b.layout.cssNum,k=c;"border-box"!==f&&(k-=j(a,"Top")+j(a,"Bottom"));"content-box"===f&&(k-=h(a,"paddingTop")+h(a,"paddingBottom"));return d(0,k)},cssNum:function(a, -d,c){a.jquery||(a=b(a));var f=b.layout.showInvisibly(a);d=b.css(a[0],d,!0);c=c&&"auto"==d?d:Math.round(parseFloat(d)||0);a.css(f);return c},borderWidth:function(a,d){a.jquery&&(a=a[0]);var c="border"+d.substr(0,1).toUpperCase()+d.substr(1);return"none"===b.css(a,c+"Style",!0)?0:Math.round(parseFloat(b.css(a,c+"Width",!0))||0)},isMouseOverElem:function(a,d){var c=b(d||this),f=c.offset(),j=f.top,f=f.left,k=f+c.outerWidth(),c=j+c.outerHeight(),h=a.pageX,p=a.pageY;return b.layout.browser.msie&&0>h&&0> -p||h>=f&&h<=k&&p>=j&&p<=c},msg:function(a,d,c,f){b.isPlainObject(a)&&window.debugData?("string"===typeof d?(f=c,c=d):"object"===typeof c&&(f=c,c=null),c=c||"log( <object> )",f=b.extend({sort:!1,returnHTML:!1,display:!1},f),!0===d||f.display?debugData(a,c,f):window.console&&console.log(debugData(a,c,f))):d?alert(a):window.console?console.log(a):(d=b("#layoutLogger"),d.length||(d=b('<div id="layoutLogger" style="position: '+(b.support.fixedPosition?"fixed":"absolute")+'; top: 5px; z-index: 999999; max-width: 25%; overflow: hidden; border: 1px solid #000; border-radius: 5px; background: #FBFBFB; box-shadow: 0 2px 10px rgba(0,0,0,0.3);"><div style="font-size: 13px; font-weight: bold; padding: 5px 10px; background: #F6F6F6; border-radius: 5px 5px 0 0; cursor: move;"><span style="float: right; padding-left: 7px; cursor: pointer;" title="Remove Console" onclick="$(this).closest(\'#layoutLogger\').remove()">X</span>Layout console.log</div><ul style="font-size: 13px; font-weight: none; list-style: none; margin: 0; padding: 0 0 2px;"></ul></div>').appendTo("body"), -d.css("left",b(window).width()-d.outerWidth()-5),b.ui.draggable&&d.draggable({handle:":first-child"})),d.children("ul").append('<li style="padding: 4px 10px; margin: 0; border-top: 1px solid #CCC;">'+a.replace(/\</g,"<").replace(/\>/g,">")+"</li>"))}};var h=navigator.userAgent.toLowerCase(),p=/(chrome)[ \/]([\w.]+)/.exec(h)||/(webkit)[ \/]([\w.]+)/.exec(h)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(h)||/(msie) ([\w.]+)/.exec(h)||0>h.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(h)|| -[],h=p[1]||"",p=p[2]||0,x="msie"===h;b.layout.browser={version:p,safari:"webkit"===h,webkit:"chrome"===h,msie:x,isIE6:x&&6==p,boxModel:!x||!1!==b.support.boxModel};h&&(b.layout.browser[h]=!0);x&&b(function(){b.layout.browser.boxModel=b.support.boxModel});b.layout.defaults={name:"",containerClass:"ui-layout-container",inset:null,scrollToBookmarkOnLoad:!0,resizeWithWindow:!0,resizeWithWindowDelay:200,resizeWithWindowMaxDelay:0,maskPanesEarly:!1,onresizeall_start:null,onresizeall_end:null,onload_start:null, -onload_end:null,onunload_start:null,onunload_end:null,initPanes:!0,showErrorMessages:!0,showDebugMessages:!1,zIndex:null,zIndexes:{pane_normal:0,content_mask:1,resizer_normal:2,pane_sliding:100,pane_animate:1E3,resizer_drag:1E4},errors:{pane:"pane",selector:"selector",addButtonError:"Error Adding Button\nInvalid ",containerMissing:"UI Layout Initialization Error\nThe specified layout-container does not exist.",centerPaneMissing:"UI Layout Initialization Error\nThe center-pane element does not exist.\nThe center-pane is a required element.", -noContainerHeight:"UI Layout Initialization Warning\nThe layout-container \"CONTAINER\" has no height.\nTherefore the layout is 0-height and hence 'invisible'!",callbackError:"UI Layout Callback Error\nThe EVENT callback is not a valid function."},panes:{applyDemoStyles:!1,closable:!0,resizable:!0,slidable:!0,initClosed:!1,initHidden:!1,contentSelector:".ui-layout-content",contentIgnoreSelector:".ui-layout-ignore",findNestedContent:!1,paneClass:"ui-layout-pane",resizerClass:"ui-layout-resizer",togglerClass:"ui-layout-toggler", -buttonClass:"ui-layout-button",minSize:0,maxSize:0,spacing_open:6,spacing_closed:6,togglerLength_open:50,togglerLength_closed:50,togglerAlign_open:"center",togglerAlign_closed:"center",togglerContent_open:"",togglerContent_closed:"",resizerDblClickToggle:!0,autoResize:!0,autoReopen:!0,resizerDragOpacity:1,maskContents:!1,maskObjects:!1,maskZindex:null,resizingGrid:!1,livePaneResizing:!1,liveContentResizing:!1,liveResizingTolerance:1,sliderCursor:"pointer",slideTrigger_open:"click",slideTrigger_close:"mouseleave", -slideDelay_open:300,slideDelay_close:300,hideTogglerOnSlide:!1,preventQuickSlideClose:b.layout.browser.webkit,preventPrematureSlideClose:!1,tips:{Open:"Open",Close:"Close",Resize:"Resize",Slide:"Slide Open",Pin:"Pin",Unpin:"Un-Pin",noRoomToOpen:"Not enough room to show this panel.",minSizeWarning:"Panel has reached its minimum size",maxSizeWarning:"Panel has reached its maximum size"},showOverflowOnHover:!1,enableCursorHotkey:!0,customHotkeyModifier:"SHIFT",fxName:"slide",fxSpeed:null,fxSettings:{}, -fxOpacityFix:!0,animatePaneSizing:!1,children:null,containerSelector:"",initChildren:!0,destroyChildren:!0,resizeChildren:!0,triggerEventsOnLoad:!1,triggerEventsDuringLiveResize:!0,onshow_start:null,onshow_end:null,onhide_start:null,onhide_end:null,onopen_start:null,onopen_end:null,onclose_start:null,onclose_end:null,onresize_start:null,onresize_end:null,onsizecontent_start:null,onsizecontent_end:null,onswap_start:null,onswap_end:null,ondrag_start:null,ondrag_end:null},north:{paneSelector:".ui-layout-north", -size:"auto",resizerCursor:"n-resize",customHotkey:""},south:{paneSelector:".ui-layout-south",size:"auto",resizerCursor:"s-resize",customHotkey:""},east:{paneSelector:".ui-layout-east",size:200,resizerCursor:"e-resize",customHotkey:""},west:{paneSelector:".ui-layout-west",size:200,resizerCursor:"w-resize",customHotkey:""},center:{paneSelector:".ui-layout-center",minWidth:0,minHeight:0}};b.layout.optionsMap={layout:"name instanceKey stateManagement effects inset zIndexes errors zIndex scrollToBookmarkOnLoad showErrorMessages maskPanesEarly outset resizeWithWindow resizeWithWindowDelay resizeWithWindowMaxDelay onresizeall onresizeall_start onresizeall_end onload onload_start onload_end onunload onunload_start onunload_end".split(" "), -center:"paneClass contentSelector contentIgnoreSelector findNestedContent applyDemoStyles triggerEventsOnLoad showOverflowOnHover maskContents maskObjects liveContentResizing containerSelector children initChildren resizeChildren destroyChildren onresize onresize_start onresize_end onsizecontent onsizecontent_start onsizecontent_end".split(" "),noDefault:["paneSelector","resizerCursor","customHotkey"]};b.layout.transformData=function(a,d){var c=d?{panes:{},center:{}}:{},f,j,k,h,p,x,D;if("object"!== -typeof a)return c;for(j in a){f=c;p=a[j];k=j.split("__");D=k.length-1;for(x=0;x<=D;x++)h=k[x],x===D?f[h]=b.isPlainObject(p)?b.layout.transformData(p):p:(f[h]||(f[h]={}),f=f[h])}return c};b.layout.backwardCompatibility={map:{applyDefaultStyles:"applyDemoStyles",childOptions:"children",initChildLayout:"initChildren",destroyChildLayout:"destroyChildren",resizeChildLayout:"resizeChildren",resizeNestedLayout:"resizeChildren",resizeWhileDragging:"livePaneResizing",resizeContentWhileDragging:"liveContentResizing", -triggerEventsWhileDragging:"triggerEventsDuringLiveResize",maskIframesOnResize:"maskContents",useStateCookie:"stateManagement.enabled","cookie.autoLoad":"stateManagement.autoLoad","cookie.autoSave":"stateManagement.autoSave","cookie.keys":"stateManagement.stateKeys","cookie.name":"stateManagement.cookie.name","cookie.domain":"stateManagement.cookie.domain","cookie.path":"stateManagement.cookie.path","cookie.expires":"stateManagement.cookie.expires","cookie.secure":"stateManagement.cookie.secure", -noRoomToOpenTip:"tips.noRoomToOpen",togglerTip_open:"tips.Close",togglerTip_closed:"tips.Open",resizerTip:"tips.Resize",sliderTip:"tips.Slide"},renameOptions:function(a){function d(b,c){for(var f=b.split("."),k=f.length-1,j={branch:a,key:f[k]},r=0,q;r<k;r++)q=f[r],j.branch=void 0==j.branch[q]?c?j.branch[q]={}:{}:j.branch[q];return j}var c=b.layout.backwardCompatibility.map,f,j,k,h;for(h in c)f=d(h),k=f.branch[f.key],void 0!==k&&(j=d(c[h],!0),j.branch[j.key]=k,delete f.branch[f.key])},renameAllOptions:function(a){var d= -b.layout.backwardCompatibility.renameOptions;d(a);a.defaults&&("object"!==typeof a.panes&&(a.panes={}),b.extend(!0,a.panes,a.defaults),delete a.defaults);a.panes&&d(a.panes);b.each(b.layout.config.allPanes,function(b,c){a[c]&&d(a[c])});return a}};b.fn.layout=function(h){function p(e){if(!e)return!0;var w=e.keyCode;if(33>w)return!0;var m={38:"north",40:"south",37:"west",39:"east"},a=e.shiftKey,g=e.ctrlKey,t,n,d,c;g&&(37<=w&&40>=w)&&r[m[w]].enableCursorHotkey?c=m[w]:(g||a)&&b.each(k.borderPanes,function(e, -b){t=r[b];n=t.customHotkey;d=t.customHotkeyModifier;if(a&&"SHIFT"==d||g&&"CTRL"==d||g&&a)if(n&&w===(isNaN(n)||9>=n?n.toUpperCase().charCodeAt(0):n))return c=b,!1});if(!c||!y[c]||!r[c].closable||q[c].isHidden)return!0;na(c);e.stopPropagation();return e.returnValue=!1}function x(e){if(H()){this&&this.tagName&&(e=this);var w;f(e)?w=y[e]:b(e).data("layoutRole")?w=b(e):b(e).parents().each(function(){if(b(this).data("layoutRole"))return w=b(this),!1});if(w&&w.length){var m=w.data("layoutEdge");e=q[m];e.cssSaved&& -X(m);if(e.isSliding||e.isResizing||e.isClosed)e.cssSaved=!1;else{var a={zIndex:r.zIndexes.resizer_normal+1},g={},t=w.css("overflow"),n=w.css("overflowX"),d=w.css("overflowY");"visible"!=t&&(g.overflow=t,a.overflow="visible");n&&!n.match(/(visible|auto)/)&&(g.overflowX=n,a.overflowX="visible");d&&!d.match(/(visible|auto)/)&&(g.overflowY=n,a.overflowY="visible");e.cssSaved=g;w.css(a);b.each(k.allPanes,function(e,b){b!=m&&X(b)})}}}}function X(e){if(H()){this&&this.tagName&&(e=this);var w;f(e)?w=y[e]: -b(e).data("layoutRole")?w=b(e):b(e).parents().each(function(){if(b(this).data("layoutRole"))return w=b(this),!1});if(w&&w.length){e=w.data("layoutEdge");e=q[e];var m=e.cssSaved||{};!e.isSliding&&!e.isResizing&&w.css("zIndex",r.zIndexes.pane_normal);w.css(m);e.cssSaved=!1}}}var G=b.layout.browser,k=b.layout.config,Q=b.layout.cssWidth,O=b.layout.cssHeight,R=b.layout.getElementDimensions,D=b.layout.getElementStyles,Ma=b.layout.getEventObject,A=b.layout.parsePaneName,r=b.extend(!0,{},b.layout.defaults); -r.effects=b.extend(!0,{},b.layout.effects);var q={id:"layout"+b.now(),initialized:!1,paneResizing:!1,panesSliding:{},container:{innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0,layoutWidth:0,layoutHeight:0},north:{childIdx:0},south:{childIdx:0},east:{childIdx:0},west:{childIdx:0},center:{childIdx:0}},ba={north:null,south:null,east:null,west:null,center:null},M={data:{},set:function(e,b,m){M.clear(e);M.data[e]=setTimeout(b,m)},clear:function(e){var b=M.data;b[e]&&(clearTimeout(b[e]),delete b[e])}}, -ca=function(e,w,m){var a=r;(a.showErrorMessages&&!m||m&&a.showDebugMessages)&&b.layout.msg(a.name+" / "+e,!1!==w);return!1},C=function(e,w,m){var a=w&&f(w),g=a?q[w]:q,t=a?r[w]:r,n=r.name,d=e+(e.match(/_/)?"":"_end"),c=d.match(/_end$/)?d.substr(0,d.length-4):"",l=t[d]||t[c],h="NC",k=[];!a&&"boolean"===b.type(w)&&(m=w,w="");if(l)try{f(l)&&(l.match(/,/)?(k=l.split(","),l=eval(k[0])):l=eval(l)),b.isFunction(l)&&(h=k.length?l(k[1]):a?l(w,y[w],g,t,n):l(z,g,t,n))}catch(j){ca(r.errors.callbackError.replace(/EVENT/, -b.trim((w||"")+" "+d)),!1),"string"===b.type(j)&&string.length&&ca("Exception: "+j,!1)}!m&&!1!==h&&(a?(m=y[w],t=r[w],g=q[w],m.triggerHandler("layoutpane"+d,[w,m,g,t,n]),c&&m.triggerHandler("layoutpane"+c,[w,m,g,t,n])):(u.triggerHandler("layout"+d,[z,g,t,n]),c&&u.triggerHandler("layout"+c,[z,g,t,n])));a&&"onresize_end"===e&&db(w+"",!0);return h},eb=function(e){if(!G.mozilla){var b=y[e];"IFRAME"===q[e].tagName?b.css(k.hidden).css(k.visible):b.find("IFRAME").css(k.hidden).css(k.visible)}},ya=function(e){var b= -y[e];e=k[e].dir;b={minWidth:1001-Q(b,1E3),minHeight:1001-O(b,1E3)};"horz"===e&&(b.minSize=b.minHeight);"vert"===e&&(b.minSize=b.minWidth);return b},fa=function(e,w,m){m||(m=k[e].dir);f(w)&&w.match(/%/)&&(w="100%"===w?-1:parseInt(w,10)/100);if(0===w)return 0;if(1<=w)return parseInt(w,10);var a=r,g=0;"horz"==m?g=v.innerHeight-(y.north?a.north.spacing_open:0)-(y.south?a.south.spacing_open:0):"vert"==m&&(g=v.innerWidth-(y.west?a.west.spacing_open:0)-(y.east?a.east.spacing_open:0));if(-1===w)return g; -if(0<w)return c(g*w);if("center"==e)return 0;m="horz"===m?"height":"width";a=y[e];e="height"===m?U[e]:!1;var g=b.layout.showInvisibly(a),t=a.css(m),n=e?e.css(m):0;a.css(m,"auto");e&&e.css(m,"auto");w="height"===m?a.outerHeight():a.outerWidth();a.css(m,t).css(g);e&&e.css(m,n);return w},ga=function(e,b){var a=y[e],E=r[e],g=q[e],t=b?E.spacing_open:0,E=b?E.spacing_closed:0;return!a||g.isHidden?0:g.isClosed||g.isSliding&&b?E:"horz"===k[e].dir?a.outerHeight()+t:a.outerWidth()+t},Y=function(e,b){if(H()){var m= -r[e],E=q[e],g=k[e],t=g.dir;g.sizeType.toLowerCase();var g=void 0!=b?b:E.isSliding,n=m.spacing_open,c=k.oppositeEdge[e],f=q[c],l=y[c],h=!l||!1===f.isVisible||f.isSliding?0:"horz"==t?l.outerHeight():l.outerWidth(),c=(!l||f.isHidden?0:r[c][!1!==f.isClosed?"spacing_closed":"spacing_open"])||0,f="horz"==t?v.innerHeight:v.innerWidth,l=ya("center"),l="horz"==t?d(r.center.minHeight,l.minHeight):d(r.center.minWidth,l.minWidth),g=f-n-(g?0:fa("center",l,t)+h+c),t=E.minSize=d(fa(e,m.minSize),ya(e).minSize),g= -E.maxSize=a(m.maxSize?fa(e,m.maxSize):1E5,g),E=E.resizerPosition={},n=v.inset.top,h=v.inset.left,c=v.innerWidth,f=v.innerHeight,m=m.spacing_open;switch(e){case "north":E.min=n+t;E.max=n+g;break;case "west":E.min=h+t;E.max=h+g;break;case "south":E.min=n+f-g-m;E.max=n+f-t-m;break;case "east":E.min=h+c-g-m,E.max=h+c-t-m}}},Na=function(e,a){var m=b(e),E=m.data("layoutRole"),g=m.data("layoutEdge"),t=r[g][E+"Class"],g="-"+g,n=m.hasClass(t+"-closed")?"-closed":"-open",d="-closed"===n?"-open":"-closed",n= -t+"-hover "+(t+g+"-hover ")+(t+n+"-hover ")+(t+g+n+"-hover ");a&&(n+=t+d+"-hover "+(t+g+d+"-hover "));"resizer"==E&&m.hasClass(t+"-sliding")&&(n+=t+"-sliding-hover "+(t+g+"-sliding-hover "));return b.trim(n)},Oa=function(e,a){var m=b(a||this);e&&"toggler"===m.data("layoutRole")&&e.stopPropagation();m.addClass(Na(m))},da=function(e,a){var m=b(a||this);m.removeClass(Na(m,!0))},fb=function(){var e=b(this).data("layoutEdge"),a=q[e];!a.isClosed&&(!a.isResizing&&!q.paneResizing)&&(b.fn.disableSelection&& -b("body").disableSelection(),r.maskPanesEarly&&va(e,{resizing:!0}))},gb=function(e,a){var m=a||this,E=b(m).data("layoutEdge"),g=E+"ResizerLeave";M.clear(E+"_openSlider");M.clear(g);a?q.paneResizing||(b.fn.enableSelection&&b("body").enableSelection(),r.maskPanesEarly&&za()):M.set(g,function(){gb(e,m)},200)},H=function(){return q.initialized||q.creatingLayout?!0:Aa()},Aa=function(e){var a=r;if(!u.is(":visible"))return!e&&(G.webkit&&"BODY"===u[0].tagName)&&setTimeout(function(){Aa(!0)},50),!1;if(!hb("center").length)return ca(a.errors.centerPaneMissing); -q.creatingLayout=!0;b.extend(v,R(u,a.inset));A(void 0);b.each(k.allPanes,function(e,b){ib(b,!0)});Pa();b.each(k.borderPanes,function(e,b){y[b]&&q[b].isVisible&&(Y(b),ha(b))});ia("center");b.each(k.allPanes,function(e,b){jb(b)});a.scrollToBookmarkOnLoad&&(e=self.location,e.hash&&e.replace(e.hash));z.hasParentLayout?a.resizeWithWindow=!1:a.resizeWithWindow&&b(window).bind("resize."+K,Ab);delete q.creatingLayout;q.initialized=!0;j(z,b.layout.onReady);C("onload_end");return!0},Qa=function(e,a){var m= -A.call(this,e),d=y[m];if(d){var g=U[m],t=q[m],n=r[m],c=r.stateManagement||{},n=a?n.children=a:n.children;if(b.isPlainObject(n))n=[n];else if(!n||!b.isArray(n))return;b.each(n,function(e,a){b.isPlainObject(a)&&(a.containerSelector?d.find(a.containerSelector):g||d).each(function(){var e=b(this),g=e.data("layout");if(!g){kb({container:e,options:a},t);if(c.includeChildren&&q.stateData[m]){var g=(q.stateData[m].children||{})[a.instanceKey],w=a.stateManagement||(a.stateManagement={autoLoad:!0});!0===w.autoLoad&& -g&&(w.autoSave=!1,w.includeChildren=!0,w.autoLoad=b.extend(!0,{},g))}(g=e.layout(a))&&Ba(m,g)}})})}},kb=function(e,b){var a=e.container,d=e.options,g=d.stateManagement,t=d.instanceKey||a.data("layoutInstanceKey");t||(t=(g&&g.cookie?g.cookie.name:"")||d.name);t=t?t.replace(/[^\w-]/gi,"_").replace(/_{2,}/g,"_"):"layout"+ ++b.childIdx;d.instanceKey=t;a.data("layoutInstanceKey",t);return t},Ba=function(e,a){var m=y[e],d=ba[e],g=q[e];b.isPlainObject(d)&&(b.each(d,function(e,b){b.destroyed&&delete d[e]}), -b.isEmptyObject(d)&&(d=ba[e]=null));!a&&!d&&(a=m.data("layout"));a&&(a.hasParentLayout=!0,m=a.options,kb(a,g),d||(d=ba[e]={}),d[m.instanceKey]=a.container.data("layout"));z[e].children=ba[e];a||Qa(e)},Ab=function(){var e=r,b=Number(e.resizeWithWindowDelay);10>b&&(b=100);M.clear("winResize");M.set("winResize",function(){M.clear("winResize");M.clear("winResizeRepeater");var b=R(u,e.inset);(b.innerWidth!==v.innerWidth||b.innerHeight!==v.innerHeight)&&oa()},b);M.data.winResizeRepeater||lb()},lb=function(){var e= -Number(r.resizeWithWindowMaxDelay);0<e&&M.set("winResizeRepeater",function(){lb();oa()},e)},mb=function(){C("onunload_start");j(z,b.layout.onUnload);C("onunload_end")},nb=function(e){e=e?e.split(","):k.borderPanes;b.each(e,function(e,a){var d=r[a];if(d.enableCursorHotkey||d.customHotkey)return b(document).bind("keydown."+K,p),!1})},hb=function(e){e=r[e].paneSelector;if("#"===e.substr(0,1))return u.find(e).eq(0);var b=u.children(e).eq(0);return b.length?b:u.children("form:first").children(e).eq(0)}, -ib=function(e,b){if(b||H()){var m=r[e],c=q[e],g=k[e],t=g.dir,n="center"===e,f={},h=y[e],l,j;h?Ra(e,!1,!0,!1):U[e]=!1;h=y[e]=hb(e);if(h.length){h.data("layoutCSS")||h.data("layoutCSS",D(h,"position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border"));z[e]={name:e,pane:y[e],content:U[e],options:r[e],state:q[e],children:ba[e]};h.data({parentLayout:z,layoutPane:z[e],layoutEdge:e,layoutRole:"pane"}).css(g.cssReq).css("zIndex",r.zIndexes.pane_normal).css(m.applyDemoStyles? -g.cssDemo:{}).addClass(m.paneClass+" "+m.paneClass+"-"+e).bind("mouseenter."+K,Oa).bind("mouseleave."+K,da);g={hide:"",show:"",toggle:"",close:"",open:"",slideOpen:"",slideClose:"",slideToggle:"",size:"sizePane",sizePane:"sizePane",sizeContent:"",sizeHandles:"",enableClosable:"",disableClosable:"",enableSlideable:"",disableSlideable:"",enableResizable:"",disableResizable:"",swapPanes:"swapPanes",swap:"swapPanes",move:"swapPanes",removePane:"removePane",remove:"removePane",createChildren:"",resizeChildren:"", -resizeAll:"resizeAll",resizeLayout:"resizeAll"};for(j in g)h.bind("layoutpane"+j.toLowerCase()+"."+K,z[g[j]||j]);Sa(e,!1);n||(l=c.size=fa(e,m.size),n=fa(e,m.minSize)||1,j=fa(e,m.maxSize)||1E5,0<l&&(l=d(a(l,j),n)),c.autoResize=m.autoResize,c.isClosed=!1,c.isSliding=!1,c.isResizing=!1,c.isHidden=!1,c.pins||(c.pins=[]));c.tagName=h[0].tagName;c.edge=e;c.noRoom=!1;c.isVisible=!0;ob(e);"horz"===t?f.height=O(h,l):"vert"===t&&(f.width=Q(h,l));h.css(f);"horz"!=t&&ia(e,!0);q.initialized&&(Pa(e),nb(e));m.initClosed&& -m.closable&&!m.initHidden?ja(e,!0,!0):m.initHidden||m.initClosed?Ta(e):c.noRoom||h.css("display","block");h.css("visibility","visible");m.showOverflowOnHover&&h.hover(x,X);q.initialized&&jb(e)}else y[e]=!1}},jb=function(e){var b=y[e],a=q[e],d=r[e];b&&(b.data("layout")&&Ba(e,b.data("layout")),a.isVisible&&(q.initialized?oa():pa(e),d.triggerEventsOnLoad?C("onresize_end",e):db(e,!0)),d.initChildren&&d.children&&Qa(e))},ob=function(e){e=e?e.split(","):k.borderPanes;b.each(e,function(e,b){var a=y[b],g= -F[b],d=q[b],c=k[b].side,f={};if(a){switch(b){case "north":f.top=v.inset.top;f.left=v.inset.left;f.right=v.inset.right;break;case "south":f.bottom=v.inset.bottom;f.left=v.inset.left;f.right=v.inset.right;break;case "west":f.left=v.inset.left;break;case "east":f.right=v.inset.right}a.css(f);g&&d.isClosed?g.css(c,v.inset[c]):g&&!d.isHidden&&g.css(c,v.inset[c]+ga(b))}})},Pa=function(e){e=e?e.split(","):k.borderPanes;b.each(e,function(e,a){var d=y[a];F[a]=!1;P[a]=!1;if(d){var g=r[a],d=q[a],c="#"===g.paneSelector.substr(0, -1)?g.paneSelector.substr(1):"",n=g.resizerClass,f=g.togglerClass,h="-"+a,l=z[a],j=l.resizer=F[a]=b("<div></div>"),l=l.toggler=g.closable?P[a]=b("<div></div>"):!1;!d.isVisible&&g.slidable&&j.attr("title",g.tips.Slide).css("cursor",g.sliderCursor);j.attr("id",c?c+"-resizer":"").data({parentLayout:z,layoutPane:z[a],layoutEdge:a,layoutRole:"resizer"}).css(k.resizers.cssReq).css("zIndex",r.zIndexes.resizer_normal).css(g.applyDemoStyles?k.resizers.cssDemo:{}).addClass(n+" "+n+h).hover(Oa,da).hover(fb,gb).appendTo(u); -g.resizerDblClickToggle&&j.bind("dblclick."+K,na);l&&(l.attr("id",c?c+"-toggler":"").data({parentLayout:z,layoutPane:z[a],layoutEdge:a,layoutRole:"toggler"}).css(k.togglers.cssReq).css(g.applyDemoStyles?k.togglers.cssDemo:{}).addClass(f+" "+f+h).hover(Oa,da).bind("mouseenter",fb).appendTo(j),g.togglerContent_open&&b("<span>"+g.togglerContent_open+"</span>").data({layoutEdge:a,layoutRole:"togglerContent"}).data("layoutRole","togglerContent").data("layoutEdge",a).addClass("content content-open").css("display", -"none").appendTo(l),g.togglerContent_closed&&b("<span>"+g.togglerContent_closed+"</span>").data({layoutEdge:a,layoutRole:"togglerContent"}).addClass("content content-closed").css("display","none").appendTo(l),pb(a));var g=a,B=b.layout.plugins.draggable,g=g?g.split(","):k.borderPanes;b.each(g,function(e,a){var g=r[a];if(!B||!y[a]||!g.resizable)return g.resizable=!1,!0;var m=q[a],w=r.zIndexes,d=k[a],c="horz"==d.dir?"top":"left",t=F[a],n=g.resizerClass,f=0,l,h,E=n+"-drag",j=n+"-"+a+"-drag",J=n+"-dragging", -zb=n+"-"+a+"-dragging",cb=n+"-dragging-limit",v=n+"-"+a+"-dragging-limit",x=!1;m.isClosed||t.attr("title",g.tips.Resize).css("cursor",g.resizerCursor);t.draggable({containment:u[0],axis:"horz"==d.dir?"y":"x",delay:0,distance:1,grid:g.resizingGrid,helper:"clone",opacity:g.resizerDragOpacity,addClasses:!1,zIndex:w.resizer_drag,start:function(e,w){g=r[a];m=q[a];h=g.livePaneResizing;if(!1===C("ondrag_start",a))return!1;m.isResizing=!0;q.paneResizing=a;M.clear(a+"_closeSlider");Y(a);l=m.resizerPosition; -f=w.position[c];t.addClass(E+" "+j);x=!1;b("body").disableSelection();va(a,{resizing:!0})},drag:function(e,b){x||(b.helper.addClass(J+" "+zb).css({right:"auto",bottom:"auto"}).children().css("visibility","hidden"),x=!0,m.isSliding&&y[a].css("zIndex",w.pane_sliding));var d=0;b.position[c]<l.min?(b.position[c]=l.min,d=-1):b.position[c]>l.max&&(b.position[c]=l.max,d=1);d?(b.helper.addClass(cb+" "+v),window.defaultStatus=0<d&&a.match(/(north|west)/)||0>d&&a.match(/(south|east)/)?g.tips.maxSizeWarning: -g.tips.minSizeWarning):(b.helper.removeClass(cb+" "+v),window.defaultStatus="");h&&Math.abs(b.position[c]-f)>=g.liveResizingTolerance&&(f=b.position[c],p(e,b,a))},stop:function(e,g){b("body").enableSelection();window.defaultStatus="";t.removeClass(E+" "+j);m.isResizing=!1;q.paneResizing=!1;p(e,g,a,!0)}})});var p=function(b,e,a,g){var m=e.position,w=k[a];b=r[a];e=q[a];var d;switch(a){case "north":d=m.top;break;case "west":d=m.left;break;case "south":d=v.layoutHeight-m.top-b.spacing_open;break;case "east":d= -v.layoutWidth-m.left-b.spacing_open}d-=v.inset[w.side];g?(!1!==C("ondrag_end",a)&&Ca(a,d,!1,!0),za(!0),e.isSliding&&va(a,{resizing:!0})):Math.abs(d-e.size)<b.liveResizingTolerance||(Ca(a,d,!1,!0),ea.each(qb))};d.isVisible?Ua(a):(Da(a),ma(a,!0))}});qa()},Sa=function(b,a){if(H()){var m=r[b],d=m.contentSelector,g=z[b],c=y[b],n;d&&(n=g.content=U[b]=m.findNestedContent?c.find(d).eq(0):c.children(d).eq(0));n&&n.length?(n.data("layoutRole","content"),n.data("layoutCSS")||n.data("layoutCSS",D(n,"height")), -n.css(k.content.cssReq),m.applyDemoStyles&&(n.css(k.content.cssDemo),c.css(k.content.cssDemoPane)),c.css("overflowX").match(/(scroll|auto)/)&&c.css("overflow","hidden"),q[b].content={},!1!==a&&pa(b)):g.content=U[b]=!1}},qb=function(){var e=b(this),a=e.data("layoutMask"),a=q[a];"IFRAME"==a.tagName&&a.isVisible&&e.css({top:a.offsetTop,left:a.offsetLeft,width:a.outerWidth,height:a.outerHeight})},va=function(e,a){var m=k[e],d=["center"],g=r.zIndexes,c=b.extend({objectsOnly:!1,animation:!1,resizing:!0, -sliding:q[e].isSliding},a),n,f;c.resizing&&d.push(e);c.sliding&&d.push(k.oppositeEdge[e]);"horz"===m.dir&&(d.push("west"),d.push("east"));b.each(d,function(e,a){f=q[a];n=r[a];if(f.isVisible&&(n.maskObjects||!c.objectsOnly&&n.maskContents)){for(var m=b([]),d,w=0,h=ea.length;w<h;w++)d=ea.eq(w),d.data("layoutMask")===a&&(m=m.add(d));if(!m.length){m=y[a];d=q[a];var w=r[a],h=r.zIndexes,j=b([]),E,k,v,p,x;if(w.maskContents||w.maskObjects)for(x=0;x<(w.maskObjects?2:1);x++)E=w.maskObjects&&0==x,k=document.createElement(E? -"iframe":"div"),v=b(k).data("layoutMask",a),k.className="ui-layout-mask ui-layout-mask-"+a,p=k.style,p.display="block",p.position="absolute",p.background="#FFF",E&&(k.frameborder=0,k.src="about:blank",p.opacity=0,p.filter="Alpha(Opacity='0')",p.border=0),"IFRAME"==d.tagName?(p.zIndex=h.pane_normal+1,u.append(k)):(v.addClass("ui-layout-mask-inside-pane"),p.zIndex=w.maskZindex||h.content_mask,p.top=0,p.left=0,p.width="100%",p.height="100%",m.append(k)),j=j.add(k),ea=ea.add(k);m=j}m.each(function(){qb.call(this); -this.style.zIndex=f.isSliding?g.pane_sliding+1:g.pane_normal+1;this.style.display="block"})}})},za=function(a){if(a||!q.paneResizing)ea.hide();else if(!a&&!b.isEmptyObject(q.panesSliding)){a=ea.length-1;for(var d,m;0<=a;a--)m=ea.eq(a),d=m.data("layoutMask"),r[d].maskObjects||m.hide()}},Ra=function(a,d,m,c){if(H()){a=A.call(this,a);var g=y[a],t=U[a],n=F[a],f=P[a];g&&b.isEmptyObject(g.data())&&(g=!1);t&&b.isEmptyObject(t.data())&&(t=!1);n&&b.isEmptyObject(n.data())&&(n=!1);f&&b.isEmptyObject(f.data())&& -(f=!1);g&&g.stop(!0,!0);var h=r[a],l=ba[a],j=b.isPlainObject(l)&&!b.isEmptyObject(l);c=void 0!==c?c:h.destroyChildren;j&&c&&(b.each(l,function(a,b){b.destroyed||b.destroy(!0);b.destroyed&&delete l[a]}),b.isEmptyObject(l)&&(l=ba[a]=null,j=!1));g&&d&&!j?g.remove():g&&g[0]&&(d=h.paneClass,c=d+"-"+a,d=[d,d+"-open",d+"-closed",d+"-sliding",c,c+"-open",c+"-closed",c+"-sliding"],b.merge(d,Na(g,!0)),g.removeClass(d.join(" ")).removeData("parentLayout").removeData("layoutPane").removeData("layoutRole").removeData("layoutEdge").removeData("autoHidden").unbind("."+ -K),j&&t?(t.width(t.width()),b.each(l,function(a,b){b.resizeAll()})):t&&t.css(t.data("layoutCSS")).removeData("layoutCSS").removeData("layoutRole"),g.data("layout")||g.css(g.data("layoutCSS")).removeData("layoutCSS"));f&&f.remove();n&&n.remove();z[a]=y[a]=U[a]=F[a]=P[a]=!1;m||oa()}},Ea=function(a){var b=y[a],d=b[0].style;r[a].useOffscreenClose?(b.data(k.offscreenReset)||b.data(k.offscreenReset,{left:d.left,right:d.right}),b.css(k.offscreenCSS)):b.hide().removeData(k.offscreenReset)},rb=function(a){var b= -y[a];a=r[a];var d=k.offscreenCSS,c=b.data(k.offscreenReset),g=b[0].style;b.show().removeData(k.offscreenReset);a.useOffscreenClose&&c&&(g.left==d.left&&(g.left=c.left),g.right==d.right&&(g.right=c.right))},Ta=function(a,b){if(H()){var d=A.call(this,a),c=r[d],g=q[d],t=F[d];y[d]&&!g.isHidden&&!(q.initialized&&!1===C("onhide_start",d))&&(g.isSliding=!1,delete q.panesSliding[d],t&&t.hide(),!q.initialized||g.isClosed?(g.isClosed=!0,g.isHidden=!0,g.isVisible=!1,q.initialized||Ea(d),ia("horz"===k[d].dir? -"":"center"),(q.initialized||c.triggerEventsOnLoad)&&C("onhide_end",d)):(g.isHiding=!0,ja(d,!1,b)))}},Fa=function(a,b,d,c){if(H()){a=A.call(this,a);var g=q[a];y[a]&&g.isHidden&&!1!==C("onshow_start",a)&&(g.isShowing=!0,g.isSliding=!1,delete q.panesSliding[a],!1===b?ja(a,!0):ra(a,!1,d,c))}},na=function(a,b){if(H()){var d=Ma(a),c=A.call(this,a),g=q[c];d&&d.stopImmediatePropagation();g.isHidden?Fa(c):g.isClosed?ra(c,!!b):ja(c)}},ja=function(a,b,d,c){function g(){l.isMoving=!1;ma(t,!0);var a=k.oppositeEdge[t]; -q[a].noRoom&&(Y(a),ha(a));if(!c&&(q.initialized||h.triggerEventsOnLoad))p||C("onclose_end",t),p&&C("onshow_end",t),v&&C("onhide_end",t)}var t=A.call(this,a);if(!q.initialized&&y[t]){a=t;var n=q[a];Ea(a);n.isClosed=!0;n.isVisible=!1;Da(a)}else if(H()){var f=y[t],h=r[t],l=q[t],j,p,v;u.queue(function(a){if(!f||!h.closable&&!l.isShowing&&!l.isHiding||!b&&l.isClosed&&!l.isShowing)return a();var e=!l.isShowing&&!1===C("onclose_start",t);p=l.isShowing;v=l.isHiding;delete l.isShowing;delete l.isHiding;if(e)return a(); -j=!d&&!l.isClosed&&"none"!=h.fxName_close;l.isMoving=!0;l.isClosed=!0;l.isVisible=!1;v?l.isHidden=!0:p&&(l.isHidden=!1);l.isSliding?wa(t,!1):ia("horz"===k[t].dir?"":"center",!1);Da(t);j?(Ga(t,!0),f.hide(h.fxName_close,h.fxSettings_close,h.fxSpeed_close,function(){Ga(t,!1);l.isClosed&&g();a()})):(Ea(t),g(),a())})}},Da=function(a){if(F[a]){var d=F[a],c=P[a],f=r[a],g=k[a].side,t=f.resizerClass,n=f.togglerClass,h="-"+a;d.css(g,v.inset[g]).removeClass(t+"-open "+t+h+"-open").removeClass(t+"-sliding "+ -t+h+"-sliding").addClass(t+"-closed "+t+h+"-closed");f.resizable&&b.layout.plugins.draggable&&d.draggable("disable").removeClass("ui-state-disabled").css("cursor","default").attr("title","");c&&(c.removeClass(n+"-open "+n+h+"-open").addClass(n+"-closed "+n+h+"-closed").attr("title",f.tips.Open),c.children(".content-open").hide(),c.children(".content-closed").css("display","block"));Va(a,!1);q.initialized&&qa()}},ra=function(a,b,d,c){function g(){j.isMoving=!1;eb(f);j.isSliding||ia("vert"==k[f].dir? -"center":"",!1);Ua(f)}if(H()){var f=A.call(this,a),n=y[f],h=r[f],j=q[f],l,p;u.queue(function(a){if(!n||!h.resizable&&!h.closable&&!j.isShowing||j.isVisible&&!j.isSliding)return a();if(j.isHidden&&!j.isShowing)a(),Fa(f,!0);else{j.autoResize&&j.size!=h.size?ka(f,h.size,!0,!0,!0):Y(f,b);var e=C("onopen_start",f);if("abort"===e)return a();"NC"!==e&&Y(f,b);if(j.minSize>j.maxSize)return Va(f,!1),!c&&h.tips.noRoomToOpen&&alert(h.tips.noRoomToOpen),a();b?wa(f,!0):j.isSliding?wa(f,!1):h.slidable&&ma(f,!1); -j.noRoom=!1;ha(f);p=j.isShowing;delete j.isShowing;l=!d&&j.isClosed&&"none"!=h.fxName_open;j.isMoving=!0;j.isVisible=!0;j.isClosed=!1;p&&(j.isHidden=!1);l?(Ga(f,!0),n.show(h.fxName_open,h.fxSettings_open,h.fxSpeed_open,function(){Ga(f,!1);j.isVisible&&g();a()})):(rb(f),g(),a())}})}},Ua=function(a,d){var c=y[a],f=F[a],g=P[a],h=r[a],n=q[a],j=k[a].side,p=h.resizerClass,l=h.togglerClass,u="-"+a;f.css(j,v.inset[j]+ga(a)).removeClass(p+"-closed "+p+u+"-closed").addClass(p+"-open "+p+u+"-open");n.isSliding? -f.addClass(p+"-sliding "+p+u+"-sliding"):f.removeClass(p+"-sliding "+p+u+"-sliding");da(0,f);h.resizable&&b.layout.plugins.draggable?f.draggable("enable").css("cursor",h.resizerCursor).attr("title",h.tips.Resize):n.isSliding||f.css("cursor","default");g&&(g.removeClass(l+"-closed "+l+u+"-closed").addClass(l+"-open "+l+u+"-open").attr("title",h.tips.Close),da(0,g),g.children(".content-closed").hide(),g.children(".content-open").css("display","block"));Va(a,!n.isSliding);b.extend(n,R(c));q.initialized&& -(qa(),pa(a,!0));if(!d&&(q.initialized||h.triggerEventsOnLoad)&&c.is(":visible"))C("onopen_end",a),n.isShowing&&C("onshow_end",a),q.initialized&&C("onresize_end",a)},sb=function(a){function b(){g.isClosed?g.isMoving||ra(c,!0):wa(c,!0)}if(H()){var d=Ma(a),c=A.call(this,a),g=q[c];a=r[c].slideDelay_open;d&&d.stopImmediatePropagation();g.isClosed&&d&&"mouseenter"===d.type&&0<a?M.set(c+"_openSlider",b,a):b()}},Wa=function(a){function c(){g.isClosed?wa(f,!1):g.isMoving||ja(f)}if(H()){var m=Ma(a),f=A.call(this, -a);a=r[f];var g=q[f],h=g.isMoving?1E3:300;!g.isClosed&&!g.isResizing&&("click"===a.slideTrigger_close?c():a.preventQuickSlideClose&&g.isMoving||a.preventPrematureSlideClose&&m&&b.layout.isMouseOverElem(m,y[f])||(m?M.set(f+"_closeSlider",c,d(a.slideDelay_close,h)):c()))}},Ga=function(a,b){var d=y[a],c=q[a],g=r[a],f=r.zIndexes;b?(va(a,{animation:!0,objectsOnly:!0}),d.css({zIndex:f.pane_animate}),"south"==a?d.css({top:v.inset.top+v.innerHeight-d.outerHeight()}):"east"==a&&d.css({left:v.inset.left+v.innerWidth- -d.outerWidth()})):(za(),d.css({zIndex:c.isSliding?f.pane_sliding:f.pane_normal}),"south"==a?d.css({top:"auto"}):"east"==a&&!d.css("left").match(/\-99999/)&&d.css({left:"auto"}),G.msie&&(g.fxOpacityFix&&"slide"!=g.fxName_open&&d.css("filter")&&1==d.css("opacity"))&&d[0].style.removeAttribute("filter"))},ma=function(a,b){var d=r[a],c=F[a],g=d.slideTrigger_open.toLowerCase();if(c&&(!b||d.slidable)){g.match(/mouseover/)?g=d.slideTrigger_open="mouseenter":g.match(/(click|dblclick|mouseenter)/)||(g=d.slideTrigger_open= -"click");if(d.resizerDblClickToggle&&g.match(/click/))c[b?"unbind":"bind"]("dblclick."+K,na);c[b?"bind":"unbind"](g+"."+K,sb).css("cursor",b?d.sliderCursor:"default").attr("title",b?d.tips.Slide:"")}},wa=function(a,b){function d(b){M.clear(a+"_closeSlider");b.stopPropagation()}var c=r[a],g=q[a],f=r.zIndexes,h=c.slideTrigger_close.toLowerCase(),j=b?"bind":"unbind",k=y[a],l=F[a];M.clear(a+"_closeSlider");b?(g.isSliding=!0,q.panesSliding[a]=!0,ma(a,!1)):(g.isSliding=!1,delete q.panesSliding[a]);k.css("zIndex", -b?f.pane_sliding:f.pane_normal);l.css("zIndex",b?f.pane_sliding+2:f.resizer_normal);h.match(/(click|mouseleave)/)||(h=c.slideTrigger_close="mouseleave");l[j](h,Wa);"mouseleave"===h&&(k[j]("mouseleave."+K,Wa),l[j]("mouseenter."+K,d),k[j]("mouseenter."+K,d));b?"click"===h&&!c.resizable&&(l.css("cursor",b?c.sliderCursor:"default"),l.attr("title",b?c.tips.Close:"")):M.clear(a+"_closeSlider")},ha=function(a,d,c,f){d=r[a];var g=q[a],h=k[a],n=y[a],j=F[a],p="vert"===h.dir,l=!1;if("center"===a||p&&g.noVerticalRoom)(l= -0<=g.maxHeight)&&g.noRoom?(rb(a),j&&j.show(),g.isVisible=!0,g.noRoom=!1,p&&(g.noVerticalRoom=!1),eb(a)):!l&&!g.noRoom&&(Ea(a),j&&j.hide(),g.isVisible=!1,g.noRoom=!0);"center"!==a&&(g.minSize<=g.maxSize?(g.size>g.maxSize?ka(a,g.maxSize,c,!0,f):g.size<g.minSize?ka(a,g.minSize,c,!0,f):j&&(g.isVisible&&n.is(":visible"))&&(c=g.size+v.inset[h.side],b.layout.cssNum(j,h.side)!=c&&j.css(h.side,c)),g.noRoom&&(g.wasOpen&&d.closable?d.autoReopen?ra(a,!1,!0,!0):g.noRoom=!1:Fa(a,g.wasOpen,!0,!0))):g.noRoom||(g.noRoom= -!0,g.wasOpen=!g.isClosed&&!g.isSliding,g.isClosed||(d.closable?ja(a,!0,!0):Ta(a,!0))))},Ca=function(a,b,d,c,g){if(H()){a=A.call(this,a);var f=r[a],h=q[a];g=g||f.livePaneResizing&&!h.isResizing;h.autoResize=!1;ka(a,b,d,c,g)}},ka=function(e,c,f,h,g){function j(){for(var a="width"===ua?l.outerWidth():l.outerHeight(),a=[{pane:n,count:1,target:c,actual:a,correct:c===a,attempt:c,cssSize:D}],e=a[0],h={},t="Inaccurate size after resizing the "+n+"-pane.";!e.correct;){h={pane:n,count:e.count+1,target:c};h.attempt= -e.actual>c?d(0,e.attempt-(e.actual-c)):d(0,e.attempt+(c-e.actual));h.cssSize=("horz"==k[n].dir?O:Q)(y[n],h.attempt);l.css(ua,h.cssSize);h.actual="width"==ua?l.outerWidth():l.outerHeight();h.correct=c===h.actual;1===a.length&&(ca(t,!1,!0),ca(e,!1,!0));ca(h,!1,!0);if(3<a.length)break;a.push(h);e=a[a.length-1]}J.size=c;b.extend(J,R(l));J.isVisible&&l.is(":visible")&&(x&&x.css(B,c+v.inset[B]),pa(n));!f&&(!Z&&q.initialized&&J.isVisible)&&C("onresize_end",n);f||(J.isSliding||ia("horz"==k[n].dir?"":"center", -Z,g),qa());e=k.oppositeEdge[n];c<G&&q[e].noRoom&&(Y(e),ha(e,!1,f));1<a.length&&ca(t+"\nSee the Error Console for details.",!0,!0)}if(H()){var n=A.call(this,e),p=r[n],J=q[n],l=y[n],x=F[n],B=k[n].side,ua=k[n].sizeType.toLowerCase(),Z=J.isResizing&&!p.triggerEventsDuringLiveResize,z=!0!==h&&p.animatePaneSizing,G,D;u.queue(function(e){Y(n);G=J.size;c=fa(n,c);c=d(c,fa(n,p.minSize));c=a(c,J.maxSize);if(c<J.minSize)e(),ha(n,!1,f);else{if(!g&&c===G)return e();J.newSize=c;!f&&(q.initialized&&J.isVisible)&& -C("onresize_start",n);D=("horz"==k[n].dir?O:Q)(y[n],c);if(z&&l.is(":visible")){var h=b.layout.effects.size[n]||b.layout.effects.size.all,h=p.fxSettings_size.easing||h.easing,v=r.zIndexes,u={};u[ua]=D+"px";J.isMoving=!0;l.css({zIndex:v.pane_animate}).show().animate(u,p.fxSpeed_size,h,function(){l.css({zIndex:J.isSliding?v.pane_sliding:v.pane_normal});J.isMoving=!1;delete J.newSize;j();e()})}else l.css(ua,D),delete J.newSize,l.is(":visible")?j():(J.size=c,b.extend(J,R(l))),e()}})}},ia=function(a,c, -f){a=(a?a:"east,west,center").split(",");b.each(a,function(a,e){if(y[e]){var h=r[e],j=q[e],k=y[e],p=!0,l={},u=b.layout.showInvisibly(k),B={top:ga("north",!0),bottom:ga("south",!0),left:ga("west",!0),right:ga("east",!0),width:0,height:0};B.width=v.innerWidth-B.left-B.right;B.height=v.innerHeight-B.bottom-B.top;B.top+=v.inset.top;B.bottom+=v.inset.bottom;B.left+=v.inset.left;B.right+=v.inset.right;b.extend(j,R(k));if("center"===e){if(!f&&j.isVisible&&B.width===j.outerWidth&&B.height===j.outerHeight)return k.css(u), -!0;b.extend(j,ya(e),{maxWidth:B.width,maxHeight:B.height});l=B;j.newWidth=l.width;j.newHeight=l.height;l.width=Q(k,l.width);l.height=O(k,l.height);p=0<=l.width&&0<=l.height;if(!q.initialized&&h.minWidth>B.width){var h=h.minWidth-j.outerWidth,B=r.east.minSize||0,x=r.west.minSize||0,Z=q.east.size,z=q.west.size,A=Z,D=z;0<h&&(q.east.isVisible&&Z>B)&&(A=d(Z-B,Z-h),h-=Z-A);0<h&&(q.west.isVisible&&z>x)&&(D=d(z-x,z-h),h-=z-D);if(0===h){Z&&Z!=B&&ka("east",A,!0,!0,f);z&&z!=x&&ka("west",D,!0,!0,f);ia("center", -c,f);k.css(u);return}}}else{j.isVisible&&!j.noVerticalRoom&&b.extend(j,R(k),ya(e));if(!f&&!j.noVerticalRoom&&B.height===j.outerHeight)return k.css(u),!0;l.top=B.top;l.bottom=B.bottom;j.newSize=B.height;l.height=O(k,B.height);j.maxHeight=l.height;p=0<=j.maxHeight;p||(j.noVerticalRoom=!0)}p?(!c&&q.initialized&&C("onresize_start",e),k.css(l),"center"!==e&&qa(e),j.noRoom&&(!j.isClosed&&!j.isHidden)&&ha(e),j.isVisible&&(b.extend(j,R(k)),q.initialized&&pa(e))):!j.noRoom&&j.isVisible&&ha(e);k.css(u);delete j.newSize; -delete j.newWidth;delete j.newHeight;if(!j.isVisible)return!0;"center"===e&&(j=G.isIE6||!G.boxModel,y.north&&(j||"IFRAME"==q.north.tagName)&&y.north.css("width",Q(y.north,v.innerWidth)),y.south&&(j||"IFRAME"==q.south.tagName)&&y.south.css("width",Q(y.south,v.innerWidth)));!c&&q.initialized&&C("onresize_end",e)}})},oa=function(a){A(a);if(u.is(":visible"))if(q.initialized){if(!0===a&&b.isPlainObject(r.outset)&&u.css(r.outset),b.extend(v,R(u,r.inset)),v.outerHeight){!0===a&&ob();if(!1===C("onresizeall_start"))return!1; -var d,c,f;b.each(["south","north","east","west"],function(a,b){y[b]&&(c=r[b],f=q[b],f.autoResize&&f.size!=c.size?ka(b,c.size,!0,!0,!0):(Y(b),ha(b,!1,!0,!0)))});ia("",!0,!0);qa();b.each(k.allPanes,function(a,b){(d=y[b])&&q[b].isVisible&&C("onresize_end",b)});C("onresizeall_end")}}else Aa()},db=function(a,d){var c=A.call(this,a);r[c].resizeChildren&&(d||Ba(c),c=ba[c],b.isPlainObject(c)&&b.each(c,function(a,b){b.destroyed||b.resizeAll()}))},pa=function(a,c){if(H()){var h=A.call(this,a),h=h?h.split(","): -k.allPanes;b.each(h,function(a,e){function h(a){return d(u.css.paddingBottom,parseInt(a.css("marginBottom"),10)||0)}function j(){var a=r[e].contentIgnoreSelector,a=p.nextAll().not(".ui-layout-mask").not(a||":lt(0)"),b=a.filter(":visible"),d=b.filter(":last");v={top:p[0].offsetTop,height:p.outerHeight(),numFooters:a.length,hiddenFooters:a.length-b.length,spaceBelow:0};v.spaceAbove=v.top;v.bottom=v.top+v.height;v.spaceBelow=d.length?d[0].offsetTop+d.outerHeight()-v.bottom+h(d):h(p)}var m=y[e],p=U[e], -l=r[e],u=q[e],v=u.content;if(!m||!p||!m.is(":visible"))return!0;if(!p.length&&(Sa(e,!1),!p))return;if(!1!==C("onsizecontent_start",e)){if(!u.isMoving&&!u.isResizing||l.liveContentResizing||c||void 0==v.top)j(),0<v.hiddenFooters&&"hidden"===m.css("overflow")&&(m.css("overflow","visible"),j(),m.css("overflow","hidden"));m=u.innerHeight-(v.spaceAbove-u.css.paddingTop)-(v.spaceBelow-u.css.paddingBottom);if(!p.is(":visible")||v.height!=m){var x=p,l=x;f(x)?l=y[x]:x.jquery||(l=b(x));x=O(l,m);l.css({height:x, -visibility:"visible"});0<x&&0<l.innerWidth()?l.data("autoHidden")&&(l.show().data("autoHidden",!1),G.mozilla||l.css(k.hidden).css(k.visible)):l.data("autoHidden")||l.hide().data("autoHidden",!0);v.height=m}q.initialized&&C("onsizecontent_end",e)}})}},qa=function(a){a=(a=A.call(this,a))?a.split(","):k.borderPanes;b.each(a,function(a,d){var e=r[d],g=q[d],h=y[d],j=F[d],p=P[d],u;if(h&&j){var l=k[d].dir,x=g.isClosed?"_closed":"_open",B=e["spacing"+x],z=e["togglerAlign"+x],x=e["togglerLength"+x],A;if(0=== -B)j.hide();else{!g.noRoom&&!g.isHidden&&j.show();"horz"===l?(A=v.innerWidth,g.resizerLength=A,h=b.layout.cssNum(h,"left"),j.css({width:Q(j,A),height:O(j,B),left:-9999<h?h:v.inset.left})):(A=h.outerHeight(),g.resizerLength=A,j.css({height:O(j,A),width:Q(j,B),top:v.inset.top+ga("north",!0)}));da(e,j);if(p){if(0===x||g.isSliding&&e.hideTogglerOnSlide){p.hide();return}p.show();if(!(0<x)||"100%"===x||x>A)x=A,z=0;else if(f(z))switch(z){case "top":case "left":z=0;break;case "bottom":case "right":z=A-x;break; -default:z=c((A-x)/2)}else h=parseInt(z,10),z=0<=z?h:A-x+h;if("horz"===l){var D=Q(p,x);p.css({width:D,height:O(p,B),left:z,top:0});p.children(".content").each(function(){u=b(this);u.css("marginLeft",c((D-u.outerWidth())/2))})}else{var C=O(p,x);p.css({height:C,width:Q(p,B),top:z,left:0});p.children(".content").each(function(){u=b(this);u.css("marginTop",c((C-u.outerHeight())/2))})}da(0,p)}if(!q.initialized&&(e.initHidden||g.isHidden))j.hide(),p&&p.hide()}}})},pb=function(a){if(H()){var b=A.call(this, -a);a=P[b];var d=r[b];a&&(d.closable=!0,a.bind("click."+K,function(a){a.stopPropagation();na(b)}).css("visibility","visible").css("cursor","pointer").attr("title",q[b].isClosed?d.tips.Open:d.tips.Close).show())}},Va=function(a,d){b.layout.plugins.buttons&&b.each(q[a].pins,function(c,f){b.layout.buttons.setPinState(z,b(f),a,d)})},u=b(this).eq(0);if(!u.length)return ca(r.errors.containerMissing);if(u.data("layoutContainer")&&u.data("layout"))return u.data("layout");var y={},U={},F={},P={},ea=b([]),v= -q.container,K=q.id,z={options:r,state:q,container:u,panes:y,contents:U,resizers:F,togglers:P,hide:Ta,show:Fa,toggle:na,open:ra,close:ja,slideOpen:sb,slideClose:Wa,slideToggle:function(a){a=A.call(this,a);na(a,!0)},setSizeLimits:Y,_sizePane:ka,sizePane:Ca,sizeContent:pa,swapPanes:function(a,c){function f(a){var d=y[a],c=U[a];return!d?!1:{pane:a,P:d?d[0]:!1,C:c?c[0]:!1,state:b.extend(!0,{},q[a]),options:b.extend(!0,{},r[a])}}function h(a,c){if(a){var e=a.P,f=a.C,g=a.pane,j=k[c],m=b.extend(!0,{},q[c]), -n=r[c],w={resizerCursor:n.resizerCursor};b.each(["fxName","fxSpeed","fxSettings"],function(a,b){w[b+"_open"]=n[b+"_open"];w[b+"_close"]=n[b+"_close"];w[b+"_size"]=n[b+"_size"]});y[c]=b(e).data({layoutPane:z[c],layoutEdge:c}).css(k.hidden).css(j.cssReq);U[c]=f?b(f):!1;r[c]=b.extend(!0,{},a.options,w);q[c]=b.extend(!0,{},a.state);e.className=e.className.replace(RegExp(n.paneClass+"-"+g,"g"),n.paneClass+"-"+c);Pa(c);j.dir!=k[g].dir?(e=p[c]||0,Y(c),e=d(e,q[c].minSize),Ca(c,e,!0,!0)):F[c].css(j.side,v.inset[j.side]+ -(q[c].isVisible?ga(c):0));a.state.isVisible&&!m.isVisible?Ua(c,!0):(Da(c),ma(c,!0));a=null}}if(H()){var g=A.call(this,a);q[g].edge=c;q[c].edge=g;if(!1===C("onswap_start",g)||!1===C("onswap_start",c))q[g].edge=g,q[c].edge=c;else{var j=f(g),n=f(c),p={};p[g]=j?j.state.size:0;p[c]=n?n.state.size:0;y[g]=!1;y[c]=!1;q[g]={};q[c]={};P[g]&&P[g].remove();P[c]&&P[c].remove();F[g]&&F[g].remove();F[c]&&F[c].remove();F[g]=F[c]=P[g]=P[c]=!1;h(j,c);h(n,g);j=n=p=null;y[g]&&y[g].css(k.visible);y[c]&&y[c].css(k.visible); -oa();C("onswap_end",g);C("onswap_end",c)}}},showMasks:va,hideMasks:za,initContent:Sa,addPane:ib,removePane:Ra,createChildren:Qa,refreshChildren:Ba,enableClosable:pb,disableClosable:function(a,b){if(H()){var c=A.call(this,a),d=P[c];d&&(r[c].closable=!1,q[c].isClosed&&ra(c,!1,!0),d.unbind("."+K).css("visibility",b?"hidden":"visible").css("cursor","default").attr("title",""))}},enableSlidable:function(a){if(H()){a=A.call(this,a);var b=F[a];b&&b.data("draggable")&&(r[a].slidable=!0,q[a].isClosed&&ma(a, -!0))}},disableSlidable:function(a){if(H()){a=A.call(this,a);var b=F[a];b&&(r[a].slidable=!1,q[a].isSliding?ja(a,!1,!0):(ma(a,!1),b.css("cursor","default").attr("title",""),da(null,b[0])))}},enableResizable:function(a){if(H()){a=A.call(this,a);var b=F[a],c=r[a];b&&b.data("draggable")&&(c.resizable=!0,b.draggable("enable"),q[a].isClosed||b.css("cursor",c.resizerCursor).attr("title",c.tips.Resize))}},disableResizable:function(a){if(H()){a=A.call(this,a);var b=F[a];b&&b.data("draggable")&&(r[a].resizable= -!1,b.draggable("disable").css("cursor","default").attr("title",""),da(null,b[0]))}},allowOverflow:x,resetOverflow:X,destroy:function(a,c){b(window).unbind("."+K);b(document).unbind("."+K);"object"===typeof a?A(a):c=a;u.clearQueue().removeData("layout").removeData("layoutContainer").removeClass(r.containerClass).unbind("."+K);ea.remove();b.each(k.allPanes,function(a,b){Ra(b,!1,!0,c)});u.data("layoutCSS")&&!u.data("layoutRole")&&u.css(u.data("layoutCSS")).removeData("layoutCSS");"BODY"===v.tagName&& -(u=b("html")).data("layoutCSS")&&u.css(u.data("layoutCSS")).removeData("layoutCSS");j(z,b.layout.onDestroy);mb();for(var d in z)d.match(/^(container|options)$/)||delete z[d];z.destroyed=!0;return z},initPanes:H,resizeAll:oa,runCallbacks:C,hasParentLayout:!1,children:ba,north:!1,south:!1,west:!1,east:!1,center:!1},Xa;var V,Ya,N,Ha,la,sa,W;h=b.layout.transformData(h,!0);h=b.layout.backwardCompatibility.renameAllOptions(h);if(!b.isEmptyObject(h.panes)){V=b.layout.optionsMap.noDefault;la=0;for(sa=V.length;la< -sa;la++)N=V[la],delete h.panes[N];V=b.layout.optionsMap.layout;la=0;for(sa=V.length;la<sa;la++)N=V[la],delete h.panes[N]}V=b.layout.optionsMap.layout;var Bb=b.layout.config.optionRootKeys;for(N in h)Ha=h[N],0>b.inArray(N,Bb)&&0>b.inArray(N,V)&&(h.panes[N]||(h.panes[N]=b.isPlainObject(Ha)?b.extend(!0,{},Ha):Ha),delete h[N]);b.extend(!0,r,h);b.each(k.allPanes,function(a,c){k[c]=b.extend(!0,{},k.panes,k[c]);Ya=r.panes;W=r[c];if("center"===c){V=b.layout.optionsMap.center;a=0;for(sa=V.length;a<sa;a++)if(N= -V[a],!h.center[N]&&(h.panes[N]||!W[N]))W[N]=Ya[N]}else{W=r[c]=b.extend(!0,{},Ya,W);var d=r[c],f=r.panes;d.fxSettings||(d.fxSettings={});f.fxSettings||(f.fxSettings={});b.each(["_open","_close","_size"],function(a,e){var h="fxName"+e,j="fxSpeed"+e,k="fxSettings"+e,l=d[h]=d[h]||f[h]||d.fxName||f.fxName||"none",p=b.effects&&(b.effects[l]||b.effects.effect&&b.effects.effect[l]);if("none"===l||!r.effects[l]||!p)l=d[h]="none";l=r.effects[l]||{};h=l.all||null;l=l[c]||null;d[j]=d[j]||f[j]||d.fxSpeed||f.fxSpeed|| -null;d[k]=b.extend(!0,{},h,l,f.fxSettings,d.fxSettings,f[k],d[k])});delete d.fxName;delete d.fxSpeed;delete d.fxSettings;W.resizerClass||(W.resizerClass="ui-layout-resizer");W.togglerClass||(W.togglerClass="ui-layout-toggler")}W.paneClass||(W.paneClass="ui-layout-pane")});var Ia=h.zIndex,xa=r.zIndexes;0<Ia&&(xa.pane_normal=Ia,xa.content_mask=d(Ia+1,xa.content_mask),xa.resizer_normal=d(Ia+2,xa.resizer_normal));delete r.panes;var Cb=r,tb=q;tb.creatingLayout=!0;j(z,b.layout.onCreate);if(!1===C("onload_start"))Xa= -"cancel";else{var Za=u[0],$=b("html"),ub=v.tagName=Za.tagName,vb=v.id=Za.id,wb=v.className=Za.className,L=r,Ja=L.name,$a={},Ka=u.data("parentLayout"),La=u.data("layoutEdge"),ab=Ka&&La,ta=b.layout.cssNum,bb,aa;v.selector=u.selector.split(".slice")[0];v.ref=(L.name?L.name+" layout / ":"")+ub+(vb?"#"+vb:wb?".["+wb+"]":"");v.isBody="BODY"===ub;!ab&&!v.isBody&&(bb=u.closest("."+b.layout.defaults.panes.paneClass),Ka=bb.data("parentLayout"),La=bb.data("layoutEdge"),ab=Ka&&La);u.data({layout:z,layoutContainer:K}).addClass(L.containerClass); -var xb={destroy:"",initPanes:"",resizeAll:"resizeAll",resize:"resizeAll"};for(Ja in xb)u.bind("layout"+Ja.toLowerCase()+"."+K,z[xb[Ja]||Ja]);ab&&(z.hasParentLayout=!0,Ka.refreshChildren(La,z));u.data("layoutCSS")||(v.isBody?(u.data("layoutCSS",b.extend(D(u,"position,margin,padding,border"),{height:u.css("height"),overflow:u.css("overflow"),overflowX:u.css("overflowX"),overflowY:u.css("overflowY")})),$.data("layoutCSS",b.extend(D($,"padding"),{height:"auto",overflow:$.css("overflow"),overflowX:$.css("overflowX"), -overflowY:$.css("overflowY")}))):u.data("layoutCSS",D(u,"position,margin,padding,border,top,bottom,left,right,width,height,overflow,overflowX,overflowY")));try{$a={overflow:"hidden",overflowX:"hidden",overflowY:"hidden"};u.css($a);L.inset&&!b.isPlainObject(L.inset)&&(aa=parseInt(L.inset,10)||0,L.inset={top:aa,bottom:aa,left:aa,right:aa});if(v.isBody)L.outset?b.isPlainObject(L.outset)||(aa=parseInt(L.outset,10)||0,L.outset={top:aa,bottom:aa,left:aa,right:aa}):L.outset={top:ta($,"paddingTop"),bottom:ta($, -"paddingBottom"),left:ta($,"paddingLeft"),right:ta($,"paddingRight")},$.css($a).css({height:"100%",border:"none",padding:0,margin:0}),G.isIE6?(u.css({width:"100%",height:"100%",border:"none",padding:0,margin:0,position:"relative"}),L.inset||(L.inset=R(u).inset)):(u.css({width:"auto",height:"auto",margin:0,position:"absolute"}),u.css(L.outset)),b.extend(v,R(u,L.inset));else{var yb=u.css("position");(!yb||!yb.match(/(fixed|absolute|relative)/))&&u.css("position","relative");u.is(":visible")&&(b.extend(v, -R(u,L.inset)),1>v.innerHeight&&ca(L.errors.noContainerHeight.replace(/CONTAINER/,v.ref)))}ta(u,"minWidth")&&u.parent().css("overflowX","auto");ta(u,"minHeight")&&u.parent().css("overflowY","auto")}catch(Db){}nb();b(window).bind("unload."+K,mb);j(z,b.layout.onLoad);Cb.initPanes&&Aa();delete tb.creatingLayout;Xa=q.initialized}return"cancel"===Xa?null:z}})(jQuery); -(function(b){b.ui||(b.ui={});b.ui.cookie={acceptsCookies:!!navigator.cookieEnabled,read:function(a){for(var d=document.cookie,d=d?d.split(";"):[],c,f=0,j=d.length;f<j;f++)if(c=b.trim(d[f]).split("="),c[0]==a)return decodeURIComponent(c[1]);return null},write:function(a,d,c){var f="",j="",h=!1;c=c||{};var p=c.expires||null,x=b.type(p);"date"===x?j=p:"string"===x&&0<p&&(p=parseInt(p,10),x="number");"number"===x&&(j=new Date,0<p?j.setDate(j.getDate()+p):(j.setFullYear(1970),h=!0));j&&(f+=";expires="+ -j.toUTCString());c.path&&(f+=";path="+c.path);c.domain&&(f+=";domain="+c.domain);c.secure&&(f+=";secure");document.cookie=a+"="+(h?"":encodeURIComponent(d))+f},clear:function(a){b.ui.cookie.write(a,"",{expires:-1})}};b.cookie||(b.cookie=function(a,d,c){var f=b.ui.cookie;if(null===d)f.clear(a);else{if(void 0===d)return f.read(a);f.write(a,d,c)}});b.layout.plugins.stateManagement=!0;b.layout.config.optionRootKeys.push("stateManagement");b.layout.defaults.stateManagement={enabled:!1,autoSave:!0,autoLoad:!0, -animateLoad:!0,includeChildren:!0,stateKeys:"north.size,south.size,east.size,west.size,north.isClosed,south.isClosed,east.isClosed,west.isClosed,north.isHidden,south.isHidden,east.isHidden,west.isHidden",cookie:{name:"",domain:"",path:"",expires:"",secure:!1}};b.layout.optionsMap.layout.push("stateManagement");b.layout.state={saveCookie:function(a,d,c){var f=a.options,j=f.stateManagement;c=b.extend(!0,{},j.cookie,c||null);a=a.state.stateData=a.readState(d||j.stateKeys);b.ui.cookie.write(c.name||f.name|| -"Layout",b.layout.state.encodeJSON(a),c);return b.extend(!0,{},a)},deleteCookie:function(a){a=a.options;b.ui.cookie.clear(a.stateManagement.cookie.name||a.name||"Layout")},readCookie:function(a){a=a.options;return(a=b.ui.cookie.read(a.stateManagement.cookie.name||a.name||"Layout"))?b.layout.state.decodeJSON(a):{}},loadCookie:function(a){var d=b.layout.state.readCookie(a);d&&(a.state.stateData=b.extend(!0,{},d),a.loadState(d));return d},loadState:function(a,d,c){if(b.isPlainObject(d)&&!b.isEmptyObject(d))if(d= -a.state.stateData=b.layout.transformData(d),c=b.extend({animateLoad:!1,includeChildren:a.options.stateManagement.includeChildren},c),a.state.initialized){var f=!c.animateLoad,j,h,p,x;b.each(b.layout.config.borderPanes,function(c,G){S=d[G];b.isPlainObject(S)&&(s=S.size,j=S.initClosed,h=S.initHidden,ar=S.autoResize,p=a.state[G],x=p.isVisible,ar&&(p.autoResize=ar),x||a._sizePane(G,s,!1,!1,!1),!0===h?a.hide(G,f):!0===j?a.close(G,!1,f):!1===j?a.open(G,!1,f):!1===h&&a.show(G,!1,f),x&&a._sizePane(G,s,!1, -!1,f))});if(c.includeChildren){var I,T;b.each(a.children,function(a,c){(I=d[a]?d[a].children:0)&&c&&b.each(c,function(a,b){T=I[a];b&&T&&b.loadState(T)})})}}else{var S=b.extend(!0,{},d);b.each(b.layout.config.allPanes,function(a,b){S[b]&&delete S[b].children});b.extend(!0,a.options,S)}},readState:function(a,d){"string"===b.type(d)&&(d={keys:d});d||(d={});var c=a.options.stateManagement,f=d.includeChildren,f=void 0!==f?f:c.includeChildren,c=d.stateKeys||c.stateKeys,j={isClosed:"initClosed",isHidden:"initHidden"}, -h=a.state,p=b.layout.config.allPanes,x={},I,T,S,X,G,k;b.isArray(c)&&(c=c.join(","));for(var c=c.replace(/__/g,".").split(","),Q=0,O=c.length;Q<O;Q++)I=c[Q].split("."),T=I[0],I=I[1],0>b.inArray(T,p)||(S=h[T][I],void 0!=S&&("isClosed"==I&&h[T].isSliding&&(S=!0),(x[T]||(x[T]={}))[j[I]?j[I]:I]=S));f&&b.each(p,function(c,d){G=a.children[d];X=h.stateData[d];b.isPlainObject(G)&&!b.isEmptyObject(G)&&(k=x[d]||(x[d]={}),k.children||(k.children={}),b.each(G,function(a,c){c.state.initialized?k.children[a]=b.layout.state.readState(c): -X&&(X.children&&X.children[a])&&(k.children[a]=b.extend(!0,{},X.children[a]))}))});return x},encodeJSON:function(a){function d(a){var f=[],j=0,h,p,x,I=b.isArray(a);for(h in a)p=a[h],x=typeof p,"string"==x?p='"'+p+'"':"object"==x&&(p=d(p)),f[j++]=(!I?'"'+h+'":':"")+p;return(I?"[":"{")+f.join(",")+(I?"]":"}")}return d(a)},decodeJSON:function(a){try{return b.parseJSON?b.parseJSON(a):window.eval("("+a+")")||{}}catch(d){return{}}},_create:function(a){var d=b.layout.state,c=a.options.stateManagement;b.extend(a, -{readCookie:function(){return d.readCookie(a)},deleteCookie:function(){d.deleteCookie(a)},saveCookie:function(b,c){return d.saveCookie(a,b,c)},loadCookie:function(){return d.loadCookie(a)},loadState:function(b,c){d.loadState(a,b,c)},readState:function(b){return d.readState(a,b)},encodeJSON:d.encodeJSON,decodeJSON:d.decodeJSON});a.state.stateData={};if(c.autoLoad)if(b.isPlainObject(c.autoLoad))b.isEmptyObject(c.autoLoad)||a.loadState(c.autoLoad);else if(c.enabled)if(b.isFunction(c.autoLoad)){var f= -{};try{f=c.autoLoad(a,a.state,a.options,a.options.name||"")}catch(j){}f&&(b.isPlainObject(f)&&!b.isEmptyObject(f))&&a.loadState(f)}else a.loadCookie()},_unload:function(a){var d=a.options.stateManagement;if(d.enabled&&d.autoSave)if(b.isFunction(d.autoSave))try{d.autoSave(a,a.state,a.options,a.options.name||"")}catch(c){}else a.saveCookie()}};b.layout.onCreate.push(b.layout.state._create);b.layout.onUnload.push(b.layout.state._unload);b.layout.plugins.buttons=!0;b.layout.defaults.autoBindCustomButtons= -!1;b.layout.optionsMap.layout.push("autoBindCustomButtons");b.layout.buttons={init:function(a){var d=a.options.name||"",c;b.each("toggle open close pin toggle-slide open-slide".split(" "),function(f,j){b.each(b.layout.config.borderPanes,function(f,p){b(".ui-layout-button-"+j+"-"+p).each(function(){c=b(this).data("layoutName")||b(this).attr("layoutName");(void 0==c||c===d)&&a.bindButton(this,j,p)})})})},get:function(a,d,c,f){var j=b(d);a=a.options;var h=a.errors.addButtonError;j.length?0>b.inArray(c, -b.layout.config.borderPanes)?(b.layout.msg(h+" "+a.errors.pane+": "+c,!0),j=b("")):(d=a[c].buttonClass+"-"+f,j.addClass(d+" "+d+"-"+c).data("layoutName",a.name)):b.layout.msg(h+" "+a.errors.selector+": "+d,!0);return j},bind:function(a,d,c,f){var j=b.layout.buttons;switch(c.toLowerCase()){case "toggle":j.addToggle(a,d,f);break;case "open":j.addOpen(a,d,f);break;case "close":j.addClose(a,d,f);break;case "pin":j.addPin(a,d,f);break;case "toggle-slide":j.addToggle(a,d,f,!0);break;case "open-slide":j.addOpen(a, -d,f,!0)}return a},addToggle:function(a,d,c,f){b.layout.buttons.get(a,d,c,"toggle").click(function(b){a.toggle(c,!!f);b.stopPropagation()});return a},addOpen:function(a,d,c,f){b.layout.buttons.get(a,d,c,"open").attr("title",a.options[c].tips.Open).click(function(b){a.open(c,!!f);b.stopPropagation()});return a},addClose:function(a,d,c){b.layout.buttons.get(a,d,c,"close").attr("title",a.options[c].tips.Close).click(function(b){a.close(c);b.stopPropagation()});return a},addPin:function(a,d,c){var f=b.layout.buttons, -j=f.get(a,d,c,"pin");if(j.length){var h=a.state[c];j.click(function(d){f.setPinState(a,b(this),c,h.isSliding||h.isClosed);h.isSliding||h.isClosed?a.open(c):a.close(c);d.stopPropagation()});f.setPinState(a,j,c,!h.isClosed&&!h.isSliding);h.pins.push(d)}return a},setPinState:function(a,b,c,f){var j=b.attr("pin");if(!(j&&f===("down"==j))){a=a.options[c];var j=a.buttonClass+"-pin",h=j+"-"+c;c=j+"-up "+h+"-up";j=j+"-down "+h+"-down";b.attr("pin",f?"down":"up").attr("title",f?a.tips.Unpin:a.tips.Pin).removeClass(f? -c:j).addClass(f?j:c)}},syncPinBtns:function(a,d,c){b.each(a.state[d].pins,function(f,j){b.layout.buttons.setPinState(a,b(j),d,c)})},_load:function(a){var d=b.layout.buttons;b.extend(a,{bindButton:function(b,c,h){return d.bind(a,b,c,h)},addToggleBtn:function(b,c,h){return d.addToggle(a,b,c,h)},addOpenBtn:function(b,c,h){return d.addOpen(a,b,c,h)},addCloseBtn:function(b,c){return d.addClose(a,b,c)},addPinBtn:function(b,c){return d.addPin(a,b,c)}});for(var c=0;4>c;c++)a.state[b.layout.config.borderPanes[c]].pins= -[];a.options.autoBindCustomButtons&&d.init(a)},_unload:function(){}};b.layout.onLoad.push(b.layout.buttons._load);b.layout.plugins.browserZoom=!0;b.layout.defaults.browserZoomCheckInterval=1E3;b.layout.optionsMap.layout.push("browserZoomCheckInterval");b.layout.browserZoom={_init:function(a){!1!==b.layout.browserZoom.ratio()&&b.layout.browserZoom._setTimer(a)},_setTimer:function(a){if(!a.destroyed){var d=a.options,c=a.state,f=a.hasParentLayout?5E3:Math.max(d.browserZoomCheckInterval,100);setTimeout(function(){if(!a.destroyed&& -d.resizeWithWindow){var f=b.layout.browserZoom.ratio();f!==c.browserZoom&&(c.browserZoom=f,a.resizeAll());b.layout.browserZoom._setTimer(a)}},f)}},ratio:function(){function a(a,b){return(100*(parseInt(a,10)/parseInt(b,10))).toFixed()}var d=window,c=screen,f=document,j=f.documentElement||f.body,h=b.layout.browser,p=h.version,x,I,T;return h.msie&&8<p||!h.msie?!1:c.deviceXDPI&&c.systemXDPI?a(c.deviceXDPI,c.systemXDPI):h.webkit&&(x=f.body.getBoundingClientRect)?a(x.left-x.right,f.body.offsetWidth):h.webkit&& -(I=d.outerWidth)?a(I,d.innerWidth):(I=c.width)&&(T=j.clientWidth)?a(I,T):!1}};b.layout.onReady.push(b.layout.browserZoom._init)})(jQuery); \ No newline at end of file diff --git a/libs/plasio/vendor/jquery.nouislider.min.js b/libs/plasio/vendor/jquery.nouislider.min.js deleted file mode 100644 index 97443640..00000000 --- a/libs/plasio/vendor/jquery.nouislider.min.js +++ /dev/null @@ -1,20 +0,0 @@ -(function(f){if(f.zepto&&!f.fn.removeData)throw new ReferenceError("Zepto is loaded without the data module.");f.fn.noUiSlider=function(C,D){function s(a,b){return 100*b/(a[1]-a[0])}function E(a,b){return b*(a[1]-a[0])/100+a[0]}function t(a){return a instanceof f||f.zepto&&f.zepto.isZ(a)}function n(a){return!isNaN(parseFloat(a))&&isFinite(a)}function r(a,b){f.isArray(a)||(a=[a]);f.each(a,function(){"function"===typeof this&&this.call(b)})}function F(a,b){return function(){var c=[null,null];c[b]=f(this).val(); -a.val(c,!0)}}function G(a,b){a=a.toFixed(b.decimals);0===parseFloat(a)&&(a=a.replace("-0","0"));return a.replace(".",b.serialization.mark)}function u(a){return parseFloat(a.toFixed(7))}function p(a,b,c,d){var e=d.target;a=a.replace(/\s/g,h+" ")+h;b.on(a,function(a){var b=e.attr("disabled");if(e.hasClass("noUi-state-tap")||void 0!==b&&null!==b)return!1;var g;a.preventDefault();var b=0===a.type.indexOf("touch"),h=0===a.type.indexOf("mouse"),l=0===a.type.indexOf("pointer"),v,H=a;0===a.type.indexOf("MSPointer")&& -(l=!0);a.originalEvent&&(a=a.originalEvent);b&&(g=a.changedTouches[0].pageX,v=a.changedTouches[0].pageY);if(h||l)l||void 0!==window.pageXOffset||(window.pageXOffset=document.documentElement.scrollLeft,window.pageYOffset=document.documentElement.scrollTop),g=a.clientX+window.pageXOffset,v=a.clientY+window.pageYOffset;g=f.extend(H,{pointX:g,pointY:v,cursor:h});c(g,d,e.data("base").data("options"))})}function I(a){var b=this.target;if(void 0===a)return this.element.data("value");!0===a?a=this.element.data("value"): -this.element.data("value",a);void 0!==a&&f.each(this.elements,function(){if("function"===typeof this)this.call(b,a);else this[0][this[1]](a)})}function J(a,b,c){if(t(b)){var d=[],e=a.data("target");a.data("options").direction&&(c=c?0:1);b.each(function(){f(this).on("change"+h,F(e,c));d.push([f(this),"val"])});return d}"string"===typeof b&&(b=[f('<input type="hidden" name="'+b+'">').appendTo(a).addClass(g[3]).change(function(a){a.stopPropagation()}),"val"]);return[b]}function K(a,b,c){var d=[];f.each(c.to[b], -function(e){d=d.concat(J(a,c.to[b][e],b))});return{element:a,elements:d,target:a.data("target"),val:I}}function L(a,b){var c=a.data("target");c.hasClass(g[14])||(b||(c.addClass(g[15]),setTimeout(function(){c.removeClass(g[15])},450)),c.addClass(g[14]),r(a.data("options").h,c))}function w(a,b){var c=a.data("options");b=u(b);a.data("target").removeClass(g[14]);a.css(c.style,b+"%").data("pct",b);a.is(":first-child")&&a.toggleClass(g[13],50<b);c.direction&&(b=100-b);a.data("store").val(G(E(c.range,b), -c))}function x(a,b){var c=a.data("base"),d=c.data("options"),c=c.data("handles"),e=0,k=100;if(!n(b))return!1;if(d.step){var m=d.step;b=Math.round(b/m)*m}1<c.length&&(a[0]!==c[0][0]?e=u(c[0].data("pct")+d.margin):k=u(c[1].data("pct")-d.margin));b=Math.min(Math.max(b,e),0>k?100:k);if(b===a.data("pct"))return[e?e:!1,100===k?!1:k];w(a,b);return!0}function A(a,b,c,d){a.addClass(g[5]);setTimeout(function(){a.removeClass(g[5])},300);x(b,c);r(d,a.data("target"));a.data("target").change()}function M(a,b,c){var d= -b.a,e=a[b.d]-b.start[b.d],e=100*e/b.size;if(1===d.length){if(a=x(d[0],b.c[0]+e),!0!==a){0<=f.inArray(d[0].data("pct"),a)&&L(b.b,!c.margin);return}}else{var k,m;c.step&&(a=c.step,e=Math.round(e/a)*a);a=k=b.c[0]+e;e=m=b.c[1]+e;0>a?(e+=-1*a,a=0):100<e&&(a-=e-100,e=100);if(0>k&&!a&&!d[0].data("pct")||100===e&&100<m&&100===d[1].data("pct"))return;w(d[0],a);w(d[1],e)}r(c.slide,b.target)}function N(a,b,c){1===b.a.length&&b.a[0].data("grab").removeClass(g[4]);a.cursor&&y.css("cursor","").off(h);z.off(h); -b.target.removeClass(g[14]+" "+g[20]).change();r(c.set,b.target)}function B(a,b,c){1===b.a.length&&b.a[0].data("grab").addClass(g[4]);a.stopPropagation();p(q.move,z,M,{start:a,b:b.b,target:b.target,a:b.a,c:[b.a[0].data("pct"),b.a[b.a.length-1].data("pct")],d:c.orientation?"pointY":"pointX",size:c.orientation?b.b.height():b.b.width()});p(q.end,z,N,{target:b.target,a:b.a});a.cursor&&(y.css("cursor",f(a.target).css("cursor")),1<b.a.length&&b.target.addClass(g[20]),y.on("selectstart"+h,function(){return!1}))} -function O(a,b,c){b=b.b;var d,e;a.stopPropagation();c.orientation?(a=a.pointY,e=b.height()):(a=a.pointX,e=b.width());d=b.data("handles");var k=a,m=c.style;1===d.length?d=d[0]:(m=d[0].offset()[m]+d[1].offset()[m],d=d[k<m/2?0:1]);a=100*(a-b.offset()[c.style])/e;A(b,d,a,[c.slide,c.set])}function P(a,b,c){var d=b.b.data("handles"),e;e=c.orientation?a.pointY:a.pointX;a=(e=e<b.b.offset()[c.style])?0:100;e=e?0:d.length-1;A(b.b,d[e],a,[c.slide,c.set])}function Q(a,b){function c(a){if(2!==a.length)return!1; -a=[parseFloat(a[0]),parseFloat(a[1])];return!n(a[0])||!n(a[1])||a[1]<a[0]?!1:a}var d={f:function(a,b){switch(a){case 1:case 0.1:case 0.01:case 0.001:case 1E-4:case 1E-5:a=a.toString().split(".");b.decimals="1"===a[0]?0:a[1].length;break;case void 0:b.decimals=2;break;default:return!1}return!0},e:function(a,b,c){if(!a)return b[c].mark=".",!0;switch(a){case ".":case ",":return!0;default:return!1}},g:function(a,b,c){function d(a){return t(a)||"string"===typeof a||"function"===typeof a||!1===a||t(a[0])&& -"function"===typeof a[0][a[1]]}function g(a){var b=[[],[]];d(a)?b[0].push(a):f.each(a,function(a,e){1<a||(d(e)?b[a].push(e):b[a]=b[a].concat(e))});return b}if(a){var l,h;a=g(a);b.direction&&a[1].length&&a.reverse();for(l=0;l<b.handles;l++)for(h=0;h<a[l].length;h++){if(!d(a[l][h]))return!1;a[l][h]||a[l].splice(h,1)}b[c].to=a}else b[c].to=[[],[]];return!0}};f.each({handles:{r:!0,t:function(a){a=parseInt(a,10);return 1===a||2===a}},range:{r:!0,t:function(a,b,d){b[d]=c(a);return b[d]&&b[d][0]!==b[d][1]}}, -start:{r:!0,t:function(a,b,d){if(1===b.handles)return f.isArray(a)&&(a=a[0]),a=parseFloat(a),b.start=[a],n(a);b[d]=c(a);return!!b[d]}},connect:{r:!0,t:function(a,b,c){if("lower"===a)b[c]=1;else if("upper"===a)b[c]=2;else if(!0===a)b[c]=3;else if(!1===a)b[c]=0;else return!1;return!0}},orientation:{t:function(a,b,c){switch(a){case "horizontal":b[c]=0;break;case "vertical":b[c]=1;break;default:return!1}return!0}},margin:{r:!0,t:function(a,b,c){a=parseFloat(a);b[c]=s(b.range,a);return n(a)}},direction:{r:!0, -t:function(a,b,c){switch(a){case "ltr":b[c]=0;break;case "rtl":b[c]=1;b.connect=[0,2,1,3][b.connect];break;default:return!1}return!0}},behaviour:{r:!0,t:function(a,b,c){b[c]={tap:a!==(a=a.replace("tap","")),extend:a!==(a=a.replace("extend","")),drag:a!==(a=a.replace("drag","")),fixed:a!==(a=a.replace("fixed",""))};return!a.replace("none","").replace(/\-/g,"")}},serialization:{r:!0,t:function(a,b,c){return d.g(a.to,b,c)&&d.f(a.resolution,b)&&d.e(a.mark,b,c)}},slide:{t:function(a){return f.isFunction(a)}}, -set:{t:function(a){return f.isFunction(a)}},block:{t:function(a){return f.isFunction(a)}},step:{t:function(a,b,c){a=parseFloat(a);b[c]=s(b.range,a);return n(a)}}},function(c,d){var f=a[c],g=void 0!==f;if(d.r&&!g||g&&!d.t(f,a,c))throw console&&console.log&&console.group&&(console.group("Invalid noUiSlider initialisation:"),console.log("Option:\t",c),console.log("Value:\t",f),console.log("Slider(s):\t",b),console.groupEnd()),new RangeError("noUiSlider");})}function R(a){this.data("options",f.extend(!0, -{},a));a=f.extend({handles:2,margin:0,connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal"},a);a.serialization=a.serialization||{};Q(a,this);a.style=a.orientation?"top":"left";return this.each(function(){var b=f(this),c,d=[],e,k=f("<div/>").appendTo(b);if(b.data("base"))throw Error("Slider was already initialized.");b.data("base",k).addClass([g[6],g[16+a.direction],g[10+a.orientation]].join(" "));for(c=0;c<a.handles;c++)e=f("<div><div/></div>").appendTo(k),e.addClass(g[1]),e.children().addClass([g[2], -g[2]+g[7+a.direction+(a.direction?-1*c:c)]].join(" ")),e.data({base:k,target:b,options:a,grab:e.children(),pct:-1}).attr("data-style",a.style),e.data({store:K(e,c,a.serialization)}),d.push(e);switch(a.connect){case 1:b.addClass(g[9]);d[0].addClass(g[12]);break;case 3:d[1].addClass(g[12]);case 2:d[0].addClass(g[9]);case 0:b.addClass(g[12])}k.addClass(g[0]).data({target:b,options:a,handles:d});b.val(a.start);if(!a.behaviour.fixed)for(c=0;c<d.length;c++)p(q.start,d[c].children(),B,{b:k,target:b,a:[d[c]]}); -a.behaviour.tap&&p(q.start,k,O,{b:k,target:b});a.behaviour.extend&&(b.addClass(g[19]),a.behaviour.tap&&p(q.start,b,P,{b:k,target:b}));a.behaviour.drag&&(c=k.find("."+g[9]).addClass(g[18]),a.behaviour.fixed&&(c=c.add(k.children().not(c).data("grab"))),p(q.start,c,B,{b:k,target:b,a:d}))})}function S(){var a=f(this).data("base"),b=[];f.each(a.data("handles"),function(){b.push(f(this).data("store").val())});return 1===b.length?b[0]:a.data("options").direction?b.reverse():b}function T(a,b){f.isArray(a)|| -(a=[a]);return this.each(function(){var c=f(this).data("base"),d,e=Array.prototype.slice.call(c.data("handles"),0),g=c.data("options");1<e.length&&(e[2]=e[0]);g.direction&&a.reverse();for(c=0;c<e.length;c++)if(d=a[c%2],null!==d&&void 0!==d){"string"===f.type(d)&&(d=d.replace(",","."));var h=g.range;d=parseFloat(d);d=s(h,0>h[0]?d+Math.abs(h[0]):d-h[0]);g.direction&&(d=100-d);!0!==x(e[c],d)&&e[c].data("store").val(!0);!0===b&&r(g.set,f(this))}})}function U(a){var b=[[a,""]];f.each(a.data("base").data("handles"), -function(){b=b.concat(f(this).data("store").elements)});f.each(b,function(){1<this.length&&this[0].off(h)});a.removeClass(g.join(" "));a.empty().removeData("base options")}function V(a){return this.each(function(){var b=f(this).val()||!1,c=f(this).data("options"),d=f.extend({},c,a);!1!==b&&U(f(this));a&&(f(this).noUiSlider(d),!1!==b&&d.start===c.start&&f(this).val(b))})}var z=f(document),y=f("body"),h=".nui",W=f.fn.val,g="noUi-base noUi-origin noUi-handle noUi-input noUi-active noUi-state-tap noUi-target -lower -upper noUi-connect noUi-horizontal noUi-vertical noUi-background noUi-stacking noUi-block noUi-state-blocked noUi-ltr noUi-rtl noUi-dragable noUi-extended noUi-state-drag".split(" "), -q=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"};f.fn.val=function(){return this.hasClass(g[6])?arguments.length?T.apply(this,arguments):S.apply(this):W.apply(this,arguments)};return(D?V:R).call(this,C)}})(window.jQuery||window.Zepto); \ No newline at end of file diff --git a/libs/plasio/vendor/jquery.ui.js b/libs/plasio/vendor/jquery.ui.js deleted file mode 100644 index 264fc53e..00000000 --- a/libs/plasio/vendor/jquery.ui.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! jQuery UI - v1.10.4 - 2014-02-28 -* http://jqueryui.com -* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.resizable.js, jquery.ui.button.js, jquery.ui.dialog.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.tooltip.js -* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ - -(function(e,t){function i(t,i){var s,a,o,r=t.nodeName.toLowerCase();return"area"===r?(s=t.parentNode,a=s.name,t.href&&a&&"map"===s.nodeName.toLowerCase()?(o=e("img[usemap=#"+a+"]")[0],!!o&&n(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||i:i)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var s=0,a=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,n){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var n,s,a=e(this[0]);a.length&&a[0]!==document;){if(n=a.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(s=parseInt(a.css("zIndex"),10),!isNaN(s)&&0!==s))return s;a=a.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){a.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,n){return!!e.data(t,n[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),s=isNaN(n);return(s||n>=0)&&i(t,!s)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,n){function s(t,i,n,s){return e.each(a,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var a="Width"===n?["Left","Right"]:["Top","Bottom"],o=n.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(i){return i===t?r["inner"+n].call(this):this.each(function(){e(this).css(o,s(this,i)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?r["outer"+n].call(this,t):this.each(function(){e(this).css(o,s(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,n){var s,a=e.ui[t].prototype;for(s in n)a.plugins[s]=a.plugins[s]||[],a.plugins[s].push([i,n[s]])},call:function(e,t,i){var n,s=e.plugins[t];if(s&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;s.length>n;n++)e.options[s[n][0]]&&s[n][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return t[n]>0?!0:(t[n]=1,s=t[n]>0,t[n]=0,s)}})})(jQuery);(function(t,e){var i=0,s=Array.prototype.slice,n=t.cleanData;t.cleanData=function(e){for(var i,s=0;null!=(i=e[s]);s++)try{t(i).triggerHandler("remove")}catch(o){}n(e)},t.widget=function(i,s,n){var o,a,r,h,l={},c=i.split(".")[0];i=i.split(".")[1],o=c+"-"+i,n||(n=s,s=t.Widget),t.expr[":"][o.toLowerCase()]=function(e){return!!t.data(e,o)},t[c]=t[c]||{},a=t[c][i],r=t[c][i]=function(t,i){return this._createWidget?(arguments.length&&this._createWidget(t,i),e):new r(t,i)},t.extend(r,a,{version:n.version,_proto:t.extend({},n),_childConstructors:[]}),h=new s,h.options=t.widget.extend({},h.options),t.each(n,function(i,n){return t.isFunction(n)?(l[i]=function(){var t=function(){return s.prototype[i].apply(this,arguments)},e=function(t){return s.prototype[i].apply(this,t)};return function(){var i,s=this._super,o=this._superApply;return this._super=t,this._superApply=e,i=n.apply(this,arguments),this._super=s,this._superApply=o,i}}(),e):(l[i]=n,e)}),r.prototype=t.widget.extend(h,{widgetEventPrefix:a?h.widgetEventPrefix||i:i},l,{constructor:r,namespace:c,widgetName:i,widgetFullName:o}),a?(t.each(a._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,r,i._proto)}),delete a._childConstructors):s._childConstructors.push(r),t.widget.bridge(i,r)},t.widget.extend=function(i){for(var n,o,a=s.call(arguments,1),r=0,h=a.length;h>r;r++)for(n in a[r])o=a[r][n],a[r].hasOwnProperty(n)&&o!==e&&(i[n]=t.isPlainObject(o)?t.isPlainObject(i[n])?t.widget.extend({},i[n],o):t.widget.extend({},o):o);return i},t.widget.bridge=function(i,n){var o=n.prototype.widgetFullName||i;t.fn[i]=function(a){var r="string"==typeof a,h=s.call(arguments,1),l=this;return a=!r&&h.length?t.widget.extend.apply(null,[a].concat(h)):a,r?this.each(function(){var s,n=t.data(this,o);return n?t.isFunction(n[a])&&"_"!==a.charAt(0)?(s=n[a].apply(n,h),s!==n&&s!==e?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):e):t.error("no such method '"+a+"' for "+i+" widget instance"):t.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var e=t.data(this,o);e?e.option(a||{})._init():t.data(this,o,new n(a,this))}),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(i,s){var n,o,a,r=i;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof i)if(r={},n=i.split("."),i=n.shift(),n.length){for(o=r[i]=t.widget.extend({},this.options[i]),a=0;n.length-1>a;a++)o[n[a]]=o[n[a]]||{},o=o[n[a]];if(i=n.pop(),1===arguments.length)return o[i]===e?null:o[i];o[i]=s}else{if(1===arguments.length)return this.options[i]===e?null:this.options[i];r[i]=s}return this._setOptions(r),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var o,a=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=o=t(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,o=this.widget()),t.each(n,function(n,r){function h(){return i||a.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof r?a[r]:r).apply(a,arguments):e}"string"!=typeof r&&(h.guid=r.guid=r.guid||h.guid||t.guid++);var l=n.match(/^(\w+)\s*(.*)$/),c=l[1]+a.eventNamespace,u=l[2];u?o.delegate(u,c,h):s.bind(c,h)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e)},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}})})(jQuery);(function(t){var e=!1;t(document).mouseup(function(){e=!1}),t.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!e){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?t(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===t.data(i.target,this.widgetName+".preventClickEvent")&&t.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return s._mouseMove(t)},this._mouseUpDelegate=function(t){return s._mouseUp(t)},t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),e=!0,!0)):!0}},_mouseMove:function(e){return t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button?this._mouseUp(e):this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function s(e,i){return parseInt(t.css(e,i),10)||0}function n(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var a,o=Math.max,r=Math.abs,l=Math.round,h=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(a!==e)return a;var i,s,n=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=n.children()[0];return t("body").append(n),i=o.offsetWidth,n.css("overflow","scroll"),s=o.offsetWidth,i===s&&(s=n[0].clientWidth),n.remove(),a=i-s},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,a="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:a?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s?i.width():i.outerWidth(),height:s?i.height():i.outerHeight()}}},t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);e=t.extend({},e);var a,p,g,m,v,_,b=t(e.of),y=t.position.getWithinInfo(e.within),k=t.position.getScrollInfo(y),w=(e.collision||"flip").split(" "),D={};return _=n(b),b[0].preventDefault&&(e.at="left top"),p=_.width,g=_.height,m=_.offset,v=t.extend({},m),t.each(["my","at"],function(){var t,i,s=(e[this]||"").split(" ");1===s.length&&(s=h.test(s[0])?s.concat(["center"]):c.test(s[0])?["center"].concat(s):["center","center"]),s[0]=h.test(s[0])?s[0]:"center",s[1]=c.test(s[1])?s[1]:"center",t=u.exec(s[0]),i=u.exec(s[1]),D[this]=[t?t[0]:0,i?i[0]:0],e[this]=[d.exec(s[0])[0],d.exec(s[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===e.at[0]?v.left+=p:"center"===e.at[0]&&(v.left+=p/2),"bottom"===e.at[1]?v.top+=g:"center"===e.at[1]&&(v.top+=g/2),a=i(D.at,p,g),v.left+=a[0],v.top+=a[1],this.each(function(){var n,h,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=s(this,"marginLeft"),_=s(this,"marginTop"),x=u+f+s(this,"marginRight")+k.width,C=d+_+s(this,"marginBottom")+k.height,M=t.extend({},v),T=i(D.my,c.outerWidth(),c.outerHeight());"right"===e.my[0]?M.left-=u:"center"===e.my[0]&&(M.left-=u/2),"bottom"===e.my[1]?M.top-=d:"center"===e.my[1]&&(M.top-=d/2),M.left+=T[0],M.top+=T[1],t.support.offsetFractions||(M.left=l(M.left),M.top=l(M.top)),n={marginLeft:f,marginTop:_},t.each(["left","top"],function(i,s){t.ui.position[w[i]]&&t.ui.position[w[i]][s](M,{targetWidth:p,targetHeight:g,elemWidth:u,elemHeight:d,collisionPosition:n,collisionWidth:x,collisionHeight:C,offset:[a[0]+T[0],a[1]+T[1]],my:e.my,at:e.at,within:y,elem:c})}),e.using&&(h=function(t){var i=m.left-M.left,s=i+p-u,n=m.top-M.top,a=n+g-d,l={target:{element:b,left:m.left,top:m.top,width:p,height:g},element:{element:c,left:M.left,top:M.top,width:u,height:d},horizontal:0>s?"left":i>0?"right":"center",vertical:0>a?"top":n>0?"bottom":"middle"};u>p&&p>r(i+s)&&(l.horizontal="center"),d>g&&g>r(n+a)&&(l.vertical="middle"),l.important=o(r(i),r(s))>o(r(n),r(a))?"horizontal":"vertical",e.using.call(this,t,l)}),c.offset(t.extend(M,{using:h}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,a=n.offset.left+n.scrollLeft,o=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-o-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-o-a,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>r(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,a=n.offset.top+n.scrollTop,o=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-o-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-o-a,t.top+p+f+g>c&&(0>s||r(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,t.top+p+f+g>u&&(i>0||u>r(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,s,n,a,o=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(o?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(a in s)e.style[a]=s[a];e.appendChild(r),i=o||document.documentElement,i.insertBefore(e,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",n=t(r).offset().left,t.support.offsetFractions=n>10&&11>n,e.innerHTML="",i.removeChild(e)}()})(jQuery);(function(t){t.widget("ui.draggable",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(t(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){t("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(t(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_mouseDrag:function(e,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||t.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1):!1},_mouseUp:function(e){return t("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.element.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,t(document).width()-this.helperProportions.width-this.margins.left,(t(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(e){var i,s,n,a,o=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=e.pageX,h=e.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(h=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,l=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s]),"drag"===e&&(this.positionAbs=this._convertPositionTo("absolute")),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i){var s=t(this).data("ui-draggable"),n=s.options,a=t.extend({},i,{item:s.element});s.sortables=[],t(n.connectToSortable).each(function(){var i=t.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",e,a))})},stop:function(e,i){var s=t(this).data("ui-draggable"),n=t.extend({},i,{item:s.element});t.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(e),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",e,n))})},drag:function(e,i){var s=t(this).data("ui-draggable"),n=this;t.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,t.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&t.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=t(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",e),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(e)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",e),s.dropped=!1)})}}),t.ui.plugin.add("draggable","cursor",{start:function(){var e=t("body"),i=t(this).data("ui-draggable").options;e.css("cursor")&&(i._cursor=e.css("cursor")),e.css("cursor",i.cursor)},stop:function(){var e=t(this).data("ui-draggable").options;e._cursor&&t("body").css("cursor",e._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._opacity&&t(i.helper).css("opacity",s._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(){var e=t(this).data("ui-draggable");e.scrollParent[0]!==document&&"HTML"!==e.scrollParent[0].tagName&&(e.overflowOffset=e.scrollParent.offset())},drag:function(e){var i=t(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-e.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:e.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-e.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:e.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(e.pageY-t(document).scrollTop()<s.scrollSensitivity?n=t(document).scrollTop(t(document).scrollTop()-s.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<s.scrollSensitivity&&(n=t(document).scrollTop(t(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(e.pageX-t(document).scrollLeft()<s.scrollSensitivity?n=t(document).scrollLeft(t(document).scrollLeft()-s.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<s.scrollSensitivity&&(n=t(document).scrollLeft(t(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&t.ui.ddmanager&&!s.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(){var e=t(this).data("ui-draggable"),i=e.options;e.snapElements=[],t(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=t(this),s=i.offset();this!==e.element[0]&&e.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left})})},drag:function(e,i){var s,n,a,o,r,l,h,c,u,d,p=t(this).data("ui-draggable"),g=p.options,f=g.snapTolerance,m=i.offset.left,_=m+p.helperProportions.width,v=i.offset.top,b=v+p.helperProportions.height;for(u=p.snapElements.length-1;u>=0;u--)r=p.snapElements[u].left,l=r+p.snapElements[u].width,h=p.snapElements[u].top,c=h+p.snapElements[u].height,r-f>_||m>l+f||h-f>b||v>c+f||!t.contains(p.snapElements[u].item.ownerDocument,p.snapElements[u].item)?(p.snapElements[u].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=!1):("inner"!==g.snapMode&&(s=f>=Math.abs(h-b),n=f>=Math.abs(c-v),a=f>=Math.abs(r-_),o=f>=Math.abs(l-m),s&&(i.position.top=p._convertPositionTo("relative",{top:h-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l}).left-p.margins.left)),d=s||n||a||o,"outer"!==g.snapMode&&(s=f>=Math.abs(h-v),n=f>=Math.abs(c-b),a=f>=Math.abs(r-m),o=f>=Math.abs(l-_),s&&(i.position.top=p._convertPositionTo("relative",{top:h,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[u].snapping&&(s||n||a||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=s||n||a||o||d)}}),t.ui.plugin.add("draggable","stack",{start:function(){var e,i=this.data("ui-draggable").options,s=t.makeArray(t(i.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});s.length&&(e=parseInt(t(s[0]).css("zIndex"),10)||0,t(s).each(function(i){t(this).css("zIndex",e+i)}),this.css("zIndex",e+s.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._zIndex&&t(i.helper).css("zIndex",s._zIndex)}})})(jQuery);(function(t){function e(t){return parseInt(t,10)||0}function i(t){return!isNaN(parseInt(t,10))}t.widget("ui.resizable",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var e,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),e=this.handles.split(","),this.handles={},i=0;e.length>i;i++)s=t.trim(e[i]),a="ui-resizable-"+s,n=t("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(e){var i,s,n,a;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=t(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=t(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,a),this._proportionallyResize()),t(this.handles[i]).length},this._renderAxis(this.element),this._handles=t(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),t(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(t(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(t(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(i){var s,n,a,o=this.options,r=this.element.position(),h=this.element;return this.resizing=!0,/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".ui-draggable")&&h.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),s=e(this.helper.css("left")),n=e(this.helper.css("top")),o.containment&&(s+=t(o.containment).scrollLeft()||0,n+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:s,top:n},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:h.width(),height:h.height()},this.originalSize=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalPosition={left:s,top:n},this.sizeDiff={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,a=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===a?this.axis+"-resize":a),h.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(e){var i,s=this.helper,n={},a=this.originalMousePosition,o=this.axis,r=this.position.top,h=this.position.left,l=this.size.width,c=this.size.height,u=e.pageX-a.left||0,d=e.pageY-a.top||0,p=this._change[o];return p?(i=p.apply(this,[e,u,d]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),this.position.top!==r&&(n.top=this.position.top+"px"),this.position.left!==h&&(n.left=this.position.left+"px"),this.size.width!==l&&(n.width=this.size.width+"px"),this.size.height!==c&&(n.height=this.size.height+"px"),s.css(n),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(n)||this._trigger("resize",e,this.ui()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&t.ui.hasScroll(i[0],"left")?0:c.sizeDiff.height,a=s?0:c.sizeDiff.width,o={width:c.helper.width()-a,height:c.helper.height()-n},r=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,h=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(o,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(t){var e,s,n,a,o,r=this.options;o={minWidth:i(r.minWidth)?r.minWidth:0,maxWidth:i(r.maxWidth)?r.maxWidth:1/0,minHeight:i(r.minHeight)?r.minHeight:0,maxHeight:i(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,n=o.minWidth/this.aspectRatio,s=o.maxHeight*this.aspectRatio,a=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),n>o.minHeight&&(o.minHeight=n),o.maxWidth>s&&(o.maxWidth=s),o.maxHeight>a&&(o.maxHeight=a)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),i(t.left)&&(this.position.left=t.left),i(t.top)&&(this.position.top=t.top),i(t.height)&&(this.size.height=t.height),i(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,s=this.size,n=this.axis;return i(t.height)?t.width=t.height*this.aspectRatio:i(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===n&&(t.left=e.left+(s.width-t.width),t.top=null),"nw"===n&&(t.top=e.top+(s.height-t.height),t.left=e.left+(s.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,s=this.axis,n=i(t.width)&&e.maxWidth&&e.maxWidth<t.width,a=i(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=i(t.width)&&e.minWidth&&e.minWidth>t.width,r=i(t.height)&&e.minHeight&&e.minHeight>t.height,h=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,c=/sw|nw|w/.test(s),u=/nw|ne|n/.test(s);return o&&(t.width=e.minWidth),r&&(t.height=e.minHeight),n&&(t.width=e.maxWidth),a&&(t.height=e.maxHeight),o&&c&&(t.left=h-e.minWidth),n&&c&&(t.left=h-e.maxWidth),r&&u&&(t.top=l-e.minHeight),a&&u&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var t,e,i,s,n,a=this.helper||this.element;for(t=0;this._proportionallyResizeElements.length>t;t++){if(n=this._proportionallyResizeElements[t],!this.borderDif)for(this.borderDif=[],i=[n.css("borderTopWidth"),n.css("borderRightWidth"),n.css("borderBottomWidth"),n.css("borderLeftWidth")],s=[n.css("paddingTop"),n.css("paddingRight"),n.css("paddingBottom"),n.css("paddingLeft")],e=0;i.length>e;e++)this.borderDif[e]=(parseInt(i[e],10)||0)+(parseInt(s[e],10)||0);n.css({height:a.height()-this.borderDif[0]-this.borderDif[2]||0,width:a.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).data("ui-resizable"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&t.ui.hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,c=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var i,s,n,a,o,r,h,l=t(this).data("ui-resizable"),c=l.options,u=l.element,d=c.containment,p=d instanceof t?d.get(0):/parent/.test(d)?u.parent().get(0):d;p&&(l.containerElement=t(p),/document/.test(d)||d===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(i=t(p),s=[],t(["Top","Right","Left","Bottom"]).each(function(t,n){s[t]=e(i.css("padding"+n))}),l.containerOffset=i.offset(),l.containerPosition=i.position(),l.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},n=l.containerOffset,a=l.containerSize.height,o=l.containerSize.width,r=t.ui.hasScroll(p,"left")?p.scrollWidth:o,h=t.ui.hasScroll(p)?p.scrollHeight:a,l.parentData={element:p,left:n.left,top:n.top,width:r,height:h}))},resize:function(e){var i,s,n,a,o=t(this).data("ui-resizable"),r=o.options,h=o.containerOffset,l=o.position,c=o._aspectRatio||e.shiftKey,u={top:0,left:0},d=o.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-u.left),c&&(o.size.height=o.size.width/o.aspectRatio),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),c&&(o.size.width=o.size.height*o.aspectRatio),o.position.top=o._helper?h.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,i=Math.abs((o._helper?o.offset.left-u.left:o.offset.left-u.left)+o.sizeDiff.width),s=Math.abs((o._helper?o.offset.top-u.top:o.offset.top-h.top)+o.sizeDiff.height),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a&&(i-=Math.abs(o.parentData.left)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,c&&(o.size.height=o.size.width/o.aspectRatio)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,c&&(o.size.width=o.size.height*o.aspectRatio))},stop:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.containerOffset,n=e.containerPosition,a=e.containerElement,o=t(e.helper),r=o.offset(),h=o.outerWidth()-e.sizeDiff.width,l=o.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(a.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(a.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,s=function(e){t(e).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseInt(e.width(),10),height:parseInt(e.height(),10),left:parseInt(e.css("left"),10),top:parseInt(e.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):t.each(i.alsoResize,function(t){s(t)})},resize:function(e,i){var s=t(this).data("ui-resizable"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},h=function(e,s){t(e).each(function(){var e=t(this),n=t(this).data("ui-resizable-alsoresize"),a={},o=s&&s.length?s:e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(n[e]||0)+(r[e]||0);i&&i>=0&&(a[e]=i||null)}),e.css(a)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):t.each(n.alsoResize,function(t,e){h(t,e)})},stop:function(){t(this).removeData("resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).data("ui-resizable");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).data("ui-resizable");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.size,n=e.originalSize,a=e.originalPosition,o=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,c=Math.round((s.width-n.width)/h)*h,u=Math.round((s.height-n.height)/l)*l,d=n.width+c,p=n.height+u,f=i.maxWidth&&d>i.maxWidth,g=i.maxHeight&&p>i.maxHeight,m=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=h),v&&(p+=l),f&&(d-=h),g&&(p-=l),/^(se|s|e)$/.test(o)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(o)?(e.size.width=d,e.size.height=p,e.position.top=a.top-u):/^(sw)$/.test(o)?(e.size.width=d,e.size.height=p,e.position.left=a.left-c):(p-l>0?(e.size.height=p,e.position.top=a.top-u):(e.size.height=l,e.position.top=a.top+n.height-l),d-h>0?(e.size.width=d,e.position.left=a.left-c):(e.size.width=h,e.position.left=a.left+n.width-h))}})})(jQuery);(function(e){var t,i="ui-button ui-widget ui-state-default ui-corner-all",n="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",s=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},a=function(t){var i=t.name,n=t.form,s=e([]);return i&&(i=i.replace(/'/g,"\\'"),s=n?e(n).find("[name='"+i+"']"):e("[name='"+i+"']",t.ownerDocument).filter(function(){return!this.form})),s};e.widget("ui.button",{version:"1.10.4",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,s),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var n=this,o=this.options,r="checkbox"===this.type||"radio"===this.type,h=r?"":"ui-state-active";null===o.label&&(o.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(i).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){o.disabled||this===t&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){o.disabled||e(this).removeClass(h)}).bind("click"+this.eventNamespace,function(e){o.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),r&&this.element.bind("change"+this.eventNamespace,function(){n.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return o.disabled?!1:undefined}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(o.disabled)return!1;e(this).addClass("ui-state-active"),n.buttonElement.attr("aria-pressed","true");var t=n.element[0];a(t).not(t).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return o.disabled?!1:(e(this).addClass("ui-state-active"),t=this,n.document.one("mouseup",function(){t=null}),undefined)}).bind("mouseup"+this.eventNamespace,function(){return o.disabled?!1:(e(this).removeClass("ui-state-active"),undefined)}).bind("keydown"+this.eventNamespace,function(t){return o.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),undefined)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",o.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(i+" ui-state-active "+n).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.element.prop("disabled",!!t),t&&this.buttonElement.removeClass("ui-state-focus"),undefined):(this._resetButton(),undefined)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?a(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),undefined;var t=this.buttonElement.removeClass(n),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,a=s.primary&&s.secondary,o=[];s.primary||s.secondary?(this.options.text&&o.push("ui-button-text-icon"+(a?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(o.push(a?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):o.push("ui-button-text-only"),t.addClass(o.join(" "))}}),e.widget("ui.buttonset",{version:"1.10.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(jQuery);(function(e){var t={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.10.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,a=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._destroyOverlay(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(s){}this._hide(this.uiDialog,this.options.hide,function(){a._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,t){var i=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return i&&!t&&this._trigger("focus",e),i},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),undefined):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._trigger("open"),undefined)},_focusTabbable:function(){var e=this.element.find("[autofocus]");e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),undefined;if(t.keyCode===e.ui.keyCode.TAB){var i=this.uiDialog.find(":tabbable"),a=i.filter(":first"),s=i.filter(":last");t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==a[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(s.focus(1),t.preventDefault()):(a.focus(1),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html(" "),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),undefined):(e.each(i,function(i,a){var s,n;a=e.isFunction(a)?{click:a,text:i}:a,a=e.extend({type:"button"},a),s=a.click,a.click=function(){s.apply(t.element[0],arguments)},n={icons:a.icons,text:a.showText},delete a.icons,delete a.showText,e("<button></button>",a).button(n).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),undefined)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,a=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(a,s){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",a,t(s))},drag:function(e,a){i._trigger("drag",e,t(a))},stop:function(s,n){a.position=[n.position.left-i.document.scrollLeft(),n.position.top-i.document.scrollTop()],e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",s,t(n))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,a=this.options,s=a.resizable,n=this.uiDialog.css("position"),r="string"==typeof s?s:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:a.maxWidth,maxHeight:a.maxHeight,minWidth:a.minWidth,minHeight:this._minHeight(),handles:r,start:function(a,s){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",a,t(s))},resize:function(e,a){i._trigger("resize",e,t(a))},stop:function(s,n){a.height=e(this).height(),a.width=e(this).width(),e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",s,t(n))}}).css("position",n)},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(a){var s=this,n=!1,r={};e.each(a,function(e,a){s._setOption(e,a),e in t&&(n=!0),e in i&&(r[e]=a)}),n&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",r)},_setOption:function(e,t){var i,a,s=this.uiDialog;"dialogClass"===e&&s.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=s.is(":data(ui-draggable)"),i&&!t&&s.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(a=s.is(":data(ui-resizable)"),a&&!t&&s.resizable("destroy"),a&&"string"==typeof t&&s.resizable("option","handles",t),a||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,a=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),a.minWidth>a.width&&(a.width=a.minWidth),e=this.uiDialog.css({height:"auto",width:a.width}).outerHeight(),t=Math.max(0,a.minHeight-e),i="number"==typeof a.maxHeight?Math.max(0,a.maxHeight-e):"none","auto"===a.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,a.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=this,i=this.widgetFullName;e.ui.dialog.overlayInstances||this._delay(function(){e.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(a){t._allowInteraction(a)||(a.preventDefault(),e(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable())})}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),e.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(e.ui.dialog.overlayInstances--,e.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),e.ui.dialog.overlayInstances=0,e.uiBackCompat!==!1&&e.widget("ui.dialog",e.ui.dialog,{_position:function(){var t,i=this.options.position,a=[],s=[0,0];i?(("string"==typeof i||"object"==typeof i&&"0"in i)&&(a=i.split?i.split(" "):[i[0],i[1]],1===a.length&&(a[1]=a[0]),e.each(["left","top"],function(e,t){+a[e]===a[e]&&(s[e]=a[e],a[e]=t)}),i={my:a[0]+(0>s[0]?s[0]:"+"+s[0])+" "+a[1]+(0>s[1]?s[1]:"+"+s[1]),at:a.join(" ")}),i=e.extend({},e.ui.dialog.prototype.options.position,i)):i=e.ui.dialog.prototype.options.position,t=this.uiDialog.is(":visible"),t||this.uiDialog.show(),this.uiDialog.position(i),t||this.uiDialog.hide()}})})(jQuery);(function(t,e){t.widget("ui.progressbar",{version:"1.10.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=t("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(t){return t===e?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),e)},_constrainedValue:function(t){return t===e&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}})})(jQuery);(function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)o.push(a);this.handles=n.add(t(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){var t=this.handles.add(this.range).filter("a");this._off(t),this._on(t,this._handleEvents),this._hoverable(t),this._focusable(t)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,a,o,r,l,h,u=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-u.values(e));(n>i||n===i&&(e===u._lastChangedValue||u.values(e)===c.min))&&(n=i,a=t(this),o=e)}),r=this._start(e,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),l=a.offset(),h=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-l.left-a.width()/2,top:e.pageY-l.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,a;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>s||1===e&&s>i)&&(i=s),i!==this.values(e)&&(n=this.values(),n[e]=i,a=this._trigger("slide",t,{handle:this.handles[e],value:i,values:n}),s=this.values(e?0:1),a!==!1&&this.values(e,i))):i!==this.value()&&(a=this._trigger("slide",t,{handle:this.handles[e],value:i}),a!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(e,i){var s,n,a;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),undefined;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),t.Widget.prototype._setOption.apply(this,arguments),e){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,i,s,n,a,o=this.options.range,r=this.options,l=this,h=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((l.values(s)-l._valueMin())/(l._valueMax()-l._valueMin())),u["horizontal"===l.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[h?"animate":"css"](u,r.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===s&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[h?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[h?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(i){var s,n,a,o,r=t(i.target).data("ui-slider-handle-index");switch(i.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(i.target).addClass("ui-state-active"),s=this._start(i,r),s===!1))return}switch(o=this.options.step,n=a=this.options.values&&this.options.values.length?this.values(r):this.value(),i.keyCode){case t.ui.keyCode.HOME:a=this._valueMin();break;case t.ui.keyCode.END:a=this._valueMax();break;case t.ui.keyCode.PAGE_UP:a=this._trimAlignValue(n+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:a=this._trimAlignValue(n-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(n===this._valueMax())return;a=this._trimAlignValue(n+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(n===this._valueMin())return;a=this._trimAlignValue(n-o)}this._slide(i,r,a)},click:function(t){t.preventDefault()},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}})})(jQuery);(function(t){function e(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))}function i(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")}var s=0;t.widget("ui.tooltip",{version:"1.10.4",options:{content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(e,i){var s=this;return"disabled"===e?(this[i?"_disable":"_enable"](),this.options[e]=i,void 0):(this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e)}),void 0)},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.is("[title]")&&e.data("ui-tooltip-title",e.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))})},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s?this._open(e,t,s):(i=s.call(t[0],function(i){t.data("ui-tooltip-open")&&n._delay(function(){e&&(e.type=o),this._open(e,t,i)})}),i&&this._open(e,t,i),void 0)},_open:function(i,s,n){function o(t){l.of=t,a.is(":hidden")||a.position(l)}var a,r,h,l=t.extend({},this.options.position);if(n){if(a=this._find(s),a.length)return a.find(".ui-tooltip-content").html(n),void 0;s.is("[title]")&&(i&&"mouseover"===i.type?s.attr("title",""):s.removeAttr("title")),a=this._tooltip(s),e(s,a.attr("id")),a.find(".ui-tooltip-content").html(n),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:o}),o(i)):a.position(t.extend({of:s},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){a.is(":visible")&&(o(l.of),clearInterval(h))},t.fx.interval)),this._trigger("open",i,{tooltip:a}),r={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var i=t.Event(e);i.currentTarget=s[0],this.close(i,!0)}},remove:function(){this._removeTooltip(a)}},i&&"mouseover"!==i.type||(r.mouseleave="close"),i&&"focusin"!==i.type||(r.focusout="close"),this._on(!0,s,r)}},close:function(e){var s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);this.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&n.attr("title",n.data("ui-tooltip-title")),i(n),o.stop(!0),this._hide(o,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),this.closing=!0,this._trigger("close",e,{tooltip:o}),this.closing=!1)},_tooltip:function(e){var i="ui-tooltip-"+s++,n=t("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("<div>").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})})(jQuery); \ No newline at end of file diff --git a/libs/plasio/vendor/laz-perf.js b/libs/plasio/vendor/laz-perf.js deleted file mode 100644 index fdde1ae3..00000000 --- a/libs/plasio/vendor/laz-perf.js +++ /dev/null @@ -1,34 +0,0 @@ -var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function";var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=nodePath["resolve"](filename)){filename=path.join(__dirname,"..","src",filename);ret=nodeFS["readFileSync"](filename)}if(ret&&!binary)ret=ret.toString();return ret};Module["readBinary"]=function readBinary(filename){return Module["read"](filename,true)};Module["load"]=function load(f){globalEval(read(f))};Module["arguments"]=process["argv"].slice(2);module["exports"]=Module}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function read(){throw"no read() available (jsc?)"}}Module["readBinary"]=function readBinary(f){return read(f,"binary")};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}this["Module"]=Module;eval("if (typeof gc === 'function' && gc.toString().indexOf('[native code]') > 0) var gc = undefined")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function printErr(x){console.log(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WEB){window["Module"]=Module}else{Module["load"]=importScripts}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]=="undefined"&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}var Runtime={setTempRet0:(function(value){tempRet0=value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),forceAlign:(function(target,quantum){quantum=quantum||4;if(quantum==1)return target;if(isNumber(target)&&isNumber(quantum)){return Math.ceil(target/quantum)*quantum}else if(isNumber(quantum)&&isPowerOfTwo(quantum)){return"((("+target+")+"+(quantum-1)+")&"+ -quantum+")"}return"Math.ceil(("+target+")/"+quantum+")*"+quantum}),isNumberType:(function(type){return type in Runtime.INT_TYPES||type in Runtime.FLOAT_TYPES}),isPointerType:function isPointerType(type){return type[type.length-1]=="*"},isStructType:function isStructType(type){if(isPointerType(type))return false;if(isArrayType(type))return true;if(/<?\{ ?[^}]* ?\}>?/.test(type))return true;return type[0]=="%"},INT_TYPES:{"i1":0,"i8":0,"i16":0,"i32":0,"i64":0},FLOAT_TYPES:{"float":0,"double":0},or64:(function(x,y){var l=x|0|(y|0);var h=(Math.round(x/4294967296)|Math.round(y/4294967296))*4294967296;return l+h}),and64:(function(x,y){var l=(x|0)&(y|0);var h=(Math.round(x/4294967296)&Math.round(y/4294967296))*4294967296;return l+h}),xor64:(function(x,y){var l=(x|0)^(y|0);var h=(Math.round(x/4294967296)^Math.round(y/4294967296))*4294967296;return l+h}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)}),dedup:function dedup(items,ident){var seen={};if(ident){return items.filter((function(item){if(seen[item[ident]])return false;seen[item[ident]]=true;return true}))}else{return items.filter((function(item){if(seen[item])return false;seen[item]=true;return true}))}},set:function set(){var args=typeof arguments[0]==="object"?arguments[0]:arguments;var ret={};for(var i=0;i<args.length;i++){ret[args[i]]=0}return ret},STACK_ALIGN:8,getAlignSize:(function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)}),calculateStructAlignment:function calculateStructAlignment(type){type.flatSize=0;type.alignSize=0;var diffs=[];var prev=-1;var index=0;type.flatIndexes=type.fields.map((function(field){index++;var size,alignSize;if(Runtime.isNumberType(field)||Runtime.isPointerType(field)){size=Runtime.getNativeTypeSize(field);alignSize=Runtime.getAlignSize(field,size)}else if(Runtime.isStructType(field)){if(field[1]==="0"){size=0;if(Types.types[field]){alignSize=Runtime.getAlignSize(null,Types.types[field].alignSize)}else{alignSize=type.alignSize||QUANTUM_SIZE}}else{size=Types.types[field].flatSize;alignSize=Runtime.getAlignSize(null,Types.types[field].alignSize)}}else if(field[0]=="b"){size=field.substr(1)|0;alignSize=1}else if(field[0]==="<"){size=alignSize=Types.types[field].flatSize}else if(field[0]==="i"){size=alignSize=parseInt(field.substr(1))/8;assert(size%1===0,"cannot handle non-byte-size field "+field)}else{assert(false,"invalid type for calculateStructAlignment")}if(type.packed)alignSize=1;type.alignSize=Math.max(type.alignSize,alignSize);var curr=Runtime.alignMemory(type.flatSize,alignSize);type.flatSize=curr+size;if(prev>=0){diffs.push(curr-prev)}prev=curr;return curr}));if(type.name_&&type.name_[0]==="["){type.flatSize=parseInt(type.name_.substr(1))*type.flatSize/2}type.flatSize=Runtime.alignMemory(type.flatSize,type.alignSize);if(diffs.length==0){type.flatFactor=type.flatSize}else if(Runtime.dedup(diffs).length==1){type.flatFactor=diffs[0]}type.needsFlattening=type.flatFactor!=1;return type.flatIndexes},generateStructInfo:(function(struct,typeName,offset){var type,alignment;if(typeName){offset=offset||0;type=(typeof Types==="undefined"?Runtime.typeInfo:Types.types)[typeName];if(!type)return null;if(type.fields.length!=struct.length){printErr("Number of named fields must match the type for "+typeName+": possibly duplicate struct names. Cannot return structInfo");return null}alignment=type.flatIndexes}else{var type={fields:struct.map((function(item){return item[0]}))};alignment=Runtime.calculateStructAlignment(type)}var ret={__size__:type.flatSize};if(typeName){struct.forEach((function(item,i){if(typeof item==="string"){ret[item]=alignment[i]+offset}else{var key;for(var k in item)key=k;ret[key]=Runtime.generateStructInfo(item[key],type.fields[i],alignment[i])}}))}else{struct.forEach((function(item,i){ret[item[1]]=alignment[i]}))}return ret}),dynCall:(function(sig,ptr,args){if(args&&args.length){if(!args.splice)args=Array.prototype.slice.call(args);args.splice(0,0,ptr);return Module["dynCall_"+sig].apply(null,args)}else{return Module["dynCall_"+sig].call(null,ptr)}}),functionPointers:[null,null,null,null,null,null,null,null,null,null],addFunction:(function(func){for(var i=0;i<Runtime.functionPointers.length;i++){if(!Runtime.functionPointers[i]){Runtime.functionPointers[i]=func;return 2*(1+i)}}throw"Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS."}),removeFunction:(function(index){Runtime.functionPointers[(index-2)/2]=null}),getAsmConst:(function(code,numArgs){if(!Runtime.asmConstCache)Runtime.asmConstCache={};var func=Runtime.asmConstCache[code];if(func)return func;var args=[];for(var i=0;i<numArgs;i++){args.push(String.fromCharCode(36)+i)}var source=Pointer_stringify(code);if(source[0]==='"'){if(source.indexOf('"',1)===source.length-1){source=source.substr(1,source.length-2)}else{abort("invalid EM_ASM input |"+source+"|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)")}}try{var evalled=eval("(function("+args.join(",")+"){ "+source+" })")}catch(e){Module.printErr("error in executing inline EM_ASM code: "+e+" on: \n\n"+source+"\n\nwith args |"+args+"| (make sure to use the right one out of EM_ASM, EM_ASM_ARGS, etc.)");throw e}return Runtime.asmConstCache[code]=evalled}),warnOnce:(function(text){if(!Runtime.warnOnce.shown)Runtime.warnOnce.shown={};if(!Runtime.warnOnce.shown[text]){Runtime.warnOnce.shown[text]=1;Module.printErr(text)}}),funcWrappers:{},getFuncWrapper:(function(func,sig){assert(sig);if(!Runtime.funcWrappers[func]){Runtime.funcWrappers[func]=function dynCall_wrapper(){return Runtime.dynCall(sig,func,arguments)}}return Runtime.funcWrappers[func]}),UTF8Processor:(function(){var buffer=[];var needed=0;this.processCChar=(function(code){code=code&255;if(buffer.length==0){if((code&128)==0){return String.fromCharCode(code)}buffer.push(code);if((code&224)==192){needed=1}else if((code&240)==224){needed=2}else{needed=3}return""}if(needed){buffer.push(code);needed--;if(needed>0)return""}var c1=buffer[0];var c2=buffer[1];var c3=buffer[2];var c4=buffer[3];var ret;if(buffer.length==2){ret=String.fromCharCode((c1&31)<<6|c2&63)}else if(buffer.length==3){ret=String.fromCharCode((c1&15)<<12|(c2&63)<<6|c3&63)}else{var codePoint=(c1&7)<<18|(c2&63)<<12|(c3&63)<<6|c4&63;ret=String.fromCharCode(Math.floor((codePoint-65536)/1024)+55296,(codePoint-65536)%1024+56320)}buffer.length=0;return ret});this.processJSString=function processJSString(string){string=unescape(encodeURIComponent(string));var ret=[];for(var i=0;i<string.length;i++){ret.push(string.charCodeAt(i))}return ret}}),getCompilerSetting:(function(name){throw"You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work"}),stackAlloc:(function(size){var ret=STACKTOP;STACKTOP=STACKTOP+size|0;STACKTOP=STACKTOP+7&-8;return ret}),staticAlloc:(function(size){var ret=STATICTOP;STATICTOP=STATICTOP+size|0;STATICTOP=STATICTOP+7&-8;return ret}),dynamicAlloc:(function(size){var ret=DYNAMICTOP;DYNAMICTOP=DYNAMICTOP+size|0;DYNAMICTOP=DYNAMICTOP+7&-8;if(DYNAMICTOP>=TOTAL_MEMORY)enlargeMemory();return ret}),alignMemory:(function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:8))*(quantum?quantum:8);return ret}),makeBigInt:(function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret}),GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module["Runtime"]=Runtime;function jsCall(){var args=Array.prototype.slice.call(arguments);return Runtime.functionPointers[args[0]].apply(null,args.slice(1))}var __THREW__=0;var ABORT=false;var EXITSTATUS=0;var undef=0;var tempValue,tempInt,tempBigInt,tempInt2,tempBigInt2,tempPair,tempBigIntI,tempBigIntR,tempBigIntS,tempBigIntP,tempBigIntD,tempDouble,tempFloat;var tempI64,tempI64b;var tempRet0,tempRet1,tempRet2,tempRet3,tempRet4,tempRet5,tempRet6,tempRet7,tempRet8,tempRet9;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var globalScope=this;function getCFunc(ident){try{var func=Module["_"+ident];if(!func)func=eval("_"+ident)}catch(e){}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var cwrap,ccall;((function(){var stack=0;var JSfuncs={"stackSave":(function(){stack=Runtime.stackSave()}),"stackRestore":(function(){Runtime.stackRestore(stack)}),"arrayToC":(function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=Runtime.stackAlloc(str.length+1);writeStringToMemory(str,ret)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args){var func=getCFunc(ident);var cArgs=[];if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=Runtime.stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func.apply(null,cArgs);if(returnType==="string")ret=Pointer_stringify(ret);if(stack!==0)JSfuncs["stackRestore"]();return ret};var sourceRegex=/^function\s\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;function parseJSFunc(jsfunc){var parsed=jsfunc.toString().match(sourceRegex).slice(1);return{arguments:parsed[0],body:parsed[1],returnValue:parsed[2]}}var JSsource={};for(var fun in JSfuncs){if(JSfuncs.hasOwnProperty(fun)){JSsource[fun]=parseJSFunc(JSfuncs[fun])}}cwrap=function cwrap(ident,returnType,argTypes){var cfunc=getCFunc(ident);var numericArgs=argTypes.every((function(type){return type==="number"}));var numericRet=returnType!=="string";if(numericRet&&numericArgs){return cfunc}var argNames=argTypes.map((function(x,i){return"$"+i}));var funcstr="(function("+argNames.join(",")+") {";var nargs=argTypes.length;if(!numericArgs){funcstr+=JSsource["stackSave"].body+";";for(var i=0;i<nargs;i++){var arg=argNames[i],type=argTypes[i];if(type==="number")continue;var convertCode=JSsource[type+"ToC"];funcstr+="var "+convertCode.arguments+" = "+arg+";";funcstr+=convertCode.body+";";funcstr+=arg+"="+convertCode.returnValue+";"}}var cfuncname=parseJSFunc((function(){return cfunc})).returnValue;funcstr+="var ret = "+cfuncname+"("+argNames.join(",")+");";if(!numericRet){var strgfy=parseJSFunc((function(){return Pointer_stringify})).returnValue;funcstr+="ret = "+strgfy+"(ret);"}if(!numericArgs){funcstr+=JSsource["stackRestore"].body+";"}funcstr+="return ret})";return eval(funcstr)}}))();Module["cwrap"]=cwrap;Module["ccall"]=ccall;function setValue(ptr,value,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":HEAP8[ptr>>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STACK=1;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;Module["ALLOC_STACK"]=ALLOC_STACK;Module["ALLOC_STATIC"]=ALLOC_STATIC;Module["ALLOC_DYNAMIC"]=ALLOC_DYNAMIC;Module["ALLOC_NONE"]=ALLOC_NONE;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[_malloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr<stop;ptr+=4){HEAP32[ptr>>2]=0}stop=ret+size;while(ptr<stop){HEAP8[ptr++>>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i<size){var curr=slab[i];if(typeof curr==="function"){curr=Runtime.getFunctionIndex(curr)}type=singleType||types[i];if(type===0){i++;continue}if(type=="i64")type="i32";setValue(ret+i,curr,type);if(previousType!==type){typeSize=Runtime.getNativeTypeSize(type);previousType=type}i+=typeSize}return ret}Module["allocate"]=allocate;function Pointer_stringify(ptr,length){var hasUtf=false;var t;var i=0;while(1){t=HEAPU8[ptr+i>>0];if(t>=128)hasUtf=true;else if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(!hasUtf){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}var utf8=new Runtime.UTF8Processor;for(i=0;i<length;i++){t=HEAPU8[ptr+i>>0];ret+=utf8.processCChar(t)}return ret}Module["Pointer_stringify"]=Pointer_stringify;function UTF16ToString(ptr){var i=0;var str="";while(1){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)return str;++i;str+=String.fromCharCode(codeUnit)}}Module["UTF16ToString"]=UTF16ToString;function stringToUTF16(str,outPtr){for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr+i*2>>1]=codeUnit}HEAP16[outPtr+str.length*2>>1]=0}Module["stringToUTF16"]=stringToUTF16;function UTF32ToString(ptr){var i=0;var str="";while(1){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)return str;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}}Module["UTF32ToString"]=UTF32ToString;function stringToUTF32(str,outPtr){var iChar=0;for(var iCodeUnit=0;iCodeUnit<str.length;++iCodeUnit){var codeUnit=str.charCodeAt(iCodeUnit);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++iCodeUnit);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr+iChar*4>>2]=codeUnit;++iChar}HEAP32[outPtr+iChar*4>>2]=0}Module["stringToUTF32"]=stringToUTF32;function demangle(func){var i=3;var basicTypes={"v":"void","b":"bool","c":"char","s":"short","i":"int","l":"long","f":"float","d":"double","w":"wchar_t","a":"signed char","h":"unsigned char","t":"unsigned short","j":"unsigned int","m":"unsigned long","x":"long long","y":"unsigned long long","z":"..."};var subs=[];var first=true;function dump(x){if(x)Module.print(x);Module.print(func);var pre="";for(var a=0;a<i;a++)pre+=" ";Module.print(pre+"^")}function parseNested(){i++;if(func[i]==="K")i++;var parts=[];while(func[i]!=="E"){if(func[i]==="S"){i++;var next=func.indexOf("_",i);var num=func.substring(i,next)||0;parts.push(subs[num]||"?");i=next+1;continue}if(func[i]==="C"){parts.push(parts[parts.length-1]);i+=2;continue}var size=parseInt(func.substr(i));var pre=size.toString().length;if(!size||!pre){i--;break}var curr=func.substr(i+pre,size);parts.push(curr);subs.push(curr);i+=pre+size}i++;return parts}function parse(rawList,limit,allowVoid){limit=limit||Infinity;var ret="",list=[];function flushList(){return"("+list.join(", ")+")"}var name;if(func[i]==="N"){name=parseNested().join("::");limit--;if(limit===0)return rawList?[name]:name}else{if(func[i]==="K"||first&&func[i]==="L")i++;var size=parseInt(func.substr(i));if(size){var pre=size.toString().length;name=func.substr(i+pre,size);i+=pre+size}}first=false;if(func[i]==="I"){i++;var iList=parse(true);var iRet=parse(true,1,true);ret+=iRet[0]+" "+name+"<"+iList.join(", ")+">"}else{ret=name}paramLoop:while(i<func.length&&limit-->0){var c=func[i++];if(c in basicTypes){list.push(basicTypes[c])}else{switch(c){case"P":list.push(parse(true,1,true)[0]+"*");break;case"R":list.push(parse(true,1,true)[0]+"&");break;case"L":{i++;var end=func.indexOf("E",i);var size=end-i;list.push(func.substr(i,size));i+=size+2;break};case"A":{var size=parseInt(func.substr(i));i+=size.toString().length;if(func[i]!=="_")throw"?";i++;list.push(parse(true,1,true)[0]+" ["+size+"]");break};case"E":break paramLoop;default:ret+="?"+c;break paramLoop}}}if(!allowVoid&&list.length===1&&list[0]==="void")list=[];if(rawList){if(ret){list.push(ret+"?")}return list}else{return ret+flushList()}}try{if(func=="Object._main"||func=="_main"){return"main()"}if(typeof func==="number")func=Pointer_stringify(func);if(func[0]!=="_")return func;if(func[1]!=="_")return func;if(func[2]!=="Z")return func;switch(func[3]){case"n":return"operator new()";case"d":return"operator delete()"}return parse()}catch(e){return func}}function demangleAll(text){return text.replace(/__Z[\w\d_]+/g,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function stackTrace(){var stack=(new Error).stack;return stack?demangleAll(stack):"(no stack trace available)"}var PAGE_SIZE=4096;function alignMemoryPage(x){return x+4095&-4096}var HEAP;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var STATIC_BASE=0,STATICTOP=0,staticSealed=false;var STACK_BASE=0,STACKTOP=0,STACK_MAX=0;var DYNAMIC_BASE=0,DYNAMICTOP=0;function enlargeMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.")}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||167772160;var FAST_MEMORY=Module["FAST_MEMORY"]||10485760;var totalMemory=4096;while(totalMemory<TOTAL_MEMORY||totalMemory<2*TOTAL_STACK){if(totalMemory<16*1024*1024){totalMemory*=2}else{totalMemory+=16*1024*1024}}if(totalMemory!==TOTAL_MEMORY){Module.printErr("increasing TOTAL_MEMORY to "+totalMemory+" to be more reasonable");TOTAL_MEMORY=totalMemory}assert(typeof Int32Array!=="undefined"&&typeof Float64Array!=="undefined"&&!!(new Int32Array(1))["subarray"]&&!!(new Int32Array(1))["set"],"JS engine does not provide full typed array support");var buffer=new ArrayBuffer(TOTAL_MEMORY);HEAP8=new Int8Array(buffer);HEAP16=new Int16Array(buffer);HEAP32=new Int32Array(buffer);HEAPU8=new Uint8Array(buffer);HEAPU16=new Uint16Array(buffer);HEAPU32=new Uint32Array(buffer);HEAPF32=new Float32Array(buffer);HEAPF64=new Float64Array(buffer);HEAP32[0]=255;assert(HEAPU8[0]===255&&HEAPU8[3]===0,"Typed arrays 2 must be run on a little-endian system");Module["HEAP"]=HEAP;Module["HEAP8"]=HEAP8;Module["HEAP16"]=HEAP16;Module["HEAP32"]=HEAP32;Module["HEAPU8"]=HEAPU8;Module["HEAPU16"]=HEAPU16;Module["HEAPU32"]=HEAPU32;Module["HEAPF32"]=HEAPF32;Module["HEAPF64"]=HEAPF64;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Runtime.dynCall("v",func)}else{Runtime.dynCall("vi",func,[callback.arg])}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}Module["addOnPreRun"]=Module.addOnPreRun=addOnPreRun;function addOnInit(cb){__ATINIT__.unshift(cb)}Module["addOnInit"]=Module.addOnInit=addOnInit;function addOnPreMain(cb){__ATMAIN__.unshift(cb)}Module["addOnPreMain"]=Module.addOnPreMain=addOnPreMain;function addOnExit(cb){__ATEXIT__.unshift(cb)}Module["addOnExit"]=Module.addOnExit=addOnExit;function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}Module["addOnPostRun"]=Module.addOnPostRun=addOnPostRun;function intArrayFromString(stringy,dontAddNull,length){var ret=(new Runtime.UTF8Processor).processJSString(stringy);if(length){ret.length=length}if(!dontAddNull){ret.push(0)}return ret}Module["intArrayFromString"]=intArrayFromString;function intArrayToString(array){var ret=[];for(var i=0;i<array.length;i++){var chr=array[i];if(chr>255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function writeStringToMemory(string,buffer,dontAddNull){var array=intArrayFromString(string,dontAddNull);var i=0;while(i<array.length){var chr=array[i];HEAP8[buffer+i>>0]=chr;i=i+1}}Module["writeStringToMemory"]=writeStringToMemory;function writeArrayToMemory(array,buffer){for(var i=0;i<array.length;i++){HEAP8[buffer+i>>0]=array[i]}}Module["writeArrayToMemory"]=writeArrayToMemory;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i<str.length;i++){HEAP8[buffer+i>>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer+str.length>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<<bits-1)+value:Math.pow(2,bits)+value}function reSign(value,bits,ignore){if(value<=0){return value}var half=bits<=32?Math.abs(1<<bits-1):Math.pow(2,bits-1);if(value>=half&&(bits<=32||value>half)){value=-2*half+value}return value}if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_min=Math.min;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}Module["addRunDependency"]=addRunDependency;function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["removeRunDependency"]=removeRunDependency;Module["preloadedImages"]={};Module["preloadedAudios"]={};var memoryInitializer=null;var __ZTIt=21872;var __ZTIs=21864;var __ZTIm=21936;var __ZTIl=21920;var __ZTVN10__cxxabiv119__pointer_type_infoE=21656;var __ZTIi=21888;var __ZTIh=21840;var __ZTIj=21904;var __ZTId=21968;var __ZTVN10__cxxabiv117__class_type_infoE=21616;var __ZTIf=21952;var __ZTIa=21856;var __ZTVN10__cxxabiv120__si_class_type_infoE=21976;var __ZTIc=21824;STATIC_BASE=8;STATICTOP=STATIC_BASE+Runtime.alignMemory(23083);__ATINIT__.push({func:(function(){__GLOBAL__I_a()})},{func:(function(){__GLOBAL__I_a65()})},{func:(function(){__GLOBAL__I_a153()})});allocate([76,65,83,90,105,112,0,0,111,112,101,110,0,0,0,0,103,101,116,80,111,105,110,116,0,0,0,0,0,0,0,0,103,101,116,67,111,117,110,116,0,0,0,0,0,0,0,0,105,105,105,0,0,0,0,0,54,76,65,83,90,105,112,0,120,84,0,0,64,0,0,0,80,54,76,65,83,90,105,112,0,0,0,0,0,0,0,0,160,84,0,0,80,0,0,0,0,0,0,0,72,0,0,0,118,105,105,105,0,0,0,0,118,105,105,105,105,0,0,0,105,105,0,0,0,0,0,0,118,105,0,0,0,0,0,0,118,0,0,0,0,0,0,0,105,105,0,0,0,0,0,0,80,75,54,76,65,83,90,105,112,0,0,0,0,0,0,0,160,84,0,0,160,0,0,0,1,0,0,0,72,0,0,0,118,50,116,54,115,50,48,0,118,50,116,54,115,50,48,118,50,116,55,115,56,0,0,0,118,50,116,54,115,50,48,118,50,116,56,115,54,0,0,0,118,50,116,54,115,50,48,118,50,116,55,115,56,118,50,116,56,115,54,0,0,0,0,0,104,97,115,32,105,115,58,32,0,0,0,0,0,0,0,0,78,54,108,97,115,122,105,112,49,57,117,110,107,110,111,119,110,95,115,99,104,101,109,97,95,116,121,112,101,69,0,0,224,85,0,0,16,1,0,0,80,39,0,0,0,0,0,0,84,104,101,32,76,65,90,32,115,99,104,101,109,97,32,105,115,32,110,111,116,32,114,101,99,111,103,110,105,122,101,100,0,0,0,0,0,0,0,0,0,0,0,0,48,1,0,0,22,0,0,0,23,0,0,0,22,0,0,0,0,0,0,0,73,110,118,97,108,105,100,32,110,117,109,98,101,114,32,111,102,32,115,121,109,98,111,108,115,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,22,0,0,0,24,0,0,0,25,0,0,0,0,0,0,0,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,48,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,48,95,53,102,105,101,108,100,73,78,83,48,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,48,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,68,95,69,69,69,69,78,83,66,95,73,78,83,67,95,55,103,112,115,116,105,109,101,69,78,83,69,95,73,83,72,95,69,69,69,69,78,83,66,95,73,78,83,67,95,51,114,103,98,69,78,83,69,95,73,83,75,95,69,69,69,69,69,69,69,69,69,0,0,0,0,0,0,0,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,48,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,69,0,120,84,0,0,208,2,0,0,224,85,0,0,184,1,0,0,248,2,0,0,0,0,0,0,78,54,108,97,115,122,105,112,49,49,101,110,100,95,111,102,95,102,105,108,101,69,0,0,224,85,0,0,16,3,0,0,80,39,0,0,0,0,0,0,82,101,97,99,104,101,100,32,69,110,100,32,111,102,32,102,105,108,101,0,0,0,0,0,0,0,0,0,40,3,0,0,26,0,0,0,27,0,0,0,22,0,0,0,0,0,0,0,15,14,13,12,11,10,9,8,14,0,1,3,6,10,10,9,13,1,2,4,7,11,11,10,12,3,4,5,8,12,12,11,11,6,7,8,9,13,13,12,10,10,11,12,13,14,14,13,9,10,11,12,13,14,15,14,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,1,0,1,2,3,4,5,6,2,1,0,1,2,3,4,5,3,2,1,0,1,2,3,4,4,3,2,1,0,1,2,3,5,4,3,2,1,0,1,2,6,5,4,3,2,1,0,1,7,6,5,4,3,2,1,0,0,0,0,0,112,5,0,0,28,0,0,0,29,0,0,0,30,0,0,0,22,0,0,0,31,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,115,104,97,114,101,100,95,112,116,114,95,112,111,105,110,116,101,114,73,80,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,49,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,50,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,50,95,53,102,105,101,108,100,73,78,83,50,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,50,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,70,95,69,69,69,69,78,83,68,95,73,78,83,69,95,55,103,112,115,116,105,109,101,69,78,83,71,95,73,83,74,95,69,69,69,69,78,83,68,95,73,78,83,69,95,51,114,103,98,69,78,83,71,95,73,83,77,95,69,69,69,69,69,69,69,69,69,78,83,95,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,83,81,95,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,83,81,95,69,69,69,69,0,0,0,0,0,0,0,224,85,0,0,8,4,0,0,144,38,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,49,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,50,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,50,95,53,102,105,101,108,100,73,78,83,50,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,50,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,70,95,69,69,69,69,78,83,68,95,73,78,83,69,95,55,103,112,115,116,105,109,101,69,78,83,71,95,73,83,74,95,69,69,69,69,78,83,68,95,73,78,83,69,95,51,114,103,98,69,78,83,71,95,73,83,77,95,69,69,69,69,69,69,69,69,69,69,69,0,0,0,0,0,0,192,7,0,0,23,0,0,0,32,0,0,0,33,0,0,0,0,0,0,0,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,48,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,48,95,53,102,105,101,108,100,73,78,83,48,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,48,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,68,95,69,69,69,69,78,83,66,95,73,78,83,67,95,51,114,103,98,69,78,83,69,95,73,83,72,95,69,69,69,69,69,69,69,69,69,0,0,0,0,0,224,85,0,0,200,6,0,0,248,2,0,0,0,0,0,0,0,0,0,0,56,9,0,0,34,0,0,0,35,0,0,0,36,0,0,0,23,0,0,0,37,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,115,104,97,114,101,100,95,112,116,114,95,112,111,105,110,116,101,114,73,80,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,49,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,50,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,50,95,53,102,105,101,108,100,73,78,83,50,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,50,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,70,95,69,69,69,69,78,83,68,95,73,78,83,69,95,51,114,103,98,69,78,83,71,95,73,83,74,95,69,69,69,69,69,69,69,69,69,78,83,95,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,83,78,95,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,83,78,95,69,69,69,69,0,0,0,0,0,224,85,0,0,240,7,0,0,144,38,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,49,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,50,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,50,95,53,102,105,101,108,100,73,78,83,50,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,50,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,70,95,69,69,69,69,78,83,68,95,73,78,83,69,95,51,114,103,98,69,78,83,71,95,73,83,74,95,69,69,69,69,69,69,69,69,69,69,69,0,0,0,0,0,0,0,0,0,0,0,0,112,11,0,0,24,0,0,0,38,0,0,0,39,0,0,0,0,0,0,0,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,48,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,48,95,53,102,105,101,108,100,73,78,83,48,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,48,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,68,95,69,69,69,69,78,83,66,95,73,78,83,67,95,55,103,112,115,116,105,109,101,69,78,83,69,95,73,83,72,95,69,69,69,69,69,69,69,69,69,0,224,85,0,0,120,10,0,0,248,2,0,0,0,0,0,0,0,0,0,0,232,12,0,0,40,0,0,0,41,0,0,0,42,0,0,0,24,0,0,0,43,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,115,104,97,114,101,100,95,112,116,114,95,112,111,105,110,116,101,114,73,80,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,49,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,50,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,50,95,53,102,105,101,108,100,73,78,83,50,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,50,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,70,95,69,69,69,69,78,83,68,95,73,78,83,69,95,55,103,112,115,116,105,109,101,69,78,83,71,95,73,83,74,95,69,69,69,69,69,69,69,69,69,78,83,95,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,83,78,95,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,83,78,95,69,69,69,69,0,224,85,0,0,160,11,0,0,144,38,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,49,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,50,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,50,95,53,102,105,101,108,100,73,78,83,50,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,50,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,70,95,69,69,69,69,78,83,68,95,73,78,83,69,95,55,103,112,115,116,105,109,101,69,78,83,71,95,73,83,74,95,69,69,69,69,69,69,69,69,69,69,69,0,0,0,0,0,0,0,0,8,15,0,0,25,0,0,0,44,0,0,0,45,0,0,0,0,0,0,0,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,48,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,48,95,53,102,105,101,108,100,73,78,83,48,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,48,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,68,95,69,69,69,69,69,69,69,69,69,0,0,0,0,0,0,0,224,85,0,0,40,14,0,0,248,2,0,0,0,0,0,0,0,0,0,0,104,16,0,0,46,0,0,0,47,0,0,0,48,0,0,0,25,0,0,0,49,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,115,104,97,114,101,100,95,112,116,114,95,112,111,105,110,116,101,114,73,80,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,49,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,50,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,50,95,53,102,105,101,108,100,73,78,83,50,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,50,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,70,95,69,69,69,69,69,69,69,69,69,78,83,95,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,83,75,95,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,83,75,95,69,69,69,69,0,0,0,0,0,0,0,224,85,0,0,56,15,0,0,144,38,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,78,54,108,97,115,122,105,112,55,102,111,114,109,97,116,115,50,49,100,121,110,97,109,105,99,95,100,101,99,111,109,112,114,101,115,115,111,114,49,73,78,83,49,95,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,50,95,49,57,114,101,99,111,114,100,95,100,101,99,111,109,112,114,101,115,115,111,114,73,74,78,83,50,95,53,102,105,101,108,100,73,78,83,50,95,51,108,97,115,55,112,111,105,110,116,49,48,69,78,83,50,95,50,48,115,116,97,110,100,97,114,100,95,100,105,102,102,95,109,101,116,104,111,100,73,83,70,95,69,69,69,69,69,69,69,69,69,69,69,0,0,118,0,0,0,0,0,0,0,116,0,0,0,0,0,0,0,115,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,16,18,0,0,50,0,0,0,51,0,0,0,56,0,0,0,248,255,255,255,16,18,0,0,52,0,0,0,53,0,0,0,192,255,255,255,192,255,255,255,16,18,0,0,54,0,0,0,55,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,56,98,97,115,105,99,95,115,116,114,105,110,103,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,0,0,0,224,85,0,0,200,17,0,0,224,45,0,0,0,0,0,0,64,0,0,0,0,0,0,0,192,44,0,0,56,0,0,0,57,0,0,0,192,255,255,255,192,255,255,255,192,44,0,0,58,0,0,0,59,0,0,0,0,0,0,0,208,18,0,0,60,0,0,0,61,0,0,0,26,0,0,0,22,0,0,0,22,0,0,0,22,0,0,0,23,0,0,0,24,0,0,0,23,0,0,0,25,0,0,0,26,0,0,0,26,0,0,0,24,0,0,0,27,0,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,105,110,103,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,0,0,0,0,0,0,224,85,0,0,136,18,0,0,72,44,0,0,0,0,0,0,0,0,0,0,168,19,0,0,62,0,0,0,63,0,0,0,64,0,0,0,28,0,0,0,65,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,115,104,97,114,101,100,95,112,116,114,95,112,111,105,110,116,101,114,73,80,78,54,108,97,115,122,105,112,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,78,83,95,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,83,57,95,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,83,57,95,69,69,69,69,0,224,85,0,0,0,19,0,0,144,38,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,78,54,108,97,115,122,105,112,56,100,101,99,111,100,101,114,115,49,48,97,114,105,116,104,109,101,116,105,99,73,78,83,49,95,50,105,111,49,56,95,95,105,102,115,116,114,101,97,109,95,119,114,97,112,112,101,114,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,69,69,0,0,0,0,71,111,116,32,100,97,116,97,32,0,0,0,0,0,0,0,32,98,121,116,101,115,0,0,100,101,108,101,116,105,110,103,32,115,104,105,116,33,0,0,100,111,110,101,32,100,101,108,101,116,105,110,103,32,115,104,105,116,33,0,0,0,0,0,76,65,83,70,0,0,0,0,78,54,108,97,115,122,105,112,49,51,105,110,118,97,108,105,100,95,109,97,103,105,99,69,0,0,0,0,0,0,0,0,224,85,0,0,120,20,0,0,80,39,0,0,0,0,0,0,77,97,103,105,99,32,114,101,97,100,33,0,0,0,0,0,112,97,114,115,105,110,103,32,108,97,115,122,105,112,0,0,112,97,114,115,105,110,103,32,99,104,117,110,107,32,116,97,98,108,101,0,0,0,0,0,78,54,108,97,115,122,105,112,50,50,99,104,117,110,107,95,116,97,98,108,101,95,114,101,97,100,95,101,114,114,111,114,69,0,0,0,0,0,0,0,224,85,0,0,224,20,0,0,80,39,0,0,0,0,0,0,67,104,117,110,107,32,116,97,98,108,101,32,111,102,102,115,101,116,32,61,61,32,45,49,32,105,115,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,97,116,32,116,104,105,115,32,116,105,109,101,0,0,78,54,108,97,115,122,105,112,49,51,110,111,116,95,115,117,112,112,111,114,116,101,100,69,0,0,0,0,0,0,0,0,224,85,0,0,80,21,0,0,80,39,0,0,0,0,0,0,78,54,108,97,115,122,105,112,50,54,117,110,107,110,111,119,110,95,99,104,117,110,107,95,116,97,98,108,101,95,102,111,114,109,97,116,69,0,0,0,224,85,0,0,128,21,0,0,80,39,0,0,0,0,0,0,99,104,117,110,107,95,115,105,122,101,32,61,61,32,117,105,110,116,46,109,97,120,32,105,115,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,97,116,32,116,104,105,115,32,116,105,109,101,44,32,99,97,108,108,32,49,45,56,48,48,45,68,65,70,85,81,32,102,111,114,32,115,117,112,112,111,114,116,46,0,0,0,0,0,99,104,117,110,107,32,116,97,98,108,101,32,99,111,117,110,116,32,105,115,58,32,0,0,99,116,111,91,0,0,0,0,93,58,32,0,0,0,0,0,84,104,101,32,99,104,117,110,107,32,116,97,98,108,101,32,118,101,114,115,105,111,110,32,110,117,109,98,101,114,32,105,115,32,117,110,107,110,111,119,110,0,0,0,0,0,0,0,0,0,0,0,168,21,0,0,66,0,0,0,67,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,112,21,0,0,68,0,0,0,69,0,0,0,22,0,0,0,0,0,0,0,84,104,101,114,101,32,119,97,115,32,97,32,112,114,111,98,108,101,109,32,114,101,97,100,105,110,103,32,116,104,101,32,99,104,117,110,107,32,116,97,98,108,101,0,0,0,0,0,0,0,0,0,8,21,0,0,70,0,0,0,71,0,0,0,22,0,0,0,0,0,0,0,108,97,115,122,105,112,32,101,110,99,111,100,101,100,0,0,118,108,114,32,104,101,97,100,101,114,32,114,101,97,100,33,0,0,0,0,0,0,0,0,108,97,115,122,105,112,32,118,108,114,32,102,111,117,110,100,0,0,0,0,0,0,0,0,78,54,108,97,115,122,105,112,49,51,110,111,95,108,97,115,122,105,112,95,118,108,114,69,0,0,0,0,0,0,0,0,224,85,0,0,32,23,0,0,80,39,0,0,0,0,0,0,112,117,115,104,105,110,103,33,0,0,0,0,0,0,0,0,78,111,32,76,65,83,122,105,112,32,86,76,82,32,119,97,115,32,102,111,117,110,100,32,105,110,32,116,104,101,32,86,76,82,115,32,115,101,99,116,105,111,110,0,0,0,0,0,0,0,0,0,64,23,0,0,72,0,0,0,73,0,0,0,22,0,0,0,0,0,0,0,78,54,108,97,115,122,105,112,50,53,108,97,115,122,105,112,95,102,111,114,109,97,116,95,117,110,115,117,112,112,111,114,116,101,100,69,0,0,0,0,224,85,0,0,168,23,0,0,80,39,0,0,0,0,0,0,99,111,109,112,114,101,115,115,111,114,32,105,115,58,32,0,116,111,116,97,108,32,105,116,101,109,115,58,32,0,0,0,80,97,114,115,105,110,103,32,116,104,114,111,117,103,104,32,105,116,101,109,115,32,110,111,119,33,0,0,0,0,0,0,80,117,115,104,105,110,103,32,105,116,101,109,32,97,116,32,105,110,100,101,120,58,32,0,79,110,108,121,32,76,65,83,122,105,112,32,80,79,73,78,84,87,73,83,69,32,67,72,85,78,75,69,68,32,100,101,99,111,109,112,114,101,115,115,111,114,32,105,115,32,115,117,112,112,111,114,116,101,100,0,0,0,0,0,208,23,0,0,74,0,0,0,75,0,0,0,22,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,55,98,97,100,95,102,117,110,99,116,105,111,110,95,99,97,108,108,69,0,0,0,0,0,224,85,0,0,136,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,24,0,0,76,0,0,0,77,0,0,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,26,0,0,78,0,0,0,79,0,0,0,28,0,0,0,27,0,0,0,80,0,0,0,81,0,0,0,28,0,0,0,29,0,0,0,29,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,48,95,95,102,117,110,99,116,105,111,110,54,95,95,102,117,110,99,73,90,78,54,108,97,115,122,105,112,50,105,111,54,114,101,97,100,101,114,49,48,98,97,115,105,99,95,102,105,108,101,73,78,83,50,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,49,49,95,118,97,108,105,100,97,116,111,114,115,69,118,69,85,108,82,78,83,51,95,54,104,101,97,100,101,114,69,69,95,78,83,95,57,97,108,108,111,99,97,116,111,114,73,83,66,95,69,69,70,118,83,65,95,69,69,69,0,0,0,0,78,83,116,51,95,95,49,49,48,95,95,102,117,110,99,116,105,111,110,54,95,95,98,97,115,101,73,70,118,82,78,54,108,97,115,122,105,112,50,105,111,54,104,101,97,100,101,114,69,69,69,69,0,0,0,0,120,84,0,0,208,25,0,0,224,85,0,0,56,25,0,0,8,26,0,0,0,0,0,0,90,78,54,108,97,115,122,105,112,50,105,111,54,114,101,97,100,101,114,49,48,98,97,115,105,99,95,102,105,108,101,73,78,83,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,49,49,95,118,97,108,105,100,97,116,111,114,115,69,118,69,85,108,82,78,83,48,95,54,104,101,97,100,101,114,69,69,95,0,0,0,120,84,0,0,32,26,0,0,78,54,108,97,115,122,105,112,50,49,111,108,100,95,115,116,121,108,101,95,99,111,109,112,114,101,115,115,105,111,110,69,0,0,0,0,0,0,0,0,224,85,0,0,136,26,0,0,80,39,0,0,0,0,0,0,78,54,108,97,115,122,105,112,49,52,110,111,116,95,99,111,109,112,114,101,115,115,101,100,69,0,0,0,0,0,0,0,224,85,0,0,192,26,0,0,80,39,0,0,0,0,0,0,84,104,101,32,102,105,108,101,32,100,111,101,115,110,39,116,32,115,101,101,109,32,116,111,32,98,101,32,99,111,109,112,114,101,115,115,101,100,0,0,0,0,0,0,224,26,0,0,82,0,0,0,83,0,0,0,22,0,0,0,0,0,0,0,84,104,101,32,102,105,108,101,32,115,101,101,109,115,32,116,111,32,104,97,118,101,32,111,108,100,32,115,116,121,108,101,32,99,111,109,112,114,101,115,115,105,111,110,32,119,104,105,99,104,32,105,115,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,0,0,0,0,0,0,0,0,176,26,0,0,84,0,0,0,85,0,0,0,22,0,0,0,0,0,0,0,70,105,108,101,32,109,97,103,105,99,32,105,115,32,110,111,116,32,118,97,108,105,100,0,0,0,0,0,152,20,0,0,86,0,0,0,87,0,0,0,22,0,0,0,0,0,0,0,103,111,105,110,103,32,100,111,119,110,33,0,0,0,0,0,0,0,0,0,128,28,0,0,88,0,0,0,89,0,0,0,90,0,0,0,30,0,0,0,91,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,115,104,97,114,101,100,95,112,116,114,95,112,111,105,110,116,101,114,73,80,78,54,108,97,115,122,105,112,50,105,111,54,114,101,97,100,101,114,49,48,98,97,115,105,99,95,102,105,108,101,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,78,83,95,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,83,55,95,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,83,55,95,69,69,69,69,0,0,0,0,0,0,224,85,0,0,240,27,0,0,144,38,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,78,54,108,97,115,122,105,112,50,105,111,54,114,101,97,100,101,114,49,48,98,97,115,105,99,95,102,105,108,101,73,78,83,49,95,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,69,69,0,0,0,0,0,120,29,0,0,92,0,0,0,93,0,0,0,94,0,0,0,31,0,0,0,95,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,115,104,97,114,101,100,95,112,116,114,95,112,111,105,110,116,101,114,73,80,78,54,108,97,115,122,105,112,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,78,83,95,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,83,51,95,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,83,51,95,69,69,69,69,0,0,0,224,85,0,0,8,29,0,0,144,38,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,100,101,102,97,117,108,116,95,100,101,108,101,116,101,73,78,54,108,97,115,122,105,112,55,115,116,114,101,97,109,115,49,51,109,101,109,111,114,121,95,115,116,114,101,97,109,69,69,69,0,0,0,0,0,0,118,111,105,100,0,0,0,0,98,111,111,108,0,0,0,0,99,104,97,114,0,0,0,0,115,105,103,110,101,100,32,99,104,97,114,0,0,0,0,0,117,110,115,105,103,110,101,100,32,99,104,97,114,0,0,0,115,104,111,114,116,0,0,0,117,110,115,105,103,110,101,100,32,115,104,111,114,116,0,0,105,110,116,0,0,0,0,0,117,110,115,105,103,110,101,100,32,105,110,116,0,0,0,0,108,111,110,103,0,0,0,0,117,110,115,105,103,110,101,100,32,108,111,110,103,0,0,0,102,108,111,97,116,0,0,0,100,111,117,98,108,101,0,0,115,116,100,58,58,115,116,114,105,110,103,0,0,0,0,0,115,116,100,58,58,98,97,115,105,99,95,115,116,114,105,110,103,60,117,110,115,105,103,110,101,100,32,99,104,97,114,62,0,0,0,0,0,0,0,0,115,116,100,58,58,119,115,116,114,105,110,103,0,0,0,0,101,109,115,99,114,105,112,116,101,110,58,58,118,97,108,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,69,0,0,0,0,0,120,84,0,0,200,30,0,0,78,49,48,101,109,115,99,114,105,112,116,101,110,51,118,97,108,69,0,0,0,0,0,0,120,84,0,0,240,30,0,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,119,69,69,69,69,0,0,78,83,116,51,95,95,49,50,49,95,95,98,97,115,105,99,95,115,116,114,105,110,103,95,99,111,109,109,111,110,73,76,98,49,69,69,69,0,0,0,120,84,0,0,80,31,0,0,64,86,0,0,16,31,0,0,0,0,0,0,1,0,0,0,120,31,0,0,0,0,0,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,104,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,104,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,104,69,69,69,69,0,0,64,86,0,0,152,31,0,0,0,0,0,0,1,0,0,0,120,31,0,0,0,0,0,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,0,64,86,0,0,240,31,0,0,0,0,0,0,1,0,0,0,120,31],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([208,36,0,0,96,0,0,0,97,0,0,0,29,0,0,0,25,0,0,0,23,0,0,0,23,0,0,0,30,0,0,0,31,0,0,0,26,0,0,0,32,0,0,0,33,0,0,0,32,0,0,0,27,0,0,0,33,0,0,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,119,69,69,0,0,0,0,0,0,0,0,224,85,0,0,176,36,0,0,136,44,0,0,0,0,0,0,0,0,0,0,56,37,0,0,98,0,0,0,99,0,0,0,30,0,0,0,25,0,0,0,23,0,0,0,23,0,0,0,34,0,0,0,31,0,0,0,26,0,0,0,35,0,0,0,36,0,0,0,34,0,0,0,28,0,0,0,35,0,0,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,119,69,69,0,224,85,0,0,32,37,0,0,136,44,0,0,0,0,0,0,117,110,115,117,112,112,111,114,116,101,100,32,108,111,99,97,108,101,32,102,111,114,32,115,116,97,110,100,97,114,100,32,105,110,112,117,116,0,0,0,0,0,0,0,208,37,0,0,100,0,0,0,101,0,0,0,31,0,0,0,22,0,0,0,24,0,0,0,24,0,0,0,37,0,0,0,24,0,0,0,23,0,0,0,38,0,0,0,26,0,0,0,36,0,0,0,29,0,0,0,37,0,0,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,99,69,69,0,0,0,0,0,0,0,0,224,85,0,0,176,37,0,0,72,44,0,0,0,0,0,0,0,0,0,0,56,38,0,0,102,0,0,0,103,0,0,0,32,0,0,0,22,0,0,0,24,0,0,0,24,0,0,0,23,0,0,0,24,0,0,0,23,0,0,0,39,0,0,0,40,0,0,0,38,0,0,0,24,0,0,0,39,0,0,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,99,69,69,0,224,85,0,0,32,38,0,0,72,44,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,95,95,115,104,97,114,101,100,95,99,111,117,110,116,69,0,0,0,0,0,0,0,0,120,84,0,0,72,38,0,0,78,83,116,51,95,95,49,49,57,95,95,115,104,97,114,101,100,95,119,101,97,107,95,99,111,117,110,116,69,0,0,0,64,86,0,0,112,38,0,0,0,0,0,0,1,0,0,0,104,38,0,0,0,0,0,0,0,0,0,0,232,38,0,0,104,0,0,0,105,0,0,0,41,0,0,0,0,0,0,0,0,0,0,0,80,39,0,0,106,0,0,0,107,0,0,0,22,0,0,0,0,0,0,0,83,116,49,49,108,111,103,105,99,95,101,114,114,111,114,0,224,85,0,0,216,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,39,0,0,104,0,0,0,108,0,0,0,41,0,0,0,0,0,0,0,83,116,49,50,108,101,110,103,116,104,95,101,114,114,111,114,0,0,0,0,0,0,0,0,224,85,0,0,16,39,0,0,232,38,0,0,0,0,0,0,83,116,49,51,114,117,110,116,105,109,101,95,101,114,114,111,114,0,0,0,0,0,0,0,224,85,0,0,56,39,0,0,0,0,0,0,0,0,0,0,103,101,110,101,114,105,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,115,121,115,116,101,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58,32,0,0,0,0,0,0,0,0,0,0,200,39,0,0,109,0,0,0,110,0,0,0,22,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,50,115,121,115,116,101,109,95,101,114,114,111,114,69,0,0,224,85,0,0,176,39,0,0,80,39,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,101,114,114,111,114,95,99,97,116,101,103,111,114,121,69,0,0,0,0,0,0,0,0,120,84,0,0,216,39,0,0,78,83,116,51,95,95,49,49,50,95,95,100,111,95,109,101,115,115,97,103,101,69,0,0,224,85,0,0,0,40,0,0,248,39,0,0,0,0,0,0,0,0,0,0,120,40,0,0,111,0,0,0,112,0,0,0,42,0,0,0,22,0,0,0,30,0,0,0,31,0,0,0,23,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,52,95,95,103,101,110,101,114,105,99,95,101,114,114,111,114,95,99,97,116,101,103,111,114,121,69,0,0,0,0,0,0,224,85,0,0,80,40,0,0,24,40,0,0,0,0,0,0,0,0,0,0,216,40,0,0,113,0,0,0,114,0,0,0,43,0,0,0,24,0,0,0,30,0,0,0,31,0,0,0,25,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,51,95,95,115,121,115,116,101,109,95,101,114,114,111,114,95,99,97,116,101,103,111,114,121,69,0,0,0,0,0,0,0,224,85,0,0,176,40,0,0,24,40,0,0,0,0,0,0,109,117,116,101,120,32,108,111,99,107,32,102,97,105,108,101,100,0,0,0,0,0,0,0,101,99,32,61,61,32,48,0,47,85,115,101,114,115,47,118,101,114,109,97,47,116,109,112,47,101,109,115,99,114,105,112,116,101,110,47,115,121,115,116,101,109,47,108,105,98,47,108,105,98,99,120,120,47,109,117,116,101,120,46,99,112,112,0,117,110,108,111,99,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,97,115,105,99,95,115,116,114,105,110,103,0,0,0,0,0,0,0,0,72,44,0,0,115,0,0,0,116,0,0,0,26,0,0,0,22,0,0,0,24,0,0,0,24,0,0,0,23,0,0,0,24,0,0,0,23,0,0,0,38,0,0,0,26,0,0,0,36,0,0,0,24,0,0,0,39,0,0,0,0,0,0,0,136,44,0,0,117,0,0,0,118,0,0,0,33,0,0,0,25,0,0,0,23,0,0,0,23,0,0,0,34,0,0,0,31,0,0,0,26,0,0,0,32,0,0,0,33,0,0,0,32,0,0,0,28,0,0,0,35,0,0,0,8,0,0,0,0,0,0,0,192,44,0,0,56,0,0,0,57,0,0,0,248,255,255,255,248,255,255,255,192,44,0,0,58,0,0,0,59,0,0,0,8,0,0,0,0,0,0,0,8,45,0,0,119,0,0,0,120,0,0,0,248,255,255,255,248,255,255,255,8,45,0,0,121,0,0,0,122,0,0,0,4,0,0,0,0,0,0,0,80,45,0,0,123,0,0,0,124,0,0,0,252,255,255,255,252,255,255,255,80,45,0,0,125,0,0,0,126,0,0,0,4,0,0,0,0,0,0,0,152,45,0,0,127,0,0,0,128,0,0,0,252,255,255,255,252,255,255,255,152,45,0,0,129,0,0,0,130,0,0,0,105,111,115,116,114,101,97,109,0,0,0,0,0,0,0,0,117,110,115,112,101,99,105,102,105,101,100,32,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,32,101,114,114,111,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,43,0,0,131,0,0,0,132,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,136,43,0,0,133,0,0,0,134,0,0,0,105,111,115,95,98,97,115,101,58,58,99,108,101,97,114,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,55,102,97,105,108,117,114,101,69,0,0,0,0,0,0,0,224,85,0,0,64,43,0,0,200,39,0,0,0,0,0,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,69,0,0,0,0,0,0,0,120,84,0,0,112,43,0,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,0,0,0,0,0,224,85,0,0,144,43,0,0,136,43,0,0,0,0,0,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,0,0,0,0,0,224,85,0,0,208,43,0,0,136,43,0,0,0,0,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,0,0,0,0,0,0,120,84,0,0,16,44,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,0,0,0,0,0,0,120,84,0,0,80,44,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,64,86,0,0,144,44,0,0,0,0,0,0,1,0,0,0,192,43,0,0,3,244,255,255,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,64,86,0,0,216,44,0,0,0,0,0,0,1,0,0,0,0,44,0,0,3,244,255,255,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,64,86,0,0,32,45,0,0,0,0,0,0,1,0,0,0,192,43,0,0,3,244,255,255,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,64,86,0,0,104,45,0,0,0,0,0,0,1,0,0,0,0,44,0,0,3,244,255,255,78,83,116,51,95,95,49,49,52,98,97,115,105,99,95,105,111,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,64,86,0,0,176,45,0,0,3,0,0,0,2,0,0,0,192,44,0,0,2,0,0,0,80,45,0,0,2,8,0,0,0,0,0,0,72,46,0,0,135,0,0,0,136,0,0,0,44,0,0,0,22,0,0,0,30,0,0,0,31,0,0,0,26,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,57,95,95,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,69,0,0,0,224,85,0,0,40,46,0,0,24,40,0,0,0,0,0,0,0,0,0,0,56,60,0,0,137,0,0,0,138,0,0,0,139,0,0,0,22,0,0,0,25,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,60,0,0,140,0,0,0,141,0,0,0,139,0,0,0,23,0,0,0,26,0,0,0,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,65,0,0,142,0,0,0,143,0,0,0,139,0,0,0,22,0,0,0,23,0,0,0,24,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,30,0,0,0,31,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,65,66,67,68,69,70,120,88,43,45,112,80,105,73,110,78,0,0,0,0,0,0,0,0,37,112,0,0,0,0,0,0,0,0,0,0,168,65,0,0,144,0,0,0,145,0,0,0,139,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,37,0,0,0,38,0,0,0,39,0,0,0,40,0,0,0,41,0,0,0,42,0,0,0,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,66,0,0,146,0,0,0,147,0,0,0,139,0,0,0,25,0,0,0,26,0,0,0,44,0,0,0,27,0,0,0,45,0,0,0,22,0,0,0,23,0,0,0,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,0,0,148,0,0,0,149,0,0,0,139,0,0,0,29,0,0,0,30,0,0,0,46,0,0,0,31,0,0,0,47,0,0,0,24,0,0,0,25,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,0,0,0,0,37,112,0,0,0,0,0,0,0,0,0,0,40,62,0,0,150,0,0,0,151,0,0,0,139,0,0,0,45,0,0,0,48,0,0,0,49,0,0,0,50,0,0,0,51,0,0,0,52,0,0,0,22,0,0,0,248,255,255,255,40,62,0,0,46,0,0,0,47,0,0,0,48,0,0,0,49,0,0,0,50,0,0,0,51,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,72,58,37,77,58,37,83,37,109,47,37,100,47,37,121,37,89,45,37,109,45,37,100,37,73,58,37,77,58,37,83,32,37,112,0,0,0,0,0,37,72,58,37,77,0,0,0,37,72,58,37,77,58,37,83,0,0,0,0,200,62,0,0,152,0,0,0,153,0,0,0,139,0,0,0,53,0,0,0,53,0,0,0,54,0,0,0,55,0,0,0,56,0,0,0,57,0,0,0,23,0,0,0,248,255,255,255,200,62,0,0,54,0,0,0,55,0,0,0,56,0,0,0,57,0,0,0,58,0,0,0,59,0,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,37,0,0,0,89,0,0,0,45,0,0,0,37,0,0,0,109,0,0,0,45,0,0,0,37,0,0,0,100,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,0,0,0,0,88,63,0,0,154,0,0,0,155,0,0,0,139,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,63,0,0,156,0,0,0,157,0,0,0,139,0,0,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,60,0,0,158,0,0,0,159,0,0,0,139,0,0,0,61,0,0,0,62,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,37,0,0,0,63,0,0,0,38,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,60,0,0,160,0,0,0,161,0,0,0,139,0,0,0,64,0,0,0,65,0,0,0,40,0,0,0,41,0,0,0,42,0,0,0,43,0,0,0,66,0,0,0,44,0,0,0,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,61,0,0,162,0,0,0,163,0,0,0,139,0,0,0,67,0,0,0,68,0,0,0,46,0,0,0,47,0,0,0,48,0,0,0,49,0,0,0,69,0,0,0,50,0,0,0,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,61,0,0,164,0,0,0,165,0,0,0,139,0,0,0,70,0,0,0,71,0,0,0,52,0,0,0,53,0,0,0,54,0,0,0,55,0,0,0,72,0,0,0,56,0,0,0,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,67,0,0,166,0,0,0,167,0,0,0,139,0,0,0,24,0,0,0,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,49,50,51,52,53,54,55,56,57,0,0,0,0,0,0,37,76,102,0,0,0,0,0,109,111,110,101,121,95,103,101,116,32,101,114,114,111,114,0,0,0,0,0,32,68,0,0,168,0,0,0,169,0,0,0,139,0,0,0,26,0,0,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,49,50,51,52,53,54,55,56,57,0,0,0,0,0,0,0,0,0,0,176,68,0,0,170,0,0,0,171,0,0,0,139,0,0,0,22,0,0,0,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,46,48,76,102,0,0,0,0,0,0,0,64,69,0,0,172,0,0,0,173,0,0,0,139,0,0,0,23,0,0,0,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,64,0,0,174,0,0,0,175,0,0,0,139,0,0,0,34,0,0,0,33,0,0,0,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,64,0,0,176,0,0,0,177,0,0,0,139,0,0,0,35,0,0,0,34,0,0,0,59,0,0,0,0,0,0,0,0,0,0,0,118,101,99,116,111,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,67,0,0,0,0,0,0,0,0,0,0,0,16,60,0,0,178,0,0,0,179,0,0,0,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,232,56,0,0,180,0,0,0,181,0,0,0,139,0,0,0,40,0,0,0,36,0,0,0,41,0,0,0,37,0,0,0,42,0,0,0,22,0,0,0,38,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,57,0,0,182,0,0,0,183,0,0,0,139,0,0,0,22,0,0,0,23,0,0,0,25,0,0,0,73,0,0,0,74,0,0,0,26,0,0,0,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,59,0,0,184,0,0,0,185,0,0,0,139,0,0,0,76,0,0,0,77,0,0,0,60,0,0,0,61,0,0,0,62,0,0,0,0,0,0,0,232,59,0,0,186,0,0,0,187,0,0,0,139,0,0,0,78,0,0,0,79,0,0,0,63,0,0,0,64,0,0,0,65,0,0,0,116,0,0,0,114,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,102,97,108,115,101,0,0,0,102,0,0,0,97,0,0,0,108,0,0,0,115,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,97,32,37,98,32,37,100,32,37,72,58,37,77,58,37,83,32,37,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,97,0,0,0,32,0,0,0,37,0,0,0,98,0,0,0,32,0,0,0,37,0,0,0,100,0,0,0,32,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,73,58,37,77,58,37,83,32,37,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,0,0,0,0,108,111,99,97,108,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,0,0,0,0,0,0,0,32,56,0,0,188,0,0,0,189,0,0,0,139,0,0,0,0,0,0,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,102,97,99,101,116,69,0,0,0,224,85,0,0,8,56,0,0,104,38,0,0,0,0,0,0,0,0,0,0,176,56,0,0,188,0,0,0,190,0,0,0,139,0,0,0,39,0,0,0,23,0,0,0,24,0,0,0,25,0,0,0,43,0,0,0,40,0,0,0,44,0,0,0,41,0,0,0,45,0,0,0,26,0,0,0,42,0,0,0,27,0,0,0,0,0,0,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,119,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,48,99,116,121,112,101,95,98,97,115,101,69,0,0,0,0,120,84,0,0,144,56,0,0,64,86,0,0,120,56,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,168,56,0,0,2,0,0,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,99,69,69,0,0,0,0,0,0,0,64,86,0,0,208,56,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,168,56,0,0,2,0,0,0,0,0,0,0,128,57,0,0,188,0,0,0,191,0,0,0,139,0,0,0,24,0,0,0,25,0,0,0,28,0,0,0,80,0,0,0,81,0,0,0,29,0,0,0,82,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,99,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,50,99,111,100,101,99,118,116,95,98,97,115,101,69,0,0,120,84,0,0,96,57,0,0,64,86,0,0,56,57,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,120,57,0,0,2,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,119,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,0,64,86,0,0,160,57,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,120,57,0,0,2,0,0,0,0,0,0,0,64,58,0,0,188,0,0,0,192,0,0,0,139,0,0,0,26,0,0,0,27,0,0,0,30,0,0,0,83,0,0,0,84,0,0,0,31,0,0,0,85,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,115,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,64,86,0,0,24,58,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,120,57,0,0,2,0,0,0,0,0,0,0,184,58,0,0,188,0,0,0,193,0,0,0,139,0,0,0,28,0,0,0,29,0,0,0,32,0,0,0,86,0,0,0,87,0,0,0,33,0,0,0,88,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,105,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,64,86,0,0,144,58,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,120,57,0,0,2,0,0,0,0,0,0,0,48,59,0,0,188,0,0,0,194,0,0,0,139,0,0,0,28,0,0,0,29,0,0,0,32,0,0,0,86,0,0,0,87,0,0,0,33,0,0,0,88,0,0,0,78,83,116,51,95,95,49,49,54,95,95,110,97,114,114,111,119,95,116,111,95,117,116,102,56,73,76,106,51,50,69,69,69,0,0,0,0,0,0,0,224,85,0,0,8,59,0,0,184,58,0,0,0,0,0,0,0,0,0,0,152,59,0,0,188,0,0,0,195,0,0,0,139,0,0,0,28,0,0,0,29,0,0,0,32,0,0,0,86,0,0,0,87,0,0,0,33,0,0,0,88,0,0,0,78,83,116,51,95,95,49,49,55,95,95,119,105,100,101,110,95,102,114,111,109,95,117,116,102,56,73,76,106,51,50,69,69,69,0,0,0,0,0,0,224,85,0,0,112,59,0,0,184,58,0,0,0,0,0,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,99,69,69,0,0,0,0,224,85,0,0,168,59,0,0,32,56,0,0,0,0,0,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,119,69,69,0,0,0,0,224,85,0,0,208,59,0,0,32,56,0,0,0,0,0,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,95,95,105,109,112,69,0,0,0,224,85,0,0,248,59,0,0,32,56,0,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,99,69,69,0,0,0,0,0,224,85,0,0,32,60,0,0,32,56,0,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,119,69,69,0,0,0,0,0,224,85,0,0,72,60,0,0,32,56,0,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,48,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,95,98,97,115,101,69,0,0,0,0,120,84,0,0,144,60,0,0,64,86,0,0,112,60,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,168,60,0,0,2,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,49,69,69,69,0,0,0,0,0,64,86,0,0,208,60,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,168,60,0,0,2,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,48,69,69,69,0,0,0,0,0,64,86,0,0,16,61,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,168,60,0,0,2,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,49,69,69,69,0,0,0,0,0,64,86,0,0,80,61,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,168,60,0,0,2,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,57,116,105,109,101,95,98,97,115,101,69,0,0,0,0,0,0,120,84,0,0,216,61,0,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,99,69,69,0,0,0,0,0,0,0,120,84,0,0,248,61,0,0,64,86,0,0,144,61,0,0,0,0,0,0,3,0,0,0,32,56,0,0,2,0,0,0,240,61,0,0,2,0,0,0,32,62,0,0,0,8,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,119,69,69,0,0,0,0,0,0,0,120,84,0,0,152,62,0,0,64,86,0,0,80,62,0,0,0,0,0,0,3,0,0,0,32,56,0,0,2,0,0,0,240,61,0,0,2,0,0,0,192,62,0,0,0,8,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,49,48,95,95,116,105,109,101,95,112,117,116,69,0,0,0,0,120,84,0,0,56,63,0,0,64,86,0,0,240,62,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,80,63,0,0,0,8,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,64,86,0,0,120,63,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,80,63,0,0,0,8,0,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,99,69,69,0,0,0,0,78,83,116,51,95,95,49,49,51,109,101,115,115,97,103,101,115,95,98,97,115,101,69,0,120,84,0,0,248,63,0,0,64,86,0,0,224,63,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,16,64,0,0,2,0,0,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,119,69,69,0,0,0,0,64,86,0,0,56,64,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,16,64,0,0,2,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,99,69,69,0,0,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,103,101,116,95,98,97,115,101,69,0,0,0,0,0,0,0,0,120,84,0,0,208,64,0,0,64,86,0,0,184,64,0,0,0,0,0,0,1,0,0,0,240,64,0,0,0,0,0,0,64,86,0,0,112,64,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,248,64,0,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,119,69,69,0,0,0,64,86,0,0,120,65,0,0,0,0,0,0,1,0,0,0,240,64,0,0,0,0,0,0,64,86,0,0,48,65,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,144,65,0,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,99,69,69,0,0,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,112,117,116,95,98,97,115,101,69,0,0,0,0,0,0,0,0,120,84,0,0,40,66,0,0,64,86,0,0,16,66,0,0,0,0,0,0,1,0,0,0,72,66,0,0,0,0,0,0,64,86,0,0,200,65,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,80,66,0,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,119,69,69,0,0,0,64,86,0,0,208,66,0,0,0,0,0,0,1,0,0,0,72,66,0,0,0,0,0,0,64,86,0,0,136,66,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,232,66,0,0,0,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,99,69,69,0,0,0,0,0,0,0,0,120,84,0,0,104,67,0,0,64,86,0,0,32,67,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,136,67,0,0,0,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,119,69,69,0,0,0,0,0,0,0,0,120,84,0,0,248,67,0,0,64,86,0,0,176,67,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,24,68,0,0,0,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,99,69,69,0,0,0,0,0,0,0,0,120,84,0,0,136,68,0,0,64,86,0,0,64,68,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,168,68,0,0,0,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,119,69,69,0,0,0,0,0,0,0,0,120,84,0,0,24,69,0,0,64,86,0,0,208,68,0,0,0,0,0,0,2,0,0,0,32,56,0,0,2,0,0,0,56,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,80,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,77,0,0,0,0,0,0,80,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,114,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,99,0,0,0,104,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,105,0,0,0,108,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,117,0,0,0,115,0,0,0,116,0,0,0,0,0,0,0,0,0,0,0,83,0,0,0,101,0,0,0,112,0,0,0,116,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,111,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,68,0,0,0,101,0,0,0,99,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,0,0,0,0,65],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+9324);allocate([112,0,0,0,114,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,0,0,0,0,83,0,0,0,101,0,0,0,112,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,0,0,0,0,68,0,0,0,101,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,74,97,110,117,97,114,121,0,70,101,98,114,117,97,114,121,0,0,0,0,0,0,0,0,77,97,114,99,104,0,0,0,65,112,114,105,108,0,0,0,77,97,121,0,0,0,0,0,74,117,110,101,0,0,0,0,74,117,108,121,0,0,0,0,65,117,103,117,115,116,0,0,83,101,112,116,101,109,98,101,114,0,0,0,0,0,0,0,79,99,116,111,98,101,114,0,78,111,118,101,109,98,101,114,0,0,0,0,0,0,0,0,68,101,99,101,109,98,101,114,0,0,0,0,0,0,0,0,74,97,110,0,0,0,0,0,70,101,98,0,0,0,0,0,77,97,114,0,0,0,0,0,65,112,114,0,0,0,0,0,74,117,110,0,0,0,0,0,74,117,108,0,0,0,0,0,65,117,103,0,0,0,0,0,83,101,112,0,0,0,0,0,79,99,116,0,0,0,0,0,78,111,118,0,0,0,0,0,68,101,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,77,0,0,0,111,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,110,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,114,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,70,0,0,0,114,0,0,0,105,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,117,0,0,0,114,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,77,0,0,0,111,0,0,0,110,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,0,0,0,0,70,0,0,0,114,0,0,0,105,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,117,110,100,97,121,0,0,77,111,110,100,97,121,0,0,84,117,101,115,100,97,121,0,87,101,100,110,101,115,100,97,121,0,0,0,0,0,0,0,84,104,117,114,115,100,97,121,0,0,0,0,0,0,0,0,70,114,105,100,97,121,0,0,83,97,116,117,114,100,97,121,0,0,0,0,0,0,0,0,83,117,110,0,0,0,0,0,77,111,110,0,0,0,0,0,84,117,101,0,0,0,0,0,87,101,100,0,0,0,0,0,84,104,117,0,0,0,0,0,70,114,105,0,0,0,0,0,83,97,116,0,0,0,0,0,2,0,0,192,3,0,0,192,4,0,0,192,5,0,0,192,6,0,0,192,7,0,0,192,8,0,0,192,9,0,0,192,10,0,0,192,11,0,0,192,12,0,0,192,13,0,0,192,14,0,0,192,15,0,0,192,16,0,0,192,17,0,0,192,18,0,0,192,19,0,0,192,20,0,0,192,21,0,0,192,22,0,0,192,23,0,0,192,24,0,0,192,25,0,0,192,26,0,0,192,27,0,0,192,28,0,0,192,29,0,0,192,30,0,0,192,31,0,0,192,0,0,0,179,1,0,0,195,2,0,0,195,3,0,0,195,4,0,0,195,5,0,0,195,6,0,0,195,7,0,0,195,8,0,0,195,9,0,0,195,10,0,0,195,11,0,0,195,12,0,0,195,13,0,0,211,14,0,0,195,15,0,0,195,0,0,12,187,1,0,12,195,2,0,12,195,3,0,12,195,4,0,12,211,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,83,0,0,196,0,0,0,197,0,0,0,89,0,0,0,0,0,0,0,115,116,100,58,58,98,97,100,95,99,97,115,116,0,0,0,83,116,57,116,121,112,101,95,105,110,102,111,0,0,0,0,120,84,0,0,88,83,0,0,83,116,56,98,97,100,95,99,97,115,116,0,0,0,0,0,224,85,0,0,112,83,0,0,0,0,0,0,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,0,0,0,0,224,85,0,0,144,83,0,0,104,83,0,0,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,0,0,0,224,85,0,0,200,83,0,0,184,83,0,0,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,0,0,0,224,85,0,0,40,84,0,0,184,83,0,0,0,0,0,0,224,85,0,0,0,84,0,0,80,84,0,0,0,0,0,0,0,0,0,0,240,83,0,0,198,0,0,0,199,0,0,0,200,0,0,0,201,0,0,0,43,0,0,0,35,0,0,0,22,0,0,0,27,0,0,0,0,0,0,0,96,84,0,0,198,0,0,0,202,0,0,0,200,0,0,0,201,0,0,0,44,0,0,0,0,0,0,0,0,0,0,0,0,85,0,0,198,0,0,0,203,0,0,0,200,0,0,0,201,0,0,0,45,0,0,0,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,51,95,95,102,117,110,100,97,109,101,110,116,97,108,95,116,121,112,101,95,105,110,102,111,69,0,224,85,0,0,216,84,0,0,184,83,0,0,0,0,0,0,192,84,0,0,112,17,0,0,68,110,0,0,0,0,0,0,192,84,0,0,24,85,0,0,98,0,0,0,0,0,0,0,192,84,0,0,40,85,0,0,99,0,0,0,0,0,0,0,192,84,0,0,56,85,0,0,104,0,0,0,0,0,0,0,192,84,0,0,72,85,0,0,97,0,0,0,0,0,0,0,192,84,0,0,88,85,0,0,192,84,0,0,128,17,0,0,192,84,0,0,120,17,0,0,105,0,0,0,0,0,0,0,192,84,0,0,120,85,0,0,106,0,0,0,0,0,0,0,192,84,0,0,136,85,0,0,108,0,0,0,0,0,0,0,192,84,0,0,152,85,0,0,109,0,0,0,0,0,0,0,192,84,0,0,168,85,0,0,102,0,0,0,0,0,0,0,192,84,0,0,184,85,0,0,100,0,0,0,0,0,0,0,192,84,0,0,200,85,0,0,0,0,0,0,40,86,0,0,198,0,0,0,204,0,0,0,200,0,0,0,201,0,0,0,43,0,0,0,36,0,0,0,23,0,0,0,28,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,224,85,0,0,0,86,0,0,240,83,0,0,0,0,0,0,0,0,0,0,136,86,0,0,198,0,0,0,205,0,0,0,200,0,0,0,201,0,0,0,43,0,0,0,37,0,0,0,24,0,0,0,29,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,49,95,95,118,109,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,224,85,0,0,96,86,0,0,240,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,88,0,0,206,0,0,0,207,0,0,0,90,0,0,0,0,0,0,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,0,83,116,57,98,97,100,95,97,108,108,111,99,0,0,0,0,224,85,0,0,184,88,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,255,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,1,2,4,7,3,6,5,0,0,0,0,0,0,0,0,105,110,102,105,110,105,116,121,0,0,0,0,0,0,0,0,110,97,110,0,0,0,0,0,95,112,137,0,255,9,47,15,10,0,0,0,100,0,0,0,232,3,0,0,16,39,0,0,160,134,1,0,64,66,15,0,128,150,152,0,0,225,245,5],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+19564);var tempDoublePtr=Runtime.alignMemory(allocate(12,"i8",ALLOC_STATIC),8);assert(tempDoublePtr%8==0);function copyTempFloat(ptr){HEAP8[tempDoublePtr]=HEAP8[ptr];HEAP8[tempDoublePtr+1]=HEAP8[ptr+1];HEAP8[tempDoublePtr+2]=HEAP8[ptr+2];HEAP8[tempDoublePtr+3]=HEAP8[ptr+3]}function copyTempDouble(ptr){HEAP8[tempDoublePtr]=HEAP8[ptr];HEAP8[tempDoublePtr+1]=HEAP8[ptr+1];HEAP8[tempDoublePtr+2]=HEAP8[ptr+2];HEAP8[tempDoublePtr+3]=HEAP8[ptr+3];HEAP8[tempDoublePtr+4]=HEAP8[ptr+4];HEAP8[tempDoublePtr+5]=HEAP8[ptr+5];HEAP8[tempDoublePtr+6]=HEAP8[ptr+6];HEAP8[tempDoublePtr+7]=HEAP8[ptr+7]}function _atexit(func,arg){__ATEXIT__.unshift({func:func,arg:arg})}var ___cxa_atexit=_atexit;Module["_i64Subtract"]=_i64Subtract;Module["_i64Add"]=_i64Add;function __ZSt18uncaught_exceptionv(){return!!__ZSt18uncaught_exceptionv.uncaught_exception}function ___cxa_is_number_type(type){var isNumber=false;try{if(type==__ZTIi)isNumber=true}catch(e){}try{if(type==__ZTIj)isNumber=true}catch(e){}try{if(type==__ZTIl)isNumber=true}catch(e){}try{if(type==__ZTIm)isNumber=true}catch(e){}try{if(type==__ZTIx)isNumber=true}catch(e){}try{if(type==__ZTIy)isNumber=true}catch(e){}try{if(type==__ZTIf)isNumber=true}catch(e){}try{if(type==__ZTId)isNumber=true}catch(e){}try{if(type==__ZTIe)isNumber=true}catch(e){}try{if(type==__ZTIc)isNumber=true}catch(e){}try{if(type==__ZTIa)isNumber=true}catch(e){}try{if(type==__ZTIh)isNumber=true}catch(e){}try{if(type==__ZTIs)isNumber=true}catch(e){}try{if(type==__ZTIt)isNumber=true}catch(e){}return isNumber}function ___cxa_does_inherit(definiteType,possibilityType,possibility){if(possibility==0)return false;if(possibilityType==0||possibilityType==definiteType)return true;var possibility_type_info;if(___cxa_is_number_type(possibilityType)){possibility_type_info=possibilityType}else{var possibility_type_infoAddr=HEAP32[possibilityType>>2]-8;possibility_type_info=HEAP32[possibility_type_infoAddr>>2]}switch(possibility_type_info){case 0:var definite_type_infoAddr=HEAP32[definiteType>>2]-8;var definite_type_info=HEAP32[definite_type_infoAddr>>2];if(definite_type_info==0){var defPointerBaseAddr=definiteType+8;var defPointerBaseType=HEAP32[defPointerBaseAddr>>2];var possPointerBaseAddr=possibilityType+8;var possPointerBaseType=HEAP32[possPointerBaseAddr>>2];return ___cxa_does_inherit(defPointerBaseType,possPointerBaseType,possibility)}else return false;case 1:return false;case 2:var parentTypeAddr=possibilityType+8;var parentType=HEAP32[parentTypeAddr>>2];return ___cxa_does_inherit(definiteType,parentType,possibility);default:return false}}var ___cxa_last_thrown_exception=0;function ___resumeException(ptr){Module.print("Resuming exception");if(!___cxa_last_thrown_exception){___cxa_last_thrown_exception=ptr}throw ptr}var ___cxa_exception_header_size=8;function ___cxa_find_matching_catch(thrown,throwntype){if(thrown==-1)thrown=___cxa_last_thrown_exception;header=thrown-___cxa_exception_header_size;if(throwntype==-1)throwntype=HEAP32[header>>2];var typeArray=Array.prototype.slice.call(arguments,2);if(throwntype!=0&&!___cxa_is_number_type(throwntype)){var throwntypeInfoAddr=HEAP32[throwntype>>2]-8;var throwntypeInfo=HEAP32[throwntypeInfoAddr>>2];if(throwntypeInfo==0)thrown=HEAP32[thrown>>2]}for(var i=0;i<typeArray.length;i++){if(___cxa_does_inherit(typeArray[i],throwntype,thrown))return(asm["setTempRet0"](typeArray[i]),thrown)|0}return(asm["setTempRet0"](throwntype),thrown)|0}function ___cxa_throw(ptr,type,destructor){if(!___cxa_throw.initialized){try{HEAP32[__ZTVN10__cxxabiv119__pointer_type_infoE>>2]=0}catch(e){}try{HEAP32[__ZTVN10__cxxabiv117__class_type_infoE>>2]=1}catch(e){}try{HEAP32[__ZTVN10__cxxabiv120__si_class_type_infoE>>2]=2}catch(e){}___cxa_throw.initialized=true}Module.printErr("Compiled code throwing an exception, "+[ptr,type,destructor]+", at "+stackTrace());var header=ptr-___cxa_exception_header_size;HEAP32[header>>2]=type;HEAP32[header+4>>2]=destructor;___cxa_last_thrown_exception=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exception=1}else{__ZSt18uncaught_exceptionv.uncaught_exception++}throw ptr}function __embind_register_bool(){Module["printErr"]("missing function: _embind_register_bool");abort(-1)}function _pthread_mutex_lock(){}function __embind_register_std_string(){Module["printErr"]("missing function: _embind_register_std_string");abort(-1)}function __embind_register_std_wstring(){Module["printErr"]("missing function: _embind_register_std_wstring");abort(-1)}var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};var ERRNO_MESSAGES={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};var ___errno_state=0;function ___setErrNo(value){HEAP32[___errno_state>>2]=value;return value}var PATH={splitPath:(function(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)}),normalizeArray:(function(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}),normalize:(function(path){var isAbsolute=path.charAt(0)==="/",trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter((function(p){return!!p})),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path}),dirname:(function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir}),basename:(function(path){if(path==="/")return"/";var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)}),extname:(function(path){return PATH.splitPath(path)[3]}),join:(function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))}),join2:(function(l,r){return PATH.normalize(l+"/"+r)}),resolve:(function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter((function(p){return!!p})),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."}),relative:(function(from,to){from=PATH.resolve(from).substr(1);to=PATH.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")})};var TTY={ttys:[],init:(function(){}),shutdown:(function(){}),register:(function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)}),stream_ops:{open:(function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)}stream.tty=tty;stream.seekable=false}),close:(function(stream){if(stream.tty.output.length){stream.tty.ops.put_char(stream.tty,10)}}),read:(function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(ERRNO_CODES.ENXIO)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EIO)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(ERRNO_CODES.EAGAIN)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead}),write:(function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(ERRNO_CODES.ENXIO)}for(var i=0;i<length;i++){try{stream.tty.ops.put_char(stream.tty,buffer[offset+i])}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EIO)}}if(length){stream.node.timestamp=Date.now()}return i})},default_tty_ops:{get_char:(function(tty){if(!tty.input.length){var result=null;if(ENVIRONMENT_IS_NODE){result=process["stdin"]["read"]();if(!result){if(process["stdin"]["_readableState"]&&process["stdin"]["_readableState"]["ended"]){return null}return undefined}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()}),put_char:(function(tty,val){if(val===null||val===10){Module["print"](tty.output.join(""));tty.output=[]}else{tty.output.push(TTY.utf8.processCChar(val))}})},default_tty1_ops:{put_char:(function(tty,val){if(val===null||val===10){Module["printErr"](tty.output.join(""));tty.output=[]}else{tty.output.push(TTY.utf8.processCChar(val))}})}};var MEMFS={ops_table:null,CONTENT_OWNING:1,CONTENT_FLEXIBLE:2,CONTENT_FIXED:3,mount:(function(mount){return MEMFS.createNode(null,"/",16384|511,0)}),createNode:(function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.contents=[];node.contentMode=MEMFS.CONTENT_FLEXIBLE}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node}return node}),ensureFlexible:(function(node){if(node.contentMode!==MEMFS.CONTENT_FLEXIBLE){var contents=node.contents;node.contents=Array.prototype.slice.call(contents);node.contentMode=MEMFS.CONTENT_FLEXIBLE}}),node_ops:{getattr:(function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.contents.length}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr}),setattr:(function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.ensureFlexible(node);var contents=node.contents;if(attr.size<contents.length)contents.length=attr.size;else while(attr.size>contents.length)contents.push(0)}}),lookup:(function(parent,name){throw FS.genericErrors[ERRNO_CODES.ENOENT]}),mknod:(function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)}),rename:(function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY)}}}delete old_node.parent.contents[old_node.name];old_node.name=new_name;new_dir.contents[new_name]=old_node;old_node.parent=new_dir}),unlink:(function(parent,name){delete parent.contents[name]}),rmdir:(function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY)}delete parent.contents[name]}),readdir:(function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries}),symlink:(function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node}),readlink:(function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return node.link})},stream_ops:{read:(function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}return size}),write:(function(stream,buffer,offset,length,position,canOwn){var node=stream.node;node.timestamp=Date.now();var contents=node.contents;if(length&&contents.length===0&&position===0&&buffer.subarray){if(canOwn&&offset===0){node.contents=buffer;node.contentMode=buffer.buffer===HEAP8.buffer?MEMFS.CONTENT_OWNING:MEMFS.CONTENT_FIXED}else{node.contents=new Uint8Array(buffer.subarray(offset,offset+length));node.contentMode=MEMFS.CONTENT_FIXED}return length}MEMFS.ensureFlexible(node);var contents=node.contents;while(contents.length<position)contents.push(0);for(var i=0;i<length;i++){contents[position+i]=buffer[offset+i]}return length}),llseek:(function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.contents.length}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}stream.ungotten=[];stream.position=position;return position}),allocate:(function(stream,offset,length){MEMFS.ensureFlexible(stream.node);var contents=stream.node.contents;var limit=offset+length;while(limit>contents.length)contents.push(0)}),mmap:(function(stream,buffer,offset,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&(contents.buffer===buffer||contents.buffer===buffer.buffer)){allocated=false;ptr=contents.byteOffset}else{if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}allocated=true;ptr=_malloc(length);if(!ptr){throw new FS.ErrnoError(ERRNO_CODES.ENOMEM)}buffer.set(contents,ptr)}return{ptr:ptr,allocated:allocated}})}};var IDBFS={dbs:{},indexedDB:(function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB}),DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:(function(mount){return MEMFS.mount.apply(null,arguments)}),syncfs:(function(mount,populate,callback){IDBFS.getLocalSet(mount,(function(err,local){if(err)return callback(err);IDBFS.getRemoteSet(mount,(function(err,remote){if(err)return callback(err);var src=populate?remote:local;var dst=populate?local:remote;IDBFS.reconcile(src,dst,callback)}))}))}),getDB:(function(name,callback){var db=IDBFS.dbs[name];if(db){return callback(null,db)}var req;try{req=IDBFS.indexedDB().open(name,IDBFS.DB_VERSION)}catch(e){return callback(e)}req.onupgradeneeded=(function(e){var db=e.target.result;var transaction=e.target.transaction;var fileStore;if(db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)){fileStore=transaction.objectStore(IDBFS.DB_STORE_NAME)}else{fileStore=db.createObjectStore(IDBFS.DB_STORE_NAME)}fileStore.createIndex("timestamp","timestamp",{unique:false})});req.onsuccess=(function(){db=req.result;IDBFS.dbs[name]=db;callback(null,db)});req.onerror=(function(){callback(this.error)})}),getLocalSet:(function(mount,callback){var entries={};function isRealDir(p){return p!=="."&&p!==".."}function toAbsolute(root){return(function(p){return PATH.join2(root,p)})}var check=FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));while(check.length){var path=check.pop();var stat;try{stat=FS.stat(path)}catch(e){return callback(e)}if(FS.isDir(stat.mode)){check.push.apply(check,FS.readdir(path).filter(isRealDir).map(toAbsolute(path)))}entries[path]={timestamp:stat.mtime}}return callback(null,{type:"local",entries:entries})}),getRemoteSet:(function(mount,callback){var entries={};IDBFS.getDB(mount.mountpoint,(function(err,db){if(err)return callback(err);var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readonly");transaction.onerror=(function(){callback(this.error)});var store=transaction.objectStore(IDBFS.DB_STORE_NAME);var index=store.index("timestamp");index.openKeyCursor().onsuccess=(function(event){var cursor=event.target.result;if(!cursor){return callback(null,{type:"remote",db:db,entries:entries})}entries[cursor.primaryKey]={timestamp:cursor.key};cursor.continue()})}))}),loadLocalEntry:(function(path,callback){var stat,node;try{var lookup=FS.lookupPath(path);node=lookup.node;stat=FS.stat(path)}catch(e){return callback(e)}if(FS.isDir(stat.mode)){return callback(null,{timestamp:stat.mtime,mode:stat.mode})}else if(FS.isFile(stat.mode)){return callback(null,{timestamp:stat.mtime,mode:stat.mode,contents:node.contents})}else{return callback(new Error("node type not supported"))}}),storeLocalEntry:(function(path,entry,callback){try{if(FS.isDir(entry.mode)){FS.mkdir(path,entry.mode)}else if(FS.isFile(entry.mode)){FS.writeFile(path,entry.contents,{encoding:"binary",canOwn:true})}else{return callback(new Error("node type not supported"))}FS.utime(path,entry.timestamp,entry.timestamp)}catch(e){return callback(e)}callback(null)}),removeLocalEntry:(function(path,callback){try{var lookup=FS.lookupPath(path);var stat=FS.stat(path);if(FS.isDir(stat.mode)){FS.rmdir(path)}else if(FS.isFile(stat.mode)){FS.unlink(path)}}catch(e){return callback(e)}callback(null)}),loadRemoteEntry:(function(store,path,callback){var req=store.get(path);req.onsuccess=(function(event){callback(null,event.target.result)});req.onerror=(function(){callback(this.error)})}),storeRemoteEntry:(function(store,path,entry,callback){var req=store.put(entry,path);req.onsuccess=(function(){callback(null)});req.onerror=(function(){callback(this.error)})}),removeRemoteEntry:(function(store,path,callback){var req=store.delete(path);req.onsuccess=(function(){callback(null)});req.onerror=(function(){callback(this.error)})}),reconcile:(function(src,dst,callback){var total=0;var create=[];Object.keys(src.entries).forEach((function(key){var e=src.entries[key];var e2=dst.entries[key];if(!e2||e.timestamp>e2.timestamp){create.push(key);total++}}));var remove=[];Object.keys(dst.entries).forEach((function(key){var e=dst.entries[key];var e2=src.entries[key];if(!e2){remove.push(key);total++}}));if(!total){return callback(null)}var errored=false;var completed=0;var db=src.type==="remote"?src.db:dst.db;var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readwrite");var store=transaction.objectStore(IDBFS.DB_STORE_NAME);function done(err){if(err){if(!done.errored){done.errored=true;return callback(err)}return}if(++completed>=total){return callback(null)}}transaction.onerror=(function(){done(this.error)});create.sort().forEach((function(path){if(dst.type==="local"){IDBFS.loadRemoteEntry(store,path,(function(err,entry){if(err)return done(err);IDBFS.storeLocalEntry(path,entry,done)}))}else{IDBFS.loadLocalEntry(path,(function(err,entry){if(err)return done(err);IDBFS.storeRemoteEntry(store,path,entry,done)}))}}));remove.sort().reverse().forEach((function(path){if(dst.type==="local"){IDBFS.removeLocalEntry(path,done)}else{IDBFS.removeRemoteEntry(store,path,done)}}))})};var NODEFS={isWindows:false,staticInit:(function(){NODEFS.isWindows=!!process.platform.match(/^win/)}),mount:(function(mount){assert(ENVIRONMENT_IS_NODE);return NODEFS.createNode(null,"/",NODEFS.getMode(mount.opts.root),0)}),createNode:(function(parent,name,mode,dev){if(!FS.isDir(mode)&&!FS.isFile(mode)&&!FS.isLink(mode)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var node=FS.createNode(parent,name,mode);node.node_ops=NODEFS.node_ops;node.stream_ops=NODEFS.stream_ops;return node}),getMode:(function(path){var stat;try{stat=fs.lstatSync(path);if(NODEFS.isWindows){stat.mode=stat.mode|(stat.mode&146)>>1}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return stat.mode}),realPath:(function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)}),flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:(function(flags){if(flags in NODEFS.flagsToPermissionStringMap){return NODEFS.flagsToPermissionStringMap[flags]}else{return flags}}),node_ops:{getattr:(function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}}),setattr:(function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),lookup:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)}),mknod:(function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,"",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return node}),rename:(function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),unlink:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),rmdir:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),readdir:(function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),symlink:(function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),readlink:(function(node){var path=NODEFS.realPath(node);try{return fs.readlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}})},stream_ops:{open:(function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsToPermissionString(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),close:(function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),read:(function(stream,buffer,offset,length,position){var nbuffer=new Buffer(length);var res;try{res=fs.readSync(stream.nfd,nbuffer,0,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(res>0){for(var i=0;i<res;i++){buffer[offset+i]=nbuffer[i]}}return res}),write:(function(stream,buffer,offset,length,position){var nbuffer=new Buffer(buffer.subarray(offset,offset+length));var res;try{res=fs.writeSync(stream.nfd,nbuffer,0,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}return res}),llseek:(function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=fs.fstatSync(stream.nfd);position+=stat.size}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}stream.position=position;return position})}};var _stdin=allocate(1,"i32*",ALLOC_STATIC);var _stdout=allocate(1,"i32*",ALLOC_STATIC);var _stderr=allocate(1,"i32*",ALLOC_STATIC);var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},handleFSError:(function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)}),lookupPath:(function(path,opts){path=PATH.resolve(FS.cwd(),path);opts=opts||{};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(ERRNO_CODES.ELOOP)}var parts=PATH.normalizeArray(path.split("/").filter((function(p){return!!p})),false);var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}current=FS.lookupNode(current,parts[i]);current_path=PATH.join2(current_path,parts[i]);if(FS.isMountpoint(current)){if(!islast||islast&&opts.follow_mount){current=current.mounted.root}}if(!islast||opts.follow){var count=0;while(FS.isLink(current.mode)){var link=FS.readlink(current_path);current_path=PATH.resolve(PATH.dirname(current_path),link);var lookup=FS.lookupPath(current_path,{recurse_count:opts.recurse_count});current=lookup.node;if(count++>40){throw new FS.ErrnoError(ERRNO_CODES.ELOOP)}}}}return{path:current_path,node:current}}),getPath:(function(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}}),hashName:(function(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length}),hashAddNode:(function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node}),hashRemoveNode:(function(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}}),lookupNode:(function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)}),createNode:(function(parent,name,mode,rdev){if(!FS.FSNode){FS.FSNode=(function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev});FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.FSNode.prototype,{read:{get:(function(){return(this.mode&readMode)===readMode}),set:(function(val){val?this.mode|=readMode:this.mode&=~readMode})},write:{get:(function(){return(this.mode&writeMode)===writeMode}),set:(function(val){val?this.mode|=writeMode:this.mode&=~writeMode})},isFolder:{get:(function(){return FS.isDir(this.mode)})},isDevice:{get:(function(){return FS.isChrdev(this.mode)})}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node}),destroyNode:(function(node){FS.hashRemoveNode(node)}),isRoot:(function(node){return node===node.parent}),isMountpoint:(function(node){return!!node.mounted}),isFile:(function(mode){return(mode&61440)===32768}),isDir:(function(mode){return(mode&61440)===16384}),isLink:(function(mode){return(mode&61440)===40960}),isChrdev:(function(mode){return(mode&61440)===8192}),isBlkdev:(function(mode){return(mode&61440)===24576}),isFIFO:(function(mode){return(mode&61440)===4096}),isSocket:(function(mode){return(mode&49152)===49152}),flagModes:{"r":0,"rs":1052672,"r+":2,"w":577,"wx":705,"xw":705,"w+":578,"wx+":706,"xw+":706,"a":1089,"ax":1217,"xa":1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:(function(str){var flags=FS.flagModes[str];if(typeof flags==="undefined"){throw new Error("Unknown file open mode: "+str)}return flags}),flagsToPermissionString:(function(flag){var accmode=flag&2097155;var perms=["r","w","rw"][accmode];if(flag&512){perms+="w"}return perms}),nodePermissions:(function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf("r")!==-1&&!(node.mode&292)){return ERRNO_CODES.EACCES}else if(perms.indexOf("w")!==-1&&!(node.mode&146)){return ERRNO_CODES.EACCES}else if(perms.indexOf("x")!==-1&&!(node.mode&73)){return ERRNO_CODES.EACCES}return 0}),mayLookup:(function(dir){return FS.nodePermissions(dir,"x")}),mayCreate:(function(dir,name){try{var node=FS.lookupNode(dir,name);return ERRNO_CODES.EEXIST}catch(e){}return FS.nodePermissions(dir,"wx")}),mayDelete:(function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,"wx");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return ERRNO_CODES.ENOTDIR}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return ERRNO_CODES.EBUSY}}else{if(FS.isDir(node.mode)){return ERRNO_CODES.EISDIR}}return 0}),mayOpen:(function(node,flags){if(!node){return ERRNO_CODES.ENOENT}if(FS.isLink(node.mode)){return ERRNO_CODES.ELOOP}else if(FS.isDir(node.mode)){if((flags&2097155)!==0||flags&512){return ERRNO_CODES.EISDIR}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))}),MAX_OPEN_FDS:4096,nextfd:(function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(ERRNO_CODES.EMFILE)}),getStream:(function(fd){return FS.streams[fd]}),createStream:(function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=(function(){});FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:(function(){return this.node}),set:(function(val){this.node=val})},isRead:{get:(function(){return(this.flags&2097155)!==1})},isWrite:{get:(function(){return(this.flags&2097155)!==0})},isAppend:{get:(function(){return this.flags&1024})}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream}),closeStream:(function(fd){FS.streams[fd]=null}),getStreamFromPtr:(function(ptr){return FS.streams[ptr-1]}),getPtrForStream:(function(stream){return stream?stream.fd+1:0}),chrdev_stream_ops:{open:(function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}}),llseek:(function(){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)})},major:(function(dev){return dev>>8}),minor:(function(dev){return dev&255}),makedev:(function(ma,mi){return ma<<8|mi}),registerDevice:(function(dev,ops){FS.devices[dev]={stream_ops:ops}}),getDevice:(function(dev){return FS.devices[dev]}),getMounts:(function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts}),syncfs:(function(populate,callback){if(typeof populate==="function"){callback=populate;populate=false}var mounts=FS.getMounts(FS.root.mount);var completed=0;function done(err){if(err){if(!done.errored){done.errored=true;return callback(err)}return}if(++completed>=mounts.length){callback(null)}}mounts.forEach((function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)}))}),mount:(function(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot}),unmount:(function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach((function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}}));node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)}),lookup:(function(parent,name){return parent.node_ops.lookup(parent,name)}),mknod:(function(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}return parent.node_ops.mknod(parent,name,mode,dev)}),create:(function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)}),mkdir:(function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)}),mkdev:(function(path,mode,dev){if(typeof dev==="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)}),symlink:(function(oldpath,newpath){var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;var newname=PATH.basename(newpath);var err=FS.mayCreate(parent,newname);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}return parent.node_ops.symlink(parent,newname,oldpath)}),rename:(function(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;try{lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(ERRNO_CODES.EXDEV)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}relative=PATH.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var err=FS.mayDelete(old_dir,old_name,isdir);if(err){throw new FS.ErrnoError(err)}err=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(err){throw new FS.ErrnoError(err)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}if(new_dir!==old_dir){err=FS.nodePermissions(old_dir,"w");if(err){throw new FS.ErrnoError(err)}}try{if(FS.trackingDelegate["willMovePath"]){FS.trackingDelegate["willMovePath"](old_path,new_path)}}catch(e){console.log("FS.trackingDelegate['willMovePath']('"+old_path+"', '"+new_path+"') threw an exception: "+e.message)}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}try{if(FS.trackingDelegate["onMovePath"])FS.trackingDelegate["onMovePath"](old_path,new_path)}catch(e){console.log("FS.trackingDelegate['onMovePath']('"+old_path+"', '"+new_path+"') threw an exception: "+e.message)}}),rmdir:(function(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var err=FS.mayDelete(parent,name,true);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}try{if(FS.trackingDelegate["willDeletePath"]){FS.trackingDelegate["willDeletePath"](path)}}catch(e){console.log("FS.trackingDelegate['willDeletePath']('"+path+"') threw an exception: "+e.message)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node);try{if(FS.trackingDelegate["onDeletePath"])FS.trackingDelegate["onDeletePath"](path)}catch(e){console.log("FS.trackingDelegate['onDeletePath']('"+path+"') threw an exception: "+e.message)}}),readdir:(function(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}return node.node_ops.readdir(node)}),unlink:(function(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var err=FS.mayDelete(parent,name,false);if(err){if(err===ERRNO_CODES.EISDIR)err=ERRNO_CODES.EPERM;throw new FS.ErrnoError(err)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}try{if(FS.trackingDelegate["willDeletePath"]){FS.trackingDelegate["willDeletePath"](path)}}catch(e){console.log("FS.trackingDelegate['willDeletePath']('"+path+"') threw an exception: "+e.message)}parent.node_ops.unlink(parent,name);FS.destroyNode(node);try{if(FS.trackingDelegate["onDeletePath"])FS.trackingDelegate["onDeletePath"](path)}catch(e){console.log("FS.trackingDelegate['onDeletePath']('"+path+"') threw an exception: "+e.message)}}),readlink:(function(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link.node_ops.readlink){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return link.node_ops.readlink(link)}),stat:(function(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node.node_ops.getattr){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}return node.node_ops.getattr(node)}),lstat:(function(path){return FS.stat(path,true)}),chmod:(function(path,mode,dontFollow){var node;if(typeof path==="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})}),lchmod:(function(path,mode){FS.chmod(path,mode,true)}),fchmod:(function(fd,mode){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(ERRNO_CODES.EBADF)}FS.chmod(stream.node,mode)}),chown:(function(path,uid,gid,dontFollow){var node;if(typeof path==="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}node.node_ops.setattr(node,{timestamp:Date.now()})}),lchown:(function(path,uid,gid){FS.chown(path,uid,gid,true)}),fchown:(function(fd,uid,gid){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(ERRNO_CODES.EBADF)}FS.chown(stream.node,uid,gid)}),truncate:(function(path,len){if(len<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var node;if(typeof path==="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(ERRNO_CODES.EISDIR)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var err=FS.nodePermissions(node,"w");if(err){throw new FS.ErrnoError(err)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})}),ftruncate:(function(fd,len){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(ERRNO_CODES.EBADF)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}FS.truncate(stream.node,len)}),utime:(function(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})}),open:(function(path,flags,mode,fd_start,fd_end){flags=typeof flags==="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode==="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path==="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(ERRNO_CODES.EEXIST)}}else{node=FS.mknod(path,mode,0)}}if(!node){throw new FS.ErrnoError(ERRNO_CODES.ENOENT)}if(FS.isChrdev(node.mode)){flags&=~512}var err=FS.mayOpen(node,flags);if(err){throw new FS.ErrnoError(err)}if(flags&512){FS.truncate(node,0)}flags&=~(128|512);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false},fd_start,fd_end);if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1;Module["printErr"]("read file: "+path)}}try{if(FS.trackingDelegate["onOpenFile"]){var trackingFlags=0;if((flags&2097155)!==1){trackingFlags|=FS.tracking.openFlags.READ}if((flags&2097155)!==0){trackingFlags|=FS.tracking.openFlags.WRITE}FS.trackingDelegate["onOpenFile"](path,trackingFlags)}}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+path+"', flags) threw an exception: "+e.message)}return stream}),close:(function(stream){try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}}),llseek:(function(stream,offset,whence){if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)}return stream.stream_ops.llseek(stream,offset,whence)}),read:(function(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(ERRNO_CODES.EBADF)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(ERRNO_CODES.EISDIR)}if(!stream.stream_ops.read){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var seeking=true;if(typeof position==="undefined"){position=stream.position;seeking=false}else if(!stream.seekable){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead}),write:(function(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(ERRNO_CODES.EBADF)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(ERRNO_CODES.EISDIR)}if(!stream.stream_ops.write){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var seeking=true;if(typeof position==="undefined"){position=stream.position;seeking=false}else if(!stream.seekable){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)}if(stream.flags&1024){FS.llseek(stream,0,2)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;try{if(stream.path&&FS.trackingDelegate["onWriteToFile"])FS.trackingDelegate["onWriteToFile"](stream.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return bytesWritten}),allocate:(function(stream,offset,length){if(offset<0||length<=0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(ERRNO_CODES.EBADF)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(node.mode)){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)}stream.stream_ops.allocate(stream,offset,length)}),mmap:(function(stream,buffer,offset,length,position,prot,flags){if((stream.flags&2097155)===1){throw new FS.ErrnoError(ERRNO_CODES.EACCES)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)}return stream.stream_ops.mmap(stream,buffer,offset,length,position,prot,flags)}),ioctl:(function(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(ERRNO_CODES.ENOTTY)}return stream.stream_ops.ioctl(stream,cmd,arg)}),readFile:(function(path,opts){opts=opts||{};opts.flags=opts.flags||"r";opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret="";var utf8=new Runtime.UTF8Processor;for(var i=0;i<length;i++){ret+=utf8.processCChar(buf[i])}}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret}),writeFile:(function(path,data,opts){opts=opts||{};opts.flags=opts.flags||"w";opts.encoding=opts.encoding||"utf8";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var stream=FS.open(path,opts.flags,opts.mode);if(opts.encoding==="utf8"){var utf8=new Runtime.UTF8Processor;var buf=new Uint8Array(utf8.processJSString(data));FS.write(stream,buf,0,buf.length,0,opts.canOwn)}else if(opts.encoding==="binary"){FS.write(stream,data,0,data.length,0,opts.canOwn)}FS.close(stream)}),cwd:(function(){return FS.currentPath}),chdir:(function(path){var lookup=FS.lookupPath(path,{follow:true});if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}var err=FS.nodePermissions(lookup.node,"x");if(err){throw new FS.ErrnoError(err)}FS.currentPath=lookup.path}),createDefaultDirectories:(function(){FS.mkdir("/tmp")}),createDefaultDevices:(function(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:(function(){return 0}),write:(function(){return 0})});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")}),createStandardStreams:(function(){if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin","r");HEAP32[_stdin>>2]=FS.getPtrForStream(stdin);assert(stdin.fd===0,"invalid handle for stdin ("+stdin.fd+")");var stdout=FS.open("/dev/stdout","w");HEAP32[_stdout>>2]=FS.getPtrForStream(stdout);assert(stdout.fd===1,"invalid handle for stdout ("+stdout.fd+")");var stderr=FS.open("/dev/stderr","w");HEAP32[_stderr>>2]=FS.getPtrForStream(stderr);assert(stderr.fd===2,"invalid handle for stderr ("+stderr.fd+")")}),ensureErrnoError:(function(){if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno){this.errno=errno;for(var key in ERRNO_CODES){if(ERRNO_CODES[key]===errno){this.code=key;break}}this.message=ERRNO_MESSAGES[errno]};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[ERRNO_CODES.ENOENT].forEach((function(code){FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack="<generic error, no stack>"}))}),staticInit:(function(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices()}),init:(function(input,output,error){assert(!FS.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()}),quit:(function(){FS.init.initialized=false;for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue}FS.close(stream)}}),getMode:(function(canRead,canWrite){var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode}),joinPath:(function(parts,forceRelative){var path=PATH.join.apply(null,parts);if(forceRelative&&path[0]=="/")path=path.substr(1);return path}),absolutePath:(function(relative,base){return PATH.resolve(base,relative)}),standardizePath:(function(path){return PATH.normalize(path)}),findObject:(function(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(ret.exists){return ret.object}else{___setErrNo(ret.error);return null}}),analyzePath:(function(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret}),createFolder:(function(parent,name,canRead,canWrite){var path=PATH.join2(typeof parent==="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.mkdir(path,mode)}),createPath:(function(parent,path,canRead,canWrite){parent=typeof parent==="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current}),createFile:(function(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent==="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)}),createDataFile:(function(parent,name,data,canRead,canWrite,canOwn){var path=name?PATH.join2(typeof parent==="string"?parent:FS.getPath(parent),name):parent;var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data==="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(node,mode|146);var stream=FS.open(node,"w");FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}return node}),createDevice:(function(parent,name,input,output){var path=PATH.join2(typeof parent==="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:(function(stream){stream.seekable=false}),close:(function(stream){if(output&&output.buffer&&output.buffer.length){output(10)}}),read:(function(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EIO)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(ERRNO_CODES.EAGAIN)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead}),write:(function(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EIO)}}if(length){stream.node.timestamp=Date.now()}return i})});return FS.mkdev(path,mode,dev)}),createLink:(function(parent,name,target,canRead,canWrite){var path=PATH.join2(typeof parent==="string"?parent:FS.getPath(parent),name);return FS.symlink(target,path)}),forceLoadFile:(function(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;var success=true;if(typeof XMLHttpRequest!=="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(Module["read"]){try{obj.contents=intArrayFromString(Module["read"](obj.url),true)}catch(e){success=false}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}if(!success)___setErrNo(ERRNO_CODES.EIO);return success}),createLazyFile:(function(parent,name,url,canRead,canWrite){function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=Math.floor(idx/this.chunkSize);return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(function(from,to){if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);if(typeof Uint8Array!="undefined")xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||"",true)}});var lazyArray=this;lazyArray.setDataGetter((function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]==="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]==="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]}));this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!=="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperty(lazyArray,"length",{get:(function(){if(!this.lengthKnown){this.cacheLength()}return this._length})});Object.defineProperty(lazyArray,"chunkSize",{get:(function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize})});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach((function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(ERRNO_CODES.EIO)}return fn.apply(null,arguments)}}));stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(ERRNO_CODES.EIO)}var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size};node.stream_ops=stream_ops;return node}),createPreloadedFile:(function(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn){Browser.init();var fullname=name?PATH.resolve(PATH.join2(parent,name)):parent;function processData(byteArray){function finish(byteArray){if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency("cp "+fullname)}var handled=false;Module["preloadPlugins"].forEach((function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,(function(){if(onerror)onerror();removeRunDependency("cp "+fullname)}));handled=true}}));if(!handled)finish(byteArray)}addRunDependency("cp "+fullname);if(typeof url=="string"){Browser.asyncLoad(url,(function(byteArray){processData(byteArray)}),onerror)}else{processData(url)}}),indexedDB:(function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB}),DB_NAME:(function(){return"EM_FS_"+window.location.pathname}),DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(function(paths,onload,onerror){onload=onload||(function(){});onerror=onerror||(function(){});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=function openRequest_onupgradeneeded(){console.log("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=function openRequest_onsuccess(){var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach((function(path){var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=function putRequest_onsuccess(){ok++;if(ok+fail==total)finish()};putRequest.onerror=function putRequest_onerror(){fail++;if(ok+fail==total)finish()}}));transaction.onerror=onerror};openRequest.onerror=onerror}),loadFilesFromDB:(function(paths,onload,onerror){onload=onload||(function(){});onerror=onerror||(function(){});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=function openRequest_onsuccess(){var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach((function(path){var getRequest=files.get(path);getRequest.onsuccess=function getRequest_onsuccess(){if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=function getRequest_onerror(){fail++;if(ok+fail==total)finish()}}));transaction.onerror=onerror};openRequest.onerror=onerror})};function _fflush(stream){}Module["_strlen"]=_strlen;function __reallyNegative(x){return x<0||x===0&&1/x===-Infinity}function __formatString(format,varargs){var textIndex=format;var argIndex=0;function getNextArg(type){var ret;if(type==="double"){ret=(HEAP32[tempDoublePtr>>2]=HEAP32[varargs+argIndex>>2],HEAP32[tempDoublePtr+4>>2]=HEAP32[varargs+(argIndex+4)>>2],+HEAPF64[tempDoublePtr>>3])}else if(type=="i64"){ret=[HEAP32[varargs+argIndex>>2],HEAP32[varargs+(argIndex+4)>>2]]}else{type="i32";ret=HEAP32[varargs+argIndex>>2]}argIndex+=Runtime.getNativeFieldSize(type);return ret}var ret=[];var curr,next,currArg;while(1){var startTextIndex=textIndex;curr=HEAP8[textIndex>>0];if(curr===0)break;next=HEAP8[textIndex+1>>0];if(curr==37){var flagAlwaysSigned=false;var flagLeftAlign=false;var flagAlternative=false;var flagZeroPad=false;var flagPadSign=false;flagsLoop:while(1){switch(next){case 43:flagAlwaysSigned=true;break;case 45:flagLeftAlign=true;break;case 35:flagAlternative=true;break;case 48:if(flagZeroPad){break flagsLoop}else{flagZeroPad=true;break};case 32:flagPadSign=true;break;default:break flagsLoop}textIndex++;next=HEAP8[textIndex+1>>0]}var width=0;if(next==42){width=getNextArg("i32");textIndex++;next=HEAP8[textIndex+1>>0]}else{while(next>=48&&next<=57){width=width*10+(next-48);textIndex++;next=HEAP8[textIndex+1>>0]}}var precisionSet=false,precision=-1;if(next==46){precision=0;precisionSet=true;textIndex++;next=HEAP8[textIndex+1>>0];if(next==42){precision=getNextArg("i32");textIndex++}else{while(1){var precisionChr=HEAP8[textIndex+1>>0];if(precisionChr<48||precisionChr>57)break;precision=precision*10+(precisionChr-48);textIndex++}}next=HEAP8[textIndex+1>>0]}if(precision<0){precision=6;precisionSet=false}var argSize;switch(String.fromCharCode(next)){case"h":var nextNext=HEAP8[textIndex+2>>0];if(nextNext==104){textIndex++;argSize=1}else{argSize=2}break;case"l":var nextNext=HEAP8[textIndex+2>>0];if(nextNext==108){textIndex++;argSize=8}else{argSize=4}break;case"L":case"q":case"j":argSize=8;break;case"z":case"t":case"I":argSize=4;break;default:argSize=null}if(argSize)textIndex++;next=HEAP8[textIndex+1>>0];switch(String.fromCharCode(next)){case"d":case"i":case"u":case"o":case"x":case"X":case"p":{var signed=next==100||next==105;argSize=argSize||4;var currArg=getNextArg("i"+argSize*8);var origArg=currArg;var argText;if(argSize==8){currArg=Runtime.makeBigInt(currArg[0],currArg[1],next==117)}if(argSize<=4){var limit=Math.pow(256,argSize)-1;currArg=(signed?reSign:unSign)(currArg&limit,argSize*8)}var currAbsArg=Math.abs(currArg);var prefix="";if(next==100||next==105){if(argSize==8&&i64Math)argText=i64Math.stringify(origArg[0],origArg[1],null);else argText=reSign(currArg,8*argSize,1).toString(10)}else if(next==117){if(argSize==8&&i64Math)argText=i64Math.stringify(origArg[0],origArg[1],true);else argText=unSign(currArg,8*argSize,1).toString(10);currArg=Math.abs(currArg)}else if(next==111){argText=(flagAlternative?"0":"")+currAbsArg.toString(8)}else if(next==120||next==88){prefix=flagAlternative&&currArg!=0?"0x":"";if(argSize==8&&i64Math){if(origArg[1]){argText=(origArg[1]>>>0).toString(16);var lower=(origArg[0]>>>0).toString(16);while(lower.length<8)lower="0"+lower;argText+=lower}else{argText=(origArg[0]>>>0).toString(16)}}else if(currArg<0){currArg=-currArg;argText=(currAbsArg-1).toString(16);var buffer=[];for(var i=0;i<argText.length;i++){buffer.push((15-parseInt(argText[i],16)).toString(16))}argText=buffer.join("");while(argText.length<argSize*2)argText="f"+argText}else{argText=currAbsArg.toString(16)}if(next==88){prefix=prefix.toUpperCase();argText=argText.toUpperCase()}}else if(next==112){if(currAbsArg===0){argText="(nil)"}else{prefix="0x";argText=currAbsArg.toString(16)}}if(precisionSet){while(argText.length<precision){argText="0"+argText}}if(currArg>=0){if(flagAlwaysSigned){prefix="+"+prefix}else if(flagPadSign){prefix=" "+prefix}}if(argText.charAt(0)=="-"){prefix="-"+prefix;argText=argText.substr(1)}while(prefix.length+argText.length<width){if(flagLeftAlign){argText+=" "}else{if(flagZeroPad){argText="0"+argText}else{prefix=" "+prefix}}}argText=prefix+argText;argText.split("").forEach((function(chr){ret.push(chr.charCodeAt(0))}));break};case"f":case"F":case"e":case"E":case"g":case"G":{var currArg=getNextArg("double");var argText;if(isNaN(currArg)){argText="nan";flagZeroPad=false}else if(!isFinite(currArg)){argText=(currArg<0?"-":"")+"inf";flagZeroPad=false}else{var isGeneral=false;var effectivePrecision=Math.min(precision,20);if(next==103||next==71){isGeneral=true;precision=precision||1;var exponent=parseInt(currArg.toExponential(effectivePrecision).split("e")[1],10);if(precision>exponent&&exponent>=-4){next=(next==103?"f":"F").charCodeAt(0);precision-=exponent+1}else{next=(next==103?"e":"E").charCodeAt(0);precision--}effectivePrecision=Math.min(precision,20)}if(next==101||next==69){argText=currArg.toExponential(effectivePrecision);if(/[eE][-+]\d$/.test(argText)){argText=argText.slice(0,-1)+"0"+argText.slice(-1)}}else if(next==102||next==70){argText=currArg.toFixed(effectivePrecision);if(currArg===0&&__reallyNegative(currArg)){argText="-"+argText}}var parts=argText.split("e");if(isGeneral&&!flagAlternative){while(parts[0].length>1&&parts[0].indexOf(".")!=-1&&(parts[0].slice(-1)=="0"||parts[0].slice(-1)==".")){parts[0]=parts[0].slice(0,-1)}}else{if(flagAlternative&&argText.indexOf(".")==-1)parts[0]+=".";while(precision>effectivePrecision++)parts[0]+="0"}argText=parts[0]+(parts.length>1?"e"+parts[1]:"");if(next==69)argText=argText.toUpperCase();if(currArg>=0){if(flagAlwaysSigned){argText="+"+argText}else if(flagPadSign){argText=" "+argText}}}while(argText.length<width){if(flagLeftAlign){argText+=" "}else{if(flagZeroPad&&(argText[0]=="-"||argText[0]=="+")){argText=argText[0]+"0"+argText.slice(1)}else{argText=(flagZeroPad?"0":" ")+argText}}}if(next<97)argText=argText.toUpperCase();argText.split("").forEach((function(chr){ret.push(chr.charCodeAt(0))}));break};case"s":{var arg=getNextArg("i8*");var argLength=arg?_strlen(arg):"(null)".length;if(precisionSet)argLength=Math.min(argLength,precision);if(!flagLeftAlign){while(argLength<width--){ret.push(32)}}if(arg){for(var i=0;i<argLength;i++){ret.push(HEAPU8[arg++>>0])}}else{ret=ret.concat(intArrayFromString("(null)".substr(0,argLength),true))}if(flagLeftAlign){while(argLength<width--){ret.push(32)}}break};case"c":{if(flagLeftAlign)ret.push(getNextArg("i8"));while(--width>0){ret.push(32)}if(!flagLeftAlign)ret.push(getNextArg("i8"));break};case"n":{var ptr=getNextArg("i32*");HEAP32[ptr>>2]=ret.length;break};case"%":{ret.push(curr);break};default:{for(var i=startTextIndex;i<textIndex+2;i++){ret.push(HEAP8[i>>0])}}}textIndex+=2}else{ret.push(curr);textIndex+=1}}return ret}function _malloc(bytes){var ptr=Runtime.dynamicAlloc(bytes+8);return ptr+8&4294967288}Module["_malloc"]=_malloc;function _snprintf(s,n,format,varargs){var result=__formatString(format,varargs);var limit=n===undefined?result.length:Math.min(result.length,Math.max(n-1,0));if(s<0){s=-s;var buf=_malloc(limit+1);HEAP32[s>>2]=buf;s=buf}for(var i=0;i<limit;i++){HEAP8[s+i>>0]=result[i]}if(limit<n||n===undefined)HEAP8[s+i>>0]=0;return result.length}function _mkport(){throw"TODO"}var SOCKFS={mount:(function(mount){return FS.createNode(null,"/",16384|511,0)}),createSocket:(function(family,type,protocol){var streaming=type==1;if(protocol){assert(streaming==(protocol==6))}var sock={family:family,type:type,protocol:protocol,server:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:FS.modeStringToFlags("r+"),seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock}),getSocket:(function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock}),stream_ops:{poll:(function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)}),ioctl:(function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)}),read:(function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length}),write:(function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)}),close:(function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)})},nextname:(function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current++ +"]"}),websocket_sock_ops:{createPeer:(function(sock,addr,port){var ws;if(typeof addr==="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){url=url+addr+":"+port}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);var opts=ENVIRONMENT_IS_NODE?{"protocol":subProtocols.toString()}:subProtocols;var WebSocket=ENVIRONMENT_IS_NODE?require("ws"):window["WebSocket"];ws=new WebSocket(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EHOSTUNREACH)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!=="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer}),getPeer:(function(sock,addr,port){return sock.peers[addr+":"+port]}),addPeer:(function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer}),removePeer:(function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]}),handlePeerEvents:(function(sock,peer){var first=true;var handleOpen=(function(){try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}});function handleMessage(data){assert(typeof data!=="string"&&data.byteLength!==undefined);data=new Uint8Array(data);var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data})}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",(function(data,flags){if(!flags.binary){return}handleMessage((new Uint8Array(data)).buffer)}));peer.socket.on("error",(function(){}))}else{peer.socket.onopen=handleOpen;peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)}}}),poll:(function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask}),ioctl:(function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return ERRNO_CODES.EINVAL}}),close:(function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i<peers.length;i++){var peer=sock.peers[peers[i]];try{peer.socket.close()}catch(e){}SOCKFS.websocket_sock_ops.removePeer(sock,peer)}return 0}),bind:(function(sock,addr,port){if(typeof sock.saddr!=="undefined"||typeof sock.sport!=="undefined"){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}sock.saddr=addr;sock.sport=port||_mkport();if(sock.type===2){if(sock.server){sock.server.close();sock.server=null}try{sock.sock_ops.listen(sock,0)}catch(e){if(!(e instanceof FS.ErrnoError))throw e;if(e.errno!==ERRNO_CODES.EOPNOTSUPP)throw e}}}),connect:(function(sock,addr,port){if(sock.server){throw new FS.ErrnoError(ERRNO_CODS.EOPNOTSUPP)}if(typeof sock.daddr!=="undefined"&&typeof sock.dport!=="undefined"){var dest=SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport);if(dest){if(dest.socket.readyState===dest.socket.CONNECTING){throw new FS.ErrnoError(ERRNO_CODES.EALREADY)}else{throw new FS.ErrnoError(ERRNO_CODES.EISCONN)}}}var peer=SOCKFS.websocket_sock_ops.createPeer(sock,addr,port);sock.daddr=peer.addr;sock.dport=peer.port;throw new FS.ErrnoError(ERRNO_CODES.EINPROGRESS)}),listen:(function(sock,backlog){if(!ENVIRONMENT_IS_NODE){throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)}if(sock.server){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var WebSocketServer=require("ws").Server;var host=sock.saddr;sock.server=new WebSocketServer({host:host,port:sock.sport});sock.server.on("connection",(function(ws){if(sock.type===1){var newsock=SOCKFS.createSocket(sock.family,sock.type,sock.protocol);var peer=SOCKFS.websocket_sock_ops.createPeer(newsock,ws);newsock.daddr=peer.addr;newsock.dport=peer.port;sock.pending.push(newsock)}else{SOCKFS.websocket_sock_ops.createPeer(sock,ws)}}));sock.server.on("closed",(function(){sock.server=null}));sock.server.on("error",(function(){}))}),accept:(function(listensock){if(!listensock.server){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var newsock=listensock.pending.shift();newsock.stream.flags=listensock.stream.flags;return newsock}),getname:(function(sock,peer){var addr,port;if(peer){if(sock.daddr===undefined||sock.dport===undefined){throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN)}addr=sock.daddr;port=sock.dport}else{addr=sock.saddr||0;port=sock.sport||0}return{addr:addr,port:port}}),sendmsg:(function(sock,buffer,offset,length,addr,port){if(sock.type===2){if(addr===undefined||port===undefined){addr=sock.daddr;port=sock.dport}if(addr===undefined||port===undefined){throw new FS.ErrnoError(ERRNO_CODES.EDESTADDRREQ)}}else{addr=sock.daddr;port=sock.dport}var dest=SOCKFS.websocket_sock_ops.getPeer(sock,addr,port);if(sock.type===1){if(!dest||dest.socket.readyState===dest.socket.CLOSING||dest.socket.readyState===dest.socket.CLOSED){throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN)}else if(dest.socket.readyState===dest.socket.CONNECTING){throw new FS.ErrnoError(ERRNO_CODES.EAGAIN)}}var data;if(buffer instanceof Array||buffer instanceof ArrayBuffer){data=buffer.slice(offset,offset+length)}else{data=buffer.buffer.slice(buffer.byteOffset+offset,buffer.byteOffset+offset+length)}if(sock.type===2){if(!dest||dest.socket.readyState!==dest.socket.OPEN){if(!dest||dest.socket.readyState===dest.socket.CLOSING||dest.socket.readyState===dest.socket.CLOSED){dest=SOCKFS.websocket_sock_ops.createPeer(sock,addr,port)}dest.dgram_send_queue.push(data);return length}}try{dest.socket.send(data);return length}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}}),recvmsg:(function(sock,length){if(sock.type===1&&sock.server){throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN)}var queued=sock.recv_queue.shift();if(!queued){if(sock.type===1){var dest=SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport);if(!dest){throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN)}else if(dest.socket.readyState===dest.socket.CLOSING||dest.socket.readyState===dest.socket.CLOSED){return null}else{throw new FS.ErrnoError(ERRNO_CODES.EAGAIN)}}else{throw new FS.ErrnoError(ERRNO_CODES.EAGAIN)}}var queuedLength=queued.data.byteLength||queued.data.length;var queuedOffset=queued.data.byteOffset||0;var queuedBuffer=queued.data.buffer||queued.data;var bytesRead=Math.min(length,queuedLength);var res={buffer:new Uint8Array(queuedBuffer,queuedOffset,bytesRead),addr:queued.addr,port:queued.port};if(sock.type===1&&bytesRead<queuedLength){var bytesRemaining=queuedLength-bytesRead;queued.data=new Uint8Array(queuedBuffer,queuedOffset+bytesRead,bytesRemaining);sock.recv_queue.unshift(queued)}return res})}};function _send(fd,buf,len,flags){var sock=SOCKFS.getSocket(fd);if(!sock){___setErrNo(ERRNO_CODES.EBADF);return-1}return _write(fd,buf,len)}function _pwrite(fildes,buf,nbyte,offset){var stream=FS.getStream(fildes);if(!stream){___setErrNo(ERRNO_CODES.EBADF);return-1}try{var slab=HEAP8;return FS.write(stream,slab,buf,nbyte,offset)}catch(e){FS.handleFSError(e);return-1}}function _write(fildes,buf,nbyte){var stream=FS.getStream(fildes);if(!stream){___setErrNo(ERRNO_CODES.EBADF);return-1}try{var slab=HEAP8;return FS.write(stream,slab,buf,nbyte)}catch(e){FS.handleFSError(e);return-1}}function _fileno(stream){stream=FS.getStreamFromPtr(stream);if(!stream)return-1;return stream.fd}function _fwrite(ptr,size,nitems,stream){var bytesToWrite=nitems*size;if(bytesToWrite==0)return 0;var fd=_fileno(stream);var bytesWritten=_write(fd,ptr,bytesToWrite);if(bytesWritten==-1){var streamObj=FS.getStreamFromPtr(stream);if(streamObj)streamObj.error=true;return 0}else{return Math.floor(bytesWritten/size)}}function _recv(fd,buf,len,flags){var sock=SOCKFS.getSocket(fd);if(!sock){___setErrNo(ERRNO_CODES.EBADF);return-1}return _read(fd,buf,len)}function _pread(fildes,buf,nbyte,offset){var stream=FS.getStream(fildes);if(!stream){___setErrNo(ERRNO_CODES.EBADF);return-1}try{var slab=HEAP8;return FS.read(stream,slab,buf,nbyte,offset)}catch(e){FS.handleFSError(e);return-1}}function _read(fildes,buf,nbyte){var stream=FS.getStream(fildes);if(!stream){___setErrNo(ERRNO_CODES.EBADF);return-1}try{var slab=HEAP8;return FS.read(stream,slab,buf,nbyte)}catch(e){FS.handleFSError(e);return-1}}function _fread(ptr,size,nitems,stream){var bytesToRead=nitems*size;if(bytesToRead==0){return 0}var bytesRead=0;var streamObj=FS.getStreamFromPtr(stream);if(!streamObj){___setErrNo(ERRNO_CODES.EBADF);return 0}while(streamObj.ungotten.length&&bytesToRead>0){HEAP8[ptr++>>0]=streamObj.ungotten.pop();bytesToRead--;bytesRead++}var err=_read(streamObj.fd,ptr,bytesToRead);if(err==-1){if(streamObj)streamObj.error=true;return 0}bytesRead+=err;if(bytesRead<bytesToRead)streamObj.eof=true;return Math.floor(bytesRead/size)}function _fgetc(stream){var streamObj=FS.getStreamFromPtr(stream);if(!streamObj)return-1;if(streamObj.eof||streamObj.error)return-1;var ret=_fread(_fgetc.ret,1,1,stream);if(ret==0){return-1}else if(ret==-1){streamObj.error=true;return-1}else{return HEAPU8[_fgetc.ret>>0]}}function __embind_register_emval(){Module["printErr"]("missing function: _embind_register_emval");abort(-1)}function ___gxx_personality_v0(){}function _sysconf(name){switch(name){case 30:return PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 79:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return 1}___setErrNo(ERRNO_CODES.EINVAL);return-1}Module["_bitshift64Lshr"]=_bitshift64Lshr;function _pthread_cond_broadcast(){return 0}function __exit(status){Module["exit"](status)}function _exit(status){__exit(status)}function __ZSt9terminatev(){_exit(-1234)}function _pthread_mutex_unlock(){}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;function _sbrk(bytes){var self=_sbrk;if(!self.called){DYNAMICTOP=alignMemoryPage(DYNAMICTOP);self.called=true;assert(Runtime.dynamicAlloc);self.alloc=Runtime.dynamicAlloc;Runtime.dynamicAlloc=(function(){abort("cannot dynamically allocate, sbrk now has control")})}var ret=DYNAMICTOP;if(bytes!=0)self.alloc(bytes);return ret}function _newlocale(mask,locale,base){return _malloc(4)}Module["_memmove"]=_memmove;function ___errno_location(){return ___errno_state}function _strerror_r(errnum,strerrbuf,buflen){if(errnum in ERRNO_MESSAGES){if(ERRNO_MESSAGES[errnum].length>buflen-1){return ___setErrNo(ERRNO_CODES.ERANGE)}else{var msg=ERRNO_MESSAGES[errnum];writeAsciiToMemory(msg,strerrbuf);return 0}}else{return ___setErrNo(ERRNO_CODES.EINVAL)}}function _strerror(errnum){if(!_strerror.buffer)_strerror.buffer=_malloc(256);_strerror_r(errnum,_strerror.buffer,256);return _strerror.buffer}function _pthread_mutex_destroy(){}function _catclose(catd){return 0}function __embind_register_memory_view(){Module["printErr"]("missing function: _embind_register_memory_view");abort(-1)}function ___cxa_guard_release(){}function _ungetc(c,stream){stream=FS.getStreamFromPtr(stream);if(!stream){return-1}if(c===-1){return c}c=unSign(c&255);stream.ungotten.push(c);stream.eof=false;return c}function _uselocale(locale){return 0}function _vsnprintf(s,n,format,va_arg){return _snprintf(s,n,format,HEAP32[va_arg>>2])}function __getFloat(text){return/^[+-]?[0-9]*\.?[0-9]+([eE][+-]?[0-9]+)?/.exec(text)}function __scanString(format,get,unget,varargs){if(!__scanString.whiteSpace){__scanString.whiteSpace={};__scanString.whiteSpace[32]=1;__scanString.whiteSpace[9]=1;__scanString.whiteSpace[10]=1;__scanString.whiteSpace[11]=1;__scanString.whiteSpace[12]=1;__scanString.whiteSpace[13]=1}format=Pointer_stringify(format);var soFar=0;if(format.indexOf("%n")>=0){var _get=get;get=function get(){soFar++;return _get()};var _unget=unget;unget=function unget(){soFar--;return _unget()}}var formatIndex=0;var argsi=0;var fields=0;var argIndex=0;var next;mainLoop:for(var formatIndex=0;formatIndex<format.length;){if(format[formatIndex]==="%"&&format[formatIndex+1]=="n"){var argPtr=HEAP32[varargs+argIndex>>2];argIndex+=Runtime.getAlignSize("void*",null,true);HEAP32[argPtr>>2]=soFar;formatIndex+=2;continue}if(format[formatIndex]==="%"){var nextC=format.indexOf("c",formatIndex+1);if(nextC>0){var maxx=1;if(nextC>formatIndex+1){var sub=format.substring(formatIndex+1,nextC);maxx=parseInt(sub);if(maxx!=sub)maxx=0}if(maxx){var argPtr=HEAP32[varargs+argIndex>>2];argIndex+=Runtime.getAlignSize("void*",null,true);fields++;for(var i=0;i<maxx;i++){next=get();HEAP8[argPtr++>>0]=next;if(next===0)return i>0?fields:fields-1}formatIndex+=nextC-formatIndex+1;continue}}}if(format[formatIndex]==="%"&&format.indexOf("[",formatIndex+1)>0){var match=/\%([0-9]*)\[(\^)?(\]?[^\]]*)\]/.exec(format.substring(formatIndex));if(match){var maxNumCharacters=parseInt(match[1])||Infinity;var negateScanList=match[2]==="^";var scanList=match[3];var middleDashMatch;while(middleDashMatch=/([^\-])\-([^\-])/.exec(scanList)){var rangeStartCharCode=middleDashMatch[1].charCodeAt(0);var rangeEndCharCode=middleDashMatch[2].charCodeAt(0);for(var expanded="";rangeStartCharCode<=rangeEndCharCode;expanded+=String.fromCharCode(rangeStartCharCode++));scanList=scanList.replace(middleDashMatch[1]+"-"+middleDashMatch[2],expanded)}var argPtr=HEAP32[varargs+argIndex>>2];argIndex+=Runtime.getAlignSize("void*",null,true);fields++;for(var i=0;i<maxNumCharacters;i++){next=get();if(negateScanList){if(scanList.indexOf(String.fromCharCode(next))<0){HEAP8[argPtr++>>0]=next}else{unget();break}}else{if(scanList.indexOf(String.fromCharCode(next))>=0){HEAP8[argPtr++>>0]=next}else{unget();break}}}HEAP8[argPtr++>>0]=0;formatIndex+=match[0].length;continue}}while(1){next=get();if(next==0)return fields;if(!(next in __scanString.whiteSpace))break}unget();if(format[formatIndex]==="%"){formatIndex++;var suppressAssignment=false;if(format[formatIndex]=="*"){suppressAssignment=true;formatIndex++}var maxSpecifierStart=formatIndex;while(format[formatIndex].charCodeAt(0)>=48&&format[formatIndex].charCodeAt(0)<=57){formatIndex++}var max_;if(formatIndex!=maxSpecifierStart){max_=parseInt(format.slice(maxSpecifierStart,formatIndex),10)}var long_=false;var half=false;var quarter=false;var longLong=false;if(format[formatIndex]=="l"){long_=true;formatIndex++;if(format[formatIndex]=="l"){longLong=true;formatIndex++}}else if(format[formatIndex]=="h"){half=true;formatIndex++;if(format[formatIndex]=="h"){quarter=true;formatIndex++}}var type=format[formatIndex];formatIndex++;var curr=0;var buffer=[];if(type=="f"||type=="e"||type=="g"||type=="F"||type=="E"||type=="G"){next=get();while(next>0&&!(next in __scanString.whiteSpace)){buffer.push(String.fromCharCode(next));next=get()}var m=__getFloat(buffer.join(""));var last=m?m[0].length:0;for(var i=0;i<buffer.length-last+1;i++){unget()}buffer.length=last}else{next=get();var first=true;if((type=="x"||type=="X")&&next==48){var peek=get();if(peek==120||peek==88){next=get()}else{unget()}}while((curr<max_||isNaN(max_))&&next>0){if(!(next in __scanString.whiteSpace)&&(type=="s"||(type==="d"||type=="u"||type=="i")&&(next>=48&&next<=57||first&&next==45)||(type==="x"||type==="X")&&(next>=48&&next<=57||next>=97&&next<=102||next>=65&&next<=70))&&(formatIndex>=format.length||next!==format[formatIndex].charCodeAt(0))){buffer.push(String.fromCharCode(next));next=get();curr++;first=false}else{break}}unget()}if(buffer.length===0)return 0;if(suppressAssignment)continue;var text=buffer.join("");var argPtr=HEAP32[varargs+argIndex>>2];argIndex+=Runtime.getAlignSize("void*",null,true);var base=10;switch(type){case"X":case"x":base=16;case"d":case"u":case"i":if(quarter){HEAP8[argPtr>>0]=parseInt(text,base)}else if(half){HEAP16[argPtr>>1]=parseInt(text,base)}else if(longLong){tempI64=[parseInt(text,base)>>>0,(tempDouble=parseInt(text,base),+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[argPtr>>2]=tempI64[0],HEAP32[argPtr+4>>2]=tempI64[1]}else{HEAP32[argPtr>>2]=parseInt(text,base)}break;case"F":case"f":case"E":case"e":case"G":case"g":case"E":if(long_){HEAPF64[argPtr>>3]=parseFloat(text)}else{HEAPF32[argPtr>>2]=parseFloat(text)}break;case"s":var array=intArrayFromString(text);for(var j=0;j<array.length;j++){HEAP8[argPtr+j>>0]=array[j]}break}fields++}else if(format[formatIndex].charCodeAt(0)in __scanString.whiteSpace){next=get();while(next in __scanString.whiteSpace){if(next<=0)break mainLoop;next=get()}unget(next);formatIndex++}else{next=get();if(format[formatIndex].charCodeAt(0)!==next){unget(next);break mainLoop}formatIndex++}}return fields}function _sscanf(s,format,varargs){var index=0;function get(){return HEAP8[s+index++>>0]}function unget(){index--}return __scanString(format,get,unget,varargs)}function _vsscanf(s,format,va_arg){return _sscanf(s,format,HEAP32[va_arg>>2])}function ___assert_fail(condition,filename,line,func){ABORT=true;throw"Assertion failed: "+Pointer_stringify(condition)+", at: "+[filename?Pointer_stringify(filename):"unknown filename",line,func?Pointer_stringify(func):"unknown function"]+" at "+stackTrace()}function __embind_register_void(){Module["printErr"]("missing function: _embind_register_void");abort(-1)}Module["_memset"]=_memset;var _BItoD=true;function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]);return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2]};var pattern=Pointer_stringify(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value==="number"?value.toString():value||"";while(str.length<digits){str=character[0]+str}return str}function leadingNulls(value,digits){return leadingSomething(value,digits,"0")}function compareByDay(date1,date2){function sgn(value){return value<0?-1:value>0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":(function(date){return WEEKDAYS[date.tm_wday].substring(0,3)}),"%A":(function(date){return WEEKDAYS[date.tm_wday]}),"%b":(function(date){return MONTHS[date.tm_mon].substring(0,3)}),"%B":(function(date){return MONTHS[date.tm_mon]}),"%C":(function(date){var year=date.tm_year+1900;return leadingNulls(Math.floor(year/100),2)}),"%d":(function(date){return leadingNulls(date.tm_mday,2)}),"%e":(function(date){return leadingSomething(date.tm_mday,2," ")}),"%g":(function(date){return getWeekBasedYear(date).toString().substring(2)}),"%G":(function(date){return getWeekBasedYear(date)}),"%H":(function(date){return leadingNulls(date.tm_hour,2)}),"%I":(function(date){return leadingNulls(date.tm_hour<13?date.tm_hour:date.tm_hour-12,2)}),"%j":(function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)}),"%m":(function(date){return leadingNulls(date.tm_mon+1,2)}),"%M":(function(date){return leadingNulls(date.tm_min,2)}),"%n":(function(){return"\n"}),"%p":(function(date){if(date.tm_hour>0&&date.tm_hour<13){return"AM"}else{return"PM"}}),"%S":(function(date){return leadingNulls(date.tm_sec,2)}),"%t":(function(){return"\t"}),"%u":(function(date){var day=new Date(date.tm_year+1900,date.tm_mon+1,date.tm_mday,0,0,0,0);return day.getDay()||7}),"%U":(function(date){var janFirst=new Date(date.tm_year+1900,0,1);var firstSunday=janFirst.getDay()===0?janFirst:__addDays(janFirst,7-janFirst.getDay());var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstSunday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstSundayUntilEndJanuary=31-firstSunday.getDate();var days=firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstSunday,janFirst)===0?"01":"00"}),"%V":(function(date){var janFourthThisYear=new Date(date.tm_year+1900,0,4);var janFourthNextYear=new Date(date.tm_year+1901,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);var endDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);if(compareByDay(endDate,firstWeekStartThisYear)<0){return"53"}if(compareByDay(firstWeekStartNextYear,endDate)<=0){return"01"}var daysDifference;if(firstWeekStartThisYear.getFullYear()<date.tm_year+1900){daysDifference=date.tm_yday+32-firstWeekStartThisYear.getDate()}else{daysDifference=date.tm_yday+1-firstWeekStartThisYear.getDate()}return leadingNulls(Math.ceil(daysDifference/7),2)}),"%w":(function(date){var day=new Date(date.tm_year+1900,date.tm_mon+1,date.tm_mday,0,0,0,0);return day.getDay()}),"%W":(function(date){var janFirst=new Date(date.tm_year,0,1);var firstMonday=janFirst.getDay()===1?janFirst:__addDays(janFirst,janFirst.getDay()===0?1:7-janFirst.getDay()+1);var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstMonday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstMondayUntilEndJanuary=31-firstMonday.getDate();var days=firstMondayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstMonday,janFirst)===0?"01":"00"}),"%y":(function(date){return(date.tm_year+1900).toString().substring(2)}),"%Y":(function(date){return date.tm_year+1900}),"%z":(function(date){return""}),"%Z":(function(date){return""}),"%%":(function(){return"%"})};for(var rule in EXPANSION_RULES_2){if(pattern.indexOf(rule)>=0){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm){return _strftime(s,maxsize,format,tm)}function _abort(){Module["abort"]()}function __embind_register_class(){Module["printErr"]("missing function: _embind_register_class");abort(-1)}function _pthread_cond_wait(){return 0}var _fabs=Math_abs;var _getc=_fgetc;function __embind_register_integer(){Module["printErr"]("missing function: _embind_register_integer");abort(-1)}var Browser={mainLoop:{scheduler:null,method:"",shouldPause:false,paused:false,queue:[],pause:(function(){Browser.mainLoop.shouldPause=true}),resume:(function(){if(Browser.mainLoop.paused){Browser.mainLoop.paused=false;Browser.mainLoop.scheduler()}Browser.mainLoop.shouldPause=false}),updateStatus:(function(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining<expected){Module["setStatus"](message+" ("+(expected-remaining)+"/"+expected+")")}else{Module["setStatus"](message)}}else{Module["setStatus"]("")}}})},isFullScreen:false,pointerLock:false,moduleContextCreatedCallbacks:[],workers:[],init:(function(){if(!Module["preloadPlugins"])Module["preloadPlugins"]=[];if(Browser.initted||ENVIRONMENT_IS_WORKER)return;Browser.initted=true;try{new Blob;Browser.hasBlobConstructor=true}catch(e){Browser.hasBlobConstructor=false;console.log("warning: no blob constructor, cannot create blobs with mimetypes")}Browser.BlobBuilder=typeof MozBlobBuilder!="undefined"?MozBlobBuilder:typeof WebKitBlobBuilder!="undefined"?WebKitBlobBuilder:!Browser.hasBlobConstructor?console.log("warning: no BlobBuilder"):null;Browser.URLObject=typeof window!="undefined"?window.URL?window.URL:window.webkitURL:undefined;if(!Module.noImageDecoding&&typeof Browser.URLObject==="undefined"){console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available.");Module.noImageDecoding=true}var imagePlugin={};imagePlugin["canHandle"]=function imagePlugin_canHandle(name){return!Module.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(name)};imagePlugin["handle"]=function imagePlugin_handle(byteArray,name,onload,onerror){var b=null;if(Browser.hasBlobConstructor){try{b=new Blob([byteArray],{type:Browser.getMimetype(name)});if(b.size!==byteArray.length){b=new Blob([(new Uint8Array(byteArray)).buffer],{type:Browser.getMimetype(name)})}}catch(e){Runtime.warnOnce("Blob constructor present but fails: "+e+"; falling back to blob builder")}}if(!b){var bb=new Browser.BlobBuilder;bb.append((new Uint8Array(byteArray)).buffer);b=bb.getBlob()}var url=Browser.URLObject.createObjectURL(b);var img=new Image;img.onload=function img_onload(){assert(img.complete,"Image "+name+" could not be decoded");var canvas=document.createElement("canvas");canvas.width=img.width;canvas.height=img.height;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);Module["preloadedImages"][name]=canvas;Browser.URLObject.revokeObjectURL(url);if(onload)onload(byteArray)};img.onerror=function img_onerror(event){console.log("Image "+url+" could not be decoded");if(onerror)onerror()};img.src=url};Module["preloadPlugins"].push(imagePlugin);var audioPlugin={};audioPlugin["canHandle"]=function audioPlugin_canHandle(name){return!Module.noAudioDecoding&&name.substr(-4)in{".ogg":1,".wav":1,".mp3":1}};audioPlugin["handle"]=function audioPlugin_handle(byteArray,name,onload,onerror){var done=false;function finish(audio){if(done)return;done=true;Module["preloadedAudios"][name]=audio;if(onload)onload(byteArray)}function fail(){if(done)return;done=true;Module["preloadedAudios"][name]=new Audio;if(onerror)onerror()}if(Browser.hasBlobConstructor){try{var b=new Blob([byteArray],{type:Browser.getMimetype(name)})}catch(e){return fail()}var url=Browser.URLObject.createObjectURL(b);var audio=new Audio;audio.addEventListener("canplaythrough",(function(){finish(audio)}),false);audio.onerror=function audio_onerror(event){if(done)return;console.log("warning: browser could not fully decode audio "+name+", trying slower base64 approach");function encode64(data){var BASE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var PAD="=";var ret="";var leftchar=0;var leftbits=0;for(var i=0;i<data.length;i++){leftchar=leftchar<<8|data[i];leftbits+=8;while(leftbits>=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;Browser.safeSetTimeout((function(){finish(audio)}),1e4)}else{return fail()}};Module["preloadPlugins"].push(audioPlugin);var canvas=Module["canvas"];if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||(function(){});canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||(function(){});canvas.exitPointerLock=canvas.exitPointerLock.bind(document);function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===canvas||document["mozPointerLockElement"]===canvas||document["webkitPointerLockElement"]===canvas||document["msPointerLockElement"]===canvas}document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",(function(ev){if(!Browser.pointerLock&&canvas.requestPointerLock){canvas.requestPointerLock();ev.preventDefault()}}),false)}}}),createContext:(function(canvas,useWebGL,setInModule,webGLContextAttributes){var ctx;var errorInfo="?";function onContextCreationError(event){errorInfo=event.statusMessage||errorInfo}try{if(useWebGL){var contextAttributes={antialias:false,alpha:false};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}canvas.addEventListener("webglcontextcreationerror",onContextCreationError,false);try{["experimental-webgl","webgl"].some((function(webglId){return ctx=canvas.getContext(webglId,contextAttributes)}))}finally{canvas.removeEventListener("webglcontextcreationerror",onContextCreationError,false)}}else{ctx=canvas.getContext("2d")}if(!ctx)throw":("}catch(e){Module.print("Could not create canvas: "+[errorInfo,e]);return null}if(useWebGL){canvas.style.backgroundColor="black"}if(setInModule){GLctx=Module.ctx=ctx;Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach((function(callback){callback()}));Browser.init()}return ctx}),destroyContext:(function(canvas,useWebGL,setInModule){}),fullScreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullScreen:(function(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer==="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas==="undefined")Browser.resizeCanvas=false;var canvas=Module["canvas"];function fullScreenChange(){Browser.isFullScreen=false;var canvasContainer=canvas.parentNode;if((document["webkitFullScreenElement"]||document["webkitFullscreenElement"]||document["mozFullScreenElement"]||document["mozFullscreenElement"]||document["fullScreenElement"]||document["fullscreenElement"]||document["msFullScreenElement"]||document["msFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.cancelFullScreen=document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["webkitCancelFullScreen"]||document["msExitFullscreen"]||document["exitFullscreen"]||(function(){});canvas.cancelFullScreen=canvas.cancelFullScreen.bind(document);if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullScreen=true;if(Browser.resizeCanvas)Browser.setFullScreenCanvasSize()}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas)Browser.setWindowedCanvasSize()}if(Module["onFullScreen"])Module["onFullScreen"](Browser.isFullScreen);Browser.updateCanvasDimensions(canvas)}if(!Browser.fullScreenHandlersInstalled){Browser.fullScreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullScreenChange,false);document.addEventListener("mozfullscreenchange",fullScreenChange,false);document.addEventListener("webkitfullscreenchange",fullScreenChange,false);document.addEventListener("MSFullscreenChange",fullScreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullScreen=canvasContainer["requestFullScreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullScreen"]?(function(){canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"])}):null);canvasContainer.requestFullScreen()}),requestAnimationFrame:function requestAnimationFrame(func){if(typeof window==="undefined"){setTimeout(func,1e3/60)}else{if(!window.requestAnimationFrame){window.requestAnimationFrame=window["requestAnimationFrame"]||window["mozRequestAnimationFrame"]||window["webkitRequestAnimationFrame"]||window["msRequestAnimationFrame"]||window["oRequestAnimationFrame"]||window["setTimeout"]}window.requestAnimationFrame(func)}},safeCallback:(function(func){return(function(){if(!ABORT)return func.apply(null,arguments)})}),safeRequestAnimationFrame:(function(func){return Browser.requestAnimationFrame((function(){if(!ABORT)func()}))}),safeSetTimeout:(function(func,timeout){Module["noExitRuntime"]=true;return setTimeout((function(){if(!ABORT)func()}),timeout)}),safeSetInterval:(function(func,timeout){Module["noExitRuntime"]=true;return setInterval((function(){if(!ABORT)func()}),timeout)}),getMimetype:(function(name){return{"jpg":"image/jpeg","jpeg":"image/jpeg","png":"image/png","bmp":"image/bmp","ogg":"audio/ogg","wav":"audio/wav","mp3":"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]}),getUserMedia:(function(func){if(!window.getUserMedia){window.getUserMedia=navigator["getUserMedia"]||navigator["mozGetUserMedia"]}window.getUserMedia(func)}),getMovementX:(function(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0}),getMovementY:(function(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0}),getMouseWheelDelta:(function(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail;break;case"mousewheel":delta=-event.wheelDelta;break;case"wheel":delta=event.deltaY;break;default:throw"unrecognized mouse wheel event: "+event.type}return Math.max(-1,Math.min(1,delta))}),mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:(function(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!=="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!=="undefined"?window.scrollY:window.pageYOffset;if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var adjustedX=touch.pageX-(scrollX+rect.left);var adjustedY=touch.pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);var coords={x:adjustedX,y:adjustedY};if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){Browser.lastTouches[touch.identifier]=Browser.touches[touch.identifier];Browser.touches[touch.identifier]={x:adjustedX,y:adjustedY}}return}var x=event.pageX-(scrollX+rect.left);var y=event.pageY-(scrollY+rect.top);x=x*(cw/rect.width);y=y*(ch/rect.height);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y}}),xhrLoad:(function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)}),asyncLoad:(function(url,onload,onerror,noRunDep){Browser.xhrLoad(url,(function(arrayBuffer){assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(!noRunDep)removeRunDependency("al "+url)}),(function(event){if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}}));if(!noRunDep)addRunDependency("al "+url)}),resizeListeners:[],updateResizeListeners:(function(){var canvas=Module["canvas"];Browser.resizeListeners.forEach((function(listener){listener(canvas.width,canvas.height)}))}),setCanvasSize:(function(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()}),windowedWidth:0,windowedHeight:0,setFullScreenCanvasSize:(function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];flags=flags|8388608;HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=flags}Browser.updateResizeListeners()}),setWindowedCanvasSize:(function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];flags=flags&~8388608;HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=flags}Browser.updateResizeListeners()}),updateCanvasDimensions:(function(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h<Module["forcedAspectRatio"]){w=Math.round(h*Module["forcedAspectRatio"])}else{h=Math.round(w/Module["forcedAspectRatio"])}}if((document["webkitFullScreenElement"]||document["webkitFullscreenElement"]||document["mozFullScreenElement"]||document["mozFullscreenElement"]||document["fullScreenElement"]||document["fullscreenElement"]||document["msFullScreenElement"]||document["msFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvas.parentNode&&typeof screen!="undefined"){var factor=Math.min(screen.width/w,screen.height/h);w=Math.round(w*factor);h=Math.round(h*factor)}if(Browser.resizeCanvas){if(canvas.width!=w)canvas.width=w;if(canvas.height!=h)canvas.height=h;if(typeof canvas.style!="undefined"){canvas.style.removeProperty("width");canvas.style.removeProperty("height")}}else{if(canvas.width!=wNative)canvas.width=wNative;if(canvas.height!=hNative)canvas.height=hNative;if(typeof canvas.style!="undefined"){if(w!=wNative||h!=hNative){canvas.style.setProperty("width",w+"px","important");canvas.style.setProperty("height",h+"px","important")}else{canvas.style.removeProperty("width");canvas.style.removeProperty("height")}}}})};function ___ctype_b_loc(){var me=___ctype_b_loc;if(!me.ret){var values=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,8195,8194,8194,8194,8194,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,24577,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,55304,55304,55304,55304,55304,55304,55304,55304,55304,55304,49156,49156,49156,49156,49156,49156,49156,54536,54536,54536,54536,54536,54536,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,49156,49156,49156,49156,49156,49156,54792,54792,54792,54792,54792,54792,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,49156,49156,49156,49156,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var i16size=2;var arr=_malloc(values.length*i16size);for(var i=0;i<values.length;i++){HEAP16[arr+i*i16size>>1]=values[i]}me.ret=allocate([arr+128*i16size],"i16*",ALLOC_NORMAL)}return me.ret}function _free(){}Module["_free"]=_free;function _freelocale(locale){_free(locale)}function ___cxa_allocate_exception(size){var ptr=_malloc(size+___cxa_exception_header_size);return ptr+___cxa_exception_header_size}function _fmod(x,y){return x%y}var _fmodl=_fmod;function _catopen(name,oflag){return-1}function _catgets(catd,set_id,msg_id,s){return s}function _sprintf(s,format,varargs){return _snprintf(s,undefined,format,varargs)}function _asprintf(s,format,varargs){return _sprintf(-s,format,varargs)}function _vasprintf(s,format,va_arg){return _asprintf(s,format,HEAP32[va_arg>>2])}function __embind_register_float(){Module["printErr"]("missing function: _embind_register_float");abort(-1)}function _time(ptr){var ret=Math.floor(Date.now()/1e3);if(ptr){HEAP32[ptr>>2]=ret}return ret}function _copysign(a,b){return __reallyNegative(a)===__reallyNegative(b)?a:-a}function ___ctype_toupper_loc(){var me=___ctype_toupper_loc;if(!me.ret){var values=[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];var i32size=4;var arr=_malloc(values.length*i32size);for(var i=0;i<values.length;i++){HEAP32[arr+i*i32size>>2]=values[i]}me.ret=allocate([arr+128*i32size],"i32*",ALLOC_NORMAL)}return me.ret}function ___cxa_guard_acquire(variable){if(!HEAP8[variable>>0]){HEAP8[variable>>0]=1;return 1}return 0}function ___ctype_tolower_loc(){var me=___ctype_tolower_loc;if(!me.ret){var values=[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];var i32size=4;var arr=_malloc(values.length*i32size);for(var i=0;i<values.length;i++){HEAP32[arr+i*i32size>>2]=values[i]}me.ret=allocate([arr+128*i32size],"i32*",ALLOC_NORMAL)}return me.ret}var ___cxa_caught_exceptions=[];function ___cxa_begin_catch(ptr){__ZSt18uncaught_exceptionv.uncaught_exception--;___cxa_caught_exceptions.push(___cxa_last_thrown_exception);return ptr}Module["_bitshift64Shl"]=_bitshift64Shl;function __ZNKSt9exception4whatEv(){if(!__ZNKSt9exception4whatEv.buffer){var name="std::exception";__ZNKSt9exception4whatEv.buffer=_malloc(name.length+1);writeStringToMemory(name,__ZNKSt9exception4whatEv.buffer)}return __ZNKSt9exception4whatEv.buffer}function __ZNSt9exceptionD2Ev(){}function __embind_register_class_constructor(){Module["printErr"]("missing function: _embind_register_class_constructor");abort(-1)}var _copysignl=_copysign;function __embind_register_class_function(){Module["printErr"]("missing function: _embind_register_class_function");abort(-1)}var __ZTISt9exception=allocate([allocate([1,0,0,0,0,0,0],"i8",ALLOC_STATIC)+8,0],"i32",ALLOC_STATIC);var ___dso_handle=allocate(1,"i32*",ALLOC_STATIC);FS.staticInit();__ATINIT__.unshift({func:(function(){if(!Module["noFSInit"]&&!FS.init.initialized)FS.init()})});__ATMAIN__.push({func:(function(){FS.ignorePermissions=false})});__ATEXIT__.push({func:(function(){FS.quit()})});Module["FS_createFolder"]=FS.createFolder;Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createLink"]=FS.createLink;Module["FS_createDevice"]=FS.createDevice;___errno_state=Runtime.staticAlloc(4);HEAP32[___errno_state>>2]=0;__ATINIT__.unshift({func:(function(){TTY.init()})});__ATEXIT__.push({func:(function(){TTY.shutdown()})});TTY.utf8=new Runtime.UTF8Processor;if(ENVIRONMENT_IS_NODE){var fs=require("fs");NODEFS.staticInit()}__ATINIT__.push({func:(function(){SOCKFS.root=FS.mount(SOCKFS,{},null)})});_fgetc.ret=allocate([0],"i8",ALLOC_STATIC);Module["requestFullScreen"]=function Module_requestFullScreen(lockPointer,resizeCanvas){Browser.requestFullScreen(lockPointer,resizeCanvas)};Module["requestAnimationFrame"]=function Module_requestAnimationFrame(func){Browser.requestAnimationFrame(func)};Module["setCanvasSize"]=function Module_setCanvasSize(width,height,noUpdates){Browser.setCanvasSize(width,height,noUpdates)};Module["pauseMainLoop"]=function Module_pauseMainLoop(){Browser.mainLoop.pause()};Module["resumeMainLoop"]=function Module_resumeMainLoop(){Browser.mainLoop.resume()};Module["getUserMedia"]=function Module_getUserMedia(){Browser.getUserMedia()};STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP);staticSealed=true;STACK_MAX=STACK_BASE+5242880;DYNAMIC_BASE=DYNAMICTOP=Runtime.alignMemory(STACK_MAX);assert(DYNAMIC_BASE<TOTAL_MEMORY,"TOTAL_MEMORY not big enough for stack");var ctlz_i8=allocate([8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"i8",ALLOC_DYNAMIC);var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_DYNAMIC);var Math_min=Math.min;function invoke_iiii(index,a1,a2,a3){try{return Module["dynCall_iiii"](index,a1,a2,a3)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){try{Module["dynCall_viiiiiii"](index,a1,a2,a3,a4,a5,a6,a7)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){try{Module["dynCall_viiiii"](index,a1,a2,a3,a4,a5)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_i(index){try{return Module["dynCall_i"](index)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_vi(index,a1){try{Module["dynCall_vi"](index,a1)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_vii(index,a1,a2){try{Module["dynCall_vii"](index,a1,a2)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9){try{Module["dynCall_viiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_ii(index,a1){try{return Module["dynCall_ii"](index,a1)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viiiiiid(index,a1,a2,a3,a4,a5,a6,a7){try{Module["dynCall_viiiiiid"](index,a1,a2,a3,a4,a5,a6,a7)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viii(index,a1,a2,a3){try{Module["dynCall_viii"](index,a1,a2,a3)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viiiiid(index,a1,a2,a3,a4,a5,a6){try{Module["dynCall_viiiiid"](index,a1,a2,a3,a4,a5,a6)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_v(index){try{Module["dynCall_v"](index)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_iiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8){try{return Module["dynCall_iiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_iiiii(index,a1,a2,a3,a4){try{return Module["dynCall_iiiii"](index,a1,a2,a3,a4)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8){try{Module["dynCall_viiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6){try{Module["dynCall_viiiiii"](index,a1,a2,a3,a4,a5,a6)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_iii(index,a1,a2){try{return Module["dynCall_iii"](index,a1,a2)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){try{return Module["dynCall_iiiiii"](index,a1,a2,a3,a4,a5)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function invoke_viiii(index,a1,a2,a3,a4){try{Module["dynCall_viiii"](index,a1,a2,a3,a4)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;asm["setThrew"](1,0)}}function asmPrintInt(x,y){Module.print("int "+x+","+y)}function asmPrintFloat(x,y){Module.print("float "+x+","+y)}var asm=(function(global,env,buffer) { -// EMSCRIPTEN_START_ASM -"use asm";var a=new global.Int8Array(buffer);var b=new global.Int16Array(buffer);var c=new global.Int32Array(buffer);var d=new global.Uint8Array(buffer);var e=new global.Uint16Array(buffer);var f=new global.Uint32Array(buffer);var g=new global.Float32Array(buffer);var h=new global.Float64Array(buffer);var i=env.STACKTOP|0;var j=env.STACK_MAX|0;var k=env.tempDoublePtr|0;var l=env.ABORT|0;var m=env.cttz_i8|0;var n=env.ctlz_i8|0;var o=env.__ZTISt9exception|0;var p=env.___dso_handle|0;var q=env._stderr|0;var r=env._stdin|0;var s=env._stdout|0;var t=0;var u=0;var v=0;var w=0;var x=+env.NaN,y=+env.Infinity;var z=0,A=0,B=0,C=0,D=0.0,E=0,F=0,G=0,H=0.0;var I=0;var J=0;var K=0;var L=0;var M=0;var N=0;var O=0;var P=0;var Q=0;var R=0;var S=global.Math.floor;var T=global.Math.abs;var U=global.Math.sqrt;var V=global.Math.pow;var W=global.Math.cos;var X=global.Math.sin;var Y=global.Math.tan;var Z=global.Math.acos;var _=global.Math.asin;var $=global.Math.atan;var aa=global.Math.atan2;var ba=global.Math.exp;var ca=global.Math.log;var da=global.Math.ceil;var ea=global.Math.imul;var fa=env.abort;var ga=env.assert;var ha=env.asmPrintInt;var ia=env.asmPrintFloat;var ja=env.min;var ka=env.jsCall;var la=env.invoke_iiii;var ma=env.invoke_viiiiiii;var na=env.invoke_viiiii;var oa=env.invoke_i;var pa=env.invoke_vi;var qa=env.invoke_vii;var ra=env.invoke_viiiiiiiii;var sa=env.invoke_ii;var ta=env.invoke_viiiiiid;var ua=env.invoke_viii;var va=env.invoke_viiiiid;var wa=env.invoke_v;var xa=env.invoke_iiiiiiiii;var ya=env.invoke_iiiii;var za=env.invoke_viiiiiiii;var Aa=env.invoke_viiiiii;var Ba=env.invoke_iii;var Ca=env.invoke_iiiiii;var Da=env.invoke_viiii;var Ea=env._fabs;var Fa=env._sscanf;var Ga=env._pthread_cond_wait;var Ha=env.___ctype_tolower_loc;var Ia=env._asprintf;var Ja=env.__embind_register_void;var Ka=env._send;var La=env.__embind_register_memory_view;var Ma=env._vsscanf;var Na=env.___ctype_b_loc;var Oa=env.__ZSt9terminatev;var Pa=env._fmod;var Qa=env.___cxa_guard_acquire;var Ra=env.___setErrNo;var Sa=env.___cxa_is_number_type;var Ta=env.___gxx_personality_v0;var Ua=env.__embind_register_integer;var Va=env._ungetc;var Wa=env.___assert_fail;var Xa=env.___cxa_allocate_exception;var Ya=env.__ZSt18uncaught_exceptionv;var Za=env.___ctype_toupper_loc;var _a=env._fflush;var $a=env.___cxa_guard_release;var ab=env.__addDays;var bb=env.___errno_location;var cb=env._pwrite;var db=env._strerror_r;var eb=env._strftime_l;var fb=env.__formatString;var gb=env.__reallyNegative;var hb=env._sbrk;var ib=env._uselocale;var jb=env._catgets;var kb=env._newlocale;var lb=env._snprintf;var mb=env.___cxa_begin_catch;var nb=env._emscripten_memcpy_big;var ob=env._fileno;var pb=env.__embind_register_bool;var qb=env.___resumeException;var rb=env.___cxa_find_matching_catch;var sb=env._sysconf;var tb=env.__embind_register_std_string;var ub=env._strftime;var vb=env.__arraySum;var wb=env.___cxa_throw;var xb=env.__embind_register_emval;var yb=env.__exit;var zb=env.__embind_register_class_function;var Ab=env.__ZNKSt9exception4whatEv;var Bb=env._pthread_mutex_destroy;var Cb=env._pthread_mutex_unlock;var Db=env._fread;var Eb=env._pthread_cond_broadcast;var Fb=env._mkport;var Gb=env._sprintf;var Hb=env.__embind_register_class;var Ib=env._vasprintf;var Jb=env.__embind_register_std_wstring;var Kb=env._write;var Lb=env.__isLeapYear;var Mb=env.__scanString;var Nb=env._strerror;var Ob=env.__embind_register_class_constructor;var Pb=env._recv;var Qb=env._vsnprintf;var Rb=env.__ZNSt9exceptionD2Ev;var Sb=env._copysign;var Tb=env._fgetc;var Ub=env.___cxa_does_inherit;var Vb=env._freelocale;var Wb=env._read;var Xb=env._abort;var Yb=env._catclose;var Zb=env._fwrite;var _b=env._time;var $b=env._pthread_mutex_lock;var ac=env.__embind_register_float;var bc=env._pread;var cc=env._atexit;var dc=env._catopen;var ec=env._exit;var fc=env.__getFloat;var gc=0.0; -// EMSCRIPTEN_START_FUNCS -function Ac(a){a=a|0;var b=0;b=i;i=i+a|0;i=i+7&-8;return b|0}function Bc(){return i|0}function Cc(a){a=a|0;i=a}function Dc(a,b){a=a|0;b=b|0;if((t|0)==0){t=a;u=b}}function Ec(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0]}function Fc(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0];a[k+4>>0]=a[b+4>>0];a[k+5>>0]=a[b+5>>0];a[k+6>>0]=a[b+6>>0];a[k+7>>0]=a[b+7>>0]}function Gc(a){a=a|0;I=a}function Hc(){return I|0}function Ic(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;f=i;i=i+16|0;m=f;l=Sc(jh(Sc(8352,5168)|0,e)|0,5184)|0;j=c[l+((c[(c[l>>2]|0)+ -12>>2]|0)+28)>>2]|0;h=j+4|0;c[h>>2]=(c[h>>2]|0)+1;if(!((c[3364]|0)==-1)){c[m>>2]=13456;c[m+4>>2]=208;c[m+8>>2]=0;cg(13456,m)}m=(c[13460>>2]|0)+ -1|0;n=c[j+8>>2]|0;if((c[j+12>>2]|0)-n>>2>>>0>m>>>0?(k=c[n+(m<<2)>>2]|0,(k|0)!=0):0){k=xc[c[(c[k>>2]|0)+28>>2]&63](k,10)|0;n=c[h>>2]|0;c[h>>2]=n+ -1;if((n|0)==0){lc[c[(c[j>>2]|0)+8>>2]&255](j)}lh(l,k);Yg(l);while(1){h=un(20)|0;if((h|0)!=0){break}h=c[5666]|0;c[5666]=h+0;if((h|0)==0){g=14;break}sc[h&31]()}if((g|0)==14){n=Xa(4)|0;c[n>>2]=22680;wb(n|0,22728,206)}c[h>>2]=d;c[h+4>>2]=e;c[h+8>>2]=0;a[h+12>>0]=0;a[h+13>>0]=0;c[h+16>>2]=0;while(1){d=un(16)|0;if((d|0)!=0){break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){g=20;break}sc[e&31]()}if((g|0)==20){n=Xa(4)|0;c[n>>2]=22680;wb(n|0,22728,206)}c[d+4>>2]=0;c[d+8>>2]=0;c[d>>2]=7408;c[d+12>>2]=h;c[b>>2]=h;n=b+4|0;e=c[n>>2]|0;c[n>>2]=d;if((e|0)!=0){m=e+4|0;n=c[m>>2]|0;c[m>>2]=n+ -1;if((n|0)==0?(lc[c[(c[e>>2]|0)+8>>2]&255](e),m=e+8|0,n=c[m>>2]|0,c[m>>2]=n+ -1,(n|0)==0):0){lc[c[(c[e>>2]|0)+16>>2]&255](e)}h=c[b>>2]|0}while(1){e=un(352)|0;if((e|0)!=0){break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){g=31;break}sc[e&31]()}if((g|0)==31){n=Xa(4)|0;c[n>>2]=22680;wb(n|0,22728,206)}c[e>>2]=h;c[e+4>>2]=h;c[e+8>>2]=0;c[e+12>>2]=0;j=un(1048644)|0;h=j+68&-64;c[h+ -4>>2]=j;c[e+16>>2]=h;h=e+279|0;a[h>>0]=0;a[h+1>>0]=0;h=e+281|0;a[h>>0]=0;a[h+1>>0]=0;a[h+2>>0]=0;a[h+3>>0]=0;h=e+344|0;j=e+288|0;d=j+56|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(d|0));n=h;c[n>>2]=-1;c[n+4>>2]=-1;oe(e);while(1){d=un(16)|0;if((d|0)!=0){break}d=c[5666]|0;c[5666]=d+0;if((d|0)==0){g=37;break}sc[d&31]()}if((g|0)==37){n=Xa(4)|0;c[n>>2]=22680;wb(n|0,22728,206)}c[d+4>>2]=0;c[d+8>>2]=0;c[d>>2]=7128;c[d+12>>2]=e;c[b+8>>2]=e;n=b+12|0;g=c[n>>2]|0;c[n>>2]=d;if((g|0)==0){i=f;return}m=g+4|0;n=c[m>>2]|0;c[m>>2]=n+ -1;if((n|0)!=0){i=f;return}lc[c[(c[g>>2]|0)+8>>2]&255](g);m=g+8|0;n=c[m>>2]|0;c[m>>2]=n+ -1;if((n|0)!=0){i=f;return}lc[c[(c[g>>2]|0)+16>>2]&255](g);i=f;return}n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}function Jc(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;h=i;i=i+176|0;g=h;k=h+32|0;j=h+24|0;f=h+12|0;b=c[b+8>>2]|0;m=b+336|0;B=m;C=b+259|0;l=b+320|0;if((!((c[B+4>>2]|0)==0?(c[B>>2]|0)==(d[C>>0]|d[C+1>>0]<<8|d[C+2>>0]<<16|d[C+3>>0]<<24|0):0)?(n=c[l>>2]|0,(n|0)!=0):0)?(c[b+312>>2]|0)!=0:0){z=n;B=c[z>>2]|0;B=c[B>>2]|0;mc[B&127](z,e);z=m;B=z;B=c[B>>2]|0;z=z+4|0;z=c[z>>2]|0;z=In(B|0,z|0,1,0)|0;B=I;C=m;A=C;c[A>>2]=z;C=C+4|0;c[C>>2]=B;i=h;return}c[l>>2]=0;n=b+324|0;p=c[n>>2]|0;c[n>>2]=0;if(((p|0)!=0?(B=p+4|0,C=c[B>>2]|0,c[B>>2]=C+ -1,(C|0)==0):0)?(lc[c[(c[p>>2]|0)+8>>2]&255](p),B=p+8|0,C=c[B>>2]|0,c[B>>2]=C+ -1,(C|0)==0):0){lc[c[(c[p>>2]|0)+16>>2]&255](p)}s=b+312|0;c[s>>2]=0;r=b+316|0;p=c[r>>2]|0;c[r>>2]=0;if(((p|0)!=0?(B=p+4|0,C=c[B>>2]|0,c[B>>2]=C+ -1,(C|0)==0):0)?(lc[c[(c[p>>2]|0)+8>>2]&255](p),B=p+8|0,C=c[B>>2]|0,c[B>>2]=C+ -1,(C|0)==0):0){lc[c[(c[p>>2]|0)+16>>2]&255](p)}while(1){p=un(12)|0;if((p|0)!=0){break}p=c[5666]|0;c[5666]=p+0;if((p|0)==0){o=15;break}sc[p&31]()}if((o|0)==15){C=Xa(4)|0;c[C>>2]=22680;wb(C|0,22728,206)}c[p>>2]=b+4;c[p+4>>2]=0;c[p+8>>2]=-1;while(1){t=un(16)|0;if((t|0)!=0){break}t=c[5666]|0;c[5666]=t+0;if((t|0)==0){o=21;break}sc[t&31]()}if((o|0)==21){C=Xa(4)|0;c[C>>2]=22680;wb(C|0,22728,206)}c[t+4>>2]=0;c[t+8>>2]=0;c[t>>2]=4840;c[t+12>>2]=p;c[s>>2]=p;u=c[r>>2]|0;c[r>>2]=t;if((u|0)!=0){B=u+4|0;C=c[B>>2]|0;c[B>>2]=C+ -1;if((C|0)==0?(lc[c[(c[u>>2]|0)+8>>2]&255](u),B=u+8|0,C=c[B>>2]|0,c[B>>2]=C+ -1,(C|0)==0):0){lc[c[(c[u>>2]|0)+16>>2]&255](u)}p=c[s>>2]|0}y=k+64|0;s=k+8|0;c[s>>2]=4520;u=k+12|0;c[k>>2]=4652;c[y>>2]=4672;c[k+4>>2]=0;r=k+64|0;c[k+88>>2]=u;c[k+80>>2]=0;c[k+84>>2]=0;c[k+68>>2]=4098;c[k+76>>2]=0;c[k+72>>2]=6;x=k+92|0;t=k+96|0;w=t+40|0;do{c[t>>2]=0;t=t+4|0}while((t|0)<(w|0));Xk(x);c[k+136>>2]=0;c[k+140>>2]=-1;c[k>>2]=4500;c[y>>2]=4540;c[s>>2]=4520;c[u>>2]=10664;t=k+16|0;Xk(t);x=k+20|0;c[x+0>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;c[x+12>>2]=0;c[x+16>>2]=0;c[x+20>>2]=0;c[u>>2]=4688;u=k+44|0;y=k+60|0;c[u+0>>2]=0;c[u+4>>2]=0;c[u+8>>2]=0;c[u+12>>2]=0;c[y>>2]=24;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;a[u+1>>0]=0;if((a[u>>0]&1)==0){a[u>>0]=0}else{c[k+48>>2]=0}w=k+56|0;c[w>>2]=0;z=a[u>>0]|0;if((z&1)==0){A=u+((z&255)>>>1)+1|0;c[w>>2]=A;z=u+1|0}else{z=c[k+52>>2]|0;A=z+(c[k+48>>2]|0)|0;c[w>>2]=A}c[x>>2]=z;c[k+24>>2]=z;c[k+28>>2]=A;C=a[u>>0]|0;if((C&1)==0){z=(C&255)>>>1;c[w>>2]=u+z+1;A=10}else{z=c[k+48>>2]|0;c[w>>2]=(c[k+52>>2]|0)+z;A=c[u>>2]|0;C=A&255;A=(A&-2)+ -1|0}B=(C&1)==0;if(B){C=(C&255)>>>1}else{C=c[k+48>>2]|0}do{if(!(C>>>0<A>>>0)){if(B){a[u+A+1>>0]=0;a[u>>0]=A<<1;break}else{a[(c[k+52>>2]|0)+A>>0]=0;c[k+48>>2]=A;break}}else{hg(u,A-C|0)}}while(0);B=a[u>>0]|0;if((B&1)==0){A=u+1|0;B=(B&255)>>>1}else{A=c[k+52>>2]|0;B=c[k+48>>2]|0}C=k+36|0;c[C>>2]=A;c[k+32>>2]=A;c[k+40>>2]=A+B;if((c[y>>2]&3|0)!=0){c[C>>2]=A+z}if(!((a[g>>0]&1)==0)?(v=c[g+8>>2]|0,(v|0)!=0):0){vn(v)}A=c[b+300>>2]|0;v=c[b+304>>2]|0;if((A|0)!=(v|0)){z=k+8|0;do{B=c[A>>2]|0;C=c[A+4>>2]|0;D=c[A+8>>2]|0;ih(Sc(ih(Sc(ih(Sc(z,4464)|0,D)|0,4472)|0,B)|0,4480)|0,C)|0;A=A+12|0}while((A|0)!=(v|0))}v=c[y>>2]|0;do{if((v&16|0)==0){if((v&8|0)==0){c[f+0>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;break}x=c[x>>2]|0;w=c[k+28>>2]|0;v=x;A=w-v|0;if(A>>>0>4294967279){dg()}do{if(A>>>0<11){a[f>>0]=A<<1;B=f+1|0}else{z=A+16&-16;y=(z|0)==0?1:z;while(1){B=un(y)|0;if((B|0)!=0){o=93;break}B=c[5666]|0;c[5666]=B+0;if((B|0)==0){break}sc[B&31]()}if((o|0)==93){c[f+8>>2]=B;c[f>>2]=z|1;c[f+4>>2]=A;break}D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}}while(0);if((x|0)!=(w|0)){o=B;while(1){a[o>>0]=a[x>>0]|0;x=x+1|0;if((x|0)==(w|0)){break}else{o=o+1|0}}B=B+(w+(0-v))|0}a[B>>0]=0}else{x=c[w>>2]|0;v=c[k+36>>2]|0;if(x>>>0<v>>>0){c[w>>2]=v}else{v=x}x=c[k+32>>2]|0;w=x;z=v-w|0;if(z>>>0>4294967279){dg()}do{if(z>>>0<11){a[f>>0]=z<<1;B=f+1|0}else{y=z+16&-16;A=(y|0)==0?1:y;while(1){B=un(A)|0;if((B|0)!=0){o=76;break}B=c[5666]|0;c[5666]=B+0;if((B|0)==0){break}sc[B&31]()}if((o|0)==76){c[f+8>>2]=B;c[f>>2]=y|1;c[f+4>>2]=z;break}D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}}while(0);if((x|0)!=(v|0)){o=B;while(1){a[o>>0]=a[x>>0]|0;x=x+1|0;if((x|0)==(v|0)){break}else{o=o+1|0}}B=B+(v+(0-w))|0}a[B>>0]=0}}while(0);c[k>>2]=4500;c[k+64>>2]=4540;c[s>>2]=4520;o=k+12|0;c[o>>2]=4688;if(!((a[u>>0]&1)==0)?(q=c[k+52>>2]|0,(q|0)!=0):0){vn(q)}c[o>>2]=10664;o=c[t>>2]|0;C=o+4|0;D=c[C>>2]|0;c[C>>2]=D+ -1;if((D|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}rg(r);q=a[f>>0]|0;r=(q&1)==0;if(r){t=(q&255)>>>1;v=f+1|0}else{t=c[f+4>>2]|0;v=c[f+8>>2]|0}s=t>>>0>7;o=s?7:t;a:do{if((o|0)==0){o=110}else{u=192;while(1){if((a[v>>0]|0)!=(a[u>>0]|0)){o=130;break a}o=o+ -1|0;if((o|0)==0){o=110;break}else{v=v+1|0;u=u+1|0}}}}while(0);do{if((o|0)==110){if(t>>>0>6&(s^1)){while(1){j=un(4788)|0;if((j|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=114;break}sc[g&31]()}if((o|0)==114){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}fd(j);a[j+4784>>0]=1;while(1){g=un(12)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=121;break}sc[g&31]()}if((o|0)==121){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}c[g>>2]=3608;c[g+4>>2]=p;c[g+8>>2]=j;while(1){j=un(16)|0;if((j|0)!=0){o=129;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){break}sc[j&31]()}if((o|0)==129){c[j+4>>2]=0;c[j+8>>2]=0;c[j>>2]=3872;c[j+12>>2]=g;break}D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}else{o=130}}}while(0);b:do{if((o|0)==130){if(r){t=(q&255)>>>1;w=f+1|0}else{t=c[f+4>>2]|0;w=c[f+8>>2]|0}s=t>>>0>13;u=s?13:t;c:do{if((u|0)==0){o=136}else{v=200;while(1){if((a[w>>0]|0)!=(a[v>>0]|0)){break c}u=u+ -1|0;if((u|0)==0){o=136;break}else{w=w+1|0;v=v+1|0}}}}while(0);do{if((o|0)==136){if(!(t>>>0>12&(s^1))){break}while(1){j=un(5116)|0;if((j|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=140;break}sc[g&31]()}if((o|0)==140){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}fd(j);ed(j+4784|0);c[j+4952>>2]=32;c[j+4956>>2]=9;c[j+4960>>2]=8;c[j+4964>>2]=0;c[j+4984>>2]=0;c[j+4988>>2]=0;c[j+4992>>2]=0;c[j+5008>>2]=1;c[j+5012>>2]=2;c[j+5004>>2]=4096;c[j+5e3>>2]=4;c[j+4996>>2]=4;c[j+5016>>2]=0;c[j+5020>>2]=0;c[j+5024>>2]=0;c[j+4968>>2]=32;c[j+4972>>2]=0;c[j+4976>>2]=-2147483648;c[j+4980>>2]=2147483647;c[j+4948>>2]=0;c[j+5032>>2]=32;c[j+5036>>2]=9;c[j+5040>>2]=8;c[j+5044>>2]=0;c[j+5064>>2]=0;c[j+5068>>2]=0;c[j+5072>>2]=0;c[j+5088>>2]=1;c[j+5092>>2]=2;c[j+5084>>2]=4096;c[j+5080>>2]=4;c[j+5076>>2]=4;c[j+5096>>2]=0;c[j+5100>>2]=0;c[j+5104>>2]=0;c[j+5048>>2]=32;c[j+5052>>2]=0;c[j+5056>>2]=-2147483648;c[j+5060>>2]=2147483647;c[j+5028>>2]=0;a[j+5108>>0]=0;a[j+5109>>0]=0;a[j+5112>>0]=1;while(1){g=un(12)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=148;break}sc[g&31]()}if((o|0)==148){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}c[g>>2]=2664;c[g+4>>2]=p;c[g+8>>2]=j;while(1){j=un(16)|0;if((j|0)!=0){o=156;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){break}sc[j&31]()}if((o|0)==156){c[j+4>>2]=0;c[j+8>>2]=0;c[j>>2]=2952;c[j+12>>2]=g;break b}D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}}while(0);if(r){t=(q&255)>>>1;v=f+1|0}else{t=c[f+4>>2]|0;v=c[f+8>>2]|0}s=t>>>0>13;u=s?13:t;d:do{if((u|0)==0){o=163}else{w=216;while(1){if((a[v>>0]|0)!=(a[w>>0]|0)){break d}u=u+ -1|0;if((u|0)==0){o=163;break}else{v=v+1|0;w=w+1|0}}}}while(0);do{if((o|0)==163){if(!(t>>>0>12&(s^1))){break}while(1){j=un(5104)|0;if((j|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=167;break}sc[g&31]()}if((o|0)==167){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}fd(j);bd(j+4784|0);a[j+5100>>0]=1;while(1){g=un(12)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=175;break}sc[g&31]()}if((o|0)==175){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}c[g>>2]=1720;c[g+4>>2]=p;c[g+8>>2]=j;while(1){j=un(16)|0;if((j|0)!=0){o=183;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){break}sc[j&31]()}if((o|0)==183){c[j+4>>2]=0;c[j+8>>2]=0;c[j>>2]=2008;c[j+12>>2]=g;break b}D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}}while(0);if(r){r=(q&255)>>>1;t=f+1|0}else{r=c[f+4>>2]|0;t=c[f+8>>2]|0}q=r>>>0>19;s=q?19:r;e:do{if((s|0)==0){o=190}else{u=232;while(1){if((a[t>>0]|0)!=(a[u>>0]|0)){break e}s=s+ -1|0;if((s|0)==0){o=190;break}else{t=t+1|0;u=u+1|0}}}}while(0);do{if((o|0)==190){if(!(r>>>0>18&(q^1))){break}while(1){j=un(5432)|0;if((j|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=194;break}sc[g&31]()}if((o|0)==194){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}fd(j);ed(j+4784|0);c[j+4952>>2]=32;c[j+4956>>2]=9;c[j+4960>>2]=8;c[j+4964>>2]=0;c[j+4984>>2]=0;c[j+4988>>2]=0;c[j+4992>>2]=0;c[j+5008>>2]=1;c[j+5012>>2]=2;c[j+5004>>2]=4096;c[j+5e3>>2]=4;c[j+4996>>2]=4;c[j+5016>>2]=0;c[j+5020>>2]=0;c[j+5024>>2]=0;c[j+4968>>2]=32;c[j+4972>>2]=0;c[j+4976>>2]=-2147483648;c[j+4980>>2]=2147483647;c[j+4948>>2]=0;c[j+5032>>2]=32;c[j+5036>>2]=9;c[j+5040>>2]=8;c[j+5044>>2]=0;c[j+5064>>2]=0;c[j+5068>>2]=0;c[j+5072>>2]=0;c[j+5088>>2]=1;c[j+5092>>2]=2;c[j+5084>>2]=4096;c[j+5080>>2]=4;c[j+5076>>2]=4;c[j+5096>>2]=0;c[j+5100>>2]=0;c[j+5104>>2]=0;c[j+5048>>2]=32;c[j+5052>>2]=0;c[j+5056>>2]=-2147483648;c[j+5060>>2]=2147483647;c[j+5028>>2]=0;a[j+5108>>0]=0;a[j+5109>>0]=0;bd(j+5112|0);a[j+5428>>0]=1;while(1){g=un(12)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=203;break}sc[g&31]()}if((o|0)==203){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}c[g>>2]=424;c[g+4>>2]=p;c[g+8>>2]=j;while(1){j=un(16)|0;if((j|0)!=0){o=211;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){break}sc[j&31]()}if((o|0)==211){c[j+4>>2]=0;c[j+8>>2]=0;c[j>>2]=1008;c[j+12>>2]=g;break b}D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}}while(0);h=Sc(8352,256)|0;a[k>>0]=0;c[k+4>>2]=h;e=c[(c[h>>2]|0)+ -12>>2]|0;do{if((c[h+(e+16)>>2]|0)==0){e=c[h+(e+72)>>2]|0;if((e|0)!=0){Yg(e)}a[k>>0]=1;e=a[f>>0]|0;do{if((e&1)==0){o=(e&255)>>>1;m=c[(c[h>>2]|0)+ -12>>2]|0;l=c[h+(m+24)>>2]|0;n=f+1|0;if((c[h+(m+4)>>2]&176|0)!=32){e=n;b=o;break}e=n;b=o;n=f+o+1|0}else{n=c[f+4>>2]|0;m=c[(c[h>>2]|0)+ -12>>2]|0;l=c[h+(m+24)>>2]|0;f=c[f+8>>2]|0;if((c[h+(m+4)>>2]&176|0)!=32){e=f;b=n;n=f;break}e=f;b=n;n=f+n|0}}while(0);f=h+m|0;o=h+(m+76)|0;p=c[o>>2]|0;f:do{if((p|0)==-1){p=c[h+(m+28)>>2]|0;m=p+4|0;c[m>>2]=(c[m>>2]|0)+1;if(!((c[3364]|0)==-1)){c[g>>2]=13456;c[g+4>>2]=208;c[g+8>>2]=0;cg(13456,g)}q=(c[13460>>2]|0)+ -1|0;r=c[p+8>>2]|0;do{if((c[p+12>>2]|0)-r>>2>>>0>q>>>0){q=c[r+(q<<2)>>2]|0;if((q|0)==0){break}q=xc[c[(c[q>>2]|0)+28>>2]&63](q,32)|0;D=c[m>>2]|0;c[m>>2]=D+ -1;if((D|0)==0){lc[c[(c[p>>2]|0)+8>>2]&255](p)}p=q<<24>>24;c[o>>2]=p;break f}}while(0);D=Xa(4)|0;c[D>>2]=21304;wb(D|0,21376,196)}}while(0);Wc(j,l,e,n,e+b|0,f,p&255);if((c[j>>2]|0)!=0){break}D=c[(c[h>>2]|0)+ -12>>2]|0;qg(h+D|0,c[h+(D+16)>>2]|5)}}while(0);gh(k);f=c[h+((c[(c[h>>2]|0)+ -12>>2]|0)+28)>>2]|0;e=f+4|0;c[e>>2]=(c[e>>2]|0)+1;if(!((c[3364]|0)==-1)){c[g>>2]=13456;c[g+4>>2]=208;c[g+8>>2]=0;cg(13456,g)}j=(c[13460>>2]|0)+ -1|0;g=c[f+8>>2]|0;do{if((c[f+12>>2]|0)-g>>2>>>0>j>>>0){g=c[g+(j<<2)>>2]|0;if((g|0)==0){break}g=xc[c[(c[g>>2]|0)+28>>2]&63](g,10)|0;D=c[e>>2]|0;c[e>>2]=D+ -1;if((D|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}lh(h,g);Yg(h);f=Xa(8)|0;c[f>>2]=9928;while(1){g=un(45)|0;if((g|0)!=0){o=253;break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){o=251;break}sc[g&31]()}if((o|0)==251){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}else if((o|0)==253){c[g+4>>2]=32;c[g>>2]=32;t=g+12|0;c[f+4>>2]=t;c[g+8>>2]=0;t=t+0|0;g=320|0;w=t+33|0;do{a[t>>0]=a[g>>0]|0;t=t+1|0;g=g+1|0}while((t|0)<(w|0));c[f>>2]=368;wb(f|0,304,22)}}}while(0);D=Xa(4)|0;c[D>>2]=21304;wb(D|0,21376,196)}}while(0);do{if(!((a[f>>0]&1)==0)){f=c[f+8>>2]|0;if((f|0)==0){break}vn(f)}}while(0);c[l>>2]=g;f=c[n>>2]|0;c[n>>2]=j;do{if((f|0)!=0){C=f+4|0;D=c[C>>2]|0;c[C>>2]=D+ -1;if((D|0)!=0){break}lc[c[(c[f>>2]|0)+8>>2]&255](f);C=f+8|0;D=c[C>>2]|0;c[C>>2]=D+ -1;if((D|0)!=0){break}lc[c[(c[f>>2]|0)+16>>2]&255](f)}}while(0);A=b+328|0;C=A;C=In(c[C>>2]|0,c[C+4>>2]|0,1,0)|0;c[A>>2]=C;c[A+4>>2]=I;A=m;c[A>>2]=0;c[A+4>>2]=0;A=c[l>>2]|0;C=c[A>>2]|0;C=c[C>>2]|0;mc[C&127](A,e);A=m;C=A;C=c[C>>2]|0;A=A+4|0;A=c[A>>2]|0;A=In(C|0,A|0,1,0)|0;C=I;D=m;B=D;c[B>>2]=A;D=D+4|0;c[D>>2]=C;i=h;return}function Kc(a){a=a|0;a=(c[a+8>>2]|0)+127|0;return d[a>>0]|d[a+1>>0]<<8|d[a+2>>0]<<16|d[a+3>>0]<<24|0}function Lc(a,b){a=a|0;b=b|0;var e=0,f=0;e=i;f=d[a>>0]|d[a+1>>0]<<8|d[a+2>>0]<<16|d[a+3>>0]<<24;a=a+4|0;a=d[a>>0]|d[a+1>>0]<<8|d[a+2>>0]<<16|d[a+3>>0]<<24;b=b+(a>>1)|0;if((a&1|0)==0){a=f;a=oc[a&127](b)|0;i=e;return a|0}else{a=c[(c[b>>2]|0)+f>>2]|0;a=oc[a&127](b)|0;i=e;return a|0}return 0}function Mc(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0;f=i;g=d[a>>0]|d[a+1>>0]<<8|d[a+2>>0]<<16|d[a+3>>0]<<24;a=a+4|0;a=d[a>>0]|d[a+1>>0]<<8|d[a+2>>0]<<16|d[a+3>>0]<<24;b=b+(a>>1)|0;if((a&1|0)==0){a=g;mc[a&127](b,e);i=f;return}else{a=c[(c[b>>2]|0)+g>>2]|0;mc[a&127](b,e);i=f;return}}function Nc(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0;g=i;h=d[a>>0]|d[a+1>>0]<<8|d[a+2>>0]<<16|d[a+3>>0]<<24;a=a+4|0;a=d[a>>0]|d[a+1>>0]<<8|d[a+2>>0]<<16|d[a+3>>0]<<24;b=b+(a>>1)|0;if((a&1|0)==0){a=h;qc[a&31](b,e,f);i=g;return}else{a=c[(c[b>>2]|0)+h>>2]|0;qc[a&31](b,e,f);i=g;return}}function Oc(){var a=0,b=0,d=0;b=i;while(1){d=un(16)|0;if((d|0)!=0){a=7;break}d=c[5666]|0;c[5666]=d+0;if((d|0)==0){break}sc[d&31]()}if((a|0)==7){c[d+0>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;i=b;return d|0}d=Xa(4)|0;c[d>>2]=22680;wb(d|0,22728,206);return 0}function Pc(a){a=a|0;var b=0;b=i;a=kc[a&31]()|0;i=b;return a|0}function Qc(a){a=a|0;return 72}function Rc(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;if((a|0)==0){i=b;return}d=c[a+12>>2]|0;if(((d|0)!=0?(f=d+4|0,e=c[f>>2]|0,c[f>>2]=e+ -1,(e|0)==0):0)?(lc[c[(c[d>>2]|0)+8>>2]&255](d),e=d+8|0,f=c[e>>2]|0,c[e>>2]=f+ -1,(f|0)==0):0){lc[c[(c[d>>2]|0)+16>>2]&255](d)}d=c[a+4>>2]|0;if(((d|0)!=0?(e=d+4|0,f=c[e>>2]|0,c[e>>2]=f+ -1,(f|0)==0):0)?(lc[c[(c[d>>2]|0)+8>>2]&255](d),e=d+8|0,f=c[e>>2]|0,c[e>>2]=f+ -1,(f|0)==0):0){lc[c[(c[d>>2]|0)+16>>2]&255](d)}vn(a);i=b;return}function Sc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;f=i;i=i+32|0;o=f;e=f+16|0;g=f+12|0;a[e>>0]=0;c[e+4>>2]=b;p=c[(c[b>>2]|0)+ -12>>2]|0;if((c[b+(p+16)>>2]|0)==0){h=c[b+(p+72)>>2]|0;if((h|0)!=0){Yg(h);p=c[(c[b>>2]|0)+ -12>>2]|0}a[e>>0]=1;j=Jn(d|0)|0;m=c[b+(p+24)>>2]|0;if((c[b+(p+4)>>2]&176|0)==32){h=d+j|0}else{h=d}l=b+p|0;n=b+(p+76)|0;q=c[n>>2]|0;do{if((q|0)==-1){p=c[b+(p+28)>>2]|0;q=p+4|0;c[q>>2]=(c[q>>2]|0)+1;if(!((c[3364]|0)==-1)){c[o>>2]=13456;c[o+4>>2]=208;c[o+8>>2]=0;cg(13456,o)}r=(c[13460>>2]|0)+ -1|0;o=c[p+8>>2]|0;if((c[p+12>>2]|0)-o>>2>>>0>r>>>0?(k=c[o+(r<<2)>>2]|0,(k|0)!=0):0){k=xc[c[(c[k>>2]|0)+28>>2]&63](k,32)|0;r=c[q>>2]|0;c[q>>2]=r+ -1;if((r|0)==0){lc[c[(c[p>>2]|0)+8>>2]&255](p)}q=k<<24>>24;c[n>>2]=q;break}r=Xa(4)|0;c[r>>2]=21304;wb(r|0,21376,196)}}while(0);Wc(g,m,d,h,d+j|0,l,q&255);if((c[g>>2]|0)==0){r=c[(c[b>>2]|0)+ -12>>2]|0;qg(b+r|0,c[b+(r+16)>>2]|5)}}gh(e);i=f;return b|0}function Tc(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function Uc(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function Vc(a){a=a|0;mb(a|0)|0;Oa()}function Wc(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0;k=i;i=i+16|0;l=k;if((d|0)==0){c[b>>2]=0;i=k;return}p=e;n=g-p|0;h=h+12|0;m=c[h>>2]|0;n=(m|0)>(n|0)?m-n|0:0;m=f;p=m-p|0;if((p|0)>0?(hc[c[(c[d>>2]|0)+48>>2]&63](d,e,p)|0)!=(p|0):0){c[b>>2]=0;i=k;return}do{if((n|0)>0){do{if(n>>>0<11){p=n<<1&255;a[l>>0]=p;o=l;e=l+1|0}else{q=n+16&-16;p=(q|0)==0?1:q;while(1){e=un(p)|0;if((e|0)!=0){o=15;break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){break}sc[e&31]()}if((o|0)==15){c[l+8>>2]=e;p=q|1;c[l>>2]=p;c[l+4>>2]=n;o=l;p=p&255;break}q=Xa(4)|0;c[q>>2]=22680;wb(q|0,22728,206)}}while(0);Nn(e|0,j|0,n|0)|0;a[e+n>>0]=0;if((p&1)==0){j=l+1|0}else{j=c[l+8>>2]|0}if((hc[c[(c[d>>2]|0)+48>>2]&63](d,j,n)|0)==(n|0)){if((a[o>>0]&1)==0){break}l=c[l+8>>2]|0;if((l|0)==0){break}vn(l);break}c[b>>2]=0;if((a[o>>0]&1)==0){i=k;return}b=c[l+8>>2]|0;if((b|0)==0){i=k;return}vn(b);i=k;return}}while(0);l=g-m|0;if((l|0)>0?(hc[c[(c[d>>2]|0)+48>>2]&63](d,f,l)|0)!=(l|0):0){c[b>>2]=0;i=k;return}c[h>>2]=0;c[b>>2]=d;i=k;return}function Xc(a){a=a|0;var b=0;b=i;_c(a+4768|0);_c(a+4736|0);_c(a+4688|0);_c(a+4656|0);_c(a+4608|0);_c(a+4576|0);_c(a+4528|0);_c(a+4496|0);_c(a+4448|0);_c(a+4416|0);Zc(a+4300|0);Zc(a+4220|0);Zc(a+4140|0);Zc(a+4060|0);Zc(a+3980|0);Yc(a);i=b;return}function Yc(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;d=c[a+896>>2]|0;if((d|0)!=0){e=c[d+8>>2]|0;if((e|0)!=0){vn(c[e+ -4>>2]|0)}e=c[d+12>>2]|0;if((e|0)!=0){vn(c[e+ -4>>2]|0)}e=c[d+16>>2]|0;if((e|0)!=0){vn(c[e+ -4>>2]|0)}vn(d)}d=c[a+900>>2]|0;if((d|0)==0){d=0}else{e=c[d+8>>2]|0;if((e|0)!=0){vn(c[e+ -4>>2]|0)}e=c[d+12>>2]|0;if((e|0)!=0){vn(c[e+ -4>>2]|0)}e=c[d+16>>2]|0;if((e|0)!=0){vn(c[e+ -4>>2]|0)}vn(d);d=0}do{e=c[a+(d<<2)+904>>2]|0;if((e|0)!=0){f=c[e+8>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[e+12>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[e+16>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}vn(e)}e=c[a+(d<<2)+1928>>2]|0;if((e|0)!=0){f=c[e+8>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[e+12>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[e+16>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}vn(e)}e=c[a+(d<<2)+2952>>2]|0;if((e|0)!=0){f=c[e+8>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[e+12>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[e+16>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}vn(e)}d=d+1|0}while((d|0)!=256);d=c[a+860>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+864>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}a=c[a+868>>2]|0;if((a|0)==0){i=b;return}vn(c[a+ -4>>2]|0);i=b;return}function Zc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=i;d=a+36|0;e=c[d>>2]|0;f=a+40|0;g=c[f>>2]|0;if((g|0)!=(e|0)){do{c[f>>2]=g+ -44;h=c[g+ -36>>2]|0;if((h|0)!=0){vn(c[h+ -4>>2]|0)}h=c[g+ -32>>2]|0;if((h|0)!=0){vn(c[h+ -4>>2]|0)}g=c[g+ -28>>2]|0;if((g|0)!=0){vn(c[g+ -4>>2]|0)}g=c[f>>2]|0}while((g|0)!=(e|0))}f=a+68|0;e=c[f>>2]|0;a=a+72|0;g=c[a>>2]|0;if((g|0)==(e|0)){_c(f);_c(d);i=b;return}do{c[a>>2]=g+ -44;h=c[g+ -36>>2]|0;if((h|0)!=0){vn(c[h+ -4>>2]|0)}h=c[g+ -32>>2]|0;if((h|0)!=0){vn(c[h+ -4>>2]|0)}g=c[g+ -28>>2]|0;if((g|0)!=0){vn(c[g+ -4>>2]|0)}g=c[a>>2]|0}while((g|0)!=(e|0));_c(f);_c(d);i=b;return}function _c(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=i;d=c[a>>2]|0;if((d|0)==0){i=b;return}e=a+4|0;f=c[e>>2]|0;if((f|0)!=(d|0)){do{c[e>>2]=f+ -44;g=c[f+ -36>>2]|0;if((g|0)!=0){vn(c[g+ -4>>2]|0)}g=c[f+ -32>>2]|0;if((g|0)!=0){vn(c[g+ -4>>2]|0)}f=c[f+ -28>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[e>>2]|0}while((f|0)!=(d|0));d=c[a>>2]|0;if((d|0)==0){i=b;return}}vn(d);i=b;return}function $c(a){a=a|0;var b=0,d=0;b=i;d=c[a+56>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+60>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+64>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+12>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+16>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}a=c[a+20>>2]|0;if((a|0)==0){i=b;return}vn(c[a+ -4>>2]|0);i=b;return}function ad(a){a=a|0;var b=0,d=0;b=i;d=c[a+280>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+284>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+288>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+236>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+240>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+244>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+192>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+196>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+200>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+148>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+152>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+156>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+104>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+108>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+112>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+60>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+64>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+68>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+16>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}d=c[a+20>>2]|0;if((d|0)!=0){vn(c[d+ -4>>2]|0)}a=c[a+24>>2]|0;if((a|0)==0){i=b;return}vn(c[a+ -4>>2]|0);i=b;return}function bd(b){b=b|0;var c=0,d=0;c=i;d=b+8|0;a[b+0>>0]=0;a[b+1>>0]=0;a[b+2>>0]=0;a[b+3>>0]=0;a[b+4>>0]=0;a[b+5>>0]=0;a[b+6>>0]=0;cd(d,128);cd(b+52|0,256);cd(b+96|0,256);cd(b+140|0,256);cd(b+184|0,256);cd(b+228|0,256);cd(b+272|0,256);i=c;return}function cd(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;e=i;c[b>>2]=d;a[b+4>>0]=0;j=b+8|0;c[j>>2]=0;g=b+12|0;c[g>>2]=0;h=b+16|0;c[h>>2]=0;if((d+ -2|0)>>>0>2046){b=Xa(8)|0;c[b>>2]=9928;while(1){e=un(38)|0;if((e|0)!=0){f=8;break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){break}sc[e&31]()}if((f|0)==8){c[e+4>>2]=25;c[e>>2]=25;d=e+12|0;c[b+4>>2]=d;c[e+8>>2]=0;e=d+0|0;d=384|0;f=e+26|0;do{a[e>>0]=a[d>>0]|0;e=e+1|0;d=d+1|0}while((e|0)<(f|0));wb(b|0,10064,106)}j=Xa(4)|0;c[j>>2]=22680;wb(j|0,22728,206)}c[b+32>>2]=d+ -1;if(d>>>0>16){f=3;while(1){if(1<<f+2>>>0<d>>>0){f=f+1|0}else{break}}k=1<<f;c[b+36>>2]=k;c[b+40>>2]=15-f;k=un((k<<2)+76|0)|0;f=k+68&-64;c[f+ -4>>2]=k;c[h>>2]=f}else{c[h>>2]=0;c[b+40>>2]=0;c[b+36>>2]=0}k=(d<<2)+68|0;h=un(k)|0;f=h+68&-64;c[f+ -4>>2]=h;c[j>>2]=f;k=un(k)|0;f=k+68&-64;c[f+ -4>>2]=k;c[g>>2]=f;c[b+20>>2]=0;g=b+24|0;c[g>>2]=d;if((d|0)==0){dd(b);j=c[b>>2]|0;j=j+6|0;j=j>>>1;c[g>>2]=j;k=b+28|0;c[k>>2]=j;i=e;return}else{d=0}do{c[f+(d<<2)>>2]=1;d=d+1|0}while(d>>>0<(c[b>>2]|0)>>>0);dd(b);j=c[b>>2]|0;j=j+6|0;j=j>>>1;c[g>>2]=j;k=b+28|0;c[k>>2]=j;i=e;return}function dd(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;d=i;e=b+24|0;h=b+20|0;k=(c[h>>2]|0)+(c[e>>2]|0)|0;c[h>>2]=k;if(k>>>0>32768){c[h>>2]=0;if((c[b>>2]|0)==0){k=0}else{l=c[b+12>>2]|0;j=0;do{s=l+(j<<2)|0;k=((c[s>>2]|0)+1|0)>>>1;c[s>>2]=k;k=k+(c[h>>2]|0)|0;c[h>>2]=k;j=j+1|0}while(j>>>0<(c[b>>2]|0)>>>0)}}h=2147483648/(k>>>0)|0;if((a[b+4>>0]|0)==0?(f=b+36|0,(c[f>>2]|0)!=0):0){if((c[b>>2]|0)!=0){o=c[b+8>>2]|0;m=c[b+12>>2]|0;k=b+40|0;n=b+16|0;j=0;s=0;l=0;while(1){r=(ea(l,h)|0)>>>16;c[o+(j<<2)>>2]=r;l=(c[m+(j<<2)>>2]|0)+l|0;r=r>>>(c[k>>2]|0);if(s>>>0<r>>>0){p=j+ -1|0;q=c[n>>2]|0;do{s=s+1|0;c[q+(s<<2)>>2]=p}while((s|0)!=(r|0))}else{r=s}j=j+1|0;if(!(j>>>0<(c[b>>2]|0)>>>0)){break}else{s=r}}h=c[n>>2]|0;c[h>>2]=0;if(!(r>>>0>(c[f>>2]|0)>>>0)){g=18}}else{h=c[b+16>>2]|0;c[h>>2]=0;r=0;g=18}if((g|0)==18){do{r=r+1|0;c[h+(r<<2)>>2]=(c[b>>2]|0)+ -1}while(!(r>>>0>(c[f>>2]|0)>>>0))}s=c[b>>2]|0;r=c[e>>2]|0;r=r*5|0;r=r>>>2;s=s<<3;s=s+48|0;q=r>>>0>s>>>0;r=q?s:r;c[e>>2]=r;s=b+28|0;c[s>>2]=r;i=d;return}if((c[b>>2]|0)==0){s=0;r=c[e>>2]|0;r=r*5|0;r=r>>>2;s=s<<3;s=s+48|0;q=r>>>0>s>>>0;r=q?s:r;c[e>>2]=r;s=b+28|0;c[s>>2]=r;i=d;return}j=c[b+8>>2]|0;k=c[b+12>>2]|0;l=0;g=0;do{c[j+(l<<2)>>2]=(ea(g,h)|0)>>>16;g=(c[k+(l<<2)>>2]|0)+g|0;l=l+1|0;f=c[b>>2]|0}while(l>>>0<f>>>0);r=c[e>>2]|0;r=r*5|0;r=r>>>2;s=f<<3;s=s+48|0;q=r>>>0>s>>>0;r=q?s:r;c[e>>2]=r;s=b+28|0;c[s>>2]=r;i=d;return}function ed(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=i;a[b>>0]=0;cd(b+4|0,516);e=b+48|0;c[e>>2]=6;a[b+52>>0]=0;c[b+80>>2]=5;c[b+64>>2]=0;c[b+88>>2]=0;c[b+84>>2]=0;g=un(92)|0;f=g+68&-64;c[f+ -4>>2]=g;c[b+56>>2]=f;f=un(92)|0;g=f+68&-64;c[g+ -4>>2]=f;c[b+60>>2]=g;c[b+68>>2]=0;f=b+72|0;c[f>>2]=6;h=0;do{c[g+(h<<2)>>2]=1;h=h+1|0}while(h>>>0<(c[e>>2]|0)>>>0);dd(e);e=((c[e>>2]|0)+6|0)>>>1;c[f>>2]=e;c[b+76>>2]=e;e=b+92|0;b=e+72|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(b|0));i=d;return}function fd(d){d=d|0;var e=0,f=0,g=0,h=0;e=i;g=d+52|0;h=d+72|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+76|0;g=d+96|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+100|0;h=d+120|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+124|0;g=d+144|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+148|0;h=d+168|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+172|0;g=d+192|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+196|0;h=d+216|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+220|0;g=d+240|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+244|0;h=d+264|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+268|0;g=d+288|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+292|0;h=d+312|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+316|0;g=d+336|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+340|0;h=d+360|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+364|0;g=d+384|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+388|0;h=d+408|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+412|0;g=d+432|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+436|0;h=d+456|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+460|0;g=d+480|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+484|0;h=d+504|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+508|0;g=d+528|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+532|0;h=d+552|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+556|0;g=d+576|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+580|0;h=d+600|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+604|0;g=d+624|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+628|0;h=d+648|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+652|0;g=d+672|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+676|0;h=d+696|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+700|0;g=d+720|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+724|0;h=d+744|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+748|0;g=d+768|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;g=d+772|0;h=d+792|0;c[g+0>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;a[h>>0]=1;h=d+796|0;g=d+816|0;c[h+0>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;a[g>>0]=1;cd(d+852|0,64);a[d+3976>>0]=0;g=d+20|0;h=g+32|0;do{b[g>>1]=0;g=g+2|0}while((g|0)<(h|0));while(1){g=un(44)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){f=5;break}sc[g&31]()}if((f|0)==5){h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}cd(g,256);c[d+896>>2]=g;while(1){g=un(44)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){f=12;break}sc[g&31]()}if((f|0)==12){h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}cd(g,256);c[d+900>>2]=g;f=d+820|0;c[f+0>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;c[f+12>>2]=0;c[f+16>>2]=0;c[f+20>>2]=0;c[f+24>>2]=0;c[f+28>>2]=0;f=0;a:while(1){while(1){g=un(44)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){f=20;break a}sc[g&31]()}cd(g,256);c[d+(f<<2)+904>>2]=g;while(1){g=un(44)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){f=27;break a}sc[g&31]()}cd(g,256);c[d+(f<<2)+1928>>2]=g;while(1){g=un(44)|0;if((g|0)!=0){break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){f=34;break a}sc[g&31]()}cd(g,256);c[d+(f<<2)+2952>>2]=g;f=f+1|0;if((f|0)>=256){f=38;break}}if((f|0)==20){h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}else if((f|0)==27){h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}else if((f|0)==34){h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}else if((f|0)==38){c[d+3984>>2]=16;c[d+3988>>2]=4;c[d+3992>>2]=8;c[d+3996>>2]=0;c[d+4016>>2]=0;c[d+4020>>2]=0;c[d+4024>>2]=0;c[d+4040>>2]=1;c[d+4044>>2]=2;c[d+4036>>2]=4096;c[d+4032>>2]=4;c[d+4028>>2]=4;c[d+4048>>2]=0;c[d+4052>>2]=0;c[d+4056>>2]=0;c[d+4e3>>2]=16;c[d+4004>>2]=65536;c[d+4008>>2]=-32768;c[d+4012>>2]=32767;c[d+3980>>2]=0;c[d+4064>>2]=16;c[d+4068>>2]=1;c[d+4072>>2]=8;c[d+4076>>2]=0;c[d+4096>>2]=0;c[d+4100>>2]=0;c[d+4104>>2]=0;c[d+4120>>2]=1;c[d+4124>>2]=2;c[d+4116>>2]=4096;c[d+4112>>2]=4;c[d+4108>>2]=4;c[d+4128>>2]=0;c[d+4132>>2]=0;c[d+4136>>2]=0;c[d+4080>>2]=16;c[d+4084>>2]=65536;c[d+4088>>2]=-32768;c[d+4092>>2]=32767;c[d+4060>>2]=0;c[d+4144>>2]=32;c[d+4148>>2]=2;c[d+4152>>2]=8;c[d+4156>>2]=0;c[d+4176>>2]=0;c[d+4180>>2]=0;c[d+4184>>2]=0;c[d+4200>>2]=1;c[d+4204>>2]=2;c[d+4196>>2]=4096;c[d+4192>>2]=4;c[d+4188>>2]=4;c[d+4208>>2]=0;c[d+4212>>2]=0;c[d+4216>>2]=0;c[d+4160>>2]=32;c[d+4164>>2]=0;c[d+4168>>2]=-2147483648;c[d+4172>>2]=2147483647;c[d+4140>>2]=0;c[d+4224>>2]=32;c[d+4228>>2]=22;c[d+4232>>2]=8;c[d+4236>>2]=0;c[d+4256>>2]=0;c[d+4260>>2]=0;c[d+4264>>2]=0;c[d+4280>>2]=1;c[d+4284>>2]=2;c[d+4276>>2]=4096;c[d+4272>>2]=4;c[d+4268>>2]=4;c[d+4288>>2]=0;c[d+4292>>2]=0;c[d+4296>>2]=0;c[d+4240>>2]=32;c[d+4244>>2]=0;c[d+4248>>2]=-2147483648;c[d+4252>>2]=2147483647;c[d+4220>>2]=0;c[d+4304>>2]=32;c[d+4308>>2]=20;c[d+4312>>2]=8;c[d+4316>>2]=0;c[d+4336>>2]=0;c[d+4340>>2]=0;c[d+4344>>2]=0;c[d+4360>>2]=1;c[d+4364>>2]=2;c[d+4356>>2]=4096;c[d+4352>>2]=4;c[d+4348>>2]=4;c[d+4368>>2]=0;c[d+4372>>2]=0;c[d+4376>>2]=0;c[d+4320>>2]=32;c[d+4324>>2]=0;c[d+4328>>2]=-2147483648;c[d+4332>>2]=2147483647;c[d+4300>>2]=0;c[d+4384>>2]=16;c[d+4388>>2]=4;c[d+4392>>2]=8;c[d+4396>>2]=0;c[d+4416>>2]=0;c[d+4420>>2]=0;c[d+4424>>2]=0;c[d+4440>>2]=1;c[d+4444>>2]=2;c[d+4436>>2]=4096;c[d+4432>>2]=4;c[d+4428>>2]=4;c[d+4448>>2]=0;c[d+4452>>2]=0;c[d+4456>>2]=0;c[d+4400>>2]=16;c[d+4404>>2]=65536;c[d+4408>>2]=-32768;c[d+4412>>2]=32767;c[d+4380>>2]=0;c[d+4464>>2]=16;c[d+4468>>2]=1;c[d+4472>>2]=8;c[d+4476>>2]=0;c[d+4496>>2]=0;c[d+4500>>2]=0;c[d+4504>>2]=0;c[d+4520>>2]=1;c[d+4524>>2]=2;c[d+4516>>2]=4096;c[d+4512>>2]=4;c[d+4508>>2]=4;c[d+4528>>2]=0;c[d+4532>>2]=0;c[d+4536>>2]=0;c[d+4480>>2]=16;c[d+4484>>2]=65536;c[d+4488>>2]=-32768;c[d+4492>>2]=32767;c[d+4460>>2]=0;c[d+4544>>2]=32;c[d+4548>>2]=2;c[d+4552>>2]=8;c[d+4556>>2]=0;c[d+4576>>2]=0;c[d+4580>>2]=0;c[d+4584>>2]=0;c[d+4600>>2]=1;c[d+4604>>2]=2;c[d+4596>>2]=4096;c[d+4592>>2]=4;c[d+4588>>2]=4;c[d+4608>>2]=0;c[d+4612>>2]=0;c[d+4616>>2]=0;c[d+4560>>2]=32;c[d+4564>>2]=0;c[d+4568>>2]=-2147483648;c[d+4572>>2]=2147483647;c[d+4540>>2]=0;c[d+4624>>2]=32;c[d+4628>>2]=22;c[d+4632>>2]=8;c[d+4636>>2]=0;c[d+4656>>2]=0;c[d+4660>>2]=0;c[d+4664>>2]=0;c[d+4680>>2]=1;c[d+4684>>2]=2;c[d+4676>>2]=4096;c[d+4672>>2]=4;c[d+4668>>2]=4;c[d+4688>>2]=0;c[d+4692>>2]=0;c[d+4696>>2]=0;c[d+4640>>2]=32;c[d+4644>>2]=0;c[d+4648>>2]=-2147483648;c[d+4652>>2]=2147483647;c[d+4620>>2]=0;c[d+4704>>2]=32;c[d+4708>>2]=20;c[d+4712>>2]=8;c[d+4716>>2]=0;c[d+4736>>2]=0;c[d+4740>>2]=0;c[d+4744>>2]=0;c[d+4760>>2]=1;c[d+4764>>2]=2;c[d+4756>>2]=4096;c[d+4752>>2]=4;c[d+4748>>2]=4;c[d+4768>>2]=0;c[d+4772>>2]=0;c[d+4776>>2]=0;c[d+4720>>2]=32;c[d+4724>>2]=0;c[d+4728>>2]=-2147483648;c[d+4732>>2]=2147483647;c[d+4700>>2]=0;a[d+4780>>0]=0;a[d+4781>>0]=0;i=e;return}}function gd(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+32|0;h=e;f=c[b+8>>2]|0;b=c[b+4>>2]|0;jd(h,f,b);g=c[h>>2]|0;a[d+3>>0]=g>>>24;a[d+2>>0]=g>>>16;a[d+1>>0]=g>>>8;a[d>>0]=g;g=c[h+4>>2]|0;a[d+7>>0]=g>>>24;a[d+6>>0]=g>>>16;a[d+5>>0]=g>>>8;a[d+4>>0]=g;g=c[h+8>>2]|0;a[d+11>>0]=g>>>24;a[d+10>>0]=g>>>16;a[d+9>>0]=g>>>8;a[d+8>>0]=g;g=c[h+12>>2]|0;a[d+13>>0]=(g&65535)>>>8;a[d+12>>0]=g;a[d+14>>0]=g>>>16;a[d+15>>0]=g>>>24;h=c[h+16>>2]|0;a[d+16>>0]=h;a[d+17>>0]=(h&65535)>>>8;a[d+19>>0]=h>>>24;a[d+18>>0]=h>>>16;h=kd(f+4784|0,b)|0;g=I;a[d+23>>0]=h>>>24;a[d+22>>0]=h>>>16;a[d+21>>0]=h>>>8;a[d+20>>0]=h;j=Kn(h|0,g|0,56)|0;a[d+27>>0]=j;j=Kn(h|0,g|0,48)|0;a[d+26>>0]=j;h=Kn(h|0,g|0,40)|0;a[d+25>>0]=h;a[d+24>>0]=g;ld(f+5112|0,b,d+28|0);i=e;return}function hd(a){a=a|0;var b=0;b=i;c[a>>2]=424;a=c[a+8>>2]|0;if((a|0)==0){i=b;return}ad(a+5112|0);_c(a+5096|0);_c(a+5064|0);Zc(a+4948|0);$c(a+4784|0);Xc(a);vn(a);i=b;return}function id(a){a=a|0;var b=0,d=0;b=i;c[a>>2]=424;d=c[a+8>>2]|0;if((d|0)==0){vn(a);i=b;return}ad(d+5112|0);_c(d+5096|0);_c(d+5064|0);Zc(d+4948|0);$c(d+4784|0);Xc(d);vn(d);vn(a);i=b;return}function jd(f,g,h){f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;j=i;i=i+32|0;k=j;l=g+4781|0;if((a[l>>0]|0)==0){td(g+4380|0);td(g+4460|0);td(g+4540|0);td(g+4620|0);td(g+4700|0);a[l>>0]=1}l=g+3976|0;if((a[l>>0]|0)==0){a[l>>0]=1;pd(c[h>>2]|0,k,20);r=d[k+1>>0]<<8|d[k>>0]|d[k+2>>0]<<16|d[k+3>>0]<<24;o=d[k+5>>0]<<8|d[k+4>>0]|d[k+6>>0]<<16|d[k+7>>0]<<24;p=d[k+9>>0]<<8|d[k+8>>0]|d[k+10>>0]<<16|d[k+11>>0]<<24;q=(a[k+13>>0]<<8|d[k+12>>0])&65535;s=a[k+14>>0]|0;t=a[k+15>>0]|0;u=a[k+16>>0]|0;h=a[k+17>>0]|0;v=(a[k+19>>0]<<8|d[k+18>>0])&65535;a[g>>0]=r;a[g+1>>0]=r>>8;a[g+2>>0]=r>>16;a[g+3>>0]=r>>24;r=g+4|0;a[r>>0]=o;a[r+1>>0]=o>>8;a[r+2>>0]=o>>16;a[r+3>>0]=o>>24;r=g+8|0;a[r>>0]=p;a[r+1>>0]=p>>8;a[r+2>>0]=p>>16;a[r+3>>0]=p>>24;r=g+12|0;a[r>>0]=q;a[r+1>>0]=q>>8;a[g+14>>0]=s;a[g+15>>0]=t;a[g+16>>0]=u;a[g+17>>0]=h;h=g+18|0;a[h>>0]=v;a[h+1>>0]=v>>8;f=f+0|0;h=g+0|0;g=f+20|0;do{a[f>>0]=a[h>>0]|0;f=f+1|0;h=h+1|0}while((f|0)<(g|0));i=j;return}m=qd(h,g+852|0)|0;if((m|0)!=0){o=g+14|0;k=a[o>>0]|0;if((m&32|0)!=0){k=(qd(h,c[g+((((k&255)>>>7&255)<<7|k&7|((k&255)>>>6&255)<<6&64|((k&255)>>>3&255)<<3&56)<<2)+904>>2]|0)|0)&255;a[o>>0]=k}l=k&7;k=(k&255)>>>3&7;n=d[872+(k<<3)+l>>0]|0;l=d[936+(k<<3)+l>>0]|0;if((m&16|0)==0){u=b[g+(n<<1)+20>>1]|0;v=g+12|0;a[v>>0]=u;a[v+1>>0]=u>>8}else{p=g+(n<<1)+20|0;q=e[p>>1]|0;q=(rd(g+4380|0,h,(c[g+4416>>2]|0)+((n>>>0<3?n:3)*44|0)|0)|0)+q|0;r=c[g+4404>>2]|0;if((q|0)<0){q=q+r|0}else{q=q-(q>>>0<r>>>0?0:r)|0}v=q&65535;u=g+12|0;a[u>>0]=v;a[u+1>>0]=v>>8;b[p>>1]=v}if((m&8|0)!=0){v=g+15|0;a[v>>0]=qd(h,c[g+(d[v>>0]<<2)+1928>>2]|0)|0}if((m&4|0)!=0){p=qd(h,c[g+(((d[o>>0]|0)>>>6&1)<<2)+896>>2]|0)|0;o=g+16|0;p=(a[o>>0]|0)+p|0;if((p|0)<0){p=p+256|0}else{p=(p|0)>255?p+ -256|0:p}a[o>>0]=p}if((m&2|0)!=0){v=g+17|0;a[v>>0]=qd(h,c[g+(d[v>>0]<<2)+2952>>2]|0)|0}if((m&1|0)!=0){m=g+18|0;p=(d[m>>0]|d[m+1>>0]<<8)&65535;p=(rd(g+4460|0,h,c[g+4496>>2]|0)|0)+p|0;o=c[g+4484>>2]|0;if((p|0)<0){o=p+o|0}else{o=p-(p>>>0<o>>>0?0:o)|0}v=o&65535;a[m>>0]=v;a[m+1>>0]=v>>8}}else{k=a[g+14>>0]|0;n=k&7;k=(k&255)>>>3&7;l=d[936+(k<<3)+n>>0]|0;n=d[872+(k<<3)+n>>0]|0}q=g+(n*24|0)+52|0;o=g+(n*24|0)+60|0;p=c[o>>2]|0;m=g+4540|0;k=(k|0)==1&1;p=(rd(m,h,(c[g+4576>>2]|0)+(k*44|0)|0)|0)+p|0;r=c[g+4564>>2]|0;if((p|0)<0){p=p+r|0}else{p=p-(p>>>0<r>>>0?0:r)|0}r=(d[g>>0]|d[g+1>>0]<<8|d[g+2>>0]<<16|d[g+3>>0]<<24)+p|0;a[g>>0]=r;a[g+1>>0]=r>>8;a[g+2>>0]=r>>16;a[g+3>>0]=r>>24;r=g+(n*24|0)+72|0;s=c[o>>2]|0;do{if((a[r>>0]|0)==0){u=g+(n*24|0)+56|0;t=c[u>>2]|0;if((s|0)>=(p|0)){if((t|0)<(p|0)){c[q>>2]=t;c[u>>2]=p}else{c[q>>2]=p}a[r>>0]=1;break}c[q>>2]=t;c[u>>2]=s;t=g+(n*24|0)+68|0;q=c[t>>2]|0;s=g+(n*24|0)+64|0;r=c[s>>2]|0;if((q|0)<(p|0)){c[o>>2]=r;c[s>>2]=q;c[t>>2]=p;break}if((r|0)<(p|0)){c[o>>2]=r;c[s>>2]=p;break}else{c[o>>2]=p;break}}else{t=g+(n*24|0)+64|0;u=c[t>>2]|0;if((p|0)>=(s|0)){o=g+(n*24|0)+68|0;if((p|0)<(u|0)){c[o>>2]=u;c[t>>2]=p}else{c[o>>2]=p}a[r>>0]=0;break}c[g+(n*24|0)+68>>2]=u;c[t>>2]=s;s=c[q>>2]|0;t=g+(n*24|0)+56|0;r=c[t>>2]|0;if((p|0)<(s|0)){c[o>>2]=r;c[t>>2]=s;c[q>>2]=p;break}if((p|0)<(r|0)){c[o>>2]=r;c[t>>2]=p;break}else{c[o>>2]=p;break}}}while(0);r=g+(n*24|0)+436|0;p=g+(n*24|0)+444|0;q=c[p>>2]|0;s=c[m>>2]|0;o=g+4620|0;q=(rd(o,h,(c[g+4656>>2]|0)+(((s>>>0<20?s&-2:20)|k)*44|0)|0)|0)+q|0;s=c[g+4644>>2]|0;if((q|0)<0){q=q+s|0}else{q=q-(q>>>0<s>>>0?0:s)|0}s=g+4|0;t=(d[s>>0]|d[s+1>>0]<<8|d[s+2>>0]<<16|d[s+3>>0]<<24)+q|0;a[s>>0]=t;a[s+1>>0]=t>>8;a[s+2>>0]=t>>16;a[s+3>>0]=t>>24;s=g+(n*24|0)+456|0;t=c[p>>2]|0;do{if((a[s>>0]|0)==0){u=g+(n*24|0)+440|0;v=c[u>>2]|0;if((t|0)>=(q|0)){if((v|0)<(q|0)){c[r>>2]=v;c[u>>2]=q}else{c[r>>2]=q}a[s>>0]=1;break}c[r>>2]=v;c[u>>2]=t;s=g+(n*24|0)+452|0;r=c[s>>2]|0;n=g+(n*24|0)+448|0;t=c[n>>2]|0;if((r|0)<(q|0)){c[p>>2]=t;c[n>>2]=r;c[s>>2]=q;break}if((t|0)<(q|0)){c[p>>2]=t;c[n>>2]=q;break}else{c[p>>2]=q;break}}else{u=g+(n*24|0)+448|0;v=c[u>>2]|0;if((q|0)>=(t|0)){n=g+(n*24|0)+452|0;if((q|0)<(v|0)){c[n>>2]=v;c[u>>2]=q}else{c[n>>2]=q}a[s>>0]=0;break}c[g+(n*24|0)+452>>2]=v;c[u>>2]=t;s=c[r>>2]|0;n=g+(n*24|0)+440|0;t=c[n>>2]|0;if((q|0)<(s|0)){c[p>>2]=t;c[n>>2]=s;c[r>>2]=q;break}if((q|0)<(t|0)){c[p>>2]=t;c[n>>2]=q;break}else{c[p>>2]=q;break}}}while(0);m=(c[o>>2]|0)+(c[m>>2]|0)|0;l=g+(l<<2)+820|0;n=c[l>>2]|0;if(m>>>0<36){m=m>>>1&2147483646}else{m=18}k=(rd(g+4700|0,h,(c[g+4736>>2]|0)+((m|k)*44|0)|0)|0)+n|0;h=c[g+4724>>2]|0;if((k|0)<0){h=k+h|0}else{h=k-(k>>>0<h>>>0?0:h)|0}v=g+8|0;a[v>>0]=h;a[v+1>>0]=h>>8;a[v+2>>0]=h>>16;a[v+3>>0]=h>>24;c[l>>2]=h;f=f+0|0;h=g+0|0;g=f+20|0;do{a[f>>0]=a[h>>0]|0;f=f+1|0;h=h+1|0}while((f|0)<(g|0));i=j;return}function kd(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;f=i;i=i+16|0;g=f;h=b+325|0;if((a[h>>0]|0)==0){td(b+244|0);a[h>>0]=1}if((a[b>>0]|0)==0){a[b>>0]=1;pd(c[e>>2]|0,g,8);n=d[g+1>>0]<<8|d[g>>0]|d[g+2>>0]<<16|d[g+3>>0]<<24;m=d[g+5>>0]<<8|d[g+4>>0]|d[g+6>>0]<<16|d[g+7>>0]<<24;l=b+100|0;k=l;a[k>>0]=n;a[k+1>>0]=n>>8;a[k+2>>0]=n>>16;a[k+3>>0]=n>>24;l=l+4|0;a[l>>0]=m;a[l+1>>0]=m>>8;a[l+2>>0]=m>>16;a[l+3>>0]=m>>24;I=m;i=f;return n|0}g=b+92|0;do{if((c[b+(c[g>>2]<<2)+132>>2]|0)==0){h=qd(e,b+48|0)|0;if((h|0)==2){h=b+96|0;c[h>>2]=(c[h>>2]|0)+1&3;j=b+(c[g>>2]<<3)+104|0;j=d[j>>0]|d[j+1>>0]<<8|d[j+2>>0]<<16|d[j+3>>0]<<24;j=(rd(b+244|0,e,(c[b+280>>2]|0)+352|0)|0)+j|0;k=c[b+268>>2]|0;if((j|0)<0){j=j+k|0}else{j=j-(j>>>0<k>>>0?0:k)|0}m=((j|0)<0)<<31>>31;k=b+(c[h>>2]<<3)+100|0;n=k;a[n>>0]=j;a[n+1>>0]=j>>8;a[n+2>>0]=j>>16;a[n+3>>0]=j>>24;k=k+4|0;a[k>>0]=m;a[k+1>>0]=m>>8;a[k+2>>0]=m>>16;a[k+3>>0]=m>>24;k=b+(c[h>>2]<<3)+100|0;m=k;m=d[m>>0]|d[m+1>>0]<<8|d[m+2>>0]<<16|d[m+3>>0]<<24;j=k;a[j>>0]=0;a[j+1>>0]=0;a[j+2>>0]=0;a[j+3>>0]=0;k=k+4|0;a[k>>0]=m;a[k+1>>0]=m>>8;a[k+2>>0]=m>>16;a[k+3>>0]=m>>24;k=e+4|0;m=c[k>>2]|0;j=e+8|0;n=(c[j>>2]|0)>>>16;c[j>>2]=n;l=(m>>>0)/(n>>>0)|0;n=m-(ea(n,l)|0)|0;c[k>>2]=n;do{n=(md(c[e>>2]|0)|0)&255|n<<8;c[k>>2]=n;m=c[j>>2]|0;o=m<<8;c[j>>2]=o}while(o>>>0<16777216);o=m>>>8&65535;c[j>>2]=o;m=(n>>>0)/(o>>>0)|0;n=n-(ea(m,o)|0)|0;c[k>>2]=n;do{n=(md(c[e>>2]|0)|0)&255|n<<8;c[k>>2]=n;o=c[j>>2]<<8;c[j>>2]=o}while(o>>>0<16777216);o=b+(c[h>>2]<<3)+100|0;n=o;k=n;n=n+4|0;n=d[n>>0]|d[n+1>>0]<<8|d[n+2>>0]<<16|d[n+3>>0]<<24;l=d[k>>0]|d[k+1>>0]<<8|d[k+2>>0]<<16|d[k+3>>0]<<24|(m<<16|l&65535);m=o;a[m>>0]=l;a[m+1>>0]=l>>8;a[m+2>>0]=l>>16;a[m+3>>0]=l>>24;o=o+4|0;a[o>>0]=n;a[o+1>>0]=n>>8;a[o+2>>0]=n>>16;a[o+3>>0]=n>>24;o=c[h>>2]|0;c[g>>2]=o;c[b+(o<<2)+132>>2]=0;c[b+(c[g>>2]<<2)+148>>2]=0;break}else if((h|0)==1){e=rd(b+244|0,e,c[b+280>>2]|0)|0;h=c[b+268>>2]|0;if((e|0)<0){e=h+e|0}else{e=e-(e>>>0<h>>>0?0:h)|0}c[b+(c[g>>2]<<2)+132>>2]=e;o=c[g>>2]|0;l=c[b+(o<<2)+132>>2]|0;o=b+(o<<3)+100|0;n=o;m=n;n=n+4|0;l=In(d[m>>0]|d[m+1>>0]<<8|d[m+2>>0]<<16|d[m+3>>0]<<24|0,d[n>>0]|d[n+1>>0]<<8|d[n+2>>0]<<16|d[n+3>>0]<<24|0,l|0,((l|0)<0)<<31>>31|0)|0;n=I;m=o;a[m>>0]=l;a[m+1>>0]=l>>8;a[m+2>>0]=l>>16;a[m+3>>0]=l>>24;o=o+4|0;a[o>>0]=n;a[o+1>>0]=n>>8;a[o+2>>0]=n>>16;a[o+3>>0]=n>>24;c[b+(c[g>>2]<<2)+148>>2]=0;break}else{if((h|0)<=2){break}c[g>>2]=h+2+(c[g>>2]|0)&3;kd(b,e)|0;break}}else{h=qd(e,b+4|0)|0;if((h|0)==1){h=c[b+(c[g>>2]<<2)+132>>2]|0;e=(rd(b+244|0,e,(c[b+280>>2]|0)+44|0)|0)+h|0;h=c[b+268>>2]|0;if((e|0)<0){e=e+h|0}else{e=e-(e>>>0<h>>>0?0:h)|0}o=b+(c[g>>2]<<3)+100|0;l=o;n=l;l=l+4|0;l=In(d[n>>0]|d[n+1>>0]<<8|d[n+2>>0]<<16|d[n+3>>0]<<24|0,d[l>>0]|d[l+1>>0]<<8|d[l+2>>0]<<16|d[l+3>>0]<<24|0,e|0,((e|0)<0)<<31>>31|0)|0;n=I;m=o;a[m>>0]=l;a[m+1>>0]=l>>8;a[m+2>>0]=l>>16;a[m+3>>0]=l>>24;o=o+4|0;a[o>>0]=n;a[o+1>>0]=n>>8;a[o+2>>0]=n>>16;a[o+3>>0]=n>>24;c[b+(c[g>>2]<<2)+148>>2]=0;break}if((h|0)>=511){if((h|0)!=512){if((h|0)<=511){break}c[g>>2]=(c[g>>2]|0)+h&3;kd(b,e)|0;break}h=b+96|0;c[h>>2]=(c[h>>2]|0)+1&3;k=b+(c[g>>2]<<3)+104|0;k=d[k>>0]|d[k+1>>0]<<8|d[k+2>>0]<<16|d[k+3>>0]<<24;k=(rd(b+244|0,e,(c[b+280>>2]|0)+352|0)|0)+k|0;j=c[b+268>>2]|0;if((k|0)<0){j=k+j|0}else{j=k-(k>>>0<j>>>0?0:j)|0}o=((j|0)<0)<<31>>31;k=b+(c[h>>2]<<3)+100|0;l=k;a[l>>0]=j;a[l+1>>0]=j>>8;a[l+2>>0]=j>>16;a[l+3>>0]=j>>24;k=k+4|0;a[k>>0]=o;a[k+1>>0]=o>>8;a[k+2>>0]=o>>16;a[k+3>>0]=o>>24;k=b+(c[h>>2]<<3)+100|0;o=k;o=d[o>>0]|d[o+1>>0]<<8|d[o+2>>0]<<16|d[o+3>>0]<<24;l=k;a[l>>0]=0;a[l+1>>0]=0;a[l+2>>0]=0;a[l+3>>0]=0;k=k+4|0;a[k>>0]=o;a[k+1>>0]=o>>8;a[k+2>>0]=o>>16;a[k+3>>0]=o>>24;k=e+4|0;o=c[k>>2]|0;l=e+8|0;m=(c[l>>2]|0)>>>16;c[l>>2]=m;j=(o>>>0)/(m>>>0)|0;m=o-(ea(m,j)|0)|0;c[k>>2]=m;do{m=(md(c[e>>2]|0)|0)&255|m<<8;c[k>>2]=m;n=c[l>>2]|0;o=n<<8;c[l>>2]=o}while(o>>>0<16777216);o=n>>>8&65535;c[l>>2]=o;n=(m>>>0)/(o>>>0)|0;m=m-(ea(n,o)|0)|0;c[k>>2]=m;do{m=(md(c[e>>2]|0)|0)&255|m<<8;c[k>>2]=m;o=c[l>>2]<<8;c[l>>2]=o}while(o>>>0<16777216);o=b+(c[h>>2]<<3)+100|0;m=o;l=m;m=m+4|0;m=d[m>>0]|d[m+1>>0]<<8|d[m+2>>0]<<16|d[m+3>>0]<<24;l=d[l>>0]|d[l+1>>0]<<8|d[l+2>>0]<<16|d[l+3>>0]<<24|(n<<16|j&65535);n=o;a[n>>0]=l;a[n+1>>0]=l>>8;a[n+2>>0]=l>>16;a[n+3>>0]=l>>24;o=o+4|0;a[o>>0]=m;a[o+1>>0]=m>>8;a[o+2>>0]=m>>16;a[o+3>>0]=m>>24;o=c[h>>2]|0;c[g>>2]=o;c[b+(o<<2)+132>>2]=0;c[b+(c[g>>2]<<2)+148>>2]=0;break}do{if((h|0)==0){e=rd(b+244|0,e,(c[b+280>>2]|0)+308|0)|0;h=c[b+268>>2]|0;if((e|0)<0){e=h+e|0}else{e=e-(e>>>0<h>>>0?0:h)|0}h=b+(c[g>>2]<<2)+148|0;c[h>>2]=(c[h>>2]|0)+1;h=c[g>>2]|0;if((c[b+(h<<2)+148>>2]|0)>3){c[b+(h<<2)+132>>2]=e;c[b+(c[g>>2]<<2)+148>>2]=0}}else{if((h|0)<500){l=b+244|0;j=ea(c[b+(c[g>>2]<<2)+132>>2]|0,h)|0;k=c[b+280>>2]|0;if((h|0)<10){h=(rd(l,e,k+88|0)|0)+j|0;e=c[b+268>>2]|0;if((h|0)<0){e=h+e|0;break}else{e=h-(h>>>0<e>>>0?0:e)|0;break}}else{h=(rd(l,e,k+132|0)|0)+j|0;e=c[b+268>>2]|0;if((h|0)<0){e=h+e|0;break}else{e=h-(h>>>0<e>>>0?0:e)|0;break}}}if((h|0)==500){h=(c[b+(c[g>>2]<<2)+132>>2]|0)*500|0;h=(rd(b+244|0,e,(c[b+280>>2]|0)+176|0)|0)+h|0;e=c[b+268>>2]|0;if((h|0)<0){e=h+e|0}else{e=h-(h>>>0<e>>>0?0:e)|0}h=b+(c[g>>2]<<2)+148|0;c[h>>2]=(c[h>>2]|0)+1;h=c[g>>2]|0;if((c[b+(h<<2)+148>>2]|0)<=3){break}c[b+(h<<2)+132>>2]=e;c[b+(c[g>>2]<<2)+148>>2]=0;break}h=500-h|0;k=b+244|0;j=c[b+(c[g>>2]<<2)+132>>2]|0;if((h|0)>-10){h=ea(j,h)|0;h=(rd(k,e,(c[b+280>>2]|0)+220|0)|0)+h|0;e=c[b+268>>2]|0;if((h|0)<0){e=h+e|0;break}else{e=h-(h>>>0<e>>>0?0:e)|0;break}}h=ea(j,-10)|0;e=(rd(k,e,(c[b+280>>2]|0)+264|0)|0)+h|0;h=c[b+268>>2]|0;if((e|0)<0){h=e+h|0}else{h=e-(e>>>0<h>>>0?0:h)|0}e=b+(c[g>>2]<<2)+148|0;c[e>>2]=(c[e>>2]|0)+1;e=c[g>>2]|0;if((c[b+(e<<2)+148>>2]|0)>3){c[b+(e<<2)+132>>2]=h;c[b+(c[g>>2]<<2)+148>>2]=0;e=h}else{e=h}}}while(0);o=b+(c[g>>2]<<3)+100|0;l=o;n=l;l=l+4|0;l=In(d[n>>0]|d[n+1>>0]<<8|d[n+2>>0]<<16|d[n+3>>0]<<24|0,d[l>>0]|d[l+1>>0]<<8|d[l+2>>0]<<16|d[l+3>>0]<<24|0,e|0,((e|0)<0)<<31>>31|0)|0;n=I;m=o;a[m>>0]=l;a[m+1>>0]=l>>8;a[m+2>>0]=l>>16;a[m+3>>0]=l>>24;o=o+4|0;a[o>>0]=n;a[o+1>>0]=n>>8;a[o+2>>0]=n>>16;a[o+3>>0]=n>>24}}while(0);n=b+(c[g>>2]<<3)+100|0;o=n;n=n+4|0;n=d[n>>0]|d[n+1>>0]<<8|d[n+2>>0]<<16|d[n+3>>0]<<24;o=d[o>>0]|d[o+1>>0]<<8|d[o+2>>0]<<16|d[o+3>>0]<<24;I=n;i=f;return o|0}function ld(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=i;i=i+16|0;h=g;if((a[b>>0]|0)==0){a[b>>0]=1;pd(c[e>>2]|0,h,6);u=a[h+1>>0]<<8|d[h>>0];j=u&65535;l=a[h+2>>0]|0;k=(a[h+3>>0]<<8|l&255)&65535;n=a[h+4>>0]|0;m=(a[h+5>>0]<<8|n&255)&65535;h=b+1|0;a[h>>0]=j;a[h+1>>0]=j>>8;h=b+3|0;a[h>>0]=k;a[h+1>>0]=k>>8;h=b+5|0;a[h>>0]=m;a[h+1>>0]=m>>8;h=u;m=(m&65535)>>>8&255}else{l=qd(e,b+8|0)|0;if((l&1|0)==0){m=b+1|0;m=d[m>>0]|d[m+1>>0]<<8;h=m&255}else{h=(qd(e,b+52|0)|0)&255;m=b+1|0;m=d[m>>0]|d[m+1>>0]<<8;h=(m&255)+h|0;h=(h|0)>255?h+65280|0:h}if((l&2|0)==0){h=m&65280|h&65535}else{u=(qd(e,b+96|0)|0)&255;m=b+1|0;m=d[m>>0]|d[m+1>>0]<<8;u=((m&65535)>>>8)+u|0;h=((u|0)>255?u+65280|0:u)<<8|h&65535}j=h&65535;do{if((l&64|0)==0){k=b+1|0;l=b+5|0;n=j;m=j}else{k=b+1|0;m=(h&255)-(m&255)|0;do{if((l&4|0)!=0){p=qd(e,b+140|0)|0;n=p&255;o=b+3|0;o=d[o>>0]|d[o+1>>0]<<8;q=o&65535;r=(q&255)+m|0;s=(r|0)<1;if((r+ -1|0)>>>0>253){t=s?0:255}else{t=q+m&255}if((t+n|0)>255){if(!s){if((r|0)>254){n=255}else{n=q+m&255}}else{n=0}n=(p|-256)+n|0;break}else{if(!s){if((r|0)>254){p=255}else{p=q+m&255}}else{p=0}n=p+n|0;break}}else{o=b+3|0;o=d[o>>0]|d[o+1>>0]<<8;n=o&255}}while(0);do{if((l&16|0)!=0){p=qd(e,b+228|0)|0;o=b+3|0;o=d[o>>0]|d[o+1>>0]<<8;r=((n&255)+m-(o&255)|0)/2|0;m=p&255;t=b+5|0;t=(d[t>>0]|d[t+1>>0]<<8)&65535;u=(t&255)+r|0;s=(u|0)<1;if((u+ -1|0)>>>0>253){q=s?0:255}else{q=t+r&255}if((q+m|0)>255){if(!s){if((u|0)>254){m=255}else{m=t+r&255}}else{m=0}m=(p|-256)+m|0;p=o;break}else{if(!s){if((u|0)>254){p=255}else{p=t+r&255}}else{p=0}m=p+m|0;p=o;break}}else{m=b+5|0;m=(d[m>>0]|d[m+1>>0]<<8)&255;p=o}}while(0);o=(h>>>8&255)-(((d[k>>0]|d[k+1>>0]<<8)&65535)>>>8)|0;if((l&8|0)==0){r=p&65280|n&65535}else{p=qd(e,b+184|0)|0;q=p&255;t=b+3|0;t=(((d[t>>0]|d[t+1>>0]<<8)&65535)>>>8)+o|0;r=(t|0)<1;if(r){s=0}else{s=(t|0)>254?255:t&255}if((s+q|0)>255){if(r){q=0}else{q=(t|0)>254?255:t&255}p=(p|-256)+q|0}else{if(r){p=0}else{p=(t|0)>254?255:t&255}p=p+q|0}r=p<<8|n&65535}n=r&65535;if((l&32|0)==0){u=b+5|0;l=u;m=((d[u>>0]|d[u+1>>0]<<8)&65280|m)&65535;break}q=qd(e,b+272|0)|0;u=b+3|0;p=q&255;l=b+5|0;r=(((d[l>>0]|d[l+1>>0]<<8)&65535)>>>8)+(((r>>>8&255)+o-(((d[u>>0]|d[u+1>>0]<<8)&65535)>>>8)|0)/2|0)|0;o=(r|0)<1;if(o){s=0}else{s=(r|0)>254?255:r&255}if((s+p|0)>255){if(o){o=0}else{o=(r|0)>254?255:r&255}o=(q|-256)+o|0}else{if(o){o=0}else{o=(r|0)>254?255:r&255}o=o+p|0}m=(o<<8|m)&65535}}while(0);a[k>>0]=j;a[k+1>>0]=j>>8;k=b+3|0;a[k>>0]=n;a[k+1>>0]=n>>8;a[l>>0]=m;a[l+1>>0]=m>>8;k=n;l=n&255;n=m&255;m=(m&65535)>>>8&255}a[f+1>>0]=(j&65535)>>>8;a[f>>0]=h;a[f+3>>0]=(k&65535)>>>8;a[f+2>>0]=l;a[f+5>>0]=m;a[f+4>>0]=n;f=b+316|0;if((a[f>>0]|0)==0){i=g;return}u=((md(c[e>>2]|0)|0)&255)<<24;u=((md(c[e>>2]|0)|0)&255)<<16|u;u=u|((md(c[e>>2]|0)|0)&255)<<8;c[e+4>>2]=u|(md(c[e>>2]|0)|0)&255;a[f>>0]=0;i=g;return}function md(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;g=i;e=b+4|0;h=c[e>>2]|0;f=b+8|0;if((h|0)<(c[f>>2]|0)){j=h;h=j+1|0;c[e>>2]=h;h=b+12|0;h=c[h>>2]|0;j=h+j|0;j=a[j>>0]|0;i=g;return j|0}c[e>>2]=0;j=c[b>>2]|0;h=j+13|0;if((a[h>>0]|0)==0){k=j+4|0;n=j+8|0;l=c[n>>2]|0;m=(c[k>>2]|0)-l|0;m=(m|0)<1048576?m:1048576;Mn(c[b+12>>2]|0,(c[j>>2]|0)+l|0,m|0)|0;l=(c[n>>2]|0)+m|0;c[n>>2]=l;c[j+16>>2]=m;if((l|0)>=(c[k>>2]|0)){a[h>>0]=1}}else{a[j+12>>0]=1}n=c[(c[b>>2]|0)+16>>2]|0;c[f>>2]=n;if((n|0)!=0){n=c[e>>2]|0;m=n+1|0;c[e>>2]=m;m=b+12|0;m=c[m>>2]|0;n=m+n|0;n=a[n>>0]|0;i=g;return n|0}b=Xa(8)|0;c[b>>2]=9928;while(1){e=un(32)|0;if((e|0)!=0){d=14;break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){break}sc[e&31]()}if((d|0)==14){c[e+4>>2]=19;c[e>>2]=19;f=e+12|0;c[b+4>>2]=f;c[e+8>>2]=0;f=f+0|0;e=824|0;d=f+20|0;do{a[f>>0]=a[e>>0]|0;f=f+1|0;e=e+1|0}while((f|0)<(d|0));c[b>>2]=856;wb(b|0,808,26)}n=Xa(4)|0;c[n>>2]=22680;wb(n|0,22728,206);return 0}function nd(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function od(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function pd(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;f=i;g=b+4|0;k=c[g>>2]|0;j=b+8|0;do{if((k|0)<(c[j>>2]|0)){j=k}else{c[g>>2]=0;k=c[b>>2]|0;l=k+13|0;if((a[l>>0]|0)==0){m=k+4|0;p=k+8|0;n=c[p>>2]|0;o=(c[m>>2]|0)-n|0;o=(o|0)<1048576?o:1048576;Mn(c[b+12>>2]|0,(c[k>>2]|0)+n|0,o|0)|0;n=(c[p>>2]|0)+o|0;c[p>>2]=n;c[k+16>>2]=o;if((n|0)>=(c[m>>2]|0)){a[l>>0]=1}}else{a[k+12>>0]=1}p=c[(c[b>>2]|0)+16>>2]|0;c[j>>2]=p;if((p|0)!=0){j=c[g>>2]|0;break}e=Xa(8)|0;c[e>>2]=9928;while(1){f=un(32)|0;if((f|0)!=0){h=14;break}f=c[5666]|0;c[5666]=f+0;if((f|0)==0){break}sc[f&31]()}if((h|0)==14){c[f+4>>2]=19;c[f>>2]=19;d=f+12|0;c[e+4>>2]=d;c[f+8>>2]=0;d=d+0|0;g=824|0;f=d+20|0;do{a[d>>0]=a[g>>0]|0;d=d+1|0;g=g+1|0}while((d|0)<(f|0));c[e>>2]=856;wb(e|0,808,26)}p=Xa(4)|0;c[p>>2]=22680;wb(p|0,22728,206)}}while(0);b=c[b+12>>2]|0;h=b+(j+e)|0;if((e|0)==0){p=j;p=p+e|0;c[g>>2]=p;i=f;return}b=b+j|0;while(1){a[d>>0]=a[b>>0]|0;b=b+1|0;if((b|0)==(h|0)){break}else{d=d+1|0}}p=c[g>>2]|0;p=p+e|0;c[g>>2]=p;i=f;return}function qd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=i;d=a+8|0;f=c[d>>2]|0;h=c[b+16>>2]|0;if((h|0)!=0){j=c[a+4>>2]|0;g=f>>>15;c[d>>2]=g;l=(j>>>0)/(g>>>0)|0;m=l>>>(c[b+40>>2]|0);k=c[h+(m<<2)>>2]|0;m=(c[h+(m+1<<2)>>2]|0)+1|0;n=k+1|0;h=c[b+8>>2]|0;if(m>>>0>n>>>0){while(1){n=(m+k|0)>>>1;o=(c[h+(n<<2)>>2]|0)>>>0>l>>>0;k=o?k:n;m=o?n:m;n=k+1|0;if(!(m>>>0>n>>>0)){l=n;break}}}else{l=n}n=ea(g,c[h+(k<<2)>>2]|0)|0;if((k|0)!=(c[b+32>>2]|0)){f=ea(c[h+(l<<2)>>2]|0,g)|0}}else{h=f>>>15;c[d>>2]=h;l=c[b>>2]|0;g=c[b+8>>2]|0;j=c[a+4>>2]|0;m=l>>>1;k=0;n=0;do{p=ea(c[g+(m<<2)>>2]|0,h)|0;o=p>>>0>j>>>0;f=o?p:f;n=o?n:p;k=o?k:m;l=o?m:l;m=(k+l|0)>>>1}while((m|0)!=(k|0))}g=a+4|0;h=j-n|0;c[g>>2]=h;p=f-n|0;c[d>>2]=p;if(p>>>0<16777216){do{h=(md(c[a>>2]|0)|0)&255|h<<8;c[g>>2]=h;p=c[d>>2]<<8;c[d>>2]=p}while(p>>>0<16777216)}o=(c[b+12>>2]|0)+(k<<2)|0;c[o>>2]=(c[o>>2]|0)+1;o=b+28|0;p=(c[o>>2]|0)+ -1|0;c[o>>2]=p;if((p|0)!=0){i=e;return k|0}dd(b);i=e;return k|0}function rd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;e=i;f=qd(b,d)|0;c[a>>2]=f;if((f|0)!=0){if(!(f>>>0<32)){l=c[a+28>>2]|0;i=e;return l|0}d=c[a+12>>2]|0;if(f>>>0>d>>>0){d=f-d|0;l=qd(b,(c[a+68>>2]|0)+((f+ -1|0)*44|0)|0)|0;d=l<<d|(sd(b,d)|0)}else{d=qd(b,(c[a+68>>2]|0)+((f+ -1|0)*44|0)|0)|0}a=c[a>>2]|0;if((d|0)<(1<<a+ -1|0)){l=d+1+(-1<<a)|0;i=e;return l|0}else{l=d+1|0;i=e;return l|0}}f=a+56|0;h=b+8|0;l=c[h>>2]|0;j=ea(l>>>13,c[f>>2]|0)|0;g=b+4|0;k=c[g>>2]|0;m=k>>>0>=j>>>0;d=m&1;if(m){c[g>>2]=k-j;j=l-j|0;c[h>>2]=j}else{c[h>>2]=j;j=a+60|0;c[j>>2]=(c[j>>2]|0)+1;j=c[h>>2]|0}if(j>>>0<16777216){j=c[g>>2]|0;do{j=(md(c[b>>2]|0)|0)&255|j<<8;c[g>>2]=j;m=c[h>>2]<<8;c[h>>2]=m}while(m>>>0<16777216)}h=a+52|0;m=(c[h>>2]|0)+ -1|0;c[h>>2]=m;if((m|0)!=0){m=d;i=e;return m|0}b=a+48|0;g=c[b>>2]|0;j=a+64|0;k=(c[j>>2]|0)+g|0;c[j>>2]=k;if(k>>>0>8192){k=(k+1|0)>>>1;c[j>>2]=k;m=a+60|0;a=((c[m>>2]|0)+1|0)>>>1;c[m>>2]=a;if((a|0)==(k|0)){m=k+1|0;c[j>>2]=m;j=m}else{j=k;k=a}}else{j=k;k=c[a+60>>2]|0}c[f>>2]=(ea(2147483648/(j>>>0)|0,k)|0)>>>18;m=g*5|0;m=m>>>0>259?64:m>>>2;c[b>>2]=m;c[h>>2]=m;m=d;i=e;return m|0}function sd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0;f=i;d=a+4|0;g=c[d>>2]|0;e=a+8|0;h=c[e>>2]|0;if(b>>>0>19){j=h>>>16;c[e>>2]=j;h=(g>>>0)/(j>>>0)|0;g=g-(ea(h,j)|0)|0;c[d>>2]=g;do{g=(md(c[a>>2]|0)|0)&255|g<<8;c[d>>2]=g;j=c[e>>2]<<8;c[e>>2]=j}while(j>>>0<16777216);j=(sd(a,b+ -16|0)|0)<<16|h&65535;i=f;return j|0}j=h>>>b;c[e>>2]=j;b=(g>>>0)/(j>>>0)|0;g=g-(ea(b,j)|0)|0;c[d>>2]=g;if(!(j>>>0<16777216)){i=f;return b|0}do{g=(md(c[a>>2]|0)|0)&255|g<<8;c[d>>2]=g;j=c[e>>2]<<8;c[e>>2]=j}while(j>>>0<16777216);i=f;return b|0}function td(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;f=i;i=i+96|0;h=f+44|0;d=f;w=b+36|0;u=b+40|0;if((c[w>>2]|0)!=(c[u>>2]|0)){i=f;return}j=b+8|0;e=b+20|0;if((c[j>>2]|0)!=0){g=b+44|0;n=h+4|0;m=h+8|0;l=h+12|0;k=h+16|0;o=h+20|0;p=h+24|0;q=h+28|0;r=h+32|0;s=h+36|0;t=h+40|0;v=0;do{cd(h,(c[e>>2]|0)+1|0);x=c[u>>2]|0;if(x>>>0<(c[g>>2]|0)>>>0){if((x|0)==0){x=0}else{c[x>>2]=c[h>>2];a[x+4>>0]=a[n>>0]|0;c[x+8>>2]=c[m>>2];c[x+12>>2]=c[l>>2];c[x+16>>2]=c[k>>2];c[x+20>>2]=c[o>>2];c[x+24>>2]=c[p>>2];c[x+28>>2]=c[q>>2];c[x+32>>2]=c[r>>2];c[x+36>>2]=c[s>>2];c[x+40>>2]=c[t>>2];c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;x=c[u>>2]|0}c[u>>2]=x+44}else{ud(w,h)}x=c[m>>2]|0;if((x|0)!=0){vn(c[x+ -4>>2]|0)}x=c[l>>2]|0;if((x|0)!=0){vn(c[x+ -4>>2]|0)}x=c[k>>2]|0;if((x|0)!=0){vn(c[x+ -4>>2]|0)}v=v+1|0}while(v>>>0<(c[j>>2]|0)>>>0)}if((c[e>>2]|0)==0){i=f;return}t=b+12|0;k=b+72|0;s=b+76|0;l=d+4|0;j=d+8|0;o=d+12|0;h=d+16|0;m=d+20|0;n=d+24|0;g=d+28|0;p=d+32|0;q=d+36|0;r=d+40|0;b=b+68|0;u=1;do{v=c[t>>2]|0;cd(d,1<<(u>>>0>v>>>0?v:u));v=c[k>>2]|0;if(v>>>0<(c[s>>2]|0)>>>0){if((v|0)==0){v=0}else{c[v>>2]=c[d>>2];a[v+4>>0]=a[l>>0]|0;c[v+8>>2]=c[j>>2];c[v+12>>2]=c[o>>2];c[v+16>>2]=c[h>>2];c[v+20>>2]=c[m>>2];c[v+24>>2]=c[n>>2];c[v+28>>2]=c[g>>2];c[v+32>>2]=c[p>>2];c[v+36>>2]=c[q>>2];c[v+40>>2]=c[r>>2];c[j+0>>2]=0;c[j+4>>2]=0;c[j+8>>2]=0;v=c[k>>2]|0}c[k>>2]=v+44}else{ud(b,d)}v=c[j>>2]|0;if((v|0)!=0){vn(c[v+ -4>>2]|0)}v=c[o>>2]|0;if((v|0)!=0){vn(c[v+ -4>>2]|0)}v=c[h>>2]|0;if((v|0)!=0){vn(c[v+ -4>>2]|0)}u=u+1|0}while(!(u>>>0>(c[e>>2]|0)>>>0));i=f;return}function ud(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=i;f=b+4|0;m=c[f>>2]|0;k=c[b>>2]|0;l=k;h=(m-l|0)/44|0;j=h+1|0;if(j>>>0>97612893){Tk()}g=b+8|0;l=((c[g>>2]|0)-l|0)/44|0;if(l>>>0<48806446){o=l<<1;o=o>>>0<j>>>0?j:o;if((o|0)==0){p=0;l=0}else{n=5}}else{o=97612893;n=5}do{if((n|0)==5){p=o*44|0;p=(p|0)==0?1:p;while(1){l=un(p)|0;if((l|0)!=0){n=11;break}l=c[5666]|0;c[5666]=l+0;if((l|0)==0){break}sc[l&31]()}if((n|0)==11){p=o;break}p=Xa(4)|0;c[p>>2]=22680;wb(p|0,22728,206)}}while(0);o=l+(h*44|0)|0;n=l+(p*44|0)|0;if((o|0)!=0){c[o>>2]=c[d>>2];a[l+(h*44|0)+4>>0]=a[d+4>>0]|0;m=d+8|0;c[l+(h*44|0)+8>>2]=c[m>>2];c[l+(h*44|0)+12>>2]=c[d+12>>2];c[l+(h*44|0)+16>>2]=c[d+16>>2];c[l+(h*44|0)+20>>2]=c[d+20>>2];c[l+(h*44|0)+24>>2]=c[d+24>>2];c[l+(h*44|0)+28>>2]=c[d+28>>2];c[l+(h*44|0)+32>>2]=c[d+32>>2];c[l+(h*44|0)+36>>2]=c[d+36>>2];c[l+(h*44|0)+40>>2]=c[d+40>>2];c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;m=c[f>>2]|0;k=c[b>>2]|0}j=l+(j*44|0)|0;if((m|0)!=(k|0)){h=h+ -1-(((m+ -44+(0-k)|0)>>>0)/44|0)|0;while(1){d=m;m=m+ -44|0;c[o+ -44>>2]=c[m>>2];a[o+ -40>>0]=a[d+ -40>>0]|0;p=d+ -36|0;c[o+ -36>>2]=c[p>>2];c[o+ -32>>2]=c[d+ -32>>2];c[o+ -28>>2]=c[d+ -28>>2];c[o+ -24>>2]=c[d+ -24>>2];c[o+ -20>>2]=c[d+ -20>>2];c[o+ -16>>2]=c[d+ -16>>2];c[o+ -12>>2]=c[d+ -12>>2];c[o+ -8>>2]=c[d+ -8>>2];c[o+ -4>>2]=c[d+ -4>>2];c[p+0>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;if((m|0)==(k|0)){break}else{o=o+ -44|0}}m=c[b>>2]|0;k=c[f>>2]|0;c[b>>2]=l+(h*44|0);c[f>>2]=j;c[g>>2]=n;if((k|0)!=(m|0)){do{f=c[k+ -36>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[k+ -32>>2]|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}f=c[k+ -28>>2]|0;k=k+ -44|0;if((f|0)!=0){vn(c[f+ -4>>2]|0)}}while((k|0)!=(m|0))}}else{c[b>>2]=o;c[f>>2]=j;c[g>>2]=n}if((m|0)==0){i=e;return}vn(m);i=e;return}function vd(a){a=a|0;return}function wd(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function xd(a){a=a|0;var b=0;b=i;a=c[a+12>>2]|0;if((a|0)==0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function yd(a,b){a=a|0;b=b|0;if((c[b+4>>2]|0)==1408){a=a+12|0}else{a=0}return a|0}function zd(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Ad(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=i;i=i+32|0;g=e;f=c[b+8>>2]|0;b=c[b+4>>2]|0;jd(g,f,b);h=c[g>>2]|0;a[d+3>>0]=h>>>24;a[d+2>>0]=h>>>16;a[d+1>>0]=h>>>8;a[d>>0]=h;h=c[g+4>>2]|0;a[d+7>>0]=h>>>24;a[d+6>>0]=h>>>16;a[d+5>>0]=h>>>8;a[d+4>>0]=h;h=c[g+8>>2]|0;a[d+11>>0]=h>>>24;a[d+10>>0]=h>>>16;a[d+9>>0]=h>>>8;a[d+8>>0]=h;h=c[g+12>>2]|0;a[d+13>>0]=(h&65535)>>>8;a[d+12>>0]=h;a[d+14>>0]=h>>>16;a[d+15>>0]=h>>>24;g=c[g+16>>2]|0;a[d+16>>0]=g;a[d+17>>0]=(g&65535)>>>8;a[d+19>>0]=g>>>24;a[d+18>>0]=g>>>16;ld(f+4784|0,b,d+20|0);i=e;return}function Bd(a){a=a|0;var b=0;b=i;c[a>>2]=1720;a=c[a+8>>2]|0;if((a|0)==0){i=b;return}ad(a+4784|0);Xc(a);vn(a);i=b;return}function Cd(a){a=a|0;var b=0,d=0;b=i;c[a>>2]=1720;d=c[a+8>>2]|0;if((d|0)==0){vn(a);i=b;return}ad(d+4784|0);Xc(d);vn(d);vn(a);i=b;return}function Dd(a){a=a|0;return}function Ed(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Fd(a){a=a|0;var b=0;b=i;a=c[a+12>>2]|0;if((a|0)==0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function Gd(a,b){a=a|0;b=b|0;if((c[b+4>>2]|0)==2376){a=a+12|0}else{a=0}return a|0}function Hd(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Id(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+32|0;h=e;f=c[b+8>>2]|0;b=c[b+4>>2]|0;jd(h,f,b);g=c[h>>2]|0;a[d+3>>0]=g>>>24;a[d+2>>0]=g>>>16;a[d+1>>0]=g>>>8;a[d>>0]=g;g=c[h+4>>2]|0;a[d+7>>0]=g>>>24;a[d+6>>0]=g>>>16;a[d+5>>0]=g>>>8;a[d+4>>0]=g;g=c[h+8>>2]|0;a[d+11>>0]=g>>>24;a[d+10>>0]=g>>>16;a[d+9>>0]=g>>>8;a[d+8>>0]=g;g=c[h+12>>2]|0;a[d+13>>0]=(g&65535)>>>8;a[d+12>>0]=g;a[d+14>>0]=g>>>16;a[d+15>>0]=g>>>24;h=c[h+16>>2]|0;a[d+16>>0]=h;a[d+17>>0]=(h&65535)>>>8;a[d+19>>0]=h>>>24;a[d+18>>0]=h>>>16;h=kd(f+4784|0,b)|0;g=I;a[d+23>>0]=h>>>24;a[d+22>>0]=h>>>16;a[d+21>>0]=h>>>8;a[d+20>>0]=h;j=Kn(h|0,g|0,56)|0;a[d+27>>0]=j;j=Kn(h|0,g|0,48)|0;a[d+26>>0]=j;h=Kn(h|0,g|0,40)|0;a[d+25>>0]=h;a[d+24>>0]=g;d=f+5112|0;if((a[d>>0]|0)==0){i=e;return}j=((md(c[b>>2]|0)|0)&255)<<24;j=((md(c[b>>2]|0)|0)&255)<<16|j;j=j|((md(c[b>>2]|0)|0)&255)<<8;c[b+4>>2]=j|(md(c[b>>2]|0)|0)&255;a[d>>0]=0;i=e;return}function Jd(a){a=a|0;var b=0;b=i;c[a>>2]=2664;a=c[a+8>>2]|0;if((a|0)==0){i=b;return}_c(a+5096|0);_c(a+5064|0);Zc(a+4948|0);$c(a+4784|0);Xc(a);vn(a);i=b;return}function Kd(a){a=a|0;var b=0,d=0;b=i;c[a>>2]=2664;d=c[a+8>>2]|0;if((d|0)==0){vn(a);i=b;return}_c(d+5096|0);_c(d+5064|0);Zc(d+4948|0);$c(d+4784|0);Xc(d);vn(d);vn(a);i=b;return}function Ld(a){a=a|0;return}function Md(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Nd(a){a=a|0;var b=0;b=i;a=c[a+12>>2]|0;if((a|0)==0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function Od(a,b){a=a|0;b=b|0;if((c[b+4>>2]|0)==3320){a=a+12|0}else{a=0}return a|0}function Pd(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Qd(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=i;i=i+32|0;g=e;f=c[b+8>>2]|0;b=c[b+4>>2]|0;jd(g,f,b);h=c[g>>2]|0;a[d+3>>0]=h>>>24;a[d+2>>0]=h>>>16;a[d+1>>0]=h>>>8;a[d>>0]=h;h=c[g+4>>2]|0;a[d+7>>0]=h>>>24;a[d+6>>0]=h>>>16;a[d+5>>0]=h>>>8;a[d+4>>0]=h;h=c[g+8>>2]|0;a[d+11>>0]=h>>>24;a[d+10>>0]=h>>>16;a[d+9>>0]=h>>>8;a[d+8>>0]=h;h=c[g+12>>2]|0;a[d+13>>0]=(h&65535)>>>8;a[d+12>>0]=h;a[d+14>>0]=h>>>16;a[d+15>>0]=h>>>24;g=c[g+16>>2]|0;a[d+16>>0]=g;a[d+17>>0]=(g&65535)>>>8;a[d+19>>0]=g>>>24;a[d+18>>0]=g>>>16;d=f+4784|0;if((a[d>>0]|0)==0){i=e;return}h=((md(c[b>>2]|0)|0)&255)<<24;h=((md(c[b>>2]|0)|0)&255)<<16|h;h=h|((md(c[b>>2]|0)|0)&255)<<8;c[b+4>>2]=h|(md(c[b>>2]|0)|0)&255;a[d>>0]=0;i=e;return}function Rd(a){a=a|0;var b=0;b=i;c[a>>2]=3608;a=c[a+8>>2]|0;if((a|0)==0){i=b;return}Xc(a);vn(a);i=b;return}function Sd(a){a=a|0;var b=0,d=0;b=i;c[a>>2]=3608;d=c[a+8>>2]|0;if((d|0)==0){vn(a);i=b;return}Xc(d);vn(d);vn(a);i=b;return}function Td(a){a=a|0;return}function Ud(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Vd(a){a=a|0;var b=0;b=i;a=c[a+12>>2]|0;if((a|0)==0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function Wd(a,b){a=a|0;b=b|0;if((c[b+4>>2]|0)==4216){a=a+12|0}else{a=0}return a|0}function Xd(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Yd(b){b=b|0;var d=0,e=0,f=0,g=0;d=i;c[b>>2]=4500;c[b+64>>2]=4540;c[b+8>>2]=4520;e=b+12|0;c[e>>2]=4688;if(!((a[b+44>>0]&1)==0)?(f=c[b+52>>2]|0,(f|0)!=0):0){vn(f)}c[e>>2]=10664;e=c[b+16>>2]|0;g=e+4|0;f=c[g>>2]|0;c[g>>2]=f+ -1;if((f|0)!=0){g=b+64|0;rg(g);i=d;return}lc[c[(c[e>>2]|0)+8>>2]&255](e);g=b+64|0;rg(g);i=d;return}function Zd(b){b=b|0;var d=0,e=0,f=0,g=0;d=i;g=b+ -8|0;c[g>>2]=4500;b=g+64|0;c[b>>2]=4540;c[g+8>>2]=4520;f=g+12|0;c[f>>2]=4688;if(!((a[g+44>>0]&1)==0)?(e=c[g+52>>2]|0,(e|0)!=0):0){vn(e)}c[f>>2]=10664;e=c[g+16>>2]|0;f=e+4|0;g=c[f>>2]|0;c[f>>2]=g+ -1;if((g|0)!=0){rg(b);i=d;return}lc[c[(c[e>>2]|0)+8>>2]&255](e);rg(b);i=d;return}function _d(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;e=i;g=c[(c[b>>2]|0)+ -12>>2]|0;c[b+g>>2]=4500;d=b+(g+64)|0;c[d>>2]=4540;c[b+(g+8)>>2]=4520;f=b+(g+12)|0;c[f>>2]=4688;if(!((a[b+(g+44)>>0]&1)==0)?(h=c[b+(g+52)>>2]|0,(h|0)!=0):0){vn(h)}c[f>>2]=10664;b=c[b+(g+16)>>2]|0;g=b+4|0;h=c[g>>2]|0;c[g>>2]=h+ -1;if((h|0)!=0){rg(d);i=e;return}lc[c[(c[b>>2]|0)+8>>2]&255](b);rg(d);i=e;return}function $d(b){b=b|0;var d=0,e=0,f=0,g=0;d=i;c[b>>2]=4500;c[b+64>>2]=4540;c[b+8>>2]=4520;e=b+12|0;c[e>>2]=4688;if(!((a[b+44>>0]&1)==0)?(f=c[b+52>>2]|0,(f|0)!=0):0){vn(f)}c[e>>2]=10664;e=c[b+16>>2]|0;g=e+4|0;f=c[g>>2]|0;c[g>>2]=f+ -1;if((f|0)==0){lc[c[(c[e>>2]|0)+8>>2]&255](e)}rg(b+64|0);if((b|0)==0){i=d;return}vn(b);i=d;return}function ae(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=i;f=b+ -8|0;c[f>>2]=4500;b=f+64|0;c[b>>2]=4540;c[f+8>>2]=4520;g=f+12|0;c[g>>2]=4688;if(!((a[f+44>>0]&1)==0)?(e=c[f+52>>2]|0,(e|0)!=0):0){vn(e)}c[g>>2]=10664;e=c[f+16>>2]|0;h=e+4|0;g=c[h>>2]|0;c[h>>2]=g+ -1;if((g|0)!=0){rg(b);vn(f);i=d;return}lc[c[(c[e>>2]|0)+8>>2]&255](e);rg(b);vn(f);i=d;return}function be(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0;d=i;h=c[(c[b>>2]|0)+ -12>>2]|0;f=b+h|0;c[f>>2]=4500;e=b+(h+64)|0;c[e>>2]=4540;c[b+(h+8)>>2]=4520;g=b+(h+12)|0;c[g>>2]=4688;if(!((a[b+(h+44)>>0]&1)==0)?(j=c[b+(h+52)>>2]|0,(j|0)!=0):0){vn(j)}c[g>>2]=10664;b=c[b+(h+16)>>2]|0;h=b+4|0;j=c[h>>2]|0;c[h>>2]=j+ -1;if((j|0)==0){lc[c[(c[b>>2]|0)+8>>2]&255](b)}rg(e);if((f|0)==0){i=d;return}vn(f);i=d;return}function ce(b){b=b|0;var d=0,e=0,f=0;d=i;c[b>>2]=4688;if(!((a[b+32>>0]&1)==0)?(e=c[b+40>>2]|0,(e|0)!=0):0){vn(e)}c[b>>2]=10664;b=c[b+4>>2]|0;f=b+4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e|0)!=0){i=d;return}lc[c[(c[b>>2]|0)+8>>2]&255](b);i=d;return}function de(b){b=b|0;var d=0,e=0,f=0,g=0;d=i;c[b>>2]=4688;if(!((a[b+32>>0]&1)==0)?(e=c[b+40>>2]|0,(e|0)!=0):0){vn(e)}c[b>>2]=10664;e=c[b+4>>2]|0;g=e+4|0;f=c[g>>2]|0;c[g>>2]=f+ -1;if((f|0)==0){lc[c[(c[e>>2]|0)+8>>2]&255](e)}if((b|0)==0){i=d;return}vn(b);i=d;return}function ee(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0;l=i;o=d+44|0;m=c[o>>2]|0;k=d+24|0;j=c[k>>2]|0;if(m>>>0<j>>>0){c[o>>2]=j;m=j}o=h&24;do{if((o|0)==0){o=b;c[o>>2]=0;c[o+4>>2]=0;o=b+8|0;c[o>>2]=-1;c[o+4>>2]=-1;i=l;return}else if((o|0)!=24){if((g|0)==2){n=11;break}else if((g|0)==0){g=0;o=0;break}else if((g|0)!=1){n=15;break}if((h&8|0)==0){o=j-(c[d+20>>2]|0)|0;g=o;o=((o|0)<0)<<31>>31;break}else{o=(c[d+12>>2]|0)-(c[d+8>>2]|0)|0;g=o;o=((o|0)<0)<<31>>31;break}}else{if((g|0)==2){n=11;break}else if((g|0)==0){g=0;o=0;break}else if((g|0)!=1){n=15;break}o=b;c[o>>2]=0;c[o+4>>2]=0;o=b+8|0;c[o>>2]=-1;c[o+4>>2]=-1;i=l;return}}while(0);if((n|0)==15){o=b;c[o>>2]=0;c[o+4>>2]=0;o=b+8|0;c[o>>2]=-1;c[o+4>>2]=-1;i=l;return}if((n|0)==11){n=d+32|0;if((a[n>>0]&1)==0){n=n+1|0}else{n=c[d+40>>2]|0}o=m-n|0;g=o;o=((o|0)<0)<<31>>31}f=In(g|0,o|0,e|0,f|0)|0;e=I;if((e|0)>=0){n=d+32|0;if((a[n>>0]&1)==0){n=n+1|0}else{n=c[d+40>>2]|0}o=m-n|0;g=((o|0)<0)<<31>>31;if(!((g|0)<(e|0)|(g|0)==(e|0)&o>>>0<f>>>0)){n=h&8;if(!((f|0)==0&(e|0)==0)){if((n|0)!=0?(c[d+12>>2]|0)==0:0){o=b;c[o>>2]=0;c[o+4>>2]=0;o=b+8|0;c[o>>2]=-1;c[o+4>>2]=-1;i=l;return}if((h&16|0)!=0&(j|0)==0){o=b;c[o>>2]=0;c[o+4>>2]=0;o=b+8|0;c[o>>2]=-1;c[o+4>>2]=-1;i=l;return}}if((n|0)!=0){c[d+12>>2]=(c[d+8>>2]|0)+f;c[d+16>>2]=m}if((h&16|0)!=0){c[k>>2]=(c[d+20>>2]|0)+f}o=b;c[o>>2]=0;c[o+4>>2]=0;o=b+8|0;c[o>>2]=f;c[o+4>>2]=e;i=l;return}}o=b;c[o>>2]=0;c[o+4>>2]=0;o=b+8|0;c[o>>2]=-1;c[o+4>>2]=-1;i=l;return}function fe(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=i;d=d+8|0;wc[c[(c[b>>2]|0)+16>>2]&63](a,b,c[d>>2]|0,c[d+4>>2]|0,0,e);i=f;return}function ge(a){a=a|0;var b=0,e=0,f=0,g=0;b=i;f=a+44|0;g=c[f>>2]|0;e=c[a+24>>2]|0;if(g>>>0<e>>>0){c[f>>2]=e}else{e=g}if((c[a+48>>2]&8|0)==0){g=-1;i=b;return g|0}f=a+16|0;g=c[f>>2]|0;a=c[a+12>>2]|0;if(g>>>0<e>>>0){c[f>>2]=e}else{e=g}if(!(a>>>0<e>>>0)){g=-1;i=b;return g|0}g=d[a>>0]|0;i=b;return g|0}function he(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;e=i;g=b+44|0;f=c[g>>2]|0;j=c[b+24>>2]|0;if(f>>>0<j>>>0){c[g>>2]=j}else{j=f}f=b+8|0;g=c[f>>2]|0;h=b+12|0;l=c[h>>2]|0;if(!(g>>>0<l>>>0)){l=-1;i=e;return l|0}if((d|0)==-1){c[f>>2]=g;c[h>>2]=l+ -1;c[b+16>>2]=j;l=0;i=e;return l|0}if((c[b+48>>2]&16|0)==0){k=d&255;l=l+ -1|0;if(!(k<<24>>24==(a[l>>0]|0))){l=-1;i=e;return l|0}}else{k=d&255;l=l+ -1|0}c[f>>2]=g;c[h>>2]=l;c[b+16>>2]=j;a[l>>0]=k;l=d;i=e;return l|0}function ie(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;j=i;if((d|0)==-1){u=0;i=j;return u|0}g=b+12|0;e=b+8|0;f=(c[g>>2]|0)-(c[e>>2]|0)|0;h=b+24|0;n=c[h>>2]|0;k=b+28|0;m=c[k>>2]|0;if((n|0)==(m|0)){l=b+48|0;if((c[l>>2]&16|0)==0){u=-1;i=j;return u|0}m=b+20|0;p=c[m>>2]|0;n=n-p|0;o=b+44|0;p=(c[o>>2]|0)-p|0;q=b+32|0;r=a[q>>0]|0;s=(r&1)!=0;if(s){t=(c[q>>2]&-2)+ -1|0;r=c[b+36>>2]|0}else{t=10;r=(r&255)>>>1}if((r|0)==(t|0)){lg(q,t,1,t,t,0);if((a[q>>0]&1)==0){s=12}else{s=13}}else{if(s){s=13}else{s=12}}if((s|0)==12){a[q>>0]=(r<<1)+2;u=q+1|0;t=r+1|0}else if((s|0)==13){u=c[b+40>>2]|0;t=r+1|0;c[b+36>>2]=t}a[u+r>>0]=0;a[u+t>>0]=0;t=a[q>>0]|0;if((t&1)==0){r=10}else{r=c[q>>2]|0;t=r&255;r=(r&-2)+ -1|0}s=(t&1)==0;if(s){t=(t&255)>>>1}else{t=c[b+36>>2]|0}do{if(!(t>>>0<r>>>0)){if(s){a[q+r+1>>0]=0;a[q>>0]=r<<1;break}else{a[(c[b+40>>2]|0)+r>>0]=0;c[b+36>>2]=r;break}}else{hg(q,r-t|0)}}while(0);r=a[q>>0]|0;if((r&1)==0){q=q+1|0;r=(r&255)>>>1}else{q=c[b+40>>2]|0;r=c[b+36>>2]|0}t=q+r|0;c[m>>2]=q;c[k>>2]=t;n=q+n|0;c[h>>2]=n;u=q+p|0;c[o>>2]=u;k=t;o=u}else{l=b+48|0;k=m;o=c[b+44>>2]|0}m=n+1|0;o=m>>>0<o>>>0?o:m;c[b+44>>2]=o;if((c[l>>2]&8|0)!=0){l=b+32|0;if((a[l>>0]&1)==0){l=l+1|0}else{l=c[b+40>>2]|0}c[e>>2]=l;c[g>>2]=l+f;c[b+16>>2]=o}if((n|0)==(k|0)){u=xc[c[(c[b>>2]|0)+52>>2]&63](b,d&255)|0;i=j;return u|0}else{c[h>>2]=m;a[n>>0]=d;u=d&255;i=j;return u|0}return 0}function je(a){a=a|0;return}function ke(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function le(a){a=a|0;var b=0;b=i;a=c[a+12>>2]|0;if((a|0)!=0){vn(a)}i=b;return}function me(a,b){a=a|0;b=b|0;if((c[b+4>>2]|0)==5048){a=a+12|0}else{a=0}return a|0}function ne(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function oe(b){b=b|0;var e=0,f=0,g=0,j=0,l=0,m=0,n=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0.0,K=0.0,L=0.0,M=0.0,N=0.0,O=0.0;e=i;i=i+256|0;f=e+80|0;o=e;n=e+104|0;m=e+224|0;j=e+208|0;g=e+128|0;x=e+240|0;v=e+112|0;s=e+56|0;z=c[b>>2]|0;y=z+13|0;if((a[y>>0]|0)==0){H=z+4|0;E=z+8|0;G=c[E>>2]|0;F=(c[H>>2]|0)-G|0;F=(F|0)<4?F:4;Mn(x|0,(c[z>>2]|0)+G|0,F|0)|0;G=(c[E>>2]|0)+F|0;c[E>>2]=G;c[z+16>>2]=F;if((G|0)>=(c[H>>2]|0)){a[y>>0]=1}}else{a[z+12>>0]=1}a[v>>0]=8;B=v+1|0;a[B>>0]=a[x>>0]|0;a[v+2>>0]=a[x+1>>0]|0;a[v+3>>0]=a[x+2>>0]|0;y=v+4|0;a[y>>0]=a[x+3>>0]|0;a[v+(x+(4-x))+1>>0]=0;z=a[v>>0]|0;x=(z&1)==0;if(x){y=(z&255)>>>1}else{B=c[v+8>>2]|0;y=c[y>>2]|0}z=y>>>0>4;A=z?4:y;a:do{if((A|0)!=0){C=5232;while(1){D=a[B>>0]|0;E=a[C>>0]|0;if(!(D<<24>>24==E<<24>>24)){break}A=A+ -1|0;if((A|0)==0){l=12;break a}else{B=B+1|0;C=C+1|0}}if(!(D<<24>>24==E<<24>>24)){y=(D&255)-(E&255)|0}else{l=12}}else{l=12}}while(0);if((l|0)==12){y=y>>>0<4?-1:z&1}y=(y|0)==0;if(!x?(w=c[v+8>>2]|0,(w|0)!=0):0){vn(w)}if(!y){g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(36)|0;if((b|0)!=0){l=23;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==23){c[b+4>>2]=23;c[b>>2]=23;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=7056|0;e=f+24|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=7088;wb(g|0,5272,86)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}v=Sc(8352,5288)|0;w=c[v+((c[(c[v>>2]|0)+ -12>>2]|0)+28)>>2]|0;x=w+4|0;c[x>>2]=(c[x>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}z=(c[13460>>2]|0)+ -1|0;y=c[w+8>>2]|0;if((c[w+12>>2]|0)-y>>2>>>0>z>>>0?(u=c[y+(z<<2)>>2]|0,(u|0)!=0):0){u=xc[c[(c[u>>2]|0)+28>>2]&63](u,10)|0;H=c[x>>2]|0;c[x>>2]=H+ -1;if((H|0)==0){lc[c[(c[w>>2]|0)+8>>2]&255](w)}lh(v,u);Yg(v);u=c[b>>2]|0;if((c[u+4>>2]|0)>0){c[u+8>>2]=0}else{a[u+12>>0]=1}v=c[b>>2]|0;u=b+20|0;w=v+13|0;if((a[w>>0]|0)==0){H=v+4|0;E=v+8|0;G=c[E>>2]|0;F=(c[H>>2]|0)-G|0;F=(F|0)<227?F:227;Mn(u|0,(c[v>>2]|0)+G|0,F|0)|0;G=(c[E>>2]|0)+F|0;c[E>>2]=G;c[v+16>>2]=F;if((G|0)>=(c[H>>2]|0)){a[w>>0]=1}}else{a[v+12>>0]=1}C=b+199|0;a[k>>0]=a[C>>0];a[k+1>>0]=a[C+1>>0];a[k+2>>0]=a[C+2>>0];a[k+3>>0]=a[C+3>>0];a[k+4>>0]=a[C+4>>0];a[k+5>>0]=a[C+5>>0];a[k+6>>0]=a[C+6>>0];a[k+7>>0]=a[C+7>>0];N=+h[k>>3];E=b+207|0;a[k>>0]=a[E>>0];a[k+1>>0]=a[E+1>>0];a[k+2>>0]=a[E+2>>0];a[k+3>>0]=a[E+3>>0];a[k+4>>0]=a[E+4>>0];a[k+5>>0]=a[E+5>>0];a[k+6>>0]=a[E+6>>0];a[k+7>>0]=a[E+7>>0];O=+h[k>>3];G=b+215|0;a[k>>0]=a[G>>0];a[k+1>>0]=a[G+1>>0];a[k+2>>0]=a[G+2>>0];a[k+3>>0]=a[G+3>>0];a[k+4>>0]=a[G+4>>0];a[k+5>>0]=a[G+5>>0];a[k+6>>0]=a[G+6>>0];a[k+7>>0]=a[G+7>>0];L=+h[k>>3];D=b+223|0;a[k>>0]=a[D>>0];a[k+1>>0]=a[D+1>>0];a[k+2>>0]=a[D+2>>0];a[k+3>>0]=a[D+3>>0];a[k+4>>0]=a[D+4>>0];a[k+5>>0]=a[D+5>>0];a[k+6>>0]=a[D+6>>0];a[k+7>>0]=a[D+7>>0];M=+h[k>>3];F=b+231|0;a[k>>0]=a[F>>0];a[k+1>>0]=a[F+1>>0];a[k+2>>0]=a[F+2>>0];a[k+3>>0]=a[F+3>>0];a[k+4>>0]=a[F+4>>0];a[k+5>>0]=a[F+5>>0];a[k+6>>0]=a[F+6>>0];a[k+7>>0]=a[F+7>>0];J=+h[k>>3];H=b+239|0;a[k>>0]=a[H>>0];a[k+1>>0]=a[H+1>>0];a[k+2>>0]=a[H+2>>0];a[k+3>>0]=a[H+3>>0];a[k+4>>0]=a[H+4>>0];a[k+5>>0]=a[H+5>>0];a[k+6>>0]=a[H+6>>0];a[k+7>>0]=a[H+7>>0];K=+h[k>>3];h[k>>3]=O;a[C>>0]=a[k>>0];a[C+1>>0]=a[k+1>>0];a[C+2>>0]=a[k+2>>0];a[C+3>>0]=a[k+3>>0];a[C+4>>0]=a[k+4>>0];a[C+5>>0]=a[k+5>>0];a[C+6>>0]=a[k+6>>0];a[C+7>>0]=a[k+7>>0];h[k>>3]=N;a[D>>0]=a[k>>0];a[D+1>>0]=a[k+1>>0];a[D+2>>0]=a[k+2>>0];a[D+3>>0]=a[k+3>>0];a[D+4>>0]=a[k+4>>0];a[D+5>>0]=a[k+5>>0];a[D+6>>0]=a[k+6>>0];a[D+7>>0]=a[k+7>>0];h[k>>3]=M;a[E>>0]=a[k>>0];a[E+1>>0]=a[k+1>>0];a[E+2>>0]=a[k+2>>0];a[E+3>>0]=a[k+3>>0];a[E+4>>0]=a[k+4>>0];a[E+5>>0]=a[k+5>>0];a[E+6>>0]=a[k+6>>0];a[E+7>>0]=a[k+7>>0];h[k>>3]=L;a[F>>0]=a[k>>0];a[F+1>>0]=a[k+1>>0];a[F+2>>0]=a[k+2>>0];a[F+3>>0]=a[k+3>>0];a[F+4>>0]=a[k+4>>0];a[F+5>>0]=a[k+5>>0];a[F+6>>0]=a[k+6>>0];a[F+7>>0]=a[k+7>>0];h[k>>3]=K;a[G>>0]=a[k>>0];a[G+1>>0]=a[k+1>>0];a[G+2>>0]=a[k+2>>0];a[G+3>>0]=a[k+3>>0];a[G+4>>0]=a[k+4>>0];a[G+5>>0]=a[k+5>>0];a[G+6>>0]=a[k+6>>0];a[G+7>>0]=a[k+7>>0];h[k>>3]=J;a[H>>0]=a[k>>0];a[H+1>>0]=a[k+1>>0];a[H+2>>0]=a[k+2>>0];a[H+3>>0]=a[k+3>>0];a[H+4>>0]=a[k+4>>0];a[H+5>>0]=a[k+5>>0];a[H+6>>0]=a[k+6>>0];a[H+7>>0]=a[k+7>>0];if((a[6368]|0)==0?(Qa(6368)|0)!=0:0){c[1588]=0;c[6356>>2]=0;c[6360>>2]=0;cc(209,6352,p|0)|0;$a(6368)}if((a[6400]|0)==0?(Qa(6400)|0)!=0:0){cc(210,6376,p|0)|0;$a(6400)}w=c[1588]|0;v=c[6356>>2]|0;do{if((w|0)==(v|0)){v=$b(6376)|0;if((v|0)!=0){b=Xa(16)|0;do{if((a[10120]|0)==0){if((Qa(10120)|0)==0){break}c[2528]=10384;$a(10120)}}while(0);Yf(b,v,10112,10472);wb(b|0,10184,109)}x=c[1588]|0;do{if((x|0)==(c[6356>>2]|0)){v=f+16|0;c[v>>2]=f;c[f>>2]=6416;w=c[6360>>2]|0;do{if(x>>>0<w>>>0){if((x|0)==0){w=0}else{c[x+16>>2]=x;w=c[v>>2]|0;mc[c[(c[w>>2]|0)+12>>2]&127](w,x);w=c[6356>>2]|0}c[6356>>2]=w+24}else{w=(w-x|0)/24|0;if(w>>>0<89478485){w=w<<1;w=(w|0)==0?1:w}else{w=178956970}x=w*24|0;x=(x|0)==0?1:x;while(1){y=un(x)|0;if((y|0)!=0){break}y=c[5666]|0;c[5666]=y+0;if((y|0)==0){l=65;break}sc[y&31]()}if((l|0)==65){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}w=y+(w*24|0)|0;do{if((y|0)!=0){x=c[v>>2]|0;if((x|0)==0){c[y+16>>2]=0;break}if((x|0)==(f|0)){c[y+16>>2]=y;mc[c[(c[f>>2]|0)+12>>2]&127](f,y);break}else{c[y+16>>2]=x;c[v>>2]=0;break}}}while(0);x=y+24|0;z=c[1588]|0;A=c[6356>>2]|0;do{if((A|0)==(z|0)){c[1588]=y;c[6356>>2]=x;c[6360>>2]=w}else{do{C=y;y=y+ -24|0;B=A+ -8|0;A=A+ -24|0;D=c[B>>2]|0;do{if((D|0)!=0){if((D|0)==(A|0)){c[C+ -8>>2]=y;H=c[B>>2]|0;mc[c[(c[H>>2]|0)+12>>2]&127](H,y);break}else{c[C+ -8>>2]=D;c[B>>2]=0;break}}else{c[C+ -8>>2]=0}}while(0)}while((A|0)!=(z|0));z=c[1588]|0;A=c[6356>>2]|0;c[1588]=y;c[6356>>2]=x;c[6360>>2]=w;if((A|0)==(z|0)){break}do{w=c[A+ -8>>2]|0;A=A+ -24|0;do{if((w|0)==(A|0)){lc[c[(c[w>>2]|0)+16>>2]&255](w)}else{if((w|0)==0){break}lc[c[(c[w>>2]|0)+20>>2]&255](w)}}while(0)}while((A|0)!=(z|0))}}while(0);if((z|0)==0){break}vn(z)}}while(0);v=c[v>>2]|0;if((v|0)==(f|0)){lc[c[(c[f>>2]|0)+16>>2]&255](f);break}if((v|0)==0){break}lc[c[(c[v>>2]|0)+20>>2]&255](v)}}while(0);if((Cb(6376)|0)==0){t=c[1588]|0;r=c[6356>>2]|0;break}Wa(10496,10504,46,10560)}else{t=w;r=v}}while(0);b:do{if((t|0)!=(r|0)){v=s+16|0;while(1){x=t+16|0;w=c[x>>2]|0;if((w|0)==0){l=101;break}if((w|0)==(t|0)){c[v>>2]=s;w=c[x>>2]|0;mc[c[(c[w>>2]|0)+12>>2]&127](w,s);w=c[v>>2]|0}else{w=oc[c[(c[w>>2]|0)+8>>2]&127](w)|0;c[v>>2]=w}if((w|0)==0){break}mc[c[(c[w>>2]|0)+24>>2]&127](w,u);w=c[v>>2]|0;do{if((w|0)==(s|0)){lc[c[(c[s>>2]|0)+16>>2]&255](s)}else{if((w|0)==0){break}lc[c[(c[w>>2]|0)+20>>2]&255](w)}}while(0);t=t+24|0;if((t|0)==(r|0)){break b}}if((l|0)==101){c[v>>2]=0}H=Xa(4)|0;c[H>>2]=6336;wb(H|0,6312,76)}}while(0);s=Sc(8352,5304)|0;r=c[s+((c[(c[s>>2]|0)+ -12>>2]|0)+28)>>2]|0;t=r+4|0;c[t>>2]=(c[t>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}u=(c[13460>>2]|0)+ -1|0;v=c[r+8>>2]|0;if((c[r+12>>2]|0)-v>>2>>>0>u>>>0?(q=c[v+(u<<2)>>2]|0,(q|0)!=0):0){q=xc[c[(c[q>>2]|0)+28>>2]&63](q,10)|0;H=c[t>>2]|0;c[t>>2]=H+ -1;if((H|0)==0){lc[c[(c[r>>2]|0)+8>>2]&255](r)}lh(s,q);Yg(s);r=c[b>>2]|0;q=b+114|0;q=d[q>>0]|d[q+1>>0]<<8;H=c[r+4>>2]|0;G=((H|0)<0)<<31>>31;if(0<(G|0)|0==(G|0)&(q&65535)>>>0<H>>>0){c[r+8>>2]=q&65535}else{a[r+12>>0]=1}r=b+120|0;c:do{if((d[r>>0]|d[r+1>>0]<<8|d[r+2>>0]<<16|d[r+3>>0]<<24|0)!=0){w=o+2|0;u=o+16|0;t=o+18|0;q=o+20|0;x=f+4|0;v=f+8|0;s=0;while(1){G=(c[b>>2]|0)+12|0;H=a[G>>0]|0;a[G>>0]=0;if(!(H<<24>>24==0)){break c}y=c[b>>2]|0;z=y+13|0;if((a[z>>0]|0)!=0){break c}H=y+4|0;E=y+8|0;G=c[E>>2]|0;F=(c[H>>2]|0)-G|0;F=(F|0)<54?F:54;Mn(o|0,(c[y>>2]|0)+G|0,F|0)|0;G=(c[E>>2]|0)+F|0;c[E>>2]=G;c[y+16>>2]=F;if((G|0)>=(c[H>>2]|0)){a[z>>0]=1}y=Sc(8352,5872)|0;z=c[y+((c[(c[y>>2]|0)+ -12>>2]|0)+28)>>2]|0;A=z+4|0;c[A>>2]=(c[A>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[x>>2]=208;c[v>>2]=0;cg(13456,f)}C=(c[13460>>2]|0)+ -1|0;B=c[z+8>>2]|0;if(!((c[z+12>>2]|0)-B>>2>>>0>C>>>0)){l=136;break}B=c[B+(C<<2)>>2]|0;if((B|0)==0){l=136;break}B=xc[c[(c[B>>2]|0)+28>>2]&63](B,10)|0;H=c[A>>2]|0;c[A>>2]=H+ -1;if((H|0)==0){lc[c[(c[z>>2]|0)+8>>2]&255](z)}lh(y,B);Yg(y);y=w;z=5856;while(1){if((a[y>>0]|0)!=(a[z>>0]|0)){break}y=y+1|0;if((y|0)==(u|0)){l=144;break}else{z=z+1|0}}if((l|0)==144?(l=0,(d[t>>0]|d[t+1>>0]<<8)<<16>>16==22204):0){break}A=c[b>>2]|0;y=A+8|0;z=c[y>>2]|0;z=In(z|0,((z|0)<0)<<31>>31|0,(d[q>>0]|d[q+1>>0]<<8)&65535|0,0)|0;H=I;G=c[A+4>>2]|0;F=((G|0)<0)<<31>>31;A=A+12|0;if((H|0)>(F|0)|(H|0)==(F|0)&z>>>0>=G>>>0|(H|0)<0){a[A>>0]=1}else{a[A>>0]=0;c[y>>2]=z}s=s+1|0;if(!(s>>>0<(d[r>>0]|d[r+1>>0]<<8|d[r+2>>0]<<16|d[r+3>>0]<<24)>>>0)){break c}}if((l|0)==136){H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}r=Sc(8352,5896)|0;s=c[r+((c[(c[r>>2]|0)+ -12>>2]|0)+28)>>2]|0;t=s+4|0;c[t>>2]=(c[t>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}u=(c[13460>>2]|0)+ -1|0;v=c[s+8>>2]|0;do{if((c[s+12>>2]|0)-v>>2>>>0>u>>>0){u=c[v+(u<<2)>>2]|0;if((u|0)==0){break}u=xc[c[(c[u>>2]|0)+28>>2]&63](u,10)|0;H=c[t>>2]|0;c[t>>2]=H+ -1;if((H|0)==0){lc[c[(c[s>>2]|0)+8>>2]&255](s)}lh(r,u);Yg(r);r=d[q>>0]|d[q+1>>0]<<8;q=r&65535;r=r<<16>>16==0?1:q;while(1){s=un(r)|0;if((s|0)!=0){break}s=c[5666]|0;c[5666]=s+0;if((s|0)==0){l=158;break}sc[s&31]()}if((l|0)==158){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}t=c[b>>2]|0;r=t+13|0;do{if((a[r>>0]|0)==0){H=t+4|0;E=t+8|0;G=c[E>>2]|0;F=(c[H>>2]|0)-G|0;F=(F|0)<(q|0)?F:q;Mn(s|0,(c[t>>2]|0)+G|0,F|0)|0;G=(c[E>>2]|0)+F|0;c[E>>2]=G;c[t+16>>2]=F;if((G|0)<(c[H>>2]|0)){break}a[r>>0]=1}else{a[t+12>>0]=1}}while(0);t=s+34|0;q=b+247|0;Mn(q|0,s|0,34)|0;if(!((d[q>>0]|d[q+1>>0]<<8)<<16>>16==2)){g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(68)|0;if((b|0)!=0){l=171;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==171){c[b+4>>2]=55;c[b>>2]=55;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=6200|0;e=f+56|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=6264;wb(g|0,6096,74)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}r=Sc(8352,6112)|0;q=hh(r,d[q>>0]|d[q+1>>0]<<8)|0;r=c[q+((c[(c[q>>2]|0)+ -12>>2]|0)+28)>>2]|0;u=r+4|0;c[u>>2]=(c[u>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}v=(c[13460>>2]|0)+ -1|0;w=c[r+8>>2]|0;do{if((c[r+12>>2]|0)-w>>2>>>0>v>>>0){v=c[w+(v<<2)>>2]|0;if((v|0)==0){break}v=xc[c[(c[v>>2]|0)+28>>2]&63](v,10)|0;H=c[u>>2]|0;c[u>>2]=H+ -1;if((H|0)==0){lc[c[(c[r>>2]|0)+8>>2]&255](r)}lh(q,v);Yg(q);v=Sc(8352,6128)|0;q=b+279|0;v=hh(v,d[q>>0]|d[q+1>>0]<<8)|0;r=c[v+((c[(c[v>>2]|0)+ -12>>2]|0)+28)>>2]|0;u=r+4|0;c[u>>2]=(c[u>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}w=(c[13460>>2]|0)+ -1|0;x=c[r+8>>2]|0;do{if((c[r+12>>2]|0)-x>>2>>>0>w>>>0){w=c[x+(w<<2)>>2]|0;if((w|0)==0){break}w=xc[c[(c[w>>2]|0)+28>>2]&63](w,10)|0;H=c[u>>2]|0;c[u>>2]=H+ -1;if((H|0)==0){lc[c[(c[r>>2]|0)+8>>2]&255](r)}lh(v,w);Yg(v);r=((d[q>>0]|d[q+1>>0]<<8)&65535)*6|0;r=(r|0)==0?1:r;while(1){u=un(r)|0;if((u|0)!=0){break}u=c[5666]|0;c[5666]=u+0;if((u|0)==0){l=194;break}sc[u&31]()}if((l|0)==194){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}r=b+281|0;a[r>>0]=u;a[r+1>>0]=u>>8;a[r+2>>0]=u>>16;a[r+3>>0]=u>>24;u=Sc(8352,6144)|0;v=c[u+((c[(c[u>>2]|0)+ -12>>2]|0)+28)>>2]|0;w=v+4|0;c[w>>2]=(c[w>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}x=(c[13460>>2]|0)+ -1|0;y=c[v+8>>2]|0;do{if((c[v+12>>2]|0)-y>>2>>>0>x>>>0){x=c[y+(x<<2)>>2]|0;if((x|0)==0){break}x=xc[c[(c[x>>2]|0)+28>>2]&63](x,10)|0;H=c[w>>2]|0;c[w>>2]=H+ -1;if((H|0)==0){lc[c[(c[v>>2]|0)+8>>2]&255](v)}lh(u,x);Yg(u);d:do{if(!((d[q>>0]|d[q+1>>0]<<8)<<16>>16==0)){v=f+4|0;u=f+8|0;w=0;while(1){Mn((d[r>>0]|d[r+1>>0]<<8|d[r+2>>0]<<16|d[r+3>>0]<<24)+(w*6|0)|0,t|0,6)|0;z=ih(Sc(8352,6176)|0,w)|0;y=c[z+((c[(c[z>>2]|0)+ -12>>2]|0)+28)>>2]|0;x=y+4|0;c[x>>2]=(c[x>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[v>>2]=208;c[u>>2]=0;cg(13456,f)}A=(c[13460>>2]|0)+ -1|0;B=c[y+8>>2]|0;if(!((c[y+12>>2]|0)-B>>2>>>0>A>>>0)){break}A=c[B+(A<<2)>>2]|0;if((A|0)==0){break}A=xc[c[(c[A>>2]|0)+28>>2]&63](A,10)|0;H=c[x>>2]|0;c[x>>2]=H+ -1;if((H|0)==0){lc[c[(c[y>>2]|0)+8>>2]&255](y)}lh(z,A);Yg(z);w=w+1|0;if((w|0)>=((d[q>>0]|d[q+1>>0]<<8)&65535|0)){break d}else{t=t+6|0}}H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);vn(s);e:do{if(!((d[q>>0]|d[q+1>>0]<<8)<<16>>16==0)){w=b+304|0;v=b+308|0;x=b+300|0;u=f+4|0;t=f+8|0;s=0;f:while(1){y=Sc(8352,5968)|0;A=c[y+((c[(c[y>>2]|0)+ -12>>2]|0)+28)>>2]|0;z=A+4|0;c[z>>2]=(c[z>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[u>>2]=208;c[t>>2]=0;cg(13456,f)}B=(c[13460>>2]|0)+ -1|0;C=c[A+8>>2]|0;if(!((c[A+12>>2]|0)-C>>2>>>0>B>>>0)){l=234;break}B=c[C+(B<<2)>>2]|0;if((B|0)==0){l=234;break}B=xc[c[(c[B>>2]|0)+28>>2]&63](B,10)|0;H=c[z>>2]|0;c[z>>2]=H+ -1;if((H|0)==0){lc[c[(c[A>>2]|0)+8>>2]&255](A)}lh(y,B);Yg(y);A=d[r>>0]|d[r+1>>0]<<8|d[r+2>>0]<<16|d[r+3>>0]<<24;y=A+(s*6|0)|0;y=(d[y>>0]|d[y+1>>0]<<8)&65535;z=A+(s*6|0)+2|0;z=(d[z>>0]|d[z+1>>0]<<8)&65535;A=A+(s*6|0)+4|0;A=(d[A>>0]|d[A+1>>0]<<8)&65535;C=c[w>>2]|0;do{if((C|0)==(c[v>>2]|0)){B=c[x>>2]|0;E=C-B|0;C=(E|0)/12|0;D=C+1|0;if(D>>>0>357913941){l=244;break f}if(C>>>0<178956970){F=C<<1;F=F>>>0<D>>>0?D:F;if((F|0)==0){F=0;G=0}else{l=247}}else{F=357913941;l=247}if((l|0)==247){l=0;H=F*12|0;H=(H|0)==0?1:H;while(1){G=un(H)|0;if((G|0)!=0){break}G=c[5666]|0;c[5666]=G+0;if((G|0)==0){l=251;break f}sc[G&31]()}}H=G+(C*12|0)|0;if((H|0)!=0){c[H>>2]=y;c[G+(C*12|0)+4>>2]=z;c[G+(C*12|0)+8>>2]=A}H=G+((((E|0)/-12|0)+C|0)*12|0)|0;Ln(H|0,B|0,E|0)|0;c[x>>2]=H;c[w>>2]=G+(D*12|0);c[v>>2]=G+(F*12|0);if((B|0)==0){break}vn(B)}else{if((C|0)==0){y=0}else{c[C>>2]=y;c[C+4>>2]=z;c[C+8>>2]=A;y=c[w>>2]|0}c[w>>2]=y+12}}while(0);s=s+1|0;if((s|0)>=((d[q>>0]|d[q+1>>0]<<8)&65535|0)){break e}}if((l|0)==234){H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}else if((l|0)==244){Tk()}else if((l|0)==251){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}}}while(0);s=Sc(8352,5320)|0;r=c[s+((c[(c[s>>2]|0)+ -12>>2]|0)+28)>>2]|0;q=r+4|0;c[q>>2]=(c[q>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}u=(c[13460>>2]|0)+ -1|0;t=c[r+8>>2]|0;do{if((c[r+12>>2]|0)-t>>2>>>0>u>>>0){t=c[t+(u<<2)>>2]|0;if((t|0)==0){break}t=xc[c[(c[t>>2]|0)+28>>2]&63](t,10)|0;H=c[q>>2]|0;c[q>>2]=H+ -1;if((H|0)==0){lc[c[(c[r>>2]|0)+8>>2]&255](r)}lh(s,t);Yg(s);r=c[b>>2]|0;q=b+116|0;s=d[q>>0]|d[q+1>>0]<<8|d[q+2>>0]<<16|d[q+3>>0]<<24;H=c[r+4>>2]|0;G=((H|0)<0)<<31>>31;if(0<(G|0)|0==(G|0)&s>>>0<H>>>0){c[r+8>>2]=s}else{a[r+12>>0]=1}s=o;c[s>>2]=0;c[s+4>>2]=0;s=c[b>>2]|0;r=s+13|0;do{if((a[r>>0]|0)==0){H=c[s+4>>2]|0;E=s+8|0;G=c[E>>2]|0;F=H-G|0;F=(F|0)<8?F:8;Ln(o|0,(c[s>>2]|0)+G|0,F|0)|0;G=G+F|0;c[E>>2]=G;c[s+16>>2]=F;if((G|0)<(H|0)){break}a[r>>0]=1}else{a[s+12>>0]=1}}while(0);G=(c[b>>2]|0)+12|0;H=a[G>>0]|0;a[G>>0]=0;if(!(H<<24>>24==0)){g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(56)|0;if((b|0)!=0){l=282;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==282){c[b+4>>2]=43;c[b>>2]=43;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=5784|0;e=f+44|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=5840;wb(g|0,5384,70)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}s=c[o>>2]|0;o=c[o+4>>2]|0;if((s|0)==-1&(o|0)==-1){g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(67)|0;if((b|0)!=0){l=290;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==290){c[b+4>>2]=54;c[b>>2]=54;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=5400|0;e=f+55|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=5768;wb(g|0,5488,68)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}r=c[b>>2]|0;H=c[r+4>>2]|0;G=((H|0)<0)<<31>>31;if((o|0)<(G|0)|(o|0)==(G|0)&s>>>0<H>>>0){c[r+8>>2]=s}else{a[r+12>>0]=1}G=(c[b>>2]|0)+12|0;H=a[G>>0]|0;a[G>>0]=0;if(!(H<<24>>24==0)){g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(56)|0;if((b|0)!=0){l=301;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==301){c[b+4>>2]=43;c[b>>2]=43;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=5784|0;e=f+44|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=5840;wb(g|0,5384,70)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}o=c[b>>2]|0;r=o+13|0;do{if((a[r>>0]|0)==0){H=c[o+4>>2]|0;E=o+8|0;G=c[E>>2]|0;F=H-G|0;F=(F|0)<8?F:8;Ln(n|0,(c[o>>2]|0)+G|0,F|0)|0;G=G+F|0;c[E>>2]=G;c[o+16>>2]=F;if((G|0)<(H|0)){break}a[r>>0]=1}else{a[o+12>>0]=1}}while(0);G=(c[b>>2]|0)+12|0;H=a[G>>0]|0;a[G>>0]=0;if(!(H<<24>>24==0)){g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(56)|0;if((b|0)!=0){l=313;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==313){c[b+4>>2]=43;c[b>>2]=43;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=5784|0;e=f+44|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=5840;wb(g|0,5384,70)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}if((c[n>>2]|0)!=0){g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(54)|0;if((b|0)!=0){l=321;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==321){c[b+4>>2]=41;c[b>>2]=41;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=5688|0;e=f+42|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=5744;wb(g|0,5544,66)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}o=b+288|0;s=c[o>>2]|0;r=b+292|0;t=c[r>>2]|0;if((t|0)==(s|0)){w=s}else{w=t+(~((t+ -8+(0-s)|0)>>>3)<<3)|0;c[r>>2]=w}H=b+259|0;if((d[H>>0]|d[H+1>>0]<<8|d[H+2>>0]<<16|d[H+3>>0]<<24|0)==-1){g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(96)|0;if((b|0)!=0){l=331;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==331){c[b+4>>2]=83;c[b>>2]=83;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=5560|0;e=f+84|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=5768;wb(g|0,5488,68)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}v=n+4|0;n=c[v>>2]|0;u=n+1|0;z=s;t=w-z>>3;do{if(t>>>0<u>>>0){u=u-t|0;t=b+296|0;A=c[t>>2]|0;x=w;if(!(A-x>>3>>>0<u>>>0)){t=u;l=w;while(1){if((l|0)!=0){H=l;c[H>>2]=0;c[H+4>>2]=0}t=t+ -1|0;if((t|0)==0){break}else{l=l+8|0}}c[r>>2]=w+(u<<3);break}x=x-z|0;y=x>>3;w=y+u|0;if(w>>>0>536870911){Tk()}z=A-z|0;if(z>>3>>>0<268435455){z=z>>2;z=z>>>0<w>>>0?w:z;if((z|0)==0){z=0;B=0}else{l=342}}else{z=536870911;l=342}do{if((l|0)==342){A=z<<3;A=(A|0)==0?1:A;while(1){B=un(A)|0;if((B|0)!=0){l=348;break}B=c[5666]|0;c[5666]=B+0;if((B|0)==0){break}sc[B&31]()}if((l|0)==348){break}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}}while(0);l=B+(y<<3)|0;while(1){if((l|0)!=0){H=l;c[H>>2]=0;c[H+4>>2]=0}u=u+ -1|0;if((u|0)==0){break}else{l=l+8|0}}Ln(B|0,s|0,x|0)|0;c[o>>2]=B;c[r>>2]=B+(w<<3);c[t>>2]=B+(z<<3);if((s|0)==0){s=B;break}vn(s);s=c[o>>2]|0}else{if(!(t>>>0>u>>>0)){break}l=s+(u<<3)|0;if((w|0)==(l|0)){break}c[r>>2]=w+(~((w+ -8+(0-l)|0)>>>3)<<3)}}while(0);l=d[q>>0]|d[q+1>>0]<<8|d[q+2>>0]<<16|d[q+3>>0]<<24;H=s;c[H>>2]=l+8;c[H+4>>2]=0;g:do{if(n>>>0>1){c[m>>2]=c[b>>2];c[m+4>>2]=0;c[m+8>>2]=0;l=m+12|0;s=un(1048644)|0;y=s+68&-64;c[y+ -4>>2]=s;c[l>>2]=y;c[j>>2]=m;y=j+4|0;c[y>>2]=0;c[j+8>>2]=-1;c[g+4>>2]=32;c[g+8>>2]=2;c[g+12>>2]=8;c[g+16>>2]=0;s=g+36|0;c[s>>2]=0;n=g+40|0;c[n>>2]=0;c[g+44>>2]=0;c[g+60>>2]=1;c[g+64>>2]=2;c[g+56>>2]=4096;c[g+52>>2]=4;c[g+48>>2]=4;u=g+68|0;c[u>>2]=0;t=g+72|0;c[t>>2]=0;c[g+76>>2]=0;c[g+20>>2]=32;w=g+24|0;c[w>>2]=0;c[g+28>>2]=-2147483648;c[g+32>>2]=2147483647;c[g>>2]=0;H=md(m)|0;G=md(m)|0;x=md(m)|0;c[y>>2]=(G&255)<<16|(H&255)<<24|(x&255)<<8|(md(m)|0)&255;td(g);y=Sc(8352,5648)|0;m=c[v>>2]|0;y=jh(y,m)|0;x=c[y+((c[(c[y>>2]|0)+ -12>>2]|0)+28)>>2]|0;v=x+4|0;c[v>>2]=(c[v>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}A=(c[13460>>2]|0)+ -1|0;z=c[x+8>>2]|0;do{if((c[x+12>>2]|0)-z>>2>>>0>A>>>0){z=c[z+(A<<2)>>2]|0;if((z|0)==0){break}z=xc[c[(c[z>>2]|0)+28>>2]&63](z,10)|0;H=c[v>>2]|0;c[v>>2]=H+ -1;if((H|0)==0){lc[c[(c[x>>2]|0)+8>>2]&255](x)}lh(y,z);Yg(y);h:do{if((m|0)!=0){x=f+4|0;v=f+8|0;y=1;while(1){if(y>>>0>1){z=c[(c[o>>2]|0)+(y+ -1<<3)>>2]|0}else{z=0}A=(rd(g,j,(c[s>>2]|0)+44|0)|0)+z|0;z=c[w>>2]|0;if((A|0)<0){z=z+A|0}else{z=A-(A>>>0<z>>>0?0:z)|0}A=(c[o>>2]|0)+(y<<3)|0;c[A>>2]=z;c[A+4>>2]=((z|0)<0)<<31>>31;A=Sc(jh(Sc(8352,5672)|0,y)|0,5680)|0;z=(c[o>>2]|0)+(y<<3)|0;z=kh(A,c[z>>2]|0,c[z+4>>2]|0)|0;A=c[z+((c[(c[z>>2]|0)+ -12>>2]|0)+28)>>2]|0;B=A+4|0;c[B>>2]=(c[B>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[x>>2]=208;c[v>>2]=0;cg(13456,f)}C=(c[13460>>2]|0)+ -1|0;D=c[A+8>>2]|0;if(!((c[A+12>>2]|0)-D>>2>>>0>C>>>0)){break}C=c[D+(C<<2)>>2]|0;if((C|0)==0){break}C=xc[c[(c[C>>2]|0)+28>>2]&63](C,10)|0;H=c[B>>2]|0;c[B>>2]=H+ -1;if((H|0)==0){lc[c[(c[A>>2]|0)+8>>2]&255](A)}lh(z,C);Yg(z);y=y+1|0;if(y>>>0>m>>>0){break h}}H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);v=c[o>>2]|0;i:do{if((c[r>>2]|0)-v>>3>>>0>1){j=f+4|0;g=f+8|0;m=1;while(1){w=v+(m+ -1<<3)|0;v=v+(m<<3)|0;x=v;w=In(c[x>>2]|0,c[x+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;c[v>>2]=w;c[v+4>>2]=I;v=Sc(jh(Sc(8352,5672)|0,m)|0,5680)|0;w=(c[o>>2]|0)+(m<<3)|0;w=kh(v,c[w>>2]|0,c[w+4>>2]|0)|0;v=c[w+((c[(c[w>>2]|0)+ -12>>2]|0)+28)>>2]|0;x=v+4|0;c[x>>2]=(c[x>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[j>>2]=208;c[g>>2]=0;cg(13456,f)}z=(c[13460>>2]|0)+ -1|0;y=c[v+8>>2]|0;if(!((c[v+12>>2]|0)-y>>2>>>0>z>>>0)){break}y=c[y+(z<<2)>>2]|0;if((y|0)==0){break}y=xc[c[(c[y>>2]|0)+28>>2]&63](y,10)|0;H=c[x>>2]|0;c[x>>2]=H+ -1;if((H|0)==0){lc[c[(c[v>>2]|0)+8>>2]&255](v)}lh(w,y);Yg(w);m=m+1|0;v=c[o>>2]|0;if(!(m>>>0<(c[r>>2]|0)-v>>3>>>0)){break i}}H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);f=c[u>>2]|0;do{if((f|0)!=0){g=c[t>>2]|0;if((g|0)!=(f|0)){do{c[t>>2]=g+ -44;j=c[g+ -36>>2]|0;if((j|0)!=0){vn(c[j+ -4>>2]|0)}j=c[g+ -32>>2]|0;if((j|0)!=0){vn(c[j+ -4>>2]|0)}g=c[g+ -28>>2]|0;if((g|0)!=0){vn(c[g+ -4>>2]|0)}g=c[t>>2]|0}while((g|0)!=(f|0));f=c[u>>2]|0;if((f|0)==0){break}}vn(f)}}while(0);f=c[s>>2]|0;do{if((f|0)!=0){g=c[n>>2]|0;if((g|0)!=(f|0)){do{c[n>>2]=g+ -44;j=c[g+ -36>>2]|0;if((j|0)!=0){vn(c[j+ -4>>2]|0)}j=c[g+ -32>>2]|0;if((j|0)!=0){vn(c[j+ -4>>2]|0)}g=c[g+ -28>>2]|0;if((g|0)!=0){vn(c[g+ -4>>2]|0)}g=c[n>>2]|0}while((g|0)!=(f|0));f=c[s>>2]|0;if((f|0)==0){break}}vn(f)}}while(0);vn(c[(c[l>>2]|0)+ -4>>2]|0);l=d[q>>0]|d[q+1>>0]<<8|d[q+2>>0]<<16|d[q+3>>0]<<24;break g}}while(0);H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);f=c[b>>2]|0;a[f+12>>0]=0;a[f+13>>0]=0;f=c[b>>2]|0;g=l+8|0;H=c[f+4>>2]|0;G=((H|0)<0)<<31>>31;if(0<(G|0)|0==(G|0)&g>>>0<H>>>0){c[f+8>>2]=g;H=b+12|0;c[H>>2]=0;H=b+8|0;c[H>>2]=0;i=e;return}else{a[f+12>>0]=1;H=b+12|0;c[H>>2]=0;H=b+8|0;c[H>>2]=0;i=e;return}}}while(0);H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}}while(0);g=Xa(8)|0;c[g>>2]=9928;while(1){b=un(56)|0;if((b|0)!=0){l=229;break}b=c[5666]|0;c[5666]=b+0;if((b|0)==0){break}sc[b&31]()}if((l|0)==229){c[b+4>>2]=43;c[b>>2]=43;f=b+12|0;c[g+4>>2]=f;c[b+8>>2]=0;f=f+0|0;b=5984|0;e=f+44|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));c[g>>2]=6040;wb(g|0,5952,72)}H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}function pe(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;b=i;i=i+16|0;f=b;g=Sc(8352,5192)|0;h=c[g+((c[(c[g>>2]|0)+ -12>>2]|0)+28)>>2]|0;j=h+4|0;c[j>>2]=(c[j>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}l=(c[13460>>2]|0)+ -1|0;m=c[h+8>>2]|0;if((c[h+12>>2]|0)-m>>2>>>0>l>>>0?(k=c[m+(l<<2)>>2]|0,(k|0)!=0):0){k=xc[c[(c[k>>2]|0)+28>>2]&63](k,10)|0;m=c[j>>2]|0;c[j>>2]=m+ -1;if((m|0)==0){lc[c[(c[h>>2]|0)+8>>2]&255](h)}lh(g,k);Yg(g);g=a+34|0;g=d[g>>0]|d[g+1>>0]<<8|d[g+2>>0]<<16|d[g+3>>0]<<24;if((g|0)!=0){vn(g)}g=Sc(8352,5208)|0;h=c[g+((c[(c[g>>2]|0)+ -12>>2]|0)+28)>>2]|0;j=h+4|0;c[j>>2]=(c[j>>2]|0)+1;if(!((c[3364]|0)==-1)){c[f>>2]=13456;c[f+4>>2]=208;c[f+8>>2]=0;cg(13456,f)}f=(c[13460>>2]|0)+ -1|0;a=c[h+8>>2]|0;if((c[h+12>>2]|0)-a>>2>>>0>f>>>0?(e=c[a+(f<<2)>>2]|0,(e|0)!=0):0){e=xc[c[(c[e>>2]|0)+28>>2]&63](e,10)|0;m=c[j>>2]|0;c[j>>2]=m+ -1;if((m|0)==0){lc[c[(c[h>>2]|0)+8>>2]&255](h)}lh(g,e);Yg(g);i=b;return}m=Xa(4)|0;c[m>>2]=21304;wb(m|0,21376,196)}m=Xa(4)|0;c[m>>2]=21304;wb(m|0,21376,196)}function qe(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function re(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function se(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function te(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function ue(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function ve(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function we(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function xe(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function ye(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function ze(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function Ae(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function Be(a){a=a|0;var b=0;b=i;Rb(a|0);i=b;return}function Ce(a){a=a|0;var b=0;b=i;Rb(a|0);if((a|0)!=0){vn(a)}i=b;return}function De(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=i;d=c[a>>2]|0;if((d|0)==0){i=b;return}e=a+4|0;f=c[e>>2]|0;if((f|0)!=(d|0)){do{g=f+ -24|0;c[e>>2]=g;f=c[f+ -8>>2]|0;if((f|0)!=(g|0)){if((f|0)!=0){lc[c[(c[f>>2]|0)+20>>2]&255](f)}}else{lc[c[(c[f>>2]|0)+16>>2]&255](f)}f=c[e>>2]|0}while((f|0)!=(d|0));d=c[a>>2]|0;if((d|0)==0){i=b;return}}vn(d);i=b;return}function Ee(a){a=a|0;return}function Fe(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Ge(a){a=a|0;var b=0,d=0;a=i;while(1){d=un(8)|0;if((d|0)!=0){b=7;break}d=c[5666]|0;c[5666]=d+0;if((d|0)==0){break}sc[d&31]()}if((b|0)==7){c[d>>2]=6416;i=a;return d|0}d=Xa(4)|0;c[d>>2]=22680;wb(d|0,22728,206);return 0}function He(a,b){a=a|0;b=b|0;if((b|0)!=0){c[b>>2]=6416}return}function Ie(a){a=a|0;return}function Je(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Ke(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0;b=i;j=e+104|0;g=d[j>>0]|0;e=g>>>7;h=g>>>6&1;if(!((e|0)!=1|(h|0)==0)){b=Xa(8)|0;c[b>>2]=9928;while(1){e=un(80)|0;if((e|0)!=0){f=8;break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){break}sc[e&31]()}if((f|0)==8){c[e+4>>2]=67;c[e>>2]=67;g=e+12|0;c[b+4>>2]=g;c[e+8>>2]=0;g=g+0|0;e=6960|0;f=g+68|0;do{a[g>>0]=a[e>>0]|0;g=g+1|0;e=e+1|0}while((g|0)<(f|0));c[b>>2]=7040;wb(b|0,6832,84)}j=Xa(4)|0;c[j>>2]=22680;wb(j|0,22728,206)}if((e|0)!=(h|0)){a[j>>0]=g&63;i=b;return}b=Xa(8)|0;c[b>>2]=9928;while(1){e=un(51)|0;if((e|0)!=0){f=16;break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){break}sc[e&31]()}if((f|0)==16){c[e+4>>2]=38;c[e>>2]=38;g=e+12|0;c[b+4>>2]=g;c[e+8>>2]=0;g=g+0|0;e=6896|0;f=g+39|0;do{a[g>>0]=a[e>>0]|0;g=g+1|0;e=e+1|0}while((g|0)<(f|0));c[b>>2]=6944;wb(b|0,6880,82)}j=Xa(4)|0;c[j>>2]=22680;wb(j|0,22728,206)}function Le(a,b){a=a|0;b=b|0;return((c[b+4>>2]|0)==6688?a+4|0:0)|0}function Me(a){a=a|0;return 6784}function Ne(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function Oe(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function Pe(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function Qe(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function Re(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function Se(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0;b=i;i=i+16|0;h=b;d=Sc(8352,7104)|0;e=c[d+((c[(c[d>>2]|0)+ -12>>2]|0)+28)>>2]|0;f=e+4|0;c[f>>2]=(c[f>>2]|0)+1;if(!((c[3364]|0)==-1)){c[h>>2]=13456;c[h+4>>2]=208;c[h+8>>2]=0;cg(13456,h)}h=(c[13460>>2]|0)+ -1|0;j=c[e+8>>2]|0;if((c[e+12>>2]|0)-j>>2>>>0>h>>>0?(g=c[j+(h<<2)>>2]|0,(g|0)!=0):0){g=xc[c[(c[g>>2]|0)+28>>2]&63](g,10)|0;j=c[f>>2]|0;c[f>>2]=j+ -1;if((j|0)==0){lc[c[(c[e>>2]|0)+8>>2]&255](e)}lh(d,g);Yg(d);d=c[a+324>>2]|0;if(((d|0)!=0?(h=d+4|0,j=c[h>>2]|0,c[h>>2]=j+ -1,(j|0)==0):0)?(lc[c[(c[d>>2]|0)+8>>2]&255](d),h=d+8|0,j=c[h>>2]|0,c[h>>2]=j+ -1,(j|0)==0):0){lc[c[(c[d>>2]|0)+16>>2]&255](d)}d=c[a+316>>2]|0;if(((d|0)!=0?(h=d+4|0,j=c[h>>2]|0,c[h>>2]=j+ -1,(j|0)==0):0)?(lc[c[(c[d>>2]|0)+8>>2]&255](d),h=d+8|0,j=c[h>>2]|0,c[h>>2]=j+ -1,(j|0)==0):0){lc[c[(c[d>>2]|0)+16>>2]&255](d)}d=c[a+300>>2]|0;if((d|0)!=0){e=a+304|0;f=c[e>>2]|0;if((f|0)!=(d|0)){c[e>>2]=f+(~(((f+ -12+(0-d)|0)>>>0)/12|0)*12|0)}vn(d)}d=c[a+288>>2]|0;if((d|0)==0){j=a+247|0;pe(j);j=a+16|0;j=c[j>>2]|0;j=j+ -4|0;j=c[j>>2]|0;vn(j);i=b;return}e=a+292|0;f=c[e>>2]|0;if((f|0)!=(d|0)){c[e>>2]=f+(~((f+ -8+(0-d)|0)>>>3)<<3)}vn(d);j=a+247|0;pe(j);j=a+16|0;j=c[j>>2]|0;j=j+ -4|0;j=c[j>>2]|0;vn(j);i=b;return}j=Xa(4)|0;c[j>>2]=21304;wb(j|0,21376,196)}function Te(a){a=a|0;return}function Ue(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Ve(a){a=a|0;var b=0;b=i;a=c[a+12>>2]|0;if((a|0)==0){i=b;return}Se(a);vn(a);i=b;return}function We(a,b){a=a|0;b=b|0;if((c[b+4>>2]|0)==7312){a=a+12|0}else{a=0}return a|0}function Xe(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Ye(a){a=a|0;return}function Ze(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function _e(a){a=a|0;var b=0;b=i;a=c[a+12>>2]|0;if((a|0)!=0){vn(a)}i=b;return}function $e(a,b){a=a|0;b=b|0;if((c[b+4>>2]|0)==7560){a=a+12|0}else{a=0}return a|0}function af(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function bf(){var b=0,d=0,e=0,f=0,g=0;b=i;i=i+32|0;d=b;Hb(72,96,176,0,152,91,144,0,144,0,8,136,211);c[d>>2]=1;e=d+4|0;c[e>>2]=96;Ob(72,1,e|0,128,92,22);c[d>>2]=4;e=d+4|0;c[e>>2]=21776;c[d+8>>2]=96;c[d+12>>2]=21904;c[d+16>>2]=21904;f=un(8)|0;if((f|0)!=0){a[f>>0]=27;a[f+1>>0]=0;a[f+2>>0]=0;a[f+3>>0]=0;g=f+4|0;a[g>>0]=0;a[g+1>>0]=0;a[g+2>>0]=0;a[g+3>>0]=0}zb(72,16,4,e|0,120,30,f|0,0);c[d>>2]=3;e=d+4|0;c[e>>2]=21776;c[d+8>>2]=96;c[d+12>>2]=21888;f=un(8)|0;if((f|0)!=0){a[f>>0]=66;a[f+1>>0]=0;a[f+2>>0]=0;a[f+3>>0]=0;g=f+4|0;a[g>>0]=0;a[g+1>>0]=0;a[g+2>>0]=0;a[g+3>>0]=0}zb(72,24,3,e|0,112,28,f|0,0);c[d>>2]=2;e=d+4|0;c[e>>2]=21904;c[d+8>>2]=96;d=un(8)|0;if((d|0)==0){zb(72,40,2,e|0,56,46,d|0,0);i=b;return}a[d>>0]=93;a[d+1>>0]=0;a[d+2>>0]=0;a[d+3>>0]=0;g=d+4|0;a[g>>0]=0;a[g+1>>0]=0;a[g+2>>0]=0;a[g+3>>0]=0;zb(72,40,2,e|0,56,46,d|0,0);i=b;return}function cf(a){a=a|0;var b=0,d=0,e=0;b=i;d=c[a+4>>2]|0;e=(Jn(d|0)|0)+1|0;a=un(e)|0;if((a|0)==0){e=0;i=b;return e|0}Ln(a|0,d|0,e|0)|0;e=a;i=b;return e|0}function df(){var a=0;a=i;Ja(21776,7624);pb(21808,7632,1,1,0);Ua(21824,7640,1,-128,127);Ua(21856,7648,1,-128,127);Ua(21840,7664,1,0,255);Ua(21864,7680,2,-32768,32767);Ua(21872,7688,2,0,65535);Ua(21888,7704,4,-2147483648,2147483647);Ua(21904,7712,4,0,-1);Ua(21920,7728,4,-2147483648,2147483647);Ua(21936,7736,4,0,-1);ac(21952,7752,4);ac(21968,7760,8);tb(8240,7768);tb(8152,7784);Jb(8064,4,7824);xb(7944,7840);La(7912,7856);i=a;return}function ef(a){a=a|0;a=i;Yg(8352);Yg(8528);bh(8704);bh(8880);i=a;return}function ff(a){a=a|0;var b=0,d=0,e=0;b=i;c[a>>2]=10728;a=c[a+4>>2]|0;e=a+4|0;d=c[e>>2]|0;c[e>>2]=d+ -1;if((d|0)!=0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function gf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=10728;d=c[a+4>>2]|0;f=d+4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e|0)!=0){vn(a);i=b;return}lc[c[(c[d>>2]|0)+8>>2]&255](d);vn(a);i=b;return}function hf(b,d){b=b|0;d=d|0;var e=0;e=i;oc[c[(c[b>>2]|0)+24>>2]&127](b)|0;d=Yk(c[d>>2]|0,13528)|0;c[b+36>>2]=d;a[b+44>>0]=(oc[c[(c[d>>2]|0)+28>>2]&127](d)|0)&1;i=e;return}function jf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;b=i;i=i+16|0;g=b+8|0;d=b;e=a+36|0;f=a+40|0;h=g+8|0;j=g;a=a+32|0;while(1){k=c[e>>2]|0;k=yc[c[(c[k>>2]|0)+20>>2]&63](k,c[f>>2]|0,g,h,d)|0;l=(c[d>>2]|0)-j|0;if((Zb(g|0,1,l|0,c[a>>2]|0)|0)!=(l|0)){e=-1;d=5;break}if((k|0)==2){e=-1;d=5;break}else if((k|0)!=1){d=4;break}}if((d|0)==4){l=((_a(c[a>>2]|0)|0)!=0)<<31>>31;i=b;return l|0}else if((d|0)==5){i=b;return e|0}return 0}function kf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;f=i;if((a[b+44>>0]|0)!=0){g=Zb(d|0,4,e|0,c[b+32>>2]|0)|0;i=f;return g|0}if((e|0)>0){g=0}else{g=0;i=f;return g|0}while(1){if((xc[c[(c[b>>2]|0)+52>>2]&63](b,c[d>>2]|0)|0)==-1){e=6;break}g=g+1|0;if((g|0)<(e|0)){d=d+4|0}else{e=6;break}}if((e|0)==6){i=f;return g|0}return 0}function lf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=i;i=i+32|0;k=e+16|0;p=e+8|0;j=e+4|0;h=e;f=(d|0)==-1;a:do{if(!f){c[p>>2]=d;if((a[b+44>>0]|0)!=0){if((Zb(p|0,4,1,c[b+32>>2]|0)|0)==1){break}else{d=-1}i=e;return d|0}c[j>>2]=k;l=p+4|0;n=b+36|0;o=b+40|0;g=k+8|0;m=k;b=b+32|0;while(1){q=c[n>>2]|0;q=tc[c[(c[q>>2]|0)+12>>2]&31](q,c[o>>2]|0,p,l,h,k,g,j)|0;if((c[h>>2]|0)==(p|0)){d=-1;g=12;break}if((q|0)==3){g=7;break}r=(q|0)==1;if(!(q>>>0<2)){d=-1;g=12;break}q=(c[j>>2]|0)-m|0;if((Zb(k|0,1,q|0,c[b>>2]|0)|0)!=(q|0)){d=-1;g=12;break}if(r){p=r?c[h>>2]|0:p}else{break a}}if((g|0)==7){if((Zb(p|0,1,1,c[b>>2]|0)|0)==1){break}else{d=-1}i=e;return d|0}else if((g|0)==12){i=e;return d|0}}}while(0);r=f?0:d;i=e;return r|0}function mf(a){a=a|0;var b=0,d=0,e=0;b=i;c[a>>2]=10728;a=c[a+4>>2]|0;e=a+4|0;d=c[e>>2]|0;c[e>>2]=d+ -1;if((d|0)!=0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function nf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=10728;d=c[a+4>>2]|0;f=d+4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e|0)!=0){vn(a);i=b;return}lc[c[(c[d>>2]|0)+8>>2]&255](d);vn(a);i=b;return}function of(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=i;g=Yk(c[d>>2]|0,13528)|0;f=b+36|0;c[f>>2]=g;d=b+44|0;c[d>>2]=oc[c[(c[g>>2]|0)+24>>2]&127](g)|0;f=c[f>>2]|0;a[b+53>>0]=(oc[c[(c[f>>2]|0)+28>>2]&127](f)|0)&1;if((c[d>>2]|0)>8){ok(9544)}else{i=e;return}}function pf(a){a=a|0;var b=0;b=i;a=sf(a,0)|0;i=b;return a|0}function qf(a){a=a|0;var b=0;b=i;a=sf(a,1)|0;i=b;return a|0}function rf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;e=i;i=i+32|0;j=e+16|0;f=e+8|0;l=e+4|0;k=e;g=b+52|0;m=(a[g>>0]|0)!=0;if((d|0)==-1){if(m){m=-1;i=e;return m|0}m=c[b+48>>2]|0;a[g>>0]=(m|0)!=-1&1;i=e;return m|0}h=b+48|0;a:do{if(m){c[l>>2]=c[h>>2];m=c[b+36>>2]|0;k=tc[c[(c[m>>2]|0)+12>>2]&31](m,c[b+40>>2]|0,l,l+4|0,k,j,j+8|0,f)|0;if((k|0)==3){a[j>>0]=c[h>>2];c[f>>2]=j+1}else if((k|0)==1|(k|0)==2){m=-1;i=e;return m|0}b=b+32|0;while(1){k=c[f>>2]|0;if(!(k>>>0>j>>>0)){break a}m=k+ -1|0;c[f>>2]=m;if((Va(a[m>>0]|0,c[b>>2]|0)|0)==-1){f=-1;break}}i=e;return f|0}}while(0);c[h>>2]=d;a[g>>0]=1;m=d;i=e;return m|0}function sf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;e=i;i=i+32|0;g=e+16|0;j=e+8|0;m=e+4|0;l=e;n=b+52|0;if((a[n>>0]|0)!=0){f=b+48|0;g=c[f>>2]|0;if(!d){v=g;i=e;return v|0}c[f>>2]=-1;a[n>>0]=0;v=g;i=e;return v|0}s=c[b+44>>2]|0;s=(s|0)>1?s:1;a:do{if((s|0)>0){p=b+32|0;n=0;while(1){o=Tb(c[p>>2]|0)|0;if((o|0)==-1){h=-1;break}a[g+n>>0]=o;n=n+1|0;if((n|0)>=(s|0)){break a}}i=e;return h|0}}while(0);b:do{if((a[b+53>>0]|0)==0){p=b+40|0;q=b+36|0;n=j+4|0;o=b+32|0;while(1){v=c[p>>2]|0;u=v;t=c[u>>2]|0;u=c[u+4>>2]|0;w=c[q>>2]|0;r=g+s|0;v=tc[c[(c[w>>2]|0)+16>>2]&31](w,v,g,r,m,j,n,l)|0;if((v|0)==3){f=14;break}else if((v|0)==2){h=-1;f=22;break}else if((v|0)!=1){k=s;break b}w=c[p>>2]|0;c[w>>2]=t;c[w+4>>2]=u;if((s|0)==8){h=-1;f=22;break}t=Tb(c[o>>2]|0)|0;if((t|0)==-1){h=-1;f=22;break}a[r>>0]=t;s=s+1|0}if((f|0)==14){c[j>>2]=a[g>>0]|0;k=s;break}else if((f|0)==22){i=e;return h|0}}else{c[j>>2]=a[g>>0]|0;k=s}}while(0);if(d){w=c[j>>2]|0;c[b+48>>2]=w;i=e;return w|0}d=b+32|0;while(1){if((k|0)<=0){break}k=k+ -1|0;if((Va(a[g+k>>0]|0,c[d>>2]|0)|0)==-1){h=-1;f=22;break}}if((f|0)==22){i=e;return h|0}w=c[j>>2]|0;i=e;return w|0}function tf(a){a=a|0;var b=0,d=0,e=0;b=i;c[a>>2]=10664;a=c[a+4>>2]|0;e=a+4|0;d=c[e>>2]|0;c[e>>2]=d+ -1;if((d|0)!=0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function uf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=10664;d=c[a+4>>2]|0;f=d+4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e|0)!=0){vn(a);i=b;return}lc[c[(c[d>>2]|0)+8>>2]&255](d);vn(a);i=b;return}function vf(b,d){b=b|0;d=d|0;var e=0;e=i;oc[c[(c[b>>2]|0)+24>>2]&127](b)|0;d=Yk(c[d>>2]|0,13520)|0;c[b+36>>2]=d;a[b+44>>0]=(oc[c[(c[d>>2]|0)+28>>2]&127](d)|0)&1;i=e;return}function wf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;b=i;i=i+16|0;g=b+8|0;d=b;e=a+36|0;f=a+40|0;h=g+8|0;j=g;a=a+32|0;while(1){k=c[e>>2]|0;k=yc[c[(c[k>>2]|0)+20>>2]&63](k,c[f>>2]|0,g,h,d)|0;l=(c[d>>2]|0)-j|0;if((Zb(g|0,1,l|0,c[a>>2]|0)|0)!=(l|0)){e=-1;d=5;break}if((k|0)==2){e=-1;d=5;break}else if((k|0)!=1){d=4;break}}if((d|0)==4){l=((_a(c[a>>2]|0)|0)!=0)<<31>>31;i=b;return l|0}else if((d|0)==5){i=b;return e|0}return 0}function xf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0;g=i;if((a[b+44>>0]|0)!=0){h=Zb(e|0,1,f|0,c[b+32>>2]|0)|0;i=g;return h|0}if((f|0)>0){h=0}else{h=0;i=g;return h|0}while(1){if((xc[c[(c[b>>2]|0)+52>>2]&63](b,d[e>>0]|0)|0)==-1){f=6;break}h=h+1|0;if((h|0)<(f|0)){e=e+1|0}else{f=6;break}}if((f|0)==6){i=g;return h|0}return 0}function yf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=i;i=i+32|0;k=e+16|0;p=e+8|0;j=e+4|0;h=e;f=(d|0)==-1;a:do{if(!f){a[p>>0]=d;if((a[b+44>>0]|0)!=0){if((Zb(p|0,1,1,c[b+32>>2]|0)|0)==1){break}else{d=-1}i=e;return d|0}c[j>>2]=k;l=p+1|0;n=b+36|0;o=b+40|0;g=k+8|0;m=k;b=b+32|0;while(1){q=c[n>>2]|0;q=tc[c[(c[q>>2]|0)+12>>2]&31](q,c[o>>2]|0,p,l,h,k,g,j)|0;if((c[h>>2]|0)==(p|0)){d=-1;g=12;break}if((q|0)==3){g=7;break}r=(q|0)==1;if(!(q>>>0<2)){d=-1;g=12;break}q=(c[j>>2]|0)-m|0;if((Zb(k|0,1,q|0,c[b>>2]|0)|0)!=(q|0)){d=-1;g=12;break}if(r){p=r?c[h>>2]|0:p}else{break a}}if((g|0)==7){if((Zb(p|0,1,1,c[b>>2]|0)|0)==1){break}else{d=-1}i=e;return d|0}else if((g|0)==12){i=e;return d|0}}}while(0);r=f?0:d;i=e;return r|0}function zf(a){a=a|0;var b=0,d=0,e=0;b=i;c[a>>2]=10664;a=c[a+4>>2]|0;e=a+4|0;d=c[e>>2]|0;c[e>>2]=d+ -1;if((d|0)!=0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function Af(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=10664;d=c[a+4>>2]|0;f=d+4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e|0)!=0){vn(a);i=b;return}lc[c[(c[d>>2]|0)+8>>2]&255](d);vn(a);i=b;return}function Bf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=i;g=Yk(c[d>>2]|0,13520)|0;f=b+36|0;c[f>>2]=g;d=b+44|0;c[d>>2]=oc[c[(c[g>>2]|0)+24>>2]&127](g)|0;f=c[f>>2]|0;a[b+53>>0]=(oc[c[(c[f>>2]|0)+28>>2]&127](f)|0)&1;if((c[d>>2]|0)>8){ok(9544)}else{i=e;return}}function Cf(a){a=a|0;var b=0;b=i;a=Ff(a,0)|0;i=b;return a|0}function Df(a){a=a|0;var b=0;b=i;a=Ff(a,1)|0;i=b;return a|0}function Ef(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;e=i;i=i+32|0;j=e+16|0;f=e+4|0;l=e+8|0;k=e;g=b+52|0;m=(a[g>>0]|0)!=0;if((d|0)==-1){if(m){m=-1;i=e;return m|0}m=c[b+48>>2]|0;a[g>>0]=(m|0)!=-1&1;i=e;return m|0}h=b+48|0;a:do{if(m){a[l>>0]=c[h>>2];m=c[b+36>>2]|0;k=tc[c[(c[m>>2]|0)+12>>2]&31](m,c[b+40>>2]|0,l,l+1|0,k,j,j+8|0,f)|0;if((k|0)==1|(k|0)==2){m=-1;i=e;return m|0}else if((k|0)==3){a[j>>0]=c[h>>2];c[f>>2]=j+1}b=b+32|0;while(1){k=c[f>>2]|0;if(!(k>>>0>j>>>0)){break a}m=k+ -1|0;c[f>>2]=m;if((Va(a[m>>0]|0,c[b>>2]|0)|0)==-1){f=-1;break}}i=e;return f|0}}while(0);c[h>>2]=d;a[g>>0]=1;m=d;i=e;return m|0}function Ff(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;f=i;i=i+32|0;h=f+16|0;j=f+8|0;n=f+4|0;m=f;o=b+52|0;if((a[o>>0]|0)!=0){g=b+48|0;h=c[g>>2]|0;if(!e){w=h;i=f;return w|0}c[g>>2]=-1;a[o>>0]=0;w=h;i=f;return w|0}p=c[b+44>>2]|0;p=(p|0)>1?p:1;a:do{if((p|0)>0){r=b+32|0;o=0;while(1){q=Tb(c[r>>2]|0)|0;if((q|0)==-1){k=-1;break}a[h+o>>0]=q;o=o+1|0;if((o|0)>=(p|0)){break a}}i=f;return k|0}}while(0);b:do{if((a[b+53>>0]|0)==0){r=b+40|0;s=b+36|0;o=j+1|0;q=b+32|0;while(1){w=c[r>>2]|0;v=w;u=c[v>>2]|0;v=c[v+4>>2]|0;x=c[s>>2]|0;t=h+p|0;w=tc[c[(c[x>>2]|0)+16>>2]&31](x,w,h,t,n,j,o,m)|0;if((w|0)==2){k=-1;m=23;break}else if((w|0)==3){m=14;break}else if((w|0)!=1){l=p;break b}x=c[r>>2]|0;c[x>>2]=u;c[x+4>>2]=v;if((p|0)==8){k=-1;m=23;break}u=Tb(c[q>>2]|0)|0;if((u|0)==-1){k=-1;m=23;break}a[t>>0]=u;p=p+1|0}if((m|0)==14){a[j>>0]=a[h>>0]|0;l=p;break}else if((m|0)==23){i=f;return k|0}}else{a[j>>0]=a[h>>0]|0;l=p}}while(0);do{if(!e){e=b+32|0;while(1){if((l|0)<=0){m=21;break}l=l+ -1|0;if((Va(d[h+l>>0]|0,c[e>>2]|0)|0)==-1){k=-1;m=23;break}}if((m|0)==21){g=a[j>>0]|0;break}else if((m|0)==23){i=f;return k|0}}else{g=a[j>>0]|0;c[b+48>>2]=g&255}}while(0);x=g&255;i=f;return x|0}function Gf(){var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;b=i;i=i+16|0;d=b;f=c[r>>2]|0;c[2244]=10664;Xk(8980|0);c[8984>>2]=0;c[8988>>2]=0;c[8992>>2]=0;c[8996>>2]=0;c[9e3>>2]=0;c[9004>>2]=0;c[2244]=9704;c[9008>>2]=f;c[9016>>2]=9032;c[9024>>2]=-1;a[9028>>0]=0;n=c[8980>>2]|0;m=n+4|0;c[m>>2]=(c[m>>2]|0)+1;if(!((c[3380]|0)==-1)){c[d>>2]=13520;c[d+4>>2]=208;c[d+8>>2]=0;cg(13520,d)}l=(c[13524>>2]|0)+ -1|0;k=c[n+8>>2]|0;if((c[n+12>>2]|0)-k>>2>>>0>l>>>0?(j=c[k+(l<<2)>>2]|0,(j|0)!=0):0){c[9012>>2]=j;c[9020>>2]=oc[c[(c[j>>2]|0)+24>>2]&127](j)|0;l=c[9012>>2]|0;a[9029>>0]=(oc[c[(c[l>>2]|0)+28>>2]&127](l)|0)&1;if((c[9020>>2]|0)>8){ok(9544)}l=c[m>>2]|0;c[m>>2]=l+ -1;if((l|0)==0){lc[c[(c[n>>2]|0)+8>>2]&255](n)}c[2066]=10796;c[8272>>2]=10816;c[8268>>2]=0;c[8296>>2]=8976;c[8288>>2]=0;c[8292>>2]=0;c[8276>>2]=4098;c[8284>>2]=0;c[8280>>2]=6;k=8304|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8300|0);c[8344>>2]=0;c[8348>>2]=-1;j=c[s>>2]|0;c[2270]=10664;Xk(9084|0);c[9088>>2]=0;c[9092>>2]=0;c[9096>>2]=0;c[9100>>2]=0;c[9104>>2]=0;c[9108>>2]=0;c[2270]=9592;c[9112>>2]=j;k=c[9084>>2]|0;l=k+4|0;c[l>>2]=(c[l>>2]|0)+1;if(!((c[3380]|0)==-1)){c[d>>2]=13520;c[d+4>>2]=208;c[d+8>>2]=0;cg(13520,d)}m=(c[13524>>2]|0)+ -1|0;n=c[k+8>>2]|0;if((c[k+12>>2]|0)-n>>2>>>0>m>>>0?(h=c[n+(m<<2)>>2]|0,(h|0)!=0):0){n=c[l>>2]|0;c[l>>2]=n+ -1;if((n|0)==0){lc[c[(c[k>>2]|0)+8>>2]&255](k)}c[9116>>2]=h;c[9120>>2]=9040;a[9124>>0]=(oc[c[(c[h>>2]|0)+28>>2]&127](h)|0)&1;c[2088]=10876;c[8356>>2]=10896;c[8380>>2]=9080;c[8372>>2]=0;c[8376>>2]=0;c[8360>>2]=4098;c[8368>>2]=0;c[8364>>2]=6;k=8388|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8384|0);c[8428>>2]=0;c[8432>>2]=-1;h=c[q>>2]|0;c[2282]=10664;Xk(9132|0);c[9136>>2]=0;c[9140>>2]=0;c[9144>>2]=0;c[9148>>2]=0;c[9152>>2]=0;c[9156>>2]=0;c[2282]=9592;c[9160>>2]=h;m=c[9132>>2]|0;n=m+4|0;c[n>>2]=(c[n>>2]|0)+1;if(!((c[3380]|0)==-1)){c[d>>2]=13520;c[d+4>>2]=208;c[d+8>>2]=0;cg(13520,d)}l=(c[13524>>2]|0)+ -1|0;k=c[m+8>>2]|0;if((c[m+12>>2]|0)-k>>2>>>0>l>>>0?(g=c[k+(l<<2)>>2]|0,(g|0)!=0):0){l=c[n>>2]|0;c[n>>2]=l+ -1;if((l|0)==0){lc[c[(c[m>>2]|0)+8>>2]&255](m)}c[9164>>2]=g;c[9168>>2]=9048;a[9172>>0]=(oc[c[(c[g>>2]|0)+28>>2]&127](g)|0)&1;c[2110]=10876;c[8444>>2]=10896;c[8468>>2]=9128;c[8460>>2]=0;c[8464>>2]=0;c[8448>>2]=4098;c[8456>>2]=0;c[8452>>2]=6;k=8476|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8472|0);c[8516>>2]=0;c[8520>>2]=-1;k=c[(c[(c[2110]|0)+ -12>>2]|0)+8464>>2]|0;c[2132]=10876;c[8532>>2]=10896;c[8556>>2]=k;c[8548>>2]=(k|0)==0&1;c[8552>>2]=0;c[8536>>2]=4098;c[8544>>2]=0;c[8540>>2]=6;k=8564|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8560|0);c[8604>>2]=0;c[8608>>2]=-1;c[(c[(c[2066]|0)+ -12>>2]|0)+8336>>2]=8352;g=(c[(c[2110]|0)+ -12>>2]|0)+8444|0;c[g>>2]=c[g>>2]|8192;c[(c[(c[2110]|0)+ -12>>2]|0)+8512>>2]=8352;c[2294]=10728;Xk(9180|0);c[9184>>2]=0;c[9188>>2]=0;c[9192>>2]=0;c[9196>>2]=0;c[9200>>2]=0;c[9204>>2]=0;c[2294]=9448;c[9208>>2]=f;c[9216>>2]=9056;c[9224>>2]=-1;a[9228>>0]=0;f=c[9180>>2]|0;g=f+4|0;c[g>>2]=(c[g>>2]|0)+1;if(!((c[3382]|0)==-1)){c[d>>2]=13528;c[d+4>>2]=208;c[d+8>>2]=0;cg(13528,d)}k=(c[13532>>2]|0)+ -1|0;l=c[f+8>>2]|0;if((c[f+12>>2]|0)-l>>2>>>0>k>>>0?(e=c[l+(k<<2)>>2]|0,(e|0)!=0):0){c[9212>>2]=e;c[9220>>2]=oc[c[(c[e>>2]|0)+24>>2]&127](e)|0;n=c[9212>>2]|0;a[9229>>0]=(oc[c[(c[n>>2]|0)+28>>2]&127](n)|0)&1;if((c[9220>>2]|0)>8){ok(9544)}n=c[g>>2]|0;c[g>>2]=n+ -1;if((n|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}c[2154]=10836;c[8624>>2]=10856;c[8620>>2]=0;c[8648>>2]=9176;c[8640>>2]=0;c[8644>>2]=0;c[8628>>2]=4098;c[8636>>2]=0;c[8632>>2]=6;k=8656|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8652|0);c[8696>>2]=0;c[8700>>2]=-1;c[2308]=10728;Xk(9236|0);c[9240>>2]=0;c[9244>>2]=0;c[9248>>2]=0;c[9252>>2]=0;c[9256>>2]=0;c[9260>>2]=0;c[2308]=9336;c[9264>>2]=j;e=c[9236>>2]|0;f=e+4|0;c[f>>2]=(c[f>>2]|0)+1;if(!((c[3382]|0)==-1)){c[d>>2]=13528;c[d+4>>2]=208;c[d+8>>2]=0;cg(13528,d)}g=(c[13532>>2]|0)+ -1|0;j=c[e+8>>2]|0;do{if((c[e+12>>2]|0)-j>>2>>>0>g>>>0){g=c[j+(g<<2)>>2]|0;if((g|0)==0){break}n=c[f>>2]|0;c[f>>2]=n+ -1;if((n|0)==0){lc[c[(c[e>>2]|0)+8>>2]&255](e)}c[9268>>2]=g;c[9272>>2]=9064;a[9276>>0]=(oc[c[(c[g>>2]|0)+28>>2]&127](g)|0)&1;c[2176]=10916;c[8708>>2]=10936;c[8732>>2]=9232;c[8724>>2]=0;c[8728>>2]=0;c[8712>>2]=4098;c[8720>>2]=0;c[8716>>2]=6;k=8740|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8736|0);c[8780>>2]=0;c[8784>>2]=-1;c[2320]=10728;Xk(9284|0);c[9288>>2]=0;c[9292>>2]=0;c[9296>>2]=0;c[9300>>2]=0;c[9304>>2]=0;c[9308>>2]=0;c[2320]=9336;c[9312>>2]=h;f=c[9284>>2]|0;e=f+4|0;c[e>>2]=(c[e>>2]|0)+1;if(!((c[3382]|0)==-1)){c[d>>2]=13528;c[d+4>>2]=208;c[d+8>>2]=0;cg(13528,d)}d=(c[13532>>2]|0)+ -1|0;g=c[f+8>>2]|0;do{if((c[f+12>>2]|0)-g>>2>>>0>d>>>0){d=c[g+(d<<2)>>2]|0;if((d|0)==0){break}n=c[e>>2]|0;c[e>>2]=n+ -1;if((n|0)!=0){c[9316>>2]=d;c[9320>>2]=9072;k=c[d>>2]|0;k=k+28|0;k=c[k>>2]|0;k=oc[k&127](d)|0;k=k&1;a[9324>>0]=k;c[2198]=10916;c[8796>>2]=10936;c[8820>>2]=9280;c[8812>>2]=0;c[8816>>2]=0;c[8800>>2]=4098;c[8808>>2]=0;c[8804>>2]=6;k=8828|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8824|0);c[8868>>2]=0;c[8872>>2]=-1;k=c[2198]|0;k=k+ -12|0;k=c[k>>2]|0;k=k+24|0;k=8792+k|0;k=c[k>>2]|0;c[2220]=10916;c[8884>>2]=10936;c[8908>>2]=k;k=(k|0)==0;k=k&1;c[8900>>2]=k;c[8904>>2]=0;c[8888>>2]=4098;c[8896>>2]=0;c[8892>>2]=6;k=8916|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8912|0);c[8956>>2]=0;c[8960>>2]=-1;n=c[2154]|0;n=n+ -12|0;n=c[n>>2]|0;n=n+72|0;n=8616+n|0;c[n>>2]=8704;n=c[2198]|0;n=n+ -12|0;n=c[n>>2]|0;n=n+4|0;n=8792+n|0;m=c[n>>2]|0;m=m|8192;c[n>>2]=m;n=c[2198]|0;n=n+ -12|0;n=c[n>>2]|0;n=n+72|0;n=8792+n|0;c[n>>2]=8704;cc(212,8968,p|0)|0;i=b;return}lc[c[(c[f>>2]|0)+8>>2]&255](f);c[9316>>2]=d;c[9320>>2]=9072;k=c[d>>2]|0;k=k+28|0;k=c[k>>2]|0;k=oc[k&127](d)|0;k=k&1;a[9324>>0]=k;c[2198]=10916;c[8796>>2]=10936;c[8820>>2]=9280;c[8812>>2]=0;c[8816>>2]=0;c[8800>>2]=4098;c[8808>>2]=0;c[8804>>2]=6;k=8828|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8824|0);c[8868>>2]=0;c[8872>>2]=-1;k=c[2198]|0;k=k+ -12|0;k=c[k>>2]|0;k=k+24|0;k=8792+k|0;k=c[k>>2]|0;c[2220]=10916;c[8884>>2]=10936;c[8908>>2]=k;k=(k|0)==0;k=k&1;c[8900>>2]=k;c[8904>>2]=0;c[8888>>2]=4098;c[8896>>2]=0;c[8892>>2]=6;k=8916|0;l=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(l|0));Xk(8912|0);c[8956>>2]=0;c[8960>>2]=-1;n=c[2154]|0;n=n+ -12|0;n=c[n>>2]|0;n=n+72|0;n=8616+n|0;c[n>>2]=8704;n=c[2198]|0;n=n+ -12|0;n=c[n>>2]|0;n=n+4|0;n=8792+n|0;m=c[n>>2]|0;m=m|8192;c[n>>2]=m;n=c[2198]|0;n=n+ -12|0;n=c[n>>2]|0;n=n+72|0;n=8792+n|0;c[n>>2]=8704;cc(212,8968,p|0)|0;i=b;return}}while(0);n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}}while(0);n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}function Hf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9904;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0);Rb(a|0);vn(a);i=b;return}else{Rb(a|0);vn(a);i=b;return}}function If(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9904;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function Jf(a){a=a|0;return c[a+4>>2]|0}function Kf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0);Rb(a|0);vn(a);i=b;return}else{Rb(a|0);vn(a);i=b;return}}function Lf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function Mf(a){a=a|0;return c[a+4>>2]|0}function Nf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9904;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0);Rb(a|0);vn(a);i=b;return}else{Rb(a|0);vn(a);i=b;return}}function Of(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=d;c[a+4>>2]=b;return}function Pf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=i;i=i+16|0;f=e;qc[c[(c[a>>2]|0)+12>>2]&31](f,a,b);if((c[f+4>>2]|0)!=(c[d+4>>2]|0)){a=0;i=e;return a|0}a=(c[f>>2]|0)==(c[d>>2]|0);i=e;return a|0}function Qf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=i;if((c[b+4>>2]|0)!=(a|0)){a=0;i=e;return a|0}a=(c[b>>2]|0)==(d|0);i=e;return a|0}function Rf(a){a=a|0;return 10080}function Sf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;d=i;e=Nb(e|0)|0;f=Jn(e|0)|0;if(f>>>0>4294967279){dg()}if(f>>>0<11){a[b>>0]=f<<1;j=b+1|0;Ln(j|0,e|0,f|0)|0;j=j+f|0;a[j>>0]=0;i=d;return}g=f+16&-16;h=(g|0)==0?1:g;while(1){j=un(h)|0;if((j|0)!=0){h=11;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){h=9;break}sc[j&31]()}if((h|0)==9){j=Xa(4)|0;c[j>>2]=22680;wb(j|0,22728,206)}else if((h|0)==11){c[b+8>>2]=j;c[b>>2]=g|1;c[b+4>>2]=f;Ln(j|0,e|0,f|0)|0;j=j+f|0;a[j>>0]=0;i=d;return}}function Tf(a){a=a|0;return}function Uf(a){a=a|0;return 10104}function Vf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;d=i;e=Nb(e|0)|0;f=Jn(e|0)|0;if(f>>>0>4294967279){dg()}if(f>>>0<11){a[b>>0]=f<<1;j=b+1|0;Ln(j|0,e|0,f|0)|0;j=j+f|0;a[j>>0]=0;i=d;return}g=f+16&-16;h=(g|0)==0?1:g;while(1){j=un(h)|0;if((j|0)!=0){h=11;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){h=9;break}sc[j&31]()}if((h|0)==9){j=Xa(4)|0;c[j>>2]=22680;wb(j|0,22728,206)}else if((h|0)==11){c[b+8>>2]=j;c[b>>2]=g|1;c[b+4>>2]=f;Ln(j|0,e|0,f|0)|0;j=j+f|0;a[j>>0]=0;i=d;return}}function Wf(b,d,e){b=b|0;d=d|0;e=e|0;d=i;if((a[10096]|0)==0?(Qa(10096)|0)!=0:0){c[2522]=10288;$a(10096)}c[b>>2]=e;c[b+4>>2]=10088;i=d;return}function Xf(a){a=a|0;return}function Yf(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;g=i;i=i+48|0;o=g+24|0;l=g+12|0;h=g;p=Jn(f|0)|0;if(p>>>0>4294967279){dg()}do{if(p>>>0<11){a[h>>0]=p<<1;m=h;q=h+1|0}else{m=p+16&-16;r=(m|0)==0?1:m;while(1){q=un(r)|0;if((q|0)!=0){j=11;break}q=c[5666]|0;c[5666]=q+0;if((q|0)==0){break}sc[q&31]()}if((j|0)==11){c[h+8>>2]=q;c[h>>2]=m|1;c[h+4>>2]=p;m=h;break}r=Xa(4)|0;c[r>>2]=22680;wb(r|0,22728,206)}}while(0);Ln(q|0,f|0,p|0)|0;a[q+p>>0]=0;if((d|0)!=0){p=a[m>>0]|0;if((p&1)==0){p=(p&255)>>>1}else{p=c[h+4>>2]|0}if((p|0)!=0){jg(h,10128,2)}qc[c[(c[e>>2]|0)+24>>2]&31](o,e,d);f=a[o>>0]|0;if((f&1)==0){p=o+1|0;f=(f&255)>>>1}else{p=c[o+8>>2]|0;f=c[o+4>>2]|0}jg(h,p,f);if(!((a[o>>0]&1)==0)?(n=c[o+8>>2]|0,(n|0)!=0):0){vn(n)}}c[l+0>>2]=c[m+0>>2];c[l+4>>2]=c[m+4>>2];c[l+8>>2]=c[m+8>>2];c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;c[b>>2]=9928;n=b+4|0;if((a[l>>0]&1)==0){f=l+1|0}else{f=c[l+8>>2]|0}p=Jn(f|0)|0;o=p+13|0;o=(o|0)==0?1:o;while(1){q=un(o)|0;if((q|0)!=0){break}q=c[5666]|0;c[5666]=q+0;if((q|0)==0){j=33;break}sc[q&31]()}if((j|0)==33){r=Xa(4)|0;c[r>>2]=22680;wb(r|0,22728,206)}c[q+4>>2]=p;c[q>>2]=p;r=q+12|0;c[n>>2]=r;c[q+8>>2]=0;Ln(r|0,f|0,p+1|0)|0;if(!((a[l>>0]&1)==0)?(k=c[l+8>>2]|0,(k|0)!=0):0){vn(k)}if((a[m>>0]&1)==0){c[b>>2]=10144;r=b+8|0;q=e;f=r;c[f>>2]=d;r=r+4|0;c[r>>2]=q;i=g;return}h=c[h+8>>2]|0;if((h|0)==0){c[b>>2]=10144;r=b+8|0;q=e;f=r;c[f>>2]=d;r=r+4|0;c[r>>2]=q;i=g;return}vn(h);c[b>>2]=10144;r=b+8|0;q=e;f=r;c[f>>2]=d;r=r+4|0;c[r>>2]=q;i=g;return}function Zf(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function _f(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function $f(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function ag(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return} - - - -function bg(a){a=a|0;var b=0;b=i;Bb(a|0)|0;i=b;return}function cg(a,b){a=a|0;b=b|0;var e=0,f=0,g=0;e=i;$b(10568)|0;if((c[a>>2]|0)==1){do{Ga(10592,10568)|0}while((c[a>>2]|0)==1)}if((c[a>>2]|0)!=0){Cb(10568)|0;i=e;return}c[a>>2]=1;Cb(10568)|0;g=b+4|0;f=d[g>>0]|d[g+1>>0]<<8|d[g+2>>0]<<16|d[g+3>>0]<<24;g=g+4|0;g=d[g>>0]|d[g+1>>0]<<8|d[g+2>>0]<<16|d[g+3>>0]<<24;b=(c[b>>2]|0)+(g>>1)|0;if((g&1|0)!=0){f=c[(c[b>>2]|0)+f>>2]|0}lc[f&255](b);$b(10568)|0;c[a>>2]=-1;Cb(10568)|0;Eb(10592)|0;i=e;return}function dg(){var b=0,d=0,e=0,f=0;b=Xa(8)|0;c[b>>2]=9904;while(1){e=un(25)|0;if((e|0)!=0){d=7;break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){break}sc[e&31]()}if((d|0)==7){c[e+4>>2]=12;c[e>>2]=12;f=e+12|0;c[b+4>>2]=f;c[e+8>>2]=0;f=f+0|0;e=10640|0;d=f+13|0;do{a[f>>0]=a[e>>0]|0;f=f+1|0;e=e+1|0}while((f|0)<(d|0));c[b>>2]=9984;wb(b|0,10024,104)}f=Xa(4)|0;c[f>>2]=22680;wb(f|0,22728,206)}function eg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;if(e>>>0>4294967279){dg()}if(e>>>0<11){a[b>>0]=e<<1;j=b+1|0;Ln(j|0,d|0,e|0)|0;j=j+e|0;a[j>>0]=0;i=f;return}g=e+16&-16;h=(g|0)==0?1:g;while(1){j=un(h)|0;if((j|0)!=0){h=11;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){h=9;break}sc[j&31]()}if((h|0)==9){j=Xa(4)|0;c[j>>2]=22680;wb(j|0,22728,206)}else if((h|0)==11){c[b+8>>2]=j;c[b>>2]=g|1;c[b+4>>2]=e;Ln(j|0,d|0,e|0)|0;j=j+e|0;a[j>>0]=0;i=f;return}}function fg(b){b=b|0;var d=0,e=0;d=i;if(!((a[b>>0]&1)==0)?(e=c[b+8>>2]|0,(e|0)!=0):0){vn(e)}i=d;return}function gg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;f=i;e=Jn(d|0)|0;h=a[b>>0]|0;if((h&1)==0){g=10}else{g=c[b>>2]|0;h=g&255;g=(g&-2)+ -1|0}j=(h&1)==0;if(g>>>0<e>>>0){if(j){h=(h&255)>>>1}else{h=c[b+4>>2]|0}kg(b,g,e-g|0,h,0,h,e,d);i=f;return}if(j){g=b+1|0}else{g=c[b+8>>2]|0}Mn(g|0,d|0,e|0)|0;a[g+e>>0]=0;if((a[b>>0]&1)==0){a[b>>0]=e<<1;i=f;return}else{c[b+4>>2]=e;i=f;return}}function hg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=i;if((d|0)==0){i=e;return}h=a[b>>0]|0;if((h&1)==0){g=10}else{h=c[b>>2]|0;g=(h&-2)+ -1|0;h=h&255}if((h&1)==0){f=(h&255)>>>1}else{f=c[b+4>>2]|0}if((g-f|0)>>>0<d>>>0){lg(b,g,d-g+f|0,f,f,0);h=a[b>>0]|0}if((h&1)==0){g=b+1|0}else{g=c[b+8>>2]|0}Nn(g+f|0,0,d|0)|0;d=f+d|0;if((a[b>>0]&1)==0){a[b>>0]=d<<1}else{c[b+4>>2]=d}a[g+d>>0]=0;i=e;return}function ig(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;d=i;h=a[b>>0]|0;if((h&1)==0){l=10}else{h=c[b>>2]|0;l=(h&-2)+ -1|0;h=h&255}j=(h&1)==0;if(j){f=(h&255)>>>1}else{f=c[b+4>>2]|0}if(f>>>0<11){e=10}else{e=(f+16&-16)+ -1|0}if((e|0)==(l|0)){i=d;return}do{if((e|0)==10){k=b+1|0;g=c[b+8>>2]|0;if(j){Ln(k|0,g|0,((h&255)>>>1)+1|0)|0;h=k;k=0;j=g;g=27}else{h=k;k=0;j=g;g=25}}else{k=e+1|0;k=(k|0)==0?1:k;a:do{if(e>>>0>l>>>0){while(1){l=un(k)|0;if((l|0)!=0){break a}l=c[5666]|0;c[5666]=l+0;if((l|0)==0){break}sc[l&31]()}l=Xa(4)|0;c[l>>2]=22680;wb(l|0,22728,206)}else{while(1){l=un(k)|0;if((l|0)!=0){break a}l=c[5666]|0;c[5666]=l+0;if((l|0)==0){break}sc[l&31]()}l=Xa(4)|0;c[l>>2]=22680;wb(l|0,22728,206)}}while(0);if(j){Ln(l|0,b+1|0,((h&255)>>>1)+1|0)|0;h=l;break}else{h=l;k=1;j=c[b+8>>2]|0;g=25;break}}}while(0);if((g|0)==25){Ln(h|0,j|0,(c[b+4>>2]|0)+1|0)|0;g=27}do{if((g|0)==27){if((j|0)==0){if(k){break}}else{vn(j);if(k){break}}a[b>>0]=f<<1;i=d;return}}while(0);c[b>>2]=e+1|1;c[b+4>>2]=f;c[b+8>>2]=h;i=d;return}function jg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;j=a[b>>0]|0;if((j&1)==0){g=10}else{j=c[b>>2]|0;g=(j&-2)+ -1|0;j=j&255}h=(j&1)==0;if(h){j=(j&255)>>>1}else{j=c[b+4>>2]|0}if((g-j|0)>>>0<e>>>0){kg(b,g,e-g+j|0,j,j,0,e,d);i=f;return}if((e|0)==0){i=f;return}if(h){g=b+1|0}else{g=c[b+8>>2]|0}Ln(g+j|0,d|0,e|0)|0;e=j+e|0;if((a[b>>0]&1)==0){a[b>>0]=e<<1}else{c[b+4>>2]=e}a[g+e>>0]=0;i=f;return}function kg(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0;l=i;if((-18-d|0)>>>0<e>>>0){dg()}if((a[b>>0]&1)==0){m=b+1|0}else{m=c[b+8>>2]|0}if(d>>>0<2147483623){e=e+d|0;p=d<<1;e=e>>>0<p>>>0?p:e;if(e>>>0<11){e=11}else{e=e+16&-16}}else{e=-17}o=(e|0)==0?1:e;while(1){p=un(o)|0;if((p|0)!=0){break}p=c[5666]|0;c[5666]=p+0;if((p|0)==0){n=13;break}sc[p&31]()}if((n|0)==13){p=Xa(4)|0;c[p>>2]=22680;wb(p|0,22728,206)}if((g|0)!=0){Ln(p|0,m|0,g|0)|0}if((j|0)!=0){Ln(p+g|0,k|0,j|0)|0}n=f-h|0;if((n|0)!=(g|0)){Ln(p+(j+g)|0,m+(h+g)|0,n-g|0)|0}if((d|0)==10|(m|0)==0){o=b+8|0;c[o>>2]=p;o=e|1;c[b>>2]=o;o=n+j|0;e=b+4|0;c[e>>2]=o;p=p+o|0;a[p>>0]=0;i=l;return}vn(m);o=b+8|0;c[o>>2]=p;o=e|1;c[b>>2]=o;o=n+j|0;e=b+4|0;c[e>>2]=o;p=p+o|0;a[p>>0]=0;i=l;return}function lg(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0;l=i;if((-17-d|0)>>>0<e>>>0){dg()}if((a[b>>0]&1)==0){k=b+1|0}else{k=c[b+8>>2]|0}if(d>>>0<2147483623){e=e+d|0;n=d<<1;e=e>>>0<n>>>0?n:e;if(e>>>0<11){e=11}else{e=e+16&-16}}else{e=-17}m=(e|0)==0?1:e;while(1){n=un(m)|0;if((n|0)!=0){break}n=c[5666]|0;c[5666]=n+0;if((n|0)==0){j=13;break}sc[n&31]()}if((j|0)==13){n=Xa(4)|0;c[n>>2]=22680;wb(n|0,22728,206)}if((g|0)!=0){Ln(n|0,k|0,g|0)|0}if((f|0)!=(g|0)){Ln(n+(h+g)|0,k+g|0,f-g|0)|0}if((d|0)==10|(k|0)==0){m=b+8|0;c[m>>2]=n;n=e|1;c[b>>2]=n;i=l;return}vn(k);m=b+8|0;c[m>>2]=n;n=e|1;c[b>>2]=n;i=l;return}function mg(b){b=b|0;var d=0,e=0;d=i;if(!((a[b>>0]&1)==0)?(e=c[b+8>>2]|0,(e|0)!=0):0){vn(e)}i=d;return}function ng(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;e=i;f=d;while(1){if((c[f>>2]|0)==0){break}else{f=f+4|0}}k=d;j=f-k|0;f=j>>2;l=a[b>>0]|0;if((l&1)==0){g=1}else{l=c[b>>2]|0;g=(l&-2)+ -1|0;l=l&255}if(!(g>>>0<f>>>0)){if((l&1)==0){g=b+4|0}else{g=c[b+8>>2]|0}h=(f|0)==0;if(g-k>>2>>>0<f>>>0){if(!h){h=f;do{h=h+ -1|0;c[g+(h<<2)>>2]=c[d+(h<<2)>>2]}while((h|0)!=0)}}else{if(!h){h=g;k=f;while(1){k=k+ -1|0;c[h>>2]=c[d>>2];if((k|0)==0){break}else{d=d+4|0;h=h+4|0}}}}c[g+(f<<2)>>2]=0;if((a[b>>0]&1)==0){a[b>>0]=j>>>1;i=e;return}else{c[b+4>>2]=f;i=e;return}}if((1073741806-g|0)>>>0<(f-g|0)>>>0){dg()}if((l&1)==0){j=b+4|0}else{j=c[b+8>>2]|0}if(g>>>0<536870887){k=g<<1;k=f>>>0<k>>>0?k:f;if(k>>>0<2){k=2}else{k=k+4&-4}}else{k=1073741807}m=k<<2;m=(m|0)==0?1:m;while(1){l=un(m)|0;if((l|0)!=0){break}l=c[5666]|0;c[5666]=l+0;if((l|0)==0){h=29;break}sc[l&31]()}if((h|0)==29){m=Xa(4)|0;c[m>>2]=22680;wb(m|0,22728,206)}if((f|0)!=0){h=f;m=l;while(1){h=h+ -1|0;c[m>>2]=c[d>>2];if((h|0)==0){break}else{d=d+4|0;m=m+4|0}}}if(!((g|0)==1|(j|0)==0)){vn(j)}c[b+8>>2]=l;c[b>>2]=k|1;c[b+4>>2]=f;c[l+(f<<2)>>2]=0;i=e;return}function og(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;d=i;g=a[b>>0]|0;if((g&1)==0){k=1}else{g=c[b>>2]|0;k=(g&-2)+ -1|0;g=g&255}h=(g&1)==0;if(h){f=(g&255)>>>1}else{f=c[b+4>>2]|0}if(f>>>0<2){e=1}else{e=(f+4&-4)+ -1|0}if((e|0)==(k|0)){i=d;return}do{if((e|0)==1){n=b+4|0;l=c[b+8>>2]|0;if(h){j=0;m=1;h=26}else{g=n;j=0;m=1;h=25}}else{j=(e<<2)+4|0;j=(j|0)==0?1:j;a:do{if(e>>>0>k>>>0){while(1){n=un(j)|0;if((n|0)!=0){break a}k=c[5666]|0;c[5666]=k+0;if((k|0)==0){break}sc[k&31]()}n=Xa(4)|0;c[n>>2]=22680;wb(n|0,22728,206)}else{while(1){n=un(j)|0;if((n|0)!=0){break a}k=c[5666]|0;c[5666]=k+0;if((k|0)==0){break}sc[k&31]()}n=Xa(4)|0;c[n>>2]=22680;wb(n|0,22728,206)}}while(0);if(h){j=1;l=b+4|0;m=0;h=26;break}else{g=n;j=1;l=c[b+8>>2]|0;m=1;h=25;break}}}while(0);if((h|0)==25){k=c[b+4>>2]|0}else if((h|0)==26){k=(g&255)>>>1;g=n}k=k+1|0;if((k|0)!=0){n=l;h=g;while(1){k=k+ -1|0;c[h>>2]=c[n>>2];if((k|0)==0){break}else{n=n+4|0;h=h+4|0}}}if(!(m^1|(l|0)==0)){vn(l)}if(j){c[b>>2]=e+1|1;c[b+4>>2]=f;c[b+8>>2]=g;i=d;return}else{a[b>>0]=f<<1;i=d;return}}function pg(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0;k=i;if((1073741807-d|0)>>>0<e>>>0){dg()}if((a[b>>0]&1)==0){l=b+4|0}else{l=c[b+8>>2]|0}if(d>>>0<536870887){e=e+d|0;p=d<<1;e=e>>>0<p>>>0?p:e;if(e>>>0<2){e=2}else{e=e+4&-4}}else{e=1073741807}o=e<<2;o=(o|0)==0?1:o;while(1){m=un(o)|0;if((m|0)!=0){break}m=c[5666]|0;c[5666]=m+0;if((m|0)==0){n=13;break}sc[m&31]()}if((n|0)==13){p=Xa(4)|0;c[p>>2]=22680;wb(p|0,22728,206)}if((g|0)!=0){o=g;n=l;p=m;while(1){o=o+ -1|0;c[p>>2]=c[n>>2];if((o|0)==0){break}else{n=n+4|0;p=p+4|0}}}f=f-h|0;if((f|0)!=(g|0)){f=f-g|0;h=l+(h+g<<2)|0;g=m+(j+g<<2)|0;while(1){f=f+ -1|0;c[g>>2]=c[h>>2];if((f|0)==0){break}else{h=h+4|0;g=g+4|0}}}if((d|0)==1|(l|0)==0){p=b+8|0;c[p>>2]=m;p=e|1;c[b>>2]=p;i=k;return}vn(l);p=b+8|0;c[p>>2]=m;p=e|1;c[b>>2]=p;i=k;return}function qg(b,d){b=b|0;d=d|0;var e=0;e=(c[b+24>>2]|0)==0;if(e){c[b+16>>2]=d|1}else{c[b+16>>2]=d}if(((e&1|d)&c[b+20>>2]|0)==0){return}d=Xa(16)|0;if((a[11008]|0)==0?(Qa(11008)|0)!=0:0){c[2750]=11784;$a(11008)}Yf(d,1,11e3,11056);c[d>>2]=11024;wb(d|0,11104,131)}function rg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;e=i;c[a>>2]=11048;f=c[a+40>>2]|0;b=a+32|0;d=a+36|0;if((f|0)!=0){do{f=f+ -1|0;qc[c[(c[b>>2]|0)+(f<<2)>>2]&31](0,a,c[(c[d>>2]|0)+(f<<2)>>2]|0)}while((f|0)!=0)}f=c[a+28>>2]|0;h=f+4|0;g=c[h>>2]|0;c[h>>2]=g+ -1;if((g|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}vn(c[b>>2]|0);vn(c[d>>2]|0);vn(c[a+48>>2]|0);vn(c[a+60>>2]|0);i=e;return}function sg(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=10664;d=c[a+4>>2]|0;f=d+4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e|0)!=0){vn(a);i=b;return}lc[c[(c[d>>2]|0)+8>>2]&255](d);vn(a);i=b;return}function tg(a){a=a|0;var b=0,d=0,e=0;b=i;c[a>>2]=10664;a=c[a+4>>2]|0;e=a+4|0;d=c[e>>2]|0;c[e>>2]=d+ -1;if((d|0)!=0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function ug(a,b){a=a|0;b=b|0;return}function vg(a,b,c){a=a|0;b=b|0;c=c|0;return a|0}function wg(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;g=a;c[g>>2]=0;c[g+4>>2]=0;g=a+8|0;c[g>>2]=-1;c[g+4>>2]=-1;return}function xg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;e=a;c[e>>2]=0;c[e+4>>2]=0;e=a+8|0;c[e>>2]=-1;c[e+4>>2]=-1;return}function yg(a){a=a|0;return 0}function zg(a){a=a|0;return 0}function Ag(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;f=i;if((e|0)<=0){k=0;i=f;return k|0}g=b+12|0;h=b+16|0;j=0;while(1){k=c[g>>2]|0;if(k>>>0<(c[h>>2]|0)>>>0){c[g>>2]=k+1;k=a[k>>0]|0}else{k=oc[c[(c[b>>2]|0)+40>>2]&127](b)|0;if((k|0)==-1){e=8;break}k=k&255}a[d>>0]=k;j=j+1|0;if((j|0)<(e|0)){d=d+1|0}else{e=8;break}}if((e|0)==8){i=f;return j|0}return 0}function Bg(a){a=a|0;return-1}function Cg(a){a=a|0;var b=0,e=0;b=i;if((oc[c[(c[a>>2]|0)+36>>2]&127](a)|0)==-1){a=-1;i=b;return a|0}e=a+12|0;a=c[e>>2]|0;c[e>>2]=a+1;a=d[a>>0]|0;i=b;return a|0}function Dg(a,b){a=a|0;b=b|0;return-1}function Eg(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;g=i;if((f|0)<=0){l=0;i=g;return l|0}j=b+24|0;h=b+28|0;k=0;while(1){l=c[j>>2]|0;if(!(l>>>0<(c[h>>2]|0)>>>0)){if((xc[c[(c[b>>2]|0)+52>>2]&63](b,d[e>>0]|0)|0)==-1){h=7;break}}else{m=a[e>>0]|0;c[j>>2]=l+1;a[l>>0]=m}k=k+1|0;if((k|0)<(f|0)){e=e+1|0}else{h=7;break}}if((h|0)==7){i=g;return k|0}return 0}function Fg(a,b){a=a|0;b=b|0;return-1}function Gg(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=10728;d=c[a+4>>2]|0;f=d+4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e|0)!=0){vn(a);i=b;return}lc[c[(c[d>>2]|0)+8>>2]&255](d);vn(a);i=b;return}function Hg(a){a=a|0;var b=0,d=0,e=0;b=i;c[a>>2]=10728;a=c[a+4>>2]|0;e=a+4|0;d=c[e>>2]|0;c[e>>2]=d+ -1;if((d|0)!=0){i=b;return}lc[c[(c[a>>2]|0)+8>>2]&255](a);i=b;return}function Ig(a,b){a=a|0;b=b|0;return}function Jg(a,b,c){a=a|0;b=b|0;c=c|0;return a|0}function Kg(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;g=a;c[g>>2]=0;c[g+4>>2]=0;g=a+8|0;c[g>>2]=-1;c[g+4>>2]=-1;return}function Lg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;e=a;c[e>>2]=0;c[e+4>>2]=0;e=a+8|0;c[e>>2]=-1;c[e+4>>2]=-1;return}function Mg(a){a=a|0;return 0}function Ng(a){a=a|0;return 0}function Og(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;if((d|0)<=0){j=0;i=e;return j|0}g=a+12|0;f=a+16|0;h=0;while(1){j=c[g>>2]|0;if(!(j>>>0<(c[f>>2]|0)>>>0)){j=oc[c[(c[a>>2]|0)+40>>2]&127](a)|0;if((j|0)==-1){a=8;break}}else{c[g>>2]=j+4;j=c[j>>2]|0}c[b>>2]=j;h=h+1|0;if((h|0)>=(d|0)){a=8;break}b=b+4|0}if((a|0)==8){i=e;return h|0}return 0}function Pg(a){a=a|0;return-1}function Qg(a){a=a|0;var b=0,d=0;b=i;if((oc[c[(c[a>>2]|0)+36>>2]&127](a)|0)==-1){a=-1;i=b;return a|0}d=a+12|0;a=c[d>>2]|0;c[d>>2]=a+4;a=c[a>>2]|0;i=b;return a|0}function Rg(a,b){a=a|0;b=b|0;return-1}function Sg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;e=i;if((d|0)<=0){j=0;i=e;return j|0}g=a+24|0;f=a+28|0;h=0;while(1){j=c[g>>2]|0;if(!(j>>>0<(c[f>>2]|0)>>>0)){if((xc[c[(c[a>>2]|0)+52>>2]&63](a,c[b>>2]|0)|0)==-1){f=8;break}}else{k=c[b>>2]|0;c[g>>2]=j+4;c[j>>2]=k}h=h+1|0;if((h|0)>=(d|0)){f=8;break}b=b+4|0}if((f|0)==8){i=e;return h|0}return 0}function Tg(a,b){a=a|0;b=b|0;return-1}function Ug(a){a=a|0;var b=0;b=i;rg(a+8|0);if((a|0)==0){i=b;return}vn(a);i=b;return}function Vg(a){a=a|0;var b=0;b=i;rg(a+8|0);i=b;return}function Wg(a){a=a|0;var b=0,d=0,e=0;b=i;e=c[(c[a>>2]|0)+ -12>>2]|0;d=a+e|0;rg(a+(e+8)|0);if((d|0)==0){i=b;return}vn(d);i=b;return}function Xg(a){a=a|0;var b=0;b=i;rg(a+((c[(c[a>>2]|0)+ -12>>2]|0)+8)|0);i=b;return}function Yg(b){b=b|0;var d=0,e=0,f=0,g=0;d=i;i=i+16|0;e=d;f=c[(c[b>>2]|0)+ -12>>2]|0;if((c[b+(f+24)>>2]|0)==0){i=d;return}a[e>>0]=0;c[e+4>>2]=b;if((c[b+(f+16)>>2]|0)==0){g=c[b+(f+72)>>2]|0;if((g|0)!=0){Yg(g);f=c[(c[b>>2]|0)+ -12>>2]|0}a[e>>0]=1;g=c[b+(f+24)>>2]|0;if((oc[c[(c[g>>2]|0)+24>>2]&127](g)|0)==-1){g=c[(c[b>>2]|0)+ -12>>2]|0;qg(b+g|0,c[b+(g+16)>>2]|1)}}gh(e);i=d;return}function Zg(a){a=a|0;var b=0;b=i;rg(a+8|0);if((a|0)==0){i=b;return}vn(a);i=b;return}function _g(a){a=a|0;var b=0;b=i;rg(a+8|0);i=b;return}function $g(a){a=a|0;var b=0,d=0,e=0;b=i;e=c[(c[a>>2]|0)+ -12>>2]|0;d=a+e|0;rg(a+(e+8)|0);if((d|0)==0){i=b;return}vn(d);i=b;return}function ah(a){a=a|0;var b=0;b=i;rg(a+((c[(c[a>>2]|0)+ -12>>2]|0)+8)|0);i=b;return}function bh(b){b=b|0;var d=0,e=0,f=0,g=0;d=i;i=i+16|0;e=d;f=c[(c[b>>2]|0)+ -12>>2]|0;if((c[b+(f+24)>>2]|0)==0){i=d;return}a[e>>0]=0;c[e+4>>2]=b;if((c[b+(f+16)>>2]|0)==0){g=c[b+(f+72)>>2]|0;if((g|0)!=0){bh(g);f=c[(c[b>>2]|0)+ -12>>2]|0}a[e>>0]=1;g=c[b+(f+24)>>2]|0;if((oc[c[(c[g>>2]|0)+24>>2]&127](g)|0)==-1){g=c[(c[b>>2]|0)+ -12>>2]|0;qg(b+g|0,c[b+(g+16)>>2]|1)}}qh(e);i=d;return}function ch(a){a=a|0;var b=0;b=i;rg(a+4|0);if((a|0)==0){i=b;return}vn(a);i=b;return}function dh(a){a=a|0;var b=0;b=i;rg(a+4|0);i=b;return}function eh(a){a=a|0;var b=0,d=0,e=0;b=i;e=c[(c[a>>2]|0)+ -12>>2]|0;d=a+e|0;rg(a+(e+4)|0);if((d|0)==0){i=b;return}vn(d);i=b;return}function fh(a){a=a|0;var b=0;b=i;rg(a+((c[(c[a>>2]|0)+ -12>>2]|0)+4)|0);i=b;return}function gh(a){a=a|0;var b=0,d=0,e=0;b=i;a=a+4|0;d=c[a>>2]|0;e=c[(c[d>>2]|0)+ -12>>2]|0;if((c[d+(e+24)>>2]|0)==0){i=b;return}if((c[d+(e+16)>>2]|0)!=0){i=b;return}if((c[d+(e+4)>>2]&8192|0)==0){i=b;return}if(Ya()|0){i=b;return}e=c[a>>2]|0;e=c[e+((c[(c[e>>2]|0)+ -12>>2]|0)+24)>>2]|0;if(!((oc[c[(c[e>>2]|0)+24>>2]&127](e)|0)==-1)){i=b;return}d=c[a>>2]|0;e=c[(c[d>>2]|0)+ -12>>2]|0;qg(d+e|0,c[d+(e+16)>>2]|1);i=b;return}function hh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;h=i;i=i+32|0;k=h;j=h+24|0;g=h+16|0;f=h+12|0;a[g>>0]=0;c[g+4>>2]=b;n=c[(c[b>>2]|0)+ -12>>2]|0;do{if((c[b+(n+16)>>2]|0)==0){m=c[b+(n+72)>>2]|0;if((m|0)!=0){Yg(m);n=c[(c[b>>2]|0)+ -12>>2]|0}a[g>>0]=1;o=c[b+(n+28)>>2]|0;p=o+4|0;c[p>>2]=(c[p>>2]|0)+1;if(!((c[3048]|0)==-1)){c[k>>2]=12192;c[k+4>>2]=208;c[k+8>>2]=0;cg(12192,k)}n=(c[12196>>2]|0)+ -1|0;m=c[o+8>>2]|0;if((c[o+12>>2]|0)-m>>2>>>0>n>>>0?(e=c[m+(n<<2)>>2]|0,(e|0)!=0):0){s=c[p>>2]|0;c[p>>2]=s+ -1;if((s|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}q=c[(c[b>>2]|0)+ -12>>2]|0;m=c[b+(q+24)>>2]|0;n=b+q|0;o=b+(q+76)|0;p=c[o>>2]|0;do{if((p|0)==-1){q=c[b+(q+28)>>2]|0;p=q+4|0;c[p>>2]=(c[p>>2]|0)+1;if(!((c[3364]|0)==-1)){c[k>>2]=13456;c[k+4>>2]=208;c[k+8>>2]=0;cg(13456,k)}r=(c[13460>>2]|0)+ -1|0;s=c[q+8>>2]|0;if((c[q+12>>2]|0)-s>>2>>>0>r>>>0?(l=c[s+(r<<2)>>2]|0,(l|0)!=0):0){l=xc[c[(c[l>>2]|0)+28>>2]&63](l,32)|0;s=c[p>>2]|0;c[p>>2]=s+ -1;if((s|0)==0){lc[c[(c[q>>2]|0)+8>>2]&255](q)}p=l<<24>>24;c[o>>2]=p;break}s=Xa(4)|0;c[s>>2]=21304;wb(s|0,21376,196)}}while(0);r=p&255;s=d&65535;q=c[(c[e>>2]|0)+24>>2]|0;c[j>>2]=m;c[k+0>>2]=c[j+0>>2];wc[q&63](f,e,k,n,r,s);if((c[f>>2]|0)!=0){break}s=c[(c[b>>2]|0)+ -12>>2]|0;qg(b+s|0,c[b+(s+16)>>2]|5);break}s=Xa(4)|0;c[s>>2]=21304;wb(s|0,21376,196)}}while(0);gh(g);i=h;return b|0}function ih(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;h=i;i=i+32|0;k=h;j=h+24|0;g=h+16|0;f=h+12|0;a[g>>0]=0;c[g+4>>2]=b;n=c[(c[b>>2]|0)+ -12>>2]|0;do{if((c[b+(n+16)>>2]|0)==0){m=c[b+(n+72)>>2]|0;if((m|0)!=0){Yg(m);n=c[(c[b>>2]|0)+ -12>>2]|0}a[g>>0]=1;o=c[b+(n+28)>>2]|0;p=o+4|0;c[p>>2]=(c[p>>2]|0)+1;if(!((c[3048]|0)==-1)){c[k>>2]=12192;c[k+4>>2]=208;c[k+8>>2]=0;cg(12192,k)}n=(c[12196>>2]|0)+ -1|0;m=c[o+8>>2]|0;if((c[o+12>>2]|0)-m>>2>>>0>n>>>0?(e=c[m+(n<<2)>>2]|0,(e|0)!=0):0){s=c[p>>2]|0;c[p>>2]=s+ -1;if((s|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}q=c[(c[b>>2]|0)+ -12>>2]|0;m=c[b+(q+24)>>2]|0;n=b+q|0;o=b+(q+76)|0;p=c[o>>2]|0;do{if((p|0)==-1){q=c[b+(q+28)>>2]|0;p=q+4|0;c[p>>2]=(c[p>>2]|0)+1;if(!((c[3364]|0)==-1)){c[k>>2]=13456;c[k+4>>2]=208;c[k+8>>2]=0;cg(13456,k)}r=(c[13460>>2]|0)+ -1|0;s=c[q+8>>2]|0;if((c[q+12>>2]|0)-s>>2>>>0>r>>>0?(l=c[s+(r<<2)>>2]|0,(l|0)!=0):0){l=xc[c[(c[l>>2]|0)+28>>2]&63](l,32)|0;s=c[p>>2]|0;c[p>>2]=s+ -1;if((s|0)==0){lc[c[(c[q>>2]|0)+8>>2]&255](q)}p=l<<24>>24;c[o>>2]=p;break}s=Xa(4)|0;c[s>>2]=21304;wb(s|0,21376,196)}}while(0);s=p&255;r=c[(c[e>>2]|0)+16>>2]|0;c[j>>2]=m;c[k+0>>2]=c[j+0>>2];wc[r&63](f,e,k,n,s,d);if((c[f>>2]|0)!=0){break}s=c[(c[b>>2]|0)+ -12>>2]|0;qg(b+s|0,c[b+(s+16)>>2]|5);break}s=Xa(4)|0;c[s>>2]=21304;wb(s|0,21376,196)}}while(0);gh(g);i=h;return b|0}function jh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;h=i;i=i+32|0;k=h;j=h+24|0;g=h+16|0;f=h+12|0;a[g>>0]=0;c[g+4>>2]=b;n=c[(c[b>>2]|0)+ -12>>2]|0;do{if((c[b+(n+16)>>2]|0)==0){m=c[b+(n+72)>>2]|0;if((m|0)!=0){Yg(m);n=c[(c[b>>2]|0)+ -12>>2]|0}a[g>>0]=1;o=c[b+(n+28)>>2]|0;p=o+4|0;c[p>>2]=(c[p>>2]|0)+1;if(!((c[3048]|0)==-1)){c[k>>2]=12192;c[k+4>>2]=208;c[k+8>>2]=0;cg(12192,k)}n=(c[12196>>2]|0)+ -1|0;m=c[o+8>>2]|0;if((c[o+12>>2]|0)-m>>2>>>0>n>>>0?(e=c[m+(n<<2)>>2]|0,(e|0)!=0):0){s=c[p>>2]|0;c[p>>2]=s+ -1;if((s|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}q=c[(c[b>>2]|0)+ -12>>2]|0;m=c[b+(q+24)>>2]|0;n=b+q|0;o=b+(q+76)|0;p=c[o>>2]|0;do{if((p|0)==-1){q=c[b+(q+28)>>2]|0;p=q+4|0;c[p>>2]=(c[p>>2]|0)+1;if(!((c[3364]|0)==-1)){c[k>>2]=13456;c[k+4>>2]=208;c[k+8>>2]=0;cg(13456,k)}r=(c[13460>>2]|0)+ -1|0;s=c[q+8>>2]|0;if((c[q+12>>2]|0)-s>>2>>>0>r>>>0?(l=c[s+(r<<2)>>2]|0,(l|0)!=0):0){l=xc[c[(c[l>>2]|0)+28>>2]&63](l,32)|0;s=c[p>>2]|0;c[p>>2]=s+ -1;if((s|0)==0){lc[c[(c[q>>2]|0)+8>>2]&255](q)}p=l<<24>>24;c[o>>2]=p;break}s=Xa(4)|0;c[s>>2]=21304;wb(s|0,21376,196)}}while(0);s=p&255;r=c[(c[e>>2]|0)+24>>2]|0;c[j>>2]=m;c[k+0>>2]=c[j+0>>2];wc[r&63](f,e,k,n,s,d);if((c[f>>2]|0)!=0){break}s=c[(c[b>>2]|0)+ -12>>2]|0;qg(b+s|0,c[b+(s+16)>>2]|5);break}s=Xa(4)|0;c[s>>2]=21304;wb(s|0,21376,196)}}while(0);gh(g);i=h;return b|0}function kh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=i;i=i+32|0;l=h;j=h+24|0;g=h+16|0;f=h+12|0;a[g>>0]=0;c[g+4>>2]=b;o=c[(c[b>>2]|0)+ -12>>2]|0;do{if((c[b+(o+16)>>2]|0)==0){n=c[b+(o+72)>>2]|0;if((n|0)!=0){Yg(n);o=c[(c[b>>2]|0)+ -12>>2]|0}a[g>>0]=1;p=c[b+(o+28)>>2]|0;q=p+4|0;c[q>>2]=(c[q>>2]|0)+1;if(!((c[3048]|0)==-1)){c[l>>2]=12192;c[l+4>>2]=208;c[l+8>>2]=0;cg(12192,l)}o=(c[12196>>2]|0)+ -1|0;n=c[p+8>>2]|0;if((c[p+12>>2]|0)-n>>2>>>0>o>>>0?(k=c[n+(o<<2)>>2]|0,(k|0)!=0):0){t=c[q>>2]|0;c[q>>2]=t+ -1;if((t|0)==0){lc[c[(c[p>>2]|0)+8>>2]&255](p)}r=c[(c[b>>2]|0)+ -12>>2]|0;n=c[b+(r+24)>>2]|0;o=b+r|0;p=b+(r+76)|0;q=c[p>>2]|0;do{if((q|0)==-1){r=c[b+(r+28)>>2]|0;q=r+4|0;c[q>>2]=(c[q>>2]|0)+1;if(!((c[3364]|0)==-1)){c[l>>2]=13456;c[l+4>>2]=208;c[l+8>>2]=0;cg(13456,l)}s=(c[13460>>2]|0)+ -1|0;t=c[r+8>>2]|0;if((c[r+12>>2]|0)-t>>2>>>0>s>>>0?(m=c[t+(s<<2)>>2]|0,(m|0)!=0):0){m=xc[c[(c[m>>2]|0)+28>>2]&63](m,32)|0;t=c[q>>2]|0;c[q>>2]=t+ -1;if((t|0)==0){lc[c[(c[r>>2]|0)+8>>2]&255](r)}q=m<<24>>24;c[p>>2]=q;break}t=Xa(4)|0;c[t>>2]=21304;wb(t|0,21376,196)}}while(0);t=q&255;s=c[(c[k>>2]|0)+28>>2]|0;c[j>>2]=n;c[l+0>>2]=c[j+0>>2];ic[s&63](f,k,l,o,t,d,e);if((c[f>>2]|0)!=0){break}t=c[(c[b>>2]|0)+ -12>>2]|0;qg(b+t|0,c[b+(t+16)>>2]|5);break}t=Xa(4)|0;c[t>>2]=21304;wb(t|0,21376,196)}}while(0);gh(g);i=h;return b|0}function lh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;f=e;a[f>>0]=0;c[f+4>>2]=b;h=c[b>>2]|0;g=c[h+ -12>>2]|0;do{if((c[b+(g+16)>>2]|0)==0){j=c[b+(g+72)>>2]|0;if((j|0)!=0){Yg(j);g=c[b>>2]|0;h=g;g=c[g+ -12>>2]|0}a[f>>0]=1;g=c[b+(g+24)>>2]|0;if((g|0)!=0){j=g+24|0;h=c[j>>2]|0;if((h|0)!=(c[g+28>>2]|0)){c[j>>2]=h+1;a[h>>0]=d;break}if(!((xc[c[(c[g>>2]|0)+52>>2]&63](g,d&255)|0)==-1)){break}h=c[b>>2]|0}j=c[h+ -12>>2]|0;qg(b+j|0,c[b+(j+16)>>2]|1)}}while(0);gh(f);i=e;return}function mh(a){a=a|0;var b=0;b=i;rg(a+4|0);if((a|0)==0){i=b;return}vn(a);i=b;return}function nh(a){a=a|0;var b=0;b=i;rg(a+4|0);i=b;return}function oh(a){a=a|0;var b=0,d=0,e=0;b=i;e=c[(c[a>>2]|0)+ -12>>2]|0;d=a+e|0;rg(a+(e+4)|0);if((d|0)==0){i=b;return}vn(d);i=b;return}function ph(a){a=a|0;var b=0;b=i;rg(a+((c[(c[a>>2]|0)+ -12>>2]|0)+4)|0);i=b;return}function qh(a){a=a|0;var b=0,d=0,e=0;b=i;a=a+4|0;d=c[a>>2]|0;e=c[(c[d>>2]|0)+ -12>>2]|0;if((c[d+(e+24)>>2]|0)==0){i=b;return}if((c[d+(e+16)>>2]|0)!=0){i=b;return}if((c[d+(e+4)>>2]&8192|0)==0){i=b;return}if(Ya()|0){i=b;return}e=c[a>>2]|0;e=c[e+((c[(c[e>>2]|0)+ -12>>2]|0)+24)>>2]|0;if(!((oc[c[(c[e>>2]|0)+24>>2]&127](e)|0)==-1)){i=b;return}d=c[a>>2]|0;e=c[(c[d>>2]|0)+ -12>>2]|0;qg(d+e|0,c[d+(e+16)>>2]|1);i=b;return}function rh(a){a=a|0;return 10944}function sh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;d=i;if((e|0)==1){eg(b,10960,35);i=d;return}g=Nb(e|0)|0;e=Jn(g|0)|0;if(e>>>0>4294967279){dg()}do{if(e>>>0<11){a[b>>0]=e<<1;k=b+1|0}else{h=e+16&-16;j=(h|0)==0?1:h;while(1){k=un(j)|0;if((k|0)!=0){f=12;break}k=c[5666]|0;c[5666]=k+0;if((k|0)==0){break}sc[k&31]()}if((f|0)==12){c[b+8>>2]=k;c[b>>2]=h|1;c[b+4>>2]=e;break}k=Xa(4)|0;c[k>>2]=22680;wb(k|0,22728,206)}}while(0);Ln(k|0,g|0,e|0)|0;a[k+e>>0]=0;i=d;return}function th(a){a=a|0;return}function uh(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)<0){vn((c[d>>2]|0)+ -12|0)}Rb(a|0);vn(a);i=b;return}function vh(a){a=a|0;var b=0,d=0,e=0,f=0;b=i;c[a>>2]=9928;d=a+4|0;f=(c[d>>2]|0)+ -4|0;e=c[f>>2]|0;c[f>>2]=e+ -1;if((e+ -1|0)>=0){Rb(a|0);i=b;return}vn((c[d>>2]|0)+ -12|0);Rb(a|0);i=b;return}function wh(a){a=a|0;var b=0;b=i;rg(a);if((a|0)!=0){vn(a)}i=b;return}function xh(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function yh(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function zh(a){a=a|0;return}function Ah(a){a=a|0;return}function Bh(b,c,d,e,f){b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0;b=i;a:do{if((e|0)==(f|0)){g=6}else{while(1){if((c|0)==(d|0)){d=-1;break a}h=a[c>>0]|0;j=a[e>>0]|0;if(h<<24>>24<j<<24>>24){d=-1;break a}if(j<<24>>24<h<<24>>24){d=1;break a}c=c+1|0;e=e+1|0;if((e|0)==(f|0)){g=6;break}}}}while(0);if((g|0)==6){d=(c|0)!=(d|0)&1}i=b;return d|0}function Ch(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;d=i;g=e;j=f-g|0;if(j>>>0>4294967279){dg()}do{if(j>>>0<11){a[b>>0]=j<<1;m=b+1|0}else{k=j+16&-16;l=(k|0)==0?1:k;while(1){m=un(l)|0;if((m|0)!=0){h=11;break}m=c[5666]|0;c[5666]=m+0;if((m|0)==0){break}sc[m&31]()}if((h|0)==11){c[b+8>>2]=m;c[b>>2]=k|1;c[b+4>>2]=j;break}m=Xa(4)|0;c[m>>2]=22680;wb(m|0,22728,206)}}while(0);if((e|0)==(f|0)){a[m>>0]=0;i=d;return}else{b=m}while(1){a[b>>0]=a[e>>0]|0;e=e+1|0;if((e|0)==(f|0)){break}else{b=b+1|0}}m=m+(f+(0-g))|0;a[m>>0]=0;i=d;return}function Dh(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0;b=i;if((c|0)==(d|0)){e=0;i=b;return e|0}else{e=0}do{e=(a[c>>0]|0)+(e<<4)|0;f=e&-268435456;e=(f>>>24|f)^e;c=c+1|0}while((c|0)!=(d|0));i=b;return e|0}function Eh(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Fh(a){a=a|0;return}function Gh(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0;a=i;a:do{if((e|0)==(f|0)){g=6}else{while(1){if((b|0)==(d|0)){d=-1;break a}h=c[b>>2]|0;j=c[e>>2]|0;if((h|0)<(j|0)){d=-1;break a}if((j|0)<(h|0)){d=1;break a}b=b+4|0;e=e+4|0;if((e|0)==(f|0)){g=6;break}}}}while(0);if((g|0)==6){d=(b|0)!=(d|0)&1}i=a;return d|0}function Hh(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;d=i;h=e;k=f-h|0;j=k>>2;if(j>>>0>1073741807){dg()}do{if(j>>>0<2){a[b>>0]=k>>>1;m=b+4|0}else{k=j+4&-4;l=k<<2;l=(l|0)==0?1:l;while(1){m=un(l)|0;if((m|0)!=0){g=11;break}m=c[5666]|0;c[5666]=m+0;if((m|0)==0){break}sc[m&31]()}if((g|0)==11){c[b+8>>2]=m;c[b>>2]=k|1;c[b+4>>2]=j;break}m=Xa(4)|0;c[m>>2]=22680;wb(m|0,22728,206)}}while(0);if((e|0)==(f|0)){c[m>>2]=0;i=d;return}b=f+ -4+(0-h)|0;g=m;while(1){c[g>>2]=c[e>>2];e=e+4|0;if((e|0)==(f|0)){break}else{g=g+4|0}}m=m+((b>>>2)+1<<2)|0;c[m>>2]=0;i=d;return}function Ih(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;a=i;if((b|0)==(d|0)){e=0;i=a;return e|0}else{e=0}do{e=(c[b>>2]|0)+(e<<4)|0;f=e&-268435456;e=(f>>>24|f)^e;b=b+4|0}while((b|0)!=(d|0));i=a;return e|0}function Jh(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Kh(a){a=a|0;return}function Lh(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;k=i;i=i+64|0;p=k;u=k+48|0;q=k+52|0;t=k+56|0;s=k+16|0;r=k+12|0;l=k+24|0;if((c[g+4>>2]&1|0)==0){c[q>>2]=-1;l=c[(c[d>>2]|0)+16>>2]|0;c[s>>2]=c[e>>2];c[r>>2]=c[f>>2];c[u+0>>2]=c[s+0>>2];c[p+0>>2]=c[r+0>>2];ic[l&63](t,d,u,p,g,h,q);l=c[t>>2]|0;c[e>>2]=l;e=c[q>>2]|0;if((e|0)==0){a[j>>0]=0}else if((e|0)==1){a[j>>0]=1}else{a[j>>0]=1;c[h>>2]=4}c[b>>2]=l;i=k;return}q=g+28|0;r=c[q>>2]|0;d=r+4|0;c[d>>2]=(c[d>>2]|0)+1;if(!((c[3364]|0)==-1)){c[p>>2]=13456;c[p+4>>2]=208;c[p+8>>2]=0;cg(13456,p)}s=(c[13460>>2]|0)+ -1|0;t=c[r+8>>2]|0;if((c[r+12>>2]|0)-t>>2>>>0>s>>>0?(o=c[t+(s<<2)>>2]|0,(o|0)!=0):0){u=r+4|0;d=c[u>>2]|0;c[u>>2]=d+ -1;if((d|0)==0){lc[c[(c[r>>2]|0)+8>>2]&255](r)}q=c[q>>2]|0;d=q+4|0;c[d>>2]=(c[d>>2]|0)+1;if(!((c[3400]|0)==-1)){c[p>>2]=13600;c[p+4>>2]=208;c[p+8>>2]=0;cg(13600,p)}p=(c[13604>>2]|0)+ -1|0;r=c[q+8>>2]|0;if((c[q+12>>2]|0)-r>>2>>>0>p>>>0?(n=c[r+(p<<2)>>2]|0,(n|0)!=0):0){u=q+4|0;d=c[u>>2]|0;c[u>>2]=d+ -1;if((d|0)==0){lc[c[(c[q>>2]|0)+8>>2]&255](q)}mc[c[(c[n>>2]|0)+24>>2]&127](l,n);d=l+12|0;mc[c[(c[n>>2]|0)+28>>2]&127](d,n);a[j>>0]=(Mh(e,c[f>>2]|0,l,l+24|0,o,h,1)|0)==(l|0)&1;c[b>>2]=c[e>>2];if(!((a[d>>0]&1)==0)?(m=c[l+20>>2]|0,(m|0)!=0):0){vn(m)}if((a[l>>0]&1)==0){i=k;return}b=c[l+8>>2]|0;if((b|0)==0){i=k;return}vn(b);i=k;return}d=Xa(4)|0;c[d>>2]=21304;wb(d|0,21376,196)}d=Xa(4)|0;c[d>>2]=21304;wb(d|0,21376,196)}function Mh(b,e,f,g,h,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;m=i;i=i+112|0;o=m;t=(g-f|0)/12|0;if(t>>>0>100){o=un(t)|0;if((o|0)==0){A=Xa(4)|0;c[A>>2]=22680;wb(A|0,22728,206)}else{l=o}}else{l=0}p=(f|0)==(g|0);if(p){u=0}else{q=f;u=0;r=o;while(1){s=a[q>>0]|0;if((s&1)==0){s=(s&255)>>>1}else{s=c[q+4>>2]|0}if((s|0)==0){a[r>>0]=2;u=u+1|0;t=t+ -1|0}else{a[r>>0]=1}q=q+12|0;if((q|0)==(g|0)){break}else{r=r+1|0}}}q=0;a:while(1){v=(t|0)!=0;r=q;while(1){q=c[b>>2]|0;do{if((q|0)!=0){if((c[q+12>>2]|0)==(c[q+16>>2]|0)){if((oc[c[(c[q>>2]|0)+36>>2]&127](q)|0)==-1){c[b>>2]=0;q=0;break}else{q=c[b>>2]|0;break}}}else{q=0}}while(0);w=(q|0)==0;if((e|0)!=0){if((c[e+12>>2]|0)==(c[e+16>>2]|0)){A=(oc[c[(c[e>>2]|0)+36>>2]&127](e)|0)==-1;q=A?0:e;e=A?0:e}else{q=e}}else{q=0;e=0}s=(q|0)==0;x=c[b>>2]|0;if(!((w^s)&v)){break a}q=c[x+12>>2]|0;if((q|0)==(c[x+16>>2]|0)){q=oc[c[(c[x>>2]|0)+36>>2]&127](x)|0}else{q=d[q>>0]|0}s=q&255;if(!k){s=xc[c[(c[h>>2]|0)+12>>2]&63](h,s)|0}q=r+1|0;if(p){r=q}else{break}}b:do{if(k){x=0;v=f;w=o;while(1){do{if((a[w>>0]|0)==1){y=a[v>>0]|0;z=(y&1)==0;if(z){A=v+1|0}else{A=c[v+8>>2]|0}if(!(s<<24>>24==(a[A+r>>0]|0))){a[w>>0]=0;t=t+ -1|0;break}if(z){x=(y&255)>>>1}else{x=c[v+4>>2]|0}if((x|0)==(q|0)){a[w>>0]=2;x=1;u=u+1|0;t=t+ -1|0}else{x=1}}}while(0);v=v+12|0;if((v|0)==(g|0)){break b}w=w+1|0}}else{x=0;v=f;w=o;while(1){do{if((a[w>>0]|0)==1){if((a[v>>0]&1)==0){y=v+1|0}else{y=c[v+8>>2]|0}if(!(s<<24>>24==(xc[c[(c[h>>2]|0)+12>>2]&63](h,a[y+r>>0]|0)|0)<<24>>24)){a[w>>0]=0;t=t+ -1|0;break}x=a[v>>0]|0;if((x&1)==0){x=(x&255)>>>1}else{x=c[v+4>>2]|0}if((x|0)==(q|0)){a[w>>0]=2;x=1;u=u+1|0;t=t+ -1|0}else{x=1}}}while(0);v=v+12|0;if((v|0)==(g|0)){break b}w=w+1|0}}}while(0);if(!x){continue}v=c[b>>2]|0;s=v+12|0;r=c[s>>2]|0;if((r|0)==(c[v+16>>2]|0)){oc[c[(c[v>>2]|0)+40>>2]&127](v)|0}else{c[s>>2]=r+1}if((t+u|0)>>>0<2){continue}else{s=f;r=o}while(1){if((a[r>>0]|0)==2){v=a[s>>0]|0;if((v&1)==0){v=(v&255)>>>1}else{v=c[s+4>>2]|0}if((v|0)!=(q|0)){a[r>>0]=0;u=u+ -1|0}}s=s+12|0;if((s|0)==(g|0)){continue a}else{r=r+1|0}}}do{if((x|0)!=0){if((c[x+12>>2]|0)==(c[x+16>>2]|0)){if((oc[c[(c[x>>2]|0)+36>>2]&127](x)|0)==-1){c[b>>2]=0;x=0;break}else{x=c[b>>2]|0;break}}}else{x=0}}while(0);h=(x|0)==0;do{if(!s){if((c[q+12>>2]|0)!=(c[q+16>>2]|0)){if(h){break}else{n=85;break}}if(!((oc[c[(c[q>>2]|0)+36>>2]&127](q)|0)==-1)){if(!h){n=85}}else{n=83}}else{n=83}}while(0);if((n|0)==83?h:0){n=85}if((n|0)==85){c[j>>2]=c[j>>2]|2}c:do{if(!p){if((a[o>>0]|0)==2){g=f}else{while(1){f=f+12|0;o=o+1|0;if((f|0)==(g|0)){n=90;break c}if((a[o>>0]|0)==2){g=f;break}}}}else{n=90}}while(0);if((n|0)==90){c[j>>2]=c[j>>2]|4}if((l|0)==0){i=m;return g|0}vn(l);i=m;return g|0}function Nh(b,e,f,g,h,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=i;i=i+224|0;v=e+198|0;u=e+196|0;n=e+16|0;o=e+4|0;q=e+192|0;s=e+32|0;r=e;t=e+28|0;y=c[f>>2]|0;A=c[g>>2]|0;g=c[h+4>>2]&74;if((g|0)==8){g=16}else if((g|0)==0){g=0}else if((g|0)==64){g=8}else{g=10}mi(n,h,v,u);c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;hg(o,10);if((a[o>>0]&1)==0){B=o+1|0;w=B;f=o+8|0}else{B=o+8|0;w=o+1|0;f=B;B=c[B>>2]|0}c[q>>2]=B;c[r>>2]=s;c[t>>2]=0;h=o+4|0;x=a[u>>0]|0;u=o+8|0;a:while(1){if((y|0)!=0){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}z=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(z){break}else{break a}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!z){break a}}else{l=19}}else{l=19}}while(0);if((l|0)==19){l=0;if(z){A=0;break}else{A=0}}D=a[o>>0]|0;C=(D&1)==0;if(C){E=(D&255)>>>1}else{E=c[h>>2]|0}if(((c[q>>2]|0)-B|0)==(E|0)){if(C){B=(D&255)>>>1;E=(D&255)>>>1;D=B<<1}else{B=c[h>>2]|0;E=c[h>>2]|0;D=B<<1}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=B<<2;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);E=a[o>>0]|0;if((E&1)==0){D=10}else{D=c[o>>2]|0;E=D&255;D=(D&-2)+ -1|0}C=(E&1)==0;if(C){E=(E&255)>>>1}else{E=c[h>>2]|0}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=D<<1;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);if((a[o>>0]&1)==0){C=w}else{C=c[f>>2]|0}c[q>>2]=C+B;B=C}D=y+12|0;E=c[D>>2]|0;C=y+16|0;if((E|0)==(c[C>>2]|0)){E=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{E=d[E>>0]|0}if((Xh(E&255,g,B,q,t,x,n,s,r,v)|0)!=0){break}z=c[D>>2]|0;if((z|0)==(c[C>>2]|0)){oc[c[(c[y>>2]|0)+40>>2]&127](y)|0;continue}else{c[D>>2]=z+1;continue}}v=a[n>>0]|0;if((v&1)==0){v=(v&255)>>>1}else{v=c[n+4>>2]|0}if((v|0)!=0?(p=c[r>>2]|0,(p-s|0)<160):0){E=c[t>>2]|0;c[r>>2]=p+4;c[p>>2]=E}c[k>>2]=Nm(B,c[q>>2]|0,j,g)|0;qk(n,s,c[r>>2]|0,j);if(!z){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}p=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(p){break}else{l=71;break}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!p){l=71}}else{l=69}}else{l=69}}while(0);if((l|0)==69?p:0){l=71}if((l|0)==71){c[j>>2]=c[j>>2]|2}c[b>>2]=y;if(!((a[o>>0]&1)==0)?(m=c[u>>2]|0,(m|0)!=0):0){vn(m)}if((a[n>>0]&1)==0){i=e;return}l=c[n+8>>2]|0;if((l|0)==0){i=e;return}vn(l);i=e;return}function Oh(b,e,f,g,h,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=i;i=i+224|0;v=e+198|0;u=e+196|0;n=e+16|0;o=e+4|0;q=e+192|0;s=e+32|0;r=e;t=e+28|0;y=c[f>>2]|0;A=c[g>>2]|0;g=c[h+4>>2]&74;if((g|0)==0){g=0}else if((g|0)==8){g=16}else if((g|0)==64){g=8}else{g=10}mi(n,h,v,u);c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;hg(o,10);if((a[o>>0]&1)==0){B=o+1|0;w=B;f=o+8|0}else{B=o+8|0;w=o+1|0;f=B;B=c[B>>2]|0}c[q>>2]=B;c[r>>2]=s;c[t>>2]=0;h=o+4|0;x=a[u>>0]|0;u=o+8|0;a:while(1){if((y|0)!=0){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}z=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(z){break}else{break a}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!z){break a}}else{l=19}}else{l=19}}while(0);if((l|0)==19){l=0;if(z){A=0;break}else{A=0}}D=a[o>>0]|0;C=(D&1)==0;if(C){E=(D&255)>>>1}else{E=c[h>>2]|0}if(((c[q>>2]|0)-B|0)==(E|0)){if(C){B=(D&255)>>>1;E=(D&255)>>>1;D=B<<1}else{B=c[h>>2]|0;E=c[h>>2]|0;D=B<<1}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=B<<2;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);E=a[o>>0]|0;if((E&1)==0){D=10}else{D=c[o>>2]|0;E=D&255;D=(D&-2)+ -1|0}C=(E&1)==0;if(C){E=(E&255)>>>1}else{E=c[h>>2]|0}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=D<<1;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);if((a[o>>0]&1)==0){C=w}else{C=c[f>>2]|0}c[q>>2]=C+B;B=C}D=y+12|0;E=c[D>>2]|0;C=y+16|0;if((E|0)==(c[C>>2]|0)){E=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{E=d[E>>0]|0}if((Xh(E&255,g,B,q,t,x,n,s,r,v)|0)!=0){break}z=c[D>>2]|0;if((z|0)==(c[C>>2]|0)){oc[c[(c[y>>2]|0)+40>>2]&127](y)|0;continue}else{c[D>>2]=z+1;continue}}v=a[n>>0]|0;if((v&1)==0){v=(v&255)>>>1}else{v=c[n+4>>2]|0}if((v|0)!=0?(p=c[r>>2]|0,(p-s|0)<160):0){E=c[t>>2]|0;c[r>>2]=p+4;c[p>>2]=E}D=Mm(B,c[q>>2]|0,j,g)|0;E=k;c[E>>2]=D;c[E+4>>2]=I;qk(n,s,c[r>>2]|0,j);if(!z){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}p=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(p){break}else{l=71;break}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!p){l=71}}else{l=69}}else{l=69}}while(0);if((l|0)==69?p:0){l=71}if((l|0)==71){c[j>>2]=c[j>>2]|2}c[b>>2]=y;if(!((a[o>>0]&1)==0)?(m=c[u>>2]|0,(m|0)!=0):0){vn(m)}if((a[n>>0]&1)==0){i=e;return}l=c[n+8>>2]|0;if((l|0)==0){i=e;return}vn(l);i=e;return}function Ph(e,f,g,h,j,k,l){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;f=i;i=i+224|0;w=f+198|0;v=f+196|0;o=f+16|0;p=f+4|0;r=f+192|0;t=f+32|0;s=f;u=f+28|0;z=c[g>>2]|0;B=c[h>>2]|0;h=c[j+4>>2]&74;if((h|0)==8){h=16}else if((h|0)==64){h=8}else if((h|0)==0){h=0}else{h=10}mi(o,j,w,v);c[p+0>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;hg(p,10);if((a[p>>0]&1)==0){C=p+1|0;x=C;g=p+8|0}else{C=p+8|0;x=p+1|0;g=C;C=c[C>>2]|0}c[r>>2]=C;c[s>>2]=t;c[u>>2]=0;j=p+4|0;y=a[v>>0]|0;v=p+8|0;a:while(1){if((z|0)!=0){if((c[z+12>>2]|0)==(c[z+16>>2]|0)){F=(oc[c[(c[z>>2]|0)+36>>2]&127](z)|0)==-1;z=F?0:z}}else{z=0}A=(z|0)==0;do{if((B|0)!=0){if((c[B+12>>2]|0)!=(c[B+16>>2]|0)){if(A){break}else{break a}}if(!((oc[c[(c[B>>2]|0)+36>>2]&127](B)|0)==-1)){if(!A){break a}}else{m=19}}else{m=19}}while(0);if((m|0)==19){m=0;if(A){B=0;break}else{B=0}}E=a[p>>0]|0;D=(E&1)==0;if(D){F=(E&255)>>>1}else{F=c[j>>2]|0}if(((c[r>>2]|0)-C|0)==(F|0)){if(D){C=(E&255)>>>1;F=(E&255)>>>1;E=C<<1}else{C=c[j>>2]|0;F=c[j>>2]|0;E=C<<1}do{if(!(F>>>0<E>>>0)){if(D){a[p+E+1>>0]=0;a[p>>0]=C<<2;break}else{a[(c[v>>2]|0)+E>>0]=0;c[j>>2]=E;break}}else{hg(p,E-F|0)}}while(0);F=a[p>>0]|0;if((F&1)==0){E=10}else{E=c[p>>2]|0;F=E&255;E=(E&-2)+ -1|0}D=(F&1)==0;if(D){F=(F&255)>>>1}else{F=c[j>>2]|0}do{if(!(F>>>0<E>>>0)){if(D){a[p+E+1>>0]=0;a[p>>0]=E<<1;break}else{a[(c[v>>2]|0)+E>>0]=0;c[j>>2]=E;break}}else{hg(p,E-F|0)}}while(0);if((a[p>>0]&1)==0){D=x}else{D=c[g>>2]|0}c[r>>2]=D+C;C=D}E=z+12|0;F=c[E>>2]|0;D=z+16|0;if((F|0)==(c[D>>2]|0)){F=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{F=d[F>>0]|0}if((Xh(F&255,h,C,r,u,y,o,t,s,w)|0)!=0){break}A=c[E>>2]|0;if((A|0)==(c[D>>2]|0)){oc[c[(c[z>>2]|0)+40>>2]&127](z)|0;continue}else{c[E>>2]=A+1;continue}}w=a[o>>0]|0;if((w&1)==0){w=(w&255)>>>1}else{w=c[o+4>>2]|0}if((w|0)!=0?(q=c[s>>2]|0,(q-t|0)<160):0){F=c[u>>2]|0;c[s>>2]=q+4;c[q>>2]=F}b[l>>1]=Lm(C,c[r>>2]|0,k,h)|0;qk(o,t,c[s>>2]|0,k);if(!A){if((c[z+12>>2]|0)==(c[z+16>>2]|0)){F=(oc[c[(c[z>>2]|0)+36>>2]&127](z)|0)==-1;z=F?0:z}}else{z=0}q=(z|0)==0;do{if((B|0)!=0){if((c[B+12>>2]|0)!=(c[B+16>>2]|0)){if(q){break}else{m=71;break}}if(!((oc[c[(c[B>>2]|0)+36>>2]&127](B)|0)==-1)){if(!q){m=71}}else{m=69}}else{m=69}}while(0);if((m|0)==69?q:0){m=71}if((m|0)==71){c[k>>2]=c[k>>2]|2}c[e>>2]=z;if(!((a[p>>0]&1)==0)?(n=c[v>>2]|0,(n|0)!=0):0){vn(n)}if((a[o>>0]&1)==0){i=f;return}m=c[o+8>>2]|0;if((m|0)==0){i=f;return}vn(m);i=f;return}function Qh(b,e,f,g,h,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=i;i=i+224|0;v=e+198|0;u=e+196|0;n=e+16|0;o=e+4|0;q=e+192|0;s=e+32|0;r=e;t=e+28|0;y=c[f>>2]|0;A=c[g>>2]|0;g=c[h+4>>2]&74;if((g|0)==64){g=8}else if((g|0)==8){g=16}else if((g|0)==0){g=0}else{g=10}mi(n,h,v,u);c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;hg(o,10);if((a[o>>0]&1)==0){B=o+1|0;w=B;f=o+8|0}else{B=o+8|0;w=o+1|0;f=B;B=c[B>>2]|0}c[q>>2]=B;c[r>>2]=s;c[t>>2]=0;h=o+4|0;x=a[u>>0]|0;u=o+8|0;a:while(1){if((y|0)!=0){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}z=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(z){break}else{break a}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!z){break a}}else{l=19}}else{l=19}}while(0);if((l|0)==19){l=0;if(z){A=0;break}else{A=0}}D=a[o>>0]|0;C=(D&1)==0;if(C){E=(D&255)>>>1}else{E=c[h>>2]|0}if(((c[q>>2]|0)-B|0)==(E|0)){if(C){B=(D&255)>>>1;E=(D&255)>>>1;D=B<<1}else{B=c[h>>2]|0;E=c[h>>2]|0;D=B<<1}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=B<<2;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);E=a[o>>0]|0;if((E&1)==0){D=10}else{D=c[o>>2]|0;E=D&255;D=(D&-2)+ -1|0}C=(E&1)==0;if(C){E=(E&255)>>>1}else{E=c[h>>2]|0}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=D<<1;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);if((a[o>>0]&1)==0){C=w}else{C=c[f>>2]|0}c[q>>2]=C+B;B=C}D=y+12|0;E=c[D>>2]|0;C=y+16|0;if((E|0)==(c[C>>2]|0)){E=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{E=d[E>>0]|0}if((Xh(E&255,g,B,q,t,x,n,s,r,v)|0)!=0){break}z=c[D>>2]|0;if((z|0)==(c[C>>2]|0)){oc[c[(c[y>>2]|0)+40>>2]&127](y)|0;continue}else{c[D>>2]=z+1;continue}}v=a[n>>0]|0;if((v&1)==0){v=(v&255)>>>1}else{v=c[n+4>>2]|0}if((v|0)!=0?(p=c[r>>2]|0,(p-s|0)<160):0){E=c[t>>2]|0;c[r>>2]=p+4;c[p>>2]=E}c[k>>2]=Km(B,c[q>>2]|0,j,g)|0;qk(n,s,c[r>>2]|0,j);if(!z){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}p=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(p){break}else{l=71;break}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!p){l=71}}else{l=69}}else{l=69}}while(0);if((l|0)==69?p:0){l=71}if((l|0)==71){c[j>>2]=c[j>>2]|2}c[b>>2]=y;if(!((a[o>>0]&1)==0)?(m=c[u>>2]|0,(m|0)!=0):0){vn(m)}if((a[n>>0]&1)==0){i=e;return}l=c[n+8>>2]|0;if((l|0)==0){i=e;return}vn(l);i=e;return}function Rh(b,e,f,g,h,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=i;i=i+224|0;v=e+198|0;u=e+196|0;n=e+16|0;o=e+4|0;q=e+192|0;s=e+32|0;r=e;t=e+28|0;y=c[f>>2]|0;A=c[g>>2]|0;g=c[h+4>>2]&74;if((g|0)==8){g=16}else if((g|0)==0){g=0}else if((g|0)==64){g=8}else{g=10}mi(n,h,v,u);c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;hg(o,10);if((a[o>>0]&1)==0){B=o+1|0;w=B;f=o+8|0}else{B=o+8|0;w=o+1|0;f=B;B=c[B>>2]|0}c[q>>2]=B;c[r>>2]=s;c[t>>2]=0;h=o+4|0;x=a[u>>0]|0;u=o+8|0;a:while(1){if((y|0)!=0){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}z=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(z){break}else{break a}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!z){break a}}else{l=19}}else{l=19}}while(0);if((l|0)==19){l=0;if(z){A=0;break}else{A=0}}D=a[o>>0]|0;C=(D&1)==0;if(C){E=(D&255)>>>1}else{E=c[h>>2]|0}if(((c[q>>2]|0)-B|0)==(E|0)){if(C){B=(D&255)>>>1;E=(D&255)>>>1;D=B<<1}else{B=c[h>>2]|0;E=c[h>>2]|0;D=B<<1}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=B<<2;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);E=a[o>>0]|0;if((E&1)==0){D=10}else{D=c[o>>2]|0;E=D&255;D=(D&-2)+ -1|0}C=(E&1)==0;if(C){E=(E&255)>>>1}else{E=c[h>>2]|0}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=D<<1;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);if((a[o>>0]&1)==0){C=w}else{C=c[f>>2]|0}c[q>>2]=C+B;B=C}D=y+12|0;E=c[D>>2]|0;C=y+16|0;if((E|0)==(c[C>>2]|0)){E=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{E=d[E>>0]|0}if((Xh(E&255,g,B,q,t,x,n,s,r,v)|0)!=0){break}z=c[D>>2]|0;if((z|0)==(c[C>>2]|0)){oc[c[(c[y>>2]|0)+40>>2]&127](y)|0;continue}else{c[D>>2]=z+1;continue}}v=a[n>>0]|0;if((v&1)==0){v=(v&255)>>>1}else{v=c[n+4>>2]|0}if((v|0)!=0?(p=c[r>>2]|0,(p-s|0)<160):0){E=c[t>>2]|0;c[r>>2]=p+4;c[p>>2]=E}c[k>>2]=Jm(B,c[q>>2]|0,j,g)|0;qk(n,s,c[r>>2]|0,j);if(!z){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}p=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(p){break}else{l=71;break}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!p){l=71}}else{l=69}}else{l=69}}while(0);if((l|0)==69?p:0){l=71}if((l|0)==71){c[j>>2]=c[j>>2]|2}c[b>>2]=y;if(!((a[o>>0]&1)==0)?(m=c[u>>2]|0,(m|0)!=0):0){vn(m)}if((a[n>>0]&1)==0){i=e;return}l=c[n+8>>2]|0;if((l|0)==0){i=e;return}vn(l);i=e;return}function Sh(b,e,f,g,h,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=i;i=i+224|0;v=e+198|0;u=e+196|0;n=e+16|0;o=e+4|0;q=e+192|0;s=e+32|0;r=e;t=e+28|0;y=c[f>>2]|0;A=c[g>>2]|0;g=c[h+4>>2]&74;if((g|0)==0){g=0}else if((g|0)==8){g=16}else if((g|0)==64){g=8}else{g=10}mi(n,h,v,u);c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;hg(o,10);if((a[o>>0]&1)==0){B=o+1|0;w=B;f=o+8|0}else{B=o+8|0;w=o+1|0;f=B;B=c[B>>2]|0}c[q>>2]=B;c[r>>2]=s;c[t>>2]=0;h=o+4|0;x=a[u>>0]|0;u=o+8|0;a:while(1){if((y|0)!=0){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}z=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(z){break}else{break a}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!z){break a}}else{l=19}}else{l=19}}while(0);if((l|0)==19){l=0;if(z){A=0;break}else{A=0}}D=a[o>>0]|0;C=(D&1)==0;if(C){E=(D&255)>>>1}else{E=c[h>>2]|0}if(((c[q>>2]|0)-B|0)==(E|0)){if(C){B=(D&255)>>>1;E=(D&255)>>>1;D=B<<1}else{B=c[h>>2]|0;E=c[h>>2]|0;D=B<<1}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=B<<2;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);E=a[o>>0]|0;if((E&1)==0){D=10}else{D=c[o>>2]|0;E=D&255;D=(D&-2)+ -1|0}C=(E&1)==0;if(C){E=(E&255)>>>1}else{E=c[h>>2]|0}do{if(!(E>>>0<D>>>0)){if(C){a[o+D+1>>0]=0;a[o>>0]=D<<1;break}else{a[(c[u>>2]|0)+D>>0]=0;c[h>>2]=D;break}}else{hg(o,D-E|0)}}while(0);if((a[o>>0]&1)==0){C=w}else{C=c[f>>2]|0}c[q>>2]=C+B;B=C}D=y+12|0;E=c[D>>2]|0;C=y+16|0;if((E|0)==(c[C>>2]|0)){E=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{E=d[E>>0]|0}if((Xh(E&255,g,B,q,t,x,n,s,r,v)|0)!=0){break}z=c[D>>2]|0;if((z|0)==(c[C>>2]|0)){oc[c[(c[y>>2]|0)+40>>2]&127](y)|0;continue}else{c[D>>2]=z+1;continue}}v=a[n>>0]|0;if((v&1)==0){v=(v&255)>>>1}else{v=c[n+4>>2]|0}if((v|0)!=0?(p=c[r>>2]|0,(p-s|0)<160):0){E=c[t>>2]|0;c[r>>2]=p+4;c[p>>2]=E}D=Im(B,c[q>>2]|0,j,g)|0;E=k;c[E>>2]=D;c[E+4>>2]=I;qk(n,s,c[r>>2]|0,j);if(!z){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){E=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;y=E?0:y}}else{y=0}p=(y|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(p){break}else{l=71;break}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(!p){l=71}}else{l=69}}else{l=69}}while(0);if((l|0)==69?p:0){l=71}if((l|0)==71){c[j>>2]=c[j>>2]|2}c[b>>2]=y;if(!((a[o>>0]&1)==0)?(m=c[u>>2]|0,(m|0)!=0):0){vn(m)}if((a[n>>0]&1)==0){i=e;return}l=c[n+8>>2]|0;if((l|0)==0){i=e;return}vn(l);i=e;return}function Th(b,e,f,h,j,k,l){b=b|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;e=i;i=i+256|0;x=e+208|0;z=e+200|0;w=e+240|0;o=e;p=e+188|0;v=e+184|0;t=e+16|0;s=e+176|0;r=e+180|0;u=e+241|0;y=e+242|0;A=c[f>>2]|0;D=c[h>>2]|0;ni(o,j,x,z,w);c[p+0>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;hg(p,10);if((a[p>>0]&1)==0){E=p+1|0;h=E;f=p+8|0}else{E=p+8|0;h=p+1|0;f=E;E=c[E>>2]|0}c[v>>2]=E;c[s>>2]=t;c[r>>2]=0;a[u>>0]=1;a[y>>0]=69;j=p+4|0;z=a[z>>0]|0;B=a[w>>0]|0;w=p+8|0;a:while(1){if((A|0)!=0){if((c[A+12>>2]|0)==(c[A+16>>2]|0)){H=(oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1;A=H?0:A}}else{A=0}C=(A|0)==0;do{if((D|0)!=0){if((c[D+12>>2]|0)!=(c[D+16>>2]|0)){if(C){break}else{break a}}if(!((oc[c[(c[D>>2]|0)+36>>2]&127](D)|0)==-1)){if(!C){break a}}else{m=15}}else{m=15}}while(0);if((m|0)==15){m=0;if(C){D=0;break}else{D=0}}G=a[p>>0]|0;F=(G&1)==0;if(F){H=(G&255)>>>1}else{H=c[j>>2]|0}if(((c[v>>2]|0)-E|0)==(H|0)){if(F){E=(G&255)>>>1;G=(G&255)>>>1;H=E<<1}else{E=c[j>>2]|0;G=c[j>>2]|0;H=E<<1}do{if(!(G>>>0<H>>>0)){if(F){a[p+H+1>>0]=0;a[p>>0]=E<<2;break}else{a[(c[w>>2]|0)+H>>0]=0;c[j>>2]=H;break}}else{hg(p,H-G|0)}}while(0);H=a[p>>0]|0;if((H&1)==0){G=10}else{G=c[p>>2]|0;H=G&255;G=(G&-2)+ -1|0}F=(H&1)==0;if(F){H=(H&255)>>>1}else{H=c[j>>2]|0}do{if(!(H>>>0<G>>>0)){if(F){a[p+G+1>>0]=0;a[p>>0]=G<<1;break}else{a[(c[w>>2]|0)+G>>0]=0;c[j>>2]=G;break}}else{hg(p,G-H|0)}}while(0);if((a[p>>0]&1)==0){F=h}else{F=c[f>>2]|0}c[v>>2]=F+E;E=F}G=A+12|0;H=c[G>>2]|0;F=A+16|0;if((H|0)==(c[F>>2]|0)){H=oc[c[(c[A>>2]|0)+36>>2]&127](A)|0}else{H=d[H>>0]|0}if((oi(H&255,u,y,E,v,z,B,o,t,s,r,x)|0)!=0){break}C=c[G>>2]|0;if((C|0)==(c[F>>2]|0)){oc[c[(c[A>>2]|0)+40>>2]&127](A)|0;continue}else{c[G>>2]=C+1;continue}}x=a[o>>0]|0;if((x&1)==0){x=(x&255)>>>1}else{x=c[o+4>>2]|0}if(((x|0)!=0?(a[u>>0]|0)!=0:0)?(q=c[s>>2]|0,(q-t|0)<160):0){H=c[r>>2]|0;c[s>>2]=q+4;c[q>>2]=H}g[l>>2]=+Hm(E,c[v>>2]|0,k);qk(o,t,c[s>>2]|0,k);if(!C){if((c[A+12>>2]|0)==(c[A+16>>2]|0)){H=(oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1;A=H?0:A}}else{A=0}l=(A|0)==0;do{if((D|0)!=0){if((c[D+12>>2]|0)!=(c[D+16>>2]|0)){if(l){break}else{m=68;break}}if(!((oc[c[(c[D>>2]|0)+36>>2]&127](D)|0)==-1)){if(!l){m=68}}else{m=66}}else{m=66}}while(0);if((m|0)==66?l:0){m=68}if((m|0)==68){c[k>>2]=c[k>>2]|2}c[b>>2]=A;if(!((a[p>>0]&1)==0)?(n=c[w>>2]|0,(n|0)!=0):0){vn(n)}if((a[o>>0]&1)==0){i=e;return}m=c[o+8>>2]|0;if((m|0)==0){i=e;return}vn(m);i=e;return}function Uh(b,e,f,g,j,k,l){b=b|0;e=e|0;f=f|0;g=g|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;e=i;i=i+256|0;x=e+208|0;z=e+200|0;w=e+240|0;o=e;p=e+188|0;v=e+184|0;t=e+16|0;s=e+176|0;r=e+180|0;u=e+241|0;y=e+242|0;A=c[f>>2]|0;D=c[g>>2]|0;ni(o,j,x,z,w);c[p+0>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;hg(p,10);if((a[p>>0]&1)==0){E=p+1|0;g=E;f=p+8|0}else{E=p+8|0;g=p+1|0;f=E;E=c[E>>2]|0}c[v>>2]=E;c[s>>2]=t;c[r>>2]=0;a[u>>0]=1;a[y>>0]=69;j=p+4|0;z=a[z>>0]|0;B=a[w>>0]|0;w=p+8|0;a:while(1){if((A|0)!=0){if((c[A+12>>2]|0)==(c[A+16>>2]|0)){H=(oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1;A=H?0:A}}else{A=0}C=(A|0)==0;do{if((D|0)!=0){if((c[D+12>>2]|0)!=(c[D+16>>2]|0)){if(C){break}else{break a}}if(!((oc[c[(c[D>>2]|0)+36>>2]&127](D)|0)==-1)){if(!C){break a}}else{m=15}}else{m=15}}while(0);if((m|0)==15){m=0;if(C){D=0;break}else{D=0}}G=a[p>>0]|0;F=(G&1)==0;if(F){H=(G&255)>>>1}else{H=c[j>>2]|0}if(((c[v>>2]|0)-E|0)==(H|0)){if(F){E=(G&255)>>>1;G=(G&255)>>>1;H=E<<1}else{E=c[j>>2]|0;G=c[j>>2]|0;H=E<<1}do{if(!(G>>>0<H>>>0)){if(F){a[p+H+1>>0]=0;a[p>>0]=E<<2;break}else{a[(c[w>>2]|0)+H>>0]=0;c[j>>2]=H;break}}else{hg(p,H-G|0)}}while(0);H=a[p>>0]|0;if((H&1)==0){G=10}else{G=c[p>>2]|0;H=G&255;G=(G&-2)+ -1|0}F=(H&1)==0;if(F){H=(H&255)>>>1}else{H=c[j>>2]|0}do{if(!(H>>>0<G>>>0)){if(F){a[p+G+1>>0]=0;a[p>>0]=G<<1;break}else{a[(c[w>>2]|0)+G>>0]=0;c[j>>2]=G;break}}else{hg(p,G-H|0)}}while(0);if((a[p>>0]&1)==0){F=g}else{F=c[f>>2]|0}c[v>>2]=F+E;E=F}G=A+12|0;H=c[G>>2]|0;F=A+16|0;if((H|0)==(c[F>>2]|0)){H=oc[c[(c[A>>2]|0)+36>>2]&127](A)|0}else{H=d[H>>0]|0}if((oi(H&255,u,y,E,v,z,B,o,t,s,r,x)|0)!=0){break}C=c[G>>2]|0;if((C|0)==(c[F>>2]|0)){oc[c[(c[A>>2]|0)+40>>2]&127](A)|0;continue}else{c[G>>2]=C+1;continue}}x=a[o>>0]|0;if((x&1)==0){x=(x&255)>>>1}else{x=c[o+4>>2]|0}if(((x|0)!=0?(a[u>>0]|0)!=0:0)?(q=c[s>>2]|0,(q-t|0)<160):0){H=c[r>>2]|0;c[s>>2]=q+4;c[q>>2]=H}h[l>>3]=+Gm(E,c[v>>2]|0,k);qk(o,t,c[s>>2]|0,k);if(!C){if((c[A+12>>2]|0)==(c[A+16>>2]|0)){H=(oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1;A=H?0:A}}else{A=0}l=(A|0)==0;do{if((D|0)!=0){if((c[D+12>>2]|0)!=(c[D+16>>2]|0)){if(l){break}else{m=68;break}}if(!((oc[c[(c[D>>2]|0)+36>>2]&127](D)|0)==-1)){if(!l){m=68}}else{m=66}}else{m=66}}while(0);if((m|0)==66?l:0){m=68}if((m|0)==68){c[k>>2]=c[k>>2]|2}c[b>>2]=A;if(!((a[p>>0]&1)==0)?(n=c[w>>2]|0,(n|0)!=0):0){vn(n)}if((a[o>>0]&1)==0){i=e;return}m=c[o+8>>2]|0;if((m|0)==0){i=e;return}vn(m);i=e;return}function Vh(b,e,f,g,j,k,l){b=b|0;e=e|0;f=f|0;g=g|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;e=i;i=i+256|0;x=e+208|0;z=e+200|0;w=e+240|0;o=e;p=e+188|0;v=e+184|0;t=e+16|0;s=e+176|0;r=e+180|0;u=e+241|0;y=e+242|0;A=c[f>>2]|0;D=c[g>>2]|0;ni(o,j,x,z,w);c[p+0>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;hg(p,10);if((a[p>>0]&1)==0){E=p+1|0;g=E;f=p+8|0}else{E=p+8|0;g=p+1|0;f=E;E=c[E>>2]|0}c[v>>2]=E;c[s>>2]=t;c[r>>2]=0;a[u>>0]=1;a[y>>0]=69;j=p+4|0;z=a[z>>0]|0;B=a[w>>0]|0;w=p+8|0;a:while(1){if((A|0)!=0){if((c[A+12>>2]|0)==(c[A+16>>2]|0)){H=(oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1;A=H?0:A}}else{A=0}C=(A|0)==0;do{if((D|0)!=0){if((c[D+12>>2]|0)!=(c[D+16>>2]|0)){if(C){break}else{break a}}if(!((oc[c[(c[D>>2]|0)+36>>2]&127](D)|0)==-1)){if(!C){break a}}else{m=15}}else{m=15}}while(0);if((m|0)==15){m=0;if(C){D=0;break}else{D=0}}G=a[p>>0]|0;F=(G&1)==0;if(F){H=(G&255)>>>1}else{H=c[j>>2]|0}if(((c[v>>2]|0)-E|0)==(H|0)){if(F){E=(G&255)>>>1;G=(G&255)>>>1;H=E<<1}else{E=c[j>>2]|0;G=c[j>>2]|0;H=E<<1}do{if(!(G>>>0<H>>>0)){if(F){a[p+H+1>>0]=0;a[p>>0]=E<<2;break}else{a[(c[w>>2]|0)+H>>0]=0;c[j>>2]=H;break}}else{hg(p,H-G|0)}}while(0);H=a[p>>0]|0;if((H&1)==0){G=10}else{G=c[p>>2]|0;H=G&255;G=(G&-2)+ -1|0}F=(H&1)==0;if(F){H=(H&255)>>>1}else{H=c[j>>2]|0}do{if(!(H>>>0<G>>>0)){if(F){a[p+G+1>>0]=0;a[p>>0]=G<<1;break}else{a[(c[w>>2]|0)+G>>0]=0;c[j>>2]=G;break}}else{hg(p,G-H|0)}}while(0);if((a[p>>0]&1)==0){F=g}else{F=c[f>>2]|0}c[v>>2]=F+E;E=F}G=A+12|0;H=c[G>>2]|0;F=A+16|0;if((H|0)==(c[F>>2]|0)){H=oc[c[(c[A>>2]|0)+36>>2]&127](A)|0}else{H=d[H>>0]|0}if((oi(H&255,u,y,E,v,z,B,o,t,s,r,x)|0)!=0){break}C=c[G>>2]|0;if((C|0)==(c[F>>2]|0)){oc[c[(c[A>>2]|0)+40>>2]&127](A)|0;continue}else{c[G>>2]=C+1;continue}}x=a[o>>0]|0;if((x&1)==0){x=(x&255)>>>1}else{x=c[o+4>>2]|0}if(((x|0)!=0?(a[u>>0]|0)!=0:0)?(q=c[s>>2]|0,(q-t|0)<160):0){H=c[r>>2]|0;c[s>>2]=q+4;c[q>>2]=H}h[l>>3]=+Fm(E,c[v>>2]|0,k);qk(o,t,c[s>>2]|0,k);if(!C){if((c[A+12>>2]|0)==(c[A+16>>2]|0)){H=(oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1;A=H?0:A}}else{A=0}l=(A|0)==0;do{if((D|0)!=0){if((c[D+12>>2]|0)!=(c[D+16>>2]|0)){if(l){break}else{m=68;break}}if(!((oc[c[(c[D>>2]|0)+36>>2]&127](D)|0)==-1)){if(!l){m=68}}else{m=66}}else{m=66}}while(0);if((m|0)==66?l:0){m=68}if((m|0)==68){c[k>>2]=c[k>>2]|2}c[b>>2]=A;if(!((a[p>>0]&1)==0)?(n=c[w>>2]|0,(n|0)!=0):0){vn(n)}if((a[o>>0]&1)==0){i=e;return}m=c[o+8>>2]|0;if((m|0)==0){i=e;return}vn(m);i=e;return}function Wh(b,e,f,g,h,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;e=i;i=i+224|0;n=e;o=e+188|0;m=e+176|0;w=e+16|0;q=c[h+28>>2]|0;D=q+4|0;c[D>>2]=(c[D>>2]|0)+1;if(!((c[3364]|0)==-1)){c[n>>2]=13456;c[n+4>>2]=208;c[n+8>>2]=0;cg(13456,n)}h=(c[13460>>2]|0)+ -1|0;r=c[q+8>>2]|0;if((c[q+12>>2]|0)-r>>2>>>0>h>>>0?(p=c[r+(h<<2)>>2]|0,(p|0)!=0):0){uc[c[(c[p>>2]|0)+32>>2]&31](p,12016,12042|0,o)|0;C=q+4|0;D=c[C>>2]|0;c[C>>2]=D+ -1;if((D|0)==0){lc[c[(c[q>>2]|0)+8>>2]&255](q)}c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;hg(m,10);if((a[m>>0]&1)==0){z=m+1|0;h=z;q=m+8|0}else{z=m+8|0;h=m+1|0;q=z;z=c[z>>2]|0}u=m+4|0;v=o+24|0;s=o+25|0;t=o+26|0;r=o;p=m+8|0;y=c[f>>2]|0;x=0;A=z;a:while(1){if((y|0)!=0){if((c[y+12>>2]|0)==(c[y+16>>2]|0)?(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1:0){c[f>>2]=0;y=0}}else{y=0}C=(y|0)==0;B=c[g>>2]|0;do{if((B|0)!=0){if((c[B+12>>2]|0)!=(c[B+16>>2]|0)){if(C){break}else{break a}}if(!((oc[c[(c[B>>2]|0)+36>>2]&127](B)|0)==-1)){if(C){break}else{break a}}else{c[g>>2]=0;l=26;break}}else{l=26}}while(0);if((l|0)==26?(l=0,C):0){break}D=a[m>>0]|0;B=(D&1)==0;if(B){C=(D&255)>>>1}else{C=c[u>>2]|0}if((A-z|0)==(C|0)){if(B){A=(D&255)>>>1;C=(D&255)>>>1;z=A<<1}else{A=c[u>>2]|0;C=c[u>>2]|0;z=A<<1}do{if(!(C>>>0<z>>>0)){if(B){a[m+z+1>>0]=0;a[m>>0]=A<<2;break}else{a[(c[p>>2]|0)+z>>0]=0;c[u>>2]=z;break}}else{hg(m,z-C|0)}}while(0);C=a[m>>0]|0;if((C&1)==0){z=10}else{z=c[m>>2]|0;C=z&255;z=(z&-2)+ -1|0}B=(C&1)==0;if(B){C=(C&255)>>>1}else{C=c[u>>2]|0}do{if(!(C>>>0<z>>>0)){if(B){a[m+z+1>>0]=0;a[m>>0]=z<<1;break}else{a[(c[p>>2]|0)+z>>0]=0;c[u>>2]=z;break}}else{hg(m,z-C|0)}}while(0);if((a[m>>0]&1)==0){z=h}else{z=c[q>>2]|0}A=z+A|0}B=c[y+12>>2]|0;if((B|0)==(c[y+16>>2]|0)){y=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{y=d[B>>0]|0}B=y&255;y=(A|0)==(z|0);do{if(y){C=(a[v>>0]|0)==B<<24>>24;if(!C?!((a[s>>0]|0)==B<<24>>24):0){C=o;l=61;break}a[A>>0]=C?43:45;A=A+1|0;x=0}else{C=o;l=61}}while(0);do{if((l|0)==61){while(1){l=0;if((a[C>>0]|0)==B<<24>>24){break}C=C+1|0;if((C|0)==(t|0)){C=t;break}else{l=61}}B=C-r|0;if((B|0)>23){break a}if((B|0)<22){a[A>>0]=a[12016+B>>0]|0;A=A+1|0;x=x+1|0;break}if(y){z=A;break a}if((A-z|0)>=3){break a}if((a[A+ -1>>0]|0)!=48){break a}a[A>>0]=a[12016+B>>0]|0;A=A+1|0;x=0}}while(0);y=c[f>>2]|0;B=y+12|0;C=c[B>>2]|0;if((C|0)==(c[y+16>>2]|0)){oc[c[(c[y>>2]|0)+40>>2]&127](y)|0;D=w;w=D;continue}else{c[B>>2]=C+1;D=w;w=D;continue}}a[z+3>>0]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}D=c[3340]|0;c[n>>2]=k;if((Yh(z,D,n)|0)!=1){c[j>>2]=4}k=c[f>>2]|0;if((k|0)!=0){if((c[k+12>>2]|0)==(c[k+16>>2]|0)?(oc[c[(c[k>>2]|0)+36>>2]&127](k)|0)==-1:0){c[f>>2]=0;f=0}else{f=k}}else{f=0}k=(f|0)==0;n=c[g>>2]|0;do{if((n|0)!=0){if((c[n+12>>2]|0)!=(c[n+16>>2]|0)){if(k){break}else{l=92;break}}if(!((oc[c[(c[n>>2]|0)+36>>2]&127](n)|0)==-1)){if(k){break}else{l=92;break}}else{c[g>>2]=0;l=90;break}}else{l=90}}while(0);if((l|0)==90?k:0){l=92}if((l|0)==92){c[j>>2]=c[j>>2]|2}c[b>>2]=f;if((a[m>>0]&1)==0){i=e;return}j=c[p>>2]|0;if((j|0)==0){i=e;return}vn(j);i=e;return}D=Xa(4)|0;c[D>>2]=21304;wb(D|0,21376,196)}function Xh(b,d,e,f,g,h,j,k,l,m){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0;n=i;p=c[f>>2]|0;o=(p|0)==(e|0);do{if(o){q=(a[m+24>>0]|0)==b<<24>>24;if(!q?!((a[m+25>>0]|0)==b<<24>>24):0){break}c[f>>2]=e+1;a[e>>0]=q?43:45;c[g>>2]=0;q=0;i=n;return q|0}}while(0);q=a[j>>0]|0;if((q&1)==0){j=(q&255)>>>1}else{j=c[j+4>>2]|0}if((j|0)!=0?b<<24>>24==h<<24>>24:0){o=c[l>>2]|0;if((o-k|0)>=160){q=0;i=n;return q|0}q=c[g>>2]|0;c[l>>2]=o+4;c[o>>2]=q;c[g>>2]=0;q=0;i=n;return q|0}l=m+26|0;k=m;while(1){if((a[k>>0]|0)==b<<24>>24){break}k=k+1|0;if((k|0)==(l|0)){k=l;break}}m=k-m|0;if((m|0)>23){q=-1;i=n;return q|0}if((d|0)==10|(d|0)==8){if((m|0)>=(d|0)){q=-1;i=n;return q|0}}else if((d|0)==16?(m|0)>=22:0){if(o){q=-1;i=n;return q|0}if((p-e|0)>=3){q=-1;i=n;return q|0}if((a[p+ -1>>0]|0)!=48){q=-1;i=n;return q|0}c[g>>2]=0;q=a[12016+m>>0]|0;c[f>>2]=p+1;a[p>>0]=q;q=0;i=n;return q|0}q=a[12016+m>>0]|0;c[f>>2]=p+1;a[p>>0]=q;c[g>>2]=(c[g>>2]|0)+1;q=0;i=n;return q|0}function Yh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=i;i=i+16|0;f=e;c[f>>2]=d;b=ib(b|0)|0;a=Ma(a|0,12056,f|0)|0;if((b|0)==0){i=e;return a|0}ib(b|0)|0;i=e;return a|0}function Zh(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function _h(a){a=a|0;return}function $h(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;k=i;i=i+64|0;p=k;u=k+48|0;q=k+52|0;t=k+56|0;s=k+16|0;r=k+12|0;l=k+24|0;if((c[g+4>>2]&1|0)==0){c[q>>2]=-1;l=c[(c[d>>2]|0)+16>>2]|0;c[s>>2]=c[e>>2];c[r>>2]=c[f>>2];c[u+0>>2]=c[s+0>>2];c[p+0>>2]=c[r+0>>2];ic[l&63](t,d,u,p,g,h,q);l=c[t>>2]|0;c[e>>2]=l;e=c[q>>2]|0;if((e|0)==1){a[j>>0]=1}else if((e|0)==0){a[j>>0]=0}else{a[j>>0]=1;c[h>>2]=4}c[b>>2]=l;i=k;return}q=g+28|0;r=c[q>>2]|0;d=r+4|0;c[d>>2]=(c[d>>2]|0)+1;if(!((c[3362]|0)==-1)){c[p>>2]=13448;c[p+4>>2]=208;c[p+8>>2]=0;cg(13448,p)}s=(c[13452>>2]|0)+ -1|0;t=c[r+8>>2]|0;if((c[r+12>>2]|0)-t>>2>>>0>s>>>0?(o=c[t+(s<<2)>>2]|0,(o|0)!=0):0){u=r+4|0;d=c[u>>2]|0;c[u>>2]=d+ -1;if((d|0)==0){lc[c[(c[r>>2]|0)+8>>2]&255](r)}q=c[q>>2]|0;d=q+4|0;c[d>>2]=(c[d>>2]|0)+1;if(!((c[3402]|0)==-1)){c[p>>2]=13608;c[p+4>>2]=208;c[p+8>>2]=0;cg(13608,p)}p=(c[13612>>2]|0)+ -1|0;r=c[q+8>>2]|0;if((c[q+12>>2]|0)-r>>2>>>0>p>>>0?(n=c[r+(p<<2)>>2]|0,(n|0)!=0):0){u=q+4|0;d=c[u>>2]|0;c[u>>2]=d+ -1;if((d|0)==0){lc[c[(c[q>>2]|0)+8>>2]&255](q)}mc[c[(c[n>>2]|0)+24>>2]&127](l,n);d=l+12|0;mc[c[(c[n>>2]|0)+28>>2]&127](d,n);a[j>>0]=(ai(e,c[f>>2]|0,l,l+24|0,o,h,1)|0)==(l|0)&1;c[b>>2]=c[e>>2];if(!((a[d>>0]&1)==0)?(m=c[l+20>>2]|0,(m|0)!=0):0){vn(m)}if((a[l>>0]&1)==0){i=k;return}b=c[l+8>>2]|0;if((b|0)==0){i=k;return}vn(b);i=k;return}d=Xa(4)|0;c[d>>2]=21304;wb(d|0,21376,196)}d=Xa(4)|0;c[d>>2]=21304;wb(d|0,21376,196)}function ai(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;l=i;i=i+112|0;n=l;s=(f-e|0)/12|0;if(s>>>0>100){n=un(s)|0;if((n|0)==0){z=Xa(4)|0;c[z>>2]=22680;wb(z|0,22728,206)}else{k=n}}else{k=0}o=(e|0)==(f|0);if(o){t=0}else{p=e;t=0;q=n;while(1){r=a[p>>0]|0;if((r&1)==0){r=(r&255)>>>1}else{r=c[p+4>>2]|0}if((r|0)==0){a[q>>0]=2;t=t+1|0;s=s+ -1|0}else{a[q>>0]=1}p=p+12|0;if((p|0)==(f|0)){break}else{q=q+1|0}}}p=0;a:while(1){u=(s|0)!=0;q=p;while(1){r=c[b>>2]|0;do{if((r|0)!=0){p=c[r+12>>2]|0;if((p|0)==(c[r+16>>2]|0)){p=oc[c[(c[r>>2]|0)+36>>2]&127](r)|0}else{p=c[p>>2]|0}if((p|0)==-1){c[b>>2]=0;r=1;break}else{r=(c[b>>2]|0)==0;break}}else{r=1}}while(0);if((d|0)==0){p=0;w=1;d=0}else{p=c[d+12>>2]|0;if((p|0)==(c[d+16>>2]|0)){p=oc[c[(c[d>>2]|0)+36>>2]&127](d)|0}else{p=c[p>>2]|0}z=(p|0)==-1;p=z?0:d;w=z?1:0;d=z?0:d}v=c[b>>2]|0;if(!((r^w)&u)){break a}p=c[v+12>>2]|0;if((p|0)==(c[v+16>>2]|0)){r=oc[c[(c[v>>2]|0)+36>>2]&127](v)|0}else{r=c[p>>2]|0}if(!j){r=xc[c[(c[g>>2]|0)+28>>2]&63](g,r)|0}p=q+1|0;if(o){q=p}else{break}}b:do{if(j){w=0;u=e;v=n;while(1){do{if((a[v>>0]|0)==1){x=a[u>>0]|0;y=(x&1)==0;if(y){z=u+4|0}else{z=c[u+8>>2]|0}if((r|0)!=(c[z+(q<<2)>>2]|0)){a[v>>0]=0;s=s+ -1|0;break}if(y){w=(x&255)>>>1}else{w=c[u+4>>2]|0}if((w|0)==(p|0)){a[v>>0]=2;w=1;t=t+1|0;s=s+ -1|0}else{w=1}}}while(0);u=u+12|0;if((u|0)==(f|0)){break b}v=v+1|0}}else{w=0;u=e;v=n;while(1){do{if((a[v>>0]|0)==1){if((a[u>>0]&1)==0){x=u+4|0}else{x=c[u+8>>2]|0}if((r|0)!=(xc[c[(c[g>>2]|0)+28>>2]&63](g,c[x+(q<<2)>>2]|0)|0)){a[v>>0]=0;s=s+ -1|0;break}w=a[u>>0]|0;if((w&1)==0){w=(w&255)>>>1}else{w=c[u+4>>2]|0}if((w|0)==(p|0)){a[v>>0]=2;w=1;t=t+1|0;s=s+ -1|0}else{w=1}}}while(0);u=u+12|0;if((u|0)==(f|0)){break b}v=v+1|0}}}while(0);if(!w){continue}u=c[b>>2]|0;r=u+12|0;q=c[r>>2]|0;if((q|0)==(c[u+16>>2]|0)){oc[c[(c[u>>2]|0)+40>>2]&127](u)|0}else{c[r>>2]=q+4}if((s+t|0)>>>0<2){continue}else{r=e;q=n}while(1){if((a[q>>0]|0)==2){u=a[r>>0]|0;if((u&1)==0){u=(u&255)>>>1}else{u=c[r+4>>2]|0}if((u|0)!=(p|0)){a[q>>0]=0;t=t+ -1|0}}r=r+12|0;if((r|0)==(f|0)){continue a}else{q=q+1|0}}}do{if((v|0)!=0){j=c[v+12>>2]|0;if((j|0)==(c[v+16>>2]|0)){j=oc[c[(c[v>>2]|0)+36>>2]&127](v)|0}else{j=c[j>>2]|0}if((j|0)==-1){c[b>>2]=0;b=1;break}else{b=(c[b>>2]|0)==0;break}}else{b=1}}while(0);if((p|0)!=0){j=c[p+12>>2]|0;if((j|0)==(c[p+16>>2]|0)){j=oc[c[(c[p>>2]|0)+36>>2]&127](p)|0}else{j=c[j>>2]|0}if(!((j|0)==-1)){if(!b){m=88}}else{m=86}}else{m=86}if((m|0)==86?b:0){m=88}if((m|0)==88){c[h>>2]=c[h>>2]|2}c:do{if(!o){if((a[n>>0]|0)==2){f=e}else{while(1){e=e+12|0;n=n+1|0;if((e|0)==(f|0)){m=93;break c}if((a[n>>0]|0)==2){f=e;break}}}}else{m=93}}while(0);if((m|0)==93){c[h>>2]=c[h>>2]|4}if((k|0)==0){i=l;return f|0}vn(k);i=l;return f|0}function bi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=i;i=i+304|0;u=d+160|0;o=d+280|0;n=d+264|0;m=d+284|0;t=d+300|0;r=d;s=d+276|0;q=d+296|0;w=c[e>>2]|0;y=c[f>>2]|0;f=c[g+4>>2]&74;if((f|0)==64){f=8}else if((f|0)==0){f=0}else if((f|0)==8){f=16}else{f=10}pi(n,g,u,o);c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;hg(m,10);if((a[m>>0]&1)==0){z=m+1|0;e=z;g=m+8|0}else{z=m+8|0;e=m+1|0;g=z;z=c[z>>2]|0}c[t>>2]=z;c[s>>2]=r;c[q>>2]=0;v=m+4|0;x=c[o>>2]|0;o=m+8|0;while(1){if((w|0)==0){A=1;w=0}else{A=c[w+12>>2]|0;if((A|0)==(c[w+16>>2]|0)){A=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{A=c[A>>2]|0}C=(A|0)==-1;A=C?1:0;w=C?0:w}if((y|0)!=0){B=c[y+12>>2]|0;if((B|0)==(c[y+16>>2]|0)){B=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{B=c[B>>2]|0}if(!((B|0)==-1)){if(!A){break}}else{k=20}}else{k=20}if((k|0)==20){k=0;if(A){y=0;break}else{y=0}}A=a[m>>0]|0;B=(A&1)==0;if(B){C=(A&255)>>>1}else{C=c[v>>2]|0}if(((c[t>>2]|0)-z|0)==(C|0)){if(B){D=(A&255)>>>1;z=(A&255)>>>1;C=D<<1;A=D}else{A=c[v>>2]|0;z=c[v>>2]|0;C=A<<1}do{if(!(z>>>0<C>>>0)){if(B){a[m+C+1>>0]=0;a[m>>0]=A<<2;break}else{a[(c[o>>2]|0)+C>>0]=0;c[v>>2]=C;break}}else{hg(m,C-z|0)}}while(0);C=a[m>>0]|0;if((C&1)==0){B=10}else{B=c[m>>2]|0;C=B&255;B=(B&-2)+ -1|0}z=(C&1)==0;if(z){C=(C&255)>>>1}else{C=c[v>>2]|0}do{if(!(C>>>0<B>>>0)){if(z){a[m+B+1>>0]=0;a[m>>0]=B<<1;break}else{a[(c[o>>2]|0)+B>>0]=0;c[v>>2]=B;break}}else{hg(m,B-C|0)}}while(0);if((a[m>>0]&1)==0){z=e}else{z=c[g>>2]|0}c[t>>2]=z+A}A=w+12|0;C=c[A>>2]|0;B=w+16|0;if((C|0)==(c[B>>2]|0)){C=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{C=c[C>>2]|0}if((li(C,f,z,t,q,x,n,r,s,u)|0)!=0){break}C=c[A>>2]|0;if((C|0)==(c[B>>2]|0)){oc[c[(c[w>>2]|0)+40>>2]&127](w)|0;continue}else{c[A>>2]=C+4;continue}}u=a[n>>0]|0;if((u&1)==0){u=(u&255)>>>1}else{u=c[n+4>>2]|0}if((u|0)!=0?(p=c[s>>2]|0,(p-r|0)<160):0){D=c[q>>2]|0;c[s>>2]=p+4;c[p>>2]=D}c[j>>2]=Nm(z,c[t>>2]|0,h,f)|0;qk(n,r,c[s>>2]|0,h);if((w|0)==0){j=0;p=1}else{j=c[w+12>>2]|0;if((j|0)==(c[w+16>>2]|0)){j=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{j=c[j>>2]|0}p=(j|0)==-1;j=p?0:w;p=p?1:0}if((y|0)!=0){q=c[y+12>>2]|0;if((q|0)==(c[y+16>>2]|0)){q=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{q=c[q>>2]|0}if(!((q|0)==-1)){if(!p){k=73}}else{k=71}}else{k=71}if((k|0)==71?p:0){k=73}if((k|0)==73){c[h>>2]=c[h>>2]|2}c[b>>2]=j;if(!((a[m>>0]&1)==0)?(l=c[o>>2]|0,(l|0)!=0):0){vn(l)}if((a[n>>0]&1)==0){i=d;return}h=c[n+8>>2]|0;if((h|0)==0){i=d;return}vn(h);i=d;return}function ci(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=i;i=i+304|0;u=d+160|0;o=d+280|0;n=d+264|0;m=d+284|0;t=d+300|0;r=d;s=d+276|0;q=d+296|0;w=c[e>>2]|0;y=c[f>>2]|0;f=c[g+4>>2]&74;if((f|0)==8){f=16}else if((f|0)==64){f=8}else if((f|0)==0){f=0}else{f=10}pi(n,g,u,o);c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;hg(m,10);if((a[m>>0]&1)==0){z=m+1|0;e=z;g=m+8|0}else{z=m+8|0;e=m+1|0;g=z;z=c[z>>2]|0}c[t>>2]=z;c[s>>2]=r;c[q>>2]=0;v=m+4|0;x=c[o>>2]|0;o=m+8|0;while(1){if((w|0)==0){A=1;w=0}else{A=c[w+12>>2]|0;if((A|0)==(c[w+16>>2]|0)){A=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{A=c[A>>2]|0}C=(A|0)==-1;A=C?1:0;w=C?0:w}if((y|0)!=0){B=c[y+12>>2]|0;if((B|0)==(c[y+16>>2]|0)){B=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{B=c[B>>2]|0}if(!((B|0)==-1)){if(!A){break}}else{k=20}}else{k=20}if((k|0)==20){k=0;if(A){y=0;break}else{y=0}}A=a[m>>0]|0;B=(A&1)==0;if(B){C=(A&255)>>>1}else{C=c[v>>2]|0}if(((c[t>>2]|0)-z|0)==(C|0)){if(B){D=(A&255)>>>1;z=(A&255)>>>1;C=D<<1;A=D}else{A=c[v>>2]|0;z=c[v>>2]|0;C=A<<1}do{if(!(z>>>0<C>>>0)){if(B){a[m+C+1>>0]=0;a[m>>0]=A<<2;break}else{a[(c[o>>2]|0)+C>>0]=0;c[v>>2]=C;break}}else{hg(m,C-z|0)}}while(0);C=a[m>>0]|0;if((C&1)==0){B=10}else{B=c[m>>2]|0;C=B&255;B=(B&-2)+ -1|0}z=(C&1)==0;if(z){C=(C&255)>>>1}else{C=c[v>>2]|0}do{if(!(C>>>0<B>>>0)){if(z){a[m+B+1>>0]=0;a[m>>0]=B<<1;break}else{a[(c[o>>2]|0)+B>>0]=0;c[v>>2]=B;break}}else{hg(m,B-C|0)}}while(0);if((a[m>>0]&1)==0){z=e}else{z=c[g>>2]|0}c[t>>2]=z+A}A=w+12|0;C=c[A>>2]|0;B=w+16|0;if((C|0)==(c[B>>2]|0)){C=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{C=c[C>>2]|0}if((li(C,f,z,t,q,x,n,r,s,u)|0)!=0){break}C=c[A>>2]|0;if((C|0)==(c[B>>2]|0)){oc[c[(c[w>>2]|0)+40>>2]&127](w)|0;continue}else{c[A>>2]=C+4;continue}}u=a[n>>0]|0;if((u&1)==0){u=(u&255)>>>1}else{u=c[n+4>>2]|0}if((u|0)!=0?(p=c[s>>2]|0,(p-r|0)<160):0){D=c[q>>2]|0;c[s>>2]=p+4;c[p>>2]=D}C=Mm(z,c[t>>2]|0,h,f)|0;D=j;c[D>>2]=C;c[D+4>>2]=I;qk(n,r,c[s>>2]|0,h);if((w|0)==0){j=0;p=1}else{j=c[w+12>>2]|0;if((j|0)==(c[w+16>>2]|0)){j=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{j=c[j>>2]|0}p=(j|0)==-1;j=p?0:w;p=p?1:0}if((y|0)!=0){q=c[y+12>>2]|0;if((q|0)==(c[y+16>>2]|0)){q=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{q=c[q>>2]|0}if(!((q|0)==-1)){if(!p){k=73}}else{k=71}}else{k=71}if((k|0)==71?p:0){k=73}if((k|0)==73){c[h>>2]=c[h>>2]|2}c[b>>2]=j;if(!((a[m>>0]&1)==0)?(l=c[o>>2]|0,(l|0)!=0):0){vn(l)}if((a[n>>0]&1)==0){i=d;return}h=c[n+8>>2]|0;if((h|0)==0){i=d;return}vn(h);i=d;return}function di(d,e,f,g,h,j,k){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=i;i=i+304|0;v=e+160|0;p=e+280|0;o=e+264|0;n=e+284|0;u=e+300|0;s=e;t=e+276|0;r=e+296|0;x=c[f>>2]|0;z=c[g>>2]|0;g=c[h+4>>2]&74;if((g|0)==0){g=0}else if((g|0)==64){g=8}else if((g|0)==8){g=16}else{g=10}pi(o,h,v,p);c[n+0>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;hg(n,10);if((a[n>>0]&1)==0){A=n+1|0;f=A;h=n+8|0}else{A=n+8|0;f=n+1|0;h=A;A=c[A>>2]|0}c[u>>2]=A;c[t>>2]=s;c[r>>2]=0;w=n+4|0;y=c[p>>2]|0;p=n+8|0;while(1){if((x|0)==0){B=1;x=0}else{B=c[x+12>>2]|0;if((B|0)==(c[x+16>>2]|0)){B=oc[c[(c[x>>2]|0)+36>>2]&127](x)|0}else{B=c[B>>2]|0}D=(B|0)==-1;B=D?1:0;x=D?0:x}if((z|0)!=0){C=c[z+12>>2]|0;if((C|0)==(c[z+16>>2]|0)){C=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{C=c[C>>2]|0}if(!((C|0)==-1)){if(!B){break}}else{l=20}}else{l=20}if((l|0)==20){l=0;if(B){z=0;break}else{z=0}}B=a[n>>0]|0;C=(B&1)==0;if(C){D=(B&255)>>>1}else{D=c[w>>2]|0}if(((c[u>>2]|0)-A|0)==(D|0)){if(C){E=(B&255)>>>1;A=(B&255)>>>1;D=E<<1;B=E}else{B=c[w>>2]|0;A=c[w>>2]|0;D=B<<1}do{if(!(A>>>0<D>>>0)){if(C){a[n+D+1>>0]=0;a[n>>0]=B<<2;break}else{a[(c[p>>2]|0)+D>>0]=0;c[w>>2]=D;break}}else{hg(n,D-A|0)}}while(0);D=a[n>>0]|0;if((D&1)==0){C=10}else{C=c[n>>2]|0;D=C&255;C=(C&-2)+ -1|0}A=(D&1)==0;if(A){D=(D&255)>>>1}else{D=c[w>>2]|0}do{if(!(D>>>0<C>>>0)){if(A){a[n+C+1>>0]=0;a[n>>0]=C<<1;break}else{a[(c[p>>2]|0)+C>>0]=0;c[w>>2]=C;break}}else{hg(n,C-D|0)}}while(0);if((a[n>>0]&1)==0){A=f}else{A=c[h>>2]|0}c[u>>2]=A+B}B=x+12|0;D=c[B>>2]|0;C=x+16|0;if((D|0)==(c[C>>2]|0)){D=oc[c[(c[x>>2]|0)+36>>2]&127](x)|0}else{D=c[D>>2]|0}if((li(D,g,A,u,r,y,o,s,t,v)|0)!=0){break}D=c[B>>2]|0;if((D|0)==(c[C>>2]|0)){oc[c[(c[x>>2]|0)+40>>2]&127](x)|0;continue}else{c[B>>2]=D+4;continue}}v=a[o>>0]|0;if((v&1)==0){v=(v&255)>>>1}else{v=c[o+4>>2]|0}if((v|0)!=0?(q=c[t>>2]|0,(q-s|0)<160):0){E=c[r>>2]|0;c[t>>2]=q+4;c[q>>2]=E}b[k>>1]=Lm(A,c[u>>2]|0,j,g)|0;qk(o,s,c[t>>2]|0,j);if((x|0)==0){k=0;q=1}else{k=c[x+12>>2]|0;if((k|0)==(c[x+16>>2]|0)){k=oc[c[(c[x>>2]|0)+36>>2]&127](x)|0}else{k=c[k>>2]|0}q=(k|0)==-1;k=q?0:x;q=q?1:0}if((z|0)!=0){r=c[z+12>>2]|0;if((r|0)==(c[z+16>>2]|0)){r=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{r=c[r>>2]|0}if(!((r|0)==-1)){if(!q){l=73}}else{l=71}}else{l=71}if((l|0)==71?q:0){l=73}if((l|0)==73){c[j>>2]=c[j>>2]|2}c[d>>2]=k;if(!((a[n>>0]&1)==0)?(m=c[p>>2]|0,(m|0)!=0):0){vn(m)}if((a[o>>0]&1)==0){i=e;return}j=c[o+8>>2]|0;if((j|0)==0){i=e;return}vn(j);i=e;return}function ei(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=i;i=i+304|0;u=d+160|0;o=d+280|0;n=d+264|0;m=d+284|0;t=d+300|0;r=d;s=d+276|0;q=d+296|0;w=c[e>>2]|0;y=c[f>>2]|0;f=c[g+4>>2]&74;if((f|0)==8){f=16}else if((f|0)==64){f=8}else if((f|0)==0){f=0}else{f=10}pi(n,g,u,o);c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;hg(m,10);if((a[m>>0]&1)==0){z=m+1|0;e=z;g=m+8|0}else{z=m+8|0;e=m+1|0;g=z;z=c[z>>2]|0}c[t>>2]=z;c[s>>2]=r;c[q>>2]=0;v=m+4|0;x=c[o>>2]|0;o=m+8|0;while(1){if((w|0)==0){A=1;w=0}else{A=c[w+12>>2]|0;if((A|0)==(c[w+16>>2]|0)){A=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{A=c[A>>2]|0}C=(A|0)==-1;A=C?1:0;w=C?0:w}if((y|0)!=0){B=c[y+12>>2]|0;if((B|0)==(c[y+16>>2]|0)){B=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{B=c[B>>2]|0}if(!((B|0)==-1)){if(!A){break}}else{k=20}}else{k=20}if((k|0)==20){k=0;if(A){y=0;break}else{y=0}}A=a[m>>0]|0;B=(A&1)==0;if(B){C=(A&255)>>>1}else{C=c[v>>2]|0}if(((c[t>>2]|0)-z|0)==(C|0)){if(B){D=(A&255)>>>1;z=(A&255)>>>1;C=D<<1;A=D}else{A=c[v>>2]|0;z=c[v>>2]|0;C=A<<1}do{if(!(z>>>0<C>>>0)){if(B){a[m+C+1>>0]=0;a[m>>0]=A<<2;break}else{a[(c[o>>2]|0)+C>>0]=0;c[v>>2]=C;break}}else{hg(m,C-z|0)}}while(0);C=a[m>>0]|0;if((C&1)==0){B=10}else{B=c[m>>2]|0;C=B&255;B=(B&-2)+ -1|0}z=(C&1)==0;if(z){C=(C&255)>>>1}else{C=c[v>>2]|0}do{if(!(C>>>0<B>>>0)){if(z){a[m+B+1>>0]=0;a[m>>0]=B<<1;break}else{a[(c[o>>2]|0)+B>>0]=0;c[v>>2]=B;break}}else{hg(m,B-C|0)}}while(0);if((a[m>>0]&1)==0){z=e}else{z=c[g>>2]|0}c[t>>2]=z+A}A=w+12|0;C=c[A>>2]|0;B=w+16|0;if((C|0)==(c[B>>2]|0)){C=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{C=c[C>>2]|0}if((li(C,f,z,t,q,x,n,r,s,u)|0)!=0){break}C=c[A>>2]|0;if((C|0)==(c[B>>2]|0)){oc[c[(c[w>>2]|0)+40>>2]&127](w)|0;continue}else{c[A>>2]=C+4;continue}}u=a[n>>0]|0;if((u&1)==0){u=(u&255)>>>1}else{u=c[n+4>>2]|0}if((u|0)!=0?(p=c[s>>2]|0,(p-r|0)<160):0){D=c[q>>2]|0;c[s>>2]=p+4;c[p>>2]=D}c[j>>2]=Km(z,c[t>>2]|0,h,f)|0;qk(n,r,c[s>>2]|0,h);if((w|0)==0){j=0;p=1}else{j=c[w+12>>2]|0;if((j|0)==(c[w+16>>2]|0)){j=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{j=c[j>>2]|0}p=(j|0)==-1;j=p?0:w;p=p?1:0}if((y|0)!=0){q=c[y+12>>2]|0;if((q|0)==(c[y+16>>2]|0)){q=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{q=c[q>>2]|0}if(!((q|0)==-1)){if(!p){k=73}}else{k=71}}else{k=71}if((k|0)==71?p:0){k=73}if((k|0)==73){c[h>>2]=c[h>>2]|2}c[b>>2]=j;if(!((a[m>>0]&1)==0)?(l=c[o>>2]|0,(l|0)!=0):0){vn(l)}if((a[n>>0]&1)==0){i=d;return}h=c[n+8>>2]|0;if((h|0)==0){i=d;return}vn(h);i=d;return}function fi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=i;i=i+304|0;u=d+160|0;o=d+280|0;n=d+264|0;m=d+284|0;t=d+300|0;r=d;s=d+276|0;q=d+296|0;w=c[e>>2]|0;y=c[f>>2]|0;f=c[g+4>>2]&74;if((f|0)==0){f=0}else if((f|0)==64){f=8}else if((f|0)==8){f=16}else{f=10}pi(n,g,u,o);c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;hg(m,10);if((a[m>>0]&1)==0){z=m+1|0;e=z;g=m+8|0}else{z=m+8|0;e=m+1|0;g=z;z=c[z>>2]|0}c[t>>2]=z;c[s>>2]=r;c[q>>2]=0;v=m+4|0;x=c[o>>2]|0;o=m+8|0;while(1){if((w|0)==0){A=1;w=0}else{A=c[w+12>>2]|0;if((A|0)==(c[w+16>>2]|0)){A=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{A=c[A>>2]|0}C=(A|0)==-1;A=C?1:0;w=C?0:w}if((y|0)!=0){B=c[y+12>>2]|0;if((B|0)==(c[y+16>>2]|0)){B=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{B=c[B>>2]|0}if(!((B|0)==-1)){if(!A){break}}else{k=20}}else{k=20}if((k|0)==20){k=0;if(A){y=0;break}else{y=0}}A=a[m>>0]|0;B=(A&1)==0;if(B){C=(A&255)>>>1}else{C=c[v>>2]|0}if(((c[t>>2]|0)-z|0)==(C|0)){if(B){D=(A&255)>>>1;z=(A&255)>>>1;C=D<<1;A=D}else{A=c[v>>2]|0;z=c[v>>2]|0;C=A<<1}do{if(!(z>>>0<C>>>0)){if(B){a[m+C+1>>0]=0;a[m>>0]=A<<2;break}else{a[(c[o>>2]|0)+C>>0]=0;c[v>>2]=C;break}}else{hg(m,C-z|0)}}while(0);C=a[m>>0]|0;if((C&1)==0){B=10}else{B=c[m>>2]|0;C=B&255;B=(B&-2)+ -1|0}z=(C&1)==0;if(z){C=(C&255)>>>1}else{C=c[v>>2]|0}do{if(!(C>>>0<B>>>0)){if(z){a[m+B+1>>0]=0;a[m>>0]=B<<1;break}else{a[(c[o>>2]|0)+B>>0]=0;c[v>>2]=B;break}}else{hg(m,B-C|0)}}while(0);if((a[m>>0]&1)==0){z=e}else{z=c[g>>2]|0}c[t>>2]=z+A}A=w+12|0;C=c[A>>2]|0;B=w+16|0;if((C|0)==(c[B>>2]|0)){C=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{C=c[C>>2]|0}if((li(C,f,z,t,q,x,n,r,s,u)|0)!=0){break}C=c[A>>2]|0;if((C|0)==(c[B>>2]|0)){oc[c[(c[w>>2]|0)+40>>2]&127](w)|0;continue}else{c[A>>2]=C+4;continue}}u=a[n>>0]|0;if((u&1)==0){u=(u&255)>>>1}else{u=c[n+4>>2]|0}if((u|0)!=0?(p=c[s>>2]|0,(p-r|0)<160):0){D=c[q>>2]|0;c[s>>2]=p+4;c[p>>2]=D}c[j>>2]=Jm(z,c[t>>2]|0,h,f)|0;qk(n,r,c[s>>2]|0,h);if((w|0)==0){j=0;p=1}else{j=c[w+12>>2]|0;if((j|0)==(c[w+16>>2]|0)){j=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{j=c[j>>2]|0}p=(j|0)==-1;j=p?0:w;p=p?1:0}if((y|0)!=0){q=c[y+12>>2]|0;if((q|0)==(c[y+16>>2]|0)){q=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{q=c[q>>2]|0}if(!((q|0)==-1)){if(!p){k=73}}else{k=71}}else{k=71}if((k|0)==71?p:0){k=73}if((k|0)==73){c[h>>2]=c[h>>2]|2}c[b>>2]=j;if(!((a[m>>0]&1)==0)?(l=c[o>>2]|0,(l|0)!=0):0){vn(l)}if((a[n>>0]&1)==0){i=d;return}h=c[n+8>>2]|0;if((h|0)==0){i=d;return}vn(h);i=d;return}function gi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=i;i=i+304|0;u=d+160|0;o=d+280|0;n=d+264|0;m=d+284|0;t=d+300|0;r=d;s=d+276|0;q=d+296|0;w=c[e>>2]|0;y=c[f>>2]|0;f=c[g+4>>2]&74;if((f|0)==8){f=16}else if((f|0)==0){f=0}else if((f|0)==64){f=8}else{f=10}pi(n,g,u,o);c[m+0>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;hg(m,10);if((a[m>>0]&1)==0){z=m+1|0;e=z;g=m+8|0}else{z=m+8|0;e=m+1|0;g=z;z=c[z>>2]|0}c[t>>2]=z;c[s>>2]=r;c[q>>2]=0;v=m+4|0;x=c[o>>2]|0;o=m+8|0;while(1){if((w|0)==0){A=1;w=0}else{A=c[w+12>>2]|0;if((A|0)==(c[w+16>>2]|0)){A=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{A=c[A>>2]|0}C=(A|0)==-1;A=C?1:0;w=C?0:w}if((y|0)!=0){B=c[y+12>>2]|0;if((B|0)==(c[y+16>>2]|0)){B=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{B=c[B>>2]|0}if(!((B|0)==-1)){if(!A){break}}else{k=20}}else{k=20}if((k|0)==20){k=0;if(A){y=0;break}else{y=0}}A=a[m>>0]|0;B=(A&1)==0;if(B){C=(A&255)>>>1}else{C=c[v>>2]|0}if(((c[t>>2]|0)-z|0)==(C|0)){if(B){D=(A&255)>>>1;z=(A&255)>>>1;C=D<<1;A=D}else{A=c[v>>2]|0;z=c[v>>2]|0;C=A<<1}do{if(!(z>>>0<C>>>0)){if(B){a[m+C+1>>0]=0;a[m>>0]=A<<2;break}else{a[(c[o>>2]|0)+C>>0]=0;c[v>>2]=C;break}}else{hg(m,C-z|0)}}while(0);C=a[m>>0]|0;if((C&1)==0){B=10}else{B=c[m>>2]|0;C=B&255;B=(B&-2)+ -1|0}z=(C&1)==0;if(z){C=(C&255)>>>1}else{C=c[v>>2]|0}do{if(!(C>>>0<B>>>0)){if(z){a[m+B+1>>0]=0;a[m>>0]=B<<1;break}else{a[(c[o>>2]|0)+B>>0]=0;c[v>>2]=B;break}}else{hg(m,B-C|0)}}while(0);if((a[m>>0]&1)==0){z=e}else{z=c[g>>2]|0}c[t>>2]=z+A}A=w+12|0;C=c[A>>2]|0;B=w+16|0;if((C|0)==(c[B>>2]|0)){C=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{C=c[C>>2]|0}if((li(C,f,z,t,q,x,n,r,s,u)|0)!=0){break}C=c[A>>2]|0;if((C|0)==(c[B>>2]|0)){oc[c[(c[w>>2]|0)+40>>2]&127](w)|0;continue}else{c[A>>2]=C+4;continue}}u=a[n>>0]|0;if((u&1)==0){u=(u&255)>>>1}else{u=c[n+4>>2]|0}if((u|0)!=0?(p=c[s>>2]|0,(p-r|0)<160):0){D=c[q>>2]|0;c[s>>2]=p+4;c[p>>2]=D}C=Im(z,c[t>>2]|0,h,f)|0;D=j;c[D>>2]=C;c[D+4>>2]=I;qk(n,r,c[s>>2]|0,h);if((w|0)==0){j=0;p=1}else{j=c[w+12>>2]|0;if((j|0)==(c[w+16>>2]|0)){j=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{j=c[j>>2]|0}p=(j|0)==-1;j=p?0:w;p=p?1:0}if((y|0)!=0){q=c[y+12>>2]|0;if((q|0)==(c[y+16>>2]|0)){q=oc[c[(c[y>>2]|0)+36>>2]&127](y)|0}else{q=c[q>>2]|0}if(!((q|0)==-1)){if(!p){k=73}}else{k=71}}else{k=71}if((k|0)==71?p:0){k=73}if((k|0)==73){c[h>>2]=c[h>>2]|2}c[b>>2]=j;if(!((a[m>>0]&1)==0)?(l=c[o>>2]|0,(l|0)!=0):0){vn(l)}if((a[n>>0]&1)==0){i=d;return}h=c[n+8>>2]|0;if((h|0)==0){i=d;return}vn(h);i=d;return}function hi(b,d,e,f,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;d=i;i=i+352|0;w=d+208|0;y=d+184|0;p=d+4|0;n=d+8|0;o=d+196|0;u=d;t=d+24|0;s=d+192|0;v=d+188|0;r=d+337|0;x=d+336|0;z=c[e>>2]|0;B=c[f>>2]|0;qi(n,h,w,y,p);c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;hg(o,10);if((a[o>>0]&1)==0){C=o+1|0;e=C;f=o+8|0}else{C=o+8|0;e=o+1|0;f=C;C=c[C>>2]|0}c[u>>2]=C;c[s>>2]=t;c[v>>2]=0;a[r>>0]=1;a[x>>0]=69;h=o+4|0;y=c[y>>2]|0;A=c[p>>2]|0;p=o+8|0;while(1){if((z|0)==0){D=1;z=0}else{D=c[z+12>>2]|0;if((D|0)==(c[z+16>>2]|0)){D=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{D=c[D>>2]|0}F=(D|0)==-1;D=F?1:0;z=F?0:z}if((B|0)!=0){E=c[B+12>>2]|0;if((E|0)==(c[B+16>>2]|0)){E=oc[c[(c[B>>2]|0)+36>>2]&127](B)|0}else{E=c[E>>2]|0}if(!((E|0)==-1)){if(!D){break}}else{m=16}}else{m=16}if((m|0)==16){m=0;if(D){B=0;break}else{B=0}}D=a[o>>0]|0;E=(D&1)==0;if(E){F=(D&255)>>>1}else{F=c[h>>2]|0}if(((c[u>>2]|0)-C|0)==(F|0)){if(E){G=(D&255)>>>1;F=(D&255)>>>1;C=G<<1;D=G}else{D=c[h>>2]|0;F=c[h>>2]|0;C=D<<1}do{if(!(F>>>0<C>>>0)){if(E){a[o+C+1>>0]=0;a[o>>0]=D<<2;break}else{a[(c[p>>2]|0)+C>>0]=0;c[h>>2]=C;break}}else{hg(o,C-F|0)}}while(0);F=a[o>>0]|0;if((F&1)==0){E=10}else{E=c[o>>2]|0;F=E&255;E=(E&-2)+ -1|0}C=(F&1)==0;if(C){F=(F&255)>>>1}else{F=c[h>>2]|0}do{if(!(F>>>0<E>>>0)){if(C){a[o+E+1>>0]=0;a[o>>0]=E<<1;break}else{a[(c[p>>2]|0)+E>>0]=0;c[h>>2]=E;break}}else{hg(o,E-F|0)}}while(0);if((a[o>>0]&1)==0){C=e}else{C=c[f>>2]|0}c[u>>2]=C+D}E=z+12|0;F=c[E>>2]|0;D=z+16|0;if((F|0)==(c[D>>2]|0)){F=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{F=c[F>>2]|0}if((ri(F,r,x,C,u,y,A,n,t,s,v,w)|0)!=0){break}F=c[E>>2]|0;if((F|0)==(c[D>>2]|0)){oc[c[(c[z>>2]|0)+40>>2]&127](z)|0;continue}else{c[E>>2]=F+4;continue}}w=a[n>>0]|0;if((w&1)==0){w=(w&255)>>>1}else{w=c[n+4>>2]|0}if(((w|0)!=0?(a[r>>0]|0)!=0:0)?(q=c[s>>2]|0,(q-t|0)<160):0){G=c[v>>2]|0;c[s>>2]=q+4;c[q>>2]=G}g[k>>2]=+Hm(C,c[u>>2]|0,j);qk(n,t,c[s>>2]|0,j);if((z|0)==0){k=0;q=1}else{k=c[z+12>>2]|0;if((k|0)==(c[z+16>>2]|0)){k=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{k=c[k>>2]|0}q=(k|0)==-1;k=q?0:z;q=q?1:0}if((B|0)!=0){r=c[B+12>>2]|0;if((r|0)==(c[B+16>>2]|0)){r=oc[c[(c[B>>2]|0)+36>>2]&127](B)|0}else{r=c[r>>2]|0}if(!((r|0)==-1)){if(!q){m=70}}else{m=68}}else{m=68}if((m|0)==68?q:0){m=70}if((m|0)==70){c[j>>2]=c[j>>2]|2}c[b>>2]=k;if(!((a[o>>0]&1)==0)?(l=c[p>>2]|0,(l|0)!=0):0){vn(l)}if((a[n>>0]&1)==0){i=d;return}j=c[n+8>>2]|0;if((j|0)==0){i=d;return}vn(j);i=d;return}function ii(b,d,e,f,g,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;d=i;i=i+352|0;w=d+208|0;y=d+184|0;p=d+4|0;n=d+8|0;o=d+196|0;u=d;t=d+24|0;s=d+192|0;v=d+188|0;r=d+337|0;x=d+336|0;z=c[e>>2]|0;B=c[f>>2]|0;qi(n,g,w,y,p);c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;hg(o,10);if((a[o>>0]&1)==0){C=o+1|0;e=C;f=o+8|0}else{C=o+8|0;e=o+1|0;f=C;C=c[C>>2]|0}c[u>>2]=C;c[s>>2]=t;c[v>>2]=0;a[r>>0]=1;a[x>>0]=69;g=o+4|0;y=c[y>>2]|0;A=c[p>>2]|0;p=o+8|0;while(1){if((z|0)==0){D=1;z=0}else{D=c[z+12>>2]|0;if((D|0)==(c[z+16>>2]|0)){D=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{D=c[D>>2]|0}F=(D|0)==-1;D=F?1:0;z=F?0:z}if((B|0)!=0){E=c[B+12>>2]|0;if((E|0)==(c[B+16>>2]|0)){E=oc[c[(c[B>>2]|0)+36>>2]&127](B)|0}else{E=c[E>>2]|0}if(!((E|0)==-1)){if(!D){break}}else{m=16}}else{m=16}if((m|0)==16){m=0;if(D){B=0;break}else{B=0}}D=a[o>>0]|0;E=(D&1)==0;if(E){F=(D&255)>>>1}else{F=c[g>>2]|0}if(((c[u>>2]|0)-C|0)==(F|0)){if(E){G=(D&255)>>>1;F=(D&255)>>>1;C=G<<1;D=G}else{D=c[g>>2]|0;F=c[g>>2]|0;C=D<<1}do{if(!(F>>>0<C>>>0)){if(E){a[o+C+1>>0]=0;a[o>>0]=D<<2;break}else{a[(c[p>>2]|0)+C>>0]=0;c[g>>2]=C;break}}else{hg(o,C-F|0)}}while(0);F=a[o>>0]|0;if((F&1)==0){E=10}else{E=c[o>>2]|0;F=E&255;E=(E&-2)+ -1|0}C=(F&1)==0;if(C){F=(F&255)>>>1}else{F=c[g>>2]|0}do{if(!(F>>>0<E>>>0)){if(C){a[o+E+1>>0]=0;a[o>>0]=E<<1;break}else{a[(c[p>>2]|0)+E>>0]=0;c[g>>2]=E;break}}else{hg(o,E-F|0)}}while(0);if((a[o>>0]&1)==0){C=e}else{C=c[f>>2]|0}c[u>>2]=C+D}E=z+12|0;F=c[E>>2]|0;D=z+16|0;if((F|0)==(c[D>>2]|0)){F=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{F=c[F>>2]|0}if((ri(F,r,x,C,u,y,A,n,t,s,v,w)|0)!=0){break}F=c[E>>2]|0;if((F|0)==(c[D>>2]|0)){oc[c[(c[z>>2]|0)+40>>2]&127](z)|0;continue}else{c[E>>2]=F+4;continue}}w=a[n>>0]|0;if((w&1)==0){w=(w&255)>>>1}else{w=c[n+4>>2]|0}if(((w|0)!=0?(a[r>>0]|0)!=0:0)?(q=c[s>>2]|0,(q-t|0)<160):0){G=c[v>>2]|0;c[s>>2]=q+4;c[q>>2]=G}h[k>>3]=+Gm(C,c[u>>2]|0,j);qk(n,t,c[s>>2]|0,j);if((z|0)==0){k=0;q=1}else{k=c[z+12>>2]|0;if((k|0)==(c[z+16>>2]|0)){k=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{k=c[k>>2]|0}q=(k|0)==-1;k=q?0:z;q=q?1:0}if((B|0)!=0){r=c[B+12>>2]|0;if((r|0)==(c[B+16>>2]|0)){r=oc[c[(c[B>>2]|0)+36>>2]&127](B)|0}else{r=c[r>>2]|0}if(!((r|0)==-1)){if(!q){m=70}}else{m=68}}else{m=68}if((m|0)==68?q:0){m=70}if((m|0)==70){c[j>>2]=c[j>>2]|2}c[b>>2]=k;if(!((a[o>>0]&1)==0)?(l=c[p>>2]|0,(l|0)!=0):0){vn(l)}if((a[n>>0]&1)==0){i=d;return}j=c[n+8>>2]|0;if((j|0)==0){i=d;return}vn(j);i=d;return}function ji(b,d,e,f,g,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;d=i;i=i+352|0;w=d+208|0;y=d+184|0;p=d+4|0;n=d+8|0;o=d+196|0;u=d;t=d+24|0;s=d+192|0;v=d+188|0;r=d+337|0;x=d+336|0;z=c[e>>2]|0;B=c[f>>2]|0;qi(n,g,w,y,p);c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;hg(o,10);if((a[o>>0]&1)==0){C=o+1|0;e=C;f=o+8|0}else{C=o+8|0;e=o+1|0;f=C;C=c[C>>2]|0}c[u>>2]=C;c[s>>2]=t;c[v>>2]=0;a[r>>0]=1;a[x>>0]=69;g=o+4|0;y=c[y>>2]|0;A=c[p>>2]|0;p=o+8|0;while(1){if((z|0)==0){D=1;z=0}else{D=c[z+12>>2]|0;if((D|0)==(c[z+16>>2]|0)){D=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{D=c[D>>2]|0}F=(D|0)==-1;D=F?1:0;z=F?0:z}if((B|0)!=0){E=c[B+12>>2]|0;if((E|0)==(c[B+16>>2]|0)){E=oc[c[(c[B>>2]|0)+36>>2]&127](B)|0}else{E=c[E>>2]|0}if(!((E|0)==-1)){if(!D){break}}else{m=16}}else{m=16}if((m|0)==16){m=0;if(D){B=0;break}else{B=0}}D=a[o>>0]|0;E=(D&1)==0;if(E){F=(D&255)>>>1}else{F=c[g>>2]|0}if(((c[u>>2]|0)-C|0)==(F|0)){if(E){G=(D&255)>>>1;F=(D&255)>>>1;C=G<<1;D=G}else{D=c[g>>2]|0;F=c[g>>2]|0;C=D<<1}do{if(!(F>>>0<C>>>0)){if(E){a[o+C+1>>0]=0;a[o>>0]=D<<2;break}else{a[(c[p>>2]|0)+C>>0]=0;c[g>>2]=C;break}}else{hg(o,C-F|0)}}while(0);F=a[o>>0]|0;if((F&1)==0){E=10}else{E=c[o>>2]|0;F=E&255;E=(E&-2)+ -1|0}C=(F&1)==0;if(C){F=(F&255)>>>1}else{F=c[g>>2]|0}do{if(!(F>>>0<E>>>0)){if(C){a[o+E+1>>0]=0;a[o>>0]=E<<1;break}else{a[(c[p>>2]|0)+E>>0]=0;c[g>>2]=E;break}}else{hg(o,E-F|0)}}while(0);if((a[o>>0]&1)==0){C=e}else{C=c[f>>2]|0}c[u>>2]=C+D}E=z+12|0;F=c[E>>2]|0;D=z+16|0;if((F|0)==(c[D>>2]|0)){F=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{F=c[F>>2]|0}if((ri(F,r,x,C,u,y,A,n,t,s,v,w)|0)!=0){break}F=c[E>>2]|0;if((F|0)==(c[D>>2]|0)){oc[c[(c[z>>2]|0)+40>>2]&127](z)|0;continue}else{c[E>>2]=F+4;continue}}w=a[n>>0]|0;if((w&1)==0){w=(w&255)>>>1}else{w=c[n+4>>2]|0}if(((w|0)!=0?(a[r>>0]|0)!=0:0)?(q=c[s>>2]|0,(q-t|0)<160):0){G=c[v>>2]|0;c[s>>2]=q+4;c[q>>2]=G}h[k>>3]=+Fm(C,c[u>>2]|0,j);qk(n,t,c[s>>2]|0,j);if((z|0)==0){k=0;q=1}else{k=c[z+12>>2]|0;if((k|0)==(c[z+16>>2]|0)){k=oc[c[(c[z>>2]|0)+36>>2]&127](z)|0}else{k=c[k>>2]|0}q=(k|0)==-1;k=q?0:z;q=q?1:0}if((B|0)!=0){r=c[B+12>>2]|0;if((r|0)==(c[B+16>>2]|0)){r=oc[c[(c[B>>2]|0)+36>>2]&127](B)|0}else{r=c[r>>2]|0}if(!((r|0)==-1)){if(!q){m=70}}else{m=68}}else{m=68}if((m|0)==68?q:0){m=70}if((m|0)==70){c[j>>2]=c[j>>2]|2}c[b>>2]=k;if(!((a[o>>0]&1)==0)?(l=c[p>>2]|0,(l|0)!=0):0){vn(l)}if((a[n>>0]&1)==0){i=d;return}j=c[n+8>>2]|0;if((j|0)==0){i=d;return}vn(j);i=d;return}function ki(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;d=i;i=i+304|0;n=d;o=d+192|0;l=d+176|0;v=d+16|0;q=c[g+28>>2]|0;C=q+4|0;c[C>>2]=(c[C>>2]|0)+1;if(!((c[3362]|0)==-1)){c[n>>2]=13448;c[n+4>>2]=208;c[n+8>>2]=0;cg(13448,n)}g=(c[13452>>2]|0)+ -1|0;p=c[q+8>>2]|0;if((c[q+12>>2]|0)-p>>2>>>0>g>>>0?(m=c[p+(g<<2)>>2]|0,(m|0)!=0):0){uc[c[(c[m>>2]|0)+48>>2]&31](m,12016,12042|0,o)|0;B=q+4|0;C=c[B>>2]|0;c[B>>2]=C+ -1;if((C|0)==0){lc[c[(c[q>>2]|0)+8>>2]&255](q)}c[l+0>>2]=0;c[l+4>>2]=0;c[l+8>>2]=0;hg(l,10);if((a[l>>0]&1)==0){y=l+1|0;p=y;q=l+8|0}else{y=l+8|0;p=l+1|0;q=y;y=c[y>>2]|0}r=l+4|0;t=o+96|0;u=o+100|0;s=o+104|0;g=o;m=l+8|0;x=c[e>>2]|0;w=0;z=y;a:while(1){if((x|0)!=0){A=c[x+12>>2]|0;if((A|0)==(c[x+16>>2]|0)){A=oc[c[(c[x>>2]|0)+36>>2]&127](x)|0}else{A=c[A>>2]|0}if((A|0)==-1){c[e>>2]=0;x=0;A=1}else{A=0}}else{x=0;A=1}C=c[f>>2]|0;do{if((C|0)!=0){B=c[C+12>>2]|0;if((B|0)==(c[C+16>>2]|0)){B=oc[c[(c[C>>2]|0)+36>>2]&127](C)|0}else{B=c[B>>2]|0}if(!((B|0)==-1)){if(A){break}else{break a}}else{c[f>>2]=0;k=27;break}}else{k=27}}while(0);if((k|0)==27?(k=0,A):0){break}C=a[l>>0]|0;A=(C&1)==0;if(A){B=(C&255)>>>1}else{B=c[r>>2]|0}if((z-y|0)==(B|0)){if(A){z=(C&255)>>>1;B=(C&255)>>>1;y=z<<1}else{z=c[r>>2]|0;B=c[r>>2]|0;y=z<<1}do{if(!(B>>>0<y>>>0)){if(A){a[l+y+1>>0]=0;a[l>>0]=z<<2;break}else{a[(c[m>>2]|0)+y>>0]=0;c[r>>2]=y;break}}else{hg(l,y-B|0)}}while(0);B=a[l>>0]|0;if((B&1)==0){A=10}else{A=c[l>>2]|0;B=A&255;A=(A&-2)+ -1|0}y=(B&1)==0;if(y){B=(B&255)>>>1}else{B=c[r>>2]|0}do{if(!(B>>>0<A>>>0)){if(y){a[l+A+1>>0]=0;a[l>>0]=A<<1;break}else{a[(c[m>>2]|0)+A>>0]=0;c[r>>2]=A;break}}else{hg(l,A-B|0)}}while(0);if((a[l>>0]&1)==0){y=p}else{y=c[q>>2]|0}z=y+z|0}A=c[x+12>>2]|0;if((A|0)==(c[x+16>>2]|0)){A=oc[c[(c[x>>2]|0)+36>>2]&127](x)|0}else{A=c[A>>2]|0}x=(z|0)==(y|0);do{if(x){B=(c[t>>2]|0)==(A|0);if(!B?(c[u>>2]|0)!=(A|0):0){B=o;k=62;break}a[z>>0]=B?43:45;z=z+1|0;w=0}else{B=o;k=62}}while(0);do{if((k|0)==62){while(1){k=0;if((c[B>>2]|0)==(A|0)){break}B=B+4|0;if((B|0)==(s|0)){B=s;break}else{k=62}}B=B-g|0;A=B>>2;if((B|0)>92){break a}if((B|0)<88){a[z>>0]=a[12016+A>>0]|0;z=z+1|0;w=w+1|0;break}if(x){y=z;break a}if((z-y|0)>=3){break a}if((a[z+ -1>>0]|0)!=48){break a}a[z>>0]=a[12016+A>>0]|0;z=z+1|0;w=0}}while(0);x=c[e>>2]|0;B=x+12|0;A=c[B>>2]|0;if((A|0)==(c[x+16>>2]|0)){oc[c[(c[x>>2]|0)+40>>2]&127](x)|0;C=v;v=C;continue}else{c[B>>2]=A+4;C=v;v=C;continue}}a[y+3>>0]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}C=c[3340]|0;c[n>>2]=j;if((Yh(y,C,n)|0)!=1){c[h>>2]=4}j=c[e>>2]|0;if((j|0)!=0){n=c[j+12>>2]|0;if((n|0)==(c[j+16>>2]|0)){n=oc[c[(c[j>>2]|0)+36>>2]&127](j)|0}else{n=c[n>>2]|0}if((n|0)==-1){c[e>>2]=0;j=0;e=1}else{e=0}}else{j=0;e=1}n=c[f>>2]|0;do{if((n|0)!=0){o=c[n+12>>2]|0;if((o|0)==(c[n+16>>2]|0)){n=oc[c[(c[n>>2]|0)+36>>2]&127](n)|0}else{n=c[o>>2]|0}if(!((n|0)==-1)){if(e){break}else{k=94;break}}else{c[f>>2]=0;k=92;break}}else{k=92}}while(0);if((k|0)==92?e:0){k=94}if((k|0)==94){c[h>>2]=c[h>>2]|2}c[b>>2]=j;if((a[l>>0]&1)==0){i=d;return}f=c[m>>2]|0;if((f|0)==0){i=d;return}vn(f);i=d;return}C=Xa(4)|0;c[C>>2]=21304;wb(C|0,21376,196)}function li(b,d,e,f,g,h,j,k,l,m){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0;n=i;p=c[f>>2]|0;o=(p|0)==(e|0);do{if(o){q=(c[m+96>>2]|0)==(b|0);if(!q?(c[m+100>>2]|0)!=(b|0):0){break}c[f>>2]=e+1;a[e>>0]=q?43:45;c[g>>2]=0;q=0;i=n;return q|0}}while(0);q=a[j>>0]|0;if((q&1)==0){j=(q&255)>>>1}else{j=c[j+4>>2]|0}if((j|0)!=0&(b|0)==(h|0)){o=c[l>>2]|0;if((o-k|0)>=160){q=0;i=n;return q|0}q=c[g>>2]|0;c[l>>2]=o+4;c[o>>2]=q;c[g>>2]=0;q=0;i=n;return q|0}l=m+104|0;k=m;while(1){if((c[k>>2]|0)==(b|0)){break}k=k+4|0;if((k|0)==(l|0)){k=l;break}}b=k-m|0;m=b>>2;if((b|0)>92){q=-1;i=n;return q|0}if((d|0)==10|(d|0)==8){if((m|0)>=(d|0)){q=-1;i=n;return q|0}}else if((d|0)==16?(b|0)>=88:0){if(o){q=-1;i=n;return q|0}if((p-e|0)>=3){q=-1;i=n;return q|0}if((a[p+ -1>>0]|0)!=48){q=-1;i=n;return q|0}c[g>>2]=0;q=a[12016+m>>0]|0;c[f>>2]=p+1;a[p>>0]=q;q=0;i=n;return q|0}q=a[12016+m>>0]|0;c[f>>2]=p+1;a[p>>0]=q;c[g>>2]=(c[g>>2]|0)+1;q=0;i=n;return q|0}function mi(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;h=i;i=i+16|0;l=h;d=c[d+28>>2]|0;o=d+4|0;c[o>>2]=(c[o>>2]|0)+1;if(!((c[3364]|0)==-1)){c[l>>2]=13456;c[l+4>>2]=208;c[l+8>>2]=0;cg(13456,l)}n=(c[13460>>2]|0)+ -1|0;j=d+12|0;m=d+8|0;o=c[m>>2]|0;if((c[j>>2]|0)-o>>2>>>0>n>>>0?(k=c[o+(n<<2)>>2]|0,(k|0)!=0):0){uc[c[(c[k>>2]|0)+32>>2]&31](k,12016,12042|0,e)|0;if(!((c[3400]|0)==-1)){c[l>>2]=13600;c[l+4>>2]=208;c[l+8>>2]=0;cg(13600,l)}e=(c[13604>>2]|0)+ -1|0;k=c[m>>2]|0;if((c[j>>2]|0)-k>>2>>>0>e>>>0?(g=c[k+(e<<2)>>2]|0,(g|0)!=0):0){a[f>>0]=oc[c[(c[g>>2]|0)+16>>2]&127](g)|0;mc[c[(c[g>>2]|0)+20>>2]&127](b,g);n=d+4|0;o=c[n>>2]|0;c[n>>2]=o+ -1;if((o|0)!=0){i=h;return}lc[c[(c[d>>2]|0)+8>>2]&255](d);i=h;return}o=Xa(4)|0;c[o>>2]=21304;wb(o|0,21376,196)}o=Xa(4)|0;c[o>>2]=21304;wb(o|0,21376,196)}function ni(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=i;i=i+16|0;l=j;d=c[d+28>>2]|0;p=d+4|0;c[p>>2]=(c[p>>2]|0)+1;if(!((c[3364]|0)==-1)){c[l>>2]=13456;c[l+4>>2]=208;c[l+8>>2]=0;cg(13456,l)}o=(c[13460>>2]|0)+ -1|0;k=d+12|0;n=d+8|0;p=c[n>>2]|0;if((c[k>>2]|0)-p>>2>>>0>o>>>0?(m=c[p+(o<<2)>>2]|0,(m|0)!=0):0){uc[c[(c[m>>2]|0)+32>>2]&31](m,12016,12048|0,e)|0;if(!((c[3400]|0)==-1)){c[l>>2]=13600;c[l+4>>2]=208;c[l+8>>2]=0;cg(13600,l)}e=(c[13604>>2]|0)+ -1|0;l=c[n>>2]|0;if((c[k>>2]|0)-l>>2>>>0>e>>>0?(h=c[l+(e<<2)>>2]|0,(h|0)!=0):0){a[f>>0]=oc[c[(c[h>>2]|0)+12>>2]&127](h)|0;a[g>>0]=oc[c[(c[h>>2]|0)+16>>2]&127](h)|0;mc[c[(c[h>>2]|0)+20>>2]&127](b,h);o=d+4|0;p=c[o>>2]|0;c[o>>2]=p+ -1;if((p|0)!=0){i=j;return}lc[c[(c[d>>2]|0)+8>>2]&255](d);i=j;return}p=Xa(4)|0;c[p>>2]=21304;wb(p|0,21376,196)}p=Xa(4)|0;c[p>>2]=21304;wb(p|0,21376,196)}function oi(b,d,e,f,g,h,j,k,l,m,n,o){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0;p=i;if(b<<24>>24==h<<24>>24){if((a[d>>0]|0)==0){j=-1;i=p;return j|0}a[d>>0]=0;j=c[g>>2]|0;c[g>>2]=j+1;a[j>>0]=46;g=a[k>>0]|0;if((g&1)==0){g=(g&255)>>>1}else{g=c[k+4>>2]|0}if((g|0)==0){j=0;i=p;return j|0}g=c[m>>2]|0;if((g-l|0)>=160){j=0;i=p;return j|0}j=c[n>>2]|0;c[m>>2]=g+4;c[g>>2]=j;j=0;i=p;return j|0}if(b<<24>>24==j<<24>>24){h=a[k>>0]|0;if((h&1)==0){h=(h&255)>>>1}else{h=c[k+4>>2]|0}if((h|0)!=0){if((a[d>>0]|0)==0){j=-1;i=p;return j|0}g=c[m>>2]|0;if((g-l|0)>=160){j=0;i=p;return j|0}j=c[n>>2]|0;c[m>>2]=g+4;c[g>>2]=j;c[n>>2]=0;j=0;i=p;return j|0}}h=o+32|0;j=o;do{if((a[j>>0]|0)==b<<24>>24){h=j;break}j=j+1|0}while((j|0)!=(h|0));b=h-o|0;if((b|0)>31){j=-1;i=p;return j|0}o=a[12016+b>>0]|0;if((b|0)==23|(b|0)==22){a[e>>0]=80;j=c[g>>2]|0;c[g>>2]=j+1;a[j>>0]=o;j=0;i=p;return j|0}else if((b|0)==24|(b|0)==25){n=c[g>>2]|0;if((n|0)!=(f|0)?(a[n+ -1>>0]&95|0)!=(a[e>>0]&127|0):0){j=-1;i=p;return j|0}c[g>>2]=n+1;a[n>>0]=o;j=0;i=p;return j|0}else{f=o&95;if((f|0)==(a[e>>0]|0)?(a[e>>0]=f|128,(a[d>>0]|0)!=0):0){a[d>>0]=0;e=a[k>>0]|0;if((e&1)==0){k=(e&255)>>>1}else{k=c[k+4>>2]|0}if((k|0)!=0?(q=c[m>>2]|0,(q-l|0)<160):0){j=c[n>>2]|0;c[m>>2]=q+4;c[q>>2]=j}}j=c[g>>2]|0;c[g>>2]=j+1;a[j>>0]=o;if((b|0)>21){j=0;i=p;return j|0}c[n>>2]=(c[n>>2]|0)+1;j=0;i=p;return j|0}return 0}function pi(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;g=i;i=i+16|0;k=g;b=c[b+28>>2]|0;n=b+4|0;c[n>>2]=(c[n>>2]|0)+1;if(!((c[3362]|0)==-1)){c[k>>2]=13448;c[k+4>>2]=208;c[k+8>>2]=0;cg(13448,k)}m=(c[13452>>2]|0)+ -1|0;h=b+12|0;l=b+8|0;n=c[l>>2]|0;if((c[h>>2]|0)-n>>2>>>0>m>>>0?(j=c[n+(m<<2)>>2]|0,(j|0)!=0):0){uc[c[(c[j>>2]|0)+48>>2]&31](j,12016,12042|0,d)|0;if(!((c[3402]|0)==-1)){c[k>>2]=13608;c[k+4>>2]=208;c[k+8>>2]=0;cg(13608,k)}d=(c[13612>>2]|0)+ -1|0;j=c[l>>2]|0;if((c[h>>2]|0)-j>>2>>>0>d>>>0?(f=c[j+(d<<2)>>2]|0,(f|0)!=0):0){c[e>>2]=oc[c[(c[f>>2]|0)+16>>2]&127](f)|0;mc[c[(c[f>>2]|0)+20>>2]&127](a,f);m=b+4|0;n=c[m>>2]|0;c[m>>2]=n+ -1;if((n|0)!=0){i=g;return}lc[c[(c[b>>2]|0)+8>>2]&255](b);i=g;return}n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}n=Xa(4)|0;c[n>>2]=21304;wb(n|0,21376,196)}function qi(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;h=i;i=i+16|0;k=h;b=c[b+28>>2]|0;o=b+4|0;c[o>>2]=(c[o>>2]|0)+1;if(!((c[3362]|0)==-1)){c[k>>2]=13448;c[k+4>>2]=208;c[k+8>>2]=0;cg(13448,k)}n=(c[13452>>2]|0)+ -1|0;j=b+12|0;m=b+8|0;o=c[m>>2]|0;if((c[j>>2]|0)-o>>2>>>0>n>>>0?(l=c[o+(n<<2)>>2]|0,(l|0)!=0):0){uc[c[(c[l>>2]|0)+48>>2]&31](l,12016,12048|0,d)|0;if(!((c[3402]|0)==-1)){c[k>>2]=13608;c[k+4>>2]=208;c[k+8>>2]=0;cg(13608,k)}d=(c[13612>>2]|0)+ -1|0;k=c[m>>2]|0;if((c[j>>2]|0)-k>>2>>>0>d>>>0?(g=c[k+(d<<2)>>2]|0,(g|0)!=0):0){c[e>>2]=oc[c[(c[g>>2]|0)+12>>2]&127](g)|0;c[f>>2]=oc[c[(c[g>>2]|0)+16>>2]&127](g)|0;mc[c[(c[g>>2]|0)+20>>2]&127](a,g);n=b+4|0;o=c[n>>2]|0;c[n>>2]=o+ -1;if((o|0)!=0){i=h;return}lc[c[(c[b>>2]|0)+8>>2]&255](b);i=h;return}o=Xa(4)|0;c[o>>2]=21304;wb(o|0,21376,196)}o=Xa(4)|0;c[o>>2]=21304;wb(o|0,21376,196)}function ri(b,d,e,f,g,h,j,k,l,m,n,o){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0;p=i;if((b|0)==(h|0)){if((a[d>>0]|0)==0){j=-1;i=p;return j|0}a[d>>0]=0;j=c[g>>2]|0;c[g>>2]=j+1;a[j>>0]=46;g=a[k>>0]|0;if((g&1)==0){g=(g&255)>>>1}else{g=c[k+4>>2]|0}if((g|0)==0){j=0;i=p;return j|0}g=c[m>>2]|0;if((g-l|0)>=160){j=0;i=p;return j|0}j=c[n>>2]|0;c[m>>2]=g+4;c[g>>2]=j;j=0;i=p;return j|0}if((b|0)==(j|0)){h=a[k>>0]|0;if((h&1)==0){h=(h&255)>>>1}else{h=c[k+4>>2]|0}if((h|0)!=0){if((a[d>>0]|0)==0){j=-1;i=p;return j|0}g=c[m>>2]|0;if((g-l|0)>=160){j=0;i=p;return j|0}j=c[n>>2]|0;c[m>>2]=g+4;c[g>>2]=j;c[n>>2]=0;j=0;i=p;return j|0}}h=o+128|0;j=o;do{if((c[j>>2]|0)==(b|0)){h=j;break}j=j+4|0}while((j|0)!=(h|0));b=h-o|0;h=b>>2;if((b|0)>124){j=-1;i=p;return j|0}o=a[12016+h>>0]|0;if((h|0)==24|(h|0)==25){n=c[g>>2]|0;if((n|0)!=(f|0)?(a[n+ -1>>0]&95|0)!=(a[e>>0]&127|0):0){j=-1;i=p;return j|0}c[g>>2]=n+1;a[n>>0]=o;j=0;i=p;return j|0}else if(!((h|0)==23|(h|0)==22)){f=o&95;if((f|0)==(a[e>>0]|0)?(a[e>>0]=f|128,(a[d>>0]|0)!=0):0){a[d>>0]=0;e=a[k>>0]|0;if((e&1)==0){k=(e&255)>>>1}else{k=c[k+4>>2]|0}if((k|0)!=0?(q=c[m>>2]|0,(q-l|0)<160):0){j=c[n>>2]|0;c[m>>2]=q+4;c[q>>2]=j}}}else{a[e>>0]=80}j=c[g>>2]|0;c[g>>2]=j+1;a[j>>0]=o;if((b|0)>84){j=0;i=p;return j|0}c[n>>2]=(c[n>>2]|0)+1;j=0;i=p;return j|0}function si(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function ti(a){a=a|0;return}function ui(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0;j=i;i=i+32|0;m=j;n=j+24|0;k=j+12|0;if((c[f+4>>2]&1|0)==0){l=c[(c[d>>2]|0)+24>>2]|0;c[n>>2]=c[e>>2];o=h&1;c[m+0>>2]=c[n+0>>2];wc[l&63](b,d,m,f,g,o);i=j;return}d=c[f+28>>2]|0;o=d+4|0;c[o>>2]=(c[o>>2]|0)+1;if(!((c[3400]|0)==-1)){c[m>>2]=13600;c[m+4>>2]=208;c[m+8>>2]=0;cg(13600,m)}f=(c[13604>>2]|0)+ -1|0;m=c[d+8>>2]|0;if((c[d+12>>2]|0)-m>>2>>>0>f>>>0?(l=c[m+(f<<2)>>2]|0,(l|0)!=0):0){g=d+4|0;o=c[g>>2]|0;c[g>>2]=o+ -1;if((o|0)==0){lc[c[(c[d>>2]|0)+8>>2]&255](d)}m=c[l>>2]|0;if(h){mc[c[m+24>>2]&127](k,l)}else{mc[c[m+28>>2]&127](k,l)}n=a[k>>0]|0;if((n&1)==0){h=k+1|0;d=h;l=k+8|0}else{l=k+8|0;d=c[l>>2]|0;h=k+1|0}m=k+4|0;while(1){f=(n&1)==0;if(f){g=h;n=(n&255)>>>1}else{g=c[l>>2]|0;n=c[m>>2]|0}if((d|0)==(g+n|0)){break}o=a[d>>0]|0;n=c[e>>2]|0;do{if((n|0)!=0){f=n+24|0;g=c[f>>2]|0;if((g|0)!=(c[n+28>>2]|0)){c[f>>2]=g+1;a[g>>0]=o;break}if((xc[c[(c[n>>2]|0)+52>>2]&63](n,o&255)|0)==-1){c[e>>2]=0}}}while(0);n=a[k>>0]|0;d=d+1|0}c[b>>2]=c[e>>2];if(f){i=j;return}k=c[k+8>>2]|0;if((k|0)==0){i=j;return}vn(k);i=j;return}o=Xa(4)|0;c[o>>2]=21304;wb(o|0,21376,196)}function vi(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=i;i=i+64|0;r=d;q=d+16|0;n=d+24|0;m=d+36|0;k=d+8|0;l=d+4|0;o=d+12|0;a[q+0>>0]=a[12264>>0]|0;a[q+1>>0]=a[12265>>0]|0;a[q+2>>0]=a[12266>>0]|0;a[q+3>>0]=a[12267>>0]|0;a[q+4>>0]=a[12268>>0]|0;a[q+5>>0]=a[12269>>0]|0;t=q+1|0;p=f+4|0;s=c[p>>2]|0;if((s&2048|0)!=0){a[t>>0]=43;t=q+2|0}if((s&512|0)!=0){a[t>>0]=35;t=t+1|0}a[t>>0]=108;t=t+1|0;u=s&74;do{if((u|0)==64){a[t>>0]=111}else if((u|0)==8){if((s&16384|0)==0){a[t>>0]=120;break}else{a[t>>0]=88;break}}else{a[t>>0]=100}}while(0);if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}u=c[3340]|0;c[r>>2]=h;q=wi(n,12,u,q,r)|0;h=n+q|0;p=c[p>>2]&176;do{if((p|0)==32){p=h}else if((p|0)==16){p=a[n>>0]|0;if(p<<24>>24==43|p<<24>>24==45){p=n+1|0;break}if((q|0)>1&p<<24>>24==48?(u=a[n+1>>0]|0,u<<24>>24==88|u<<24>>24==120):0){p=n+2|0}else{j=21}}else{j=21}}while(0);if((j|0)==21){p=n}j=c[f+28>>2]|0;c[o>>2]=j;j=j+4|0;c[j>>2]=(c[j>>2]|0)+1;xi(n,p,h,m,k,l,o);j=c[o>>2]|0;t=j+4|0;u=c[t>>2]|0;c[t>>2]=u+ -1;if((u|0)!=0){s=c[e>>2]|0;t=c[k>>2]|0;u=c[l>>2]|0;Wc(b,s,m,t,u,f,g);i=d;return}lc[c[(c[j>>2]|0)+8>>2]&255](j);s=c[e>>2]|0;t=c[k>>2]|0;u=c[l>>2]|0;Wc(b,s,m,t,u,f,g);i=d;return}function wi(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=i;i=i+16|0;h=g;c[h>>2]=f;d=ib(d|0)|0;e=Qb(a|0,b|0,e|0,h|0)|0;if((d|0)==0){i=g;return e|0}ib(d|0)|0;i=g;return e|0}function xi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;k=i;i=i+32|0;p=k;l=k+12|0;n=c[j>>2]|0;if(!((c[3364]|0)==-1)){c[p>>2]=13456;c[p+4>>2]=208;c[p+8>>2]=0;cg(13456,p)}r=(c[13460>>2]|0)+ -1|0;s=c[n+8>>2]|0;if(!((c[n+12>>2]|0)-s>>2>>>0>r>>>0)){v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}n=c[s+(r<<2)>>2]|0;if((n|0)==0){v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}j=c[j>>2]|0;if(!((c[3400]|0)==-1)){c[p>>2]=13600;c[p+4>>2]=208;c[p+8>>2]=0;cg(13600,p)}p=(c[13604>>2]|0)+ -1|0;r=c[j+8>>2]|0;if(!((c[j+12>>2]|0)-r>>2>>>0>p>>>0)){v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}j=c[r+(p<<2)>>2]|0;if((j|0)==0){v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}mc[c[(c[j>>2]|0)+20>>2]&127](l,j);p=a[l>>0]|0;if((p&1)==0){p=(p&255)>>>1}else{p=c[l+4>>2]|0}if((p|0)!=0){c[h>>2]=f;p=a[b>>0]|0;if(p<<24>>24==43|p<<24>>24==45){v=xc[c[(c[n>>2]|0)+28>>2]&63](n,p)|0;p=c[h>>2]|0;c[h>>2]=p+1;a[p>>0]=v;p=b+1|0}else{p=b}if(((e-p|0)>1?(a[p>>0]|0)==48:0)?(q=p+1|0,v=a[q>>0]|0,v<<24>>24==88|v<<24>>24==120):0){v=xc[c[(c[n>>2]|0)+28>>2]&63](n,48)|0;u=c[h>>2]|0;c[h>>2]=u+1;a[u>>0]=v;u=xc[c[(c[n>>2]|0)+28>>2]&63](n,a[q>>0]|0)|0;v=c[h>>2]|0;c[h>>2]=v+1;a[v>>0]=u;p=p+2|0}if((p|0)!=(e|0)?(o=e+ -1|0,o>>>0>p>>>0):0){q=p;do{v=a[q>>0]|0;a[q>>0]=a[o>>0]|0;a[o>>0]=v;q=q+1|0;o=o+ -1|0}while(q>>>0<o>>>0)}j=oc[c[(c[j>>2]|0)+16>>2]&127](j)|0;if(p>>>0<e>>>0){q=l+1|0;s=l+4|0;o=l+8|0;u=0;t=0;r=p;while(1){v=a[((a[l>>0]&1)==0?q:c[o>>2]|0)+t>>0]|0;if(v<<24>>24!=0&(u|0)==(v<<24>>24|0)){u=c[h>>2]|0;c[h>>2]=u+1;a[u>>0]=j;u=a[l>>0]|0;if((u&1)==0){v=(u&255)>>>1}else{v=c[s>>2]|0}u=0;t=(t>>>0<(v+ -1|0)>>>0&1)+t|0}w=xc[c[(c[n>>2]|0)+28>>2]&63](n,a[r>>0]|0)|0;v=c[h>>2]|0;c[h>>2]=v+1;a[v>>0]=w;r=r+1|0;if(!(r>>>0<e>>>0)){break}else{u=u+1|0}}}o=f+(p-b)|0;n=c[h>>2]|0;if((o|0)!=(n|0)?(m=n+ -1|0,m>>>0>o>>>0):0){do{w=a[o>>0]|0;a[o>>0]=a[m>>0]|0;a[m>>0]=w;o=o+1|0;m=m+ -1|0}while(o>>>0<m>>>0)}}else{uc[c[(c[n>>2]|0)+32>>2]&31](n,b,e,f)|0;c[h>>2]=f+(e-b)}if((d|0)==(e|0)){b=c[h>>2]|0}else{b=f+(d-b)|0}c[g>>2]=b;if((a[l>>0]&1)==0){i=k;return}l=c[l+8>>2]|0;if((l|0)==0){i=k;return}vn(l);i=k;return}function yi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=i;i=i+96|0;n=d+8|0;s=d;o=d+64|0;k=d+60|0;m=d+56|0;p=d+52|0;u=s;c[u>>2]=37;c[u+4>>2]=0;u=s+1|0;q=f+4|0;r=c[q>>2]|0;if((r&2048|0)!=0){a[u>>0]=43;u=s+2|0}if((r&512|0)!=0){a[u>>0]=35;u=u+1|0}t=u+2|0;a[u>>0]=108;a[u+1>>0]=108;u=r&74;do{if((u|0)==64){a[t>>0]=111}else if((u|0)==8){if((r&16384|0)==0){a[t>>0]=120;break}else{a[t>>0]=88;break}}else{a[t>>0]=100}}while(0);if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}u=c[3340]|0;t=n;c[t>>2]=h;c[t+4>>2]=j;j=wi(o,22,u,s,n)|0;h=o+j|0;q=c[q>>2]&176;do{if((q|0)==32){q=h}else if((q|0)==16){q=a[o>>0]|0;if(q<<24>>24==43|q<<24>>24==45){q=o+1|0;break}if((j|0)>1&q<<24>>24==48?(u=a[o+1>>0]|0,u<<24>>24==88|u<<24>>24==120):0){q=o+2|0}else{l=21}}else{l=21}}while(0);if((l|0)==21){q=o}l=c[f+28>>2]|0;c[p>>2]=l;l=l+4|0;c[l>>2]=(c[l>>2]|0)+1;xi(o,q,h,n,k,m,p);l=c[p>>2]|0;t=l+4|0;u=c[t>>2]|0;c[t>>2]=u+ -1;if((u|0)!=0){s=c[e>>2]|0;t=c[k>>2]|0;u=c[m>>2]|0;Wc(b,s,n,t,u,f,g);i=d;return}lc[c[(c[l>>2]|0)+8>>2]&255](l);s=c[e>>2]|0;t=c[k>>2]|0;u=c[m>>2]|0;Wc(b,s,n,t,u,f,g);i=d;return}function zi(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;m=i;i=i+64|0;r=m;q=m+16|0;n=m+24|0;k=m+36|0;d=m+8|0;j=m+4|0;o=m+12|0;a[q+0>>0]=a[12264>>0]|0;a[q+1>>0]=a[12265>>0]|0;a[q+2>>0]=a[12266>>0]|0;a[q+3>>0]=a[12267>>0]|0;a[q+4>>0]=a[12268>>0]|0;a[q+5>>0]=a[12269>>0]|0;t=q+1|0;p=f+4|0;s=c[p>>2]|0;if((s&2048|0)!=0){a[t>>0]=43;t=q+2|0}if((s&512|0)!=0){a[t>>0]=35;t=t+1|0}a[t>>0]=108;t=t+1|0;u=s&74;do{if((u|0)==8){if((s&16384|0)==0){a[t>>0]=120;break}else{a[t>>0]=88;break}}else if((u|0)==64){a[t>>0]=111}else{a[t>>0]=117}}while(0);if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}u=c[3340]|0;c[r>>2]=h;q=wi(n,12,u,q,r)|0;h=n+q|0;p=c[p>>2]&176;do{if((p|0)==32){p=h}else if((p|0)==16){p=a[n>>0]|0;if(p<<24>>24==43|p<<24>>24==45){p=n+1|0;break}if((q|0)>1&p<<24>>24==48?(u=a[n+1>>0]|0,u<<24>>24==88|u<<24>>24==120):0){p=n+2|0}else{l=21}}else{l=21}}while(0);if((l|0)==21){p=n}l=c[f+28>>2]|0;c[o>>2]=l;l=l+4|0;c[l>>2]=(c[l>>2]|0)+1;xi(n,p,h,k,d,j,o);l=c[o>>2]|0;t=l+4|0;u=c[t>>2]|0;c[t>>2]=u+ -1;if((u|0)!=0){s=c[e>>2]|0;t=c[d>>2]|0;u=c[j>>2]|0;Wc(b,s,k,t,u,f,g);i=m;return}lc[c[(c[l>>2]|0)+8>>2]&255](l);s=c[e>>2]|0;t=c[d>>2]|0;u=c[j>>2]|0;Wc(b,s,k,t,u,f,g);i=m;return}function Ai(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=i;i=i+96|0;n=d+8|0;s=d;o=d+64|0;k=d+60|0;m=d+56|0;p=d+52|0;u=s;c[u>>2]=37;c[u+4>>2]=0;u=s+1|0;q=f+4|0;r=c[q>>2]|0;if((r&2048|0)!=0){a[u>>0]=43;u=s+2|0}if((r&512|0)!=0){a[u>>0]=35;u=u+1|0}t=u+2|0;a[u>>0]=108;a[u+1>>0]=108;u=r&74;do{if((u|0)==64){a[t>>0]=111}else if((u|0)==8){if((r&16384|0)==0){a[t>>0]=120;break}else{a[t>>0]=88;break}}else{a[t>>0]=117}}while(0);if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}u=c[3340]|0;t=n;c[t>>2]=h;c[t+4>>2]=j;j=wi(o,23,u,s,n)|0;h=o+j|0;q=c[q>>2]&176;do{if((q|0)==32){q=h}else if((q|0)==16){q=a[o>>0]|0;if(q<<24>>24==43|q<<24>>24==45){q=o+1|0;break}if((j|0)>1&q<<24>>24==48?(u=a[o+1>>0]|0,u<<24>>24==88|u<<24>>24==120):0){q=o+2|0}else{l=21}}else{l=21}}while(0);if((l|0)==21){q=o}l=c[f+28>>2]|0;c[p>>2]=l;l=l+4|0;c[l>>2]=(c[l>>2]|0)+1;xi(o,q,h,n,k,m,p);l=c[p>>2]|0;t=l+4|0;u=c[t>>2]|0;c[t>>2]=u+ -1;if((u|0)!=0){s=c[e>>2]|0;t=c[k>>2]|0;u=c[m>>2]|0;Wc(b,s,n,t,u,f,g);i=d;return}lc[c[(c[l>>2]|0)+8>>2]&255](l);s=c[e>>2]|0;t=c[k>>2]|0;u=c[m>>2]|0;Wc(b,s,n,t,u,f,g);i=d;return}function Bi(b,d,e,f,g,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=+j;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;d=i;i=i+128|0;p=d;u=d+64|0;r=d+92|0;t=d+80|0;l=d+76|0;n=d+72|0;o=d+84|0;m=d+88|0;v=u;c[v>>2]=37;c[v+4>>2]=0;v=u+1|0;s=f+4|0;w=c[s>>2]|0;if((w&2048|0)!=0){a[v>>0]=43;v=u+2|0}if((w&1024|0)!=0){a[v>>0]=35;v=v+1|0}x=w&260;y=w>>>14;do{if((x|0)==260){if((y&1|0)==0){a[v>>0]=97;v=0;break}else{a[v>>0]=65;v=0;break}}else{a[v>>0]=46;w=v+2|0;a[v+1>>0]=42;if((x|0)==4){if((y&1|0)==0){a[w>>0]=102;v=1;break}else{a[w>>0]=70;v=1;break}}else if((x|0)==256){if((y&1|0)==0){a[w>>0]=101;v=1;break}else{a[w>>0]=69;v=1;break}}else{if((y&1|0)==0){a[w>>0]=103;v=1;break}else{a[w>>0]=71;v=1;break}}}}while(0);c[t>>2]=r;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;if(v){c[p>>2]=c[f+8>>2];y=p+4|0;h[k>>3]=j;c[y>>2]=c[k>>2];c[y+4>>2]=c[k+4>>2];w=wi(r,30,w,u,p)|0}else{h[k>>3]=j;c[p>>2]=c[k>>2];c[p+4>>2]=c[k+4>>2];w=wi(r,30,w,u,p)|0}if((w|0)>29){w=(a[13368]|0)==0;if(v){if(w?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;c[p>>2]=c[f+8>>2];y=p+4|0;h[k>>3]=j;c[y>>2]=c[k>>2];c[y+4>>2]=c[k+4>>2];w=Ci(t,w,u,p)|0}else{if(w?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;c[p>>2]=c[f+8>>2];y=p+4|0;h[k>>3]=j;c[y>>2]=c[k>>2];c[y+4>>2]=c[k+4>>2];w=Ci(t,w,u,p)|0}t=c[t>>2]|0;if((t|0)==0){y=Xa(4)|0;c[y>>2]=22680;wb(y|0,22728,206)}else{v=t}}else{v=c[t>>2]|0;t=0}u=v+w|0;s=c[s>>2]&176;do{if((s|0)==16){s=a[v>>0]|0;if(s<<24>>24==43|s<<24>>24==45){s=v+1|0;break}if((w|0)>1&s<<24>>24==48?(y=a[v+1>>0]|0,y<<24>>24==88|y<<24>>24==120):0){s=v+2|0}else{q=48}}else if((s|0)==32){s=u}else{q=48}}while(0);if((q|0)==48){s=v}if((v|0)!=(r|0)){p=un(w<<1)|0;if((p|0)==0){y=Xa(4)|0;c[y>>2]=22680;wb(y|0,22728,206)}else{r=v;q=p}}else{q=0}x=c[f+28>>2]|0;c[o>>2]=x;x=x+4|0;c[x>>2]=(c[x>>2]|0)+1;Di(r,s,u,p,l,n,o);o=c[o>>2]|0;x=o+4|0;y=c[x>>2]|0;c[x>>2]=y+ -1;if((y|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}Wc(m,c[e>>2]|0,p,c[l>>2]|0,c[n>>2]|0,f,g);y=c[m>>2]|0;c[e>>2]=y;c[b>>2]=y;if((q|0)!=0){vn(q)}if((t|0)==0){i=d;return}vn(t);i=d;return}function Ci(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=i;i=i+16|0;g=f;c[g>>2]=e;b=ib(b|0)|0;d=Ib(a|0,d|0,g|0)|0;if((b|0)==0){i=f;return d|0}ib(b|0)|0;i=f;return d|0}function Di(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;k=i;i=i+32|0;o=k;l=k+12|0;m=c[j>>2]|0;if(!((c[3364]|0)==-1)){c[o>>2]=13456;c[o+4>>2]=208;c[o+8>>2]=0;cg(13456,o)}t=(c[13460>>2]|0)+ -1|0;r=c[m+8>>2]|0;if(!((c[m+12>>2]|0)-r>>2>>>0>t>>>0)){y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}m=c[r+(t<<2)>>2]|0;if((m|0)==0){y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}j=c[j>>2]|0;if(!((c[3400]|0)==-1)){c[o>>2]=13600;c[o+4>>2]=208;c[o+8>>2]=0;cg(13600,o)}o=(c[13604>>2]|0)+ -1|0;r=c[j+8>>2]|0;if(!((c[j+12>>2]|0)-r>>2>>>0>o>>>0)){y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}o=c[r+(o<<2)>>2]|0;if((o|0)==0){y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}mc[c[(c[o>>2]|0)+20>>2]&127](l,o);c[h>>2]=f;j=a[b>>0]|0;if(j<<24>>24==43|j<<24>>24==45){y=xc[c[(c[m>>2]|0)+28>>2]&63](m,j)|0;t=c[h>>2]|0;c[h>>2]=t+1;a[t>>0]=y;t=b+1|0}else{t=b}j=e;a:do{if(((j-t|0)>1?(a[t>>0]|0)==48:0)?(p=t+1|0,y=a[p>>0]|0,y<<24>>24==88|y<<24>>24==120):0){y=xc[c[(c[m>>2]|0)+28>>2]&63](m,48)|0;x=c[h>>2]|0;c[h>>2]=x+1;a[x>>0]=y;t=t+2|0;x=xc[c[(c[m>>2]|0)+28>>2]&63](m,a[p>>0]|0)|0;y=c[h>>2]|0;c[h>>2]=y+1;a[y>>0]=x;if(t>>>0<e>>>0){r=t;while(1){p=a[r>>0]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}y=p<<24>>24;if(!((y+ -48|0)>>>0<10)?!(((y|32)+ -97|0)>>>0<6):0){p=t;break a}r=r+1|0;if(!(r>>>0<e>>>0)){p=t;break}}}else{p=t;r=t}}else{s=15}}while(0);b:do{if((s|0)==15){if(t>>>0<e>>>0){r=t;while(1){p=a[r>>0]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}s=r+1|0;if(!(((p<<24>>24)+ -48|0)>>>0<10)){p=t;break b}if(s>>>0<e>>>0){r=s}else{p=t;r=s;break}}}else{p=t;r=t}}}while(0);s=a[l>>0]|0;if((s&1)==0){s=(s&255)>>>1}else{s=c[l+4>>2]|0}if((s|0)!=0){if((p|0)!=(r|0)?(q=r+ -1|0,q>>>0>p>>>0):0){s=p;do{y=a[s>>0]|0;a[s>>0]=a[q>>0]|0;a[q>>0]=y;s=s+1|0;q=q+ -1|0}while(s>>>0<q>>>0)}u=oc[c[(c[o>>2]|0)+16>>2]&127](o)|0;if(p>>>0<r>>>0){q=l+1|0;t=l+4|0;s=l+8|0;x=0;w=0;v=p;while(1){y=a[((a[l>>0]&1)==0?q:c[s>>2]|0)+w>>0]|0;if(y<<24>>24>0&(x|0)==(y<<24>>24|0)){x=c[h>>2]|0;c[h>>2]=x+1;a[x>>0]=u;x=a[l>>0]|0;if((x&1)==0){y=(x&255)>>>1}else{y=c[t>>2]|0}x=0;w=(w>>>0<(y+ -1|0)>>>0&1)+w|0}z=xc[c[(c[m>>2]|0)+28>>2]&63](m,a[v>>0]|0)|0;y=c[h>>2]|0;c[h>>2]=y+1;a[y>>0]=z;v=v+1|0;if(!(v>>>0<r>>>0)){break}else{x=x+1|0}}}p=f+(p-b)|0;q=c[h>>2]|0;if((p|0)!=(q|0)?(n=q+ -1|0,n>>>0>p>>>0):0){do{z=a[p>>0]|0;a[p>>0]=a[n>>0]|0;a[n>>0]=z;p=p+1|0;n=n+ -1|0}while(p>>>0<n>>>0)}}else{uc[c[(c[m>>2]|0)+32>>2]&31](m,p,r,c[h>>2]|0)|0;c[h>>2]=(c[h>>2]|0)+(r-p)}c:do{if(r>>>0<e>>>0){while(1){n=a[r>>0]|0;if(n<<24>>24==46){break}y=xc[c[(c[m>>2]|0)+28>>2]&63](m,n)|0;z=c[h>>2]|0;c[h>>2]=z+1;a[z>>0]=y;r=r+1|0;if(!(r>>>0<e>>>0)){break c}}y=oc[c[(c[o>>2]|0)+12>>2]&127](o)|0;z=c[h>>2]|0;c[h>>2]=z+1;a[z>>0]=y;r=r+1|0}}while(0);uc[c[(c[m>>2]|0)+32>>2]&31](m,r,e,c[h>>2]|0)|0;m=(c[h>>2]|0)+(j-r)|0;c[h>>2]=m;if((d|0)!=(e|0)){m=f+(d-b)|0}c[g>>2]=m;if((a[l>>0]&1)==0){i=k;return}l=c[l+8>>2]|0;if((l|0)==0){i=k;return}vn(l);i=k;return}function Ei(b,d,e,f,g,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=+j;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;d=i;i=i+128|0;p=d;u=d+64|0;r=d+92|0;t=d+80|0;l=d+76|0;m=d+72|0;o=d+84|0;n=d+88|0;x=u;c[x>>2]=37;c[x+4>>2]=0;x=u+1|0;s=f+4|0;v=c[s>>2]|0;if((v&2048|0)!=0){a[x>>0]=43;x=u+2|0}if((v&1024|0)!=0){a[x>>0]=35;x=x+1|0}w=v&260;v=v>>>14;do{if((w|0)==260){a[x>>0]=76;w=x+1|0;if((v&1|0)==0){a[w>>0]=97;v=0;break}else{a[w>>0]=65;v=0;break}}else{a[x>>0]=46;a[x+1>>0]=42;a[x+2>>0]=76;x=x+3|0;if((w|0)==256){if((v&1|0)==0){a[x>>0]=101;v=1;break}else{a[x>>0]=69;v=1;break}}else if((w|0)==4){if((v&1|0)==0){a[x>>0]=102;v=1;break}else{a[x>>0]=70;v=1;break}}else{if((v&1|0)==0){a[x>>0]=103;v=1;break}else{a[x>>0]=71;v=1;break}}}}while(0);c[t>>2]=r;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;if(v){c[p>>2]=c[f+8>>2];x=p+4|0;h[k>>3]=j;c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];w=wi(r,30,w,u,p)|0}else{h[k>>3]=j;c[p>>2]=c[k>>2];c[p+4>>2]=c[k+4>>2];w=wi(r,30,w,u,p)|0}if((w|0)>29){w=(a[13368]|0)==0;if(v){if(w?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;c[p>>2]=c[f+8>>2];x=p+4|0;h[k>>3]=j;c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];w=Ci(t,w,u,p)|0}else{if(w?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;h[k>>3]=j;c[p>>2]=c[k>>2];c[p+4>>2]=c[k+4>>2];w=Ci(t,w,u,p)|0}t=c[t>>2]|0;if((t|0)==0){x=Xa(4)|0;c[x>>2]=22680;wb(x|0,22728,206)}else{v=t}}else{v=c[t>>2]|0;t=0}u=v+w|0;s=c[s>>2]&176;do{if((s|0)==16){s=a[v>>0]|0;if(s<<24>>24==43|s<<24>>24==45){s=v+1|0;break}if((w|0)>1&s<<24>>24==48?(x=a[v+1>>0]|0,x<<24>>24==88|x<<24>>24==120):0){s=v+2|0}else{q=48}}else if((s|0)==32){s=u}else{q=48}}while(0);if((q|0)==48){s=v}if((v|0)!=(r|0)){p=un(w<<1)|0;if((p|0)==0){x=Xa(4)|0;c[x>>2]=22680;wb(x|0,22728,206)}else{r=v;q=p}}else{q=0}w=c[f+28>>2]|0;c[o>>2]=w;w=w+4|0;c[w>>2]=(c[w>>2]|0)+1;Di(r,s,u,p,l,m,o);o=c[o>>2]|0;w=o+4|0;x=c[w>>2]|0;c[w>>2]=x+ -1;if((x|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}Wc(n,c[e>>2]|0,p,c[l>>2]|0,c[m>>2]|0,f,g);x=c[n>>2]|0;c[e>>2]=x;c[b>>2]=x;if((q|0)!=0){vn(q)}if((t|0)==0){i=d;return}vn(t);i=d;return}function Fi(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;l=i;i=i+80|0;n=l;o=l+72|0;d=l+52|0;k=l+12|0;a[o+0>>0]=a[12272>>0]|0;a[o+1>>0]=a[12273>>0]|0;a[o+2>>0]=a[12274>>0]|0;a[o+3>>0]=a[12275>>0]|0;a[o+4>>0]=a[12276>>0]|0;a[o+5>>0]=a[12277>>0]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}p=c[3340]|0;c[n>>2]=h;o=wi(d,20,p,o,n)|0;h=d+o|0;p=c[f+4>>2]&176;do{if((p|0)==16){p=a[d>>0]|0;if(p<<24>>24==43|p<<24>>24==45){p=d+1|0;break}if((o|0)>1&p<<24>>24==48?(q=a[d+1>>0]|0,q<<24>>24==88|q<<24>>24==120):0){p=d+2|0}else{m=11}}else if((p|0)==32){p=h}else{m=11}}while(0);if((m|0)==11){p=d}m=c[f+28>>2]|0;q=m+4|0;c[q>>2]=(c[q>>2]|0)+1;if(!((c[3364]|0)==-1)){c[n>>2]=13456;c[n+4>>2]=208;c[n+8>>2]=0;cg(13456,n)}q=(c[13460>>2]|0)+ -1|0;n=c[m+8>>2]|0;if((c[m+12>>2]|0)-n>>2>>>0>q>>>0?(j=c[n+(q<<2)>>2]|0,(j|0)!=0):0){n=m+4|0;q=c[n>>2]|0;c[n>>2]=q+ -1;if((q|0)==0){lc[c[(c[m>>2]|0)+8>>2]&255](m)}uc[c[(c[j>>2]|0)+32>>2]&31](j,d,h,k)|0;j=k+o|0;if((p|0)==(h|0)){q=j;p=c[e>>2]|0;Wc(b,p,k,q,j,f,g);i=l;return}q=k+(p-d)|0;p=c[e>>2]|0;Wc(b,p,k,q,j,f,g);i=l;return}q=Xa(4)|0;c[q>>2]=21304;wb(q|0,21376,196)}function Gi(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Hi(a){a=a|0;return}function Ii(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0;j=i;i=i+32|0;m=j;n=j+24|0;k=j+12|0;if((c[f+4>>2]&1|0)==0){k=c[(c[d>>2]|0)+24>>2]|0;c[n>>2]=c[e>>2];l=h&1;c[m+0>>2]=c[n+0>>2];wc[k&63](b,d,m,f,g,l);i=j;return}n=c[f+28>>2]|0;d=n+4|0;c[d>>2]=(c[d>>2]|0)+1;if(!((c[3402]|0)==-1)){c[m>>2]=13608;c[m+4>>2]=208;c[m+8>>2]=0;cg(13608,m)}g=(c[13612>>2]|0)+ -1|0;m=c[n+8>>2]|0;if((c[n+12>>2]|0)-m>>2>>>0>g>>>0?(l=c[m+(g<<2)>>2]|0,(l|0)!=0):0){f=n+4|0;d=c[f>>2]|0;c[f>>2]=d+ -1;if((d|0)==0){lc[c[(c[n>>2]|0)+8>>2]&255](n)}m=c[l>>2]|0;if(h){mc[c[m+24>>2]&127](k,l)}else{mc[c[m+28>>2]&127](k,l)}g=a[k>>0]|0;if((g&1)==0){h=k+4|0;m=h;l=k+8|0}else{l=k+8|0;m=c[l>>2]|0;h=k+4|0}while(1){f=(g&1)==0;if(f){n=h;g=(g&255)>>>1}else{n=c[l>>2]|0;g=c[h>>2]|0}if((m|0)==(n+(g<<2)|0)){break}g=c[m>>2]|0;f=c[e>>2]|0;if((f|0)!=0){d=f+24|0;n=c[d>>2]|0;if((n|0)==(c[f+28>>2]|0)){g=xc[c[(c[f>>2]|0)+52>>2]&63](f,g)|0}else{c[d>>2]=n+4;c[n>>2]=g}if((g|0)==-1){c[e>>2]=0}}g=a[k>>0]|0;m=m+4|0}c[b>>2]=c[e>>2];if(f){i=j;return}k=c[k+8>>2]|0;if((k|0)==0){i=j;return}vn(k);i=j;return}d=Xa(4)|0;c[d>>2]=21304;wb(d|0,21376,196)}function Ji(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;m=i;i=i+128|0;l=m;r=m+108|0;n=m+96|0;d=m+92|0;j=m+88|0;o=m+84|0;a[r+0>>0]=a[12264>>0]|0;a[r+1>>0]=a[12265>>0]|0;a[r+2>>0]=a[12266>>0]|0;a[r+3>>0]=a[12267>>0]|0;a[r+4>>0]=a[12268>>0]|0;a[r+5>>0]=a[12269>>0]|0;s=r+1|0;p=f+4|0;q=c[p>>2]|0;if((q&2048|0)!=0){a[s>>0]=43;s=r+2|0}if((q&512|0)!=0){a[s>>0]=35;s=s+1|0}a[s>>0]=108;s=s+1|0;t=q&74;do{if((t|0)==8){if((q&16384|0)==0){a[s>>0]=120;break}else{a[s>>0]=88;break}}else if((t|0)==64){a[s>>0]=111}else{a[s>>0]=100}}while(0);if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}q=c[3340]|0;c[l>>2]=h;q=wi(n,12,q,r,l)|0;h=n+q|0;p=c[p>>2]&176;do{if((p|0)==16){p=a[n>>0]|0;if(p<<24>>24==43|p<<24>>24==45){p=n+1|0;break}if((q|0)>1&p<<24>>24==48?(t=a[n+1>>0]|0,t<<24>>24==88|t<<24>>24==120):0){p=n+2|0}else{k=21}}else if((p|0)==32){p=h}else{k=21}}while(0);if((k|0)==21){p=n}k=c[f+28>>2]|0;c[o>>2]=k;k=k+4|0;c[k>>2]=(c[k>>2]|0)+1;Ki(n,p,h,l,d,j,o);k=c[o>>2]|0;s=k+4|0;t=c[s>>2]|0;c[s>>2]=t+ -1;if((t|0)!=0){r=c[e>>2]|0;s=c[d>>2]|0;t=c[j>>2]|0;Li(b,r,l,s,t,f,g);i=m;return}lc[c[(c[k>>2]|0)+8>>2]&255](k);r=c[e>>2]|0;s=c[d>>2]|0;t=c[j>>2]|0;Li(b,r,l,s,t,f,g);i=m;return}function Ki(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;k=i;i=i+32|0;o=k;l=k+12|0;n=c[j>>2]|0;if(!((c[3362]|0)==-1)){c[o>>2]=13448;c[o+4>>2]=208;c[o+8>>2]=0;cg(13448,o)}s=(c[13452>>2]|0)+ -1|0;r=c[n+8>>2]|0;if(!((c[n+12>>2]|0)-r>>2>>>0>s>>>0)){v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}n=c[r+(s<<2)>>2]|0;if((n|0)==0){v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}j=c[j>>2]|0;if(!((c[3402]|0)==-1)){c[o>>2]=13608;c[o+4>>2]=208;c[o+8>>2]=0;cg(13608,o)}o=(c[13612>>2]|0)+ -1|0;r=c[j+8>>2]|0;if(!((c[j+12>>2]|0)-r>>2>>>0>o>>>0)){v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}j=c[r+(o<<2)>>2]|0;if((j|0)==0){v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}mc[c[(c[j>>2]|0)+20>>2]&127](l,j);o=a[l>>0]|0;if((o&1)==0){o=(o&255)>>>1}else{o=c[l+4>>2]|0}if((o|0)!=0){c[h>>2]=f;o=a[b>>0]|0;if(o<<24>>24==43|o<<24>>24==45){v=xc[c[(c[n>>2]|0)+44>>2]&63](n,o)|0;o=c[h>>2]|0;c[h>>2]=o+4;c[o>>2]=v;o=b+1|0}else{o=b}if(((e-o|0)>1?(a[o>>0]|0)==48:0)?(q=o+1|0,v=a[q>>0]|0,v<<24>>24==88|v<<24>>24==120):0){v=xc[c[(c[n>>2]|0)+44>>2]&63](n,48)|0;u=c[h>>2]|0;c[h>>2]=u+4;c[u>>2]=v;u=xc[c[(c[n>>2]|0)+44>>2]&63](n,a[q>>0]|0)|0;v=c[h>>2]|0;c[h>>2]=v+4;c[v>>2]=u;o=o+2|0}if((o|0)!=(e|0)?(p=e+ -1|0,p>>>0>o>>>0):0){q=o;do{v=a[q>>0]|0;a[q>>0]=a[p>>0]|0;a[p>>0]=v;q=q+1|0;p=p+ -1|0}while(q>>>0<p>>>0)}q=oc[c[(c[j>>2]|0)+16>>2]&127](j)|0;if(o>>>0<e>>>0){p=l+1|0;s=l+4|0;j=l+8|0;u=0;t=0;r=o;while(1){v=a[((a[l>>0]&1)==0?p:c[j>>2]|0)+t>>0]|0;if(v<<24>>24!=0&(u|0)==(v<<24>>24|0)){u=c[h>>2]|0;c[h>>2]=u+4;c[u>>2]=q;u=a[l>>0]|0;if((u&1)==0){v=(u&255)>>>1}else{v=c[s>>2]|0}u=0;t=(t>>>0<(v+ -1|0)>>>0&1)+t|0}x=xc[c[(c[n>>2]|0)+44>>2]&63](n,a[r>>0]|0)|0;w=c[h>>2]|0;v=w+4|0;c[h>>2]=v;c[w>>2]=x;r=r+1|0;if(!(r>>>0<e>>>0)){break}else{u=u+1|0}}}else{v=c[h>>2]|0}h=f+(o-b<<2)|0;if((h|0)!=(v|0)?(m=v+ -4|0,m>>>0>h>>>0):0){do{x=c[h>>2]|0;c[h>>2]=c[m>>2];c[m>>2]=x;h=h+4|0;m=m+ -4|0}while(h>>>0<m>>>0)}}else{uc[c[(c[n>>2]|0)+48>>2]&31](n,b,e,f)|0;v=f+(e-b<<2)|0;c[h>>2]=v}if((d|0)!=(e|0)){v=f+(d-b<<2)|0}c[g>>2]=v;if((a[l>>0]&1)==0){i=k;return}l=c[l+8>>2]|0;if((l|0)==0){i=k;return}vn(l);i=k;return}function Li(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0;k=i;i=i+16|0;l=k;if((d|0)==0){c[b>>2]=0;i=k;return}q=e;n=g-q>>2;h=h+12|0;m=c[h>>2]|0;n=(m|0)>(n|0)?m-n|0:0;m=f;q=m-q|0;p=q>>2;if((q|0)>0?(hc[c[(c[d>>2]|0)+48>>2]&63](d,e,p)|0)!=(p|0):0){c[b>>2]=0;i=k;return}do{if((n|0)>0){if(n>>>0>1073741807){dg()}do{if(n>>>0<2){a[l>>0]=n<<1;e=l+4|0;o=18}else{e=n+4&-4;p=e<<2;p=(p|0)==0?1:p;while(1){q=un(p)|0;if((q|0)!=0){o=17;break}q=c[5666]|0;c[5666]=q+0;if((q|0)==0){break}sc[q&31]()}if((o|0)==17){c[l+8>>2]=q;c[l>>2]=e|1;c[l+4>>2]=n;if((n|0)==0){e=q;break}else{e=q;o=18;break}}q=Xa(4)|0;c[q>>2]=22680;wb(q|0,22728,206)}}while(0);if((o|0)==18){o=n;p=e;while(1){o=o+ -1|0;c[p>>2]=j;if((o|0)==0){break}else{p=p+4|0}}}c[e+(n<<2)>>2]=0;if((a[l>>0]&1)==0){j=l+4|0}else{j=c[l+8>>2]|0}if((hc[c[(c[d>>2]|0)+48>>2]&63](d,j,n)|0)==(n|0)){if((a[l>>0]&1)==0){break}l=c[l+8>>2]|0;if((l|0)==0){break}vn(l);break}c[b>>2]=0;if((a[l>>0]&1)==0){i=k;return}b=c[l+8>>2]|0;if((b|0)==0){i=k;return}vn(b);i=k;return}}while(0);q=g-m|0;l=q>>2;if((q|0)>0?(hc[c[(c[d>>2]|0)+48>>2]&63](d,f,l)|0)!=(l|0):0){c[b>>2]=0;i=k;return}c[h>>2]=0;c[b>>2]=d;i=k;return}function Mi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;m=i;i=i+208|0;l=m+8|0;s=m;o=m+184|0;d=m+180|0;k=m+176|0;p=m+172|0;u=s;c[u>>2]=37;c[u+4>>2]=0;u=s+1|0;q=f+4|0;r=c[q>>2]|0;if((r&2048|0)!=0){a[u>>0]=43;u=s+2|0}if((r&512|0)!=0){a[u>>0]=35;u=u+1|0}t=u+2|0;a[u>>0]=108;a[u+1>>0]=108;u=r&74;do{if((u|0)==8){if((r&16384|0)==0){a[t>>0]=120;break}else{a[t>>0]=88;break}}else if((u|0)==64){a[t>>0]=111}else{a[t>>0]=100}}while(0);if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}u=c[3340]|0;t=l;c[t>>2]=h;c[t+4>>2]=j;h=wi(o,22,u,s,l)|0;j=o+h|0;q=c[q>>2]&176;do{if((q|0)==32){q=j}else if((q|0)==16){q=a[o>>0]|0;if(q<<24>>24==43|q<<24>>24==45){q=o+1|0;break}if((h|0)>1&q<<24>>24==48?(u=a[o+1>>0]|0,u<<24>>24==88|u<<24>>24==120):0){q=o+2|0}else{n=21}}else{n=21}}while(0);if((n|0)==21){q=o}n=c[f+28>>2]|0;c[p>>2]=n;n=n+4|0;c[n>>2]=(c[n>>2]|0)+1;Ki(o,q,j,l,d,k,p);n=c[p>>2]|0;t=n+4|0;u=c[t>>2]|0;c[t>>2]=u+ -1;if((u|0)!=0){s=c[e>>2]|0;t=c[d>>2]|0;u=c[k>>2]|0;Li(b,s,l,t,u,f,g);i=m;return}lc[c[(c[n>>2]|0)+8>>2]&255](n);s=c[e>>2]|0;t=c[d>>2]|0;u=c[k>>2]|0;Li(b,s,l,t,u,f,g);i=m;return}function Ni(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=i;i=i+128|0;l=d;q=d+108|0;n=d+96|0;k=d+92|0;m=d+88|0;o=d+84|0;a[q+0>>0]=a[12264>>0]|0;a[q+1>>0]=a[12265>>0]|0;a[q+2>>0]=a[12266>>0]|0;a[q+3>>0]=a[12267>>0]|0;a[q+4>>0]=a[12268>>0]|0;a[q+5>>0]=a[12269>>0]|0;s=q+1|0;p=f+4|0;r=c[p>>2]|0;if((r&2048|0)!=0){a[s>>0]=43;s=q+2|0}if((r&512|0)!=0){a[s>>0]=35;s=s+1|0}a[s>>0]=108;t=s+1|0;s=r&74;do{if((s|0)==64){a[t>>0]=111}else if((s|0)==8){if((r&16384|0)==0){a[t>>0]=120;break}else{a[t>>0]=88;break}}else{a[t>>0]=117}}while(0);if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}t=c[3340]|0;c[l>>2]=h;q=wi(n,12,t,q,l)|0;h=n+q|0;p=c[p>>2]&176;do{if((p|0)==32){p=h}else if((p|0)==16){p=a[n>>0]|0;if(p<<24>>24==43|p<<24>>24==45){p=n+1|0;break}if((q|0)>1&p<<24>>24==48?(t=a[n+1>>0]|0,t<<24>>24==88|t<<24>>24==120):0){p=n+2|0}else{j=21}}else{j=21}}while(0);if((j|0)==21){p=n}j=c[f+28>>2]|0;c[o>>2]=j;j=j+4|0;c[j>>2]=(c[j>>2]|0)+1;Ki(n,p,h,l,k,m,o);j=c[o>>2]|0;s=j+4|0;t=c[s>>2]|0;c[s>>2]=t+ -1;if((t|0)!=0){r=c[e>>2]|0;s=c[k>>2]|0;t=c[m>>2]|0;Li(b,r,l,s,t,f,g);i=d;return}lc[c[(c[j>>2]|0)+8>>2]&255](j);r=c[e>>2]|0;s=c[k>>2]|0;t=c[m>>2]|0;Li(b,r,l,s,t,f,g);i=d;return} - - - -function Xk(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=i;i=i+16|0;e=d;if((a[13432]|0)!=0){h=c[3356]|0;c[b>>2]=h;h=h+4|0;g=c[h>>2]|0;c[h>>2]=g+1;i=d;return}if((Qa(13432)|0)==0){h=c[3356]|0;c[b>>2]=h;h=h+4|0;g=c[h>>2]|0;c[h>>2]=g+1;i=d;return}if((a[13416]|0)==0?(Qa(13416)|0)!=0:0){c[17764>>2]=0;c[4440]=13392;a[17896>>0]=1;c[17772>>2]=17784;c[17768>>2]=17784;c[17776>>2]=17896;h=28;f=17784|0;do{c[f>>2]=0;g=c[17772>>2]|0;f=g+4|0;c[17772>>2]=f;h=h+ -1|0}while((h|0)!=0);a[17904>>0]=2;a[17905>>0]=67;a[17906>>0]=0;h=c[17768>>2]|0;if((f|0)!=(h|0)){c[17772>>2]=g+(0-((g+(0-h)|0)>>>2)<<2)}c[18228>>2]=0;c[4556]=11872;if(!((c[2974]|0)==-1)){c[e>>2]=11896;c[e+4>>2]=208;c[e+8>>2]=0;cg(11896,e)}Uk(17760,18224,(c[11900>>2]|0)+ -1|0);c[18220>>2]=0;c[4554]=11912;if(!((c[2984]|0)==-1)){c[e>>2]=11936;c[e+4>>2]=208;c[e+8>>2]=0;cg(11936,e)}Uk(17760,18216,(c[11940>>2]|0)+ -1|0);c[18204>>2]=0;c[4550]=13472;c[18208>>2]=0;a[18212>>0]=0;c[18208>>2]=c[(Na()|0)>>2];if(!((c[3364]|0)==-1)){c[e>>2]=13456;c[e+4>>2]=208;c[e+8>>2]=0;cg(13456,e)}Uk(17760,18200,(c[13460>>2]|0)+ -1|0);c[18196>>2]=0;c[4548]=14392;if(!((c[3362]|0)==-1)){c[e>>2]=13448;c[e+4>>2]=208;c[e+8>>2]=0;cg(13448,e)}Uk(17760,18192,(c[13452>>2]|0)+ -1|0);c[18188>>2]=0;c[4546]=14608;if(!((c[3380]|0)==-1)){c[e>>2]=13520;c[e+4>>2]=208;c[e+8>>2]=0;cg(13520,e)}Uk(17760,18184,(c[13524>>2]|0)+ -1|0);c[18172>>2]=0;c[4542]=13544;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}c[18176>>2]=c[3340];if(!((c[3382]|0)==-1)){c[e>>2]=13528;c[e+4>>2]=208;c[e+8>>2]=0;cg(13528,e)}Uk(17760,18168,(c[13532>>2]|0)+ -1|0);c[18164>>2]=0;c[4540]=14832;if(!((c[3396]|0)==-1)){c[e>>2]=13584;c[e+4>>2]=208;c[e+8>>2]=0;cg(13584,e)}Uk(17760,18160,(c[13588>>2]|0)+ -1|0);c[18156>>2]=0;c[4538]=14952;if(!((c[3398]|0)==-1)){c[e>>2]=13592;c[e+4>>2]=208;c[e+8>>2]=0;cg(13592,e)}Uk(17760,18152,(c[13596>>2]|0)+ -1|0);c[18132>>2]=0;c[4532]=13624;a[18136>>0]=46;a[18137>>0]=44;c[18140>>2]=0;c[18144>>2]=0;c[18148>>2]=0;if(!((c[3400]|0)==-1)){c[e>>2]=13600;c[e+4>>2]=208;c[e+8>>2]=0;cg(13600,e)}Uk(17760,18128,(c[13604>>2]|0)+ -1|0);c[18100>>2]=0;c[4524]=13664;c[18104>>2]=46;c[18108>>2]=44;c[18112>>2]=0;c[18116>>2]=0;c[18120>>2]=0;if(!((c[3402]|0)==-1)){c[e>>2]=13608;c[e+4>>2]=208;c[e+8>>2]=0;cg(13608,e)}Uk(17760,18096,(c[13612>>2]|0)+ -1|0);c[18092>>2]=0;c[4522]=11952;if(!((c[3002]|0)==-1)){c[e>>2]=12008;c[e+4>>2]=208;c[e+8>>2]=0;cg(12008,e)}Uk(17760,18088,(c[12012>>2]|0)+ -1|0);c[18084>>2]=0;c[4520]=12072;if(!((c[3032]|0)==-1)){c[e>>2]=12128;c[e+4>>2]=208;c[e+8>>2]=0;cg(12128,e)}Uk(17760,18080,(c[12132>>2]|0)+ -1|0);c[18076>>2]=0;c[4518]=12144;if(!((c[3048]|0)==-1)){c[e>>2]=12192;c[e+4>>2]=208;c[e+8>>2]=0;cg(12192,e)}Uk(17760,18072,(c[12196>>2]|0)+ -1|0);c[18068>>2]=0;c[4516]=12208;if(!((c[3064]|0)==-1)){c[e>>2]=12256;c[e+4>>2]=208;c[e+8>>2]=0;cg(12256,e)}Uk(17760,18064,(c[12260>>2]|0)+ -1|0);c[18060>>2]=0;c[4514]=12800;if(!((c[3212]|0)==-1)){c[e>>2]=12848;c[e+4>>2]=208;c[e+8>>2]=0;cg(12848,e)}Uk(17760,18056,(c[12852>>2]|0)+ -1|0);c[18052>>2]=0;c[4512]=12864;if(!((c[3228]|0)==-1)){c[e>>2]=12912;c[e+4>>2]=208;c[e+8>>2]=0;cg(12912,e)}Uk(17760,18048,(c[12916>>2]|0)+ -1|0);c[18044>>2]=0;c[4510]=12928;if(!((c[3244]|0)==-1)){c[e>>2]=12976;c[e+4>>2]=208;c[e+8>>2]=0;cg(12976,e)}Uk(17760,18040,(c[12980>>2]|0)+ -1|0);c[18036>>2]=0;c[4508]=12992;if(!((c[3260]|0)==-1)){c[e>>2]=13040;c[e+4>>2]=208;c[e+8>>2]=0;cg(13040,e)}Uk(17760,18032,(c[13044>>2]|0)+ -1|0);c[18028>>2]=0;c[4506]=13056;if(!((c[3270]|0)==-1)){c[e>>2]=13080;c[e+4>>2]=208;c[e+8>>2]=0;cg(13080,e)}Uk(17760,18024,(c[13084>>2]|0)+ -1|0);c[18020>>2]=0;c[4504]=13136;if(!((c[3290]|0)==-1)){c[e>>2]=13160;c[e+4>>2]=208;c[e+8>>2]=0;cg(13160,e)}Uk(17760,18016,(c[13164>>2]|0)+ -1|0);c[18012>>2]=0;c[4502]=13192;if(!((c[3304]|0)==-1)){c[e>>2]=13216;c[e+4>>2]=208;c[e+8>>2]=0;cg(13216,e)}Uk(17760,18008,(c[13220>>2]|0)+ -1|0);c[18004>>2]=0;c[4500]=13240;if(!((c[3316]|0)==-1)){c[e>>2]=13264;c[e+4>>2]=208;c[e+8>>2]=0;cg(13264,e)}Uk(17760,18e3,(c[13268>>2]|0)+ -1|0);c[17988>>2]=0;c[4496]=12288;c[17992>>2]=12336;if(!((c[3092]|0)==-1)){c[e>>2]=12368;c[e+4>>2]=208;c[e+8>>2]=0;cg(12368,e)}Uk(17760,17984,(c[12372>>2]|0)+ -1|0);c[17972>>2]=0;c[4492]=12440;c[17976>>2]=12488;if(!((c[3130]|0)==-1)){c[e>>2]=12520;c[e+4>>2]=208;c[e+8>>2]=0;cg(12520,e)}Uk(17760,17968,(c[12524>>2]|0)+ -1|0);c[17956>>2]=0;c[4488]=14328;do{if((a[13368]|0)==0){if((Qa(13368)|0)==0){break}c[3340]=kb(2147483647,13376,0)|0;$a(13368)}}while(0);c[17960>>2]=c[3340];c[4488]=12736;if(!((c[3188]|0)==-1)){c[e>>2]=12752;c[e+4>>2]=208;c[e+8>>2]=0;cg(12752,e)}Uk(17760,17952,(c[12756>>2]|0)+ -1|0);c[17940>>2]=0;c[4484]=14328;do{if((a[13368]|0)==0){if((Qa(13368)|0)==0){break}c[3340]=kb(2147483647,13376,0)|0;$a(13368)}}while(0);c[17944>>2]=c[3340];c[4484]=12768;if(!((c[3196]|0)==-1)){c[e>>2]=12784;c[e+4>>2]=208;c[e+8>>2]=0;cg(12784,e)}Uk(17760,17936,(c[12788>>2]|0)+ -1|0);c[17932>>2]=0;c[4482]=13280;if(!((c[3326]|0)==-1)){c[e>>2]=13304;c[e+4>>2]=208;c[e+8>>2]=0;cg(13304,e)}Uk(17760,17928,(c[13308>>2]|0)+ -1|0);c[17924>>2]=0;c[4480]=13320;if(!((c[3336]|0)==-1)){c[e>>2]=13344;c[e+4>>2]=208;c[e+8>>2]=0;cg(13344,e)}Uk(17760,17920,(c[13348>>2]|0)+ -1|0);c[3352]=17760;$a(13416)}h=c[3352]|0;c[3356]=h;h=h+4|0;c[h>>2]=(c[h>>2]|0)+1;$a(13432);h=c[3356]|0;c[b>>2]=h;h=h+4|0;g=c[h>>2]|0;c[h>>2]=g+1;i=d;return}function Yk(a,b){a=a|0;b=b|0;var d=0,e=0;d=i;i=i+16|0;e=d;if(!((c[b>>2]|0)==-1)){c[e>>2]=b;c[e+4>>2]=208;c[e+8>>2]=0;cg(b,e)}e=(c[b+4>>2]|0)+ -1|0;b=c[a+8>>2]|0;if(!((c[a+12>>2]|0)-b>>2>>>0>e>>>0)){e=Xa(4)|0;c[e>>2]=21304;wb(e|0,21376,196)}a=c[b+(e<<2)>>2]|0;if((a|0)==0){e=Xa(4)|0;c[e>>2]=21304;wb(e|0,21376,196)}else{i=d;return a|0}return 0}function Zk(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function _k(a){a=a|0;var b=0;b=i;if((a|0)==0){i=b;return}lc[c[(c[a>>2]|0)+4>>2]&255](a);i=b;return}function $k(a){a=a|0;var b=0;b=c[3360]|0;c[3360]=b+1;c[a+4>>2]=b+1;return}function al(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function bl(a,d,e){a=a|0;d=d|0;e=e|0;a=i;if(!(e>>>0<128)){d=0;i=a;return d|0}d=(b[(c[(Na()|0)>>2]|0)+(e<<1)>>1]&d)<<16>>16!=0;i=a;return d|0}function cl(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0;a=i;if((d|0)==(e|0)){g=d;i=a;return g|0}while(1){g=c[d>>2]|0;if(g>>>0<128){g=b[(c[(Na()|0)>>2]|0)+(g<<1)>>1]|0}else{g=0}b[f>>1]=g;d=d+4|0;if((d|0)==(e|0)){break}else{f=f+2|0}}i=a;return e|0}function dl(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0;a=i;a:do{if((e|0)==(f|0)){f=e}else{do{g=c[e>>2]|0;if(g>>>0<128?!((b[(c[(Na()|0)>>2]|0)+(g<<1)>>1]&d)<<16>>16==0):0){f=e;break a}e=e+4|0}while((e|0)!=(f|0))}}while(0);i=a;return f|0}function el(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0;a=i;a:do{if((e|0)==(f|0)){f=e}else{do{g=c[e>>2]|0;if(!(g>>>0<128)){f=e;break a}if((b[(c[(Na()|0)>>2]|0)+(g<<1)>>1]&d)<<16>>16==0){f=e;break a}e=e+4|0}while((e|0)!=(f|0))}}while(0);i=a;return f|0}function fl(a,b){a=a|0;b=b|0;a=i;if(!(b>>>0<128)){i=a;return b|0}b=c[(c[(Za()|0)>>2]|0)+(b<<2)>>2]|0;i=a;return b|0}function gl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;a=i;if((b|0)==(d|0)){e=b;i=a;return e|0}do{e=c[b>>2]|0;if(e>>>0<128){e=c[(c[(Za()|0)>>2]|0)+(e<<2)>>2]|0}c[b>>2]=e;b=b+4|0}while((b|0)!=(d|0));i=a;return d|0}function hl(a,b){a=a|0;b=b|0;a=i;if(!(b>>>0<128)){i=a;return b|0}b=c[(c[(Ha()|0)>>2]|0)+(b<<2)>>2]|0;i=a;return b|0}function il(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;a=i;if((b|0)==(d|0)){e=b;i=a;return e|0}do{e=c[b>>2]|0;if(e>>>0<128){e=c[(c[(Ha()|0)>>2]|0)+(e<<2)>>2]|0}c[b>>2]=e;b=b+4|0}while((b|0)!=(d|0));i=a;return d|0}function jl(a,b){a=a|0;b=b|0;return b<<24>>24|0}function kl(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;b=i;if((d|0)==(e|0)){i=b;return d|0}while(1){c[f>>2]=a[d>>0]|0;d=d+1|0;if((d|0)==(e|0)){break}else{f=f+4|0}}i=b;return e|0}function ll(a,b,c){a=a|0;b=b|0;c=c|0;return(b>>>0<128?b&255:c)|0}function ml(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0;b=i;if((d|0)==(e|0)){j=d;i=b;return j|0}h=((e+ -4+(0-d)|0)>>>2)+1|0;j=d;while(1){k=c[j>>2]|0;a[g>>0]=k>>>0<128?k&255:f;j=j+4|0;if((j|0)==(e|0)){break}else{g=g+1|0}}k=d+(h<<2)|0;i=b;return k|0}function nl(b){b=b|0;var d=0,e=0;d=i;c[b>>2]=13472;e=c[b+8>>2]|0;if((e|0)!=0){if((a[b+12>>0]|0)!=0){vn(e)}if((b|0)==0){i=d;return}}vn(b);i=d;return}function ol(b){b=b|0;var d=0,e=0;d=i;c[b>>2]=13472;e=c[b+8>>2]|0;if((e|0)!=0?(a[b+12>>0]|0)!=0:0){vn(e)}i=d;return}function pl(a,b){a=a|0;b=b|0;a=i;if(!(b<<24>>24>-1)){i=a;return b|0}b=c[(c[(Za()|0)>>2]|0)+((b&255)<<2)>>2]&255;i=a;return b|0}function ql(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;b=i;if((d|0)==(e|0)){f=d;i=b;return f|0}do{f=a[d>>0]|0;if(f<<24>>24>-1){f=c[(c[(Za()|0)>>2]|0)+(f<<24>>24<<2)>>2]&255}a[d>>0]=f;d=d+1|0}while((d|0)!=(e|0));i=b;return e|0}function rl(a,b){a=a|0;b=b|0;a=i;if(!(b<<24>>24>-1)){i=a;return b|0}b=c[(c[(Ha()|0)>>2]|0)+(b<<24>>24<<2)>>2]&255;i=a;return b|0}function sl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;b=i;if((d|0)==(e|0)){f=d;i=b;return f|0}do{f=a[d>>0]|0;if(f<<24>>24>-1){f=c[(c[(Ha()|0)>>2]|0)+(f<<24>>24<<2)>>2]&255}a[d>>0]=f;d=d+1|0}while((d|0)!=(e|0));i=b;return e|0}function tl(a,b){a=a|0;b=b|0;return b|0}function ul(b,c,d,e){b=b|0;c=c|0;d=d|0;e=e|0;b=i;if((c|0)==(d|0)){d=c}else{while(1){a[e>>0]=a[c>>0]|0;c=c+1|0;if((c|0)==(d|0)){break}else{e=e+1|0}}}i=b;return d|0}function vl(a,b,c){a=a|0;b=b|0;c=c|0;return(b<<24>>24>-1?b:c)|0}function wl(b,c,d,e,f){b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0;b=i;if((c|0)==(d|0)){i=b;return c|0}while(1){g=a[c>>0]|0;a[f>>0]=g<<24>>24>-1?g:e;c=c+1|0;if((c|0)==(d|0)){break}else{f=f+1|0}}i=b;return d|0}function xl(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function yl(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;c[f>>2]=d;c[i>>2]=g;return 3}function zl(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;c[f>>2]=d;c[i>>2]=g;return 3}function Al(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;c[f>>2]=d;return 3}function Bl(a){a=a|0;return 1}function Cl(a){a=a|0;return 1}function Dl(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;b=d-c|0;return(b>>>0<e>>>0?b:e)|0}function El(a){a=a|0;return 1}function Fl(a){a=a|0;var b=0;b=i;Sk(a);if((a|0)!=0){vn(a)}i=b;return}function Gl(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;d=i;i=i+272|0;l=d+264|0;n=d+8|0;o=d;a:do{if((e|0)!=(f|0)){q=e;while(1){if((c[q>>2]|0)==0){break}q=q+4|0;if((q|0)==(f|0)){q=f;break}}c[k>>2]=h;c[g>>2]=e;if((h|0)!=(j|0)){p=j;b=b+8|0;while(1){w=q-e>>2;s=ib(c[b>>2]|0)|0;y=c[g>>2]|0;r=(h|0)!=0;v=r?p-h|0:256;u=r?h:n;b:do{if((y|0)==0|(v|0)==0){t=0}else{t=0;do{x=w>>>0>=v>>>0;if(!(x|w>>>0>32)){break b}x=x?v:w;w=w-x|0;c:do{if((u|0)==0){A=c[y>>2]|0;if((A|0)==0){z=0}else{z=0;x=y;while(1){if(A>>>0>127){A=Wm(l,A)|0;if((A|0)==-1){v=0;t=-1;break b}}else{A=1}z=A+z|0;x=x+4|0;A=c[x>>2]|0;if((A|0)==0){m=32;break}}}}else{d:do{if(x>>>0>3){z=u;A=x;while(1){B=c[y>>2]|0;if((B|0)==0){m=22;break d}if(B>>>0>127){B=Wm(z,B)|0;if((B|0)==-1){v=0;t=-1;break b}z=z+B|0;A=A-B|0}else{a[z>>0]=B;z=z+1|0;A=A+ -1|0}y=y+4|0;if(!(A>>>0>3)){m=16;break}}}else{z=u;A=x;m=16}}while(0);if((m|0)==16){m=0;if((A|0)==0){A=0}else{m=22}}e:do{if((m|0)==22){while(1){m=0;B=c[y>>2]|0;if((B|0)==0){m=30;break}if(B>>>0>127){B=Wm(l,B)|0;if((B|0)==-1){v=0;t=-1;break b}if(B>>>0>A>>>0){m=26;break}Wm(z,c[y>>2]|0)|0;z=z+B|0;A=A-B|0}else{a[z>>0]=B;z=z+1|0;A=A+ -1|0}if((A|0)==0){A=0;break e}else{y=y+4|0;m=22}}if((m|0)==26){z=x-A|0;m=32;break c}else if((m|0)==30){a[z>>0]=0;break}}}while(0);z=x-A|0;y=0;m=32}}while(0);if((m|0)==32){m=0;if((z|0)==-1){v=0;t=-1;break b}}if((u|0)==(n|0)){u=n}else{v=v-z|0;u=u+z|0}t=z+t|0}while(!((y|0)==0|(v|0)==0))}}while(0);f:do{if((y|0)!=0?!((v|0)==0|(w|0)==0):0){while(1){x=Wm(u,c[y>>2]|0)|0;if((x+1|0)>>>0<2){break}y=y+4|0;w=w+ -1|0;t=t+1|0;if((v|0)==(x|0)|(w|0)==0){break f}else{v=v-x|0;u=u+x|0}}B=(x|0)==0;t=B?t:-1;y=B?0:y}}while(0);if(r){c[g>>2]=y}if((s|0)!=0){ib(s|0)|0}if((t|0)==0){g=1;m=67;break}else if((t|0)==-1){m=46;break}h=(c[k>>2]|0)+t|0;c[k>>2]=h;if((h|0)==(j|0)){m=65;break}if((q|0)==(f|0)){e=c[g>>2]|0;q=f}else{e=ib(c[b>>2]|0)|0;a[o>>0]=0;if((e|0)!=0){ib(e|0)|0}h=c[k>>2]|0;if((h|0)==(j|0)){g=1;m=67;break}else{e=0;q=0;r=o}while(1){c[k>>2]=h+1;a[h>>0]=e;if((q|0)==0){break}B=r+1|0;h=c[k>>2]|0;e=a[B>>0]|0;q=q+ -1|0;r=B}e=(c[g>>2]|0)+4|0;c[g>>2]=e;g:do{if((e|0)==(f|0)){q=f}else{q=e;while(1){if((c[q>>2]|0)==0){break g}q=q+4|0;if((q|0)==(f|0)){q=f;break}}}}while(0);h=c[k>>2]|0}if((e|0)==(f|0)|(h|0)==(j|0)){break a}}if((m|0)==46){c[k>>2]=h;h:do{if((e|0)!=(c[g>>2]|0)){do{j=c[e>>2]|0;f=ib(c[b>>2]|0)|0;j=Wm(h,j)|0;if((f|0)!=0){ib(f|0)|0}if((j|0)==-1){break h}h=(c[k>>2]|0)+j|0;c[k>>2]=h;e=e+4|0}while((e|0)!=(c[g>>2]|0))}}while(0);c[g>>2]=e;B=2;i=d;return B|0}else if((m|0)==65){e=c[g>>2]|0;break}else if((m|0)==67){i=d;return g|0}}}else{c[k>>2]=h;c[g>>2]=e}}while(0);B=(e|0)!=(f|0)&1;i=d;return B|0}function Hl(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;l=i;i=i+1040|0;n=l+16|0;o=l+8|0;m=l;a:do{if((e|0)!=(f|0)){r=e;while(1){if((a[r>>0]|0)==0){break}r=r+1|0;if((r|0)==(f|0)){r=f;break}}c[k>>2]=h;c[g>>2]=e;if((h|0)!=(j|0)){p=j;b=b+8|0;while(1){t=d;u=c[t+4>>2]|0;q=m;c[q>>2]=c[t>>2];c[q+4>>2]=u;q=r;u=q-e|0;t=ib(c[b>>2]|0)|0;y=c[g>>2]|0;c[o>>2]=y;s=(h|0)!=0;w=s?p-h>>2:256;x=s?h:n;b:do{if((y|0)==0|(w|0)==0){v=0}else{v=0;while(1){z=u>>>2;A=z>>>0>=w>>>0;if(!(A|u>>>0>131)){break b}y=A?w:z;u=u-y|0;y=Vm(x,o,y,d)|0;if((y|0)==-1){break}if((x|0)==(n|0)){x=n}else{w=w-y|0;x=x+(y<<2)|0}v=y+v|0;y=c[o>>2]|0;if((y|0)==0|(w|0)==0){break b}}w=0;y=c[o>>2]|0;v=-1}}while(0);c:do{if((y|0)!=0){if(!((w|0)==0|(u|0)==0)){while(1){z=Um(x,y,u,d)|0;if((z+2|0)>>>0<3){break}y=y+z|0;c[o>>2]=y;w=w+ -1|0;v=v+1|0;if((w|0)==0|(u|0)==(z|0)){break c}else{u=u-z|0;x=x+4|0}}if((z|0)==-1){v=-1;break}else if((z|0)==0){c[o>>2]=0;y=0;break}else{c[d>>2]=0;break}}}else{y=0}}while(0);if(s){c[g>>2]=y}if((t|0)!=0){ib(t|0)|0}if((v|0)==0){f=2;d=48;break}else if((v|0)==-1){d=26;break}h=(c[k>>2]|0)+(v<<2)|0;c[k>>2]=h;if((h|0)==(j|0)){d=46;break}e=c[g>>2]|0;if((r|0)==(f|0)){r=f}else{q=ib(c[b>>2]|0)|0;e=Um(h,e,1,d)|0;if((q|0)!=0){ib(q|0)|0}if((e|0)!=0){f=2;d=48;break}c[k>>2]=(c[k>>2]|0)+4;e=(c[g>>2]|0)+1|0;c[g>>2]=e;d:do{if((e|0)==(f|0)){r=f}else{r=e;while(1){if((a[r>>0]|0)==0){break d}r=r+1|0;if((r|0)==(f|0)){r=f;break}}}}while(0);h=c[k>>2]|0}if((e|0)==(f|0)|(h|0)==(j|0)){break a}}if((d|0)==26){c[k>>2]=h;e:do{if((e|0)!=(c[g>>2]|0)){while(1){d=ib(c[b>>2]|0)|0;n=Um(h,e,q-e|0,m)|0;if((d|0)!=0){ib(d|0)|0}if((n|0)==-1){d=31;break}else if((n|0)==-2){d=32;break}else if((n|0)==0){e=e+1|0}else{e=e+n|0}h=(c[k>>2]|0)+4|0;c[k>>2]=h;if((e|0)==(c[g>>2]|0)){break e}}if((d|0)==31){c[g>>2]=e;A=2;i=l;return A|0}else if((d|0)==32){c[g>>2]=e;A=1;i=l;return A|0}}}while(0);c[g>>2]=e;A=(e|0)!=(f|0)&1;i=l;return A|0}else if((d|0)==46){e=c[g>>2]|0;break}else if((d|0)==48){i=l;return f|0}}}else{c[k>>2]=h;c[g>>2]=e}}while(0);A=(e|0)!=(f|0)&1;i=l;return A|0}function Il(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;b=i;c[f>>2]=d;a=ib(c[a+8>>2]|0)|0;if((a|0)==0){i=b;return 0}ib(a|0)|0;i=b;return 0}function Jl(a){a=a|0;var b=0,d=0;b=i;a=a+8|0;d=ib(c[a>>2]|0)|0;if((d|0)!=0){ib(d|0)|0}a=c[a>>2]|0;if((a|0)!=0){a=ib(a|0)|0;if((a|0)==0){a=0}else{ib(a|0)|0;a=0}}else{a=1}i=b;return a|0}function Kl(a){a=a|0;return 0}function Ll(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;g=i;if((f|0)==0|(d|0)==(e|0)){m=0;i=g;return m|0}h=e;a=a+8|0;b=(b|0)!=0?b:21280;k=0;j=0;while(1){m=ib(c[a>>2]|0)|0;l=Um(0,d,h-d|0,b)|0;if((m|0)!=0){ib(m|0)|0}if((l|0)==0){d=d+1|0;l=1}else if((l|0)==-2|(l|0)==-1){f=9;break}else{d=d+l|0}k=l+k|0;j=j+1|0;if(j>>>0>=f>>>0|(d|0)==(e|0)){f=9;break}}if((f|0)==9){i=g;return k|0}return 0}function Ml(a){a=a|0;var b=0;b=i;a=c[a+8>>2]|0;if((a|0)!=0){a=ib(a|0)|0;if((a|0)==0){a=4}else{ib(a|0)|0;a=4}}else{a=1}i=b;return a|0}function Nl(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Ol(d,f,g,h,j,k,l,m){d=d|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0;f=i;d=h;a:do{if(g>>>0<h>>>0){o=g;n=k;while(1){q=b[o>>1]|0;p=q&65535;do{if((q&65535)<128){if((l-n|0)<1){h=1;break a}a[n>>0]=q;n=n+1|0}else{if((q&65535)<2048){if((l-n|0)<2){h=1;break a}a[n>>0]=p>>>6|192;a[n+1>>0]=p&63|128;n=n+2|0;break}if((q&65535)<55296){if((l-n|0)<3){h=1;break a}a[n>>0]=p>>>12|224;a[n+1>>0]=p>>>6&63|128;a[n+2>>0]=p&63|128;n=n+3|0;break}if(!((q&65535)<56320)){if((q&65535)<57344){h=2;break a}if((l-n|0)<3){h=1;break a}a[n>>0]=p>>>12|224;a[n+1>>0]=p>>>6&63|128;a[n+2>>0]=p&63|128;n=n+3|0;break}if((d-o|0)<4){h=1;break a}q=o+2|0;r=e[q>>1]|0;if((r&64512|0)!=56320){h=2;break a}if((l-n|0)<4){h=1;break a}s=p&960;if(((s<<10)+65536|0)>>>0>1114111){h=2;break a}o=(s>>>6)+1|0;a[n>>0]=o>>>2|240;a[n+1>>0]=p>>>2&15|o<<4&48|128;a[n+2>>0]=p<<4&48|r>>>6&15|128;a[n+3>>0]=r&63|128;o=q;n=n+4|0}}while(0);o=o+2|0;if(!(o>>>0<h>>>0)){h=0;break}}}else{h=0;o=g;n=k}}while(0);c[j>>2]=g+(o-g>>1<<1);c[m>>2]=k+(n-k);i=f;return h|0}function Pl(e,f,g,h,j,k,l,m){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;f=i;a:do{if(g>>>0<h>>>0){o=h;p=l;q=g;e=k;while(1){if(!(e>>>0<l>>>0)){n=31;break a}s=a[q>>0]|0;r=s&255;do{if(s<<24>>24>-1){b[e>>1]=s&255;q=q+1|0}else{if((s&255)<194){h=2;break a}if((s&255)<224){if((o-q|0)<2){h=1;break a}s=d[q+1>>0]|0;if((s&192|0)!=128){h=2;break a}b[e>>1]=s&63|r<<6&1984;q=q+2|0;break}if((s&255)<240){if((o-q|0)<3){h=1;break a}s=a[q+1>>0]|0;t=a[q+2>>0]|0;if((r|0)==237){if(!((s&-32)<<24>>24==-128)){h=2;break a}}else if((r|0)==224){if(!((s&-32)<<24>>24==-96)){h=2;break a}}else{if(!((s&-64)<<24>>24==-128)){h=2;break a}}t=t&255;if((t&192|0)!=128){h=2;break a}b[e>>1]=(s&255)<<6&4032|r<<12|t&63;q=q+3|0;break}if(!((s&255)<245)){h=2;break a}if((o-q|0)<4){h=1;break a}s=a[q+1>>0]|0;t=a[q+2>>0]|0;u=a[q+3>>0]|0;if((r|0)==240){if(!((s+112<<24>>24&255)<48)){h=2;break a}}else if((r|0)==244){if(!((s&-16)<<24>>24==-128)){h=2;break a}}else{if(!((s&-64)<<24>>24==-128)){h=2;break a}}t=t&255;if((t&192|0)!=128){h=2;break a}u=u&255;if((u&192|0)!=128){h=2;break a}if((p-e|0)<4){h=1;break a}r=r&7;s=s&255;if((s<<12&196608|r<<18)>>>0>1114111){h=2;break a}b[e>>1]=s<<2&60|t>>>4&3|((s>>>4&3|r<<2)<<6)+16320|55296;e=e+2|0;b[e>>1]=u&63|t<<6&960|56320;q=q+4|0}}while(0);e=e+2|0;if(!(q>>>0<h>>>0)){n=31;break}}}else{q=g;e=k;n=31}}while(0);if((n|0)==31){h=q>>>0<h>>>0&1}c[j>>2]=g+(q-g);c[m>>2]=k+(e-k>>1<<1);i=f;return h|0}function Ql(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;c[f>>2]=d;return 3}function Rl(a){a=a|0;return 0}function Sl(a){a=a|0;return 0}function Tl(b,c,d,e,f){b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;c=i;a:do{if(d>>>0<e>>>0&(f|0)!=0){b=e;h=d;g=0;b:while(1){k=a[h>>0]|0;j=k&255;do{if(k<<24>>24>-1){h=h+1|0}else{if((k&255)<194){break a}if((k&255)<224){if((b-h|0)<2){break a}if(!((a[h+1>>0]&-64)<<24>>24==-128)){break a}h=h+2|0;break}if((k&255)<240){k=h;if((b-k|0)<3){break a}m=a[h+1>>0]|0;l=a[h+2>>0]|0;if((j|0)==224){if(!((m&-32)<<24>>24==-96)){e=14;break b}}else if((j|0)==237){if(!((m&-32)<<24>>24==-128)){e=16;break b}}else{if(!((m&-64)<<24>>24==-128)){e=18;break b}}if(!((l&-64)<<24>>24==-128)){break a}h=h+3|0;break}if(!((k&255)<245)){break a}k=h;if((b-k|0)<4){break a}if((f-g|0)>>>0<2){break a}n=a[h+1>>0]|0;l=a[h+2>>0]|0;m=a[h+3>>0]|0;if((j|0)==244){if(!((n&-16)<<24>>24==-128)){e=28;break b}}else if((j|0)==240){if(!((n+112<<24>>24&255)<48)){e=26;break b}}else{if(!((n&-64)<<24>>24==-128)){e=30;break b}}if(!((l&-64)<<24>>24==-128)){break a}if(!((m&-64)<<24>>24==-128)){break a}if(((n&255)<<12&196608|j<<18&1835008)>>>0>1114111){break a}h=h+4|0;g=g+1|0}}while(0);g=g+1|0;if(!(h>>>0<e>>>0&g>>>0<f>>>0)){break a}}if((e|0)==14){n=k-d|0;i=c;return n|0}else if((e|0)==16){n=k-d|0;i=c;return n|0}else if((e|0)==18){n=k-d|0;i=c;return n|0}else if((e|0)==26){n=k-d|0;i=c;return n|0}else if((e|0)==28){n=k-d|0;i=c;return n|0}else if((e|0)==30){n=k-d|0;i=c;return n|0}}else{h=d}}while(0);n=h-d|0;i=c;return n|0}function Ul(a){a=a|0;return 4}function Vl(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Wl(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0;d=i;a:do{if(e>>>0<f>>>0){b=e;l=h;while(1){m=c[b>>2]|0;if((m&-2048|0)==55296|m>>>0>1114111){f=2;break a}do{if(!(m>>>0<128)){if(m>>>0<2048){if((j-l|0)<2){f=1;break a}a[l>>0]=m>>>6|192;a[l+1>>0]=m&63|128;l=l+2|0;break}n=j-l|0;if(m>>>0<65536){if((n|0)<3){f=1;break a}a[l>>0]=m>>>12|224;a[l+1>>0]=m>>>6&63|128;a[l+2>>0]=m&63|128;l=l+3|0;break}else{if((n|0)<4){f=1;break a}a[l>>0]=m>>>18|240;a[l+1>>0]=m>>>12&63|128;a[l+2>>0]=m>>>6&63|128;a[l+3>>0]=m&63|128;l=l+4|0;break}}else{if((j-l|0)<1){f=1;break a}a[l>>0]=m;l=l+1|0}}while(0);b=b+4|0;if(!(b>>>0<f>>>0)){f=0;break}}}else{f=0;b=e;l=h}}while(0);c[g>>2]=e+(b-e>>2<<2);c[k>>2]=h+(l-h);i=d;return f|0}function Xl(b,e,f,g,h,j,k,l){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0;e=i;a:do{if(f>>>0<g>>>0){o=g;n=f;b=j;while(1){if(!(b>>>0<k>>>0)){m=30;break a}q=a[n>>0]|0;p=q&255;do{if(q<<24>>24>-1){c[b>>2]=p;n=n+1|0}else{if((q&255)<194){g=2;break a}if((q&255)<224){if((o-n|0)<2){g=1;break a}q=d[n+1>>0]|0;if((q&192|0)!=128){g=2;break a}c[b>>2]=q&63|p<<6&1984;n=n+2|0;break}if((q&255)<240){if((o-n|0)<3){g=1;break a}q=a[n+1>>0]|0;r=a[n+2>>0]|0;if((p|0)==224){if(!((q&-32)<<24>>24==-96)){g=2;break a}}else if((p|0)==237){if(!((q&-32)<<24>>24==-128)){g=2;break a}}else{if(!((q&-64)<<24>>24==-128)){g=2;break a}}r=r&255;if((r&192|0)!=128){g=2;break a}c[b>>2]=(q&255)<<6&4032|p<<12&61440|r&63;n=n+3|0;break}if(!((q&255)<245)){g=2;break a}if((o-n|0)<4){g=1;break a}q=a[n+1>>0]|0;r=a[n+2>>0]|0;s=a[n+3>>0]|0;if((p|0)==244){if(!((q&-16)<<24>>24==-128)){g=2;break a}}else if((p|0)==240){if(!((q+112<<24>>24&255)<48)){g=2;break a}}else{if(!((q&-64)<<24>>24==-128)){g=2;break a}}r=r&255;if((r&192|0)!=128){g=2;break a}s=s&255;if((s&192|0)!=128){g=2;break a}p=(q&255)<<12&258048|p<<18&1835008|r<<6&4032|s&63;if(p>>>0>1114111){g=2;break a}c[b>>2]=p;n=n+4|0}}while(0);b=b+4|0;if(!(n>>>0<g>>>0)){m=30;break}}}else{n=f;b=j;m=30}}while(0);if((m|0)==30){g=n>>>0<g>>>0&1}c[h>>2]=f+(n-f);c[l>>2]=j+(b-j>>2<<2);i=e;return g|0}function Yl(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;c[f>>2]=d;return 3}function Zl(a){a=a|0;return 0}function _l(a){a=a|0;return 0}function $l(b,c,d,e,f){b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;c=i;a:do{if(d>>>0<e>>>0&(f|0)!=0){g=e;j=d;b=1;b:while(1){k=a[j>>0]|0;h=k&255;do{if(k<<24>>24>-1){j=j+1|0}else{if((k&255)<194){break a}if((k&255)<224){if((g-j|0)<2){break a}if(!((a[j+1>>0]&-64)<<24>>24==-128)){break a}j=j+2|0;break}if((k&255)<240){k=j;if((g-k|0)<3){break a}m=a[j+1>>0]|0;l=a[j+2>>0]|0;if((h|0)==224){if(!((m&-32)<<24>>24==-96)){e=14;break b}}else if((h|0)==237){if(!((m&-32)<<24>>24==-128)){e=16;break b}}else{if(!((m&-64)<<24>>24==-128)){e=18;break b}}if(!((l&-64)<<24>>24==-128)){break a}j=j+3|0;break}if(!((k&255)<245)){break a}k=j;if((g-k|0)<4){break a}m=a[j+1>>0]|0;n=a[j+2>>0]|0;l=a[j+3>>0]|0;if((h|0)==240){if(!((m+112<<24>>24&255)<48)){e=25;break b}}else if((h|0)==244){if(!((m&-16)<<24>>24==-128)){e=27;break b}}else{if(!((m&-64)<<24>>24==-128)){e=29;break b}}if(!((n&-64)<<24>>24==-128)){break a}if(!((l&-64)<<24>>24==-128)){break a}if(((m&255)<<12&196608|h<<18&1835008)>>>0>1114111){break a}j=j+4|0}}while(0);if(!(j>>>0<e>>>0&b>>>0<f>>>0)){break a}b=b+1|0}if((e|0)==14){n=k-d|0;i=c;return n|0}else if((e|0)==16){n=k-d|0;i=c;return n|0}else if((e|0)==18){n=k-d|0;i=c;return n|0}else if((e|0)==25){n=k-d|0;i=c;return n|0}else if((e|0)==27){n=k-d|0;i=c;return n|0}else if((e|0)==29){n=k-d|0;i=c;return n|0}}else{j=d}}while(0);n=j-d|0;i=c;return n|0}function am(a){a=a|0;return 4}function bm(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function cm(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function dm(b){b=b|0;var d=0,e=0;d=i;c[b>>2]=13624;if(!((a[b+12>>0]&1)==0)){e=c[b+20>>2]|0;if((e|0)!=0){vn(e)}if((b|0)==0){i=d;return}}vn(b);i=d;return}function em(b){b=b|0;var d=0,e=0;d=i;c[b>>2]=13624;if(!((a[b+12>>0]&1)==0)?(e=c[b+20>>2]|0,(e|0)!=0):0){vn(e)}i=d;return}function fm(b){b=b|0;var d=0,e=0;d=i;c[b>>2]=13664;if(!((a[b+16>>0]&1)==0)){e=c[b+24>>2]|0;if((e|0)!=0){vn(e)}if((b|0)==0){i=d;return}}vn(b);i=d;return}function gm(b){b=b|0;var d=0,e=0;d=i;c[b>>2]=13664;if(!((a[b+16>>0]&1)==0)?(e=c[b+24>>2]|0,(e|0)!=0):0){vn(e)}i=d;return}function hm(b){b=b|0;return a[b+8>>0]|0}function im(a){a=a|0;return c[a+8>>2]|0}function jm(b){b=b|0;return a[b+9>>0]|0}function km(a){a=a|0;return c[a+12>>2]|0}function lm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;e=i;g=d+12|0;if((a[g>>0]&1)==0){c[b+0>>2]=c[g+0>>2];c[b+4>>2]=c[g+4>>2];c[b+8>>2]=c[g+8>>2];i=e;return}g=c[d+20>>2]|0;d=c[d+16>>2]|0;if(d>>>0>4294967279){dg()}do{if(d>>>0<11){a[b>>0]=d<<1;k=b+1|0}else{h=d+16&-16;j=(h|0)==0?1:h;while(1){k=un(j)|0;if((k|0)!=0){f=13;break}k=c[5666]|0;c[5666]=k+0;if((k|0)==0){break}sc[k&31]()}if((f|0)==13){c[b+8>>2]=k;c[b>>2]=h|1;c[b+4>>2]=d;break}k=Xa(4)|0;c[k>>2]=22680;wb(k|0,22728,206)}}while(0);Ln(k|0,g|0,d|0)|0;a[k+d>>0]=0;i=e;return}function mm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;e=i;g=d+16|0;if((a[g>>0]&1)==0){c[b+0>>2]=c[g+0>>2];c[b+4>>2]=c[g+4>>2];c[b+8>>2]=c[g+8>>2];i=e;return}g=c[d+24>>2]|0;d=c[d+20>>2]|0;if(d>>>0>4294967279){dg()}do{if(d>>>0<11){a[b>>0]=d<<1;k=b+1|0}else{h=d+16&-16;j=(h|0)==0?1:h;while(1){k=un(j)|0;if((k|0)!=0){f=13;break}k=c[5666]|0;c[5666]=k+0;if((k|0)==0){break}sc[k&31]()}if((f|0)==13){c[b+8>>2]=k;c[b>>2]=h|1;c[b+4>>2]=d;break}k=Xa(4)|0;c[k>>2]=22680;wb(k|0,22728,206)}}while(0);Ln(k|0,g|0,d|0)|0;a[k+d>>0]=0;i=e;return}function nm(b,c){b=b|0;c=c|0;a[b>>0]=8;c=b+1|0;a[c>>0]=1702195828;a[c+1>>0]=6649202;a[c+2>>0]=25973;a[c+3>>0]=101;a[b+5>>0]=0;return}function om(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;d=i;e=13696;while(1){if((c[e>>2]|0)==0){break}else{e=e+4|0}}g=e-13696|0;e=g>>2;if(e>>>0>1073741807){dg()}do{if(e>>>0<2){a[b>>0]=g>>>1;j=b+4|0}else{g=e+4&-4;h=g<<2;h=(h|0)==0?1:h;while(1){j=un(h)|0;if((j|0)!=0){f=13;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){break}sc[j&31]()}if((f|0)==13){c[b+8>>2]=j;c[b>>2]=g|1;c[b+4>>2]=e;break}j=Xa(4)|0;c[j>>2]=22680;wb(j|0,22728,206)}}while(0);if((e|0)==0){j=j+(e<<2)|0;c[j>>2]=0;i=d;return}else{f=e;g=13696;b=j}while(1){f=f+ -1|0;c[b>>2]=c[g>>2];if((f|0)==0){break}else{g=g+4|0;b=b+4|0}}j=j+(e<<2)|0;c[j>>2]=0;i=d;return}function pm(b,c){b=b|0;c=c|0;var d=0;c=i;a[b>>0]=10;d=b+1|0;a[d+0>>0]=a[13720>>0]|0;a[d+1>>0]=a[13721>>0]|0;a[d+2>>0]=a[13722>>0]|0;a[d+3>>0]=a[13723>>0]|0;a[d+4>>0]=a[13724>>0]|0;a[b+6>>0]=0;i=c;return}function qm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;d=i;e=13728;while(1){if((c[e>>2]|0)==0){break}else{e=e+4|0}}g=e-13728|0;e=g>>2;if(e>>>0>1073741807){dg()}do{if(e>>>0<2){a[b>>0]=g>>>1;j=b+4|0}else{g=e+4&-4;h=g<<2;h=(h|0)==0?1:h;while(1){j=un(h)|0;if((j|0)!=0){f=13;break}j=c[5666]|0;c[5666]=j+0;if((j|0)==0){break}sc[j&31]()}if((f|0)==13){c[b+8>>2]=j;c[b>>2]=g|1;c[b+4>>2]=e;break}j=Xa(4)|0;c[j>>2]=22680;wb(j|0,22728,206)}}while(0);if((e|0)==0){j=j+(e<<2)|0;c[j>>2]=0;i=d;return}else{f=e;g=13728;b=j}while(1){f=f+ -1|0;c[b>>2]=c[g>>2];if((f|0)==0){break}else{g=g+4|0;b=b+4|0}}j=j+(e<<2)|0;c[j>>2]=0;i=d;return}function rm(b){b=b|0;var d=0;b=i;if((a[13760]|0)!=0){d=c[3438]|0;i=b;return d|0}if((Qa(13760)|0)==0){d=c[3438]|0;i=b;return d|0}if((a[20928]|0)==0?(Qa(20928)|0)!=0:0){Nn(20760,0,168)|0;cc(215,0,p|0)|0;$a(20928)}gg(20760,20936);gg(20772|0,20944);gg(20784|0,20952);gg(20796|0,20960);gg(20808|0,20976);gg(20820|0,20992);gg(20832|0,21e3);gg(20844|0,21016);gg(20856|0,21024);gg(20868|0,21032);gg(20880|0,21040);gg(20892|0,21048);gg(20904|0,21056);gg(20916|0,21064);c[3438]=20760;$a(13760);d=c[3438]|0;i=b;return d|0}function sm(b){b=b|0;var d=0;b=i;if((a[13776]|0)!=0){d=c[3442]|0;i=b;return d|0}if((Qa(13776)|0)==0){d=c[3442]|0;i=b;return d|0}if((a[20392]|0)==0?(Qa(20392)|0)!=0:0){Nn(20224,0,168)|0;cc(216,0,p|0)|0;$a(20392)}ng(20224,20400);ng(20236|0,20432);ng(20248|0,20464);ng(20260|0,20496);ng(20272|0,20536);ng(20284|0,20576);ng(20296|0,20608);ng(20308|0,20648);ng(20320|0,20664);ng(20332|0,20680);ng(20344|0,20696);ng(20356|0,20712);ng(20368|0,20728);ng(20380|0,20744);c[3442]=20224;$a(13776);d=c[3442]|0;i=b;return d|0}function tm(b){b=b|0;var d=0;b=i;if((a[13792]|0)!=0){d=c[3446]|0;i=b;return d|0}if((Qa(13792)|0)==0){d=c[3446]|0;i=b;return d|0}if((a[2e4]|0)==0?(Qa(2e4)|0)!=0:0){Nn(19712,0,288)|0;cc(217,0,p|0)|0;$a(2e4)}gg(19712,20008);gg(19724|0,20016);gg(19736|0,20032);gg(19748|0,20040);gg(19760|0,20048);gg(19772|0,20056);gg(19784|0,20064);gg(19796|0,20072);gg(19808|0,20080);gg(19820|0,20096);gg(19832|0,20104);gg(19844|0,20120);gg(19856|0,20136);gg(19868|0,20144);gg(19880|0,20152);gg(19892|0,20160);gg(19904|0,20048);gg(19916|0,20168);gg(19928|0,20176);gg(19940|0,20184);gg(19952|0,20192);gg(19964|0,20200);gg(19976|0,20208);gg(19988|0,20216);c[3446]=19712;$a(13792);d=c[3446]|0;i=b;return d|0}function um(b){b=b|0;var d=0;b=i;if((a[13808]|0)!=0){d=c[3450]|0;i=b;return d|0}if((Qa(13808)|0)==0){d=c[3450]|0;i=b;return d|0}if((a[19160]|0)==0?(Qa(19160)|0)!=0:0){Nn(18872,0,288)|0;cc(218,0,p|0)|0;$a(19160)}ng(18872,19168);ng(18884|0,19200);ng(18896|0,19240);ng(18908|0,19264);ng(18920|0,19584);ng(18932|0,19288);ng(18944|0,19312);ng(18956|0,19336);ng(18968|0,19368);ng(18980|0,19408);ng(18992|0,19440);ng(19004|0,19480);ng(19016|0,19520);ng(19028|0,19536);ng(19040|0,19552);ng(19052|0,19568);ng(19064|0,19584);ng(19076|0,19600);ng(19088|0,19616);ng(19100|0,19632);ng(19112|0,19648);ng(19124|0,19664);ng(19136|0,19680);ng(19148|0,19696);c[3450]=18872;$a(13808);d=c[3450]|0;i=b;return d|0}function vm(b){b=b|0;var d=0;b=i;if((a[13824]|0)!=0){d=c[3454]|0;i=b;return d|0}if((Qa(13824)|0)==0){d=c[3454]|0;i=b;return d|0}if((a[18848]|0)==0?(Qa(18848)|0)!=0:0){Nn(18560,0,288)|0;cc(219,0,p|0)|0;$a(18848)}gg(18560,18856);gg(18572|0,18864);c[3454]=18560;$a(13824);d=c[3454]|0;i=b;return d|0}function wm(b){b=b|0;var d=0;b=i;if((a[13840]|0)!=0){d=c[3458]|0;i=b;return d|0}if((Qa(13840)|0)==0){d=c[3458]|0;i=b;return d|0}if((a[18520]|0)==0?(Qa(18520)|0)!=0:0){Nn(18232,0,288)|0;cc(220,0,p|0)|0;$a(18520)}ng(18232,18528);ng(18244|0,18544);c[3458]=18232;$a(13840);d=c[3458]|0;i=b;return d|0}function xm(b){b=b|0;var c=0,d=0;b=i;if((a[13864]|0)!=0){i=b;return 13848}if((Qa(13864)|0)==0){i=b;return 13848}a[13848]=16;c=13849|0;d=c;a[d>>0]=623865125;a[d+1>>0]=2436973;a[d+2>>0]=9519;a[d+3>>0]=37;c=c+4|0;a[c>>0]=2032480100;a[c+1>>0]=7939375;a[c+2>>0]=31013;a[c+3>>0]=121;a[13857>>0]=0;cc(221,13848,p|0)|0;$a(13864);i=b;return 13848}function ym(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;b=i;if((a[13888]|0)!=0){i=b;return 13872}if((Qa(13888)|0)==0){i=b;return 13872}else{d=13896}while(1){if((c[d>>2]|0)==0){break}else{d=d+4|0}}f=d-13896|0;d=f>>2;if(d>>>0>1073741807){dg()}do{if(d>>>0<2){a[13872]=f>>>1;e=13876|0}else{f=d+4&-4;g=f<<2;g=(g|0)==0?1:g;while(1){h=un(g)|0;if((h|0)!=0){e=15;break}h=c[5666]|0;c[5666]=h+0;if((h|0)==0){break}sc[h&31]()}if((e|0)==15){c[13880>>2]=h;c[3468]=f|1;c[13876>>2]=d;e=h;break}h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}}while(0);if((d|0)!=0){h=d;f=13896;g=e;while(1){h=h+ -1|0;c[g>>2]=c[f>>2];if((h|0)==0){break}else{f=f+4|0;g=g+4|0}}}c[e+(d<<2)>>2]=0;cc(222,13872,p|0)|0;$a(13888);i=b;return 13872}function zm(b){b=b|0;var c=0,d=0;b=i;if((a[13952]|0)!=0){i=b;return 13936}if((Qa(13952)|0)==0){i=b;return 13936}a[13936]=16;c=13937|0;d=c;a[d>>0]=624576549;a[d+1>>0]=2439752;a[d+2>>0]=9530;a[d+3>>0]=37;c=c+4|0;a[c>>0]=1394948685;a[c+1>>0]=5449018;a[c+2>>0]=21285;a[c+3>>0]=83;a[13945>>0]=0;cc(221,13936,p|0)|0;$a(13952);i=b;return 13936}function Am(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;b=i;if((a[13976]|0)!=0){i=b;return 13960}if((Qa(13976)|0)==0){i=b;return 13960}else{d=13984}while(1){if((c[d>>2]|0)==0){break}else{d=d+4|0}}f=d-13984|0;d=f>>2;if(d>>>0>1073741807){dg()}do{if(d>>>0<2){a[13960]=f>>>1;e=13964|0}else{f=d+4&-4;g=f<<2;g=(g|0)==0?1:g;while(1){h=un(g)|0;if((h|0)!=0){e=15;break}h=c[5666]|0;c[5666]=h+0;if((h|0)==0){break}sc[h&31]()}if((e|0)==15){c[13968>>2]=h;c[3490]=f|1;c[13964>>2]=d;e=h;break}h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}}while(0);if((d|0)!=0){h=d;f=13984;g=e;while(1){h=h+ -1|0;c[g>>2]=c[f>>2];if((h|0)==0){break}else{f=f+4|0;g=g+4|0}}}c[e+(d<<2)>>2]=0;cc(222,13960,p|0)|0;$a(13976);i=b;return 13960}function Bm(b){b=b|0;b=i;if((a[14040]|0)==0?(Qa(14040)|0)!=0:0){eg(14024,14048,20);cc(221,14024,p|0)|0;$a(14040)}i=b;return 14024}function Cm(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;b=i;if((a[14088]|0)!=0){i=b;return 14072}if((Qa(14088)|0)==0){i=b;return 14072}else{d=14096}while(1){if((c[d>>2]|0)==0){break}else{d=d+4|0}}f=d-14096|0;d=f>>2;if(d>>>0>1073741807){dg()}do{if(d>>>0<2){a[14072]=f>>>1;e=14076|0}else{f=d+4&-4;g=f<<2;g=(g|0)==0?1:g;while(1){h=un(g)|0;if((h|0)!=0){e=15;break}h=c[5666]|0;c[5666]=h+0;if((h|0)==0){break}sc[h&31]()}if((e|0)==15){c[14080>>2]=h;c[3518]=f|1;c[14076>>2]=d;e=h;break}h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}}while(0);if((d|0)!=0){h=d;f=14096;g=e;while(1){h=h+ -1|0;c[g>>2]=c[f>>2];if((h|0)==0){break}else{f=f+4|0;g=g+4|0}}}c[e+(d<<2)>>2]=0;cc(222,14072,p|0)|0;$a(14088);i=b;return 14072}function Dm(b){b=b|0;b=i;if((a[14200]|0)==0?(Qa(14200)|0)!=0:0){eg(14184,14208,11);cc(221,14184,p|0)|0;$a(14200)}i=b;return 14184}function Em(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;b=i;if((a[14240]|0)!=0){i=b;return 14224}if((Qa(14240)|0)==0){i=b;return 14224}else{d=14248}while(1){if((c[d>>2]|0)==0){break}else{d=d+4|0}}f=d-14248|0;d=f>>2;if(d>>>0>1073741807){dg()}do{if(d>>>0<2){a[14224]=f>>>1;e=14228|0}else{f=d+4&-4;g=f<<2;g=(g|0)==0?1:g;while(1){h=un(g)|0;if((h|0)!=0){e=15;break}h=c[5666]|0;c[5666]=h+0;if((h|0)==0){break}sc[h&31]()}if((e|0)==15){c[14232>>2]=h;c[3556]=f|1;c[14228>>2]=d;e=h;break}h=Xa(4)|0;c[h>>2]=22680;wb(h|0,22728,206)}}while(0);if((d|0)!=0){h=d;f=14248;g=e;while(1){h=h+ -1|0;c[g>>2]=c[f>>2];if((h|0)==0){break}else{f=f+4|0;g=g+4|0}}}c[e+(d<<2)>>2]=0;cc(222,14224,p|0)|0;$a(14240);i=b;return 14224}function Fm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0.0;f=i;i=i+16|0;g=f;if((b|0)==(d|0)){c[e>>2]=4;k=0.0;i=f;return+k}j=bb()|0;h=c[j>>2]|0;c[j>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}k=+Fn(b,g);b=c[j>>2]|0;if((b|0)==0){c[j>>2]=h}if((c[g>>2]|0)!=(d|0)){c[e>>2]=4;k=0.0;i=f;return+k}if((b|0)!=34){i=f;return+k}c[e>>2]=4;i=f;return+k}function Gm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0.0;f=i;i=i+16|0;g=f;if((b|0)==(d|0)){c[e>>2]=4;k=0.0;i=f;return+k}j=bb()|0;h=c[j>>2]|0;c[j>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}k=+Fn(b,g);b=c[j>>2]|0;if((b|0)==0){c[j>>2]=h}if((c[g>>2]|0)!=(d|0)){c[e>>2]=4;k=0.0;i=f;return+k}if((b|0)!=34){i=f;return+k}c[e>>2]=4;i=f;return+k}function Hm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0.0;f=i;i=i+16|0;g=f;if((b|0)==(d|0)){c[e>>2]=4;k=0.0;i=f;return+k}j=bb()|0;h=c[j>>2]|0;c[j>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}k=+Fn(b,g);b=c[j>>2]|0;if((b|0)==0){c[j>>2]=h}if((c[g>>2]|0)!=(d|0)){c[e>>2]=4;k=0.0;i=f;return+k}if((b|0)==34){c[e>>2]=4}i=f;return+k}function Im(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+112|0;k=h;if((b|0)==(d|0)){c[e>>2]=4;f=0;m=0;I=f;i=h;return m|0}if((a[b>>0]|0)==45){c[e>>2]=4;f=0;m=0;I=f;i=h;return m|0}g=bb()|0;j=c[g>>2]|0;c[g>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}c[k>>2]=0;l=k+4|0;c[l>>2]=b;c[k+44>>2]=b;if((b|0)<0){c[k+8>>2]=-1;m=-1}else{m=b+2147483647|0;c[k+8>>2]=m}c[k+76>>2]=-1;c[k+104>>2]=0;n=k+108|0;c[n>>2]=m-b;c[k+100>>2]=m;m=Bn(k,f,-1,-1)|0;f=I;k=b+((c[l>>2]|0)+(c[n>>2]|0)-(c[k+8>>2]|0))|0;b=c[g>>2]|0;if((b|0)==0){c[g>>2]=j}if((k|0)!=(d|0)){c[e>>2]=4;m=0;n=0;I=m;i=h;return n|0}if((b|0)!=34){n=m;I=f;i=h;return n|0}c[e>>2]=4;m=-1;n=-1;I=m;i=h;return n|0}function Jm(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+112|0;k=h;if((b|0)==(d|0)){c[e>>2]=4;m=0;i=h;return m|0}if((a[b>>0]|0)==45){c[e>>2]=4;m=0;i=h;return m|0}g=bb()|0;j=c[g>>2]|0;c[g>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}c[k>>2]=0;l=k+4|0;c[l>>2]=b;c[k+44>>2]=b;if((b|0)<0){c[k+8>>2]=-1;m=-1}else{m=b+2147483647|0;c[k+8>>2]=m}c[k+76>>2]=-1;c[k+104>>2]=0;n=k+108|0;c[n>>2]=m-b;c[k+100>>2]=m;m=Bn(k,f,-1,-1)|0;f=I;k=b+((c[l>>2]|0)+(c[n>>2]|0)-(c[k+8>>2]|0))|0;b=c[g>>2]|0;if((b|0)==0){c[g>>2]=j}if((k|0)!=(d|0)){c[e>>2]=4;n=0;i=h;return n|0}if((b|0)==34|(f>>>0>0|(f|0)==0&m>>>0>4294967295)){c[e>>2]=4;n=-1;i=h;return n|0}else{n=m;i=h;return n|0}return 0}function Km(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+112|0;k=h;if((b|0)==(d|0)){c[e>>2]=4;m=0;i=h;return m|0}if((a[b>>0]|0)==45){c[e>>2]=4;m=0;i=h;return m|0}g=bb()|0;j=c[g>>2]|0;c[g>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}c[k>>2]=0;l=k+4|0;c[l>>2]=b;c[k+44>>2]=b;if((b|0)<0){c[k+8>>2]=-1;m=-1}else{m=b+2147483647|0;c[k+8>>2]=m}c[k+76>>2]=-1;c[k+104>>2]=0;n=k+108|0;c[n>>2]=m-b;c[k+100>>2]=m;m=Bn(k,f,-1,-1)|0;f=I;k=b+((c[l>>2]|0)+(c[n>>2]|0)-(c[k+8>>2]|0))|0;b=c[g>>2]|0;if((b|0)==0){c[g>>2]=j}if((k|0)!=(d|0)){c[e>>2]=4;n=0;i=h;return n|0}if((b|0)==34|(f>>>0>0|(f|0)==0&m>>>0>4294967295)){c[e>>2]=4;n=-1;i=h;return n|0}else{n=m;i=h;return n|0}return 0}function Lm(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+112|0;k=h;if((b|0)==(d|0)){c[e>>2]=4;m=0;i=h;return m|0}if((a[b>>0]|0)==45){c[e>>2]=4;m=0;i=h;return m|0}g=bb()|0;j=c[g>>2]|0;c[g>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}c[k>>2]=0;l=k+4|0;c[l>>2]=b;c[k+44>>2]=b;if((b|0)<0){c[k+8>>2]=-1;m=-1}else{m=b+2147483647|0;c[k+8>>2]=m}c[k+76>>2]=-1;c[k+104>>2]=0;n=k+108|0;c[n>>2]=m-b;c[k+100>>2]=m;m=Bn(k,f,-1,-1)|0;f=I;k=b+((c[l>>2]|0)+(c[n>>2]|0)-(c[k+8>>2]|0))|0;b=c[g>>2]|0;if((b|0)==0){c[g>>2]=j}if((k|0)!=(d|0)){c[e>>2]=4;n=0;i=h;return n|0}if((b|0)==34|(f>>>0>0|(f|0)==0&m>>>0>65535)){c[e>>2]=4;n=-1;i=h;return n|0}else{n=m&65535;i=h;return n|0}return 0}function Mm(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+112|0;k=h;if((b|0)==(d|0)){c[e>>2]=4;f=0;m=0;I=f;i=h;return m|0}g=bb()|0;j=c[g>>2]|0;c[g>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}c[k>>2]=0;l=k+4|0;c[l>>2]=b;c[k+44>>2]=b;if((b|0)<0){c[k+8>>2]=-1;m=-1}else{m=b+2147483647|0;c[k+8>>2]=m}c[k+76>>2]=-1;c[k+104>>2]=0;n=k+108|0;c[n>>2]=m-b;c[k+100>>2]=m;m=Bn(k,f,0,-2147483648)|0;f=I;k=b+((c[l>>2]|0)+(c[n>>2]|0)-(c[k+8>>2]|0))|0;b=c[g>>2]|0;if((b|0)==0){c[g>>2]=j}if((k|0)!=(d|0)){c[e>>2]=4;m=0;n=0;I=m;i=h;return n|0}if((b|0)==34){c[e>>2]=4;n=(f|0)>0|(f|0)==0&m>>>0>0;I=n?2147483647:-2147483648;i=h;return(n?-1:0)|0}else{n=m;I=f;i=h;return n|0}return 0}function Nm(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;i=i+112|0;k=h;if((b|0)==(d|0)){c[e>>2]=4;m=0;i=h;return m|0}g=bb()|0;j=c[g>>2]|0;c[g>>2]=0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}c[k>>2]=0;l=k+4|0;c[l>>2]=b;c[k+44>>2]=b;if((b|0)<0){c[k+8>>2]=-1;m=-1}else{m=b+2147483647|0;c[k+8>>2]=m}c[k+76>>2]=-1;c[k+104>>2]=0;n=k+108|0;c[n>>2]=m-b;c[k+100>>2]=m;m=Bn(k,f,0,-2147483648)|0;f=I;k=b+((c[l>>2]|0)+(c[n>>2]|0)-(c[k+8>>2]|0))|0;b=c[g>>2]|0;if((b|0)==0){c[g>>2]=j}if((k|0)!=(d|0)){c[e>>2]=4;n=0;i=h;return n|0}do{if((b|0)==34){c[e>>2]=4;if((f|0)>0|(f|0)==0&m>>>0>0){n=2147483647;i=h;return n|0}}else{if((f|0)<-1|(f|0)==-1&m>>>0<2147483648){c[e>>2]=4;break}if((f|0)>0|(f|0)==0&m>>>0>2147483647){c[e>>2]=4;n=2147483647;i=h;return n|0}else{n=m;i=h;return n|0}}}while(0);n=-2147483648;i=h;return n|0}function Om(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;b=i;if(!((a[18508>>0]&1)==0)?(v=c[18516>>2]|0,(v|0)!=0):0){vn(v)}if(!((a[18496>>0]&1)==0)?(u=c[18504>>2]|0,(u|0)!=0):0){vn(u)}if(!((a[18484>>0]&1)==0)?(t=c[18492>>2]|0,(t|0)!=0):0){vn(t)}if(!((a[18472>>0]&1)==0)?(s=c[18480>>2]|0,(s|0)!=0):0){vn(s)}if(!((a[18460>>0]&1)==0)?(r=c[18468>>2]|0,(r|0)!=0):0){vn(r)}if(!((a[18448>>0]&1)==0)?(d=c[18456>>2]|0,(d|0)!=0):0){vn(d)}if(!((a[18436>>0]&1)==0)?(p=c[18444>>2]|0,(p|0)!=0):0){vn(p)}if(!((a[18424>>0]&1)==0)?(o=c[18432>>2]|0,(o|0)!=0):0){vn(o)}if(!((a[18412>>0]&1)==0)?(n=c[18420>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[18400>>0]&1)==0)?(m=c[18408>>2]|0,(m|0)!=0):0){vn(m)}if(!((a[18388>>0]&1)==0)?(l=c[18396>>2]|0,(l|0)!=0):0){vn(l)}if(!((a[18376>>0]&1)==0)?(k=c[18384>>2]|0,(k|0)!=0):0){vn(k)}if(!((a[18364>>0]&1)==0)?(j=c[18372>>2]|0,(j|0)!=0):0){vn(j)}if(!((a[18352>>0]&1)==0)?(h=c[18360>>2]|0,(h|0)!=0):0){vn(h)}if(!((a[18340>>0]&1)==0)?(g=c[18348>>2]|0,(g|0)!=0):0){vn(g)}if(!((a[18328>>0]&1)==0)?(f=c[18336>>2]|0,(f|0)!=0):0){vn(f)}if(!((a[18316>>0]&1)==0)?(e=c[18324>>2]|0,(e|0)!=0):0){vn(e)}if(!((a[18304>>0]&1)==0)?(q=c[18312>>2]|0,(q|0)!=0):0){vn(q)}do{if(!((a[18292>>0]&1)==0)){d=c[18300>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18280>>0]&1)==0)){d=c[18288>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18268>>0]&1)==0)){d=c[18276>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18256>>0]&1)==0)){d=c[18264>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18244>>0]&1)==0)){d=c[18252>>2]|0;if((d|0)==0){break}vn(d)}}while(0);if((a[18232]&1)==0){i=b;return}d=c[18240>>2]|0;if((d|0)==0){i=b;return}vn(d);i=b;return}function Pm(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;b=i;if(!((a[18836>>0]&1)==0)?(v=c[18844>>2]|0,(v|0)!=0):0){vn(v)}if(!((a[18824>>0]&1)==0)?(u=c[18832>>2]|0,(u|0)!=0):0){vn(u)}if(!((a[18812>>0]&1)==0)?(t=c[18820>>2]|0,(t|0)!=0):0){vn(t)}if(!((a[18800>>0]&1)==0)?(s=c[18808>>2]|0,(s|0)!=0):0){vn(s)}if(!((a[18788>>0]&1)==0)?(r=c[18796>>2]|0,(r|0)!=0):0){vn(r)}if(!((a[18776>>0]&1)==0)?(d=c[18784>>2]|0,(d|0)!=0):0){vn(d)}if(!((a[18764>>0]&1)==0)?(p=c[18772>>2]|0,(p|0)!=0):0){vn(p)}if(!((a[18752>>0]&1)==0)?(o=c[18760>>2]|0,(o|0)!=0):0){vn(o)}if(!((a[18740>>0]&1)==0)?(n=c[18748>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[18728>>0]&1)==0)?(m=c[18736>>2]|0,(m|0)!=0):0){vn(m)}if(!((a[18716>>0]&1)==0)?(l=c[18724>>2]|0,(l|0)!=0):0){vn(l)}if(!((a[18704>>0]&1)==0)?(k=c[18712>>2]|0,(k|0)!=0):0){vn(k)}if(!((a[18692>>0]&1)==0)?(j=c[18700>>2]|0,(j|0)!=0):0){vn(j)}if(!((a[18680>>0]&1)==0)?(h=c[18688>>2]|0,(h|0)!=0):0){vn(h)}if(!((a[18668>>0]&1)==0)?(g=c[18676>>2]|0,(g|0)!=0):0){vn(g)}if(!((a[18656>>0]&1)==0)?(f=c[18664>>2]|0,(f|0)!=0):0){vn(f)}if(!((a[18644>>0]&1)==0)?(e=c[18652>>2]|0,(e|0)!=0):0){vn(e)}if(!((a[18632>>0]&1)==0)?(q=c[18640>>2]|0,(q|0)!=0):0){vn(q)}do{if(!((a[18620>>0]&1)==0)){d=c[18628>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18608>>0]&1)==0)){d=c[18616>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18596>>0]&1)==0)){d=c[18604>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18584>>0]&1)==0)){d=c[18592>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18572>>0]&1)==0)){d=c[18580>>2]|0;if((d|0)==0){break}vn(d)}}while(0);if((a[18560]&1)==0){i=b;return}d=c[18568>>2]|0;if((d|0)==0){i=b;return}vn(d);i=b;return}function Qm(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;b=i;if(!((a[19148>>0]&1)==0)?(v=c[19156>>2]|0,(v|0)!=0):0){vn(v)}if(!((a[19136>>0]&1)==0)?(u=c[19144>>2]|0,(u|0)!=0):0){vn(u)}if(!((a[19124>>0]&1)==0)?(t=c[19132>>2]|0,(t|0)!=0):0){vn(t)}if(!((a[19112>>0]&1)==0)?(s=c[19120>>2]|0,(s|0)!=0):0){vn(s)}if(!((a[19100>>0]&1)==0)?(r=c[19108>>2]|0,(r|0)!=0):0){vn(r)}if(!((a[19088>>0]&1)==0)?(d=c[19096>>2]|0,(d|0)!=0):0){vn(d)}if(!((a[19076>>0]&1)==0)?(p=c[19084>>2]|0,(p|0)!=0):0){vn(p)}if(!((a[19064>>0]&1)==0)?(o=c[19072>>2]|0,(o|0)!=0):0){vn(o)}if(!((a[19052>>0]&1)==0)?(n=c[19060>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[19040>>0]&1)==0)?(m=c[19048>>2]|0,(m|0)!=0):0){vn(m)}if(!((a[19028>>0]&1)==0)?(l=c[19036>>2]|0,(l|0)!=0):0){vn(l)}if(!((a[19016>>0]&1)==0)?(k=c[19024>>2]|0,(k|0)!=0):0){vn(k)}if(!((a[19004>>0]&1)==0)?(j=c[19012>>2]|0,(j|0)!=0):0){vn(j)}if(!((a[18992>>0]&1)==0)?(h=c[19e3>>2]|0,(h|0)!=0):0){vn(h)}if(!((a[18980>>0]&1)==0)?(g=c[18988>>2]|0,(g|0)!=0):0){vn(g)}if(!((a[18968>>0]&1)==0)?(f=c[18976>>2]|0,(f|0)!=0):0){vn(f)}if(!((a[18956>>0]&1)==0)?(e=c[18964>>2]|0,(e|0)!=0):0){vn(e)}if(!((a[18944>>0]&1)==0)?(q=c[18952>>2]|0,(q|0)!=0):0){vn(q)}do{if(!((a[18932>>0]&1)==0)){d=c[18940>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18920>>0]&1)==0)){d=c[18928>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18908>>0]&1)==0)){d=c[18916>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18896>>0]&1)==0)){d=c[18904>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[18884>>0]&1)==0)){d=c[18892>>2]|0;if((d|0)==0){break}vn(d)}}while(0);if((a[18872]&1)==0){i=b;return}d=c[18880>>2]|0;if((d|0)==0){i=b;return}vn(d);i=b;return}function Rm(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;b=i;if(!((a[19988>>0]&1)==0)?(v=c[19996>>2]|0,(v|0)!=0):0){vn(v)}if(!((a[19976>>0]&1)==0)?(u=c[19984>>2]|0,(u|0)!=0):0){vn(u)}if(!((a[19964>>0]&1)==0)?(t=c[19972>>2]|0,(t|0)!=0):0){vn(t)}if(!((a[19952>>0]&1)==0)?(s=c[19960>>2]|0,(s|0)!=0):0){vn(s)}if(!((a[19940>>0]&1)==0)?(r=c[19948>>2]|0,(r|0)!=0):0){vn(r)}if(!((a[19928>>0]&1)==0)?(d=c[19936>>2]|0,(d|0)!=0):0){vn(d)}if(!((a[19916>>0]&1)==0)?(p=c[19924>>2]|0,(p|0)!=0):0){vn(p)}if(!((a[19904>>0]&1)==0)?(o=c[19912>>2]|0,(o|0)!=0):0){vn(o)}if(!((a[19892>>0]&1)==0)?(n=c[19900>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[19880>>0]&1)==0)?(m=c[19888>>2]|0,(m|0)!=0):0){vn(m)}if(!((a[19868>>0]&1)==0)?(l=c[19876>>2]|0,(l|0)!=0):0){vn(l)}if(!((a[19856>>0]&1)==0)?(k=c[19864>>2]|0,(k|0)!=0):0){vn(k)}if(!((a[19844>>0]&1)==0)?(j=c[19852>>2]|0,(j|0)!=0):0){vn(j)}if(!((a[19832>>0]&1)==0)?(h=c[19840>>2]|0,(h|0)!=0):0){vn(h)}if(!((a[19820>>0]&1)==0)?(g=c[19828>>2]|0,(g|0)!=0):0){vn(g)}if(!((a[19808>>0]&1)==0)?(f=c[19816>>2]|0,(f|0)!=0):0){vn(f)}if(!((a[19796>>0]&1)==0)?(e=c[19804>>2]|0,(e|0)!=0):0){vn(e)}if(!((a[19784>>0]&1)==0)?(q=c[19792>>2]|0,(q|0)!=0):0){vn(q)}do{if(!((a[19772>>0]&1)==0)){d=c[19780>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[19760>>0]&1)==0)){d=c[19768>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[19748>>0]&1)==0)){d=c[19756>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[19736>>0]&1)==0)){d=c[19744>>2]|0;if((d|0)==0){break}vn(d)}}while(0);do{if(!((a[19724>>0]&1)==0)){d=c[19732>>2]|0;if((d|0)==0){break}vn(d)}}while(0);if((a[19712]&1)==0){i=b;return}d=c[19720>>2]|0;if((d|0)==0){i=b;return}vn(d);i=b;return}function Sm(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=i;if(!((a[20380>>0]&1)==0)?(q=c[20388>>2]|0,(q|0)!=0):0){vn(q)}if(!((a[20368>>0]&1)==0)?(p=c[20376>>2]|0,(p|0)!=0):0){vn(p)}if(!((a[20356>>0]&1)==0)?(o=c[20364>>2]|0,(o|0)!=0):0){vn(o)}if(!((a[20344>>0]&1)==0)?(n=c[20352>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[20332>>0]&1)==0)?(m=c[20340>>2]|0,(m|0)!=0):0){vn(m)}if(!((a[20320>>0]&1)==0)?(d=c[20328>>2]|0,(d|0)!=0):0){vn(d)}if(!((a[20308>>0]&1)==0)?(l=c[20316>>2]|0,(l|0)!=0):0){vn(l)}if(!((a[20296>>0]&1)==0)?(k=c[20304>>2]|0,(k|0)!=0):0){vn(k)}if(!((a[20284>>0]&1)==0)?(j=c[20292>>2]|0,(j|0)!=0):0){vn(j)}if(!((a[20272>>0]&1)==0)?(h=c[20280>>2]|0,(h|0)!=0):0){vn(h)}if(!((a[20260>>0]&1)==0)?(g=c[20268>>2]|0,(g|0)!=0):0){vn(g)}if(!((a[20248>>0]&1)==0)?(f=c[20256>>2]|0,(f|0)!=0):0){vn(f)}if(!((a[20236>>0]&1)==0)?(e=c[20244>>2]|0,(e|0)!=0):0){vn(e)}if((a[20224]&1)==0){i=b;return}d=c[20232>>2]|0;if((d|0)==0){i=b;return}vn(d);i=b;return}function Tm(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=i;if(!((a[20916>>0]&1)==0)?(q=c[20924>>2]|0,(q|0)!=0):0){vn(q)}if(!((a[20904>>0]&1)==0)?(p=c[20912>>2]|0,(p|0)!=0):0){vn(p)}if(!((a[20892>>0]&1)==0)?(o=c[20900>>2]|0,(o|0)!=0):0){vn(o)}if(!((a[20880>>0]&1)==0)?(n=c[20888>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[20868>>0]&1)==0)?(m=c[20876>>2]|0,(m|0)!=0):0){vn(m)}if(!((a[20856>>0]&1)==0)?(d=c[20864>>2]|0,(d|0)!=0):0){vn(d)}if(!((a[20844>>0]&1)==0)?(l=c[20852>>2]|0,(l|0)!=0):0){vn(l)}if(!((a[20832>>0]&1)==0)?(k=c[20840>>2]|0,(k|0)!=0):0){vn(k)}if(!((a[20820>>0]&1)==0)?(j=c[20828>>2]|0,(j|0)!=0):0){vn(j)}if(!((a[20808>>0]&1)==0)?(h=c[20816>>2]|0,(h|0)!=0):0){vn(h)}if(!((a[20796>>0]&1)==0)?(g=c[20804>>2]|0,(g|0)!=0):0){vn(g)}if(!((a[20784>>0]&1)==0)?(f=c[20792>>2]|0,(f|0)!=0):0){vn(f)}if(!((a[20772>>0]&1)==0)?(e=c[20780>>2]|0,(e|0)!=0):0){vn(e)}if((a[20760]&1)==0){i=b;return}d=c[20768>>2]|0;if((d|0)==0){i=b;return}vn(d);i=b;return}function Um(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0;g=i;i=i+16|0;h=g;c[h>>2]=b;f=(f|0)==0?21288:f;j=c[f>>2]|0;a:do{if((d|0)==0){if((j|0)==0){k=0;i=g;return k|0}}else{if((b|0)==0){c[h>>2]=h}else{h=b}if((e|0)==0){k=-2;i=g;return k|0}do{if((j|0)==0){b=a[d>>0]|0;j=b&255;if(b<<24>>24>-1){c[h>>2]=j;k=b<<24>>24!=0&1;i=g;return k|0}else{j=j+ -194|0;if(j>>>0>50){break a}b=e+ -1|0;j=c[21072+(j<<2)>>2]|0;d=d+1|0;break}}else{b=e}}while(0);b:do{if((b|0)!=0){k=a[d>>0]|0;l=(k&255)>>>3;if((l+ -16|l+(j>>26))>>>0>7){break a}while(1){d=d+1|0;j=(k&255)+ -128|j<<6;b=b+ -1|0;if((j|0)>=0){break}if((b|0)==0){break b}k=a[d>>0]|0;if(((k&255)+ -128|0)>>>0>63){break a}}c[f>>2]=0;c[h>>2]=j;l=e-b|0;i=g;return l|0}}while(0);c[f>>2]=j;l=-2;i=g;return l|0}}while(0);c[f>>2]=0;c[(bb()|0)>>2]=84;l=-1;i=g;return l|0}function Vm(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;k=c[e>>2]|0;if((g|0)!=0?(l=c[g>>2]|0,(l|0)!=0):0){if((b|0)==0){j=f;g=16}else{c[g>>2]=0;j=f;g=35}}else{if((b|0)==0){j=f;g=7}else{j=f;g=6}}a:while(1){if((g|0)==6){if((j|0)==0){g=53;break}while(1){g=a[k>>0]|0;b:do{if(((g&255)+ -1|0)>>>0<127?(k&3|0)==0&j>>>0>3:0){do{g=c[k>>2]|0;if(((g+ -16843009|g)&-2139062144|0)!=0){g=g&255;break b}c[b>>2]=g&255;c[b+4>>2]=d[k+1>>0]|0;c[b+8>>2]=d[k+2>>0]|0;l=k;k=k+4|0;m=b;b=b+16|0;c[m+12>>2]=d[l+3>>0]|0;j=j+ -4|0}while(j>>>0>3);g=a[k>>0]|0}}while(0);l=g&255;if(!((l+ -1|0)>>>0<127)){break}c[b>>2]=l;j=j+ -1|0;if((j|0)==0){g=53;break a}else{b=b+4|0;k=k+1|0}}l=l+ -194|0;if(l>>>0>50){l=g;g=47;break}l=c[21072+(l<<2)>>2]|0;k=k+1|0;g=35;continue}else if((g|0)==7){l=a[k>>0]|0;if(((l&255)+ -1|0)>>>0<127?(k&3|0)==0:0){l=c[k>>2]|0;if(((l+ -16843009|l)&-2139062144|0)==0){do{k=k+4|0;j=j+ -4|0;l=c[k>>2]|0}while(((l+ -16843009|l)&-2139062144|0)==0)}g=l&255;l=l&255}else{g=l}l=l&255;if((l+ -1|0)>>>0<127){j=j+ -1|0;k=k+1|0;g=7;continue}l=l+ -194|0;if(l>>>0>50){l=g;g=47;break}l=c[21072+(l<<2)>>2]|0;k=k+1|0;g=16;continue}else if((g|0)==16){m=(d[k>>0]|0)>>>3;if((m+ -16|m+(l>>26))>>>0>7){g=17;break}g=k+1|0;if((l&33554432|0)!=0){if(((d[g>>0]|0)+ -128|0)>>>0>63){g=20;break}g=k+2|0;if((l&524288|0)==0){k=g}else{if(((d[g>>0]|0)+ -128|0)>>>0>63){g=23;break}k=k+3|0}}else{k=g}j=j+ -1|0;g=7;continue}else if((g|0)==35){m=d[k>>0]|0;g=m>>>3;if((g+ -16|g+(l>>26))>>>0>7){g=36;break}g=k+1|0;l=m+ -128|l<<6;if((l|0)<0){m=(d[g>>0]|0)+ -128|0;if(m>>>0>63){g=39;break}g=k+2|0;l=m|l<<6;if((l|0)<0){g=(d[g>>0]|0)+ -128|0;if(g>>>0>63){g=42;break}l=g|l<<6;k=k+3|0}else{k=g}}else{k=g}c[b>>2]=l;b=b+4|0;j=j+ -1|0;g=6;continue}}if((g|0)==17){k=k+ -1|0;g=45}else if((g|0)==20){k=k+ -1|0;g=45}else if((g|0)==23){k=k+ -1|0;g=45}else if((g|0)==36){k=k+ -1|0;g=45}else if((g|0)==39){k=k+ -1|0;g=45}else if((g|0)==42){k=k+ -1|0;g=45}else if((g|0)==53){i=h;return f|0}if((g|0)==45){if((l|0)==0){l=a[k>>0]|0;g=47}}if((g|0)==47){if(l<<24>>24==0){if((b|0)!=0){c[b>>2]=0;c[e>>2]=0}m=f-j|0;i=h;return m|0}}c[(bb()|0)>>2]=84;if((b|0)==0){m=-1;i=h;return m|0}c[e>>2]=k;m=-1;i=h;return m|0}function Wm(b,d){b=b|0;d=d|0;var e=0;e=i;if((b|0)==0){b=1;i=e;return b|0}if(d>>>0<128){a[b>>0]=d;b=1;i=e;return b|0}if(d>>>0<2048){a[b>>0]=d>>>6|192;a[b+1>>0]=d&63|128;b=2;i=e;return b|0}if(d>>>0<55296|(d+ -57344|0)>>>0<8192){a[b>>0]=d>>>12|224;a[b+1>>0]=d>>>6&63|128;a[b+2>>0]=d&63|128;b=3;i=e;return b|0}if((d+ -65536|0)>>>0<1048576){a[b>>0]=d>>>18|240;a[b+1>>0]=d>>>12&63|128;a[b+2>>0]=d>>>6&63|128;a[b+3>>0]=d&63|128;b=4;i=e;return b|0}else{c[(bb()|0)>>2]=84;b=-1;i=e;return b|0}return 0}function Xm(a){a=a|0;var b=0;b=i;Rb(a|0);if((a|0)!=0){vn(a)}i=b;return}function Ym(a){a=a|0;var b=0;b=i;Rb(a|0);i=b;return}function Zm(a){a=a|0;return 21320}function _m(a){a=a|0;return}function $m(a){a=a|0;return}function an(a){a=a|0;return}function bn(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function cn(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function dn(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function en(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function fn(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function gn(a,b,c){a=a|0;b=b|0;c=c|0;return(a|0)==(b|0)|0}function hn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=i;i=i+64|0;f=e;if((a|0)==(b|0)){h=1;i=e;return h|0}if((b|0)==0){h=0;i=e;return h|0}b=nn(b,21488)|0;if((b|0)==0){h=0;i=e;return h|0}h=f+0|0;g=h+56|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(g|0));c[f>>2]=b;c[f+8>>2]=a;c[f+12>>2]=-1;c[f+48>>2]=1;zc[c[(c[b>>2]|0)+28>>2]&31](b,f,c[d>>2]|0,1);if((c[f+24>>2]|0)!=1){h=0;i=e;return h|0}c[d>>2]=c[f+16>>2];h=1;i=e;return h|0}function jn(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=i;if((c[d+8>>2]|0)!=(b|0)){i=g;return}b=d+16|0;h=c[b>>2]|0;if((h|0)==0){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;i=g;return}if((h|0)!=(e|0)){h=d+36|0;c[h>>2]=(c[h>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;i=g;return}e=d+24|0;if((c[e>>2]|0)!=2){i=g;return}c[e>>2]=f;i=g;return}function kn(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=i;if((b|0)!=(c[d+8>>2]|0)){h=c[b+8>>2]|0;zc[c[(c[h>>2]|0)+28>>2]&31](h,d,e,f);i=g;return}b=d+16|0;h=c[b>>2]|0;if((h|0)==0){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;i=g;return}if((h|0)!=(e|0)){h=d+36|0;c[h>>2]=(c[h>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;i=g;return}e=d+24|0;if((c[e>>2]|0)!=2){i=g;return}c[e>>2]=f;i=g;return}function ln(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;g=i;if((b|0)==(c[d+8>>2]|0)){b=d+16|0;h=c[b>>2]|0;if((h|0)==0){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;i=g;return}if((h|0)!=(e|0)){l=d+36|0;c[l>>2]=(c[l>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;i=g;return}e=d+24|0;if((c[e>>2]|0)!=2){i=g;return}c[e>>2]=f;i=g;return}j=c[b+12>>2]|0;h=b+(j<<3)+16|0;k=c[b+20>>2]|0;l=k>>8;if((k&1|0)!=0){l=c[(c[e>>2]|0)+l>>2]|0}m=c[b+16>>2]|0;zc[c[(c[m>>2]|0)+28>>2]&31](m,d,e+l|0,(k&2|0)!=0?f:2);if((j|0)<=1){i=g;return}j=d+54|0;k=b+24|0;while(1){b=c[k+4>>2]|0;l=b>>8;if((b&1|0)!=0){l=c[(c[e>>2]|0)+l>>2]|0}m=c[k>>2]|0;zc[c[(c[m>>2]|0)+28>>2]&31](m,d,e+l|0,(b&2|0)!=0?f:2);if((a[j>>0]|0)!=0){f=16;break}k=k+8|0;if(!(k>>>0<h>>>0)){f=16;break}}if((f|0)==16){i=g;return}}function mn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;e=i;i=i+64|0;h=e;c[d>>2]=c[c[d>>2]>>2];if(!((a|0)==(b|0)|(b|0)==21792)){if(((b|0)!=0?(k=nn(b,21600)|0,(k|0)!=0):0)?(c[k+8>>2]&~c[a+8>>2]|0)==0:0){b=c[a+12>>2]|0;k=k+12|0;if(!((b|0)==21776?1:(b|0)==(c[k>>2]|0))){if((((b|0)!=0?(g=nn(b,21488)|0,(g|0)!=0):0)?(j=c[k>>2]|0,(j|0)!=0):0)?(f=nn(j,21488)|0,(f|0)!=0):0){k=h+0|0;j=k+56|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(j|0));c[h>>2]=f;c[h+8>>2]=g;c[h+12>>2]=-1;c[h+48>>2]=1;zc[c[(c[f>>2]|0)+28>>2]&31](f,h,c[d>>2]|0,1);if((c[h+24>>2]|0)==1){c[d>>2]=c[h+16>>2];d=1}else{d=0}}else{d=0}}else{d=1}}else{d=0}}else{d=1}i=e;return d|0}function nn(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;f=i;i=i+64|0;m=f;g=c[d>>2]|0;h=d+(c[g+ -8>>2]|0)|0;g=c[g+ -4>>2]|0;c[m>>2]=e;c[m+4>>2]=d;c[m+8>>2]=21432;p=m+12|0;n=m+16|0;o=m+20|0;j=m+24|0;d=m+28|0;k=m+32|0;l=m+40|0;r=(g|0)==(e|0);e=p+0|0;q=e+40|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(q|0));b[p+40>>1]=0;a[p+42>>0]=0;do{if(r){c[m+48>>2]=1;wc[c[(c[g>>2]|0)+20>>2]&63](g,m,h,h,1,0);d=(c[j>>2]|0)==1?h:0}else{jc[c[(c[g>>2]|0)+24>>2]&31](g,m,h,1,0);g=c[m+36>>2]|0;if((g|0)==0){if((c[l>>2]|0)!=1){d=0;break}if((c[d>>2]|0)!=1){d=0;break}d=(c[k>>2]|0)==1?c[o>>2]|0:0;break}else if((g|0)!=1){d=0;break}if((c[j>>2]|0)!=1){if((c[l>>2]|0)!=0){d=0;break}if((c[d>>2]|0)!=1){d=0;break}if((c[k>>2]|0)!=1){d=0;break}}d=c[n>>2]|0}}while(0);i=f;return d|0}function on(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;h=i;if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)!=(e|0)){i=h;return}e=d+28|0;if((c[e>>2]|0)==1){i=h;return}c[e>>2]=f;i=h;return}if((b|0)==(c[d>>2]|0)){if((c[d+16>>2]|0)!=(e|0)?(l=d+20|0,(c[l>>2]|0)!=(e|0)):0){c[d+32>>2]=f;k=d+44|0;if((c[k>>2]|0)==4){i=h;return}w=c[b+12>>2]|0;p=b+(w<<3)+16|0;a:do{if((w|0)>0){n=d+52|0;q=d+53|0;o=d+54|0;t=b+8|0;r=d+24|0;u=0;s=0;b=b+16|0;b:do{a[n>>0]=0;a[q>>0]=0;v=c[b+4>>2]|0;w=v>>8;if((v&1|0)!=0){w=c[(c[e>>2]|0)+w>>2]|0}x=c[b>>2]|0;wc[c[(c[x>>2]|0)+20>>2]&63](x,d,e,e+w|0,2-(v>>>1&1)|0,g);if((a[o>>0]|0)!=0){break}do{if((a[q>>0]|0)!=0){if((a[n>>0]|0)==0){if((c[t>>2]&1|0)==0){s=1;break b}else{s=1;break}}if((c[r>>2]|0)==1){b=27;break a}if((c[t>>2]&2|0)==0){b=27;break a}else{u=1;s=1}}}while(0);b=b+8|0}while(b>>>0<p>>>0);if(u){j=s;b=26}else{m=s;b=23}}else{m=0;b=23}}while(0);if((b|0)==23){c[l>>2]=e;x=d+40|0;c[x>>2]=(c[x>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0){a[d+54>>0]=1;if(m){b=27}else{b=28}}else{j=m;b=26}}if((b|0)==26){if(j){b=27}else{b=28}}if((b|0)==27){c[k>>2]=3;i=h;return}else if((b|0)==28){c[k>>2]=4;i=h;return}}if((f|0)!=1){i=h;return}c[d+32>>2]=1;i=h;return}m=c[b+12>>2]|0;j=b+(m<<3)+16|0;l=c[b+20>>2]|0;n=l>>8;if((l&1|0)!=0){n=c[(c[e>>2]|0)+n>>2]|0}x=c[b+16>>2]|0;jc[c[(c[x>>2]|0)+24>>2]&31](x,d,e+n|0,(l&2|0)!=0?f:2,g);l=b+24|0;if((m|0)<=1){i=h;return}m=c[b+8>>2]|0;if((m&2|0)==0?(k=d+36|0,(c[k>>2]|0)!=1):0){if((m&1|0)==0){m=d+54|0;b=l;while(1){if((a[m>>0]|0)!=0){b=53;break}if((c[k>>2]|0)==1){b=53;break}n=c[b+4>>2]|0;o=n>>8;if((n&1|0)!=0){o=c[(c[e>>2]|0)+o>>2]|0}x=c[b>>2]|0;jc[c[(c[x>>2]|0)+24>>2]&31](x,d,e+o|0,(n&2|0)!=0?f:2,g);b=b+8|0;if(!(b>>>0<j>>>0)){b=53;break}}if((b|0)==53){i=h;return}}n=d+24|0;o=d+54|0;b=l;while(1){if((a[o>>0]|0)!=0){b=53;break}if((c[k>>2]|0)==1?(c[n>>2]|0)==1:0){b=53;break}m=c[b+4>>2]|0;p=m>>8;if((m&1|0)!=0){p=c[(c[e>>2]|0)+p>>2]|0}x=c[b>>2]|0;jc[c[(c[x>>2]|0)+24>>2]&31](x,d,e+p|0,(m&2|0)!=0?f:2,g);b=b+8|0;if(!(b>>>0<j>>>0)){b=53;break}}if((b|0)==53){i=h;return}}k=d+54|0;while(1){if((a[k>>0]|0)!=0){b=53;break}m=c[l+4>>2]|0;b=m>>8;if((m&1|0)!=0){b=c[(c[e>>2]|0)+b>>2]|0}x=c[l>>2]|0;jc[c[(c[x>>2]|0)+24>>2]&31](x,d,e+b|0,(m&2|0)!=0?f:2,g);l=l+8|0;if(!(l>>>0<j>>>0)){b=53;break}}if((b|0)==53){i=h;return}}function pn(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)!=(e|0)){i=h;return}j=d+28|0;if((c[j>>2]|0)==1){i=h;return}c[j>>2]=f;i=h;return}if((b|0)!=(c[d>>2]|0)){l=c[b+8>>2]|0;jc[c[(c[l>>2]|0)+24>>2]&31](l,d,e,f,g);i=h;return}if((c[d+16>>2]|0)!=(e|0)?(k=d+20|0,(c[k>>2]|0)!=(e|0)):0){c[d+32>>2]=f;f=d+44|0;if((c[f>>2]|0)==4){i=h;return}l=d+52|0;a[l>>0]=0;m=d+53|0;a[m>>0]=0;b=c[b+8>>2]|0;wc[c[(c[b>>2]|0)+20>>2]&63](b,d,e,e,1,g);if((a[m>>0]|0)!=0){if((a[l>>0]|0)==0){b=1;j=13}}else{b=0;j=13}do{if((j|0)==13){c[k>>2]=e;m=d+40|0;c[m>>2]=(c[m>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0){a[d+54>>0]=1;if(b){break}}else{j=16}if((j|0)==16?b:0){break}c[f>>2]=4;i=h;return}}while(0);c[f>>2]=3;i=h;return}if((f|0)!=1){i=h;return}c[d+32>>2]=1;i=h;return}function qn(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0;g=i;if((c[d+8>>2]|0)==(b|0)){if((c[d+4>>2]|0)!=(e|0)){i=g;return}d=d+28|0;if((c[d>>2]|0)==1){i=g;return}c[d>>2]=f;i=g;return}if((c[d>>2]|0)!=(b|0)){i=g;return}if((c[d+16>>2]|0)!=(e|0)?(h=d+20|0,(c[h>>2]|0)!=(e|0)):0){c[d+32>>2]=f;c[h>>2]=e;b=d+40|0;c[b>>2]=(c[b>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0){a[d+54>>0]=1}c[d+44>>2]=4;i=g;return}if((f|0)!=1){i=g;return}c[d+32>>2]=1;i=g;return}function rn(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;j=i;if((b|0)!=(c[d+8>>2]|0)){m=d+52|0;l=a[m>>0]|0;o=d+53|0;n=a[o>>0]|0;q=c[b+12>>2]|0;k=b+(q<<3)+16|0;a[m>>0]=0;a[o>>0]=0;p=c[b+20>>2]|0;r=p>>8;if((p&1|0)!=0){r=c[(c[f>>2]|0)+r>>2]|0}t=c[b+16>>2]|0;wc[c[(c[t>>2]|0)+20>>2]&63](t,d,e,f+r|0,(p&2|0)!=0?g:2,h);a:do{if((q|0)>1){q=d+24|0;p=b+8|0;r=d+54|0;b=b+24|0;do{if((a[r>>0]|0)!=0){break a}if((a[m>>0]|0)==0){if((a[o>>0]|0)!=0?(c[p>>2]&1|0)==0:0){break a}}else{if((c[q>>2]|0)==1){break a}if((c[p>>2]&2|0)==0){break a}}a[m>>0]=0;a[o>>0]=0;s=c[b+4>>2]|0;t=s>>8;if((s&1|0)!=0){t=c[(c[f>>2]|0)+t>>2]|0}u=c[b>>2]|0;wc[c[(c[u>>2]|0)+20>>2]&63](u,d,e,f+t|0,(s&2|0)!=0?g:2,h);b=b+8|0}while(b>>>0<k>>>0)}}while(0);a[m>>0]=l;a[o>>0]=n;i=j;return}a[d+53>>0]=1;if((c[d+4>>2]|0)!=(f|0)){i=j;return}a[d+52>>0]=1;k=d+16|0;f=c[k>>2]|0;if((f|0)==0){c[k>>2]=e;c[d+24>>2]=g;c[d+36>>2]=1;if(!((g|0)==1?(c[d+48>>2]|0)==1:0)){i=j;return}a[d+54>>0]=1;i=j;return}if((f|0)!=(e|0)){u=d+36|0;c[u>>2]=(c[u>>2]|0)+1;a[d+54>>0]=1;i=j;return}e=d+24|0;k=c[e>>2]|0;if((k|0)==2){c[e>>2]=g}else{g=k}if(!((g|0)==1?(c[d+48>>2]|0)==1:0)){i=j;return}a[d+54>>0]=1;i=j;return}function sn(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0;j=i;if((b|0)!=(c[d+8>>2]|0)){b=c[b+8>>2]|0;wc[c[(c[b>>2]|0)+20>>2]&63](b,d,e,f,g,h);i=j;return}a[d+53>>0]=1;if((c[d+4>>2]|0)!=(f|0)){i=j;return}a[d+52>>0]=1;b=d+16|0;f=c[b>>2]|0;if((f|0)==0){c[b>>2]=e;c[d+24>>2]=g;c[d+36>>2]=1;if(!((g|0)==1?(c[d+48>>2]|0)==1:0)){i=j;return}a[d+54>>0]=1;i=j;return}if((f|0)!=(e|0)){h=d+36|0;c[h>>2]=(c[h>>2]|0)+1;a[d+54>>0]=1;i=j;return}e=d+24|0;b=c[e>>2]|0;if((b|0)==2){c[e>>2]=g}else{g=b}if(!((g|0)==1?(c[d+48>>2]|0)==1:0)){i=j;return}a[d+54>>0]=1;i=j;return}function tn(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;h=i;if((c[d+8>>2]|0)!=(b|0)){i=h;return}a[d+53>>0]=1;if((c[d+4>>2]|0)!=(f|0)){i=h;return}a[d+52>>0]=1;f=d+16|0;b=c[f>>2]|0;if((b|0)==0){c[f>>2]=e;c[d+24>>2]=g;c[d+36>>2]=1;if(!((g|0)==1?(c[d+48>>2]|0)==1:0)){i=h;return}a[d+54>>0]=1;i=h;return}if((b|0)!=(e|0)){b=d+36|0;c[b>>2]=(c[b>>2]|0)+1;a[d+54>>0]=1;i=h;return}e=d+24|0;f=c[e>>2]|0;if((f|0)==2){c[e>>2]=g}else{g=f}if(!((g|0)==1?(c[d+48>>2]|0)==1:0)){i=h;return}a[d+54>>0]=1;i=h;return}function un(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;b=i;do{if(a>>>0<245){if(a>>>0<11){a=16}else{a=a+11&-8}v=a>>>3;p=c[5542]|0;w=p>>>v;if((w&3|0)!=0){h=(w&1^1)+v|0;g=h<<1;e=22208+(g<<2)|0;g=22208+(g+2<<2)|0;j=c[g>>2]|0;d=j+8|0;f=c[d>>2]|0;do{if((e|0)!=(f|0)){if(f>>>0<(c[22184>>2]|0)>>>0){Xb()}k=f+12|0;if((c[k>>2]|0)==(j|0)){c[k>>2]=e;c[g>>2]=f;break}else{Xb()}}else{c[5542]=p&~(1<<h)}}while(0);H=h<<3;c[j+4>>2]=H|3;H=j+(H|4)|0;c[H>>2]=c[H>>2]|1;H=d;i=b;return H|0}if(a>>>0>(c[22176>>2]|0)>>>0){if((w|0)!=0){h=2<<v;h=w<<v&(h|0-h);h=(h&0-h)+ -1|0;d=h>>>12&16;h=h>>>d;f=h>>>5&8;h=h>>>f;g=h>>>2&4;h=h>>>g;e=h>>>1&2;h=h>>>e;j=h>>>1&1;j=(f|d|g|e|j)+(h>>>j)|0;h=j<<1;e=22208+(h<<2)|0;h=22208+(h+2<<2)|0;g=c[h>>2]|0;d=g+8|0;f=c[d>>2]|0;do{if((e|0)!=(f|0)){if(f>>>0<(c[22184>>2]|0)>>>0){Xb()}k=f+12|0;if((c[k>>2]|0)==(g|0)){c[k>>2]=e;c[h>>2]=f;break}else{Xb()}}else{c[5542]=p&~(1<<j)}}while(0);h=j<<3;f=h-a|0;c[g+4>>2]=a|3;e=g+a|0;c[g+(a|4)>>2]=f|1;c[g+h>>2]=f;h=c[22176>>2]|0;if((h|0)!=0){g=c[22188>>2]|0;k=h>>>3;j=k<<1;h=22208+(j<<2)|0;l=c[5542]|0;k=1<<k;if((l&k|0)!=0){j=22208+(j+2<<2)|0;k=c[j>>2]|0;if(k>>>0<(c[22184>>2]|0)>>>0){Xb()}else{D=j;C=k}}else{c[5542]=l|k;D=22208+(j+2<<2)|0;C=h}c[D>>2]=g;c[C+12>>2]=g;c[g+8>>2]=C;c[g+12>>2]=h}c[22176>>2]=f;c[22188>>2]=e;H=d;i=b;return H|0}p=c[22172>>2]|0;if((p|0)!=0){e=(p&0-p)+ -1|0;G=e>>>12&16;e=e>>>G;F=e>>>5&8;e=e>>>F;H=e>>>2&4;e=e>>>H;f=e>>>1&2;e=e>>>f;d=e>>>1&1;d=c[22472+((F|G|H|f|d)+(e>>>d)<<2)>>2]|0;e=(c[d+4>>2]&-8)-a|0;f=d;while(1){g=c[f+16>>2]|0;if((g|0)==0){g=c[f+20>>2]|0;if((g|0)==0){break}}f=(c[g+4>>2]&-8)-a|0;H=f>>>0<e>>>0;e=H?f:e;f=g;d=H?g:d}h=c[22184>>2]|0;if(d>>>0<h>>>0){Xb()}f=d+a|0;if(!(d>>>0<f>>>0)){Xb()}g=c[d+24>>2]|0;k=c[d+12>>2]|0;do{if((k|0)==(d|0)){k=d+20|0;j=c[k>>2]|0;if((j|0)==0){k=d+16|0;j=c[k>>2]|0;if((j|0)==0){B=0;break}}while(1){l=j+20|0;m=c[l>>2]|0;if((m|0)!=0){j=m;k=l;continue}m=j+16|0;l=c[m>>2]|0;if((l|0)==0){break}else{j=l;k=m}}if(k>>>0<h>>>0){Xb()}else{c[k>>2]=0;B=j;break}}else{j=c[d+8>>2]|0;if(j>>>0<h>>>0){Xb()}h=j+12|0;if((c[h>>2]|0)!=(d|0)){Xb()}l=k+8|0;if((c[l>>2]|0)==(d|0)){c[h>>2]=k;c[l>>2]=j;B=k;break}else{Xb()}}}while(0);do{if((g|0)!=0){h=c[d+28>>2]|0;j=22472+(h<<2)|0;if((d|0)==(c[j>>2]|0)){c[j>>2]=B;if((B|0)==0){c[22172>>2]=c[22172>>2]&~(1<<h);break}}else{if(g>>>0<(c[22184>>2]|0)>>>0){Xb()}h=g+16|0;if((c[h>>2]|0)==(d|0)){c[h>>2]=B}else{c[g+20>>2]=B}if((B|0)==0){break}}if(B>>>0<(c[22184>>2]|0)>>>0){Xb()}c[B+24>>2]=g;g=c[d+16>>2]|0;do{if((g|0)!=0){if(g>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[B+16>>2]=g;c[g+24>>2]=B;break}}}while(0);g=c[d+20>>2]|0;if((g|0)!=0){if(g>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[B+20>>2]=g;c[g+24>>2]=B;break}}}}while(0);if(e>>>0<16){H=e+a|0;c[d+4>>2]=H|3;H=d+(H+4)|0;c[H>>2]=c[H>>2]|1}else{c[d+4>>2]=a|3;c[d+(a|4)>>2]=e|1;c[d+(e+a)>>2]=e;h=c[22176>>2]|0;if((h|0)!=0){g=c[22188>>2]|0;l=h>>>3;j=l<<1;h=22208+(j<<2)|0;k=c[5542]|0;l=1<<l;if((k&l|0)!=0){j=22208+(j+2<<2)|0;k=c[j>>2]|0;if(k>>>0<(c[22184>>2]|0)>>>0){Xb()}else{A=j;z=k}}else{c[5542]=k|l;A=22208+(j+2<<2)|0;z=h}c[A>>2]=g;c[z+12>>2]=g;c[g+8>>2]=z;c[g+12>>2]=h}c[22176>>2]=e;c[22188>>2]=f}H=d+8|0;i=b;return H|0}}}else{if(!(a>>>0>4294967231)){z=a+11|0;a=z&-8;B=c[22172>>2]|0;if((B|0)!=0){A=0-a|0;z=z>>>8;if((z|0)!=0){if(a>>>0>16777215){C=31}else{G=(z+1048320|0)>>>16&8;H=z<<G;F=(H+520192|0)>>>16&4;H=H<<F;C=(H+245760|0)>>>16&2;C=14-(F|G|C)+(H<<C>>>15)|0;C=a>>>(C+7|0)&1|C<<1}}else{C=0}D=c[22472+(C<<2)>>2]|0;a:do{if((D|0)==0){F=0;z=0}else{if((C|0)==31){z=0}else{z=25-(C>>>1)|0}F=0;E=a<<z;z=0;while(1){H=c[D+4>>2]&-8;G=H-a|0;if(G>>>0<A>>>0){if((H|0)==(a|0)){A=G;F=D;z=D;break a}else{A=G;z=D}}H=c[D+20>>2]|0;D=c[D+(E>>>31<<2)+16>>2]|0;F=(H|0)==0|(H|0)==(D|0)?F:H;if((D|0)==0){break}else{E=E<<1}}}}while(0);if((F|0)==0&(z|0)==0){H=2<<C;B=B&(H|0-H);if((B|0)==0){break}H=(B&0-B)+ -1|0;D=H>>>12&16;H=H>>>D;C=H>>>5&8;H=H>>>C;E=H>>>2&4;H=H>>>E;G=H>>>1&2;H=H>>>G;F=H>>>1&1;F=c[22472+((C|D|E|G|F)+(H>>>F)<<2)>>2]|0}if((F|0)!=0){while(1){H=(c[F+4>>2]&-8)-a|0;B=H>>>0<A>>>0;A=B?H:A;z=B?F:z;B=c[F+16>>2]|0;if((B|0)!=0){F=B;continue}F=c[F+20>>2]|0;if((F|0)==0){break}}}if((z|0)!=0?A>>>0<((c[22176>>2]|0)-a|0)>>>0:0){f=c[22184>>2]|0;if(z>>>0<f>>>0){Xb()}d=z+a|0;if(!(z>>>0<d>>>0)){Xb()}e=c[z+24>>2]|0;h=c[z+12>>2]|0;do{if((h|0)==(z|0)){h=z+20|0;g=c[h>>2]|0;if((g|0)==0){h=z+16|0;g=c[h>>2]|0;if((g|0)==0){x=0;break}}while(1){j=g+20|0;k=c[j>>2]|0;if((k|0)!=0){g=k;h=j;continue}j=g+16|0;k=c[j>>2]|0;if((k|0)==0){break}else{g=k;h=j}}if(h>>>0<f>>>0){Xb()}else{c[h>>2]=0;x=g;break}}else{g=c[z+8>>2]|0;if(g>>>0<f>>>0){Xb()}f=g+12|0;if((c[f>>2]|0)!=(z|0)){Xb()}j=h+8|0;if((c[j>>2]|0)==(z|0)){c[f>>2]=h;c[j>>2]=g;x=h;break}else{Xb()}}}while(0);do{if((e|0)!=0){g=c[z+28>>2]|0;f=22472+(g<<2)|0;if((z|0)==(c[f>>2]|0)){c[f>>2]=x;if((x|0)==0){c[22172>>2]=c[22172>>2]&~(1<<g);break}}else{if(e>>>0<(c[22184>>2]|0)>>>0){Xb()}f=e+16|0;if((c[f>>2]|0)==(z|0)){c[f>>2]=x}else{c[e+20>>2]=x}if((x|0)==0){break}}if(x>>>0<(c[22184>>2]|0)>>>0){Xb()}c[x+24>>2]=e;e=c[z+16>>2]|0;do{if((e|0)!=0){if(e>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[x+16>>2]=e;c[e+24>>2]=x;break}}}while(0);e=c[z+20>>2]|0;if((e|0)!=0){if(e>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[x+20>>2]=e;c[e+24>>2]=x;break}}}}while(0);b:do{if(!(A>>>0<16)){c[z+4>>2]=a|3;c[z+(a|4)>>2]=A|1;c[z+(A+a)>>2]=A;f=A>>>3;if(A>>>0<256){h=f<<1;e=22208+(h<<2)|0;g=c[5542]|0;f=1<<f;do{if((g&f|0)==0){c[5542]=g|f;w=22208+(h+2<<2)|0;v=e}else{f=22208+(h+2<<2)|0;g=c[f>>2]|0;if(!(g>>>0<(c[22184>>2]|0)>>>0)){w=f;v=g;break}Xb()}}while(0);c[w>>2]=d;c[v+12>>2]=d;c[z+(a+8)>>2]=v;c[z+(a+12)>>2]=e;break}e=A>>>8;if((e|0)!=0){if(A>>>0>16777215){e=31}else{G=(e+1048320|0)>>>16&8;H=e<<G;F=(H+520192|0)>>>16&4;H=H<<F;e=(H+245760|0)>>>16&2;e=14-(F|G|e)+(H<<e>>>15)|0;e=A>>>(e+7|0)&1|e<<1}}else{e=0}f=22472+(e<<2)|0;c[z+(a+28)>>2]=e;c[z+(a+20)>>2]=0;c[z+(a+16)>>2]=0;h=c[22172>>2]|0;g=1<<e;if((h&g|0)==0){c[22172>>2]=h|g;c[f>>2]=d;c[z+(a+24)>>2]=f;c[z+(a+12)>>2]=d;c[z+(a+8)>>2]=d;break}f=c[f>>2]|0;if((e|0)==31){e=0}else{e=25-(e>>>1)|0}c:do{if((c[f+4>>2]&-8|0)!=(A|0)){e=A<<e;while(1){g=f+(e>>>31<<2)+16|0;h=c[g>>2]|0;if((h|0)==0){break}if((c[h+4>>2]&-8|0)==(A|0)){p=h;break c}else{e=e<<1;f=h}}if(g>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[g>>2]=d;c[z+(a+24)>>2]=f;c[z+(a+12)>>2]=d;c[z+(a+8)>>2]=d;break b}}else{p=f}}while(0);f=p+8|0;e=c[f>>2]|0;g=c[22184>>2]|0;if(p>>>0<g>>>0){Xb()}if(e>>>0<g>>>0){Xb()}else{c[e+12>>2]=d;c[f>>2]=d;c[z+(a+8)>>2]=e;c[z+(a+12)>>2]=p;c[z+(a+24)>>2]=0;break}}else{H=A+a|0;c[z+4>>2]=H|3;H=z+(H+4)|0;c[H>>2]=c[H>>2]|1}}while(0);H=z+8|0;i=b;return H|0}}}else{a=-1}}}while(0);p=c[22176>>2]|0;if(!(a>>>0>p>>>0)){e=p-a|0;d=c[22188>>2]|0;if(e>>>0>15){c[22188>>2]=d+a;c[22176>>2]=e;c[d+(a+4)>>2]=e|1;c[d+p>>2]=e;c[d+4>>2]=a|3}else{c[22176>>2]=0;c[22188>>2]=0;c[d+4>>2]=p|3;H=d+(p+4)|0;c[H>>2]=c[H>>2]|1}H=d+8|0;i=b;return H|0}p=c[22180>>2]|0;if(a>>>0<p>>>0){G=p-a|0;c[22180>>2]=G;H=c[22192>>2]|0;c[22192>>2]=H+a;c[H+(a+4)>>2]=G|1;c[H+4>>2]=a|3;H=H+8|0;i=b;return H|0}do{if((c[5660]|0)==0){p=sb(30)|0;if((p+ -1&p|0)==0){c[22648>>2]=p;c[22644>>2]=p;c[22652>>2]=-1;c[22656>>2]=-1;c[22660>>2]=0;c[22612>>2]=0;c[5660]=(_b(0)|0)&-16^1431655768;break}else{Xb()}}}while(0);w=a+48|0;p=c[22648>>2]|0;x=a+47|0;z=p+x|0;p=0-p|0;v=z&p;if(!(v>>>0>a>>>0)){H=0;i=b;return H|0}A=c[22608>>2]|0;if((A|0)!=0?(G=c[22600>>2]|0,H=G+v|0,H>>>0<=G>>>0|H>>>0>A>>>0):0){H=0;i=b;return H|0}d:do{if((c[22612>>2]&4|0)==0){B=c[22192>>2]|0;e:do{if((B|0)!=0){A=22616|0;while(1){C=c[A>>2]|0;if(!(C>>>0>B>>>0)?(y=A+4|0,(C+(c[y>>2]|0)|0)>>>0>B>>>0):0){break}A=c[A+8>>2]|0;if((A|0)==0){o=182;break e}}if((A|0)!=0){B=z-(c[22180>>2]|0)&p;if(B>>>0<2147483647){p=hb(B|0)|0;A=(p|0)==((c[A>>2]|0)+(c[y>>2]|0)|0);y=p;z=B;p=A?p:-1;A=A?B:0;o=191}else{A=0}}else{o=182}}else{o=182}}while(0);do{if((o|0)==182){p=hb(0)|0;if((p|0)!=(-1|0)){z=p;A=c[22644>>2]|0;y=A+ -1|0;if((y&z|0)==0){A=v}else{A=v-z+(y+z&0-A)|0}y=c[22600>>2]|0;z=y+A|0;if(A>>>0>a>>>0&A>>>0<2147483647){H=c[22608>>2]|0;if((H|0)!=0?z>>>0<=y>>>0|z>>>0>H>>>0:0){A=0;break}y=hb(A|0)|0;o=(y|0)==(p|0);z=A;p=o?p:-1;A=o?A:0;o=191}else{A=0}}else{A=0}}}while(0);f:do{if((o|0)==191){o=0-z|0;if((p|0)!=(-1|0)){q=A;o=202;break d}do{if((y|0)!=(-1|0)&z>>>0<2147483647&z>>>0<w>>>0?(u=c[22648>>2]|0,u=x-z+u&0-u,u>>>0<2147483647):0){if((hb(u|0)|0)==(-1|0)){hb(o|0)|0;break f}else{z=u+z|0;break}}}while(0);if((y|0)!=(-1|0)){p=y;q=z;o=202;break d}}}while(0);c[22612>>2]=c[22612>>2]|4;o=199}else{A=0;o=199}}while(0);if((((o|0)==199?v>>>0<2147483647:0)?(t=hb(v|0)|0,s=hb(0)|0,(s|0)!=(-1|0)&(t|0)!=(-1|0)&t>>>0<s>>>0):0)?(r=s-t|0,q=r>>>0>(a+40|0)>>>0,q):0){p=t;q=q?r:A;o=202}if((o|0)==202){r=(c[22600>>2]|0)+q|0;c[22600>>2]=r;if(r>>>0>(c[22604>>2]|0)>>>0){c[22604>>2]=r}r=c[22192>>2]|0;g:do{if((r|0)!=0){v=22616|0;while(1){t=c[v>>2]|0;u=v+4|0;s=c[u>>2]|0;if((p|0)==(t+s|0)){o=214;break}w=c[v+8>>2]|0;if((w|0)==0){break}else{v=w}}if(((o|0)==214?(c[v+12>>2]&8|0)==0:0)?r>>>0>=t>>>0&r>>>0<p>>>0:0){c[u>>2]=s+q;d=(c[22180>>2]|0)+q|0;e=r+8|0;if((e&7|0)==0){e=0}else{e=0-e&7}H=d-e|0;c[22192>>2]=r+e;c[22180>>2]=H;c[r+(e+4)>>2]=H|1;c[r+(d+4)>>2]=40;c[22196>>2]=c[22656>>2];break}if(p>>>0<(c[22184>>2]|0)>>>0){c[22184>>2]=p}t=p+q|0;s=22616|0;while(1){if((c[s>>2]|0)==(t|0)){o=224;break}u=c[s+8>>2]|0;if((u|0)==0){break}else{s=u}}if((o|0)==224?(c[s+12>>2]&8|0)==0:0){c[s>>2]=p;h=s+4|0;c[h>>2]=(c[h>>2]|0)+q;h=p+8|0;if((h&7|0)==0){h=0}else{h=0-h&7}j=p+(q+8)|0;if((j&7|0)==0){n=0}else{n=0-j&7}o=p+(n+q)|0;j=h+a|0;k=p+j|0;m=o-(p+h)-a|0;c[p+(h+4)>>2]=a|3;h:do{if((o|0)!=(c[22192>>2]|0)){if((o|0)==(c[22188>>2]|0)){H=(c[22176>>2]|0)+m|0;c[22176>>2]=H;c[22188>>2]=k;c[p+(j+4)>>2]=H|1;c[p+(H+j)>>2]=H;break}r=q+4|0;t=c[p+(r+n)>>2]|0;if((t&3|0)==1){a=t&-8;s=t>>>3;i:do{if(!(t>>>0<256)){l=c[p+((n|24)+q)>>2]|0;u=c[p+(q+12+n)>>2]|0;do{if((u|0)==(o|0)){u=n|16;t=p+(r+u)|0;s=c[t>>2]|0;if((s|0)==0){t=p+(u+q)|0;s=c[t>>2]|0;if((s|0)==0){g=0;break}}while(1){u=s+20|0;v=c[u>>2]|0;if((v|0)!=0){s=v;t=u;continue}u=s+16|0;v=c[u>>2]|0;if((v|0)==0){break}else{s=v;t=u}}if(t>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[t>>2]=0;g=s;break}}else{t=c[p+((n|8)+q)>>2]|0;if(t>>>0<(c[22184>>2]|0)>>>0){Xb()}v=t+12|0;if((c[v>>2]|0)!=(o|0)){Xb()}s=u+8|0;if((c[s>>2]|0)==(o|0)){c[v>>2]=u;c[s>>2]=t;g=u;break}else{Xb()}}}while(0);if((l|0)==0){break}t=c[p+(q+28+n)>>2]|0;s=22472+(t<<2)|0;do{if((o|0)!=(c[s>>2]|0)){if(l>>>0<(c[22184>>2]|0)>>>0){Xb()}s=l+16|0;if((c[s>>2]|0)==(o|0)){c[s>>2]=g}else{c[l+20>>2]=g}if((g|0)==0){break i}}else{c[s>>2]=g;if((g|0)!=0){break}c[22172>>2]=c[22172>>2]&~(1<<t);break i}}while(0);if(g>>>0<(c[22184>>2]|0)>>>0){Xb()}c[g+24>>2]=l;l=n|16;o=c[p+(l+q)>>2]|0;do{if((o|0)!=0){if(o>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[g+16>>2]=o;c[o+24>>2]=g;break}}}while(0);l=c[p+(r+l)>>2]|0;if((l|0)==0){break}if(l>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[g+20>>2]=l;c[l+24>>2]=g;break}}else{r=c[p+((n|8)+q)>>2]|0;g=c[p+(q+12+n)>>2]|0;t=22208+(s<<1<<2)|0;do{if((r|0)!=(t|0)){if(r>>>0<(c[22184>>2]|0)>>>0){Xb()}if((c[r+12>>2]|0)==(o|0)){break}Xb()}}while(0);if((g|0)==(r|0)){c[5542]=c[5542]&~(1<<s);break}do{if((g|0)==(t|0)){l=g+8|0}else{if(g>>>0<(c[22184>>2]|0)>>>0){Xb()}s=g+8|0;if((c[s>>2]|0)==(o|0)){l=s;break}Xb()}}while(0);c[r+12>>2]=g;c[l>>2]=r}}while(0);o=p+((a|n)+q)|0;m=a+m|0}g=o+4|0;c[g>>2]=c[g>>2]&-2;c[p+(j+4)>>2]=m|1;c[p+(m+j)>>2]=m;g=m>>>3;if(m>>>0<256){m=g<<1;d=22208+(m<<2)|0;l=c[5542]|0;g=1<<g;do{if((l&g|0)==0){c[5542]=l|g;f=22208+(m+2<<2)|0;e=d}else{l=22208+(m+2<<2)|0;g=c[l>>2]|0;if(!(g>>>0<(c[22184>>2]|0)>>>0)){f=l;e=g;break}Xb()}}while(0);c[f>>2]=k;c[e+12>>2]=k;c[p+(j+8)>>2]=e;c[p+(j+12)>>2]=d;break}e=m>>>8;do{if((e|0)==0){e=0}else{if(m>>>0>16777215){e=31;break}G=(e+1048320|0)>>>16&8;H=e<<G;F=(H+520192|0)>>>16&4;H=H<<F;e=(H+245760|0)>>>16&2;e=14-(F|G|e)+(H<<e>>>15)|0;e=m>>>(e+7|0)&1|e<<1}}while(0);l=22472+(e<<2)|0;c[p+(j+28)>>2]=e;c[p+(j+20)>>2]=0;c[p+(j+16)>>2]=0;f=c[22172>>2]|0;g=1<<e;if((f&g|0)==0){c[22172>>2]=f|g;c[l>>2]=k;c[p+(j+24)>>2]=l;c[p+(j+12)>>2]=k;c[p+(j+8)>>2]=k;break}l=c[l>>2]|0;if((e|0)==31){e=0}else{e=25-(e>>>1)|0}j:do{if((c[l+4>>2]&-8|0)!=(m|0)){e=m<<e;while(1){g=l+(e>>>31<<2)+16|0;f=c[g>>2]|0;if((f|0)==0){break}if((c[f+4>>2]&-8|0)==(m|0)){d=f;break j}else{e=e<<1;l=f}}if(g>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[g>>2]=k;c[p+(j+24)>>2]=l;c[p+(j+12)>>2]=k;c[p+(j+8)>>2]=k;break h}}else{d=l}}while(0);f=d+8|0;e=c[f>>2]|0;g=c[22184>>2]|0;if(d>>>0<g>>>0){Xb()}if(e>>>0<g>>>0){Xb()}else{c[e+12>>2]=k;c[f>>2]=k;c[p+(j+8)>>2]=e;c[p+(j+12)>>2]=d;c[p+(j+24)>>2]=0;break}}else{H=(c[22180>>2]|0)+m|0;c[22180>>2]=H;c[22192>>2]=k;c[p+(j+4)>>2]=H|1}}while(0);H=p+(h|8)|0;i=b;return H|0}e=22616|0;while(1){d=c[e>>2]|0;if(!(d>>>0>r>>>0)?(n=c[e+4>>2]|0,m=d+n|0,m>>>0>r>>>0):0){break}e=c[e+8>>2]|0}e=d+(n+ -39)|0;if((e&7|0)==0){e=0}else{e=0-e&7}d=d+(n+ -47+e)|0;d=d>>>0<(r+16|0)>>>0?r:d;e=d+8|0;f=p+8|0;if((f&7|0)==0){f=0}else{f=0-f&7}H=q+ -40-f|0;c[22192>>2]=p+f;c[22180>>2]=H;c[p+(f+4)>>2]=H|1;c[p+(q+ -36)>>2]=40;c[22196>>2]=c[22656>>2];c[d+4>>2]=27;c[e+0>>2]=c[22616>>2];c[e+4>>2]=c[22620>>2];c[e+8>>2]=c[22624>>2];c[e+12>>2]=c[22628>>2];c[22616>>2]=p;c[22620>>2]=q;c[22628>>2]=0;c[22624>>2]=e;e=d+28|0;c[e>>2]=7;if((d+32|0)>>>0<m>>>0){do{H=e;e=e+4|0;c[e>>2]=7}while((H+8|0)>>>0<m>>>0)}if((d|0)!=(r|0)){d=d-r|0;e=r+(d+4)|0;c[e>>2]=c[e>>2]&-2;c[r+4>>2]=d|1;c[r+d>>2]=d;e=d>>>3;if(d>>>0<256){g=e<<1;d=22208+(g<<2)|0;f=c[5542]|0;e=1<<e;do{if((f&e|0)==0){c[5542]=f|e;k=22208+(g+2<<2)|0;j=d}else{f=22208+(g+2<<2)|0;e=c[f>>2]|0;if(!(e>>>0<(c[22184>>2]|0)>>>0)){k=f;j=e;break}Xb()}}while(0);c[k>>2]=r;c[j+12>>2]=r;c[r+8>>2]=j;c[r+12>>2]=d;break}e=d>>>8;if((e|0)!=0){if(d>>>0>16777215){e=31}else{G=(e+1048320|0)>>>16&8;H=e<<G;F=(H+520192|0)>>>16&4;H=H<<F;e=(H+245760|0)>>>16&2;e=14-(F|G|e)+(H<<e>>>15)|0;e=d>>>(e+7|0)&1|e<<1}}else{e=0}j=22472+(e<<2)|0;c[r+28>>2]=e;c[r+20>>2]=0;c[r+16>>2]=0;f=c[22172>>2]|0;g=1<<e;if((f&g|0)==0){c[22172>>2]=f|g;c[j>>2]=r;c[r+24>>2]=j;c[r+12>>2]=r;c[r+8>>2]=r;break}f=c[j>>2]|0;if((e|0)==31){e=0}else{e=25-(e>>>1)|0}k:do{if((c[f+4>>2]&-8|0)!=(d|0)){e=d<<e;while(1){j=f+(e>>>31<<2)+16|0;g=c[j>>2]|0;if((g|0)==0){break}if((c[g+4>>2]&-8|0)==(d|0)){h=g;break k}else{e=e<<1;f=g}}if(j>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[j>>2]=r;c[r+24>>2]=f;c[r+12>>2]=r;c[r+8>>2]=r;break g}}else{h=f}}while(0);f=h+8|0;e=c[f>>2]|0;d=c[22184>>2]|0;if(h>>>0<d>>>0){Xb()}if(e>>>0<d>>>0){Xb()}else{c[e+12>>2]=r;c[f>>2]=r;c[r+8>>2]=e;c[r+12>>2]=h;c[r+24>>2]=0;break}}}else{H=c[22184>>2]|0;if((H|0)==0|p>>>0<H>>>0){c[22184>>2]=p}c[22616>>2]=p;c[22620>>2]=q;c[22628>>2]=0;c[22204>>2]=c[5660];c[22200>>2]=-1;d=0;do{H=d<<1;G=22208+(H<<2)|0;c[22208+(H+3<<2)>>2]=G;c[22208+(H+2<<2)>>2]=G;d=d+1|0}while((d|0)!=32);d=p+8|0;if((d&7|0)==0){d=0}else{d=0-d&7}H=q+ -40-d|0;c[22192>>2]=p+d;c[22180>>2]=H;c[p+(d+4)>>2]=H|1;c[p+(q+ -36)>>2]=40;c[22196>>2]=c[22656>>2]}}while(0);d=c[22180>>2]|0;if(d>>>0>a>>>0){G=d-a|0;c[22180>>2]=G;H=c[22192>>2]|0;c[22192>>2]=H+a;c[H+(a+4)>>2]=G|1;c[H+4>>2]=a|3;H=H+8|0;i=b;return H|0}}c[(bb()|0)>>2]=12;H=0;i=b;return H|0}function vn(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;b=i;if((a|0)==0){i=b;return}q=a+ -8|0;r=c[22184>>2]|0;if(q>>>0<r>>>0){Xb()}o=c[a+ -4>>2]|0;n=o&3;if((n|0)==1){Xb()}j=o&-8;h=a+(j+ -8)|0;do{if((o&1|0)==0){u=c[q>>2]|0;if((n|0)==0){i=b;return}q=-8-u|0;o=a+q|0;n=u+j|0;if(o>>>0<r>>>0){Xb()}if((o|0)==(c[22188>>2]|0)){d=a+(j+ -4)|0;if((c[d>>2]&3|0)!=3){d=o;m=n;break}c[22176>>2]=n;c[d>>2]=c[d>>2]&-2;c[a+(q+4)>>2]=n|1;c[h>>2]=n;i=b;return}t=u>>>3;if(u>>>0<256){d=c[a+(q+8)>>2]|0;m=c[a+(q+12)>>2]|0;p=22208+(t<<1<<2)|0;if((d|0)!=(p|0)){if(d>>>0<r>>>0){Xb()}if((c[d+12>>2]|0)!=(o|0)){Xb()}}if((m|0)==(d|0)){c[5542]=c[5542]&~(1<<t);d=o;m=n;break}if((m|0)!=(p|0)){if(m>>>0<r>>>0){Xb()}p=m+8|0;if((c[p>>2]|0)==(o|0)){s=p}else{Xb()}}else{s=m+8|0}c[d+12>>2]=m;c[s>>2]=d;d=o;m=n;break}s=c[a+(q+24)>>2]|0;t=c[a+(q+12)>>2]|0;do{if((t|0)==(o|0)){u=a+(q+20)|0;t=c[u>>2]|0;if((t|0)==0){u=a+(q+16)|0;t=c[u>>2]|0;if((t|0)==0){p=0;break}}while(1){w=t+20|0;v=c[w>>2]|0;if((v|0)!=0){t=v;u=w;continue}v=t+16|0;w=c[v>>2]|0;if((w|0)==0){break}else{t=w;u=v}}if(u>>>0<r>>>0){Xb()}else{c[u>>2]=0;p=t;break}}else{u=c[a+(q+8)>>2]|0;if(u>>>0<r>>>0){Xb()}r=u+12|0;if((c[r>>2]|0)!=(o|0)){Xb()}v=t+8|0;if((c[v>>2]|0)==(o|0)){c[r>>2]=t;c[v>>2]=u;p=t;break}else{Xb()}}}while(0);if((s|0)!=0){t=c[a+(q+28)>>2]|0;r=22472+(t<<2)|0;if((o|0)==(c[r>>2]|0)){c[r>>2]=p;if((p|0)==0){c[22172>>2]=c[22172>>2]&~(1<<t);d=o;m=n;break}}else{if(s>>>0<(c[22184>>2]|0)>>>0){Xb()}r=s+16|0;if((c[r>>2]|0)==(o|0)){c[r>>2]=p}else{c[s+20>>2]=p}if((p|0)==0){d=o;m=n;break}}if(p>>>0<(c[22184>>2]|0)>>>0){Xb()}c[p+24>>2]=s;r=c[a+(q+16)>>2]|0;do{if((r|0)!=0){if(r>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[p+16>>2]=r;c[r+24>>2]=p;break}}}while(0);q=c[a+(q+20)>>2]|0;if((q|0)!=0){if(q>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[p+20>>2]=q;c[q+24>>2]=p;d=o;m=n;break}}else{d=o;m=n}}else{d=o;m=n}}else{d=q;m=j}}while(0);if(!(d>>>0<h>>>0)){Xb()}n=a+(j+ -4)|0;o=c[n>>2]|0;if((o&1|0)==0){Xb()}if((o&2|0)==0){if((h|0)==(c[22192>>2]|0)){w=(c[22180>>2]|0)+m|0;c[22180>>2]=w;c[22192>>2]=d;c[d+4>>2]=w|1;if((d|0)!=(c[22188>>2]|0)){i=b;return}c[22188>>2]=0;c[22176>>2]=0;i=b;return}if((h|0)==(c[22188>>2]|0)){w=(c[22176>>2]|0)+m|0;c[22176>>2]=w;c[22188>>2]=d;c[d+4>>2]=w|1;c[d+w>>2]=w;i=b;return}m=(o&-8)+m|0;n=o>>>3;do{if(!(o>>>0<256)){l=c[a+(j+16)>>2]|0;q=c[a+(j|4)>>2]|0;do{if((q|0)==(h|0)){o=a+(j+12)|0;n=c[o>>2]|0;if((n|0)==0){o=a+(j+8)|0;n=c[o>>2]|0;if((n|0)==0){k=0;break}}while(1){p=n+20|0;q=c[p>>2]|0;if((q|0)!=0){n=q;o=p;continue}p=n+16|0;q=c[p>>2]|0;if((q|0)==0){break}else{n=q;o=p}}if(o>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[o>>2]=0;k=n;break}}else{o=c[a+j>>2]|0;if(o>>>0<(c[22184>>2]|0)>>>0){Xb()}p=o+12|0;if((c[p>>2]|0)!=(h|0)){Xb()}n=q+8|0;if((c[n>>2]|0)==(h|0)){c[p>>2]=q;c[n>>2]=o;k=q;break}else{Xb()}}}while(0);if((l|0)!=0){n=c[a+(j+20)>>2]|0;o=22472+(n<<2)|0;if((h|0)==(c[o>>2]|0)){c[o>>2]=k;if((k|0)==0){c[22172>>2]=c[22172>>2]&~(1<<n);break}}else{if(l>>>0<(c[22184>>2]|0)>>>0){Xb()}n=l+16|0;if((c[n>>2]|0)==(h|0)){c[n>>2]=k}else{c[l+20>>2]=k}if((k|0)==0){break}}if(k>>>0<(c[22184>>2]|0)>>>0){Xb()}c[k+24>>2]=l;h=c[a+(j+8)>>2]|0;do{if((h|0)!=0){if(h>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[k+16>>2]=h;c[h+24>>2]=k;break}}}while(0);h=c[a+(j+12)>>2]|0;if((h|0)!=0){if(h>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[k+20>>2]=h;c[h+24>>2]=k;break}}}}else{k=c[a+j>>2]|0;a=c[a+(j|4)>>2]|0;j=22208+(n<<1<<2)|0;if((k|0)!=(j|0)){if(k>>>0<(c[22184>>2]|0)>>>0){Xb()}if((c[k+12>>2]|0)!=(h|0)){Xb()}}if((a|0)==(k|0)){c[5542]=c[5542]&~(1<<n);break}if((a|0)!=(j|0)){if(a>>>0<(c[22184>>2]|0)>>>0){Xb()}j=a+8|0;if((c[j>>2]|0)==(h|0)){l=j}else{Xb()}}else{l=a+8|0}c[k+12>>2]=a;c[l>>2]=k}}while(0);c[d+4>>2]=m|1;c[d+m>>2]=m;if((d|0)==(c[22188>>2]|0)){c[22176>>2]=m;i=b;return}}else{c[n>>2]=o&-2;c[d+4>>2]=m|1;c[d+m>>2]=m}h=m>>>3;if(m>>>0<256){a=h<<1;e=22208+(a<<2)|0;j=c[5542]|0;h=1<<h;if((j&h|0)!=0){h=22208+(a+2<<2)|0;a=c[h>>2]|0;if(a>>>0<(c[22184>>2]|0)>>>0){Xb()}else{f=h;g=a}}else{c[5542]=j|h;f=22208+(a+2<<2)|0;g=e}c[f>>2]=d;c[g+12>>2]=d;c[d+8>>2]=g;c[d+12>>2]=e;i=b;return}f=m>>>8;if((f|0)!=0){if(m>>>0>16777215){f=31}else{v=(f+1048320|0)>>>16&8;w=f<<v;u=(w+520192|0)>>>16&4;w=w<<u;f=(w+245760|0)>>>16&2;f=14-(u|v|f)+(w<<f>>>15)|0;f=m>>>(f+7|0)&1|f<<1}}else{f=0}g=22472+(f<<2)|0;c[d+28>>2]=f;c[d+20>>2]=0;c[d+16>>2]=0;a=c[22172>>2]|0;h=1<<f;a:do{if((a&h|0)!=0){g=c[g>>2]|0;if((f|0)==31){f=0}else{f=25-(f>>>1)|0}b:do{if((c[g+4>>2]&-8|0)!=(m|0)){f=m<<f;a=g;while(1){h=a+(f>>>31<<2)+16|0;g=c[h>>2]|0;if((g|0)==0){break}if((c[g+4>>2]&-8|0)==(m|0)){e=g;break b}else{f=f<<1;a=g}}if(h>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[h>>2]=d;c[d+24>>2]=a;c[d+12>>2]=d;c[d+8>>2]=d;break a}}else{e=g}}while(0);g=e+8|0;f=c[g>>2]|0;h=c[22184>>2]|0;if(e>>>0<h>>>0){Xb()}if(f>>>0<h>>>0){Xb()}else{c[f+12>>2]=d;c[g>>2]=d;c[d+8>>2]=f;c[d+12>>2]=e;c[d+24>>2]=0;break}}else{c[22172>>2]=a|h;c[g>>2]=d;c[d+24>>2]=g;c[d+12>>2]=d;c[d+8>>2]=d}}while(0);w=(c[22200>>2]|0)+ -1|0;c[22200>>2]=w;if((w|0)==0){d=22624|0}else{i=b;return}while(1){d=c[d>>2]|0;if((d|0)==0){break}else{d=d+8|0}}c[22200>>2]=-1;i=b;return}function wn(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=i;if((a|0)==0){r=un(b)|0;i=d;return r|0}if(b>>>0>4294967231){c[(bb()|0)>>2]=12;r=0;i=d;return r|0}if(b>>>0<11){f=16}else{f=b+11&-8}e=a+ -4|0;k=c[e>>2]|0;l=k&-8;o=l+ -8|0;h=a+o|0;m=c[22184>>2]|0;if((a+ -8|0)>>>0<m>>>0){Xb()}r=k&3;if(!((r|0)!=1&(o|0)>-8)){Xb()}o=l|4;q=a+(o+ -8)|0;p=c[q>>2]|0;if((p&1|0)==0){Xb()}do{if((r|0)==0){if(!(f>>>0<256|l>>>0<(f|4)>>>0)?!((l-f|0)>>>0>c[22648>>2]<<1>>>0):0){r=a;i=d;return r|0}}else{if(!(l>>>0<f>>>0)){g=l-f|0;if(!(g>>>0>15)){r=a;i=d;return r|0}c[e>>2]=k&1|f|2;c[a+((f|4)+ -8)>>2]=g|3;c[q>>2]=c[q>>2]|1;xn(a+(f+ -8)|0,g);r=a;i=d;return r|0}if((h|0)==(c[22192>>2]|0)){g=(c[22180>>2]|0)+l|0;if(!(g>>>0>f>>>0)){break}r=g-f|0;c[e>>2]=k&1|f|2;c[a+((f|4)+ -8)>>2]=r|1;c[22192>>2]=a+(f+ -8);c[22180>>2]=r;r=a;i=d;return r|0}if((h|0)==(c[22188>>2]|0)){g=(c[22176>>2]|0)+l|0;if(g>>>0<f>>>0){break}h=g-f|0;if(h>>>0>15){c[e>>2]=k&1|f|2;c[a+((f|4)+ -8)>>2]=h|1;c[a+(g+ -8)>>2]=h;e=a+(g+ -4)|0;c[e>>2]=c[e>>2]&-2;e=a+(f+ -8)|0}else{c[e>>2]=k&1|g|2;e=a+(g+ -4)|0;c[e>>2]=c[e>>2]|1;e=0;h=0}c[22176>>2]=h;c[22188>>2]=e;r=a;i=d;return r|0}if((p&2|0)==0?(g=(p&-8)+l|0,!(g>>>0<f>>>0)):0){k=g-f|0;b=p>>>3;do{if(!(p>>>0<256)){n=c[a+(l+16)>>2]|0;o=c[a+o>>2]|0;do{if((o|0)==(h|0)){b=a+(l+12)|0;o=c[b>>2]|0;if((o|0)==0){b=a+(l+8)|0;o=c[b>>2]|0;if((o|0)==0){j=0;break}}while(1){q=o+20|0;p=c[q>>2]|0;if((p|0)!=0){o=p;b=q;continue}p=o+16|0;q=c[p>>2]|0;if((q|0)==0){break}else{o=q;b=p}}if(b>>>0<m>>>0){Xb()}else{c[b>>2]=0;j=o;break}}else{b=c[a+l>>2]|0;if(b>>>0<m>>>0){Xb()}p=b+12|0;if((c[p>>2]|0)!=(h|0)){Xb()}m=o+8|0;if((c[m>>2]|0)==(h|0)){c[p>>2]=o;c[m>>2]=b;j=o;break}else{Xb()}}}while(0);if((n|0)!=0){o=c[a+(l+20)>>2]|0;m=22472+(o<<2)|0;if((h|0)==(c[m>>2]|0)){c[m>>2]=j;if((j|0)==0){c[22172>>2]=c[22172>>2]&~(1<<o);break}}else{if(n>>>0<(c[22184>>2]|0)>>>0){Xb()}m=n+16|0;if((c[m>>2]|0)==(h|0)){c[m>>2]=j}else{c[n+20>>2]=j}if((j|0)==0){break}}if(j>>>0<(c[22184>>2]|0)>>>0){Xb()}c[j+24>>2]=n;h=c[a+(l+8)>>2]|0;do{if((h|0)!=0){if(h>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[j+16>>2]=h;c[h+24>>2]=j;break}}}while(0);h=c[a+(l+12)>>2]|0;if((h|0)==0){break}if(h>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[j+20>>2]=h;c[h+24>>2]=j;break}}}else{j=c[a+l>>2]|0;l=c[a+o>>2]|0;o=22208+(b<<1<<2)|0;if((j|0)!=(o|0)){if(j>>>0<m>>>0){Xb()}if((c[j+12>>2]|0)!=(h|0)){Xb()}}if((l|0)==(j|0)){c[5542]=c[5542]&~(1<<b);break}do{if((l|0)==(o|0)){n=l+8|0}else{if(l>>>0<m>>>0){Xb()}m=l+8|0;if((c[m>>2]|0)==(h|0)){n=m;break}Xb()}}while(0);c[j+12>>2]=l;c[n>>2]=j}}while(0);if(k>>>0<16){c[e>>2]=g|c[e>>2]&1|2;r=a+((g|4)+ -8)|0;c[r>>2]=c[r>>2]|1;r=a;i=d;return r|0}else{c[e>>2]=c[e>>2]&1|f|2;c[a+((f|4)+ -8)>>2]=k|3;r=a+((g|4)+ -8)|0;c[r>>2]=c[r>>2]|1;xn(a+(f+ -8)|0,k);r=a;i=d;return r|0}}}}while(0);f=un(b)|0;if((f|0)==0){r=0;i=d;return r|0}r=c[e>>2]|0;r=(r&-8)-((r&3|0)==0?8:4)|0;Ln(f|0,a|0,(r>>>0<b>>>0?r:b)|0)|0;vn(a);r=f;i=d;return r|0}function xn(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=i;h=a+b|0;l=c[a+4>>2]|0;do{if((l&1|0)==0){p=c[a>>2]|0;if((l&3|0)==0){i=d;return}l=a+(0-p)|0;m=p+b|0;q=c[22184>>2]|0;if(l>>>0<q>>>0){Xb()}if((l|0)==(c[22188>>2]|0)){e=a+(b+4)|0;if((c[e>>2]&3|0)!=3){e=l;n=m;break}c[22176>>2]=m;c[e>>2]=c[e>>2]&-2;c[a+(4-p)>>2]=m|1;c[h>>2]=m;i=d;return}s=p>>>3;if(p>>>0<256){e=c[a+(8-p)>>2]|0;n=c[a+(12-p)>>2]|0;o=22208+(s<<1<<2)|0;if((e|0)!=(o|0)){if(e>>>0<q>>>0){Xb()}if((c[e+12>>2]|0)!=(l|0)){Xb()}}if((n|0)==(e|0)){c[5542]=c[5542]&~(1<<s);e=l;n=m;break}if((n|0)!=(o|0)){if(n>>>0<q>>>0){Xb()}o=n+8|0;if((c[o>>2]|0)==(l|0)){r=o}else{Xb()}}else{r=n+8|0}c[e+12>>2]=n;c[r>>2]=e;e=l;n=m;break}r=c[a+(24-p)>>2]|0;t=c[a+(12-p)>>2]|0;do{if((t|0)==(l|0)){u=16-p|0;t=a+(u+4)|0;s=c[t>>2]|0;if((s|0)==0){t=a+u|0;s=c[t>>2]|0;if((s|0)==0){o=0;break}}while(1){u=s+20|0;v=c[u>>2]|0;if((v|0)!=0){s=v;t=u;continue}v=s+16|0;u=c[v>>2]|0;if((u|0)==0){break}else{s=u;t=v}}if(t>>>0<q>>>0){Xb()}else{c[t>>2]=0;o=s;break}}else{s=c[a+(8-p)>>2]|0;if(s>>>0<q>>>0){Xb()}u=s+12|0;if((c[u>>2]|0)!=(l|0)){Xb()}q=t+8|0;if((c[q>>2]|0)==(l|0)){c[u>>2]=t;c[q>>2]=s;o=t;break}else{Xb()}}}while(0);if((r|0)!=0){q=c[a+(28-p)>>2]|0;s=22472+(q<<2)|0;if((l|0)==(c[s>>2]|0)){c[s>>2]=o;if((o|0)==0){c[22172>>2]=c[22172>>2]&~(1<<q);e=l;n=m;break}}else{if(r>>>0<(c[22184>>2]|0)>>>0){Xb()}q=r+16|0;if((c[q>>2]|0)==(l|0)){c[q>>2]=o}else{c[r+20>>2]=o}if((o|0)==0){e=l;n=m;break}}if(o>>>0<(c[22184>>2]|0)>>>0){Xb()}c[o+24>>2]=r;p=16-p|0;q=c[a+p>>2]|0;do{if((q|0)!=0){if(q>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[o+16>>2]=q;c[q+24>>2]=o;break}}}while(0);p=c[a+(p+4)>>2]|0;if((p|0)!=0){if(p>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[o+20>>2]=p;c[p+24>>2]=o;e=l;n=m;break}}else{e=l;n=m}}else{e=l;n=m}}else{e=a;n=b}}while(0);l=c[22184>>2]|0;if(h>>>0<l>>>0){Xb()}m=a+(b+4)|0;o=c[m>>2]|0;if((o&2|0)==0){if((h|0)==(c[22192>>2]|0)){v=(c[22180>>2]|0)+n|0;c[22180>>2]=v;c[22192>>2]=e;c[e+4>>2]=v|1;if((e|0)!=(c[22188>>2]|0)){i=d;return}c[22188>>2]=0;c[22176>>2]=0;i=d;return}if((h|0)==(c[22188>>2]|0)){v=(c[22176>>2]|0)+n|0;c[22176>>2]=v;c[22188>>2]=e;c[e+4>>2]=v|1;c[e+v>>2]=v;i=d;return}n=(o&-8)+n|0;m=o>>>3;do{if(!(o>>>0<256)){k=c[a+(b+24)>>2]|0;m=c[a+(b+12)>>2]|0;do{if((m|0)==(h|0)){o=a+(b+20)|0;m=c[o>>2]|0;if((m|0)==0){o=a+(b+16)|0;m=c[o>>2]|0;if((m|0)==0){j=0;break}}while(1){q=m+20|0;p=c[q>>2]|0;if((p|0)!=0){m=p;o=q;continue}p=m+16|0;q=c[p>>2]|0;if((q|0)==0){break}else{m=q;o=p}}if(o>>>0<l>>>0){Xb()}else{c[o>>2]=0;j=m;break}}else{o=c[a+(b+8)>>2]|0;if(o>>>0<l>>>0){Xb()}l=o+12|0;if((c[l>>2]|0)!=(h|0)){Xb()}p=m+8|0;if((c[p>>2]|0)==(h|0)){c[l>>2]=m;c[p>>2]=o;j=m;break}else{Xb()}}}while(0);if((k|0)!=0){l=c[a+(b+28)>>2]|0;m=22472+(l<<2)|0;if((h|0)==(c[m>>2]|0)){c[m>>2]=j;if((j|0)==0){c[22172>>2]=c[22172>>2]&~(1<<l);break}}else{if(k>>>0<(c[22184>>2]|0)>>>0){Xb()}l=k+16|0;if((c[l>>2]|0)==(h|0)){c[l>>2]=j}else{c[k+20>>2]=j}if((j|0)==0){break}}if(j>>>0<(c[22184>>2]|0)>>>0){Xb()}c[j+24>>2]=k;h=c[a+(b+16)>>2]|0;do{if((h|0)!=0){if(h>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[j+16>>2]=h;c[h+24>>2]=j;break}}}while(0);h=c[a+(b+20)>>2]|0;if((h|0)!=0){if(h>>>0<(c[22184>>2]|0)>>>0){Xb()}else{c[j+20>>2]=h;c[h+24>>2]=j;break}}}}else{j=c[a+(b+8)>>2]|0;a=c[a+(b+12)>>2]|0;b=22208+(m<<1<<2)|0;if((j|0)!=(b|0)){if(j>>>0<l>>>0){Xb()}if((c[j+12>>2]|0)!=(h|0)){Xb()}}if((a|0)==(j|0)){c[5542]=c[5542]&~(1<<m);break}if((a|0)!=(b|0)){if(a>>>0<l>>>0){Xb()}b=a+8|0;if((c[b>>2]|0)==(h|0)){k=b}else{Xb()}}else{k=a+8|0}c[j+12>>2]=a;c[k>>2]=j}}while(0);c[e+4>>2]=n|1;c[e+n>>2]=n;if((e|0)==(c[22188>>2]|0)){c[22176>>2]=n;i=d;return}}else{c[m>>2]=o&-2;c[e+4>>2]=n|1;c[e+n>>2]=n}a=n>>>3;if(n>>>0<256){b=a<<1;h=22208+(b<<2)|0;j=c[5542]|0;a=1<<a;if((j&a|0)!=0){b=22208+(b+2<<2)|0;a=c[b>>2]|0;if(a>>>0<(c[22184>>2]|0)>>>0){Xb()}else{g=b;f=a}}else{c[5542]=j|a;g=22208+(b+2<<2)|0;f=h}c[g>>2]=e;c[f+12>>2]=e;c[e+8>>2]=f;c[e+12>>2]=h;i=d;return}f=n>>>8;if((f|0)!=0){if(n>>>0>16777215){f=31}else{u=(f+1048320|0)>>>16&8;v=f<<u;t=(v+520192|0)>>>16&4;v=v<<t;f=(v+245760|0)>>>16&2;f=14-(t|u|f)+(v<<f>>>15)|0;f=n>>>(f+7|0)&1|f<<1}}else{f=0}a=22472+(f<<2)|0;c[e+28>>2]=f;c[e+20>>2]=0;c[e+16>>2]=0;h=c[22172>>2]|0;g=1<<f;if((h&g|0)==0){c[22172>>2]=h|g;c[a>>2]=e;c[e+24>>2]=a;c[e+12>>2]=e;c[e+8>>2]=e;i=d;return}g=c[a>>2]|0;if((f|0)==31){f=0}else{f=25-(f>>>1)|0}a:do{if((c[g+4>>2]&-8|0)!=(n|0)){f=n<<f;a=g;while(1){h=a+(f>>>31<<2)+16|0;g=c[h>>2]|0;if((g|0)==0){break}if((c[g+4>>2]&-8|0)==(n|0)){break a}else{f=f<<1;a=g}}if(h>>>0<(c[22184>>2]|0)>>>0){Xb()}c[h>>2]=e;c[e+24>>2]=a;c[e+12>>2]=e;c[e+8>>2]=e;i=d;return}}while(0);f=g+8|0;a=c[f>>2]|0;h=c[22184>>2]|0;if(g>>>0<h>>>0){Xb()}if(a>>>0<h>>>0){Xb()}c[a+12>>2]=e;c[f>>2]=e;c[e+8>>2]=a;c[e+12>>2]=g;c[e+24>>2]=0;i=d;return}function yn(a){a=a|0;var b=0;b=i;Rb(a|0);if((a|0)!=0){vn(a)}i=b;return}function zn(a){a=a|0;var b=0;b=i;Rb(a|0);i=b;return}function An(a){a=a|0;return 22696}function Bn(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=i;if(e>>>0>36){c[(bb()|0)>>2]=22;s=0;t=0;I=s;i=h;return t|0}k=b+4|0;j=b+100|0;do{l=c[k>>2]|0;if(l>>>0<(c[j>>2]|0)>>>0){c[k>>2]=l+1;o=d[l>>0]|0}else{o=Dn(b)|0}}while((o|0)==32|(o+ -9|0)>>>0<5);do{if((o|0)==43|(o|0)==45){l=((o|0)==45)<<31>>31;m=c[k>>2]|0;if(m>>>0<(c[j>>2]|0)>>>0){c[k>>2]=m+1;o=d[m>>0]|0;break}else{o=Dn(b)|0;break}}else{l=0}}while(0);m=(e|0)==0;do{if((e&-17|0)==0&(o|0)==48){n=c[k>>2]|0;if(n>>>0<(c[j>>2]|0)>>>0){c[k>>2]=n+1;o=d[n>>0]|0}else{o=Dn(b)|0}if((o|32|0)!=120){e=m?8:e;m=28;break}e=c[k>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){c[k>>2]=e+1;o=d[e>>0]|0}else{o=Dn(b)|0}if((d[o+22745>>0]|0)>15){if((c[j>>2]|0)==0){s=0;t=0;I=s;i=h;return t|0}c[k>>2]=(c[k>>2]|0)+ -2;s=0;t=0;I=s;i=h;return t|0}else{e=16;m=43}}else{e=m?10:e;if((d[o+22745>>0]|0)>>>0<e>>>0){m=28}else{f=c[k>>2]|0;if((c[j>>2]|0)!=0){f=f+ -1|0;c[k>>2]=f}c[b+104>>2]=0;s=c[b+8>>2]|0;c[b+108>>2]=s-f;c[j>>2]=s;c[(bb()|0)>>2]=22;s=0;t=0;I=s;i=h;return t|0}}}while(0);if((m|0)==28){if((e|0)==10){e=o+ -48|0;if(e>>>0<10){n=0;while(1){n=n+e|0;e=c[k>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){c[k>>2]=e+1;o=d[e>>0]|0}else{o=Dn(b)|0}e=o+ -48|0;if(!(e>>>0<10&n>>>0<429496729)){break}n=n*10|0}p=0}else{n=0;p=0}e=o+ -48|0;if(e>>>0<10){do{s=Vn(n|0,p|0,10,0)|0;r=I;q=((e|0)<0)<<31>>31;t=~q;if(r>>>0>t>>>0|(r|0)==(t|0)&s>>>0>~e>>>0){break}n=In(s|0,r|0,e|0,q|0)|0;p=I;e=c[k>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){c[k>>2]=e+1;o=d[e>>0]|0}else{o=Dn(b)|0}e=o+ -48|0}while(e>>>0<10&(p>>>0<429496729|(p|0)==429496729&n>>>0<2576980378));if(!(e>>>0>9)){e=10;m=69}}}else{m=43}}a:do{if((m|0)==43){if((e+ -1&e|0)==0){m=a[23008+((e*23|0)>>>5&7)>>0]|0;r=a[o+22745>>0]|0;n=r&255;if(n>>>0<e>>>0){o=n;n=0;do{n=o|n<<m;o=c[k>>2]|0;if(o>>>0<(c[j>>2]|0)>>>0){c[k>>2]=o+1;s=d[o>>0]|0}else{s=Dn(b)|0}r=a[s+22745>>0]|0;o=r&255}while(o>>>0<e>>>0&n>>>0<134217728);p=0}else{p=0;n=0;s=o}q=Kn(-1,-1,m|0)|0;o=I;if((r&255)>>>0>=e>>>0|(p>>>0>o>>>0|(p|0)==(o|0)&n>>>0>q>>>0)){o=s;m=69;break}while(1){n=On(n|0,p|0,m|0)|0;p=I;n=r&255|n;r=c[k>>2]|0;if(r>>>0<(c[j>>2]|0)>>>0){c[k>>2]=r+1;s=d[r>>0]|0}else{s=Dn(b)|0}r=a[s+22745>>0]|0;if((r&255)>>>0>=e>>>0|(p>>>0>o>>>0|(p|0)==(o|0)&n>>>0>q>>>0)){o=s;m=69;break a}}}q=a[o+22745>>0]|0;m=q&255;if(m>>>0<e>>>0){n=0;do{n=m+(ea(n,e)|0)|0;m=c[k>>2]|0;if(m>>>0<(c[j>>2]|0)>>>0){c[k>>2]=m+1;r=d[m>>0]|0}else{r=Dn(b)|0}q=a[r+22745>>0]|0;m=q&255}while(m>>>0<e>>>0&n>>>0<119304647);p=0}else{n=0;p=0;r=o}if((q&255)>>>0<e>>>0){m=Wn(-1,-1,e|0,0)|0;o=I;while(1){if(p>>>0>o>>>0|(p|0)==(o|0)&n>>>0>m>>>0){o=r;m=69;break a}s=Vn(n|0,p|0,e|0,0)|0;t=I;q=q&255;if(t>>>0>4294967295|(t|0)==-1&s>>>0>~q>>>0){o=r;m=69;break a}n=In(q|0,0,s|0,t|0)|0;p=I;q=c[k>>2]|0;if(q>>>0<(c[j>>2]|0)>>>0){c[k>>2]=q+1;r=d[q>>0]|0}else{r=Dn(b)|0}q=a[r+22745>>0]|0;if(!((q&255)>>>0<e>>>0)){o=r;m=69;break}}}else{o=r;m=69}}}while(0);if((m|0)==69){if((d[o+22745>>0]|0)>>>0<e>>>0){do{m=c[k>>2]|0;if(m>>>0<(c[j>>2]|0)>>>0){c[k>>2]=m+1;m=d[m>>0]|0}else{m=Dn(b)|0}}while((d[m+22745>>0]|0)>>>0<e>>>0);c[(bb()|0)>>2]=34;p=g;n=f}}if((c[j>>2]|0)!=0){c[k>>2]=(c[k>>2]|0)+ -1}if(!(p>>>0<g>>>0|(p|0)==(g|0)&n>>>0<f>>>0)){if((f&1|0)==0&0==0&(l|0)==0){c[(bb()|0)>>2]=34;t=In(f|0,g|0,-1,-1)|0;s=I;I=s;i=h;return t|0}if(p>>>0>g>>>0|(p|0)==(g|0)&n>>>0>f>>>0){c[(bb()|0)>>2]=34;s=g;t=f;I=s;i=h;return t|0}}t=((l|0)<0)<<31>>31;t=Hn(n^l|0,p^t|0,l|0,t|0)|0;s=I;I=s;i=h;return t|0}function Cn(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;e=i;f=a+4|0;g=c[f>>2]|0;b=a+100|0;if(g>>>0<(c[b>>2]|0)>>>0){c[f>>2]=g+1;j=d[g>>0]|0}else{j=Dn(a)|0}if((j|0)==43|(j|0)==45){g=(j|0)==45&1;h=c[f>>2]|0;if(h>>>0<(c[b>>2]|0)>>>0){c[f>>2]=h+1;j=d[h>>0]|0}else{j=Dn(a)|0}if(!((j+ -48|0)>>>0<10)?(c[b>>2]|0)!=0:0){c[f>>2]=(c[f>>2]|0)+ -1}}else{g=0}if((j+ -48|0)>>>0>9){if((c[b>>2]|0)==0){k=-2147483648;l=0;I=k;i=e;return l|0}c[f>>2]=(c[f>>2]|0)+ -1;k=-2147483648;l=0;I=k;i=e;return l|0}else{h=0}while(1){h=j+ -48+h|0;j=c[f>>2]|0;if(j>>>0<(c[b>>2]|0)>>>0){c[f>>2]=j+1;j=d[j>>0]|0}else{j=Dn(a)|0}l=(j+ -48|0)>>>0<10;if(!(l&(h|0)<214748364)){break}h=h*10|0}k=((h|0)<0)<<31>>31;if(l){do{k=Vn(h|0,k|0,10,0)|0;h=I;j=In(j|0,((j|0)<0)<<31>>31|0,-48,-1)|0;h=In(j|0,I|0,k|0,h|0)|0;k=I;j=c[f>>2]|0;if(j>>>0<(c[b>>2]|0)>>>0){c[f>>2]=j+1;j=d[j>>0]|0}else{j=Dn(a)|0}}while((j+ -48|0)>>>0<10&((k|0)<21474836|(k|0)==21474836&h>>>0<2061584302))}if((j+ -48|0)>>>0<10){do{j=c[f>>2]|0;if(j>>>0<(c[b>>2]|0)>>>0){c[f>>2]=j+1;j=d[j>>0]|0}else{j=Dn(a)|0}}while((j+ -48|0)>>>0<10)}if((c[b>>2]|0)!=0){c[f>>2]=(c[f>>2]|0)+ -1}j=(g|0)!=0;l=Hn(0,0,h|0,k|0)|0;k=j?I:k;l=j?l:h;I=k;i=e;return l|0}function Dn(b){b=b|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;e=i;h=b+104|0;l=c[h>>2]|0;if(!((l|0)!=0?(c[b+108>>2]|0)>=(l|0):0)){g=3}if((g|0)==3?(f=En(b)|0,(f|0)>=0):0){l=c[h>>2]|0;h=c[b+8>>2]|0;k=c[b+4>>2]|0;if((l|0)!=0?(j=l-(c[b+108>>2]|0)+ -1|0,(h-k|0)>(j|0)):0){c[b+100>>2]=k+j}else{g=8}if((g|0)==8){c[b+100>>2]=h}if((h|0)!=0){l=b+108|0;c[l>>2]=h+1-k+(c[l>>2]|0)}b=k+ -1|0;if((d[b>>0]|0|0)==(f|0)){l=f;i=e;return l|0}a[b>>0]=f;l=f;i=e;return l|0}c[b+100>>2]=0;l=-1;i=e;return l|0}function En(b){b=b|0;var e=0,f=0,g=0,h=0,j=0;g=i;i=i+16|0;e=g;f=b+8|0;do{if((c[f>>2]|0)==0){j=b+74|0;h=a[j>>0]|0;a[j>>0]=h+255|h;j=b+20|0;h=b+44|0;if((c[j>>2]|0)>>>0>(c[h>>2]|0)>>>0){hc[c[b+36>>2]&63](b,0,0)|0}c[b+16>>2]=0;c[b+28>>2]=0;c[j>>2]=0;j=c[b>>2]|0;if((j&20|0)==0){j=c[h>>2]|0;c[f>>2]=j;c[b+4>>2]=j;break}if((j&4|0)==0){j=-1;i=g;return j|0}c[b>>2]=j|32;j=-1;i=g;return j|0}}while(0);if((hc[c[b+32>>2]&63](b,e,1)|0)!=1){j=-1;i=g;return j|0}j=d[e>>0]|0;i=g;return j|0}function Fn(b,e){b=b|0;e=e|0;var f=0,g=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0.0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0.0,J=0,K=0,L=0.0,M=0.0,N=0.0,O=0.0;f=i;i=i+624|0;o=f+112|0;q=f;l=q+0|0;j=l+108|0;do{c[l>>2]=0;l=l+4|0}while((l|0)<(j|0));m=q+4|0;c[m>>2]=b;l=q+8|0;c[l>>2]=-1;c[q+44>>2]=b;c[q+76>>2]=-1;s=q+104|0;c[s>>2]=0;j=q+108|0;c[j>>2]=~b;p=q+100|0;c[p>>2]=-1;n=b;z=-1;while(1){if(n>>>0<z>>>0){c[m>>2]=n+1;z=d[n>>0]|0}else{z=Dn(q)|0}if(!((z|0)==32|(z+ -9|0)>>>0<5)){break}n=c[m>>2]|0;z=c[p>>2]|0}do{if((z|0)==43|(z|0)==45){n=1-(((z|0)==45&1)<<1)|0;z=c[m>>2]|0;if(z>>>0<(c[p>>2]|0)>>>0){c[m>>2]=z+1;z=d[z>>0]|0;break}else{z=Dn(q)|0;break}}else{n=1}}while(0);B=0;do{if((z|32|0)!=(a[23024+B>>0]|0)){break}do{if(B>>>0<7){z=c[m>>2]|0;if(z>>>0<(c[p>>2]|0)>>>0){c[m>>2]=z+1;z=d[z>>0]|0;break}else{z=Dn(q)|0;break}}}while(0);B=B+1|0}while(B>>>0<8);a:do{if((B|0)==3){g=21}else if((B|0)!=8){if(!(B>>>0<4)){if((B|0)==8){g=25;break}else{g=21;break}}b:do{if((B|0)==0){B=0;do{if((z|32|0)!=(a[23040+B>>0]|0)){break b}do{if(B>>>0<2){z=c[m>>2]|0;if(z>>>0<(c[p>>2]|0)>>>0){c[m>>2]=z+1;z=d[z>>0]|0;break}else{z=Dn(q)|0;break}}}while(0);B=B+1|0}while(B>>>0<3)}}while(0);if((B|0)==0){do{if((z|0)==48){z=c[m>>2]|0;if(z>>>0<(c[p>>2]|0)>>>0){c[m>>2]=z+1;z=d[z>>0]|0}else{z=Dn(q)|0}if((z|32|0)!=120){if((c[p>>2]|0)==0){z=48;break}c[m>>2]=(c[m>>2]|0)+ -1;z=48;break}o=c[m>>2]|0;if(o>>>0<(c[p>>2]|0)>>>0){c[m>>2]=o+1;F=d[o>>0]|0;D=0}else{F=Dn(q)|0;D=0}while(1){if((F|0)==46){g=65;break}else if((F|0)!=48){o=0;s=0;A=0;z=0;C=0;E=0;H=1.0;B=0;w=0.0;break}o=c[m>>2]|0;if(o>>>0<(c[p>>2]|0)>>>0){c[m>>2]=o+1;F=d[o>>0]|0;D=1;continue}else{F=Dn(q)|0;D=1;continue}}c:do{if((g|0)==65){o=c[m>>2]|0;if(o>>>0<(c[p>>2]|0)>>>0){c[m>>2]=o+1;F=d[o>>0]|0}else{F=Dn(q)|0}if((F|0)==48){A=-1;z=-1;while(1){o=c[m>>2]|0;if(o>>>0<(c[p>>2]|0)>>>0){c[m>>2]=o+1;F=d[o>>0]|0}else{F=Dn(q)|0}if((F|0)!=48){o=0;s=0;D=1;C=1;E=0;H=1.0;B=0;w=0.0;break c}K=In(A|0,z|0,-1,-1)|0;A=K;z=I}}else{o=0;s=0;A=0;z=0;C=1;E=0;H=1.0;B=0;w=0.0}}}while(0);d:while(1){K=F+ -48|0;do{if(!(K>>>0<10)){G=F|32;J=(F|0)==46;if(!((G+ -97|0)>>>0<6|J)){break d}if(J){if((C|0)==0){A=s;z=o;C=1;break}else{F=46;break d}}else{K=(F|0)>57?G+ -87|0:K;g=79;break}}else{g=79}}while(0);if((g|0)==79){g=0;do{if(!((o|0)<0|(o|0)==0&s>>>0<8)){if((o|0)<0|(o|0)==0&s>>>0<14){N=H*.0625;L=N;w=w+N*+(K|0);break}if((K|0)!=0&(E|0)==0){E=1;L=H;w=w+H*.5}else{L=H}}else{L=H;B=K+(B<<4)|0}}while(0);s=In(s|0,o|0,1,0)|0;o=I;D=1;H=L}F=c[m>>2]|0;if(F>>>0<(c[p>>2]|0)>>>0){c[m>>2]=F+1;F=d[F>>0]|0;continue}else{F=Dn(q)|0;continue}}if((D|0)==0){if((c[p>>2]|0)!=0?(v=c[m>>2]|0,c[m>>2]=v+ -2,(C|0)!=0):0){c[m>>2]=v+ -3}w=+(n|0)*0.0;break a}K=(C|0)==0;v=K?s:A;z=K?o:z;if((o|0)<0|(o|0)==0&s>>>0<8){do{B=B<<4;s=In(s|0,o|0,1,0)|0;o=I}while((o|0)<0|(o|0)==0&s>>>0<8)}if(!((F|32|0)==112?(u=Cn(q)|0,t=I,!((u|0)==0&(t|0)==-2147483648)):0)){if((c[p>>2]|0)==0){u=0;t=0}else{c[m>>2]=(c[m>>2]|0)+ -1;u=0;t=0}}o=On(v|0,z|0,2)|0;o=In(o|0,I|0,-32,-1)|0;o=In(o|0,I|0,u|0,t|0)|0;p=I;if((B|0)==0){w=+(n|0)*0.0;break a}if((p|0)>0|(p|0)==0&o>>>0>1074){c[(bb()|0)>>2]=34;w=+(n|0)*1.7976931348623157e+308*1.7976931348623157e+308;break a}if((p|0)<-1|(p|0)==-1&o>>>0<4294966116){c[(bb()|0)>>2]=34;w=+(n|0)*2.2250738585072014e-308*2.2250738585072014e-308;break a}if((B|0)>-1){do{B=B<<1;if(!(w>=.5)){H=w}else{H=w+-1.0;B=B|1}w=w+H;o=In(o|0,p|0,-1,-1)|0;p=I}while((B|0)>-1)}p=In(o|0,p|0,1106,0)|0;K=I;do{if((K|0)<0|(K|0)==0&p>>>0<53?(r=(p|0)<0?0:p,(r|0)<53):0){p=84-r|0;do{if((p|0)>1023){q=p+ -1023|0;if((q|0)<=1023){p=q;H=8.98846567431158e+307;break}p=p+ -2046|0;p=(p|0)>1023?1023:p;H=y}else{if(!((p|0)<-1022)){H=1.0;break}q=p+1022|0;if(!((q|0)<-1022)){p=q;H=2.2250738585072014e-308;break}p=p+2044|0;p=(p|0)<-1022?-1022:p;H=0.0}}while(0);J=On(p+1023|0,0,52)|0;K=I;c[k>>2]=J;c[k+4>>2]=K;M=+(n|0);L=+Sb(+(H*+h[k>>3]),+M);if(!((r|0)<32&w!=0.0)){H=M;break}K=B&1;H=M;B=(K^1)+B|0;w=(K|0)==0?0.0:w}else{g=114}}while(0);if((g|0)==114){H=+(n|0);L=0.0}w=H*w+(L+H*+(B>>>0))-L;if(!(w!=0.0)){c[(bb()|0)>>2]=34}do{if((o|0)>1023){w=w*8.98846567431158e+307;n=o+ -1023|0;if((n|0)<=1023){o=n;break}o=o+ -2046|0;o=(o|0)>1023?1023:o;w=w*8.98846567431158e+307}else{if(!((o|0)<-1022)){break}w=w*2.2250738585072014e-308;n=o+1022|0;if(!((n|0)<-1022)){o=n;break}o=o+2044|0;o=(o|0)<-1022?-1022:o;w=w*2.2250738585072014e-308}}while(0);J=On(o+1023|0,0,52)|0;K=I;c[k>>2]=J;c[k+4>>2]=K;w=w*+h[k>>3];break a}}while(0);G=0;while(1){if((z|0)==46){g=139;break}else if((z|0)!=48){r=0;F=0;C=0;break}r=c[m>>2]|0;if(r>>>0<(c[p>>2]|0)>>>0){c[m>>2]=r+1;z=d[r>>0]|0;G=1;continue}else{z=Dn(q)|0;G=1;continue}}e:do{if((g|0)==139){r=c[m>>2]|0;if(r>>>0<(c[p>>2]|0)>>>0){c[m>>2]=r+1;z=d[r>>0]|0}else{z=Dn(q)|0}if((z|0)==48){r=-1;F=-1;while(1){t=c[m>>2]|0;if(t>>>0<(c[p>>2]|0)>>>0){c[m>>2]=t+1;z=d[t>>0]|0}else{z=Dn(q)|0}if((z|0)!=48){G=1;C=1;break e}K=In(r|0,F|0,-1,-1)|0;r=K;F=I}}else{r=0;F=0;C=1}}}while(0);c[o>>2]=0;D=z+ -48|0;J=(z|0)==46;f:do{if(D>>>0<10|J){t=o+496|0;E=0;B=0;A=0;v=0;u=0;while(1){do{if(J){if((C|0)==0){r=E;F=B;C=1}else{break f}}else{J=In(E|0,B|0,1,0)|0;B=I;K=(z|0)!=48;if((v|0)>=125){if(!K){E=J;break}c[t>>2]=c[t>>2]|1;E=J;break}E=o+(v<<2)|0;if((A|0)!=0){D=z+ -48+((c[E>>2]|0)*10|0)|0}c[E>>2]=D;A=A+1|0;D=(A|0)==9;E=J;G=1;A=D?0:A;v=(D&1)+v|0;u=K?J:u}}while(0);z=c[m>>2]|0;if(z>>>0<(c[p>>2]|0)>>>0){c[m>>2]=z+1;z=d[z>>0]|0}else{z=Dn(q)|0}D=z+ -48|0;J=(z|0)==46;if(!(D>>>0<10|J)){g=162;break}}}else{E=0;B=0;A=0;v=0;u=0;g=162}}while(0);if((g|0)==162){K=(C|0)==0;r=K?E:r;F=K?B:F}t=(G|0)!=0;if(t?(z|32|0)==101:0){z=Cn(q)|0;q=I;if((z|0)==0&(q|0)==-2147483648){if((c[p>>2]|0)==0){z=0;q=0}else{c[m>>2]=(c[m>>2]|0)+ -1;z=0;q=0}}r=In(z|0,q|0,r|0,F|0)|0;F=I}else{if((z|0)>-1?(c[p>>2]|0)!=0:0){c[m>>2]=(c[m>>2]|0)+ -1}}if(!t){c[(bb()|0)>>2]=22;c[s>>2]=0;K=c[l>>2]|0;c[j>>2]=K-(c[m>>2]|0);c[p>>2]=K;w=0.0;break}p=c[o>>2]|0;if((p|0)==0){w=+(n|0)*0.0;break}if((r|0)==(E|0)&(F|0)==(B|0)&((B|0)<0|(B|0)==0&E>>>0<10)){w=+(n|0)*+(p>>>0);break}if((F|0)>0|(F|0)==0&r>>>0>537){c[(bb()|0)>>2]=34;w=+(n|0)*1.7976931348623157e+308*1.7976931348623157e+308;break}if((F|0)<-1|(F|0)==-1&r>>>0<4294966116){c[(bb()|0)>>2]=34;w=+(n|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if((A|0)!=0){if((A|0)<9){q=o+(v<<2)|0;p=c[q>>2]|0;do{p=p*10|0;A=A+1|0}while((A|0)!=9);c[q>>2]=p}v=v+1|0}do{if((u|0)<9?(u|0)<=(r|0)&(r|0)<18:0){if((r|0)==9){w=+(n|0)*+((c[o>>2]|0)>>>0);break a}if((r|0)<9){w=+(n|0)*+((c[o>>2]|0)>>>0)/+(c[23056+(8-r<<2)>>2]|0);break a}K=(ea(r,-3)|0)+80|0;p=c[o>>2]|0;if((K|0)<=30?(p>>>K|0)!=0:0){break}w=+(n|0)*+(p>>>0)*+(c[23056+(r+ -10<<2)>>2]|0);break a}}while(0);p=(r|0)%9|0;if((p|0)==0){p=0;q=0}else{s=(r|0)>-1?p:p+9|0;q=c[23056+(8-s<<2)>>2]|0;if((v|0)!=0){t=1e9/(q|0)|0;p=0;z=0;u=0;do{G=o+(u<<2)|0;J=c[G>>2]|0;K=((J>>>0)/(q>>>0)|0)+z|0;c[G>>2]=K;z=ea((J>>>0)%(q>>>0)|0,t)|0;J=u;u=u+1|0;if((J|0)==(p|0)&(K|0)==0){p=u&127;r=r+ -9|0}}while((u|0)!=(v|0));if((z|0)!=0){c[o+(v<<2)>>2]=z;v=v+1|0}}else{p=0;v=0}q=0;r=9-s+r|0}g:while(1){s=o+(p<<2)|0;if((r|0)<18){do{u=0;s=v+127|0;while(1){s=s&127;t=o+(s<<2)|0;z=On(c[t>>2]|0,0,29)|0;z=In(z|0,I|0,u|0,0)|0;u=I;if(u>>>0>0|(u|0)==0&z>>>0>1e9){K=Wn(z|0,u|0,1e9,0)|0;z=Xn(z|0,u|0,1e9,0)|0;u=K}else{u=0}c[t>>2]=z;t=(s|0)==(p|0);if(!((s|0)!=(v+127&127|0)|t)){v=(z|0)==0?s:v}if(t){break}else{s=s+ -1|0}}q=q+ -29|0}while((u|0)==0)}else{if((r|0)!=18){break}do{if(!((c[s>>2]|0)>>>0<9007199)){r=18;break g}u=0;t=v+127|0;while(1){t=t&127;z=o+(t<<2)|0;A=On(c[z>>2]|0,0,29)|0;A=In(A|0,I|0,u|0,0)|0;u=I;if(u>>>0>0|(u|0)==0&A>>>0>1e9){K=Wn(A|0,u|0,1e9,0)|0;A=Xn(A|0,u|0,1e9,0)|0;u=K}else{u=0}c[z>>2]=A;z=(t|0)==(p|0);if(!((t|0)!=(v+127&127|0)|z)){v=(A|0)==0?t:v}if(z){break}else{t=t+ -1|0}}q=q+ -29|0}while((u|0)==0)}p=p+127&127;if((p|0)==(v|0)){K=v+127&127;v=o+((v+126&127)<<2)|0;c[v>>2]=c[v>>2]|c[o+(K<<2)>>2];v=K}c[o+(p<<2)>>2]=u;r=r+9|0}h:while(1){s=v+1&127;t=o+((v+127&127)<<2)|0;while(1){z=(r|0)==18;u=(r|0)>27?9:1;while(1){A=0;while(1){B=A+p&127;if((B|0)==(v|0)){A=2;break}B=c[o+(B<<2)>>2]|0;D=c[23048+(A<<2)>>2]|0;if(B>>>0<D>>>0){A=2;break}C=A+1|0;if(B>>>0>D>>>0){break}if((C|0)<2){A=C}else{A=C;break}}if((A|0)==2&z){break h}q=u+q|0;if((p|0)==(v|0)){p=v}else{break}}z=(1<<u)+ -1|0;A=1e9>>>u;B=p;C=0;do{G=o+(p<<2)|0;J=c[G>>2]|0;K=(J>>>u)+C|0;c[G>>2]=K;C=ea(J&z,A)|0;K=(p|0)==(B|0)&(K|0)==0;p=p+1&127;r=K?r+ -9|0:r;B=K?p:B}while((p|0)!=(v|0));if((C|0)==0){p=B;continue}if((s|0)!=(B|0)){break}c[t>>2]=c[t>>2]|1;p=B}c[o+(v<<2)>>2]=C;p=B;v=s}r=p&127;if((r|0)==(v|0)){c[o+(s+ -1<<2)>>2]=0;v=s}H=+((c[o+(r<<2)>>2]|0)>>>0);r=p+1&127;if((r|0)==(v|0)){v=v+1&127;c[o+(v+ -1<<2)>>2]=0}w=+(n|0);H=w*(H*1.0e9+ +((c[o+(r<<2)>>2]|0)>>>0));n=q+53|0;r=q+1127|0;do{if((r|0)<53){s=(r|0)<0?0:r;if((s|0)>=53){M=0.0;t=1;N=0.0;break}t=105-s|0;do{if((t|0)>1023){u=t+ -1023|0;if((u|0)<=1023){t=u;L=8.98846567431158e+307;break}t=t+ -2046|0;t=(t|0)>1023?1023:t;L=y}else{if(!((t|0)<-1022)){L=1.0;break}u=t+1022|0;if(!((u|0)<-1022)){t=u;L=2.2250738585072014e-308;break}t=t+2044|0;t=(t|0)<-1022?-1022:t;L=0.0}}while(0);K=On(t+1023|0,0,52)|0;t=I;c[k>>2]=K;c[k+4>>2]=t;L=+Sb(+(L*+h[k>>3]),+H);t=53-s|0;do{if((t|0)>1023){u=t+ -1023|0;if((u|0)<=1023){t=u;M=8.98846567431158e+307;break}t=t+ -2046|0;t=(t|0)>1023?1023:t;M=y}else{if(!((t|0)<-1022)){M=1.0;break}u=t+1022|0;if(!((u|0)<-1022)){t=u;M=2.2250738585072014e-308;break}t=t+2044|0;t=(t|0)<-1022?-1022:t;M=0.0}}while(0);K=On(t+1023|0,0,52)|0;t=I;c[k>>2]=K;c[k+4>>2]=t;O=+Pa(+H,+(M*+h[k>>3]));M=L;t=1;N=O;H=L+(H-O)}else{s=53;M=0.0;t=0;N=0.0}}while(0);u=p+2&127;do{if((u|0)!=(v|0)){o=c[o+(u<<2)>>2]|0;do{if(!(o>>>0<5e8)){if(o>>>0>5e8){N=w*.75+N;break}if((p+3&127|0)==(v|0)){N=w*.5+N;break}else{N=w*.75+N;break}}else{if((o|0)==0?(p+3&127|0)==(v|0):0){break}N=w*.25+N}}while(0);if((53-s|0)<=1){break}if(+Pa(+N,1.0)!=0.0){break}N=N+1.0}}while(0);w=H+N-M;do{if((n&2147483644)>>>0>1019){if(+T(+w)>=9007199254740992.0){t=(t|0)!=0&(s|0)==(r|0)?0:t;q=q+1|0;w=w*.5}if((q+50|0)<=1021?!((t|0)!=0&N!=0.0):0){break}c[(bb()|0)>>2]=34}}while(0);do{if((q|0)>1023){w=w*8.98846567431158e+307;n=q+ -1023|0;if((n|0)<=1023){q=n;break}q=q+ -2046|0;q=(q|0)>1023?1023:q;w=w*8.98846567431158e+307}else{if(!((q|0)<-1022)){break}w=w*2.2250738585072014e-308;n=q+1022|0;if(!((n|0)<-1022)){q=n;break}q=q+2044|0;q=(q|0)<-1022?-1022:q;w=w*2.2250738585072014e-308}}while(0);J=On(q+1023|0,0,52)|0;K=I;c[k>>2]=J;c[k+4>>2]=K;w=w*+h[k>>3];break}else if((B|0)==3){n=c[m>>2]|0;if(n>>>0<(c[p>>2]|0)>>>0){c[m>>2]=n+1;n=d[n>>0]|0}else{n=Dn(q)|0}if((n|0)==40){n=1}else{if((c[p>>2]|0)==0){w=x;break}c[m>>2]=(c[m>>2]|0)+ -1;w=x;break}while(1){o=c[m>>2]|0;if(o>>>0<(c[p>>2]|0)>>>0){c[m>>2]=o+1;o=d[o>>0]|0}else{o=Dn(q)|0}if(!((o+ -48|0)>>>0<10|(o+ -65|0)>>>0<26)?!((o+ -97|0)>>>0<26|(o|0)==95):0){break}n=n+1|0}if((o|0)==41){w=x;break}if((c[p>>2]|0)==0){w=x;break}o=(c[m>>2]|0)+ -1|0;c[m>>2]=o;if((n|0)==0){w=x;break}do{n=n+ -1|0;o=o+ -1|0}while((n|0)!=0);c[m>>2]=o;w=x;break}else{n=c[m>>2]|0;if((c[p>>2]|0)!=0){n=n+ -1|0;c[m>>2]=n}c[(bb()|0)>>2]=22;c[s>>2]=0;K=c[l>>2]|0;c[j>>2]=K-n;c[p>>2]=K;w=0.0;break}}else{g=25}}while(0);if((g|0)==21){if((c[p>>2]|0)!=0?(A=(c[m>>2]|0)+ -1|0,c[m>>2]=A,!(B>>>0<4)):0){do{A=A+ -1|0;B=B+ -1|0}while(B>>>0>3);c[m>>2]=A;g=25}else{g=25}}if((g|0)==25){w=+(n|0)*y}g=(c[m>>2]|0)-(c[l>>2]|0)+(c[j>>2]|0)|0;if((e|0)==0){i=f;return+w}if((g|0)!=0){b=b+g|0}c[e>>2]=b;i=f;return+w}function Gn(){c[1580]=o;c[2492]=o;c[2518]=o;c[5346]=o;c[5684]=o}function Hn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;b=b-d-(c>>>0>a>>>0|0)>>>0;return(I=b,a-c>>>0|0)|0}function In(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;c=a+c>>>0;return(I=b+d+(c>>>0<a>>>0|0)>>>0,c|0)|0}function Jn(b){b=b|0;var c=0;c=b;while(a[c>>0]|0){c=c+1|0}return c-b|0}function Kn(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b>>>c;return a>>>c|(b&(1<<c)-1)<<32-c}I=0;return b>>>c-32|0}function Ln(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;if((e|0)>=4096)return nb(b|0,d|0,e|0)|0;f=b|0;if((b&3)==(d&3)){while(b&3){if((e|0)==0)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}while((e|0)>=4){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0;e=e-4|0}}while((e|0)>0){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}return f|0}function Mn(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)<(b|0)&(b|0)<(c+d|0)){e=b;c=c+d|0;b=b+d|0;while((d|0)>0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else{Ln(b,c,d)|0}return b|0}function Nn(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;if((e|0)>=20){d=d&255;i=b&3;h=d|d<<8|d<<16|d<<24;g=f&~3;if(i){i=b+4-i|0;while((b|0)<(i|0)){a[b>>0]=d;b=b+1|0}}while((b|0)<(g|0)){c[b>>2]=h;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return b-e|0}function On(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b<<c|(a&(1<<c)-1<<32-c)>>>32-c;return a<<c}I=a<<c-32;return 0}function Pn(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b>>c;return a>>>c|(b&(1<<c)-1)<<32-c}I=(b|0)<0?-1:0;return b>>c-32|0}function Qn(b){b=b|0;var c=0;c=a[n+(b>>>24)>>0]|0;if((c|0)<8)return c|0;c=a[n+(b>>16&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[n+(b>>8&255)>>0]|0;if((c|0)<8)return c+16|0;return(a[n+(b&255)>>0]|0)+24|0}function Rn(b){b=b|0;var c=0;c=a[m+(b&255)>>0]|0;if((c|0)<8)return c|0;c=a[m+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[m+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return(a[m+(b>>>24)>>0]|0)+24|0}function Sn(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=a&65535;d=b&65535;c=ea(d,f)|0;e=a>>>16;d=(c>>>16)+(ea(d,e)|0)|0;b=b>>>16;a=ea(b,f)|0;return(I=(d>>>16)+(ea(b,e)|0)+(((d&65535)+a|0)>>>16)|0,d+a<<16|c&65535|0)|0}function Tn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;f=d>>31|((d|0)<0?-1:0)<<1;e=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;h=Hn(j^a,i^b,j,i)|0;g=I;b=f^j;a=e^i;a=Hn((Yn(h,g,Hn(f^c,e^d,f,e)|0,I,0)|0)^b,I^a,b,a)|0;return a|0}function Un(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;f=i;i=i+8|0;j=f|0;h=b>>31|((b|0)<0?-1:0)<<1;g=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;l=e>>31|((e|0)<0?-1:0)<<1;k=((e|0)<0?-1:0)>>31|((e|0)<0?-1:0)<<1;b=Hn(h^a,g^b,h,g)|0;a=I;Yn(b,a,Hn(l^d,k^e,l,k)|0,I,j)|0;a=Hn(c[j>>2]^h,c[j+4>>2]^g,h,g)|0;b=I;i=f;return(I=b,a)|0}function Vn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;f=c;a=Sn(e,f)|0;c=I;return(I=(ea(b,f)|0)+(ea(d,e)|0)+c|c&0,a|0|0)|0}function Wn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;a=Yn(a,b,c,d,0)|0;return a|0}function Xn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+8|0;f=g|0;Yn(a,b,d,e,f)|0;i=g;return(I=c[f+4>>2]|0,c[f>>2]|0)|0}function Yn(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;h=a;j=b;i=j;l=d;g=e;k=g;if((i|0)==0){g=(f|0)!=0;if((k|0)==0){if(g){c[f>>2]=(h>>>0)%(l>>>0);c[f+4>>2]=0}k=0;m=(h>>>0)/(l>>>0)>>>0;return(I=k,m)|0}else{if(!g){l=0;m=0;return(I=l,m)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;l=0;m=0;return(I=l,m)|0}}m=(k|0)==0;do{if((l|0)!=0){if(!m){k=(Qn(k|0)|0)-(Qn(i|0)|0)|0;if(k>>>0<=31){m=k+1|0;l=31-k|0;a=k-31>>31;j=m;b=h>>>(m>>>0)&a|i<<l;a=i>>>(m>>>0)&a;k=0;l=h<<l;break}if((f|0)==0){l=0;m=0;return(I=l,m)|0}c[f>>2]=a|0;c[f+4>>2]=j|b&0;l=0;m=0;return(I=l,m)|0}k=l-1|0;if((k&l|0)!=0){l=(Qn(l|0)|0)+33-(Qn(i|0)|0)|0;p=64-l|0;m=32-l|0;n=m>>31;o=l-32|0;a=o>>31;j=l;b=m-1>>31&i>>>(o>>>0)|(i<<m|h>>>(l>>>0))&a;a=a&i>>>(l>>>0);k=h<<p&n;l=(i<<p|h>>>(o>>>0))&n|h<<m&l-33>>31;break}if((f|0)!=0){c[f>>2]=k&h;c[f+4>>2]=0}if((l|0)==1){o=j|b&0;p=a|0|0;return(I=o,p)|0}else{p=Rn(l|0)|0;o=i>>>(p>>>0)|0;p=i<<32-p|h>>>(p>>>0)|0;return(I=o,p)|0}}else{if(m){if((f|0)!=0){c[f>>2]=(i>>>0)%(l>>>0);c[f+4>>2]=0}o=0;p=(i>>>0)/(l>>>0)>>>0;return(I=o,p)|0}if((h|0)==0){if((f|0)!=0){c[f>>2]=0;c[f+4>>2]=(i>>>0)%(k>>>0)}o=0;p=(i>>>0)/(k>>>0)>>>0;return(I=o,p)|0}l=k-1|0;if((l&k|0)==0){if((f|0)!=0){c[f>>2]=a|0;c[f+4>>2]=l&i|b&0}o=0;p=i>>>((Rn(k|0)|0)>>>0);return(I=o,p)|0}k=(Qn(k|0)|0)-(Qn(i|0)|0)|0;if(k>>>0<=30){a=k+1|0;l=31-k|0;j=a;b=i<<l|h>>>(a>>>0);a=i>>>(a>>>0);k=0;l=h<<l;break}if((f|0)==0){o=0;p=0;return(I=o,p)|0}c[f>>2]=a|0;c[f+4>>2]=j|b&0;o=0;p=0;return(I=o,p)|0}}while(0);if((j|0)==0){g=l;e=0;i=0}else{h=d|0|0;g=g|e&0;e=In(h,g,-1,-1)|0;d=I;i=0;do{m=l;l=k>>>31|l<<1;k=i|k<<1;m=b<<1|m>>>31|0;n=b>>>31|a<<1|0;Hn(e,d,m,n)|0;p=I;o=p>>31|((p|0)<0?-1:0)<<1;i=o&1;b=Hn(m,n,o&h,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&g)|0;a=I;j=j-1|0}while((j|0)!=0);g=l;e=0}h=0;if((f|0)!=0){c[f>>2]=b;c[f+4>>2]=a}o=(k|0)>>>31|(g|h)<<1|(h<<1|k>>>31)&0|e;p=(k<<1|0>>>31)&-2|i;return(I=o,p)|0} - - - -function Oi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;m=i;i=i+224|0;l=m+8|0;s=m;o=m+192|0;d=m+188|0;k=m+184|0;p=m+180|0;u=s;c[u>>2]=37;c[u+4>>2]=0;u=s+1|0;q=f+4|0;r=c[q>>2]|0;if((r&2048|0)!=0){a[u>>0]=43;u=s+2|0}if((r&512|0)!=0){a[u>>0]=35;u=u+1|0}t=u+2|0;a[u>>0]=108;a[u+1>>0]=108;u=r&74;do{if((u|0)==8){if((r&16384|0)==0){a[t>>0]=120;break}else{a[t>>0]=88;break}}else if((u|0)==64){a[t>>0]=111}else{a[t>>0]=117}}while(0);if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}u=c[3340]|0;t=l;c[t>>2]=h;c[t+4>>2]=j;h=wi(o,23,u,s,l)|0;j=o+h|0;q=c[q>>2]&176;do{if((q|0)==32){q=j}else if((q|0)==16){q=a[o>>0]|0;if(q<<24>>24==43|q<<24>>24==45){q=o+1|0;break}if((h|0)>1&q<<24>>24==48?(u=a[o+1>>0]|0,u<<24>>24==88|u<<24>>24==120):0){q=o+2|0}else{n=21}}else{n=21}}while(0);if((n|0)==21){q=o}n=c[f+28>>2]|0;c[p>>2]=n;n=n+4|0;c[n>>2]=(c[n>>2]|0)+1;Ki(o,q,j,l,d,k,p);n=c[p>>2]|0;t=n+4|0;u=c[t>>2]|0;c[t>>2]=u+ -1;if((u|0)!=0){s=c[e>>2]|0;t=c[d>>2]|0;u=c[k>>2]|0;Li(b,s,l,t,u,f,g);i=m;return}lc[c[(c[n>>2]|0)+8>>2]&255](n);s=c[e>>2]|0;t=c[d>>2]|0;u=c[k>>2]|0;Li(b,s,l,t,u,f,g);i=m;return}function Pi(b,d,e,f,g,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=+j;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;l=i;i=i+304|0;p=l;u=l+232|0;r=l+260|0;t=l+248|0;d=l+244|0;n=l+240|0;o=l+252|0;m=l+256|0;v=u;c[v>>2]=37;c[v+4>>2]=0;v=u+1|0;s=f+4|0;w=c[s>>2]|0;if((w&2048|0)!=0){a[v>>0]=43;v=u+2|0}if((w&1024|0)!=0){a[v>>0]=35;v=v+1|0}x=w&260;y=w>>>14;do{if((x|0)==260){if((y&1|0)==0){a[v>>0]=97;v=0;break}else{a[v>>0]=65;v=0;break}}else{a[v>>0]=46;w=v+2|0;a[v+1>>0]=42;if((x|0)==256){if((y&1|0)==0){a[w>>0]=101;v=1;break}else{a[w>>0]=69;v=1;break}}else if((x|0)==4){if((y&1|0)==0){a[w>>0]=102;v=1;break}else{a[w>>0]=70;v=1;break}}else{if((y&1|0)==0){a[w>>0]=103;v=1;break}else{a[w>>0]=71;v=1;break}}}}while(0);c[t>>2]=r;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;if(v){c[p>>2]=c[f+8>>2];y=p+4|0;h[k>>3]=j;c[y>>2]=c[k>>2];c[y+4>>2]=c[k+4>>2];w=wi(r,30,w,u,p)|0}else{h[k>>3]=j;c[p>>2]=c[k>>2];c[p+4>>2]=c[k+4>>2];w=wi(r,30,w,u,p)|0}if((w|0)>29){w=(a[13368]|0)==0;if(v){if(w?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;c[p>>2]=c[f+8>>2];y=p+4|0;h[k>>3]=j;c[y>>2]=c[k>>2];c[y+4>>2]=c[k+4>>2];w=Ci(t,w,u,p)|0}else{if(w?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;c[p>>2]=c[f+8>>2];y=p+4|0;h[k>>3]=j;c[y>>2]=c[k>>2];c[y+4>>2]=c[k+4>>2];w=Ci(t,w,u,p)|0}t=c[t>>2]|0;if((t|0)==0){y=Xa(4)|0;c[y>>2]=22680;wb(y|0,22728,206)}else{v=t}}else{v=c[t>>2]|0;t=0}u=v+w|0;s=c[s>>2]&176;do{if((s|0)==32){s=u}else if((s|0)==16){s=a[v>>0]|0;if(s<<24>>24==43|s<<24>>24==45){s=v+1|0;break}if((w|0)>1&s<<24>>24==48?(y=a[v+1>>0]|0,y<<24>>24==88|y<<24>>24==120):0){s=v+2|0}else{q=48}}else{q=48}}while(0);if((q|0)==48){s=v}if((v|0)!=(r|0)){p=un(w<<3)|0;if((p|0)==0){y=Xa(4)|0;c[y>>2]=22680;wb(y|0,22728,206)}else{r=v;q=p}}else{q=0}x=c[f+28>>2]|0;c[o>>2]=x;x=x+4|0;c[x>>2]=(c[x>>2]|0)+1;Qi(r,s,u,p,d,n,o);o=c[o>>2]|0;x=o+4|0;y=c[x>>2]|0;c[x>>2]=y+ -1;if((y|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}Li(m,c[e>>2]|0,p,c[d>>2]|0,c[n>>2]|0,f,g);y=c[m>>2]|0;c[e>>2]=y;c[b>>2]=y;if((q|0)!=0){vn(q)}if((t|0)==0){i=l;return}vn(t);i=l;return}function Qi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;k=i;i=i+32|0;o=k;l=k+12|0;q=c[j>>2]|0;if(!((c[3362]|0)==-1)){c[o>>2]=13448;c[o+4>>2]=208;c[o+8>>2]=0;cg(13448,o)}m=(c[13452>>2]|0)+ -1|0;t=c[q+8>>2]|0;if(!((c[q+12>>2]|0)-t>>2>>>0>m>>>0)){y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}m=c[t+(m<<2)>>2]|0;if((m|0)==0){y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}j=c[j>>2]|0;if(!((c[3402]|0)==-1)){c[o>>2]=13608;c[o+4>>2]=208;c[o+8>>2]=0;cg(13608,o)}o=(c[13612>>2]|0)+ -1|0;q=c[j+8>>2]|0;if(!((c[j+12>>2]|0)-q>>2>>>0>o>>>0)){y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}j=c[q+(o<<2)>>2]|0;if((j|0)==0){y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}mc[c[(c[j>>2]|0)+20>>2]&127](l,j);c[h>>2]=f;o=a[b>>0]|0;if(o<<24>>24==43|o<<24>>24==45){y=xc[c[(c[m>>2]|0)+44>>2]&63](m,o)|0;t=c[h>>2]|0;c[h>>2]=t+4;c[t>>2]=y;t=b+1|0}else{t=b}o=e;a:do{if(((o-t|0)>1?(a[t>>0]|0)==48:0)?(p=t+1|0,y=a[p>>0]|0,y<<24>>24==88|y<<24>>24==120):0){y=xc[c[(c[m>>2]|0)+44>>2]&63](m,48)|0;x=c[h>>2]|0;c[h>>2]=x+4;c[x>>2]=y;t=t+2|0;x=xc[c[(c[m>>2]|0)+44>>2]&63](m,a[p>>0]|0)|0;y=c[h>>2]|0;c[h>>2]=y+4;c[y>>2]=x;if(t>>>0<e>>>0){q=t;while(1){p=a[q>>0]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}y=p<<24>>24;if(!((y+ -48|0)>>>0<10)?!(((y|32)+ -97|0)>>>0<6):0){p=t;break a}q=q+1|0;if(!(q>>>0<e>>>0)){p=t;break}}}else{p=t;q=t}}else{s=15}}while(0);b:do{if((s|0)==15){if(t>>>0<e>>>0){q=t;while(1){p=a[q>>0]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}s=q+1|0;if(!(((p<<24>>24)+ -48|0)>>>0<10)){p=t;break b}if(s>>>0<e>>>0){q=s}else{p=t;q=s;break}}}else{p=t;q=t}}}while(0);s=a[l>>0]|0;if((s&1)==0){s=(s&255)>>>1}else{s=c[l+4>>2]|0}if((s|0)!=0){if((p|0)!=(q|0)?(r=q+ -1|0,r>>>0>p>>>0):0){s=p;do{y=a[s>>0]|0;a[s>>0]=a[r>>0]|0;a[r>>0]=y;s=s+1|0;r=r+ -1|0}while(s>>>0<r>>>0)}v=oc[c[(c[j>>2]|0)+16>>2]&127](j)|0;if(p>>>0<q>>>0){t=l+1|0;r=l+4|0;u=l+8|0;x=0;w=0;s=p;while(1){y=a[((a[l>>0]&1)==0?t:c[u>>2]|0)+w>>0]|0;if(y<<24>>24>0&(x|0)==(y<<24>>24|0)){x=c[h>>2]|0;c[h>>2]=x+4;c[x>>2]=v;x=a[l>>0]|0;if((x&1)==0){y=(x&255)>>>1}else{y=c[r>>2]|0}x=0;w=(w>>>0<(y+ -1|0)>>>0&1)+w|0}A=xc[c[(c[m>>2]|0)+44>>2]&63](m,a[s>>0]|0)|0;z=c[h>>2]|0;y=z+4|0;c[h>>2]=y;c[z>>2]=A;s=s+1|0;if(!(s>>>0<q>>>0)){break}else{x=x+1|0}}}else{y=c[h>>2]|0}p=f+(p-b<<2)|0;if((p|0)!=(y|0)?(n=y+ -4|0,n>>>0>p>>>0):0){do{A=c[p>>2]|0;c[p>>2]=c[n>>2];c[n>>2]=A;p=p+4|0;n=n+ -4|0}while(p>>>0<n>>>0)}}else{uc[c[(c[m>>2]|0)+48>>2]&31](m,p,q,c[h>>2]|0)|0;y=(c[h>>2]|0)+(q-p<<2)|0;c[h>>2]=y}c:do{if(q>>>0<e>>>0){while(1){n=a[q>>0]|0;if(n<<24>>24==46){break}z=xc[c[(c[m>>2]|0)+44>>2]&63](m,n)|0;A=c[h>>2]|0;y=A+4|0;c[h>>2]=y;c[A>>2]=z;q=q+1|0;if(!(q>>>0<e>>>0)){break c}}z=oc[c[(c[j>>2]|0)+12>>2]&127](j)|0;A=c[h>>2]|0;y=A+4|0;c[h>>2]=y;c[A>>2]=z;q=q+1|0}}while(0);uc[c[(c[m>>2]|0)+48>>2]&31](m,q,e,y)|0;m=(c[h>>2]|0)+(o-q<<2)|0;c[h>>2]=m;if((d|0)!=(e|0)){m=f+(d-b<<2)|0}c[g>>2]=m;if((a[l>>0]&1)==0){i=k;return}g=c[l+8>>2]|0;if((g|0)==0){i=k;return}vn(g);i=k;return}function Ri(b,d,e,f,g,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=+j;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;l=i;i=i+304|0;p=l;u=l+232|0;r=l+260|0;t=l+248|0;m=l+244|0;d=l+240|0;o=l+252|0;n=l+256|0;x=u;c[x>>2]=37;c[x+4>>2]=0;x=u+1|0;s=f+4|0;v=c[s>>2]|0;if((v&2048|0)!=0){a[x>>0]=43;x=u+2|0}if((v&1024|0)!=0){a[x>>0]=35;x=x+1|0}w=v&260;v=v>>>14;do{if((w|0)==260){a[x>>0]=76;w=x+1|0;if((v&1|0)==0){a[w>>0]=97;v=0;break}else{a[w>>0]=65;v=0;break}}else{a[x>>0]=46;a[x+1>>0]=42;a[x+2>>0]=76;x=x+3|0;if((w|0)==4){if((v&1|0)==0){a[x>>0]=102;v=1;break}else{a[x>>0]=70;v=1;break}}else if((w|0)==256){if((v&1|0)==0){a[x>>0]=101;v=1;break}else{a[x>>0]=69;v=1;break}}else{if((v&1|0)==0){a[x>>0]=103;v=1;break}else{a[x>>0]=71;v=1;break}}}}while(0);c[t>>2]=r;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;if(v){c[p>>2]=c[f+8>>2];x=p+4|0;h[k>>3]=j;c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];w=wi(r,30,w,u,p)|0}else{h[k>>3]=j;c[p>>2]=c[k>>2];c[p+4>>2]=c[k+4>>2];w=wi(r,30,w,u,p)|0}if((w|0)>29){w=(a[13368]|0)==0;if(v){if(w?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;c[p>>2]=c[f+8>>2];x=p+4|0;h[k>>3]=j;c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];w=Ci(t,w,u,p)|0}else{if(w?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}w=c[3340]|0;h[k>>3]=j;c[p>>2]=c[k>>2];c[p+4>>2]=c[k+4>>2];w=Ci(t,w,u,p)|0}t=c[t>>2]|0;if((t|0)==0){x=Xa(4)|0;c[x>>2]=22680;wb(x|0,22728,206)}else{v=t}}else{v=c[t>>2]|0;t=0}u=v+w|0;s=c[s>>2]&176;do{if((s|0)==32){s=u}else if((s|0)==16){s=a[v>>0]|0;if(s<<24>>24==43|s<<24>>24==45){s=v+1|0;break}if((w|0)>1&s<<24>>24==48?(x=a[v+1>>0]|0,x<<24>>24==88|x<<24>>24==120):0){s=v+2|0}else{q=48}}else{q=48}}while(0);if((q|0)==48){s=v}if((v|0)!=(r|0)){p=un(w<<3)|0;if((p|0)==0){x=Xa(4)|0;c[x>>2]=22680;wb(x|0,22728,206)}else{r=v;q=p}}else{q=0}w=c[f+28>>2]|0;c[o>>2]=w;w=w+4|0;c[w>>2]=(c[w>>2]|0)+1;Qi(r,s,u,p,m,d,o);o=c[o>>2]|0;w=o+4|0;x=c[w>>2]|0;c[w>>2]=x+ -1;if((x|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}Li(n,c[e>>2]|0,p,c[m>>2]|0,c[d>>2]|0,f,g);x=c[n>>2]|0;c[e>>2]=x;c[b>>2]=x;if((q|0)!=0){vn(q)}if((t|0)==0){i=l;return}vn(t);i=l;return}function Si(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=i;i=i+192|0;n=d;o=d+180|0;k=d+160|0;l=d+12|0;a[o+0>>0]=a[12272>>0]|0;a[o+1>>0]=a[12273>>0]|0;a[o+2>>0]=a[12274>>0]|0;a[o+3>>0]=a[12275>>0]|0;a[o+4>>0]=a[12276>>0]|0;a[o+5>>0]=a[12277>>0]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}p=c[3340]|0;c[n>>2]=h;o=wi(k,20,p,o,n)|0;h=k+o|0;p=c[f+4>>2]&176;do{if((p|0)==32){p=h}else if((p|0)==16){p=a[k>>0]|0;if(p<<24>>24==43|p<<24>>24==45){p=k+1|0;break}if((o|0)>1&p<<24>>24==48?(q=a[k+1>>0]|0,q<<24>>24==88|q<<24>>24==120):0){p=k+2|0}else{m=11}}else{m=11}}while(0);if((m|0)==11){p=k}m=c[f+28>>2]|0;q=m+4|0;c[q>>2]=(c[q>>2]|0)+1;if(!((c[3362]|0)==-1)){c[n>>2]=13448;c[n+4>>2]=208;c[n+8>>2]=0;cg(13448,n)}q=(c[13452>>2]|0)+ -1|0;n=c[m+8>>2]|0;if((c[m+12>>2]|0)-n>>2>>>0>q>>>0?(j=c[n+(q<<2)>>2]|0,(j|0)!=0):0){n=m+4|0;q=c[n>>2]|0;c[n>>2]=q+ -1;if((q|0)==0){lc[c[(c[m>>2]|0)+8>>2]&255](m)}uc[c[(c[j>>2]|0)+48>>2]&31](j,k,h,l)|0;j=l+(o<<2)|0;if((p|0)==(h|0)){q=j;p=c[e>>2]|0;Li(b,p,l,q,j,f,g);i=d;return}q=l+(p-k<<2)|0;p=c[e>>2]|0;Li(b,p,l,q,j,f,g);i=d;return}q=Xa(4)|0;c[q>>2]=21304;wb(q|0,21376,196)}function Ti(e,f,g,h,j,k,l,m,n){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;var o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;p=i;i=i+32|0;q=p;r=p+24|0;u=p+20|0;t=p+16|0;s=p+12|0;y=c[j+28>>2]|0;D=y+4|0;c[D>>2]=(c[D>>2]|0)+1;if(!((c[3364]|0)==-1)){c[q>>2]=13456;c[q+4>>2]=208;c[q+8>>2]=0;cg(13456,q)}x=(c[13460>>2]|0)+ -1|0;z=c[y+8>>2]|0;if((c[y+12>>2]|0)-z>>2>>>0>x>>>0?(w=c[z+(x<<2)>>2]|0,(w|0)!=0):0){C=y+4|0;D=c[C>>2]|0;c[C>>2]=D+ -1;if((D|0)==0){lc[c[(c[y>>2]|0)+8>>2]&255](y)}c[k>>2]=0;a:do{if((m|0)!=(n|0)){x=w+8|0;y=0;b:while(1){z=y;y=g;while(1){if((z|0)!=0){g=y;break a}if((y|0)!=0){if((c[y+12>>2]|0)==(c[y+16>>2]|0)){D=(oc[c[(c[y>>2]|0)+36>>2]&127](y)|0)==-1;g=D?0:y;y=D?0:y}else{g=y}}else{g=0;y=0}z=(g|0)==0;do{if((h|0)!=0){if((c[h+12>>2]|0)==(c[h+16>>2]|0)?(oc[c[(c[h>>2]|0)+36>>2]&127](h)|0)==-1:0){o=20;break}if(!z){o=21;break b}}else{o=20}}while(0);if((o|0)==20){o=0;if(z){h=0;o=21;break b}else{h=0}}if((hc[c[(c[w>>2]|0)+36>>2]&63](w,a[m>>0]|0,0)|0)<<24>>24==37){o=23;break}z=a[m>>0]|0;if(z<<24>>24>-1?(v=c[x>>2]|0,!((b[v+(z<<24>>24<<1)>>1]&8192)==0)):0){o=34;break}z=g+12|0;B=c[z>>2]|0;A=g+16|0;if((B|0)==(c[A>>2]|0)){B=oc[c[(c[g>>2]|0)+36>>2]&127](g)|0}else{B=d[B>>0]|0}D=xc[c[(c[w>>2]|0)+12>>2]&63](w,B&255)|0;if(D<<24>>24==(xc[c[(c[w>>2]|0)+12>>2]&63](w,a[m>>0]|0)|0)<<24>>24){o=59;break}c[k>>2]=4;z=4}c:do{if((o|0)==23){o=0;z=m+1|0;if((z|0)==(n|0)){o=24;break b}y=hc[c[(c[w>>2]|0)+36>>2]&63](w,a[z>>0]|0,0)|0;if(y<<24>>24==48|y<<24>>24==69){z=m+2|0;if((z|0)==(n|0)){o=27;break b}m=z;z=hc[c[(c[w>>2]|0)+36>>2]&63](w,a[z>>0]|0,0)|0}else{m=z;z=y;y=0}D=c[(c[f>>2]|0)+36>>2]|0;c[t>>2]=g;c[s>>2]=h;c[r+0>>2]=c[t+0>>2];c[q+0>>2]=c[s+0>>2];nc[D&31](u,f,r,q,j,k,l,z,y);m=m+1|0;g=c[u>>2]|0}else if((o|0)==34){while(1){o=0;m=m+1|0;if((m|0)==(n|0)){m=n;break}z=a[m>>0]|0;if(!(z<<24>>24>-1)){break}if((b[v+(z<<24>>24<<1)>>1]&8192)==0){break}else{o=34}}B=h;A=h;while(1){if((g|0)!=0){if((c[g+12>>2]|0)==(c[g+16>>2]|0)){D=(oc[c[(c[g>>2]|0)+36>>2]&127](g)|0)==-1;g=D?0:g;y=D?0:y}}else{g=0}C=(g|0)==0;do{if((A|0)!=0){if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){if(C){z=B;break}else{g=y;break c}}if(!((oc[c[(c[A>>2]|0)+36>>2]&127](A)|0)==-1)){if(C^(B|0)==0){z=B;A=B}else{g=y;break c}}else{z=0;h=0;o=45}}else{z=B;o=45}}while(0);if((o|0)==45){o=0;if(C){g=y;break c}else{A=0}}B=g+12|0;D=c[B>>2]|0;C=g+16|0;if((D|0)==(c[C>>2]|0)){D=oc[c[(c[g>>2]|0)+36>>2]&127](g)|0}else{D=d[D>>0]|0}if(!((D&255)<<24>>24>-1)){g=y;break c}if((b[(c[x>>2]|0)+(D<<24>>24<<1)>>1]&8192)==0){g=y;break c}D=c[B>>2]|0;if((D|0)==(c[C>>2]|0)){oc[c[(c[g>>2]|0)+40>>2]&127](g)|0;B=z;continue}else{c[B>>2]=D+1;B=z;continue}}}else if((o|0)==59){o=0;B=c[z>>2]|0;if((B|0)==(c[A>>2]|0)){oc[c[(c[g>>2]|0)+40>>2]&127](g)|0}else{c[z>>2]=B+1}m=m+1|0;g=y}}while(0);if((m|0)==(n|0)){break a}y=c[k>>2]|0}if((o|0)==21){c[k>>2]=4;break}else if((o|0)==24){c[k>>2]=4;break}else if((o|0)==27){c[k>>2]=4;break}}}while(0);if((g|0)!=0){if((c[g+12>>2]|0)==(c[g+16>>2]|0)){D=(oc[c[(c[g>>2]|0)+36>>2]&127](g)|0)==-1;g=D?0:g}}else{g=0}f=(g|0)==0;do{if((h|0)!=0){if((c[h+12>>2]|0)==(c[h+16>>2]|0)?(oc[c[(c[h>>2]|0)+36>>2]&127](h)|0)==-1:0){o=71;break}if(f){c[e>>2]=g;i=p;return}}else{o=71}}while(0);if((o|0)==71?!f:0){c[e>>2]=g;i=p;return}c[k>>2]=c[k>>2]|2;c[e>>2]=g;i=p;return}D=Xa(4)|0;c[D>>2]=21304;wb(D|0,21376,196)}function Ui(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Vi(a){a=a|0;return}function Wi(a){a=a|0;return 2}function Xi(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0;j=i;Ti(a,b,c[d>>2]|0,c[e>>2]|0,f,g,h,12376,12384|0);i=j;return}function Yi(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0;k=i;m=d+8|0;m=oc[c[(c[m>>2]|0)+20>>2]&127](m)|0;n=a[m>>0]|0;if((n&1)==0){l=m+1|0;m=(n&255)>>>1}else{l=c[m+8>>2]|0;m=c[m+4>>2]|0}Ti(b,d,c[e>>2]|0,c[f>>2]|0,g,h,j,l,l+m|0);i=k;return}function Zi(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0;j=i;i=i+16|0;l=j;f=c[f+28>>2]|0;m=f+4|0;c[m>>2]=(c[m>>2]|0)+1;if(!((c[3364]|0)==-1)){c[l>>2]=13456;c[l+4>>2]=208;c[l+8>>2]=0;cg(13456,l)}l=(c[13460>>2]|0)+ -1|0;m=c[f+8>>2]|0;if((c[f+12>>2]|0)-m>>2>>>0>l>>>0?(k=c[m+(l<<2)>>2]|0,(k|0)!=0):0){l=f+4|0;m=c[l>>2]|0;c[l>>2]=m+ -1;if((m|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}m=c[e>>2]|0;b=b+8|0;b=oc[c[c[b>>2]>>2]&127](b)|0;b=(Mh(d,m,b,b+168|0,k,g,0)|0)-b|0;if((b|0)>=168){m=c[d>>2]|0;c[a>>2]=m;i=j;return}c[h+24>>2]=((b|0)/12|0|0)%7|0;m=c[d>>2]|0;c[a>>2]=m;i=j;return}m=Xa(4)|0;c[m>>2]=21304;wb(m|0,21376,196)}function _i(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0;j=i;i=i+16|0;l=j;f=c[f+28>>2]|0;m=f+4|0;c[m>>2]=(c[m>>2]|0)+1;if(!((c[3364]|0)==-1)){c[l>>2]=13456;c[l+4>>2]=208;c[l+8>>2]=0;cg(13456,l)}l=(c[13460>>2]|0)+ -1|0;m=c[f+8>>2]|0;if((c[f+12>>2]|0)-m>>2>>>0>l>>>0?(k=c[m+(l<<2)>>2]|0,(k|0)!=0):0){l=f+4|0;m=c[l>>2]|0;c[l>>2]=m+ -1;if((m|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}m=c[e>>2]|0;b=b+8|0;b=oc[c[(c[b>>2]|0)+4>>2]&127](b)|0;b=(Mh(d,m,b,b+288|0,k,g,0)|0)-b|0;if((b|0)>=288){m=c[d>>2]|0;c[a>>2]=m;i=j;return}c[h+16>>2]=((b|0)/12|0|0)%12|0;m=c[d>>2]|0;c[a>>2]=m;i=j;return}m=Xa(4)|0;c[m>>2]=21304;wb(m|0,21376,196)}function $i(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0;b=i;i=i+16|0;k=b;f=c[f+28>>2]|0;l=f+4|0;c[l>>2]=(c[l>>2]|0)+1;if(!((c[3364]|0)==-1)){c[k>>2]=13456;c[k+4>>2]=208;c[k+8>>2]=0;cg(13456,k)}k=(c[13460>>2]|0)+ -1|0;l=c[f+8>>2]|0;if((c[f+12>>2]|0)-l>>2>>>0>k>>>0?(j=c[l+(k<<2)>>2]|0,(j|0)!=0):0){k=f+4|0;l=c[k>>2]|0;c[k>>2]=l+ -1;if((l|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}e=bj(d,c[e>>2]|0,g,j,4)|0;if((c[g>>2]&4|0)!=0){l=c[d>>2]|0;c[a>>2]=l;i=b;return}if((e|0)<69){g=e+2e3|0}else{g=(e+ -69|0)>>>0<31?e+1900|0:e}c[h+20>>2]=g+ -1900;l=c[d>>2]|0;c[a>>2]=l;i=b;return}l=Xa(4)|0;c[l>>2]=21304;wb(l|0,21376,196)}function aj(e,f,g,h,j,k,l,m,n){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;var o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;n=i;i=i+64|0;w=n;E=n+16|0;r=n+28|0;u=n+24|0;v=n+32|0;y=n+12|0;z=n+20|0;x=n+36|0;B=n+40|0;t=n+44|0;s=n+48|0;c[k>>2]=0;A=c[j+28>>2]|0;D=A+4|0;c[D>>2]=(c[D>>2]|0)+1;if(!((c[3364]|0)==-1)){c[w>>2]=13456;c[w+4>>2]=208;c[w+8>>2]=0;cg(13456,w)}C=(c[13460>>2]|0)+ -1|0;D=c[A+8>>2]|0;if((c[A+12>>2]|0)-D>>2>>>0>C>>>0?(p=c[D+(C<<2)>>2]|0,(p|0)!=0):0){C=A+4|0;D=c[C>>2]|0;c[C>>2]=D+ -1;if((D|0)==0){lc[c[(c[A>>2]|0)+8>>2]&255](A)}a:do{switch(m<<24>>24|0){case 112:{o=l+8|0;l=c[h>>2]|0;h=f+8|0;h=oc[c[(c[h>>2]|0)+8>>2]&127](h)|0;f=a[h>>0]|0;if((f&1)==0){f=(f&255)>>>1}else{f=c[h+4>>2]|0}j=a[h+12>>0]|0;if((j&1)==0){j=(j&255)>>>1}else{j=c[h+16>>2]|0}if((f|0)==(0-j|0)){c[k>>2]=c[k>>2]|4;break a}E=Mh(g,l,h,h+24|0,p,k,0)|0;k=E-h|0;if((E|0)==(h|0)?(c[o>>2]|0)==12:0){c[o>>2]=0;break a}if((k|0)==12?(q=c[o>>2]|0,(q|0)<12):0){c[o>>2]=q+12}break};case 120:{D=c[(c[f>>2]|0)+20>>2]|0;c[B>>2]=c[g>>2];c[t>>2]=c[h>>2];c[E+0>>2]=c[B+0>>2];c[w+0>>2]=c[t+0>>2];ic[D&63](e,f,E,w,j,k,l);i=n;return};case 88:{q=f+8|0;q=oc[c[(c[q>>2]|0)+24>>2]&127](q)|0;p=a[q>>0]|0;if((p&1)==0){o=q+1|0;p=(p&255)>>>1}else{o=c[q+8>>2]|0;p=c[q+4>>2]|0}Ti(s,f,c[g>>2]|0,c[h>>2]|0,j,k,l,o,o+p|0);c[g>>2]=c[s>>2];break};case 121:{o=l+20|0;l=bj(g,c[h>>2]|0,k,p,4)|0;if((c[k>>2]&4|0)==0){if((l|0)<69){k=l+2e3|0}else{k=(l+ -69|0)>>>0<31?l+1900|0:l}c[o>>2]=k+ -1900}break};case 83:{o=bj(g,c[h>>2]|0,k,p,2)|0;p=c[k>>2]|0;if((p&4|0)==0&(o|0)<61){c[l>>2]=o;break a}else{c[k>>2]=p|4;break a}};case 82:{Ti(z,f,c[g>>2]|0,c[h>>2]|0,j,k,l,12416,12421|0);c[g>>2]=c[z>>2];break};case 114:{Ti(y,f,c[g>>2]|0,c[h>>2]|0,j,k,l,12400,12411|0);c[g>>2]=c[y>>2];break};case 89:{o=bj(g,c[h>>2]|0,k,p,4)|0;if((c[k>>2]&4|0)==0){c[l+20>>2]=o+ -1900}break};case 37:{l=c[h>>2]|0;h=c[g>>2]|0;do{if((h|0)!=0){if((c[h+12>>2]|0)==(c[h+16>>2]|0)){if((oc[c[(c[h>>2]|0)+36>>2]&127](h)|0)==-1){c[g>>2]=0;h=0;break}else{h=c[g>>2]|0;break}}}else{h=0}}while(0);h=(h|0)==0;do{if((l|0)!=0){if((c[l+12>>2]|0)==(c[l+16>>2]|0)?(oc[c[(c[l>>2]|0)+36>>2]&127](l)|0)==-1:0){o=115;break}if(!h){o=116}}else{o=115}}while(0);if((o|0)==115){if(h){o=116}else{l=0}}if((o|0)==116){c[k>>2]=c[k>>2]|6;break a}h=c[g>>2]|0;f=c[h+12>>2]|0;if((f|0)==(c[h+16>>2]|0)){h=oc[c[(c[h>>2]|0)+36>>2]&127](h)|0}else{h=d[f>>0]|0}if(!((hc[c[(c[p>>2]|0)+36>>2]&63](p,h&255,0)|0)<<24>>24==37)){c[k>>2]=c[k>>2]|4;break a}p=c[g>>2]|0;h=p+12|0;f=c[h>>2]|0;if((f|0)==(c[p+16>>2]|0)){oc[c[(c[p>>2]|0)+40>>2]&127](p)|0}else{c[h>>2]=f+1}p=c[g>>2]|0;do{if((p|0)!=0){if((c[p+12>>2]|0)==(c[p+16>>2]|0)){if((oc[c[(c[p>>2]|0)+36>>2]&127](p)|0)==-1){c[g>>2]=0;p=0;break}else{p=c[g>>2]|0;break}}}else{p=0}}while(0);p=(p|0)==0;do{if((l|0)!=0){if((c[l+12>>2]|0)==(c[l+16>>2]|0)?(oc[c[(c[l>>2]|0)+36>>2]&127](l)|0)==-1:0){o=134;break}if(p){break a}}else{o=134}}while(0);if((o|0)==134?!p:0){break a}c[k>>2]=c[k>>2]|2;break};case 84:{Ti(x,f,c[g>>2]|0,c[h>>2]|0,j,k,l,12424,12432|0);c[g>>2]=c[x>>2];break};case 119:{o=bj(g,c[h>>2]|0,k,p,1)|0;p=c[k>>2]|0;if((p&4|0)==0&(o|0)<7){c[l+24>>2]=o;break a}else{c[k>>2]=p|4;break a}};case 109:{o=bj(g,c[h>>2]|0,k,p,2)|0;p=c[k>>2]|0;if((p&4|0)==0&(o|0)<13){c[l+16>>2]=o+ -1;break a}else{c[k>>2]=p|4;break a}};case 77:{o=bj(g,c[h>>2]|0,k,p,2)|0;p=c[k>>2]|0;if((p&4|0)==0&(o|0)<60){c[l+4>>2]=o;break a}else{c[k>>2]=p|4;break a}};case 106:{o=bj(g,c[h>>2]|0,k,p,3)|0;p=c[k>>2]|0;if((p&4|0)==0&(o|0)<366){c[l+28>>2]=o;break a}else{c[k>>2]=p|4;break a}};case 72:{p=bj(g,c[h>>2]|0,k,p,2)|0;o=c[k>>2]|0;if((o&4|0)==0&(p|0)<24){c[l+8>>2]=p;break a}else{c[k>>2]=o|4;break a}};case 70:{Ti(v,f,c[g>>2]|0,c[h>>2]|0,j,k,l,12392,12400|0);c[g>>2]=c[v>>2];break};case 68:{Ti(u,f,c[g>>2]|0,c[h>>2]|0,j,k,l,12384,12392|0);c[g>>2]=c[u>>2];break};case 104:case 66:case 98:{D=c[h>>2]|0;E=f+8|0;E=oc[c[(c[E>>2]|0)+4>>2]&127](E)|0;k=(Mh(g,D,E,E+288|0,p,k,0)|0)-E|0;if((k|0)<288){c[l+16>>2]=((k|0)/12|0|0)%12|0}break};case 73:{o=l+8|0;l=bj(g,c[h>>2]|0,k,p,2)|0;p=c[k>>2]|0;if((p&4|0)==0?(l+ -1|0)>>>0<12:0){c[o>>2]=l;break a}c[k>>2]=p|4;break};case 65:case 97:{D=c[h>>2]|0;E=f+8|0;E=oc[c[c[E>>2]>>2]&127](E)|0;k=(Mh(g,D,E,E+168|0,p,k,0)|0)-E|0;if((k|0)<168){c[l+24>>2]=((k|0)/12|0|0)%7|0}break};case 101:case 100:{o=l+12|0;l=bj(g,c[h>>2]|0,k,p,2)|0;p=c[k>>2]|0;if((p&4|0)==0?(l+ -1|0)>>>0<31:0){c[o>>2]=l;break a}c[k>>2]=p|4;break};case 116:case 110:{l=p+8|0;p=c[h>>2]|0;b:while(1){h=c[g>>2]|0;do{if((h|0)!=0){if((c[h+12>>2]|0)==(c[h+16>>2]|0)){if((oc[c[(c[h>>2]|0)+36>>2]&127](h)|0)==-1){c[g>>2]=0;h=0;break}else{h=c[g>>2]|0;break}}}else{h=0}}while(0);h=(h|0)==0;do{if((p|0)!=0){if((c[p+12>>2]|0)!=(c[p+16>>2]|0)){if(h){break}else{break b}}if(!((oc[c[(c[p>>2]|0)+36>>2]&127](p)|0)==-1)){if(!h){break b}}else{o=50}}else{o=50}}while(0);if((o|0)==50){o=0;if(h){p=0;break}else{p=0}}h=c[g>>2]|0;f=c[h+12>>2]|0;if((f|0)==(c[h+16>>2]|0)){h=oc[c[(c[h>>2]|0)+36>>2]&127](h)|0}else{h=d[f>>0]|0}if(!((h&255)<<24>>24>-1)){break}if((b[(c[l>>2]|0)+(h<<24>>24<<1)>>1]&8192)==0){break}j=c[g>>2]|0;h=j+12|0;f=c[h>>2]|0;if((f|0)==(c[j+16>>2]|0)){oc[c[(c[j>>2]|0)+40>>2]&127](j)|0;continue}else{c[h>>2]=f+1;continue}}l=c[g>>2]|0;do{if((l|0)!=0){if((c[l+12>>2]|0)==(c[l+16>>2]|0)){if((oc[c[(c[l>>2]|0)+36>>2]&127](l)|0)==-1){c[g>>2]=0;l=0;break}else{l=c[g>>2]|0;break}}}else{l=0}}while(0);l=(l|0)==0;do{if((p|0)!=0){if((c[p+12>>2]|0)==(c[p+16>>2]|0)?(oc[c[(c[p>>2]|0)+36>>2]&127](p)|0)==-1:0){o=69;break}if(l){break a}}else{o=69}}while(0);if((o|0)==69?!l:0){break a}c[k>>2]=c[k>>2]|2;break};case 99:{q=f+8|0;q=oc[c[(c[q>>2]|0)+12>>2]&127](q)|0;p=a[q>>0]|0;if((p&1)==0){o=q+1|0;p=(p&255)>>>1}else{o=c[q+8>>2]|0;p=c[q+4>>2]|0}Ti(r,f,c[g>>2]|0,c[h>>2]|0,j,k,l,o,o+p|0);c[g>>2]=c[r>>2];break};default:{c[k>>2]=c[k>>2]|4}}}while(0);c[e>>2]=c[g>>2];i=n;return}E=Xa(4)|0;c[E>>2]=21304;wb(E|0,21376,196)}function bj(a,e,f,g,h){a=a|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=i;l=c[a>>2]|0;do{if((l|0)!=0){if((c[l+12>>2]|0)==(c[l+16>>2]|0)){if((oc[c[(c[l>>2]|0)+36>>2]&127](l)|0)==-1){c[a>>2]=0;l=0;break}else{l=c[a>>2]|0;break}}}else{l=0}}while(0);l=(l|0)==0;do{if((e|0)!=0){if((c[e+12>>2]|0)==(c[e+16>>2]|0)?(oc[c[(c[e>>2]|0)+36>>2]&127](e)|0)==-1:0){m=10;break}if(!l){m=11}}else{m=10}}while(0);if((m|0)==10){if(l){m=11}else{e=0}}if((m|0)==11){c[f>>2]=c[f>>2]|6;p=0;i=j;return p|0}m=c[a>>2]|0;l=c[m+12>>2]|0;if((l|0)==(c[m+16>>2]|0)){m=oc[c[(c[m>>2]|0)+36>>2]&127](m)|0}else{m=d[l>>0]|0}l=m&255;if(l<<24>>24>-1?(k=g+8|0,!((b[(c[k>>2]|0)+(m<<24>>24<<1)>>1]&2048)==0)):0){l=(hc[c[(c[g>>2]|0)+36>>2]&63](g,l,0)|0)<<24>>24;o=c[a>>2]|0;m=o+12|0;n=c[m>>2]|0;if((n|0)==(c[o+16>>2]|0)){oc[c[(c[o>>2]|0)+40>>2]&127](o)|0;n=e;m=e}else{c[m>>2]=n+1;n=e;m=e}while(1){l=l+ -48|0;h=h+ -1|0;e=c[a>>2]|0;do{if((e|0)!=0){if((c[e+12>>2]|0)==(c[e+16>>2]|0)){if((oc[c[(c[e>>2]|0)+36>>2]&127](e)|0)==-1){c[a>>2]=0;e=0;break}else{e=c[a>>2]|0;break}}}else{e=0}}while(0);o=(e|0)==0;if((m|0)!=0){if((c[m+12>>2]|0)==(c[m+16>>2]|0)){m=(oc[c[(c[m>>2]|0)+36>>2]&127](m)|0)==-1;e=m?0:n;m=m?0:n}else{e=n}}else{e=n;m=0}n=c[a>>2]|0;if(!((o^(m|0)==0)&(h|0)>0)){m=38;break}o=c[n+12>>2]|0;if((o|0)==(c[n+16>>2]|0)){n=oc[c[(c[n>>2]|0)+36>>2]&127](n)|0}else{n=d[o>>0]|0}o=n&255;if(!(o<<24>>24>-1)){m=49;break}if((b[(c[k>>2]|0)+(n<<24>>24<<1)>>1]&2048)==0){m=49;break}l=((hc[c[(c[g>>2]|0)+36>>2]&63](g,o,0)|0)<<24>>24)+(l*10|0)|0;n=c[a>>2]|0;p=n+12|0;o=c[p>>2]|0;if((o|0)==(c[n+16>>2]|0)){oc[c[(c[n>>2]|0)+40>>2]&127](n)|0;n=e;continue}else{c[p>>2]=o+1;n=e;continue}}if((m|0)==38){do{if((n|0)!=0){if((c[n+12>>2]|0)==(c[n+16>>2]|0)){if((oc[c[(c[n>>2]|0)+36>>2]&127](n)|0)==-1){c[a>>2]=0;n=0;break}else{n=c[a>>2]|0;break}}}else{n=0}}while(0);g=(n|0)==0;do{if((e|0)!=0){if((c[e+12>>2]|0)==(c[e+16>>2]|0)?(oc[c[(c[e>>2]|0)+36>>2]&127](e)|0)==-1:0){m=47;break}if(g){p=l;i=j;return p|0}}else{m=47}}while(0);if((m|0)==47?!g:0){p=l;i=j;return p|0}c[f>>2]=c[f>>2]|2;p=l;i=j;return p|0}else if((m|0)==49){i=j;return l|0}}c[f>>2]=c[f>>2]|4;p=0;i=j;return p|0}function cj(a,b,d,e,f,g,h,j,k){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;m=i;i=i+32|0;o=m;p=m+24|0;n=m+20|0;r=m+16|0;q=m+12|0;t=c[f+28>>2]|0;y=t+4|0;c[y>>2]=(c[y>>2]|0)+1;if(!((c[3362]|0)==-1)){c[o>>2]=13448;c[o+4>>2]=208;c[o+8>>2]=0;cg(13448,o)}u=(c[13452>>2]|0)+ -1|0;v=c[t+8>>2]|0;if((c[t+12>>2]|0)-v>>2>>>0>u>>>0?(s=c[v+(u<<2)>>2]|0,(s|0)!=0):0){x=t+4|0;y=c[x>>2]|0;c[x>>2]=y+ -1;if((y|0)==0){lc[c[(c[t>>2]|0)+8>>2]&255](t)}c[g>>2]=0;a:do{if((j|0)!=(k|0)){t=0;b:while(1){u=t;t=d;while(1){if((u|0)!=0){d=t;break a}if((t|0)==0){u=1;d=0;t=0}else{d=c[t+12>>2]|0;if((d|0)==(c[t+16>>2]|0)){d=oc[c[(c[t>>2]|0)+36>>2]&127](t)|0}else{d=c[d>>2]|0}y=(d|0)==-1;u=y?1:0;d=y?0:t;t=y?0:t}if((e|0)!=0){v=c[e+12>>2]|0;if((v|0)==(c[e+16>>2]|0)){v=oc[c[(c[e>>2]|0)+36>>2]&127](e)|0}else{v=c[v>>2]|0}if(!((v|0)==-1)){if(!u){l=25;break b}}else{l=23}}else{l=23}if((l|0)==23){l=0;if(u){e=0;l=25;break b}else{e=0}}if((hc[c[(c[s>>2]|0)+52>>2]&63](s,c[j>>2]|0,0)|0)<<24>>24==37){l=27;break}if(hc[c[(c[s>>2]|0)+12>>2]&63](s,8192,c[j>>2]|0)|0){l=37;break}u=d+12|0;w=c[u>>2]|0;v=d+16|0;if((w|0)==(c[v>>2]|0)){w=oc[c[(c[d>>2]|0)+36>>2]&127](d)|0}else{w=c[w>>2]|0}y=xc[c[(c[s>>2]|0)+28>>2]&63](s,w)|0;if((y|0)==(xc[c[(c[s>>2]|0)+28>>2]&63](s,c[j>>2]|0)|0)){l=63;break}c[g>>2]=4;u=4}c:do{if((l|0)==27){l=0;u=j+4|0;if((u|0)==(k|0)){l=28;break b}t=hc[c[(c[s>>2]|0)+52>>2]&63](s,c[u>>2]|0,0)|0;if(t<<24>>24==48|t<<24>>24==69){u=j+8|0;if((u|0)==(k|0)){l=31;break b}j=u;u=hc[c[(c[s>>2]|0)+52>>2]&63](s,c[u>>2]|0,0)|0}else{j=u;u=t;t=0}y=c[(c[b>>2]|0)+36>>2]|0;c[r>>2]=d;c[q>>2]=e;c[p+0>>2]=c[r+0>>2];c[o+0>>2]=c[q+0>>2];nc[y&31](n,b,p,o,f,g,h,u,t);j=j+4|0;d=c[n>>2]|0}else if((l|0)==37){while(1){l=0;j=j+4|0;if((j|0)==(k|0)){j=k;break}if(hc[c[(c[s>>2]|0)+12>>2]&63](s,8192,c[j>>2]|0)|0){l=37}else{break}}u=e;w=e;while(1){if((d|0)==0){v=1;d=0}else{v=c[d+12>>2]|0;if((v|0)==(c[d+16>>2]|0)){v=oc[c[(c[d>>2]|0)+36>>2]&127](d)|0}else{v=c[v>>2]|0}y=(v|0)==-1;v=y?1:0;d=y?0:d;t=y?0:t}if((w|0)!=0){x=c[w+12>>2]|0;if((x|0)==(c[w+16>>2]|0)){w=oc[c[(c[w>>2]|0)+36>>2]&127](w)|0}else{w=c[x>>2]|0}if(!((w|0)==-1)){if(v^(u|0)==0){v=u;w=u}else{d=t;break c}}else{u=0;e=0;l=50}}else{l=50}if((l|0)==50){l=0;if(v){d=t;break c}else{v=u;w=0}}x=d+12|0;y=c[x>>2]|0;u=d+16|0;if((y|0)==(c[u>>2]|0)){y=oc[c[(c[d>>2]|0)+36>>2]&127](d)|0}else{y=c[y>>2]|0}if(!(hc[c[(c[s>>2]|0)+12>>2]&63](s,8192,y)|0)){d=t;break c}y=c[x>>2]|0;if((y|0)==(c[u>>2]|0)){oc[c[(c[d>>2]|0)+40>>2]&127](d)|0;u=v;continue}else{c[x>>2]=y+4;u=v;continue}}}else if((l|0)==63){l=0;w=c[u>>2]|0;if((w|0)==(c[v>>2]|0)){oc[c[(c[d>>2]|0)+40>>2]&127](d)|0}else{c[u>>2]=w+4}j=j+4|0;d=t}}while(0);if((j|0)==(k|0)){break a}t=c[g>>2]|0}if((l|0)==25){c[g>>2]=4;break}else if((l|0)==28){c[g>>2]=4;break}else if((l|0)==31){c[g>>2]=4;break}}}while(0);if((d|0)==0){n=0;o=1}else{n=c[d+12>>2]|0;if((n|0)==(c[d+16>>2]|0)){n=oc[c[(c[d>>2]|0)+36>>2]&127](d)|0}else{n=c[n>>2]|0}o=(n|0)==-1;n=o?0:d;o=o?1:0}if((e|0)!=0){p=c[e+12>>2]|0;if((p|0)==(c[e+16>>2]|0)){p=oc[c[(c[e>>2]|0)+36>>2]&127](e)|0}else{p=c[p>>2]|0}if(!((p|0)==-1)){if(o){c[a>>2]=n;i=m;return}}else{l=78}}else{l=78}if((l|0)==78?!o:0){c[a>>2]=n;i=m;return}c[g>>2]=c[g>>2]|2;c[a>>2]=n;i=m;return}y=Xa(4)|0;c[y>>2]=21304;wb(y|0,21376,196)}function dj(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function ej(a){a=a|0;return}function fj(a){a=a|0;return 2}function gj(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0;j=i;cj(a,b,c[d>>2]|0,c[e>>2]|0,f,g,h,12528,12560|0);i=j;return}function hj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0;k=i;m=d+8|0;m=oc[c[(c[m>>2]|0)+20>>2]&127](m)|0;n=a[m>>0]|0;if((n&1)==0){l=m+4|0;m=(n&255)>>>1}else{l=c[m+8>>2]|0;m=c[m+4>>2]|0}cj(b,d,c[e>>2]|0,c[f>>2]|0,g,h,j,l,l+(m<<2)|0);i=k;return}function ij(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0;j=i;i=i+16|0;l=j;f=c[f+28>>2]|0;m=f+4|0;c[m>>2]=(c[m>>2]|0)+1;if(!((c[3362]|0)==-1)){c[l>>2]=13448;c[l+4>>2]=208;c[l+8>>2]=0;cg(13448,l)}l=(c[13452>>2]|0)+ -1|0;m=c[f+8>>2]|0;if((c[f+12>>2]|0)-m>>2>>>0>l>>>0?(k=c[m+(l<<2)>>2]|0,(k|0)!=0):0){l=f+4|0;m=c[l>>2]|0;c[l>>2]=m+ -1;if((m|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}m=c[e>>2]|0;b=b+8|0;b=oc[c[c[b>>2]>>2]&127](b)|0;b=(ai(d,m,b,b+168|0,k,g,0)|0)-b|0;if((b|0)>=168){m=c[d>>2]|0;c[a>>2]=m;i=j;return}c[h+24>>2]=((b|0)/12|0|0)%7|0;m=c[d>>2]|0;c[a>>2]=m;i=j;return}m=Xa(4)|0;c[m>>2]=21304;wb(m|0,21376,196)}function jj(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0;j=i;i=i+16|0;l=j;f=c[f+28>>2]|0;m=f+4|0;c[m>>2]=(c[m>>2]|0)+1;if(!((c[3362]|0)==-1)){c[l>>2]=13448;c[l+4>>2]=208;c[l+8>>2]=0;cg(13448,l)}l=(c[13452>>2]|0)+ -1|0;m=c[f+8>>2]|0;if((c[f+12>>2]|0)-m>>2>>>0>l>>>0?(k=c[m+(l<<2)>>2]|0,(k|0)!=0):0){l=f+4|0;m=c[l>>2]|0;c[l>>2]=m+ -1;if((m|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}m=c[e>>2]|0;b=b+8|0;b=oc[c[(c[b>>2]|0)+4>>2]&127](b)|0;b=(ai(d,m,b,b+288|0,k,g,0)|0)-b|0;if((b|0)>=288){m=c[d>>2]|0;c[a>>2]=m;i=j;return}c[h+16>>2]=((b|0)/12|0|0)%12|0;m=c[d>>2]|0;c[a>>2]=m;i=j;return}m=Xa(4)|0;c[m>>2]=21304;wb(m|0,21376,196)}function kj(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0;b=i;i=i+16|0;k=b;f=c[f+28>>2]|0;l=f+4|0;c[l>>2]=(c[l>>2]|0)+1;if(!((c[3362]|0)==-1)){c[k>>2]=13448;c[k+4>>2]=208;c[k+8>>2]=0;cg(13448,k)}k=(c[13452>>2]|0)+ -1|0;l=c[f+8>>2]|0;if((c[f+12>>2]|0)-l>>2>>>0>k>>>0?(j=c[l+(k<<2)>>2]|0,(j|0)!=0):0){k=f+4|0;l=c[k>>2]|0;c[k>>2]=l+ -1;if((l|0)==0){lc[c[(c[f>>2]|0)+8>>2]&255](f)}e=mj(d,c[e>>2]|0,g,j,4)|0;if((c[g>>2]&4|0)!=0){l=c[d>>2]|0;c[a>>2]=l;i=b;return}if((e|0)<69){g=e+2e3|0}else{g=(e+ -69|0)>>>0<31?e+1900|0:e}c[h+20>>2]=g+ -1900;l=c[d>>2]|0;c[a>>2]=l;i=b;return}l=Xa(4)|0;c[l>>2]=21304;wb(l|0,21376,196)}function lj(b,d,e,f,g,h,j,k,l){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;l=i;i=i+64|0;y=l;x=l+16|0;p=l+28|0;v=l+24|0;w=l+32|0;C=l+12|0;r=l+20|0;s=l+36|0;t=l+40|0;z=l+44|0;q=l+48|0;c[h>>2]=0;u=c[g+28>>2]|0;B=u+4|0;c[B>>2]=(c[B>>2]|0)+1;if(!((c[3362]|0)==-1)){c[y>>2]=13448;c[y+4>>2]=208;c[y+8>>2]=0;cg(13448,y)}A=(c[13452>>2]|0)+ -1|0;B=c[u+8>>2]|0;if((c[u+12>>2]|0)-B>>2>>>0>A>>>0?(n=c[B+(A<<2)>>2]|0,(n|0)!=0):0){A=u+4|0;B=c[A>>2]|0;c[A>>2]=B+ -1;if((B|0)==0){lc[c[(c[u>>2]|0)+8>>2]&255](u)}a:do{switch(k<<24>>24|0){case 83:{n=mj(e,c[f>>2]|0,h,n,2)|0;m=c[h>>2]|0;if((m&4|0)==0&(n|0)<61){c[j>>2]=n;break a}else{c[h>>2]=m|4;break a}};case 84:{cj(s,d,c[e>>2]|0,c[f>>2]|0,g,h,j,12696,12728|0);c[e>>2]=c[s>>2];break};case 82:{cj(r,d,c[e>>2]|0,c[f>>2]|0,g,h,j,12672,12692|0);c[e>>2]=c[r>>2];break};case 112:{m=j+8|0;j=c[f>>2]|0;f=d+8|0;f=oc[c[(c[f>>2]|0)+8>>2]&127](f)|0;d=a[f>>0]|0;if((d&1)==0){d=(d&255)>>>1}else{d=c[f+4>>2]|0}g=a[f+12>>0]|0;if((g&1)==0){g=(g&255)>>>1}else{g=c[f+16>>2]|0}if((d|0)==(0-g|0)){c[h>>2]=c[h>>2]|4;break a}C=ai(e,j,f,f+24|0,n,h,0)|0;h=C-f|0;if((C|0)==(f|0)?(c[m>>2]|0)==12:0){c[m>>2]=0;break a}if((h|0)==12?(o=c[m>>2]|0,(o|0)<12):0){c[m>>2]=o+12}break};case 114:{cj(C,d,c[e>>2]|0,c[f>>2]|0,g,h,j,12624,12668|0);c[e>>2]=c[C>>2];break};case 120:{C=c[(c[d>>2]|0)+20>>2]|0;c[t>>2]=c[e>>2];c[z>>2]=c[f>>2];c[x+0>>2]=c[t+0>>2];c[y+0>>2]=c[z+0>>2];ic[C&63](b,d,x,y,g,h,j);i=l;return};case 88:{o=d+8|0;o=oc[c[(c[o>>2]|0)+24>>2]&127](o)|0;n=a[o>>0]|0;if((n&1)==0){m=o+4|0;n=(n&255)>>>1}else{m=c[o+8>>2]|0;n=c[o+4>>2]|0}cj(q,d,c[e>>2]|0,c[f>>2]|0,g,h,j,m,m+(n<<2)|0);c[e>>2]=c[q>>2];break};case 119:{n=mj(e,c[f>>2]|0,h,n,1)|0;m=c[h>>2]|0;if((m&4|0)==0&(n|0)<7){c[j+24>>2]=n;break a}else{c[h>>2]=m|4;break a}};case 121:{m=j+20|0;n=mj(e,c[f>>2]|0,h,n,4)|0;if((c[h>>2]&4|0)==0){if((n|0)<69){h=n+2e3|0}else{h=(n+ -69|0)>>>0<31?n+1900|0:n}c[m>>2]=h+ -1900}break};case 89:{m=mj(e,c[f>>2]|0,h,n,4)|0;if((c[h>>2]&4|0)==0){c[j+20>>2]=m+ -1900}break};case 37:{j=c[f>>2]|0;f=c[e>>2]|0;do{if((f|0)!=0){d=c[f+12>>2]|0;if((d|0)==(c[f+16>>2]|0)){f=oc[c[(c[f>>2]|0)+36>>2]&127](f)|0}else{f=c[d>>2]|0}if((f|0)==-1){c[e>>2]=0;f=1;break}else{f=(c[e>>2]|0)==0;break}}else{f=1}}while(0);if((j|0)!=0){d=c[j+12>>2]|0;if((d|0)==(c[j+16>>2]|0)){d=oc[c[(c[j>>2]|0)+36>>2]&127](j)|0}else{d=c[d>>2]|0}if(!((d|0)==-1)){if(!f){m=126}}else{m=124}}else{m=124}if((m|0)==124){if(f){m=126}else{j=0}}if((m|0)==126){c[h>>2]=c[h>>2]|6;break a}d=c[e>>2]|0;f=c[d+12>>2]|0;if((f|0)==(c[d+16>>2]|0)){f=oc[c[(c[d>>2]|0)+36>>2]&127](d)|0}else{f=c[f>>2]|0}if(!((hc[c[(c[n>>2]|0)+52>>2]&63](n,f,0)|0)<<24>>24==37)){c[h>>2]=c[h>>2]|4;break a}d=c[e>>2]|0;f=d+12|0;n=c[f>>2]|0;if((n|0)==(c[d+16>>2]|0)){oc[c[(c[d>>2]|0)+40>>2]&127](d)|0}else{c[f>>2]=n+4}n=c[e>>2]|0;do{if((n|0)!=0){f=c[n+12>>2]|0;if((f|0)==(c[n+16>>2]|0)){n=oc[c[(c[n>>2]|0)+36>>2]&127](n)|0}else{n=c[f>>2]|0}if((n|0)==-1){c[e>>2]=0;n=1;break}else{n=(c[e>>2]|0)==0;break}}else{n=1}}while(0);if((j|0)!=0){f=c[j+12>>2]|0;if((f|0)==(c[j+16>>2]|0)){j=oc[c[(c[j>>2]|0)+36>>2]&127](j)|0}else{j=c[f>>2]|0}if(!((j|0)==-1)){if(n){break a}}else{m=147}}else{m=147}if((m|0)==147?!n:0){break a}c[h>>2]=c[h>>2]|2;break};case 109:{n=mj(e,c[f>>2]|0,h,n,2)|0;m=c[h>>2]|0;if((m&4|0)==0&(n|0)<13){c[j+16>>2]=n+ -1;break a}else{c[h>>2]=m|4;break a}};case 70:{cj(w,d,c[e>>2]|0,c[f>>2]|0,g,h,j,12592,12624|0);c[e>>2]=c[w>>2];break};case 68:{cj(v,d,c[e>>2]|0,c[f>>2]|0,g,h,j,12560,12592|0);c[e>>2]=c[v>>2];break};case 104:case 66:case 98:{B=c[f>>2]|0;C=d+8|0;C=oc[c[(c[C>>2]|0)+4>>2]&127](C)|0;h=(ai(e,B,C,C+288|0,n,h,0)|0)-C|0;if((h|0)<288){c[j+16>>2]=((h|0)/12|0|0)%12|0}break};case 116:case 110:{j=c[f>>2]|0;while(1){d=c[e>>2]|0;do{if((d|0)!=0){f=c[d+12>>2]|0;if((f|0)==(c[d+16>>2]|0)){f=oc[c[(c[d>>2]|0)+36>>2]&127](d)|0}else{f=c[f>>2]|0}if((f|0)==-1){c[e>>2]=0;f=1;break}else{f=(c[e>>2]|0)==0;break}}else{f=1}}while(0);if((j|0)!=0){d=c[j+12>>2]|0;if((d|0)==(c[j+16>>2]|0)){d=oc[c[(c[j>>2]|0)+36>>2]&127](j)|0}else{d=c[d>>2]|0}if(!((d|0)==-1)){if(!f){break}}else{m=53}}else{m=53}if((m|0)==53){m=0;if(f){j=0;break}else{j=0}}d=c[e>>2]|0;f=c[d+12>>2]|0;if((f|0)==(c[d+16>>2]|0)){f=oc[c[(c[d>>2]|0)+36>>2]&127](d)|0}else{f=c[f>>2]|0}if(!(hc[c[(c[n>>2]|0)+12>>2]&63](n,8192,f)|0)){break}o=c[e>>2]|0;d=o+12|0;f=c[d>>2]|0;if((f|0)==(c[o+16>>2]|0)){oc[c[(c[o>>2]|0)+40>>2]&127](o)|0;continue}else{c[d>>2]=f+4;continue}}f=c[e>>2]|0;do{if((f|0)!=0){n=c[f+12>>2]|0;if((n|0)==(c[f+16>>2]|0)){n=oc[c[(c[f>>2]|0)+36>>2]&127](f)|0}else{n=c[n>>2]|0}if((n|0)==-1){c[e>>2]=0;n=1;break}else{n=(c[e>>2]|0)==0;break}}else{n=1}}while(0);if((j|0)!=0){f=c[j+12>>2]|0;if((f|0)==(c[j+16>>2]|0)){j=oc[c[(c[j>>2]|0)+36>>2]&127](j)|0}else{j=c[f>>2]|0}if(!((j|0)==-1)){if(n){break a}}else{m=74}}else{m=74}if((m|0)==74?!n:0){break a}c[h>>2]=c[h>>2]|2;break};case 65:case 97:{B=c[f>>2]|0;C=d+8|0;C=oc[c[c[C>>2]>>2]&127](C)|0;h=(ai(e,B,C,C+168|0,n,h,0)|0)-C|0;if((h|0)<168){c[j+24>>2]=((h|0)/12|0|0)%7|0}break};case 99:{o=d+8|0;o=oc[c[(c[o>>2]|0)+12>>2]&127](o)|0;n=a[o>>0]|0;if((n&1)==0){m=o+4|0;n=(n&255)>>>1}else{m=c[o+8>>2]|0;n=c[o+4>>2]|0}cj(p,d,c[e>>2]|0,c[f>>2]|0,g,h,j,m,m+(n<<2)|0);c[e>>2]=c[p>>2];break};case 72:{n=mj(e,c[f>>2]|0,h,n,2)|0;m=c[h>>2]|0;if((m&4|0)==0&(n|0)<24){c[j+8>>2]=n;break a}else{c[h>>2]=m|4;break a}};case 101:case 100:{m=j+12|0;j=mj(e,c[f>>2]|0,h,n,2)|0;n=c[h>>2]|0;if((n&4|0)==0?(j+ -1|0)>>>0<31:0){c[m>>2]=j;break a}c[h>>2]=n|4;break};case 73:{m=j+8|0;n=mj(e,c[f>>2]|0,h,n,2)|0;j=c[h>>2]|0;if((j&4|0)==0?(n+ -1|0)>>>0<12:0){c[m>>2]=n;break a}c[h>>2]=j|4;break};case 77:{n=mj(e,c[f>>2]|0,h,n,2)|0;m=c[h>>2]|0;if((m&4|0)==0&(n|0)<60){c[j+4>>2]=n;break a}else{c[h>>2]=m|4;break a}};case 106:{n=mj(e,c[f>>2]|0,h,n,3)|0;m=c[h>>2]|0;if((m&4|0)==0&(n|0)<366){c[j+28>>2]=n;break a}else{c[h>>2]=m|4;break a}};default:{c[h>>2]=c[h>>2]|4}}}while(0);c[b>>2]=c[e>>2];i=l;return}C=Xa(4)|0;c[C>>2]=21304;wb(C|0,21376,196)}function mj(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;h=i;k=c[a>>2]|0;do{if((k|0)!=0){j=c[k+12>>2]|0;if((j|0)==(c[k+16>>2]|0)){j=oc[c[(c[k>>2]|0)+36>>2]&127](k)|0}else{j=c[j>>2]|0}if((j|0)==-1){c[a>>2]=0;j=1;break}else{j=(c[a>>2]|0)==0;break}}else{j=1}}while(0);if((b|0)!=0){k=c[b+12>>2]|0;if((k|0)==(c[b+16>>2]|0)){k=oc[c[(c[b>>2]|0)+36>>2]&127](b)|0}else{k=c[k>>2]|0}if(!((k|0)==-1)){if(!j){g=15}}else{g=13}}else{g=13}if((g|0)==13){if(j){g=15}else{b=0}}if((g|0)==15){c[d>>2]=c[d>>2]|6;n=0;i=h;return n|0}j=c[a>>2]|0;k=c[j+12>>2]|0;if((k|0)==(c[j+16>>2]|0)){j=oc[c[(c[j>>2]|0)+36>>2]&127](j)|0}else{j=c[k>>2]|0}if(!(hc[c[(c[e>>2]|0)+12>>2]&63](e,2048,j)|0)){c[d>>2]=c[d>>2]|4;n=0;i=h;return n|0}j=(hc[c[(c[e>>2]|0)+52>>2]&63](e,j,0)|0)<<24>>24;l=c[a>>2]|0;k=l+12|0;m=c[k>>2]|0;if((m|0)==(c[l+16>>2]|0)){oc[c[(c[l>>2]|0)+40>>2]&127](l)|0;k=b;l=b;b=j}else{c[k>>2]=m+4;k=b;l=b;b=j}while(1){b=b+ -48|0;f=f+ -1|0;j=c[a>>2]|0;do{if((j|0)!=0){m=c[j+12>>2]|0;if((m|0)==(c[j+16>>2]|0)){j=oc[c[(c[j>>2]|0)+36>>2]&127](j)|0}else{j=c[m>>2]|0}if((j|0)==-1){c[a>>2]=0;m=1;break}else{m=(c[a>>2]|0)==0;break}}else{m=1}}while(0);if((l|0)==0){j=k;l=0;n=1}else{j=c[l+12>>2]|0;if((j|0)==(c[l+16>>2]|0)){j=oc[c[(c[l>>2]|0)+36>>2]&127](l)|0}else{j=c[j>>2]|0}n=(j|0)==-1;j=n?0:k;l=n?0:k;n=n?1:(k|0)==0}k=c[a>>2]|0;if(!((m^n)&(f|0)>0)){break}m=c[k+12>>2]|0;if((m|0)==(c[k+16>>2]|0)){k=oc[c[(c[k>>2]|0)+36>>2]&127](k)|0}else{k=c[m>>2]|0}if(!(hc[c[(c[e>>2]|0)+12>>2]&63](e,2048,k)|0)){g=59;break}b=((hc[c[(c[e>>2]|0)+52>>2]&63](e,k,0)|0)<<24>>24)+(b*10|0)|0;m=c[a>>2]|0;n=m+12|0;k=c[n>>2]|0;if((k|0)==(c[m+16>>2]|0)){oc[c[(c[m>>2]|0)+40>>2]&127](m)|0;k=j;continue}else{c[n>>2]=k+4;k=j;continue}}if((g|0)==59){i=h;return b|0}do{if((k|0)!=0){e=c[k+12>>2]|0;if((e|0)==(c[k+16>>2]|0)){e=oc[c[(c[k>>2]|0)+36>>2]&127](k)|0}else{e=c[e>>2]|0}if((e|0)==-1){c[a>>2]=0;a=1;break}else{a=(c[a>>2]|0)==0;break}}else{a=1}}while(0);if((j|0)!=0){e=c[j+12>>2]|0;if((e|0)==(c[j+16>>2]|0)){e=oc[c[(c[j>>2]|0)+36>>2]&127](j)|0}else{e=c[e>>2]|0}if(!((e|0)==-1)){if(a){n=b;i=h;return n|0}}else{g=56}}else{g=56}if((g|0)==56?!a:0){n=b;i=h;return n|0}c[d>>2]=c[d>>2]|2;n=b;i=h;return n|0}function nj(b){b=b|0;var d=0,e=0,f=0;d=i;e=b+8|0;f=c[e>>2]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}if((f|0)!=(c[3340]|0)){Vb(c[e>>2]|0)}if((b|0)==0){i=d;return}vn(b);i=d;return}function oj(b){b=b|0;var d=0,e=0;d=i;b=b+8|0;e=c[b>>2]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}if((e|0)==(c[3340]|0)){i=d;return}Vb(c[b>>2]|0);i=d;return}function pj(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0;f=i;i=i+112|0;n=f+100|0;g=f;a[n>>0]=37;l=n+1|0;a[l>>0]=j;m=n+2|0;a[m>>0]=k;a[n+3>>0]=0;if(!(k<<24>>24==0)){a[l>>0]=k;a[m>>0]=j}n=eb(g|0,100,n|0,h|0,c[d+8>>2]|0)|0;h=g+n|0;d=c[e>>2]|0;if((n|0)==0){n=d;c[b>>2]=n;i=f;return}else{e=d;l=d}do{j=a[g>>0]|0;do{if((e|0)!=0){k=e+24|0;d=c[k>>2]|0;if((d|0)==(c[e+28>>2]|0)){n=(xc[c[(c[e>>2]|0)+52>>2]&63](e,j&255)|0)==-1;l=n?0:l;e=n?0:e;break}else{c[k>>2]=d+1;a[d>>0]=j;break}}else{e=0}}while(0);g=g+1|0}while((g|0)!=(h|0));c[b>>2]=l;i=f;return}function qj(b){b=b|0;var d=0,e=0,f=0;d=i;e=b+8|0;f=c[e>>2]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}if((f|0)!=(c[3340]|0)){Vb(c[e>>2]|0)}if((b|0)==0){i=d;return}vn(b);i=d;return}function rj(b){b=b|0;var d=0,e=0;d=i;b=b+8|0;e=c[b>>2]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}if((e|0)==(c[3340]|0)){i=d;return}Vb(c[b>>2]|0);i=d;return}function sj(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0;f=i;i=i+528|0;o=f+512|0;p=f+412|0;m=f;l=f+408|0;g=f+8|0;a[o>>0]=37;n=o+1|0;a[n>>0]=j;q=o+2|0;a[q>>0]=k;a[o+3>>0]=0;if(!(k<<24>>24==0)){a[n>>0]=k;a[q>>0]=j}j=d+8|0;eb(p|0,100,o|0,h|0,c[j>>2]|0)|0;k=m;c[k>>2]=0;c[k+4>>2]=0;c[l>>2]=p;j=ib(c[j>>2]|0)|0;k=Vm(g,l,100,m)|0;if((j|0)!=0){ib(j|0)|0}if((k|0)==-1){ok(14296)}j=g+(k<<2)|0;d=c[e>>2]|0;if((k|0)==0){q=d;c[b>>2]=q;i=f;return}else{e=d;k=d}do{d=c[g>>2]|0;if((e|0)==0){e=0}else{h=e+24|0;l=c[h>>2]|0;if((l|0)==(c[e+28>>2]|0)){d=xc[c[(c[e>>2]|0)+52>>2]&63](e,d)|0}else{c[h>>2]=l+4;c[l>>2]=d}q=(d|0)==-1;k=q?0:k;e=q?0:e}g=g+4|0}while((g|0)!=(j|0));c[b>>2]=k;i=f;return}function tj(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function uj(a){a=a|0;return}function vj(a){a=a|0;return 127}function wj(a){a=a|0;return 127}function xj(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function yj(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function zj(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function Aj(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=45;a[b+2>>0]=0;return}function Bj(a){a=a|0;return 0}function Cj(b,c){b=b|0;c=c|0;a[b>>0]=67109634;a[b+1>>0]=262147;a[b+2>>0]=1024;a[b+3>>0]=4;return}function Dj(b,c){b=b|0;c=c|0;a[b>>0]=67109634;a[b+1>>0]=262147;a[b+2>>0]=1024;a[b+3>>0]=4;return}function Ej(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Fj(a){a=a|0;return}function Gj(a){a=a|0;return 127}function Hj(a){a=a|0;return 127}function Ij(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function Jj(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function Kj(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function Lj(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=45;a[b+2>>0]=0;return}function Mj(a){a=a|0;return 0}function Nj(b,c){b=b|0;c=c|0;a[b>>0]=67109634;a[b+1>>0]=262147;a[b+2>>0]=1024;a[b+3>>0]=4;return}function Oj(b,c){b=b|0;c=c|0;a[b>>0]=67109634;a[b+1>>0]=262147;a[b+2>>0]=1024;a[b+3>>0]=4;return}function Pj(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Qj(a){a=a|0;return}function Rj(a){a=a|0;return 2147483647}function Sj(a){a=a|0;return 2147483647}function Tj(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function Uj(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function Vj(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function Wj(b,d){b=b|0;d=d|0;var e=0,f=0;d=i;a[b>>0]=2;b=b+4|0;f=1;e=b;while(1){f=f+ -1|0;c[e>>2]=45;if((f|0)==0){break}else{e=e+4|0}}c[b+4>>2]=0;i=d;return}function Xj(a){a=a|0;return 0}function Yj(b,c){b=b|0;c=c|0;a[b>>0]=67109634;a[b+1>>0]=262147;a[b+2>>0]=1024;a[b+3>>0]=4;return}function Zj(b,c){b=b|0;c=c|0;a[b>>0]=67109634;a[b+1>>0]=262147;a[b+2>>0]=1024;a[b+3>>0]=4;return}function _j(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function $j(a){a=a|0;return}function ak(a){a=a|0;return 2147483647}function bk(a){a=a|0;return 2147483647}function ck(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function dk(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function ek(a,b){a=a|0;b=b|0;b=i;c[a+0>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;i=b;return}function fk(b,d){b=b|0;d=d|0;var e=0,f=0;d=i;a[b>>0]=2;b=b+4|0;f=1;e=b;while(1){f=f+ -1|0;c[e>>2]=45;if((f|0)==0){break}else{e=e+4|0}}c[b+4>>2]=0;i=d;return}function gk(a){a=a|0;return 0}function hk(b,c){b=b|0;c=c|0;a[b>>0]=67109634;a[b+1>>0]=262147;a[b+2>>0]=1024;a[b+3>>0]=4;return}function ik(b,c){b=b|0;c=c|0;a[b>>0]=67109634;a[b+1>>0]=262147;a[b+2>>0]=1024;a[b+3>>0]=4;return}function jk(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function kk(a){a=a|0;return}function lk(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;n=i;i=i+240|0;p=n;x=n+140|0;d=n+16|0;r=n+24|0;u=n+138|0;s=n+128|0;q=n+28|0;c[d>>2]=x;m=d+4|0;c[m>>2]=213;x=x+100|0;o=c[h+28>>2]|0;w=o+4|0;c[w>>2]=(c[w>>2]|0)+1;if(!((c[3364]|0)==-1)){c[p>>2]=13456;c[p+4>>2]=208;c[p+8>>2]=0;cg(13456,p)}w=(c[13460>>2]|0)+ -1|0;v=c[o+8>>2]|0;if((c[o+12>>2]|0)-v>>2>>>0>w>>>0?(t=c[v+(w<<2)>>2]|0,(t|0)!=0):0){a[u>>0]=0;do{if(nk(e,c[f>>2]|0,g,o,c[h+4>>2]|0,j,u,t,d,r,x)|0){uc[c[(c[t>>2]|0)+32>>2]&31](t,13088,13098|0,s)|0;g=c[r>>2]|0;h=c[d>>2]|0;t=g-h|0;if((t|0)>98){v=un(t+2|0)|0;if((v|0)==0){x=Xa(4)|0;c[x>>2]=22680;wb(x|0,22728,206)}else{t=v}}else{t=0;v=q}if((a[u>>0]|0)!=0){a[v>>0]=45;v=v+1|0}if(h>>>0<g>>>0){u=s+10|0;g=s;do{w=a[h>>0]|0;x=s;while(1){if((a[x>>0]|0)==w<<24>>24){break}x=x+1|0;if((x|0)==(u|0)){x=u;break}}a[v>>0]=a[13088+(x-g)>>0]|0;h=h+1|0;v=v+1|0}while(h>>>0<(c[r>>2]|0)>>>0)}a[v>>0]=0;c[p>>2]=k;if((Fa(q|0,13104,p|0)|0)==1){if((t|0)==0){break}vn(t);break}f=Xa(8)|0;c[f>>2]=9928;while(1){j=un(28)|0;if((j|0)!=0){l=29;break}l=c[5666]|0;c[5666]=l+0;if((l|0)==0){l=27;break}sc[l&31]()}if((l|0)==27){x=Xa(4)|0;c[x>>2]=22680;wb(x|0,22728,206)}else if((l|0)==29){c[j+4>>2]=15;c[j>>2]=15;l=j+12|0;c[f+4>>2]=l;c[j+8>>2]=0;j=l+0|0;l=13112|0;b=j+16|0;do{a[j>>0]=a[l>>0]|0;j=j+1|0;l=l+1|0}while((j|0)<(b|0));wb(f|0,10064,106)}}}while(0);p=c[e>>2]|0;if((p|0)!=0){if((c[p+12>>2]|0)==(c[p+16>>2]|0)?(oc[c[(c[p>>2]|0)+36>>2]&127](p)|0)==-1:0){c[e>>2]=0;p=0}}else{p=0}k=(p|0)==0;e=c[f>>2]|0;do{if((e|0)!=0){if((c[e+12>>2]|0)!=(c[e+16>>2]|0)){if(k){break}else{l=46;break}}if(!((oc[c[(c[e>>2]|0)+36>>2]&127](e)|0)==-1)){if(k){break}else{l=46;break}}else{c[f>>2]=0;l=44;break}}else{l=44}}while(0);if((l|0)==44?k:0){l=46}if((l|0)==46){c[j>>2]=c[j>>2]|2}c[b>>2]=p;w=o+4|0;x=c[w>>2]|0;c[w>>2]=x+ -1;if((x|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}l=c[d>>2]|0;c[d>>2]=0;if((l|0)==0){i=n;return}lc[c[m>>2]&255](l);i=n;return}x=Xa(4)|0;c[x>>2]=21304;wb(x|0,21376,196)}function mk(a){a=a|0;return}function nk(e,f,g,h,j,k,l,m,n,o,p){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0;u=i;i=i+592|0;Q=u;O=u+112|0;G=u+12|0;M=u+100|0;J=u+40|0;K=u+24|0;L=u+36|0;P=u+88|0;N=u+76|0;H=u+52|0;I=u+64|0;T=u+120|0;F=u+520|0;t=u+524|0;y=u+536|0;x=u+548|0;s=u+560|0;w=u+572|0;B=u+584|0;c[F>>2]=0;c[t+0>>2]=0;c[t+4>>2]=0;c[t+8>>2]=0;c[y+0>>2]=0;c[y+4>>2]=0;c[y+8>>2]=0;c[x+0>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;c[s+0>>2]=0;c[s+4>>2]=0;c[s+8>>2]=0;c[w+0>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0;do{if(g){if(!((c[3228]|0)==-1)){c[Q>>2]=12912;c[Q+4>>2]=208;c[Q+8>>2]=0;cg(12912,Q)}H=(c[12916>>2]|0)+ -1|0;E=c[h+8>>2]|0;if((c[h+12>>2]|0)-E>>2>>>0>H>>>0?(D=c[E+(H<<2)>>2]|0,(D|0)!=0):0){mc[c[(c[D>>2]|0)+44>>2]&127](O,D);c[F>>2]=c[O>>2];mc[c[(c[D>>2]|0)+32>>2]&127](G,D);if((a[s>>0]&1)==0){a[s+1>>0]=0;a[s>>0]=0}else{a[c[s+8>>2]>>0]=0;c[s+4>>2]=0}ig(s);c[s+0>>2]=c[G+0>>2];c[s+4>>2]=c[G+4>>2];c[s+8>>2]=c[G+8>>2];c[G+0>>2]=0;c[G+4>>2]=0;c[G+8>>2]=0;mc[c[(c[D>>2]|0)+28>>2]&127](M,D);if((a[x>>0]&1)==0){a[x+1>>0]=0;a[x>>0]=0}else{a[c[x+8>>2]>>0]=0;c[x+4>>2]=0}ig(x);c[x+0>>2]=c[M+0>>2];c[x+4>>2]=c[M+4>>2];c[x+8>>2]=c[M+8>>2];c[M+0>>2]=0;c[M+4>>2]=0;c[M+8>>2]=0;h=oc[c[(c[D>>2]|0)+12>>2]&127](D)|0;G=oc[c[(c[D>>2]|0)+16>>2]&127](D)|0;mc[c[(c[D>>2]|0)+20>>2]&127](J,D);if((a[t>>0]&1)==0){a[t+1>>0]=0;a[t>>0]=0}else{a[c[t+8>>2]>>0]=0;c[t+4>>2]=0}ig(t);c[t+0>>2]=c[J+0>>2];c[t+4>>2]=c[J+4>>2];c[t+8>>2]=c[J+8>>2];c[J+0>>2]=0;c[J+4>>2]=0;c[J+8>>2]=0;mc[c[(c[D>>2]|0)+24>>2]&127](K,D);if((a[y>>0]&1)==0){a[y+1>>0]=0;a[y>>0]=0}else{a[c[y+8>>2]>>0]=0;c[y+4>>2]=0}ig(y);c[y+0>>2]=c[K+0>>2];c[y+4>>2]=c[K+4>>2];c[y+8>>2]=c[K+8>>2];c[K+0>>2]=0;c[K+4>>2]=0;c[K+8>>2]=0;V=oc[c[(c[D>>2]|0)+36>>2]&127](D)|0;break}ea=Xa(4)|0;c[ea>>2]=21304;wb(ea|0,21376,196)}else{if(!((c[3212]|0)==-1)){c[Q>>2]=12848;c[Q+4>>2]=208;c[Q+8>>2]=0;cg(12848,Q)}G=(c[12852>>2]|0)+ -1|0;D=c[h+8>>2]|0;if((c[h+12>>2]|0)-D>>2>>>0>G>>>0?(E=c[D+(G<<2)>>2]|0,(E|0)!=0):0){mc[c[(c[E>>2]|0)+44>>2]&127](L,E);c[F>>2]=c[L>>2];mc[c[(c[E>>2]|0)+32>>2]&127](P,E);if((a[s>>0]&1)==0){a[s+1>>0]=0;a[s>>0]=0}else{a[c[s+8>>2]>>0]=0;c[s+4>>2]=0}ig(s);c[s+0>>2]=c[P+0>>2];c[s+4>>2]=c[P+4>>2];c[s+8>>2]=c[P+8>>2];c[P+0>>2]=0;c[P+4>>2]=0;c[P+8>>2]=0;mc[c[(c[E>>2]|0)+28>>2]&127](N,E);if((a[x>>0]&1)==0){a[x+1>>0]=0;a[x>>0]=0}else{a[c[x+8>>2]>>0]=0;c[x+4>>2]=0}ig(x);c[x+0>>2]=c[N+0>>2];c[x+4>>2]=c[N+4>>2];c[x+8>>2]=c[N+8>>2];c[N+0>>2]=0;c[N+4>>2]=0;c[N+8>>2]=0;h=oc[c[(c[E>>2]|0)+12>>2]&127](E)|0;G=oc[c[(c[E>>2]|0)+16>>2]&127](E)|0;mc[c[(c[E>>2]|0)+20>>2]&127](H,E);if((a[t>>0]&1)==0){a[t+1>>0]=0;a[t>>0]=0}else{a[c[t+8>>2]>>0]=0;c[t+4>>2]=0}ig(t);c[t+0>>2]=c[H+0>>2];c[t+4>>2]=c[H+4>>2];c[t+8>>2]=c[H+8>>2];c[H+0>>2]=0;c[H+4>>2]=0;c[H+8>>2]=0;mc[c[(c[E>>2]|0)+24>>2]&127](I,E);if((a[y>>0]&1)==0){a[y+1>>0]=0;a[y>>0]=0}else{a[c[y+8>>2]>>0]=0;c[y+4>>2]=0}ig(y);c[y+0>>2]=c[I+0>>2];c[y+4>>2]=c[I+4>>2];c[y+8>>2]=c[I+8>>2];c[I+0>>2]=0;c[I+4>>2]=0;c[I+8>>2]=0;V=oc[c[(c[E>>2]|0)+36>>2]&127](E)|0;break}ea=Xa(4)|0;c[ea>>2]=21304;wb(ea|0,21376,196)}}while(0);c[o>>2]=c[n>>2];J=m+8|0;I=s+1|0;L=s+4|0;m=s+8|0;K=x+1|0;H=x+4|0;D=x+8|0;M=(j&512|0)!=0;S=y+1|0;j=y+8|0;Q=y+4|0;g=w+1|0;E=w+8|0;O=w+4|0;N=F+3|0;R=n+4|0;P=t+4|0;X=T+400|0;Y=T;Z=T;U=0;T=0;W=213;a:while(1){_=c[e>>2]|0;do{if((_|0)!=0){if((c[_+12>>2]|0)==(c[_+16>>2]|0)){if((oc[c[(c[_>>2]|0)+36>>2]&127](_)|0)==-1){c[e>>2]=0;_=0;break}else{_=c[e>>2]|0;break}}}else{_=0}}while(0);_=(_|0)==0;do{if((f|0)!=0){if((c[f+12>>2]|0)!=(c[f+16>>2]|0)){if(_){break}else{C=363;break a}}if(!((oc[c[(c[f>>2]|0)+36>>2]&127](f)|0)==-1)){if(!_){C=363;break a}}else{C=74}}else{C=74}}while(0);if((C|0)==74){C=0;if(_){f=0;C=363;break}else{f=0}}b:do{switch(a[F+U>>0]|0){case 2:{if(!((T|0)!=0|U>>>0<2)){if((U|0)==2){_=(a[N>>0]|0)!=0}else{_=0}if(!(M|_)){T=0;break b}}$=a[y>>0]|0;aa=($&1)==0;_=aa?S:c[j>>2]|0;c:do{if((U|0)!=0?(d[F+(U+ -1)>>0]|0)<2:0){ba=_+(aa?($&255)>>>1:c[Q>>2]|0)|0;ca=_;while(1){if((ca|0)==(ba|0)){break}aa=a[ca>>0]|0;if(!(aa<<24>>24>-1)){ba=ca;break}if((b[(c[J>>2]|0)+(aa<<24>>24<<1)>>1]&8192)==0){ba=ca;break}else{ca=ca+1|0}}aa=ba-_|0;ca=a[w>>0]|0;da=(ca&1)==0;if(da){ea=(ca&255)>>>1}else{ea=c[O>>2]|0}if(!(aa>>>0>ea>>>0)){if(da){da=(ca&255)>>>1;ca=g;ea=da;da=w+(da-aa)+1|0}else{fa=c[E>>2]|0;da=c[O>>2]|0;ca=fa;ea=da;da=fa+(da-aa)|0}aa=ca+ea|0;if((da|0)==(aa|0)){aa=f;_=ba;ba=f}else{ca=_;while(1){if((a[da>>0]|0)!=(a[ca>>0]|0)){aa=f;ba=f;break c}da=da+1|0;if((da|0)==(aa|0)){aa=f;_=ba;ba=f;break}else{ca=ca+1|0}}}}else{aa=f;ba=f}}else{aa=f;ba=f}}while(0);d:while(1){if(($&1)==0){ca=S;$=($&255)>>>1}else{ca=c[j>>2]|0;$=c[Q>>2]|0}if((_|0)==(ca+$|0)){break}$=c[e>>2]|0;do{if(($|0)!=0){if((c[$+12>>2]|0)==(c[$+16>>2]|0)){if((oc[c[(c[$>>2]|0)+36>>2]&127]($)|0)==-1){c[e>>2]=0;$=0;break}else{$=c[e>>2]|0;break}}}else{$=0}}while(0);$=($|0)==0;do{if((ba|0)!=0){if((c[ba+12>>2]|0)!=(c[ba+16>>2]|0)){if($){$=aa;break}else{break d}}if(!((oc[c[(c[ba>>2]|0)+36>>2]&127](ba)|0)==-1)){if($^(aa|0)==0){$=aa;ba=aa}else{break d}}else{aa=0;f=0;C=232}}else{C=232}}while(0);if((C|0)==232){C=0;if($){break}else{$=aa;ba=0}}aa=c[e>>2]|0;ca=c[aa+12>>2]|0;if((ca|0)==(c[aa+16>>2]|0)){aa=oc[c[(c[aa>>2]|0)+36>>2]&127](aa)|0}else{aa=d[ca>>0]|0}if(!((aa&255)<<24>>24==(a[_>>0]|0))){break}da=c[e>>2]|0;ca=da+12|0;aa=c[ca>>2]|0;if((aa|0)==(c[da+16>>2]|0)){oc[c[(c[da>>2]|0)+40>>2]&127](da)|0}else{c[ca>>2]=aa+1}aa=$;$=a[y>>0]|0;_=_+1|0}if(M){aa=a[y>>0]|0;if((aa&1)==0){$=S;aa=(aa&255)>>>1}else{$=c[j>>2]|0;aa=c[Q>>2]|0}if((_|0)!=($+aa|0)){C=247;break a}}break};case 0:{C=97;break};case 3:{_=a[x>>0]|0;aa=(_&1)==0;if(aa){da=(_&255)>>>1}else{da=c[H>>2]|0}$=a[s>>0]|0;ba=($&1)==0;if(ba){ca=($&255)>>>1}else{ca=c[L>>2]|0}if((da|0)!=(0-ca|0)){if(aa){ca=(_&255)>>>1}else{ca=c[H>>2]|0}if((ca|0)!=0){if(ba){ba=($&255)>>>1}else{ba=c[L>>2]|0}if((ba|0)!=0){aa=c[e>>2]|0;ba=c[aa+12>>2]|0;ca=c[aa+16>>2]|0;if((ba|0)==(ca|0)){$=oc[c[(c[aa>>2]|0)+36>>2]&127](aa)|0;ca=c[e>>2]|0;_=a[x>>0]|0;aa=ca;ba=c[ca+12>>2]|0;ca=c[ca+16>>2]|0}else{$=d[ba>>0]|0}da=aa+12|0;ca=(ba|0)==(ca|0);if(($&255)<<24>>24==(a[((_&1)==0?K:c[D>>2]|0)>>0]|0)){if(ca){oc[c[(c[aa>>2]|0)+40>>2]&127](aa)|0}else{c[da>>2]=ba+1}_=a[x>>0]|0;if((_&1)==0){_=(_&255)>>>1}else{_=c[H>>2]|0}T=_>>>0>1?x:T;break b}if(ca){_=oc[c[(c[aa>>2]|0)+36>>2]&127](aa)|0}else{_=d[ba>>0]|0}if(!((_&255)<<24>>24==(a[((a[s>>0]&1)==0?I:c[m>>2]|0)>>0]|0))){C=196;break a}aa=c[e>>2]|0;_=aa+12|0;$=c[_>>2]|0;if(($|0)==(c[aa+16>>2]|0)){oc[c[(c[aa>>2]|0)+40>>2]&127](aa)|0}else{c[_>>2]=$+1}a[l>>0]=1;_=a[s>>0]|0;if((_&1)==0){_=(_&255)>>>1}else{_=c[L>>2]|0}T=_>>>0>1?s:T;break b}}if(aa){aa=(_&255)>>>1}else{aa=c[H>>2]|0}ba=c[e>>2]|0;ca=c[ba+12>>2]|0;da=(ca|0)==(c[ba+16>>2]|0);if((aa|0)==0){if(da){_=oc[c[(c[ba>>2]|0)+36>>2]&127](ba)|0;$=a[s>>0]|0}else{_=d[ca>>0]|0}if(!((_&255)<<24>>24==(a[(($&1)==0?I:c[m>>2]|0)>>0]|0))){break b}aa=c[e>>2]|0;_=aa+12|0;$=c[_>>2]|0;if(($|0)==(c[aa+16>>2]|0)){oc[c[(c[aa>>2]|0)+40>>2]&127](aa)|0}else{c[_>>2]=$+1}a[l>>0]=1;_=a[s>>0]|0;if((_&1)==0){_=(_&255)>>>1}else{_=c[L>>2]|0}T=_>>>0>1?s:T;break b}if(da){$=oc[c[(c[ba>>2]|0)+36>>2]&127](ba)|0;_=a[x>>0]|0}else{$=d[ca>>0]|0}if(!(($&255)<<24>>24==(a[((_&1)==0?K:c[D>>2]|0)>>0]|0))){a[l>>0]=1;break b}_=c[e>>2]|0;$=_+12|0;aa=c[$>>2]|0;if((aa|0)==(c[_+16>>2]|0)){oc[c[(c[_>>2]|0)+40>>2]&127](_)|0}else{c[$>>2]=aa+1}_=a[x>>0]|0;if((_&1)==0){_=(_&255)>>>1}else{_=c[H>>2]|0}T=_>>>0>1?x:T}break};case 4:{_=0;e:while(1){$=c[e>>2]|0;do{if(($|0)!=0){if((c[$+12>>2]|0)==(c[$+16>>2]|0)){if((oc[c[(c[$>>2]|0)+36>>2]&127]($)|0)==-1){c[e>>2]=0;$=0;break}else{$=c[e>>2]|0;break}}}else{$=0}}while(0);$=($|0)==0;do{if((f|0)!=0){if((c[f+12>>2]|0)!=(c[f+16>>2]|0)){if($){break}else{break e}}if(!((oc[c[(c[f>>2]|0)+36>>2]&127](f)|0)==-1)){if(!$){break e}}else{C=259}}else{C=259}}while(0);if((C|0)==259){C=0;if($){f=0;break}else{f=0}}$=c[e>>2]|0;aa=c[$+12>>2]|0;if((aa|0)==(c[$+16>>2]|0)){aa=oc[c[(c[$>>2]|0)+36>>2]&127]($)|0}else{aa=d[aa>>0]|0}$=aa&255;if($<<24>>24>-1?!((b[(c[J>>2]|0)+(aa<<24>>24<<1)>>1]&2048)==0):0){aa=c[o>>2]|0;if((aa|0)==(p|0)){ba=(c[R>>2]|0)!=213;ca=c[n>>2]|0;aa=p-ca|0;p=aa>>>0<2147483647?aa<<1:-1;ca=wn(ba?ca:0,p)|0;if((ca|0)==0){C=268;break a}if(!ba){ba=c[n>>2]|0;c[n>>2]=ca;if((ba|0)!=0){lc[c[R>>2]&255](ba);ca=c[n>>2]|0}}else{c[n>>2]=ca}c[R>>2]=214;aa=ca+aa|0;c[o>>2]=aa;p=(c[n>>2]|0)+p|0}c[o>>2]=aa+1;a[aa>>0]=$;_=_+1|0}else{aa=a[t>>0]|0;if((aa&1)==0){aa=(aa&255)>>>1}else{aa=c[P>>2]|0}if(!((((aa|0)==0|(_|0)==0)^1)&$<<24>>24==G<<24>>24)){break}if((Y|0)==(X|0)){Y=Y-Z|0;X=Y>>>0<2147483647?Y<<1:-1;if((W|0)==213){Z=0}W=wn(Z,X)|0;if((W|0)==0){C=285;break a}Z=W;X=W+(X>>>2<<2)|0;Y=W+(Y>>2<<2)|0;W=214}c[Y>>2]=_;Y=Y+4|0;_=0}$=c[e>>2]|0;aa=$+12|0;ba=c[aa>>2]|0;if((ba|0)==(c[$+16>>2]|0)){oc[c[(c[$>>2]|0)+40>>2]&127]($)|0;continue}else{c[aa>>2]=ba+1;continue}}if(!((Z|0)==(Y|0)|(_|0)==0)){if((Y|0)==(X|0)){Y=Y-Z|0;X=Y>>>0<2147483647?Y<<1:-1;if((W|0)==213){Z=0}W=wn(Z,X)|0;if((W|0)==0){C=297;break a}Z=W;X=W+(X>>>2<<2)|0;Y=W+(Y>>2<<2)|0;W=214}c[Y>>2]=_;Y=Y+4|0}if((V|0)>0){_=c[e>>2]|0;do{if((_|0)!=0){if((c[_+12>>2]|0)==(c[_+16>>2]|0)){if((oc[c[(c[_>>2]|0)+36>>2]&127](_)|0)==-1){c[e>>2]=0;_=0;break}else{_=c[e>>2]|0;break}}}else{_=0}}while(0);_=(_|0)==0;do{if((f|0)!=0){if((c[f+12>>2]|0)!=(c[f+16>>2]|0)){if(_){break}else{C=319;break a}}if(!((oc[c[(c[f>>2]|0)+36>>2]&127](f)|0)==-1)){if(!_){C=319;break a}}else{C=313}}else{C=313}}while(0);if((C|0)==313){C=0;if(_){C=319;break a}else{f=0}}_=c[e>>2]|0;$=c[_+12>>2]|0;if(($|0)==(c[_+16>>2]|0)){_=oc[c[(c[_>>2]|0)+36>>2]&127](_)|0}else{_=d[$>>0]|0}if(!((_&255)<<24>>24==h<<24>>24)){C=319;break a}_=c[e>>2]|0;$=_+12|0;aa=c[$>>2]|0;if((aa|0)==(c[_+16>>2]|0)){oc[c[(c[_>>2]|0)+40>>2]&127](_)|0;aa=f;$=f}else{c[$>>2]=aa+1;aa=f;$=f}while(1){_=c[e>>2]|0;do{if((_|0)!=0){if((c[_+12>>2]|0)==(c[_+16>>2]|0)){if((oc[c[(c[_>>2]|0)+36>>2]&127](_)|0)==-1){c[e>>2]=0;_=0;break}else{_=c[e>>2]|0;break}}}else{_=0}}while(0);ba=(_|0)==0;do{if(($|0)!=0){if((c[$+12>>2]|0)!=(c[$+16>>2]|0)){if(ba){_=aa;break}else{C=341;break a}}if(!((oc[c[(c[$>>2]|0)+36>>2]&127]($)|0)==-1)){if(ba^(aa|0)==0){_=aa;$=aa}else{C=341;break a}}else{_=0;f=0;C=334}}else{_=aa;C=334}}while(0);if((C|0)==334){C=0;if(ba){C=341;break a}else{$=0}}aa=c[e>>2]|0;ba=c[aa+12>>2]|0;if((ba|0)==(c[aa+16>>2]|0)){aa=oc[c[(c[aa>>2]|0)+36>>2]&127](aa)|0}else{aa=d[ba>>0]|0}if(!((aa&255)<<24>>24>-1)){C=341;break a}if((b[(c[J>>2]|0)+(aa<<24>>24<<1)>>1]&2048)==0){C=341;break a}aa=c[o>>2]|0;if((aa|0)==(p|0)){ba=(c[R>>2]|0)!=213;ca=c[n>>2]|0;aa=p-ca|0;p=aa>>>0<2147483647?aa<<1:-1;ca=wn(ba?ca:0,p)|0;if((ca|0)==0){C=344;break a}do{if(ba){c[n>>2]=ca}else{ba=c[n>>2]|0;c[n>>2]=ca;if((ba|0)==0){break}lc[c[R>>2]&255](ba);ca=c[n>>2]|0}}while(0);c[R>>2]=214;aa=ca+aa|0;c[o>>2]=aa;p=(c[n>>2]|0)+p|0}ca=c[e>>2]|0;ba=c[ca+12>>2]|0;if((ba|0)==(c[ca+16>>2]|0)){ba=oc[c[(c[ca>>2]|0)+36>>2]&127](ca)|0;aa=c[o>>2]|0}else{ba=d[ba>>0]|0}c[o>>2]=aa+1;a[aa>>0]=ba;V=V+ -1|0;ca=c[e>>2]|0;aa=ca+12|0;ba=c[aa>>2]|0;if((ba|0)==(c[ca+16>>2]|0)){oc[c[(c[ca>>2]|0)+40>>2]&127](ca)|0}else{c[aa>>2]=ba+1}if((V|0)>0){aa=_}else{break}}}if((c[o>>2]|0)==(c[n>>2]|0)){C=361;break a}break};case 1:{if((U|0)==3){C=363;break a}C=c[e>>2]|0;_=c[C+12>>2]|0;if((_|0)==(c[C+16>>2]|0)){C=oc[c[(c[C>>2]|0)+36>>2]&127](C)|0}else{C=d[_>>0]|0}if(!((C&255)<<24>>24>-1)){C=96;break a}if((b[(c[J>>2]|0)+(C<<24>>24<<1)>>1]&8192)==0){C=96;break a}C=c[e>>2]|0;$=C+12|0;_=c[$>>2]|0;if((_|0)==(c[C+16>>2]|0)){C=oc[c[(c[C>>2]|0)+40>>2]&127](C)|0}else{c[$>>2]=_+1;C=d[_>>0]|0}_=C&255;$=a[w>>0]|0;C=($&1)!=0;if(C){aa=(c[w>>2]&-2)+ -1|0;$=c[O>>2]|0}else{aa=10;$=($&255)>>>1}if(($|0)==(aa|0)){lg(w,aa,1,aa,aa,0);if((a[w>>0]&1)==0){C=93}else{C=94}}else{if(C){C=94}else{C=93}}if((C|0)==93){a[w>>0]=($<<1)+2;ba=g;aa=$+1|0}else if((C|0)==94){ba=c[E>>2]|0;aa=$+1|0;c[O>>2]=aa}a[ba+$>>0]=_;a[ba+aa>>0]=0;C=97;break};default:{}}}while(0);f:do{if((C|0)==97){C=0;if((U|0)==3){C=363;break a}else{aa=f;$=f}while(1){_=c[e>>2]|0;do{if((_|0)!=0){if((c[_+12>>2]|0)==(c[_+16>>2]|0)){if((oc[c[(c[_>>2]|0)+36>>2]&127](_)|0)==-1){c[e>>2]=0;_=0;break}else{_=c[e>>2]|0;break}}}else{_=0}}while(0);ba=(_|0)==0;do{if(($|0)!=0){if((c[$+12>>2]|0)!=(c[$+16>>2]|0)){if(ba){_=aa;break}else{break f}}if(!((oc[c[(c[$>>2]|0)+36>>2]&127]($)|0)==-1)){if(ba^(aa|0)==0){_=aa;$=aa}else{break f}}else{_=0;f=0;C=109}}else{_=aa;C=109}}while(0);if((C|0)==109){C=0;if(ba){break f}else{$=0}}ba=c[e>>2]|0;aa=c[ba+12>>2]|0;if((aa|0)==(c[ba+16>>2]|0)){aa=oc[c[(c[ba>>2]|0)+36>>2]&127](ba)|0}else{aa=d[aa>>0]|0}if(!((aa&255)<<24>>24>-1)){break f}if((b[(c[J>>2]|0)+(aa<<24>>24<<1)>>1]&8192)==0){break f}ba=c[e>>2]|0;C=ba+12|0;aa=c[C>>2]|0;if((aa|0)==(c[ba+16>>2]|0)){C=oc[c[(c[ba>>2]|0)+40>>2]&127](ba)|0}else{c[C>>2]=aa+1;C=d[aa>>0]|0}aa=C&255;ba=a[w>>0]|0;ca=(ba&1)!=0;if(ca){C=(c[w>>2]&-2)+ -1|0;ba=c[O>>2]|0}else{C=10;ba=(ba&255)>>>1}if((ba|0)==(C|0)){lg(w,C,1,C,C,0);if((a[w>>0]&1)==0){C=126}else{C=127}}else{if(ca){C=127}else{C=126}}if((C|0)==126){C=0;a[w>>0]=(ba<<1)+2;ca=g;da=ba+1|0}else if((C|0)==127){C=0;ca=c[E>>2]|0;da=ba+1|0;c[O>>2]=da}a[ca+ba>>0]=aa;a[ca+da>>0]=0;aa=_}}}while(0);U=U+1|0;if(!(U>>>0<4)){C=363;break}}g:switch(C|0){case 96:{c[k>>2]=c[k>>2]|4;e=0;Y=Z;break};case 196:{c[k>>2]=c[k>>2]|4;e=0;Y=Z;break};case 247:{c[k>>2]=c[k>>2]|4;e=0;Y=Z;break};case 268:{fa=Xa(4)|0;c[fa>>2]=22680;wb(fa|0,22728,206)};case 285:{fa=Xa(4)|0;c[fa>>2]=22680;wb(fa|0,22728,206)};case 297:{fa=Xa(4)|0;c[fa>>2]=22680;wb(fa|0,22728,206)};case 319:{c[k>>2]=c[k>>2]|4;e=0;Y=Z;break};case 341:{c[k>>2]=c[k>>2]|4;e=0;Y=Z;break};case 344:{fa=Xa(4)|0;c[fa>>2]=22680;wb(fa|0,22728,206)};case 361:{c[k>>2]=c[k>>2]|4;e=0;Y=Z;break};case 363:{h:do{if((T|0)!=0){F=T+1|0;n=T+8|0;l=T+4|0;o=1;i:while(1){h=a[T>>0]|0;if((h&1)==0){h=(h&255)>>>1}else{h=c[l>>2]|0}if(!(o>>>0<h>>>0)){break h}h=c[e>>2]|0;do{if((h|0)!=0){if((c[h+12>>2]|0)==(c[h+16>>2]|0)){if((oc[c[(c[h>>2]|0)+36>>2]&127](h)|0)==-1){c[e>>2]=0;h=0;break}else{h=c[e>>2]|0;break}}}else{h=0}}while(0);h=(h|0)==0;do{if((f|0)!=0){if((c[f+12>>2]|0)!=(c[f+16>>2]|0)){if(h){break}else{break i}}if(!((oc[c[(c[f>>2]|0)+36>>2]&127](f)|0)==-1)){if(!h){break i}}else{C=380}}else{C=380}}while(0);if((C|0)==380){C=0;if(h){break}else{f=0}}h=c[e>>2]|0;G=c[h+12>>2]|0;if((G|0)==(c[h+16>>2]|0)){h=oc[c[(c[h>>2]|0)+36>>2]&127](h)|0}else{h=d[G>>0]|0}if((a[T>>0]&1)==0){G=F}else{G=c[n>>2]|0}if(!((h&255)<<24>>24==(a[G+o>>0]|0))){break}o=o+1|0;h=c[e>>2]|0;G=h+12|0;H=c[G>>2]|0;if((H|0)==(c[h+16>>2]|0)){oc[c[(c[h>>2]|0)+40>>2]&127](h)|0;continue}else{c[G>>2]=H+1;continue}}c[k>>2]=c[k>>2]|4;e=0;Y=Z;break g}}while(0);if((Z|0)!=(Y|0)){c[B>>2]=0;qk(t,Z,Y,B);if((c[B>>2]|0)==0){e=1;Y=Z}else{c[k>>2]=c[k>>2]|4;e=0;Y=Z}}else{e=1}break}}if(!((a[w>>0]&1)==0)?(v=c[E>>2]|0,(v|0)!=0):0){vn(v)}if(!((a[s>>0]&1)==0)?(z=c[m>>2]|0,(z|0)!=0):0){vn(z)}if(!((a[x>>0]&1)==0)?(A=c[D>>2]|0,(A|0)!=0):0){vn(A)}if(!((a[y>>0]&1)==0)?(r=c[j>>2]|0,(r|0)!=0):0){vn(r)}if(!((a[t>>0]&1)==0)?(q=c[t+8>>2]|0,(q|0)!=0):0){vn(q)}if((Y|0)==0){i=u;return e|0}lc[W&255](Y);i=u;return e|0}function ok(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;d=Xa(8)|0;c[d>>2]=9928;b=Jn(a|0)|0;e=b+13|0;e=(e|0)==0?1:e;while(1){g=un(e)|0;if((g|0)!=0){f=7;break}g=c[5666]|0;c[5666]=g+0;if((g|0)==0){break}sc[g&31]()}if((f|0)==7){c[g+4>>2]=b;c[g>>2]=b;f=g+12|0;c[d+4>>2]=f;c[g+8>>2]=0;Ln(f|0,a|0,b+1|0)|0;wb(d|0,10064,106)}g=Xa(4)|0;c[g>>2]=22680;wb(g|0,22728,206)}function pk(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;m=i;i=i+128|0;p=m;s=m+28|0;d=m+16|0;q=m+12|0;t=m+24|0;c[d>>2]=s;l=d+4|0;c[l>>2]=213;s=s+100|0;n=c[h+28>>2]|0;u=n+4|0;c[u>>2]=(c[u>>2]|0)+1;if(!((c[3364]|0)==-1)){c[p>>2]=13456;c[p+4>>2]=208;c[p+8>>2]=0;cg(13456,p)}p=(c[13460>>2]|0)+ -1|0;u=c[n+8>>2]|0;if((c[n+12>>2]|0)-u>>2>>>0>p>>>0?(r=c[u+(p<<2)>>2]|0,(r|0)!=0):0){a[t>>0]=0;p=c[f>>2]|0;do{if(nk(e,p,g,n,c[h+4>>2]|0,j,t,r,d,q,s)|0){if((a[k>>0]&1)==0){a[k+1>>0]=0;a[k>>0]=0}else{a[c[k+8>>2]>>0]=0;c[k+4>>2]=0}if((a[t>>0]|0)!=0){g=xc[c[(c[r>>2]|0)+28>>2]&63](r,45)|0;h=a[k>>0]|0;o=(h&1)!=0;if(o){s=(c[k>>2]&-2)+ -1|0;h=c[k+4>>2]|0}else{s=10;h=(h&255)>>>1}if((h|0)==(s|0)){lg(k,s,1,s,s,0);if((a[k>>0]&1)==0){o=21}else{o=22}}else{if(o){o=22}else{o=21}}if((o|0)==21){a[k>>0]=(h<<1)+2;s=k+1|0;t=h+1|0}else if((o|0)==22){s=c[k+8>>2]|0;t=h+1|0;c[k+4>>2]=t}a[s+h>>0]=g;a[s+t>>0]=0}r=xc[c[(c[r>>2]|0)+28>>2]&63](r,48)|0;h=c[d>>2]|0;q=c[q>>2]|0;g=q+ -1|0;a:do{if(h>>>0<g>>>0){while(1){s=h+1|0;if(!((a[h>>0]|0)==r<<24>>24)){break a}if(s>>>0<g>>>0){h=s}else{h=s;break}}}}while(0);s=h;r=a[k>>0]|0;if((r&1)==0){t=r;u=10;r=(r&255)>>>1}else{u=c[k>>2]|0;t=u&255;u=(u&-2)+ -1|0;r=c[k+4>>2]|0}g=q-s|0;if((q|0)!=(h|0)){if((u-r|0)>>>0<g>>>0){lg(k,u,r+g-u|0,r,r,0);t=a[k>>0]|0}if((t&1)==0){t=k+1|0}else{t=c[k+8>>2]|0}s=q+(r-s)|0;u=t+r|0;while(1){a[u>>0]=a[h>>0]|0;h=h+1|0;if((h|0)==(q|0)){break}u=u+1|0}a[t+s>>0]=0;q=r+g|0;if((a[k>>0]&1)==0){a[k>>0]=q<<1;break}else{c[k+4>>2]=q;break}}}}while(0);k=c[e>>2]|0;if((k|0)!=0){if((c[k+12>>2]|0)==(c[k+16>>2]|0)?(oc[c[(c[k>>2]|0)+36>>2]&127](k)|0)==-1:0){c[e>>2]=0;k=0}}else{k=0}e=(k|0)==0;do{if((p|0)!=0){if((c[p+12>>2]|0)!=(c[p+16>>2]|0)){if(e){break}else{o=57;break}}if(!((oc[c[(c[p>>2]|0)+36>>2]&127](p)|0)==-1)){if(e){break}else{o=57;break}}else{c[f>>2]=0;o=55;break}}else{o=55}}while(0);if((o|0)==55?e:0){o=57}if((o|0)==57){c[j>>2]=c[j>>2]|2}c[b>>2]=k;t=n+4|0;u=c[t>>2]|0;c[t>>2]=u+ -1;if((u|0)==0){lc[c[(c[n>>2]|0)+8>>2]&255](n)}j=c[d>>2]|0;c[d>>2]=0;if((j|0)==0){i=m;return}lc[c[l>>2]&255](j);i=m;return}u=Xa(4)|0;c[u>>2]=21304;wb(u|0,21376,196)}function qk(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0;g=i;k=a[b>>0]|0;if((k&1)==0){j=(k&255)>>>1}else{j=c[b+4>>2]|0}if((j|0)==0){i=g;return}if((d|0)!=(e|0)?(h=e+ -4|0,h>>>0>d>>>0):0){j=d;do{k=c[j>>2]|0;c[j>>2]=c[h>>2];c[h>>2]=k;j=j+4|0;h=h+ -4|0}while(j>>>0<h>>>0);k=a[b>>0]|0}if((k&1)==0){h=b+1|0;b=(k&255)>>>1}else{h=c[b+8>>2]|0;b=c[b+4>>2]|0}e=e+ -4|0;k=a[h>>0]|0;j=k<<24>>24<1|k<<24>>24==127;a:do{if(e>>>0>d>>>0){b=h+b|0;while(1){if(!j?(k<<24>>24|0)!=(c[d>>2]|0):0){break}h=(b-h|0)>1?h+1|0:h;d=d+4|0;k=a[h>>0]|0;j=k<<24>>24<1|k<<24>>24==127;if(!(d>>>0<e>>>0)){break a}}c[f>>2]=4;i=g;return}}while(0);if(j){i=g;return}j=c[e>>2]|0;if(!(k<<24>>24>>>0<j>>>0|(j|0)==0)){i=g;return}c[f>>2]=4;i=g;return}function rk(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function sk(a){a=a|0;return}function tk(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;n=i;i=i+576|0;q=n;v=n+24|0;d=n+16|0;r=n+464|0;u=n+568|0;s=n+424|0;p=n+468|0;c[d>>2]=v;m=d+4|0;c[m>>2]=213;v=v+400|0;o=c[h+28>>2]|0;x=o+4|0;c[x>>2]=(c[x>>2]|0)+1;if(!((c[3362]|0)==-1)){c[q>>2]=13448;c[q+4>>2]=208;c[q+8>>2]=0;cg(13448,q)}x=(c[13452>>2]|0)+ -1|0;w=c[o+8>>2]|0;if((c[o+12>>2]|0)-w>>2>>>0>x>>>0?(t=c[w+(x<<2)>>2]|0,(t|0)!=0):0){a[u>>0]=0;do{if(uk(e,c[f>>2]|0,g,o,c[h+4>>2]|0,j,u,t,d,r,v)|0){uc[c[(c[t>>2]|0)+48>>2]&31](t,13168,13178|0,s)|0;h=c[r>>2]|0;g=c[d>>2]|0;t=h-g|0;if((t|0)>392){v=un((t>>2)+2|0)|0;if((v|0)==0){x=Xa(4)|0;c[x>>2]=22680;wb(x|0,22728,206)}else{t=v}}else{t=0;v=p}if((a[u>>0]|0)!=0){a[v>>0]=45;v=v+1|0}if(g>>>0<h>>>0){h=s+40|0;u=s;do{x=c[g>>2]|0;w=s;while(1){if((c[w>>2]|0)==(x|0)){break}w=w+4|0;if((w|0)==(h|0)){w=h;break}}a[v>>0]=a[13168+(w-u>>2)>>0]|0;g=g+4|0;v=v+1|0}while(g>>>0<(c[r>>2]|0)>>>0)}a[v>>0]=0;c[q>>2]=k;if((Fa(p|0,13104,q|0)|0)==1){if((t|0)==0){break}vn(t);break}j=Xa(8)|0;c[j>>2]=9928;while(1){d=un(28)|0;if((d|0)!=0){l=29;break}l=c[5666]|0;c[5666]=l+0;if((l|0)==0){l=27;break}sc[l&31]()}if((l|0)==27){x=Xa(4)|0;c[x>>2]=22680;wb(x|0,22728,206)}else if((l|0)==29){c[d+4>>2]=15;c[d>>2]=15;b=d+12|0;c[j+4>>2]=b;c[d+8>>2]=0;b=b+0|0;d=13112|0;l=b+16|0;do{a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0}while((b|0)<(l|0));wb(j|0,10064,106)}}}while(0);k=c[e>>2]|0;if((k|0)!=0){p=c[k+12>>2]|0;if((p|0)==(c[k+16>>2]|0)){p=oc[c[(c[k>>2]|0)+36>>2]&127](k)|0}else{p=c[p>>2]|0}if((p|0)==-1){c[e>>2]=0;e=0;k=1}else{e=k;k=0}}else{e=0;k=1}q=c[f>>2]|0;do{if((q|0)!=0){p=c[q+12>>2]|0;if((p|0)==(c[q+16>>2]|0)){p=oc[c[(c[q>>2]|0)+36>>2]&127](q)|0}else{p=c[p>>2]|0}if(!((p|0)==-1)){if(k){break}else{l=47;break}}else{c[f>>2]=0;l=45;break}}else{l=45}}while(0);if((l|0)==45?k:0){l=47}if((l|0)==47){c[j>>2]=c[j>>2]|2}c[b>>2]=e;w=o+4|0;x=c[w>>2]|0;c[w>>2]=x+ -1;if((x|0)==0){lc[c[(c[o>>2]|0)+8>>2]&255](o)}l=c[d>>2]|0;c[d>>2]=0;if((l|0)==0){i=n;return}lc[c[m>>2]&255](l);i=n;return}x=Xa(4)|0;c[x>>2]=21304;wb(x|0,21376,196)}function uk(b,e,f,g,h,j,k,l,m,n,o){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0;v=i;i=i+592|0;Q=v;O=v+112|0;K=v+12|0;G=v+100|0;H=v+40|0;E=v+24|0;N=v+36|0;M=v+88|0;L=v+76|0;J=v+52|0;I=v+64|0;P=v+120|0;F=v+520|0;t=v+524|0;w=v+536|0;x=v+548|0;r=v+560|0;s=v+572|0;A=v+584|0;c[F>>2]=0;c[t+0>>2]=0;c[t+4>>2]=0;c[t+8>>2]=0;c[w+0>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0;c[x+0>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;c[r+0>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;c[s+0>>2]=0;c[s+4>>2]=0;c[s+8>>2]=0;do{if(f){if(!((c[3260]|0)==-1)){c[Q>>2]=13040;c[Q+4>>2]=208;c[Q+8>>2]=0;cg(13040,Q)}C=(c[13044>>2]|0)+ -1|0;I=c[g+8>>2]|0;if((c[g+12>>2]|0)-I>>2>>>0>C>>>0?(D=c[I+(C<<2)>>2]|0,(D|0)!=0):0){mc[c[(c[D>>2]|0)+44>>2]&127](O,D);c[F>>2]=c[O>>2];mc[c[(c[D>>2]|0)+32>>2]&127](K,D);if((a[r>>0]&1)==0){c[r+4>>2]=0;a[r>>0]=0}else{c[c[r+8>>2]>>2]=0;c[r+4>>2]=0}og(r);c[r+0>>2]=c[K+0>>2];c[r+4>>2]=c[K+4>>2];c[r+8>>2]=c[K+8>>2];c[K+0>>2]=0;c[K+4>>2]=0;c[K+8>>2]=0;mc[c[(c[D>>2]|0)+28>>2]&127](G,D);if((a[x>>0]&1)==0){c[x+4>>2]=0;a[x>>0]=0}else{c[c[x+8>>2]>>2]=0;c[x+4>>2]=0}og(x);c[x+0>>2]=c[G+0>>2];c[x+4>>2]=c[G+4>>2];c[x+8>>2]=c[G+8>>2];c[G+0>>2]=0;c[G+4>>2]=0;c[G+8>>2]=0;g=oc[c[(c[D>>2]|0)+12>>2]&127](D)|0;G=oc[c[(c[D>>2]|0)+16>>2]&127](D)|0;mc[c[(c[D>>2]|0)+20>>2]&127](H,D);if((a[t>>0]&1)==0){a[t+1>>0]=0;a[t>>0]=0}else{a[c[t+8>>2]>>0]=0;c[t+4>>2]=0}ig(t);c[t+0>>2]=c[H+0>>2];c[t+4>>2]=c[H+4>>2];c[t+8>>2]=c[H+8>>2];c[H+0>>2]=0;c[H+4>>2]=0;c[H+8>>2]=0;mc[c[(c[D>>2]|0)+24>>2]&127](E,D);if((a[w>>0]&1)==0){c[w+4>>2]=0;a[w>>0]=0}else{c[c[w+8>>2]>>2]=0;c[w+4>>2]=0}og(w);c[w+0>>2]=c[E+0>>2];c[w+4>>2]=c[E+4>>2];c[w+8>>2]=c[E+8>>2];c[E+0>>2]=0;c[E+4>>2]=0;c[E+8>>2]=0;f=oc[c[(c[D>>2]|0)+36>>2]&127](D)|0;break}$=Xa(4)|0;c[$>>2]=21304;wb($|0,21376,196)}else{if(!((c[3244]|0)==-1)){c[Q>>2]=12976;c[Q+4>>2]=208;c[Q+8>>2]=0;cg(12976,Q)}D=(c[12980>>2]|0)+ -1|0;E=c[g+8>>2]|0;if((c[g+12>>2]|0)-E>>2>>>0>D>>>0?(C=c[E+(D<<2)>>2]|0,(C|0)!=0):0){mc[c[(c[C>>2]|0)+44>>2]&127](N,C);c[F>>2]=c[N>>2];mc[c[(c[C>>2]|0)+32>>2]&127](M,C);if((a[r>>0]&1)==0){c[r+4>>2]=0;a[r>>0]=0}else{c[c[r+8>>2]>>2]=0;c[r+4>>2]=0}og(r);c[r+0>>2]=c[M+0>>2];c[r+4>>2]=c[M+4>>2];c[r+8>>2]=c[M+8>>2];c[M+0>>2]=0;c[M+4>>2]=0;c[M+8>>2]=0;mc[c[(c[C>>2]|0)+28>>2]&127](L,C);if((a[x>>0]&1)==0){c[x+4>>2]=0;a[x>>0]=0}else{c[c[x+8>>2]>>2]=0;c[x+4>>2]=0}og(x);c[x+0>>2]=c[L+0>>2];c[x+4>>2]=c[L+4>>2];c[x+8>>2]=c[L+8>>2];c[L+0>>2]=0;c[L+4>>2]=0;c[L+8>>2]=0;g=oc[c[(c[C>>2]|0)+12>>2]&127](C)|0;G=oc[c[(c[C>>2]|0)+16>>2]&127](C)|0;mc[c[(c[C>>2]|0)+20>>2]&127](J,C);if((a[t>>0]&1)==0){a[t+1>>0]=0;a[t>>0]=0}else{a[c[t+8>>2]>>0]=0;c[t+4>>2]=0}ig(t);c[t+0>>2]=c[J+0>>2];c[t+4>>2]=c[J+4>>2];c[t+8>>2]=c[J+8>>2];c[J+0>>2]=0;c[J+4>>2]=0;c[J+8>>2]=0;mc[c[(c[C>>2]|0)+24>>2]&127](I,C);if((a[w>>0]&1)==0){c[w+4>>2]=0;a[w>>0]=0}else{c[c[w+8>>2]>>2]=0;c[w+4>>2]=0}og(w);c[w+0>>2]=c[I+0>>2];c[w+4>>2]=c[I+4>>2];c[w+8>>2]=c[I+8>>2];c[I+0>>2]=0;c[I+4>>2]=0;c[I+8>>2]=0;f=oc[c[(c[C>>2]|0)+36>>2]&127](C)|0;break}$=Xa(4)|0;c[$>>2]=21304;wb($|0,21376,196)}}while(0);c[n>>2]=c[m>>2];I=r+4|0;D=r+8|0;H=x+4|0;C=x+8|0;L=(h&512|0)!=0;J=w+4|0;h=w+8|0;M=s+4|0;E=s+8|0;N=F+3|0;K=m+4|0;O=t+4|0;S=P+400|0;U=P;T=P;Q=0;P=0;R=213;a:while(1){V=c[b>>2]|0;do{if((V|0)!=0){W=c[V+12>>2]|0;if((W|0)==(c[V+16>>2]|0)){V=oc[c[(c[V>>2]|0)+36>>2]&127](V)|0}else{V=c[W>>2]|0}if((V|0)==-1){c[b>>2]=0;V=1;break}else{V=(c[b>>2]|0)==0;break}}else{V=1}}while(0);if((e|0)!=0){W=c[e+12>>2]|0;if((W|0)==(c[e+16>>2]|0)){W=oc[c[(c[e>>2]|0)+36>>2]&127](e)|0}else{W=c[W>>2]|0}if(!((W|0)==-1)){if(!V){B=378;break}}else{B=75}}else{B=75}if((B|0)==75){B=0;if(V){e=0;B=378;break}else{e=0}}b:do{switch(a[F+Q>>0]|0){case 1:{if((Q|0)==3){B=378;break a}B=c[b>>2]|0;V=c[B+12>>2]|0;if((V|0)==(c[B+16>>2]|0)){B=oc[c[(c[B>>2]|0)+36>>2]&127](B)|0}else{B=c[V>>2]|0}if(!(hc[c[(c[l>>2]|0)+12>>2]&63](l,8192,B)|0)){B=97;break a}W=c[b>>2]|0;B=W+12|0;V=c[B>>2]|0;if((V|0)==(c[W+16>>2]|0)){V=oc[c[(c[W>>2]|0)+40>>2]&127](W)|0}else{c[B>>2]=V+4;V=c[V>>2]|0}W=a[s>>0]|0;B=(W&1)!=0;if(B){X=(c[s>>2]&-2)+ -1|0;W=c[M>>2]|0}else{X=1;W=(W&255)>>>1}if((W|0)==(X|0)){pg(s,X,1,X,X,0,0);if((a[s>>0]&1)==0){B=94}else{B=95}}else{if(B){B=95}else{B=94}}if((B|0)==94){a[s>>0]=(W<<1)+2;X=M;Y=W+1|0}else if((B|0)==95){X=c[E>>2]|0;Y=W+1|0;c[M>>2]=Y}c[X+(W<<2)>>2]=V;c[X+(Y<<2)>>2]=0;B=98;break};case 2:{if(!((P|0)!=0|Q>>>0<2)){if((Q|0)==2){V=(a[N>>0]|0)!=0}else{V=0}if(!(L|V)){P=0;break b}}Y=a[w>>0]|0;V=(Y&1)==0?J:c[h>>2]|0;c:do{if((Q|0)!=0?(d[F+(Q+ -1)>>0]|0)<2:0){while(1){if((Y&1)==0){X=J;W=(Y&255)>>>1}else{X=c[h>>2]|0;W=c[J>>2]|0}if((V|0)==(X+(W<<2)|0)){break}if(!(hc[c[(c[l>>2]|0)+12>>2]&63](l,8192,c[V>>2]|0)|0)){B=212;break}Y=a[w>>0]|0;V=V+4|0}if((B|0)==212){B=0;Y=a[w>>0]|0}X=(Y&1)==0?J:c[h>>2]|0;W=V-X>>2;Z=a[s>>0]|0;$=(Z&1)==0;if($){_=(Z&255)>>>1}else{_=c[M>>2]|0}if(!(W>>>0>_>>>0)){if($){_=(Z&255)>>>1;$=M;Z=_;_=M+(_-W<<2)|0}else{aa=c[E>>2]|0;_=c[M>>2]|0;$=aa;Z=_;_=aa+(_-W<<2)|0}W=$+(Z<<2)|0;if((_|0)==(W|0)){W=e;X=e}else{Z=X;while(1){if((c[_>>2]|0)!=(c[Z>>2]|0)){W=e;V=X;X=e;break c}_=_+4|0;if((_|0)==(W|0)){W=e;X=e;break c}Z=Z+4|0}}}else{W=e;V=X;X=e}}else{W=e;X=e}}while(0);while(1){if((Y&1)==0){Z=J;Y=(Y&255)>>>1}else{Z=c[h>>2]|0;Y=c[J>>2]|0}if((V|0)==(Z+(Y<<2)|0)){break}Y=c[b>>2]|0;do{if((Y|0)!=0){Z=c[Y+12>>2]|0;if((Z|0)==(c[Y+16>>2]|0)){Y=oc[c[(c[Y>>2]|0)+36>>2]&127](Y)|0}else{Y=c[Z>>2]|0}if((Y|0)==-1){c[b>>2]=0;Y=1;break}else{Y=(c[b>>2]|0)==0;break}}else{Y=1}}while(0);if((X|0)!=0){Z=c[X+12>>2]|0;if((Z|0)==(c[X+16>>2]|0)){X=oc[c[(c[X>>2]|0)+36>>2]&127](X)|0}else{X=c[Z>>2]|0}if(!((X|0)==-1)){if(Y^(W|0)==0){Y=W;X=W}else{break}}else{W=0;e=0;B=240}}else{B=240}if((B|0)==240){B=0;if(Y){break}else{Y=W;X=0}}Z=c[b>>2]|0;W=c[Z+12>>2]|0;if((W|0)==(c[Z+16>>2]|0)){W=oc[c[(c[Z>>2]|0)+36>>2]&127](Z)|0}else{W=c[W>>2]|0}if((W|0)!=(c[V>>2]|0)){break}_=c[b>>2]|0;W=_+12|0;Z=c[W>>2]|0;if((Z|0)==(c[_+16>>2]|0)){oc[c[(c[_>>2]|0)+40>>2]&127](_)|0}else{c[W>>2]=Z+4}W=Y;Y=a[w>>0]|0;V=V+4|0}if(L){X=a[w>>0]|0;if((X&1)==0){W=J;X=(X&255)>>>1}else{W=c[h>>2]|0;X=c[J>>2]|0}if((V|0)!=(W+(X<<2)|0)){B=255;break a}}break};case 0:{B=98;break};case 3:{V=a[x>>0]|0;X=(V&1)==0;if(X){Z=(V&255)>>>1}else{Z=c[H>>2]|0}W=a[r>>0]|0;Y=(W&1)==0;if(Y){_=(W&255)>>>1}else{_=c[I>>2]|0}if((Z|0)!=(0-_|0)){if(X){Z=(V&255)>>>1}else{Z=c[H>>2]|0}if((Z|0)!=0){if(Y){Y=(W&255)>>>1}else{Y=c[I>>2]|0}if((Y|0)!=0){X=c[b>>2]|0;Y=c[X+12>>2]|0;Z=c[X+16>>2]|0;if((Y|0)==(Z|0)){W=oc[c[(c[X>>2]|0)+36>>2]&127](X)|0;Z=c[b>>2]|0;V=a[x>>0]|0;X=Z;Y=c[Z+12>>2]|0;Z=c[Z+16>>2]|0}else{W=c[Y>>2]|0}_=X+12|0;Z=(Y|0)==(Z|0);if((W|0)==(c[((V&1)==0?H:c[C>>2]|0)>>2]|0)){if(Z){oc[c[(c[X>>2]|0)+40>>2]&127](X)|0}else{c[_>>2]=Y+4}V=a[x>>0]|0;if((V&1)==0){V=(V&255)>>>1}else{V=c[H>>2]|0}P=V>>>0>1?x:P;break b}if(Z){V=oc[c[(c[X>>2]|0)+36>>2]&127](X)|0}else{V=c[Y>>2]|0}if((V|0)!=(c[((a[r>>0]&1)==0?I:c[D>>2]|0)>>2]|0)){B=198;break a}V=c[b>>2]|0;W=V+12|0;X=c[W>>2]|0;if((X|0)==(c[V+16>>2]|0)){oc[c[(c[V>>2]|0)+40>>2]&127](V)|0}else{c[W>>2]=X+4}a[k>>0]=1;V=a[r>>0]|0;if((V&1)==0){V=(V&255)>>>1}else{V=c[I>>2]|0}P=V>>>0>1?r:P;break b}}if(X){X=(V&255)>>>1}else{X=c[H>>2]|0}Y=c[b>>2]|0;Z=c[Y+12>>2]|0;_=(Z|0)==(c[Y+16>>2]|0);if((X|0)==0){if(_){V=oc[c[(c[Y>>2]|0)+36>>2]&127](Y)|0;W=a[r>>0]|0}else{V=c[Z>>2]|0}if((V|0)!=(c[((W&1)==0?I:c[D>>2]|0)>>2]|0)){break b}X=c[b>>2]|0;W=X+12|0;V=c[W>>2]|0;if((V|0)==(c[X+16>>2]|0)){oc[c[(c[X>>2]|0)+40>>2]&127](X)|0}else{c[W>>2]=V+4}a[k>>0]=1;V=a[r>>0]|0;if((V&1)==0){V=(V&255)>>>1}else{V=c[I>>2]|0}P=V>>>0>1?r:P;break b}if(_){W=oc[c[(c[Y>>2]|0)+36>>2]&127](Y)|0;V=a[x>>0]|0}else{W=c[Z>>2]|0}if((W|0)!=(c[((V&1)==0?H:c[C>>2]|0)>>2]|0)){a[k>>0]=1;break b}X=c[b>>2]|0;W=X+12|0;V=c[W>>2]|0;if((V|0)==(c[X+16>>2]|0)){oc[c[(c[X>>2]|0)+40>>2]&127](X)|0}else{c[W>>2]=V+4}V=a[x>>0]|0;if((V&1)==0){V=(V&255)>>>1}else{V=c[H>>2]|0}P=V>>>0>1?x:P}break};case 4:{V=0;while(1){X=c[b>>2]|0;do{if((X|0)!=0){W=c[X+12>>2]|0;if((W|0)==(c[X+16>>2]|0)){W=oc[c[(c[X>>2]|0)+36>>2]&127](X)|0}else{W=c[W>>2]|0}if((W|0)==-1){c[b>>2]=0;W=1;break}else{W=(c[b>>2]|0)==0;break}}else{W=1}}while(0);if((e|0)!=0){X=c[e+12>>2]|0;if((X|0)==(c[e+16>>2]|0)){X=oc[c[(c[e>>2]|0)+36>>2]&127](e)|0}else{X=c[X>>2]|0}if(!((X|0)==-1)){if(!W){break}}else{B=268}}else{B=268}if((B|0)==268){B=0;if(W){e=0;break}else{e=0}}X=c[b>>2]|0;W=c[X+12>>2]|0;if((W|0)==(c[X+16>>2]|0)){W=oc[c[(c[X>>2]|0)+36>>2]&127](X)|0}else{W=c[W>>2]|0}if(hc[c[(c[l>>2]|0)+12>>2]&63](l,2048,W)|0){X=c[n>>2]|0;if((X|0)==(o|0)){Y=(c[K>>2]|0)!=213;Z=c[m>>2]|0;o=o-Z|0;X=o>>>0<2147483647?o<<1:-1;o=o>>2;if(!Y){Z=0}Z=wn(Z,X)|0;if((Z|0)==0){B=279;break a}if(!Y){Y=c[m>>2]|0;c[m>>2]=Z;if((Y|0)!=0){lc[c[K>>2]&255](Y);Z=c[m>>2]|0}}else{c[m>>2]=Z}c[K>>2]=214;aa=Z+(o<<2)|0;c[n>>2]=aa;o=(c[m>>2]|0)+(X>>>2<<2)|0;X=aa}c[n>>2]=X+4;c[X>>2]=W;V=V+1|0}else{X=a[t>>0]|0;if((X&1)==0){X=(X&255)>>>1}else{X=c[O>>2]|0}if(!((((X|0)==0|(V|0)==0)^1)&(W|0)==(G|0))){break}if((U|0)==(S|0)){U=U-T|0;S=U>>>0<2147483647?U<<1:-1;if((R|0)==213){T=0}R=wn(T,S)|0;if((R|0)==0){B=296;break a}T=R;S=R+(S>>>2<<2)|0;U=R+(U>>2<<2)|0;R=214}c[U>>2]=V;U=U+4|0;V=0}W=c[b>>2]|0;X=W+12|0;Y=c[X>>2]|0;if((Y|0)==(c[W+16>>2]|0)){oc[c[(c[W>>2]|0)+40>>2]&127](W)|0;continue}else{c[X>>2]=Y+4;continue}}if(!((T|0)==(U|0)|(V|0)==0)){if((U|0)==(S|0)){U=U-T|0;S=U>>>0<2147483647?U<<1:-1;if((R|0)==213){T=0}R=wn(T,S)|0;if((R|0)==0){B=308;break a}T=R;S=R+(S>>>2<<2)|0;U=R+(U>>2<<2)|0;R=214}c[U>>2]=V;U=U+4|0}if((f|0)>0){W=c[b>>2]|0;do{if((W|0)!=0){V=c[W+12>>2]|0;if((V|0)==(c[W+16>>2]|0)){V=oc[c[(c[W>>2]|0)+36>>2]&127](W)|0}else{V=c[V>>2]|0}if((V|0)==-1){c[b>>2]=0;V=1;break}else{V=(c[b>>2]|0)==0;break}}else{V=1}}while(0);if((e|0)!=0){W=c[e+12>>2]|0;if((W|0)==(c[e+16>>2]|0)){W=oc[c[(c[e>>2]|0)+36>>2]&127](e)|0}else{W=c[W>>2]|0}if(!((W|0)==-1)){if(!V){B=331;break a}}else{B=325}}else{B=325}if((B|0)==325){B=0;if(V){B=331;break a}else{e=0}}W=c[b>>2]|0;V=c[W+12>>2]|0;if((V|0)==(c[W+16>>2]|0)){V=oc[c[(c[W>>2]|0)+36>>2]&127](W)|0}else{V=c[V>>2]|0}if((V|0)!=(g|0)){B=331;break a}V=c[b>>2]|0;W=V+12|0;X=c[W>>2]|0;if((X|0)==(c[V+16>>2]|0)){oc[c[(c[V>>2]|0)+40>>2]&127](V)|0;X=e;W=e}else{c[W>>2]=X+4;X=e;W=e}while(1){Y=c[b>>2]|0;do{if((Y|0)!=0){V=c[Y+12>>2]|0;if((V|0)==(c[Y+16>>2]|0)){V=oc[c[(c[Y>>2]|0)+36>>2]&127](Y)|0}else{V=c[V>>2]|0}if((V|0)==-1){c[b>>2]=0;Y=1;break}else{Y=(c[b>>2]|0)==0;break}}else{Y=1}}while(0);if((W|0)!=0){V=c[W+12>>2]|0;if((V|0)==(c[W+16>>2]|0)){V=oc[c[(c[W>>2]|0)+36>>2]&127](W)|0}else{V=c[V>>2]|0}if(!((V|0)==-1)){if(Y^(X|0)==0){V=X;W=X}else{B=354;break a}}else{V=0;e=0;B=347}}else{V=X;B=347}if((B|0)==347){B=0;if(Y){B=354;break a}else{W=0}}Y=c[b>>2]|0;X=c[Y+12>>2]|0;if((X|0)==(c[Y+16>>2]|0)){X=oc[c[(c[Y>>2]|0)+36>>2]&127](Y)|0}else{X=c[X>>2]|0}if(!(hc[c[(c[l>>2]|0)+12>>2]&63](l,2048,X)|0)){B=354;break a}X=c[n>>2]|0;if((X|0)==(o|0)){Y=(c[K>>2]|0)!=213;Z=c[m>>2]|0;X=o-Z|0;o=X>>>0<2147483647?X<<1:-1;X=X>>2;if(!Y){Z=0}Z=wn(Z,o)|0;if((Z|0)==0){B=359;break a}do{if(Y){c[m>>2]=Z}else{Y=c[m>>2]|0;c[m>>2]=Z;if((Y|0)==0){break}lc[c[K>>2]&255](Y);Z=c[m>>2]|0}}while(0);c[K>>2]=214;X=Z+(X<<2)|0;c[n>>2]=X;o=(c[m>>2]|0)+(o>>>2<<2)|0}Y=c[b>>2]|0;Z=c[Y+12>>2]|0;if((Z|0)==(c[Y+16>>2]|0)){Y=oc[c[(c[Y>>2]|0)+36>>2]&127](Y)|0;X=c[n>>2]|0}else{Y=c[Z>>2]|0}c[n>>2]=X+4;c[X>>2]=Y;f=f+ -1|0;X=c[b>>2]|0;Y=X+12|0;Z=c[Y>>2]|0;if((Z|0)==(c[X+16>>2]|0)){oc[c[(c[X>>2]|0)+40>>2]&127](X)|0}else{c[Y>>2]=Z+4}if((f|0)>0){X=V}else{break}}}if((c[n>>2]|0)==(c[m>>2]|0)){B=376;break a}break};default:{}}}while(0);d:do{if((B|0)==98){B=0;if((Q|0)==3){B=378;break a}else{X=e;V=e}while(1){W=c[b>>2]|0;do{if((W|0)!=0){Y=c[W+12>>2]|0;if((Y|0)==(c[W+16>>2]|0)){W=oc[c[(c[W>>2]|0)+36>>2]&127](W)|0}else{W=c[Y>>2]|0}if((W|0)==-1){c[b>>2]=0;Y=1;break}else{Y=(c[b>>2]|0)==0;break}}else{Y=1}}while(0);if((V|0)!=0){W=c[V+12>>2]|0;if((W|0)==(c[V+16>>2]|0)){V=oc[c[(c[V>>2]|0)+36>>2]&127](V)|0}else{V=c[W>>2]|0}if(!((V|0)==-1)){if(Y^(X|0)==0){W=X;V=X}else{break d}}else{W=0;e=0;B=111}}else{W=X;B=111}if((B|0)==111){B=0;if(Y){break d}else{V=0}}Y=c[b>>2]|0;X=c[Y+12>>2]|0;if((X|0)==(c[Y+16>>2]|0)){X=oc[c[(c[Y>>2]|0)+36>>2]&127](Y)|0}else{X=c[X>>2]|0}if(!(hc[c[(c[l>>2]|0)+12>>2]&63](l,8192,X)|0)){break d}B=c[b>>2]|0;X=B+12|0;Y=c[X>>2]|0;if((Y|0)==(c[B+16>>2]|0)){X=oc[c[(c[B>>2]|0)+40>>2]&127](B)|0}else{c[X>>2]=Y+4;X=c[Y>>2]|0}Y=a[s>>0]|0;Z=(Y&1)!=0;if(Z){B=(c[s>>2]&-2)+ -1|0;Y=c[M>>2]|0}else{B=1;Y=(Y&255)>>>1}if((Y|0)==(B|0)){pg(s,B,1,B,B,0,0);if((a[s>>0]&1)==0){B=128}else{B=129}}else{if(Z){B=129}else{B=128}}if((B|0)==128){B=0;a[s>>0]=(Y<<1)+2;Z=M;_=Y+1|0}else if((B|0)==129){B=0;Z=c[E>>2]|0;_=Y+1|0;c[M>>2]=_}c[Z+(Y<<2)>>2]=X;c[Z+(_<<2)>>2]=0;X=W}}}while(0);Q=Q+1|0;if(!(Q>>>0<4)){B=378;break}}e:switch(B|0){case 97:{c[j>>2]=c[j>>2]|4;b=0;break};case 198:{c[j>>2]=c[j>>2]|4;b=0;break};case 255:{c[j>>2]=c[j>>2]|4;b=0;break};case 279:{aa=Xa(4)|0;c[aa>>2]=22680;wb(aa|0,22728,206)};case 296:{aa=Xa(4)|0;c[aa>>2]=22680;wb(aa|0,22728,206)};case 308:{aa=Xa(4)|0;c[aa>>2]=22680;wb(aa|0,22728,206)};case 331:{c[j>>2]=c[j>>2]|4;b=0;break};case 354:{c[j>>2]=c[j>>2]|4;b=0;break};case 359:{aa=Xa(4)|0;c[aa>>2]=22680;wb(aa|0,22728,206)};case 376:{c[j>>2]=c[j>>2]|4;b=0;break};case 378:{f:do{if((P|0)!=0){l=P+4|0;F=P+8|0;k=1;while(1){m=a[P>>0]|0;if((m&1)==0){m=(m&255)>>>1}else{m=c[l>>2]|0}if(!(k>>>0<m>>>0)){break f}n=c[b>>2]|0;do{if((n|0)!=0){m=c[n+12>>2]|0;if((m|0)==(c[n+16>>2]|0)){m=oc[c[(c[n>>2]|0)+36>>2]&127](n)|0}else{m=c[m>>2]|0}if((m|0)==-1){c[b>>2]=0;m=1;break}else{m=(c[b>>2]|0)==0;break}}else{m=1}}while(0);if((e|0)!=0){n=c[e+12>>2]|0;if((n|0)==(c[e+16>>2]|0)){n=oc[c[(c[e>>2]|0)+36>>2]&127](e)|0}else{n=c[n>>2]|0}if(!((n|0)==-1)){if(!m){break}}else{B=396}}else{B=396}if((B|0)==396){B=0;if(m){break}else{e=0}}m=c[b>>2]|0;n=c[m+12>>2]|0;if((n|0)==(c[m+16>>2]|0)){m=oc[c[(c[m>>2]|0)+36>>2]&127](m)|0}else{m=c[n>>2]|0}if((a[P>>0]&1)==0){n=l}else{n=c[F>>2]|0}if((m|0)!=(c[n+(k<<2)>>2]|0)){break}k=k+1|0;g=c[b>>2]|0;n=g+12|0;m=c[n>>2]|0;if((m|0)==(c[g+16>>2]|0)){oc[c[(c[g>>2]|0)+40>>2]&127](g)|0;continue}else{c[n>>2]=m+4;continue}}c[j>>2]=c[j>>2]|4;b=0;break e}}while(0);if((T|0)!=(U|0)){c[A>>2]=0;qk(t,T,U,A);if((c[A>>2]|0)==0){b=1}else{c[j>>2]=c[j>>2]|4;b=0}}else{b=1;T=U}break}}if(!((a[s>>0]&1)==0)?(z=c[E>>2]|0,(z|0)!=0):0){vn(z)}if(!((a[r>>0]&1)==0)?(y=c[D>>2]|0,(y|0)!=0):0){vn(y)}if(!((a[x>>0]&1)==0)?(u=c[C>>2]|0,(u|0)!=0):0){vn(u)}if(!((a[w>>0]&1)==0)?(q=c[h>>2]|0,(q|0)!=0):0){vn(q)}if(!((a[t>>0]&1)==0)?(p=c[t+8>>2]|0,(p|0)!=0):0){vn(p)}if((T|0)==0){i=v;return b|0}lc[R&255](T);i=v;return b|0}function vk(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;m=i;i=i+432|0;p=m;s=m+24|0;d=m+16|0;q=m+12|0;t=m+424|0;c[d>>2]=s;l=d+4|0;c[l>>2]=213;s=s+400|0;n=c[h+28>>2]|0;v=n+4|0;c[v>>2]=(c[v>>2]|0)+1;if(!((c[3362]|0)==-1)){c[p>>2]=13448;c[p+4>>2]=208;c[p+8>>2]=0;cg(13448,p)}p=(c[13452>>2]|0)+ -1|0;u=c[n+8>>2]|0;if((c[n+12>>2]|0)-u>>2>>>0>p>>>0?(r=c[u+(p<<2)>>2]|0,(r|0)!=0):0){a[t>>0]=0;p=c[f>>2]|0;do{if(uk(e,p,g,n,c[h+4>>2]|0,j,t,r,d,q,s)|0){if((a[k>>0]&1)==0){c[k+4>>2]=0;a[k>>0]=0}else{c[c[k+8>>2]>>2]=0;c[k+4>>2]=0}if((a[t>>0]|0)!=0){g=xc[c[(c[r>>2]|0)+44>>2]&63](r,45)|0;h=a[k>>0]|0;o=(h&1)!=0;if(o){s=(c[k>>2]&-2)+ -1|0;h=c[k+4>>2]|0}else{s=1;h=(h&255)>>>1}if((h|0)==(s|0)){pg(k,s,1,s,s,0,0);if((a[k>>0]&1)==0){o=21}else{o=22}}else{if(o){o=22}else{o=21}}if((o|0)==21){a[k>>0]=(h<<1)+2;t=k+4|0;s=h+1|0}else if((o|0)==22){t=c[k+8>>2]|0;s=h+1|0;c[k+4>>2]=s}c[t+(h<<2)>>2]=g;c[t+(s<<2)>>2]=0}r=xc[c[(c[r>>2]|0)+44>>2]&63](r,48)|0;s=c[d>>2]|0;q=c[q>>2]|0;h=q+ -4|0;a:do{if(s>>>0<h>>>0){while(1){g=s+4|0;if((c[s>>2]|0)!=(r|0)){break a}if(g>>>0<h>>>0){s=g}else{s=g;break}}}}while(0);t=s;r=a[k>>0]|0;if((r&1)==0){v=r;u=1;g=(r&255)>>>1}else{u=c[k>>2]|0;v=u&255;u=(u&-2)+ -1|0;g=c[k+4>>2]|0}r=q-t>>2;if((r|0)!=0){if((u-g|0)>>>0<r>>>0){pg(k,u,g+r-u|0,g,g,0,0);v=a[k>>0]|0}if((v&1)==0){u=k+4|0}else{u=c[k+8>>2]|0}v=u+(g<<2)|0;if((s|0)!=(q|0)){h=g+((h+(0-t)|0)>>>2)+1|0;while(1){c[v>>2]=c[s>>2];s=s+4|0;if((s|0)==(q|0)){break}v=v+4|0}v=u+(h<<2)|0}c[v>>2]=0;q=g+r|0;if((a[k>>0]&1)==0){a[k>>0]=q<<1;break}else{c[k+4>>2]=q;break}}}}while(0);k=c[e>>2]|0;if((k|0)!=0){q=c[k+12>>2]|0;if((q|0)==(c[k+16>>2]|0)){q=oc[c[(c[k>>2]|0)+36>>2]&127](k)|0}else{q=c[q>>2]|0}if((q|0)==-1){c[e>>2]=0;k=0;e=1}else{e=0}}else{k=0;e=1}do{if((p|0)!=0){q=c[p+12>>2]|0;if((q|0)==(c[p+16>>2]|0)){p=oc[c[(c[p>>2]|0)+36>>2]&127](p)|0}else{p=c[q>>2]|0}if(!((p|0)==-1)){if(e){break}else{o=60;break}}else{c[f>>2]=0;o=58;break}}else{o=58}}while(0);if((o|0)==58?e:0){o=60}if((o|0)==60){c[j>>2]=c[j>>2]|2}c[b>>2]=k;u=n+4|0;v=c[u>>2]|0;c[u>>2]=v+ -1;if((v|0)==0){lc[c[(c[n>>2]|0)+8>>2]&255](n)}j=c[d>>2]|0;c[d>>2]=0;if((j|0)==0){i=m;return}lc[c[l>>2]&255](j);i=m;return}v=Xa(4)|0;c[v>>2]=21304;wb(v|0,21376,196)}function wk(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function xk(a){a=a|0;return}function yk(b,d,e,f,g,j,l){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;l=+l;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;q=i;i=i+368|0;A=q;C=q+156|0;E=q+132|0;B=q+256|0;t=q+148|0;s=q+356|0;r=q+357|0;x=q+136|0;d=q+104|0;w=q+116|0;F=q+100|0;v=q+128|0;u=q+152|0;c[E>>2]=C;h[k>>3]=l;c[A>>2]=c[k>>2];c[A+4>>2]=c[k+4>>2];C=lb(C|0,100,13224,A|0)|0;if(C>>>0>99){if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}C=c[3340]|0;h[k>>3]=l;c[A>>2]=c[k>>2];c[A+4>>2]=c[k+4>>2];C=Ci(E,C,13224,A)|0;z=c[E>>2]|0;if((z|0)==0){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}B=un(C)|0;if((B|0)==0){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}else{y=B}}else{y=0;z=0}D=c[g+28>>2]|0;H=D+4|0;c[H>>2]=(c[H>>2]|0)+1;if(!((c[3364]|0)==-1)){c[A>>2]=13456;c[A+4>>2]=208;c[A+8>>2]=0;cg(13456,A)}G=(c[13460>>2]|0)+ -1|0;H=c[D+8>>2]|0;if((c[D+12>>2]|0)-H>>2>>>0>G>>>0?(p=c[H+(G<<2)>>2]|0,(p|0)!=0):0){H=c[E>>2]|0;uc[c[(c[p>>2]|0)+32>>2]&31](p,H,H+C|0,B)|0;if((C|0)==0){E=0}else{E=(a[c[E>>2]>>0]|0)==45}c[t>>2]=0;c[x+0>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;c[d+0>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[w+0>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0;zk(f,E,D,t,s,r,x,d,w,F);f=c[F>>2]|0;if((C|0)>(f|0)){F=a[w>>0]|0;if((F&1)==0){F=(F&255)>>>1}else{F=c[w+4>>2]|0}G=a[d>>0]|0;if((G&1)==0){G=(G&255)>>>1}else{G=c[d+4>>2]|0}F=F+(C-f<<1|1)+G|0}else{F=a[w>>0]|0;if((F&1)==0){F=(F&255)>>>1}else{F=c[w+4>>2]|0}G=a[d>>0]|0;if((G&1)==0){G=(G&255)>>>1}else{G=c[d+4>>2]|0}F=F+2+G|0}F=F+f|0;if(F>>>0>100){A=un(F)|0;if((A|0)==0){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}else{F=A}}else{F=0}Ak(A,v,u,c[g+4>>2]|0,B,B+C|0,p,E,t,a[s>>0]|0,a[r>>0]|0,x,d,w,f);Wc(b,c[e>>2]|0,A,c[v>>2]|0,c[u>>2]|0,g,j);if((F|0)!=0){vn(F)}if(!((a[w>>0]&1)==0)?(n=c[w+8>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[d>>0]&1)==0)?(o=c[d+8>>2]|0,(o|0)!=0):0){vn(o)}if(!((a[x>>0]&1)==0)?(m=c[x+8>>2]|0,(m|0)!=0):0){vn(m)}G=D+4|0;H=c[G>>2]|0;c[G>>2]=H+ -1;if((H|0)==0){lc[c[(c[D>>2]|0)+8>>2]&255](D)}if((y|0)!=0){vn(y)}if((z|0)==0){i=q;return}vn(z);i=q;return}H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}function zk(b,d,e,f,g,h,j,k,l,m){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;n=i;i=i+128|0;A=n;x=n+12|0;o=n+40|0;v=n+52|0;w=n+56|0;u=n+16|0;z=n+28|0;r=n+68|0;q=n+72|0;t=n+84|0;s=n+88|0;p=n+100|0;y=n+112|0;if(b){if(!((c[3228]|0)==-1)){c[A>>2]=12912;c[A+4>>2]=208;c[A+8>>2]=0;cg(12912,A)}q=(c[12916>>2]|0)+ -1|0;p=c[e+8>>2]|0;if(!((c[e+12>>2]|0)-p>>2>>>0>q>>>0)){b=Xa(4)|0;c[b>>2]=21304;wb(b|0,21376,196)}p=c[p+(q<<2)>>2]|0;if((p|0)==0){b=Xa(4)|0;c[b>>2]=21304;wb(b|0,21376,196)}q=c[p>>2]|0;if(d){mc[c[q+44>>2]&127](x,p);b=c[x>>2]|0;a[f>>0]=b;a[f+1>>0]=b>>8;a[f+2>>0]=b>>16;a[f+3>>0]=b>>24;mc[c[(c[p>>2]|0)+32>>2]&127](o,p);if((a[l>>0]&1)==0){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}ig(l);c[l+0>>2]=c[o+0>>2];c[l+4>>2]=c[o+4>>2];c[l+8>>2]=c[o+8>>2];c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0}else{mc[c[q+40>>2]&127](v,p);b=c[v>>2]|0;a[f>>0]=b;a[f+1>>0]=b>>8;a[f+2>>0]=b>>16;a[f+3>>0]=b>>24;mc[c[(c[p>>2]|0)+28>>2]&127](w,p);if((a[l>>0]&1)==0){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}ig(l);c[l+0>>2]=c[w+0>>2];c[l+4>>2]=c[w+4>>2];c[l+8>>2]=c[w+8>>2];c[w+0>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0}a[g>>0]=oc[c[(c[p>>2]|0)+12>>2]&127](p)|0;a[h>>0]=oc[c[(c[p>>2]|0)+16>>2]&127](p)|0;mc[c[(c[p>>2]|0)+20>>2]&127](u,p);if((a[j>>0]&1)==0){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}ig(j);c[j+0>>2]=c[u+0>>2];c[j+4>>2]=c[u+4>>2];c[j+8>>2]=c[u+8>>2];c[u+0>>2]=0;c[u+4>>2]=0;c[u+8>>2]=0;mc[c[(c[p>>2]|0)+24>>2]&127](z,p);if((a[k>>0]&1)==0){a[k+1>>0]=0;a[k>>0]=0}else{a[c[k+8>>2]>>0]=0;c[k+4>>2]=0}ig(k);c[k+0>>2]=c[z+0>>2];c[k+4>>2]=c[z+4>>2];c[k+8>>2]=c[z+8>>2];c[z+0>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;b=oc[c[(c[p>>2]|0)+36>>2]&127](p)|0;c[m>>2]=b;i=n;return}else{if(!((c[3212]|0)==-1)){c[A>>2]=12848;c[A+4>>2]=208;c[A+8>>2]=0;cg(12848,A)}u=(c[12852>>2]|0)+ -1|0;o=c[e+8>>2]|0;if(!((c[e+12>>2]|0)-o>>2>>>0>u>>>0)){b=Xa(4)|0;c[b>>2]=21304;wb(b|0,21376,196)}o=c[o+(u<<2)>>2]|0;if((o|0)==0){b=Xa(4)|0;c[b>>2]=21304;wb(b|0,21376,196)}e=c[o>>2]|0;if(d){mc[c[e+44>>2]&127](r,o);b=c[r>>2]|0;a[f>>0]=b;a[f+1>>0]=b>>8;a[f+2>>0]=b>>16;a[f+3>>0]=b>>24;mc[c[(c[o>>2]|0)+32>>2]&127](q,o);if((a[l>>0]&1)==0){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}ig(l);c[l+0>>2]=c[q+0>>2];c[l+4>>2]=c[q+4>>2];c[l+8>>2]=c[q+8>>2];c[q+0>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0}else{mc[c[e+40>>2]&127](t,o);b=c[t>>2]|0;a[f>>0]=b;a[f+1>>0]=b>>8;a[f+2>>0]=b>>16;a[f+3>>0]=b>>24;mc[c[(c[o>>2]|0)+28>>2]&127](s,o);if((a[l>>0]&1)==0){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}ig(l);c[l+0>>2]=c[s+0>>2];c[l+4>>2]=c[s+4>>2];c[l+8>>2]=c[s+8>>2];c[s+0>>2]=0;c[s+4>>2]=0;c[s+8>>2]=0}a[g>>0]=oc[c[(c[o>>2]|0)+12>>2]&127](o)|0;a[h>>0]=oc[c[(c[o>>2]|0)+16>>2]&127](o)|0;mc[c[(c[o>>2]|0)+20>>2]&127](p,o);if((a[j>>0]&1)==0){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}ig(j);c[j+0>>2]=c[p+0>>2];c[j+4>>2]=c[p+4>>2];c[j+8>>2]=c[p+8>>2];c[p+0>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;mc[c[(c[o>>2]|0)+24>>2]&127](y,o);if((a[k>>0]&1)==0){a[k+1>>0]=0;a[k>>0]=0}else{a[c[k+8>>2]>>0]=0;c[k+4>>2]=0}ig(k);c[k+0>>2]=c[y+0>>2];c[k+4>>2]=c[y+4>>2];c[k+8>>2]=c[y+8>>2];c[y+0>>2]=0;c[y+4>>2]=0;c[y+8>>2]=0;b=oc[c[(c[o>>2]|0)+36>>2]&127](o)|0;c[m>>2]=b;i=n;return}}function Ak(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;t=i;c[f>>2]=d;v=r+1|0;w=r+8|0;u=r+4|0;x=(g&512|0)==0;D=q+1|0;H=q+8|0;I=q+4|0;A=(s|0)>0;B=p+1|0;E=p+8|0;y=p+4|0;C=k+8|0;z=0-s|0;J=0;do{switch(a[m+J>>0]|0){case 0:{c[e>>2]=c[f>>2];break};case 4:{K=c[f>>2]|0;h=l?h+1|0:h;a:do{if(h>>>0<j>>>0){L=h;while(1){N=a[L>>0]|0;if(!(N<<24>>24>-1)){break a}M=L+1|0;if((b[(c[C>>2]|0)+(N<<24>>24<<1)>>1]&2048)==0){break a}if(M>>>0<j>>>0){L=M}else{L=M;break}}}else{L=h}}while(0);M=L;if(A){if(L>>>0>h>>>0){N=h+(0-M)|0;N=N>>>0<z>>>0?z:N;M=N+s|0;Q=K;P=L;O=s;while(1){P=P+ -1|0;R=a[P>>0]|0;c[f>>2]=Q+1;a[Q>>0]=R;O=O+ -1|0;Q=(O|0)>0;if(!(P>>>0>h>>>0&Q)){break}Q=c[f>>2]|0}L=L+N|0;if(Q){G=32}else{N=0}}else{M=s;G=32}if((G|0)==32){G=0;N=xc[c[(c[k>>2]|0)+28>>2]&63](k,48)|0}O=c[f>>2]|0;c[f>>2]=O+1;if((M|0)>0){do{a[O>>0]=N;M=M+ -1|0;O=c[f>>2]|0;c[f>>2]=O+1}while((M|0)>0)}a[O>>0]=n}if((L|0)==(h|0)){Q=xc[c[(c[k>>2]|0)+28>>2]&63](k,48)|0;R=c[f>>2]|0;c[f>>2]=R+1;a[R>>0]=Q}else{N=a[p>>0]|0;M=(N&1)==0;if(M){N=(N&255)>>>1}else{N=c[y>>2]|0}if((N|0)==0){M=-1;N=0;O=0}else{if(M){M=B}else{M=c[E>>2]|0}M=a[M>>0]|0;N=0;O=0}while(1){if((O|0)==(M|0)){P=c[f>>2]|0;c[f>>2]=P+1;a[P>>0]=o;N=N+1|0;P=a[p>>0]|0;O=(P&1)==0;if(O){P=(P&255)>>>1}else{P=c[y>>2]|0}if(N>>>0<P>>>0){if(O){M=B}else{M=c[E>>2]|0}if((a[M+N>>0]|0)==127){M=-1;O=0}else{if(O){M=B}else{M=c[E>>2]|0}M=a[M+N>>0]|0;O=0}}else{O=0}}L=L+ -1|0;Q=a[L>>0]|0;R=c[f>>2]|0;c[f>>2]=R+1;a[R>>0]=Q;if((L|0)==(h|0)){break}else{O=O+1|0}}}L=c[f>>2]|0;if((K|0)!=(L|0)?(F=L+ -1|0,F>>>0>K>>>0):0){L=F;do{R=a[K>>0]|0;a[K>>0]=a[L>>0]|0;a[L>>0]=R;K=K+1|0;L=L+ -1|0}while(K>>>0<L>>>0)}break};case 2:{L=a[q>>0]|0;M=(L&1)==0;if(M){K=(L&255)>>>1}else{K=c[I>>2]|0}if(!((K|0)==0|x)){if(M){K=D;L=(L&255)>>>1}else{K=c[H>>2]|0;L=c[I>>2]|0}L=K+L|0;M=c[f>>2]|0;if((K|0)!=(L|0)){do{a[M>>0]=a[K>>0]|0;K=K+1|0;M=M+1|0}while((K|0)!=(L|0))}c[f>>2]=M}break};case 3:{L=a[r>>0]|0;K=(L&1)==0;if(K){L=(L&255)>>>1}else{L=c[u>>2]|0}if((L|0)!=0){if(K){K=v}else{K=c[w>>2]|0}Q=a[K>>0]|0;R=c[f>>2]|0;c[f>>2]=R+1;a[R>>0]=Q}break};case 1:{c[e>>2]=c[f>>2];Q=xc[c[(c[k>>2]|0)+28>>2]&63](k,32)|0;R=c[f>>2]|0;c[f>>2]=R+1;a[R>>0]=Q;break};default:{}}J=J+1|0}while((J|0)!=4);k=a[r>>0]|0;x=(k&1)==0;if(x){r=(k&255)>>>1}else{r=c[u>>2]|0}if(r>>>0>1){if(x){u=(k&255)>>>1}else{v=c[w>>2]|0;u=c[u>>2]|0}w=v+1|0;u=v+u|0;v=c[f>>2]|0;if((w|0)!=(u|0)){do{a[v>>0]=a[w>>0]|0;w=w+1|0;v=v+1|0}while((w|0)!=(u|0))}c[f>>2]=v}g=g&176;if((g|0)==16){i=t;return}else if((g|0)==32){c[e>>2]=c[f>>2];i=t;return}else{c[e>>2]=d;i=t;return}}function Bk(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;p=i;i=i+160|0;x=p;t=p+140|0;s=p+152|0;r=p+153|0;q=p+112|0;v=p+100|0;d=p+128|0;z=p+124|0;w=p+144|0;u=p+148|0;o=c[g+28>>2]|0;D=o+4|0;c[D>>2]=(c[D>>2]|0)+1;if(!((c[3364]|0)==-1)){c[x>>2]=13456;c[x+4>>2]=208;c[x+8>>2]=0;cg(13456,x)}y=(c[13460>>2]|0)+ -1|0;A=c[o+8>>2]|0;if((c[o+12>>2]|0)-A>>2>>>0>y>>>0?(l=c[A+(y<<2)>>2]|0,(l|0)!=0):0){A=a[j>>0]|0;y=(A&1)==0;if(y){A=(A&255)>>>1}else{A=c[j+4>>2]|0}if((A|0)==0){y=0}else{if(y){y=j+1|0}else{y=c[j+8>>2]|0}y=a[y>>0]|0;y=y<<24>>24==(xc[c[(c[l>>2]|0)+28>>2]&63](l,45)|0)<<24>>24}c[t>>2]=0;c[q+0>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;c[v+0>>2]=0;c[v+4>>2]=0;c[v+8>>2]=0;c[d+0>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;zk(f,y,o,t,s,r,q,v,d,z);f=a[j>>0]|0;A=(f&1)==0;if(A){B=(f&255)>>>1}else{B=c[j+4>>2]|0}z=c[z>>2]|0;if((B|0)>(z|0)){if(A){B=(f&255)>>>1}else{B=c[j+4>>2]|0}C=a[d>>0]|0;if((C&1)==0){C=(C&255)>>>1}else{C=c[d+4>>2]|0}D=a[v>>0]|0;if((D&1)==0){D=(D&255)>>>1}else{D=c[v+4>>2]|0}B=C+(B-z<<1|1)+D|0}else{B=a[d>>0]|0;if((B&1)==0){B=(B&255)>>>1}else{B=c[d+4>>2]|0}C=a[v>>0]|0;if((C&1)==0){C=(C&255)>>>1}else{C=c[v+4>>2]|0}B=B+2+C|0}B=B+z|0;if(B>>>0>100){x=un(B)|0;if((x|0)==0){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}else{B=x}}else{B=0}if(A){A=j+1|0;j=(f&255)>>>1}else{A=c[j+8>>2]|0;j=c[j+4>>2]|0}Ak(x,w,u,c[g+4>>2]|0,A,A+j|0,l,y,t,a[s>>0]|0,a[r>>0]|0,q,v,d,z);Wc(b,c[e>>2]|0,x,c[w>>2]|0,c[u>>2]|0,g,h);if((B|0)!=0){vn(B)}if(!((a[d>>0]&1)==0)?(m=c[d+8>>2]|0,(m|0)!=0):0){vn(m)}if(!((a[v>>0]&1)==0)?(n=c[v+8>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[q>>0]&1)==0)?(k=c[q+8>>2]|0,(k|0)!=0):0){vn(k)}C=o+4|0;D=c[C>>2]|0;c[C>>2]=D+ -1;if((D|0)!=0){i=p;return}lc[c[(c[o>>2]|0)+8>>2]&255](o);i=p;return}D=Xa(4)|0;c[D>>2]=21304;wb(D|0,21376,196)}function Ck(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Dk(a){a=a|0;return}function Ek(b,d,e,f,g,j,l){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;l=+l;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;q=i;i=i+976|0;A=q;C=q+868|0;E=q+816|0;B=q+416|0;t=q+408|0;s=q+860|0;r=q+400|0;x=q+824|0;d=q+836|0;w=q+848|0;F=q+820|0;v=q+404|0;u=q+864|0;c[E>>2]=C;h[k>>3]=l;c[A>>2]=c[k>>2];c[A+4>>2]=c[k+4>>2];C=lb(C|0,100,13224,A|0)|0;if(C>>>0>99){if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}C=c[3340]|0;h[k>>3]=l;c[A>>2]=c[k>>2];c[A+4>>2]=c[k+4>>2];C=Ci(E,C,13224,A)|0;z=c[E>>2]|0;if((z|0)==0){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}B=un(C<<2)|0;if((B|0)==0){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}else{y=B}}else{y=0;z=0}D=c[g+28>>2]|0;H=D+4|0;c[H>>2]=(c[H>>2]|0)+1;if(!((c[3362]|0)==-1)){c[A>>2]=13448;c[A+4>>2]=208;c[A+8>>2]=0;cg(13448,A)}G=(c[13452>>2]|0)+ -1|0;H=c[D+8>>2]|0;if((c[D+12>>2]|0)-H>>2>>>0>G>>>0?(p=c[H+(G<<2)>>2]|0,(p|0)!=0):0){H=c[E>>2]|0;uc[c[(c[p>>2]|0)+48>>2]&31](p,H,H+C|0,B)|0;if((C|0)==0){E=0}else{E=(a[c[E>>2]>>0]|0)==45}c[t>>2]=0;c[x+0>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;c[d+0>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[w+0>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0;Fk(f,E,D,t,s,r,x,d,w,F);f=c[F>>2]|0;if((C|0)>(f|0)){F=a[w>>0]|0;if((F&1)==0){F=(F&255)>>>1}else{F=c[w+4>>2]|0}G=a[d>>0]|0;if((G&1)==0){G=(G&255)>>>1}else{G=c[d+4>>2]|0}F=F+(C-f<<1|1)+G|0}else{F=a[w>>0]|0;if((F&1)==0){F=(F&255)>>>1}else{F=c[w+4>>2]|0}G=a[d>>0]|0;if((G&1)==0){G=(G&255)>>>1}else{G=c[d+4>>2]|0}F=F+2+G|0}F=F+f|0;if(F>>>0>100){A=un(F<<2)|0;if((A|0)==0){H=Xa(4)|0;c[H>>2]=22680;wb(H|0,22728,206)}else{F=A}}else{F=0}Gk(A,v,u,c[g+4>>2]|0,B,B+(C<<2)|0,p,E,t,c[s>>2]|0,c[r>>2]|0,x,d,w,f);Li(b,c[e>>2]|0,A,c[v>>2]|0,c[u>>2]|0,g,j);if((F|0)!=0){vn(F)}if(!((a[w>>0]&1)==0)?(n=c[w+8>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[d>>0]&1)==0)?(o=c[d+8>>2]|0,(o|0)!=0):0){vn(o)}if(!((a[x>>0]&1)==0)?(m=c[x+8>>2]|0,(m|0)!=0):0){vn(m)}G=D+4|0;H=c[G>>2]|0;c[G>>2]=H+ -1;if((H|0)==0){lc[c[(c[D>>2]|0)+8>>2]&255](D)}if((y|0)!=0){vn(y)}if((z|0)==0){i=q;return}vn(z);i=q;return}H=Xa(4)|0;c[H>>2]=21304;wb(H|0,21376,196)}function Fk(b,d,e,f,g,h,j,k,l,m){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;n=i;i=i+128|0;A=n;x=n+12|0;o=n+40|0;v=n+52|0;w=n+56|0;u=n+16|0;z=n+28|0;r=n+68|0;q=n+72|0;t=n+84|0;s=n+88|0;p=n+100|0;y=n+112|0;if(b){if(!((c[3260]|0)==-1)){c[A>>2]=13040;c[A+4>>2]=208;c[A+8>>2]=0;cg(13040,A)}q=(c[13044>>2]|0)+ -1|0;p=c[e+8>>2]|0;if(!((c[e+12>>2]|0)-p>>2>>>0>q>>>0)){b=Xa(4)|0;c[b>>2]=21304;wb(b|0,21376,196)}p=c[p+(q<<2)>>2]|0;if((p|0)==0){b=Xa(4)|0;c[b>>2]=21304;wb(b|0,21376,196)}q=c[p>>2]|0;if(d){mc[c[q+44>>2]&127](x,p);b=c[x>>2]|0;a[f>>0]=b;a[f+1>>0]=b>>8;a[f+2>>0]=b>>16;a[f+3>>0]=b>>24;mc[c[(c[p>>2]|0)+32>>2]&127](o,p);if((a[l>>0]&1)==0){c[l+4>>2]=0;a[l>>0]=0}else{c[c[l+8>>2]>>2]=0;c[l+4>>2]=0}og(l);c[l+0>>2]=c[o+0>>2];c[l+4>>2]=c[o+4>>2];c[l+8>>2]=c[o+8>>2];c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0}else{mc[c[q+40>>2]&127](v,p);b=c[v>>2]|0;a[f>>0]=b;a[f+1>>0]=b>>8;a[f+2>>0]=b>>16;a[f+3>>0]=b>>24;mc[c[(c[p>>2]|0)+28>>2]&127](w,p);if((a[l>>0]&1)==0){c[l+4>>2]=0;a[l>>0]=0}else{c[c[l+8>>2]>>2]=0;c[l+4>>2]=0}og(l);c[l+0>>2]=c[w+0>>2];c[l+4>>2]=c[w+4>>2];c[l+8>>2]=c[w+8>>2];c[w+0>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0}c[g>>2]=oc[c[(c[p>>2]|0)+12>>2]&127](p)|0;c[h>>2]=oc[c[(c[p>>2]|0)+16>>2]&127](p)|0;mc[c[(c[p>>2]|0)+20>>2]&127](u,p);if((a[j>>0]&1)==0){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}ig(j);c[j+0>>2]=c[u+0>>2];c[j+4>>2]=c[u+4>>2];c[j+8>>2]=c[u+8>>2];c[u+0>>2]=0;c[u+4>>2]=0;c[u+8>>2]=0;mc[c[(c[p>>2]|0)+24>>2]&127](z,p);if((a[k>>0]&1)==0){c[k+4>>2]=0;a[k>>0]=0}else{c[c[k+8>>2]>>2]=0;c[k+4>>2]=0}og(k);c[k+0>>2]=c[z+0>>2];c[k+4>>2]=c[z+4>>2];c[k+8>>2]=c[z+8>>2];c[z+0>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;b=oc[c[(c[p>>2]|0)+36>>2]&127](p)|0;c[m>>2]=b;i=n;return}else{if(!((c[3244]|0)==-1)){c[A>>2]=12976;c[A+4>>2]=208;c[A+8>>2]=0;cg(12976,A)}u=(c[12980>>2]|0)+ -1|0;o=c[e+8>>2]|0;if(!((c[e+12>>2]|0)-o>>2>>>0>u>>>0)){b=Xa(4)|0;c[b>>2]=21304;wb(b|0,21376,196)}o=c[o+(u<<2)>>2]|0;if((o|0)==0){b=Xa(4)|0;c[b>>2]=21304;wb(b|0,21376,196)}e=c[o>>2]|0;if(d){mc[c[e+44>>2]&127](r,o);b=c[r>>2]|0;a[f>>0]=b;a[f+1>>0]=b>>8;a[f+2>>0]=b>>16;a[f+3>>0]=b>>24;mc[c[(c[o>>2]|0)+32>>2]&127](q,o);if((a[l>>0]&1)==0){c[l+4>>2]=0;a[l>>0]=0}else{c[c[l+8>>2]>>2]=0;c[l+4>>2]=0}og(l);c[l+0>>2]=c[q+0>>2];c[l+4>>2]=c[q+4>>2];c[l+8>>2]=c[q+8>>2];c[q+0>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0}else{mc[c[e+40>>2]&127](t,o);b=c[t>>2]|0;a[f>>0]=b;a[f+1>>0]=b>>8;a[f+2>>0]=b>>16;a[f+3>>0]=b>>24;mc[c[(c[o>>2]|0)+28>>2]&127](s,o);if((a[l>>0]&1)==0){c[l+4>>2]=0;a[l>>0]=0}else{c[c[l+8>>2]>>2]=0;c[l+4>>2]=0}og(l);c[l+0>>2]=c[s+0>>2];c[l+4>>2]=c[s+4>>2];c[l+8>>2]=c[s+8>>2];c[s+0>>2]=0;c[s+4>>2]=0;c[s+8>>2]=0}c[g>>2]=oc[c[(c[o>>2]|0)+12>>2]&127](o)|0;c[h>>2]=oc[c[(c[o>>2]|0)+16>>2]&127](o)|0;mc[c[(c[o>>2]|0)+20>>2]&127](p,o);if((a[j>>0]&1)==0){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}ig(j);c[j+0>>2]=c[p+0>>2];c[j+4>>2]=c[p+4>>2];c[j+8>>2]=c[p+8>>2];c[p+0>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;mc[c[(c[o>>2]|0)+24>>2]&127](y,o);if((a[k>>0]&1)==0){c[k+4>>2]=0;a[k>>0]=0}else{c[c[k+8>>2]>>2]=0;c[k+4>>2]=0}og(k);c[k+0>>2]=c[y+0>>2];c[k+4>>2]=c[y+4>>2];c[k+8>>2]=c[y+8>>2];c[y+0>>2]=0;c[y+4>>2]=0;c[y+8>>2]=0;b=oc[c[(c[o>>2]|0)+36>>2]&127](o)|0;c[m>>2]=b;i=n;return}}function Gk(b,d,e,f,g,h,j,k,l,m,n,o,p,q,r){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;var s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;s=i;c[e>>2]=b;t=q+4|0;u=q+8|0;y=(f&512|0)==0;x=p+4|0;A=p+8|0;w=(r|0)>0;B=o+1|0;C=o+8|0;D=o+4|0;E=0;do{switch(a[l+E>>0]|0){case 2:{F=a[p>>0]|0;H=(F&1)==0;if(H){G=(F&255)>>>1}else{G=c[x>>2]|0}if(!((G|0)==0|y)){if(H){H=x;I=(F&255)>>>1}else{H=c[A>>2]|0;I=c[x>>2]|0}G=H+(I<<2)|0;F=c[e>>2]|0;if((H|0)!=(G|0)){J=(H+(I+ -1<<2)+(0-H)|0)>>>2;I=F;while(1){c[I>>2]=c[H>>2];H=H+4|0;if((H|0)==(G|0)){break}I=I+4|0}F=F+(J+1<<2)|0}c[e>>2]=F}break};case 3:{G=a[q>>0]|0;F=(G&1)==0;if(F){G=(G&255)>>>1}else{G=c[t>>2]|0}if((G|0)!=0){if(F){F=t}else{F=c[u>>2]|0}L=c[F>>2]|0;M=c[e>>2]|0;c[e>>2]=M+4;c[M>>2]=L}break};case 4:{F=c[e>>2]|0;g=k?g+4|0:g;a:do{if(g>>>0<h>>>0){G=g;while(1){H=G+4|0;if(!(hc[c[(c[j>>2]|0)+12>>2]&63](j,2048,c[G>>2]|0)|0)){break a}if(H>>>0<h>>>0){G=H}else{G=H;break}}}else{G=g}}while(0);if(w){if(G>>>0>g>>>0){H=c[e>>2]|0;I=r;while(1){G=G+ -4|0;K=H+4|0;c[H>>2]=c[G>>2];I=I+ -1|0;J=(I|0)>0;if(!(G>>>0>g>>>0&J)){break}else{H=K}}c[e>>2]=K;if(J){z=34}else{c[e>>2]=H+8}}else{I=r;z=34}if((z|0)==34){z=0;J=xc[c[(c[j>>2]|0)+44>>2]&63](j,48)|0;K=c[e>>2]|0;M=K+4|0;c[e>>2]=M;if((I|0)>0){H=K;L=I;while(1){c[H>>2]=J;L=L+ -1|0;if((L|0)<=0){break}else{H=M;M=M+4|0}}c[e>>2]=K+(I+1<<2);K=K+(I<<2)|0}}c[K>>2]=m}if((G|0)==(g|0)){K=xc[c[(c[j>>2]|0)+44>>2]&63](j,48)|0;M=c[e>>2]|0;L=M+4|0;c[e>>2]=L;c[M>>2]=K}else{I=a[o>>0]|0;H=(I&1)==0;if(H){I=(I&255)>>>1}else{I=c[D>>2]|0}if((I|0)==0){H=-1}else{if(H){H=B}else{H=c[C>>2]|0}H=a[H>>0]|0}I=c[e>>2]|0;K=0;J=0;while(1){if((J|0)==(H|0)){J=I+4|0;c[e>>2]=J;c[I>>2]=n;K=K+1|0;L=a[o>>0]|0;I=(L&1)==0;if(I){L=(L&255)>>>1}else{L=c[D>>2]|0}if(K>>>0<L>>>0){if(I){H=B}else{H=c[C>>2]|0}if((a[H+K>>0]|0)==127){I=J;H=-1;J=0}else{if(I){H=B}else{H=c[C>>2]|0}I=J;H=a[H+K>>0]|0;J=0}}else{I=J;J=0}}G=G+ -4|0;M=c[G>>2]|0;L=I+4|0;c[e>>2]=L;c[I>>2]=M;if((G|0)==(g|0)){break}else{I=L;J=J+1|0}}}if((F|0)!=(L|0)?(v=L+ -4|0,v>>>0>F>>>0):0){G=v;do{M=c[F>>2]|0;c[F>>2]=c[G>>2];c[G>>2]=M;F=F+4|0;G=G+ -4|0}while(F>>>0<G>>>0)}break};case 1:{c[d>>2]=c[e>>2];L=xc[c[(c[j>>2]|0)+44>>2]&63](j,32)|0;M=c[e>>2]|0;c[e>>2]=M+4;c[M>>2]=L;break};case 0:{c[d>>2]=c[e>>2];break};default:{}}E=E+1|0}while((E|0)!=4);w=a[q>>0]|0;v=(w&1)==0;if(v){q=(w&255)>>>1}else{q=c[t>>2]|0}if(q>>>0>1){if(v){v=t;q=(w&255)>>>1}else{v=c[u>>2]|0;q=c[t>>2]|0}w=v+4|0;u=v+(q<<2)|0;t=c[e>>2]|0;if((w|0)!=(u|0)){q=(v+(q+ -1<<2)+(0-w)|0)>>>2;v=t;while(1){c[v>>2]=c[w>>2];w=w+4|0;if((w|0)==(u|0)){break}else{v=v+4|0}}t=t+(q+1<<2)|0}c[e>>2]=t}f=f&176;if((f|0)==16){i=s;return}else if((f|0)==32){c[d>>2]=c[e>>2];i=s;return}else{c[d>>2]=b;i=s;return}}function Hk(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;p=i;i=i+464|0;x=p;t=p+436|0;s=p+440|0;r=p+444|0;q=p+412|0;v=p+400|0;d=p+424|0;z=p+448|0;w=p+452|0;u=p+456|0;o=c[g+28>>2]|0;D=o+4|0;c[D>>2]=(c[D>>2]|0)+1;if(!((c[3362]|0)==-1)){c[x>>2]=13448;c[x+4>>2]=208;c[x+8>>2]=0;cg(13448,x)}y=(c[13452>>2]|0)+ -1|0;A=c[o+8>>2]|0;if((c[o+12>>2]|0)-A>>2>>>0>y>>>0?(l=c[A+(y<<2)>>2]|0,(l|0)!=0):0){A=a[j>>0]|0;y=(A&1)==0;if(y){A=(A&255)>>>1}else{A=c[j+4>>2]|0}if((A|0)==0){y=0}else{if(y){y=j+4|0}else{y=c[j+8>>2]|0}y=c[y>>2]|0;y=(y|0)==(xc[c[(c[l>>2]|0)+44>>2]&63](l,45)|0)}c[t>>2]=0;c[q+0>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;c[v+0>>2]=0;c[v+4>>2]=0;c[v+8>>2]=0;c[d+0>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;Fk(f,y,o,t,s,r,q,v,d,z);f=a[j>>0]|0;A=(f&1)==0;if(A){B=(f&255)>>>1}else{B=c[j+4>>2]|0}z=c[z>>2]|0;if((B|0)>(z|0)){if(A){B=(f&255)>>>1}else{B=c[j+4>>2]|0}C=a[d>>0]|0;if((C&1)==0){C=(C&255)>>>1}else{C=c[d+4>>2]|0}D=a[v>>0]|0;if((D&1)==0){D=(D&255)>>>1}else{D=c[v+4>>2]|0}B=C+(B-z<<1|1)+D|0}else{B=a[d>>0]|0;if((B&1)==0){B=(B&255)>>>1}else{B=c[d+4>>2]|0}C=a[v>>0]|0;if((C&1)==0){C=(C&255)>>>1}else{C=c[v+4>>2]|0}B=B+2+C|0}B=B+z|0;if(B>>>0>100){x=un(B<<2)|0;if((x|0)==0){D=Xa(4)|0;c[D>>2]=22680;wb(D|0,22728,206)}else{B=x}}else{B=0}if(A){A=j+4|0;j=(f&255)>>>1}else{A=c[j+8>>2]|0;j=c[j+4>>2]|0}Gk(x,w,u,c[g+4>>2]|0,A,A+(j<<2)|0,l,y,t,c[s>>2]|0,c[r>>2]|0,q,v,d,z);Li(b,c[e>>2]|0,x,c[w>>2]|0,c[u>>2]|0,g,h);if((B|0)!=0){vn(B)}if(!((a[d>>0]&1)==0)?(m=c[d+8>>2]|0,(m|0)!=0):0){vn(m)}if(!((a[v>>0]&1)==0)?(n=c[v+8>>2]|0,(n|0)!=0):0){vn(n)}if(!((a[q>>0]&1)==0)?(k=c[q+8>>2]|0,(k|0)!=0):0){vn(k)}C=o+4|0;D=c[C>>2]|0;c[C>>2]=D+ -1;if((D|0)!=0){i=p;return}lc[c[(c[o>>2]|0)+8>>2]&255](o);i=p;return}D=Xa(4)|0;c[D>>2]=21304;wb(D|0,21376,196)}function Ik(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Jk(a){a=a|0;return}function Kk(b,d,e){b=b|0;d=d|0;e=e|0;b=i;if((a[d>>0]&1)==0){d=d+1|0}else{d=c[d+8>>2]|0}e=dc(d|0,1)|0;i=b;return e>>>((e|0)!=(-1|0)&1)|0}function Lk(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;d=i;i=i+16|0;j=d;c[j+0>>2]=0;c[j+4>>2]=0;c[j+8>>2]=0;k=a[h>>0]|0;if((k&1)==0){p=h+1|0;h=(k&255)>>>1}else{p=c[h+8>>2]|0;h=c[h+4>>2]|0}m=p+h|0;if(p>>>0<m>>>0){n=j+4|0;l=j+1|0;k=j+8|0;q=0;do{o=a[p>>0]|0;h=(q&1)!=0;if(h){r=(c[j>>2]&-2)+ -1|0;q=c[n>>2]|0}else{r=10;q=(q&255)>>>1}if((q|0)==(r|0)){lg(j,r,1,r,r,0);if((a[j>>0]&1)==0){h=14}else{h=15}}else{if(h){h=15}else{h=14}}if((h|0)==14){a[j>>0]=(q<<1)+2;r=l;s=q+1|0}else if((h|0)==15){r=c[k>>2]|0;s=q+1|0;c[n>>2]=s}a[r+q>>0]=o;a[r+s>>0]=0;p=p+1|0;q=a[j>>0]|0}while((p|0)!=(m|0));h=(e|0)==-1?-1:e<<1;e=(q&1)==0?l:c[k>>2]|0}else{h=(e|0)==-1?-1:e<<1;e=j+1|0}l=jb(h|0,f|0,g|0,e|0)|0;c[b+0>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;s=Jn(l|0)|0;k=l+s|0;a:do{if((s|0)>0){f=b+4|0;g=b+1|0;e=b+8|0;n=0;while(1){m=a[l>>0]|0;h=(n&1)!=0;if(h){o=(c[b>>2]&-2)+ -1|0;n=c[f>>2]|0}else{o=10;n=(n&255)>>>1}if((n|0)==(o|0)){lg(b,o,1,o,o,0);if((a[b>>0]&1)==0){h=28}else{h=29}}else{if(h){h=29}else{h=28}}if((h|0)==28){a[b>>0]=(n<<1)+2;p=g;o=n+1|0}else if((h|0)==29){p=c[e>>2]|0;o=n+1|0;c[f>>2]=o}a[p+n>>0]=m;a[p+o>>0]=0;l=l+1|0;if((l|0)==(k|0)){break a}n=a[b>>0]|0}}}while(0);if((a[j>>0]&1)==0){i=d;return}b=c[j+8>>2]|0;if((b|0)==0){i=d;return}vn(b);i=d;return}function Mk(a,b){a=a|0;b=b|0;a=i;Yb(((b|0)==-1?-1:b<<1)|0)|0;i=a;return}function Nk(a){a=a|0;var b=0;b=i;if((a|0)!=0){vn(a)}i=b;return}function Ok(a){a=a|0;return}function Pk(b,d,e){b=b|0;d=d|0;e=e|0;b=i;if((a[d>>0]&1)==0){d=d+1|0}else{d=c[d+8>>2]|0}e=dc(d|0,1)|0;i=b;return e>>>((e|0)!=(-1|0)&1)|0}function Qk(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;d=i;i=i+176|0;m=d;n=d+40|0;k=d+168|0;l=d+172|0;o=d+16|0;r=d+8|0;j=d+32|0;c[o+0>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;c[r+4>>2]=0;c[r>>2]=15072;s=a[h>>0]|0;if((s&1)==0){w=h+4|0;h=(s&255)>>>1}else{w=c[h+8>>2]|0;h=c[h+4>>2]|0}v=w+(h<<2)|0;A=m;c[A>>2]=0;c[A+4>>2]=0;do{if(w>>>0<v>>>0){t=n+32|0;u=o+4|0;s=o+1|0;h=o+8|0;x=15072|0;while(1){c[l>>2]=w;A=(tc[c[x+12>>2]&31](r,m,w,v,l,n,t,k)|0)==2;x=c[l>>2]|0;if(A|(x|0)==(w|0)){break}if(n>>>0<(c[k>>2]|0)>>>0){x=n;do{w=a[x>>0]|0;y=a[o>>0]|0;z=(y&1)!=0;if(z){p=(c[o>>2]&-2)+ -1|0;y=c[u>>2]|0}else{p=10;y=(y&255)>>>1}if((y|0)==(p|0)){lg(o,p,1,p,p,0);if((a[o>>0]&1)==0){p=18}else{p=19}}else{if(z){p=19}else{p=18}}if((p|0)==18){p=0;a[o>>0]=(y<<1)+2;A=s;z=y+1|0}else if((p|0)==19){p=0;A=c[h>>2]|0;z=y+1|0;c[u>>2]=z}a[A+y>>0]=w;a[A+z>>0]=0;x=x+1|0}while(x>>>0<(c[k>>2]|0)>>>0);w=c[l>>2]|0}else{w=x}if(!(w>>>0<v>>>0)){p=24;break}x=c[r>>2]|0}if((p|0)==24){q=(a[o>>0]&1)==0;break}ok(14296)}else{q=1}}while(0);if(q){p=o+1|0}else{p=c[o+8>>2]|0}p=jb(((e|0)==-1?-1:e<<1)|0,f|0,g|0,p|0)|0;c[b+0>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[j+4>>2]=0;c[j>>2]=15176;A=Jn(p|0)|0;q=p+A|0;z=m;c[z>>2]=0;c[z+4>>2]=0;a:do{if((A|0)>0){e=q;r=n+128|0;g=b+4|0;f=b+8|0;h=15176|0;while(1){c[l>>2]=p;A=(tc[c[h+16>>2]&31](j,m,p,(e-p|0)>32?p+32|0:q,l,n,r,k)|0)==2;h=c[l>>2]|0;if(A|(h|0)==(p|0)){break}if(n>>>0<(c[k>>2]|0)>>>0){s=n;do{h=c[s>>2]|0;t=a[b>>0]|0;u=(t&1)!=0;if(u){p=(c[b>>2]&-2)+ -1|0;t=c[g>>2]|0}else{p=1;t=(t&255)>>>1}if((t|0)==(p|0)){pg(b,p,1,p,p,0,0);if((a[b>>0]&1)==0){p=43}else{p=44}}else{if(u){p=44}else{p=43}}if((p|0)==43){a[b>>0]=(t<<1)+2;v=g;u=t+1|0}else if((p|0)==44){v=c[f>>2]|0;u=t+1|0;c[g>>2]=u}c[v+(t<<2)>>2]=h;c[v+(u<<2)>>2]=0;s=s+4|0}while(s>>>0<(c[k>>2]|0)>>>0);p=c[l>>2]|0}else{p=h}if(!(p>>>0<q>>>0)){break a}h=c[j>>2]|0}ok(14296)}}while(0);if((a[o>>0]&1)==0){i=d;return}b=c[o+8>>2]|0;if((b|0)==0){i=d;return}vn(b);i=d;return}function Rk(a,b){a=a|0;b=b|0;a=i;Yb(((b|0)==-1?-1:b<<1)|0)|0;i=a;return}function Sk(b){b=b|0;var d=0,e=0;d=i;c[b>>2]=13544;b=b+8|0;e=c[b>>2]|0;if((a[13368]|0)==0?(Qa(13368)|0)!=0:0){c[3340]=kb(2147483647,13376,0)|0;$a(13368)}if((e|0)==(c[3340]|0)){i=d;return}Vb(c[b>>2]|0);i=d;return}function Tk(){var b=0,d=0,e=0;d=Xa(8)|0;c[d>>2]=9904;while(1){e=un(19)|0;if((e|0)!=0){b=7;break}e=c[5666]|0;c[5666]=e+0;if((e|0)==0){break}sc[e&31]()}if((b|0)==7){c[e+4>>2]=6;c[e>>2]=6;b=e+12|0;c[d+4>>2]=b;c[e+8>>2]=0;a[b+0>>0]=a[13352>>0]|0;a[b+1>>0]=a[13353>>0]|0;a[b+2>>0]=a[13354>>0]|0;a[b+3>>0]=a[13355>>0]|0;a[b+4>>0]=a[13356>>0]|0;a[b+5>>0]=a[13357>>0]|0;a[b+6>>0]=a[13358>>0]|0;c[d>>2]=9984;wb(d|0,10024,104)}e=Xa(4)|0;c[e>>2]=22680;wb(e|0,22728,206)}function Uk(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;f=i;h=d+4|0;c[h>>2]=(c[h>>2]|0)+1;h=b+12|0;l=c[h>>2]|0;g=b+8|0;k=c[g>>2]|0;q=l;p=k;j=q-p>>2;do{if(!(j>>>0>e>>>0)){o=e+1|0;if(!(j>>>0<o>>>0)){if(!(j>>>0>o>>>0)){break}j=k+(o<<2)|0;if((l|0)==(j|0)){break}c[h>>2]=l+(~((l+ -4+(0-j)|0)>>>2)<<2);break}n=o-j|0;k=b+16|0;r=c[k>>2]|0;do{if(r-q>>2>>>0<n>>>0){l=b+24|0;if(o>>>0>1073741823){Tk()}p=r-p|0;if(p>>2>>>0<536870911){r=p>>1;o=r>>>0<o>>>0?o:r;if((o|0)!=0){p=b+136|0;if((a[p>>0]|0)==0&o>>>0<29){a[p>>0]=1;p=l}else{m=14}}else{o=0;p=0}}else{o=1073741823;m=14}do{if((m|0)==14){q=o<<2;q=(q|0)==0?1:q;while(1){p=un(q)|0;if((p|0)!=0){m=20;break}p=c[5666]|0;c[5666]=p+0;if((p|0)==0){break}sc[p&31]()}if((m|0)==20){break}r=Xa(4)|0;c[r>>2]=22680;wb(r|0,22728,206)}}while(0);m=p+(j<<2)|0;do{if((m|0)==0){m=0}else{c[m>>2]=0}m=m+4|0;n=n+ -1|0}while((n|0)!=0);n=c[g>>2]|0;q=(c[h>>2]|0)-n|0;r=p+(j-(q>>2)<<2)|0;Ln(r|0,n|0,q|0)|0;c[g>>2]=r;c[h>>2]=m;c[k>>2]=p+(o<<2);if((n|0)!=0){if((l|0)==(n|0)){a[b+136>>0]=0;break}else{vn(n);break}}}else{do{if((l|0)==0){j=0}else{c[l>>2]=0;j=c[h>>2]|0}l=j+4|0;c[h>>2]=l;n=n+ -1|0}while((n|0)!=0)}}while(0);k=c[g>>2]|0}}while(0);h=c[k+(e<<2)>>2]|0;if((h|0)==0){r=k;r=r+(e<<2)|0;c[r>>2]=d;i=f;return}q=h+4|0;r=c[q>>2]|0;c[q>>2]=r+ -1;if((r|0)==0){lc[c[(c[h>>2]|0)+8>>2]&255](h)}r=c[g>>2]|0;r=r+(e<<2)|0;c[r>>2]=d;i=f;return}function Vk(a){a=a|0;var b=0;b=i;Wk(a);if((a|0)!=0){vn(a)}i=b;return}function Wk(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;e=i;c[b>>2]=13392;d=b+12|0;j=c[d>>2]|0;f=b+8|0;k=c[f>>2]|0;if((j|0)!=(k|0)){h=0;while(1){l=c[k+(h<<2)>>2]|0;if((l|0)!=0){j=l+4|0;k=c[j>>2]|0;c[j>>2]=k+ -1;if((k|0)==0){lc[c[(c[l>>2]|0)+8>>2]&255](l)}j=c[d>>2]|0;k=c[f>>2]|0}h=h+1|0;if(!(h>>>0<j-k>>2>>>0)){j=k;break}}}if(!((a[b+144>>0]&1)==0)?(g=c[b+152>>2]|0,(g|0)!=0):0){vn(g);j=c[f>>2]|0}if((j|0)==0){i=e;return}f=c[d>>2]|0;if((f|0)!=(j|0)){c[d>>2]=f+(~((f+ -4+(0-j)|0)>>>2)<<2)}if((b+24|0)==(j|0)){a[b+136>>0]=0;i=e;return}else{vn(j);i=e;return}} - - - -function Zn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return hc[a&63](b|0,c|0,d|0)|0}function _n(a,b,c){a=a|0;b=b|0;c=c|0;return ka(0,a|0,b|0,c|0)|0}function $n(a,b,c){a=a|0;b=b|0;c=c|0;return ka(1,a|0,b|0,c|0)|0}function ao(a,b,c){a=a|0;b=b|0;c=c|0;return ka(2,a|0,b|0,c|0)|0}function bo(a,b,c){a=a|0;b=b|0;c=c|0;return ka(3,a|0,b|0,c|0)|0}function co(a,b,c){a=a|0;b=b|0;c=c|0;return ka(4,a|0,b|0,c|0)|0}function eo(a,b,c){a=a|0;b=b|0;c=c|0;return ka(5,a|0,b|0,c|0)|0}function fo(a,b,c){a=a|0;b=b|0;c=c|0;return ka(6,a|0,b|0,c|0)|0}function go(a,b,c){a=a|0;b=b|0;c=c|0;return ka(7,a|0,b|0,c|0)|0}function ho(a,b,c){a=a|0;b=b|0;c=c|0;return ka(8,a|0,b|0,c|0)|0}function io(a,b,c){a=a|0;b=b|0;c=c|0;return ka(9,a|0,b|0,c|0)|0}function jo(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ic[a&63](b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function ko(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(0,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function lo(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(1,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function mo(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(2,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function no(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(3,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function oo(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(4,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function po(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(5,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function qo(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(6,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function ro(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(7,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function so(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(8,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function to(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ka(9,a|0,b|0,c|0,d|0,e|0,f|0,g|0)}function uo(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;jc[a&31](b|0,c|0,d|0,e|0,f|0)}function vo(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(0,a|0,b|0,c|0,d|0,e|0)}function wo(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(1,a|0,b|0,c|0,d|0,e|0)}function xo(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(2,a|0,b|0,c|0,d|0,e|0)}function yo(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(3,a|0,b|0,c|0,d|0,e|0)}function zo(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(4,a|0,b|0,c|0,d|0,e|0)}function Ao(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(5,a|0,b|0,c|0,d|0,e|0)}function Bo(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(6,a|0,b|0,c|0,d|0,e|0)}function Co(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(7,a|0,b|0,c|0,d|0,e|0)}function Do(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(8,a|0,b|0,c|0,d|0,e|0)}function Eo(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(9,a|0,b|0,c|0,d|0,e|0)}function Fo(a){a=a|0;return kc[a&31]()|0}function Go(){return ka(0)|0}function Ho(){return ka(1)|0}function Io(){return ka(2)|0}function Jo(){return ka(3)|0}function Ko(){return ka(4)|0}function Lo(){return ka(5)|0}function Mo(){return ka(6)|0}function No(){return ka(7)|0}function Oo(){return ka(8)|0}function Po(){return ka(9)|0}function Qo(a,b){a=a|0;b=b|0;lc[a&255](b|0)}function Ro(a){a=a|0;ka(0,a|0)}function So(a){a=a|0;ka(1,a|0)}function To(a){a=a|0;ka(2,a|0)}function Uo(a){a=a|0;ka(3,a|0)}function Vo(a){a=a|0;ka(4,a|0)}function Wo(a){a=a|0;ka(5,a|0)}function Xo(a){a=a|0;ka(6,a|0)}function Yo(a){a=a|0;ka(7,a|0)}function Zo(a){a=a|0;ka(8,a|0)}function _o(a){a=a|0;ka(9,a|0)}function $o(a,b,c){a=a|0;b=b|0;c=c|0;mc[a&127](b|0,c|0)}function ap(a,b){a=a|0;b=b|0;ka(0,a|0,b|0)}function bp(a,b){a=a|0;b=b|0;ka(1,a|0,b|0)}function cp(a,b){a=a|0;b=b|0;ka(2,a|0,b|0)}function dp(a,b){a=a|0;b=b|0;ka(3,a|0,b|0)}function ep(a,b){a=a|0;b=b|0;ka(4,a|0,b|0)}function fp(a,b){a=a|0;b=b|0;ka(5,a|0,b|0)}function gp(a,b){a=a|0;b=b|0;ka(6,a|0,b|0)}function hp(a,b){a=a|0;b=b|0;ka(7,a|0,b|0)}function ip(a,b){a=a|0;b=b|0;ka(8,a|0,b|0)}function jp(a,b){a=a|0;b=b|0;ka(9,a|0,b|0)}function kp(a,b,c,d,e,f,g,h,i,j){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;nc[a&31](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0,j|0)}function lp(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(0,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function mp(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(1,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function np(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(2,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function op(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(3,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function pp(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(4,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function qp(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(5,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function rp(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(6,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function sp(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(7,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function tp(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(8,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function up(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;ka(9,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function vp(a,b){a=a|0;b=b|0;return oc[a&127](b|0)|0}function wp(a){a=a|0;return ka(0,a|0)|0}function xp(a){a=a|0;return ka(1,a|0)|0}function yp(a){a=a|0;return ka(2,a|0)|0}function zp(a){a=a|0;return ka(3,a|0)|0}function Ap(a){a=a|0;return ka(4,a|0)|0}function Bp(a){a=a|0;return ka(5,a|0)|0}function Cp(a){a=a|0;return ka(6,a|0)|0}function Dp(a){a=a|0;return ka(7,a|0)|0}function Ep(a){a=a|0;return ka(8,a|0)|0}function Fp(a){a=a|0;return ka(9,a|0)|0}function Gp(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=+h;pc[a&31](b|0,c|0,d|0,e|0,f|0,g|0,+h)}function Hp(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(0,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Ip(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(1,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Jp(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(2,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Kp(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(3,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Lp(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(4,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Mp(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(5,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Np(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(6,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Op(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(7,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Pp(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(8,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Qp(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;ka(9,a|0,b|0,c|0,d|0,e|0,f|0,+g)}function Rp(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;qc[a&31](b|0,c|0,d|0)}function Sp(a,b,c){a=a|0;b=b|0;c=c|0;ka(0,a|0,b|0,c|0)}function Tp(a,b,c){a=a|0;b=b|0;c=c|0;ka(1,a|0,b|0,c|0)}function Up(a,b,c){a=a|0;b=b|0;c=c|0;ka(2,a|0,b|0,c|0)}function Vp(a,b,c){a=a|0;b=b|0;c=c|0;ka(3,a|0,b|0,c|0)}function Wp(a,b,c){a=a|0;b=b|0;c=c|0;ka(4,a|0,b|0,c|0)}function Xp(a,b,c){a=a|0;b=b|0;c=c|0;ka(5,a|0,b|0,c|0)}function Yp(a,b,c){a=a|0;b=b|0;c=c|0;ka(6,a|0,b|0,c|0)}function Zp(a,b,c){a=a|0;b=b|0;c=c|0;ka(7,a|0,b|0,c|0)}function _p(a,b,c){a=a|0;b=b|0;c=c|0;ka(8,a|0,b|0,c|0)}function $p(a,b,c){a=a|0;b=b|0;c=c|0;ka(9,a|0,b|0,c|0)}function aq(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;rc[a&31](b|0,c|0,d|0,e|0,f|0,+g)}function bq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(0,a|0,b|0,c|0,d|0,e|0,+f)}function cq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(1,a|0,b|0,c|0,d|0,e|0,+f)}function dq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(2,a|0,b|0,c|0,d|0,e|0,+f)}function eq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(3,a|0,b|0,c|0,d|0,e|0,+f)}function fq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(4,a|0,b|0,c|0,d|0,e|0,+f)}function gq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(5,a|0,b|0,c|0,d|0,e|0,+f)}function hq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(6,a|0,b|0,c|0,d|0,e|0,+f)}function iq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(7,a|0,b|0,c|0,d|0,e|0,+f)}function jq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(8,a|0,b|0,c|0,d|0,e|0,+f)}function kq(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ka(9,a|0,b|0,c|0,d|0,e|0,+f)}function lq(a){a=a|0;sc[a&31]()}function mq(){ka(0)}function nq(){ka(1)}function oq(){ka(2)}function pq(){ka(3)}function qq(){ka(4)}function rq(){ka(5)}function sq(){ka(6)}function tq(){ka(7)}function uq(){ka(8)}function vq(){ka(9)}function wq(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;return tc[a&31](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)|0}function xq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(0,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function yq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(1,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function zq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(2,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function Aq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(3,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function Bq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(4,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function Cq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(5,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function Dq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(6,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function Eq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(7,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function Fq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(8,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function Gq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ka(9,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function Hq(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return uc[a&31](b|0,c|0,d|0,e|0)|0}function Iq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(0,a|0,b|0,c|0,d|0)|0}function Jq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(1,a|0,b|0,c|0,d|0)|0}function Kq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(2,a|0,b|0,c|0,d|0)|0}function Lq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(3,a|0,b|0,c|0,d|0)|0}function Mq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(4,a|0,b|0,c|0,d|0)|0}function Nq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(5,a|0,b|0,c|0,d|0)|0}function Oq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(6,a|0,b|0,c|0,d|0)|0}function Pq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(7,a|0,b|0,c|0,d|0)|0}function Qq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(8,a|0,b|0,c|0,d|0)|0}function Rq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ka(9,a|0,b|0,c|0,d|0)|0}function Sq(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;vc[a&31](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)}function Tq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(0,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Uq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(1,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Vq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(2,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Wq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(3,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Xq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(4,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Yq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(5,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Zq(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(6,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function _q(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(7,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function $q(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(8,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function ar(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ka(9,a|0,b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function br(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;wc[a&63](b|0,c|0,d|0,e|0,f|0,g|0)}function cr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(0,a|0,b|0,c|0,d|0,e|0,f|0)}function dr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(1,a|0,b|0,c|0,d|0,e|0,f|0)}function er(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(2,a|0,b|0,c|0,d|0,e|0,f|0)}function fr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(3,a|0,b|0,c|0,d|0,e|0,f|0)}function gr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(4,a|0,b|0,c|0,d|0,e|0,f|0)}function hr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(5,a|0,b|0,c|0,d|0,e|0,f|0)}function ir(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(6,a|0,b|0,c|0,d|0,e|0,f|0)}function jr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(7,a|0,b|0,c|0,d|0,e|0,f|0)}function kr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(8,a|0,b|0,c|0,d|0,e|0,f|0)}function lr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(9,a|0,b|0,c|0,d|0,e|0,f|0)}function mr(a,b,c){a=a|0;b=b|0;c=c|0;return xc[a&63](b|0,c|0)|0}function nr(a,b){a=a|0;b=b|0;return ka(0,a|0,b|0)|0}function or(a,b){a=a|0;b=b|0;return ka(1,a|0,b|0)|0}function pr(a,b){a=a|0;b=b|0;return ka(2,a|0,b|0)|0}function qr(a,b){a=a|0;b=b|0;return ka(3,a|0,b|0)|0}function rr(a,b){a=a|0;b=b|0;return ka(4,a|0,b|0)|0}function sr(a,b){a=a|0;b=b|0;return ka(5,a|0,b|0)|0}function tr(a,b){a=a|0;b=b|0;return ka(6,a|0,b|0)|0}function ur(a,b){a=a|0;b=b|0;return ka(7,a|0,b|0)|0}function vr(a,b){a=a|0;b=b|0;return ka(8,a|0,b|0)|0}function wr(a,b){a=a|0;b=b|0;return ka(9,a|0,b|0)|0}function xr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return yc[a&63](b|0,c|0,d|0,e|0,f|0)|0}function yr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(0,a|0,b|0,c|0,d|0,e|0)|0}function zr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(1,a|0,b|0,c|0,d|0,e|0)|0}function Ar(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(2,a|0,b|0,c|0,d|0,e|0)|0}function Br(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(3,a|0,b|0,c|0,d|0,e|0)|0}function Cr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(4,a|0,b|0,c|0,d|0,e|0)|0}function Dr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(5,a|0,b|0,c|0,d|0,e|0)|0}function Er(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(6,a|0,b|0,c|0,d|0,e|0)|0}function Fr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(7,a|0,b|0,c|0,d|0,e|0)|0}function Gr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(8,a|0,b|0,c|0,d|0,e|0)|0}function Hr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return ka(9,a|0,b|0,c|0,d|0,e|0)|0}function Ir(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;zc[a&31](b|0,c|0,d|0,e|0)}function Jr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(0,a|0,b|0,c|0,d|0)}function Kr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(1,a|0,b|0,c|0,d|0)}function Lr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(2,a|0,b|0,c|0,d|0)}function Mr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(3,a|0,b|0,c|0,d|0)}function Nr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(4,a|0,b|0,c|0,d|0)}function Or(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(5,a|0,b|0,c|0,d|0)}function Pr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(6,a|0,b|0,c|0,d|0)}function Qr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(7,a|0,b|0,c|0,d|0)}function Rr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(8,a|0,b|0,c|0,d|0)}function Sr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(9,a|0,b|0,c|0,d|0)}function Tr(a,b,c){a=a|0;b=b|0;c=c|0;fa(0);return 0}function Ur(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;fa(1)}function Vr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;fa(2)}function Wr(){fa(3);return 0}function Xr(a){a=a|0;fa(4)}function Yr(a,b){a=a|0;b=b|0;fa(5)}function Zr(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;fa(6)}function _r(a){a=a|0;fa(7);return 0}function $r(a){a=a|0;return Ab(a|0)|0}function as(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;fa(8)}function bs(a,b,c){a=a|0;b=b|0;c=c|0;fa(9)}function cs(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;fa(10)}function ds(){fa(11)}function es(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;fa(12);return 0}function fs(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;fa(13);return 0}function gs(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;fa(14)}function hs(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;fa(15)}function is(a,b){a=a|0;b=b|0;fa(16);return 0}function js(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;fa(17);return 0}function ks(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;fa(18)} - - - - -// EMSCRIPTEN_END_FUNCS -var hc=[Tr,Tr,_n,Tr,$n,Tr,ao,Tr,bo,Tr,co,Tr,eo,Tr,fo,Tr,go,Tr,ho,Tr,io,Tr,vg,Ag,Eg,Jg,Og,kf,Sg,xf,Pf,Qf,Dh,Ih,Kk,Pk,ql,sl,vl,bl,gl,il,ll,hn,mn,gn,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr,Tr];var ic=[Ur,Ur,ko,Ur,lo,Ur,mo,Ur,no,Ur,oo,Ur,po,Ur,qo,Ur,ro,Ur,so,Ur,to,Ur,Lh,Nh,Oh,Ph,Qh,Rh,Sh,Th,Uh,Vh,Wh,$h,bi,ci,di,ei,fi,gi,hi,ii,ji,ki,yi,Ai,Mi,Oi,Xi,Yi,Zi,_i,$i,gj,hj,ij,jj,kj,Bk,Hk,Ur,Ur,Ur,Ur];var jc=[Vr,Vr,vo,Vr,wo,Vr,xo,Vr,yo,Vr,zo,Vr,Ao,Vr,Bo,Vr,Co,Vr,Do,Vr,Eo,Vr,qn,pn,on,Vr,Vr,Vr,Vr,Vr,Vr,Vr];var kc=[Wr,Wr,Go,Wr,Ho,Wr,Io,Wr,Jo,Wr,Ko,Wr,Lo,Wr,Mo,Wr,No,Wr,Oo,Wr,Po,Wr,Oc,Wr,Wr,Wr,Wr,Wr,Wr,Wr,Wr,Wr];var lc=[Xr,Xr,Ro,Xr,So,Xr,To,Xr,Uo,Xr,Vo,Xr,Wo,Xr,Xo,Xr,Yo,Xr,Zo,Xr,_o,Xr,Tc,Uc,hd,id,nd,od,vd,wd,xd,zd,Bd,Cd,Dd,Ed,Fd,Hd,Jd,Kd,Ld,Md,Nd,Pd,Rd,Sd,Td,Ud,Vd,Xd,Yd,$d,Zd,ae,_d,be,Vg,Ug,Xg,Wg,ce,de,je,ke,le,ne,te,ue,se,ve,re,we,xe,ye,ze,Ae,Be,Ce,Ee,Fe,Ie,Je,Oe,Pe,Ne,Qe,qe,Re,Te,Ue,Ve,Xe,Ye,Ze,_e,af,ff,gf,mf,nf,tf,uf,zf,Af,If,Hf,Lf,Kf,Nf,_f,Zf,Tf,$f,Xf,ag,tg,sg,Hg,Gg,_g,Zg,ah,$g,dh,ch,fh,eh,nh,mh,ph,oh,vh,uh,rg,wh,th,xh,zh,yh,_k,Fh,Eh,Kh,Jh,_h,Zh,ti,si,Hi,Gi,Vi,Ui,ej,dj,oj,nj,rj,qj,uj,tj,Fj,Ej,Qj,Pj,$j,_j,kk,jk,sk,rk,xk,wk,Dk,Ck,Jk,Ik,Ok,Nk,Wk,Vk,ol,nl,Sk,Fl,em,dm,gm,fm,Ah,Zk,al,xl,Nl,Vl,bm,cm,Ym,Xm,_m,cn,$m,an,fn,bn,dn,en,zn,yn,$k,De,bg,Rc,ef,mk,vn,Tm,Sm,Rm,Qm,Pm,Om,fg,mg,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr,Xr];var mc=[Yr,Yr,ap,Yr,bp,Yr,cp,Yr,dp,Yr,ep,Yr,fp,Yr,gp,Yr,hp,Yr,ip,Yr,jp,Yr,gd,Ad,Id,Qd,ug,He,Ke,hf,of,vf,Bf,Ig,xj,yj,zj,Aj,Cj,Dj,Ij,Jj,Kj,Lj,Nj,Oj,Tj,Uj,Vj,Wj,Yj,Zj,ck,dk,ek,fk,hk,ik,Mk,Rk,lm,nm,pm,mm,om,qm,Jc,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr,Yr];var nc=[Zr,Zr,lp,Zr,mp,Zr,np,Zr,op,Zr,pp,Zr,qp,Zr,rp,Zr,sp,Zr,tp,Zr,up,Zr,aj,lj,Zr,Zr,Zr,Zr,Zr,Zr,Zr,Zr];var oc=[_r,_r,wp,_r,xp,_r,yp,_r,zp,_r,Ap,_r,Bp,_r,Cp,_r,Dp,_r,Ep,_r,Fp,_r,Mf,yg,zg,ge,Cg,$r,Ge,Me,jf,Ng,Pg,Qg,Mg,pf,qf,wf,Bg,Cf,Df,Jf,Rf,Uf,rh,Wi,rm,tm,vm,Bm,Dm,xm,zm,fj,sm,um,wm,Cm,Em,ym,Am,vj,wj,Bj,Gj,Hj,Mj,Rj,Sj,Xj,ak,bk,gk,Jl,Kl,Ml,hm,jm,im,km,Bl,Cl,El,Rl,Sl,Ul,Zl,_l,am,Zm,An,Qc,Pc,Kc,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r,_r];var pc=[as,as,Hp,as,Ip,as,Jp,as,Kp,as,Lp,as,Mp,as,Np,as,Op,as,Pp,as,Qp,as,yk,Ek,as,as,as,as,as,as,as,as];var qc=[bs,bs,Sp,bs,Tp,bs,Up,bs,Vp,bs,Wp,bs,Xp,bs,Yp,bs,Zp,bs,_p,bs,$p,bs,Of,Sf,Wf,Vf,sh,Ic,Mc,bs,bs,bs];var rc=[cs,cs,bq,cs,cq,cs,dq,cs,eq,cs,fq,cs,gq,cs,hq,cs,iq,cs,jq,cs,kq,cs,Bi,Ei,Pi,Ri,cs,cs,cs,cs,cs,cs];var sc=[ds,ds,mq,ds,nq,ds,oq,ds,pq,ds,qq,ds,rq,ds,sq,ds,tq,ds,uq,ds,vq,ds,ds,ds,ds,ds,ds,ds,ds,ds,ds,ds];var tc=[es,es,xq,es,yq,es,zq,es,Aq,es,Bq,es,Cq,es,Dq,es,Eq,es,Fq,es,Gq,es,Gl,Hl,yl,zl,Ol,Pl,Wl,Xl,es,es];var uc=[fs,fs,Iq,fs,Jq,fs,Kq,fs,Lq,fs,Mq,fs,Nq,fs,Oq,fs,Pq,fs,Qq,fs,Rq,fs,ul,cl,dl,el,kl,fs,fs,fs,fs,fs];var vc=[gs,gs,Tq,gs,Uq,gs,Vq,gs,Wq,gs,Xq,gs,Yq,gs,Zq,gs,_q,gs,$q,gs,ar,gs,pj,sj,lk,pk,tk,vk,gs,gs,gs,gs];var wc=[hs,hs,cr,hs,dr,hs,er,hs,fr,hs,gr,hs,hr,hs,ir,hs,jr,hs,kr,hs,lr,hs,ee,Kg,wg,ui,vi,zi,Fi,Ii,Ji,Ni,Si,Lk,Qk,tn,sn,rn,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs,hs];var xc=[is,is,nr,is,or,is,pr,is,qr,is,rr,is,sr,is,tr,is,ur,is,vr,is,wr,is,yd,Gd,Od,Wd,he,ie,me,Le,We,$e,Rg,lf,rf,Tg,Dg,yf,Ef,Fg,pl,rl,tl,fl,hl,jl,Lc,is,is,is,is,is,is,is,is,is,is,is,is,is,is,is,is,is];var yc=[js,js,yr,js,zr,js,Ar,js,Br,js,Cr,js,Dr,js,Er,js,Fr,js,Gr,js,Hr,js,Bh,Gh,wl,Il,Ll,ml,Al,Dl,Ql,Tl,Yl,$l,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js,js];var zc=[ks,ks,Jr,ks,Kr,ks,Lr,ks,Mr,ks,Nr,ks,Or,ks,Pr,ks,Qr,ks,Rr,ks,Sr,ks,fe,Lg,xg,Ch,Hh,jn,kn,ln,Nc,ks];return{_i64Subtract:Hn,_free:vn,_realloc:wn,_i64Add:In,_memmove:Mn,_strlen:Jn,_memset:Nn,_malloc:un,_memcpy:Ln,___getTypeName:cf,_bitshift64Lshr:Kn,_bitshift64Shl:On,__GLOBAL__I_a:bf,__GLOBAL__I_a65:df,__GLOBAL__I_a153:Gf,runPostSets:Gn,stackAlloc:Ac,stackSave:Bc,stackRestore:Cc,setThrew:Dc,setTempRet0:Gc,getTempRet0:Hc,dynCall_iiii:Zn,dynCall_viiiiiii:jo,dynCall_viiiii:uo,dynCall_i:Fo,dynCall_vi:Qo,dynCall_vii:$o,dynCall_viiiiiiiii:kp,dynCall_ii:vp,dynCall_viiiiiid:Gp,dynCall_viii:Rp,dynCall_viiiiid:aq,dynCall_v:lq,dynCall_iiiiiiiii:wq,dynCall_iiiii:Hq,dynCall_viiiiiiii:Sq,dynCall_viiiiii:br,dynCall_iii:mr,dynCall_iiiiii:xr,dynCall_viiii:Ir} -// EMSCRIPTEN_END_ASM - -})({"Math":Math,"Int8Array":Int8Array,"Int16Array":Int16Array,"Int32Array":Int32Array,"Uint8Array":Uint8Array,"Uint16Array":Uint16Array,"Uint32Array":Uint32Array,"Float32Array":Float32Array,"Float64Array":Float64Array},{"abort":abort,"assert":assert,"asmPrintInt":asmPrintInt,"asmPrintFloat":asmPrintFloat,"min":Math_min,"jsCall":jsCall,"invoke_iiii":invoke_iiii,"invoke_viiiiiii":invoke_viiiiiii,"invoke_viiiii":invoke_viiiii,"invoke_i":invoke_i,"invoke_vi":invoke_vi,"invoke_vii":invoke_vii,"invoke_viiiiiiiii":invoke_viiiiiiiii,"invoke_ii":invoke_ii,"invoke_viiiiiid":invoke_viiiiiid,"invoke_viii":invoke_viii,"invoke_viiiiid":invoke_viiiiid,"invoke_v":invoke_v,"invoke_iiiiiiiii":invoke_iiiiiiiii,"invoke_iiiii":invoke_iiiii,"invoke_viiiiiiii":invoke_viiiiiiii,"invoke_viiiiii":invoke_viiiiii,"invoke_iii":invoke_iii,"invoke_iiiiii":invoke_iiiiii,"invoke_viiii":invoke_viiii,"_fabs":_fabs,"_sscanf":_sscanf,"_pthread_cond_wait":_pthread_cond_wait,"___ctype_tolower_loc":___ctype_tolower_loc,"_asprintf":_asprintf,"__embind_register_void":__embind_register_void,"_send":_send,"__embind_register_memory_view":__embind_register_memory_view,"_vsscanf":_vsscanf,"___ctype_b_loc":___ctype_b_loc,"__ZSt9terminatev":__ZSt9terminatev,"_fmod":_fmod,"___cxa_guard_acquire":___cxa_guard_acquire,"___setErrNo":___setErrNo,"___cxa_is_number_type":___cxa_is_number_type,"___gxx_personality_v0":___gxx_personality_v0,"__embind_register_integer":__embind_register_integer,"_ungetc":_ungetc,"___assert_fail":___assert_fail,"___cxa_allocate_exception":___cxa_allocate_exception,"__ZSt18uncaught_exceptionv":__ZSt18uncaught_exceptionv,"___ctype_toupper_loc":___ctype_toupper_loc,"_fflush":_fflush,"___cxa_guard_release":___cxa_guard_release,"__addDays":__addDays,"___errno_location":___errno_location,"_pwrite":_pwrite,"_strerror_r":_strerror_r,"_strftime_l":_strftime_l,"__formatString":__formatString,"__reallyNegative":__reallyNegative,"_sbrk":_sbrk,"_uselocale":_uselocale,"_catgets":_catgets,"_newlocale":_newlocale,"_snprintf":_snprintf,"___cxa_begin_catch":___cxa_begin_catch,"_emscripten_memcpy_big":_emscripten_memcpy_big,"_fileno":_fileno,"__embind_register_bool":__embind_register_bool,"___resumeException":___resumeException,"___cxa_find_matching_catch":___cxa_find_matching_catch,"_sysconf":_sysconf,"__embind_register_std_string":__embind_register_std_string,"_strftime":_strftime,"__arraySum":__arraySum,"___cxa_throw":___cxa_throw,"__embind_register_emval":__embind_register_emval,"__exit":__exit,"__embind_register_class_function":__embind_register_class_function,"__ZNKSt9exception4whatEv":__ZNKSt9exception4whatEv,"_pthread_mutex_destroy":_pthread_mutex_destroy,"_pthread_mutex_unlock":_pthread_mutex_unlock,"_fread":_fread,"_pthread_cond_broadcast":_pthread_cond_broadcast,"_mkport":_mkport,"_sprintf":_sprintf,"__embind_register_class":__embind_register_class,"_vasprintf":_vasprintf,"__embind_register_std_wstring":__embind_register_std_wstring,"_write":_write,"__isLeapYear":__isLeapYear,"__scanString":__scanString,"_strerror":_strerror,"__embind_register_class_constructor":__embind_register_class_constructor,"_recv":_recv,"_vsnprintf":_vsnprintf,"__ZNSt9exceptionD2Ev":__ZNSt9exceptionD2Ev,"_copysign":_copysign,"_fgetc":_fgetc,"___cxa_does_inherit":___cxa_does_inherit,"_freelocale":_freelocale,"_read":_read,"_abort":_abort,"_catclose":_catclose,"_fwrite":_fwrite,"_time":_time,"_pthread_mutex_lock":_pthread_mutex_lock,"__embind_register_float":__embind_register_float,"_pread":_pread,"_atexit":_atexit,"_catopen":_catopen,"_exit":_exit,"__getFloat":__getFloat,"STACKTOP":STACKTOP,"STACK_MAX":STACK_MAX,"tempDoublePtr":tempDoublePtr,"ABORT":ABORT,"cttz_i8":cttz_i8,"ctlz_i8":ctlz_i8,"NaN":NaN,"Infinity":Infinity,"__ZTISt9exception":__ZTISt9exception,"___dso_handle":___dso_handle,"_stderr":_stderr,"_stdin":_stdin,"_stdout":_stdout},buffer);var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _free=Module["_free"]=asm["_free"];var _realloc=Module["_realloc"]=asm["_realloc"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _memmove=Module["_memmove"]=asm["_memmove"];var _strlen=Module["_strlen"]=asm["_strlen"];var _memset=Module["_memset"]=asm["_memset"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var ___getTypeName=Module["___getTypeName"]=asm["___getTypeName"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var __GLOBAL__I_a=Module["__GLOBAL__I_a"]=asm["__GLOBAL__I_a"];var __GLOBAL__I_a65=Module["__GLOBAL__I_a65"]=asm["__GLOBAL__I_a65"];var __GLOBAL__I_a153=Module["__GLOBAL__I_a153"]=asm["__GLOBAL__I_a153"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_viiiiiii=Module["dynCall_viiiiiii"]=asm["dynCall_viiiiiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_i=Module["dynCall_i"]=asm["dynCall_i"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_viiiiiiiii=Module["dynCall_viiiiiiiii"]=asm["dynCall_viiiiiiiii"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_viiiiiid=Module["dynCall_viiiiiid"]=asm["dynCall_viiiiiid"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_viiiiid=Module["dynCall_viiiiid"]=asm["dynCall_viiiiid"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_iiiiiiiii=Module["dynCall_iiiiiiiii"]=asm["dynCall_iiiiiiiii"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_viiiiiiii=Module["dynCall_viiiiiiii"]=asm["dynCall_viiiiiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];Runtime.stackAlloc=asm["stackAlloc"];Runtime.stackSave=asm["stackSave"];Runtime.stackRestore=asm["stackRestore"];Runtime.setTempRet0=asm["setTempRet0"];Runtime.getTempRet0=asm["getTempRet0"];var i64Math=(function(){var goog={math:{}};goog.math.Long=(function(low,high){this.low_=low|0;this.high_=high|0});goog.math.Long.IntCache_={};goog.math.Long.fromInt=(function(value){if(-128<=value&&value<128){var cachedObj=goog.math.Long.IntCache_[value];if(cachedObj){return cachedObj}}var obj=new goog.math.Long(value|0,value<0?-1:0);if(-128<=value&&value<128){goog.math.Long.IntCache_[value]=obj}return obj});goog.math.Long.fromNumber=(function(value){if(isNaN(value)||!isFinite(value)){return goog.math.Long.ZERO}else if(value<=-goog.math.Long.TWO_PWR_63_DBL_){return goog.math.Long.MIN_VALUE}else if(value+1>=goog.math.Long.TWO_PWR_63_DBL_){return goog.math.Long.MAX_VALUE}else if(value<0){return goog.math.Long.fromNumber(-value).negate()}else{return new goog.math.Long(value%goog.math.Long.TWO_PWR_32_DBL_|0,value/goog.math.Long.TWO_PWR_32_DBL_|0)}});goog.math.Long.fromBits=(function(lowBits,highBits){return new goog.math.Long(lowBits,highBits)});goog.math.Long.fromString=(function(str,opt_radix){if(str.length==0){throw Error("number format error: empty string")}var radix=opt_radix||10;if(radix<2||36<radix){throw Error("radix out of range: "+radix)}if(str.charAt(0)=="-"){return goog.math.Long.fromString(str.substring(1),radix).negate()}else if(str.indexOf("-")>=0){throw Error('number format error: interior "-" character: '+str)}var radixToPower=goog.math.Long.fromNumber(Math.pow(radix,8));var result=goog.math.Long.ZERO;for(var i=0;i<str.length;i+=8){var size=Math.min(8,str.length-i);var value=parseInt(str.substring(i,i+size),radix);if(size<8){var power=goog.math.Long.fromNumber(Math.pow(radix,size));result=result.multiply(power).add(goog.math.Long.fromNumber(value))}else{result=result.multiply(radixToPower);result=result.add(goog.math.Long.fromNumber(value))}}return result});goog.math.Long.TWO_PWR_16_DBL_=1<<16;goog.math.Long.TWO_PWR_24_DBL_=1<<24;goog.math.Long.TWO_PWR_32_DBL_=goog.math.Long.TWO_PWR_16_DBL_*goog.math.Long.TWO_PWR_16_DBL_;goog.math.Long.TWO_PWR_31_DBL_=goog.math.Long.TWO_PWR_32_DBL_/2;goog.math.Long.TWO_PWR_48_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_16_DBL_;goog.math.Long.TWO_PWR_64_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_32_DBL_;goog.math.Long.TWO_PWR_63_DBL_=goog.math.Long.TWO_PWR_64_DBL_/2;goog.math.Long.ZERO=goog.math.Long.fromInt(0);goog.math.Long.ONE=goog.math.Long.fromInt(1);goog.math.Long.NEG_ONE=goog.math.Long.fromInt(-1);goog.math.Long.MAX_VALUE=goog.math.Long.fromBits(4294967295|0,2147483647|0);goog.math.Long.MIN_VALUE=goog.math.Long.fromBits(0,2147483648|0);goog.math.Long.TWO_PWR_24_=goog.math.Long.fromInt(1<<24);goog.math.Long.prototype.toInt=(function(){return this.low_});goog.math.Long.prototype.toNumber=(function(){return this.high_*goog.math.Long.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()});goog.math.Long.prototype.toString=(function(opt_radix){var radix=opt_radix||10;if(radix<2||36<radix){throw Error("radix out of range: "+radix)}if(this.isZero()){return"0"}if(this.isNegative()){if(this.equals(goog.math.Long.MIN_VALUE)){var radixLong=goog.math.Long.fromNumber(radix);var div=this.div(radixLong);var rem=div.multiply(radixLong).subtract(this);return div.toString(radix)+rem.toInt().toString(radix)}else{return"-"+this.negate().toString(radix)}}var radixToPower=goog.math.Long.fromNumber(Math.pow(radix,6));var rem=this;var result="";while(true){var remDiv=rem.div(radixToPower);var intval=rem.subtract(remDiv.multiply(radixToPower)).toInt();var digits=intval.toString(radix);rem=remDiv;if(rem.isZero()){return digits+result}else{while(digits.length<6){digits="0"+digits}result=""+digits+result}}});goog.math.Long.prototype.getHighBits=(function(){return this.high_});goog.math.Long.prototype.getLowBits=(function(){return this.low_});goog.math.Long.prototype.getLowBitsUnsigned=(function(){return this.low_>=0?this.low_:goog.math.Long.TWO_PWR_32_DBL_+this.low_});goog.math.Long.prototype.getNumBitsAbs=(function(){if(this.isNegative()){if(this.equals(goog.math.Long.MIN_VALUE)){return 64}else{return this.negate().getNumBitsAbs()}}else{var val=this.high_!=0?this.high_:this.low_;for(var bit=31;bit>0;bit--){if((val&1<<bit)!=0){break}}return this.high_!=0?bit+33:bit+1}});goog.math.Long.prototype.isZero=(function(){return this.high_==0&&this.low_==0});goog.math.Long.prototype.isNegative=(function(){return this.high_<0});goog.math.Long.prototype.isOdd=(function(){return(this.low_&1)==1});goog.math.Long.prototype.equals=(function(other){return this.high_==other.high_&&this.low_==other.low_});goog.math.Long.prototype.notEquals=(function(other){return this.high_!=other.high_||this.low_!=other.low_});goog.math.Long.prototype.lessThan=(function(other){return this.compare(other)<0});goog.math.Long.prototype.lessThanOrEqual=(function(other){return this.compare(other)<=0});goog.math.Long.prototype.greaterThan=(function(other){return this.compare(other)>0});goog.math.Long.prototype.greaterThanOrEqual=(function(other){return this.compare(other)>=0});goog.math.Long.prototype.compare=(function(other){if(this.equals(other)){return 0}var thisNeg=this.isNegative();var otherNeg=other.isNegative();if(thisNeg&&!otherNeg){return-1}if(!thisNeg&&otherNeg){return 1}if(this.subtract(other).isNegative()){return-1}else{return 1}});goog.math.Long.prototype.negate=(function(){if(this.equals(goog.math.Long.MIN_VALUE)){return goog.math.Long.MIN_VALUE}else{return this.not().add(goog.math.Long.ONE)}});goog.math.Long.prototype.add=(function(other){var a48=this.high_>>>16;var a32=this.high_&65535;var a16=this.low_>>>16;var a00=this.low_&65535;var b48=other.high_>>>16;var b32=other.high_&65535;var b16=other.low_>>>16;var b00=other.low_&65535;var c48=0,c32=0,c16=0,c00=0;c00+=a00+b00;c16+=c00>>>16;c00&=65535;c16+=a16+b16;c32+=c16>>>16;c16&=65535;c32+=a32+b32;c48+=c32>>>16;c32&=65535;c48+=a48+b48;c48&=65535;return goog.math.Long.fromBits(c16<<16|c00,c48<<16|c32)});goog.math.Long.prototype.subtract=(function(other){return this.add(other.negate())});goog.math.Long.prototype.multiply=(function(other){if(this.isZero()){return goog.math.Long.ZERO}else if(other.isZero()){return goog.math.Long.ZERO}if(this.equals(goog.math.Long.MIN_VALUE)){return other.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO}else if(other.equals(goog.math.Long.MIN_VALUE)){return this.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO}if(this.isNegative()){if(other.isNegative()){return this.negate().multiply(other.negate())}else{return this.negate().multiply(other).negate()}}else if(other.isNegative()){return this.multiply(other.negate()).negate()}if(this.lessThan(goog.math.Long.TWO_PWR_24_)&&other.lessThan(goog.math.Long.TWO_PWR_24_)){return goog.math.Long.fromNumber(this.toNumber()*other.toNumber())}var a48=this.high_>>>16;var a32=this.high_&65535;var a16=this.low_>>>16;var a00=this.low_&65535;var b48=other.high_>>>16;var b32=other.high_&65535;var b16=other.low_>>>16;var b00=other.low_&65535;var c48=0,c32=0,c16=0,c00=0;c00+=a00*b00;c16+=c00>>>16;c00&=65535;c16+=a16*b00;c32+=c16>>>16;c16&=65535;c16+=a00*b16;c32+=c16>>>16;c16&=65535;c32+=a32*b00;c48+=c32>>>16;c32&=65535;c32+=a16*b16;c48+=c32>>>16;c32&=65535;c32+=a00*b32;c48+=c32>>>16;c32&=65535;c48+=a48*b00+a32*b16+a16*b32+a00*b48;c48&=65535;return goog.math.Long.fromBits(c16<<16|c00,c48<<16|c32)});goog.math.Long.prototype.div=(function(other){if(other.isZero()){throw Error("division by zero")}else if(this.isZero()){return goog.math.Long.ZERO}if(this.equals(goog.math.Long.MIN_VALUE)){if(other.equals(goog.math.Long.ONE)||other.equals(goog.math.Long.NEG_ONE)){return goog.math.Long.MIN_VALUE}else if(other.equals(goog.math.Long.MIN_VALUE)){return goog.math.Long.ONE}else{var halfThis=this.shiftRight(1);var approx=halfThis.div(other).shiftLeft(1);if(approx.equals(goog.math.Long.ZERO)){return other.isNegative()?goog.math.Long.ONE:goog.math.Long.NEG_ONE}else{var rem=this.subtract(other.multiply(approx));var result=approx.add(rem.div(other));return result}}}else if(other.equals(goog.math.Long.MIN_VALUE)){return goog.math.Long.ZERO}if(this.isNegative()){if(other.isNegative()){return this.negate().div(other.negate())}else{return this.negate().div(other).negate()}}else if(other.isNegative()){return this.div(other.negate()).negate()}var res=goog.math.Long.ZERO;var rem=this;while(rem.greaterThanOrEqual(other)){var approx=Math.max(1,Math.floor(rem.toNumber()/other.toNumber()));var log2=Math.ceil(Math.log(approx)/Math.LN2);var delta=log2<=48?1:Math.pow(2,log2-48);var approxRes=goog.math.Long.fromNumber(approx);var approxRem=approxRes.multiply(other);while(approxRem.isNegative()||approxRem.greaterThan(rem)){approx-=delta;approxRes=goog.math.Long.fromNumber(approx);approxRem=approxRes.multiply(other)}if(approxRes.isZero()){approxRes=goog.math.Long.ONE}res=res.add(approxRes);rem=rem.subtract(approxRem)}return res});goog.math.Long.prototype.modulo=(function(other){return this.subtract(this.div(other).multiply(other))});goog.math.Long.prototype.not=(function(){return goog.math.Long.fromBits(~this.low_,~this.high_)});goog.math.Long.prototype.and=(function(other){return goog.math.Long.fromBits(this.low_&other.low_,this.high_&other.high_)});goog.math.Long.prototype.or=(function(other){return goog.math.Long.fromBits(this.low_|other.low_,this.high_|other.high_)});goog.math.Long.prototype.xor=(function(other){return goog.math.Long.fromBits(this.low_^other.low_,this.high_^other.high_)});goog.math.Long.prototype.shiftLeft=(function(numBits){numBits&=63;if(numBits==0){return this}else{var low=this.low_;if(numBits<32){var high=this.high_;return goog.math.Long.fromBits(low<<numBits,high<<numBits|low>>>32-numBits)}else{return goog.math.Long.fromBits(0,low<<numBits-32)}}});goog.math.Long.prototype.shiftRight=(function(numBits){numBits&=63;if(numBits==0){return this}else{var high=this.high_;if(numBits<32){var low=this.low_;return goog.math.Long.fromBits(low>>>numBits|high<<32-numBits,high>>numBits)}else{return goog.math.Long.fromBits(high>>numBits-32,high>=0?0:-1)}}});goog.math.Long.prototype.shiftRightUnsigned=(function(numBits){numBits&=63;if(numBits==0){return this}else{var high=this.high_;if(numBits<32){var low=this.low_;return goog.math.Long.fromBits(low>>>numBits|high<<32-numBits,high>>>numBits)}else if(numBits==32){return goog.math.Long.fromBits(high,0)}else{return goog.math.Long.fromBits(high>>>numBits-32,0)}}});var navigator={appName:"Modern Browser"};var dbits;var canary=0xdeadbeefcafe;var j_lm=(canary&16777215)==15715070;function BigInteger(a,b,c){if(a!=null)if("number"==typeof a)this.fromNumber(a,b,c);else if(b==null&&"string"!=typeof a)this.fromString(a,256);else this.fromString(a,b)}function nbi(){return new BigInteger(null)}function am1(i,x,w,j,c,n){while(--n>=0){var v=x*this[i++]+w[j]+c;c=Math.floor(v/67108864);w[j++]=v&67108863}return c}function am2(i,x,w,j,c,n){var xl=x&32767,xh=x>>15;while(--n>=0){var l=this[i]&32767;var h=this[i++]>>15;var m=xh*l+h*xl;l=xl*l+((m&32767)<<15)+w[j]+(c&1073741823);c=(l>>>30)+(m>>>15)+xh*h+(c>>>30);w[j++]=l&1073741823}return c}function am3(i,x,w,j,c,n){var xl=x&16383,xh=x>>14;while(--n>=0){var l=this[i]&16383;var h=this[i++]>>14;var m=xh*l+h*xl;l=xl*l+((m&16383)<<14)+w[j]+c;c=(l>>28)+(m>>14)+xh*h;w[j++]=l&268435455}return c}if(j_lm&&navigator.appName=="Microsoft Internet Explorer"){BigInteger.prototype.am=am2;dbits=30}else if(j_lm&&navigator.appName!="Netscape"){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=(1<<dbits)-1;BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz";var BI_RC=new Array;var rr,vv;rr="0".charCodeAt(0);for(vv=0;vv<=9;++vv)BI_RC[rr++]=vv;rr="a".charCodeAt(0);for(vv=10;vv<36;++vv)BI_RC[rr++]=vv;rr="A".charCodeAt(0);for(vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(n){return BI_RM.charAt(n)}function intAt(s,i){var c=BI_RC[s.charCodeAt(i)];return c==null?-1:c}function bnpCopyTo(r){for(var i=this.t-1;i>=0;--i)r[i]=this[i];r.t=this.t;r.s=this.s}function bnpFromInt(x){this.t=1;this.s=x<0?-1:0;if(x>0)this[0]=x;else if(x<-1)this[0]=x+DV;else this.t=0}function nbv(i){var r=nbi();r.fromInt(i);return r}function bnpFromString(s,b){var k;if(b==16)k=4;else if(b==8)k=3;else if(b==256)k=8;else if(b==2)k=1;else if(b==32)k=5;else if(b==4)k=2;else{this.fromRadix(s,b);return}this.t=0;this.s=0;var i=s.length,mi=false,sh=0;while(--i>=0){var x=k==8?s[i]&255:intAt(s,i);if(x<0){if(s.charAt(i)=="-")mi=true;continue}mi=false;if(sh==0)this[this.t++]=x;else if(sh+k>this.DB){this[this.t-1]|=(x&(1<<this.DB-sh)-1)<<sh;this[this.t++]=x>>this.DB-sh}else this[this.t-1]|=x<<sh;sh+=k;if(sh>=this.DB)sh-=this.DB}if(k==8&&(s[0]&128)!=0){this.s=-1;if(sh>0)this[this.t-1]|=(1<<this.DB-sh)-1<<sh}this.clamp();if(mi)BigInteger.ZERO.subTo(this,this)}function bnpClamp(){var c=this.s&this.DM;while(this.t>0&&this[this.t-1]==c)--this.t}function bnToString(b){if(this.s<0)return"-"+this.negate().toString(b);var k;if(b==16)k=4;else if(b==8)k=3;else if(b==2)k=1;else if(b==32)k=5;else if(b==4)k=2;else return this.toRadix(b);var km=(1<<k)-1,d,m=false,r="",i=this.t;var p=this.DB-i*this.DB%k;if(i-->0){if(p<this.DB&&(d=this[i]>>p)>0){m=true;r=int2char(d)}while(i>=0){if(p<k){d=(this[i]&(1<<p)-1)<<k-p;d|=this[--i]>>(p+=this.DB-k)}else{d=this[i]>>(p-=k)&km;if(p<=0){p+=this.DB;--i}}if(d>0)m=true;if(m)r+=int2char(d)}}return m?r:"0"}function bnNegate(){var r=nbi();BigInteger.ZERO.subTo(this,r);return r}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(a){var r=this.s-a.s;if(r!=0)return r;var i=this.t;r=i-a.t;if(r!=0)return this.s<0?-r:r;while(--i>=0)if((r=this[i]-a[i])!=0)return r;return 0}function nbits(x){var r=1,t;if((t=x>>>16)!=0){x=t;r+=16}if((t=x>>8)!=0){x=t;r+=8}if((t=x>>4)!=0){x=t;r+=4}if((t=x>>2)!=0){x=t;r+=2}if((t=x>>1)!=0){x=t;r+=1}return r}function bnBitLength(){if(this.t<=0)return 0;return this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(n,r){var i;for(i=this.t-1;i>=0;--i)r[i+n]=this[i];for(i=n-1;i>=0;--i)r[i]=0;r.t=this.t+n;r.s=this.s}function bnpDRShiftTo(n,r){for(var i=n;i<this.t;++i)r[i-n]=this[i];r.t=Math.max(this.t-n,0);r.s=this.s}function bnpLShiftTo(n,r){var bs=n%this.DB;var cbs=this.DB-bs;var bm=(1<<cbs)-1;var ds=Math.floor(n/this.DB),c=this.s<<bs&this.DM,i;for(i=this.t-1;i>=0;--i){r[i+ds+1]=this[i]>>cbs|c;c=(this[i]&bm)<<bs}for(i=ds-1;i>=0;--i)r[i]=0;r[ds]=c;r.t=this.t+ds+1;r.s=this.s;r.clamp()}function bnpRShiftTo(n,r){r.s=this.s;var ds=Math.floor(n/this.DB);if(ds>=this.t){r.t=0;return}var bs=n%this.DB;var cbs=this.DB-bs;var bm=(1<<bs)-1;r[0]=this[ds]>>bs;for(var i=ds+1;i<this.t;++i){r[i-ds-1]|=(this[i]&bm)<<cbs;r[i-ds]=this[i]>>bs}if(bs>0)r[this.t-ds-1]|=(this.s&bm)<<cbs;r.t=this.t-ds;r.clamp()}function bnpSubTo(a,r){var i=0,c=0,m=Math.min(a.t,this.t);while(i<m){c+=this[i]-a[i];r[i++]=c&this.DM;c>>=this.DB}if(a.t<this.t){c-=a.s;while(i<this.t){c+=this[i];r[i++]=c&this.DM;c>>=this.DB}c+=this.s}else{c+=this.s;while(i<a.t){c-=a[i];r[i++]=c&this.DM;c>>=this.DB}c-=a.s}r.s=c<0?-1:0;if(c<-1)r[i++]=this.DV+c;else if(c>0)r[i++]=c;r.t=i;r.clamp()}function bnpMultiplyTo(a,r){var x=this.abs(),y=a.abs();var i=x.t;r.t=i+y.t;while(--i>=0)r[i]=0;for(i=0;i<y.t;++i)r[i+x.t]=x.am(0,y[i],r,i,0,x.t);r.s=0;r.clamp();if(this.s!=a.s)BigInteger.ZERO.subTo(r,r)}function bnpSquareTo(r){var x=this.abs();var i=r.t=2*x.t;while(--i>=0)r[i]=0;for(i=0;i<x.t-1;++i){var c=x.am(i,x[i],r,2*i,0,1);if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1))>=x.DV){r[i+x.t]-=x.DV;r[i+x.t+1]=1}}if(r.t>0)r[r.t-1]+=x.am(i,x[i],r,2*i,0,1);r.s=0;r.clamp()}function bnpDivRemTo(m,q,r){var pm=m.abs();if(pm.t<=0)return;var pt=this.abs();if(pt.t<pm.t){if(q!=null)q.fromInt(0);if(r!=null)this.copyTo(r);return}if(r==null)r=nbi();var y=nbi(),ts=this.s,ms=m.s;var nsh=this.DB-nbits(pm[pm.t-1]);if(nsh>0){pm.lShiftTo(nsh,y);pt.lShiftTo(nsh,r)}else{pm.copyTo(y);pt.copyTo(r)}var ys=y.t;var y0=y[ys-1];if(y0==0)return;var yt=y0*(1<<this.F1)+(ys>1?y[ys-2]>>this.F2:0);var d1=this.FV/yt,d2=(1<<this.F1)/yt,e=1<<this.F2;var i=r.t,j=i-ys,t=q==null?nbi():q;y.dlShiftTo(j,t);if(r.compareTo(t)>=0){r[r.t++]=1;r.subTo(t,r)}BigInteger.ONE.dlShiftTo(ys,t);t.subTo(y,y);while(y.t<ys)y[y.t++]=0;while(--j>=0){var qd=r[--i]==y0?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);if((r[i]+=y.am(0,qd,r,j,0,ys))<qd){y.dlShiftTo(j,t);r.subTo(t,r);while(r[i]<--qd)r.subTo(t,r)}}if(q!=null){r.drShiftTo(ys,q);if(ts!=ms)BigInteger.ZERO.subTo(q,q)}r.t=ys;r.clamp();if(nsh>0)r.rShiftTo(nsh,r);if(ts<0)BigInteger.ZERO.subTo(r,r)}function bnMod(a){var r=nbi();this.abs().divRemTo(a,null,r);if(this.s<0&&r.compareTo(BigInteger.ZERO)>0)a.subTo(r,r);return r}function Classic(m){this.m=m}function cConvert(x){if(x.s<0||x.compareTo(this.m)>=0)return x.mod(this.m);else return x}function cRevert(x){return x}function cReduce(x){x.divRemTo(this.m,null,x)}function cMulTo(x,y,r){x.multiplyTo(y,r);this.reduce(r)}function cSqrTo(x,r){x.squareTo(r);this.reduce(r)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1)return 0;var x=this[0];if((x&1)==0)return 0;var y=x&3;y=y*(2-(x&15)*y)&15;y=y*(2-(x&255)*y)&255;y=y*(2-((x&65535)*y&65535))&65535;y=y*(2-x*y%this.DV)%this.DV;return y>0?this.DV-y:-y}function Montgomery(m){this.m=m;this.mp=m.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<m.DB-15)-1;this.mt2=2*m.t}function montConvert(x){var r=nbi();x.abs().dlShiftTo(this.m.t,r);r.divRemTo(this.m,null,r);if(x.s<0&&r.compareTo(BigInteger.ZERO)>0)this.m.subTo(r,r);return r}function montRevert(x){var r=nbi();x.copyTo(r);this.reduce(r);return r}function montReduce(x){while(x.t<=this.mt2)x[x.t++]=0;for(var i=0;i<this.m.t;++i){var j=x[i]&32767;var u0=j*this.mpl+((j*this.mph+(x[i]>>15)*this.mpl&this.um)<<15)&x.DM;j=i+this.m.t;x[j]+=this.m.am(0,u0,x,i,0,this.m.t);while(x[j]>=x.DV){x[j]-=x.DV;x[++j]++}}x.clamp();x.drShiftTo(this.m.t,x);if(x.compareTo(this.m)>=0)x.subTo(this.m,x)}function montSqrTo(x,r){x.squareTo(r);this.reduce(r)}function montMulTo(x,y,r){x.multiplyTo(y,r);this.reduce(r)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return(this.t>0?this[0]&1:this.s)==0}function bnpExp(e,z){if(e>4294967295||e<1)return BigInteger.ONE;var r=nbi(),r2=nbi(),g=z.convert(this),i=nbits(e)-1;g.copyTo(r);while(--i>=0){z.sqrTo(r,r2);if((e&1<<i)>0)z.mulTo(r2,g,r);else{var t=r;r=r2;r2=t}}return z.revert(r)}function bnModPowInt(e,m){var z;if(e<256||m.isEven())z=new Classic(m);else z=new Montgomery(m);return this.exp(e,z)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);function bnpFromRadix(s,b){this.fromInt(0);if(b==null)b=10;var cs=this.chunkSize(b);var d=Math.pow(b,cs),mi=false,j=0,w=0;for(var i=0;i<s.length;++i){var x=intAt(s,i);if(x<0){if(s.charAt(i)=="-"&&this.signum()==0)mi=true;continue}w=b*w+x;if(++j>=cs){this.dMultiply(d);this.dAddOffset(w,0);j=0;w=0}}if(j>0){this.dMultiply(Math.pow(b,j));this.dAddOffset(w,0)}if(mi)BigInteger.ZERO.subTo(this,this)}function bnpChunkSize(r){return Math.floor(Math.LN2*this.DB/Math.log(r))}function bnSigNum(){if(this.s<0)return-1;else if(this.t<=0||this.t==1&&this[0]<=0)return 0;else return 1}function bnpDMultiply(n){this[this.t]=this.am(0,n-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(n,w){if(n==0)return;while(this.t<=w)this[this.t++]=0;this[w]+=n;while(this[w]>=this.DV){this[w]-=this.DV;if(++w>=this.t)this[this.t++]=0;++this[w]}}function bnpToRadix(b){if(b==null)b=10;if(this.signum()==0||b<2||b>36)return"0";var cs=this.chunkSize(b);var a=Math.pow(b,cs);var d=nbv(a),y=nbi(),z=nbi(),r="";this.divRemTo(d,y,z);while(y.signum()>0){r=(a+z.intValue()).toString(b).substr(1)+r;y.divRemTo(d,y,z)}return z.intValue().toString(b)+r}function bnIntValue(){if(this.s<0){if(this.t==1)return this[0]-this.DV;else if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnpAddTo(a,r){var i=0,c=0,m=Math.min(a.t,this.t);while(i<m){c+=this[i]+a[i];r[i++]=c&this.DM;c>>=this.DB}if(a.t<this.t){c+=a.s;while(i<this.t){c+=this[i];r[i++]=c&this.DM;c>>=this.DB}c+=this.s}else{c+=this.s;while(i<a.t){c+=a[i];r[i++]=c&this.DM;c>>=this.DB}c+=a.s}r.s=c<0?-1:0;if(c>0)r[i++]=c;else if(c<-1)r[i++]=this.DV+c;r.t=i;r.clamp()}BigInteger.prototype.fromRadix=bnpFromRadix;BigInteger.prototype.chunkSize=bnpChunkSize;BigInteger.prototype.signum=bnSigNum;BigInteger.prototype.dMultiply=bnpDMultiply;BigInteger.prototype.dAddOffset=bnpDAddOffset;BigInteger.prototype.toRadix=bnpToRadix;BigInteger.prototype.intValue=bnIntValue;BigInteger.prototype.addTo=bnpAddTo;var Wrapper={abs:(function(l,h){var x=new goog.math.Long(l,h);var ret;if(x.isNegative()){ret=x.negate()}else{ret=x}HEAP32[tempDoublePtr>>2]=ret.low_;HEAP32[tempDoublePtr+4>>2]=ret.high_}),ensureTemps:(function(){if(Wrapper.ensuredTemps)return;Wrapper.ensuredTemps=true;Wrapper.two32=new BigInteger;Wrapper.two32.fromString("4294967296",10);Wrapper.two64=new BigInteger;Wrapper.two64.fromString("18446744073709551616",10);Wrapper.temp1=new BigInteger;Wrapper.temp2=new BigInteger}),lh2bignum:(function(l,h){var a=new BigInteger;a.fromString(h.toString(),10);var b=new BigInteger;a.multiplyTo(Wrapper.two32,b);var c=new BigInteger;c.fromString(l.toString(),10);var d=new BigInteger;c.addTo(b,d);return d}),stringify:(function(l,h,unsigned){var ret=(new goog.math.Long(l,h)).toString();if(unsigned&&ret[0]=="-"){Wrapper.ensureTemps();var bignum=new BigInteger;bignum.fromString(ret,10);ret=new BigInteger;Wrapper.two64.addTo(bignum,ret);ret=ret.toString(10)}return ret}),fromString:(function(str,base,min,max,unsigned){Wrapper.ensureTemps();var bignum=new BigInteger;bignum.fromString(str,base);var bigmin=new BigInteger;bigmin.fromString(min,10);var bigmax=new BigInteger;bigmax.fromString(max,10);if(unsigned&&bignum.compareTo(BigInteger.ZERO)<0){var temp=new BigInteger;bignum.addTo(Wrapper.two64,temp);bignum=temp}var error=false;if(bignum.compareTo(bigmin)<0){bignum=bigmin;error=true}else if(bignum.compareTo(bigmax)>0){bignum=bigmax;error=true}var ret=goog.math.Long.fromString(bignum.toString());HEAP32[tempDoublePtr>>2]=ret.low_;HEAP32[tempDoublePtr+4>>2]=ret.high_;if(error)throw"range error"})};return Wrapper})();if(memoryInitializer){if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=Module["readBinary"](memoryInitializer);HEAPU8.set(data,STATIC_BASE)}else{addRunDependency("memory initializer");Browser.asyncLoad(memoryInitializer,(function(data){HEAPU8.set(data,STATIC_BASE);removeRunDependency("memory initializer")}),(function(data){throw"could not load memory initializer "+memoryInitializer}))}}function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"]&&shouldRunNow)run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){assert(runDependencies==0,"cannot call main when async dependencies remain! (listen on __ATMAIN__)");assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called");args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString("/bin/this.program"),"i8",ALLOC_NORMAL)];pad();for(var i=0;i<argc-1;i=i+1){argv.push(allocate(intArrayFromString(args[i]),"i8",ALLOC_NORMAL));pad()}argv.push(0);argv=allocate(argv,"i32",ALLOC_NORMAL);initialStackTop=STACKTOP;try{var ret=Module["_main"](argc,argv,0);if(!Module["noExitRuntime"]){exit(ret)}}catch(e){if(e instanceof ExitStatus){return}else if(e=="SimulateInfiniteLoop"){Module["noExitRuntime"]=true;return}else{if(e&&typeof e==="object"&&e.stack)Module.printErr("exception thrown: "+[e,e.stack]);throw e}}finally{calledMain=true}};function run(args){args=args||Module["arguments"];if(preloadStartTime===null)preloadStartTime=Date.now();if(runDependencies>0){Module.printErr("run() called, but dependencies remain, so not running");return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;ensureInitRuntime();preMain();if(ENVIRONMENT_IS_WEB&&preloadStartTime!==null){Module.printErr("pre-main prep time: "+(Date.now()-preloadStartTime)+" ms")}if(Module["_main"]&&shouldRunNow){Module["callMain"](args)}postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);if(!ABORT)doRun()}),1)}else{doRun()}}Module["run"]=Module.run=run;function exit(status){ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();throw new ExitStatus(status)}Module["exit"]=Module.exit=exit;function abort(text){if(text){Module.print(text);Module.printErr(text)}ABORT=true;EXITSTATUS=1;var extra="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";throw"abort() at "+stackTrace()+extra}Module["abort"]=Module.abort=abort;var InternalError=Module["InternalError"]=extendError(Error,"InternalError");var BindingError=Module["BindingError"]=extendError(Error,"BindingError");var UnboundTypeError=Module["UnboundTypeError"]=extendError(BindingError,"UnboundTypeError");var PureVirtualError=Module["PureVirtualError"]=extendError(BindingError,"PureVirtualError");function throwInternalError(message){throw new InternalError(message)}function throwBindingError(message){throw new BindingError(message)}function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(message+": "+unboundTypes.map(getTypeName).join([", "]))}function ensureOverloadTable(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=(function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError("Function '"+humanName+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+proto[methodName].overloadTable+")!")}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)});proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '"+name+"' twice")}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments ("+numArguments+")!")}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value}}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,(function(message){this.name=errorName;this.message=message;var stack=(new Error(message)).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}}));errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=(function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}});return errorClass}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return(new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n"))(body)}function _embind_repr(v){var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}}var registeredInstances={};function getBasestPointer(class_,ptr){if(ptr===undefined){throwBindingError("ptr should not be undefined")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr}function registerInheritedInstance(class_,ptr,instance){ptr=getBasestPointer(class_,ptr);if(registeredInstances.hasOwnProperty(ptr)){throwBindingError("Tried to register registered instance: "+ptr)}else{registeredInstances[ptr]=instance}}function unregisterInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);if(registeredInstances.hasOwnProperty(ptr)){delete registeredInstances[ptr]}else{throwBindingError("Tried to unregister unregistered instance: "+ptr)}}function getInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]}function getInheritedInstanceCount(){return Object.keys(registeredInstances).length}Module["getInheritedInstanceCount"]=getInheritedInstanceCount;function getLiveInheritedInstances(){var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv}Module["getLiveInheritedInstances"]=getLiveInheritedInstances;var registeredTypes={};var awaitingDependencies={};var typeDependencies={};var registeredPointers={};function registerType(rawType,registeredInstance){if(!("argPackAdvance"in registeredInstance)){throw new TypeError("registerType registeredInstance requires argPackAdvance")}var name=registeredInstance.name;if(!rawType){throwBindingError('type "'+name+'" must have a positive integer typeid pointer')}if(registeredTypes.hasOwnProperty(rawType)){throwBindingError("Cannot register type '"+name+"' twice")}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach((function(cb){cb()}))}}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach((function(type){typeDependencies[type]=dependentTypes}));function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i])}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach((function(dt,i){if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push((function(){typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}}))}}));if(0===unregisteredTypes.length){onComplete(typeConverters)}}var __charCodes=(function(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}return codes})();function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=__charCodes[HEAPU8[c++]]}return ret}function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv}function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i<count;i++){array.push(HEAP32[(firstElement>>2)+i])}return array}function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(humanName+" has unknown type "+getTypeName(rawType))}return impl}function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"argPackAdvance":0,"fromWireType":(function(){return undefined}),"toWireType":(function(destructors,o){return undefined})})}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(wt){return!!wt}),"toWireType":(function(destructors,o){return o?trueValue:falseValue}),"argPackAdvance":8,"readValueFromPointer":(function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError("Unknown boolean type size: "+name)}return this["fromWireType"](heap[pointer>>shift])}),destructorFunction:null})}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return(function(pointer){var heap=signed?HEAP8:HEAPU8;return this["fromWireType"](heap[pointer])});case 1:return(function(pointer){var heap=signed?HEAP16:HEAPU16;return this["fromWireType"](heap[pointer>>1])});case 2:return(function(pointer){var heap=signed?HEAP32:HEAPU32;return this["fromWireType"](heap[pointer>>2])});default:throw new TypeError("Unknown integer type: "+name)}}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return(function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])});case 3:return(function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])});default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);registerType(primitiveType,{name:name,"fromWireType":(function(value){return value}),"toWireType":(function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}if(value<minRange||value>maxRange){throw new TypeError('Passing a number "'+_embind_repr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+", "+maxRange+"]!")}return value|0}),"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(value){return value}),"toWireType":(function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}return value}),"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}function __embind_register_std_string(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(value){var length=HEAPU32[value>>2];var a=new Array(length);for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAPU8[value+4+i])}_free(value);return a.join("")}),"toWireType":(function(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value)}function getTAElement(ta,index){return ta[index]}function getStringElement(string,index){return string.charCodeAt(index)}var getElement;if(value instanceof Uint8Array){getElement=getTAElement}else if(value instanceof Int8Array){getElement=getTAElement}else if(typeof value==="string"){getElement=getStringElement}else{throwBindingError("Cannot pass non-string to std::string")}var length=value.length;var ptr=_malloc(4+length);HEAPU32[ptr>>2]=length;for(var i=0;i<length;++i){var charCode=getElement(value,i);if(charCode>255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+4+i]=charCode}if(destructors!==null){destructors.push(_free,ptr)}return ptr}),"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:(function(ptr){_free(ptr)})})}function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var HEAP,shift;if(charSize===2){HEAP=HEAPU16;shift=1}else if(charSize===4){HEAP=HEAPU32;shift=2}registerType(rawType,{name:name,"fromWireType":(function(value){var length=HEAPU32[value>>2];var a=new Array(length);var start=value+4>>shift;for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAP[start+i])}_free(value);return a.join("")}),"toWireType":(function(destructors,value){var length=value.length;var ptr=_malloc(4+length*charSize);HEAPU32[ptr>>2]=length;var start=ptr+4>>shift;for(var i=0;i<length;++i){HEAP[start+i]=value.charCodeAt(i)}if(destructors!==null){destructors.push(_free,ptr)}return ptr}),"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:(function(ptr){_free(ptr)})})}function __embind_register_emval(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(handle){var rv=_emval_handle_array[handle].value;__emval_decref(handle);return rv}),"toWireType":(function(destructors,value){return __emval_register(value)}),"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:null})}function __embind_register_memory_view(rawType,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(handle){var type=HEAPU32[handle>>2];var size=HEAPU32[(handle>>2)+1];var data=HEAPU32[(handle>>2)+2];var TA=typeMapping[type];return new TA(HEAP8.buffer,data,size)}),"argPackAdvance":16,"readValueFromPointer":(function(ptr){return this["fromWireType"](ptr)})})}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function")}var dummy=createNamedFunction(constructor.name,(function(){}));dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var argsList="";var argsListWired="";for(var i=0;i<argCount-2;++i){argsList+=(i!==0?", ":"")+"arg"+i;argsListWired+=(i!==0?", ":"")+"arg"+i+"Wired"}var invokerFnBody="return function "+makeLegalFunctionName(humanName)+"("+argsList+") {\n"+"if (arguments.length !== "+(argCount-2)+") {\n"+"throwBindingError('function "+humanName+" called with ' + arguments.length + ' arguments, expected "+(argCount-2)+" args!');\n"+"}\n";var needsDestructorStack=false;for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){needsDestructorStack=true;break}}if(needsDestructorStack){invokerFnBody+="var destructors = [];\n"}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["throwBindingError","invoker","fn","runDestructors","retType","classParam"];var args2=[throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];if(isClassMethodFunc){invokerFnBody+="var thisWired = classParam.toWireType("+dtorStack+", this);\n"}for(var i=0;i<argCount-2;++i){invokerFnBody+="var arg"+i+"Wired = argType"+i+".toWireType("+dtorStack+", arg"+i+"); // "+argTypes[i+2].name+"\n";args1.push("argType"+i);args2.push(argTypes[i+2])}if(isClassMethodFunc){argsListWired="thisWired"+(argsListWired.length>0?", ":"")+argsListWired}var returns=argTypes[0].name!=="void";invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+=paramName+"_dtor("+paramName+"); // "+argTypes[i].name+"\n";args1.push(paramName+"_dtor");args2.push(argTypes[i].destructorFunction)}}}if(returns){invokerFnBody+="return retType.fromWireType(rv);\n"}invokerFnBody+="}\n";args1.push(invokerFnBody);var invokerFunction=new_(Function,args1).apply(null,args2);return invokerFunction}function requireFunction(signature,rawFunction){signature=readLatin1String(signature);var fp;if(typeof FUNCTION_TABLE==="undefined"){var dc=asm["dynCall_"+signature];if(dc===undefined){dc=asm["dynCall_"+signature.replace(/f/g,"d")];if(dc===undefined){throwBindingError("No dynCall invoker for signature: "+signature)}}fp=dc.bind(undefined,rawFunction)}else{fp=FUNCTION_TABLE[rawFunction]}if(typeof fp!=="function"){throwBindingError("unknown function pointer with signature "+signature+": "+rawFunction)}return fp}function __embind_register_function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);rawInvoker=requireFunction(signature,rawInvoker);exposePublicSymbol(name,(function(){throwUnboundTypeError("Cannot call "+name+" due to unbound types",argTypes)}),argCount-1);whenDependentTypesAreResolved([],argTypes,(function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn),argCount-1);return[]}))}var tupleRegistrations={};function __embind_register_value_array(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){tupleRegistrations[rawType]={name:readLatin1String(name),rawConstructor:requireFunction(constructorSignature,rawConstructor),rawDestructor:requireFunction(destructorSignature,rawDestructor),elements:[]}}function __embind_register_value_array_element(rawTupleType,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){tupleRegistrations[rawTupleType].elements.push({getterReturnType:getterReturnType,getter:requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:requireFunction(setterSignature,setter),setterContext:setterContext})}function __embind_finalize_value_array(rawTupleType){var reg=tupleRegistrations[rawTupleType];delete tupleRegistrations[rawTupleType];var elements=reg.elements;var elementsLength=elements.length;var elementTypes=elements.map((function(elt){return elt.getterReturnType})).concat(elements.map((function(elt){return elt.setterArgumentType})));var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;whenDependentTypesAreResolved([rawTupleType],elementTypes,(function(elementTypes){elements.forEach((function(elt,i){var getterReturnType=elementTypes[i];var getter=elt.getter;var getterContext=elt.getterContext;var setterArgumentType=elementTypes[i+elementsLength];var setter=elt.setter;var setterContext=elt.setterContext;elt.read=(function(ptr){return getterReturnType["fromWireType"](getter(getterContext,ptr))});elt.write=(function(ptr,o){var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors)})}));return[{name:reg.name,"fromWireType":(function(ptr){var rv=new Array(elementsLength);for(var i=0;i<elementsLength;++i){rv[i]=elements[i].read(ptr)}rawDestructor(ptr);return rv}),"toWireType":(function(destructors,o){if(elementsLength!==o.length){throw new TypeError("Incorrect number of tuple elements for "+reg.name+": expected="+elementsLength+", actual="+o.length)}var ptr=rawConstructor();for(var i=0;i<elementsLength;++i){elements[i].write(ptr,o[i])}if(destructors!==null){destructors.push(rawDestructor,ptr)}return ptr}),"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:rawDestructor}]}))}var structRegistrations={};function __embind_register_value_object(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:requireFunction(constructorSignature,rawConstructor),rawDestructor:requireFunction(destructorSignature,rawDestructor),fields:[]}}function __embind_register_value_object_field(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:requireFunction(setterSignature,setter),setterContext:setterContext})}function __embind_finalize_value_object(structType){var reg=structRegistrations[structType];delete structRegistrations[structType];var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;var fieldRecords=reg.fields;var fieldTypes=fieldRecords.map((function(field){return field.getterReturnType})).concat(fieldRecords.map((function(field){return field.setterArgumentType})));whenDependentTypesAreResolved([structType],fieldTypes,(function(fieldTypes){var fields={};fieldRecords.forEach((function(field,i){var fieldName=field.fieldName;var getterReturnType=fieldTypes[i];var getter=field.getter;var getterContext=field.getterContext;var setterArgumentType=fieldTypes[i+fieldRecords.length];var setter=field.setter;var setterContext=field.setterContext;fields[fieldName]={read:(function(ptr){return getterReturnType["fromWireType"](getter(getterContext,ptr))}),write:(function(ptr,o){var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors)})}}));return[{name:reg.name,"fromWireType":(function(ptr){var rv={};for(var i in fields){rv[i]=fields[i].read(ptr)}rawDestructor(ptr);return rv}),"toWireType":(function(destructors,o){for(var fieldName in fields){if(!(fieldName in o)){throw new TypeError("Missing field")}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName])}if(destructors!==null){destructors.push(rawDestructor,ptr)}return ptr}),"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:rawDestructor}]}))}var genericPointerToWireType=(function(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}if(this.isSmartPointer){var ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError("Passing raw pointer to smart pointer is illegal")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle["clone"]();ptr=this.rawShare(ptr,__emval_register((function(){clonedHandle["delete"]()})));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError("Unsupporting sharing policy")}}return ptr});var constNoSmartPtrRawPointerToWireType=(function(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr});var nonConstNoSmartPtrRawPointerToWireType=(function(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+handle.$$.ptrType.name+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr});function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this["toWireType"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this["toWireType"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this["toWireType"]=genericPointerToWireType}}RegisteredPointer.prototype.getPointee=function getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr};RegisteredPointer.prototype.destructor=function destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}};RegisteredPointer.prototype["argPackAdvance"]=8;RegisteredPointer.prototype["readValueFromPointer"]=simpleReadValueFromPointer;RegisteredPointer.prototype["deleteObject"]=function deleteObject(handle){if(handle!==null){handle["delete"]()}};RegisteredPointer.prototype["fromWireType"]=function fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance["clone"]()}else{var rv=registeredInstance["clone"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}};function makeClassHandle(prototype,record){if(!record.ptrType||!record.ptr){throwInternalError("makeClassHandle requires ptr and ptrType")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError("Both smartPtrType and smartPtr must be specified")}record.count={value:1};return Object.create(prototype,{$$:{value:record}})}function ClassHandle(){}function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}ClassHandle.prototype["isAliasOf"]=function isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right};function throwInstanceAlreadyDeleted(obj){throwBindingError(getInstanceTypeName(obj)+" instance already deleted")}ClassHandle.prototype["clone"]=function clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopy(this.$$)}});clone.$$.count.value+=1;return clone}};function runDestructor(handle){var $$=handle.$$;if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}}ClassHandle.prototype["delete"]=function ClassHandle_delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}this.$$.count.value-=1;var toDelete=0===this.$$.count.value;if(toDelete){runDestructor(this)}if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}};var deletionQueue=[];ClassHandle.prototype["isDeleted"]=function isDeleted(){return!this.$$.ptr};ClassHandle.prototype["deleteLater"]=function deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this};function flushPendingDeletes(){while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj["delete"]()}}Module["flushPendingDeletes"]=flushPendingDeletes;var delayFunction;Module["setDelayFunction"]=function setDelayFunction(fn){delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}};function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}function shallowCopy(o){var rv={};for(var k in o){if(Object.prototype.hasOwnProperty.call(o,k)){rv[k]=o[k]}}return rv}function __embind_register_class(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor){name=readLatin1String(name);getActualType=requireFunction(getActualTypeSignature,getActualType);if(upcast){upcast=requireFunction(upcastSignature,upcast)}if(downcast){downcast=requireFunction(downcastSignature,downcast)}rawDestructor=requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,(function(){throwUnboundTypeError("Cannot construct "+name+" due to unbound types",[baseClassRawType])}));whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],(function(base){base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(legalFunctionName,(function(){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError("Use 'new' to construct "+name)}if(undefined===registeredClass.constructor_body){throw new BindingError(name+" has no accessible constructor")}var body=registeredClass.constructor_body[arguments.length];if(undefined===body){throw new BindingError("Tried to invoke ctor of "+name+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(registeredClass.constructor_body).toString()+") parameters instead!")}return body.apply(this,arguments)}));var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+"*",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+" const*",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]}))}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],(function(classType){classType=classType[0];var humanName="constructor "+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!")}classType.registeredClass.constructor_body[argCount-1]=function unboundTypeHandler(){throwUnboundTypeError("Cannot construct "+classType.name+" due to unbound types",rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,(function(argTypes){classType.registeredClass.constructor_body[argCount-1]=function constructor_body(){if(arguments.length!==argCount-1){throwBindingError(humanName+" called with "+arguments.length+" arguments, expected "+(argCount-1))}var destructors=[];var args=new Array(argCount);args[0]=rawConstructor;for(var i=1;i<argCount;++i){args[i]=argTypes[i]["toWireType"](destructors,arguments[i-1])}var ptr=invoker.apply(null,args);runDestructors(destructors);return argTypes[0]["fromWireType"](ptr)};return[]}));return[]}))}function downcastPointer(ptr,ptrClass,desiredClass){if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)}function upcastPointer(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError("Expected null or instance of "+desiredClass.name+", got an instance of "+ptrClass.name)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}function validateThis(this_,classType,humanName){if(!(this_ instanceof Object)){throwBindingError(humanName+' with invalid "this": '+this_)}if(!(this_ instanceof classType.registeredClass.constructor)){throwBindingError(humanName+' incompatible with "this" of type '+this_.constructor.name)}if(!this_.$$.ptr){throwBindingError("cannot call emscripten binding method "+humanName+" on deleted object")}return upcastPointer(this_.$$.ptr,this_.$$.ptrType.registeredClass,classType.registeredClass)}function __embind_register_class_function(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,context,isPureVirtual){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=readLatin1String(methodName);rawInvoker=requireFunction(invokerSignature,rawInvoker);whenDependentTypesAreResolved([],[rawClassType],(function(classType){classType=classType[0];var humanName=classType.name+"."+methodName;if(isPureVirtual){classType.registeredClass.pureVirtualFunctions.push(methodName)}function unboundTypesHandler(){throwUnboundTypeError("Cannot call "+humanName+" due to unbound types",rawArgTypes)}var proto=classType.registeredClass.instancePrototype;var method=proto[methodName];if(undefined===method||undefined===method.overloadTable&&method.className!==classType.name&&method.argCount===argCount-2){unboundTypesHandler.argCount=argCount-2;unboundTypesHandler.className=classType.name;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-2]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,(function(argTypes){var memberFunction=craftInvokerFunction(humanName,argTypes,classType,rawInvoker,context);if(undefined===proto[methodName].overloadTable){proto[methodName]=memberFunction}else{proto[methodName].overloadTable[argCount-2]=memberFunction}return[]}));return[]}))}function __embind_register_class_property(classType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){fieldName=readLatin1String(fieldName);getter=requireFunction(getterSignature,getter);whenDependentTypesAreResolved([],[classType],(function(classType){classType=classType[0];var humanName=classType.name+"."+fieldName;var desc={get:(function(){throwUnboundTypeError("Cannot access "+humanName+" due to unbound types",[getterReturnType,setterArgumentType])}),enumerable:true,configurable:true};if(setter){desc.set=(function(){throwUnboundTypeError("Cannot access "+humanName+" due to unbound types",[getterReturnType,setterArgumentType])})}else{desc.set=(function(v){throwBindingError(humanName+" is a read-only property")})}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);whenDependentTypesAreResolved([],setter?[getterReturnType,setterArgumentType]:[getterReturnType],(function(types){var getterReturnType=types[0];var desc={get:(function(){var ptr=validateThis(this,classType,humanName+" getter");return getterReturnType["fromWireType"](getter(getterContext,ptr))}),enumerable:true};if(setter){setter=requireFunction(setterSignature,setter);var setterArgumentType=types[1];desc.set=(function(v){var ptr=validateThis(this,classType,humanName+" setter");var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,v));runDestructors(destructors)})}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);return[]}));return[]}))}function __embind_register_class_class_function(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,fn){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=readLatin1String(methodName);rawInvoker=requireFunction(invokerSignature,rawInvoker);whenDependentTypesAreResolved([],[rawClassType],(function(classType){classType=classType[0];var humanName=classType.name+"."+methodName;function unboundTypesHandler(){throwUnboundTypeError("Cannot call "+humanName+" due to unbound types",rawArgTypes)}var proto=classType.registeredClass.constructor;if(undefined===proto[methodName]){unboundTypesHandler.argCount=argCount-1;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-1]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,(function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));var func=craftInvokerFunction(humanName,invokerArgsArray,null,rawInvoker,fn);if(undefined===proto[methodName].overloadTable){proto[methodName]=func}else{proto[methodName].overloadTable[argCount-1]=func}return[]}));return[]}))}function __embind_create_inheriting_constructor(constructorName,wrapperType,properties){constructorName=readLatin1String(constructorName);wrapperType=requireRegisteredType(wrapperType,"wrapper");properties=requireHandle(properties);var arraySlice=[].slice;var registeredClass=wrapperType.registeredClass;var wrapperPrototype=registeredClass.instancePrototype;var baseClass=registeredClass.baseClass;var baseClassPrototype=baseClass.instancePrototype;var baseConstructor=registeredClass.baseClass.constructor;var ctor=createNamedFunction(constructorName,(function(){registeredClass.baseClass.pureVirtualFunctions.forEach((function(name){if(this[name]===baseClassPrototype[name]){throw new PureVirtualError("Pure virtual function "+name+" must be implemented in JavaScript")}}).bind(this));Object.defineProperty(this,"__parent",{value:wrapperPrototype});this.__construct.apply(this,arraySlice.call(arguments))}));wrapperPrototype.__construct=function __construct(){if(this===wrapperPrototype){throwBindingError("Pass correct 'this' to __construct")}var inner=baseConstructor.implement.apply(undefined,[this].concat(arraySlice.call(arguments)));var $$=inner.$$;inner.notifyOnDestruction();$$.preservePointerOnDelete=true;Object.defineProperty(this,"$$",{value:$$});registerInheritedInstance(registeredClass,$$.ptr,this)};wrapperPrototype.__destruct=function __destruct(){if(this===wrapperPrototype){throwBindingError("Pass correct 'this' to __destruct")}unregisterInheritedInstance(registeredClass,this.$$.ptr)};ctor.prototype=Object.create(wrapperPrototype);for(var p in properties){ctor.prototype[p]=properties[p]}return __emval_register(ctor)}var char_0="0".charCodeAt(0);var char_9="9".charCodeAt(0);function makeLegalFunctionName(name){name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}else{return name}}function __embind_register_smart_ptr(rawType,rawPointeeType,name,sharingPolicy,getPointeeSignature,rawGetPointee,constructorSignature,rawConstructor,shareSignature,rawShare,destructorSignature,rawDestructor){name=readLatin1String(name);rawGetPointee=requireFunction(getPointeeSignature,rawGetPointee);rawConstructor=requireFunction(constructorSignature,rawConstructor);rawShare=requireFunction(shareSignature,rawShare);rawDestructor=requireFunction(destructorSignature,rawDestructor);whenDependentTypesAreResolved([rawType],[rawPointeeType],(function(pointeeType){pointeeType=pointeeType[0];var registeredPointer=new RegisteredPointer(name,pointeeType.registeredClass,false,false,true,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor);return[registeredPointer]}))}function __embind_register_enum(rawType,name,size,isSigned){var shift=getShiftFromSize(size);name=readLatin1String(name);function constructor(){}constructor.values={};registerType(rawType,{name:name,constructor:constructor,"fromWireType":(function(c){return this.constructor.values[c]}),"toWireType":(function(destructors,c){return c.value}),"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,isSigned),destructorFunction:null});exposePublicSymbol(name,constructor)}function __embind_register_enum_value(rawEnumType,name,enumValue){var enumType=requireRegisteredType(rawEnumType,"enum");name=readLatin1String(name);var Enum=enumType.constructor;var Value=Object.create(enumType.constructor.prototype,{value:{value:enumValue},constructor:{value:createNamedFunction(enumType.name+"_"+name,(function(){}))}});Enum.values[enumValue]=Value;Enum[name]=Value}function __embind_register_constant(name,type,value){name=readLatin1String(name);whenDependentTypesAreResolved([],[type],(function(type){type=type[0];Module[name]=type["fromWireType"](value);return[]}))}var Module=Module||{};var _emval_handle_array=[{}];var _emval_free_list=[];Module.count_emval_handles=(function(){var count=0;for(var i=1;i<_emval_handle_array.length;++i){if(_emval_handle_array[i]!==undefined){++count}}return count});Module.get_first_emval=(function(){for(var i=1;i<_emval_handle_array.length;++i){if(_emval_handle_array[i]!==undefined){return _emval_handle_array[i]}}return null});var _emval_symbols={};function __emval_register_symbol(address){_emval_symbols[address]=readLatin1String(address)}function getStringOrSymbol(address){var symbol=_emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}else{return symbol}}function requireHandle(handle){if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}return _emval_handle_array[handle].value}function __emval_register(value){var handle=_emval_free_list.length?_emval_free_list.pop():_emval_handle_array.length;_emval_handle_array[handle]={refcount:1,value:value};return handle}function __emval_incref(handle){if(handle){_emval_handle_array[handle].refcount+=1}}function __emval_decref(handle){if(handle&&0===--_emval_handle_array[handle].refcount){_emval_handle_array[handle]=undefined;_emval_free_list.push(handle)}}function __emval_run_destructors(handle){var destructors=_emval_handle_array[handle].value;runDestructors(destructors);__emval_decref(handle)}function __emval_new_array(){return __emval_register([])}function __emval_new_object(){return __emval_register({})}function __emval_undefined(){return __emval_register(undefined)}function __emval_null(){return __emval_register(null)}function __emval_new_cstring(v){return __emval_register(getStringOrSymbol(v))}function __emval_take_value(type,argv){type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](argv);return __emval_register(v)}var __newers={};function craftEmvalAllocator(argCount){var argsList="";for(var i=0;i<argCount;++i){argsList+=(i!==0?", ":"")+"arg"+i}var functionBody="return function emval_allocator_"+argCount+"(constructor, argTypes, args) {\n";for(var i=0;i<argCount;++i){functionBody+="var argType"+i+" = requireRegisteredType(HEAP32[(argTypes >> 2) + "+i+'], "parameter '+i+'");\n'+"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+"args += argType"+i+".argPackAdvance;\n"}functionBody+="var obj = new constructor("+argsList+");\n"+"return __emval_register(obj);\n"+"}\n";return(new Function("requireRegisteredType","HEAP32","__emval_register",functionBody))(requireRegisteredType,HEAP32,__emval_register)}function __emval_new(handle,argCount,argTypes,args){handle=requireHandle(handle);var newer=__newers[argCount];if(!newer){newer=craftEmvalAllocator(argCount);__newers[argCount]=newer}return newer(handle,argTypes,args)}var global=(function(){return Function})()("return this")();function __emval_get_global(name){name=getStringOrSymbol(name);return __emval_register(global[name])}function __emval_get_module_property(name){name=getStringOrSymbol(name);return __emval_register(Module[name])}function __emval_get_property(handle,key){handle=requireHandle(handle);key=requireHandle(key);return __emval_register(handle[key])}function __emval_set_property(handle,key,value){handle=requireHandle(handle);key=requireHandle(key);value=requireHandle(value);handle[key]=value}function __emval_as(handle,returnType,destructorsRef){handle=requireHandle(handle);returnType=requireRegisteredType(returnType,"emval::as");var destructors=[];var rd=__emval_register(destructors);HEAP32[destructorsRef>>2]=rd;return returnType["toWireType"](destructors,handle)}function __emval_call(handle,argCount,argTypes,argv){handle=requireHandle(handle);var types=lookupTypes(argCount,argTypes);var args=new Array(argCount);for(var i=0;i<argCount;++i){var type=types[i];args[i]=type["readValueFromPointer"](argv);argv+=type.argPackAdvance}var rv=handle.apply(undefined,args);return __emval_register(rv)}function lookupTypes(argCount,argTypes,argWireTypes){var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAP32[(argTypes>>2)+i],"parameter "+i)}return a}function allocateDestructors(destructorsRef){var destructors=[];HEAP32[destructorsRef>>2]=__emval_register(destructors);return destructors}var methodCallers=[undefined];function addMethodCaller(caller){var id=methodCallers.length;methodCallers.push(caller);return id}function __emval_get_method_caller(argCount,argTypes){var types=lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+"_$"+types.slice(1).map((function(t){return t.name})).join("_")+"$";var params=["retType"];var args=[retType];var argsList="";for(var i=0;i<argCount-1;++i){argsList+=(i!==0?", ":"")+"arg"+i;params.push("argType"+i);args.push(types[1+i])}var functionBody="return function (handle, name, destructors, args) {\n";for(var i=0;i<argCount-1;++i){functionBody+=" var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+" args += argType"+i+".argPackAdvance;\n"}functionBody+=" var rv = handle[name]("+argsList+");\n";for(var i=0;i<argCount-1;++i){if(types[i+1]["deleteObject"]){functionBody+=" argType"+i+".deleteObject(arg"+i+");\n"}}functionBody+=" return retType.toWireType(destructors, rv);\n"+"};\n";params.push(functionBody);var invokerFunction=new_(Function,params).apply(null,args);return addMethodCaller(createNamedFunction(signatureName,invokerFunction))}function __emval_call_method(caller,handle,methodName,destructorsRef,args){caller=methodCallers[caller];handle=requireHandle(handle);methodName=getStringOrSymbol(methodName);return caller(handle,methodName,allocateDestructors(destructorsRef),args)}function __emval_has_function(handle,name,classType){handle=requireHandle(handle);name=getStringOrSymbol(name);classType=requireRegisteredType(classType,"class wrapper filter");var filter=classType.registeredClass.instancePrototype[name];return handle[name]instanceof Function&&(filter===undefined||handle[name]!==filter)}function __emval_typeof(handle){handle=requireHandle(handle);return __emval_register(typeof handle)}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"]){shouldRunNow=false}run() - - - - diff --git a/libs/plasio/vendor/loaders/BinaryLoader.js b/libs/plasio/vendor/loaders/BinaryLoader.js deleted file mode 100644 index fe4c73f8..00000000 --- a/libs/plasio/vendor/loaders/BinaryLoader.js +++ /dev/null @@ -1,792 +0,0 @@ -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.BinaryLoader = function ( showStatus ) { - - THREE.Loader.call( this, showStatus ); - -}; - -THREE.BinaryLoader.prototype = Object.create( THREE.Loader.prototype ); - -// Load models generated by slim OBJ converter with BINARY option (converter_obj_three_slim.py -t binary) -// - binary models consist of two files: JS and BIN -// - parameters -// - url (required) -// - callback (required) -// - texturePath (optional: if not specified, textures will be assumed to be in the same folder as JS model file) -// - binaryPath (optional: if not specified, binary file will be assumed to be in the same folder as JS model file) - -THREE.BinaryLoader.prototype.load = function ( url, callback, texturePath, binaryPath, progressCB ) { - - // todo: unify load API to for easier SceneLoader use - - texturePath = texturePath || this.extractUrlBase( url ); - binaryPath = binaryPath || this.extractUrlBase( url ); - - var callbackProgress = progressCB; - - this.onLoadStart(); - - // #1 load JS part via web worker - - this.loadAjaxJSON( this, url, callback, texturePath, binaryPath, callbackProgress ); - -}; - -THREE.BinaryLoader.prototype.loadAjaxJSON = function ( context, url, callback, texturePath, binaryPath, callbackProgress ) { - - var xhr = new XMLHttpRequest(); - - texturePath = texturePath && ( typeof texturePath === "string" ) ? texturePath : this.extractUrlBase( url ); - binaryPath = binaryPath && ( typeof binaryPath === "string" ) ? binaryPath : this.extractUrlBase( url ); - - xhr.onreadystatechange = function () { - - if ( xhr.readyState == 4 ) { - - if ( xhr.status == 200 || xhr.status == 0 ) { - - var json = JSON.parse( xhr.responseText ); - context.loadAjaxBuffers( json, callback, binaryPath, texturePath, callbackProgress ); - - } else { - - console.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" ); - - } - - } - - }; - - xhr.open( "GET", url, true ); - xhr.send( null ); - -}; - -THREE.BinaryLoader.prototype.loadAjaxBuffers = function ( json, callback, binaryPath, texturePath, callbackProgress ) { - - var xhr = new XMLHttpRequest(), - url = binaryPath + json.buffers; - - xhr.addEventListener( 'load', function ( event ) { - - var buffer = xhr.response; - - if ( buffer === undefined ) { - - // IEWEBGL needs this - buffer = ( new Uint8Array( xhr.responseBody ) ).buffer; - - } - - if ( buffer.byteLength == 0 ) { // iOS and other XMLHttpRequest level 1 - - var buffer = new ArrayBuffer( xhr.responseText.length ); - - var bufView = new Uint8Array( buffer ); - - for ( var i = 0, l = xhr.responseText.length; i < l; i ++ ) { - - bufView[ i ] = xhr.responseText.charCodeAt( i ) & 0xff; - - } - - } - - THREE.BinaryLoader.prototype.createBinModel( buffer, callback, texturePath, json.materials ); - - }, false ); - - if ( callbackProgress !== undefined ) { - - xhr.addEventListener( 'progress', function ( event ) { - - if ( event.lengthComputable ) { - - callbackProgress( event ); - - } - - }, false ); - - } - - xhr.addEventListener( 'error', function ( event ) { - - console.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" ); - - }, false ); - - - xhr.open( "GET", url, true ); - xhr.responseType = "arraybuffer"; - if ( xhr.overrideMimeType ) xhr.overrideMimeType( "text/plain; charset=x-user-defined" ); - xhr.send( null ); - -}; - -// Binary AJAX parser - -THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texturePath, jsonMaterials ) { - - var Model = function ( texturePath ) { - - var scope = this, - currentOffset = 0, - md, - normals = [], - uvs = [], - start_tri_flat, start_tri_smooth, start_tri_flat_uv, start_tri_smooth_uv, - start_quad_flat, start_quad_smooth, start_quad_flat_uv, start_quad_smooth_uv, - tri_size, quad_size, - len_tri_flat, len_tri_smooth, len_tri_flat_uv, len_tri_smooth_uv, - len_quad_flat, len_quad_smooth, len_quad_flat_uv, len_quad_smooth_uv; - - - THREE.Geometry.call( this ); - - md = parseMetaData( data, currentOffset ); - - currentOffset += md.header_bytes; -/* - md.vertex_index_bytes = Uint32Array.BYTES_PER_ELEMENT; - md.material_index_bytes = Uint16Array.BYTES_PER_ELEMENT; - md.normal_index_bytes = Uint32Array.BYTES_PER_ELEMENT; - md.uv_index_bytes = Uint32Array.BYTES_PER_ELEMENT; -*/ - // buffers sizes - - tri_size = md.vertex_index_bytes * 3 + md.material_index_bytes; - quad_size = md.vertex_index_bytes * 4 + md.material_index_bytes; - - len_tri_flat = md.ntri_flat * ( tri_size ); - len_tri_smooth = md.ntri_smooth * ( tri_size + md.normal_index_bytes * 3 ); - len_tri_flat_uv = md.ntri_flat_uv * ( tri_size + md.uv_index_bytes * 3 ); - len_tri_smooth_uv = md.ntri_smooth_uv * ( tri_size + md.normal_index_bytes * 3 + md.uv_index_bytes * 3 ); - - len_quad_flat = md.nquad_flat * ( quad_size ); - len_quad_smooth = md.nquad_smooth * ( quad_size + md.normal_index_bytes * 4 ); - len_quad_flat_uv = md.nquad_flat_uv * ( quad_size + md.uv_index_bytes * 4 ); - len_quad_smooth_uv = md.nquad_smooth_uv * ( quad_size + md.normal_index_bytes * 4 + md.uv_index_bytes * 4 ); - - // read buffers - - currentOffset += init_vertices( currentOffset ); - - currentOffset += init_normals( currentOffset ); - currentOffset += handlePadding( md.nnormals * 3 ); - - currentOffset += init_uvs( currentOffset ); - - start_tri_flat = currentOffset; - start_tri_smooth = start_tri_flat + len_tri_flat + handlePadding( md.ntri_flat * 2 ); - start_tri_flat_uv = start_tri_smooth + len_tri_smooth + handlePadding( md.ntri_smooth * 2 ); - start_tri_smooth_uv = start_tri_flat_uv + len_tri_flat_uv + handlePadding( md.ntri_flat_uv * 2 ); - - start_quad_flat = start_tri_smooth_uv + len_tri_smooth_uv + handlePadding( md.ntri_smooth_uv * 2 ); - start_quad_smooth = start_quad_flat + len_quad_flat + handlePadding( md.nquad_flat * 2 ); - start_quad_flat_uv = start_quad_smooth + len_quad_smooth + handlePadding( md.nquad_smooth * 2 ); - start_quad_smooth_uv= start_quad_flat_uv + len_quad_flat_uv + handlePadding( md.nquad_flat_uv * 2 ); - - // have to first process faces with uvs - // so that face and uv indices match - - init_triangles_flat_uv( start_tri_flat_uv ); - init_triangles_smooth_uv( start_tri_smooth_uv ); - - init_quads_flat_uv( start_quad_flat_uv ); - init_quads_smooth_uv( start_quad_smooth_uv ); - - // now we can process untextured faces - - init_triangles_flat( start_tri_flat ); - init_triangles_smooth( start_tri_smooth ); - - init_quads_flat( start_quad_flat ); - init_quads_smooth( start_quad_smooth ); - - this.computeCentroids(); - this.computeFaceNormals(); - - function handlePadding( n ) { - - return ( n % 4 ) ? ( 4 - n % 4 ) : 0; - - }; - - function parseMetaData( data, offset ) { - - var metaData = { - - 'signature' :parseString( data, offset, 12 ), - 'header_bytes' :parseUChar8( data, offset + 12 ), - - 'vertex_coordinate_bytes' :parseUChar8( data, offset + 13 ), - 'normal_coordinate_bytes' :parseUChar8( data, offset + 14 ), - 'uv_coordinate_bytes' :parseUChar8( data, offset + 15 ), - - 'vertex_index_bytes' :parseUChar8( data, offset + 16 ), - 'normal_index_bytes' :parseUChar8( data, offset + 17 ), - 'uv_index_bytes' :parseUChar8( data, offset + 18 ), - 'material_index_bytes' :parseUChar8( data, offset + 19 ), - - 'nvertices' :parseUInt32( data, offset + 20 ), - 'nnormals' :parseUInt32( data, offset + 20 + 4*1 ), - 'nuvs' :parseUInt32( data, offset + 20 + 4*2 ), - - 'ntri_flat' :parseUInt32( data, offset + 20 + 4*3 ), - 'ntri_smooth' :parseUInt32( data, offset + 20 + 4*4 ), - 'ntri_flat_uv' :parseUInt32( data, offset + 20 + 4*5 ), - 'ntri_smooth_uv' :parseUInt32( data, offset + 20 + 4*6 ), - - 'nquad_flat' :parseUInt32( data, offset + 20 + 4*7 ), - 'nquad_smooth' :parseUInt32( data, offset + 20 + 4*8 ), - 'nquad_flat_uv' :parseUInt32( data, offset + 20 + 4*9 ), - 'nquad_smooth_uv' :parseUInt32( data, offset + 20 + 4*10 ) - - }; -/* - console.log( "signature: " + metaData.signature ); - - console.log( "header_bytes: " + metaData.header_bytes ); - console.log( "vertex_coordinate_bytes: " + metaData.vertex_coordinate_bytes ); - console.log( "normal_coordinate_bytes: " + metaData.normal_coordinate_bytes ); - console.log( "uv_coordinate_bytes: " + metaData.uv_coordinate_bytes ); - - console.log( "vertex_index_bytes: " + metaData.vertex_index_bytes ); - console.log( "normal_index_bytes: " + metaData.normal_index_bytes ); - console.log( "uv_index_bytes: " + metaData.uv_index_bytes ); - console.log( "material_index_bytes: " + metaData.material_index_bytes ); - - console.log( "nvertices: " + metaData.nvertices ); - console.log( "nnormals: " + metaData.nnormals ); - console.log( "nuvs: " + metaData.nuvs ); - - console.log( "ntri_flat: " + metaData.ntri_flat ); - console.log( "ntri_smooth: " + metaData.ntri_smooth ); - console.log( "ntri_flat_uv: " + metaData.ntri_flat_uv ); - console.log( "ntri_smooth_uv: " + metaData.ntri_smooth_uv ); - - console.log( "nquad_flat: " + metaData.nquad_flat ); - console.log( "nquad_smooth: " + metaData.nquad_smooth ); - console.log( "nquad_flat_uv: " + metaData.nquad_flat_uv ); - console.log( "nquad_smooth_uv: " + metaData.nquad_smooth_uv ); - - var total = metaData.header_bytes - + metaData.nvertices * metaData.vertex_coordinate_bytes * 3 - + metaData.nnormals * metaData.normal_coordinate_bytes * 3 - + metaData.nuvs * metaData.uv_coordinate_bytes * 2 - + metaData.ntri_flat * ( metaData.vertex_index_bytes*3 + metaData.material_index_bytes ) - + metaData.ntri_smooth * ( metaData.vertex_index_bytes*3 + metaData.material_index_bytes + metaData.normal_index_bytes*3 ) - + metaData.ntri_flat_uv * ( metaData.vertex_index_bytes*3 + metaData.material_index_bytes + metaData.uv_index_bytes*3 ) - + metaData.ntri_smooth_uv * ( metaData.vertex_index_bytes*3 + metaData.material_index_bytes + metaData.normal_index_bytes*3 + metaData.uv_index_bytes*3 ) - + metaData.nquad_flat * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes ) - + metaData.nquad_smooth * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.normal_index_bytes*4 ) - + metaData.nquad_flat_uv * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.uv_index_bytes*4 ) - + metaData.nquad_smooth_uv * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.normal_index_bytes*4 + metaData.uv_index_bytes*4 ); - console.log( "total bytes: " + total ); -*/ - - return metaData; - - }; - - function parseString( data, offset, length ) { - - var charArray = new Uint8Array( data, offset, length ); - - var text = ""; - - for ( var i = 0; i < length; i ++ ) { - - text += String.fromCharCode( charArray[ offset + i ] ); - - } - - return text; - - }; - - function parseUChar8( data, offset ) { - - var charArray = new Uint8Array( data, offset, 1 ); - - return charArray[ 0 ]; - - }; - - function parseUInt32( data, offset ) { - - var intArray = new Uint32Array( data, offset, 1 ); - - return intArray[ 0 ]; - - }; - - function init_vertices( start ) { - - var nElements = md.nvertices; - - var coordArray = new Float32Array( data, start, nElements * 3 ); - - var i, x, y, z; - - for( i = 0; i < nElements; i ++ ) { - - x = coordArray[ i * 3 ]; - y = coordArray[ i * 3 + 1 ]; - z = coordArray[ i * 3 + 2 ]; - - vertex( scope, x, y, z ); - - } - - return nElements * 3 * Float32Array.BYTES_PER_ELEMENT; - - }; - - function init_normals( start ) { - - var nElements = md.nnormals; - - if ( nElements ) { - - var normalArray = new Int8Array( data, start, nElements * 3 ); - - var i, x, y, z; - - for( i = 0; i < nElements; i ++ ) { - - x = normalArray[ i * 3 ]; - y = normalArray[ i * 3 + 1 ]; - z = normalArray[ i * 3 + 2 ]; - - normals.push( x/127, y/127, z/127 ); - - } - - } - - return nElements * 3 * Int8Array.BYTES_PER_ELEMENT; - - }; - - function init_uvs( start ) { - - var nElements = md.nuvs; - - if ( nElements ) { - - var uvArray = new Float32Array( data, start, nElements * 2 ); - - var i, u, v; - - for( i = 0; i < nElements; i ++ ) { - - u = uvArray[ i * 2 ]; - v = uvArray[ i * 2 + 1 ]; - - uvs.push( u, v ); - - } - - } - - return nElements * 2 * Float32Array.BYTES_PER_ELEMENT; - - }; - - function init_uvs3( nElements, offset ) { - - var i, uva, uvb, uvc, u1, u2, u3, v1, v2, v3; - - var uvIndexBuffer = new Uint32Array( data, offset, 3 * nElements ); - - for( i = 0; i < nElements; i ++ ) { - - uva = uvIndexBuffer[ i * 3 ]; - uvb = uvIndexBuffer[ i * 3 + 1 ]; - uvc = uvIndexBuffer[ i * 3 + 2 ]; - - u1 = uvs[ uva*2 ]; - v1 = uvs[ uva*2 + 1 ]; - - u2 = uvs[ uvb*2 ]; - v2 = uvs[ uvb*2 + 1 ]; - - u3 = uvs[ uvc*2 ]; - v3 = uvs[ uvc*2 + 1 ]; - - uv3( scope.faceVertexUvs[ 0 ], u1, v1, u2, v2, u3, v3 ); - - } - - }; - - function init_uvs4( nElements, offset ) { - - var i, uva, uvb, uvc, uvd, u1, u2, u3, u4, v1, v2, v3, v4; - - var uvIndexBuffer = new Uint32Array( data, offset, 4 * nElements ); - - for( i = 0; i < nElements; i ++ ) { - - uva = uvIndexBuffer[ i * 4 ]; - uvb = uvIndexBuffer[ i * 4 + 1 ]; - uvc = uvIndexBuffer[ i * 4 + 2 ]; - uvd = uvIndexBuffer[ i * 4 + 3 ]; - - u1 = uvs[ uva*2 ]; - v1 = uvs[ uva*2 + 1 ]; - - u2 = uvs[ uvb*2 ]; - v2 = uvs[ uvb*2 + 1 ]; - - u3 = uvs[ uvc*2 ]; - v3 = uvs[ uvc*2 + 1 ]; - - u4 = uvs[ uvd*2 ]; - v4 = uvs[ uvd*2 + 1 ]; - - uv4( scope.faceVertexUvs[ 0 ], u1, v1, u2, v2, u3, v3, u4, v4 ); - - } - - }; - - function init_faces3_flat( nElements, offsetVertices, offsetMaterials ) { - - var i, a, b, c, m; - - var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 3 * nElements ); - var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements ); - - for( i = 0; i < nElements; i ++ ) { - - a = vertexIndexBuffer[ i * 3 ]; - b = vertexIndexBuffer[ i * 3 + 1 ]; - c = vertexIndexBuffer[ i * 3 + 2 ]; - - m = materialIndexBuffer[ i ]; - - f3( scope, a, b, c, m ); - - } - - }; - - function init_faces4_flat( nElements, offsetVertices, offsetMaterials ) { - - var i, a, b, c, d, m; - - var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 4 * nElements ); - var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements ); - - for( i = 0; i < nElements; i ++ ) { - - a = vertexIndexBuffer[ i * 4 ]; - b = vertexIndexBuffer[ i * 4 + 1 ]; - c = vertexIndexBuffer[ i * 4 + 2 ]; - d = vertexIndexBuffer[ i * 4 + 3 ]; - - m = materialIndexBuffer[ i ]; - - f4( scope, a, b, c, d, m ); - - } - - }; - - function init_faces3_smooth( nElements, offsetVertices, offsetNormals, offsetMaterials ) { - - var i, a, b, c, m; - var na, nb, nc; - - var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 3 * nElements ); - var normalIndexBuffer = new Uint32Array( data, offsetNormals, 3 * nElements ); - var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements ); - - for( i = 0; i < nElements; i ++ ) { - - a = vertexIndexBuffer[ i * 3 ]; - b = vertexIndexBuffer[ i * 3 + 1 ]; - c = vertexIndexBuffer[ i * 3 + 2 ]; - - na = normalIndexBuffer[ i * 3 ]; - nb = normalIndexBuffer[ i * 3 + 1 ]; - nc = normalIndexBuffer[ i * 3 + 2 ]; - - m = materialIndexBuffer[ i ]; - - f3n( scope, normals, a, b, c, m, na, nb, nc ); - - } - - }; - - function init_faces4_smooth( nElements, offsetVertices, offsetNormals, offsetMaterials ) { - - var i, a, b, c, d, m; - var na, nb, nc, nd; - - var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 4 * nElements ); - var normalIndexBuffer = new Uint32Array( data, offsetNormals, 4 * nElements ); - var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements ); - - for( i = 0; i < nElements; i ++ ) { - - a = vertexIndexBuffer[ i * 4 ]; - b = vertexIndexBuffer[ i * 4 + 1 ]; - c = vertexIndexBuffer[ i * 4 + 2 ]; - d = vertexIndexBuffer[ i * 4 + 3 ]; - - na = normalIndexBuffer[ i * 4 ]; - nb = normalIndexBuffer[ i * 4 + 1 ]; - nc = normalIndexBuffer[ i * 4 + 2 ]; - nd = normalIndexBuffer[ i * 4 + 3 ]; - - m = materialIndexBuffer[ i ]; - - f4n( scope, normals, a, b, c, d, m, na, nb, nc, nd ); - - } - - }; - - function init_triangles_flat( start ) { - - var nElements = md.ntri_flat; - - if ( nElements ) { - - var offsetMaterials = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 3; - init_faces3_flat( nElements, start, offsetMaterials ); - - } - - }; - - function init_triangles_flat_uv( start ) { - - var nElements = md.ntri_flat_uv; - - if ( nElements ) { - - var offsetUvs = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 3; - var offsetMaterials = offsetUvs + nElements * Uint32Array.BYTES_PER_ELEMENT * 3; - - init_faces3_flat( nElements, start, offsetMaterials ); - init_uvs3( nElements, offsetUvs ); - - } - - }; - - function init_triangles_smooth( start ) { - - var nElements = md.ntri_smooth; - - if ( nElements ) { - - var offsetNormals = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 3; - var offsetMaterials = offsetNormals + nElements * Uint32Array.BYTES_PER_ELEMENT * 3; - - init_faces3_smooth( nElements, start, offsetNormals, offsetMaterials ); - - } - - }; - - function init_triangles_smooth_uv( start ) { - - var nElements = md.ntri_smooth_uv; - - if ( nElements ) { - - var offsetNormals = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 3; - var offsetUvs = offsetNormals + nElements * Uint32Array.BYTES_PER_ELEMENT * 3; - var offsetMaterials = offsetUvs + nElements * Uint32Array.BYTES_PER_ELEMENT * 3; - - init_faces3_smooth( nElements, start, offsetNormals, offsetMaterials ); - init_uvs3( nElements, offsetUvs ); - - } - - }; - - function init_quads_flat( start ) { - - var nElements = md.nquad_flat; - - if ( nElements ) { - - var offsetMaterials = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 4; - init_faces4_flat( nElements, start, offsetMaterials ); - - } - - }; - - function init_quads_flat_uv( start ) { - - var nElements = md.nquad_flat_uv; - - if ( nElements ) { - - var offsetUvs = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 4; - var offsetMaterials = offsetUvs + nElements * Uint32Array.BYTES_PER_ELEMENT * 4; - - init_faces4_flat( nElements, start, offsetMaterials ); - init_uvs4( nElements, offsetUvs ); - - } - - }; - - function init_quads_smooth( start ) { - - var nElements = md.nquad_smooth; - - if ( nElements ) { - - var offsetNormals = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 4; - var offsetMaterials = offsetNormals + nElements * Uint32Array.BYTES_PER_ELEMENT * 4; - - init_faces4_smooth( nElements, start, offsetNormals, offsetMaterials ); - - } - - }; - - function init_quads_smooth_uv( start ) { - - var nElements = md.nquad_smooth_uv; - - if ( nElements ) { - - var offsetNormals = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 4; - var offsetUvs = offsetNormals + nElements * Uint32Array.BYTES_PER_ELEMENT * 4; - var offsetMaterials = offsetUvs + nElements * Uint32Array.BYTES_PER_ELEMENT * 4; - - init_faces4_smooth( nElements, start, offsetNormals, offsetMaterials ); - init_uvs4( nElements, offsetUvs ); - - } - - }; - - }; - - function vertex ( scope, x, y, z ) { - - scope.vertices.push( new THREE.Vector3( x, y, z ) ); - - }; - - function f3 ( scope, a, b, c, mi ) { - - scope.faces.push( new THREE.Face3( a, b, c, null, null, mi ) ); - - }; - - function f4 ( scope, a, b, c, d, mi ) { - - scope.faces.push( new THREE.Face3( a, b, d, null, null, mi ) ); - scope.faces.push( new THREE.Face3( b, c, d, null, null, mi ) ); - - }; - - function f3n ( scope, normals, a, b, c, mi, na, nb, nc ) { - - var nax = normals[ na*3 ], - nay = normals[ na*3 + 1 ], - naz = normals[ na*3 + 2 ], - - nbx = normals[ nb*3 ], - nby = normals[ nb*3 + 1 ], - nbz = normals[ nb*3 + 2 ], - - ncx = normals[ nc*3 ], - ncy = normals[ nc*3 + 1 ], - ncz = normals[ nc*3 + 2 ]; - - scope.faces.push( new THREE.Face3( a, b, c, - [new THREE.Vector3( nax, nay, naz ), - new THREE.Vector3( nbx, nby, nbz ), - new THREE.Vector3( ncx, ncy, ncz )], - null, - mi ) ); - - }; - - function f4n ( scope, normals, a, b, c, d, mi, na, nb, nc, nd ) { - - var nax = normals[ na*3 ], - nay = normals[ na*3 + 1 ], - naz = normals[ na*3 + 2 ], - - nbx = normals[ nb*3 ], - nby = normals[ nb*3 + 1 ], - nbz = normals[ nb*3 + 2 ], - - ncx = normals[ nc*3 ], - ncy = normals[ nc*3 + 1 ], - ncz = normals[ nc*3 + 2 ], - - ndx = normals[ nd*3 ], - ndy = normals[ nd*3 + 1 ], - ndz = normals[ nd*3 + 2 ]; - - scope.faces.push( new THREE.Face3( a, b, d, [ - new THREE.Vector3( nax, nay, naz ), - new THREE.Vector3( nbx, nby, nbz ), - new THREE.Vector3( ndx, ndy, ndz ) - ], null, mi ) ); - - scope.faces.push( new THREE.Face3( b, c, d, [ - new THREE.Vector3( nbx, nby, nbz ), - new THREE.Vector3( ncx, ncy, ncz ), - new THREE.Vector3( ndx, ndy, ndz ) - ], null, mi ) ); - - }; - - function uv3 ( where, u1, v1, u2, v2, u3, v3 ) { - - where.push( [ - new THREE.Vector2( u1, v1 ), - new THREE.Vector2( u2, v2 ), - new THREE.Vector2( u3, v3 ) - ] ); - - }; - - function uv4 ( where, u1, v1, u2, v2, u3, v3, u4, v4 ) { - - where.push( [ - new THREE.Vector2( u1, v1 ), - new THREE.Vector2( u2, v2 ), - new THREE.Vector2( u4, v4 ) - ] ); - - where.push( [ - new THREE.Vector2( u2, v2 ), - new THREE.Vector2( u3, v3 ), - new THREE.Vector2( u4, v4 ) - ] ); - - }; - - Model.prototype = Object.create( THREE.Geometry.prototype ); - - var geometry = new Model( texturePath ); - var materials = this.initMaterials( jsonMaterials, texturePath ); - - if ( this.needsTangents( materials ) ) geometry.computeTangents(); - - callback( geometry, materials ); - -}; diff --git a/libs/plasio/vendor/lodash.min.js b/libs/plasio/vendor/lodash.min.js deleted file mode 100644 index 85a96263..00000000 --- a/libs/plasio/vendor/lodash.min.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @license - * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE - * Build: `lodash modern -o ./dist/lodash.js` - */ -;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e<r;)if(n[e]===t)return e;return-1}function t(t,e){var r=typeof e;if(t=t.l,"boolean"==r||null==e)return t[e]?0:-1;"number"!=r&&"string"!=r&&(r="object");var u="number"==r?e:m+e;return t=(t=t[r])&&t[u],"object"==r?t&&-1<n(t,e)?0:-1:t?0:-1}function e(n){var t=this.l,e=typeof n;if("boolean"==e||null==n)t[n]=true;else{"number"!=e&&"string"!=e&&(e="object");var r="number"==e?n:m+n,t=t[e]||(t[e]={});"object"==e?(t[r]||(t[r]=[])).push(n):t[r]=true -}}function r(n){return n.charCodeAt(0)}function u(n,t){for(var e=n.m,r=t.m,u=-1,o=e.length;++u<o;){var i=e[u],a=r[u];if(i!==a){if(i>a||typeof i=="undefined")return 1;if(i<a||typeof a=="undefined")return-1}}return n.n-t.n}function o(n){var t=-1,r=n.length,u=n[0],o=n[r/2|0],i=n[r-1];if(u&&typeof u=="object"&&o&&typeof o=="object"&&i&&typeof i=="object")return false;for(u=f(),u["false"]=u["null"]=u["true"]=u.undefined=false,o=f(),o.k=n,o.l=u,o.push=e;++t<r;)o.push(n[t]);return o}function i(n){return"\\"+U[n] -}function a(){return h.pop()||[]}function f(){return g.pop()||{k:null,l:null,m:null,"false":false,n:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,o:null}}function l(n){n.length=0,h.length<_&&h.push(n)}function c(n){var t=n.l;t&&c(t),n.k=n.l=n.m=n.object=n.number=n.string=n.o=null,g.length<_&&g.push(n)}function p(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Array(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function s(e){function h(n,t,e){if(!n||!V[typeof n])return n; -t=t&&typeof e=="undefined"?t:tt(t,e,3);for(var r=-1,u=V[typeof n]&&Fe(n),o=u?u.length:0;++r<o&&(e=u[r],false!==t(n[e],e,n)););return n}function g(n,t,e){var r;if(!n||!V[typeof n])return n;t=t&&typeof e=="undefined"?t:tt(t,e,3);for(r in n)if(false===t(n[r],r,n))break;return n}function _(n,t,e){var r,u=n,o=u;if(!u)return o;for(var i=arguments,a=0,f=typeof e=="number"?2:i.length;++a<f;)if((u=i[a])&&V[typeof u])for(var l=-1,c=V[typeof u]&&Fe(u),p=c?c.length:0;++l<p;)r=c[l],"undefined"==typeof o[r]&&(o[r]=u[r]); -return o}function U(n,t,e){var r,u=n,o=u;if(!u)return o;var i=arguments,a=0,f=typeof e=="number"?2:i.length;if(3<f&&"function"==typeof i[f-2])var l=tt(i[--f-1],i[f--],2);else 2<f&&"function"==typeof i[f-1]&&(l=i[--f]);for(;++a<f;)if((u=i[a])&&V[typeof u])for(var c=-1,p=V[typeof u]&&Fe(u),s=p?p.length:0;++c<s;)r=p[c],o[r]=l?l(o[r],u[r]):u[r];return o}function H(n){var t,e=[];if(!n||!V[typeof n])return e;for(t in n)me.call(n,t)&&e.push(t);return e}function J(n){return n&&typeof n=="object"&&!Te(n)&&me.call(n,"__wrapped__")?n:new Q(n) -}function Q(n,t){this.__chain__=!!t,this.__wrapped__=n}function X(n){function t(){if(r){var n=p(r);be.apply(n,arguments)}if(this instanceof t){var o=nt(e.prototype),n=e.apply(o,n||arguments);return wt(n)?n:o}return e.apply(u,n||arguments)}var e=n[0],r=n[2],u=n[4];return $e(t,n),t}function Z(n,t,e,r,u){if(e){var o=e(n);if(typeof o!="undefined")return o}if(!wt(n))return n;var i=ce.call(n);if(!K[i])return n;var f=Ae[i];switch(i){case T:case F:return new f(+n);case W:case P:return new f(n);case z:return o=f(n.source,C.exec(n)),o.lastIndex=n.lastIndex,o -}if(i=Te(n),t){var c=!r;r||(r=a()),u||(u=a());for(var s=r.length;s--;)if(r[s]==n)return u[s];o=i?f(n.length):{}}else o=i?p(n):U({},n);return i&&(me.call(n,"index")&&(o.index=n.index),me.call(n,"input")&&(o.input=n.input)),t?(r.push(n),u.push(o),(i?St:h)(n,function(n,i){o[i]=Z(n,t,e,r,u)}),c&&(l(r),l(u)),o):o}function nt(n){return wt(n)?ke(n):{}}function tt(n,t,e){if(typeof n!="function")return Ut;if(typeof t=="undefined"||!("prototype"in n))return n;var r=n.__bindData__;if(typeof r=="undefined"&&(De.funcNames&&(r=!n.name),r=r||!De.funcDecomp,!r)){var u=ge.call(n); -De.funcNames||(r=!O.test(u)),r||(r=E.test(u),$e(n,r))}if(false===r||true!==r&&1&r[1])return n;switch(e){case 1:return function(e){return n.call(t,e)};case 2:return function(e,r){return n.call(t,e,r)};case 3:return function(e,r,u){return n.call(t,e,r,u)};case 4:return function(e,r,u,o){return n.call(t,e,r,u,o)}}return Mt(n,t)}function et(n){function t(){var n=f?i:this;if(u){var h=p(u);be.apply(h,arguments)}return(o||c)&&(h||(h=p(arguments)),o&&be.apply(h,o),c&&h.length<a)?(r|=16,et([e,s?r:-4&r,h,null,i,a])):(h||(h=arguments),l&&(e=n[v]),this instanceof t?(n=nt(e.prototype),h=e.apply(n,h),wt(h)?h:n):e.apply(n,h)) -}var e=n[0],r=n[1],u=n[2],o=n[3],i=n[4],a=n[5],f=1&r,l=2&r,c=4&r,s=8&r,v=e;return $e(t,n),t}function rt(e,r){var u=-1,i=st(),a=e?e.length:0,f=a>=b&&i===n,l=[];if(f){var p=o(r);p?(i=t,r=p):f=false}for(;++u<a;)p=e[u],0>i(r,p)&&l.push(p);return f&&c(r),l}function ut(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r<u;){var i=n[r];if(i&&typeof i=="object"&&typeof i.length=="number"&&(Te(i)||yt(i))){t||(i=ut(i,t,e));var a=-1,f=i.length,l=o.length;for(o.length+=f;++a<f;)o[l++]=i[a]}else e||o.push(i)}return o -}function ot(n,t,e,r,u,o){if(e){var i=e(n,t);if(typeof i!="undefined")return!!i}if(n===t)return 0!==n||1/n==1/t;if(n===n&&!(n&&V[typeof n]||t&&V[typeof t]))return false;if(null==n||null==t)return n===t;var f=ce.call(n),c=ce.call(t);if(f==D&&(f=q),c==D&&(c=q),f!=c)return false;switch(f){case T:case F:return+n==+t;case W:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case z:case P:return n==oe(t)}if(c=f==$,!c){var p=me.call(n,"__wrapped__"),s=me.call(t,"__wrapped__");if(p||s)return ot(p?n.__wrapped__:n,s?t.__wrapped__:t,e,r,u,o); -if(f!=q)return false;if(f=n.constructor,p=t.constructor,f!=p&&!(dt(f)&&f instanceof f&&dt(p)&&p instanceof p)&&"constructor"in n&&"constructor"in t)return false}for(f=!u,u||(u=a()),o||(o=a()),p=u.length;p--;)if(u[p]==n)return o[p]==t;var v=0,i=true;if(u.push(n),o.push(t),c){if(p=n.length,v=t.length,(i=v==p)||r)for(;v--;)if(c=p,s=t[v],r)for(;c--&&!(i=ot(n[c],s,e,r,u,o)););else if(!(i=ot(n[v],s,e,r,u,o)))break}else g(t,function(t,a,f){return me.call(f,a)?(v++,i=me.call(n,a)&&ot(n[a],t,e,r,u,o)):void 0}),i&&!r&&g(n,function(n,t,e){return me.call(e,t)?i=-1<--v:void 0 -});return u.pop(),o.pop(),f&&(l(u),l(o)),i}function it(n,t,e,r,u){(Te(t)?St:h)(t,function(t,o){var i,a,f=t,l=n[o];if(t&&((a=Te(t))||Pe(t))){for(f=r.length;f--;)if(i=r[f]==t){l=u[f];break}if(!i){var c;e&&(f=e(l,t),c=typeof f!="undefined")&&(l=f),c||(l=a?Te(l)?l:[]:Pe(l)?l:{}),r.push(t),u.push(l),c||it(l,t,e,r,u)}}else e&&(f=e(l,t),typeof f=="undefined"&&(f=t)),typeof f!="undefined"&&(l=f);n[o]=l})}function at(n,t){return n+he(Re()*(t-n+1))}function ft(e,r,u){var i=-1,f=st(),p=e?e.length:0,s=[],v=!r&&p>=b&&f===n,h=u||v?a():s; -for(v&&(h=o(h),f=t);++i<p;){var g=e[i],y=u?u(g,i,e):g;(r?!i||h[h.length-1]!==y:0>f(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(l(h.k),c(h)):u&&l(h),s}function lt(n){return function(t,e,r){var u={};e=J.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++r<o;){var i=t[r];n(u,i,e(i,r,t),t)}else h(t,function(t,r,o){n(u,t,e(t,r,o),o)});return u}}function ct(n,t,e,r,u,o){var i=1&t,a=4&t,f=16&t,l=32&t;if(!(2&t||dt(n)))throw new ie;f&&!e.length&&(t&=-17,f=e=false),l&&!r.length&&(t&=-33,l=r=false); -var c=n&&n.__bindData__;return c&&true!==c?(c=p(c),c[2]&&(c[2]=p(c[2])),c[3]&&(c[3]=p(c[3])),!i||1&c[1]||(c[4]=u),!i&&1&c[1]&&(t|=8),!a||4&c[1]||(c[5]=o),f&&be.apply(c[2]||(c[2]=[]),e),l&&we.apply(c[3]||(c[3]=[]),r),c[1]|=t,ct.apply(null,c)):(1==t||17===t?X:et)([n,t,e,r,u,o])}function pt(n){return Be[n]}function st(){var t=(t=J.indexOf)===Wt?n:t;return t}function vt(n){return typeof n=="function"&&pe.test(n)}function ht(n){var t,e;return n&&ce.call(n)==q&&(t=n.constructor,!dt(t)||t instanceof t)?(g(n,function(n,t){e=t -}),typeof e=="undefined"||me.call(n,e)):false}function gt(n){return We[n]}function yt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ce.call(n)==D||false}function mt(n,t,e){var r=Fe(n),u=r.length;for(t=tt(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function bt(n){var t=[];return g(n,function(n,e){dt(n)&&t.push(e)}),t.sort()}function _t(n){for(var t=-1,e=Fe(n),r=e.length,u={};++t<r;){var o=e[t];u[n[o]]=o}return u}function dt(n){return typeof n=="function"}function wt(n){return!(!n||!V[typeof n]) -}function jt(n){return typeof n=="number"||n&&typeof n=="object"&&ce.call(n)==W||false}function kt(n){return typeof n=="string"||n&&typeof n=="object"&&ce.call(n)==P||false}function xt(n){for(var t=-1,e=Fe(n),r=e.length,u=Xt(r);++t<r;)u[t]=n[e[t]];return u}function Ct(n,t,e){var r=-1,u=st(),o=n?n.length:0,i=false;return e=(0>e?Ie(0,o+e):e)||0,Te(n)?i=-1<u(n,t,e):typeof o=="number"?i=-1<(kt(n)?n.indexOf(t,e):u(n,t,e)):h(n,function(n){return++r<e?void 0:!(i=n===t)}),i}function Ot(n,t,e){var r=true;t=J.createCallback(t,e,3),e=-1; -var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&(r=!!t(n[e],e,n)););else h(n,function(n,e,u){return r=!!t(n,e,u)});return r}function Nt(n,t,e){var r=[];t=J.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}else h(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function It(n,t,e){t=J.createCallback(t,e,3),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return h(n,function(n,e,r){return t(n,e,r)?(u=n,false):void 0}),u}for(;++e<r;){var o=n[e]; -if(t(o,e,n))return o}}function St(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:tt(t,e,3),typeof u=="number")for(;++r<u&&false!==t(n[r],r,n););else h(n,t);return n}function Et(n,t,e){var r=n?n.length:0;if(t=t&&typeof e=="undefined"?t:tt(t,e,3),typeof r=="number")for(;r--&&false!==t(n[r],r,n););else{var u=Fe(n),r=u.length;h(n,function(n,e,o){return e=u?u[--r]:--r,t(o[e],e,o)})}return n}function Rt(n,t,e){var r=-1,u=n?n.length:0;if(t=J.createCallback(t,e,3),typeof u=="number")for(var o=Xt(u);++r<u;)o[r]=t(n[r],r,n); -else o=[],h(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function At(n,t,e){var u=-1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&Te(n)){e=-1;for(var i=n.length;++e<i;){var a=n[e];a>o&&(o=a)}}else t=null==t&&kt(n)?r:J.createCallback(t,e,3),St(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Dt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=J.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n);else h(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o) -});return e}function $t(n,t,e,r){var u=3>arguments.length;return t=J.createCallback(t,r,4),Et(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)}),e}function Tt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=at(0,++t);r[t]=r[e],r[e]=n}),r}function Ft(n,t,e){var r;t=J.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else h(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function Bt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1; -for(t=J.createCallback(t,e,3);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[0]:v;return p(n,0,Se(Ie(0,r),u))}function Wt(t,e,r){if(typeof r=="number"){var u=t?t.length:0;r=0>r?Ie(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1;return n(t,e,r)}function qt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=J.createCallback(t,e,3);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:Ie(0,t);return p(n,r)}function zt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?J.createCallback(e,r,1):Ut,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r; -return u}function Pt(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(e=J.createCallback(e,r,3)),ft(n,t,e)}function Kt(){for(var n=1<arguments.length?arguments:arguments[0],t=-1,e=n?At(Ve(n,"length")):0,r=Xt(0>e?0:e);++t<e;)r[t]=Ve(n,t);return r}function Lt(n,t){var e=-1,r=n?n.length:0,u={};for(t||!r||Te(n[0])||(t=[]);++e<r;){var o=n[e];t?u[o]=t[e]:o&&(u[o[0]]=o[1])}return u}function Mt(n,t){return 2<arguments.length?ct(n,17,p(arguments,2),null,t):ct(n,1,null,null,t) -}function Vt(n,t,e){function r(){c&&ve(c),i=c=p=v,(g||h!==t)&&(s=Ue(),a=n.apply(l,o),c||i||(o=l=null))}function u(){var e=t-(Ue()-f);0<e?c=_e(u,e):(i&&ve(i),e=p,i=c=p=v,e&&(s=Ue(),a=n.apply(l,o),c||i||(o=l=null)))}var o,i,a,f,l,c,p,s=0,h=false,g=true;if(!dt(n))throw new ie;if(t=Ie(0,t)||0,true===e)var y=true,g=false;else wt(e)&&(y=e.leading,h="maxWait"in e&&(Ie(t,e.maxWait)||0),g="trailing"in e?e.trailing:g);return function(){if(o=arguments,f=Ue(),l=this,p=g&&(c||!y),false===h)var e=y&&!c;else{i||y||(s=f);var v=h-(f-s),m=0>=v; -m?(i&&(i=ve(i)),s=f,a=n.apply(l,o)):i||(i=_e(r,v))}return m&&c?c=ve(c):c||t===h||(c=_e(u,t)),e&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Ut(n){return n}function Gt(n,t,e){var r=true,u=t&&bt(t);t&&(e||u.length)||(null==e&&(e=t),o=Q,t=n,n=J,u=bt(t)),false===e?r=false:wt(e)&&"chain"in e&&(r=e.chain);var o=n,i=dt(o);St(u,function(e){var u=n[e]=t[e];i&&(o.prototype[e]=function(){var t=this.__chain__,e=this.__wrapped__,i=[e];if(be.apply(i,arguments),i=u.apply(n,i),r||t){if(e===i&&wt(i))return this; -i=new o(i),i.__chain__=t}return i})})}function Ht(){}function Jt(n){return function(t){return t[n]}}function Qt(){return this.__wrapped__}e=e?Y.defaults(G.Object(),e,Y.pick(G,A)):G;var Xt=e.Array,Yt=e.Boolean,Zt=e.Date,ne=e.Function,te=e.Math,ee=e.Number,re=e.Object,ue=e.RegExp,oe=e.String,ie=e.TypeError,ae=[],fe=re.prototype,le=e._,ce=fe.toString,pe=ue("^"+oe(ce).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),se=te.ceil,ve=e.clearTimeout,he=te.floor,ge=ne.prototype.toString,ye=vt(ye=re.getPrototypeOf)&&ye,me=fe.hasOwnProperty,be=ae.push,_e=e.setTimeout,de=ae.splice,we=ae.unshift,je=function(){try{var n={},t=vt(t=re.defineProperty)&&t,e=t(n,n,n)&&t -}catch(r){}return e}(),ke=vt(ke=re.create)&&ke,xe=vt(xe=Xt.isArray)&&xe,Ce=e.isFinite,Oe=e.isNaN,Ne=vt(Ne=re.keys)&&Ne,Ie=te.max,Se=te.min,Ee=e.parseInt,Re=te.random,Ae={};Ae[$]=Xt,Ae[T]=Yt,Ae[F]=Zt,Ae[B]=ne,Ae[q]=re,Ae[W]=ee,Ae[z]=ue,Ae[P]=oe,Q.prototype=J.prototype;var De=J.support={};De.funcDecomp=!vt(e.a)&&E.test(s),De.funcNames=typeof ne.name=="string",J.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:J}},ke||(nt=function(){function n(){}return function(t){if(wt(t)){n.prototype=t; -var r=new n;n.prototype=null}return r||e.Object()}}());var $e=je?function(n,t){M.value=t,je(n,"__bindData__",M)}:Ht,Te=xe||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ce.call(n)==$||false},Fe=Ne?function(n){return wt(n)?Ne(n):[]}:H,Be={"&":"&","<":"<",">":">",'"':""","'":"'"},We=_t(Be),qe=ue("("+Fe(We).join("|")+")","g"),ze=ue("["+Fe(Be).join("")+"]","g"),Pe=ye?function(n){if(!n||ce.call(n)!=q)return false;var t=n.valueOf,e=vt(t)&&(e=ye(t))&&ye(e);return e?n==e||ye(n)==e:ht(n) -}:ht,Ke=lt(function(n,t,e){me.call(n,e)?n[e]++:n[e]=1}),Le=lt(function(n,t,e){(me.call(n,e)?n[e]:n[e]=[]).push(t)}),Me=lt(function(n,t,e){n[e]=t}),Ve=Rt,Ue=vt(Ue=Zt.now)&&Ue||function(){return(new Zt).getTime()},Ge=8==Ee(d+"08")?Ee:function(n,t){return Ee(kt(n)?n.replace(I,""):n,t||0)};return J.after=function(n,t){if(!dt(t))throw new ie;return function(){return 1>--n?t.apply(this,arguments):void 0}},J.assign=U,J.at=function(n){for(var t=arguments,e=-1,r=ut(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);++e<t;)u[e]=n[r[e]]; -return u},J.bind=Mt,J.bindAll=function(n){for(var t=1<arguments.length?ut(arguments,true,false,1):bt(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=ct(n[u],1,null,null,n)}return n},J.bindKey=function(n,t){return 2<arguments.length?ct(t,19,p(arguments,2),null,n):ct(t,3,null,null,n)},J.chain=function(n){return n=new Q(n),n.__chain__=true,n},J.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},J.compose=function(){for(var n=arguments,t=n.length;t--;)if(!dt(n[t]))throw new ie; -return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},J.constant=function(n){return function(){return n}},J.countBy=Ke,J.create=function(n,t){var e=nt(n);return t?U(e,t):e},J.createCallback=function(n,t,e){var r=typeof n;if(null==n||"function"==r)return tt(n,t,e);if("object"!=r)return Jt(n);var u=Fe(n),o=u[0],i=n[o];return 1!=u.length||i!==i||wt(i)?function(t){for(var e=u.length,r=false;e--&&(r=ot(t[u[e]],n[u[e]],null,true)););return r}:function(n){return n=n[o],i===n&&(0!==i||1/i==1/n) -}},J.curry=function(n,t){return t=typeof t=="number"?t:+t||n.length,ct(n,4,null,null,null,t)},J.debounce=Vt,J.defaults=_,J.defer=function(n){if(!dt(n))throw new ie;var t=p(arguments,1);return _e(function(){n.apply(v,t)},1)},J.delay=function(n,t){if(!dt(n))throw new ie;var e=p(arguments,2);return _e(function(){n.apply(v,e)},t)},J.difference=function(n){return rt(n,ut(arguments,true,true,1))},J.filter=Nt,J.flatten=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(n=Rt(n,e,r)),ut(n,t) -},J.forEach=St,J.forEachRight=Et,J.forIn=g,J.forInRight=function(n,t,e){var r=[];g(n,function(n,t){r.push(t,n)});var u=r.length;for(t=tt(t,e,3);u--&&false!==t(r[u--],r[u],n););return n},J.forOwn=h,J.forOwnRight=mt,J.functions=bt,J.groupBy=Le,J.indexBy=Me,J.initial=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=J.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return p(n,0,Se(Ie(0,u-r),u))},J.intersection=function(){for(var e=[],r=-1,u=arguments.length,i=a(),f=st(),p=f===n,s=a();++r<u;){var v=arguments[r]; -(Te(v)||yt(v))&&(e.push(v),i.push(p&&v.length>=b&&o(r?e[r]:s)))}var p=e[0],h=-1,g=p?p.length:0,y=[];n:for(;++h<g;){var m=i[0],v=p[h];if(0>(m?t(m,v):f(s,v))){for(r=u,(m||s).push(v);--r;)if(m=i[r],0>(m?t(m,v):f(e[r],v)))continue n;y.push(v)}}for(;u--;)(m=i[u])&&c(m);return l(i),l(s),y},J.invert=_t,J.invoke=function(n,t){var e=p(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,i=Xt(typeof o=="number"?o:0);return St(n,function(n){i[++r]=(u?t:n[t]).apply(n,e)}),i},J.keys=Fe,J.map=Rt,J.mapValues=function(n,t,e){var r={}; -return t=J.createCallback(t,e,3),h(n,function(n,e,u){r[e]=t(n,e,u)}),r},J.max=At,J.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):m+arguments[0];return me.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!dt(n))throw new ie;return e.cache={},e},J.merge=function(n){var t=arguments,e=2;if(!wt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3<e&&"function"==typeof t[e-2])var r=tt(t[--e-1],t[e--],2);else 2<e&&"function"==typeof t[e-1]&&(r=t[--e]);for(var t=p(arguments,1,e),u=-1,o=a(),i=a();++u<e;)it(n,t[u],r,o,i); -return l(o),l(i),n},J.min=function(n,t,e){var u=1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&Te(n)){e=-1;for(var i=n.length;++e<i;){var a=n[e];a<o&&(o=a)}}else t=null==t&&kt(n)?r:J.createCallback(t,e,3),St(n,function(n,e,r){e=t(n,e,r),e<u&&(u=e,o=n)});return o},J.omit=function(n,t,e){var r={};if(typeof t!="function"){var u=[];g(n,function(n,t){u.push(t)});for(var u=rt(u,ut(arguments,true,false,1)),o=-1,i=u.length;++o<i;){var a=u[o];r[a]=n[a]}}else t=J.createCallback(t,e,3),g(n,function(n,e,u){t(n,e,u)||(r[e]=n) -});return r},J.once=function(n){var t,e;if(!dt(n))throw new ie;return function(){return t?e:(t=true,e=n.apply(this,arguments),n=null,e)}},J.pairs=function(n){for(var t=-1,e=Fe(n),r=e.length,u=Xt(r);++t<r;){var o=e[t];u[t]=[o,n[o]]}return u},J.partial=function(n){return ct(n,16,p(arguments,1))},J.partialRight=function(n){return ct(n,32,null,p(arguments,1))},J.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=ut(arguments,true,false,1),i=wt(n)?o.length:0;++u<i;){var a=o[u];a in n&&(r[a]=n[a]) -}else t=J.createCallback(t,e,3),g(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},J.pluck=Ve,J.property=Jt,J.pull=function(n){for(var t=arguments,e=0,r=t.length,u=n?n.length:0;++e<r;)for(var o=-1,i=t[e];++o<u;)n[o]===i&&(de.call(n,o--,1),u--);return n},J.range=function(n,t,e){n=+n||0,e=typeof e=="number"?e:+e||1,null==t&&(t=n,n=0);var r=-1;t=Ie(0,se((t-n)/(e||1)));for(var u=Xt(t);++r<t;)u[r]=n,n+=e;return u},J.reject=function(n,t,e){return t=J.createCallback(t,e,3),Nt(n,function(n,e,r){return!t(n,e,r) -})},J.remove=function(n,t,e){var r=-1,u=n?n.length:0,o=[];for(t=J.createCallback(t,e,3);++r<u;)e=n[r],t(e,r,n)&&(o.push(e),de.call(n,r--,1),u--);return o},J.rest=qt,J.shuffle=Tt,J.sortBy=function(n,t,e){var r=-1,o=Te(t),i=n?n.length:0,p=Xt(typeof i=="number"?i:0);for(o||(t=J.createCallback(t,e,3)),St(n,function(n,e,u){var i=p[++r]=f();o?i.m=Rt(t,function(t){return n[t]}):(i.m=a())[0]=t(n,e,u),i.n=r,i.o=n}),i=p.length,p.sort(u);i--;)n=p[i],p[i]=n.o,o||l(n.m),c(n);return p},J.tap=function(n,t){return t(n),n -},J.throttle=function(n,t,e){var r=true,u=true;if(!dt(n))throw new ie;return false===e?r=false:wt(e)&&(r="leading"in e?e.leading:r,u="trailing"in e?e.trailing:u),L.leading=r,L.maxWait=t,L.trailing=u,Vt(n,t,L)},J.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Xt(n);for(t=tt(t,e,1);++r<n;)u[r]=t(r);return u},J.toArray=function(n){return n&&typeof n.length=="number"?p(n):xt(n)},J.transform=function(n,t,e,r){var u=Te(n);if(null==e)if(u)e=[];else{var o=n&&n.constructor;e=nt(o&&o.prototype)}return t&&(t=J.createCallback(t,r,4),(u?St:h)(n,function(n,r,u){return t(e,n,r,u) -})),e},J.union=function(){return ft(ut(arguments,true,true))},J.uniq=Pt,J.values=xt,J.where=Nt,J.without=function(n){return rt(n,p(arguments,1))},J.wrap=function(n,t){return ct(t,16,[n])},J.xor=function(){for(var n=-1,t=arguments.length;++n<t;){var e=arguments[n];if(Te(e)||yt(e))var r=r?ft(rt(r,e).concat(rt(e,r))):e}return r||[]},J.zip=Kt,J.zipObject=Lt,J.collect=Rt,J.drop=qt,J.each=St,J.eachRight=Et,J.extend=U,J.methods=bt,J.object=Lt,J.select=Nt,J.tail=qt,J.unique=Pt,J.unzip=Kt,Gt(J),J.clone=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=t,t=false),Z(n,t,typeof e=="function"&&tt(e,r,1)) -},J.cloneDeep=function(n,t,e){return Z(n,true,typeof t=="function"&&tt(t,e,1))},J.contains=Ct,J.escape=function(n){return null==n?"":oe(n).replace(ze,pt)},J.every=Ot,J.find=It,J.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=J.createCallback(t,e,3);++r<u;)if(t(n[r],r,n))return r;return-1},J.findKey=function(n,t,e){var r;return t=J.createCallback(t,e,3),h(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},J.findLast=function(n,t,e){var r;return t=J.createCallback(t,e,3),Et(n,function(n,e,u){return t(n,e,u)?(r=n,false):void 0 -}),r},J.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=J.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},J.findLastKey=function(n,t,e){var r;return t=J.createCallback(t,e,3),mt(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},J.has=function(n,t){return n?me.call(n,t):false},J.identity=Ut,J.indexOf=Wt,J.isArguments=yt,J.isArray=Te,J.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&ce.call(n)==T||false},J.isDate=function(n){return n&&typeof n=="object"&&ce.call(n)==F||false -},J.isElement=function(n){return n&&1===n.nodeType||false},J.isEmpty=function(n){var t=true;if(!n)return t;var e=ce.call(n),r=n.length;return e==$||e==P||e==D||e==q&&typeof r=="number"&&dt(n.splice)?!r:(h(n,function(){return t=false}),t)},J.isEqual=function(n,t,e,r){return ot(n,t,typeof e=="function"&&tt(e,r,2))},J.isFinite=function(n){return Ce(n)&&!Oe(parseFloat(n))},J.isFunction=dt,J.isNaN=function(n){return jt(n)&&n!=+n},J.isNull=function(n){return null===n},J.isNumber=jt,J.isObject=wt,J.isPlainObject=Pe,J.isRegExp=function(n){return n&&typeof n=="object"&&ce.call(n)==z||false -},J.isString=kt,J.isUndefined=function(n){return typeof n=="undefined"},J.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Ie(0,r+e):Se(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},J.mixin=Gt,J.noConflict=function(){return e._=le,this},J.noop=Ht,J.now=Ue,J.parseInt=Ge,J.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=Re(),Se(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):at(n,t) -},J.reduce=Dt,J.reduceRight=$t,J.result=function(n,t){if(n){var e=n[t];return dt(e)?n[t]():e}},J.runInContext=s,J.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Fe(n).length},J.some=Ft,J.sortedIndex=zt,J.template=function(n,t,e){var r=J.templateSettings;n=oe(n||""),e=_({},e,r);var u,o=_({},e.imports,r.imports),r=Fe(o),o=xt(o),a=0,f=e.interpolate||S,l="__p+='",f=ue((e.escape||S).source+"|"+f.source+"|"+(f===N?x:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(a,c).replace(R,i),e&&(l+="'+__e("+e+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t -}),l+="';",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(w,""):l).replace(j,"$1").replace(k,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=ne(r,"return "+l).apply(v,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},J.unescape=function(n){return null==n?"":oe(n).replace(qe,gt)},J.uniqueId=function(n){var t=++y;return oe(null==n?"":n)+t -},J.all=Ot,J.any=Ft,J.detect=It,J.findWhere=It,J.foldl=Dt,J.foldr=$t,J.include=Ct,J.inject=Dt,Gt(function(){var n={};return h(J,function(t,e){J.prototype[e]||(n[e]=t)}),n}(),false),J.first=Bt,J.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=J.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return p(n,Ie(0,u-r))},J.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=xt(n)),null==t||e?n?n[at(0,n.length-1)]:v:(n=Tt(n),n.length=Se(Ie(0,t),n.length),n) -},J.take=Bt,J.head=Bt,h(J,function(n,t){var e="sample"!==t;J.prototype[t]||(J.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new Q(o,u):o})}),J.VERSION="2.4.1",J.prototype.chain=function(){return this.__chain__=true,this},J.prototype.toString=function(){return oe(this.__wrapped__)},J.prototype.value=Qt,J.prototype.valueOf=Qt,St(["join","pop","shift"],function(n){var t=ae[n];J.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); -return n?new Q(e,n):e}}),St(["push","reverse","sort","unshift"],function(n){var t=ae[n];J.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),St(["concat","slice","splice"],function(n){var t=ae[n];J.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments),this.__chain__)}}),J}var v,h=[],g=[],y=0,m=+new Date+"",b=75,_=40,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",w=/\b__p\+='';/g,j=/\b(__p\+=)''\+/g,k=/(__e\(.*?\)|\b__t\))\+'';/g,x=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,C=/\w*$/,O=/^\s*function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,I=RegExp("^["+d+"]*0+(?=.$)"),S=/($^)/,E=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,A="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setTimeout".split(" "),D="[object Arguments]",$="[object Array]",T="[object Boolean]",F="[object Date]",B="[object Function]",W="[object Number]",q="[object Object]",z="[object RegExp]",P="[object String]",K={}; -K[B]=false,K[D]=K[$]=K[T]=K[F]=K[W]=K[q]=K[z]=K[P]=true;var L={leading:false,maxWait:0,trailing:false},M={configurable:false,enumerable:false,value:null,writable:false},V={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},U={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},G=V[typeof window]&&window||this,H=V[typeof exports]&&exports&&!exports.nodeType&&exports,J=V[typeof module]&&module&&!module.nodeType&&module,Q=J&&J.exports===H&&H,X=V[typeof global]&&global;!X||X.global!==X&&X.window!==X||(G=X); -var Y=s();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(G._=Y, define(function(){return Y})):H&&J?Q?(J.exports=Y)._=Y:H._=Y:G._=Y}).call(this); \ No newline at end of file diff --git a/libs/plasio/vendor/three.js b/libs/plasio/vendor/three.js deleted file mode 100644 index 80a5354a..00000000 --- a/libs/plasio/vendor/three.js +++ /dev/null @@ -1,37760 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * @author Larry Battle / http://bateru.com/news - * @author bhouston / http://exocortex.com - */ - -var THREE = { REVISION: '66' }; - -self.console = self.console || { - - info: function () {}, - log: function () {}, - debug: function () {}, - warn: function () {}, - error: function () {} - -}; - -// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ -// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating - -// requestAnimationFrame polyfill by Erik Möller -// fixes from Paul Irish and Tino Zijdel -// using 'self' instead of 'window' for compatibility with both NodeJS and IE10. -( function () { - - var lastTime = 0; - var vendors = [ 'ms', 'moz', 'webkit', 'o' ]; - - for ( var x = 0; x < vendors.length && !self.requestAnimationFrame; ++ x ) { - - self.requestAnimationFrame = self[ vendors[ x ] + 'RequestAnimationFrame' ]; - self.cancelAnimationFrame = self[ vendors[ x ] + 'CancelAnimationFrame' ] || self[ vendors[ x ] + 'CancelRequestAnimationFrame' ]; - - } - - if ( self.requestAnimationFrame === undefined && self['setTimeout'] !== undefined ) { - - self.requestAnimationFrame = function ( callback ) { - - var currTime = Date.now(), timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ); - var id = self.setTimeout( function() { callback( currTime + timeToCall ); }, timeToCall ); - lastTime = currTime + timeToCall; - return id; - - }; - - } - - if( self.cancelAnimationFrame === undefined && self['clearTimeout'] !== undefined ) { - - self.cancelAnimationFrame = function ( id ) { self.clearTimeout( id ) }; - - } - -}() ); - -// GL STATE CONSTANTS - -THREE.CullFaceNone = 0; -THREE.CullFaceBack = 1; -THREE.CullFaceFront = 2; -THREE.CullFaceFrontBack = 3; - -THREE.FrontFaceDirectionCW = 0; -THREE.FrontFaceDirectionCCW = 1; - -// SHADOWING TYPES - -THREE.BasicShadowMap = 0; -THREE.PCFShadowMap = 1; -THREE.PCFSoftShadowMap = 2; - -// MATERIAL CONSTANTS - -// side - -THREE.FrontSide = 0; -THREE.BackSide = 1; -THREE.DoubleSide = 2; - -// shading - -THREE.NoShading = 0; -THREE.FlatShading = 1; -THREE.SmoothShading = 2; - -// colors - -THREE.NoColors = 0; -THREE.FaceColors = 1; -THREE.VertexColors = 2; - -// blending modes - -THREE.NoBlending = 0; -THREE.NormalBlending = 1; -THREE.AdditiveBlending = 2; -THREE.SubtractiveBlending = 3; -THREE.MultiplyBlending = 4; -THREE.CustomBlending = 5; - -// custom blending equations -// (numbers start from 100 not to clash with other -// mappings to OpenGL constants defined in Texture.js) - -THREE.AddEquation = 100; -THREE.SubtractEquation = 101; -THREE.ReverseSubtractEquation = 102; - -// custom blending destination factors - -THREE.ZeroFactor = 200; -THREE.OneFactor = 201; -THREE.SrcColorFactor = 202; -THREE.OneMinusSrcColorFactor = 203; -THREE.SrcAlphaFactor = 204; -THREE.OneMinusSrcAlphaFactor = 205; -THREE.DstAlphaFactor = 206; -THREE.OneMinusDstAlphaFactor = 207; - -// custom blending source factors - -//THREE.ZeroFactor = 200; -//THREE.OneFactor = 201; -//THREE.SrcAlphaFactor = 204; -//THREE.OneMinusSrcAlphaFactor = 205; -//THREE.DstAlphaFactor = 206; -//THREE.OneMinusDstAlphaFactor = 207; -THREE.DstColorFactor = 208; -THREE.OneMinusDstColorFactor = 209; -THREE.SrcAlphaSaturateFactor = 210; - - -// TEXTURE CONSTANTS - -THREE.MultiplyOperation = 0; -THREE.MixOperation = 1; -THREE.AddOperation = 2; - -// Mapping modes - -THREE.UVMapping = function () {}; - -THREE.CubeReflectionMapping = function () {}; -THREE.CubeRefractionMapping = function () {}; - -THREE.SphericalReflectionMapping = function () {}; -THREE.SphericalRefractionMapping = function () {}; - -// Wrapping modes - -THREE.RepeatWrapping = 1000; -THREE.ClampToEdgeWrapping = 1001; -THREE.MirroredRepeatWrapping = 1002; - -// Filters - -THREE.NearestFilter = 1003; -THREE.NearestMipMapNearestFilter = 1004; -THREE.NearestMipMapLinearFilter = 1005; -THREE.LinearFilter = 1006; -THREE.LinearMipMapNearestFilter = 1007; -THREE.LinearMipMapLinearFilter = 1008; - -// Data types - -THREE.UnsignedByteType = 1009; -THREE.ByteType = 1010; -THREE.ShortType = 1011; -THREE.UnsignedShortType = 1012; -THREE.IntType = 1013; -THREE.UnsignedIntType = 1014; -THREE.FloatType = 1015; - -// Pixel types - -//THREE.UnsignedByteType = 1009; -THREE.UnsignedShort4444Type = 1016; -THREE.UnsignedShort5551Type = 1017; -THREE.UnsignedShort565Type = 1018; - -// Pixel formats - -THREE.AlphaFormat = 1019; -THREE.RGBFormat = 1020; -THREE.RGBAFormat = 1021; -THREE.LuminanceFormat = 1022; -THREE.LuminanceAlphaFormat = 1023; - -// Compressed texture formats - -THREE.RGB_S3TC_DXT1_Format = 2001; -THREE.RGBA_S3TC_DXT1_Format = 2002; -THREE.RGBA_S3TC_DXT3_Format = 2003; -THREE.RGBA_S3TC_DXT5_Format = 2004; - -/* -// Potential future PVRTC compressed texture formats -THREE.RGB_PVRTC_4BPPV1_Format = 2100; -THREE.RGB_PVRTC_2BPPV1_Format = 2101; -THREE.RGBA_PVRTC_4BPPV1_Format = 2102; -THREE.RGBA_PVRTC_2BPPV1_Format = 2103; -*/ - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Color = function ( color ) { - - if ( arguments.length === 3 ) { - - return this.setRGB( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] ); - - } - - return this.set( color ) - -}; - -THREE.Color.prototype = { - - constructor: THREE.Color, - - r: 1, g: 1, b: 1, - - set: function ( value ) { - - if ( value instanceof THREE.Color ) { - - this.copy( value ); - - } else if ( typeof value === 'number' ) { - - this.setHex( value ); - - } else if ( typeof value === 'string' ) { - - this.setStyle( value ); - - } - - return this; - - }, - - setHex: function ( hex ) { - - hex = Math.floor( hex ); - - this.r = ( hex >> 16 & 255 ) / 255; - this.g = ( hex >> 8 & 255 ) / 255; - this.b = ( hex & 255 ) / 255; - - return this; - - }, - - setRGB: function ( r, g, b ) { - - this.r = r; - this.g = g; - this.b = b; - - return this; - - }, - - setHSL: function ( h, s, l ) { - - // h,s,l ranges are in 0.0 - 1.0 - - if ( s === 0 ) { - - this.r = this.g = this.b = l; - - } else { - - var hue2rgb = function ( p, q, t ) { - - if ( t < 0 ) t += 1; - if ( t > 1 ) t -= 1; - if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t; - if ( t < 1 / 2 ) return q; - if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t ); - return p; - - }; - - var p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s ); - var q = ( 2 * l ) - p; - - this.r = hue2rgb( q, p, h + 1 / 3 ); - this.g = hue2rgb( q, p, h ); - this.b = hue2rgb( q, p, h - 1 / 3 ); - - } - - return this; - - }, - - setStyle: function ( style ) { - - // rgb(255,0,0) - - if ( /^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test( style ) ) { - - var color = /^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec( style ); - - this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255; - this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255; - this.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255; - - return this; - - } - - // rgb(100%,0%,0%) - - if ( /^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test( style ) ) { - - var color = /^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec( style ); - - this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100; - this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100; - this.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100; - - return this; - - } - - // #ff0000 - - if ( /^\#([0-9a-f]{6})$/i.test( style ) ) { - - var color = /^\#([0-9a-f]{6})$/i.exec( style ); - - this.setHex( parseInt( color[ 1 ], 16 ) ); - - return this; - - } - - // #f00 - - if ( /^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test( style ) ) { - - var color = /^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec( style ); - - this.setHex( parseInt( color[ 1 ] + color[ 1 ] + color[ 2 ] + color[ 2 ] + color[ 3 ] + color[ 3 ], 16 ) ); - - return this; - - } - - // red - - if ( /^(\w+)$/i.test( style ) ) { - - this.setHex( THREE.ColorKeywords[ style ] ); - - return this; - - } - - - }, - - copy: function ( color ) { - - this.r = color.r; - this.g = color.g; - this.b = color.b; - - return this; - - }, - - copyGammaToLinear: function ( color ) { - - this.r = color.r * color.r; - this.g = color.g * color.g; - this.b = color.b * color.b; - - return this; - - }, - - copyLinearToGamma: function ( color ) { - - this.r = Math.sqrt( color.r ); - this.g = Math.sqrt( color.g ); - this.b = Math.sqrt( color.b ); - - return this; - - }, - - convertGammaToLinear: function () { - - var r = this.r, g = this.g, b = this.b; - - this.r = r * r; - this.g = g * g; - this.b = b * b; - - return this; - - }, - - convertLinearToGamma: function () { - - this.r = Math.sqrt( this.r ); - this.g = Math.sqrt( this.g ); - this.b = Math.sqrt( this.b ); - - return this; - - }, - - getHex: function () { - - return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0; - - }, - - getHexString: function () { - - return ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 ); - - }, - - getHSL: function ( optionalTarget ) { - - // h,s,l ranges are in 0.0 - 1.0 - - var hsl = optionalTarget || { h: 0, s: 0, l: 0 }; - - var r = this.r, g = this.g, b = this.b; - - var max = Math.max( r, g, b ); - var min = Math.min( r, g, b ); - - var hue, saturation; - var lightness = ( min + max ) / 2.0; - - if ( min === max ) { - - hue = 0; - saturation = 0; - - } else { - - var delta = max - min; - - saturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min ); - - switch ( max ) { - - case r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break; - case g: hue = ( b - r ) / delta + 2; break; - case b: hue = ( r - g ) / delta + 4; break; - - } - - hue /= 6; - - } - - hsl.h = hue; - hsl.s = saturation; - hsl.l = lightness; - - return hsl; - - }, - - getStyle: function () { - - return 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')'; - - }, - - offsetHSL: function ( h, s, l ) { - - var hsl = this.getHSL(); - - hsl.h += h; hsl.s += s; hsl.l += l; - - this.setHSL( hsl.h, hsl.s, hsl.l ); - - return this; - - }, - - add: function ( color ) { - - this.r += color.r; - this.g += color.g; - this.b += color.b; - - return this; - - }, - - addColors: function ( color1, color2 ) { - - this.r = color1.r + color2.r; - this.g = color1.g + color2.g; - this.b = color1.b + color2.b; - - return this; - - }, - - addScalar: function ( s ) { - - this.r += s; - this.g += s; - this.b += s; - - return this; - - }, - - multiply: function ( color ) { - - this.r *= color.r; - this.g *= color.g; - this.b *= color.b; - - return this; - - }, - - multiplyScalar: function ( s ) { - - this.r *= s; - this.g *= s; - this.b *= s; - - return this; - - }, - - lerp: function ( color, alpha ) { - - this.r += ( color.r - this.r ) * alpha; - this.g += ( color.g - this.g ) * alpha; - this.b += ( color.b - this.b ) * alpha; - - return this; - - }, - - equals: function ( c ) { - - return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b ); - - }, - - fromArray: function ( array ) { - - this.r = array[ 0 ]; - this.g = array[ 1 ]; - this.b = array[ 2 ]; - - return this; - - }, - - toArray: function () { - - return [ this.r, this.g, this.b ]; - - }, - - clone: function () { - - return new THREE.Color().setRGB( this.r, this.g, this.b ); - - } - -}; - -THREE.ColorKeywords = { "aliceblue": 0xF0F8FF, "antiquewhite": 0xFAEBD7, "aqua": 0x00FFFF, "aquamarine": 0x7FFFD4, "azure": 0xF0FFFF, -"beige": 0xF5F5DC, "bisque": 0xFFE4C4, "black": 0x000000, "blanchedalmond": 0xFFEBCD, "blue": 0x0000FF, "blueviolet": 0x8A2BE2, -"brown": 0xA52A2A, "burlywood": 0xDEB887, "cadetblue": 0x5F9EA0, "chartreuse": 0x7FFF00, "chocolate": 0xD2691E, "coral": 0xFF7F50, -"cornflowerblue": 0x6495ED, "cornsilk": 0xFFF8DC, "crimson": 0xDC143C, "cyan": 0x00FFFF, "darkblue": 0x00008B, "darkcyan": 0x008B8B, -"darkgoldenrod": 0xB8860B, "darkgray": 0xA9A9A9, "darkgreen": 0x006400, "darkgrey": 0xA9A9A9, "darkkhaki": 0xBDB76B, "darkmagenta": 0x8B008B, -"darkolivegreen": 0x556B2F, "darkorange": 0xFF8C00, "darkorchid": 0x9932CC, "darkred": 0x8B0000, "darksalmon": 0xE9967A, "darkseagreen": 0x8FBC8F, -"darkslateblue": 0x483D8B, "darkslategray": 0x2F4F4F, "darkslategrey": 0x2F4F4F, "darkturquoise": 0x00CED1, "darkviolet": 0x9400D3, -"deeppink": 0xFF1493, "deepskyblue": 0x00BFFF, "dimgray": 0x696969, "dimgrey": 0x696969, "dodgerblue": 0x1E90FF, "firebrick": 0xB22222, -"floralwhite": 0xFFFAF0, "forestgreen": 0x228B22, "fuchsia": 0xFF00FF, "gainsboro": 0xDCDCDC, "ghostwhite": 0xF8F8FF, "gold": 0xFFD700, -"goldenrod": 0xDAA520, "gray": 0x808080, "green": 0x008000, "greenyellow": 0xADFF2F, "grey": 0x808080, "honeydew": 0xF0FFF0, "hotpink": 0xFF69B4, -"indianred": 0xCD5C5C, "indigo": 0x4B0082, "ivory": 0xFFFFF0, "khaki": 0xF0E68C, "lavender": 0xE6E6FA, "lavenderblush": 0xFFF0F5, "lawngreen": 0x7CFC00, -"lemonchiffon": 0xFFFACD, "lightblue": 0xADD8E6, "lightcoral": 0xF08080, "lightcyan": 0xE0FFFF, "lightgoldenrodyellow": 0xFAFAD2, "lightgray": 0xD3D3D3, -"lightgreen": 0x90EE90, "lightgrey": 0xD3D3D3, "lightpink": 0xFFB6C1, "lightsalmon": 0xFFA07A, "lightseagreen": 0x20B2AA, "lightskyblue": 0x87CEFA, -"lightslategray": 0x778899, "lightslategrey": 0x778899, "lightsteelblue": 0xB0C4DE, "lightyellow": 0xFFFFE0, "lime": 0x00FF00, "limegreen": 0x32CD32, -"linen": 0xFAF0E6, "magenta": 0xFF00FF, "maroon": 0x800000, "mediumaquamarine": 0x66CDAA, "mediumblue": 0x0000CD, "mediumorchid": 0xBA55D3, -"mediumpurple": 0x9370DB, "mediumseagreen": 0x3CB371, "mediumslateblue": 0x7B68EE, "mediumspringgreen": 0x00FA9A, "mediumturquoise": 0x48D1CC, -"mediumvioletred": 0xC71585, "midnightblue": 0x191970, "mintcream": 0xF5FFFA, "mistyrose": 0xFFE4E1, "moccasin": 0xFFE4B5, "navajowhite": 0xFFDEAD, -"navy": 0x000080, "oldlace": 0xFDF5E6, "olive": 0x808000, "olivedrab": 0x6B8E23, "orange": 0xFFA500, "orangered": 0xFF4500, "orchid": 0xDA70D6, -"palegoldenrod": 0xEEE8AA, "palegreen": 0x98FB98, "paleturquoise": 0xAFEEEE, "palevioletred": 0xDB7093, "papayawhip": 0xFFEFD5, "peachpuff": 0xFFDAB9, -"peru": 0xCD853F, "pink": 0xFFC0CB, "plum": 0xDDA0DD, "powderblue": 0xB0E0E6, "purple": 0x800080, "red": 0xFF0000, "rosybrown": 0xBC8F8F, -"royalblue": 0x4169E1, "saddlebrown": 0x8B4513, "salmon": 0xFA8072, "sandybrown": 0xF4A460, "seagreen": 0x2E8B57, "seashell": 0xFFF5EE, -"sienna": 0xA0522D, "silver": 0xC0C0C0, "skyblue": 0x87CEEB, "slateblue": 0x6A5ACD, "slategray": 0x708090, "slategrey": 0x708090, "snow": 0xFFFAFA, -"springgreen": 0x00FF7F, "steelblue": 0x4682B4, "tan": 0xD2B48C, "teal": 0x008080, "thistle": 0xD8BFD8, "tomato": 0xFF6347, "turquoise": 0x40E0D0, -"violet": 0xEE82EE, "wheat": 0xF5DEB3, "white": 0xFFFFFF, "whitesmoke": 0xF5F5F5, "yellow": 0xFFFF00, "yellowgreen": 0x9ACD32 }; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://exocortex.com - */ - -THREE.Quaternion = function ( x, y, z, w ) { - - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._w = ( w !== undefined ) ? w : 1; - -}; - -THREE.Quaternion.prototype = { - - constructor: THREE.Quaternion, - - _x: 0,_y: 0, _z: 0, _w: 0, - - _euler: undefined, - - _updateEuler: function ( callback ) { - - if ( this._euler !== undefined ) { - - this._euler.setFromQuaternion( this, undefined, false ); - - } - - }, - - get x () { - - return this._x; - - }, - - set x ( value ) { - - this._x = value; - this._updateEuler(); - - }, - - get y () { - - return this._y; - - }, - - set y ( value ) { - - this._y = value; - this._updateEuler(); - - }, - - get z () { - - return this._z; - - }, - - set z ( value ) { - - this._z = value; - this._updateEuler(); - - }, - - get w () { - - return this._w; - - }, - - set w ( value ) { - - this._w = value; - this._updateEuler(); - - }, - - set: function ( x, y, z, w ) { - - this._x = x; - this._y = y; - this._z = z; - this._w = w; - - this._updateEuler(); - - return this; - - }, - - copy: function ( quaternion ) { - - this._x = quaternion._x; - this._y = quaternion._y; - this._z = quaternion._z; - this._w = quaternion._w; - - this._updateEuler(); - - return this; - - }, - - setFromEuler: function ( euler, update ) { - - if ( euler instanceof THREE.Euler === false ) { - - throw new Error( 'ERROR: Quaternion\'s .setFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' ); - } - - // http://www.mathworks.com/matlabcentral/fileexchange/ - // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ - // content/SpinCalc.m - - var c1 = Math.cos( euler._x / 2 ); - var c2 = Math.cos( euler._y / 2 ); - var c3 = Math.cos( euler._z / 2 ); - var s1 = Math.sin( euler._x / 2 ); - var s2 = Math.sin( euler._y / 2 ); - var s3 = Math.sin( euler._z / 2 ); - - if ( euler.order === 'XYZ' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( euler.order === 'YXZ' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } else if ( euler.order === 'ZXY' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( euler.order === 'ZYX' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } else if ( euler.order === 'YZX' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( euler.order === 'XZY' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } - - if ( update !== false ) this._updateEuler(); - - return this; - - }, - - setFromAxisAngle: function ( axis, angle ) { - - // from http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm - // axis have to be normalized - - var halfAngle = angle / 2, s = Math.sin( halfAngle ); - - this._x = axis.x * s; - this._y = axis.y * s; - this._z = axis.z * s; - this._w = Math.cos( halfAngle ); - - this._updateEuler(); - - return this; - - }, - - setFromRotationMatrix: function ( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var te = m.elements, - - m11 = te[0], m12 = te[4], m13 = te[8], - m21 = te[1], m22 = te[5], m23 = te[9], - m31 = te[2], m32 = te[6], m33 = te[10], - - trace = m11 + m22 + m33, - s; - - if ( trace > 0 ) { - - s = 0.5 / Math.sqrt( trace + 1.0 ); - - this._w = 0.25 / s; - this._x = ( m32 - m23 ) * s; - this._y = ( m13 - m31 ) * s; - this._z = ( m21 - m12 ) * s; - - } else if ( m11 > m22 && m11 > m33 ) { - - s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 ); - - this._w = (m32 - m23 ) / s; - this._x = 0.25 * s; - this._y = (m12 + m21 ) / s; - this._z = (m13 + m31 ) / s; - - } else if ( m22 > m33 ) { - - s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 ); - - this._w = (m13 - m31 ) / s; - this._x = (m12 + m21 ) / s; - this._y = 0.25 * s; - this._z = (m23 + m32 ) / s; - - } else { - - s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 ); - - this._w = ( m21 - m12 ) / s; - this._x = ( m13 + m31 ) / s; - this._y = ( m23 + m32 ) / s; - this._z = 0.25 * s; - - } - - this._updateEuler(); - - return this; - - }, - - inverse: function () { - - this.conjugate().normalize(); - - return this; - - }, - - conjugate: function () { - - this._x *= -1; - this._y *= -1; - this._z *= -1; - - this._updateEuler(); - - return this; - - }, - - lengthSq: function () { - - return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - - }, - - length: function () { - - return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w ); - - }, - - normalize: function () { - - var l = this.length(); - - if ( l === 0 ) { - - this._x = 0; - this._y = 0; - this._z = 0; - this._w = 1; - - } else { - - l = 1 / l; - - this._x = this._x * l; - this._y = this._y * l; - this._z = this._z * l; - this._w = this._w * l; - - } - - return this; - - }, - - multiply: function ( q, p ) { - - if ( p !== undefined ) { - - console.warn( 'DEPRECATED: Quaternion\'s .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' ); - return this.multiplyQuaternions( q, p ); - - } - - return this.multiplyQuaternions( this, q ); - - }, - - multiplyQuaternions: function ( a, b ) { - - // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm - - var qax = a._x, qay = a._y, qaz = a._z, qaw = a._w; - var qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w; - - this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; - this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; - this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; - this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - - this._updateEuler(); - - return this; - - }, - - multiplyVector3: function ( vector ) { - - console.warn( 'DEPRECATED: Quaternion\'s .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' ); - return vector.applyQuaternion( this ); - - }, - - slerp: function ( qb, t ) { - - var x = this._x, y = this._y, z = this._z, w = this._w; - - // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ - - var cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; - - if ( cosHalfTheta < 0 ) { - - this._w = -qb._w; - this._x = -qb._x; - this._y = -qb._y; - this._z = -qb._z; - - cosHalfTheta = -cosHalfTheta; - - } else { - - this.copy( qb ); - - } - - if ( cosHalfTheta >= 1.0 ) { - - this._w = w; - this._x = x; - this._y = y; - this._z = z; - - return this; - - } - - var halfTheta = Math.acos( cosHalfTheta ); - var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); - - if ( Math.abs( sinHalfTheta ) < 0.001 ) { - - this._w = 0.5 * ( w + this._w ); - this._x = 0.5 * ( x + this._x ); - this._y = 0.5 * ( y + this._y ); - this._z = 0.5 * ( z + this._z ); - - return this; - - } - - var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, - ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; - - this._w = ( w * ratioA + this._w * ratioB ); - this._x = ( x * ratioA + this._x * ratioB ); - this._y = ( y * ratioA + this._y * ratioB ); - this._z = ( z * ratioA + this._z * ratioB ); - - this._updateEuler(); - - return this; - - }, - - equals: function ( quaternion ) { - - return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w ); - - }, - - fromArray: function ( array ) { - - this._x = array[ 0 ]; - this._y = array[ 1 ]; - this._z = array[ 2 ]; - this._w = array[ 3 ]; - - this._updateEuler(); - - return this; - - }, - - toArray: function () { - - return [ this._x, this._y, this._z, this._w ]; - - }, - - clone: function () { - - return new THREE.Quaternion( this._x, this._y, this._z, this._w ); - - } - -}; - -THREE.Quaternion.slerp = function ( qa, qb, qm, t ) { - - return qm.copy( qa ).slerp( qb, t ); - -} - -/** - * @author mrdoob / http://mrdoob.com/ - * @author philogb / http://blog.thejit.org/ - * @author egraether / http://egraether.com/ - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - -THREE.Vector2 = function ( x, y ) { - - this.x = x || 0; - this.y = y || 0; - -}; - -THREE.Vector2.prototype = { - - constructor: THREE.Vector2, - - set: function ( x, y ) { - - this.x = x; - this.y = y; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - default: throw new Error( "index is out of range: " + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - default: throw new Error( "index is out of range: " + index ); - - } - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'DEPRECATED: Vector2\'s .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'DEPRECATED: Vector2\'s .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - - return this; - - }, - - multiplyScalar: function ( s ) { - - this.x *= s; - this.y *= s; - - return this; - - }, - - divideScalar: function ( scalar ) { - - if ( scalar !== 0 ) { - - var invScalar = 1 / scalar; - - this.x *= invScalar; - this.y *= invScalar; - - } else { - - this.x = 0; - this.y = 0; - - } - - return this; - - }, - - min: function ( v ) { - - if ( this.x > v.x ) { - - this.x = v.x; - - } - - if ( this.y > v.y ) { - - this.y = v.y; - - } - - return this; - - }, - - max: function ( v ) { - - if ( this.x < v.x ) { - - this.x = v.x; - - } - - if ( this.y < v.y ) { - - this.y = v.y; - - } - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - if ( this.x < min.x ) { - - this.x = min.x; - - } else if ( this.x > max.x ) { - - this.x = max.x; - - } - - if ( this.y < min.y ) { - - this.y = min.y; - - } else if ( this.y > max.y ) { - - this.y = max.y; - - } - - return this; - }, - - clampScalar: ( function () { - - var min, max; - - return function ( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new THREE.Vector2(); - max = new THREE.Vector2(); - - } - - min.set( minVal, minVal ); - max.set( maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - } )(), - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - - return this; - - }, - - negate: function () { - - return this.multiplyScalar( - 1 ); - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - distanceTo: function ( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - }, - - distanceToSquared: function ( v ) { - - var dx = this.x - v.x, dy = this.y - v.y; - return dx * dx + dy * dy; - - }, - - setLength: function ( l ) { - - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - } - - return this; - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - - return this; - - }, - - equals: function( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) ); - - }, - - fromArray: function ( array ) { - - this.x = array[ 0 ]; - this.y = array[ 1 ]; - - return this; - - }, - - toArray: function () { - - return [ this.x, this.y ]; - - }, - - clone: function () { - - return new THREE.Vector2( this.x, this.y ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author *kile / http://kile.stravaganza.org/ - * @author philogb / http://blog.thejit.org/ - * @author mikael emtinger / http://gomo.se/ - * @author egraether / http://egraether.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Vector3 = function ( x, y, z ) { - - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - -}; - -THREE.Vector3.prototype = { - - constructor: THREE.Vector3, - - set: function ( x, y, z ) { - - this.x = x; - this.y = y; - this.z = z; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setZ: function ( z ) { - - this.z = z; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - default: throw new Error( "index is out of range: " + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - default: throw new Error( "index is out of range: " + index ); - - } - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'DEPRECATED: Vector3\'s .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - this.z += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'DEPRECATED: Vector3\'s .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - - return this; - - }, - - multiply: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'DEPRECATED: Vector3\'s .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' ); - return this.multiplyVectors( v, w ); - - } - - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - - return this; - - }, - - multiplyVectors: function ( a, b ) { - - this.x = a.x * b.x; - this.y = a.y * b.y; - this.z = a.z * b.z; - - return this; - - }, - - applyEuler: function () { - - var quaternion; - - return function ( euler ) { - - if ( euler instanceof THREE.Euler === false ) { - - console.error( 'ERROR: Vector3\'s .applyEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' ); - - } - - if ( quaternion === undefined ) quaternion = new THREE.Quaternion(); - - this.applyQuaternion( quaternion.setFromEuler( euler ) ); - - return this; - - }; - - }(), - - applyAxisAngle: function () { - - var quaternion; - - return function ( axis, angle ) { - - if ( quaternion === undefined ) quaternion = new THREE.Quaternion(); - - this.applyQuaternion( quaternion.setFromAxisAngle( axis, angle ) ); - - return this; - - }; - - }(), - - applyMatrix3: function ( m ) { - - var x = this.x; - var y = this.y; - var z = this.z; - - var e = m.elements; - - this.x = e[0] * x + e[3] * y + e[6] * z; - this.y = e[1] * x + e[4] * y + e[7] * z; - this.z = e[2] * x + e[5] * y + e[8] * z; - - return this; - - }, - - applyMatrix4: function ( m ) { - - // input: THREE.Matrix4 affine matrix - - var x = this.x, y = this.y, z = this.z; - - var e = m.elements; - - this.x = e[0] * x + e[4] * y + e[8] * z + e[12]; - this.y = e[1] * x + e[5] * y + e[9] * z + e[13]; - this.z = e[2] * x + e[6] * y + e[10] * z + e[14]; - - return this; - - }, - - applyProjection: function ( m ) { - - // input: THREE.Matrix4 projection matrix - - var x = this.x, y = this.y, z = this.z; - - var e = m.elements; - var d = 1 / ( e[3] * x + e[7] * y + e[11] * z + e[15] ); // perspective divide - - this.x = ( e[0] * x + e[4] * y + e[8] * z + e[12] ) * d; - this.y = ( e[1] * x + e[5] * y + e[9] * z + e[13] ) * d; - this.z = ( e[2] * x + e[6] * y + e[10] * z + e[14] ) * d; - - return this; - - }, - - applyQuaternion: function ( q ) { - - var x = this.x; - var y = this.y; - var z = this.z; - - var qx = q.x; - var qy = q.y; - var qz = q.z; - var qw = q.w; - - // calculate quat * vector - - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; - - // calculate result * inverse quat - - this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; - this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; - this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; - - return this; - - }, - - transformDirection: function ( m ) { - - // input: THREE.Matrix4 affine matrix - // vector interpreted as a direction - - var x = this.x, y = this.y, z = this.z; - - var e = m.elements; - - this.x = e[0] * x + e[4] * y + e[8] * z; - this.y = e[1] * x + e[5] * y + e[9] * z; - this.z = e[2] * x + e[6] * y + e[10] * z; - - this.normalize(); - - return this; - - }, - - divide: function ( v ) { - - this.x /= v.x; - this.y /= v.y; - this.z /= v.z; - - return this; - - }, - - divideScalar: function ( scalar ) { - - if ( scalar !== 0 ) { - - var invScalar = 1 / scalar; - - this.x *= invScalar; - this.y *= invScalar; - this.z *= invScalar; - - } else { - - this.x = 0; - this.y = 0; - this.z = 0; - - } - - return this; - - }, - - min: function ( v ) { - - if ( this.x > v.x ) { - - this.x = v.x; - - } - - if ( this.y > v.y ) { - - this.y = v.y; - - } - - if ( this.z > v.z ) { - - this.z = v.z; - - } - - return this; - - }, - - max: function ( v ) { - - if ( this.x < v.x ) { - - this.x = v.x; - - } - - if ( this.y < v.y ) { - - this.y = v.y; - - } - - if ( this.z < v.z ) { - - this.z = v.z; - - } - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - if ( this.x < min.x ) { - - this.x = min.x; - - } else if ( this.x > max.x ) { - - this.x = max.x; - - } - - if ( this.y < min.y ) { - - this.y = min.y; - - } else if ( this.y > max.y ) { - - this.y = max.y; - - } - - if ( this.z < min.z ) { - - this.z = min.z; - - } else if ( this.z > max.z ) { - - this.z = max.z; - - } - - return this; - - }, - - clampScalar: ( function () { - - var min, max; - - return function ( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new THREE.Vector3(); - max = new THREE.Vector3(); - - } - - min.set( minVal, minVal, minVal ); - max.set( maxVal, maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - } )(), - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - - return this; - - }, - - negate: function () { - - return this.multiplyScalar( - 1 ); - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y + this.z * this.z; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); - - }, - - lengthManhattan: function () { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - setLength: function ( l ) { - - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - } - - return this; - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - - return this; - - }, - - cross: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'DEPRECATED: Vector3\'s .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' ); - return this.crossVectors( v, w ); - - } - - var x = this.x, y = this.y, z = this.z; - - this.x = y * v.z - z * v.y; - this.y = z * v.x - x * v.z; - this.z = x * v.y - y * v.x; - - return this; - - }, - - crossVectors: function ( a, b ) { - - var ax = a.x, ay = a.y, az = a.z; - var bx = b.x, by = b.y, bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - - }, - - projectOnVector: function () { - - var v1, dot; - - return function ( vector ) { - - if ( v1 === undefined ) v1 = new THREE.Vector3(); - - v1.copy( vector ).normalize(); - - dot = this.dot( v1 ); - - return this.copy( v1 ).multiplyScalar( dot ); - - }; - - }(), - - projectOnPlane: function () { - - var v1; - - return function ( planeNormal ) { - - if ( v1 === undefined ) v1 = new THREE.Vector3(); - - v1.copy( this ).projectOnVector( planeNormal ); - - return this.sub( v1 ); - - } - - }(), - - reflect: function () { - - // reflect incident vector off plane orthogonal to normal - // normal is assumed to have unit length - - var v1; - - return function ( normal ) { - - if ( v1 === undefined ) v1 = new THREE.Vector3(); - - return this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) ); - - } - - }(), - - angleTo: function ( v ) { - - var theta = this.dot( v ) / ( this.length() * v.length() ); - - // clamp, to handle numerical problems - - return Math.acos( THREE.Math.clamp( theta, -1, 1 ) ); - - }, - - distanceTo: function ( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - }, - - distanceToSquared: function ( v ) { - - var dx = this.x - v.x; - var dy = this.y - v.y; - var dz = this.z - v.z; - - return dx * dx + dy * dy + dz * dz; - - }, - - setEulerFromRotationMatrix: function ( m, order ) { - - console.error( "REMOVED: Vector3\'s setEulerFromRotationMatrix has been removed in favor of Euler.setFromRotationMatrix(), please update your code."); - - }, - - setEulerFromQuaternion: function ( q, order ) { - - console.error( "REMOVED: Vector3\'s setEulerFromQuaternion: has been removed in favor of Euler.setFromQuaternion(), please update your code."); - - }, - - getPositionFromMatrix: function ( m ) { - - console.warn( "DEPRECATED: Vector3\'s .getPositionFromMatrix() has been renamed to .setFromMatrixPosition(). Please update your code." ); - - return this.setFromMatrixPosition( m ); - - }, - - getScaleFromMatrix: function ( m ) { - - console.warn( "DEPRECATED: Vector3\'s .getScaleFromMatrix() has been renamed to .setFromMatrixScale(). Please update your code." ); - - return this.setFromMatrixScale( m ); - }, - - getColumnFromMatrix: function ( index, matrix ) { - - console.warn( "DEPRECATED: Vector3\'s .getColumnFromMatrix() has been renamed to .setFromMatrixColumn(). Please update your code." ); - - return this.setFromMatrixColumn( index, matrix ); - - }, - - setFromMatrixPosition: function ( m ) { - - this.x = m.elements[ 12 ]; - this.y = m.elements[ 13 ]; - this.z = m.elements[ 14 ]; - - return this; - - }, - - setFromMatrixScale: function ( m ) { - - var sx = this.set( m.elements[ 0 ], m.elements[ 1 ], m.elements[ 2 ] ).length(); - var sy = this.set( m.elements[ 4 ], m.elements[ 5 ], m.elements[ 6 ] ).length(); - var sz = this.set( m.elements[ 8 ], m.elements[ 9 ], m.elements[ 10 ] ).length(); - - this.x = sx; - this.y = sy; - this.z = sz; - - return this; - }, - - setFromMatrixColumn: function ( index, matrix ) { - - var offset = index * 4; - - var me = matrix.elements; - - this.x = me[ offset ]; - this.y = me[ offset + 1 ]; - this.z = me[ offset + 2 ]; - - return this; - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) ); - - }, - - fromArray: function ( array ) { - - this.x = array[ 0 ]; - this.y = array[ 1 ]; - this.z = array[ 2 ]; - - return this; - - }, - - toArray: function () { - - return [ this.x, this.y, this.z ]; - - }, - - clone: function () { - - return new THREE.Vector3( this.x, this.y, this.z ); - - } - -}; -/** - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author philogb / http://blog.thejit.org/ - * @author mikael emtinger / http://gomo.se/ - * @author egraether / http://egraether.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Vector4 = function ( x, y, z, w ) { - - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = ( w !== undefined ) ? w : 1; - -}; - -THREE.Vector4.prototype = { - - constructor: THREE.Vector4, - - set: function ( x, y, z, w ) { - - this.x = x; - this.y = y; - this.z = z; - this.w = w; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setZ: function ( z ) { - - this.z = z; - - return this; - - }, - - setW: function ( w ) { - - this.w = w; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - case 3: this.w = value; break; - default: throw new Error( "index is out of range: " + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - case 3: return this.w; - default: throw new Error( "index is out of range: " + index ); - - } - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - this.w = ( v.w !== undefined ) ? v.w : 1; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'DEPRECATED: Vector4\'s .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - this.z += s; - this.w += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - this.w = a.w + b.w; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'DEPRECATED: Vector4\'s .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - this.w = a.w - b.w; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - this.w *= scalar; - - return this; - - }, - - applyMatrix4: function ( m ) { - - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - var e = m.elements; - - this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w; - this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w; - this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w; - this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w; - - return this; - - }, - - divideScalar: function ( scalar ) { - - if ( scalar !== 0 ) { - - var invScalar = 1 / scalar; - - this.x *= invScalar; - this.y *= invScalar; - this.z *= invScalar; - this.w *= invScalar; - - } else { - - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - } - - return this; - - }, - - setAxisAngleFromQuaternion: function ( q ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm - - // q is assumed to be normalized - - this.w = 2 * Math.acos( q.w ); - - var s = Math.sqrt( 1 - q.w * q.w ); - - if ( s < 0.0001 ) { - - this.x = 1; - this.y = 0; - this.z = 0; - - } else { - - this.x = q.x / s; - this.y = q.y / s; - this.z = q.z / s; - - } - - return this; - - }, - - setAxisAngleFromRotationMatrix: function ( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var angle, x, y, z, // variables for result - epsilon = 0.01, // margin to allow for rounding errors - epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees - - te = m.elements, - - m11 = te[0], m12 = te[4], m13 = te[8], - m21 = te[1], m22 = te[5], m23 = te[9], - m31 = te[2], m32 = te[6], m33 = te[10]; - - if ( ( Math.abs( m12 - m21 ) < epsilon ) - && ( Math.abs( m13 - m31 ) < epsilon ) - && ( Math.abs( m23 - m32 ) < epsilon ) ) { - - // singularity found - // first check for identity matrix which must have +1 for all terms - // in leading diagonal and zero in other terms - - if ( ( Math.abs( m12 + m21 ) < epsilon2 ) - && ( Math.abs( m13 + m31 ) < epsilon2 ) - && ( Math.abs( m23 + m32 ) < epsilon2 ) - && ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) { - - // this singularity is identity matrix so angle = 0 - - this.set( 1, 0, 0, 0 ); - - return this; // zero angle, arbitrary axis - - } - - // otherwise this singularity is angle = 180 - - angle = Math.PI; - - var xx = ( m11 + 1 ) / 2; - var yy = ( m22 + 1 ) / 2; - var zz = ( m33 + 1 ) / 2; - var xy = ( m12 + m21 ) / 4; - var xz = ( m13 + m31 ) / 4; - var yz = ( m23 + m32 ) / 4; - - if ( ( xx > yy ) && ( xx > zz ) ) { // m11 is the largest diagonal term - - if ( xx < epsilon ) { - - x = 0; - y = 0.707106781; - z = 0.707106781; - - } else { - - x = Math.sqrt( xx ); - y = xy / x; - z = xz / x; - - } - - } else if ( yy > zz ) { // m22 is the largest diagonal term - - if ( yy < epsilon ) { - - x = 0.707106781; - y = 0; - z = 0.707106781; - - } else { - - y = Math.sqrt( yy ); - x = xy / y; - z = yz / y; - - } - - } else { // m33 is the largest diagonal term so base result on this - - if ( zz < epsilon ) { - - x = 0.707106781; - y = 0.707106781; - z = 0; - - } else { - - z = Math.sqrt( zz ); - x = xz / z; - y = yz / z; - - } - - } - - this.set( x, y, z, angle ); - - return this; // return 180 deg rotation - - } - - // as we have reached here there are no singularities so we can handle normally - - var s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) - + ( m13 - m31 ) * ( m13 - m31 ) - + ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize - - if ( Math.abs( s ) < 0.001 ) s = 1; - - // prevent divide by zero, should not happen if matrix is orthogonal and should be - // caught by singularity test above, but I've left it in just in case - - this.x = ( m32 - m23 ) / s; - this.y = ( m13 - m31 ) / s; - this.z = ( m21 - m12 ) / s; - this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 ); - - return this; - - }, - - min: function ( v ) { - - if ( this.x > v.x ) { - - this.x = v.x; - - } - - if ( this.y > v.y ) { - - this.y = v.y; - - } - - if ( this.z > v.z ) { - - this.z = v.z; - - } - - if ( this.w > v.w ) { - - this.w = v.w; - - } - - return this; - - }, - - max: function ( v ) { - - if ( this.x < v.x ) { - - this.x = v.x; - - } - - if ( this.y < v.y ) { - - this.y = v.y; - - } - - if ( this.z < v.z ) { - - this.z = v.z; - - } - - if ( this.w < v.w ) { - - this.w = v.w; - - } - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - if ( this.x < min.x ) { - - this.x = min.x; - - } else if ( this.x > max.x ) { - - this.x = max.x; - - } - - if ( this.y < min.y ) { - - this.y = min.y; - - } else if ( this.y > max.y ) { - - this.y = max.y; - - } - - if ( this.z < min.z ) { - - this.z = min.z; - - } else if ( this.z > max.z ) { - - this.z = max.z; - - } - - if ( this.w < min.w ) { - - this.w = min.w; - - } else if ( this.w > max.w ) { - - this.w = max.w; - - } - - return this; - - }, - - clampScalar: ( function () { - - var min, max; - - return function ( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new THREE.Vector4(); - max = new THREE.Vector4(); - - } - - min.set( minVal, minVal, minVal, minVal ); - max.set( maxVal, maxVal, maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - } )(), - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - this.w = Math.floor( this.w ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - this.w = Math.ceil( this.w ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - this.w = Math.round( this.w ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w ); - - return this; - - }, - - negate: function () { - - return this.multiplyScalar( -1 ); - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); - - }, - - lengthManhattan: function () { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - setLength: function ( l ) { - - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - - } - - return this; - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - this.w += ( v.w - this.w ) * alpha; - - return this; - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) ); - - }, - - fromArray: function ( array ) { - - this.x = array[ 0 ]; - this.y = array[ 1 ]; - this.z = array[ 2 ]; - this.w = array[ 3 ]; - - return this; - - }, - - toArray: function () { - - return [ this.x, this.y, this.z, this.w ]; - - }, - - clone: function () { - - return new THREE.Vector4( this.x, this.y, this.z, this.w ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://exocortex.com - */ - -THREE.Euler = function ( x, y, z, order ) { - - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._order = order || THREE.Euler.DefaultOrder; - -}; - -THREE.Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; - -THREE.Euler.DefaultOrder = 'XYZ'; - -THREE.Euler.prototype = { - - constructor: THREE.Euler, - - _x: 0, _y: 0, _z: 0, _order: THREE.Euler.DefaultOrder, - - _quaternion: undefined, - - _updateQuaternion: function () { - - if ( this._quaternion !== undefined ) { - - this._quaternion.setFromEuler( this, false ); - - } - - }, - - get x () { - - return this._x; - - }, - - set x ( value ) { - - this._x = value; - this._updateQuaternion(); - - }, - - get y () { - - return this._y; - - }, - - set y ( value ) { - - this._y = value; - this._updateQuaternion(); - - }, - - get z () { - - return this._z; - - }, - - set z ( value ) { - - this._z = value; - this._updateQuaternion(); - - }, - - get order () { - - return this._order; - - }, - - set order ( value ) { - - this._order = value; - this._updateQuaternion(); - - }, - - set: function ( x, y, z, order ) { - - this._x = x; - this._y = y; - this._z = z; - this._order = order || this._order; - - this._updateQuaternion(); - - return this; - - }, - - copy: function ( euler ) { - - this._x = euler._x; - this._y = euler._y; - this._z = euler._z; - this._order = euler._order; - - this._updateQuaternion(); - - return this; - - }, - - setFromRotationMatrix: function ( m, order ) { - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - // clamp, to handle numerical problems - - function clamp( x ) { - - return Math.min( Math.max( x, -1 ), 1 ); - - } - - var te = m.elements; - var m11 = te[0], m12 = te[4], m13 = te[8]; - var m21 = te[1], m22 = te[5], m23 = te[9]; - var m31 = te[2], m32 = te[6], m33 = te[10]; - - order = order || this._order; - - if ( order === 'XYZ' ) { - - this._y = Math.asin( clamp( m13 ) ); - - if ( Math.abs( m13 ) < 0.99999 ) { - - this._x = Math.atan2( - m23, m33 ); - this._z = Math.atan2( - m12, m11 ); - - } else { - - this._x = Math.atan2( m32, m22 ); - this._z = 0; - - } - - } else if ( order === 'YXZ' ) { - - this._x = Math.asin( - clamp( m23 ) ); - - if ( Math.abs( m23 ) < 0.99999 ) { - - this._y = Math.atan2( m13, m33 ); - this._z = Math.atan2( m21, m22 ); - - } else { - - this._y = Math.atan2( - m31, m11 ); - this._z = 0; - - } - - } else if ( order === 'ZXY' ) { - - this._x = Math.asin( clamp( m32 ) ); - - if ( Math.abs( m32 ) < 0.99999 ) { - - this._y = Math.atan2( - m31, m33 ); - this._z = Math.atan2( - m12, m22 ); - - } else { - - this._y = 0; - this._z = Math.atan2( m21, m11 ); - - } - - } else if ( order === 'ZYX' ) { - - this._y = Math.asin( - clamp( m31 ) ); - - if ( Math.abs( m31 ) < 0.99999 ) { - - this._x = Math.atan2( m32, m33 ); - this._z = Math.atan2( m21, m11 ); - - } else { - - this._x = 0; - this._z = Math.atan2( - m12, m22 ); - - } - - } else if ( order === 'YZX' ) { - - this._z = Math.asin( clamp( m21 ) ); - - if ( Math.abs( m21 ) < 0.99999 ) { - - this._x = Math.atan2( - m23, m22 ); - this._y = Math.atan2( - m31, m11 ); - - } else { - - this._x = 0; - this._y = Math.atan2( m13, m33 ); - - } - - } else if ( order === 'XZY' ) { - - this._z = Math.asin( - clamp( m12 ) ); - - if ( Math.abs( m12 ) < 0.99999 ) { - - this._x = Math.atan2( m32, m22 ); - this._y = Math.atan2( m13, m11 ); - - } else { - - this._x = Math.atan2( - m23, m33 ); - this._y = 0; - - } - - } else { - - console.warn( 'WARNING: Euler.setFromRotationMatrix() given unsupported order: ' + order ) - - } - - this._order = order; - - this._updateQuaternion(); - - return this; - - }, - - setFromQuaternion: function ( q, order, update ) { - - // q is assumed to be normalized - - // clamp, to handle numerical problems - - function clamp( x ) { - - return Math.min( Math.max( x, -1 ), 1 ); - - } - - // http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m - - var sqx = q.x * q.x; - var sqy = q.y * q.y; - var sqz = q.z * q.z; - var sqw = q.w * q.w; - - order = order || this._order; - - if ( order === 'XYZ' ) { - - this._x = Math.atan2( 2 * ( q.x * q.w - q.y * q.z ), ( sqw - sqx - sqy + sqz ) ); - this._y = Math.asin( clamp( 2 * ( q.x * q.z + q.y * q.w ) ) ); - this._z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw + sqx - sqy - sqz ) ); - - } else if ( order === 'YXZ' ) { - - this._x = Math.asin( clamp( 2 * ( q.x * q.w - q.y * q.z ) ) ); - this._y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw - sqx - sqy + sqz ) ); - this._z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw - sqx + sqy - sqz ) ); - - } else if ( order === 'ZXY' ) { - - this._x = Math.asin( clamp( 2 * ( q.x * q.w + q.y * q.z ) ) ); - this._y = Math.atan2( 2 * ( q.y * q.w - q.z * q.x ), ( sqw - sqx - sqy + sqz ) ); - this._z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw - sqx + sqy - sqz ) ); - - } else if ( order === 'ZYX' ) { - - this._x = Math.atan2( 2 * ( q.x * q.w + q.z * q.y ), ( sqw - sqx - sqy + sqz ) ); - this._y = Math.asin( clamp( 2 * ( q.y * q.w - q.x * q.z ) ) ); - this._z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw + sqx - sqy - sqz ) ); - - } else if ( order === 'YZX' ) { - - this._x = Math.atan2( 2 * ( q.x * q.w - q.z * q.y ), ( sqw - sqx + sqy - sqz ) ); - this._y = Math.atan2( 2 * ( q.y * q.w - q.x * q.z ), ( sqw + sqx - sqy - sqz ) ); - this._z = Math.asin( clamp( 2 * ( q.x * q.y + q.z * q.w ) ) ); - - } else if ( order === 'XZY' ) { - - this._x = Math.atan2( 2 * ( q.x * q.w + q.y * q.z ), ( sqw - sqx + sqy - sqz ) ); - this._y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw + sqx - sqy - sqz ) ); - this._z = Math.asin( clamp( 2 * ( q.z * q.w - q.x * q.y ) ) ); - - } else { - - console.warn( 'WARNING: Euler.setFromQuaternion() given unsupported order: ' + order ) - - } - - this._order = order; - - if ( update !== false ) this._updateQuaternion(); - - return this; - - }, - - reorder: function () { - - // WARNING: this discards revolution information -bhouston - - var q = new THREE.Quaternion(); - - return function ( newOrder ) { - - q.setFromEuler( this ); - this.setFromQuaternion( q, newOrder ); - - }; - - - }(), - - fromArray: function ( array ) { - - this._x = array[ 0 ]; - this._y = array[ 1 ]; - this._z = array[ 2 ]; - if ( array[ 3 ] !== undefined ) this._order = array[ 3 ]; - - this._updateQuaternion(); - - return this; - - }, - - toArray: function () { - - return [ this._x, this._y, this._z, this._order ]; - - }, - - equals: function ( euler ) { - - return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order ); - - }, - - clone: function () { - - return new THREE.Euler( this._x, this._y, this._z, this._order ); - - } - -}; - -/** - * @author bhouston / http://exocortex.com - */ - -THREE.Line3 = function ( start, end ) { - - this.start = ( start !== undefined ) ? start : new THREE.Vector3(); - this.end = ( end !== undefined ) ? end : new THREE.Vector3(); - -}; - -THREE.Line3.prototype = { - - constructor: THREE.Line3, - - set: function ( start, end ) { - - this.start.copy( start ); - this.end.copy( end ); - - return this; - - }, - - copy: function ( line ) { - - this.start.copy( line.start ); - this.end.copy( line.end ); - - return this; - - }, - - center: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.addVectors( this.start, this.end ).multiplyScalar( 0.5 ); - - }, - - delta: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.subVectors( this.end, this.start ); - - }, - - distanceSq: function () { - - return this.start.distanceToSquared( this.end ); - - }, - - distance: function () { - - return this.start.distanceTo( this.end ); - - }, - - at: function ( t, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - return this.delta( result ).multiplyScalar( t ).add( this.start ); - - }, - - closestPointToPointParameter: function() { - - var startP = new THREE.Vector3(); - var startEnd = new THREE.Vector3(); - - return function ( point, clampToLine ) { - - startP.subVectors( point, this.start ); - startEnd.subVectors( this.end, this.start ); - - var startEnd2 = startEnd.dot( startEnd ); - var startEnd_startP = startEnd.dot( startP ); - - var t = startEnd_startP / startEnd2; - - if ( clampToLine ) { - - t = THREE.Math.clamp( t, 0, 1 ); - - } - - return t; - - }; - - }(), - - closestPointToPoint: function ( point, clampToLine, optionalTarget ) { - - var t = this.closestPointToPointParameter( point, clampToLine ); - - var result = optionalTarget || new THREE.Vector3(); - - return this.delta( result ).multiplyScalar( t ).add( this.start ); - - }, - - applyMatrix4: function ( matrix ) { - - this.start.applyMatrix4( matrix ); - this.end.applyMatrix4( matrix ); - - return this; - - }, - - equals: function ( line ) { - - return line.start.equals( this.start ) && line.end.equals( this.end ); - - }, - - clone: function () { - - return new THREE.Line3().copy( this ); - - } - -}; - -/** - * @author bhouston / http://exocortex.com - */ - -THREE.Box2 = function ( min, max ) { - - this.min = ( min !== undefined ) ? min : new THREE.Vector2( Infinity, Infinity ); - this.max = ( max !== undefined ) ? max : new THREE.Vector2( -Infinity, -Infinity ); - -}; - -THREE.Box2.prototype = { - - constructor: THREE.Box2, - - set: function ( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - }, - - setFromPoints: function ( points ) { - - if ( points.length > 0 ) { - - var point = points[ 0 ]; - - this.min.copy( point ); - this.max.copy( point ); - - for ( var i = 1, il = points.length; i < il; i ++ ) { - - point = points[ i ]; - - if ( point.x < this.min.x ) { - - this.min.x = point.x; - - } else if ( point.x > this.max.x ) { - - this.max.x = point.x; - - } - - if ( point.y < this.min.y ) { - - this.min.y = point.y; - - } else if ( point.y > this.max.y ) { - - this.max.y = point.y; - - } - - } - - } else { - - this.makeEmpty(); - - } - - return this; - - }, - - setFromCenterAndSize: function () { - - var v1 = new THREE.Vector2(); - - return function ( center, size ) { - - var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - }; - - }(), - - copy: function ( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - }, - - makeEmpty: function () { - - this.min.x = this.min.y = Infinity; - this.max.x = this.max.y = -Infinity; - - return this; - - }, - - empty: function () { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ); - - }, - - center: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector2(); - return result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - }, - - size: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector2(); - return result.subVectors( this.max, this.min ); - - }, - - expandByPoint: function ( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - }, - - expandByVector: function ( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - }, - - expandByScalar: function ( scalar ) { - - this.min.addScalar( -scalar ); - this.max.addScalar( scalar ); - - return this; - }, - - containsPoint: function ( point ) { - - if ( point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y ) { - - return false; - - } - - return true; - - }, - - containsBox: function ( box ) { - - if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && - ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) { - - return true; - - } - - return false; - - }, - - getParameter: function ( point, optionalTarget ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - var result = optionalTarget || new THREE.Vector2(); - - return result.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ) - ); - - }, - - isIntersectionBox: function ( box ) { - - // using 6 splitting planes to rule out intersections. - - if ( box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y ) { - - return false; - - } - - return true; - - }, - - clampPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector2(); - return result.copy( point ).clamp( this.min, this.max ); - - }, - - distanceToPoint: function () { - - var v1 = new THREE.Vector2(); - - return function ( point ) { - - var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - }; - - }(), - - intersect: function ( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - return this; - - }, - - union: function ( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - }, - - translate: function ( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - }, - - equals: function ( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - }, - - clone: function () { - - return new THREE.Box2().copy( this ); - - } - -}; - -/** - * @author bhouston / http://exocortex.com - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Box3 = function ( min, max ) { - - this.min = ( min !== undefined ) ? min : new THREE.Vector3( Infinity, Infinity, Infinity ); - this.max = ( max !== undefined ) ? max : new THREE.Vector3( -Infinity, -Infinity, -Infinity ); - -}; - -THREE.Box3.prototype = { - - constructor: THREE.Box3, - - set: function ( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - }, - - addPoint: function ( point ) { - - if ( point.x < this.min.x ) { - - this.min.x = point.x; - - } else if ( point.x > this.max.x ) { - - this.max.x = point.x; - - } - - if ( point.y < this.min.y ) { - - this.min.y = point.y; - - } else if ( point.y > this.max.y ) { - - this.max.y = point.y; - - } - - if ( point.z < this.min.z ) { - - this.min.z = point.z; - - } else if ( point.z > this.max.z ) { - - this.max.z = point.z; - - } - - }, - - setFromPoints: function ( points ) { - - if ( points.length > 0 ) { - - var point = points[ 0 ]; - - this.min.copy( point ); - this.max.copy( point ); - - for ( var i = 1, il = points.length; i < il; i ++ ) { - - this.addPoint( points[ i ] ) - - } - - } else { - - this.makeEmpty(); - - } - - return this; - - }, - - setFromCenterAndSize: function() { - - var v1 = new THREE.Vector3(); - - return function ( center, size ) { - - var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); - - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - }; - - }(), - - setFromObject: function() { - - // Computes the world-axis-aligned bounding box of an object (including its children), - // accounting for both the object's, and childrens', world transforms - - var v1 = new THREE.Vector3(); - - return function( object ) { - - var scope = this; - - object.updateMatrixWorld( true ); - - this.makeEmpty(); - - object.traverse( function ( node ) { - - if ( node.geometry !== undefined && node.geometry.vertices !== undefined ) { - - var vertices = node.geometry.vertices; - - for ( var i = 0, il = vertices.length; i < il; i++ ) { - - v1.copy( vertices[ i ] ); - - v1.applyMatrix4( node.matrixWorld ); - - scope.expandByPoint( v1 ); - - } - - } - - } ); - - return this; - - }; - - }(), - - copy: function ( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - }, - - makeEmpty: function () { - - this.min.x = this.min.y = this.min.z = Infinity; - this.max.x = this.max.y = this.max.z = -Infinity; - - return this; - - }, - - empty: function () { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z ); - - }, - - center: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - }, - - size: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.subVectors( this.max, this.min ); - - }, - - expandByPoint: function ( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - - }, - - expandByVector: function ( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - - }, - - expandByScalar: function ( scalar ) { - - this.min.addScalar( -scalar ); - this.max.addScalar( scalar ); - - return this; - - }, - - containsPoint: function ( point ) { - - if ( point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y || - point.z < this.min.z || point.z > this.max.z ) { - - return false; - - } - - return true; - - }, - - containsBox: function ( box ) { - - if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && - ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) && - ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) { - - return true; - - } - - return false; - - }, - - getParameter: function ( point, optionalTarget ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - var result = optionalTarget || new THREE.Vector3(); - - return result.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ), - ( point.z - this.min.z ) / ( this.max.z - this.min.z ) - ); - - }, - - isIntersectionBox: function ( box ) { - - // using 6 splitting planes to rule out intersections. - - if ( box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y || - box.max.z < this.min.z || box.min.z > this.max.z ) { - - return false; - - } - - return true; - - }, - - clampPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.copy( point ).clamp( this.min, this.max ); - - }, - - distanceToPoint: function() { - - var v1 = new THREE.Vector3(); - - return function ( point ) { - - var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - }; - - }(), - - getBoundingSphere: function() { - - var v1 = new THREE.Vector3(); - - return function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Sphere(); - - result.center = this.center(); - result.radius = this.size( v1 ).length() * 0.5; - - return result; - - }; - - }(), - - intersect: function ( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - return this; - - }, - - union: function ( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - }, - - applyMatrix4: function() { - - var points = [ - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3() - ]; - - return function ( matrix ) { - - // NOTE: I am using a binary pattern to specify all 2^3 combinations below - points[0].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000 - points[1].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001 - points[2].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010 - points[3].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011 - points[4].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100 - points[5].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101 - points[6].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110 - points[7].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111 - - this.makeEmpty(); - this.setFromPoints( points ); - - return this; - - }; - - }(), - - translate: function ( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - }, - - equals: function ( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - }, - - clone: function () { - - return new THREE.Box3().copy( this ); - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://exocortex.com - */ - -THREE.Matrix3 = function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) { - - this.elements = new Float32Array(9); - - this.set( - - ( n11 !== undefined ) ? n11 : 1, n12 || 0, n13 || 0, - n21 || 0, ( n22 !== undefined ) ? n22 : 1, n23 || 0, - n31 || 0, n32 || 0, ( n33 !== undefined ) ? n33 : 1 - - ); -}; - -THREE.Matrix3.prototype = { - - constructor: THREE.Matrix3, - - set: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) { - - var te = this.elements; - - te[0] = n11; te[3] = n12; te[6] = n13; - te[1] = n21; te[4] = n22; te[7] = n23; - te[2] = n31; te[5] = n32; te[8] = n33; - - return this; - - }, - - identity: function () { - - this.set( - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ); - - return this; - - }, - - copy: function ( m ) { - - var me = m.elements; - - this.set( - - me[0], me[3], me[6], - me[1], me[4], me[7], - me[2], me[5], me[8] - - ); - - return this; - - }, - - multiplyVector3: function ( vector ) { - - console.warn( 'DEPRECATED: Matrix3\'s .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' ); - return vector.applyMatrix3( this ); - - }, - - multiplyVector3Array: function() { - - var v1 = new THREE.Vector3(); - - return function ( a ) { - - for ( var i = 0, il = a.length; i < il; i += 3 ) { - - v1.x = a[ i ]; - v1.y = a[ i + 1 ]; - v1.z = a[ i + 2 ]; - - v1.applyMatrix3(this); - - a[ i ] = v1.x; - a[ i + 1 ] = v1.y; - a[ i + 2 ] = v1.z; - - } - - return a; - - }; - - }(), - - multiplyScalar: function ( s ) { - - var te = this.elements; - - te[0] *= s; te[3] *= s; te[6] *= s; - te[1] *= s; te[4] *= s; te[7] *= s; - te[2] *= s; te[5] *= s; te[8] *= s; - - return this; - - }, - - determinant: function () { - - var te = this.elements; - - var a = te[0], b = te[1], c = te[2], - d = te[3], e = te[4], f = te[5], - g = te[6], h = te[7], i = te[8]; - - return a*e*i - a*f*h - b*d*i + b*f*g + c*d*h - c*e*g; - - }, - - getInverse: function ( matrix, throwOnInvertible ) { - - // input: THREE.Matrix4 - // ( based on http://code.google.com/p/webgl-mjs/ ) - - var me = matrix.elements; - var te = this.elements; - - te[ 0 ] = me[10] * me[5] - me[6] * me[9]; - te[ 1 ] = - me[10] * me[1] + me[2] * me[9]; - te[ 2 ] = me[6] * me[1] - me[2] * me[5]; - te[ 3 ] = - me[10] * me[4] + me[6] * me[8]; - te[ 4 ] = me[10] * me[0] - me[2] * me[8]; - te[ 5 ] = - me[6] * me[0] + me[2] * me[4]; - te[ 6 ] = me[9] * me[4] - me[5] * me[8]; - te[ 7 ] = - me[9] * me[0] + me[1] * me[8]; - te[ 8 ] = me[5] * me[0] - me[1] * me[4]; - - var det = me[ 0 ] * te[ 0 ] + me[ 1 ] * te[ 3 ] + me[ 2 ] * te[ 6 ]; - - // no inverse - - if ( det === 0 ) { - - var msg = "Matrix3.getInverse(): can't invert matrix, determinant is 0"; - - if ( throwOnInvertible || false ) { - - throw new Error( msg ); - - } else { - - console.warn( msg ); - - } - - this.identity(); - - return this; - - } - - this.multiplyScalar( 1.0 / det ); - - return this; - - }, - - transpose: function () { - - var tmp, m = this.elements; - - tmp = m[1]; m[1] = m[3]; m[3] = tmp; - tmp = m[2]; m[2] = m[6]; m[6] = tmp; - tmp = m[5]; m[5] = m[7]; m[7] = tmp; - - return this; - - }, - - getNormalMatrix: function ( m ) { - - // input: THREE.Matrix4 - - this.getInverse( m ).transpose(); - - return this; - - }, - - transposeIntoArray: function ( r ) { - - var m = this.elements; - - r[ 0 ] = m[ 0 ]; - r[ 1 ] = m[ 3 ]; - r[ 2 ] = m[ 6 ]; - r[ 3 ] = m[ 1 ]; - r[ 4 ] = m[ 4 ]; - r[ 5 ] = m[ 7 ]; - r[ 6 ] = m[ 2 ]; - r[ 7 ] = m[ 5 ]; - r[ 8 ] = m[ 8 ]; - - return this; - - }, - - fromArray: function ( array ) { - - this.elements.set( array ); - - return this; - - }, - - toArray: function () { - - var te = this.elements; - - return [ - te[ 0 ], te[ 1 ], te[ 2 ], - te[ 3 ], te[ 4 ], te[ 5 ], - te[ 6 ], te[ 7 ], te[ 8 ] - ]; - - }, - - clone: function () { - - var te = this.elements; - - return new THREE.Matrix3( - - te[0], te[3], te[6], - te[1], te[4], te[7], - te[2], te[5], te[8] - - ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author philogb / http://blog.thejit.org/ - * @author jordi_ros / http://plattsoft.com - * @author D1plo1d / http://github.com/D1plo1d - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author timknip / http://www.floorplanner.com/ - * @author bhouston / http://exocortex.com - * @author WestLangley / http://github.com/WestLangley - */ - - -THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) { - - this.elements = new Float32Array( 16 ); - - // TODO: if n11 is undefined, then just set to identity, otherwise copy all other values into matrix - // we should not support semi specification of Matrix4, it is just weird. - - var te = this.elements; - - te[0] = ( n11 !== undefined ) ? n11 : 1; te[4] = n12 || 0; te[8] = n13 || 0; te[12] = n14 || 0; - te[1] = n21 || 0; te[5] = ( n22 !== undefined ) ? n22 : 1; te[9] = n23 || 0; te[13] = n24 || 0; - te[2] = n31 || 0; te[6] = n32 || 0; te[10] = ( n33 !== undefined ) ? n33 : 1; te[14] = n34 || 0; - te[3] = n41 || 0; te[7] = n42 || 0; te[11] = n43 || 0; te[15] = ( n44 !== undefined ) ? n44 : 1; - -}; - -THREE.Matrix4.prototype = { - - constructor: THREE.Matrix4, - - set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) { - - var te = this.elements; - - te[0] = n11; te[4] = n12; te[8] = n13; te[12] = n14; - te[1] = n21; te[5] = n22; te[9] = n23; te[13] = n24; - te[2] = n31; te[6] = n32; te[10] = n33; te[14] = n34; - te[3] = n41; te[7] = n42; te[11] = n43; te[15] = n44; - - return this; - - }, - - identity: function () { - - this.set( - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - copy: function ( m ) { - - this.elements.set( m.elements ); - - return this; - - }, - - extractPosition: function ( m ) { - - console.warn( 'DEPRECATED: Matrix4\'s .extractPosition() has been renamed to .copyPosition().' ); - return this.copyPosition( m ); - - }, - - copyPosition: function ( m ) { - - var te = this.elements; - var me = m.elements; - - te[12] = me[12]; - te[13] = me[13]; - te[14] = me[14]; - - return this; - - }, - - extractRotation: function () { - - var v1 = new THREE.Vector3(); - - return function ( m ) { - - var te = this.elements; - var me = m.elements; - - var scaleX = 1 / v1.set( me[0], me[1], me[2] ).length(); - var scaleY = 1 / v1.set( me[4], me[5], me[6] ).length(); - var scaleZ = 1 / v1.set( me[8], me[9], me[10] ).length(); - - te[0] = me[0] * scaleX; - te[1] = me[1] * scaleX; - te[2] = me[2] * scaleX; - - te[4] = me[4] * scaleY; - te[5] = me[5] * scaleY; - te[6] = me[6] * scaleY; - - te[8] = me[8] * scaleZ; - te[9] = me[9] * scaleZ; - te[10] = me[10] * scaleZ; - - return this; - - }; - - }(), - - makeRotationFromEuler: function ( euler ) { - - if ( euler instanceof THREE.Euler === false ) { - - console.error( 'ERROR: Matrix\'s .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' ); - - } - - var te = this.elements; - - var x = euler.x, y = euler.y, z = euler.z; - var a = Math.cos( x ), b = Math.sin( x ); - var c = Math.cos( y ), d = Math.sin( y ); - var e = Math.cos( z ), f = Math.sin( z ); - - if ( euler.order === 'XYZ' ) { - - var ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[0] = c * e; - te[4] = - c * f; - te[8] = d; - - te[1] = af + be * d; - te[5] = ae - bf * d; - te[9] = - b * c; - - te[2] = bf - ae * d; - te[6] = be + af * d; - te[10] = a * c; - - } else if ( euler.order === 'YXZ' ) { - - var ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[0] = ce + df * b; - te[4] = de * b - cf; - te[8] = a * d; - - te[1] = a * f; - te[5] = a * e; - te[9] = - b; - - te[2] = cf * b - de; - te[6] = df + ce * b; - te[10] = a * c; - - } else if ( euler.order === 'ZXY' ) { - - var ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[0] = ce - df * b; - te[4] = - a * f; - te[8] = de + cf * b; - - te[1] = cf + de * b; - te[5] = a * e; - te[9] = df - ce * b; - - te[2] = - a * d; - te[6] = b; - te[10] = a * c; - - } else if ( euler.order === 'ZYX' ) { - - var ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[0] = c * e; - te[4] = be * d - af; - te[8] = ae * d + bf; - - te[1] = c * f; - te[5] = bf * d + ae; - te[9] = af * d - be; - - te[2] = - d; - te[6] = b * c; - te[10] = a * c; - - } else if ( euler.order === 'YZX' ) { - - var ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[0] = c * e; - te[4] = bd - ac * f; - te[8] = bc * f + ad; - - te[1] = f; - te[5] = a * e; - te[9] = - b * e; - - te[2] = - d * e; - te[6] = ad * f + bc; - te[10] = ac - bd * f; - - } else if ( euler.order === 'XZY' ) { - - var ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[0] = c * e; - te[4] = - f; - te[8] = d * e; - - te[1] = ac * f + bd; - te[5] = a * e; - te[9] = ad * f - bc; - - te[2] = bc * f - ad; - te[6] = b * e; - te[10] = bd * f + ac; - - } - - // last column - te[3] = 0; - te[7] = 0; - te[11] = 0; - - // bottom row - te[12] = 0; - te[13] = 0; - te[14] = 0; - te[15] = 1; - - return this; - - }, - - setRotationFromQuaternion: function ( q ) { - - console.warn( 'DEPRECATED: Matrix4\'s .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.' ); - - return this.makeRotationFromQuaternion( q ); - - }, - - makeRotationFromQuaternion: function ( q ) { - - var te = this.elements; - - var x = q.x, y = q.y, z = q.z, w = q.w; - var x2 = x + x, y2 = y + y, z2 = z + z; - var xx = x * x2, xy = x * y2, xz = x * z2; - var yy = y * y2, yz = y * z2, zz = z * z2; - var wx = w * x2, wy = w * y2, wz = w * z2; - - te[0] = 1 - ( yy + zz ); - te[4] = xy - wz; - te[8] = xz + wy; - - te[1] = xy + wz; - te[5] = 1 - ( xx + zz ); - te[9] = yz - wx; - - te[2] = xz - wy; - te[6] = yz + wx; - te[10] = 1 - ( xx + yy ); - - // last column - te[3] = 0; - te[7] = 0; - te[11] = 0; - - // bottom row - te[12] = 0; - te[13] = 0; - te[14] = 0; - te[15] = 1; - - return this; - - }, - - lookAt: function() { - - var x = new THREE.Vector3(); - var y = new THREE.Vector3(); - var z = new THREE.Vector3(); - - return function ( eye, target, up ) { - - var te = this.elements; - - z.subVectors( eye, target ).normalize(); - - if ( z.length() === 0 ) { - - z.z = 1; - - } - - x.crossVectors( up, z ).normalize(); - - if ( x.length() === 0 ) { - - z.x += 0.0001; - x.crossVectors( up, z ).normalize(); - - } - - y.crossVectors( z, x ); - - - te[0] = x.x; te[4] = y.x; te[8] = z.x; - te[1] = x.y; te[5] = y.y; te[9] = z.y; - te[2] = x.z; te[6] = y.z; te[10] = z.z; - - return this; - - }; - - }(), - - multiply: function ( m, n ) { - - if ( n !== undefined ) { - - console.warn( 'DEPRECATED: Matrix4\'s .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' ); - return this.multiplyMatrices( m, n ); - - } - - return this.multiplyMatrices( this, m ); - - }, - - multiplyMatrices: function ( a, b ) { - - var ae = a.elements; - var be = b.elements; - var te = this.elements; - - var a11 = ae[0], a12 = ae[4], a13 = ae[8], a14 = ae[12]; - var a21 = ae[1], a22 = ae[5], a23 = ae[9], a24 = ae[13]; - var a31 = ae[2], a32 = ae[6], a33 = ae[10], a34 = ae[14]; - var a41 = ae[3], a42 = ae[7], a43 = ae[11], a44 = ae[15]; - - var b11 = be[0], b12 = be[4], b13 = be[8], b14 = be[12]; - var b21 = be[1], b22 = be[5], b23 = be[9], b24 = be[13]; - var b31 = be[2], b32 = be[6], b33 = be[10], b34 = be[14]; - var b41 = be[3], b42 = be[7], b43 = be[11], b44 = be[15]; - - te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; - te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; - te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; - te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44; - - te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41; - te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42; - te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43; - te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44; - - te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41; - te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42; - te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43; - te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44; - - te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41; - te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42; - te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; - te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; - - return this; - - }, - - multiplyToArray: function ( a, b, r ) { - - var te = this.elements; - - this.multiplyMatrices( a, b ); - - r[ 0 ] = te[0]; r[ 1 ] = te[1]; r[ 2 ] = te[2]; r[ 3 ] = te[3]; - r[ 4 ] = te[4]; r[ 5 ] = te[5]; r[ 6 ] = te[6]; r[ 7 ] = te[7]; - r[ 8 ] = te[8]; r[ 9 ] = te[9]; r[ 10 ] = te[10]; r[ 11 ] = te[11]; - r[ 12 ] = te[12]; r[ 13 ] = te[13]; r[ 14 ] = te[14]; r[ 15 ] = te[15]; - - return this; - - }, - - multiplyScalar: function ( s ) { - - var te = this.elements; - - te[0] *= s; te[4] *= s; te[8] *= s; te[12] *= s; - te[1] *= s; te[5] *= s; te[9] *= s; te[13] *= s; - te[2] *= s; te[6] *= s; te[10] *= s; te[14] *= s; - te[3] *= s; te[7] *= s; te[11] *= s; te[15] *= s; - - return this; - - }, - - multiplyVector3: function ( vector ) { - - console.warn( 'DEPRECATED: Matrix4\'s .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' ); - return vector.applyProjection( this ); - - }, - - multiplyVector4: function ( vector ) { - - console.warn( 'DEPRECATED: Matrix4\'s .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - - }, - - multiplyVector3Array: function() { - - var v1 = new THREE.Vector3(); - - return function ( a ) { - - for ( var i = 0, il = a.length; i < il; i += 3 ) { - - v1.x = a[ i ]; - v1.y = a[ i + 1 ]; - v1.z = a[ i + 2 ]; - - v1.applyProjection( this ); - - a[ i ] = v1.x; - a[ i + 1 ] = v1.y; - a[ i + 2 ] = v1.z; - - } - - return a; - - }; - - }(), - - rotateAxis: function ( v ) { - - console.warn( 'DEPRECATED: Matrix4\'s .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' ); - - v.transformDirection( this ); - - }, - - crossVector: function ( vector ) { - - console.warn( 'DEPRECATED: Matrix4\'s .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - - }, - - determinant: function () { - - var te = this.elements; - - var n11 = te[0], n12 = te[4], n13 = te[8], n14 = te[12]; - var n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13]; - var n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14]; - var n41 = te[3], n42 = te[7], n43 = te[11], n44 = te[15]; - - //TODO: make this more efficient - //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm ) - - return ( - n41 * ( - +n14 * n23 * n32 - -n13 * n24 * n32 - -n14 * n22 * n33 - +n12 * n24 * n33 - +n13 * n22 * n34 - -n12 * n23 * n34 - ) + - n42 * ( - +n11 * n23 * n34 - -n11 * n24 * n33 - +n14 * n21 * n33 - -n13 * n21 * n34 - +n13 * n24 * n31 - -n14 * n23 * n31 - ) + - n43 * ( - +n11 * n24 * n32 - -n11 * n22 * n34 - -n14 * n21 * n32 - +n12 * n21 * n34 - +n14 * n22 * n31 - -n12 * n24 * n31 - ) + - n44 * ( - -n13 * n22 * n31 - -n11 * n23 * n32 - +n11 * n22 * n33 - +n13 * n21 * n32 - -n12 * n21 * n33 - +n12 * n23 * n31 - ) - - ); - - }, - - transpose: function () { - - var te = this.elements; - var tmp; - - tmp = te[1]; te[1] = te[4]; te[4] = tmp; - tmp = te[2]; te[2] = te[8]; te[8] = tmp; - tmp = te[6]; te[6] = te[9]; te[9] = tmp; - - tmp = te[3]; te[3] = te[12]; te[12] = tmp; - tmp = te[7]; te[7] = te[13]; te[13] = tmp; - tmp = te[11]; te[11] = te[14]; te[14] = tmp; - - return this; - - }, - - flattenToArray: function ( flat ) { - - var te = this.elements; - flat[ 0 ] = te[0]; flat[ 1 ] = te[1]; flat[ 2 ] = te[2]; flat[ 3 ] = te[3]; - flat[ 4 ] = te[4]; flat[ 5 ] = te[5]; flat[ 6 ] = te[6]; flat[ 7 ] = te[7]; - flat[ 8 ] = te[8]; flat[ 9 ] = te[9]; flat[ 10 ] = te[10]; flat[ 11 ] = te[11]; - flat[ 12 ] = te[12]; flat[ 13 ] = te[13]; flat[ 14 ] = te[14]; flat[ 15 ] = te[15]; - - return flat; - - }, - - flattenToArrayOffset: function( flat, offset ) { - - var te = this.elements; - flat[ offset ] = te[0]; - flat[ offset + 1 ] = te[1]; - flat[ offset + 2 ] = te[2]; - flat[ offset + 3 ] = te[3]; - - flat[ offset + 4 ] = te[4]; - flat[ offset + 5 ] = te[5]; - flat[ offset + 6 ] = te[6]; - flat[ offset + 7 ] = te[7]; - - flat[ offset + 8 ] = te[8]; - flat[ offset + 9 ] = te[9]; - flat[ offset + 10 ] = te[10]; - flat[ offset + 11 ] = te[11]; - - flat[ offset + 12 ] = te[12]; - flat[ offset + 13 ] = te[13]; - flat[ offset + 14 ] = te[14]; - flat[ offset + 15 ] = te[15]; - - return flat; - - }, - - getPosition: function() { - - var v1 = new THREE.Vector3(); - - return function () { - - console.warn( 'DEPRECATED: Matrix4\'s .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' ); - - var te = this.elements; - return v1.set( te[12], te[13], te[14] ); - - }; - - }(), - - setPosition: function ( v ) { - - var te = this.elements; - - te[12] = v.x; - te[13] = v.y; - te[14] = v.z; - - return this; - - }, - - getInverse: function ( m, throwOnInvertible ) { - - // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm - var te = this.elements; - var me = m.elements; - - var n11 = me[0], n12 = me[4], n13 = me[8], n14 = me[12]; - var n21 = me[1], n22 = me[5], n23 = me[9], n24 = me[13]; - var n31 = me[2], n32 = me[6], n33 = me[10], n34 = me[14]; - var n41 = me[3], n42 = me[7], n43 = me[11], n44 = me[15]; - - te[0] = n23*n34*n42 - n24*n33*n42 + n24*n32*n43 - n22*n34*n43 - n23*n32*n44 + n22*n33*n44; - te[4] = n14*n33*n42 - n13*n34*n42 - n14*n32*n43 + n12*n34*n43 + n13*n32*n44 - n12*n33*n44; - te[8] = n13*n24*n42 - n14*n23*n42 + n14*n22*n43 - n12*n24*n43 - n13*n22*n44 + n12*n23*n44; - te[12] = n14*n23*n32 - n13*n24*n32 - n14*n22*n33 + n12*n24*n33 + n13*n22*n34 - n12*n23*n34; - te[1] = n24*n33*n41 - n23*n34*n41 - n24*n31*n43 + n21*n34*n43 + n23*n31*n44 - n21*n33*n44; - te[5] = n13*n34*n41 - n14*n33*n41 + n14*n31*n43 - n11*n34*n43 - n13*n31*n44 + n11*n33*n44; - te[9] = n14*n23*n41 - n13*n24*n41 - n14*n21*n43 + n11*n24*n43 + n13*n21*n44 - n11*n23*n44; - te[13] = n13*n24*n31 - n14*n23*n31 + n14*n21*n33 - n11*n24*n33 - n13*n21*n34 + n11*n23*n34; - te[2] = n22*n34*n41 - n24*n32*n41 + n24*n31*n42 - n21*n34*n42 - n22*n31*n44 + n21*n32*n44; - te[6] = n14*n32*n41 - n12*n34*n41 - n14*n31*n42 + n11*n34*n42 + n12*n31*n44 - n11*n32*n44; - te[10] = n12*n24*n41 - n14*n22*n41 + n14*n21*n42 - n11*n24*n42 - n12*n21*n44 + n11*n22*n44; - te[14] = n14*n22*n31 - n12*n24*n31 - n14*n21*n32 + n11*n24*n32 + n12*n21*n34 - n11*n22*n34; - te[3] = n23*n32*n41 - n22*n33*n41 - n23*n31*n42 + n21*n33*n42 + n22*n31*n43 - n21*n32*n43; - te[7] = n12*n33*n41 - n13*n32*n41 + n13*n31*n42 - n11*n33*n42 - n12*n31*n43 + n11*n32*n43; - te[11] = n13*n22*n41 - n12*n23*n41 - n13*n21*n42 + n11*n23*n42 + n12*n21*n43 - n11*n22*n43; - te[15] = n12*n23*n31 - n13*n22*n31 + n13*n21*n32 - n11*n23*n32 - n12*n21*n33 + n11*n22*n33; - - var det = n11 * te[ 0 ] + n21 * te[ 4 ] + n31 * te[ 8 ] + n41 * te[ 12 ]; - - if ( det == 0 ) { - - var msg = "Matrix4.getInverse(): can't invert matrix, determinant is 0"; - - if ( throwOnInvertible || false ) { - - throw new Error( msg ); - - } else { - - console.warn( msg ); - - } - - this.identity(); - - return this; - } - - this.multiplyScalar( 1 / det ); - - return this; - - }, - - translate: function ( v ) { - - console.warn( 'DEPRECATED: Matrix4\'s .translate() has been removed.'); - - }, - - rotateX: function ( angle ) { - - console.warn( 'DEPRECATED: Matrix4\'s .rotateX() has been removed.'); - - }, - - rotateY: function ( angle ) { - - console.warn( 'DEPRECATED: Matrix4\'s .rotateY() has been removed.'); - - }, - - rotateZ: function ( angle ) { - - console.warn( 'DEPRECATED: Matrix4\'s .rotateZ() has been removed.'); - - }, - - rotateByAxis: function ( axis, angle ) { - - console.warn( 'DEPRECATED: Matrix4\'s .rotateByAxis() has been removed.'); - - }, - - scale: function ( v ) { - - var te = this.elements; - var x = v.x, y = v.y, z = v.z; - - te[0] *= x; te[4] *= y; te[8] *= z; - te[1] *= x; te[5] *= y; te[9] *= z; - te[2] *= x; te[6] *= y; te[10] *= z; - te[3] *= x; te[7] *= y; te[11] *= z; - - return this; - - }, - - getMaxScaleOnAxis: function () { - - var te = this.elements; - - var scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2]; - var scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6]; - var scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10]; - - return Math.sqrt( Math.max( scaleXSq, Math.max( scaleYSq, scaleZSq ) ) ); - - }, - - makeTranslation: function ( x, y, z ) { - - this.set( - - 1, 0, 0, x, - 0, 1, 0, y, - 0, 0, 1, z, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationX: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - 1, 0, 0, 0, - 0, c, -s, 0, - 0, s, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationY: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, 0, s, 0, - 0, 1, 0, 0, - -s, 0, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationZ: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, -s, 0, 0, - s, c, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationAxis: function ( axis, angle ) { - - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - var c = Math.cos( angle ); - var s = Math.sin( angle ); - var t = 1 - c; - var x = axis.x, y = axis.y, z = axis.z; - var tx = t * x, ty = t * y; - - this.set( - - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeScale: function ( x, y, z ) { - - this.set( - - x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - compose: function ( position, quaternion, scale ) { - - this.makeRotationFromQuaternion( quaternion ); - this.scale( scale ); - this.setPosition( position ); - - return this; - - }, - - decompose: function () { - - var vector = new THREE.Vector3(); - var matrix = new THREE.Matrix4(); - - return function ( position, quaternion, scale ) { - - var te = this.elements; - - var sx = vector.set( te[0], te[1], te[2] ).length(); - var sy = vector.set( te[4], te[5], te[6] ).length(); - var sz = vector.set( te[8], te[9], te[10] ).length(); - - // if determine is negative, we need to invert one scale - var det = this.determinant(); - if( det < 0 ) { - sx = -sx; - } - - position.x = te[12]; - position.y = te[13]; - position.z = te[14]; - - // scale the rotation part - - matrix.elements.set( this.elements ); // at this point matrix is incomplete so we can't use .copy() - - var invSX = 1 / sx; - var invSY = 1 / sy; - var invSZ = 1 / sz; - - matrix.elements[0] *= invSX; - matrix.elements[1] *= invSX; - matrix.elements[2] *= invSX; - - matrix.elements[4] *= invSY; - matrix.elements[5] *= invSY; - matrix.elements[6] *= invSY; - - matrix.elements[8] *= invSZ; - matrix.elements[9] *= invSZ; - matrix.elements[10] *= invSZ; - - quaternion.setFromRotationMatrix( matrix ); - - scale.x = sx; - scale.y = sy; - scale.z = sz; - - return this; - - }; - - }(), - - makeFrustum: function ( left, right, bottom, top, near, far ) { - - var te = this.elements; - var x = 2 * near / ( right - left ); - var y = 2 * near / ( top - bottom ); - - var a = ( right + left ) / ( right - left ); - var b = ( top + bottom ) / ( top - bottom ); - var c = - ( far + near ) / ( far - near ); - var d = - 2 * far * near / ( far - near ); - - te[0] = x; te[4] = 0; te[8] = a; te[12] = 0; - te[1] = 0; te[5] = y; te[9] = b; te[13] = 0; - te[2] = 0; te[6] = 0; te[10] = c; te[14] = d; - te[3] = 0; te[7] = 0; te[11] = - 1; te[15] = 0; - - return this; - - }, - - makePerspective: function ( fov, aspect, near, far ) { - - var ymax = near * Math.tan( THREE.Math.degToRad( fov * 0.5 ) ); - var ymin = - ymax; - var xmin = ymin * aspect; - var xmax = ymax * aspect; - - return this.makeFrustum( xmin, xmax, ymin, ymax, near, far ); - - }, - - makeOrthographic: function ( left, right, top, bottom, near, far ) { - - var te = this.elements; - var w = right - left; - var h = top - bottom; - var p = far - near; - - var x = ( right + left ) / w; - var y = ( top + bottom ) / h; - var z = ( far + near ) / p; - - te[0] = 2 / w; te[4] = 0; te[8] = 0; te[12] = -x; - te[1] = 0; te[5] = 2 / h; te[9] = 0; te[13] = -y; - te[2] = 0; te[6] = 0; te[10] = -2/p; te[14] = -z; - te[3] = 0; te[7] = 0; te[11] = 0; te[15] = 1; - - return this; - - }, - - fromArray: function ( array ) { - - this.elements.set( array ); - - return this; - - }, - - toArray: function () { - - var te = this.elements; - - return [ - te[ 0 ], te[ 1 ], te[ 2 ], te[ 3 ], - te[ 4 ], te[ 5 ], te[ 6 ], te[ 7 ], - te[ 8 ], te[ 9 ], te[ 10 ], te[ 11 ], - te[ 12 ], te[ 13 ], te[ 14 ], te[ 15 ] - ]; - - }, - - clone: function () { - - var te = this.elements; - - return new THREE.Matrix4( - - te[0], te[4], te[8], te[12], - te[1], te[5], te[9], te[13], - te[2], te[6], te[10], te[14], - te[3], te[7], te[11], te[15] - - ); - - } - -}; - -/** - * @author bhouston / http://exocortex.com - */ - -THREE.Ray = function ( origin, direction ) { - - this.origin = ( origin !== undefined ) ? origin : new THREE.Vector3(); - this.direction = ( direction !== undefined ) ? direction : new THREE.Vector3(); - -}; - -THREE.Ray.prototype = { - - constructor: THREE.Ray, - - set: function ( origin, direction ) { - - this.origin.copy( origin ); - this.direction.copy( direction ); - - return this; - - }, - - copy: function ( ray ) { - - this.origin.copy( ray.origin ); - this.direction.copy( ray.direction ); - - return this; - - }, - - at: function ( t, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - return result.copy( this.direction ).multiplyScalar( t ).add( this.origin ); - - }, - - recast: function () { - - var v1 = new THREE.Vector3(); - - return function ( t ) { - - this.origin.copy( this.at( t, v1 ) ); - - return this; - - }; - - }(), - - closestPointToPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - result.subVectors( point, this.origin ); - var directionDistance = result.dot( this.direction ); - - if ( directionDistance < 0 ) { - - return result.copy( this.origin ); - - } - - return result.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - }, - - distanceToPoint: function () { - - var v1 = new THREE.Vector3(); - - return function ( point ) { - - var directionDistance = v1.subVectors( point, this.origin ).dot( this.direction ); - - // point behind the ray - - if ( directionDistance < 0 ) { - - return this.origin.distanceTo( point ); - - } - - v1.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - return v1.distanceTo( point ); - - }; - - }(), - - distanceSqToSegment: function( v0, v1, optionalPointOnRay, optionalPointOnSegment ) { - - // from http://www.geometrictools.com/LibMathematics/Distance/Wm5DistRay3Segment3.cpp - // It returns the min distance between the ray and the segment - // defined by v0 and v1 - // It can also set two optional targets : - // - The closest point on the ray - // - The closest point on the segment - - var segCenter = v0.clone().add( v1 ).multiplyScalar( 0.5 ); - var segDir = v1.clone().sub( v0 ).normalize(); - var segExtent = v0.distanceTo( v1 ) * 0.5; - var diff = this.origin.clone().sub( segCenter ); - var a01 = - this.direction.dot( segDir ); - var b0 = diff.dot( this.direction ); - var b1 = - diff.dot( segDir ); - var c = diff.lengthSq(); - var det = Math.abs( 1 - a01 * a01 ); - var s0, s1, sqrDist, extDet; - - if ( det >= 0 ) { - - // The ray and segment are not parallel. - - s0 = a01 * b1 - b0; - s1 = a01 * b0 - b1; - extDet = segExtent * det; - - if ( s0 >= 0 ) { - - if ( s1 >= - extDet ) { - - if ( s1 <= extDet ) { - - // region 0 - // Minimum at interior points of ray and segment. - - var invDet = 1 / det; - s0 *= invDet; - s1 *= invDet; - sqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c; - - } else { - - // region 1 - - s1 = segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - // region 5 - - s1 = - segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - if ( s1 <= - extDet) { - - // region 4 - - s0 = Math.max( 0, - ( - a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } else if ( s1 <= extDet ) { - - // region 3 - - s0 = 0; - s1 = Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = s1 * ( s1 + 2 * b1 ) + c; - - } else { - - // region 2 - - s0 = Math.max( 0, - ( a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } - - } else { - - // Ray and segment are parallel. - - s1 = ( a01 > 0 ) ? - segExtent : segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - if ( optionalPointOnRay ) { - - optionalPointOnRay.copy( this.direction.clone().multiplyScalar( s0 ).add( this.origin ) ); - - } - - if ( optionalPointOnSegment ) { - - optionalPointOnSegment.copy( segDir.clone().multiplyScalar( s1 ).add( segCenter ) ); - - } - - return sqrDist; - - }, - - isIntersectionSphere: function ( sphere ) { - - return this.distanceToPoint( sphere.center ) <= sphere.radius; - - }, - - isIntersectionPlane: function ( plane ) { - - // check if the ray lies on the plane first - - var distToPoint = plane.distanceToPoint( this.origin ); - - if ( distToPoint === 0 ) { - - return true; - - } - - var denominator = plane.normal.dot( this.direction ); - - if ( denominator * distToPoint < 0 ) { - - return true - - } - - // ray origin is behind the plane (and is pointing behind it) - - return false; - - }, - - distanceToPlane: function ( plane ) { - - var denominator = plane.normal.dot( this.direction ); - if ( denominator == 0 ) { - - // line is coplanar, return origin - if( plane.distanceToPoint( this.origin ) == 0 ) { - - return 0; - - } - - // Null is preferable to undefined since undefined means.... it is undefined - - return null; - - } - - var t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator; - - // Return if the ray never intersects the plane - - return t >= 0 ? t : null; - - }, - - intersectPlane: function ( plane, optionalTarget ) { - - var t = this.distanceToPlane( plane ); - - if ( t === null ) { - - return null; - } - - return this.at( t, optionalTarget ); - - }, - - isIntersectionBox: function () { - - var v = new THREE.Vector3(); - - return function ( box ) { - - return this.intersectBox( box, v ) !== null; - - } - - }(), - - intersectBox: function ( box , optionalTarget ) { - - // http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/ - - var tmin,tmax,tymin,tymax,tzmin,tzmax; - - var invdirx = 1/this.direction.x, - invdiry = 1/this.direction.y, - invdirz = 1/this.direction.z; - - var origin = this.origin; - - if (invdirx >= 0) { - - tmin = (box.min.x - origin.x) * invdirx; - tmax = (box.max.x - origin.x) * invdirx; - - } else { - - tmin = (box.max.x - origin.x) * invdirx; - tmax = (box.min.x - origin.x) * invdirx; - } - - if (invdiry >= 0) { - - tymin = (box.min.y - origin.y) * invdiry; - tymax = (box.max.y - origin.y) * invdiry; - - } else { - - tymin = (box.max.y - origin.y) * invdiry; - tymax = (box.min.y - origin.y) * invdiry; - } - - if ((tmin > tymax) || (tymin > tmax)) return null; - - // These lines also handle the case where tmin or tmax is NaN - // (result of 0 * Infinity). x !== x returns true if x is NaN - - if (tymin > tmin || tmin !== tmin ) tmin = tymin; - - if (tymax < tmax || tmax !== tmax ) tmax = tymax; - - if (invdirz >= 0) { - - tzmin = (box.min.z - origin.z) * invdirz; - tzmax = (box.max.z - origin.z) * invdirz; - - } else { - - tzmin = (box.max.z - origin.z) * invdirz; - tzmax = (box.min.z - origin.z) * invdirz; - } - - if ((tmin > tzmax) || (tzmin > tmax)) return null; - - if (tzmin > tmin || tmin !== tmin ) tmin = tzmin; - - if (tzmax < tmax || tmax !== tmax ) tmax = tzmax; - - //return point closest to the ray (positive side) - - if ( tmax < 0 ) return null; - - return this.at( tmin >= 0 ? tmin : tmax, optionalTarget ); - - }, - - intersectTriangle: function() { - - // Compute the offset origin, edges, and normal. - var diff = new THREE.Vector3(); - var edge1 = new THREE.Vector3(); - var edge2 = new THREE.Vector3(); - var normal = new THREE.Vector3(); - - return function ( a, b, c, backfaceCulling, optionalTarget ) { - - // from http://www.geometrictools.com/LibMathematics/Intersection/Wm5IntrRay3Triangle3.cpp - - edge1.subVectors( b, a ); - edge2.subVectors( c, a ); - normal.crossVectors( edge1, edge2 ); - - // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, - // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by - // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2)) - // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q)) - // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N) - var DdN = this.direction.dot( normal ); - var sign; - - if ( DdN > 0 ) { - - if ( backfaceCulling ) return null; - sign = 1; - - } else if ( DdN < 0 ) { - - sign = - 1; - DdN = - DdN; - - } else { - - return null; - - } - - diff.subVectors( this.origin, a ); - var DdQxE2 = sign * this.direction.dot( edge2.crossVectors( diff, edge2 ) ); - - // b1 < 0, no intersection - if ( DdQxE2 < 0 ) { - - return null; - - } - - var DdE1xQ = sign * this.direction.dot( edge1.cross( diff ) ); - - // b2 < 0, no intersection - if ( DdE1xQ < 0 ) { - - return null; - - } - - // b1+b2 > 1, no intersection - if ( DdQxE2 + DdE1xQ > DdN ) { - - return null; - - } - - // Line intersects triangle, check if ray does. - var QdN = - sign * diff.dot( normal ); - - // t < 0, no intersection - if ( QdN < 0 ) { - - return null; - - } - - // Ray intersects triangle. - return this.at( QdN / DdN, optionalTarget ); - - } - - }(), - - applyMatrix4: function ( matrix4 ) { - - this.direction.add( this.origin ).applyMatrix4( matrix4 ); - this.origin.applyMatrix4( matrix4 ); - this.direction.sub( this.origin ); - this.direction.normalize(); - - return this; - }, - - equals: function ( ray ) { - - return ray.origin.equals( this.origin ) && ray.direction.equals( this.direction ); - - }, - - clone: function () { - - return new THREE.Ray().copy( this ); - - } - -}; - -/** - * @author bhouston / http://exocortex.com - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Sphere = function ( center, radius ) { - - this.center = ( center !== undefined ) ? center : new THREE.Vector3(); - this.radius = ( radius !== undefined ) ? radius : 0; - -}; - -THREE.Sphere.prototype = { - - constructor: THREE.Sphere, - - set: function ( center, radius ) { - - this.center.copy( center ); - this.radius = radius; - - return this; - }, - - - setFromPoints: function () { - - var box = new THREE.Box3(); - - return function ( points, optionalCenter ) { - - var center = this.center; - - if ( optionalCenter !== undefined ) { - - center.copy( optionalCenter ); - - } else { - - box.setFromPoints( points ).center( center ); - - } - - var maxRadiusSq = 0; - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) ); - - } - - this.radius = Math.sqrt( maxRadiusSq ); - - return this; - - }; - - }(), - - copy: function ( sphere ) { - - this.center.copy( sphere.center ); - this.radius = sphere.radius; - - return this; - - }, - - empty: function () { - - return ( this.radius <= 0 ); - - }, - - containsPoint: function ( point ) { - - return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) ); - - }, - - distanceToPoint: function ( point ) { - - return ( point.distanceTo( this.center ) - this.radius ); - - }, - - intersectsSphere: function ( sphere ) { - - var radiusSum = this.radius + sphere.radius; - - return sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum ); - - }, - - clampPoint: function ( point, optionalTarget ) { - - var deltaLengthSq = this.center.distanceToSquared( point ); - - var result = optionalTarget || new THREE.Vector3(); - result.copy( point ); - - if ( deltaLengthSq > ( this.radius * this.radius ) ) { - - result.sub( this.center ).normalize(); - result.multiplyScalar( this.radius ).add( this.center ); - - } - - return result; - - }, - - getBoundingBox: function ( optionalTarget ) { - - var box = optionalTarget || new THREE.Box3(); - - box.set( this.center, this.center ); - box.expandByScalar( this.radius ); - - return box; - - }, - - applyMatrix4: function ( matrix ) { - - this.center.applyMatrix4( matrix ); - this.radius = this.radius * matrix.getMaxScaleOnAxis(); - - return this; - - }, - - translate: function ( offset ) { - - this.center.add( offset ); - - return this; - - }, - - equals: function ( sphere ) { - - return sphere.center.equals( this.center ) && ( sphere.radius === this.radius ); - - }, - - clone: function () { - - return new THREE.Sphere().copy( this ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author bhouston / http://exocortex.com - */ - -THREE.Frustum = function ( p0, p1, p2, p3, p4, p5 ) { - - this.planes = [ - - ( p0 !== undefined ) ? p0 : new THREE.Plane(), - ( p1 !== undefined ) ? p1 : new THREE.Plane(), - ( p2 !== undefined ) ? p2 : new THREE.Plane(), - ( p3 !== undefined ) ? p3 : new THREE.Plane(), - ( p4 !== undefined ) ? p4 : new THREE.Plane(), - ( p5 !== undefined ) ? p5 : new THREE.Plane() - - ]; - -}; - -THREE.Frustum.prototype = { - - constructor: THREE.Frustum, - - set: function ( p0, p1, p2, p3, p4, p5 ) { - - var planes = this.planes; - - planes[0].copy( p0 ); - planes[1].copy( p1 ); - planes[2].copy( p2 ); - planes[3].copy( p3 ); - planes[4].copy( p4 ); - planes[5].copy( p5 ); - - return this; - - }, - - copy: function ( frustum ) { - - var planes = this.planes; - - for( var i = 0; i < 6; i ++ ) { - - planes[i].copy( frustum.planes[i] ); - - } - - return this; - - }, - - setFromMatrix: function ( m ) { - - var planes = this.planes; - var me = m.elements; - var me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3]; - var me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7]; - var me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11]; - var me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15]; - - planes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize(); - planes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize(); - planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize(); - planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize(); - planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); - planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize(); - - return this; - - }, - - intersectsObject: function () { - - var sphere = new THREE.Sphere(); - - return function ( object ) { - - var geometry = object.geometry; - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( object.matrixWorld ); - - return this.intersectsSphere( sphere ); - - }; - - }(), - - intersectsSphere: function ( sphere ) { - - var planes = this.planes; - var center = sphere.center; - var negRadius = -sphere.radius; - - for ( var i = 0; i < 6; i ++ ) { - - var distance = planes[ i ].distanceToPoint( center ); - - if ( distance < negRadius ) { - - return false; - - } - - } - - return true; - - }, - - intersectsBox : function() { - - var p1 = new THREE.Vector3(), - p2 = new THREE.Vector3(); - - return function( box ) { - - var planes = this.planes; - - for ( var i = 0; i < 6 ; i ++ ) { - - var plane = planes[i]; - - p1.x = plane.normal.x > 0 ? box.min.x : box.max.x; - p2.x = plane.normal.x > 0 ? box.max.x : box.min.x; - p1.y = plane.normal.y > 0 ? box.min.y : box.max.y; - p2.y = plane.normal.y > 0 ? box.max.y : box.min.y; - p1.z = plane.normal.z > 0 ? box.min.z : box.max.z; - p2.z = plane.normal.z > 0 ? box.max.z : box.min.z; - - var d1 = plane.distanceToPoint( p1 ); - var d2 = plane.distanceToPoint( p2 ); - - // if both outside plane, no intersection - - if ( d1 < 0 && d2 < 0 ) { - - return false; - - } - } - - return true; - }; - - }(), - - - containsPoint: function ( point ) { - - var planes = this.planes; - - for ( var i = 0; i < 6; i ++ ) { - - if ( planes[ i ].distanceToPoint( point ) < 0 ) { - - return false; - - } - - } - - return true; - - }, - - clone: function () { - - return new THREE.Frustum().copy( this ); - - } - -}; - -/** - * @author bhouston / http://exocortex.com - */ - -THREE.Plane = function ( normal, constant ) { - - this.normal = ( normal !== undefined ) ? normal : new THREE.Vector3( 1, 0, 0 ); - this.constant = ( constant !== undefined ) ? constant : 0; - -}; - -THREE.Plane.prototype = { - - constructor: THREE.Plane, - - set: function ( normal, constant ) { - - this.normal.copy( normal ); - this.constant = constant; - - return this; - - }, - - setComponents: function ( x, y, z, w ) { - - this.normal.set( x, y, z ); - this.constant = w; - - return this; - - }, - - setFromNormalAndCoplanarPoint: function ( normal, point ) { - - this.normal.copy( normal ); - this.constant = - point.dot( this.normal ); // must be this.normal, not normal, as this.normal is normalized - - return this; - - }, - - setFromCoplanarPoints: function() { - - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - - return function ( a, b, c ) { - - var normal = v1.subVectors( c, b ).cross( v2.subVectors( a, b ) ).normalize(); - - // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? - - this.setFromNormalAndCoplanarPoint( normal, a ); - - return this; - - }; - - }(), - - - copy: function ( plane ) { - - this.normal.copy( plane.normal ); - this.constant = plane.constant; - - return this; - - }, - - normalize: function () { - - // Note: will lead to a divide by zero if the plane is invalid. - - var inverseNormalLength = 1.0 / this.normal.length(); - this.normal.multiplyScalar( inverseNormalLength ); - this.constant *= inverseNormalLength; - - return this; - - }, - - negate: function () { - - this.constant *= -1; - this.normal.negate(); - - return this; - - }, - - distanceToPoint: function ( point ) { - - return this.normal.dot( point ) + this.constant; - - }, - - distanceToSphere: function ( sphere ) { - - return this.distanceToPoint( sphere.center ) - sphere.radius; - - }, - - projectPoint: function ( point, optionalTarget ) { - - return this.orthoPoint( point, optionalTarget ).sub( point ).negate(); - - }, - - orthoPoint: function ( point, optionalTarget ) { - - var perpendicularMagnitude = this.distanceToPoint( point ); - - var result = optionalTarget || new THREE.Vector3(); - return result.copy( this.normal ).multiplyScalar( perpendicularMagnitude ); - - }, - - isIntersectionLine: function ( line ) { - - // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it. - - var startSign = this.distanceToPoint( line.start ); - var endSign = this.distanceToPoint( line.end ); - - return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 ); - - }, - - intersectLine: function() { - - var v1 = new THREE.Vector3(); - - return function ( line, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - var direction = line.delta( v1 ); - - var denominator = this.normal.dot( direction ); - - if ( denominator == 0 ) { - - // line is coplanar, return origin - if( this.distanceToPoint( line.start ) == 0 ) { - - return result.copy( line.start ); - - } - - // Unsure if this is the correct method to handle this case. - return undefined; - - } - - var t = - ( line.start.dot( this.normal ) + this.constant ) / denominator; - - if( t < 0 || t > 1 ) { - - return undefined; - - } - - return result.copy( direction ).multiplyScalar( t ).add( line.start ); - - }; - - }(), - - - coplanarPoint: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.copy( this.normal ).multiplyScalar( - this.constant ); - - }, - - applyMatrix4: function() { - - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - var m1 = new THREE.Matrix3(); - - return function ( matrix, optionalNormalMatrix ) { - - // compute new normal based on theory here: - // http://www.songho.ca/opengl/gl_normaltransform.html - var normalMatrix = optionalNormalMatrix || m1.getNormalMatrix( matrix ); - var newNormal = v1.copy( this.normal ).applyMatrix3( normalMatrix ); - - var newCoplanarPoint = this.coplanarPoint( v2 ); - newCoplanarPoint.applyMatrix4( matrix ); - - this.setFromNormalAndCoplanarPoint( newNormal, newCoplanarPoint ); - - return this; - - }; - - }(), - - translate: function ( offset ) { - - this.constant = this.constant - offset.dot( this.normal ); - - return this; - - }, - - equals: function ( plane ) { - - return plane.normal.equals( this.normal ) && ( plane.constant == this.constant ); - - }, - - clone: function () { - - return new THREE.Plane().copy( this ); - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Math = { - - PI2: Math.PI * 2, - - generateUUID: function () { - - // http://www.broofa.com/Tools/Math.uuid.htm - - var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); - var uuid = new Array(36); - var rnd = 0, r; - - return function () { - - for ( var i = 0; i < 36; i ++ ) { - - if ( i == 8 || i == 13 || i == 18 || i == 23 ) { - - uuid[ i ] = '-'; - - } else if ( i == 14 ) { - - uuid[ i ] = '4'; - - } else { - - if (rnd <= 0x02) rnd = 0x2000000 + (Math.random()*0x1000000)|0; - r = rnd & 0xf; - rnd = rnd >> 4; - uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]; - - } - } - - return uuid.join(''); - - }; - - }(), - - // Clamp value to range <a, b> - - clamp: function ( x, a, b ) { - - return ( x < a ) ? a : ( ( x > b ) ? b : x ); - - }, - - // Clamp value to range <a, inf) - - clampBottom: function ( x, a ) { - - return x < a ? a : x; - - }, - - // Linear mapping from range <a1, a2> to range <b1, b2> - - mapLinear: function ( x, a1, a2, b1, b2 ) { - - return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 ); - - }, - - // http://en.wikipedia.org/wiki/Smoothstep - - smoothstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min )/( max - min ); - - return x*x*(3 - 2*x); - - }, - - smootherstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min )/( max - min ); - - return x*x*x*(x*(x*6 - 15) + 10); - - }, - - // Random float from <0, 1> with 16 bits of randomness - // (standard Math.random() creates repetitive patterns when applied over larger space) - - random16: function () { - - return ( 65280 * Math.random() + 255 * Math.random() ) / 65535; - - }, - - // Random integer from <low, high> interval - - randInt: function ( low, high ) { - - return low + Math.floor( Math.random() * ( high - low + 1 ) ); - - }, - - // Random float from <low, high> interval - - randFloat: function ( low, high ) { - - return low + Math.random() * ( high - low ); - - }, - - // Random float from <-range/2, range/2> interval - - randFloatSpread: function ( range ) { - - return range * ( 0.5 - Math.random() ); - - }, - - sign: function ( x ) { - - return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : 0; - - }, - - degToRad: function() { - - var degreeToRadiansFactor = Math.PI / 180; - - return function ( degrees ) { - - return degrees * degreeToRadiansFactor; - - }; - - }(), - - radToDeg: function() { - - var radianToDegreesFactor = 180 / Math.PI; - - return function ( radians ) { - - return radians * radianToDegreesFactor; - - }; - - }(), - - isPowerOfTwo: function ( value ) { - return ( value & ( value - 1 ) ) === 0 && value !== 0; - } - -}; - -/** - * Spline from Tween.js, slightly optimized (and trashed) - * http://sole.github.com/tween.js/examples/05_spline.html - * - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Spline = function ( points ) { - - this.points = points; - - var c = [], v3 = { x: 0, y: 0, z: 0 }, - point, intPoint, weight, w2, w3, - pa, pb, pc, pd; - - this.initFromArray = function( a ) { - - this.points = []; - - for ( var i = 0; i < a.length; i++ ) { - - this.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] }; - - } - - }; - - this.getPoint = function ( k ) { - - point = ( this.points.length - 1 ) * k; - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1; - c[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2; - - pa = this.points[ c[ 0 ] ]; - pb = this.points[ c[ 1 ] ]; - pc = this.points[ c[ 2 ] ]; - pd = this.points[ c[ 3 ] ]; - - w2 = weight * weight; - w3 = weight * w2; - - v3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 ); - v3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 ); - v3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 ); - - return v3; - - }; - - this.getControlPointsArray = function () { - - var i, p, l = this.points.length, - coords = []; - - for ( i = 0; i < l; i ++ ) { - - p = this.points[ i ]; - coords[ i ] = [ p.x, p.y, p.z ]; - - } - - return coords; - - }; - - // approximate length by summing linear segments - - this.getLength = function ( nSubDivisions ) { - - var i, index, nSamples, position, - point = 0, intPoint = 0, oldIntPoint = 0, - oldPosition = new THREE.Vector3(), - tmpVec = new THREE.Vector3(), - chunkLengths = [], - totalLength = 0; - - // first point has 0 length - - chunkLengths[ 0 ] = 0; - - if ( !nSubDivisions ) nSubDivisions = 100; - - nSamples = this.points.length * nSubDivisions; - - oldPosition.copy( this.points[ 0 ] ); - - for ( i = 1; i < nSamples; i ++ ) { - - index = i / nSamples; - - position = this.getPoint( index ); - tmpVec.copy( position ); - - totalLength += tmpVec.distanceTo( oldPosition ); - - oldPosition.copy( position ); - - point = ( this.points.length - 1 ) * index; - intPoint = Math.floor( point ); - - if ( intPoint != oldIntPoint ) { - - chunkLengths[ intPoint ] = totalLength; - oldIntPoint = intPoint; - - } - - } - - // last point ends with total length - - chunkLengths[ chunkLengths.length ] = totalLength; - - return { chunks: chunkLengths, total: totalLength }; - - }; - - this.reparametrizeByArcLength = function ( samplingCoef ) { - - var i, j, - index, indexCurrent, indexNext, - linearDistance, realDistance, - sampling, position, - newpoints = [], - tmpVec = new THREE.Vector3(), - sl = this.getLength(); - - newpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() ); - - for ( i = 1; i < this.points.length; i++ ) { - - //tmpVec.copy( this.points[ i - 1 ] ); - //linearDistance = tmpVec.distanceTo( this.points[ i ] ); - - realDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ]; - - sampling = Math.ceil( samplingCoef * realDistance / sl.total ); - - indexCurrent = ( i - 1 ) / ( this.points.length - 1 ); - indexNext = i / ( this.points.length - 1 ); - - for ( j = 1; j < sampling - 1; j++ ) { - - index = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent ); - - position = this.getPoint( index ); - newpoints.push( tmpVec.copy( position ).clone() ); - - } - - newpoints.push( tmpVec.copy( this.points[ i ] ).clone() ); - - } - - this.points = newpoints; - - }; - - // Catmull-Rom - - function interpolate( p0, p1, p2, p3, t, t2, t3 ) { - - var v0 = ( p2 - p0 ) * 0.5, - v1 = ( p3 - p1 ) * 0.5; - - return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - }; - -}; - -/** - * @author bhouston / http://exocortex.com - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Triangle = function ( a, b, c ) { - - this.a = ( a !== undefined ) ? a : new THREE.Vector3(); - this.b = ( b !== undefined ) ? b : new THREE.Vector3(); - this.c = ( c !== undefined ) ? c : new THREE.Vector3(); - -}; - -THREE.Triangle.normal = function() { - - var v0 = new THREE.Vector3(); - - return function ( a, b, c, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - result.subVectors( c, b ); - v0.subVectors( a, b ); - result.cross( v0 ); - - var resultLengthSq = result.lengthSq(); - if( resultLengthSq > 0 ) { - - return result.multiplyScalar( 1 / Math.sqrt( resultLengthSq ) ); - - } - - return result.set( 0, 0, 0 ); - - }; - -}(); - -// static/instance method to calculate barycoordinates -// based on: http://www.blackpawn.com/texts/pointinpoly/default.html -THREE.Triangle.barycoordFromPoint = function() { - - var v0 = new THREE.Vector3(); - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - - return function ( point, a, b, c, optionalTarget ) { - - v0.subVectors( c, a ); - v1.subVectors( b, a ); - v2.subVectors( point, a ); - - var dot00 = v0.dot( v0 ); - var dot01 = v0.dot( v1 ); - var dot02 = v0.dot( v2 ); - var dot11 = v1.dot( v1 ); - var dot12 = v1.dot( v2 ); - - var denom = ( dot00 * dot11 - dot01 * dot01 ); - - var result = optionalTarget || new THREE.Vector3(); - - // colinear or singular triangle - if( denom == 0 ) { - // arbitrary location outside of triangle? - // not sure if this is the best idea, maybe should be returning undefined - return result.set( -2, -1, -1 ); - } - - var invDenom = 1 / denom; - var u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom; - var v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom; - - // barycoordinates must always sum to 1 - return result.set( 1 - u - v, v, u ); - - }; - -}(); - -THREE.Triangle.containsPoint = function() { - - var v1 = new THREE.Vector3(); - - return function ( point, a, b, c ) { - - var result = THREE.Triangle.barycoordFromPoint( point, a, b, c, v1 ); - - return ( result.x >= 0 ) && ( result.y >= 0 ) && ( ( result.x + result.y ) <= 1 ); - - }; - -}(); - -THREE.Triangle.prototype = { - - constructor: THREE.Triangle, - - set: function ( a, b, c ) { - - this.a.copy( a ); - this.b.copy( b ); - this.c.copy( c ); - - return this; - - }, - - setFromPointsAndIndices: function ( points, i0, i1, i2 ) { - - this.a.copy( points[i0] ); - this.b.copy( points[i1] ); - this.c.copy( points[i2] ); - - return this; - - }, - - copy: function ( triangle ) { - - this.a.copy( triangle.a ); - this.b.copy( triangle.b ); - this.c.copy( triangle.c ); - - return this; - - }, - - area: function() { - - var v0 = new THREE.Vector3(); - var v1 = new THREE.Vector3(); - - return function () { - - v0.subVectors( this.c, this.b ); - v1.subVectors( this.a, this.b ); - - return v0.cross( v1 ).length() * 0.5; - - }; - - }(), - - midpoint: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 ); - - }, - - normal: function ( optionalTarget ) { - - return THREE.Triangle.normal( this.a, this.b, this.c, optionalTarget ); - - }, - - plane: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Plane(); - - return result.setFromCoplanarPoints( this.a, this.b, this.c ); - - }, - - barycoordFromPoint: function ( point, optionalTarget ) { - - return THREE.Triangle.barycoordFromPoint( point, this.a, this.b, this.c, optionalTarget ); - - }, - - containsPoint: function ( point ) { - - return THREE.Triangle.containsPoint( point, this.a, this.b, this.c ); - - }, - - equals: function ( triangle ) { - - return triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c ); - - }, - - clone: function () { - - return new THREE.Triangle().copy( this ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Vertex = function ( v ) { - - console.warn( 'THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.') - return v; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.UV = function ( u, v ) { - - console.warn( 'THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.') - return new THREE.Vector2( u, v ); - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Clock = function ( autoStart ) { - - this.autoStart = ( autoStart !== undefined ) ? autoStart : true; - - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - - this.running = false; - -}; - -THREE.Clock.prototype = { - - constructor: THREE.Clock, - - start: function () { - - this.startTime = self.performance !== undefined && self.performance.now !== undefined - ? self.performance.now() - : Date.now(); - - this.oldTime = this.startTime; - this.running = true; - }, - - stop: function () { - - this.getElapsedTime(); - this.running = false; - - }, - - getElapsedTime: function () { - - this.getDelta(); - return this.elapsedTime; - - }, - - getDelta: function () { - - var diff = 0; - - if ( this.autoStart && ! this.running ) { - - this.start(); - - } - - if ( this.running ) { - - var newTime = self.performance !== undefined && self.performance.now !== undefined - ? self.performance.now() - : Date.now(); - - diff = 0.001 * ( newTime - this.oldTime ); - this.oldTime = newTime; - - this.elapsedTime += diff; - - } - - return diff; - - } - -}; - -/** - * https://github.com/mrdoob/eventdispatcher.js/ - */ - -THREE.EventDispatcher = function () {} - -THREE.EventDispatcher.prototype = { - - constructor: THREE.EventDispatcher, - - apply: function ( object ) { - - object.addEventListener = THREE.EventDispatcher.prototype.addEventListener; - object.hasEventListener = THREE.EventDispatcher.prototype.hasEventListener; - object.removeEventListener = THREE.EventDispatcher.prototype.removeEventListener; - object.dispatchEvent = THREE.EventDispatcher.prototype.dispatchEvent; - - }, - - addEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) this._listeners = {}; - - var listeners = this._listeners; - - if ( listeners[ type ] === undefined ) { - - listeners[ type ] = []; - - } - - if ( listeners[ type ].indexOf( listener ) === - 1 ) { - - listeners[ type ].push( listener ); - - } - - }, - - hasEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return false; - - var listeners = this._listeners; - - if ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) { - - return true; - - } - - return false; - - }, - - removeEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return; - - var listeners = this._listeners; - var listenerArray = listeners[ type ]; - - if ( listenerArray !== undefined ) { - - var index = listenerArray.indexOf( listener ); - - if ( index !== - 1 ) { - - listenerArray.splice( index, 1 ); - - } - - } - - }, - - dispatchEvent: function () { - - var array = []; - - return function ( event ) { - - if ( this._listeners === undefined ) return; - - var listeners = this._listeners; - var listenerArray = listeners[ event.type ]; - - if ( listenerArray !== undefined ) { - - event.target = this; - - var length = listenerArray.length; - - for ( var i = 0; i < length; i ++ ) { - - array[ i ] = listenerArray[ i ]; - - } - - for ( var i = 0; i < length; i ++ ) { - - array[ i ].call( this, event ); - - } - - } - - }; - - }() - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author bhouston / http://exocortex.com/ - * @author stephomi / http://stephaneginier.com/ - */ - -( function ( THREE ) { - - THREE.Raycaster = function ( origin, direction, near, far ) { - - this.ray = new THREE.Ray( origin, direction ); - // direction is assumed to be normalized (for accurate distance calculations) - - this.near = near || 0; - this.far = far || Infinity; - - }; - - var sphere = new THREE.Sphere(); - var localRay = new THREE.Ray(); - var facePlane = new THREE.Plane(); - var intersectPoint = new THREE.Vector3(); - var matrixPosition = new THREE.Vector3(); - - var inverseMatrix = new THREE.Matrix4(); - - var descSort = function ( a, b ) { - - return a.distance - b.distance; - - }; - - var vA = new THREE.Vector3(); - var vB = new THREE.Vector3(); - var vC = new THREE.Vector3(); - - var intersectObject = function ( object, raycaster, intersects ) { - - if ( object instanceof THREE.Sprite ) { - - matrixPosition.setFromMatrixPosition( object.matrixWorld ); - - var distance = raycaster.ray.distanceToPoint( matrixPosition ); - - if ( distance > object.scale.x ) { - - return intersects; - - } - - intersects.push( { - - distance: distance, - point: object.position, - face: null, - object: object - - } ); - - } else if ( object instanceof THREE.LOD ) { - - matrixPosition.setFromMatrixPosition( object.matrixWorld ); - var distance = raycaster.ray.origin.distanceTo( matrixPosition ); - - intersectObject( object.getObjectForDistance( distance ), raycaster, intersects ); - - } else if ( object instanceof THREE.Mesh ) { - - var geometry = object.geometry; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( object.matrixWorld ); - - if ( raycaster.ray.isIntersectionSphere( sphere ) === false ) { - - return intersects; - - } - - // Check boundingBox before continuing - - inverseMatrix.getInverse( object.matrixWorld ); - localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - if ( geometry.boundingBox !== null ) { - - if ( localRay.isIntersectionBox( geometry.boundingBox ) === false ) { - - return intersects; - - } - - } - - if ( geometry instanceof THREE.BufferGeometry ) { - - var material = object.material; - - if ( material === undefined ) return intersects; - - var attributes = geometry.attributes; - - var a, b, c; - var precision = raycaster.precision; - - if ( attributes.index !== undefined ) { - - var offsets = geometry.offsets; - var indices = attributes.index.array; - var positions = attributes.position.array; - - for ( var oi = 0, ol = offsets.length; oi < ol; ++oi ) { - - var start = offsets[ oi ].start; - var count = offsets[ oi ].count; - var index = offsets[ oi ].index; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - a = index + indices[ i ]; - b = index + indices[ i + 1 ]; - c = index + indices[ i + 2 ]; - - vA.set( - positions[ a * 3 ], - positions[ a * 3 + 1 ], - positions[ a * 3 + 2 ] - ); - vB.set( - positions[ b * 3 ], - positions[ b * 3 + 1 ], - positions[ b * 3 + 2 ] - ); - vC.set( - positions[ c * 3 ], - positions[ c * 3 + 1 ], - positions[ c * 3 + 2 ] - ); - - - if ( material.side === THREE.BackSide ) { - - var intersectionPoint = localRay.intersectTriangle( vC, vB, vA, true ); - - } else { - - var intersectionPoint = localRay.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide ); - - } - - if ( intersectionPoint === null ) continue; - - intersectionPoint.applyMatrix4( object.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectionPoint ); - - if ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - point: intersectionPoint, - indices: [a, b, c], - face: null, - faceIndex: null, - object: object - - } ); - - } - - } - - } else { - - var offsets = geometry.offsets; - var positions = attributes.position.array; - - for ( var i = 0, il = attributes.position.array.length; i < il; i += 3 ) { - - a = i; - b = i + 1; - c = i + 2; - - vA.set( - positions[ a * 3 ], - positions[ a * 3 + 1 ], - positions[ a * 3 + 2 ] - ); - vB.set( - positions[ b * 3 ], - positions[ b * 3 + 1 ], - positions[ b * 3 + 2 ] - ); - vC.set( - positions[ c * 3 ], - positions[ c * 3 + 1 ], - positions[ c * 3 + 2 ] - ); - - - if ( material.side === THREE.BackSide ) { - - var intersectionPoint = localRay.intersectTriangle( vC, vB, vA, true ); - - } else { - - var intersectionPoint = localRay.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide ); - - } - - if ( intersectionPoint === null ) continue; - - intersectionPoint.applyMatrix4( object.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectionPoint ); - - if ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - point: intersectionPoint, - indices: [a, b, c], - face: null, - faceIndex: null, - object: object - - } ); - - } - - } - - } else if ( geometry instanceof THREE.Geometry ) { - - var isFaceMaterial = object.material instanceof THREE.MeshFaceMaterial; - var objectMaterials = isFaceMaterial === true ? object.material.materials : null; - - var a, b, c, d; - var precision = raycaster.precision; - - var vertices = geometry.vertices; - - for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) { - - var face = geometry.faces[ f ]; - - var material = isFaceMaterial === true ? objectMaterials[ face.materialIndex ] : object.material; - - if ( material === undefined ) continue; - - a = vertices[ face.a ]; - b = vertices[ face.b ]; - c = vertices[ face.c ]; - - if ( material.morphTargets === true ) { - - var morphTargets = geometry.morphTargets; - var morphInfluences = object.morphTargetInfluences; - - vA.set( 0, 0, 0 ); - vB.set( 0, 0, 0 ); - vC.set( 0, 0, 0 ); - - for ( var t = 0, tl = morphTargets.length; t < tl; t ++ ) { - - var influence = morphInfluences[ t ]; - - if ( influence === 0 ) continue; - - var targets = morphTargets[ t ].vertices; - - vA.x += ( targets[ face.a ].x - a.x ) * influence; - vA.y += ( targets[ face.a ].y - a.y ) * influence; - vA.z += ( targets[ face.a ].z - a.z ) * influence; - - vB.x += ( targets[ face.b ].x - b.x ) * influence; - vB.y += ( targets[ face.b ].y - b.y ) * influence; - vB.z += ( targets[ face.b ].z - b.z ) * influence; - - vC.x += ( targets[ face.c ].x - c.x ) * influence; - vC.y += ( targets[ face.c ].y - c.y ) * influence; - vC.z += ( targets[ face.c ].z - c.z ) * influence; - - } - - vA.add( a ); - vB.add( b ); - vC.add( c ); - - a = vA; - b = vB; - c = vC; - - } - - if ( material.side === THREE.BackSide ) { - - var intersectionPoint = localRay.intersectTriangle( c, b, a, true ); - - } else { - - var intersectionPoint = localRay.intersectTriangle( a, b, c, material.side !== THREE.DoubleSide ); - - } - - if ( intersectionPoint === null ) continue; - - intersectionPoint.applyMatrix4( object.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectionPoint ); - - if ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - point: intersectionPoint, - face: face, - faceIndex: f, - object: object - - } ); - - } - - } - - } else if ( object instanceof THREE.Line ) { - - var precision = raycaster.linePrecision; - var precisionSq = precision * precision; - - var geometry = object.geometry; - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - // Checking boundingSphere distance to ray - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( object.matrixWorld ); - - if ( raycaster.ray.isIntersectionSphere( sphere ) === false ) { - - return intersects; - - } - - inverseMatrix.getInverse( object.matrixWorld ); - localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - /* if ( geometry instanceof THREE.BufferGeometry ) { - - } else */ if ( geometry instanceof THREE.Geometry ) { - - var vertices = geometry.vertices; - var nbVertices = vertices.length; - var interSegment = new THREE.Vector3(); - var interRay = new THREE.Vector3(); - var step = object.type === THREE.LineStrip ? 1 : 2; - - for ( var i = 0; i < nbVertices - 1; i = i + step ) { - - var distSq = localRay.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - var distance = localRay.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( object.matrixWorld ), - face: null, - faceIndex: null, - object: object - - } ); - - } - - } - - } - - }; - - var intersectDescendants = function ( object, raycaster, intersects ) { - - var descendants = object.getDescendants(); - - for ( var i = 0, l = descendants.length; i < l; i ++ ) { - - intersectObject( descendants[ i ], raycaster, intersects ); - - } - }; - - // - - THREE.Raycaster.prototype.precision = 0.0001; - THREE.Raycaster.prototype.linePrecision = 1; - - THREE.Raycaster.prototype.set = function ( origin, direction ) { - - this.ray.set( origin, direction ); - // direction is assumed to be normalized (for accurate distance calculations) - - }; - - THREE.Raycaster.prototype.intersectObject = function ( object, recursive ) { - - var intersects = []; - - if ( recursive === true ) { - - intersectDescendants( object, this, intersects ); - - } - - intersectObject( object, this, intersects ); - - intersects.sort( descSort ); - - return intersects; - - }; - - THREE.Raycaster.prototype.intersectObjects = function ( objects, recursive ) { - - var intersects = []; - - for ( var i = 0, l = objects.length; i < l; i ++ ) { - - intersectObject( objects[ i ], this, intersects ); - - if ( recursive === true ) { - - intersectDescendants( objects[ i ], this, intersects ); - - } - - } - - intersects.sort( descSort ); - - return intersects; - - }; - -}( THREE ) ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Object3D = function () { - - this.id = THREE.Object3DIdCount ++; - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - - this.parent = undefined; - this.children = []; - - this.up = new THREE.Vector3( 0, 1, 0 ); - - this.position = new THREE.Vector3(); - this._rotation = new THREE.Euler(); - this._quaternion = new THREE.Quaternion(); - this.scale = new THREE.Vector3( 1, 1, 1 ); - - // keep rotation and quaternion in sync - - this._rotation._quaternion = this.quaternion; - this._quaternion._euler = this.rotation; - - this.renderDepth = null; - - this.rotationAutoUpdate = true; - - this.matrix = new THREE.Matrix4(); - this.matrixWorld = new THREE.Matrix4(); - - this.matrixAutoUpdate = true; - this.matrixWorldNeedsUpdate = true; - - this.visible = true; - - this.castShadow = false; - this.receiveShadow = false; - - this.frustumCulled = true; - - this.userData = {}; - -}; - - -THREE.Object3D.prototype = { - - constructor: THREE.Object3D, - - get rotation () { - return this._rotation; - }, - - set rotation ( value ) { - - this._rotation = value; - this._rotation._quaternion = this._quaternion; - this._quaternion._euler = this._rotation; - this._rotation._updateQuaternion(); - - }, - - get quaternion () { - return this._quaternion; - }, - - set quaternion ( value ) { - - this._quaternion = value; - this._quaternion._euler = this._rotation; - this._rotation._quaternion = this._quaternion; - this._quaternion._updateEuler(); - - }, - - get eulerOrder () { - - console.warn( 'DEPRECATED: Object3D\'s .eulerOrder has been moved to Object3D\'s .rotation.order.' ); - - return this.rotation.order; - - }, - - set eulerOrder ( value ) { - - console.warn( 'DEPRECATED: Object3D\'s .eulerOrder has been moved to Object3D\'s .rotation.order.' ); - - this.rotation.order = value; - - }, - - get useQuaternion () { - - console.warn( 'DEPRECATED: Object3D\'s .useQuaternion has been removed. The library now uses quaternions by default.' ); - - }, - - set useQuaternion ( value ) { - - console.warn( 'DEPRECATED: Object3D\'s .useQuaternion has been removed. The library now uses quaternions by default.' ); - - }, - - applyMatrix: function ( matrix ) { - - this.matrix.multiplyMatrices( matrix, this.matrix ); - - this.matrix.decompose( this.position, this.quaternion, this.scale ); - - }, - - setRotationFromAxisAngle: function ( axis, angle ) { - - // assumes axis is normalized - - this.quaternion.setFromAxisAngle( axis, angle ); - - }, - - setRotationFromEuler: function ( euler ) { - - this.quaternion.setFromEuler( euler, true ); - - }, - - setRotationFromMatrix: function ( m ) { - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - this.quaternion.setFromRotationMatrix( m ); - - }, - - setRotationFromQuaternion: function ( q ) { - - // assumes q is normalized - - this.quaternion.copy( q ); - - }, - - rotateOnAxis: function() { - - // rotate object on axis in object space - // axis is assumed to be normalized - - var q1 = new THREE.Quaternion(); - - return function ( axis, angle ) { - - q1.setFromAxisAngle( axis, angle ); - - this.quaternion.multiply( q1 ); - - return this; - - } - - }(), - - rotateX: function () { - - var v1 = new THREE.Vector3( 1, 0, 0 ); - - return function ( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - rotateY: function () { - - var v1 = new THREE.Vector3( 0, 1, 0 ); - - return function ( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - rotateZ: function () { - - var v1 = new THREE.Vector3( 0, 0, 1 ); - - return function ( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - translateOnAxis: function () { - - // translate object by distance along axis in object space - // axis is assumed to be normalized - - var v1 = new THREE.Vector3(); - - return function ( axis, distance ) { - - v1.copy( axis ); - - v1.applyQuaternion( this.quaternion ); - - this.position.add( v1.multiplyScalar( distance ) ); - - return this; - - } - - }(), - - translate: function ( distance, axis ) { - - console.warn( 'DEPRECATED: Object3D\'s .translate() has been removed. Use .translateOnAxis( axis, distance ) instead. Note args have been changed.' ); - return this.translateOnAxis( axis, distance ); - - }, - - translateX: function () { - - var v1 = new THREE.Vector3( 1, 0, 0 ); - - return function ( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - translateY: function () { - - var v1 = new THREE.Vector3( 0, 1, 0 ); - - return function ( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - translateZ: function () { - - var v1 = new THREE.Vector3( 0, 0, 1 ); - - return function ( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - localToWorld: function ( vector ) { - - return vector.applyMatrix4( this.matrixWorld ); - - }, - - worldToLocal: function () { - - var m1 = new THREE.Matrix4(); - - return function ( vector ) { - - return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) ); - - }; - - }(), - - lookAt: function () { - - // This routine does not support objects with rotated and/or translated parent(s) - - var m1 = new THREE.Matrix4(); - - return function ( vector ) { - - m1.lookAt( vector, this.position, this.up ); - - this.quaternion.setFromRotationMatrix( m1 ); - - }; - - }(), - - add: function ( object ) { - - if ( object === this ) { - - console.warn( 'THREE.Object3D.add: An object can\'t be added as a child of itself.' ); - return; - - } - - if ( object instanceof THREE.Object3D ) { - - if ( object.parent !== undefined ) { - - object.parent.remove( object ); - - } - - object.parent = this; - object.dispatchEvent( { type: 'added' } ); - - this.children.push( object ); - - // add to scene - - var scene = this; - - while ( scene.parent !== undefined ) { - - scene = scene.parent; - - } - - if ( scene !== undefined && scene instanceof THREE.Scene ) { - - scene.__addObject( object ); - - } - - } - - }, - - remove: function ( object ) { - - var index = this.children.indexOf( object ); - - if ( index !== - 1 ) { - - object.parent = undefined; - object.dispatchEvent( { type: 'removed' } ); - - this.children.splice( index, 1 ); - - // remove from scene - - var scene = this; - - while ( scene.parent !== undefined ) { - - scene = scene.parent; - - } - - if ( scene !== undefined && scene instanceof THREE.Scene ) { - - scene.__removeObject( object ); - - } - - } - - }, - - traverse: function ( callback ) { - - callback( this ); - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].traverse( callback ); - - } - - }, - - getObjectById: function ( id, recursive ) { - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - var child = this.children[ i ]; - - if ( child.id === id ) { - - return child; - - } - - if ( recursive === true ) { - - child = child.getObjectById( id, recursive ); - - if ( child !== undefined ) { - - return child; - - } - - } - - } - - return undefined; - - }, - - getObjectByName: function ( name, recursive ) { - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - var child = this.children[ i ]; - - if ( child.name === name ) { - - return child; - - } - - if ( recursive === true ) { - - child = child.getObjectByName( name, recursive ); - - if ( child !== undefined ) { - - return child; - - } - - } - - } - - return undefined; - - }, - - getChildByName: function ( name, recursive ) { - - console.warn( 'DEPRECATED: Object3D\'s .getChildByName() has been renamed to .getObjectByName().' ); - return this.getObjectByName( name, recursive ); - - }, - - getDescendants: function ( array ) { - - if ( array === undefined ) array = []; - - Array.prototype.push.apply( array, this.children ); - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].getDescendants( array ); - - } - - return array; - - }, - - updateMatrix: function () { - - this.matrix.compose( this.position, this.quaternion, this.scale ); - - this.matrixWorldNeedsUpdate = true; - - }, - - updateMatrixWorld: function ( force ) { - - if ( this.matrixAutoUpdate === true ) this.updateMatrix(); - - if ( this.matrixWorldNeedsUpdate === true || force === true ) { - - if ( this.parent === undefined ) { - - this.matrixWorld.copy( this.matrix ); - - } else { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - } - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].updateMatrixWorld( force ); - - } - - }, - - clone: function ( object, recursive ) { - - if ( object === undefined ) object = new THREE.Object3D(); - if ( recursive === undefined ) recursive = true; - - object.name = this.name; - - object.up.copy( this.up ); - - object.position.copy( this.position ); - object.quaternion.copy( this.quaternion ); - object.scale.copy( this.scale ); - - object.renderDepth = this.renderDepth; - - object.rotationAutoUpdate = this.rotationAutoUpdate; - - object.matrix.copy( this.matrix ); - object.matrixWorld.copy( this.matrixWorld ); - - object.matrixAutoUpdate = this.matrixAutoUpdate; - object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate; - - object.visible = this.visible; - - object.castShadow = this.castShadow; - object.receiveShadow = this.receiveShadow; - - object.frustumCulled = this.frustumCulled; - - object.userData = JSON.parse( JSON.stringify( this.userData ) ); - - if ( recursive === true ) { - - for ( var i = 0; i < this.children.length; i ++ ) { - - var child = this.children[ i ]; - object.add( child.clone() ); - - } - - } - - return object; - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.Object3D.prototype ); - -THREE.Object3DIdCount = 0; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author julianwa / https://github.com/julianwa - */ - -THREE.Projector = function () { - - var _object, _objectCount, _objectPool = [], _objectPoolLength = 0, - _vertex, _vertexCount, _vertexPool = [], _vertexPoolLength = 0, - _face, _faceCount, _facePool = [], _facePoolLength = 0, - _line, _lineCount, _linePool = [], _linePoolLength = 0, - _sprite, _spriteCount, _spritePool = [], _spritePoolLength = 0, - - _renderData = { objects: [], lights: [], elements: [] }, - - _vA = new THREE.Vector3(), - _vB = new THREE.Vector3(), - _vC = new THREE.Vector3(), - - _vector3 = new THREE.Vector3(), - _vector4 = new THREE.Vector4(), - - _clipBox = new THREE.Box3( new THREE.Vector3( -1, -1, -1 ), new THREE.Vector3( 1, 1, 1 ) ), - _boundingBox = new THREE.Box3(), - _points3 = new Array( 3 ), - _points4 = new Array( 4 ), - - _viewMatrix = new THREE.Matrix4(), - _viewProjectionMatrix = new THREE.Matrix4(), - - _modelMatrix, - _modelViewProjectionMatrix = new THREE.Matrix4(), - - _normalMatrix = new THREE.Matrix3(), - - _frustum = new THREE.Frustum(), - - _clippedVertex1PositionScreen = new THREE.Vector4(), - _clippedVertex2PositionScreen = new THREE.Vector4(); - - this.projectVector = function ( vector, camera ) { - - camera.matrixWorldInverse.getInverse( camera.matrixWorld ); - - _viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - - return vector.applyProjection( _viewProjectionMatrix ); - - }; - - this.unprojectVector = function () { - - var projectionMatrixInverse = new THREE.Matrix4(); - - return function ( vector, camera ) { - - projectionMatrixInverse.getInverse( camera.projectionMatrix ); - _viewProjectionMatrix.multiplyMatrices( camera.matrixWorld, projectionMatrixInverse ); - - return vector.applyProjection( _viewProjectionMatrix ); - - }; - - }(); - - this.pickingRay = function ( vector, camera ) { - - // set two vectors with opposing z values - vector.z = -1.0; - var end = new THREE.Vector3( vector.x, vector.y, 1.0 ); - - this.unprojectVector( vector, camera ); - this.unprojectVector( end, camera ); - - // find direction from vector to end - end.sub( vector ).normalize(); - - return new THREE.Raycaster( vector, end ); - - }; - - var projectObject = function ( object ) { - - if ( object.visible === false ) return; - - if ( object instanceof THREE.Light ) { - - _renderData.lights.push( object ); - - } else if ( object instanceof THREE.Mesh || object instanceof THREE.Line || object instanceof THREE.Sprite ) { - - if ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) { - - _object = getNextObjectInPool(); - _object.id = object.id; - _object.object = object; - - if ( object.renderDepth !== null ) { - - _object.z = object.renderDepth; - - } else { - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyProjection( _viewProjectionMatrix ); - _object.z = _vector3.z; - - } - - _renderData.objects.push( _object ); - - } - - } - - for ( var i = 0, l = object.children.length; i < l; i ++ ) { - - projectObject( object.children[ i ] ); - - } - - }; - - var projectGraph = function ( root, sortObjects ) { - - _objectCount = 0; - - _renderData.objects.length = 0; - _renderData.lights.length = 0; - - projectObject( root ); - - if ( sortObjects === true ) { - - _renderData.objects.sort( painterSort ); - - } - - }; - - var RenderList = function () { - - var normals = []; - - var object = null; - var normalMatrix = new THREE.Matrix3(); - - var setObject = function ( value ) { - - object = value; - normalMatrix.getNormalMatrix( object.matrixWorld ); - - normals.length = 0; - - }; - - var projectVertex = function ( vertex ) { - - var position = vertex.position; - var positionWorld = vertex.positionWorld; - var positionScreen = vertex.positionScreen; - - positionWorld.copy( position ).applyMatrix4( _modelMatrix ); - positionScreen.copy( positionWorld ).applyMatrix4( _viewProjectionMatrix ); - - var invW = 1 / positionScreen.w; - - positionScreen.x *= invW; - positionScreen.y *= invW; - positionScreen.z *= invW; - - vertex.visible = positionScreen.x >= -1 && positionScreen.x <= 1 && - positionScreen.y >= -1 && positionScreen.y <= 1 && - positionScreen.z >= -1 && positionScreen.z <= 1; - - }; - - var pushVertex = function ( x, y, z ) { - - _vertex = getNextVertexInPool(); - _vertex.position.set( x, y, z ); - - projectVertex( _vertex ); - - }; - - var pushNormal = function ( x, y, z ) { - - normals.push( x, y, z ); - - }; - - var checkTriangleVisibility = function ( v1, v2, v3 ) { - - _points3[ 0 ] = v1.positionScreen; - _points3[ 1 ] = v2.positionScreen; - _points3[ 2 ] = v3.positionScreen; - - if ( v1.visible === true || v2.visible === true || v3.visible === true || - _clipBox.isIntersectionBox( _boundingBox.setFromPoints( _points3 ) ) ) { - - return ( ( v3.positionScreen.x - v1.positionScreen.x ) * - ( v2.positionScreen.y - v1.positionScreen.y ) - - ( v3.positionScreen.y - v1.positionScreen.y ) * - ( v2.positionScreen.x - v1.positionScreen.x ) ) < 0; - - } - - return false; - - }; - - var pushLine = function ( a, b ) { - - var v1 = _vertexPool[ a ]; - var v2 = _vertexPool[ b ]; - - _line = getNextLineInPool(); - - _line.id = object.id; - _line.v1.copy( v1 ); - _line.v2.copy( v2 ); - _line.z = ( v1.positionScreen.z + v2.positionScreen.z ) / 2; - - _line.material = object.material; - - _renderData.elements.push( _line ); - - }; - - var pushTriangle = function ( a, b, c ) { - - var v1 = _vertexPool[ a ]; - var v2 = _vertexPool[ b ]; - var v3 = _vertexPool[ c ]; - - if ( checkTriangleVisibility( v1, v2, v3 ) === true ) { - - _face = getNextFaceInPool(); - - _face.id = object.id; - _face.v1.copy( v1 ); - _face.v2.copy( v2 ); - _face.v3.copy( v3 ); - _face.z = ( v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z ) / 3; - - for ( var i = 0; i < 3; i ++ ) { - - var offset = arguments[ i ] * 3; - var normal = _face.vertexNormalsModel[ i ]; - - normal.set( normals[ offset + 0 ], normals[ offset + 1 ], normals[ offset + 2 ] ); - normal.applyMatrix3( normalMatrix ).normalize(); - - } - - _face.vertexNormalsLength = 3; - - _face.material = object.material; - - _renderData.elements.push( _face ); - - } - - }; - - return { - setObject: setObject, - projectVertex: projectVertex, - checkTriangleVisibility: checkTriangleVisibility, - pushVertex: pushVertex, - pushNormal: pushNormal, - pushLine: pushLine, - pushTriangle: pushTriangle - } - - }; - - var renderList = new RenderList(); - - this.projectScene = function ( scene, camera, sortObjects, sortElements ) { - - var object, geometry, vertices, faces, face, faceVertexNormals, faceVertexUvs, uvs, - isFaceMaterial, objectMaterials; - - _faceCount = 0; - _lineCount = 0; - _spriteCount = 0; - - _renderData.elements.length = 0; - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - if ( camera.parent === undefined ) camera.updateMatrixWorld(); - - _viewMatrix.copy( camera.matrixWorldInverse.getInverse( camera.matrixWorld ) ); - _viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix ); - - _frustum.setFromMatrix( _viewProjectionMatrix ); - - projectGraph( scene, sortObjects ); - - for ( var o = 0, ol = _renderData.objects.length; o < ol; o ++ ) { - - object = _renderData.objects[ o ].object; - geometry = object.geometry; - - renderList.setObject( object ); - - _modelMatrix = object.matrixWorld; - - _vertexCount = 0; - - if ( object instanceof THREE.Mesh ) { - - if ( geometry instanceof THREE.BufferGeometry ) { - - var attributes = geometry.attributes; - var offsets = geometry.offsets; - - if ( attributes.position === undefined ) continue; - - var positions = attributes.position.array; - - for ( var i = 0, l = positions.length; i < l; i += 3 ) { - - renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - - } - - var normals = attributes.normal.array; - - for ( var i = 0, l = normals.length; i < l; i += 3 ) { - - renderList.pushNormal( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] ); - - } - - if ( attributes.index !== undefined ) { - - var indices = attributes.index.array; - - if ( offsets.length > 0 ) { - - for ( var o = 0; o < offsets.length; o ++ ) { - - var offset = offsets[ o ]; - var index = offset.index; - - for ( var i = offset.start, l = offset.start + offset.count; i < l; i += 3 ) { - - renderList.pushTriangle( indices[ i ] + index, indices[ i + 1 ] + index, indices[ i + 2 ] + index ); - - } - - } - - } else { - - for ( var i = 0, l = indices.length; i < l; i += 3 ) { - - renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] ); - - } - - } - - } else { - - for ( var i = 0, l = positions.length / 3; i < l; i += 3 ) { - - renderList.pushTriangle( i, i + 1, i + 2 ); - - } - - } - - } else if ( geometry instanceof THREE.Geometry ) { - - vertices = geometry.vertices; - faces = geometry.faces; - faceVertexUvs = geometry.faceVertexUvs; - - _normalMatrix.getNormalMatrix( _modelMatrix ); - - isFaceMaterial = object.material instanceof THREE.MeshFaceMaterial; - objectMaterials = isFaceMaterial === true ? object.material : null; - - for ( var v = 0, vl = vertices.length; v < vl; v ++ ) { - - var vertex = vertices[ v ]; - renderList.pushVertex( vertex.x, vertex.y, vertex.z ); - - } - - for ( var f = 0, fl = faces.length; f < fl; f ++ ) { - - face = faces[ f ]; - - var material = isFaceMaterial === true - ? objectMaterials.materials[ face.materialIndex ] - : object.material; - - if ( material === undefined ) continue; - - var side = material.side; - - var v1 = _vertexPool[ face.a ]; - var v2 = _vertexPool[ face.b ]; - var v3 = _vertexPool[ face.c ]; - - if ( material.morphTargets === true ) { - - var morphTargets = geometry.morphTargets; - var morphInfluences = object.morphTargetInfluences; - - var v1p = v1.position; - var v2p = v2.position; - var v3p = v3.position; - - _vA.set( 0, 0, 0 ); - _vB.set( 0, 0, 0 ); - _vC.set( 0, 0, 0 ); - - for ( var t = 0, tl = morphTargets.length; t < tl; t ++ ) { - - var influence = morphInfluences[ t ]; - - if ( influence === 0 ) continue; - - var targets = morphTargets[ t ].vertices; - - _vA.x += ( targets[ face.a ].x - v1p.x ) * influence; - _vA.y += ( targets[ face.a ].y - v1p.y ) * influence; - _vA.z += ( targets[ face.a ].z - v1p.z ) * influence; - - _vB.x += ( targets[ face.b ].x - v2p.x ) * influence; - _vB.y += ( targets[ face.b ].y - v2p.y ) * influence; - _vB.z += ( targets[ face.b ].z - v2p.z ) * influence; - - _vC.x += ( targets[ face.c ].x - v3p.x ) * influence; - _vC.y += ( targets[ face.c ].y - v3p.y ) * influence; - _vC.z += ( targets[ face.c ].z - v3p.z ) * influence; - - } - - v1.position.add( _vA ); - v2.position.add( _vB ); - v3.position.add( _vC ); - - renderList.projectVertex( v1 ); - renderList.projectVertex( v2 ); - renderList.projectVertex( v3 ); - - } - - var visible = renderList.checkTriangleVisibility( v1, v2, v3 ); - - if ( ( visible === false && side === THREE.FrontSide ) || - ( visible === true && side === THREE.BackSide ) ) continue; - - _face = getNextFaceInPool(); - - _face.id = object.id; - _face.v1.copy( v1 ); - _face.v2.copy( v2 ); - _face.v3.copy( v3 ); - - _face.normalModel.copy( face.normal ); - - if ( visible === false && ( side === THREE.BackSide || side === THREE.DoubleSide ) ) { - - _face.normalModel.negate(); - - } - - _face.normalModel.applyMatrix3( _normalMatrix ).normalize(); - - _face.centroidModel.copy( face.centroid ).applyMatrix4( _modelMatrix ); - - faceVertexNormals = face.vertexNormals; - - for ( var n = 0, nl = Math.min( faceVertexNormals.length, 3 ); n < nl; n ++ ) { - - var normalModel = _face.vertexNormalsModel[ n ]; - normalModel.copy( faceVertexNormals[ n ] ); - - if ( visible === false && ( side === THREE.BackSide || side === THREE.DoubleSide ) ) { - - normalModel.negate(); - - } - - normalModel.applyMatrix3( _normalMatrix ).normalize(); - - } - - _face.vertexNormalsLength = faceVertexNormals.length; - - for ( var c = 0, cl = Math.min( faceVertexUvs.length, 3 ); c < cl; c ++ ) { - - uvs = faceVertexUvs[ c ][ f ]; - - if ( uvs === undefined ) continue; - - for ( var u = 0, ul = uvs.length; u < ul; u ++ ) { - - _face.uvs[ c ][ u ] = uvs[ u ]; - - } - - } - - _face.color = face.color; - _face.material = material; - - _face.z = ( v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z ) / 3; - - _renderData.elements.push( _face ); - - } - - } - - } else if ( object instanceof THREE.Line ) { - - if ( geometry instanceof THREE.BufferGeometry ) { - - var attributes = geometry.attributes; - - if ( attributes.position !== undefined ) { - - var positions = attributes.position.array; - - for ( var i = 0, l = positions.length; i < l; i += 3 ) { - - renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - - } - - if ( attributes.index !== undefined ) { - - var indices = attributes.index.array; - - for ( var i = 0, l = indices.length; i < l; i += 2 ) { - - renderList.pushLine( indices[ i ], indices[ i + 1 ] ); - - } - - } else { - - for ( var i = 0, l = ( positions.length / 3 ) - 1; i < l; i ++ ) { - - renderList.pushLine( i, i + 1 ); - - } - - } - - } - - } else if ( geometry instanceof THREE.Geometry ) { - - _modelViewProjectionMatrix.multiplyMatrices( _viewProjectionMatrix, _modelMatrix ); - - vertices = object.geometry.vertices; - - if ( vertices.length === 0 ) continue; - - v1 = getNextVertexInPool(); - v1.positionScreen.copy( vertices[ 0 ] ).applyMatrix4( _modelViewProjectionMatrix ); - - // Handle LineStrip and LinePieces - var step = object.type === THREE.LinePieces ? 2 : 1; - - for ( var v = 1, vl = vertices.length; v < vl; v ++ ) { - - v1 = getNextVertexInPool(); - v1.positionScreen.copy( vertices[ v ] ).applyMatrix4( _modelViewProjectionMatrix ); - - if ( ( v + 1 ) % step > 0 ) continue; - - v2 = _vertexPool[ _vertexCount - 2 ]; - - _clippedVertex1PositionScreen.copy( v1.positionScreen ); - _clippedVertex2PositionScreen.copy( v2.positionScreen ); - - if ( clipLine( _clippedVertex1PositionScreen, _clippedVertex2PositionScreen ) === true ) { - - // Perform the perspective divide - _clippedVertex1PositionScreen.multiplyScalar( 1 / _clippedVertex1PositionScreen.w ); - _clippedVertex2PositionScreen.multiplyScalar( 1 / _clippedVertex2PositionScreen.w ); - - _line = getNextLineInPool(); - - _line.id = object.id; - _line.v1.positionScreen.copy( _clippedVertex1PositionScreen ); - _line.v2.positionScreen.copy( _clippedVertex2PositionScreen ); - - _line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z ); - - _line.material = object.material; - - if ( object.material.vertexColors === THREE.VertexColors ) { - - _line.vertexColors[ 0 ].copy( object.geometry.colors[ v ] ); - _line.vertexColors[ 1 ].copy( object.geometry.colors[ v - 1 ] ); - - } - - _renderData.elements.push( _line ); - - } - - } - - } - - } else if ( object instanceof THREE.Sprite ) { - - _vector4.set( _modelMatrix.elements[12], _modelMatrix.elements[13], _modelMatrix.elements[14], 1 ); - _vector4.applyMatrix4( _viewProjectionMatrix ); - - var invW = 1 / _vector4.w; - - _vector4.z *= invW; - - if ( _vector4.z >= -1 && _vector4.z <= 1 ) { - - _sprite = getNextSpriteInPool(); - _sprite.id = object.id; - _sprite.x = _vector4.x * invW; - _sprite.y = _vector4.y * invW; - _sprite.z = _vector4.z; - _sprite.object = object; - - _sprite.rotation = object.rotation; - - _sprite.scale.x = object.scale.x * Math.abs( _sprite.x - ( _vector4.x + camera.projectionMatrix.elements[0] ) / ( _vector4.w + camera.projectionMatrix.elements[12] ) ); - _sprite.scale.y = object.scale.y * Math.abs( _sprite.y - ( _vector4.y + camera.projectionMatrix.elements[5] ) / ( _vector4.w + camera.projectionMatrix.elements[13] ) ); - - _sprite.material = object.material; - - _renderData.elements.push( _sprite ); - - } - - } - - } - - if ( sortElements === true ) _renderData.elements.sort( painterSort ); - - return _renderData; - - }; - - // Pools - - function getNextObjectInPool() { - - if ( _objectCount === _objectPoolLength ) { - - var object = new THREE.RenderableObject(); - _objectPool.push( object ); - _objectPoolLength ++; - _objectCount ++; - return object; - - } - - return _objectPool[ _objectCount ++ ]; - - } - - function getNextVertexInPool() { - - if ( _vertexCount === _vertexPoolLength ) { - - var vertex = new THREE.RenderableVertex(); - _vertexPool.push( vertex ); - _vertexPoolLength ++; - _vertexCount ++; - return vertex; - - } - - return _vertexPool[ _vertexCount ++ ]; - - } - - function getNextFaceInPool() { - - if ( _faceCount === _facePoolLength ) { - - var face = new THREE.RenderableFace(); - _facePool.push( face ); - _facePoolLength ++; - _faceCount ++; - return face; - - } - - return _facePool[ _faceCount ++ ]; - - - } - - function getNextLineInPool() { - - if ( _lineCount === _linePoolLength ) { - - var line = new THREE.RenderableLine(); - _linePool.push( line ); - _linePoolLength ++; - _lineCount ++ - return line; - - } - - return _linePool[ _lineCount ++ ]; - - } - - function getNextSpriteInPool() { - - if ( _spriteCount === _spritePoolLength ) { - - var sprite = new THREE.RenderableSprite(); - _spritePool.push( sprite ); - _spritePoolLength ++; - _spriteCount ++ - return sprite; - - } - - return _spritePool[ _spriteCount ++ ]; - - } - - // - - function painterSort( a, b ) { - - if ( a.z !== b.z ) { - - return b.z - a.z; - - } else if ( a.id !== b.id ) { - - return a.id - b.id; - - } else { - - return 0; - - } - - } - - function clipLine( s1, s2 ) { - - var alpha1 = 0, alpha2 = 1, - - // Calculate the boundary coordinate of each vertex for the near and far clip planes, - // Z = -1 and Z = +1, respectively. - bc1near = s1.z + s1.w, - bc2near = s2.z + s2.w, - bc1far = - s1.z + s1.w, - bc2far = - s2.z + s2.w; - - if ( bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0 ) { - - // Both vertices lie entirely within all clip planes. - return true; - - } else if ( ( bc1near < 0 && bc2near < 0) || (bc1far < 0 && bc2far < 0 ) ) { - - // Both vertices lie entirely outside one of the clip planes. - return false; - - } else { - - // The line segment spans at least one clip plane. - - if ( bc1near < 0 ) { - - // v1 lies outside the near plane, v2 inside - alpha1 = Math.max( alpha1, bc1near / ( bc1near - bc2near ) ); - - } else if ( bc2near < 0 ) { - - // v2 lies outside the near plane, v1 inside - alpha2 = Math.min( alpha2, bc1near / ( bc1near - bc2near ) ); - - } - - if ( bc1far < 0 ) { - - // v1 lies outside the far plane, v2 inside - alpha1 = Math.max( alpha1, bc1far / ( bc1far - bc2far ) ); - - } else if ( bc2far < 0 ) { - - // v2 lies outside the far plane, v2 inside - alpha2 = Math.min( alpha2, bc1far / ( bc1far - bc2far ) ); - - } - - if ( alpha2 < alpha1 ) { - - // The line segment spans two boundaries, but is outside both of them. - // (This can't happen when we're only clipping against just near/far but good - // to leave the check here for future usage if other clip planes are added.) - return false; - - } else { - - // Update the s1 and s2 vertices to match the clipped line segment. - s1.lerp( s2, alpha1 ); - s2.lerp( s1, 1 - alpha2 ); - - return true; - - } - - } - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Face3 = function ( a, b, c, normal, color, materialIndex ) { - - this.a = a; - this.b = b; - this.c = c; - - this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3(); - this.vertexNormals = normal instanceof Array ? normal : [ ]; - - this.color = color instanceof THREE.Color ? color : new THREE.Color(); - this.vertexColors = color instanceof Array ? color : []; - - this.vertexTangents = []; - - this.materialIndex = materialIndex !== undefined ? materialIndex : 0; - - this.centroid = new THREE.Vector3(); - -}; - -THREE.Face3.prototype = { - - constructor: THREE.Face3, - - clone: function () { - - var face = new THREE.Face3( this.a, this.b, this.c ); - - face.normal.copy( this.normal ); - face.color.copy( this.color ); - face.centroid.copy( this.centroid ); - - face.materialIndex = this.materialIndex; - - var i, il; - for ( i = 0, il = this.vertexNormals.length; i < il; i ++ ) face.vertexNormals[ i ] = this.vertexNormals[ i ].clone(); - for ( i = 0, il = this.vertexColors.length; i < il; i ++ ) face.vertexColors[ i ] = this.vertexColors[ i ].clone(); - for ( i = 0, il = this.vertexTangents.length; i < il; i ++ ) face.vertexTangents[ i ] = this.vertexTangents[ i ].clone(); - - return face; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) { - - console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.') - - return new THREE.Face3( a, b, c, normal, color, materialIndex ); - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.BufferGeometry = function () { - - this.id = THREE.GeometryIdCount ++; - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - - // attributes - - this.attributes = {}; - - // offsets for chunks when using indexed elements - - this.offsets = []; - - // boundings - - this.boundingBox = null; - this.boundingSphere = null; - -}; - -THREE.BufferGeometry.prototype = { - - constructor: THREE.BufferGeometry, - - addAttribute: function ( name, type, numItems, itemSize ) { - - this.attributes[ name ] = { - - array: new type( numItems * itemSize ), - itemSize: itemSize - - }; - - return this.attributes[ name ]; - - }, - - applyMatrix: function ( matrix ) { - - var position = this.attributes.position; - - if ( position !== undefined ) { - - matrix.multiplyVector3Array( position.array ); - position.needsUpdate = true; - - } - - var normal = this.attributes.normal; - - if ( normal !== undefined ) { - - var normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); - - normalMatrix.multiplyVector3Array( normal.array ); - normal.needsUpdate = true; - - } - - }, - - computeBoundingBox: function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new THREE.Box3(); - - } - - var positions = this.attributes[ "position" ].array; - - if ( positions ) { - - var bb = this.boundingBox; - - if( positions.length >= 3 ) { - bb.min.x = bb.max.x = positions[ 0 ]; - bb.min.y = bb.max.y = positions[ 1 ]; - bb.min.z = bb.max.z = positions[ 2 ]; - } - - for ( var i = 3, il = positions.length; i < il; i += 3 ) { - - var x = positions[ i ]; - var y = positions[ i + 1 ]; - var z = positions[ i + 2 ]; - - // bounding box - - if ( x < bb.min.x ) { - - bb.min.x = x; - - } else if ( x > bb.max.x ) { - - bb.max.x = x; - - } - - if ( y < bb.min.y ) { - - bb.min.y = y; - - } else if ( y > bb.max.y ) { - - bb.max.y = y; - - } - - if ( z < bb.min.z ) { - - bb.min.z = z; - - } else if ( z > bb.max.z ) { - - bb.max.z = z; - - } - - } - - } - - if ( positions === undefined || positions.length === 0 ) { - - this.boundingBox.min.set( 0, 0, 0 ); - this.boundingBox.max.set( 0, 0, 0 ); - - } - - }, - - computeBoundingSphere: function () { - - var box = new THREE.Box3(); - var vector = new THREE.Vector3(); - - return function () { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new THREE.Sphere(); - - } - - var positions = this.attributes[ "position" ].array; - - if ( positions ) { - - box.makeEmpty(); - - var center = this.boundingSphere.center; - - for ( var i = 0, il = positions.length; i < il; i += 3 ) { - - vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - box.addPoint( vector ); - - } - - box.center( center ); - - var maxRadiusSq = 0; - - for ( var i = 0, il = positions.length; i < il; i += 3 ) { - - vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); - - } - - this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); - - } - - } - - }(), - - computeVertexNormals: function () { - - if ( this.attributes[ "position" ] ) { - - var i, il; - var j, jl; - - var nVertexElements = this.attributes[ "position" ].array.length; - - if ( this.attributes[ "normal" ] === undefined ) { - - this.attributes[ "normal" ] = { - - itemSize: 3, - array: new Float32Array( nVertexElements ) - - }; - - } else { - - // reset existing normals to zero - - for ( i = 0, il = this.attributes[ "normal" ].array.length; i < il; i ++ ) { - - this.attributes[ "normal" ].array[ i ] = 0; - - } - - } - - var positions = this.attributes[ "position" ].array; - var normals = this.attributes[ "normal" ].array; - - var vA, vB, vC, x, y, z, - - pA = new THREE.Vector3(), - pB = new THREE.Vector3(), - pC = new THREE.Vector3(), - - cb = new THREE.Vector3(), - ab = new THREE.Vector3(); - - // indexed elements - - if ( this.attributes[ "index" ] ) { - - var indices = this.attributes[ "index" ].array; - - var offsets = this.offsets; - - for ( j = 0, jl = offsets.length; j < jl; ++ j ) { - - var start = offsets[ j ].start; - var count = offsets[ j ].count; - var index = offsets[ j ].index; - - for ( i = start, il = start + count; i < il; i += 3 ) { - - vA = index + indices[ i ]; - vB = index + indices[ i + 1 ]; - vC = index + indices[ i + 2 ]; - - x = positions[ vA * 3 ]; - y = positions[ vA * 3 + 1 ]; - z = positions[ vA * 3 + 2 ]; - pA.set( x, y, z ); - - x = positions[ vB * 3 ]; - y = positions[ vB * 3 + 1 ]; - z = positions[ vB * 3 + 2 ]; - pB.set( x, y, z ); - - x = positions[ vC * 3 ]; - y = positions[ vC * 3 + 1 ]; - z = positions[ vC * 3 + 2 ]; - pC.set( x, y, z ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normals[ vA * 3 ] += cb.x; - normals[ vA * 3 + 1 ] += cb.y; - normals[ vA * 3 + 2 ] += cb.z; - - normals[ vB * 3 ] += cb.x; - normals[ vB * 3 + 1 ] += cb.y; - normals[ vB * 3 + 2 ] += cb.z; - - normals[ vC * 3 ] += cb.x; - normals[ vC * 3 + 1 ] += cb.y; - normals[ vC * 3 + 2 ] += cb.z; - - } - - } - - // non-indexed elements (unconnected triangle soup) - - } else { - - for ( i = 0, il = positions.length; i < il; i += 9 ) { - - x = positions[ i ]; - y = positions[ i + 1 ]; - z = positions[ i + 2 ]; - pA.set( x, y, z ); - - x = positions[ i + 3 ]; - y = positions[ i + 4 ]; - z = positions[ i + 5 ]; - pB.set( x, y, z ); - - x = positions[ i + 6 ]; - y = positions[ i + 7 ]; - z = positions[ i + 8 ]; - pC.set( x, y, z ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normals[ i ] = cb.x; - normals[ i + 1 ] = cb.y; - normals[ i + 2 ] = cb.z; - - normals[ i + 3 ] = cb.x; - normals[ i + 4 ] = cb.y; - normals[ i + 5 ] = cb.z; - - normals[ i + 6 ] = cb.x; - normals[ i + 7 ] = cb.y; - normals[ i + 8 ] = cb.z; - - } - - } - - this.normalizeNormals(); - - this.normalsNeedUpdate = true; - - } - - }, - - normalizeNormals: function () { - - var normals = this.attributes[ "normal" ].array; - - var x, y, z, n; - - for ( var i = 0, il = normals.length; i < il; i += 3 ) { - - x = normals[ i ]; - y = normals[ i + 1 ]; - z = normals[ i + 2 ]; - - n = 1.0 / Math.sqrt( x * x + y * y + z * z ); - - normals[ i ] *= n; - normals[ i + 1 ] *= n; - normals[ i + 2 ] *= n; - - } - - }, - - computeTangents: function () { - - // based on http://www.terathon.com/code/tangent.html - // (per vertex tangents) - - if ( this.attributes[ "index" ] === undefined || - this.attributes[ "position" ] === undefined || - this.attributes[ "normal" ] === undefined || - this.attributes[ "uv" ] === undefined ) { - - console.warn( "Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()" ); - return; - - } - - var indices = this.attributes[ "index" ].array; - var positions = this.attributes[ "position" ].array; - var normals = this.attributes[ "normal" ].array; - var uvs = this.attributes[ "uv" ].array; - - var nVertices = positions.length / 3; - - if ( this.attributes[ "tangent" ] === undefined ) { - - var nTangentElements = 4 * nVertices; - - this.attributes[ "tangent" ] = { - - itemSize: 4, - array: new Float32Array( nTangentElements ) - - }; - - } - - var tangents = this.attributes[ "tangent" ].array; - - var tan1 = [], tan2 = []; - - for ( var k = 0; k < nVertices; k ++ ) { - - tan1[ k ] = new THREE.Vector3(); - tan2[ k ] = new THREE.Vector3(); - - } - - var xA, yA, zA, - xB, yB, zB, - xC, yC, zC, - - uA, vA, - uB, vB, - uC, vC, - - x1, x2, y1, y2, z1, z2, - s1, s2, t1, t2, r; - - var sdir = new THREE.Vector3(), tdir = new THREE.Vector3(); - - function handleTriangle( a, b, c ) { - - xA = positions[ a * 3 ]; - yA = positions[ a * 3 + 1 ]; - zA = positions[ a * 3 + 2 ]; - - xB = positions[ b * 3 ]; - yB = positions[ b * 3 + 1 ]; - zB = positions[ b * 3 + 2 ]; - - xC = positions[ c * 3 ]; - yC = positions[ c * 3 + 1 ]; - zC = positions[ c * 3 + 2 ]; - - uA = uvs[ a * 2 ]; - vA = uvs[ a * 2 + 1 ]; - - uB = uvs[ b * 2 ]; - vB = uvs[ b * 2 + 1 ]; - - uC = uvs[ c * 2 ]; - vC = uvs[ c * 2 + 1 ]; - - x1 = xB - xA; - x2 = xC - xA; - - y1 = yB - yA; - y2 = yC - yA; - - z1 = zB - zA; - z2 = zC - zA; - - s1 = uB - uA; - s2 = uC - uA; - - t1 = vB - vA; - t2 = vC - vA; - - r = 1.0 / ( s1 * t2 - s2 * t1 ); - - sdir.set( - ( t2 * x1 - t1 * x2 ) * r, - ( t2 * y1 - t1 * y2 ) * r, - ( t2 * z1 - t1 * z2 ) * r - ); - - tdir.set( - ( s1 * x2 - s2 * x1 ) * r, - ( s1 * y2 - s2 * y1 ) * r, - ( s1 * z2 - s2 * z1 ) * r - ); - - tan1[ a ].add( sdir ); - tan1[ b ].add( sdir ); - tan1[ c ].add( sdir ); - - tan2[ a ].add( tdir ); - tan2[ b ].add( tdir ); - tan2[ c ].add( tdir ); - - } - - var i, il; - var j, jl; - var iA, iB, iC; - - var offsets = this.offsets; - - for ( j = 0, jl = offsets.length; j < jl; ++ j ) { - - var start = offsets[ j ].start; - var count = offsets[ j ].count; - var index = offsets[ j ].index; - - for ( i = start, il = start + count; i < il; i += 3 ) { - - iA = index + indices[ i ]; - iB = index + indices[ i + 1 ]; - iC = index + indices[ i + 2 ]; - - handleTriangle( iA, iB, iC ); - - } - - } - - var tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3(); - var n = new THREE.Vector3(), n2 = new THREE.Vector3(); - var w, t, test; - - function handleVertex( v ) { - - n.x = normals[ v * 3 ]; - n.y = normals[ v * 3 + 1 ]; - n.z = normals[ v * 3 + 2 ]; - - n2.copy( n ); - - t = tan1[ v ]; - - // Gram-Schmidt orthogonalize - - tmp.copy( t ); - tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize(); - - // Calculate handedness - - tmp2.crossVectors( n2, t ); - test = tmp2.dot( tan2[ v ] ); - w = ( test < 0.0 ) ? -1.0 : 1.0; - - tangents[ v * 4 ] = tmp.x; - tangents[ v * 4 + 1 ] = tmp.y; - tangents[ v * 4 + 2 ] = tmp.z; - tangents[ v * 4 + 3 ] = w; - - } - - for ( j = 0, jl = offsets.length; j < jl; ++ j ) { - - var start = offsets[ j ].start; - var count = offsets[ j ].count; - var index = offsets[ j ].index; - - for ( i = start, il = start + count; i < il; i += 3 ) { - - iA = index + indices[ i ]; - iB = index + indices[ i + 1 ]; - iC = index + indices[ i + 2 ]; - - handleVertex( iA ); - handleVertex( iB ); - handleVertex( iC ); - - } - - } - - }, - - /* - computeOffsets - Compute the draw offset for large models by chunking the index buffer into chunks of 65k addressable vertices. - This method will effectively rewrite the index buffer and remap all attributes to match the new indices. - WARNING: This method will also expand the vertex count to prevent sprawled triangles across draw offsets. - indexBufferSize - Defaults to 65535, but allows for larger or smaller chunks. - */ - computeOffsets: function(indexBufferSize) { - - var size = indexBufferSize; - if(indexBufferSize === undefined) - size = 65535; //WebGL limits type of index buffer values to 16-bit. - - var s = Date.now(); - - var indices = this.attributes['index'].array; - var vertices = this.attributes['position'].array; - - var verticesCount = (vertices.length/3); - var facesCount = (indices.length/3); - - /* - console.log("Computing buffers in offsets of "+size+" -> indices:"+indices.length+" vertices:"+vertices.length); - console.log("Faces to process: "+(indices.length/3)); - console.log("Reordering "+verticesCount+" vertices."); - */ - - var sortedIndices = new Uint16Array( indices.length ); //16-bit buffers - var indexPtr = 0; - var vertexPtr = 0; - - var offsets = [ { start:0, count:0, index:0 } ]; - var offset = offsets[0]; - - var duplicatedVertices = 0; - var newVerticeMaps = 0; - var faceVertices = new Int32Array(6); - var vertexMap = new Int32Array( vertices.length ); - var revVertexMap = new Int32Array( vertices.length ); - for(var j = 0; j < vertices.length; j++) { vertexMap[j] = -1; revVertexMap[j] = -1; } - - /* - Traverse every face and reorder vertices in the proper offsets of 65k. - We can have more than 65k entries in the index buffer per offset, but only reference 65k values. - */ - for(var findex = 0; findex < facesCount; findex++) { - newVerticeMaps = 0; - - for(var vo = 0; vo < 3; vo++) { - var vid = indices[ findex*3 + vo ]; - if(vertexMap[vid] == -1) { - //Unmapped vertice - faceVertices[vo*2] = vid; - faceVertices[vo*2+1] = -1; - newVerticeMaps++; - } else if(vertexMap[vid] < offset.index) { - //Reused vertices from previous block (duplicate) - faceVertices[vo*2] = vid; - faceVertices[vo*2+1] = -1; - duplicatedVertices++; - } else { - //Reused vertice in the current block - faceVertices[vo*2] = vid; - faceVertices[vo*2+1] = vertexMap[vid]; - } - } - - var faceMax = vertexPtr + newVerticeMaps; - if(faceMax > (offset.index + size)) { - var new_offset = { start:indexPtr, count:0, index:vertexPtr }; - offsets.push(new_offset); - offset = new_offset; - - //Re-evaluate reused vertices in light of new offset. - for(var v = 0; v < 6; v+=2) { - var new_vid = faceVertices[v+1]; - if(new_vid > -1 && new_vid < offset.index) - faceVertices[v+1] = -1; - } - } - - //Reindex the face. - for(var v = 0; v < 6; v+=2) { - var vid = faceVertices[v]; - var new_vid = faceVertices[v+1]; - - if(new_vid === -1) - new_vid = vertexPtr++; - - vertexMap[vid] = new_vid; - revVertexMap[new_vid] = vid; - sortedIndices[indexPtr++] = new_vid - offset.index; //XXX overflows at 16bit - offset.count++; - } - } - - /* Move all attribute values to map to the new computed indices , also expand the vertice stack to match our new vertexPtr. */ - this.reorderBuffers(sortedIndices, revVertexMap, vertexPtr); - this.offsets = offsets; - - /* - var orderTime = Date.now(); - console.log("Reorder time: "+(orderTime-s)+"ms"); - console.log("Duplicated "+duplicatedVertices+" vertices."); - console.log("Compute Buffers time: "+(Date.now()-s)+"ms"); - console.log("Draw offsets: "+offsets.length); - */ - - return offsets; - }, - - /* - reoderBuffers: - Reorder attributes based on a new indexBuffer and indexMap. - indexBuffer - Uint16Array of the new ordered indices. - indexMap - Int32Array where the position is the new vertex ID and the value the old vertex ID for each vertex. - vertexCount - Amount of total vertices considered in this reordering (in case you want to grow the vertice stack). - */ - reorderBuffers: function(indexBuffer, indexMap, vertexCount) { - - /* Create a copy of all attributes for reordering. */ - var sortedAttributes = {}; - var types = [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array ]; - for( var attr in this.attributes ) { - if(attr == 'index') - continue; - var sourceArray = this.attributes[attr].array; - for ( var i = 0, il = types.length; i < il; i++ ) { - var type = types[i]; - if (sourceArray instanceof type) { - sortedAttributes[attr] = new type( this.attributes[attr].itemSize * vertexCount ); - break; - } - } - } - - /* Move attribute positions based on the new index map */ - for(var new_vid = 0; new_vid < vertexCount; new_vid++) { - var vid = indexMap[new_vid]; - for ( var attr in this.attributes ) { - if(attr == 'index') - continue; - var attrArray = this.attributes[attr].array; - var attrSize = this.attributes[attr].itemSize; - var sortedAttr = sortedAttributes[attr]; - for(var k = 0; k < attrSize; k++) - sortedAttr[ new_vid * attrSize + k ] = attrArray[ vid * attrSize + k ]; - } - } - - /* Carry the new sorted buffers locally */ - this.attributes['index'].array = indexBuffer; - for ( var attr in this.attributes ) { - if(attr == 'index') - continue; - this.attributes[attr].array = sortedAttributes[attr]; - this.attributes[attr].numItems = this.attributes[attr].itemSize * vertexCount; - } - }, - - clone: function () { - - var geometry = new THREE.BufferGeometry(); - - var types = [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array ]; - - for ( var attr in this.attributes ) { - - var sourceAttr = this.attributes[ attr ]; - var sourceArray = sourceAttr.array; - - var attribute = { - - itemSize: sourceAttr.itemSize, - array: null - - }; - - for ( var i = 0, il = types.length; i < il; i ++ ) { - - var type = types[ i ]; - - if ( sourceArray instanceof type ) { - - attribute.array = new type( sourceArray ); - break; - - } - - } - - geometry.attributes[ attr ] = attribute; - - } - - for ( var i = 0, il = this.offsets.length; i < il; i ++ ) { - - var offset = this.offsets[ i ]; - - geometry.offsets.push( { - - start: offset.start, - index: offset.index, - count: offset.count - - } ); - - } - - return geometry; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.BufferGeometry.prototype ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author kile / http://kile.stravaganza.org/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author bhouston / http://exocortex.com - */ - -THREE.Geometry = function () { - - this.id = THREE.GeometryIdCount ++; - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - - this.vertices = []; - this.colors = []; // one-to-one vertex colors, used in ParticleSystem and Line - - this.faces = []; - - this.faceVertexUvs = [[]]; - - this.morphTargets = []; - this.morphColors = []; - this.morphNormals = []; - - this.skinWeights = []; - this.skinIndices = []; - - this.lineDistances = []; - - this.boundingBox = null; - this.boundingSphere = null; - - this.hasTangents = false; - - this.dynamic = true; // the intermediate typed arrays will be deleted when set to false - - // update flags - - this.verticesNeedUpdate = false; - this.elementsNeedUpdate = false; - this.uvsNeedUpdate = false; - this.normalsNeedUpdate = false; - this.tangentsNeedUpdate = false; - this.colorsNeedUpdate = false; - this.lineDistancesNeedUpdate = false; - - this.buffersNeedUpdate = false; - -}; - -THREE.Geometry.prototype = { - - constructor: THREE.Geometry, - - applyMatrix: function ( matrix ) { - - var normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); - - for ( var i = 0, il = this.vertices.length; i < il; i ++ ) { - - var vertex = this.vertices[ i ]; - vertex.applyMatrix4( matrix ); - - } - - for ( var i = 0, il = this.faces.length; i < il; i ++ ) { - - var face = this.faces[ i ]; - face.normal.applyMatrix3( normalMatrix ).normalize(); - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - face.vertexNormals[ j ].applyMatrix3( normalMatrix ).normalize(); - - } - - face.centroid.applyMatrix4( matrix ); - - } - - if ( this.boundingBox instanceof THREE.Box3 ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere instanceof THREE.Sphere ) { - - this.computeBoundingSphere(); - - } - - }, - - computeCentroids: function () { - - var f, fl, face; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - face.centroid.set( 0, 0, 0 ); - - face.centroid.add( this.vertices[ face.a ] ); - face.centroid.add( this.vertices[ face.b ] ); - face.centroid.add( this.vertices[ face.c ] ); - face.centroid.divideScalar( 3 ); - - } - - }, - - computeFaceNormals: function () { - - var cb = new THREE.Vector3(), ab = new THREE.Vector3(); - - for ( var f = 0, fl = this.faces.length; f < fl; f ++ ) { - - var face = this.faces[ f ]; - - var vA = this.vertices[ face.a ]; - var vB = this.vertices[ face.b ]; - var vC = this.vertices[ face.c ]; - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ); - - cb.normalize(); - - face.normal.copy( cb ); - - } - - }, - - computeVertexNormals: function ( areaWeighted ) { - - var v, vl, f, fl, face, vertices; - - vertices = new Array( this.vertices.length ); - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - vertices[ v ] = new THREE.Vector3(); - - } - - if ( areaWeighted ) { - - // vertex normals weighted by triangle areas - // http://www.iquilezles.org/www/articles/normals/normals.htm - - var vA, vB, vC, vD; - var cb = new THREE.Vector3(), ab = new THREE.Vector3(), - db = new THREE.Vector3(), dc = new THREE.Vector3(), bc = new THREE.Vector3(); - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - vA = this.vertices[ face.a ]; - vB = this.vertices[ face.b ]; - vC = this.vertices[ face.c ]; - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ); - - vertices[ face.a ].add( cb ); - vertices[ face.b ].add( cb ); - vertices[ face.c ].add( cb ); - - } - - } else { - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - vertices[ face.a ].add( face.normal ); - vertices[ face.b ].add( face.normal ); - vertices[ face.c ].add( face.normal ); - - } - - } - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - vertices[ v ].normalize(); - - } - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - face.vertexNormals[ 0 ] = vertices[ face.a ].clone(); - face.vertexNormals[ 1 ] = vertices[ face.b ].clone(); - face.vertexNormals[ 2 ] = vertices[ face.c ].clone(); - - } - - }, - - computeMorphNormals: function () { - - var i, il, f, fl, face; - - // save original normals - // - create temp variables on first access - // otherwise just copy (for faster repeated calls) - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - if ( ! face.__originalFaceNormal ) { - - face.__originalFaceNormal = face.normal.clone(); - - } else { - - face.__originalFaceNormal.copy( face.normal ); - - } - - if ( ! face.__originalVertexNormals ) face.__originalVertexNormals = []; - - for ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) { - - if ( ! face.__originalVertexNormals[ i ] ) { - - face.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone(); - - } else { - - face.__originalVertexNormals[ i ].copy( face.vertexNormals[ i ] ); - - } - - } - - } - - // use temp geometry to compute face and vertex normals for each morph - - var tmpGeo = new THREE.Geometry(); - tmpGeo.faces = this.faces; - - for ( i = 0, il = this.morphTargets.length; i < il; i ++ ) { - - // create on first access - - if ( ! this.morphNormals[ i ] ) { - - this.morphNormals[ i ] = {}; - this.morphNormals[ i ].faceNormals = []; - this.morphNormals[ i ].vertexNormals = []; - - var dstNormalsFace = this.morphNormals[ i ].faceNormals; - var dstNormalsVertex = this.morphNormals[ i ].vertexNormals; - - var faceNormal, vertexNormals; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - faceNormal = new THREE.Vector3(); - vertexNormals = { a: new THREE.Vector3(), b: new THREE.Vector3(), c: new THREE.Vector3() }; - - dstNormalsFace.push( faceNormal ); - dstNormalsVertex.push( vertexNormals ); - - } - - } - - var morphNormals = this.morphNormals[ i ]; - - // set vertices to morph target - - tmpGeo.vertices = this.morphTargets[ i ].vertices; - - // compute morph normals - - tmpGeo.computeFaceNormals(); - tmpGeo.computeVertexNormals(); - - // store morph normals - - var faceNormal, vertexNormals; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - faceNormal = morphNormals.faceNormals[ f ]; - vertexNormals = morphNormals.vertexNormals[ f ]; - - faceNormal.copy( face.normal ); - - vertexNormals.a.copy( face.vertexNormals[ 0 ] ); - vertexNormals.b.copy( face.vertexNormals[ 1 ] ); - vertexNormals.c.copy( face.vertexNormals[ 2 ] ); - - } - - } - - // restore original normals - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - face.normal = face.__originalFaceNormal; - face.vertexNormals = face.__originalVertexNormals; - - } - - }, - - computeTangents: function () { - - // based on http://www.terathon.com/code/tangent.html - // tangents go to vertices - - var f, fl, v, vl, i, il, vertexIndex, - face, uv, vA, vB, vC, uvA, uvB, uvC, - x1, x2, y1, y2, z1, z2, - s1, s2, t1, t2, r, t, test, - tan1 = [], tan2 = [], - sdir = new THREE.Vector3(), tdir = new THREE.Vector3(), - tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3(), - n = new THREE.Vector3(), w; - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - tan1[ v ] = new THREE.Vector3(); - tan2[ v ] = new THREE.Vector3(); - - } - - function handleTriangle( context, a, b, c, ua, ub, uc ) { - - vA = context.vertices[ a ]; - vB = context.vertices[ b ]; - vC = context.vertices[ c ]; - - uvA = uv[ ua ]; - uvB = uv[ ub ]; - uvC = uv[ uc ]; - - x1 = vB.x - vA.x; - x2 = vC.x - vA.x; - y1 = vB.y - vA.y; - y2 = vC.y - vA.y; - z1 = vB.z - vA.z; - z2 = vC.z - vA.z; - - s1 = uvB.x - uvA.x; - s2 = uvC.x - uvA.x; - t1 = uvB.y - uvA.y; - t2 = uvC.y - uvA.y; - - r = 1.0 / ( s1 * t2 - s2 * t1 ); - sdir.set( ( t2 * x1 - t1 * x2 ) * r, - ( t2 * y1 - t1 * y2 ) * r, - ( t2 * z1 - t1 * z2 ) * r ); - tdir.set( ( s1 * x2 - s2 * x1 ) * r, - ( s1 * y2 - s2 * y1 ) * r, - ( s1 * z2 - s2 * z1 ) * r ); - - tan1[ a ].add( sdir ); - tan1[ b ].add( sdir ); - tan1[ c ].add( sdir ); - - tan2[ a ].add( tdir ); - tan2[ b ].add( tdir ); - tan2[ c ].add( tdir ); - - } - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - uv = this.faceVertexUvs[ 0 ][ f ]; // use UV layer 0 for tangents - - handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 ); - - } - - var faceIndex = [ 'a', 'b', 'c', 'd' ]; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - for ( i = 0; i < Math.min( face.vertexNormals.length, 3 ); i++ ) { - - n.copy( face.vertexNormals[ i ] ); - - vertexIndex = face[ faceIndex[ i ] ]; - - t = tan1[ vertexIndex ]; - - // Gram-Schmidt orthogonalize - - tmp.copy( t ); - tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize(); - - // Calculate handedness - - tmp2.crossVectors( face.vertexNormals[ i ], t ); - test = tmp2.dot( tan2[ vertexIndex ] ); - w = (test < 0.0) ? -1.0 : 1.0; - - face.vertexTangents[ i ] = new THREE.Vector4( tmp.x, tmp.y, tmp.z, w ); - - } - - } - - this.hasTangents = true; - - }, - - computeLineDistances: function ( ) { - - var d = 0; - var vertices = this.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - if ( i > 0 ) { - - d += vertices[ i ].distanceTo( vertices[ i - 1 ] ); - - } - - this.lineDistances[ i ] = d; - - } - - }, - - computeBoundingBox: function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new THREE.Box3(); - - } - - this.boundingBox.setFromPoints( this.vertices ); - - }, - - computeBoundingSphere: function () { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new THREE.Sphere(); - - } - - this.boundingSphere.setFromPoints( this.vertices ); - - }, - - /* - * Checks for duplicate vertices with hashmap. - * Duplicated vertices are removed - * and faces' vertices are updated. - */ - - mergeVertices: function () { - - var verticesMap = {}; // Hashmap for looking up vertice by position coordinates (and making sure they are unique) - var unique = [], changes = []; - - var v, key; - var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001 - var precision = Math.pow( 10, precisionPoints ); - var i,il, face; - var indices, k, j, jl, u; - - for ( i = 0, il = this.vertices.length; i < il; i ++ ) { - - v = this.vertices[ i ]; - key = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision ); - - if ( verticesMap[ key ] === undefined ) { - - verticesMap[ key ] = i; - unique.push( this.vertices[ i ] ); - changes[ i ] = unique.length - 1; - - } else { - - //console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]); - changes[ i ] = changes[ verticesMap[ key ] ]; - - } - - }; - - - // if faces are completely degenerate after merging vertices, we - // have to remove them from the geometry. - var faceIndicesToRemove = []; - - for( i = 0, il = this.faces.length; i < il; i ++ ) { - - face = this.faces[ i ]; - - face.a = changes[ face.a ]; - face.b = changes[ face.b ]; - face.c = changes[ face.c ]; - - indices = [ face.a, face.b, face.c ]; - - var dupIndex = -1; - - // if any duplicate vertices are found in a Face3 - // we have to remove the face as nothing can be saved - for ( var n = 0; n < 3; n ++ ) { - if ( indices[ n ] == indices[ ( n + 1 ) % 3 ] ) { - - dupIndex = n; - faceIndicesToRemove.push( i ); - break; - - } - } - - } - - for ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) { - var idx = faceIndicesToRemove[ i ]; - - this.faces.splice( idx, 1 ); - - for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) { - - this.faceVertexUvs[ j ].splice( idx, 1 ); - - } - - } - - // Use unique set of vertices - - var diff = this.vertices.length - unique.length; - this.vertices = unique; - return diff; - - }, - - // Geometry splitting - - makeGroups: ( function () { - - var geometryGroupCounter = 0; - - return function ( usesFaceMaterial ) { - - var f, fl, face, materialIndex, - groupHash, hash_map = {}; - - var numMorphTargets = this.morphTargets.length; - var numMorphNormals = this.morphNormals.length; - - this.geometryGroups = {}; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - materialIndex = usesFaceMaterial ? face.materialIndex : 0; - - if ( ! ( materialIndex in hash_map ) ) { - - hash_map[ materialIndex ] = { 'hash': materialIndex, 'counter': 0 }; - - } - - groupHash = hash_map[ materialIndex ].hash + '_' + hash_map[ materialIndex ].counter; - - if ( ! ( groupHash in this.geometryGroups ) ) { - - this.geometryGroups[ groupHash ] = { 'faces3': [], 'materialIndex': materialIndex, 'vertices': 0, 'numMorphTargets': numMorphTargets, 'numMorphNormals': numMorphNormals }; - - } - - if ( this.geometryGroups[ groupHash ].vertices + 3 > 65535 ) { - - hash_map[ materialIndex ].counter += 1; - groupHash = hash_map[ materialIndex ].hash + '_' + hash_map[ materialIndex ].counter; - - if ( ! ( groupHash in this.geometryGroups ) ) { - - this.geometryGroups[ groupHash ] = { 'faces3': [], 'materialIndex': materialIndex, 'vertices': 0, 'numMorphTargets': numMorphTargets, 'numMorphNormals': numMorphNormals }; - - } - - } - - this.geometryGroups[ groupHash ].faces3.push( f ); - this.geometryGroups[ groupHash ].vertices += 3; - - } - - this.geometryGroupsList = []; - - for ( var g in this.geometryGroups ) { - - this.geometryGroups[ g ].id = geometryGroupCounter ++; - - this.geometryGroupsList.push( this.geometryGroups[ g ] ); - - } - - }; - - } )(), - - clone: function () { - - var geometry = new THREE.Geometry(); - - var vertices = this.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - geometry.vertices.push( vertices[ i ].clone() ); - - } - - var faces = this.faces; - - for ( var i = 0, il = faces.length; i < il; i ++ ) { - - geometry.faces.push( faces[ i ].clone() ); - - } - - var uvs = this.faceVertexUvs[ 0 ]; - - for ( var i = 0, il = uvs.length; i < il; i ++ ) { - - var uv = uvs[ i ], uvCopy = []; - - for ( var j = 0, jl = uv.length; j < jl; j ++ ) { - - uvCopy.push( new THREE.Vector2( uv[ j ].x, uv[ j ].y ) ); - - } - - geometry.faceVertexUvs[ 0 ].push( uvCopy ); - - } - - return geometry; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.Geometry.prototype ); - -THREE.GeometryIdCount = 0; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Geometry2 = function ( size ) { - - THREE.BufferGeometry.call( this ); - - this.vertices = this.addAttribute( 'position', Float32Array, size, 3 ).array; - this.normals = this.addAttribute( 'normal', Float32Array, size, 3 ).array; - this.uvs = this.addAttribute( 'uv', Float32Array, size, 2 ).array; - - this.boundingBox = null; - this.boundingSphere = null; - -}; - -THREE.Geometry2.prototype = Object.create( THREE.BufferGeometry.prototype ); -/** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.Camera = function () { - - THREE.Object3D.call( this ); - - this.matrixWorldInverse = new THREE.Matrix4(); - this.projectionMatrix = new THREE.Matrix4(); - -}; - -THREE.Camera.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.Camera.prototype.lookAt = function () { - - // This routine does not support cameras with rotated and/or translated parent(s) - - var m1 = new THREE.Matrix4(); - - return function ( vector ) { - - m1.lookAt( this.position, vector, this.up ); - - this.quaternion.setFromRotationMatrix( m1 ); - - }; - -}(); - -THREE.Camera.prototype.clone = function (camera) { - - if ( camera === undefined ) camera = new THREE.Camera(); - - THREE.Object3D.prototype.clone.call( this, camera ); - - camera.matrixWorldInverse.copy( this.matrixWorldInverse ); - camera.projectionMatrix.copy( this.projectionMatrix ); - - return camera; -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) { - - THREE.Camera.call( this ); - - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - - this.near = ( near !== undefined ) ? near : 0.1; - this.far = ( far !== undefined ) ? far : 2000; - - this.updateProjectionMatrix(); - -}; - -THREE.OrthographicCamera.prototype = Object.create( THREE.Camera.prototype ); - -THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () { - - this.projectionMatrix.makeOrthographic( this.left, this.right, this.top, this.bottom, this.near, this.far ); - -}; - -THREE.OrthographicCamera.prototype.clone = function () { - - var camera = new THREE.OrthographicCamera(); - - THREE.Camera.prototype.clone.call( this, camera ); - - camera.left = this.left; - camera.right = this.right; - camera.top = this.top; - camera.bottom = this.bottom; - - camera.near = this.near; - camera.far = this.far; - - return camera; -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author greggman / http://games.greggman.com/ - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - -THREE.PerspectiveCamera = function ( fov, aspect, near, far ) { - - THREE.Camera.call( this ); - - this.fov = fov !== undefined ? fov : 50; - this.aspect = aspect !== undefined ? aspect : 1; - this.near = near !== undefined ? near : 0.1; - this.far = far !== undefined ? far : 2000; - - this.updateProjectionMatrix(); - -}; - -THREE.PerspectiveCamera.prototype = Object.create( THREE.Camera.prototype ); - - -/** - * Uses Focal Length (in mm) to estimate and set FOV - * 35mm (fullframe) camera is used if frame size is not specified; - * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html - */ - -THREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameHeight ) { - - if ( frameHeight === undefined ) frameHeight = 24; - - this.fov = 2 * THREE.Math.radToDeg( Math.atan( frameHeight / ( focalLength * 2 ) ) ); - this.updateProjectionMatrix(); - -} - - -/** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and - * the monitors are in grid like this - * - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - * - * then for each monitor you would call it like this - * - * var w = 1920; - * var h = 1080; - * var fullWidth = w * 3; - * var fullHeight = h * 2; - * - * --A-- - * camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * --B-- - * camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * --C-- - * camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * --D-- - * camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * --E-- - * camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * --F-- - * camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); - * - * Note there is no reason monitors have to be the same size or in a grid. - */ - -THREE.PerspectiveCamera.prototype.setViewOffset = function ( fullWidth, fullHeight, x, y, width, height ) { - - this.fullWidth = fullWidth; - this.fullHeight = fullHeight; - this.x = x; - this.y = y; - this.width = width; - this.height = height; - - this.updateProjectionMatrix(); - -}; - - -THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () { - - if ( this.fullWidth ) { - - var aspect = this.fullWidth / this.fullHeight; - var top = Math.tan( THREE.Math.degToRad( this.fov * 0.5 ) ) * this.near; - var bottom = -top; - var left = aspect * bottom; - var right = aspect * top; - var width = Math.abs( right - left ); - var height = Math.abs( top - bottom ); - - this.projectionMatrix.makeFrustum( - left + this.x * width / this.fullWidth, - left + ( this.x + this.width ) * width / this.fullWidth, - top - ( this.y + this.height ) * height / this.fullHeight, - top - this.y * height / this.fullHeight, - this.near, - this.far - ); - - } else { - - this.projectionMatrix.makePerspective( this.fov, this.aspect, this.near, this.far ); - - } - -}; - -THREE.PerspectiveCamera.prototype.clone = function () { - - var camera = new THREE.PerspectiveCamera(); - - THREE.Camera.prototype.clone.call( this, camera ); - - camera.fov = this.fov; - camera.aspect = this.aspect; - camera.near = this.near; - camera.far = this.far; - - return camera; -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Light = function ( color ) { - - THREE.Object3D.call( this ); - - this.color = new THREE.Color( color ); - -}; - -THREE.Light.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.Light.prototype.clone = function ( light ) { - - if ( light === undefined ) light = new THREE.Light(); - - THREE.Object3D.prototype.clone.call( this, light ); - - light.color.copy( this.color ); - - return light; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.AmbientLight = function ( color ) { - - THREE.Light.call( this, color ); - -}; - -THREE.AmbientLight.prototype = Object.create( THREE.Light.prototype ); - -THREE.AmbientLight.prototype.clone = function () { - - var light = new THREE.AmbientLight(); - - THREE.Light.prototype.clone.call( this, light ); - - return light; - -}; - -/** - * @author MPanknin / http://www.redplant.de/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.AreaLight = function ( color, intensity ) { - - THREE.Light.call( this, color ); - - this.normal = new THREE.Vector3( 0, -1, 0 ); - this.right = new THREE.Vector3( 1, 0, 0 ); - - this.intensity = ( intensity !== undefined ) ? intensity : 1; - - this.width = 1.0; - this.height = 1.0; - - this.constantAttenuation = 1.5; - this.linearAttenuation = 0.5; - this.quadraticAttenuation = 0.1; - -}; - -THREE.AreaLight.prototype = Object.create( THREE.Light.prototype ); - - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.DirectionalLight = function ( color, intensity ) { - - THREE.Light.call( this, color ); - - this.position.set( 0, 1, 0 ); - this.target = new THREE.Object3D(); - - this.intensity = ( intensity !== undefined ) ? intensity : 1; - - this.castShadow = false; - this.onlyShadow = false; - - // - - this.shadowCameraNear = 50; - this.shadowCameraFar = 5000; - - this.shadowCameraLeft = -500; - this.shadowCameraRight = 500; - this.shadowCameraTop = 500; - this.shadowCameraBottom = -500; - - this.shadowCameraVisible = false; - - this.shadowBias = 0; - this.shadowDarkness = 0.5; - - this.shadowMapWidth = 512; - this.shadowMapHeight = 512; - - // - - this.shadowCascade = false; - - this.shadowCascadeOffset = new THREE.Vector3( 0, 0, -1000 ); - this.shadowCascadeCount = 2; - - this.shadowCascadeBias = [ 0, 0, 0 ]; - this.shadowCascadeWidth = [ 512, 512, 512 ]; - this.shadowCascadeHeight = [ 512, 512, 512 ]; - - this.shadowCascadeNearZ = [ -1.000, 0.990, 0.998 ]; - this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ]; - - this.shadowCascadeArray = []; - - // - - this.shadowMap = null; - this.shadowMapSize = null; - this.shadowCamera = null; - this.shadowMatrix = null; - -}; - -THREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype ); - -THREE.DirectionalLight.prototype.clone = function () { - - var light = new THREE.DirectionalLight(); - - THREE.Light.prototype.clone.call( this, light ); - - light.target = this.target.clone(); - - light.intensity = this.intensity; - - light.castShadow = this.castShadow; - light.onlyShadow = this.onlyShadow; - - return light; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.HemisphereLight = function ( skyColor, groundColor, intensity ) { - - THREE.Light.call( this, skyColor ); - - this.position.set( 0, 100, 0 ); - - this.groundColor = new THREE.Color( groundColor ); - this.intensity = ( intensity !== undefined ) ? intensity : 1; - -}; - -THREE.HemisphereLight.prototype = Object.create( THREE.Light.prototype ); - -THREE.HemisphereLight.prototype.clone = function () { - - var light = new THREE.HemisphereLight(); - - THREE.Light.prototype.clone.call( this, light ); - - light.groundColor.copy( this.groundColor ); - light.intensity = this.intensity; - - return light; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.PointLight = function ( color, intensity, distance ) { - - THREE.Light.call( this, color ); - - this.intensity = ( intensity !== undefined ) ? intensity : 1; - this.distance = ( distance !== undefined ) ? distance : 0; - -}; - -THREE.PointLight.prototype = Object.create( THREE.Light.prototype ); - -THREE.PointLight.prototype.clone = function () { - - var light = new THREE.PointLight(); - - THREE.Light.prototype.clone.call( this, light ); - - light.intensity = this.intensity; - light.distance = this.distance; - - return light; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.SpotLight = function ( color, intensity, distance, angle, exponent ) { - - THREE.Light.call( this, color ); - - this.position.set( 0, 1, 0 ); - this.target = new THREE.Object3D(); - - this.intensity = ( intensity !== undefined ) ? intensity : 1; - this.distance = ( distance !== undefined ) ? distance : 0; - this.angle = ( angle !== undefined ) ? angle : Math.PI / 3; - this.exponent = ( exponent !== undefined ) ? exponent : 10; - - this.castShadow = false; - this.onlyShadow = false; - - // - - this.shadowCameraNear = 50; - this.shadowCameraFar = 5000; - this.shadowCameraFov = 50; - - this.shadowCameraVisible = false; - - this.shadowBias = 0; - this.shadowDarkness = 0.5; - - this.shadowMapWidth = 512; - this.shadowMapHeight = 512; - - // - - this.shadowMap = null; - this.shadowMapSize = null; - this.shadowCamera = null; - this.shadowMatrix = null; - -}; - -THREE.SpotLight.prototype = Object.create( THREE.Light.prototype ); - -THREE.SpotLight.prototype.clone = function () { - - var light = new THREE.SpotLight(); - - THREE.Light.prototype.clone.call( this, light ); - - light.target = this.target.clone(); - - light.intensity = this.intensity; - light.distance = this.distance; - light.angle = this.angle; - light.exponent = this.exponent; - - light.castShadow = this.castShadow; - light.onlyShadow = this.onlyShadow; - - return light; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Loader = function ( showStatus ) { - - this.showStatus = showStatus; - this.statusDomElement = showStatus ? THREE.Loader.prototype.addStatusElement() : null; - - this.onLoadStart = function () {}; - this.onLoadProgress = function () {}; - this.onLoadComplete = function () {}; - -}; - -THREE.Loader.prototype = { - - constructor: THREE.Loader, - - crossOrigin: undefined, - - addStatusElement: function () { - - var e = document.createElement( "div" ); - - e.style.position = "absolute"; - e.style.right = "0px"; - e.style.top = "0px"; - e.style.fontSize = "0.8em"; - e.style.textAlign = "left"; - e.style.background = "rgba(0,0,0,0.25)"; - e.style.color = "#fff"; - e.style.width = "120px"; - e.style.padding = "0.5em 0.5em 0.5em 0.5em"; - e.style.zIndex = 1000; - - e.innerHTML = "Loading ..."; - - return e; - - }, - - updateProgress: function ( progress ) { - - var message = "Loaded "; - - if ( progress.total ) { - - message += ( 100 * progress.loaded / progress.total ).toFixed(0) + "%"; - - - } else { - - message += ( progress.loaded / 1000 ).toFixed(2) + " KB"; - - } - - this.statusDomElement.innerHTML = message; - - }, - - extractUrlBase: function ( url ) { - - var parts = url.split( '/' ); - - if ( parts.length === 1 ) return './'; - - parts.pop(); - - return parts.join( '/' ) + '/'; - - }, - - initMaterials: function ( materials, texturePath ) { - - var array = []; - - for ( var i = 0; i < materials.length; ++ i ) { - - array[ i ] = THREE.Loader.prototype.createMaterial( materials[ i ], texturePath ); - - } - - return array; - - }, - - needsTangents: function ( materials ) { - - for( var i = 0, il = materials.length; i < il; i ++ ) { - - var m = materials[ i ]; - - if ( m instanceof THREE.ShaderMaterial ) return true; - - } - - return false; - - }, - - createMaterial: function ( m, texturePath ) { - - var _this = this; - - function is_pow2( n ) { - - var l = Math.log( n ) / Math.LN2; - return Math.floor( l ) == l; - - } - - function nearest_pow2( n ) { - - var l = Math.log( n ) / Math.LN2; - return Math.pow( 2, Math.round( l ) ); - - } - - function load_image( where, url ) { - - var image = new Image(); - - image.onload = function () { - - if ( !is_pow2( this.width ) || !is_pow2( this.height ) ) { - - var width = nearest_pow2( this.width ); - var height = nearest_pow2( this.height ); - - where.image.width = width; - where.image.height = height; - where.image.getContext( '2d' ).drawImage( this, 0, 0, width, height ); - - } else { - - where.image = this; - - } - - where.needsUpdate = true; - - }; - - if ( _this.crossOrigin !== undefined ) image.crossOrigin = _this.crossOrigin; - image.src = url; - - } - - function create_texture( where, name, sourceFile, repeat, offset, wrap, anisotropy ) { - - var isCompressed = /\.dds$/i.test( sourceFile ); - - var fullPath = texturePath + sourceFile; - - if ( isCompressed ) { - - var texture = THREE.ImageUtils.loadCompressedTexture( fullPath ); - - where[ name ] = texture; - - } else { - - var texture = document.createElement( 'canvas' ); - - where[ name ] = new THREE.Texture( texture ); - - } - - where[ name ].sourceFile = sourceFile; - - if( repeat ) { - - where[ name ].repeat.set( repeat[ 0 ], repeat[ 1 ] ); - - if ( repeat[ 0 ] !== 1 ) where[ name ].wrapS = THREE.RepeatWrapping; - if ( repeat[ 1 ] !== 1 ) where[ name ].wrapT = THREE.RepeatWrapping; - - } - - if ( offset ) { - - where[ name ].offset.set( offset[ 0 ], offset[ 1 ] ); - - } - - if ( wrap ) { - - var wrapMap = { - "repeat": THREE.RepeatWrapping, - "mirror": THREE.MirroredRepeatWrapping - } - - if ( wrapMap[ wrap[ 0 ] ] !== undefined ) where[ name ].wrapS = wrapMap[ wrap[ 0 ] ]; - if ( wrapMap[ wrap[ 1 ] ] !== undefined ) where[ name ].wrapT = wrapMap[ wrap[ 1 ] ]; - - } - - if ( anisotropy ) { - - where[ name ].anisotropy = anisotropy; - - } - - if ( ! isCompressed ) { - - load_image( where[ name ], fullPath ); - - } - - } - - function rgb2hex( rgb ) { - - return ( rgb[ 0 ] * 255 << 16 ) + ( rgb[ 1 ] * 255 << 8 ) + rgb[ 2 ] * 255; - - } - - // defaults - - var mtype = "MeshLambertMaterial"; - var mpars = { color: 0xeeeeee, opacity: 1.0, map: null, lightMap: null, normalMap: null, bumpMap: null, wireframe: false }; - - // parameters from model file - - if ( m.shading ) { - - var shading = m.shading.toLowerCase(); - - if ( shading === "phong" ) mtype = "MeshPhongMaterial"; - else if ( shading === "basic" ) mtype = "MeshBasicMaterial"; - - } - - if ( m.blending !== undefined && THREE[ m.blending ] !== undefined ) { - - mpars.blending = THREE[ m.blending ]; - - } - - if ( m.transparent !== undefined || m.opacity < 1.0 ) { - - mpars.transparent = m.transparent; - - } - - if ( m.depthTest !== undefined ) { - - mpars.depthTest = m.depthTest; - - } - - if ( m.depthWrite !== undefined ) { - - mpars.depthWrite = m.depthWrite; - - } - - if ( m.visible !== undefined ) { - - mpars.visible = m.visible; - - } - - if ( m.flipSided !== undefined ) { - - mpars.side = THREE.BackSide; - - } - - if ( m.doubleSided !== undefined ) { - - mpars.side = THREE.DoubleSide; - - } - - if ( m.wireframe !== undefined ) { - - mpars.wireframe = m.wireframe; - - } - - if ( m.vertexColors !== undefined ) { - - if ( m.vertexColors === "face" ) { - - mpars.vertexColors = THREE.FaceColors; - - } else if ( m.vertexColors ) { - - mpars.vertexColors = THREE.VertexColors; - - } - - } - - // colors - - if ( m.colorDiffuse ) { - - mpars.color = rgb2hex( m.colorDiffuse ); - - } else if ( m.DbgColor ) { - - mpars.color = m.DbgColor; - - } - - if ( m.colorSpecular ) { - - mpars.specular = rgb2hex( m.colorSpecular ); - - } - - if ( m.colorAmbient ) { - - mpars.ambient = rgb2hex( m.colorAmbient ); - - } - - // modifiers - - if ( m.transparency ) { - - mpars.opacity = m.transparency; - - } - - if ( m.specularCoef ) { - - mpars.shininess = m.specularCoef; - - } - - // textures - - if ( m.mapDiffuse && texturePath ) { - - create_texture( mpars, "map", m.mapDiffuse, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy ); - - } - - if ( m.mapLight && texturePath ) { - - create_texture( mpars, "lightMap", m.mapLight, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy ); - - } - - if ( m.mapBump && texturePath ) { - - create_texture( mpars, "bumpMap", m.mapBump, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy ); - - } - - if ( m.mapNormal && texturePath ) { - - create_texture( mpars, "normalMap", m.mapNormal, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy ); - - } - - if ( m.mapSpecular && texturePath ) { - - create_texture( mpars, "specularMap", m.mapSpecular, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy ); - - } - - // - - if ( m.mapBumpScale ) { - - mpars.bumpScale = m.mapBumpScale; - - } - - // special case for normal mapped material - - if ( m.mapNormal ) { - - var shader = THREE.ShaderLib[ "normalmap" ]; - var uniforms = THREE.UniformsUtils.clone( shader.uniforms ); - - uniforms[ "tNormal" ].value = mpars.normalMap; - - if ( m.mapNormalFactor ) { - - uniforms[ "uNormalScale" ].value.set( m.mapNormalFactor, m.mapNormalFactor ); - - } - - if ( mpars.map ) { - - uniforms[ "tDiffuse" ].value = mpars.map; - uniforms[ "enableDiffuse" ].value = true; - - } - - if ( mpars.specularMap ) { - - uniforms[ "tSpecular" ].value = mpars.specularMap; - uniforms[ "enableSpecular" ].value = true; - - } - - if ( mpars.lightMap ) { - - uniforms[ "tAO" ].value = mpars.lightMap; - uniforms[ "enableAO" ].value = true; - - } - - // for the moment don't handle displacement texture - - uniforms[ "diffuse" ].value.setHex( mpars.color ); - uniforms[ "specular" ].value.setHex( mpars.specular ); - uniforms[ "ambient" ].value.setHex( mpars.ambient ); - - uniforms[ "shininess" ].value = mpars.shininess; - - if ( mpars.opacity !== undefined ) { - - uniforms[ "opacity" ].value = mpars.opacity; - - } - - var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: true }; - var material = new THREE.ShaderMaterial( parameters ); - - if ( mpars.transparent ) { - - material.transparent = true; - - } - - } else { - - var material = new THREE[ mtype ]( mpars ); - - } - - if ( m.DbgName !== undefined ) material.name = m.DbgName; - - return material; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.XHRLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.XHRLoader.prototype = { - - constructor: THREE.XHRLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - var request = new XMLHttpRequest(); - - if ( onLoad !== undefined ) { - - request.addEventListener( 'load', function ( event ) { - - onLoad( event.target.responseText ); - scope.manager.itemEnd( url ); - - }, false ); - - } - - if ( onProgress !== undefined ) { - - request.addEventListener( 'progress', function ( event ) { - - onProgress( event ); - - }, false ); - - } - - if ( onError !== undefined ) { - - request.addEventListener( 'error', function ( event ) { - - onError( event ); - - }, false ); - - } - - if ( this.crossOrigin !== undefined ) request.crossOrigin = this.crossOrigin; - - request.open( 'GET', url, true ); - request.send( null ); - - scope.manager.itemStart( url ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.ImageLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.ImageLoader.prototype = { - - constructor: THREE.ImageLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - var image = document.createElement( 'img' ); - - if ( onLoad !== undefined ) { - - image.addEventListener( 'load', function ( event ) { - - scope.manager.itemEnd( url ); - onLoad( this ); - - }, false ); - - } - - if ( onProgress !== undefined ) { - - image.addEventListener( 'progress', function ( event ) { - - onProgress( event ); - - }, false ); - - } - - if ( onError !== undefined ) { - - image.addEventListener( 'error', function ( event ) { - - onError( event ); - - }, false ); - - } - - if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin; - - image.src = url; - - scope.manager.itemStart( url ); - - return image; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - } - -} - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.JSONLoader = function ( showStatus ) { - - THREE.Loader.call( this, showStatus ); - - this.withCredentials = false; - -}; - -THREE.JSONLoader.prototype = Object.create( THREE.Loader.prototype ); - -THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) { - - var scope = this; - - // todo: unify load API to for easier SceneLoader use - - texturePath = texturePath && ( typeof texturePath === "string" ) ? texturePath : this.extractUrlBase( url ); - - this.onLoadStart(); - this.loadAjaxJSON( this, url, callback, texturePath ); - -}; - -THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, texturePath, callbackProgress ) { - - var xhr = new XMLHttpRequest(); - - var length = 0; - - xhr.onreadystatechange = function () { - - if ( xhr.readyState === xhr.DONE ) { - - if ( xhr.status === 200 || xhr.status === 0 ) { - - if ( xhr.responseText ) { - - var json = JSON.parse( xhr.responseText ); - - if ( json.metadata.type === 'scene' ) { - - console.error( 'THREE.JSONLoader: "' + url + '" seems to be a Scene. Use THREE.SceneLoader instead.' ); - return; - - } - - var result = context.parse( json, texturePath ); - callback( result.geometry, result.materials ); - - } else { - - console.error( 'THREE.JSONLoader: "' + url + '" seems to be unreachable or the file is empty.' ); - - } - - // in context of more complex asset initialization - // do not block on single failed file - // maybe should go even one more level up - - context.onLoadComplete(); - - } else { - - console.error( 'THREE.JSONLoader: Couldn\'t load "' + url + '" (' + xhr.status + ')' ); - - } - - } else if ( xhr.readyState === xhr.LOADING ) { - - if ( callbackProgress ) { - - if ( length === 0 ) { - - length = xhr.getResponseHeader( 'Content-Length' ); - - } - - callbackProgress( { total: length, loaded: xhr.responseText.length } ); - - } - - } else if ( xhr.readyState === xhr.HEADERS_RECEIVED ) { - - if ( callbackProgress !== undefined ) { - - length = xhr.getResponseHeader( "Content-Length" ); - - } - - } - - }; - - xhr.open( "GET", url, true ); - xhr.withCredentials = this.withCredentials; - xhr.send( null ); - -}; - -THREE.JSONLoader.prototype.parse = function ( json, texturePath ) { - - var scope = this, - geometry = new THREE.Geometry(), - scale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0; - - parseModel( scale ); - - parseSkin(); - parseMorphing( scale ); - - geometry.computeCentroids(); - geometry.computeFaceNormals(); - geometry.computeBoundingSphere(); - - function parseModel( scale ) { - - function isBitSet( value, position ) { - - return value & ( 1 << position ); - - } - - var i, j, fi, - - offset, zLength, - - colorIndex, normalIndex, uvIndex, materialIndex, - - type, - isQuad, - hasMaterial, - hasFaceVertexUv, - hasFaceNormal, hasFaceVertexNormal, - hasFaceColor, hasFaceVertexColor, - - vertex, face, faceA, faceB, color, hex, normal, - - uvLayer, uv, u, v, - - faces = json.faces, - vertices = json.vertices, - normals = json.normals, - colors = json.colors, - - nUvLayers = 0; - - if ( json.uvs !== undefined ) { - - // disregard empty arrays - - for ( i = 0; i < json.uvs.length; i++ ) { - - if ( json.uvs[ i ].length ) nUvLayers ++; - - } - - for ( i = 0; i < nUvLayers; i++ ) { - - geometry.faceVertexUvs[ i ] = []; - - } - - } - - offset = 0; - zLength = vertices.length; - - while ( offset < zLength ) { - - vertex = new THREE.Vector3(); - - vertex.x = vertices[ offset ++ ] * scale; - vertex.y = vertices[ offset ++ ] * scale; - vertex.z = vertices[ offset ++ ] * scale; - - geometry.vertices.push( vertex ); - - } - - offset = 0; - zLength = faces.length; - - while ( offset < zLength ) { - - type = faces[ offset ++ ]; - - - isQuad = isBitSet( type, 0 ); - hasMaterial = isBitSet( type, 1 ); - hasFaceVertexUv = isBitSet( type, 3 ); - hasFaceNormal = isBitSet( type, 4 ); - hasFaceVertexNormal = isBitSet( type, 5 ); - hasFaceColor = isBitSet( type, 6 ); - hasFaceVertexColor = isBitSet( type, 7 ); - - // console.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor); - - if ( isQuad ) { - - faceA = new THREE.Face3(); - faceA.a = faces[ offset ]; - faceA.b = faces[ offset + 1 ]; - faceA.c = faces[ offset + 3 ]; - - faceB = new THREE.Face3(); - faceB.a = faces[ offset + 1 ]; - faceB.b = faces[ offset + 2 ]; - faceB.c = faces[ offset + 3 ]; - - offset += 4; - - if ( hasMaterial ) { - - materialIndex = faces[ offset ++ ]; - faceA.materialIndex = materialIndex; - faceB.materialIndex = materialIndex; - - } - - // to get face <=> uv index correspondence - - fi = geometry.faces.length; - - if ( hasFaceVertexUv ) { - - for ( i = 0; i < nUvLayers; i++ ) { - - uvLayer = json.uvs[ i ]; - - geometry.faceVertexUvs[ i ][ fi ] = []; - geometry.faceVertexUvs[ i ][ fi + 1 ] = [] - - for ( j = 0; j < 4; j ++ ) { - - uvIndex = faces[ offset ++ ]; - - u = uvLayer[ uvIndex * 2 ]; - v = uvLayer[ uvIndex * 2 + 1 ]; - - uv = new THREE.Vector2( u, v ); - - if ( j !== 2 ) geometry.faceVertexUvs[ i ][ fi ].push( uv ); - if ( j !== 0 ) geometry.faceVertexUvs[ i ][ fi + 1 ].push( uv ); - - } - - } - - } - - if ( hasFaceNormal ) { - - normalIndex = faces[ offset ++ ] * 3; - - faceA.normal.set( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - faceB.normal.copy( faceA.normal ); - - } - - if ( hasFaceVertexNormal ) { - - for ( i = 0; i < 4; i++ ) { - - normalIndex = faces[ offset ++ ] * 3; - - normal = new THREE.Vector3( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - - if ( i !== 2 ) faceA.vertexNormals.push( normal ); - if ( i !== 0 ) faceB.vertexNormals.push( normal ); - - } - - } - - - if ( hasFaceColor ) { - - colorIndex = faces[ offset ++ ]; - hex = colors[ colorIndex ]; - - faceA.color.setHex( hex ); - faceB.color.setHex( hex ); - - } - - - if ( hasFaceVertexColor ) { - - for ( i = 0; i < 4; i++ ) { - - colorIndex = faces[ offset ++ ]; - hex = colors[ colorIndex ]; - - if ( i !== 2 ) faceA.vertexColors.push( new THREE.Color( hex ) ); - if ( i !== 0 ) faceB.vertexColors.push( new THREE.Color( hex ) ); - - } - - } - - geometry.faces.push( faceA ); - geometry.faces.push( faceB ); - - } else { - - face = new THREE.Face3(); - face.a = faces[ offset ++ ]; - face.b = faces[ offset ++ ]; - face.c = faces[ offset ++ ]; - - if ( hasMaterial ) { - - materialIndex = faces[ offset ++ ]; - face.materialIndex = materialIndex; - - } - - // to get face <=> uv index correspondence - - fi = geometry.faces.length; - - if ( hasFaceVertexUv ) { - - for ( i = 0; i < nUvLayers; i++ ) { - - uvLayer = json.uvs[ i ]; - - geometry.faceVertexUvs[ i ][ fi ] = []; - - for ( j = 0; j < 3; j ++ ) { - - uvIndex = faces[ offset ++ ]; - - u = uvLayer[ uvIndex * 2 ]; - v = uvLayer[ uvIndex * 2 + 1 ]; - - uv = new THREE.Vector2( u, v ); - - geometry.faceVertexUvs[ i ][ fi ].push( uv ); - - } - - } - - } - - if ( hasFaceNormal ) { - - normalIndex = faces[ offset ++ ] * 3; - - face.normal.set( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - } - - if ( hasFaceVertexNormal ) { - - for ( i = 0; i < 3; i++ ) { - - normalIndex = faces[ offset ++ ] * 3; - - normal = new THREE.Vector3( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - face.vertexNormals.push( normal ); - - } - - } - - - if ( hasFaceColor ) { - - colorIndex = faces[ offset ++ ]; - face.color.setHex( colors[ colorIndex ] ); - - } - - - if ( hasFaceVertexColor ) { - - for ( i = 0; i < 3; i++ ) { - - colorIndex = faces[ offset ++ ]; - face.vertexColors.push( new THREE.Color( colors[ colorIndex ] ) ); - - } - - } - - geometry.faces.push( face ); - - } - - } - - }; - - function parseSkin() { - - if ( json.skinWeights ) { - - for ( var i = 0, l = json.skinWeights.length; i < l; i += 2 ) { - - var x = json.skinWeights[ i ]; - var y = json.skinWeights[ i + 1 ]; - var z = 0; - var w = 0; - - geometry.skinWeights.push( new THREE.Vector4( x, y, z, w ) ); - - } - - } - - if ( json.skinIndices ) { - - for ( var i = 0, l = json.skinIndices.length; i < l; i += 2 ) { - - var a = json.skinIndices[ i ]; - var b = json.skinIndices[ i + 1 ]; - var c = 0; - var d = 0; - - geometry.skinIndices.push( new THREE.Vector4( a, b, c, d ) ); - - } - - } - - geometry.bones = json.bones; - - if ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) { - - console.warn( 'When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' + - geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' ); - - } - - - // could change this to json.animations[0] or remove completely - - geometry.animation = json.animation; - geometry.animations = json.animations; - - }; - - function parseMorphing( scale ) { - - if ( json.morphTargets !== undefined ) { - - var i, l, v, vl, dstVertices, srcVertices; - - for ( i = 0, l = json.morphTargets.length; i < l; i ++ ) { - - geometry.morphTargets[ i ] = {}; - geometry.morphTargets[ i ].name = json.morphTargets[ i ].name; - geometry.morphTargets[ i ].vertices = []; - - dstVertices = geometry.morphTargets[ i ].vertices; - srcVertices = json.morphTargets [ i ].vertices; - - for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) { - - var vertex = new THREE.Vector3(); - vertex.x = srcVertices[ v ] * scale; - vertex.y = srcVertices[ v + 1 ] * scale; - vertex.z = srcVertices[ v + 2 ] * scale; - - dstVertices.push( vertex ); - - } - - } - - } - - if ( json.morphColors !== undefined ) { - - var i, l, c, cl, dstColors, srcColors, color; - - for ( i = 0, l = json.morphColors.length; i < l; i++ ) { - - geometry.morphColors[ i ] = {}; - geometry.morphColors[ i ].name = json.morphColors[ i ].name; - geometry.morphColors[ i ].colors = []; - - dstColors = geometry.morphColors[ i ].colors; - srcColors = json.morphColors [ i ].colors; - - for ( c = 0, cl = srcColors.length; c < cl; c += 3 ) { - - color = new THREE.Color( 0xffaa00 ); - color.setRGB( srcColors[ c ], srcColors[ c + 1 ], srcColors[ c + 2 ] ); - dstColors.push( color ); - - } - - } - - } - - }; - - if ( json.materials === undefined ) { - - return { geometry: geometry }; - - } else { - - var materials = this.initMaterials( json.materials, texturePath ); - - if ( this.needsTangents( materials ) ) { - - geometry.computeTangents(); - - } - - return { geometry: geometry, materials: materials }; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.LoadingManager = function ( onLoad, onProgress, onError ) { - - var scope = this; - - var loaded = 0, total = 0; - - this.onLoad = onLoad; - this.onProgress = onProgress; - this.onError = onError; - - this.itemStart = function ( url ) { - - total ++; - - }; - - this.itemEnd = function ( url ) { - - loaded ++; - - if ( scope.onProgress !== undefined ) { - - scope.onProgress( url, loaded, total ); - - } - - if ( loaded === total && scope.onLoad !== undefined ) { - - scope.onLoad(); - - } - - }; - -}; - -THREE.DefaultLoadingManager = new THREE.LoadingManager(); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.BufferGeometryLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.BufferGeometryLoader.prototype = { - - constructor: THREE.BufferGeometryLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.XHRLoader(); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - } ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json ) { - - var geometry = new THREE.BufferGeometry(); - - var attributes = json.attributes; - var offsets = json.offsets; - var boundingSphere = json.boundingSphere; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - - geometry.attributes[ key ] = { - itemSize: attribute.itemSize, - array: new self[ attribute.type ]( attribute.array ) - } - - } - - if ( offsets !== undefined ) { - - geometry.offsets = JSON.parse( JSON.stringify( offsets ) ); - - } - - if ( boundingSphere !== undefined ) { - - geometry.boundingSphere = new THREE.Sphere( - new THREE.Vector3().fromArray( boundingSphere.center !== undefined ? boundingSphere.center : [ 0, 0, 0 ] ), - boundingSphere.radius - ); - - } - - return geometry; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Geometry2Loader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.Geometry2Loader.prototype = { - - constructor: THREE.Geometry2Loader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.XHRLoader(); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - } ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json ) { - - var geometry = new THREE.Geometry2( json.vertices.length / 3 ); - - var attributes = [ 'vertices', 'normals', 'uvs' ]; - var boundingSphere = json.boundingSphere; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - geometry[ attribute ].set( json[ attribute ] ); - - } - - if ( boundingSphere !== undefined ) { - - geometry.boundingSphere = new THREE.Sphere( - new THREE.Vector3().fromArray( boundingSphere.center !== undefined ? boundingSphere.center : [ 0, 0, 0 ] ), - boundingSphere.radius - ); - - } - - return geometry; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.MaterialLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.MaterialLoader.prototype = { - - constructor: THREE.MaterialLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.XHRLoader(); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - } ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json ) { - - var material = new THREE[ json.type ]; - - if ( json.color !== undefined ) material.color.setHex( json.color ); - if ( json.ambient !== undefined ) material.ambient.setHex( json.ambient ); - if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive ); - if ( json.specular !== undefined ) material.specular.setHex( json.specular ); - if ( json.shininess !== undefined ) material.shininess = json.shininess; - if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors; - if ( json.blending !== undefined ) material.blending = json.blending; - if ( json.side !== undefined ) material.side = json.side; - if ( json.opacity !== undefined ) material.opacity = json.opacity; - if ( json.transparent !== undefined ) material.transparent = json.transparent; - if ( json.wireframe !== undefined ) material.wireframe = json.wireframe; - - if ( json.materials !== undefined ) { - - for ( var i = 0, l = json.materials.length; i < l; i ++ ) { - - material.materials.push( this.parse( json.materials[ i ] ) ); - - } - - } - - return material; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.ObjectLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.ObjectLoader.prototype = { - - constructor: THREE.ObjectLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.XHRLoader( scope.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - } ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json ) { - - var geometries = this.parseGeometries( json.geometries ); - var materials = this.parseMaterials( json.materials ); - var object = this.parseObject( json.object, geometries, materials ); - - return object; - - }, - - parseGeometries: function ( json ) { - - var geometries = {}; - - if ( json !== undefined ) { - - var geometryLoader = new THREE.JSONLoader(); - var geometry2Loader = new THREE.Geometry2Loader(); - var bufferGeometryLoader = new THREE.BufferGeometryLoader(); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var geometry; - var data = json[ i ]; - - switch ( data.type ) { - - case 'PlaneGeometry': - - geometry = new THREE.PlaneGeometry( - data.width, - data.height, - data.widthSegments, - data.heightSegments - ); - - break; - - case 'BoxGeometry': - case 'CubeGeometry': // DEPRECATED - - geometry = new THREE.BoxGeometry( - data.width, - data.height, - data.depth, - data.widthSegments, - data.heightSegments, - data.depthSegments - ); - - break; - - case 'CircleGeometry': - - geometry = new THREE.CircleGeometry( - data.radius, - data.segments - ); - - break; - - case 'CylinderGeometry': - - geometry = new THREE.CylinderGeometry( - data.radiusTop, - data.radiusBottom, - data.height, - data.radialSegments, - data.heightSegments, - data.openEnded - ); - - break; - - case 'SphereGeometry': - - geometry = new THREE.SphereGeometry( - data.radius, - data.widthSegments, - data.heightSegments, - data.phiStart, - data.phiLength, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'IcosahedronGeometry': - - geometry = new THREE.IcosahedronGeometry( - data.radius, - data.detail - ); - - break; - - case 'TorusGeometry': - - geometry = new THREE.TorusGeometry( - data.radius, - data.tube, - data.radialSegments, - data.tubularSegments, - data.arc - ); - - break; - - case 'TorusKnotGeometry': - - geometry = new THREE.TorusKnotGeometry( - data.radius, - data.tube, - data.radialSegments, - data.tubularSegments, - data.p, - data.q, - data.heightScale - ); - - break; - - case 'BufferGeometry': - - geometry = bufferGeometryLoader.parse( data.data ); - - break; - - case 'Geometry2': - - geometry = geometry2Loader.parse( data.data ); - - break; - - case 'Geometry': - - geometry = geometryLoader.parse( data.data ).geometry; - - break; - - } - - geometry.uuid = data.uuid; - - if ( data.name !== undefined ) geometry.name = data.name; - - geometries[ data.uuid ] = geometry; - - } - - } - - return geometries; - - }, - - parseMaterials: function ( json ) { - - var materials = {}; - - if ( json !== undefined ) { - - var loader = new THREE.MaterialLoader(); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var data = json[ i ]; - var material = loader.parse( data ); - - material.uuid = data.uuid; - - if ( data.name !== undefined ) material.name = data.name; - - materials[ data.uuid ] = material; - - } - - } - - return materials; - - }, - - parseObject: function () { - - var matrix = new THREE.Matrix4(); - - return function ( data, geometries, materials ) { - - var object; - - switch ( data.type ) { - - case 'Scene': - - object = new THREE.Scene(); - - break; - - case 'PerspectiveCamera': - - object = new THREE.PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); - - break; - - case 'OrthographicCamera': - - object = new THREE.OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); - - break; - - case 'AmbientLight': - - object = new THREE.AmbientLight( data.color ); - - break; - - case 'DirectionalLight': - - object = new THREE.DirectionalLight( data.color, data.intensity ); - - break; - - case 'PointLight': - - object = new THREE.PointLight( data.color, data.intensity, data.distance ); - - break; - - case 'SpotLight': - - object = new THREE.SpotLight( data.color, data.intensity, data.distance, data.angle, data.exponent ); - - break; - - case 'HemisphereLight': - - object = new THREE.HemisphereLight( data.color, data.groundColor, data.intensity ); - - break; - - case 'Mesh': - - var geometry = geometries[ data.geometry ]; - var material = materials[ data.material ]; - - if ( geometry === undefined ) { - - console.error( 'THREE.ObjectLoader: Undefined geometry ' + data.geometry ); - - } - - if ( material === undefined ) { - - console.error( 'THREE.ObjectLoader: Undefined material ' + data.material ); - - } - - object = new THREE.Mesh( geometry, material ); - - break; - - case 'Sprite': - - var material = materials[ data.material ]; - - if ( material === undefined ) { - - console.error( 'THREE.ObjectLoader: Undefined material ' + data.material ); - - } - - object = new THREE.Sprite( material ); - - break; - - default: - - object = new THREE.Object3D(); - - } - - object.uuid = data.uuid; - - if ( data.name !== undefined ) object.name = data.name; - if ( data.matrix !== undefined ) { - - matrix.fromArray( data.matrix ); - matrix.decompose( object.position, object.quaternion, object.scale ); - - } else { - - if ( data.position !== undefined ) object.position.fromArray( data.position ); - if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); - if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); - - } - - if ( data.visible !== undefined ) object.visible = data.visible; - if ( data.userData !== undefined ) object.userData = data.userData; - - if ( data.children !== undefined ) { - - for ( var child in data.children ) { - - object.add( this.parseObject( data.children[ child ], geometries, materials ) ); - - } - - } - - return object; - - } - - }() - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.SceneLoader = function () { - - this.onLoadStart = function () {}; - this.onLoadProgress = function() {}; - this.onLoadComplete = function () {}; - - this.callbackSync = function () {}; - this.callbackProgress = function () {}; - - this.geometryHandlers = {}; - this.hierarchyHandlers = {}; - - this.addGeometryHandler( "ascii", THREE.JSONLoader ); - -}; - -THREE.SceneLoader.prototype = { - - constructor: THREE.SceneLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.XHRLoader( scope.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - scope.parse( JSON.parse( text ), onLoad, url ); - - } ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - addGeometryHandler: function ( typeID, loaderClass ) { - - this.geometryHandlers[ typeID ] = { "loaderClass": loaderClass }; - - }, - - addHierarchyHandler: function ( typeID, loaderClass ) { - - this.hierarchyHandlers[ typeID ] = { "loaderClass": loaderClass }; - - }, - - parse: function ( json, callbackFinished, url ) { - - var scope = this; - - var urlBase = THREE.Loader.prototype.extractUrlBase( url ); - - var geometry, material, camera, fog, - texture, images, color, - light, hex, intensity, - counter_models, counter_textures, - total_models, total_textures, - result; - - var target_array = []; - - var data = json; - - // async geometry loaders - - for ( var typeID in this.geometryHandlers ) { - - var loaderClass = this.geometryHandlers[ typeID ][ "loaderClass" ]; - this.geometryHandlers[ typeID ][ "loaderObject" ] = new loaderClass(); - - } - - // async hierachy loaders - - for ( var typeID in this.hierarchyHandlers ) { - - var loaderClass = this.hierarchyHandlers[ typeID ][ "loaderClass" ]; - this.hierarchyHandlers[ typeID ][ "loaderObject" ] = new loaderClass(); - - } - - counter_models = 0; - counter_textures = 0; - - result = { - - scene: new THREE.Scene(), - geometries: {}, - face_materials: {}, - materials: {}, - textures: {}, - objects: {}, - cameras: {}, - lights: {}, - fogs: {}, - empties: {}, - groups: {} - - }; - - if ( data.transform ) { - - var position = data.transform.position, - rotation = data.transform.rotation, - scale = data.transform.scale; - - if ( position ) { - - result.scene.position.fromArray( position ); - - } - - if ( rotation ) { - - result.scene.rotation.fromArray( rotation ); - - } - - if ( scale ) { - - result.scene.scale.fromArray( scale ); - - } - - if ( position || rotation || scale ) { - - result.scene.updateMatrix(); - result.scene.updateMatrixWorld(); - - } - - } - - function get_url( source_url, url_type ) { - - if ( url_type == "relativeToHTML" ) { - - return source_url; - - } else { - - return urlBase + source_url; - - } - - }; - - // toplevel loader function, delegates to handle_children - - function handle_objects() { - - handle_children( result.scene, data.objects ); - - } - - // handle all the children from the loaded json and attach them to given parent - - function handle_children( parent, children ) { - - var mat, dst, pos, rot, scl, quat; - - for ( var objID in children ) { - - // check by id if child has already been handled, - // if not, create new object - - var object = result.objects[ objID ]; - var objJSON = children[ objID ]; - - if ( object === undefined ) { - - // meshes - - if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlers ) ) { - - if ( objJSON.loading === undefined ) { - - var reservedTypes = { - "type": 1, "url": 1, "material": 1, - "position": 1, "rotation": 1, "scale" : 1, - "visible": 1, "children": 1, "userData": 1, - "skin": 1, "morph": 1, "mirroredLoop": 1, "duration": 1 - }; - - var loaderParameters = {}; - - for ( var parType in objJSON ) { - - if ( ! ( parType in reservedTypes ) ) { - - loaderParameters[ parType ] = objJSON[ parType ]; - - } - - } - - material = result.materials[ objJSON.material ]; - - objJSON.loading = true; - - var loader = scope.hierarchyHandlers[ objJSON.type ][ "loaderObject" ]; - - // ColladaLoader - - if ( loader.options ) { - - loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ) ); - - // UTF8Loader - // OBJLoader - - } else { - - loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ), loaderParameters ); - - } - - } - - } else if ( objJSON.geometry !== undefined ) { - - geometry = result.geometries[ objJSON.geometry ]; - - // geometry already loaded - - if ( geometry ) { - - var needsTangents = false; - - material = result.materials[ objJSON.material ]; - needsTangents = material instanceof THREE.ShaderMaterial; - - pos = objJSON.position; - rot = objJSON.rotation; - scl = objJSON.scale; - mat = objJSON.matrix; - quat = objJSON.quaternion; - - // use materials from the model file - // if there is no material specified in the object - - if ( ! objJSON.material ) { - - material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] ); - - } - - // use materials from the model file - // if there is just empty face material - // (must create new material as each model has its own face material) - - if ( ( material instanceof THREE.MeshFaceMaterial ) && material.materials.length === 0 ) { - - material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] ); - - } - - if ( material instanceof THREE.MeshFaceMaterial ) { - - for ( var i = 0; i < material.materials.length; i ++ ) { - - needsTangents = needsTangents || ( material.materials[ i ] instanceof THREE.ShaderMaterial ); - - } - - } - - if ( needsTangents ) { - - geometry.computeTangents(); - - } - - if ( objJSON.skin ) { - - object = new THREE.SkinnedMesh( geometry, material ); - - } else if ( objJSON.morph ) { - - object = new THREE.MorphAnimMesh( geometry, material ); - - if ( objJSON.duration !== undefined ) { - - object.duration = objJSON.duration; - - } - - if ( objJSON.time !== undefined ) { - - object.time = objJSON.time; - - } - - if ( objJSON.mirroredLoop !== undefined ) { - - object.mirroredLoop = objJSON.mirroredLoop; - - } - - if ( material.morphNormals ) { - - geometry.computeMorphNormals(); - - } - - } else { - - object = new THREE.Mesh( geometry, material ); - - } - - object.name = objID; - - if ( mat ) { - - object.matrixAutoUpdate = false; - object.matrix.set( - mat[0], mat[1], mat[2], mat[3], - mat[4], mat[5], mat[6], mat[7], - mat[8], mat[9], mat[10], mat[11], - mat[12], mat[13], mat[14], mat[15] - ); - - } else { - - object.position.fromArray( pos ); - - if ( quat ) { - - object.quaternion.fromArray( quat ); - - } else { - - object.rotation.fromArray( rot ); - - } - - object.scale.fromArray( scl ); - - } - - object.visible = objJSON.visible; - object.castShadow = objJSON.castShadow; - object.receiveShadow = objJSON.receiveShadow; - - parent.add( object ); - - result.objects[ objID ] = object; - - } - - // lights - - } else if ( objJSON.type === "AmbientLight" || objJSON.type === "PointLight" || - objJSON.type === "DirectionalLight" || objJSON.type === "SpotLight" || - objJSON.type === "HemisphereLight" || objJSON.type === "AreaLight" ) { - - var color = objJSON.color; - var intensity = objJSON.intensity; - var distance = objJSON.distance; - var position = objJSON.position; - var rotation = objJSON.rotation; - - switch ( objJSON.type ) { - - case 'AmbientLight': - light = new THREE.AmbientLight( color ); - break; - - case 'PointLight': - light = new THREE.PointLight( color, intensity, distance ); - light.position.fromArray( position ); - break; - - case 'DirectionalLight': - light = new THREE.DirectionalLight( color, intensity ); - light.position.fromArray( objJSON.direction ); - break; - - case 'SpotLight': - light = new THREE.SpotLight( color, intensity, distance, 1 ); - light.angle = objJSON.angle; - light.position.fromArray( position ); - light.target.set( position[ 0 ], position[ 1 ] - distance, position[ 2 ] ); - light.target.applyEuler( new THREE.Euler( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ], 'XYZ' ) ); - break; - - case 'HemisphereLight': - light = new THREE.DirectionalLight( color, intensity, distance ); - light.target.set( position[ 0 ], position[ 1 ] - distance, position[ 2 ] ); - light.target.applyEuler( new THREE.Euler( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ], 'XYZ' ) ); - break; - - case 'AreaLight': - light = new THREE.AreaLight(color, intensity); - light.position.fromArray( position ); - light.width = objJSON.size; - light.height = objJSON.size_y; - break; - - } - - parent.add( light ); - - light.name = objID; - result.lights[ objID ] = light; - result.objects[ objID ] = light; - - // cameras - - } else if ( objJSON.type === "PerspectiveCamera" || objJSON.type === "OrthographicCamera" ) { - - pos = objJSON.position; - rot = objJSON.rotation; - quat = objJSON.quaternion; - - if ( objJSON.type === "PerspectiveCamera" ) { - - camera = new THREE.PerspectiveCamera( objJSON.fov, objJSON.aspect, objJSON.near, objJSON.far ); - - } else if ( objJSON.type === "OrthographicCamera" ) { - - camera = new THREE.OrthographicCamera( objJSON.left, objJSON.right, objJSON.top, objJSON.bottom, objJSON.near, objJSON.far ); - - } - - camera.name = objID; - camera.position.fromArray( pos ); - - if ( quat !== undefined ) { - - camera.quaternion.fromArray( quat ); - - } else if ( rot !== undefined ) { - - camera.rotation.fromArray( rot ); - - } - - parent.add( camera ); - - result.cameras[ objID ] = camera; - result.objects[ objID ] = camera; - - // pure Object3D - - } else { - - pos = objJSON.position; - rot = objJSON.rotation; - scl = objJSON.scale; - quat = objJSON.quaternion; - - object = new THREE.Object3D(); - object.name = objID; - object.position.fromArray( pos ); - - if ( quat ) { - - object.quaternion.fromArray( quat ); - - } else { - - object.rotation.fromArray( rot ); - - } - - object.scale.fromArray( scl ); - object.visible = ( objJSON.visible !== undefined ) ? objJSON.visible : false; - - parent.add( object ); - - result.objects[ objID ] = object; - result.empties[ objID ] = object; - - } - - if ( object ) { - - if ( objJSON.userData !== undefined ) { - - for ( var key in objJSON.userData ) { - - var value = objJSON.userData[ key ]; - object.userData[ key ] = value; - - } - - } - - if ( objJSON.groups !== undefined ) { - - for ( var i = 0; i < objJSON.groups.length; i ++ ) { - - var groupID = objJSON.groups[ i ]; - - if ( result.groups[ groupID ] === undefined ) { - - result.groups[ groupID ] = []; - - } - - result.groups[ groupID ].push( objID ); - - } - - } - - } - - } - - if ( object !== undefined && objJSON.children !== undefined ) { - - handle_children( object, objJSON.children ); - - } - - } - - }; - - function handle_mesh( geo, mat, id ) { - - result.geometries[ id ] = geo; - result.face_materials[ id ] = mat; - handle_objects(); - - }; - - function handle_hierarchy( node, id, parent, material, obj ) { - - var p = obj.position; - var r = obj.rotation; - var q = obj.quaternion; - var s = obj.scale; - - node.position.fromArray( p ); - - if ( q ) { - - node.quaternion.fromArray( q ); - - } else { - - node.rotation.fromArray( r ); - - } - - node.scale.fromArray( s ); - - // override children materials - // if object material was specified in JSON explicitly - - if ( material ) { - - node.traverse( function ( child ) { - - child.material = material; - - } ); - - } - - // override children visibility - // with root node visibility as specified in JSON - - var visible = ( obj.visible !== undefined ) ? obj.visible : true; - - node.traverse( function ( child ) { - - child.visible = visible; - - } ); - - parent.add( node ); - - node.name = id; - - result.objects[ id ] = node; - handle_objects(); - - }; - - function create_callback_geometry( id ) { - - return function ( geo, mat ) { - - geo.name = id; - - handle_mesh( geo, mat, id ); - - counter_models -= 1; - - scope.onLoadComplete(); - - async_callback_gate(); - - } - - }; - - function create_callback_hierachy( id, parent, material, obj ) { - - return function ( event ) { - - var result; - - // loaders which use EventDispatcher - - if ( event.content ) { - - result = event.content; - - // ColladaLoader - - } else if ( event.dae ) { - - result = event.scene; - - - // UTF8Loader - - } else { - - result = event; - - } - - handle_hierarchy( result, id, parent, material, obj ); - - counter_models -= 1; - - scope.onLoadComplete(); - - async_callback_gate(); - - } - - }; - - function create_callback_embed( id ) { - - return function ( geo, mat ) { - - geo.name = id; - - result.geometries[ id ] = geo; - result.face_materials[ id ] = mat; - - } - - }; - - function async_callback_gate() { - - var progress = { - - totalModels : total_models, - totalTextures : total_textures, - loadedModels : total_models - counter_models, - loadedTextures : total_textures - counter_textures - - }; - - scope.callbackProgress( progress, result ); - - scope.onLoadProgress(); - - if ( counter_models === 0 && counter_textures === 0 ) { - - finalize(); - callbackFinished( result ); - - } - - }; - - function finalize() { - - // take care of targets which could be asynchronously loaded objects - - for ( var i = 0; i < target_array.length; i ++ ) { - - var ta = target_array[ i ]; - - var target = result.objects[ ta.targetName ]; - - if ( target ) { - - ta.object.target = target; - - } else { - - // if there was error and target of specified name doesn't exist in the scene file - // create instead dummy target - // (target must be added to scene explicitly as parent is already added) - - ta.object.target = new THREE.Object3D(); - result.scene.add( ta.object.target ); - - } - - ta.object.target.userData.targetInverse = ta.object; - - } - - }; - - var callbackTexture = function ( count ) { - - counter_textures -= count; - async_callback_gate(); - - scope.onLoadComplete(); - - }; - - // must use this instead of just directly calling callbackTexture - // because of closure in the calling context loop - - var generateTextureCallback = function ( count ) { - - return function () { - - callbackTexture( count ); - - }; - - }; - - function traverse_json_hierarchy( objJSON, callback ) { - - callback( objJSON ); - - if ( objJSON.children !== undefined ) { - - for ( var objChildID in objJSON.children ) { - - traverse_json_hierarchy( objJSON.children[ objChildID ], callback ); - - } - - } - - }; - - // first go synchronous elements - - // fogs - - var fogID, fogJSON; - - for ( fogID in data.fogs ) { - - fogJSON = data.fogs[ fogID ]; - - if ( fogJSON.type === "linear" ) { - - fog = new THREE.Fog( 0x000000, fogJSON.near, fogJSON.far ); - - } else if ( fogJSON.type === "exp2" ) { - - fog = new THREE.FogExp2( 0x000000, fogJSON.density ); - - } - - color = fogJSON.color; - fog.color.setRGB( color[0], color[1], color[2] ); - - result.fogs[ fogID ] = fog; - - } - - // now come potentially asynchronous elements - - // geometries - - // count how many geometries will be loaded asynchronously - - var geoID, geoJSON; - - for ( geoID in data.geometries ) { - - geoJSON = data.geometries[ geoID ]; - - if ( geoJSON.type in this.geometryHandlers ) { - - counter_models += 1; - - scope.onLoadStart(); - - } - - } - - // count how many hierarchies will be loaded asynchronously - - for ( var objID in data.objects ) { - - traverse_json_hierarchy( data.objects[ objID ], function ( objJSON ) { - - if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlers ) ) { - - counter_models += 1; - - scope.onLoadStart(); - - } - - }); - - } - - total_models = counter_models; - - for ( geoID in data.geometries ) { - - geoJSON = data.geometries[ geoID ]; - - if ( geoJSON.type === "cube" ) { - - geometry = new THREE.BoxGeometry( geoJSON.width, geoJSON.height, geoJSON.depth, geoJSON.widthSegments, geoJSON.heightSegments, geoJSON.depthSegments ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; - - } else if ( geoJSON.type === "plane" ) { - - geometry = new THREE.PlaneGeometry( geoJSON.width, geoJSON.height, geoJSON.widthSegments, geoJSON.heightSegments ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; - - } else if ( geoJSON.type === "sphere" ) { - - geometry = new THREE.SphereGeometry( geoJSON.radius, geoJSON.widthSegments, geoJSON.heightSegments ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; - - } else if ( geoJSON.type === "cylinder" ) { - - geometry = new THREE.CylinderGeometry( geoJSON.topRad, geoJSON.botRad, geoJSON.height, geoJSON.radSegs, geoJSON.heightSegs ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; - - } else if ( geoJSON.type === "torus" ) { - - geometry = new THREE.TorusGeometry( geoJSON.radius, geoJSON.tube, geoJSON.segmentsR, geoJSON.segmentsT ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; - - } else if ( geoJSON.type === "icosahedron" ) { - - geometry = new THREE.IcosahedronGeometry( geoJSON.radius, geoJSON.subdivisions ); - geometry.name = geoID; - result.geometries[ geoID ] = geometry; - - } else if ( geoJSON.type in this.geometryHandlers ) { - - var loaderParameters = {}; - - for ( var parType in geoJSON ) { - - if ( parType !== "type" && parType !== "url" ) { - - loaderParameters[ parType ] = geoJSON[ parType ]; - - } - - } - - var loader = this.geometryHandlers[ geoJSON.type ][ "loaderObject" ]; - loader.load( get_url( geoJSON.url, data.urlBaseType ), create_callback_geometry( geoID ), loaderParameters ); - - } else if ( geoJSON.type === "embedded" ) { - - var modelJson = data.embeds[ geoJSON.id ], - texture_path = ""; - - // pass metadata along to jsonLoader so it knows the format version - - modelJson.metadata = data.metadata; - - if ( modelJson ) { - - var jsonLoader = this.geometryHandlers[ "ascii" ][ "loaderObject" ]; - var model = jsonLoader.parse( modelJson, texture_path ); - create_callback_embed( geoID )( model.geometry, model.materials ); - - } - - } - - } - - // textures - - // count how many textures will be loaded asynchronously - - var textureID, textureJSON; - - for ( textureID in data.textures ) { - - textureJSON = data.textures[ textureID ]; - - if ( textureJSON.url instanceof Array ) { - - counter_textures += textureJSON.url.length; - - for( var n = 0; n < textureJSON.url.length; n ++ ) { - - scope.onLoadStart(); - - } - - } else { - - counter_textures += 1; - - scope.onLoadStart(); - - } - - } - - total_textures = counter_textures; - - for ( textureID in data.textures ) { - - textureJSON = data.textures[ textureID ]; - - if ( textureJSON.mapping !== undefined && THREE[ textureJSON.mapping ] !== undefined ) { - - textureJSON.mapping = new THREE[ textureJSON.mapping ](); - - } - - if ( textureJSON.url instanceof Array ) { - - var count = textureJSON.url.length; - var url_array = []; - - for( var i = 0; i < count; i ++ ) { - - url_array[ i ] = get_url( textureJSON.url[ i ], data.urlBaseType ); - - } - - var isCompressed = /\.dds$/i.test( url_array[ 0 ] ); - - if ( isCompressed ) { - - texture = THREE.ImageUtils.loadCompressedTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) ); - - } else { - - texture = THREE.ImageUtils.loadTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) ); - - } - - } else { - - var isCompressed = /\.dds$/i.test( textureJSON.url ); - var fullUrl = get_url( textureJSON.url, data.urlBaseType ); - var textureCallback = generateTextureCallback( 1 ); - - if ( isCompressed ) { - - texture = THREE.ImageUtils.loadCompressedTexture( fullUrl, textureJSON.mapping, textureCallback ); - - } else { - - texture = THREE.ImageUtils.loadTexture( fullUrl, textureJSON.mapping, textureCallback ); - - } - - if ( THREE[ textureJSON.minFilter ] !== undefined ) - texture.minFilter = THREE[ textureJSON.minFilter ]; - - if ( THREE[ textureJSON.magFilter ] !== undefined ) - texture.magFilter = THREE[ textureJSON.magFilter ]; - - if ( textureJSON.anisotropy ) texture.anisotropy = textureJSON.anisotropy; - - if ( textureJSON.repeat ) { - - texture.repeat.set( textureJSON.repeat[ 0 ], textureJSON.repeat[ 1 ] ); - - if ( textureJSON.repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping; - if ( textureJSON.repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping; - - } - - if ( textureJSON.offset ) { - - texture.offset.set( textureJSON.offset[ 0 ], textureJSON.offset[ 1 ] ); - - } - - // handle wrap after repeat so that default repeat can be overriden - - if ( textureJSON.wrap ) { - - var wrapMap = { - "repeat": THREE.RepeatWrapping, - "mirror": THREE.MirroredRepeatWrapping - } - - if ( wrapMap[ textureJSON.wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ textureJSON.wrap[ 0 ] ]; - if ( wrapMap[ textureJSON.wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ textureJSON.wrap[ 1 ] ]; - - } - - } - - result.textures[ textureID ] = texture; - - } - - // materials - - var matID, matJSON; - var parID; - - for ( matID in data.materials ) { - - matJSON = data.materials[ matID ]; - - for ( parID in matJSON.parameters ) { - - if ( parID === "envMap" || parID === "map" || parID === "lightMap" || parID === "bumpMap" ) { - - matJSON.parameters[ parID ] = result.textures[ matJSON.parameters[ parID ] ]; - - } else if ( parID === "shading" ) { - - matJSON.parameters[ parID ] = ( matJSON.parameters[ parID ] === "flat" ) ? THREE.FlatShading : THREE.SmoothShading; - - } else if ( parID === "side" ) { - - if ( matJSON.parameters[ parID ] == "double" ) { - - matJSON.parameters[ parID ] = THREE.DoubleSide; - - } else if ( matJSON.parameters[ parID ] == "back" ) { - - matJSON.parameters[ parID ] = THREE.BackSide; - - } else { - - matJSON.parameters[ parID ] = THREE.FrontSide; - - } - - } else if ( parID === "blending" ) { - - matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.NormalBlending; - - } else if ( parID === "combine" ) { - - matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.MultiplyOperation; - - } else if ( parID === "vertexColors" ) { - - if ( matJSON.parameters[ parID ] == "face" ) { - - matJSON.parameters[ parID ] = THREE.FaceColors; - - // default to vertex colors if "vertexColors" is anything else face colors or 0 / null / false - - } else if ( matJSON.parameters[ parID ] ) { - - matJSON.parameters[ parID ] = THREE.VertexColors; - - } - - } else if ( parID === "wrapRGB" ) { - - var v3 = matJSON.parameters[ parID ]; - matJSON.parameters[ parID ] = new THREE.Vector3( v3[ 0 ], v3[ 1 ], v3[ 2 ] ); - - } - - } - - if ( matJSON.parameters.opacity !== undefined && matJSON.parameters.opacity < 1.0 ) { - - matJSON.parameters.transparent = true; - - } - - if ( matJSON.parameters.normalMap ) { - - var shader = THREE.ShaderLib[ "normalmap" ]; - var uniforms = THREE.UniformsUtils.clone( shader.uniforms ); - - var diffuse = matJSON.parameters.color; - var specular = matJSON.parameters.specular; - var ambient = matJSON.parameters.ambient; - var shininess = matJSON.parameters.shininess; - - uniforms[ "tNormal" ].value = result.textures[ matJSON.parameters.normalMap ]; - - if ( matJSON.parameters.normalScale ) { - - uniforms[ "uNormalScale" ].value.set( matJSON.parameters.normalScale[ 0 ], matJSON.parameters.normalScale[ 1 ] ); - - } - - if ( matJSON.parameters.map ) { - - uniforms[ "tDiffuse" ].value = matJSON.parameters.map; - uniforms[ "enableDiffuse" ].value = true; - - } - - if ( matJSON.parameters.envMap ) { - - uniforms[ "tCube" ].value = matJSON.parameters.envMap; - uniforms[ "enableReflection" ].value = true; - uniforms[ "reflectivity" ].value = matJSON.parameters.reflectivity; - - } - - if ( matJSON.parameters.lightMap ) { - - uniforms[ "tAO" ].value = matJSON.parameters.lightMap; - uniforms[ "enableAO" ].value = true; - - } - - if ( matJSON.parameters.specularMap ) { - - uniforms[ "tSpecular" ].value = result.textures[ matJSON.parameters.specularMap ]; - uniforms[ "enableSpecular" ].value = true; - - } - - if ( matJSON.parameters.displacementMap ) { - - uniforms[ "tDisplacement" ].value = result.textures[ matJSON.parameters.displacementMap ]; - uniforms[ "enableDisplacement" ].value = true; - - uniforms[ "uDisplacementBias" ].value = matJSON.parameters.displacementBias; - uniforms[ "uDisplacementScale" ].value = matJSON.parameters.displacementScale; - - } - - uniforms[ "diffuse" ].value.setHex( diffuse ); - uniforms[ "specular" ].value.setHex( specular ); - uniforms[ "ambient" ].value.setHex( ambient ); - - uniforms[ "shininess" ].value = shininess; - - if ( matJSON.parameters.opacity ) { - - uniforms[ "opacity" ].value = matJSON.parameters.opacity; - - } - - var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: true }; - - material = new THREE.ShaderMaterial( parameters ); - - } else { - - material = new THREE[ matJSON.type ]( matJSON.parameters ); - - } - - material.name = matID; - - result.materials[ matID ] = material; - - } - - // second pass through all materials to initialize MeshFaceMaterials - // that could be referring to other materials out of order - - for ( matID in data.materials ) { - - matJSON = data.materials[ matID ]; - - if ( matJSON.parameters.materials ) { - - var materialArray = []; - - for ( var i = 0; i < matJSON.parameters.materials.length; i ++ ) { - - var label = matJSON.parameters.materials[ i ]; - materialArray.push( result.materials[ label ] ); - - } - - result.materials[ matID ].materials = materialArray; - - } - - } - - // objects ( synchronous init of procedural primitives ) - - handle_objects(); - - // defaults - - if ( result.cameras && data.defaults.camera ) { - - result.currentCamera = result.cameras[ data.defaults.camera ]; - - } - - if ( result.fogs && data.defaults.fog ) { - - result.scene.fog = result.fogs[ data.defaults.fog ]; - - } - - // synchronous callback - - scope.callbackSync( result ); - - // just in case there are no async elements - - async_callback_gate(); - - } - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.TextureLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.TextureLoader.prototype = { - - constructor: THREE.TextureLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.ImageLoader( scope.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( image ) { - - var texture = new THREE.Texture( image ); - texture.needsUpdate = true; - - if ( onLoad !== undefined ) { - - onLoad( texture ); - - } - - } ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Material = function () { - - this.id = THREE.MaterialIdCount ++; - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - - this.side = THREE.FrontSide; - - this.opacity = 1; - this.transparent = false; - - this.blending = THREE.NormalBlending; - - this.blendSrc = THREE.SrcAlphaFactor; - this.blendDst = THREE.OneMinusSrcAlphaFactor; - this.blendEquation = THREE.AddEquation; - - this.depthTest = true; - this.depthWrite = true; - - this.polygonOffset = false; - this.polygonOffsetFactor = 0; - this.polygonOffsetUnits = 0; - - this.alphaTest = 0; - - this.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer - - this.visible = true; - - this.needsUpdate = true; - -}; - -THREE.Material.prototype = { - - constructor: THREE.Material, - - setValues: function ( values ) { - - if ( values === undefined ) return; - - for ( var key in values ) { - - var newValue = values[ key ]; - - if ( newValue === undefined ) { - - console.warn( 'THREE.Material: \'' + key + '\' parameter is undefined.' ); - continue; - - } - - if ( key in this ) { - - var currentValue = this[ key ]; - - if ( currentValue instanceof THREE.Color ) { - - currentValue.set( newValue ); - - } else if ( currentValue instanceof THREE.Vector3 && newValue instanceof THREE.Vector3 ) { - - currentValue.copy( newValue ); - - } else if ( key == 'overdraw') { - - // ensure overdraw is backwards-compatable with legacy boolean type - this[ key ] = Number(newValue); - - } else { - - this[ key ] = newValue; - - } - - } - - } - - }, - - clone: function ( material ) { - - if ( material === undefined ) material = new THREE.Material(); - - material.name = this.name; - - material.side = this.side; - - material.opacity = this.opacity; - material.transparent = this.transparent; - - material.blending = this.blending; - - material.blendSrc = this.blendSrc; - material.blendDst = this.blendDst; - material.blendEquation = this.blendEquation; - - material.depthTest = this.depthTest; - material.depthWrite = this.depthWrite; - - material.polygonOffset = this.polygonOffset; - material.polygonOffsetFactor = this.polygonOffsetFactor; - material.polygonOffsetUnits = this.polygonOffsetUnits; - - material.alphaTest = this.alphaTest; - - material.overdraw = this.overdraw; - - material.visible = this.visible; - - return material; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.Material.prototype ); - -THREE.MaterialIdCount = 0; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * linewidth: <float>, - * linecap: "round", - * linejoin: "round", - * - * vertexColors: <bool> - * - * fog: <bool> - * } - */ - -THREE.LineBasicMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.color = new THREE.Color( 0xffffff ); - - this.linewidth = 1; - this.linecap = 'round'; - this.linejoin = 'round'; - - this.vertexColors = false; - - this.fog = true; - - this.setValues( parameters ); - -}; - -THREE.LineBasicMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.LineBasicMaterial.prototype.clone = function () { - - var material = new THREE.LineBasicMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - - material.linewidth = this.linewidth; - material.linecap = this.linecap; - material.linejoin = this.linejoin; - - material.vertexColors = this.vertexColors; - - material.fog = this.fog; - - return material; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * linewidth: <float>, - * - * scale: <float>, - * dashSize: <float>, - * gapSize: <float>, - * - * vertexColors: <bool> - * - * fog: <bool> - * } - */ - -THREE.LineDashedMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.color = new THREE.Color( 0xffffff ); - - this.linewidth = 1; - - this.scale = 1; - this.dashSize = 3; - this.gapSize = 1; - - this.vertexColors = false; - - this.fog = true; - - this.setValues( parameters ); - -}; - -THREE.LineDashedMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.LineDashedMaterial.prototype.clone = function () { - - var material = new THREE.LineDashedMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - - material.linewidth = this.linewidth; - - material.scale = this.scale; - material.dashSize = this.dashSize; - material.gapSize = this.gapSize; - - material.vertexColors = this.vertexColors; - - material.fog = this.fog; - - return material; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * - * specularMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: <bool>, - * morphTargets: <bool>, - * - * fog: <bool> - * } - */ - -THREE.MeshBasicMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.color = new THREE.Color( 0xffffff ); // emissive - - this.map = null; - - this.lightMap = null; - - this.specularMap = null; - - this.envMap = null; - this.combine = THREE.MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.fog = true; - - this.shading = THREE.SmoothShading; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.vertexColors = THREE.NoColors; - - this.skinning = false; - this.morphTargets = false; - - this.setValues( parameters ); - -}; - -THREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.MeshBasicMaterial.prototype.clone = function () { - - var material = new THREE.MeshBasicMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - - material.map = this.map; - - material.lightMap = this.lightMap; - - material.specularMap = this.specularMap; - - material.envMap = this.envMap; - material.combine = this.combine; - material.reflectivity = this.reflectivity; - material.refractionRatio = this.refractionRatio; - - material.fog = this.fog; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - material.wireframeLinecap = this.wireframeLinecap; - material.wireframeLinejoin = this.wireframeLinejoin; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - material.morphTargets = this.morphTargets; - - return material; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * ambient: <hex>, - * emissive: <hex>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * - * specularMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool>, - * - * fog: <bool> - * } - */ - -THREE.MeshLambertMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.color = new THREE.Color( 0xffffff ); // diffuse - this.ambient = new THREE.Color( 0xffffff ); - this.emissive = new THREE.Color( 0x000000 ); - - this.wrapAround = false; - this.wrapRGB = new THREE.Vector3( 1, 1, 1 ); - - this.map = null; - - this.lightMap = null; - - this.specularMap = null; - - this.envMap = null; - this.combine = THREE.MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.fog = true; - - this.shading = THREE.SmoothShading; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.vertexColors = THREE.NoColors; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - -}; - -THREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.MeshLambertMaterial.prototype.clone = function () { - - var material = new THREE.MeshLambertMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - material.ambient.copy( this.ambient ); - material.emissive.copy( this.emissive ); - - material.wrapAround = this.wrapAround; - material.wrapRGB.copy( this.wrapRGB ); - - material.map = this.map; - - material.lightMap = this.lightMap; - - material.specularMap = this.specularMap; - - material.envMap = this.envMap; - material.combine = this.combine; - material.reflectivity = this.reflectivity; - material.refractionRatio = this.refractionRatio; - - material.fog = this.fog; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - material.wireframeLinecap = this.wireframeLinecap; - material.wireframeLinejoin = this.wireframeLinejoin; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - material.morphTargets = this.morphTargets; - material.morphNormals = this.morphNormals; - - return material; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * ambient: <hex>, - * emissive: <hex>, - * specular: <hex>, - * shininess: <float>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * - * bumpMap: new THREE.Texture( <Image> ), - * bumpScale: <float>, - * - * normalMap: new THREE.Texture( <Image> ), - * normalScale: <Vector2>, - * - * specularMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool>, - * - * fog: <bool> - * } - */ - -THREE.MeshPhongMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.color = new THREE.Color( 0xffffff ); // diffuse - this.ambient = new THREE.Color( 0xffffff ); - this.emissive = new THREE.Color( 0x000000 ); - this.specular = new THREE.Color( 0x111111 ); - this.shininess = 30; - - this.metal = false; - - this.wrapAround = false; - this.wrapRGB = new THREE.Vector3( 1, 1, 1 ); - - this.map = null; - - this.lightMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalScale = new THREE.Vector2( 1, 1 ); - - this.specularMap = null; - - this.envMap = null; - this.combine = THREE.MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.fog = true; - - this.shading = THREE.SmoothShading; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.vertexColors = THREE.NoColors; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - -}; - -THREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.MeshPhongMaterial.prototype.clone = function () { - - var material = new THREE.MeshPhongMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - material.ambient.copy( this.ambient ); - material.emissive.copy( this.emissive ); - material.specular.copy( this.specular ); - material.shininess = this.shininess; - - material.metal = this.metal; - - material.wrapAround = this.wrapAround; - material.wrapRGB.copy( this.wrapRGB ); - - material.map = this.map; - - material.lightMap = this.lightMap; - - material.bumpMap = this.bumpMap; - material.bumpScale = this.bumpScale; - - material.normalMap = this.normalMap; - material.normalScale.copy( this.normalScale ); - - material.specularMap = this.specularMap; - - material.envMap = this.envMap; - material.combine = this.combine; - material.reflectivity = this.reflectivity; - material.refractionRatio = this.refractionRatio; - - material.fog = this.fog; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - material.wireframeLinecap = this.wireframeLinecap; - material.wireframeLinejoin = this.wireframeLinejoin; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - material.morphTargets = this.morphTargets; - material.morphNormals = this.morphNormals; - - return material; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * opacity: <float>, - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float> - * } - */ - -THREE.MeshDepthMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.setValues( parameters ); - -}; - -THREE.MeshDepthMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.MeshDepthMaterial.prototype.clone = function () { - - var material = new THREE.MeshDepthMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - - return material; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * - * parameters = { - * opacity: <float>, - * - * shading: THREE.FlatShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float> - * } - */ - -THREE.MeshNormalMaterial = function ( parameters ) { - - THREE.Material.call( this, parameters ); - - this.shading = THREE.FlatShading; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.morphTargets = false; - - this.setValues( parameters ); - -}; - -THREE.MeshNormalMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.MeshNormalMaterial.prototype.clone = function () { - - var material = new THREE.MeshNormalMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - - return material; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.MeshFaceMaterial = function ( materials ) { - - this.materials = materials instanceof Array ? materials : []; - -}; - -THREE.MeshFaceMaterial.prototype.clone = function () { - - var material = new THREE.MeshFaceMaterial(); - - for ( var i = 0; i < this.materials.length; i ++ ) { - - material.materials.push( this.materials[ i ].clone() ); - - } - - return material; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * size: <float>, - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * vertexColors: <bool>, - * - * fog: <bool> - * } - */ - -THREE.ParticleSystemMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.color = new THREE.Color( 0xffffff ); - - this.map = null; - - this.size = 1; - this.sizeAttenuation = true; - - this.vertexColors = false; - - this.fog = true; - - this.setValues( parameters ); - -}; - -THREE.ParticleSystemMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.ParticleSystemMaterial.prototype.clone = function () { - - var material = new THREE.ParticleSystemMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - - material.map = this.map; - - material.size = this.size; - material.sizeAttenuation = this.sizeAttenuation; - - material.vertexColors = this.vertexColors; - - material.fog = this.fog; - - return material; - -}; - -// backwards compatibility - -THREE.ParticleBasicMaterial = THREE.ParticleSystemMaterial; - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * fragmentShader: <string>, - * vertexShader: <string>, - * - * uniforms: { "parameter1": { type: "f", value: 1.0 }, "parameter2": { type: "i" value2: 2 } }, - * - * defines: { "label" : "value" }, - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * lights: <bool>, - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool>, - * - * fog: <bool> - * } - */ - -THREE.ShaderMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.fragmentShader = "void main() {}"; - this.vertexShader = "void main() {}"; - this.uniforms = {}; - this.defines = {}; - this.attributes = null; - - this.shading = THREE.SmoothShading; - - this.linewidth = 1; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; // set to use scene fog - - this.lights = false; // set to use scene lights - - this.vertexColors = THREE.NoColors; // set to use "color" attribute stream - - this.skinning = false; // set to use skinning attribute streams - - this.morphTargets = false; // set to use morph targets - this.morphNormals = false; // set to use morph normals - - // When rendered geometry doesn't include these attributes but the material does, - // use these default values in WebGL. This avoids errors when buffer data is missing. - this.defaultAttributeValues = { - "color" : [ 1, 1, 1], - "uv" : [ 0, 0 ], - "uv2" : [ 0, 0 ] - }; - - // By default, bind position to attribute index 0. In WebGL, attribute 0 - // should always be used to avoid potentially expensive emulation. - this.index0AttributeName = "position"; - - this.setValues( parameters ); - -}; - -THREE.ShaderMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.ShaderMaterial.prototype.clone = function () { - - var material = new THREE.ShaderMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.fragmentShader = this.fragmentShader; - material.vertexShader = this.vertexShader; - - material.uniforms = THREE.UniformsUtils.clone( this.uniforms ); - - material.attributes = this.attributes; - material.defines = this.defines; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - - material.fog = this.fog; - - material.lights = this.lights; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - - material.morphTargets = this.morphTargets; - material.morphNormals = this.morphNormals; - - return material; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * uvOffset: new THREE.Vector2(), - * uvScale: new THREE.Vector2(), - * - * fog: <bool> - * } - */ - -THREE.SpriteMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - // defaults - - this.color = new THREE.Color( 0xffffff ); - this.map = null; - - this.rotation = 0; - - this.fog = false; - - // set parameters - - this.setValues( parameters ); - -}; - -THREE.SpriteMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.SpriteMaterial.prototype.clone = function () { - - var material = new THREE.SpriteMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - material.map = this.map; - - material.rotation = this.rotation; - - material.fog = this.fog; - - return material; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * - * parameters = { - * color: <hex>, - * program: <function>, - * opacity: <float>, - * blending: THREE.NormalBlending - * } - */ - -THREE.SpriteCanvasMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.color = new THREE.Color( 0xffffff ); - this.program = function ( context, color ) {}; - - this.setValues( parameters ); - -}; - -THREE.SpriteCanvasMaterial.prototype = Object.create( THREE.Material.prototype ); - -THREE.SpriteCanvasMaterial.prototype.clone = function () { - - var material = new THREE.SpriteCanvasMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - material.program = this.program; - - return material; - -}; - -// backwards compatibility - -THREE.ParticleCanvasMaterial = THREE.SpriteCanvasMaterial; -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author szimek / https://github.com/szimek/ - */ - -THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - this.id = THREE.TextureIdCount ++; - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - - this.image = image; - this.mipmaps = []; - - this.mapping = mapping !== undefined ? mapping : new THREE.UVMapping(); - - this.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping; - this.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping; - - this.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter; - this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter; - - this.anisotropy = anisotropy !== undefined ? anisotropy : 1; - - this.format = format !== undefined ? format : THREE.RGBAFormat; - this.type = type !== undefined ? type : THREE.UnsignedByteType; - - this.offset = new THREE.Vector2( 0, 0 ); - this.repeat = new THREE.Vector2( 1, 1 ); - - this.generateMipmaps = true; - this.premultiplyAlpha = false; - this.flipY = true; - this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml) - - this._needsUpdate = false; - this.onUpdate = null; - -}; - -THREE.Texture.prototype = { - - constructor: THREE.Texture, - - get needsUpdate () { - - return this._needsUpdate; - - }, - - set needsUpdate ( value ) { - - if ( value === true ) this.update(); - - this._needsUpdate = value; - - }, - - clone: function ( texture ) { - - if ( texture === undefined ) texture = new THREE.Texture(); - - texture.image = this.image; - texture.mipmaps = this.mipmaps.slice(0); - - texture.mapping = this.mapping; - - texture.wrapS = this.wrapS; - texture.wrapT = this.wrapT; - - texture.magFilter = this.magFilter; - texture.minFilter = this.minFilter; - - texture.anisotropy = this.anisotropy; - - texture.format = this.format; - texture.type = this.type; - - texture.offset.copy( this.offset ); - texture.repeat.copy( this.repeat ); - - texture.generateMipmaps = this.generateMipmaps; - texture.premultiplyAlpha = this.premultiplyAlpha; - texture.flipY = this.flipY; - texture.unpackAlignment = this.unpackAlignment; - - return texture; - - }, - - update: function () { - - this.dispatchEvent( { type: 'update' } ); - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.Texture.prototype ); - -THREE.TextureIdCount = 0; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.CompressedTexture = function ( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) { - - THREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.image = { width: width, height: height }; - this.mipmaps = mipmaps; - - this.generateMipmaps = false; // WebGL currently can't generate mipmaps for compressed textures, they must be embedded in DDS file - -}; - -THREE.CompressedTexture.prototype = Object.create( THREE.Texture.prototype ); - -THREE.CompressedTexture.prototype.clone = function () { - - var texture = new THREE.CompressedTexture(); - - THREE.Texture.prototype.clone.call( this, texture ); - - return texture; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.DataTexture = function ( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) { - - THREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.image = { data: data, width: width, height: height }; - -}; - -THREE.DataTexture.prototype = Object.create( THREE.Texture.prototype ); - -THREE.DataTexture.prototype.clone = function () { - - var texture = new THREE.DataTexture(); - - THREE.Texture.prototype.clone.call( this, texture ); - - return texture; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.ParticleSystem = function ( geometry, material ) { - - THREE.Object3D.call( this ); - - this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); - this.material = material !== undefined ? material : new THREE.ParticleSystemMaterial( { color: Math.random() * 0xffffff } ); - - this.sortParticles = false; - this.frustumCulled = false; - -}; - -THREE.ParticleSystem.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.ParticleSystem.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.ParticleSystem( this.geometry, this.material ); - - object.sortParticles = this.sortParticles; - - THREE.Object3D.prototype.clone.call( this, object ); - - return object; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Line = function ( geometry, material, type ) { - - THREE.Object3D.call( this ); - - this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); - this.material = material !== undefined ? material : new THREE.LineBasicMaterial( { color: Math.random() * 0xffffff } ); - - this.type = ( type !== undefined ) ? type : THREE.LineStrip; - -}; - -THREE.LineStrip = 0; -THREE.LinePieces = 1; - -THREE.Line.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.Line.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.Line( this.geometry, this.material, this.type ); - - THREE.Object3D.prototype.clone.call( this, object ); - - return object; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author jonobr1 / http://jonobr1.com/ - */ - -THREE.Mesh = function ( geometry, material ) { - - THREE.Object3D.call( this ); - - this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); - this.material = material !== undefined ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ); - - this.updateMorphTargets(); - -}; - -THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.Mesh.prototype.updateMorphTargets = function () { - - if ( this.geometry.morphTargets !== undefined && this.geometry.morphTargets.length > 0 ) { - - this.morphTargetBase = -1; - this.morphTargetForcedOrder = []; - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - - for ( var m = 0, ml = this.geometry.morphTargets.length; m < ml; m ++ ) { - - this.morphTargetInfluences.push( 0 ); - this.morphTargetDictionary[ this.geometry.morphTargets[ m ].name ] = m; - - } - - } - -}; - -THREE.Mesh.prototype.getMorphTargetIndexByName = function ( name ) { - - if ( this.morphTargetDictionary[ name ] !== undefined ) { - - return this.morphTargetDictionary[ name ]; - - } - - console.log( "THREE.Mesh.getMorphTargetIndexByName: morph target " + name + " does not exist. Returning 0." ); - - return 0; - -}; - -THREE.Mesh.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.Mesh( this.geometry, this.material ); - - THREE.Object3D.prototype.clone.call( this, object ); - - return object; - -}; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Bone = function( belongsToSkin ) { - - THREE.Object3D.call( this ); - - this.skin = belongsToSkin; - this.skinMatrix = new THREE.Matrix4(); - -}; - -THREE.Bone.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.Bone.prototype.update = function ( parentSkinMatrix, forceUpdate ) { - - // update local - - if ( this.matrixAutoUpdate ) { - - forceUpdate |= this.updateMatrix(); - - } - - // update skin matrix - - if ( forceUpdate || this.matrixWorldNeedsUpdate ) { - - if( parentSkinMatrix ) { - - this.skinMatrix.multiplyMatrices( parentSkinMatrix, this.matrix ); - - } else { - - this.skinMatrix.copy( this.matrix ); - - } - - this.matrixWorldNeedsUpdate = false; - forceUpdate = true; - - } - - // update children - - var child, i, l = this.children.length; - - for ( i = 0; i < l; i ++ ) { - - this.children[ i ].update( this.skinMatrix, forceUpdate ); - - } - -}; - - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { - - THREE.Mesh.call( this, geometry, material ); - - // - - this.useVertexTexture = useVertexTexture !== undefined ? useVertexTexture : true; - - // init bones - - this.identityMatrix = new THREE.Matrix4(); - - this.bones = []; - this.boneMatrices = []; - - var b, bone, gbone, p, q, s; - - if ( this.geometry && this.geometry.bones !== undefined ) { - - for ( b = 0; b < this.geometry.bones.length; b ++ ) { - - gbone = this.geometry.bones[ b ]; - - p = gbone.pos; - q = gbone.rotq; - s = gbone.scl; - - bone = this.addBone(); - - bone.name = gbone.name; - bone.position.set( p[0], p[1], p[2] ); - bone.quaternion.set( q[0], q[1], q[2], q[3] ); - - if ( s !== undefined ) { - - bone.scale.set( s[0], s[1], s[2] ); - - } else { - - bone.scale.set( 1, 1, 1 ); - - } - - } - - for ( b = 0; b < this.bones.length; b ++ ) { - - gbone = this.geometry.bones[ b ]; - bone = this.bones[ b ]; - - if ( gbone.parent === -1 ) { - - this.add( bone ); - - } else { - - this.bones[ gbone.parent ].add( bone ); - - } - - } - - // - - var nBones = this.bones.length; - - if ( this.useVertexTexture ) { - - // layout (1 matrix = 4 pixels) - // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) - // with 8x8 pixel texture max 16 bones (8 * 8 / 4) - // 16x16 pixel texture max 64 bones (16 * 16 / 4) - // 32x32 pixel texture max 256 bones (32 * 32 / 4) - // 64x64 pixel texture max 1024 bones (64 * 64 / 4) - - var size; - - if ( nBones > 256 ) - size = 64; - else if ( nBones > 64 ) - size = 32; - else if ( nBones > 16 ) - size = 16; - else - size = 8; - - this.boneTextureWidth = size; - this.boneTextureHeight = size; - - this.boneMatrices = new Float32Array( this.boneTextureWidth * this.boneTextureHeight * 4 ); // 4 floats per RGBA pixel - this.boneTexture = new THREE.DataTexture( this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, THREE.RGBAFormat, THREE.FloatType ); - this.boneTexture.minFilter = THREE.NearestFilter; - this.boneTexture.magFilter = THREE.NearestFilter; - this.boneTexture.generateMipmaps = false; - this.boneTexture.flipY = false; - - } else { - - this.boneMatrices = new Float32Array( 16 * nBones ); - - } - - this.pose(); - - } - -}; - -THREE.SkinnedMesh.prototype = Object.create( THREE.Mesh.prototype ); - -THREE.SkinnedMesh.prototype.addBone = function( bone ) { - - if ( bone === undefined ) { - - bone = new THREE.Bone( this ); - - } - - this.bones.push( bone ); - - return bone; - -}; - -THREE.SkinnedMesh.prototype.updateMatrixWorld = function () { - - var offsetMatrix = new THREE.Matrix4(); - - return function ( force ) { - - this.matrixAutoUpdate && this.updateMatrix(); - - // update matrixWorld - - if ( this.matrixWorldNeedsUpdate || force ) { - - if ( this.parent ) { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - } else { - - this.matrixWorld.copy( this.matrix ); - - } - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - var child = this.children[ i ]; - - if ( child instanceof THREE.Bone ) { - - child.update( this.identityMatrix, false ); - - } else { - - child.updateMatrixWorld( true ); - - } - - } - - // make a snapshot of the bones' rest position - - if ( this.boneInverses == undefined ) { - - this.boneInverses = []; - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - var inverse = new THREE.Matrix4(); - - inverse.getInverse( this.bones[ b ].skinMatrix ); - - this.boneInverses.push( inverse ); - - } - - } - - // flatten bone matrices to array - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - // compute the offset between the current and the original transform; - - // TODO: we could get rid of this multiplication step if the skinMatrix - // was already representing the offset; however, this requires some - // major changes to the animation system - - offsetMatrix.multiplyMatrices( this.bones[ b ].skinMatrix, this.boneInverses[ b ] ); - offsetMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 ); - - } - - if ( this.useVertexTexture ) { - - this.boneTexture.needsUpdate = true; - - } - - }; - -}(); - -THREE.SkinnedMesh.prototype.pose = function () { - - this.updateMatrixWorld( true ); - - this.normalizeSkinWeights(); - -}; - -THREE.SkinnedMesh.prototype.normalizeSkinWeights = function () { - - if ( this.geometry instanceof THREE.Geometry ) { - - for ( var i = 0; i < this.geometry.skinIndices.length; i ++ ) { - - var sw = this.geometry.skinWeights[ i ]; - - var scale = 1.0 / sw.lengthManhattan(); - - if ( scale !== Infinity ) { - - sw.multiplyScalar( scale ); - - } else { - - sw.set( 1 ); // this will be normalized by the shader anyway - - } - - } - - } else { - - // skinning weights assumed to be normalized for THREE.BufferGeometry - - } - -}; - -THREE.SkinnedMesh.prototype.clone = function ( object ) { - - if ( object === undefined ) { - - object = new THREE.SkinnedMesh( this.geometry, this.material, this.useVertexTexture ); - - } - - THREE.Mesh.prototype.clone.call( this, object ); - - return object; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.MorphAnimMesh = function ( geometry, material ) { - - THREE.Mesh.call( this, geometry, material ); - - // API - - this.duration = 1000; // milliseconds - this.mirroredLoop = false; - this.time = 0; - - // internals - - this.lastKeyframe = 0; - this.currentKeyframe = 0; - - this.direction = 1; - this.directionBackwards = false; - - this.setFrameRange( 0, this.geometry.morphTargets.length - 1 ); - -}; - -THREE.MorphAnimMesh.prototype = Object.create( THREE.Mesh.prototype ); - -THREE.MorphAnimMesh.prototype.setFrameRange = function ( start, end ) { - - this.startKeyframe = start; - this.endKeyframe = end; - - this.length = this.endKeyframe - this.startKeyframe + 1; - -}; - -THREE.MorphAnimMesh.prototype.setDirectionForward = function () { - - this.direction = 1; - this.directionBackwards = false; - -}; - -THREE.MorphAnimMesh.prototype.setDirectionBackward = function () { - - this.direction = -1; - this.directionBackwards = true; - -}; - -THREE.MorphAnimMesh.prototype.parseAnimations = function () { - - var geometry = this.geometry; - - if ( ! geometry.animations ) geometry.animations = {}; - - var firstAnimation, animations = geometry.animations; - - var pattern = /([a-z]+)(\d+)/; - - for ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) { - - var morph = geometry.morphTargets[ i ]; - var parts = morph.name.match( pattern ); - - if ( parts && parts.length > 1 ) { - - var label = parts[ 1 ]; - var num = parts[ 2 ]; - - if ( ! animations[ label ] ) animations[ label ] = { start: Infinity, end: -Infinity }; - - var animation = animations[ label ]; - - if ( i < animation.start ) animation.start = i; - if ( i > animation.end ) animation.end = i; - - if ( ! firstAnimation ) firstAnimation = label; - - } - - } - - geometry.firstAnimation = firstAnimation; - -}; - -THREE.MorphAnimMesh.prototype.setAnimationLabel = function ( label, start, end ) { - - if ( ! this.geometry.animations ) this.geometry.animations = {}; - - this.geometry.animations[ label ] = { start: start, end: end }; - -}; - -THREE.MorphAnimMesh.prototype.playAnimation = function ( label, fps ) { - - var animation = this.geometry.animations[ label ]; - - if ( animation ) { - - this.setFrameRange( animation.start, animation.end ); - this.duration = 1000 * ( ( animation.end - animation.start ) / fps ); - this.time = 0; - - } else { - - console.warn( "animation[" + label + "] undefined" ); - - } - -}; - -THREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) { - - var frameTime = this.duration / this.length; - - this.time += this.direction * delta; - - if ( this.mirroredLoop ) { - - if ( this.time > this.duration || this.time < 0 ) { - - this.direction *= -1; - - if ( this.time > this.duration ) { - - this.time = this.duration; - this.directionBackwards = true; - - } - - if ( this.time < 0 ) { - - this.time = 0; - this.directionBackwards = false; - - } - - } - - } else { - - this.time = this.time % this.duration; - - if ( this.time < 0 ) this.time += this.duration; - - } - - var keyframe = this.startKeyframe + THREE.Math.clamp( Math.floor( this.time / frameTime ), 0, this.length - 1 ); - - if ( keyframe !== this.currentKeyframe ) { - - this.morphTargetInfluences[ this.lastKeyframe ] = 0; - this.morphTargetInfluences[ this.currentKeyframe ] = 1; - - this.morphTargetInfluences[ keyframe ] = 0; - - this.lastKeyframe = this.currentKeyframe; - this.currentKeyframe = keyframe; - - } - - var mix = ( this.time % frameTime ) / frameTime; - - if ( this.directionBackwards ) { - - mix = 1 - mix; - - } - - this.morphTargetInfluences[ this.currentKeyframe ] = mix; - this.morphTargetInfluences[ this.lastKeyframe ] = 1 - mix; - -}; - -THREE.MorphAnimMesh.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.MorphAnimMesh( this.geometry, this.material ); - - object.duration = this.duration; - object.mirroredLoop = this.mirroredLoop; - object.time = this.time; - - object.lastKeyframe = this.lastKeyframe; - object.currentKeyframe = this.currentKeyframe; - - object.direction = this.direction; - object.directionBackwards = this.directionBackwards; - - THREE.Mesh.prototype.clone.call( this, object ); - - return object; - -}; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.LOD = function () { - - THREE.Object3D.call( this ); - - this.objects = []; - -}; - - -THREE.LOD.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.LOD.prototype.addLevel = function ( object, distance ) { - - if ( distance === undefined ) distance = 0; - - distance = Math.abs( distance ); - - for ( var l = 0; l < this.objects.length; l ++ ) { - - if ( distance < this.objects[ l ].distance ) { - - break; - - } - - } - - this.objects.splice( l, 0, { distance: distance, object: object } ); - this.add( object ); - -}; - -THREE.LOD.prototype.getObjectForDistance = function ( distance ) { - - for ( var i = 1, l = this.objects.length; i < l; i ++ ) { - - if ( distance < this.objects[ i ].distance ) { - - break; - - } - - } - - return this.objects[ i - 1 ].object; - -}; - -THREE.LOD.prototype.update = function () { - - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - - return function ( camera ) { - - if ( this.objects.length > 1 ) { - - v1.setFromMatrixPosition( camera.matrixWorld ); - v2.setFromMatrixPosition( this.matrixWorld ); - - var distance = v1.distanceTo( v2 ); - - this.objects[ 0 ].object.visible = true; - - for ( var i = 1, l = this.objects.length; i < l; i ++ ) { - - if ( distance >= this.objects[ i ].distance ) { - - this.objects[ i - 1 ].object.visible = false; - this.objects[ i ].object.visible = true; - - } else { - - break; - - } - - } - - for( ; i < l; i ++ ) { - - this.objects[ i ].object.visible = false; - - } - - } - - }; - -}(); - -THREE.LOD.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.LOD(); - - THREE.Object3D.prototype.clone.call( this, object ); - - for ( var i = 0, l = this.objects.length; i < l; i ++ ) { - var x = this.objects[i].object.clone(); - x.visible = i === 0; - object.addLevel( x, this.objects[i].distance ); - } - - return object; - -}; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Sprite = ( function () { - - var geometry = new THREE.Geometry2( 3 ); - geometry.vertices.set( [ - 0.5, - 0.5, 0, 0.5, - 0.5, 0, 0.5, 0.5, 0 ] ); - - return function ( material ) { - - THREE.Object3D.call( this ); - - this.geometry = geometry; - this.material = ( material !== undefined ) ? material : new THREE.SpriteMaterial(); - - }; - -} )(); - -THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype ); - -/* - * Custom update matrix - */ - -THREE.Sprite.prototype.updateMatrix = function () { - - this.matrix.compose( this.position, this.quaternion, this.scale ); - - this.matrixWorldNeedsUpdate = true; - -}; - -THREE.Sprite.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.Sprite( this.material ); - - THREE.Object3D.prototype.clone.call( this, object ); - - return object; - -}; - -// Backwards compatibility - -THREE.Particle = THREE.Sprite; -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Scene = function () { - - THREE.Object3D.call( this ); - - this.fog = null; - this.overrideMaterial = null; - - this.autoUpdate = true; // checked by the renderer - this.matrixAutoUpdate = false; - - this.__lights = []; - - this.__objectsAdded = []; - this.__objectsRemoved = []; - -}; - -THREE.Scene.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.Scene.prototype.__addObject = function ( object ) { - - if ( object instanceof THREE.Light ) { - - if ( this.__lights.indexOf( object ) === - 1 ) { - - this.__lights.push( object ); - - } - - if ( object.target && object.target.parent === undefined ) { - - this.add( object.target ); - - } - - } else if ( !( object instanceof THREE.Camera || object instanceof THREE.Bone ) ) { - - this.__objectsAdded.push( object ); - - // check if previously removed - - var i = this.__objectsRemoved.indexOf( object ); - - if ( i !== -1 ) { - - this.__objectsRemoved.splice( i, 1 ); - - } - - } - - this.dispatchEvent( { type: 'objectAdded', object: object } ); - object.dispatchEvent( { type: 'addedToScene', scene: this } ); - - for ( var c = 0; c < object.children.length; c ++ ) { - - this.__addObject( object.children[ c ] ); - - } - -}; - -THREE.Scene.prototype.__removeObject = function ( object ) { - - if ( object instanceof THREE.Light ) { - - var i = this.__lights.indexOf( object ); - - if ( i !== -1 ) { - - this.__lights.splice( i, 1 ); - - } - - if ( object.shadowCascadeArray ) { - - for ( var x = 0; x < object.shadowCascadeArray.length; x ++ ) { - - this.__removeObject( object.shadowCascadeArray[ x ] ); - - } - - } - - } else if ( !( object instanceof THREE.Camera ) ) { - - this.__objectsRemoved.push( object ); - - // check if previously added - - var i = this.__objectsAdded.indexOf( object ); - - if ( i !== -1 ) { - - this.__objectsAdded.splice( i, 1 ); - - } - - } - - this.dispatchEvent( { type: 'objectRemoved', object: object } ); - object.dispatchEvent( { type: 'removedFromScene', scene: this } ); - - for ( var c = 0; c < object.children.length; c ++ ) { - - this.__removeObject( object.children[ c ] ); - - } - -}; - -THREE.Scene.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.Scene(); - - THREE.Object3D.prototype.clone.call(this, object); - - if ( this.fog !== null ) object.fog = this.fog.clone(); - if ( this.overrideMaterial !== null ) object.overrideMaterial = this.overrideMaterial.clone(); - - object.autoUpdate = this.autoUpdate; - object.matrixAutoUpdate = this.matrixAutoUpdate; - - return object; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Fog = function ( color, near, far ) { - - this.name = ''; - - this.color = new THREE.Color( color ); - - this.near = ( near !== undefined ) ? near : 1; - this.far = ( far !== undefined ) ? far : 1000; - -}; - -THREE.Fog.prototype.clone = function () { - - return new THREE.Fog( this.color.getHex(), this.near, this.far ); - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.FogExp2 = function ( color, density ) { - - this.name = ''; - - this.color = new THREE.Color( color ); - this.density = ( density !== undefined ) ? density : 0.00025; - -}; - -THREE.FogExp2.prototype.clone = function () { - - return new THREE.FogExp2( this.color.getHex(), this.density ); - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.CanvasRenderer = function ( parameters ) { - - console.log( 'THREE.CanvasRenderer', THREE.REVISION ); - - var smoothstep = THREE.Math.smoothstep; - - parameters = parameters || {}; - - var _this = this, - _renderData, _elements, _lights, - _projector = new THREE.Projector(), - - _canvas = parameters.canvas !== undefined - ? parameters.canvas - : document.createElement( 'canvas' ), - - _canvasWidth = _canvas.width, - _canvasHeight = _canvas.height, - _canvasWidthHalf = Math.floor( _canvasWidth / 2 ), - _canvasHeightHalf = Math.floor( _canvasHeight / 2 ), - - _context = _canvas.getContext( '2d', { - alpha: parameters.alpha === true - } ), - - _clearColor = new THREE.Color( 0x000000 ), - _clearAlpha = 0, - - _contextGlobalAlpha = 1, - _contextGlobalCompositeOperation = 0, - _contextStrokeStyle = null, - _contextFillStyle = null, - _contextLineWidth = null, - _contextLineCap = null, - _contextLineJoin = null, - _contextDashSize = null, - _contextGapSize = 0, - - _camera, - - _v1, _v2, _v3, _v4, - _v5 = new THREE.RenderableVertex(), - _v6 = new THREE.RenderableVertex(), - - _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, - _v4x, _v4y, _v5x, _v5y, _v6x, _v6y, - - _color = new THREE.Color(), - _color1 = new THREE.Color(), - _color2 = new THREE.Color(), - _color3 = new THREE.Color(), - _color4 = new THREE.Color(), - - _diffuseColor = new THREE.Color(), - _emissiveColor = new THREE.Color(), - - _lightColor = new THREE.Color(), - - _patterns = {}, - - _near, _far, - - _image, _uvs, - _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, - - _clipBox = new THREE.Box2(), - _clearBox = new THREE.Box2(), - _elemBox = new THREE.Box2(), - - _ambientLight = new THREE.Color(), - _directionalLights = new THREE.Color(), - _pointLights = new THREE.Color(), - - _vector3 = new THREE.Vector3(), // Needed for PointLight - _normal = new THREE.Vector3(), - _normalViewMatrix = new THREE.Matrix3(), - - _pixelMap, _pixelMapContext, _pixelMapImage, _pixelMapData, - _gradientMap, _gradientMapContext, _gradientMapQuality = 16; - - _pixelMap = document.createElement( 'canvas' ); - _pixelMap.width = _pixelMap.height = 2; - - _pixelMapContext = _pixelMap.getContext( '2d' ); - _pixelMapContext.fillStyle = 'rgba(0,0,0,1)'; - _pixelMapContext.fillRect( 0, 0, 2, 2 ); - - _pixelMapImage = _pixelMapContext.getImageData( 0, 0, 2, 2 ); - _pixelMapData = _pixelMapImage.data; - - _gradientMap = document.createElement( 'canvas' ); - _gradientMap.width = _gradientMap.height = _gradientMapQuality; - - _gradientMapContext = _gradientMap.getContext( '2d' ); - _gradientMapContext.translate( - _gradientMapQuality / 2, - _gradientMapQuality / 2 ); - _gradientMapContext.scale( _gradientMapQuality, _gradientMapQuality ); - - _gradientMapQuality --; // Fix UVs - - // dash+gap fallbacks for Firefox and everything else - - if ( _context.setLineDash === undefined ) { - - if ( _context.mozDash !== undefined ) { - - _context.setLineDash = function ( values ) { - - _context.mozDash = values[ 0 ] !== null ? values : null; - - } - - } else { - - _context.setLineDash = function () {} - - } - - } - - this.domElement = _canvas; - - this.devicePixelRatio = parameters.devicePixelRatio !== undefined - ? parameters.devicePixelRatio - : self.devicePixelRatio !== undefined - ? self.devicePixelRatio - : 1; - - this.autoClear = true; - this.sortObjects = true; - this.sortElements = true; - - this.info = { - - render: { - - vertices: 0, - faces: 0 - - } - - } - - // WebGLRenderer compatibility - - this.supportsVertexTextures = function () {}; - this.setFaceCulling = function () {}; - - this.setSize = function ( width, height, updateStyle ) { - - _canvasWidth = width * this.devicePixelRatio; - _canvasHeight = height * this.devicePixelRatio; - - _canvasWidthHalf = Math.floor( _canvasWidth / 2 ); - _canvasHeightHalf = Math.floor( _canvasHeight / 2 ); - - _canvas.width = _canvasWidth; - _canvas.height = _canvasHeight; - - if ( this.devicePixelRatio !== 1 && updateStyle !== false ) { - - _canvas.style.width = width + 'px'; - _canvas.style.height = height + 'px'; - - } - - _clipBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf ), - _clipBox.max.set( _canvasWidthHalf, _canvasHeightHalf ); - - _clearBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf ); - _clearBox.max.set( _canvasWidthHalf, _canvasHeightHalf ); - - _contextGlobalAlpha = 1; - _contextGlobalCompositeOperation = 0; - _contextStrokeStyle = null; - _contextFillStyle = null; - _contextLineWidth = null; - _contextLineCap = null; - _contextLineJoin = null; - - }; - - this.setClearColor = function ( color, alpha ) { - - _clearColor.set( color ); - _clearAlpha = alpha !== undefined ? alpha : 1; - - _clearBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf ); - _clearBox.max.set( _canvasWidthHalf, _canvasHeightHalf ); - - }; - - this.setClearColorHex = function ( hex, alpha ) { - - console.warn( 'DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.' ); - this.setClearColor( hex, alpha ); - - }; - - this.getMaxAnisotropy = function () { - - return 0; - - }; - - this.clear = function () { - - _context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf ); - - if ( _clearBox.empty() === false ) { - - _clearBox.intersect( _clipBox ); - _clearBox.expandByScalar( 2 ); - - if ( _clearAlpha < 1 ) { - - _context.clearRect( - _clearBox.min.x | 0, - _clearBox.min.y | 0, - ( _clearBox.max.x - _clearBox.min.x ) | 0, - ( _clearBox.max.y - _clearBox.min.y ) | 0 - ); - - } - - if ( _clearAlpha > 0 ) { - - setBlending( THREE.NormalBlending ); - setOpacity( 1 ); - - setFillStyle( 'rgba(' + Math.floor( _clearColor.r * 255 ) + ',' + Math.floor( _clearColor.g * 255 ) + ',' + Math.floor( _clearColor.b * 255 ) + ',' + _clearAlpha + ')' ); - - _context.fillRect( - _clearBox.min.x | 0, - _clearBox.min.y | 0, - ( _clearBox.max.x - _clearBox.min.x ) | 0, - ( _clearBox.max.y - _clearBox.min.y ) | 0 - ); - - } - - _clearBox.makeEmpty(); - - } - - }; - - // compatibility - - this.clearColor = function () {}; - this.clearDepth = function () {}; - this.clearStencil = function () {}; - - this.render = function ( scene, camera ) { - - if ( camera instanceof THREE.Camera === false ) { - - console.error( 'THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.' ); - return; - - } - - if ( this.autoClear === true ) this.clear(); - - _context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf ); - - _this.info.render.vertices = 0; - _this.info.render.faces = 0; - - _renderData = _projector.projectScene( scene, camera, this.sortObjects, this.sortElements ); - _elements = _renderData.elements; - _lights = _renderData.lights; - _camera = camera; - - _normalViewMatrix.getNormalMatrix( camera.matrixWorldInverse ); - - /* DEBUG - setFillStyle( 'rgba( 0, 255, 255, 0.5 )' ); - _context.fillRect( _clipBox.min.x, _clipBox.min.y, _clipBox.max.x - _clipBox.min.x, _clipBox.max.y - _clipBox.min.y ); - */ - - calculateLights(); - - for ( var e = 0, el = _elements.length; e < el; e ++ ) { - - var element = _elements[ e ]; - - var material = element.material; - - if ( material === undefined || material.visible === false ) continue; - - _elemBox.makeEmpty(); - - if ( element instanceof THREE.RenderableSprite ) { - - _v1 = element; - _v1.x *= _canvasWidthHalf; _v1.y *= _canvasHeightHalf; - - renderSprite( _v1, element, material ); - - } else if ( element instanceof THREE.RenderableLine ) { - - _v1 = element.v1; _v2 = element.v2; - - _v1.positionScreen.x *= _canvasWidthHalf; _v1.positionScreen.y *= _canvasHeightHalf; - _v2.positionScreen.x *= _canvasWidthHalf; _v2.positionScreen.y *= _canvasHeightHalf; - - _elemBox.setFromPoints( [ - _v1.positionScreen, - _v2.positionScreen - ] ); - - if ( _clipBox.isIntersectionBox( _elemBox ) === true ) { - - renderLine( _v1, _v2, element, material ); - - } - - } else if ( element instanceof THREE.RenderableFace ) { - - _v1 = element.v1; _v2 = element.v2; _v3 = element.v3; - - if ( _v1.positionScreen.z < -1 || _v1.positionScreen.z > 1 ) continue; - if ( _v2.positionScreen.z < -1 || _v2.positionScreen.z > 1 ) continue; - if ( _v3.positionScreen.z < -1 || _v3.positionScreen.z > 1 ) continue; - - _v1.positionScreen.x *= _canvasWidthHalf; _v1.positionScreen.y *= _canvasHeightHalf; - _v2.positionScreen.x *= _canvasWidthHalf; _v2.positionScreen.y *= _canvasHeightHalf; - _v3.positionScreen.x *= _canvasWidthHalf; _v3.positionScreen.y *= _canvasHeightHalf; - - if ( material.overdraw > 0 ) { - - expand( _v1.positionScreen, _v2.positionScreen, material.overdraw ); - expand( _v2.positionScreen, _v3.positionScreen, material.overdraw ); - expand( _v3.positionScreen, _v1.positionScreen, material.overdraw ); - - } - - _elemBox.setFromPoints( [ - _v1.positionScreen, - _v2.positionScreen, - _v3.positionScreen - ] ); - - if ( _clipBox.isIntersectionBox( _elemBox ) === true ) { - - renderFace3( _v1, _v2, _v3, 0, 1, 2, element, material ); - - } - - } - - /* DEBUG - setLineWidth( 1 ); - setStrokeStyle( 'rgba( 0, 255, 0, 0.5 )' ); - _context.strokeRect( _elemBox.min.x, _elemBox.min.y, _elemBox.max.x - _elemBox.min.x, _elemBox.max.y - _elemBox.min.y ); - */ - - _clearBox.union( _elemBox ); - - } - - /* DEBUG - setLineWidth( 1 ); - setStrokeStyle( 'rgba( 255, 0, 0, 0.5 )' ); - _context.strokeRect( _clearBox.min.x, _clearBox.min.y, _clearBox.max.x - _clearBox.min.x, _clearBox.max.y - _clearBox.min.y ); - */ - - _context.setTransform( 1, 0, 0, 1, 0, 0 ); - - }; - - // - - function calculateLights() { - - _ambientLight.setRGB( 0, 0, 0 ); - _directionalLights.setRGB( 0, 0, 0 ); - _pointLights.setRGB( 0, 0, 0 ); - - for ( var l = 0, ll = _lights.length; l < ll; l ++ ) { - - var light = _lights[ l ]; - var lightColor = light.color; - - if ( light instanceof THREE.AmbientLight ) { - - _ambientLight.add( lightColor ); - - } else if ( light instanceof THREE.DirectionalLight ) { - - // for sprites - - _directionalLights.add( lightColor ); - - } else if ( light instanceof THREE.PointLight ) { - - // for sprites - - _pointLights.add( lightColor ); - - } - - } - - } - - function calculateLight( position, normal, color ) { - - for ( var l = 0, ll = _lights.length; l < ll; l ++ ) { - - var light = _lights[ l ]; - - _lightColor.copy( light.color ); - - if ( light instanceof THREE.DirectionalLight ) { - - var lightPosition = _vector3.setFromMatrixPosition( light.matrixWorld ).normalize(); - - var amount = normal.dot( lightPosition ); - - if ( amount <= 0 ) continue; - - amount *= light.intensity; - - color.add( _lightColor.multiplyScalar( amount ) ); - - } else if ( light instanceof THREE.PointLight ) { - - var lightPosition = _vector3.setFromMatrixPosition( light.matrixWorld ); - - var amount = normal.dot( _vector3.subVectors( lightPosition, position ).normalize() ); - - if ( amount <= 0 ) continue; - - amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 ); - - if ( amount == 0 ) continue; - - amount *= light.intensity; - - color.add( _lightColor.multiplyScalar( amount ) ); - - } - - } - - } - - function renderSprite( v1, element, material ) { - - setOpacity( material.opacity ); - setBlending( material.blending ); - - var scaleX = element.scale.x * _canvasWidthHalf; - var scaleY = element.scale.y * _canvasHeightHalf; - - var dist = 0.5 * Math.sqrt( scaleX * scaleX + scaleY * scaleY ); // allow for rotated sprite - _elemBox.min.set( v1.x - dist, v1.y - dist ); - _elemBox.max.set( v1.x + dist, v1.y + dist ); - - if ( material instanceof THREE.SpriteMaterial || - material instanceof THREE.ParticleSystemMaterial ) { // Backwards compatibility - - var texture = material.map; - - if ( texture !== null ) { - - if ( texture.hasEventListener( 'update', onTextureUpdate ) === false ) { - - if ( texture.image !== undefined && texture.image.width > 0 ) { - - textureToPattern( texture ); - - } - - texture.addEventListener( 'update', onTextureUpdate ); - - } - - var pattern = _patterns[ texture.id ]; - - if ( pattern !== undefined ) { - - setFillStyle( pattern ); - - } else { - - setFillStyle( 'rgba( 0, 0, 0, 1 )' ); - - } - - // - - var bitmap = texture.image; - - var ox = bitmap.width * texture.offset.x; - var oy = bitmap.height * texture.offset.y; - - var sx = bitmap.width * texture.repeat.x; - var sy = bitmap.height * texture.repeat.y; - - var cx = scaleX / sx; - var cy = scaleY / sy; - - _context.save(); - _context.translate( v1.x, v1.y ); - if ( material.rotation !== 0 ) _context.rotate( material.rotation ); - _context.translate( - scaleX / 2, - scaleY / 2 ); - _context.scale( cx, cy ); - _context.translate( - ox, - oy ); - _context.fillRect( ox, oy, sx, sy ); - _context.restore(); - - } else { // no texture - - setFillStyle( material.color.getStyle() ); - - _context.save(); - _context.translate( v1.x, v1.y ); - if ( material.rotation !== 0 ) _context.rotate( material.rotation ); - _context.scale( scaleX, - scaleY ); - _context.fillRect( - 0.5, - 0.5, 1, 1 ); - _context.restore(); - - } - - } else if ( material instanceof THREE.SpriteCanvasMaterial ) { - - setStrokeStyle( material.color.getStyle() ); - setFillStyle( material.color.getStyle() ); - - _context.save(); - _context.translate( v1.x, v1.y ); - if ( material.rotation !== 0 ) _context.rotate( material.rotation ); - _context.scale( scaleX, scaleY ); - - material.program( _context ); - - _context.restore(); - - } - - /* DEBUG - setStrokeStyle( 'rgb(255,255,0)' ); - _context.beginPath(); - _context.moveTo( v1.x - 10, v1.y ); - _context.lineTo( v1.x + 10, v1.y ); - _context.moveTo( v1.x, v1.y - 10 ); - _context.lineTo( v1.x, v1.y + 10 ); - _context.stroke(); - */ - - } - - function renderLine( v1, v2, element, material ) { - - setOpacity( material.opacity ); - setBlending( material.blending ); - - _context.beginPath(); - _context.moveTo( v1.positionScreen.x, v1.positionScreen.y ); - _context.lineTo( v2.positionScreen.x, v2.positionScreen.y ); - - if ( material instanceof THREE.LineBasicMaterial ) { - - setLineWidth( material.linewidth ); - setLineCap( material.linecap ); - setLineJoin( material.linejoin ); - - if ( material.vertexColors !== THREE.VertexColors ) { - - setStrokeStyle( material.color.getStyle() ); - - } else { - - var colorStyle1 = element.vertexColors[0].getStyle(); - var colorStyle2 = element.vertexColors[1].getStyle(); - - if ( colorStyle1 === colorStyle2 ) { - - setStrokeStyle( colorStyle1 ); - - } else { - - try { - - var grad = _context.createLinearGradient( - v1.positionScreen.x, - v1.positionScreen.y, - v2.positionScreen.x, - v2.positionScreen.y - ); - grad.addColorStop( 0, colorStyle1 ); - grad.addColorStop( 1, colorStyle2 ); - - } catch ( exception ) { - - grad = colorStyle1; - - } - - setStrokeStyle( grad ); - - } - - } - - _context.stroke(); - _elemBox.expandByScalar( material.linewidth * 2 ); - - } else if ( material instanceof THREE.LineDashedMaterial ) { - - setLineWidth( material.linewidth ); - setLineCap( material.linecap ); - setLineJoin( material.linejoin ); - setStrokeStyle( material.color.getStyle() ); - setDashAndGap( material.dashSize, material.gapSize ); - - _context.stroke(); - - _elemBox.expandByScalar( material.linewidth * 2 ); - - setDashAndGap( null, null ); - - } - - } - - function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) { - - _this.info.render.vertices += 3; - _this.info.render.faces ++; - - setOpacity( material.opacity ); - setBlending( material.blending ); - - _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y; - _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y; - _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y; - - drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y ); - - if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) { - - _diffuseColor.copy( material.color ); - _emissiveColor.copy( material.emissive ); - - if ( material.vertexColors === THREE.FaceColors ) { - - _diffuseColor.multiply( element.color ); - - } - - if ( material.wireframe === false && material.shading === THREE.SmoothShading && element.vertexNormalsLength === 3 ) { - - _color1.copy( _ambientLight ); - _color2.copy( _ambientLight ); - _color3.copy( _ambientLight ); - - calculateLight( element.v1.positionWorld, element.vertexNormalsModel[ 0 ], _color1 ); - calculateLight( element.v2.positionWorld, element.vertexNormalsModel[ 1 ], _color2 ); - calculateLight( element.v3.positionWorld, element.vertexNormalsModel[ 2 ], _color3 ); - - _color1.multiply( _diffuseColor ).add( _emissiveColor ); - _color2.multiply( _diffuseColor ).add( _emissiveColor ); - _color3.multiply( _diffuseColor ).add( _emissiveColor ); - _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); - - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); - - clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); - - } else { - - _color.copy( _ambientLight ); - - calculateLight( element.centroidModel, element.normalModel, _color ); - - _color.multiply( _diffuseColor ).add( _emissiveColor ); - - material.wireframe === true - ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) - : fillPath( _color ); - - } - - } else if ( material instanceof THREE.MeshBasicMaterial || material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) { - - if ( material.map !== null ) { - - if ( material.map.mapping instanceof THREE.UVMapping ) { - - _uvs = element.uvs[ 0 ]; - patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uvs[ uv1 ].x, _uvs[ uv1 ].y, _uvs[ uv2 ].x, _uvs[ uv2 ].y, _uvs[ uv3 ].x, _uvs[ uv3 ].y, material.map ); - - } - - - } else if ( material.envMap !== null ) { - - if ( material.envMap.mapping instanceof THREE.SphericalReflectionMapping ) { - - _normal.copy( element.vertexNormalsModel[ uv1 ] ).applyMatrix3( _normalViewMatrix ); - _uv1x = 0.5 * _normal.x + 0.5; - _uv1y = 0.5 * _normal.y + 0.5; - - _normal.copy( element.vertexNormalsModel[ uv2 ] ).applyMatrix3( _normalViewMatrix ); - _uv2x = 0.5 * _normal.x + 0.5; - _uv2y = 0.5 * _normal.y + 0.5; - - _normal.copy( element.vertexNormalsModel[ uv3 ] ).applyMatrix3( _normalViewMatrix ); - _uv3x = 0.5 * _normal.x + 0.5; - _uv3y = 0.5 * _normal.y + 0.5; - - patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap ); - - }/* else if ( material.envMap.mapping === THREE.SphericalRefractionMapping ) { - - - - }*/ - - - } else { - - _color.copy( material.color ); - - if ( material.vertexColors === THREE.FaceColors ) { - - _color.multiply( element.color ); - - } - - material.wireframe === true - ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) - : fillPath( _color ); - - } - - } else if ( material instanceof THREE.MeshDepthMaterial ) { - - _near = _camera.near; - _far = _camera.far; - - _color1.r = _color1.g = _color1.b = 1 - smoothstep( v1.positionScreen.z * v1.positionScreen.w, _near, _far ); - _color2.r = _color2.g = _color2.b = 1 - smoothstep( v2.positionScreen.z * v2.positionScreen.w, _near, _far ); - _color3.r = _color3.g = _color3.b = 1 - smoothstep( v3.positionScreen.z * v3.positionScreen.w, _near, _far ); - _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); - - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); - - clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); - - } else if ( material instanceof THREE.MeshNormalMaterial ) { - - if ( material.shading === THREE.FlatShading ) { - - _normal.copy( element.normalModel ).applyMatrix3( _normalViewMatrix ); - - _color.setRGB( _normal.x, _normal.y, _normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - - material.wireframe === true - ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) - : fillPath( _color ); - - } else if ( material.shading === THREE.SmoothShading ) { - - _normal.copy( element.vertexNormalsModel[ uv1 ] ).applyMatrix3( _normalViewMatrix ); - _color1.setRGB( _normal.x, _normal.y, _normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - - _normal.copy( element.vertexNormalsModel[ uv2 ] ).applyMatrix3( _normalViewMatrix ); - _color2.setRGB( _normal.x, _normal.y, _normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - - _normal.copy( element.vertexNormalsModel[ uv3 ] ).applyMatrix3( _normalViewMatrix ); - _color3.setRGB( _normal.x, _normal.y, _normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - - _color4.addColors( _color2, _color3 ).multiplyScalar( 0.5 ); - - _image = getGradientTexture( _color1, _color2, _color3, _color4 ); - - clipImage( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, 0, 0, 1, 0, 0, 1, _image ); - - } - - } - - } - - // - - function drawTriangle( x0, y0, x1, y1, x2, y2 ) { - - _context.beginPath(); - _context.moveTo( x0, y0 ); - _context.lineTo( x1, y1 ); - _context.lineTo( x2, y2 ); - _context.closePath(); - - } - - function strokePath( color, linewidth, linecap, linejoin ) { - - setLineWidth( linewidth ); - setLineCap( linecap ); - setLineJoin( linejoin ); - setStrokeStyle( color.getStyle() ); - - _context.stroke(); - - _elemBox.expandByScalar( linewidth * 2 ); - - } - - function fillPath( color ) { - - setFillStyle( color.getStyle() ); - _context.fill(); - - } - - function onTextureUpdate ( event ) { - - textureToPattern( event.target ); - - } - - function textureToPattern( texture ) { - - var repeatX = texture.wrapS === THREE.RepeatWrapping; - var repeatY = texture.wrapT === THREE.RepeatWrapping; - - var image = texture.image; - - var canvas = document.createElement( 'canvas' ); - canvas.width = image.width; - canvas.height = image.height; - - var context = canvas.getContext( '2d' ); - context.setTransform( 1, 0, 0, - 1, 0, image.height ); - context.drawImage( image, 0, 0 ); - - _patterns[ texture.id ] = _context.createPattern( - canvas, repeatX === true && repeatY === true - ? 'repeat' - : repeatX === true && repeatY === false - ? 'repeat-x' - : repeatX === false && repeatY === true - ? 'repeat-y' - : 'no-repeat' - ); - - } - - function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { - - if ( texture instanceof THREE.DataTexture ) return; - - if ( texture.hasEventListener( 'update', onTextureUpdate ) === false ) { - - if ( texture.image !== undefined && texture.image.width > 0 ) { - - textureToPattern( texture ); - - } - - texture.addEventListener( 'update', onTextureUpdate ); - - } - - var pattern = _patterns[ texture.id ]; - - if ( pattern !== undefined ) { - - setFillStyle( pattern ); - - } else { - - setFillStyle( 'rgba(0,0,0,1)' ); - _context.fill(); - - return; - - } - - // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 - - var a, b, c, d, e, f, det, idet, - offsetX = texture.offset.x / texture.repeat.x, - offsetY = texture.offset.y / texture.repeat.y, - width = texture.image.width * texture.repeat.x, - height = texture.image.height * texture.repeat.y; - - u0 = ( u0 + offsetX ) * width; - v0 = ( v0 + offsetY ) * height; - - u1 = ( u1 + offsetX ) * width; - v1 = ( v1 + offsetY ) * height; - - u2 = ( u2 + offsetX ) * width; - v2 = ( v2 + offsetY ) * height; - - x1 -= x0; y1 -= y0; - x2 -= x0; y2 -= y0; - - u1 -= u0; v1 -= v0; - u2 -= u0; v2 -= v0; - - det = u1 * v2 - u2 * v1; - - if ( det === 0 ) return; - - idet = 1 / det; - - a = ( v2 * x1 - v1 * x2 ) * idet; - b = ( v2 * y1 - v1 * y2 ) * idet; - c = ( u1 * x2 - u2 * x1 ) * idet; - d = ( u1 * y2 - u2 * y1 ) * idet; - - e = x0 - a * u0 - c * v0; - f = y0 - b * u0 - d * v0; - - _context.save(); - _context.transform( a, b, c, d, e, f ); - _context.fill(); - _context.restore(); - - } - - function clipImage( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image ) { - - // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 - - var a, b, c, d, e, f, det, idet, - width = image.width - 1, - height = image.height - 1; - - u0 *= width; v0 *= height; - u1 *= width; v1 *= height; - u2 *= width; v2 *= height; - - x1 -= x0; y1 -= y0; - x2 -= x0; y2 -= y0; - - u1 -= u0; v1 -= v0; - u2 -= u0; v2 -= v0; - - det = u1 * v2 - u2 * v1; - - idet = 1 / det; - - a = ( v2 * x1 - v1 * x2 ) * idet; - b = ( v2 * y1 - v1 * y2 ) * idet; - c = ( u1 * x2 - u2 * x1 ) * idet; - d = ( u1 * y2 - u2 * y1 ) * idet; - - e = x0 - a * u0 - c * v0; - f = y0 - b * u0 - d * v0; - - _context.save(); - _context.transform( a, b, c, d, e, f ); - _context.clip(); - _context.drawImage( image, 0, 0 ); - _context.restore(); - - } - - function getGradientTexture( color1, color2, color3, color4 ) { - - // http://mrdoob.com/blog/post/710 - - _pixelMapData[ 0 ] = ( color1.r * 255 ) | 0; - _pixelMapData[ 1 ] = ( color1.g * 255 ) | 0; - _pixelMapData[ 2 ] = ( color1.b * 255 ) | 0; - - _pixelMapData[ 4 ] = ( color2.r * 255 ) | 0; - _pixelMapData[ 5 ] = ( color2.g * 255 ) | 0; - _pixelMapData[ 6 ] = ( color2.b * 255 ) | 0; - - _pixelMapData[ 8 ] = ( color3.r * 255 ) | 0; - _pixelMapData[ 9 ] = ( color3.g * 255 ) | 0; - _pixelMapData[ 10 ] = ( color3.b * 255 ) | 0; - - _pixelMapData[ 12 ] = ( color4.r * 255 ) | 0; - _pixelMapData[ 13 ] = ( color4.g * 255 ) | 0; - _pixelMapData[ 14 ] = ( color4.b * 255 ) | 0; - - _pixelMapContext.putImageData( _pixelMapImage, 0, 0 ); - _gradientMapContext.drawImage( _pixelMap, 0, 0 ); - - return _gradientMap; - - } - - // Hide anti-alias gaps - - function expand( v1, v2, pixels ) { - - var x = v2.x - v1.x, y = v2.y - v1.y, - det = x * x + y * y, idet; - - if ( det === 0 ) return; - - idet = pixels / Math.sqrt( det ); - - x *= idet; y *= idet; - - v2.x += x; v2.y += y; - v1.x -= x; v1.y -= y; - - } - - // Context cached methods. - - function setOpacity( value ) { - - if ( _contextGlobalAlpha !== value ) { - - _context.globalAlpha = value; - _contextGlobalAlpha = value; - - } - - } - - function setBlending( value ) { - - if ( _contextGlobalCompositeOperation !== value ) { - - if ( value === THREE.NormalBlending ) { - - _context.globalCompositeOperation = 'source-over'; - - } else if ( value === THREE.AdditiveBlending ) { - - _context.globalCompositeOperation = 'lighter'; - - } else if ( value === THREE.SubtractiveBlending ) { - - _context.globalCompositeOperation = 'darker'; - - } - - _contextGlobalCompositeOperation = value; - - } - - } - - function setLineWidth( value ) { - - if ( _contextLineWidth !== value ) { - - _context.lineWidth = value; - _contextLineWidth = value; - - } - - } - - function setLineCap( value ) { - - // "butt", "round", "square" - - if ( _contextLineCap !== value ) { - - _context.lineCap = value; - _contextLineCap = value; - - } - - } - - function setLineJoin( value ) { - - // "round", "bevel", "miter" - - if ( _contextLineJoin !== value ) { - - _context.lineJoin = value; - _contextLineJoin = value; - - } - - } - - function setStrokeStyle( value ) { - - if ( _contextStrokeStyle !== value ) { - - _context.strokeStyle = value; - _contextStrokeStyle = value; - - } - - } - - function setFillStyle( value ) { - - if ( _contextFillStyle !== value ) { - - _context.fillStyle = value; - _contextFillStyle = value; - - } - - } - - function setDashAndGap( dashSizeValue, gapSizeValue ) { - - if ( _contextDashSize !== dashSizeValue || _contextGapSize !== gapSizeValue ) { - - _context.setLineDash( [ dashSizeValue, gapSizeValue ] ); - _contextDashSize = dashSizeValue; - _contextGapSize = gapSizeValue; - - } - - } - -}; - -/** - * Shader chunks for WebLG Shader library - * - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - */ - -THREE.ShaderChunk = { - - // FOG - - fog_pars_fragment: [ - - "#ifdef USE_FOG", - - "uniform vec3 fogColor;", - - "#ifdef FOG_EXP2", - - "uniform float fogDensity;", - - "#else", - - "uniform float fogNear;", - "uniform float fogFar;", - - "#endif", - - "#endif" - - ].join("\n"), - - fog_fragment: [ - - "#ifdef USE_FOG", - - "float depth = gl_FragCoord.z / gl_FragCoord.w;", - - "#ifdef FOG_EXP2", - - "const float LOG2 = 1.442695;", - "float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );", - "fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );", - - "#else", - - "float fogFactor = smoothstep( fogNear, fogFar, depth );", - - "#endif", - - "gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );", - - "#endif" - - ].join("\n"), - - // ENVIRONMENT MAP - - envmap_pars_fragment: [ - - "#ifdef USE_ENVMAP", - - "uniform float reflectivity;", - "uniform samplerCube envMap;", - "uniform float flipEnvMap;", - "uniform int combine;", - - "#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )", - - "uniform bool useRefract;", - "uniform float refractionRatio;", - - "#else", - - "varying vec3 vReflect;", - - "#endif", - - "#endif" - - ].join("\n"), - - envmap_fragment: [ - - "#ifdef USE_ENVMAP", - - "vec3 reflectVec;", - - "#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )", - - "vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );", - - "if ( useRefract ) {", - - "reflectVec = refract( cameraToVertex, normal, refractionRatio );", - - "} else { ", - - "reflectVec = reflect( cameraToVertex, normal );", - - "}", - - "#else", - - "reflectVec = vReflect;", - - "#endif", - - "#ifdef DOUBLE_SIDED", - - "float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );", - "vec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );", - - "#else", - - "vec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );", - - "#endif", - - "#ifdef GAMMA_INPUT", - - "cubeColor.xyz *= cubeColor.xyz;", - - "#endif", - - "if ( combine == 1 ) {", - - "gl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );", - - "} else if ( combine == 2 ) {", - - "gl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;", - - "} else {", - - "gl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );", - - "}", - - "#endif" - - ].join("\n"), - - envmap_pars_vertex: [ - - "#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )", - - "varying vec3 vReflect;", - - "uniform float refractionRatio;", - "uniform bool useRefract;", - - "#endif" - - ].join("\n"), - - worldpos_vertex : [ - - "#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )", - - "#ifdef USE_SKINNING", - - "vec4 worldPosition = modelMatrix * skinned;", - - "#endif", - - "#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )", - - "vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );", - - "#endif", - - "#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )", - - "vec4 worldPosition = modelMatrix * vec4( position, 1.0 );", - - "#endif", - - "#endif" - - ].join("\n"), - - envmap_vertex : [ - - "#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )", - - "vec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;", - "worldNormal = normalize( worldNormal );", - - "vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );", - - "if ( useRefract ) {", - - "vReflect = refract( cameraToVertex, worldNormal, refractionRatio );", - - "} else {", - - "vReflect = reflect( cameraToVertex, worldNormal );", - - "}", - - "#endif" - - ].join("\n"), - - // COLOR MAP (particles) - - map_particle_pars_fragment: [ - - "#ifdef USE_MAP", - - "uniform sampler2D map;", - - "#endif" - - ].join("\n"), - - - map_particle_fragment: [ - - "#ifdef USE_MAP", - - "gl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );", - - "#endif" - - ].join("\n"), - - // COLOR MAP (triangles) - - map_pars_vertex: [ - - "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )", - - "varying vec2 vUv;", - "uniform vec4 offsetRepeat;", - - "#endif" - - ].join("\n"), - - map_pars_fragment: [ - - "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )", - - "varying vec2 vUv;", - - "#endif", - - "#ifdef USE_MAP", - - "uniform sampler2D map;", - - "#endif" - - ].join("\n"), - - map_vertex: [ - - "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )", - - "vUv = uv * offsetRepeat.zw + offsetRepeat.xy;", - - "#endif" - - ].join("\n"), - - map_fragment: [ - - "#ifdef USE_MAP", - - "vec4 texelColor = texture2D( map, vUv );", - - "#ifdef GAMMA_INPUT", - - "texelColor.xyz *= texelColor.xyz;", - - "#endif", - - "gl_FragColor = gl_FragColor * texelColor;", - - "#endif" - - ].join("\n"), - - // LIGHT MAP - - lightmap_pars_fragment: [ - - "#ifdef USE_LIGHTMAP", - - "varying vec2 vUv2;", - "uniform sampler2D lightMap;", - - "#endif" - - ].join("\n"), - - lightmap_pars_vertex: [ - - "#ifdef USE_LIGHTMAP", - - "varying vec2 vUv2;", - - "#endif" - - ].join("\n"), - - lightmap_fragment: [ - - "#ifdef USE_LIGHTMAP", - - "gl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );", - - "#endif" - - ].join("\n"), - - lightmap_vertex: [ - - "#ifdef USE_LIGHTMAP", - - "vUv2 = uv2;", - - "#endif" - - ].join("\n"), - - // BUMP MAP - - bumpmap_pars_fragment: [ - - "#ifdef USE_BUMPMAP", - - "uniform sampler2D bumpMap;", - "uniform float bumpScale;", - - // Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen - // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html - - // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2) - - "vec2 dHdxy_fwd() {", - - "vec2 dSTdx = dFdx( vUv );", - "vec2 dSTdy = dFdy( vUv );", - - "float Hll = bumpScale * texture2D( bumpMap, vUv ).x;", - "float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;", - "float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;", - - "return vec2( dBx, dBy );", - - "}", - - "vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {", - - "vec3 vSigmaX = dFdx( surf_pos );", - "vec3 vSigmaY = dFdy( surf_pos );", - "vec3 vN = surf_norm;", // normalized - - "vec3 R1 = cross( vSigmaY, vN );", - "vec3 R2 = cross( vN, vSigmaX );", - - "float fDet = dot( vSigmaX, R1 );", - - "vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );", - "return normalize( abs( fDet ) * surf_norm - vGrad );", - - "}", - - "#endif" - - ].join("\n"), - - // NORMAL MAP - - normalmap_pars_fragment: [ - - "#ifdef USE_NORMALMAP", - - "uniform sampler2D normalMap;", - "uniform vec2 normalScale;", - - // Per-Pixel Tangent Space Normal Mapping - // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html - - "vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {", - - "vec3 q0 = dFdx( eye_pos.xyz );", - "vec3 q1 = dFdy( eye_pos.xyz );", - "vec2 st0 = dFdx( vUv.st );", - "vec2 st1 = dFdy( vUv.st );", - - "vec3 S = normalize( q0 * st1.t - q1 * st0.t );", - "vec3 T = normalize( -q0 * st1.s + q1 * st0.s );", - "vec3 N = normalize( surf_norm );", - - "vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;", - "mapN.xy = normalScale * mapN.xy;", - "mat3 tsn = mat3( S, T, N );", - "return normalize( tsn * mapN );", - - "}", - - "#endif" - - ].join("\n"), - - // SPECULAR MAP - - specularmap_pars_fragment: [ - - "#ifdef USE_SPECULARMAP", - - "uniform sampler2D specularMap;", - - "#endif" - - ].join("\n"), - - specularmap_fragment: [ - - "float specularStrength;", - - "#ifdef USE_SPECULARMAP", - - "vec4 texelSpecular = texture2D( specularMap, vUv );", - "specularStrength = texelSpecular.r;", - - "#else", - - "specularStrength = 1.0;", - - "#endif" - - ].join("\n"), - - // LIGHTS LAMBERT - - lights_lambert_pars_vertex: [ - - "uniform vec3 ambient;", - "uniform vec3 diffuse;", - "uniform vec3 emissive;", - - "uniform vec3 ambientLightColor;", - - "#if MAX_DIR_LIGHTS > 0", - - "uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];", - "uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];", - - "#endif", - - "#if MAX_HEMI_LIGHTS > 0", - - "uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];", - "uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];", - "uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];", - - "#endif", - - "#if MAX_POINT_LIGHTS > 0", - - "uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];", - "uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];", - "uniform float pointLightDistance[ MAX_POINT_LIGHTS ];", - - "#endif", - - "#if MAX_SPOT_LIGHTS > 0", - - "uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];", - "uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];", - "uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];", - "uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];", - "uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];", - "uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];", - - "#endif", - - "#ifdef WRAP_AROUND", - - "uniform vec3 wrapRGB;", - - "#endif" - - ].join("\n"), - - lights_lambert_vertex: [ - - "vLightFront = vec3( 0.0 );", - - "#ifdef DOUBLE_SIDED", - - "vLightBack = vec3( 0.0 );", - - "#endif", - - "transformedNormal = normalize( transformedNormal );", - - "#if MAX_DIR_LIGHTS > 0", - - "for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {", - - "vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );", - "vec3 dirVector = normalize( lDirection.xyz );", - - "float dotProduct = dot( transformedNormal, dirVector );", - "vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );", - - "#ifdef DOUBLE_SIDED", - - "vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );", - - "#ifdef WRAP_AROUND", - - "vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );", - - "#endif", - - "#endif", - - "#ifdef WRAP_AROUND", - - "vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );", - "directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );", - - "#ifdef DOUBLE_SIDED", - - "directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );", - - "#endif", - - "#endif", - - "vLightFront += directionalLightColor[ i ] * directionalLightWeighting;", - - "#ifdef DOUBLE_SIDED", - - "vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;", - - "#endif", - - "}", - - "#endif", - - "#if MAX_POINT_LIGHTS > 0", - - "for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {", - - "vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );", - "vec3 lVector = lPosition.xyz - mvPosition.xyz;", - - "float lDistance = 1.0;", - "if ( pointLightDistance[ i ] > 0.0 )", - "lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );", - - "lVector = normalize( lVector );", - "float dotProduct = dot( transformedNormal, lVector );", - - "vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );", - - "#ifdef DOUBLE_SIDED", - - "vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );", - - "#ifdef WRAP_AROUND", - - "vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );", - - "#endif", - - "#endif", - - "#ifdef WRAP_AROUND", - - "vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );", - "pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );", - - "#ifdef DOUBLE_SIDED", - - "pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );", - - "#endif", - - "#endif", - - "vLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;", - - "#ifdef DOUBLE_SIDED", - - "vLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;", - - "#endif", - - "}", - - "#endif", - - "#if MAX_SPOT_LIGHTS > 0", - - "for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {", - - "vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );", - "vec3 lVector = lPosition.xyz - mvPosition.xyz;", - - "float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );", - - "if ( spotEffect > spotLightAngleCos[ i ] ) {", - - "spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );", - - "float lDistance = 1.0;", - "if ( spotLightDistance[ i ] > 0.0 )", - "lDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );", - - "lVector = normalize( lVector );", - - "float dotProduct = dot( transformedNormal, lVector );", - "vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );", - - "#ifdef DOUBLE_SIDED", - - "vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );", - - "#ifdef WRAP_AROUND", - - "vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );", - - "#endif", - - "#endif", - - "#ifdef WRAP_AROUND", - - "vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );", - "spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );", - - "#ifdef DOUBLE_SIDED", - - "spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );", - - "#endif", - - "#endif", - - "vLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;", - - "#ifdef DOUBLE_SIDED", - - "vLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;", - - "#endif", - - "}", - - "}", - - "#endif", - - "#if MAX_HEMI_LIGHTS > 0", - - "for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {", - - "vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );", - "vec3 lVector = normalize( lDirection.xyz );", - - "float dotProduct = dot( transformedNormal, lVector );", - - "float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;", - "float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;", - - "vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );", - - "#ifdef DOUBLE_SIDED", - - "vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );", - - "#endif", - - "}", - - "#endif", - - "vLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;", - - "#ifdef DOUBLE_SIDED", - - "vLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;", - - "#endif" - - ].join("\n"), - - // LIGHTS PHONG - - lights_phong_pars_vertex: [ - - "#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )", - - "varying vec3 vWorldPosition;", - - "#endif" - - ].join("\n"), - - - lights_phong_vertex: [ - - "#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )", - - "vWorldPosition = worldPosition.xyz;", - - "#endif" - - ].join("\n"), - - lights_phong_pars_fragment: [ - - "uniform vec3 ambientLightColor;", - - "#if MAX_DIR_LIGHTS > 0", - - "uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];", - "uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];", - - "#endif", - - "#if MAX_HEMI_LIGHTS > 0", - - "uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];", - "uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];", - "uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];", - - "#endif", - - "#if MAX_POINT_LIGHTS > 0", - - "uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];", - - "uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];", - "uniform float pointLightDistance[ MAX_POINT_LIGHTS ];", - - "#endif", - - "#if MAX_SPOT_LIGHTS > 0", - - "uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];", - "uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];", - "uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];", - "uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];", - "uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];", - - "uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];", - - "#endif", - - "#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )", - - "varying vec3 vWorldPosition;", - - "#endif", - - "#ifdef WRAP_AROUND", - - "uniform vec3 wrapRGB;", - - "#endif", - - "varying vec3 vViewPosition;", - "varying vec3 vNormal;" - - ].join("\n"), - - lights_phong_fragment: [ - - "vec3 normal = normalize( vNormal );", - "vec3 viewPosition = normalize( vViewPosition );", - - "#ifdef DOUBLE_SIDED", - - "normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );", - - "#endif", - - "#ifdef USE_NORMALMAP", - - "normal = perturbNormal2Arb( -vViewPosition, normal );", - - "#elif defined( USE_BUMPMAP )", - - "normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );", - - "#endif", - - "#if MAX_POINT_LIGHTS > 0", - - "vec3 pointDiffuse = vec3( 0.0 );", - "vec3 pointSpecular = vec3( 0.0 );", - - "for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {", - - "vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );", - "vec3 lVector = lPosition.xyz + vViewPosition.xyz;", - - "float lDistance = 1.0;", - "if ( pointLightDistance[ i ] > 0.0 )", - "lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );", - - "lVector = normalize( lVector );", - - // diffuse - - "float dotProduct = dot( normal, lVector );", - - "#ifdef WRAP_AROUND", - - "float pointDiffuseWeightFull = max( dotProduct, 0.0 );", - "float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );", - - "vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );", - - "#else", - - "float pointDiffuseWeight = max( dotProduct, 0.0 );", - - "#endif", - - "pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;", - - // specular - - "vec3 pointHalfVector = normalize( lVector + viewPosition );", - "float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );", - "float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );", - - // 2.0 => 2.0001 is hack to work around ANGLE bug - - "float specularNormalization = ( shininess + 2.0001 ) / 8.0;", - - "vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );", - "pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;", - - "}", - - "#endif", - - "#if MAX_SPOT_LIGHTS > 0", - - "vec3 spotDiffuse = vec3( 0.0 );", - "vec3 spotSpecular = vec3( 0.0 );", - - "for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {", - - "vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );", - "vec3 lVector = lPosition.xyz + vViewPosition.xyz;", - - "float lDistance = 1.0;", - "if ( spotLightDistance[ i ] > 0.0 )", - "lDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );", - - "lVector = normalize( lVector );", - - "float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );", - - "if ( spotEffect > spotLightAngleCos[ i ] ) {", - - "spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );", - - // diffuse - - "float dotProduct = dot( normal, lVector );", - - "#ifdef WRAP_AROUND", - - "float spotDiffuseWeightFull = max( dotProduct, 0.0 );", - "float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );", - - "vec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );", - - "#else", - - "float spotDiffuseWeight = max( dotProduct, 0.0 );", - - "#endif", - - "spotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;", - - // specular - - "vec3 spotHalfVector = normalize( lVector + viewPosition );", - "float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );", - "float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );", - - // 2.0 => 2.0001 is hack to work around ANGLE bug - - "float specularNormalization = ( shininess + 2.0001 ) / 8.0;", - - "vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );", - "spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;", - - "}", - - "}", - - "#endif", - - "#if MAX_DIR_LIGHTS > 0", - - "vec3 dirDiffuse = vec3( 0.0 );", - "vec3 dirSpecular = vec3( 0.0 );" , - - "for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {", - - "vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );", - "vec3 dirVector = normalize( lDirection.xyz );", - - // diffuse - - "float dotProduct = dot( normal, dirVector );", - - "#ifdef WRAP_AROUND", - - "float dirDiffuseWeightFull = max( dotProduct, 0.0 );", - "float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );", - - "vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );", - - "#else", - - "float dirDiffuseWeight = max( dotProduct, 0.0 );", - - "#endif", - - "dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;", - - // specular - - "vec3 dirHalfVector = normalize( dirVector + viewPosition );", - "float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );", - "float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );", - - /* - // fresnel term from skin shader - "const float F0 = 0.128;", - - "float base = 1.0 - dot( viewPosition, dirHalfVector );", - "float exponential = pow( base, 5.0 );", - - "float fresnel = exponential + F0 * ( 1.0 - exponential );", - */ - - /* - // fresnel term from fresnel shader - "const float mFresnelBias = 0.08;", - "const float mFresnelScale = 0.3;", - "const float mFresnelPower = 5.0;", - - "float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );", - */ - - // 2.0 => 2.0001 is hack to work around ANGLE bug - - "float specularNormalization = ( shininess + 2.0001 ) / 8.0;", - - //"dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;", - - "vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );", - "dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;", - - - "}", - - "#endif", - - "#if MAX_HEMI_LIGHTS > 0", - - "vec3 hemiDiffuse = vec3( 0.0 );", - "vec3 hemiSpecular = vec3( 0.0 );" , - - "for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {", - - "vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );", - "vec3 lVector = normalize( lDirection.xyz );", - - // diffuse - - "float dotProduct = dot( normal, lVector );", - "float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;", - - "vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );", - - "hemiDiffuse += diffuse * hemiColor;", - - // specular (sky light) - - "vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );", - "float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;", - "float hemiSpecularWeightSky = specularStrength * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );", - - // specular (ground light) - - "vec3 lVectorGround = -lVector;", - - "vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );", - "float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;", - "float hemiSpecularWeightGround = specularStrength * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );", - - "float dotProductGround = dot( normal, lVectorGround );", - - // 2.0 => 2.0001 is hack to work around ANGLE bug - - "float specularNormalization = ( shininess + 2.0001 ) / 8.0;", - - "vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );", - "vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );", - "hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );", - - "}", - - "#endif", - - "vec3 totalDiffuse = vec3( 0.0 );", - "vec3 totalSpecular = vec3( 0.0 );", - - "#if MAX_DIR_LIGHTS > 0", - - "totalDiffuse += dirDiffuse;", - "totalSpecular += dirSpecular;", - - "#endif", - - "#if MAX_HEMI_LIGHTS > 0", - - "totalDiffuse += hemiDiffuse;", - "totalSpecular += hemiSpecular;", - - "#endif", - - "#if MAX_POINT_LIGHTS > 0", - - "totalDiffuse += pointDiffuse;", - "totalSpecular += pointSpecular;", - - "#endif", - - "#if MAX_SPOT_LIGHTS > 0", - - "totalDiffuse += spotDiffuse;", - "totalSpecular += spotSpecular;", - - "#endif", - - "#ifdef METAL", - - "gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );", - - "#else", - - "gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;", - - "#endif" - - ].join("\n"), - - // VERTEX COLORS - - color_pars_fragment: [ - - "#ifdef USE_COLOR", - - "varying vec3 vColor;", - - "#endif" - - ].join("\n"), - - - color_fragment: [ - - "#ifdef USE_COLOR", - - "gl_FragColor = gl_FragColor * vec4( vColor, 1.0 );", - - "#endif" - - ].join("\n"), - - color_pars_vertex: [ - - "#ifdef USE_COLOR", - - "varying vec3 vColor;", - - "#endif" - - ].join("\n"), - - - color_vertex: [ - - "#ifdef USE_COLOR", - - "#ifdef GAMMA_INPUT", - - "vColor = color * color;", - - "#else", - - "vColor = color;", - - "#endif", - - "#endif" - - ].join("\n"), - - // SKINNING - - skinning_pars_vertex: [ - - "#ifdef USE_SKINNING", - - "#ifdef BONE_TEXTURE", - - "uniform sampler2D boneTexture;", - "uniform int boneTextureWidth;", - "uniform int boneTextureHeight;", - - "mat4 getBoneMatrix( const in float i ) {", - - "float j = i * 4.0;", - "float x = mod( j, float( boneTextureWidth ) );", - "float y = floor( j / float( boneTextureWidth ) );", - - "float dx = 1.0 / float( boneTextureWidth );", - "float dy = 1.0 / float( boneTextureHeight );", - - "y = dy * ( y + 0.5 );", - - "vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );", - "vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );", - "vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );", - "vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );", - - "mat4 bone = mat4( v1, v2, v3, v4 );", - - "return bone;", - - "}", - - "#else", - - "uniform mat4 boneGlobalMatrices[ MAX_BONES ];", - - "mat4 getBoneMatrix( const in float i ) {", - - "mat4 bone = boneGlobalMatrices[ int(i) ];", - "return bone;", - - "}", - - "#endif", - - "#endif" - - ].join("\n"), - - skinbase_vertex: [ - - "#ifdef USE_SKINNING", - - "mat4 boneMatX = getBoneMatrix( skinIndex.x );", - "mat4 boneMatY = getBoneMatrix( skinIndex.y );", - "mat4 boneMatZ = getBoneMatrix( skinIndex.z );", - "mat4 boneMatW = getBoneMatrix( skinIndex.w );", - - "#endif" - - ].join("\n"), - - skinning_vertex: [ - - "#ifdef USE_SKINNING", - - "#ifdef USE_MORPHTARGETS", - - "vec4 skinVertex = vec4( morphed, 1.0 );", - - "#else", - - "vec4 skinVertex = vec4( position, 1.0 );", - - "#endif", - - "vec4 skinned = boneMatX * skinVertex * skinWeight.x;", - "skinned += boneMatY * skinVertex * skinWeight.y;", - "skinned += boneMatZ * skinVertex * skinWeight.z;", - "skinned += boneMatW * skinVertex * skinWeight.w;", - - "#endif" - - ].join("\n"), - - // MORPHING - - morphtarget_pars_vertex: [ - - "#ifdef USE_MORPHTARGETS", - - "#ifndef USE_MORPHNORMALS", - - "uniform float morphTargetInfluences[ 8 ];", - - "#else", - - "uniform float morphTargetInfluences[ 4 ];", - - "#endif", - - "#endif" - - ].join("\n"), - - morphtarget_vertex: [ - - "#ifdef USE_MORPHTARGETS", - - "vec3 morphed = vec3( 0.0 );", - "morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];", - "morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];", - "morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];", - "morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];", - - "#ifndef USE_MORPHNORMALS", - - "morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];", - "morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];", - "morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];", - "morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];", - - "#endif", - - "morphed += position;", - - "#endif" - - ].join("\n"), - - default_vertex : [ - - "vec4 mvPosition;", - - "#ifdef USE_SKINNING", - - "mvPosition = modelViewMatrix * skinned;", - - "#endif", - - "#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )", - - "mvPosition = modelViewMatrix * vec4( morphed, 1.0 );", - - "#endif", - - "#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )", - - "mvPosition = modelViewMatrix * vec4( position, 1.0 );", - - "#endif", - - "gl_Position = projectionMatrix * mvPosition;" - - ].join("\n"), - - morphnormal_vertex: [ - - "#ifdef USE_MORPHNORMALS", - - "vec3 morphedNormal = vec3( 0.0 );", - - "morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];", - "morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];", - "morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];", - "morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];", - - "morphedNormal += normal;", - - "#endif" - - ].join("\n"), - - skinnormal_vertex: [ - - "#ifdef USE_SKINNING", - - "mat4 skinMatrix = skinWeight.x * boneMatX;", - "skinMatrix += skinWeight.y * boneMatY;", - - "#ifdef USE_MORPHNORMALS", - - "vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );", - - "#else", - - "vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );", - - "#endif", - - "#endif" - - ].join("\n"), - - defaultnormal_vertex: [ - - "vec3 objectNormal;", - - "#ifdef USE_SKINNING", - - "objectNormal = skinnedNormal.xyz;", - - "#endif", - - "#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )", - - "objectNormal = morphedNormal;", - - "#endif", - - "#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )", - - "objectNormal = normal;", - - "#endif", - - "#ifdef FLIP_SIDED", - - "objectNormal = -objectNormal;", - - "#endif", - - "vec3 transformedNormal = normalMatrix * objectNormal;" - - ].join("\n"), - - // SHADOW MAP - - // based on SpiderGL shadow map and Fabien Sanglard's GLSL shadow mapping examples - // http://spidergl.org/example.php?id=6 - // http://fabiensanglard.net/shadowmapping - - shadowmap_pars_fragment: [ - - "#ifdef USE_SHADOWMAP", - - "uniform sampler2D shadowMap[ MAX_SHADOWS ];", - "uniform vec2 shadowMapSize[ MAX_SHADOWS ];", - - "uniform float shadowDarkness[ MAX_SHADOWS ];", - "uniform float shadowBias[ MAX_SHADOWS ];", - - "varying vec4 vShadowCoord[ MAX_SHADOWS ];", - - "float unpackDepth( const in vec4 rgba_depth ) {", - - "const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );", - "float depth = dot( rgba_depth, bit_shift );", - "return depth;", - - "}", - - "#endif" - - ].join("\n"), - - shadowmap_fragment: [ - - "#ifdef USE_SHADOWMAP", - - "#ifdef SHADOWMAP_DEBUG", - - "vec3 frustumColors[3];", - "frustumColors[0] = vec3( 1.0, 0.5, 0.0 );", - "frustumColors[1] = vec3( 0.0, 1.0, 0.8 );", - "frustumColors[2] = vec3( 0.0, 0.5, 1.0 );", - - "#endif", - - "#ifdef SHADOWMAP_CASCADE", - - "int inFrustumCount = 0;", - - "#endif", - - "float fDepth;", - "vec3 shadowColor = vec3( 1.0 );", - - "for( int i = 0; i < MAX_SHADOWS; i ++ ) {", - - "vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;", - - // "if ( something && something )" breaks ATI OpenGL shader compiler - // "if ( all( something, something ) )" using this instead - - "bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );", - "bool inFrustum = all( inFrustumVec );", - - // don't shadow pixels outside of light frustum - // use just first frustum (for cascades) - // don't shadow pixels behind far plane of light frustum - - "#ifdef SHADOWMAP_CASCADE", - - "inFrustumCount += int( inFrustum );", - "bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );", - - "#else", - - "bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );", - - "#endif", - - "bool frustumTest = all( frustumTestVec );", - - "if ( frustumTest ) {", - - "shadowCoord.z += shadowBias[ i ];", - - "#if defined( SHADOWMAP_TYPE_PCF )", - - // Percentage-close filtering - // (9 pixel kernel) - // http://fabiensanglard.net/shadowmappingPCF/ - - "float shadow = 0.0;", - - /* - // nested loops breaks shader compiler / validator on some ATI cards when using OpenGL - // must enroll loop manually - - "for ( float y = -1.25; y <= 1.25; y += 1.25 )", - "for ( float x = -1.25; x <= 1.25; x += 1.25 ) {", - - "vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );", - - // doesn't seem to produce any noticeable visual difference compared to simple "texture2D" lookup - //"vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );", - - "float fDepth = unpackDepth( rgbaDepth );", - - "if ( fDepth < shadowCoord.z )", - "shadow += 1.0;", - - "}", - - "shadow /= 9.0;", - - */ - - "const float shadowDelta = 1.0 / 9.0;", - - "float xPixelOffset = 1.0 / shadowMapSize[ i ].x;", - "float yPixelOffset = 1.0 / shadowMapSize[ i ].y;", - - "float dx0 = -1.25 * xPixelOffset;", - "float dy0 = -1.25 * yPixelOffset;", - "float dx1 = 1.25 * xPixelOffset;", - "float dy1 = 1.25 * yPixelOffset;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );", - "if ( fDepth < shadowCoord.z ) shadow += shadowDelta;", - - "shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );", - - "#elif defined( SHADOWMAP_TYPE_PCF_SOFT )", - - // Percentage-close filtering - // (9 pixel kernel) - // http://fabiensanglard.net/shadowmappingPCF/ - - "float shadow = 0.0;", - - "float xPixelOffset = 1.0 / shadowMapSize[ i ].x;", - "float yPixelOffset = 1.0 / shadowMapSize[ i ].y;", - - "float dx0 = -1.0 * xPixelOffset;", - "float dy0 = -1.0 * yPixelOffset;", - "float dx1 = 1.0 * xPixelOffset;", - "float dy1 = 1.0 * yPixelOffset;", - - "mat3 shadowKernel;", - "mat3 depthKernel;", - - "depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );", - "depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );", - "depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );", - "depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );", - "depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );", - "depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );", - "depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );", - "depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );", - "depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );", - - "vec3 shadowZ = vec3( shadowCoord.z );", - "shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));", - "shadowKernel[0] *= vec3(0.25);", - - "shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));", - "shadowKernel[1] *= vec3(0.25);", - - "shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));", - "shadowKernel[2] *= vec3(0.25);", - - "vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );", - - "shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );", - "shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );", - - "vec4 shadowValues;", - "shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );", - "shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );", - "shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );", - "shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );", - - "shadow = dot( shadowValues, vec4( 1.0 ) );", - - "shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );", - - "#else", - - "vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );", - "float fDepth = unpackDepth( rgbaDepth );", - - "if ( fDepth < shadowCoord.z )", - - // spot with multiple shadows is darker - - "shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );", - - // spot with multiple shadows has the same color as single shadow spot - - //"shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );", - - "#endif", - - "}", - - - "#ifdef SHADOWMAP_DEBUG", - - "#ifdef SHADOWMAP_CASCADE", - - "if ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];", - - "#else", - - "if ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];", - - "#endif", - - "#endif", - - "}", - - "#ifdef GAMMA_OUTPUT", - - "shadowColor *= shadowColor;", - - "#endif", - - "gl_FragColor.xyz = gl_FragColor.xyz * shadowColor;", - - "#endif" - - ].join("\n"), - - shadowmap_pars_vertex: [ - - "#ifdef USE_SHADOWMAP", - - "varying vec4 vShadowCoord[ MAX_SHADOWS ];", - "uniform mat4 shadowMatrix[ MAX_SHADOWS ];", - - "#endif" - - ].join("\n"), - - shadowmap_vertex: [ - - "#ifdef USE_SHADOWMAP", - - "for( int i = 0; i < MAX_SHADOWS; i ++ ) {", - - "vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;", - - "}", - - "#endif" - - ].join("\n"), - - // ALPHATEST - - alphatest_fragment: [ - - "#ifdef ALPHATEST", - - "if ( gl_FragColor.a < ALPHATEST ) discard;", - - "#endif" - - ].join("\n"), - - // LINEAR SPACE - - linear_to_gamma_fragment: [ - - "#ifdef GAMMA_OUTPUT", - - "gl_FragColor.xyz = sqrt( gl_FragColor.xyz );", - - "#endif" - - ].join("\n") - - -}; -/** - * Uniform Utilities - */ - -THREE.UniformsUtils = { - - merge: function ( uniforms ) { - - var u, p, tmp, merged = {}; - - for ( u = 0; u < uniforms.length; u ++ ) { - - tmp = this.clone( uniforms[ u ] ); - - for ( p in tmp ) { - - merged[ p ] = tmp[ p ]; - - } - - } - - return merged; - - }, - - clone: function ( uniforms_src ) { - - var u, p, parameter, parameter_src, uniforms_dst = {}; - - for ( u in uniforms_src ) { - - uniforms_dst[ u ] = {}; - - for ( p in uniforms_src[ u ] ) { - - parameter_src = uniforms_src[ u ][ p ]; - - if ( parameter_src instanceof THREE.Color || - parameter_src instanceof THREE.Vector2 || - parameter_src instanceof THREE.Vector3 || - parameter_src instanceof THREE.Vector4 || - parameter_src instanceof THREE.Matrix4 || - parameter_src instanceof THREE.Texture ) { - - uniforms_dst[ u ][ p ] = parameter_src.clone(); - - } else if ( parameter_src instanceof Array ) { - - uniforms_dst[ u ][ p ] = parameter_src.slice(); - - } else { - - uniforms_dst[ u ][ p ] = parameter_src; - - } - - } - - } - - return uniforms_dst; - - } - -}; -/** - * Uniforms library for shared webgl shaders - */ - -THREE.UniformsLib = { - - common: { - - "diffuse" : { type: "c", value: new THREE.Color( 0xeeeeee ) }, - "opacity" : { type: "f", value: 1.0 }, - - "map" : { type: "t", value: null }, - "offsetRepeat" : { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) }, - - "lightMap" : { type: "t", value: null }, - "specularMap" : { type: "t", value: null }, - - "envMap" : { type: "t", value: null }, - "flipEnvMap" : { type: "f", value: -1 }, - "useRefract" : { type: "i", value: 0 }, - "reflectivity" : { type: "f", value: 1.0 }, - "refractionRatio" : { type: "f", value: 0.98 }, - "combine" : { type: "i", value: 0 }, - - "morphTargetInfluences" : { type: "f", value: 0 } - - }, - - bump: { - - "bumpMap" : { type: "t", value: null }, - "bumpScale" : { type: "f", value: 1 } - - }, - - normalmap: { - - "normalMap" : { type: "t", value: null }, - "normalScale" : { type: "v2", value: new THREE.Vector2( 1, 1 ) } - }, - - fog : { - - "fogDensity" : { type: "f", value: 0.00025 }, - "fogNear" : { type: "f", value: 1 }, - "fogFar" : { type: "f", value: 2000 }, - "fogColor" : { type: "c", value: new THREE.Color( 0xffffff ) } - - }, - - lights: { - - "ambientLightColor" : { type: "fv", value: [] }, - - "directionalLightDirection" : { type: "fv", value: [] }, - "directionalLightColor" : { type: "fv", value: [] }, - - "hemisphereLightDirection" : { type: "fv", value: [] }, - "hemisphereLightSkyColor" : { type: "fv", value: [] }, - "hemisphereLightGroundColor" : { type: "fv", value: [] }, - - "pointLightColor" : { type: "fv", value: [] }, - "pointLightPosition" : { type: "fv", value: [] }, - "pointLightDistance" : { type: "fv1", value: [] }, - - "spotLightColor" : { type: "fv", value: [] }, - "spotLightPosition" : { type: "fv", value: [] }, - "spotLightDirection" : { type: "fv", value: [] }, - "spotLightDistance" : { type: "fv1", value: [] }, - "spotLightAngleCos" : { type: "fv1", value: [] }, - "spotLightExponent" : { type: "fv1", value: [] } - - }, - - particle: { - - "psColor" : { type: "c", value: new THREE.Color( 0xeeeeee ) }, - "opacity" : { type: "f", value: 1.0 }, - "size" : { type: "f", value: 1.0 }, - "scale" : { type: "f", value: 1.0 }, - "map" : { type: "t", value: null }, - - "fogDensity" : { type: "f", value: 0.00025 }, - "fogNear" : { type: "f", value: 1 }, - "fogFar" : { type: "f", value: 2000 }, - "fogColor" : { type: "c", value: new THREE.Color( 0xffffff ) } - - }, - - shadowmap: { - - "shadowMap": { type: "tv", value: [] }, - "shadowMapSize": { type: "v2v", value: [] }, - - "shadowBias" : { type: "fv1", value: [] }, - "shadowDarkness": { type: "fv1", value: [] }, - - "shadowMatrix" : { type: "m4v", value: [] } - - } - -}; -/** - * Webgl Shader Library for three.js - * - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - */ - - -THREE.ShaderLib = { - - 'basic': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "common" ], - THREE.UniformsLib[ "fog" ], - THREE.UniformsLib[ "shadowmap" ] - - ] ), - - vertexShader: [ - - THREE.ShaderChunk[ "map_pars_vertex" ], - THREE.ShaderChunk[ "lightmap_pars_vertex" ], - THREE.ShaderChunk[ "envmap_pars_vertex" ], - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "skinning_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "map_vertex" ], - THREE.ShaderChunk[ "lightmap_vertex" ], - THREE.ShaderChunk[ "color_vertex" ], - THREE.ShaderChunk[ "skinbase_vertex" ], - - "#ifdef USE_ENVMAP", - - THREE.ShaderChunk[ "morphnormal_vertex" ], - THREE.ShaderChunk[ "skinnormal_vertex" ], - THREE.ShaderChunk[ "defaultnormal_vertex" ], - - "#endif", - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "skinning_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - - THREE.ShaderChunk[ "worldpos_vertex" ], - THREE.ShaderChunk[ "envmap_vertex" ], - THREE.ShaderChunk[ "shadowmap_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform vec3 diffuse;", - "uniform float opacity;", - - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "map_pars_fragment" ], - THREE.ShaderChunk[ "lightmap_pars_fragment" ], - THREE.ShaderChunk[ "envmap_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - THREE.ShaderChunk[ "specularmap_pars_fragment" ], - - "void main() {", - - "gl_FragColor = vec4( diffuse, opacity );", - - THREE.ShaderChunk[ "map_fragment" ], - THREE.ShaderChunk[ "alphatest_fragment" ], - THREE.ShaderChunk[ "specularmap_fragment" ], - THREE.ShaderChunk[ "lightmap_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "envmap_fragment" ], - THREE.ShaderChunk[ "shadowmap_fragment" ], - - THREE.ShaderChunk[ "linear_to_gamma_fragment" ], - - THREE.ShaderChunk[ "fog_fragment" ], - - "}" - - ].join("\n") - - }, - - 'lambert': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "common" ], - THREE.UniformsLib[ "fog" ], - THREE.UniformsLib[ "lights" ], - THREE.UniformsLib[ "shadowmap" ], - - { - "ambient" : { type: "c", value: new THREE.Color( 0xffffff ) }, - "emissive" : { type: "c", value: new THREE.Color( 0x000000 ) }, - "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) } - } - - ] ), - - vertexShader: [ - - "#define LAMBERT", - - "varying vec3 vLightFront;", - - "#ifdef DOUBLE_SIDED", - - "varying vec3 vLightBack;", - - "#endif", - - THREE.ShaderChunk[ "map_pars_vertex" ], - THREE.ShaderChunk[ "lightmap_pars_vertex" ], - THREE.ShaderChunk[ "envmap_pars_vertex" ], - THREE.ShaderChunk[ "lights_lambert_pars_vertex" ], - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "skinning_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "map_vertex" ], - THREE.ShaderChunk[ "lightmap_vertex" ], - THREE.ShaderChunk[ "color_vertex" ], - - THREE.ShaderChunk[ "morphnormal_vertex" ], - THREE.ShaderChunk[ "skinbase_vertex" ], - THREE.ShaderChunk[ "skinnormal_vertex" ], - THREE.ShaderChunk[ "defaultnormal_vertex" ], - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "skinning_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - - THREE.ShaderChunk[ "worldpos_vertex" ], - THREE.ShaderChunk[ "envmap_vertex" ], - THREE.ShaderChunk[ "lights_lambert_vertex" ], - THREE.ShaderChunk[ "shadowmap_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform float opacity;", - - "varying vec3 vLightFront;", - - "#ifdef DOUBLE_SIDED", - - "varying vec3 vLightBack;", - - "#endif", - - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "map_pars_fragment" ], - THREE.ShaderChunk[ "lightmap_pars_fragment" ], - THREE.ShaderChunk[ "envmap_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - THREE.ShaderChunk[ "specularmap_pars_fragment" ], - - "void main() {", - - "gl_FragColor = vec4( vec3 ( 1.0 ), opacity );", - - THREE.ShaderChunk[ "map_fragment" ], - THREE.ShaderChunk[ "alphatest_fragment" ], - THREE.ShaderChunk[ "specularmap_fragment" ], - - "#ifdef DOUBLE_SIDED", - - //"float isFront = float( gl_FrontFacing );", - //"gl_FragColor.xyz *= isFront * vLightFront + ( 1.0 - isFront ) * vLightBack;", - - "if ( gl_FrontFacing )", - "gl_FragColor.xyz *= vLightFront;", - "else", - "gl_FragColor.xyz *= vLightBack;", - - "#else", - - "gl_FragColor.xyz *= vLightFront;", - - "#endif", - - THREE.ShaderChunk[ "lightmap_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "envmap_fragment" ], - THREE.ShaderChunk[ "shadowmap_fragment" ], - - THREE.ShaderChunk[ "linear_to_gamma_fragment" ], - - THREE.ShaderChunk[ "fog_fragment" ], - - "}" - - ].join("\n") - - }, - - 'phong': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "common" ], - THREE.UniformsLib[ "bump" ], - THREE.UniformsLib[ "normalmap" ], - THREE.UniformsLib[ "fog" ], - THREE.UniformsLib[ "lights" ], - THREE.UniformsLib[ "shadowmap" ], - - { - "ambient" : { type: "c", value: new THREE.Color( 0xffffff ) }, - "emissive" : { type: "c", value: new THREE.Color( 0x000000 ) }, - "specular" : { type: "c", value: new THREE.Color( 0x111111 ) }, - "shininess": { type: "f", value: 30 }, - "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) } - } - - ] ), - - vertexShader: [ - - "#define PHONG", - - "varying vec3 vViewPosition;", - "varying vec3 vNormal;", - - THREE.ShaderChunk[ "map_pars_vertex" ], - THREE.ShaderChunk[ "lightmap_pars_vertex" ], - THREE.ShaderChunk[ "envmap_pars_vertex" ], - THREE.ShaderChunk[ "lights_phong_pars_vertex" ], - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "skinning_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "map_vertex" ], - THREE.ShaderChunk[ "lightmap_vertex" ], - THREE.ShaderChunk[ "color_vertex" ], - - THREE.ShaderChunk[ "morphnormal_vertex" ], - THREE.ShaderChunk[ "skinbase_vertex" ], - THREE.ShaderChunk[ "skinnormal_vertex" ], - THREE.ShaderChunk[ "defaultnormal_vertex" ], - - "vNormal = normalize( transformedNormal );", - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "skinning_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - - "vViewPosition = -mvPosition.xyz;", - - THREE.ShaderChunk[ "worldpos_vertex" ], - THREE.ShaderChunk[ "envmap_vertex" ], - THREE.ShaderChunk[ "lights_phong_vertex" ], - THREE.ShaderChunk[ "shadowmap_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform vec3 diffuse;", - "uniform float opacity;", - - "uniform vec3 ambient;", - "uniform vec3 emissive;", - "uniform vec3 specular;", - "uniform float shininess;", - - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "map_pars_fragment" ], - THREE.ShaderChunk[ "lightmap_pars_fragment" ], - THREE.ShaderChunk[ "envmap_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "lights_phong_pars_fragment" ], - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - THREE.ShaderChunk[ "bumpmap_pars_fragment" ], - THREE.ShaderChunk[ "normalmap_pars_fragment" ], - THREE.ShaderChunk[ "specularmap_pars_fragment" ], - - "void main() {", - - "gl_FragColor = vec4( vec3 ( 1.0 ), opacity );", - - THREE.ShaderChunk[ "map_fragment" ], - THREE.ShaderChunk[ "alphatest_fragment" ], - THREE.ShaderChunk[ "specularmap_fragment" ], - - THREE.ShaderChunk[ "lights_phong_fragment" ], - - THREE.ShaderChunk[ "lightmap_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "envmap_fragment" ], - THREE.ShaderChunk[ "shadowmap_fragment" ], - - THREE.ShaderChunk[ "linear_to_gamma_fragment" ], - - THREE.ShaderChunk[ "fog_fragment" ], - - "}" - - ].join("\n") - - }, - - 'particle_basic': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "particle" ], - THREE.UniformsLib[ "shadowmap" ] - - ] ), - - vertexShader: [ - - "uniform float size;", - "uniform float scale;", - - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "color_vertex" ], - - "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", - - "#ifdef USE_SIZEATTENUATION", - "gl_PointSize = size * ( scale / length( mvPosition.xyz ) );", - "#else", - "gl_PointSize = size;", - "#endif", - - "gl_Position = projectionMatrix * mvPosition;", - - THREE.ShaderChunk[ "worldpos_vertex" ], - THREE.ShaderChunk[ "shadowmap_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform vec3 psColor;", - "uniform float opacity;", - - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "map_particle_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - - "void main() {", - - "gl_FragColor = vec4( psColor, opacity );", - - THREE.ShaderChunk[ "map_particle_fragment" ], - THREE.ShaderChunk[ "alphatest_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "shadowmap_fragment" ], - THREE.ShaderChunk[ "fog_fragment" ], - - "}" - - ].join("\n") - - }, - - 'dashed': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "common" ], - THREE.UniformsLib[ "fog" ], - - { - "scale": { type: "f", value: 1 }, - "dashSize": { type: "f", value: 1 }, - "totalSize": { type: "f", value: 2 } - } - - ] ), - - vertexShader: [ - - "uniform float scale;", - "attribute float lineDistance;", - - "varying float vLineDistance;", - - THREE.ShaderChunk[ "color_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "color_vertex" ], - - "vLineDistance = scale * lineDistance;", - - "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", - "gl_Position = projectionMatrix * mvPosition;", - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform vec3 diffuse;", - "uniform float opacity;", - - "uniform float dashSize;", - "uniform float totalSize;", - - "varying float vLineDistance;", - - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - - "void main() {", - - "if ( mod( vLineDistance, totalSize ) > dashSize ) {", - - "discard;", - - "}", - - "gl_FragColor = vec4( diffuse, opacity );", - - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "fog_fragment" ], - - "}" - - ].join("\n") - - }, - - 'depth': { - - uniforms: { - - "mNear": { type: "f", value: 1.0 }, - "mFar" : { type: "f", value: 2000.0 }, - "opacity" : { type: "f", value: 1.0 } - - }, - - vertexShader: [ - - "void main() {", - - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform float mNear;", - "uniform float mFar;", - "uniform float opacity;", - - "void main() {", - - "float depth = gl_FragCoord.z / gl_FragCoord.w;", - "float color = 1.0 - smoothstep( mNear, mFar, depth );", - "gl_FragColor = vec4( vec3( color ), opacity );", - - "}" - - ].join("\n") - - }, - - 'normal': { - - uniforms: { - - "opacity" : { type: "f", value: 1.0 } - - }, - - vertexShader: [ - - "varying vec3 vNormal;", - - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - - "void main() {", - - "vNormal = normalize( normalMatrix * normal );", - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform float opacity;", - "varying vec3 vNormal;", - - "void main() {", - - "gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );", - - "}" - - ].join("\n") - - }, - - /* ------------------------------------------------------------------------- - // Normal map shader - // - Blinn-Phong - // - normal + diffuse + specular + AO + displacement + reflection + shadow maps - // - point and directional lights (use with "lights: true" material option) - ------------------------------------------------------------------------- */ - - 'normalmap' : { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "fog" ], - THREE.UniformsLib[ "lights" ], - THREE.UniformsLib[ "shadowmap" ], - - { - - "enableAO" : { type: "i", value: 0 }, - "enableDiffuse" : { type: "i", value: 0 }, - "enableSpecular" : { type: "i", value: 0 }, - "enableReflection": { type: "i", value: 0 }, - "enableDisplacement": { type: "i", value: 0 }, - - "tDisplacement": { type: "t", value: null }, // must go first as this is vertex texture - "tDiffuse" : { type: "t", value: null }, - "tCube" : { type: "t", value: null }, - "tNormal" : { type: "t", value: null }, - "tSpecular" : { type: "t", value: null }, - "tAO" : { type: "t", value: null }, - - "uNormalScale": { type: "v2", value: new THREE.Vector2( 1, 1 ) }, - - "uDisplacementBias": { type: "f", value: 0.0 }, - "uDisplacementScale": { type: "f", value: 1.0 }, - - "diffuse": { type: "c", value: new THREE.Color( 0xffffff ) }, - "specular": { type: "c", value: new THREE.Color( 0x111111 ) }, - "ambient": { type: "c", value: new THREE.Color( 0xffffff ) }, - "shininess": { type: "f", value: 30 }, - "opacity": { type: "f", value: 1 }, - - "useRefract": { type: "i", value: 0 }, - "refractionRatio": { type: "f", value: 0.98 }, - "reflectivity": { type: "f", value: 0.5 }, - - "uOffset" : { type: "v2", value: new THREE.Vector2( 0, 0 ) }, - "uRepeat" : { type: "v2", value: new THREE.Vector2( 1, 1 ) }, - - "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) } - - } - - ] ), - - fragmentShader: [ - - "uniform vec3 ambient;", - "uniform vec3 diffuse;", - "uniform vec3 specular;", - "uniform float shininess;", - "uniform float opacity;", - - "uniform bool enableDiffuse;", - "uniform bool enableSpecular;", - "uniform bool enableAO;", - "uniform bool enableReflection;", - - "uniform sampler2D tDiffuse;", - "uniform sampler2D tNormal;", - "uniform sampler2D tSpecular;", - "uniform sampler2D tAO;", - - "uniform samplerCube tCube;", - - "uniform vec2 uNormalScale;", - - "uniform bool useRefract;", - "uniform float refractionRatio;", - "uniform float reflectivity;", - - "varying vec3 vTangent;", - "varying vec3 vBinormal;", - "varying vec3 vNormal;", - "varying vec2 vUv;", - - "uniform vec3 ambientLightColor;", - - "#if MAX_DIR_LIGHTS > 0", - - "uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];", - "uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];", - - "#endif", - - "#if MAX_HEMI_LIGHTS > 0", - - "uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];", - "uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];", - "uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];", - - "#endif", - - "#if MAX_POINT_LIGHTS > 0", - - "uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];", - "uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];", - "uniform float pointLightDistance[ MAX_POINT_LIGHTS ];", - - "#endif", - - "#if MAX_SPOT_LIGHTS > 0", - - "uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];", - "uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];", - "uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];", - "uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];", - "uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];", - "uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];", - - "#endif", - - "#ifdef WRAP_AROUND", - - "uniform vec3 wrapRGB;", - - "#endif", - - "varying vec3 vWorldPosition;", - "varying vec3 vViewPosition;", - - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - - "void main() {", - - "gl_FragColor = vec4( vec3( 1.0 ), opacity );", - - "vec3 specularTex = vec3( 1.0 );", - - "vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;", - "normalTex.xy *= uNormalScale;", - "normalTex = normalize( normalTex );", - - "if( enableDiffuse ) {", - - "#ifdef GAMMA_INPUT", - - "vec4 texelColor = texture2D( tDiffuse, vUv );", - "texelColor.xyz *= texelColor.xyz;", - - "gl_FragColor = gl_FragColor * texelColor;", - - "#else", - - "gl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );", - - "#endif", - - "}", - - "if( enableAO ) {", - - "#ifdef GAMMA_INPUT", - - "vec4 aoColor = texture2D( tAO, vUv );", - "aoColor.xyz *= aoColor.xyz;", - - "gl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;", - - "#else", - - "gl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;", - - "#endif", - - "}", - - "if( enableSpecular )", - "specularTex = texture2D( tSpecular, vUv ).xyz;", - - "mat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );", - "vec3 finalNormal = tsb * normalTex;", - - "#ifdef FLIP_SIDED", - - "finalNormal = -finalNormal;", - - "#endif", - - "vec3 normal = normalize( finalNormal );", - "vec3 viewPosition = normalize( vViewPosition );", - - // point lights - - "#if MAX_POINT_LIGHTS > 0", - - "vec3 pointDiffuse = vec3( 0.0 );", - "vec3 pointSpecular = vec3( 0.0 );", - - "for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {", - - "vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );", - "vec3 pointVector = lPosition.xyz + vViewPosition.xyz;", - - "float pointDistance = 1.0;", - "if ( pointLightDistance[ i ] > 0.0 )", - "pointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );", - - "pointVector = normalize( pointVector );", - - // diffuse - - "#ifdef WRAP_AROUND", - - "float pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );", - "float pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );", - - "vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );", - - "#else", - - "float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );", - - "#endif", - - "pointDiffuse += pointDistance * pointLightColor[ i ] * diffuse * pointDiffuseWeight;", - - // specular - - "vec3 pointHalfVector = normalize( pointVector + viewPosition );", - "float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );", - "float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );", - - // 2.0 => 2.0001 is hack to work around ANGLE bug - - "float specularNormalization = ( shininess + 2.0001 ) / 8.0;", - - "vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( pointVector, pointHalfVector ), 5.0 );", - "pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;", - - "}", - - "#endif", - - // spot lights - - "#if MAX_SPOT_LIGHTS > 0", - - "vec3 spotDiffuse = vec3( 0.0 );", - "vec3 spotSpecular = vec3( 0.0 );", - - "for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {", - - "vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );", - "vec3 spotVector = lPosition.xyz + vViewPosition.xyz;", - - "float spotDistance = 1.0;", - "if ( spotLightDistance[ i ] > 0.0 )", - "spotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );", - - "spotVector = normalize( spotVector );", - - "float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );", - - "if ( spotEffect > spotLightAngleCos[ i ] ) {", - - "spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );", - - // diffuse - - "#ifdef WRAP_AROUND", - - "float spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );", - "float spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );", - - "vec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );", - - "#else", - - "float spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );", - - "#endif", - - "spotDiffuse += spotDistance * spotLightColor[ i ] * diffuse * spotDiffuseWeight * spotEffect;", - - // specular - - "vec3 spotHalfVector = normalize( spotVector + viewPosition );", - "float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );", - "float spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, shininess ), 0.0 );", - - // 2.0 => 2.0001 is hack to work around ANGLE bug - - "float specularNormalization = ( shininess + 2.0001 ) / 8.0;", - - "vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( spotVector, spotHalfVector ), 5.0 );", - "spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;", - - "}", - - "}", - - "#endif", - - // directional lights - - "#if MAX_DIR_LIGHTS > 0", - - "vec3 dirDiffuse = vec3( 0.0 );", - "vec3 dirSpecular = vec3( 0.0 );", - - "for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {", - - "vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );", - "vec3 dirVector = normalize( lDirection.xyz );", - - // diffuse - - "#ifdef WRAP_AROUND", - - "float directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );", - "float directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );", - - "vec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );", - - "#else", - - "float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );", - - "#endif", - - "dirDiffuse += directionalLightColor[ i ] * diffuse * dirDiffuseWeight;", - - // specular - - "vec3 dirHalfVector = normalize( dirVector + viewPosition );", - "float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );", - "float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );", - - // 2.0 => 2.0001 is hack to work around ANGLE bug - - "float specularNormalization = ( shininess + 2.0001 ) / 8.0;", - - "vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );", - "dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;", - - "}", - - "#endif", - - // hemisphere lights - - "#if MAX_HEMI_LIGHTS > 0", - - "vec3 hemiDiffuse = vec3( 0.0 );", - "vec3 hemiSpecular = vec3( 0.0 );" , - - "for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {", - - "vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );", - "vec3 lVector = normalize( lDirection.xyz );", - - // diffuse - - "float dotProduct = dot( normal, lVector );", - "float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;", - - "vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );", - - "hemiDiffuse += diffuse * hemiColor;", - - // specular (sky light) - - - "vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );", - "float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;", - "float hemiSpecularWeightSky = specularTex.r * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );", - - // specular (ground light) - - "vec3 lVectorGround = -lVector;", - - "vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );", - "float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;", - "float hemiSpecularWeightGround = specularTex.r * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );", - - "float dotProductGround = dot( normal, lVectorGround );", - - // 2.0 => 2.0001 is hack to work around ANGLE bug - - "float specularNormalization = ( shininess + 2.0001 ) / 8.0;", - - "vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );", - "vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );", - "hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );", - - "}", - - "#endif", - - // all lights contribution summation - - "vec3 totalDiffuse = vec3( 0.0 );", - "vec3 totalSpecular = vec3( 0.0 );", - - "#if MAX_DIR_LIGHTS > 0", - - "totalDiffuse += dirDiffuse;", - "totalSpecular += dirSpecular;", - - "#endif", - - "#if MAX_HEMI_LIGHTS > 0", - - "totalDiffuse += hemiDiffuse;", - "totalSpecular += hemiSpecular;", - - "#endif", - - "#if MAX_POINT_LIGHTS > 0", - - "totalDiffuse += pointDiffuse;", - "totalSpecular += pointSpecular;", - - "#endif", - - "#if MAX_SPOT_LIGHTS > 0", - - "totalDiffuse += spotDiffuse;", - "totalSpecular += spotSpecular;", - - "#endif", - - "#ifdef METAL", - - "gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );", - - "#else", - - "gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;", - - "#endif", - - "if ( enableReflection ) {", - - "vec3 vReflect;", - "vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );", - - "if ( useRefract ) {", - - "vReflect = refract( cameraToVertex, normal, refractionRatio );", - - "} else {", - - "vReflect = reflect( cameraToVertex, normal );", - - "}", - - "vec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );", - - "#ifdef GAMMA_INPUT", - - "cubeColor.xyz *= cubeColor.xyz;", - - "#endif", - - "gl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * reflectivity );", - - "}", - - THREE.ShaderChunk[ "shadowmap_fragment" ], - THREE.ShaderChunk[ "linear_to_gamma_fragment" ], - THREE.ShaderChunk[ "fog_fragment" ], - - "}" - - ].join("\n"), - - vertexShader: [ - - "attribute vec4 tangent;", - - "uniform vec2 uOffset;", - "uniform vec2 uRepeat;", - - "uniform bool enableDisplacement;", - - "#ifdef VERTEX_TEXTURES", - - "uniform sampler2D tDisplacement;", - "uniform float uDisplacementScale;", - "uniform float uDisplacementBias;", - - "#endif", - - "varying vec3 vTangent;", - "varying vec3 vBinormal;", - "varying vec3 vNormal;", - "varying vec2 vUv;", - - "varying vec3 vWorldPosition;", - "varying vec3 vViewPosition;", - - THREE.ShaderChunk[ "skinning_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "skinbase_vertex" ], - THREE.ShaderChunk[ "skinnormal_vertex" ], - - // normal, tangent and binormal vectors - - "#ifdef USE_SKINNING", - - "vNormal = normalize( normalMatrix * skinnedNormal.xyz );", - - "vec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );", - "vTangent = normalize( normalMatrix * skinnedTangent.xyz );", - - "#else", - - "vNormal = normalize( normalMatrix * normal );", - "vTangent = normalize( normalMatrix * tangent.xyz );", - - "#endif", - - "vBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );", - - "vUv = uv * uRepeat + uOffset;", - - // displacement mapping - - "vec3 displacedPosition;", - - "#ifdef VERTEX_TEXTURES", - - "if ( enableDisplacement ) {", - - "vec3 dv = texture2D( tDisplacement, uv ).xyz;", - "float df = uDisplacementScale * dv.x + uDisplacementBias;", - "displacedPosition = position + normalize( normal ) * df;", - - "} else {", - - "#ifdef USE_SKINNING", - - "vec4 skinVertex = vec4( position, 1.0 );", - - "vec4 skinned = boneMatX * skinVertex * skinWeight.x;", - "skinned += boneMatY * skinVertex * skinWeight.y;", - - "displacedPosition = skinned.xyz;", - - "#else", - - "displacedPosition = position;", - - "#endif", - - "}", - - "#else", - - "#ifdef USE_SKINNING", - - "vec4 skinVertex = vec4( position, 1.0 );", - - "vec4 skinned = boneMatX * skinVertex * skinWeight.x;", - "skinned += boneMatY * skinVertex * skinWeight.y;", - - "displacedPosition = skinned.xyz;", - - "#else", - - "displacedPosition = position;", - - "#endif", - - "#endif", - - // - - "vec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );", - "vec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );", - - "gl_Position = projectionMatrix * mvPosition;", - - // - - "vWorldPosition = worldPosition.xyz;", - "vViewPosition = -mvPosition.xyz;", - - // shadows - - "#ifdef USE_SHADOWMAP", - - "for( int i = 0; i < MAX_SHADOWS; i ++ ) {", - - "vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;", - - "}", - - "#endif", - - "}" - - ].join("\n") - - }, - - /* ------------------------------------------------------------------------- - // Cube map shader - ------------------------------------------------------------------------- */ - - 'cube': { - - uniforms: { "tCube": { type: "t", value: null }, - "tFlip": { type: "f", value: -1 } }, - - vertexShader: [ - - "varying vec3 vWorldPosition;", - - "void main() {", - - "vec4 worldPosition = modelMatrix * vec4( position, 1.0 );", - "vWorldPosition = worldPosition.xyz;", - - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform samplerCube tCube;", - "uniform float tFlip;", - - "varying vec3 vWorldPosition;", - - "void main() {", - - "gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );", - - "}" - - ].join("\n") - - }, - - // Depth encoding into RGBA texture - // based on SpiderGL shadow map example - // http://spidergl.org/example.php?id=6 - // originally from - // http://www.gamedev.net/topic/442138-packing-a-float-into-a-a8r8g8b8-texture-shader/page__whichpage__1%25EF%25BF%25BD - // see also here: - // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ - - 'depthRGBA': { - - uniforms: {}, - - vertexShader: [ - - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "skinning_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "skinbase_vertex" ], - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "skinning_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "vec4 pack_depth( const in float depth ) {", - - "const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );", - "const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );", - "vec4 res = fract( depth * bit_shift );", - "res -= res.xxyz * bit_mask;", - "return res;", - - "}", - - "void main() {", - - "gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );", - - //"gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z / gl_FragCoord.w );", - //"float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 );", - //"gl_FragData[ 0 ] = pack_depth( z );", - //"gl_FragData[ 0 ] = vec4( z, z, z, 1.0 );", - - "}" - - ].join("\n") - - } - -}; - -/** - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author szimek / https://github.com/szimek/ - */ - -THREE.WebGLRenderer = function ( parameters ) { - - console.log( 'THREE.WebGLRenderer', THREE.REVISION ); - - parameters = parameters || {}; - - var _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElement( 'canvas' ), - _context = parameters.context !== undefined ? parameters.context : null, - - _precision = parameters.precision !== undefined ? parameters.precision : 'highp', - - _buffers = {}, - - _alpha = parameters.alpha !== undefined ? parameters.alpha : false, - _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, - _antialias = parameters.antialias !== undefined ? parameters.antialias : false, - _stencil = parameters.stencil !== undefined ? parameters.stencil : true, - _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, - - _clearColor = new THREE.Color( 0x000000 ), - _clearAlpha = 0; - - // public properties - - this.domElement = _canvas; - this.context = null; - this.devicePixelRatio = parameters.devicePixelRatio !== undefined - ? parameters.devicePixelRatio - : self.devicePixelRatio !== undefined - ? self.devicePixelRatio - : 1; - - // clearing - - this.autoClear = true; - this.autoClearColor = true; - this.autoClearDepth = true; - this.autoClearStencil = true; - - // scene graph - - this.sortObjects = true; - this.autoUpdateObjects = true; - - // physically based shading - - this.gammaInput = false; - this.gammaOutput = false; - - // shadow map - - this.shadowMapEnabled = false; - this.shadowMapAutoUpdate = true; - this.shadowMapType = THREE.PCFShadowMap; - this.shadowMapCullFace = THREE.CullFaceFront; - this.shadowMapDebug = false; - this.shadowMapCascade = false; - - // morphs - - this.maxMorphTargets = 8; - this.maxMorphNormals = 4; - - // flags - - this.autoScaleCubemaps = true; - - // custom render plugins - - this.renderPluginsPre = []; - this.renderPluginsPost = []; - - // info - - this.info = { - - memory: { - - programs: 0, - geometries: 0, - textures: 0 - - }, - - render: { - - calls: 0, - vertices: 0, - faces: 0, - points: 0 - - } - - }; - - // internal properties - - var _this = this, - - _programs = [], - _programs_counter = 0, - - // internal state cache - - _currentProgram = null, - _currentFramebuffer = null, - _currentMaterialId = -1, - _currentGeometryGroupHash = null, - _currentCamera = null, - - _usedTextureUnits = 0, - - // GL state cache - - _oldDoubleSided = -1, - _oldFlipSided = -1, - - _oldBlending = -1, - - _oldBlendEquation = -1, - _oldBlendSrc = -1, - _oldBlendDst = -1, - - _oldDepthTest = -1, - _oldDepthWrite = -1, - - _oldPolygonOffset = null, - _oldPolygonOffsetFactor = null, - _oldPolygonOffsetUnits = null, - - _oldLineWidth = null, - - _viewportX = 0, - _viewportY = 0, - _viewportWidth = _canvas.width, - _viewportHeight = _canvas.height, - _currentWidth = 0, - _currentHeight = 0, - - _enabledAttributes = new Uint8Array( 16 ), - - // frustum - - _frustum = new THREE.Frustum(), - - // camera matrices cache - - _projScreenMatrix = new THREE.Matrix4(), - _projScreenMatrixPS = new THREE.Matrix4(), - - _vector3 = new THREE.Vector3(), - - // light arrays cache - - _direction = new THREE.Vector3(), - - _lightsNeedUpdate = true, - - _lights = { - - ambient: [ 0, 0, 0 ], - directional: { length: 0, colors: new Array(), positions: new Array() }, - point: { length: 0, colors: new Array(), positions: new Array(), distances: new Array() }, - spot: { length: 0, colors: new Array(), positions: new Array(), distances: new Array(), directions: new Array(), anglesCos: new Array(), exponents: new Array() }, - hemi: { length: 0, skyColors: new Array(), groundColors: new Array(), positions: new Array() } - - }; - - // initialize - - var _gl; - - var _glExtensionTextureFloat; - var _glExtensionTextureFloatLinear; - var _glExtensionStandardDerivatives; - var _glExtensionTextureFilterAnisotropic; - var _glExtensionCompressedTextureS3TC; - - initGL(); - - setDefaultGLState(); - - this.context = _gl; - - // GPU capabilities - - var _maxTextures = _gl.getParameter( _gl.MAX_TEXTURE_IMAGE_UNITS ); - var _maxVertexTextures = _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ); - var _maxTextureSize = _gl.getParameter( _gl.MAX_TEXTURE_SIZE ); - var _maxCubemapSize = _gl.getParameter( _gl.MAX_CUBE_MAP_TEXTURE_SIZE ); - - var _maxAnisotropy = _glExtensionTextureFilterAnisotropic ? _gl.getParameter( _glExtensionTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT ) : 0; - - var _supportsVertexTextures = ( _maxVertexTextures > 0 ); - var _supportsBoneTextures = _supportsVertexTextures && _glExtensionTextureFloat; - - var _compressedTextureFormats = _glExtensionCompressedTextureS3TC ? _gl.getParameter( _gl.COMPRESSED_TEXTURE_FORMATS ) : []; - - // - - var _vertexShaderPrecisionHighpFloat = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.HIGH_FLOAT ); - var _vertexShaderPrecisionMediumpFloat = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.MEDIUM_FLOAT ); - var _vertexShaderPrecisionLowpFloat = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.LOW_FLOAT ); - - var _fragmentShaderPrecisionHighpFloat = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.HIGH_FLOAT ); - var _fragmentShaderPrecisionMediumpFloat = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.MEDIUM_FLOAT ); - var _fragmentShaderPrecisionLowpFloat = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.LOW_FLOAT ); - - var _vertexShaderPrecisionHighpInt = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.HIGH_INT ); - var _vertexShaderPrecisionMediumpInt = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.MEDIUM_INT ); - var _vertexShaderPrecisionLowpInt = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.LOW_INT ); - - var _fragmentShaderPrecisionHighpInt = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.HIGH_INT ); - var _fragmentShaderPrecisionMediumpInt = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.MEDIUM_INT ); - var _fragmentShaderPrecisionLowpInt = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.LOW_INT ); - - // clamp precision to maximum available - - var highpAvailable = _vertexShaderPrecisionHighpFloat.precision > 0 && _fragmentShaderPrecisionHighpFloat.precision > 0; - var mediumpAvailable = _vertexShaderPrecisionMediumpFloat.precision > 0 && _fragmentShaderPrecisionMediumpFloat.precision > 0; - - if ( _precision === "highp" && ! highpAvailable ) { - - if ( mediumpAvailable ) { - - _precision = "mediump"; - console.warn( "WebGLRenderer: highp not supported, using mediump" ); - - } else { - - _precision = "lowp"; - console.warn( "WebGLRenderer: highp and mediump not supported, using lowp" ); - - } - - } - - if ( _precision === "mediump" && ! mediumpAvailable ) { - - _precision = "lowp"; - console.warn( "WebGLRenderer: mediump not supported, using lowp" ); - - } - - // API - - this.getContext = function () { - - return _gl; - - }; - - this.supportsVertexTextures = function () { - - return _supportsVertexTextures; - - }; - - this.supportsFloatTextures = function () { - - return _glExtensionTextureFloat; - - }; - - this.supportsStandardDerivatives = function () { - - return _glExtensionStandardDerivatives; - - }; - - this.supportsCompressedTextureS3TC = function () { - - return _glExtensionCompressedTextureS3TC; - - }; - - this.getMaxAnisotropy = function () { - - return _maxAnisotropy; - - }; - - this.getPrecision = function () { - - return _precision; - - }; - - this.setSize = function ( width, height, updateStyle ) { - - _canvas.width = width * this.devicePixelRatio; - _canvas.height = height * this.devicePixelRatio; - - if ( this.devicePixelRatio !== 1 && updateStyle !== false ) { - - _canvas.style.width = width + 'px'; - _canvas.style.height = height + 'px'; - - } - - this.setViewport( 0, 0, width, height ); - - }; - - this.setViewport = function ( x, y, width, height ) { - - _viewportX = x * this.devicePixelRatio; - _viewportY = y * this.devicePixelRatio; - - _viewportWidth = width * this.devicePixelRatio; - _viewportHeight = height * this.devicePixelRatio; - - _gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight ); - - }; - - this.setScissor = function ( x, y, width, height ) { - - _gl.scissor( - x * this.devicePixelRatio, - y * this.devicePixelRatio, - width * this.devicePixelRatio, - height * this.devicePixelRatio - ); - - }; - - this.enableScissorTest = function ( enable ) { - - enable ? _gl.enable( _gl.SCISSOR_TEST ) : _gl.disable( _gl.SCISSOR_TEST ); - - }; - - // Clearing - - this.setClearColor = function ( color, alpha ) { - - _clearColor.set( color ); - _clearAlpha = alpha !== undefined ? alpha : 1; - - _gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - }; - - this.setClearColorHex = function ( hex, alpha ) { - - console.warn( 'DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.' ); - this.setClearColor( hex, alpha ); - - }; - - this.getClearColor = function () { - - return _clearColor; - - }; - - this.getClearAlpha = function () { - - return _clearAlpha; - - }; - - this.clear = function ( color, depth, stencil ) { - - var bits = 0; - - if ( color === undefined || color ) bits |= _gl.COLOR_BUFFER_BIT; - if ( depth === undefined || depth ) bits |= _gl.DEPTH_BUFFER_BIT; - if ( stencil === undefined || stencil ) bits |= _gl.STENCIL_BUFFER_BIT; - - _gl.clear( bits ); - - }; - - this.clearColor = function () { - - _gl.clear( _gl.COLOR_BUFFER_BIT ); - - }; - - this.clearDepth = function () { - - _gl.clear( _gl.DEPTH_BUFFER_BIT ); - - }; - - this.clearStencil = function () { - - _gl.clear( _gl.STENCIL_BUFFER_BIT ); - - }; - - this.clearTarget = function ( renderTarget, color, depth, stencil ) { - - this.setRenderTarget( renderTarget ); - this.clear( color, depth, stencil ); - - }; - - // Plugins - - this.addPostPlugin = function ( plugin ) { - - plugin.init( this ); - this.renderPluginsPost.push( plugin ); - - }; - - this.addPrePlugin = function ( plugin ) { - - plugin.init( this ); - this.renderPluginsPre.push( plugin ); - - }; - - // Rendering - - this.updateShadowMap = function ( scene, camera ) { - - _currentProgram = null; - _oldBlending = -1; - _oldDepthTest = -1; - _oldDepthWrite = -1; - _currentGeometryGroupHash = -1; - _currentMaterialId = -1; - _lightsNeedUpdate = true; - _oldDoubleSided = -1; - _oldFlipSided = -1; - - this.shadowMapPlugin.update( scene, camera ); - - }; - - // Internal functions - - // Buffer allocation - - function createParticleBuffers ( geometry ) { - - geometry.__webglVertexBuffer = _gl.createBuffer(); - geometry.__webglColorBuffer = _gl.createBuffer(); - - _this.info.memory.geometries ++; - - }; - - function createLineBuffers ( geometry ) { - - geometry.__webglVertexBuffer = _gl.createBuffer(); - geometry.__webglColorBuffer = _gl.createBuffer(); - geometry.__webglLineDistanceBuffer = _gl.createBuffer(); - - _this.info.memory.geometries ++; - - }; - - function createMeshBuffers ( geometryGroup ) { - - geometryGroup.__webglVertexBuffer = _gl.createBuffer(); - geometryGroup.__webglNormalBuffer = _gl.createBuffer(); - geometryGroup.__webglTangentBuffer = _gl.createBuffer(); - geometryGroup.__webglColorBuffer = _gl.createBuffer(); - geometryGroup.__webglUVBuffer = _gl.createBuffer(); - geometryGroup.__webglUV2Buffer = _gl.createBuffer(); - - geometryGroup.__webglSkinIndicesBuffer = _gl.createBuffer(); - geometryGroup.__webglSkinWeightsBuffer = _gl.createBuffer(); - - geometryGroup.__webglFaceBuffer = _gl.createBuffer(); - geometryGroup.__webglLineBuffer = _gl.createBuffer(); - - var m, ml; - - if ( geometryGroup.numMorphTargets ) { - - geometryGroup.__webglMorphTargetsBuffers = []; - - for ( m = 0, ml = geometryGroup.numMorphTargets; m < ml; m ++ ) { - - geometryGroup.__webglMorphTargetsBuffers.push( _gl.createBuffer() ); - - } - - } - - if ( geometryGroup.numMorphNormals ) { - - geometryGroup.__webglMorphNormalsBuffers = []; - - for ( m = 0, ml = geometryGroup.numMorphNormals; m < ml; m ++ ) { - - geometryGroup.__webglMorphNormalsBuffers.push( _gl.createBuffer() ); - - } - - } - - _this.info.memory.geometries ++; - - }; - - // Events - - var onGeometryDispose = function ( event ) { - - var geometry = event.target; - - geometry.removeEventListener( 'dispose', onGeometryDispose ); - - deallocateGeometry( geometry ); - - }; - - var onTextureDispose = function ( event ) { - - var texture = event.target; - - texture.removeEventListener( 'dispose', onTextureDispose ); - - deallocateTexture( texture ); - - _this.info.memory.textures --; - - - }; - - var onRenderTargetDispose = function ( event ) { - - var renderTarget = event.target; - - renderTarget.removeEventListener( 'dispose', onRenderTargetDispose ); - - deallocateRenderTarget( renderTarget ); - - _this.info.memory.textures --; - - }; - - var onMaterialDispose = function ( event ) { - - var material = event.target; - - material.removeEventListener( 'dispose', onMaterialDispose ); - - deallocateMaterial( material ); - - }; - - // Buffer deallocation - - var deleteBuffers = function ( geometry ) { - - if ( geometry.__webglVertexBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglVertexBuffer ); - if ( geometry.__webglNormalBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglNormalBuffer ); - if ( geometry.__webglTangentBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglTangentBuffer ); - if ( geometry.__webglColorBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglColorBuffer ); - if ( geometry.__webglUVBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglUVBuffer ); - if ( geometry.__webglUV2Buffer !== undefined ) _gl.deleteBuffer( geometry.__webglUV2Buffer ); - - if ( geometry.__webglSkinIndicesBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglSkinIndicesBuffer ); - if ( geometry.__webglSkinWeightsBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglSkinWeightsBuffer ); - - if ( geometry.__webglFaceBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglFaceBuffer ); - if ( geometry.__webglLineBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglLineBuffer ); - - if ( geometry.__webglLineDistanceBuffer !== undefined ) _gl.deleteBuffer( geometry.__webglLineDistanceBuffer ); - // custom attributes - - if ( geometry.__webglCustomAttributesList !== undefined ) { - - for ( var id in geometry.__webglCustomAttributesList ) { - - _gl.deleteBuffer( geometry.__webglCustomAttributesList[ id ].buffer ); - - } - - } - - _this.info.memory.geometries --; - - }; - - var deallocateGeometry = function ( geometry ) { - - geometry.__webglInit = undefined; - - if ( geometry instanceof THREE.BufferGeometry ) { - - var attributes = geometry.attributes; - - for ( var key in attributes ) { - - if ( attributes[ key ].buffer !== undefined ) { - - _gl.deleteBuffer( attributes[ key ].buffer ); - - } - - } - - _this.info.memory.geometries --; - - } else { - - if ( geometry.geometryGroups !== undefined ) { - - for ( var g in geometry.geometryGroups ) { - - var geometryGroup = geometry.geometryGroups[ g ]; - - if ( geometryGroup.numMorphTargets !== undefined ) { - - for ( var m = 0, ml = geometryGroup.numMorphTargets; m < ml; m ++ ) { - - _gl.deleteBuffer( geometryGroup.__webglMorphTargetsBuffers[ m ] ); - - } - - } - - if ( geometryGroup.numMorphNormals !== undefined ) { - - for ( var m = 0, ml = geometryGroup.numMorphNormals; m < ml; m ++ ) { - - _gl.deleteBuffer( geometryGroup.__webglMorphNormalsBuffers[ m ] ); - - } - - } - - deleteBuffers( geometryGroup ); - - } - - } else { - - deleteBuffers( geometry ); - - } - - } - - }; - - var deallocateTexture = function ( texture ) { - - if ( texture.image && texture.image.__webglTextureCube ) { - - // cube texture - - _gl.deleteTexture( texture.image.__webglTextureCube ); - - } else { - - // 2D texture - - if ( ! texture.__webglInit ) return; - - texture.__webglInit = false; - _gl.deleteTexture( texture.__webglTexture ); - - } - - }; - - var deallocateRenderTarget = function ( renderTarget ) { - - if ( !renderTarget || ! renderTarget.__webglTexture ) return; - - _gl.deleteTexture( renderTarget.__webglTexture ); - - if ( renderTarget instanceof THREE.WebGLRenderTargetCube ) { - - for ( var i = 0; i < 6; i ++ ) { - - _gl.deleteFramebuffer( renderTarget.__webglFramebuffer[ i ] ); - _gl.deleteRenderbuffer( renderTarget.__webglRenderbuffer[ i ] ); - - } - - } else { - - _gl.deleteFramebuffer( renderTarget.__webglFramebuffer ); - _gl.deleteRenderbuffer( renderTarget.__webglRenderbuffer ); - - } - - }; - - var deallocateMaterial = function ( material ) { - - var program = material.program; - - if ( program === undefined ) return; - - material.program = undefined; - - // only deallocate GL program if this was the last use of shared program - // assumed there is only single copy of any program in the _programs list - // (that's how it's constructed) - - var i, il, programInfo; - var deleteProgram = false; - - for ( i = 0, il = _programs.length; i < il; i ++ ) { - - programInfo = _programs[ i ]; - - if ( programInfo.program === program ) { - - programInfo.usedTimes --; - - if ( programInfo.usedTimes === 0 ) { - - deleteProgram = true; - - } - - break; - - } - - } - - if ( deleteProgram === true ) { - - // avoid using array.splice, this is costlier than creating new array from scratch - - var newPrograms = []; - - for ( i = 0, il = _programs.length; i < il; i ++ ) { - - programInfo = _programs[ i ]; - - if ( programInfo.program !== program ) { - - newPrograms.push( programInfo ); - - } - - } - - _programs = newPrograms; - - _gl.deleteProgram( program ); - - _this.info.memory.programs --; - - } - - }; - - // Buffer initialization - - function initCustomAttributes ( geometry, object ) { - - var nvertices = geometry.vertices.length; - - var material = object.material; - - if ( material.attributes ) { - - if ( geometry.__webglCustomAttributesList === undefined ) { - - geometry.__webglCustomAttributesList = []; - - } - - for ( var a in material.attributes ) { - - var attribute = material.attributes[ a ]; - - if ( !attribute.__webglInitialized || attribute.createUniqueBuffers ) { - - attribute.__webglInitialized = true; - - var size = 1; // "f" and "i" - - if ( attribute.type === "v2" ) size = 2; - else if ( attribute.type === "v3" ) size = 3; - else if ( attribute.type === "v4" ) size = 4; - else if ( attribute.type === "c" ) size = 3; - - attribute.size = size; - - attribute.array = new Float32Array( nvertices * size ); - - attribute.buffer = _gl.createBuffer(); - attribute.buffer.belongsToAttribute = a; - - attribute.needsUpdate = true; - - } - - geometry.__webglCustomAttributesList.push( attribute ); - - } - - } - - }; - - function initParticleBuffers ( geometry, object ) { - - var nvertices = geometry.vertices.length; - - geometry.__vertexArray = new Float32Array( nvertices * 3 ); - geometry.__colorArray = new Float32Array( nvertices * 3 ); - - geometry.__sortArray = []; - - geometry.__webglParticleCount = nvertices; - - initCustomAttributes ( geometry, object ); - - }; - - function initLineBuffers ( geometry, object ) { - - var nvertices = geometry.vertices.length; - - geometry.__vertexArray = new Float32Array( nvertices * 3 ); - geometry.__colorArray = new Float32Array( nvertices * 3 ); - geometry.__lineDistanceArray = new Float32Array( nvertices * 1 ); - - geometry.__webglLineCount = nvertices; - - initCustomAttributes ( geometry, object ); - - }; - - function initMeshBuffers ( geometryGroup, object ) { - - var geometry = object.geometry, - faces3 = geometryGroup.faces3, - - nvertices = faces3.length * 3, - ntris = faces3.length * 1, - nlines = faces3.length * 3, - - material = getBufferMaterial( object, geometryGroup ), - - uvType = bufferGuessUVType( material ), - normalType = bufferGuessNormalType( material ), - vertexColorType = bufferGuessVertexColorType( material ); - - // console.log( "uvType", uvType, "normalType", normalType, "vertexColorType", vertexColorType, object, geometryGroup, material ); - - geometryGroup.__vertexArray = new Float32Array( nvertices * 3 ); - - if ( normalType ) { - - geometryGroup.__normalArray = new Float32Array( nvertices * 3 ); - - } - - if ( geometry.hasTangents ) { - - geometryGroup.__tangentArray = new Float32Array( nvertices * 4 ); - - } - - if ( vertexColorType ) { - - geometryGroup.__colorArray = new Float32Array( nvertices * 3 ); - - } - - if ( uvType ) { - - if ( geometry.faceVertexUvs.length > 0 ) { - - geometryGroup.__uvArray = new Float32Array( nvertices * 2 ); - - } - - if ( geometry.faceVertexUvs.length > 1 ) { - - geometryGroup.__uv2Array = new Float32Array( nvertices * 2 ); - - } - - } - - if ( object.geometry.skinWeights.length && object.geometry.skinIndices.length ) { - - geometryGroup.__skinIndexArray = new Float32Array( nvertices * 4 ); - geometryGroup.__skinWeightArray = new Float32Array( nvertices * 4 ); - - } - - geometryGroup.__faceArray = new Uint16Array( ntris * 3 ); - geometryGroup.__lineArray = new Uint16Array( nlines * 2 ); - - var m, ml; - - if ( geometryGroup.numMorphTargets ) { - - geometryGroup.__morphTargetsArrays = []; - - for ( m = 0, ml = geometryGroup.numMorphTargets; m < ml; m ++ ) { - - geometryGroup.__morphTargetsArrays.push( new Float32Array( nvertices * 3 ) ); - - } - - } - - if ( geometryGroup.numMorphNormals ) { - - geometryGroup.__morphNormalsArrays = []; - - for ( m = 0, ml = geometryGroup.numMorphNormals; m < ml; m ++ ) { - - geometryGroup.__morphNormalsArrays.push( new Float32Array( nvertices * 3 ) ); - - } - - } - - geometryGroup.__webglFaceCount = ntris * 3; - geometryGroup.__webglLineCount = nlines * 2; - - - // custom attributes - - if ( material.attributes ) { - - if ( geometryGroup.__webglCustomAttributesList === undefined ) { - - geometryGroup.__webglCustomAttributesList = []; - - } - - for ( var a in material.attributes ) { - - // Do a shallow copy of the attribute object so different geometryGroup chunks use different - // attribute buffers which are correctly indexed in the setMeshBuffers function - - var originalAttribute = material.attributes[ a ]; - - var attribute = {}; - - for ( var property in originalAttribute ) { - - attribute[ property ] = originalAttribute[ property ]; - - } - - if ( !attribute.__webglInitialized || attribute.createUniqueBuffers ) { - - attribute.__webglInitialized = true; - - var size = 1; // "f" and "i" - - if( attribute.type === "v2" ) size = 2; - else if( attribute.type === "v3" ) size = 3; - else if( attribute.type === "v4" ) size = 4; - else if( attribute.type === "c" ) size = 3; - - attribute.size = size; - - attribute.array = new Float32Array( nvertices * size ); - - attribute.buffer = _gl.createBuffer(); - attribute.buffer.belongsToAttribute = a; - - originalAttribute.needsUpdate = true; - attribute.__original = originalAttribute; - - } - - geometryGroup.__webglCustomAttributesList.push( attribute ); - - } - - } - - geometryGroup.__inittedArrays = true; - - }; - - function getBufferMaterial( object, geometryGroup ) { - - return object.material instanceof THREE.MeshFaceMaterial - ? object.material.materials[ geometryGroup.materialIndex ] - : object.material; - - }; - - function materialNeedsSmoothNormals ( material ) { - - return material && material.shading !== undefined && material.shading === THREE.SmoothShading; - - }; - - function bufferGuessNormalType ( material ) { - - // only MeshBasicMaterial and MeshDepthMaterial don't need normals - - if ( ( material instanceof THREE.MeshBasicMaterial && !material.envMap ) || material instanceof THREE.MeshDepthMaterial ) { - - return false; - - } - - if ( materialNeedsSmoothNormals( material ) ) { - - return THREE.SmoothShading; - - } else { - - return THREE.FlatShading; - - } - - }; - - function bufferGuessVertexColorType( material ) { - - if ( material.vertexColors ) { - - return material.vertexColors; - - } - - return false; - - }; - - function bufferGuessUVType( material ) { - - // material must use some texture to require uvs - - if ( material.map || - material.lightMap || - material.bumpMap || - material.normalMap || - material.specularMap || - material instanceof THREE.ShaderMaterial ) { - - return true; - - } - - return false; - - }; - - // - - function initDirectBuffers( geometry ) { - - var a, attribute, type; - - for ( a in geometry.attributes ) { - - if ( a === "index" ) { - - type = _gl.ELEMENT_ARRAY_BUFFER; - - } else { - - type = _gl.ARRAY_BUFFER; - - } - - attribute = geometry.attributes[ a ]; - - attribute.buffer = _gl.createBuffer(); - - _gl.bindBuffer( type, attribute.buffer ); - _gl.bufferData( type, attribute.array, _gl.STATIC_DRAW ); - - } - - }; - - // Buffer setting - - function setParticleBuffers ( geometry, hint, object ) { - - var v, c, vertex, offset, index, color, - - vertices = geometry.vertices, - vl = vertices.length, - - colors = geometry.colors, - cl = colors.length, - - vertexArray = geometry.__vertexArray, - colorArray = geometry.__colorArray, - - sortArray = geometry.__sortArray, - - dirtyVertices = geometry.verticesNeedUpdate, - dirtyElements = geometry.elementsNeedUpdate, - dirtyColors = geometry.colorsNeedUpdate, - - customAttributes = geometry.__webglCustomAttributesList, - i, il, - a, ca, cal, value, - customAttribute; - - if ( object.sortParticles ) { - - _projScreenMatrixPS.copy( _projScreenMatrix ); - _projScreenMatrixPS.multiply( object.matrixWorld ); - - for ( v = 0; v < vl; v ++ ) { - - vertex = vertices[ v ]; - - _vector3.copy( vertex ); - _vector3.applyProjection( _projScreenMatrixPS ); - - sortArray[ v ] = [ _vector3.z, v ]; - - } - - sortArray.sort( numericalSort ); - - for ( v = 0; v < vl; v ++ ) { - - vertex = vertices[ sortArray[v][1] ]; - - offset = v * 3; - - vertexArray[ offset ] = vertex.x; - vertexArray[ offset + 1 ] = vertex.y; - vertexArray[ offset + 2 ] = vertex.z; - - } - - for ( c = 0; c < cl; c ++ ) { - - offset = c * 3; - - color = colors[ sortArray[c][1] ]; - - colorArray[ offset ] = color.r; - colorArray[ offset + 1 ] = color.g; - colorArray[ offset + 2 ] = color.b; - - } - - if ( customAttributes ) { - - for ( i = 0, il = customAttributes.length; i < il; i ++ ) { - - customAttribute = customAttributes[ i ]; - - if ( ! ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) ) continue; - - offset = 0; - - cal = customAttribute.value.length; - - if ( customAttribute.size === 1 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - index = sortArray[ ca ][ 1 ]; - - customAttribute.array[ ca ] = customAttribute.value[ index ]; - - } - - } else if ( customAttribute.size === 2 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - index = sortArray[ ca ][ 1 ]; - - value = customAttribute.value[ index ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - - offset += 2; - - } - - } else if ( customAttribute.size === 3 ) { - - if ( customAttribute.type === "c" ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - index = sortArray[ ca ][ 1 ]; - - value = customAttribute.value[ index ]; - - customAttribute.array[ offset ] = value.r; - customAttribute.array[ offset + 1 ] = value.g; - customAttribute.array[ offset + 2 ] = value.b; - - offset += 3; - - } - - } else { - - for ( ca = 0; ca < cal; ca ++ ) { - - index = sortArray[ ca ][ 1 ]; - - value = customAttribute.value[ index ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - - offset += 3; - - } - - } - - } else if ( customAttribute.size === 4 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - index = sortArray[ ca ][ 1 ]; - - value = customAttribute.value[ index ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - customAttribute.array[ offset + 3 ] = value.w; - - offset += 4; - - } - - } - - } - - } - - } else { - - if ( dirtyVertices ) { - - for ( v = 0; v < vl; v ++ ) { - - vertex = vertices[ v ]; - - offset = v * 3; - - vertexArray[ offset ] = vertex.x; - vertexArray[ offset + 1 ] = vertex.y; - vertexArray[ offset + 2 ] = vertex.z; - - } - - } - - if ( dirtyColors ) { - - for ( c = 0; c < cl; c ++ ) { - - color = colors[ c ]; - - offset = c * 3; - - colorArray[ offset ] = color.r; - colorArray[ offset + 1 ] = color.g; - colorArray[ offset + 2 ] = color.b; - - } - - } - - if ( customAttributes ) { - - for ( i = 0, il = customAttributes.length; i < il; i ++ ) { - - customAttribute = customAttributes[ i ]; - - if ( customAttribute.needsUpdate && - ( customAttribute.boundTo === undefined || - customAttribute.boundTo === "vertices") ) { - - cal = customAttribute.value.length; - - offset = 0; - - if ( customAttribute.size === 1 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - customAttribute.array[ ca ] = customAttribute.value[ ca ]; - - } - - } else if ( customAttribute.size === 2 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - - offset += 2; - - } - - } else if ( customAttribute.size === 3 ) { - - if ( customAttribute.type === "c" ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.r; - customAttribute.array[ offset + 1 ] = value.g; - customAttribute.array[ offset + 2 ] = value.b; - - offset += 3; - - } - - } else { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - - offset += 3; - - } - - } - - } else if ( customAttribute.size === 4 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - customAttribute.array[ offset + 3 ] = value.w; - - offset += 4; - - } - - } - - } - - } - - } - - } - - if ( dirtyVertices || object.sortParticles ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); - - } - - if ( dirtyColors || object.sortParticles ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint ); - - } - - if ( customAttributes ) { - - for ( i = 0, il = customAttributes.length; i < il; i ++ ) { - - customAttribute = customAttributes[ i ]; - - if ( customAttribute.needsUpdate || object.sortParticles ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint ); - - } - - } - - } - - - }; - - function setLineBuffers ( geometry, hint ) { - - var v, c, d, vertex, offset, color, - - vertices = geometry.vertices, - colors = geometry.colors, - lineDistances = geometry.lineDistances, - - vl = vertices.length, - cl = colors.length, - dl = lineDistances.length, - - vertexArray = geometry.__vertexArray, - colorArray = geometry.__colorArray, - lineDistanceArray = geometry.__lineDistanceArray, - - dirtyVertices = geometry.verticesNeedUpdate, - dirtyColors = geometry.colorsNeedUpdate, - dirtyLineDistances = geometry.lineDistancesNeedUpdate, - - customAttributes = geometry.__webglCustomAttributesList, - - i, il, - a, ca, cal, value, - customAttribute; - - if ( dirtyVertices ) { - - for ( v = 0; v < vl; v ++ ) { - - vertex = vertices[ v ]; - - offset = v * 3; - - vertexArray[ offset ] = vertex.x; - vertexArray[ offset + 1 ] = vertex.y; - vertexArray[ offset + 2 ] = vertex.z; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); - - } - - if ( dirtyColors ) { - - for ( c = 0; c < cl; c ++ ) { - - color = colors[ c ]; - - offset = c * 3; - - colorArray[ offset ] = color.r; - colorArray[ offset + 1 ] = color.g; - colorArray[ offset + 2 ] = color.b; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint ); - - } - - if ( dirtyLineDistances ) { - - for ( d = 0; d < dl; d ++ ) { - - lineDistanceArray[ d ] = lineDistances[ d ]; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglLineDistanceBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, lineDistanceArray, hint ); - - } - - if ( customAttributes ) { - - for ( i = 0, il = customAttributes.length; i < il; i ++ ) { - - customAttribute = customAttributes[ i ]; - - if ( customAttribute.needsUpdate && - ( customAttribute.boundTo === undefined || - customAttribute.boundTo === "vertices" ) ) { - - offset = 0; - - cal = customAttribute.value.length; - - if ( customAttribute.size === 1 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - customAttribute.array[ ca ] = customAttribute.value[ ca ]; - - } - - } else if ( customAttribute.size === 2 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - - offset += 2; - - } - - } else if ( customAttribute.size === 3 ) { - - if ( customAttribute.type === "c" ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.r; - customAttribute.array[ offset + 1 ] = value.g; - customAttribute.array[ offset + 2 ] = value.b; - - offset += 3; - - } - - } else { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - - offset += 3; - - } - - } - - } else if ( customAttribute.size === 4 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - customAttribute.array[ offset + 3 ] = value.w; - - offset += 4; - - } - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint ); - - } - - } - - } - - }; - - function setMeshBuffers( geometryGroup, object, hint, dispose, material ) { - - if ( ! geometryGroup.__inittedArrays ) { - - return; - - } - - var normalType = bufferGuessNormalType( material ), - vertexColorType = bufferGuessVertexColorType( material ), - uvType = bufferGuessUVType( material ), - - needsSmoothNormals = ( normalType === THREE.SmoothShading ); - - var f, fl, fi, face, - vertexNormals, faceNormal, normal, - vertexColors, faceColor, - vertexTangents, - uv, uv2, v1, v2, v3, v4, t1, t2, t3, t4, n1, n2, n3, n4, - c1, c2, c3, c4, - sw1, sw2, sw3, sw4, - si1, si2, si3, si4, - sa1, sa2, sa3, sa4, - sb1, sb2, sb3, sb4, - m, ml, i, il, - vn, uvi, uv2i, - vk, vkl, vka, - nka, chf, faceVertexNormals, - a, - - vertexIndex = 0, - - offset = 0, - offset_uv = 0, - offset_uv2 = 0, - offset_face = 0, - offset_normal = 0, - offset_tangent = 0, - offset_line = 0, - offset_color = 0, - offset_skin = 0, - offset_morphTarget = 0, - offset_custom = 0, - offset_customSrc = 0, - - value, - - vertexArray = geometryGroup.__vertexArray, - uvArray = geometryGroup.__uvArray, - uv2Array = geometryGroup.__uv2Array, - normalArray = geometryGroup.__normalArray, - tangentArray = geometryGroup.__tangentArray, - colorArray = geometryGroup.__colorArray, - - skinIndexArray = geometryGroup.__skinIndexArray, - skinWeightArray = geometryGroup.__skinWeightArray, - - morphTargetsArrays = geometryGroup.__morphTargetsArrays, - morphNormalsArrays = geometryGroup.__morphNormalsArrays, - - customAttributes = geometryGroup.__webglCustomAttributesList, - customAttribute, - - faceArray = geometryGroup.__faceArray, - lineArray = geometryGroup.__lineArray, - - geometry = object.geometry, // this is shared for all chunks - - dirtyVertices = geometry.verticesNeedUpdate, - dirtyElements = geometry.elementsNeedUpdate, - dirtyUvs = geometry.uvsNeedUpdate, - dirtyNormals = geometry.normalsNeedUpdate, - dirtyTangents = geometry.tangentsNeedUpdate, - dirtyColors = geometry.colorsNeedUpdate, - dirtyMorphTargets = geometry.morphTargetsNeedUpdate, - - vertices = geometry.vertices, - chunk_faces3 = geometryGroup.faces3, - obj_faces = geometry.faces, - - obj_uvs = geometry.faceVertexUvs[ 0 ], - obj_uvs2 = geometry.faceVertexUvs[ 1 ], - - obj_colors = geometry.colors, - - obj_skinIndices = geometry.skinIndices, - obj_skinWeights = geometry.skinWeights, - - morphTargets = geometry.morphTargets, - morphNormals = geometry.morphNormals; - - if ( dirtyVertices ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - v1 = vertices[ face.a ]; - v2 = vertices[ face.b ]; - v3 = vertices[ face.c ]; - - vertexArray[ offset ] = v1.x; - vertexArray[ offset + 1 ] = v1.y; - vertexArray[ offset + 2 ] = v1.z; - - vertexArray[ offset + 3 ] = v2.x; - vertexArray[ offset + 4 ] = v2.y; - vertexArray[ offset + 5 ] = v2.z; - - vertexArray[ offset + 6 ] = v3.x; - vertexArray[ offset + 7 ] = v3.y; - vertexArray[ offset + 8 ] = v3.z; - - offset += 9; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); - - } - - if ( dirtyMorphTargets ) { - - for ( vk = 0, vkl = morphTargets.length; vk < vkl; vk ++ ) { - - offset_morphTarget = 0; - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - chf = chunk_faces3[ f ]; - face = obj_faces[ chf ]; - - // morph positions - - v1 = morphTargets[ vk ].vertices[ face.a ]; - v2 = morphTargets[ vk ].vertices[ face.b ]; - v3 = morphTargets[ vk ].vertices[ face.c ]; - - vka = morphTargetsArrays[ vk ]; - - vka[ offset_morphTarget ] = v1.x; - vka[ offset_morphTarget + 1 ] = v1.y; - vka[ offset_morphTarget + 2 ] = v1.z; - - vka[ offset_morphTarget + 3 ] = v2.x; - vka[ offset_morphTarget + 4 ] = v2.y; - vka[ offset_morphTarget + 5 ] = v2.z; - - vka[ offset_morphTarget + 6 ] = v3.x; - vka[ offset_morphTarget + 7 ] = v3.y; - vka[ offset_morphTarget + 8 ] = v3.z; - - // morph normals - - if ( material.morphNormals ) { - - if ( needsSmoothNormals ) { - - faceVertexNormals = morphNormals[ vk ].vertexNormals[ chf ]; - - n1 = faceVertexNormals.a; - n2 = faceVertexNormals.b; - n3 = faceVertexNormals.c; - - } else { - - n1 = morphNormals[ vk ].faceNormals[ chf ]; - n2 = n1; - n3 = n1; - - } - - nka = morphNormalsArrays[ vk ]; - - nka[ offset_morphTarget ] = n1.x; - nka[ offset_morphTarget + 1 ] = n1.y; - nka[ offset_morphTarget + 2 ] = n1.z; - - nka[ offset_morphTarget + 3 ] = n2.x; - nka[ offset_morphTarget + 4 ] = n2.y; - nka[ offset_morphTarget + 5 ] = n2.z; - - nka[ offset_morphTarget + 6 ] = n3.x; - nka[ offset_morphTarget + 7 ] = n3.y; - nka[ offset_morphTarget + 8 ] = n3.z; - - } - - // - - offset_morphTarget += 9; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ vk ] ); - _gl.bufferData( _gl.ARRAY_BUFFER, morphTargetsArrays[ vk ], hint ); - - if ( material.morphNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ vk ] ); - _gl.bufferData( _gl.ARRAY_BUFFER, morphNormalsArrays[ vk ], hint ); - - } - - } - - } - - if ( obj_skinWeights.length ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - // weights - - sw1 = obj_skinWeights[ face.a ]; - sw2 = obj_skinWeights[ face.b ]; - sw3 = obj_skinWeights[ face.c ]; - - skinWeightArray[ offset_skin ] = sw1.x; - skinWeightArray[ offset_skin + 1 ] = sw1.y; - skinWeightArray[ offset_skin + 2 ] = sw1.z; - skinWeightArray[ offset_skin + 3 ] = sw1.w; - - skinWeightArray[ offset_skin + 4 ] = sw2.x; - skinWeightArray[ offset_skin + 5 ] = sw2.y; - skinWeightArray[ offset_skin + 6 ] = sw2.z; - skinWeightArray[ offset_skin + 7 ] = sw2.w; - - skinWeightArray[ offset_skin + 8 ] = sw3.x; - skinWeightArray[ offset_skin + 9 ] = sw3.y; - skinWeightArray[ offset_skin + 10 ] = sw3.z; - skinWeightArray[ offset_skin + 11 ] = sw3.w; - - // indices - - si1 = obj_skinIndices[ face.a ]; - si2 = obj_skinIndices[ face.b ]; - si3 = obj_skinIndices[ face.c ]; - - skinIndexArray[ offset_skin ] = si1.x; - skinIndexArray[ offset_skin + 1 ] = si1.y; - skinIndexArray[ offset_skin + 2 ] = si1.z; - skinIndexArray[ offset_skin + 3 ] = si1.w; - - skinIndexArray[ offset_skin + 4 ] = si2.x; - skinIndexArray[ offset_skin + 5 ] = si2.y; - skinIndexArray[ offset_skin + 6 ] = si2.z; - skinIndexArray[ offset_skin + 7 ] = si2.w; - - skinIndexArray[ offset_skin + 8 ] = si3.x; - skinIndexArray[ offset_skin + 9 ] = si3.y; - skinIndexArray[ offset_skin + 10 ] = si3.z; - skinIndexArray[ offset_skin + 11 ] = si3.w; - - offset_skin += 12; - - } - - if ( offset_skin > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinIndicesBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, skinIndexArray, hint ); - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinWeightsBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, skinWeightArray, hint ); - - } - - } - - if ( dirtyColors && vertexColorType ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - vertexColors = face.vertexColors; - faceColor = face.color; - - if ( vertexColors.length === 3 && vertexColorType === THREE.VertexColors ) { - - c1 = vertexColors[ 0 ]; - c2 = vertexColors[ 1 ]; - c3 = vertexColors[ 2 ]; - - } else { - - c1 = faceColor; - c2 = faceColor; - c3 = faceColor; - - } - - colorArray[ offset_color ] = c1.r; - colorArray[ offset_color + 1 ] = c1.g; - colorArray[ offset_color + 2 ] = c1.b; - - colorArray[ offset_color + 3 ] = c2.r; - colorArray[ offset_color + 4 ] = c2.g; - colorArray[ offset_color + 5 ] = c2.b; - - colorArray[ offset_color + 6 ] = c3.r; - colorArray[ offset_color + 7 ] = c3.g; - colorArray[ offset_color + 8 ] = c3.b; - - offset_color += 9; - - } - - if ( offset_color > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint ); - - } - - } - - if ( dirtyTangents && geometry.hasTangents ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - vertexTangents = face.vertexTangents; - - t1 = vertexTangents[ 0 ]; - t2 = vertexTangents[ 1 ]; - t3 = vertexTangents[ 2 ]; - - tangentArray[ offset_tangent ] = t1.x; - tangentArray[ offset_tangent + 1 ] = t1.y; - tangentArray[ offset_tangent + 2 ] = t1.z; - tangentArray[ offset_tangent + 3 ] = t1.w; - - tangentArray[ offset_tangent + 4 ] = t2.x; - tangentArray[ offset_tangent + 5 ] = t2.y; - tangentArray[ offset_tangent + 6 ] = t2.z; - tangentArray[ offset_tangent + 7 ] = t2.w; - - tangentArray[ offset_tangent + 8 ] = t3.x; - tangentArray[ offset_tangent + 9 ] = t3.y; - tangentArray[ offset_tangent + 10 ] = t3.z; - tangentArray[ offset_tangent + 11 ] = t3.w; - - offset_tangent += 12; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglTangentBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, tangentArray, hint ); - - } - - if ( dirtyNormals && normalType ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - vertexNormals = face.vertexNormals; - faceNormal = face.normal; - - if ( vertexNormals.length === 3 && needsSmoothNormals ) { - - for ( i = 0; i < 3; i ++ ) { - - vn = vertexNormals[ i ]; - - normalArray[ offset_normal ] = vn.x; - normalArray[ offset_normal + 1 ] = vn.y; - normalArray[ offset_normal + 2 ] = vn.z; - - offset_normal += 3; - - } - - } else { - - for ( i = 0; i < 3; i ++ ) { - - normalArray[ offset_normal ] = faceNormal.x; - normalArray[ offset_normal + 1 ] = faceNormal.y; - normalArray[ offset_normal + 2 ] = faceNormal.z; - - offset_normal += 3; - - } - - } - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglNormalBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, normalArray, hint ); - - } - - if ( dirtyUvs && obj_uvs && uvType ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - fi = chunk_faces3[ f ]; - - uv = obj_uvs[ fi ]; - - if ( uv === undefined ) continue; - - for ( i = 0; i < 3; i ++ ) { - - uvi = uv[ i ]; - - uvArray[ offset_uv ] = uvi.x; - uvArray[ offset_uv + 1 ] = uvi.y; - - offset_uv += 2; - - } - - } - - if ( offset_uv > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUVBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, uvArray, hint ); - - } - - } - - if ( dirtyUvs && obj_uvs2 && uvType ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - fi = chunk_faces3[ f ]; - - uv2 = obj_uvs2[ fi ]; - - if ( uv2 === undefined ) continue; - - for ( i = 0; i < 3; i ++ ) { - - uv2i = uv2[ i ]; - - uv2Array[ offset_uv2 ] = uv2i.x; - uv2Array[ offset_uv2 + 1 ] = uv2i.y; - - offset_uv2 += 2; - - } - - } - - if ( offset_uv2 > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUV2Buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, uv2Array, hint ); - - } - - } - - if ( dirtyElements ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - faceArray[ offset_face ] = vertexIndex; - faceArray[ offset_face + 1 ] = vertexIndex + 1; - faceArray[ offset_face + 2 ] = vertexIndex + 2; - - offset_face += 3; - - lineArray[ offset_line ] = vertexIndex; - lineArray[ offset_line + 1 ] = vertexIndex + 1; - - lineArray[ offset_line + 2 ] = vertexIndex; - lineArray[ offset_line + 3 ] = vertexIndex + 2; - - lineArray[ offset_line + 4 ] = vertexIndex + 1; - lineArray[ offset_line + 5 ] = vertexIndex + 2; - - offset_line += 6; - - vertexIndex += 3; - - } - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglFaceBuffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, faceArray, hint ); - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglLineBuffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, lineArray, hint ); - - } - - if ( customAttributes ) { - - for ( i = 0, il = customAttributes.length; i < il; i ++ ) { - - customAttribute = customAttributes[ i ]; - - if ( ! customAttribute.__original.needsUpdate ) continue; - - offset_custom = 0; - offset_customSrc = 0; - - if ( customAttribute.size === 1 ) { - - if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - customAttribute.array[ offset_custom ] = customAttribute.value[ face.a ]; - customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ]; - customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ]; - - offset_custom += 3; - - } - - } else if ( customAttribute.boundTo === "faces" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - customAttribute.array[ offset_custom ] = value; - customAttribute.array[ offset_custom + 1 ] = value; - customAttribute.array[ offset_custom + 2 ] = value; - - offset_custom += 3; - - } - - } - - } else if ( customAttribute.size === 2 ) { - - if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - v1 = customAttribute.value[ face.a ]; - v2 = customAttribute.value[ face.b ]; - v3 = customAttribute.value[ face.c ]; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - - customAttribute.array[ offset_custom + 2 ] = v2.x; - customAttribute.array[ offset_custom + 3 ] = v2.y; - - customAttribute.array[ offset_custom + 4 ] = v3.x; - customAttribute.array[ offset_custom + 5 ] = v3.y; - - offset_custom += 6; - - } - - } else if ( customAttribute.boundTo === "faces" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value; - v2 = value; - v3 = value; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - - customAttribute.array[ offset_custom + 2 ] = v2.x; - customAttribute.array[ offset_custom + 3 ] = v2.y; - - customAttribute.array[ offset_custom + 4 ] = v3.x; - customAttribute.array[ offset_custom + 5 ] = v3.y; - - offset_custom += 6; - - } - - } - - } else if ( customAttribute.size === 3 ) { - - var pp; - - if ( customAttribute.type === "c" ) { - - pp = [ "r", "g", "b" ]; - - } else { - - pp = [ "x", "y", "z" ]; - - } - - if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - v1 = customAttribute.value[ face.a ]; - v2 = customAttribute.value[ face.b ]; - v3 = customAttribute.value[ face.c ]; - - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ]; - - offset_custom += 9; - - } - - } else if ( customAttribute.boundTo === "faces" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value; - v2 = value; - v3 = value; - - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ]; - - offset_custom += 9; - - } - - } else if ( customAttribute.boundTo === "faceVertices" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value[ 0 ]; - v2 = value[ 1 ]; - v3 = value[ 2 ]; - - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ]; - - offset_custom += 9; - - } - - } - - } else if ( customAttribute.size === 4 ) { - - if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - v1 = customAttribute.value[ face.a ]; - v2 = customAttribute.value[ face.b ]; - v3 = customAttribute.value[ face.c ]; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - customAttribute.array[ offset_custom + 2 ] = v1.z; - customAttribute.array[ offset_custom + 3 ] = v1.w; - - customAttribute.array[ offset_custom + 4 ] = v2.x; - customAttribute.array[ offset_custom + 5 ] = v2.y; - customAttribute.array[ offset_custom + 6 ] = v2.z; - customAttribute.array[ offset_custom + 7 ] = v2.w; - - customAttribute.array[ offset_custom + 8 ] = v3.x; - customAttribute.array[ offset_custom + 9 ] = v3.y; - customAttribute.array[ offset_custom + 10 ] = v3.z; - customAttribute.array[ offset_custom + 11 ] = v3.w; - - offset_custom += 12; - - } - - } else if ( customAttribute.boundTo === "faces" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value; - v2 = value; - v3 = value; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - customAttribute.array[ offset_custom + 2 ] = v1.z; - customAttribute.array[ offset_custom + 3 ] = v1.w; - - customAttribute.array[ offset_custom + 4 ] = v2.x; - customAttribute.array[ offset_custom + 5 ] = v2.y; - customAttribute.array[ offset_custom + 6 ] = v2.z; - customAttribute.array[ offset_custom + 7 ] = v2.w; - - customAttribute.array[ offset_custom + 8 ] = v3.x; - customAttribute.array[ offset_custom + 9 ] = v3.y; - customAttribute.array[ offset_custom + 10 ] = v3.z; - customAttribute.array[ offset_custom + 11 ] = v3.w; - - offset_custom += 12; - - } - - } else if ( customAttribute.boundTo === "faceVertices" ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value[ 0 ]; - v2 = value[ 1 ]; - v3 = value[ 2 ]; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - customAttribute.array[ offset_custom + 2 ] = v1.z; - customAttribute.array[ offset_custom + 3 ] = v1.w; - - customAttribute.array[ offset_custom + 4 ] = v2.x; - customAttribute.array[ offset_custom + 5 ] = v2.y; - customAttribute.array[ offset_custom + 6 ] = v2.z; - customAttribute.array[ offset_custom + 7 ] = v2.w; - - customAttribute.array[ offset_custom + 8 ] = v3.x; - customAttribute.array[ offset_custom + 9 ] = v3.y; - customAttribute.array[ offset_custom + 10 ] = v3.z; - customAttribute.array[ offset_custom + 11 ] = v3.w; - - offset_custom += 12; - - } - - } - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint ); - - } - - } - - if ( dispose ) { - - delete geometryGroup.__inittedArrays; - delete geometryGroup.__colorArray; - delete geometryGroup.__normalArray; - delete geometryGroup.__tangentArray; - delete geometryGroup.__uvArray; - delete geometryGroup.__uv2Array; - delete geometryGroup.__faceArray; - delete geometryGroup.__vertexArray; - delete geometryGroup.__lineArray; - delete geometryGroup.__skinIndexArray; - delete geometryGroup.__skinWeightArray; - - } - - }; - - // used by renderBufferDirect for THREE.Line - function setupLinesVertexAttributes( material, programAttributes, geometryAttributes, startIndex ) { - - var attributeItem, attributeName, attributePointer, attributeSize; - - for ( attributeName in programAttributes ) { - - attributePointer = programAttributes[ attributeName ]; - attributeItem = geometryAttributes[ attributeName ]; - - if ( attributePointer >= 0 ) { - - if ( attributeItem ) { - - attributeSize = attributeItem.itemSize; - _gl.bindBuffer( _gl.ARRAY_BUFFER, attributeItem.buffer ); - enableAttribute( attributePointer ); - _gl.vertexAttribPointer( attributePointer, attributeSize, _gl.FLOAT, false, 0, startIndex * attributeSize * 4 ); // 4 bytes per Float32 - - } else if ( material.defaultAttributeValues ) { - - if ( material.defaultAttributeValues[ attributeName ].length === 2 ) { - - _gl.vertexAttrib2fv( attributePointer, material.defaultAttributeValues[ attributeName ] ); - - } else if ( material.defaultAttributeValues[ attributeName ].length === 3 ) { - - _gl.vertexAttrib3fv( attributePointer, material.defaultAttributeValues[ attributeName ] ); - - } - - } - - } - - } - - } - - function setDirectBuffers( geometry, hint ) { - - var attributes = geometry.attributes; - - var attributeName, attributeItem; - - for ( attributeName in attributes ) { - - attributeItem = attributes[ attributeName ]; - - if ( attributeItem.needsUpdate ) { - - if ( attributeName === 'index' ) { - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, attributeItem.buffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, attributeItem.array, hint ); - - } else { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, attributeItem.buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, attributeItem.array, hint ); - - } - - attributeItem.needsUpdate = false; - - } - - } - - } - - // Buffer rendering - - this.renderBufferImmediate = function ( object, program, material ) { - - if ( object.hasPositions && ! object.__webglVertexBuffer ) object.__webglVertexBuffer = _gl.createBuffer(); - if ( object.hasNormals && ! object.__webglNormalBuffer ) object.__webglNormalBuffer = _gl.createBuffer(); - if ( object.hasUvs && ! object.__webglUvBuffer ) object.__webglUvBuffer = _gl.createBuffer(); - if ( object.hasColors && ! object.__webglColorBuffer ) object.__webglColorBuffer = _gl.createBuffer(); - - if ( object.hasPositions ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW ); - _gl.enableVertexAttribArray( program.attributes.position ); - _gl.vertexAttribPointer( program.attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglNormalBuffer ); - - if ( material.shading === THREE.FlatShading ) { - - var nx, ny, nz, - nax, nbx, ncx, nay, nby, ncy, naz, nbz, ncz, - normalArray, - i, il = object.count * 3; - - for( i = 0; i < il; i += 9 ) { - - normalArray = object.normalArray; - - nax = normalArray[ i ]; - nay = normalArray[ i + 1 ]; - naz = normalArray[ i + 2 ]; - - nbx = normalArray[ i + 3 ]; - nby = normalArray[ i + 4 ]; - nbz = normalArray[ i + 5 ]; - - ncx = normalArray[ i + 6 ]; - ncy = normalArray[ i + 7 ]; - ncz = normalArray[ i + 8 ]; - - nx = ( nax + nbx + ncx ) / 3; - ny = ( nay + nby + ncy ) / 3; - nz = ( naz + nbz + ncz ) / 3; - - normalArray[ i ] = nx; - normalArray[ i + 1 ] = ny; - normalArray[ i + 2 ] = nz; - - normalArray[ i + 3 ] = nx; - normalArray[ i + 4 ] = ny; - normalArray[ i + 5 ] = nz; - - normalArray[ i + 6 ] = nx; - normalArray[ i + 7 ] = ny; - normalArray[ i + 8 ] = nz; - - } - - } - - _gl.bufferData( _gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW ); - _gl.enableVertexAttribArray( program.attributes.normal ); - _gl.vertexAttribPointer( program.attributes.normal, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasUvs && material.map ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglUvBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW ); - _gl.enableVertexAttribArray( program.attributes.uv ); - _gl.vertexAttribPointer( program.attributes.uv, 2, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasColors && material.vertexColors !== THREE.NoColors ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW ); - _gl.enableVertexAttribArray( program.attributes.color ); - _gl.vertexAttribPointer( program.attributes.color, 3, _gl.FLOAT, false, 0, 0 ); - - } - - _gl.drawArrays( _gl.TRIANGLES, 0, object.count ); - - object.count = 0; - - }; - - this.renderBufferDirect = function ( camera, lights, fog, material, geometry, object ) { - - if ( material.visible === false ) return; - - var linewidth, a, attribute; - var attributeItem, attributeName, attributePointer, attributeSize; - - var program = setProgram( camera, lights, fog, material, object ); - - var programAttributes = program.attributes; - var geometryAttributes = geometry.attributes; - - var updateBuffers = false, - wireframeBit = material.wireframe ? 1 : 0, - geometryHash = ( geometry.id * 0xffffff ) + ( program.id * 2 ) + wireframeBit; - - if ( geometryHash !== _currentGeometryGroupHash ) { - - _currentGeometryGroupHash = geometryHash; - updateBuffers = true; - - } - - if ( updateBuffers ) { - - disableAttributes(); - - } - - // render mesh - - if ( object instanceof THREE.Mesh ) { - - var index = geometryAttributes[ "index" ]; - - // indexed triangles - - if ( index ) { - - var offsets = geometry.offsets; - - // if there is more than 1 chunk - // must set attribute pointers to use new offsets for each chunk - // even if geometry and materials didn't change - - if ( offsets.length > 1 ) updateBuffers = true; - - for ( var i = 0, il = offsets.length; i < il; i ++ ) { - - var startIndex = offsets[ i ].index; - - if ( updateBuffers ) { - - for ( attributeName in programAttributes ) { - - attributePointer = programAttributes[ attributeName ]; - attributeItem = geometryAttributes[ attributeName ]; - - if ( attributePointer >= 0 ) { - - if ( attributeItem ) { - - attributeSize = attributeItem.itemSize; - _gl.bindBuffer( _gl.ARRAY_BUFFER, attributeItem.buffer ); - enableAttribute( attributePointer ); - _gl.vertexAttribPointer( attributePointer, attributeSize, _gl.FLOAT, false, 0, startIndex * attributeSize * 4 ); // 4 bytes per Float32 - - } else if ( material.defaultAttributeValues ) { - - if ( material.defaultAttributeValues[ attributeName ].length === 2 ) { - - _gl.vertexAttrib2fv( attributePointer, material.defaultAttributeValues[ attributeName ] ); - - } else if ( material.defaultAttributeValues[ attributeName ].length === 3 ) { - - _gl.vertexAttrib3fv( attributePointer, material.defaultAttributeValues[ attributeName ] ); - - } - - } - - } - - } - - // indices - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); - - } - - // render indexed triangles - - _gl.drawElements( _gl.TRIANGLES, offsets[ i ].count, _gl.UNSIGNED_SHORT, offsets[ i ].start * 2 ); // 2 bytes per Uint16 - - _this.info.render.calls ++; - _this.info.render.vertices += offsets[ i ].count; // not really true, here vertices can be shared - _this.info.render.faces += offsets[ i ].count / 3; - - } - - // non-indexed triangles - - } else { - - if ( updateBuffers ) { - - for ( attributeName in programAttributes ) { - - if ( attributeName === 'index') continue; - - attributePointer = programAttributes[ attributeName ]; - attributeItem = geometryAttributes[ attributeName ]; - - if ( attributePointer >= 0 ) { - - if ( attributeItem ) { - - attributeSize = attributeItem.itemSize; - _gl.bindBuffer( _gl.ARRAY_BUFFER, attributeItem.buffer ); - enableAttribute( attributePointer ); - _gl.vertexAttribPointer( attributePointer, attributeSize, _gl.FLOAT, false, 0, 0 ); - - } else if ( material.defaultAttributeValues && material.defaultAttributeValues[ attributeName ] ) { - - if ( material.defaultAttributeValues[ attributeName ].length === 2 ) { - - _gl.vertexAttrib2fv( attributePointer, material.defaultAttributeValues[ attributeName ] ); - - } else if ( material.defaultAttributeValues[ attributeName ].length === 3 ) { - - _gl.vertexAttrib3fv( attributePointer, material.defaultAttributeValues[ attributeName ] ); - - } - - } - - } - - } - - } - - var position = geometry.attributes[ "position" ]; - - // render non-indexed triangles - - _gl.drawArrays( _gl.TRIANGLES, 0, position.array.length / 3 ); - - _this.info.render.calls ++; - _this.info.render.vertices += position.array.length / 3; - _this.info.render.faces += position.array.length / 3 / 3; - - } - - // render particles - - } else if ( object instanceof THREE.ParticleSystem ) { - - if ( updateBuffers ) { - - for ( attributeName in programAttributes ) { - - attributePointer = programAttributes[ attributeName ]; - attributeItem = geometryAttributes[ attributeName ]; - - if ( attributePointer >= 0 ) { - - if ( attributeItem ) { - - attributeSize = attributeItem.itemSize; - _gl.bindBuffer( _gl.ARRAY_BUFFER, attributeItem.buffer ); - enableAttribute( attributePointer ); - _gl.vertexAttribPointer( attributePointer, attributeSize, _gl.FLOAT, false, 0, 0 ); - - } else if ( material.defaultAttributeValues && material.defaultAttributeValues[ attributeName ] ) { - - if ( material.defaultAttributeValues[ attributeName ].length === 2 ) { - - _gl.vertexAttrib2fv( attributePointer, material.defaultAttributeValues[ attributeName ] ); - - } else if ( material.defaultAttributeValues[ attributeName ].length === 3 ) { - - _gl.vertexAttrib3fv( attributePointer, material.defaultAttributeValues[ attributeName ] ); - - } - - } - - } - - } - - } - - var position = geometryAttributes[ "position" ]; - - // render particles - - _gl.drawArrays( _gl.POINTS, 0, position.array.length / 3 ); - - _this.info.render.calls ++; - _this.info.render.points += position.array.length / 3; - - } else if ( object instanceof THREE.Line ) { - - var primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES; - - setLineWidth( material.linewidth ); - - var index = geometryAttributes[ "index" ]; - - // indexed lines - - if ( index ) { - - var offsets = geometry.offsets; - - // if there is more than 1 chunk - // must set attribute pointers to use new offsets for each chunk - // even if geometry and materials didn't change - - if ( offsets.length > 1 ) updateBuffers = true; - - for ( var i = 0, il = offsets.length; i < il; i ++ ) { - - var startIndex = offsets[ i ].index; - - if ( updateBuffers ) { - - setupLinesVertexAttributes(material, programAttributes, geometryAttributes, startIndex); - - // indices - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); - - } - - // render indexed lines - - _gl.drawElements( _gl.LINES, offsets[ i ].count, _gl.UNSIGNED_SHORT, offsets[ i ].start * 2 ); // 2 bytes per Uint16Array - - _this.info.render.calls ++; - _this.info.render.vertices += offsets[ i ].count; // not really true, here vertices can be shared - - } - - } - - // non-indexed lines - - else { - - if ( updateBuffers ) { - - setupLinesVertexAttributes(material, programAttributes, geometryAttributes, 0); - } - - var position = geometryAttributes[ "position" ]; - - _gl.drawArrays( primitives, 0, position.array.length / 3 ); - _this.info.render.calls ++; - _this.info.render.points += position.array.length; - } - - - - } - - }; - - this.renderBuffer = function ( camera, lights, fog, material, geometryGroup, object ) { - - if ( material.visible === false ) return; - - var linewidth, a, attribute, i, il; - - var program = setProgram( camera, lights, fog, material, object ); - - var attributes = program.attributes; - - var updateBuffers = false, - wireframeBit = material.wireframe ? 1 : 0, - geometryGroupHash = ( geometryGroup.id * 0xffffff ) + ( program.id * 2 ) + wireframeBit; - - if ( geometryGroupHash !== _currentGeometryGroupHash ) { - - _currentGeometryGroupHash = geometryGroupHash; - updateBuffers = true; - - } - - if ( updateBuffers ) { - - disableAttributes(); - - } - - // vertices - - if ( !material.morphTargets && attributes.position >= 0 ) { - - if ( updateBuffers ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer ); - enableAttribute( attributes.position ); - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - } else { - - if ( object.morphTargetBase ) { - - setupMorphTargets( material, geometryGroup, object ); - - } - - } - - - if ( updateBuffers ) { - - // custom attributes - - // Use the per-geometryGroup custom attribute arrays which are setup in initMeshBuffers - - if ( geometryGroup.__webglCustomAttributesList ) { - - for ( i = 0, il = geometryGroup.__webglCustomAttributesList.length; i < il; i ++ ) { - - attribute = geometryGroup.__webglCustomAttributesList[ i ]; - - if ( attributes[ attribute.buffer.belongsToAttribute ] >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, attribute.buffer ); - enableAttribute( attributes[ attribute.buffer.belongsToAttribute ] ); - _gl.vertexAttribPointer( attributes[ attribute.buffer.belongsToAttribute ], attribute.size, _gl.FLOAT, false, 0, 0 ); - - } - - } - - } - - - // colors - - if ( attributes.color >= 0 ) { - - if ( object.geometry.colors.length > 0 || object.geometry.faces.length > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglColorBuffer ); - enableAttribute( attributes.color ); - _gl.vertexAttribPointer( attributes.color, 3, _gl.FLOAT, false, 0, 0 ); - - } else if ( material.defaultAttributeValues ) { - - - _gl.vertexAttrib3fv( attributes.color, material.defaultAttributeValues.color ); - - } - - } - - // normals - - if ( attributes.normal >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglNormalBuffer ); - enableAttribute( attributes.normal ); - _gl.vertexAttribPointer( attributes.normal, 3, _gl.FLOAT, false, 0, 0 ); - - } - - // tangents - - if ( attributes.tangent >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglTangentBuffer ); - enableAttribute( attributes.tangent ); - _gl.vertexAttribPointer( attributes.tangent, 4, _gl.FLOAT, false, 0, 0 ); - - } - - // uvs - - if ( attributes.uv >= 0 ) { - - if ( object.geometry.faceVertexUvs[0] ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUVBuffer ); - enableAttribute( attributes.uv ); - _gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 0, 0 ); - - } else if ( material.defaultAttributeValues ) { - - - _gl.vertexAttrib2fv( attributes.uv, material.defaultAttributeValues.uv ); - - } - - } - - if ( attributes.uv2 >= 0 ) { - - if ( object.geometry.faceVertexUvs[1] ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUV2Buffer ); - enableAttribute( attributes.uv2 ); - _gl.vertexAttribPointer( attributes.uv2, 2, _gl.FLOAT, false, 0, 0 ); - - } else if ( material.defaultAttributeValues ) { - - - _gl.vertexAttrib2fv( attributes.uv2, material.defaultAttributeValues.uv2 ); - - } - - } - - if ( material.skinning && - attributes.skinIndex >= 0 && attributes.skinWeight >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinIndicesBuffer ); - enableAttribute( attributes.skinIndex ); - _gl.vertexAttribPointer( attributes.skinIndex, 4, _gl.FLOAT, false, 0, 0 ); - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinWeightsBuffer ); - enableAttribute( attributes.skinWeight ); - _gl.vertexAttribPointer( attributes.skinWeight, 4, _gl.FLOAT, false, 0, 0 ); - - } - - // line distances - - if ( attributes.lineDistance >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglLineDistanceBuffer ); - enableAttribute( attributes.lineDistance ); - _gl.vertexAttribPointer( attributes.lineDistance, 1, _gl.FLOAT, false, 0, 0 ); - - } - - } - - // render mesh - - if ( object instanceof THREE.Mesh ) { - - // wireframe - - if ( material.wireframe ) { - - setLineWidth( material.wireframeLinewidth ); - - if ( updateBuffers ) _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglLineBuffer ); - _gl.drawElements( _gl.LINES, geometryGroup.__webglLineCount, _gl.UNSIGNED_SHORT, 0 ); - - // triangles - - } else { - - if ( updateBuffers ) _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglFaceBuffer ); - _gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, _gl.UNSIGNED_SHORT, 0 ); - - } - - _this.info.render.calls ++; - _this.info.render.vertices += geometryGroup.__webglFaceCount; - _this.info.render.faces += geometryGroup.__webglFaceCount / 3; - - // render lines - - } else if ( object instanceof THREE.Line ) { - - var primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES; - - setLineWidth( material.linewidth ); - - _gl.drawArrays( primitives, 0, geometryGroup.__webglLineCount ); - - _this.info.render.calls ++; - - // render particles - - } else if ( object instanceof THREE.ParticleSystem ) { - - _gl.drawArrays( _gl.POINTS, 0, geometryGroup.__webglParticleCount ); - - _this.info.render.calls ++; - _this.info.render.points += geometryGroup.__webglParticleCount; - - } - - }; - - function enableAttribute( attribute ) { - - if ( _enabledAttributes[ attribute ] === 0 ) { - - _gl.enableVertexAttribArray( attribute ); - _enabledAttributes[ attribute ] = 1; - - } - - }; - - function disableAttributes() { - - for ( var attribute in _enabledAttributes ) { - - if ( _enabledAttributes[ attribute ] === 1 ) { - - _gl.disableVertexAttribArray( attribute ); - _enabledAttributes[ attribute ] = 0; - - } - - } - - }; - - function setupMorphTargets ( material, geometryGroup, object ) { - - // set base - - var attributes = material.program.attributes; - - if ( object.morphTargetBase !== -1 && attributes.position >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ object.morphTargetBase ] ); - enableAttribute( attributes.position ); - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } else if ( attributes.position >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer ); - enableAttribute( attributes.position ); - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.morphTargetForcedOrder.length ) { - - // set forced order - - var m = 0; - var order = object.morphTargetForcedOrder; - var influences = object.morphTargetInfluences; - - while ( m < material.numSupportedMorphTargets && m < order.length ) { - - if ( attributes[ "morphTarget" + m ] >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ order[ m ] ] ); - enableAttribute( attributes[ "morphTarget" + m ] ); - _gl.vertexAttribPointer( attributes[ "morphTarget" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( attributes[ "morphNormal" + m ] >= 0 && material.morphNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ order[ m ] ] ); - enableAttribute( attributes[ "morphNormal" + m ] ); - _gl.vertexAttribPointer( attributes[ "morphNormal" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - } - - object.__webglMorphTargetInfluences[ m ] = influences[ order[ m ] ]; - - m ++; - } - - } else { - - // find the most influencing - - var influence, activeInfluenceIndices = []; - var influences = object.morphTargetInfluences; - var i, il = influences.length; - - for ( i = 0; i < il; i ++ ) { - - influence = influences[ i ]; - - if ( influence > 0 ) { - - activeInfluenceIndices.push( [ influence, i ] ); - - } - - } - - if ( activeInfluenceIndices.length > material.numSupportedMorphTargets ) { - - activeInfluenceIndices.sort( numericalSort ); - activeInfluenceIndices.length = material.numSupportedMorphTargets; - - } else if ( activeInfluenceIndices.length > material.numSupportedMorphNormals ) { - - activeInfluenceIndices.sort( numericalSort ); - - } else if ( activeInfluenceIndices.length === 0 ) { - - activeInfluenceIndices.push( [ 0, 0 ] ); - - }; - - var influenceIndex, m = 0; - - while ( m < material.numSupportedMorphTargets ) { - - if ( activeInfluenceIndices[ m ] ) { - - influenceIndex = activeInfluenceIndices[ m ][ 1 ]; - - if ( attributes[ "morphTarget" + m ] >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ influenceIndex ] ); - enableAttribute( attributes[ "morphTarget" + m ] ); - _gl.vertexAttribPointer( attributes[ "morphTarget" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( attributes[ "morphNormal" + m ] >= 0 && material.morphNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ influenceIndex ] ); - enableAttribute( attributes[ "morphNormal" + m ] ); - _gl.vertexAttribPointer( attributes[ "morphNormal" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - - } - - object.__webglMorphTargetInfluences[ m ] = influences[ influenceIndex ]; - - } else { - - /* - _gl.vertexAttribPointer( attributes[ "morphTarget" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - if ( material.morphNormals ) { - - _gl.vertexAttribPointer( attributes[ "morphNormal" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - } - */ - - object.__webglMorphTargetInfluences[ m ] = 0; - - } - - m ++; - - } - - } - - // load updated influences uniform - - if ( material.program.uniforms.morphTargetInfluences !== null ) { - - _gl.uniform1fv( material.program.uniforms.morphTargetInfluences, object.__webglMorphTargetInfluences ); - - } - - }; - - // Sorting - - function painterSortStable ( a, b ) { - - if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return a.id - b.id; - - } - - }; - - function numericalSort ( a, b ) { - - return b[ 0 ] - a[ 0 ]; - - }; - - - // Rendering - - this.render = function ( scene, camera, renderTarget, forceClear ) { - - if ( camera instanceof THREE.Camera === false ) { - - console.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' ); - return; - - } - - var i, il, - - webglObject, object, - renderList, - - lights = scene.__lights, - fog = scene.fog; - - // reset caching for this frame - - _currentMaterialId = -1; - _lightsNeedUpdate = true; - - // update scene graph - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - - // update camera matrices and frustum - - if ( camera.parent === undefined ) camera.updateMatrixWorld(); - - camera.matrixWorldInverse.getInverse( camera.matrixWorld ); - - _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - // update WebGL objects - - if ( this.autoUpdateObjects ) this.initWebGLObjects( scene ); - - // custom render plugins (pre pass) - - renderPlugins( this.renderPluginsPre, scene, camera ); - - // - - _this.info.render.calls = 0; - _this.info.render.vertices = 0; - _this.info.render.faces = 0; - _this.info.render.points = 0; - - this.setRenderTarget( renderTarget ); - - if ( this.autoClear || forceClear ) { - - this.clear( this.autoClearColor, this.autoClearDepth, this.autoClearStencil ); - - } - - // set matrices for regular objects (frustum culled) - - renderList = scene.__webglObjects; - - for ( i = 0, il = renderList.length; i < il; i ++ ) { - - webglObject = renderList[ i ]; - object = webglObject.object; - - webglObject.id = i; - webglObject.render = false; - - if ( object.visible ) { - - if ( ! ( object instanceof THREE.Mesh || object instanceof THREE.ParticleSystem ) || ! ( object.frustumCulled ) || _frustum.intersectsObject( object ) ) { - - setupMatrices( object, camera ); - - unrollBufferMaterial( webglObject ); - - webglObject.render = true; - - if ( this.sortObjects === true ) { - - if ( object.renderDepth !== null ) { - - webglObject.z = object.renderDepth; - - } else { - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyProjection( _projScreenMatrix ); - - webglObject.z = _vector3.z; - - } - - } - - } - - } - - } - - if ( this.sortObjects ) { - - renderList.sort( painterSortStable ); - - } - - // set matrices for immediate objects - - renderList = scene.__webglObjectsImmediate; - - for ( i = 0, il = renderList.length; i < il; i ++ ) { - - webglObject = renderList[ i ]; - object = webglObject.object; - - if ( object.visible ) { - - setupMatrices( object, camera ); - - unrollImmediateBufferMaterial( webglObject ); - - } - - } - - if ( scene.overrideMaterial ) { - - var material = scene.overrideMaterial; - - this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst ); - this.setDepthTest( material.depthTest ); - this.setDepthWrite( material.depthWrite ); - setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - - renderObjects( scene.__webglObjects, false, "", camera, lights, fog, true, material ); - renderObjectsImmediate( scene.__webglObjectsImmediate, "", camera, lights, fog, false, material ); - - } else { - - var material = null; - - // opaque pass (front-to-back order) - - this.setBlending( THREE.NoBlending ); - - renderObjects( scene.__webglObjects, true, "opaque", camera, lights, fog, false, material ); - renderObjectsImmediate( scene.__webglObjectsImmediate, "opaque", camera, lights, fog, false, material ); - - // transparent pass (back-to-front order) - - renderObjects( scene.__webglObjects, false, "transparent", camera, lights, fog, true, material ); - renderObjectsImmediate( scene.__webglObjectsImmediate, "transparent", camera, lights, fog, true, material ); - - } - - // custom render plugins (post pass) - - renderPlugins( this.renderPluginsPost, scene, camera ); - - - // Generate mipmap if we're using any kind of mipmap filtering - - if ( renderTarget && renderTarget.generateMipmaps && renderTarget.minFilter !== THREE.NearestFilter && renderTarget.minFilter !== THREE.LinearFilter ) { - - updateRenderTargetMipmap( renderTarget ); - - } - - // Ensure depth buffer writing is enabled so it can be cleared on next render - - this.setDepthTest( true ); - this.setDepthWrite( true ); - - // _gl.finish(); - - }; - - function renderPlugins( plugins, scene, camera ) { - - if ( ! plugins.length ) return; - - for ( var i = 0, il = plugins.length; i < il; i ++ ) { - - // reset state for plugin (to start from clean slate) - - _currentProgram = null; - _currentCamera = null; - - _oldBlending = -1; - _oldDepthTest = -1; - _oldDepthWrite = -1; - _oldDoubleSided = -1; - _oldFlipSided = -1; - _currentGeometryGroupHash = -1; - _currentMaterialId = -1; - - _lightsNeedUpdate = true; - - plugins[ i ].render( scene, camera, _currentWidth, _currentHeight ); - - // reset state after plugin (anything could have changed) - - _currentProgram = null; - _currentCamera = null; - - _oldBlending = -1; - _oldDepthTest = -1; - _oldDepthWrite = -1; - _oldDoubleSided = -1; - _oldFlipSided = -1; - _currentGeometryGroupHash = -1; - _currentMaterialId = -1; - - _lightsNeedUpdate = true; - - } - - }; - - function renderObjects( renderList, reverse, materialType, camera, lights, fog, useBlending, overrideMaterial ) { - - var webglObject, object, buffer, material, start, end, delta; - - if ( reverse ) { - - start = renderList.length - 1; - end = -1; - delta = -1; - - } else { - - start = 0; - end = renderList.length; - delta = 1; - } - - for ( var i = start; i !== end; i += delta ) { - - webglObject = renderList[ i ]; - - if ( webglObject.render ) { - - object = webglObject.object; - buffer = webglObject.buffer; - - if ( overrideMaterial ) { - - material = overrideMaterial; - - } else { - - material = webglObject[ materialType ]; - - if ( ! material ) continue; - - if ( useBlending ) _this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst ); - - _this.setDepthTest( material.depthTest ); - _this.setDepthWrite( material.depthWrite ); - setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - - } - - _this.setMaterialFaces( material ); - - if ( buffer instanceof THREE.BufferGeometry ) { - - _this.renderBufferDirect( camera, lights, fog, material, buffer, object ); - - } else { - - _this.renderBuffer( camera, lights, fog, material, buffer, object ); - - } - - } - - } - - }; - - function renderObjectsImmediate ( renderList, materialType, camera, lights, fog, useBlending, overrideMaterial ) { - - var webglObject, object, material, program; - - for ( var i = 0, il = renderList.length; i < il; i ++ ) { - - webglObject = renderList[ i ]; - object = webglObject.object; - - if ( object.visible ) { - - if ( overrideMaterial ) { - - material = overrideMaterial; - - } else { - - material = webglObject[ materialType ]; - - if ( ! material ) continue; - - if ( useBlending ) _this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst ); - - _this.setDepthTest( material.depthTest ); - _this.setDepthWrite( material.depthWrite ); - setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - - } - - _this.renderImmediateObject( camera, lights, fog, material, object ); - - } - - } - - }; - - this.renderImmediateObject = function ( camera, lights, fog, material, object ) { - - var program = setProgram( camera, lights, fog, material, object ); - - _currentGeometryGroupHash = -1; - - _this.setMaterialFaces( material ); - - if ( object.immediateRenderCallback ) { - - object.immediateRenderCallback( program, _gl, _frustum ); - - } else { - - object.render( function( object ) { _this.renderBufferImmediate( object, program, material ); } ); - - } - - }; - - function unrollImmediateBufferMaterial ( globject ) { - - var object = globject.object, - material = object.material; - - if ( material.transparent ) { - - globject.transparent = material; - globject.opaque = null; - - } else { - - globject.opaque = material; - globject.transparent = null; - - } - - }; - - function unrollBufferMaterial ( globject ) { - - var object = globject.object; - var buffer = globject.buffer; - - var geometry = object.geometry; - var material = object.material; - - if ( material instanceof THREE.MeshFaceMaterial ) { - - var materialIndex = geometry instanceof THREE.BufferGeometry ? 0 : buffer.materialIndex; - - material = material.materials[ materialIndex ]; - - if ( material.transparent ) { - - globject.transparent = material; - globject.opaque = null; - - } else { - - globject.opaque = material; - globject.transparent = null; - - } - - } else { - - if ( material ) { - - if ( material.transparent ) { - - globject.transparent = material; - globject.opaque = null; - - } else { - - globject.opaque = material; - globject.transparent = null; - - } - - } - - } - - }; - - // Objects refresh - - this.initWebGLObjects = function ( scene ) { - - if ( !scene.__webglObjects ) { - - scene.__webglObjects = []; - scene.__webglObjectsImmediate = []; - scene.__webglSprites = []; - scene.__webglFlares = []; - - } - - while ( scene.__objectsAdded.length ) { - - addObject( scene.__objectsAdded[ 0 ], scene ); - scene.__objectsAdded.splice( 0, 1 ); - - } - - while ( scene.__objectsRemoved.length ) { - - removeObject( scene.__objectsRemoved[ 0 ], scene ); - scene.__objectsRemoved.splice( 0, 1 ); - - } - - // update must be called after objects adding / removal - - for ( var o = 0, ol = scene.__webglObjects.length; o < ol; o ++ ) { - - var object = scene.__webglObjects[ o ].object; - - // TODO: Remove this hack (WebGLRenderer refactoring) - - if ( object.__webglInit === undefined ) { - - if ( object.__webglActive !== undefined ) { - - removeObject( object, scene ); - - } - - addObject( object, scene ); - - } - - updateObject( object ); - - } - - }; - - // Objects adding - - function addObject( object, scene ) { - - var g, geometry, material, geometryGroup; - - if ( object.__webglInit === undefined ) { - - object.__webglInit = true; - - object._modelViewMatrix = new THREE.Matrix4(); - object._normalMatrix = new THREE.Matrix3(); - - if ( object.geometry !== undefined && object.geometry.__webglInit === undefined ) { - - object.geometry.__webglInit = true; - object.geometry.addEventListener( 'dispose', onGeometryDispose ); - - } - - geometry = object.geometry; - - if ( geometry === undefined ) { - - // fail silently for now - - } else if ( geometry instanceof THREE.BufferGeometry ) { - - initDirectBuffers( geometry ); - - } else if ( object instanceof THREE.Mesh ) { - - material = object.material; - - if ( geometry.geometryGroups === undefined ) { - - geometry.makeGroups( material instanceof THREE.MeshFaceMaterial ); - - } - - // create separate VBOs per geometry chunk - - for ( g in geometry.geometryGroups ) { - - geometryGroup = geometry.geometryGroups[ g ]; - - // initialise VBO on the first access - - if ( ! geometryGroup.__webglVertexBuffer ) { - - createMeshBuffers( geometryGroup ); - initMeshBuffers( geometryGroup, object ); - - geometry.verticesNeedUpdate = true; - geometry.morphTargetsNeedUpdate = true; - geometry.elementsNeedUpdate = true; - geometry.uvsNeedUpdate = true; - geometry.normalsNeedUpdate = true; - geometry.tangentsNeedUpdate = true; - geometry.colorsNeedUpdate = true; - - } - - } - - } else if ( object instanceof THREE.Line ) { - - if ( ! geometry.__webglVertexBuffer ) { - - createLineBuffers( geometry ); - initLineBuffers( geometry, object ); - - geometry.verticesNeedUpdate = true; - geometry.colorsNeedUpdate = true; - geometry.lineDistancesNeedUpdate = true; - - } - - } else if ( object instanceof THREE.ParticleSystem ) { - - if ( ! geometry.__webglVertexBuffer ) { - - createParticleBuffers( geometry ); - initParticleBuffers( geometry, object ); - - geometry.verticesNeedUpdate = true; - geometry.colorsNeedUpdate = true; - - } - - } - - } - - if ( object.__webglActive === undefined ) { - - if ( object instanceof THREE.Mesh ) { - - geometry = object.geometry; - - if ( geometry instanceof THREE.BufferGeometry ) { - - addBuffer( scene.__webglObjects, geometry, object ); - - } else if ( geometry instanceof THREE.Geometry ) { - - for ( g in geometry.geometryGroups ) { - - geometryGroup = geometry.geometryGroups[ g ]; - - addBuffer( scene.__webglObjects, geometryGroup, object ); - - } - - } - - } else if ( object instanceof THREE.Line || - object instanceof THREE.ParticleSystem ) { - - geometry = object.geometry; - addBuffer( scene.__webglObjects, geometry, object ); - - } else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) { - - addBufferImmediate( scene.__webglObjectsImmediate, object ); - - } else if ( object instanceof THREE.Sprite ) { - - scene.__webglSprites.push( object ); - - } else if ( object instanceof THREE.LensFlare ) { - - scene.__webglFlares.push( object ); - - } - - object.__webglActive = true; - - } - - }; - - function addBuffer( objlist, buffer, object ) { - - objlist.push( - { - id: null, - buffer: buffer, - object: object, - opaque: null, - transparent: null, - z: 0 - } - ); - - }; - - function addBufferImmediate( objlist, object ) { - - objlist.push( - { - id: null, - object: object, - opaque: null, - transparent: null, - z: 0 - } - ); - - }; - - // Objects updates - - function updateObject( object ) { - - var geometry = object.geometry, - geometryGroup, customAttributesDirty, material; - - if ( geometry instanceof THREE.BufferGeometry ) { - - setDirectBuffers( geometry, _gl.DYNAMIC_DRAW ); - - } else if ( object instanceof THREE.Mesh ) { - - // check all geometry groups - - for( var i = 0, il = geometry.geometryGroupsList.length; i < il; i ++ ) { - - geometryGroup = geometry.geometryGroupsList[ i ]; - - material = getBufferMaterial( object, geometryGroup ); - - if ( geometry.buffersNeedUpdate ) { - - initMeshBuffers( geometryGroup, object ); - - } - - customAttributesDirty = material.attributes && areCustomAttributesDirty( material ); - - if ( geometry.verticesNeedUpdate || geometry.morphTargetsNeedUpdate || geometry.elementsNeedUpdate || - geometry.uvsNeedUpdate || geometry.normalsNeedUpdate || - geometry.colorsNeedUpdate || geometry.tangentsNeedUpdate || customAttributesDirty ) { - - setMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW, !geometry.dynamic, material ); - - } - - } - - geometry.verticesNeedUpdate = false; - geometry.morphTargetsNeedUpdate = false; - geometry.elementsNeedUpdate = false; - geometry.uvsNeedUpdate = false; - geometry.normalsNeedUpdate = false; - geometry.colorsNeedUpdate = false; - geometry.tangentsNeedUpdate = false; - - geometry.buffersNeedUpdate = false; - - material.attributes && clearCustomAttributes( material ); - - } else if ( object instanceof THREE.Line ) { - - material = getBufferMaterial( object, geometry ); - - customAttributesDirty = material.attributes && areCustomAttributesDirty( material ); - - if ( geometry.verticesNeedUpdate || geometry.colorsNeedUpdate || geometry.lineDistancesNeedUpdate || customAttributesDirty ) { - - setLineBuffers( geometry, _gl.DYNAMIC_DRAW ); - - } - - geometry.verticesNeedUpdate = false; - geometry.colorsNeedUpdate = false; - geometry.lineDistancesNeedUpdate = false; - - material.attributes && clearCustomAttributes( material ); - - - } else if ( object instanceof THREE.ParticleSystem ) { - - material = getBufferMaterial( object, geometry ); - - customAttributesDirty = material.attributes && areCustomAttributesDirty( material ); - - if ( geometry.verticesNeedUpdate || geometry.colorsNeedUpdate || object.sortParticles || customAttributesDirty ) { - - setParticleBuffers( geometry, _gl.DYNAMIC_DRAW, object ); - - } - - geometry.verticesNeedUpdate = false; - geometry.colorsNeedUpdate = false; - - material.attributes && clearCustomAttributes( material ); - - } - - }; - - // Objects updates - custom attributes check - - function areCustomAttributesDirty( material ) { - - for ( var a in material.attributes ) { - - if ( material.attributes[ a ].needsUpdate ) return true; - - } - - return false; - - }; - - function clearCustomAttributes( material ) { - - for ( var a in material.attributes ) { - - material.attributes[ a ].needsUpdate = false; - - } - - }; - - // Objects removal - - function removeObject( object, scene ) { - - if ( object instanceof THREE.Mesh || - object instanceof THREE.ParticleSystem || - object instanceof THREE.Line ) { - - removeInstances( scene.__webglObjects, object ); - - } else if ( object instanceof THREE.Sprite ) { - - removeInstancesDirect( scene.__webglSprites, object ); - - } else if ( object instanceof THREE.LensFlare ) { - - removeInstancesDirect( scene.__webglFlares, object ); - - } else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) { - - removeInstances( scene.__webglObjectsImmediate, object ); - - } - - delete object.__webglActive; - - }; - - function removeInstances( objlist, object ) { - - for ( var o = objlist.length - 1; o >= 0; o -- ) { - - if ( objlist[ o ].object === object ) { - - objlist.splice( o, 1 ); - - } - - } - - }; - - function removeInstancesDirect( objlist, object ) { - - for ( var o = objlist.length - 1; o >= 0; o -- ) { - - if ( objlist[ o ] === object ) { - - objlist.splice( o, 1 ); - - } - - } - - }; - - // Materials - - this.initMaterial = function ( material, lights, fog, object ) { - - material.addEventListener( 'dispose', onMaterialDispose ); - - var u, a, identifiers, i, parameters, maxLightCount, maxBones, maxShadows, shaderID; - - if ( material instanceof THREE.MeshDepthMaterial ) { - - shaderID = 'depth'; - - } else if ( material instanceof THREE.MeshNormalMaterial ) { - - shaderID = 'normal'; - - } else if ( material instanceof THREE.MeshBasicMaterial ) { - - shaderID = 'basic'; - - } else if ( material instanceof THREE.MeshLambertMaterial ) { - - shaderID = 'lambert'; - - } else if ( material instanceof THREE.MeshPhongMaterial ) { - - shaderID = 'phong'; - - } else if ( material instanceof THREE.LineBasicMaterial ) { - - shaderID = 'basic'; - - } else if ( material instanceof THREE.LineDashedMaterial ) { - - shaderID = 'dashed'; - - } else if ( material instanceof THREE.ParticleSystemMaterial ) { - - shaderID = 'particle_basic'; - - } - - if ( shaderID ) { - - setMaterialShaders( material, THREE.ShaderLib[ shaderID ] ); - - } - - // heuristics to create shader parameters according to lights in the scene - // (not to blow over maxLights budget) - - maxLightCount = allocateLights( lights ); - - maxShadows = allocateShadows( lights ); - - maxBones = allocateBones( object ); - - parameters = { - - map: !!material.map, - envMap: !!material.envMap, - lightMap: !!material.lightMap, - bumpMap: !!material.bumpMap, - normalMap: !!material.normalMap, - specularMap: !!material.specularMap, - - vertexColors: material.vertexColors, - - fog: fog, - useFog: material.fog, - fogExp: fog instanceof THREE.FogExp2, - - sizeAttenuation: material.sizeAttenuation, - - skinning: material.skinning, - maxBones: maxBones, - useVertexTexture: _supportsBoneTextures && object && object.useVertexTexture, - - morphTargets: material.morphTargets, - morphNormals: material.morphNormals, - maxMorphTargets: this.maxMorphTargets, - maxMorphNormals: this.maxMorphNormals, - - maxDirLights: maxLightCount.directional, - maxPointLights: maxLightCount.point, - maxSpotLights: maxLightCount.spot, - maxHemiLights: maxLightCount.hemi, - - maxShadows: maxShadows, - shadowMapEnabled: this.shadowMapEnabled && object.receiveShadow && maxShadows > 0, - shadowMapType: this.shadowMapType, - shadowMapDebug: this.shadowMapDebug, - shadowMapCascade: this.shadowMapCascade, - - alphaTest: material.alphaTest, - metal: material.metal, - wrapAround: material.wrapAround, - doubleSided: material.side === THREE.DoubleSide, - flipSided: material.side === THREE.BackSide - - }; - - material.program = buildProgram( shaderID, material.fragmentShader, material.vertexShader, material.uniforms, material.attributes, material.defines, parameters, material.index0AttributeName ); - - var attributes = material.program.attributes; - - if ( material.morphTargets ) { - - material.numSupportedMorphTargets = 0; - - var id, base = "morphTarget"; - - for ( i = 0; i < this.maxMorphTargets; i ++ ) { - - id = base + i; - - if ( attributes[ id ] >= 0 ) { - - material.numSupportedMorphTargets ++; - - } - - } - - } - - if ( material.morphNormals ) { - - material.numSupportedMorphNormals = 0; - - var id, base = "morphNormal"; - - for ( i = 0; i < this.maxMorphNormals; i ++ ) { - - id = base + i; - - if ( attributes[ id ] >= 0 ) { - - material.numSupportedMorphNormals ++; - - } - - } - - } - - material.uniformsList = []; - - for ( u in material.uniforms ) { - - material.uniformsList.push( [ material.uniforms[ u ], u ] ); - - } - - }; - - function setMaterialShaders( material, shaders ) { - - material.uniforms = THREE.UniformsUtils.clone( shaders.uniforms ); - material.vertexShader = shaders.vertexShader; - material.fragmentShader = shaders.fragmentShader; - - }; - - function setProgram( camera, lights, fog, material, object ) { - - _usedTextureUnits = 0; - - if ( material.needsUpdate ) { - - if ( material.program ) deallocateMaterial( material ); - - _this.initMaterial( material, lights, fog, object ); - material.needsUpdate = false; - - } - - if ( material.morphTargets ) { - - if ( ! object.__webglMorphTargetInfluences ) { - - object.__webglMorphTargetInfluences = new Float32Array( _this.maxMorphTargets ); - - } - - } - - var refreshMaterial = false; - - var program = material.program, - p_uniforms = program.uniforms, - m_uniforms = material.uniforms; - - if ( program !== _currentProgram ) { - - _gl.useProgram( program ); - _currentProgram = program; - - refreshMaterial = true; - - } - - if ( material.id !== _currentMaterialId ) { - - _currentMaterialId = material.id; - refreshMaterial = true; - - } - - if ( refreshMaterial || camera !== _currentCamera ) { - - _gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, camera.projectionMatrix.elements ); - - if ( camera !== _currentCamera ) _currentCamera = camera; - - } - - // skinning uniforms must be set even if material didn't change - // auto-setting of texture unit for bone texture must go before other textures - // not sure why, but otherwise weird things happen - - if ( material.skinning ) { - - if ( _supportsBoneTextures && object.useVertexTexture ) { - - if ( p_uniforms.boneTexture !== null ) { - - var textureUnit = getTextureUnit(); - - _gl.uniform1i( p_uniforms.boneTexture, textureUnit ); - _this.setTexture( object.boneTexture, textureUnit ); - - } - - if ( p_uniforms.boneTextureWidth !== null ) { - - _gl.uniform1i( p_uniforms.boneTextureWidth, object.boneTextureWidth ); - - } - - if ( p_uniforms.boneTextureHeight !== null ) { - - _gl.uniform1i( p_uniforms.boneTextureHeight, object.boneTextureHeight ); - - } - - } else { - - if ( p_uniforms.boneGlobalMatrices !== null ) { - - _gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.boneMatrices ); - - } - - } - - } - - if ( refreshMaterial ) { - - // refresh uniforms common to several materials - - if ( fog && material.fog ) { - - refreshUniformsFog( m_uniforms, fog ); - - } - - if ( material instanceof THREE.MeshPhongMaterial || - material instanceof THREE.MeshLambertMaterial || - material.lights ) { - - if ( _lightsNeedUpdate ) { - - setupLights( program, lights ); - _lightsNeedUpdate = false; - - } - - refreshUniformsLights( m_uniforms, _lights ); - - } - - if ( material instanceof THREE.MeshBasicMaterial || - material instanceof THREE.MeshLambertMaterial || - material instanceof THREE.MeshPhongMaterial ) { - - refreshUniformsCommon( m_uniforms, material ); - - } - - // refresh single material specific uniforms - - if ( material instanceof THREE.LineBasicMaterial ) { - - refreshUniformsLine( m_uniforms, material ); - - } else if ( material instanceof THREE.LineDashedMaterial ) { - - refreshUniformsLine( m_uniforms, material ); - refreshUniformsDash( m_uniforms, material ); - - } else if ( material instanceof THREE.ParticleSystemMaterial ) { - - refreshUniformsParticle( m_uniforms, material ); - - } else if ( material instanceof THREE.MeshPhongMaterial ) { - - refreshUniformsPhong( m_uniforms, material ); - - } else if ( material instanceof THREE.MeshLambertMaterial ) { - - refreshUniformsLambert( m_uniforms, material ); - - } else if ( material instanceof THREE.MeshDepthMaterial ) { - - m_uniforms.mNear.value = camera.near; - m_uniforms.mFar.value = camera.far; - m_uniforms.opacity.value = material.opacity; - - } else if ( material instanceof THREE.MeshNormalMaterial ) { - - m_uniforms.opacity.value = material.opacity; - - } - - if ( object.receiveShadow && ! material._shadowPass ) { - - refreshUniformsShadow( m_uniforms, lights ); - - } - - // load common uniforms - - loadUniformsGeneric( program, material.uniformsList ); - - // load material specific uniforms - // (shader material also gets them for the sake of genericity) - - if ( material instanceof THREE.ShaderMaterial || - material instanceof THREE.MeshPhongMaterial || - material.envMap ) { - - if ( p_uniforms.cameraPosition !== null ) { - - _vector3.setFromMatrixPosition( camera.matrixWorld ); - _gl.uniform3f( p_uniforms.cameraPosition, _vector3.x, _vector3.y, _vector3.z ); - - } - - } - - if ( material instanceof THREE.MeshPhongMaterial || - material instanceof THREE.MeshLambertMaterial || - material instanceof THREE.ShaderMaterial || - material.skinning ) { - - if ( p_uniforms.viewMatrix !== null ) { - - _gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, camera.matrixWorldInverse.elements ); - - } - - } - - } - - loadUniformsMatrices( p_uniforms, object ); - - if ( p_uniforms.modelMatrix !== null ) { - - _gl.uniformMatrix4fv( p_uniforms.modelMatrix, false, object.matrixWorld.elements ); - - } - - return program; - - }; - - // Uniforms (refresh uniforms objects) - - function refreshUniformsCommon ( uniforms, material ) { - - uniforms.opacity.value = material.opacity; - - if ( _this.gammaInput ) { - - uniforms.diffuse.value.copyGammaToLinear( material.color ); - - } else { - - uniforms.diffuse.value = material.color; - - } - - uniforms.map.value = material.map; - uniforms.lightMap.value = material.lightMap; - uniforms.specularMap.value = material.specularMap; - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - - } - - // uv repeat and offset setting priorities - // 1. color map - // 2. specular map - // 3. normal map - // 4. bump map - - var uvScaleMap; - - if ( material.map ) { - - uvScaleMap = material.map; - - } else if ( material.specularMap ) { - - uvScaleMap = material.specularMap; - - } else if ( material.normalMap ) { - - uvScaleMap = material.normalMap; - - } else if ( material.bumpMap ) { - - uvScaleMap = material.bumpMap; - - } - - if ( uvScaleMap !== undefined ) { - - var offset = uvScaleMap.offset; - var repeat = uvScaleMap.repeat; - - uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y ); - - } - - uniforms.envMap.value = material.envMap; - uniforms.flipEnvMap.value = ( material.envMap instanceof THREE.WebGLRenderTargetCube ) ? 1 : -1; - - if ( _this.gammaInput ) { - - //uniforms.reflectivity.value = material.reflectivity * material.reflectivity; - uniforms.reflectivity.value = material.reflectivity; - - } else { - - uniforms.reflectivity.value = material.reflectivity; - - } - - uniforms.refractionRatio.value = material.refractionRatio; - uniforms.combine.value = material.combine; - uniforms.useRefract.value = material.envMap && material.envMap.mapping instanceof THREE.CubeRefractionMapping; - - }; - - function refreshUniformsLine ( uniforms, material ) { - - uniforms.diffuse.value = material.color; - uniforms.opacity.value = material.opacity; - - }; - - function refreshUniformsDash ( uniforms, material ) { - - uniforms.dashSize.value = material.dashSize; - uniforms.totalSize.value = material.dashSize + material.gapSize; - uniforms.scale.value = material.scale; - - }; - - function refreshUniformsParticle ( uniforms, material ) { - - uniforms.psColor.value = material.color; - uniforms.opacity.value = material.opacity; - uniforms.size.value = material.size; - uniforms.scale.value = _canvas.height / 2.0; // TODO: Cache this. - - uniforms.map.value = material.map; - - }; - - function refreshUniformsFog ( uniforms, fog ) { - - uniforms.fogColor.value = fog.color; - - if ( fog instanceof THREE.Fog ) { - - uniforms.fogNear.value = fog.near; - uniforms.fogFar.value = fog.far; - - } else if ( fog instanceof THREE.FogExp2 ) { - - uniforms.fogDensity.value = fog.density; - - } - - }; - - function refreshUniformsPhong ( uniforms, material ) { - - uniforms.shininess.value = material.shininess; - - if ( _this.gammaInput ) { - - uniforms.ambient.value.copyGammaToLinear( material.ambient ); - uniforms.emissive.value.copyGammaToLinear( material.emissive ); - uniforms.specular.value.copyGammaToLinear( material.specular ); - - } else { - - uniforms.ambient.value = material.ambient; - uniforms.emissive.value = material.emissive; - uniforms.specular.value = material.specular; - - } - - if ( material.wrapAround ) { - - uniforms.wrapRGB.value.copy( material.wrapRGB ); - - } - - }; - - function refreshUniformsLambert ( uniforms, material ) { - - if ( _this.gammaInput ) { - - uniforms.ambient.value.copyGammaToLinear( material.ambient ); - uniforms.emissive.value.copyGammaToLinear( material.emissive ); - - } else { - - uniforms.ambient.value = material.ambient; - uniforms.emissive.value = material.emissive; - - } - - if ( material.wrapAround ) { - - uniforms.wrapRGB.value.copy( material.wrapRGB ); - - } - - }; - - function refreshUniformsLights ( uniforms, lights ) { - - uniforms.ambientLightColor.value = lights.ambient; - - uniforms.directionalLightColor.value = lights.directional.colors; - uniforms.directionalLightDirection.value = lights.directional.positions; - - uniforms.pointLightColor.value = lights.point.colors; - uniforms.pointLightPosition.value = lights.point.positions; - uniforms.pointLightDistance.value = lights.point.distances; - - uniforms.spotLightColor.value = lights.spot.colors; - uniforms.spotLightPosition.value = lights.spot.positions; - uniforms.spotLightDistance.value = lights.spot.distances; - uniforms.spotLightDirection.value = lights.spot.directions; - uniforms.spotLightAngleCos.value = lights.spot.anglesCos; - uniforms.spotLightExponent.value = lights.spot.exponents; - - uniforms.hemisphereLightSkyColor.value = lights.hemi.skyColors; - uniforms.hemisphereLightGroundColor.value = lights.hemi.groundColors; - uniforms.hemisphereLightDirection.value = lights.hemi.positions; - - }; - - function refreshUniformsShadow ( uniforms, lights ) { - - if ( uniforms.shadowMatrix ) { - - var j = 0; - - for ( var i = 0, il = lights.length; i < il; i ++ ) { - - var light = lights[ i ]; - - if ( ! light.castShadow ) continue; - - if ( light instanceof THREE.SpotLight || ( light instanceof THREE.DirectionalLight && ! light.shadowCascade ) ) { - - uniforms.shadowMap.value[ j ] = light.shadowMap; - uniforms.shadowMapSize.value[ j ] = light.shadowMapSize; - - uniforms.shadowMatrix.value[ j ] = light.shadowMatrix; - - uniforms.shadowDarkness.value[ j ] = light.shadowDarkness; - uniforms.shadowBias.value[ j ] = light.shadowBias; - - j ++; - - } - - } - - } - - }; - - // Uniforms (load to GPU) - - function loadUniformsMatrices ( uniforms, object ) { - - _gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrix.elements ); - - if ( uniforms.normalMatrix ) { - - _gl.uniformMatrix3fv( uniforms.normalMatrix, false, object._normalMatrix.elements ); - - } - - }; - - function getTextureUnit() { - - var textureUnit = _usedTextureUnits; - - if ( textureUnit >= _maxTextures ) { - - console.warn( "WebGLRenderer: trying to use " + textureUnit + " texture units while this GPU supports only " + _maxTextures ); - - } - - _usedTextureUnits += 1; - - return textureUnit; - - }; - - function loadUniformsGeneric ( program, uniforms ) { - - var uniform, value, type, location, texture, textureUnit, i, il, j, jl, offset; - - for ( j = 0, jl = uniforms.length; j < jl; j ++ ) { - - location = program.uniforms[ uniforms[ j ][ 1 ] ]; - if ( !location ) continue; - - uniform = uniforms[ j ][ 0 ]; - - type = uniform.type; - value = uniform.value; - - if ( type === "i" ) { // single integer - - _gl.uniform1i( location, value ); - - } else if ( type === "f" ) { // single float - - _gl.uniform1f( location, value ); - - } else if ( type === "v2" ) { // single THREE.Vector2 - - _gl.uniform2f( location, value.x, value.y ); - - } else if ( type === "v3" ) { // single THREE.Vector3 - - _gl.uniform3f( location, value.x, value.y, value.z ); - - } else if ( type === "v4" ) { // single THREE.Vector4 - - _gl.uniform4f( location, value.x, value.y, value.z, value.w ); - - } else if ( type === "c" ) { // single THREE.Color - - _gl.uniform3f( location, value.r, value.g, value.b ); - - } else if ( type === "iv1" ) { // flat array of integers (JS or typed array) - - _gl.uniform1iv( location, value ); - - } else if ( type === "iv" ) { // flat array of integers with 3 x N size (JS or typed array) - - _gl.uniform3iv( location, value ); - - } else if ( type === "fv1" ) { // flat array of floats (JS or typed array) - - _gl.uniform1fv( location, value ); - - } else if ( type === "fv" ) { // flat array of floats with 3 x N size (JS or typed array) - - _gl.uniform3fv( location, value ); - - } else if ( type === "v2v" ) { // array of THREE.Vector2 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 2 * value.length ); - - } - - for ( i = 0, il = value.length; i < il; i ++ ) { - - offset = i * 2; - - uniform._array[ offset ] = value[ i ].x; - uniform._array[ offset + 1 ] = value[ i ].y; - - } - - _gl.uniform2fv( location, uniform._array ); - - } else if ( type === "v3v" ) { // array of THREE.Vector3 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 3 * value.length ); - - } - - for ( i = 0, il = value.length; i < il; i ++ ) { - - offset = i * 3; - - uniform._array[ offset ] = value[ i ].x; - uniform._array[ offset + 1 ] = value[ i ].y; - uniform._array[ offset + 2 ] = value[ i ].z; - - } - - _gl.uniform3fv( location, uniform._array ); - - } else if ( type === "v4v" ) { // array of THREE.Vector4 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 4 * value.length ); - - } - - for ( i = 0, il = value.length; i < il; i ++ ) { - - offset = i * 4; - - uniform._array[ offset ] = value[ i ].x; - uniform._array[ offset + 1 ] = value[ i ].y; - uniform._array[ offset + 2 ] = value[ i ].z; - uniform._array[ offset + 3 ] = value[ i ].w; - - } - - _gl.uniform4fv( location, uniform._array ); - - } else if ( type === "m4") { // single THREE.Matrix4 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 16 ); - - } - - value.flattenToArray( uniform._array ); - _gl.uniformMatrix4fv( location, false, uniform._array ); - - } else if ( type === "m4v" ) { // array of THREE.Matrix4 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 16 * value.length ); - - } - - for ( i = 0, il = value.length; i < il; i ++ ) { - - value[ i ].flattenToArrayOffset( uniform._array, i * 16 ); - - } - - _gl.uniformMatrix4fv( location, false, uniform._array ); - - } else if ( type === "t" ) { // single THREE.Texture (2d or cube) - - texture = value; - textureUnit = getTextureUnit(); - - _gl.uniform1i( location, textureUnit ); - - if ( !texture ) continue; - - if ( texture.image instanceof Array && texture.image.length === 6 ) { - - setCubeTexture( texture, textureUnit ); - - } else if ( texture instanceof THREE.WebGLRenderTargetCube ) { - - setCubeTextureDynamic( texture, textureUnit ); - - } else { - - _this.setTexture( texture, textureUnit ); - - } - - } else if ( type === "tv" ) { // array of THREE.Texture (2d) - - if ( uniform._array === undefined ) { - - uniform._array = []; - - } - - for( i = 0, il = uniform.value.length; i < il; i ++ ) { - - uniform._array[ i ] = getTextureUnit(); - - } - - _gl.uniform1iv( location, uniform._array ); - - for( i = 0, il = uniform.value.length; i < il; i ++ ) { - - texture = uniform.value[ i ]; - textureUnit = uniform._array[ i ]; - - if ( !texture ) continue; - - _this.setTexture( texture, textureUnit ); - - } - - } else { - - console.warn( 'THREE.WebGLRenderer: Unknown uniform type: ' + type ); - - } - - } - - }; - - function setupMatrices ( object, camera ) { - - object._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); - object._normalMatrix.getNormalMatrix( object._modelViewMatrix ); - - }; - - // - - function setColorGamma( array, offset, color, intensitySq ) { - - array[ offset ] = color.r * color.r * intensitySq; - array[ offset + 1 ] = color.g * color.g * intensitySq; - array[ offset + 2 ] = color.b * color.b * intensitySq; - - }; - - function setColorLinear( array, offset, color, intensity ) { - - array[ offset ] = color.r * intensity; - array[ offset + 1 ] = color.g * intensity; - array[ offset + 2 ] = color.b * intensity; - - }; - - function setupLights ( program, lights ) { - - var l, ll, light, n, - r = 0, g = 0, b = 0, - color, skyColor, groundColor, - intensity, intensitySq, - position, - distance, - - zlights = _lights, - - dirColors = zlights.directional.colors, - dirPositions = zlights.directional.positions, - - pointColors = zlights.point.colors, - pointPositions = zlights.point.positions, - pointDistances = zlights.point.distances, - - spotColors = zlights.spot.colors, - spotPositions = zlights.spot.positions, - spotDistances = zlights.spot.distances, - spotDirections = zlights.spot.directions, - spotAnglesCos = zlights.spot.anglesCos, - spotExponents = zlights.spot.exponents, - - hemiSkyColors = zlights.hemi.skyColors, - hemiGroundColors = zlights.hemi.groundColors, - hemiPositions = zlights.hemi.positions, - - dirLength = 0, - pointLength = 0, - spotLength = 0, - hemiLength = 0, - - dirCount = 0, - pointCount = 0, - spotCount = 0, - hemiCount = 0, - - dirOffset = 0, - pointOffset = 0, - spotOffset = 0, - hemiOffset = 0; - - for ( l = 0, ll = lights.length; l < ll; l ++ ) { - - light = lights[ l ]; - - if ( light.onlyShadow ) continue; - - color = light.color; - intensity = light.intensity; - distance = light.distance; - - if ( light instanceof THREE.AmbientLight ) { - - if ( ! light.visible ) continue; - - if ( _this.gammaInput ) { - - r += color.r * color.r; - g += color.g * color.g; - b += color.b * color.b; - - } else { - - r += color.r; - g += color.g; - b += color.b; - - } - - } else if ( light instanceof THREE.DirectionalLight ) { - - dirCount += 1; - - if ( ! light.visible ) continue; - - _direction.setFromMatrixPosition( light.matrixWorld ); - _vector3.setFromMatrixPosition( light.target.matrixWorld ); - _direction.sub( _vector3 ); - _direction.normalize(); - - // skip lights with undefined direction - // these create troubles in OpenGL (making pixel black) - - if ( _direction.x === 0 && _direction.y === 0 && _direction.z === 0 ) continue; - - dirOffset = dirLength * 3; - - dirPositions[ dirOffset ] = _direction.x; - dirPositions[ dirOffset + 1 ] = _direction.y; - dirPositions[ dirOffset + 2 ] = _direction.z; - - if ( _this.gammaInput ) { - - setColorGamma( dirColors, dirOffset, color, intensity * intensity ); - - } else { - - setColorLinear( dirColors, dirOffset, color, intensity ); - - } - - dirLength += 1; - - } else if ( light instanceof THREE.PointLight ) { - - pointCount += 1; - - if ( ! light.visible ) continue; - - pointOffset = pointLength * 3; - - if ( _this.gammaInput ) { - - setColorGamma( pointColors, pointOffset, color, intensity * intensity ); - - } else { - - setColorLinear( pointColors, pointOffset, color, intensity ); - - } - - _vector3.setFromMatrixPosition( light.matrixWorld ); - - pointPositions[ pointOffset ] = _vector3.x; - pointPositions[ pointOffset + 1 ] = _vector3.y; - pointPositions[ pointOffset + 2 ] = _vector3.z; - - pointDistances[ pointLength ] = distance; - - pointLength += 1; - - } else if ( light instanceof THREE.SpotLight ) { - - spotCount += 1; - - if ( ! light.visible ) continue; - - spotOffset = spotLength * 3; - - if ( _this.gammaInput ) { - - setColorGamma( spotColors, spotOffset, color, intensity * intensity ); - - } else { - - setColorLinear( spotColors, spotOffset, color, intensity ); - - } - - _vector3.setFromMatrixPosition( light.matrixWorld ); - - spotPositions[ spotOffset ] = _vector3.x; - spotPositions[ spotOffset + 1 ] = _vector3.y; - spotPositions[ spotOffset + 2 ] = _vector3.z; - - spotDistances[ spotLength ] = distance; - - _direction.copy( _vector3 ); - _vector3.setFromMatrixPosition( light.target.matrixWorld ); - _direction.sub( _vector3 ); - _direction.normalize(); - - spotDirections[ spotOffset ] = _direction.x; - spotDirections[ spotOffset + 1 ] = _direction.y; - spotDirections[ spotOffset + 2 ] = _direction.z; - - spotAnglesCos[ spotLength ] = Math.cos( light.angle ); - spotExponents[ spotLength ] = light.exponent; - - spotLength += 1; - - } else if ( light instanceof THREE.HemisphereLight ) { - - hemiCount += 1; - - if ( ! light.visible ) continue; - - _direction.setFromMatrixPosition( light.matrixWorld ); - _direction.normalize(); - - // skip lights with undefined direction - // these create troubles in OpenGL (making pixel black) - - if ( _direction.x === 0 && _direction.y === 0 && _direction.z === 0 ) continue; - - hemiOffset = hemiLength * 3; - - hemiPositions[ hemiOffset ] = _direction.x; - hemiPositions[ hemiOffset + 1 ] = _direction.y; - hemiPositions[ hemiOffset + 2 ] = _direction.z; - - skyColor = light.color; - groundColor = light.groundColor; - - if ( _this.gammaInput ) { - - intensitySq = intensity * intensity; - - setColorGamma( hemiSkyColors, hemiOffset, skyColor, intensitySq ); - setColorGamma( hemiGroundColors, hemiOffset, groundColor, intensitySq ); - - } else { - - setColorLinear( hemiSkyColors, hemiOffset, skyColor, intensity ); - setColorLinear( hemiGroundColors, hemiOffset, groundColor, intensity ); - - } - - hemiLength += 1; - - } - - } - - // null eventual remains from removed lights - // (this is to avoid if in shader) - - for ( l = dirLength * 3, ll = Math.max( dirColors.length, dirCount * 3 ); l < ll; l ++ ) dirColors[ l ] = 0.0; - for ( l = pointLength * 3, ll = Math.max( pointColors.length, pointCount * 3 ); l < ll; l ++ ) pointColors[ l ] = 0.0; - for ( l = spotLength * 3, ll = Math.max( spotColors.length, spotCount * 3 ); l < ll; l ++ ) spotColors[ l ] = 0.0; - for ( l = hemiLength * 3, ll = Math.max( hemiSkyColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiSkyColors[ l ] = 0.0; - for ( l = hemiLength * 3, ll = Math.max( hemiGroundColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiGroundColors[ l ] = 0.0; - - zlights.directional.length = dirLength; - zlights.point.length = pointLength; - zlights.spot.length = spotLength; - zlights.hemi.length = hemiLength; - - zlights.ambient[ 0 ] = r; - zlights.ambient[ 1 ] = g; - zlights.ambient[ 2 ] = b; - - }; - - // GL state setting - - this.setFaceCulling = function ( cullFace, frontFaceDirection ) { - - if ( cullFace === THREE.CullFaceNone ) { - - _gl.disable( _gl.CULL_FACE ); - - } else { - - if ( frontFaceDirection === THREE.FrontFaceDirectionCW ) { - - _gl.frontFace( _gl.CW ); - - } else { - - _gl.frontFace( _gl.CCW ); - - } - - if ( cullFace === THREE.CullFaceBack ) { - - _gl.cullFace( _gl.BACK ); - - } else if ( cullFace === THREE.CullFaceFront ) { - - _gl.cullFace( _gl.FRONT ); - - } else { - - _gl.cullFace( _gl.FRONT_AND_BACK ); - - } - - _gl.enable( _gl.CULL_FACE ); - - } - - }; - - this.setMaterialFaces = function ( material ) { - - var doubleSided = material.side === THREE.DoubleSide; - var flipSided = material.side === THREE.BackSide; - - if ( _oldDoubleSided !== doubleSided ) { - - if ( doubleSided ) { - - _gl.disable( _gl.CULL_FACE ); - - } else { - - _gl.enable( _gl.CULL_FACE ); - - } - - _oldDoubleSided = doubleSided; - - } - - if ( _oldFlipSided !== flipSided ) { - - if ( flipSided ) { - - _gl.frontFace( _gl.CW ); - - } else { - - _gl.frontFace( _gl.CCW ); - - } - - _oldFlipSided = flipSided; - - } - - }; - - this.setDepthTest = function ( depthTest ) { - - if ( _oldDepthTest !== depthTest ) { - - if ( depthTest ) { - - _gl.enable( _gl.DEPTH_TEST ); - - } else { - - _gl.disable( _gl.DEPTH_TEST ); - - } - - _oldDepthTest = depthTest; - - } - - }; - - this.setDepthWrite = function ( depthWrite ) { - - if ( _oldDepthWrite !== depthWrite ) { - - _gl.depthMask( depthWrite ); - _oldDepthWrite = depthWrite; - - } - - }; - - function setLineWidth ( width ) { - - if ( width !== _oldLineWidth ) { - - _gl.lineWidth( width ); - - _oldLineWidth = width; - - } - - }; - - function setPolygonOffset ( polygonoffset, factor, units ) { - - if ( _oldPolygonOffset !== polygonoffset ) { - - if ( polygonoffset ) { - - _gl.enable( _gl.POLYGON_OFFSET_FILL ); - - } else { - - _gl.disable( _gl.POLYGON_OFFSET_FILL ); - - } - - _oldPolygonOffset = polygonoffset; - - } - - if ( polygonoffset && ( _oldPolygonOffsetFactor !== factor || _oldPolygonOffsetUnits !== units ) ) { - - _gl.polygonOffset( factor, units ); - - _oldPolygonOffsetFactor = factor; - _oldPolygonOffsetUnits = units; - - } - - }; - - this.setBlending = function ( blending, blendEquation, blendSrc, blendDst ) { - - if ( blending !== _oldBlending ) { - - if ( blending === THREE.NoBlending ) { - - _gl.disable( _gl.BLEND ); - - } else if ( blending === THREE.AdditiveBlending ) { - - _gl.enable( _gl.BLEND ); - _gl.blendEquation( _gl.FUNC_ADD ); - _gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE ); - - } else if ( blending === THREE.SubtractiveBlending ) { - - // TODO: Find blendFuncSeparate() combination - _gl.enable( _gl.BLEND ); - _gl.blendEquation( _gl.FUNC_ADD ); - _gl.blendFunc( _gl.ZERO, _gl.ONE_MINUS_SRC_COLOR ); - - } else if ( blending === THREE.MultiplyBlending ) { - - // TODO: Find blendFuncSeparate() combination - _gl.enable( _gl.BLEND ); - _gl.blendEquation( _gl.FUNC_ADD ); - _gl.blendFunc( _gl.ZERO, _gl.SRC_COLOR ); - - } else if ( blending === THREE.CustomBlending ) { - - _gl.enable( _gl.BLEND ); - - } else { - - _gl.enable( _gl.BLEND ); - _gl.blendEquationSeparate( _gl.FUNC_ADD, _gl.FUNC_ADD ); - _gl.blendFuncSeparate( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA ); - - } - - _oldBlending = blending; - - } - - if ( blending === THREE.CustomBlending ) { - - if ( blendEquation !== _oldBlendEquation ) { - - _gl.blendEquation( paramThreeToGL( blendEquation ) ); - - _oldBlendEquation = blendEquation; - - } - - if ( blendSrc !== _oldBlendSrc || blendDst !== _oldBlendDst ) { - - _gl.blendFunc( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ) ); - - _oldBlendSrc = blendSrc; - _oldBlendDst = blendDst; - - } - - } else { - - _oldBlendEquation = null; - _oldBlendSrc = null; - _oldBlendDst = null; - - } - - }; - - // Defines - - function generateDefines ( defines ) { - - var value, chunk, chunks = []; - - for ( var d in defines ) { - - value = defines[ d ]; - if ( value === false ) continue; - - chunk = "#define " + d + " " + value; - chunks.push( chunk ); - - } - - return chunks.join( "\n" ); - - }; - - // Shaders - - function buildProgram( shaderID, fragmentShader, vertexShader, uniforms, attributes, defines, parameters, index0AttributeName ) { - - var p, pl, d, program, code; - var chunks = []; - - // Generate code - - if ( shaderID ) { - - chunks.push( shaderID ); - - } else { - - chunks.push( fragmentShader ); - chunks.push( vertexShader ); - - } - - for ( d in defines ) { - - chunks.push( d ); - chunks.push( defines[ d ] ); - - } - - for ( p in parameters ) { - - chunks.push( p ); - chunks.push( parameters[ p ] ); - - } - - code = chunks.join(); - - // Check if code has been already compiled - - for ( p = 0, pl = _programs.length; p < pl; p ++ ) { - - var programInfo = _programs[ p ]; - - if ( programInfo.code === code ) { - - // console.log( "Code already compiled." /*: \n\n" + code*/ ); - - programInfo.usedTimes ++; - - return programInfo.program; - - } - - } - - var shadowMapTypeDefine = "SHADOWMAP_TYPE_BASIC"; - - if ( parameters.shadowMapType === THREE.PCFShadowMap ) { - - shadowMapTypeDefine = "SHADOWMAP_TYPE_PCF"; - - } else if ( parameters.shadowMapType === THREE.PCFSoftShadowMap ) { - - shadowMapTypeDefine = "SHADOWMAP_TYPE_PCF_SOFT"; - - } - - // console.log( "building new program " ); - - // - - var customDefines = generateDefines( defines ); - - // - - program = _gl.createProgram(); - - var prefix_vertex = [ - - "precision " + _precision + " float;", - "precision " + _precision + " int;", - - customDefines, - - _supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", - - _this.gammaInput ? "#define GAMMA_INPUT" : "", - _this.gammaOutput ? "#define GAMMA_OUTPUT" : "", - - "#define MAX_DIR_LIGHTS " + parameters.maxDirLights, - "#define MAX_POINT_LIGHTS " + parameters.maxPointLights, - "#define MAX_SPOT_LIGHTS " + parameters.maxSpotLights, - "#define MAX_HEMI_LIGHTS " + parameters.maxHemiLights, - - "#define MAX_SHADOWS " + parameters.maxShadows, - - "#define MAX_BONES " + parameters.maxBones, - - parameters.map ? "#define USE_MAP" : "", - parameters.envMap ? "#define USE_ENVMAP" : "", - parameters.lightMap ? "#define USE_LIGHTMAP" : "", - parameters.bumpMap ? "#define USE_BUMPMAP" : "", - parameters.normalMap ? "#define USE_NORMALMAP" : "", - parameters.specularMap ? "#define USE_SPECULARMAP" : "", - parameters.vertexColors ? "#define USE_COLOR" : "", - - parameters.skinning ? "#define USE_SKINNING" : "", - parameters.useVertexTexture ? "#define BONE_TEXTURE" : "", - - parameters.morphTargets ? "#define USE_MORPHTARGETS" : "", - parameters.morphNormals ? "#define USE_MORPHNORMALS" : "", - parameters.wrapAround ? "#define WRAP_AROUND" : "", - parameters.doubleSided ? "#define DOUBLE_SIDED" : "", - parameters.flipSided ? "#define FLIP_SIDED" : "", - - parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "", - parameters.shadowMapDebug ? "#define SHADOWMAP_DEBUG" : "", - parameters.shadowMapCascade ? "#define SHADOWMAP_CASCADE" : "", - - parameters.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", - - "uniform mat4 modelMatrix;", - "uniform mat4 modelViewMatrix;", - "uniform mat4 projectionMatrix;", - "uniform mat4 viewMatrix;", - "uniform mat3 normalMatrix;", - "uniform vec3 cameraPosition;", - - "attribute vec3 position;", - "attribute vec3 normal;", - "attribute vec2 uv;", - "attribute vec2 uv2;", - - "#ifdef USE_COLOR", - - "attribute vec3 color;", - - "#endif", - - "#ifdef USE_MORPHTARGETS", - - "attribute vec3 morphTarget0;", - "attribute vec3 morphTarget1;", - "attribute vec3 morphTarget2;", - "attribute vec3 morphTarget3;", - - "#ifdef USE_MORPHNORMALS", - - "attribute vec3 morphNormal0;", - "attribute vec3 morphNormal1;", - "attribute vec3 morphNormal2;", - "attribute vec3 morphNormal3;", - - "#else", - - "attribute vec3 morphTarget4;", - "attribute vec3 morphTarget5;", - "attribute vec3 morphTarget6;", - "attribute vec3 morphTarget7;", - - "#endif", - - "#endif", - - "#ifdef USE_SKINNING", - - "attribute vec4 skinIndex;", - "attribute vec4 skinWeight;", - - "#endif", - - "" - - ].join("\n"); - - var prefix_fragment = [ - - "precision " + _precision + " float;", - "precision " + _precision + " int;", - - ( parameters.bumpMap || parameters.normalMap ) ? "#extension GL_OES_standard_derivatives : enable" : "", - - customDefines, - - "#define MAX_DIR_LIGHTS " + parameters.maxDirLights, - "#define MAX_POINT_LIGHTS " + parameters.maxPointLights, - "#define MAX_SPOT_LIGHTS " + parameters.maxSpotLights, - "#define MAX_HEMI_LIGHTS " + parameters.maxHemiLights, - - "#define MAX_SHADOWS " + parameters.maxShadows, - - parameters.alphaTest ? "#define ALPHATEST " + parameters.alphaTest: "", - - _this.gammaInput ? "#define GAMMA_INPUT" : "", - _this.gammaOutput ? "#define GAMMA_OUTPUT" : "", - - ( parameters.useFog && parameters.fog ) ? "#define USE_FOG" : "", - ( parameters.useFog && parameters.fogExp ) ? "#define FOG_EXP2" : "", - - parameters.map ? "#define USE_MAP" : "", - parameters.envMap ? "#define USE_ENVMAP" : "", - parameters.lightMap ? "#define USE_LIGHTMAP" : "", - parameters.bumpMap ? "#define USE_BUMPMAP" : "", - parameters.normalMap ? "#define USE_NORMALMAP" : "", - parameters.specularMap ? "#define USE_SPECULARMAP" : "", - parameters.vertexColors ? "#define USE_COLOR" : "", - - parameters.metal ? "#define METAL" : "", - parameters.wrapAround ? "#define WRAP_AROUND" : "", - parameters.doubleSided ? "#define DOUBLE_SIDED" : "", - parameters.flipSided ? "#define FLIP_SIDED" : "", - - parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "", - parameters.shadowMapDebug ? "#define SHADOWMAP_DEBUG" : "", - parameters.shadowMapCascade ? "#define SHADOWMAP_CASCADE" : "", - - "uniform mat4 viewMatrix;", - "uniform vec3 cameraPosition;", - "" - - ].join("\n"); - - var glVertexShader = getShader( "vertex", prefix_vertex + vertexShader ); - var glFragmentShader = getShader( "fragment", prefix_fragment + fragmentShader ); - - _gl.attachShader( program, glVertexShader ); - _gl.attachShader( program, glFragmentShader ); - - // Force a particular attribute to index 0. - // because potentially expensive emulation is done by browser if attribute 0 is disabled. - // And, color, for example is often automatically bound to index 0 so disabling it - if ( index0AttributeName !== undefined ) { - - _gl.bindAttribLocation( program, 0, index0AttributeName ); - - } - - _gl.linkProgram( program ); - - if ( _gl.getProgramParameter( program, _gl.LINK_STATUS ) === false ) { - - console.error( 'Could not initialise shader' ); - console.error( 'gl.VALIDATE_STATUS', _gl.getProgramParameter( program, _gl.VALIDATE_STATUS ) ); - console.error( 'gl.getError()', _gl.getError() ); - - } - - if ( _gl.getProgramInfoLog( program ) !== '' ) { - - console.error( 'gl.getProgramInfoLog()', _gl.getProgramInfoLog( program ) ); - - } - - // clean up - - _gl.deleteShader( glFragmentShader ); - _gl.deleteShader( glVertexShader ); - - // console.log( prefix_fragment + fragmentShader ); - // console.log( prefix_vertex + vertexShader ); - - program.uniforms = {}; - program.attributes = {}; - - var identifiers, u, a, i; - - // cache uniform locations - - identifiers = [ - - 'viewMatrix', 'modelViewMatrix', 'projectionMatrix', 'normalMatrix', 'modelMatrix', 'cameraPosition', - 'morphTargetInfluences' - - ]; - - if ( parameters.useVertexTexture ) { - - identifiers.push( 'boneTexture' ); - identifiers.push( 'boneTextureWidth' ); - identifiers.push( 'boneTextureHeight' ); - - } else { - - identifiers.push( 'boneGlobalMatrices' ); - - } - - for ( u in uniforms ) { - - identifiers.push( u ); - - } - - cacheUniformLocations( program, identifiers ); - - // cache attributes locations - - identifiers = [ - - "position", "normal", "uv", "uv2", "tangent", "color", - "skinIndex", "skinWeight", "lineDistance" - - ]; - - for ( i = 0; i < parameters.maxMorphTargets; i ++ ) { - - identifiers.push( "morphTarget" + i ); - - } - - for ( i = 0; i < parameters.maxMorphNormals; i ++ ) { - - identifiers.push( "morphNormal" + i ); - - } - - for ( a in attributes ) { - - identifiers.push( a ); - - } - - cacheAttributeLocations( program, identifiers ); - - program.id = _programs_counter ++; - - _programs.push( { program: program, code: code, usedTimes: 1 } ); - - _this.info.memory.programs = _programs.length; - - return program; - - }; - - // Shader parameters cache - - function cacheUniformLocations ( program, identifiers ) { - - var i, l, id; - - for( i = 0, l = identifiers.length; i < l; i ++ ) { - - id = identifiers[ i ]; - program.uniforms[ id ] = _gl.getUniformLocation( program, id ); - - } - - }; - - function cacheAttributeLocations ( program, identifiers ) { - - var i, l, id; - - for( i = 0, l = identifiers.length; i < l; i ++ ) { - - id = identifiers[ i ]; - program.attributes[ id ] = _gl.getAttribLocation( program, id ); - - } - - }; - - function addLineNumbers ( string ) { - - var chunks = string.split( "\n" ); - - for ( var i = 0, il = chunks.length; i < il; i ++ ) { - - // Chrome reports shader errors on lines - // starting counting from 1 - - chunks[ i ] = ( i + 1 ) + ": " + chunks[ i ]; - - } - - return chunks.join( "\n" ); - - }; - - function getShader ( type, string ) { - - var shader; - - if ( type === "fragment" ) { - - shader = _gl.createShader( _gl.FRAGMENT_SHADER ); - - } else if ( type === "vertex" ) { - - shader = _gl.createShader( _gl.VERTEX_SHADER ); - - } - - _gl.shaderSource( shader, string ); - _gl.compileShader( shader ); - - if ( !_gl.getShaderParameter( shader, _gl.COMPILE_STATUS ) ) { - - console.error( _gl.getShaderInfoLog( shader ) ); - console.error( addLineNumbers( string ) ); - return null; - - } - - return shader; - - }; - - // Textures - - function setTextureParameters ( textureType, texture, isImagePowerOfTwo ) { - - if ( isImagePowerOfTwo ) { - - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) ); - - _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) ); - - } else { - - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); - - _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) ); - - } - - if ( _glExtensionTextureFilterAnisotropic && texture.type !== THREE.FloatType ) { - - if ( texture.anisotropy > 1 || texture.__oldAnisotropy ) { - - _gl.texParameterf( textureType, _glExtensionTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, _maxAnisotropy ) ); - texture.__oldAnisotropy = texture.anisotropy; - - } - - } - - }; - - this.setTexture = function ( texture, slot ) { - - if ( texture.needsUpdate ) { - - if ( ! texture.__webglInit ) { - - texture.__webglInit = true; - - texture.addEventListener( 'dispose', onTextureDispose ); - - texture.__webglTexture = _gl.createTexture(); - - _this.info.memory.textures ++; - - } - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); - - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); - _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment ); - - var image = texture.image, - isImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); - - setTextureParameters( _gl.TEXTURE_2D, texture, isImagePowerOfTwo ); - - var mipmap, mipmaps = texture.mipmaps; - - if ( texture instanceof THREE.DataTexture ) { - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isImagePowerOfTwo ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - texture.generateMipmaps = false; - - } else { - - _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, image.width, image.height, 0, glFormat, glType, image.data ); - - } - - } else if ( texture instanceof THREE.CompressedTexture ) { - - for( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - if ( texture.format!==THREE.RGBAFormat ) { - _gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - } else { - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - } - - } - - } else { // regular Texture (image, video, canvas) - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isImagePowerOfTwo ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, glFormat, glType, mipmap ); - - } - - texture.generateMipmaps = false; - - } else { - - _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, glFormat, glType, texture.image ); - - } - - } - - if ( texture.generateMipmaps && isImagePowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D ); - - texture.needsUpdate = false; - - if ( texture.onUpdate ) texture.onUpdate(); - - } else { - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); - - } - - }; - - function clampToMaxSize ( image, maxSize ) { - - if ( image.width <= maxSize && image.height <= maxSize ) { - - return image; - - } - - // Warning: Scaling through the canvas will only work with images that use - // premultiplied alpha. - - var maxDimension = Math.max( image.width, image.height ); - var newWidth = Math.floor( image.width * maxSize / maxDimension ); - var newHeight = Math.floor( image.height * maxSize / maxDimension ); - - var canvas = document.createElement( 'canvas' ); - canvas.width = newWidth; - canvas.height = newHeight; - - var ctx = canvas.getContext( "2d" ); - ctx.drawImage( image, 0, 0, image.width, image.height, 0, 0, newWidth, newHeight ); - - return canvas; - - } - - function setCubeTexture ( texture, slot ) { - - if ( texture.image.length === 6 ) { - - if ( texture.needsUpdate ) { - - if ( ! texture.image.__webglTextureCube ) { - - texture.addEventListener( 'dispose', onTextureDispose ); - - texture.image.__webglTextureCube = _gl.createTexture(); - - _this.info.memory.textures ++; - - } - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube ); - - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - - var isCompressed = texture instanceof THREE.CompressedTexture; - - var cubeImage = []; - - for ( var i = 0; i < 6; i ++ ) { - - if ( _this.autoScaleCubemaps && ! isCompressed ) { - - cubeImage[ i ] = clampToMaxSize( texture.image[ i ], _maxCubemapSize ); - - } else { - - cubeImage[ i ] = texture.image[ i ]; - - } - - } - - var image = cubeImage[ 0 ], - isImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); - - setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, isImagePowerOfTwo ); - - for ( var i = 0; i < 6; i ++ ) { - - if( !isCompressed ) { - - _gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] ); - - } else { - - var mipmap, mipmaps = cubeImage[ i ].mipmaps; - - for( var j = 0, jl = mipmaps.length; j < jl; j ++ ) { - - mipmap = mipmaps[ j ]; - if ( texture.format!==THREE.RGBAFormat ) { - - _gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - _gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - } - - } - } - } - - if ( texture.generateMipmaps && isImagePowerOfTwo ) { - - _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - - } - - texture.needsUpdate = false; - - if ( texture.onUpdate ) texture.onUpdate(); - - } else { - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube ); - - } - - } - - }; - - function setCubeTextureDynamic ( texture, slot ) { - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.__webglTexture ); - - }; - - // Render targets - - function setupFrameBuffer ( framebuffer, renderTarget, textureTarget ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureTarget, renderTarget.__webglTexture, 0 ); - - }; - - function setupRenderBuffer ( renderbuffer, renderTarget ) { - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer ); - - if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_COMPONENT16, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - - /* For some reason this is not working. Defaulting to RGBA4. - } else if( ! renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.STENCIL_INDEX8, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - */ - } else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - - } else { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.RGBA4, renderTarget.width, renderTarget.height ); - - } - - }; - - this.setRenderTarget = function ( renderTarget ) { - - var isCube = ( renderTarget instanceof THREE.WebGLRenderTargetCube ); - - if ( renderTarget && ! renderTarget.__webglFramebuffer ) { - - if ( renderTarget.depthBuffer === undefined ) renderTarget.depthBuffer = true; - if ( renderTarget.stencilBuffer === undefined ) renderTarget.stencilBuffer = true; - - renderTarget.addEventListener( 'dispose', onRenderTargetDispose ); - - renderTarget.__webglTexture = _gl.createTexture(); - - _this.info.memory.textures ++; - - // Setup texture, create render and frame buffers - - var isTargetPowerOfTwo = THREE.Math.isPowerOfTwo( renderTarget.width ) && THREE.Math.isPowerOfTwo( renderTarget.height ), - glFormat = paramThreeToGL( renderTarget.format ), - glType = paramThreeToGL( renderTarget.type ); - - if ( isCube ) { - - renderTarget.__webglFramebuffer = []; - renderTarget.__webglRenderbuffer = []; - - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture ); - setTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget, isTargetPowerOfTwo ); - - for ( var i = 0; i < 6; i ++ ) { - - renderTarget.__webglFramebuffer[ i ] = _gl.createFramebuffer(); - renderTarget.__webglRenderbuffer[ i ] = _gl.createRenderbuffer(); - - _gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null ); - - setupFrameBuffer( renderTarget.__webglFramebuffer[ i ], renderTarget, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i ); - setupRenderBuffer( renderTarget.__webglRenderbuffer[ i ], renderTarget ); - - } - - if ( isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - - } else { - - renderTarget.__webglFramebuffer = _gl.createFramebuffer(); - - if ( renderTarget.shareDepthFrom ) { - - renderTarget.__webglRenderbuffer = renderTarget.shareDepthFrom.__webglRenderbuffer; - - } else { - - renderTarget.__webglRenderbuffer = _gl.createRenderbuffer(); - - } - - _gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture ); - setTextureParameters( _gl.TEXTURE_2D, renderTarget, isTargetPowerOfTwo ); - - _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null ); - - setupFrameBuffer( renderTarget.__webglFramebuffer, renderTarget, _gl.TEXTURE_2D ); - - if ( renderTarget.shareDepthFrom ) { - - if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) { - - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderTarget.__webglRenderbuffer ); - - } else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderTarget.__webglRenderbuffer ); - - } - - } else { - - setupRenderBuffer( renderTarget.__webglRenderbuffer, renderTarget ); - - } - - if ( isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D ); - - } - - // Release everything - - if ( isCube ) { - - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); - - } else { - - _gl.bindTexture( _gl.TEXTURE_2D, null ); - - } - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, null ); - _gl.bindFramebuffer( _gl.FRAMEBUFFER, null ); - - } - - var framebuffer, width, height, vx, vy; - - if ( renderTarget ) { - - if ( isCube ) { - - framebuffer = renderTarget.__webglFramebuffer[ renderTarget.activeCubeFace ]; - - } else { - - framebuffer = renderTarget.__webglFramebuffer; - - } - - width = renderTarget.width; - height = renderTarget.height; - - vx = 0; - vy = 0; - - } else { - - framebuffer = null; - - width = _viewportWidth; - height = _viewportHeight; - - vx = _viewportX; - vy = _viewportY; - - } - - if ( framebuffer !== _currentFramebuffer ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - _gl.viewport( vx, vy, width, height ); - - _currentFramebuffer = framebuffer; - - } - - _currentWidth = width; - _currentHeight = height; - - }; - - function updateRenderTargetMipmap ( renderTarget ) { - - if ( renderTarget instanceof THREE.WebGLRenderTargetCube ) { - - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture ); - _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); - - } else { - - _gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture ); - _gl.generateMipmap( _gl.TEXTURE_2D ); - _gl.bindTexture( _gl.TEXTURE_2D, null ); - - } - - }; - - // Fallback filters for non-power-of-2 textures - - function filterFallback ( f ) { - - if ( f === THREE.NearestFilter || f === THREE.NearestMipMapNearestFilter || f === THREE.NearestMipMapLinearFilter ) { - - return _gl.NEAREST; - - } - - return _gl.LINEAR; - - }; - - // Map three.js constants to WebGL constants - - function paramThreeToGL ( p ) { - - if ( p === THREE.RepeatWrapping ) return _gl.REPEAT; - if ( p === THREE.ClampToEdgeWrapping ) return _gl.CLAMP_TO_EDGE; - if ( p === THREE.MirroredRepeatWrapping ) return _gl.MIRRORED_REPEAT; - - if ( p === THREE.NearestFilter ) return _gl.NEAREST; - if ( p === THREE.NearestMipMapNearestFilter ) return _gl.NEAREST_MIPMAP_NEAREST; - if ( p === THREE.NearestMipMapLinearFilter ) return _gl.NEAREST_MIPMAP_LINEAR; - - if ( p === THREE.LinearFilter ) return _gl.LINEAR; - if ( p === THREE.LinearMipMapNearestFilter ) return _gl.LINEAR_MIPMAP_NEAREST; - if ( p === THREE.LinearMipMapLinearFilter ) return _gl.LINEAR_MIPMAP_LINEAR; - - if ( p === THREE.UnsignedByteType ) return _gl.UNSIGNED_BYTE; - if ( p === THREE.UnsignedShort4444Type ) return _gl.UNSIGNED_SHORT_4_4_4_4; - if ( p === THREE.UnsignedShort5551Type ) return _gl.UNSIGNED_SHORT_5_5_5_1; - if ( p === THREE.UnsignedShort565Type ) return _gl.UNSIGNED_SHORT_5_6_5; - - if ( p === THREE.ByteType ) return _gl.BYTE; - if ( p === THREE.ShortType ) return _gl.SHORT; - if ( p === THREE.UnsignedShortType ) return _gl.UNSIGNED_SHORT; - if ( p === THREE.IntType ) return _gl.INT; - if ( p === THREE.UnsignedIntType ) return _gl.UNSIGNED_INT; - if ( p === THREE.FloatType ) return _gl.FLOAT; - - if ( p === THREE.AlphaFormat ) return _gl.ALPHA; - if ( p === THREE.RGBFormat ) return _gl.RGB; - if ( p === THREE.RGBAFormat ) return _gl.RGBA; - if ( p === THREE.LuminanceFormat ) return _gl.LUMINANCE; - if ( p === THREE.LuminanceAlphaFormat ) return _gl.LUMINANCE_ALPHA; - - if ( p === THREE.AddEquation ) return _gl.FUNC_ADD; - if ( p === THREE.SubtractEquation ) return _gl.FUNC_SUBTRACT; - if ( p === THREE.ReverseSubtractEquation ) return _gl.FUNC_REVERSE_SUBTRACT; - - if ( p === THREE.ZeroFactor ) return _gl.ZERO; - if ( p === THREE.OneFactor ) return _gl.ONE; - if ( p === THREE.SrcColorFactor ) return _gl.SRC_COLOR; - if ( p === THREE.OneMinusSrcColorFactor ) return _gl.ONE_MINUS_SRC_COLOR; - if ( p === THREE.SrcAlphaFactor ) return _gl.SRC_ALPHA; - if ( p === THREE.OneMinusSrcAlphaFactor ) return _gl.ONE_MINUS_SRC_ALPHA; - if ( p === THREE.DstAlphaFactor ) return _gl.DST_ALPHA; - if ( p === THREE.OneMinusDstAlphaFactor ) return _gl.ONE_MINUS_DST_ALPHA; - - if ( p === THREE.DstColorFactor ) return _gl.DST_COLOR; - if ( p === THREE.OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR; - if ( p === THREE.SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE; - - if ( _glExtensionCompressedTextureS3TC !== undefined ) { - - if ( p === THREE.RGB_S3TC_DXT1_Format ) return _glExtensionCompressedTextureS3TC.COMPRESSED_RGB_S3TC_DXT1_EXT; - if ( p === THREE.RGBA_S3TC_DXT1_Format ) return _glExtensionCompressedTextureS3TC.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if ( p === THREE.RGBA_S3TC_DXT3_Format ) return _glExtensionCompressedTextureS3TC.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if ( p === THREE.RGBA_S3TC_DXT5_Format ) return _glExtensionCompressedTextureS3TC.COMPRESSED_RGBA_S3TC_DXT5_EXT; - - } - - return 0; - - }; - - // Allocations - - function allocateBones ( object ) { - - if ( _supportsBoneTextures && object && object.useVertexTexture ) { - - return 1024; - - } else { - - // default for when object is not specified - // ( for example when prebuilding shader - // to be used with multiple objects ) - // - // - leave some extra space for other uniforms - // - limit here is ANGLE's 254 max uniform vectors - // (up to 54 should be safe) - - var nVertexUniforms = _gl.getParameter( _gl.MAX_VERTEX_UNIFORM_VECTORS ); - var nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 ); - - var maxBones = nVertexMatrices; - - if ( object !== undefined && object instanceof THREE.SkinnedMesh ) { - - maxBones = Math.min( object.bones.length, maxBones ); - - if ( maxBones < object.bones.length ) { - - console.warn( "WebGLRenderer: too many bones - " + object.bones.length + ", this GPU supports just " + maxBones + " (try OpenGL instead of ANGLE)" ); - - } - - } - - return maxBones; - - } - - }; - - function allocateLights( lights ) { - - var dirLights = 0; - var pointLights = 0; - var spotLights = 0; - var hemiLights = 0; - - for ( var l = 0, ll = lights.length; l < ll; l ++ ) { - - var light = lights[ l ]; - - if ( light.onlyShadow || light.visible === false ) continue; - - if ( light instanceof THREE.DirectionalLight ) dirLights ++; - if ( light instanceof THREE.PointLight ) pointLights ++; - if ( light instanceof THREE.SpotLight ) spotLights ++; - if ( light instanceof THREE.HemisphereLight ) hemiLights ++; - - } - - return { 'directional' : dirLights, 'point' : pointLights, 'spot': spotLights, 'hemi': hemiLights }; - - }; - - function allocateShadows( lights ) { - - var maxShadows = 0; - - for ( var l = 0, ll = lights.length; l < ll; l++ ) { - - var light = lights[ l ]; - - if ( ! light.castShadow ) continue; - - if ( light instanceof THREE.SpotLight ) maxShadows ++; - if ( light instanceof THREE.DirectionalLight && ! light.shadowCascade ) maxShadows ++; - - } - - return maxShadows; - - }; - - // Initialization - - function initGL() { - - try { - - var attributes = { - alpha: _alpha, - premultipliedAlpha: _premultipliedAlpha, - antialias: _antialias, - stencil: _stencil, - preserveDrawingBuffer: _preserveDrawingBuffer - }; - - _gl = _context || _canvas.getContext( 'webgl', attributes ) || _canvas.getContext( 'experimental-webgl', attributes ); - - if ( _gl === null ) { - - throw 'Error creating WebGL context.'; - - } - - } catch ( error ) { - - console.error( error ); - - } - - _glExtensionTextureFloat = _gl.getExtension( 'OES_texture_float' ); - _glExtensionTextureFloatLinear = _gl.getExtension( 'OES_texture_float_linear' ); - _glExtensionStandardDerivatives = _gl.getExtension( 'OES_standard_derivatives' ); - - _glExtensionTextureFilterAnisotropic = _gl.getExtension( 'EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' ); - - _glExtensionCompressedTextureS3TC = _gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' ); - - if ( ! _glExtensionTextureFloat ) { - - console.log( 'THREE.WebGLRenderer: Float textures not supported.' ); - - } - - if ( ! _glExtensionStandardDerivatives ) { - - console.log( 'THREE.WebGLRenderer: Standard derivatives not supported.' ); - - } - - if ( ! _glExtensionTextureFilterAnisotropic ) { - - console.log( 'THREE.WebGLRenderer: Anisotropic texture filtering not supported.' ); - - } - - if ( ! _glExtensionCompressedTextureS3TC ) { - - console.log( 'THREE.WebGLRenderer: S3TC compressed textures not supported.' ); - - } - - if ( _gl.getShaderPrecisionFormat === undefined ) { - - _gl.getShaderPrecisionFormat = function() { - - return { - "rangeMin" : 1, - "rangeMax" : 1, - "precision" : 1 - }; - - } - } - - }; - - function setDefaultGLState () { - - _gl.clearColor( 0, 0, 0, 1 ); - _gl.clearDepth( 1 ); - _gl.clearStencil( 0 ); - - _gl.enable( _gl.DEPTH_TEST ); - _gl.depthFunc( _gl.LEQUAL ); - - _gl.frontFace( _gl.CCW ); - _gl.cullFace( _gl.BACK ); - _gl.enable( _gl.CULL_FACE ); - - _gl.enable( _gl.BLEND ); - _gl.blendEquation( _gl.FUNC_ADD ); - _gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA ); - - _gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight ); - - _gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - }; - - // default plugins (order is important) - - this.shadowMapPlugin = new THREE.ShadowMapPlugin(); - this.addPrePlugin( this.shadowMapPlugin ); - - this.addPostPlugin( new THREE.SpritePlugin() ); - this.addPostPlugin( new THREE.LensFlarePlugin() ); - -}; - -/** - * @author szimek / https://github.com/szimek/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.WebGLRenderTarget = function ( width, height, options ) { - - this.width = width; - this.height = height; - - options = options || {}; - - this.wrapS = options.wrapS !== undefined ? options.wrapS : THREE.ClampToEdgeWrapping; - this.wrapT = options.wrapT !== undefined ? options.wrapT : THREE.ClampToEdgeWrapping; - - this.magFilter = options.magFilter !== undefined ? options.magFilter : THREE.LinearFilter; - this.minFilter = options.minFilter !== undefined ? options.minFilter : THREE.LinearMipMapLinearFilter; - - this.anisotropy = options.anisotropy !== undefined ? options.anisotropy : 1; - - this.offset = new THREE.Vector2( 0, 0 ); - this.repeat = new THREE.Vector2( 1, 1 ); - - this.format = options.format !== undefined ? options.format : THREE.RGBAFormat; - this.type = options.type !== undefined ? options.type : THREE.UnsignedByteType; - - this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; - this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true; - - this.generateMipmaps = true; - - this.shareDepthFrom = null; - -}; - -THREE.WebGLRenderTarget.prototype = { - - constructor: THREE.WebGLRenderTarget, - - clone: function () { - - var tmp = new THREE.WebGLRenderTarget( this.width, this.height ); - - tmp.wrapS = this.wrapS; - tmp.wrapT = this.wrapT; - - tmp.magFilter = this.magFilter; - tmp.minFilter = this.minFilter; - - tmp.anisotropy = this.anisotropy; - - tmp.offset.copy( this.offset ); - tmp.repeat.copy( this.repeat ); - - tmp.format = this.format; - tmp.type = this.type; - - tmp.depthBuffer = this.depthBuffer; - tmp.stencilBuffer = this.stencilBuffer; - - tmp.generateMipmaps = this.generateMipmaps; - - tmp.shareDepthFrom = this.shareDepthFrom; - - return tmp; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.WebGLRenderTarget.prototype ); - -/** - * @author alteredq / http://alteredqualia.com - */ - -THREE.WebGLRenderTargetCube = function ( width, height, options ) { - - THREE.WebGLRenderTarget.call( this, width, height, options ); - - this.activeCubeFace = 0; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5 - -}; - -THREE.WebGLRenderTargetCube.prototype = Object.create( THREE.WebGLRenderTarget.prototype ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.RenderableVertex = function () { - - this.position = new THREE.Vector3(); - this.positionWorld = new THREE.Vector3(); - this.positionScreen = new THREE.Vector4(); - - this.visible = true; - -}; - -THREE.RenderableVertex.prototype.copy = function ( vertex ) { - - this.positionWorld.copy( vertex.positionWorld ); - this.positionScreen.copy( vertex.positionScreen ); - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.RenderableFace = function () { - - this.id = 0; - - this.v1 = new THREE.RenderableVertex(); - this.v2 = new THREE.RenderableVertex(); - this.v3 = new THREE.RenderableVertex(); - - this.centroidModel = new THREE.Vector3(); - - this.normalModel = new THREE.Vector3(); - - this.vertexNormalsModel = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ]; - this.vertexNormalsLength = 0; - - this.color = null; - this.material = null; - this.uvs = [[]]; - - this.z = 0; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.RenderableObject = function () { - - this.id = 0; - - this.object = null; - this.z = 0; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.RenderableSprite = function () { - - this.id = 0; - - this.object = null; - - this.x = 0; - this.y = 0; - this.z = 0; - - this.rotation = 0; - this.scale = new THREE.Vector2(); - - this.material = null; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.RenderableLine = function () { - - this.id = 0; - - this.v1 = new THREE.RenderableVertex(); - this.v2 = new THREE.RenderableVertex(); - - this.vertexColors = [ new THREE.Color(), new THREE.Color() ]; - this.material = null; - - this.z = 0; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.GeometryUtils = { - - // Merge two geometries or geometry and geometry from object (using object's transform) - - merge: function ( geometry1, object2 /* mesh | geometry */, materialIndexOffset ) { - - var matrix, normalMatrix, - vertexOffset = geometry1.vertices.length, - uvPosition = geometry1.faceVertexUvs[ 0 ].length, - geometry2 = object2 instanceof THREE.Mesh ? object2.geometry : object2, - vertices1 = geometry1.vertices, - vertices2 = geometry2.vertices, - faces1 = geometry1.faces, - faces2 = geometry2.faces, - uvs1 = geometry1.faceVertexUvs[ 0 ], - uvs2 = geometry2.faceVertexUvs[ 0 ]; - - if ( materialIndexOffset === undefined ) materialIndexOffset = 0; - - if ( object2 instanceof THREE.Mesh ) { - - object2.matrixAutoUpdate && object2.updateMatrix(); - - matrix = object2.matrix; - - normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); - - } - - // vertices - - for ( var i = 0, il = vertices2.length; i < il; i ++ ) { - - var vertex = vertices2[ i ]; - - var vertexCopy = vertex.clone(); - - if ( matrix ) vertexCopy.applyMatrix4( matrix ); - - vertices1.push( vertexCopy ); - - } - - // faces - - for ( i = 0, il = faces2.length; i < il; i ++ ) { - - var face = faces2[ i ], faceCopy, normal, color, - faceVertexNormals = face.vertexNormals, - faceVertexColors = face.vertexColors; - - faceCopy = new THREE.Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset ); - faceCopy.normal.copy( face.normal ); - - if ( normalMatrix ) { - - faceCopy.normal.applyMatrix3( normalMatrix ).normalize(); - - } - - for ( var j = 0, jl = faceVertexNormals.length; j < jl; j ++ ) { - - normal = faceVertexNormals[ j ].clone(); - - if ( normalMatrix ) { - - normal.applyMatrix3( normalMatrix ).normalize(); - - } - - faceCopy.vertexNormals.push( normal ); - - } - - faceCopy.color.copy( face.color ); - - for ( var j = 0, jl = faceVertexColors.length; j < jl; j ++ ) { - - color = faceVertexColors[ j ]; - faceCopy.vertexColors.push( color.clone() ); - - } - - faceCopy.materialIndex = face.materialIndex + materialIndexOffset; - - faceCopy.centroid.copy( face.centroid ); - - if ( matrix ) { - - faceCopy.centroid.applyMatrix4( matrix ); - - } - - faces1.push( faceCopy ); - - } - - // uvs - - for ( i = 0, il = uvs2.length; i < il; i ++ ) { - - var uv = uvs2[ i ], uvCopy = []; - - for ( var j = 0, jl = uv.length; j < jl; j ++ ) { - - uvCopy.push( new THREE.Vector2( uv[ j ].x, uv[ j ].y ) ); - - } - - uvs1.push( uvCopy ); - - } - - }, - - // Get random point in triangle (via barycentric coordinates) - // (uniform distribution) - // http://www.cgafaq.info/wiki/Random_Point_In_Triangle - - randomPointInTriangle: function () { - - var vector = new THREE.Vector3(); - - return function ( vectorA, vectorB, vectorC ) { - - var point = new THREE.Vector3(); - - var a = THREE.Math.random16(); - var b = THREE.Math.random16(); - - if ( ( a + b ) > 1 ) { - - a = 1 - a; - b = 1 - b; - - } - - var c = 1 - a - b; - - point.copy( vectorA ); - point.multiplyScalar( a ); - - vector.copy( vectorB ); - vector.multiplyScalar( b ); - - point.add( vector ); - - vector.copy( vectorC ); - vector.multiplyScalar( c ); - - point.add( vector ); - - return point; - - }; - - }(), - - // Get random point in face (triangle / quad) - // (uniform distribution) - - randomPointInFace: function ( face, geometry, useCachedAreas ) { - - var vA, vB, vC, vD; - - vA = geometry.vertices[ face.a ]; - vB = geometry.vertices[ face.b ]; - vC = geometry.vertices[ face.c ]; - - return THREE.GeometryUtils.randomPointInTriangle( vA, vB, vC ); - - }, - - // Get uniformly distributed random points in mesh - // - create array with cumulative sums of face areas - // - pick random number from 0 to total area - // - find corresponding place in area array by binary search - // - get random point in face - - randomPointsInGeometry: function ( geometry, n ) { - - var face, i, - faces = geometry.faces, - vertices = geometry.vertices, - il = faces.length, - totalArea = 0, - cumulativeAreas = [], - vA, vB, vC, vD; - - // precompute face areas - - for ( i = 0; i < il; i ++ ) { - - face = faces[ i ]; - - vA = vertices[ face.a ]; - vB = vertices[ face.b ]; - vC = vertices[ face.c ]; - - face._area = THREE.GeometryUtils.triangleArea( vA, vB, vC ); - - totalArea += face._area; - - cumulativeAreas[ i ] = totalArea; - - } - - // binary search cumulative areas array - - function binarySearchIndices( value ) { - - function binarySearch( start, end ) { - - // return closest larger index - // if exact number is not found - - if ( end < start ) - return start; - - var mid = start + Math.floor( ( end - start ) / 2 ); - - if ( cumulativeAreas[ mid ] > value ) { - - return binarySearch( start, mid - 1 ); - - } else if ( cumulativeAreas[ mid ] < value ) { - - return binarySearch( mid + 1, end ); - - } else { - - return mid; - - } - - } - - var result = binarySearch( 0, cumulativeAreas.length - 1 ) - return result; - - } - - // pick random face weighted by face area - - var r, index, - result = []; - - var stats = {}; - - for ( i = 0; i < n; i ++ ) { - - r = THREE.Math.random16() * totalArea; - - index = binarySearchIndices( r ); - - result[ i ] = THREE.GeometryUtils.randomPointInFace( faces[ index ], geometry, true ); - - if ( ! stats[ index ] ) { - - stats[ index ] = 1; - - } else { - - stats[ index ] += 1; - - } - - } - - return result; - - }, - - // Get triangle area (half of parallelogram) - // http://mathworld.wolfram.com/TriangleArea.html - - triangleArea: function () { - - var vector1 = new THREE.Vector3(); - var vector2 = new THREE.Vector3(); - - return function ( vectorA, vectorB, vectorC ) { - - vector1.subVectors( vectorB, vectorA ); - vector2.subVectors( vectorC, vectorA ); - vector1.cross( vector2 ); - - return 0.5 * vector1.length(); - - }; - - }(), - - // Center geometry so that 0,0,0 is in center of bounding box - - center: function ( geometry ) { - - geometry.computeBoundingBox(); - - var bb = geometry.boundingBox; - - var offset = new THREE.Vector3(); - - offset.addVectors( bb.min, bb.max ); - offset.multiplyScalar( -0.5 ); - - geometry.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) ); - geometry.computeBoundingBox(); - - return offset; - - }, - - triangulateQuads: function ( geometry ) { - - var i, il, j, jl; - - var faces = []; - var faceVertexUvs = []; - - for ( i = 0, il = geometry.faceVertexUvs.length; i < il; i ++ ) { - - faceVertexUvs[ i ] = []; - - } - - for ( i = 0, il = geometry.faces.length; i < il; i ++ ) { - - var face = geometry.faces[ i ]; - - faces.push( face ); - - for ( j = 0, jl = geometry.faceVertexUvs.length; j < jl; j ++ ) { - - faceVertexUvs[ j ].push( geometry.faceVertexUvs[ j ][ i ] ); - - } - - } - - geometry.faces = faces; - geometry.faceVertexUvs = faceVertexUvs; - - geometry.computeCentroids(); - geometry.computeFaceNormals(); - geometry.computeVertexNormals(); - - if ( geometry.hasTangents ) geometry.computeTangents(); - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.ImageUtils = { - - crossOrigin: undefined, - - loadTexture: function ( url, mapping, onLoad, onError ) { - - var loader = new THREE.ImageLoader(); - loader.crossOrigin = this.crossOrigin; - - var texture = new THREE.Texture( undefined, mapping ); - - var image = loader.load( url, function () { - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } ); - - texture.image = image; - texture.sourceFile = url; - - return texture; - - }, - - loadCompressedTexture: function ( url, mapping, onLoad, onError ) { - - var texture = new THREE.CompressedTexture(); - texture.mapping = mapping; - - var request = new XMLHttpRequest(); - - request.onload = function () { - - var buffer = request.response; - var dds = THREE.ImageUtils.parseDDS( buffer, true ); - - texture.format = dds.format; - - texture.mipmaps = dds.mipmaps; - texture.image.width = dds.width; - texture.image.height = dds.height; - - // gl.generateMipmap fails for compressed textures - // mipmaps must be embedded in the DDS file - // or texture filters must not use mipmapping - - texture.generateMipmaps = false; - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - request.onerror = onError; - - request.open( 'GET', url, true ); - request.responseType = "arraybuffer"; - request.send( null ); - - return texture; - - }, - - loadTextureCube: function ( array, mapping, onLoad, onError ) { - - var images = []; - images.loadCount = 0; - - var texture = new THREE.Texture(); - texture.image = images; - if ( mapping !== undefined ) texture.mapping = mapping; - - // no flipping needed for cube textures - - texture.flipY = false; - - for ( var i = 0, il = array.length; i < il; ++ i ) { - - var cubeImage = new Image(); - images[ i ] = cubeImage; - - cubeImage.onload = function () { - - images.loadCount += 1; - - if ( images.loadCount === 6 ) { - - texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); - - } - - }; - - cubeImage.onerror = onError; - - cubeImage.crossOrigin = this.crossOrigin; - cubeImage.src = array[ i ]; - - } - - return texture; - - }, - - loadCompressedTextureCube: function ( array, mapping, onLoad, onError ) { - - var images = []; - images.loadCount = 0; - - var texture = new THREE.CompressedTexture(); - texture.image = images; - if ( mapping !== undefined ) texture.mapping = mapping; - - // no flipping for cube textures - // (also flipping doesn't work for compressed textures ) - - texture.flipY = false; - - // can't generate mipmaps for compressed textures - // mips must be embedded in DDS files - - texture.generateMipmaps = false; - - var generateCubeFaceCallback = function ( rq, img ) { - - return function () { - - var buffer = rq.response; - var dds = THREE.ImageUtils.parseDDS( buffer, true ); - - img.format = dds.format; - - img.mipmaps = dds.mipmaps; - img.width = dds.width; - img.height = dds.height; - - images.loadCount += 1; - - if ( images.loadCount === 6 ) { - - texture.format = dds.format; - texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); - - } - - } - - } - - // compressed cubemap textures as 6 separate DDS files - - if ( array instanceof Array ) { - - for ( var i = 0, il = array.length; i < il; ++ i ) { - - var cubeImage = {}; - images[ i ] = cubeImage; - - var request = new XMLHttpRequest(); - - request.onload = generateCubeFaceCallback( request, cubeImage ); - request.onerror = onError; - - var url = array[ i ]; - - request.open( 'GET', url, true ); - request.responseType = "arraybuffer"; - request.send( null ); - - } - - // compressed cubemap texture stored in a single DDS file - - } else { - - var url = array; - var request = new XMLHttpRequest(); - - request.onload = function( ) { - - var buffer = request.response; - var dds = THREE.ImageUtils.parseDDS( buffer, true ); - - if ( dds.isCubemap ) { - - var faces = dds.mipmaps.length / dds.mipmapCount; - - for ( var f = 0; f < faces; f ++ ) { - - images[ f ] = { mipmaps : [] }; - - for ( var i = 0; i < dds.mipmapCount; i ++ ) { - - images[ f ].mipmaps.push( dds.mipmaps[ f * dds.mipmapCount + i ] ); - images[ f ].format = dds.format; - images[ f ].width = dds.width; - images[ f ].height = dds.height; - - } - - } - - texture.format = dds.format; - texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); - - } - - } - - request.onerror = onError; - - request.open( 'GET', url, true ); - request.responseType = "arraybuffer"; - request.send( null ); - - } - - return texture; - - }, - - loadDDSTexture: function ( url, mapping, onLoad, onError ) { - - var images = []; - images.loadCount = 0; - - var texture = new THREE.CompressedTexture(); - texture.image = images; - if ( mapping !== undefined ) texture.mapping = mapping; - - // no flipping for cube textures - // (also flipping doesn't work for compressed textures ) - - texture.flipY = false; - - // can't generate mipmaps for compressed textures - // mips must be embedded in DDS files - - texture.generateMipmaps = false; - - { - var request = new XMLHttpRequest(); - - request.onload = function( ) { - - var buffer = request.response; - var dds = THREE.ImageUtils.parseDDS( buffer, true ); - - if ( dds.isCubemap ) { - - var faces = dds.mipmaps.length / dds.mipmapCount; - - for ( var f = 0; f < faces; f ++ ) { - - images[ f ] = { mipmaps : [] }; - - for ( var i = 0; i < dds.mipmapCount; i ++ ) { - - images[ f ].mipmaps.push( dds.mipmaps[ f * dds.mipmapCount + i ] ); - images[ f ].format = dds.format; - images[ f ].width = dds.width; - images[ f ].height = dds.height; - - } - - } - - - } else { - texture.image.width = dds.width; - texture.image.height = dds.height; - texture.mipmaps = dds.mipmaps; - } - - texture.format = dds.format; - texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); - - } - - request.onerror = onError; - - request.open( 'GET', url, true ); - request.responseType = "arraybuffer"; - request.send( null ); - - } - - return texture; - - }, - - parseDDS: function ( buffer, loadMipmaps ) { - - var dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 }; - - // Adapted from @toji's DDS utils - // https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js - - // All values and structures referenced from: - // http://msdn.microsoft.com/en-us/library/bb943991.aspx/ - - var DDS_MAGIC = 0x20534444; - - var DDSD_CAPS = 0x1, - DDSD_HEIGHT = 0x2, - DDSD_WIDTH = 0x4, - DDSD_PITCH = 0x8, - DDSD_PIXELFORMAT = 0x1000, - DDSD_MIPMAPCOUNT = 0x20000, - DDSD_LINEARSIZE = 0x80000, - DDSD_DEPTH = 0x800000; - - var DDSCAPS_COMPLEX = 0x8, - DDSCAPS_MIPMAP = 0x400000, - DDSCAPS_TEXTURE = 0x1000; - - var DDSCAPS2_CUBEMAP = 0x200, - DDSCAPS2_CUBEMAP_POSITIVEX = 0x400, - DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800, - DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000, - DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000, - DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000, - DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000, - DDSCAPS2_VOLUME = 0x200000; - - var DDPF_ALPHAPIXELS = 0x1, - DDPF_ALPHA = 0x2, - DDPF_FOURCC = 0x4, - DDPF_RGB = 0x40, - DDPF_YUV = 0x200, - DDPF_LUMINANCE = 0x20000; - - function fourCCToInt32( value ) { - - return value.charCodeAt(0) + - (value.charCodeAt(1) << 8) + - (value.charCodeAt(2) << 16) + - (value.charCodeAt(3) << 24); - - } - - function int32ToFourCC( value ) { - - return String.fromCharCode( - value & 0xff, - (value >> 8) & 0xff, - (value >> 16) & 0xff, - (value >> 24) & 0xff - ); - } - - function loadARGBMip( buffer, dataOffset, width, height ) { - var dataLength = width*height*4; - var srcBuffer = new Uint8Array( buffer, dataOffset, dataLength ); - var byteArray = new Uint8Array( dataLength ); - var dst = 0; - var src = 0; - for ( var y = 0; y < height; y++ ) { - for ( var x = 0; x < width; x++ ) { - var b = srcBuffer[src]; src++; - var g = srcBuffer[src]; src++; - var r = srcBuffer[src]; src++; - var a = srcBuffer[src]; src++; - byteArray[dst] = r; dst++; //r - byteArray[dst] = g; dst++; //g - byteArray[dst] = b; dst++; //b - byteArray[dst] = a; dst++; //a - } - } - return byteArray; - } - - var FOURCC_DXT1 = fourCCToInt32("DXT1"); - var FOURCC_DXT3 = fourCCToInt32("DXT3"); - var FOURCC_DXT5 = fourCCToInt32("DXT5"); - - var headerLengthInt = 31; // The header length in 32 bit ints - - // Offsets into the header array - - var off_magic = 0; - - var off_size = 1; - var off_flags = 2; - var off_height = 3; - var off_width = 4; - - var off_mipmapCount = 7; - - var off_pfFlags = 20; - var off_pfFourCC = 21; - var off_RGBBitCount = 22; - var off_RBitMask = 23; - var off_GBitMask = 24; - var off_BBitMask = 25; - var off_ABitMask = 26; - - var off_caps = 27; - var off_caps2 = 28; - var off_caps3 = 29; - var off_caps4 = 30; - - // Parse header - - var header = new Int32Array( buffer, 0, headerLengthInt ); - - if ( header[ off_magic ] !== DDS_MAGIC ) { - - console.error( "ImageUtils.parseDDS(): Invalid magic number in DDS header" ); - return dds; - - } - - if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) { - - console.error( "ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code" ); - return dds; - - } - - var blockBytes; - - var fourCC = header[ off_pfFourCC ]; - - var isRGBAUncompressed = false; - - switch ( fourCC ) { - - case FOURCC_DXT1: - - blockBytes = 8; - dds.format = THREE.RGB_S3TC_DXT1_Format; - break; - - case FOURCC_DXT3: - - blockBytes = 16; - dds.format = THREE.RGBA_S3TC_DXT3_Format; - break; - - case FOURCC_DXT5: - - blockBytes = 16; - dds.format = THREE.RGBA_S3TC_DXT5_Format; - break; - - default: - - if( header[off_RGBBitCount] ==32 - && header[off_RBitMask]&0xff0000 - && header[off_GBitMask]&0xff00 - && header[off_BBitMask]&0xff - && header[off_ABitMask]&0xff000000 ) { - isRGBAUncompressed = true; - blockBytes = 64; - dds.format = THREE.RGBAFormat; - } else { - console.error( "ImageUtils.parseDDS(): Unsupported FourCC code: ", int32ToFourCC( fourCC ) ); - return dds; - } - } - - dds.mipmapCount = 1; - - if ( header[ off_flags ] & DDSD_MIPMAPCOUNT && loadMipmaps !== false ) { - - dds.mipmapCount = Math.max( 1, header[ off_mipmapCount ] ); - - } - - //TODO: Verify that all faces of the cubemap are present with DDSCAPS2_CUBEMAP_POSITIVEX, etc. - - dds.isCubemap = header[ off_caps2 ] & DDSCAPS2_CUBEMAP ? true : false; - - dds.width = header[ off_width ]; - dds.height = header[ off_height ]; - - var dataOffset = header[ off_size ] + 4; - - // Extract mipmaps buffers - - var width = dds.width; - var height = dds.height; - - var faces = dds.isCubemap ? 6 : 1; - - for ( var face = 0; face < faces; face ++ ) { - - for ( var i = 0; i < dds.mipmapCount; i ++ ) { - - if( isRGBAUncompressed ) { - var byteArray = loadARGBMip( buffer, dataOffset, width, height ); - var dataLength = byteArray.length; - } else { - var dataLength = Math.max( 4, width ) / 4 * Math.max( 4, height ) / 4 * blockBytes; - var byteArray = new Uint8Array( buffer, dataOffset, dataLength ); - } - - var mipmap = { "data": byteArray, "width": width, "height": height }; - dds.mipmaps.push( mipmap ); - - dataOffset += dataLength; - - width = Math.max( width * 0.5, 1 ); - height = Math.max( height * 0.5, 1 ); - - } - - width = dds.width; - height = dds.height; - - } - - return dds; - - }, - - getNormalMap: function ( image, depth ) { - - // Adapted from http://www.paulbrunt.co.uk/lab/heightnormal/ - - var cross = function ( a, b ) { - - return [ a[ 1 ] * b[ 2 ] - a[ 2 ] * b[ 1 ], a[ 2 ] * b[ 0 ] - a[ 0 ] * b[ 2 ], a[ 0 ] * b[ 1 ] - a[ 1 ] * b[ 0 ] ]; - - } - - var subtract = function ( a, b ) { - - return [ a[ 0 ] - b[ 0 ], a[ 1 ] - b[ 1 ], a[ 2 ] - b[ 2 ] ]; - - } - - var normalize = function ( a ) { - - var l = Math.sqrt( a[ 0 ] * a[ 0 ] + a[ 1 ] * a[ 1 ] + a[ 2 ] * a[ 2 ] ); - return [ a[ 0 ] / l, a[ 1 ] / l, a[ 2 ] / l ]; - - } - - depth = depth | 1; - - var width = image.width; - var height = image.height; - - var canvas = document.createElement( 'canvas' ); - canvas.width = width; - canvas.height = height; - - var context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0 ); - - var data = context.getImageData( 0, 0, width, height ).data; - var imageData = context.createImageData( width, height ); - var output = imageData.data; - - for ( var x = 0; x < width; x ++ ) { - - for ( var y = 0; y < height; y ++ ) { - - var ly = y - 1 < 0 ? 0 : y - 1; - var uy = y + 1 > height - 1 ? height - 1 : y + 1; - var lx = x - 1 < 0 ? 0 : x - 1; - var ux = x + 1 > width - 1 ? width - 1 : x + 1; - - var points = []; - var origin = [ 0, 0, data[ ( y * width + x ) * 4 ] / 255 * depth ]; - points.push( [ - 1, 0, data[ ( y * width + lx ) * 4 ] / 255 * depth ] ); - points.push( [ - 1, - 1, data[ ( ly * width + lx ) * 4 ] / 255 * depth ] ); - points.push( [ 0, - 1, data[ ( ly * width + x ) * 4 ] / 255 * depth ] ); - points.push( [ 1, - 1, data[ ( ly * width + ux ) * 4 ] / 255 * depth ] ); - points.push( [ 1, 0, data[ ( y * width + ux ) * 4 ] / 255 * depth ] ); - points.push( [ 1, 1, data[ ( uy * width + ux ) * 4 ] / 255 * depth ] ); - points.push( [ 0, 1, data[ ( uy * width + x ) * 4 ] / 255 * depth ] ); - points.push( [ - 1, 1, data[ ( uy * width + lx ) * 4 ] / 255 * depth ] ); - - var normals = []; - var num_points = points.length; - - for ( var i = 0; i < num_points; i ++ ) { - - var v1 = points[ i ]; - var v2 = points[ ( i + 1 ) % num_points ]; - v1 = subtract( v1, origin ); - v2 = subtract( v2, origin ); - normals.push( normalize( cross( v1, v2 ) ) ); - - } - - var normal = [ 0, 0, 0 ]; - - for ( var i = 0; i < normals.length; i ++ ) { - - normal[ 0 ] += normals[ i ][ 0 ]; - normal[ 1 ] += normals[ i ][ 1 ]; - normal[ 2 ] += normals[ i ][ 2 ]; - - } - - normal[ 0 ] /= normals.length; - normal[ 1 ] /= normals.length; - normal[ 2 ] /= normals.length; - - var idx = ( y * width + x ) * 4; - - output[ idx ] = ( ( normal[ 0 ] + 1.0 ) / 2.0 * 255 ) | 0; - output[ idx + 1 ] = ( ( normal[ 1 ] + 1.0 ) / 2.0 * 255 ) | 0; - output[ idx + 2 ] = ( normal[ 2 ] * 255 ) | 0; - output[ idx + 3 ] = 255; - - } - - } - - context.putImageData( imageData, 0, 0 ); - - return canvas; - - }, - - generateDataTexture: function ( width, height, color ) { - - var size = width * height; - var data = new Uint8Array( 3 * size ); - - var r = Math.floor( color.r * 255 ); - var g = Math.floor( color.g * 255 ); - var b = Math.floor( color.b * 255 ); - - for ( var i = 0; i < size; i ++ ) { - - data[ i * 3 ] = r; - data[ i * 3 + 1 ] = g; - data[ i * 3 + 2 ] = b; - - } - - var texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat ); - texture.needsUpdate = true; - - return texture; - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.SceneUtils = { - - createMultiMaterialObject: function ( geometry, materials ) { - - var group = new THREE.Object3D(); - - for ( var i = 0, l = materials.length; i < l; i ++ ) { - - group.add( new THREE.Mesh( geometry, materials[ i ] ) ); - - } - - return group; - - }, - - detach : function ( child, parent, scene ) { - - child.applyMatrix( parent.matrixWorld ); - parent.remove( child ); - scene.add( child ); - - }, - - attach: function ( child, scene, parent ) { - - var matrixWorldInverse = new THREE.Matrix4(); - matrixWorldInverse.getInverse( parent.matrixWorld ); - child.applyMatrix( matrixWorldInverse ); - - scene.remove( child ); - parent.add( child ); - - } - -}; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author alteredq / http://alteredqualia.com/ - * - * For Text operations in three.js (See TextGeometry) - * - * It uses techniques used in: - * - * typeface.js and canvastext - * For converting fonts and rendering with javascript - * http://typeface.neocracy.org - * - * Triangulation ported from AS3 - * Simple Polygon Triangulation - * http://actionsnippet.com/?p=1462 - * - * A Method to triangulate shapes with holes - * http://www.sakri.net/blog/2009/06/12/an-approach-to-triangulating-polygons-with-holes/ - * - */ - -THREE.FontUtils = { - - faces : {}, - - // Just for now. face[weight][style] - - face : "helvetiker", - weight: "normal", - style : "normal", - size : 150, - divisions : 10, - - getFace : function() { - - return this.faces[ this.face ][ this.weight ][ this.style ]; - - }, - - loadFace : function( data ) { - - var family = data.familyName.toLowerCase(); - - var ThreeFont = this; - - ThreeFont.faces[ family ] = ThreeFont.faces[ family ] || {}; - - ThreeFont.faces[ family ][ data.cssFontWeight ] = ThreeFont.faces[ family ][ data.cssFontWeight ] || {}; - ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data; - - var face = ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data; - - return data; - - }, - - drawText : function( text ) { - - var characterPts = [], allPts = []; - - // RenderText - - var i, p, - face = this.getFace(), - scale = this.size / face.resolution, - offset = 0, - chars = String( text ).split( '' ), - length = chars.length; - - var fontPaths = []; - - for ( i = 0; i < length; i ++ ) { - - var path = new THREE.Path(); - - var ret = this.extractGlyphPoints( chars[ i ], face, scale, offset, path ); - offset += ret.offset; - - fontPaths.push( ret.path ); - - } - - // get the width - - var width = offset / 2; - // - // for ( p = 0; p < allPts.length; p++ ) { - // - // allPts[ p ].x -= width; - // - // } - - //var extract = this.extractPoints( allPts, characterPts ); - //extract.contour = allPts; - - //extract.paths = fontPaths; - //extract.offset = width; - - return { paths : fontPaths, offset : width }; - - }, - - - - - extractGlyphPoints : function( c, face, scale, offset, path ) { - - var pts = []; - - var i, i2, divisions, - outline, action, length, - scaleX, scaleY, - x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2, - laste, - glyph = face.glyphs[ c ] || face.glyphs[ '?' ]; - - if ( !glyph ) return; - - if ( glyph.o ) { - - outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) ); - length = outline.length; - - scaleX = scale; - scaleY = scale; - - for ( i = 0; i < length; ) { - - action = outline[ i ++ ]; - - //console.log( action ); - - switch( action ) { - - case 'm': - - // Move To - - x = outline[ i++ ] * scaleX + offset; - y = outline[ i++ ] * scaleY; - - path.moveTo( x, y ); - break; - - case 'l': - - // Line To - - x = outline[ i++ ] * scaleX + offset; - y = outline[ i++ ] * scaleY; - path.lineTo(x,y); - break; - - case 'q': - - // QuadraticCurveTo - - cpx = outline[ i++ ] * scaleX + offset; - cpy = outline[ i++ ] * scaleY; - cpx1 = outline[ i++ ] * scaleX + offset; - cpy1 = outline[ i++ ] * scaleY; - - path.quadraticCurveTo(cpx1, cpy1, cpx, cpy); - - laste = pts[ pts.length - 1 ]; - - if ( laste ) { - - cpx0 = laste.x; - cpy0 = laste.y; - - for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) { - - var t = i2 / divisions; - var tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx ); - var ty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy ); - } - - } - - break; - - case 'b': - - // Cubic Bezier Curve - - cpx = outline[ i++ ] * scaleX + offset; - cpy = outline[ i++ ] * scaleY; - cpx1 = outline[ i++ ] * scaleX + offset; - cpy1 = outline[ i++ ] * -scaleY; - cpx2 = outline[ i++ ] * scaleX + offset; - cpy2 = outline[ i++ ] * -scaleY; - - path.bezierCurveTo( cpx, cpy, cpx1, cpy1, cpx2, cpy2 ); - - laste = pts[ pts.length - 1 ]; - - if ( laste ) { - - cpx0 = laste.x; - cpy0 = laste.y; - - for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) { - - var t = i2 / divisions; - var tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx ); - var ty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy ); - - } - - } - - break; - - } - - } - } - - - - return { offset: glyph.ha*scale, path:path}; - } - -}; - - -THREE.FontUtils.generateShapes = function( text, parameters ) { - - // Parameters - - parameters = parameters || {}; - - var size = parameters.size !== undefined ? parameters.size : 100; - var curveSegments = parameters.curveSegments !== undefined ? parameters.curveSegments: 4; - - var font = parameters.font !== undefined ? parameters.font : "helvetiker"; - var weight = parameters.weight !== undefined ? parameters.weight : "normal"; - var style = parameters.style !== undefined ? parameters.style : "normal"; - - THREE.FontUtils.size = size; - THREE.FontUtils.divisions = curveSegments; - - THREE.FontUtils.face = font; - THREE.FontUtils.weight = weight; - THREE.FontUtils.style = style; - - // Get a Font data json object - - var data = THREE.FontUtils.drawText( text ); - - var paths = data.paths; - var shapes = []; - - for ( var p = 0, pl = paths.length; p < pl; p ++ ) { - - Array.prototype.push.apply( shapes, paths[ p ].toShapes() ); - - } - - return shapes; - -}; - - -/** - * This code is a quick port of code written in C++ which was submitted to - * flipcode.com by John W. Ratcliff // July 22, 2000 - * See original code and more information here: - * http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml - * - * ported to actionscript by Zevan Rosser - * www.actionsnippet.com - * - * ported to javascript by Joshua Koo - * http://www.lab4games.net/zz85/blog - * - */ - - -( function( namespace ) { - - var EPSILON = 0.0000000001; - - // takes in an contour array and returns - - var process = function( contour, indices ) { - - var n = contour.length; - - if ( n < 3 ) return null; - - var result = [], - verts = [], - vertIndices = []; - - /* we want a counter-clockwise polygon in verts */ - - var u, v, w; - - if ( area( contour ) > 0.0 ) { - - for ( v = 0; v < n; v++ ) verts[ v ] = v; - - } else { - - for ( v = 0; v < n; v++ ) verts[ v ] = ( n - 1 ) - v; - - } - - var nv = n; - - /* remove nv - 2 vertices, creating 1 triangle every time */ - - var count = 2 * nv; /* error detection */ - - for( v = nv - 1; nv > 2; ) { - - /* if we loop, it is probably a non-simple polygon */ - - if ( ( count-- ) <= 0 ) { - - //** Triangulate: ERROR - probable bad polygon! - - //throw ( "Warning, unable to triangulate polygon!" ); - //return null; - // Sometimes warning is fine, especially polygons are triangulated in reverse. - console.log( "Warning, unable to triangulate polygon!" ); - - if ( indices ) return vertIndices; - return result; - - } - - /* three consecutive vertices in current polygon, <u,v,w> */ - - u = v; if ( nv <= u ) u = 0; /* previous */ - v = u + 1; if ( nv <= v ) v = 0; /* new v */ - w = v + 1; if ( nv <= w ) w = 0; /* next */ - - if ( snip( contour, u, v, w, nv, verts ) ) { - - var a, b, c, s, t; - - /* true names of the vertices */ - - a = verts[ u ]; - b = verts[ v ]; - c = verts[ w ]; - - /* output Triangle */ - - result.push( [ contour[ a ], - contour[ b ], - contour[ c ] ] ); - - - vertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] ); - - /* remove v from the remaining polygon */ - - for( s = v, t = v + 1; t < nv; s++, t++ ) { - - verts[ s ] = verts[ t ]; - - } - - nv--; - - /* reset error detection counter */ - - count = 2 * nv; - - } - - } - - if ( indices ) return vertIndices; - return result; - - }; - - // calculate area of the contour polygon - - var area = function ( contour ) { - - var n = contour.length; - var a = 0.0; - - for( var p = n - 1, q = 0; q < n; p = q++ ) { - - a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y; - - } - - return a * 0.5; - - }; - - var snip = function ( contour, u, v, w, n, verts ) { - - var p; - var ax, ay, bx, by; - var cx, cy, px, py; - - ax = contour[ verts[ u ] ].x; - ay = contour[ verts[ u ] ].y; - - bx = contour[ verts[ v ] ].x; - by = contour[ verts[ v ] ].y; - - cx = contour[ verts[ w ] ].x; - cy = contour[ verts[ w ] ].y; - - if ( EPSILON > (((bx-ax)*(cy-ay)) - ((by-ay)*(cx-ax))) ) return false; - - var aX, aY, bX, bY, cX, cY; - var apx, apy, bpx, bpy, cpx, cpy; - var cCROSSap, bCROSScp, aCROSSbp; - - aX = cx - bx; aY = cy - by; - bX = ax - cx; bY = ay - cy; - cX = bx - ax; cY = by - ay; - - for ( p = 0; p < n; p++ ) { - - px = contour[ verts[ p ] ].x - py = contour[ verts[ p ] ].y - - if ( ( (px === ax) && (py === ay) ) || - ( (px === bx) && (py === by) ) || - ( (px === cx) && (py === cy) ) ) continue; - - apx = px - ax; apy = py - ay; - bpx = px - bx; bpy = py - by; - cpx = px - cx; cpy = py - cy; - - // see if p is inside triangle abc - - aCROSSbp = aX*bpy - aY*bpx; - cCROSSap = cX*apy - cY*apx; - bCROSScp = bX*cpy - bY*cpx; - - if ( (aCROSSbp >= -EPSILON) && (bCROSScp >= -EPSILON) && (cCROSSap >= -EPSILON) ) return false; - - } - - return true; - - }; - - - namespace.Triangulate = process; - namespace.Triangulate.area = area; - - return namespace; - -})(THREE.FontUtils); - -// To use the typeface.js face files, hook up the API -self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace }; -THREE.typeface_js = self._typeface_js; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Extensible curve object - * - * Some common of Curve methods - * .getPoint(t), getTangent(t) - * .getPointAt(u), getTagentAt(u) - * .getPoints(), .getSpacedPoints() - * .getLength() - * .updateArcLengths() - * - * This following classes subclasses THREE.Curve: - * - * -- 2d classes -- - * THREE.LineCurve - * THREE.QuadraticBezierCurve - * THREE.CubicBezierCurve - * THREE.SplineCurve - * THREE.ArcCurve - * THREE.EllipseCurve - * - * -- 3d classes -- - * THREE.LineCurve3 - * THREE.QuadraticBezierCurve3 - * THREE.CubicBezierCurve3 - * THREE.SplineCurve3 - * THREE.ClosedSplineCurve3 - * - * A series of curves can be represented as a THREE.CurvePath - * - **/ - -/************************************************************** - * Abstract Curve base class - **************************************************************/ - -THREE.Curve = function () { - -}; - -// Virtual base class method to overwrite and implement in subclasses -// - t [0 .. 1] - -THREE.Curve.prototype.getPoint = function ( t ) { - - console.log( "Warning, getPoint() not implemented!" ); - return null; - -}; - -// Get point at relative position in curve according to arc length -// - u [0 .. 1] - -THREE.Curve.prototype.getPointAt = function ( u ) { - - var t = this.getUtoTmapping( u ); - return this.getPoint( t ); - -}; - -// Get sequence of points using getPoint( t ) - -THREE.Curve.prototype.getPoints = function ( divisions ) { - - if ( !divisions ) divisions = 5; - - var d, pts = []; - - for ( d = 0; d <= divisions; d ++ ) { - - pts.push( this.getPoint( d / divisions ) ); - - } - - return pts; - -}; - -// Get sequence of points using getPointAt( u ) - -THREE.Curve.prototype.getSpacedPoints = function ( divisions ) { - - if ( !divisions ) divisions = 5; - - var d, pts = []; - - for ( d = 0; d <= divisions; d ++ ) { - - pts.push( this.getPointAt( d / divisions ) ); - - } - - return pts; - -}; - -// Get total curve arc length - -THREE.Curve.prototype.getLength = function () { - - var lengths = this.getLengths(); - return lengths[ lengths.length - 1 ]; - -}; - -// Get list of cumulative segment lengths - -THREE.Curve.prototype.getLengths = function ( divisions ) { - - if ( !divisions ) divisions = (this.__arcLengthDivisions) ? (this.__arcLengthDivisions): 200; - - if ( this.cacheArcLengths - && ( this.cacheArcLengths.length == divisions + 1 ) - && !this.needsUpdate) { - - //console.log( "cached", this.cacheArcLengths ); - return this.cacheArcLengths; - - } - - this.needsUpdate = false; - - var cache = []; - var current, last = this.getPoint( 0 ); - var p, sum = 0; - - cache.push( 0 ); - - for ( p = 1; p <= divisions; p ++ ) { - - current = this.getPoint ( p / divisions ); - sum += current.distanceTo( last ); - cache.push( sum ); - last = current; - - } - - this.cacheArcLengths = cache; - - return cache; // { sums: cache, sum:sum }; Sum is in the last element. - -}; - - -THREE.Curve.prototype.updateArcLengths = function() { - this.needsUpdate = true; - this.getLengths(); -}; - -// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance - -THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) { - - var arcLengths = this.getLengths(); - - var i = 0, il = arcLengths.length; - - var targetArcLength; // The targeted u distance value to get - - if ( distance ) { - - targetArcLength = distance; - - } else { - - targetArcLength = u * arcLengths[ il - 1 ]; - - } - - //var time = Date.now(); - - // binary search for the index with largest value smaller than target u distance - - var low = 0, high = il - 1, comparison; - - while ( low <= high ) { - - i = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - - comparison = arcLengths[ i ] - targetArcLength; - - if ( comparison < 0 ) { - - low = i + 1; - continue; - - } else if ( comparison > 0 ) { - - high = i - 1; - continue; - - } else { - - high = i; - break; - - // DONE - - } - - } - - i = high; - - //console.log('b' , i, low, high, Date.now()- time); - - if ( arcLengths[ i ] == targetArcLength ) { - - var t = i / ( il - 1 ); - return t; - - } - - // we could get finer grain at lengths, or use simple interpolatation between two points - - var lengthBefore = arcLengths[ i ]; - var lengthAfter = arcLengths[ i + 1 ]; - - var segmentLength = lengthAfter - lengthBefore; - - // determine where we are between the 'before' and 'after' points - - var segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength; - - // add that fractional amount to t - - var t = ( i + segmentFraction ) / ( il -1 ); - - return t; - -}; - -// Returns a unit vector tangent at t -// In case any sub curve does not implement its tangent derivation, -// 2 points a small delta apart will be used to find its gradient -// which seems to give a reasonable approximation - -THREE.Curve.prototype.getTangent = function( t ) { - - var delta = 0.0001; - var t1 = t - delta; - var t2 = t + delta; - - // Capping in case of danger - - if ( t1 < 0 ) t1 = 0; - if ( t2 > 1 ) t2 = 1; - - var pt1 = this.getPoint( t1 ); - var pt2 = this.getPoint( t2 ); - - var vec = pt2.clone().sub(pt1); - return vec.normalize(); - -}; - - -THREE.Curve.prototype.getTangentAt = function ( u ) { - - var t = this.getUtoTmapping( u ); - return this.getTangent( t ); - -}; - - - - - -/************************************************************** - * Utils - **************************************************************/ - -THREE.Curve.Utils = { - - tangentQuadraticBezier: function ( t, p0, p1, p2 ) { - - return 2 * ( 1 - t ) * ( p1 - p0 ) + 2 * t * ( p2 - p1 ); - - }, - - // Puay Bing, thanks for helping with this derivative! - - tangentCubicBezier: function (t, p0, p1, p2, p3 ) { - - return -3 * p0 * (1 - t) * (1 - t) + - 3 * p1 * (1 - t) * (1-t) - 6 *t *p1 * (1-t) + - 6 * t * p2 * (1-t) - 3 * t * t * p2 + - 3 * t * t * p3; - }, - - - tangentSpline: function ( t, p0, p1, p2, p3 ) { - - // To check if my formulas are correct - - var h00 = 6 * t * t - 6 * t; // derived from 2t^3 − 3t^2 + 1 - var h10 = 3 * t * t - 4 * t + 1; // t^3 − 2t^2 + t - var h01 = -6 * t * t + 6 * t; // − 2t3 + 3t2 - var h11 = 3 * t * t - 2 * t; // t3 − t2 - - return h00 + h10 + h01 + h11; - - }, - - // Catmull-Rom - - interpolate: function( p0, p1, p2, p3, t ) { - - var v0 = ( p2 - p0 ) * 0.5; - var v1 = ( p3 - p1 ) * 0.5; - var t2 = t * t; - var t3 = t * t2; - return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - } - -}; - - -// TODO: Transformation for Curves? - -/************************************************************** - * 3D Curves - **************************************************************/ - -// A Factory method for creating new curve subclasses - -THREE.Curve.create = function ( constructor, getPointFunc ) { - - constructor.prototype = Object.create( THREE.Curve.prototype ); - constructor.prototype.getPoint = getPointFunc; - - return constructor; - -}; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * - **/ - -/************************************************************** - * Curved Path - a curve path is simply a array of connected - * curves, but retains the api of a curve - **************************************************************/ - -THREE.CurvePath = function () { - - this.curves = []; - this.bends = []; - - this.autoClose = false; // Automatically closes the path -}; - -THREE.CurvePath.prototype = Object.create( THREE.Curve.prototype ); - -THREE.CurvePath.prototype.add = function ( curve ) { - - this.curves.push( curve ); - -}; - -THREE.CurvePath.prototype.checkConnection = function() { - // TODO - // If the ending of curve is not connected to the starting - // or the next curve, then, this is not a real path -}; - -THREE.CurvePath.prototype.closePath = function() { - // TODO Test - // and verify for vector3 (needs to implement equals) - // Add a line curve if start and end of lines are not connected - var startPoint = this.curves[0].getPoint(0); - var endPoint = this.curves[this.curves.length-1].getPoint(1); - - if (!startPoint.equals(endPoint)) { - this.curves.push( new THREE.LineCurve(endPoint, startPoint) ); - } - -}; - -// To get accurate point with reference to -// entire path distance at time t, -// following has to be done: - -// 1. Length of each sub path have to be known -// 2. Locate and identify type of curve -// 3. Get t for the curve -// 4. Return curve.getPointAt(t') - -THREE.CurvePath.prototype.getPoint = function( t ) { - - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0, diff, curve; - - // To think about boundaries points. - - while ( i < curveLengths.length ) { - - if ( curveLengths[ i ] >= d ) { - - diff = curveLengths[ i ] - d; - curve = this.curves[ i ]; - - var u = 1 - diff / curve.getLength(); - - return curve.getPointAt( u ); - - break; - } - - i ++; - - } - - return null; - - // loop where sum != 0, sum > d , sum+1 <d - -}; - -/* -THREE.CurvePath.prototype.getTangent = function( t ) { -};*/ - - -// We cannot use the default THREE.Curve getPoint() with getLength() because in -// THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath -// getPoint() depends on getLength - -THREE.CurvePath.prototype.getLength = function() { - - var lens = this.getCurveLengths(); - return lens[ lens.length - 1 ]; - -}; - -// Compute lengths and cache them -// We cannot overwrite getLengths() because UtoT mapping uses it. - -THREE.CurvePath.prototype.getCurveLengths = function() { - - // We use cache values if curves and cache array are same length - - if ( this.cacheLengths && this.cacheLengths.length == this.curves.length ) { - - return this.cacheLengths; - - }; - - // Get length of subsurve - // Push sums into cached array - - var lengths = [], sums = 0; - var i, il = this.curves.length; - - for ( i = 0; i < il; i ++ ) { - - sums += this.curves[ i ].getLength(); - lengths.push( sums ); - - } - - this.cacheLengths = lengths; - - return lengths; - -}; - - - -// Returns min and max coordinates, as well as centroid - -THREE.CurvePath.prototype.getBoundingBox = function () { - - var points = this.getPoints(); - - var maxX, maxY, maxZ; - var minX, minY, minZ; - - maxX = maxY = Number.NEGATIVE_INFINITY; - minX = minY = Number.POSITIVE_INFINITY; - - var p, i, il, sum; - - var v3 = points[0] instanceof THREE.Vector3; - - sum = v3 ? new THREE.Vector3() : new THREE.Vector2(); - - for ( i = 0, il = points.length; i < il; i ++ ) { - - p = points[ i ]; - - if ( p.x > maxX ) maxX = p.x; - else if ( p.x < minX ) minX = p.x; - - if ( p.y > maxY ) maxY = p.y; - else if ( p.y < minY ) minY = p.y; - - if ( v3 ) { - - if ( p.z > maxZ ) maxZ = p.z; - else if ( p.z < minZ ) minZ = p.z; - - } - - sum.add( p ); - - } - - var ret = { - - minX: minX, - minY: minY, - maxX: maxX, - maxY: maxY, - centroid: sum.divideScalar( il ) - - }; - - if ( v3 ) { - - ret.maxZ = maxZ; - ret.minZ = minZ; - - } - - return ret; - -}; - -/************************************************************** - * Create Geometries Helpers - **************************************************************/ - -/// Generate geometry from path points (for Line or ParticleSystem objects) - -THREE.CurvePath.prototype.createPointsGeometry = function( divisions ) { - - var pts = this.getPoints( divisions, true ); - return this.createGeometry( pts ); - -}; - -// Generate geometry from equidistance sampling along the path - -THREE.CurvePath.prototype.createSpacedPointsGeometry = function( divisions ) { - - var pts = this.getSpacedPoints( divisions, true ); - return this.createGeometry( pts ); - -}; - -THREE.CurvePath.prototype.createGeometry = function( points ) { - - var geometry = new THREE.Geometry(); - - for ( var i = 0; i < points.length; i ++ ) { - - geometry.vertices.push( new THREE.Vector3( points[ i ].x, points[ i ].y, points[ i ].z || 0) ); - - } - - return geometry; - -}; - - -/************************************************************** - * Bend / Wrap Helper Methods - **************************************************************/ - -// Wrap path / Bend modifiers? - -THREE.CurvePath.prototype.addWrapPath = function ( bendpath ) { - - this.bends.push( bendpath ); - -}; - -THREE.CurvePath.prototype.getTransformedPoints = function( segments, bends ) { - - var oldPts = this.getPoints( segments ); // getPoints getSpacedPoints - var i, il; - - if ( !bends ) { - - bends = this.bends; - - } - - for ( i = 0, il = bends.length; i < il; i ++ ) { - - oldPts = this.getWrapPoints( oldPts, bends[ i ] ); - - } - - return oldPts; - -}; - -THREE.CurvePath.prototype.getTransformedSpacedPoints = function( segments, bends ) { - - var oldPts = this.getSpacedPoints( segments ); - - var i, il; - - if ( !bends ) { - - bends = this.bends; - - } - - for ( i = 0, il = bends.length; i < il; i ++ ) { - - oldPts = this.getWrapPoints( oldPts, bends[ i ] ); - - } - - return oldPts; - -}; - -// This returns getPoints() bend/wrapped around the contour of a path. -// Read http://www.planetclegg.com/projects/WarpingTextToSplines.html - -THREE.CurvePath.prototype.getWrapPoints = function ( oldPts, path ) { - - var bounds = this.getBoundingBox(); - - var i, il, p, oldX, oldY, xNorm; - - for ( i = 0, il = oldPts.length; i < il; i ++ ) { - - p = oldPts[ i ]; - - oldX = p.x; - oldY = p.y; - - xNorm = oldX / bounds.maxX; - - // If using actual distance, for length > path, requires line extrusions - //xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance - - xNorm = path.getUtoTmapping( xNorm, oldX ); - - // check for out of bounds? - - var pathPt = path.getPoint( xNorm ); - var normal = path.getTangent( xNorm ); - normal.set( -normal.y, normal.x ).multiplyScalar( oldY ); - - p.x = pathPt.x + normal.x; - p.y = pathPt.y + normal.y; - - } - - return oldPts; - -}; - - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Gyroscope = function () { - - THREE.Object3D.call( this ); - -}; - -THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.Gyroscope.prototype.updateMatrixWorld = function ( force ) { - - this.matrixAutoUpdate && this.updateMatrix(); - - // update matrixWorld - - if ( this.matrixWorldNeedsUpdate || force ) { - - if ( this.parent ) { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - this.matrixWorld.decompose( this.translationWorld, this.quaternionWorld, this.scaleWorld ); - this.matrix.decompose( this.translationObject, this.quaternionObject, this.scaleObject ); - - this.matrixWorld.compose( this.translationWorld, this.quaternionObject, this.scaleWorld ); - - - } else { - - this.matrixWorld.copy( this.matrix ); - - } - - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].updateMatrixWorld( force ); - - } - -}; - -THREE.Gyroscope.prototype.translationWorld = new THREE.Vector3(); -THREE.Gyroscope.prototype.translationObject = new THREE.Vector3(); -THREE.Gyroscope.prototype.quaternionWorld = new THREE.Quaternion(); -THREE.Gyroscope.prototype.quaternionObject = new THREE.Quaternion(); -THREE.Gyroscope.prototype.scaleWorld = new THREE.Vector3(); -THREE.Gyroscope.prototype.scaleObject = new THREE.Vector3(); - - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Creates free form 2d path using series of points, lines or curves. - * - **/ - -THREE.Path = function ( points ) { - - THREE.CurvePath.call(this); - - this.actions = []; - - if ( points ) { - - this.fromPoints( points ); - - } - -}; - -THREE.Path.prototype = Object.create( THREE.CurvePath.prototype ); - -THREE.PathActions = { - - MOVE_TO: 'moveTo', - LINE_TO: 'lineTo', - QUADRATIC_CURVE_TO: 'quadraticCurveTo', // Bezier quadratic curve - BEZIER_CURVE_TO: 'bezierCurveTo', // Bezier cubic curve - CSPLINE_THRU: 'splineThru', // Catmull-rom spline - ARC: 'arc', // Circle - ELLIPSE: 'ellipse' -}; - -// TODO Clean up PATH API - -// Create path using straight lines to connect all points -// - vectors: array of Vector2 - -THREE.Path.prototype.fromPoints = function ( vectors ) { - - this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y ); - - for ( var v = 1, vlen = vectors.length; v < vlen; v ++ ) { - - this.lineTo( vectors[ v ].x, vectors[ v ].y ); - - }; - -}; - -// startPath() endPath()? - -THREE.Path.prototype.moveTo = function ( x, y ) { - - var args = Array.prototype.slice.call( arguments ); - this.actions.push( { action: THREE.PathActions.MOVE_TO, args: args } ); - -}; - -THREE.Path.prototype.lineTo = function ( x, y ) { - - var args = Array.prototype.slice.call( arguments ); - - var lastargs = this.actions[ this.actions.length - 1 ].args; - - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - var curve = new THREE.LineCurve( new THREE.Vector2( x0, y0 ), new THREE.Vector2( x, y ) ); - this.curves.push( curve ); - - this.actions.push( { action: THREE.PathActions.LINE_TO, args: args } ); - -}; - -THREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) { - - var args = Array.prototype.slice.call( arguments ); - - var lastargs = this.actions[ this.actions.length - 1 ].args; - - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - var curve = new THREE.QuadraticBezierCurve( new THREE.Vector2( x0, y0 ), - new THREE.Vector2( aCPx, aCPy ), - new THREE.Vector2( aX, aY ) ); - this.curves.push( curve ); - - this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args } ); - -}; - -THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y, - aCP2x, aCP2y, - aX, aY ) { - - var args = Array.prototype.slice.call( arguments ); - - var lastargs = this.actions[ this.actions.length - 1 ].args; - - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - var curve = new THREE.CubicBezierCurve( new THREE.Vector2( x0, y0 ), - new THREE.Vector2( aCP1x, aCP1y ), - new THREE.Vector2( aCP2x, aCP2y ), - new THREE.Vector2( aX, aY ) ); - this.curves.push( curve ); - - this.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args } ); - -}; - -THREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) { - - var args = Array.prototype.slice.call( arguments ); - var lastargs = this.actions[ this.actions.length - 1 ].args; - - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; -//--- - var npts = [ new THREE.Vector2( x0, y0 ) ]; - Array.prototype.push.apply( npts, pts ); - - var curve = new THREE.SplineCurve( npts ); - this.curves.push( curve ); - - this.actions.push( { action: THREE.PathActions.CSPLINE_THRU, args: args } ); - -}; - -// FUTURE: Change the API or follow canvas API? - -THREE.Path.prototype.arc = function ( aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise ) { - - var lastargs = this.actions[ this.actions.length - 1].args; - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - this.absarc(aX + x0, aY + y0, aRadius, - aStartAngle, aEndAngle, aClockwise ); - - }; - - THREE.Path.prototype.absarc = function ( aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise ) { - this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); - }; - -THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius, - aStartAngle, aEndAngle, aClockwise ) { - - var lastargs = this.actions[ this.actions.length - 1].args; - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - this.absellipse(aX + x0, aY + y0, xRadius, yRadius, - aStartAngle, aEndAngle, aClockwise ); - - }; - - -THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius, - aStartAngle, aEndAngle, aClockwise ) { - - var args = Array.prototype.slice.call( arguments ); - var curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius, - aStartAngle, aEndAngle, aClockwise ); - this.curves.push( curve ); - - var lastPoint = curve.getPoint(1); - args.push(lastPoint.x); - args.push(lastPoint.y); - - this.actions.push( { action: THREE.PathActions.ELLIPSE, args: args } ); - - }; - -THREE.Path.prototype.getSpacedPoints = function ( divisions, closedPath ) { - - if ( ! divisions ) divisions = 40; - - var points = []; - - for ( var i = 0; i < divisions; i ++ ) { - - points.push( this.getPoint( i / divisions ) ); - - //if( !this.getPoint( i / divisions ) ) throw "DIE"; - - } - - // if ( closedPath ) { - // - // points.push( points[ 0 ] ); - // - // } - - return points; - -}; - -/* Return an array of vectors based on contour of the path */ - -THREE.Path.prototype.getPoints = function( divisions, closedPath ) { - - if (this.useSpacedPoints) { - console.log('tata'); - return this.getSpacedPoints( divisions, closedPath ); - } - - divisions = divisions || 12; - - var points = []; - - var i, il, item, action, args; - var cpx, cpy, cpx2, cpy2, cpx1, cpy1, cpx0, cpy0, - laste, j, - t, tx, ty; - - for ( i = 0, il = this.actions.length; i < il; i ++ ) { - - item = this.actions[ i ]; - - action = item.action; - args = item.args; - - switch( action ) { - - case THREE.PathActions.MOVE_TO: - - points.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) ); - - break; - - case THREE.PathActions.LINE_TO: - - points.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) ); - - break; - - case THREE.PathActions.QUADRATIC_CURVE_TO: - - cpx = args[ 2 ]; - cpy = args[ 3 ]; - - cpx1 = args[ 0 ]; - cpy1 = args[ 1 ]; - - if ( points.length > 0 ) { - - laste = points[ points.length - 1 ]; - - cpx0 = laste.x; - cpy0 = laste.y; - - } else { - - laste = this.actions[ i - 1 ].args; - - cpx0 = laste[ laste.length - 2 ]; - cpy0 = laste[ laste.length - 1 ]; - - } - - for ( j = 1; j <= divisions; j ++ ) { - - t = j / divisions; - - tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx ); - ty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy ); - - points.push( new THREE.Vector2( tx, ty ) ); - - } - - break; - - case THREE.PathActions.BEZIER_CURVE_TO: - - cpx = args[ 4 ]; - cpy = args[ 5 ]; - - cpx1 = args[ 0 ]; - cpy1 = args[ 1 ]; - - cpx2 = args[ 2 ]; - cpy2 = args[ 3 ]; - - if ( points.length > 0 ) { - - laste = points[ points.length - 1 ]; - - cpx0 = laste.x; - cpy0 = laste.y; - - } else { - - laste = this.actions[ i - 1 ].args; - - cpx0 = laste[ laste.length - 2 ]; - cpy0 = laste[ laste.length - 1 ]; - - } - - - for ( j = 1; j <= divisions; j ++ ) { - - t = j / divisions; - - tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx ); - ty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy ); - - points.push( new THREE.Vector2( tx, ty ) ); - - } - - break; - - case THREE.PathActions.CSPLINE_THRU: - - laste = this.actions[ i - 1 ].args; - - var last = new THREE.Vector2( laste[ laste.length - 2 ], laste[ laste.length - 1 ] ); - var spts = [ last ]; - - var n = divisions * args[ 0 ].length; - - spts = spts.concat( args[ 0 ] ); - - var spline = new THREE.SplineCurve( spts ); - - for ( j = 1; j <= n; j ++ ) { - - points.push( spline.getPointAt( j / n ) ) ; - - } - - break; - - case THREE.PathActions.ARC: - - var aX = args[ 0 ], aY = args[ 1 ], - aRadius = args[ 2 ], - aStartAngle = args[ 3 ], aEndAngle = args[ 4 ], - aClockwise = !!args[ 5 ]; - - var deltaAngle = aEndAngle - aStartAngle; - var angle; - var tdivisions = divisions * 2; - - for ( j = 1; j <= tdivisions; j ++ ) { - - t = j / tdivisions; - - if ( ! aClockwise ) { - - t = 1 - t; - - } - - angle = aStartAngle + t * deltaAngle; - - tx = aX + aRadius * Math.cos( angle ); - ty = aY + aRadius * Math.sin( angle ); - - //console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty); - - points.push( new THREE.Vector2( tx, ty ) ); - - } - - //console.log(points); - - break; - - case THREE.PathActions.ELLIPSE: - - var aX = args[ 0 ], aY = args[ 1 ], - xRadius = args[ 2 ], - yRadius = args[ 3 ], - aStartAngle = args[ 4 ], aEndAngle = args[ 5 ], - aClockwise = !!args[ 6 ]; - - - var deltaAngle = aEndAngle - aStartAngle; - var angle; - var tdivisions = divisions * 2; - - for ( j = 1; j <= tdivisions; j ++ ) { - - t = j / tdivisions; - - if ( ! aClockwise ) { - - t = 1 - t; - - } - - angle = aStartAngle + t * deltaAngle; - - tx = aX + xRadius * Math.cos( angle ); - ty = aY + yRadius * Math.sin( angle ); - - //console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty); - - points.push( new THREE.Vector2( tx, ty ) ); - - } - - //console.log(points); - - break; - - } // end switch - - } - - - - // Normalize to remove the closing point by default. - var lastPoint = points[ points.length - 1]; - var EPSILON = 0.0000000001; - if ( Math.abs(lastPoint.x - points[ 0 ].x) < EPSILON && - Math.abs(lastPoint.y - points[ 0 ].y) < EPSILON) - points.splice( points.length - 1, 1); - if ( closedPath ) { - - points.push( points[ 0 ] ); - - } - - return points; - -}; - -// Breaks path into shapes - -THREE.Path.prototype.toShapes = function( isCCW ) { - - function isPointInsidePolygon( inPt, inPolygon ) { - var EPSILON = 0.0000000001; - - var polyLen = inPolygon.length; - - // inPt on polygon contour => immediate success or - // toggling of inside/outside at every single! intersection point of an edge - // with the horizontal line through inPt, left of inPt - // not counting lowerY endpoints of edges and whole edges on that line - var inside = false; - for( var p = polyLen - 1, q = 0; q < polyLen; p = q++ ) { - var edgeLowPt = inPolygon[ p ]; - var edgeHighPt = inPolygon[ q ]; - - var edgeDx = edgeHighPt.x - edgeLowPt.x; - var edgeDy = edgeHighPt.y - edgeLowPt.y; - - if ( Math.abs(edgeDy) > EPSILON ) { // not parallel - if ( edgeDy < 0 ) { - edgeLowPt = inPolygon[ q ]; edgeDx = -edgeDx; - edgeHighPt = inPolygon[ p ]; edgeDy = -edgeDy; - } - if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue; - - if ( inPt.y == edgeLowPt.y ) { - if ( inPt.x == edgeLowPt.x ) return true; // inPt is on contour ? - // continue; // no intersection or edgeLowPt => doesn't count !!! - } else { - var perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); - if ( perpEdge == 0 ) return true; // inPt is on contour ? - if ( perpEdge < 0 ) continue; - inside = !inside; // true intersection left of inPt - } - } else { // parallel or colinear - if ( inPt.y != edgeLowPt.y ) continue; // parallel - // egde lies on the same horizontal line as inPt - if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) || - ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour ! - // continue; - } - } - - return inside; - } - - var i, il, item, action, args; - - var subPaths = [], lastPath = new THREE.Path(); - - for ( i = 0, il = this.actions.length; i < il; i ++ ) { - - item = this.actions[ i ]; - - args = item.args; - action = item.action; - - if ( action == THREE.PathActions.MOVE_TO ) { - - if ( lastPath.actions.length != 0 ) { - - subPaths.push( lastPath ); - lastPath = new THREE.Path(); - - } - - } - - lastPath[ action ].apply( lastPath, args ); - - } - - if ( lastPath.actions.length != 0 ) { - - subPaths.push( lastPath ); - - } - - // console.log(subPaths); - - if ( subPaths.length == 0 ) return []; - - var solid, tmpPath, tmpShape, shapes = []; - - if ( subPaths.length == 1) { - - tmpPath = subPaths[0]; - tmpShape = new THREE.Shape(); - tmpShape.actions = tmpPath.actions; - tmpShape.curves = tmpPath.curves; - shapes.push( tmpShape ); - return shapes; - - } - - var holesFirst = !THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() ); - holesFirst = isCCW ? !holesFirst : holesFirst; - - // console.log("Holes first", holesFirst); - - var betterShapeHoles = []; - var newShapes = []; - var newShapeHoles = []; - var mainIdx = 0; - var tmpPoints; - - newShapes[mainIdx] = undefined; - newShapeHoles[mainIdx] = []; - - for ( i = 0, il = subPaths.length; i < il; i ++ ) { - - tmpPath = subPaths[ i ]; - tmpPoints = tmpPath.getPoints(); - solid = THREE.Shape.Utils.isClockWise( tmpPoints ); - solid = isCCW ? !solid : solid; - - if ( solid ) { - - if ( (! holesFirst ) && ( newShapes[mainIdx] ) ) mainIdx++; - - newShapes[mainIdx] = { s: new THREE.Shape(), p: tmpPoints }; - newShapes[mainIdx].s.actions = tmpPath.actions; - newShapes[mainIdx].s.curves = tmpPath.curves; - - if ( holesFirst ) mainIdx++; - newShapeHoles[mainIdx] = []; - - //console.log('cw', i); - - } else { - - newShapeHoles[mainIdx].push( { h: tmpPath, p: tmpPoints[0] } ); - - //console.log('ccw', i); - - } - - } - - if ( newShapes.length > 1 ) { - var ambigious = false; - var toChange = []; - - for (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++ ) { - betterShapeHoles[sIdx] = []; - } - for (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++ ) { - var sh = newShapes[sIdx]; - var sho = newShapeHoles[sIdx]; - for (var hIdx = 0; hIdx < sho.length; hIdx++ ) { - var ho = sho[hIdx]; - var hole_unassigned = true; - for (var s2Idx = 0; s2Idx < newShapes.length; s2Idx++ ) { - if ( isPointInsidePolygon( ho.p, newShapes[s2Idx].p ) ) { - if ( sIdx != s2Idx ) toChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } ); - if ( hole_unassigned ) { - hole_unassigned = false; - betterShapeHoles[s2Idx].push( ho ); - } else { - ambigious = true; - } - } - } - if ( hole_unassigned ) { betterShapeHoles[sIdx].push( ho ); } - } - } - // console.log("ambigious: ", ambigious); - if ( toChange.length > 0 ) { - // console.log("to change: ", toChange); - if (! ambigious) newShapeHoles = betterShapeHoles; - } - } - - var tmpHoles, j, jl; - for ( i = 0, il = newShapes.length; i < il; i ++ ) { - tmpShape = newShapes[i].s; - shapes.push( tmpShape ); - tmpHoles = newShapeHoles[i]; - for ( j = 0, jl = tmpHoles.length; j < jl; j ++ ) { - tmpShape.holes.push( tmpHoles[j].h ); - } - } - - //console.log("shape", shapes); - - return shapes; - -}; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Defines a 2d shape plane using paths. - **/ - -// STEP 1 Create a path. -// STEP 2 Turn path into shape. -// STEP 3 ExtrudeGeometry takes in Shape/Shapes -// STEP 3a - Extract points from each shape, turn to vertices -// STEP 3b - Triangulate each shape, add faces. - -THREE.Shape = function () { - - THREE.Path.apply( this, arguments ); - this.holes = []; - -}; - -THREE.Shape.prototype = Object.create( THREE.Path.prototype ); - -// Convenience method to return ExtrudeGeometry - -THREE.Shape.prototype.extrude = function ( options ) { - - var extruded = new THREE.ExtrudeGeometry( this, options ); - return extruded; - -}; - -// Convenience method to return ShapeGeometry - -THREE.Shape.prototype.makeGeometry = function ( options ) { - - var geometry = new THREE.ShapeGeometry( this, options ); - return geometry; - -}; - -// Get points of holes - -THREE.Shape.prototype.getPointsHoles = function ( divisions ) { - - var i, il = this.holes.length, holesPts = []; - - for ( i = 0; i < il; i ++ ) { - - holesPts[ i ] = this.holes[ i ].getTransformedPoints( divisions, this.bends ); - - } - - return holesPts; - -}; - -// Get points of holes (spaced by regular distance) - -THREE.Shape.prototype.getSpacedPointsHoles = function ( divisions ) { - - var i, il = this.holes.length, holesPts = []; - - for ( i = 0; i < il; i ++ ) { - - holesPts[ i ] = this.holes[ i ].getTransformedSpacedPoints( divisions, this.bends ); - - } - - return holesPts; - -}; - - -// Get points of shape and holes (keypoints based on segments parameter) - -THREE.Shape.prototype.extractAllPoints = function ( divisions ) { - - return { - - shape: this.getTransformedPoints( divisions ), - holes: this.getPointsHoles( divisions ) - - }; - -}; - -THREE.Shape.prototype.extractPoints = function ( divisions ) { - - if (this.useSpacedPoints) { - return this.extractAllSpacedPoints(divisions); - } - - return this.extractAllPoints(divisions); - -}; - -// -// THREE.Shape.prototype.extractAllPointsWithBend = function ( divisions, bend ) { -// -// return { -// -// shape: this.transform( bend, divisions ), -// holes: this.getPointsHoles( divisions, bend ) -// -// }; -// -// }; - -// Get points of shape and holes (spaced by regular distance) - -THREE.Shape.prototype.extractAllSpacedPoints = function ( divisions ) { - - return { - - shape: this.getTransformedSpacedPoints( divisions ), - holes: this.getSpacedPointsHoles( divisions ) - - }; - -}; - -/************************************************************** - * Utils - **************************************************************/ - -THREE.Shape.Utils = { - - triangulateShape: function ( contour, holes ) { - - function point_in_segment_2D_colin( inSegPt1, inSegPt2, inOtherPt ) { - // inOtherPt needs to be colinear to the inSegment - if ( inSegPt1.x != inSegPt2.x ) { - if ( inSegPt1.x < inSegPt2.x ) { - return ( ( inSegPt1.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt2.x ) ); - } else { - return ( ( inSegPt2.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt1.x ) ); - } - } else { - if ( inSegPt1.y < inSegPt2.y ) { - return ( ( inSegPt1.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt2.y ) ); - } else { - return ( ( inSegPt2.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt1.y ) ); - } - } - } - - function intersect_segments_2D( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1, inSeg2Pt2, inExcludeAdjacentSegs ) { - var EPSILON = 0.0000000001; - - var seg1dx = inSeg1Pt2.x - inSeg1Pt1.x, seg1dy = inSeg1Pt2.y - inSeg1Pt1.y; - var seg2dx = inSeg2Pt2.x - inSeg2Pt1.x, seg2dy = inSeg2Pt2.y - inSeg2Pt1.y; - - var seg1seg2dx = inSeg1Pt1.x - inSeg2Pt1.x; - var seg1seg2dy = inSeg1Pt1.y - inSeg2Pt1.y; - - var limit = seg1dy * seg2dx - seg1dx * seg2dy; - var perpSeg1 = seg1dy * seg1seg2dx - seg1dx * seg1seg2dy; - - if ( Math.abs(limit) > EPSILON ) { // not parallel - - var perpSeg2; - if ( limit > 0 ) { - if ( ( perpSeg1 < 0 ) || ( perpSeg1 > limit ) ) return []; - perpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy; - if ( ( perpSeg2 < 0 ) || ( perpSeg2 > limit ) ) return []; - } else { - if ( ( perpSeg1 > 0 ) || ( perpSeg1 < limit ) ) return []; - perpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy; - if ( ( perpSeg2 > 0 ) || ( perpSeg2 < limit ) ) return []; - } - - // i.e. to reduce rounding errors - // intersection at endpoint of segment#1? - if ( perpSeg2 == 0 ) { - if ( ( inExcludeAdjacentSegs ) && - ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) ) return []; - return [ inSeg1Pt1 ]; - } - if ( perpSeg2 == limit ) { - if ( ( inExcludeAdjacentSegs ) && - ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) ) return []; - return [ inSeg1Pt2 ]; - } - // intersection at endpoint of segment#2? - if ( perpSeg1 == 0 ) return [ inSeg2Pt1 ]; - if ( perpSeg1 == limit ) return [ inSeg2Pt2 ]; - - // return real intersection point - var factorSeg1 = perpSeg2 / limit; - return [ { x: inSeg1Pt1.x + factorSeg1 * seg1dx, - y: inSeg1Pt1.y + factorSeg1 * seg1dy } ]; - - } else { // parallel or colinear - if ( ( perpSeg1 != 0 ) || - ( seg2dy * seg1seg2dx != seg2dx * seg1seg2dy ) ) return []; - - // they are collinear or degenerate - var seg1Pt = ( (seg1dx == 0) && (seg1dy == 0) ); // segment1 ist just a point? - var seg2Pt = ( (seg2dx == 0) && (seg2dy == 0) ); // segment2 ist just a point? - // both segments are points - if ( seg1Pt && seg2Pt ) { - if ( (inSeg1Pt1.x != inSeg2Pt1.x) || - (inSeg1Pt1.y != inSeg2Pt1.y) ) return []; // they are distinct points - return [ inSeg1Pt1 ]; // they are the same point - } - // segment#1 is a single point - if ( seg1Pt ) { - if (! point_in_segment_2D_colin( inSeg2Pt1, inSeg2Pt2, inSeg1Pt1 ) ) return []; // but not in segment#2 - return [ inSeg1Pt1 ]; - } - // segment#2 is a single point - if ( seg2Pt ) { - if (! point_in_segment_2D_colin( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1 ) ) return []; // but not in segment#1 - return [ inSeg2Pt1 ]; - } - - // they are collinear segments, which might overlap - var seg1min, seg1max, seg1minVal, seg1maxVal; - var seg2min, seg2max, seg2minVal, seg2maxVal; - if (seg1dx != 0) { // the segments are NOT on a vertical line - if ( inSeg1Pt1.x < inSeg1Pt2.x ) { - seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.x; - seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.x; - } else { - seg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.x; - seg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.x; - } - if ( inSeg2Pt1.x < inSeg2Pt2.x ) { - seg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.x; - seg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.x; - } else { - seg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.x; - seg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.x; - } - } else { // the segments are on a vertical line - if ( inSeg1Pt1.y < inSeg1Pt2.y ) { - seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.y; - seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.y; - } else { - seg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.y; - seg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.y; - } - if ( inSeg2Pt1.y < inSeg2Pt2.y ) { - seg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.y; - seg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.y; - } else { - seg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.y; - seg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.y; - } - } - if ( seg1minVal <= seg2minVal ) { - if ( seg1maxVal < seg2minVal ) return []; - if ( seg1maxVal == seg2minVal ) { - if ( inExcludeAdjacentSegs ) return []; - return [ seg2min ]; - } - if ( seg1maxVal <= seg2maxVal ) return [ seg2min, seg1max ]; - return [ seg2min, seg2max ]; - } else { - if ( seg1minVal > seg2maxVal ) return []; - if ( seg1minVal == seg2maxVal ) { - if ( inExcludeAdjacentSegs ) return []; - return [ seg1min ]; - } - if ( seg1maxVal <= seg2maxVal ) return [ seg1min, seg1max ]; - return [ seg1min, seg2max ]; - } - } - } - - function isPointInsideAngle( inVertex, inLegFromPt, inLegToPt, inOtherPt ) { - // The order of legs is important - - var EPSILON = 0.0000000001; - - // translation of all points, so that Vertex is at (0,0) - var legFromPtX = inLegFromPt.x - inVertex.x, legFromPtY = inLegFromPt.y - inVertex.y; - var legToPtX = inLegToPt.x - inVertex.x, legToPtY = inLegToPt.y - inVertex.y; - var otherPtX = inOtherPt.x - inVertex.x, otherPtY = inOtherPt.y - inVertex.y; - - // main angle >0: < 180 deg.; 0: 180 deg.; <0: > 180 deg. - var from2toAngle = legFromPtX * legToPtY - legFromPtY * legToPtX; - var from2otherAngle = legFromPtX * otherPtY - legFromPtY * otherPtX; - - if ( Math.abs(from2toAngle) > EPSILON ) { // angle != 180 deg. - - var other2toAngle = otherPtX * legToPtY - otherPtY * legToPtX; - // console.log( "from2to: " + from2toAngle + ", from2other: " + from2otherAngle + ", other2to: " + other2toAngle ); - - if ( from2toAngle > 0 ) { // main angle < 180 deg. - return ( ( from2otherAngle >= 0 ) && ( other2toAngle >= 0 ) ); - } else { // main angle > 180 deg. - return ( ( from2otherAngle >= 0 ) || ( other2toAngle >= 0 ) ); - } - } else { // angle == 180 deg. - // console.log( "from2to: 180 deg., from2other: " + from2otherAngle ); - return ( from2otherAngle > 0 ); - } - } - - - function removeHoles( contour, holes ) { - - var shape = contour.concat(); // work on this shape - var hole; - - function isCutLineInsideAngles( inShapeIdx, inHoleIdx ) { - // Check if hole point lies within angle around shape point - var lastShapeIdx = shape.length - 1; - - var prevShapeIdx = inShapeIdx - 1; - if ( prevShapeIdx < 0 ) prevShapeIdx = lastShapeIdx; - - var nextShapeIdx = inShapeIdx + 1; - if ( nextShapeIdx > lastShapeIdx ) nextShapeIdx = 0; - - var insideAngle = isPointInsideAngle( shape[inShapeIdx], shape[ prevShapeIdx ], shape[ nextShapeIdx ], hole[inHoleIdx] ); - if (! insideAngle ) { - // console.log( "Vertex (Shape): " + inShapeIdx + ", Point: " + hole[inHoleIdx].x + "/" + hole[inHoleIdx].y ); - return false; - } - - // Check if shape point lies within angle around hole point - var lastHoleIdx = hole.length - 1; - - var prevHoleIdx = inHoleIdx - 1; - if ( prevHoleIdx < 0 ) prevHoleIdx = lastHoleIdx; - - var nextHoleIdx = inHoleIdx + 1; - if ( nextHoleIdx > lastHoleIdx ) nextHoleIdx = 0; - - insideAngle = isPointInsideAngle( hole[inHoleIdx], hole[ prevHoleIdx ], hole[ nextHoleIdx ], shape[inShapeIdx] ); - if (! insideAngle ) { - // console.log( "Vertex (Hole): " + inHoleIdx + ", Point: " + shape[inShapeIdx].x + "/" + shape[inShapeIdx].y ); - return false; - } - - return true; - } - - function intersectsShapeEdge( inShapePt, inHolePt ) { - // checks for intersections with shape edges - var sIdx, nextIdx, intersection; - for ( sIdx = 0; sIdx < shape.length; sIdx++ ) { - nextIdx = sIdx+1; nextIdx %= shape.length; - intersection = intersect_segments_2D( inShapePt, inHolePt, shape[sIdx], shape[nextIdx], true ); - if ( intersection.length > 0 ) return true; - } - - return false; - } - - var indepHoles = []; - - function intersectsHoleEdge( inShapePt, inHolePt ) { - // checks for intersections with hole edges - var ihIdx, chkHole, - hIdx, nextIdx, intersection; - for ( ihIdx = 0; ihIdx < indepHoles.length; ihIdx++ ) { - chkHole = holes[indepHoles[ihIdx]]; - for ( hIdx = 0; hIdx < chkHole.length; hIdx++ ) { - nextIdx = hIdx+1; nextIdx %= chkHole.length; - intersection = intersect_segments_2D( inShapePt, inHolePt, chkHole[hIdx], chkHole[nextIdx], true ); - if ( intersection.length > 0 ) return true; - } - } - return false; - } - - var holeIndex, shapeIndex, - shapePt, holePt, - holeIdx, cutKey, failedCuts = [], - tmpShape1, tmpShape2, - tmpHole1, tmpHole2; - - for ( var h = 0, hl = holes.length; h < hl; h ++ ) { - - indepHoles.push( h ); - - } - - var counter = indepHoles.length * 2; - while ( indepHoles.length > 0 ) { - counter --; - if ( counter < 0 ) { - console.log( "Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!" ); - break; - } - - // search for shape-vertex and hole-vertex, - // which can be connected without intersections - for ( shapeIndex = 0; shapeIndex < shape.length; shapeIndex++ ) { - - shapePt = shape[ shapeIndex ]; - holeIndex = -1; - - // search for hole which can be reached without intersections - for ( var h = 0; h < indepHoles.length; h ++ ) { - holeIdx = indepHoles[h]; - - // prevent multiple checks - cutKey = shapePt.x + ":" + shapePt.y + ":" + holeIdx; - if ( failedCuts[cutKey] !== undefined ) continue; - - hole = holes[holeIdx]; - for ( var h2 = 0; h2 < hole.length; h2 ++ ) { - holePt = hole[ h2 ]; - if (! isCutLineInsideAngles( shapeIndex, h2 ) ) continue; - if ( intersectsShapeEdge( shapePt, holePt ) ) continue; - if ( intersectsHoleEdge( shapePt, holePt ) ) continue; - - holeIndex = h2; - indepHoles.splice(h,1); - - tmpShape1 = shape.slice( 0, shapeIndex+1 ); - tmpShape2 = shape.slice( shapeIndex ); - tmpHole1 = hole.slice( holeIndex ); - tmpHole2 = hole.slice( 0, holeIndex+1 ); - - shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 ); - - // Debug only, to show the selected cuts - // glob_CutLines.push( [ shapePt, holePt ] ); - - break; - } - if ( holeIndex >= 0 ) break; // hole-vertex found - - failedCuts[cutKey] = true; // remember failure - } - if ( holeIndex >= 0 ) break; // hole-vertex found - } - } - - return shape; /* shape with no holes */ - } - - - var i, il, f, face, - key, index, - allPointsMap = {}; - - // To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first. - - var allpoints = contour.concat(); - - for ( var h = 0, hl = holes.length; h < hl; h ++ ) { - - Array.prototype.push.apply( allpoints, holes[h] ); - - } - - //console.log( "allpoints",allpoints, allpoints.length ); - - // prepare all points map - - for ( i = 0, il = allpoints.length; i < il; i ++ ) { - - key = allpoints[ i ].x + ":" + allpoints[ i ].y; - - if ( allPointsMap[ key ] !== undefined ) { - - console.log( "Duplicate point", key ); - - } - - allPointsMap[ key ] = i; - - } - - // remove holes by cutting paths to holes and adding them to the shape - var shapeWithoutHoles = removeHoles( contour, holes ); - - var triangles = THREE.FontUtils.Triangulate( shapeWithoutHoles, false ); // True returns indices for points of spooled shape - //console.log( "triangles",triangles, triangles.length ); - - // check all face vertices against all points map - - for ( i = 0, il = triangles.length; i < il; i ++ ) { - - face = triangles[ i ]; - - for ( f = 0; f < 3; f ++ ) { - - key = face[ f ].x + ":" + face[ f ].y; - - index = allPointsMap[ key ]; - - if ( index !== undefined ) { - - face[ f ] = index; - - } - - } - - } - - return triangles.concat(); - - }, - - isClockWise: function ( pts ) { - - return THREE.FontUtils.Triangulate.area( pts ) < 0; - - }, - - // Bezier Curves formulas obtained from - // http://en.wikipedia.org/wiki/B%C3%A9zier_curve - - // Quad Bezier Functions - - b2p0: function ( t, p ) { - - var k = 1 - t; - return k * k * p; - - }, - - b2p1: function ( t, p ) { - - return 2 * ( 1 - t ) * t * p; - - }, - - b2p2: function ( t, p ) { - - return t * t * p; - - }, - - b2: function ( t, p0, p1, p2 ) { - - return this.b2p0( t, p0 ) + this.b2p1( t, p1 ) + this.b2p2( t, p2 ); - - }, - - // Cubic Bezier Functions - - b3p0: function ( t, p ) { - - var k = 1 - t; - return k * k * k * p; - - }, - - b3p1: function ( t, p ) { - - var k = 1 - t; - return 3 * k * k * t * p; - - }, - - b3p2: function ( t, p ) { - - var k = 1 - t; - return 3 * k * t * t * p; - - }, - - b3p3: function ( t, p ) { - - return t * t * t * p; - - }, - - b3: function ( t, p0, p1, p2, p3 ) { - - return this.b3p0( t, p0 ) + this.b3p1( t, p1 ) + this.b3p2( t, p2 ) + this.b3p3( t, p3 ); - - } - -}; - - -/************************************************************** - * Line - **************************************************************/ - -THREE.LineCurve = function ( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - -}; - -THREE.LineCurve.prototype = Object.create( THREE.Curve.prototype ); - -THREE.LineCurve.prototype.getPoint = function ( t ) { - - var point = this.v2.clone().sub(this.v1); - point.multiplyScalar( t ).add( this.v1 ); - - return point; - -}; - -// Line curve is linear, so we can overwrite default getPointAt - -THREE.LineCurve.prototype.getPointAt = function ( u ) { - - return this.getPoint( u ); - -}; - -THREE.LineCurve.prototype.getTangent = function( t ) { - - var tangent = this.v2.clone().sub(this.v1); - - return tangent.normalize(); - -}; -/************************************************************** - * Quadratic Bezier curve - **************************************************************/ - - -THREE.QuadraticBezierCurve = function ( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - -}; - -THREE.QuadraticBezierCurve.prototype = Object.create( THREE.Curve.prototype ); - - -THREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) { - - var tx, ty; - - tx = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x ); - ty = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y ); - - return new THREE.Vector2( tx, ty ); - -}; - - -THREE.QuadraticBezierCurve.prototype.getTangent = function( t ) { - - var tx, ty; - - tx = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ); - ty = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y ); - - // returns unit vector - - var tangent = new THREE.Vector2( tx, ty ); - tangent.normalize(); - - return tangent; - -}; -/************************************************************** - * Cubic Bezier curve - **************************************************************/ - -THREE.CubicBezierCurve = function ( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - -}; - -THREE.CubicBezierCurve.prototype = Object.create( THREE.Curve.prototype ); - -THREE.CubicBezierCurve.prototype.getPoint = function ( t ) { - - var tx, ty; - - tx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - ty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - - return new THREE.Vector2( tx, ty ); - -}; - -THREE.CubicBezierCurve.prototype.getTangent = function( t ) { - - var tx, ty; - - tx = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - ty = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - - var tangent = new THREE.Vector2( tx, ty ); - tangent.normalize(); - - return tangent; - -}; -/************************************************************** - * Spline curve - **************************************************************/ - -THREE.SplineCurve = function ( points /* array of Vector2 */ ) { - - this.points = (points == undefined) ? [] : points; - -}; - -THREE.SplineCurve.prototype = Object.create( THREE.Curve.prototype ); - -THREE.SplineCurve.prototype.getPoint = function ( t ) { - - var v = new THREE.Vector2(); - var c = []; - var points = this.points, point, intPoint, weight; - point = ( points.length - 1 ) * t; - - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > points.length - 2 ? points.length -1 : intPoint + 1; - c[ 3 ] = intPoint > points.length - 3 ? points.length -1 : intPoint + 2; - - v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight ); - v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight ); - - return v; - -}; -/************************************************************** - * Ellipse curve - **************************************************************/ - -THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) { - - this.aX = aX; - this.aY = aY; - - this.xRadius = xRadius; - this.yRadius = yRadius; - - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - - this.aClockwise = aClockwise; - -}; - -THREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype ); - -THREE.EllipseCurve.prototype.getPoint = function ( t ) { - - var angle; - var deltaAngle = this.aEndAngle - this.aStartAngle; - - if ( deltaAngle < 0 ) deltaAngle += Math.PI * 2; - if ( deltaAngle > Math.PI * 2 ) deltaAngle -= Math.PI * 2; - - if ( this.aClockwise === true ) { - - angle = this.aEndAngle + ( 1 - t ) * ( Math.PI * 2 - deltaAngle ); - - } else { - - angle = this.aStartAngle + t * deltaAngle; - - } - - var tx = this.aX + this.xRadius * Math.cos( angle ); - var ty = this.aY + this.yRadius * Math.sin( angle ); - - return new THREE.Vector2( tx, ty ); - -}; - -/************************************************************** - * Arc curve - **************************************************************/ - -THREE.ArcCurve = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - THREE.EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); -}; - -THREE.ArcCurve.prototype = Object.create( THREE.EllipseCurve.prototype ); -/************************************************************** - * Line3D - **************************************************************/ - -THREE.LineCurve3 = THREE.Curve.create( - - function ( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - var r = new THREE.Vector3(); - - - r.subVectors( this.v2, this.v1 ); // diff - r.multiplyScalar( t ); - r.add( this.v1 ); - - return r; - - } - -); - -/************************************************************** - * Quadratic Bezier 3D curve - **************************************************************/ - -THREE.QuadraticBezierCurve3 = THREE.Curve.create( - - function ( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - var tx, ty, tz; - - tx = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x ); - ty = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y ); - tz = THREE.Shape.Utils.b2( t, this.v0.z, this.v1.z, this.v2.z ); - - return new THREE.Vector3( tx, ty, tz ); - - } - -); -/************************************************************** - * Cubic Bezier 3D curve - **************************************************************/ - -THREE.CubicBezierCurve3 = THREE.Curve.create( - - function ( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - }, - - function ( t ) { - - var tx, ty, tz; - - tx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - ty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - tz = THREE.Shape.Utils.b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z ); - - return new THREE.Vector3( tx, ty, tz ); - - } - -); -/************************************************************** - * Spline 3D curve - **************************************************************/ - - -THREE.SplineCurve3 = THREE.Curve.create( - - function ( points /* array of Vector3 */) { - - this.points = (points == undefined) ? [] : points; - - }, - - function ( t ) { - - var v = new THREE.Vector3(); - var c = []; - var points = this.points, point, intPoint, weight; - point = ( points.length - 1 ) * t; - - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > points.length - 2 ? points.length - 1 : intPoint + 1; - c[ 3 ] = intPoint > points.length - 3 ? points.length - 1 : intPoint + 2; - - var pt0 = points[ c[0] ], - pt1 = points[ c[1] ], - pt2 = points[ c[2] ], - pt3 = points[ c[3] ]; - - v.x = THREE.Curve.Utils.interpolate(pt0.x, pt1.x, pt2.x, pt3.x, weight); - v.y = THREE.Curve.Utils.interpolate(pt0.y, pt1.y, pt2.y, pt3.y, weight); - v.z = THREE.Curve.Utils.interpolate(pt0.z, pt1.z, pt2.z, pt3.z, weight); - - return v; - - } - -); - - -// THREE.SplineCurve3.prototype.getTangent = function(t) { -// var v = new THREE.Vector3(); -// var c = []; -// var points = this.points, point, intPoint, weight; -// point = ( points.length - 1 ) * t; - -// intPoint = Math.floor( point ); -// weight = point - intPoint; - -// c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1; -// c[ 1 ] = intPoint; -// c[ 2 ] = intPoint > points.length - 2 ? points.length - 1 : intPoint + 1; -// c[ 3 ] = intPoint > points.length - 3 ? points.length - 1 : intPoint + 2; - -// var pt0 = points[ c[0] ], -// pt1 = points[ c[1] ], -// pt2 = points[ c[2] ], -// pt3 = points[ c[3] ]; - -// // t = weight; -// v.x = THREE.Curve.Utils.tangentSpline( t, pt0.x, pt1.x, pt2.x, pt3.x ); -// v.y = THREE.Curve.Utils.tangentSpline( t, pt0.y, pt1.y, pt2.y, pt3.y ); -// v.z = THREE.Curve.Utils.tangentSpline( t, pt0.z, pt1.z, pt2.z, pt3.z ); - -// return v; - -// } -/************************************************************** - * Closed Spline 3D curve - **************************************************************/ - - -THREE.ClosedSplineCurve3 = THREE.Curve.create( - - function ( points /* array of Vector3 */) { - - this.points = (points == undefined) ? [] : points; - - }, - - function ( t ) { - - var v = new THREE.Vector3(); - var c = []; - var points = this.points, point, intPoint, weight; - point = ( points.length - 0 ) * t; - // This needs to be from 0-length +1 - - intPoint = Math.floor( point ); - weight = point - intPoint; - - intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length; - c[ 0 ] = ( intPoint - 1 ) % points.length; - c[ 1 ] = ( intPoint ) % points.length; - c[ 2 ] = ( intPoint + 1 ) % points.length; - c[ 3 ] = ( intPoint + 2 ) % points.length; - - v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight ); - v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight ); - v.z = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].z, points[ c[ 1 ] ].z, points[ c[ 2 ] ].z, points[ c[ 3 ] ].z, weight ); - - return v; - - } - -); -/** - * @author mikael emtinger / http://gomo.se/ - */ - -THREE.AnimationHandler = (function() { - - var playing = []; - var library = {}; - var that = {}; - - - //--- update --- - - that.update = function( deltaTimeMS ) { - - for( var i = 0; i < playing.length; i ++ ) - playing[ i ].update( deltaTimeMS ); - - }; - - - //--- add --- - - that.addToUpdate = function( animation ) { - - if ( playing.indexOf( animation ) === -1 ) - playing.push( animation ); - - }; - - - //--- remove --- - - that.removeFromUpdate = function( animation ) { - - var index = playing.indexOf( animation ); - - if( index !== -1 ) - playing.splice( index, 1 ); - - }; - - - //--- add --- - - that.add = function( data ) { - - if ( library[ data.name ] !== undefined ) - console.log( "THREE.AnimationHandler.add: Warning! " + data.name + " already exists in library. Overwriting." ); - - library[ data.name ] = data; - initData( data ); - - }; - - - //--- get --- - - that.get = function( name ) { - - if ( typeof name === "string" ) { - - if ( library[ name ] ) { - - return library[ name ]; - - } else { - - console.log( "THREE.AnimationHandler.get: Couldn't find animation " + name ); - return null; - - } - - } else { - - // todo: add simple tween library - - } - - }; - - //--- parse --- - - that.parse = function( root ) { - - // setup hierarchy - - var hierarchy = []; - - if ( root instanceof THREE.SkinnedMesh ) { - - for( var b = 0; b < root.bones.length; b++ ) { - - hierarchy.push( root.bones[ b ] ); - - } - - } else { - - parseRecurseHierarchy( root, hierarchy ); - - } - - return hierarchy; - - }; - - var parseRecurseHierarchy = function( root, hierarchy ) { - - hierarchy.push( root ); - - for( var c = 0; c < root.children.length; c++ ) - parseRecurseHierarchy( root.children[ c ], hierarchy ); - - } - - - //--- init data --- - - var initData = function( data ) { - - if( data.initialized === true ) - return; - - - // loop through all keys - - for( var h = 0; h < data.hierarchy.length; h ++ ) { - - for( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) { - - // remove minus times - - if( data.hierarchy[ h ].keys[ k ].time < 0 ) - data.hierarchy[ h ].keys[ k ].time = 0; - - - // create quaternions - - if( data.hierarchy[ h ].keys[ k ].rot !== undefined && - !( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) { - - var quat = data.hierarchy[ h ].keys[ k ].rot; - data.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion( quat[0], quat[1], quat[2], quat[3] ); - - } - - } - - - // prepare morph target keys - - if( data.hierarchy[ h ].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) { - - // get all used - - var usedMorphTargets = {}; - - for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) { - - for ( var m = 0; m < data.hierarchy[ h ].keys[ k ].morphTargets.length; m ++ ) { - - var morphTargetName = data.hierarchy[ h ].keys[ k ].morphTargets[ m ]; - usedMorphTargets[ morphTargetName ] = -1; - - } - - } - - data.hierarchy[ h ].usedMorphTargets = usedMorphTargets; - - - // set all used on all frames - - for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) { - - var influences = {}; - - for ( var morphTargetName in usedMorphTargets ) { - - for ( var m = 0; m < data.hierarchy[ h ].keys[ k ].morphTargets.length; m ++ ) { - - if ( data.hierarchy[ h ].keys[ k ].morphTargets[ m ] === morphTargetName ) { - - influences[ morphTargetName ] = data.hierarchy[ h ].keys[ k ].morphTargetsInfluences[ m ]; - break; - - } - - } - - if ( m === data.hierarchy[ h ].keys[ k ].morphTargets.length ) { - - influences[ morphTargetName ] = 0; - - } - - } - - data.hierarchy[ h ].keys[ k ].morphTargetsInfluences = influences; - - } - - } - - - // remove all keys that are on the same time - - for ( var k = 1; k < data.hierarchy[ h ].keys.length; k ++ ) { - - if ( data.hierarchy[ h ].keys[ k ].time === data.hierarchy[ h ].keys[ k - 1 ].time ) { - - data.hierarchy[ h ].keys.splice( k, 1 ); - k --; - - } - - } - - - // set index - - for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) { - - data.hierarchy[ h ].keys[ k ].index = k; - - } - - } - - // done - - data.initialized = true; - - }; - - - // interpolation types - - that.LINEAR = 0; - that.CATMULLROM = 1; - that.CATMULLROM_FORWARD = 2; - - return that; - -}()); - -/** - * @author mikael emtinger / http://gomo.se/ - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Animation = function ( root, name ) { - - this.root = root; - this.data = THREE.AnimationHandler.get( name ); - this.hierarchy = THREE.AnimationHandler.parse( root ); - - this.currentTime = 0; - this.timeScale = 1; - - this.isPlaying = false; - this.isPaused = true; - this.loop = true; - - this.interpolationType = THREE.AnimationHandler.LINEAR; - -}; - -THREE.Animation.prototype.play = function ( startTime ) { - - this.currentTime = startTime !== undefined ? startTime : 0; - - if ( this.isPlaying === false ) { - - this.isPlaying = true; - - this.reset(); - this.update( 0 ); - - } - - this.isPaused = false; - - THREE.AnimationHandler.addToUpdate( this ); - -}; - - -THREE.Animation.prototype.pause = function() { - - if ( this.isPaused === true ) { - - THREE.AnimationHandler.addToUpdate( this ); - - } else { - - THREE.AnimationHandler.removeFromUpdate( this ); - - } - - this.isPaused = !this.isPaused; - -}; - - -THREE.Animation.prototype.stop = function() { - - this.isPlaying = false; - this.isPaused = false; - THREE.AnimationHandler.removeFromUpdate( this ); - -}; - -THREE.Animation.prototype.reset = function () { - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - - var object = this.hierarchy[ h ]; - - object.matrixAutoUpdate = true; - - if ( object.animationCache === undefined ) { - - object.animationCache = {}; - object.animationCache.prevKey = { pos: 0, rot: 0, scl: 0 }; - object.animationCache.nextKey = { pos: 0, rot: 0, scl: 0 }; - object.animationCache.originalMatrix = object instanceof THREE.Bone ? object.skinMatrix : object.matrix; - - } - - var prevKey = object.animationCache.prevKey; - var nextKey = object.animationCache.nextKey; - - prevKey.pos = this.data.hierarchy[ h ].keys[ 0 ]; - prevKey.rot = this.data.hierarchy[ h ].keys[ 0 ]; - prevKey.scl = this.data.hierarchy[ h ].keys[ 0 ]; - - nextKey.pos = this.getNextKeyWith( "pos", h, 1 ); - nextKey.rot = this.getNextKeyWith( "rot", h, 1 ); - nextKey.scl = this.getNextKeyWith( "scl", h, 1 ); - - } - -}; - - -THREE.Animation.prototype.update = (function(){ - - var points = []; - var target = new THREE.Vector3(); - - // Catmull-Rom spline - - var interpolateCatmullRom = function ( points, scale ) { - - var c = [], v3 = [], - point, intPoint, weight, w2, w3, - pa, pb, pc, pd; - - point = ( points.length - 1 ) * scale; - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1; - c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2; - - pa = points[ c[ 0 ] ]; - pb = points[ c[ 1 ] ]; - pc = points[ c[ 2 ] ]; - pd = points[ c[ 3 ] ]; - - w2 = weight * weight; - w3 = weight * w2; - - v3[ 0 ] = interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 ); - v3[ 1 ] = interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 ); - v3[ 2 ] = interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 ); - - return v3; - - }; - - var interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) { - - var v0 = ( p2 - p0 ) * 0.5, - v1 = ( p3 - p1 ) * 0.5; - - return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - }; - - return function ( delta ) { - if ( this.isPlaying === false ) return; - - this.currentTime += delta * this.timeScale; - - // - - var vector; - var types = [ "pos", "rot", "scl" ]; - - var duration = this.data.length; - - if ( this.loop === true && this.currentTime > duration ) { - - this.currentTime %= duration; - this.reset(); - - } else if ( this.loop === false && this.currentTime > duration ) { - - this.stop(); - return; - - } - - this.currentTime = Math.min( this.currentTime, duration ); - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - - var object = this.hierarchy[ h ]; - var animationCache = object.animationCache; - - // loop through pos/rot/scl - - for ( var t = 0; t < 3; t ++ ) { - - // get keys - - var type = types[ t ]; - var prevKey = animationCache.prevKey[ type ]; - var nextKey = animationCache.nextKey[ type ]; - - if ( nextKey.time <= this.currentTime ) { - - prevKey = this.data.hierarchy[ h ].keys[ 0 ]; - nextKey = this.getNextKeyWith( type, h, 1 ); - - while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { - - prevKey = nextKey; - nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 ); - - } - - animationCache.prevKey[ type ] = prevKey; - animationCache.nextKey[ type ] = nextKey; - - } - - object.matrixAutoUpdate = true; - object.matrixWorldNeedsUpdate = true; - - var scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time ); - - var prevXYZ = prevKey[ type ]; - var nextXYZ = nextKey[ type ]; - - if ( scale < 0 ) scale = 0; - if ( scale > 1 ) scale = 1; - - // interpolate - - if ( type === "pos" ) { - - vector = object.position; - - if ( this.interpolationType === THREE.AnimationHandler.LINEAR ) { - - vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; - vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; - vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; - - } else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || - this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ]; - points[ 1 ] = prevXYZ; - points[ 2 ] = nextXYZ; - points[ 3 ] = this.getNextKeyWith( "pos", h, nextKey.index + 1 )[ "pos" ]; - - scale = scale * 0.33 + 0.33; - - var currentPoint = interpolateCatmullRom( points, scale ); - - vector.x = currentPoint[ 0 ]; - vector.y = currentPoint[ 1 ]; - vector.z = currentPoint[ 2 ]; - - if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - var forwardPoint = interpolateCatmullRom( points, scale * 1.01 ); - - target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] ); - target.sub( vector ); - target.y = 0; - target.normalize(); - - var angle = Math.atan2( target.x, target.z ); - object.rotation.set( 0, angle, 0 ); - - } - - } - - } else if ( type === "rot" ) { - - THREE.Quaternion.slerp( prevXYZ, nextXYZ, object.quaternion, scale ); - - } else if ( type === "scl" ) { - - vector = object.scale; - - vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; - vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; - vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; - - } - - } - - } - - }; - -})(); - - - - - -// Get next key with - -THREE.Animation.prototype.getNextKeyWith = function ( type, h, key ) { - - var keys = this.data.hierarchy[ h ].keys; - - if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || - this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - key = key < keys.length - 1 ? key : keys.length - 1; - - } else { - - key = key % keys.length; - - } - - for ( ; key < keys.length; key++ ) { - - if ( keys[ key ][ type ] !== undefined ) { - - return keys[ key ]; - - } - - } - - return this.data.hierarchy[ h ].keys[ 0 ]; - -}; - -// Get previous key with - -THREE.Animation.prototype.getPrevKeyWith = function ( type, h, key ) { - - var keys = this.data.hierarchy[ h ].keys; - - if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || - this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - key = key > 0 ? key : 0; - - } else { - - key = key >= 0 ? key : key + keys.length; - - } - - - for ( ; key >= 0; key -- ) { - - if ( keys[ key ][ type ] !== undefined ) { - - return keys[ key ]; - - } - - } - - return this.data.hierarchy[ h ].keys[ keys.length - 1 ]; - -}; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author khang duong - * @author erik kitson - */ - -THREE.KeyFrameAnimation = function ( root, data ) { - - this.root = root; - this.data = THREE.AnimationHandler.get( data ); - this.hierarchy = THREE.AnimationHandler.parse( root ); - this.currentTime = 0; - this.timeScale = 0.001; - this.isPlaying = false; - this.isPaused = true; - this.loop = true; - - // initialize to first keyframes - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - - var keys = this.data.hierarchy[h].keys, - sids = this.data.hierarchy[h].sids, - obj = this.hierarchy[h]; - - if ( keys.length && sids ) { - - for ( var s = 0; s < sids.length; s++ ) { - - var sid = sids[ s ], - next = this.getNextKeyWith( sid, h, 0 ); - - if ( next ) { - - next.apply( sid ); - - } - - } - - obj.matrixAutoUpdate = false; - this.data.hierarchy[h].node.updateMatrix(); - obj.matrixWorldNeedsUpdate = true; - - } - - } - -}; - -// Play - -THREE.KeyFrameAnimation.prototype.play = function ( startTime ) { - - this.currentTime = startTime !== undefined ? startTime : 0; - - if ( this.isPlaying === false ) { - - this.isPlaying = true; - - // reset key cache - - var h, hl = this.hierarchy.length, - object, - node; - - for ( h = 0; h < hl; h++ ) { - - object = this.hierarchy[ h ]; - node = this.data.hierarchy[ h ]; - - if ( node.animationCache === undefined ) { - - node.animationCache = {}; - node.animationCache.prevKey = null; - node.animationCache.nextKey = null; - node.animationCache.originalMatrix = object instanceof THREE.Bone ? object.skinMatrix : object.matrix; - - } - - var keys = this.data.hierarchy[h].keys; - - if (keys.length) { - - node.animationCache.prevKey = keys[ 0 ]; - node.animationCache.nextKey = keys[ 1 ]; - - this.startTime = Math.min( keys[0].time, this.startTime ); - this.endTime = Math.max( keys[keys.length - 1].time, this.endTime ); - - } - - } - - this.update( 0 ); - - } - - this.isPaused = false; - - THREE.AnimationHandler.addToUpdate( this ); - -}; - - - -// Pause - -THREE.KeyFrameAnimation.prototype.pause = function() { - - if( this.isPaused ) { - - THREE.AnimationHandler.addToUpdate( this ); - - } else { - - THREE.AnimationHandler.removeFromUpdate( this ); - - } - - this.isPaused = !this.isPaused; - -}; - - -// Stop - -THREE.KeyFrameAnimation.prototype.stop = function() { - - this.isPlaying = false; - this.isPaused = false; - - THREE.AnimationHandler.removeFromUpdate( this ); - - // reset JIT matrix and remove cache - - for ( var h = 0; h < this.data.hierarchy.length; h++ ) { - - var obj = this.hierarchy[ h ]; - var node = this.data.hierarchy[ h ]; - - if ( node.animationCache !== undefined ) { - - var original = node.animationCache.originalMatrix; - - if( obj instanceof THREE.Bone ) { - - original.copy( obj.skinMatrix ); - obj.skinMatrix = original; - - } else { - - original.copy( obj.matrix ); - obj.matrix = original; - - } - - delete node.animationCache; - - } - - } - -}; - - -// Update - -THREE.KeyFrameAnimation.prototype.update = function ( delta ) { - - if ( this.isPlaying === false ) return; - - this.currentTime += delta * this.timeScale; - - // - - var duration = this.data.length; - - if ( this.loop === true && this.currentTime > duration ) { - - this.currentTime %= duration; - - } - - this.currentTime = Math.min( this.currentTime, duration ); - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h++ ) { - - var object = this.hierarchy[ h ]; - var node = this.data.hierarchy[ h ]; - - var keys = node.keys, - animationCache = node.animationCache; - - - if ( keys.length ) { - - var prevKey = animationCache.prevKey; - var nextKey = animationCache.nextKey; - - if ( nextKey.time <= this.currentTime ) { - - while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { - - prevKey = nextKey; - nextKey = keys[ prevKey.index + 1 ]; - - } - - animationCache.prevKey = prevKey; - animationCache.nextKey = nextKey; - - } - - if ( nextKey.time >= this.currentTime ) { - - prevKey.interpolate( nextKey, this.currentTime ); - - } else { - - prevKey.interpolate( nextKey, nextKey.time ); - - } - - this.data.hierarchy[ h ].node.updateMatrix(); - object.matrixWorldNeedsUpdate = true; - - } - - } - -}; - -// Get next key with - -THREE.KeyFrameAnimation.prototype.getNextKeyWith = function( sid, h, key ) { - - var keys = this.data.hierarchy[ h ].keys; - key = key % keys.length; - - for ( ; key < keys.length; key++ ) { - - if ( keys[ key ].hasTarget( sid ) ) { - - return keys[ key ]; - - } - - } - - return keys[ 0 ]; - -}; - -// Get previous key with - -THREE.KeyFrameAnimation.prototype.getPrevKeyWith = function( sid, h, key ) { - - var keys = this.data.hierarchy[ h ].keys; - key = key >= 0 ? key : key + keys.length; - - for ( ; key >= 0; key-- ) { - - if ( keys[ key ].hasTarget( sid ) ) { - - return keys[ key ]; - - } - - } - - return keys[ keys.length - 1 ]; - -}; - -/** - * @author mrdoob / http://mrdoob.com - */ - -THREE.MorphAnimation = function ( mesh ) { - - this.mesh = mesh; - this.frames = mesh.morphTargetInfluences.length; - this.currentTime = 0; - this.duration = 1000; - this.loop = true; - - this.isPlaying = false; - -}; - -THREE.MorphAnimation.prototype = { - - play: function () { - - this.isPlaying = true; - - }, - - pause: function () { - - this.isPlaying = false; - }, - - update: ( function () { - - var lastFrame = 0; - var currentFrame = 0; - - return function ( delta ) { - - if ( this.isPlaying === false ) return; - - this.currentTime += delta; - - if ( this.loop === true && this.currentTime > this.duration ) { - - this.currentTime %= this.duration; - - } - - this.currentTime = Math.min( this.currentTime, this.duration ); - - var interpolation = this.duration / this.frames; - var frame = Math.floor( this.currentTime / interpolation ); - - if ( frame != currentFrame ) { - - this.mesh.morphTargetInfluences[ lastFrame ] = 0; - this.mesh.morphTargetInfluences[ currentFrame ] = 1; - this.mesh.morphTargetInfluences[ frame ] = 0; - - lastFrame = currentFrame; - currentFrame = frame; - - } - - this.mesh.morphTargetInfluences[ frame ] = ( this.currentTime % interpolation ) / interpolation; - this.mesh.morphTargetInfluences[ lastFrame ] = 1 - this.mesh.morphTargetInfluences[ frame ]; - - } - - } )() - -}; - -/** - * Camera for rendering cube maps - * - renders scene into axis-aligned cube - * - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.CubeCamera = function ( near, far, cubeResolution ) { - - THREE.Object3D.call( this ); - - var fov = 90, aspect = 1; - - var cameraPX = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraPX.up.set( 0, -1, 0 ); - cameraPX.lookAt( new THREE.Vector3( 1, 0, 0 ) ); - this.add( cameraPX ); - - var cameraNX = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraNX.up.set( 0, -1, 0 ); - cameraNX.lookAt( new THREE.Vector3( -1, 0, 0 ) ); - this.add( cameraNX ); - - var cameraPY = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraPY.up.set( 0, 0, 1 ); - cameraPY.lookAt( new THREE.Vector3( 0, 1, 0 ) ); - this.add( cameraPY ); - - var cameraNY = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraNY.up.set( 0, 0, -1 ); - cameraNY.lookAt( new THREE.Vector3( 0, -1, 0 ) ); - this.add( cameraNY ); - - var cameraPZ = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraPZ.up.set( 0, -1, 0 ); - cameraPZ.lookAt( new THREE.Vector3( 0, 0, 1 ) ); - this.add( cameraPZ ); - - var cameraNZ = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraNZ.up.set( 0, -1, 0 ); - cameraNZ.lookAt( new THREE.Vector3( 0, 0, -1 ) ); - this.add( cameraNZ ); - - this.renderTarget = new THREE.WebGLRenderTargetCube( cubeResolution, cubeResolution, { format: THREE.RGBFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter } ); - - this.updateCubeMap = function ( renderer, scene ) { - - var renderTarget = this.renderTarget; - var generateMipmaps = renderTarget.generateMipmaps; - - renderTarget.generateMipmaps = false; - - renderTarget.activeCubeFace = 0; - renderer.render( scene, cameraPX, renderTarget ); - - renderTarget.activeCubeFace = 1; - renderer.render( scene, cameraNX, renderTarget ); - - renderTarget.activeCubeFace = 2; - renderer.render( scene, cameraPY, renderTarget ); - - renderTarget.activeCubeFace = 3; - renderer.render( scene, cameraNY, renderTarget ); - - renderTarget.activeCubeFace = 4; - renderer.render( scene, cameraPZ, renderTarget ); - - renderTarget.generateMipmaps = generateMipmaps; - - renderTarget.activeCubeFace = 5; - renderer.render( scene, cameraNZ, renderTarget ); - - }; - -}; - -THREE.CubeCamera.prototype = Object.create( THREE.Object3D.prototype ); - -/** - * @author zz85 / http://twitter.com/blurspline / http://www.lab4games.net/zz85/blog - * - * A general perpose camera, for setting FOV, Lens Focal Length, - * and switching between perspective and orthographic views easily. - * Use this only if you do not wish to manage - * both a Orthographic and Perspective Camera - * - */ - - -THREE.CombinedCamera = function ( width, height, fov, near, far, orthoNear, orthoFar ) { - - THREE.Camera.call( this ); - - this.fov = fov; - - this.left = -width / 2; - this.right = width / 2 - this.top = height / 2; - this.bottom = -height / 2; - - // We could also handle the projectionMatrix internally, but just wanted to test nested camera objects - - this.cameraO = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, orthoNear, orthoFar ); - this.cameraP = new THREE.PerspectiveCamera( fov, width / height, near, far ); - - this.zoom = 1; - - this.toPerspective(); - - var aspect = width/height; - -}; - -THREE.CombinedCamera.prototype = Object.create( THREE.Camera.prototype ); - -THREE.CombinedCamera.prototype.toPerspective = function () { - - // Switches to the Perspective Camera - - this.near = this.cameraP.near; - this.far = this.cameraP.far; - - this.cameraP.fov = this.fov / this.zoom ; - - this.cameraP.updateProjectionMatrix(); - - this.projectionMatrix = this.cameraP.projectionMatrix; - - this.inPerspectiveMode = true; - this.inOrthographicMode = false; - -}; - -THREE.CombinedCamera.prototype.toOrthographic = function () { - - // Switches to the Orthographic camera estimating viewport from Perspective - - var fov = this.fov; - var aspect = this.cameraP.aspect; - var near = this.cameraP.near; - var far = this.cameraP.far; - - // The size that we set is the mid plane of the viewing frustum - - var hyperfocus = ( near + far ) / 2; - - var halfHeight = Math.tan( fov / 2 ) * hyperfocus; - var planeHeight = 2 * halfHeight; - var planeWidth = planeHeight * aspect; - var halfWidth = planeWidth / 2; - - halfHeight /= this.zoom; - halfWidth /= this.zoom; - - this.cameraO.left = -halfWidth; - this.cameraO.right = halfWidth; - this.cameraO.top = halfHeight; - this.cameraO.bottom = -halfHeight; - - // this.cameraO.left = -farHalfWidth; - // this.cameraO.right = farHalfWidth; - // this.cameraO.top = farHalfHeight; - // this.cameraO.bottom = -farHalfHeight; - - // this.cameraO.left = this.left / this.zoom; - // this.cameraO.right = this.right / this.zoom; - // this.cameraO.top = this.top / this.zoom; - // this.cameraO.bottom = this.bottom / this.zoom; - - this.cameraO.updateProjectionMatrix(); - - this.near = this.cameraO.near; - this.far = this.cameraO.far; - this.projectionMatrix = this.cameraO.projectionMatrix; - - this.inPerspectiveMode = false; - this.inOrthographicMode = true; - -}; - - -THREE.CombinedCamera.prototype.setSize = function( width, height ) { - - this.cameraP.aspect = width / height; - this.left = -width / 2; - this.right = width / 2 - this.top = height / 2; - this.bottom = -height / 2; - -}; - - -THREE.CombinedCamera.prototype.setFov = function( fov ) { - - this.fov = fov; - - if ( this.inPerspectiveMode ) { - - this.toPerspective(); - - } else { - - this.toOrthographic(); - - } - -}; - -// For mantaining similar API with PerspectiveCamera - -THREE.CombinedCamera.prototype.updateProjectionMatrix = function() { - - if ( this.inPerspectiveMode ) { - - this.toPerspective(); - - } else { - - this.toPerspective(); - this.toOrthographic(); - - } - -}; - -/* -* Uses Focal Length (in mm) to estimate and set FOV -* 35mm (fullframe) camera is used if frame size is not specified; -* Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html -*/ -THREE.CombinedCamera.prototype.setLens = function ( focalLength, frameHeight ) { - - if ( frameHeight === undefined ) frameHeight = 24; - - var fov = 2 * THREE.Math.radToDeg( Math.atan( frameHeight / ( focalLength * 2 ) ) ); - - this.setFov( fov ); - - return fov; -}; - - -THREE.CombinedCamera.prototype.setZoom = function( zoom ) { - - this.zoom = zoom; - - if ( this.inPerspectiveMode ) { - - this.toPerspective(); - - } else { - - this.toOrthographic(); - - } - -}; - -THREE.CombinedCamera.prototype.toFrontView = function() { - - this.rotation.x = 0; - this.rotation.y = 0; - this.rotation.z = 0; - - // should we be modifing the matrix instead? - - this.rotationAutoUpdate = false; - -}; - -THREE.CombinedCamera.prototype.toBackView = function() { - - this.rotation.x = 0; - this.rotation.y = Math.PI; - this.rotation.z = 0; - this.rotationAutoUpdate = false; - -}; - -THREE.CombinedCamera.prototype.toLeftView = function() { - - this.rotation.x = 0; - this.rotation.y = - Math.PI / 2; - this.rotation.z = 0; - this.rotationAutoUpdate = false; - -}; - -THREE.CombinedCamera.prototype.toRightView = function() { - - this.rotation.x = 0; - this.rotation.y = Math.PI / 2; - this.rotation.z = 0; - this.rotationAutoUpdate = false; - -}; - -THREE.CombinedCamera.prototype.toTopView = function() { - - this.rotation.x = - Math.PI / 2; - this.rotation.y = 0; - this.rotation.z = 0; - this.rotationAutoUpdate = false; - -}; - -THREE.CombinedCamera.prototype.toBottomView = function() { - - this.rotation.x = Math.PI / 2; - this.rotation.y = 0; - this.rotation.z = 0; - this.rotationAutoUpdate = false; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as - */ - -THREE.BoxGeometry = function ( width, height, depth, widthSegments, heightSegments, depthSegments ) { - - THREE.Geometry.call( this ); - - var scope = this; - - this.width = width; - this.height = height; - this.depth = depth; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - this.depthSegments = depthSegments || 1; - - var width_half = this.width / 2; - var height_half = this.height / 2; - var depth_half = this.depth / 2; - - buildPlane( 'z', 'y', - 1, - 1, this.depth, this.height, width_half, 0 ); // px - buildPlane( 'z', 'y', 1, - 1, this.depth, this.height, - width_half, 1 ); // nx - buildPlane( 'x', 'z', 1, 1, this.width, this.depth, height_half, 2 ); // py - buildPlane( 'x', 'z', 1, - 1, this.width, this.depth, - height_half, 3 ); // ny - buildPlane( 'x', 'y', 1, - 1, this.width, this.height, depth_half, 4 ); // pz - buildPlane( 'x', 'y', - 1, - 1, this.width, this.height, - depth_half, 5 ); // nz - - function buildPlane( u, v, udir, vdir, width, height, depth, materialIndex ) { - - var w, ix, iy, - gridX = scope.widthSegments, - gridY = scope.heightSegments, - width_half = width / 2, - height_half = height / 2, - offset = scope.vertices.length; - - if ( ( u === 'x' && v === 'y' ) || ( u === 'y' && v === 'x' ) ) { - - w = 'z'; - - } else if ( ( u === 'x' && v === 'z' ) || ( u === 'z' && v === 'x' ) ) { - - w = 'y'; - gridY = scope.depthSegments; - - } else if ( ( u === 'z' && v === 'y' ) || ( u === 'y' && v === 'z' ) ) { - - w = 'x'; - gridX = scope.depthSegments; - - } - - var gridX1 = gridX + 1, - gridY1 = gridY + 1, - segment_width = width / gridX, - segment_height = height / gridY, - normal = new THREE.Vector3(); - - normal[ w ] = depth > 0 ? 1 : - 1; - - for ( iy = 0; iy < gridY1; iy ++ ) { - - for ( ix = 0; ix < gridX1; ix ++ ) { - - var vector = new THREE.Vector3(); - vector[ u ] = ( ix * segment_width - width_half ) * udir; - vector[ v ] = ( iy * segment_height - height_half ) * vdir; - vector[ w ] = depth; - - scope.vertices.push( vector ); - - } - - } - - for ( iy = 0; iy < gridY; iy++ ) { - - for ( ix = 0; ix < gridX; ix++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - var uva = new THREE.Vector2( ix / gridX, 1 - iy / gridY ); - var uvb = new THREE.Vector2( ix / gridX, 1 - ( iy + 1 ) / gridY ); - var uvc = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - ( iy + 1 ) / gridY ); - var uvd = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - iy / gridY ); - - var face = new THREE.Face3( a + offset, b + offset, d + offset ); - face.normal.copy( normal ); - face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() ); - face.materialIndex = materialIndex; - - scope.faces.push( face ); - scope.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - face = new THREE.Face3( b + offset, c + offset, d + offset ); - face.normal.copy( normal ); - face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() ); - face.materialIndex = materialIndex; - - scope.faces.push( face ); - scope.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - - } - - } - - this.computeCentroids(); - this.mergeVertices(); - -}; - -THREE.BoxGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author hughes - */ - -THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) { - - THREE.Geometry.call( this ); - - this.radius = radius = radius || 50; - this.segments = segments = segments !== undefined ? Math.max( 3, segments ) : 8; - - this.thetaStart = thetaStart = thetaStart !== undefined ? thetaStart : 0; - this.thetaLength = thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - var i, uvs = [], - center = new THREE.Vector3(), centerUV = new THREE.Vector2( 0.5, 0.5 ); - - this.vertices.push(center); - uvs.push( centerUV ); - - for ( i = 0; i <= segments; i ++ ) { - - var vertex = new THREE.Vector3(); - var segment = thetaStart + i / segments * thetaLength; - - vertex.x = radius * Math.cos( segment ); - vertex.y = radius * Math.sin( segment ); - - this.vertices.push( vertex ); - uvs.push( new THREE.Vector2( ( vertex.x / radius + 1 ) / 2, ( vertex.y / radius + 1 ) / 2 ) ); - - } - - var n = new THREE.Vector3( 0, 0, 1 ); - - for ( i = 1; i <= segments; i ++ ) { - - var v1 = i; - var v2 = i + 1 ; - var v3 = 0; - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uvs[ i ].clone(), uvs[ i + 1 ].clone(), centerUV.clone() ] ); - - } - - this.computeCentroids(); - this.computeFaceNormals(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - -}; - -THREE.CircleGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -// DEPRECATED - -THREE.CubeGeometry = THREE.BoxGeometry; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded ) { - - THREE.Geometry.call( this ); - - this.radiusTop = radiusTop = radiusTop !== undefined ? radiusTop : 20; - this.radiusBottom = radiusBottom = radiusBottom !== undefined ? radiusBottom : 20; - this.height = height = height !== undefined ? height : 100; - - this.radialSegments = radialSegments = radialSegments || 8; - this.heightSegments = heightSegments = heightSegments || 1; - - this.openEnded = openEnded = openEnded !== undefined ? openEnded : false; - - var heightHalf = height / 2; - - var x, y, vertices = [], uvs = []; - - for ( y = 0; y <= heightSegments; y ++ ) { - - var verticesRow = []; - var uvsRow = []; - - var v = y / heightSegments; - var radius = v * ( radiusBottom - radiusTop ) + radiusTop; - - for ( x = 0; x <= radialSegments; x ++ ) { - - var u = x / radialSegments; - - var vertex = new THREE.Vector3(); - vertex.x = radius * Math.sin( u * Math.PI * 2 ); - vertex.y = - v * height + heightHalf; - vertex.z = radius * Math.cos( u * Math.PI * 2 ); - - this.vertices.push( vertex ); - - verticesRow.push( this.vertices.length - 1 ); - uvsRow.push( new THREE.Vector2( u, 1 - v ) ); - - } - - vertices.push( verticesRow ); - uvs.push( uvsRow ); - - } - - var tanTheta = ( radiusBottom - radiusTop ) / height; - var na, nb; - - for ( x = 0; x < radialSegments; x ++ ) { - - if ( radiusTop !== 0 ) { - - na = this.vertices[ vertices[ 0 ][ x ] ].clone(); - nb = this.vertices[ vertices[ 0 ][ x + 1 ] ].clone(); - - } else { - - na = this.vertices[ vertices[ 1 ][ x ] ].clone(); - nb = this.vertices[ vertices[ 1 ][ x + 1 ] ].clone(); - - } - - na.setY( Math.sqrt( na.x * na.x + na.z * na.z ) * tanTheta ).normalize(); - nb.setY( Math.sqrt( nb.x * nb.x + nb.z * nb.z ) * tanTheta ).normalize(); - - for ( y = 0; y < heightSegments; y ++ ) { - - var v1 = vertices[ y ][ x ]; - var v2 = vertices[ y + 1 ][ x ]; - var v3 = vertices[ y + 1 ][ x + 1 ]; - var v4 = vertices[ y ][ x + 1 ]; - - var n1 = na.clone(); - var n2 = na.clone(); - var n3 = nb.clone(); - var n4 = nb.clone(); - - var uv1 = uvs[ y ][ x ].clone(); - var uv2 = uvs[ y + 1 ][ x ].clone(); - var uv3 = uvs[ y + 1 ][ x + 1 ].clone(); - var uv4 = uvs[ y ][ x + 1 ].clone(); - - this.faces.push( new THREE.Face3( v1, v2, v4, [ n1, n2, n4 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv4 ] ); - - this.faces.push( new THREE.Face3( v2, v3, v4, [ n2.clone(), n3, n4.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv2.clone(), uv3, uv4.clone() ] ); - - } - - } - - // top cap - - if ( openEnded === false && radiusTop > 0 ) { - - this.vertices.push( new THREE.Vector3( 0, heightHalf, 0 ) ); - - for ( x = 0; x < radialSegments; x ++ ) { - - var v1 = vertices[ 0 ][ x ]; - var v2 = vertices[ 0 ][ x + 1 ]; - var v3 = this.vertices.length - 1; - - var n1 = new THREE.Vector3( 0, 1, 0 ); - var n2 = new THREE.Vector3( 0, 1, 0 ); - var n3 = new THREE.Vector3( 0, 1, 0 ); - - var uv1 = uvs[ 0 ][ x ].clone(); - var uv2 = uvs[ 0 ][ x + 1 ].clone(); - var uv3 = new THREE.Vector2( uv2.x, 0 ); - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); - - } - - } - - // bottom cap - - if ( openEnded === false && radiusBottom > 0 ) { - - this.vertices.push( new THREE.Vector3( 0, - heightHalf, 0 ) ); - - for ( x = 0; x < radialSegments; x ++ ) { - - var v1 = vertices[ y ][ x + 1 ]; - var v2 = vertices[ y ][ x ]; - var v3 = this.vertices.length - 1; - - var n1 = new THREE.Vector3( 0, - 1, 0 ); - var n2 = new THREE.Vector3( 0, - 1, 0 ); - var n3 = new THREE.Vector3( 0, - 1, 0 ); - - var uv1 = uvs[ y ][ x + 1 ].clone(); - var uv2 = uvs[ y ][ x ].clone(); - var uv3 = new THREE.Vector2( uv2.x, 1 ); - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); - - } - - } - - this.computeCentroids(); - this.computeFaceNormals(); - -} - -THREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * - * Creates extruded geometry from a path shape. - * - * parameters = { - * - * curveSegments: <int>, // number of points on the curves - * steps: <int>, // number of points for z-side extrusions / used for subdividing segements of extrude spline too - * amount: <int>, // Depth to extrude the shape - * - * bevelEnabled: <bool>, // turn on bevel - * bevelThickness: <float>, // how deep into the original shape bevel goes - * bevelSize: <float>, // how far from shape outline is bevel - * bevelSegments: <int>, // number of bevel layers - * - * extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined) - * frames: <THREE.TubeGeometry.FrenetFrames> // containing arrays of tangents, normals, binormals - * - * material: <int> // material index for front and back faces - * extrudeMaterial: <int> // material index for extrusion and beveled faces - * uvGenerator: <Object> // object that provides UV generator functions - * - * } - **/ - -THREE.ExtrudeGeometry = function ( shapes, options ) { - - if ( typeof( shapes ) === "undefined" ) { - shapes = []; - return; - } - - THREE.Geometry.call( this ); - - shapes = shapes instanceof Array ? shapes : [ shapes ]; - - this.shapebb = shapes[ shapes.length - 1 ].getBoundingBox(); - - this.addShapeList( shapes, options ); - - this.computeCentroids(); - this.computeFaceNormals(); - - // can't really use automatic vertex normals - // as then front and back sides get smoothed too - // should do separate smoothing just for sides - - //this.computeVertexNormals(); - - //console.log( "took", ( Date.now() - startTime ) ); - -}; - -THREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -THREE.ExtrudeGeometry.prototype.addShapeList = function ( shapes, options ) { - var sl = shapes.length; - - for ( var s = 0; s < sl; s ++ ) { - var shape = shapes[ s ]; - this.addShape( shape, options ); - } -}; - -THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) { - - var amount = options.amount !== undefined ? options.amount : 100; - - var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; // 10 - var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; // 8 - var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3; - - var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false - - var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - - var steps = options.steps !== undefined ? options.steps : 1; - - var extrudePath = options.extrudePath; - var extrudePts, extrudeByPath = false; - - var material = options.material; - var extrudeMaterial = options.extrudeMaterial; - - // Use default WorldUVGenerator if no UV generators are specified. - var uvgen = options.UVGenerator !== undefined ? options.UVGenerator : THREE.ExtrudeGeometry.WorldUVGenerator; - - var shapebb = this.shapebb; - //shapebb = shape.getBoundingBox(); - - - - var splineTube, binormal, normal, position2; - if ( extrudePath ) { - - extrudePts = extrudePath.getSpacedPoints( steps ); - - extrudeByPath = true; - bevelEnabled = false; // bevels not supported for path extrusion - - // SETUP TNB variables - - // Reuse TNB from TubeGeomtry for now. - // TODO1 - have a .isClosed in spline? - - splineTube = options.frames !== undefined ? options.frames : new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false); - - // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); - - binormal = new THREE.Vector3(); - normal = new THREE.Vector3(); - position2 = new THREE.Vector3(); - - } - - // Safeguards if bevels are not enabled - - if ( ! bevelEnabled ) { - - bevelSegments = 0; - bevelThickness = 0; - bevelSize = 0; - - } - - // Variables initalization - - var ahole, h, hl; // looping of holes - var scope = this; - var bevelPoints = []; - - var shapesOffset = this.vertices.length; - - var shapePoints = shape.extractPoints( curveSegments ); - - var vertices = shapePoints.shape; - var holes = shapePoints.holes; - - var reverse = !THREE.Shape.Utils.isClockWise( vertices ) ; - - if ( reverse ) { - - vertices = vertices.reverse(); - - // Maybe we should also check if holes are in the opposite direction, just to be safe ... - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - if ( THREE.Shape.Utils.isClockWise( ahole ) ) { - - holes[ h ] = ahole.reverse(); - - } - - } - - reverse = false; // If vertices are in order now, we shouldn't need to worry about them again (hopefully)! - - } - - - var faces = THREE.Shape.Utils.triangulateShape ( vertices, holes ); - - /* Vertices */ - - var contour = vertices; // vertices has all points but contour has only points of circumference - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - vertices = vertices.concat( ahole ); - - } - - - function scalePt2 ( pt, vec, size ) { - - if ( !vec ) console.log( "die" ); - - return vec.clone().multiplyScalar( size ).add( pt ); - - } - - var b, bs, t, z, - vert, vlen = vertices.length, - face, flen = faces.length, - cont, clen = contour.length; - - - // Find directions for point movement - - var RAD_TO_DEGREES = 180 / Math.PI; - - - function getBevelVec( inPt, inPrev, inNext ) { - - var EPSILON = 0.0000000001; - var sign = THREE.Math.sign; - - // computes for inPt the corresponding point inPt' on a new contour - // shiftet by 1 unit (length of normalized vector) to the left - // if we walk along contour clockwise, this new contour is outside the old one - // - // inPt' is the intersection of the two lines parallel to the two - // adjacent edges of inPt at a distance of 1 unit on the left side. - - var v_trans_x, v_trans_y, shrink_by = 1; // resulting translation vector for inPt - - // good reading for geometry algorithms (here: line-line intersection) - // http://geomalgorithms.com/a05-_intersect-1.html - - var v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y; - var v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y; - - var v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y ); - - // check for colinear edges - var colinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - if ( Math.abs( colinear0 ) > EPSILON ) { // not colinear - - // length of vectors for normalizing - - var v_prev_len = Math.sqrt( v_prev_lensq ); - var v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y ); - - // shift adjacent points by unit vectors to the left - - var ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len ); - var ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len ); - - var ptNextShift_x = ( inNext.x - v_next_y / v_next_len ); - var ptNextShift_y = ( inNext.y + v_next_x / v_next_len ); - - // scaling factor for v_prev to intersection point - - var sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y - - ( ptNextShift_y - ptPrevShift_y ) * v_next_x ) / - ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - // vector from inPt to intersection point - - v_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x ); - v_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y ); - - // Don't normalize!, otherwise sharp corners become ugly - // but prevent crazy spikes - var v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y ) - if ( v_trans_lensq <= 2 ) { - return new THREE.Vector2( v_trans_x, v_trans_y ); - } else { - shrink_by = Math.sqrt( v_trans_lensq / 2 ); - } - - } else { // handle special case of colinear edges - - var direction_eq = false; // assumes: opposite - if ( v_prev_x > EPSILON ) { - if ( v_next_x > EPSILON ) { direction_eq = true; } - } else { - if ( v_prev_x < -EPSILON ) { - if ( v_next_x < -EPSILON ) { direction_eq = true; } - } else { - if ( sign(v_prev_y) == sign(v_next_y) ) { direction_eq = true; } - } - } - - if ( direction_eq ) { - // console.log("Warning: lines are a straight sequence"); - v_trans_x = -v_prev_y; - v_trans_y = v_prev_x; - shrink_by = Math.sqrt( v_prev_lensq ); - } else { - // console.log("Warning: lines are a straight spike"); - v_trans_x = v_prev_x; - v_trans_y = v_prev_y; - shrink_by = Math.sqrt( v_prev_lensq / 2 ); - } - - } - - return new THREE.Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by ); - - } - - - var contourMovements = []; - - for ( var i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - // console.log('i,j,k', i, j , k) - - var pt_i = contour[ i ]; - var pt_j = contour[ j ]; - var pt_k = contour[ k ]; - - contourMovements[ i ]= getBevelVec( contour[ i ], contour[ j ], contour[ k ] ); - - } - - var holesMovements = [], oneHoleMovements, verticesMovements = contourMovements.concat(); - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - oneHoleMovements = []; - - for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - oneHoleMovements[ i ]= getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] ); - - } - - holesMovements.push( oneHoleMovements ); - verticesMovements = verticesMovements.concat( oneHoleMovements ); - - } - - - // Loop bevelSegments, 1 for the front, 1 for the back - - for ( b = 0; b < bevelSegments; b ++ ) { - //for ( b = bevelSegments; b > 0; b -- ) { - - t = b / bevelSegments; - z = bevelThickness * ( 1 - t ); - - //z = bevelThickness * t; - bs = bevelSize * ( Math.sin ( t * Math.PI/2 ) ) ; // curved - //bs = bevelSize * t ; // linear - - // contract shape - - for ( i = 0, il = contour.length; i < il; i ++ ) { - - vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - //vert = scalePt( contour[ i ], contourCentroid, bs, false ); - v( vert.x, vert.y, - z ); - - } - - // expand holes - - for ( h = 0, hl = holes.length; h < hl; h++ ) { - - ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( i = 0, il = ahole.length; i < il; i++ ) { - - vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - //vert = scalePt( ahole[ i ], holesCentroids[ h ], bs, true ); - - v( vert.x, vert.y, -z ); - - } - - } - - } - - bs = bevelSize; - - // Back facing vertices - - for ( i = 0; i < vlen; i ++ ) { - - vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( !extrudeByPath ) { - - v( vert.x, vert.y, 0 ); - - } else { - - // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x ); - - normal.copy( splineTube.normals[0] ).multiplyScalar(vert.x); - binormal.copy( splineTube.binormals[0] ).multiplyScalar(vert.y); - - position2.copy( extrudePts[0] ).add(normal).add(binormal); - - v( position2.x, position2.y, position2.z ); - - } - - } - - // Add stepped vertices... - // Including front facing vertices - - var s; - - for ( s = 1; s <= steps; s ++ ) { - - for ( i = 0; i < vlen; i ++ ) { - - vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( !extrudeByPath ) { - - v( vert.x, vert.y, amount / steps * s ); - - } else { - - // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x ); - - normal.copy( splineTube.normals[s] ).multiplyScalar( vert.x ); - binormal.copy( splineTube.binormals[s] ).multiplyScalar( vert.y ); - - position2.copy( extrudePts[s] ).add( normal ).add( binormal ); - - v( position2.x, position2.y, position2.z ); - - } - - } - - } - - - // Add bevel segments planes - - //for ( b = 1; b <= bevelSegments; b ++ ) { - for ( b = bevelSegments - 1; b >= 0; b -- ) { - - t = b / bevelSegments; - z = bevelThickness * ( 1 - t ); - //bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) ); - bs = bevelSize * Math.sin ( t * Math.PI/2 ) ; - - // contract shape - - for ( i = 0, il = contour.length; i < il; i ++ ) { - - vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - v( vert.x, vert.y, amount + z ); - - } - - // expand holes - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( i = 0, il = ahole.length; i < il; i ++ ) { - - vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - if ( !extrudeByPath ) { - - v( vert.x, vert.y, amount + z ); - - } else { - - v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z ); - - } - - } - - } - - } - - /* Faces */ - - // Top and bottom faces - - buildLidFaces(); - - // Sides faces - - buildSideFaces(); - - - ///// Internal functions - - function buildLidFaces() { - - if ( bevelEnabled ) { - - var layer = 0 ; // steps + 1 - var offset = vlen * layer; - - // Bottom faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 2 ]+ offset, face[ 1 ]+ offset, face[ 0 ] + offset, true ); - - } - - layer = steps + bevelSegments * 2; - offset = vlen * layer; - - // Top faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset, false ); - - } - - } else { - - // Bottom faces - - for ( i = 0; i < flen; i++ ) { - - face = faces[ i ]; - f3( face[ 2 ], face[ 1 ], face[ 0 ], true ); - - } - - // Top faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps, false ); - - } - } - - } - - // Create faces for the z-sides of the shape - - function buildSideFaces() { - - var layeroffset = 0; - sidewalls( contour, layeroffset ); - layeroffset += contour.length; - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - sidewalls( ahole, layeroffset ); - - //, true - layeroffset += ahole.length; - - } - - } - - function sidewalls( contour, layeroffset ) { - - var j, k; - i = contour.length; - - while ( --i >= 0 ) { - - j = i; - k = i - 1; - if ( k < 0 ) k = contour.length - 1; - - //console.log('b', i,j, i-1, k,vertices.length); - - var s = 0, sl = steps + bevelSegments * 2; - - for ( s = 0; s < sl; s ++ ) { - - var slen1 = vlen * s; - var slen2 = vlen * ( s + 1 ); - - var a = layeroffset + j + slen1, - b = layeroffset + k + slen1, - c = layeroffset + k + slen2, - d = layeroffset + j + slen2; - - f4( a, b, c, d, contour, s, sl, j, k ); - - } - } - - } - - - function v( x, y, z ) { - - scope.vertices.push( new THREE.Vector3( x, y, z ) ); - - } - - function f3( a, b, c, isBottom ) { - - a += shapesOffset; - b += shapesOffset; - c += shapesOffset; - - // normal, color, material - scope.faces.push( new THREE.Face3( a, b, c, null, null, material ) ); - - var uvs = isBottom ? uvgen.generateBottomUV( scope, shape, options, a, b, c ) : uvgen.generateTopUV( scope, shape, options, a, b, c ); - - scope.faceVertexUvs[ 0 ].push( uvs ); - - } - - function f4( a, b, c, d, wallContour, stepIndex, stepsLength, contourIndex1, contourIndex2 ) { - - a += shapesOffset; - b += shapesOffset; - c += shapesOffset; - d += shapesOffset; - - scope.faces.push( new THREE.Face3( a, b, d, null, null, extrudeMaterial ) ); - scope.faces.push( new THREE.Face3( b, c, d, null, null, extrudeMaterial ) ); - - var uvs = uvgen.generateSideWallUV( scope, shape, wallContour, options, a, b, c, d, - stepIndex, stepsLength, contourIndex1, contourIndex2 ); - - scope.faceVertexUvs[ 0 ].push( [ uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] ] ); - scope.faceVertexUvs[ 0 ].push( [ uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] ] ); - - } - -}; - -THREE.ExtrudeGeometry.WorldUVGenerator = { - - generateTopUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ) { - var ax = geometry.vertices[ indexA ].x, - ay = geometry.vertices[ indexA ].y, - - bx = geometry.vertices[ indexB ].x, - by = geometry.vertices[ indexB ].y, - - cx = geometry.vertices[ indexC ].x, - cy = geometry.vertices[ indexC ].y; - - return [ - new THREE.Vector2( ax, ay ), - new THREE.Vector2( bx, by ), - new THREE.Vector2( cx, cy ) - ]; - - }, - - generateBottomUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ) { - - return this.generateTopUV( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ); - - }, - - generateSideWallUV: function( geometry, extrudedShape, wallContour, extrudeOptions, - indexA, indexB, indexC, indexD, stepIndex, stepsLength, - contourIndex1, contourIndex2 ) { - - var ax = geometry.vertices[ indexA ].x, - ay = geometry.vertices[ indexA ].y, - az = geometry.vertices[ indexA ].z, - - bx = geometry.vertices[ indexB ].x, - by = geometry.vertices[ indexB ].y, - bz = geometry.vertices[ indexB ].z, - - cx = geometry.vertices[ indexC ].x, - cy = geometry.vertices[ indexC ].y, - cz = geometry.vertices[ indexC ].z, - - dx = geometry.vertices[ indexD ].x, - dy = geometry.vertices[ indexD ].y, - dz = geometry.vertices[ indexD ].z; - - if ( Math.abs( ay - by ) < 0.01 ) { - return [ - new THREE.Vector2( ax, 1 - az ), - new THREE.Vector2( bx, 1 - bz ), - new THREE.Vector2( cx, 1 - cz ), - new THREE.Vector2( dx, 1 - dz ) - ]; - } else { - return [ - new THREE.Vector2( ay, 1 - az ), - new THREE.Vector2( by, 1 - bz ), - new THREE.Vector2( cy, 1 - cz ), - new THREE.Vector2( dy, 1 - dz ) - ]; - } - } -}; - -THREE.ExtrudeGeometry.__v1 = new THREE.Vector2(); -THREE.ExtrudeGeometry.__v2 = new THREE.Vector2(); -THREE.ExtrudeGeometry.__v3 = new THREE.Vector2(); -THREE.ExtrudeGeometry.__v4 = new THREE.Vector2(); -THREE.ExtrudeGeometry.__v5 = new THREE.Vector2(); -THREE.ExtrudeGeometry.__v6 = new THREE.Vector2(); - -/** - * @author jonobr1 / http://jonobr1.com - * - * Creates a one-sided polygonal geometry from a path shape. Similar to - * ExtrudeGeometry. - * - * parameters = { - * - * curveSegments: <int>, // number of points on the curves. NOT USED AT THE MOMENT. - * - * material: <int> // material index for front and back faces - * uvGenerator: <Object> // object that provides UV generator functions - * - * } - **/ - -THREE.ShapeGeometry = function ( shapes, options ) { - - THREE.Geometry.call( this ); - - if ( shapes instanceof Array === false ) shapes = [ shapes ]; - - this.shapebb = shapes[ shapes.length - 1 ].getBoundingBox(); - - this.addShapeList( shapes, options ); - - this.computeCentroids(); - this.computeFaceNormals(); - -}; - -THREE.ShapeGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * Add an array of shapes to THREE.ShapeGeometry. - */ -THREE.ShapeGeometry.prototype.addShapeList = function ( shapes, options ) { - - for ( var i = 0, l = shapes.length; i < l; i++ ) { - - this.addShape( shapes[ i ], options ); - - } - - return this; - -}; - -/** - * Adds a shape to THREE.ShapeGeometry, based on THREE.ExtrudeGeometry. - */ -THREE.ShapeGeometry.prototype.addShape = function ( shape, options ) { - - if ( options === undefined ) options = {}; - var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - - var material = options.material; - var uvgen = options.UVGenerator === undefined ? THREE.ExtrudeGeometry.WorldUVGenerator : options.UVGenerator; - - var shapebb = this.shapebb; - - // - - var i, l, hole, s; - - var shapesOffset = this.vertices.length; - var shapePoints = shape.extractPoints( curveSegments ); - - var vertices = shapePoints.shape; - var holes = shapePoints.holes; - - var reverse = !THREE.Shape.Utils.isClockWise( vertices ); - - if ( reverse ) { - - vertices = vertices.reverse(); - - // Maybe we should also check if holes are in the opposite direction, just to be safe... - - for ( i = 0, l = holes.length; i < l; i++ ) { - - hole = holes[ i ]; - - if ( THREE.Shape.Utils.isClockWise( hole ) ) { - - holes[ i ] = hole.reverse(); - - } - - } - - reverse = false; - - } - - var faces = THREE.Shape.Utils.triangulateShape( vertices, holes ); - - // Vertices - - var contour = vertices; - - for ( i = 0, l = holes.length; i < l; i++ ) { - - hole = holes[ i ]; - vertices = vertices.concat( hole ); - - } - - // - - var vert, vlen = vertices.length; - var face, flen = faces.length; - var cont, clen = contour.length; - - for ( i = 0; i < vlen; i++ ) { - - vert = vertices[ i ]; - - this.vertices.push( new THREE.Vector3( vert.x, vert.y, 0 ) ); - - } - - for ( i = 0; i < flen; i++ ) { - - face = faces[ i ]; - - var a = face[ 0 ] + shapesOffset; - var b = face[ 1 ] + shapesOffset; - var c = face[ 2 ] + shapesOffset; - - this.faces.push( new THREE.Face3( a, b, c, null, null, material ) ); - this.faceVertexUvs[ 0 ].push( uvgen.generateBottomUV( this, shape, options, a, b, c ) ); - - } - -}; - -/** - * @author astrodud / http://astrodud.isgreat.org/ - * @author zz85 / https://github.com/zz85 - * @author bhouston / http://exocortex.com - */ - -// points - to create a closed torus, one must use a set of points -// like so: [ a, b, c, d, a ], see first is the same as last. -// segments - the number of circumference segments to create -// phiStart - the starting radian -// phiLength - the radian (0 to 2*PI) range of the lathed section -// 2*pi is a closed lathe, less than 2PI is a portion. -THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { - - THREE.Geometry.call( this ); - - segments = segments || 12; - phiStart = phiStart || 0; - phiLength = phiLength || 2 * Math.PI; - - var inversePointLength = 1.0 / ( points.length - 1 ); - var inverseSegments = 1.0 / segments; - - for ( var i = 0, il = segments; i <= il; i ++ ) { - - var phi = phiStart + i * inverseSegments * phiLength; - - var c = Math.cos( phi ), - s = Math.sin( phi ); - - for ( var j = 0, jl = points.length; j < jl; j ++ ) { - - var pt = points[ j ]; - - var vertex = new THREE.Vector3(); - - vertex.x = c * pt.x - s * pt.y; - vertex.y = s * pt.x + c * pt.y; - vertex.z = pt.z; - - this.vertices.push( vertex ); - - } - - } - - var np = points.length; - - for ( var i = 0, il = segments; i < il; i ++ ) { - - for ( var j = 0, jl = points.length - 1; j < jl; j ++ ) { - - var base = j + np * i; - var a = base; - var b = base + np; - var c = base + 1 + np; - var d = base + 1; - - var u0 = i * inverseSegments; - var v0 = j * inversePointLength; - var u1 = u0 + inverseSegments; - var v1 = v0 + inversePointLength; - - this.faces.push( new THREE.Face3( a, b, d ) ); - - this.faceVertexUvs[ 0 ].push( [ - - new THREE.Vector2( u0, v0 ), - new THREE.Vector2( u1, v0 ), - new THREE.Vector2( u0, v1 ) - - ] ); - - this.faces.push( new THREE.Face3( b, c, d ) ); - - this.faceVertexUvs[ 0 ].push( [ - - new THREE.Vector2( u1, v0 ), - new THREE.Vector2( u1, v1 ), - new THREE.Vector2( u0, v1 ) - - ] ); - - - } - - } - - this.mergeVertices(); - this.computeCentroids(); - this.computeFaceNormals(); - this.computeVertexNormals(); - -}; - -THREE.LatheGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) { - - THREE.Geometry.call( this ); - - this.width = width; - this.height = height; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - - var ix, iz; - var width_half = width / 2; - var height_half = height / 2; - - var gridX = this.widthSegments; - var gridZ = this.heightSegments; - - var gridX1 = gridX + 1; - var gridZ1 = gridZ + 1; - - var segment_width = this.width / gridX; - var segment_height = this.height / gridZ; - - var normal = new THREE.Vector3( 0, 0, 1 ); - - for ( iz = 0; iz < gridZ1; iz ++ ) { - - for ( ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segment_width - width_half; - var y = iz * segment_height - height_half; - - this.vertices.push( new THREE.Vector3( x, - y, 0 ) ); - - } - - } - - for ( iz = 0; iz < gridZ; iz ++ ) { - - for ( ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iz; - var b = ix + gridX1 * ( iz + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iz + 1 ); - var d = ( ix + 1 ) + gridX1 * iz; - - var uva = new THREE.Vector2( ix / gridX, 1 - iz / gridZ ); - var uvb = new THREE.Vector2( ix / gridX, 1 - ( iz + 1 ) / gridZ ); - var uvc = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - ( iz + 1 ) / gridZ ); - var uvd = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - iz / gridZ ); - - var face = new THREE.Face3( a, b, d ); - face.normal.copy( normal ); - face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() ); - - this.faces.push( face ); - this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - face = new THREE.Face3( b, c, d ); - face.normal.copy( normal ); - face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() ); - - this.faces.push( face ); - this.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - - } - - this.computeCentroids(); - -}; - -THREE.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author Kaleb Murphy - */ - -THREE.RingGeometry = function ( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) { - - THREE.Geometry.call( this ); - - innerRadius = innerRadius || 0; - outerRadius = outerRadius || 50; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - thetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8; - phiSegments = phiSegments !== undefined ? Math.max( 3, phiSegments ) : 8; - - var i, o, uvs = [], radius = innerRadius, radiusStep = ( ( outerRadius - innerRadius ) / phiSegments ); - - for ( i = 0; i <= phiSegments; i ++ ) { // concentric circles inside ring - - for ( o = 0; o <= thetaSegments; o ++ ) { // number of segments per circle - - var vertex = new THREE.Vector3(); - var segment = thetaStart + o / thetaSegments * thetaLength; - - vertex.x = radius * Math.cos( segment ); - vertex.y = radius * Math.sin( segment ); - - this.vertices.push( vertex ); - uvs.push( new THREE.Vector2( ( vertex.x / outerRadius + 1 ) / 2, ( vertex.y / outerRadius + 1 ) / 2 ) ); - } - - radius += radiusStep; - - } - - var n = new THREE.Vector3( 0, 0, 1 ); - - for ( i = 0; i < phiSegments; i ++ ) { // concentric circles inside ring - - var thetaSegment = i * thetaSegments; - - for ( o = 0; o <= thetaSegments; o ++ ) { // number of segments per circle - - var segment = o + thetaSegment; - - var v1 = segment + i; - var v2 = segment + thetaSegments + i; - var v3 = segment + thetaSegments + 1 + i; - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uvs[ v1 ].clone(), uvs[ v2 ].clone(), uvs[ v3 ].clone() ]); - - v1 = segment + i; - v2 = segment + thetaSegments + 1 + i; - v3 = segment + 1 + i; - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uvs[ v1 ].clone(), uvs[ v2 ].clone(), uvs[ v3 ].clone() ]); - - } - } - - this.computeCentroids(); - this.computeFaceNormals(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - -}; - -THREE.RingGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) { - - THREE.Geometry.call( this ); - - this.radius = radius = radius || 50; - - this.widthSegments = widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 ); - this.heightSegments = heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 ); - - this.phiStart = phiStart = phiStart !== undefined ? phiStart : 0; - this.phiLength = phiLength = phiLength !== undefined ? phiLength : Math.PI * 2; - - this.thetaStart = thetaStart = thetaStart !== undefined ? thetaStart : 0; - this.thetaLength = thetaLength = thetaLength !== undefined ? thetaLength : Math.PI; - - var x, y, vertices = [], uvs = []; - - for ( y = 0; y <= heightSegments; y ++ ) { - - var verticesRow = []; - var uvsRow = []; - - for ( x = 0; x <= widthSegments; x ++ ) { - - var u = x / widthSegments; - var v = y / heightSegments; - - var vertex = new THREE.Vector3(); - vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - vertex.y = radius * Math.cos( thetaStart + v * thetaLength ); - vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - - this.vertices.push( vertex ); - - verticesRow.push( this.vertices.length - 1 ); - uvsRow.push( new THREE.Vector2( u, 1 - v ) ); - - } - - vertices.push( verticesRow ); - uvs.push( uvsRow ); - - } - - for ( y = 0; y < this.heightSegments; y ++ ) { - - for ( x = 0; x < this.widthSegments; x ++ ) { - - var v1 = vertices[ y ][ x + 1 ]; - var v2 = vertices[ y ][ x ]; - var v3 = vertices[ y + 1 ][ x ]; - var v4 = vertices[ y + 1 ][ x + 1 ]; - - var n1 = this.vertices[ v1 ].clone().normalize(); - var n2 = this.vertices[ v2 ].clone().normalize(); - var n3 = this.vertices[ v3 ].clone().normalize(); - var n4 = this.vertices[ v4 ].clone().normalize(); - - var uv1 = uvs[ y ][ x + 1 ].clone(); - var uv2 = uvs[ y ][ x ].clone(); - var uv3 = uvs[ y + 1 ][ x ].clone(); - var uv4 = uvs[ y + 1 ][ x + 1 ].clone(); - - if ( Math.abs( this.vertices[ v1 ].y ) === this.radius ) { - - uv1.x = ( uv1.x + uv2.x ) / 2; - this.faces.push( new THREE.Face3( v1, v3, v4, [ n1, n3, n4 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv3, uv4 ] ); - - } else if ( Math.abs( this.vertices[ v3 ].y ) === this.radius ) { - - uv3.x = ( uv3.x + uv4.x ) / 2; - this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); - - } else { - - this.faces.push( new THREE.Face3( v1, v2, v4, [ n1, n2, n4 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv4 ] ); - - this.faces.push( new THREE.Face3( v2, v3, v4, [ n2.clone(), n3, n4.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv2.clone(), uv3, uv4.clone() ] ); - - } - - } - - } - - this.computeCentroids(); - this.computeFaceNormals(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - -}; - -THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author alteredq / http://alteredqualia.com/ - * - * For creating 3D text geometry in three.js - * - * Text = 3D Text - * - * parameters = { - * size: <float>, // size of the text - * height: <float>, // thickness to extrude text - * curveSegments: <int>, // number of points on the curves - * - * font: <string>, // font name - * weight: <string>, // font weight (normal, bold) - * style: <string>, // font style (normal, italics) - * - * bevelEnabled: <bool>, // turn on bevel - * bevelThickness: <float>, // how deep into text bevel goes - * bevelSize: <float>, // how far from text outline is bevel - * } - * - */ - -/* Usage Examples - - // TextGeometry wrapper - - var text3d = new TextGeometry( text, options ); - - // Complete manner - - var textShapes = THREE.FontUtils.generateShapes( text, options ); - var text3d = new ExtrudeGeometry( textShapes, options ); - -*/ - - -THREE.TextGeometry = function ( text, parameters ) { - - parameters = parameters || {}; - - var textShapes = THREE.FontUtils.generateShapes( text, parameters ); - - // translate parameters to ExtrudeGeometry API - - parameters.amount = parameters.height !== undefined ? parameters.height : 50; - - // defaults - - if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10; - if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; - if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; - - THREE.ExtrudeGeometry.call( this, textShapes, parameters ); - -}; - -THREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype ); - -/** - * @author oosmoxiecode - * @author mrdoob / http://mrdoob.com/ - * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888 - */ - -THREE.TorusGeometry = function ( radius, tube, radialSegments, tubularSegments, arc ) { - - THREE.Geometry.call( this ); - - var scope = this; - - this.radius = radius || 100; - this.tube = tube || 40; - this.radialSegments = radialSegments || 8; - this.tubularSegments = tubularSegments || 6; - this.arc = arc || Math.PI * 2; - - var center = new THREE.Vector3(), uvs = [], normals = []; - - for ( var j = 0; j <= this.radialSegments; j ++ ) { - - for ( var i = 0; i <= this.tubularSegments; i ++ ) { - - var u = i / this.tubularSegments * this.arc; - var v = j / this.radialSegments * Math.PI * 2; - - center.x = this.radius * Math.cos( u ); - center.y = this.radius * Math.sin( u ); - - var vertex = new THREE.Vector3(); - vertex.x = ( this.radius + this.tube * Math.cos( v ) ) * Math.cos( u ); - vertex.y = ( this.radius + this.tube * Math.cos( v ) ) * Math.sin( u ); - vertex.z = this.tube * Math.sin( v ); - - this.vertices.push( vertex ); - - uvs.push( new THREE.Vector2( i / this.tubularSegments, j / this.radialSegments ) ); - normals.push( vertex.clone().sub( center ).normalize() ); - - } - - } - - - for ( var j = 1; j <= this.radialSegments; j ++ ) { - - for ( var i = 1; i <= this.tubularSegments; i ++ ) { - - var a = ( this.tubularSegments + 1 ) * j + i - 1; - var b = ( this.tubularSegments + 1 ) * ( j - 1 ) + i - 1; - var c = ( this.tubularSegments + 1 ) * ( j - 1 ) + i; - var d = ( this.tubularSegments + 1 ) * j + i; - - var face = new THREE.Face3( a, b, d, [ normals[ a ].clone(), normals[ b ].clone(), normals[ d ].clone() ] ); - this.faces.push( face ); - this.faceVertexUvs[ 0 ].push( [ uvs[ a ].clone(), uvs[ b ].clone(), uvs[ d ].clone() ] ); - - face = new THREE.Face3( b, c, d, [ normals[ b ].clone(), normals[ c ].clone(), normals[ d ].clone() ] ); - this.faces.push( face ); - this.faceVertexUvs[ 0 ].push( [ uvs[ b ].clone(), uvs[ c ].clone(), uvs[ d ].clone() ] ); - - } - - } - - this.computeCentroids(); - this.computeFaceNormals(); - -}; - -THREE.TorusGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author oosmoxiecode - * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473 - */ - -THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegments, p, q, heightScale ) { - - THREE.Geometry.call( this ); - - var scope = this; - - this.radius = radius || 100; - this.tube = tube || 40; - this.radialSegments = radialSegments || 64; - this.tubularSegments = tubularSegments || 8; - this.p = p || 2; - this.q = q || 3; - this.heightScale = heightScale || 1; - this.grid = new Array( this.radialSegments ); - - var tang = new THREE.Vector3(); - var n = new THREE.Vector3(); - var bitan = new THREE.Vector3(); - - for ( var i = 0; i < this.radialSegments; ++ i ) { - - this.grid[ i ] = new Array( this.tubularSegments ); - var u = i / this.radialSegments * 2 * this.p * Math.PI; - var p1 = getPos( u, this.q, this.p, this.radius, this.heightScale ); - var p2 = getPos( u + 0.01, this.q, this.p, this.radius, this.heightScale ); - tang.subVectors( p2, p1 ); - n.addVectors( p2, p1 ); - - bitan.crossVectors( tang, n ); - n.crossVectors( bitan, tang ); - bitan.normalize(); - n.normalize(); - - for ( var j = 0; j < this.tubularSegments; ++ j ) { - - var v = j / this.tubularSegments * 2 * Math.PI; - var cx = - this.tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. - var cy = this.tube * Math.sin( v ); - - var pos = new THREE.Vector3(); - pos.x = p1.x + cx * n.x + cy * bitan.x; - pos.y = p1.y + cx * n.y + cy * bitan.y; - pos.z = p1.z + cx * n.z + cy * bitan.z; - - this.grid[ i ][ j ] = scope.vertices.push( pos ) - 1; - - } - - } - - for ( var i = 0; i < this.radialSegments; ++ i ) { - - for ( var j = 0; j < this.tubularSegments; ++ j ) { - - var ip = ( i + 1 ) % this.radialSegments; - var jp = ( j + 1 ) % this.tubularSegments; - - var a = this.grid[ i ][ j ]; - var b = this.grid[ ip ][ j ]; - var c = this.grid[ ip ][ jp ]; - var d = this.grid[ i ][ jp ]; - - var uva = new THREE.Vector2( i / this.radialSegments, j / this.tubularSegments ); - var uvb = new THREE.Vector2( ( i + 1 ) / this.radialSegments, j / this.tubularSegments ); - var uvc = new THREE.Vector2( ( i + 1 ) / this.radialSegments, ( j + 1 ) / this.tubularSegments ); - var uvd = new THREE.Vector2( i / this.radialSegments, ( j + 1 ) / this.tubularSegments ); - - this.faces.push( new THREE.Face3( a, b, d ) ); - this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - this.faces.push( new THREE.Face3( b, c, d ) ); - this.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - } - - this.computeCentroids(); - this.computeFaceNormals(); - this.computeVertexNormals(); - - function getPos( u, in_q, in_p, radius, heightScale ) { - - var cu = Math.cos( u ); - var su = Math.sin( u ); - var quOverP = in_q / in_p * u; - var cs = Math.cos( quOverP ); - - var tx = radius * ( 2 + cs ) * 0.5 * cu; - var ty = radius * ( 2 + cs ) * su * 0.5; - var tz = heightScale * radius * Math.sin( quOverP ) * 0.5; - - return new THREE.Vector3( tx, ty, tz ); - - } - -}; - -THREE.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author WestLangley / https://github.com/WestLangley - * @author zz85 / https://github.com/zz85 - * @author miningold / https://github.com/miningold - * - * Modified from the TorusKnotGeometry by @oosmoxiecode - * - * Creates a tube which extrudes along a 3d spline - * - * Uses parallel transport frames as described in - * http://www.cs.indiana.edu/pub/techreports/TR425.pdf - */ - -THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed ) { - - THREE.Geometry.call( this ); - - this.path = path; - this.segments = segments || 64; - this.radius = radius || 1; - this.radialSegments = radialSegments || 8; - this.closed = closed || false; - - this.grid = []; - - var scope = this, - - tangent, - normal, - binormal, - - numpoints = this.segments + 1, - - x, y, z, - tx, ty, tz, - u, v, - - cx, cy, - pos, pos2 = new THREE.Vector3(), - i, j, - ip, jp, - a, b, c, d, - uva, uvb, uvc, uvd; - - var frames = new THREE.TubeGeometry.FrenetFrames( this.path, this.segments, this.closed ), - tangents = frames.tangents, - normals = frames.normals, - binormals = frames.binormals; - - // proxy internals - this.tangents = tangents; - this.normals = normals; - this.binormals = binormals; - - function vert( x, y, z ) { - - return scope.vertices.push( new THREE.Vector3( x, y, z ) ) - 1; - - } - - - // consruct the grid - - for ( i = 0; i < numpoints; i++ ) { - - this.grid[ i ] = []; - - u = i / ( numpoints - 1 ); - - pos = path.getPointAt( u ); - - tangent = tangents[ i ]; - normal = normals[ i ]; - binormal = binormals[ i ]; - - for ( j = 0; j < this.radialSegments; j++ ) { - - v = j / this.radialSegments * 2 * Math.PI; - - cx = -this.radius * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. - cy = this.radius * Math.sin( v ); - - pos2.copy( pos ); - pos2.x += cx * normal.x + cy * binormal.x; - pos2.y += cx * normal.y + cy * binormal.y; - pos2.z += cx * normal.z + cy * binormal.z; - - this.grid[ i ][ j ] = vert( pos2.x, pos2.y, pos2.z ); - - } - } - - - // construct the mesh - - for ( i = 0; i < this.segments; i++ ) { - - for ( j = 0; j < this.radialSegments; j++ ) { - - ip = ( this.closed ) ? (i + 1) % this.segments : i + 1; - jp = (j + 1) % this.radialSegments; - - a = this.grid[ i ][ j ]; // *** NOT NECESSARILY PLANAR ! *** - b = this.grid[ ip ][ j ]; - c = this.grid[ ip ][ jp ]; - d = this.grid[ i ][ jp ]; - - uva = new THREE.Vector2( i / this.segments, j / this.radialSegments ); - uvb = new THREE.Vector2( ( i + 1 ) / this.segments, j / this.radialSegments ); - uvc = new THREE.Vector2( ( i + 1 ) / this.segments, ( j + 1 ) / this.radialSegments ); - uvd = new THREE.Vector2( i / this.segments, ( j + 1 ) / this.radialSegments ); - - this.faces.push( new THREE.Face3( a, b, d ) ); - this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - this.faces.push( new THREE.Face3( b, c, d ) ); - this.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - } - - this.computeCentroids(); - this.computeFaceNormals(); - this.computeVertexNormals(); - -}; - -THREE.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype ); - - -// For computing of Frenet frames, exposing the tangents, normals and binormals the spline -THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) { - - var tangent = new THREE.Vector3(), - normal = new THREE.Vector3(), - binormal = new THREE.Vector3(), - - tangents = [], - normals = [], - binormals = [], - - vec = new THREE.Vector3(), - mat = new THREE.Matrix4(), - - numpoints = segments + 1, - theta, - epsilon = 0.0001, - smallest, - - tx, ty, tz, - i, u, v; - - - // expose internals - this.tangents = tangents; - this.normals = normals; - this.binormals = binormals; - - // compute the tangent vectors for each segment on the path - - for ( i = 0; i < numpoints; i++ ) { - - u = i / ( numpoints - 1 ); - - tangents[ i ] = path.getTangentAt( u ); - tangents[ i ].normalize(); - - } - - initialNormal3(); - - function initialNormal1(lastBinormal) { - // fixed start binormal. Has dangers of 0 vectors - normals[ 0 ] = new THREE.Vector3(); - binormals[ 0 ] = new THREE.Vector3(); - if (lastBinormal===undefined) lastBinormal = new THREE.Vector3( 0, 0, 1 ); - normals[ 0 ].crossVectors( lastBinormal, tangents[ 0 ] ).normalize(); - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize(); - } - - function initialNormal2() { - - // This uses the Frenet-Serret formula for deriving binormal - var t2 = path.getTangentAt( epsilon ); - - normals[ 0 ] = new THREE.Vector3().subVectors( t2, tangents[ 0 ] ).normalize(); - binormals[ 0 ] = new THREE.Vector3().crossVectors( tangents[ 0 ], normals[ 0 ] ); - - normals[ 0 ].crossVectors( binormals[ 0 ], tangents[ 0 ] ).normalize(); // last binormal x tangent - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize(); - - } - - function initialNormal3() { - // select an initial normal vector perpenicular to the first tangent vector, - // and in the direction of the smallest tangent xyz component - - normals[ 0 ] = new THREE.Vector3(); - binormals[ 0 ] = new THREE.Vector3(); - smallest = Number.MAX_VALUE; - tx = Math.abs( tangents[ 0 ].x ); - ty = Math.abs( tangents[ 0 ].y ); - tz = Math.abs( tangents[ 0 ].z ); - - if ( tx <= smallest ) { - smallest = tx; - normal.set( 1, 0, 0 ); - } - - if ( ty <= smallest ) { - smallest = ty; - normal.set( 0, 1, 0 ); - } - - if ( tz <= smallest ) { - normal.set( 0, 0, 1 ); - } - - vec.crossVectors( tangents[ 0 ], normal ).normalize(); - - normals[ 0 ].crossVectors( tangents[ 0 ], vec ); - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ); - } - - - // compute the slowly-varying normal and binormal vectors for each segment on the path - - for ( i = 1; i < numpoints; i++ ) { - - normals[ i ] = normals[ i-1 ].clone(); - - binormals[ i ] = binormals[ i-1 ].clone(); - - vec.crossVectors( tangents[ i-1 ], tangents[ i ] ); - - if ( vec.length() > epsilon ) { - - vec.normalize(); - - theta = Math.acos( THREE.Math.clamp( tangents[ i-1 ].dot( tangents[ i ] ), -1, 1 ) ); // clamp for floating pt errors - - normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) ); - - } - - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - - // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same - - if ( closed ) { - - theta = Math.acos( THREE.Math.clamp( normals[ 0 ].dot( normals[ numpoints-1 ] ), -1, 1 ) ); - theta /= ( numpoints - 1 ); - - if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints-1 ] ) ) > 0 ) { - - theta = -theta; - - } - - for ( i = 1; i < numpoints; i++ ) { - - // twist a little... - normals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) ); - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - } -}; - -/** - * @author clockworkgeek / https://github.com/clockworkgeek - * @author timothypratley / https://github.com/timothypratley - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { - - THREE.Geometry.call( this ); - - radius = radius || 1; - detail = detail || 0; - - var that = this; - - for ( var i = 0, l = vertices.length; i < l; i ++ ) { - - prepare( new THREE.Vector3( vertices[ i ][ 0 ], vertices[ i ][ 1 ], vertices[ i ][ 2 ] ) ); - - } - - var midpoints = [], p = this.vertices; - - var f = []; - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var v1 = p[ faces[ i ][ 0 ] ]; - var v2 = p[ faces[ i ][ 1 ] ]; - var v3 = p[ faces[ i ][ 2 ] ]; - - f[ i ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); - - } - - for ( var i = 0, l = f.length; i < l; i ++ ) { - - subdivide(f[ i ], detail); - - } - - - // Handle case when face straddles the seam - - for ( var i = 0, l = this.faceVertexUvs[ 0 ].length; i < l; i ++ ) { - - var uvs = this.faceVertexUvs[ 0 ][ i ]; - - var x0 = uvs[ 0 ].x; - var x1 = uvs[ 1 ].x; - var x2 = uvs[ 2 ].x; - - var max = Math.max( x0, Math.max( x1, x2 ) ); - var min = Math.min( x0, Math.min( x1, x2 ) ); - - if ( max > 0.9 && min < 0.1 ) { // 0.9 is somewhat arbitrary - - if ( x0 < 0.2 ) uvs[ 0 ].x += 1; - if ( x1 < 0.2 ) uvs[ 1 ].x += 1; - if ( x2 < 0.2 ) uvs[ 2 ].x += 1; - - } - - } - - - // Apply radius - - for ( var i = 0, l = this.vertices.length; i < l; i ++ ) { - - this.vertices[ i ].multiplyScalar( radius ); - - } - - - // Merge vertices - - this.mergeVertices(); - - this.computeCentroids(); - - this.computeFaceNormals(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - - - // Project vector onto sphere's surface - - function prepare( vector ) { - - var vertex = vector.normalize().clone(); - vertex.index = that.vertices.push( vertex ) - 1; - - // Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle. - - var u = azimuth( vector ) / 2 / Math.PI + 0.5; - var v = inclination( vector ) / Math.PI + 0.5; - vertex.uv = new THREE.Vector2( u, 1 - v ); - - return vertex; - - } - - - // Approximate a curved face with recursively sub-divided triangles. - - function make( v1, v2, v3 ) { - - var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); - face.centroid.add( v1 ).add( v2 ).add( v3 ).divideScalar( 3 ); - that.faces.push( face ); - - var azi = azimuth( face.centroid ); - - that.faceVertexUvs[ 0 ].push( [ - correctUV( v1.uv, v1, azi ), - correctUV( v2.uv, v2, azi ), - correctUV( v3.uv, v3, azi ) - ] ); - - } - - - // Analytically subdivide a face to the required detail level. - - function subdivide(face, detail ) { - - var cols = Math.pow(2, detail); - var cells = Math.pow(4, detail); - var a = prepare( that.vertices[ face.a ] ); - var b = prepare( that.vertices[ face.b ] ); - var c = prepare( that.vertices[ face.c ] ); - var v = []; - - // Construct all of the vertices for this subdivision. - - for ( var i = 0 ; i <= cols; i ++ ) { - - v[ i ] = []; - - var aj = prepare( a.clone().lerp( c, i / cols ) ); - var bj = prepare( b.clone().lerp( c, i / cols ) ); - var rows = cols - i; - - for ( var j = 0; j <= rows; j ++) { - - if ( j == 0 && i == cols ) { - - v[ i ][ j ] = aj; - - } else { - - v[ i ][ j ] = prepare( aj.clone().lerp( bj, j / rows ) ); - - } - - } - - } - - // Construct all of the faces. - - for ( var i = 0; i < cols ; i ++ ) { - - for ( var j = 0; j < 2 * (cols - i) - 1; j ++ ) { - - var k = Math.floor( j / 2 ); - - if ( j % 2 == 0 ) { - - make( - v[ i ][ k + 1], - v[ i + 1 ][ k ], - v[ i ][ k ] - ); - - } else { - - make( - v[ i ][ k + 1 ], - v[ i + 1][ k + 1], - v[ i + 1 ][ k ] - ); - - } - - } - - } - - } - - - // Angle around the Y axis, counter-clockwise when looking from above. - - function azimuth( vector ) { - - return Math.atan2( vector.z, -vector.x ); - - } - - - // Angle above the XZ plane. - - function inclination( vector ) { - - return Math.atan2( -vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); - - } - - - // Texture fixing helper. Spheres have some odd behaviours. - - function correctUV( uv, vector, azimuth ) { - - if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) uv = new THREE.Vector2( uv.x - 1, uv.y ); - if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) uv = new THREE.Vector2( azimuth / 2 / Math.PI + 0.5, uv.y ); - return uv.clone(); - - } - - -}; - -THREE.PolyhedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -THREE.IcosahedronGeometry = function ( radius, detail ) { - - this.radius = radius; - this.detail = detail; - - var t = ( 1 + Math.sqrt( 5 ) ) / 2; - - var vertices = [ - [ -1, t, 0 ], [ 1, t, 0 ], [ -1, -t, 0 ], [ 1, -t, 0 ], - [ 0, -1, t ], [ 0, 1, t ], [ 0, -1, -t ], [ 0, 1, -t ], - [ t, 0, -1 ], [ t, 0, 1 ], [ -t, 0, -1 ], [ -t, 0, 1 ] - ]; - - var faces = [ - [ 0, 11, 5 ], [ 0, 5, 1 ], [ 0, 1, 7 ], [ 0, 7, 10 ], [ 0, 10, 11 ], - [ 1, 5, 9 ], [ 5, 11, 4 ], [ 11, 10, 2 ], [ 10, 7, 6 ], [ 7, 1, 8 ], - [ 3, 9, 4 ], [ 3, 4, 2 ], [ 3, 2, 6 ], [ 3, 6, 8 ], [ 3, 8, 9 ], - [ 4, 9, 5 ], [ 2, 4, 11 ], [ 6, 2, 10 ], [ 8, 6, 7 ], [ 9, 8, 1 ] - ]; - - THREE.PolyhedronGeometry.call( this, vertices, faces, radius, detail ); - -}; - -THREE.IcosahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -THREE.OctahedronGeometry = function ( radius, detail ) { - - var vertices = [ - [ 1, 0, 0 ], [ -1, 0, 0 ], [ 0, 1, 0 ], [ 0, -1, 0 ], [ 0, 0, 1 ], [ 0, 0, -1 ] - ]; - - var faces = [ - [ 0, 2, 4 ], [ 0, 4, 3 ], [ 0, 3, 5 ], [ 0, 5, 2 ], [ 1, 2, 5 ], [ 1, 5, 3 ], [ 1, 3, 4 ], [ 1, 4, 2 ] - ]; - - THREE.PolyhedronGeometry.call( this, vertices, faces, radius, detail ); -}; - -THREE.OctahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -THREE.TetrahedronGeometry = function ( radius, detail ) { - - var vertices = [ - [ 1, 1, 1 ], [ -1, -1, 1 ], [ -1, 1, -1 ], [ 1, -1, -1 ] - ]; - - var faces = [ - [ 2, 1, 0 ], [ 0, 3, 2 ], [ 1, 3, 0 ], [ 2, 3, 1 ] - ]; - - THREE.PolyhedronGeometry.call( this, vertices, faces, radius, detail ); - -}; - -THREE.TetrahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author zz85 / https://github.com/zz85 - * Parametric Surfaces Geometry - * based on the brilliant article by @prideout http://prideout.net/blog/?p=44 - * - * new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements ); - * - */ - -THREE.ParametricGeometry = function ( func, slices, stacks ) { - - THREE.Geometry.call( this ); - - var verts = this.vertices; - var faces = this.faces; - var uvs = this.faceVertexUvs[ 0 ]; - - var i, il, j, p; - var u, v; - - var stackCount = stacks + 1; - var sliceCount = slices + 1; - - for ( i = 0; i <= stacks; i ++ ) { - - v = i / stacks; - - for ( j = 0; j <= slices; j ++ ) { - - u = j / slices; - - p = func( u, v ); - verts.push( p ); - - } - } - - var a, b, c, d; - var uva, uvb, uvc, uvd; - - for ( i = 0; i < stacks; i ++ ) { - - for ( j = 0; j < slices; j ++ ) { - - a = i * sliceCount + j; - b = i * sliceCount + j + 1; - c = (i + 1) * sliceCount + j + 1; - d = (i + 1) * sliceCount + j; - - uva = new THREE.Vector2( j / slices, i / stacks ); - uvb = new THREE.Vector2( ( j + 1 ) / slices, i / stacks ); - uvc = new THREE.Vector2( ( j + 1 ) / slices, ( i + 1 ) / stacks ); - uvd = new THREE.Vector2( j / slices, ( i + 1 ) / stacks ); - - faces.push( new THREE.Face3( a, b, d ) ); - uvs.push( [ uva, uvb, uvd ] ); - - faces.push( new THREE.Face3( b, c, d ) ); - uvs.push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - - } - - // console.log(this); - - // magic bullet - // var diff = this.mergeVertices(); - // console.log('removed ', diff, ' vertices by merging'); - - this.computeCentroids(); - this.computeFaceNormals(); - this.computeVertexNormals(); - -}; - -THREE.ParametricGeometry.prototype = Object.create( THREE.Geometry.prototype ); - -/** - * @author sroucheray / http://sroucheray.org/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.AxisHelper = function ( size ) { - - size = size || 1; - - var geometry = new THREE.Geometry(); - - geometry.vertices.push( - new THREE.Vector3(), new THREE.Vector3( size, 0, 0 ), - new THREE.Vector3(), new THREE.Vector3( 0, size, 0 ), - new THREE.Vector3(), new THREE.Vector3( 0, 0, size ) - ); - - geometry.colors.push( - new THREE.Color( 0xff0000 ), new THREE.Color( 0xffaa00 ), - new THREE.Color( 0x00ff00 ), new THREE.Color( 0xaaff00 ), - new THREE.Color( 0x0000ff ), new THREE.Color( 0x00aaff ) - ); - - var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } ); - - THREE.Line.call( this, geometry, material, THREE.LinePieces ); - -}; - -THREE.AxisHelper.prototype = Object.create( THREE.Line.prototype ); - -/** - * @author WestLangley / http://github.com/WestLangley - * @author zz85 / http://github.com/zz85 - * @author bhouston / http://exocortex.com - * - * Creates an arrow for visualizing directions - * - * Parameters: - * dir - Vector3 - * origin - Vector3 - * length - Number - * hex - color in hex value - * headLength - Number - * headWidth - Number - */ - -THREE.ArrowHelper = function ( dir, origin, length, hex, headLength, headWidth ) { - - // dir is assumed to be normalized - - THREE.Object3D.call( this ); - - if ( hex === undefined ) hex = 0xffff00; - if ( length === undefined ) length = 1; - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; - - this.position = origin; - - var lineGeometry = new THREE.Geometry(); - lineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ) ); - lineGeometry.vertices.push( new THREE.Vector3( 0, 1, 0 ) ); - - this.line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color: hex } ) ); - this.line.matrixAutoUpdate = false; - this.add( this.line ); - - var coneGeometry = new THREE.CylinderGeometry( 0, 0.5, 1, 5, 1 ); - coneGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 0.5, 0 ) ); - - this.cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color: hex } ) ); - this.cone.matrixAutoUpdate = false; - this.add( this.cone ); - - this.setDirection( dir ); - this.setLength( length, headLength, headWidth ); - -}; - -THREE.ArrowHelper.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.ArrowHelper.prototype.setDirection = function () { - - var axis = new THREE.Vector3(); - var radians; - - return function ( dir ) { - - // dir is assumed to be normalized - - if ( dir.y > 0.99999 ) { - - this.quaternion.set( 0, 0, 0, 1 ); - - } else if ( dir.y < - 0.99999 ) { - - this.quaternion.set( 1, 0, 0, 0 ); - - } else { - - axis.set( dir.z, 0, - dir.x ).normalize(); - - radians = Math.acos( dir.y ); - - this.quaternion.setFromAxisAngle( axis, radians ); - - } - - }; - -}(); - -THREE.ArrowHelper.prototype.setLength = function ( length, headLength, headWidth ) { - - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; - - this.line.scale.set( 1, length, 1 ); - this.line.updateMatrix(); - - this.cone.scale.set( headWidth, headLength, headWidth ); - this.cone.position.y = length; - this.cone.updateMatrix(); - -}; - -THREE.ArrowHelper.prototype.setColor = function ( hex ) { - - this.line.material.color.setHex( hex ); - this.cone.material.color.setHex( hex ); - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.BoxHelper = function ( object ) { - - // 5____4 - // 1/___0/| - // | 6__|_7 - // 2/___3/ - - var vertices = [ - new THREE.Vector3( 1, 1, 1 ), - new THREE.Vector3( - 1, 1, 1 ), - new THREE.Vector3( - 1, - 1, 1 ), - new THREE.Vector3( 1, - 1, 1 ), - - new THREE.Vector3( 1, 1, - 1 ), - new THREE.Vector3( - 1, 1, - 1 ), - new THREE.Vector3( - 1, - 1, - 1 ), - new THREE.Vector3( 1, - 1, - 1 ) - ]; - - this.vertices = vertices; - - // TODO: Wouldn't be nice if Line had .segments? - - var geometry = new THREE.Geometry(); - geometry.vertices.push( - vertices[ 0 ], vertices[ 1 ], - vertices[ 1 ], vertices[ 2 ], - vertices[ 2 ], vertices[ 3 ], - vertices[ 3 ], vertices[ 0 ], - - vertices[ 4 ], vertices[ 5 ], - vertices[ 5 ], vertices[ 6 ], - vertices[ 6 ], vertices[ 7 ], - vertices[ 7 ], vertices[ 4 ], - - vertices[ 0 ], vertices[ 4 ], - vertices[ 1 ], vertices[ 5 ], - vertices[ 2 ], vertices[ 6 ], - vertices[ 3 ], vertices[ 7 ] - ); - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ), THREE.LinePieces ); - - if ( object !== undefined ) { - - this.update( object ); - - } - -}; - -THREE.BoxHelper.prototype = Object.create( THREE.Line.prototype ); - -THREE.BoxHelper.prototype.update = function ( object ) { - - var geometry = object.geometry; - - if ( geometry.boundingBox === null ) { - - geometry.computeBoundingBox(); - - } - - var min = geometry.boundingBox.min; - var max = geometry.boundingBox.max; - var vertices = this.vertices; - - vertices[ 0 ].set( max.x, max.y, max.z ); - vertices[ 1 ].set( min.x, max.y, max.z ); - vertices[ 2 ].set( min.x, min.y, max.z ); - vertices[ 3 ].set( max.x, min.y, max.z ); - vertices[ 4 ].set( max.x, max.y, min.z ); - vertices[ 5 ].set( min.x, max.y, min.z ); - vertices[ 6 ].set( min.x, min.y, min.z ); - vertices[ 7 ].set( max.x, min.y, min.z ); - - this.geometry.computeBoundingSphere(); - this.geometry.verticesNeedUpdate = true; - - this.matrixAutoUpdate = false; - this.matrixWorld = object.matrixWorld; - -}; - -/** - * @author WestLangley / http://github.com/WestLangley - */ - -// a helper to show the world-axis-aligned bounding box for an object - -THREE.BoundingBoxHelper = function ( object, hex ) { - - var color = ( hex !== undefined ) ? hex : 0x888888; - - this.object = object; - - this.box = new THREE.Box3(); - - THREE.Mesh.call( this, new THREE.BoxGeometry( 1, 1, 1 ), new THREE.MeshBasicMaterial( { color: color, wireframe: true } ) ); - -}; - -THREE.BoundingBoxHelper.prototype = Object.create( THREE.Mesh.prototype ); - -THREE.BoundingBoxHelper.prototype.update = function () { - - this.box.setFromObject( this.object ); - - this.box.size( this.scale ); - - this.box.center( this.position ); - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * - * - shows frustum, line of sight and up of the camera - * - suitable for fast updates - * - based on frustum visualization in lightgl.js shadowmap example - * http://evanw.github.com/lightgl.js/tests/shadowmap.html - */ - -THREE.CameraHelper = function ( camera ) { - - var geometry = new THREE.Geometry(); - var material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } ); - - var pointMap = {}; - - // colors - - var hexFrustum = 0xffaa00; - var hexCone = 0xff0000; - var hexUp = 0x00aaff; - var hexTarget = 0xffffff; - var hexCross = 0x333333; - - // near - - addLine( "n1", "n2", hexFrustum ); - addLine( "n2", "n4", hexFrustum ); - addLine( "n4", "n3", hexFrustum ); - addLine( "n3", "n1", hexFrustum ); - - // far - - addLine( "f1", "f2", hexFrustum ); - addLine( "f2", "f4", hexFrustum ); - addLine( "f4", "f3", hexFrustum ); - addLine( "f3", "f1", hexFrustum ); - - // sides - - addLine( "n1", "f1", hexFrustum ); - addLine( "n2", "f2", hexFrustum ); - addLine( "n3", "f3", hexFrustum ); - addLine( "n4", "f4", hexFrustum ); - - // cone - - addLine( "p", "n1", hexCone ); - addLine( "p", "n2", hexCone ); - addLine( "p", "n3", hexCone ); - addLine( "p", "n4", hexCone ); - - // up - - addLine( "u1", "u2", hexUp ); - addLine( "u2", "u3", hexUp ); - addLine( "u3", "u1", hexUp ); - - // target - - addLine( "c", "t", hexTarget ); - addLine( "p", "c", hexCross ); - - // cross - - addLine( "cn1", "cn2", hexCross ); - addLine( "cn3", "cn4", hexCross ); - - addLine( "cf1", "cf2", hexCross ); - addLine( "cf3", "cf4", hexCross ); - - function addLine( a, b, hex ) { - - addPoint( a, hex ); - addPoint( b, hex ); - - } - - function addPoint( id, hex ) { - - geometry.vertices.push( new THREE.Vector3() ); - geometry.colors.push( new THREE.Color( hex ) ); - - if ( pointMap[ id ] === undefined ) { - - pointMap[ id ] = []; - - } - - pointMap[ id ].push( geometry.vertices.length - 1 ); - - } - - THREE.Line.call( this, geometry, material, THREE.LinePieces ); - - this.camera = camera; - this.matrixWorld = camera.matrixWorld; - this.matrixAutoUpdate = false; - - this.pointMap = pointMap; - - this.update(); - -}; - -THREE.CameraHelper.prototype = Object.create( THREE.Line.prototype ); - -THREE.CameraHelper.prototype.update = function () { - - var vector = new THREE.Vector3(); - var camera = new THREE.Camera(); - var projector = new THREE.Projector(); - - return function () { - - var scope = this; - - var w = 1, h = 1; - - // we need just camera projection matrix - // world matrix must be identity - - camera.projectionMatrix.copy( this.camera.projectionMatrix ); - - // center / target - - setPoint( "c", 0, 0, -1 ); - setPoint( "t", 0, 0, 1 ); - - // near - - setPoint( "n1", -w, -h, -1 ); - setPoint( "n2", w, -h, -1 ); - setPoint( "n3", -w, h, -1 ); - setPoint( "n4", w, h, -1 ); - - // far - - setPoint( "f1", -w, -h, 1 ); - setPoint( "f2", w, -h, 1 ); - setPoint( "f3", -w, h, 1 ); - setPoint( "f4", w, h, 1 ); - - // up - - setPoint( "u1", w * 0.7, h * 1.1, -1 ); - setPoint( "u2", -w * 0.7, h * 1.1, -1 ); - setPoint( "u3", 0, h * 2, -1 ); - - // cross - - setPoint( "cf1", -w, 0, 1 ); - setPoint( "cf2", w, 0, 1 ); - setPoint( "cf3", 0, -h, 1 ); - setPoint( "cf4", 0, h, 1 ); - - setPoint( "cn1", -w, 0, -1 ); - setPoint( "cn2", w, 0, -1 ); - setPoint( "cn3", 0, -h, -1 ); - setPoint( "cn4", 0, h, -1 ); - - function setPoint( point, x, y, z ) { - - vector.set( x, y, z ); - projector.unprojectVector( vector, camera ); - - var points = scope.pointMap[ point ]; - - if ( points !== undefined ) { - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - scope.geometry.vertices[ points[ i ] ].copy( vector ); - - } - - } - - } - - this.geometry.verticesNeedUpdate = true; - - }; - -}(); - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.DirectionalLightHelper = function ( light, size ) { - - THREE.Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrixWorld = light.matrixWorld; - this.matrixAutoUpdate = false; - - size = size || 1; - var geometry = new THREE.PlaneGeometry( size, size ); - var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - this.lightPlane = new THREE.Mesh( geometry, material ); - this.add( this.lightPlane ); - - geometry = new THREE.Geometry(); - geometry.vertices.push( new THREE.Vector3() ); - geometry.vertices.push( new THREE.Vector3() ); - - material = new THREE.LineBasicMaterial( { fog: false } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - this.targetLine = new THREE.Line( geometry, material ); - this.add( this.targetLine ); - - this.update(); - -}; - -THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.DirectionalLightHelper.prototype.dispose = function () { - - this.lightPlane.geometry.dispose(); - this.lightPlane.material.dispose(); - this.targetLine.geometry.dispose(); - this.targetLine.material.dispose(); -}; - -THREE.DirectionalLightHelper.prototype.update = function () { - - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - var v3 = new THREE.Vector3(); - - return function () { - - v1.setFromMatrixPosition( this.light.matrixWorld ); - v2.setFromMatrixPosition( this.light.target.matrixWorld ); - v3.subVectors( v2, v1 ); - - this.lightPlane.lookAt( v3 ); - this.lightPlane.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - this.targetLine.geometry.vertices[ 1 ].copy( v3 ); - this.targetLine.geometry.verticesNeedUpdate = true; - this.targetLine.material.color.copy( this.lightPlane.material.color ); - - } - -}(); - - -/** - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.EdgesHelper = function ( object, hex ) { - - var color = ( hex !== undefined ) ? hex : 0xffffff; - - var edge = [ 0, 0 ], hash = {}; - var sortFunction = function ( a, b ) { return a - b }; - - var keys = [ 'a', 'b', 'c' ]; - var geometry = new THREE.BufferGeometry(); - - var geometry2 = object.geometry.clone(); - - geometry2.mergeVertices(); - geometry2.computeFaceNormals(); - - var vertices = geometry2.vertices; - var faces = geometry2.faces; - var numEdges = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = face[ keys[ j ] ]; - edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - hash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined }; - numEdges ++; - - } else { - - hash[ key ].face2 = i; - - } - - } - - } - - geometry.addAttribute( 'position', Float32Array, 2 * numEdges, 3 ); - - var coords = geometry.attributes.position.array; - - var index = 0; - - for ( var key in hash ) { - - var h = hash[ key ]; - - if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) < 0.9999 ) { // hardwired const OK - - var vertex = vertices[ h.vert1 ]; - coords[ index ++ ] = vertex.x; - coords[ index ++ ] = vertex.y; - coords[ index ++ ] = vertex.z; - - vertex = vertices[ h.vert2 ]; - coords[ index ++ ] = vertex.x; - coords[ index ++ ] = vertex.y; - coords[ index ++ ] = vertex.z; - - } - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color } ), THREE.LinePieces ); - - this.matrixAutoUpdate = false; - this.matrixWorld = object.matrixWorld; - -}; - -THREE.EdgesHelper.prototype = Object.create( THREE.Line.prototype ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.FaceNormalsHelper = function ( object, size, hex, linewidth ) { - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0xffff00; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - var geometry = new THREE.Geometry(); - - var faces = this.object.geometry.faces; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - geometry.vertices.push( new THREE.Vector3() ); - geometry.vertices.push( new THREE.Vector3() ); - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); - - this.matrixAutoUpdate = false; - - this.normalMatrix = new THREE.Matrix3(); - - this.update(); - -}; - -THREE.FaceNormalsHelper.prototype = Object.create( THREE.Line.prototype ); - -THREE.FaceNormalsHelper.prototype.update = ( function ( object ) { - - var v1 = new THREE.Vector3(); - - return function ( object ) { - - this.object.updateMatrixWorld( true ); - - this.normalMatrix.getNormalMatrix( this.object.matrixWorld ); - - var vertices = this.geometry.vertices; - - var faces = this.object.geometry.faces; - - var worldMatrix = this.object.matrixWorld; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - v1.copy( face.normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size ); - - var idx = 2 * i; - - vertices[ idx ].copy( face.centroid ).applyMatrix4( worldMatrix ); - - vertices[ idx + 1 ].addVectors( vertices[ idx ], v1 ); - - } - - this.geometry.verticesNeedUpdate = true; - - return this; - - } - -}()); - - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.GridHelper = function ( size, step ) { - - var geometry = new THREE.Geometry(); - var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } ); - - this.color1 = new THREE.Color( 0x444444 ); - this.color2 = new THREE.Color( 0x888888 ); - - for ( var i = - size; i <= size; i += step ) { - - geometry.vertices.push( - new THREE.Vector3( - size, 0, i ), new THREE.Vector3( size, 0, i ), - new THREE.Vector3( i, 0, - size ), new THREE.Vector3( i, 0, size ) - ); - - var color = i === 0 ? this.color1 : this.color2; - - geometry.colors.push( color, color, color, color ); - - } - - THREE.Line.call( this, geometry, material, THREE.LinePieces ); - -}; - -THREE.GridHelper.prototype = Object.create( THREE.Line.prototype ); - -THREE.GridHelper.prototype.setColors = function( colorCenterLine, colorGrid ) { - - this.color1.set( colorCenterLine ); - this.color2.set( colorGrid ); - - this.geometry.colorsNeedUpdate = true; - -} - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.HemisphereLightHelper = function ( light, sphereSize, arrowLength, domeSize ) { - - THREE.Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrixWorld = light.matrixWorld; - this.matrixAutoUpdate = false; - - this.colors = [ new THREE.Color(), new THREE.Color() ]; - - var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 ); - geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) ); - - for ( var i = 0, il = 8; i < il; i ++ ) { - - geometry.faces[ i ].color = this.colors[ i < 4 ? 0 : 1 ]; - - } - - var material = new THREE.MeshBasicMaterial( { vertexColors: THREE.FaceColors, wireframe: true } ); - - this.lightSphere = new THREE.Mesh( geometry, material ); - this.add( this.lightSphere ); - - this.update(); - -}; - -THREE.HemisphereLightHelper.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.HemisphereLightHelper.prototype.dispose = function () { - this.lightSphere.geometry.dispose(); - this.lightSphere.material.dispose(); -}; - -THREE.HemisphereLightHelper.prototype.update = function () { - - var vector = new THREE.Vector3(); - - return function () { - - this.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity ); - this.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity ); - - this.lightSphere.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() ); - this.lightSphere.geometry.colorsNeedUpdate = true; - - } - -}(); - - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.PointLightHelper = function ( light, sphereSize ) { - - this.light = light; - this.light.updateMatrixWorld(); - - var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 ); - var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - THREE.Mesh.call( this, geometry, material ); - - this.matrixWorld = this.light.matrixWorld; - this.matrixAutoUpdate = false; - - /* - var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 ); - var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } ); - - this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); - this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial ); - - var d = light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.scale.set( d, d, d ); - - } - - this.add( this.lightDistance ); - */ - -}; - -THREE.PointLightHelper.prototype = Object.create( THREE.Mesh.prototype ); - -THREE.PointLightHelper.prototype.dispose = function () { - - this.geometry.dispose(); - this.material.dispose(); -}; - -THREE.PointLightHelper.prototype.update = function () { - - this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - /* - var d = this.light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.visible = true; - this.lightDistance.scale.set( d, d, d ); - - } - */ - -}; - - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.SpotLightHelper = function ( light ) { - - THREE.Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrixWorld = light.matrixWorld; - this.matrixAutoUpdate = false; - - var geometry = new THREE.CylinderGeometry( 0, 1, 1, 8, 1, true ); - - geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, -0.5, 0 ) ); - geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) ); - - var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } ); - - this.cone = new THREE.Mesh( geometry, material ); - this.add( this.cone ); - - this.update(); - -}; - -THREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype ); - -THREE.SpotLightHelper.prototype.dispose = function () { - this.cone.geometry.dispose(); - this.cone.material.dispose(); -}; - -THREE.SpotLightHelper.prototype.update = function () { - - var vector = new THREE.Vector3(); - var vector2 = new THREE.Vector3(); - - return function () { - - var coneLength = this.light.distance ? this.light.distance : 10000; - var coneWidth = coneLength * Math.tan( this.light.angle ); - - this.cone.scale.set( coneWidth, coneWidth, coneLength ); - - vector.setFromMatrixPosition( this.light.matrixWorld ); - vector2.setFromMatrixPosition( this.light.target.matrixWorld ); - - this.cone.lookAt( vector2.sub( vector ) ); - - this.cone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - }; - -}(); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) { - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0xff0000; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - var geometry = new THREE.Geometry(); - - var vertices = object.geometry.vertices; - - var faces = object.geometry.faces; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - geometry.vertices.push( new THREE.Vector3() ); - geometry.vertices.push( new THREE.Vector3() ); - - } - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); - - this.matrixAutoUpdate = false; - - this.normalMatrix = new THREE.Matrix3(); - - this.update(); - -}; - -THREE.VertexNormalsHelper.prototype = Object.create( THREE.Line.prototype ); - -THREE.VertexNormalsHelper.prototype.update = ( function ( object ) { - - var v1 = new THREE.Vector3(); - - return function( object ) { - - var keys = [ 'a', 'b', 'c', 'd' ]; - - this.object.updateMatrixWorld( true ); - - this.normalMatrix.getNormalMatrix( this.object.matrixWorld ); - - var vertices = this.geometry.vertices; - - var verts = this.object.geometry.vertices; - - var faces = this.object.geometry.faces; - - var worldMatrix = this.object.matrixWorld; - - var idx = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - var vertexId = face[ keys[ j ] ]; - var vertex = verts[ vertexId ]; - - var normal = face.vertexNormals[ j ]; - - vertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix ); - - v1.copy( normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size ); - - v1.add( vertices[ idx ] ); - idx = idx + 1; - - vertices[ idx ].copy( v1 ); - idx = idx + 1; - - } - - } - - this.geometry.verticesNeedUpdate = true; - - return this; - - } - -}()); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.VertexTangentsHelper = function ( object, size, hex, linewidth ) { - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0x0000ff; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - var geometry = new THREE.Geometry(); - - var vertices = object.geometry.vertices; - - var faces = object.geometry.faces; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) { - - geometry.vertices.push( new THREE.Vector3() ); - geometry.vertices.push( new THREE.Vector3() ); - - } - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); - - this.matrixAutoUpdate = false; - - this.update(); - -}; - -THREE.VertexTangentsHelper.prototype = Object.create( THREE.Line.prototype ); - -THREE.VertexTangentsHelper.prototype.update = ( function ( object ) { - - var v1 = new THREE.Vector3(); - - return function( object ) { - - var keys = [ 'a', 'b', 'c', 'd' ]; - - this.object.updateMatrixWorld( true ); - - var vertices = this.geometry.vertices; - - var verts = this.object.geometry.vertices; - - var faces = this.object.geometry.faces; - - var worldMatrix = this.object.matrixWorld; - - var idx = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) { - - var vertexId = face[ keys[ j ] ]; - var vertex = verts[ vertexId ]; - - var tangent = face.vertexTangents[ j ]; - - vertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix ); - - v1.copy( tangent ).transformDirection( worldMatrix ).multiplyScalar( this.size ); - - v1.add( vertices[ idx ] ); - idx = idx + 1; - - vertices[ idx ].copy( v1 ); - idx = idx + 1; - - } - - } - - this.geometry.verticesNeedUpdate = true; - - return this; - - } - -}()); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.WireframeHelper = function ( object, hex ) { - - var color = ( hex !== undefined ) ? hex : 0xffffff; - - var edge = [ 0, 0 ], hash = {}; - var sortFunction = function ( a, b ) { return a - b }; - - var keys = [ 'a', 'b', 'c' ]; - var geometry = new THREE.BufferGeometry(); - - if ( object.geometry instanceof THREE.Geometry ) { - - var vertices = object.geometry.vertices; - var faces = object.geometry.faces; - var numEdges = 0; - - // allocate maximal size - var edges = new Uint32Array( 6 * faces.length ); - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = face[ keys[ j ] ]; - edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - edges[ 2 * numEdges ] = edge[ 0 ]; - edges[ 2 * numEdges + 1 ] = edge[ 1 ]; - hash[ key ] = true; - numEdges ++; - - } - - } - - } - - geometry.addAttribute( 'position', Float32Array, 2 * numEdges, 3 ); - - var coords = geometry.attributes.position.array; - - for ( var i = 0, l = numEdges; i < l; i ++ ) { - - for ( var j = 0; j < 2; j ++ ) { - - var vertex = vertices[ edges [ 2 * i + j] ]; - - var index = 6 * i + 3 * j; - coords[ index + 0 ] = vertex.x; - coords[ index + 1 ] = vertex.y; - coords[ index + 2 ] = vertex.z; - - } - - } - - } else if ( object.geometry instanceof THREE.BufferGeometry && object.geometry.attributes.index !== undefined ) { // indexed BufferGeometry - - var vertices = object.geometry.attributes.position.array; - var indices = object.geometry.attributes.index.array; - var offsets = object.geometry.offsets; - var numEdges = 0; - - // allocate maximal size - var edges = new Uint32Array( 2 * indices.length ); - - for ( var o = 0, ol = offsets.length; o < ol; ++ o ) { - - var start = offsets[ o ].start; - var count = offsets[ o ].count; - var index = offsets[ o ].index; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = index + indices[ i + j ]; - edge[ 1 ] = index + indices[ i + ( j + 1 ) % 3 ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - edges[ 2 * numEdges ] = edge[ 0 ]; - edges[ 2 * numEdges + 1 ] = edge[ 1 ]; - hash[ key ] = true; - numEdges ++; - - } - - } - - } - - } - - geometry.addAttribute( 'position', Float32Array, 2 * numEdges, 3 ); - - var coords = geometry.attributes.position.array; - - for ( var i = 0, l = numEdges; i < l; i ++ ) { - - for ( var j = 0; j < 2; j ++ ) { - - var index = 6 * i + 3 * j; - var index2 = 3 * edges[ 2 * i + j]; - coords[ index + 0 ] = vertices[ index2 ]; - coords[ index + 1 ] = vertices[ index2 + 1 ]; - coords[ index + 2 ] = vertices[ index2 + 2 ]; - - } - - } - - } else if ( object.geometry instanceof THREE.BufferGeometry ) { // non-indexed BufferGeometry - - var vertices = object.geometry.attributes.position.array; - var numEdges = vertices.length / 3; - var numTris = numEdges / 3; - - geometry.addAttribute( 'position', Float32Array, 2 * numEdges, 3 ); - - var coords = geometry.attributes.position.array; - - for ( var i = 0, l = numTris; i < l; i ++ ) { - - for ( var j = 0; j < 3; j ++ ) { - - var index = 18 * i + 6 * j; - - var index1 = 9 * i + 3 * j; - coords[ index + 0 ] = vertices[ index1 ]; - coords[ index + 1 ] = vertices[ index1 + 1 ]; - coords[ index + 2 ] = vertices[ index1 + 2 ]; - - var index2 = 9 * i + 3 * ( ( j + 1 ) % 3 ); - coords[ index + 3 ] = vertices[ index2 ]; - coords[ index + 4 ] = vertices[ index2 + 1 ]; - coords[ index + 5 ] = vertices[ index2 + 2 ]; - - } - - } - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color } ), THREE.LinePieces ); - - this.matrixAutoUpdate = false; - this.matrixWorld = object.matrixWorld; - -}; - -THREE.WireframeHelper.prototype = Object.create( THREE.Line.prototype ); - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.ImmediateRenderObject = function () { - - THREE.Object3D.call( this ); - - this.render = function ( renderCallback ) { }; - -}; - -THREE.ImmediateRenderObject.prototype = Object.create( THREE.Object3D.prototype ); - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.LensFlare = function ( texture, size, distance, blending, color ) { - - THREE.Object3D.call( this ); - - this.lensFlares = []; - - this.positionScreen = new THREE.Vector3(); - this.customUpdateCallback = undefined; - - if( texture !== undefined ) { - - this.add( texture, size, distance, blending, color ); - - } - -}; - -THREE.LensFlare.prototype = Object.create( THREE.Object3D.prototype ); - - -/* - * Add: adds another flare - */ - -THREE.LensFlare.prototype.add = function ( texture, size, distance, blending, color, opacity ) { - - if( size === undefined ) size = -1; - if( distance === undefined ) distance = 0; - if( opacity === undefined ) opacity = 1; - if( color === undefined ) color = new THREE.Color( 0xffffff ); - if( blending === undefined ) blending = THREE.NormalBlending; - - distance = Math.min( distance, Math.max( 0, distance ) ); - - this.lensFlares.push( { texture: texture, // THREE.Texture - size: size, // size in pixels (-1 = use texture.width) - distance: distance, // distance (0-1) from light source (0=at light source) - x: 0, y: 0, z: 0, // screen position (-1 => 1) z = 0 is ontop z = 1 is back - scale: 1, // scale - rotation: 1, // rotation - opacity: opacity, // opacity - color: color, // color - blending: blending } ); // blending - -}; - - -/* - * Update lens flares update positions on all flares based on the screen position - * Set myLensFlare.customUpdateCallback to alter the flares in your project specific way. - */ - -THREE.LensFlare.prototype.updateLensFlares = function () { - - var f, fl = this.lensFlares.length; - var flare; - var vecX = -this.positionScreen.x * 2; - var vecY = -this.positionScreen.y * 2; - - for( f = 0; f < fl; f ++ ) { - - flare = this.lensFlares[ f ]; - - flare.x = this.positionScreen.x + vecX * flare.distance; - flare.y = this.positionScreen.y + vecY * flare.distance; - - flare.wantedRotation = flare.x * Math.PI * 0.25; - flare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25; - - } - -}; - - - - - - - - - - - - - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.MorphBlendMesh = function( geometry, material ) { - - THREE.Mesh.call( this, geometry, material ); - - this.animationsMap = {}; - this.animationsList = []; - - // prepare default animation - // (all frames played together in 1 second) - - var numFrames = this.geometry.morphTargets.length; - - var name = "__default"; - - var startFrame = 0; - var endFrame = numFrames - 1; - - var fps = numFrames / 1; - - this.createAnimation( name, startFrame, endFrame, fps ); - this.setAnimationWeight( name, 1 ); - -}; - -THREE.MorphBlendMesh.prototype = Object.create( THREE.Mesh.prototype ); - -THREE.MorphBlendMesh.prototype.createAnimation = function ( name, start, end, fps ) { - - var animation = { - - startFrame: start, - endFrame: end, - - length: end - start + 1, - - fps: fps, - duration: ( end - start ) / fps, - - lastFrame: 0, - currentFrame: 0, - - active: false, - - time: 0, - direction: 1, - weight: 1, - - directionBackwards: false, - mirroredLoop: false - - }; - - this.animationsMap[ name ] = animation; - this.animationsList.push( animation ); - -}; - -THREE.MorphBlendMesh.prototype.autoCreateAnimations = function ( fps ) { - - var pattern = /([a-z]+)(\d+)/; - - var firstAnimation, frameRanges = {}; - - var geometry = this.geometry; - - for ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) { - - var morph = geometry.morphTargets[ i ]; - var chunks = morph.name.match( pattern ); - - if ( chunks && chunks.length > 1 ) { - - var name = chunks[ 1 ]; - var num = chunks[ 2 ]; - - if ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: -Infinity }; - - var range = frameRanges[ name ]; - - if ( i < range.start ) range.start = i; - if ( i > range.end ) range.end = i; - - if ( ! firstAnimation ) firstAnimation = name; - - } - - } - - for ( var name in frameRanges ) { - - var range = frameRanges[ name ]; - this.createAnimation( name, range.start, range.end, fps ); - - } - - this.firstAnimation = firstAnimation; - -}; - -THREE.MorphBlendMesh.prototype.setAnimationDirectionForward = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = 1; - animation.directionBackwards = false; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = -1; - animation.directionBackwards = true; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationFPS = function ( name, fps ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.fps = fps; - animation.duration = ( animation.end - animation.start ) / animation.fps; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationDuration = function ( name, duration ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.duration = duration; - animation.fps = ( animation.end - animation.start ) / animation.duration; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationWeight = function ( name, weight ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.weight = weight; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationTime = function ( name, time ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = time; - - } - -}; - -THREE.MorphBlendMesh.prototype.getAnimationTime = function ( name ) { - - var time = 0; - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - time = animation.time; - - } - - return time; - -}; - -THREE.MorphBlendMesh.prototype.getAnimationDuration = function ( name ) { - - var duration = -1; - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - duration = animation.duration; - - } - - return duration; - -}; - -THREE.MorphBlendMesh.prototype.playAnimation = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = 0; - animation.active = true; - - } else { - - console.warn( "animation[" + name + "] undefined" ); - - } - -}; - -THREE.MorphBlendMesh.prototype.stopAnimation = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.active = false; - - } - -}; - -THREE.MorphBlendMesh.prototype.update = function ( delta ) { - - for ( var i = 0, il = this.animationsList.length; i < il; i ++ ) { - - var animation = this.animationsList[ i ]; - - if ( ! animation.active ) continue; - - var frameTime = animation.duration / animation.length; - - animation.time += animation.direction * delta; - - if ( animation.mirroredLoop ) { - - if ( animation.time > animation.duration || animation.time < 0 ) { - - animation.direction *= -1; - - if ( animation.time > animation.duration ) { - - animation.time = animation.duration; - animation.directionBackwards = true; - - } - - if ( animation.time < 0 ) { - - animation.time = 0; - animation.directionBackwards = false; - - } - - } - - } else { - - animation.time = animation.time % animation.duration; - - if ( animation.time < 0 ) animation.time += animation.duration; - - } - - var keyframe = animation.startFrame + THREE.Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 ); - var weight = animation.weight; - - if ( keyframe !== animation.currentFrame ) { - - this.morphTargetInfluences[ animation.lastFrame ] = 0; - this.morphTargetInfluences[ animation.currentFrame ] = 1 * weight; - - this.morphTargetInfluences[ keyframe ] = 0; - - animation.lastFrame = animation.currentFrame; - animation.currentFrame = keyframe; - - } - - var mix = ( animation.time % frameTime ) / frameTime; - - if ( animation.directionBackwards ) mix = 1 - mix; - - this.morphTargetInfluences[ animation.currentFrame ] = mix * weight; - this.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight; - - } - -}; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.LensFlarePlugin = function () { - - var _gl, _renderer, _precision, _lensFlare = {}; - - this.init = function ( renderer ) { - - _gl = renderer.context; - _renderer = renderer; - - _precision = renderer.getPrecision(); - - _lensFlare.vertices = new Float32Array( 8 + 8 ); - _lensFlare.faces = new Uint16Array( 6 ); - - var i = 0; - _lensFlare.vertices[ i++ ] = -1; _lensFlare.vertices[ i++ ] = -1; // vertex - _lensFlare.vertices[ i++ ] = 0; _lensFlare.vertices[ i++ ] = 0; // uv... etc. - - _lensFlare.vertices[ i++ ] = 1; _lensFlare.vertices[ i++ ] = -1; - _lensFlare.vertices[ i++ ] = 1; _lensFlare.vertices[ i++ ] = 0; - - _lensFlare.vertices[ i++ ] = 1; _lensFlare.vertices[ i++ ] = 1; - _lensFlare.vertices[ i++ ] = 1; _lensFlare.vertices[ i++ ] = 1; - - _lensFlare.vertices[ i++ ] = -1; _lensFlare.vertices[ i++ ] = 1; - _lensFlare.vertices[ i++ ] = 0; _lensFlare.vertices[ i++ ] = 1; - - i = 0; - _lensFlare.faces[ i++ ] = 0; _lensFlare.faces[ i++ ] = 1; _lensFlare.faces[ i++ ] = 2; - _lensFlare.faces[ i++ ] = 0; _lensFlare.faces[ i++ ] = 2; _lensFlare.faces[ i++ ] = 3; - - // buffers - - _lensFlare.vertexBuffer = _gl.createBuffer(); - _lensFlare.elementBuffer = _gl.createBuffer(); - - _gl.bindBuffer( _gl.ARRAY_BUFFER, _lensFlare.vertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, _lensFlare.vertices, _gl.STATIC_DRAW ); - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _lensFlare.elementBuffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, _lensFlare.faces, _gl.STATIC_DRAW ); - - // textures - - _lensFlare.tempTexture = _gl.createTexture(); - _lensFlare.occlusionTexture = _gl.createTexture(); - - _gl.bindTexture( _gl.TEXTURE_2D, _lensFlare.tempTexture ); - _gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGB, 16, 16, 0, _gl.RGB, _gl.UNSIGNED_BYTE, null ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, _gl.NEAREST ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.NEAREST ); - - _gl.bindTexture( _gl.TEXTURE_2D, _lensFlare.occlusionTexture ); - _gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, 16, 16, 0, _gl.RGBA, _gl.UNSIGNED_BYTE, null ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, _gl.NEAREST ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.NEAREST ); - - if ( _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ) <= 0 ) { - - _lensFlare.hasVertexTexture = false; - _lensFlare.program = createProgram( THREE.ShaderFlares[ "lensFlare" ], _precision ); - - } else { - - _lensFlare.hasVertexTexture = true; - _lensFlare.program = createProgram( THREE.ShaderFlares[ "lensFlareVertexTexture" ], _precision ); - - } - - _lensFlare.attributes = {}; - _lensFlare.uniforms = {}; - - _lensFlare.attributes.vertex = _gl.getAttribLocation ( _lensFlare.program, "position" ); - _lensFlare.attributes.uv = _gl.getAttribLocation ( _lensFlare.program, "uv" ); - - _lensFlare.uniforms.renderType = _gl.getUniformLocation( _lensFlare.program, "renderType" ); - _lensFlare.uniforms.map = _gl.getUniformLocation( _lensFlare.program, "map" ); - _lensFlare.uniforms.occlusionMap = _gl.getUniformLocation( _lensFlare.program, "occlusionMap" ); - _lensFlare.uniforms.opacity = _gl.getUniformLocation( _lensFlare.program, "opacity" ); - _lensFlare.uniforms.color = _gl.getUniformLocation( _lensFlare.program, "color" ); - _lensFlare.uniforms.scale = _gl.getUniformLocation( _lensFlare.program, "scale" ); - _lensFlare.uniforms.rotation = _gl.getUniformLocation( _lensFlare.program, "rotation" ); - _lensFlare.uniforms.screenPosition = _gl.getUniformLocation( _lensFlare.program, "screenPosition" ); - - }; - - - /* - * Render lens flares - * Method: renders 16x16 0xff00ff-colored points scattered over the light source area, - * reads these back and calculates occlusion. - * Then _lensFlare.update_lensFlares() is called to re-position and - * update transparency of flares. Then they are rendered. - * - */ - - this.render = function ( scene, camera, viewportWidth, viewportHeight ) { - - var flares = scene.__webglFlares, - nFlares = flares.length; - - if ( ! nFlares ) return; - - var tempPosition = new THREE.Vector3(); - - var invAspect = viewportHeight / viewportWidth, - halfViewportWidth = viewportWidth * 0.5, - halfViewportHeight = viewportHeight * 0.5; - - var size = 16 / viewportHeight, - scale = new THREE.Vector2( size * invAspect, size ); - - var screenPosition = new THREE.Vector3( 1, 1, 0 ), - screenPositionPixels = new THREE.Vector2( 1, 1 ); - - var uniforms = _lensFlare.uniforms, - attributes = _lensFlare.attributes; - - // set _lensFlare program and reset blending - - _gl.useProgram( _lensFlare.program ); - - _gl.enableVertexAttribArray( _lensFlare.attributes.vertex ); - _gl.enableVertexAttribArray( _lensFlare.attributes.uv ); - - // loop through all lens flares to update their occlusion and positions - // setup gl and common used attribs/unforms - - _gl.uniform1i( uniforms.occlusionMap, 0 ); - _gl.uniform1i( uniforms.map, 1 ); - - _gl.bindBuffer( _gl.ARRAY_BUFFER, _lensFlare.vertexBuffer ); - _gl.vertexAttribPointer( attributes.vertex, 2, _gl.FLOAT, false, 2 * 8, 0 ); - _gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 2 * 8, 8 ); - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _lensFlare.elementBuffer ); - - _gl.disable( _gl.CULL_FACE ); - _gl.depthMask( false ); - - var i, j, jl, flare, sprite; - - for ( i = 0; i < nFlares; i ++ ) { - - size = 16 / viewportHeight; - scale.set( size * invAspect, size ); - - // calc object screen position - - flare = flares[ i ]; - - tempPosition.set( flare.matrixWorld.elements[12], flare.matrixWorld.elements[13], flare.matrixWorld.elements[14] ); - - tempPosition.applyMatrix4( camera.matrixWorldInverse ); - tempPosition.applyProjection( camera.projectionMatrix ); - - // setup arrays for gl programs - - screenPosition.copy( tempPosition ) - - screenPositionPixels.x = screenPosition.x * halfViewportWidth + halfViewportWidth; - screenPositionPixels.y = screenPosition.y * halfViewportHeight + halfViewportHeight; - - // screen cull - - if ( _lensFlare.hasVertexTexture || ( - screenPositionPixels.x > 0 && - screenPositionPixels.x < viewportWidth && - screenPositionPixels.y > 0 && - screenPositionPixels.y < viewportHeight ) ) { - - // save current RGB to temp texture - - _gl.activeTexture( _gl.TEXTURE1 ); - _gl.bindTexture( _gl.TEXTURE_2D, _lensFlare.tempTexture ); - _gl.copyTexImage2D( _gl.TEXTURE_2D, 0, _gl.RGB, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 ); - - - // render pink quad - - _gl.uniform1i( uniforms.renderType, 0 ); - _gl.uniform2f( uniforms.scale, scale.x, scale.y ); - _gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z ); - - _gl.disable( _gl.BLEND ); - _gl.enable( _gl.DEPTH_TEST ); - - _gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 ); - - - // copy result to occlusionMap - - _gl.activeTexture( _gl.TEXTURE0 ); - _gl.bindTexture( _gl.TEXTURE_2D, _lensFlare.occlusionTexture ); - _gl.copyTexImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 ); - - - // restore graphics - - _gl.uniform1i( uniforms.renderType, 1 ); - _gl.disable( _gl.DEPTH_TEST ); - - _gl.activeTexture( _gl.TEXTURE1 ); - _gl.bindTexture( _gl.TEXTURE_2D, _lensFlare.tempTexture ); - _gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 ); - - - // update object positions - - flare.positionScreen.copy( screenPosition ) - - if ( flare.customUpdateCallback ) { - - flare.customUpdateCallback( flare ); - - } else { - - flare.updateLensFlares(); - - } - - // render flares - - _gl.uniform1i( uniforms.renderType, 2 ); - _gl.enable( _gl.BLEND ); - - for ( j = 0, jl = flare.lensFlares.length; j < jl; j ++ ) { - - sprite = flare.lensFlares[ j ]; - - if ( sprite.opacity > 0.001 && sprite.scale > 0.001 ) { - - screenPosition.x = sprite.x; - screenPosition.y = sprite.y; - screenPosition.z = sprite.z; - - size = sprite.size * sprite.scale / viewportHeight; - - scale.x = size * invAspect; - scale.y = size; - - _gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z ); - _gl.uniform2f( uniforms.scale, scale.x, scale.y ); - _gl.uniform1f( uniforms.rotation, sprite.rotation ); - - _gl.uniform1f( uniforms.opacity, sprite.opacity ); - _gl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b ); - - _renderer.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst ); - _renderer.setTexture( sprite.texture, 1 ); - - _gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 ); - - } - - } - - } - - } - - // restore gl - - _gl.enable( _gl.CULL_FACE ); - _gl.enable( _gl.DEPTH_TEST ); - _gl.depthMask( true ); - - }; - - function createProgram ( shader, precision ) { - - var program = _gl.createProgram(); - - var fragmentShader = _gl.createShader( _gl.FRAGMENT_SHADER ); - var vertexShader = _gl.createShader( _gl.VERTEX_SHADER ); - - var prefix = "precision " + precision + " float;\n"; - - _gl.shaderSource( fragmentShader, prefix + shader.fragmentShader ); - _gl.shaderSource( vertexShader, prefix + shader.vertexShader ); - - _gl.compileShader( fragmentShader ); - _gl.compileShader( vertexShader ); - - _gl.attachShader( program, fragmentShader ); - _gl.attachShader( program, vertexShader ); - - _gl.linkProgram( program ); - - return program; - - }; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.ShadowMapPlugin = function () { - - var _gl, - _renderer, - _depthMaterial, _depthMaterialMorph, _depthMaterialSkin, _depthMaterialMorphSkin, - - _frustum = new THREE.Frustum(), - _projScreenMatrix = new THREE.Matrix4(), - - _min = new THREE.Vector3(), - _max = new THREE.Vector3(), - - _matrixPosition = new THREE.Vector3(); - - this.init = function ( renderer ) { - - _gl = renderer.context; - _renderer = renderer; - - var depthShader = THREE.ShaderLib[ "depthRGBA" ]; - var depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms ); - - _depthMaterial = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms } ); - _depthMaterialMorph = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, morphTargets: true } ); - _depthMaterialSkin = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, skinning: true } ); - _depthMaterialMorphSkin = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, morphTargets: true, skinning: true } ); - - _depthMaterial._shadowPass = true; - _depthMaterialMorph._shadowPass = true; - _depthMaterialSkin._shadowPass = true; - _depthMaterialMorphSkin._shadowPass = true; - - }; - - this.render = function ( scene, camera ) { - - if ( ! ( _renderer.shadowMapEnabled && _renderer.shadowMapAutoUpdate ) ) return; - - this.update( scene, camera ); - - }; - - this.update = function ( scene, camera ) { - - var i, il, j, jl, n, - - shadowMap, shadowMatrix, shadowCamera, - program, buffer, material, - webglObject, object, light, - renderList, - - lights = [], - k = 0, - - fog = null; - - // set GL state for depth map - - _gl.clearColor( 1, 1, 1, 1 ); - _gl.disable( _gl.BLEND ); - - _gl.enable( _gl.CULL_FACE ); - _gl.frontFace( _gl.CCW ); - - if ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) { - - _gl.cullFace( _gl.FRONT ); - - } else { - - _gl.cullFace( _gl.BACK ); - - } - - _renderer.setDepthTest( true ); - - // preprocess lights - // - skip lights that are not casting shadows - // - create virtual lights for cascaded shadow maps - - for ( i = 0, il = scene.__lights.length; i < il; i ++ ) { - - light = scene.__lights[ i ]; - - if ( ! light.castShadow ) continue; - - if ( ( light instanceof THREE.DirectionalLight ) && light.shadowCascade ) { - - for ( n = 0; n < light.shadowCascadeCount; n ++ ) { - - var virtualLight; - - if ( ! light.shadowCascadeArray[ n ] ) { - - virtualLight = createVirtualLight( light, n ); - virtualLight.originalCamera = camera; - - var gyro = new THREE.Gyroscope(); - gyro.position = light.shadowCascadeOffset; - - gyro.add( virtualLight ); - gyro.add( virtualLight.target ); - - camera.add( gyro ); - - light.shadowCascadeArray[ n ] = virtualLight; - - console.log( "Created virtualLight", virtualLight ); - - } else { - - virtualLight = light.shadowCascadeArray[ n ]; - - } - - updateVirtualLight( light, n ); - - lights[ k ] = virtualLight; - k ++; - - } - - } else { - - lights[ k ] = light; - k ++; - - } - - } - - // render depth map - - for ( i = 0, il = lights.length; i < il; i ++ ) { - - light = lights[ i ]; - - if ( ! light.shadowMap ) { - - var shadowFilter = THREE.LinearFilter; - - if ( _renderer.shadowMapType === THREE.PCFSoftShadowMap ) { - - shadowFilter = THREE.NearestFilter; - - } - - var pars = { minFilter: shadowFilter, magFilter: shadowFilter, format: THREE.RGBAFormat }; - - light.shadowMap = new THREE.WebGLRenderTarget( light.shadowMapWidth, light.shadowMapHeight, pars ); - light.shadowMapSize = new THREE.Vector2( light.shadowMapWidth, light.shadowMapHeight ); - - light.shadowMatrix = new THREE.Matrix4(); - - } - - if ( ! light.shadowCamera ) { - - if ( light instanceof THREE.SpotLight ) { - - light.shadowCamera = new THREE.PerspectiveCamera( light.shadowCameraFov, light.shadowMapWidth / light.shadowMapHeight, light.shadowCameraNear, light.shadowCameraFar ); - - } else if ( light instanceof THREE.DirectionalLight ) { - - light.shadowCamera = new THREE.OrthographicCamera( light.shadowCameraLeft, light.shadowCameraRight, light.shadowCameraTop, light.shadowCameraBottom, light.shadowCameraNear, light.shadowCameraFar ); - - } else { - - console.error( "Unsupported light type for shadow" ); - continue; - - } - - scene.add( light.shadowCamera ); - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - - } - - if ( light.shadowCameraVisible && ! light.cameraHelper ) { - - light.cameraHelper = new THREE.CameraHelper( light.shadowCamera ); - light.shadowCamera.add( light.cameraHelper ); - - } - - if ( light.isVirtual && virtualLight.originalCamera == camera ) { - - updateShadowCamera( camera, light ); - - } - - shadowMap = light.shadowMap; - shadowMatrix = light.shadowMatrix; - shadowCamera = light.shadowCamera; - - shadowCamera.position.setFromMatrixPosition( light.matrixWorld ); - _matrixPosition.setFromMatrixPosition( light.target.matrixWorld ); - shadowCamera.lookAt( _matrixPosition ); - shadowCamera.updateMatrixWorld(); - - shadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld ); - - if ( light.cameraHelper ) light.cameraHelper.visible = light.shadowCameraVisible; - if ( light.shadowCameraVisible ) light.cameraHelper.update(); - - // compute shadow matrix - - shadowMatrix.set( 0.5, 0.0, 0.0, 0.5, - 0.0, 0.5, 0.0, 0.5, - 0.0, 0.0, 0.5, 0.5, - 0.0, 0.0, 0.0, 1.0 ); - - shadowMatrix.multiply( shadowCamera.projectionMatrix ); - shadowMatrix.multiply( shadowCamera.matrixWorldInverse ); - - // update camera matrices and frustum - - _projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - // render shadow map - - _renderer.setRenderTarget( shadowMap ); - _renderer.clear(); - - // set object matrices & frustum culling - - renderList = scene.__webglObjects; - - for ( j = 0, jl = renderList.length; j < jl; j ++ ) { - - webglObject = renderList[ j ]; - object = webglObject.object; - - webglObject.render = false; - - if ( object.visible && object.castShadow ) { - - if ( ! ( object instanceof THREE.Mesh || object instanceof THREE.ParticleSystem ) || ! ( object.frustumCulled ) || _frustum.intersectsObject( object ) ) { - - object._modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); - - webglObject.render = true; - - } - - } - - } - - // render regular objects - - var objectMaterial, useMorphing, useSkinning; - - for ( j = 0, jl = renderList.length; j < jl; j ++ ) { - - webglObject = renderList[ j ]; - - if ( webglObject.render ) { - - object = webglObject.object; - buffer = webglObject.buffer; - - // culling is overriden globally for all objects - // while rendering depth map - - // need to deal with MeshFaceMaterial somehow - // in that case just use the first of material.materials for now - // (proper solution would require to break objects by materials - // similarly to regular rendering and then set corresponding - // depth materials per each chunk instead of just once per object) - - objectMaterial = getObjectMaterial( object ); - - useMorphing = object.geometry.morphTargets !== undefined && object.geometry.morphTargets.length > 0 && objectMaterial.morphTargets; - useSkinning = object instanceof THREE.SkinnedMesh && objectMaterial.skinning; - - if ( object.customDepthMaterial ) { - - material = object.customDepthMaterial; - - } else if ( useSkinning ) { - - material = useMorphing ? _depthMaterialMorphSkin : _depthMaterialSkin; - - } else if ( useMorphing ) { - - material = _depthMaterialMorph; - - } else { - - material = _depthMaterial; - - } - - if ( buffer instanceof THREE.BufferGeometry ) { - - _renderer.renderBufferDirect( shadowCamera, scene.__lights, fog, material, buffer, object ); - - } else { - - _renderer.renderBuffer( shadowCamera, scene.__lights, fog, material, buffer, object ); - - } - - } - - } - - // set matrices and render immediate objects - - renderList = scene.__webglObjectsImmediate; - - for ( j = 0, jl = renderList.length; j < jl; j ++ ) { - - webglObject = renderList[ j ]; - object = webglObject.object; - - if ( object.visible && object.castShadow ) { - - object._modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); - - _renderer.renderImmediateObject( shadowCamera, scene.__lights, fog, _depthMaterial, object ); - - } - - } - - } - - // restore GL state - - var clearColor = _renderer.getClearColor(), - clearAlpha = _renderer.getClearAlpha(); - - _gl.clearColor( clearColor.r, clearColor.g, clearColor.b, clearAlpha ); - _gl.enable( _gl.BLEND ); - - if ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) { - - _gl.cullFace( _gl.BACK ); - - } - - }; - - function createVirtualLight( light, cascade ) { - - var virtualLight = new THREE.DirectionalLight(); - - virtualLight.isVirtual = true; - - virtualLight.onlyShadow = true; - virtualLight.castShadow = true; - - virtualLight.shadowCameraNear = light.shadowCameraNear; - virtualLight.shadowCameraFar = light.shadowCameraFar; - - virtualLight.shadowCameraLeft = light.shadowCameraLeft; - virtualLight.shadowCameraRight = light.shadowCameraRight; - virtualLight.shadowCameraBottom = light.shadowCameraBottom; - virtualLight.shadowCameraTop = light.shadowCameraTop; - - virtualLight.shadowCameraVisible = light.shadowCameraVisible; - - virtualLight.shadowDarkness = light.shadowDarkness; - - virtualLight.shadowBias = light.shadowCascadeBias[ cascade ]; - virtualLight.shadowMapWidth = light.shadowCascadeWidth[ cascade ]; - virtualLight.shadowMapHeight = light.shadowCascadeHeight[ cascade ]; - - virtualLight.pointsWorld = []; - virtualLight.pointsFrustum = []; - - var pointsWorld = virtualLight.pointsWorld, - pointsFrustum = virtualLight.pointsFrustum; - - for ( var i = 0; i < 8; i ++ ) { - - pointsWorld[ i ] = new THREE.Vector3(); - pointsFrustum[ i ] = new THREE.Vector3(); - - } - - var nearZ = light.shadowCascadeNearZ[ cascade ]; - var farZ = light.shadowCascadeFarZ[ cascade ]; - - pointsFrustum[ 0 ].set( -1, -1, nearZ ); - pointsFrustum[ 1 ].set( 1, -1, nearZ ); - pointsFrustum[ 2 ].set( -1, 1, nearZ ); - pointsFrustum[ 3 ].set( 1, 1, nearZ ); - - pointsFrustum[ 4 ].set( -1, -1, farZ ); - pointsFrustum[ 5 ].set( 1, -1, farZ ); - pointsFrustum[ 6 ].set( -1, 1, farZ ); - pointsFrustum[ 7 ].set( 1, 1, farZ ); - - return virtualLight; - - } - - // Synchronize virtual light with the original light - - function updateVirtualLight( light, cascade ) { - - var virtualLight = light.shadowCascadeArray[ cascade ]; - - virtualLight.position.copy( light.position ); - virtualLight.target.position.copy( light.target.position ); - virtualLight.lookAt( virtualLight.target ); - - virtualLight.shadowCameraVisible = light.shadowCameraVisible; - virtualLight.shadowDarkness = light.shadowDarkness; - - virtualLight.shadowBias = light.shadowCascadeBias[ cascade ]; - - var nearZ = light.shadowCascadeNearZ[ cascade ]; - var farZ = light.shadowCascadeFarZ[ cascade ]; - - var pointsFrustum = virtualLight.pointsFrustum; - - pointsFrustum[ 0 ].z = nearZ; - pointsFrustum[ 1 ].z = nearZ; - pointsFrustum[ 2 ].z = nearZ; - pointsFrustum[ 3 ].z = nearZ; - - pointsFrustum[ 4 ].z = farZ; - pointsFrustum[ 5 ].z = farZ; - pointsFrustum[ 6 ].z = farZ; - pointsFrustum[ 7 ].z = farZ; - - } - - // Fit shadow camera's ortho frustum to camera frustum - - function updateShadowCamera( camera, light ) { - - var shadowCamera = light.shadowCamera, - pointsFrustum = light.pointsFrustum, - pointsWorld = light.pointsWorld; - - _min.set( Infinity, Infinity, Infinity ); - _max.set( -Infinity, -Infinity, -Infinity ); - - for ( var i = 0; i < 8; i ++ ) { - - var p = pointsWorld[ i ]; - - p.copy( pointsFrustum[ i ] ); - THREE.ShadowMapPlugin.__projector.unprojectVector( p, camera ); - - p.applyMatrix4( shadowCamera.matrixWorldInverse ); - - if ( p.x < _min.x ) _min.x = p.x; - if ( p.x > _max.x ) _max.x = p.x; - - if ( p.y < _min.y ) _min.y = p.y; - if ( p.y > _max.y ) _max.y = p.y; - - if ( p.z < _min.z ) _min.z = p.z; - if ( p.z > _max.z ) _max.z = p.z; - - } - - shadowCamera.left = _min.x; - shadowCamera.right = _max.x; - shadowCamera.top = _max.y; - shadowCamera.bottom = _min.y; - - // can't really fit near/far - //shadowCamera.near = _min.z; - //shadowCamera.far = _max.z; - - shadowCamera.updateProjectionMatrix(); - - } - - // For the moment just ignore objects that have multiple materials with different animation methods - // Only the first material will be taken into account for deciding which depth material to use for shadow maps - - function getObjectMaterial( object ) { - - return object.material instanceof THREE.MeshFaceMaterial - ? object.material.materials[ 0 ] - : object.material; - - }; - -}; - -THREE.ShadowMapPlugin.__projector = new THREE.Projector(); - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.SpritePlugin = function () { - - var _gl, _renderer, _texture; - - var vertices, faces, vertexBuffer, elementBuffer; - var program, attributes, uniforms; - - this.init = function ( renderer ) { - - _gl = renderer.context; - _renderer = renderer; - - vertices = new Float32Array( [ - - 0.5, - 0.5, 0, 0, - 0.5, - 0.5, 1, 0, - 0.5, 0.5, 1, 1, - - 0.5, 0.5, 0, 1 - ] ); - - faces = new Uint16Array( [ - 0, 1, 2, - 0, 2, 3 - ] ); - - vertexBuffer = _gl.createBuffer(); - elementBuffer = _gl.createBuffer(); - - _gl.bindBuffer( _gl.ARRAY_BUFFER, vertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertices, _gl.STATIC_DRAW ); - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, faces, _gl.STATIC_DRAW ); - - program = createProgram(); - - attributes = { - position: _gl.getAttribLocation ( program, 'position' ), - uv: _gl.getAttribLocation ( program, 'uv' ) - }; - - uniforms = { - uvOffset: _gl.getUniformLocation( program, 'uvOffset' ), - uvScale: _gl.getUniformLocation( program, 'uvScale' ), - - rotation: _gl.getUniformLocation( program, 'rotation' ), - scale: _gl.getUniformLocation( program, 'scale' ), - - color: _gl.getUniformLocation( program, 'color' ), - map: _gl.getUniformLocation( program, 'map' ), - opacity: _gl.getUniformLocation( program, 'opacity' ), - - modelViewMatrix: _gl.getUniformLocation( program, 'modelViewMatrix' ), - projectionMatrix: _gl.getUniformLocation( program, 'projectionMatrix' ), - - fogType: _gl.getUniformLocation( program, 'fogType' ), - fogDensity: _gl.getUniformLocation( program, 'fogDensity' ), - fogNear: _gl.getUniformLocation( program, 'fogNear' ), - fogFar: _gl.getUniformLocation( program, 'fogFar' ), - fogColor: _gl.getUniformLocation( program, 'fogColor' ), - - alphaTest: _gl.getUniformLocation( program, 'alphaTest' ) - }; - - var canvas = document.createElement( 'canvas' ); - canvas.width = 8; - canvas.height = 8; - - var context = canvas.getContext( '2d' ); - context.fillStyle = '#ffffff'; - context.fillRect( 0, 0, canvas.width, canvas.height ); - - _texture = new THREE.Texture( canvas ); - _texture.needsUpdate = true; - - }; - - this.render = function ( scene, camera, viewportWidth, viewportHeight ) { - - var sprites = scene.__webglSprites, - nSprites = sprites.length; - - if ( ! nSprites ) return; - - // setup gl - - _gl.useProgram( program ); - - _gl.enableVertexAttribArray( attributes.position ); - _gl.enableVertexAttribArray( attributes.uv ); - - _gl.disable( _gl.CULL_FACE ); - _gl.enable( _gl.BLEND ); - - _gl.bindBuffer( _gl.ARRAY_BUFFER, vertexBuffer ); - _gl.vertexAttribPointer( attributes.position, 2, _gl.FLOAT, false, 2 * 8, 0 ); - _gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 2 * 8, 8 ); - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - - _gl.uniformMatrix4fv( uniforms.projectionMatrix, false, camera.projectionMatrix.elements ); - - _gl.activeTexture( _gl.TEXTURE0 ); - _gl.uniform1i( uniforms.map, 0 ); - - var oldFogType = 0; - var sceneFogType = 0; - var fog = scene.fog; - - if ( fog ) { - - _gl.uniform3f( uniforms.fogColor, fog.color.r, fog.color.g, fog.color.b ); - - if ( fog instanceof THREE.Fog ) { - - _gl.uniform1f( uniforms.fogNear, fog.near ); - _gl.uniform1f( uniforms.fogFar, fog.far ); - - _gl.uniform1i( uniforms.fogType, 1 ); - oldFogType = 1; - sceneFogType = 1; - - } else if ( fog instanceof THREE.FogExp2 ) { - - _gl.uniform1f( uniforms.fogDensity, fog.density ); - - _gl.uniform1i( uniforms.fogType, 2 ); - oldFogType = 2; - sceneFogType = 2; - - } - - } else { - - _gl.uniform1i( uniforms.fogType, 0 ); - oldFogType = 0; - sceneFogType = 0; - - } - - - // update positions and sort - - var i, sprite, material, fogType, scale = []; - - for( i = 0; i < nSprites; i ++ ) { - - sprite = sprites[ i ]; - material = sprite.material; - - if ( sprite.visible === false ) continue; - - sprite._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, sprite.matrixWorld ); - sprite.z = - sprite._modelViewMatrix.elements[ 14 ]; - - } - - sprites.sort( painterSortStable ); - - // render all sprites - - for( i = 0; i < nSprites; i ++ ) { - - sprite = sprites[ i ]; - - if ( sprite.visible === false ) continue; - - material = sprite.material; - - _gl.uniform1f( uniforms.alphaTest, material.alphaTest ); - _gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, sprite._modelViewMatrix.elements ); - - scale[ 0 ] = sprite.scale.x; - scale[ 1 ] = sprite.scale.y; - - if ( scene.fog && material.fog ) { - - fogType = sceneFogType; - - } else { - - fogType = 0; - - } - - if ( oldFogType !== fogType ) { - - _gl.uniform1i( uniforms.fogType, fogType ); - oldFogType = fogType; - - } - - if ( material.map !== null ) { - - _gl.uniform2f( uniforms.uvOffset, material.map.offset.x, material.map.offset.y ); - _gl.uniform2f( uniforms.uvScale, material.map.repeat.x, material.map.repeat.y ); - - } else { - - _gl.uniform2f( uniforms.uvOffset, 0, 0 ); - _gl.uniform2f( uniforms.uvScale, 1, 1 ); - - } - - _gl.uniform1f( uniforms.opacity, material.opacity ); - _gl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b ); - - _gl.uniform1f( uniforms.rotation, material.rotation ); - _gl.uniform2fv( uniforms.scale, scale ); - - _renderer.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst ); - _renderer.setDepthTest( material.depthTest ); - _renderer.setDepthWrite( material.depthWrite ); - - if ( material.map && material.map.image && material.map.image.width ) { - - _renderer.setTexture( material.map, 0 ); - - } else { - - _renderer.setTexture( _texture, 0 ); - - } - - _gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 ); - - } - - // restore gl - - _gl.enable( _gl.CULL_FACE ); - - }; - - function createProgram () { - - var program = _gl.createProgram(); - - var vertexShader = _gl.createShader( _gl.VERTEX_SHADER ); - var fragmentShader = _gl.createShader( _gl.FRAGMENT_SHADER ); - - _gl.shaderSource( vertexShader, [ - - 'precision ' + _renderer.getPrecision() + ' float;', - - 'uniform mat4 modelViewMatrix;', - 'uniform mat4 projectionMatrix;', - 'uniform float rotation;', - 'uniform vec2 scale;', - 'uniform vec2 uvOffset;', - 'uniform vec2 uvScale;', - - 'attribute vec2 position;', - 'attribute vec2 uv;', - - 'varying vec2 vUV;', - - 'void main() {', - - 'vUV = uvOffset + uv * uvScale;', - - 'vec2 alignedPosition = position * scale;', - - 'vec2 rotatedPosition;', - 'rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;', - 'rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;', - - 'vec4 finalPosition;', - - 'finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );', - 'finalPosition.xy += rotatedPosition;', - 'finalPosition = projectionMatrix * finalPosition;', - - 'gl_Position = finalPosition;', - - '}' - - ].join( '\n' ) ); - - _gl.shaderSource( fragmentShader, [ - - 'precision ' + _renderer.getPrecision() + ' float;', - - 'uniform vec3 color;', - 'uniform sampler2D map;', - 'uniform float opacity;', - - 'uniform int fogType;', - 'uniform vec3 fogColor;', - 'uniform float fogDensity;', - 'uniform float fogNear;', - 'uniform float fogFar;', - 'uniform float alphaTest;', - - 'varying vec2 vUV;', - - 'void main() {', - - 'vec4 texture = texture2D( map, vUV );', - - 'if ( texture.a < alphaTest ) discard;', - - 'gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );', - - 'if ( fogType > 0 ) {', - - 'float depth = gl_FragCoord.z / gl_FragCoord.w;', - 'float fogFactor = 0.0;', - - 'if ( fogType == 1 ) {', - - 'fogFactor = smoothstep( fogNear, fogFar, depth );', - - '} else {', - - 'const float LOG2 = 1.442695;', - 'float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );', - 'fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );', - - '}', - - 'gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );', - - '}', - - '}' - - ].join( '\n' ) ); - - _gl.compileShader( vertexShader ); - _gl.compileShader( fragmentShader ); - - _gl.attachShader( program, vertexShader ); - _gl.attachShader( program, fragmentShader ); - - _gl.linkProgram( program ); - - return program; - - }; - - function painterSortStable ( a, b ) { - - if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return b.id - a.id; - - } - - }; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.DepthPassPlugin = function () { - - this.enabled = false; - this.renderTarget = null; - - var _gl, - _renderer, - _depthMaterial, _depthMaterialMorph, _depthMaterialSkin, _depthMaterialMorphSkin, - - _frustum = new THREE.Frustum(), - _projScreenMatrix = new THREE.Matrix4(); - - this.init = function ( renderer ) { - - _gl = renderer.context; - _renderer = renderer; - - var depthShader = THREE.ShaderLib[ "depthRGBA" ]; - var depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms ); - - _depthMaterial = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms } ); - _depthMaterialMorph = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, morphTargets: true } ); - _depthMaterialSkin = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, skinning: true } ); - _depthMaterialMorphSkin = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, morphTargets: true, skinning: true } ); - - _depthMaterial._shadowPass = true; - _depthMaterialMorph._shadowPass = true; - _depthMaterialSkin._shadowPass = true; - _depthMaterialMorphSkin._shadowPass = true; - - }; - - this.render = function ( scene, camera ) { - - if ( ! this.enabled ) return; - - this.update( scene, camera ); - - }; - - this.update = function ( scene, camera ) { - - var i, il, j, jl, n, - - program, buffer, material, - webglObject, object, light, - renderList, - - fog = null; - - // set GL state for depth map - - _gl.clearColor( 1, 1, 1, 1 ); - _gl.disable( _gl.BLEND ); - - _renderer.setDepthTest( true ); - - // update scene - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - - // update camera matrices and frustum - - camera.matrixWorldInverse.getInverse( camera.matrixWorld ); - - _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - // render depth map - - _renderer.setRenderTarget( this.renderTarget ); - _renderer.clear(); - - // set object matrices & frustum culling - - renderList = scene.__webglObjects; - - for ( j = 0, jl = renderList.length; j < jl; j ++ ) { - - webglObject = renderList[ j ]; - object = webglObject.object; - - webglObject.render = false; - - if ( object.visible ) { - - if ( ! ( object instanceof THREE.Mesh || object instanceof THREE.ParticleSystem ) || ! ( object.frustumCulled ) || _frustum.intersectsObject( object ) ) { - - object._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); - - webglObject.render = true; - - } - - } - - } - - // render regular objects - - var objectMaterial, useMorphing, useSkinning; - - for ( j = 0, jl = renderList.length; j < jl; j ++ ) { - - webglObject = renderList[ j ]; - - if ( webglObject.render ) { - - object = webglObject.object; - buffer = webglObject.buffer; - - // todo: create proper depth material for particles - - if ( object instanceof THREE.ParticleSystem && !object.customDepthMaterial ) continue; - - objectMaterial = getObjectMaterial( object ); - - if ( objectMaterial ) _renderer.setMaterialFaces( object.material ); - - useMorphing = object.geometry.morphTargets.length > 0 && objectMaterial.morphTargets; - useSkinning = object instanceof THREE.SkinnedMesh && objectMaterial.skinning; - - if ( object.customDepthMaterial ) { - - material = object.customDepthMaterial; - - } else if ( useSkinning ) { - - material = useMorphing ? _depthMaterialMorphSkin : _depthMaterialSkin; - - } else if ( useMorphing ) { - - material = _depthMaterialMorph; - - } else { - - material = _depthMaterial; - - } - - if ( buffer instanceof THREE.BufferGeometry ) { - - _renderer.renderBufferDirect( camera, scene.__lights, fog, material, buffer, object ); - - } else { - - _renderer.renderBuffer( camera, scene.__lights, fog, material, buffer, object ); - - } - - } - - } - - // set matrices and render immediate objects - - renderList = scene.__webglObjectsImmediate; - - for ( j = 0, jl = renderList.length; j < jl; j ++ ) { - - webglObject = renderList[ j ]; - object = webglObject.object; - - if ( object.visible ) { - - object._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); - - _renderer.renderImmediateObject( camera, scene.__lights, fog, _depthMaterial, object ); - - } - - } - - // restore GL state - - var clearColor = _renderer.getClearColor(), - clearAlpha = _renderer.getClearAlpha(); - - _gl.clearColor( clearColor.r, clearColor.g, clearColor.b, clearAlpha ); - _gl.enable( _gl.BLEND ); - - }; - - // For the moment just ignore objects that have multiple materials with different animation methods - // Only the first material will be taken into account for deciding which depth material to use - - function getObjectMaterial( object ) { - - return object.material instanceof THREE.MeshFaceMaterial - ? object.material.materials[ 0 ] - : object.material; - - }; - -}; - - -/** - * @author mikael emtinger / http://gomo.se/ - */ - -THREE.ShaderFlares = { - - 'lensFlareVertexTexture': { - - vertexShader: [ - - "uniform lowp int renderType;", - - "uniform vec3 screenPosition;", - "uniform vec2 scale;", - "uniform float rotation;", - - "uniform sampler2D occlusionMap;", - - "attribute vec2 position;", - "attribute vec2 uv;", - - "varying vec2 vUV;", - "varying float vVisibility;", - - "void main() {", - - "vUV = uv;", - - "vec2 pos = position;", - - "if( renderType == 2 ) {", - - "vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );", - - "vVisibility = visibility.r / 9.0;", - "vVisibility *= 1.0 - visibility.g / 9.0;", - "vVisibility *= visibility.b / 9.0;", - "vVisibility *= 1.0 - visibility.a / 9.0;", - - "pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;", - "pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;", - - "}", - - "gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );", - - "}" - - ].join( "\n" ), - - fragmentShader: [ - - "uniform lowp int renderType;", - - "uniform sampler2D map;", - "uniform float opacity;", - "uniform vec3 color;", - - "varying vec2 vUV;", - "varying float vVisibility;", - - "void main() {", - - // pink square - - "if( renderType == 0 ) {", - - "gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );", - - // restore - - "} else if( renderType == 1 ) {", - - "gl_FragColor = texture2D( map, vUV );", - - // flare - - "} else {", - - "vec4 texture = texture2D( map, vUV );", - "texture.a *= opacity * vVisibility;", - "gl_FragColor = texture;", - "gl_FragColor.rgb *= color;", - - "}", - - "}" - ].join( "\n" ) - - }, - - - 'lensFlare': { - - vertexShader: [ - - "uniform lowp int renderType;", - - "uniform vec3 screenPosition;", - "uniform vec2 scale;", - "uniform float rotation;", - - "attribute vec2 position;", - "attribute vec2 uv;", - - "varying vec2 vUV;", - - "void main() {", - - "vUV = uv;", - - "vec2 pos = position;", - - "if( renderType == 2 ) {", - - "pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;", - "pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;", - - "}", - - "gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );", - - "}" - - ].join( "\n" ), - - fragmentShader: [ - - "precision mediump float;", - - "uniform lowp int renderType;", - - "uniform sampler2D map;", - "uniform sampler2D occlusionMap;", - "uniform float opacity;", - "uniform vec3 color;", - - "varying vec2 vUV;", - - "void main() {", - - // pink square - - "if( renderType == 0 ) {", - - "gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );", - - // restore - - "} else if( renderType == 1 ) {", - - "gl_FragColor = texture2D( map, vUV );", - - // flare - - "} else {", - - "float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;", - "visibility = ( 1.0 - visibility / 4.0 );", - - "vec4 texture = texture2D( map, vUV );", - "texture.a *= opacity * visibility;", - "gl_FragColor = texture;", - "gl_FragColor.rgb *= color;", - - "}", - - "}" - - ].join( "\n" ) - - } - -}; - diff --git a/libs/three.js/build/three.modules.js b/libs/three.js/build/three.modules.js deleted file mode 100644 index 6d840d25..00000000 --- a/libs/three.js/build/three.modules.js +++ /dev/null @@ -1,42802 +0,0 @@ -// Polyfills - -if ( Number.EPSILON === undefined ) { - - Number.EPSILON = Math.pow( 2, - 52 ); - -} - -// - -if ( Math.sign === undefined ) { - - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign - - Math.sign = function ( x ) { - - return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : + x; - - }; - -} - -if ( Function.prototype.name === undefined ) { - - // Missing in IE9-11. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name - - Object.defineProperty( Function.prototype, 'name', { - - get: function () { - - return this.toString().match( /^\s*function\s*([^\(\s]*)/ )[ 1 ]; - - } - - } ); - -} - -if ( Object.assign === undefined ) { - - // Missing in IE. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign - - ( function () { - - Object.assign = function ( target ) { - - 'use strict'; - - if ( target === undefined || target === null ) { - - throw new TypeError( 'Cannot convert undefined or null to object' ); - - } - - var output = Object( target ); - - for ( var index = 1; index < arguments.length; index ++ ) { - - var source = arguments[ index ]; - - if ( source !== undefined && source !== null ) { - - for ( var nextKey in source ) { - - if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) { - - output[ nextKey ] = source[ nextKey ]; - - } - - } - - } - - } - - return output; - - }; - - } )(); - -} - -/** - * https://github.com/mrdoob/eventdispatcher.js/ - */ - -function EventDispatcher() {} - -Object.assign( EventDispatcher.prototype, { - - addEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) this._listeners = {}; - - var listeners = this._listeners; - - if ( listeners[ type ] === undefined ) { - - listeners[ type ] = []; - - } - - if ( listeners[ type ].indexOf( listener ) === - 1 ) { - - listeners[ type ].push( listener ); - - } - - }, - - hasEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return false; - - var listeners = this._listeners; - - if ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) { - - return true; - - } - - return false; - - }, - - removeEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return; - - var listeners = this._listeners; - var listenerArray = listeners[ type ]; - - if ( listenerArray !== undefined ) { - - var index = listenerArray.indexOf( listener ); - - if ( index !== - 1 ) { - - listenerArray.splice( index, 1 ); - - } - - } - - }, - - dispatchEvent: function ( event ) { - - if ( this._listeners === undefined ) return; - - var listeners = this._listeners; - var listenerArray = listeners[ event.type ]; - - if ( listenerArray !== undefined ) { - - event.target = this; - - var array = [], i = 0; - var length = listenerArray.length; - - for ( i = 0; i < length; i ++ ) { - - array[ i ] = listenerArray[ i ]; - - } - - for ( i = 0; i < length; i ++ ) { - - array[ i ].call( this, event ); - - } - - } - - } - -} ); - -var REVISION = '83dev'; -var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 }; -var CullFaceNone = 0; -var CullFaceBack = 1; -var CullFaceFront = 2; -var CullFaceFrontBack = 3; -var FrontFaceDirectionCW = 0; -var FrontFaceDirectionCCW = 1; -var BasicShadowMap = 0; -var PCFShadowMap = 1; -var PCFSoftShadowMap = 2; -var FrontSide = 0; -var BackSide = 1; -var DoubleSide = 2; -var FlatShading = 1; -var SmoothShading = 2; -var NoColors = 0; -var FaceColors = 1; -var VertexColors = 2; -var NoBlending = 0; -var NormalBlending = 1; -var AdditiveBlending = 2; -var SubtractiveBlending = 3; -var MultiplyBlending = 4; -var CustomBlending = 5; -var BlendingMode = { - NoBlending: NoBlending, - NormalBlending: NormalBlending, - AdditiveBlending: AdditiveBlending, - SubtractiveBlending: SubtractiveBlending, - MultiplyBlending: MultiplyBlending, - CustomBlending: CustomBlending -}; -var AddEquation = 100; -var SubtractEquation = 101; -var ReverseSubtractEquation = 102; -var MinEquation = 103; -var MaxEquation = 104; -var ZeroFactor = 200; -var OneFactor = 201; -var SrcColorFactor = 202; -var OneMinusSrcColorFactor = 203; -var SrcAlphaFactor = 204; -var OneMinusSrcAlphaFactor = 205; -var DstAlphaFactor = 206; -var OneMinusDstAlphaFactor = 207; -var DstColorFactor = 208; -var OneMinusDstColorFactor = 209; -var SrcAlphaSaturateFactor = 210; -var NeverDepth = 0; -var AlwaysDepth = 1; -var LessDepth = 2; -var LessEqualDepth = 3; -var EqualDepth = 4; -var GreaterEqualDepth = 5; -var GreaterDepth = 6; -var NotEqualDepth = 7; -var MultiplyOperation = 0; -var MixOperation = 1; -var AddOperation = 2; -var NoToneMapping = 0; -var LinearToneMapping = 1; -var ReinhardToneMapping = 2; -var Uncharted2ToneMapping = 3; -var CineonToneMapping = 4; -var UVMapping = 300; -var CubeReflectionMapping = 301; -var CubeRefractionMapping = 302; -var EquirectangularReflectionMapping = 303; -var EquirectangularRefractionMapping = 304; -var SphericalReflectionMapping = 305; -var CubeUVReflectionMapping = 306; -var CubeUVRefractionMapping = 307; -var TextureMapping = { - UVMapping: UVMapping, - CubeReflectionMapping: CubeReflectionMapping, - CubeRefractionMapping: CubeRefractionMapping, - EquirectangularReflectionMapping: EquirectangularReflectionMapping, - EquirectangularRefractionMapping: EquirectangularRefractionMapping, - SphericalReflectionMapping: SphericalReflectionMapping, - CubeUVReflectionMapping: CubeUVReflectionMapping, - CubeUVRefractionMapping: CubeUVRefractionMapping -}; -var RepeatWrapping = 1000; -var ClampToEdgeWrapping = 1001; -var MirroredRepeatWrapping = 1002; -var TextureWrapping = { - RepeatWrapping: RepeatWrapping, - ClampToEdgeWrapping: ClampToEdgeWrapping, - MirroredRepeatWrapping: MirroredRepeatWrapping -}; -var NearestFilter = 1003; -var NearestMipMapNearestFilter = 1004; -var NearestMipMapLinearFilter = 1005; -var LinearFilter = 1006; -var LinearMipMapNearestFilter = 1007; -var LinearMipMapLinearFilter = 1008; -var TextureFilter = { - NearestFilter: NearestFilter, - NearestMipMapNearestFilter: NearestMipMapNearestFilter, - NearestMipMapLinearFilter: NearestMipMapLinearFilter, - LinearFilter: LinearFilter, - LinearMipMapNearestFilter: LinearMipMapNearestFilter, - LinearMipMapLinearFilter: LinearMipMapLinearFilter -}; -var UnsignedByteType = 1009; -var ByteType = 1010; -var ShortType = 1011; -var UnsignedShortType = 1012; -var IntType = 1013; -var UnsignedIntType = 1014; -var FloatType = 1015; -var HalfFloatType = 1016; -var UnsignedShort4444Type = 1017; -var UnsignedShort5551Type = 1018; -var UnsignedShort565Type = 1019; -var UnsignedInt248Type = 1020; -var AlphaFormat = 1021; -var RGBFormat = 1022; -var RGBAFormat = 1023; -var LuminanceFormat = 1024; -var LuminanceAlphaFormat = 1025; -var RGBEFormat = RGBAFormat; -var DepthFormat = 1026; -var DepthStencilFormat = 1027; -var RGB_S3TC_DXT1_Format = 2001; -var RGBA_S3TC_DXT1_Format = 2002; -var RGBA_S3TC_DXT3_Format = 2003; -var RGBA_S3TC_DXT5_Format = 2004; -var RGB_PVRTC_4BPPV1_Format = 2100; -var RGB_PVRTC_2BPPV1_Format = 2101; -var RGBA_PVRTC_4BPPV1_Format = 2102; -var RGBA_PVRTC_2BPPV1_Format = 2103; -var RGB_ETC1_Format = 2151; -var LoopOnce = 2200; -var LoopRepeat = 2201; -var LoopPingPong = 2202; -var InterpolateDiscrete = 2300; -var InterpolateLinear = 2301; -var InterpolateSmooth = 2302; -var ZeroCurvatureEnding = 2400; -var ZeroSlopeEnding = 2401; -var WrapAroundEnding = 2402; -var TrianglesDrawMode = 0; -var TriangleStripDrawMode = 1; -var TriangleFanDrawMode = 2; -var LinearEncoding = 3000; -var sRGBEncoding = 3001; -var GammaEncoding = 3007; -var RGBEEncoding = 3002; -var LogLuvEncoding = 3003; -var RGBM7Encoding = 3004; -var RGBM16Encoding = 3005; -var RGBDEncoding = 3006; -var BasicDepthPacking = 3200; -var RGBADepthPacking = 3201; - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -var _Math = { - - DEG2RAD: Math.PI / 180, - RAD2DEG: 180 / Math.PI, - - generateUUID: function () { - - // http://www.broofa.com/Tools/Math.uuid.htm - - var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split( '' ); - var uuid = new Array( 36 ); - var rnd = 0, r; - - return function generateUUID() { - - for ( var i = 0; i < 36; i ++ ) { - - if ( i === 8 || i === 13 || i === 18 || i === 23 ) { - - uuid[ i ] = '-'; - - } else if ( i === 14 ) { - - uuid[ i ] = '4'; - - } else { - - if ( rnd <= 0x02 ) rnd = 0x2000000 + ( Math.random() * 0x1000000 ) | 0; - r = rnd & 0xf; - rnd = rnd >> 4; - uuid[ i ] = chars[ ( i === 19 ) ? ( r & 0x3 ) | 0x8 : r ]; - - } - - } - - return uuid.join( '' ); - - }; - - }(), - - clamp: function ( value, min, max ) { - - return Math.max( min, Math.min( max, value ) ); - - }, - - // compute euclidian modulo of m % n - // https://en.wikipedia.org/wiki/Modulo_operation - - euclideanModulo: function ( n, m ) { - - return ( ( n % m ) + m ) % m; - - }, - - // Linear mapping from range <a1, a2> to range <b1, b2> - - mapLinear: function ( x, a1, a2, b1, b2 ) { - - return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 ); - - }, - - // https://en.wikipedia.org/wiki/Linear_interpolation - - lerp: function ( x, y, t ) { - - return ( 1 - t ) * x + t * y; - - }, - - // http://en.wikipedia.org/wiki/Smoothstep - - smoothstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min ) / ( max - min ); - - return x * x * ( 3 - 2 * x ); - - }, - - smootherstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min ) / ( max - min ); - - return x * x * x * ( x * ( x * 6 - 15 ) + 10 ); - - }, - - // Random integer from <low, high> interval - - randInt: function ( low, high ) { - - return low + Math.floor( Math.random() * ( high - low + 1 ) ); - - }, - - // Random float from <low, high> interval - - randFloat: function ( low, high ) { - - return low + Math.random() * ( high - low ); - - }, - - // Random float from <-range/2, range/2> interval - - randFloatSpread: function ( range ) { - - return range * ( 0.5 - Math.random() ); - - }, - - degToRad: function ( degrees ) { - - return degrees * _Math.DEG2RAD; - - }, - - radToDeg: function ( radians ) { - - return radians * _Math.RAD2DEG; - - }, - - isPowerOfTwo: function ( value ) { - - return ( value & ( value - 1 ) ) === 0 && value !== 0; - - }, - - nearestPowerOfTwo: function ( value ) { - - return Math.pow( 2, Math.round( Math.log( value ) / Math.LN2 ) ); - - }, - - nextPowerOfTwo: function ( value ) { - - value --; - value |= value >> 1; - value |= value >> 2; - value |= value >> 4; - value |= value >> 8; - value |= value >> 16; - value ++; - - return value; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author philogb / http://blog.thejit.org/ - * @author egraether / http://egraether.com/ - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - -function Vector2( x, y ) { - - this.x = x || 0; - this.y = y || 0; - -} - -Vector2.prototype = { - - constructor: Vector2, - - isVector2: true, - - get width() { - - return this.x; - - }, - - set width( value ) { - - this.x = value; - - }, - - get height() { - - return this.y; - - }, - - set height( value ) { - - this.y = value; - - }, - - // - - set: function ( x, y ) { - - this.x = x; - this.y = y; - - return this; - - }, - - setScalar: function ( scalar ) { - - this.x = scalar; - this.y = scalar; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - return this; - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - clone: function () { - - return new this.constructor( this.x, this.y ); - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - - return this; - - }, - - addScaledVector: function ( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - - return this; - - }, - - multiply: function ( v ) { - - this.x *= v.x; - this.y *= v.y; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - if ( isFinite( scalar ) ) { - - this.x *= scalar; - this.y *= scalar; - - } else { - - this.x = 0; - this.y = 0; - - } - - return this; - - }, - - divide: function ( v ) { - - this.x /= v.x; - this.y /= v.y; - - return this; - - }, - - divideScalar: function ( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - }, - - min: function ( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - - return this; - - }, - - max: function ( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - - return this; - - }, - - clampScalar: function () { - - var min, max; - - return function clampScalar( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new Vector2(); - max = new Vector2(); - - } - - min.set( minVal, minVal ); - max.set( maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - }(), - - clampLength: function ( min, max ) { - - var length = this.length(); - - return this.multiplyScalar( Math.max( min, Math.min( max, length ) ) / length ); - - }, - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y ); - - }, - - lengthManhattan: function() { - - return Math.abs( this.x ) + Math.abs( this.y ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - angle: function () { - - // computes the angle in radians with respect to the positive x-axis - - var angle = Math.atan2( this.y, this.x ); - - if ( angle < 0 ) angle += 2 * Math.PI; - - return angle; - - }, - - distanceTo: function ( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - }, - - distanceToSquared: function ( v ) { - - var dx = this.x - v.x, dy = this.y - v.y; - return dx * dx + dy * dy; - - }, - - distanceToManhattan: function ( v ) { - - return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ); - - }, - - setLength: function ( length ) { - - return this.multiplyScalar( length / this.length() ); - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - - return this; - - }, - - rotateAround: function ( center, angle ) { - - var c = Math.cos( angle ), s = Math.sin( angle ); - - var x = this.x - center.x; - var y = this.y - center.y; - - this.x = x * c - y * s + center.x; - this.y = x * s + y * c + center.y; - - return this; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author szimek / https://github.com/szimek/ - */ - -var textureId = 0; - -function Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) { - - Object.defineProperty( this, 'id', { value: textureId ++ } ); - - this.uuid = _Math.generateUUID(); - - this.name = ''; - - this.image = image !== undefined ? image : Texture.DEFAULT_IMAGE; - this.mipmaps = []; - - this.mapping = mapping !== undefined ? mapping : Texture.DEFAULT_MAPPING; - - this.wrapS = wrapS !== undefined ? wrapS : ClampToEdgeWrapping; - this.wrapT = wrapT !== undefined ? wrapT : ClampToEdgeWrapping; - - this.magFilter = magFilter !== undefined ? magFilter : LinearFilter; - this.minFilter = minFilter !== undefined ? minFilter : LinearMipMapLinearFilter; - - this.anisotropy = anisotropy !== undefined ? anisotropy : 1; - - this.format = format !== undefined ? format : RGBAFormat; - this.type = type !== undefined ? type : UnsignedByteType; - - this.offset = new Vector2( 0, 0 ); - this.repeat = new Vector2( 1, 1 ); - - this.generateMipmaps = true; - this.premultiplyAlpha = false; - this.flipY = true; - this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml) - - - // Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap. - // - // Also changing the encoding after already used by a Material will not automatically make the Material - // update. You need to explicitly call Material.needsUpdate to trigger it to recompile. - this.encoding = encoding !== undefined ? encoding : LinearEncoding; - - this.version = 0; - this.onUpdate = null; - -} - -Texture.DEFAULT_IMAGE = undefined; -Texture.DEFAULT_MAPPING = UVMapping; - -Texture.prototype = { - - constructor: Texture, - - isTexture: true, - - set needsUpdate( value ) { - - if ( value === true ) this.version ++; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.image = source.image; - this.mipmaps = source.mipmaps.slice( 0 ); - - this.mapping = source.mapping; - - this.wrapS = source.wrapS; - this.wrapT = source.wrapT; - - this.magFilter = source.magFilter; - this.minFilter = source.minFilter; - - this.anisotropy = source.anisotropy; - - this.format = source.format; - this.type = source.type; - - this.offset.copy( source.offset ); - this.repeat.copy( source.repeat ); - - this.generateMipmaps = source.generateMipmaps; - this.premultiplyAlpha = source.premultiplyAlpha; - this.flipY = source.flipY; - this.unpackAlignment = source.unpackAlignment; - this.encoding = source.encoding; - - return this; - - }, - - toJSON: function ( meta ) { - - if ( meta.textures[ this.uuid ] !== undefined ) { - - return meta.textures[ this.uuid ]; - - } - - function getDataURL( image ) { - - var canvas; - - if ( image.toDataURL !== undefined ) { - - canvas = image; - - } else { - - canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.width = image.width; - canvas.height = image.height; - - canvas.getContext( '2d' ).drawImage( image, 0, 0, image.width, image.height ); - - } - - if ( canvas.width > 2048 || canvas.height > 2048 ) { - - return canvas.toDataURL( 'image/jpeg', 0.6 ); - - } else { - - return canvas.toDataURL( 'image/png' ); - - } - - } - - var output = { - metadata: { - version: 4.4, - type: 'Texture', - generator: 'Texture.toJSON' - }, - - uuid: this.uuid, - name: this.name, - - mapping: this.mapping, - - repeat: [ this.repeat.x, this.repeat.y ], - offset: [ this.offset.x, this.offset.y ], - wrap: [ this.wrapS, this.wrapT ], - - minFilter: this.minFilter, - magFilter: this.magFilter, - anisotropy: this.anisotropy, - - flipY: this.flipY - }; - - if ( this.image !== undefined ) { - - // TODO: Move to THREE.Image - - var image = this.image; - - if ( image.uuid === undefined ) { - - image.uuid = _Math.generateUUID(); // UGH - - } - - if ( meta.images[ image.uuid ] === undefined ) { - - meta.images[ image.uuid ] = { - uuid: image.uuid, - url: getDataURL( image ) - }; - - } - - output.image = image.uuid; - - } - - meta.textures[ this.uuid ] = output; - - return output; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - }, - - transformUv: function ( uv ) { - - if ( this.mapping !== UVMapping ) return; - - uv.multiply( this.repeat ); - uv.add( this.offset ); - - if ( uv.x < 0 || uv.x > 1 ) { - - switch ( this.wrapS ) { - - case RepeatWrapping: - - uv.x = uv.x - Math.floor( uv.x ); - break; - - case ClampToEdgeWrapping: - - uv.x = uv.x < 0 ? 0 : 1; - break; - - case MirroredRepeatWrapping: - - if ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) { - - uv.x = Math.ceil( uv.x ) - uv.x; - - } else { - - uv.x = uv.x - Math.floor( uv.x ); - - } - break; - - } - - } - - if ( uv.y < 0 || uv.y > 1 ) { - - switch ( this.wrapT ) { - - case RepeatWrapping: - - uv.y = uv.y - Math.floor( uv.y ); - break; - - case ClampToEdgeWrapping: - - uv.y = uv.y < 0 ? 0 : 1; - break; - - case MirroredRepeatWrapping: - - if ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) { - - uv.y = Math.ceil( uv.y ) - uv.y; - - } else { - - uv.y = uv.y - Math.floor( uv.y ); - - } - break; - - } - - } - - if ( this.flipY ) { - - uv.y = 1 - uv.y; - - } - - } - -}; - -Object.assign( Texture.prototype, EventDispatcher.prototype ); - -/** - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author philogb / http://blog.thejit.org/ - * @author mikael emtinger / http://gomo.se/ - * @author egraether / http://egraether.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -function Vector4( x, y, z, w ) { - - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = ( w !== undefined ) ? w : 1; - -} - -Vector4.prototype = { - - constructor: Vector4, - - isVector4: true, - - set: function ( x, y, z, w ) { - - this.x = x; - this.y = y; - this.z = z; - this.w = w; - - return this; - - }, - - setScalar: function ( scalar ) { - - this.x = scalar; - this.y = scalar; - this.z = scalar; - this.w = scalar; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setZ: function ( z ) { - - this.z = z; - - return this; - - }, - - setW: function ( w ) { - - this.w = w; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - case 3: this.w = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - return this; - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - case 3: return this.w; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - clone: function () { - - return new this.constructor( this.x, this.y, this.z, this.w ); - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - this.w = ( v.w !== undefined ) ? v.w : 1; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - this.z += s; - this.w += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - this.w = a.w + b.w; - - return this; - - }, - - addScaledVector: function ( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - this.w += v.w * s; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - this.z -= s; - this.w -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - this.w = a.w - b.w; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - if ( isFinite( scalar ) ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - this.w *= scalar; - - } else { - - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 0; - - } - - return this; - - }, - - applyMatrix4: function ( m ) { - - var x = this.x, y = this.y, z = this.z, w = this.w; - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w; - this.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w; - - return this; - - }, - - divideScalar: function ( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - }, - - setAxisAngleFromQuaternion: function ( q ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm - - // q is assumed to be normalized - - this.w = 2 * Math.acos( q.w ); - - var s = Math.sqrt( 1 - q.w * q.w ); - - if ( s < 0.0001 ) { - - this.x = 1; - this.y = 0; - this.z = 0; - - } else { - - this.x = q.x / s; - this.y = q.y / s; - this.z = q.z / s; - - } - - return this; - - }, - - setAxisAngleFromRotationMatrix: function ( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var angle, x, y, z, // variables for result - epsilon = 0.01, // margin to allow for rounding errors - epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees - - te = m.elements, - - m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ], - m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ], - m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; - - if ( ( Math.abs( m12 - m21 ) < epsilon ) && - ( Math.abs( m13 - m31 ) < epsilon ) && - ( Math.abs( m23 - m32 ) < epsilon ) ) { - - // singularity found - // first check for identity matrix which must have +1 for all terms - // in leading diagonal and zero in other terms - - if ( ( Math.abs( m12 + m21 ) < epsilon2 ) && - ( Math.abs( m13 + m31 ) < epsilon2 ) && - ( Math.abs( m23 + m32 ) < epsilon2 ) && - ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) { - - // this singularity is identity matrix so angle = 0 - - this.set( 1, 0, 0, 0 ); - - return this; // zero angle, arbitrary axis - - } - - // otherwise this singularity is angle = 180 - - angle = Math.PI; - - var xx = ( m11 + 1 ) / 2; - var yy = ( m22 + 1 ) / 2; - var zz = ( m33 + 1 ) / 2; - var xy = ( m12 + m21 ) / 4; - var xz = ( m13 + m31 ) / 4; - var yz = ( m23 + m32 ) / 4; - - if ( ( xx > yy ) && ( xx > zz ) ) { - - // m11 is the largest diagonal term - - if ( xx < epsilon ) { - - x = 0; - y = 0.707106781; - z = 0.707106781; - - } else { - - x = Math.sqrt( xx ); - y = xy / x; - z = xz / x; - - } - - } else if ( yy > zz ) { - - // m22 is the largest diagonal term - - if ( yy < epsilon ) { - - x = 0.707106781; - y = 0; - z = 0.707106781; - - } else { - - y = Math.sqrt( yy ); - x = xy / y; - z = yz / y; - - } - - } else { - - // m33 is the largest diagonal term so base result on this - - if ( zz < epsilon ) { - - x = 0.707106781; - y = 0.707106781; - z = 0; - - } else { - - z = Math.sqrt( zz ); - x = xz / z; - y = yz / z; - - } - - } - - this.set( x, y, z, angle ); - - return this; // return 180 deg rotation - - } - - // as we have reached here there are no singularities so we can handle normally - - var s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) + - ( m13 - m31 ) * ( m13 - m31 ) + - ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize - - if ( Math.abs( s ) < 0.001 ) s = 1; - - // prevent divide by zero, should not happen if matrix is orthogonal and should be - // caught by singularity test above, but I've left it in just in case - - this.x = ( m32 - m23 ) / s; - this.y = ( m13 - m31 ) / s; - this.z = ( m21 - m12 ) / s; - this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 ); - - return this; - - }, - - min: function ( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - this.z = Math.min( this.z, v.z ); - this.w = Math.min( this.w, v.w ); - - return this; - - }, - - max: function ( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - this.z = Math.max( this.z, v.z ); - this.w = Math.max( this.w, v.w ); - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - this.z = Math.max( min.z, Math.min( max.z, this.z ) ); - this.w = Math.max( min.w, Math.min( max.w, this.w ) ); - - return this; - - }, - - clampScalar: function () { - - var min, max; - - return function clampScalar( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new Vector4(); - max = new Vector4(); - - } - - min.set( minVal, minVal, minVal, minVal ); - max.set( maxVal, maxVal, maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - }(), - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - this.w = Math.floor( this.w ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - this.w = Math.ceil( this.w ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - this.w = Math.round( this.w ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - this.z = - this.z; - this.w = - this.w; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); - - }, - - lengthManhattan: function () { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - setLength: function ( length ) { - - return this.multiplyScalar( length / this.length() ); - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - this.w += ( v.w - this.w ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - this.z = array[ offset + 2 ]; - this.w = array[ offset + 3 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - array[ offset + 2 ] = this.z; - array[ offset + 3 ] = this.w; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - this.z = attribute.array[ index + 2 ]; - this.w = attribute.array[ index + 3 ]; - - return this; - - } - -}; - -/** - * @author szimek / https://github.com/szimek/ - * @author alteredq / http://alteredqualia.com/ - * @author Marius Kintel / https://github.com/kintel - */ - -/* - In options, we can specify: - * Texture parameters for an auto-generated target texture - * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers -*/ -function WebGLRenderTarget( width, height, options ) { - - this.uuid = _Math.generateUUID(); - - this.width = width; - this.height = height; - - this.scissor = new Vector4( 0, 0, width, height ); - this.scissorTest = false; - - this.viewport = new Vector4( 0, 0, width, height ); - - options = options || {}; - - if ( options.minFilter === undefined ) options.minFilter = LinearFilter; - - this.texture = new Texture( undefined, undefined, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding ); - - this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; - this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true; - this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null; - -} - -Object.assign( WebGLRenderTarget.prototype, EventDispatcher.prototype, { - - isWebGLRenderTarget: true, - - setSize: function ( width, height ) { - - if ( this.width !== width || this.height !== height ) { - - this.width = width; - this.height = height; - - this.dispose(); - - } - - this.viewport.set( 0, 0, width, height ); - this.scissor.set( 0, 0, width, height ); - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.width = source.width; - this.height = source.height; - - this.viewport.copy( source.viewport ); - - this.texture = source.texture.clone(); - - this.depthBuffer = source.depthBuffer; - this.stencilBuffer = source.stencilBuffer; - this.depthTexture = source.depthTexture; - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -} ); - -/** - * @author alteredq / http://alteredqualia.com - */ - -function WebGLRenderTargetCube( width, height, options ) { - - WebGLRenderTarget.call( this, width, height, options ); - - this.activeCubeFace = 0; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5 - this.activeMipMapLevel = 0; - -} - -WebGLRenderTargetCube.prototype = Object.create( WebGLRenderTarget.prototype ); -WebGLRenderTargetCube.prototype.constructor = WebGLRenderTargetCube; - -WebGLRenderTargetCube.prototype.isWebGLRenderTargetCube = true; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://clara.io - */ - -function Quaternion( x, y, z, w ) { - - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._w = ( w !== undefined ) ? w : 1; - -} - -Quaternion.prototype = { - - constructor: Quaternion, - - get x () { - - return this._x; - - }, - - set x ( value ) { - - this._x = value; - this.onChangeCallback(); - - }, - - get y () { - - return this._y; - - }, - - set y ( value ) { - - this._y = value; - this.onChangeCallback(); - - }, - - get z () { - - return this._z; - - }, - - set z ( value ) { - - this._z = value; - this.onChangeCallback(); - - }, - - get w () { - - return this._w; - - }, - - set w ( value ) { - - this._w = value; - this.onChangeCallback(); - - }, - - set: function ( x, y, z, w ) { - - this._x = x; - this._y = y; - this._z = z; - this._w = w; - - this.onChangeCallback(); - - return this; - - }, - - clone: function () { - - return new this.constructor( this._x, this._y, this._z, this._w ); - - }, - - copy: function ( quaternion ) { - - this._x = quaternion.x; - this._y = quaternion.y; - this._z = quaternion.z; - this._w = quaternion.w; - - this.onChangeCallback(); - - return this; - - }, - - setFromEuler: function ( euler, update ) { - - if ( (euler && euler.isEuler) === false ) { - - throw new Error( 'THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.' ); - - } - - // http://www.mathworks.com/matlabcentral/fileexchange/ - // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ - // content/SpinCalc.m - - var c1 = Math.cos( euler._x / 2 ); - var c2 = Math.cos( euler._y / 2 ); - var c3 = Math.cos( euler._z / 2 ); - var s1 = Math.sin( euler._x / 2 ); - var s2 = Math.sin( euler._y / 2 ); - var s3 = Math.sin( euler._z / 2 ); - - var order = euler.order; - - if ( order === 'XYZ' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( order === 'YXZ' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } else if ( order === 'ZXY' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( order === 'ZYX' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } else if ( order === 'YZX' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( order === 'XZY' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } - - if ( update !== false ) this.onChangeCallback(); - - return this; - - }, - - setFromAxisAngle: function ( axis, angle ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm - - // assumes axis is normalized - - var halfAngle = angle / 2, s = Math.sin( halfAngle ); - - this._x = axis.x * s; - this._y = axis.y * s; - this._z = axis.z * s; - this._w = Math.cos( halfAngle ); - - this.onChangeCallback(); - - return this; - - }, - - setFromRotationMatrix: function ( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var te = m.elements, - - m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ], - m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ], - m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ], - - trace = m11 + m22 + m33, - s; - - if ( trace > 0 ) { - - s = 0.5 / Math.sqrt( trace + 1.0 ); - - this._w = 0.25 / s; - this._x = ( m32 - m23 ) * s; - this._y = ( m13 - m31 ) * s; - this._z = ( m21 - m12 ) * s; - - } else if ( m11 > m22 && m11 > m33 ) { - - s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 ); - - this._w = ( m32 - m23 ) / s; - this._x = 0.25 * s; - this._y = ( m12 + m21 ) / s; - this._z = ( m13 + m31 ) / s; - - } else if ( m22 > m33 ) { - - s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 ); - - this._w = ( m13 - m31 ) / s; - this._x = ( m12 + m21 ) / s; - this._y = 0.25 * s; - this._z = ( m23 + m32 ) / s; - - } else { - - s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 ); - - this._w = ( m21 - m12 ) / s; - this._x = ( m13 + m31 ) / s; - this._y = ( m23 + m32 ) / s; - this._z = 0.25 * s; - - } - - this.onChangeCallback(); - - return this; - - }, - - setFromUnitVectors: function () { - - // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final - - // assumes direction vectors vFrom and vTo are normalized - - var v1, r; - - var EPS = 0.000001; - - return function setFromUnitVectors( vFrom, vTo ) { - - if ( v1 === undefined ) v1 = new Vector3(); - - r = vFrom.dot( vTo ) + 1; - - if ( r < EPS ) { - - r = 0; - - if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { - - v1.set( - vFrom.y, vFrom.x, 0 ); - - } else { - - v1.set( 0, - vFrom.z, vFrom.y ); - - } - - } else { - - v1.crossVectors( vFrom, vTo ); - - } - - this._x = v1.x; - this._y = v1.y; - this._z = v1.z; - this._w = r; - - return this.normalize(); - - }; - - }(), - - inverse: function () { - - return this.conjugate().normalize(); - - }, - - conjugate: function () { - - this._x *= - 1; - this._y *= - 1; - this._z *= - 1; - - this.onChangeCallback(); - - return this; - - }, - - dot: function ( v ) { - - return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w; - - }, - - lengthSq: function () { - - return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - - }, - - length: function () { - - return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w ); - - }, - - normalize: function () { - - var l = this.length(); - - if ( l === 0 ) { - - this._x = 0; - this._y = 0; - this._z = 0; - this._w = 1; - - } else { - - l = 1 / l; - - this._x = this._x * l; - this._y = this._y * l; - this._z = this._z * l; - this._w = this._w * l; - - } - - this.onChangeCallback(); - - return this; - - }, - - multiply: function ( q, p ) { - - if ( p !== undefined ) { - - console.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' ); - return this.multiplyQuaternions( q, p ); - - } - - return this.multiplyQuaternions( this, q ); - - }, - - premultiply: function ( q ) { - - return this.multiplyQuaternions( q, this ); - - }, - - multiplyQuaternions: function ( a, b ) { - - // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm - - var qax = a._x, qay = a._y, qaz = a._z, qaw = a._w; - var qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w; - - this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; - this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; - this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; - this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - - this.onChangeCallback(); - - return this; - - }, - - slerp: function ( qb, t ) { - - if ( t === 0 ) return this; - if ( t === 1 ) return this.copy( qb ); - - var x = this._x, y = this._y, z = this._z, w = this._w; - - // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ - - var cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; - - if ( cosHalfTheta < 0 ) { - - this._w = - qb._w; - this._x = - qb._x; - this._y = - qb._y; - this._z = - qb._z; - - cosHalfTheta = - cosHalfTheta; - - } else { - - this.copy( qb ); - - } - - if ( cosHalfTheta >= 1.0 ) { - - this._w = w; - this._x = x; - this._y = y; - this._z = z; - - return this; - - } - - var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); - - if ( Math.abs( sinHalfTheta ) < 0.001 ) { - - this._w = 0.5 * ( w + this._w ); - this._x = 0.5 * ( x + this._x ); - this._y = 0.5 * ( y + this._y ); - this._z = 0.5 * ( z + this._z ); - - return this; - - } - - var halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta ); - var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, - ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; - - this._w = ( w * ratioA + this._w * ratioB ); - this._x = ( x * ratioA + this._x * ratioB ); - this._y = ( y * ratioA + this._y * ratioB ); - this._z = ( z * ratioA + this._z * ratioB ); - - this.onChangeCallback(); - - return this; - - }, - - equals: function ( quaternion ) { - - return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this._x = array[ offset ]; - this._y = array[ offset + 1 ]; - this._z = array[ offset + 2 ]; - this._w = array[ offset + 3 ]; - - this.onChangeCallback(); - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this._x; - array[ offset + 1 ] = this._y; - array[ offset + 2 ] = this._z; - array[ offset + 3 ] = this._w; - - return array; - - }, - - onChange: function ( callback ) { - - this.onChangeCallback = callback; - - return this; - - }, - - onChangeCallback: function () {} - -}; - -Object.assign( Quaternion, { - - slerp: function( qa, qb, qm, t ) { - - return qm.copy( qa ).slerp( qb, t ); - - }, - - slerpFlat: function( - dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) { - - // fuzz-free, array-based Quaternion SLERP operation - - var x0 = src0[ srcOffset0 + 0 ], - y0 = src0[ srcOffset0 + 1 ], - z0 = src0[ srcOffset0 + 2 ], - w0 = src0[ srcOffset0 + 3 ], - - x1 = src1[ srcOffset1 + 0 ], - y1 = src1[ srcOffset1 + 1 ], - z1 = src1[ srcOffset1 + 2 ], - w1 = src1[ srcOffset1 + 3 ]; - - if ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) { - - var s = 1 - t, - - cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, - - dir = ( cos >= 0 ? 1 : - 1 ), - sqrSin = 1 - cos * cos; - - // Skip the Slerp for tiny steps to avoid numeric problems: - if ( sqrSin > Number.EPSILON ) { - - var sin = Math.sqrt( sqrSin ), - len = Math.atan2( sin, cos * dir ); - - s = Math.sin( s * len ) / sin; - t = Math.sin( t * len ) / sin; - - } - - var tDir = t * dir; - - x0 = x0 * s + x1 * tDir; - y0 = y0 * s + y1 * tDir; - z0 = z0 * s + z1 * tDir; - w0 = w0 * s + w1 * tDir; - - // Normalize in case we just did a lerp: - if ( s === 1 - t ) { - - var f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 ); - - x0 *= f; - y0 *= f; - z0 *= f; - w0 *= f; - - } - - } - - dst[ dstOffset ] = x0; - dst[ dstOffset + 1 ] = y0; - dst[ dstOffset + 2 ] = z0; - dst[ dstOffset + 3 ] = w0; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author *kile / http://kile.stravaganza.org/ - * @author philogb / http://blog.thejit.org/ - * @author mikael emtinger / http://gomo.se/ - * @author egraether / http://egraether.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -function Vector3( x, y, z ) { - - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - -} - -Vector3.prototype = { - - constructor: Vector3, - - isVector3: true, - - set: function ( x, y, z ) { - - this.x = x; - this.y = y; - this.z = z; - - return this; - - }, - - setScalar: function ( scalar ) { - - this.x = scalar; - this.y = scalar; - this.z = scalar; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setZ: function ( z ) { - - this.z = z; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - return this; - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - clone: function () { - - return new this.constructor( this.x, this.y, this.z ); - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - this.z += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - - return this; - - }, - - addScaledVector: function ( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - this.z -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - - return this; - - }, - - multiply: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' ); - return this.multiplyVectors( v, w ); - - } - - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - if ( isFinite( scalar ) ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - - } else { - - this.x = 0; - this.y = 0; - this.z = 0; - - } - - return this; - - }, - - multiplyVectors: function ( a, b ) { - - this.x = a.x * b.x; - this.y = a.y * b.y; - this.z = a.z * b.z; - - return this; - - }, - - applyEuler: function () { - - var quaternion; - - return function applyEuler( euler ) { - - if ( (euler && euler.isEuler) === false ) { - - console.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' ); - - } - - if ( quaternion === undefined ) quaternion = new Quaternion(); - - return this.applyQuaternion( quaternion.setFromEuler( euler ) ); - - }; - - }(), - - applyAxisAngle: function () { - - var quaternion; - - return function applyAxisAngle( axis, angle ) { - - if ( quaternion === undefined ) quaternion = new Quaternion(); - - return this.applyQuaternion( quaternion.setFromAxisAngle( axis, angle ) ); - - }; - - }(), - - applyMatrix3: function ( m ) { - - var x = this.x, y = this.y, z = this.z; - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z; - this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z; - this.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z; - - return this; - - }, - - applyMatrix4: function ( m ) { - - // input: THREE.Matrix4 affine matrix - - var x = this.x, y = this.y, z = this.z; - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ]; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ]; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ]; - - return this; - - }, - - applyProjection: function ( m ) { - - // input: THREE.Matrix4 projection matrix - - var x = this.x, y = this.y, z = this.z; - var e = m.elements; - var d = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] ); // perspective divide - - this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * d; - this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * d; - this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * d; - - return this; - - }, - - applyQuaternion: function ( q ) { - - var x = this.x, y = this.y, z = this.z; - var qx = q.x, qy = q.y, qz = q.z, qw = q.w; - - // calculate quat * vector - - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = - qx * x - qy * y - qz * z; - - // calculate result * inverse quat - - this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; - this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; - this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; - - return this; - - }, - - project: function () { - - var matrix; - - return function project( camera ) { - - if ( matrix === undefined ) matrix = new Matrix4(); - - matrix.multiplyMatrices( camera.projectionMatrix, matrix.getInverse( camera.matrixWorld ) ); - return this.applyProjection( matrix ); - - }; - - }(), - - unproject: function () { - - var matrix; - - return function unproject( camera ) { - - if ( matrix === undefined ) matrix = new Matrix4(); - - matrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) ); - return this.applyProjection( matrix ); - - }; - - }(), - - transformDirection: function ( m ) { - - // input: THREE.Matrix4 affine matrix - // vector interpreted as a direction - - var x = this.x, y = this.y, z = this.z; - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z; - - return this.normalize(); - - }, - - divide: function ( v ) { - - this.x /= v.x; - this.y /= v.y; - this.z /= v.z; - - return this; - - }, - - divideScalar: function ( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - }, - - min: function ( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - this.z = Math.min( this.z, v.z ); - - return this; - - }, - - max: function ( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - this.z = Math.max( this.z, v.z ); - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - this.z = Math.max( min.z, Math.min( max.z, this.z ) ); - - return this; - - }, - - clampScalar: function () { - - var min, max; - - return function clampScalar( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new Vector3(); - max = new Vector3(); - - } - - min.set( minVal, minVal, minVal ); - max.set( maxVal, maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - }(), - - clampLength: function ( min, max ) { - - var length = this.length(); - - return this.multiplyScalar( Math.max( min, Math.min( max, length ) ) / length ); - - }, - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - this.z = - this.z; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y + this.z * this.z; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); - - }, - - lengthManhattan: function () { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - setLength: function ( length ) { - - return this.multiplyScalar( length / this.length() ); - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - }, - - cross: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' ); - return this.crossVectors( v, w ); - - } - - var x = this.x, y = this.y, z = this.z; - - this.x = y * v.z - z * v.y; - this.y = z * v.x - x * v.z; - this.z = x * v.y - y * v.x; - - return this; - - }, - - crossVectors: function ( a, b ) { - - var ax = a.x, ay = a.y, az = a.z; - var bx = b.x, by = b.y, bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - - }, - - projectOnVector: function ( vector ) { - - var scalar = vector.dot( this ) / vector.lengthSq(); - - return this.copy( vector ).multiplyScalar( scalar ); - - }, - - projectOnPlane: function () { - - var v1; - - return function projectOnPlane( planeNormal ) { - - if ( v1 === undefined ) v1 = new Vector3(); - - v1.copy( this ).projectOnVector( planeNormal ); - - return this.sub( v1 ); - - }; - - }(), - - reflect: function () { - - // reflect incident vector off plane orthogonal to normal - // normal is assumed to have unit length - - var v1; - - return function reflect( normal ) { - - if ( v1 === undefined ) v1 = new Vector3(); - - return this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) ); - - }; - - }(), - - angleTo: function ( v ) { - - var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) ); - - // clamp, to handle numerical problems - - return Math.acos( _Math.clamp( theta, - 1, 1 ) ); - - }, - - distanceTo: function ( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - }, - - distanceToSquared: function ( v ) { - - var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; - - return dx * dx + dy * dy + dz * dz; - - }, - - distanceToManhattan: function ( v ) { - - return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z ); - - }, - - setFromSpherical: function( s ) { - - var sinPhiRadius = Math.sin( s.phi ) * s.radius; - - this.x = sinPhiRadius * Math.sin( s.theta ); - this.y = Math.cos( s.phi ) * s.radius; - this.z = sinPhiRadius * Math.cos( s.theta ); - - return this; - - }, - - setFromMatrixPosition: function ( m ) { - - return this.setFromMatrixColumn( m, 3 ); - - }, - - setFromMatrixScale: function ( m ) { - - var sx = this.setFromMatrixColumn( m, 0 ).length(); - var sy = this.setFromMatrixColumn( m, 1 ).length(); - var sz = this.setFromMatrixColumn( m, 2 ).length(); - - this.x = sx; - this.y = sy; - this.z = sz; - - return this; - - }, - - setFromMatrixColumn: function ( m, index ) { - - if ( typeof m === 'number' ) { - - console.warn( 'THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).' ); - var temp = m; - m = index; - index = temp; - - } - - return this.fromArray( m.elements, index * 4 ); - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - this.z = array[ offset + 2 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - array[ offset + 2 ] = this.z; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - this.z = attribute.array[ index + 2 ]; - - return this; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author philogb / http://blog.thejit.org/ - * @author jordi_ros / http://plattsoft.com - * @author D1plo1d / http://github.com/D1plo1d - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author timknip / http://www.floorplanner.com/ - * @author bhouston / http://clara.io - * @author WestLangley / http://github.com/WestLangley - */ - -function Matrix4() { - - this.elements = new Float64Array( [ - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ] ); - - if ( arguments.length > 0 ) { - - console.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' ); - - } - -} - -Matrix4.prototype = { - - constructor: Matrix4, - - isMatrix4: true, - - set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) { - - var te = this.elements; - - te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14; - te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24; - te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34; - te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44; - - return this; - - }, - - identity: function () { - - this.set( - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - clone: function () { - - return new Matrix4().fromArray( this.elements ); - - }, - - copy: function ( m ) { - - this.elements.set( m.elements ); - - return this; - - }, - - copyPosition: function ( m ) { - - var te = this.elements; - var me = m.elements; - - te[ 12 ] = me[ 12 ]; - te[ 13 ] = me[ 13 ]; - te[ 14 ] = me[ 14 ]; - - return this; - - }, - - extractBasis: function ( xAxis, yAxis, zAxis ) { - - xAxis.setFromMatrixColumn( this, 0 ); - yAxis.setFromMatrixColumn( this, 1 ); - zAxis.setFromMatrixColumn( this, 2 ); - - return this; - - }, - - makeBasis: function ( xAxis, yAxis, zAxis ) { - - this.set( - xAxis.x, yAxis.x, zAxis.x, 0, - xAxis.y, yAxis.y, zAxis.y, 0, - xAxis.z, yAxis.z, zAxis.z, 0, - 0, 0, 0, 1 - ); - - return this; - - }, - - extractRotation: function () { - - var v1; - - return function extractRotation( m ) { - - if ( v1 === undefined ) v1 = new Vector3(); - - var te = this.elements; - var me = m.elements; - - var scaleX = 1 / v1.setFromMatrixColumn( m, 0 ).length(); - var scaleY = 1 / v1.setFromMatrixColumn( m, 1 ).length(); - var scaleZ = 1 / v1.setFromMatrixColumn( m, 2 ).length(); - - te[ 0 ] = me[ 0 ] * scaleX; - te[ 1 ] = me[ 1 ] * scaleX; - te[ 2 ] = me[ 2 ] * scaleX; - - te[ 4 ] = me[ 4 ] * scaleY; - te[ 5 ] = me[ 5 ] * scaleY; - te[ 6 ] = me[ 6 ] * scaleY; - - te[ 8 ] = me[ 8 ] * scaleZ; - te[ 9 ] = me[ 9 ] * scaleZ; - te[ 10 ] = me[ 10 ] * scaleZ; - - return this; - - }; - - }(), - - makeRotationFromEuler: function ( euler ) { - - if ( (euler && euler.isEuler) === false ) { - - console.error( 'THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' ); - - } - - var te = this.elements; - - var x = euler.x, y = euler.y, z = euler.z; - var a = Math.cos( x ), b = Math.sin( x ); - var c = Math.cos( y ), d = Math.sin( y ); - var e = Math.cos( z ), f = Math.sin( z ); - - if ( euler.order === 'XYZ' ) { - - var ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[ 0 ] = c * e; - te[ 4 ] = - c * f; - te[ 8 ] = d; - - te[ 1 ] = af + be * d; - te[ 5 ] = ae - bf * d; - te[ 9 ] = - b * c; - - te[ 2 ] = bf - ae * d; - te[ 6 ] = be + af * d; - te[ 10 ] = a * c; - - } else if ( euler.order === 'YXZ' ) { - - var ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[ 0 ] = ce + df * b; - te[ 4 ] = de * b - cf; - te[ 8 ] = a * d; - - te[ 1 ] = a * f; - te[ 5 ] = a * e; - te[ 9 ] = - b; - - te[ 2 ] = cf * b - de; - te[ 6 ] = df + ce * b; - te[ 10 ] = a * c; - - } else if ( euler.order === 'ZXY' ) { - - var ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[ 0 ] = ce - df * b; - te[ 4 ] = - a * f; - te[ 8 ] = de + cf * b; - - te[ 1 ] = cf + de * b; - te[ 5 ] = a * e; - te[ 9 ] = df - ce * b; - - te[ 2 ] = - a * d; - te[ 6 ] = b; - te[ 10 ] = a * c; - - } else if ( euler.order === 'ZYX' ) { - - var ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[ 0 ] = c * e; - te[ 4 ] = be * d - af; - te[ 8 ] = ae * d + bf; - - te[ 1 ] = c * f; - te[ 5 ] = bf * d + ae; - te[ 9 ] = af * d - be; - - te[ 2 ] = - d; - te[ 6 ] = b * c; - te[ 10 ] = a * c; - - } else if ( euler.order === 'YZX' ) { - - var ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[ 0 ] = c * e; - te[ 4 ] = bd - ac * f; - te[ 8 ] = bc * f + ad; - - te[ 1 ] = f; - te[ 5 ] = a * e; - te[ 9 ] = - b * e; - - te[ 2 ] = - d * e; - te[ 6 ] = ad * f + bc; - te[ 10 ] = ac - bd * f; - - } else if ( euler.order === 'XZY' ) { - - var ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[ 0 ] = c * e; - te[ 4 ] = - f; - te[ 8 ] = d * e; - - te[ 1 ] = ac * f + bd; - te[ 5 ] = a * e; - te[ 9 ] = ad * f - bc; - - te[ 2 ] = bc * f - ad; - te[ 6 ] = b * e; - te[ 10 ] = bd * f + ac; - - } - - // last column - te[ 3 ] = 0; - te[ 7 ] = 0; - te[ 11 ] = 0; - - // bottom row - te[ 12 ] = 0; - te[ 13 ] = 0; - te[ 14 ] = 0; - te[ 15 ] = 1; - - return this; - - }, - - makeRotationFromQuaternion: function ( q ) { - - var te = this.elements; - - var x = q.x, y = q.y, z = q.z, w = q.w; - var x2 = x + x, y2 = y + y, z2 = z + z; - var xx = x * x2, xy = x * y2, xz = x * z2; - var yy = y * y2, yz = y * z2, zz = z * z2; - var wx = w * x2, wy = w * y2, wz = w * z2; - - te[ 0 ] = 1 - ( yy + zz ); - te[ 4 ] = xy - wz; - te[ 8 ] = xz + wy; - - te[ 1 ] = xy + wz; - te[ 5 ] = 1 - ( xx + zz ); - te[ 9 ] = yz - wx; - - te[ 2 ] = xz - wy; - te[ 6 ] = yz + wx; - te[ 10 ] = 1 - ( xx + yy ); - - // last column - te[ 3 ] = 0; - te[ 7 ] = 0; - te[ 11 ] = 0; - - // bottom row - te[ 12 ] = 0; - te[ 13 ] = 0; - te[ 14 ] = 0; - te[ 15 ] = 1; - - return this; - - }, - - lookAt: function () { - - var x, y, z; - - return function lookAt( eye, target, up ) { - - if ( x === undefined ) { - - x = new Vector3(); - y = new Vector3(); - z = new Vector3(); - - } - - var te = this.elements; - - z.subVectors( eye, target ).normalize(); - - if ( z.lengthSq() === 0 ) { - - z.z = 1; - - } - - x.crossVectors( up, z ).normalize(); - - if ( x.lengthSq() === 0 ) { - - z.z += 0.0001; - x.crossVectors( up, z ).normalize(); - - } - - y.crossVectors( z, x ); - - - te[ 0 ] = x.x; te[ 4 ] = y.x; te[ 8 ] = z.x; - te[ 1 ] = x.y; te[ 5 ] = y.y; te[ 9 ] = z.y; - te[ 2 ] = x.z; te[ 6 ] = y.z; te[ 10 ] = z.z; - - return this; - - }; - - }(), - - multiply: function ( m, n ) { - - if ( n !== undefined ) { - - console.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' ); - return this.multiplyMatrices( m, n ); - - } - - return this.multiplyMatrices( this, m ); - - }, - - premultiply: function ( m ) { - - return this.multiplyMatrices( m, this ); - - }, - - multiplyMatrices: function ( a, b ) { - - var ae = a.elements; - var be = b.elements; - var te = this.elements; - - var a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ]; - var a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ]; - var a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ]; - var a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ]; - - var b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ]; - var b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ]; - var b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ]; - var b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ]; - - te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; - te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; - te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; - te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44; - - te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41; - te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42; - te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43; - te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44; - - te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41; - te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42; - te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43; - te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44; - - te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41; - te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42; - te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; - te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; - - return this; - - }, - - multiplyToArray: function ( a, b, r ) { - - var te = this.elements; - - this.multiplyMatrices( a, b ); - - r[ 0 ] = te[ 0 ]; r[ 1 ] = te[ 1 ]; r[ 2 ] = te[ 2 ]; r[ 3 ] = te[ 3 ]; - r[ 4 ] = te[ 4 ]; r[ 5 ] = te[ 5 ]; r[ 6 ] = te[ 6 ]; r[ 7 ] = te[ 7 ]; - r[ 8 ] = te[ 8 ]; r[ 9 ] = te[ 9 ]; r[ 10 ] = te[ 10 ]; r[ 11 ] = te[ 11 ]; - r[ 12 ] = te[ 12 ]; r[ 13 ] = te[ 13 ]; r[ 14 ] = te[ 14 ]; r[ 15 ] = te[ 15 ]; - - return this; - - }, - - multiplyScalar: function ( s ) { - - var te = this.elements; - - te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s; - te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s; - te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s; - te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s; - - return this; - - }, - - applyToVector3Array: function () { - - var v1; - - return function applyToVector3Array( array, offset, length ) { - - if ( v1 === undefined ) v1 = new Vector3(); - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = array.length; - - for ( var i = 0, j = offset; i < length; i += 3, j += 3 ) { - - v1.fromArray( array, j ); - v1.applyMatrix4( this ); - v1.toArray( array, j ); - - } - - return array; - - }; - - }(), - - applyToBuffer: function () { - - var v1; - - return function applyToBuffer( buffer, offset, length ) { - - if ( v1 === undefined ) v1 = new Vector3(); - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = buffer.length / buffer.itemSize; - - for ( var i = 0, j = offset; i < length; i ++, j ++ ) { - - v1.x = buffer.getX( j ); - v1.y = buffer.getY( j ); - v1.z = buffer.getZ( j ); - - v1.applyMatrix4( this ); - - buffer.setXYZ( j, v1.x, v1.y, v1.z ); - - } - - return buffer; - - }; - - }(), - - determinant: function () { - - var te = this.elements; - - var n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ]; - var n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ]; - var n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ]; - var n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ]; - - //TODO: make this more efficient - //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm ) - - return ( - n41 * ( - + n14 * n23 * n32 - - n13 * n24 * n32 - - n14 * n22 * n33 - + n12 * n24 * n33 - + n13 * n22 * n34 - - n12 * n23 * n34 - ) + - n42 * ( - + n11 * n23 * n34 - - n11 * n24 * n33 - + n14 * n21 * n33 - - n13 * n21 * n34 - + n13 * n24 * n31 - - n14 * n23 * n31 - ) + - n43 * ( - + n11 * n24 * n32 - - n11 * n22 * n34 - - n14 * n21 * n32 - + n12 * n21 * n34 - + n14 * n22 * n31 - - n12 * n24 * n31 - ) + - n44 * ( - - n13 * n22 * n31 - - n11 * n23 * n32 - + n11 * n22 * n33 - + n13 * n21 * n32 - - n12 * n21 * n33 - + n12 * n23 * n31 - ) - - ); - - }, - - transpose: function () { - - var te = this.elements; - var tmp; - - tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp; - tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp; - tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp; - - tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp; - tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp; - tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp; - - return this; - - }, - - setPosition: function ( v ) { - - var te = this.elements; - - te[ 12 ] = v.x; - te[ 13 ] = v.y; - te[ 14 ] = v.z; - - return this; - - }, - - getInverse: function ( m, throwOnDegenerate ) { - - // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm - var te = this.elements, - me = m.elements, - - n11 = me[ 0 ], n21 = me[ 1 ], n31 = me[ 2 ], n41 = me[ 3 ], - n12 = me[ 4 ], n22 = me[ 5 ], n32 = me[ 6 ], n42 = me[ 7 ], - n13 = me[ 8 ], n23 = me[ 9 ], n33 = me[ 10 ], n43 = me[ 11 ], - n14 = me[ 12 ], n24 = me[ 13 ], n34 = me[ 14 ], n44 = me[ 15 ], - - t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, - t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, - t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, - t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; - - var det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14; - - if ( det === 0 ) { - - var msg = "THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"; - - if ( throwOnDegenerate === true ) { - - throw new Error( msg ); - - } else { - - console.warn( msg ); - - } - - return this.identity(); - - } - - var detInv = 1 / det; - - te[ 0 ] = t11 * detInv; - te[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv; - te[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv; - te[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv; - - te[ 4 ] = t12 * detInv; - te[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv; - te[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv; - te[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv; - - te[ 8 ] = t13 * detInv; - te[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv; - te[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv; - te[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv; - - te[ 12 ] = t14 * detInv; - te[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv; - te[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv; - te[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv; - - return this; - - }, - - scale: function ( v ) { - - var te = this.elements; - var x = v.x, y = v.y, z = v.z; - - te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z; - te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z; - te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z; - te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z; - - return this; - - }, - - getMaxScaleOnAxis: function () { - - var te = this.elements; - - var scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ]; - var scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ]; - var scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ]; - - return Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) ); - - }, - - makeTranslation: function ( x, y, z ) { - - this.set( - - 1, 0, 0, x, - 0, 1, 0, y, - 0, 0, 1, z, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationX: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - 1, 0, 0, 0, - 0, c, - s, 0, - 0, s, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationY: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, 0, s, 0, - 0, 1, 0, 0, - - s, 0, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationZ: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, - s, 0, 0, - s, c, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationAxis: function ( axis, angle ) { - - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - var c = Math.cos( angle ); - var s = Math.sin( angle ); - var t = 1 - c; - var x = axis.x, y = axis.y, z = axis.z; - var tx = t * x, ty = t * y; - - this.set( - - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeScale: function ( x, y, z ) { - - this.set( - - x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeShear: function ( x, y, z ) { - - this.set( - - 1, y, z, 0, - x, 1, z, 0, - x, y, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - compose: function ( position, quaternion, scale ) { - - this.makeRotationFromQuaternion( quaternion ); - this.scale( scale ); - this.setPosition( position ); - - return this; - - }, - - decompose: function () { - - var vector, matrix; - - return function decompose( position, quaternion, scale ) { - - if ( vector === undefined ) { - - vector = new Vector3(); - matrix = new Matrix4(); - - } - - var te = this.elements; - - var sx = vector.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length(); - var sy = vector.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length(); - var sz = vector.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length(); - - // if determine is negative, we need to invert one scale - var det = this.determinant(); - if ( det < 0 ) { - - sx = - sx; - - } - - position.x = te[ 12 ]; - position.y = te[ 13 ]; - position.z = te[ 14 ]; - - // scale the rotation part - - matrix.elements.set( this.elements ); // at this point matrix is incomplete so we can't use .copy() - - var invSX = 1 / sx; - var invSY = 1 / sy; - var invSZ = 1 / sz; - - matrix.elements[ 0 ] *= invSX; - matrix.elements[ 1 ] *= invSX; - matrix.elements[ 2 ] *= invSX; - - matrix.elements[ 4 ] *= invSY; - matrix.elements[ 5 ] *= invSY; - matrix.elements[ 6 ] *= invSY; - - matrix.elements[ 8 ] *= invSZ; - matrix.elements[ 9 ] *= invSZ; - matrix.elements[ 10 ] *= invSZ; - - quaternion.setFromRotationMatrix( matrix ); - - scale.x = sx; - scale.y = sy; - scale.z = sz; - - return this; - - }; - - }(), - - makeFrustum: function ( left, right, bottom, top, near, far ) { - - var te = this.elements; - var x = 2 * near / ( right - left ); - var y = 2 * near / ( top - bottom ); - - var a = ( right + left ) / ( right - left ); - var b = ( top + bottom ) / ( top - bottom ); - var c = - ( far + near ) / ( far - near ); - var d = - 2 * far * near / ( far - near ); - - te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0; - te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0; - te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d; - te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0; - - return this; - - }, - - makePerspective: function ( fov, aspect, near, far ) { - - var ymax = near * Math.tan( _Math.DEG2RAD * fov * 0.5 ); - var ymin = - ymax; - var xmin = ymin * aspect; - var xmax = ymax * aspect; - - return this.makeFrustum( xmin, xmax, ymin, ymax, near, far ); - - }, - - makeOrthographic: function ( left, right, top, bottom, near, far ) { - - var te = this.elements; - var w = 1.0 / ( right - left ); - var h = 1.0 / ( top - bottom ); - var p = 1.0 / ( far - near ); - - var x = ( right + left ) * w; - var y = ( top + bottom ) * h; - var z = ( far + near ) * p; - - te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x; - te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y; - te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z; - te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1; - - return this; - - }, - - equals: function ( matrix ) { - - var te = this.elements; - var me = matrix.elements; - - for ( var i = 0; i < 16; i ++ ) { - - if ( te[ i ] !== me[ i ] ) return false; - - } - - return true; - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - for( var i = 0; i < 16; i ++ ) { - - this.elements[ i ] = array[ i + offset ]; - - } - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - var te = this.elements; - - array[ offset ] = te[ 0 ]; - array[ offset + 1 ] = te[ 1 ]; - array[ offset + 2 ] = te[ 2 ]; - array[ offset + 3 ] = te[ 3 ]; - - array[ offset + 4 ] = te[ 4 ]; - array[ offset + 5 ] = te[ 5 ]; - array[ offset + 6 ] = te[ 6 ]; - array[ offset + 7 ] = te[ 7 ]; - - array[ offset + 8 ] = te[ 8 ]; - array[ offset + 9 ] = te[ 9 ]; - array[ offset + 10 ] = te[ 10 ]; - array[ offset + 11 ] = te[ 11 ]; - - array[ offset + 12 ] = te[ 12 ]; - array[ offset + 13 ] = te[ 13 ]; - array[ offset + 14 ] = te[ 14 ]; - array[ offset + 15 ] = te[ 15 ]; - - return array; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function CubeTexture( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) { - - images = images !== undefined ? images : []; - mapping = mapping !== undefined ? mapping : CubeReflectionMapping; - - Texture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - this.flipY = false; - -} - -CubeTexture.prototype = Object.create( Texture.prototype ); -CubeTexture.prototype.constructor = CubeTexture; - -CubeTexture.prototype.isCubeTexture = true; - -Object.defineProperty( CubeTexture.prototype, 'images', { - - get: function () { - - return this.image; - - }, - - set: function ( value ) { - - this.image = value; - - } - -} ); - -/** - * @author tschw - * - * Uniforms of a program. - * Those form a tree structure with a special top-level container for the root, - * which you get by calling 'new WebGLUniforms( gl, program, renderer )'. - * - * - * Properties of inner nodes including the top-level container: - * - * .seq - array of nested uniforms - * .map - nested uniforms by name - * - * - * Methods of all nodes except the top-level container: - * - * .setValue( gl, value, [renderer] ) - * - * uploads a uniform value(s) - * the 'renderer' parameter is needed for sampler uniforms - * - * - * Static methods of the top-level container (renderer factorizations): - * - * .upload( gl, seq, values, renderer ) - * - * sets uniforms in 'seq' to 'values[id].value' - * - * .seqWithValue( seq, values ) : filteredSeq - * - * filters 'seq' entries with corresponding entry in values - * - * - * Methods of the top-level container (renderer factorizations): - * - * .setValue( gl, name, value ) - * - * sets uniform with name 'name' to 'value' - * - * .set( gl, obj, prop ) - * - * sets uniform from object and property with same name than uniform - * - * .setOptional( gl, obj, prop ) - * - * like .set for an optional property of the object - * - */ - -var emptyTexture = new Texture(); -var emptyCubeTexture = new CubeTexture(); - -// --- Base for inner nodes (including the root) --- - -function UniformContainer() { - - this.seq = []; - this.map = {}; - -} - -// --- Utilities --- - -// Array Caches (provide typed arrays for temporary by size) - -var arrayCacheF32 = []; -var arrayCacheI32 = []; - -// Flattening for arrays of vectors and matrices - -function flatten( array, nBlocks, blockSize ) { - - var firstElem = array[ 0 ]; - - if ( firstElem <= 0 || firstElem > 0 ) return array; - // unoptimized: ! isNaN( firstElem ) - // see http://jacksondunstan.com/articles/983 - - var n = nBlocks * blockSize, - r = arrayCacheF32[ n ]; - - if ( r === undefined ) { - - r = new Float32Array( n ); - arrayCacheF32[ n ] = r; - - } - - if ( nBlocks !== 0 ) { - - firstElem.toArray( r, 0 ); - - for ( var i = 1, offset = 0; i !== nBlocks; ++ i ) { - - offset += blockSize; - array[ i ].toArray( r, offset ); - - } - - } - - return r; - -} - -// Texture unit allocation - -function allocTexUnits( renderer, n ) { - - var r = arrayCacheI32[ n ]; - - if ( r === undefined ) { - - r = new Int32Array( n ); - arrayCacheI32[ n ] = r; - - } - - for ( var i = 0; i !== n; ++ i ) - r[ i ] = renderer.allocTextureUnit(); - - return r; - -} - -// --- Setters --- - -// Note: Defining these methods externally, because they come in a bunch -// and this way their names minify. - -// Single scalar - -function setValue1f( gl, v ) { gl.uniform1f( this.addr, v ); } -function setValue1i( gl, v ) { gl.uniform1i( this.addr, v ); } - -// Single float vector (from flat array or THREE.VectorN) - -function setValue2fv( gl, v ) { - - if ( v.x === undefined ) gl.uniform2fv( this.addr, v ); - else gl.uniform2f( this.addr, v.x, v.y ); - -} - -function setValue3fv( gl, v ) { - - if ( v.x !== undefined ) - gl.uniform3f( this.addr, v.x, v.y, v.z ); - else if ( v.r !== undefined ) - gl.uniform3f( this.addr, v.r, v.g, v.b ); - else - gl.uniform3fv( this.addr, v ); - -} - -function setValue4fv( gl, v ) { - - if ( v.x === undefined ) gl.uniform4fv( this.addr, v ); - else gl.uniform4f( this.addr, v.x, v.y, v.z, v.w ); - -} - -// Single matrix (from flat array or MatrixN) - -function setValue2fm( gl, v ) { - - gl.uniformMatrix2fv( this.addr, false, v.elements || v ); - -} - -function setValue3fm( gl, v ) { - - gl.uniformMatrix3fv( this.addr, false, v.elements || v ); - -} - -function setValue4fm( gl, v ) { - - gl.uniformMatrix4fv( this.addr, false, new Float32Array(v.elements) || v ); - -} - -// Single texture (2D / Cube) - -function setValueT1( gl, v, renderer ) { - - var unit = renderer.allocTextureUnit(); - gl.uniform1i( this.addr, unit ); - renderer.setTexture2D( v || emptyTexture, unit ); - -} - -function setValueT6( gl, v, renderer ) { - - var unit = renderer.allocTextureUnit(); - gl.uniform1i( this.addr, unit ); - renderer.setTextureCube( v || emptyCubeTexture, unit ); - -} - -// Integer / Boolean vectors or arrays thereof (always flat arrays) - -function setValue2iv( gl, v ) { gl.uniform2iv( this.addr, v ); } -function setValue3iv( gl, v ) { gl.uniform3iv( this.addr, v ); } -function setValue4iv( gl, v ) { gl.uniform4iv( this.addr, v ); } - -// Helper to pick the right setter for the singular case - -function getSingularSetter( type ) { - - switch ( type ) { - - case 0x1406: return setValue1f; // FLOAT - case 0x8b50: return setValue2fv; // _VEC2 - case 0x8b51: return setValue3fv; // _VEC3 - case 0x8b52: return setValue4fv; // _VEC4 - - case 0x8b5a: return setValue2fm; // _MAT2 - case 0x8b5b: return setValue3fm; // _MAT3 - case 0x8b5c: return setValue4fm; // _MAT4 - - case 0x8b5e: return setValueT1; // SAMPLER_2D - case 0x8b60: return setValueT6; // SAMPLER_CUBE - - case 0x1404: case 0x8b56: return setValue1i; // INT, BOOL - case 0x8b53: case 0x8b57: return setValue2iv; // _VEC2 - case 0x8b54: case 0x8b58: return setValue3iv; // _VEC3 - case 0x8b55: case 0x8b59: return setValue4iv; // _VEC4 - - } - -} - -// Array of scalars - -function setValue1fv( gl, v ) { gl.uniform1fv( this.addr, v ); } -function setValue1iv( gl, v ) { gl.uniform1iv( this.addr, v ); } - -// Array of vectors (flat or from THREE classes) - -function setValueV2a( gl, v ) { - - gl.uniform2fv( this.addr, flatten( v, this.size, 2 ) ); - -} - -function setValueV3a( gl, v ) { - - gl.uniform3fv( this.addr, flatten( v, this.size, 3 ) ); - -} - -function setValueV4a( gl, v ) { - - gl.uniform4fv( this.addr, flatten( v, this.size, 4 ) ); - -} - -// Array of matrices (flat or from THREE clases) - -function setValueM2a( gl, v ) { - - gl.uniformMatrix2fv( this.addr, false, flatten( v, this.size, 4 ) ); - -} - -function setValueM3a( gl, v ) { - - gl.uniformMatrix3fv( this.addr, false, flatten( v, this.size, 9 ) ); - -} - -function setValueM4a( gl, v ) { - - gl.uniformMatrix4fv( this.addr, false, flatten( v, this.size, 16 ) ); - -} - -// Array of textures (2D / Cube) - -function setValueT1a( gl, v, renderer ) { - - var n = v.length, - units = allocTexUnits( renderer, n ); - - gl.uniform1iv( this.addr, units ); - - for ( var i = 0; i !== n; ++ i ) { - - renderer.setTexture2D( v[ i ] || emptyTexture, units[ i ] ); - - } - -} - -function setValueT6a( gl, v, renderer ) { - - var n = v.length, - units = allocTexUnits( renderer, n ); - - gl.uniform1iv( this.addr, units ); - - for ( var i = 0; i !== n; ++ i ) { - - renderer.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] ); - - } - -} - -// Helper to pick the right setter for a pure (bottom-level) array - -function getPureArraySetter( type ) { - - switch ( type ) { - - case 0x1406: return setValue1fv; // FLOAT - case 0x8b50: return setValueV2a; // _VEC2 - case 0x8b51: return setValueV3a; // _VEC3 - case 0x8b52: return setValueV4a; // _VEC4 - - case 0x8b5a: return setValueM2a; // _MAT2 - case 0x8b5b: return setValueM3a; // _MAT3 - case 0x8b5c: return setValueM4a; // _MAT4 - - case 0x8b5e: return setValueT1a; // SAMPLER_2D - case 0x8b60: return setValueT6a; // SAMPLER_CUBE - - case 0x1404: case 0x8b56: return setValue1iv; // INT, BOOL - case 0x8b53: case 0x8b57: return setValue2iv; // _VEC2 - case 0x8b54: case 0x8b58: return setValue3iv; // _VEC3 - case 0x8b55: case 0x8b59: return setValue4iv; // _VEC4 - - } - -} - -// --- Uniform Classes --- - -function SingleUniform( id, activeInfo, addr ) { - - this.id = id; - this.addr = addr; - this.setValue = getSingularSetter( activeInfo.type ); - - // this.path = activeInfo.name; // DEBUG - -} - -function PureArrayUniform( id, activeInfo, addr ) { - - this.id = id; - this.addr = addr; - this.size = activeInfo.size; - this.setValue = getPureArraySetter( activeInfo.type ); - - // this.path = activeInfo.name; // DEBUG - -} - -function StructuredUniform( id ) { - - this.id = id; - - UniformContainer.call( this ); // mix-in - -} - -StructuredUniform.prototype.setValue = function( gl, value ) { - - // Note: Don't need an extra 'renderer' parameter, since samplers - // are not allowed in structured uniforms. - - var seq = this.seq; - - for ( var i = 0, n = seq.length; i !== n; ++ i ) { - - var u = seq[ i ]; - u.setValue( gl, value[ u.id ] ); - - } - -}; - -// --- Top-level --- - -// Parser - builds up the property tree from the path strings - -var RePathPart = /([\w\d_]+)(\])?(\[|\.)?/g; - -// extracts -// - the identifier (member name or array index) -// - followed by an optional right bracket (found when array index) -// - followed by an optional left bracket or dot (type of subscript) -// -// Note: These portions can be read in a non-overlapping fashion and -// allow straightforward parsing of the hierarchy that WebGL encodes -// in the uniform names. - -function addUniform( container, uniformObject ) { - - container.seq.push( uniformObject ); - container.map[ uniformObject.id ] = uniformObject; - -} - -function parseUniform( activeInfo, addr, container ) { - - var path = activeInfo.name, - pathLength = path.length; - - // reset RegExp object, because of the early exit of a previous run - RePathPart.lastIndex = 0; - - for (; ;) { - - var match = RePathPart.exec( path ), - matchEnd = RePathPart.lastIndex, - - id = match[ 1 ], - idIsIndex = match[ 2 ] === ']', - subscript = match[ 3 ]; - - if ( idIsIndex ) id = id | 0; // convert to integer - - if ( subscript === undefined || - subscript === '[' && matchEnd + 2 === pathLength ) { - // bare name or "pure" bottom-level array "[0]" suffix - - addUniform( container, subscript === undefined ? - new SingleUniform( id, activeInfo, addr ) : - new PureArrayUniform( id, activeInfo, addr ) ); - - break; - - } else { - // step into inner node / create it in case it doesn't exist - - var map = container.map, - next = map[ id ]; - - if ( next === undefined ) { - - next = new StructuredUniform( id ); - addUniform( container, next ); - - } - - container = next; - - } - - } - -} - -// Root Container - -function WebGLUniforms( gl, program, renderer ) { - - UniformContainer.call( this ); - - this.renderer = renderer; - - var n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS ); - - for ( var i = 0; i !== n; ++ i ) { - - var info = gl.getActiveUniform( program, i ), - path = info.name, - addr = gl.getUniformLocation( program, path ); - - parseUniform( info, addr, this ); - - } - -} - -WebGLUniforms.prototype.setValue = function( gl, name, value ) { - - var u = this.map[ name ]; - - if ( u !== undefined ) u.setValue( gl, value, this.renderer ); - -}; - -WebGLUniforms.prototype.set = function( gl, object, name ) { - - var u = this.map[ name ]; - - if ( u !== undefined ) u.setValue( gl, object[ name ], this.renderer ); - -}; - -WebGLUniforms.prototype.setOptional = function( gl, object, name ) { - - var v = object[ name ]; - - if ( v !== undefined ) this.setValue( gl, name, v ); - -}; - - -// Static interface - -WebGLUniforms.upload = function( gl, seq, values, renderer ) { - - for ( var i = 0, n = seq.length; i !== n; ++ i ) { - - var u = seq[ i ], - v = values[ u.id ]; - - if ( v.needsUpdate !== false ) { - // note: always updating when .needsUpdate is undefined - - u.setValue( gl, v.value, renderer ); - - } - - } - -}; - -WebGLUniforms.seqWithValue = function( seq, values ) { - - var r = []; - - for ( var i = 0, n = seq.length; i !== n; ++ i ) { - - var u = seq[ i ]; - if ( u.id in values ) r.push( u ); - - } - - return r; - -}; - -var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n"; - -var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n"; - -var alphatest_fragment = "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n"; - -var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n"; - -var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif"; - -var begin_vertex = "\nvec3 transformed = vec3( position );\n"; - -var beginnormal_vertex = "\nvec3 objectNormal = vec3( normal );\n"; - -var bsdfs = "float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n"; - -var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n"; - -var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n"; - -var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n"; - -var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n"; - -var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n"; - -var color_fragment = "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif"; - -var color_pars_fragment = "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n"; - -var color_pars_vertex = "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif"; - -var color_vertex = "#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif"; - -var common = "#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n"; - -var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n"; - -var defaultnormal_vertex = "#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n"; - -var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n"; - -var displacementmap_vertex = "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n"; - -var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n"; - -var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n"; - -var encodings_fragment = " gl_FragColor = linearToOutputTexel( gl_FragColor );\n"; - -var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n"; - -var envmap_fragment = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n"; - -var envmap_pars_fragment = "#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n"; - -var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n"; - -var envmap_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n"; - -var fog_fragment = "#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n"; - -var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif"; - -var gradientmap_pars_fragment = "#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n"; - -var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n"; - -var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif"; - -var lights_lambert_vertex = "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n"; - -var lights_pars = "uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#include <normal_flip>\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#include <normal_flip>\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n"; - -var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n"; - -var lights_phong_pars_fragment = "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 matDiffColor = material.diffuseColor;\n vec3 matSpecColor = material.specularColor;\n vec3 lightColor = rectAreaLight.color;\n float roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n vec3 spec = Rect_Area_Light_Specular_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n roughness,\n ltcMat, ltcMag );\n vec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n reflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n reflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n }\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n"; - -var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n"; - -var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 matDiffColor = material.diffuseColor;\n vec3 matSpecColor = material.specularColor;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 spec = Rect_Area_Light_Specular_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n roughness,\n ltcMat, ltcMag );\n vec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n reflectedLight.directSpecular += lightColor * matSpecColor * spec;\n reflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n"; - -var lights_template = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n"; - -var logdepthbuf_fragment = "#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif"; - -var logdepthbuf_pars_fragment = "#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n"; - -var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif"; - -var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n"; - -var map_fragment = "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n"; - -var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n"; - -var map_particle_fragment = "#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n"; - -var map_particle_pars_fragment = "#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n"; - -var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n"; - -var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif"; - -var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n"; - -var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif"; - -var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n"; - -var normal_flip = "#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n"; - -var normal_fragment = "#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n"; - -var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n"; - -var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n"; - -var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n"; - -var project_vertex = "#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n"; - -var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n"; - -var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif"; - -var shadowmap_pars_fragment = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n #if NUM_RECT_AREA_LIGHTS > 0\n #endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n"; - -var shadowmap_pars_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n #if NUM_RECT_AREA_LIGHTS > 0\n #endif\n#endif\n"; - -var shadowmap_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n #if NUM_RECT_AREA_LIGHTS > 0\n #endif\n#endif\n"; - -var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\t#endif\n\t#endif\n\treturn shadow;\n}\n"; - -var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif"; - -var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n"; - -var skinning_vertex = "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n"; - -var skinnormal_vertex = "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n"; - -var specularmap_fragment = "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif"; - -var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif"; - -var tonemapping_fragment = "#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n"; - -var tonemapping_pars_fragment = "#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n"; - -var uv_pars_fragment = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif"; - -var uv_pars_vertex = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n"; - -var uv_vertex = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif"; - -var uv2_pars_fragment = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif"; - -var uv2_pars_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif"; - -var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif"; - -var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n"; - -var cube_frag = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n"; - -var cube_vert = "varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n"; - -var depth_frag = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n"; - -var depth_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n"; - -var distanceRGBA_frag = "uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n"; - -var distanceRGBA_vert = "varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n"; - -var equirect_frag = "uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n"; - -var equirect_vert = "varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n"; - -var linedashed_frag = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - -var linedashed_vert = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n"; - -var meshbasic_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - -var meshbasic_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n}\n"; - -var meshlambert_frag = "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - -var meshlambert_vert = "#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - -var meshphong_frag = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - -var meshphong_vert = "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - -var meshphysical_frag = "#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - -var meshphysical_vert = "#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - -var normal_frag = "uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include <logdepthbuf_fragment>\n}\n"; - -var normal_vert = "varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n"; - -var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - -var points_vert = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - -var shadow_frag = "uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n"; - -var shadow_vert = "#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - -var ShaderChunk = { - alphamap_fragment: alphamap_fragment, - alphamap_pars_fragment: alphamap_pars_fragment, - alphatest_fragment: alphatest_fragment, - aomap_fragment: aomap_fragment, - aomap_pars_fragment: aomap_pars_fragment, - begin_vertex: begin_vertex, - beginnormal_vertex: beginnormal_vertex, - bsdfs: bsdfs, - bumpmap_pars_fragment: bumpmap_pars_fragment, - clipping_planes_fragment: clipping_planes_fragment, - clipping_planes_pars_fragment: clipping_planes_pars_fragment, - clipping_planes_pars_vertex: clipping_planes_pars_vertex, - clipping_planes_vertex: clipping_planes_vertex, - color_fragment: color_fragment, - color_pars_fragment: color_pars_fragment, - color_pars_vertex: color_pars_vertex, - color_vertex: color_vertex, - common: common, - cube_uv_reflection_fragment: cube_uv_reflection_fragment, - defaultnormal_vertex: defaultnormal_vertex, - displacementmap_pars_vertex: displacementmap_pars_vertex, - displacementmap_vertex: displacementmap_vertex, - emissivemap_fragment: emissivemap_fragment, - emissivemap_pars_fragment: emissivemap_pars_fragment, - encodings_fragment: encodings_fragment, - encodings_pars_fragment: encodings_pars_fragment, - envmap_fragment: envmap_fragment, - envmap_pars_fragment: envmap_pars_fragment, - envmap_pars_vertex: envmap_pars_vertex, - envmap_vertex: envmap_vertex, - fog_fragment: fog_fragment, - fog_pars_fragment: fog_pars_fragment, - gradientmap_pars_fragment: gradientmap_pars_fragment, - lightmap_fragment: lightmap_fragment, - lightmap_pars_fragment: lightmap_pars_fragment, - lights_lambert_vertex: lights_lambert_vertex, - lights_pars: lights_pars, - lights_phong_fragment: lights_phong_fragment, - lights_phong_pars_fragment: lights_phong_pars_fragment, - lights_physical_fragment: lights_physical_fragment, - lights_physical_pars_fragment: lights_physical_pars_fragment, - lights_template: lights_template, - logdepthbuf_fragment: logdepthbuf_fragment, - logdepthbuf_pars_fragment: logdepthbuf_pars_fragment, - logdepthbuf_pars_vertex: logdepthbuf_pars_vertex, - logdepthbuf_vertex: logdepthbuf_vertex, - map_fragment: map_fragment, - map_pars_fragment: map_pars_fragment, - map_particle_fragment: map_particle_fragment, - map_particle_pars_fragment: map_particle_pars_fragment, - metalnessmap_fragment: metalnessmap_fragment, - metalnessmap_pars_fragment: metalnessmap_pars_fragment, - morphnormal_vertex: morphnormal_vertex, - morphtarget_pars_vertex: morphtarget_pars_vertex, - morphtarget_vertex: morphtarget_vertex, - normal_flip: normal_flip, - normal_fragment: normal_fragment, - normalmap_pars_fragment: normalmap_pars_fragment, - packing: packing, - premultiplied_alpha_fragment: premultiplied_alpha_fragment, - project_vertex: project_vertex, - roughnessmap_fragment: roughnessmap_fragment, - roughnessmap_pars_fragment: roughnessmap_pars_fragment, - shadowmap_pars_fragment: shadowmap_pars_fragment, - shadowmap_pars_vertex: shadowmap_pars_vertex, - shadowmap_vertex: shadowmap_vertex, - shadowmask_pars_fragment: shadowmask_pars_fragment, - skinbase_vertex: skinbase_vertex, - skinning_pars_vertex: skinning_pars_vertex, - skinning_vertex: skinning_vertex, - skinnormal_vertex: skinnormal_vertex, - specularmap_fragment: specularmap_fragment, - specularmap_pars_fragment: specularmap_pars_fragment, - tonemapping_fragment: tonemapping_fragment, - tonemapping_pars_fragment: tonemapping_pars_fragment, - uv_pars_fragment: uv_pars_fragment, - uv_pars_vertex: uv_pars_vertex, - uv_vertex: uv_vertex, - uv2_pars_fragment: uv2_pars_fragment, - uv2_pars_vertex: uv2_pars_vertex, - uv2_vertex: uv2_vertex, - worldpos_vertex: worldpos_vertex, - - cube_frag: cube_frag, - cube_vert: cube_vert, - depth_frag: depth_frag, - depth_vert: depth_vert, - distanceRGBA_frag: distanceRGBA_frag, - distanceRGBA_vert: distanceRGBA_vert, - equirect_frag: equirect_frag, - equirect_vert: equirect_vert, - linedashed_frag: linedashed_frag, - linedashed_vert: linedashed_vert, - meshbasic_frag: meshbasic_frag, - meshbasic_vert: meshbasic_vert, - meshlambert_frag: meshlambert_frag, - meshlambert_vert: meshlambert_vert, - meshphong_frag: meshphong_frag, - meshphong_vert: meshphong_vert, - meshphysical_frag: meshphysical_frag, - meshphysical_vert: meshphysical_vert, - normal_frag: normal_frag, - normal_vert: normal_vert, - points_frag: points_frag, - points_vert: points_vert, - shadow_frag: shadow_frag, - shadow_vert: shadow_vert -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function Color( r, g, b ) { - - if ( g === undefined && b === undefined ) { - - // r is THREE.Color, hex or string - return this.set( r ); - - } - - return this.setRGB( r, g, b ); - -} - -Color.prototype = { - - constructor: Color, - - isColor: true, - - r: 1, g: 1, b: 1, - - set: function ( value ) { - - if ( value && value.isColor ) { - - this.copy( value ); - - } else if ( typeof value === 'number' ) { - - this.setHex( value ); - - } else if ( typeof value === 'string' ) { - - this.setStyle( value ); - - } - - return this; - - }, - - setScalar: function ( scalar ) { - - this.r = scalar; - this.g = scalar; - this.b = scalar; - - return this; - - }, - - setHex: function ( hex ) { - - hex = Math.floor( hex ); - - this.r = ( hex >> 16 & 255 ) / 255; - this.g = ( hex >> 8 & 255 ) / 255; - this.b = ( hex & 255 ) / 255; - - return this; - - }, - - setRGB: function ( r, g, b ) { - - this.r = r; - this.g = g; - this.b = b; - - return this; - - }, - - setHSL: function () { - - function hue2rgb( p, q, t ) { - - if ( t < 0 ) t += 1; - if ( t > 1 ) t -= 1; - if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t; - if ( t < 1 / 2 ) return q; - if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t ); - return p; - - } - - return function setHSL( h, s, l ) { - - // h,s,l ranges are in 0.0 - 1.0 - h = _Math.euclideanModulo( h, 1 ); - s = _Math.clamp( s, 0, 1 ); - l = _Math.clamp( l, 0, 1 ); - - if ( s === 0 ) { - - this.r = this.g = this.b = l; - - } else { - - var p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s ); - var q = ( 2 * l ) - p; - - this.r = hue2rgb( q, p, h + 1 / 3 ); - this.g = hue2rgb( q, p, h ); - this.b = hue2rgb( q, p, h - 1 / 3 ); - - } - - return this; - - }; - - }(), - - setStyle: function ( style ) { - - function handleAlpha( string ) { - - if ( string === undefined ) return; - - if ( parseFloat( string ) < 1 ) { - - console.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' ); - - } - - } - - - var m; - - if ( m = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec( style ) ) { - - // rgb / hsl - - var color; - var name = m[ 1 ]; - var components = m[ 2 ]; - - switch ( name ) { - - case 'rgb': - case 'rgba': - - if ( color = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec( components ) ) { - - // rgb(255,0,0) rgba(255,0,0,0.5) - this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255; - this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255; - this.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255; - - handleAlpha( color[ 5 ] ); - - return this; - - } - - if ( color = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec( components ) ) { - - // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5) - this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100; - this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100; - this.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100; - - handleAlpha( color[ 5 ] ); - - return this; - - } - - break; - - case 'hsl': - case 'hsla': - - if ( color = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec( components ) ) { - - // hsl(120,50%,50%) hsla(120,50%,50%,0.5) - var h = parseFloat( color[ 1 ] ) / 360; - var s = parseInt( color[ 2 ], 10 ) / 100; - var l = parseInt( color[ 3 ], 10 ) / 100; - - handleAlpha( color[ 5 ] ); - - return this.setHSL( h, s, l ); - - } - - break; - - } - - } else if ( m = /^\#([A-Fa-f0-9]+)$/.exec( style ) ) { - - // hex color - - var hex = m[ 1 ]; - var size = hex.length; - - if ( size === 3 ) { - - // #ff0 - this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 0 ), 16 ) / 255; - this.g = parseInt( hex.charAt( 1 ) + hex.charAt( 1 ), 16 ) / 255; - this.b = parseInt( hex.charAt( 2 ) + hex.charAt( 2 ), 16 ) / 255; - - return this; - - } else if ( size === 6 ) { - - // #ff0000 - this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 1 ), 16 ) / 255; - this.g = parseInt( hex.charAt( 2 ) + hex.charAt( 3 ), 16 ) / 255; - this.b = parseInt( hex.charAt( 4 ) + hex.charAt( 5 ), 16 ) / 255; - - return this; - - } - - } - - if ( style && style.length > 0 ) { - - // color keywords - var hex = ColorKeywords[ style ]; - - if ( hex !== undefined ) { - - // red - this.setHex( hex ); - - } else { - - // unknown color - console.warn( 'THREE.Color: Unknown color ' + style ); - - } - - } - - return this; - - }, - - clone: function () { - - return new this.constructor( this.r, this.g, this.b ); - - }, - - copy: function ( color ) { - - this.r = color.r; - this.g = color.g; - this.b = color.b; - - return this; - - }, - - copyGammaToLinear: function ( color, gammaFactor ) { - - if ( gammaFactor === undefined ) gammaFactor = 2.0; - - this.r = Math.pow( color.r, gammaFactor ); - this.g = Math.pow( color.g, gammaFactor ); - this.b = Math.pow( color.b, gammaFactor ); - - return this; - - }, - - copyLinearToGamma: function ( color, gammaFactor ) { - - if ( gammaFactor === undefined ) gammaFactor = 2.0; - - var safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0; - - this.r = Math.pow( color.r, safeInverse ); - this.g = Math.pow( color.g, safeInverse ); - this.b = Math.pow( color.b, safeInverse ); - - return this; - - }, - - convertGammaToLinear: function () { - - var r = this.r, g = this.g, b = this.b; - - this.r = r * r; - this.g = g * g; - this.b = b * b; - - return this; - - }, - - convertLinearToGamma: function () { - - this.r = Math.sqrt( this.r ); - this.g = Math.sqrt( this.g ); - this.b = Math.sqrt( this.b ); - - return this; - - }, - - getHex: function () { - - return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0; - - }, - - getHexString: function () { - - return ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 ); - - }, - - getHSL: function ( optionalTarget ) { - - // h,s,l ranges are in 0.0 - 1.0 - - var hsl = optionalTarget || { h: 0, s: 0, l: 0 }; - - var r = this.r, g = this.g, b = this.b; - - var max = Math.max( r, g, b ); - var min = Math.min( r, g, b ); - - var hue, saturation; - var lightness = ( min + max ) / 2.0; - - if ( min === max ) { - - hue = 0; - saturation = 0; - - } else { - - var delta = max - min; - - saturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min ); - - switch ( max ) { - - case r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break; - case g: hue = ( b - r ) / delta + 2; break; - case b: hue = ( r - g ) / delta + 4; break; - - } - - hue /= 6; - - } - - hsl.h = hue; - hsl.s = saturation; - hsl.l = lightness; - - return hsl; - - }, - - getStyle: function () { - - return 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')'; - - }, - - offsetHSL: function ( h, s, l ) { - - var hsl = this.getHSL(); - - hsl.h += h; hsl.s += s; hsl.l += l; - - this.setHSL( hsl.h, hsl.s, hsl.l ); - - return this; - - }, - - add: function ( color ) { - - this.r += color.r; - this.g += color.g; - this.b += color.b; - - return this; - - }, - - addColors: function ( color1, color2 ) { - - this.r = color1.r + color2.r; - this.g = color1.g + color2.g; - this.b = color1.b + color2.b; - - return this; - - }, - - addScalar: function ( s ) { - - this.r += s; - this.g += s; - this.b += s; - - return this; - - }, - - sub: function( color ) { - - this.r = Math.max( 0, this.r - color.r ); - this.g = Math.max( 0, this.g - color.g ); - this.b = Math.max( 0, this.b - color.b ); - - return this; - - }, - - multiply: function ( color ) { - - this.r *= color.r; - this.g *= color.g; - this.b *= color.b; - - return this; - - }, - - multiplyScalar: function ( s ) { - - this.r *= s; - this.g *= s; - this.b *= s; - - return this; - - }, - - lerp: function ( color, alpha ) { - - this.r += ( color.r - this.r ) * alpha; - this.g += ( color.g - this.g ) * alpha; - this.b += ( color.b - this.b ) * alpha; - - return this; - - }, - - equals: function ( c ) { - - return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.r = array[ offset ]; - this.g = array[ offset + 1 ]; - this.b = array[ offset + 2 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.r; - array[ offset + 1 ] = this.g; - array[ offset + 2 ] = this.b; - - return array; - - }, - - toJSON: function () { - - return this.getHex(); - - } - -}; - -var ColorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF, -'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2, -'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50, -'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B, -'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B, -'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F, -'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3, -'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222, -'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700, -'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4, -'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00, -'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3, -'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA, -'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32, -'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3, -'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC, -'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD, -'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6, -'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9, -'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F, -'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE, -'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA, -'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0, -'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 }; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function DataTexture( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) { - - Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - this.image = { data: data, width: width, height: height }; - - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - -} - -DataTexture.prototype = Object.create( Texture.prototype ); -DataTexture.prototype.constructor = DataTexture; - -DataTexture.prototype.isDataTexture = true; - -/** - * Uniforms library for shared webgl shaders - */ - -var UniformsLib = { - - common: { - - diffuse: { value: new Color( 0xeeeeee ) }, - opacity: { value: 1.0 }, - - map: { value: null }, - offsetRepeat: { value: new Vector4( 0, 0, 1, 1 ) }, - - specularMap: { value: null }, - alphaMap: { value: null }, - - envMap: { value: null }, - flipEnvMap: { value: - 1 }, - reflectivity: { value: 1.0 }, - refractionRatio: { value: 0.98 } - - }, - - aomap: { - - aoMap: { value: null }, - aoMapIntensity: { value: 1 } - - }, - - lightmap: { - - lightMap: { value: null }, - lightMapIntensity: { value: 1 } - - }, - - emissivemap: { - - emissiveMap: { value: null } - - }, - - bumpmap: { - - bumpMap: { value: null }, - bumpScale: { value: 1 } - - }, - - normalmap: { - - normalMap: { value: null }, - normalScale: { value: new Vector2( 1, 1 ) } - - }, - - displacementmap: { - - displacementMap: { value: null }, - displacementScale: { value: 1 }, - displacementBias: { value: 0 } - - }, - - roughnessmap: { - - roughnessMap: { value: null } - - }, - - metalnessmap: { - - metalnessMap: { value: null } - - }, - - gradientmap: { - - gradientMap: { value: null } - - }, - - fog: { - - fogDensity: { value: 0.00025 }, - fogNear: { value: 1 }, - fogFar: { value: 2000 }, - fogColor: { value: new Color( 0xffffff ) } - - }, - - lights: { - - ambientLightColor: { value: [] }, - - directionalLights: { value: [], properties: { - direction: {}, - color: {}, - - shadow: {}, - shadowBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - - directionalShadowMap: { value: [] }, - directionalShadowMatrix: { value: [] }, - - spotLights: { value: [], properties: { - color: {}, - position: {}, - direction: {}, - distance: {}, - coneCos: {}, - penumbraCos: {}, - decay: {}, - - shadow: {}, - shadowBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - - spotShadowMap: { value: [] }, - spotShadowMatrix: { value: [] }, - - pointLights: { value: [], properties: { - color: {}, - position: {}, - decay: {}, - distance: {}, - - shadow: {}, - shadowBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - - pointShadowMap: { value: [] }, - pointShadowMatrix: { value: [] }, - - hemisphereLights: { value: [], properties: { - direction: {}, - skyColor: {}, - groundColor: {} - } }, - - // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src - rectAreaLights: { value: [], properties: { - color: {}, - position: {}, - width: {}, - height: {}, - } } - - }, - - points: { - - diffuse: { value: new Color( 0xeeeeee ) }, - opacity: { value: 1.0 }, - size: { value: 1.0 }, - scale: { value: 1.0 }, - map: { value: null }, - offsetRepeat: { value: new Vector4( 0, 0, 1, 1 ) } - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - */ - -var ShaderLib = { - - basic: { - - uniforms: Object.assign( {}, - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.fog - ), - - vertexShader: ShaderChunk.meshbasic_vert, - fragmentShader: ShaderChunk.meshbasic_frag - - }, - - lambert: { - - uniforms: Object.assign( {}, - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive : { value: new Color( 0x000000 ) } - } - ), - - vertexShader: ShaderChunk.meshlambert_vert, - fragmentShader: ShaderChunk.meshlambert_frag - - }, - - phong: { - - uniforms: Object.assign( {}, - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.gradientmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive : { value: new Color( 0x000000 ) }, - specular : { value: new Color( 0x111111 ) }, - shininess: { value: 30 } - } - ), - - vertexShader: ShaderChunk.meshphong_vert, - fragmentShader: ShaderChunk.meshphong_frag - - }, - - standard: { - - uniforms: Object.assign( {}, - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.roughnessmap, - UniformsLib.metalnessmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive : { value: new Color( 0x000000 ) }, - roughness: { value: 0.5 }, - metalness: { value: 0 }, - envMapIntensity : { value: 1 }, // temporary - } - ), - - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag - - }, - - points: { - - uniforms: Object.assign( {}, - UniformsLib.points, - UniformsLib.fog - ), - - vertexShader: ShaderChunk.points_vert, - fragmentShader: ShaderChunk.points_frag - - }, - - dashed: { - - uniforms: Object.assign( {}, - UniformsLib.common, - UniformsLib.fog, - { - scale : { value: 1 }, - dashSize : { value: 1 }, - totalSize: { value: 2 } - } - ), - - vertexShader: ShaderChunk.linedashed_vert, - fragmentShader: ShaderChunk.linedashed_frag - - }, - - depth: { - - uniforms: Object.assign( {}, - UniformsLib.common, - UniformsLib.displacementmap - ), - - vertexShader: ShaderChunk.depth_vert, - fragmentShader: ShaderChunk.depth_frag - - }, - - normal: { - - uniforms: { - opacity : { value: 1.0 } - }, - - vertexShader: ShaderChunk.normal_vert, - fragmentShader: ShaderChunk.normal_frag - - }, - - /* ------------------------------------------------------------------------- - // Cube map shader - ------------------------------------------------------------------------- */ - - cube: { - - uniforms: { - tCube: { value: null }, - tFlip: { value: - 1 }, - opacity: { value: 1.0 } - }, - - vertexShader: ShaderChunk.cube_vert, - fragmentShader: ShaderChunk.cube_frag - - }, - - /* ------------------------------------------------------------------------- - // Cube map shader - ------------------------------------------------------------------------- */ - - equirect: { - - uniforms: { - tEquirect: { value: null }, - tFlip: { value: - 1 } - }, - - vertexShader: ShaderChunk.equirect_vert, - fragmentShader: ShaderChunk.equirect_frag - - }, - - distanceRGBA: { - - uniforms: { - lightPos: { value: new Vector3() } - }, - - vertexShader: ShaderChunk.distanceRGBA_vert, - fragmentShader: ShaderChunk.distanceRGBA_frag - - } - -}; - -ShaderLib.physical = { - - uniforms: Object.assign( {}, - ShaderLib.standard.uniforms, - { - clearCoat: { value: 0 }, - clearCoatRoughness: { value: 0 } - } - ), - - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag - -}; - -/** - * @author bhouston / http://clara.io - */ - -function Box2( min, max ) { - - this.min = ( min !== undefined ) ? min : new Vector2( + Infinity, + Infinity ); - this.max = ( max !== undefined ) ? max : new Vector2( - Infinity, - Infinity ); - -} - -Box2.prototype = { - - constructor: Box2, - - set: function ( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - }, - - setFromPoints: function ( points ) { - - this.makeEmpty(); - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - this.expandByPoint( points[ i ] ); - - } - - return this; - - }, - - setFromCenterAndSize: function () { - - var v1 = new Vector2(); - - return function setFromCenterAndSize( center, size ) { - - var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - }; - - }(), - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - }, - - makeEmpty: function () { - - this.min.x = this.min.y = + Infinity; - this.max.x = this.max.y = - Infinity; - - return this; - - }, - - isEmpty: function () { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ); - - }, - - getCenter: function ( optionalTarget ) { - - var result = optionalTarget || new Vector2(); - return this.isEmpty() ? result.set( 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - }, - - getSize: function ( optionalTarget ) { - - var result = optionalTarget || new Vector2(); - return this.isEmpty() ? result.set( 0, 0 ) : result.subVectors( this.max, this.min ); - - }, - - expandByPoint: function ( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - - }, - - expandByVector: function ( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - - }, - - expandByScalar: function ( scalar ) { - - this.min.addScalar( - scalar ); - this.max.addScalar( scalar ); - - return this; - - }, - - containsPoint: function ( point ) { - - if ( point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y ) { - - return false; - - } - - return true; - - }, - - containsBox: function ( box ) { - - if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && - ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) { - - return true; - - } - - return false; - - }, - - getParameter: function ( point, optionalTarget ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - var result = optionalTarget || new Vector2(); - - return result.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ) - ); - - }, - - intersectsBox: function ( box ) { - - // using 6 splitting planes to rule out intersections. - - if ( box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y ) { - - return false; - - } - - return true; - - }, - - clampPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new Vector2(); - return result.copy( point ).clamp( this.min, this.max ); - - }, - - distanceToPoint: function () { - - var v1 = new Vector2(); - - return function distanceToPoint( point ) { - - var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - }; - - }(), - - intersect: function ( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - return this; - - }, - - union: function ( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - }, - - translate: function ( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - }, - - equals: function ( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - } - -}; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -function LensFlarePlugin( renderer, flares ) { - - var gl = renderer.context; - var state = renderer.state; - - var vertexBuffer, elementBuffer; - var shader, program, attributes, uniforms; - - var tempTexture, occlusionTexture; - - function init() { - - var vertices = new Float32Array( [ - - 1, - 1, 0, 0, - 1, - 1, 1, 0, - 1, 1, 1, 1, - - 1, 1, 0, 1 - ] ); - - var faces = new Uint16Array( [ - 0, 1, 2, - 0, 2, 3 - ] ); - - // buffers - - vertexBuffer = gl.createBuffer(); - elementBuffer = gl.createBuffer(); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW ); - - // textures - - tempTexture = gl.createTexture(); - occlusionTexture = gl.createTexture(); - - state.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - - state.bindTexture( gl.TEXTURE_2D, occlusionTexture ); - gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - - shader = { - - vertexShader: [ - - "uniform lowp int renderType;", - - "uniform vec3 screenPosition;", - "uniform vec2 scale;", - "uniform float rotation;", - - "uniform sampler2D occlusionMap;", - - "attribute vec2 position;", - "attribute vec2 uv;", - - "varying vec2 vUV;", - "varying float vVisibility;", - - "void main() {", - - "vUV = uv;", - - "vec2 pos = position;", - - "if ( renderType == 2 ) {", - - "vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );", - - "vVisibility = visibility.r / 9.0;", - "vVisibility *= 1.0 - visibility.g / 9.0;", - "vVisibility *= visibility.b / 9.0;", - "vVisibility *= 1.0 - visibility.a / 9.0;", - - "pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;", - "pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;", - - "}", - - "gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );", - - "}" - - ].join( "\n" ), - - fragmentShader: [ - - "uniform lowp int renderType;", - - "uniform sampler2D map;", - "uniform float opacity;", - "uniform vec3 color;", - - "varying vec2 vUV;", - "varying float vVisibility;", - - "void main() {", - - // pink square - - "if ( renderType == 0 ) {", - - "gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );", - - // restore - - "} else if ( renderType == 1 ) {", - - "gl_FragColor = texture2D( map, vUV );", - - // flare - - "} else {", - - "vec4 texture = texture2D( map, vUV );", - "texture.a *= opacity * vVisibility;", - "gl_FragColor = texture;", - "gl_FragColor.rgb *= color;", - - "}", - - "}" - - ].join( "\n" ) - - }; - - program = createProgram( shader ); - - attributes = { - vertex: gl.getAttribLocation ( program, "position" ), - uv: gl.getAttribLocation ( program, "uv" ) - }; - - uniforms = { - renderType: gl.getUniformLocation( program, "renderType" ), - map: gl.getUniformLocation( program, "map" ), - occlusionMap: gl.getUniformLocation( program, "occlusionMap" ), - opacity: gl.getUniformLocation( program, "opacity" ), - color: gl.getUniformLocation( program, "color" ), - scale: gl.getUniformLocation( program, "scale" ), - rotation: gl.getUniformLocation( program, "rotation" ), - screenPosition: gl.getUniformLocation( program, "screenPosition" ) - }; - - } - - /* - * Render lens flares - * Method: renders 16x16 0xff00ff-colored points scattered over the light source area, - * reads these back and calculates occlusion. - */ - - this.render = function ( scene, camera, viewport ) { - - if ( flares.length === 0 ) return; - - var tempPosition = new Vector3(); - - var invAspect = viewport.w / viewport.z, - halfViewportWidth = viewport.z * 0.5, - halfViewportHeight = viewport.w * 0.5; - - var size = 16 / viewport.w, - scale = new Vector2( size * invAspect, size ); - - var screenPosition = new Vector3( 1, 1, 0 ), - screenPositionPixels = new Vector2( 1, 1 ); - - var validArea = new Box2(); - - validArea.min.set( viewport.x, viewport.y ); - validArea.max.set( viewport.x + ( viewport.z - 16 ), viewport.y + ( viewport.w - 16 ) ); - - if ( program === undefined ) { - - init(); - - } - - gl.useProgram( program ); - - state.initAttributes(); - state.enableAttribute( attributes.vertex ); - state.enableAttribute( attributes.uv ); - state.disableUnusedAttributes(); - - // loop through all lens flares to update their occlusion and positions - // setup gl and common used attribs/uniforms - - gl.uniform1i( uniforms.occlusionMap, 0 ); - gl.uniform1i( uniforms.map, 1 ); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.vertexAttribPointer( attributes.vertex, 2, gl.FLOAT, false, 2 * 8, 0 ); - gl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - - state.disable( gl.CULL_FACE ); - state.setDepthWrite( false ); - - for ( var i = 0, l = flares.length; i < l; i ++ ) { - - size = 16 / viewport.w; - scale.set( size * invAspect, size ); - - // calc object screen position - - var flare = flares[ i ]; - - tempPosition.set( flare.matrixWorld.elements[ 12 ], flare.matrixWorld.elements[ 13 ], flare.matrixWorld.elements[ 14 ] ); - - tempPosition.applyMatrix4( camera.matrixWorldInverse ); - tempPosition.applyProjection( camera.projectionMatrix ); - - // setup arrays for gl programs - - screenPosition.copy( tempPosition ); - - // horizontal and vertical coordinate of the lower left corner of the pixels to copy - - screenPositionPixels.x = viewport.x + ( screenPosition.x * halfViewportWidth ) + halfViewportWidth - 8; - screenPositionPixels.y = viewport.y + ( screenPosition.y * halfViewportHeight ) + halfViewportHeight - 8; - - // screen cull - - if ( validArea.containsPoint( screenPositionPixels ) === true ) { - - // save current RGB to temp texture - - state.activeTexture( gl.TEXTURE0 ); - state.bindTexture( gl.TEXTURE_2D, null ); - state.activeTexture( gl.TEXTURE1 ); - state.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x, screenPositionPixels.y, 16, 16, 0 ); - - - // render pink quad - - gl.uniform1i( uniforms.renderType, 0 ); - gl.uniform2f( uniforms.scale, scale.x, scale.y ); - gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z ); - - state.disable( gl.BLEND ); - state.enable( gl.DEPTH_TEST ); - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - - // copy result to occlusionMap - - state.activeTexture( gl.TEXTURE0 ); - state.bindTexture( gl.TEXTURE_2D, occlusionTexture ); - gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, screenPositionPixels.x, screenPositionPixels.y, 16, 16, 0 ); - - - // restore graphics - - gl.uniform1i( uniforms.renderType, 1 ); - state.disable( gl.DEPTH_TEST ); - - state.activeTexture( gl.TEXTURE1 ); - state.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - - // update object positions - - flare.positionScreen.copy( screenPosition ); - - if ( flare.customUpdateCallback ) { - - flare.customUpdateCallback( flare ); - - } else { - - flare.updateLensFlares(); - - } - - // render flares - - gl.uniform1i( uniforms.renderType, 2 ); - state.enable( gl.BLEND ); - - for ( var j = 0, jl = flare.lensFlares.length; j < jl; j ++ ) { - - var sprite = flare.lensFlares[ j ]; - - if ( sprite.opacity > 0.001 && sprite.scale > 0.001 ) { - - screenPosition.x = sprite.x; - screenPosition.y = sprite.y; - screenPosition.z = sprite.z; - - size = sprite.size * sprite.scale / viewport.w; - - scale.x = size * invAspect; - scale.y = size; - - gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z ); - gl.uniform2f( uniforms.scale, scale.x, scale.y ); - gl.uniform1f( uniforms.rotation, sprite.rotation ); - - gl.uniform1f( uniforms.opacity, sprite.opacity ); - gl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b ); - - state.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst ); - renderer.setTexture2D( sprite.texture, 1 ); - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - } - - } - - } - - } - - // restore gl - - state.enable( gl.CULL_FACE ); - state.enable( gl.DEPTH_TEST ); - state.setDepthWrite( true ); - - renderer.resetGLState(); - - }; - - function createProgram( shader ) { - - var program = gl.createProgram(); - - var fragmentShader = gl.createShader( gl.FRAGMENT_SHADER ); - var vertexShader = gl.createShader( gl.VERTEX_SHADER ); - - var prefix = "precision " + renderer.getPrecision() + " float;\n"; - - gl.shaderSource( fragmentShader, prefix + shader.fragmentShader ); - gl.shaderSource( vertexShader, prefix + shader.vertexShader ); - - gl.compileShader( fragmentShader ); - gl.compileShader( vertexShader ); - - gl.attachShader( program, fragmentShader ); - gl.attachShader( program, vertexShader ); - - gl.linkProgram( program ); - - return program; - - } - -} - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -function SpritePlugin( renderer, sprites ) { - - var gl = renderer.context; - var state = renderer.state; - - var vertexBuffer, elementBuffer; - var program, attributes, uniforms; - - var texture; - - // decompose matrixWorld - - var spritePosition = new Vector3(); - var spriteRotation = new Quaternion(); - var spriteScale = new Vector3(); - - function init() { - - var vertices = new Float32Array( [ - - 0.5, - 0.5, 0, 0, - 0.5, - 0.5, 1, 0, - 0.5, 0.5, 1, 1, - - 0.5, 0.5, 0, 1 - ] ); - - var faces = new Uint16Array( [ - 0, 1, 2, - 0, 2, 3 - ] ); - - vertexBuffer = gl.createBuffer(); - elementBuffer = gl.createBuffer(); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW ); - - program = createProgram(); - - attributes = { - position: gl.getAttribLocation ( program, 'position' ), - uv: gl.getAttribLocation ( program, 'uv' ) - }; - - uniforms = { - uvOffset: gl.getUniformLocation( program, 'uvOffset' ), - uvScale: gl.getUniformLocation( program, 'uvScale' ), - - rotation: gl.getUniformLocation( program, 'rotation' ), - scale: gl.getUniformLocation( program, 'scale' ), - - color: gl.getUniformLocation( program, 'color' ), - map: gl.getUniformLocation( program, 'map' ), - opacity: gl.getUniformLocation( program, 'opacity' ), - - modelViewMatrix: gl.getUniformLocation( program, 'modelViewMatrix' ), - projectionMatrix: gl.getUniformLocation( program, 'projectionMatrix' ), - - fogType: gl.getUniformLocation( program, 'fogType' ), - fogDensity: gl.getUniformLocation( program, 'fogDensity' ), - fogNear: gl.getUniformLocation( program, 'fogNear' ), - fogFar: gl.getUniformLocation( program, 'fogFar' ), - fogColor: gl.getUniformLocation( program, 'fogColor' ), - - alphaTest: gl.getUniformLocation( program, 'alphaTest' ) - }; - - var canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.width = 8; - canvas.height = 8; - - var context = canvas.getContext( '2d' ); - context.fillStyle = 'white'; - context.fillRect( 0, 0, 8, 8 ); - - texture = new Texture( canvas ); - texture.needsUpdate = true; - - } - - this.render = function ( scene, camera ) { - - if ( sprites.length === 0 ) return; - - // setup gl - - if ( program === undefined ) { - - init(); - - } - - gl.useProgram( program ); - - state.initAttributes(); - state.enableAttribute( attributes.position ); - state.enableAttribute( attributes.uv ); - state.disableUnusedAttributes(); - - state.disable( gl.CULL_FACE ); - state.enable( gl.BLEND ); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.vertexAttribPointer( attributes.position, 2, gl.FLOAT, false, 2 * 8, 0 ); - gl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - - gl.uniformMatrix4fv( uniforms.projectionMatrix, false, new Float32Array( camera.projectionMatrix.elements ) ); - - state.activeTexture( gl.TEXTURE0 ); - gl.uniform1i( uniforms.map, 0 ); - - var oldFogType = 0; - var sceneFogType = 0; - var fog = scene.fog; - - if ( fog ) { - - gl.uniform3f( uniforms.fogColor, fog.color.r, fog.color.g, fog.color.b ); - - if ( fog.isFog ) { - - gl.uniform1f( uniforms.fogNear, fog.near ); - gl.uniform1f( uniforms.fogFar, fog.far ); - - gl.uniform1i( uniforms.fogType, 1 ); - oldFogType = 1; - sceneFogType = 1; - - } else if ( fog.isFogExp2 ) { - - gl.uniform1f( uniforms.fogDensity, fog.density ); - - gl.uniform1i( uniforms.fogType, 2 ); - oldFogType = 2; - sceneFogType = 2; - - } - - } else { - - gl.uniform1i( uniforms.fogType, 0 ); - oldFogType = 0; - sceneFogType = 0; - - } - - - // update positions and sort - - for ( var i = 0, l = sprites.length; i < l; i ++ ) { - - var sprite = sprites[ i ]; - - sprite.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, sprite.matrixWorld ); - sprite.z = - sprite.modelViewMatrix.elements[ 14 ]; - - } - - sprites.sort( painterSortStable ); - - // render all sprites - - var scale = []; - - for ( var i = 0, l = sprites.length; i < l; i ++ ) { - - var sprite = sprites[ i ]; - var material = sprite.material; - - if ( material.visible === false ) continue; - - gl.uniform1f( uniforms.alphaTest, material.alphaTest ); - gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, new Float32Array( sprite.modelViewMatrix.elements ) ); - - sprite.matrixWorld.decompose( spritePosition, spriteRotation, spriteScale ); - - scale[ 0 ] = spriteScale.x; - scale[ 1 ] = spriteScale.y; - - var fogType = 0; - - if ( scene.fog && material.fog ) { - - fogType = sceneFogType; - - } - - if ( oldFogType !== fogType ) { - - gl.uniform1i( uniforms.fogType, fogType ); - oldFogType = fogType; - - } - - if ( material.map !== null ) { - - gl.uniform2f( uniforms.uvOffset, material.map.offset.x, material.map.offset.y ); - gl.uniform2f( uniforms.uvScale, material.map.repeat.x, material.map.repeat.y ); - - } else { - - gl.uniform2f( uniforms.uvOffset, 0, 0 ); - gl.uniform2f( uniforms.uvScale, 1, 1 ); - - } - - gl.uniform1f( uniforms.opacity, material.opacity ); - gl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b ); - - gl.uniform1f( uniforms.rotation, material.rotation ); - gl.uniform2fv( uniforms.scale, scale ); - - state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst ); - state.setDepthTest( material.depthTest ); - state.setDepthWrite( material.depthWrite ); - - if ( material.map ) { - - renderer.setTexture2D( material.map, 0 ); - - } else { - - renderer.setTexture2D( texture, 0 ); - - } - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - } - - // restore gl - - state.enable( gl.CULL_FACE ); - - renderer.resetGLState(); - - }; - - function createProgram() { - - var program = gl.createProgram(); - - var vertexShader = gl.createShader( gl.VERTEX_SHADER ); - var fragmentShader = gl.createShader( gl.FRAGMENT_SHADER ); - - gl.shaderSource( vertexShader, [ - - 'precision ' + renderer.getPrecision() + ' float;', - - 'uniform mat4 modelViewMatrix;', - 'uniform mat4 projectionMatrix;', - 'uniform float rotation;', - 'uniform vec2 scale;', - 'uniform vec2 uvOffset;', - 'uniform vec2 uvScale;', - - 'attribute vec2 position;', - 'attribute vec2 uv;', - - 'varying vec2 vUV;', - - 'void main() {', - - 'vUV = uvOffset + uv * uvScale;', - - 'vec2 alignedPosition = position * scale;', - - 'vec2 rotatedPosition;', - 'rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;', - 'rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;', - - 'vec4 finalPosition;', - - 'finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );', - 'finalPosition.xy += rotatedPosition;', - 'finalPosition = projectionMatrix * finalPosition;', - - 'gl_Position = finalPosition;', - - '}' - - ].join( '\n' ) ); - - gl.shaderSource( fragmentShader, [ - - 'precision ' + renderer.getPrecision() + ' float;', - - 'uniform vec3 color;', - 'uniform sampler2D map;', - 'uniform float opacity;', - - 'uniform int fogType;', - 'uniform vec3 fogColor;', - 'uniform float fogDensity;', - 'uniform float fogNear;', - 'uniform float fogFar;', - 'uniform float alphaTest;', - - 'varying vec2 vUV;', - - 'void main() {', - - 'vec4 texture = texture2D( map, vUV );', - - 'if ( texture.a < alphaTest ) discard;', - - 'gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );', - - 'if ( fogType > 0 ) {', - - 'float depth = gl_FragCoord.z / gl_FragCoord.w;', - 'float fogFactor = 0.0;', - - 'if ( fogType == 1 ) {', - - 'fogFactor = smoothstep( fogNear, fogFar, depth );', - - '} else {', - - 'const float LOG2 = 1.442695;', - 'fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );', - 'fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );', - - '}', - - 'gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );', - - '}', - - '}' - - ].join( '\n' ) ); - - gl.compileShader( vertexShader ); - gl.compileShader( fragmentShader ); - - gl.attachShader( program, vertexShader ); - gl.attachShader( program, fragmentShader ); - - gl.linkProgram( program ); - - return program; - - } - - function painterSortStable( a, b ) { - - if ( a.renderOrder !== b.renderOrder ) { - - return a.renderOrder - b.renderOrder; - - } else if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return b.id - a.id; - - } - - } - -} - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -var materialId = 0; - -function Material() { - - Object.defineProperty( this, 'id', { value: materialId ++ } ); - - this.uuid = _Math.generateUUID(); - - this.name = ''; - this.type = 'Material'; - - this.fog = true; - this.lights = true; - - this.blending = NormalBlending; - this.side = FrontSide; - this.shading = SmoothShading; // THREE.FlatShading, THREE.SmoothShading - this.vertexColors = NoColors; // THREE.NoColors, THREE.VertexColors, THREE.FaceColors - - this.opacity = 1; - this.transparent = false; - - this.blendSrc = SrcAlphaFactor; - this.blendDst = OneMinusSrcAlphaFactor; - this.blendEquation = AddEquation; - this.blendSrcAlpha = null; - this.blendDstAlpha = null; - this.blendEquationAlpha = null; - - this.depthFunc = LessEqualDepth; - this.depthTest = true; - this.depthWrite = true; - - this.clippingPlanes = null; - this.clipIntersection = false; - this.clipShadows = false; - - this.colorWrite = true; - - this.precision = null; // override the renderer's default precision for this material - - this.polygonOffset = false; - this.polygonOffsetFactor = 0; - this.polygonOffsetUnits = 0; - - this.alphaTest = 0; - this.premultipliedAlpha = false; - - this.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer - - this.visible = true; - - this._needsUpdate = true; - -} - -Material.prototype = { - - constructor: Material, - - isMaterial: true, - - get needsUpdate() { - - return this._needsUpdate; - - }, - - set needsUpdate( value ) { - - if ( value === true ) this.update(); - this._needsUpdate = value; - - }, - - setValues: function ( values ) { - - if ( values === undefined ) return; - - for ( var key in values ) { - - var newValue = values[ key ]; - - if ( newValue === undefined ) { - - console.warn( "THREE.Material: '" + key + "' parameter is undefined." ); - continue; - - } - - var currentValue = this[ key ]; - - if ( currentValue === undefined ) { - - console.warn( "THREE." + this.type + ": '" + key + "' is not a property of this material." ); - continue; - - } - - if ( currentValue && currentValue.isColor ) { - - currentValue.set( newValue ); - - } else if ( (currentValue && currentValue.isVector3) && (newValue && newValue.isVector3) ) { - - currentValue.copy( newValue ); - - } else if ( key === 'overdraw' ) { - - // ensure overdraw is backwards-compatible with legacy boolean type - this[ key ] = Number( newValue ); - - } else { - - this[ key ] = newValue; - - } - - } - - }, - - toJSON: function ( meta ) { - - var isRoot = meta === undefined; - - if ( isRoot ) { - - meta = { - textures: {}, - images: {} - }; - - } - - var data = { - metadata: { - version: 4.4, - type: 'Material', - generator: 'Material.toJSON' - } - }; - - // standard Material serialization - data.uuid = this.uuid; - data.type = this.type; - - if ( this.name !== '' ) data.name = this.name; - - if ( this.color && this.color.isColor ) data.color = this.color.getHex(); - - if ( this.roughness !== undefined ) data.roughness = this.roughness; - if ( this.metalness !== undefined ) data.metalness = this.metalness; - - if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex(); - if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex(); - if ( this.shininess !== undefined ) data.shininess = this.shininess; - if ( this.clearCoat !== undefined ) data.clearCoat = this.clearCoat; - if ( this.clearCoatRoughness !== undefined ) data.clearCoatRoughness = this.clearCoatRoughness; - - if ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid; - if ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid; - if ( this.lightMap && this.lightMap.isTexture ) data.lightMap = this.lightMap.toJSON( meta ).uuid; - if ( this.bumpMap && this.bumpMap.isTexture ) { - - data.bumpMap = this.bumpMap.toJSON( meta ).uuid; - data.bumpScale = this.bumpScale; - - } - if ( this.normalMap && this.normalMap.isTexture ) { - - data.normalMap = this.normalMap.toJSON( meta ).uuid; - data.normalScale = this.normalScale.toArray(); - - } - if ( this.displacementMap && this.displacementMap.isTexture ) { - - data.displacementMap = this.displacementMap.toJSON( meta ).uuid; - data.displacementScale = this.displacementScale; - data.displacementBias = this.displacementBias; - - } - if ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid; - if ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid; - - if ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid; - if ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid; - - if ( this.envMap && this.envMap.isTexture ) { - - data.envMap = this.envMap.toJSON( meta ).uuid; - data.reflectivity = this.reflectivity; // Scale behind envMap - - } - - if ( this.gradientMap && this.gradientMap.isTexture ) { - - data.gradientMap = this.gradientMap.toJSON( meta ).uuid; - - } - - if ( this.size !== undefined ) data.size = this.size; - if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation; - - if ( this.blending !== NormalBlending ) data.blending = this.blending; - if ( this.shading !== SmoothShading ) data.shading = this.shading; - if ( this.side !== FrontSide ) data.side = this.side; - if ( this.vertexColors !== NoColors ) data.vertexColors = this.vertexColors; - - if ( this.opacity < 1 ) data.opacity = this.opacity; - if ( this.transparent === true ) data.transparent = this.transparent; - - data.depthFunc = this.depthFunc; - data.depthTest = this.depthTest; - data.depthWrite = this.depthWrite; - - if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest; - if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha; - if ( this.wireframe === true ) data.wireframe = this.wireframe; - if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth; - if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap; - if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin; - - data.skinning = this.skinning; - data.morphTargets = this.morphTargets; - - // TODO: Copied from Object3D.toJSON - - function extractFromCache( cache ) { - - var values = []; - - for ( var key in cache ) { - - var data = cache[ key ]; - delete data.metadata; - values.push( data ); - - } - - return values; - - } - - if ( isRoot ) { - - var textures = extractFromCache( meta.textures ); - var images = extractFromCache( meta.images ); - - if ( textures.length > 0 ) data.textures = textures; - if ( images.length > 0 ) data.images = images; - - } - - return data; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.name = source.name; - - this.fog = source.fog; - this.lights = source.lights; - - this.blending = source.blending; - this.side = source.side; - this.shading = source.shading; - this.vertexColors = source.vertexColors; - - this.opacity = source.opacity; - this.transparent = source.transparent; - - this.blendSrc = source.blendSrc; - this.blendDst = source.blendDst; - this.blendEquation = source.blendEquation; - this.blendSrcAlpha = source.blendSrcAlpha; - this.blendDstAlpha = source.blendDstAlpha; - this.blendEquationAlpha = source.blendEquationAlpha; - - this.depthFunc = source.depthFunc; - this.depthTest = source.depthTest; - this.depthWrite = source.depthWrite; - - this.colorWrite = source.colorWrite; - - this.precision = source.precision; - - this.polygonOffset = source.polygonOffset; - this.polygonOffsetFactor = source.polygonOffsetFactor; - this.polygonOffsetUnits = source.polygonOffsetUnits; - - this.alphaTest = source.alphaTest; - - this.premultipliedAlpha = source.premultipliedAlpha; - - this.overdraw = source.overdraw; - - this.visible = source.visible; - this.clipShadows = source.clipShadows; - this.clipIntersection = source.clipIntersection; - - var srcPlanes = source.clippingPlanes, - dstPlanes = null; - - if ( srcPlanes !== null ) { - - var n = srcPlanes.length; - dstPlanes = new Array( n ); - - for ( var i = 0; i !== n; ++ i ) - dstPlanes[ i ] = srcPlanes[ i ].clone(); - - } - - this.clippingPlanes = dstPlanes; - - return this; - - }, - - update: function () { - - this.dispatchEvent( { type: 'update' } ); - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -Object.assign( Material.prototype, EventDispatcher.prototype ); - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * defines: { "label" : "value" }, - * uniforms: { "parameter1": { value: 1.0 }, "parameter2": { value2: 2 } }, - * - * fragmentShader: <string>, - * vertexShader: <string>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * lights: <bool>, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool> - * } - */ - -function ShaderMaterial( parameters ) { - - Material.call( this ); - - this.type = 'ShaderMaterial'; - - this.defines = {}; - this.uniforms = {}; - - this.vertexShader = 'void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}'; - this.fragmentShader = 'void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}'; - - this.linewidth = 1; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; // set to use scene fog - this.lights = false; // set to use scene lights - this.clipping = false; // set to use user-defined clipping planes - - this.skinning = false; // set to use skinning attribute streams - this.morphTargets = false; // set to use morph targets - this.morphNormals = false; // set to use morph normals - - this.extensions = { - derivatives: false, // set to use derivatives - fragDepth: false, // set to use fragment depth values - drawBuffers: false, // set to use draw buffers - shaderTextureLOD: false // set to use shader texture LOD - }; - - // When rendered geometry doesn't include these attributes but the material does, - // use these default values in WebGL. This avoids errors when buffer data is missing. - this.defaultAttributeValues = { - 'color': [ 1, 1, 1 ], - 'uv': [ 0, 0 ], - 'uv2': [ 0, 0 ] - }; - - this.index0AttributeName = undefined; - - if ( parameters !== undefined ) { - - if ( parameters.attributes !== undefined ) { - - console.error( 'THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.' ); - - } - - this.setValues( parameters ); - - } - -} - -ShaderMaterial.prototype = Object.create( Material.prototype ); -ShaderMaterial.prototype.constructor = ShaderMaterial; - -ShaderMaterial.prototype.isShaderMaterial = true; - -ShaderMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.fragmentShader = source.fragmentShader; - this.vertexShader = source.vertexShader; - - this.uniforms = Object.assign( {}, source.uniforms ); - - this.defines = source.defines; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - this.lights = source.lights; - this.clipping = source.clipping; - - this.skinning = source.skinning; - - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - this.extensions = source.extensions; - - return this; - -}; - -ShaderMaterial.prototype.toJSON = function ( meta ) { - - var data = Material.prototype.toJSON.call( this, meta ); - - data.uniforms = this.uniforms; - data.vertexShader = this.vertexShader; - data.fragmentShader = this.fragmentShader; - - return data; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author bhouston / https://clara.io - * @author WestLangley / http://github.com/WestLangley - * - * parameters = { - * - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * displacementMap: new THREE.Texture( <Image> ), - * displacementScale: <float>, - * displacementBias: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float> - * } - */ - -function MeshDepthMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshDepthMaterial'; - - this.depthPacking = BasicDepthPacking; - - this.skinning = false; - this.morphTargets = false; - - this.map = null; - - this.alphaMap = null; - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; - this.lights = false; - - this.setValues( parameters ); - -} - -MeshDepthMaterial.prototype = Object.create( Material.prototype ); -MeshDepthMaterial.prototype.constructor = MeshDepthMaterial; - -MeshDepthMaterial.prototype.isMeshDepthMaterial = true; - -MeshDepthMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.depthPacking = source.depthPacking; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - this.map = source.map; - - this.alphaMap = source.alphaMap; - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - return this; - -}; - -/** - * @author bhouston / http://clara.io - * @author WestLangley / http://github.com/WestLangley - */ - -function Box3( min, max ) { - - this.min = ( min !== undefined ) ? min : new Vector3( + Infinity, + Infinity, + Infinity ); - this.max = ( max !== undefined ) ? max : new Vector3( - Infinity, - Infinity, - Infinity ); - -} - -Box3.prototype = { - - constructor: Box3, - - isBox3: true, - - set: function ( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - }, - - setFromArray: function ( array ) { - - var minX = + Infinity; - var minY = + Infinity; - var minZ = + Infinity; - - var maxX = - Infinity; - var maxY = - Infinity; - var maxZ = - Infinity; - - for ( var i = 0, l = array.length; i < l; i += 3 ) { - - var x = array[ i ]; - var y = array[ i + 1 ]; - var z = array[ i + 2 ]; - - if ( x < minX ) minX = x; - if ( y < minY ) minY = y; - if ( z < minZ ) minZ = z; - - if ( x > maxX ) maxX = x; - if ( y > maxY ) maxY = y; - if ( z > maxZ ) maxZ = z; - - } - - this.min.set( minX, minY, minZ ); - this.max.set( maxX, maxY, maxZ ); - - }, - - setFromPoints: function ( points ) { - - this.makeEmpty(); - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - this.expandByPoint( points[ i ] ); - - } - - return this; - - }, - - setFromCenterAndSize: function () { - - var v1 = new Vector3(); - - return function setFromCenterAndSize( center, size ) { - - var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); - - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - }; - - }(), - - setFromObject: function () { - - // Computes the world-axis-aligned bounding box of an object (including its children), - // accounting for both the object's, and children's, world transforms - - var v1 = new Vector3(); - - return function setFromObject( object ) { - - var scope = this; - - object.updateMatrixWorld( true ); - - this.makeEmpty(); - - object.traverse( function ( node ) { - - var geometry = node.geometry; - - if ( geometry !== undefined ) { - - if ( geometry.isGeometry ) { - - var vertices = geometry.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - v1.copy( vertices[ i ] ); - v1.applyMatrix4( node.matrixWorld ); - - scope.expandByPoint( v1 ); - - } - - } else if ( geometry.isBufferGeometry ) { - - var attribute = geometry.attributes.position; - - if ( attribute !== undefined ) { - - var array, offset, stride; - - if ( attribute.isInterleavedBufferAttribute ) { - - array = attribute.data.array; - offset = attribute.offset; - stride = attribute.data.stride; - - } else { - - array = attribute.array; - offset = 0; - stride = 3; - - } - - for ( var i = offset, il = array.length; i < il; i += stride ) { - - v1.fromArray( array, i ); - v1.applyMatrix4( node.matrixWorld ); - - scope.expandByPoint( v1 ); - - } - - } - - } - - } - - } ); - - return this; - - }; - - }(), - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - }, - - makeEmpty: function () { - - this.min.x = this.min.y = this.min.z = + Infinity; - this.max.x = this.max.y = this.max.z = - Infinity; - - return this; - - }, - - isEmpty: function () { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z ); - - }, - - getCenter: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return this.isEmpty() ? result.set( 0, 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - }, - - getSize: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return this.isEmpty() ? result.set( 0, 0, 0 ) : result.subVectors( this.max, this.min ); - - }, - - expandByPoint: function ( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - - }, - - expandByVector: function ( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - - }, - - expandByScalar: function ( scalar ) { - - this.min.addScalar( - scalar ); - this.max.addScalar( scalar ); - - return this; - - }, - - containsPoint: function ( point ) { - - if ( point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y || - point.z < this.min.z || point.z > this.max.z ) { - - return false; - - } - - return true; - - }, - - containsBox: function ( box ) { - - if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && - ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) && - ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) { - - return true; - - } - - return false; - - }, - - getParameter: function ( point, optionalTarget ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - var result = optionalTarget || new Vector3(); - - return result.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ), - ( point.z - this.min.z ) / ( this.max.z - this.min.z ) - ); - - }, - - intersectsBox: function ( box ) { - - // using 6 splitting planes to rule out intersections. - - if ( box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y || - box.max.z < this.min.z || box.min.z > this.max.z ) { - - return false; - - } - - return true; - - }, - - intersectsSphere: ( function () { - - var closestPoint; - - return function intersectsSphere( sphere ) { - - if ( closestPoint === undefined ) closestPoint = new Vector3(); - - // Find the point on the AABB closest to the sphere center. - this.clampPoint( sphere.center, closestPoint ); - - // If that point is inside the sphere, the AABB and sphere intersect. - return closestPoint.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius ); - - }; - - } )(), - - intersectsPlane: function ( plane ) { - - // We compute the minimum and maximum dot product values. If those values - // are on the same side (back or front) of the plane, then there is no intersection. - - var min, max; - - if ( plane.normal.x > 0 ) { - - min = plane.normal.x * this.min.x; - max = plane.normal.x * this.max.x; - - } else { - - min = plane.normal.x * this.max.x; - max = plane.normal.x * this.min.x; - - } - - if ( plane.normal.y > 0 ) { - - min += plane.normal.y * this.min.y; - max += plane.normal.y * this.max.y; - - } else { - - min += plane.normal.y * this.max.y; - max += plane.normal.y * this.min.y; - - } - - if ( plane.normal.z > 0 ) { - - min += plane.normal.z * this.min.z; - max += plane.normal.z * this.max.z; - - } else { - - min += plane.normal.z * this.max.z; - max += plane.normal.z * this.min.z; - - } - - return ( min <= plane.constant && max >= plane.constant ); - - }, - - clampPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.copy( point ).clamp( this.min, this.max ); - - }, - - distanceToPoint: function () { - - var v1 = new Vector3(); - - return function distanceToPoint( point ) { - - var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - }; - - }(), - - getBoundingSphere: function () { - - var v1 = new Vector3(); - - return function getBoundingSphere( optionalTarget ) { - - var result = optionalTarget || new Sphere(); - - this.getCenter( result.center ); - - result.radius = this.getSize( v1 ).length() * 0.5; - - return result; - - }; - - }(), - - intersect: function ( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values. - if( this.isEmpty() ) this.makeEmpty(); - - return this; - - }, - - union: function ( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - }, - - applyMatrix4: function () { - - var points = [ - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3() - ]; - - return function applyMatrix4( matrix ) { - - // transform of empty box is an empty box. - if( this.isEmpty() ) return this; - - // NOTE: I am using a binary pattern to specify all 2^3 combinations below - points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000 - points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001 - points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010 - points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011 - points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100 - points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101 - points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110 - points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111 - - this.setFromPoints( points ); - - return this; - - }; - - }(), - - translate: function ( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - }, - - equals: function ( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - } - -}; - -/** - * @author bhouston / http://clara.io - * @author mrdoob / http://mrdoob.com/ - */ - -function Sphere( center, radius ) { - - this.center = ( center !== undefined ) ? center : new Vector3(); - this.radius = ( radius !== undefined ) ? radius : 0; - -} - -Sphere.prototype = { - - constructor: Sphere, - - set: function ( center, radius ) { - - this.center.copy( center ); - this.radius = radius; - - return this; - - }, - - setFromPoints: function () { - - var box = new Box3(); - - return function setFromPoints( points, optionalCenter ) { - - var center = this.center; - - if ( optionalCenter !== undefined ) { - - center.copy( optionalCenter ); - - } else { - - box.setFromPoints( points ).getCenter( center ); - - } - - var maxRadiusSq = 0; - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) ); - - } - - this.radius = Math.sqrt( maxRadiusSq ); - - return this; - - }; - - }(), - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( sphere ) { - - this.center.copy( sphere.center ); - this.radius = sphere.radius; - - return this; - - }, - - empty: function () { - - return ( this.radius <= 0 ); - - }, - - containsPoint: function ( point ) { - - return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) ); - - }, - - distanceToPoint: function ( point ) { - - return ( point.distanceTo( this.center ) - this.radius ); - - }, - - intersectsSphere: function ( sphere ) { - - var radiusSum = this.radius + sphere.radius; - - return sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum ); - - }, - - intersectsBox: function ( box ) { - - return box.intersectsSphere( this ); - - }, - - intersectsPlane: function ( plane ) { - - // We use the following equation to compute the signed distance from - // the center of the sphere to the plane. - // - // distance = q * n - d - // - // If this distance is greater than the radius of the sphere, - // then there is no intersection. - - return Math.abs( this.center.dot( plane.normal ) - plane.constant ) <= this.radius; - - }, - - clampPoint: function ( point, optionalTarget ) { - - var deltaLengthSq = this.center.distanceToSquared( point ); - - var result = optionalTarget || new Vector3(); - - result.copy( point ); - - if ( deltaLengthSq > ( this.radius * this.radius ) ) { - - result.sub( this.center ).normalize(); - result.multiplyScalar( this.radius ).add( this.center ); - - } - - return result; - - }, - - getBoundingBox: function ( optionalTarget ) { - - var box = optionalTarget || new Box3(); - - box.set( this.center, this.center ); - box.expandByScalar( this.radius ); - - return box; - - }, - - applyMatrix4: function ( matrix ) { - - this.center.applyMatrix4( matrix ); - this.radius = this.radius * matrix.getMaxScaleOnAxis(); - - return this; - - }, - - translate: function ( offset ) { - - this.center.add( offset ); - - return this; - - }, - - equals: function ( sphere ) { - - return sphere.center.equals( this.center ) && ( sphere.radius === this.radius ); - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://clara.io - * @author tschw - */ - -function Matrix3() { - - this.elements = new Float32Array( [ - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ] ); - - if ( arguments.length > 0 ) { - - console.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' ); - - } - -} - -Matrix3.prototype = { - - constructor: Matrix3, - - isMatrix3: true, - - set: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) { - - var te = this.elements; - - te[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31; - te[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32; - te[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33; - - return this; - - }, - - identity: function () { - - this.set( - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ); - - return this; - - }, - - clone: function () { - - return new this.constructor().fromArray( this.elements ); - - }, - - copy: function ( m ) { - - var me = m.elements; - - this.set( - - me[ 0 ], me[ 3 ], me[ 6 ], - me[ 1 ], me[ 4 ], me[ 7 ], - me[ 2 ], me[ 5 ], me[ 8 ] - - ); - - return this; - - }, - - setFromMatrix4: function( m ) { - - var me = m.elements; - - this.set( - - me[ 0 ], me[ 4 ], me[ 8 ], - me[ 1 ], me[ 5 ], me[ 9 ], - me[ 2 ], me[ 6 ], me[ 10 ] - - ); - - return this; - - }, - - applyToVector3Array: function () { - - var v1; - - return function applyToVector3Array( array, offset, length ) { - - if ( v1 === undefined ) v1 = new Vector3(); - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = array.length; - - for ( var i = 0, j = offset; i < length; i += 3, j += 3 ) { - - v1.fromArray( array, j ); - v1.applyMatrix3( this ); - v1.toArray( array, j ); - - } - - return array; - - }; - - }(), - - applyToBuffer: function () { - - var v1; - - return function applyToBuffer( buffer, offset, length ) { - - if ( v1 === undefined ) v1 = new Vector3(); - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = buffer.length / buffer.itemSize; - - for ( var i = 0, j = offset; i < length; i ++, j ++ ) { - - v1.x = buffer.getX( j ); - v1.y = buffer.getY( j ); - v1.z = buffer.getZ( j ); - - v1.applyMatrix3( this ); - - buffer.setXYZ( j, v1.x, v1.y, v1.z ); - - } - - return buffer; - - }; - - }(), - - multiplyScalar: function ( s ) { - - var te = this.elements; - - te[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s; - te[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s; - te[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s; - - return this; - - }, - - determinant: function () { - - var te = this.elements; - - var a = te[ 0 ], b = te[ 1 ], c = te[ 2 ], - d = te[ 3 ], e = te[ 4 ], f = te[ 5 ], - g = te[ 6 ], h = te[ 7 ], i = te[ 8 ]; - - return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; - - }, - - getInverse: function ( matrix, throwOnDegenerate ) { - - if ( matrix && matrix.isMatrix4 ) { - - console.error( "THREE.Matrix3.getInverse no longer takes a Matrix4 argument." ); - - } - - var me = matrix.elements, - te = this.elements, - - n11 = me[ 0 ], n21 = me[ 1 ], n31 = me[ 2 ], - n12 = me[ 3 ], n22 = me[ 4 ], n32 = me[ 5 ], - n13 = me[ 6 ], n23 = me[ 7 ], n33 = me[ 8 ], - - t11 = n33 * n22 - n32 * n23, - t12 = n32 * n13 - n33 * n12, - t13 = n23 * n12 - n22 * n13, - - det = n11 * t11 + n21 * t12 + n31 * t13; - - if ( det === 0 ) { - - var msg = "THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"; - - if ( throwOnDegenerate === true ) { - - throw new Error( msg ); - - } else { - - console.warn( msg ); - - } - - return this.identity(); - } - - var detInv = 1 / det; - - te[ 0 ] = t11 * detInv; - te[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv; - te[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv; - - te[ 3 ] = t12 * detInv; - te[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv; - te[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv; - - te[ 6 ] = t13 * detInv; - te[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv; - te[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv; - - return this; - - }, - - transpose: function () { - - var tmp, m = this.elements; - - tmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp; - tmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp; - tmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp; - - return this; - - }, - - getNormalMatrix: function ( matrix4 ) { - - return this.setFromMatrix4( matrix4 ).getInverse( this ).transpose(); - - }, - - transposeIntoArray: function ( r ) { - - var m = this.elements; - - r[ 0 ] = m[ 0 ]; - r[ 1 ] = m[ 3 ]; - r[ 2 ] = m[ 6 ]; - r[ 3 ] = m[ 1 ]; - r[ 4 ] = m[ 4 ]; - r[ 5 ] = m[ 7 ]; - r[ 6 ] = m[ 2 ]; - r[ 7 ] = m[ 5 ]; - r[ 8 ] = m[ 8 ]; - - return this; - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - for( var i = 0; i < 9; i ++ ) { - - this.elements[ i ] = array[ i + offset ]; - - } - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - var te = this.elements; - - array[ offset ] = te[ 0 ]; - array[ offset + 1 ] = te[ 1 ]; - array[ offset + 2 ] = te[ 2 ]; - - array[ offset + 3 ] = te[ 3 ]; - array[ offset + 4 ] = te[ 4 ]; - array[ offset + 5 ] = te[ 5 ]; - - array[ offset + 6 ] = te[ 6 ]; - array[ offset + 7 ] = te[ 7 ]; - array[ offset + 8 ] = te[ 8 ]; - - return array; - - } - -}; - -/** - * @author bhouston / http://clara.io - */ - -function Plane( normal, constant ) { - - this.normal = ( normal !== undefined ) ? normal : new Vector3( 1, 0, 0 ); - this.constant = ( constant !== undefined ) ? constant : 0; - -} - -Plane.prototype = { - - constructor: Plane, - - set: function ( normal, constant ) { - - this.normal.copy( normal ); - this.constant = constant; - - return this; - - }, - - setComponents: function ( x, y, z, w ) { - - this.normal.set( x, y, z ); - this.constant = w; - - return this; - - }, - - setFromNormalAndCoplanarPoint: function ( normal, point ) { - - this.normal.copy( normal ); - this.constant = - point.dot( this.normal ); // must be this.normal, not normal, as this.normal is normalized - - return this; - - }, - - setFromCoplanarPoints: function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - - return function setFromCoplanarPoints( a, b, c ) { - - var normal = v1.subVectors( c, b ).cross( v2.subVectors( a, b ) ).normalize(); - - // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? - - this.setFromNormalAndCoplanarPoint( normal, a ); - - return this; - - }; - - }(), - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( plane ) { - - this.normal.copy( plane.normal ); - this.constant = plane.constant; - - return this; - - }, - - normalize: function () { - - // Note: will lead to a divide by zero if the plane is invalid. - - var inverseNormalLength = 1.0 / this.normal.length(); - this.normal.multiplyScalar( inverseNormalLength ); - this.constant *= inverseNormalLength; - - return this; - - }, - - negate: function () { - - this.constant *= - 1; - this.normal.negate(); - - return this; - - }, - - distanceToPoint: function ( point ) { - - return this.normal.dot( point ) + this.constant; - - }, - - distanceToSphere: function ( sphere ) { - - return this.distanceToPoint( sphere.center ) - sphere.radius; - - }, - - projectPoint: function ( point, optionalTarget ) { - - return this.orthoPoint( point, optionalTarget ).sub( point ).negate(); - - }, - - orthoPoint: function ( point, optionalTarget ) { - - var perpendicularMagnitude = this.distanceToPoint( point ); - - var result = optionalTarget || new Vector3(); - return result.copy( this.normal ).multiplyScalar( perpendicularMagnitude ); - - }, - - intersectLine: function () { - - var v1 = new Vector3(); - - return function intersectLine( line, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - var direction = line.delta( v1 ); - - var denominator = this.normal.dot( direction ); - - if ( denominator === 0 ) { - - // line is coplanar, return origin - if ( this.distanceToPoint( line.start ) === 0 ) { - - return result.copy( line.start ); - - } - - // Unsure if this is the correct method to handle this case. - return undefined; - - } - - var t = - ( line.start.dot( this.normal ) + this.constant ) / denominator; - - if ( t < 0 || t > 1 ) { - - return undefined; - - } - - return result.copy( direction ).multiplyScalar( t ).add( line.start ); - - }; - - }(), - - intersectsLine: function ( line ) { - - // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it. - - var startSign = this.distanceToPoint( line.start ); - var endSign = this.distanceToPoint( line.end ); - - return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 ); - - }, - - intersectsBox: function ( box ) { - - return box.intersectsPlane( this ); - - }, - - intersectsSphere: function ( sphere ) { - - return sphere.intersectsPlane( this ); - - }, - - coplanarPoint: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.copy( this.normal ).multiplyScalar( - this.constant ); - - }, - - applyMatrix4: function () { - - var v1 = new Vector3(); - var m1 = new Matrix3(); - - return function applyMatrix4( matrix, optionalNormalMatrix ) { - - var referencePoint = this.coplanarPoint( v1 ).applyMatrix4( matrix ); - - // transform normal based on theory here: - // http://www.songho.ca/opengl/gl_normaltransform.html - var normalMatrix = optionalNormalMatrix || m1.getNormalMatrix( matrix ); - var normal = this.normal.applyMatrix3( normalMatrix ).normalize(); - - // recalculate constant (like in setFromNormalAndCoplanarPoint) - this.constant = - referencePoint.dot( normal ); - - return this; - - }; - - }(), - - translate: function ( offset ) { - - this.constant = this.constant - offset.dot( this.normal ); - - return this; - - }, - - equals: function ( plane ) { - - return plane.normal.equals( this.normal ) && ( plane.constant === this.constant ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author bhouston / http://clara.io - */ - -function Frustum( p0, p1, p2, p3, p4, p5 ) { - - this.planes = [ - - ( p0 !== undefined ) ? p0 : new Plane(), - ( p1 !== undefined ) ? p1 : new Plane(), - ( p2 !== undefined ) ? p2 : new Plane(), - ( p3 !== undefined ) ? p3 : new Plane(), - ( p4 !== undefined ) ? p4 : new Plane(), - ( p5 !== undefined ) ? p5 : new Plane() - - ]; - -} - -Frustum.prototype = { - - constructor: Frustum, - - set: function ( p0, p1, p2, p3, p4, p5 ) { - - var planes = this.planes; - - planes[ 0 ].copy( p0 ); - planes[ 1 ].copy( p1 ); - planes[ 2 ].copy( p2 ); - planes[ 3 ].copy( p3 ); - planes[ 4 ].copy( p4 ); - planes[ 5 ].copy( p5 ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( frustum ) { - - var planes = this.planes; - - for ( var i = 0; i < 6; i ++ ) { - - planes[ i ].copy( frustum.planes[ i ] ); - - } - - return this; - - }, - - setFromMatrix: function ( m ) { - - var planes = this.planes; - var me = m.elements; - var me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ]; - var me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ]; - var me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ]; - var me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ]; - - planes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize(); - planes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize(); - planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize(); - planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize(); - planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); - planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize(); - - return this; - - }, - - intersectsObject: function () { - - var sphere = new Sphere(); - - return function intersectsObject( object ) { - - var geometry = object.geometry; - - if ( geometry.boundingSphere === null ) - geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ) - .applyMatrix4( object.matrixWorld ); - - return this.intersectsSphere( sphere ); - - }; - - }(), - - intersectsSprite: function () { - - var sphere = new Sphere(); - - return function intersectsSprite( sprite ) { - - sphere.center.set( 0, 0, 0 ); - sphere.radius = 0.7071067811865476; - sphere.applyMatrix4( sprite.matrixWorld ); - - return this.intersectsSphere( sphere ); - - }; - - }(), - - intersectsSphere: function ( sphere ) { - - var planes = this.planes; - var center = sphere.center; - var negRadius = - sphere.radius; - - for ( var i = 0; i < 6; i ++ ) { - - var distance = planes[ i ].distanceToPoint( center ); - - if ( distance < negRadius ) { - - return false; - - } - - } - - return true; - - }, - - intersectsBox: function () { - - var p1 = new Vector3(), - p2 = new Vector3(); - - return function intersectsBox( box ) { - - var planes = this.planes; - - for ( var i = 0; i < 6 ; i ++ ) { - - var plane = planes[ i ]; - - p1.x = plane.normal.x > 0 ? box.min.x : box.max.x; - p2.x = plane.normal.x > 0 ? box.max.x : box.min.x; - p1.y = plane.normal.y > 0 ? box.min.y : box.max.y; - p2.y = plane.normal.y > 0 ? box.max.y : box.min.y; - p1.z = plane.normal.z > 0 ? box.min.z : box.max.z; - p2.z = plane.normal.z > 0 ? box.max.z : box.min.z; - - var d1 = plane.distanceToPoint( p1 ); - var d2 = plane.distanceToPoint( p2 ); - - // if both outside plane, no intersection - - if ( d1 < 0 && d2 < 0 ) { - - return false; - - } - - } - - return true; - - }; - - }(), - - - containsPoint: function ( point ) { - - var planes = this.planes; - - for ( var i = 0; i < 6; i ++ ) { - - if ( planes[ i ].distanceToPoint( point ) < 0 ) { - - return false; - - } - - } - - return true; - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) { - - var _gl = _renderer.context, - _state = _renderer.state, - _frustum = new Frustum(), - _projScreenMatrix = new Matrix4(), - - _lightShadows = _lights.shadows, - - _shadowMapSize = new Vector2(), - _maxShadowMapSize = new Vector2( capabilities.maxTextureSize, capabilities.maxTextureSize ), - - _lookTarget = new Vector3(), - _lightPositionWorld = new Vector3(), - - _renderList = [], - - _MorphingFlag = 1, - _SkinningFlag = 2, - - _NumberOfMaterialVariants = ( _MorphingFlag | _SkinningFlag ) + 1, - - _depthMaterials = new Array( _NumberOfMaterialVariants ), - _distanceMaterials = new Array( _NumberOfMaterialVariants ), - - _materialCache = {}; - - var cubeDirections = [ - new Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ), - new Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 ) - ]; - - var cubeUps = [ - new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), - new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ), new Vector3( 0, 0, - 1 ) - ]; - - var cube2DViewPorts = [ - new Vector4(), new Vector4(), new Vector4(), - new Vector4(), new Vector4(), new Vector4() - ]; - - // init - - var depthMaterialTemplate = new MeshDepthMaterial(); - depthMaterialTemplate.depthPacking = RGBADepthPacking; - depthMaterialTemplate.clipping = true; - - var distanceShader = ShaderLib[ "distanceRGBA" ]; - var distanceUniforms = Object.assign( {}, distanceShader.uniforms ); - - for ( var i = 0; i !== _NumberOfMaterialVariants; ++ i ) { - - var useMorphing = ( i & _MorphingFlag ) !== 0; - var useSkinning = ( i & _SkinningFlag ) !== 0; - - var depthMaterial = depthMaterialTemplate.clone(); - depthMaterial.morphTargets = useMorphing; - depthMaterial.skinning = useSkinning; - - _depthMaterials[ i ] = depthMaterial; - - var distanceMaterial = new ShaderMaterial( { - defines: { - 'USE_SHADOWMAP': '' - }, - uniforms: distanceUniforms, - vertexShader: distanceShader.vertexShader, - fragmentShader: distanceShader.fragmentShader, - morphTargets: useMorphing, - skinning: useSkinning, - clipping: true - } ); - - _distanceMaterials[ i ] = distanceMaterial; - - } - - // - - var scope = this; - - this.enabled = false; - - this.autoUpdate = true; - this.needsUpdate = false; - - this.type = PCFShadowMap; - - this.renderReverseSided = true; - this.renderSingleSided = true; - - this.render = function ( scene, camera ) { - - if ( scope.enabled === false ) return; - if ( scope.autoUpdate === false && scope.needsUpdate === false ) return; - - if ( _lightShadows.length === 0 ) return; - - // Set GL state for depth map. - _state.buffers.color.setClear( 1, 1, 1, 1 ); - _state.disable( _gl.BLEND ); - _state.setDepthTest( true ); - _state.setScissorTest( false ); - - // render depth map - - var faceCount, isPointLight; - - for ( var i = 0, il = _lightShadows.length; i < il; i ++ ) { - - var light = _lightShadows[ i ]; - var shadow = light.shadow; - - if ( shadow === undefined ) { - - console.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' ); - continue; - - } - - var shadowCamera = shadow.camera; - - _shadowMapSize.copy( shadow.mapSize ); - _shadowMapSize.min( _maxShadowMapSize ); - - if ( light && light.isPointLight ) { - - faceCount = 6; - isPointLight = true; - - var vpWidth = _shadowMapSize.x; - var vpHeight = _shadowMapSize.y; - - // These viewports map a cube-map onto a 2D texture with the - // following orientation: - // - // xzXZ - // y Y - // - // X - Positive x direction - // x - Negative x direction - // Y - Positive y direction - // y - Negative y direction - // Z - Positive z direction - // z - Negative z direction - - // positive X - cube2DViewPorts[ 0 ].set( vpWidth * 2, vpHeight, vpWidth, vpHeight ); - // negative X - cube2DViewPorts[ 1 ].set( 0, vpHeight, vpWidth, vpHeight ); - // positive Z - cube2DViewPorts[ 2 ].set( vpWidth * 3, vpHeight, vpWidth, vpHeight ); - // negative Z - cube2DViewPorts[ 3 ].set( vpWidth, vpHeight, vpWidth, vpHeight ); - // positive Y - cube2DViewPorts[ 4 ].set( vpWidth * 3, 0, vpWidth, vpHeight ); - // negative Y - cube2DViewPorts[ 5 ].set( vpWidth, 0, vpWidth, vpHeight ); - - _shadowMapSize.x *= 4.0; - _shadowMapSize.y *= 2.0; - - } else { - - faceCount = 1; - isPointLight = false; - - } - - if ( shadow.map === null ) { - - var pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat }; - - shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars ); - - shadowCamera.updateProjectionMatrix(); - - } - - if ( shadow.isSpotLightShadow ) { - - shadow.update( light ); - - } - - // TODO (abelnation / sam-g-steel): is this needed? - if (shadow && shadow.isRectAreaLightShadow ) { - - shadow.update( light ); - - } - - var shadowMap = shadow.map; - var shadowMatrix = shadow.matrix; - - _lightPositionWorld.setFromMatrixPosition( light.matrixWorld ); - shadowCamera.position.copy( _lightPositionWorld ); - - _renderer.setRenderTarget( shadowMap ); - _renderer.clear(); - - // render shadow map for each cube face (if omni-directional) or - // run a single pass if not - - for ( var face = 0; face < faceCount; face ++ ) { - - if ( isPointLight ) { - - _lookTarget.copy( shadowCamera.position ); - _lookTarget.add( cubeDirections[ face ] ); - shadowCamera.up.copy( cubeUps[ face ] ); - shadowCamera.lookAt( _lookTarget ); - - var vpDimensions = cube2DViewPorts[ face ]; - _state.viewport( vpDimensions ); - - } else { - - _lookTarget.setFromMatrixPosition( light.target.matrixWorld ); - shadowCamera.lookAt( _lookTarget ); - - } - - shadowCamera.updateMatrixWorld(); - shadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld ); - - // compute shadow matrix - - shadowMatrix.set( - 0.5, 0.0, 0.0, 0.5, - 0.0, 0.5, 0.0, 0.5, - 0.0, 0.0, 0.5, 0.5, - 0.0, 0.0, 0.0, 1.0 - ); - - shadowMatrix.multiply( shadowCamera.projectionMatrix ); - shadowMatrix.multiply( shadowCamera.matrixWorldInverse ); - - // update camera matrices and frustum - - _projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - // set object matrices & frustum culling - - _renderList.length = 0; - - projectObject( scene, camera, shadowCamera ); - - // render shadow map - // render regular objects - - for ( var j = 0, jl = _renderList.length; j < jl; j ++ ) { - - var object = _renderList[ j ]; - var geometry = _objects.update( object ); - var material = object.material; - - if ( material && material.isMultiMaterial ) { - - var groups = geometry.groups; - var materials = material.materials; - - for ( var k = 0, kl = groups.length; k < kl; k ++ ) { - - var group = groups[ k ]; - var groupMaterial = materials[ group.materialIndex ]; - - if ( groupMaterial.visible === true ) { - - var depthMaterial = getDepthMaterial( object, groupMaterial, isPointLight, _lightPositionWorld ); - _renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group ); - - } - - } - - } else { - - var depthMaterial = getDepthMaterial( object, material, isPointLight, _lightPositionWorld ); - _renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null ); - - } - - } - - } - - } - - // Restore GL state. - var clearColor = _renderer.getClearColor(), - clearAlpha = _renderer.getClearAlpha(); - _renderer.setClearColor( clearColor, clearAlpha ); - - scope.needsUpdate = false; - - }; - - function getDepthMaterial( object, material, isPointLight, lightPositionWorld ) { - - var geometry = object.geometry; - - var result = null; - - var materialVariants = _depthMaterials; - var customMaterial = object.customDepthMaterial; - - if ( isPointLight ) { - - materialVariants = _distanceMaterials; - customMaterial = object.customDistanceMaterial; - - } - - if ( ! customMaterial ) { - - var useMorphing = false; - - if ( material.morphTargets ) { - - if ( geometry && geometry.isBufferGeometry ) { - - useMorphing = geometry.morphAttributes && geometry.morphAttributes.position && geometry.morphAttributes.position.length > 0; - - } else if ( geometry && geometry.isGeometry ) { - - useMorphing = geometry.morphTargets && geometry.morphTargets.length > 0; - - } - - } - - var useSkinning = object.isSkinnedMesh && material.skinning; - - var variantIndex = 0; - - if ( useMorphing ) variantIndex |= _MorphingFlag; - if ( useSkinning ) variantIndex |= _SkinningFlag; - - result = materialVariants[ variantIndex ]; - - } else { - - result = customMaterial; - - } - - if ( _renderer.localClippingEnabled && - material.clipShadows === true && - material.clippingPlanes.length !== 0 ) { - - // in this case we need a unique material instance reflecting the - // appropriate state - - var keyA = result.uuid, keyB = material.uuid; - - var materialsForVariant = _materialCache[ keyA ]; - - if ( materialsForVariant === undefined ) { - - materialsForVariant = {}; - _materialCache[ keyA ] = materialsForVariant; - - } - - var cachedMaterial = materialsForVariant[ keyB ]; - - if ( cachedMaterial === undefined ) { - - cachedMaterial = result.clone(); - materialsForVariant[ keyB ] = cachedMaterial; - - } - - result = cachedMaterial; - - } - - result.visible = material.visible; - result.wireframe = material.wireframe; - - var side = material.side; - - if ( scope.renderSingleSided && side == DoubleSide ) { - - side = FrontSide; - - } - - if ( scope.renderReverseSided ) { - - if ( side === FrontSide ) side = BackSide; - else if ( side === BackSide ) side = FrontSide; - - } - - result.side = side; - - result.clipShadows = material.clipShadows; - result.clippingPlanes = material.clippingPlanes; - - result.wireframeLinewidth = material.wireframeLinewidth; - result.linewidth = material.linewidth; - - if ( isPointLight && result.uniforms.lightPos !== undefined ) { - - result.uniforms.lightPos.value.copy( lightPositionWorld ); - - } - - return result; - - } - - function projectObject( object, camera, shadowCamera ) { - - if ( object.visible === false ) return; - - var visible = ( object.layers.mask & camera.layers.mask ) !== 0; - - if ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) { - - if ( object.castShadow && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) { - - var material = object.material; - - if ( material.visible === true ) { - - object.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); - _renderList.push( object ); - - } - - } - - } - - var children = object.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - projectObject( children[ i ], camera, shadowCamera ); - - } - - } - -} - -/** - * @author bhouston / http://clara.io - */ - -function Ray( origin, direction ) { - - this.origin = ( origin !== undefined ) ? origin : new Vector3(); - this.direction = ( direction !== undefined ) ? direction : new Vector3(); - -} - -Ray.prototype = { - - constructor: Ray, - - set: function ( origin, direction ) { - - this.origin.copy( origin ); - this.direction.copy( direction ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( ray ) { - - this.origin.copy( ray.origin ); - this.direction.copy( ray.direction ); - - return this; - - }, - - at: function ( t, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - return result.copy( this.direction ).multiplyScalar( t ).add( this.origin ); - - }, - - lookAt: function ( v ) { - - this.direction.copy( v ).sub( this.origin ).normalize(); - - return this; - - }, - - recast: function () { - - var v1 = new Vector3(); - - return function recast( t ) { - - this.origin.copy( this.at( t, v1 ) ); - - return this; - - }; - - }(), - - closestPointToPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - result.subVectors( point, this.origin ); - var directionDistance = result.dot( this.direction ); - - if ( directionDistance < 0 ) { - - return result.copy( this.origin ); - - } - - return result.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - }, - - distanceToPoint: function ( point ) { - - return Math.sqrt( this.distanceSqToPoint( point ) ); - - }, - - distanceSqToPoint: function () { - - var v1 = new Vector3(); - - return function distanceSqToPoint( point ) { - - var directionDistance = v1.subVectors( point, this.origin ).dot( this.direction ); - - // point behind the ray - - if ( directionDistance < 0 ) { - - return this.origin.distanceToSquared( point ); - - } - - v1.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - return v1.distanceToSquared( point ); - - }; - - }(), - - distanceSqToSegment: function () { - - var segCenter = new Vector3(); - var segDir = new Vector3(); - var diff = new Vector3(); - - return function distanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) { - - // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h - // It returns the min distance between the ray and the segment - // defined by v0 and v1 - // It can also set two optional targets : - // - The closest point on the ray - // - The closest point on the segment - - segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 ); - segDir.copy( v1 ).sub( v0 ).normalize(); - diff.copy( this.origin ).sub( segCenter ); - - var segExtent = v0.distanceTo( v1 ) * 0.5; - var a01 = - this.direction.dot( segDir ); - var b0 = diff.dot( this.direction ); - var b1 = - diff.dot( segDir ); - var c = diff.lengthSq(); - var det = Math.abs( 1 - a01 * a01 ); - var s0, s1, sqrDist, extDet; - - if ( det > 0 ) { - - // The ray and segment are not parallel. - - s0 = a01 * b1 - b0; - s1 = a01 * b0 - b1; - extDet = segExtent * det; - - if ( s0 >= 0 ) { - - if ( s1 >= - extDet ) { - - if ( s1 <= extDet ) { - - // region 0 - // Minimum at interior points of ray and segment. - - var invDet = 1 / det; - s0 *= invDet; - s1 *= invDet; - sqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c; - - } else { - - // region 1 - - s1 = segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - // region 5 - - s1 = - segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - if ( s1 <= - extDet ) { - - // region 4 - - s0 = Math.max( 0, - ( - a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } else if ( s1 <= extDet ) { - - // region 3 - - s0 = 0; - s1 = Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = s1 * ( s1 + 2 * b1 ) + c; - - } else { - - // region 2 - - s0 = Math.max( 0, - ( a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } - - } else { - - // Ray and segment are parallel. - - s1 = ( a01 > 0 ) ? - segExtent : segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - if ( optionalPointOnRay ) { - - optionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin ); - - } - - if ( optionalPointOnSegment ) { - - optionalPointOnSegment.copy( segDir ).multiplyScalar( s1 ).add( segCenter ); - - } - - return sqrDist; - - }; - - }(), - - intersectSphere: function () { - - var v1 = new Vector3(); - - return function intersectSphere( sphere, optionalTarget ) { - - v1.subVectors( sphere.center, this.origin ); - var tca = v1.dot( this.direction ); - var d2 = v1.dot( v1 ) - tca * tca; - var radius2 = sphere.radius * sphere.radius; - - if ( d2 > radius2 ) return null; - - var thc = Math.sqrt( radius2 - d2 ); - - // t0 = first intersect point - entrance on front of sphere - var t0 = tca - thc; - - // t1 = second intersect point - exit point on back of sphere - var t1 = tca + thc; - - // test to see if both t0 and t1 are behind the ray - if so, return null - if ( t0 < 0 && t1 < 0 ) return null; - - // test to see if t0 is behind the ray: - // if it is, the ray is inside the sphere, so return the second exit point scaled by t1, - // in order to always return an intersect point that is in front of the ray. - if ( t0 < 0 ) return this.at( t1, optionalTarget ); - - // else t0 is in front of the ray, so return the first collision point scaled by t0 - return this.at( t0, optionalTarget ); - - }; - - }(), - - intersectsSphere: function ( sphere ) { - - return this.distanceToPoint( sphere.center ) <= sphere.radius; - - }, - - distanceToPlane: function ( plane ) { - - var denominator = plane.normal.dot( this.direction ); - - if ( denominator === 0 ) { - - // line is coplanar, return origin - if ( plane.distanceToPoint( this.origin ) === 0 ) { - - return 0; - - } - - // Null is preferable to undefined since undefined means.... it is undefined - - return null; - - } - - var t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator; - - // Return if the ray never intersects the plane - - return t >= 0 ? t : null; - - }, - - intersectPlane: function ( plane, optionalTarget ) { - - var t = this.distanceToPlane( plane ); - - if ( t === null ) { - - return null; - - } - - return this.at( t, optionalTarget ); - - }, - - - - intersectsPlane: function ( plane ) { - - // check if the ray lies on the plane first - - var distToPoint = plane.distanceToPoint( this.origin ); - - if ( distToPoint === 0 ) { - - return true; - - } - - var denominator = plane.normal.dot( this.direction ); - - if ( denominator * distToPoint < 0 ) { - - return true; - - } - - // ray origin is behind the plane (and is pointing behind it) - - return false; - - }, - - intersectBox: function ( box, optionalTarget ) { - - var tmin, tmax, tymin, tymax, tzmin, tzmax; - - var invdirx = 1 / this.direction.x, - invdiry = 1 / this.direction.y, - invdirz = 1 / this.direction.z; - - var origin = this.origin; - - if ( invdirx >= 0 ) { - - tmin = ( box.min.x - origin.x ) * invdirx; - tmax = ( box.max.x - origin.x ) * invdirx; - - } else { - - tmin = ( box.max.x - origin.x ) * invdirx; - tmax = ( box.min.x - origin.x ) * invdirx; - - } - - if ( invdiry >= 0 ) { - - tymin = ( box.min.y - origin.y ) * invdiry; - tymax = ( box.max.y - origin.y ) * invdiry; - - } else { - - tymin = ( box.max.y - origin.y ) * invdiry; - tymax = ( box.min.y - origin.y ) * invdiry; - - } - - if ( ( tmin > tymax ) || ( tymin > tmax ) ) return null; - - // These lines also handle the case where tmin or tmax is NaN - // (result of 0 * Infinity). x !== x returns true if x is NaN - - if ( tymin > tmin || tmin !== tmin ) tmin = tymin; - - if ( tymax < tmax || tmax !== tmax ) tmax = tymax; - - if ( invdirz >= 0 ) { - - tzmin = ( box.min.z - origin.z ) * invdirz; - tzmax = ( box.max.z - origin.z ) * invdirz; - - } else { - - tzmin = ( box.max.z - origin.z ) * invdirz; - tzmax = ( box.min.z - origin.z ) * invdirz; - - } - - if ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null; - - if ( tzmin > tmin || tmin !== tmin ) tmin = tzmin; - - if ( tzmax < tmax || tmax !== tmax ) tmax = tzmax; - - //return point closest to the ray (positive side) - - if ( tmax < 0 ) return null; - - return this.at( tmin >= 0 ? tmin : tmax, optionalTarget ); - - }, - - intersectsBox: ( function () { - - var v = new Vector3(); - - return function intersectsBox( box ) { - - return this.intersectBox( box, v ) !== null; - - }; - - } )(), - - intersectTriangle: function () { - - // Compute the offset origin, edges, and normal. - var diff = new Vector3(); - var edge1 = new Vector3(); - var edge2 = new Vector3(); - var normal = new Vector3(); - - return function intersectTriangle( a, b, c, backfaceCulling, optionalTarget ) { - - // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h - - edge1.subVectors( b, a ); - edge2.subVectors( c, a ); - normal.crossVectors( edge1, edge2 ); - - // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, - // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by - // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2)) - // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q)) - // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N) - var DdN = this.direction.dot( normal ); - var sign; - - if ( DdN > 0 ) { - - if ( backfaceCulling ) return null; - sign = 1; - - } else if ( DdN < 0 ) { - - sign = - 1; - DdN = - DdN; - - } else { - - return null; - - } - - diff.subVectors( this.origin, a ); - var DdQxE2 = sign * this.direction.dot( edge2.crossVectors( diff, edge2 ) ); - - // b1 < 0, no intersection - if ( DdQxE2 < 0 ) { - - return null; - - } - - var DdE1xQ = sign * this.direction.dot( edge1.cross( diff ) ); - - // b2 < 0, no intersection - if ( DdE1xQ < 0 ) { - - return null; - - } - - // b1+b2 > 1, no intersection - if ( DdQxE2 + DdE1xQ > DdN ) { - - return null; - - } - - // Line intersects triangle, check if ray does. - var QdN = - sign * diff.dot( normal ); - - // t < 0, no intersection - if ( QdN < 0 ) { - - return null; - - } - - // Ray intersects triangle. - return this.at( QdN / DdN, optionalTarget ); - - }; - - }(), - - applyMatrix4: function ( matrix4 ) { - - this.direction.add( this.origin ).applyMatrix4( matrix4 ); - this.origin.applyMatrix4( matrix4 ); - this.direction.sub( this.origin ); - this.direction.normalize(); - - return this; - - }, - - equals: function ( ray ) { - - return ray.origin.equals( this.origin ) && ray.direction.equals( this.direction ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://clara.io - */ - -function Euler( x, y, z, order ) { - - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._order = order || Euler.DefaultOrder; - -} - -Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; - -Euler.DefaultOrder = 'XYZ'; - -Euler.prototype = { - - constructor: Euler, - - isEuler: true, - - get x () { - - return this._x; - - }, - - set x ( value ) { - - this._x = value; - this.onChangeCallback(); - - }, - - get y () { - - return this._y; - - }, - - set y ( value ) { - - this._y = value; - this.onChangeCallback(); - - }, - - get z () { - - return this._z; - - }, - - set z ( value ) { - - this._z = value; - this.onChangeCallback(); - - }, - - get order () { - - return this._order; - - }, - - set order ( value ) { - - this._order = value; - this.onChangeCallback(); - - }, - - set: function ( x, y, z, order ) { - - this._x = x; - this._y = y; - this._z = z; - this._order = order || this._order; - - this.onChangeCallback(); - - return this; - - }, - - clone: function () { - - return new this.constructor( this._x, this._y, this._z, this._order ); - - }, - - copy: function ( euler ) { - - this._x = euler._x; - this._y = euler._y; - this._z = euler._z; - this._order = euler._order; - - this.onChangeCallback(); - - return this; - - }, - - setFromRotationMatrix: function ( m, order, update ) { - - var clamp = _Math.clamp; - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var te = m.elements; - var m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ]; - var m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ]; - var m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; - - order = order || this._order; - - if ( order === 'XYZ' ) { - - this._y = Math.asin( clamp( m13, - 1, 1 ) ); - - if ( Math.abs( m13 ) < 0.99999 ) { - - this._x = Math.atan2( - m23, m33 ); - this._z = Math.atan2( - m12, m11 ); - - } else { - - this._x = Math.atan2( m32, m22 ); - this._z = 0; - - } - - } else if ( order === 'YXZ' ) { - - this._x = Math.asin( - clamp( m23, - 1, 1 ) ); - - if ( Math.abs( m23 ) < 0.99999 ) { - - this._y = Math.atan2( m13, m33 ); - this._z = Math.atan2( m21, m22 ); - - } else { - - this._y = Math.atan2( - m31, m11 ); - this._z = 0; - - } - - } else if ( order === 'ZXY' ) { - - this._x = Math.asin( clamp( m32, - 1, 1 ) ); - - if ( Math.abs( m32 ) < 0.99999 ) { - - this._y = Math.atan2( - m31, m33 ); - this._z = Math.atan2( - m12, m22 ); - - } else { - - this._y = 0; - this._z = Math.atan2( m21, m11 ); - - } - - } else if ( order === 'ZYX' ) { - - this._y = Math.asin( - clamp( m31, - 1, 1 ) ); - - if ( Math.abs( m31 ) < 0.99999 ) { - - this._x = Math.atan2( m32, m33 ); - this._z = Math.atan2( m21, m11 ); - - } else { - - this._x = 0; - this._z = Math.atan2( - m12, m22 ); - - } - - } else if ( order === 'YZX' ) { - - this._z = Math.asin( clamp( m21, - 1, 1 ) ); - - if ( Math.abs( m21 ) < 0.99999 ) { - - this._x = Math.atan2( - m23, m22 ); - this._y = Math.atan2( - m31, m11 ); - - } else { - - this._x = 0; - this._y = Math.atan2( m13, m33 ); - - } - - } else if ( order === 'XZY' ) { - - this._z = Math.asin( - clamp( m12, - 1, 1 ) ); - - if ( Math.abs( m12 ) < 0.99999 ) { - - this._x = Math.atan2( m32, m22 ); - this._y = Math.atan2( m13, m11 ); - - } else { - - this._x = Math.atan2( - m23, m33 ); - this._y = 0; - - } - - } else { - - console.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order ); - - } - - this._order = order; - - if ( update !== false ) this.onChangeCallback(); - - return this; - - }, - - setFromQuaternion: function () { - - var matrix; - - return function setFromQuaternion( q, order, update ) { - - if ( matrix === undefined ) matrix = new Matrix4(); - - matrix.makeRotationFromQuaternion( q ); - - return this.setFromRotationMatrix( matrix, order, update ); - - }; - - }(), - - setFromVector3: function ( v, order ) { - - return this.set( v.x, v.y, v.z, order || this._order ); - - }, - - reorder: function () { - - // WARNING: this discards revolution information -bhouston - - var q = new Quaternion(); - - return function reorder( newOrder ) { - - q.setFromEuler( this ); - - return this.setFromQuaternion( q, newOrder ); - - }; - - }(), - - equals: function ( euler ) { - - return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order ); - - }, - - fromArray: function ( array ) { - - this._x = array[ 0 ]; - this._y = array[ 1 ]; - this._z = array[ 2 ]; - if ( array[ 3 ] !== undefined ) this._order = array[ 3 ]; - - this.onChangeCallback(); - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this._x; - array[ offset + 1 ] = this._y; - array[ offset + 2 ] = this._z; - array[ offset + 3 ] = this._order; - - return array; - - }, - - toVector3: function ( optionalResult ) { - - if ( optionalResult ) { - - return optionalResult.set( this._x, this._y, this._z ); - - } else { - - return new Vector3( this._x, this._y, this._z ); - - } - - }, - - onChange: function ( callback ) { - - this.onChangeCallback = callback; - - return this; - - }, - - onChangeCallback: function () {} - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function Layers() { - - this.mask = 1; - -} - -Layers.prototype = { - - constructor: Layers, - - set: function ( channel ) { - - this.mask = 1 << channel; - - }, - - enable: function ( channel ) { - - this.mask |= 1 << channel; - - }, - - toggle: function ( channel ) { - - this.mask ^= 1 << channel; - - }, - - disable: function ( channel ) { - - this.mask &= ~ ( 1 << channel ); - - }, - - test: function ( layers ) { - - return ( this.mask & layers.mask ) !== 0; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author elephantatwork / www.elephantatwork.ch - */ - -var object3DId = 0; - -function Object3D() { - - Object.defineProperty( this, 'id', { value: object3DId ++ } ); - - this.uuid = _Math.generateUUID(); - - this.name = ''; - this.type = 'Object3D'; - - this.parent = null; - this.children = []; - - this.up = Object3D.DefaultUp.clone(); - - var position = new Vector3(); - var rotation = new Euler(); - var quaternion = new Quaternion(); - var scale = new Vector3( 1, 1, 1 ); - - function onRotationChange() { - - quaternion.setFromEuler( rotation, false ); - - } - - function onQuaternionChange() { - - rotation.setFromQuaternion( quaternion, undefined, false ); - - } - - rotation.onChange( onRotationChange ); - quaternion.onChange( onQuaternionChange ); - - Object.defineProperties( this, { - position: { - enumerable: true, - value: position - }, - rotation: { - enumerable: true, - value: rotation - }, - quaternion: { - enumerable: true, - value: quaternion - }, - scale: { - enumerable: true, - value: scale - }, - modelViewMatrix: { - value: new Matrix4() - }, - normalMatrix: { - value: new Matrix3() - } - } ); - - this.matrix = new Matrix4(); - this.matrixWorld = new Matrix4(); - - this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate; - this.matrixWorldNeedsUpdate = false; - - this.layers = new Layers(); - this.visible = true; - - this.castShadow = false; - this.receiveShadow = false; - - this.frustumCulled = true; - this.renderOrder = 0; - - this.userData = {}; - - this.onBeforeRender = function(){}; - this.onAfterRender = function(){}; - -} - -Object3D.DefaultUp = new Vector3( 0, 1, 0 ); -Object3D.DefaultMatrixAutoUpdate = true; - -Object.assign( Object3D.prototype, EventDispatcher.prototype, { - - isObject3D: true, - - applyMatrix: function ( matrix ) { - - this.matrix.multiplyMatrices( matrix, this.matrix ); - - this.matrix.decompose( this.position, this.quaternion, this.scale ); - - }, - - setRotationFromAxisAngle: function ( axis, angle ) { - - // assumes axis is normalized - - this.quaternion.setFromAxisAngle( axis, angle ); - - }, - - setRotationFromEuler: function ( euler ) { - - this.quaternion.setFromEuler( euler, true ); - - }, - - setRotationFromMatrix: function ( m ) { - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - this.quaternion.setFromRotationMatrix( m ); - - }, - - setRotationFromQuaternion: function ( q ) { - - // assumes q is normalized - - this.quaternion.copy( q ); - - }, - - rotateOnAxis: function () { - - // rotate object on axis in object space - // axis is assumed to be normalized - - var q1 = new Quaternion(); - - return function rotateOnAxis( axis, angle ) { - - q1.setFromAxisAngle( axis, angle ); - - this.quaternion.multiply( q1 ); - - return this; - - }; - - }(), - - rotateX: function () { - - var v1 = new Vector3( 1, 0, 0 ); - - return function rotateX( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - rotateY: function () { - - var v1 = new Vector3( 0, 1, 0 ); - - return function rotateY( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - rotateZ: function () { - - var v1 = new Vector3( 0, 0, 1 ); - - return function rotateZ( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - translateOnAxis: function () { - - // translate object by distance along axis in object space - // axis is assumed to be normalized - - var v1 = new Vector3(); - - return function translateOnAxis( axis, distance ) { - - v1.copy( axis ).applyQuaternion( this.quaternion ); - - this.position.add( v1.multiplyScalar( distance ) ); - - return this; - - }; - - }(), - - translateX: function () { - - var v1 = new Vector3( 1, 0, 0 ); - - return function translateX( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - translateY: function () { - - var v1 = new Vector3( 0, 1, 0 ); - - return function translateY( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - translateZ: function () { - - var v1 = new Vector3( 0, 0, 1 ); - - return function translateZ( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - localToWorld: function ( vector ) { - - return vector.applyMatrix4( this.matrixWorld ); - - }, - - worldToLocal: function () { - - var m1 = new Matrix4(); - - return function worldToLocal( vector ) { - - return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) ); - - }; - - }(), - - lookAt: function () { - - // This routine does not support objects with rotated and/or translated parent(s) - - var m1 = new Matrix4(); - - return function lookAt( vector ) { - - m1.lookAt( vector, this.position, this.up ); - - this.quaternion.setFromRotationMatrix( m1 ); - - }; - - }(), - - add: function ( object ) { - - if ( arguments.length > 1 ) { - - for ( var i = 0; i < arguments.length; i ++ ) { - - this.add( arguments[ i ] ); - - } - - return this; - - } - - if ( object === this ) { - - console.error( "THREE.Object3D.add: object can't be added as a child of itself.", object ); - return this; - - } - - if ( (object && object.isObject3D) ) { - - if ( object.parent !== null ) { - - object.parent.remove( object ); - - } - - object.parent = this; - object.dispatchEvent( { type: 'added' } ); - - this.children.push( object ); - - } else { - - console.error( "THREE.Object3D.add: object not an instance of THREE.Object3D.", object ); - - } - - return this; - - }, - - remove: function ( object ) { - - if ( arguments.length > 1 ) { - - for ( var i = 0; i < arguments.length; i ++ ) { - - this.remove( arguments[ i ] ); - - } - - } - - var index = this.children.indexOf( object ); - - if ( index !== - 1 ) { - - object.parent = null; - - object.dispatchEvent( { type: 'removed' } ); - - this.children.splice( index, 1 ); - - } - - }, - - getObjectById: function ( id ) { - - return this.getObjectByProperty( 'id', id ); - - }, - - getObjectByName: function ( name ) { - - return this.getObjectByProperty( 'name', name ); - - }, - - getObjectByProperty: function ( name, value ) { - - if ( this[ name ] === value ) return this; - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - var child = this.children[ i ]; - var object = child.getObjectByProperty( name, value ); - - if ( object !== undefined ) { - - return object; - - } - - } - - return undefined; - - }, - - getWorldPosition: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - this.updateMatrixWorld( true ); - - return result.setFromMatrixPosition( this.matrixWorld ); - - }, - - getWorldQuaternion: function () { - - var position = new Vector3(); - var scale = new Vector3(); - - return function getWorldQuaternion( optionalTarget ) { - - var result = optionalTarget || new Quaternion(); - - this.updateMatrixWorld( true ); - - this.matrixWorld.decompose( position, result, scale ); - - return result; - - }; - - }(), - - getWorldRotation: function () { - - var quaternion = new Quaternion(); - - return function getWorldRotation( optionalTarget ) { - - var result = optionalTarget || new Euler(); - - this.getWorldQuaternion( quaternion ); - - return result.setFromQuaternion( quaternion, this.rotation.order, false ); - - }; - - }(), - - getWorldScale: function () { - - var position = new Vector3(); - var quaternion = new Quaternion(); - - return function getWorldScale( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - this.updateMatrixWorld( true ); - - this.matrixWorld.decompose( position, quaternion, result ); - - return result; - - }; - - }(), - - getWorldDirection: function () { - - var quaternion = new Quaternion(); - - return function getWorldDirection( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - this.getWorldQuaternion( quaternion ); - - return result.set( 0, 0, 1 ).applyQuaternion( quaternion ); - - }; - - }(), - - raycast: function () {}, - - traverse: function ( callback ) { - - callback( this ); - - var children = this.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].traverse( callback ); - - } - - }, - - traverseVisible: function ( callback ) { - - if ( this.visible === false ) return; - - callback( this ); - - var children = this.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].traverseVisible( callback ); - - } - - }, - - traverseAncestors: function ( callback ) { - - var parent = this.parent; - - if ( parent !== null ) { - - callback( parent ); - - parent.traverseAncestors( callback ); - - } - - }, - - updateMatrix: function () { - - this.matrix.compose( this.position, this.quaternion, this.scale ); - - this.matrixWorldNeedsUpdate = true; - - }, - - updateMatrixWorld: function ( force ) { - - if ( this.matrixAutoUpdate === true ) this.updateMatrix(); - - if ( this.matrixWorldNeedsUpdate === true || force === true ) { - - if ( this.parent === null ) { - - this.matrixWorld.copy( this.matrix ); - - } else { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - } - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - var children = this.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].updateMatrixWorld( force ); - - } - - }, - - toJSON: function ( meta ) { - - // meta is '' when called from JSON.stringify - var isRootObject = ( meta === undefined || meta === '' ); - - var output = {}; - - // meta is a hash used to collect geometries, materials. - // not providing it implies that this is the root object - // being serialized. - if ( isRootObject ) { - - // initialize meta obj - meta = { - geometries: {}, - materials: {}, - textures: {}, - images: {} - }; - - output.metadata = { - version: 4.4, - type: 'Object', - generator: 'Object3D.toJSON' - }; - - } - - // standard Object3D serialization - - var object = {}; - - object.uuid = this.uuid; - object.type = this.type; - - if ( this.name !== '' ) object.name = this.name; - if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData; - if ( this.castShadow === true ) object.castShadow = true; - if ( this.receiveShadow === true ) object.receiveShadow = true; - if ( this.visible === false ) object.visible = false; - - object.matrix = this.matrix.toArray(); - - // - - if ( this.geometry !== undefined ) { - - if ( meta.geometries[ this.geometry.uuid ] === undefined ) { - - meta.geometries[ this.geometry.uuid ] = this.geometry.toJSON( meta ); - - } - - object.geometry = this.geometry.uuid; - - } - - if ( this.material !== undefined ) { - - if ( meta.materials[ this.material.uuid ] === undefined ) { - - meta.materials[ this.material.uuid ] = this.material.toJSON( meta ); - - } - - object.material = this.material.uuid; - - } - - // - - if ( this.children.length > 0 ) { - - object.children = []; - - for ( var i = 0; i < this.children.length; i ++ ) { - - object.children.push( this.children[ i ].toJSON( meta ).object ); - - } - - } - - if ( isRootObject ) { - - var geometries = extractFromCache( meta.geometries ); - var materials = extractFromCache( meta.materials ); - var textures = extractFromCache( meta.textures ); - var images = extractFromCache( meta.images ); - - if ( geometries.length > 0 ) output.geometries = geometries; - if ( materials.length > 0 ) output.materials = materials; - if ( textures.length > 0 ) output.textures = textures; - if ( images.length > 0 ) output.images = images; - - } - - output.object = object; - - return output; - - // extract data from the cache hash - // remove metadata on each item - // and return as array - function extractFromCache( cache ) { - - var values = []; - for ( var key in cache ) { - - var data = cache[ key ]; - delete data.metadata; - values.push( data ); - - } - return values; - - } - - }, - - clone: function ( recursive ) { - - return new this.constructor().copy( this, recursive ); - - }, - - copy: function ( source, recursive ) { - - if ( recursive === undefined ) recursive = true; - - this.name = source.name; - - this.up.copy( source.up ); - - this.position.copy( source.position ); - this.quaternion.copy( source.quaternion ); - this.scale.copy( source.scale ); - - this.matrix.copy( source.matrix ); - this.matrixWorld.copy( source.matrixWorld ); - - this.matrixAutoUpdate = source.matrixAutoUpdate; - this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate; - - this.visible = source.visible; - - this.castShadow = source.castShadow; - this.receiveShadow = source.receiveShadow; - - this.frustumCulled = source.frustumCulled; - this.renderOrder = source.renderOrder; - - this.userData = JSON.parse( JSON.stringify( source.userData ) ); - - if ( recursive === true ) { - - for ( var i = 0; i < source.children.length; i ++ ) { - - var child = source.children[ i ]; - this.add( child.clone() ); - - } - - } - - return this; - - } - -} ); - -/** - * @author bhouston / http://clara.io - */ - -function Line3( start, end ) { - - this.start = ( start !== undefined ) ? start : new Vector3(); - this.end = ( end !== undefined ) ? end : new Vector3(); - -} - -Line3.prototype = { - - constructor: Line3, - - set: function ( start, end ) { - - this.start.copy( start ); - this.end.copy( end ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( line ) { - - this.start.copy( line.start ); - this.end.copy( line.end ); - - return this; - - }, - - getCenter: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.addVectors( this.start, this.end ).multiplyScalar( 0.5 ); - - }, - - delta: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.subVectors( this.end, this.start ); - - }, - - distanceSq: function () { - - return this.start.distanceToSquared( this.end ); - - }, - - distance: function () { - - return this.start.distanceTo( this.end ); - - }, - - at: function ( t, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - return this.delta( result ).multiplyScalar( t ).add( this.start ); - - }, - - closestPointToPointParameter: function () { - - var startP = new Vector3(); - var startEnd = new Vector3(); - - return function closestPointToPointParameter( point, clampToLine ) { - - startP.subVectors( point, this.start ); - startEnd.subVectors( this.end, this.start ); - - var startEnd2 = startEnd.dot( startEnd ); - var startEnd_startP = startEnd.dot( startP ); - - var t = startEnd_startP / startEnd2; - - if ( clampToLine ) { - - t = _Math.clamp( t, 0, 1 ); - - } - - return t; - - }; - - }(), - - closestPointToPoint: function ( point, clampToLine, optionalTarget ) { - - var t = this.closestPointToPointParameter( point, clampToLine ); - - var result = optionalTarget || new Vector3(); - - return this.delta( result ).multiplyScalar( t ).add( this.start ); - - }, - - applyMatrix4: function ( matrix ) { - - this.start.applyMatrix4( matrix ); - this.end.applyMatrix4( matrix ); - - return this; - - }, - - equals: function ( line ) { - - return line.start.equals( this.start ) && line.end.equals( this.end ); - - } - -}; - -/** - * @author bhouston / http://clara.io - * @author mrdoob / http://mrdoob.com/ - */ - -function Triangle( a, b, c ) { - - this.a = ( a !== undefined ) ? a : new Vector3(); - this.b = ( b !== undefined ) ? b : new Vector3(); - this.c = ( c !== undefined ) ? c : new Vector3(); - -} - -Triangle.normal = function () { - - var v0 = new Vector3(); - - return function normal( a, b, c, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - result.subVectors( c, b ); - v0.subVectors( a, b ); - result.cross( v0 ); - - var resultLengthSq = result.lengthSq(); - if ( resultLengthSq > 0 ) { - - return result.multiplyScalar( 1 / Math.sqrt( resultLengthSq ) ); - - } - - return result.set( 0, 0, 0 ); - - }; - -}(); - -// static/instance method to calculate barycentric coordinates -// based on: http://www.blackpawn.com/texts/pointinpoly/default.html -Triangle.barycoordFromPoint = function () { - - var v0 = new Vector3(); - var v1 = new Vector3(); - var v2 = new Vector3(); - - return function barycoordFromPoint( point, a, b, c, optionalTarget ) { - - v0.subVectors( c, a ); - v1.subVectors( b, a ); - v2.subVectors( point, a ); - - var dot00 = v0.dot( v0 ); - var dot01 = v0.dot( v1 ); - var dot02 = v0.dot( v2 ); - var dot11 = v1.dot( v1 ); - var dot12 = v1.dot( v2 ); - - var denom = ( dot00 * dot11 - dot01 * dot01 ); - - var result = optionalTarget || new Vector3(); - - // collinear or singular triangle - if ( denom === 0 ) { - - // arbitrary location outside of triangle? - // not sure if this is the best idea, maybe should be returning undefined - return result.set( - 2, - 1, - 1 ); - - } - - var invDenom = 1 / denom; - var u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom; - var v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom; - - // barycentric coordinates must always sum to 1 - return result.set( 1 - u - v, v, u ); - - }; - -}(); - -Triangle.containsPoint = function () { - - var v1 = new Vector3(); - - return function containsPoint( point, a, b, c ) { - - var result = Triangle.barycoordFromPoint( point, a, b, c, v1 ); - - return ( result.x >= 0 ) && ( result.y >= 0 ) && ( ( result.x + result.y ) <= 1 ); - - }; - -}(); - -Triangle.prototype = { - - constructor: Triangle, - - set: function ( a, b, c ) { - - this.a.copy( a ); - this.b.copy( b ); - this.c.copy( c ); - - return this; - - }, - - setFromPointsAndIndices: function ( points, i0, i1, i2 ) { - - this.a.copy( points[ i0 ] ); - this.b.copy( points[ i1 ] ); - this.c.copy( points[ i2 ] ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( triangle ) { - - this.a.copy( triangle.a ); - this.b.copy( triangle.b ); - this.c.copy( triangle.c ); - - return this; - - }, - - area: function () { - - var v0 = new Vector3(); - var v1 = new Vector3(); - - return function area() { - - v0.subVectors( this.c, this.b ); - v1.subVectors( this.a, this.b ); - - return v0.cross( v1 ).length() * 0.5; - - }; - - }(), - - midpoint: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 ); - - }, - - normal: function ( optionalTarget ) { - - return Triangle.normal( this.a, this.b, this.c, optionalTarget ); - - }, - - plane: function ( optionalTarget ) { - - var result = optionalTarget || new Plane(); - - return result.setFromCoplanarPoints( this.a, this.b, this.c ); - - }, - - barycoordFromPoint: function ( point, optionalTarget ) { - - return Triangle.barycoordFromPoint( point, this.a, this.b, this.c, optionalTarget ); - - }, - - containsPoint: function ( point ) { - - return Triangle.containsPoint( point, this.a, this.b, this.c ); - - }, - - closestPointToPoint: function () { - - var plane, edgeList, projectedPoint, closestPoint; - - return function closestPointToPoint( point, optionalTarget ) { - - if ( plane === undefined ) { - - plane = new Plane(); - edgeList = [ new Line3(), new Line3(), new Line3() ]; - projectedPoint = new Vector3(); - closestPoint = new Vector3(); - - } - - var result = optionalTarget || new Vector3(); - var minDistance = Infinity; - - // project the point onto the plane of the triangle - - plane.setFromCoplanarPoints( this.a, this.b, this.c ); - plane.projectPoint( point, projectedPoint ); - - // check if the projection lies within the triangle - - if( this.containsPoint( projectedPoint ) === true ) { - - // if so, this is the closest point - - result.copy( projectedPoint ); - - } else { - - // if not, the point falls outside the triangle. the result is the closest point to the triangle's edges or vertices - - edgeList[ 0 ].set( this.a, this.b ); - edgeList[ 1 ].set( this.b, this.c ); - edgeList[ 2 ].set( this.c, this.a ); - - for( var i = 0; i < edgeList.length; i ++ ) { - - edgeList[ i ].closestPointToPoint( projectedPoint, true, closestPoint ); - - var distance = projectedPoint.distanceToSquared( closestPoint ); - - if( distance < minDistance ) { - - minDistance = distance; - - result.copy( closestPoint ); - - } - - } - - } - - return result; - - }; - - }(), - - equals: function ( triangle ) { - - return triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -function Face3( a, b, c, normal, color, materialIndex ) { - - this.a = a; - this.b = b; - this.c = c; - - this.normal = (normal && normal.isVector3) ? normal : new Vector3(); - this.vertexNormals = Array.isArray( normal ) ? normal : []; - - this.color = (color && color.isColor) ? color : new Color(); - this.vertexColors = Array.isArray( color ) ? color : []; - - this.materialIndex = materialIndex !== undefined ? materialIndex : 0; - -} - -Face3.prototype = { - - constructor: Face3, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.a = source.a; - this.b = source.b; - this.c = source.c; - - this.normal.copy( source.normal ); - this.color.copy( source.color ); - - this.materialIndex = source.materialIndex; - - for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) { - - this.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); - - } - - for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) { - - this.vertexColors[ i ] = source.vertexColors[ i ].clone(); - - } - - return this; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * lightMapIntensity: <float> - * - * aoMap: new THREE.Texture( <Image> ), - * aoMapIntensity: <float> - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * shading: THREE.SmoothShading, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * skinning: <bool>, - * morphTargets: <bool> - * } - */ - -function MeshBasicMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshBasicMaterial'; - - this.color = new Color( 0xffffff ); // emissive - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - - this.lights = false; - - this.setValues( parameters ); - -} - -MeshBasicMaterial.prototype = Object.create( Material.prototype ); -MeshBasicMaterial.prototype.constructor = MeshBasicMaterial; - -MeshBasicMaterial.prototype.isMeshBasicMaterial = true; - -MeshBasicMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - return this; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function BufferAttribute( array, itemSize, normalized ) { - - if ( Array.isArray( array ) ) { - - throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' ); - - } - - this.uuid = _Math.generateUUID(); - - this.array = array; - this.itemSize = itemSize; - this.count = array !== undefined ? array.length / itemSize : 0; - this.normalized = normalized === true; - - this.dynamic = false; - this.updateRange = { offset: 0, count: - 1 }; - - this.onUploadCallback = function () {}; - - this.version = 0; - -} - -BufferAttribute.prototype = { - - constructor: BufferAttribute, - - isBufferAttribute: true, - - set needsUpdate( value ) { - - if ( value === true ) this.version ++; - - }, - - setArray: function ( array ) { - - if ( Array.isArray( array ) ) { - - throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' ); - - } - - this.count = array !== undefined ? array.length / this.itemSize : 0; - this.array = array; - - }, - - setDynamic: function ( value ) { - - this.dynamic = value; - - return this; - - }, - - copy: function ( source ) { - - this.array = new source.array.constructor( source.array ); - this.itemSize = source.itemSize; - this.count = source.count; - this.normalized = source.normalized; - - this.dynamic = source.dynamic; - - return this; - - }, - - copyAt: function ( index1, attribute, index2 ) { - - index1 *= this.itemSize; - index2 *= attribute.itemSize; - - for ( var i = 0, l = this.itemSize; i < l; i ++ ) { - - this.array[ index1 + i ] = attribute.array[ index2 + i ]; - - } - - return this; - - }, - - copyArray: function ( array ) { - - this.array.set( array ); - - return this; - - }, - - copyColorsArray: function ( colors ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = colors.length; i < l; i ++ ) { - - var color = colors[ i ]; - - if ( color === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyColorsArray(): color is undefined', i ); - color = new Color(); - - } - - array[ offset ++ ] = color.r; - array[ offset ++ ] = color.g; - array[ offset ++ ] = color.b; - - } - - return this; - - }, - - copyIndicesArray: function ( indices ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = indices.length; i < l; i ++ ) { - - var index = indices[ i ]; - - array[ offset ++ ] = index.a; - array[ offset ++ ] = index.b; - array[ offset ++ ] = index.c; - - } - - return this; - - }, - - copyVector2sArray: function ( vectors ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = vectors.length; i < l; i ++ ) { - - var vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i ); - vector = new Vector2(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - - } - - return this; - - }, - - copyVector3sArray: function ( vectors ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = vectors.length; i < l; i ++ ) { - - var vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i ); - vector = new Vector3(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - array[ offset ++ ] = vector.z; - - } - - return this; - - }, - - copyVector4sArray: function ( vectors ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = vectors.length; i < l; i ++ ) { - - var vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i ); - vector = new Vector4(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - array[ offset ++ ] = vector.z; - array[ offset ++ ] = vector.w; - - } - - return this; - - }, - - set: function ( value, offset ) { - - if ( offset === undefined ) offset = 0; - - this.array.set( value, offset ); - - return this; - - }, - - getX: function ( index ) { - - return this.array[ index * this.itemSize ]; - - }, - - setX: function ( index, x ) { - - this.array[ index * this.itemSize ] = x; - - return this; - - }, - - getY: function ( index ) { - - return this.array[ index * this.itemSize + 1 ]; - - }, - - setY: function ( index, y ) { - - this.array[ index * this.itemSize + 1 ] = y; - - return this; - - }, - - getZ: function ( index ) { - - return this.array[ index * this.itemSize + 2 ]; - - }, - - setZ: function ( index, z ) { - - this.array[ index * this.itemSize + 2 ] = z; - - return this; - - }, - - getW: function ( index ) { - - return this.array[ index * this.itemSize + 3 ]; - - }, - - setW: function ( index, w ) { - - this.array[ index * this.itemSize + 3 ] = w; - - return this; - - }, - - setXY: function ( index, x, y ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - - return this; - - }, - - setXYZ: function ( index, x, y, z ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - this.array[ index + 2 ] = z; - - return this; - - }, - - setXYZW: function ( index, x, y, z, w ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - this.array[ index + 2 ] = z; - this.array[ index + 3 ] = w; - - return this; - - }, - - onUpload: function ( callback ) { - - this.onUploadCallback = callback; - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - } - -}; - -// - -function Int8BufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Int8Array( array ), itemSize ); - -} - -Int8BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Int8BufferAttribute.prototype.constructor = Int8BufferAttribute; - - -function Uint8BufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Uint8Array( array ), itemSize ); - -} - -Uint8BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Uint8BufferAttribute.prototype.constructor = Uint8BufferAttribute; - - -function Uint8ClampedBufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Uint8ClampedArray( array ), itemSize ); - -} - -Uint8ClampedBufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Uint8ClampedBufferAttribute.prototype.constructor = Uint8ClampedBufferAttribute; - - -function Int16BufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Int16Array( array ), itemSize ); - -} - -Int16BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Int16BufferAttribute.prototype.constructor = Int16BufferAttribute; - - -function Uint16BufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Uint16Array( array ), itemSize ); - -} - -Uint16BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Uint16BufferAttribute.prototype.constructor = Uint16BufferAttribute; - - -function Int32BufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Int32Array( array ), itemSize ); - -} - -Int32BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Int32BufferAttribute.prototype.constructor = Int32BufferAttribute; - - -function Uint32BufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Uint32Array( array ), itemSize ); - -} - -Uint32BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Uint32BufferAttribute.prototype.constructor = Uint32BufferAttribute; - - -function Float32BufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Float32Array( array ), itemSize ); - -} - -Float32BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Float32BufferAttribute.prototype.constructor = Float32BufferAttribute; - - -function Float64BufferAttribute( array, itemSize ) { - - BufferAttribute.call( this, new Float64Array( array ), itemSize ); - -} - -Float64BufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -Float64BufferAttribute.prototype.constructor = Float64BufferAttribute; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function DirectGeometry() { - - this.indices = []; - this.vertices = []; - this.normals = []; - this.colors = []; - this.uvs = []; - this.uvs2 = []; - - this.groups = []; - - this.morphTargets = {}; - - this.skinWeights = []; - this.skinIndices = []; - - // this.lineDistances = []; - - this.boundingBox = null; - this.boundingSphere = null; - - // update flags - - this.verticesNeedUpdate = false; - this.normalsNeedUpdate = false; - this.colorsNeedUpdate = false; - this.uvsNeedUpdate = false; - this.groupsNeedUpdate = false; - -} - -Object.assign( DirectGeometry.prototype, { - - computeGroups: function ( geometry ) { - - var group; - var groups = []; - var materialIndex; - - var faces = geometry.faces; - - for ( var i = 0; i < faces.length; i ++ ) { - - var face = faces[ i ]; - - // materials - - if ( face.materialIndex !== materialIndex ) { - - materialIndex = face.materialIndex; - - if ( group !== undefined ) { - - group.count = ( i * 3 ) - group.start; - groups.push( group ); - - } - - group = { - start: i * 3, - materialIndex: materialIndex - }; - - } - - } - - if ( group !== undefined ) { - - group.count = ( i * 3 ) - group.start; - groups.push( group ); - - } - - this.groups = groups; - - }, - - fromGeometry: function ( geometry ) { - - var faces = geometry.faces; - var vertices = geometry.vertices; - var faceVertexUvs = geometry.faceVertexUvs; - - var hasFaceVertexUv = faceVertexUvs[ 0 ] && faceVertexUvs[ 0 ].length > 0; - var hasFaceVertexUv2 = faceVertexUvs[ 1 ] && faceVertexUvs[ 1 ].length > 0; - - // morphs - - var morphTargets = geometry.morphTargets; - var morphTargetsLength = morphTargets.length; - - var morphTargetsPosition; - - if ( morphTargetsLength > 0 ) { - - morphTargetsPosition = []; - - for ( var i = 0; i < morphTargetsLength; i ++ ) { - - morphTargetsPosition[ i ] = []; - - } - - this.morphTargets.position = morphTargetsPosition; - - } - - var morphNormals = geometry.morphNormals; - var morphNormalsLength = morphNormals.length; - - var morphTargetsNormal; - - if ( morphNormalsLength > 0 ) { - - morphTargetsNormal = []; - - for ( var i = 0; i < morphNormalsLength; i ++ ) { - - morphTargetsNormal[ i ] = []; - - } - - this.morphTargets.normal = morphTargetsNormal; - - } - - // skins - - var skinIndices = geometry.skinIndices; - var skinWeights = geometry.skinWeights; - - var hasSkinIndices = skinIndices.length === vertices.length; - var hasSkinWeights = skinWeights.length === vertices.length; - - // - - for ( var i = 0; i < faces.length; i ++ ) { - - var face = faces[ i ]; - - this.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] ); - - var vertexNormals = face.vertexNormals; - - if ( vertexNormals.length === 3 ) { - - this.normals.push( vertexNormals[ 0 ], vertexNormals[ 1 ], vertexNormals[ 2 ] ); - - } else { - - var normal = face.normal; - - this.normals.push( normal, normal, normal ); - - } - - var vertexColors = face.vertexColors; - - if ( vertexColors.length === 3 ) { - - this.colors.push( vertexColors[ 0 ], vertexColors[ 1 ], vertexColors[ 2 ] ); - - } else { - - var color = face.color; - - this.colors.push( color, color, color ); - - } - - if ( hasFaceVertexUv === true ) { - - var vertexUvs = faceVertexUvs[ 0 ][ i ]; - - if ( vertexUvs !== undefined ) { - - this.uvs.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); - - } else { - - console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', i ); - - this.uvs.push( new Vector2(), new Vector2(), new Vector2() ); - - } - - } - - if ( hasFaceVertexUv2 === true ) { - - var vertexUvs = faceVertexUvs[ 1 ][ i ]; - - if ( vertexUvs !== undefined ) { - - this.uvs2.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); - - } else { - - console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', i ); - - this.uvs2.push( new Vector2(), new Vector2(), new Vector2() ); - - } - - } - - // morphs - - for ( var j = 0; j < morphTargetsLength; j ++ ) { - - var morphTarget = morphTargets[ j ].vertices; - - morphTargetsPosition[ j ].push( morphTarget[ face.a ], morphTarget[ face.b ], morphTarget[ face.c ] ); - - } - - for ( var j = 0; j < morphNormalsLength; j ++ ) { - - var morphNormal = morphNormals[ j ].vertexNormals[ i ]; - - morphTargetsNormal[ j ].push( morphNormal.a, morphNormal.b, morphNormal.c ); - - } - - // skins - - if ( hasSkinIndices ) { - - this.skinIndices.push( skinIndices[ face.a ], skinIndices[ face.b ], skinIndices[ face.c ] ); - - } - - if ( hasSkinWeights ) { - - this.skinWeights.push( skinWeights[ face.a ], skinWeights[ face.b ], skinWeights[ face.c ] ); - - } - - } - - this.computeGroups( geometry ); - - this.verticesNeedUpdate = geometry.verticesNeedUpdate; - this.normalsNeedUpdate = geometry.normalsNeedUpdate; - this.colorsNeedUpdate = geometry.colorsNeedUpdate; - this.uvsNeedUpdate = geometry.uvsNeedUpdate; - this.groupsNeedUpdate = geometry.groupsNeedUpdate; - - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author kile / http://kile.stravaganza.org/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author bhouston / http://clara.io - */ - -function Geometry() { - - Object.defineProperty( this, 'id', { value: GeometryIdCount() } ); - - this.uuid = _Math.generateUUID(); - - this.name = ''; - this.type = 'Geometry'; - - this.vertices = []; - this.colors = []; - this.faces = []; - this.faceVertexUvs = [ [] ]; - - this.morphTargets = []; - this.morphNormals = []; - - this.skinWeights = []; - this.skinIndices = []; - - this.lineDistances = []; - - this.boundingBox = null; - this.boundingSphere = null; - - // update flags - - this.elementsNeedUpdate = false; - this.verticesNeedUpdate = false; - this.uvsNeedUpdate = false; - this.normalsNeedUpdate = false; - this.colorsNeedUpdate = false; - this.lineDistancesNeedUpdate = false; - this.groupsNeedUpdate = false; - -} - -Object.assign( Geometry.prototype, EventDispatcher.prototype, { - - isGeometry: true, - - applyMatrix: function ( matrix ) { - - var normalMatrix = new Matrix3().getNormalMatrix( matrix ); - - for ( var i = 0, il = this.vertices.length; i < il; i ++ ) { - - var vertex = this.vertices[ i ]; - vertex.applyMatrix4( matrix ); - - } - - for ( var i = 0, il = this.faces.length; i < il; i ++ ) { - - var face = this.faces[ i ]; - face.normal.applyMatrix3( normalMatrix ).normalize(); - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - face.vertexNormals[ j ].applyMatrix3( normalMatrix ).normalize(); - - } - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - this.verticesNeedUpdate = true; - this.normalsNeedUpdate = true; - - return this; - - }, - - rotateX: function () { - - // rotate geometry around world x-axis - - var m1; - - return function rotateX( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationX( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - rotateY: function () { - - // rotate geometry around world y-axis - - var m1; - - return function rotateY( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationY( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - rotateZ: function () { - - // rotate geometry around world z-axis - - var m1; - - return function rotateZ( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationZ( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - translate: function () { - - // translate geometry - - var m1; - - return function translate( x, y, z ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeTranslation( x, y, z ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - scale: function () { - - // scale geometry - - var m1; - - return function scale( x, y, z ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeScale( x, y, z ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - lookAt: function () { - - var obj; - - return function lookAt( vector ) { - - if ( obj === undefined ) obj = new Object3D(); - - obj.lookAt( vector ); - - obj.updateMatrix(); - - this.applyMatrix( obj.matrix ); - - }; - - }(), - - fromBufferGeometry: function ( geometry ) { - - var scope = this; - - var indices = geometry.index !== null ? geometry.index.array : undefined; - var attributes = geometry.attributes; - - var positions = attributes.position.array; - var normals = attributes.normal !== undefined ? attributes.normal.array : undefined; - var colors = attributes.color !== undefined ? attributes.color.array : undefined; - var uvs = attributes.uv !== undefined ? attributes.uv.array : undefined; - var uvs2 = attributes.uv2 !== undefined ? attributes.uv2.array : undefined; - - if ( uvs2 !== undefined ) this.faceVertexUvs[ 1 ] = []; - - var tempNormals = []; - var tempUVs = []; - var tempUVs2 = []; - - for ( var i = 0, j = 0; i < positions.length; i += 3, j += 2 ) { - - scope.vertices.push( new Vector3( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ) ); - - if ( normals !== undefined ) { - - tempNormals.push( new Vector3( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] ) ); - - } - - if ( colors !== undefined ) { - - scope.colors.push( new Color( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] ) ); - - } - - if ( uvs !== undefined ) { - - tempUVs.push( new Vector2( uvs[ j ], uvs[ j + 1 ] ) ); - - } - - if ( uvs2 !== undefined ) { - - tempUVs2.push( new Vector2( uvs2[ j ], uvs2[ j + 1 ] ) ); - - } - - } - - function addFace( a, b, c, materialIndex ) { - - var vertexNormals = normals !== undefined ? [ tempNormals[ a ].clone(), tempNormals[ b ].clone(), tempNormals[ c ].clone() ] : []; - var vertexColors = colors !== undefined ? [ scope.colors[ a ].clone(), scope.colors[ b ].clone(), scope.colors[ c ].clone() ] : []; - - var face = new Face3( a, b, c, vertexNormals, vertexColors, materialIndex ); - - scope.faces.push( face ); - - if ( uvs !== undefined ) { - - scope.faceVertexUvs[ 0 ].push( [ tempUVs[ a ].clone(), tempUVs[ b ].clone(), tempUVs[ c ].clone() ] ); - - } - - if ( uvs2 !== undefined ) { - - scope.faceVertexUvs[ 1 ].push( [ tempUVs2[ a ].clone(), tempUVs2[ b ].clone(), tempUVs2[ c ].clone() ] ); - - } - - } - - if ( indices !== undefined ) { - - var groups = geometry.groups; - - if ( groups.length > 0 ) { - - for ( var i = 0; i < groups.length; i ++ ) { - - var group = groups[ i ]; - - var start = group.start; - var count = group.count; - - for ( var j = start, jl = start + count; j < jl; j += 3 ) { - - addFace( indices[ j ], indices[ j + 1 ], indices[ j + 2 ], group.materialIndex ); - - } - - } - - } else { - - for ( var i = 0; i < indices.length; i += 3 ) { - - addFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] ); - - } - - } - - } else { - - for ( var i = 0; i < positions.length / 3; i += 3 ) { - - addFace( i, i + 1, i + 2 ); - - } - - } - - this.computeFaceNormals(); - - if ( geometry.boundingBox !== null ) { - - this.boundingBox = geometry.boundingBox.clone(); - - } - - if ( geometry.boundingSphere !== null ) { - - this.boundingSphere = geometry.boundingSphere.clone(); - - } - - return this; - - }, - - center: function () { - - this.computeBoundingBox(); - - var offset = this.boundingBox.getCenter().negate(); - - this.translate( offset.x, offset.y, offset.z ); - - return offset; - - }, - - normalize: function () { - - this.computeBoundingSphere(); - - var center = this.boundingSphere.center; - var radius = this.boundingSphere.radius; - - var s = radius === 0 ? 1 : 1.0 / radius; - - var matrix = new Matrix4(); - matrix.set( - s, 0, 0, - s * center.x, - 0, s, 0, - s * center.y, - 0, 0, s, - s * center.z, - 0, 0, 0, 1 - ); - - this.applyMatrix( matrix ); - - return this; - - }, - - computeFaceNormals: function () { - - var cb = new Vector3(), ab = new Vector3(); - - for ( var f = 0, fl = this.faces.length; f < fl; f ++ ) { - - var face = this.faces[ f ]; - - var vA = this.vertices[ face.a ]; - var vB = this.vertices[ face.b ]; - var vC = this.vertices[ face.c ]; - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ); - - cb.normalize(); - - face.normal.copy( cb ); - - } - - }, - - computeVertexNormals: function ( areaWeighted ) { - - if ( areaWeighted === undefined ) areaWeighted = true; - - var v, vl, f, fl, face, vertices; - - vertices = new Array( this.vertices.length ); - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - vertices[ v ] = new Vector3(); - - } - - if ( areaWeighted ) { - - // vertex normals weighted by triangle areas - // http://www.iquilezles.org/www/articles/normals/normals.htm - - var vA, vB, vC; - var cb = new Vector3(), ab = new Vector3(); - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - vA = this.vertices[ face.a ]; - vB = this.vertices[ face.b ]; - vC = this.vertices[ face.c ]; - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ); - - vertices[ face.a ].add( cb ); - vertices[ face.b ].add( cb ); - vertices[ face.c ].add( cb ); - - } - - } else { - - this.computeFaceNormals(); - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - vertices[ face.a ].add( face.normal ); - vertices[ face.b ].add( face.normal ); - vertices[ face.c ].add( face.normal ); - - } - - } - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - vertices[ v ].normalize(); - - } - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - var vertexNormals = face.vertexNormals; - - if ( vertexNormals.length === 3 ) { - - vertexNormals[ 0 ].copy( vertices[ face.a ] ); - vertexNormals[ 1 ].copy( vertices[ face.b ] ); - vertexNormals[ 2 ].copy( vertices[ face.c ] ); - - } else { - - vertexNormals[ 0 ] = vertices[ face.a ].clone(); - vertexNormals[ 1 ] = vertices[ face.b ].clone(); - vertexNormals[ 2 ] = vertices[ face.c ].clone(); - - } - - } - - if ( this.faces.length > 0 ) { - - this.normalsNeedUpdate = true; - - } - - }, - - computeFlatVertexNormals: function () { - - var f, fl, face; - - this.computeFaceNormals(); - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - var vertexNormals = face.vertexNormals; - - if ( vertexNormals.length === 3 ) { - - vertexNormals[ 0 ].copy( face.normal ); - vertexNormals[ 1 ].copy( face.normal ); - vertexNormals[ 2 ].copy( face.normal ); - - } else { - - vertexNormals[ 0 ] = face.normal.clone(); - vertexNormals[ 1 ] = face.normal.clone(); - vertexNormals[ 2 ] = face.normal.clone(); - - } - - } - - if ( this.faces.length > 0 ) { - - this.normalsNeedUpdate = true; - - } - - }, - - computeMorphNormals: function () { - - var i, il, f, fl, face; - - // save original normals - // - create temp variables on first access - // otherwise just copy (for faster repeated calls) - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - if ( ! face.__originalFaceNormal ) { - - face.__originalFaceNormal = face.normal.clone(); - - } else { - - face.__originalFaceNormal.copy( face.normal ); - - } - - if ( ! face.__originalVertexNormals ) face.__originalVertexNormals = []; - - for ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) { - - if ( ! face.__originalVertexNormals[ i ] ) { - - face.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone(); - - } else { - - face.__originalVertexNormals[ i ].copy( face.vertexNormals[ i ] ); - - } - - } - - } - - // use temp geometry to compute face and vertex normals for each morph - - var tmpGeo = new Geometry(); - tmpGeo.faces = this.faces; - - for ( i = 0, il = this.morphTargets.length; i < il; i ++ ) { - - // create on first access - - if ( ! this.morphNormals[ i ] ) { - - this.morphNormals[ i ] = {}; - this.morphNormals[ i ].faceNormals = []; - this.morphNormals[ i ].vertexNormals = []; - - var dstNormalsFace = this.morphNormals[ i ].faceNormals; - var dstNormalsVertex = this.morphNormals[ i ].vertexNormals; - - var faceNormal, vertexNormals; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - faceNormal = new Vector3(); - vertexNormals = { a: new Vector3(), b: new Vector3(), c: new Vector3() }; - - dstNormalsFace.push( faceNormal ); - dstNormalsVertex.push( vertexNormals ); - - } - - } - - var morphNormals = this.morphNormals[ i ]; - - // set vertices to morph target - - tmpGeo.vertices = this.morphTargets[ i ].vertices; - - // compute morph normals - - tmpGeo.computeFaceNormals(); - tmpGeo.computeVertexNormals(); - - // store morph normals - - var faceNormal, vertexNormals; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - faceNormal = morphNormals.faceNormals[ f ]; - vertexNormals = morphNormals.vertexNormals[ f ]; - - faceNormal.copy( face.normal ); - - vertexNormals.a.copy( face.vertexNormals[ 0 ] ); - vertexNormals.b.copy( face.vertexNormals[ 1 ] ); - vertexNormals.c.copy( face.vertexNormals[ 2 ] ); - - } - - } - - // restore original normals - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - face.normal = face.__originalFaceNormal; - face.vertexNormals = face.__originalVertexNormals; - - } - - }, - - computeLineDistances: function () { - - var d = 0; - var vertices = this.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - if ( i > 0 ) { - - d += vertices[ i ].distanceTo( vertices[ i - 1 ] ); - - } - - this.lineDistances[ i ] = d; - - } - - }, - - computeBoundingBox: function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new Box3(); - - } - - this.boundingBox.setFromPoints( this.vertices ); - - }, - - computeBoundingSphere: function () { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new Sphere(); - - } - - this.boundingSphere.setFromPoints( this.vertices ); - - }, - - merge: function ( geometry, matrix, materialIndexOffset ) { - - if ( (geometry && geometry.isGeometry) === false ) { - - console.error( 'THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry ); - return; - - } - - var normalMatrix, - vertexOffset = this.vertices.length, - vertices1 = this.vertices, - vertices2 = geometry.vertices, - faces1 = this.faces, - faces2 = geometry.faces, - uvs1 = this.faceVertexUvs[ 0 ], - uvs2 = geometry.faceVertexUvs[ 0 ], - colors1 = this.colors, - colors2 = geometry.colors; - - if ( materialIndexOffset === undefined ) materialIndexOffset = 0; - - if ( matrix !== undefined ) { - - normalMatrix = new Matrix3().getNormalMatrix( matrix ); - - } - - // vertices - - for ( var i = 0, il = vertices2.length; i < il; i ++ ) { - - var vertex = vertices2[ i ]; - - var vertexCopy = vertex.clone(); - - if ( matrix !== undefined ) vertexCopy.applyMatrix4( matrix ); - - vertices1.push( vertexCopy ); - - } - - // colors - - for ( var i = 0, il = colors2.length; i < il; i ++ ) { - - colors1.push( colors2[ i ].clone() ); - - } - - // faces - - for ( i = 0, il = faces2.length; i < il; i ++ ) { - - var face = faces2[ i ], faceCopy, normal, color, - faceVertexNormals = face.vertexNormals, - faceVertexColors = face.vertexColors; - - faceCopy = new Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset ); - faceCopy.normal.copy( face.normal ); - - if ( normalMatrix !== undefined ) { - - faceCopy.normal.applyMatrix3( normalMatrix ).normalize(); - - } - - for ( var j = 0, jl = faceVertexNormals.length; j < jl; j ++ ) { - - normal = faceVertexNormals[ j ].clone(); - - if ( normalMatrix !== undefined ) { - - normal.applyMatrix3( normalMatrix ).normalize(); - - } - - faceCopy.vertexNormals.push( normal ); - - } - - faceCopy.color.copy( face.color ); - - for ( var j = 0, jl = faceVertexColors.length; j < jl; j ++ ) { - - color = faceVertexColors[ j ]; - faceCopy.vertexColors.push( color.clone() ); - - } - - faceCopy.materialIndex = face.materialIndex + materialIndexOffset; - - faces1.push( faceCopy ); - - } - - // uvs - - for ( i = 0, il = uvs2.length; i < il; i ++ ) { - - var uv = uvs2[ i ], uvCopy = []; - - if ( uv === undefined ) { - - continue; - - } - - for ( var j = 0, jl = uv.length; j < jl; j ++ ) { - - uvCopy.push( uv[ j ].clone() ); - - } - - uvs1.push( uvCopy ); - - } - - }, - - mergeMesh: function ( mesh ) { - - if ( (mesh && mesh.isMesh) === false ) { - - console.error( 'THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh ); - return; - - } - - mesh.matrixAutoUpdate && mesh.updateMatrix(); - - this.merge( mesh.geometry, mesh.matrix ); - - }, - - /* - * Checks for duplicate vertices with hashmap. - * Duplicated vertices are removed - * and faces' vertices are updated. - */ - - mergeVertices: function () { - - var verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique) - var unique = [], changes = []; - - var v, key; - var precisionPoints = 4; // number of decimal points, e.g. 4 for epsilon of 0.0001 - var precision = Math.pow( 10, precisionPoints ); - var i, il, face; - var indices, j, jl; - - for ( i = 0, il = this.vertices.length; i < il; i ++ ) { - - v = this.vertices[ i ]; - key = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision ); - - if ( verticesMap[ key ] === undefined ) { - - verticesMap[ key ] = i; - unique.push( this.vertices[ i ] ); - changes[ i ] = unique.length - 1; - - } else { - - //console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]); - changes[ i ] = changes[ verticesMap[ key ] ]; - - } - - } - - - // if faces are completely degenerate after merging vertices, we - // have to remove them from the geometry. - var faceIndicesToRemove = []; - - for ( i = 0, il = this.faces.length; i < il; i ++ ) { - - face = this.faces[ i ]; - - face.a = changes[ face.a ]; - face.b = changes[ face.b ]; - face.c = changes[ face.c ]; - - indices = [ face.a, face.b, face.c ]; - - var dupIndex = - 1; - - // if any duplicate vertices are found in a Face3 - // we have to remove the face as nothing can be saved - for ( var n = 0; n < 3; n ++ ) { - - if ( indices[ n ] === indices[ ( n + 1 ) % 3 ] ) { - - dupIndex = n; - faceIndicesToRemove.push( i ); - break; - - } - - } - - } - - for ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) { - - var idx = faceIndicesToRemove[ i ]; - - this.faces.splice( idx, 1 ); - - for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) { - - this.faceVertexUvs[ j ].splice( idx, 1 ); - - } - - } - - // Use unique set of vertices - - var diff = this.vertices.length - unique.length; - this.vertices = unique; - return diff; - - }, - - sortFacesByMaterialIndex: function () { - - var faces = this.faces; - var length = faces.length; - - // tag faces - - for ( var i = 0; i < length; i ++ ) { - - faces[ i ]._id = i; - - } - - // sort faces - - function materialIndexSort( a, b ) { - - return a.materialIndex - b.materialIndex; - - } - - faces.sort( materialIndexSort ); - - // sort uvs - - var uvs1 = this.faceVertexUvs[ 0 ]; - var uvs2 = this.faceVertexUvs[ 1 ]; - - var newUvs1, newUvs2; - - if ( uvs1 && uvs1.length === length ) newUvs1 = []; - if ( uvs2 && uvs2.length === length ) newUvs2 = []; - - for ( var i = 0; i < length; i ++ ) { - - var id = faces[ i ]._id; - - if ( newUvs1 ) newUvs1.push( uvs1[ id ] ); - if ( newUvs2 ) newUvs2.push( uvs2[ id ] ); - - } - - if ( newUvs1 ) this.faceVertexUvs[ 0 ] = newUvs1; - if ( newUvs2 ) this.faceVertexUvs[ 1 ] = newUvs2; - - }, - - toJSON: function () { - - var data = { - metadata: { - version: 4.4, - type: 'Geometry', - generator: 'Geometry.toJSON' - } - }; - - // standard Geometry serialization - - data.uuid = this.uuid; - data.type = this.type; - if ( this.name !== '' ) data.name = this.name; - - if ( this.parameters !== undefined ) { - - var parameters = this.parameters; - - for ( var key in parameters ) { - - if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ]; - - } - - return data; - - } - - var vertices = []; - - for ( var i = 0; i < this.vertices.length; i ++ ) { - - var vertex = this.vertices[ i ]; - vertices.push( vertex.x, vertex.y, vertex.z ); - - } - - var faces = []; - var normals = []; - var normalsHash = {}; - var colors = []; - var colorsHash = {}; - var uvs = []; - var uvsHash = {}; - - for ( var i = 0; i < this.faces.length; i ++ ) { - - var face = this.faces[ i ]; - - var hasMaterial = true; - var hasFaceUv = false; // deprecated - var hasFaceVertexUv = this.faceVertexUvs[ 0 ][ i ] !== undefined; - var hasFaceNormal = face.normal.length() > 0; - var hasFaceVertexNormal = face.vertexNormals.length > 0; - var hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1; - var hasFaceVertexColor = face.vertexColors.length > 0; - - var faceType = 0; - - faceType = setBit( faceType, 0, 0 ); // isQuad - faceType = setBit( faceType, 1, hasMaterial ); - faceType = setBit( faceType, 2, hasFaceUv ); - faceType = setBit( faceType, 3, hasFaceVertexUv ); - faceType = setBit( faceType, 4, hasFaceNormal ); - faceType = setBit( faceType, 5, hasFaceVertexNormal ); - faceType = setBit( faceType, 6, hasFaceColor ); - faceType = setBit( faceType, 7, hasFaceVertexColor ); - - faces.push( faceType ); - faces.push( face.a, face.b, face.c ); - faces.push( face.materialIndex ); - - if ( hasFaceVertexUv ) { - - var faceVertexUvs = this.faceVertexUvs[ 0 ][ i ]; - - faces.push( - getUvIndex( faceVertexUvs[ 0 ] ), - getUvIndex( faceVertexUvs[ 1 ] ), - getUvIndex( faceVertexUvs[ 2 ] ) - ); - - } - - if ( hasFaceNormal ) { - - faces.push( getNormalIndex( face.normal ) ); - - } - - if ( hasFaceVertexNormal ) { - - var vertexNormals = face.vertexNormals; - - faces.push( - getNormalIndex( vertexNormals[ 0 ] ), - getNormalIndex( vertexNormals[ 1 ] ), - getNormalIndex( vertexNormals[ 2 ] ) - ); - - } - - if ( hasFaceColor ) { - - faces.push( getColorIndex( face.color ) ); - - } - - if ( hasFaceVertexColor ) { - - var vertexColors = face.vertexColors; - - faces.push( - getColorIndex( vertexColors[ 0 ] ), - getColorIndex( vertexColors[ 1 ] ), - getColorIndex( vertexColors[ 2 ] ) - ); - - } - - } - - function setBit( value, position, enabled ) { - - return enabled ? value | ( 1 << position ) : value & ( ~ ( 1 << position ) ); - - } - - function getNormalIndex( normal ) { - - var hash = normal.x.toString() + normal.y.toString() + normal.z.toString(); - - if ( normalsHash[ hash ] !== undefined ) { - - return normalsHash[ hash ]; - - } - - normalsHash[ hash ] = normals.length / 3; - normals.push( normal.x, normal.y, normal.z ); - - return normalsHash[ hash ]; - - } - - function getColorIndex( color ) { - - var hash = color.r.toString() + color.g.toString() + color.b.toString(); - - if ( colorsHash[ hash ] !== undefined ) { - - return colorsHash[ hash ]; - - } - - colorsHash[ hash ] = colors.length; - colors.push( color.getHex() ); - - return colorsHash[ hash ]; - - } - - function getUvIndex( uv ) { - - var hash = uv.x.toString() + uv.y.toString(); - - if ( uvsHash[ hash ] !== undefined ) { - - return uvsHash[ hash ]; - - } - - uvsHash[ hash ] = uvs.length / 2; - uvs.push( uv.x, uv.y ); - - return uvsHash[ hash ]; - - } - - data.data = {}; - - data.data.vertices = vertices; - data.data.normals = normals; - if ( colors.length > 0 ) data.data.colors = colors; - if ( uvs.length > 0 ) data.data.uvs = [ uvs ]; // temporal backward compatibility - data.data.faces = faces; - - return data; - - }, - - clone: function () { - - /* - // Handle primitives - - var parameters = this.parameters; - - if ( parameters !== undefined ) { - - var values = []; - - for ( var key in parameters ) { - - values.push( parameters[ key ] ); - - } - - var geometry = Object.create( this.constructor.prototype ); - this.constructor.apply( geometry, values ); - return geometry; - - } - - return new this.constructor().copy( this ); - */ - - return new Geometry().copy( this ); - - }, - - copy: function ( source ) { - - this.vertices = []; - this.faces = []; - this.faceVertexUvs = [ [] ]; - this.colors = []; - - var vertices = source.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - this.vertices.push( vertices[ i ].clone() ); - - } - - var colors = source.colors; - - for ( var i = 0, il = colors.length; i < il; i ++ ) { - - this.colors.push( colors[ i ].clone() ); - - } - - var faces = source.faces; - - for ( var i = 0, il = faces.length; i < il; i ++ ) { - - this.faces.push( faces[ i ].clone() ); - - } - - for ( var i = 0, il = source.faceVertexUvs.length; i < il; i ++ ) { - - var faceVertexUvs = source.faceVertexUvs[ i ]; - - if ( this.faceVertexUvs[ i ] === undefined ) { - - this.faceVertexUvs[ i ] = []; - - } - - for ( var j = 0, jl = faceVertexUvs.length; j < jl; j ++ ) { - - var uvs = faceVertexUvs[ j ], uvsCopy = []; - - for ( var k = 0, kl = uvs.length; k < kl; k ++ ) { - - var uv = uvs[ k ]; - - uvsCopy.push( uv.clone() ); - - } - - this.faceVertexUvs[ i ].push( uvsCopy ); - - } - - } - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -} ); - -var count = 0; -function GeometryIdCount() { return count++; } - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -function BufferGeometry() { - - Object.defineProperty( this, 'id', { value: GeometryIdCount() } ); - - this.uuid = _Math.generateUUID(); - - this.name = ''; - this.type = 'BufferGeometry'; - - this.index = null; - this.attributes = {}; - - this.morphAttributes = {}; - - this.groups = []; - - this.boundingBox = null; - this.boundingSphere = null; - - this.drawRange = { start: 0, count: Infinity }; - -} - -Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, { - - isBufferGeometry: true, - - getIndex: function () { - - return this.index; - - }, - - setIndex: function ( index ) { - - this.index = index; - - }, - - addAttribute: function ( name, attribute ) { - - if ( ( attribute && attribute.isBufferAttribute ) === false && ( attribute && attribute.isInterleavedBufferAttribute ) === false ) { - - console.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' ); - - this.addAttribute( name, new BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) ); - - return; - - } - - if ( name === 'index' ) { - - console.warn( 'THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.' ); - this.setIndex( attribute ); - - return; - - } - - this.attributes[ name ] = attribute; - - return this; - - }, - - getAttribute: function ( name ) { - - return this.attributes[ name ]; - - }, - - removeAttribute: function ( name ) { - - delete this.attributes[ name ]; - - return this; - - }, - - addGroup: function ( start, count, materialIndex ) { - - this.groups.push( { - - start: start, - count: count, - materialIndex: materialIndex !== undefined ? materialIndex : 0 - - } ); - - }, - - clearGroups: function () { - - this.groups = []; - - }, - - setDrawRange: function ( start, count ) { - - this.drawRange.start = start; - this.drawRange.count = count; - - }, - - applyMatrix: function ( matrix ) { - - var position = this.attributes.position; - - if ( position !== undefined ) { - - matrix.applyToVector3Array( position.array ); - position.needsUpdate = true; - - } - - var normal = this.attributes.normal; - - if ( normal !== undefined ) { - - var normalMatrix = new Matrix3().getNormalMatrix( matrix ); - - normalMatrix.applyToVector3Array( normal.array ); - normal.needsUpdate = true; - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - return this; - - }, - - rotateX: function () { - - // rotate geometry around world x-axis - - var m1; - - return function rotateX( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationX( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - rotateY: function () { - - // rotate geometry around world y-axis - - var m1; - - return function rotateY( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationY( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - rotateZ: function () { - - // rotate geometry around world z-axis - - var m1; - - return function rotateZ( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationZ( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - translate: function () { - - // translate geometry - - var m1; - - return function translate( x, y, z ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeTranslation( x, y, z ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - scale: function () { - - // scale geometry - - var m1; - - return function scale( x, y, z ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeScale( x, y, z ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - lookAt: function () { - - var obj; - - return function lookAt( vector ) { - - if ( obj === undefined ) obj = new Object3D(); - - obj.lookAt( vector ); - - obj.updateMatrix(); - - this.applyMatrix( obj.matrix ); - - }; - - }(), - - center: function () { - - this.computeBoundingBox(); - - var offset = this.boundingBox.getCenter().negate(); - - this.translate( offset.x, offset.y, offset.z ); - - return offset; - - }, - - setFromObject: function ( object ) { - - // console.log( 'THREE.BufferGeometry.setFromObject(). Converting', object, this ); - - var geometry = object.geometry; - - if ( object.isPoints || object.isLine ) { - - var positions = new Float32BufferAttribute( geometry.vertices.length * 3, 3 ); - var colors = new Float32BufferAttribute( geometry.colors.length * 3, 3 ); - - this.addAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) ); - this.addAttribute( 'color', colors.copyColorsArray( geometry.colors ) ); - - if ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) { - - var lineDistances = new Float32BufferAttribute( geometry.lineDistances.length, 1 ); - - this.addAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) ); - - } - - if ( geometry.boundingSphere !== null ) { - - this.boundingSphere = geometry.boundingSphere.clone(); - - } - - if ( geometry.boundingBox !== null ) { - - this.boundingBox = geometry.boundingBox.clone(); - - } - - } else if ( object.isMesh ) { - - if ( geometry && geometry.isGeometry ) { - - this.fromGeometry( geometry ); - - } - - } - - return this; - - }, - - updateFromObject: function ( object ) { - - var geometry = object.geometry; - - if ( object.isMesh ) { - - var direct = geometry.__directGeometry; - - if ( geometry.elementsNeedUpdate === true ) { - - direct = undefined; - geometry.elementsNeedUpdate = false; - - } - - if ( direct === undefined ) { - - return this.fromGeometry( geometry ); - - } - - direct.verticesNeedUpdate = geometry.verticesNeedUpdate; - direct.normalsNeedUpdate = geometry.normalsNeedUpdate; - direct.colorsNeedUpdate = geometry.colorsNeedUpdate; - direct.uvsNeedUpdate = geometry.uvsNeedUpdate; - direct.groupsNeedUpdate = geometry.groupsNeedUpdate; - - geometry.verticesNeedUpdate = false; - geometry.normalsNeedUpdate = false; - geometry.colorsNeedUpdate = false; - geometry.uvsNeedUpdate = false; - geometry.groupsNeedUpdate = false; - - geometry = direct; - - } - - var attribute; - - if ( geometry.verticesNeedUpdate === true ) { - - attribute = this.attributes.position; - - if ( attribute !== undefined ) { - - attribute.copyVector3sArray( geometry.vertices ); - attribute.needsUpdate = true; - - } - - geometry.verticesNeedUpdate = false; - - } - - if ( geometry.normalsNeedUpdate === true ) { - - attribute = this.attributes.normal; - - if ( attribute !== undefined ) { - - attribute.copyVector3sArray( geometry.normals ); - attribute.needsUpdate = true; - - } - - geometry.normalsNeedUpdate = false; - - } - - if ( geometry.colorsNeedUpdate === true ) { - - attribute = this.attributes.color; - - if ( attribute !== undefined ) { - - attribute.copyColorsArray( geometry.colors ); - attribute.needsUpdate = true; - - } - - geometry.colorsNeedUpdate = false; - - } - - if ( geometry.uvsNeedUpdate ) { - - attribute = this.attributes.uv; - - if ( attribute !== undefined ) { - - attribute.copyVector2sArray( geometry.uvs ); - attribute.needsUpdate = true; - - } - - geometry.uvsNeedUpdate = false; - - } - - if ( geometry.lineDistancesNeedUpdate ) { - - attribute = this.attributes.lineDistance; - - if ( attribute !== undefined ) { - - attribute.copyArray( geometry.lineDistances ); - attribute.needsUpdate = true; - - } - - geometry.lineDistancesNeedUpdate = false; - - } - - if ( geometry.groupsNeedUpdate ) { - - geometry.computeGroups( object.geometry ); - this.groups = geometry.groups; - - geometry.groupsNeedUpdate = false; - - } - - return this; - - }, - - fromGeometry: function ( geometry ) { - - geometry.__directGeometry = new DirectGeometry().fromGeometry( geometry ); - - return this.fromDirectGeometry( geometry.__directGeometry ); - - }, - - fromDirectGeometry: function ( geometry ) { - - var positions = new Float32Array( geometry.vertices.length * 3 ); - this.addAttribute( 'position', new BufferAttribute( positions, 3 ).copyVector3sArray( geometry.vertices ) ); - - if ( geometry.normals.length > 0 ) { - - var normals = new Float32Array( geometry.normals.length * 3 ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ).copyVector3sArray( geometry.normals ) ); - - } - - if ( geometry.colors.length > 0 ) { - - var colors = new Float32Array( geometry.colors.length * 3 ); - this.addAttribute( 'color', new BufferAttribute( colors, 3 ).copyColorsArray( geometry.colors ) ); - - } - - if ( geometry.uvs.length > 0 ) { - - var uvs = new Float32Array( geometry.uvs.length * 2 ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ).copyVector2sArray( geometry.uvs ) ); - - } - - if ( geometry.uvs2.length > 0 ) { - - var uvs2 = new Float32Array( geometry.uvs2.length * 2 ); - this.addAttribute( 'uv2', new BufferAttribute( uvs2, 2 ).copyVector2sArray( geometry.uvs2 ) ); - - } - - if ( geometry.indices.length > 0 ) { - - var TypeArray = geometry.vertices.length > 65535 ? Uint32Array : Uint16Array; - var indices = new TypeArray( geometry.indices.length * 3 ); - this.setIndex( new BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) ); - - } - - // groups - - this.groups = geometry.groups; - - // morphs - - for ( var name in geometry.morphTargets ) { - - var array = []; - var morphTargets = geometry.morphTargets[ name ]; - - for ( var i = 0, l = morphTargets.length; i < l; i ++ ) { - - var morphTarget = morphTargets[ i ]; - - var attribute = new Float32BufferAttribute( morphTarget.length * 3, 3 ); - - array.push( attribute.copyVector3sArray( morphTarget ) ); - - } - - this.morphAttributes[ name ] = array; - - } - - // skinning - - if ( geometry.skinIndices.length > 0 ) { - - var skinIndices = new Float32BufferAttribute( geometry.skinIndices.length * 4, 4 ); - this.addAttribute( 'skinIndex', skinIndices.copyVector4sArray( geometry.skinIndices ) ); - - } - - if ( geometry.skinWeights.length > 0 ) { - - var skinWeights = new Float32BufferAttribute( geometry.skinWeights.length * 4, 4 ); - this.addAttribute( 'skinWeight', skinWeights.copyVector4sArray( geometry.skinWeights ) ); - - } - - // - - if ( geometry.boundingSphere !== null ) { - - this.boundingSphere = geometry.boundingSphere.clone(); - - } - - if ( geometry.boundingBox !== null ) { - - this.boundingBox = geometry.boundingBox.clone(); - - } - - return this; - - }, - - computeBoundingBox: function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new Box3(); - - } - - var positions = this.attributes.position.array; - - if ( positions !== undefined ) { - - this.boundingBox.setFromArray( positions ); - - } else { - - this.boundingBox.makeEmpty(); - - } - - if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) { - - console.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this ); - - } - - }, - - computeBoundingSphere: function () { - - var box = new Box3(); - var vector = new Vector3(); - - return function computeBoundingSphere() { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new Sphere(); - - } - - var positions = this.attributes.position; - - if ( positions ) { - - var array = positions.array; - var center = this.boundingSphere.center; - - box.setFromArray( array ); - box.getCenter( center ); - - // hoping to find a boundingSphere with a radius smaller than the - // boundingSphere of the boundingBox: sqrt(3) smaller in the best case - - var maxRadiusSq = 0; - - for ( var i = 0, il = array.length; i < il; i += 3 ) { - - vector.fromArray( array, i ); - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); - - } - - this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); - - if ( isNaN( this.boundingSphere.radius ) ) { - - console.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this ); - - } - - } - - }; - - }(), - - computeFaceNormals: function () { - - // backwards compatibility - - }, - - computeVertexNormals: function () { - - var index = this.index; - var attributes = this.attributes; - var groups = this.groups; - - if ( attributes.position ) { - - var positions = attributes.position.array; - - if ( attributes.normal === undefined ) { - - this.addAttribute( 'normal', new BufferAttribute( new Float32Array( positions.length ), 3 ) ); - - } else { - - // reset existing normals to zero - - var array = attributes.normal.array; - - for ( var i = 0, il = array.length; i < il; i ++ ) { - - array[ i ] = 0; - - } - - } - - var normals = attributes.normal.array; - - var vA, vB, vC; - var pA = new Vector3(), pB = new Vector3(), pC = new Vector3(); - var cb = new Vector3(), ab = new Vector3(); - - // indexed elements - - if ( index ) { - - var indices = index.array; - - if ( groups.length === 0 ) { - - this.addGroup( 0, indices.length ); - - } - - for ( var j = 0, jl = groups.length; j < jl; ++ j ) { - - var group = groups[ j ]; - - var start = group.start; - var count = group.count; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - vA = indices[ i + 0 ] * 3; - vB = indices[ i + 1 ] * 3; - vC = indices[ i + 2 ] * 3; - - pA.fromArray( positions, vA ); - pB.fromArray( positions, vB ); - pC.fromArray( positions, vC ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normals[ vA ] += cb.x; - normals[ vA + 1 ] += cb.y; - normals[ vA + 2 ] += cb.z; - - normals[ vB ] += cb.x; - normals[ vB + 1 ] += cb.y; - normals[ vB + 2 ] += cb.z; - - normals[ vC ] += cb.x; - normals[ vC + 1 ] += cb.y; - normals[ vC + 2 ] += cb.z; - - } - - } - - } else { - - // non-indexed elements (unconnected triangle soup) - - for ( var i = 0, il = positions.length; i < il; i += 9 ) { - - pA.fromArray( positions, i ); - pB.fromArray( positions, i + 3 ); - pC.fromArray( positions, i + 6 ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normals[ i ] = cb.x; - normals[ i + 1 ] = cb.y; - normals[ i + 2 ] = cb.z; - - normals[ i + 3 ] = cb.x; - normals[ i + 4 ] = cb.y; - normals[ i + 5 ] = cb.z; - - normals[ i + 6 ] = cb.x; - normals[ i + 7 ] = cb.y; - normals[ i + 8 ] = cb.z; - - } - - } - - this.normalizeNormals(); - - attributes.normal.needsUpdate = true; - - } - - }, - - merge: function ( geometry, offset ) { - - if ( ( geometry && geometry.isBufferGeometry ) === false ) { - - console.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry ); - return; - - } - - if ( offset === undefined ) offset = 0; - - var attributes = this.attributes; - - for ( var key in attributes ) { - - if ( geometry.attributes[ key ] === undefined ) continue; - - var attribute1 = attributes[ key ]; - var attributeArray1 = attribute1.array; - - var attribute2 = geometry.attributes[ key ]; - var attributeArray2 = attribute2.array; - - var attributeSize = attribute2.itemSize; - - for ( var i = 0, j = attributeSize * offset; i < attributeArray2.length; i ++, j ++ ) { - - attributeArray1[ j ] = attributeArray2[ i ]; - - } - - } - - return this; - - }, - - normalizeNormals: function () { - - var normals = this.attributes.normal.array; - - var x, y, z, n; - - for ( var i = 0, il = normals.length; i < il; i += 3 ) { - - x = normals[ i ]; - y = normals[ i + 1 ]; - z = normals[ i + 2 ]; - - n = 1.0 / Math.sqrt( x * x + y * y + z * z ); - - normals[ i ] *= n; - normals[ i + 1 ] *= n; - normals[ i + 2 ] *= n; - - } - - }, - - toNonIndexed: function () { - - if ( this.index === null ) { - - console.warn( 'THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.' ); - return this; - - } - - var geometry2 = new BufferGeometry(); - - var indices = this.index.array; - var attributes = this.attributes; - - for ( var name in attributes ) { - - var attribute = attributes[ name ]; - - var array = attribute.array; - var itemSize = attribute.itemSize; - - var array2 = new array.constructor( indices.length * itemSize ); - - var index = 0, index2 = 0; - - for ( var i = 0, l = indices.length; i < l; i ++ ) { - - index = indices[ i ] * itemSize; - - for ( var j = 0; j < itemSize; j ++ ) { - - array2[ index2 ++ ] = array[ index ++ ]; - - } - - } - - geometry2.addAttribute( name, new BufferAttribute( array2, itemSize ) ); - - } - - return geometry2; - - }, - - toJSON: function () { - - var data = { - metadata: { - version: 4.4, - type: 'BufferGeometry', - generator: 'BufferGeometry.toJSON' - } - }; - - // standard BufferGeometry serialization - - data.uuid = this.uuid; - data.type = this.type; - if ( this.name !== '' ) data.name = this.name; - - if ( this.parameters !== undefined ) { - - var parameters = this.parameters; - - for ( var key in parameters ) { - - if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ]; - - } - - return data; - - } - - data.data = { attributes: {} }; - - var index = this.index; - - if ( index !== null ) { - - var array = Array.prototype.slice.call( index.array ); - - data.data.index = { - type: index.array.constructor.name, - array: array - }; - - } - - var attributes = this.attributes; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - - var array = Array.prototype.slice.call( attribute.array ); - - data.data.attributes[ key ] = { - itemSize: attribute.itemSize, - type: attribute.array.constructor.name, - array: array, - normalized: attribute.normalized - }; - - } - - var groups = this.groups; - - if ( groups.length > 0 ) { - - data.data.groups = JSON.parse( JSON.stringify( groups ) ); - - } - - var boundingSphere = this.boundingSphere; - - if ( boundingSphere !== null ) { - - data.data.boundingSphere = { - center: boundingSphere.center.toArray(), - radius: boundingSphere.radius - }; - - } - - return data; - - }, - - clone: function () { - - /* - // Handle primitives - - var parameters = this.parameters; - - if ( parameters !== undefined ) { - - var values = []; - - for ( var key in parameters ) { - - values.push( parameters[ key ] ); - - } - - var geometry = Object.create( this.constructor.prototype ); - this.constructor.apply( geometry, values ); - return geometry; - - } - - return new this.constructor().copy( this ); - */ - - return new BufferGeometry().copy( this ); - - }, - - copy: function ( source ) { - - var index = source.index; - - if ( index !== null ) { - - this.setIndex( index.clone() ); - - } - - var attributes = source.attributes; - - for ( var name in attributes ) { - - var attribute = attributes[ name ]; - this.addAttribute( name, attribute.clone() ); - - } - - var groups = source.groups; - - for ( var i = 0, l = groups.length; i < l; i ++ ) { - - var group = groups[ i ]; - this.addGroup( group.start, group.count, group.materialIndex ); - - } - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -} ); - -BufferGeometry.MaxIndex = 65535; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author jonobr1 / http://jonobr1.com/ - */ - -function Mesh( geometry, material ) { - - Object3D.call( this ); - - this.type = 'Mesh'; - - this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); - this.material = material !== undefined ? material : new MeshBasicMaterial( { color: Math.random() * 0xffffff } ); - - this.drawMode = TrianglesDrawMode; - - this.updateMorphTargets(); - -} - -Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Mesh, - - isMesh: true, - - setDrawMode: function ( value ) { - - this.drawMode = value; - - }, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.drawMode = source.drawMode; - - return this; - - }, - - updateMorphTargets: function () { - - var morphTargets = this.geometry.morphTargets; - - if ( morphTargets !== undefined && morphTargets.length > 0 ) { - - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - - for ( var m = 0, ml = morphTargets.length; m < ml; m ++ ) { - - this.morphTargetInfluences.push( 0 ); - this.morphTargetDictionary[ morphTargets[ m ].name ] = m; - - } - - } - - }, - - raycast: ( function () { - - var inverseMatrix = new Matrix4(); - var ray = new Ray(); - var sphere = new Sphere(); - - var vA = new Vector3(); - var vB = new Vector3(); - var vC = new Vector3(); - - var tempA = new Vector3(); - var tempB = new Vector3(); - var tempC = new Vector3(); - - var uvA = new Vector2(); - var uvB = new Vector2(); - var uvC = new Vector2(); - - var barycoord = new Vector3(); - - var intersectionPoint = new Vector3(); - var intersectionPointWorld = new Vector3(); - - function uvIntersection( point, p1, p2, p3, uv1, uv2, uv3 ) { - - Triangle.barycoordFromPoint( point, p1, p2, p3, barycoord ); - - uv1.multiplyScalar( barycoord.x ); - uv2.multiplyScalar( barycoord.y ); - uv3.multiplyScalar( barycoord.z ); - - uv1.add( uv2 ).add( uv3 ); - - return uv1.clone(); - - } - - function checkIntersection( object, raycaster, ray, pA, pB, pC, point ) { - - var intersect; - var material = object.material; - - if ( material.side === BackSide ) { - - intersect = ray.intersectTriangle( pC, pB, pA, true, point ); - - } else { - - intersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point ); - - } - - if ( intersect === null ) return null; - - intersectionPointWorld.copy( point ); - intersectionPointWorld.applyMatrix4( object.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectionPointWorld ); - - if ( distance < raycaster.near || distance > raycaster.far ) return null; - - return { - distance: distance, - point: intersectionPointWorld.clone(), - object: object - }; - - } - - function checkBufferGeometryIntersection( object, raycaster, ray, positions, uvs, a, b, c ) { - - vA.fromArray( positions, a * 3 ); - vB.fromArray( positions, b * 3 ); - vC.fromArray( positions, c * 3 ); - - var intersection = checkIntersection( object, raycaster, ray, vA, vB, vC, intersectionPoint ); - - if ( intersection ) { - - if ( uvs ) { - - uvA.fromArray( uvs, a * 2 ); - uvB.fromArray( uvs, b * 2 ); - uvC.fromArray( uvs, c * 2 ); - - intersection.uv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC ); - - } - - intersection.face = new Face3( a, b, c, Triangle.normal( vA, vB, vC ) ); - intersection.faceIndex = a; - - } - - return intersection; - - } - - return function raycast( raycaster, intersects ) { - - var geometry = this.geometry; - var material = this.material; - var matrixWorld = this.matrixWorld; - - if ( material === undefined ) return; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( matrixWorld ); - - if ( raycaster.ray.intersectsSphere( sphere ) === false ) return; - - // - - inverseMatrix.getInverse( matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - // Check boundingBox before continuing - - if ( geometry.boundingBox !== null ) { - - if ( ray.intersectsBox( geometry.boundingBox ) === false ) return; - - } - - var uvs, intersection; - - if ( geometry.isBufferGeometry ) { - - var a, b, c; - var index = geometry.index; - var attributes = geometry.attributes; - var positions = attributes.position.array; - - if ( attributes.uv !== undefined ) { - - uvs = attributes.uv.array; - - } - - if ( index !== null ) { - - var indices = index.array; - - for ( var i = 0, l = indices.length; i < l; i += 3 ) { - - a = indices[ i ]; - b = indices[ i + 1 ]; - c = indices[ i + 2 ]; - - intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c ); - - if ( intersection ) { - - intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indices buffer semantics - intersects.push( intersection ); - - } - - } - - } else { - - - for ( var i = 0, l = positions.length; i < l; i += 9 ) { - - a = i / 3; - b = a + 1; - c = a + 2; - - intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c ); - - if ( intersection ) { - - intersection.index = a; // triangle number in positions buffer semantics - intersects.push( intersection ); - - } - - } - - } - - } else if ( geometry.isGeometry ) { - - var fvA, fvB, fvC; - var isFaceMaterial = (material && material.isMultiMaterial); - var materials = isFaceMaterial === true ? material.materials : null; - - var vertices = geometry.vertices; - var faces = geometry.faces; - var faceVertexUvs = geometry.faceVertexUvs[ 0 ]; - if ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs; - - for ( var f = 0, fl = faces.length; f < fl; f ++ ) { - - var face = faces[ f ]; - var faceMaterial = isFaceMaterial === true ? materials[ face.materialIndex ] : material; - - if ( faceMaterial === undefined ) continue; - - fvA = vertices[ face.a ]; - fvB = vertices[ face.b ]; - fvC = vertices[ face.c ]; - - if ( faceMaterial.morphTargets === true ) { - - var morphTargets = geometry.morphTargets; - var morphInfluences = this.morphTargetInfluences; - - vA.set( 0, 0, 0 ); - vB.set( 0, 0, 0 ); - vC.set( 0, 0, 0 ); - - for ( var t = 0, tl = morphTargets.length; t < tl; t ++ ) { - - var influence = morphInfluences[ t ]; - - if ( influence === 0 ) continue; - - var targets = morphTargets[ t ].vertices; - - vA.addScaledVector( tempA.subVectors( targets[ face.a ], fvA ), influence ); - vB.addScaledVector( tempB.subVectors( targets[ face.b ], fvB ), influence ); - vC.addScaledVector( tempC.subVectors( targets[ face.c ], fvC ), influence ); - - } - - vA.add( fvA ); - vB.add( fvB ); - vC.add( fvC ); - - fvA = vA; - fvB = vB; - fvC = vC; - - } - - intersection = checkIntersection( this, raycaster, ray, fvA, fvB, fvC, intersectionPoint ); - - if ( intersection ) { - - if ( uvs ) { - - var uvs_f = uvs[ f ]; - uvA.copy( uvs_f[ 0 ] ); - uvB.copy( uvs_f[ 1 ] ); - uvC.copy( uvs_f[ 2 ] ); - - intersection.uv = uvIntersection( intersectionPoint, fvA, fvB, fvC, uvA, uvB, uvC ); - - } - - intersection.face = face; - intersection.faceIndex = f; - intersects.push( intersection ); - - } - - } - - } - - }; - - }() ), - - clone: function () { - - return new this.constructor( this.geometry, this.material ).copy( this ); - - } - -} ); - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { - - BufferGeometry.call( this ); - - this.type = 'BoxBufferGeometry'; - - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; - - var scope = this; - - // segments - widthSegments = Math.floor( widthSegments ) || 1; - heightSegments = Math.floor( heightSegments ) || 1; - depthSegments = Math.floor( depthSegments ) || 1; - - // these are used to calculate buffer length - var vertexCount = calculateVertexCount( widthSegments, heightSegments, depthSegments ); - var indexCount = calculateIndexCount( widthSegments, heightSegments, depthSegments ); - - // buffers - var indices = new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ); - var vertices = new Float32Array( vertexCount * 3 ); - var normals = new Float32Array( vertexCount * 3 ); - var uvs = new Float32Array( vertexCount * 2 ); - - // offset variables - var vertexBufferOffset = 0; - var uvBufferOffset = 0; - var indexBufferOffset = 0; - var numberOfVertices = 0; - - // group variables - var groupStart = 0; - - // build each side of the box geometry - buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px - buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx - buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py - buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny - buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz - buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz - - // build geometry - this.setIndex( new BufferAttribute( indices, 1 ) ); - this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - - // helper functions - - function calculateVertexCount( w, h, d ) { - - var vertices = 0; - - // calculate the amount of vertices for each side (plane) - vertices += (w + 1) * (h + 1) * 2; // xy - vertices += (w + 1) * (d + 1) * 2; // xz - vertices += (d + 1) * (h + 1) * 2; // zy - - return vertices; - - } - - function calculateIndexCount( w, h, d ) { - - var index = 0; - - // calculate the amount of squares for each side - index += w * h * 2; // xy - index += w * d * 2; // xz - index += d * h * 2; // zy - - return index * 6; // two triangles per square => six vertices per square - - } - - function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) { - - var segmentWidth = width / gridX; - var segmentHeight = height / gridY; - - var widthHalf = width / 2; - var heightHalf = height / 2; - var depthHalf = depth / 2; - - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; - - var vertexCounter = 0; - var groupCount = 0; - - var vector = new Vector3(); - - // generate vertices, normals and uvs - - for ( var iy = 0; iy < gridY1; iy ++ ) { - - var y = iy * segmentHeight - heightHalf; - - for ( var ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segmentWidth - widthHalf; - - // set values to correct vector component - vector[ u ] = x * udir; - vector[ v ] = y * vdir; - vector[ w ] = depthHalf; - - // now apply vector to vertex buffer - vertices[ vertexBufferOffset ] = vector.x; - vertices[ vertexBufferOffset + 1 ] = vector.y; - vertices[ vertexBufferOffset + 2 ] = vector.z; - - // set values to correct vector component - vector[ u ] = 0; - vector[ v ] = 0; - vector[ w ] = depth > 0 ? 1 : - 1; - - // now apply vector to normal buffer - normals[ vertexBufferOffset ] = vector.x; - normals[ vertexBufferOffset + 1 ] = vector.y; - normals[ vertexBufferOffset + 2 ] = vector.z; - - // uvs - uvs[ uvBufferOffset ] = ix / gridX; - uvs[ uvBufferOffset + 1 ] = 1 - ( iy / gridY ); - - // update offsets and counters - vertexBufferOffset += 3; - uvBufferOffset += 2; - vertexCounter += 1; - - } - - } - - // 1. you need three indices to draw a single face - // 2. a single segment consists of two faces - // 3. so we need to generate six (2*3) indices per segment - - for ( iy = 0; iy < gridY; iy ++ ) { - - for ( ix = 0; ix < gridX; ix ++ ) { - - // indices - var a = numberOfVertices + ix + gridX1 * iy; - var b = numberOfVertices + ix + gridX1 * ( iy + 1 ); - var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; - - // face one - indices[ indexBufferOffset ] = a; - indices[ indexBufferOffset + 1 ] = b; - indices[ indexBufferOffset + 2 ] = d; - - // face two - indices[ indexBufferOffset + 3 ] = b; - indices[ indexBufferOffset + 4 ] = c; - indices[ indexBufferOffset + 5 ] = d; - - // update offsets and counters - indexBufferOffset += 6; - groupCount += 6; - - } - - } - - // add a group to the geometry. this will ensure multi material support - scope.addGroup( groupStart, groupCount, materialIndex ); - - // calculate new start value for groups - groupStart += groupCount; - - // update total number of vertices - numberOfVertices += vertexCounter; - - } - -} - -BoxBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -BoxBufferGeometry.prototype.constructor = BoxBufferGeometry; - -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -function PlaneBufferGeometry( width, height, widthSegments, heightSegments ) { - - BufferGeometry.call( this ); - - this.type = 'PlaneBufferGeometry'; - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments - }; - - var width_half = width / 2; - var height_half = height / 2; - - var gridX = Math.floor( widthSegments ) || 1; - var gridY = Math.floor( heightSegments ) || 1; - - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; - - var segment_width = width / gridX; - var segment_height = height / gridY; - - var vertices = new Float32Array( gridX1 * gridY1 * 3 ); - var normals = new Float32Array( gridX1 * gridY1 * 3 ); - var uvs = new Float32Array( gridX1 * gridY1 * 2 ); - - var offset = 0; - var offset2 = 0; - - for ( var iy = 0; iy < gridY1; iy ++ ) { - - var y = iy * segment_height - height_half; - - for ( var ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segment_width - width_half; - - vertices[ offset ] = x; - vertices[ offset + 1 ] = - y; - - normals[ offset + 2 ] = 1; - - uvs[ offset2 ] = ix / gridX; - uvs[ offset2 + 1 ] = 1 - ( iy / gridY ); - - offset += 3; - offset2 += 2; - - } - - } - - offset = 0; - - var indices = new ( ( vertices.length / 3 ) > 65535 ? Uint32Array : Uint16Array )( gridX * gridY * 6 ); - - for ( var iy = 0; iy < gridY; iy ++ ) { - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - indices[ offset ] = a; - indices[ offset + 1 ] = b; - indices[ offset + 2 ] = d; - - indices[ offset + 3 ] = b; - indices[ offset + 4 ] = c; - indices[ offset + 5 ] = d; - - offset += 6; - - } - - } - - this.setIndex( new BufferAttribute( indices, 1 ) ); - this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - -} - -PlaneBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -PlaneBufferGeometry.prototype.constructor = PlaneBufferGeometry; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author WestLangley / http://github.com/WestLangley -*/ - -function Camera() { - - Object3D.call( this ); - - this.type = 'Camera'; - - this.matrixWorldInverse = new Matrix4(); - this.projectionMatrix = new Matrix4(); - -} - -Camera.prototype = Object.create( Object3D.prototype ); -Camera.prototype.constructor = Camera; - -Camera.prototype.isCamera = true; - -Camera.prototype.getWorldDirection = function () { - - var quaternion = new Quaternion(); - - return function getWorldDirection( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - this.getWorldQuaternion( quaternion ); - - return result.set( 0, 0, - 1 ).applyQuaternion( quaternion ); - - }; - -}(); - -Camera.prototype.lookAt = function () { - - // This routine does not support cameras with rotated and/or translated parent(s) - - var m1 = new Matrix4(); - - return function lookAt( vector ) { - - m1.lookAt( this.position, vector, this.up ); - - this.quaternion.setFromRotationMatrix( m1 ); - - }; - -}(); - -Camera.prototype.clone = function () { - - return new this.constructor().copy( this ); - -}; - -Camera.prototype.copy = function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.matrixWorldInverse.copy( source.matrixWorldInverse ); - this.projectionMatrix.copy( source.projectionMatrix ); - - return this; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author greggman / http://games.greggman.com/ - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author tschw - */ - -function PerspectiveCamera( fov, aspect, near, far ) { - - Camera.call( this ); - - this.type = 'PerspectiveCamera'; - - this.fov = fov !== undefined ? fov : 50; - this.zoom = 1; - - this.near = near !== undefined ? near : 0.1; - this.far = far !== undefined ? far : 2000; - this.focus = 10; - - this.aspect = aspect !== undefined ? aspect : 1; - this.view = null; - - this.filmGauge = 35; // width of the film (default in millimeters) - this.filmOffset = 0; // horizontal film offset (same unit as gauge) - - this.updateProjectionMatrix(); - -} - -PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ), { - - constructor: PerspectiveCamera, - - isPerspectiveCamera: true, - - copy: function ( source ) { - - Camera.prototype.copy.call( this, source ); - - this.fov = source.fov; - this.zoom = source.zoom; - - this.near = source.near; - this.far = source.far; - this.focus = source.focus; - - this.aspect = source.aspect; - this.view = source.view === null ? null : Object.assign( {}, source.view ); - - this.filmGauge = source.filmGauge; - this.filmOffset = source.filmOffset; - - return this; - - }, - - /** - * Sets the FOV by focal length in respect to the current .filmGauge. - * - * The default film gauge is 35, so that the focal length can be specified for - * a 35mm (full frame) camera. - * - * Values for focal length and film gauge must have the same unit. - */ - setFocalLength: function ( focalLength ) { - - // see http://www.bobatkins.com/photography/technical/field_of_view.html - var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; - - this.fov = _Math.RAD2DEG * 2 * Math.atan( vExtentSlope ); - this.updateProjectionMatrix(); - - }, - - /** - * Calculates the focal length from the current .fov and .filmGauge. - */ - getFocalLength: function () { - - var vExtentSlope = Math.tan( _Math.DEG2RAD * 0.5 * this.fov ); - - return 0.5 * this.getFilmHeight() / vExtentSlope; - - }, - - getEffectiveFOV: function () { - - return _Math.RAD2DEG * 2 * Math.atan( - Math.tan( _Math.DEG2RAD * 0.5 * this.fov ) / this.zoom ); - - }, - - getFilmWidth: function () { - - // film not completely covered in portrait format (aspect < 1) - return this.filmGauge * Math.min( this.aspect, 1 ); - - }, - - getFilmHeight: function () { - - // film not completely covered in landscape format (aspect > 1) - return this.filmGauge / Math.max( this.aspect, 1 ); - - }, - - /** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and - * the monitors are in grid like this - * - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - * - * then for each monitor you would call it like this - * - * var w = 1920; - * var h = 1080; - * var fullWidth = w * 3; - * var fullHeight = h * 2; - * - * --A-- - * camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * --B-- - * camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * --C-- - * camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * --D-- - * camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * --E-- - * camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * --F-- - * camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); - * - * Note there is no reason monitors have to be the same size or in a grid. - */ - setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) { - - this.aspect = fullWidth / fullHeight; - - this.view = { - fullWidth: fullWidth, - fullHeight: fullHeight, - offsetX: x, - offsetY: y, - width: width, - height: height - }; - - this.updateProjectionMatrix(); - - }, - - clearViewOffset: function() { - - this.view = null; - this.updateProjectionMatrix(); - - }, - - updateProjectionMatrix: function () { - - var near = this.near, - top = near * Math.tan( - _Math.DEG2RAD * 0.5 * this.fov ) / this.zoom, - height = 2 * top, - width = this.aspect * height, - left = - 0.5 * width, - view = this.view; - - if ( view !== null ) { - - var fullWidth = view.fullWidth, - fullHeight = view.fullHeight; - - left += view.offsetX * width / fullWidth; - top -= view.offsetY * height / fullHeight; - width *= view.width / fullWidth; - height *= view.height / fullHeight; - - } - - var skew = this.filmOffset; - if ( skew !== 0 ) left += near * skew / this.getFilmWidth(); - - this.projectionMatrix.makeFrustum( - left, left + width, top - height, top, near, this.far ); - - }, - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.fov = this.fov; - data.object.zoom = this.zoom; - - data.object.near = this.near; - data.object.far = this.far; - data.object.focus = this.focus; - - data.object.aspect = this.aspect; - - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); - - data.object.filmGauge = this.filmGauge; - data.object.filmOffset = this.filmOffset; - - return data; - - } - -} ); - -/** - * @author alteredq / http://alteredqualia.com/ - * @author arose / http://github.com/arose - */ - -function OrthographicCamera( left, right, top, bottom, near, far ) { - - Camera.call( this ); - - this.type = 'OrthographicCamera'; - - this.zoom = 1; - this.view = null; - - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - - this.near = ( near !== undefined ) ? near : 0.1; - this.far = ( far !== undefined ) ? far : 2000; - - this.updateProjectionMatrix(); - -} - -OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), { - - constructor: OrthographicCamera, - - isOrthographicCamera: true, - - copy: function ( source ) { - - Camera.prototype.copy.call( this, source ); - - this.left = source.left; - this.right = source.right; - this.top = source.top; - this.bottom = source.bottom; - this.near = source.near; - this.far = source.far; - - this.zoom = source.zoom; - this.view = source.view === null ? null : Object.assign( {}, source.view ); - - return this; - - }, - - setViewOffset: function( fullWidth, fullHeight, x, y, width, height ) { - - this.view = { - fullWidth: fullWidth, - fullHeight: fullHeight, - offsetX: x, - offsetY: y, - width: width, - height: height - }; - - this.updateProjectionMatrix(); - - }, - - clearViewOffset: function() { - - this.view = null; - this.updateProjectionMatrix(); - - }, - - updateProjectionMatrix: function () { - - var dx = ( this.right - this.left ) / ( 2 * this.zoom ); - var dy = ( this.top - this.bottom ) / ( 2 * this.zoom ); - var cx = ( this.right + this.left ) / 2; - var cy = ( this.top + this.bottom ) / 2; - - var left = cx - dx; - var right = cx + dx; - var top = cy + dy; - var bottom = cy - dy; - - if ( this.view !== null ) { - - var zoomW = this.zoom / ( this.view.width / this.view.fullWidth ); - var zoomH = this.zoom / ( this.view.height / this.view.fullHeight ); - var scaleW = ( this.right - this.left ) / this.view.width; - var scaleH = ( this.top - this.bottom ) / this.view.height; - - left += scaleW * ( this.view.offsetX / zoomW ); - right = left + scaleW * ( this.view.width / zoomW ); - top -= scaleH * ( this.view.offsetY / zoomH ); - bottom = top - scaleH * ( this.view.height / zoomH ); - - } - - this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far ); - - }, - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.zoom = this.zoom; - data.object.left = this.left; - data.object.right = this.right; - data.object.top = this.top; - data.object.bottom = this.bottom; - data.object.near = this.near; - data.object.far = this.far; - - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); - - return data; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLIndexedBufferRenderer( gl, extensions, infoRender ) { - - var mode; - - function setMode( value ) { - - mode = value; - - } - - var type, size; - - function setIndex( index ) { - - if ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) { - - type = gl.UNSIGNED_INT; - size = 4; - - } else { - - type = gl.UNSIGNED_SHORT; - size = 2; - - } - - } - - function render( start, count ) { - - gl.drawElements( mode, count, type, start * size ); - - infoRender.calls ++; - infoRender.vertices += count; - - if ( mode === gl.TRIANGLES ) infoRender.faces += count / 3; - - } - - function renderInstances( geometry, start, count ) { - - var extension = extensions.get( 'ANGLE_instanced_arrays' ); - - if ( extension === null ) { - - console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' ); - return; - - } - - extension.drawElementsInstancedANGLE( mode, count, type, start * size, geometry.maxInstancedCount ); - - infoRender.calls ++; - infoRender.vertices += count * geometry.maxInstancedCount; - - if ( mode === gl.TRIANGLES ) infoRender.faces += geometry.maxInstancedCount * count / 3; - - } - - return { - - setMode: setMode, - setIndex: setIndex, - render: render, - renderInstances: renderInstances - - }; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLBufferRenderer( gl, extensions, infoRender ) { - - var mode; - - function setMode( value ) { - - mode = value; - - } - - function render( start, count ) { - - gl.drawArrays( mode, start, count ); - - infoRender.calls ++; - infoRender.vertices += count; - - if ( mode === gl.TRIANGLES ) infoRender.faces += count / 3; - - } - - function renderInstances( geometry ) { - - var extension = extensions.get( 'ANGLE_instanced_arrays' ); - - if ( extension === null ) { - - console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' ); - return; - - } - - var position = geometry.attributes.position; - - var count = 0; - - if ( position.isInterleavedBufferAttribute ) { - - count = position.data.count; - - extension.drawArraysInstancedANGLE( mode, 0, count, geometry.maxInstancedCount ); - - } else { - - count = position.count; - - extension.drawArraysInstancedANGLE( mode, 0, count, geometry.maxInstancedCount ); - - } - - infoRender.calls ++; - infoRender.vertices += count * geometry.maxInstancedCount; - - if ( mode === gl.TRIANGLES ) infoRender.faces += geometry.maxInstancedCount * count / 3; - - } - - return { - setMode: setMode, - render: render, - renderInstances: renderInstances - }; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLLights() { - - var lights = {}; - - return { - - get: function ( light ) { - - if ( lights[ light.id ] !== undefined ) { - - return lights[ light.id ]; - - } - - var uniforms; - - switch ( light.type ) { - - case 'DirectionalLight': - uniforms = { - direction: new Vector3(), - color: new Color(), - - shadow: false, - shadowBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - - case 'SpotLight': - uniforms = { - position: new Vector3(), - direction: new Vector3(), - color: new Color(), - distance: 0, - coneCos: 0, - penumbraCos: 0, - decay: 0, - - shadow: false, - shadowBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - - case 'PointLight': - uniforms = { - position: new Vector3(), - color: new Color(), - distance: 0, - decay: 0, - - shadow: false, - shadowBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - - case 'HemisphereLight': - uniforms = { - direction: new Vector3(), - skyColor: new Color(), - groundColor: new Color() - }; - break; - - case 'RectAreaLight': - uniforms = { - color: new Color(), - position: new Vector3(), - halfWidth: new Vector3(), - halfHeight: new Vector3() - // TODO (abelnation): set RectAreaLight shadow uniforms - }; - break; - - } - - lights[ light.id ] = uniforms; - - return uniforms; - - } - - }; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function addLineNumbers( string ) { - - var lines = string.split( '\n' ); - - for ( var i = 0; i < lines.length; i ++ ) { - - lines[ i ] = ( i + 1 ) + ': ' + lines[ i ]; - - } - - return lines.join( '\n' ); - -} - -function WebGLShader( gl, type, string ) { - - var shader = gl.createShader( type ); - - gl.shaderSource( shader, string ); - gl.compileShader( shader ); - - if ( gl.getShaderParameter( shader, gl.COMPILE_STATUS ) === false ) { - - console.error( 'THREE.WebGLShader: Shader couldn\'t compile.' ); - - } - - if ( gl.getShaderInfoLog( shader ) !== '' ) { - - console.warn( 'THREE.WebGLShader: gl.getShaderInfoLog()', type === gl.VERTEX_SHADER ? 'vertex' : 'fragment', gl.getShaderInfoLog( shader ), addLineNumbers( string ) ); - - } - - // --enable-privileged-webgl-extension - // console.log( type, gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); - - return shader; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -var programIdCount = 0; - -function getEncodingComponents( encoding ) { - - switch ( encoding ) { - - case LinearEncoding: - return [ 'Linear','( value )' ]; - case sRGBEncoding: - return [ 'sRGB','( value )' ]; - case RGBEEncoding: - return [ 'RGBE','( value )' ]; - case RGBM7Encoding: - return [ 'RGBM','( value, 7.0 )' ]; - case RGBM16Encoding: - return [ 'RGBM','( value, 16.0 )' ]; - case RGBDEncoding: - return [ 'RGBD','( value, 256.0 )' ]; - case GammaEncoding: - return [ 'Gamma','( value, float( GAMMA_FACTOR ) )' ]; - default: - throw new Error( 'unsupported encoding: ' + encoding ); - - } - -} - -function getTexelDecodingFunction( functionName, encoding ) { - - var components = getEncodingComponents( encoding ); - return "vec4 " + functionName + "( vec4 value ) { return " + components[ 0 ] + "ToLinear" + components[ 1 ] + "; }"; - -} - -function getTexelEncodingFunction( functionName, encoding ) { - - var components = getEncodingComponents( encoding ); - return "vec4 " + functionName + "( vec4 value ) { return LinearTo" + components[ 0 ] + components[ 1 ] + "; }"; - -} - -function getToneMappingFunction( functionName, toneMapping ) { - - var toneMappingName; - - switch ( toneMapping ) { - - case LinearToneMapping: - toneMappingName = "Linear"; - break; - - case ReinhardToneMapping: - toneMappingName = "Reinhard"; - break; - - case Uncharted2ToneMapping: - toneMappingName = "Uncharted2"; - break; - - case CineonToneMapping: - toneMappingName = "OptimizedCineon"; - break; - - default: - throw new Error( 'unsupported toneMapping: ' + toneMapping ); - - } - - return "vec3 " + functionName + "( vec3 color ) { return " + toneMappingName + "ToneMapping( color ); }"; - -} - -function generateExtensions( extensions, parameters, rendererExtensions ) { - - extensions = extensions || {}; - - var chunks = [ - ( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.normalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '', - ( extensions.fragDepth || parameters.logarithmicDepthBuffer ) && rendererExtensions.get( 'EXT_frag_depth' ) ? '#extension GL_EXT_frag_depth : enable' : '', - ( extensions.drawBuffers ) && rendererExtensions.get( 'WEBGL_draw_buffers' ) ? '#extension GL_EXT_draw_buffers : require' : '', - ( extensions.shaderTextureLOD || parameters.envMap ) && rendererExtensions.get( 'EXT_shader_texture_lod' ) ? '#extension GL_EXT_shader_texture_lod : enable' : '', - ]; - - return chunks.filter( filterEmptyLine ).join( '\n' ); - -} - -function generateDefines( defines ) { - - var chunks = []; - - for ( var name in defines ) { - - var value = defines[ name ]; - - if ( value === false ) continue; - - chunks.push( '#define ' + name + ' ' + value ); - - } - - return chunks.join( '\n' ); - -} - -function fetchAttributeLocations( gl, program, identifiers ) { - - var attributes = {}; - - var n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES ); - - for ( var i = 0; i < n; i ++ ) { - - var info = gl.getActiveAttrib( program, i ); - var name = info.name; - - // console.log("THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:", name, i ); - - attributes[ name ] = gl.getAttribLocation( program, name ); - - } - - return attributes; - -} - -function filterEmptyLine( string ) { - - return string !== ''; - -} - -function replaceLightNums( string, parameters ) { - - return string - .replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights ) - .replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights ) - .replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights ) - .replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights ) - .replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights ); - -} - -function parseIncludes( string ) { - - var pattern = /#include +<([\w\d.]+)>/g; - - function replace( match, include ) { - - var replace = ShaderChunk[ include ]; - - if ( replace === undefined ) { - - throw new Error( 'Can not resolve #include <' + include + '>' ); - - } - - return parseIncludes( replace ); - - } - - return string.replace( pattern, replace ); - -} - -function unrollLoops( string ) { - - var pattern = /for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; - - function replace( match, start, end, snippet ) { - - var unroll = ''; - - for ( var i = parseInt( start ); i < parseInt( end ); i ++ ) { - - unroll += snippet.replace( /\[ i \]/g, '[ ' + i + ' ]' ); - - } - - return unroll; - - } - - return string.replace( pattern, replace ); - -} - -function WebGLProgram( renderer, code, material, parameters ) { - - var gl = renderer.context; - - var extensions = material.extensions; - var defines = material.defines; - - var vertexShader = material.__webglShader.vertexShader; - var fragmentShader = material.__webglShader.fragmentShader; - - var shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; - - if ( parameters.shadowMapType === PCFShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF'; - - } else if ( parameters.shadowMapType === PCFSoftShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT'; - - } - - var envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - var envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; - var envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; - - if ( parameters.envMap ) { - - switch ( material.envMap.mapping ) { - - case CubeReflectionMapping: - case CubeRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - break; - - case CubeUVReflectionMapping: - case CubeUVRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV'; - break; - - case EquirectangularReflectionMapping: - case EquirectangularRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_EQUIREC'; - break; - - case SphericalReflectionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_SPHERE'; - break; - - } - - switch ( material.envMap.mapping ) { - - case CubeRefractionMapping: - case EquirectangularRefractionMapping: - envMapModeDefine = 'ENVMAP_MODE_REFRACTION'; - break; - - } - - switch ( material.combine ) { - - case MultiplyOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; - break; - - case MixOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_MIX'; - break; - - case AddOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_ADD'; - break; - - } - - } - - var gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0; - - // console.log( 'building new program ' ); - - // - - var customExtensions = generateExtensions( extensions, parameters, renderer.extensions ); - - var customDefines = generateDefines( defines ); - - // - - var program = gl.createProgram(); - - var prefixVertex, prefixFragment; - - if ( material.isRawShaderMaterial ) { - - prefixVertex = [ - - customDefines, - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - prefixFragment = [ - - customExtensions, - customDefines, - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - } else { - - prefixVertex = [ - - 'precision ' + parameters.precision + ' float;', - 'precision ' + parameters.precision + ' int;', - - '#define SHADER_NAME ' + material.__webglShader.name, - - customDefines, - - parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '', - - '#define GAMMA_FACTOR ' + gammaFactorDefine, - - '#define MAX_BONES ' + parameters.maxBones, - - parameters.map ? '#define USE_MAP' : '', - parameters.envMap ? '#define USE_ENVMAP' : '', - parameters.envMap ? '#define ' + envMapModeDefine : '', - parameters.lightMap ? '#define USE_LIGHTMAP' : '', - parameters.aoMap ? '#define USE_AOMAP' : '', - parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', - parameters.bumpMap ? '#define USE_BUMPMAP' : '', - parameters.normalMap ? '#define USE_NORMALMAP' : '', - parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '', - parameters.specularMap ? '#define USE_SPECULARMAP' : '', - parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', - parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', - parameters.alphaMap ? '#define USE_ALPHAMAP' : '', - parameters.vertexColors ? '#define USE_COLOR' : '', - - parameters.flatShading ? '#define FLAT_SHADED' : '', - - parameters.skinning ? '#define USE_SKINNING' : '', - parameters.useVertexTexture ? '#define BONE_TEXTURE' : '', - - parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', - parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '', - parameters.doubleSided ? '#define DOUBLE_SIDED' : '', - parameters.flipSided ? '#define FLIP_SIDED' : '', - - '#define NUM_CLIPPING_PLANES ' + parameters.numClippingPlanes, - - parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', - parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', - - parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', - - parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', - parameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '', - - 'uniform mat4 modelMatrix;', - 'uniform mat4 modelViewMatrix;', - 'uniform mat4 projectionMatrix;', - 'uniform mat4 viewMatrix;', - 'uniform mat3 normalMatrix;', - 'uniform vec3 cameraPosition;', - - 'attribute vec3 position;', - 'attribute vec3 normal;', - 'attribute vec2 uv;', - - '#ifdef USE_COLOR', - - ' attribute vec3 color;', - - '#endif', - - '#ifdef USE_MORPHTARGETS', - - ' attribute vec3 morphTarget0;', - ' attribute vec3 morphTarget1;', - ' attribute vec3 morphTarget2;', - ' attribute vec3 morphTarget3;', - - ' #ifdef USE_MORPHNORMALS', - - ' attribute vec3 morphNormal0;', - ' attribute vec3 morphNormal1;', - ' attribute vec3 morphNormal2;', - ' attribute vec3 morphNormal3;', - - ' #else', - - ' attribute vec3 morphTarget4;', - ' attribute vec3 morphTarget5;', - ' attribute vec3 morphTarget6;', - ' attribute vec3 morphTarget7;', - - ' #endif', - - '#endif', - - '#ifdef USE_SKINNING', - - ' attribute vec4 skinIndex;', - ' attribute vec4 skinWeight;', - - '#endif', - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - prefixFragment = [ - - customExtensions, - - 'precision ' + parameters.precision + ' float;', - 'precision ' + parameters.precision + ' int;', - - '#define SHADER_NAME ' + material.__webglShader.name, - - customDefines, - - parameters.alphaTest ? '#define ALPHATEST ' + parameters.alphaTest : '', - - '#define GAMMA_FACTOR ' + gammaFactorDefine, - - ( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '', - ( parameters.useFog && parameters.fogExp ) ? '#define FOG_EXP2' : '', - - parameters.map ? '#define USE_MAP' : '', - parameters.envMap ? '#define USE_ENVMAP' : '', - parameters.envMap ? '#define ' + envMapTypeDefine : '', - parameters.envMap ? '#define ' + envMapModeDefine : '', - parameters.envMap ? '#define ' + envMapBlendingDefine : '', - parameters.lightMap ? '#define USE_LIGHTMAP' : '', - parameters.aoMap ? '#define USE_AOMAP' : '', - parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', - parameters.bumpMap ? '#define USE_BUMPMAP' : '', - parameters.normalMap ? '#define USE_NORMALMAP' : '', - parameters.specularMap ? '#define USE_SPECULARMAP' : '', - parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', - parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', - parameters.alphaMap ? '#define USE_ALPHAMAP' : '', - parameters.vertexColors ? '#define USE_COLOR' : '', - - parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', - - parameters.flatShading ? '#define FLAT_SHADED' : '', - - parameters.doubleSided ? '#define DOUBLE_SIDED' : '', - parameters.flipSided ? '#define FLIP_SIDED' : '', - - '#define NUM_CLIPPING_PLANES ' + parameters.numClippingPlanes, - '#define UNION_CLIPPING_PLANES ' + (parameters.numClippingPlanes - parameters.numClipIntersection), - - parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', - parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', - - parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : '', - - parameters.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : '', - - parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', - parameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '', - - parameters.envMap && renderer.extensions.get( 'EXT_shader_texture_lod' ) ? '#define TEXTURE_LOD_EXT' : '', - - 'uniform mat4 viewMatrix;', - 'uniform vec3 cameraPosition;', - - ( parameters.toneMapping !== NoToneMapping ) ? "#define TONE_MAPPING" : '', - ( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below - ( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( "toneMapping", parameters.toneMapping ) : '', - - ( parameters.outputEncoding || parameters.mapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding ) ? ShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below - parameters.mapEncoding ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '', - parameters.envMapEncoding ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '', - parameters.emissiveMapEncoding ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '', - parameters.outputEncoding ? getTexelEncodingFunction( "linearToOutputTexel", parameters.outputEncoding ) : '', - - parameters.depthPacking ? "#define DEPTH_PACKING " + material.depthPacking : '', - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - } - - vertexShader = parseIncludes( vertexShader, parameters ); - vertexShader = replaceLightNums( vertexShader, parameters ); - - fragmentShader = parseIncludes( fragmentShader, parameters ); - fragmentShader = replaceLightNums( fragmentShader, parameters ); - - if ( ! material.isShaderMaterial ) { - - vertexShader = unrollLoops( vertexShader ); - fragmentShader = unrollLoops( fragmentShader ); - - } - - var vertexGlsl = prefixVertex + vertexShader; - var fragmentGlsl = prefixFragment + fragmentShader; - - // console.log( '*VERTEX*', vertexGlsl ); - // console.log( '*FRAGMENT*', fragmentGlsl ); - - var glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl ); - var glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl ); - - gl.attachShader( program, glVertexShader ); - gl.attachShader( program, glFragmentShader ); - - // Force a particular attribute to index 0. - - if ( material.index0AttributeName !== undefined ) { - - gl.bindAttribLocation( program, 0, material.index0AttributeName ); - - } else if ( parameters.morphTargets === true ) { - - // programs with morphTargets displace position out of attribute 0 - gl.bindAttribLocation( program, 0, 'position' ); - - } - - gl.linkProgram( program ); - - var programLog = gl.getProgramInfoLog( program ); - var vertexLog = gl.getShaderInfoLog( glVertexShader ); - var fragmentLog = gl.getShaderInfoLog( glFragmentShader ); - - var runnable = true; - var haveDiagnostics = true; - - // console.log( '**VERTEX**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glVertexShader ) ); - // console.log( '**FRAGMENT**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glFragmentShader ) ); - - if ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) { - - runnable = false; - - console.error( 'THREE.WebGLProgram: shader error: ', gl.getError(), 'gl.VALIDATE_STATUS', gl.getProgramParameter( program, gl.VALIDATE_STATUS ), 'gl.getProgramInfoLog', programLog, vertexLog, fragmentLog ); - - } else if ( programLog !== '' ) { - - console.warn( 'THREE.WebGLProgram: gl.getProgramInfoLog()', programLog ); - - } else if ( vertexLog === '' || fragmentLog === '' ) { - - haveDiagnostics = false; - - } - - if ( haveDiagnostics ) { - - this.diagnostics = { - - runnable: runnable, - material: material, - - programLog: programLog, - - vertexShader: { - - log: vertexLog, - prefix: prefixVertex - - }, - - fragmentShader: { - - log: fragmentLog, - prefix: prefixFragment - - } - - }; - - } - - // clean up - - gl.deleteShader( glVertexShader ); - gl.deleteShader( glFragmentShader ); - - // set up caching for uniform locations - - var cachedUniforms; - - this.getUniforms = function() { - - if ( cachedUniforms === undefined ) { - - cachedUniforms = - new WebGLUniforms( gl, program, renderer ); - - } - - return cachedUniforms; - - }; - - // set up caching for attribute locations - - var cachedAttributes; - - this.getAttributes = function() { - - if ( cachedAttributes === undefined ) { - - cachedAttributes = fetchAttributeLocations( gl, program ); - - } - - return cachedAttributes; - - }; - - // free resource - - this.destroy = function() { - - gl.deleteProgram( program ); - this.program = undefined; - - }; - - // DEPRECATED - - Object.defineProperties( this, { - - uniforms: { - get: function() { - - console.warn( 'THREE.WebGLProgram: .uniforms is now .getUniforms().' ); - return this.getUniforms(); - - } - }, - - attributes: { - get: function() { - - console.warn( 'THREE.WebGLProgram: .attributes is now .getAttributes().' ); - return this.getAttributes(); - - } - } - - } ); - - - // - - this.id = programIdCount ++; - this.code = code; - this.usedTimes = 1; - this.program = program; - this.vertexShader = glVertexShader; - this.fragmentShader = glFragmentShader; - - return this; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLPrograms( renderer, capabilities ) { - - var programs = []; - - var shaderIDs = { - MeshDepthMaterial: 'depth', - MeshNormalMaterial: 'normal', - MeshBasicMaterial: 'basic', - MeshLambertMaterial: 'lambert', - MeshPhongMaterial: 'phong', - MeshToonMaterial: 'phong', - MeshStandardMaterial: 'physical', - MeshPhysicalMaterial: 'physical', - LineBasicMaterial: 'basic', - LineDashedMaterial: 'dashed', - PointsMaterial: 'points' - }; - - var parameterNames = [ - "precision", "supportsVertexTextures", "map", "mapEncoding", "envMap", "envMapMode", "envMapEncoding", - "lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "displacementMap", "specularMap", - "roughnessMap", "metalnessMap", "gradientMap", - "alphaMap", "combine", "vertexColors", "fog", "useFog", "fogExp", - "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", - "maxBones", "useVertexTexture", "morphTargets", "morphNormals", - "maxMorphTargets", "maxMorphNormals", "premultipliedAlpha", - "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights", - "shadowMapEnabled", "shadowMapType", "toneMapping", 'physicallyCorrectLights', - "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking" - ]; - - - function allocateBones( object ) { - - if ( capabilities.floatVertexTextures && object && object.skeleton && object.skeleton.useVertexTexture ) { - - return 1024; - - } else { - - // default for when object is not specified - // ( for example when prebuilding shader to be used with multiple objects ) - // - // - leave some extra space for other uniforms - // - limit here is ANGLE's 254 max uniform vectors - // (up to 54 should be safe) - - var nVertexUniforms = capabilities.maxVertexUniforms; - var nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 ); - - var maxBones = nVertexMatrices; - - if ( object !== undefined && (object && object.isSkinnedMesh) ) { - - maxBones = Math.min( object.skeleton.bones.length, maxBones ); - - if ( maxBones < object.skeleton.bones.length ) { - - console.warn( 'WebGLRenderer: too many bones - ' + object.skeleton.bones.length + ', this GPU supports just ' + maxBones + ' (try OpenGL instead of ANGLE)' ); - - } - - } - - return maxBones; - - } - - } - - function getTextureEncodingFromMap( map, gammaOverrideLinear ) { - - var encoding; - - if ( ! map ) { - - encoding = LinearEncoding; - - } else if ( map.isTexture ) { - - encoding = map.encoding; - - } else if ( map.isWebGLRenderTarget ) { - - console.warn( "THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead." ); - encoding = map.texture.encoding; - - } - - // add backwards compatibility for WebGLRenderer.gammaInput/gammaOutput parameter, should probably be removed at some point. - if ( encoding === LinearEncoding && gammaOverrideLinear ) { - - encoding = GammaEncoding; - - } - - return encoding; - - } - - this.getParameters = function ( material, lights, fog, nClipPlanes, nClipIntersection, object ) { - - var shaderID = shaderIDs[ material.type ]; - - // heuristics to create shader parameters according to lights in the scene - // (not to blow over maxLights budget) - - var maxBones = allocateBones( object ); - var precision = renderer.getPrecision(); - - if ( material.precision !== null ) { - - precision = capabilities.getMaxPrecision( material.precision ); - - if ( precision !== material.precision ) { - - console.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' ); - - } - - } - - var currentRenderTarget = renderer.getCurrentRenderTarget(); - - var parameters = { - - shaderID: shaderID, - - precision: precision, - supportsVertexTextures: capabilities.vertexTextures, - outputEncoding: getTextureEncodingFromMap( ( ! currentRenderTarget ) ? null : currentRenderTarget.texture, renderer.gammaOutput ), - map: !! material.map, - mapEncoding: getTextureEncodingFromMap( material.map, renderer.gammaInput ), - envMap: !! material.envMap, - envMapMode: material.envMap && material.envMap.mapping, - envMapEncoding: getTextureEncodingFromMap( material.envMap, renderer.gammaInput ), - envMapCubeUV: ( !! material.envMap ) && ( ( material.envMap.mapping === CubeUVReflectionMapping ) || ( material.envMap.mapping === CubeUVRefractionMapping ) ), - lightMap: !! material.lightMap, - aoMap: !! material.aoMap, - emissiveMap: !! material.emissiveMap, - emissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap, renderer.gammaInput ), - bumpMap: !! material.bumpMap, - normalMap: !! material.normalMap, - displacementMap: !! material.displacementMap, - roughnessMap: !! material.roughnessMap, - metalnessMap: !! material.metalnessMap, - specularMap: !! material.specularMap, - alphaMap: !! material.alphaMap, - - gradientMap: !! material.gradientMap, - - combine: material.combine, - - vertexColors: material.vertexColors, - - fog: !! fog, - useFog: material.fog, - fogExp: (fog && fog.isFogExp2), - - flatShading: material.shading === FlatShading, - - sizeAttenuation: material.sizeAttenuation, - logarithmicDepthBuffer: capabilities.logarithmicDepthBuffer, - - skinning: material.skinning, - maxBones: maxBones, - useVertexTexture: capabilities.floatVertexTextures && object && object.skeleton && object.skeleton.useVertexTexture, - - morphTargets: material.morphTargets, - morphNormals: material.morphNormals, - maxMorphTargets: renderer.maxMorphTargets, - maxMorphNormals: renderer.maxMorphNormals, - - numDirLights: lights.directional.length, - numPointLights: lights.point.length, - numSpotLights: lights.spot.length, - numRectAreaLights: lights.rectArea.length, - numHemiLights: lights.hemi.length, - - numClippingPlanes: nClipPlanes, - numClipIntersection: nClipIntersection, - - shadowMapEnabled: renderer.shadowMap.enabled && object.receiveShadow && lights.shadows.length > 0, - shadowMapType: renderer.shadowMap.type, - - toneMapping: renderer.toneMapping, - physicallyCorrectLights: renderer.physicallyCorrectLights, - - premultipliedAlpha: material.premultipliedAlpha, - - alphaTest: material.alphaTest, - doubleSided: material.side === DoubleSide, - flipSided: material.side === BackSide, - - depthPacking: ( material.depthPacking !== undefined ) ? material.depthPacking : false - - }; - - return parameters; - - }; - - this.getProgramCode = function ( material, parameters ) { - - var array = []; - - if ( parameters.shaderID ) { - - array.push( parameters.shaderID ); - - } else { - - array.push( material.fragmentShader ); - array.push( material.vertexShader ); - - } - - if ( material.defines !== undefined ) { - - for ( var name in material.defines ) { - - array.push( name ); - array.push( material.defines[ name ] ); - - } - - } - - for ( var i = 0; i < parameterNames.length; i ++ ) { - - array.push( parameters[ parameterNames[ i ] ] ); - - } - - return array.join(); - - }; - - this.acquireProgram = function ( material, parameters, code ) { - - var program; - - // Check if code has been already compiled - for ( var p = 0, pl = programs.length; p < pl; p ++ ) { - - var programInfo = programs[ p ]; - - if ( programInfo.code === code ) { - - program = programInfo; - ++ program.usedTimes; - - break; - - } - - } - - if ( program === undefined ) { - - program = new WebGLProgram( renderer, code, material, parameters ); - programs.push( program ); - - } - - return program; - - }; - - this.releaseProgram = function( program ) { - - if ( -- program.usedTimes === 0 ) { - - // Remove from unordered set - var i = programs.indexOf( program ); - programs[ i ] = programs[ programs.length - 1 ]; - programs.pop(); - - // Free WebGL resources - program.destroy(); - - } - - }; - - // Exposed for resource monitoring & error feedback via renderer.info: - this.programs = programs; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLGeometries( gl, properties, info ) { - - var geometries = {}; - - function onGeometryDispose( event ) { - - var geometry = event.target; - var buffergeometry = geometries[ geometry.id ]; - - if ( buffergeometry.index !== null ) { - - deleteAttribute( buffergeometry.index ); - - } - - deleteAttributes( buffergeometry.attributes ); - - geometry.removeEventListener( 'dispose', onGeometryDispose ); - - delete geometries[ geometry.id ]; - - // TODO - - var property = properties.get( geometry ); - - if ( property.wireframe ) { - - deleteAttribute( property.wireframe ); - - } - - properties.delete( geometry ); - - var bufferproperty = properties.get( buffergeometry ); - - if ( bufferproperty.wireframe ) { - - deleteAttribute( bufferproperty.wireframe ); - - } - - properties.delete( buffergeometry ); - - // - - info.memory.geometries --; - - } - - function getAttributeBuffer( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) { - - return properties.get( attribute.data ).__webglBuffer; - - } - - return properties.get( attribute ).__webglBuffer; - - } - - function deleteAttribute( attribute ) { - - var buffer = getAttributeBuffer( attribute ); - - if ( buffer !== undefined ) { - - gl.deleteBuffer( buffer ); - removeAttributeBuffer( attribute ); - - } - - } - - function deleteAttributes( attributes ) { - - for ( var name in attributes ) { - - deleteAttribute( attributes[ name ] ); - - } - - } - - function removeAttributeBuffer( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) { - - properties.delete( attribute.data ); - - } else { - - properties.delete( attribute ); - - } - - } - - return { - - get: function ( object ) { - - var geometry = object.geometry; - - if ( geometries[ geometry.id ] !== undefined ) { - - return geometries[ geometry.id ]; - - } - - geometry.addEventListener( 'dispose', onGeometryDispose ); - - var buffergeometry; - - if ( geometry.isBufferGeometry ) { - - buffergeometry = geometry; - - } else if ( geometry.isGeometry ) { - - if ( geometry._bufferGeometry === undefined ) { - - geometry._bufferGeometry = new BufferGeometry().setFromObject( object ); - - } - - buffergeometry = geometry._bufferGeometry; - - } - - geometries[ geometry.id ] = buffergeometry; - - info.memory.geometries ++; - - return buffergeometry; - - } - - }; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLObjects( gl, properties, info ) { - - var geometries = new WebGLGeometries( gl, properties, info ); - - // - - function update( object ) { - - // TODO: Avoid updating twice (when using shadowMap). Maybe add frame counter. - - var geometry = geometries.get( object ); - - if ( object.geometry.isGeometry ) { - - geometry.updateFromObject( object ); - - } - - var index = geometry.index; - var attributes = geometry.attributes; - - if ( index !== null ) { - - updateAttribute( index, gl.ELEMENT_ARRAY_BUFFER ); - - } - - for ( var name in attributes ) { - - updateAttribute( attributes[ name ], gl.ARRAY_BUFFER ); - - } - - // morph targets - - var morphAttributes = geometry.morphAttributes; - - for ( var name in morphAttributes ) { - - var array = morphAttributes[ name ]; - - for ( var i = 0, l = array.length; i < l; i ++ ) { - - updateAttribute( array[ i ], gl.ARRAY_BUFFER ); - - } - - } - - return geometry; - - } - - function updateAttribute( attribute, bufferType ) { - - var data = ( attribute.isInterleavedBufferAttribute ) ? attribute.data : attribute; - - var attributeProperties = properties.get( data ); - - if ( attributeProperties.__webglBuffer === undefined ) { - - createBuffer( attributeProperties, data, bufferType ); - - } else if ( attributeProperties.version !== data.version ) { - - updateBuffer( attributeProperties, data, bufferType ); - - } - - } - - function createBuffer( attributeProperties, data, bufferType ) { - - attributeProperties.__webglBuffer = gl.createBuffer(); - gl.bindBuffer( bufferType, attributeProperties.__webglBuffer ); - - var usage = data.dynamic ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW; - - gl.bufferData( bufferType, data.array, usage ); - - var type = gl.FLOAT; - var array = data.array; - - if ( array instanceof Float32Array ) { - - type = gl.FLOAT; - - } else if ( array instanceof Float64Array ) { - - console.warn( "Unsupported data buffer format: Float64Array" ); - - } else if ( array instanceof Uint16Array ) { - - type = gl.UNSIGNED_SHORT; - - } else if ( array instanceof Int16Array ) { - - type = gl.SHORT; - - } else if ( array instanceof Uint32Array ) { - - type = gl.UNSIGNED_INT; - - } else if ( array instanceof Int32Array ) { - - type = gl.INT; - - } else if ( array instanceof Int8Array ) { - - type = gl.BYTE; - - } else if ( array instanceof Uint8Array ) { - - type = gl.UNSIGNED_BYTE; - - } - - attributeProperties.bytesPerElement = array.BYTES_PER_ELEMENT; - attributeProperties.type = type; - attributeProperties.version = data.version; - - data.onUploadCallback(); - - } - - function updateBuffer( attributeProperties, data, bufferType ) { - - gl.bindBuffer( bufferType, attributeProperties.__webglBuffer ); - - if ( data.dynamic === false ) { - - gl.bufferData( bufferType, data.array, gl.STATIC_DRAW ); - - } else if ( data.updateRange.count === - 1 ) { - - // Not using update ranges - - gl.bufferSubData( bufferType, 0, data.array ); - - } else if ( data.updateRange.count === 0 ) { - - console.error( 'THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually.' ); - - } else { - - gl.bufferSubData( bufferType, data.updateRange.offset * data.array.BYTES_PER_ELEMENT, - data.array.subarray( data.updateRange.offset, data.updateRange.offset + data.updateRange.count ) ); - - data.updateRange.count = 0; // reset range - - } - - attributeProperties.version = data.version; - - } - - function getAttributeBuffer( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) { - - return properties.get( attribute.data ).__webglBuffer; - - } - - return properties.get( attribute ).__webglBuffer; - - } - - function getAttributeProperties( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) { - - return properties.get( attribute.data ); - - } - - return properties.get( attribute ); - - } - - function getWireframeAttribute( geometry ) { - - var property = properties.get( geometry ); - - if ( property.wireframe !== undefined ) { - - return property.wireframe; - - } - - var indices = []; - - var index = geometry.index; - var attributes = geometry.attributes; - var position = attributes.position; - - // console.time( 'wireframe' ); - - if ( index !== null ) { - - var edges = {}; - var array = index.array; - - for ( var i = 0, l = array.length; i < l; i += 3 ) { - - var a = array[ i + 0 ]; - var b = array[ i + 1 ]; - var c = array[ i + 2 ]; - - indices.push( a, b, b, c, c, a ); - - } - - } else { - - var array = attributes.position.array; - - for ( var i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) { - - var a = i + 0; - var b = i + 1; - var c = i + 2; - - indices.push( a, b, b, c, c, a ); - - } - - } - - // console.timeEnd( 'wireframe' ); - - var TypeArray = position.count > 65535 ? Uint32Array : Uint16Array; - var attribute = new BufferAttribute( new TypeArray( indices ), 1 ); - - updateAttribute( attribute, gl.ELEMENT_ARRAY_BUFFER ); - - property.wireframe = attribute; - - return attribute; - - } - - return { - - getAttributeBuffer: getAttributeBuffer, - getAttributeProperties: getAttributeProperties, - getWireframeAttribute: getWireframeAttribute, - - update: update - - }; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLTextures( _gl, extensions, state, properties, capabilities, paramThreeToGL, info ) { - - var _infoMemory = info.memory; - var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof WebGL2RenderingContext ); - - // - - function clampToMaxSize( image, maxSize ) { - - if ( image.width > maxSize || image.height > maxSize ) { - - // Warning: Scaling through the canvas will only work with images that use - // premultiplied alpha. - - var scale = maxSize / Math.max( image.width, image.height ); - - var canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.width = Math.floor( image.width * scale ); - canvas.height = Math.floor( image.height * scale ); - - var context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height ); - - console.warn( 'THREE.WebGLRenderer: image is too big (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image ); - - return canvas; - - } - - return image; - - } - - function isPowerOfTwo( image ) { - - return _Math.isPowerOfTwo( image.width ) && _Math.isPowerOfTwo( image.height ); - - } - - function makePowerOfTwo( image ) { - - if ( image instanceof HTMLImageElement || image instanceof HTMLCanvasElement ) { - - var canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.width = _Math.nearestPowerOfTwo( image.width ); - canvas.height = _Math.nearestPowerOfTwo( image.height ); - - var context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0, canvas.width, canvas.height ); - - console.warn( 'THREE.WebGLRenderer: image is not power of two (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image ); - - return canvas; - - } - - return image; - - } - - function textureNeedsPowerOfTwo( texture ) { - - if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) return true; - if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) return true; - - return false; - - } - - // Fallback filters for non-power-of-2 textures - - function filterFallback( f ) { - - if ( f === NearestFilter || f === NearestMipMapNearestFilter || f === NearestMipMapLinearFilter ) { - - return _gl.NEAREST; - - } - - return _gl.LINEAR; - - } - - // - - function onTextureDispose( event ) { - - var texture = event.target; - - texture.removeEventListener( 'dispose', onTextureDispose ); - - deallocateTexture( texture ); - - _infoMemory.textures --; - - - } - - function onRenderTargetDispose( event ) { - - var renderTarget = event.target; - - renderTarget.removeEventListener( 'dispose', onRenderTargetDispose ); - - deallocateRenderTarget( renderTarget ); - - _infoMemory.textures --; - - } - - // - - function deallocateTexture( texture ) { - - var textureProperties = properties.get( texture ); - - if ( texture.image && textureProperties.__image__webglTextureCube ) { - - // cube texture - - _gl.deleteTexture( textureProperties.__image__webglTextureCube ); - - } else { - - // 2D texture - - if ( textureProperties.__webglInit === undefined ) return; - - _gl.deleteTexture( textureProperties.__webglTexture ); - - } - - // remove all webgl properties - properties.delete( texture ); - - } - - function deallocateRenderTarget( renderTarget ) { - - var renderTargetProperties = properties.get( renderTarget ); - var textureProperties = properties.get( renderTarget.texture ); - - if ( ! renderTarget ) return; - - if ( textureProperties.__webglTexture !== undefined ) { - - _gl.deleteTexture( textureProperties.__webglTexture ); - - } - - if ( renderTarget.depthTexture ) { - - renderTarget.depthTexture.dispose(); - - } - - if ( renderTarget.isWebGLRenderTargetCube ) { - - for ( var i = 0; i < 6; i ++ ) { - - _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] ); - if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] ); - - } - - } else { - - _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer ); - if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer ); - - } - - properties.delete( renderTarget.texture ); - properties.delete( renderTarget ); - - } - - // - - - - function setTexture2D( texture, slot ) { - - var textureProperties = properties.get( texture ); - - if ( texture.version > 0 && textureProperties.__version !== texture.version ) { - - var image = texture.image; - - if ( image === undefined ) { - - console.warn( 'THREE.WebGLRenderer: Texture marked for update but image is undefined', texture ); - - } else if ( image.complete === false ) { - - console.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete', texture ); - - } else { - - uploadTexture( textureProperties, texture, slot ); - return; - - } - - } - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); - - } - - function setTextureCube( texture, slot ) { - - var textureProperties = properties.get( texture ); - - if ( texture.image.length === 6 ) { - - if ( texture.version > 0 && textureProperties.__version !== texture.version ) { - - if ( ! textureProperties.__image__webglTextureCube ) { - - texture.addEventListener( 'dispose', onTextureDispose ); - - textureProperties.__image__webglTextureCube = _gl.createTexture(); - - _infoMemory.textures ++; - - } - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__image__webglTextureCube ); - - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - - var isCompressed = (texture && texture.isCompressedTexture); - var isDataTexture = (texture.image[ 0 ] && texture.image[ 0 ].isDataTexture); - - var cubeImage = []; - - for ( var i = 0; i < 6; i ++ ) { - - if ( ! isCompressed && ! isDataTexture ) { - - cubeImage[ i ] = clampToMaxSize( texture.image[ i ], capabilities.maxCubemapSize ); - - } else { - - cubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ]; - - } - - } - - var image = cubeImage[ 0 ], - isPowerOfTwoImage = isPowerOfTwo( image ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); - - setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, isPowerOfTwoImage ); - - for ( var i = 0; i < 6; i ++ ) { - - if ( ! isCompressed ) { - - if ( isDataTexture ) { - - state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data ); - - } else { - - state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] ); - - } - - } else { - - var mipmap, mipmaps = cubeImage[ i ].mipmaps; - - for ( var j = 0, jl = mipmaps.length; j < jl; j ++ ) { - - mipmap = mipmaps[ j ]; - - if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) { - - if ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) { - - state.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - - console.warn( "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()" ); - - } - - } else { - - state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - } - - } - - } - - if ( texture.generateMipmaps && isPowerOfTwoImage ) { - - _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - - } - - textureProperties.__version = texture.version; - - if ( texture.onUpdate ) texture.onUpdate( texture ); - - } else { - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__image__webglTextureCube ); - - } - - } - - } - - function setTextureCubeDynamic( texture, slot ) { - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_CUBE_MAP, properties.get( texture ).__webglTexture ); - - } - - function setTextureParameters( textureType, texture, isPowerOfTwoImage ) { - - var extension; - - if ( isPowerOfTwoImage ) { - - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) ); - - _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) ); - - } else { - - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); - - if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) { - - console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.', texture ); - - } - - _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) ); - - if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) { - - console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.', texture ); - - } - - } - - extension = extensions.get( 'EXT_texture_filter_anisotropic' ); - - if ( extension ) { - - if ( texture.type === FloatType && extensions.get( 'OES_texture_float_linear' ) === null ) return; - if ( texture.type === HalfFloatType && extensions.get( 'OES_texture_half_float_linear' ) === null ) return; - - if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) { - - _gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) ); - properties.get( texture ).__currentAnisotropy = texture.anisotropy; - - } - - } - - } - - function uploadTexture( textureProperties, texture, slot ) { - - if ( textureProperties.__webglInit === undefined ) { - - textureProperties.__webglInit = true; - - texture.addEventListener( 'dispose', onTextureDispose ); - - textureProperties.__webglTexture = _gl.createTexture(); - - _infoMemory.textures ++; - - } - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); - - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); - _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment ); - - var image = clampToMaxSize( texture.image, capabilities.maxTextureSize ); - - if ( textureNeedsPowerOfTwo( texture ) && isPowerOfTwo( image ) === false ) { - - image = makePowerOfTwo( image ); - - } - - var isPowerOfTwoImage = isPowerOfTwo( image ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); - - setTextureParameters( _gl.TEXTURE_2D, texture, isPowerOfTwoImage ); - - var mipmap, mipmaps = texture.mipmaps; - - if ( texture.isDepthTexture ) { - - // populate depth texture with dummy data - - var internalFormat = _gl.DEPTH_COMPONENT; - - if ( texture.type === FloatType ) { - - if ( !_isWebGL2 ) throw new Error('Float Depth Texture only supported in WebGL2.0'); - internalFormat = _gl.DEPTH_COMPONENT32F; - - } else if ( _isWebGL2 ) { - - // WebGL 2.0 requires signed internalformat for glTexImage2D - internalFormat = _gl.DEPTH_COMPONENT16; - - } - - if ( texture.format === DepthFormat && internalFormat === _gl.DEPTH_COMPONENT ) { - - // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are - // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT - // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) { - - console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' ); - - texture.type = UnsignedShortType; - glType = paramThreeToGL( texture.type ); - - } - - } - - // Depth stencil textures need the DEPTH_STENCIL internal format - // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - if ( texture.format === DepthStencilFormat ) { - - internalFormat = _gl.DEPTH_STENCIL; - - // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are - // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL. - // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - if ( texture.type !== UnsignedInt248Type ) { - - console.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' ); - - texture.type = UnsignedInt248Type; - glType = paramThreeToGL( texture.type ); - - } - - } - - state.texImage2D( _gl.TEXTURE_2D, 0, internalFormat, image.width, image.height, 0, glFormat, glType, null ); - - } else if ( texture.isDataTexture ) { - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isPowerOfTwoImage ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - state.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - texture.generateMipmaps = false; - - } else { - - state.texImage2D( _gl.TEXTURE_2D, 0, glFormat, image.width, image.height, 0, glFormat, glType, image.data ); - - } - - } else if ( texture.isCompressedTexture ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - - if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) { - - if ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) { - - state.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - - console.warn( "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()" ); - - } - - } else { - - state.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - } - - } else { - - // regular Texture (image, video, canvas) - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isPowerOfTwoImage ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - state.texImage2D( _gl.TEXTURE_2D, i, glFormat, glFormat, glType, mipmap ); - - } - - texture.generateMipmaps = false; - - } else { - - state.texImage2D( _gl.TEXTURE_2D, 0, glFormat, glFormat, glType, image ); - - } - - } - - if ( texture.generateMipmaps && isPowerOfTwoImage ) _gl.generateMipmap( _gl.TEXTURE_2D ); - - textureProperties.__version = texture.version; - - if ( texture.onUpdate ) texture.onUpdate( texture ); - - } - - // Render targets - - // Setup storage for target texture and bind it to correct framebuffer - function setupFrameBufferTexture( framebuffer, renderTarget, attachment, textureTarget ) { - - var glFormat = paramThreeToGL( renderTarget.texture.format ); - var glType = paramThreeToGL( renderTarget.texture.type ); - state.texImage2D( textureTarget, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null ); - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( renderTarget.texture ).__webglTexture, 0 ); - _gl.bindFramebuffer( _gl.FRAMEBUFFER, null ); - - } - - // Setup storage for internal depth/stencil buffers and bind to correct framebuffer - function setupRenderBufferStorage( renderbuffer, renderTarget ) { - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer ); - - if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_COMPONENT16, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - - } else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - - } else { - - // FIXME: We don't support !depth !stencil - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.RGBA4, renderTarget.width, renderTarget.height ); - - } - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, null ); - - } - - // Setup resources for a Depth Texture for a FBO (needs an extension) - function setupDepthTexture( framebuffer, renderTarget ) { - - var isCube = ( renderTarget && renderTarget.isWebGLRenderTargetCube ); - if ( isCube ) throw new Error('Depth Texture with cube render targets is not supported!'); - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - - if ( !( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) { - - throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture'); - - } - - // upload an empty depth texture with framebuffer size - if ( !properties.get( renderTarget.depthTexture ).__webglTexture || - renderTarget.depthTexture.image.width !== renderTarget.width || - renderTarget.depthTexture.image.height !== renderTarget.height ) { - renderTarget.depthTexture.image.width = renderTarget.width; - renderTarget.depthTexture.image.height = renderTarget.height; - renderTarget.depthTexture.needsUpdate = true; - } - - setTexture2D( renderTarget.depthTexture, 0 ); - - var webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture; - - if ( renderTarget.depthTexture.format === DepthFormat ) { - - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 ); - - } else if ( renderTarget.depthTexture.format === DepthStencilFormat ) { - - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 ); - - } else { - - throw new Error('Unknown depthTexture format') - - } - - } - - // Setup GL resources for a non-texture depth buffer - function setupDepthRenderbuffer( renderTarget ) { - - var renderTargetProperties = properties.get( renderTarget ); - - var isCube = ( renderTarget.isWebGLRenderTargetCube === true ); - - if ( renderTarget.depthTexture ) { - - if ( isCube ) throw new Error('target.depthTexture not supported in Cube render targets'); - - setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget ); - - } else { - - if ( isCube ) { - - renderTargetProperties.__webglDepthbuffer = []; - - for ( var i = 0; i < 6; i ++ ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] ); - renderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer(); - setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget ); - - } - - } else { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer ); - renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget ); - - } - - } - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, null ); - - } - - // Set up GL resources for the render target - function setupRenderTarget( renderTarget ) { - - var renderTargetProperties = properties.get( renderTarget ); - var textureProperties = properties.get( renderTarget.texture ); - - renderTarget.addEventListener( 'dispose', onRenderTargetDispose ); - - textureProperties.__webglTexture = _gl.createTexture(); - - _infoMemory.textures ++; - - var isCube = ( renderTarget.isWebGLRenderTargetCube === true ); - var isTargetPowerOfTwo = isPowerOfTwo( renderTarget ); - - // Setup framebuffer - - if ( isCube ) { - - renderTargetProperties.__webglFramebuffer = []; - - for ( var i = 0; i < 6; i ++ ) { - - renderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer(); - - } - - } else { - - renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer(); - - } - - // Setup color buffer - - if ( isCube ) { - - state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture ); - setTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget.texture, isTargetPowerOfTwo ); - - for ( var i = 0; i < 6; i ++ ) { - - setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i ); - - } - - if ( renderTarget.texture.generateMipmaps && isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - state.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); - - } else { - - state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); - setTextureParameters( _gl.TEXTURE_2D, renderTarget.texture, isTargetPowerOfTwo ); - setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D ); - - if ( renderTarget.texture.generateMipmaps && isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D ); - state.bindTexture( _gl.TEXTURE_2D, null ); - - } - - // Setup depth and stencil buffers - - if ( renderTarget.depthBuffer ) { - - setupDepthRenderbuffer( renderTarget ); - - } - - } - - function updateRenderTargetMipmap( renderTarget ) { - - var texture = renderTarget.texture; - - if ( texture.generateMipmaps && isPowerOfTwo( renderTarget ) && - texture.minFilter !== NearestFilter && - texture.minFilter !== LinearFilter ) { - - var target = (renderTarget && renderTarget.isWebGLRenderTargetCube) ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D; - var webglTexture = properties.get( texture ).__webglTexture; - - state.bindTexture( target, webglTexture ); - _gl.generateMipmap( target ); - state.bindTexture( target, null ); - - } - - } - - this.setTexture2D = setTexture2D; - this.setTextureCube = setTextureCube; - this.setTextureCubeDynamic = setTextureCubeDynamic; - this.setupRenderTarget = setupRenderTarget; - this.updateRenderTargetMipmap = updateRenderTargetMipmap; - -} - -/** - * @author fordacious / fordacious.github.io - */ - -function WebGLProperties() { - - var properties = {}; - - return { - - get: function ( object ) { - - var uuid = object.uuid; - var map = properties[ uuid ]; - - if ( map === undefined ) { - - map = {}; - properties[ uuid ] = map; - - } - - return map; - - }, - - delete: function ( object ) { - - delete properties[ object.uuid ]; - - }, - - clear: function () { - - properties = {}; - - } - - }; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLState( gl, extensions, paramThreeToGL ) { - - function ColorBuffer() { - - var locked = false; - - var color = new Vector4(); - var currentColorMask = null; - var currentColorClear = new Vector4(); - - return { - - setMask: function ( colorMask ) { - - if ( currentColorMask !== colorMask && ! locked ) { - - gl.colorMask( colorMask, colorMask, colorMask, colorMask ); - currentColorMask = colorMask; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( r, g, b, a, premultipliedAlpha ) { - - if ( premultipliedAlpha === true ) { - - r *= a; g *= a; b *= a; - - } - - color.set( r, g, b, a ); - - if ( currentColorClear.equals( color ) === false ) { - - gl.clearColor( r, g, b, a ); - currentColorClear.copy( color ); - - } - - }, - - reset: function () { - - locked = false; - - currentColorMask = null; - currentColorClear.set( 0, 0, 0, 1 ); - - } - - }; - - } - - function DepthBuffer() { - - var locked = false; - - var currentDepthMask = null; - var currentDepthFunc = null; - var currentDepthClear = null; - - return { - - setTest: function ( depthTest ) { - - if ( depthTest ) { - - enable( gl.DEPTH_TEST ); - - } else { - - disable( gl.DEPTH_TEST ); - - } - - }, - - setMask: function ( depthMask ) { - - if ( currentDepthMask !== depthMask && ! locked ) { - - gl.depthMask( depthMask ); - currentDepthMask = depthMask; - - } - - }, - - setFunc: function ( depthFunc ) { - - if ( currentDepthFunc !== depthFunc ) { - - if ( depthFunc ) { - - switch ( depthFunc ) { - - case NeverDepth: - - gl.depthFunc( gl.NEVER ); - break; - - case AlwaysDepth: - - gl.depthFunc( gl.ALWAYS ); - break; - - case LessDepth: - - gl.depthFunc( gl.LESS ); - break; - - case LessEqualDepth: - - gl.depthFunc( gl.LEQUAL ); - break; - - case EqualDepth: - - gl.depthFunc( gl.EQUAL ); - break; - - case GreaterEqualDepth: - - gl.depthFunc( gl.GEQUAL ); - break; - - case GreaterDepth: - - gl.depthFunc( gl.GREATER ); - break; - - case NotEqualDepth: - - gl.depthFunc( gl.NOTEQUAL ); - break; - - default: - - gl.depthFunc( gl.LEQUAL ); - - } - - } else { - - gl.depthFunc( gl.LEQUAL ); - - } - - currentDepthFunc = depthFunc; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( depth ) { - - if ( currentDepthClear !== depth ) { - - gl.clearDepth( depth ); - currentDepthClear = depth; - - } - - }, - - reset: function () { - - locked = false; - - currentDepthMask = null; - currentDepthFunc = null; - currentDepthClear = null; - - } - - }; - - } - - function StencilBuffer() { - - var locked = false; - - var currentStencilMask = null; - var currentStencilFunc = null; - var currentStencilRef = null; - var currentStencilFuncMask = null; - var currentStencilFail = null; - var currentStencilZFail = null; - var currentStencilZPass = null; - var currentStencilClear = null; - - return { - - setTest: function ( stencilTest ) { - - if ( stencilTest ) { - - enable( gl.STENCIL_TEST ); - - } else { - - disable( gl.STENCIL_TEST ); - - } - - }, - - setMask: function ( stencilMask ) { - - if ( currentStencilMask !== stencilMask && ! locked ) { - - gl.stencilMask( stencilMask ); - currentStencilMask = stencilMask; - - } - - }, - - setFunc: function ( stencilFunc, stencilRef, stencilMask ) { - - if ( currentStencilFunc !== stencilFunc || - currentStencilRef !== stencilRef || - currentStencilFuncMask !== stencilMask ) { - - gl.stencilFunc( stencilFunc, stencilRef, stencilMask ); - - currentStencilFunc = stencilFunc; - currentStencilRef = stencilRef; - currentStencilFuncMask = stencilMask; - - } - - }, - - setOp: function ( stencilFail, stencilZFail, stencilZPass ) { - - if ( currentStencilFail !== stencilFail || - currentStencilZFail !== stencilZFail || - currentStencilZPass !== stencilZPass ) { - - gl.stencilOp( stencilFail, stencilZFail, stencilZPass ); - - currentStencilFail = stencilFail; - currentStencilZFail = stencilZFail; - currentStencilZPass = stencilZPass; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( stencil ) { - - if ( currentStencilClear !== stencil ) { - - gl.clearStencil( stencil ); - currentStencilClear = stencil; - - } - - }, - - reset: function () { - - locked = false; - - currentStencilMask = null; - currentStencilFunc = null; - currentStencilRef = null; - currentStencilFuncMask = null; - currentStencilFail = null; - currentStencilZFail = null; - currentStencilZPass = null; - currentStencilClear = null; - - } - - }; - - } - - // - - var colorBuffer = new ColorBuffer(); - var depthBuffer = new DepthBuffer(); - var stencilBuffer = new StencilBuffer(); - - var maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS ); - var newAttributes = new Uint8Array( maxVertexAttributes ); - var enabledAttributes = new Uint8Array( maxVertexAttributes ); - var attributeDivisors = new Uint8Array( maxVertexAttributes ); - - var capabilities = {}; - - var compressedTextureFormats = null; - - var currentBlending = null; - var currentBlendEquation = null; - var currentBlendSrc = null; - var currentBlendDst = null; - var currentBlendEquationAlpha = null; - var currentBlendSrcAlpha = null; - var currentBlendDstAlpha = null; - var currentPremultipledAlpha = false; - - var currentFlipSided = null; - var currentCullFace = null; - - var currentLineWidth = null; - - var currentPolygonOffsetFactor = null; - var currentPolygonOffsetUnits = null; - - var currentScissorTest = null; - - var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS ); - - var currentTextureSlot = null; - var currentBoundTextures = {}; - - var currentScissor = new Vector4(); - var currentViewport = new Vector4(); - - function createTexture( type, target, count ) { - - var data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4. - var texture = gl.createTexture(); - - gl.bindTexture( type, texture ); - gl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - gl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); - - for ( var i = 0; i < count; i ++ ) { - - gl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data ); - - } - - return texture; - - } - - var emptyTextures = {}; - emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 ); - emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 ); - - // - - function init() { - - colorBuffer.setClear( 0, 0, 0, 1 ); - depthBuffer.setClear( 1 ); - stencilBuffer.setClear( 0 ); - - enable( gl.DEPTH_TEST ); - setDepthFunc( LessEqualDepth ); - - setFlipSided( false ); - setCullFace( CullFaceBack ); - enable( gl.CULL_FACE ); - - enable( gl.BLEND ); - setBlending( NormalBlending ); - - } - - function initAttributes() { - - for ( var i = 0, l = newAttributes.length; i < l; i ++ ) { - - newAttributes[ i ] = 0; - - } - - } - - function enableAttribute( attribute ) { - - newAttributes[ attribute ] = 1; - - if ( enabledAttributes[ attribute ] === 0 ) { - - gl.enableVertexAttribArray( attribute ); - enabledAttributes[ attribute ] = 1; - - } - - if ( attributeDivisors[ attribute ] !== 0 ) { - - var extension = extensions.get( 'ANGLE_instanced_arrays' ); - - extension.vertexAttribDivisorANGLE( attribute, 0 ); - attributeDivisors[ attribute ] = 0; - - } - - } - - function enableAttributeAndDivisor( attribute, meshPerAttribute, extension ) { - - newAttributes[ attribute ] = 1; - - if ( enabledAttributes[ attribute ] === 0 ) { - - gl.enableVertexAttribArray( attribute ); - enabledAttributes[ attribute ] = 1; - - } - - if ( attributeDivisors[ attribute ] !== meshPerAttribute ) { - - extension.vertexAttribDivisorANGLE( attribute, meshPerAttribute ); - attributeDivisors[ attribute ] = meshPerAttribute; - - } - - } - - function disableUnusedAttributes() { - - for ( var i = 0, l = enabledAttributes.length; i !== l; ++ i ) { - - if ( enabledAttributes[ i ] !== newAttributes[ i ] ) { - - gl.disableVertexAttribArray( i ); - enabledAttributes[ i ] = 0; - - } - - } - - } - - function enable( id ) { - - if ( capabilities[ id ] !== true ) { - - gl.enable( id ); - capabilities[ id ] = true; - - } - - } - - function disable( id ) { - - if ( capabilities[ id ] !== false ) { - - gl.disable( id ); - capabilities[ id ] = false; - - } - - } - - function getCompressedTextureFormats() { - - if ( compressedTextureFormats === null ) { - - compressedTextureFormats = []; - - if ( extensions.get( 'WEBGL_compressed_texture_pvrtc' ) || - extensions.get( 'WEBGL_compressed_texture_s3tc' ) || - extensions.get( 'WEBGL_compressed_texture_etc1' ) ) { - - var formats = gl.getParameter( gl.COMPRESSED_TEXTURE_FORMATS ); - - for ( var i = 0; i < formats.length; i ++ ) { - - compressedTextureFormats.push( formats[ i ] ); - - } - - } - - } - - return compressedTextureFormats; - - } - - function setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) { - - if ( blending !== NoBlending ) { - - enable( gl.BLEND ); - - } else { - - disable( gl.BLEND ); - - } - - if ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) { - - if ( blending === AdditiveBlending ) { - - if ( premultipliedAlpha ) { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.ONE, gl.ONE, gl.ONE, gl.ONE ); - - } else { - - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.SRC_ALPHA, gl.ONE ); - - } - - } else if ( blending === SubtractiveBlending ) { - - if ( premultipliedAlpha ) { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.ZERO, gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_SRC_ALPHA ); - - } else { - - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.ZERO, gl.ONE_MINUS_SRC_COLOR ); - - } - - } else if ( blending === MultiplyBlending ) { - - if ( premultipliedAlpha ) { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA ); - - } else { - - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.ZERO, gl.SRC_COLOR ); - - } - - } else { - - if ( premultipliedAlpha ) { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA ); - - } else { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA ); - - } - - } - - currentBlending = blending; - currentPremultipledAlpha = premultipliedAlpha; - - } - - if ( blending === CustomBlending ) { - - blendEquationAlpha = blendEquationAlpha || blendEquation; - blendSrcAlpha = blendSrcAlpha || blendSrc; - blendDstAlpha = blendDstAlpha || blendDst; - - if ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) { - - gl.blendEquationSeparate( paramThreeToGL( blendEquation ), paramThreeToGL( blendEquationAlpha ) ); - - currentBlendEquation = blendEquation; - currentBlendEquationAlpha = blendEquationAlpha; - - } - - if ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) { - - gl.blendFuncSeparate( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ), paramThreeToGL( blendSrcAlpha ), paramThreeToGL( blendDstAlpha ) ); - - currentBlendSrc = blendSrc; - currentBlendDst = blendDst; - currentBlendSrcAlpha = blendSrcAlpha; - currentBlendDstAlpha = blendDstAlpha; - - } - - } else { - - currentBlendEquation = null; - currentBlendSrc = null; - currentBlendDst = null; - currentBlendEquationAlpha = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - - } - - } - - // TODO Deprecate - - function setColorWrite( colorWrite ) { - - colorBuffer.setMask( colorWrite ); - - } - - function setDepthTest( depthTest ) { - - depthBuffer.setTest( depthTest ); - - } - - function setDepthWrite( depthWrite ) { - - depthBuffer.setMask( depthWrite ); - - } - - function setDepthFunc( depthFunc ) { - - depthBuffer.setFunc( depthFunc ); - - } - - function setStencilTest( stencilTest ) { - - stencilBuffer.setTest( stencilTest ); - - } - - function setStencilWrite( stencilWrite ) { - - stencilBuffer.setMask( stencilWrite ); - - } - - function setStencilFunc( stencilFunc, stencilRef, stencilMask ) { - - stencilBuffer.setFunc( stencilFunc, stencilRef, stencilMask ); - - } - - function setStencilOp( stencilFail, stencilZFail, stencilZPass ) { - - stencilBuffer.setOp( stencilFail, stencilZFail, stencilZPass ); - - } - - // - - function setFlipSided( flipSided ) { - - if ( currentFlipSided !== flipSided ) { - - if ( flipSided ) { - - gl.frontFace( gl.CW ); - - } else { - - gl.frontFace( gl.CCW ); - - } - - currentFlipSided = flipSided; - - } - - } - - function setCullFace( cullFace ) { - - if ( cullFace !== CullFaceNone ) { - - enable( gl.CULL_FACE ); - - if ( cullFace !== currentCullFace ) { - - if ( cullFace === CullFaceBack ) { - - gl.cullFace( gl.BACK ); - - } else if ( cullFace === CullFaceFront ) { - - gl.cullFace( gl.FRONT ); - - } else { - - gl.cullFace( gl.FRONT_AND_BACK ); - - } - - } - - } else { - - disable( gl.CULL_FACE ); - - } - - currentCullFace = cullFace; - - } - - function setLineWidth( width ) { - - if ( width !== currentLineWidth ) { - - gl.lineWidth( width ); - - currentLineWidth = width; - - } - - } - - function setPolygonOffset( polygonOffset, factor, units ) { - - if ( polygonOffset ) { - - enable( gl.POLYGON_OFFSET_FILL ); - - if ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) { - - gl.polygonOffset( factor, units ); - - currentPolygonOffsetFactor = factor; - currentPolygonOffsetUnits = units; - - } - - } else { - - disable( gl.POLYGON_OFFSET_FILL ); - - } - - } - - function getScissorTest() { - - return currentScissorTest; - - } - - function setScissorTest( scissorTest ) { - - currentScissorTest = scissorTest; - - if ( scissorTest ) { - - enable( gl.SCISSOR_TEST ); - - } else { - - disable( gl.SCISSOR_TEST ); - - } - - } - - // texture - - function activeTexture( webglSlot ) { - - if ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1; - - if ( currentTextureSlot !== webglSlot ) { - - gl.activeTexture( webglSlot ); - currentTextureSlot = webglSlot; - - } - - } - - function bindTexture( webglType, webglTexture ) { - - if ( currentTextureSlot === null ) { - - activeTexture(); - - } - - var boundTexture = currentBoundTextures[ currentTextureSlot ]; - - if ( boundTexture === undefined ) { - - boundTexture = { type: undefined, texture: undefined }; - currentBoundTextures[ currentTextureSlot ] = boundTexture; - - } - - if ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) { - - gl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] ); - - boundTexture.type = webglType; - boundTexture.texture = webglTexture; - - } - - } - - function compressedTexImage2D() { - - try { - - gl.compressedTexImage2D.apply( gl, arguments ); - - } catch ( error ) { - - console.error( error ); - - } - - } - - function texImage2D() { - - try { - - gl.texImage2D.apply( gl, arguments ); - - } catch ( error ) { - - console.error( error ); - - } - - } - - // - - function scissor( scissor ) { - - if ( currentScissor.equals( scissor ) === false ) { - - gl.scissor( scissor.x, scissor.y, scissor.z, scissor.w ); - currentScissor.copy( scissor ); - - } - - } - - function viewport( viewport ) { - - if ( currentViewport.equals( viewport ) === false ) { - - gl.viewport( viewport.x, viewport.y, viewport.z, viewport.w ); - currentViewport.copy( viewport ); - - } - - } - - // - - function reset() { - - for ( var i = 0; i < enabledAttributes.length; i ++ ) { - - if ( enabledAttributes[ i ] === 1 ) { - - gl.disableVertexAttribArray( i ); - enabledAttributes[ i ] = 0; - - } - - } - - capabilities = {}; - - compressedTextureFormats = null; - - currentTextureSlot = null; - currentBoundTextures = {}; - - currentBlending = null; - - currentFlipSided = null; - currentCullFace = null; - - colorBuffer.reset(); - depthBuffer.reset(); - stencilBuffer.reset(); - - } - - return { - - buffers: { - color: colorBuffer, - depth: depthBuffer, - stencil: stencilBuffer - }, - - init: init, - initAttributes: initAttributes, - enableAttribute: enableAttribute, - enableAttributeAndDivisor: enableAttributeAndDivisor, - disableUnusedAttributes: disableUnusedAttributes, - enable: enable, - disable: disable, - getCompressedTextureFormats: getCompressedTextureFormats, - - setBlending: setBlending, - - setColorWrite: setColorWrite, - setDepthTest: setDepthTest, - setDepthWrite: setDepthWrite, - setDepthFunc: setDepthFunc, - setStencilTest: setStencilTest, - setStencilWrite: setStencilWrite, - setStencilFunc: setStencilFunc, - setStencilOp: setStencilOp, - - setFlipSided: setFlipSided, - setCullFace: setCullFace, - - setLineWidth: setLineWidth, - setPolygonOffset: setPolygonOffset, - - getScissorTest: getScissorTest, - setScissorTest: setScissorTest, - - activeTexture: activeTexture, - bindTexture: bindTexture, - compressedTexImage2D: compressedTexImage2D, - texImage2D: texImage2D, - - scissor: scissor, - viewport: viewport, - - reset: reset - - }; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLCapabilities( gl, extensions, parameters ) { - - var maxAnisotropy; - - function getMaxAnisotropy() { - - if ( maxAnisotropy !== undefined ) return maxAnisotropy; - - var extension = extensions.get( 'EXT_texture_filter_anisotropic' ); - - if ( extension !== null ) { - - maxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT ); - - } else { - - maxAnisotropy = 0; - - } - - return maxAnisotropy; - - } - - function getMaxPrecision( precision ) { - - if ( precision === 'highp' ) { - - if ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 && - gl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) { - - return 'highp'; - - } - - precision = 'mediump'; - - } - - if ( precision === 'mediump' ) { - - if ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 && - gl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) { - - return 'mediump'; - - } - - } - - return 'lowp'; - - } - - var precision = parameters.precision !== undefined ? parameters.precision : 'highp'; - var maxPrecision = getMaxPrecision( precision ); - - if ( maxPrecision !== precision ) { - - console.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' ); - precision = maxPrecision; - - } - - var logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true && !! extensions.get( 'EXT_frag_depth' ); - - var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS ); - var maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ); - var maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE ); - var maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE ); - - var maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS ); - var maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS ); - var maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS ); - var maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS ); - - var vertexTextures = maxVertexTextures > 0; - var floatFragmentTextures = !! extensions.get( 'OES_texture_float' ); - var floatVertexTextures = vertexTextures && floatFragmentTextures; - - return { - - getMaxAnisotropy: getMaxAnisotropy, - getMaxPrecision: getMaxPrecision, - - precision: precision, - logarithmicDepthBuffer: logarithmicDepthBuffer, - - maxTextures: maxTextures, - maxVertexTextures: maxVertexTextures, - maxTextureSize: maxTextureSize, - maxCubemapSize: maxCubemapSize, - - maxAttributes: maxAttributes, - maxVertexUniforms: maxVertexUniforms, - maxVaryings: maxVaryings, - maxFragmentUniforms: maxFragmentUniforms, - - vertexTextures: vertexTextures, - floatFragmentTextures: floatFragmentTextures, - floatVertexTextures: floatVertexTextures - - }; - -} - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WebGLExtensions( gl ) { - - var extensions = {}; - - return { - - get: function ( name ) { - - if ( extensions[ name ] !== undefined ) { - - return extensions[ name ]; - - } - - var extension; - - switch ( name ) { - - case 'WEBGL_depth_texture': - extension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' ); - break; - - case 'EXT_texture_filter_anisotropic': - extension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' ); - break; - - case 'WEBGL_compressed_texture_s3tc': - extension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' ); - break; - - case 'WEBGL_compressed_texture_pvrtc': - extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' ); - break; - - case 'WEBGL_compressed_texture_etc1': - extension = gl.getExtension( 'WEBGL_compressed_texture_etc1' ); - break; - - default: - extension = gl.getExtension( name ); - - } - - if ( extension === null ) { - - console.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' ); - - } - - extensions[ name ] = extension; - - return extension; - - } - - }; - -} - -/** - * @author tschw - */ - -function WebGLClipping() { - - var scope = this, - - globalState = null, - numGlobalPlanes = 0, - localClippingEnabled = false, - renderingShadows = false, - - plane = new Plane(), - viewNormalMatrix = new Matrix3(), - - uniform = { value: null, needsUpdate: false }; - - this.uniform = uniform; - this.numPlanes = 0; - this.numIntersection = 0; - - this.init = function( planes, enableLocalClipping, camera ) { - - var enabled = - planes.length !== 0 || - enableLocalClipping || - // enable state of previous frame - the clipping code has to - // run another frame in order to reset the state: - numGlobalPlanes !== 0 || - localClippingEnabled; - - localClippingEnabled = enableLocalClipping; - - globalState = projectPlanes( planes, camera, 0 ); - numGlobalPlanes = planes.length; - - return enabled; - - }; - - this.beginShadows = function() { - - renderingShadows = true; - projectPlanes( null ); - - }; - - this.endShadows = function() { - - renderingShadows = false; - resetGlobalState(); - - }; - - this.setState = function( planes, clipIntersection, clipShadows, camera, cache, fromCache ) { - - if ( ! localClippingEnabled || - planes === null || planes.length === 0 || - renderingShadows && ! clipShadows ) { - // there's no local clipping - - if ( renderingShadows ) { - // there's no global clipping - - projectPlanes( null ); - - } else { - - resetGlobalState(); - } - - } else { - - var nGlobal = renderingShadows ? 0 : numGlobalPlanes, - lGlobal = nGlobal * 4, - - dstArray = cache.clippingState || null; - - uniform.value = dstArray; // ensure unique state - - dstArray = projectPlanes( planes, camera, lGlobal, fromCache ); - - for ( var i = 0; i !== lGlobal; ++ i ) { - - dstArray[ i ] = globalState[ i ]; - - } - - cache.clippingState = dstArray; - this.numIntersection = clipIntersection ? this.numPlanes : 0; - this.numPlanes += nGlobal; - - } - - - }; - - function resetGlobalState() { - - if ( uniform.value !== globalState ) { - - uniform.value = globalState; - uniform.needsUpdate = numGlobalPlanes > 0; - - } - - scope.numPlanes = numGlobalPlanes; - scope.numIntersection = 0; - - } - - function projectPlanes( planes, camera, dstOffset, skipTransform ) { - - var nPlanes = planes !== null ? planes.length : 0, - dstArray = null; - - if ( nPlanes !== 0 ) { - - dstArray = uniform.value; - - if ( skipTransform !== true || dstArray === null ) { - - var flatSize = dstOffset + nPlanes * 4, - viewMatrix = camera.matrixWorldInverse; - - viewNormalMatrix.getNormalMatrix( viewMatrix ); - - if ( dstArray === null || dstArray.length < flatSize ) { - - dstArray = new Float32Array( flatSize ); - - } - - for ( var i = 0, i4 = dstOffset; - i !== nPlanes; ++ i, i4 += 4 ) { - - plane.copy( planes[ i ] ). - applyMatrix4( viewMatrix, viewNormalMatrix ); - - plane.normal.toArray( dstArray, i4 ); - dstArray[ i4 + 3 ] = plane.constant; - - } - - } - - uniform.value = dstArray; - uniform.needsUpdate = true; - - } - - scope.numPlanes = nPlanes; - - return dstArray; - - } - -} - -/** - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author szimek / https://github.com/szimek/ - * @author tschw - */ - -function WebGLRenderer( parameters ) { - - console.log( 'THREE.WebGLRenderer', REVISION ); - - parameters = parameters || {}; - - var _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ), - _context = parameters.context !== undefined ? parameters.context : null, - - _alpha = parameters.alpha !== undefined ? parameters.alpha : false, - _depth = parameters.depth !== undefined ? parameters.depth : true, - _stencil = parameters.stencil !== undefined ? parameters.stencil : true, - _antialias = parameters.antialias !== undefined ? parameters.antialias : false, - _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, - _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false; - - var lights = []; - - var opaqueObjects = []; - var opaqueObjectsLastIndex = - 1; - var transparentObjects = []; - var transparentObjectsLastIndex = - 1; - - var morphInfluences = new Float32Array( 8 ); - - var sprites = []; - var lensFlares = []; - - // public properties - - this.domElement = _canvas; - this.context = null; - - // clearing - - this.autoClear = true; - this.autoClearColor = true; - this.autoClearDepth = true; - this.autoClearStencil = true; - - // scene graph - - this.sortObjects = true; - - // user-defined clipping - - this.clippingPlanes = []; - this.localClippingEnabled = false; - - // physically based shading - - this.gammaFactor = 2.0; // for backwards compatibility - this.gammaInput = false; - this.gammaOutput = false; - - // physical lights - - this.physicallyCorrectLights = false; - - // tone mapping - - this.toneMapping = LinearToneMapping; - this.toneMappingExposure = 1.0; - this.toneMappingWhitePoint = 1.0; - - // morphs - - this.maxMorphTargets = 8; - this.maxMorphNormals = 4; - - // internal properties - - var _this = this, - - // internal state cache - - _currentProgram = null, - _currentRenderTarget = null, - _currentFramebuffer = null, - _currentMaterialId = - 1, - _currentGeometryProgram = '', - _currentCamera = null, - - _currentScissor = new Vector4(), - _currentScissorTest = null, - - _currentViewport = new Vector4(), - - // - - _usedTextureUnits = 0, - - // - - _clearColor = new Color( 0x000000 ), - _clearAlpha = 0, - - _width = _canvas.width, - _height = _canvas.height, - - _pixelRatio = 1, - - _scissor = new Vector4( 0, 0, _width, _height ), - _scissorTest = false, - - _viewport = new Vector4( 0, 0, _width, _height ), - - // frustum - - _frustum = new Frustum(), - - // clipping - - _clipping = new WebGLClipping(), - _clippingEnabled = false, - _localClippingEnabled = false, - - _sphere = new Sphere(), - - // camera matrices cache - - _projScreenMatrix = new Matrix4(), - - _vector3 = new Vector3(), - _matrix4 = new Matrix4(), - _matrix42 = new Matrix4(), - - // light arrays cache - - _lights = { - - hash: '', - - ambient: [ 0, 0, 0 ], - directional: [], - directionalShadowMap: [], - directionalShadowMatrix: [], - spot: [], - spotShadowMap: [], - spotShadowMatrix: [], - rectArea: [], - point: [], - pointShadowMap: [], - pointShadowMatrix: [], - hemi: [], - - shadows: [] - - }, - - // info - - _infoRender = { - - calls: 0, - vertices: 0, - faces: 0, - points: 0 - - }; - - this.info = { - - render: _infoRender, - memory: { - - geometries: 0, - textures: 0 - - }, - programs: null - - }; - - - // initialize - - var _gl; - - try { - - var attributes = { - alpha: _alpha, - depth: _depth, - stencil: _stencil, - antialias: _antialias, - premultipliedAlpha: _premultipliedAlpha, - preserveDrawingBuffer: _preserveDrawingBuffer - }; - - _gl = _context || _canvas.getContext( 'webgl', attributes ) || _canvas.getContext( 'experimental-webgl', attributes ); - - if ( _gl === null ) { - - if ( _canvas.getContext( 'webgl' ) !== null ) { - - throw 'Error creating WebGL context with your selected attributes.'; - - } else { - - throw 'Error creating WebGL context.'; - - } - - } - - // Some experimental-webgl implementations do not have getShaderPrecisionFormat - - if ( _gl.getShaderPrecisionFormat === undefined ) { - - _gl.getShaderPrecisionFormat = function () { - - return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 }; - - }; - - } - - _canvas.addEventListener( 'webglcontextlost', onContextLost, false ); - - } catch ( error ) { - - console.error( 'THREE.WebGLRenderer: ' + error ); - - } - - var extensions = new WebGLExtensions( _gl ); - - extensions.get( 'WEBGL_depth_texture' ); - extensions.get( 'OES_texture_float' ); - extensions.get( 'OES_texture_float_linear' ); - extensions.get( 'OES_texture_half_float' ); - extensions.get( 'OES_texture_half_float_linear' ); - extensions.get( 'OES_standard_derivatives' ); - extensions.get( 'ANGLE_instanced_arrays' ); - - if ( extensions.get( 'OES_element_index_uint' ) ) { - - BufferGeometry.MaxIndex = 4294967296; - - } - - var capabilities = new WebGLCapabilities( _gl, extensions, parameters ); - - var state = new WebGLState( _gl, extensions, paramThreeToGL ); - var properties = new WebGLProperties(); - var textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, paramThreeToGL, this.info ); - var objects = new WebGLObjects( _gl, properties, this.info ); - var programCache = new WebGLPrograms( this, capabilities ); - var lightCache = new WebGLLights(); - - this.info.programs = programCache.programs; - - var bufferRenderer = new WebGLBufferRenderer( _gl, extensions, _infoRender ); - var indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, _infoRender ); - - // - - var backgroundCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); - var backgroundCamera2 = new PerspectiveCamera(); - var backgroundPlaneMesh = new Mesh( - new PlaneBufferGeometry( 2, 2 ), - new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } ) - ); - var backgroundBoxShader = ShaderLib[ 'cube' ]; - var backgroundBoxMesh = new Mesh( - new BoxBufferGeometry( 5, 5, 5 ), - new ShaderMaterial( { - uniforms: backgroundBoxShader.uniforms, - vertexShader: backgroundBoxShader.vertexShader, - fragmentShader: backgroundBoxShader.fragmentShader, - side: BackSide, - depthTest: false, - depthWrite: false, - fog: false - } ) - ); - - // - - function getTargetPixelRatio() { - - return _currentRenderTarget === null ? _pixelRatio : 1; - - } - - function setDefaultGLState() { - - state.init(); - - state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ) ); - state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ) ); - - state.buffers.color.setClear( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha, _premultipliedAlpha ); - - } - - function resetGLState() { - - _currentProgram = null; - _currentCamera = null; - - _currentGeometryProgram = ''; - _currentMaterialId = - 1; - - state.reset(); - - } - - setDefaultGLState(); - - this.context = _gl; - this.capabilities = capabilities; - this.extensions = extensions; - this.properties = properties; - this.state = state; - - // shadow map - - var shadowMap = new WebGLShadowMap( this, _lights, objects, capabilities ); - - this.shadowMap = shadowMap; - - - // Plugins - - var spritePlugin = new SpritePlugin( this, sprites ); - var lensFlarePlugin = new LensFlarePlugin( this, lensFlares ); - - // API - - this.getContext = function () { - - return _gl; - - }; - - this.getContextAttributes = function () { - - return _gl.getContextAttributes(); - - }; - - this.forceContextLoss = function () { - - extensions.get( 'WEBGL_lose_context' ).loseContext(); - - }; - - this.getMaxAnisotropy = function () { - - return capabilities.getMaxAnisotropy(); - - }; - - this.getPrecision = function () { - - return capabilities.precision; - - }; - - this.getPixelRatio = function () { - - return _pixelRatio; - - }; - - this.setPixelRatio = function ( value ) { - - if ( value === undefined ) return; - - _pixelRatio = value; - - this.setSize( _viewport.z, _viewport.w, false ); - - }; - - this.getSize = function () { - - return { - width: _width, - height: _height - }; - - }; - - this.setSize = function ( width, height, updateStyle ) { - - _width = width; - _height = height; - - _canvas.width = width * _pixelRatio; - _canvas.height = height * _pixelRatio; - - if ( updateStyle !== false ) { - - _canvas.style.width = width + 'px'; - _canvas.style.height = height + 'px'; - - } - - this.setViewport( 0, 0, width, height ); - - }; - - this.setViewport = function ( x, y, width, height ) { - - state.viewport( _viewport.set( x, y, width, height ) ); - - }; - - this.setScissor = function ( x, y, width, height ) { - - state.scissor( _scissor.set( x, y, width, height ) ); - - }; - - this.setScissorTest = function ( boolean ) { - - state.setScissorTest( _scissorTest = boolean ); - - }; - - // Clearing - - this.getClearColor = function () { - - return _clearColor; - - }; - - this.setClearColor = function ( color, alpha ) { - - _clearColor.set( color ); - - _clearAlpha = alpha !== undefined ? alpha : 1; - - state.buffers.color.setClear( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha, _premultipliedAlpha ); - - }; - - this.getClearAlpha = function () { - - return _clearAlpha; - - }; - - this.setClearAlpha = function ( alpha ) { - - _clearAlpha = alpha; - - state.buffers.color.setClear( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha, _premultipliedAlpha ); - - }; - - this.clear = function ( color, depth, stencil ) { - - var bits = 0; - - if ( color === undefined || color ) bits |= _gl.COLOR_BUFFER_BIT; - if ( depth === undefined || depth ) bits |= _gl.DEPTH_BUFFER_BIT; - if ( stencil === undefined || stencil ) bits |= _gl.STENCIL_BUFFER_BIT; - - _gl.clear( bits ); - - }; - - this.clearColor = function () { - - this.clear( true, false, false ); - - }; - - this.clearDepth = function () { - - this.clear( false, true, false ); - - }; - - this.clearStencil = function () { - - this.clear( false, false, true ); - - }; - - this.clearTarget = function ( renderTarget, color, depth, stencil ) { - - this.setRenderTarget( renderTarget ); - this.clear( color, depth, stencil ); - - }; - - // Reset - - this.resetGLState = resetGLState; - - this.dispose = function() { - - transparentObjects = []; - transparentObjectsLastIndex = -1; - opaqueObjects = []; - opaqueObjectsLastIndex = -1; - - _canvas.removeEventListener( 'webglcontextlost', onContextLost, false ); - - }; - - // Events - - function onContextLost( event ) { - - event.preventDefault(); - - resetGLState(); - setDefaultGLState(); - - properties.clear(); - - } - - function onMaterialDispose( event ) { - - var material = event.target; - - material.removeEventListener( 'dispose', onMaterialDispose ); - - deallocateMaterial( material ); - - } - - // Buffer deallocation - - function deallocateMaterial( material ) { - - releaseMaterialProgramReference( material ); - - properties.delete( material ); - - } - - - function releaseMaterialProgramReference( material ) { - - var programInfo = properties.get( material ).program; - - material.program = undefined; - - if ( programInfo !== undefined ) { - - programCache.releaseProgram( programInfo ); - - } - - } - - // Buffer rendering - - this.renderBufferImmediate = function ( object, program, material ) { - - state.initAttributes(); - - var buffers = properties.get( object ); - - if ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer(); - if ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer(); - if ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer(); - if ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer(); - - var attributes = program.getAttributes(); - - if ( object.hasPositions ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.position ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( attributes.position ); - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.normal ); - - if ( ! material.isMeshPhongMaterial && - ! material.isMeshStandardMaterial && - material.shading === FlatShading ) { - - for ( var i = 0, l = object.count * 3; i < l; i += 9 ) { - - var array = object.normalArray; - - var nx = ( array[ i + 0 ] + array[ i + 3 ] + array[ i + 6 ] ) / 3; - var ny = ( array[ i + 1 ] + array[ i + 4 ] + array[ i + 7 ] ) / 3; - var nz = ( array[ i + 2 ] + array[ i + 5 ] + array[ i + 8 ] ) / 3; - - array[ i + 0 ] = nx; - array[ i + 1 ] = ny; - array[ i + 2 ] = nz; - - array[ i + 3 ] = nx; - array[ i + 4 ] = ny; - array[ i + 5 ] = nz; - - array[ i + 6 ] = nx; - array[ i + 7 ] = ny; - array[ i + 8 ] = nz; - - } - - } - - _gl.bufferData( _gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( attributes.normal ); - - _gl.vertexAttribPointer( attributes.normal, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasUvs && material.map ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.uv ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( attributes.uv ); - - _gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasColors && material.vertexColors !== NoColors ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.color ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( attributes.color ); - - _gl.vertexAttribPointer( attributes.color, 3, _gl.FLOAT, false, 0, 0 ); - - } - - state.disableUnusedAttributes(); - - _gl.drawArrays( _gl.TRIANGLES, 0, object.count ); - - object.count = 0; - - }; - - this.renderBufferDirect = function ( camera, fog, geometry, material, object, group ) { - - setMaterial( material ); - - var program = setProgram( camera, fog, material, object ); - - var updateBuffers = false; - var geometryProgram = geometry.id + '_' + program.id + '_' + material.wireframe; - - if ( geometryProgram !== _currentGeometryProgram ) { - - _currentGeometryProgram = geometryProgram; - updateBuffers = true; - - } - - // morph targets - - var morphTargetInfluences = object.morphTargetInfluences; - - if ( morphTargetInfluences !== undefined ) { - - var activeInfluences = []; - - for ( var i = 0, l = morphTargetInfluences.length; i < l; i ++ ) { - - var influence = morphTargetInfluences[ i ]; - activeInfluences.push( [ influence, i ] ); - - } - - activeInfluences.sort( absNumericalSort ); - - if ( activeInfluences.length > 8 ) { - - activeInfluences.length = 8; - - } - - var morphAttributes = geometry.morphAttributes; - - for ( var i = 0, l = activeInfluences.length; i < l; i ++ ) { - - var influence = activeInfluences[ i ]; - morphInfluences[ i ] = influence[ 0 ]; - - if ( influence[ 0 ] !== 0 ) { - - var index = influence[ 1 ]; - - if ( material.morphTargets === true && morphAttributes.position ) geometry.addAttribute( 'morphTarget' + i, morphAttributes.position[ index ] ); - if ( material.morphNormals === true && morphAttributes.normal ) geometry.addAttribute( 'morphNormal' + i, morphAttributes.normal[ index ] ); - - } else { - - if ( material.morphTargets === true ) geometry.removeAttribute( 'morphTarget' + i ); - if ( material.morphNormals === true ) geometry.removeAttribute( 'morphNormal' + i ); - - } - - } - - for ( var i = activeInfluences.length, il = morphInfluences.length; i < il; i ++ ) { - - morphInfluences[ i ] = 0.0; - - } - - program.getUniforms().setValue( - _gl, 'morphTargetInfluences', morphInfluences ); - - updateBuffers = true; - - } - - // - - var index = geometry.index; - var position = geometry.attributes.position; - var rangeFactor = 1; - - if ( material.wireframe === true ) { - - index = objects.getWireframeAttribute( geometry ); - rangeFactor = 2; - - } - - var renderer; - - if ( index !== null ) { - - renderer = indexedBufferRenderer; - renderer.setIndex( index ); - - } else { - - renderer = bufferRenderer; - - } - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry ); - - if ( index !== null ) { - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, objects.getAttributeBuffer( index ) ); - - } - - } - - // - - var dataCount = 0; - - if ( index !== null ) { - - dataCount = index.count; - - } else if ( position !== undefined ) { - - dataCount = position.count; - - } - - var rangeStart = geometry.drawRange.start * rangeFactor; - var rangeCount = geometry.drawRange.count * rangeFactor; - - var groupStart = group !== null ? group.start * rangeFactor : 0; - var groupCount = group !== null ? group.count * rangeFactor : Infinity; - - var drawStart = Math.max( rangeStart, groupStart ); - var drawEnd = Math.min( dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1; - - var drawCount = Math.max( 0, drawEnd - drawStart + 1 ); - - if ( drawCount === 0 ) return; - - // - - if ( object.isMesh ) { - - if ( material.wireframe === true ) { - - state.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() ); - renderer.setMode( _gl.LINES ); - - } else { - - switch ( object.drawMode ) { - - case TrianglesDrawMode: - renderer.setMode( _gl.TRIANGLES ); - break; - - case TriangleStripDrawMode: - renderer.setMode( _gl.TRIANGLE_STRIP ); - break; - - case TriangleFanDrawMode: - renderer.setMode( _gl.TRIANGLE_FAN ); - break; - - } - - } - - - } else if ( object.isLine ) { - - var lineWidth = material.linewidth; - - if ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material - - state.setLineWidth( lineWidth * getTargetPixelRatio() ); - - if ( object.isLineSegments ) { - - renderer.setMode( _gl.LINES ); - - } else { - - renderer.setMode( _gl.LINE_STRIP ); - - } - - } else if ( object.isPoints ) { - - renderer.setMode( _gl.POINTS ); - - } - - if ( geometry && geometry.isInstancedBufferGeometry ) { - - if ( geometry.maxInstancedCount > 0 ) { - - renderer.renderInstances( geometry, drawStart, drawCount ); - - } - - } else { - - renderer.render( drawStart, drawCount ); - - } - - }; - - function setupVertexAttributes( material, program, geometry, startIndex ) { - - var extension; - - if ( geometry && geometry.isInstancedBufferGeometry ) { - - extension = extensions.get( 'ANGLE_instanced_arrays' ); - - if ( extension === null ) { - - console.error( 'THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' ); - return; - - } - - } - - if ( startIndex === undefined ) startIndex = 0; - - state.initAttributes(); - - var geometryAttributes = geometry.attributes; - - var programAttributes = program.getAttributes(); - - var materialDefaultAttributeValues = material.defaultAttributeValues; - - for ( var name in programAttributes ) { - - var programAttribute = programAttributes[ name ]; - - if ( programAttribute >= 0 ) { - - var geometryAttribute = geometryAttributes[ name ]; - - if ( geometryAttribute !== undefined ) { - - var normalized = geometryAttribute.normalized; - var size = geometryAttribute.itemSize; - - var attributeProperties = objects.getAttributeProperties( geometryAttribute ); - - var buffer = attributeProperties.__webglBuffer; - var type = attributeProperties.type; - var bytesPerElement = attributeProperties.bytesPerElement; - - if ( geometryAttribute.isInterleavedBufferAttribute ) { - - var data = geometryAttribute.data; - var stride = data.stride; - var offset = geometryAttribute.offset; - - if ( data && data.isInstancedInterleavedBuffer ) { - - state.enableAttributeAndDivisor( programAttribute, data.meshPerAttribute, extension ); - - if ( geometry.maxInstancedCount === undefined ) { - - geometry.maxInstancedCount = data.meshPerAttribute * data.count; - - } - - } else { - - state.enableAttribute( programAttribute ); - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffer ); - _gl.vertexAttribPointer( programAttribute, size, type, normalized, stride * bytesPerElement, ( startIndex * stride + offset ) * bytesPerElement ); - - } else { - - if ( geometryAttribute.isInstancedBufferAttribute ) { - - state.enableAttributeAndDivisor( programAttribute, geometryAttribute.meshPerAttribute, extension ); - - if ( geometry.maxInstancedCount === undefined ) { - - geometry.maxInstancedCount = geometryAttribute.meshPerAttribute * geometryAttribute.count; - - } - - } else { - - state.enableAttribute( programAttribute ); - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffer ); - _gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * bytesPerElement ); - - } - - } else if ( materialDefaultAttributeValues !== undefined ) { - - var value = materialDefaultAttributeValues[ name ]; - - if ( value !== undefined ) { - - switch ( value.length ) { - - case 2: - _gl.vertexAttrib2fv( programAttribute, value ); - break; - - case 3: - _gl.vertexAttrib3fv( programAttribute, value ); - break; - - case 4: - _gl.vertexAttrib4fv( programAttribute, value ); - break; - - default: - _gl.vertexAttrib1fv( programAttribute, value ); - - } - - } - - } - - } - - } - - state.disableUnusedAttributes(); - - } - - // Sorting - - function absNumericalSort( a, b ) { - - return Math.abs( b[ 0 ] ) - Math.abs( a[ 0 ] ); - - } - - function painterSortStable( a, b ) { - - if ( a.object.renderOrder !== b.object.renderOrder ) { - - return a.object.renderOrder - b.object.renderOrder; - - } else if ( a.material.program && b.material.program && a.material.program !== b.material.program ) { - - return a.material.program.id - b.material.program.id; - - } else if ( a.material.id !== b.material.id ) { - - return a.material.id - b.material.id; - - } else if ( a.z !== b.z ) { - - return a.z - b.z; - - } else { - - return a.id - b.id; - - } - - } - - function reversePainterSortStable( a, b ) { - - if ( a.object.renderOrder !== b.object.renderOrder ) { - - return a.object.renderOrder - b.object.renderOrder; - - } if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return a.id - b.id; - - } - - } - - // Rendering - - this.render = function ( scene, camera, renderTarget, forceClear ) { - - if ( camera !== undefined && camera.isCamera !== true ) { - - console.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' ); - return; - - } - - // reset caching for this frame - - _currentGeometryProgram = ''; - _currentMaterialId = - 1; - _currentCamera = null; - - // update scene graph - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - - // update camera matrices and frustum - - if ( camera.parent === null ) camera.updateMatrixWorld(); - - camera.matrixWorldInverse.getInverse( camera.matrixWorld ); - - _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - lights.length = 0; - - opaqueObjectsLastIndex = - 1; - transparentObjectsLastIndex = - 1; - - sprites.length = 0; - lensFlares.length = 0; - - _localClippingEnabled = this.localClippingEnabled; - _clippingEnabled = _clipping.init( this.clippingPlanes, _localClippingEnabled, camera ); - - projectObject( scene, camera ); - - opaqueObjects.length = opaqueObjectsLastIndex + 1; - transparentObjects.length = transparentObjectsLastIndex + 1; - - if ( _this.sortObjects === true ) { - - opaqueObjects.sort( painterSortStable ); - transparentObjects.sort( reversePainterSortStable ); - - } - - // - - if ( _clippingEnabled ) _clipping.beginShadows(); - - setupShadows( lights ); - - shadowMap.render( scene, camera ); - - setupLights( lights, camera ); - - if ( _clippingEnabled ) _clipping.endShadows(); - - // - - _infoRender.calls = 0; - _infoRender.vertices = 0; - _infoRender.faces = 0; - _infoRender.points = 0; - - if ( renderTarget === undefined ) { - - renderTarget = null; - - } - - this.setRenderTarget( renderTarget ); - - // - - var background = scene.background; - - if ( background === null ) { - - state.buffers.color.setClear( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha, _premultipliedAlpha ); - - } else if ( background && background.isColor ) { - - state.buffers.color.setClear( background.r, background.g, background.b, 1, _premultipliedAlpha ); - forceClear = true; - - } - - if ( this.autoClear || forceClear ) { - - this.clear( this.autoClearColor, this.autoClearDepth, this.autoClearStencil ); - - } - - if ( background && background.isCubeTexture ) { - - backgroundCamera2.projectionMatrix.copy( camera.projectionMatrix ); - - backgroundCamera2.matrixWorld.extractRotation( camera.matrixWorld ); - backgroundCamera2.matrixWorldInverse.getInverse( backgroundCamera2.matrixWorld ); - - backgroundBoxMesh.material.uniforms[ "tCube" ].value = background; - backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundCamera2.matrixWorldInverse, backgroundBoxMesh.matrixWorld ); - - objects.update( backgroundBoxMesh ); - - _this.renderBufferDirect( backgroundCamera2, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null ); - - } else if ( background && background.isTexture ) { - - backgroundPlaneMesh.material.map = background; - - objects.update( backgroundPlaneMesh ); - - _this.renderBufferDirect( backgroundCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null ); - - } - - // - - if ( scene.overrideMaterial ) { - - var overrideMaterial = scene.overrideMaterial; - - renderObjects( opaqueObjects, scene, camera, overrideMaterial ); - renderObjects( transparentObjects, scene, camera, overrideMaterial ); - - } else { - - // opaque pass (front-to-back order) - - state.setBlending( NoBlending ); - renderObjects( opaqueObjects, scene, camera ); - - // transparent pass (back-to-front order) - - renderObjects( transparentObjects, scene, camera ); - - } - - // custom render plugins (post pass) - - spritePlugin.render( scene, camera ); - lensFlarePlugin.render( scene, camera, _currentViewport ); - - // Generate mipmap if we're using any kind of mipmap filtering - - if ( renderTarget ) { - - textures.updateRenderTargetMipmap( renderTarget ); - - } - - // Ensure depth buffer writing is enabled so it can be cleared on next render - - state.setDepthTest( true ); - state.setDepthWrite( true ); - state.setColorWrite( true ); - - // _gl.finish(); - - }; - - function pushRenderItem( object, geometry, material, z, group ) { - - var array, index; - - // allocate the next position in the appropriate array - - if ( material.transparent ) { - - array = transparentObjects; - index = ++ transparentObjectsLastIndex; - - } else { - - array = opaqueObjects; - index = ++ opaqueObjectsLastIndex; - - } - - // recycle existing render item or grow the array - - var renderItem = array[ index ]; - - if ( renderItem !== undefined ) { - - renderItem.id = object.id; - renderItem.object = object; - renderItem.geometry = geometry; - renderItem.material = material; - renderItem.z = _vector3.z; - renderItem.group = group; - - } else { - - renderItem = { - id: object.id, - object: object, - geometry: geometry, - material: material, - z: _vector3.z, - group: group - }; - - // assert( index === array.length ); - array.push( renderItem ); - - } - - } - - // TODO Duplicated code (Frustum) - - function isObjectViewable( object ) { - - var geometry = object.geometry; - - if ( geometry.boundingSphere === null ) - geometry.computeBoundingSphere(); - - _sphere.copy( geometry.boundingSphere ). - applyMatrix4( object.matrixWorld ); - - return isSphereViewable( _sphere ); - - } - - function isSpriteViewable( sprite ) { - - _sphere.center.set( 0, 0, 0 ); - _sphere.radius = 0.7071067811865476; - _sphere.applyMatrix4( sprite.matrixWorld ); - - return isSphereViewable( _sphere ); - - } - - function isSphereViewable( sphere ) { - - if ( ! _frustum.intersectsSphere( sphere ) ) return false; - - var numPlanes = _clipping.numPlanes; - - if ( numPlanes === 0 ) return true; - - var planes = _this.clippingPlanes, - - center = sphere.center, - negRad = - sphere.radius, - i = 0; - - do { - - // out when deeper than radius in the negative halfspace - if ( planes[ i ].distanceToPoint( center ) < negRad ) return false; - - } while ( ++ i !== numPlanes ); - - return true; - - } - - function projectObject( object, camera ) { - - if ( object.visible === false ) return; - - var visible = ( object.layers.mask & camera.layers.mask ) !== 0; - - if ( visible ) { - - if ( object.isLight ) { - - lights.push( object ); - - } else if ( object.isSprite ) { - - if ( object.frustumCulled === false || isSpriteViewable( object ) === true ) { - - sprites.push( object ); - - } - - } else if ( object.isLensFlare ) { - - lensFlares.push( object ); - - } else if ( object.isImmediateRenderObject ) { - - if ( _this.sortObjects === true ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyProjection( _projScreenMatrix ); - - } - - pushRenderItem( object, null, object.material, _vector3.z, null ); - - } else if ( object.isMesh || object.isLine || object.isPoints ) { - - if ( object.isSkinnedMesh ) { - - object.skeleton.update(); - - } - - if ( object.frustumCulled === false || isObjectViewable( object ) === true ) { - - var material = object.material; - - if ( material.visible === true ) { - - if ( _this.sortObjects === true ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyProjection( _projScreenMatrix ); - - } - - var geometry = objects.update( object ); - - if ( material.isMultiMaterial ) { - - var groups = geometry.groups; - var materials = material.materials; - - for ( var i = 0, l = groups.length; i < l; i ++ ) { - - var group = groups[ i ]; - var groupMaterial = materials[ group.materialIndex ]; - - if ( groupMaterial.visible === true ) { - - pushRenderItem( object, geometry, groupMaterial, _vector3.z, group ); - - } - - } - - } else { - - pushRenderItem( object, geometry, material, _vector3.z, null ); - - } - - } - - } - - } - - } - - var children = object.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - projectObject( children[ i ], camera ); - - } - - } - - function renderObjects( renderList, scene, camera, overrideMaterial ) { - - for ( var i = 0, l = renderList.length; i < l; i ++ ) { - - var renderItem = renderList[ i ]; - - var object = renderItem.object; - var geometry = renderItem.geometry; - var material = overrideMaterial === undefined ? renderItem.material : overrideMaterial; - var group = renderItem.group; - - object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); - object.normalMatrix.getNormalMatrix( object.modelViewMatrix ); - - object.onBeforeRender( _this, scene, camera, geometry, material, group ); - - if ( object.isImmediateRenderObject ) { - - setMaterial( material ); - - var program = setProgram( camera, scene.fog, material, object ); - - _currentGeometryProgram = ''; - - object.render( function ( object ) { - - _this.renderBufferImmediate( object, program, material ); - - } ); - - } else { - - _this.renderBufferDirect( camera, scene.fog, geometry, material, object, group ); - - } - - object.onAfterRender( _this, scene, camera, geometry, material, group ); - - - } - - } - - function initMaterial( material, fog, object ) { - - var materialProperties = properties.get( material ); - - var parameters = programCache.getParameters( - material, _lights, fog, _clipping.numPlanes, _clipping.numIntersection, object ); - - var code = programCache.getProgramCode( material, parameters ); - - var program = materialProperties.program; - var programChange = true; - - if ( program === undefined ) { - - // new material - material.addEventListener( 'dispose', onMaterialDispose ); - - } else if ( program.code !== code ) { - - // changed glsl or parameters - releaseMaterialProgramReference( material ); - - } else if ( parameters.shaderID !== undefined ) { - - // same glsl and uniform list - return; - - } else { - - // only rebuild uniform list - programChange = false; - - } - - if ( programChange ) { - - if ( parameters.shaderID ) { - - var shader = ShaderLib[ parameters.shaderID ]; - - materialProperties.__webglShader = { - name: material.type, - uniforms: Object.assign( {}, shader.uniforms ), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader - }; - - } else { - - materialProperties.__webglShader = { - name: material.type, - uniforms: material.uniforms, - vertexShader: material.vertexShader, - fragmentShader: material.fragmentShader - }; - - } - - material.__webglShader = materialProperties.__webglShader; - - program = programCache.acquireProgram( material, parameters, code ); - - materialProperties.program = program; - material.program = program; - - } - - var attributes = program.getAttributes(); - - if ( material.morphTargets ) { - - material.numSupportedMorphTargets = 0; - - for ( var i = 0; i < _this.maxMorphTargets; i ++ ) { - - if ( attributes[ 'morphTarget' + i ] >= 0 ) { - - material.numSupportedMorphTargets ++; - - } - - } - - } - - if ( material.morphNormals ) { - - material.numSupportedMorphNormals = 0; - - for ( var i = 0; i < _this.maxMorphNormals; i ++ ) { - - if ( attributes[ 'morphNormal' + i ] >= 0 ) { - - material.numSupportedMorphNormals ++; - - } - - } - - } - - var uniforms = materialProperties.__webglShader.uniforms; - - if ( ! material.isShaderMaterial && - ! material.isRawShaderMaterial || - material.clipping === true ) { - - materialProperties.numClippingPlanes = _clipping.numPlanes; - materialProperties.numIntersection = _clipping.numIntersection; - uniforms.clippingPlanes = _clipping.uniform; - - } - - materialProperties.fog = fog; - - // store the light setup it was created for - - materialProperties.lightsHash = _lights.hash; - - if ( material.lights ) { - - // wire up the material to this renderer's lighting state - - uniforms.ambientLightColor.value = _lights.ambient; - uniforms.directionalLights.value = _lights.directional; - uniforms.spotLights.value = _lights.spot; - uniforms.rectAreaLights.value = _lights.rectArea; - uniforms.pointLights.value = _lights.point; - uniforms.hemisphereLights.value = _lights.hemi; - - uniforms.directionalShadowMap.value = _lights.directionalShadowMap; - uniforms.directionalShadowMatrix.value = _lights.directionalShadowMatrix; - uniforms.spotShadowMap.value = _lights.spotShadowMap; - uniforms.spotShadowMatrix.value = _lights.spotShadowMatrix; - uniforms.pointShadowMap.value = _lights.pointShadowMap; - uniforms.pointShadowMatrix.value = _lights.pointShadowMatrix; - // TODO (abelnation): add area lights shadow info to uniforms - - } - - var progUniforms = materialProperties.program.getUniforms(), - uniformsList = - WebGLUniforms.seqWithValue( progUniforms.seq, uniforms ); - - materialProperties.uniformsList = uniformsList; - - } - - function setMaterial( material ) { - - material.side === DoubleSide - ? state.disable( _gl.CULL_FACE ) - : state.enable( _gl.CULL_FACE ); - - state.setFlipSided( material.side === BackSide ); - - material.transparent === true - ? state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha ) - : state.setBlending( NoBlending ); - - state.setDepthFunc( material.depthFunc ); - state.setDepthTest( material.depthTest ); - state.setDepthWrite( material.depthWrite ); - state.setColorWrite( material.colorWrite ); - state.setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - - } - - function setProgram( camera, fog, material, object ) { - - _usedTextureUnits = 0; - - var materialProperties = properties.get( material ); - - if ( _clippingEnabled ) { - - if ( _localClippingEnabled || camera !== _currentCamera ) { - - var useCache = - camera === _currentCamera && - material.id === _currentMaterialId; - - // we might want to call this function with some ClippingGroup - // object instead of the material, once it becomes feasible - // (#8465, #8379) - _clipping.setState( - material.clippingPlanes, material.clipIntersection, material.clipShadows, - camera, materialProperties, useCache ); - - } - - } - - if ( material.needsUpdate === false ) { - - if ( materialProperties.program === undefined ) { - - material.needsUpdate = true; - - } else if ( material.fog && materialProperties.fog !== fog ) { - - material.needsUpdate = true; - - } else if ( material.lights && materialProperties.lightsHash !== _lights.hash ) { - - material.needsUpdate = true; - - } else if ( materialProperties.numClippingPlanes !== undefined && - ( materialProperties.numClippingPlanes !== _clipping.numPlanes || - materialProperties.numIntersection !== _clipping.numIntersection ) ) { - - material.needsUpdate = true; - - } - - } - - if ( material.needsUpdate ) { - - initMaterial( material, fog, object ); - material.needsUpdate = false; - - } - - var refreshProgram = false; - var refreshMaterial = false; - var refreshLights = false; - - var program = materialProperties.program, - p_uniforms = program.getUniforms(), - m_uniforms = materialProperties.__webglShader.uniforms; - - if ( program.id !== _currentProgram ) { - - _gl.useProgram( program.program ); - _currentProgram = program.id; - - refreshProgram = true; - refreshMaterial = true; - refreshLights = true; - - } - - if ( material.id !== _currentMaterialId ) { - - _currentMaterialId = material.id; - - refreshMaterial = true; - - } - - if ( refreshProgram || camera !== _currentCamera ) { - - p_uniforms.set( _gl, camera, 'projectionMatrix' ); - - if ( capabilities.logarithmicDepthBuffer ) { - - p_uniforms.setValue( _gl, 'logDepthBufFC', - 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) ); - - } - - - if ( camera !== _currentCamera ) { - - _currentCamera = camera; - - // lighting uniforms depend on the camera so enforce an update - // now, in case this material supports lights - or later, when - // the next material that does gets activated: - - refreshMaterial = true; // set to true on material change - refreshLights = true; // remains set until update done - - } - - // load material specific uniforms - // (shader material also gets them for the sake of genericity) - - if ( material.isShaderMaterial || - material.isMeshPhongMaterial || - material.isMeshStandardMaterial || - material.envMap ) { - - var uCamPos = p_uniforms.map.cameraPosition; - - if ( uCamPos !== undefined ) { - - uCamPos.setValue( _gl, - _vector3.setFromMatrixPosition( camera.matrixWorld ) ); - - } - - } - - if ( material.isMeshPhongMaterial || - material.isMeshLambertMaterial || - material.isMeshBasicMaterial || - material.isMeshStandardMaterial || - material.isShaderMaterial || - material.skinning ) { - - p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse ); - - } - - p_uniforms.set( _gl, _this, 'toneMappingExposure' ); - p_uniforms.set( _gl, _this, 'toneMappingWhitePoint' ); - - } - - // skinning uniforms must be set even if material didn't change - // auto-setting of texture unit for bone texture must go before other textures - // not sure why, but otherwise weird things happen - - if ( material.skinning ) { - - p_uniforms.setOptional( _gl, object, 'bindMatrix' ); - p_uniforms.setOptional( _gl, object, 'bindMatrixInverse' ); - - var skeleton = object.skeleton; - - if ( skeleton ) { - - if ( capabilities.floatVertexTextures && skeleton.useVertexTexture ) { - - p_uniforms.set( _gl, skeleton, 'boneTexture' ); - p_uniforms.set( _gl, skeleton, 'boneTextureWidth' ); - p_uniforms.set( _gl, skeleton, 'boneTextureHeight' ); - - } else { - - p_uniforms.setOptional( _gl, skeleton, 'boneMatrices' ); - - } - - } - - } - - if ( refreshMaterial ) { - - if ( material.lights ) { - - // the current material requires lighting info - - // note: all lighting uniforms are always set correctly - // they simply reference the renderer's state for their - // values - // - // use the current material's .needsUpdate flags to set - // the GL state when required - - markUniformsLightsNeedsUpdate( m_uniforms, refreshLights ); - - } - - // refresh uniforms common to several materials - - if ( fog && material.fog ) { - - refreshUniformsFog( m_uniforms, fog ); - - } - - if ( material.isMeshBasicMaterial || - material.isMeshLambertMaterial || - material.isMeshPhongMaterial || - material.isMeshStandardMaterial || - material.isMeshDepthMaterial ) { - - refreshUniformsCommon( m_uniforms, material ); - - } - - // refresh single material specific uniforms - - if ( material.isLineBasicMaterial ) { - - refreshUniformsLine( m_uniforms, material ); - - } else if ( material.isLineDashedMaterial ) { - - refreshUniformsLine( m_uniforms, material ); - refreshUniformsDash( m_uniforms, material ); - - } else if ( material.isPointsMaterial ) { - - refreshUniformsPoints( m_uniforms, material ); - - } else if ( material.isMeshLambertMaterial ) { - - refreshUniformsLambert( m_uniforms, material ); - - } else if ( material.isMeshToonMaterial ) { - - refreshUniformsToon( m_uniforms, material ); - - } else if ( material.isMeshPhongMaterial ) { - - refreshUniformsPhong( m_uniforms, material ); - - } else if ( material.isMeshPhysicalMaterial ) { - - refreshUniformsPhysical( m_uniforms, material ); - - } else if ( material.isMeshStandardMaterial ) { - - refreshUniformsStandard( m_uniforms, material ); - - } else if ( material.isMeshDepthMaterial ) { - - if ( material.displacementMap ) { - - m_uniforms.displacementMap.value = material.displacementMap; - m_uniforms.displacementScale.value = material.displacementScale; - m_uniforms.displacementBias.value = material.displacementBias; - - } - - } else if ( material.isMeshNormalMaterial ) { - - m_uniforms.opacity.value = material.opacity; - - } - - WebGLUniforms.upload( - _gl, materialProperties.uniformsList, m_uniforms, _this ); - - } - - - // common matrices - - p_uniforms.set( _gl, object, 'modelViewMatrix' ); - p_uniforms.set( _gl, object, 'normalMatrix' ); - p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld ); - - return program; - - } - - // Uniforms (refresh uniforms objects) - - function refreshUniformsCommon( uniforms, material ) { - - uniforms.opacity.value = material.opacity; - - uniforms.diffuse.value = material.color; - - if ( material.emissive ) { - - uniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity ); - - } - - uniforms.map.value = material.map; - uniforms.specularMap.value = material.specularMap; - uniforms.alphaMap.value = material.alphaMap; - - if ( material.lightMap ) { - - uniforms.lightMap.value = material.lightMap; - uniforms.lightMapIntensity.value = material.lightMapIntensity; - - } - - if ( material.aoMap ) { - - uniforms.aoMap.value = material.aoMap; - uniforms.aoMapIntensity.value = material.aoMapIntensity; - - } - - // uv repeat and offset setting priorities - // 1. color map - // 2. specular map - // 3. normal map - // 4. bump map - // 5. alpha map - // 6. emissive map - - var uvScaleMap; - - if ( material.map ) { - - uvScaleMap = material.map; - - } else if ( material.specularMap ) { - - uvScaleMap = material.specularMap; - - } else if ( material.displacementMap ) { - - uvScaleMap = material.displacementMap; - - } else if ( material.normalMap ) { - - uvScaleMap = material.normalMap; - - } else if ( material.bumpMap ) { - - uvScaleMap = material.bumpMap; - - } else if ( material.roughnessMap ) { - - uvScaleMap = material.roughnessMap; - - } else if ( material.metalnessMap ) { - - uvScaleMap = material.metalnessMap; - - } else if ( material.alphaMap ) { - - uvScaleMap = material.alphaMap; - - } else if ( material.emissiveMap ) { - - uvScaleMap = material.emissiveMap; - - } - - if ( uvScaleMap !== undefined ) { - - // backwards compatibility - if ( uvScaleMap.isWebGLRenderTarget ) { - - uvScaleMap = uvScaleMap.texture; - - } - - var offset = uvScaleMap.offset; - var repeat = uvScaleMap.repeat; - - uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y ); - - } - - uniforms.envMap.value = material.envMap; - - // don't flip CubeTexture envMaps, flip everything else: - // WebGLRenderTargetCube will be flipped for backwards compatibility - // WebGLRenderTargetCube.texture will be flipped because it's a Texture and NOT a CubeTexture - // this check must be handled differently, or removed entirely, if WebGLRenderTargetCube uses a CubeTexture in the future - uniforms.flipEnvMap.value = ( ! ( material.envMap && material.envMap.isCubeTexture ) ) ? 1 : - 1; - - uniforms.reflectivity.value = material.reflectivity; - uniforms.refractionRatio.value = material.refractionRatio; - - } - - function refreshUniformsLine( uniforms, material ) { - - uniforms.diffuse.value = material.color; - uniforms.opacity.value = material.opacity; - - } - - function refreshUniformsDash( uniforms, material ) { - - uniforms.dashSize.value = material.dashSize; - uniforms.totalSize.value = material.dashSize + material.gapSize; - uniforms.scale.value = material.scale; - - } - - function refreshUniformsPoints( uniforms, material ) { - - uniforms.diffuse.value = material.color; - uniforms.opacity.value = material.opacity; - uniforms.size.value = material.size * _pixelRatio; - uniforms.scale.value = _height * 0.5; - - uniforms.map.value = material.map; - - if ( material.map !== null ) { - - var offset = material.map.offset; - var repeat = material.map.repeat; - - uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y ); - - } - - } - - function refreshUniformsFog( uniforms, fog ) { - - uniforms.fogColor.value = fog.color; - - if ( fog.isFog ) { - - uniforms.fogNear.value = fog.near; - uniforms.fogFar.value = fog.far; - - } else if ( fog.isFogExp2 ) { - - uniforms.fogDensity.value = fog.density; - - } - - } - - function refreshUniformsLambert( uniforms, material ) { - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - } - - function refreshUniformsPhong( uniforms, material ) { - - uniforms.specular.value = material.specular; - uniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 ) - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - } - - function refreshUniformsToon( uniforms, material ) { - - refreshUniformsPhong( uniforms, material ); - - if ( material.gradientMap ) { - - uniforms.gradientMap.value = material.gradientMap; - - } - - } - - function refreshUniformsStandard( uniforms, material ) { - - uniforms.roughness.value = material.roughness; - uniforms.metalness.value = material.metalness; - - if ( material.roughnessMap ) { - - uniforms.roughnessMap.value = material.roughnessMap; - - } - - if ( material.metalnessMap ) { - - uniforms.metalnessMap.value = material.metalnessMap; - - } - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - if ( material.envMap ) { - - //uniforms.envMap.value = material.envMap; // part of uniforms common - uniforms.envMapIntensity.value = material.envMapIntensity; - - } - - } - - function refreshUniformsPhysical( uniforms, material ) { - - uniforms.clearCoat.value = material.clearCoat; - uniforms.clearCoatRoughness.value = material.clearCoatRoughness; - - refreshUniformsStandard( uniforms, material ); - - } - - // If uniforms are marked as clean, they don't need to be loaded to the GPU. - - function markUniformsLightsNeedsUpdate( uniforms, value ) { - - uniforms.ambientLightColor.needsUpdate = value; - - uniforms.directionalLights.needsUpdate = value; - uniforms.pointLights.needsUpdate = value; - uniforms.spotLights.needsUpdate = value; - uniforms.rectAreaLights.needsUpdate = value; - uniforms.hemisphereLights.needsUpdate = value; - - } - - // Lighting - - function setupShadows( lights ) { - - var lightShadowsLength = 0; - - for ( var i = 0, l = lights.length; i < l; i ++ ) { - - var light = lights[ i ]; - - if ( light.castShadow ) { - - _lights.shadows[ lightShadowsLength ++ ] = light; - - } - - } - - _lights.shadows.length = lightShadowsLength; - - } - - function setupLights( lights, camera ) { - - var l, ll, light, - r = 0, g = 0, b = 0, - color, - intensity, - distance, - shadowMap, - - viewMatrix = camera.matrixWorldInverse, - - directionalLength = 0, - pointLength = 0, - spotLength = 0, - rectAreaLength = 0, - hemiLength = 0; - - for ( l = 0, ll = lights.length; l < ll; l ++ ) { - - light = lights[ l ]; - - color = light.color; - intensity = light.intensity; - distance = light.distance; - - shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null; - - if ( light.isAmbientLight ) { - - r += color.r * intensity; - g += color.g * intensity; - b += color.b * intensity; - - } else if ( light.isDirectionalLight ) { - - var uniforms = lightCache.get( light ); - - uniforms.color.copy( light.color ).multiplyScalar( light.intensity ); - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - _vector3.setFromMatrixPosition( light.target.matrixWorld ); - uniforms.direction.sub( _vector3 ); - uniforms.direction.transformDirection( viewMatrix ); - - uniforms.shadow = light.castShadow; - - if ( light.castShadow ) { - - uniforms.shadowBias = light.shadow.bias; - uniforms.shadowRadius = light.shadow.radius; - uniforms.shadowMapSize = light.shadow.mapSize; - - } - - _lights.directionalShadowMap[ directionalLength ] = shadowMap; - _lights.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix; - _lights.directional[ directionalLength ++ ] = uniforms; - - } else if ( light.isSpotLight ) { - - var uniforms = lightCache.get( light ); - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - uniforms.position.applyMatrix4( viewMatrix ); - - uniforms.color.copy( color ).multiplyScalar( intensity ); - uniforms.distance = distance; - - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - _vector3.setFromMatrixPosition( light.target.matrixWorld ); - uniforms.direction.sub( _vector3 ); - uniforms.direction.transformDirection( viewMatrix ); - - uniforms.coneCos = Math.cos( light.angle ); - uniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) ); - uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay; - - uniforms.shadow = light.castShadow; - - if ( light.castShadow ) { - - uniforms.shadowBias = light.shadow.bias; - uniforms.shadowRadius = light.shadow.radius; - uniforms.shadowMapSize = light.shadow.mapSize; - - } - - _lights.spotShadowMap[ spotLength ] = shadowMap; - _lights.spotShadowMatrix[ spotLength ] = light.shadow.matrix; - _lights.spot[ spotLength ++ ] = uniforms; - - } else if ( light.isRectAreaLight ) { - - var uniforms = lightCache.get( light ); - - // (a) intensity controls irradiance of entire light - uniforms.color - .copy( color ) - .multiplyScalar( intensity / ( light.width * light.height ) ); - - // (b) intensity controls the radiance per light area - // uniforms.color.copy( color ).multiplyScalar( intensity ); - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - uniforms.position.applyMatrix4( viewMatrix ); - - // extract local rotation of light to derive width/height half vectors - _matrix42.identity(); - _matrix4.copy( light.matrixWorld ); - _matrix4.premultiply( viewMatrix ); - _matrix42.extractRotation( _matrix4 ); - - uniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 ); - uniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 ); - - uniforms.halfWidth.applyMatrix4( _matrix42 ); - uniforms.halfHeight.applyMatrix4( _matrix42 ); - - // TODO (abelnation): RectAreaLight distance? - // uniforms.distance = distance; - - _lights.rectArea[ rectAreaLength ++ ] = uniforms; - - } else if ( light.isPointLight ) { - - var uniforms = lightCache.get( light ); - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - uniforms.position.applyMatrix4( viewMatrix ); - - uniforms.color.copy( light.color ).multiplyScalar( light.intensity ); - uniforms.distance = light.distance; - uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay; - - uniforms.shadow = light.castShadow; - - if ( light.castShadow ) { - - uniforms.shadowBias = light.shadow.bias; - uniforms.shadowRadius = light.shadow.radius; - uniforms.shadowMapSize = light.shadow.mapSize; - - } - - _lights.pointShadowMap[ pointLength ] = shadowMap; - - if ( _lights.pointShadowMatrix[ pointLength ] === undefined ) { - - _lights.pointShadowMatrix[ pointLength ] = new Matrix4(); - - } - - // for point lights we set the shadow matrix to be a translation-only matrix - // equal to inverse of the light's position - _vector3.setFromMatrixPosition( light.matrixWorld ).negate(); - _lights.pointShadowMatrix[ pointLength ].identity().setPosition( _vector3 ); - - _lights.point[ pointLength ++ ] = uniforms; - - } else if ( light.isHemisphereLight ) { - - var uniforms = lightCache.get( light ); - - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - uniforms.direction.transformDirection( viewMatrix ); - uniforms.direction.normalize(); - - uniforms.skyColor.copy( light.color ).multiplyScalar( intensity ); - uniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity ); - - _lights.hemi[ hemiLength ++ ] = uniforms; - - } - - } - - _lights.ambient[ 0 ] = r; - _lights.ambient[ 1 ] = g; - _lights.ambient[ 2 ] = b; - - _lights.directional.length = directionalLength; - _lights.spot.length = spotLength; - _lights.rectArea.length = rectAreaLength; - _lights.point.length = pointLength; - _lights.hemi.length = hemiLength; - - // TODO (sam-g-steel) why aren't we using join - _lights.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + _lights.shadows.length; - - } - - // GL state setting - - this.setFaceCulling = function ( cullFace, frontFaceDirection ) { - - state.setCullFace( cullFace ); - state.setFlipSided( frontFaceDirection === FrontFaceDirectionCW ); - - }; - - // Textures - - function allocTextureUnit() { - - var textureUnit = _usedTextureUnits; - - if ( textureUnit >= capabilities.maxTextures ) { - - console.warn( 'WebGLRenderer: trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures ); - - } - - _usedTextureUnits += 1; - - return textureUnit; - - } - - this.allocTextureUnit = allocTextureUnit; - - // this.setTexture2D = setTexture2D; - this.setTexture2D = ( function() { - - var warned = false; - - // backwards compatibility: peel texture.texture - return function setTexture2D( texture, slot ) { - - if ( texture && texture.isWebGLRenderTarget ) { - - if ( ! warned ) { - - console.warn( "THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead." ); - warned = true; - - } - - texture = texture.texture; - - } - - textures.setTexture2D( texture, slot ); - - }; - - }() ); - - this.setTexture = ( function() { - - var warned = false; - - return function setTexture( texture, slot ) { - - if ( ! warned ) { - - console.warn( "THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead." ); - warned = true; - - } - - textures.setTexture2D( texture, slot ); - - }; - - }() ); - - this.setTextureCube = ( function() { - - var warned = false; - - return function setTextureCube( texture, slot ) { - - // backwards compatibility: peel texture.texture - if ( texture && texture.isWebGLRenderTargetCube ) { - - if ( ! warned ) { - - console.warn( "THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead." ); - warned = true; - - } - - texture = texture.texture; - - } - - // currently relying on the fact that WebGLRenderTargetCube.texture is a Texture and NOT a CubeTexture - // TODO: unify these code paths - if ( ( texture && texture.isCubeTexture ) || - ( Array.isArray( texture.image ) && texture.image.length === 6 ) ) { - - // CompressedTexture can have Array in image :/ - - // this function alone should take care of cube textures - textures.setTextureCube( texture, slot ); - - } else { - - // assumed: texture property of THREE.WebGLRenderTargetCube - - textures.setTextureCubeDynamic( texture, slot ); - - } - - }; - - }() ); - - this.getCurrentRenderTarget = function() { - - return _currentRenderTarget; - - }; - - this.setRenderTarget = function ( renderTarget ) { - - _currentRenderTarget = renderTarget; - - if ( renderTarget && properties.get( renderTarget ).__webglFramebuffer === undefined ) { - - textures.setupRenderTarget( renderTarget ); - - } - - var isCube = ( renderTarget && renderTarget.isWebGLRenderTargetCube ); - var framebuffer; - - if ( renderTarget ) { - - var renderTargetProperties = properties.get( renderTarget ); - - if ( isCube ) { - - framebuffer = renderTargetProperties.__webglFramebuffer[ renderTarget.activeCubeFace ]; - - } else { - - framebuffer = renderTargetProperties.__webglFramebuffer; - - } - - _currentScissor.copy( renderTarget.scissor ); - _currentScissorTest = renderTarget.scissorTest; - - _currentViewport.copy( renderTarget.viewport ); - - } else { - - framebuffer = null; - - _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ); - _currentScissorTest = _scissorTest; - - _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ); - - } - - if ( _currentFramebuffer !== framebuffer ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - _currentFramebuffer = framebuffer; - - } - - state.scissor( _currentScissor ); - state.setScissorTest( _currentScissorTest ); - - state.viewport( _currentViewport ); - - if ( isCube ) { - - var textureProperties = properties.get( renderTarget.texture ); - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + renderTarget.activeCubeFace, textureProperties.__webglTexture, renderTarget.activeMipMapLevel ); - - } - - }; - - this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer ) { - - if ( ( renderTarget && renderTarget.isWebGLRenderTarget ) === false ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' ); - return; - - } - - var framebuffer = properties.get( renderTarget ).__webglFramebuffer; - - if ( framebuffer ) { - - var restore = false; - - if ( framebuffer !== _currentFramebuffer ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - - restore = true; - - } - - try { - - var texture = renderTarget.texture; - var textureFormat = texture.format; - var textureType = texture.type; - - if ( textureFormat !== RGBAFormat && paramThreeToGL( textureFormat ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' ); - return; - - } - - if ( textureType !== UnsignedByteType && paramThreeToGL( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // IE11, Edge and Chrome Mac < 52 (#9513) - ! ( textureType === FloatType && ( extensions.get( 'OES_texture_float' ) || extensions.get( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox - ! ( textureType === HalfFloatType && extensions.get( 'EXT_color_buffer_half_float' ) ) ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' ); - return; - - } - - if ( _gl.checkFramebufferStatus( _gl.FRAMEBUFFER ) === _gl.FRAMEBUFFER_COMPLETE ) { - - // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604) - - if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) { - - _gl.readPixels( x, y, width, height, paramThreeToGL( textureFormat ), paramThreeToGL( textureType ), buffer ); - - } - - } else { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' ); - - } - - } finally { - - if ( restore ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, _currentFramebuffer ); - - } - - } - - } - - }; - - // Map three.js constants to WebGL constants - - function paramThreeToGL( p ) { - - var extension; - - if ( p === RepeatWrapping ) return _gl.REPEAT; - if ( p === ClampToEdgeWrapping ) return _gl.CLAMP_TO_EDGE; - if ( p === MirroredRepeatWrapping ) return _gl.MIRRORED_REPEAT; - - if ( p === NearestFilter ) return _gl.NEAREST; - if ( p === NearestMipMapNearestFilter ) return _gl.NEAREST_MIPMAP_NEAREST; - if ( p === NearestMipMapLinearFilter ) return _gl.NEAREST_MIPMAP_LINEAR; - - if ( p === LinearFilter ) return _gl.LINEAR; - if ( p === LinearMipMapNearestFilter ) return _gl.LINEAR_MIPMAP_NEAREST; - if ( p === LinearMipMapLinearFilter ) return _gl.LINEAR_MIPMAP_LINEAR; - - if ( p === UnsignedByteType ) return _gl.UNSIGNED_BYTE; - if ( p === UnsignedShort4444Type ) return _gl.UNSIGNED_SHORT_4_4_4_4; - if ( p === UnsignedShort5551Type ) return _gl.UNSIGNED_SHORT_5_5_5_1; - if ( p === UnsignedShort565Type ) return _gl.UNSIGNED_SHORT_5_6_5; - - if ( p === ByteType ) return _gl.BYTE; - if ( p === ShortType ) return _gl.SHORT; - if ( p === UnsignedShortType ) return _gl.UNSIGNED_SHORT; - if ( p === IntType ) return _gl.INT; - if ( p === UnsignedIntType ) return _gl.UNSIGNED_INT; - if ( p === FloatType ) return _gl.FLOAT; - - if ( p === HalfFloatType ) { - - extension = extensions.get( 'OES_texture_half_float' ); - - if ( extension !== null ) return extension.HALF_FLOAT_OES; - - } - - if ( p === AlphaFormat ) return _gl.ALPHA; - if ( p === RGBFormat ) return _gl.RGB; - if ( p === RGBAFormat ) return _gl.RGBA; - if ( p === LuminanceFormat ) return _gl.LUMINANCE; - if ( p === LuminanceAlphaFormat ) return _gl.LUMINANCE_ALPHA; - if ( p === DepthFormat ) return _gl.DEPTH_COMPONENT; - if ( p === DepthStencilFormat ) return _gl.DEPTH_STENCIL; - - if ( p === AddEquation ) return _gl.FUNC_ADD; - if ( p === SubtractEquation ) return _gl.FUNC_SUBTRACT; - if ( p === ReverseSubtractEquation ) return _gl.FUNC_REVERSE_SUBTRACT; - - if ( p === ZeroFactor ) return _gl.ZERO; - if ( p === OneFactor ) return _gl.ONE; - if ( p === SrcColorFactor ) return _gl.SRC_COLOR; - if ( p === OneMinusSrcColorFactor ) return _gl.ONE_MINUS_SRC_COLOR; - if ( p === SrcAlphaFactor ) return _gl.SRC_ALPHA; - if ( p === OneMinusSrcAlphaFactor ) return _gl.ONE_MINUS_SRC_ALPHA; - if ( p === DstAlphaFactor ) return _gl.DST_ALPHA; - if ( p === OneMinusDstAlphaFactor ) return _gl.ONE_MINUS_DST_ALPHA; - - if ( p === DstColorFactor ) return _gl.DST_COLOR; - if ( p === OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR; - if ( p === SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE; - - if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || - p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) { - - extension = extensions.get( 'WEBGL_compressed_texture_s3tc' ); - - if ( extension !== null ) { - - if ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; - if ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT; - - } - - } - - if ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || - p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) { - - extension = extensions.get( 'WEBGL_compressed_texture_pvrtc' ); - - if ( extension !== null ) { - - if ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - - } - - } - - if ( p === RGB_ETC1_Format ) { - - extension = extensions.get( 'WEBGL_compressed_texture_etc1' ); - - if ( extension !== null ) return extension.COMPRESSED_RGB_ETC1_WEBGL; - - } - - if ( p === MinEquation || p === MaxEquation ) { - - extension = extensions.get( 'EXT_blend_minmax' ); - - if ( extension !== null ) { - - if ( p === MinEquation ) return extension.MIN_EXT; - if ( p === MaxEquation ) return extension.MAX_EXT; - - } - - } - - if ( p === UnsignedInt248Type ) { - - extension = extensions.get( 'WEBGL_depth_texture' ); - - if ( extension !== null ) return extension.UNSIGNED_INT_24_8_WEBGL; - - } - - return 0; - - } - -} - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -function FogExp2 ( color, density ) { - - this.name = ''; - - this.color = new Color( color ); - this.density = ( density !== undefined ) ? density : 0.00025; - -} - -FogExp2.prototype.isFogExp2 = true; - -FogExp2.prototype.clone = function () { - - return new FogExp2( this.color.getHex(), this.density ); - -}; - -FogExp2.prototype.toJSON = function ( meta ) { - - return { - type: 'FogExp2', - color: this.color.getHex(), - density: this.density - }; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -function Fog ( color, near, far ) { - - this.name = ''; - - this.color = new Color( color ); - - this.near = ( near !== undefined ) ? near : 1; - this.far = ( far !== undefined ) ? far : 1000; - -} - -Fog.prototype.isFog = true; - -Fog.prototype.clone = function () { - - return new Fog( this.color.getHex(), this.near, this.far ); - -}; - -Fog.prototype.toJSON = function ( meta ) { - - return { - type: 'Fog', - color: this.color.getHex(), - near: this.near, - far: this.far - }; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function Scene () { - - Object3D.call( this ); - - this.type = 'Scene'; - - this.background = null; - this.fog = null; - this.overrideMaterial = null; - - this.autoUpdate = true; // checked by the renderer - -} - -Scene.prototype = Object.create( Object3D.prototype ); - -Scene.prototype.constructor = Scene; - -Scene.prototype.copy = function ( source, recursive ) { - - Object3D.prototype.copy.call( this, source, recursive ); - - if ( source.background !== null ) this.background = source.background.clone(); - if ( source.fog !== null ) this.fog = source.fog.clone(); - if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone(); - - this.autoUpdate = source.autoUpdate; - this.matrixAutoUpdate = source.matrixAutoUpdate; - - return this; - -}; - -Scene.prototype.toJSON = function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - if ( this.background !== null ) data.object.background = this.background.toJSON( meta ); - if ( this.fog !== null ) data.object.fog = this.fog.toJSON(); - - return data; - -}; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -function LensFlare( texture, size, distance, blending, color ) { - - Object3D.call( this ); - - this.lensFlares = []; - - this.positionScreen = new Vector3(); - this.customUpdateCallback = undefined; - - if ( texture !== undefined ) { - - this.add( texture, size, distance, blending, color ); - - } - -} - -LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: LensFlare, - - isLensFlare: true, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.positionScreen.copy( source.positionScreen ); - this.customUpdateCallback = source.customUpdateCallback; - - for ( var i = 0, l = source.lensFlares.length; i < l; i ++ ) { - - this.lensFlares.push( source.lensFlares[ i ] ); - - } - - return this; - - }, - - add: function ( texture, size, distance, blending, color, opacity ) { - - if ( size === undefined ) size = - 1; - if ( distance === undefined ) distance = 0; - if ( opacity === undefined ) opacity = 1; - if ( color === undefined ) color = new Color( 0xffffff ); - if ( blending === undefined ) blending = NormalBlending; - - distance = Math.min( distance, Math.max( 0, distance ) ); - - this.lensFlares.push( { - texture: texture, // THREE.Texture - size: size, // size in pixels (-1 = use texture.width) - distance: distance, // distance (0-1) from light source (0=at light source) - x: 0, y: 0, z: 0, // screen position (-1 => 1) z = 0 is in front z = 1 is back - scale: 1, // scale - rotation: 0, // rotation - opacity: opacity, // opacity - color: color, // color - blending: blending // blending - } ); - - }, - - /* - * Update lens flares update positions on all flares based on the screen position - * Set myLensFlare.customUpdateCallback to alter the flares in your project specific way. - */ - - updateLensFlares: function () { - - var f, fl = this.lensFlares.length; - var flare; - var vecX = - this.positionScreen.x * 2; - var vecY = - this.positionScreen.y * 2; - - for ( f = 0; f < fl; f ++ ) { - - flare = this.lensFlares[ f ]; - - flare.x = this.positionScreen.x + vecX * flare.distance; - flare.y = this.positionScreen.y + vecY * flare.distance; - - flare.wantedRotation = flare.x * Math.PI * 0.25; - flare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25; - - } - - } - -} ); - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * uvOffset: new THREE.Vector2(), - * uvScale: new THREE.Vector2() - * } - */ - -function SpriteMaterial( parameters ) { - - Material.call( this ); - - this.type = 'SpriteMaterial'; - - this.color = new Color( 0xffffff ); - this.map = null; - - this.rotation = 0; - - this.fog = false; - this.lights = false; - - this.setValues( parameters ); - -} - -SpriteMaterial.prototype = Object.create( Material.prototype ); -SpriteMaterial.prototype.constructor = SpriteMaterial; - -SpriteMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - this.map = source.map; - - this.rotation = source.rotation; - - return this; - -}; - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -function Sprite( material ) { - - Object3D.call( this ); - - this.type = 'Sprite'; - - this.material = ( material !== undefined ) ? material : new SpriteMaterial(); - -} - -Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Sprite, - - isSprite: true, - - raycast: ( function () { - - var matrixPosition = new Vector3(); - - return function raycast( raycaster, intersects ) { - - matrixPosition.setFromMatrixPosition( this.matrixWorld ); - - var distanceSq = raycaster.ray.distanceSqToPoint( matrixPosition ); - var guessSizeSq = this.scale.x * this.scale.y / 4; - - if ( distanceSq > guessSizeSq ) { - - return; - - } - - intersects.push( { - - distance: Math.sqrt( distanceSq ), - point: this.position, - face: null, - object: this - - } ); - - }; - - }() ), - - clone: function () { - - return new this.constructor( this.material ).copy( this ); - - } - -} ); - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -function LOD() { - - Object3D.call( this ); - - this.type = 'LOD'; - - Object.defineProperties( this, { - levels: { - enumerable: true, - value: [] - } - } ); - -} - - -LOD.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: LOD, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source, false ); - - var levels = source.levels; - - for ( var i = 0, l = levels.length; i < l; i ++ ) { - - var level = levels[ i ]; - - this.addLevel( level.object.clone(), level.distance ); - - } - - return this; - - }, - - addLevel: function ( object, distance ) { - - if ( distance === undefined ) distance = 0; - - distance = Math.abs( distance ); - - var levels = this.levels; - - for ( var l = 0; l < levels.length; l ++ ) { - - if ( distance < levels[ l ].distance ) { - - break; - - } - - } - - levels.splice( l, 0, { distance: distance, object: object } ); - - this.add( object ); - - }, - - getObjectForDistance: function ( distance ) { - - var levels = this.levels; - - for ( var i = 1, l = levels.length; i < l; i ++ ) { - - if ( distance < levels[ i ].distance ) { - - break; - - } - - } - - return levels[ i - 1 ].object; - - }, - - raycast: ( function () { - - var matrixPosition = new Vector3(); - - return function raycast( raycaster, intersects ) { - - matrixPosition.setFromMatrixPosition( this.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( matrixPosition ); - - this.getObjectForDistance( distance ).raycast( raycaster, intersects ); - - }; - - }() ), - - update: function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - - return function update( camera ) { - - var levels = this.levels; - - if ( levels.length > 1 ) { - - v1.setFromMatrixPosition( camera.matrixWorld ); - v2.setFromMatrixPosition( this.matrixWorld ); - - var distance = v1.distanceTo( v2 ); - - levels[ 0 ].object.visible = true; - - for ( var i = 1, l = levels.length; i < l; i ++ ) { - - if ( distance >= levels[ i ].distance ) { - - levels[ i - 1 ].object.visible = false; - levels[ i ].object.visible = true; - - } else { - - break; - - } - - } - - for ( ; i < l; i ++ ) { - - levels[ i ].object.visible = false; - - } - - } - - }; - - }(), - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.levels = []; - - var levels = this.levels; - - for ( var i = 0, l = levels.length; i < l; i ++ ) { - - var level = levels[ i ]; - - data.object.levels.push( { - object: level.object.uuid, - distance: level.distance - } ); - - } - - return data; - - } - -} ); - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author michael guerrero / http://realitymeltdown.com - * @author ikerr / http://verold.com - */ - -function Skeleton( bones, boneInverses, useVertexTexture ) { - - this.useVertexTexture = useVertexTexture !== undefined ? useVertexTexture : true; - - this.identityMatrix = new Matrix4(); - - // copy the bone array - - bones = bones || []; - - this.bones = bones.slice( 0 ); - - // create a bone texture or an array of floats - - if ( this.useVertexTexture ) { - - // layout (1 matrix = 4 pixels) - // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) - // with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8) - // 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16) - // 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32) - // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64) - - - var size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix - size = _Math.nextPowerOfTwo( Math.ceil( size ) ); - size = Math.max( size, 4 ); - - this.boneTextureWidth = size; - this.boneTextureHeight = size; - - this.boneMatrices = new Float32Array( this.boneTextureWidth * this.boneTextureHeight * 4 ); // 4 floats per RGBA pixel - this.boneTexture = new DataTexture( this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, RGBAFormat, FloatType ); - - } else { - - this.boneMatrices = new Float32Array( 16 * this.bones.length ); - - } - - // use the supplied bone inverses or calculate the inverses - - if ( boneInverses === undefined ) { - - this.calculateInverses(); - - } else { - - if ( this.bones.length === boneInverses.length ) { - - this.boneInverses = boneInverses.slice( 0 ); - - } else { - - console.warn( 'THREE.Skeleton bonInverses is the wrong length.' ); - - this.boneInverses = []; - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - this.boneInverses.push( new Matrix4() ); - - } - - } - - } - -} - -Object.assign( Skeleton.prototype, { - - calculateInverses: function () { - - this.boneInverses = []; - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - var inverse = new Matrix4(); - - if ( this.bones[ b ] ) { - - inverse.getInverse( this.bones[ b ].matrixWorld ); - - } - - this.boneInverses.push( inverse ); - - } - - }, - - pose: function () { - - var bone; - - // recover the bind-time world matrices - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - bone = this.bones[ b ]; - - if ( bone ) { - - bone.matrixWorld.getInverse( this.boneInverses[ b ] ); - - } - - } - - // compute the local matrices, positions, rotations and scales - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - bone = this.bones[ b ]; - - if ( bone ) { - - if ( bone.parent && bone.parent.isBone ) { - - bone.matrix.getInverse( bone.parent.matrixWorld ); - bone.matrix.multiply( bone.matrixWorld ); - - } else { - - bone.matrix.copy( bone.matrixWorld ); - - } - - bone.matrix.decompose( bone.position, bone.quaternion, bone.scale ); - - } - - } - - }, - - update: ( function () { - - var offsetMatrix = new Matrix4(); - - return function update() { - - // flatten bone matrices to array - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - // compute the offset between the current and the original transform - - var matrix = this.bones[ b ] ? this.bones[ b ].matrixWorld : this.identityMatrix; - - offsetMatrix.multiplyMatrices( matrix, this.boneInverses[ b ] ); - offsetMatrix.toArray( this.boneMatrices, b * 16 ); - - } - - if ( this.useVertexTexture ) { - - this.boneTexture.needsUpdate = true; - - } - - }; - - } )(), - - clone: function () { - - return new Skeleton( this.bones, this.boneInverses, this.useVertexTexture ); - - } - -} ); - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author ikerr / http://verold.com - */ - -function Bone() { - - Object3D.call( this ); - - this.type = 'Bone'; - -} - -Bone.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Bone, - - isBone: true - -} ); - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author ikerr / http://verold.com - */ - -function SkinnedMesh( geometry, material, useVertexTexture ) { - - Mesh.call( this, geometry, material ); - - this.type = 'SkinnedMesh'; - - this.bindMode = "attached"; - this.bindMatrix = new Matrix4(); - this.bindMatrixInverse = new Matrix4(); - - // init bones - - // TODO: remove bone creation as there is no reason (other than - // convenience) for THREE.SkinnedMesh to do this. - - var bones = []; - - if ( this.geometry && this.geometry.bones !== undefined ) { - - var bone, gbone; - - for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) { - - gbone = this.geometry.bones[ b ]; - - bone = new Bone(); - bones.push( bone ); - - bone.name = gbone.name; - bone.position.fromArray( gbone.pos ); - bone.quaternion.fromArray( gbone.rotq ); - if ( gbone.scl !== undefined ) bone.scale.fromArray( gbone.scl ); - - } - - for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) { - - gbone = this.geometry.bones[ b ]; - - if ( gbone.parent !== - 1 && gbone.parent !== null && - bones[ gbone.parent ] !== undefined ) { - - bones[ gbone.parent ].add( bones[ b ] ); - - } else { - - this.add( bones[ b ] ); - - } - - } - - } - - this.normalizeSkinWeights(); - - this.updateMatrixWorld( true ); - this.bind( new Skeleton( bones, undefined, useVertexTexture ), this.matrixWorld ); - -} - - -SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { - - constructor: SkinnedMesh, - - isSkinnedMesh: true, - - bind: function( skeleton, bindMatrix ) { - - this.skeleton = skeleton; - - if ( bindMatrix === undefined ) { - - this.updateMatrixWorld( true ); - - this.skeleton.calculateInverses(); - - bindMatrix = this.matrixWorld; - - } - - this.bindMatrix.copy( bindMatrix ); - this.bindMatrixInverse.getInverse( bindMatrix ); - - }, - - pose: function () { - - this.skeleton.pose(); - - }, - - normalizeSkinWeights: function () { - - if ( this.geometry && this.geometry.isGeometry ) { - - for ( var i = 0; i < this.geometry.skinWeights.length; i ++ ) { - - var sw = this.geometry.skinWeights[ i ]; - - var scale = 1.0 / sw.lengthManhattan(); - - if ( scale !== Infinity ) { - - sw.multiplyScalar( scale ); - - } else { - - sw.set( 1, 0, 0, 0 ); // do something reasonable - - } - - } - - } else if ( this.geometry && this.geometry.isBufferGeometry ) { - - var vec = new Vector4(); - - var skinWeight = this.geometry.attributes.skinWeight; - - for ( var i = 0; i < skinWeight.count; i ++ ) { - - vec.x = skinWeight.getX( i ); - vec.y = skinWeight.getY( i ); - vec.z = skinWeight.getZ( i ); - vec.w = skinWeight.getW( i ); - - var scale = 1.0 / vec.lengthManhattan(); - - if ( scale !== Infinity ) { - - vec.multiplyScalar( scale ); - - } else { - - vec.set( 1, 0, 0, 0 ); // do something reasonable - - } - - skinWeight.setXYZW( i, vec.x, vec.y, vec.z, vec.w ); - - } - - } - - }, - - updateMatrixWorld: function( force ) { - - Mesh.prototype.updateMatrixWorld.call( this, true ); - - if ( this.bindMode === "attached" ) { - - this.bindMatrixInverse.getInverse( this.matrixWorld ); - - } else if ( this.bindMode === "detached" ) { - - this.bindMatrixInverse.getInverse( this.bindMatrix ); - - } else { - - console.warn( 'THREE.SkinnedMesh unrecognized bindMode: ' + this.bindMode ); - - } - - }, - - clone: function() { - - return new this.constructor( this.geometry, this.material, this.skeleton.useVertexTexture ).copy( this ); - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * linewidth: <float>, - * linecap: "round", - * linejoin: "round" - * } - */ - -function LineBasicMaterial( parameters ) { - - Material.call( this ); - - this.type = 'LineBasicMaterial'; - - this.color = new Color( 0xffffff ); - - this.linewidth = 1; - this.linecap = 'round'; - this.linejoin = 'round'; - - this.lights = false; - - this.setValues( parameters ); - -} - -LineBasicMaterial.prototype = Object.create( Material.prototype ); -LineBasicMaterial.prototype.constructor = LineBasicMaterial; - -LineBasicMaterial.prototype.isLineBasicMaterial = true; - -LineBasicMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.linewidth = source.linewidth; - this.linecap = source.linecap; - this.linejoin = source.linejoin; - - return this; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function Line( geometry, material, mode ) { - - if ( mode === 1 ) { - - console.warn( 'THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead.' ); - return new LineSegments( geometry, material ); - - } - - Object3D.call( this ); - - this.type = 'Line'; - - this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); - this.material = material !== undefined ? material : new LineBasicMaterial( { color: Math.random() * 0xffffff } ); - -} - -Line.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Line, - - isLine: true, - - raycast: ( function () { - - var inverseMatrix = new Matrix4(); - var ray = new Ray(); - var sphere = new Sphere(); - - return function raycast( raycaster, intersects ) { - - var precision = raycaster.linePrecision; - var precisionSq = precision * precision; - - var geometry = this.geometry; - var matrixWorld = this.matrixWorld; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( matrixWorld ); - - if ( raycaster.ray.intersectsSphere( sphere ) === false ) return; - - // - - inverseMatrix.getInverse( matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - var vStart = new Vector3(); - var vEnd = new Vector3(); - var interSegment = new Vector3(); - var interRay = new Vector3(); - var step = (this && this.isLineSegments) ? 2 : 1; - - if ( geometry.isBufferGeometry ) { - - var index = geometry.index; - var attributes = geometry.attributes; - var positions = attributes.position.array; - - if ( index !== null ) { - - var indices = index.array; - - for ( var i = 0, l = indices.length - 1; i < l; i += step ) { - - var a = indices[ i ]; - var b = indices[ i + 1 ]; - - vStart.fromArray( positions, a * 3 ); - vEnd.fromArray( positions, b * 3 ); - - var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation - - var distance = raycaster.ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } else { - - for ( var i = 0, l = positions.length / 3 - 1; i < l; i += step ) { - - vStart.fromArray( positions, 3 * i ); - vEnd.fromArray( positions, 3 * i + 3 ); - - var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation - - var distance = raycaster.ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } - - } else if ( geometry.isGeometry ) { - - var vertices = geometry.vertices; - var nbVertices = vertices.length; - - for ( var i = 0; i < nbVertices - 1; i += step ) { - - var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation - - var distance = raycaster.ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } - - }; - - }() ), - - clone: function () { - - return new this.constructor( this.geometry, this.material ).copy( this ); - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function LineSegments( geometry, material ) { - - Line.call( this, geometry, material ); - - this.type = 'LineSegments'; - -} - -LineSegments.prototype = Object.assign( Object.create( Line.prototype ), { - - constructor: LineSegments, - - isLineSegments: true - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * size: <float>, - * sizeAttenuation: <bool> - * } - */ - -function PointsMaterial( parameters ) { - - Material.call( this ); - - this.type = 'PointsMaterial'; - - this.color = new Color( 0xffffff ); - - this.map = null; - - this.size = 1; - this.sizeAttenuation = true; - - this.lights = false; - - this.setValues( parameters ); - -} - -PointsMaterial.prototype = Object.create( Material.prototype ); -PointsMaterial.prototype.constructor = PointsMaterial; - -PointsMaterial.prototype.isPointsMaterial = true; - -PointsMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.size = source.size; - this.sizeAttenuation = source.sizeAttenuation; - - return this; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function Points( geometry, material ) { - - Object3D.call( this ); - - this.type = 'Points'; - - this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); - this.material = material !== undefined ? material : new PointsMaterial( { color: Math.random() * 0xffffff } ); - -} - -Points.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Points, - - isPoints: true, - - raycast: ( function () { - - var inverseMatrix = new Matrix4(); - var ray = new Ray(); - var sphere = new Sphere(); - - return function raycast( raycaster, intersects ) { - - var object = this; - var geometry = this.geometry; - var matrixWorld = this.matrixWorld; - var threshold = raycaster.params.Points.threshold; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( matrixWorld ); - - if ( raycaster.ray.intersectsSphere( sphere ) === false ) return; - - // - - inverseMatrix.getInverse( matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - var localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 ); - var localThresholdSq = localThreshold * localThreshold; - var position = new Vector3(); - - function testPoint( point, index ) { - - var rayPointDistanceSq = ray.distanceSqToPoint( point ); - - if ( rayPointDistanceSq < localThresholdSq ) { - - var intersectPoint = ray.closestPointToPoint( point ); - intersectPoint.applyMatrix4( matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectPoint ); - - if ( distance < raycaster.near || distance > raycaster.far ) return; - - intersects.push( { - - distance: distance, - distanceToRay: Math.sqrt( rayPointDistanceSq ), - point: intersectPoint.clone(), - index: index, - face: null, - object: object - - } ); - - } - - } - - if ( geometry.isBufferGeometry ) { - - var index = geometry.index; - var attributes = geometry.attributes; - var positions = attributes.position.array; - - if ( index !== null ) { - - var indices = index.array; - - for ( var i = 0, il = indices.length; i < il; i ++ ) { - - var a = indices[ i ]; - - position.fromArray( positions, a * 3 ); - - testPoint( position, a ); - - } - - } else { - - for ( var i = 0, l = positions.length / 3; i < l; i ++ ) { - - position.fromArray( positions, i * 3 ); - - testPoint( position, i ); - - } - - } - - } else { - - var vertices = geometry.vertices; - - for ( var i = 0, l = vertices.length; i < l; i ++ ) { - - testPoint( vertices[ i ], i ); - - } - - } - - }; - - }() ), - - clone: function () { - - return new this.constructor( this.geometry, this.material ).copy( this ); - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function Group() { - - Object3D.call( this ); - - this.type = 'Group'; - -} - -Group.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Group - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.generateMipmaps = false; - - var scope = this; - - function update() { - - requestAnimationFrame( update ); - - if ( video.readyState >= video.HAVE_CURRENT_DATA ) { - - scope.needsUpdate = true; - - } - - } - - update(); - -} - -VideoTexture.prototype = Object.create( Texture.prototype ); -VideoTexture.prototype.constructor = VideoTexture; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function CompressedTexture( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) { - - Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - this.image = { width: width, height: height }; - this.mipmaps = mipmaps; - - // no flipping for cube textures - // (also flipping doesn't work for compressed textures ) - - this.flipY = false; - - // can't generate mipmaps for compressed textures - // mips must be embedded in DDS files - - this.generateMipmaps = false; - -} - -CompressedTexture.prototype = Object.create( Texture.prototype ); -CompressedTexture.prototype.constructor = CompressedTexture; - -CompressedTexture.prototype.isCompressedTexture = true; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function CanvasTexture( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - Texture.call( this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.needsUpdate = true; - -} - -CanvasTexture.prototype = Object.create( Texture.prototype ); -CanvasTexture.prototype.constructor = CanvasTexture; - -/** - * @author Matt DesLauriers / @mattdesl - * @author atix / arthursilber.de - */ - -function DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) { - - format = format !== undefined ? format : DepthFormat; - - if ( format !== DepthFormat && format !== DepthStencilFormat ) { - - throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' ) - - } - - if ( type === undefined && format === DepthFormat ) type = UnsignedShortType; - if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type; - - Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.image = { width: width, height: height }; - - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - - this.flipY = false; - this.generateMipmaps = false; - -} - -DepthTexture.prototype = Object.create( Texture.prototype ); -DepthTexture.prototype.constructor = DepthTexture; -DepthTexture.prototype.isDepthTexture = true; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function WireframeGeometry( geometry ) { - - BufferGeometry.call( this ); - - var edge = [ 0, 0 ], hash = {}; - - function sortFunction( a, b ) { - - return a - b; - - } - - var keys = [ 'a', 'b', 'c' ]; - - if ( geometry && geometry.isGeometry ) { - - var vertices = geometry.vertices; - var faces = geometry.faces; - var numEdges = 0; - - // allocate maximal size - var edges = new Uint32Array( 6 * faces.length ); - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = face[ keys[ j ] ]; - edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - edges[ 2 * numEdges ] = edge[ 0 ]; - edges[ 2 * numEdges + 1 ] = edge[ 1 ]; - hash[ key ] = true; - numEdges ++; - - } - - } - - } - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numEdges; i < l; i ++ ) { - - for ( var j = 0; j < 2; j ++ ) { - - var vertex = vertices[ edges [ 2 * i + j ] ]; - - var index = 6 * i + 3 * j; - coords[ index + 0 ] = vertex.x; - coords[ index + 1 ] = vertex.y; - coords[ index + 2 ] = vertex.z; - - } - - } - - this.addAttribute( 'position', new BufferAttribute( coords, 3 ) ); - - } else if ( geometry && geometry.isBufferGeometry ) { - - if ( geometry.index !== null ) { - - // Indexed BufferGeometry - - var indices = geometry.index.array; - var vertices = geometry.attributes.position; - var groups = geometry.groups; - var numEdges = 0; - - if ( groups.length === 0 ) { - - geometry.addGroup( 0, indices.length ); - - } - - // allocate maximal size - var edges = new Uint32Array( 2 * indices.length ); - - for ( var o = 0, ol = groups.length; o < ol; ++ o ) { - - var group = groups[ o ]; - - var start = group.start; - var count = group.count; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = indices[ i + j ]; - edge[ 1 ] = indices[ i + ( j + 1 ) % 3 ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - edges[ 2 * numEdges ] = edge[ 0 ]; - edges[ 2 * numEdges + 1 ] = edge[ 1 ]; - hash[ key ] = true; - numEdges ++; - - } - - } - - } - - } - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numEdges; i < l; i ++ ) { - - for ( var j = 0; j < 2; j ++ ) { - - var index = 6 * i + 3 * j; - var index2 = edges[ 2 * i + j ]; - - coords[ index + 0 ] = vertices.getX( index2 ); - coords[ index + 1 ] = vertices.getY( index2 ); - coords[ index + 2 ] = vertices.getZ( index2 ); - - } - - } - - this.addAttribute( 'position', new BufferAttribute( coords, 3 ) ); - - } else { - - // non-indexed BufferGeometry - - var vertices = geometry.attributes.position.array; - var numEdges = vertices.length / 3; - var numTris = numEdges / 3; - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numTris; i < l; i ++ ) { - - for ( var j = 0; j < 3; j ++ ) { - - var index = 18 * i + 6 * j; - - var index1 = 9 * i + 3 * j; - coords[ index + 0 ] = vertices[ index1 ]; - coords[ index + 1 ] = vertices[ index1 + 1 ]; - coords[ index + 2 ] = vertices[ index1 + 2 ]; - - var index2 = 9 * i + 3 * ( ( j + 1 ) % 3 ); - coords[ index + 3 ] = vertices[ index2 ]; - coords[ index + 4 ] = vertices[ index2 + 1 ]; - coords[ index + 5 ] = vertices[ index2 + 2 ]; - - } - - } - - this.addAttribute( 'position', new BufferAttribute( coords, 3 ) ); - - } - - } - -} - -WireframeGeometry.prototype = Object.create( BufferGeometry.prototype ); -WireframeGeometry.prototype.constructor = WireframeGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - * - * Parametric Surfaces Geometry - * based on the brilliant article by @prideout http://prideout.net/blog/?p=44 - */ - -function ParametricBufferGeometry( func, slices, stacks ) { - - BufferGeometry.call( this ); - - this.type = 'ParametricBufferGeometry'; - - this.parameters = { - func: func, - slices: slices, - stacks: stacks - }; - - // generate vertices and uvs - - var vertices = []; - var uvs = []; - - var i, j, p; - var u, v; - - var sliceCount = slices + 1; - - for ( i = 0; i <= stacks; i ++ ) { - - v = i / stacks; - - for ( j = 0; j <= slices; j ++ ) { - - u = j / slices; - - p = func( u, v ); - vertices.push( p.x, p.y, p.z ); - - uvs.push( u, v ); - - } - - } - - // generate indices - - var indices = []; - var a, b, c, d; - - for ( i = 0; i < stacks; i ++ ) { - - for ( j = 0; j < slices; j ++ ) { - - a = i * sliceCount + j; - b = i * sliceCount + j + 1; - c = ( i + 1 ) * sliceCount + j + 1; - d = ( i + 1 ) * sliceCount + j; - - // faces one and two - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - // build geometry - - this.setIndex( new ( indices.length > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ) ); - this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - // generate normals - - this.computeVertexNormals(); - -} - -ParametricBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -ParametricBufferGeometry.prototype.constructor = ParametricBufferGeometry; - -/** - * @author zz85 / https://github.com/zz85 - * - * Parametric Surfaces Geometry - * based on the brilliant article by @prideout http://prideout.net/blog/?p=44 - */ - -function ParametricGeometry( func, slices, stacks ) { - - Geometry.call( this ); - - this.type = 'ParametricGeometry'; - - this.parameters = { - func: func, - slices: slices, - stacks: stacks - }; - - this.fromBufferGeometry( new ParametricBufferGeometry( func, slices, stacks ) ); - this.mergeVertices(); - -} - -ParametricGeometry.prototype = Object.create( Geometry.prototype ); -ParametricGeometry.prototype.constructor = ParametricGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function PolyhedronBufferGeometry( vertices, indices, radius, detail ) { - - BufferGeometry.call( this ); - - this.type = 'PolyhedronBufferGeometry'; - - this.parameters = { - vertices: vertices, - indices: indices, - radius: radius, - detail: detail - }; - - radius = radius || 1; - detail = detail || 0; - - // default buffer data - - var vertexBuffer = []; - var uvBuffer = []; - - // the subdivision creates the vertex buffer data - - subdivide( detail ); - - // all vertices should lie on a conceptual sphere with a given radius - - appplyRadius( radius ); - - // finally, create the uv data - - generateUVs(); - - // build non-indexed geometry - - this.addAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) ); - this.addAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) ); - this.addAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) ); - this.normalizeNormals(); - - this.boundingSphere = new Sphere( new Vector3(), radius ); - - // helper functions - - function subdivide( detail ) { - - var a = new Vector3(); - var b = new Vector3(); - var c = new Vector3(); - - // iterate over all faces and apply a subdivison with the given detail value - - for ( var i = 0; i < indices.length; i += 3 ) { - - // get the vertices of the face - - getVertexByIndex( indices[ i + 0 ], a ); - getVertexByIndex( indices[ i + 1 ], b ); - getVertexByIndex( indices[ i + 2 ], c ); - - // perform subdivision - - subdivideFace( a, b, c, detail ); - - } - - } - - function subdivideFace( a, b, c, detail ) { - - var cols = Math.pow( 2, detail ); - - // we use this multidimensional array as a data structure for creating the subdivision - - var v = []; - - var i, j; - - // construct all of the vertices for this subdivision - - for ( i = 0 ; i <= cols; i ++ ) { - - v[ i ] = []; - - var aj = a.clone().lerp( c, i / cols ); - var bj = b.clone().lerp( c, i / cols ); - - var rows = cols - i; - - for ( j = 0; j <= rows; j ++ ) { - - if ( j === 0 && i === cols ) { - - v[ i ][ j ] = aj; - - } else { - - v[ i ][ j ] = aj.clone().lerp( bj, j / rows ); - - } - - } - - } - - // construct all of the faces - - for ( i = 0; i < cols ; i ++ ) { - - for ( j = 0; j < 2 * ( cols - i ) - 1; j ++ ) { - - var k = Math.floor( j / 2 ); - - if ( j % 2 === 0 ) { - - pushVertex( v[ i ][ k + 1 ] ); - pushVertex( v[ i + 1 ][ k ] ); - pushVertex( v[ i ][ k ] ); - - } else { - - pushVertex( v[ i ][ k + 1 ] ); - pushVertex( v[ i + 1 ][ k + 1 ] ); - pushVertex( v[ i + 1 ][ k ] ); - - } - - } - - } - - } - - function appplyRadius( radius ) { - - var vertex = new Vector3(); - - // iterate over the entire buffer and apply the radius to each vertex - - for ( var i = 0; i < vertexBuffer.length; i += 3 ) { - - vertex.x = vertexBuffer[ i + 0 ]; - vertex.y = vertexBuffer[ i + 1 ]; - vertex.z = vertexBuffer[ i + 2 ]; - - vertex.normalize().multiplyScalar( radius ); - - vertexBuffer[ i + 0 ] = vertex.x; - vertexBuffer[ i + 1 ] = vertex.y; - vertexBuffer[ i + 2 ] = vertex.z; - - } - - } - - function generateUVs() { - - var vertex = new Vector3(); - - for ( var i = 0; i < vertexBuffer.length; i += 3 ) { - - vertex.x = vertexBuffer[ i + 0 ]; - vertex.y = vertexBuffer[ i + 1 ]; - vertex.z = vertexBuffer[ i + 2 ]; - - var u = azimuth( vertex ) / 2 / Math.PI + 0.5; - var v = inclination( vertex ) / Math.PI + 0.5; - uvBuffer.push( u, 1 - v ); - - } - - correctUVs(); - - correctSeam(); - - } - - function correctSeam() { - - // handle case when face straddles the seam, see #3269 - - for ( var i = 0; i < uvBuffer.length; i += 6 ) { - - // uv data of a single face - - var x0 = uvBuffer[ i + 0 ]; - var x1 = uvBuffer[ i + 2 ]; - var x2 = uvBuffer[ i + 4 ]; - - var max = Math.max( x0, x1, x2 ); - var min = Math.min( x0, x1, x2 ); - - // 0.9 is somewhat arbitrary - - if ( max > 0.9 && min < 0.1 ) { - - if ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1; - if ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1; - if ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1; - - } - - } - - } - - function pushVertex( vertex ) { - - vertexBuffer.push( vertex.x, vertex.y, vertex.z ); - - } - - function getVertexByIndex( index, vertex ) { - - var stride = index * 3; - - vertex.x = vertices[ stride + 0 ]; - vertex.y = vertices[ stride + 1 ]; - vertex.z = vertices[ stride + 2 ]; - - } - - function correctUVs() { - - var a = new Vector3(); - var b = new Vector3(); - var c = new Vector3(); - - var centroid = new Vector3(); - - var uvA = new Vector2(); - var uvB = new Vector2(); - var uvC = new Vector2(); - - for ( var i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) { - - a.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] ); - b.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] ); - c.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] ); - - uvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] ); - uvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] ); - uvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] ); - - centroid.copy( a ).add( b ).add( c ).divideScalar( 3 ); - - var azi = azimuth( centroid ); - - correctUV( uvA, j + 0, a, azi ); - correctUV( uvB, j + 2, b, azi ); - correctUV( uvC, j + 4, c, azi ); - - } - - } - - function correctUV( uv, stride, vector, azimuth ) { - - if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) { - - uvBuffer[ stride ] = uv.x - 1; - - } - - if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) { - - uvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5; - - } - - } - - // Angle around the Y axis, counter-clockwise when looking from above. - - function azimuth( vector ) { - - return Math.atan2( vector.z, - vector.x ); - - } - - - // Angle above the XZ plane. - - function inclination( vector ) { - - return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); - - } - -} - -PolyhedronBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -PolyhedronBufferGeometry.prototype.constructor = PolyhedronBufferGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function TetrahedronBufferGeometry( radius, detail ) { - - var vertices = [ - 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1 - ]; - - var indices = [ - 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1 - ]; - - PolyhedronBufferGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'TetrahedronBufferGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - -} - -TetrahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype ); -TetrahedronBufferGeometry.prototype.constructor = TetrahedronBufferGeometry; - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -function TetrahedronGeometry( radius, detail ) { - - Geometry.call( this ); - - this.type = 'TetrahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - this.fromBufferGeometry( new TetrahedronBufferGeometry( radius, detail ) ); - this.mergeVertices(); - -} - -TetrahedronGeometry.prototype = Object.create( Geometry.prototype ); -TetrahedronGeometry.prototype.constructor = TetrahedronGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function OctahedronBufferGeometry( radius,detail ) { - - var vertices = [ - 1, 0, 0, - 1, 0, 0, 0, 1, 0, 0, - 1, 0, 0, 0, 1, 0, 0, - 1 - ]; - - var indices = [ - 0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2 - ]; - - PolyhedronBufferGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'OctahedronBufferGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - -} - -OctahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype ); -OctahedronBufferGeometry.prototype.constructor = OctahedronBufferGeometry; - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -function OctahedronGeometry( radius, detail ) { - - Geometry.call( this ); - - this.type = 'OctahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - this.fromBufferGeometry( new OctahedronBufferGeometry( radius, detail ) ); - this.mergeVertices(); - -} - -OctahedronGeometry.prototype = Object.create( Geometry.prototype ); -OctahedronGeometry.prototype.constructor = OctahedronGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function IcosahedronBufferGeometry( radius, detail ) { - - var t = ( 1 + Math.sqrt( 5 ) ) / 2; - - var vertices = [ - - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, 0, - 0, - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, - t, 0, - 1, t, 0, 1, - t, 0, - 1, - t, 0, 1 - ]; - - var indices = [ - 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, - 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, - 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, - 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1 - ]; - - PolyhedronBufferGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'IcosahedronBufferGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - -} - -IcosahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype ); -IcosahedronBufferGeometry.prototype.constructor = IcosahedronBufferGeometry; - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -function IcosahedronGeometry( radius, detail ) { - - Geometry.call( this ); - - this.type = 'IcosahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - this.fromBufferGeometry( new IcosahedronBufferGeometry( radius, detail ) ); - this.mergeVertices(); - -} - -IcosahedronGeometry.prototype = Object.create( Geometry.prototype ); -IcosahedronGeometry.prototype.constructor = IcosahedronGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function DodecahedronBufferGeometry( radius, detail ) { - - var t = ( 1 + Math.sqrt( 5 ) ) / 2; - var r = 1 / t; - - var vertices = [ - - // (±1, ±1, ±1) - - 1, - 1, - 1, - 1, - 1, 1, - - 1, 1, - 1, - 1, 1, 1, - 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, 1, 1, 1, - - // (0, ±1/φ, ±φ) - 0, - r, - t, 0, - r, t, - 0, r, - t, 0, r, t, - - // (±1/φ, ±φ, 0) - - r, - t, 0, - r, t, 0, - r, - t, 0, r, t, 0, - - // (±φ, 0, ±1/φ) - - t, 0, - r, t, 0, - r, - - t, 0, r, t, 0, r - ]; - - var indices = [ - 3, 11, 7, 3, 7, 15, 3, 15, 13, - 7, 19, 17, 7, 17, 6, 7, 6, 15, - 17, 4, 8, 17, 8, 10, 17, 10, 6, - 8, 0, 16, 8, 16, 2, 8, 2, 10, - 0, 12, 1, 0, 1, 18, 0, 18, 16, - 6, 10, 2, 6, 2, 13, 6, 13, 15, - 2, 16, 18, 2, 18, 3, 2, 3, 13, - 18, 1, 9, 18, 9, 11, 18, 11, 3, - 4, 14, 12, 4, 12, 0, 4, 0, 8, - 11, 9, 5, 11, 5, 19, 11, 19, 7, - 19, 5, 14, 19, 14, 4, 19, 4, 17, - 1, 12, 14, 1, 14, 5, 1, 5, 9 - ]; - - PolyhedronBufferGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'DodecahedronBufferGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - -} - -DodecahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype ); -DodecahedronBufferGeometry.prototype.constructor = DodecahedronBufferGeometry; - -/** - * @author Abe Pazos / https://hamoid.com - */ - -function DodecahedronGeometry( radius, detail ) { - - Geometry.call( this ); - - this.type = 'DodecahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - this.fromBufferGeometry( new DodecahedronBufferGeometry( radius, detail ) ); - this.mergeVertices(); - -} - -DodecahedronGeometry.prototype = Object.create( Geometry.prototype ); -DodecahedronGeometry.prototype.constructor = DodecahedronGeometry; - -/** - * @author clockworkgeek / https://github.com/clockworkgeek - * @author timothypratley / https://github.com/timothypratley - * @author WestLangley / http://github.com/WestLangley -*/ - -function PolyhedronGeometry( vertices, indices, radius, detail ) { - - Geometry.call( this ); - - this.type = 'PolyhedronGeometry'; - - this.parameters = { - vertices: vertices, - indices: indices, - radius: radius, - detail: detail - }; - - this.fromBufferGeometry( new PolyhedronBufferGeometry( vertices, indices, radius, detail ) ); - this.mergeVertices(); - -} - -PolyhedronGeometry.prototype = Object.create( Geometry.prototype ); -PolyhedronGeometry.prototype.constructor = PolyhedronGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - * - * Creates a tube which extrudes along a 3d spline. - * - */ - -function TubeBufferGeometry( path, tubularSegments, radius, radialSegments, closed ) { - - BufferGeometry.call( this ); - - this.type = 'TubeBufferGeometry'; - - this.parameters = { - path: path, - tubularSegments: tubularSegments, - radius: radius, - radialSegments: radialSegments, - closed: closed - }; - - tubularSegments = tubularSegments || 64; - radius = radius || 1; - radialSegments = radialSegments || 8; - closed = closed || false; - - var frames = path.computeFrenetFrames( tubularSegments, closed ); - - // expose internals - - this.tangents = frames.tangents; - this.normals = frames.normals; - this.binormals = frames.binormals; - - // helper variables - - var vertex = new Vector3(); - var normal = new Vector3(); - var uv = new Vector2(); - - var i, j; - - // buffer - - var vertices = []; - var normals = []; - var uvs = []; - var indices = []; - - // create buffer data - - generateBufferData(); - - // build geometry - - this.setIndex( new ( indices.length > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ) ); - this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - // functions - - function generateBufferData() { - - for ( i = 0; i < tubularSegments; i ++ ) { - - generateSegment( i ); - - } - - // if the geometry is not closed, generate the last row of vertices and normals - // at the regular position on the given path - // - // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ) - - generateSegment( ( closed === false ) ? tubularSegments : 0 ); - - // uvs are generated in a separate function. - // this makes it easy compute correct values for closed geometries - - generateUVs(); - - // finally create faces - - generateIndices(); - - } - - function generateSegment( i ) { - - // we use getPointAt to sample evenly distributed points from the given path - - var P = path.getPointAt( i / tubularSegments ); - - // retrieve corresponding normal and binormal - - var N = frames.normals[ i ]; - var B = frames.binormals[ i ]; - - // generate normals and vertices for the current segment - - for ( j = 0; j <= radialSegments; j ++ ) { - - var v = j / radialSegments * Math.PI * 2; - - var sin = Math.sin( v ); - var cos = - Math.cos( v ); - - // normal - - normal.x = ( cos * N.x + sin * B.x ); - normal.y = ( cos * N.y + sin * B.y ); - normal.z = ( cos * N.z + sin * B.z ); - normal.normalize(); - - normals.push( normal.x, normal.y, normal.z ); - - // vertex - - vertex.x = P.x + radius * normal.x; - vertex.y = P.y + radius * normal.y; - vertex.z = P.z + radius * normal.z; - - vertices.push( vertex.x, vertex.y, vertex.z ); - - } - - } - - function generateIndices() { - - for ( j = 1; j <= tubularSegments; j ++ ) { - - for ( i = 1; i <= radialSegments; i ++ ) { - - var a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 ); - var b = ( radialSegments + 1 ) * j + ( i - 1 ); - var c = ( radialSegments + 1 ) * j + i; - var d = ( radialSegments + 1 ) * ( j - 1 ) + i; - - // faces - - indices.push( a, b, d ); - indices.push( b, c, d ); - - } - - } - - } - - function generateUVs() { - - for ( i = 0; i <= tubularSegments; i ++ ) { - - for ( j = 0; j <= radialSegments; j ++ ) { - - uv.x = i / tubularSegments; - uv.y = j / radialSegments; - - uvs.push( uv.x, uv.y ); - - } - - } - - } - -} - -TubeBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -TubeBufferGeometry.prototype.constructor = TubeBufferGeometry; - -/** - * @author oosmoxiecode / https://github.com/oosmoxiecode - * @author WestLangley / https://github.com/WestLangley - * @author zz85 / https://github.com/zz85 - * @author miningold / https://github.com/miningold - * @author jonobr1 / https://github.com/jonobr1 - * - * Creates a tube which extrudes along a 3d spline. - */ - -function TubeGeometry( path, tubularSegments, radius, radialSegments, closed, taper ) { - - Geometry.call( this ); - - this.type = 'TubeGeometry'; - - this.parameters = { - path: path, - tubularSegments: tubularSegments, - radius: radius, - radialSegments: radialSegments, - closed: closed - }; - - if ( taper !== undefined ) console.warn( 'THREE.TubeGeometry: taper has been removed.' ); - - var bufferGeometry = new TubeBufferGeometry( path, tubularSegments, radius, radialSegments, closed ); - - // expose internals - - this.tangents = bufferGeometry.tangents; - this.normals = bufferGeometry.normals; - this.binormals = bufferGeometry.binormals; - - // create geometry - - this.fromBufferGeometry( bufferGeometry ); - this.mergeVertices(); - -} - -TubeGeometry.prototype = Object.create( Geometry.prototype ); -TubeGeometry.prototype.constructor = TubeGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - * - * see: http://www.blackpawn.com/texts/pqtorus/ - */ -function TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q ) { - - BufferGeometry.call( this ); - - this.type = 'TorusKnotBufferGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - tubularSegments: tubularSegments, - radialSegments: radialSegments, - p: p, - q: q - }; - - radius = radius || 100; - tube = tube || 40; - tubularSegments = Math.floor( tubularSegments ) || 64; - radialSegments = Math.floor( radialSegments ) || 8; - p = p || 2; - q = q || 3; - - // used to calculate buffer length - var vertexCount = ( ( radialSegments + 1 ) * ( tubularSegments + 1 ) ); - var indexCount = radialSegments * tubularSegments * 2 * 3; - - // buffers - var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ) , 1 ); - var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - // helper variables - var i, j, index = 0, indexOffset = 0; - - var vertex = new Vector3(); - var normal = new Vector3(); - var uv = new Vector2(); - - var P1 = new Vector3(); - var P2 = new Vector3(); - - var B = new Vector3(); - var T = new Vector3(); - var N = new Vector3(); - - // generate vertices, normals and uvs - - for ( i = 0; i <= tubularSegments; ++ i ) { - - // the radian "u" is used to calculate the position on the torus curve of the current tubular segement - - var u = i / tubularSegments * p * Math.PI * 2; - - // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead. - // these points are used to create a special "coordinate space", which is necessary to calculate the correct vertex positions - - calculatePositionOnCurve( u, p, q, radius, P1 ); - calculatePositionOnCurve( u + 0.01, p, q, radius, P2 ); - - // calculate orthonormal basis - - T.subVectors( P2, P1 ); - N.addVectors( P2, P1 ); - B.crossVectors( T, N ); - N.crossVectors( B, T ); - - // normalize B, N. T can be ignored, we don't use it - - B.normalize(); - N.normalize(); - - for ( j = 0; j <= radialSegments; ++ j ) { - - // now calculate the vertices. they are nothing more than an extrusion of the torus curve. - // because we extrude a shape in the xy-plane, there is no need to calculate a z-value. - - var v = j / radialSegments * Math.PI * 2; - var cx = - tube * Math.cos( v ); - var cy = tube * Math.sin( v ); - - // now calculate the final vertex position. - // first we orient the extrusion with our basis vectos, then we add it to the current position on the curve - - vertex.x = P1.x + ( cx * N.x + cy * B.x ); - vertex.y = P1.y + ( cx * N.y + cy * B.y ); - vertex.z = P1.z + ( cx * N.z + cy * B.z ); - - // vertex - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal) - normal.subVectors( vertex, P1 ).normalize(); - normals.setXYZ( index, normal.x, normal.y, normal.z ); - - // uv - uv.x = i / tubularSegments; - uv.y = j / radialSegments; - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index ++; - - } - - } - - // generate indices - - for ( j = 1; j <= tubularSegments; j ++ ) { - - for ( i = 1; i <= radialSegments; i ++ ) { - - // indices - var a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 ); - var b = ( radialSegments + 1 ) * j + ( i - 1 ); - var c = ( radialSegments + 1 ) * j + i; - var d = ( radialSegments + 1 ) * ( j - 1 ) + i; - - // face one - indices.setX( indexOffset, a ); indexOffset++; - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - // face two - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, c ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - } - - } - - // build geometry - - this.setIndex( indices ); - this.addAttribute( 'position', vertices ); - this.addAttribute( 'normal', normals ); - this.addAttribute( 'uv', uvs ); - - // this function calculates the current position on the torus curve - - function calculatePositionOnCurve( u, p, q, radius, position ) { - - var cu = Math.cos( u ); - var su = Math.sin( u ); - var quOverP = q / p * u; - var cs = Math.cos( quOverP ); - - position.x = radius * ( 2 + cs ) * 0.5 * cu; - position.y = radius * ( 2 + cs ) * su * 0.5; - position.z = radius * Math.sin( quOverP ) * 0.5; - - } - -} - -TorusKnotBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -TorusKnotBufferGeometry.prototype.constructor = TorusKnotBufferGeometry; - -/** - * @author oosmoxiecode - */ - -function TorusKnotGeometry( radius, tube, tubularSegments, radialSegments, p, q, heightScale ) { - - Geometry.call( this ); - - this.type = 'TorusKnotGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - tubularSegments: tubularSegments, - radialSegments: radialSegments, - p: p, - q: q - }; - - if( heightScale !== undefined ) console.warn( 'THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.' ); - - this.fromBufferGeometry( new TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q ) ); - this.mergeVertices(); - -} - -TorusKnotGeometry.prototype = Object.create( Geometry.prototype ); -TorusKnotGeometry.prototype.constructor = TorusKnotGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc ) { - - BufferGeometry.call( this ); - - this.type = 'TorusBufferGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - radialSegments: radialSegments, - tubularSegments: tubularSegments, - arc: arc - }; - - radius = radius || 100; - tube = tube || 40; - radialSegments = Math.floor( radialSegments ) || 8; - tubularSegments = Math.floor( tubularSegments ) || 6; - arc = arc || Math.PI * 2; - - // used to calculate buffer length - var vertexCount = ( ( radialSegments + 1 ) * ( tubularSegments + 1 ) ); - var indexCount = radialSegments * tubularSegments * 2 * 3; - - // buffers - var indices = new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ); - var vertices = new Float32Array( vertexCount * 3 ); - var normals = new Float32Array( vertexCount * 3 ); - var uvs = new Float32Array( vertexCount * 2 ); - - // offset variables - var vertexBufferOffset = 0; - var uvBufferOffset = 0; - var indexBufferOffset = 0; - - // helper variables - var center = new Vector3(); - var vertex = new Vector3(); - var normal = new Vector3(); - - var j, i; - - // generate vertices, normals and uvs - - for ( j = 0; j <= radialSegments; j ++ ) { - - for ( i = 0; i <= tubularSegments; i ++ ) { - - var u = i / tubularSegments * arc; - var v = j / radialSegments * Math.PI * 2; - - // vertex - vertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u ); - vertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u ); - vertex.z = tube * Math.sin( v ); - - vertices[ vertexBufferOffset ] = vertex.x; - vertices[ vertexBufferOffset + 1 ] = vertex.y; - vertices[ vertexBufferOffset + 2 ] = vertex.z; - - // this vector is used to calculate the normal - center.x = radius * Math.cos( u ); - center.y = radius * Math.sin( u ); - - // normal - normal.subVectors( vertex, center ).normalize(); - - normals[ vertexBufferOffset ] = normal.x; - normals[ vertexBufferOffset + 1 ] = normal.y; - normals[ vertexBufferOffset + 2 ] = normal.z; - - // uv - uvs[ uvBufferOffset ] = i / tubularSegments; - uvs[ uvBufferOffset + 1 ] = j / radialSegments; - - // update offsets - vertexBufferOffset += 3; - uvBufferOffset += 2; - - } - - } - - // generate indices - - for ( j = 1; j <= radialSegments; j ++ ) { - - for ( i = 1; i <= tubularSegments; i ++ ) { - - // indices - var a = ( tubularSegments + 1 ) * j + i - 1; - var b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1; - var c = ( tubularSegments + 1 ) * ( j - 1 ) + i; - var d = ( tubularSegments + 1 ) * j + i; - - // face one - indices[ indexBufferOffset ] = a; - indices[ indexBufferOffset + 1 ] = b; - indices[ indexBufferOffset + 2 ] = d; - - // face two - indices[ indexBufferOffset + 3 ] = b; - indices[ indexBufferOffset + 4 ] = c; - indices[ indexBufferOffset + 5 ] = d; - - // update offset - indexBufferOffset += 6; - - } - - } - - // build geometry - this.setIndex( new BufferAttribute( indices, 1 ) ); - this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - -} - -TorusBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -TorusBufferGeometry.prototype.constructor = TorusBufferGeometry; - -/** - * @author oosmoxiecode - * @author mrdoob / http://mrdoob.com/ - * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888 - */ - -function TorusGeometry( radius, tube, radialSegments, tubularSegments, arc ) { - - Geometry.call( this ); - - this.type = 'TorusGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - radialSegments: radialSegments, - tubularSegments: tubularSegments, - arc: arc - }; - - this.fromBufferGeometry( new TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc ) ); - -} - -TorusGeometry.prototype = Object.create( Geometry.prototype ); -TorusGeometry.prototype.constructor = TorusGeometry; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - -var ShapeUtils = { - - // calculate area of the contour polygon - - area: function ( contour ) { - - var n = contour.length; - var a = 0.0; - - for ( var p = n - 1, q = 0; q < n; p = q ++ ) { - - a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y; - - } - - return a * 0.5; - - }, - - triangulate: ( function () { - - /** - * This code is a quick port of code written in C++ which was submitted to - * flipcode.com by John W. Ratcliff // July 22, 2000 - * See original code and more information here: - * http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml - * - * ported to actionscript by Zevan Rosser - * www.actionsnippet.com - * - * ported to javascript by Joshua Koo - * http://www.lab4games.net/zz85/blog - * - */ - - function snip( contour, u, v, w, n, verts ) { - - var p; - var ax, ay, bx, by; - var cx, cy, px, py; - - ax = contour[ verts[ u ] ].x; - ay = contour[ verts[ u ] ].y; - - bx = contour[ verts[ v ] ].x; - by = contour[ verts[ v ] ].y; - - cx = contour[ verts[ w ] ].x; - cy = contour[ verts[ w ] ].y; - - if ( ( bx - ax ) * ( cy - ay ) - ( by - ay ) * ( cx - ax ) <= 0 ) return false; - - var aX, aY, bX, bY, cX, cY; - var apx, apy, bpx, bpy, cpx, cpy; - var cCROSSap, bCROSScp, aCROSSbp; - - aX = cx - bx; aY = cy - by; - bX = ax - cx; bY = ay - cy; - cX = bx - ax; cY = by - ay; - - for ( p = 0; p < n; p ++ ) { - - px = contour[ verts[ p ] ].x; - py = contour[ verts[ p ] ].y; - - if ( ( ( px === ax ) && ( py === ay ) ) || - ( ( px === bx ) && ( py === by ) ) || - ( ( px === cx ) && ( py === cy ) ) ) continue; - - apx = px - ax; apy = py - ay; - bpx = px - bx; bpy = py - by; - cpx = px - cx; cpy = py - cy; - - // see if p is inside triangle abc - - aCROSSbp = aX * bpy - aY * bpx; - cCROSSap = cX * apy - cY * apx; - bCROSScp = bX * cpy - bY * cpx; - - if ( ( aCROSSbp >= - Number.EPSILON ) && ( bCROSScp >= - Number.EPSILON ) && ( cCROSSap >= - Number.EPSILON ) ) return false; - - } - - return true; - - } - - // takes in an contour array and returns - - return function triangulate( contour, indices ) { - - var n = contour.length; - - if ( n < 3 ) return null; - - var result = [], - verts = [], - vertIndices = []; - - /* we want a counter-clockwise polygon in verts */ - - var u, v, w; - - if ( ShapeUtils.area( contour ) > 0.0 ) { - - for ( v = 0; v < n; v ++ ) verts[ v ] = v; - - } else { - - for ( v = 0; v < n; v ++ ) verts[ v ] = ( n - 1 ) - v; - - } - - var nv = n; - - /* remove nv - 2 vertices, creating 1 triangle every time */ - - var count = 2 * nv; /* error detection */ - - for ( v = nv - 1; nv > 2; ) { - - /* if we loop, it is probably a non-simple polygon */ - - if ( ( count -- ) <= 0 ) { - - //** Triangulate: ERROR - probable bad polygon! - - //throw ( "Warning, unable to triangulate polygon!" ); - //return null; - // Sometimes warning is fine, especially polygons are triangulated in reverse. - console.warn( 'THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()' ); - - if ( indices ) return vertIndices; - return result; - - } - - /* three consecutive vertices in current polygon, <u,v,w> */ - - u = v; if ( nv <= u ) u = 0; /* previous */ - v = u + 1; if ( nv <= v ) v = 0; /* new v */ - w = v + 1; if ( nv <= w ) w = 0; /* next */ - - if ( snip( contour, u, v, w, nv, verts ) ) { - - var a, b, c, s, t; - - /* true names of the vertices */ - - a = verts[ u ]; - b = verts[ v ]; - c = verts[ w ]; - - /* output Triangle */ - - result.push( [ contour[ a ], - contour[ b ], - contour[ c ] ] ); - - - vertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] ); - - /* remove v from the remaining polygon */ - - for ( s = v, t = v + 1; t < nv; s ++, t ++ ) { - - verts[ s ] = verts[ t ]; - - } - - nv --; - - /* reset error detection counter */ - - count = 2 * nv; - - } - - } - - if ( indices ) return vertIndices; - return result; - - } - - } )(), - - triangulateShape: function ( contour, holes ) { - - function removeDupEndPts(points) { - - var l = points.length; - - if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) { - - points.pop(); - - } - - } - - removeDupEndPts( contour ); - holes.forEach( removeDupEndPts ); - - function point_in_segment_2D_colin( inSegPt1, inSegPt2, inOtherPt ) { - - // inOtherPt needs to be collinear to the inSegment - if ( inSegPt1.x !== inSegPt2.x ) { - - if ( inSegPt1.x < inSegPt2.x ) { - - return ( ( inSegPt1.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt2.x ) ); - - } else { - - return ( ( inSegPt2.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt1.x ) ); - - } - - } else { - - if ( inSegPt1.y < inSegPt2.y ) { - - return ( ( inSegPt1.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt2.y ) ); - - } else { - - return ( ( inSegPt2.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt1.y ) ); - - } - - } - - } - - function intersect_segments_2D( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1, inSeg2Pt2, inExcludeAdjacentSegs ) { - - var seg1dx = inSeg1Pt2.x - inSeg1Pt1.x, seg1dy = inSeg1Pt2.y - inSeg1Pt1.y; - var seg2dx = inSeg2Pt2.x - inSeg2Pt1.x, seg2dy = inSeg2Pt2.y - inSeg2Pt1.y; - - var seg1seg2dx = inSeg1Pt1.x - inSeg2Pt1.x; - var seg1seg2dy = inSeg1Pt1.y - inSeg2Pt1.y; - - var limit = seg1dy * seg2dx - seg1dx * seg2dy; - var perpSeg1 = seg1dy * seg1seg2dx - seg1dx * seg1seg2dy; - - if ( Math.abs( limit ) > Number.EPSILON ) { - - // not parallel - - var perpSeg2; - if ( limit > 0 ) { - - if ( ( perpSeg1 < 0 ) || ( perpSeg1 > limit ) ) return []; - perpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy; - if ( ( perpSeg2 < 0 ) || ( perpSeg2 > limit ) ) return []; - - } else { - - if ( ( perpSeg1 > 0 ) || ( perpSeg1 < limit ) ) return []; - perpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy; - if ( ( perpSeg2 > 0 ) || ( perpSeg2 < limit ) ) return []; - - } - - // i.e. to reduce rounding errors - // intersection at endpoint of segment#1? - if ( perpSeg2 === 0 ) { - - if ( ( inExcludeAdjacentSegs ) && - ( ( perpSeg1 === 0 ) || ( perpSeg1 === limit ) ) ) return []; - return [ inSeg1Pt1 ]; - - } - if ( perpSeg2 === limit ) { - - if ( ( inExcludeAdjacentSegs ) && - ( ( perpSeg1 === 0 ) || ( perpSeg1 === limit ) ) ) return []; - return [ inSeg1Pt2 ]; - - } - // intersection at endpoint of segment#2? - if ( perpSeg1 === 0 ) return [ inSeg2Pt1 ]; - if ( perpSeg1 === limit ) return [ inSeg2Pt2 ]; - - // return real intersection point - var factorSeg1 = perpSeg2 / limit; - return [ { x: inSeg1Pt1.x + factorSeg1 * seg1dx, - y: inSeg1Pt1.y + factorSeg1 * seg1dy } ]; - - } else { - - // parallel or collinear - if ( ( perpSeg1 !== 0 ) || - ( seg2dy * seg1seg2dx !== seg2dx * seg1seg2dy ) ) return []; - - // they are collinear or degenerate - var seg1Pt = ( ( seg1dx === 0 ) && ( seg1dy === 0 ) ); // segment1 is just a point? - var seg2Pt = ( ( seg2dx === 0 ) && ( seg2dy === 0 ) ); // segment2 is just a point? - // both segments are points - if ( seg1Pt && seg2Pt ) { - - if ( ( inSeg1Pt1.x !== inSeg2Pt1.x ) || - ( inSeg1Pt1.y !== inSeg2Pt1.y ) ) return []; // they are distinct points - return [ inSeg1Pt1 ]; // they are the same point - - } - // segment#1 is a single point - if ( seg1Pt ) { - - if ( ! point_in_segment_2D_colin( inSeg2Pt1, inSeg2Pt2, inSeg1Pt1 ) ) return []; // but not in segment#2 - return [ inSeg1Pt1 ]; - - } - // segment#2 is a single point - if ( seg2Pt ) { - - if ( ! point_in_segment_2D_colin( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1 ) ) return []; // but not in segment#1 - return [ inSeg2Pt1 ]; - - } - - // they are collinear segments, which might overlap - var seg1min, seg1max, seg1minVal, seg1maxVal; - var seg2min, seg2max, seg2minVal, seg2maxVal; - if ( seg1dx !== 0 ) { - - // the segments are NOT on a vertical line - if ( inSeg1Pt1.x < inSeg1Pt2.x ) { - - seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.x; - seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.x; - - } else { - - seg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.x; - seg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.x; - - } - if ( inSeg2Pt1.x < inSeg2Pt2.x ) { - - seg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.x; - seg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.x; - - } else { - - seg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.x; - seg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.x; - - } - - } else { - - // the segments are on a vertical line - if ( inSeg1Pt1.y < inSeg1Pt2.y ) { - - seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.y; - seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.y; - - } else { - - seg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.y; - seg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.y; - - } - if ( inSeg2Pt1.y < inSeg2Pt2.y ) { - - seg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.y; - seg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.y; - - } else { - - seg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.y; - seg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.y; - - } - - } - if ( seg1minVal <= seg2minVal ) { - - if ( seg1maxVal < seg2minVal ) return []; - if ( seg1maxVal === seg2minVal ) { - - if ( inExcludeAdjacentSegs ) return []; - return [ seg2min ]; - - } - if ( seg1maxVal <= seg2maxVal ) return [ seg2min, seg1max ]; - return [ seg2min, seg2max ]; - - } else { - - if ( seg1minVal > seg2maxVal ) return []; - if ( seg1minVal === seg2maxVal ) { - - if ( inExcludeAdjacentSegs ) return []; - return [ seg1min ]; - - } - if ( seg1maxVal <= seg2maxVal ) return [ seg1min, seg1max ]; - return [ seg1min, seg2max ]; - - } - - } - - } - - function isPointInsideAngle( inVertex, inLegFromPt, inLegToPt, inOtherPt ) { - - // The order of legs is important - - // translation of all points, so that Vertex is at (0,0) - var legFromPtX = inLegFromPt.x - inVertex.x, legFromPtY = inLegFromPt.y - inVertex.y; - var legToPtX = inLegToPt.x - inVertex.x, legToPtY = inLegToPt.y - inVertex.y; - var otherPtX = inOtherPt.x - inVertex.x, otherPtY = inOtherPt.y - inVertex.y; - - // main angle >0: < 180 deg.; 0: 180 deg.; <0: > 180 deg. - var from2toAngle = legFromPtX * legToPtY - legFromPtY * legToPtX; - var from2otherAngle = legFromPtX * otherPtY - legFromPtY * otherPtX; - - if ( Math.abs( from2toAngle ) > Number.EPSILON ) { - - // angle != 180 deg. - - var other2toAngle = otherPtX * legToPtY - otherPtY * legToPtX; - // console.log( "from2to: " + from2toAngle + ", from2other: " + from2otherAngle + ", other2to: " + other2toAngle ); - - if ( from2toAngle > 0 ) { - - // main angle < 180 deg. - return ( ( from2otherAngle >= 0 ) && ( other2toAngle >= 0 ) ); - - } else { - - // main angle > 180 deg. - return ( ( from2otherAngle >= 0 ) || ( other2toAngle >= 0 ) ); - - } - - } else { - - // angle == 180 deg. - // console.log( "from2to: 180 deg., from2other: " + from2otherAngle ); - return ( from2otherAngle > 0 ); - - } - - } - - - function removeHoles( contour, holes ) { - - var shape = contour.concat(); // work on this shape - var hole; - - function isCutLineInsideAngles( inShapeIdx, inHoleIdx ) { - - // Check if hole point lies within angle around shape point - var lastShapeIdx = shape.length - 1; - - var prevShapeIdx = inShapeIdx - 1; - if ( prevShapeIdx < 0 ) prevShapeIdx = lastShapeIdx; - - var nextShapeIdx = inShapeIdx + 1; - if ( nextShapeIdx > lastShapeIdx ) nextShapeIdx = 0; - - var insideAngle = isPointInsideAngle( shape[ inShapeIdx ], shape[ prevShapeIdx ], shape[ nextShapeIdx ], hole[ inHoleIdx ] ); - if ( ! insideAngle ) { - - // console.log( "Vertex (Shape): " + inShapeIdx + ", Point: " + hole[inHoleIdx].x + "/" + hole[inHoleIdx].y ); - return false; - - } - - // Check if shape point lies within angle around hole point - var lastHoleIdx = hole.length - 1; - - var prevHoleIdx = inHoleIdx - 1; - if ( prevHoleIdx < 0 ) prevHoleIdx = lastHoleIdx; - - var nextHoleIdx = inHoleIdx + 1; - if ( nextHoleIdx > lastHoleIdx ) nextHoleIdx = 0; - - insideAngle = isPointInsideAngle( hole[ inHoleIdx ], hole[ prevHoleIdx ], hole[ nextHoleIdx ], shape[ inShapeIdx ] ); - if ( ! insideAngle ) { - - // console.log( "Vertex (Hole): " + inHoleIdx + ", Point: " + shape[inShapeIdx].x + "/" + shape[inShapeIdx].y ); - return false; - - } - - return true; - - } - - function intersectsShapeEdge( inShapePt, inHolePt ) { - - // checks for intersections with shape edges - var sIdx, nextIdx, intersection; - for ( sIdx = 0; sIdx < shape.length; sIdx ++ ) { - - nextIdx = sIdx + 1; nextIdx %= shape.length; - intersection = intersect_segments_2D( inShapePt, inHolePt, shape[ sIdx ], shape[ nextIdx ], true ); - if ( intersection.length > 0 ) return true; - - } - - return false; - - } - - var indepHoles = []; - - function intersectsHoleEdge( inShapePt, inHolePt ) { - - // checks for intersections with hole edges - var ihIdx, chkHole, - hIdx, nextIdx, intersection; - for ( ihIdx = 0; ihIdx < indepHoles.length; ihIdx ++ ) { - - chkHole = holes[ indepHoles[ ihIdx ]]; - for ( hIdx = 0; hIdx < chkHole.length; hIdx ++ ) { - - nextIdx = hIdx + 1; nextIdx %= chkHole.length; - intersection = intersect_segments_2D( inShapePt, inHolePt, chkHole[ hIdx ], chkHole[ nextIdx ], true ); - if ( intersection.length > 0 ) return true; - - } - - } - return false; - - } - - var holeIndex, shapeIndex, - shapePt, holePt, - holeIdx, cutKey, failedCuts = [], - tmpShape1, tmpShape2, - tmpHole1, tmpHole2; - - for ( var h = 0, hl = holes.length; h < hl; h ++ ) { - - indepHoles.push( h ); - - } - - var minShapeIndex = 0; - var counter = indepHoles.length * 2; - while ( indepHoles.length > 0 ) { - - counter --; - if ( counter < 0 ) { - - console.log( "Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!" ); - break; - - } - - // search for shape-vertex and hole-vertex, - // which can be connected without intersections - for ( shapeIndex = minShapeIndex; shapeIndex < shape.length; shapeIndex ++ ) { - - shapePt = shape[ shapeIndex ]; - holeIndex = - 1; - - // search for hole which can be reached without intersections - for ( var h = 0; h < indepHoles.length; h ++ ) { - - holeIdx = indepHoles[ h ]; - - // prevent multiple checks - cutKey = shapePt.x + ":" + shapePt.y + ":" + holeIdx; - if ( failedCuts[ cutKey ] !== undefined ) continue; - - hole = holes[ holeIdx ]; - for ( var h2 = 0; h2 < hole.length; h2 ++ ) { - - holePt = hole[ h2 ]; - if ( ! isCutLineInsideAngles( shapeIndex, h2 ) ) continue; - if ( intersectsShapeEdge( shapePt, holePt ) ) continue; - if ( intersectsHoleEdge( shapePt, holePt ) ) continue; - - holeIndex = h2; - indepHoles.splice( h, 1 ); - - tmpShape1 = shape.slice( 0, shapeIndex + 1 ); - tmpShape2 = shape.slice( shapeIndex ); - tmpHole1 = hole.slice( holeIndex ); - tmpHole2 = hole.slice( 0, holeIndex + 1 ); - - shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 ); - - minShapeIndex = shapeIndex; - - // Debug only, to show the selected cuts - // glob_CutLines.push( [ shapePt, holePt ] ); - - break; - - } - if ( holeIndex >= 0 ) break; // hole-vertex found - - failedCuts[ cutKey ] = true; // remember failure - - } - if ( holeIndex >= 0 ) break; // hole-vertex found - - } - - } - - return shape; /* shape with no holes */ - - } - - - var i, il, f, face, - key, index, - allPointsMap = {}; - - // To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first. - - var allpoints = contour.concat(); - - for ( var h = 0, hl = holes.length; h < hl; h ++ ) { - - Array.prototype.push.apply( allpoints, holes[ h ] ); - - } - - //console.log( "allpoints",allpoints, allpoints.length ); - - // prepare all points map - - for ( i = 0, il = allpoints.length; i < il; i ++ ) { - - key = allpoints[ i ].x + ":" + allpoints[ i ].y; - - if ( allPointsMap[ key ] !== undefined ) { - - console.warn( "THREE.ShapeUtils: Duplicate point", key, i ); - - } - - allPointsMap[ key ] = i; - - } - - // remove holes by cutting paths to holes and adding them to the shape - var shapeWithoutHoles = removeHoles( contour, holes ); - - var triangles = ShapeUtils.triangulate( shapeWithoutHoles, false ); // True returns indices for points of spooled shape - //console.log( "triangles",triangles, triangles.length ); - - // check all face vertices against all points map - - for ( i = 0, il = triangles.length; i < il; i ++ ) { - - face = triangles[ i ]; - - for ( f = 0; f < 3; f ++ ) { - - key = face[ f ].x + ":" + face[ f ].y; - - index = allPointsMap[ key ]; - - if ( index !== undefined ) { - - face[ f ] = index; - - } - - } - - } - - return triangles.concat(); - - }, - - isClockWise: function ( pts ) { - - return ShapeUtils.area( pts ) < 0; - - }, - - // Bezier Curves formulas obtained from - // http://en.wikipedia.org/wiki/B%C3%A9zier_curve - - // Quad Bezier Functions - - b2: ( function () { - - function b2p0( t, p ) { - - var k = 1 - t; - return k * k * p; - - } - - function b2p1( t, p ) { - - return 2 * ( 1 - t ) * t * p; - - } - - function b2p2( t, p ) { - - return t * t * p; - - } - - return function b2( t, p0, p1, p2 ) { - - return b2p0( t, p0 ) + b2p1( t, p1 ) + b2p2( t, p2 ); - - }; - - } )(), - - // Cubic Bezier Functions - - b3: ( function () { - - function b3p0( t, p ) { - - var k = 1 - t; - return k * k * k * p; - - } - - function b3p1( t, p ) { - - var k = 1 - t; - return 3 * k * k * t * p; - - } - - function b3p2( t, p ) { - - var k = 1 - t; - return 3 * k * t * t * p; - - } - - function b3p3( t, p ) { - - return t * t * t * p; - - } - - return function b3( t, p0, p1, p2, p3 ) { - - return b3p0( t, p0 ) + b3p1( t, p1 ) + b3p2( t, p2 ) + b3p3( t, p3 ); - - }; - - } )() - -}; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * - * Creates extruded geometry from a path shape. - * - * parameters = { - * - * curveSegments: <int>, // number of points on the curves - * steps: <int>, // number of points for z-side extrusions / used for subdividing segments of extrude spline too - * amount: <int>, // Depth to extrude the shape - * - * bevelEnabled: <bool>, // turn on bevel - * bevelThickness: <float>, // how deep into the original shape bevel goes - * bevelSize: <float>, // how far from shape outline is bevel - * bevelSegments: <int>, // number of bevel layers - * - * extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined) - * frames: <Object> // containing arrays of tangents, normals, binormals - * - * uvGenerator: <Object> // object that provides UV generator functions - * - * } - **/ - -function ExtrudeGeometry( shapes, options ) { - - if ( typeof( shapes ) === "undefined" ) { - - shapes = []; - return; - - } - - Geometry.call( this ); - - this.type = 'ExtrudeGeometry'; - - shapes = Array.isArray( shapes ) ? shapes : [ shapes ]; - - this.addShapeList( shapes, options ); - - this.computeFaceNormals(); - - // can't really use automatic vertex normals - // as then front and back sides get smoothed too - // should do separate smoothing just for sides - - //this.computeVertexNormals(); - - //console.log( "took", ( Date.now() - startTime ) ); - -} - -ExtrudeGeometry.prototype = Object.create( Geometry.prototype ); -ExtrudeGeometry.prototype.constructor = ExtrudeGeometry; - -ExtrudeGeometry.prototype.addShapeList = function ( shapes, options ) { - - var sl = shapes.length; - - for ( var s = 0; s < sl; s ++ ) { - - var shape = shapes[ s ]; - this.addShape( shape, options ); - - } - -}; - -ExtrudeGeometry.prototype.addShape = function ( shape, options ) { - - var amount = options.amount !== undefined ? options.amount : 100; - - var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; // 10 - var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; // 8 - var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3; - - var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false - - var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - - var steps = options.steps !== undefined ? options.steps : 1; - - var extrudePath = options.extrudePath; - var extrudePts, extrudeByPath = false; - - // Use default WorldUVGenerator if no UV generators are specified. - var uvgen = options.UVGenerator !== undefined ? options.UVGenerator : ExtrudeGeometry.WorldUVGenerator; - - var splineTube, binormal, normal, position2; - if ( extrudePath ) { - - extrudePts = extrudePath.getSpacedPoints( steps ); - - extrudeByPath = true; - bevelEnabled = false; // bevels not supported for path extrusion - - // SETUP TNB variables - - // TODO1 - have a .isClosed in spline? - - splineTube = options.frames !== undefined ? options.frames : extrudePath.computeFrenetFrames( steps, false ); - - // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); - - binormal = new Vector3(); - normal = new Vector3(); - position2 = new Vector3(); - - } - - // Safeguards if bevels are not enabled - - if ( ! bevelEnabled ) { - - bevelSegments = 0; - bevelThickness = 0; - bevelSize = 0; - - } - - // Variables initialization - - var ahole, h, hl; // looping of holes - var scope = this; - - var shapesOffset = this.vertices.length; - - var shapePoints = shape.extractPoints( curveSegments ); - - var vertices = shapePoints.shape; - var holes = shapePoints.holes; - - var reverse = ! ShapeUtils.isClockWise( vertices ); - - if ( reverse ) { - - vertices = vertices.reverse(); - - // Maybe we should also check if holes are in the opposite direction, just to be safe ... - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - if ( ShapeUtils.isClockWise( ahole ) ) { - - holes[ h ] = ahole.reverse(); - - } - - } - - reverse = false; // If vertices are in order now, we shouldn't need to worry about them again (hopefully)! - - } - - - var faces = ShapeUtils.triangulateShape( vertices, holes ); - - /* Vertices */ - - var contour = vertices; // vertices has all points but contour has only points of circumference - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - vertices = vertices.concat( ahole ); - - } - - - function scalePt2( pt, vec, size ) { - - if ( ! vec ) console.error( "THREE.ExtrudeGeometry: vec does not exist" ); - - return vec.clone().multiplyScalar( size ).add( pt ); - - } - - var b, bs, t, z, - vert, vlen = vertices.length, - face, flen = faces.length; - - - // Find directions for point movement - - - function getBevelVec( inPt, inPrev, inNext ) { - - // computes for inPt the corresponding point inPt' on a new contour - // shifted by 1 unit (length of normalized vector) to the left - // if we walk along contour clockwise, this new contour is outside the old one - // - // inPt' is the intersection of the two lines parallel to the two - // adjacent edges of inPt at a distance of 1 unit on the left side. - - var v_trans_x, v_trans_y, shrink_by = 1; // resulting translation vector for inPt - - // good reading for geometry algorithms (here: line-line intersection) - // http://geomalgorithms.com/a05-_intersect-1.html - - var v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y; - var v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y; - - var v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y ); - - // check for collinear edges - var collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - if ( Math.abs( collinear0 ) > Number.EPSILON ) { - - // not collinear - - // length of vectors for normalizing - - var v_prev_len = Math.sqrt( v_prev_lensq ); - var v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y ); - - // shift adjacent points by unit vectors to the left - - var ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len ); - var ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len ); - - var ptNextShift_x = ( inNext.x - v_next_y / v_next_len ); - var ptNextShift_y = ( inNext.y + v_next_x / v_next_len ); - - // scaling factor for v_prev to intersection point - - var sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y - - ( ptNextShift_y - ptPrevShift_y ) * v_next_x ) / - ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - // vector from inPt to intersection point - - v_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x ); - v_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y ); - - // Don't normalize!, otherwise sharp corners become ugly - // but prevent crazy spikes - var v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y ); - if ( v_trans_lensq <= 2 ) { - - return new Vector2( v_trans_x, v_trans_y ); - - } else { - - shrink_by = Math.sqrt( v_trans_lensq / 2 ); - - } - - } else { - - // handle special case of collinear edges - - var direction_eq = false; // assumes: opposite - if ( v_prev_x > Number.EPSILON ) { - - if ( v_next_x > Number.EPSILON ) { - - direction_eq = true; - - } - - } else { - - if ( v_prev_x < - Number.EPSILON ) { - - if ( v_next_x < - Number.EPSILON ) { - - direction_eq = true; - - } - - } else { - - if ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) { - - direction_eq = true; - - } - - } - - } - - if ( direction_eq ) { - - // console.log("Warning: lines are a straight sequence"); - v_trans_x = - v_prev_y; - v_trans_y = v_prev_x; - shrink_by = Math.sqrt( v_prev_lensq ); - - } else { - - // console.log("Warning: lines are a straight spike"); - v_trans_x = v_prev_x; - v_trans_y = v_prev_y; - shrink_by = Math.sqrt( v_prev_lensq / 2 ); - - } - - } - - return new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by ); - - } - - - var contourMovements = []; - - for ( var i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - // console.log('i,j,k', i, j , k) - - contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] ); - - } - - var holesMovements = [], oneHoleMovements, verticesMovements = contourMovements.concat(); - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - oneHoleMovements = []; - - for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - oneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] ); - - } - - holesMovements.push( oneHoleMovements ); - verticesMovements = verticesMovements.concat( oneHoleMovements ); - - } - - - // Loop bevelSegments, 1 for the front, 1 for the back - - for ( b = 0; b < bevelSegments; b ++ ) { - - //for ( b = bevelSegments; b > 0; b -- ) { - - t = b / bevelSegments; - z = bevelThickness * Math.cos( t * Math.PI / 2 ); - bs = bevelSize * Math.sin( t * Math.PI / 2 ); - - // contract shape - - for ( i = 0, il = contour.length; i < il; i ++ ) { - - vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - - v( vert.x, vert.y, - z ); - - } - - // expand holes - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( i = 0, il = ahole.length; i < il; i ++ ) { - - vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - v( vert.x, vert.y, - z ); - - } - - } - - } - - bs = bevelSize; - - // Back facing vertices - - for ( i = 0; i < vlen; i ++ ) { - - vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, 0 ); - - } else { - - // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x ); - - normal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x ); - binormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y ); - - position2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal ); - - v( position2.x, position2.y, position2.z ); - - } - - } - - // Add stepped vertices... - // Including front facing vertices - - var s; - - for ( s = 1; s <= steps; s ++ ) { - - for ( i = 0; i < vlen; i ++ ) { - - vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, amount / steps * s ); - - } else { - - // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x ); - - normal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x ); - binormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y ); - - position2.copy( extrudePts[ s ] ).add( normal ).add( binormal ); - - v( position2.x, position2.y, position2.z ); - - } - - } - - } - - - // Add bevel segments planes - - //for ( b = 1; b <= bevelSegments; b ++ ) { - for ( b = bevelSegments - 1; b >= 0; b -- ) { - - t = b / bevelSegments; - z = bevelThickness * Math.cos ( t * Math.PI / 2 ); - bs = bevelSize * Math.sin( t * Math.PI / 2 ); - - // contract shape - - for ( i = 0, il = contour.length; i < il; i ++ ) { - - vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - v( vert.x, vert.y, amount + z ); - - } - - // expand holes - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( i = 0, il = ahole.length; i < il; i ++ ) { - - vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, amount + z ); - - } else { - - v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z ); - - } - - } - - } - - } - - /* Faces */ - - // Top and bottom faces - - buildLidFaces(); - - // Sides faces - - buildSideFaces(); - - - ///// Internal functions - - function buildLidFaces() { - - if ( bevelEnabled ) { - - var layer = 0; // steps + 1 - var offset = vlen * layer; - - // Bottom faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset ); - - } - - layer = steps + bevelSegments * 2; - offset = vlen * layer; - - // Top faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset ); - - } - - } else { - - // Bottom faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 2 ], face[ 1 ], face[ 0 ] ); - - } - - // Top faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps ); - - } - - } - - } - - // Create faces for the z-sides of the shape - - function buildSideFaces() { - - var layeroffset = 0; - sidewalls( contour, layeroffset ); - layeroffset += contour.length; - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - sidewalls( ahole, layeroffset ); - - //, true - layeroffset += ahole.length; - - } - - } - - function sidewalls( contour, layeroffset ) { - - var j, k; - i = contour.length; - - while ( -- i >= 0 ) { - - j = i; - k = i - 1; - if ( k < 0 ) k = contour.length - 1; - - //console.log('b', i,j, i-1, k,vertices.length); - - var s = 0, sl = steps + bevelSegments * 2; - - for ( s = 0; s < sl; s ++ ) { - - var slen1 = vlen * s; - var slen2 = vlen * ( s + 1 ); - - var a = layeroffset + j + slen1, - b = layeroffset + k + slen1, - c = layeroffset + k + slen2, - d = layeroffset + j + slen2; - - f4( a, b, c, d, contour, s, sl, j, k ); - - } - - } - - } - - - function v( x, y, z ) { - - scope.vertices.push( new Vector3( x, y, z ) ); - - } - - function f3( a, b, c ) { - - a += shapesOffset; - b += shapesOffset; - c += shapesOffset; - - scope.faces.push( new Face3( a, b, c, null, null, 0 ) ); - - var uvs = uvgen.generateTopUV( scope, a, b, c ); - - scope.faceVertexUvs[ 0 ].push( uvs ); - - } - - function f4( a, b, c, d, wallContour, stepIndex, stepsLength, contourIndex1, contourIndex2 ) { - - a += shapesOffset; - b += shapesOffset; - c += shapesOffset; - d += shapesOffset; - - scope.faces.push( new Face3( a, b, d, null, null, 1 ) ); - scope.faces.push( new Face3( b, c, d, null, null, 1 ) ); - - var uvs = uvgen.generateSideWallUV( scope, a, b, c, d ); - - scope.faceVertexUvs[ 0 ].push( [ uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] ] ); - scope.faceVertexUvs[ 0 ].push( [ uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] ] ); - - } - -}; - -ExtrudeGeometry.WorldUVGenerator = { - - generateTopUV: function ( geometry, indexA, indexB, indexC ) { - - var vertices = geometry.vertices; - - var a = vertices[ indexA ]; - var b = vertices[ indexB ]; - var c = vertices[ indexC ]; - - return [ - new Vector2( a.x, a.y ), - new Vector2( b.x, b.y ), - new Vector2( c.x, c.y ) - ]; - - }, - - generateSideWallUV: function ( geometry, indexA, indexB, indexC, indexD ) { - - var vertices = geometry.vertices; - - var a = vertices[ indexA ]; - var b = vertices[ indexB ]; - var c = vertices[ indexC ]; - var d = vertices[ indexD ]; - - if ( Math.abs( a.y - b.y ) < 0.01 ) { - - return [ - new Vector2( a.x, 1 - a.z ), - new Vector2( b.x, 1 - b.z ), - new Vector2( c.x, 1 - c.z ), - new Vector2( d.x, 1 - d.z ) - ]; - - } else { - - return [ - new Vector2( a.y, 1 - a.z ), - new Vector2( b.y, 1 - b.z ), - new Vector2( c.y, 1 - c.z ), - new Vector2( d.y, 1 - d.z ) - ]; - - } - - } -}; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author alteredq / http://alteredqualia.com/ - * - * Text = 3D Text - * - * parameters = { - * font: <THREE.Font>, // font - * - * size: <float>, // size of the text - * height: <float>, // thickness to extrude text - * curveSegments: <int>, // number of points on the curves - * - * bevelEnabled: <bool>, // turn on bevel - * bevelThickness: <float>, // how deep into text bevel goes - * bevelSize: <float> // how far from text outline is bevel - * } - */ - -function TextGeometry( text, parameters ) { - - parameters = parameters || {}; - - var font = parameters.font; - - if ( (font && font.isFont) === false ) { - - console.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' ); - return new Geometry(); - - } - - var shapes = font.generateShapes( text, parameters.size, parameters.curveSegments ); - - // translate parameters to ExtrudeGeometry API - - parameters.amount = parameters.height !== undefined ? parameters.height : 50; - - // defaults - - if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10; - if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; - if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; - - ExtrudeGeometry.call( this, shapes, parameters ); - - this.type = 'TextGeometry'; - -} - -TextGeometry.prototype = Object.create( ExtrudeGeometry.prototype ); -TextGeometry.prototype.constructor = TextGeometry; - -/** - * @author benaadams / https://twitter.com/ben_a_adams - * based on THREE.SphereGeometry - */ - -function SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) { - - BufferGeometry.call( this ); - - this.type = 'SphereBufferGeometry'; - - this.parameters = { - radius: radius, - widthSegments: widthSegments, - heightSegments: heightSegments, - phiStart: phiStart, - phiLength: phiLength, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - radius = radius || 50; - - widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 ); - heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 ); - - phiStart = phiStart !== undefined ? phiStart : 0; - phiLength = phiLength !== undefined ? phiLength : Math.PI * 2; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI; - - var thetaEnd = thetaStart + thetaLength; - - var vertexCount = ( ( widthSegments + 1 ) * ( heightSegments + 1 ) ); - - var positions = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - var index = 0, vertices = [], normal = new Vector3(); - - for ( var y = 0; y <= heightSegments; y ++ ) { - - var verticesRow = []; - - var v = y / heightSegments; - - for ( var x = 0; x <= widthSegments; x ++ ) { - - var u = x / widthSegments; - - var px = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - var py = radius * Math.cos( thetaStart + v * thetaLength ); - var pz = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - - normal.set( px, py, pz ).normalize(); - - positions.setXYZ( index, px, py, pz ); - normals.setXYZ( index, normal.x, normal.y, normal.z ); - uvs.setXY( index, u, 1 - v ); - - verticesRow.push( index ); - - index ++; - - } - - vertices.push( verticesRow ); - - } - - var indices = []; - - for ( var y = 0; y < heightSegments; y ++ ) { - - for ( var x = 0; x < widthSegments; x ++ ) { - - var v1 = vertices[ y ][ x + 1 ]; - var v2 = vertices[ y ][ x ]; - var v3 = vertices[ y + 1 ][ x ]; - var v4 = vertices[ y + 1 ][ x + 1 ]; - - if ( y !== 0 || thetaStart > 0 ) indices.push( v1, v2, v4 ); - if ( y !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( v2, v3, v4 ); - - } - - } - - this.setIndex( new ( positions.count > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ) ); - this.addAttribute( 'position', positions ); - this.addAttribute( 'normal', normals ); - this.addAttribute( 'uv', uvs ); - - this.boundingSphere = new Sphere( new Vector3(), radius ); - -} - -SphereBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -SphereBufferGeometry.prototype.constructor = SphereBufferGeometry; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function SphereGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) { - - Geometry.call( this ); - - this.type = 'SphereGeometry'; - - this.parameters = { - radius: radius, - widthSegments: widthSegments, - heightSegments: heightSegments, - phiStart: phiStart, - phiLength: phiLength, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - this.fromBufferGeometry( new SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) ); - -} - -SphereGeometry.prototype = Object.create( Geometry.prototype ); -SphereGeometry.prototype.constructor = SphereGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) { - - BufferGeometry.call( this ); - - this.type = 'RingBufferGeometry'; - - this.parameters = { - innerRadius: innerRadius, - outerRadius: outerRadius, - thetaSegments: thetaSegments, - phiSegments: phiSegments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - innerRadius = innerRadius || 20; - outerRadius = outerRadius || 50; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - thetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8; - phiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 1; - - // these are used to calculate buffer length - var vertexCount = ( thetaSegments + 1 ) * ( phiSegments + 1 ); - var indexCount = thetaSegments * phiSegments * 2 * 3; - - // buffers - var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ) , 1 ); - var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - // some helper variables - var index = 0, indexOffset = 0, segment; - var radius = innerRadius; - var radiusStep = ( ( outerRadius - innerRadius ) / phiSegments ); - var vertex = new Vector3(); - var uv = new Vector2(); - var j, i; - - // generate vertices, normals and uvs - - // values are generate from the inside of the ring to the outside - - for ( j = 0; j <= phiSegments; j ++ ) { - - for ( i = 0; i <= thetaSegments; i ++ ) { - - segment = thetaStart + i / thetaSegments * thetaLength; - - // vertex - vertex.x = radius * Math.cos( segment ); - vertex.y = radius * Math.sin( segment ); - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // normal - normals.setXYZ( index, 0, 0, 1 ); - - // uv - uv.x = ( vertex.x / outerRadius + 1 ) / 2; - uv.y = ( vertex.y / outerRadius + 1 ) / 2; - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index++; - - } - - // increase the radius for next row of vertices - radius += radiusStep; - - } - - // generate indices - - for ( j = 0; j < phiSegments; j ++ ) { - - var thetaSegmentLevel = j * ( thetaSegments + 1 ); - - for ( i = 0; i < thetaSegments; i ++ ) { - - segment = i + thetaSegmentLevel; - - // indices - var a = segment; - var b = segment + thetaSegments + 1; - var c = segment + thetaSegments + 2; - var d = segment + 1; - - // face one - indices.setX( indexOffset, a ); indexOffset++; - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, c ); indexOffset++; - - // face two - indices.setX( indexOffset, a ); indexOffset++; - indices.setX( indexOffset, c ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - } - - } - - // build geometry - - this.setIndex( indices ); - this.addAttribute( 'position', vertices ); - this.addAttribute( 'normal', normals ); - this.addAttribute( 'uv', uvs ); - -} - -RingBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -RingBufferGeometry.prototype.constructor = RingBufferGeometry; - -/** - * @author Kaleb Murphy - */ - -function RingGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) { - - Geometry.call( this ); - - this.type = 'RingGeometry'; - - this.parameters = { - innerRadius: innerRadius, - outerRadius: outerRadius, - thetaSegments: thetaSegments, - phiSegments: phiSegments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - this.fromBufferGeometry( new RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) ); - -} - -RingGeometry.prototype = Object.create( Geometry.prototype ); -RingGeometry.prototype.constructor = RingGeometry; - -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -function PlaneGeometry( width, height, widthSegments, heightSegments ) { - - Geometry.call( this ); - - this.type = 'PlaneGeometry'; - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments - }; - - this.fromBufferGeometry( new PlaneBufferGeometry( width, height, widthSegments, heightSegments ) ); - -} - -PlaneGeometry.prototype = Object.create( Geometry.prototype ); -PlaneGeometry.prototype.constructor = PlaneGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - - // points - to create a closed torus, one must use a set of points - // like so: [ a, b, c, d, a ], see first is the same as last. - // segments - the number of circumference segments to create - // phiStart - the starting radian - // phiLength - the radian (0 to 2PI) range of the lathed section - // 2PI is a closed lathe, less than 2PI is a portion. - -function LatheBufferGeometry( points, segments, phiStart, phiLength ) { - - BufferGeometry.call( this ); - - this.type = 'LatheBufferGeometry'; - - this.parameters = { - points: points, - segments: segments, - phiStart: phiStart, - phiLength: phiLength - }; - - segments = Math.floor( segments ) || 12; - phiStart = phiStart || 0; - phiLength = phiLength || Math.PI * 2; - - // clamp phiLength so it's in range of [ 0, 2PI ] - phiLength = _Math.clamp( phiLength, 0, Math.PI * 2 ); - - // these are used to calculate buffer length - var vertexCount = ( segments + 1 ) * points.length; - var indexCount = segments * points.length * 2 * 3; - - // buffers - var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ) , 1 ); - var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - // helper variables - var index = 0, indexOffset = 0, base; - var inverseSegments = 1.0 / segments; - var vertex = new Vector3(); - var uv = new Vector2(); - var i, j; - - // generate vertices and uvs - - for ( i = 0; i <= segments; i ++ ) { - - var phi = phiStart + i * inverseSegments * phiLength; - - var sin = Math.sin( phi ); - var cos = Math.cos( phi ); - - for ( j = 0; j <= ( points.length - 1 ); j ++ ) { - - // vertex - vertex.x = points[ j ].x * sin; - vertex.y = points[ j ].y; - vertex.z = points[ j ].x * cos; - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // uv - uv.x = i / segments; - uv.y = j / ( points.length - 1 ); - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index ++; - - } - - } - - // generate indices - - for ( i = 0; i < segments; i ++ ) { - - for ( j = 0; j < ( points.length - 1 ); j ++ ) { - - base = j + i * points.length; - - // indices - var a = base; - var b = base + points.length; - var c = base + points.length + 1; - var d = base + 1; - - // face one - indices.setX( indexOffset, a ); indexOffset++; - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - // face two - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, c ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - } - - } - - // build geometry - - this.setIndex( indices ); - this.addAttribute( 'position', vertices ); - this.addAttribute( 'uv', uvs ); - - // generate normals - - this.computeVertexNormals(); - - // if the geometry is closed, we need to average the normals along the seam. - // because the corresponding vertices are identical (but still have different UVs). - - if( phiLength === Math.PI * 2 ) { - - var normals = this.attributes.normal.array; - var n1 = new Vector3(); - var n2 = new Vector3(); - var n = new Vector3(); - - // this is the buffer offset for the last line of vertices - base = segments * points.length * 3; - - for( i = 0, j = 0; i < points.length; i ++, j += 3 ) { - - // select the normal of the vertex in the first line - n1.x = normals[ j + 0 ]; - n1.y = normals[ j + 1 ]; - n1.z = normals[ j + 2 ]; - - // select the normal of the vertex in the last line - n2.x = normals[ base + j + 0 ]; - n2.y = normals[ base + j + 1 ]; - n2.z = normals[ base + j + 2 ]; - - // average normals - n.addVectors( n1, n2 ).normalize(); - - // assign the new values to both normals - normals[ j + 0 ] = normals[ base + j + 0 ] = n.x; - normals[ j + 1 ] = normals[ base + j + 1 ] = n.y; - normals[ j + 2 ] = normals[ base + j + 2 ] = n.z; - - } // next row - - } - -} - -LatheBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -LatheBufferGeometry.prototype.constructor = LatheBufferGeometry; - -/** - * @author astrodud / http://astrodud.isgreat.org/ - * @author zz85 / https://github.com/zz85 - * @author bhouston / http://clara.io - */ - -// points - to create a closed torus, one must use a set of points -// like so: [ a, b, c, d, a ], see first is the same as last. -// segments - the number of circumference segments to create -// phiStart - the starting radian -// phiLength - the radian (0 to 2PI) range of the lathed section -// 2PI is a closed lathe, less than 2PI is a portion. - -function LatheGeometry( points, segments, phiStart, phiLength ) { - - Geometry.call( this ); - - this.type = 'LatheGeometry'; - - this.parameters = { - points: points, - segments: segments, - phiStart: phiStart, - phiLength: phiLength - }; - - this.fromBufferGeometry( new LatheBufferGeometry( points, segments, phiStart, phiLength ) ); - this.mergeVertices(); - -} - -LatheGeometry.prototype = Object.create( Geometry.prototype ); -LatheGeometry.prototype.constructor = LatheGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - * - * Creates a one-sided polygonal geometry from one or more shapes. - * - **/ - -function ShapeBufferGeometry( shapes, curveSegments ) { - - BufferGeometry.call( this ); - - this.type = 'ShapeBufferGeometry'; - - this.parameters = { - shapes: shapes, - curveSegments: curveSegments - }; - - curveSegments = curveSegments || 12; - - var vertices = []; - var normals = []; - var uvs = []; - var indices = []; - - var groupStart = 0; - var groupCount = 0; - - // allow single and array values for "shapes" parameter - - if ( Array.isArray( shapes ) === false ) { - - addShape( shapes ); - - } else { - - for ( var i = 0; i < shapes.length; i++ ) { - - addShape( shapes[ i ] ); - - this.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support - - groupStart += groupCount; - groupCount = 0; - - } - - } - - // build geometry - - this.setIndex( new ( indices.length > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ) ); - this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - - // helper functions - - function addShape( shape ) { - - var i, l, shapeHole; - - var indexOffset = vertices.length / 3; - var points = shape.extractPoints( curveSegments ); - - var shapeVertices = points.shape; - var shapeHoles = points.holes; - - // check direction of vertices - - if ( ShapeUtils.isClockWise( shapeVertices ) === false ) { - - shapeVertices = shapeVertices.reverse(); - - // also check if holes are in the opposite direction - - for ( i = 0, l = shapeHoles.length; i < l; i ++ ) { - - shapeHole = shapeHoles[ i ]; - - if ( ShapeUtils.isClockWise( shapeHole ) === true ) { - - shapeHoles[ i ] = shapeHole.reverse(); - - } - - } - - } - - var faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles ); - - // join vertices of inner and outer paths to a single array - - for ( i = 0, l = shapeHoles.length; i < l; i ++ ) { - - shapeHole = shapeHoles[ i ]; - shapeVertices = shapeVertices.concat( shapeHole ); - - } - - // vertices, normals, uvs - - for ( i = 0, l = shapeVertices.length; i < l; i ++ ) { - - var vertex = shapeVertices[ i ]; - - vertices.push( vertex.x, vertex.y, 0 ); - normals.push( 0, 0, 1 ); - uvs.push( vertex.x, vertex.y ); // world uvs - - } - - // incides - - for ( i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - var a = face[ 0 ] + indexOffset; - var b = face[ 1 ] + indexOffset; - var c = face[ 2 ] + indexOffset; - - indices.push( a, b, c ); - groupCount += 3; - - } - - } - -} - -ShapeBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -ShapeBufferGeometry.prototype.constructor = ShapeBufferGeometry; - -/** - * @author jonobr1 / http://jonobr1.com - * - * Creates a one-sided polygonal geometry from a path shape. - * - **/ - -function ShapeGeometry( shapes, curveSegments ) { - - Geometry.call( this ); - - this.type = 'ShapeGeometry'; - - if ( typeof curveSegments === 'object' ) { - - console.warn( 'THREE.ShapeGeometry: Options parameter has been removed.' ); - - curveSegments = curveSegments.curveSegments; - - } - - this.parameters = { - shapes: shapes, - curveSegments: curveSegments - }; - - this.fromBufferGeometry( new ShapeBufferGeometry( shapes, curveSegments ) ); - this.mergeVertices(); - -} - -ShapeGeometry.prototype = Object.create( Geometry.prototype ); -ShapeGeometry.prototype.constructor = ShapeGeometry; - -/** - * @author WestLangley / http://github.com/WestLangley - */ - -function EdgesGeometry( geometry, thresholdAngle ) { - - BufferGeometry.call( this ); - - thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1; - - var thresholdDot = Math.cos( _Math.DEG2RAD * thresholdAngle ); - - var edge = [ 0, 0 ], hash = {}; - - function sortFunction( a, b ) { - - return a - b; - - } - - var keys = [ 'a', 'b', 'c' ]; - - var geometry2; - - if ( geometry.isBufferGeometry ) { - - geometry2 = new Geometry(); - geometry2.fromBufferGeometry( geometry ); - - } else { - - geometry2 = geometry.clone(); - - } - - geometry2.mergeVertices(); - geometry2.computeFaceNormals(); - - var vertices = geometry2.vertices; - var faces = geometry2.faces; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = face[ keys[ j ] ]; - edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - hash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined }; - - } else { - - hash[ key ].face2 = i; - - } - - } - - } - - var coords = []; - - for ( var key in hash ) { - - var h = hash[ key ]; - - if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) { - - var vertex = vertices[ h.vert1 ]; - coords.push( vertex.x ); - coords.push( vertex.y ); - coords.push( vertex.z ); - - vertex = vertices[ h.vert2 ]; - coords.push( vertex.x ); - coords.push( vertex.y ); - coords.push( vertex.z ); - - } - - } - - this.addAttribute( 'position', new BufferAttribute( new Float32Array( coords ), 3 ) ); - -} - -EdgesGeometry.prototype = Object.create( BufferGeometry.prototype ); -EdgesGeometry.prototype.constructor = EdgesGeometry; - -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) { - - BufferGeometry.call( this ); - - this.type = 'CylinderBufferGeometry'; - - this.parameters = { - radiusTop: radiusTop, - radiusBottom: radiusBottom, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - var scope = this; - - radiusTop = radiusTop !== undefined ? radiusTop : 20; - radiusBottom = radiusBottom !== undefined ? radiusBottom : 20; - height = height !== undefined ? height : 100; - - radialSegments = Math.floor( radialSegments ) || 8; - heightSegments = Math.floor( heightSegments ) || 1; - - openEnded = openEnded !== undefined ? openEnded : false; - thetaStart = thetaStart !== undefined ? thetaStart : 0.0; - thetaLength = thetaLength !== undefined ? thetaLength : 2.0 * Math.PI; - - // used to calculate buffer length - - var nbCap = 0; - - if ( openEnded === false ) { - - if ( radiusTop > 0 ) nbCap ++; - if ( radiusBottom > 0 ) nbCap ++; - - } - - var vertexCount = calculateVertexCount(); - var indexCount = calculateIndexCount(); - - // buffers - - var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ), 1 ); - var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - // helper variables - - var index = 0, - indexOffset = 0, - indexArray = [], - halfHeight = height / 2; - - // group variables - var groupStart = 0; - - // generate geometry - - generateTorso(); - - if ( openEnded === false ) { - - if ( radiusTop > 0 ) generateCap( true ); - if ( radiusBottom > 0 ) generateCap( false ); - - } - - // build geometry - - this.setIndex( indices ); - this.addAttribute( 'position', vertices ); - this.addAttribute( 'normal', normals ); - this.addAttribute( 'uv', uvs ); - - // helper functions - - function calculateVertexCount() { - - var count = ( radialSegments + 1 ) * ( heightSegments + 1 ); - - if ( openEnded === false ) { - - count += ( ( radialSegments + 1 ) * nbCap ) + ( radialSegments * nbCap ); - - } - - return count; - - } - - function calculateIndexCount() { - - var count = radialSegments * heightSegments * 2 * 3; - - if ( openEnded === false ) { - - count += radialSegments * nbCap * 3; - - } - - return count; - - } - - function generateTorso() { - - var x, y; - var normal = new Vector3(); - var vertex = new Vector3(); - - var groupCount = 0; - - // this will be used to calculate the normal - var slope = ( radiusBottom - radiusTop ) / height; - - // generate vertices, normals and uvs - - for ( y = 0; y <= heightSegments; y ++ ) { - - var indexRow = []; - - var v = y / heightSegments; - - // calculate the radius of the current row - var radius = v * ( radiusBottom - radiusTop ) + radiusTop; - - for ( x = 0; x <= radialSegments; x ++ ) { - - var u = x / radialSegments; - - var theta = u * thetaLength + thetaStart; - - var sinTheta = Math.sin( theta ); - var cosTheta = Math.cos( theta ); - - // vertex - vertex.x = radius * sinTheta; - vertex.y = - v * height + halfHeight; - vertex.z = radius * cosTheta; - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // normal - normal.set( sinTheta, slope, cosTheta ).normalize(); - normals.setXYZ( index, normal.x, normal.y, normal.z ); - - // uv - uvs.setXY( index, u, 1 - v ); - - // save index of vertex in respective row - indexRow.push( index ); - - // increase index - index ++; - - } - - // now save vertices of the row in our index array - indexArray.push( indexRow ); - - } - - // generate indices - - for ( x = 0; x < radialSegments; x ++ ) { - - for ( y = 0; y < heightSegments; y ++ ) { - - // we use the index array to access the correct indices - var i1 = indexArray[ y ][ x ]; - var i2 = indexArray[ y + 1 ][ x ]; - var i3 = indexArray[ y + 1 ][ x + 1 ]; - var i4 = indexArray[ y ][ x + 1 ]; - - // face one - indices.setX( indexOffset, i1 ); indexOffset ++; - indices.setX( indexOffset, i2 ); indexOffset ++; - indices.setX( indexOffset, i4 ); indexOffset ++; - - // face two - indices.setX( indexOffset, i2 ); indexOffset ++; - indices.setX( indexOffset, i3 ); indexOffset ++; - indices.setX( indexOffset, i4 ); indexOffset ++; - - // update counters - groupCount += 6; - - } - - } - - // add a group to the geometry. this will ensure multi material support - scope.addGroup( groupStart, groupCount, 0 ); - - // calculate new start value for groups - groupStart += groupCount; - - } - - function generateCap( top ) { - - var x, centerIndexStart, centerIndexEnd; - - var uv = new Vector2(); - var vertex = new Vector3(); - - var groupCount = 0; - - var radius = ( top === true ) ? radiusTop : radiusBottom; - var sign = ( top === true ) ? 1 : - 1; - - // save the index of the first center vertex - centerIndexStart = index; - - // first we generate the center vertex data of the cap. - // because the geometry needs one set of uvs per face, - // we must generate a center vertex per face/segment - - for ( x = 1; x <= radialSegments; x ++ ) { - - // vertex - vertices.setXYZ( index, 0, halfHeight * sign, 0 ); - - // normal - normals.setXYZ( index, 0, sign, 0 ); - - // uv - uv.x = 0.5; - uv.y = 0.5; - - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index ++; - - } - - // save the index of the last center vertex - centerIndexEnd = index; - - // now we generate the surrounding vertices, normals and uvs - - for ( x = 0; x <= radialSegments; x ++ ) { - - var u = x / radialSegments; - var theta = u * thetaLength + thetaStart; - - var cosTheta = Math.cos( theta ); - var sinTheta = Math.sin( theta ); - - // vertex - vertex.x = radius * sinTheta; - vertex.y = halfHeight * sign; - vertex.z = radius * cosTheta; - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // normal - normals.setXYZ( index, 0, sign, 0 ); - - // uv - uv.x = ( cosTheta * 0.5 ) + 0.5; - uv.y = ( sinTheta * 0.5 * sign ) + 0.5; - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index ++; - - } - - // generate indices - - for ( x = 0; x < radialSegments; x ++ ) { - - var c = centerIndexStart + x; - var i = centerIndexEnd + x; - - if ( top === true ) { - - // face top - indices.setX( indexOffset, i ); indexOffset ++; - indices.setX( indexOffset, i + 1 ); indexOffset ++; - indices.setX( indexOffset, c ); indexOffset ++; - - } else { - - // face bottom - indices.setX( indexOffset, i + 1 ); indexOffset ++; - indices.setX( indexOffset, i ); indexOffset ++; - indices.setX( indexOffset, c ); indexOffset ++; - - } - - // update counters - groupCount += 3; - - } - - // add a group to the geometry. this will ensure multi material support - scope.addGroup( groupStart, groupCount, top === true ? 1 : 2 ); - - // calculate new start value for groups - groupStart += groupCount; - - } - -} - -CylinderBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -CylinderBufferGeometry.prototype.constructor = CylinderBufferGeometry; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function CylinderGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) { - - Geometry.call( this ); - - this.type = 'CylinderGeometry'; - - this.parameters = { - radiusTop: radiusTop, - radiusBottom: radiusBottom, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - this.fromBufferGeometry( new CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) ); - this.mergeVertices(); - -} - -CylinderGeometry.prototype = Object.create( Geometry.prototype ); -CylinderGeometry.prototype.constructor = CylinderGeometry; - -/** - * @author abelnation / http://github.com/abelnation - */ - -function ConeGeometry( radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) { - - CylinderGeometry.call( this, 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ); - - this.type = 'ConeGeometry'; - - this.parameters = { - radius: radius, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - -} - -ConeGeometry.prototype = Object.create( CylinderGeometry.prototype ); -ConeGeometry.prototype.constructor = ConeGeometry; - -/** - * @author: abelnation / http://github.com/abelnation - */ - -function ConeBufferGeometry( radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) { - - CylinderBufferGeometry.call( this, 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ); - - this.type = 'ConeBufferGeometry'; - - this.parameters = { - radius: radius, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - -} - -ConeBufferGeometry.prototype = Object.create( CylinderBufferGeometry.prototype ); -ConeBufferGeometry.prototype.constructor = ConeBufferGeometry; - -/** - * @author benaadams / https://twitter.com/ben_a_adams - */ - -function CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) { - - BufferGeometry.call( this ); - - this.type = 'CircleBufferGeometry'; - - this.parameters = { - radius: radius, - segments: segments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - radius = radius || 50; - segments = segments !== undefined ? Math.max( 3, segments ) : 8; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - var vertices = segments + 2; - - var positions = new Float32Array( vertices * 3 ); - var normals = new Float32Array( vertices * 3 ); - var uvs = new Float32Array( vertices * 2 ); - - // center data is already zero, but need to set a few extras - normals[ 2 ] = 1.0; - uvs[ 0 ] = 0.5; - uvs[ 1 ] = 0.5; - - for ( var s = 0, i = 3, ii = 2 ; s <= segments; s ++, i += 3, ii += 2 ) { - - var segment = thetaStart + s / segments * thetaLength; - - positions[ i ] = radius * Math.cos( segment ); - positions[ i + 1 ] = radius * Math.sin( segment ); - - normals[ i + 2 ] = 1; // normal z - - uvs[ ii ] = ( positions[ i ] / radius + 1 ) / 2; - uvs[ ii + 1 ] = ( positions[ i + 1 ] / radius + 1 ) / 2; - - } - - var indices = []; - - for ( var i = 1; i <= segments; i ++ ) { - - indices.push( i, i + 1, 0 ); - - } - - this.setIndex( new BufferAttribute( new Uint16Array( indices ), 1 ) ); - this.addAttribute( 'position', new BufferAttribute( positions, 3 ) ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - - this.boundingSphere = new Sphere( new Vector3(), radius ); - -} - -CircleBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -CircleBufferGeometry.prototype.constructor = CircleBufferGeometry; - -/** - * @author hughes - */ - -function CircleGeometry( radius, segments, thetaStart, thetaLength ) { - - Geometry.call( this ); - - this.type = 'CircleGeometry'; - - this.parameters = { - radius: radius, - segments: segments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - this.fromBufferGeometry( new CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) ); - -} - -CircleGeometry.prototype = Object.create( Geometry.prototype ); -CircleGeometry.prototype.constructor = CircleGeometry; - -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as - */ - -function BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { - - Geometry.call( this ); - - this.type = 'BoxGeometry'; - - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; - - this.fromBufferGeometry( new BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) ); - this.mergeVertices(); - -} - -BoxGeometry.prototype = Object.create( Geometry.prototype ); -BoxGeometry.prototype.constructor = BoxGeometry; - - - -var Geometries = Object.freeze({ - WireframeGeometry: WireframeGeometry, - ParametricGeometry: ParametricGeometry, - ParametricBufferGeometry: ParametricBufferGeometry, - TetrahedronGeometry: TetrahedronGeometry, - TetrahedronBufferGeometry: TetrahedronBufferGeometry, - OctahedronGeometry: OctahedronGeometry, - OctahedronBufferGeometry: OctahedronBufferGeometry, - IcosahedronGeometry: IcosahedronGeometry, - IcosahedronBufferGeometry: IcosahedronBufferGeometry, - DodecahedronGeometry: DodecahedronGeometry, - DodecahedronBufferGeometry: DodecahedronBufferGeometry, - PolyhedronGeometry: PolyhedronGeometry, - PolyhedronBufferGeometry: PolyhedronBufferGeometry, - TubeGeometry: TubeGeometry, - TubeBufferGeometry: TubeBufferGeometry, - TorusKnotGeometry: TorusKnotGeometry, - TorusKnotBufferGeometry: TorusKnotBufferGeometry, - TorusGeometry: TorusGeometry, - TorusBufferGeometry: TorusBufferGeometry, - TextGeometry: TextGeometry, - SphereBufferGeometry: SphereBufferGeometry, - SphereGeometry: SphereGeometry, - RingGeometry: RingGeometry, - RingBufferGeometry: RingBufferGeometry, - PlaneBufferGeometry: PlaneBufferGeometry, - PlaneGeometry: PlaneGeometry, - LatheGeometry: LatheGeometry, - LatheBufferGeometry: LatheBufferGeometry, - ShapeGeometry: ShapeGeometry, - ShapeBufferGeometry: ShapeBufferGeometry, - ExtrudeGeometry: ExtrudeGeometry, - EdgesGeometry: EdgesGeometry, - ConeGeometry: ConeGeometry, - ConeBufferGeometry: ConeBufferGeometry, - CylinderGeometry: CylinderGeometry, - CylinderBufferGeometry: CylinderBufferGeometry, - CircleBufferGeometry: CircleBufferGeometry, - CircleGeometry: CircleGeometry, - BoxBufferGeometry: BoxBufferGeometry, - BoxGeometry: BoxGeometry -}); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function ShadowMaterial() { - - ShaderMaterial.call( this, { - uniforms: Object.assign( {}, - UniformsLib.lights, - { - opacity: { value: 1.0 } - } - ), - vertexShader: ShaderChunk[ 'shadow_vert' ], - fragmentShader: ShaderChunk[ 'shadow_frag' ] - } ); - - this.lights = true; - this.transparent = true; - - Object.defineProperties( this, { - opacity: { - enumerable: true, - get: function () { - return this.uniforms.opacity.value; - }, - set: function ( value ) { - this.uniforms.opacity.value = value; - } - } - } ); - -} - -ShadowMaterial.prototype = Object.create( ShaderMaterial.prototype ); -ShadowMaterial.prototype.constructor = ShadowMaterial; - -ShadowMaterial.prototype.isShadowMaterial = true; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function RawShaderMaterial( parameters ) { - - ShaderMaterial.call( this, parameters ); - - this.type = 'RawShaderMaterial'; - -} - -RawShaderMaterial.prototype = Object.create( ShaderMaterial.prototype ); -RawShaderMaterial.prototype.constructor = RawShaderMaterial; - -RawShaderMaterial.prototype.isRawShaderMaterial = true; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function MultiMaterial( materials ) { - - this.uuid = _Math.generateUUID(); - - this.type = 'MultiMaterial'; - - this.materials = materials instanceof Array ? materials : []; - - this.visible = true; - -} - -MultiMaterial.prototype = { - - constructor: MultiMaterial, - - isMultiMaterial: true, - - toJSON: function ( meta ) { - - var output = { - metadata: { - version: 4.2, - type: 'material', - generator: 'MaterialExporter' - }, - uuid: this.uuid, - type: this.type, - materials: [] - }; - - var materials = this.materials; - - for ( var i = 0, l = materials.length; i < l; i ++ ) { - - var material = materials[ i ].toJSON( meta ); - delete material.metadata; - - output.materials.push( material ); - - } - - output.visible = this.visible; - - return output; - - }, - - clone: function () { - - var material = new this.constructor(); - - for ( var i = 0; i < this.materials.length; i ++ ) { - - material.materials.push( this.materials[ i ].clone() ); - - } - - material.visible = this.visible; - - return material; - - } - -}; - -/** - * @author WestLangley / http://github.com/WestLangley - * - * parameters = { - * color: <hex>, - * roughness: <float>, - * metalness: <float>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * lightMapIntensity: <float> - * - * aoMap: new THREE.Texture( <Image> ), - * aoMapIntensity: <float> - * - * emissive: <hex>, - * emissiveIntensity: <float> - * emissiveMap: new THREE.Texture( <Image> ), - * - * bumpMap: new THREE.Texture( <Image> ), - * bumpScale: <float>, - * - * normalMap: new THREE.Texture( <Image> ), - * normalScale: <Vector2>, - * - * displacementMap: new THREE.Texture( <Image> ), - * displacementScale: <float>, - * displacementBias: <float>, - * - * roughnessMap: new THREE.Texture( <Image> ), - * - * metalnessMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), - * envMapIntensity: <float> - * - * refractionRatio: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool> - * } - */ - -function MeshStandardMaterial( parameters ) { - - Material.call( this ); - - this.defines = { 'STANDARD': '' }; - - this.type = 'MeshStandardMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - this.roughness = 0.5; - this.metalness = 0.5; - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.roughnessMap = null; - - this.metalnessMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.envMapIntensity = 1.0; - - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - -} - -MeshStandardMaterial.prototype = Object.create( Material.prototype ); -MeshStandardMaterial.prototype.constructor = MeshStandardMaterial; - -MeshStandardMaterial.prototype.isMeshStandardMaterial = true; - -MeshStandardMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.defines = { 'STANDARD': '' }; - - this.color.copy( source.color ); - this.roughness = source.roughness; - this.metalness = source.metalness; - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.roughnessMap = source.roughnessMap; - - this.metalnessMap = source.metalnessMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.envMapIntensity = source.envMapIntensity; - - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - return this; - -}; - -/** - * @author WestLangley / http://github.com/WestLangley - * - * parameters = { - * reflectivity: <float> - * } - */ - -function MeshPhysicalMaterial( parameters ) { - - MeshStandardMaterial.call( this ); - - this.defines = { 'PHYSICAL': '' }; - - this.type = 'MeshPhysicalMaterial'; - - this.reflectivity = 0.5; // maps to F0 = 0.04 - - this.clearCoat = 0.0; - this.clearCoatRoughness = 0.0; - - this.setValues( parameters ); - -} - -MeshPhysicalMaterial.prototype = Object.create( MeshStandardMaterial.prototype ); -MeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial; - -MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true; - -MeshPhysicalMaterial.prototype.copy = function ( source ) { - - MeshStandardMaterial.prototype.copy.call( this, source ); - - this.defines = { 'PHYSICAL': '' }; - - this.reflectivity = source.reflectivity; - - this.clearCoat = source.clearCoat; - this.clearCoatRoughness = source.clearCoatRoughness; - - return this; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * specular: <hex>, - * shininess: <float>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * lightMapIntensity: <float> - * - * aoMap: new THREE.Texture( <Image> ), - * aoMapIntensity: <float> - * - * emissive: <hex>, - * emissiveIntensity: <float> - * emissiveMap: new THREE.Texture( <Image> ), - * - * bumpMap: new THREE.Texture( <Image> ), - * bumpScale: <float>, - * - * normalMap: new THREE.Texture( <Image> ), - * normalScale: <Vector2>, - * - * displacementMap: new THREE.Texture( <Image> ), - * displacementScale: <float>, - * displacementBias: <float>, - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool> - * } - */ - -function MeshPhongMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshPhongMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - this.specular = new Color( 0x111111 ); - this.shininess = 30; - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - -} - -MeshPhongMaterial.prototype = Object.create( Material.prototype ); -MeshPhongMaterial.prototype.constructor = MeshPhongMaterial; - -MeshPhongMaterial.prototype.isMeshPhongMaterial = true; - -MeshPhongMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - this.specular.copy( source.specular ); - this.shininess = source.shininess; - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - return this; - -}; - -/** - * @author takahirox / http://github.com/takahirox - * - * parameters = { - * gradientMap: new THREE.Texture( <Image> ) - * } - */ - -function MeshToonMaterial( parameters ) { - - MeshPhongMaterial.call( this ); - - this.defines = { 'TOON': '' }; - - this.type = 'MeshToonMaterial'; - - this.gradientMap = null; - - this.setValues( parameters ); - -} - -MeshToonMaterial.prototype = Object.create( MeshPhongMaterial.prototype ); -MeshToonMaterial.prototype.constructor = MeshToonMaterial; - -MeshToonMaterial.prototype.isMeshToonMaterial = true; - -MeshToonMaterial.prototype.copy = function ( source ) { - - MeshPhongMaterial.prototype.copy.call( this, source ); - - this.gradientMap = source.gradientMap; - - return this; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * - * parameters = { - * opacity: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float> - * } - */ - -function MeshNormalMaterial( parameters ) { - - Material.call( this, parameters ); - - this.type = 'MeshNormalMaterial'; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; - this.lights = false; - this.morphTargets = false; - - this.setValues( parameters ); - -} - -MeshNormalMaterial.prototype = Object.create( Material.prototype ); -MeshNormalMaterial.prototype.constructor = MeshNormalMaterial; - -MeshNormalMaterial.prototype.isMeshNormalMaterial = true; - -MeshNormalMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - return this; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * lightMapIntensity: <float> - * - * aoMap: new THREE.Texture( <Image> ), - * aoMapIntensity: <float> - * - * emissive: <hex>, - * emissiveIntensity: <float> - * emissiveMap: new THREE.Texture( <Image> ), - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool> - * } - */ - -function MeshLambertMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshLambertMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - -} - -MeshLambertMaterial.prototype = Object.create( Material.prototype ); -MeshLambertMaterial.prototype.constructor = MeshLambertMaterial; - -MeshLambertMaterial.prototype.isMeshLambertMaterial = true; - -MeshLambertMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - return this; - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * linewidth: <float>, - * - * scale: <float>, - * dashSize: <float>, - * gapSize: <float> - * } - */ - -function LineDashedMaterial( parameters ) { - - Material.call( this ); - - this.type = 'LineDashedMaterial'; - - this.color = new Color( 0xffffff ); - - this.linewidth = 1; - - this.scale = 1; - this.dashSize = 3; - this.gapSize = 1; - - this.lights = false; - - this.setValues( parameters ); - -} - -LineDashedMaterial.prototype = Object.create( Material.prototype ); -LineDashedMaterial.prototype.constructor = LineDashedMaterial; - -LineDashedMaterial.prototype.isLineDashedMaterial = true; - -LineDashedMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.linewidth = source.linewidth; - - this.scale = source.scale; - this.dashSize = source.dashSize; - this.gapSize = source.gapSize; - - return this; - -}; - - - -var Materials = Object.freeze({ - ShadowMaterial: ShadowMaterial, - SpriteMaterial: SpriteMaterial, - RawShaderMaterial: RawShaderMaterial, - ShaderMaterial: ShaderMaterial, - PointsMaterial: PointsMaterial, - MultiMaterial: MultiMaterial, - MeshPhysicalMaterial: MeshPhysicalMaterial, - MeshStandardMaterial: MeshStandardMaterial, - MeshPhongMaterial: MeshPhongMaterial, - MeshToonMaterial: MeshToonMaterial, - MeshNormalMaterial: MeshNormalMaterial, - MeshLambertMaterial: MeshLambertMaterial, - MeshDepthMaterial: MeshDepthMaterial, - MeshBasicMaterial: MeshBasicMaterial, - LineDashedMaterial: LineDashedMaterial, - LineBasicMaterial: LineBasicMaterial, - Material: Material -}); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -var Cache = { - - enabled: false, - - files: {}, - - add: function ( key, file ) { - - if ( this.enabled === false ) return; - - // console.log( 'THREE.Cache', 'Adding key:', key ); - - this.files[ key ] = file; - - }, - - get: function ( key ) { - - if ( this.enabled === false ) return; - - // console.log( 'THREE.Cache', 'Checking key:', key ); - - return this.files[ key ]; - - }, - - remove: function ( key ) { - - delete this.files[ key ]; - - }, - - clear: function () { - - this.files = {}; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function LoadingManager( onLoad, onProgress, onError ) { - - var scope = this; - - var isLoading = false, itemsLoaded = 0, itemsTotal = 0; - - this.onStart = undefined; - this.onLoad = onLoad; - this.onProgress = onProgress; - this.onError = onError; - - this.itemStart = function ( url ) { - - itemsTotal ++; - - if ( isLoading === false ) { - - if ( scope.onStart !== undefined ) { - - scope.onStart( url, itemsLoaded, itemsTotal ); - - } - - } - - isLoading = true; - - }; - - this.itemEnd = function ( url ) { - - itemsLoaded ++; - - if ( scope.onProgress !== undefined ) { - - scope.onProgress( url, itemsLoaded, itemsTotal ); - - } - - if ( itemsLoaded === itemsTotal ) { - - isLoading = false; - - if ( scope.onLoad !== undefined ) { - - scope.onLoad(); - - } - - } - - }; - - this.itemError = function ( url ) { - - if ( scope.onError !== undefined ) { - - scope.onError( url ); - - } - - }; - -} - -var DefaultLoadingManager = new LoadingManager(); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function FileLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - -} - -Object.assign( FileLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - if ( url === undefined ) url = ''; - - if ( this.path !== undefined ) url = this.path + url; - - var scope = this; - - var cached = Cache.get( url ); - - if ( cached !== undefined ) { - - scope.manager.itemStart( url ); - - setTimeout( function () { - - if ( onLoad ) onLoad( cached ); - - scope.manager.itemEnd( url ); - - }, 0 ); - - return cached; - - } - - // Check for data: URI - var dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/; - var dataUriRegexResult = url.match( dataUriRegex ); - - // Safari can not handle Data URIs through XMLHttpRequest so process manually - if ( dataUriRegexResult ) { - - var mimeType = dataUriRegexResult[ 1 ]; - var isBase64 = !! dataUriRegexResult[ 2 ]; - var data = dataUriRegexResult[ 3 ]; - - data = window.decodeURIComponent( data ); - - if ( isBase64 ) data = window.atob( data ); - - try { - - var response; - var responseType = ( this.responseType || '' ).toLowerCase(); - - switch ( responseType ) { - - case 'arraybuffer': - case 'blob': - - response = new ArrayBuffer( data.length ); - - var view = new Uint8Array( response ); - - for ( var i = 0; i < data.length; i ++ ) { - - view[ i ] = data.charCodeAt( i ); - - } - - if ( responseType === 'blob' ) { - - response = new Blob( [ response ], { type: mimeType } ); - - } - - break; - - case 'document': - - var parser = new DOMParser(); - response = parser.parseFromString( data, mimeType ); - - break; - - case 'json': - - response = JSON.parse( data ); - - break; - - default: // 'text' or other - - response = data; - - break; - - } - - // Wait for next browser tick - window.setTimeout( function () { - - if ( onLoad ) onLoad( response ); - - scope.manager.itemEnd( url ); - - }, 0 ); - - } catch ( error ) { - - // Wait for next browser tick - window.setTimeout( function () { - - if ( onError ) onError( error ); - - scope.manager.itemError( url ); - - }, 0 ); - - } - - } else { - - var request = new XMLHttpRequest(); - request.open( 'GET', url, true ); - - request.addEventListener( 'load', function ( event ) { - - var response = event.target.response; - - Cache.add( url, response ); - - if ( this.status === 200 ) { - - if ( onLoad ) onLoad( response ); - - scope.manager.itemEnd( url ); - - } else if ( this.status === 0 ) { - - // Some browsers return HTTP Status 0 when using non-http protocol - // e.g. 'file://' or 'data://'. Handle as success. - - console.warn( 'THREE.FileLoader: HTTP Status 0 received.' ); - - if ( onLoad ) onLoad( response ); - - scope.manager.itemEnd( url ); - - } else { - - if ( onError ) onError( event ); - - scope.manager.itemError( url ); - - } - - }, false ); - - if ( onProgress !== undefined ) { - - request.addEventListener( 'progress', function ( event ) { - - onProgress( event ); - - }, false ); - - } - - request.addEventListener( 'error', function ( event ) { - - if ( onError ) onError( event ); - - scope.manager.itemError( url ); - - }, false ); - - if ( this.responseType !== undefined ) request.responseType = this.responseType; - if ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials; - - if ( request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' ); - - request.send( null ); - - } - - scope.manager.itemStart( url ); - - return request; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - }, - - setResponseType: function ( value ) { - - this.responseType = value; - return this; - - }, - - setWithCredentials: function ( value ) { - - this.withCredentials = value; - return this; - - }, - - setMimeType: function ( value ) { - - this.mimeType = value; - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * - * Abstract Base class to block based textures loader (dds, pvr, ...) - */ - -function CompressedTextureLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - - // override in sub classes - this._parser = null; - -} - -Object.assign( CompressedTextureLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var images = []; - - var texture = new CompressedTexture(); - texture.image = images; - - var loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setResponseType( 'arraybuffer' ); - - function loadTexture( i ) { - - loader.load( url[ i ], function ( buffer ) { - - var texDatas = scope._parser( buffer, true ); - - images[ i ] = { - width: texDatas.width, - height: texDatas.height, - format: texDatas.format, - mipmaps: texDatas.mipmaps - }; - - loaded += 1; - - if ( loaded === 6 ) { - - if ( texDatas.mipmapCount === 1 ) - texture.minFilter = LinearFilter; - - texture.format = texDatas.format; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - }, onProgress, onError ); - - } - - if ( Array.isArray( url ) ) { - - var loaded = 0; - - for ( var i = 0, il = url.length; i < il; ++ i ) { - - loadTexture( i ); - - } - - } else { - - // compressed cubemap texture stored in a single DDS file - - loader.load( url, function ( buffer ) { - - var texDatas = scope._parser( buffer, true ); - - if ( texDatas.isCubemap ) { - - var faces = texDatas.mipmaps.length / texDatas.mipmapCount; - - for ( var f = 0; f < faces; f ++ ) { - - images[ f ] = { mipmaps : [] }; - - for ( var i = 0; i < texDatas.mipmapCount; i ++ ) { - - images[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] ); - images[ f ].format = texDatas.format; - images[ f ].width = texDatas.width; - images[ f ].height = texDatas.height; - - } - - } - - } else { - - texture.image.width = texDatas.width; - texture.image.height = texDatas.height; - texture.mipmaps = texDatas.mipmaps; - - } - - if ( texDatas.mipmapCount === 1 ) { - - texture.minFilter = LinearFilter; - - } - - texture.format = texDatas.format; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - }, onProgress, onError ); - - } - - return texture; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - } - -} ); - -/** - * @author Nikos M. / https://github.com/foo123/ - * - * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...) - */ - -var DataTextureLoader = BinaryTextureLoader; -function BinaryTextureLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - - // override in sub classes - this._parser = null; - -} - -Object.assign( BinaryTextureLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var texture = new DataTexture(); - - var loader = new FileLoader( this.manager ); - loader.setResponseType( 'arraybuffer' ); - - loader.load( url, function ( buffer ) { - - var texData = scope._parser( buffer ); - - if ( ! texData ) return; - - if ( undefined !== texData.image ) { - - texture.image = texData.image; - - } else if ( undefined !== texData.data ) { - - texture.image.width = texData.width; - texture.image.height = texData.height; - texture.image.data = texData.data; - - } - - texture.wrapS = undefined !== texData.wrapS ? texData.wrapS : ClampToEdgeWrapping; - texture.wrapT = undefined !== texData.wrapT ? texData.wrapT : ClampToEdgeWrapping; - - texture.magFilter = undefined !== texData.magFilter ? texData.magFilter : LinearFilter; - texture.minFilter = undefined !== texData.minFilter ? texData.minFilter : LinearMipMapLinearFilter; - - texture.anisotropy = undefined !== texData.anisotropy ? texData.anisotropy : 1; - - if ( undefined !== texData.format ) { - - texture.format = texData.format; - - } - if ( undefined !== texData.type ) { - - texture.type = texData.type; - - } - - if ( undefined !== texData.mipmaps ) { - - texture.mipmaps = texData.mipmaps; - - } - - if ( 1 === texData.mipmapCount ) { - - texture.minFilter = LinearFilter; - - } - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture, texData ); - - }, onProgress, onError ); - - - return texture; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function ImageLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - -} - -Object.assign( ImageLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' ); - image.onload = function () { - - image.onload = null; - - URL.revokeObjectURL( image.src ); - - if ( onLoad ) onLoad( image ); - - scope.manager.itemEnd( url ); - - }; - image.onerror = onError; - - if ( url.indexOf( 'data:' ) === 0 ) { - - image.src = url; - - } else if ( this.crossOrigin !== undefined ) { - - // crossOrigin doesn't work with URL.createObjectURL()? - - image.crossOrigin = this.crossOrigin; - image.src = url; - - } else { - - var loader = new FileLoader(); - loader.setPath( this.path ); - loader.setResponseType( 'blob' ); - loader.setWithCredentials( this.withCredentials ); - loader.load( url, function ( blob ) { - - image.src = URL.createObjectURL( blob ); - - }, onProgress, onError ); - - } - - scope.manager.itemStart( url ); - - return image; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setWithCredentials: function ( value ) { - - this.withCredentials = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function CubeTextureLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - -} - -Object.assign( CubeTextureLoader.prototype, { - - load: function ( urls, onLoad, onProgress, onError ) { - - var texture = new CubeTexture(); - - var loader = new ImageLoader( this.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.setPath( this.path ); - - var loaded = 0; - - function loadTexture( i ) { - - loader.load( urls[ i ], function ( image ) { - - texture.images[ i ] = image; - - loaded ++; - - if ( loaded === 6 ) { - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - }, undefined, onError ); - - } - - for ( var i = 0; i < urls.length; ++ i ) { - - loadTexture( i ); - - } - - return texture; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function TextureLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - -} - -Object.assign( TextureLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var texture = new Texture(); - - var loader = new ImageLoader( this.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.setWithCredentials( this.withCredentials ); - loader.setPath( this.path ); - loader.load( url, function ( image ) { - - // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB. - var isJPEG = url.search( /\.(jpg|jpeg)$/ ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; - - texture.format = isJPEG ? RGBFormat : RGBAFormat; - texture.image = image; - texture.needsUpdate = true; - - if ( onLoad !== undefined ) { - - onLoad( texture ); - - } - - }, onProgress, onError ); - - return texture; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setWithCredentials: function ( value ) { - - this.withCredentials = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - } - - - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -function Light( color, intensity ) { - - Object3D.call( this ); - - this.type = 'Light'; - - this.color = new Color( color ); - this.intensity = intensity !== undefined ? intensity : 1; - - this.receiveShadow = undefined; - -} - -Light.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Light, - - isLight: true, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - this.intensity = source.intensity; - - return this; - - }, - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.color = this.color.getHex(); - data.object.intensity = this.intensity; - - if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex(); - - if ( this.distance !== undefined ) data.object.distance = this.distance; - if ( this.angle !== undefined ) data.object.angle = this.angle; - if ( this.decay !== undefined ) data.object.decay = this.decay; - if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra; - - if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON(); - - return data; - - } - -} ); - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function HemisphereLight( skyColor, groundColor, intensity ) { - - Light.call( this, skyColor, intensity ); - - this.type = 'HemisphereLight'; - - this.castShadow = undefined; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.groundColor = new Color( groundColor ); - -} - -HemisphereLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: HemisphereLight, - - isHemisphereLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.groundColor.copy( source.groundColor ); - - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function LightShadow( camera ) { - - this.camera = camera; - - this.bias = 0; - this.radius = 1; - - this.mapSize = new Vector2( 512, 512 ); - - this.map = null; - this.matrix = new Matrix4(); - -} - -Object.assign( LightShadow.prototype, { - - copy: function ( source ) { - - this.camera = source.camera.clone(); - - this.bias = source.bias; - this.radius = source.radius; - - this.mapSize.copy( source.mapSize ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - toJSON: function () { - - var object = {}; - - if ( this.bias !== 0 ) object.bias = this.bias; - if ( this.radius !== 1 ) object.radius = this.radius; - if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray(); - - object.camera = this.camera.toJSON( false ).object; - delete object.camera.matrix; - - return object; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function SpotLightShadow() { - - LightShadow.call( this, new PerspectiveCamera( 50, 1, 0.5, 500 ) ); - -} - -SpotLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), { - - constructor: SpotLightShadow, - - isSpotLightShadow: true, - - update: function ( light ) { - - var fov = _Math.RAD2DEG * 2 * light.angle; - var aspect = this.mapSize.width / this.mapSize.height; - var far = light.distance || 500; - - var camera = this.camera; - - if ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) { - - camera.fov = fov; - camera.aspect = aspect; - camera.far = far; - camera.updateProjectionMatrix(); - - } - - } - -} ); - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function SpotLight( color, intensity, distance, angle, penumbra, decay ) { - - Light.call( this, color, intensity ); - - this.type = 'SpotLight'; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.target = new Object3D(); - - Object.defineProperty( this, 'power', { - get: function () { - // intensity = power per solid angle. - // ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf - return this.intensity * Math.PI; - }, - set: function ( power ) { - // intensity = power per solid angle. - // ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf - this.intensity = power / Math.PI; - } - } ); - - this.distance = ( distance !== undefined ) ? distance : 0; - this.angle = ( angle !== undefined ) ? angle : Math.PI / 3; - this.penumbra = ( penumbra !== undefined ) ? penumbra : 0; - this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2. - - this.shadow = new SpotLightShadow(); - -} - -SpotLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: SpotLight, - - isSpotLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.distance = source.distance; - this.angle = source.angle; - this.penumbra = source.penumbra; - this.decay = source.decay; - - this.target = source.target.clone(); - - this.shadow = source.shadow.clone(); - - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - - -function PointLight( color, intensity, distance, decay ) { - - Light.call( this, color, intensity ); - - this.type = 'PointLight'; - - Object.defineProperty( this, 'power', { - get: function () { - // intensity = power per solid angle. - // ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf - return this.intensity * 4 * Math.PI; - - }, - set: function ( power ) { - // intensity = power per solid angle. - // ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf - this.intensity = power / ( 4 * Math.PI ); - } - } ); - - this.distance = ( distance !== undefined ) ? distance : 0; - this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2. - - this.shadow = new LightShadow( new PerspectiveCamera( 90, 1, 0.5, 500 ) ); - -} - -PointLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: PointLight, - - isPointLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.distance = source.distance; - this.decay = source.decay; - - this.shadow = source.shadow.clone(); - - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function DirectionalLightShadow( light ) { - - LightShadow.call( this, new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) ); - -} - -DirectionalLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), { - - constructor: DirectionalLightShadow - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -function DirectionalLight( color, intensity ) { - - Light.call( this, color, intensity ); - - this.type = 'DirectionalLight'; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.target = new Object3D(); - - this.shadow = new DirectionalLightShadow(); - -} - -DirectionalLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: DirectionalLight, - - isDirectionalLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.target = source.target.clone(); - - this.shadow = source.shadow.clone(); - - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function AmbientLight( color, intensity ) { - - Light.call( this, color, intensity ); - - this.type = 'AmbientLight'; - - this.castShadow = undefined; - -} - -AmbientLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: AmbientLight, - - isAmbientLight: true, - -} ); - -/** - * @author tschw - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - */ - -var AnimationUtils = { - - // same as Array.prototype.slice, but also works on typed arrays - arraySlice: function( array, from, to ) { - - if ( AnimationUtils.isTypedArray( array ) ) { - - return new array.constructor( array.subarray( from, to ) ); - - } - - return array.slice( from, to ); - - }, - - // converts an array to a specific type - convertArray: function( array, type, forceClone ) { - - if ( ! array || // let 'undefined' and 'null' pass - ! forceClone && array.constructor === type ) return array; - - if ( typeof type.BYTES_PER_ELEMENT === 'number' ) { - - return new type( array ); // create typed array - - } - - return Array.prototype.slice.call( array ); // create Array - - }, - - isTypedArray: function( object ) { - - return ArrayBuffer.isView( object ) && - ! ( object instanceof DataView ); - - }, - - // returns an array by which times and values can be sorted - getKeyframeOrder: function( times ) { - - function compareTime( i, j ) { - - return times[ i ] - times[ j ]; - - } - - var n = times.length; - var result = new Array( n ); - for ( var i = 0; i !== n; ++ i ) result[ i ] = i; - - result.sort( compareTime ); - - return result; - - }, - - // uses the array previously returned by 'getKeyframeOrder' to sort data - sortedArray: function( values, stride, order ) { - - var nValues = values.length; - var result = new values.constructor( nValues ); - - for ( var i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) { - - var srcOffset = order[ i ] * stride; - - for ( var j = 0; j !== stride; ++ j ) { - - result[ dstOffset ++ ] = values[ srcOffset + j ]; - - } - - } - - return result; - - }, - - // function for parsing AOS keyframe formats - flattenJSON: function( jsonKeys, times, values, valuePropertyName ) { - - var i = 1, key = jsonKeys[ 0 ]; - - while ( key !== undefined && key[ valuePropertyName ] === undefined ) { - - key = jsonKeys[ i ++ ]; - - } - - if ( key === undefined ) return; // no data - - var value = key[ valuePropertyName ]; - if ( value === undefined ) return; // no data - - if ( Array.isArray( value ) ) { - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - values.push.apply( values, value ); // push all elements - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } else if ( value.toArray !== undefined ) { - // ...assume THREE.Math-ish - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - value.toArray( values, values.length ); - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } else { - // otherwise push as-is - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - values.push( value ); - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } - - } - -}; - -/** - * Abstract base class of interpolants over parametric samples. - * - * The parameter domain is one dimensional, typically the time or a path - * along a curve defined by the data. - * - * The sample values can have any dimensionality and derived classes may - * apply special interpretations to the data. - * - * This class provides the interval seek in a Template Method, deferring - * the actual interpolation to derived classes. - * - * Time complexity is O(1) for linear access crossing at most two points - * and O(log N) for random access, where N is the number of positions. - * - * References: - * - * http://www.oodesign.com/template-method-pattern.html - * - * @author tschw - */ - -function Interpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - this.parameterPositions = parameterPositions; - this._cachedIndex = 0; - - this.resultBuffer = resultBuffer !== undefined ? - resultBuffer : new sampleValues.constructor( sampleSize ); - this.sampleValues = sampleValues; - this.valueSize = sampleSize; - -} - -Interpolant.prototype = { - - constructor: Interpolant, - - evaluate: function( t ) { - - var pp = this.parameterPositions, - i1 = this._cachedIndex, - - t1 = pp[ i1 ], - t0 = pp[ i1 - 1 ]; - - validate_interval: { - - seek: { - - var right; - - linear_scan: { -//- See http://jsperf.com/comparison-to-undefined/3 -//- slower code: -//- -//- if ( t >= t1 || t1 === undefined ) { - forward_scan: if ( ! ( t < t1 ) ) { - - for ( var giveUpAt = i1 + 2; ;) { - - if ( t1 === undefined ) { - - if ( t < t0 ) break forward_scan; - - // after end - - i1 = pp.length; - this._cachedIndex = i1; - return this.afterEnd_( i1 - 1, t, t0 ); - - } - - if ( i1 === giveUpAt ) break; // this loop - - t0 = t1; - t1 = pp[ ++ i1 ]; - - if ( t < t1 ) { - - // we have arrived at the sought interval - break seek; - - } - - } - - // prepare binary search on the right side of the index - right = pp.length; - break linear_scan; - - } - -//- slower code: -//- if ( t < t0 || t0 === undefined ) { - if ( ! ( t >= t0 ) ) { - - // looping? - - var t1global = pp[ 1 ]; - - if ( t < t1global ) { - - i1 = 2; // + 1, using the scan for the details - t0 = t1global; - - } - - // linear reverse scan - - for ( var giveUpAt = i1 - 2; ;) { - - if ( t0 === undefined ) { - - // before start - - this._cachedIndex = 0; - return this.beforeStart_( 0, t, t1 ); - - } - - if ( i1 === giveUpAt ) break; // this loop - - t1 = t0; - t0 = pp[ -- i1 - 1 ]; - - if ( t >= t0 ) { - - // we have arrived at the sought interval - break seek; - - } - - } - - // prepare binary search on the left side of the index - right = i1; - i1 = 0; - break linear_scan; - - } - - // the interval is valid - - break validate_interval; - - } // linear scan - - // binary search - - while ( i1 < right ) { - - var mid = ( i1 + right ) >>> 1; - - if ( t < pp[ mid ] ) { - - right = mid; - - } else { - - i1 = mid + 1; - - } - - } - - t1 = pp[ i1 ]; - t0 = pp[ i1 - 1 ]; - - // check boundary cases, again - - if ( t0 === undefined ) { - - this._cachedIndex = 0; - return this.beforeStart_( 0, t, t1 ); - - } - - if ( t1 === undefined ) { - - i1 = pp.length; - this._cachedIndex = i1; - return this.afterEnd_( i1 - 1, t0, t ); - - } - - } // seek - - this._cachedIndex = i1; - - this.intervalChanged_( i1, t0, t1 ); - - } // validate_interval - - return this.interpolate_( i1, t0, t, t1 ); - - }, - - settings: null, // optional, subclass-specific settings structure - // Note: The indirection allows central control of many interpolants. - - // --- Protected interface - - DefaultSettings_: {}, - - getSettings_: function() { - - return this.settings || this.DefaultSettings_; - - }, - - copySampleValue_: function( index ) { - - // copies a sample value to the result buffer - - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset = index * stride; - - for ( var i = 0; i !== stride; ++ i ) { - - result[ i ] = values[ offset + i ]; - - } - - return result; - - }, - - // Template methods for derived classes: - - interpolate_: function( i1, t0, t, t1 ) { - - throw new Error( "call to abstract method" ); - // implementations shall return this.resultBuffer - - }, - - intervalChanged_: function( i1, t0, t1 ) { - - // empty - - } - -}; - -Object.assign( Interpolant.prototype, { - - beforeStart_: //( 0, t, t0 ), returns this.resultBuffer - Interpolant.prototype.copySampleValue_, - - afterEnd_: //( N-1, tN-1, t ), returns this.resultBuffer - Interpolant.prototype.copySampleValue_ - -} ); - -/** - * Fast and simple cubic spline interpolant. - * - * It was derived from a Hermitian construction setting the first derivative - * at each sample position to the linear slope between neighboring positions - * over their parameter interval. - * - * @author tschw - */ - -function CubicInterpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( - this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - - this._weightPrev = -0; - this._offsetPrev = -0; - this._weightNext = -0; - this._offsetNext = -0; - -} - -CubicInterpolant.prototype = - Object.assign( Object.create( Interpolant.prototype ), { - - constructor: CubicInterpolant, - - DefaultSettings_: { - - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - - }, - - intervalChanged_: function( i1, t0, t1 ) { - - var pp = this.parameterPositions, - iPrev = i1 - 2, - iNext = i1 + 1, - - tPrev = pp[ iPrev ], - tNext = pp[ iNext ]; - - if ( tPrev === undefined ) { - - switch ( this.getSettings_().endingStart ) { - - case ZeroSlopeEnding: - - // f'(t0) = 0 - iPrev = i1; - tPrev = 2 * t0 - t1; - - break; - - case WrapAroundEnding: - - // use the other end of the curve - iPrev = pp.length - 2; - tPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ]; - - break; - - default: // ZeroCurvatureEnding - - // f''(t0) = 0 a.k.a. Natural Spline - iPrev = i1; - tPrev = t1; - - } - - } - - if ( tNext === undefined ) { - - switch ( this.getSettings_().endingEnd ) { - - case ZeroSlopeEnding: - - // f'(tN) = 0 - iNext = i1; - tNext = 2 * t1 - t0; - - break; - - case WrapAroundEnding: - - // use the other end of the curve - iNext = 1; - tNext = t1 + pp[ 1 ] - pp[ 0 ]; - - break; - - default: // ZeroCurvatureEnding - - // f''(tN) = 0, a.k.a. Natural Spline - iNext = i1 - 1; - tNext = t0; - - } - - } - - var halfDt = ( t1 - t0 ) * 0.5, - stride = this.valueSize; - - this._weightPrev = halfDt / ( t0 - tPrev ); - this._weightNext = halfDt / ( tNext - t1 ); - this._offsetPrev = iPrev * stride; - this._offsetNext = iNext * stride; - - }, - - interpolate_: function( i1, t0, t, t1 ) { - - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - o1 = i1 * stride, o0 = o1 - stride, - oP = this._offsetPrev, oN = this._offsetNext, - wP = this._weightPrev, wN = this._weightNext, - - p = ( t - t0 ) / ( t1 - t0 ), - pp = p * p, - ppp = pp * p; - - // evaluate polynomials - - var sP = - wP * ppp + 2 * wP * pp - wP * p; - var s0 = ( 1 + wP ) * ppp + (-1.5 - 2 * wP ) * pp + ( -0.5 + wP ) * p + 1; - var s1 = (-1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p; - var sN = wN * ppp - wN * pp; - - // combine data linearly - - for ( var i = 0; i !== stride; ++ i ) { - - result[ i ] = - sP * values[ oP + i ] + - s0 * values[ o0 + i ] + - s1 * values[ o1 + i ] + - sN * values[ oN + i ]; - - } - - return result; - - } - -} ); - -/** - * @author tschw - */ - -function LinearInterpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( - this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - -} - -LinearInterpolant.prototype = - Object.assign( Object.create( Interpolant.prototype ), { - - constructor: LinearInterpolant, - - interpolate_: function( i1, t0, t, t1 ) { - - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - offset1 = i1 * stride, - offset0 = offset1 - stride, - - weight1 = ( t - t0 ) / ( t1 - t0 ), - weight0 = 1 - weight1; - - for ( var i = 0; i !== stride; ++ i ) { - - result[ i ] = - values[ offset0 + i ] * weight0 + - values[ offset1 + i ] * weight1; - - } - - return result; - - } - -} ); - -/** - * - * Interpolant that evaluates to the sample value at the position preceeding - * the parameter. - * - * @author tschw - */ - -function DiscreteInterpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( - this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - -} - -DiscreteInterpolant.prototype = - Object.assign( Object.create( Interpolant.prototype ), { - - constructor: DiscreteInterpolant, - - interpolate_: function( i1, t0, t, t1 ) { - - return this.copySampleValue_( i1 - 1 ); - - } - -} ); - -var KeyframeTrackPrototype; - -KeyframeTrackPrototype = { - - TimeBufferType: Float32Array, - ValueBufferType: Float32Array, - - DefaultInterpolation: InterpolateLinear, - - InterpolantFactoryMethodDiscrete: function( result ) { - - return new DiscreteInterpolant( - this.times, this.values, this.getValueSize(), result ); - - }, - - InterpolantFactoryMethodLinear: function( result ) { - - return new LinearInterpolant( - this.times, this.values, this.getValueSize(), result ); - - }, - - InterpolantFactoryMethodSmooth: function( result ) { - - return new CubicInterpolant( - this.times, this.values, this.getValueSize(), result ); - - }, - - setInterpolation: function( interpolation ) { - - var factoryMethod; - - switch ( interpolation ) { - - case InterpolateDiscrete: - - factoryMethod = this.InterpolantFactoryMethodDiscrete; - - break; - - case InterpolateLinear: - - factoryMethod = this.InterpolantFactoryMethodLinear; - - break; - - case InterpolateSmooth: - - factoryMethod = this.InterpolantFactoryMethodSmooth; - - break; - - } - - if ( factoryMethod === undefined ) { - - var message = "unsupported interpolation for " + - this.ValueTypeName + " keyframe track named " + this.name; - - if ( this.createInterpolant === undefined ) { - - // fall back to default, unless the default itself is messed up - if ( interpolation !== this.DefaultInterpolation ) { - - this.setInterpolation( this.DefaultInterpolation ); - - } else { - - throw new Error( message ); // fatal, in this case - - } - - } - - console.warn( message ); - return; - - } - - this.createInterpolant = factoryMethod; - - }, - - getInterpolation: function() { - - switch ( this.createInterpolant ) { - - case this.InterpolantFactoryMethodDiscrete: - - return InterpolateDiscrete; - - case this.InterpolantFactoryMethodLinear: - - return InterpolateLinear; - - case this.InterpolantFactoryMethodSmooth: - - return InterpolateSmooth; - - } - - }, - - getValueSize: function() { - - return this.values.length / this.times.length; - - }, - - // move all keyframes either forwards or backwards in time - shift: function( timeOffset ) { - - if( timeOffset !== 0.0 ) { - - var times = this.times; - - for( var i = 0, n = times.length; i !== n; ++ i ) { - - times[ i ] += timeOffset; - - } - - } - - return this; - - }, - - // scale all keyframe times by a factor (useful for frame <-> seconds conversions) - scale: function( timeScale ) { - - if( timeScale !== 1.0 ) { - - var times = this.times; - - for( var i = 0, n = times.length; i !== n; ++ i ) { - - times[ i ] *= timeScale; - - } - - } - - return this; - - }, - - // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. - // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values - trim: function( startTime, endTime ) { - - var times = this.times, - nKeys = times.length, - from = 0, - to = nKeys - 1; - - while ( from !== nKeys && times[ from ] < startTime ) ++ from; - while ( to !== -1 && times[ to ] > endTime ) -- to; - - ++ to; // inclusive -> exclusive bound - - if( from !== 0 || to !== nKeys ) { - - // empty tracks are forbidden, so keep at least one keyframe - if ( from >= to ) to = Math.max( to , 1 ), from = to - 1; - - var stride = this.getValueSize(); - this.times = AnimationUtils.arraySlice( times, from, to ); - this.values = AnimationUtils. - arraySlice( this.values, from * stride, to * stride ); - - } - - return this; - - }, - - // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable - validate: function() { - - var valid = true; - - var valueSize = this.getValueSize(); - if ( valueSize - Math.floor( valueSize ) !== 0 ) { - - console.error( "invalid value size in track", this ); - valid = false; - - } - - var times = this.times, - values = this.values, - - nKeys = times.length; - - if( nKeys === 0 ) { - - console.error( "track is empty", this ); - valid = false; - - } - - var prevTime = null; - - for( var i = 0; i !== nKeys; i ++ ) { - - var currTime = times[ i ]; - - if ( typeof currTime === 'number' && isNaN( currTime ) ) { - - console.error( "time is not a valid number", this, i, currTime ); - valid = false; - break; - - } - - if( prevTime !== null && prevTime > currTime ) { - - console.error( "out of order keys", this, i, currTime, prevTime ); - valid = false; - break; - - } - - prevTime = currTime; - - } - - if ( values !== undefined ) { - - if ( AnimationUtils.isTypedArray( values ) ) { - - for ( var i = 0, n = values.length; i !== n; ++ i ) { - - var value = values[ i ]; - - if ( isNaN( value ) ) { - - console.error( "value is not a valid number", this, i, value ); - valid = false; - break; - - } - - } - - } - - } - - return valid; - - }, - - // removes equivalent sequential keys as common in morph target sequences - // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) - optimize: function() { - - var times = this.times, - values = this.values, - stride = this.getValueSize(), - - smoothInterpolation = this.getInterpolation() === InterpolateSmooth, - - writeIndex = 1, - lastIndex = times.length - 1; - - for( var i = 1; i < lastIndex; ++ i ) { - - var keep = false; - - var time = times[ i ]; - var timeNext = times[ i + 1 ]; - - // remove adjacent keyframes scheduled at the same time - - if ( time !== timeNext && ( i !== 1 || time !== time[ 0 ] ) ) { - - if ( ! smoothInterpolation ) { - - // remove unnecessary keyframes same as their neighbors - - var offset = i * stride, - offsetP = offset - stride, - offsetN = offset + stride; - - for ( var j = 0; j !== stride; ++ j ) { - - var value = values[ offset + j ]; - - if ( value !== values[ offsetP + j ] || - value !== values[ offsetN + j ] ) { - - keep = true; - break; - - } - - } - - } else keep = true; - - } - - // in-place compaction - - if ( keep ) { - - if ( i !== writeIndex ) { - - times[ writeIndex ] = times[ i ]; - - var readOffset = i * stride, - writeOffset = writeIndex * stride; - - for ( var j = 0; j !== stride; ++ j ) - - values[ writeOffset + j ] = values[ readOffset + j ]; - - } - - ++ writeIndex; - - } - - } - - // flush last keyframe (compaction looks ahead) - - if ( lastIndex > 0 ) { - - times[ writeIndex ] = times[ lastIndex ]; - - for ( var readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) - - values[ writeOffset + j ] = values[ readOffset + j ]; - - ++ writeIndex; - - } - - if ( writeIndex !== times.length ) { - - this.times = AnimationUtils.arraySlice( times, 0, writeIndex ); - this.values = AnimationUtils.arraySlice( values, 0, writeIndex * stride ); - - } - - return this; - - } - -}; - -function KeyframeTrackConstructor( name, times, values, interpolation ) { - - if( name === undefined ) throw new Error( "track name is undefined" ); - - if( times === undefined || times.length === 0 ) { - - throw new Error( "no keyframes in track named " + name ); - - } - - this.name = name; - - this.times = AnimationUtils.convertArray( times, this.TimeBufferType ); - this.values = AnimationUtils.convertArray( values, this.ValueBufferType ); - - this.setInterpolation( interpolation || this.DefaultInterpolation ); - - this.validate(); - this.optimize(); - -} - -/** - * - * A Track of vectored keyframe values. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function VectorKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - -} - -VectorKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: VectorKeyframeTrack, - - ValueTypeName: 'vector' - - // ValueBufferType is inherited - - // DefaultInterpolation is inherited - -} ); - -/** - * Spherical linear unit quaternion interpolant. - * - * @author tschw - */ - -function QuaternionLinearInterpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( - this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - -} - -QuaternionLinearInterpolant.prototype = - Object.assign( Object.create( Interpolant.prototype ), { - - constructor: QuaternionLinearInterpolant, - - interpolate_: function( i1, t0, t, t1 ) { - - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - offset = i1 * stride, - - alpha = ( t - t0 ) / ( t1 - t0 ); - - for ( var end = offset + stride; offset !== end; offset += 4 ) { - - Quaternion.slerpFlat( result, 0, - values, offset - stride, values, offset, alpha ); - - } - - return result; - - } - -} ); - -/** - * - * A Track of quaternion keyframe values. - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function QuaternionKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - -} - -QuaternionKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: QuaternionKeyframeTrack, - - ValueTypeName: 'quaternion', - - // ValueBufferType is inherited - - DefaultInterpolation: InterpolateLinear, - - InterpolantFactoryMethodLinear: function( result ) { - - return new QuaternionLinearInterpolant( - this.times, this.values, this.getValueSize(), result ); - - }, - - InterpolantFactoryMethodSmooth: undefined // not yet implemented - -} ); - -/** - * - * A Track of numeric keyframe values. - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function NumberKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - -} - -NumberKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: NumberKeyframeTrack, - - ValueTypeName: 'number', - - // ValueBufferType is inherited - - // DefaultInterpolation is inherited - -} ); - -/** - * - * A Track that interpolates Strings - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function StringKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - -} - -StringKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: StringKeyframeTrack, - - ValueTypeName: 'string', - ValueBufferType: Array, - - DefaultInterpolation: InterpolateDiscrete, - - InterpolantFactoryMethodLinear: undefined, - - InterpolantFactoryMethodSmooth: undefined - -} ); - -/** - * - * A Track of Boolean keyframe values. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function BooleanKeyframeTrack( name, times, values ) { - - KeyframeTrackConstructor.call( this, name, times, values ); - -} - -BooleanKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: BooleanKeyframeTrack, - - ValueTypeName: 'bool', - ValueBufferType: Array, - - DefaultInterpolation: InterpolateDiscrete, - - InterpolantFactoryMethodLinear: undefined, - InterpolantFactoryMethodSmooth: undefined - - // Note: Actually this track could have a optimized / compressed - // representation of a single value and a custom interpolant that - // computes "firstValue ^ isOdd( index )". - -} ); - -/** - * - * A Track of keyframe values that represent color. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function ColorKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - -} - -ColorKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: ColorKeyframeTrack, - - ValueTypeName: 'color' - - // ValueBufferType is inherited - - // DefaultInterpolation is inherited - - - // Note: Very basic implementation and nothing special yet. - // However, this is the place for color space parameterization. - -} ); - -/** - * - * A timed sequence of keyframes for a specific property. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function KeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.apply( this, arguments ); - -} - -KeyframeTrack.prototype = KeyframeTrackPrototype; -KeyframeTrackPrototype.constructor = KeyframeTrack; - -// Static methods: - -Object.assign( KeyframeTrack, { - - // Serialization (in static context, because of constructor invocation - // and automatic invocation of .toJSON): - - parse: function( json ) { - - if( json.type === undefined ) { - - throw new Error( "track type undefined, can not parse" ); - - } - - var trackType = KeyframeTrack._getTrackTypeForValueTypeName( json.type ); - - if ( json.times === undefined ) { - - var times = [], values = []; - - AnimationUtils.flattenJSON( json.keys, times, values, 'value' ); - - json.times = times; - json.values = values; - - } - - // derived classes can define a static parse method - if ( trackType.parse !== undefined ) { - - return trackType.parse( json ); - - } else { - - // by default, we asssume a constructor compatible with the base - return new trackType( - json.name, json.times, json.values, json.interpolation ); - - } - - }, - - toJSON: function( track ) { - - var trackType = track.constructor; - - var json; - - // derived classes can define a static toJSON method - if ( trackType.toJSON !== undefined ) { - - json = trackType.toJSON( track ); - - } else { - - // by default, we assume the data can be serialized as-is - json = { - - 'name': track.name, - 'times': AnimationUtils.convertArray( track.times, Array ), - 'values': AnimationUtils.convertArray( track.values, Array ) - - }; - - var interpolation = track.getInterpolation(); - - if ( interpolation !== track.DefaultInterpolation ) { - - json.interpolation = interpolation; - - } - - } - - json.type = track.ValueTypeName; // mandatory - - return json; - - }, - - _getTrackTypeForValueTypeName: function( typeName ) { - - switch( typeName.toLowerCase() ) { - - case "scalar": - case "double": - case "float": - case "number": - case "integer": - - return NumberKeyframeTrack; - - case "vector": - case "vector2": - case "vector3": - case "vector4": - - return VectorKeyframeTrack; - - case "color": - - return ColorKeyframeTrack; - - case "quaternion": - - return QuaternionKeyframeTrack; - - case "bool": - case "boolean": - - return BooleanKeyframeTrack; - - case "string": - - return StringKeyframeTrack; - - } - - throw new Error( "Unsupported typeName: " + typeName ); - - } - -} ); - -/** - * - * Reusable set of Tracks that represent an animation. - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - */ - -function AnimationClip( name, duration, tracks ) { - - this.name = name; - this.tracks = tracks; - this.duration = ( duration !== undefined ) ? duration : -1; - - this.uuid = _Math.generateUUID(); - - // this means it should figure out its duration by scanning the tracks - if ( this.duration < 0 ) { - - this.resetDuration(); - - } - - this.optimize(); - -} - -AnimationClip.prototype = { - - constructor: AnimationClip, - - resetDuration: function() { - - var tracks = this.tracks, - duration = 0; - - for ( var i = 0, n = tracks.length; i !== n; ++ i ) { - - var track = this.tracks[ i ]; - - duration = Math.max( - duration, track.times[ track.times.length - 1 ] ); - - } - - this.duration = duration; - - }, - - trim: function() { - - for ( var i = 0; i < this.tracks.length; i ++ ) { - - this.tracks[ i ].trim( 0, this.duration ); - - } - - return this; - - }, - - optimize: function() { - - for ( var i = 0; i < this.tracks.length; i ++ ) { - - this.tracks[ i ].optimize(); - - } - - return this; - - } - -}; - -// Static methods: - -Object.assign( AnimationClip, { - - parse: function( json ) { - - var tracks = [], - jsonTracks = json.tracks, - frameTime = 1.0 / ( json.fps || 1.0 ); - - for ( var i = 0, n = jsonTracks.length; i !== n; ++ i ) { - - tracks.push( KeyframeTrack.parse( jsonTracks[ i ] ).scale( frameTime ) ); - - } - - return new AnimationClip( json.name, json.duration, tracks ); - - }, - - - toJSON: function( clip ) { - - var tracks = [], - clipTracks = clip.tracks; - - var json = { - - 'name': clip.name, - 'duration': clip.duration, - 'tracks': tracks - - }; - - for ( var i = 0, n = clipTracks.length; i !== n; ++ i ) { - - tracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) ); - - } - - return json; - - }, - - - CreateFromMorphTargetSequence: function( name, morphTargetSequence, fps, noLoop ) { - - var numMorphTargets = morphTargetSequence.length; - var tracks = []; - - for ( var i = 0; i < numMorphTargets; i ++ ) { - - var times = []; - var values = []; - - times.push( - ( i + numMorphTargets - 1 ) % numMorphTargets, - i, - ( i + 1 ) % numMorphTargets ); - - values.push( 0, 1, 0 ); - - var order = AnimationUtils.getKeyframeOrder( times ); - times = AnimationUtils.sortedArray( times, 1, order ); - values = AnimationUtils.sortedArray( values, 1, order ); - - // if there is a key at the first frame, duplicate it as the - // last frame as well for perfect loop. - if ( ! noLoop && times[ 0 ] === 0 ) { - - times.push( numMorphTargets ); - values.push( values[ 0 ] ); - - } - - tracks.push( - new NumberKeyframeTrack( - '.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']', - times, values - ).scale( 1.0 / fps ) ); - } - - return new AnimationClip( name, -1, tracks ); - - }, - - findByName: function( objectOrClipArray, name ) { - - var clipArray = objectOrClipArray; - - if ( ! Array.isArray( objectOrClipArray ) ) { - - var o = objectOrClipArray; - clipArray = o.geometry && o.geometry.animations || o.animations; - - } - - for ( var i = 0; i < clipArray.length; i ++ ) { - - if ( clipArray[ i ].name === name ) { - - return clipArray[ i ]; - - } - } - - return null; - - }, - - CreateClipsFromMorphTargetSequences: function( morphTargets, fps, noLoop ) { - - var animationToMorphTargets = {}; - - // tested with https://regex101.com/ on trick sequences - // such flamingo_flyA_003, flamingo_run1_003, crdeath0059 - var pattern = /^([\w-]*?)([\d]+)$/; - - // sort morph target names into animation groups based - // patterns like Walk_001, Walk_002, Run_001, Run_002 - for ( var i = 0, il = morphTargets.length; i < il; i ++ ) { - - var morphTarget = morphTargets[ i ]; - var parts = morphTarget.name.match( pattern ); - - if ( parts && parts.length > 1 ) { - - var name = parts[ 1 ]; - - var animationMorphTargets = animationToMorphTargets[ name ]; - if ( ! animationMorphTargets ) { - - animationToMorphTargets[ name ] = animationMorphTargets = []; - - } - - animationMorphTargets.push( morphTarget ); - - } - - } - - var clips = []; - - for ( var name in animationToMorphTargets ) { - - clips.push( AnimationClip.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) ); - - } - - return clips; - - }, - - // parse the animation.hierarchy format - parseAnimation: function( animation, bones ) { - - if ( ! animation ) { - - console.error( " no animation in JSONLoader data" ); - return null; - - } - - var addNonemptyTrack = function( - trackType, trackName, animationKeys, propertyName, destTracks ) { - - // only return track if there are actually keys. - if ( animationKeys.length !== 0 ) { - - var times = []; - var values = []; - - AnimationUtils.flattenJSON( - animationKeys, times, values, propertyName ); - - // empty keys are filtered out, so check again - if ( times.length !== 0 ) { - - destTracks.push( new trackType( trackName, times, values ) ); - - } - - } - - }; - - var tracks = []; - - var clipName = animation.name || 'default'; - // automatic length determination in AnimationClip. - var duration = animation.length || -1; - var fps = animation.fps || 30; - - var hierarchyTracks = animation.hierarchy || []; - - for ( var h = 0; h < hierarchyTracks.length; h ++ ) { - - var animationKeys = hierarchyTracks[ h ].keys; - - // skip empty tracks - if ( ! animationKeys || animationKeys.length === 0 ) continue; - - // process morph targets in a way exactly compatible - // with AnimationHandler.init( animation ) - if ( animationKeys[0].morphTargets ) { - - // figure out all morph targets used in this track - var morphTargetNames = {}; - for ( var k = 0; k < animationKeys.length; k ++ ) { - - if ( animationKeys[k].morphTargets ) { - - for ( var m = 0; m < animationKeys[k].morphTargets.length; m ++ ) { - - morphTargetNames[ animationKeys[k].morphTargets[m] ] = -1; - } - - } - - } - - // create a track for each morph target with all zero - // morphTargetInfluences except for the keys in which - // the morphTarget is named. - for ( var morphTargetName in morphTargetNames ) { - - var times = []; - var values = []; - - for ( var m = 0; - m !== animationKeys[k].morphTargets.length; ++ m ) { - - var animationKey = animationKeys[k]; - - times.push( animationKey.time ); - values.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 ); - - } - - tracks.push( new NumberKeyframeTrack( - '.morphTargetInfluence[' + morphTargetName + ']', times, values ) ); - - } - - duration = morphTargetNames.length * ( fps || 1.0 ); - - } else { - // ...assume skeletal animation - - var boneName = '.bones[' + bones[ h ].name + ']'; - - addNonemptyTrack( - VectorKeyframeTrack, boneName + '.position', - animationKeys, 'pos', tracks ); - - addNonemptyTrack( - QuaternionKeyframeTrack, boneName + '.quaternion', - animationKeys, 'rot', tracks ); - - addNonemptyTrack( - VectorKeyframeTrack, boneName + '.scale', - animationKeys, 'scl', tracks ); - - } - - } - - if ( tracks.length === 0 ) { - - return null; - - } - - var clip = new AnimationClip( clipName, duration, tracks ); - - return clip; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function MaterialLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - this.textures = {}; - -} - -Object.assign( MaterialLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new FileLoader( scope.manager ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - }, onProgress, onError ); - - }, - - setTextures: function ( value ) { - - this.textures = value; - - }, - - parse: function ( json ) { - - var textures = this.textures; - - function getTexture( name ) { - - if ( textures[ name ] === undefined ) { - - console.warn( 'THREE.MaterialLoader: Undefined texture', name ); - - } - - return textures[ name ]; - - } - - var material = new Materials[ json.type ](); - - if ( json.uuid !== undefined ) material.uuid = json.uuid; - if ( json.name !== undefined ) material.name = json.name; - if ( json.color !== undefined ) material.color.setHex( json.color ); - if ( json.roughness !== undefined ) material.roughness = json.roughness; - if ( json.metalness !== undefined ) material.metalness = json.metalness; - if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive ); - if ( json.specular !== undefined ) material.specular.setHex( json.specular ); - if ( json.shininess !== undefined ) material.shininess = json.shininess; - if ( json.clearCoat !== undefined ) material.clearCoat = json.clearCoat; - if ( json.clearCoatRoughness !== undefined ) material.clearCoatRoughness = json.clearCoatRoughness; - if ( json.uniforms !== undefined ) material.uniforms = json.uniforms; - if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader; - if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader; - if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors; - if ( json.fog !== undefined ) material.fog = json.fog; - if ( json.shading !== undefined ) material.shading = json.shading; - if ( json.blending !== undefined ) material.blending = json.blending; - if ( json.side !== undefined ) material.side = json.side; - if ( json.opacity !== undefined ) material.opacity = json.opacity; - if ( json.transparent !== undefined ) material.transparent = json.transparent; - if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest; - if ( json.depthTest !== undefined ) material.depthTest = json.depthTest; - if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite; - if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite; - if ( json.wireframe !== undefined ) material.wireframe = json.wireframe; - if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth; - if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap; - if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin; - if ( json.skinning !== undefined ) material.skinning = json.skinning; - if ( json.morphTargets !== undefined ) material.morphTargets = json.morphTargets; - - // for PointsMaterial - - if ( json.size !== undefined ) material.size = json.size; - if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation; - - // maps - - if ( json.map !== undefined ) material.map = getTexture( json.map ); - - if ( json.alphaMap !== undefined ) { - - material.alphaMap = getTexture( json.alphaMap ); - material.transparent = true; - - } - - if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap ); - if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale; - - if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap ); - if ( json.normalScale !== undefined ) { - - var normalScale = json.normalScale; - - if ( Array.isArray( normalScale ) === false ) { - - // Blender exporter used to export a scalar. See #7459 - - normalScale = [ normalScale, normalScale ]; - - } - - material.normalScale = new Vector2().fromArray( normalScale ); - - } - - if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap ); - if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale; - if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias; - - if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap ); - if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap ); - - if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap ); - if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity; - - if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap ); - - if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap ); - - if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity; - - if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap ); - if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity; - - if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap ); - if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity; - - if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap ); - - // MultiMaterial - - if ( json.materials !== undefined ) { - - for ( var i = 0, l = json.materials.length; i < l; i ++ ) { - - material.materials.push( this.parse( json.materials[ i ] ) ); - - } - - } - - return material; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function BufferGeometryLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - -} - -Object.assign( BufferGeometryLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new FileLoader( scope.manager ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - }, onProgress, onError ); - - }, - - parse: function ( json ) { - - var geometry = new BufferGeometry(); - - var index = json.data.index; - - var TYPED_ARRAYS = { - 'Int8Array': Int8Array, - 'Uint8Array': Uint8Array, - 'Uint8ClampedArray': Uint8ClampedArray, - 'Int16Array': Int16Array, - 'Uint16Array': Uint16Array, - 'Int32Array': Int32Array, - 'Uint32Array': Uint32Array, - 'Float32Array': Float32Array, - 'Float64Array': Float64Array - }; - - if ( index !== undefined ) { - - var typedArray = new TYPED_ARRAYS[ index.type ]( index.array ); - geometry.setIndex( new BufferAttribute( typedArray, 1 ) ); - - } - - var attributes = json.data.attributes; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - var typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array ); - - geometry.addAttribute( key, new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized ) ); - - } - - var groups = json.data.groups || json.data.drawcalls || json.data.offsets; - - if ( groups !== undefined ) { - - for ( var i = 0, n = groups.length; i !== n; ++ i ) { - - var group = groups[ i ]; - - geometry.addGroup( group.start, group.count, group.materialIndex ); - - } - - } - - var boundingSphere = json.data.boundingSphere; - - if ( boundingSphere !== undefined ) { - - var center = new Vector3(); - - if ( boundingSphere.center !== undefined ) { - - center.fromArray( boundingSphere.center ); - - } - - geometry.boundingSphere = new Sphere( center, boundingSphere.radius ); - - } - - return geometry; - - } - -} ); - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function Loader() { - - this.onLoadStart = function () {}; - this.onLoadProgress = function () {}; - this.onLoadComplete = function () {}; - -} - -Loader.prototype = { - - constructor: Loader, - - crossOrigin: undefined, - - extractUrlBase: function ( url ) { - - var parts = url.split( '/' ); - - if ( parts.length === 1 ) return './'; - - parts.pop(); - - return parts.join( '/' ) + '/'; - - }, - - initMaterials: function ( materials, texturePath, crossOrigin ) { - - var array = []; - - for ( var i = 0; i < materials.length; ++ i ) { - - array[ i ] = this.createMaterial( materials[ i ], texturePath, crossOrigin ); - - } - - return array; - - }, - - createMaterial: ( function () { - - var color, textureLoader, materialLoader; - - return function createMaterial( m, texturePath, crossOrigin ) { - - if ( color === undefined ) color = new Color(); - if ( textureLoader === undefined ) textureLoader = new TextureLoader(); - if ( materialLoader === undefined ) materialLoader = new MaterialLoader(); - - // convert from old material format - - var textures = {}; - - function loadTexture( path, repeat, offset, wrap, anisotropy ) { - - var fullPath = texturePath + path; - var loader = Loader.Handlers.get( fullPath ); - - var texture; - - if ( loader !== null ) { - - texture = loader.load( fullPath ); - - } else { - - textureLoader.setCrossOrigin( crossOrigin ); - texture = textureLoader.load( fullPath ); - - } - - if ( repeat !== undefined ) { - - texture.repeat.fromArray( repeat ); - - if ( repeat[ 0 ] !== 1 ) texture.wrapS = RepeatWrapping; - if ( repeat[ 1 ] !== 1 ) texture.wrapT = RepeatWrapping; - - } - - if ( offset !== undefined ) { - - texture.offset.fromArray( offset ); - - } - - if ( wrap !== undefined ) { - - if ( wrap[ 0 ] === 'repeat' ) texture.wrapS = RepeatWrapping; - if ( wrap[ 0 ] === 'mirror' ) texture.wrapS = MirroredRepeatWrapping; - - if ( wrap[ 1 ] === 'repeat' ) texture.wrapT = RepeatWrapping; - if ( wrap[ 1 ] === 'mirror' ) texture.wrapT = MirroredRepeatWrapping; - - } - - if ( anisotropy !== undefined ) { - - texture.anisotropy = anisotropy; - - } - - var uuid = _Math.generateUUID(); - - textures[ uuid ] = texture; - - return uuid; - - } - - // - - var json = { - uuid: _Math.generateUUID(), - type: 'MeshLambertMaterial' - }; - - for ( var name in m ) { - - var value = m[ name ]; - - switch ( name ) { - case 'DbgColor': - case 'DbgIndex': - case 'opticalDensity': - case 'illumination': - break; - case 'DbgName': - json.name = value; - break; - case 'blending': - json.blending = BlendingMode[ value ]; - break; - case 'colorAmbient': - case 'mapAmbient': - console.warn( 'THREE.Loader.createMaterial:', name, 'is no longer supported.' ); - break; - case 'colorDiffuse': - json.color = color.fromArray( value ).getHex(); - break; - case 'colorSpecular': - json.specular = color.fromArray( value ).getHex(); - break; - case 'colorEmissive': - json.emissive = color.fromArray( value ).getHex(); - break; - case 'specularCoef': - json.shininess = value; - break; - case 'shading': - if ( value.toLowerCase() === 'basic' ) json.type = 'MeshBasicMaterial'; - if ( value.toLowerCase() === 'phong' ) json.type = 'MeshPhongMaterial'; - if ( value.toLowerCase() === 'standard' ) json.type = 'MeshStandardMaterial'; - break; - case 'mapDiffuse': - json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy ); - break; - case 'mapDiffuseRepeat': - case 'mapDiffuseOffset': - case 'mapDiffuseWrap': - case 'mapDiffuseAnisotropy': - break; - case 'mapEmissive': - json.emissiveMap = loadTexture( value, m.mapEmissiveRepeat, m.mapEmissiveOffset, m.mapEmissiveWrap, m.mapEmissiveAnisotropy ); - break; - case 'mapEmissiveRepeat': - case 'mapEmissiveOffset': - case 'mapEmissiveWrap': - case 'mapEmissiveAnisotropy': - break; - case 'mapLight': - json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy ); - break; - case 'mapLightRepeat': - case 'mapLightOffset': - case 'mapLightWrap': - case 'mapLightAnisotropy': - break; - case 'mapAO': - json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy ); - break; - case 'mapAORepeat': - case 'mapAOOffset': - case 'mapAOWrap': - case 'mapAOAnisotropy': - break; - case 'mapBump': - json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy ); - break; - case 'mapBumpScale': - json.bumpScale = value; - break; - case 'mapBumpRepeat': - case 'mapBumpOffset': - case 'mapBumpWrap': - case 'mapBumpAnisotropy': - break; - case 'mapNormal': - json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy ); - break; - case 'mapNormalFactor': - json.normalScale = [ value, value ]; - break; - case 'mapNormalRepeat': - case 'mapNormalOffset': - case 'mapNormalWrap': - case 'mapNormalAnisotropy': - break; - case 'mapSpecular': - json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy ); - break; - case 'mapSpecularRepeat': - case 'mapSpecularOffset': - case 'mapSpecularWrap': - case 'mapSpecularAnisotropy': - break; - case 'mapMetalness': - json.metalnessMap = loadTexture( value, m.mapMetalnessRepeat, m.mapMetalnessOffset, m.mapMetalnessWrap, m.mapMetalnessAnisotropy ); - break; - case 'mapMetalnessRepeat': - case 'mapMetalnessOffset': - case 'mapMetalnessWrap': - case 'mapMetalnessAnisotropy': - break; - case 'mapRoughness': - json.roughnessMap = loadTexture( value, m.mapRoughnessRepeat, m.mapRoughnessOffset, m.mapRoughnessWrap, m.mapRoughnessAnisotropy ); - break; - case 'mapRoughnessRepeat': - case 'mapRoughnessOffset': - case 'mapRoughnessWrap': - case 'mapRoughnessAnisotropy': - break; - case 'mapAlpha': - json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy ); - break; - case 'mapAlphaRepeat': - case 'mapAlphaOffset': - case 'mapAlphaWrap': - case 'mapAlphaAnisotropy': - break; - case 'flipSided': - json.side = BackSide; - break; - case 'doubleSided': - json.side = DoubleSide; - break; - case 'transparency': - console.warn( 'THREE.Loader.createMaterial: transparency has been renamed to opacity' ); - json.opacity = value; - break; - case 'depthTest': - case 'depthWrite': - case 'colorWrite': - case 'opacity': - case 'reflectivity': - case 'transparent': - case 'visible': - case 'wireframe': - json[ name ] = value; - break; - case 'vertexColors': - if ( value === true ) json.vertexColors = VertexColors; - if ( value === 'face' ) json.vertexColors = FaceColors; - break; - default: - console.error( 'THREE.Loader.createMaterial: Unsupported', name, value ); - break; - } - - } - - if ( json.type === 'MeshBasicMaterial' ) delete json.emissive; - if ( json.type !== 'MeshPhongMaterial' ) delete json.specular; - - if ( json.opacity < 1 ) json.transparent = true; - - materialLoader.setTextures( textures ); - - return materialLoader.parse( json ); - - }; - - } )() - -}; - -Loader.Handlers = { - - handlers: [], - - add: function ( regex, loader ) { - - this.handlers.push( regex, loader ); - - }, - - get: function ( file ) { - - var handlers = this.handlers; - - for ( var i = 0, l = handlers.length; i < l; i += 2 ) { - - var regex = handlers[ i ]; - var loader = handlers[ i + 1 ]; - - if ( regex.test( file ) ) { - - return loader; - - } - - } - - return null; - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -function JSONLoader( manager ) { - - if ( typeof manager === 'boolean' ) { - - console.warn( 'THREE.JSONLoader: showStatus parameter has been removed from constructor.' ); - manager = undefined; - - } - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - - this.withCredentials = false; - -} - -Object.assign( JSONLoader.prototype, { - - load: function( url, onLoad, onProgress, onError ) { - - var scope = this; - - var texturePath = this.texturePath && ( typeof this.texturePath === "string" ) ? this.texturePath : Loader.prototype.extractUrlBase( url ); - - var loader = new FileLoader( this.manager ); - loader.setWithCredentials( this.withCredentials ); - loader.load( url, function ( text ) { - - var json = JSON.parse( text ); - var metadata = json.metadata; - - if ( metadata !== undefined ) { - - var type = metadata.type; - - if ( type !== undefined ) { - - if ( type.toLowerCase() === 'object' ) { - - console.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.ObjectLoader instead.' ); - return; - - } - - if ( type.toLowerCase() === 'scene' ) { - - console.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.SceneLoader instead.' ); - return; - - } - - } - - } - - var object = scope.parse( json, texturePath ); - onLoad( object.geometry, object.materials ); - - }, onProgress, onError ); - - }, - - setTexturePath: function ( value ) { - - this.texturePath = value; - - }, - - parse: function ( json, texturePath ) { - - var geometry = new Geometry(), - scale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0; - - parseModel( scale ); - - parseSkin(); - parseMorphing( scale ); - parseAnimations(); - - geometry.computeFaceNormals(); - geometry.computeBoundingSphere(); - - function parseModel( scale ) { - - function isBitSet( value, position ) { - - return value & ( 1 << position ); - - } - - var i, j, fi, - - offset, zLength, - - colorIndex, normalIndex, uvIndex, materialIndex, - - type, - isQuad, - hasMaterial, - hasFaceVertexUv, - hasFaceNormal, hasFaceVertexNormal, - hasFaceColor, hasFaceVertexColor, - - vertex, face, faceA, faceB, hex, normal, - - uvLayer, uv, u, v, - - faces = json.faces, - vertices = json.vertices, - normals = json.normals, - colors = json.colors, - - nUvLayers = 0; - - if ( json.uvs !== undefined ) { - - // disregard empty arrays - - for ( i = 0; i < json.uvs.length; i ++ ) { - - if ( json.uvs[ i ].length ) nUvLayers ++; - - } - - for ( i = 0; i < nUvLayers; i ++ ) { - - geometry.faceVertexUvs[ i ] = []; - - } - - } - - offset = 0; - zLength = vertices.length; - - while ( offset < zLength ) { - - vertex = new Vector3(); - - vertex.x = vertices[ offset ++ ] * scale; - vertex.y = vertices[ offset ++ ] * scale; - vertex.z = vertices[ offset ++ ] * scale; - - geometry.vertices.push( vertex ); - - } - - offset = 0; - zLength = faces.length; - - while ( offset < zLength ) { - - type = faces[ offset ++ ]; - - - isQuad = isBitSet( type, 0 ); - hasMaterial = isBitSet( type, 1 ); - hasFaceVertexUv = isBitSet( type, 3 ); - hasFaceNormal = isBitSet( type, 4 ); - hasFaceVertexNormal = isBitSet( type, 5 ); - hasFaceColor = isBitSet( type, 6 ); - hasFaceVertexColor = isBitSet( type, 7 ); - - // console.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor); - - if ( isQuad ) { - - faceA = new Face3(); - faceA.a = faces[ offset ]; - faceA.b = faces[ offset + 1 ]; - faceA.c = faces[ offset + 3 ]; - - faceB = new Face3(); - faceB.a = faces[ offset + 1 ]; - faceB.b = faces[ offset + 2 ]; - faceB.c = faces[ offset + 3 ]; - - offset += 4; - - if ( hasMaterial ) { - - materialIndex = faces[ offset ++ ]; - faceA.materialIndex = materialIndex; - faceB.materialIndex = materialIndex; - - } - - // to get face <=> uv index correspondence - - fi = geometry.faces.length; - - if ( hasFaceVertexUv ) { - - for ( i = 0; i < nUvLayers; i ++ ) { - - uvLayer = json.uvs[ i ]; - - geometry.faceVertexUvs[ i ][ fi ] = []; - geometry.faceVertexUvs[ i ][ fi + 1 ] = []; - - for ( j = 0; j < 4; j ++ ) { - - uvIndex = faces[ offset ++ ]; - - u = uvLayer[ uvIndex * 2 ]; - v = uvLayer[ uvIndex * 2 + 1 ]; - - uv = new Vector2( u, v ); - - if ( j !== 2 ) geometry.faceVertexUvs[ i ][ fi ].push( uv ); - if ( j !== 0 ) geometry.faceVertexUvs[ i ][ fi + 1 ].push( uv ); - - } - - } - - } - - if ( hasFaceNormal ) { - - normalIndex = faces[ offset ++ ] * 3; - - faceA.normal.set( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - faceB.normal.copy( faceA.normal ); - - } - - if ( hasFaceVertexNormal ) { - - for ( i = 0; i < 4; i ++ ) { - - normalIndex = faces[ offset ++ ] * 3; - - normal = new Vector3( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - - if ( i !== 2 ) faceA.vertexNormals.push( normal ); - if ( i !== 0 ) faceB.vertexNormals.push( normal ); - - } - - } - - - if ( hasFaceColor ) { - - colorIndex = faces[ offset ++ ]; - hex = colors[ colorIndex ]; - - faceA.color.setHex( hex ); - faceB.color.setHex( hex ); - - } - - - if ( hasFaceVertexColor ) { - - for ( i = 0; i < 4; i ++ ) { - - colorIndex = faces[ offset ++ ]; - hex = colors[ colorIndex ]; - - if ( i !== 2 ) faceA.vertexColors.push( new Color( hex ) ); - if ( i !== 0 ) faceB.vertexColors.push( new Color( hex ) ); - - } - - } - - geometry.faces.push( faceA ); - geometry.faces.push( faceB ); - - } else { - - face = new Face3(); - face.a = faces[ offset ++ ]; - face.b = faces[ offset ++ ]; - face.c = faces[ offset ++ ]; - - if ( hasMaterial ) { - - materialIndex = faces[ offset ++ ]; - face.materialIndex = materialIndex; - - } - - // to get face <=> uv index correspondence - - fi = geometry.faces.length; - - if ( hasFaceVertexUv ) { - - for ( i = 0; i < nUvLayers; i ++ ) { - - uvLayer = json.uvs[ i ]; - - geometry.faceVertexUvs[ i ][ fi ] = []; - - for ( j = 0; j < 3; j ++ ) { - - uvIndex = faces[ offset ++ ]; - - u = uvLayer[ uvIndex * 2 ]; - v = uvLayer[ uvIndex * 2 + 1 ]; - - uv = new Vector2( u, v ); - - geometry.faceVertexUvs[ i ][ fi ].push( uv ); - - } - - } - - } - - if ( hasFaceNormal ) { - - normalIndex = faces[ offset ++ ] * 3; - - face.normal.set( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - } - - if ( hasFaceVertexNormal ) { - - for ( i = 0; i < 3; i ++ ) { - - normalIndex = faces[ offset ++ ] * 3; - - normal = new Vector3( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - face.vertexNormals.push( normal ); - - } - - } - - - if ( hasFaceColor ) { - - colorIndex = faces[ offset ++ ]; - face.color.setHex( colors[ colorIndex ] ); - - } - - - if ( hasFaceVertexColor ) { - - for ( i = 0; i < 3; i ++ ) { - - colorIndex = faces[ offset ++ ]; - face.vertexColors.push( new Color( colors[ colorIndex ] ) ); - - } - - } - - geometry.faces.push( face ); - - } - - } - - } - - function parseSkin() { - - var influencesPerVertex = ( json.influencesPerVertex !== undefined ) ? json.influencesPerVertex : 2; - - if ( json.skinWeights ) { - - for ( var i = 0, l = json.skinWeights.length; i < l; i += influencesPerVertex ) { - - var x = json.skinWeights[ i ]; - var y = ( influencesPerVertex > 1 ) ? json.skinWeights[ i + 1 ] : 0; - var z = ( influencesPerVertex > 2 ) ? json.skinWeights[ i + 2 ] : 0; - var w = ( influencesPerVertex > 3 ) ? json.skinWeights[ i + 3 ] : 0; - - geometry.skinWeights.push( new Vector4( x, y, z, w ) ); - - } - - } - - if ( json.skinIndices ) { - - for ( var i = 0, l = json.skinIndices.length; i < l; i += influencesPerVertex ) { - - var a = json.skinIndices[ i ]; - var b = ( influencesPerVertex > 1 ) ? json.skinIndices[ i + 1 ] : 0; - var c = ( influencesPerVertex > 2 ) ? json.skinIndices[ i + 2 ] : 0; - var d = ( influencesPerVertex > 3 ) ? json.skinIndices[ i + 3 ] : 0; - - geometry.skinIndices.push( new Vector4( a, b, c, d ) ); - - } - - } - - geometry.bones = json.bones; - - if ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) { - - console.warn( 'When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' + - geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' ); - - } - - } - - function parseMorphing( scale ) { - - if ( json.morphTargets !== undefined ) { - - for ( var i = 0, l = json.morphTargets.length; i < l; i ++ ) { - - geometry.morphTargets[ i ] = {}; - geometry.morphTargets[ i ].name = json.morphTargets[ i ].name; - geometry.morphTargets[ i ].vertices = []; - - var dstVertices = geometry.morphTargets[ i ].vertices; - var srcVertices = json.morphTargets[ i ].vertices; - - for ( var v = 0, vl = srcVertices.length; v < vl; v += 3 ) { - - var vertex = new Vector3(); - vertex.x = srcVertices[ v ] * scale; - vertex.y = srcVertices[ v + 1 ] * scale; - vertex.z = srcVertices[ v + 2 ] * scale; - - dstVertices.push( vertex ); - - } - - } - - } - - if ( json.morphColors !== undefined && json.morphColors.length > 0 ) { - - console.warn( 'THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.' ); - - var faces = geometry.faces; - var morphColors = json.morphColors[ 0 ].colors; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - faces[ i ].color.fromArray( morphColors, i * 3 ); - - } - - } - - } - - function parseAnimations() { - - var outputAnimations = []; - - // parse old style Bone/Hierarchy animations - var animations = []; - - if ( json.animation !== undefined ) { - - animations.push( json.animation ); - - } - - if ( json.animations !== undefined ) { - - if ( json.animations.length ) { - - animations = animations.concat( json.animations ); - - } else { - - animations.push( json.animations ); - - } - - } - - for ( var i = 0; i < animations.length; i ++ ) { - - var clip = AnimationClip.parseAnimation( animations[ i ], geometry.bones ); - if ( clip ) outputAnimations.push( clip ); - - } - - // parse implicit morph animations - if ( geometry.morphTargets ) { - - // TODO: Figure out what an appropraite FPS is for morph target animations -- defaulting to 10, but really it is completely arbitrary. - var morphAnimationClips = AnimationClip.CreateClipsFromMorphTargetSequences( geometry.morphTargets, 10 ); - outputAnimations = outputAnimations.concat( morphAnimationClips ); - - } - - if ( outputAnimations.length > 0 ) geometry.animations = outputAnimations; - - } - - if ( json.materials === undefined || json.materials.length === 0 ) { - - return { geometry: geometry }; - - } else { - - var materials = Loader.prototype.initMaterials( json.materials, texturePath, this.crossOrigin ); - - return { geometry: geometry, materials: materials }; - - } - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function ObjectLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - this.texturePath = ''; - -} - -Object.assign( ObjectLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - if ( this.texturePath === '' ) { - - this.texturePath = url.substring( 0, url.lastIndexOf( '/' ) + 1 ); - - } - - var scope = this; - - var loader = new FileLoader( scope.manager ); - loader.load( url, function ( text ) { - - var json = null; - - try { - - json = JSON.parse( text ); - - } catch ( error ) { - - console.error( 'THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message ); - return; - - } - - var metadata = json.metadata; - - if ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) { - - console.error( 'THREE.ObjectLoader: Can\'t load ' + url + '. Use THREE.JSONLoader instead.' ); - return; - - } - - scope.parse( json, onLoad ); - - }, onProgress, onError ); - - }, - - setTexturePath: function ( value ) { - - this.texturePath = value; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json, onLoad ) { - - var geometries = this.parseGeometries( json.geometries ); - - var images = this.parseImages( json.images, function () { - - if ( onLoad !== undefined ) onLoad( object ); - - } ); - - var textures = this.parseTextures( json.textures, images ); - var materials = this.parseMaterials( json.materials, textures ); - - var object = this.parseObject( json.object, geometries, materials ); - - if ( json.animations ) { - - object.animations = this.parseAnimations( json.animations ); - - } - - if ( json.images === undefined || json.images.length === 0 ) { - - if ( onLoad !== undefined ) onLoad( object ); - - } - - return object; - - }, - - parseGeometries: function ( json ) { - - var geometries = {}; - - if ( json !== undefined ) { - - var geometryLoader = new JSONLoader(); - var bufferGeometryLoader = new BufferGeometryLoader(); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var geometry; - var data = json[ i ]; - - switch ( data.type ) { - - case 'PlaneGeometry': - case 'PlaneBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.width, - data.height, - data.widthSegments, - data.heightSegments - ); - - break; - - case 'BoxGeometry': - case 'BoxBufferGeometry': - case 'CubeGeometry': // backwards compatible - - geometry = new Geometries[ data.type ]( - data.width, - data.height, - data.depth, - data.widthSegments, - data.heightSegments, - data.depthSegments - ); - - break; - - case 'CircleGeometry': - case 'CircleBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.segments, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'CylinderGeometry': - case 'CylinderBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radiusTop, - data.radiusBottom, - data.height, - data.radialSegments, - data.heightSegments, - data.openEnded, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'ConeGeometry': - case 'ConeBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.height, - data.radialSegments, - data.heightSegments, - data.openEnded, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'SphereGeometry': - case 'SphereBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.widthSegments, - data.heightSegments, - data.phiStart, - data.phiLength, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'DodecahedronGeometry': - case 'IcosahedronGeometry': - case 'OctahedronGeometry': - case 'TetrahedronGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.detail - ); - - break; - - case 'RingGeometry': - case 'RingBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.innerRadius, - data.outerRadius, - data.thetaSegments, - data.phiSegments, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'TorusGeometry': - case 'TorusBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.tube, - data.radialSegments, - data.tubularSegments, - data.arc - ); - - break; - - case 'TorusKnotGeometry': - case 'TorusKnotBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.tube, - data.tubularSegments, - data.radialSegments, - data.p, - data.q - ); - - break; - - case 'LatheGeometry': - case 'LatheBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.points, - data.segments, - data.phiStart, - data.phiLength - ); - - break; - - case 'BufferGeometry': - - geometry = bufferGeometryLoader.parse( data ); - - break; - - case 'Geometry': - - geometry = geometryLoader.parse( data.data, this.texturePath ).geometry; - - break; - - default: - - console.warn( 'THREE.ObjectLoader: Unsupported geometry type "' + data.type + '"' ); - - continue; - - } - - geometry.uuid = data.uuid; - - if ( data.name !== undefined ) geometry.name = data.name; - - geometries[ data.uuid ] = geometry; - - } - - } - - return geometries; - - }, - - parseMaterials: function ( json, textures ) { - - var materials = {}; - - if ( json !== undefined ) { - - var loader = new MaterialLoader(); - loader.setTextures( textures ); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var material = loader.parse( json[ i ] ); - materials[ material.uuid ] = material; - - } - - } - - return materials; - - }, - - parseAnimations: function ( json ) { - - var animations = []; - - for ( var i = 0; i < json.length; i ++ ) { - - var clip = AnimationClip.parse( json[ i ] ); - - animations.push( clip ); - - } - - return animations; - - }, - - parseImages: function ( json, onLoad ) { - - var scope = this; - var images = {}; - - function loadImage( url ) { - - scope.manager.itemStart( url ); - - return loader.load( url, function () { - - scope.manager.itemEnd( url ); - - }, undefined, function () { - - scope.manager.itemError( url ); - - } ); - - } - - if ( json !== undefined && json.length > 0 ) { - - var manager = new LoadingManager( onLoad ); - - var loader = new ImageLoader( manager ); - loader.setCrossOrigin( this.crossOrigin ); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var image = json[ i ]; - var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url; - - images[ image.uuid ] = loadImage( path ); - - } - - } - - return images; - - }, - - parseTextures: function ( json, images ) { - - function parseConstant( value, type ) { - - if ( typeof( value ) === 'number' ) return value; - - console.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value ); - - return type[ value ]; - - } - - var textures = {}; - - if ( json !== undefined ) { - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var data = json[ i ]; - - if ( data.image === undefined ) { - - console.warn( 'THREE.ObjectLoader: No "image" specified for', data.uuid ); - - } - - if ( images[ data.image ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined image', data.image ); - - } - - var texture = new Texture( images[ data.image ] ); - texture.needsUpdate = true; - - texture.uuid = data.uuid; - - if ( data.name !== undefined ) texture.name = data.name; - - if ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TextureMapping ); - - if ( data.offset !== undefined ) texture.offset.fromArray( data.offset ); - if ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat ); - if ( data.wrap !== undefined ) { - - texture.wrapS = parseConstant( data.wrap[ 0 ], TextureWrapping ); - texture.wrapT = parseConstant( data.wrap[ 1 ], TextureWrapping ); - - } - - if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TextureFilter ); - if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TextureFilter ); - if ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy; - - if ( data.flipY !== undefined ) texture.flipY = data.flipY; - - textures[ data.uuid ] = texture; - - } - - } - - return textures; - - }, - - parseObject: function () { - - var matrix = new Matrix4(); - - return function parseObject( data, geometries, materials ) { - - var object; - - function getGeometry( name ) { - - if ( geometries[ name ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined geometry', name ); - - } - - return geometries[ name ]; - - } - - function getMaterial( name ) { - - if ( name === undefined ) return undefined; - - if ( materials[ name ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined material', name ); - - } - - return materials[ name ]; - - } - - switch ( data.type ) { - - case 'Scene': - - object = new Scene(); - - if ( data.background !== undefined ) { - - if ( Number.isInteger( data.background ) ) { - - object.background = new Color( data.background ); - - } - - } - - if ( data.fog !== undefined ) { - - if ( data.fog.type === 'Fog' ) { - - object.fog = new Fog( data.fog.color, data.fog.near, data.fog.far ); - - } else if ( data.fog.type === 'FogExp2' ) { - - object.fog = new FogExp2( data.fog.color, data.fog.density ); - - } - - } - - break; - - case 'PerspectiveCamera': - - object = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); - - if ( data.focus !== undefined ) object.focus = data.focus; - if ( data.zoom !== undefined ) object.zoom = data.zoom; - if ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge; - if ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset; - if ( data.view !== undefined ) object.view = Object.assign( {}, data.view ); - - break; - - case 'OrthographicCamera': - - object = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); - - break; - - case 'AmbientLight': - - object = new AmbientLight( data.color, data.intensity ); - - break; - - case 'DirectionalLight': - - object = new DirectionalLight( data.color, data.intensity ); - - break; - - case 'PointLight': - - object = new PointLight( data.color, data.intensity, data.distance, data.decay ); - - break; - - case 'SpotLight': - - object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay ); - - break; - - case 'HemisphereLight': - - object = new HemisphereLight( data.color, data.groundColor, data.intensity ); - - break; - - case 'Mesh': - - var geometry = getGeometry( data.geometry ); - var material = getMaterial( data.material ); - - if ( geometry.bones && geometry.bones.length > 0 ) { - - object = new SkinnedMesh( geometry, material ); - - } else { - - object = new Mesh( geometry, material ); - - } - - break; - - case 'LOD': - - object = new LOD(); - - break; - - case 'Line': - - object = new Line( getGeometry( data.geometry ), getMaterial( data.material ), data.mode ); - - break; - - case 'LineSegments': - - object = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'PointCloud': - case 'Points': - - object = new Points( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'Sprite': - - object = new Sprite( getMaterial( data.material ) ); - - break; - - case 'Group': - - object = new Group(); - - break; - - default: - - object = new Object3D(); - - } - - object.uuid = data.uuid; - - if ( data.name !== undefined ) object.name = data.name; - if ( data.matrix !== undefined ) { - - matrix.fromArray( data.matrix ); - matrix.decompose( object.position, object.quaternion, object.scale ); - - } else { - - if ( data.position !== undefined ) object.position.fromArray( data.position ); - if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); - if ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion ); - if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); - - } - - if ( data.castShadow !== undefined ) object.castShadow = data.castShadow; - if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow; - - if ( data.shadow ) { - - if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias; - if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius; - if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize ); - if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera ); - - } - - if ( data.visible !== undefined ) object.visible = data.visible; - if ( data.userData !== undefined ) object.userData = data.userData; - - if ( data.children !== undefined ) { - - for ( var child in data.children ) { - - object.add( this.parseObject( data.children[ child ], geometries, materials ) ); - - } - - } - - if ( data.type === 'LOD' ) { - - var levels = data.levels; - - for ( var l = 0; l < levels.length; l ++ ) { - - var level = levels[ l ]; - var child = object.getObjectByProperty( 'uuid', level.object ); - - if ( child !== undefined ) { - - object.addLevel( child, level.distance ); - - } - - } - - } - - return object; - - }; - - }() - -} ); - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Extensible curve object - * - * Some common of Curve methods - * .getPoint(t), getTangent(t) - * .getPointAt(u), getTangentAt(u) - * .getPoints(), .getSpacedPoints() - * .getLength() - * .updateArcLengths() - * - * This following classes subclasses THREE.Curve: - * - * -- 2d classes -- - * THREE.LineCurve - * THREE.QuadraticBezierCurve - * THREE.CubicBezierCurve - * THREE.SplineCurve - * THREE.ArcCurve - * THREE.EllipseCurve - * - * -- 3d classes -- - * THREE.LineCurve3 - * THREE.QuadraticBezierCurve3 - * THREE.CubicBezierCurve3 - * THREE.SplineCurve3 - * - * A series of curves can be represented as a THREE.CurvePath - * - **/ - -/************************************************************** - * Abstract Curve base class - **************************************************************/ - -function Curve() {} - -Curve.prototype = { - - constructor: Curve, - - // Virtual base class method to overwrite and implement in subclasses - // - t [0 .. 1] - - getPoint: function ( t ) { - - console.warn( "THREE.Curve: Warning, getPoint() not implemented!" ); - return null; - - }, - - // Get point at relative position in curve according to arc length - // - u [0 .. 1] - - getPointAt: function ( u ) { - - var t = this.getUtoTmapping( u ); - return this.getPoint( t ); - - }, - - // Get sequence of points using getPoint( t ) - - getPoints: function ( divisions ) { - - if ( ! divisions ) divisions = 5; - - var points = []; - - for ( var d = 0; d <= divisions; d ++ ) { - - points.push( this.getPoint( d / divisions ) ); - - } - - return points; - - }, - - // Get sequence of points using getPointAt( u ) - - getSpacedPoints: function ( divisions ) { - - if ( ! divisions ) divisions = 5; - - var points = []; - - for ( var d = 0; d <= divisions; d ++ ) { - - points.push( this.getPointAt( d / divisions ) ); - - } - - return points; - - }, - - // Get total curve arc length - - getLength: function () { - - var lengths = this.getLengths(); - return lengths[ lengths.length - 1 ]; - - }, - - // Get list of cumulative segment lengths - - getLengths: function ( divisions ) { - - if ( ! divisions ) divisions = ( this.__arcLengthDivisions ) ? ( this.__arcLengthDivisions ) : 200; - - if ( this.cacheArcLengths - && ( this.cacheArcLengths.length === divisions + 1 ) - && ! this.needsUpdate ) { - - //console.log( "cached", this.cacheArcLengths ); - return this.cacheArcLengths; - - } - - this.needsUpdate = false; - - var cache = []; - var current, last = this.getPoint( 0 ); - var p, sum = 0; - - cache.push( 0 ); - - for ( p = 1; p <= divisions; p ++ ) { - - current = this.getPoint ( p / divisions ); - sum += current.distanceTo( last ); - cache.push( sum ); - last = current; - - } - - this.cacheArcLengths = cache; - - return cache; // { sums: cache, sum:sum }; Sum is in the last element. - - }, - - updateArcLengths: function() { - - this.needsUpdate = true; - this.getLengths(); - - }, - - // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - - getUtoTmapping: function ( u, distance ) { - - var arcLengths = this.getLengths(); - - var i = 0, il = arcLengths.length; - - var targetArcLength; // The targeted u distance value to get - - if ( distance ) { - - targetArcLength = distance; - - } else { - - targetArcLength = u * arcLengths[ il - 1 ]; - - } - - //var time = Date.now(); - - // binary search for the index with largest value smaller than target u distance - - var low = 0, high = il - 1, comparison; - - while ( low <= high ) { - - i = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - - comparison = arcLengths[ i ] - targetArcLength; - - if ( comparison < 0 ) { - - low = i + 1; - - } else if ( comparison > 0 ) { - - high = i - 1; - - } else { - - high = i; - break; - - // DONE - - } - - } - - i = high; - - //console.log('b' , i, low, high, Date.now()- time); - - if ( arcLengths[ i ] === targetArcLength ) { - - var t = i / ( il - 1 ); - return t; - - } - - // we could get finer grain at lengths, or use simple interpolation between two points - - var lengthBefore = arcLengths[ i ]; - var lengthAfter = arcLengths[ i + 1 ]; - - var segmentLength = lengthAfter - lengthBefore; - - // determine where we are between the 'before' and 'after' points - - var segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength; - - // add that fractional amount to t - - var t = ( i + segmentFraction ) / ( il - 1 ); - - return t; - - }, - - // Returns a unit vector tangent at t - // In case any sub curve does not implement its tangent derivation, - // 2 points a small delta apart will be used to find its gradient - // which seems to give a reasonable approximation - - getTangent: function( t ) { - - var delta = 0.0001; - var t1 = t - delta; - var t2 = t + delta; - - // Capping in case of danger - - if ( t1 < 0 ) t1 = 0; - if ( t2 > 1 ) t2 = 1; - - var pt1 = this.getPoint( t1 ); - var pt2 = this.getPoint( t2 ); - - var vec = pt2.clone().sub( pt1 ); - return vec.normalize(); - - }, - - getTangentAt: function ( u ) { - - var t = this.getUtoTmapping( u ); - return this.getTangent( t ); - - }, - - computeFrenetFrames: function ( segments, closed ) { - - // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf - - var normal = new Vector3(); - - var tangents = []; - var normals = []; - var binormals = []; - - var vec = new Vector3(); - var mat = new Matrix4(); - - var i, u, theta; - - // compute the tangent vectors for each segment on the curve - - for ( i = 0; i <= segments; i ++ ) { - - u = i / segments; - - tangents[ i ] = this.getTangentAt( u ); - tangents[ i ].normalize(); - - } - - // select an initial normal vector perpendicular to the first tangent vector, - // and in the direction of the minimum tangent xyz component - - normals[ 0 ] = new Vector3(); - binormals[ 0 ] = new Vector3(); - var min = Number.MAX_VALUE; - var tx = Math.abs( tangents[ 0 ].x ); - var ty = Math.abs( tangents[ 0 ].y ); - var tz = Math.abs( tangents[ 0 ].z ); - - if ( tx <= min ) { - - min = tx; - normal.set( 1, 0, 0 ); - - } - - if ( ty <= min ) { - - min = ty; - normal.set( 0, 1, 0 ); - - } - - if ( tz <= min ) { - - normal.set( 0, 0, 1 ); - - } - - vec.crossVectors( tangents[ 0 ], normal ).normalize(); - - normals[ 0 ].crossVectors( tangents[ 0 ], vec ); - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ); - - - // compute the slowly-varying normal and binormal vectors for each segment on the curve - - for ( i = 1; i <= segments; i ++ ) { - - normals[ i ] = normals[ i - 1 ].clone(); - - binormals[ i ] = binormals[ i - 1 ].clone(); - - vec.crossVectors( tangents[ i - 1 ], tangents[ i ] ); - - if ( vec.length() > Number.EPSILON ) { - - vec.normalize(); - - theta = Math.acos( _Math.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors - - normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) ); - - } - - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same - - if ( closed === true ) { - - theta = Math.acos( _Math.clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) ); - theta /= segments; - - if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) { - - theta = - theta; - - } - - for ( i = 1; i <= segments; i ++ ) { - - // twist a little... - normals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) ); - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - } - - return { - tangents: tangents, - normals: normals, - binormals: binormals - }; - - } - -}; - -// TODO: Transformation for Curves? - -/************************************************************** - * 3D Curves - **************************************************************/ - -// A Factory method for creating new curve subclasses - -Curve.create = function ( constructor, getPointFunc ) { - - constructor.prototype = Object.create( Curve.prototype ); - constructor.prototype.constructor = constructor; - constructor.prototype.getPoint = getPointFunc; - - return constructor; - -}; - -/************************************************************** - * Line - **************************************************************/ - -function LineCurve( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - -} - -LineCurve.prototype = Object.create( Curve.prototype ); -LineCurve.prototype.constructor = LineCurve; - -LineCurve.prototype.isLineCurve = true; - -LineCurve.prototype.getPoint = function ( t ) { - - if ( t === 1 ) { - - return this.v2.clone(); - - } - - var point = this.v2.clone().sub( this.v1 ); - point.multiplyScalar( t ).add( this.v1 ); - - return point; - -}; - -// Line curve is linear, so we can overwrite default getPointAt - -LineCurve.prototype.getPointAt = function ( u ) { - - return this.getPoint( u ); - -}; - -LineCurve.prototype.getTangent = function( t ) { - - var tangent = this.v2.clone().sub( this.v1 ); - - return tangent.normalize(); - -}; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * - **/ - -/************************************************************** - * Curved Path - a curve path is simply a array of connected - * curves, but retains the api of a curve - **************************************************************/ - -function CurvePath() { - - this.curves = []; - - this.autoClose = false; // Automatically closes the path - -} - -CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { - - constructor: CurvePath, - - add: function ( curve ) { - - this.curves.push( curve ); - - }, - - closePath: function () { - - // Add a line curve if start and end of lines are not connected - var startPoint = this.curves[ 0 ].getPoint( 0 ); - var endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 ); - - if ( ! startPoint.equals( endPoint ) ) { - - this.curves.push( new LineCurve( endPoint, startPoint ) ); - - } - - }, - - // To get accurate point with reference to - // entire path distance at time t, - // following has to be done: - - // 1. Length of each sub path have to be known - // 2. Locate and identify type of curve - // 3. Get t for the curve - // 4. Return curve.getPointAt(t') - - getPoint: function ( t ) { - - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; - - // To think about boundaries points. - - while ( i < curveLengths.length ) { - - if ( curveLengths[ i ] >= d ) { - - var diff = curveLengths[ i ] - d; - var curve = this.curves[ i ]; - - var segmentLength = curve.getLength(); - var u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; - - return curve.getPointAt( u ); - - } - - i ++; - - } - - return null; - - // loop where sum != 0, sum > d , sum+1 <d - - }, - - // We cannot use the default THREE.Curve getPoint() with getLength() because in - // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath - // getPoint() depends on getLength - - getLength: function () { - - var lens = this.getCurveLengths(); - return lens[ lens.length - 1 ]; - - }, - - // cacheLengths must be recalculated. - updateArcLengths: function () { - - this.needsUpdate = true; - this.cacheLengths = null; - this.getLengths(); - - }, - - // Compute lengths and cache them - // We cannot overwrite getLengths() because UtoT mapping uses it. - - getCurveLengths: function () { - - // We use cache values if curves and cache array are same length - - if ( this.cacheLengths && this.cacheLengths.length === this.curves.length ) { - - return this.cacheLengths; - - } - - // Get length of sub-curve - // Push sums into cached array - - var lengths = [], sums = 0; - - for ( var i = 0, l = this.curves.length; i < l; i ++ ) { - - sums += this.curves[ i ].getLength(); - lengths.push( sums ); - - } - - this.cacheLengths = lengths; - - return lengths; - - }, - - getSpacedPoints: function ( divisions ) { - - if ( ! divisions ) divisions = 40; - - var points = []; - - for ( var i = 0; i <= divisions; i ++ ) { - - points.push( this.getPoint( i / divisions ) ); - - } - - if ( this.autoClose ) { - - points.push( points[ 0 ] ); - - } - - return points; - - }, - - getPoints: function ( divisions ) { - - divisions = divisions || 12; - - var points = [], last; - - for ( var i = 0, curves = this.curves; i < curves.length; i ++ ) { - - var curve = curves[ i ]; - var resolution = (curve && curve.isEllipseCurve) ? divisions * 2 - : (curve && curve.isLineCurve) ? 1 - : (curve && curve.isSplineCurve) ? divisions * curve.points.length - : divisions; - - var pts = curve.getPoints( resolution ); - - for ( var j = 0; j < pts.length; j++ ) { - - var point = pts[ j ]; - - if ( last && last.equals( point ) ) continue; // ensures no consecutive points are duplicates - - points.push( point ); - last = point; - - } - - } - - if ( this.autoClose && points.length > 1 && !points[ points.length - 1 ].equals( points[ 0 ] ) ) { - - points.push( points[ 0 ] ); - - } - - return points; - - }, - - /************************************************************** - * Create Geometries Helpers - **************************************************************/ - - /// Generate geometry from path points (for Line or Points objects) - - createPointsGeometry: function ( divisions ) { - - var pts = this.getPoints( divisions ); - return this.createGeometry( pts ); - - }, - - // Generate geometry from equidistant sampling along the path - - createSpacedPointsGeometry: function ( divisions ) { - - var pts = this.getSpacedPoints( divisions ); - return this.createGeometry( pts ); - - }, - - createGeometry: function ( points ) { - - var geometry = new Geometry(); - - for ( var i = 0, l = points.length; i < l; i ++ ) { - - var point = points[ i ]; - geometry.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) ); - - } - - return geometry; - - } - -} ); - -/************************************************************** - * Ellipse curve - **************************************************************/ - -function EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - - this.aX = aX; - this.aY = aY; - - this.xRadius = xRadius; - this.yRadius = yRadius; - - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - - this.aClockwise = aClockwise; - - this.aRotation = aRotation || 0; - -} - -EllipseCurve.prototype = Object.create( Curve.prototype ); -EllipseCurve.prototype.constructor = EllipseCurve; - -EllipseCurve.prototype.isEllipseCurve = true; - -EllipseCurve.prototype.getPoint = function( t ) { - - var twoPi = Math.PI * 2; - var deltaAngle = this.aEndAngle - this.aStartAngle; - var samePoints = Math.abs( deltaAngle ) < Number.EPSILON; - - // ensures that deltaAngle is 0 .. 2 PI - while ( deltaAngle < 0 ) deltaAngle += twoPi; - while ( deltaAngle > twoPi ) deltaAngle -= twoPi; - - if ( deltaAngle < Number.EPSILON ) { - - if ( samePoints ) { - - deltaAngle = 0; - - } else { - - deltaAngle = twoPi; - - } - - } - - if ( this.aClockwise === true && ! samePoints ) { - - if ( deltaAngle === twoPi ) { - - deltaAngle = - twoPi; - - } else { - - deltaAngle = deltaAngle - twoPi; - - } - - } - - var angle = this.aStartAngle + t * deltaAngle; - var x = this.aX + this.xRadius * Math.cos( angle ); - var y = this.aY + this.yRadius * Math.sin( angle ); - - if ( this.aRotation !== 0 ) { - - var cos = Math.cos( this.aRotation ); - var sin = Math.sin( this.aRotation ); - - var tx = x - this.aX; - var ty = y - this.aY; - - // Rotate the point about the center of the ellipse. - x = tx * cos - ty * sin + this.aX; - y = tx * sin + ty * cos + this.aY; - - } - - return new Vector2( x, y ); - -}; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - -var CurveUtils = { - - tangentQuadraticBezier: function ( t, p0, p1, p2 ) { - - return 2 * ( 1 - t ) * ( p1 - p0 ) + 2 * t * ( p2 - p1 ); - - }, - - // Puay Bing, thanks for helping with this derivative! - - tangentCubicBezier: function ( t, p0, p1, p2, p3 ) { - - return - 3 * p0 * ( 1 - t ) * ( 1 - t ) + - 3 * p1 * ( 1 - t ) * ( 1 - t ) - 6 * t * p1 * ( 1 - t ) + - 6 * t * p2 * ( 1 - t ) - 3 * t * t * p2 + - 3 * t * t * p3; - - }, - - tangentSpline: function ( t, p0, p1, p2, p3 ) { - - // To check if my formulas are correct - - var h00 = 6 * t * t - 6 * t; // derived from 2t^3 − 3t^2 + 1 - var h10 = 3 * t * t - 4 * t + 1; // t^3 − 2t^2 + t - var h01 = - 6 * t * t + 6 * t; // − 2t3 + 3t2 - var h11 = 3 * t * t - 2 * t; // t3 − t2 - - return h00 + h10 + h01 + h11; - - }, - - // Catmull-Rom - - interpolate: function( p0, p1, p2, p3, t ) { - - var v0 = ( p2 - p0 ) * 0.5; - var v1 = ( p3 - p1 ) * 0.5; - var t2 = t * t; - var t3 = t * t2; - return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - } - -}; - -/************************************************************** - * Spline curve - **************************************************************/ - -function SplineCurve( points /* array of Vector2 */ ) { - - this.points = ( points === undefined ) ? [] : points; - -} - -SplineCurve.prototype = Object.create( Curve.prototype ); -SplineCurve.prototype.constructor = SplineCurve; - -SplineCurve.prototype.isSplineCurve = true; - -SplineCurve.prototype.getPoint = function ( t ) { - - var points = this.points; - var point = ( points.length - 1 ) * t; - - var intPoint = Math.floor( point ); - var weight = point - intPoint; - - var point0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ]; - var point1 = points[ intPoint ]; - var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ]; - var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ]; - - var interpolate = CurveUtils.interpolate; - - return new Vector2( - interpolate( point0.x, point1.x, point2.x, point3.x, weight ), - interpolate( point0.y, point1.y, point2.y, point3.y, weight ) - ); - -}; - -/************************************************************** - * Cubic Bezier curve - **************************************************************/ - -function CubicBezierCurve( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - -} - -CubicBezierCurve.prototype = Object.create( Curve.prototype ); -CubicBezierCurve.prototype.constructor = CubicBezierCurve; - -CubicBezierCurve.prototype.getPoint = function ( t ) { - - var b3 = ShapeUtils.b3; - - return new Vector2( - b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ), - b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ) - ); - -}; - -CubicBezierCurve.prototype.getTangent = function( t ) { - - var tangentCubicBezier = CurveUtils.tangentCubicBezier; - - return new Vector2( - tangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ), - tangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ) - ).normalize(); - -}; - -/************************************************************** - * Quadratic Bezier curve - **************************************************************/ - - -function QuadraticBezierCurve( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - -} - -QuadraticBezierCurve.prototype = Object.create( Curve.prototype ); -QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve; - - -QuadraticBezierCurve.prototype.getPoint = function ( t ) { - - var b2 = ShapeUtils.b2; - - return new Vector2( - b2( t, this.v0.x, this.v1.x, this.v2.x ), - b2( t, this.v0.y, this.v1.y, this.v2.y ) - ); - -}; - - -QuadraticBezierCurve.prototype.getTangent = function( t ) { - - var tangentQuadraticBezier = CurveUtils.tangentQuadraticBezier; - - return new Vector2( - tangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ), - tangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y ) - ).normalize(); - -}; - -var PathPrototype = Object.assign( Object.create( CurvePath.prototype ), { - - fromPoints: function ( vectors ) { - - this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y ); - - for ( var i = 1, l = vectors.length; i < l; i ++ ) { - - this.lineTo( vectors[ i ].x, vectors[ i ].y ); - - } - - }, - - moveTo: function ( x, y ) { - - this.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying? - - }, - - lineTo: function ( x, y ) { - - var curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) ); - this.curves.push( curve ); - - this.currentPoint.set( x, y ); - - }, - - quadraticCurveTo: function ( aCPx, aCPy, aX, aY ) { - - var curve = new QuadraticBezierCurve( - this.currentPoint.clone(), - new Vector2( aCPx, aCPy ), - new Vector2( aX, aY ) - ); - - this.curves.push( curve ); - - this.currentPoint.set( aX, aY ); - - }, - - bezierCurveTo: function ( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) { - - var curve = new CubicBezierCurve( - this.currentPoint.clone(), - new Vector2( aCP1x, aCP1y ), - new Vector2( aCP2x, aCP2y ), - new Vector2( aX, aY ) - ); - - this.curves.push( curve ); - - this.currentPoint.set( aX, aY ); - - }, - - splineThru: function ( pts /*Array of Vector*/ ) { - - var npts = [ this.currentPoint.clone() ].concat( pts ); - - var curve = new SplineCurve( npts ); - this.curves.push( curve ); - - this.currentPoint.copy( pts[ pts.length - 1 ] ); - - }, - - arc: function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - var x0 = this.currentPoint.x; - var y0 = this.currentPoint.y; - - this.absarc( aX + x0, aY + y0, aRadius, - aStartAngle, aEndAngle, aClockwise ); - - }, - - absarc: function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - this.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); - - }, - - ellipse: function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - - var x0 = this.currentPoint.x; - var y0 = this.currentPoint.y; - - this.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ); - - }, - - absellipse: function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - - var curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ); - - if ( this.curves.length > 0 ) { - - // if a previous curve is present, attempt to join - var firstPoint = curve.getPoint( 0 ); - - if ( ! firstPoint.equals( this.currentPoint ) ) { - - this.lineTo( firstPoint.x, firstPoint.y ); - - } - - } - - this.curves.push( curve ); - - var lastPoint = curve.getPoint( 1 ); - this.currentPoint.copy( lastPoint ); - - } - -} ); - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Defines a 2d shape plane using paths. - **/ - -// STEP 1 Create a path. -// STEP 2 Turn path into shape. -// STEP 3 ExtrudeGeometry takes in Shape/Shapes -// STEP 3a - Extract points from each shape, turn to vertices -// STEP 3b - Triangulate each shape, add faces. - -function Shape() { - - Path.apply( this, arguments ); - - this.holes = []; - -} - -Shape.prototype = Object.assign( Object.create( PathPrototype ), { - - constructor: Shape, - - getPointsHoles: function ( divisions ) { - - var holesPts = []; - - for ( var i = 0, l = this.holes.length; i < l; i ++ ) { - - holesPts[ i ] = this.holes[ i ].getPoints( divisions ); - - } - - return holesPts; - - }, - - // Get points of shape and holes (keypoints based on segments parameter) - - extractAllPoints: function ( divisions ) { - - return { - - shape: this.getPoints( divisions ), - holes: this.getPointsHoles( divisions ) - - }; - - }, - - extractPoints: function ( divisions ) { - - return this.extractAllPoints( divisions ); - - } - -} ); - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Creates free form 2d path using series of points, lines or curves. - * - **/ - -function Path( points ) { - - CurvePath.call( this ); - this.currentPoint = new Vector2(); - - if ( points ) { - - this.fromPoints( points ); - - } - -} - -Path.prototype = PathPrototype; -PathPrototype.constructor = Path; - - -// minimal class for proxing functions to Path. Replaces old "extractSubpaths()" -function ShapePath() { - this.subPaths = []; - this.currentPath = null; -} - -ShapePath.prototype = { - moveTo: function ( x, y ) { - this.currentPath = new Path(); - this.subPaths.push(this.currentPath); - this.currentPath.moveTo( x, y ); - }, - lineTo: function ( x, y ) { - this.currentPath.lineTo( x, y ); - }, - quadraticCurveTo: function ( aCPx, aCPy, aX, aY ) { - this.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY ); - }, - bezierCurveTo: function ( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) { - this.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ); - }, - splineThru: function ( pts ) { - this.currentPath.splineThru( pts ); - }, - - toShapes: function ( isCCW, noHoles ) { - - function toShapesNoHoles( inSubpaths ) { - - var shapes = []; - - for ( var i = 0, l = inSubpaths.length; i < l; i ++ ) { - - var tmpPath = inSubpaths[ i ]; - - var tmpShape = new Shape(); - tmpShape.curves = tmpPath.curves; - - shapes.push( tmpShape ); - - } - - return shapes; - - } - - function isPointInsidePolygon( inPt, inPolygon ) { - - var polyLen = inPolygon.length; - - // inPt on polygon contour => immediate success or - // toggling of inside/outside at every single! intersection point of an edge - // with the horizontal line through inPt, left of inPt - // not counting lowerY endpoints of edges and whole edges on that line - var inside = false; - for ( var p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) { - - var edgeLowPt = inPolygon[ p ]; - var edgeHighPt = inPolygon[ q ]; - - var edgeDx = edgeHighPt.x - edgeLowPt.x; - var edgeDy = edgeHighPt.y - edgeLowPt.y; - - if ( Math.abs( edgeDy ) > Number.EPSILON ) { - - // not parallel - if ( edgeDy < 0 ) { - - edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx; - edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy; - - } - if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue; - - if ( inPt.y === edgeLowPt.y ) { - - if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ? - // continue; // no intersection or edgeLowPt => doesn't count !!! - - } else { - - var perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y ); - if ( perpEdge === 0 ) return true; // inPt is on contour ? - if ( perpEdge < 0 ) continue; - inside = ! inside; // true intersection left of inPt - - } - - } else { - - // parallel or collinear - if ( inPt.y !== edgeLowPt.y ) continue; // parallel - // edge lies on the same horizontal line as inPt - if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) || - ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour ! - // continue; - - } - - } - - return inside; - - } - - var isClockWise = ShapeUtils.isClockWise; - - var subPaths = this.subPaths; - if ( subPaths.length === 0 ) return []; - - if ( noHoles === true ) return toShapesNoHoles( subPaths ); - - - var solid, tmpPath, tmpShape, shapes = []; - - if ( subPaths.length === 1 ) { - - tmpPath = subPaths[ 0 ]; - tmpShape = new Shape(); - tmpShape.curves = tmpPath.curves; - shapes.push( tmpShape ); - return shapes; - - } - - var holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() ); - holesFirst = isCCW ? ! holesFirst : holesFirst; - - // console.log("Holes first", holesFirst); - - var betterShapeHoles = []; - var newShapes = []; - var newShapeHoles = []; - var mainIdx = 0; - var tmpPoints; - - newShapes[ mainIdx ] = undefined; - newShapeHoles[ mainIdx ] = []; - - for ( var i = 0, l = subPaths.length; i < l; i ++ ) { - - tmpPath = subPaths[ i ]; - tmpPoints = tmpPath.getPoints(); - solid = isClockWise( tmpPoints ); - solid = isCCW ? ! solid : solid; - - if ( solid ) { - - if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) mainIdx ++; - - newShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints }; - newShapes[ mainIdx ].s.curves = tmpPath.curves; - - if ( holesFirst ) mainIdx ++; - newShapeHoles[ mainIdx ] = []; - - //console.log('cw', i); - - } else { - - newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } ); - - //console.log('ccw', i); - - } - - } - - // only Holes? -> probably all Shapes with wrong orientation - if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths ); - - - if ( newShapes.length > 1 ) { - - var ambiguous = false; - var toChange = []; - - for ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) { - - betterShapeHoles[ sIdx ] = []; - - } - - for ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) { - - var sho = newShapeHoles[ sIdx ]; - - for ( var hIdx = 0; hIdx < sho.length; hIdx ++ ) { - - var ho = sho[ hIdx ]; - var hole_unassigned = true; - - for ( var s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) { - - if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) { - - if ( sIdx !== s2Idx ) toChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } ); - if ( hole_unassigned ) { - - hole_unassigned = false; - betterShapeHoles[ s2Idx ].push( ho ); - - } else { - - ambiguous = true; - - } - - } - - } - if ( hole_unassigned ) { - - betterShapeHoles[ sIdx ].push( ho ); - - } - - } - - } - // console.log("ambiguous: ", ambiguous); - if ( toChange.length > 0 ) { - - // console.log("to change: ", toChange); - if ( ! ambiguous ) newShapeHoles = betterShapeHoles; - - } - - } - - var tmpHoles; - - for ( var i = 0, il = newShapes.length; i < il; i ++ ) { - - tmpShape = newShapes[ i ].s; - shapes.push( tmpShape ); - tmpHoles = newShapeHoles[ i ]; - - for ( var j = 0, jl = tmpHoles.length; j < jl; j ++ ) { - - tmpShape.holes.push( tmpHoles[ j ].h ); - - } - - } - - //console.log("shape", shapes); - - return shapes; - - } -}; - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author mrdoob / http://mrdoob.com/ - */ - -function Font( data ) { - - this.data = data; - -} - -Object.assign( Font.prototype, { - - isFont: true, - - generateShapes: function ( text, size, divisions ) { - - function createPaths( text ) { - - var chars = String( text ).split( '' ); - var scale = size / data.resolution; - var offset = 0; - - var paths = []; - - for ( var i = 0; i < chars.length; i ++ ) { - - var ret = createPath( chars[ i ], scale, offset ); - offset += ret.offset; - - paths.push( ret.path ); - - } - - return paths; - - } - - function createPath( c, scale, offset ) { - - var glyph = data.glyphs[ c ] || data.glyphs[ '?' ]; - - if ( ! glyph ) return; - - var path = new ShapePath(); - - var pts = [], b2 = ShapeUtils.b2, b3 = ShapeUtils.b3; - var x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2, laste; - - if ( glyph.o ) { - - var outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) ); - - for ( var i = 0, l = outline.length; i < l; ) { - - var action = outline[ i ++ ]; - - switch ( action ) { - - case 'm': // moveTo - - x = outline[ i ++ ] * scale + offset; - y = outline[ i ++ ] * scale; - - path.moveTo( x, y ); - - break; - - case 'l': // lineTo - - x = outline[ i ++ ] * scale + offset; - y = outline[ i ++ ] * scale; - - path.lineTo( x, y ); - - break; - - case 'q': // quadraticCurveTo - - cpx = outline[ i ++ ] * scale + offset; - cpy = outline[ i ++ ] * scale; - cpx1 = outline[ i ++ ] * scale + offset; - cpy1 = outline[ i ++ ] * scale; - - path.quadraticCurveTo( cpx1, cpy1, cpx, cpy ); - - laste = pts[ pts.length - 1 ]; - - if ( laste ) { - - cpx0 = laste.x; - cpy0 = laste.y; - - for ( var i2 = 1; i2 <= divisions; i2 ++ ) { - - var t = i2 / divisions; - b2( t, cpx0, cpx1, cpx ); - b2( t, cpy0, cpy1, cpy ); - - } - - } - - break; - - case 'b': // bezierCurveTo - - cpx = outline[ i ++ ] * scale + offset; - cpy = outline[ i ++ ] * scale; - cpx1 = outline[ i ++ ] * scale + offset; - cpy1 = outline[ i ++ ] * scale; - cpx2 = outline[ i ++ ] * scale + offset; - cpy2 = outline[ i ++ ] * scale; - - path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy ); - - laste = pts[ pts.length - 1 ]; - - if ( laste ) { - - cpx0 = laste.x; - cpy0 = laste.y; - - for ( var i2 = 1; i2 <= divisions; i2 ++ ) { - - var t = i2 / divisions; - b3( t, cpx0, cpx1, cpx2, cpx ); - b3( t, cpy0, cpy1, cpy2, cpy ); - - } - - } - - break; - - } - - } - - } - - return { offset: glyph.ha * scale, path: path }; - - } - - // - - if ( size === undefined ) size = 100; - if ( divisions === undefined ) divisions = 4; - - var data = this.data; - - var paths = createPaths( text ); - var shapes = []; - - for ( var p = 0, pl = paths.length; p < pl; p ++ ) { - - Array.prototype.push.apply( shapes, paths[ p ].toShapes() ); - - } - - return shapes; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function FontLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - -} - -Object.assign( FontLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new FileLoader( this.manager ); - loader.load( url, function ( text ) { - - var json; - - try { - - json = JSON.parse( text ); - - } catch ( e ) { - - console.warn( 'THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.' ); - json = JSON.parse( text.substring( 65, text.length - 2 ) ); - - } - - var font = scope.parse( json ); - - if ( onLoad ) onLoad( font ); - - }, onProgress, onError ); - - }, - - parse: function ( json ) { - - return new Font( json ); - - } - -} ); - -var context; - -var AudioContext = { - - getContext: function () { - - if ( context === undefined ) { - - context = new ( window.AudioContext || window.webkitAudioContext )(); - - } - - return context; - - }, - - setContext: function ( value ) { - - context = value; - - } - -}; - -/** - * @author Reece Aaron Lecrivain / http://reecenotes.com/ - */ - -function AudioLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - -} - -Object.assign( AudioLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var loader = new FileLoader( this.manager ); - loader.setResponseType( 'arraybuffer' ); - loader.load( url, function ( buffer ) { - - var context = AudioContext.getContext(); - - context.decodeAudioData( buffer, function ( audioBuffer ) { - - onLoad( audioBuffer ); - - } ); - - }, onProgress, onError ); - - } - -} ); - -/** - * @author abelnation / http://github.com/abelnation - */ - -function RectAreaLight ( color, intensity, width, height ) { - - Light.call( this, color, intensity ); - - this.type = 'RectAreaLight'; - - this.position.set( 0, 1, 0 ); - this.updateMatrix(); - - this.width = ( width !== undefined ) ? width : 10; - this.height = ( height !== undefined ) ? height : 10; - - // TODO (abelnation): distance/decay - - // TODO (abelnation): update method for RectAreaLight to update transform to lookat target - - // TODO (abelnation): shadows - // this.shadow = new THREE.RectAreaLightShadow( new THREE.PerspectiveCamera( 90, 1, 0.5, 500 ) ); - -} - -// TODO (abelnation): RectAreaLight update when light shape is changed -RectAreaLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: RectAreaLight, - - isRectAreaLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.width = source.width; - this.height = source.height; - - // this.shadow = source.shadow.clone(); - - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function StereoCamera() { - - this.type = 'StereoCamera'; - - this.aspect = 1; - - this.eyeSep = 0.064; - - this.cameraL = new PerspectiveCamera(); - this.cameraL.layers.enable( 1 ); - this.cameraL.matrixAutoUpdate = false; - - this.cameraR = new PerspectiveCamera(); - this.cameraR.layers.enable( 2 ); - this.cameraR.matrixAutoUpdate = false; - -} - -Object.assign( StereoCamera.prototype, { - - update: ( function () { - - var instance, focus, fov, aspect, near, far, zoom; - - var eyeRight = new Matrix4(); - var eyeLeft = new Matrix4(); - - return function update( camera ) { - - var needsUpdate = instance !== this || focus !== camera.focus || fov !== camera.fov || - aspect !== camera.aspect * this.aspect || near !== camera.near || - far !== camera.far || zoom !== camera.zoom; - - if ( needsUpdate ) { - - instance = this; - focus = camera.focus; - fov = camera.fov; - aspect = camera.aspect * this.aspect; - near = camera.near; - far = camera.far; - zoom = camera.zoom; - - // Off-axis stereoscopic effect based on - // http://paulbourke.net/stereographics/stereorender/ - - var projectionMatrix = camera.projectionMatrix.clone(); - var eyeSep = this.eyeSep / 2; - var eyeSepOnProjection = eyeSep * near / focus; - var ymax = ( near * Math.tan( _Math.DEG2RAD * fov * 0.5 ) ) / zoom; - var xmin, xmax; - - // translate xOffset - - eyeLeft.elements[ 12 ] = - eyeSep; - eyeRight.elements[ 12 ] = eyeSep; - - // for left eye - - xmin = - ymax * aspect + eyeSepOnProjection; - xmax = ymax * aspect + eyeSepOnProjection; - - projectionMatrix.elements[ 0 ] = 2 * near / ( xmax - xmin ); - projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin ); - - this.cameraL.projectionMatrix.copy( projectionMatrix ); - - // for right eye - - xmin = - ymax * aspect - eyeSepOnProjection; - xmax = ymax * aspect - eyeSepOnProjection; - - projectionMatrix.elements[ 0 ] = 2 * near / ( xmax - xmin ); - projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin ); - - this.cameraR.projectionMatrix.copy( projectionMatrix ); - - } - - this.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( eyeLeft ); - this.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( eyeRight ); - - }; - - } )() - -} ); - -/** - * Camera for rendering cube maps - * - renders scene into axis-aligned cube - * - * @author alteredq / http://alteredqualia.com/ - */ - -function CubeCamera( near, far, cubeResolution ) { - - Object3D.call( this ); - - this.type = 'CubeCamera'; - - var fov = 90, aspect = 1; - - var cameraPX = new PerspectiveCamera( fov, aspect, near, far ); - cameraPX.up.set( 0, - 1, 0 ); - cameraPX.lookAt( new Vector3( 1, 0, 0 ) ); - this.add( cameraPX ); - - var cameraNX = new PerspectiveCamera( fov, aspect, near, far ); - cameraNX.up.set( 0, - 1, 0 ); - cameraNX.lookAt( new Vector3( - 1, 0, 0 ) ); - this.add( cameraNX ); - - var cameraPY = new PerspectiveCamera( fov, aspect, near, far ); - cameraPY.up.set( 0, 0, 1 ); - cameraPY.lookAt( new Vector3( 0, 1, 0 ) ); - this.add( cameraPY ); - - var cameraNY = new PerspectiveCamera( fov, aspect, near, far ); - cameraNY.up.set( 0, 0, - 1 ); - cameraNY.lookAt( new Vector3( 0, - 1, 0 ) ); - this.add( cameraNY ); - - var cameraPZ = new PerspectiveCamera( fov, aspect, near, far ); - cameraPZ.up.set( 0, - 1, 0 ); - cameraPZ.lookAt( new Vector3( 0, 0, 1 ) ); - this.add( cameraPZ ); - - var cameraNZ = new PerspectiveCamera( fov, aspect, near, far ); - cameraNZ.up.set( 0, - 1, 0 ); - cameraNZ.lookAt( new Vector3( 0, 0, - 1 ) ); - this.add( cameraNZ ); - - var options = { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter }; - - this.renderTarget = new WebGLRenderTargetCube( cubeResolution, cubeResolution, options ); - - this.updateCubeMap = function ( renderer, scene ) { - - if ( this.parent === null ) this.updateMatrixWorld(); - - var renderTarget = this.renderTarget; - var generateMipmaps = renderTarget.texture.generateMipmaps; - - renderTarget.texture.generateMipmaps = false; - - renderTarget.activeCubeFace = 0; - renderer.render( scene, cameraPX, renderTarget ); - - renderTarget.activeCubeFace = 1; - renderer.render( scene, cameraNX, renderTarget ); - - renderTarget.activeCubeFace = 2; - renderer.render( scene, cameraPY, renderTarget ); - - renderTarget.activeCubeFace = 3; - renderer.render( scene, cameraNY, renderTarget ); - - renderTarget.activeCubeFace = 4; - renderer.render( scene, cameraPZ, renderTarget ); - - renderTarget.texture.generateMipmaps = generateMipmaps; - - renderTarget.activeCubeFace = 5; - renderer.render( scene, cameraNZ, renderTarget ); - - renderer.setRenderTarget( null ); - - }; - -} - -CubeCamera.prototype = Object.create( Object3D.prototype ); -CubeCamera.prototype.constructor = CubeCamera; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function AudioListener() { - - Object3D.call( this ); - - this.type = 'AudioListener'; - - this.context = AudioContext.getContext(); - - this.gain = this.context.createGain(); - this.gain.connect( this.context.destination ); - - this.filter = null; - -} - -AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: AudioListener, - - getInput: function () { - - return this.gain; - - }, - - removeFilter: function ( ) { - - if ( this.filter !== null ) { - - this.gain.disconnect( this.filter ); - this.filter.disconnect( this.context.destination ); - this.gain.connect( this.context.destination ); - this.filter = null; - - } - - }, - - getFilter: function () { - - return this.filter; - - }, - - setFilter: function ( value ) { - - if ( this.filter !== null ) { - - this.gain.disconnect( this.filter ); - this.filter.disconnect( this.context.destination ); - - } else { - - this.gain.disconnect( this.context.destination ); - - } - - this.filter = value; - this.gain.connect( this.filter ); - this.filter.connect( this.context.destination ); - - }, - - getMasterVolume: function () { - - return this.gain.gain.value; - - }, - - setMasterVolume: function ( value ) { - - this.gain.gain.value = value; - - }, - - updateMatrixWorld: ( function () { - - var position = new Vector3(); - var quaternion = new Quaternion(); - var scale = new Vector3(); - - var orientation = new Vector3(); - - return function updateMatrixWorld( force ) { - - Object3D.prototype.updateMatrixWorld.call( this, force ); - - var listener = this.context.listener; - var up = this.up; - - this.matrixWorld.decompose( position, quaternion, scale ); - - orientation.set( 0, 0, - 1 ).applyQuaternion( quaternion ); - - if ( listener.positionX ) { - - listener.positionX.setValueAtTime( position.x, this.context.currentTime ); - listener.positionY.setValueAtTime( position.y, this.context.currentTime ); - listener.positionZ.setValueAtTime( position.z, this.context.currentTime ); - listener.forwardX.setValueAtTime( orientation.x, this.context.currentTime ); - listener.forwardY.setValueAtTime( orientation.y, this.context.currentTime ); - listener.forwardZ.setValueAtTime( orientation.z, this.context.currentTime ); - listener.upX.setValueAtTime( up.x, this.context.currentTime ); - listener.upY.setValueAtTime( up.y, this.context.currentTime ); - listener.upZ.setValueAtTime( up.z, this.context.currentTime ); - - } else { - - listener.setPosition( position.x, position.y, position.z ); - listener.setOrientation( orientation.x, orientation.y, orientation.z, up.x, up.y, up.z ); - - } - - }; - - } )() - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author Reece Aaron Lecrivain / http://reecenotes.com/ - */ - -function Audio( listener ) { - - Object3D.call( this ); - - this.type = 'Audio'; - - this.context = listener.context; - - this.gain = this.context.createGain(); - this.gain.connect( listener.getInput() ); - - this.autoplay = false; - - this.buffer = null; - this.loop = false; - this.startTime = 0; - this.playbackRate = 1; - this.isPlaying = false; - this.hasPlaybackControl = true; - this.sourceType = 'empty'; - - this.filters = []; - -} - -Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Audio, - - getOutput: function () { - - return this.gain; - - }, - - setNodeSource: function ( audioNode ) { - - this.hasPlaybackControl = false; - this.sourceType = 'audioNode'; - this.source = audioNode; - this.connect(); - - return this; - - }, - - setBuffer: function ( audioBuffer ) { - - this.buffer = audioBuffer; - this.sourceType = 'buffer'; - - if ( this.autoplay ) this.play(); - - return this; - - }, - - play: function () { - - if ( this.isPlaying === true ) { - - console.warn( 'THREE.Audio: Audio is already playing.' ); - return; - - } - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - var source = this.context.createBufferSource(); - - source.buffer = this.buffer; - source.loop = this.loop; - source.onended = this.onEnded.bind( this ); - source.playbackRate.setValueAtTime( this.playbackRate, this.startTime ); - source.start( 0, this.startTime ); - - this.isPlaying = true; - - this.source = source; - - return this.connect(); - - }, - - pause: function () { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.source.stop(); - this.startTime = this.context.currentTime; - this.isPlaying = false; - - return this; - - }, - - stop: function () { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.source.stop(); - this.startTime = 0; - this.isPlaying = false; - - return this; - - }, - - connect: function () { - - if ( this.filters.length > 0 ) { - - this.source.connect( this.filters[ 0 ] ); - - for ( var i = 1, l = this.filters.length; i < l; i ++ ) { - - this.filters[ i - 1 ].connect( this.filters[ i ] ); - - } - - this.filters[ this.filters.length - 1 ].connect( this.getOutput() ); - - } else { - - this.source.connect( this.getOutput() ); - - } - - return this; - - }, - - disconnect: function () { - - if ( this.filters.length > 0 ) { - - this.source.disconnect( this.filters[ 0 ] ); - - for ( var i = 1, l = this.filters.length; i < l; i ++ ) { - - this.filters[ i - 1 ].disconnect( this.filters[ i ] ); - - } - - this.filters[ this.filters.length - 1 ].disconnect( this.getOutput() ); - - } else { - - this.source.disconnect( this.getOutput() ); - - } - - return this; - - }, - - getFilters: function () { - - return this.filters; - - }, - - setFilters: function ( value ) { - - if ( ! value ) value = []; - - if ( this.isPlaying === true ) { - - this.disconnect(); - this.filters = value; - this.connect(); - - } else { - - this.filters = value; - - } - - return this; - - }, - - getFilter: function () { - - return this.getFilters()[ 0 ]; - - }, - - setFilter: function ( filter ) { - - return this.setFilters( filter ? [ filter ] : [] ); - - }, - - setPlaybackRate: function ( value ) { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.playbackRate = value; - - if ( this.isPlaying === true ) { - - this.source.playbackRate.setValueAtTime( this.playbackRate, this.context.currentTime ); - - } - - return this; - - }, - - getPlaybackRate: function () { - - return this.playbackRate; - - }, - - onEnded: function () { - - this.isPlaying = false; - - }, - - getLoop: function () { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return false; - - } - - return this.loop; - - }, - - setLoop: function ( value ) { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.loop = value; - - if ( this.isPlaying === true ) { - - this.source.loop = this.loop; - - } - - return this; - - }, - - getVolume: function () { - - return this.gain.gain.value; - - }, - - - setVolume: function ( value ) { - - this.gain.gain.value = value; - - return this; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function PositionalAudio( listener ) { - - Audio.call( this, listener ); - - this.panner = this.context.createPanner(); - this.panner.connect( this.gain ); - -} - -PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), { - - constructor: PositionalAudio, - - getOutput: function () { - - return this.panner; - - }, - - getRefDistance: function () { - - return this.panner.refDistance; - - }, - - setRefDistance: function ( value ) { - - this.panner.refDistance = value; - - }, - - getRolloffFactor: function () { - - return this.panner.rolloffFactor; - - }, - - setRolloffFactor: function ( value ) { - - this.panner.rolloffFactor = value; - - }, - - getDistanceModel: function () { - - return this.panner.distanceModel; - - }, - - setDistanceModel: function ( value ) { - - this.panner.distanceModel = value; - - }, - - getMaxDistance: function () { - - return this.panner.maxDistance; - - }, - - setMaxDistance: function ( value ) { - - this.panner.maxDistance = value; - - }, - - updateMatrixWorld: ( function () { - - var position = new Vector3(); - - return function updateMatrixWorld( force ) { - - Object3D.prototype.updateMatrixWorld.call( this, force ); - - position.setFromMatrixPosition( this.matrixWorld ); - - this.panner.setPosition( position.x, position.y, position.z ); - - }; - - } )() - - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function AudioAnalyser( audio, fftSize ) { - - this.analyser = audio.context.createAnalyser(); - this.analyser.fftSize = fftSize !== undefined ? fftSize : 2048; - - this.data = new Uint8Array( this.analyser.frequencyBinCount ); - - audio.getOutput().connect( this.analyser ); - -} - -Object.assign( AudioAnalyser.prototype, { - - getFrequencyData: function () { - - this.analyser.getByteFrequencyData( this.data ); - - return this.data; - - }, - - getAverageFrequency: function () { - - var value = 0, data = this.getFrequencyData(); - - for ( var i = 0; i < data.length; i ++ ) { - - value += data[ i ]; - - } - - return value / data.length; - - } - -} ); - -/** - * - * Buffered scene graph property that allows weighted accumulation. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function PropertyMixer( binding, typeName, valueSize ) { - - this.binding = binding; - this.valueSize = valueSize; - - var bufferType = Float64Array, - mixFunction; - - switch ( typeName ) { - - case 'quaternion': mixFunction = this._slerp; break; - - case 'string': - case 'bool': - - bufferType = Array, mixFunction = this._select; break; - - default: mixFunction = this._lerp; - - } - - this.buffer = new bufferType( valueSize * 4 ); - // layout: [ incoming | accu0 | accu1 | orig ] - // - // interpolators can use .buffer as their .result - // the data then goes to 'incoming' - // - // 'accu0' and 'accu1' are used frame-interleaved for - // the cumulative result and are compared to detect - // changes - // - // 'orig' stores the original state of the property - - this._mixBufferRegion = mixFunction; - - this.cumulativeWeight = 0; - - this.useCount = 0; - this.referenceCount = 0; - -} - -PropertyMixer.prototype = { - - constructor: PropertyMixer, - - // accumulate data in the 'incoming' region into 'accu<i>' - accumulate: function( accuIndex, weight ) { - - // note: happily accumulating nothing when weight = 0, the caller knows - // the weight and shouldn't have made the call in the first place - - var buffer = this.buffer, - stride = this.valueSize, - offset = accuIndex * stride + stride, - - currentWeight = this.cumulativeWeight; - - if ( currentWeight === 0 ) { - - // accuN := incoming * weight - - for ( var i = 0; i !== stride; ++ i ) { - - buffer[ offset + i ] = buffer[ i ]; - - } - - currentWeight = weight; - - } else { - - // accuN := accuN + incoming * weight - - currentWeight += weight; - var mix = weight / currentWeight; - this._mixBufferRegion( buffer, offset, 0, mix, stride ); - - } - - this.cumulativeWeight = currentWeight; - - }, - - // apply the state of 'accu<i>' to the binding when accus differ - apply: function( accuIndex ) { - - var stride = this.valueSize, - buffer = this.buffer, - offset = accuIndex * stride + stride, - - weight = this.cumulativeWeight, - - binding = this.binding; - - this.cumulativeWeight = 0; - - if ( weight < 1 ) { - - // accuN := accuN + original * ( 1 - cumulativeWeight ) - - var originalValueOffset = stride * 3; - - this._mixBufferRegion( - buffer, offset, originalValueOffset, 1 - weight, stride ); - - } - - for ( var i = stride, e = stride + stride; i !== e; ++ i ) { - - if ( buffer[ i ] !== buffer[ i + stride ] ) { - - // value has changed -> update scene graph - - binding.setValue( buffer, offset ); - break; - - } - - } - - }, - - // remember the state of the bound property and copy it to both accus - saveOriginalState: function() { - - var binding = this.binding; - - var buffer = this.buffer, - stride = this.valueSize, - - originalValueOffset = stride * 3; - - binding.getValue( buffer, originalValueOffset ); - - // accu[0..1] := orig -- initially detect changes against the original - for ( var i = stride, e = originalValueOffset; i !== e; ++ i ) { - - buffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ]; - - } - - this.cumulativeWeight = 0; - - }, - - // apply the state previously taken via 'saveOriginalState' to the binding - restoreOriginalState: function() { - - var originalValueOffset = this.valueSize * 3; - this.binding.setValue( this.buffer, originalValueOffset ); - - }, - - - // mix functions - - _select: function( buffer, dstOffset, srcOffset, t, stride ) { - - if ( t >= 0.5 ) { - - for ( var i = 0; i !== stride; ++ i ) { - - buffer[ dstOffset + i ] = buffer[ srcOffset + i ]; - - } - - } - - }, - - _slerp: function( buffer, dstOffset, srcOffset, t, stride ) { - - Quaternion.slerpFlat( buffer, dstOffset, - buffer, dstOffset, buffer, srcOffset, t ); - - }, - - _lerp: function( buffer, dstOffset, srcOffset, t, stride ) { - - var s = 1 - t; - - for ( var i = 0; i !== stride; ++ i ) { - - var j = dstOffset + i; - - buffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t; - - } - - } - -}; - -/** - * - * A reference to a real property in the scene graph. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function PropertyBinding( rootNode, path, parsedPath ) { - - this.path = path; - this.parsedPath = parsedPath || - PropertyBinding.parseTrackName( path ); - - this.node = PropertyBinding.findNode( - rootNode, this.parsedPath.nodeName ) || rootNode; - - this.rootNode = rootNode; - -} - -PropertyBinding.prototype = { - - constructor: PropertyBinding, - - getValue: function getValue_unbound( targetArray, offset ) { - - this.bind(); - this.getValue( targetArray, offset ); - - // Note: This class uses a State pattern on a per-method basis: - // 'bind' sets 'this.getValue' / 'setValue' and shadows the - // prototype version of these methods with one that represents - // the bound state. When the property is not found, the methods - // become no-ops. - - }, - - setValue: function getValue_unbound( sourceArray, offset ) { - - this.bind(); - this.setValue( sourceArray, offset ); - - }, - - // create getter / setter pair for a property in the scene graph - bind: function() { - - var targetObject = this.node, - parsedPath = this.parsedPath, - - objectName = parsedPath.objectName, - propertyName = parsedPath.propertyName, - propertyIndex = parsedPath.propertyIndex; - - if ( ! targetObject ) { - - targetObject = PropertyBinding.findNode( - this.rootNode, parsedPath.nodeName ) || this.rootNode; - - this.node = targetObject; - - } - - // set fail state so we can just 'return' on error - this.getValue = this._getValue_unavailable; - this.setValue = this._setValue_unavailable; - - // ensure there is a value node - if ( ! targetObject ) { - - console.error( " trying to update node for track: " + this.path + " but it wasn't found." ); - return; - - } - - if ( objectName ) { - - var objectIndex = parsedPath.objectIndex; - - // special cases were we need to reach deeper into the hierarchy to get the face materials.... - switch ( objectName ) { - - case 'materials': - - if ( ! targetObject.material ) { - - console.error( ' can not bind to material as node does not have a material', this ); - return; - - } - - if ( ! targetObject.material.materials ) { - - console.error( ' can not bind to material.materials as node.material does not have a materials array', this ); - return; - - } - - targetObject = targetObject.material.materials; - - break; - - case 'bones': - - if ( ! targetObject.skeleton ) { - - console.error( ' can not bind to bones as node does not have a skeleton', this ); - return; - - } - - // potential future optimization: skip this if propertyIndex is already an integer - // and convert the integer string to a true integer. - - targetObject = targetObject.skeleton.bones; - - // support resolving morphTarget names into indices. - for ( var i = 0; i < targetObject.length; i ++ ) { - - if ( targetObject[ i ].name === objectIndex ) { - - objectIndex = i; - break; - - } - - } - - break; - - default: - - if ( targetObject[ objectName ] === undefined ) { - - console.error( ' can not bind to objectName of node, undefined', this ); - return; - - } - - targetObject = targetObject[ objectName ]; - - } - - - if ( objectIndex !== undefined ) { - - if ( targetObject[ objectIndex ] === undefined ) { - - console.error( " trying to bind to objectIndex of objectName, but is undefined:", this, targetObject ); - return; - - } - - targetObject = targetObject[ objectIndex ]; - - } - - } - - // resolve property - var nodeProperty = targetObject[ propertyName ]; - - if ( nodeProperty === undefined ) { - - var nodeName = parsedPath.nodeName; - - console.error( " trying to update property for track: " + nodeName + - '.' + propertyName + " but it wasn't found.", targetObject ); - return; - - } - - // determine versioning scheme - var versioning = this.Versioning.None; - - if ( targetObject.needsUpdate !== undefined ) { // material - - versioning = this.Versioning.NeedsUpdate; - this.targetObject = targetObject; - - } else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform - - versioning = this.Versioning.MatrixWorldNeedsUpdate; - this.targetObject = targetObject; - - } - - // determine how the property gets bound - var bindingType = this.BindingType.Direct; - - if ( propertyIndex !== undefined ) { - // access a sub element of the property array (only primitives are supported right now) - - if ( propertyName === "morphTargetInfluences" ) { - // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer. - - // support resolving morphTarget names into indices. - if ( ! targetObject.geometry ) { - - console.error( ' can not bind to morphTargetInfluences becasuse node does not have a geometry', this ); - return; - - } - - if ( ! targetObject.geometry.morphTargets ) { - - console.error( ' can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets', this ); - return; - - } - - for ( var i = 0; i < this.node.geometry.morphTargets.length; i ++ ) { - - if ( targetObject.geometry.morphTargets[ i ].name === propertyIndex ) { - - propertyIndex = i; - break; - - } - - } - - } - - bindingType = this.BindingType.ArrayElement; - - this.resolvedProperty = nodeProperty; - this.propertyIndex = propertyIndex; - - } else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) { - // must use copy for Object3D.Euler/Quaternion - - bindingType = this.BindingType.HasFromToArray; - - this.resolvedProperty = nodeProperty; - - } else if ( nodeProperty.length !== undefined ) { - - bindingType = this.BindingType.EntireArray; - - this.resolvedProperty = nodeProperty; - - } else { - - this.propertyName = propertyName; - - } - - // select getter / setter - this.getValue = this.GetterByBindingType[ bindingType ]; - this.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ]; - - }, - - unbind: function() { - - this.node = null; - - // back to the prototype version of getValue / setValue - // note: avoiding to mutate the shape of 'this' via 'delete' - this.getValue = this._getValue_unbound; - this.setValue = this._setValue_unbound; - - } - -}; - -Object.assign( PropertyBinding.prototype, { // prototype, continued - - // these are used to "bind" a nonexistent property - _getValue_unavailable: function() {}, - _setValue_unavailable: function() {}, - - // initial state of these methods that calls 'bind' - _getValue_unbound: PropertyBinding.prototype.getValue, - _setValue_unbound: PropertyBinding.prototype.setValue, - - BindingType: { - Direct: 0, - EntireArray: 1, - ArrayElement: 2, - HasFromToArray: 3 - }, - - Versioning: { - None: 0, - NeedsUpdate: 1, - MatrixWorldNeedsUpdate: 2 - }, - - GetterByBindingType: [ - - function getValue_direct( buffer, offset ) { - - buffer[ offset ] = this.node[ this.propertyName ]; - - }, - - function getValue_array( buffer, offset ) { - - var source = this.resolvedProperty; - - for ( var i = 0, n = source.length; i !== n; ++ i ) { - - buffer[ offset ++ ] = source[ i ]; - - } - - }, - - function getValue_arrayElement( buffer, offset ) { - - buffer[ offset ] = this.resolvedProperty[ this.propertyIndex ]; - - }, - - function getValue_toArray( buffer, offset ) { - - this.resolvedProperty.toArray( buffer, offset ); - - } - - ], - - SetterByBindingTypeAndVersioning: [ - - [ - // Direct - - function setValue_direct( buffer, offset ) { - - this.node[ this.propertyName ] = buffer[ offset ]; - - }, - - function setValue_direct_setNeedsUpdate( buffer, offset ) { - - this.node[ this.propertyName ] = buffer[ offset ]; - this.targetObject.needsUpdate = true; - - }, - - function setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.node[ this.propertyName ] = buffer[ offset ]; - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // EntireArray - - function setValue_array( buffer, offset ) { - - var dest = this.resolvedProperty; - - for ( var i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - }, - - function setValue_array_setNeedsUpdate( buffer, offset ) { - - var dest = this.resolvedProperty; - - for ( var i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - this.targetObject.needsUpdate = true; - - }, - - function setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) { - - var dest = this.resolvedProperty; - - for ( var i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // ArrayElement - - function setValue_arrayElement( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - - }, - - function setValue_arrayElement_setNeedsUpdate( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - this.targetObject.needsUpdate = true; - - }, - - function setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // HasToFromArray - - function setValue_fromArray( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - - }, - - function setValue_fromArray_setNeedsUpdate( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - this.targetObject.needsUpdate = true; - - }, - - function setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ] - - ] - -} ); - -PropertyBinding.Composite = - function( targetGroup, path, optionalParsedPath ) { - - var parsedPath = optionalParsedPath || - PropertyBinding.parseTrackName( path ); - - this._targetGroup = targetGroup; - this._bindings = targetGroup.subscribe_( path, parsedPath ); - -}; - -PropertyBinding.Composite.prototype = { - - constructor: PropertyBinding.Composite, - - getValue: function( array, offset ) { - - this.bind(); // bind all binding - - var firstValidIndex = this._targetGroup.nCachedObjects_, - binding = this._bindings[ firstValidIndex ]; - - // and only call .getValue on the first - if ( binding !== undefined ) binding.getValue( array, offset ); - - }, - - setValue: function( array, offset ) { - - var bindings = this._bindings; - - for ( var i = this._targetGroup.nCachedObjects_, - n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].setValue( array, offset ); - - } - - }, - - bind: function() { - - var bindings = this._bindings; - - for ( var i = this._targetGroup.nCachedObjects_, - n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].bind(); - - } - - }, - - unbind: function() { - - var bindings = this._bindings; - - for ( var i = this._targetGroup.nCachedObjects_, - n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].unbind(); - - } - - } - -}; - -PropertyBinding.create = function( root, path, parsedPath ) { - - if ( ! ( root && root.isAnimationObjectGroup ) ) { - - return new PropertyBinding( root, path, parsedPath ); - - } else { - - return new PropertyBinding.Composite( root, path, parsedPath ); - - } - -}; - -PropertyBinding.parseTrackName = function( trackName ) { - - // matches strings in the form of: - // nodeName.property - // nodeName.property[accessor] - // nodeName.material.property[accessor] - // uuid.property[accessor] - // uuid.objectName[objectIndex].propertyName[propertyIndex] - // parentName/nodeName.property - // parentName/parentName/nodeName.property[index] - // .bone[Armature.DEF_cog].position - // scene:helium_balloon_model:helium_balloon_model.position - // created and tested via https://regex101.com/#javascript - - var re = /^((?:\w+[\/:])*)(\w+)?(?:\.(\w+)(?:\[(.+)\])?)?\.(\w+)(?:\[(.+)\])?$/; - var matches = re.exec( trackName ); - - if ( ! matches ) { - - throw new Error( "cannot parse trackName at all: " + trackName ); - - } - - var results = { - // directoryName: matches[ 1 ], // (tschw) currently unused - nodeName: matches[ 2 ], // allowed to be null, specified root node. - objectName: matches[ 3 ], - objectIndex: matches[ 4 ], - propertyName: matches[ 5 ], - propertyIndex: matches[ 6 ] // allowed to be null, specifies that the whole property is set. - }; - - if ( results.propertyName === null || results.propertyName.length === 0 ) { - - throw new Error( "can not parse propertyName from trackName: " + trackName ); - - } - - return results; - -}; - -PropertyBinding.findNode = function( root, nodeName ) { - - if ( ! nodeName || nodeName === "" || nodeName === "root" || nodeName === "." || nodeName === -1 || nodeName === root.name || nodeName === root.uuid ) { - - return root; - - } - - // search into skeleton bones. - if ( root.skeleton ) { - - var searchSkeleton = function( skeleton ) { - - for( var i = 0; i < skeleton.bones.length; i ++ ) { - - var bone = skeleton.bones[ i ]; - - if ( bone.name === nodeName ) { - - return bone; - - } - } - - return null; - - }; - - var bone = searchSkeleton( root.skeleton ); - - if ( bone ) { - - return bone; - - } - } - - // search into node subtree. - if ( root.children ) { - - var searchNodeSubtree = function( children ) { - - for( var i = 0; i < children.length; i ++ ) { - - var childNode = children[ i ]; - - if ( childNode.name === nodeName || childNode.uuid === nodeName ) { - - return childNode; - - } - - var result = searchNodeSubtree( childNode.children ); - - if ( result ) return result; - - } - - return null; - - }; - - var subTreeNode = searchNodeSubtree( root.children ); - - if ( subTreeNode ) { - - return subTreeNode; - - } - - } - - return null; - -}; - -/** - * - * A group of objects that receives a shared animation state. - * - * Usage: - * - * - Add objects you would otherwise pass as 'root' to the - * constructor or the .clipAction method of AnimationMixer. - * - * - Instead pass this object as 'root'. - * - * - You can also add and remove objects later when the mixer - * is running. - * - * Note: - * - * Objects of this class appear as one object to the mixer, - * so cache control of the individual objects must be done - * on the group. - * - * Limitation: - * - * - The animated properties must be compatible among the - * all objects in the group. - * - * - A single property can either be controlled through a - * target group or directly, but not both. - * - * @author tschw - */ - -function AnimationObjectGroup( var_args ) { - - this.uuid = _Math.generateUUID(); - - // cached objects followed by the active ones - this._objects = Array.prototype.slice.call( arguments ); - - this.nCachedObjects_ = 0; // threshold - // note: read by PropertyBinding.Composite - - var indices = {}; - this._indicesByUUID = indices; // for bookkeeping - - for ( var i = 0, n = arguments.length; i !== n; ++ i ) { - - indices[ arguments[ i ].uuid ] = i; - - } - - this._paths = []; // inside: string - this._parsedPaths = []; // inside: { we don't care, here } - this._bindings = []; // inside: Array< PropertyBinding > - this._bindingsIndicesByPath = {}; // inside: indices in these arrays - - var scope = this; - - this.stats = { - - objects: { - get total() { return scope._objects.length; }, - get inUse() { return this.total - scope.nCachedObjects_; } - }, - - get bindingsPerObject() { return scope._bindings.length; } - - }; - -} - -AnimationObjectGroup.prototype = { - - constructor: AnimationObjectGroup, - - isAnimationObjectGroup: true, - - add: function( var_args ) { - - var objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - indicesByUUID = this._indicesByUUID, - paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - nBindings = bindings.length; - - for ( var i = 0, n = arguments.length; i !== n; ++ i ) { - - var object = arguments[ i ], - uuid = object.uuid, - index = indicesByUUID[ uuid ]; - - if ( index === undefined ) { - - // unknown object -> add it to the ACTIVE region - - index = nObjects ++; - indicesByUUID[ uuid ] = index; - objects.push( object ); - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - bindings[ j ].push( - new PropertyBinding( - object, paths[ j ], parsedPaths[ j ] ) ); - - } - - } else if ( index < nCachedObjects ) { - - var knownObject = objects[ index ]; - - // move existing object to the ACTIVE region - - var firstActiveIndex = -- nCachedObjects, - lastCachedObject = objects[ firstActiveIndex ]; - - indicesByUUID[ lastCachedObject.uuid ] = index; - objects[ index ] = lastCachedObject; - - indicesByUUID[ uuid ] = firstActiveIndex; - objects[ firstActiveIndex ] = object; - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - var bindingsForPath = bindings[ j ], - lastCached = bindingsForPath[ firstActiveIndex ], - binding = bindingsForPath[ index ]; - - bindingsForPath[ index ] = lastCached; - - if ( binding === undefined ) { - - // since we do not bother to create new bindings - // for objects that are cached, the binding may - // or may not exist - - binding = new PropertyBinding( - object, paths[ j ], parsedPaths[ j ] ); - - } - - bindingsForPath[ firstActiveIndex ] = binding; - - } - - } else if ( objects[ index ] !== knownObject) { - - console.error( "Different objects with the same UUID " + - "detected. Clean the caches or recreate your " + - "infrastructure when reloading scenes..." ); - - } // else the object is already where we want it to be - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - }, - - remove: function( var_args ) { - - var objects = this._objects, - nCachedObjects = this.nCachedObjects_, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - - for ( var i = 0, n = arguments.length; i !== n; ++ i ) { - - var object = arguments[ i ], - uuid = object.uuid, - index = indicesByUUID[ uuid ]; - - if ( index !== undefined && index >= nCachedObjects ) { - - // move existing object into the CACHED region - - var lastCachedIndex = nCachedObjects ++, - firstActiveObject = objects[ lastCachedIndex ]; - - indicesByUUID[ firstActiveObject.uuid ] = index; - objects[ index ] = firstActiveObject; - - indicesByUUID[ uuid ] = lastCachedIndex; - objects[ lastCachedIndex ] = object; - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - var bindingsForPath = bindings[ j ], - firstActive = bindingsForPath[ lastCachedIndex ], - binding = bindingsForPath[ index ]; - - bindingsForPath[ index ] = firstActive; - bindingsForPath[ lastCachedIndex ] = binding; - - } - - } - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - }, - - // remove & forget - uncache: function( var_args ) { - - var objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - - for ( var i = 0, n = arguments.length; i !== n; ++ i ) { - - var object = arguments[ i ], - uuid = object.uuid, - index = indicesByUUID[ uuid ]; - - if ( index !== undefined ) { - - delete indicesByUUID[ uuid ]; - - if ( index < nCachedObjects ) { - - // object is cached, shrink the CACHED region - - var firstActiveIndex = -- nCachedObjects, - lastCachedObject = objects[ firstActiveIndex ], - lastIndex = -- nObjects, - lastObject = objects[ lastIndex ]; - - // last cached object takes this object's place - indicesByUUID[ lastCachedObject.uuid ] = index; - objects[ index ] = lastCachedObject; - - // last object goes to the activated slot and pop - indicesByUUID[ lastObject.uuid ] = firstActiveIndex; - objects[ firstActiveIndex ] = lastObject; - objects.pop(); - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - var bindingsForPath = bindings[ j ], - lastCached = bindingsForPath[ firstActiveIndex ], - last = bindingsForPath[ lastIndex ]; - - bindingsForPath[ index ] = lastCached; - bindingsForPath[ firstActiveIndex ] = last; - bindingsForPath.pop(); - - } - - } else { - - // object is active, just swap with the last and pop - - var lastIndex = -- nObjects, - lastObject = objects[ lastIndex ]; - - indicesByUUID[ lastObject.uuid ] = index; - objects[ index ] = lastObject; - objects.pop(); - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - var bindingsForPath = bindings[ j ]; - - bindingsForPath[ index ] = bindingsForPath[ lastIndex ]; - bindingsForPath.pop(); - - } - - } // cached or active - - } // if object is known - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - }, - - // Internal interface used by befriended PropertyBinding.Composite: - - subscribe_: function( path, parsedPath ) { - // returns an array of bindings for the given path that is changed - // according to the contained objects in the group - - var indicesByPath = this._bindingsIndicesByPath, - index = indicesByPath[ path ], - bindings = this._bindings; - - if ( index !== undefined ) return bindings[ index ]; - - var paths = this._paths, - parsedPaths = this._parsedPaths, - objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - bindingsForPath = new Array( nObjects ); - - index = bindings.length; - - indicesByPath[ path ] = index; - - paths.push( path ); - parsedPaths.push( parsedPath ); - bindings.push( bindingsForPath ); - - for ( var i = nCachedObjects, - n = objects.length; i !== n; ++ i ) { - - var object = objects[ i ]; - - bindingsForPath[ i ] = - new PropertyBinding( object, path, parsedPath ); - - } - - return bindingsForPath; - - }, - - unsubscribe_: function( path ) { - // tells the group to forget about a property path and no longer - // update the array previously obtained with 'subscribe_' - - var indicesByPath = this._bindingsIndicesByPath, - index = indicesByPath[ path ]; - - if ( index !== undefined ) { - - var paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - lastBindingsIndex = bindings.length - 1, - lastBindings = bindings[ lastBindingsIndex ], - lastBindingsPath = path[ lastBindingsIndex ]; - - indicesByPath[ lastBindingsPath ] = index; - - bindings[ index ] = lastBindings; - bindings.pop(); - - parsedPaths[ index ] = parsedPaths[ lastBindingsIndex ]; - parsedPaths.pop(); - - paths[ index ] = paths[ lastBindingsIndex ]; - paths.pop(); - - } - - } - -}; - -/** - * - * Action provided by AnimationMixer for scheduling clip playback on specific - * objects. - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - * - */ - -function AnimationAction( mixer, clip, localRoot ) { - - this._mixer = mixer; - this._clip = clip; - this._localRoot = localRoot || null; - - var tracks = clip.tracks, - nTracks = tracks.length, - interpolants = new Array( nTracks ); - - var interpolantSettings = { - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - }; - - for ( var i = 0; i !== nTracks; ++ i ) { - - var interpolant = tracks[ i ].createInterpolant( null ); - interpolants[ i ] = interpolant; - interpolant.settings = interpolantSettings; - - } - - this._interpolantSettings = interpolantSettings; - - this._interpolants = interpolants; // bound by the mixer - - // inside: PropertyMixer (managed by the mixer) - this._propertyBindings = new Array( nTracks ); - - this._cacheIndex = null; // for the memory manager - this._byClipCacheIndex = null; // for the memory manager - - this._timeScaleInterpolant = null; - this._weightInterpolant = null; - - this.loop = LoopRepeat; - this._loopCount = -1; - - // global mixer time when the action is to be started - // it's set back to 'null' upon start of the action - this._startTime = null; - - // scaled local time of the action - // gets clamped or wrapped to 0..clip.duration according to loop - this.time = 0; - - this.timeScale = 1; - this._effectiveTimeScale = 1; - - this.weight = 1; - this._effectiveWeight = 1; - - this.repetitions = Infinity; // no. of repetitions when looping - - this.paused = false; // false -> zero effective time scale - this.enabled = true; // true -> zero effective weight - - this.clampWhenFinished = false; // keep feeding the last frame? - - this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate - this.zeroSlopeAtEnd = true; // clips for start, loop and end - -} - -AnimationAction.prototype = { - - constructor: AnimationAction, - - // State & Scheduling - - play: function() { - - this._mixer._activateAction( this ); - - return this; - - }, - - stop: function() { - - this._mixer._deactivateAction( this ); - - return this.reset(); - - }, - - reset: function() { - - this.paused = false; - this.enabled = true; - - this.time = 0; // restart clip - this._loopCount = -1; // forget previous loops - this._startTime = null; // forget scheduling - - return this.stopFading().stopWarping(); - - }, - - isRunning: function() { - - return this.enabled && ! this.paused && this.timeScale !== 0 && - this._startTime === null && this._mixer._isActiveAction( this ); - - }, - - // return true when play has been called - isScheduled: function() { - - return this._mixer._isActiveAction( this ); - - }, - - startAt: function( time ) { - - this._startTime = time; - - return this; - - }, - - setLoop: function( mode, repetitions ) { - - this.loop = mode; - this.repetitions = repetitions; - - return this; - - }, - - // Weight - - // set the weight stopping any scheduled fading - // although .enabled = false yields an effective weight of zero, this - // method does *not* change .enabled, because it would be confusing - setEffectiveWeight: function( weight ) { - - this.weight = weight; - - // note: same logic as when updated at runtime - this._effectiveWeight = this.enabled ? weight : 0; - - return this.stopFading(); - - }, - - // return the weight considering fading and .enabled - getEffectiveWeight: function() { - - return this._effectiveWeight; - - }, - - fadeIn: function( duration ) { - - return this._scheduleFading( duration, 0, 1 ); - - }, - - fadeOut: function( duration ) { - - return this._scheduleFading( duration, 1, 0 ); - - }, - - crossFadeFrom: function( fadeOutAction, duration, warp ) { - - fadeOutAction.fadeOut( duration ); - this.fadeIn( duration ); - - if( warp ) { - - var fadeInDuration = this._clip.duration, - fadeOutDuration = fadeOutAction._clip.duration, - - startEndRatio = fadeOutDuration / fadeInDuration, - endStartRatio = fadeInDuration / fadeOutDuration; - - fadeOutAction.warp( 1.0, startEndRatio, duration ); - this.warp( endStartRatio, 1.0, duration ); - - } - - return this; - - }, - - crossFadeTo: function( fadeInAction, duration, warp ) { - - return fadeInAction.crossFadeFrom( this, duration, warp ); - - }, - - stopFading: function() { - - var weightInterpolant = this._weightInterpolant; - - if ( weightInterpolant !== null ) { - - this._weightInterpolant = null; - this._mixer._takeBackControlInterpolant( weightInterpolant ); - - } - - return this; - - }, - - // Time Scale Control - - // set the weight stopping any scheduled warping - // although .paused = true yields an effective time scale of zero, this - // method does *not* change .paused, because it would be confusing - setEffectiveTimeScale: function( timeScale ) { - - this.timeScale = timeScale; - this._effectiveTimeScale = this.paused ? 0 :timeScale; - - return this.stopWarping(); - - }, - - // return the time scale considering warping and .paused - getEffectiveTimeScale: function() { - - return this._effectiveTimeScale; - - }, - - setDuration: function( duration ) { - - this.timeScale = this._clip.duration / duration; - - return this.stopWarping(); - - }, - - syncWith: function( action ) { - - this.time = action.time; - this.timeScale = action.timeScale; - - return this.stopWarping(); - - }, - - halt: function( duration ) { - - return this.warp( this._effectiveTimeScale, 0, duration ); - - }, - - warp: function( startTimeScale, endTimeScale, duration ) { - - var mixer = this._mixer, now = mixer.time, - interpolant = this._timeScaleInterpolant, - - timeScale = this.timeScale; - - if ( interpolant === null ) { - - interpolant = mixer._lendControlInterpolant(), - this._timeScaleInterpolant = interpolant; - - } - - var times = interpolant.parameterPositions, - values = interpolant.sampleValues; - - times[ 0 ] = now; - times[ 1 ] = now + duration; - - values[ 0 ] = startTimeScale / timeScale; - values[ 1 ] = endTimeScale / timeScale; - - return this; - - }, - - stopWarping: function() { - - var timeScaleInterpolant = this._timeScaleInterpolant; - - if ( timeScaleInterpolant !== null ) { - - this._timeScaleInterpolant = null; - this._mixer._takeBackControlInterpolant( timeScaleInterpolant ); - - } - - return this; - - }, - - // Object Accessors - - getMixer: function() { - - return this._mixer; - - }, - - getClip: function() { - - return this._clip; - - }, - - getRoot: function() { - - return this._localRoot || this._mixer._root; - - }, - - // Interna - - _update: function( time, deltaTime, timeDirection, accuIndex ) { - // called by the mixer - - var startTime = this._startTime; - - if ( startTime !== null ) { - - // check for scheduled start of action - - var timeRunning = ( time - startTime ) * timeDirection; - if ( timeRunning < 0 || timeDirection === 0 ) { - - return; // yet to come / don't decide when delta = 0 - - } - - // start - - this._startTime = null; // unschedule - deltaTime = timeDirection * timeRunning; - - } - - // apply time scale and advance time - - deltaTime *= this._updateTimeScale( time ); - var clipTime = this._updateTime( deltaTime ); - - // note: _updateTime may disable the action resulting in - // an effective weight of 0 - - var weight = this._updateWeight( time ); - - if ( weight > 0 ) { - - var interpolants = this._interpolants; - var propertyMixers = this._propertyBindings; - - for ( var j = 0, m = interpolants.length; j !== m; ++ j ) { - - interpolants[ j ].evaluate( clipTime ); - propertyMixers[ j ].accumulate( accuIndex, weight ); - - } - - } - - }, - - _updateWeight: function( time ) { - - var weight = 0; - - if ( this.enabled ) { - - weight = this.weight; - var interpolant = this._weightInterpolant; - - if ( interpolant !== null ) { - - var interpolantValue = interpolant.evaluate( time )[ 0 ]; - - weight *= interpolantValue; - - if ( time > interpolant.parameterPositions[ 1 ] ) { - - this.stopFading(); - - if ( interpolantValue === 0 ) { - - // faded out, disable - this.enabled = false; - - } - - } - - } - - } - - this._effectiveWeight = weight; - return weight; - - }, - - _updateTimeScale: function( time ) { - - var timeScale = 0; - - if ( ! this.paused ) { - - timeScale = this.timeScale; - - var interpolant = this._timeScaleInterpolant; - - if ( interpolant !== null ) { - - var interpolantValue = interpolant.evaluate( time )[ 0 ]; - - timeScale *= interpolantValue; - - if ( time > interpolant.parameterPositions[ 1 ] ) { - - this.stopWarping(); - - if ( timeScale === 0 ) { - - // motion has halted, pause - this.paused = true; - - } else { - - // warp done - apply final time scale - this.timeScale = timeScale; - - } - - } - - } - - } - - this._effectiveTimeScale = timeScale; - return timeScale; - - }, - - _updateTime: function( deltaTime ) { - - var time = this.time + deltaTime; - - if ( deltaTime === 0 ) return time; - - var duration = this._clip.duration, - - loop = this.loop, - loopCount = this._loopCount; - - if ( loop === LoopOnce ) { - - if ( loopCount === -1 ) { - // just started - - this.loopCount = 0; - this._setEndings( true, true, false ); - - } - - handle_stop: { - - if ( time >= duration ) { - - time = duration; - - } else if ( time < 0 ) { - - time = 0; - - } else break handle_stop; - - if ( this.clampWhenFinished ) this.paused = true; - else this.enabled = false; - - this._mixer.dispatchEvent( { - type: 'finished', action: this, - direction: deltaTime < 0 ? -1 : 1 - } ); - - } - - } else { // repetitive Repeat or PingPong - - var pingPong = ( loop === LoopPingPong ); - - if ( loopCount === -1 ) { - // just started - - if ( deltaTime >= 0 ) { - - loopCount = 0; - - this._setEndings( - true, this.repetitions === 0, pingPong ); - - } else { - - // when looping in reverse direction, the initial - // transition through zero counts as a repetition, - // so leave loopCount at -1 - - this._setEndings( - this.repetitions === 0, true, pingPong ); - - } - - } - - if ( time >= duration || time < 0 ) { - // wrap around - - var loopDelta = Math.floor( time / duration ); // signed - time -= duration * loopDelta; - - loopCount += Math.abs( loopDelta ); - - var pending = this.repetitions - loopCount; - - if ( pending < 0 ) { - // have to stop (switch state, clamp time, fire event) - - if ( this.clampWhenFinished ) this.paused = true; - else this.enabled = false; - - time = deltaTime > 0 ? duration : 0; - - this._mixer.dispatchEvent( { - type: 'finished', action: this, - direction: deltaTime > 0 ? 1 : -1 - } ); - - } else { - // keep running - - if ( pending === 0 ) { - // entering the last round - - var atStart = deltaTime < 0; - this._setEndings( atStart, ! atStart, pingPong ); - - } else { - - this._setEndings( false, false, pingPong ); - - } - - this._loopCount = loopCount; - - this._mixer.dispatchEvent( { - type: 'loop', action: this, loopDelta: loopDelta - } ); - - } - - } - - if ( pingPong && ( loopCount & 1 ) === 1 ) { - // invert time for the "pong round" - - this.time = time; - return duration - time; - - } - - } - - this.time = time; - return time; - - }, - - _setEndings: function( atStart, atEnd, pingPong ) { - - var settings = this._interpolantSettings; - - if ( pingPong ) { - - settings.endingStart = ZeroSlopeEnding; - settings.endingEnd = ZeroSlopeEnding; - - } else { - - // assuming for LoopOnce atStart == atEnd == true - - if ( atStart ) { - - settings.endingStart = this.zeroSlopeAtStart ? - ZeroSlopeEnding : ZeroCurvatureEnding; - - } else { - - settings.endingStart = WrapAroundEnding; - - } - - if ( atEnd ) { - - settings.endingEnd = this.zeroSlopeAtEnd ? - ZeroSlopeEnding : ZeroCurvatureEnding; - - } else { - - settings.endingEnd = WrapAroundEnding; - - } - - } - - }, - - _scheduleFading: function( duration, weightNow, weightThen ) { - - var mixer = this._mixer, now = mixer.time, - interpolant = this._weightInterpolant; - - if ( interpolant === null ) { - - interpolant = mixer._lendControlInterpolant(), - this._weightInterpolant = interpolant; - - } - - var times = interpolant.parameterPositions, - values = interpolant.sampleValues; - - times[ 0 ] = now; values[ 0 ] = weightNow; - times[ 1 ] = now + duration; values[ 1 ] = weightThen; - - return this; - - } - -}; - -/** - * - * Player for AnimationClips. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - -function AnimationMixer( root ) { - - this._root = root; - this._initMemoryManager(); - this._accuIndex = 0; - - this.time = 0; - - this.timeScale = 1.0; - -} - -Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, { - - // return an action for a clip optionally using a custom root target - // object (this method allocates a lot of dynamic memory in case a - // previously unknown clip/root combination is specified) - clipAction: function( clip, optionalRoot ) { - - var root = optionalRoot || this._root, - rootUuid = root.uuid, - - clipObject = typeof clip === 'string' ? - AnimationClip.findByName( root, clip ) : clip, - - clipUuid = clipObject !== null ? clipObject.uuid : clip, - - actionsForClip = this._actionsByClip[ clipUuid ], - prototypeAction = null; - - if ( actionsForClip !== undefined ) { - - var existingAction = - actionsForClip.actionByRoot[ rootUuid ]; - - if ( existingAction !== undefined ) { - - return existingAction; - - } - - // we know the clip, so we don't have to parse all - // the bindings again but can just copy - prototypeAction = actionsForClip.knownActions[ 0 ]; - - // also, take the clip from the prototype action - if ( clipObject === null ) - clipObject = prototypeAction._clip; - - } - - // clip must be known when specified via string - if ( clipObject === null ) return null; - - // allocate all resources required to run it - var newAction = new AnimationAction( this, clipObject, optionalRoot ); - - this._bindAction( newAction, prototypeAction ); - - // and make the action known to the memory manager - this._addInactiveAction( newAction, clipUuid, rootUuid ); - - return newAction; - - }, - - // get an existing action - existingAction: function( clip, optionalRoot ) { - - var root = optionalRoot || this._root, - rootUuid = root.uuid, - - clipObject = typeof clip === 'string' ? - AnimationClip.findByName( root, clip ) : clip, - - clipUuid = clipObject ? clipObject.uuid : clip, - - actionsForClip = this._actionsByClip[ clipUuid ]; - - if ( actionsForClip !== undefined ) { - - return actionsForClip.actionByRoot[ rootUuid ] || null; - - } - - return null; - - }, - - // deactivates all previously scheduled actions - stopAllAction: function() { - - var actions = this._actions, - nActions = this._nActiveActions, - bindings = this._bindings, - nBindings = this._nActiveBindings; - - this._nActiveActions = 0; - this._nActiveBindings = 0; - - for ( var i = 0; i !== nActions; ++ i ) { - - actions[ i ].reset(); - - } - - for ( var i = 0; i !== nBindings; ++ i ) { - - bindings[ i ].useCount = 0; - - } - - return this; - - }, - - // advance the time and update apply the animation - update: function( deltaTime ) { - - deltaTime *= this.timeScale; - - var actions = this._actions, - nActions = this._nActiveActions, - - time = this.time += deltaTime, - timeDirection = Math.sign( deltaTime ), - - accuIndex = this._accuIndex ^= 1; - - // run active actions - - for ( var i = 0; i !== nActions; ++ i ) { - - var action = actions[ i ]; - - if ( action.enabled ) { - - action._update( time, deltaTime, timeDirection, accuIndex ); - - } - - } - - // update scene graph - - var bindings = this._bindings, - nBindings = this._nActiveBindings; - - for ( var i = 0; i !== nBindings; ++ i ) { - - bindings[ i ].apply( accuIndex ); - - } - - return this; - - }, - - // return this mixer's root target object - getRoot: function() { - - return this._root; - - }, - - // free all resources specific to a particular clip - uncacheClip: function( clip ) { - - var actions = this._actions, - clipUuid = clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[ clipUuid ]; - - if ( actionsForClip !== undefined ) { - - // note: just calling _removeInactiveAction would mess up the - // iteration state and also require updating the state we can - // just throw away - - var actionsToRemove = actionsForClip.knownActions; - - for ( var i = 0, n = actionsToRemove.length; i !== n; ++ i ) { - - var action = actionsToRemove[ i ]; - - this._deactivateAction( action ); - - var cacheIndex = action._cacheIndex, - lastInactiveAction = actions[ actions.length - 1 ]; - - action._cacheIndex = null; - action._byClipCacheIndex = null; - - lastInactiveAction._cacheIndex = cacheIndex; - actions[ cacheIndex ] = lastInactiveAction; - actions.pop(); - - this._removeInactiveBindingsForAction( action ); - - } - - delete actionsByClip[ clipUuid ]; - - } - - }, - - // free all resources specific to a particular root target object - uncacheRoot: function( root ) { - - var rootUuid = root.uuid, - actionsByClip = this._actionsByClip; - - for ( var clipUuid in actionsByClip ) { - - var actionByRoot = actionsByClip[ clipUuid ].actionByRoot, - action = actionByRoot[ rootUuid ]; - - if ( action !== undefined ) { - - this._deactivateAction( action ); - this._removeInactiveAction( action ); - - } - - } - - var bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[ rootUuid ]; - - if ( bindingByName !== undefined ) { - - for ( var trackName in bindingByName ) { - - var binding = bindingByName[ trackName ]; - binding.restoreOriginalState(); - this._removeInactiveBinding( binding ); - - } - - } - - }, - - // remove a targeted clip from the cache - uncacheAction: function( clip, optionalRoot ) { - - var action = this.existingAction( clip, optionalRoot ); - - if ( action !== null ) { - - this._deactivateAction( action ); - this._removeInactiveAction( action ); - - } - - } - -} ); - -// Implementation details: - -Object.assign( AnimationMixer.prototype, { - - _bindAction: function( action, prototypeAction ) { - - var root = action._localRoot || this._root, - tracks = action._clip.tracks, - nTracks = tracks.length, - bindings = action._propertyBindings, - interpolants = action._interpolants, - rootUuid = root.uuid, - bindingsByRoot = this._bindingsByRootAndName, - bindingsByName = bindingsByRoot[ rootUuid ]; - - if ( bindingsByName === undefined ) { - - bindingsByName = {}; - bindingsByRoot[ rootUuid ] = bindingsByName; - - } - - for ( var i = 0; i !== nTracks; ++ i ) { - - var track = tracks[ i ], - trackName = track.name, - binding = bindingsByName[ trackName ]; - - if ( binding !== undefined ) { - - bindings[ i ] = binding; - - } else { - - binding = bindings[ i ]; - - if ( binding !== undefined ) { - - // existing binding, make sure the cache knows - - if ( binding._cacheIndex === null ) { - - ++ binding.referenceCount; - this._addInactiveBinding( binding, rootUuid, trackName ); - - } - - continue; - - } - - var path = prototypeAction && prototypeAction. - _propertyBindings[ i ].binding.parsedPath; - - binding = new PropertyMixer( - PropertyBinding.create( root, trackName, path ), - track.ValueTypeName, track.getValueSize() ); - - ++ binding.referenceCount; - this._addInactiveBinding( binding, rootUuid, trackName ); - - bindings[ i ] = binding; - - } - - interpolants[ i ].resultBuffer = binding.buffer; - - } - - }, - - _activateAction: function( action ) { - - if ( ! this._isActiveAction( action ) ) { - - if ( action._cacheIndex === null ) { - - // this action has been forgotten by the cache, but the user - // appears to be still using it -> rebind - - var rootUuid = ( action._localRoot || this._root ).uuid, - clipUuid = action._clip.uuid, - actionsForClip = this._actionsByClip[ clipUuid ]; - - this._bindAction( action, - actionsForClip && actionsForClip.knownActions[ 0 ] ); - - this._addInactiveAction( action, clipUuid, rootUuid ); - - } - - var bindings = action._propertyBindings; - - // increment reference counts / sort out state - for ( var i = 0, n = bindings.length; i !== n; ++ i ) { - - var binding = bindings[ i ]; - - if ( binding.useCount ++ === 0 ) { - - this._lendBinding( binding ); - binding.saveOriginalState(); - - } - - } - - this._lendAction( action ); - - } - - }, - - _deactivateAction: function( action ) { - - if ( this._isActiveAction( action ) ) { - - var bindings = action._propertyBindings; - - // decrement reference counts / sort out state - for ( var i = 0, n = bindings.length; i !== n; ++ i ) { - - var binding = bindings[ i ]; - - if ( -- binding.useCount === 0 ) { - - binding.restoreOriginalState(); - this._takeBackBinding( binding ); - - } - - } - - this._takeBackAction( action ); - - } - - }, - - // Memory manager - - _initMemoryManager: function() { - - this._actions = []; // 'nActiveActions' followed by inactive ones - this._nActiveActions = 0; - - this._actionsByClip = {}; - // inside: - // { - // knownActions: Array< AnimationAction > - used as prototypes - // actionByRoot: AnimationAction - lookup - // } - - - this._bindings = []; // 'nActiveBindings' followed by inactive ones - this._nActiveBindings = 0; - - this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer > - - - this._controlInterpolants = []; // same game as above - this._nActiveControlInterpolants = 0; - - var scope = this; - - this.stats = { - - actions: { - get total() { return scope._actions.length; }, - get inUse() { return scope._nActiveActions; } - }, - bindings: { - get total() { return scope._bindings.length; }, - get inUse() { return scope._nActiveBindings; } - }, - controlInterpolants: { - get total() { return scope._controlInterpolants.length; }, - get inUse() { return scope._nActiveControlInterpolants; } - } - - }; - - }, - - // Memory management for AnimationAction objects - - _isActiveAction: function( action ) { - - var index = action._cacheIndex; - return index !== null && index < this._nActiveActions; - - }, - - _addInactiveAction: function( action, clipUuid, rootUuid ) { - - var actions = this._actions, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[ clipUuid ]; - - if ( actionsForClip === undefined ) { - - actionsForClip = { - - knownActions: [ action ], - actionByRoot: {} - - }; - - action._byClipCacheIndex = 0; - - actionsByClip[ clipUuid ] = actionsForClip; - - } else { - - var knownActions = actionsForClip.knownActions; - - action._byClipCacheIndex = knownActions.length; - knownActions.push( action ); - - } - - action._cacheIndex = actions.length; - actions.push( action ); - - actionsForClip.actionByRoot[ rootUuid ] = action; - - }, - - _removeInactiveAction: function( action ) { - - var actions = this._actions, - lastInactiveAction = actions[ actions.length - 1 ], - cacheIndex = action._cacheIndex; - - lastInactiveAction._cacheIndex = cacheIndex; - actions[ cacheIndex ] = lastInactiveAction; - actions.pop(); - - action._cacheIndex = null; - - - var clipUuid = action._clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[ clipUuid ], - knownActionsForClip = actionsForClip.knownActions, - - lastKnownAction = - knownActionsForClip[ knownActionsForClip.length - 1 ], - - byClipCacheIndex = action._byClipCacheIndex; - - lastKnownAction._byClipCacheIndex = byClipCacheIndex; - knownActionsForClip[ byClipCacheIndex ] = lastKnownAction; - knownActionsForClip.pop(); - - action._byClipCacheIndex = null; - - - var actionByRoot = actionsForClip.actionByRoot, - rootUuid = ( actions._localRoot || this._root ).uuid; - - delete actionByRoot[ rootUuid ]; - - if ( knownActionsForClip.length === 0 ) { - - delete actionsByClip[ clipUuid ]; - - } - - this._removeInactiveBindingsForAction( action ); - - }, - - _removeInactiveBindingsForAction: function( action ) { - - var bindings = action._propertyBindings; - for ( var i = 0, n = bindings.length; i !== n; ++ i ) { - - var binding = bindings[ i ]; - - if ( -- binding.referenceCount === 0 ) { - - this._removeInactiveBinding( binding ); - - } - - } - - }, - - _lendAction: function( action ) { - - // [ active actions | inactive actions ] - // [ active actions >| inactive actions ] - // s a - // <-swap-> - // a s - - var actions = this._actions, - prevIndex = action._cacheIndex, - - lastActiveIndex = this._nActiveActions ++, - - firstInactiveAction = actions[ lastActiveIndex ]; - - action._cacheIndex = lastActiveIndex; - actions[ lastActiveIndex ] = action; - - firstInactiveAction._cacheIndex = prevIndex; - actions[ prevIndex ] = firstInactiveAction; - - }, - - _takeBackAction: function( action ) { - - // [ active actions | inactive actions ] - // [ active actions |< inactive actions ] - // a s - // <-swap-> - // s a - - var actions = this._actions, - prevIndex = action._cacheIndex, - - firstInactiveIndex = -- this._nActiveActions, - - lastActiveAction = actions[ firstInactiveIndex ]; - - action._cacheIndex = firstInactiveIndex; - actions[ firstInactiveIndex ] = action; - - lastActiveAction._cacheIndex = prevIndex; - actions[ prevIndex ] = lastActiveAction; - - }, - - // Memory management for PropertyMixer objects - - _addInactiveBinding: function( binding, rootUuid, trackName ) { - - var bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[ rootUuid ], - - bindings = this._bindings; - - if ( bindingByName === undefined ) { - - bindingByName = {}; - bindingsByRoot[ rootUuid ] = bindingByName; - - } - - bindingByName[ trackName ] = binding; - - binding._cacheIndex = bindings.length; - bindings.push( binding ); - - }, - - _removeInactiveBinding: function( binding ) { - - var bindings = this._bindings, - propBinding = binding.binding, - rootUuid = propBinding.rootNode.uuid, - trackName = propBinding.path, - bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[ rootUuid ], - - lastInactiveBinding = bindings[ bindings.length - 1 ], - cacheIndex = binding._cacheIndex; - - lastInactiveBinding._cacheIndex = cacheIndex; - bindings[ cacheIndex ] = lastInactiveBinding; - bindings.pop(); - - delete bindingByName[ trackName ]; - - remove_empty_map: { - - for ( var _ in bindingByName ) break remove_empty_map; - - delete bindingsByRoot[ rootUuid ]; - - } - - }, - - _lendBinding: function( binding ) { - - var bindings = this._bindings, - prevIndex = binding._cacheIndex, - - lastActiveIndex = this._nActiveBindings ++, - - firstInactiveBinding = bindings[ lastActiveIndex ]; - - binding._cacheIndex = lastActiveIndex; - bindings[ lastActiveIndex ] = binding; - - firstInactiveBinding._cacheIndex = prevIndex; - bindings[ prevIndex ] = firstInactiveBinding; - - }, - - _takeBackBinding: function( binding ) { - - var bindings = this._bindings, - prevIndex = binding._cacheIndex, - - firstInactiveIndex = -- this._nActiveBindings, - - lastActiveBinding = bindings[ firstInactiveIndex ]; - - binding._cacheIndex = firstInactiveIndex; - bindings[ firstInactiveIndex ] = binding; - - lastActiveBinding._cacheIndex = prevIndex; - bindings[ prevIndex ] = lastActiveBinding; - - }, - - - // Memory management of Interpolants for weight and time scale - - _lendControlInterpolant: function() { - - var interpolants = this._controlInterpolants, - lastActiveIndex = this._nActiveControlInterpolants ++, - interpolant = interpolants[ lastActiveIndex ]; - - if ( interpolant === undefined ) { - - interpolant = new LinearInterpolant( - new Float32Array( 2 ), new Float32Array( 2 ), - 1, this._controlInterpolantsResultBuffer ); - - interpolant.__cacheIndex = lastActiveIndex; - interpolants[ lastActiveIndex ] = interpolant; - - } - - return interpolant; - - }, - - _takeBackControlInterpolant: function( interpolant ) { - - var interpolants = this._controlInterpolants, - prevIndex = interpolant.__cacheIndex, - - firstInactiveIndex = -- this._nActiveControlInterpolants, - - lastActiveInterpolant = interpolants[ firstInactiveIndex ]; - - interpolant.__cacheIndex = firstInactiveIndex; - interpolants[ firstInactiveIndex ] = interpolant; - - lastActiveInterpolant.__cacheIndex = prevIndex; - interpolants[ prevIndex ] = lastActiveInterpolant; - - }, - - _controlInterpolantsResultBuffer: new Float32Array( 1 ) - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function Uniform( value ) { - - if ( typeof value === 'string' ) { - - console.warn( 'THREE.Uniform: Type parameter is no longer needed.' ); - value = arguments[ 1 ]; - - } - - this.value = value; - -} - -Uniform.prototype.clone = function () { - - return new Uniform( this.value.clone === undefined ? this.value : this.value.clone() ); - -}; - -/** - * @author benaadams / https://twitter.com/ben_a_adams - */ - -function InstancedBufferGeometry() { - - BufferGeometry.call( this ); - - this.type = 'InstancedBufferGeometry'; - this.maxInstancedCount = undefined; - -} - -InstancedBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -InstancedBufferGeometry.prototype.constructor = InstancedBufferGeometry; - -InstancedBufferGeometry.prototype.isInstancedBufferGeometry = true; - -InstancedBufferGeometry.prototype.addGroup = function ( start, count, materialIndex ) { - - this.groups.push( { - - start: start, - count: count, - materialIndex: materialIndex - - } ); - -}; - -InstancedBufferGeometry.prototype.copy = function ( source ) { - - var index = source.index; - - if ( index !== null ) { - - this.setIndex( index.clone() ); - - } - - var attributes = source.attributes; - - for ( var name in attributes ) { - - var attribute = attributes[ name ]; - this.addAttribute( name, attribute.clone() ); - - } - - var groups = source.groups; - - for ( var i = 0, l = groups.length; i < l; i ++ ) { - - var group = groups[ i ]; - this.addGroup( group.start, group.count, group.materialIndex ); - - } - - return this; - -}; - -/** - * @author benaadams / https://twitter.com/ben_a_adams - */ - -function InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, normalized ) { - - this.uuid = _Math.generateUUID(); - - this.data = interleavedBuffer; - this.itemSize = itemSize; - this.offset = offset; - - this.normalized = normalized === true; - -} - - -InterleavedBufferAttribute.prototype = { - - constructor: InterleavedBufferAttribute, - - isInterleavedBufferAttribute: true, - - get count() { - - return this.data.count; - - }, - - get array() { - - return this.data.array; - - }, - - setX: function ( index, x ) { - - this.data.array[ index * this.data.stride + this.offset ] = x; - - return this; - - }, - - setY: function ( index, y ) { - - this.data.array[ index * this.data.stride + this.offset + 1 ] = y; - - return this; - - }, - - setZ: function ( index, z ) { - - this.data.array[ index * this.data.stride + this.offset + 2 ] = z; - - return this; - - }, - - setW: function ( index, w ) { - - this.data.array[ index * this.data.stride + this.offset + 3 ] = w; - - return this; - - }, - - getX: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset ]; - - }, - - getY: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 1 ]; - - }, - - getZ: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 2 ]; - - }, - - getW: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 3 ]; - - }, - - setXY: function ( index, x, y ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - - return this; - - }, - - setXYZ: function ( index, x, y, z ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - this.data.array[ index + 2 ] = z; - - return this; - - }, - - setXYZW: function ( index, x, y, z, w ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - this.data.array[ index + 2 ] = z; - this.data.array[ index + 3 ] = w; - - return this; - - } - -}; - -/** - * @author benaadams / https://twitter.com/ben_a_adams - */ - -function InterleavedBuffer( array, stride ) { - - this.uuid = _Math.generateUUID(); - - this.array = array; - this.stride = stride; - this.count = array !== undefined ? array.length / stride : 0; - - this.dynamic = false; - this.updateRange = { offset: 0, count: - 1 }; - - this.onUploadCallback = function () {}; - - this.version = 0; - -} - -InterleavedBuffer.prototype = { - - constructor: InterleavedBuffer, - - isInterleavedBuffer: true, - - set needsUpdate( value ) { - - if ( value === true ) this.version ++; - - }, - - setArray: function ( array ) { - - if ( Array.isArray( array ) ) { - - throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' ); - - } - - this.count = array !== undefined ? array.length / this.stride : 0; - this.array = array; - - }, - - setDynamic: function ( value ) { - - this.dynamic = value; - - return this; - - }, - - copy: function ( source ) { - - this.array = new source.array.constructor( source.array ); - this.count = source.count; - this.stride = source.stride; - this.dynamic = source.dynamic; - - return this; - - }, - - copyAt: function ( index1, attribute, index2 ) { - - index1 *= this.stride; - index2 *= attribute.stride; - - for ( var i = 0, l = this.stride; i < l; i ++ ) { - - this.array[ index1 + i ] = attribute.array[ index2 + i ]; - - } - - return this; - - }, - - set: function ( value, offset ) { - - if ( offset === undefined ) offset = 0; - - this.array.set( value, offset ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - onUpload: function ( callback ) { - - this.onUploadCallback = callback; - - return this; - - } - -}; - -/** - * @author benaadams / https://twitter.com/ben_a_adams - */ - -function InstancedInterleavedBuffer( array, stride, meshPerAttribute ) { - - InterleavedBuffer.call( this, array, stride ); - - this.meshPerAttribute = meshPerAttribute || 1; - -} - -InstancedInterleavedBuffer.prototype = Object.create( InterleavedBuffer.prototype ); -InstancedInterleavedBuffer.prototype.constructor = InstancedInterleavedBuffer; - -InstancedInterleavedBuffer.prototype.isInstancedInterleavedBuffer = true; - -InstancedInterleavedBuffer.prototype.copy = function ( source ) { - - InterleavedBuffer.prototype.copy.call( this, source ); - - this.meshPerAttribute = source.meshPerAttribute; - - return this; - -}; - -/** - * @author benaadams / https://twitter.com/ben_a_adams - */ - -function InstancedBufferAttribute( array, itemSize, meshPerAttribute ) { - - BufferAttribute.call( this, array, itemSize ); - - this.meshPerAttribute = meshPerAttribute || 1; - -} - -InstancedBufferAttribute.prototype = Object.create( BufferAttribute.prototype ); -InstancedBufferAttribute.prototype.constructor = InstancedBufferAttribute; - -InstancedBufferAttribute.prototype.isInstancedBufferAttribute = true; - -InstancedBufferAttribute.prototype.copy = function ( source ) { - - BufferAttribute.prototype.copy.call( this, source ); - - this.meshPerAttribute = source.meshPerAttribute; - - return this; - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author bhouston / http://clara.io/ - * @author stephomi / http://stephaneginier.com/ - */ - -function Raycaster( origin, direction, near, far ) { - - this.ray = new Ray( origin, direction ); - // direction is assumed to be normalized (for accurate distance calculations) - - this.near = near || 0; - this.far = far || Infinity; - - this.params = { - Mesh: {}, - Line: {}, - LOD: {}, - Points: { threshold: 1 }, - Sprite: {} - }; - - Object.defineProperties( this.params, { - PointCloud: { - get: function () { - console.warn( 'THREE.Raycaster: params.PointCloud has been renamed to params.Points.' ); - return this.Points; - } - } - } ); - -} - -function ascSort( a, b ) { - - return a.distance - b.distance; - -} - -function intersectObject( object, raycaster, intersects, recursive ) { - - if ( object.visible === false ) return; - - object.raycast( raycaster, intersects ); - - if ( recursive === true ) { - - var children = object.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - intersectObject( children[ i ], raycaster, intersects, true ); - - } - - } - -} - -// - -Raycaster.prototype = { - - constructor: Raycaster, - - linePrecision: 1, - - set: function ( origin, direction ) { - - // direction is assumed to be normalized (for accurate distance calculations) - - this.ray.set( origin, direction ); - - }, - - setFromCamera: function ( coords, camera ) { - - if ( (camera && camera.isPerspectiveCamera) ) { - - this.ray.origin.setFromMatrixPosition( camera.matrixWorld ); - this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize(); - - } else if ( (camera && camera.isOrthographicCamera) ) { - - this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera - this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ); - - } else { - - console.error( 'THREE.Raycaster: Unsupported camera type.' ); - - } - - }, - - intersectObject: function ( object, recursive ) { - - var intersects = []; - - intersectObject( object, this, intersects, recursive ); - - intersects.sort( ascSort ); - - return intersects; - - }, - - intersectObjects: function ( objects, recursive ) { - - var intersects = []; - - if ( Array.isArray( objects ) === false ) { - - console.warn( 'THREE.Raycaster.intersectObjects: objects is not an Array.' ); - return intersects; - - } - - for ( var i = 0, l = objects.length; i < l; i ++ ) { - - intersectObject( objects[ i ], this, intersects, recursive ); - - } - - intersects.sort( ascSort ); - - return intersects; - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function Clock( autoStart ) { - - this.autoStart = ( autoStart !== undefined ) ? autoStart : true; - - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - - this.running = false; - -} - -Clock.prototype = { - - constructor: Clock, - - start: function () { - - this.startTime = ( performance || Date ).now(); - - this.oldTime = this.startTime; - this.elapsedTime = 0; - this.running = true; - - }, - - stop: function () { - - this.getElapsedTime(); - this.running = false; - - }, - - getElapsedTime: function () { - - this.getDelta(); - return this.elapsedTime; - - }, - - getDelta: function () { - - var diff = 0; - - if ( this.autoStart && ! this.running ) { - - this.start(); - - } - - if ( this.running ) { - - var newTime = ( performance || Date ).now(); - - diff = ( newTime - this.oldTime ) / 1000; - this.oldTime = newTime; - - this.elapsedTime += diff; - - } - - return diff; - - } - -}; - -/** - * Spline from Tween.js, slightly optimized (and trashed) - * http://sole.github.com/tween.js/examples/05_spline.html - * - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -function Spline( points ) { - - this.points = points; - - var c = [], v3 = { x: 0, y: 0, z: 0 }, - point, intPoint, weight, w2, w3, - pa, pb, pc, pd; - - this.initFromArray = function ( a ) { - - this.points = []; - - for ( var i = 0; i < a.length; i ++ ) { - - this.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] }; - - } - - }; - - this.getPoint = function ( k ) { - - point = ( this.points.length - 1 ) * k; - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1; - c[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2; - - pa = this.points[ c[ 0 ] ]; - pb = this.points[ c[ 1 ] ]; - pc = this.points[ c[ 2 ] ]; - pd = this.points[ c[ 3 ] ]; - - w2 = weight * weight; - w3 = weight * w2; - - v3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 ); - v3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 ); - v3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 ); - - return v3; - - }; - - this.getControlPointsArray = function () { - - var i, p, l = this.points.length, - coords = []; - - for ( i = 0; i < l; i ++ ) { - - p = this.points[ i ]; - coords[ i ] = [ p.x, p.y, p.z ]; - - } - - return coords; - - }; - - // approximate length by summing linear segments - - this.getLength = function ( nSubDivisions ) { - - var i, index, nSamples, position, - point = 0, intPoint = 0, oldIntPoint = 0, - oldPosition = new Vector3(), - tmpVec = new Vector3(), - chunkLengths = [], - totalLength = 0; - - // first point has 0 length - - chunkLengths[ 0 ] = 0; - - if ( ! nSubDivisions ) nSubDivisions = 100; - - nSamples = this.points.length * nSubDivisions; - - oldPosition.copy( this.points[ 0 ] ); - - for ( i = 1; i < nSamples; i ++ ) { - - index = i / nSamples; - - position = this.getPoint( index ); - tmpVec.copy( position ); - - totalLength += tmpVec.distanceTo( oldPosition ); - - oldPosition.copy( position ); - - point = ( this.points.length - 1 ) * index; - intPoint = Math.floor( point ); - - if ( intPoint !== oldIntPoint ) { - - chunkLengths[ intPoint ] = totalLength; - oldIntPoint = intPoint; - - } - - } - - // last point ends with total length - - chunkLengths[ chunkLengths.length ] = totalLength; - - return { chunks: chunkLengths, total: totalLength }; - - }; - - this.reparametrizeByArcLength = function ( samplingCoef ) { - - var i, j, - index, indexCurrent, indexNext, - realDistance, - sampling, position, - newpoints = [], - tmpVec = new Vector3(), - sl = this.getLength(); - - newpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() ); - - for ( i = 1; i < this.points.length; i ++ ) { - - //tmpVec.copy( this.points[ i - 1 ] ); - //linearDistance = tmpVec.distanceTo( this.points[ i ] ); - - realDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ]; - - sampling = Math.ceil( samplingCoef * realDistance / sl.total ); - - indexCurrent = ( i - 1 ) / ( this.points.length - 1 ); - indexNext = i / ( this.points.length - 1 ); - - for ( j = 1; j < sampling - 1; j ++ ) { - - index = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent ); - - position = this.getPoint( index ); - newpoints.push( tmpVec.copy( position ).clone() ); - - } - - newpoints.push( tmpVec.copy( this.points[ i ] ).clone() ); - - } - - this.points = newpoints; - - }; - - // Catmull-Rom - - function interpolate( p0, p1, p2, p3, t, t2, t3 ) { - - var v0 = ( p2 - p0 ) * 0.5, - v1 = ( p3 - p1 ) * 0.5; - - return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - } - -} - -/** - * @author bhouston / http://clara.io - * @author WestLangley / http://github.com/WestLangley - * - * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system - * - * The poles (phi) are at the positive and negative y axis. - * The equator starts at positive z. - */ - -function Spherical( radius, phi, theta ) { - - this.radius = ( radius !== undefined ) ? radius : 1.0; - this.phi = ( phi !== undefined ) ? phi : 0; // up / down towards top and bottom pole - this.theta = ( theta !== undefined ) ? theta : 0; // around the equator of the sphere - - return this; - -} - -Spherical.prototype = { - - constructor: Spherical, - - set: function ( radius, phi, theta ) { - - this.radius = radius; - this.phi = phi; - this.theta = theta; - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( other ) { - - this.radius = other.radius; - this.phi = other.phi; - this.theta = other.theta; - - return this; - - }, - - // restrict phi to be betwee EPS and PI-EPS - makeSafe: function() { - - var EPS = 0.000001; - this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) ); - - return this; - - }, - - setFromVector3: function( vec3 ) { - - this.radius = vec3.length(); - - if ( this.radius === 0 ) { - - this.theta = 0; - this.phi = 0; - - } else { - - this.theta = Math.atan2( vec3.x, vec3.z ); // equator angle around y-up axis - this.phi = Math.acos( _Math.clamp( vec3.y / this.radius, - 1, 1 ) ); // polar angle - - } - - return this; - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function MorphBlendMesh( geometry, material ) { - - Mesh.call( this, geometry, material ); - - this.animationsMap = {}; - this.animationsList = []; - - // prepare default animation - // (all frames played together in 1 second) - - var numFrames = this.geometry.morphTargets.length; - - var name = "__default"; - - var startFrame = 0; - var endFrame = numFrames - 1; - - var fps = numFrames / 1; - - this.createAnimation( name, startFrame, endFrame, fps ); - this.setAnimationWeight( name, 1 ); - -} - -MorphBlendMesh.prototype = Object.create( Mesh.prototype ); -MorphBlendMesh.prototype.constructor = MorphBlendMesh; - -MorphBlendMesh.prototype.createAnimation = function ( name, start, end, fps ) { - - var animation = { - - start: start, - end: end, - - length: end - start + 1, - - fps: fps, - duration: ( end - start ) / fps, - - lastFrame: 0, - currentFrame: 0, - - active: false, - - time: 0, - direction: 1, - weight: 1, - - directionBackwards: false, - mirroredLoop: false - - }; - - this.animationsMap[ name ] = animation; - this.animationsList.push( animation ); - -}; - -MorphBlendMesh.prototype.autoCreateAnimations = function ( fps ) { - - var pattern = /([a-z]+)_?(\d+)/i; - - var firstAnimation, frameRanges = {}; - - var geometry = this.geometry; - - for ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) { - - var morph = geometry.morphTargets[ i ]; - var chunks = morph.name.match( pattern ); - - if ( chunks && chunks.length > 1 ) { - - var name = chunks[ 1 ]; - - if ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity }; - - var range = frameRanges[ name ]; - - if ( i < range.start ) range.start = i; - if ( i > range.end ) range.end = i; - - if ( ! firstAnimation ) firstAnimation = name; - - } - - } - - for ( var name in frameRanges ) { - - var range = frameRanges[ name ]; - this.createAnimation( name, range.start, range.end, fps ); - - } - - this.firstAnimation = firstAnimation; - -}; - -MorphBlendMesh.prototype.setAnimationDirectionForward = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = 1; - animation.directionBackwards = false; - - } - -}; - -MorphBlendMesh.prototype.setAnimationDirectionBackward = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = - 1; - animation.directionBackwards = true; - - } - -}; - -MorphBlendMesh.prototype.setAnimationFPS = function ( name, fps ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.fps = fps; - animation.duration = ( animation.end - animation.start ) / animation.fps; - - } - -}; - -MorphBlendMesh.prototype.setAnimationDuration = function ( name, duration ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.duration = duration; - animation.fps = ( animation.end - animation.start ) / animation.duration; - - } - -}; - -MorphBlendMesh.prototype.setAnimationWeight = function ( name, weight ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.weight = weight; - - } - -}; - -MorphBlendMesh.prototype.setAnimationTime = function ( name, time ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = time; - - } - -}; - -MorphBlendMesh.prototype.getAnimationTime = function ( name ) { - - var time = 0; - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - time = animation.time; - - } - - return time; - -}; - -MorphBlendMesh.prototype.getAnimationDuration = function ( name ) { - - var duration = - 1; - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - duration = animation.duration; - - } - - return duration; - -}; - -MorphBlendMesh.prototype.playAnimation = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = 0; - animation.active = true; - - } else { - - console.warn( "THREE.MorphBlendMesh: animation[" + name + "] undefined in .playAnimation()" ); - - } - -}; - -MorphBlendMesh.prototype.stopAnimation = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.active = false; - - } - -}; - -MorphBlendMesh.prototype.update = function ( delta ) { - - for ( var i = 0, il = this.animationsList.length; i < il; i ++ ) { - - var animation = this.animationsList[ i ]; - - if ( ! animation.active ) continue; - - var frameTime = animation.duration / animation.length; - - animation.time += animation.direction * delta; - - if ( animation.mirroredLoop ) { - - if ( animation.time > animation.duration || animation.time < 0 ) { - - animation.direction *= - 1; - - if ( animation.time > animation.duration ) { - - animation.time = animation.duration; - animation.directionBackwards = true; - - } - - if ( animation.time < 0 ) { - - animation.time = 0; - animation.directionBackwards = false; - - } - - } - - } else { - - animation.time = animation.time % animation.duration; - - if ( animation.time < 0 ) animation.time += animation.duration; - - } - - var keyframe = animation.start + _Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 ); - var weight = animation.weight; - - if ( keyframe !== animation.currentFrame ) { - - this.morphTargetInfluences[ animation.lastFrame ] = 0; - this.morphTargetInfluences[ animation.currentFrame ] = 1 * weight; - - this.morphTargetInfluences[ keyframe ] = 0; - - animation.lastFrame = animation.currentFrame; - animation.currentFrame = keyframe; - - } - - var mix = ( animation.time % frameTime ) / frameTime; - - if ( animation.directionBackwards ) mix = 1 - mix; - - if ( animation.currentFrame !== animation.lastFrame ) { - - this.morphTargetInfluences[ animation.currentFrame ] = mix * weight; - this.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight; - - } else { - - this.morphTargetInfluences[ animation.currentFrame ] = weight; - - } - - } - -}; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -function ImmediateRenderObject( material ) { - - Object3D.call( this ); - - this.material = material; - this.render = function ( renderCallback ) {}; - -} - -ImmediateRenderObject.prototype = Object.create( Object3D.prototype ); -ImmediateRenderObject.prototype.constructor = ImmediateRenderObject; - -ImmediateRenderObject.prototype.isImmediateRenderObject = true; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -function VertexNormalsHelper( object, size, hex, linewidth ) { - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0xff0000; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - // - - var nNormals = 0; - - var objGeometry = this.object.geometry; - - if ( objGeometry && objGeometry.isGeometry ) { - - nNormals = objGeometry.faces.length * 3; - - } else if ( objGeometry && objGeometry.isBufferGeometry ) { - - nNormals = objGeometry.attributes.normal.count; - - } - - // - - var geometry = new BufferGeometry(); - - var positions = new Float32BufferAttribute( nNormals * 2 * 3, 3 ); - - geometry.addAttribute( 'position', positions ); - - LineSegments.call( this, geometry, new LineBasicMaterial( { color: color, linewidth: width } ) ); - - // - - this.matrixAutoUpdate = false; - - this.update(); - -} - -VertexNormalsHelper.prototype = Object.create( LineSegments.prototype ); -VertexNormalsHelper.prototype.constructor = VertexNormalsHelper; - -VertexNormalsHelper.prototype.update = ( function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - var normalMatrix = new Matrix3(); - - return function update() { - - var keys = [ 'a', 'b', 'c' ]; - - this.object.updateMatrixWorld( true ); - - normalMatrix.getNormalMatrix( this.object.matrixWorld ); - - var matrixWorld = this.object.matrixWorld; - - var position = this.geometry.attributes.position; - - // - - var objGeometry = this.object.geometry; - - if ( objGeometry && objGeometry.isGeometry ) { - - var vertices = objGeometry.vertices; - - var faces = objGeometry.faces; - - var idx = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - var vertex = vertices[ face[ keys[ j ] ] ]; - - var normal = face.vertexNormals[ j ]; - - v1.copy( vertex ).applyMatrix4( matrixWorld ); - - v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); - - position.setXYZ( idx, v1.x, v1.y, v1.z ); - - idx = idx + 1; - - position.setXYZ( idx, v2.x, v2.y, v2.z ); - - idx = idx + 1; - - } - - } - - } else if ( objGeometry && objGeometry.isBufferGeometry ) { - - var objPos = objGeometry.attributes.position; - - var objNorm = objGeometry.attributes.normal; - - var idx = 0; - - // for simplicity, ignore index and drawcalls, and render every normal - - for ( var j = 0, jl = objPos.count; j < jl; j ++ ) { - - v1.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld ); - - v2.set( objNorm.getX( j ), objNorm.getY( j ), objNorm.getZ( j ) ); - - v2.applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); - - position.setXYZ( idx, v1.x, v1.y, v1.z ); - - idx = idx + 1; - - position.setXYZ( idx, v2.x, v2.y, v2.z ); - - idx = idx + 1; - - } - - } - - position.needsUpdate = true; - - return this; - - }; - -}() ); - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -function SpotLightHelper( light ) { - - Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - var geometry = new BufferGeometry(); - - var positions = [ - 0, 0, 0, 0, 0, 1, - 0, 0, 0, 1, 0, 1, - 0, 0, 0, - 1, 0, 1, - 0, 0, 0, 0, 1, 1, - 0, 0, 0, 0, - 1, 1 - ]; - - for ( var i = 0, j = 1, l = 32; i < l; i ++, j ++ ) { - - var p1 = ( i / l ) * Math.PI * 2; - var p2 = ( j / l ) * Math.PI * 2; - - positions.push( - Math.cos( p1 ), Math.sin( p1 ), 1, - Math.cos( p2 ), Math.sin( p2 ), 1 - ); - - } - - geometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - - var material = new LineBasicMaterial( { fog: false } ); - - this.cone = new LineSegments( geometry, material ); - this.add( this.cone ); - - this.update(); - -} - -SpotLightHelper.prototype = Object.create( Object3D.prototype ); -SpotLightHelper.prototype.constructor = SpotLightHelper; - -SpotLightHelper.prototype.dispose = function () { - - this.cone.geometry.dispose(); - this.cone.material.dispose(); - -}; - -SpotLightHelper.prototype.update = function () { - - var vector = new Vector3(); - var vector2 = new Vector3(); - - return function update() { - - var coneLength = this.light.distance ? this.light.distance : 1000; - var coneWidth = coneLength * Math.tan( this.light.angle ); - - this.cone.scale.set( coneWidth, coneWidth, coneLength ); - - vector.setFromMatrixPosition( this.light.matrixWorld ); - vector2.setFromMatrixPosition( this.light.target.matrixWorld ); - - this.cone.lookAt( vector2.sub( vector ) ); - - this.cone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - }; - -}(); - -/** - * @author Sean Griffin / http://twitter.com/sgrif - * @author Michael Guerrero / http://realitymeltdown.com - * @author mrdoob / http://mrdoob.com/ - * @author ikerr / http://verold.com - * @author Mugen87 / https://github.com/Mugen87 - */ - -function SkeletonHelper( object ) { - - this.bones = this.getBoneList( object ); - - var geometry = new BufferGeometry(); - - var vertices = []; - var colors = []; - - var color1 = new Color( 0, 0, 1 ); - var color2 = new Color( 0, 1, 0 ); - - for ( var i = 0; i < this.bones.length; i ++ ) { - - var bone = this.bones[ i ]; - - if ( bone.parent && bone.parent.isBone ) { - - vertices.push( 0, 0, 0 ); - vertices.push( 0, 0, 0 ); - colors.push( color1.r, color1.g, color1.b ); - colors.push( color2.r, color2.g, color2.b ); - - } - - } - - geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - var material = new LineBasicMaterial( { vertexColors: VertexColors, depthTest: false, depthWrite: false, transparent: true } ); - - LineSegments.call( this, geometry, material ); - - this.root = object; - - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - - this.update(); - -} - - -SkeletonHelper.prototype = Object.create( LineSegments.prototype ); -SkeletonHelper.prototype.constructor = SkeletonHelper; - -SkeletonHelper.prototype.getBoneList = function( object ) { - - var boneList = []; - - if ( object && object.isBone ) { - - boneList.push( object ); - - } - - for ( var i = 0; i < object.children.length; i ++ ) { - - boneList.push.apply( boneList, this.getBoneList( object.children[ i ] ) ); - - } - - return boneList; - -}; - -SkeletonHelper.prototype.update = function () { - - var vector = new Vector3(); - - var boneMatrix = new Matrix4(); - var matrixWorldInv = new Matrix4(); - - return function update() { - - var geometry = this.geometry; - var position = geometry.getAttribute( 'position' ); - - matrixWorldInv.getInverse( this.root.matrixWorld ); - - for ( var i = 0, j = 0; i < this.bones.length; i ++ ) { - - var bone = this.bones[ i ]; - - if ( bone.parent && bone.parent.isBone ) { - - boneMatrix.multiplyMatrices( matrixWorldInv, bone.matrixWorld ); - vector.setFromMatrixPosition( boneMatrix ); - position.setXYZ( j, vector.x, vector.y, vector.z ); - - boneMatrix.multiplyMatrices( matrixWorldInv, bone.parent.matrixWorld ); - vector.setFromMatrixPosition( boneMatrix ); - position.setXYZ( j + 1, vector.x, vector.y, vector.z ); - - j += 2; - - } - - } - - geometry.getAttribute( 'position' ).needsUpdate = true; - - }; - -}(); - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -function PointLightHelper( light, sphereSize ) { - - this.light = light; - this.light.updateMatrixWorld(); - - var geometry = new SphereBufferGeometry( sphereSize, 4, 2 ); - var material = new MeshBasicMaterial( { wireframe: true, fog: false } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - Mesh.call( this, geometry, material ); - - this.matrix = this.light.matrixWorld; - this.matrixAutoUpdate = false; - - /* - var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 ); - var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } ); - - this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); - this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial ); - - var d = light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.scale.set( d, d, d ); - - } - - this.add( this.lightDistance ); - */ - -} - -PointLightHelper.prototype = Object.create( Mesh.prototype ); -PointLightHelper.prototype.constructor = PointLightHelper; - -PointLightHelper.prototype.dispose = function () { - - this.geometry.dispose(); - this.material.dispose(); - -}; - -PointLightHelper.prototype.update = function () { - - this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - /* - var d = this.light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.visible = true; - this.lightDistance.scale.set( d, d, d ); - - } - */ - -}; - -/** - * @author abelnation / http://github.com/abelnation - * @author Mugen87 / http://github.com/Mugen87 - */ - -function RectAreaLightHelper( light ) { - - Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - var materialFront = new MeshBasicMaterial( { - color: light.color, - fog: false - } ); - - var materialBack = new MeshBasicMaterial( { - color: light.color, - fog: false, - wireframe: true - } ); - - var geometry = new BufferGeometry(); - - geometry.addAttribute( 'position', new BufferAttribute( new Float32Array( 6 * 3 ), 3 ) ); - - // shows the "front" of the light, e.g. where light comes from - - this.add( new Mesh( geometry, materialFront ) ); - - // shows the "back" of the light, which does not emit light - - this.add( new Mesh( geometry, materialBack ) ); - - this.update(); - -} - -RectAreaLightHelper.prototype = Object.create( Object3D.prototype ); -RectAreaLightHelper.prototype.constructor = RectAreaLightHelper; - -RectAreaLightHelper.prototype.dispose = function () { - - this.children[ 0 ].geometry.dispose(); - this.children[ 0 ].material.dispose(); - this.children[ 1 ].geometry.dispose(); - this.children[ 1 ].material.dispose(); - -}; - -RectAreaLightHelper.prototype.update = function () { - - var vector1 = new Vector3(); - var vector2 = new Vector3(); - - return function update() { - - var mesh1 = this.children[ 0 ]; - var mesh2 = this.children[ 1 ]; - - if ( this.light.target ) { - - vector1.setFromMatrixPosition( this.light.matrixWorld ); - vector2.setFromMatrixPosition( this.light.target.matrixWorld ); - - var lookVec = vector2.clone().sub( vector1 ); - mesh1.lookAt( lookVec ); - mesh2.lookAt( lookVec ); - - } - - // update materials - - mesh1.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - mesh2.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - // calculate new dimensions of the helper - - var hx = this.light.width * 0.5; - var hy = this.light.height * 0.5; - - // because the buffer attribute is shared over both geometries, we only have to update once - - var position = mesh1.geometry.getAttribute( 'position' ); - var array = position.array; - - // first face - - array[ 0 ] = hx; array[ 1 ] = - hy; array[ 2 ] = 0; - array[ 3 ] = hx; array[ 4 ] = hy; array[ 5 ] = 0; - array[ 6 ] = - hx; array[ 7 ] = hy; array[ 8 ] = 0; - - // second face - - array[ 9 ] = - hx; array[ 10 ] = hy; array[ 11 ] = 0; - array[ 12 ] = - hx; array[ 13 ] = - hy; array[ 14 ] = 0; - array[ 15 ] = hx; array[ 16 ] = - hy; array[ 17 ] = 0; - - position.needsUpdate = true; - - }; - -}(); - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author Mugen87 / https://github.com/Mugen87 - */ - -function HemisphereLightHelper( light, size ) { - - Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - var geometry = new OctahedronBufferGeometry( size ); - geometry.rotateY( Math.PI * 0.5 ); - - var material = new MeshBasicMaterial( { vertexColors: VertexColors, wireframe: true } ); - - var position = geometry.getAttribute( 'position' ); - var colors = new Float32Array( position.count * 3 ); - - geometry.addAttribute( 'color', new BufferAttribute( colors, 3 ) ); - - this.add( new Mesh( geometry, material ) ); - - this.update(); - -} - -HemisphereLightHelper.prototype = Object.create( Object3D.prototype ); -HemisphereLightHelper.prototype.constructor = HemisphereLightHelper; - -HemisphereLightHelper.prototype.dispose = function () { - - this.children[ 0 ].geometry.dispose(); - this.children[ 0 ].material.dispose(); - -}; - -HemisphereLightHelper.prototype.update = function () { - - var vector = new Vector3(); - - var color1 = new Color(); - var color2 = new Color(); - - return function update() { - - var mesh = this.children[ 0 ]; - - var colors = mesh.geometry.getAttribute( 'color' ); - - color1.copy( this.light.color ).multiplyScalar( this.light.intensity ); - color2.copy( this.light.groundColor ).multiplyScalar( this.light.intensity ); - - for ( var i = 0, l = colors.count; i < l; i ++ ) { - - var color = ( i < ( l / 2 ) ) ? color1 : color2; - - colors.setXYZ( i, color.r, color.g, color.b ); - - } - - mesh.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() ); - - colors.needsUpdate = true; - - }; - -}(); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function GridHelper( size, divisions, color1, color2 ) { - - size = size || 10; - divisions = divisions || 10; - color1 = new Color( color1 !== undefined ? color1 : 0x444444 ); - color2 = new Color( color2 !== undefined ? color2 : 0x888888 ); - - var center = divisions / 2; - var step = ( size * 2 ) / divisions; - var vertices = [], colors = []; - - for ( var i = 0, j = 0, k = - size; i <= divisions; i ++, k += step ) { - - vertices.push( - size, 0, k, size, 0, k ); - vertices.push( k, 0, - size, k, 0, size ); - - var color = i === center ? color1 : color2; - - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - - } - - var geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - var material = new LineBasicMaterial( { vertexColors: VertexColors } ); - - LineSegments.call( this, geometry, material ); - -} - -GridHelper.prototype = Object.create( LineSegments.prototype ); -GridHelper.prototype.constructor = GridHelper; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author Mugen87 / http://github.com/Mugen87 - * @author Hectate / http://www.github.com/Hectate - */ - -function PolarGridHelper( radius, radials, circles, divisions, color1, color2 ) { - - radius = radius || 10; - radials = radials || 16; - circles = circles || 8; - divisions = divisions || 64; - color1 = new Color( color1 !== undefined ? color1 : 0x444444 ); - color2 = new Color( color2 !== undefined ? color2 : 0x888888 ); - - var vertices = []; - var colors = []; - - var x, z; - var v, i, j, r, color; - - // create the radials - - for ( i = 0; i <= radials; i ++ ) { - - v = ( i / radials ) * ( Math.PI * 2 ); - - x = Math.sin( v ) * radius; - z = Math.cos( v ) * radius; - - vertices.push( 0, 0, 0 ); - vertices.push( x, 0, z ); - - color = ( i & 1 ) ? color1 : color2; - - colors.push( color.r, color.g, color.b ); - colors.push( color.r, color.g, color.b ); - - } - - // create the circles - - for ( i = 0; i <= circles; i ++ ) { - - color = ( i & 1 ) ? color1 : color2; - - r = radius - ( radius / circles * i ); - - for ( j = 0; j < divisions; j ++ ) { - - // first vertex - - v = ( j / divisions ) * ( Math.PI * 2 ); - - x = Math.sin( v ) * r; - z = Math.cos( v ) * r; - - vertices.push( x, 0, z ); - colors.push( color.r, color.g, color.b ); - - // second vertex - - v = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 ); - - x = Math.sin( v ) * r; - z = Math.cos( v ) * r; - - vertices.push( x, 0, z ); - colors.push( color.r, color.g, color.b ); - - } - - } - - var geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - var material = new LineBasicMaterial( { vertexColors: VertexColors } ); - - LineSegments.call( this, geometry, material ); - -} - -PolarGridHelper.prototype = Object.create( LineSegments.prototype ); -PolarGridHelper.prototype.constructor = PolarGridHelper; - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -function FaceNormalsHelper( object, size, hex, linewidth ) { - - // FaceNormalsHelper only supports THREE.Geometry - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0xffff00; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - // - - var nNormals = 0; - - var objGeometry = this.object.geometry; - - if ( objGeometry && objGeometry.isGeometry ) { - - nNormals = objGeometry.faces.length; - - } else { - - console.warn( 'THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.' ); - - } - - // - - var geometry = new BufferGeometry(); - - var positions = new Float32BufferAttribute( nNormals * 2 * 3, 3 ); - - geometry.addAttribute( 'position', positions ); - - LineSegments.call( this, geometry, new LineBasicMaterial( { color: color, linewidth: width } ) ); - - // - - this.matrixAutoUpdate = false; - this.update(); - -} - -FaceNormalsHelper.prototype = Object.create( LineSegments.prototype ); -FaceNormalsHelper.prototype.constructor = FaceNormalsHelper; - -FaceNormalsHelper.prototype.update = ( function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - var normalMatrix = new Matrix3(); - - return function update() { - - this.object.updateMatrixWorld( true ); - - normalMatrix.getNormalMatrix( this.object.matrixWorld ); - - var matrixWorld = this.object.matrixWorld; - - var position = this.geometry.attributes.position; - - // - - var objGeometry = this.object.geometry; - - var vertices = objGeometry.vertices; - - var faces = objGeometry.faces; - - var idx = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - var normal = face.normal; - - v1.copy( vertices[ face.a ] ) - .add( vertices[ face.b ] ) - .add( vertices[ face.c ] ) - .divideScalar( 3 ) - .applyMatrix4( matrixWorld ); - - v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); - - position.setXYZ( idx, v1.x, v1.y, v1.z ); - - idx = idx + 1; - - position.setXYZ( idx, v2.x, v2.y, v2.z ); - - idx = idx + 1; - - } - - position.needsUpdate = true; - - return this; - - }; - -}() ); - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -function DirectionalLightHelper( light, size ) { - - Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - if ( size === undefined ) size = 1; - - var geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new Float32BufferAttribute( [ - - size, size, 0, - size, size, 0, - size, - size, 0, - - size, - size, 0, - - size, size, 0 - ], 3 ) ); - - var material = new LineBasicMaterial( { fog: false } ); - - this.add( new Line( geometry, material ) ); - - geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) ); - - this.add( new Line( geometry, material )); - - this.update(); - -} - -DirectionalLightHelper.prototype = Object.create( Object3D.prototype ); -DirectionalLightHelper.prototype.constructor = DirectionalLightHelper; - -DirectionalLightHelper.prototype.dispose = function () { - - var lightPlane = this.children[ 0 ]; - var targetLine = this.children[ 1 ]; - - lightPlane.geometry.dispose(); - lightPlane.material.dispose(); - targetLine.geometry.dispose(); - targetLine.material.dispose(); - -}; - -DirectionalLightHelper.prototype.update = function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - var v3 = new Vector3(); - - return function update() { - - v1.setFromMatrixPosition( this.light.matrixWorld ); - v2.setFromMatrixPosition( this.light.target.matrixWorld ); - v3.subVectors( v2, v1 ); - - var lightPlane = this.children[ 0 ]; - var targetLine = this.children[ 1 ]; - - lightPlane.lookAt( v3 ); - lightPlane.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - targetLine.lookAt( v3 ); - targetLine.scale.z = v3.length(); - - }; - -}(); - -/** - * @author alteredq / http://alteredqualia.com/ - * @author Mugen87 / https://github.com/Mugen87 - * - * - shows frustum, line of sight and up of the camera - * - suitable for fast updates - * - based on frustum visualization in lightgl.js shadowmap example - * http://evanw.github.com/lightgl.js/tests/shadowmap.html - */ - -function CameraHelper( camera ) { - - var geometry = new BufferGeometry(); - var material = new LineBasicMaterial( { color: 0xffffff, vertexColors: FaceColors } ); - - var vertices = []; - var colors = []; - - var pointMap = {}; - - // colors - - var colorFrustum = new Color( 0xffaa00 ); - var colorCone = new Color( 0xff0000 ); - var colorUp = new Color( 0x00aaff ); - var colorTarget = new Color( 0xffffff ); - var colorCross = new Color( 0x333333 ); - - // near - - addLine( "n1", "n2", colorFrustum ); - addLine( "n2", "n4", colorFrustum ); - addLine( "n4", "n3", colorFrustum ); - addLine( "n3", "n1", colorFrustum ); - - // far - - addLine( "f1", "f2", colorFrustum ); - addLine( "f2", "f4", colorFrustum ); - addLine( "f4", "f3", colorFrustum ); - addLine( "f3", "f1", colorFrustum ); - - // sides - - addLine( "n1", "f1", colorFrustum ); - addLine( "n2", "f2", colorFrustum ); - addLine( "n3", "f3", colorFrustum ); - addLine( "n4", "f4", colorFrustum ); - - // cone - - addLine( "p", "n1", colorCone ); - addLine( "p", "n2", colorCone ); - addLine( "p", "n3", colorCone ); - addLine( "p", "n4", colorCone ); - - // up - - addLine( "u1", "u2", colorUp ); - addLine( "u2", "u3", colorUp ); - addLine( "u3", "u1", colorUp ); - - // target - - addLine( "c", "t", colorTarget ); - addLine( "p", "c", colorCross ); - - // cross - - addLine( "cn1", "cn2", colorCross ); - addLine( "cn3", "cn4", colorCross ); - - addLine( "cf1", "cf2", colorCross ); - addLine( "cf3", "cf4", colorCross ); - - function addLine( a, b, color ) { - - addPoint( a, color ); - addPoint( b, color ); - - } - - function addPoint( id, color ) { - - vertices.push( 0, 0, 0 ); - colors.push( color.r, color.g, color.b ); - - if ( pointMap[ id ] === undefined ) { - - pointMap[ id ] = []; - - } - - pointMap[ id ].push( ( vertices.length / 3 ) - 1 ); - - } - - geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - LineSegments.call( this, geometry, material ); - - this.camera = camera; - if ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix(); - - this.matrix = camera.matrixWorld; - this.matrixAutoUpdate = false; - - this.pointMap = pointMap; - - this.update(); - -} - -CameraHelper.prototype = Object.create( LineSegments.prototype ); -CameraHelper.prototype.constructor = CameraHelper; - -CameraHelper.prototype.update = function () { - - var geometry, pointMap; - - var vector = new Vector3(); - var camera = new Camera(); - - function setPoint( point, x, y, z ) { - - vector.set( x, y, z ).unproject( camera ); - - var points = pointMap[ point ]; - - if ( points !== undefined ) { - - var position = geometry.getAttribute( 'position' ); - - for ( var i = 0, l = points.length; i < l; i ++ ) { - - position.setXYZ( points[ i ], vector.x, vector.y, vector.z ); - - } - - } - - } - - return function update() { - - geometry = this.geometry; - pointMap = this.pointMap; - - var w = 1, h = 1; - - // we need just camera projection matrix - // world matrix must be identity - - camera.projectionMatrix.copy( this.camera.projectionMatrix ); - - // center / target - - setPoint( "c", 0, 0, - 1 ); - setPoint( "t", 0, 0, 1 ); - - // near - - setPoint( "n1", - w, - h, - 1 ); - setPoint( "n2", w, - h, - 1 ); - setPoint( "n3", - w, h, - 1 ); - setPoint( "n4", w, h, - 1 ); - - // far - - setPoint( "f1", - w, - h, 1 ); - setPoint( "f2", w, - h, 1 ); - setPoint( "f3", - w, h, 1 ); - setPoint( "f4", w, h, 1 ); - - // up - - setPoint( "u1", w * 0.7, h * 1.1, - 1 ); - setPoint( "u2", - w * 0.7, h * 1.1, - 1 ); - setPoint( "u3", 0, h * 2, - 1 ); - - // cross - - setPoint( "cf1", - w, 0, 1 ); - setPoint( "cf2", w, 0, 1 ); - setPoint( "cf3", 0, - h, 1 ); - setPoint( "cf4", 0, h, 1 ); - - setPoint( "cn1", - w, 0, - 1 ); - setPoint( "cn2", w, 0, - 1 ); - setPoint( "cn3", 0, - h, - 1 ); - setPoint( "cn4", 0, h, - 1 ); - - geometry.getAttribute( 'position' ).needsUpdate = true; - - }; - -}(); - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function BoxHelper( object, color ) { - - if ( color === undefined ) color = 0xffff00; - - var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] ); - var positions = new Float32Array( 8 * 3 ); - - var geometry = new BufferGeometry(); - geometry.setIndex( new BufferAttribute( indices, 1 ) ); - geometry.addAttribute( 'position', new BufferAttribute( positions, 3 ) ); - - LineSegments.call( this, geometry, new LineBasicMaterial( { color: color } ) ); - - if ( object !== undefined ) { - - this.update( object ); - - } - -} - -BoxHelper.prototype = Object.create( LineSegments.prototype ); -BoxHelper.prototype.constructor = BoxHelper; - -BoxHelper.prototype.update = ( function () { - - var box = new Box3(); - - return function update( object ) { - - if ( object && object.isBox3 ) { - - box.copy( object ); - - } else { - - box.setFromObject( object ); - - } - - if ( box.isEmpty() ) return; - - var min = box.min; - var max = box.max; - - /* - 5____4 - 1/___0/| - | 6__|_7 - 2/___3/ - - 0: max.x, max.y, max.z - 1: min.x, max.y, max.z - 2: min.x, min.y, max.z - 3: max.x, min.y, max.z - 4: max.x, max.y, min.z - 5: min.x, max.y, min.z - 6: min.x, min.y, min.z - 7: max.x, min.y, min.z - */ - - var position = this.geometry.attributes.position; - var array = position.array; - - array[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z; - array[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z; - array[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z; - array[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z; - array[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z; - array[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z; - array[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z; - array[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z; - - position.needsUpdate = true; - - this.geometry.computeBoundingSphere(); - - }; - -} )(); - -/** - * @author WestLangley / http://github.com/WestLangley - * @author zz85 / http://github.com/zz85 - * @author bhouston / http://clara.io - * - * Creates an arrow for visualizing directions - * - * Parameters: - * dir - Vector3 - * origin - Vector3 - * length - Number - * color - color in hex value - * headLength - Number - * headWidth - Number - */ - -var lineGeometry = new BufferGeometry(); -lineGeometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) ); - -var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 ); -coneGeometry.translate( 0, - 0.5, 0 ); - -function ArrowHelper( dir, origin, length, color, headLength, headWidth ) { - - // dir is assumed to be normalized - - Object3D.call( this ); - - if ( color === undefined ) color = 0xffff00; - if ( length === undefined ) length = 1; - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; - - this.position.copy( origin ); - - this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) ); - this.line.matrixAutoUpdate = false; - this.add( this.line ); - - this.cone = new Mesh( coneGeometry, new MeshBasicMaterial( { color: color } ) ); - this.cone.matrixAutoUpdate = false; - this.add( this.cone ); - - this.setDirection( dir ); - this.setLength( length, headLength, headWidth ); - -} - -ArrowHelper.prototype = Object.create( Object3D.prototype ); -ArrowHelper.prototype.constructor = ArrowHelper; - -ArrowHelper.prototype.setDirection = ( function () { - - var axis = new Vector3(); - var radians; - - return function setDirection( dir ) { - - // dir is assumed to be normalized - - if ( dir.y > 0.99999 ) { - - this.quaternion.set( 0, 0, 0, 1 ); - - } else if ( dir.y < - 0.99999 ) { - - this.quaternion.set( 1, 0, 0, 0 ); - - } else { - - axis.set( dir.z, 0, - dir.x ).normalize(); - - radians = Math.acos( dir.y ); - - this.quaternion.setFromAxisAngle( axis, radians ); - - } - - }; - -}() ); - -ArrowHelper.prototype.setLength = function ( length, headLength, headWidth ) { - - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; - - this.line.scale.set( 1, Math.max( 0, length - headLength ), 1 ); - this.line.updateMatrix(); - - this.cone.scale.set( headWidth, headLength, headWidth ); - this.cone.position.y = length; - this.cone.updateMatrix(); - -}; - -ArrowHelper.prototype.setColor = function ( color ) { - - this.line.material.color.copy( color ); - this.cone.material.color.copy( color ); - -}; - -/** - * @author sroucheray / http://sroucheray.org/ - * @author mrdoob / http://mrdoob.com/ - */ - -function AxisHelper( size ) { - - size = size || 1; - - var vertices = [ - 0, 0, 0, size, 0, 0, - 0, 0, 0, 0, size, 0, - 0, 0, 0, 0, 0, size - ]; - - var colors = [ - 1, 0, 0, 1, 0.6, 0, - 0, 1, 0, 0.6, 1, 0, - 0, 0, 1, 0, 0.6, 1 - ]; - - var geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); - - var material = new LineBasicMaterial( { vertexColors: VertexColors } ); - - LineSegments.call( this, geometry, material ); - -} - -AxisHelper.prototype = Object.create( LineSegments.prototype ); -AxisHelper.prototype.constructor = AxisHelper; - -/** - * @author zz85 https://github.com/zz85 - * - * Centripetal CatmullRom Curve - which is useful for avoiding - * cusps and self-intersections in non-uniform catmull rom curves. - * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf - * - * curve.type accepts centripetal(default), chordal and catmullrom - * curve.tension is used for catmullrom which defaults to 0.5 - */ - -var CatmullRomCurve3 = ( function() { - - var - tmp = new Vector3(), - px = new CubicPoly(), - py = new CubicPoly(), - pz = new CubicPoly(); - - /* - Based on an optimized c++ solution in - - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/ - - http://ideone.com/NoEbVM - - This CubicPoly class could be used for reusing some variables and calculations, - but for three.js curve use, it could be possible inlined and flatten into a single function call - which can be placed in CurveUtils. - */ - - function CubicPoly() {} - - /* - * Compute coefficients for a cubic polynomial - * p(s) = c0 + c1*s + c2*s^2 + c3*s^3 - * such that - * p(0) = x0, p(1) = x1 - * and - * p'(0) = t0, p'(1) = t1. - */ - CubicPoly.prototype.init = function( x0, x1, t0, t1 ) { - - this.c0 = x0; - this.c1 = t0; - this.c2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1; - this.c3 = 2 * x0 - 2 * x1 + t0 + t1; - - }; - - CubicPoly.prototype.initNonuniformCatmullRom = function( x0, x1, x2, x3, dt0, dt1, dt2 ) { - - // compute tangents when parameterized in [t1,t2] - var t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1; - var t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2; - - // rescale tangents for parametrization in [0,1] - t1 *= dt1; - t2 *= dt1; - - // initCubicPoly - this.init( x1, x2, t1, t2 ); - - }; - - // standard Catmull-Rom spline: interpolate between x1 and x2 with previous/following points x1/x4 - CubicPoly.prototype.initCatmullRom = function( x0, x1, x2, x3, tension ) { - - this.init( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) ); - - }; - - CubicPoly.prototype.calc = function( t ) { - - var t2 = t * t; - var t3 = t2 * t; - return this.c0 + this.c1 * t + this.c2 * t2 + this.c3 * t3; - - }; - - // Subclass Three.js curve - return Curve.create( - - function ( p /* array of Vector3 */ ) { - - this.points = p || []; - this.closed = false; - - }, - - function ( t ) { - - var points = this.points, - point, intPoint, weight, l; - - l = points.length; - - if ( l < 2 ) console.log( 'duh, you need at least 2 points' ); - - point = ( l - ( this.closed ? 0 : 1 ) ) * t; - intPoint = Math.floor( point ); - weight = point - intPoint; - - if ( this.closed ) { - - intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length; - - } else if ( weight === 0 && intPoint === l - 1 ) { - - intPoint = l - 2; - weight = 1; - - } - - var p0, p1, p2, p3; // 4 points - - if ( this.closed || intPoint > 0 ) { - - p0 = points[ ( intPoint - 1 ) % l ]; - - } else { - - // extrapolate first point - tmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] ); - p0 = tmp; - - } - - p1 = points[ intPoint % l ]; - p2 = points[ ( intPoint + 1 ) % l ]; - - if ( this.closed || intPoint + 2 < l ) { - - p3 = points[ ( intPoint + 2 ) % l ]; - - } else { - - // extrapolate last point - tmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] ); - p3 = tmp; - - } - - if ( this.type === undefined || this.type === 'centripetal' || this.type === 'chordal' ) { - - // init Centripetal / Chordal Catmull-Rom - var pow = this.type === 'chordal' ? 0.5 : 0.25; - var dt0 = Math.pow( p0.distanceToSquared( p1 ), pow ); - var dt1 = Math.pow( p1.distanceToSquared( p2 ), pow ); - var dt2 = Math.pow( p2.distanceToSquared( p3 ), pow ); - - // safety check for repeated points - if ( dt1 < 1e-4 ) dt1 = 1.0; - if ( dt0 < 1e-4 ) dt0 = dt1; - if ( dt2 < 1e-4 ) dt2 = dt1; - - px.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 ); - py.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 ); - pz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 ); - - } else if ( this.type === 'catmullrom' ) { - - var tension = this.tension !== undefined ? this.tension : 0.5; - px.initCatmullRom( p0.x, p1.x, p2.x, p3.x, tension ); - py.initCatmullRom( p0.y, p1.y, p2.y, p3.y, tension ); - pz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, tension ); - - } - - var v = new Vector3( - px.calc( weight ), - py.calc( weight ), - pz.calc( weight ) - ); - - return v; - - } - - ); - -} )(); - -/************************************************************** - * Spline 3D curve - **************************************************************/ - - -var SplineCurve3 = Curve.create( - - function ( points /* array of Vector3 */ ) { - - console.warn( 'THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3' ); - this.points = ( points === undefined ) ? [] : points; - - }, - - function ( t ) { - - var points = this.points; - var point = ( points.length - 1 ) * t; - - var intPoint = Math.floor( point ); - var weight = point - intPoint; - - var point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ]; - var point1 = points[ intPoint ]; - var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ]; - var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ]; - - var interpolate = CurveUtils.interpolate; - - return new Vector3( - interpolate( point0.x, point1.x, point2.x, point3.x, weight ), - interpolate( point0.y, point1.y, point2.y, point3.y, weight ), - interpolate( point0.z, point1.z, point2.z, point3.z, weight ) - ); - - } - -); - -/************************************************************** - * Cubic Bezier 3D curve - **************************************************************/ - -var CubicBezierCurve3 = Curve.create( - - function ( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - }, - - function ( t ) { - - var b3 = ShapeUtils.b3; - - return new Vector3( - b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ), - b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ), - b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z ) - ); - - } - -); - -/************************************************************** - * Quadratic Bezier 3D curve - **************************************************************/ - -var QuadraticBezierCurve3 = Curve.create( - - function ( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - var b2 = ShapeUtils.b2; - - return new Vector3( - b2( t, this.v0.x, this.v1.x, this.v2.x ), - b2( t, this.v0.y, this.v1.y, this.v2.y ), - b2( t, this.v0.z, this.v1.z, this.v2.z ) - ); - - } - -); - -/************************************************************** - * Line3D - **************************************************************/ - -var LineCurve3 = Curve.create( - - function ( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - if ( t === 1 ) { - - return this.v2.clone(); - - } - - var vector = new Vector3(); - - vector.subVectors( this.v2, this.v1 ); // diff - vector.multiplyScalar( t ); - vector.add( this.v1 ); - - return vector; - - } - -); - -/************************************************************** - * Arc curve - **************************************************************/ - -function ArcCurve( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); - -} - -ArcCurve.prototype = Object.create( EllipseCurve.prototype ); -ArcCurve.prototype.constructor = ArcCurve; - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -var SceneUtils = { - - createMultiMaterialObject: function ( geometry, materials ) { - - var group = new Group(); - - for ( var i = 0, l = materials.length; i < l; i ++ ) { - - group.add( new Mesh( geometry, materials[ i ] ) ); - - } - - return group; - - }, - - detach: function ( child, parent, scene ) { - - child.applyMatrix( parent.matrixWorld ); - parent.remove( child ); - scene.add( child ); - - }, - - attach: function ( child, scene, parent ) { - - var matrixWorldInverse = new Matrix4(); - matrixWorldInverse.getInverse( parent.matrixWorld ); - child.applyMatrix( matrixWorldInverse ); - - scene.remove( child ); - parent.add( child ); - - } - -}; - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -function Face4( a, b, c, d, normal, color, materialIndex ) { - - console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' ); - return new Face3( a, b, c, normal, color, materialIndex ); - -} - -var LineStrip = 0; - -var LinePieces = 1; - -function MeshFaceMaterial( materials ) { - - console.warn( 'THREE.MeshFaceMaterial has been renamed to THREE.MultiMaterial.' ); - return new MultiMaterial( materials ); - -} - -function PointCloud( geometry, material ) { - - console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' ); - return new Points( geometry, material ); - -} - -function Particle( material ) { - - console.warn( 'THREE.Particle has been renamed to THREE.Sprite.' ); - return new Sprite( material ); - -} - -function ParticleSystem( geometry, material ) { - - console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' ); - return new Points( geometry, material ); - -} - -function PointCloudMaterial( parameters ) { - - console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - -} - -function ParticleBasicMaterial( parameters ) { - - console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - -} - -function ParticleSystemMaterial( parameters ) { - - console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - -} - -function Vertex( x, y, z ) { - - console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' ); - return new Vector3( x, y, z ); - -} - -// - -function DynamicBufferAttribute( array, itemSize ) { - - console.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.' ); - return new BufferAttribute( array, itemSize ).setDynamic( true ); - -} - -function Int8Attribute( array, itemSize ) { - - console.warn( 'THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.' ); - return new Int8BufferAttribute( array, itemSize ); - -} - -function Uint8Attribute( array, itemSize ) { - - console.warn( 'THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.' ); - return new Uint8BufferAttribute( array, itemSize ); - -} - -function Uint8ClampedAttribute( array, itemSize ) { - - console.warn( 'THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.' ); - return new Uint8ClampedBufferAttribute( array, itemSize ); - -} - -function Int16Attribute( array, itemSize ) { - - console.warn( 'THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.' ); - return new Int16BufferAttribute( array, itemSize ); - -} - -function Uint16Attribute( array, itemSize ) { - - console.warn( 'THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.' ); - return new Uint16BufferAttribute( array, itemSize ); - -} - -function Int32Attribute( array, itemSize ) { - - console.warn( 'THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.' ); - return new Int32BufferAttribute( array, itemSize ); - -} - -function Uint32Attribute( array, itemSize ) { - - console.warn( 'THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.' ); - return new Uint32BufferAttribute( array, itemSize ); - -} - -function Float32Attribute( array, itemSize ) { - - console.warn( 'THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.' ); - return new Float32BufferAttribute( array, itemSize ); - -} - -function Float64Attribute( array, itemSize ) { - - console.warn( 'THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.' ); - return new Float64BufferAttribute( array, itemSize ); - -} - -// - -function ClosedSplineCurve3( points ) { - - console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' ); - - CatmullRomCurve3.call( this, points ); - this.type = 'catmullrom'; - this.closed = true; - -} - -ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype ); - - -// -function BoundingBoxHelper( object, color ) { - - console.warn( 'THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.' ); - return new BoxHelper( object, color ); - -} - -function EdgesHelper( object, hex ) { - - console.warn( 'THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.' ); - return new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) ); - -} - -GridHelper.prototype.setColors = function () { - - console.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' ); - -}; - -function WireframeHelper( object, hex ) { - - console.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' ); - return new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) ); - -} - -// - -function XHRLoader( manager ) { - - console.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' ); - return new FileLoader( manager ); - -} - -// - -Object.assign( Box2.prototype, { - - center: function ( optionalTarget ) { - - console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - - }, - empty: function () { - - console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' ); - return this.isEmpty(); - - }, - isIntersectionBox: function ( box ) { - - console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - - }, - size: function ( optionalTarget ) { - - console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' ); - return this.getSize( optionalTarget ); - - } -} ); - -Object.assign( Box3.prototype, { - - center: function ( optionalTarget ) { - - console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - - }, - empty: function () { - - console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' ); - return this.isEmpty(); - - }, - isIntersectionBox: function ( box ) { - - console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - - }, - isIntersectionSphere: function ( sphere ) { - - console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' ); - return this.intersectsSphere( sphere ); - - }, - size: function ( optionalTarget ) { - - console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' ); - return this.getSize( optionalTarget ); - - } -} ); - -Line3.prototype.center = function ( optionalTarget ) { - - console.warn( 'THREE.Line3: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - -}; - -_Math.random16 = function () { - - console.warn( 'THREE.Math.random16() has been deprecated. Use Math.random() instead.' ); - return Math.random(); - -}; - -Object.assign( Matrix3.prototype, { - - flattenToArrayOffset: function ( array, offset ) { - - console.warn( "THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." ); - return this.toArray( array, offset ); - - }, - multiplyVector3: function ( vector ) { - - console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' ); - return vector.applyMatrix3( this ); - - }, - multiplyVector3Array: function ( a ) { - - console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' ); - return this.applyToVector3Array( a ); - - } - -} ); - -Object.assign( Matrix4.prototype, { - - extractPosition: function ( m ) { - - console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' ); - return this.copyPosition( m ); - - }, - flattenToArrayOffset: function ( array, offset ) { - - console.warn( "THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." ); - return this.toArray( array, offset ); - - }, - getPosition: function () { - - var v1; - - return function getPosition() { - - if ( v1 === undefined ) v1 = new Vector3(); - console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' ); - return v1.setFromMatrixColumn( this, 3 ); - - }; - - }(), - setRotationFromQuaternion: function ( q ) { - - console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' ); - return this.makeRotationFromQuaternion( q ); - - }, - multiplyVector3: function ( vector ) { - - console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' ); - return vector.applyProjection( this ); - - }, - multiplyVector4: function ( vector ) { - - console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - - }, - multiplyVector3Array: function ( a ) { - - console.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' ); - return this.applyToVector3Array( a ); - - }, - rotateAxis: function ( v ) { - - console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' ); - v.transformDirection( this ); - - }, - crossVector: function ( vector ) { - - console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - - }, - translate: function () { - - console.error( 'THREE.Matrix4: .translate() has been removed.' ); - - }, - rotateX: function () { - - console.error( 'THREE.Matrix4: .rotateX() has been removed.' ); - - }, - rotateY: function () { - - console.error( 'THREE.Matrix4: .rotateY() has been removed.' ); - - }, - rotateZ: function () { - - console.error( 'THREE.Matrix4: .rotateZ() has been removed.' ); - - }, - rotateByAxis: function () { - - console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' ); - - } - -} ); - -Plane.prototype.isIntersectionLine = function ( line ) { - - console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' ); - return this.intersectsLine( line ); - -}; - -Quaternion.prototype.multiplyVector3 = function ( vector ) { - - console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' ); - return vector.applyQuaternion( this ); - -}; - -Object.assign( Ray.prototype, { - - isIntersectionBox: function ( box ) { - - console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - - }, - isIntersectionPlane: function ( plane ) { - - console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' ); - return this.intersectsPlane( plane ); - - }, - isIntersectionSphere: function ( sphere ) { - - console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' ); - return this.intersectsSphere( sphere ); - - } - -} ); - -Object.assign( Shape.prototype, { - - extrude: function ( options ) { - - console.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' ); - return new ExtrudeGeometry( this, options ); - - }, - makeGeometry: function ( options ) { - - console.warn( 'THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.' ); - return new ShapeGeometry( this, options ); - - } - -} ); - -Object.assign( Vector3.prototype, { - - setEulerFromRotationMatrix: function () { - - console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' ); - - }, - setEulerFromQuaternion: function () { - - console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' ); - - }, - getPositionFromMatrix: function ( m ) { - - console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' ); - return this.setFromMatrixPosition( m ); - - }, - getScaleFromMatrix: function ( m ) { - - console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' ); - return this.setFromMatrixScale( m ); - - }, - getColumnFromMatrix: function ( index, matrix ) { - - console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' ); - return this.setFromMatrixColumn( matrix, index ); - - } - -} ); - -// - -Geometry.prototype.computeTangents = function () { - - console.warn( 'THREE.Geometry: .computeTangents() has been removed.' ); - -}; - -Object.assign( Object3D.prototype, { - - getChildByName: function ( name ) { - - console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' ); - return this.getObjectByName( name ); - - }, - renderDepth: function () { - - console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' ); - - }, - translate: function ( distance, axis ) { - - console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' ); - return this.translateOnAxis( axis, distance ); - - } - -} ); - -Object.defineProperties( Object3D.prototype, { - - eulerOrder: { - get: function () { - - console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' ); - return this.rotation.order; - - }, - set: function ( value ) { - - console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' ); - this.rotation.order = value; - - } - }, - useQuaternion: { - get: function () { - - console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' ); - - }, - set: function () { - - console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' ); - - } - } - -} ); - -Object.defineProperties( LOD.prototype, { - - objects: { - get: function () { - - console.warn( 'THREE.LOD: .objects has been renamed to .levels.' ); - return this.levels; - - } - } - -} ); - -// - -PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) { - - console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " + - "Use .setFocalLength and .filmGauge for a photographic setup." ); - - if ( filmGauge !== undefined ) this.filmGauge = filmGauge; - this.setFocalLength( focalLength ); - -}; - -// - -Object.defineProperties( Light.prototype, { - onlyShadow: { - set: function () { - - console.warn( 'THREE.Light: .onlyShadow has been removed.' ); - - } - }, - shadowCameraFov: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' ); - this.shadow.camera.fov = value; - - } - }, - shadowCameraLeft: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' ); - this.shadow.camera.left = value; - - } - }, - shadowCameraRight: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' ); - this.shadow.camera.right = value; - - } - }, - shadowCameraTop: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' ); - this.shadow.camera.top = value; - - } - }, - shadowCameraBottom: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' ); - this.shadow.camera.bottom = value; - - } - }, - shadowCameraNear: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' ); - this.shadow.camera.near = value; - - } - }, - shadowCameraFar: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' ); - this.shadow.camera.far = value; - - } - }, - shadowCameraVisible: { - set: function () { - - console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' ); - - } - }, - shadowBias: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' ); - this.shadow.bias = value; - - } - }, - shadowDarkness: { - set: function () { - - console.warn( 'THREE.Light: .shadowDarkness has been removed.' ); - - } - }, - shadowMapWidth: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' ); - this.shadow.mapSize.width = value; - - } - }, - shadowMapHeight: { - set: function ( value ) { - - console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' ); - this.shadow.mapSize.height = value; - - } - } -} ); - -// - -Object.defineProperties( BufferAttribute.prototype, { - - length: { - get: function () { - - console.warn( 'THREE.BufferAttribute: .length has been deprecated. Use .count instead.' ); - return this.array.length; - - } - } - -} ); - -Object.assign( BufferGeometry.prototype, { - - addIndex: function ( index ) { - - console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' ); - this.setIndex( index ); - - }, - addDrawCall: function ( start, count, indexOffset ) { - - if ( indexOffset !== undefined ) { - - console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' ); - - } - console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' ); - this.addGroup( start, count ); - - }, - clearDrawCalls: function () { - - console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' ); - this.clearGroups(); - - }, - computeTangents: function () { - - console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' ); - - }, - computeOffsets: function () { - - console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' ); - - } - -} ); - -Object.defineProperties( BufferGeometry.prototype, { - - drawcalls: { - get: function () { - - console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' ); - return this.groups; - - } - }, - offsets: { - get: function () { - - console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' ); - return this.groups; - - } - } - -} ); - -// - -Object.defineProperties( Uniform.prototype, { - - dynamic: { - set: function () { - - console.warn( 'THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.' ); - - } - }, - onUpdate: { - value: function () { - - console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' ); - return this; - - } - } - -} ); - -// - -Object.defineProperties( Material.prototype, { - - wrapAround: { - get: function () { - - console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' ); - - }, - set: function () { - - console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' ); - - } - }, - wrapRGB: { - get: function () { - - console.warn( 'THREE.' + this.type + ': .wrapRGB has been removed.' ); - return new Color(); - - } - } - -} ); - -Object.defineProperties( MeshPhongMaterial.prototype, { - - metal: { - get: function () { - - console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' ); - return false; - - }, - set: function () { - - console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' ); - - } - } - -} ); - -Object.defineProperties( ShaderMaterial.prototype, { - - derivatives: { - get: function () { - - console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' ); - return this.extensions.derivatives; - - }, - set: function ( value ) { - - console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' ); - this.extensions.derivatives = value; - - } - } - -} ); - -// - -EventDispatcher.prototype = Object.assign( Object.create( { - - // Note: Extra base ensures these properties are not 'assign'ed. - - constructor: EventDispatcher, - - apply: function ( target ) { - - console.warn( "THREE.EventDispatcher: .apply is deprecated, " + - "just inherit or Object.assign the prototype to mix-in." ); - - Object.assign( target, this ); - - } - -} ), EventDispatcher.prototype ); - -// - -Object.assign( WebGLRenderer.prototype, { - - supportsFloatTextures: function () { - - console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' ); - return this.extensions.get( 'OES_texture_float' ); - - }, - supportsHalfFloatTextures: function () { - - console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' ); - return this.extensions.get( 'OES_texture_half_float' ); - - }, - supportsStandardDerivatives: function () { - - console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' ); - return this.extensions.get( 'OES_standard_derivatives' ); - - }, - supportsCompressedTextureS3TC: function () { - - console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' ); - return this.extensions.get( 'WEBGL_compressed_texture_s3tc' ); - - }, - supportsCompressedTexturePVRTC: function () { - - console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' ); - return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' ); - - }, - supportsBlendMinMax: function () { - - console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' ); - return this.extensions.get( 'EXT_blend_minmax' ); - - }, - supportsVertexTextures: function () { - - console.warn( 'THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.' ); - return this.capabilities.vertexTextures; - - }, - supportsInstancedArrays: function () { - - console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' ); - return this.extensions.get( 'ANGLE_instanced_arrays' ); - - }, - enableScissorTest: function ( boolean ) { - - console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' ); - this.setScissorTest( boolean ); - - }, - initMaterial: function () { - - console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' ); - - }, - addPrePlugin: function () { - - console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' ); - - }, - addPostPlugin: function () { - - console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' ); - - }, - updateShadowMap: function () { - - console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' ); - - } - -} ); - -Object.defineProperties( WebGLRenderer.prototype, { - - shadowMapEnabled: { - get: function () { - - return this.shadowMap.enabled; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' ); - this.shadowMap.enabled = value; - - } - }, - shadowMapType: { - get: function () { - - return this.shadowMap.type; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' ); - this.shadowMap.type = value; - - } - }, - shadowMapCullFace: { - get: function () { - - return this.shadowMap.cullFace; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.' ); - this.shadowMap.cullFace = value; - - } - } -} ); - -Object.defineProperties( WebGLShadowMap.prototype, { - - cullFace: { - get: function () { - - return this.renderReverseSided ? CullFaceFront : CullFaceBack; - - }, - set: function ( cullFace ) { - - var value = ( cullFace !== CullFaceBack ); - console.warn( "WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to " + value + "." ); - this.renderReverseSided = value; - - } - } - -} ); - -// - -Object.defineProperties( WebGLRenderTarget.prototype, { - - wrapS: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' ); - return this.texture.wrapS; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' ); - this.texture.wrapS = value; - - } - }, - wrapT: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' ); - return this.texture.wrapT; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' ); - this.texture.wrapT = value; - - } - }, - magFilter: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' ); - return this.texture.magFilter; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' ); - this.texture.magFilter = value; - - } - }, - minFilter: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' ); - return this.texture.minFilter; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' ); - this.texture.minFilter = value; - - } - }, - anisotropy: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' ); - return this.texture.anisotropy; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' ); - this.texture.anisotropy = value; - - } - }, - offset: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' ); - return this.texture.offset; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' ); - this.texture.offset = value; - - } - }, - repeat: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' ); - return this.texture.repeat; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' ); - this.texture.repeat = value; - - } - }, - format: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' ); - return this.texture.format; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' ); - this.texture.format = value; - - } - }, - type: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' ); - return this.texture.type; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' ); - this.texture.type = value; - - } - }, - generateMipmaps: { - get: function () { - - console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' ); - return this.texture.generateMipmaps; - - }, - set: function ( value ) { - - console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' ); - this.texture.generateMipmaps = value; - - } - } - -} ); - -// - -Audio.prototype.load = function ( file ) { - - console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' ); - var scope = this; - var audioLoader = new AudioLoader(); - audioLoader.load( file, function ( buffer ) { - - scope.setBuffer( buffer ); - - } ); - return this; - -}; - -AudioAnalyser.prototype.getData = function () { - - console.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' ); - return this.getFrequencyData(); - -}; - -// - -var GeometryUtils = { - - merge: function ( geometry1, geometry2, materialIndexOffset ) { - - console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' ); - var matrix; - - if ( geometry2.isMesh ) { - - geometry2.matrixAutoUpdate && geometry2.updateMatrix(); - - matrix = geometry2.matrix; - geometry2 = geometry2.geometry; - - } - - geometry1.merge( geometry2, matrix, materialIndexOffset ); - - }, - - center: function ( geometry ) { - - console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' ); - return geometry.center(); - - } - -}; - -var ImageUtils = { - - crossOrigin: undefined, - - loadTexture: function ( url, mapping, onLoad, onError ) { - - console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' ); - - var loader = new TextureLoader(); - loader.setCrossOrigin( this.crossOrigin ); - - var texture = loader.load( url, onLoad, undefined, onError ); - - if ( mapping ) texture.mapping = mapping; - - return texture; - - }, - - loadTextureCube: function ( urls, mapping, onLoad, onError ) { - - console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' ); - - var loader = new CubeTextureLoader(); - loader.setCrossOrigin( this.crossOrigin ); - - var texture = loader.load( urls, onLoad, undefined, onError ); - - if ( mapping ) texture.mapping = mapping; - - return texture; - - }, - - loadCompressedTexture: function () { - - console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' ); - - }, - - loadCompressedTextureCube: function () { - - console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' ); - - } - -}; - -var UniformsUtils = { - - merge: function ( uniforms ) { - - console.warn( 'THREE.UniformsUtils.merge() has been deprecated. Use Object.assign() instead.' ); - - var merged = {}; - - for ( var u = 0; u < uniforms.length; u ++ ) { - - var tmp = this.clone( uniforms[ u ] ); - - for ( var p in tmp ) { - - merged[ p ] = tmp[ p ]; - - } - - } - - return merged; - - }, - - clone: function ( uniforms_src ) { - - console.warn( 'THREE.UniformsUtils.clone() has been deprecated.' ); - - var uniforms_dst = {}; - - for ( var u in uniforms_src ) { - - uniforms_dst[ u ] = {}; - - for ( var p in uniforms_src[ u ] ) { - - var parameter_src = uniforms_src[ u ][ p ]; - - if ( parameter_src && ( parameter_src.isColor || - parameter_src.isMatrix3 || parameter_src.isMatrix4 || - parameter_src.isVector2 || parameter_src.isVector3 || parameter_src.isVector4 || - parameter_src.isTexture ) ) { - - uniforms_dst[ u ][ p ] = parameter_src.clone(); - - } else if ( Array.isArray( parameter_src ) ) { - - uniforms_dst[ u ][ p ] = parameter_src.slice(); - - } else { - - uniforms_dst[ u ][ p ] = parameter_src; - - } - - } - - } - - return uniforms_dst; - - } - -}; - -// - -function Projector() { - - console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' ); - - this.projectVector = function ( vector, camera ) { - - console.warn( 'THREE.Projector: .projectVector() is now vector.project().' ); - vector.project( camera ); - - }; - - this.unprojectVector = function ( vector, camera ) { - - console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' ); - vector.unproject( camera ); - - }; - - this.pickingRay = function () { - - console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' ); - - }; - -} - -// - -function CanvasRenderer() { - - console.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' ); - - this.domElement = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - this.clear = function () {}; - this.render = function () {}; - this.setClearColor = function () {}; - this.setSize = function () {}; - -} - -export { WebGLRenderTargetCube, WebGLRenderTarget, WebGLRenderer, ShaderLib, UniformsLib, ShaderChunk, FogExp2, Fog, Scene, LensFlare, Sprite, LOD, SkinnedMesh, Skeleton, Bone, Mesh, LineSegments, Line, Points, Group, VideoTexture, DataTexture, CompressedTexture, CubeTexture, CanvasTexture, DepthTexture, Texture, CompressedTextureLoader, BinaryTextureLoader, DataTextureLoader, CubeTextureLoader, TextureLoader, ObjectLoader, MaterialLoader, BufferGeometryLoader, DefaultLoadingManager, LoadingManager, JSONLoader, ImageLoader, FontLoader, FileLoader, Loader, Cache, AudioLoader, SpotLightShadow, SpotLight, PointLight, RectAreaLight, HemisphereLight, DirectionalLightShadow, DirectionalLight, AmbientLight, LightShadow, Light, StereoCamera, PerspectiveCamera, OrthographicCamera, CubeCamera, Camera, AudioListener, PositionalAudio, AudioContext, AudioAnalyser, Audio, VectorKeyframeTrack, StringKeyframeTrack, QuaternionKeyframeTrack, NumberKeyframeTrack, ColorKeyframeTrack, BooleanKeyframeTrack, PropertyMixer, PropertyBinding, KeyframeTrack, AnimationUtils, AnimationObjectGroup, AnimationMixer, AnimationClip, Uniform, InstancedBufferGeometry, BufferGeometry, GeometryIdCount, Geometry, InterleavedBufferAttribute, InstancedInterleavedBuffer, InterleavedBuffer, InstancedBufferAttribute, Face3, Object3D, Raycaster, Layers, EventDispatcher, Clock, QuaternionLinearInterpolant, LinearInterpolant, DiscreteInterpolant, CubicInterpolant, Interpolant, Triangle, Spline, _Math as Math, Spherical, Plane, Frustum, Sphere, Ray, Matrix4, Matrix3, Box3, Box2, Line3, Euler, Vector4, Vector3, Vector2, Quaternion, Color, MorphBlendMesh, ImmediateRenderObject, VertexNormalsHelper, SpotLightHelper, SkeletonHelper, PointLightHelper, RectAreaLightHelper, HemisphereLightHelper, GridHelper, PolarGridHelper, FaceNormalsHelper, DirectionalLightHelper, CameraHelper, BoxHelper, ArrowHelper, AxisHelper, CatmullRomCurve3, SplineCurve3, CubicBezierCurve3, QuadraticBezierCurve3, LineCurve3, ArcCurve, EllipseCurve, SplineCurve, CubicBezierCurve, QuadraticBezierCurve, LineCurve, Shape, ShapePath, Path, Font, CurvePath, Curve, ShapeUtils, SceneUtils, CurveUtils, WireframeGeometry, ParametricGeometry, ParametricBufferGeometry, TetrahedronGeometry, TetrahedronBufferGeometry, OctahedronGeometry, OctahedronBufferGeometry, IcosahedronGeometry, IcosahedronBufferGeometry, DodecahedronGeometry, DodecahedronBufferGeometry, PolyhedronGeometry, PolyhedronBufferGeometry, TubeGeometry, TubeBufferGeometry, TorusKnotGeometry, TorusKnotBufferGeometry, TorusGeometry, TorusBufferGeometry, TextGeometry, SphereBufferGeometry, SphereGeometry, RingGeometry, RingBufferGeometry, PlaneBufferGeometry, PlaneGeometry, LatheGeometry, LatheBufferGeometry, ShapeGeometry, ShapeBufferGeometry, ExtrudeGeometry, EdgesGeometry, ConeGeometry, ConeBufferGeometry, CylinderGeometry, CylinderBufferGeometry, CircleBufferGeometry, CircleGeometry, BoxBufferGeometry, BoxGeometry, ShadowMaterial, SpriteMaterial, RawShaderMaterial, ShaderMaterial, PointsMaterial, MultiMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshPhongMaterial, MeshToonMaterial, MeshNormalMaterial, MeshLambertMaterial, MeshDepthMaterial, MeshBasicMaterial, LineDashedMaterial, LineBasicMaterial, Material, Float64BufferAttribute, Float32BufferAttribute, Uint32BufferAttribute, Int32BufferAttribute, Uint16BufferAttribute, Int16BufferAttribute, Uint8ClampedBufferAttribute, Uint8BufferAttribute, Int8BufferAttribute, BufferAttribute, REVISION, MOUSE, CullFaceNone, CullFaceBack, CullFaceFront, CullFaceFrontBack, FrontFaceDirectionCW, FrontFaceDirectionCCW, BasicShadowMap, PCFShadowMap, PCFSoftShadowMap, FrontSide, BackSide, DoubleSide, FlatShading, SmoothShading, NoColors, FaceColors, VertexColors, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, BlendingMode, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, SrcAlphaSaturateFactor, NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth, MultiplyOperation, MixOperation, AddOperation, NoToneMapping, LinearToneMapping, ReinhardToneMapping, Uncharted2ToneMapping, CineonToneMapping, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, SphericalReflectionMapping, CubeUVReflectionMapping, CubeUVRefractionMapping, TextureMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, TextureWrapping, NearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter, LinearFilter, LinearMipMapNearestFilter, LinearMipMapLinearFilter, TextureFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedInt248Type, AlphaFormat, RGBFormat, RGBAFormat, LuminanceFormat, LuminanceAlphaFormat, RGBEFormat, DepthFormat, DepthStencilFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, LoopOnce, LoopRepeat, LoopPingPong, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, LinearEncoding, sRGBEncoding, GammaEncoding, RGBEEncoding, LogLuvEncoding, RGBM7Encoding, RGBM16Encoding, RGBDEncoding, BasicDepthPacking, RGBADepthPacking, BoxGeometry as CubeGeometry, Face4, LineStrip, LinePieces, MeshFaceMaterial, PointCloud, Particle, ParticleSystem, PointCloudMaterial, ParticleBasicMaterial, ParticleSystemMaterial, Vertex, DynamicBufferAttribute, Int8Attribute, Uint8Attribute, Uint8ClampedAttribute, Int16Attribute, Uint16Attribute, Int32Attribute, Uint32Attribute, Float32Attribute, Float64Attribute, ClosedSplineCurve3, BoundingBoxHelper, EdgesHelper, WireframeHelper, XHRLoader, GeometryUtils, ImageUtils, UniformsUtils, Projector, CanvasRenderer }; diff --git a/libs/three.js/r71/three.js b/libs/three.js/r71/three.js deleted file mode 100644 index aca8c230..00000000 --- a/libs/three.js/r71/three.js +++ /dev/null @@ -1,35133 +0,0 @@ -// File:src/Three.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -var THREE = { REVISION: '71' }; - -// browserify support - -if ( typeof module === 'object' ) { - - module.exports = THREE; - -} - -// polyfills - -if ( Math.sign === undefined ) { - - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign - - Math.sign = function ( x ) { - - return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : +x; - - }; - -} - - -// set the default log handlers -THREE.log = function() { console.log.apply( console, arguments ); } -THREE.warn = function() { console.warn.apply( console, arguments ); } -THREE.error = function() { console.error.apply( console, arguments ); } - - -// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button - -THREE.MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 }; - -// GL STATE CONSTANTS - -THREE.CullFaceNone = 0; -THREE.CullFaceBack = 1; -THREE.CullFaceFront = 2; -THREE.CullFaceFrontBack = 3; - -THREE.FrontFaceDirectionCW = 0; -THREE.FrontFaceDirectionCCW = 1; - -// SHADOWING TYPES - -THREE.BasicShadowMap = 0; -THREE.PCFShadowMap = 1; -THREE.PCFSoftShadowMap = 2; - -// MATERIAL CONSTANTS - -// side - -THREE.FrontSide = 0; -THREE.BackSide = 1; -THREE.DoubleSide = 2; - -// shading - -THREE.NoShading = 0; -THREE.FlatShading = 1; -THREE.SmoothShading = 2; - -// colors - -THREE.NoColors = 0; -THREE.FaceColors = 1; -THREE.VertexColors = 2; - -// blending modes - -THREE.NoBlending = 0; -THREE.NormalBlending = 1; -THREE.AdditiveBlending = 2; -THREE.SubtractiveBlending = 3; -THREE.MultiplyBlending = 4; -THREE.CustomBlending = 5; - -// custom blending equations -// (numbers start from 100 not to clash with other -// mappings to OpenGL constants defined in Texture.js) - -THREE.AddEquation = 100; -THREE.SubtractEquation = 101; -THREE.ReverseSubtractEquation = 102; -THREE.MinEquation = 103; -THREE.MaxEquation = 104; - -// custom blending destination factors - -THREE.ZeroFactor = 200; -THREE.OneFactor = 201; -THREE.SrcColorFactor = 202; -THREE.OneMinusSrcColorFactor = 203; -THREE.SrcAlphaFactor = 204; -THREE.OneMinusSrcAlphaFactor = 205; -THREE.DstAlphaFactor = 206; -THREE.OneMinusDstAlphaFactor = 207; - -// custom blending source factors - -//THREE.ZeroFactor = 200; -//THREE.OneFactor = 201; -//THREE.SrcAlphaFactor = 204; -//THREE.OneMinusSrcAlphaFactor = 205; -//THREE.DstAlphaFactor = 206; -//THREE.OneMinusDstAlphaFactor = 207; -THREE.DstColorFactor = 208; -THREE.OneMinusDstColorFactor = 209; -THREE.SrcAlphaSaturateFactor = 210; - - -// TEXTURE CONSTANTS - -THREE.MultiplyOperation = 0; -THREE.MixOperation = 1; -THREE.AddOperation = 2; - -// Mapping modes - -THREE.UVMapping = 300; - -THREE.CubeReflectionMapping = 301; -THREE.CubeRefractionMapping = 302; - -THREE.EquirectangularReflectionMapping = 303; -THREE.EquirectangularRefractionMapping = 304; - -THREE.SphericalReflectionMapping = 305; - -// Wrapping modes - -THREE.RepeatWrapping = 1000; -THREE.ClampToEdgeWrapping = 1001; -THREE.MirroredRepeatWrapping = 1002; - -// Filters - -THREE.NearestFilter = 1003; -THREE.NearestMipMapNearestFilter = 1004; -THREE.NearestMipMapLinearFilter = 1005; -THREE.LinearFilter = 1006; -THREE.LinearMipMapNearestFilter = 1007; -THREE.LinearMipMapLinearFilter = 1008; - -// Data types - -THREE.UnsignedByteType = 1009; -THREE.ByteType = 1010; -THREE.ShortType = 1011; -THREE.UnsignedShortType = 1012; -THREE.IntType = 1013; -THREE.UnsignedIntType = 1014; -THREE.FloatType = 1015; -THREE.HalfFloatType = 1025; - -// Pixel types - -//THREE.UnsignedByteType = 1009; -THREE.UnsignedShort4444Type = 1016; -THREE.UnsignedShort5551Type = 1017; -THREE.UnsignedShort565Type = 1018; - -// Pixel formats - -THREE.AlphaFormat = 1019; -THREE.RGBFormat = 1020; -THREE.RGBAFormat = 1021; -THREE.LuminanceFormat = 1022; -THREE.LuminanceAlphaFormat = 1023; -// THREE.RGBEFormat handled as THREE.RGBAFormat in shaders -THREE.RGBEFormat = THREE.RGBAFormat; //1024; - -// DDS / ST3C Compressed texture formats - -THREE.RGB_S3TC_DXT1_Format = 2001; -THREE.RGBA_S3TC_DXT1_Format = 2002; -THREE.RGBA_S3TC_DXT3_Format = 2003; -THREE.RGBA_S3TC_DXT5_Format = 2004; - - -// PVRTC compressed texture formats - -THREE.RGB_PVRTC_4BPPV1_Format = 2100; -THREE.RGB_PVRTC_2BPPV1_Format = 2101; -THREE.RGBA_PVRTC_4BPPV1_Format = 2102; -THREE.RGBA_PVRTC_2BPPV1_Format = 2103; - - -// DEPRECATED - -THREE.Projector = function () { - - THREE.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' ); - - this.projectVector = function ( vector, camera ) { - - THREE.warn( 'THREE.Projector: .projectVector() is now vector.project().' ); - vector.project( camera ); - - }; - - this.unprojectVector = function ( vector, camera ) { - - THREE.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' ); - vector.unproject( camera ); - - }; - - this.pickingRay = function ( vector, camera ) { - - THREE.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' ); - - }; - -}; - -THREE.CanvasRenderer = function () { - - THREE.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' ); - - this.domElement = document.createElement( 'canvas' ); - this.clear = function () {}; - this.render = function () {}; - this.setClearColor = function () {}; - this.setSize = function () {}; - -}; - -// File:src/math/Color.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Color = function ( color ) { - - if ( arguments.length === 3 ) { - - return this.setRGB( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] ); - - } - - return this.set( color ) - -}; - -THREE.Color.prototype = { - - constructor: THREE.Color, - - r: 1, g: 1, b: 1, - - set: function ( value ) { - - if ( value instanceof THREE.Color ) { - - this.copy( value ); - - } else if ( typeof value === 'number' ) { - - this.setHex( value ); - - } else if ( typeof value === 'string' ) { - - this.setStyle( value ); - - } - - return this; - - }, - - setHex: function ( hex ) { - - hex = Math.floor( hex ); - - this.r = ( hex >> 16 & 255 ) / 255; - this.g = ( hex >> 8 & 255 ) / 255; - this.b = ( hex & 255 ) / 255; - - return this; - - }, - - setRGB: function ( r, g, b ) { - - this.r = r; - this.g = g; - this.b = b; - - return this; - - }, - - setHSL: function ( h, s, l ) { - - // h,s,l ranges are in 0.0 - 1.0 - - if ( s === 0 ) { - - this.r = this.g = this.b = l; - - } else { - - var hue2rgb = function ( p, q, t ) { - - if ( t < 0 ) t += 1; - if ( t > 1 ) t -= 1; - if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t; - if ( t < 1 / 2 ) return q; - if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t ); - return p; - - }; - - var p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s ); - var q = ( 2 * l ) - p; - - this.r = hue2rgb( q, p, h + 1 / 3 ); - this.g = hue2rgb( q, p, h ); - this.b = hue2rgb( q, p, h - 1 / 3 ); - - } - - return this; - - }, - - setStyle: function ( style ) { - - // rgb(255,0,0) - - if ( /^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test( style ) ) { - - var color = /^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec( style ); - - this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255; - this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255; - this.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255; - - return this; - - } - - // rgb(100%,0%,0%) - - if ( /^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test( style ) ) { - - var color = /^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec( style ); - - this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100; - this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100; - this.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100; - - return this; - - } - - // #ff0000 - - if ( /^\#([0-9a-f]{6})$/i.test( style ) ) { - - var color = /^\#([0-9a-f]{6})$/i.exec( style ); - - this.setHex( parseInt( color[ 1 ], 16 ) ); - - return this; - - } - - // #f00 - - if ( /^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test( style ) ) { - - var color = /^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec( style ); - - this.setHex( parseInt( color[ 1 ] + color[ 1 ] + color[ 2 ] + color[ 2 ] + color[ 3 ] + color[ 3 ], 16 ) ); - - return this; - - } - - // red - - if ( /^(\w+)$/i.test( style ) ) { - - this.setHex( THREE.ColorKeywords[ style ] ); - - return this; - - } - - - }, - - copy: function ( color ) { - - this.r = color.r; - this.g = color.g; - this.b = color.b; - - return this; - - }, - - copyGammaToLinear: function ( color, gammaFactor ) { - - if ( gammaFactor === undefined ) gammaFactor = 2.0; - - this.r = Math.pow( color.r, gammaFactor ); - this.g = Math.pow( color.g, gammaFactor ); - this.b = Math.pow( color.b, gammaFactor ); - - return this; - - }, - - copyLinearToGamma: function ( color, gammaFactor ) { - - if ( gammaFactor === undefined ) gammaFactor = 2.0; - - var safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0; - - this.r = Math.pow( color.r, safeInverse ); - this.g = Math.pow( color.g, safeInverse ); - this.b = Math.pow( color.b, safeInverse ); - - return this; - - }, - - convertGammaToLinear: function () { - - var r = this.r, g = this.g, b = this.b; - - this.r = r * r; - this.g = g * g; - this.b = b * b; - - return this; - - }, - - convertLinearToGamma: function () { - - this.r = Math.sqrt( this.r ); - this.g = Math.sqrt( this.g ); - this.b = Math.sqrt( this.b ); - - return this; - - }, - - getHex: function () { - - return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0; - - }, - - getHexString: function () { - - return ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 ); - - }, - - getHSL: function ( optionalTarget ) { - - // h,s,l ranges are in 0.0 - 1.0 - - var hsl = optionalTarget || { h: 0, s: 0, l: 0 }; - - var r = this.r, g = this.g, b = this.b; - - var max = Math.max( r, g, b ); - var min = Math.min( r, g, b ); - - var hue, saturation; - var lightness = ( min + max ) / 2.0; - - if ( min === max ) { - - hue = 0; - saturation = 0; - - } else { - - var delta = max - min; - - saturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min ); - - switch ( max ) { - - case r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break; - case g: hue = ( b - r ) / delta + 2; break; - case b: hue = ( r - g ) / delta + 4; break; - - } - - hue /= 6; - - } - - hsl.h = hue; - hsl.s = saturation; - hsl.l = lightness; - - return hsl; - - }, - - getStyle: function () { - - return 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')'; - - }, - - offsetHSL: function ( h, s, l ) { - - var hsl = this.getHSL(); - - hsl.h += h; hsl.s += s; hsl.l += l; - - this.setHSL( hsl.h, hsl.s, hsl.l ); - - return this; - - }, - - add: function ( color ) { - - this.r += color.r; - this.g += color.g; - this.b += color.b; - - return this; - - }, - - addColors: function ( color1, color2 ) { - - this.r = color1.r + color2.r; - this.g = color1.g + color2.g; - this.b = color1.b + color2.b; - - return this; - - }, - - addScalar: function ( s ) { - - this.r += s; - this.g += s; - this.b += s; - - return this; - - }, - - multiply: function ( color ) { - - this.r *= color.r; - this.g *= color.g; - this.b *= color.b; - - return this; - - }, - - multiplyScalar: function ( s ) { - - this.r *= s; - this.g *= s; - this.b *= s; - - return this; - - }, - - lerp: function ( color, alpha ) { - - this.r += ( color.r - this.r ) * alpha; - this.g += ( color.g - this.g ) * alpha; - this.b += ( color.b - this.b ) * alpha; - - return this; - - }, - - equals: function ( c ) { - - return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b ); - - }, - - fromArray: function ( array ) { - - this.r = array[ 0 ]; - this.g = array[ 1 ]; - this.b = array[ 2 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.r; - array[ offset + 1 ] = this.g; - array[ offset + 2 ] = this.b; - - return array; - }, - - clone: function () { - - return new THREE.Color().setRGB( this.r, this.g, this.b ); - - } - -}; - -THREE.ColorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF, -'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2, -'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50, -'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B, -'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B, -'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F, -'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3, -'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222, -'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700, -'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4, -'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00, -'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3, -'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA, -'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32, -'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3, -'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC, -'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD, -'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6, -'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9, -'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F, -'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE, -'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA, -'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0, -'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 }; - -// File:src/math/Quaternion.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://exocortex.com - */ - -THREE.Quaternion = function ( x, y, z, w ) { - - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._w = ( w !== undefined ) ? w : 1; - -}; - -THREE.Quaternion.prototype = { - - constructor: THREE.Quaternion, - - _x: 0,_y: 0, _z: 0, _w: 0, - - get x () { - - return this._x; - - }, - - set x ( value ) { - - this._x = value; - this.onChangeCallback(); - - }, - - get y () { - - return this._y; - - }, - - set y ( value ) { - - this._y = value; - this.onChangeCallback(); - - }, - - get z () { - - return this._z; - - }, - - set z ( value ) { - - this._z = value; - this.onChangeCallback(); - - }, - - get w () { - - return this._w; - - }, - - set w ( value ) { - - this._w = value; - this.onChangeCallback(); - - }, - - set: function ( x, y, z, w ) { - - this._x = x; - this._y = y; - this._z = z; - this._w = w; - - this.onChangeCallback(); - - return this; - - }, - - copy: function ( quaternion ) { - - this._x = quaternion.x; - this._y = quaternion.y; - this._z = quaternion.z; - this._w = quaternion.w; - - this.onChangeCallback(); - - return this; - - }, - - setFromEuler: function ( euler, update ) { - - if ( euler instanceof THREE.Euler === false ) { - - throw new Error( 'THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.' ); - } - - // http://www.mathworks.com/matlabcentral/fileexchange/ - // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ - // content/SpinCalc.m - - var c1 = Math.cos( euler._x / 2 ); - var c2 = Math.cos( euler._y / 2 ); - var c3 = Math.cos( euler._z / 2 ); - var s1 = Math.sin( euler._x / 2 ); - var s2 = Math.sin( euler._y / 2 ); - var s3 = Math.sin( euler._z / 2 ); - - if ( euler.order === 'XYZ' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( euler.order === 'YXZ' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } else if ( euler.order === 'ZXY' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( euler.order === 'ZYX' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } else if ( euler.order === 'YZX' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( euler.order === 'XZY' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } - - if ( update !== false ) this.onChangeCallback(); - - return this; - - }, - - setFromAxisAngle: function ( axis, angle ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm - - // assumes axis is normalized - - var halfAngle = angle / 2, s = Math.sin( halfAngle ); - - this._x = axis.x * s; - this._y = axis.y * s; - this._z = axis.z * s; - this._w = Math.cos( halfAngle ); - - this.onChangeCallback(); - - return this; - - }, - - setFromRotationMatrix: function ( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var te = m.elements, - - m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ], - m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ], - m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ], - - trace = m11 + m22 + m33, - s; - - if ( trace > 0 ) { - - s = 0.5 / Math.sqrt( trace + 1.0 ); - - this._w = 0.25 / s; - this._x = ( m32 - m23 ) * s; - this._y = ( m13 - m31 ) * s; - this._z = ( m21 - m12 ) * s; - - } else if ( m11 > m22 && m11 > m33 ) { - - s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 ); - - this._w = ( m32 - m23 ) / s; - this._x = 0.25 * s; - this._y = ( m12 + m21 ) / s; - this._z = ( m13 + m31 ) / s; - - } else if ( m22 > m33 ) { - - s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 ); - - this._w = ( m13 - m31 ) / s; - this._x = ( m12 + m21 ) / s; - this._y = 0.25 * s; - this._z = ( m23 + m32 ) / s; - - } else { - - s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 ); - - this._w = ( m21 - m12 ) / s; - this._x = ( m13 + m31 ) / s; - this._y = ( m23 + m32 ) / s; - this._z = 0.25 * s; - - } - - this.onChangeCallback(); - - return this; - - }, - - setFromUnitVectors: function () { - - // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final - - // assumes direction vectors vFrom and vTo are normalized - - var v1, r; - - var EPS = 0.000001; - - return function ( vFrom, vTo ) { - - if ( v1 === undefined ) v1 = new THREE.Vector3(); - - r = vFrom.dot( vTo ) + 1; - - if ( r < EPS ) { - - r = 0; - - if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { - - v1.set( - vFrom.y, vFrom.x, 0 ); - - } else { - - v1.set( 0, - vFrom.z, vFrom.y ); - - } - - } else { - - v1.crossVectors( vFrom, vTo ); - - } - - this._x = v1.x; - this._y = v1.y; - this._z = v1.z; - this._w = r; - - this.normalize(); - - return this; - - } - - }(), - - inverse: function () { - - this.conjugate().normalize(); - - return this; - - }, - - conjugate: function () { - - this._x *= - 1; - this._y *= - 1; - this._z *= - 1; - - this.onChangeCallback(); - - return this; - - }, - - dot: function ( v ) { - - return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w; - - }, - - lengthSq: function () { - - return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - - }, - - length: function () { - - return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w ); - - }, - - normalize: function () { - - var l = this.length(); - - if ( l === 0 ) { - - this._x = 0; - this._y = 0; - this._z = 0; - this._w = 1; - - } else { - - l = 1 / l; - - this._x = this._x * l; - this._y = this._y * l; - this._z = this._z * l; - this._w = this._w * l; - - } - - this.onChangeCallback(); - - return this; - - }, - - multiply: function ( q, p ) { - - if ( p !== undefined ) { - - THREE.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' ); - return this.multiplyQuaternions( q, p ); - - } - - return this.multiplyQuaternions( this, q ); - - }, - - multiplyQuaternions: function ( a, b ) { - - // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm - - var qax = a._x, qay = a._y, qaz = a._z, qaw = a._w; - var qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w; - - this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; - this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; - this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; - this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - - this.onChangeCallback(); - - return this; - - }, - - multiplyVector3: function ( vector ) { - - THREE.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' ); - return vector.applyQuaternion( this ); - - }, - - slerp: function ( qb, t ) { - - if ( t === 0 ) return this; - if ( t === 1 ) return this.copy( qb ); - - var x = this._x, y = this._y, z = this._z, w = this._w; - - // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ - - var cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; - - if ( cosHalfTheta < 0 ) { - - this._w = - qb._w; - this._x = - qb._x; - this._y = - qb._y; - this._z = - qb._z; - - cosHalfTheta = - cosHalfTheta; - - } else { - - this.copy( qb ); - - } - - if ( cosHalfTheta >= 1.0 ) { - - this._w = w; - this._x = x; - this._y = y; - this._z = z; - - return this; - - } - - var halfTheta = Math.acos( cosHalfTheta ); - var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); - - if ( Math.abs( sinHalfTheta ) < 0.001 ) { - - this._w = 0.5 * ( w + this._w ); - this._x = 0.5 * ( x + this._x ); - this._y = 0.5 * ( y + this._y ); - this._z = 0.5 * ( z + this._z ); - - return this; - - } - - var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, - ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; - - this._w = ( w * ratioA + this._w * ratioB ); - this._x = ( x * ratioA + this._x * ratioB ); - this._y = ( y * ratioA + this._y * ratioB ); - this._z = ( z * ratioA + this._z * ratioB ); - - this.onChangeCallback(); - - return this; - - }, - - equals: function ( quaternion ) { - - return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this._x = array[ offset ]; - this._y = array[ offset + 1 ]; - this._z = array[ offset + 2 ]; - this._w = array[ offset + 3 ]; - - this.onChangeCallback(); - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this._x; - array[ offset + 1 ] = this._y; - array[ offset + 2 ] = this._z; - array[ offset + 3 ] = this._w; - - return array; - - }, - - onChange: function ( callback ) { - - this.onChangeCallback = callback; - - return this; - - }, - - onChangeCallback: function () {}, - - clone: function () { - - return new THREE.Quaternion( this._x, this._y, this._z, this._w ); - - } - -}; - -THREE.Quaternion.slerp = function ( qa, qb, qm, t ) { - - return qm.copy( qa ).slerp( qb, t ); - -} - -// File:src/math/Vector2.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author philogb / http://blog.thejit.org/ - * @author egraether / http://egraether.com/ - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - -THREE.Vector2 = function ( x, y ) { - - this.x = x || 0; - this.y = y || 0; - -}; - -THREE.Vector2.prototype = { - - constructor: THREE.Vector2, - - set: function ( x, y ) { - - this.x = x; - this.y = y; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - THREE.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - THREE.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - - return this; - - }, - - multiply: function ( v ) { - - this.x *= v.x; - this.y *= v.y; - - return this; - - }, - - multiplyScalar: function ( s ) { - - this.x *= s; - this.y *= s; - - return this; - - }, - - divide: function ( v ) { - - this.x /= v.x; - this.y /= v.y; - - return this; - - }, - - divideScalar: function ( scalar ) { - - if ( scalar !== 0 ) { - - var invScalar = 1 / scalar; - - this.x *= invScalar; - this.y *= invScalar; - - } else { - - this.x = 0; - this.y = 0; - - } - - return this; - - }, - - min: function ( v ) { - - if ( this.x > v.x ) { - - this.x = v.x; - - } - - if ( this.y > v.y ) { - - this.y = v.y; - - } - - return this; - - }, - - max: function ( v ) { - - if ( this.x < v.x ) { - - this.x = v.x; - - } - - if ( this.y < v.y ) { - - this.y = v.y; - - } - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - if ( this.x < min.x ) { - - this.x = min.x; - - } else if ( this.x > max.x ) { - - this.x = max.x; - - } - - if ( this.y < min.y ) { - - this.y = min.y; - - } else if ( this.y > max.y ) { - - this.y = max.y; - - } - - return this; - }, - - clampScalar: ( function () { - - var min, max; - - return function ( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new THREE.Vector2(); - max = new THREE.Vector2(); - - } - - min.set( minVal, minVal ); - max.set( maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - } )(), - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - distanceTo: function ( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - }, - - distanceToSquared: function ( v ) { - - var dx = this.x - v.x, dy = this.y - v.y; - return dx * dx + dy * dy; - - }, - - setLength: function ( l ) { - - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - } - - return this; - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - return this; - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - - return this; - - }, - - clone: function () { - - return new THREE.Vector2( this.x, this.y ); - - } - -}; - -// File:src/math/Vector3.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author *kile / http://kile.stravaganza.org/ - * @author philogb / http://blog.thejit.org/ - * @author mikael emtinger / http://gomo.se/ - * @author egraether / http://egraether.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Vector3 = function ( x, y, z ) { - - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - -}; - -THREE.Vector3.prototype = { - - constructor: THREE.Vector3, - - set: function ( x, y, z ) { - - this.x = x; - this.y = y; - this.z = z; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setZ: function ( z ) { - - this.z = z; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - THREE.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - this.z += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - THREE.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - this.z -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - - return this; - - }, - - multiply: function ( v, w ) { - - if ( w !== undefined ) { - - THREE.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' ); - return this.multiplyVectors( v, w ); - - } - - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - - return this; - - }, - - multiplyVectors: function ( a, b ) { - - this.x = a.x * b.x; - this.y = a.y * b.y; - this.z = a.z * b.z; - - return this; - - }, - - applyEuler: function () { - - var quaternion; - - return function ( euler ) { - - if ( euler instanceof THREE.Euler === false ) { - - THREE.error( 'THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.' ); - - } - - if ( quaternion === undefined ) quaternion = new THREE.Quaternion(); - - this.applyQuaternion( quaternion.setFromEuler( euler ) ); - - return this; - - }; - - }(), - - applyAxisAngle: function () { - - var quaternion; - - return function ( axis, angle ) { - - if ( quaternion === undefined ) quaternion = new THREE.Quaternion(); - - this.applyQuaternion( quaternion.setFromAxisAngle( axis, angle ) ); - - return this; - - }; - - }(), - - applyMatrix3: function ( m ) { - - var x = this.x; - var y = this.y; - var z = this.z; - - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z; - this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z; - this.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z; - - return this; - - }, - - applyMatrix4: function ( m ) { - - // input: THREE.Matrix4 affine matrix - - var x = this.x, y = this.y, z = this.z; - - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ]; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ]; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ]; - - return this; - - }, - - applyProjection: function ( m ) { - - // input: THREE.Matrix4 projection matrix - - var x = this.x, y = this.y, z = this.z; - - var e = m.elements; - var d = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] ); // perspective divide - - this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * d; - this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * d; - this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * d; - - return this; - - }, - - applyQuaternion: function ( q ) { - - var x = this.x; - var y = this.y; - var z = this.z; - - var qx = q.x; - var qy = q.y; - var qz = q.z; - var qw = q.w; - - // calculate quat * vector - - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = - qx * x - qy * y - qz * z; - - // calculate result * inverse quat - - this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; - this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; - this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; - - return this; - - }, - - project: function () { - - var matrix; - - return function ( camera ) { - - if ( matrix === undefined ) matrix = new THREE.Matrix4(); - - matrix.multiplyMatrices( camera.projectionMatrix, matrix.getInverse( camera.matrixWorld ) ); - return this.applyProjection( matrix ); - - }; - - }(), - - unproject: function () { - - var matrix; - - return function ( camera ) { - - if ( matrix === undefined ) matrix = new THREE.Matrix4(); - - matrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) ); - return this.applyProjection( matrix ); - - }; - - }(), - - transformDirection: function ( m ) { - - // input: THREE.Matrix4 affine matrix - // vector interpreted as a direction - - var x = this.x, y = this.y, z = this.z; - - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z; - - this.normalize(); - - return this; - - }, - - divide: function ( v ) { - - this.x /= v.x; - this.y /= v.y; - this.z /= v.z; - - return this; - - }, - - divideScalar: function ( scalar ) { - - if ( scalar !== 0 ) { - - var invScalar = 1 / scalar; - - this.x *= invScalar; - this.y *= invScalar; - this.z *= invScalar; - - } else { - - this.x = 0; - this.y = 0; - this.z = 0; - - } - - return this; - - }, - - min: function ( v ) { - - if ( this.x > v.x ) { - - this.x = v.x; - - } - - if ( this.y > v.y ) { - - this.y = v.y; - - } - - if ( this.z > v.z ) { - - this.z = v.z; - - } - - return this; - - }, - - max: function ( v ) { - - if ( this.x < v.x ) { - - this.x = v.x; - - } - - if ( this.y < v.y ) { - - this.y = v.y; - - } - - if ( this.z < v.z ) { - - this.z = v.z; - - } - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - if ( this.x < min.x ) { - - this.x = min.x; - - } else if ( this.x > max.x ) { - - this.x = max.x; - - } - - if ( this.y < min.y ) { - - this.y = min.y; - - } else if ( this.y > max.y ) { - - this.y = max.y; - - } - - if ( this.z < min.z ) { - - this.z = min.z; - - } else if ( this.z > max.z ) { - - this.z = max.z; - - } - - return this; - - }, - - clampScalar: ( function () { - - var min, max; - - return function ( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new THREE.Vector3(); - max = new THREE.Vector3(); - - } - - min.set( minVal, minVal, minVal ); - max.set( maxVal, maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - } )(), - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - this.z = - this.z; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y + this.z * this.z; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); - - }, - - lengthManhattan: function () { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - setLength: function ( l ) { - - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - } - - return this; - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - return this; - - }, - - cross: function ( v, w ) { - - if ( w !== undefined ) { - - THREE.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' ); - return this.crossVectors( v, w ); - - } - - var x = this.x, y = this.y, z = this.z; - - this.x = y * v.z - z * v.y; - this.y = z * v.x - x * v.z; - this.z = x * v.y - y * v.x; - - return this; - - }, - - crossVectors: function ( a, b ) { - - var ax = a.x, ay = a.y, az = a.z; - var bx = b.x, by = b.y, bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - - }, - - projectOnVector: function () { - - var v1, dot; - - return function ( vector ) { - - if ( v1 === undefined ) v1 = new THREE.Vector3(); - - v1.copy( vector ).normalize(); - - dot = this.dot( v1 ); - - return this.copy( v1 ).multiplyScalar( dot ); - - }; - - }(), - - projectOnPlane: function () { - - var v1; - - return function ( planeNormal ) { - - if ( v1 === undefined ) v1 = new THREE.Vector3(); - - v1.copy( this ).projectOnVector( planeNormal ); - - return this.sub( v1 ); - - } - - }(), - - reflect: function () { - - // reflect incident vector off plane orthogonal to normal - // normal is assumed to have unit length - - var v1; - - return function ( normal ) { - - if ( v1 === undefined ) v1 = new THREE.Vector3(); - - return this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) ); - - } - - }(), - - angleTo: function ( v ) { - - var theta = this.dot( v ) / ( this.length() * v.length() ); - - // clamp, to handle numerical problems - - return Math.acos( THREE.Math.clamp( theta, - 1, 1 ) ); - - }, - - distanceTo: function ( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - }, - - distanceToSquared: function ( v ) { - - var dx = this.x - v.x; - var dy = this.y - v.y; - var dz = this.z - v.z; - - return dx * dx + dy * dy + dz * dz; - - }, - - setEulerFromRotationMatrix: function ( m, order ) { - - THREE.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' ); - - }, - - setEulerFromQuaternion: function ( q, order ) { - - THREE.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' ); - - }, - - getPositionFromMatrix: function ( m ) { - - THREE.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' ); - - return this.setFromMatrixPosition( m ); - - }, - - getScaleFromMatrix: function ( m ) { - - THREE.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' ); - - return this.setFromMatrixScale( m ); - }, - - getColumnFromMatrix: function ( index, matrix ) { - - THREE.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' ); - - return this.setFromMatrixColumn( index, matrix ); - - }, - - setFromMatrixPosition: function ( m ) { - - this.x = m.elements[ 12 ]; - this.y = m.elements[ 13 ]; - this.z = m.elements[ 14 ]; - - return this; - - }, - - setFromMatrixScale: function ( m ) { - - var sx = this.set( m.elements[ 0 ], m.elements[ 1 ], m.elements[ 2 ] ).length(); - var sy = this.set( m.elements[ 4 ], m.elements[ 5 ], m.elements[ 6 ] ).length(); - var sz = this.set( m.elements[ 8 ], m.elements[ 9 ], m.elements[ 10 ] ).length(); - - this.x = sx; - this.y = sy; - this.z = sz; - - return this; - }, - - setFromMatrixColumn: function ( index, matrix ) { - - var offset = index * 4; - - var me = matrix.elements; - - this.x = me[ offset ]; - this.y = me[ offset + 1 ]; - this.z = me[ offset + 2 ]; - - return this; - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - this.z = array[ offset + 2 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - array[ offset + 2 ] = this.z; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - this.z = attribute.array[ index + 2 ]; - - return this; - - }, - - clone: function () { - - return new THREE.Vector3( this.x, this.y, this.z ); - - } - -}; - -// File:src/math/Vector4.js - -/** - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author philogb / http://blog.thejit.org/ - * @author mikael emtinger / http://gomo.se/ - * @author egraether / http://egraether.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Vector4 = function ( x, y, z, w ) { - - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = ( w !== undefined ) ? w : 1; - -}; - -THREE.Vector4.prototype = { - - constructor: THREE.Vector4, - - set: function ( x, y, z, w ) { - - this.x = x; - this.y = y; - this.z = z; - this.w = w; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setZ: function ( z ) { - - this.z = z; - - return this; - - }, - - setW: function ( w ) { - - this.w = w; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - case 3: this.w = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - case 3: return this.w; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - this.w = ( v.w !== undefined ) ? v.w : 1; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - THREE.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - this.z += s; - this.w += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - this.w = a.w + b.w; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - THREE.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - this.z -= s; - this.w -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - this.w = a.w - b.w; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - this.w *= scalar; - - return this; - - }, - - applyMatrix4: function ( m ) { - - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w; - this.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w; - - return this; - - }, - - divideScalar: function ( scalar ) { - - if ( scalar !== 0 ) { - - var invScalar = 1 / scalar; - - this.x *= invScalar; - this.y *= invScalar; - this.z *= invScalar; - this.w *= invScalar; - - } else { - - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - } - - return this; - - }, - - setAxisAngleFromQuaternion: function ( q ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm - - // q is assumed to be normalized - - this.w = 2 * Math.acos( q.w ); - - var s = Math.sqrt( 1 - q.w * q.w ); - - if ( s < 0.0001 ) { - - this.x = 1; - this.y = 0; - this.z = 0; - - } else { - - this.x = q.x / s; - this.y = q.y / s; - this.z = q.z / s; - - } - - return this; - - }, - - setAxisAngleFromRotationMatrix: function ( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var angle, x, y, z, // variables for result - epsilon = 0.01, // margin to allow for rounding errors - epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees - - te = m.elements, - - m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ], - m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ], - m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; - - if ( ( Math.abs( m12 - m21 ) < epsilon ) - && ( Math.abs( m13 - m31 ) < epsilon ) - && ( Math.abs( m23 - m32 ) < epsilon ) ) { - - // singularity found - // first check for identity matrix which must have +1 for all terms - // in leading diagonal and zero in other terms - - if ( ( Math.abs( m12 + m21 ) < epsilon2 ) - && ( Math.abs( m13 + m31 ) < epsilon2 ) - && ( Math.abs( m23 + m32 ) < epsilon2 ) - && ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) { - - // this singularity is identity matrix so angle = 0 - - this.set( 1, 0, 0, 0 ); - - return this; // zero angle, arbitrary axis - - } - - // otherwise this singularity is angle = 180 - - angle = Math.PI; - - var xx = ( m11 + 1 ) / 2; - var yy = ( m22 + 1 ) / 2; - var zz = ( m33 + 1 ) / 2; - var xy = ( m12 + m21 ) / 4; - var xz = ( m13 + m31 ) / 4; - var yz = ( m23 + m32 ) / 4; - - if ( ( xx > yy ) && ( xx > zz ) ) { // m11 is the largest diagonal term - - if ( xx < epsilon ) { - - x = 0; - y = 0.707106781; - z = 0.707106781; - - } else { - - x = Math.sqrt( xx ); - y = xy / x; - z = xz / x; - - } - - } else if ( yy > zz ) { // m22 is the largest diagonal term - - if ( yy < epsilon ) { - - x = 0.707106781; - y = 0; - z = 0.707106781; - - } else { - - y = Math.sqrt( yy ); - x = xy / y; - z = yz / y; - - } - - } else { // m33 is the largest diagonal term so base result on this - - if ( zz < epsilon ) { - - x = 0.707106781; - y = 0.707106781; - z = 0; - - } else { - - z = Math.sqrt( zz ); - x = xz / z; - y = yz / z; - - } - - } - - this.set( x, y, z, angle ); - - return this; // return 180 deg rotation - - } - - // as we have reached here there are no singularities so we can handle normally - - var s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) - + ( m13 - m31 ) * ( m13 - m31 ) - + ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize - - if ( Math.abs( s ) < 0.001 ) s = 1; - - // prevent divide by zero, should not happen if matrix is orthogonal and should be - // caught by singularity test above, but I've left it in just in case - - this.x = ( m32 - m23 ) / s; - this.y = ( m13 - m31 ) / s; - this.z = ( m21 - m12 ) / s; - this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 ); - - return this; - - }, - - min: function ( v ) { - - if ( this.x > v.x ) { - - this.x = v.x; - - } - - if ( this.y > v.y ) { - - this.y = v.y; - - } - - if ( this.z > v.z ) { - - this.z = v.z; - - } - - if ( this.w > v.w ) { - - this.w = v.w; - - } - - return this; - - }, - - max: function ( v ) { - - if ( this.x < v.x ) { - - this.x = v.x; - - } - - if ( this.y < v.y ) { - - this.y = v.y; - - } - - if ( this.z < v.z ) { - - this.z = v.z; - - } - - if ( this.w < v.w ) { - - this.w = v.w; - - } - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - if ( this.x < min.x ) { - - this.x = min.x; - - } else if ( this.x > max.x ) { - - this.x = max.x; - - } - - if ( this.y < min.y ) { - - this.y = min.y; - - } else if ( this.y > max.y ) { - - this.y = max.y; - - } - - if ( this.z < min.z ) { - - this.z = min.z; - - } else if ( this.z > max.z ) { - - this.z = max.z; - - } - - if ( this.w < min.w ) { - - this.w = min.w; - - } else if ( this.w > max.w ) { - - this.w = max.w; - - } - - return this; - - }, - - clampScalar: ( function () { - - var min, max; - - return function ( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new THREE.Vector4(); - max = new THREE.Vector4(); - - } - - min.set( minVal, minVal, minVal, minVal ); - max.set( maxVal, maxVal, maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - } )(), - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - this.w = Math.floor( this.w ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - this.w = Math.ceil( this.w ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - this.w = Math.round( this.w ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - this.z = - this.z; - this.w = - this.w; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); - - }, - - lengthManhattan: function () { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - setLength: function ( l ) { - - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - - } - - return this; - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - this.w += ( v.w - this.w ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - return this; - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - this.z = array[ offset + 2 ]; - this.w = array[ offset + 3 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - array[ offset + 2 ] = this.z; - array[ offset + 3 ] = this.w; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - this.z = attribute.array[ index + 2 ]; - this.w = attribute.array[ index + 3 ]; - - return this; - - }, - - clone: function () { - - return new THREE.Vector4( this.x, this.y, this.z, this.w ); - - } - -}; - -// File:src/math/Euler.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://exocortex.com - */ - -THREE.Euler = function ( x, y, z, order ) { - - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._order = order || THREE.Euler.DefaultOrder; - -}; - -THREE.Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; - -THREE.Euler.DefaultOrder = 'XYZ'; - -THREE.Euler.prototype = { - - constructor: THREE.Euler, - - _x: 0, _y: 0, _z: 0, _order: THREE.Euler.DefaultOrder, - - get x () { - - return this._x; - - }, - - set x ( value ) { - - this._x = value; - this.onChangeCallback(); - - }, - - get y () { - - return this._y; - - }, - - set y ( value ) { - - this._y = value; - this.onChangeCallback(); - - }, - - get z () { - - return this._z; - - }, - - set z ( value ) { - - this._z = value; - this.onChangeCallback(); - - }, - - get order () { - - return this._order; - - }, - - set order ( value ) { - - this._order = value; - this.onChangeCallback(); - - }, - - set: function ( x, y, z, order ) { - - this._x = x; - this._y = y; - this._z = z; - this._order = order || this._order; - - this.onChangeCallback(); - - return this; - - }, - - copy: function ( euler ) { - - this._x = euler._x; - this._y = euler._y; - this._z = euler._z; - this._order = euler._order; - - this.onChangeCallback(); - - return this; - - }, - - setFromRotationMatrix: function ( m, order, update ) { - - var clamp = THREE.Math.clamp; - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var te = m.elements; - var m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ]; - var m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ]; - var m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; - - order = order || this._order; - - if ( order === 'XYZ' ) { - - this._y = Math.asin( clamp( m13, - 1, 1 ) ); - - if ( Math.abs( m13 ) < 0.99999 ) { - - this._x = Math.atan2( - m23, m33 ); - this._z = Math.atan2( - m12, m11 ); - - } else { - - this._x = Math.atan2( m32, m22 ); - this._z = 0; - - } - - } else if ( order === 'YXZ' ) { - - this._x = Math.asin( - clamp( m23, - 1, 1 ) ); - - if ( Math.abs( m23 ) < 0.99999 ) { - - this._y = Math.atan2( m13, m33 ); - this._z = Math.atan2( m21, m22 ); - - } else { - - this._y = Math.atan2( - m31, m11 ); - this._z = 0; - - } - - } else if ( order === 'ZXY' ) { - - this._x = Math.asin( clamp( m32, - 1, 1 ) ); - - if ( Math.abs( m32 ) < 0.99999 ) { - - this._y = Math.atan2( - m31, m33 ); - this._z = Math.atan2( - m12, m22 ); - - } else { - - this._y = 0; - this._z = Math.atan2( m21, m11 ); - - } - - } else if ( order === 'ZYX' ) { - - this._y = Math.asin( - clamp( m31, - 1, 1 ) ); - - if ( Math.abs( m31 ) < 0.99999 ) { - - this._x = Math.atan2( m32, m33 ); - this._z = Math.atan2( m21, m11 ); - - } else { - - this._x = 0; - this._z = Math.atan2( - m12, m22 ); - - } - - } else if ( order === 'YZX' ) { - - this._z = Math.asin( clamp( m21, - 1, 1 ) ); - - if ( Math.abs( m21 ) < 0.99999 ) { - - this._x = Math.atan2( - m23, m22 ); - this._y = Math.atan2( - m31, m11 ); - - } else { - - this._x = 0; - this._y = Math.atan2( m13, m33 ); - - } - - } else if ( order === 'XZY' ) { - - this._z = Math.asin( - clamp( m12, - 1, 1 ) ); - - if ( Math.abs( m12 ) < 0.99999 ) { - - this._x = Math.atan2( m32, m22 ); - this._y = Math.atan2( m13, m11 ); - - } else { - - this._x = Math.atan2( - m23, m33 ); - this._y = 0; - - } - - } else { - - THREE.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order ) - - } - - this._order = order; - - if ( update !== false ) this.onChangeCallback(); - - return this; - - }, - - setFromQuaternion: function () { - - var matrix; - - return function ( q, order, update ) { - - if ( matrix === undefined ) matrix = new THREE.Matrix4(); - matrix.makeRotationFromQuaternion( q ); - this.setFromRotationMatrix( matrix, order, update ); - - return this; - - }; - - }(), - - setFromVector3: function ( v, order ) { - - return this.set( v.x, v.y, v.z, order || this._order ); - - }, - - reorder: function () { - - // WARNING: this discards revolution information -bhouston - - var q = new THREE.Quaternion(); - - return function ( newOrder ) { - - q.setFromEuler( this ); - this.setFromQuaternion( q, newOrder ); - - }; - - }(), - - equals: function ( euler ) { - - return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order ); - - }, - - fromArray: function ( array ) { - - this._x = array[ 0 ]; - this._y = array[ 1 ]; - this._z = array[ 2 ]; - if ( array[ 3 ] !== undefined ) this._order = array[ 3 ]; - - this.onChangeCallback(); - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this._x; - array[ offset + 1 ] = this._y; - array[ offset + 2 ] = this._z; - array[ offset + 3 ] = this._order; - - return array; - }, - - toVector3: function ( optionalResult ) { - - if ( optionalResult ) { - - return optionalResult.set( this._x, this._y, this._z ); - - } else { - - return new THREE.Vector3( this._x, this._y, this._z ); - - } - - }, - - onChange: function ( callback ) { - - this.onChangeCallback = callback; - - return this; - - }, - - onChangeCallback: function () {}, - - clone: function () { - - return new THREE.Euler( this._x, this._y, this._z, this._order ); - - } - -}; - -// File:src/math/Line3.js - -/** - * @author bhouston / http://exocortex.com - */ - -THREE.Line3 = function ( start, end ) { - - this.start = ( start !== undefined ) ? start : new THREE.Vector3(); - this.end = ( end !== undefined ) ? end : new THREE.Vector3(); - -}; - -THREE.Line3.prototype = { - - constructor: THREE.Line3, - - set: function ( start, end ) { - - this.start.copy( start ); - this.end.copy( end ); - - return this; - - }, - - copy: function ( line ) { - - this.start.copy( line.start ); - this.end.copy( line.end ); - - return this; - - }, - - center: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.addVectors( this.start, this.end ).multiplyScalar( 0.5 ); - - }, - - delta: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.subVectors( this.end, this.start ); - - }, - - distanceSq: function () { - - return this.start.distanceToSquared( this.end ); - - }, - - distance: function () { - - return this.start.distanceTo( this.end ); - - }, - - at: function ( t, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - return this.delta( result ).multiplyScalar( t ).add( this.start ); - - }, - - closestPointToPointParameter: function () { - - var startP = new THREE.Vector3(); - var startEnd = new THREE.Vector3(); - - return function ( point, clampToLine ) { - - startP.subVectors( point, this.start ); - startEnd.subVectors( this.end, this.start ); - - var startEnd2 = startEnd.dot( startEnd ); - var startEnd_startP = startEnd.dot( startP ); - - var t = startEnd_startP / startEnd2; - - if ( clampToLine ) { - - t = THREE.Math.clamp( t, 0, 1 ); - - } - - return t; - - }; - - }(), - - closestPointToPoint: function ( point, clampToLine, optionalTarget ) { - - var t = this.closestPointToPointParameter( point, clampToLine ); - - var result = optionalTarget || new THREE.Vector3(); - - return this.delta( result ).multiplyScalar( t ).add( this.start ); - - }, - - applyMatrix4: function ( matrix ) { - - this.start.applyMatrix4( matrix ); - this.end.applyMatrix4( matrix ); - - return this; - - }, - - equals: function ( line ) { - - return line.start.equals( this.start ) && line.end.equals( this.end ); - - }, - - clone: function () { - - return new THREE.Line3().copy( this ); - - } - -}; - -// File:src/math/Box2.js - -/** - * @author bhouston / http://exocortex.com - */ - -THREE.Box2 = function ( min, max ) { - - this.min = ( min !== undefined ) ? min : new THREE.Vector2( Infinity, Infinity ); - this.max = ( max !== undefined ) ? max : new THREE.Vector2( - Infinity, - Infinity ); - -}; - -THREE.Box2.prototype = { - - constructor: THREE.Box2, - - set: function ( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - }, - - setFromPoints: function ( points ) { - - this.makeEmpty(); - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - this.expandByPoint( points[ i ] ) - - } - - return this; - - }, - - setFromCenterAndSize: function () { - - var v1 = new THREE.Vector2(); - - return function ( center, size ) { - - var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - }; - - }(), - - copy: function ( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - }, - - makeEmpty: function () { - - this.min.x = this.min.y = Infinity; - this.max.x = this.max.y = - Infinity; - - return this; - - }, - - empty: function () { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ); - - }, - - center: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector2(); - return result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - }, - - size: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector2(); - return result.subVectors( this.max, this.min ); - - }, - - expandByPoint: function ( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - }, - - expandByVector: function ( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - }, - - expandByScalar: function ( scalar ) { - - this.min.addScalar( - scalar ); - this.max.addScalar( scalar ); - - return this; - }, - - containsPoint: function ( point ) { - - if ( point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y ) { - - return false; - - } - - return true; - - }, - - containsBox: function ( box ) { - - if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && - ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) { - - return true; - - } - - return false; - - }, - - getParameter: function ( point, optionalTarget ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - var result = optionalTarget || new THREE.Vector2(); - - return result.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ) - ); - - }, - - isIntersectionBox: function ( box ) { - - // using 6 splitting planes to rule out intersections. - - if ( box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y ) { - - return false; - - } - - return true; - - }, - - clampPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector2(); - return result.copy( point ).clamp( this.min, this.max ); - - }, - - distanceToPoint: function () { - - var v1 = new THREE.Vector2(); - - return function ( point ) { - - var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - }; - - }(), - - intersect: function ( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - return this; - - }, - - union: function ( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - }, - - translate: function ( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - }, - - equals: function ( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - }, - - clone: function () { - - return new THREE.Box2().copy( this ); - - } - -}; - -// File:src/math/Box3.js - -/** - * @author bhouston / http://exocortex.com - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Box3 = function ( min, max ) { - - this.min = ( min !== undefined ) ? min : new THREE.Vector3( Infinity, Infinity, Infinity ); - this.max = ( max !== undefined ) ? max : new THREE.Vector3( - Infinity, - Infinity, - Infinity ); - -}; - -THREE.Box3.prototype = { - - constructor: THREE.Box3, - - set: function ( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - }, - - setFromPoints: function ( points ) { - - this.makeEmpty(); - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - this.expandByPoint( points[ i ] ) - - } - - return this; - - }, - - setFromCenterAndSize: function () { - - var v1 = new THREE.Vector3(); - - return function ( center, size ) { - - var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); - - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - }; - - }(), - - setFromObject: function () { - - // Computes the world-axis-aligned bounding box of an object (including its children), - // accounting for both the object's, and childrens', world transforms - - var v1 = new THREE.Vector3(); - - return function ( object ) { - - var scope = this; - - object.updateMatrixWorld( true ); - - this.makeEmpty(); - - object.traverse( function ( node ) { - - var geometry = node.geometry; - - if ( geometry !== undefined ) { - - if ( geometry instanceof THREE.Geometry ) { - - var vertices = geometry.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - v1.copy( vertices[ i ] ); - - v1.applyMatrix4( node.matrixWorld ); - - scope.expandByPoint( v1 ); - - } - - } else if ( geometry instanceof THREE.BufferGeometry && geometry.attributes[ 'position' ] !== undefined ) { - - var positions = geometry.attributes[ 'position' ].array; - - for ( var i = 0, il = positions.length; i < il; i += 3 ) { - - v1.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - - v1.applyMatrix4( node.matrixWorld ); - - scope.expandByPoint( v1 ); - - } - - } - - } - - } ); - - return this; - - }; - - }(), - - copy: function ( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - }, - - makeEmpty: function () { - - this.min.x = this.min.y = this.min.z = Infinity; - this.max.x = this.max.y = this.max.z = - Infinity; - - return this; - - }, - - empty: function () { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z ); - - }, - - center: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - }, - - size: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.subVectors( this.max, this.min ); - - }, - - expandByPoint: function ( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - - }, - - expandByVector: function ( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - - }, - - expandByScalar: function ( scalar ) { - - this.min.addScalar( - scalar ); - this.max.addScalar( scalar ); - - return this; - - }, - - containsPoint: function ( point ) { - - if ( point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y || - point.z < this.min.z || point.z > this.max.z ) { - - return false; - - } - - return true; - - }, - - containsBox: function ( box ) { - - if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && - ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) && - ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) { - - return true; - - } - - return false; - - }, - - getParameter: function ( point, optionalTarget ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - var result = optionalTarget || new THREE.Vector3(); - - return result.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ), - ( point.z - this.min.z ) / ( this.max.z - this.min.z ) - ); - - }, - - isIntersectionBox: function ( box ) { - - // using 6 splitting planes to rule out intersections. - - if ( box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y || - box.max.z < this.min.z || box.min.z > this.max.z ) { - - return false; - - } - - return true; - - }, - - clampPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.copy( point ).clamp( this.min, this.max ); - - }, - - distanceToPoint: function () { - - var v1 = new THREE.Vector3(); - - return function ( point ) { - - var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - }; - - }(), - - getBoundingSphere: function () { - - var v1 = new THREE.Vector3(); - - return function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Sphere(); - - result.center = this.center(); - result.radius = this.size( v1 ).length() * 0.5; - - return result; - - }; - - }(), - - intersect: function ( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - return this; - - }, - - union: function ( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - }, - - applyMatrix4: function () { - - var points = [ - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3(), - new THREE.Vector3() - ]; - - return function ( matrix ) { - - // NOTE: I am using a binary pattern to specify all 2^3 combinations below - points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000 - points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001 - points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010 - points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011 - points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100 - points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101 - points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110 - points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111 - - this.makeEmpty(); - this.setFromPoints( points ); - - return this; - - }; - - }(), - - translate: function ( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - }, - - equals: function ( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - }, - - clone: function () { - - return new THREE.Box3().copy( this ); - - } - -}; - -// File:src/math/Matrix3.js - -/** - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://exocortex.com - */ - -THREE.Matrix3 = function () { - - this.elements = new Float32Array( [ - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ] ); - - if ( arguments.length > 0 ) { - - THREE.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' ); - - } - -}; - -THREE.Matrix3.prototype = { - - constructor: THREE.Matrix3, - - set: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) { - - var te = this.elements; - - te[ 0 ] = n11; te[ 3 ] = n12; te[ 6 ] = n13; - te[ 1 ] = n21; te[ 4 ] = n22; te[ 7 ] = n23; - te[ 2 ] = n31; te[ 5 ] = n32; te[ 8 ] = n33; - - return this; - - }, - - identity: function () { - - this.set( - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ); - - return this; - - }, - - copy: function ( m ) { - - var me = m.elements; - - this.set( - - me[ 0 ], me[ 3 ], me[ 6 ], - me[ 1 ], me[ 4 ], me[ 7 ], - me[ 2 ], me[ 5 ], me[ 8 ] - - ); - - return this; - - }, - - multiplyVector3: function ( vector ) { - - THREE.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' ); - return vector.applyMatrix3( this ); - - }, - - multiplyVector3Array: function ( a ) { - - THREE.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' ); - return this.applyToVector3Array( a ); - - }, - - applyToVector3Array: function () { - - var v1 = new THREE.Vector3(); - - return function ( array, offset, length ) { - - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = array.length; - - for ( var i = 0, j = offset; i < length; i += 3, j += 3 ) { - - v1.x = array[ j ]; - v1.y = array[ j + 1 ]; - v1.z = array[ j + 2 ]; - - v1.applyMatrix3( this ); - - array[ j ] = v1.x; - array[ j + 1 ] = v1.y; - array[ j + 2 ] = v1.z; - - } - - return array; - - }; - - }(), - - multiplyScalar: function ( s ) { - - var te = this.elements; - - te[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s; - te[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s; - te[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s; - - return this; - - }, - - determinant: function () { - - var te = this.elements; - - var a = te[ 0 ], b = te[ 1 ], c = te[ 2 ], - d = te[ 3 ], e = te[ 4 ], f = te[ 5 ], - g = te[ 6 ], h = te[ 7 ], i = te[ 8 ]; - - return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; - - }, - - getInverse: function ( matrix, throwOnInvertible ) { - - // input: THREE.Matrix4 - // ( based on http://code.google.com/p/webgl-mjs/ ) - - var me = matrix.elements; - var te = this.elements; - - te[ 0 ] = me[ 10 ] * me[ 5 ] - me[ 6 ] * me[ 9 ]; - te[ 1 ] = - me[ 10 ] * me[ 1 ] + me[ 2 ] * me[ 9 ]; - te[ 2 ] = me[ 6 ] * me[ 1 ] - me[ 2 ] * me[ 5 ]; - te[ 3 ] = - me[ 10 ] * me[ 4 ] + me[ 6 ] * me[ 8 ]; - te[ 4 ] = me[ 10 ] * me[ 0 ] - me[ 2 ] * me[ 8 ]; - te[ 5 ] = - me[ 6 ] * me[ 0 ] + me[ 2 ] * me[ 4 ]; - te[ 6 ] = me[ 9 ] * me[ 4 ] - me[ 5 ] * me[ 8 ]; - te[ 7 ] = - me[ 9 ] * me[ 0 ] + me[ 1 ] * me[ 8 ]; - te[ 8 ] = me[ 5 ] * me[ 0 ] - me[ 1 ] * me[ 4 ]; - - var det = me[ 0 ] * te[ 0 ] + me[ 1 ] * te[ 3 ] + me[ 2 ] * te[ 6 ]; - - // no inverse - - if ( det === 0 ) { - - var msg = "Matrix3.getInverse(): can't invert matrix, determinant is 0"; - - if ( throwOnInvertible || false ) { - - throw new Error( msg ); - - } else { - - THREE.warn( msg ); - - } - - this.identity(); - - return this; - - } - - this.multiplyScalar( 1.0 / det ); - - return this; - - }, - - transpose: function () { - - var tmp, m = this.elements; - - tmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp; - tmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp; - tmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp; - - return this; - - }, - - flattenToArrayOffset: function ( array, offset ) { - - var te = this.elements; - - array[ offset ] = te[ 0 ]; - array[ offset + 1 ] = te[ 1 ]; - array[ offset + 2 ] = te[ 2 ]; - - array[ offset + 3 ] = te[ 3 ]; - array[ offset + 4 ] = te[ 4 ]; - array[ offset + 5 ] = te[ 5 ]; - - array[ offset + 6 ] = te[ 6 ]; - array[ offset + 7 ] = te[ 7 ]; - array[ offset + 8 ] = te[ 8 ]; - - return array; - - }, - - getNormalMatrix: function ( m ) { - - // input: THREE.Matrix4 - - this.getInverse( m ).transpose(); - - return this; - - }, - - transposeIntoArray: function ( r ) { - - var m = this.elements; - - r[ 0 ] = m[ 0 ]; - r[ 1 ] = m[ 3 ]; - r[ 2 ] = m[ 6 ]; - r[ 3 ] = m[ 1 ]; - r[ 4 ] = m[ 4 ]; - r[ 5 ] = m[ 7 ]; - r[ 6 ] = m[ 2 ]; - r[ 7 ] = m[ 5 ]; - r[ 8 ] = m[ 8 ]; - - return this; - - }, - - fromArray: function ( array ) { - - this.elements.set( array ); - - return this; - - }, - - toArray: function () { - - var te = this.elements; - - return [ - te[ 0 ], te[ 1 ], te[ 2 ], - te[ 3 ], te[ 4 ], te[ 5 ], - te[ 6 ], te[ 7 ], te[ 8 ] - ]; - - }, - - clone: function () { - - return new THREE.Matrix3().fromArray( this.elements ); - - } - -}; - -// File:src/math/Matrix4.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author philogb / http://blog.thejit.org/ - * @author jordi_ros / http://plattsoft.com - * @author D1plo1d / http://github.com/D1plo1d - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author timknip / http://www.floorplanner.com/ - * @author bhouston / http://exocortex.com - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Matrix4 = function () { - - this.elements = new Float32Array( [ - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ] ); - - if ( arguments.length > 0 ) { - - THREE.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' ); - - } - -}; - -THREE.Matrix4.prototype = { - - constructor: THREE.Matrix4, - - set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) { - - var te = this.elements; - - te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14; - te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24; - te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34; - te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44; - - return this; - - }, - - identity: function () { - - this.set( - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - copy: function ( m ) { - - this.elements.set( m.elements ); - - return this; - - }, - - extractPosition: function ( m ) { - - THREE.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' ); - return this.copyPosition( m ); - - }, - - copyPosition: function ( m ) { - - var te = this.elements; - var me = m.elements; - - te[ 12 ] = me[ 12 ]; - te[ 13 ] = me[ 13 ]; - te[ 14 ] = me[ 14 ]; - - return this; - - }, - - extractBasis: function ( xAxis, yAxis, zAxis ) { - - var te = this.elements; - - xAxis.set( te[ 0 ], te[ 1 ], te[ 2 ] ); - yAxis.set( te[ 4 ], te[ 5 ], te[ 6 ] ); - zAxis.set( te[ 8 ], te[ 9 ], te[ 10 ] ); - - return this; - - }, - - makeBasis: function ( xAxis, yAxis, zAxis ) { - - this.set( - xAxis.x, yAxis.x, zAxis.x, 0, - xAxis.y, yAxis.y, zAxis.y, 0, - xAxis.z, yAxis.z, zAxis.z, 0, - 0, 0, 0, 1 - ); - - return this; - - }, - - extractRotation: function () { - - var v1 = new THREE.Vector3(); - - return function ( m ) { - - var te = this.elements; - var me = m.elements; - - var scaleX = 1 / v1.set( me[ 0 ], me[ 1 ], me[ 2 ] ).length(); - var scaleY = 1 / v1.set( me[ 4 ], me[ 5 ], me[ 6 ] ).length(); - var scaleZ = 1 / v1.set( me[ 8 ], me[ 9 ], me[ 10 ] ).length(); - - te[ 0 ] = me[ 0 ] * scaleX; - te[ 1 ] = me[ 1 ] * scaleX; - te[ 2 ] = me[ 2 ] * scaleX; - - te[ 4 ] = me[ 4 ] * scaleY; - te[ 5 ] = me[ 5 ] * scaleY; - te[ 6 ] = me[ 6 ] * scaleY; - - te[ 8 ] = me[ 8 ] * scaleZ; - te[ 9 ] = me[ 9 ] * scaleZ; - te[ 10 ] = me[ 10 ] * scaleZ; - - return this; - - }; - - }(), - - makeRotationFromEuler: function ( euler ) { - - if ( euler instanceof THREE.Euler === false ) { - - THREE.error( 'THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' ); - - } - - var te = this.elements; - - var x = euler.x, y = euler.y, z = euler.z; - var a = Math.cos( x ), b = Math.sin( x ); - var c = Math.cos( y ), d = Math.sin( y ); - var e = Math.cos( z ), f = Math.sin( z ); - - if ( euler.order === 'XYZ' ) { - - var ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[ 0 ] = c * e; - te[ 4 ] = - c * f; - te[ 8 ] = d; - - te[ 1 ] = af + be * d; - te[ 5 ] = ae - bf * d; - te[ 9 ] = - b * c; - - te[ 2 ] = bf - ae * d; - te[ 6 ] = be + af * d; - te[ 10 ] = a * c; - - } else if ( euler.order === 'YXZ' ) { - - var ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[ 0 ] = ce + df * b; - te[ 4 ] = de * b - cf; - te[ 8 ] = a * d; - - te[ 1 ] = a * f; - te[ 5 ] = a * e; - te[ 9 ] = - b; - - te[ 2 ] = cf * b - de; - te[ 6 ] = df + ce * b; - te[ 10 ] = a * c; - - } else if ( euler.order === 'ZXY' ) { - - var ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[ 0 ] = ce - df * b; - te[ 4 ] = - a * f; - te[ 8 ] = de + cf * b; - - te[ 1 ] = cf + de * b; - te[ 5 ] = a * e; - te[ 9 ] = df - ce * b; - - te[ 2 ] = - a * d; - te[ 6 ] = b; - te[ 10 ] = a * c; - - } else if ( euler.order === 'ZYX' ) { - - var ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[ 0 ] = c * e; - te[ 4 ] = be * d - af; - te[ 8 ] = ae * d + bf; - - te[ 1 ] = c * f; - te[ 5 ] = bf * d + ae; - te[ 9 ] = af * d - be; - - te[ 2 ] = - d; - te[ 6 ] = b * c; - te[ 10 ] = a * c; - - } else if ( euler.order === 'YZX' ) { - - var ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[ 0 ] = c * e; - te[ 4 ] = bd - ac * f; - te[ 8 ] = bc * f + ad; - - te[ 1 ] = f; - te[ 5 ] = a * e; - te[ 9 ] = - b * e; - - te[ 2 ] = - d * e; - te[ 6 ] = ad * f + bc; - te[ 10 ] = ac - bd * f; - - } else if ( euler.order === 'XZY' ) { - - var ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[ 0 ] = c * e; - te[ 4 ] = - f; - te[ 8 ] = d * e; - - te[ 1 ] = ac * f + bd; - te[ 5 ] = a * e; - te[ 9 ] = ad * f - bc; - - te[ 2 ] = bc * f - ad; - te[ 6 ] = b * e; - te[ 10 ] = bd * f + ac; - - } - - // last column - te[ 3 ] = 0; - te[ 7 ] = 0; - te[ 11 ] = 0; - - // bottom row - te[ 12 ] = 0; - te[ 13 ] = 0; - te[ 14 ] = 0; - te[ 15 ] = 1; - - return this; - - }, - - setRotationFromQuaternion: function ( q ) { - - THREE.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' ); - - return this.makeRotationFromQuaternion( q ); - - }, - - makeRotationFromQuaternion: function ( q ) { - - var te = this.elements; - - var x = q.x, y = q.y, z = q.z, w = q.w; - var x2 = x + x, y2 = y + y, z2 = z + z; - var xx = x * x2, xy = x * y2, xz = x * z2; - var yy = y * y2, yz = y * z2, zz = z * z2; - var wx = w * x2, wy = w * y2, wz = w * z2; - - te[ 0 ] = 1 - ( yy + zz ); - te[ 4 ] = xy - wz; - te[ 8 ] = xz + wy; - - te[ 1 ] = xy + wz; - te[ 5 ] = 1 - ( xx + zz ); - te[ 9 ] = yz - wx; - - te[ 2 ] = xz - wy; - te[ 6 ] = yz + wx; - te[ 10 ] = 1 - ( xx + yy ); - - // last column - te[ 3 ] = 0; - te[ 7 ] = 0; - te[ 11 ] = 0; - - // bottom row - te[ 12 ] = 0; - te[ 13 ] = 0; - te[ 14 ] = 0; - te[ 15 ] = 1; - - return this; - - }, - - lookAt: function () { - - var x = new THREE.Vector3(); - var y = new THREE.Vector3(); - var z = new THREE.Vector3(); - - return function ( eye, target, up ) { - - var te = this.elements; - - z.subVectors( eye, target ).normalize(); - - if ( z.length() === 0 ) { - - z.z = 1; - - } - - x.crossVectors( up, z ).normalize(); - - if ( x.length() === 0 ) { - - z.x += 0.0001; - x.crossVectors( up, z ).normalize(); - - } - - y.crossVectors( z, x ); - - - te[ 0 ] = x.x; te[ 4 ] = y.x; te[ 8 ] = z.x; - te[ 1 ] = x.y; te[ 5 ] = y.y; te[ 9 ] = z.y; - te[ 2 ] = x.z; te[ 6 ] = y.z; te[ 10 ] = z.z; - - return this; - - }; - - }(), - - multiply: function ( m, n ) { - - if ( n !== undefined ) { - - THREE.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' ); - return this.multiplyMatrices( m, n ); - - } - - return this.multiplyMatrices( this, m ); - - }, - - multiplyMatrices: function ( a, b ) { - - var ae = a.elements; - var be = b.elements; - var te = this.elements; - - var a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ]; - var a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ]; - var a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ]; - var a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ]; - - var b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ]; - var b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ]; - var b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ]; - var b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ]; - - te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; - te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; - te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; - te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44; - - te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41; - te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42; - te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43; - te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44; - - te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41; - te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42; - te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43; - te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44; - - te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41; - te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42; - te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; - te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; - - return this; - - }, - - multiplyToArray: function ( a, b, r ) { - - var te = this.elements; - - this.multiplyMatrices( a, b ); - - r[ 0 ] = te[ 0 ]; r[ 1 ] = te[ 1 ]; r[ 2 ] = te[ 2 ]; r[ 3 ] = te[ 3 ]; - r[ 4 ] = te[ 4 ]; r[ 5 ] = te[ 5 ]; r[ 6 ] = te[ 6 ]; r[ 7 ] = te[ 7 ]; - r[ 8 ] = te[ 8 ]; r[ 9 ] = te[ 9 ]; r[ 10 ] = te[ 10 ]; r[ 11 ] = te[ 11 ]; - r[ 12 ] = te[ 12 ]; r[ 13 ] = te[ 13 ]; r[ 14 ] = te[ 14 ]; r[ 15 ] = te[ 15 ]; - - return this; - - }, - - multiplyScalar: function ( s ) { - - var te = this.elements; - - te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s; - te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s; - te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s; - te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s; - - return this; - - }, - - multiplyVector3: function ( vector ) { - - THREE.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' ); - return vector.applyProjection( this ); - - }, - - multiplyVector4: function ( vector ) { - - THREE.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - - }, - - multiplyVector3Array: function ( a ) { - - THREE.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' ); - return this.applyToVector3Array( a ); - - }, - - applyToVector3Array: function () { - - var v1 = new THREE.Vector3(); - - return function ( array, offset, length ) { - - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = array.length; - - for ( var i = 0, j = offset; i < length; i += 3, j += 3 ) { - - v1.x = array[ j ]; - v1.y = array[ j + 1 ]; - v1.z = array[ j + 2 ]; - - v1.applyMatrix4( this ); - - array[ j ] = v1.x; - array[ j + 1 ] = v1.y; - array[ j + 2 ] = v1.z; - - } - - return array; - - }; - - }(), - - rotateAxis: function ( v ) { - - THREE.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' ); - - v.transformDirection( this ); - - }, - - crossVector: function ( vector ) { - - THREE.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - - }, - - determinant: function () { - - var te = this.elements; - - var n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ]; - var n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ]; - var n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ]; - var n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ]; - - //TODO: make this more efficient - //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm ) - - return ( - n41 * ( - + n14 * n23 * n32 - - n13 * n24 * n32 - - n14 * n22 * n33 - + n12 * n24 * n33 - + n13 * n22 * n34 - - n12 * n23 * n34 - ) + - n42 * ( - + n11 * n23 * n34 - - n11 * n24 * n33 - + n14 * n21 * n33 - - n13 * n21 * n34 - + n13 * n24 * n31 - - n14 * n23 * n31 - ) + - n43 * ( - + n11 * n24 * n32 - - n11 * n22 * n34 - - n14 * n21 * n32 - + n12 * n21 * n34 - + n14 * n22 * n31 - - n12 * n24 * n31 - ) + - n44 * ( - - n13 * n22 * n31 - - n11 * n23 * n32 - + n11 * n22 * n33 - + n13 * n21 * n32 - - n12 * n21 * n33 - + n12 * n23 * n31 - ) - - ); - - }, - - transpose: function () { - - var te = this.elements; - var tmp; - - tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp; - tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp; - tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp; - - tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp; - tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp; - tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp; - - return this; - - }, - - flattenToArrayOffset: function ( array, offset ) { - - var te = this.elements; - - array[ offset ] = te[ 0 ]; - array[ offset + 1 ] = te[ 1 ]; - array[ offset + 2 ] = te[ 2 ]; - array[ offset + 3 ] = te[ 3 ]; - - array[ offset + 4 ] = te[ 4 ]; - array[ offset + 5 ] = te[ 5 ]; - array[ offset + 6 ] = te[ 6 ]; - array[ offset + 7 ] = te[ 7 ]; - - array[ offset + 8 ] = te[ 8 ]; - array[ offset + 9 ] = te[ 9 ]; - array[ offset + 10 ] = te[ 10 ]; - array[ offset + 11 ] = te[ 11 ]; - - array[ offset + 12 ] = te[ 12 ]; - array[ offset + 13 ] = te[ 13 ]; - array[ offset + 14 ] = te[ 14 ]; - array[ offset + 15 ] = te[ 15 ]; - - return array; - - }, - - getPosition: function () { - - var v1 = new THREE.Vector3(); - - return function () { - - THREE.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' ); - - var te = this.elements; - return v1.set( te[ 12 ], te[ 13 ], te[ 14 ] ); - - }; - - }(), - - setPosition: function ( v ) { - - var te = this.elements; - - te[ 12 ] = v.x; - te[ 13 ] = v.y; - te[ 14 ] = v.z; - - return this; - - }, - - getInverse: function ( m, throwOnInvertible ) { - - // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm - var te = this.elements; - var me = m.elements; - - var n11 = me[ 0 ], n12 = me[ 4 ], n13 = me[ 8 ], n14 = me[ 12 ]; - var n21 = me[ 1 ], n22 = me[ 5 ], n23 = me[ 9 ], n24 = me[ 13 ]; - var n31 = me[ 2 ], n32 = me[ 6 ], n33 = me[ 10 ], n34 = me[ 14 ]; - var n41 = me[ 3 ], n42 = me[ 7 ], n43 = me[ 11 ], n44 = me[ 15 ]; - - te[ 0 ] = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44; - te[ 4 ] = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44; - te[ 8 ] = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44; - te[ 12 ] = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; - te[ 1 ] = n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44; - te[ 5 ] = n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44; - te[ 9 ] = n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44; - te[ 13 ] = n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34; - te[ 2 ] = n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44; - te[ 6 ] = n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44; - te[ 10 ] = n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44; - te[ 14 ] = n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34; - te[ 3 ] = n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43; - te[ 7 ] = n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43; - te[ 11 ] = n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43; - te[ 15 ] = n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33; - - var det = n11 * te[ 0 ] + n21 * te[ 4 ] + n31 * te[ 8 ] + n41 * te[ 12 ]; - - if ( det == 0 ) { - - var msg = "THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"; - - if ( throwOnInvertible || false ) { - - throw new Error( msg ); - - } else { - - THREE.warn( msg ); - - } - - this.identity(); - - return this; - } - - this.multiplyScalar( 1 / det ); - - return this; - - }, - - translate: function ( v ) { - - THREE.error( 'THREE.Matrix4: .translate() has been removed.' ); - - }, - - rotateX: function ( angle ) { - - THREE.error( 'THREE.Matrix4: .rotateX() has been removed.' ); - - }, - - rotateY: function ( angle ) { - - THREE.error( 'THREE.Matrix4: .rotateY() has been removed.' ); - - }, - - rotateZ: function ( angle ) { - - THREE.error( 'THREE.Matrix4: .rotateZ() has been removed.' ); - - }, - - rotateByAxis: function ( axis, angle ) { - - THREE.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' ); - - }, - - scale: function ( v ) { - - var te = this.elements; - var x = v.x, y = v.y, z = v.z; - - te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z; - te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z; - te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z; - te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z; - - return this; - - }, - - getMaxScaleOnAxis: function () { - - var te = this.elements; - - var scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ]; - var scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ]; - var scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ]; - - return Math.sqrt( Math.max( scaleXSq, Math.max( scaleYSq, scaleZSq ) ) ); - - }, - - makeTranslation: function ( x, y, z ) { - - this.set( - - 1, 0, 0, x, - 0, 1, 0, y, - 0, 0, 1, z, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationX: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - 1, 0, 0, 0, - 0, c, - s, 0, - 0, s, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationY: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, 0, s, 0, - 0, 1, 0, 0, - - s, 0, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationZ: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, - s, 0, 0, - s, c, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationAxis: function ( axis, angle ) { - - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - var c = Math.cos( angle ); - var s = Math.sin( angle ); - var t = 1 - c; - var x = axis.x, y = axis.y, z = axis.z; - var tx = t * x, ty = t * y; - - this.set( - - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeScale: function ( x, y, z ) { - - this.set( - - x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - compose: function ( position, quaternion, scale ) { - - this.makeRotationFromQuaternion( quaternion ); - this.scale( scale ); - this.setPosition( position ); - - return this; - - }, - - decompose: function () { - - var vector = new THREE.Vector3(); - var matrix = new THREE.Matrix4(); - - return function ( position, quaternion, scale ) { - - var te = this.elements; - - var sx = vector.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length(); - var sy = vector.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length(); - var sz = vector.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length(); - - // if determine is negative, we need to invert one scale - var det = this.determinant(); - if ( det < 0 ) { - sx = - sx; - } - - position.x = te[ 12 ]; - position.y = te[ 13 ]; - position.z = te[ 14 ]; - - // scale the rotation part - - matrix.elements.set( this.elements ); // at this point matrix is incomplete so we can't use .copy() - - var invSX = 1 / sx; - var invSY = 1 / sy; - var invSZ = 1 / sz; - - matrix.elements[ 0 ] *= invSX; - matrix.elements[ 1 ] *= invSX; - matrix.elements[ 2 ] *= invSX; - - matrix.elements[ 4 ] *= invSY; - matrix.elements[ 5 ] *= invSY; - matrix.elements[ 6 ] *= invSY; - - matrix.elements[ 8 ] *= invSZ; - matrix.elements[ 9 ] *= invSZ; - matrix.elements[ 10 ] *= invSZ; - - quaternion.setFromRotationMatrix( matrix ); - - scale.x = sx; - scale.y = sy; - scale.z = sz; - - return this; - - }; - - }(), - - makeFrustum: function ( left, right, bottom, top, near, far ) { - - var te = this.elements; - var x = 2 * near / ( right - left ); - var y = 2 * near / ( top - bottom ); - - var a = ( right + left ) / ( right - left ); - var b = ( top + bottom ) / ( top - bottom ); - var c = - ( far + near ) / ( far - near ); - var d = - 2 * far * near / ( far - near ); - - te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0; - te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0; - te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d; - te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0; - - return this; - - }, - - makePerspective: function ( fov, aspect, near, far ) { - - var ymax = near * Math.tan( THREE.Math.degToRad( fov * 0.5 ) ); - var ymin = - ymax; - var xmin = ymin * aspect; - var xmax = ymax * aspect; - - return this.makeFrustum( xmin, xmax, ymin, ymax, near, far ); - - }, - - makeOrthographic: function ( left, right, top, bottom, near, far ) { - - var te = this.elements; - var w = right - left; - var h = top - bottom; - var p = far - near; - - var x = ( right + left ) / w; - var y = ( top + bottom ) / h; - var z = ( far + near ) / p; - - te[ 0 ] = 2 / w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x; - te[ 1 ] = 0; te[ 5 ] = 2 / h; te[ 9 ] = 0; te[ 13 ] = - y; - te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 / p; te[ 14 ] = - z; - te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1; - - return this; - - }, - - fromArray: function ( array ) { - - this.elements.set( array ); - - return this; - - }, - - toArray: function () { - - var te = this.elements; - - return [ - te[ 0 ], te[ 1 ], te[ 2 ], te[ 3 ], - te[ 4 ], te[ 5 ], te[ 6 ], te[ 7 ], - te[ 8 ], te[ 9 ], te[ 10 ], te[ 11 ], - te[ 12 ], te[ 13 ], te[ 14 ], te[ 15 ] - ]; - - }, - - clone: function () { - - return new THREE.Matrix4().fromArray( this.elements ); - - } - -}; - -// File:src/math/Ray.js - -/** - * @author bhouston / http://exocortex.com - */ - -THREE.Ray = function ( origin, direction ) { - - this.origin = ( origin !== undefined ) ? origin : new THREE.Vector3(); - this.direction = ( direction !== undefined ) ? direction : new THREE.Vector3(); - -}; - -THREE.Ray.prototype = { - - constructor: THREE.Ray, - - set: function ( origin, direction ) { - - this.origin.copy( origin ); - this.direction.copy( direction ); - - return this; - - }, - - copy: function ( ray ) { - - this.origin.copy( ray.origin ); - this.direction.copy( ray.direction ); - - return this; - - }, - - at: function ( t, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - return result.copy( this.direction ).multiplyScalar( t ).add( this.origin ); - - }, - - recast: function () { - - var v1 = new THREE.Vector3(); - - return function ( t ) { - - this.origin.copy( this.at( t, v1 ) ); - - return this; - - }; - - }(), - - closestPointToPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - result.subVectors( point, this.origin ); - var directionDistance = result.dot( this.direction ); - - if ( directionDistance < 0 ) { - - return result.copy( this.origin ); - - } - - return result.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - }, - - distanceToPoint: function () { - - var v1 = new THREE.Vector3(); - - return function ( point ) { - - var directionDistance = v1.subVectors( point, this.origin ).dot( this.direction ); - - // point behind the ray - - if ( directionDistance < 0 ) { - - return this.origin.distanceTo( point ); - - } - - v1.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - return v1.distanceTo( point ); - - }; - - }(), - - distanceSqToSegment: function () { - - var segCenter = new THREE.Vector3(); - var segDir = new THREE.Vector3(); - var diff = new THREE.Vector3(); - - return function ( v0, v1, optionalPointOnRay, optionalPointOnSegment ) { - - // from http://www.geometrictools.com/LibMathematics/Distance/Wm5DistRay3Segment3.cpp - // It returns the min distance between the ray and the segment - // defined by v0 and v1 - // It can also set two optional targets : - // - The closest point on the ray - // - The closest point on the segment - - segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 ); - segDir.copy( v1 ).sub( v0 ).normalize(); - diff.copy( this.origin ).sub( segCenter ); - - var segExtent = v0.distanceTo( v1 ) * 0.5; - var a01 = - this.direction.dot( segDir ); - var b0 = diff.dot( this.direction ); - var b1 = - diff.dot( segDir ); - var c = diff.lengthSq(); - var det = Math.abs( 1 - a01 * a01 ); - var s0, s1, sqrDist, extDet; - - if ( det > 0 ) { - - // The ray and segment are not parallel. - - s0 = a01 * b1 - b0; - s1 = a01 * b0 - b1; - extDet = segExtent * det; - - if ( s0 >= 0 ) { - - if ( s1 >= - extDet ) { - - if ( s1 <= extDet ) { - - // region 0 - // Minimum at interior points of ray and segment. - - var invDet = 1 / det; - s0 *= invDet; - s1 *= invDet; - sqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c; - - } else { - - // region 1 - - s1 = segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - // region 5 - - s1 = - segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - if ( s1 <= - extDet ) { - - // region 4 - - s0 = Math.max( 0, - ( - a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } else if ( s1 <= extDet ) { - - // region 3 - - s0 = 0; - s1 = Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = s1 * ( s1 + 2 * b1 ) + c; - - } else { - - // region 2 - - s0 = Math.max( 0, - ( a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } - - } else { - - // Ray and segment are parallel. - - s1 = ( a01 > 0 ) ? - segExtent : segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - if ( optionalPointOnRay ) { - - optionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin ); - - } - - if ( optionalPointOnSegment ) { - - optionalPointOnSegment.copy( segDir ).multiplyScalar( s1 ).add( segCenter ); - - } - - return sqrDist; - - }; - - }(), - - - isIntersectionSphere: function ( sphere ) { - - return this.distanceToPoint( sphere.center ) <= sphere.radius; - - }, - - intersectSphere: function () { - - // from http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-sphere-intersection/ - - var v1 = new THREE.Vector3(); - - return function ( sphere, optionalTarget ) { - - v1.subVectors( sphere.center, this.origin ); - - var tca = v1.dot( this.direction ); - - var d2 = v1.dot( v1 ) - tca * tca; - - var radius2 = sphere.radius * sphere.radius; - - if ( d2 > radius2 ) return null; - - var thc = Math.sqrt( radius2 - d2 ); - - // t0 = first intersect point - entrance on front of sphere - var t0 = tca - thc; - - // t1 = second intersect point - exit point on back of sphere - var t1 = tca + thc; - - // test to see if both t0 and t1 are behind the ray - if so, return null - if ( t0 < 0 && t1 < 0 ) return null; - - // test to see if t0 is behind the ray: - // if it is, the ray is inside the sphere, so return the second exit point scaled by t1, - // in order to always return an intersect point that is in front of the ray. - if ( t0 < 0 ) return this.at( t1, optionalTarget ); - - // else t0 is in front of the ray, so return the first collision point scaled by t0 - return this.at( t0, optionalTarget ); - - } - - }(), - - isIntersectionPlane: function ( plane ) { - - // check if the ray lies on the plane first - - var distToPoint = plane.distanceToPoint( this.origin ); - - if ( distToPoint === 0 ) { - - return true; - - } - - var denominator = plane.normal.dot( this.direction ); - - if ( denominator * distToPoint < 0 ) { - - return true; - - } - - // ray origin is behind the plane (and is pointing behind it) - - return false; - - }, - - distanceToPlane: function ( plane ) { - - var denominator = plane.normal.dot( this.direction ); - if ( denominator == 0 ) { - - // line is coplanar, return origin - if ( plane.distanceToPoint( this.origin ) == 0 ) { - - return 0; - - } - - // Null is preferable to undefined since undefined means.... it is undefined - - return null; - - } - - var t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator; - - // Return if the ray never intersects the plane - - return t >= 0 ? t : null; - - }, - - intersectPlane: function ( plane, optionalTarget ) { - - var t = this.distanceToPlane( plane ); - - if ( t === null ) { - - return null; - } - - return this.at( t, optionalTarget ); - - }, - - isIntersectionBox: function () { - - var v = new THREE.Vector3(); - - return function ( box ) { - - return this.intersectBox( box, v ) !== null; - - }; - - }(), - - intersectBox: function ( box, optionalTarget ) { - - // http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/ - - var tmin,tmax,tymin,tymax,tzmin,tzmax; - - var invdirx = 1 / this.direction.x, - invdiry = 1 / this.direction.y, - invdirz = 1 / this.direction.z; - - var origin = this.origin; - - if ( invdirx >= 0 ) { - - tmin = ( box.min.x - origin.x ) * invdirx; - tmax = ( box.max.x - origin.x ) * invdirx; - - } else { - - tmin = ( box.max.x - origin.x ) * invdirx; - tmax = ( box.min.x - origin.x ) * invdirx; - } - - if ( invdiry >= 0 ) { - - tymin = ( box.min.y - origin.y ) * invdiry; - tymax = ( box.max.y - origin.y ) * invdiry; - - } else { - - tymin = ( box.max.y - origin.y ) * invdiry; - tymax = ( box.min.y - origin.y ) * invdiry; - } - - if ( ( tmin > tymax ) || ( tymin > tmax ) ) return null; - - // These lines also handle the case where tmin or tmax is NaN - // (result of 0 * Infinity). x !== x returns true if x is NaN - - if ( tymin > tmin || tmin !== tmin ) tmin = tymin; - - if ( tymax < tmax || tmax !== tmax ) tmax = tymax; - - if ( invdirz >= 0 ) { - - tzmin = ( box.min.z - origin.z ) * invdirz; - tzmax = ( box.max.z - origin.z ) * invdirz; - - } else { - - tzmin = ( box.max.z - origin.z ) * invdirz; - tzmax = ( box.min.z - origin.z ) * invdirz; - } - - if ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null; - - if ( tzmin > tmin || tmin !== tmin ) tmin = tzmin; - - if ( tzmax < tmax || tmax !== tmax ) tmax = tzmax; - - //return point closest to the ray (positive side) - - if ( tmax < 0 ) return null; - - return this.at( tmin >= 0 ? tmin : tmax, optionalTarget ); - - }, - - intersectTriangle: function () { - - // Compute the offset origin, edges, and normal. - var diff = new THREE.Vector3(); - var edge1 = new THREE.Vector3(); - var edge2 = new THREE.Vector3(); - var normal = new THREE.Vector3(); - - return function ( a, b, c, backfaceCulling, optionalTarget ) { - - // from http://www.geometrictools.com/LibMathematics/Intersection/Wm5IntrRay3Triangle3.cpp - - edge1.subVectors( b, a ); - edge2.subVectors( c, a ); - normal.crossVectors( edge1, edge2 ); - - // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, - // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by - // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2)) - // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q)) - // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N) - var DdN = this.direction.dot( normal ); - var sign; - - if ( DdN > 0 ) { - - if ( backfaceCulling ) return null; - sign = 1; - - } else if ( DdN < 0 ) { - - sign = - 1; - DdN = - DdN; - - } else { - - return null; - - } - - diff.subVectors( this.origin, a ); - var DdQxE2 = sign * this.direction.dot( edge2.crossVectors( diff, edge2 ) ); - - // b1 < 0, no intersection - if ( DdQxE2 < 0 ) { - - return null; - - } - - var DdE1xQ = sign * this.direction.dot( edge1.cross( diff ) ); - - // b2 < 0, no intersection - if ( DdE1xQ < 0 ) { - - return null; - - } - - // b1+b2 > 1, no intersection - if ( DdQxE2 + DdE1xQ > DdN ) { - - return null; - - } - - // Line intersects triangle, check if ray does. - var QdN = - sign * diff.dot( normal ); - - // t < 0, no intersection - if ( QdN < 0 ) { - - return null; - - } - - // Ray intersects triangle. - return this.at( QdN / DdN, optionalTarget ); - - }; - - }(), - - applyMatrix4: function ( matrix4 ) { - - this.direction.add( this.origin ).applyMatrix4( matrix4 ); - this.origin.applyMatrix4( matrix4 ); - this.direction.sub( this.origin ); - this.direction.normalize(); - - return this; - }, - - equals: function ( ray ) { - - return ray.origin.equals( this.origin ) && ray.direction.equals( this.direction ); - - }, - - clone: function () { - - return new THREE.Ray().copy( this ); - - } - -}; - -// File:src/math/Sphere.js - -/** - * @author bhouston / http://exocortex.com - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Sphere = function ( center, radius ) { - - this.center = ( center !== undefined ) ? center : new THREE.Vector3(); - this.radius = ( radius !== undefined ) ? radius : 0; - -}; - -THREE.Sphere.prototype = { - - constructor: THREE.Sphere, - - set: function ( center, radius ) { - - this.center.copy( center ); - this.radius = radius; - - return this; - }, - - setFromPoints: function () { - - var box = new THREE.Box3(); - - return function ( points, optionalCenter ) { - - var center = this.center; - - if ( optionalCenter !== undefined ) { - - center.copy( optionalCenter ); - - } else { - - box.setFromPoints( points ).center( center ); - - } - - var maxRadiusSq = 0; - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) ); - - } - - this.radius = Math.sqrt( maxRadiusSq ); - - return this; - - }; - - }(), - - copy: function ( sphere ) { - - this.center.copy( sphere.center ); - this.radius = sphere.radius; - - return this; - - }, - - empty: function () { - - return ( this.radius <= 0 ); - - }, - - containsPoint: function ( point ) { - - return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) ); - - }, - - distanceToPoint: function ( point ) { - - return ( point.distanceTo( this.center ) - this.radius ); - - }, - - intersectsSphere: function ( sphere ) { - - var radiusSum = this.radius + sphere.radius; - - return sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum ); - - }, - - clampPoint: function ( point, optionalTarget ) { - - var deltaLengthSq = this.center.distanceToSquared( point ); - - var result = optionalTarget || new THREE.Vector3(); - result.copy( point ); - - if ( deltaLengthSq > ( this.radius * this.radius ) ) { - - result.sub( this.center ).normalize(); - result.multiplyScalar( this.radius ).add( this.center ); - - } - - return result; - - }, - - getBoundingBox: function ( optionalTarget ) { - - var box = optionalTarget || new THREE.Box3(); - - box.set( this.center, this.center ); - box.expandByScalar( this.radius ); - - return box; - - }, - - applyMatrix4: function ( matrix ) { - - this.center.applyMatrix4( matrix ); - this.radius = this.radius * matrix.getMaxScaleOnAxis(); - - return this; - - }, - - translate: function ( offset ) { - - this.center.add( offset ); - - return this; - - }, - - equals: function ( sphere ) { - - return sphere.center.equals( this.center ) && ( sphere.radius === this.radius ); - - }, - - clone: function () { - - return new THREE.Sphere().copy( this ); - - } - -}; - -// File:src/math/Frustum.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author bhouston / http://exocortex.com - */ - -THREE.Frustum = function ( p0, p1, p2, p3, p4, p5 ) { - - this.planes = [ - - ( p0 !== undefined ) ? p0 : new THREE.Plane(), - ( p1 !== undefined ) ? p1 : new THREE.Plane(), - ( p2 !== undefined ) ? p2 : new THREE.Plane(), - ( p3 !== undefined ) ? p3 : new THREE.Plane(), - ( p4 !== undefined ) ? p4 : new THREE.Plane(), - ( p5 !== undefined ) ? p5 : new THREE.Plane() - - ]; - -}; - -THREE.Frustum.prototype = { - - constructor: THREE.Frustum, - - set: function ( p0, p1, p2, p3, p4, p5 ) { - - var planes = this.planes; - - planes[ 0 ].copy( p0 ); - planes[ 1 ].copy( p1 ); - planes[ 2 ].copy( p2 ); - planes[ 3 ].copy( p3 ); - planes[ 4 ].copy( p4 ); - planes[ 5 ].copy( p5 ); - - return this; - - }, - - copy: function ( frustum ) { - - var planes = this.planes; - - for ( var i = 0; i < 6; i ++ ) { - - planes[ i ].copy( frustum.planes[ i ] ); - - } - - return this; - - }, - - setFromMatrix: function ( m ) { - - var planes = this.planes; - var me = m.elements; - var me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ]; - var me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ]; - var me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ]; - var me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ]; - - planes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize(); - planes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize(); - planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize(); - planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize(); - planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); - planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize(); - - return this; - - }, - - intersectsObject: function () { - - var sphere = new THREE.Sphere(); - - return function ( object ) { - - var geometry = object.geometry; - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( object.matrixWorld ); - - return this.intersectsSphere( sphere ); - - }; - - }(), - - intersectsSphere: function ( sphere ) { - - var planes = this.planes; - var center = sphere.center; - var negRadius = - sphere.radius; - - for ( var i = 0; i < 6; i ++ ) { - - var distance = planes[ i ].distanceToPoint( center ); - - if ( distance < negRadius ) { - - return false; - - } - - } - - return true; - - }, - - intersectsBox: function () { - - var p1 = new THREE.Vector3(), - p2 = new THREE.Vector3(); - - return function ( box ) { - - var planes = this.planes; - - for ( var i = 0; i < 6 ; i ++ ) { - - var plane = planes[ i ]; - - p1.x = plane.normal.x > 0 ? box.min.x : box.max.x; - p2.x = plane.normal.x > 0 ? box.max.x : box.min.x; - p1.y = plane.normal.y > 0 ? box.min.y : box.max.y; - p2.y = plane.normal.y > 0 ? box.max.y : box.min.y; - p1.z = plane.normal.z > 0 ? box.min.z : box.max.z; - p2.z = plane.normal.z > 0 ? box.max.z : box.min.z; - - var d1 = plane.distanceToPoint( p1 ); - var d2 = plane.distanceToPoint( p2 ); - - // if both outside plane, no intersection - - if ( d1 < 0 && d2 < 0 ) { - - return false; - - } - } - - return true; - }; - - }(), - - - containsPoint: function ( point ) { - - var planes = this.planes; - - for ( var i = 0; i < 6; i ++ ) { - - if ( planes[ i ].distanceToPoint( point ) < 0 ) { - - return false; - - } - - } - - return true; - - }, - - clone: function () { - - return new THREE.Frustum().copy( this ); - - } - -}; - -// File:src/math/Plane.js - -/** - * @author bhouston / http://exocortex.com - */ - -THREE.Plane = function ( normal, constant ) { - - this.normal = ( normal !== undefined ) ? normal : new THREE.Vector3( 1, 0, 0 ); - this.constant = ( constant !== undefined ) ? constant : 0; - -}; - -THREE.Plane.prototype = { - - constructor: THREE.Plane, - - set: function ( normal, constant ) { - - this.normal.copy( normal ); - this.constant = constant; - - return this; - - }, - - setComponents: function ( x, y, z, w ) { - - this.normal.set( x, y, z ); - this.constant = w; - - return this; - - }, - - setFromNormalAndCoplanarPoint: function ( normal, point ) { - - this.normal.copy( normal ); - this.constant = - point.dot( this.normal ); // must be this.normal, not normal, as this.normal is normalized - - return this; - - }, - - setFromCoplanarPoints: function () { - - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - - return function ( a, b, c ) { - - var normal = v1.subVectors( c, b ).cross( v2.subVectors( a, b ) ).normalize(); - - // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? - - this.setFromNormalAndCoplanarPoint( normal, a ); - - return this; - - }; - - }(), - - - copy: function ( plane ) { - - this.normal.copy( plane.normal ); - this.constant = plane.constant; - - return this; - - }, - - normalize: function () { - - // Note: will lead to a divide by zero if the plane is invalid. - - var inverseNormalLength = 1.0 / this.normal.length(); - this.normal.multiplyScalar( inverseNormalLength ); - this.constant *= inverseNormalLength; - - return this; - - }, - - negate: function () { - - this.constant *= - 1; - this.normal.negate(); - - return this; - - }, - - distanceToPoint: function ( point ) { - - return this.normal.dot( point ) + this.constant; - - }, - - distanceToSphere: function ( sphere ) { - - return this.distanceToPoint( sphere.center ) - sphere.radius; - - }, - - projectPoint: function ( point, optionalTarget ) { - - return this.orthoPoint( point, optionalTarget ).sub( point ).negate(); - - }, - - orthoPoint: function ( point, optionalTarget ) { - - var perpendicularMagnitude = this.distanceToPoint( point ); - - var result = optionalTarget || new THREE.Vector3(); - return result.copy( this.normal ).multiplyScalar( perpendicularMagnitude ); - - }, - - isIntersectionLine: function ( line ) { - - // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it. - - var startSign = this.distanceToPoint( line.start ); - var endSign = this.distanceToPoint( line.end ); - - return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 ); - - }, - - intersectLine: function () { - - var v1 = new THREE.Vector3(); - - return function ( line, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - var direction = line.delta( v1 ); - - var denominator = this.normal.dot( direction ); - - if ( denominator == 0 ) { - - // line is coplanar, return origin - if ( this.distanceToPoint( line.start ) == 0 ) { - - return result.copy( line.start ); - - } - - // Unsure if this is the correct method to handle this case. - return undefined; - - } - - var t = - ( line.start.dot( this.normal ) + this.constant ) / denominator; - - if ( t < 0 || t > 1 ) { - - return undefined; - - } - - return result.copy( direction ).multiplyScalar( t ).add( line.start ); - - }; - - }(), - - - coplanarPoint: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.copy( this.normal ).multiplyScalar( - this.constant ); - - }, - - applyMatrix4: function () { - - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - var m1 = new THREE.Matrix3(); - - return function ( matrix, optionalNormalMatrix ) { - - // compute new normal based on theory here: - // http://www.songho.ca/opengl/gl_normaltransform.html - var normalMatrix = optionalNormalMatrix || m1.getNormalMatrix( matrix ); - var newNormal = v1.copy( this.normal ).applyMatrix3( normalMatrix ); - - var newCoplanarPoint = this.coplanarPoint( v2 ); - newCoplanarPoint.applyMatrix4( matrix ); - - this.setFromNormalAndCoplanarPoint( newNormal, newCoplanarPoint ); - - return this; - - }; - - }(), - - translate: function ( offset ) { - - this.constant = this.constant - offset.dot( this.normal ); - - return this; - - }, - - equals: function ( plane ) { - - return plane.normal.equals( this.normal ) && ( plane.constant == this.constant ); - - }, - - clone: function () { - - return new THREE.Plane().copy( this ); - - } - -}; - -// File:src/math/Math.js - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Math = { - - generateUUID: function () { - - // http://www.broofa.com/Tools/Math.uuid.htm - - var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split( '' ); - var uuid = new Array( 36 ); - var rnd = 0, r; - - return function () { - - for ( var i = 0; i < 36; i ++ ) { - - if ( i == 8 || i == 13 || i == 18 || i == 23 ) { - - uuid[ i ] = '-'; - - } else if ( i == 14 ) { - - uuid[ i ] = '4'; - - } else { - - if ( rnd <= 0x02 ) rnd = 0x2000000 + ( Math.random() * 0x1000000 ) | 0; - r = rnd & 0xf; - rnd = rnd >> 4; - uuid[ i ] = chars[ ( i == 19 ) ? ( r & 0x3 ) | 0x8 : r ]; - - } - } - - return uuid.join( '' ); - - }; - - }(), - - // Clamp value to range <a, b> - - clamp: function ( x, a, b ) { - - return ( x < a ) ? a : ( ( x > b ) ? b : x ); - - }, - - // Clamp value to range <a, inf) - - clampBottom: function ( x, a ) { - - return x < a ? a : x; - - }, - - // Linear mapping from range <a1, a2> to range <b1, b2> - - mapLinear: function ( x, a1, a2, b1, b2 ) { - - return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 ); - - }, - - // http://en.wikipedia.org/wiki/Smoothstep - - smoothstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min ) / ( max - min ); - - return x * x * ( 3 - 2 * x ); - - }, - - smootherstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min ) / ( max - min ); - - return x * x * x * ( x * ( x * 6 - 15 ) + 10 ); - - }, - - // Random float from <0, 1> with 16 bits of randomness - // (standard Math.random() creates repetitive patterns when applied over larger space) - - random16: function () { - - return ( 65280 * Math.random() + 255 * Math.random() ) / 65535; - - }, - - // Random integer from <low, high> interval - - randInt: function ( low, high ) { - - return Math.floor( this.randFloat( low, high ) ); - - }, - - // Random float from <low, high> interval - - randFloat: function ( low, high ) { - - return low + Math.random() * ( high - low ); - - }, - - // Random float from <-range/2, range/2> interval - - randFloatSpread: function ( range ) { - - return range * ( 0.5 - Math.random() ); - - }, - - degToRad: function () { - - var degreeToRadiansFactor = Math.PI / 180; - - return function ( degrees ) { - - return degrees * degreeToRadiansFactor; - - }; - - }(), - - radToDeg: function () { - - var radianToDegreesFactor = 180 / Math.PI; - - return function ( radians ) { - - return radians * radianToDegreesFactor; - - }; - - }(), - - isPowerOfTwo: function ( value ) { - - return ( value & ( value - 1 ) ) === 0 && value !== 0; - - }, - - nextPowerOfTwo: function ( value ) { - - value --; - value |= value >> 1; - value |= value >> 2; - value |= value >> 4; - value |= value >> 8; - value |= value >> 16; - value ++; - - return value; - - } - -}; - -// File:src/math/Spline.js - -/** - * Spline from Tween.js, slightly optimized (and trashed) - * http://sole.github.com/tween.js/examples/05_spline.html - * - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Spline = function ( points ) { - - this.points = points; - - var c = [], v3 = { x: 0, y: 0, z: 0 }, - point, intPoint, weight, w2, w3, - pa, pb, pc, pd; - - this.initFromArray = function ( a ) { - - this.points = []; - - for ( var i = 0; i < a.length; i ++ ) { - - this.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] }; - - } - - }; - - this.getPoint = function ( k ) { - - point = ( this.points.length - 1 ) * k; - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1; - c[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2; - - pa = this.points[ c[ 0 ] ]; - pb = this.points[ c[ 1 ] ]; - pc = this.points[ c[ 2 ] ]; - pd = this.points[ c[ 3 ] ]; - - w2 = weight * weight; - w3 = weight * w2; - - v3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 ); - v3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 ); - v3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 ); - - return v3; - - }; - - this.getControlPointsArray = function () { - - var i, p, l = this.points.length, - coords = []; - - for ( i = 0; i < l; i ++ ) { - - p = this.points[ i ]; - coords[ i ] = [ p.x, p.y, p.z ]; - - } - - return coords; - - }; - - // approximate length by summing linear segments - - this.getLength = function ( nSubDivisions ) { - - var i, index, nSamples, position, - point = 0, intPoint = 0, oldIntPoint = 0, - oldPosition = new THREE.Vector3(), - tmpVec = new THREE.Vector3(), - chunkLengths = [], - totalLength = 0; - - // first point has 0 length - - chunkLengths[ 0 ] = 0; - - if ( ! nSubDivisions ) nSubDivisions = 100; - - nSamples = this.points.length * nSubDivisions; - - oldPosition.copy( this.points[ 0 ] ); - - for ( i = 1; i < nSamples; i ++ ) { - - index = i / nSamples; - - position = this.getPoint( index ); - tmpVec.copy( position ); - - totalLength += tmpVec.distanceTo( oldPosition ); - - oldPosition.copy( position ); - - point = ( this.points.length - 1 ) * index; - intPoint = Math.floor( point ); - - if ( intPoint != oldIntPoint ) { - - chunkLengths[ intPoint ] = totalLength; - oldIntPoint = intPoint; - - } - - } - - // last point ends with total length - - chunkLengths[ chunkLengths.length ] = totalLength; - - return { chunks: chunkLengths, total: totalLength }; - - }; - - this.reparametrizeByArcLength = function ( samplingCoef ) { - - var i, j, - index, indexCurrent, indexNext, - realDistance, - sampling, position, - newpoints = [], - tmpVec = new THREE.Vector3(), - sl = this.getLength(); - - newpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() ); - - for ( i = 1; i < this.points.length; i ++ ) { - - //tmpVec.copy( this.points[ i - 1 ] ); - //linearDistance = tmpVec.distanceTo( this.points[ i ] ); - - realDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ]; - - sampling = Math.ceil( samplingCoef * realDistance / sl.total ); - - indexCurrent = ( i - 1 ) / ( this.points.length - 1 ); - indexNext = i / ( this.points.length - 1 ); - - for ( j = 1; j < sampling - 1; j ++ ) { - - index = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent ); - - position = this.getPoint( index ); - newpoints.push( tmpVec.copy( position ).clone() ); - - } - - newpoints.push( tmpVec.copy( this.points[ i ] ).clone() ); - - } - - this.points = newpoints; - - }; - - // Catmull-Rom - - function interpolate( p0, p1, p2, p3, t, t2, t3 ) { - - var v0 = ( p2 - p0 ) * 0.5, - v1 = ( p3 - p1 ) * 0.5; - - return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - }; - -}; - -// File:src/math/Triangle.js - -/** - * @author bhouston / http://exocortex.com - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Triangle = function ( a, b, c ) { - - this.a = ( a !== undefined ) ? a : new THREE.Vector3(); - this.b = ( b !== undefined ) ? b : new THREE.Vector3(); - this.c = ( c !== undefined ) ? c : new THREE.Vector3(); - -}; - -THREE.Triangle.normal = function () { - - var v0 = new THREE.Vector3(); - - return function ( a, b, c, optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - result.subVectors( c, b ); - v0.subVectors( a, b ); - result.cross( v0 ); - - var resultLengthSq = result.lengthSq(); - if ( resultLengthSq > 0 ) { - - return result.multiplyScalar( 1 / Math.sqrt( resultLengthSq ) ); - - } - - return result.set( 0, 0, 0 ); - - }; - -}(); - -// static/instance method to calculate barycoordinates -// based on: http://www.blackpawn.com/texts/pointinpoly/default.html -THREE.Triangle.barycoordFromPoint = function () { - - var v0 = new THREE.Vector3(); - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - - return function ( point, a, b, c, optionalTarget ) { - - v0.subVectors( c, a ); - v1.subVectors( b, a ); - v2.subVectors( point, a ); - - var dot00 = v0.dot( v0 ); - var dot01 = v0.dot( v1 ); - var dot02 = v0.dot( v2 ); - var dot11 = v1.dot( v1 ); - var dot12 = v1.dot( v2 ); - - var denom = ( dot00 * dot11 - dot01 * dot01 ); - - var result = optionalTarget || new THREE.Vector3(); - - // colinear or singular triangle - if ( denom == 0 ) { - // arbitrary location outside of triangle? - // not sure if this is the best idea, maybe should be returning undefined - return result.set( - 2, - 1, - 1 ); - } - - var invDenom = 1 / denom; - var u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom; - var v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom; - - // barycoordinates must always sum to 1 - return result.set( 1 - u - v, v, u ); - - }; - -}(); - -THREE.Triangle.containsPoint = function () { - - var v1 = new THREE.Vector3(); - - return function ( point, a, b, c ) { - - var result = THREE.Triangle.barycoordFromPoint( point, a, b, c, v1 ); - - return ( result.x >= 0 ) && ( result.y >= 0 ) && ( ( result.x + result.y ) <= 1 ); - - }; - -}(); - -THREE.Triangle.prototype = { - - constructor: THREE.Triangle, - - set: function ( a, b, c ) { - - this.a.copy( a ); - this.b.copy( b ); - this.c.copy( c ); - - return this; - - }, - - setFromPointsAndIndices: function ( points, i0, i1, i2 ) { - - this.a.copy( points[ i0 ] ); - this.b.copy( points[ i1 ] ); - this.c.copy( points[ i2 ] ); - - return this; - - }, - - copy: function ( triangle ) { - - this.a.copy( triangle.a ); - this.b.copy( triangle.b ); - this.c.copy( triangle.c ); - - return this; - - }, - - area: function () { - - var v0 = new THREE.Vector3(); - var v1 = new THREE.Vector3(); - - return function () { - - v0.subVectors( this.c, this.b ); - v1.subVectors( this.a, this.b ); - - return v0.cross( v1 ).length() * 0.5; - - }; - - }(), - - midpoint: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - return result.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 ); - - }, - - normal: function ( optionalTarget ) { - - return THREE.Triangle.normal( this.a, this.b, this.c, optionalTarget ); - - }, - - plane: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Plane(); - - return result.setFromCoplanarPoints( this.a, this.b, this.c ); - - }, - - barycoordFromPoint: function ( point, optionalTarget ) { - - return THREE.Triangle.barycoordFromPoint( point, this.a, this.b, this.c, optionalTarget ); - - }, - - containsPoint: function ( point ) { - - return THREE.Triangle.containsPoint( point, this.a, this.b, this.c ); - - }, - - equals: function ( triangle ) { - - return triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c ); - - }, - - clone: function () { - - return new THREE.Triangle().copy( this ); - - } - -}; - -// File:src/core/Clock.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Clock = function ( autoStart ) { - - this.autoStart = ( autoStart !== undefined ) ? autoStart : true; - - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - - this.running = false; - -}; - -THREE.Clock.prototype = { - - constructor: THREE.Clock, - - start: function () { - - this.startTime = self.performance !== undefined && self.performance.now !== undefined - ? self.performance.now() - : Date.now(); - - this.oldTime = this.startTime; - this.running = true; - }, - - stop: function () { - - this.getElapsedTime(); - this.running = false; - - }, - - getElapsedTime: function () { - - this.getDelta(); - return this.elapsedTime; - - }, - - getDelta: function () { - - var diff = 0; - - if ( this.autoStart && ! this.running ) { - - this.start(); - - } - - if ( this.running ) { - - var newTime = self.performance !== undefined && self.performance.now !== undefined - ? self.performance.now() - : Date.now(); - - diff = 0.001 * ( newTime - this.oldTime ); - this.oldTime = newTime; - - this.elapsedTime += diff; - - } - - return diff; - - } - -}; - -// File:src/core/EventDispatcher.js - -/** - * https://github.com/mrdoob/eventdispatcher.js/ - */ - -THREE.EventDispatcher = function () {} - -THREE.EventDispatcher.prototype = { - - constructor: THREE.EventDispatcher, - - apply: function ( object ) { - - object.addEventListener = THREE.EventDispatcher.prototype.addEventListener; - object.hasEventListener = THREE.EventDispatcher.prototype.hasEventListener; - object.removeEventListener = THREE.EventDispatcher.prototype.removeEventListener; - object.dispatchEvent = THREE.EventDispatcher.prototype.dispatchEvent; - - }, - - addEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) this._listeners = {}; - - var listeners = this._listeners; - - if ( listeners[ type ] === undefined ) { - - listeners[ type ] = []; - - } - - if ( listeners[ type ].indexOf( listener ) === - 1 ) { - - listeners[ type ].push( listener ); - - } - - }, - - hasEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return false; - - var listeners = this._listeners; - - if ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) { - - return true; - - } - - return false; - - }, - - removeEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return; - - var listeners = this._listeners; - var listenerArray = listeners[ type ]; - - if ( listenerArray !== undefined ) { - - var index = listenerArray.indexOf( listener ); - - if ( index !== - 1 ) { - - listenerArray.splice( index, 1 ); - - } - - } - - }, - - dispatchEvent: function ( event ) { - - if ( this._listeners === undefined ) return; - - var listeners = this._listeners; - var listenerArray = listeners[ event.type ]; - - if ( listenerArray !== undefined ) { - - event.target = this; - - var array = []; - var length = listenerArray.length; - - for ( var i = 0; i < length; i ++ ) { - - array[ i ] = listenerArray[ i ]; - - } - - for ( var i = 0; i < length; i ++ ) { - - array[ i ].call( this, event ); - - } - - } - - } - -}; - -// File:src/core/Raycaster.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author bhouston / http://exocortex.com/ - * @author stephomi / http://stephaneginier.com/ - */ - -( function ( THREE ) { - - THREE.Raycaster = function ( origin, direction, near, far ) { - - this.ray = new THREE.Ray( origin, direction ); - // direction is assumed to be normalized (for accurate distance calculations) - - this.near = near || 0; - this.far = far || Infinity; - - this.params = { - Sprite: {}, - Mesh: {}, - PointCloud: { threshold: 1 }, - LOD: {}, - Line: {} - }; - - }; - - var descSort = function ( a, b ) { - - return a.distance - b.distance; - - }; - - var intersectObject = function ( object, raycaster, intersects, recursive ) { - - object.raycast( raycaster, intersects ); - - if ( recursive === true ) { - - var children = object.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - intersectObject( children[ i ], raycaster, intersects, true ); - - } - - } - - }; - - // - - THREE.Raycaster.prototype = { - - constructor: THREE.Raycaster, - - precision: 0.0001, - linePrecision: 1, - - set: function ( origin, direction ) { - - // direction is assumed to be normalized (for accurate distance calculations) - - this.ray.set( origin, direction ); - - }, - - setFromCamera: function ( coords, camera ) { - - // camera is assumed _not_ to be a child of a transformed object - - if ( camera instanceof THREE.PerspectiveCamera ) { - - this.ray.origin.copy( camera.position ); - this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( camera.position ).normalize(); - - } else if ( camera instanceof THREE.OrthographicCamera ) { - - this.ray.origin.set( coords.x, coords.y, - 1 ).unproject( camera ); - this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ); - - } else { - - THREE.error( 'THREE.Raycaster: Unsupported camera type.' ); - - } - - }, - - intersectObject: function ( object, recursive ) { - - var intersects = []; - - intersectObject( object, this, intersects, recursive ); - - intersects.sort( descSort ); - - return intersects; - - }, - - intersectObjects: function ( objects, recursive ) { - - var intersects = []; - - if ( objects instanceof Array === false ) { - - THREE.warn( 'THREE.Raycaster.intersectObjects: objects is not an Array.' ); - return intersects; - - } - - for ( var i = 0, l = objects.length; i < l; i ++ ) { - - intersectObject( objects[ i ], this, intersects, recursive ); - - } - - intersects.sort( descSort ); - - return intersects; - - } - - }; - -}( THREE ) ); - -// File:src/core/Object3D.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.Object3D = function () { - - Object.defineProperty( this, 'id', { value: THREE.Object3DIdCount ++ } ); - - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - this.type = 'Object3D'; - - this.parent = undefined; - this.children = []; - - this.up = THREE.Object3D.DefaultUp.clone(); - - var position = new THREE.Vector3(); - var rotation = new THREE.Euler(); - var quaternion = new THREE.Quaternion(); - var scale = new THREE.Vector3( 1, 1, 1 ); - - var onRotationChange = function () { - quaternion.setFromEuler( rotation, false ); - }; - - var onQuaternionChange = function () { - rotation.setFromQuaternion( quaternion, undefined, false ); - }; - - rotation.onChange( onRotationChange ); - quaternion.onChange( onQuaternionChange ); - - Object.defineProperties( this, { - position: { - enumerable: true, - value: position - }, - rotation: { - enumerable: true, - value: rotation - }, - quaternion: { - enumerable: true, - value: quaternion - }, - scale: { - enumerable: true, - value: scale - } - } ); - - this.rotationAutoUpdate = true; - - this.matrix = new THREE.Matrix4(); - this.matrixWorld = new THREE.Matrix4(); - - this.matrixAutoUpdate = true; - this.matrixWorldNeedsUpdate = false; - - this.visible = true; - - this.castShadow = false; - this.receiveShadow = false; - - this.frustumCulled = true; - this.renderOrder = 0; - - this.userData = {}; - -}; - -THREE.Object3D.DefaultUp = new THREE.Vector3( 0, 1, 0 ); - -THREE.Object3D.prototype = { - - constructor: THREE.Object3D, - - get eulerOrder () { - - THREE.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' ); - - return this.rotation.order; - - }, - - set eulerOrder ( value ) { - - THREE.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' ); - - this.rotation.order = value; - - }, - - get useQuaternion () { - - THREE.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' ); - - }, - - set useQuaternion ( value ) { - - THREE.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' ); - - }, - - applyMatrix: function ( matrix ) { - - this.matrix.multiplyMatrices( matrix, this.matrix ); - - this.matrix.decompose( this.position, this.quaternion, this.scale ); - - }, - - setRotationFromAxisAngle: function ( axis, angle ) { - - // assumes axis is normalized - - this.quaternion.setFromAxisAngle( axis, angle ); - - }, - - setRotationFromEuler: function ( euler ) { - - this.quaternion.setFromEuler( euler, true ); - - }, - - setRotationFromMatrix: function ( m ) { - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - this.quaternion.setFromRotationMatrix( m ); - - }, - - setRotationFromQuaternion: function ( q ) { - - // assumes q is normalized - - this.quaternion.copy( q ); - - }, - - rotateOnAxis: function () { - - // rotate object on axis in object space - // axis is assumed to be normalized - - var q1 = new THREE.Quaternion(); - - return function ( axis, angle ) { - - q1.setFromAxisAngle( axis, angle ); - - this.quaternion.multiply( q1 ); - - return this; - - } - - }(), - - rotateX: function () { - - var v1 = new THREE.Vector3( 1, 0, 0 ); - - return function ( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - rotateY: function () { - - var v1 = new THREE.Vector3( 0, 1, 0 ); - - return function ( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - rotateZ: function () { - - var v1 = new THREE.Vector3( 0, 0, 1 ); - - return function ( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - translateOnAxis: function () { - - // translate object by distance along axis in object space - // axis is assumed to be normalized - - var v1 = new THREE.Vector3(); - - return function ( axis, distance ) { - - v1.copy( axis ).applyQuaternion( this.quaternion ); - - this.position.add( v1.multiplyScalar( distance ) ); - - return this; - - } - - }(), - - translate: function ( distance, axis ) { - - THREE.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' ); - return this.translateOnAxis( axis, distance ); - - }, - - translateX: function () { - - var v1 = new THREE.Vector3( 1, 0, 0 ); - - return function ( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - translateY: function () { - - var v1 = new THREE.Vector3( 0, 1, 0 ); - - return function ( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - translateZ: function () { - - var v1 = new THREE.Vector3( 0, 0, 1 ); - - return function ( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - localToWorld: function ( vector ) { - - return vector.applyMatrix4( this.matrixWorld ); - - }, - - worldToLocal: function () { - - var m1 = new THREE.Matrix4(); - - return function ( vector ) { - - return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) ); - - }; - - }(), - - lookAt: function () { - - // This routine does not support objects with rotated and/or translated parent(s) - - var m1 = new THREE.Matrix4(); - - return function ( vector ) { - - m1.lookAt( vector, this.position, this.up ); - - this.quaternion.setFromRotationMatrix( m1 ); - - }; - - }(), - - add: function ( object ) { - - if ( arguments.length > 1 ) { - - for ( var i = 0; i < arguments.length; i ++ ) { - - this.add( arguments[ i ] ); - - } - - return this; - - }; - - if ( object === this ) { - - THREE.error( "THREE.Object3D.add: object can't be added as a child of itself.", object ); - return this; - - } - - if ( object instanceof THREE.Object3D ) { - - if ( object.parent !== undefined ) { - - object.parent.remove( object ); - - } - - object.parent = this; - object.dispatchEvent( { type: 'added' } ); - - this.children.push( object ); - - } else { - - THREE.error( "THREE.Object3D.add: object not an instance of THREE.Object3D.", object ); - - } - - return this; - - }, - - remove: function ( object ) { - - if ( arguments.length > 1 ) { - - for ( var i = 0; i < arguments.length; i ++ ) { - - this.remove( arguments[ i ] ); - - } - - }; - - var index = this.children.indexOf( object ); - - if ( index !== - 1 ) { - - object.parent = undefined; - - object.dispatchEvent( { type: 'removed' } ); - - this.children.splice( index, 1 ); - - } - - }, - - getChildByName: function ( name ) { - - THREE.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' ); - return this.getObjectByName( name ); - - }, - - getObjectById: function ( id ) { - - return this.getObjectByProperty( 'id', id ); - - }, - - getObjectByName: function ( name ) { - - return this.getObjectByProperty( 'name', name ); - - }, - - getObjectByProperty: function ( name, value ) { - - if ( this[ name ] === value ) return this; - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - var child = this.children[ i ]; - var object = child.getObjectByProperty( name, value ); - - if ( object !== undefined ) { - - return object; - - } - - } - - return undefined; - - }, - - getWorldPosition: function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - this.updateMatrixWorld( true ); - - return result.setFromMatrixPosition( this.matrixWorld ); - - }, - - getWorldQuaternion: function () { - - var position = new THREE.Vector3(); - var scale = new THREE.Vector3(); - - return function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Quaternion(); - - this.updateMatrixWorld( true ); - - this.matrixWorld.decompose( position, result, scale ); - - return result; - - } - - }(), - - getWorldRotation: function () { - - var quaternion = new THREE.Quaternion(); - - return function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Euler(); - - this.getWorldQuaternion( quaternion ); - - return result.setFromQuaternion( quaternion, this.rotation.order, false ); - - } - - }(), - - getWorldScale: function () { - - var position = new THREE.Vector3(); - var quaternion = new THREE.Quaternion(); - - return function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - this.updateMatrixWorld( true ); - - this.matrixWorld.decompose( position, quaternion, result ); - - return result; - - } - - }(), - - getWorldDirection: function () { - - var quaternion = new THREE.Quaternion(); - - return function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - this.getWorldQuaternion( quaternion ); - - return result.set( 0, 0, 1 ).applyQuaternion( quaternion ); - - } - - }(), - - raycast: function () {}, - - traverse: function ( callback ) { - - callback( this ); - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].traverse( callback ); - - } - - }, - - traverseVisible: function ( callback ) { - - if ( this.visible === false ) return; - - callback( this ); - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].traverseVisible( callback ); - - } - - }, - - traverseAncestors: function ( callback ) { - - if ( this.parent ) { - - callback( this.parent ); - - this.parent.traverseAncestors( callback ); - - } - - }, - - updateMatrix: function () { - - this.matrix.compose( this.position, this.quaternion, this.scale ); - - this.matrixWorldNeedsUpdate = true; - - }, - - updateMatrixWorld: function ( force ) { - - if ( this.matrixAutoUpdate === true ) this.updateMatrix(); - - if ( this.matrixWorldNeedsUpdate === true || force === true ) { - - if ( this.parent === undefined ) { - - this.matrixWorld.copy( this.matrix ); - - } else { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - } - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].updateMatrixWorld( force ); - - } - - }, - - toJSON: function () { - - var output = { - metadata: { - version: 4.3, - type: 'Object', - generator: 'ObjectExporter' - } - }; - - // - - var geometries = {}; - - var parseGeometry = function ( geometry ) { - - if ( output.geometries === undefined ) { - - output.geometries = []; - - } - - if ( geometries[ geometry.uuid ] === undefined ) { - - var json = geometry.toJSON(); - - delete json.metadata; - - geometries[ geometry.uuid ] = json; - - output.geometries.push( json ); - - } - - return geometry.uuid; - - }; - - // - - var materials = {}; - - var parseMaterial = function ( material ) { - - if ( output.materials === undefined ) { - - output.materials = []; - - } - - if ( materials[ material.uuid ] === undefined ) { - - var json = material.toJSON(); - - delete json.metadata; - - materials[ material.uuid ] = json; - - output.materials.push( json ); - - } - - return material.uuid; - - }; - - // - - var parseObject = function ( object ) { - - var data = {}; - - data.uuid = object.uuid; - data.type = object.type; - - if ( object.name !== '' ) data.name = object.name; - if ( JSON.stringify( object.userData ) !== '{}' ) data.userData = object.userData; - if ( object.visible !== true ) data.visible = object.visible; - - if ( object instanceof THREE.PerspectiveCamera ) { - - data.fov = object.fov; - data.aspect = object.aspect; - data.near = object.near; - data.far = object.far; - - } else if ( object instanceof THREE.OrthographicCamera ) { - - data.left = object.left; - data.right = object.right; - data.top = object.top; - data.bottom = object.bottom; - data.near = object.near; - data.far = object.far; - - } else if ( object instanceof THREE.AmbientLight ) { - - data.color = object.color.getHex(); - - } else if ( object instanceof THREE.DirectionalLight ) { - - data.color = object.color.getHex(); - data.intensity = object.intensity; - - } else if ( object instanceof THREE.PointLight ) { - - data.color = object.color.getHex(); - data.intensity = object.intensity; - data.distance = object.distance; - data.decay = object.decay; - - } else if ( object instanceof THREE.SpotLight ) { - - data.color = object.color.getHex(); - data.intensity = object.intensity; - data.distance = object.distance; - data.angle = object.angle; - data.exponent = object.exponent; - data.decay = object.decay; - - } else if ( object instanceof THREE.HemisphereLight ) { - - data.color = object.color.getHex(); - data.groundColor = object.groundColor.getHex(); - - } else if ( object instanceof THREE.Mesh || object instanceof THREE.Line || object instanceof THREE.PointCloud ) { - - data.geometry = parseGeometry( object.geometry ); - data.material = parseMaterial( object.material ); - - if ( object instanceof THREE.Line ) data.mode = object.mode; - - } else if ( object instanceof THREE.Sprite ) { - - data.material = parseMaterial( object.material ); - - } - - data.matrix = object.matrix.toArray(); - - if ( object.children.length > 0 ) { - - data.children = []; - - for ( var i = 0; i < object.children.length; i ++ ) { - - data.children.push( parseObject( object.children[ i ] ) ); - - } - - } - - return data; - - } - - output.object = parseObject( this ); - - return output; - - }, - - clone: function ( object, recursive ) { - - if ( object === undefined ) object = new THREE.Object3D(); - if ( recursive === undefined ) recursive = true; - - object.name = this.name; - - object.up.copy( this.up ); - - object.position.copy( this.position ); - object.quaternion.copy( this.quaternion ); - object.scale.copy( this.scale ); - - object.rotationAutoUpdate = this.rotationAutoUpdate; - - object.matrix.copy( this.matrix ); - object.matrixWorld.copy( this.matrixWorld ); - - object.matrixAutoUpdate = this.matrixAutoUpdate; - object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate; - - object.visible = this.visible; - - object.castShadow = this.castShadow; - object.receiveShadow = this.receiveShadow; - - object.frustumCulled = this.frustumCulled; - - object.userData = JSON.parse( JSON.stringify( this.userData ) ); - - if ( recursive === true ) { - - for ( var i = 0; i < this.children.length; i ++ ) { - - var child = this.children[ i ]; - object.add( child.clone() ); - - } - - } - - return object; - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.Object3D.prototype ); - -THREE.Object3DIdCount = 0; - -// File:src/core/Face3.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Face3 = function ( a, b, c, normal, color, materialIndex ) { - - this.a = a; - this.b = b; - this.c = c; - - this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3(); - this.vertexNormals = normal instanceof Array ? normal : []; - - this.color = color instanceof THREE.Color ? color : new THREE.Color(); - this.vertexColors = color instanceof Array ? color : []; - - this.vertexTangents = []; - - this.materialIndex = materialIndex !== undefined ? materialIndex : 0; - -}; - -THREE.Face3.prototype = { - - constructor: THREE.Face3, - - clone: function () { - - var face = new THREE.Face3( this.a, this.b, this.c ); - - face.normal.copy( this.normal ); - face.color.copy( this.color ); - - face.materialIndex = this.materialIndex; - - for ( var i = 0, il = this.vertexNormals.length; i < il; i ++ ) { - - face.vertexNormals[ i ] = this.vertexNormals[ i ].clone(); - - } - - for ( var i = 0, il = this.vertexColors.length; i < il; i ++ ) { - - face.vertexColors[ i ] = this.vertexColors[ i ].clone(); - - } - - for ( var i = 0, il = this.vertexTangents.length; i < il; i ++ ) { - - face.vertexTangents[ i ] = this.vertexTangents[ i ].clone(); - - } - - return face; - - } - -}; - -// File:src/core/Face4.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) { - - THREE.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' ) - return new THREE.Face3( a, b, c, normal, color, materialIndex ); - -}; - -// File:src/core/BufferAttribute.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.BufferAttribute = function ( array, itemSize ) { - - this.array = array; - this.itemSize = itemSize; - - this.needsUpdate = false; - -}; - -THREE.BufferAttribute.prototype = { - - constructor: THREE.BufferAttribute, - - get length () { - - return this.array.length; - - }, - - copyAt: function ( index1, attribute, index2 ) { - - index1 *= this.itemSize; - index2 *= attribute.itemSize; - - for ( var i = 0, l = this.itemSize; i < l; i ++ ) { - - this.array[ index1 + i ] = attribute.array[ index2 + i ]; - - } - - return this; - - }, - - set: function ( value, offset ) { - - if ( offset === undefined ) offset = 0; - - this.array.set( value, offset ); - - return this; - - }, - - setX: function ( index, x ) { - - this.array[ index * this.itemSize ] = x; - - return this; - - }, - - setY: function ( index, y ) { - - this.array[ index * this.itemSize + 1 ] = y; - - return this; - - }, - - setZ: function ( index, z ) { - - this.array[ index * this.itemSize + 2 ] = z; - - return this; - - }, - - setXY: function ( index, x, y ) { - - index *= this.itemSize; - - this.array[ index ] = x; - this.array[ index + 1 ] = y; - - return this; - - }, - - setXYZ: function ( index, x, y, z ) { - - index *= this.itemSize; - - this.array[ index ] = x; - this.array[ index + 1 ] = y; - this.array[ index + 2 ] = z; - - return this; - - }, - - setXYZW: function ( index, x, y, z, w ) { - - index *= this.itemSize; - - this.array[ index ] = x; - this.array[ index + 1 ] = y; - this.array[ index + 2 ] = z; - this.array[ index + 3 ] = w; - - return this; - - }, - - clone: function () { - - return new THREE.BufferAttribute( new this.array.constructor( this.array ), this.itemSize ); - - } - -}; - -// - -THREE.Int8Attribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - -}; - -THREE.Uint8Attribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - -}; - -THREE.Uint8ClampedAttribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - - -}; - -THREE.Int16Attribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - -}; - -THREE.Uint16Attribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - -}; - -THREE.Int32Attribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - -}; - -THREE.Uint32Attribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - -}; - -THREE.Float32Attribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - -}; - -THREE.Float64Attribute = function ( data, itemSize ) { - - THREE.warn( 'THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' ); - return new THREE.BufferAttribute( data, itemSize ); - -}; - -// File:src/core/DynamicBufferAttribute.js - -/** - * @author benaadams / https://twitter.com/ben_a_adams - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.DynamicBufferAttribute = function ( array, itemSize ) { - - THREE.BufferAttribute.call( this, array, itemSize ); - - this.updateRange = { offset: 0, count: -1 }; - -}; - -THREE.DynamicBufferAttribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.DynamicBufferAttribute.prototype.constructor = THREE.DynamicBufferAttribute; - -THREE.DynamicBufferAttribute.prototype.clone = function () { - - return new THREE.DynamicBufferAttribute( new this.array.constructor( this.array ), this.itemSize ); - -}; - -// File:src/core/BufferGeometry.js - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.BufferGeometry = function () { - - Object.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } ); - - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - this.type = 'BufferGeometry'; - - this.attributes = {}; - this.attributesKeys = []; - - this.drawcalls = []; - this.offsets = this.drawcalls; // backwards compatibility - - this.boundingBox = null; - this.boundingSphere = null; - -}; - -THREE.BufferGeometry.prototype = { - - constructor: THREE.BufferGeometry, - - addAttribute: function ( name, attribute ) { - - if ( attribute instanceof THREE.BufferAttribute === false ) { - - THREE.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' ); - - this.attributes[ name ] = { array: arguments[ 1 ], itemSize: arguments[ 2 ] }; - - return; - - } - - this.attributes[ name ] = attribute; - this.attributesKeys = Object.keys( this.attributes ); - - }, - - getAttribute: function ( name ) { - - return this.attributes[ name ]; - - }, - - addDrawCall: function ( start, count, indexOffset ) { - - this.drawcalls.push( { - - start: start, - count: count, - index: indexOffset !== undefined ? indexOffset : 0 - - } ); - - }, - - applyMatrix: function ( matrix ) { - - var position = this.attributes.position; - - if ( position !== undefined ) { - - matrix.applyToVector3Array( position.array ); - position.needsUpdate = true; - - } - - var normal = this.attributes.normal; - - if ( normal !== undefined ) { - - var normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); - - normalMatrix.applyToVector3Array( normal.array ); - normal.needsUpdate = true; - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - }, - - center: function () { - - this.computeBoundingBox(); - - var offset = this.boundingBox.center().negate(); - - this.applyMatrix( new THREE.Matrix4().setPosition( offset ) ); - - return offset; - - }, - - fromGeometry: function ( geometry, settings ) { - - settings = settings || { 'vertexColors': THREE.NoColors }; - - var vertices = geometry.vertices; - var faces = geometry.faces; - var faceVertexUvs = geometry.faceVertexUvs; - var vertexColors = settings.vertexColors; - var hasFaceVertexUv = faceVertexUvs[ 0 ].length > 0; - var hasFaceVertexNormals = faces[ 0 ].vertexNormals.length == 3; - - var positions = new Float32Array( faces.length * 3 * 3 ); - this.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) ); - - var normals = new Float32Array( faces.length * 3 * 3 ); - this.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) ); - - if ( vertexColors !== THREE.NoColors ) { - - var colors = new Float32Array( faces.length * 3 * 3 ); - this.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) ); - - } - - if ( hasFaceVertexUv === true ) { - - var uvs = new Float32Array( faces.length * 3 * 2 ); - this.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) ); - - } - - for ( var i = 0, i2 = 0, i3 = 0; i < faces.length; i ++, i2 += 6, i3 += 9 ) { - - var face = faces[ i ]; - - var a = vertices[ face.a ]; - var b = vertices[ face.b ]; - var c = vertices[ face.c ]; - - positions[ i3 ] = a.x; - positions[ i3 + 1 ] = a.y; - positions[ i3 + 2 ] = a.z; - - positions[ i3 + 3 ] = b.x; - positions[ i3 + 4 ] = b.y; - positions[ i3 + 5 ] = b.z; - - positions[ i3 + 6 ] = c.x; - positions[ i3 + 7 ] = c.y; - positions[ i3 + 8 ] = c.z; - - if ( hasFaceVertexNormals === true ) { - - var na = face.vertexNormals[ 0 ]; - var nb = face.vertexNormals[ 1 ]; - var nc = face.vertexNormals[ 2 ]; - - normals[ i3 ] = na.x; - normals[ i3 + 1 ] = na.y; - normals[ i3 + 2 ] = na.z; - - normals[ i3 + 3 ] = nb.x; - normals[ i3 + 4 ] = nb.y; - normals[ i3 + 5 ] = nb.z; - - normals[ i3 + 6 ] = nc.x; - normals[ i3 + 7 ] = nc.y; - normals[ i3 + 8 ] = nc.z; - - } else { - - var n = face.normal; - - normals[ i3 ] = n.x; - normals[ i3 + 1 ] = n.y; - normals[ i3 + 2 ] = n.z; - - normals[ i3 + 3 ] = n.x; - normals[ i3 + 4 ] = n.y; - normals[ i3 + 5 ] = n.z; - - normals[ i3 + 6 ] = n.x; - normals[ i3 + 7 ] = n.y; - normals[ i3 + 8 ] = n.z; - - } - - if ( vertexColors === THREE.FaceColors ) { - - var fc = face.color; - - colors[ i3 ] = fc.r; - colors[ i3 + 1 ] = fc.g; - colors[ i3 + 2 ] = fc.b; - - colors[ i3 + 3 ] = fc.r; - colors[ i3 + 4 ] = fc.g; - colors[ i3 + 5 ] = fc.b; - - colors[ i3 + 6 ] = fc.r; - colors[ i3 + 7 ] = fc.g; - colors[ i3 + 8 ] = fc.b; - - } else if ( vertexColors === THREE.VertexColors ) { - - var vca = face.vertexColors[ 0 ]; - var vcb = face.vertexColors[ 1 ]; - var vcc = face.vertexColors[ 2 ]; - - colors[ i3 ] = vca.r; - colors[ i3 + 1 ] = vca.g; - colors[ i3 + 2 ] = vca.b; - - colors[ i3 + 3 ] = vcb.r; - colors[ i3 + 4 ] = vcb.g; - colors[ i3 + 5 ] = vcb.b; - - colors[ i3 + 6 ] = vcc.r; - colors[ i3 + 7 ] = vcc.g; - colors[ i3 + 8 ] = vcc.b; - - } - - if ( hasFaceVertexUv === true ) { - - var uva = faceVertexUvs[ 0 ][ i ][ 0 ]; - var uvb = faceVertexUvs[ 0 ][ i ][ 1 ]; - var uvc = faceVertexUvs[ 0 ][ i ][ 2 ]; - - uvs[ i2 ] = uva.x; - uvs[ i2 + 1 ] = uva.y; - - uvs[ i2 + 2 ] = uvb.x; - uvs[ i2 + 3 ] = uvb.y; - - uvs[ i2 + 4 ] = uvc.x; - uvs[ i2 + 5 ] = uvc.y; - - } - - } - - this.computeBoundingSphere() - - return this; - - }, - - computeBoundingBox: function () { - - var vector = new THREE.Vector3(); - - return function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new THREE.Box3(); - - } - - var positions = this.attributes.position.array; - - if ( positions ) { - - var bb = this.boundingBox; - bb.makeEmpty(); - - for ( var i = 0, il = positions.length; i < il; i += 3 ) { - - vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - bb.expandByPoint( vector ); - - } - - } - - if ( positions === undefined || positions.length === 0 ) { - - this.boundingBox.min.set( 0, 0, 0 ); - this.boundingBox.max.set( 0, 0, 0 ); - - } - - if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) { - - THREE.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.' ); - - } - - } - - }(), - - computeBoundingSphere: function () { - - var box = new THREE.Box3(); - var vector = new THREE.Vector3(); - - return function () { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new THREE.Sphere(); - - } - - var positions = this.attributes.position.array; - - if ( positions ) { - - box.makeEmpty(); - - var center = this.boundingSphere.center; - - for ( var i = 0, il = positions.length; i < il; i += 3 ) { - - vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - box.expandByPoint( vector ); - - } - - box.center( center ); - - // hoping to find a boundingSphere with a radius smaller than the - // boundingSphere of the boundingBox: sqrt(3) smaller in the best case - - var maxRadiusSq = 0; - - for ( var i = 0, il = positions.length; i < il; i += 3 ) { - - vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); - - } - - this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); - - if ( isNaN( this.boundingSphere.radius ) ) { - - THREE.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.' ); - - } - - } - - } - - }(), - - computeFaceNormals: function () { - - // backwards compatibility - - }, - - computeVertexNormals: function () { - - var attributes = this.attributes; - - if ( attributes.position ) { - - var positions = attributes.position.array; - - if ( attributes.normal === undefined ) { - - this.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( positions.length ), 3 ) ); - - } else { - - // reset existing normals to zero - - var normals = attributes.normal.array; - - for ( var i = 0, il = normals.length; i < il; i ++ ) { - - normals[ i ] = 0; - - } - - } - - var normals = attributes.normal.array; - - var vA, vB, vC, - - pA = new THREE.Vector3(), - pB = new THREE.Vector3(), - pC = new THREE.Vector3(), - - cb = new THREE.Vector3(), - ab = new THREE.Vector3(); - - // indexed elements - - if ( attributes.index ) { - - var indices = attributes.index.array; - - var offsets = ( this.offsets.length > 0 ? this.offsets : [ { start: 0, count: indices.length, index: 0 } ] ); - - for ( var j = 0, jl = offsets.length; j < jl; ++ j ) { - - var start = offsets[ j ].start; - var count = offsets[ j ].count; - var index = offsets[ j ].index; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - vA = ( index + indices[ i ] ) * 3; - vB = ( index + indices[ i + 1 ] ) * 3; - vC = ( index + indices[ i + 2 ] ) * 3; - - pA.fromArray( positions, vA ); - pB.fromArray( positions, vB ); - pC.fromArray( positions, vC ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normals[ vA ] += cb.x; - normals[ vA + 1 ] += cb.y; - normals[ vA + 2 ] += cb.z; - - normals[ vB ] += cb.x; - normals[ vB + 1 ] += cb.y; - normals[ vB + 2 ] += cb.z; - - normals[ vC ] += cb.x; - normals[ vC + 1 ] += cb.y; - normals[ vC + 2 ] += cb.z; - - } - - } - - } else { - - // non-indexed elements (unconnected triangle soup) - - for ( var i = 0, il = positions.length; i < il; i += 9 ) { - - pA.fromArray( positions, i ); - pB.fromArray( positions, i + 3 ); - pC.fromArray( positions, i + 6 ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normals[ i ] = cb.x; - normals[ i + 1 ] = cb.y; - normals[ i + 2 ] = cb.z; - - normals[ i + 3 ] = cb.x; - normals[ i + 4 ] = cb.y; - normals[ i + 5 ] = cb.z; - - normals[ i + 6 ] = cb.x; - normals[ i + 7 ] = cb.y; - normals[ i + 8 ] = cb.z; - - } - - } - - this.normalizeNormals(); - - attributes.normal.needsUpdate = true; - - } - - }, - - computeTangents: function () { - - // based on http://www.terathon.com/code/tangent.html - // (per vertex tangents) - - if ( this.attributes.index === undefined || - this.attributes.position === undefined || - this.attributes.normal === undefined || - this.attributes.uv === undefined ) { - - THREE.warn( 'THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' ); - return; - - } - - var indices = this.attributes.index.array; - var positions = this.attributes.position.array; - var normals = this.attributes.normal.array; - var uvs = this.attributes.uv.array; - - var nVertices = positions.length / 3; - - if ( this.attributes.tangent === undefined ) { - - this.addAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) ); - - } - - var tangents = this.attributes.tangent.array; - - var tan1 = [], tan2 = []; - - for ( var k = 0; k < nVertices; k ++ ) { - - tan1[ k ] = new THREE.Vector3(); - tan2[ k ] = new THREE.Vector3(); - - } - - var vA = new THREE.Vector3(), - vB = new THREE.Vector3(), - vC = new THREE.Vector3(), - - uvA = new THREE.Vector2(), - uvB = new THREE.Vector2(), - uvC = new THREE.Vector2(), - - x1, x2, y1, y2, z1, z2, - s1, s2, t1, t2, r; - - var sdir = new THREE.Vector3(), tdir = new THREE.Vector3(); - - function handleTriangle( a, b, c ) { - - vA.fromArray( positions, a * 3 ); - vB.fromArray( positions, b * 3 ); - vC.fromArray( positions, c * 3 ); - - uvA.fromArray( uvs, a * 2 ); - uvB.fromArray( uvs, b * 2 ); - uvC.fromArray( uvs, c * 2 ); - - x1 = vB.x - vA.x; - x2 = vC.x - vA.x; - - y1 = vB.y - vA.y; - y2 = vC.y - vA.y; - - z1 = vB.z - vA.z; - z2 = vC.z - vA.z; - - s1 = uvB.x - uvA.x; - s2 = uvC.x - uvA.x; - - t1 = uvB.y - uvA.y; - t2 = uvC.y - uvA.y; - - r = 1.0 / ( s1 * t2 - s2 * t1 ); - - sdir.set( - ( t2 * x1 - t1 * x2 ) * r, - ( t2 * y1 - t1 * y2 ) * r, - ( t2 * z1 - t1 * z2 ) * r - ); - - tdir.set( - ( s1 * x2 - s2 * x1 ) * r, - ( s1 * y2 - s2 * y1 ) * r, - ( s1 * z2 - s2 * z1 ) * r - ); - - tan1[ a ].add( sdir ); - tan1[ b ].add( sdir ); - tan1[ c ].add( sdir ); - - tan2[ a ].add( tdir ); - tan2[ b ].add( tdir ); - tan2[ c ].add( tdir ); - - } - - var i, il; - var j, jl; - var iA, iB, iC; - - if ( this.drawcalls.length === 0 ) { - - this.addDrawCall( 0, indices.length, 0 ); - - } - - var drawcalls = this.drawcalls; - - for ( j = 0, jl = drawcalls.length; j < jl; ++ j ) { - - var start = drawcalls[ j ].start; - var count = drawcalls[ j ].count; - var index = drawcalls[ j ].index; - - for ( i = start, il = start + count; i < il; i += 3 ) { - - iA = index + indices[ i ]; - iB = index + indices[ i + 1 ]; - iC = index + indices[ i + 2 ]; - - handleTriangle( iA, iB, iC ); - - } - - } - - var tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3(); - var n = new THREE.Vector3(), n2 = new THREE.Vector3(); - var w, t, test; - - function handleVertex( v ) { - - n.fromArray( normals, v * 3 ); - n2.copy( n ); - - t = tan1[ v ]; - - // Gram-Schmidt orthogonalize - - tmp.copy( t ); - tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize(); - - // Calculate handedness - - tmp2.crossVectors( n2, t ); - test = tmp2.dot( tan2[ v ] ); - w = ( test < 0.0 ) ? - 1.0 : 1.0; - - tangents[ v * 4 ] = tmp.x; - tangents[ v * 4 + 1 ] = tmp.y; - tangents[ v * 4 + 2 ] = tmp.z; - tangents[ v * 4 + 3 ] = w; - - } - - for ( j = 0, jl = drawcalls.length; j < jl; ++ j ) { - - var start = drawcalls[ j ].start; - var count = drawcalls[ j ].count; - var index = drawcalls[ j ].index; - - for ( i = start, il = start + count; i < il; i += 3 ) { - - iA = index + indices[ i ]; - iB = index + indices[ i + 1 ]; - iC = index + indices[ i + 2 ]; - - handleVertex( iA ); - handleVertex( iB ); - handleVertex( iC ); - - } - - } - - }, - - /* - Compute the draw offset for large models by chunking the index buffer into chunks of 65k addressable vertices. - This method will effectively rewrite the index buffer and remap all attributes to match the new indices. - WARNING: This method will also expand the vertex count to prevent sprawled triangles across draw offsets. - size - Defaults to 65535, but allows for larger or smaller chunks. - */ - computeOffsets: function ( size ) { - - if ( size === undefined ) size = 65535; // WebGL limits type of index buffer values to 16-bit. - - var indices = this.attributes.index.array; - var vertices = this.attributes.position.array; - - var facesCount = ( indices.length / 3 ); - - /* - console.log("Computing buffers in offsets of "+size+" -> indices:"+indices.length+" vertices:"+vertices.length); - console.log("Faces to process: "+(indices.length/3)); - console.log("Reordering "+verticesCount+" vertices."); - */ - - var sortedIndices = new Uint16Array( indices.length ); //16-bit buffers - var indexPtr = 0; - var vertexPtr = 0; - - var offsets = [ { start:0, count:0, index:0 } ]; - var offset = offsets[ 0 ]; - - var duplicatedVertices = 0; - var newVerticeMaps = 0; - var faceVertices = new Int32Array( 6 ); - var vertexMap = new Int32Array( vertices.length ); - var revVertexMap = new Int32Array( vertices.length ); - for ( var j = 0; j < vertices.length; j ++ ) { vertexMap[ j ] = - 1; revVertexMap[ j ] = - 1; } - - /* - Traverse every face and reorder vertices in the proper offsets of 65k. - We can have more than 65k entries in the index buffer per offset, but only reference 65k values. - */ - for ( var findex = 0; findex < facesCount; findex ++ ) { - newVerticeMaps = 0; - - for ( var vo = 0; vo < 3; vo ++ ) { - var vid = indices[ findex * 3 + vo ]; - if ( vertexMap[ vid ] == - 1 ) { - //Unmapped vertice - faceVertices[ vo * 2 ] = vid; - faceVertices[ vo * 2 + 1 ] = - 1; - newVerticeMaps ++; - } else if ( vertexMap[ vid ] < offset.index ) { - //Reused vertices from previous block (duplicate) - faceVertices[ vo * 2 ] = vid; - faceVertices[ vo * 2 + 1 ] = - 1; - duplicatedVertices ++; - } else { - //Reused vertice in the current block - faceVertices[ vo * 2 ] = vid; - faceVertices[ vo * 2 + 1 ] = vertexMap[ vid ]; - } - } - - var faceMax = vertexPtr + newVerticeMaps; - if ( faceMax > ( offset.index + size ) ) { - var new_offset = { start:indexPtr, count:0, index:vertexPtr }; - offsets.push( new_offset ); - offset = new_offset; - - //Re-evaluate reused vertices in light of new offset. - for ( var v = 0; v < 6; v += 2 ) { - var new_vid = faceVertices[ v + 1 ]; - if ( new_vid > - 1 && new_vid < offset.index ) - faceVertices[ v + 1 ] = - 1; - } - } - - //Reindex the face. - for ( var v = 0; v < 6; v += 2 ) { - var vid = faceVertices[ v ]; - var new_vid = faceVertices[ v + 1 ]; - - if ( new_vid === - 1 ) - new_vid = vertexPtr ++; - - vertexMap[ vid ] = new_vid; - revVertexMap[ new_vid ] = vid; - sortedIndices[ indexPtr ++ ] = new_vid - offset.index; //XXX overflows at 16bit - offset.count ++; - } - } - - /* Move all attribute values to map to the new computed indices , also expand the vertice stack to match our new vertexPtr. */ - this.reorderBuffers( sortedIndices, revVertexMap, vertexPtr ); - this.offsets = offsets; // TODO: Deprecate - this.drawcalls = offsets; - - /* - var orderTime = Date.now(); - console.log("Reorder time: "+(orderTime-s)+"ms"); - console.log("Duplicated "+duplicatedVertices+" vertices."); - console.log("Compute Buffers time: "+(Date.now()-s)+"ms"); - console.log("Draw offsets: "+offsets.length); - */ - - return offsets; - - }, - - merge: function ( geometry, offset ) { - - if ( geometry instanceof THREE.BufferGeometry === false ) { - - THREE.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry ); - return; - - } - - if ( offset === undefined ) offset = 0; - - var attributes = this.attributes; - - for ( var key in attributes ) { - - if ( geometry.attributes[ key ] === undefined ) continue; - - var attribute1 = attributes[ key ]; - var attributeArray1 = attribute1.array; - - var attribute2 = geometry.attributes[ key ]; - var attributeArray2 = attribute2.array; - - var attributeSize = attribute2.itemSize; - - for ( var i = 0, j = attributeSize * offset; i < attributeArray2.length; i ++, j ++ ) { - - attributeArray1[ j ] = attributeArray2[ i ]; - - } - - } - - return this; - - }, - - normalizeNormals: function () { - - var normals = this.attributes.normal.array; - - var x, y, z, n; - - for ( var i = 0, il = normals.length; i < il; i += 3 ) { - - x = normals[ i ]; - y = normals[ i + 1 ]; - z = normals[ i + 2 ]; - - n = 1.0 / Math.sqrt( x * x + y * y + z * z ); - - normals[ i ] *= n; - normals[ i + 1 ] *= n; - normals[ i + 2 ] *= n; - - } - - }, - - /* - reoderBuffers: - Reorder attributes based on a new indexBuffer and indexMap. - indexBuffer - Uint16Array of the new ordered indices. - indexMap - Int32Array where the position is the new vertex ID and the value the old vertex ID for each vertex. - vertexCount - Amount of total vertices considered in this reordering (in case you want to grow the vertice stack). - */ - reorderBuffers: function ( indexBuffer, indexMap, vertexCount ) { - - /* Create a copy of all attributes for reordering. */ - var sortedAttributes = {}; - for ( var attr in this.attributes ) { - if ( attr == 'index' ) - continue; - var sourceArray = this.attributes[ attr ].array; - sortedAttributes[ attr ] = new sourceArray.constructor( this.attributes[ attr ].itemSize * vertexCount ); - } - - /* Move attribute positions based on the new index map */ - for ( var new_vid = 0; new_vid < vertexCount; new_vid ++ ) { - var vid = indexMap[ new_vid ]; - for ( var attr in this.attributes ) { - if ( attr == 'index' ) - continue; - var attrArray = this.attributes[ attr ].array; - var attrSize = this.attributes[ attr ].itemSize; - var sortedAttr = sortedAttributes[ attr ]; - for ( var k = 0; k < attrSize; k ++ ) - sortedAttr[ new_vid * attrSize + k ] = attrArray[ vid * attrSize + k ]; - } - } - - /* Carry the new sorted buffers locally */ - this.attributes[ 'index' ].array = indexBuffer; - for ( var attr in this.attributes ) { - if ( attr == 'index' ) - continue; - this.attributes[ attr ].array = sortedAttributes[ attr ]; - this.attributes[ attr ].numItems = this.attributes[ attr ].itemSize * vertexCount; - } - }, - - toJSON: function () { - - var output = { - metadata: { - version: 4.0, - type: 'BufferGeometry', - generator: 'BufferGeometryExporter' - }, - uuid: this.uuid, - type: this.type, - data: { - attributes: {} - } - }; - - var attributes = this.attributes; - var offsets = this.offsets; - var boundingSphere = this.boundingSphere; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - - var array = Array.prototype.slice.call( attribute.array ); - - output.data.attributes[ key ] = { - itemSize: attribute.itemSize, - type: attribute.array.constructor.name, - array: array - } - - } - - if ( offsets.length > 0 ) { - - output.data.offsets = JSON.parse( JSON.stringify( offsets ) ); - - } - - if ( boundingSphere !== null ) { - - output.data.boundingSphere = { - center: boundingSphere.center.toArray(), - radius: boundingSphere.radius - } - - } - - return output; - - }, - - clone: function () { - - var geometry = new THREE.BufferGeometry(); - - for ( var attr in this.attributes ) { - - var sourceAttr = this.attributes[ attr ]; - geometry.addAttribute( attr, sourceAttr.clone() ); - - } - - for ( var i = 0, il = this.offsets.length; i < il; i ++ ) { - - var offset = this.offsets[ i ]; - - geometry.offsets.push( { - - start: offset.start, - index: offset.index, - count: offset.count - - } ); - - } - - return geometry; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.BufferGeometry.prototype ); - -// File:src/core/Geometry.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author kile / http://kile.stravaganza.org/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author bhouston / http://exocortex.com - */ - -THREE.Geometry = function () { - - Object.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } ); - - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - this.type = 'Geometry'; - - this.vertices = []; - this.colors = []; // one-to-one vertex colors, used in Points and Line - - this.faces = []; - - this.faceVertexUvs = [ [] ]; - - this.morphTargets = []; - this.morphColors = []; - this.morphNormals = []; - - this.skinWeights = []; - this.skinIndices = []; - - this.lineDistances = []; - - this.boundingBox = null; - this.boundingSphere = null; - - this.hasTangents = false; - - this.dynamic = true; // the intermediate typed arrays will be deleted when set to false - - // update flags - - this.verticesNeedUpdate = false; - this.elementsNeedUpdate = false; - this.uvsNeedUpdate = false; - this.normalsNeedUpdate = false; - this.tangentsNeedUpdate = false; - this.colorsNeedUpdate = false; - this.lineDistancesNeedUpdate = false; - - this.groupsNeedUpdate = false; - -}; - -THREE.Geometry.prototype = { - - constructor: THREE.Geometry, - - applyMatrix: function ( matrix ) { - - var normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); - - for ( var i = 0, il = this.vertices.length; i < il; i ++ ) { - - var vertex = this.vertices[ i ]; - vertex.applyMatrix4( matrix ); - - } - - for ( var i = 0, il = this.faces.length; i < il; i ++ ) { - - var face = this.faces[ i ]; - face.normal.applyMatrix3( normalMatrix ).normalize(); - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - face.vertexNormals[ j ].applyMatrix3( normalMatrix ).normalize(); - - } - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - this.verticesNeedUpdate = true; - this.normalsNeedUpdate = true; - - }, - - fromBufferGeometry: function ( geometry ) { - - var scope = this; - - var attributes = geometry.attributes; - - var vertices = attributes.position.array; - var indices = attributes.index !== undefined ? attributes.index.array : undefined; - var normals = attributes.normal !== undefined ? attributes.normal.array : undefined; - var colors = attributes.color !== undefined ? attributes.color.array : undefined; - var uvs = attributes.uv !== undefined ? attributes.uv.array : undefined; - - var tempNormals = []; - var tempUVs = []; - - for ( var i = 0, j = 0; i < vertices.length; i += 3, j += 2 ) { - - scope.vertices.push( new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) ); - - if ( normals !== undefined ) { - - tempNormals.push( new THREE.Vector3( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] ) ); - - } - - if ( colors !== undefined ) { - - scope.colors.push( new THREE.Color( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] ) ); - - } - - if ( uvs !== undefined ) { - - tempUVs.push( new THREE.Vector2( uvs[ j ], uvs[ j + 1 ] ) ); - - } - - } - - var addFace = function ( a, b, c ) { - - var vertexNormals = normals !== undefined ? [ tempNormals[ a ].clone(), tempNormals[ b ].clone(), tempNormals[ c ].clone() ] : []; - var vertexColors = colors !== undefined ? [ scope.colors[ a ].clone(), scope.colors[ b ].clone(), scope.colors[ c ].clone() ] : []; - - scope.faces.push( new THREE.Face3( a, b, c, vertexNormals, vertexColors ) ); - - if ( uvs !== undefined ) { - - scope.faceVertexUvs[ 0 ].push( [ tempUVs[ a ].clone(), tempUVs[ b ].clone(), tempUVs[ c ].clone() ] ); - - } - - }; - - if ( indices !== undefined ) { - - var drawcalls = geometry.drawcalls; - - if ( drawcalls.length > 0 ) { - - for ( var i = 0; i < drawcalls.length; i ++ ) { - - var drawcall = drawcalls[ i ]; - - var start = drawcall.start; - var count = drawcall.count; - var index = drawcall.index; - - for ( var j = start, jl = start + count; j < jl; j += 3 ) { - - addFace( index + indices[ j ], index + indices[ j + 1 ], index + indices[ j + 2 ] ); - - } - - } - - } else { - - for ( var i = 0; i < indices.length; i += 3 ) { - - addFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] ); - - } - - } - - } else { - - for ( var i = 0; i < vertices.length / 3; i += 3 ) { - - addFace( i, i + 1, i + 2 ); - - } - - } - - this.computeFaceNormals(); - - if ( geometry.boundingBox !== null ) { - - this.boundingBox = geometry.boundingBox.clone(); - - } - - if ( geometry.boundingSphere !== null ) { - - this.boundingSphere = geometry.boundingSphere.clone(); - - } - - return this; - - }, - - center: function () { - - this.computeBoundingBox(); - - var offset = this.boundingBox.center().negate(); - - this.applyMatrix( new THREE.Matrix4().setPosition( offset ) ); - - return offset; - - }, - - computeFaceNormals: function () { - - var cb = new THREE.Vector3(), ab = new THREE.Vector3(); - - for ( var f = 0, fl = this.faces.length; f < fl; f ++ ) { - - var face = this.faces[ f ]; - - var vA = this.vertices[ face.a ]; - var vB = this.vertices[ face.b ]; - var vC = this.vertices[ face.c ]; - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ); - - cb.normalize(); - - face.normal.copy( cb ); - - } - - }, - - computeVertexNormals: function ( areaWeighted ) { - - var v, vl, f, fl, face, vertices; - - vertices = new Array( this.vertices.length ); - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - vertices[ v ] = new THREE.Vector3(); - - } - - if ( areaWeighted ) { - - // vertex normals weighted by triangle areas - // http://www.iquilezles.org/www/articles/normals/normals.htm - - var vA, vB, vC; - var cb = new THREE.Vector3(), ab = new THREE.Vector3(); - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - vA = this.vertices[ face.a ]; - vB = this.vertices[ face.b ]; - vC = this.vertices[ face.c ]; - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ); - - vertices[ face.a ].add( cb ); - vertices[ face.b ].add( cb ); - vertices[ face.c ].add( cb ); - - } - - } else { - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - vertices[ face.a ].add( face.normal ); - vertices[ face.b ].add( face.normal ); - vertices[ face.c ].add( face.normal ); - - } - - } - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - vertices[ v ].normalize(); - - } - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - face.vertexNormals[ 0 ] = vertices[ face.a ].clone(); - face.vertexNormals[ 1 ] = vertices[ face.b ].clone(); - face.vertexNormals[ 2 ] = vertices[ face.c ].clone(); - - } - - }, - - computeMorphNormals: function () { - - var i, il, f, fl, face; - - // save original normals - // - create temp variables on first access - // otherwise just copy (for faster repeated calls) - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - if ( ! face.__originalFaceNormal ) { - - face.__originalFaceNormal = face.normal.clone(); - - } else { - - face.__originalFaceNormal.copy( face.normal ); - - } - - if ( ! face.__originalVertexNormals ) face.__originalVertexNormals = []; - - for ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) { - - if ( ! face.__originalVertexNormals[ i ] ) { - - face.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone(); - - } else { - - face.__originalVertexNormals[ i ].copy( face.vertexNormals[ i ] ); - - } - - } - - } - - // use temp geometry to compute face and vertex normals for each morph - - var tmpGeo = new THREE.Geometry(); - tmpGeo.faces = this.faces; - - for ( i = 0, il = this.morphTargets.length; i < il; i ++ ) { - - // create on first access - - if ( ! this.morphNormals[ i ] ) { - - this.morphNormals[ i ] = {}; - this.morphNormals[ i ].faceNormals = []; - this.morphNormals[ i ].vertexNormals = []; - - var dstNormalsFace = this.morphNormals[ i ].faceNormals; - var dstNormalsVertex = this.morphNormals[ i ].vertexNormals; - - var faceNormal, vertexNormals; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - faceNormal = new THREE.Vector3(); - vertexNormals = { a: new THREE.Vector3(), b: new THREE.Vector3(), c: new THREE.Vector3() }; - - dstNormalsFace.push( faceNormal ); - dstNormalsVertex.push( vertexNormals ); - - } - - } - - var morphNormals = this.morphNormals[ i ]; - - // set vertices to morph target - - tmpGeo.vertices = this.morphTargets[ i ].vertices; - - // compute morph normals - - tmpGeo.computeFaceNormals(); - tmpGeo.computeVertexNormals(); - - // store morph normals - - var faceNormal, vertexNormals; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - faceNormal = morphNormals.faceNormals[ f ]; - vertexNormals = morphNormals.vertexNormals[ f ]; - - faceNormal.copy( face.normal ); - - vertexNormals.a.copy( face.vertexNormals[ 0 ] ); - vertexNormals.b.copy( face.vertexNormals[ 1 ] ); - vertexNormals.c.copy( face.vertexNormals[ 2 ] ); - - } - - } - - // restore original normals - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - face.normal = face.__originalFaceNormal; - face.vertexNormals = face.__originalVertexNormals; - - } - - }, - - computeTangents: function () { - - // based on http://www.terathon.com/code/tangent.html - // tangents go to vertices - - var f, fl, v, vl, i, vertexIndex, - face, uv, vA, vB, vC, uvA, uvB, uvC, - x1, x2, y1, y2, z1, z2, - s1, s2, t1, t2, r, t, test, - tan1 = [], tan2 = [], - sdir = new THREE.Vector3(), tdir = new THREE.Vector3(), - tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3(), - n = new THREE.Vector3(), w; - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - tan1[ v ] = new THREE.Vector3(); - tan2[ v ] = new THREE.Vector3(); - - } - - function handleTriangle( context, a, b, c, ua, ub, uc ) { - - vA = context.vertices[ a ]; - vB = context.vertices[ b ]; - vC = context.vertices[ c ]; - - uvA = uv[ ua ]; - uvB = uv[ ub ]; - uvC = uv[ uc ]; - - x1 = vB.x - vA.x; - x2 = vC.x - vA.x; - y1 = vB.y - vA.y; - y2 = vC.y - vA.y; - z1 = vB.z - vA.z; - z2 = vC.z - vA.z; - - s1 = uvB.x - uvA.x; - s2 = uvC.x - uvA.x; - t1 = uvB.y - uvA.y; - t2 = uvC.y - uvA.y; - - r = 1.0 / ( s1 * t2 - s2 * t1 ); - sdir.set( ( t2 * x1 - t1 * x2 ) * r, - ( t2 * y1 - t1 * y2 ) * r, - ( t2 * z1 - t1 * z2 ) * r ); - tdir.set( ( s1 * x2 - s2 * x1 ) * r, - ( s1 * y2 - s2 * y1 ) * r, - ( s1 * z2 - s2 * z1 ) * r ); - - tan1[ a ].add( sdir ); - tan1[ b ].add( sdir ); - tan1[ c ].add( sdir ); - - tan2[ a ].add( tdir ); - tan2[ b ].add( tdir ); - tan2[ c ].add( tdir ); - - } - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - uv = this.faceVertexUvs[ 0 ][ f ]; // use UV layer 0 for tangents - - handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 ); - - } - - var faceIndex = [ 'a', 'b', 'c', 'd' ]; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - for ( i = 0; i < Math.min( face.vertexNormals.length, 3 ); i ++ ) { - - n.copy( face.vertexNormals[ i ] ); - - vertexIndex = face[ faceIndex[ i ] ]; - - t = tan1[ vertexIndex ]; - - // Gram-Schmidt orthogonalize - - tmp.copy( t ); - tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize(); - - // Calculate handedness - - tmp2.crossVectors( face.vertexNormals[ i ], t ); - test = tmp2.dot( tan2[ vertexIndex ] ); - w = ( test < 0.0 ) ? - 1.0 : 1.0; - - face.vertexTangents[ i ] = new THREE.Vector4( tmp.x, tmp.y, tmp.z, w ); - - } - - } - - this.hasTangents = true; - - }, - - computeLineDistances: function () { - - var d = 0; - var vertices = this.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - if ( i > 0 ) { - - d += vertices[ i ].distanceTo( vertices[ i - 1 ] ); - - } - - this.lineDistances[ i ] = d; - - } - - }, - - computeBoundingBox: function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new THREE.Box3(); - - } - - this.boundingBox.setFromPoints( this.vertices ); - - }, - - computeBoundingSphere: function () { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new THREE.Sphere(); - - } - - this.boundingSphere.setFromPoints( this.vertices ); - - }, - - merge: function ( geometry, matrix, materialIndexOffset ) { - - if ( geometry instanceof THREE.Geometry === false ) { - - THREE.error( 'THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry ); - return; - - } - - var normalMatrix, - vertexOffset = this.vertices.length, - vertices1 = this.vertices, - vertices2 = geometry.vertices, - faces1 = this.faces, - faces2 = geometry.faces, - uvs1 = this.faceVertexUvs[ 0 ], - uvs2 = geometry.faceVertexUvs[ 0 ]; - - if ( materialIndexOffset === undefined ) materialIndexOffset = 0; - - if ( matrix !== undefined ) { - - normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); - - } - - // vertices - - for ( var i = 0, il = vertices2.length; i < il; i ++ ) { - - var vertex = vertices2[ i ]; - - var vertexCopy = vertex.clone(); - - if ( matrix !== undefined ) vertexCopy.applyMatrix4( matrix ); - - vertices1.push( vertexCopy ); - - } - - // faces - - for ( i = 0, il = faces2.length; i < il; i ++ ) { - - var face = faces2[ i ], faceCopy, normal, color, - faceVertexNormals = face.vertexNormals, - faceVertexColors = face.vertexColors; - - faceCopy = new THREE.Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset ); - faceCopy.normal.copy( face.normal ); - - if ( normalMatrix !== undefined ) { - - faceCopy.normal.applyMatrix3( normalMatrix ).normalize(); - - } - - for ( var j = 0, jl = faceVertexNormals.length; j < jl; j ++ ) { - - normal = faceVertexNormals[ j ].clone(); - - if ( normalMatrix !== undefined ) { - - normal.applyMatrix3( normalMatrix ).normalize(); - - } - - faceCopy.vertexNormals.push( normal ); - - } - - faceCopy.color.copy( face.color ); - - for ( var j = 0, jl = faceVertexColors.length; j < jl; j ++ ) { - - color = faceVertexColors[ j ]; - faceCopy.vertexColors.push( color.clone() ); - - } - - faceCopy.materialIndex = face.materialIndex + materialIndexOffset; - - faces1.push( faceCopy ); - - } - - // uvs - - for ( i = 0, il = uvs2.length; i < il; i ++ ) { - - var uv = uvs2[ i ], uvCopy = []; - - if ( uv === undefined ) { - - continue; - - } - - for ( var j = 0, jl = uv.length; j < jl; j ++ ) { - - uvCopy.push( uv[ j ].clone() ); - - } - - uvs1.push( uvCopy ); - - } - - }, - - mergeMesh: function ( mesh ) { - - if ( mesh instanceof THREE.Mesh === false ) { - - THREE.error( 'THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh ); - return; - - } - - mesh.matrixAutoUpdate && mesh.updateMatrix(); - - this.merge( mesh.geometry, mesh.matrix ); - - }, - - /* - * Checks for duplicate vertices with hashmap. - * Duplicated vertices are removed - * and faces' vertices are updated. - */ - - mergeVertices: function () { - - var verticesMap = {}; // Hashmap for looking up vertice by position coordinates (and making sure they are unique) - var unique = [], changes = []; - - var v, key; - var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001 - var precision = Math.pow( 10, precisionPoints ); - var i, il, face; - var indices, j, jl; - - for ( i = 0, il = this.vertices.length; i < il; i ++ ) { - - v = this.vertices[ i ]; - key = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision ); - - if ( verticesMap[ key ] === undefined ) { - - verticesMap[ key ] = i; - unique.push( this.vertices[ i ] ); - changes[ i ] = unique.length - 1; - - } else { - - //console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]); - changes[ i ] = changes[ verticesMap[ key ] ]; - - } - - }; - - - // if faces are completely degenerate after merging vertices, we - // have to remove them from the geometry. - var faceIndicesToRemove = []; - - for ( i = 0, il = this.faces.length; i < il; i ++ ) { - - face = this.faces[ i ]; - - face.a = changes[ face.a ]; - face.b = changes[ face.b ]; - face.c = changes[ face.c ]; - - indices = [ face.a, face.b, face.c ]; - - var dupIndex = - 1; - - // if any duplicate vertices are found in a Face3 - // we have to remove the face as nothing can be saved - for ( var n = 0; n < 3; n ++ ) { - if ( indices[ n ] == indices[ ( n + 1 ) % 3 ] ) { - - dupIndex = n; - faceIndicesToRemove.push( i ); - break; - - } - } - - } - - for ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) { - var idx = faceIndicesToRemove[ i ]; - - this.faces.splice( idx, 1 ); - - for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) { - - this.faceVertexUvs[ j ].splice( idx, 1 ); - - } - - } - - // Use unique set of vertices - - var diff = this.vertices.length - unique.length; - this.vertices = unique; - return diff; - - }, - - toJSON: function () { - - var output = { - metadata: { - version: 4.0, - type: 'BufferGeometry', - generator: 'BufferGeometryExporter' - }, - uuid: this.uuid, - type: this.type - }; - - if ( this.name !== "" ) output.name = this.name; - - if ( this.parameters !== undefined ) { - - var parameters = this.parameters; - - for ( var key in parameters ) { - - if ( parameters[ key ] !== undefined ) output[ key ] = parameters[ key ]; - - } - - return output; - - } - - var vertices = []; - - for ( var i = 0; i < this.vertices.length; i ++ ) { - - var vertex = this.vertices[ i ]; - vertices.push( vertex.x, vertex.y, vertex.z ); - - } - - var faces = []; - var normals = []; - var normalsHash = {}; - var colors = []; - var colorsHash = {}; - var uvs = []; - var uvsHash = {}; - - for ( var i = 0; i < this.faces.length; i ++ ) { - - var face = this.faces[ i ]; - - var hasMaterial = false; // face.materialIndex !== undefined; - var hasFaceUv = false; // deprecated - var hasFaceVertexUv = this.faceVertexUvs[ 0 ][ i ] !== undefined; - var hasFaceNormal = face.normal.length() > 0; - var hasFaceVertexNormal = face.vertexNormals.length > 0; - var hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1; - var hasFaceVertexColor = face.vertexColors.length > 0; - - var faceType = 0; - - faceType = setBit( faceType, 0, 0 ); - faceType = setBit( faceType, 1, hasMaterial ); - faceType = setBit( faceType, 2, hasFaceUv ); - faceType = setBit( faceType, 3, hasFaceVertexUv ); - faceType = setBit( faceType, 4, hasFaceNormal ); - faceType = setBit( faceType, 5, hasFaceVertexNormal ); - faceType = setBit( faceType, 6, hasFaceColor ); - faceType = setBit( faceType, 7, hasFaceVertexColor ); - - faces.push( faceType ); - faces.push( face.a, face.b, face.c ); - - - /* - if ( hasMaterial ) { - - faces.push( face.materialIndex ); - - } - */ - - if ( hasFaceVertexUv ) { - - var faceVertexUvs = this.faceVertexUvs[ 0 ][ i ]; - - faces.push( - getUvIndex( faceVertexUvs[ 0 ] ), - getUvIndex( faceVertexUvs[ 1 ] ), - getUvIndex( faceVertexUvs[ 2 ] ) - ); - - } - - if ( hasFaceNormal ) { - - faces.push( getNormalIndex( face.normal ) ); - - } - - if ( hasFaceVertexNormal ) { - - var vertexNormals = face.vertexNormals; - - faces.push( - getNormalIndex( vertexNormals[ 0 ] ), - getNormalIndex( vertexNormals[ 1 ] ), - getNormalIndex( vertexNormals[ 2 ] ) - ); - - } - - if ( hasFaceColor ) { - - faces.push( getColorIndex( face.color ) ); - - } - - if ( hasFaceVertexColor ) { - - var vertexColors = face.vertexColors; - - faces.push( - getColorIndex( vertexColors[ 0 ] ), - getColorIndex( vertexColors[ 1 ] ), - getColorIndex( vertexColors[ 2 ] ) - ); - - } - - } - - function setBit( value, position, enabled ) { - - return enabled ? value | ( 1 << position ) : value & ( ~ ( 1 << position) ); - - } - - function getNormalIndex( normal ) { - - var hash = normal.x.toString() + normal.y.toString() + normal.z.toString(); - - if ( normalsHash[ hash ] !== undefined ) { - - return normalsHash[ hash ]; - - } - - normalsHash[ hash ] = normals.length / 3; - normals.push( normal.x, normal.y, normal.z ); - - return normalsHash[ hash ]; - - } - - function getColorIndex( color ) { - - var hash = color.r.toString() + color.g.toString() + color.b.toString(); - - if ( colorsHash[ hash ] !== undefined ) { - - return colorsHash[ hash ]; - - } - - colorsHash[ hash ] = colors.length; - colors.push( color.getHex() ); - - return colorsHash[ hash ]; - - } - - function getUvIndex( uv ) { - - var hash = uv.x.toString() + uv.y.toString(); - - if ( uvsHash[ hash ] !== undefined ) { - - return uvsHash[ hash ]; - - } - - uvsHash[ hash ] = uvs.length / 2; - uvs.push( uv.x, uv.y ); - - return uvsHash[ hash ]; - - } - - output.data = {}; - - output.data.vertices = vertices; - output.data.normals = normals; - if ( colors.length > 0 ) output.data.colors = colors; - if ( uvs.length > 0 ) output.data.uvs = [ uvs ]; // temporal backward compatibility - output.data.faces = faces; - - // - - return output; - - }, - - clone: function () { - - var geometry = new THREE.Geometry(); - - var vertices = this.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - geometry.vertices.push( vertices[ i ].clone() ); - - } - - var faces = this.faces; - - for ( var i = 0, il = faces.length; i < il; i ++ ) { - - geometry.faces.push( faces[ i ].clone() ); - - } - - for ( var i = 0, il = this.faceVertexUvs.length; i < il; i ++ ) { - - var faceVertexUvs = this.faceVertexUvs[ i ]; - - if ( geometry.faceVertexUvs[ i ] === undefined ) { - - geometry.faceVertexUvs[ i ] = []; - - } - - for ( var j = 0, jl = faceVertexUvs.length; j < jl; j ++ ) { - - var uvs = faceVertexUvs[ j ], uvsCopy = []; - - for ( var k = 0, kl = uvs.length; k < kl; k ++ ) { - - var uv = uvs[ k ]; - - uvsCopy.push( uv.clone() ); - - } - - geometry.faceVertexUvs[ i ].push( uvsCopy ); - - } - - } - - return geometry; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.Geometry.prototype ); - -THREE.GeometryIdCount = 0; - -// File:src/cameras/Camera.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.Camera = function () { - - THREE.Object3D.call( this ); - - this.type = 'Camera'; - - this.matrixWorldInverse = new THREE.Matrix4(); - this.projectionMatrix = new THREE.Matrix4(); - -}; - -THREE.Camera.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Camera.prototype.constructor = THREE.Camera; - -THREE.Camera.prototype.getWorldDirection = function () { - - var quaternion = new THREE.Quaternion(); - - return function ( optionalTarget ) { - - var result = optionalTarget || new THREE.Vector3(); - - this.getWorldQuaternion( quaternion ); - - return result.set( 0, 0, - 1 ).applyQuaternion( quaternion ); - - } - -}(); - -THREE.Camera.prototype.lookAt = function () { - - // This routine does not support cameras with rotated and/or translated parent(s) - - var m1 = new THREE.Matrix4(); - - return function ( vector ) { - - m1.lookAt( this.position, vector, this.up ); - - this.quaternion.setFromRotationMatrix( m1 ); - - }; - -}(); - -THREE.Camera.prototype.clone = function ( camera ) { - - if ( camera === undefined ) camera = new THREE.Camera(); - - THREE.Object3D.prototype.clone.call( this, camera ); - - camera.matrixWorldInverse.copy( this.matrixWorldInverse ); - camera.projectionMatrix.copy( this.projectionMatrix ); - - return camera; -}; - -// File:src/cameras/CubeCamera.js - -/** - * Camera for rendering cube maps - * - renders scene into axis-aligned cube - * - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.CubeCamera = function ( near, far, cubeResolution ) { - - THREE.Object3D.call( this ); - - this.type = 'CubeCamera'; - - var fov = 90, aspect = 1; - - var cameraPX = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraPX.up.set( 0, - 1, 0 ); - cameraPX.lookAt( new THREE.Vector3( 1, 0, 0 ) ); - this.add( cameraPX ); - - var cameraNX = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraNX.up.set( 0, - 1, 0 ); - cameraNX.lookAt( new THREE.Vector3( - 1, 0, 0 ) ); - this.add( cameraNX ); - - var cameraPY = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraPY.up.set( 0, 0, 1 ); - cameraPY.lookAt( new THREE.Vector3( 0, 1, 0 ) ); - this.add( cameraPY ); - - var cameraNY = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraNY.up.set( 0, 0, - 1 ); - cameraNY.lookAt( new THREE.Vector3( 0, - 1, 0 ) ); - this.add( cameraNY ); - - var cameraPZ = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraPZ.up.set( 0, - 1, 0 ); - cameraPZ.lookAt( new THREE.Vector3( 0, 0, 1 ) ); - this.add( cameraPZ ); - - var cameraNZ = new THREE.PerspectiveCamera( fov, aspect, near, far ); - cameraNZ.up.set( 0, - 1, 0 ); - cameraNZ.lookAt( new THREE.Vector3( 0, 0, - 1 ) ); - this.add( cameraNZ ); - - this.renderTarget = new THREE.WebGLRenderTargetCube( cubeResolution, cubeResolution, { format: THREE.RGBFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter } ); - - this.updateCubeMap = function ( renderer, scene ) { - - var renderTarget = this.renderTarget; - var generateMipmaps = renderTarget.generateMipmaps; - - renderTarget.generateMipmaps = false; - - renderTarget.activeCubeFace = 0; - renderer.render( scene, cameraPX, renderTarget ); - - renderTarget.activeCubeFace = 1; - renderer.render( scene, cameraNX, renderTarget ); - - renderTarget.activeCubeFace = 2; - renderer.render( scene, cameraPY, renderTarget ); - - renderTarget.activeCubeFace = 3; - renderer.render( scene, cameraNY, renderTarget ); - - renderTarget.activeCubeFace = 4; - renderer.render( scene, cameraPZ, renderTarget ); - - renderTarget.generateMipmaps = generateMipmaps; - - renderTarget.activeCubeFace = 5; - renderer.render( scene, cameraNZ, renderTarget ); - - }; - -}; - -THREE.CubeCamera.prototype = Object.create( THREE.Object3D.prototype ); -THREE.CubeCamera.prototype.constructor = THREE.CubeCamera; - -// File:src/cameras/OrthographicCamera.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) { - - THREE.Camera.call( this ); - - this.type = 'OrthographicCamera'; - - this.zoom = 1; - - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - - this.near = ( near !== undefined ) ? near : 0.1; - this.far = ( far !== undefined ) ? far : 2000; - - this.updateProjectionMatrix(); - -}; - -THREE.OrthographicCamera.prototype = Object.create( THREE.Camera.prototype ); -THREE.OrthographicCamera.prototype.constructor = THREE.OrthographicCamera; - -THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () { - - var dx = ( this.right - this.left ) / ( 2 * this.zoom ); - var dy = ( this.top - this.bottom ) / ( 2 * this.zoom ); - var cx = ( this.right + this.left ) / 2; - var cy = ( this.top + this.bottom ) / 2; - - this.projectionMatrix.makeOrthographic( cx - dx, cx + dx, cy + dy, cy - dy, this.near, this.far ); - -}; - -THREE.OrthographicCamera.prototype.clone = function () { - - var camera = new THREE.OrthographicCamera(); - - THREE.Camera.prototype.clone.call( this, camera ); - - camera.zoom = this.zoom; - - camera.left = this.left; - camera.right = this.right; - camera.top = this.top; - camera.bottom = this.bottom; - - camera.near = this.near; - camera.far = this.far; - - camera.projectionMatrix.copy( this.projectionMatrix ); - - return camera; -}; - -// File:src/cameras/PerspectiveCamera.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author greggman / http://games.greggman.com/ - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - -THREE.PerspectiveCamera = function ( fov, aspect, near, far ) { - - THREE.Camera.call( this ); - - this.type = 'PerspectiveCamera'; - - this.zoom = 1; - - this.fov = fov !== undefined ? fov : 50; - this.aspect = aspect !== undefined ? aspect : 1; - this.near = near !== undefined ? near : 0.1; - this.far = far !== undefined ? far : 2000; - - this.updateProjectionMatrix(); - -}; - -THREE.PerspectiveCamera.prototype = Object.create( THREE.Camera.prototype ); -THREE.PerspectiveCamera.prototype.constructor = THREE.PerspectiveCamera; - - -/** - * Uses Focal Length (in mm) to estimate and set FOV - * 35mm (fullframe) camera is used if frame size is not specified; - * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html - */ - -THREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameHeight ) { - - if ( frameHeight === undefined ) frameHeight = 24; - - this.fov = 2 * THREE.Math.radToDeg( Math.atan( frameHeight / ( focalLength * 2 ) ) ); - this.updateProjectionMatrix(); - -} - - -/** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and - * the monitors are in grid like this - * - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - * - * then for each monitor you would call it like this - * - * var w = 1920; - * var h = 1080; - * var fullWidth = w * 3; - * var fullHeight = h * 2; - * - * --A-- - * camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * --B-- - * camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * --C-- - * camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * --D-- - * camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * --E-- - * camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * --F-- - * camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); - * - * Note there is no reason monitors have to be the same size or in a grid. - */ - -THREE.PerspectiveCamera.prototype.setViewOffset = function ( fullWidth, fullHeight, x, y, width, height ) { - - this.fullWidth = fullWidth; - this.fullHeight = fullHeight; - this.x = x; - this.y = y; - this.width = width; - this.height = height; - - this.updateProjectionMatrix(); - -}; - - -THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () { - - var fov = THREE.Math.radToDeg( 2 * Math.atan( Math.tan( THREE.Math.degToRad( this.fov ) * 0.5 ) / this.zoom ) ); - - if ( this.fullWidth ) { - - var aspect = this.fullWidth / this.fullHeight; - var top = Math.tan( THREE.Math.degToRad( fov * 0.5 ) ) * this.near; - var bottom = - top; - var left = aspect * bottom; - var right = aspect * top; - var width = Math.abs( right - left ); - var height = Math.abs( top - bottom ); - - this.projectionMatrix.makeFrustum( - left + this.x * width / this.fullWidth, - left + ( this.x + this.width ) * width / this.fullWidth, - top - ( this.y + this.height ) * height / this.fullHeight, - top - this.y * height / this.fullHeight, - this.near, - this.far - ); - - } else { - - this.projectionMatrix.makePerspective( fov, this.aspect, this.near, this.far ); - - } - -}; - -THREE.PerspectiveCamera.prototype.clone = function () { - - var camera = new THREE.PerspectiveCamera(); - - THREE.Camera.prototype.clone.call( this, camera ); - - camera.zoom = this.zoom; - - camera.fov = this.fov; - camera.aspect = this.aspect; - camera.near = this.near; - camera.far = this.far; - - camera.projectionMatrix.copy( this.projectionMatrix ); - - return camera; - -}; - -// File:src/lights/Light.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Light = function ( color ) { - - THREE.Object3D.call( this ); - - this.type = 'Light'; - - this.color = new THREE.Color( color ); - -}; - -THREE.Light.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Light.prototype.constructor = THREE.Light; - -THREE.Light.prototype.clone = function ( light ) { - - if ( light === undefined ) light = new THREE.Light(); - - THREE.Object3D.prototype.clone.call( this, light ); - - light.color.copy( this.color ); - - return light; - -}; - -// File:src/lights/AmbientLight.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.AmbientLight = function ( color ) { - - THREE.Light.call( this, color ); - - this.type = 'AmbientLight'; - -}; - -THREE.AmbientLight.prototype = Object.create( THREE.Light.prototype ); -THREE.AmbientLight.prototype.constructor = THREE.AmbientLight; - -THREE.AmbientLight.prototype.clone = function () { - - var light = new THREE.AmbientLight(); - - THREE.Light.prototype.clone.call( this, light ); - - return light; - -}; - -// File:src/lights/AreaLight.js - -/** - * @author MPanknin / http://www.redplant.de/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.AreaLight = function ( color, intensity ) { - - THREE.Light.call( this, color ); - - this.type = 'AreaLight'; - - this.normal = new THREE.Vector3( 0, - 1, 0 ); - this.right = new THREE.Vector3( 1, 0, 0 ); - - this.intensity = ( intensity !== undefined ) ? intensity : 1; - - this.width = 1.0; - this.height = 1.0; - - this.constantAttenuation = 1.5; - this.linearAttenuation = 0.5; - this.quadraticAttenuation = 0.1; - -}; - -THREE.AreaLight.prototype = Object.create( THREE.Light.prototype ); -THREE.AreaLight.prototype.constructor = THREE.AreaLight; - - -// File:src/lights/DirectionalLight.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.DirectionalLight = function ( color, intensity ) { - - THREE.Light.call( this, color ); - - this.type = 'DirectionalLight'; - - this.position.set( 0, 1, 0 ); - this.target = new THREE.Object3D(); - - this.intensity = ( intensity !== undefined ) ? intensity : 1; - - this.castShadow = false; - this.onlyShadow = false; - - // - - this.shadowCameraNear = 50; - this.shadowCameraFar = 5000; - - this.shadowCameraLeft = - 500; - this.shadowCameraRight = 500; - this.shadowCameraTop = 500; - this.shadowCameraBottom = - 500; - - this.shadowCameraVisible = false; - - this.shadowBias = 0; - this.shadowDarkness = 0.5; - - this.shadowMapWidth = 512; - this.shadowMapHeight = 512; - - // - - this.shadowCascade = false; - - this.shadowCascadeOffset = new THREE.Vector3( 0, 0, - 1000 ); - this.shadowCascadeCount = 2; - - this.shadowCascadeBias = [ 0, 0, 0 ]; - this.shadowCascadeWidth = [ 512, 512, 512 ]; - this.shadowCascadeHeight = [ 512, 512, 512 ]; - - this.shadowCascadeNearZ = [ - 1.000, 0.990, 0.998 ]; - this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ]; - - this.shadowCascadeArray = []; - - // - - this.shadowMap = null; - this.shadowMapSize = null; - this.shadowCamera = null; - this.shadowMatrix = null; - -}; - -THREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype ); -THREE.DirectionalLight.prototype.constructor = THREE.DirectionalLight; - -THREE.DirectionalLight.prototype.clone = function () { - - var light = new THREE.DirectionalLight(); - - THREE.Light.prototype.clone.call( this, light ); - - light.target = this.target.clone(); - - light.intensity = this.intensity; - - light.castShadow = this.castShadow; - light.onlyShadow = this.onlyShadow; - - // - - light.shadowCameraNear = this.shadowCameraNear; - light.shadowCameraFar = this.shadowCameraFar; - - light.shadowCameraLeft = this.shadowCameraLeft; - light.shadowCameraRight = this.shadowCameraRight; - light.shadowCameraTop = this.shadowCameraTop; - light.shadowCameraBottom = this.shadowCameraBottom; - - light.shadowCameraVisible = this.shadowCameraVisible; - - light.shadowBias = this.shadowBias; - light.shadowDarkness = this.shadowDarkness; - - light.shadowMapWidth = this.shadowMapWidth; - light.shadowMapHeight = this.shadowMapHeight; - - // - - light.shadowCascade = this.shadowCascade; - - light.shadowCascadeOffset.copy( this.shadowCascadeOffset ); - light.shadowCascadeCount = this.shadowCascadeCount; - - light.shadowCascadeBias = this.shadowCascadeBias.slice( 0 ); - light.shadowCascadeWidth = this.shadowCascadeWidth.slice( 0 ); - light.shadowCascadeHeight = this.shadowCascadeHeight.slice( 0 ); - - light.shadowCascadeNearZ = this.shadowCascadeNearZ.slice( 0 ); - light.shadowCascadeFarZ = this.shadowCascadeFarZ.slice( 0 ); - - return light; - -}; - -// File:src/lights/HemisphereLight.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.HemisphereLight = function ( skyColor, groundColor, intensity ) { - - THREE.Light.call( this, skyColor ); - - this.type = 'HemisphereLight'; - - this.position.set( 0, 100, 0 ); - - this.groundColor = new THREE.Color( groundColor ); - this.intensity = ( intensity !== undefined ) ? intensity : 1; - -}; - -THREE.HemisphereLight.prototype = Object.create( THREE.Light.prototype ); -THREE.HemisphereLight.prototype.constructor = THREE.HemisphereLight; - -THREE.HemisphereLight.prototype.clone = function () { - - var light = new THREE.HemisphereLight(); - - THREE.Light.prototype.clone.call( this, light ); - - light.groundColor.copy( this.groundColor ); - light.intensity = this.intensity; - - return light; - -}; - -// File:src/lights/PointLight.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.PointLight = function ( color, intensity, distance, decay ) { - - THREE.Light.call( this, color ); - - this.type = 'PointLight'; - - this.intensity = ( intensity !== undefined ) ? intensity : 1; - this.distance = ( distance !== undefined ) ? distance : 0; - this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2. - -}; - -THREE.PointLight.prototype = Object.create( THREE.Light.prototype ); -THREE.PointLight.prototype.constructor = THREE.PointLight; - -THREE.PointLight.prototype.clone = function () { - - var light = new THREE.PointLight(); - - THREE.Light.prototype.clone.call( this, light ); - - light.intensity = this.intensity; - light.distance = this.distance; - light.decay = this.decay; - - return light; - -}; - -// File:src/lights/SpotLight.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.SpotLight = function ( color, intensity, distance, angle, exponent, decay ) { - - THREE.Light.call( this, color ); - - this.type = 'SpotLight'; - - this.position.set( 0, 1, 0 ); - this.target = new THREE.Object3D(); - - this.intensity = ( intensity !== undefined ) ? intensity : 1; - this.distance = ( distance !== undefined ) ? distance : 0; - this.angle = ( angle !== undefined ) ? angle : Math.PI / 3; - this.exponent = ( exponent !== undefined ) ? exponent : 10; - this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2. - - this.castShadow = false; - this.onlyShadow = false; - - // - - this.shadowCameraNear = 50; - this.shadowCameraFar = 5000; - this.shadowCameraFov = 50; - - this.shadowCameraVisible = false; - - this.shadowBias = 0; - this.shadowDarkness = 0.5; - - this.shadowMapWidth = 512; - this.shadowMapHeight = 512; - - // - - this.shadowMap = null; - this.shadowMapSize = null; - this.shadowCamera = null; - this.shadowMatrix = null; - -}; - -THREE.SpotLight.prototype = Object.create( THREE.Light.prototype ); -THREE.SpotLight.prototype.constructor = THREE.SpotLight; - -THREE.SpotLight.prototype.clone = function () { - - var light = new THREE.SpotLight(); - - THREE.Light.prototype.clone.call( this, light ); - - light.target = this.target.clone(); - - light.intensity = this.intensity; - light.distance = this.distance; - light.angle = this.angle; - light.exponent = this.exponent; - light.decay = this.decay; - - light.castShadow = this.castShadow; - light.onlyShadow = this.onlyShadow; - - // - - light.shadowCameraNear = this.shadowCameraNear; - light.shadowCameraFar = this.shadowCameraFar; - light.shadowCameraFov = this.shadowCameraFov; - - light.shadowCameraVisible = this.shadowCameraVisible; - - light.shadowBias = this.shadowBias; - light.shadowDarkness = this.shadowDarkness; - - light.shadowMapWidth = this.shadowMapWidth; - light.shadowMapHeight = this.shadowMapHeight; - - return light; - -}; - -// File:src/loaders/Cache.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Cache = { - - files: {}, - - add: function ( key, file ) { - - // console.log( 'THREE.Cache', 'Adding key:', key ); - - this.files[ key ] = file; - - }, - - get: function ( key ) { - - // console.log( 'THREE.Cache', 'Checking key:', key ); - - return this.files[ key ]; - - }, - - remove: function ( key ) { - - delete this.files[ key ]; - - }, - - clear: function () { - - this.files = {} - - } - -}; - -// File:src/loaders/Loader.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Loader = function ( showStatus ) { - - this.showStatus = showStatus; - this.statusDomElement = showStatus ? THREE.Loader.prototype.addStatusElement() : null; - - this.imageLoader = new THREE.ImageLoader(); - - this.onLoadStart = function () {}; - this.onLoadProgress = function () {}; - this.onLoadComplete = function () {}; - -}; - -THREE.Loader.prototype = { - - constructor: THREE.Loader, - - crossOrigin: undefined, - - addStatusElement: function () { - - var e = document.createElement( 'div' ); - - e.style.position = 'absolute'; - e.style.right = '0px'; - e.style.top = '0px'; - e.style.fontSize = '0.8em'; - e.style.textAlign = 'left'; - e.style.background = 'rgba(0,0,0,0.25)'; - e.style.color = '#fff'; - e.style.width = '120px'; - e.style.padding = '0.5em 0.5em 0.5em 0.5em'; - e.style.zIndex = 1000; - - e.innerHTML = 'Loading ...'; - - return e; - - }, - - updateProgress: function ( progress ) { - - var message = 'Loaded '; - - if ( progress.total ) { - - message += ( 100 * progress.loaded / progress.total ).toFixed( 0 ) + '%'; - - - } else { - - message += ( progress.loaded / 1024 ).toFixed( 2 ) + ' KB'; - - } - - this.statusDomElement.innerHTML = message; - - }, - - extractUrlBase: function ( url ) { - - var parts = url.split( '/' ); - - if ( parts.length === 1 ) return './'; - - parts.pop(); - - return parts.join( '/' ) + '/'; - - }, - - initMaterials: function ( materials, texturePath ) { - - var array = []; - - for ( var i = 0; i < materials.length; ++ i ) { - - array[ i ] = this.createMaterial( materials[ i ], texturePath ); - - } - - return array; - - }, - - needsTangents: function ( materials ) { - - for ( var i = 0, il = materials.length; i < il; i ++ ) { - - var m = materials[ i ]; - - if ( m instanceof THREE.ShaderMaterial ) return true; - - } - - return false; - - }, - - createMaterial: function ( m, texturePath ) { - - var scope = this; - - function nearest_pow2( n ) { - - var l = Math.log( n ) / Math.LN2; - return Math.pow( 2, Math.round( l ) ); - - } - - function create_texture( where, name, sourceFile, repeat, offset, wrap, anisotropy ) { - - var fullPath = texturePath + sourceFile; - - var texture; - - var loader = THREE.Loader.Handlers.get( fullPath ); - - if ( loader !== null ) { - - texture = loader.load( fullPath ); - - } else { - - texture = new THREE.Texture(); - - loader = scope.imageLoader; - loader.crossOrigin = scope.crossOrigin; - loader.load( fullPath, function ( image ) { - - if ( THREE.Math.isPowerOfTwo( image.width ) === false || - THREE.Math.isPowerOfTwo( image.height ) === false ) { - - var width = nearest_pow2( image.width ); - var height = nearest_pow2( image.height ); - - var canvas = document.createElement( 'canvas' ); - canvas.width = width; - canvas.height = height; - - var context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0, width, height ); - - texture.image = canvas; - - } else { - - texture.image = image; - - } - - texture.needsUpdate = true; - - } ); - - } - - texture.sourceFile = sourceFile; - - if ( repeat ) { - - texture.repeat.set( repeat[ 0 ], repeat[ 1 ] ); - - if ( repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping; - if ( repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping; - - } - - if ( offset ) { - - texture.offset.set( offset[ 0 ], offset[ 1 ] ); - - } - - if ( wrap ) { - - var wrapMap = { - 'repeat': THREE.RepeatWrapping, - 'mirror': THREE.MirroredRepeatWrapping - } - - if ( wrapMap[ wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ wrap[ 0 ] ]; - if ( wrapMap[ wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ wrap[ 1 ] ]; - - } - - if ( anisotropy ) { - - texture.anisotropy = anisotropy; - - } - - where[ name ] = texture; - - } - - function rgb2hex( rgb ) { - - return ( rgb[ 0 ] * 255 << 16 ) + ( rgb[ 1 ] * 255 << 8 ) + rgb[ 2 ] * 255; - - } - - // defaults - - var mtype = 'MeshLambertMaterial'; - var mpars = { color: 0xeeeeee, opacity: 1.0, map: null, lightMap: null, normalMap: null, bumpMap: null, wireframe: false }; - - // parameters from model file - - if ( m.shading ) { - - var shading = m.shading.toLowerCase(); - - if ( shading === 'phong' ) mtype = 'MeshPhongMaterial'; - else if ( shading === 'basic' ) mtype = 'MeshBasicMaterial'; - - } - - if ( m.blending !== undefined && THREE[ m.blending ] !== undefined ) { - - mpars.blending = THREE[ m.blending ]; - - } - - if ( m.transparent !== undefined ) { - - mpars.transparent = m.transparent; - - } - - if ( m.opacity !== undefined && m.opacity < 1.0 ) { - - mpars.transparent = true; - - } - - if ( m.depthTest !== undefined ) { - - mpars.depthTest = m.depthTest; - - } - - if ( m.depthWrite !== undefined ) { - - mpars.depthWrite = m.depthWrite; - - } - - if ( m.visible !== undefined ) { - - mpars.visible = m.visible; - - } - - if ( m.flipSided !== undefined ) { - - mpars.side = THREE.BackSide; - - } - - if ( m.doubleSided !== undefined ) { - - mpars.side = THREE.DoubleSide; - - } - - if ( m.wireframe !== undefined ) { - - mpars.wireframe = m.wireframe; - - } - - if ( m.vertexColors !== undefined ) { - - if ( m.vertexColors === 'face' ) { - - mpars.vertexColors = THREE.FaceColors; - - } else if ( m.vertexColors ) { - - mpars.vertexColors = THREE.VertexColors; - - } - - } - - // colors - - if ( m.colorDiffuse ) { - - mpars.color = rgb2hex( m.colorDiffuse ); - - } else if ( m.DbgColor ) { - - mpars.color = m.DbgColor; - - } - - if ( m.colorSpecular ) { - - mpars.specular = rgb2hex( m.colorSpecular ); - - } - - if ( m.colorEmissive ) { - - mpars.emissive = rgb2hex( m.colorEmissive ); - - } - - // modifiers - - if ( m.transparency !== undefined ) { - - console.warn( 'THREE.Loader: transparency has been renamed to opacity' ); - m.opacity = m.transparency; - - } - - if ( m.opacity !== undefined ) { - - mpars.opacity = m.opacity; - - } - - if ( m.specularCoef ) { - - mpars.shininess = m.specularCoef; - - } - - // textures - - if ( m.mapDiffuse && texturePath ) { - - create_texture( mpars, 'map', m.mapDiffuse, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy ); - - } - - if ( m.mapLight && texturePath ) { - - create_texture( mpars, 'lightMap', m.mapLight, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy ); - - } - - if ( m.mapBump && texturePath ) { - - create_texture( mpars, 'bumpMap', m.mapBump, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy ); - - } - - if ( m.mapNormal && texturePath ) { - - create_texture( mpars, 'normalMap', m.mapNormal, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy ); - - } - - if ( m.mapSpecular && texturePath ) { - - create_texture( mpars, 'specularMap', m.mapSpecular, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy ); - - } - - if ( m.mapAlpha && texturePath ) { - - create_texture( mpars, 'alphaMap', m.mapAlpha, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy ); - - } - - // - - if ( m.mapBumpScale ) { - - mpars.bumpScale = m.mapBumpScale; - - } - - if ( m.mapNormalFactor ) { - - mpars.normalScale = new THREE.Vector2( m.mapNormalFactor, m.mapNormalFactor ); - - } - - var material = new THREE[ mtype ]( mpars ); - - if ( m.DbgName !== undefined ) material.name = m.DbgName; - - return material; - - } - -}; - -THREE.Loader.Handlers = { - - handlers: [], - - add: function ( regex, loader ) { - - this.handlers.push( regex, loader ); - - }, - - get: function ( file ) { - - for ( var i = 0, l = this.handlers.length; i < l; i += 2 ) { - - var regex = this.handlers[ i ]; - var loader = this.handlers[ i + 1 ]; - - if ( regex.test( file ) ) { - - return loader; - - } - - } - - return null; - - } - -}; - -// File:src/loaders/XHRLoader.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.XHRLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.XHRLoader.prototype = { - - constructor: THREE.XHRLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var cached = THREE.Cache.get( url ); - - if ( cached !== undefined ) { - - if ( onLoad ) onLoad( cached ); - return; - - } - - var request = new XMLHttpRequest(); - request.open( 'GET', url, true ); - - request.addEventListener( 'load', function ( event ) { - - THREE.Cache.add( url, this.response ); - - if ( onLoad ) onLoad( this.response ); - - scope.manager.itemEnd( url ); - - }, false ); - - if ( onProgress !== undefined ) { - - request.addEventListener( 'progress', function ( event ) { - - onProgress( event ); - - }, false ); - - } - - if ( onError !== undefined ) { - - request.addEventListener( 'error', function ( event ) { - - onError( event ); - - }, false ); - - } - - if ( this.crossOrigin !== undefined ) request.crossOrigin = this.crossOrigin; - if ( this.responseType !== undefined ) request.responseType = this.responseType; - - request.send( null ); - - scope.manager.itemStart( url ); - - }, - - setResponseType: function ( value ) { - - this.responseType = value; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - } - -}; - -// File:src/loaders/ImageLoader.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.ImageLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.ImageLoader.prototype = { - - constructor: THREE.ImageLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var cached = THREE.Cache.get( url ); - - if ( cached !== undefined ) { - - onLoad( cached ); - return; - - } - - var image = document.createElement( 'img' ); - - image.addEventListener( 'load', function ( event ) { - - THREE.Cache.add( url, this ); - - if ( onLoad ) onLoad( this ); - - scope.manager.itemEnd( url ); - - }, false ); - - if ( onProgress !== undefined ) { - - image.addEventListener( 'progress', function ( event ) { - - onProgress( event ); - - }, false ); - - } - - if ( onError !== undefined ) { - - image.addEventListener( 'error', function ( event ) { - - onError( event ); - - }, false ); - - } - - if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin; - - image.src = url; - - scope.manager.itemStart( url ); - - return image; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - } - -} - -// File:src/loaders/JSONLoader.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.JSONLoader = function ( showStatus ) { - - THREE.Loader.call( this, showStatus ); - - this.withCredentials = false; - -}; - -THREE.JSONLoader.prototype = Object.create( THREE.Loader.prototype ); -THREE.JSONLoader.prototype.constructor = THREE.JSONLoader; - -THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) { - - // todo: unify load API to for easier SceneLoader use - - texturePath = texturePath && ( typeof texturePath === 'string' ) ? texturePath : this.extractUrlBase( url ); - - this.onLoadStart(); - this.loadAjaxJSON( this, url, callback, texturePath ); - -}; - -THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, texturePath, callbackProgress ) { - - var xhr = new XMLHttpRequest(); - - var length = 0; - - xhr.onreadystatechange = function () { - - if ( xhr.readyState === xhr.DONE ) { - - if ( xhr.status === 200 || xhr.status === 0 ) { - - if ( xhr.responseText ) { - - var json = JSON.parse( xhr.responseText ); - var metadata = json.metadata; - - if ( metadata !== undefined ) { - - if ( metadata.type === 'object' ) { - - THREE.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.ObjectLoader instead.' ); - return; - - } - - if ( metadata.type === 'scene' ) { - - THREE.error( 'THREE.JSONLoader: ' + url + ' seems to be a Scene. Use THREE.SceneLoader instead.' ); - return; - - } - - } - - var result = context.parse( json, texturePath ); - callback( result.geometry, result.materials ); - - } else { - - THREE.error( 'THREE.JSONLoader: ' + url + ' seems to be unreachable or the file is empty.' ); - - } - - // in context of more complex asset initialization - // do not block on single failed file - // maybe should go even one more level up - - context.onLoadComplete(); - - } else { - - THREE.error( 'THREE.JSONLoader: Couldn\'t load ' + url + ' (' + xhr.status + ')' ); - - } - - } else if ( xhr.readyState === xhr.LOADING ) { - - if ( callbackProgress ) { - - if ( length === 0 ) { - - length = xhr.getResponseHeader( 'Content-Length' ); - - } - - callbackProgress( { total: length, loaded: xhr.responseText.length } ); - - } - - } else if ( xhr.readyState === xhr.HEADERS_RECEIVED ) { - - if ( callbackProgress !== undefined ) { - - length = xhr.getResponseHeader( 'Content-Length' ); - - } - - } - - }; - - xhr.open( 'GET', url, true ); - xhr.withCredentials = this.withCredentials; - xhr.send( null ); - -}; - -THREE.JSONLoader.prototype.parse = function ( json, texturePath ) { - - var geometry = new THREE.Geometry(), - scale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0; - - parseModel( scale ); - - parseSkin(); - parseMorphing( scale ); - - geometry.computeFaceNormals(); - geometry.computeBoundingSphere(); - - function parseModel( scale ) { - - function isBitSet( value, position ) { - - return value & ( 1 << position ); - - } - - var i, j, fi, - - offset, zLength, - - colorIndex, normalIndex, uvIndex, materialIndex, - - type, - isQuad, - hasMaterial, - hasFaceVertexUv, - hasFaceNormal, hasFaceVertexNormal, - hasFaceColor, hasFaceVertexColor, - - vertex, face, faceA, faceB, hex, normal, - - uvLayer, uv, u, v, - - faces = json.faces, - vertices = json.vertices, - normals = json.normals, - colors = json.colors, - - nUvLayers = 0; - - if ( json.uvs !== undefined ) { - - // disregard empty arrays - - for ( i = 0; i < json.uvs.length; i ++ ) { - - if ( json.uvs[ i ].length ) nUvLayers ++; - - } - - for ( i = 0; i < nUvLayers; i ++ ) { - - geometry.faceVertexUvs[ i ] = []; - - } - - } - - offset = 0; - zLength = vertices.length; - - while ( offset < zLength ) { - - vertex = new THREE.Vector3(); - - vertex.x = vertices[ offset ++ ] * scale; - vertex.y = vertices[ offset ++ ] * scale; - vertex.z = vertices[ offset ++ ] * scale; - - geometry.vertices.push( vertex ); - - } - - offset = 0; - zLength = faces.length; - - while ( offset < zLength ) { - - type = faces[ offset ++ ]; - - - isQuad = isBitSet( type, 0 ); - hasMaterial = isBitSet( type, 1 ); - hasFaceVertexUv = isBitSet( type, 3 ); - hasFaceNormal = isBitSet( type, 4 ); - hasFaceVertexNormal = isBitSet( type, 5 ); - hasFaceColor = isBitSet( type, 6 ); - hasFaceVertexColor = isBitSet( type, 7 ); - - // console.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor); - - if ( isQuad ) { - - faceA = new THREE.Face3(); - faceA.a = faces[ offset ]; - faceA.b = faces[ offset + 1 ]; - faceA.c = faces[ offset + 3 ]; - - faceB = new THREE.Face3(); - faceB.a = faces[ offset + 1 ]; - faceB.b = faces[ offset + 2 ]; - faceB.c = faces[ offset + 3 ]; - - offset += 4; - - if ( hasMaterial ) { - - materialIndex = faces[ offset ++ ]; - faceA.materialIndex = materialIndex; - faceB.materialIndex = materialIndex; - - } - - // to get face <=> uv index correspondence - - fi = geometry.faces.length; - - if ( hasFaceVertexUv ) { - - for ( i = 0; i < nUvLayers; i ++ ) { - - uvLayer = json.uvs[ i ]; - - geometry.faceVertexUvs[ i ][ fi ] = []; - geometry.faceVertexUvs[ i ][ fi + 1 ] = [] - - for ( j = 0; j < 4; j ++ ) { - - uvIndex = faces[ offset ++ ]; - - u = uvLayer[ uvIndex * 2 ]; - v = uvLayer[ uvIndex * 2 + 1 ]; - - uv = new THREE.Vector2( u, v ); - - if ( j !== 2 ) geometry.faceVertexUvs[ i ][ fi ].push( uv ); - if ( j !== 0 ) geometry.faceVertexUvs[ i ][ fi + 1 ].push( uv ); - - } - - } - - } - - if ( hasFaceNormal ) { - - normalIndex = faces[ offset ++ ] * 3; - - faceA.normal.set( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - faceB.normal.copy( faceA.normal ); - - } - - if ( hasFaceVertexNormal ) { - - for ( i = 0; i < 4; i ++ ) { - - normalIndex = faces[ offset ++ ] * 3; - - normal = new THREE.Vector3( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - - if ( i !== 2 ) faceA.vertexNormals.push( normal ); - if ( i !== 0 ) faceB.vertexNormals.push( normal ); - - } - - } - - - if ( hasFaceColor ) { - - colorIndex = faces[ offset ++ ]; - hex = colors[ colorIndex ]; - - faceA.color.setHex( hex ); - faceB.color.setHex( hex ); - - } - - - if ( hasFaceVertexColor ) { - - for ( i = 0; i < 4; i ++ ) { - - colorIndex = faces[ offset ++ ]; - hex = colors[ colorIndex ]; - - if ( i !== 2 ) faceA.vertexColors.push( new THREE.Color( hex ) ); - if ( i !== 0 ) faceB.vertexColors.push( new THREE.Color( hex ) ); - - } - - } - - geometry.faces.push( faceA ); - geometry.faces.push( faceB ); - - } else { - - face = new THREE.Face3(); - face.a = faces[ offset ++ ]; - face.b = faces[ offset ++ ]; - face.c = faces[ offset ++ ]; - - if ( hasMaterial ) { - - materialIndex = faces[ offset ++ ]; - face.materialIndex = materialIndex; - - } - - // to get face <=> uv index correspondence - - fi = geometry.faces.length; - - if ( hasFaceVertexUv ) { - - for ( i = 0; i < nUvLayers; i ++ ) { - - uvLayer = json.uvs[ i ]; - - geometry.faceVertexUvs[ i ][ fi ] = []; - - for ( j = 0; j < 3; j ++ ) { - - uvIndex = faces[ offset ++ ]; - - u = uvLayer[ uvIndex * 2 ]; - v = uvLayer[ uvIndex * 2 + 1 ]; - - uv = new THREE.Vector2( u, v ); - - geometry.faceVertexUvs[ i ][ fi ].push( uv ); - - } - - } - - } - - if ( hasFaceNormal ) { - - normalIndex = faces[ offset ++ ] * 3; - - face.normal.set( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - } - - if ( hasFaceVertexNormal ) { - - for ( i = 0; i < 3; i ++ ) { - - normalIndex = faces[ offset ++ ] * 3; - - normal = new THREE.Vector3( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - face.vertexNormals.push( normal ); - - } - - } - - - if ( hasFaceColor ) { - - colorIndex = faces[ offset ++ ]; - face.color.setHex( colors[ colorIndex ] ); - - } - - - if ( hasFaceVertexColor ) { - - for ( i = 0; i < 3; i ++ ) { - - colorIndex = faces[ offset ++ ]; - face.vertexColors.push( new THREE.Color( colors[ colorIndex ] ) ); - - } - - } - - geometry.faces.push( face ); - - } - - } - - }; - - function parseSkin() { - var influencesPerVertex = ( json.influencesPerVertex !== undefined ) ? json.influencesPerVertex : 2; - - if ( json.skinWeights ) { - - for ( var i = 0, l = json.skinWeights.length; i < l; i += influencesPerVertex ) { - - var x = json.skinWeights[ i ]; - var y = ( influencesPerVertex > 1 ) ? json.skinWeights[ i + 1 ] : 0; - var z = ( influencesPerVertex > 2 ) ? json.skinWeights[ i + 2 ] : 0; - var w = ( influencesPerVertex > 3 ) ? json.skinWeights[ i + 3 ] : 0; - - geometry.skinWeights.push( new THREE.Vector4( x, y, z, w ) ); - - } - - } - - if ( json.skinIndices ) { - - for ( var i = 0, l = json.skinIndices.length; i < l; i += influencesPerVertex ) { - - var a = json.skinIndices[ i ]; - var b = ( influencesPerVertex > 1 ) ? json.skinIndices[ i + 1 ] : 0; - var c = ( influencesPerVertex > 2 ) ? json.skinIndices[ i + 2 ] : 0; - var d = ( influencesPerVertex > 3 ) ? json.skinIndices[ i + 3 ] : 0; - - geometry.skinIndices.push( new THREE.Vector4( a, b, c, d ) ); - - } - - } - - geometry.bones = json.bones; - - if ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) { - - THREE.warn( 'THREE.JSONLoader: When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' + - geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' ); - - } - - - // could change this to json.animations[0] or remove completely - - geometry.animation = json.animation; - geometry.animations = json.animations; - - }; - - function parseMorphing( scale ) { - - if ( json.morphTargets !== undefined ) { - - var i, l, v, vl, dstVertices, srcVertices; - - for ( i = 0, l = json.morphTargets.length; i < l; i ++ ) { - - geometry.morphTargets[ i ] = {}; - geometry.morphTargets[ i ].name = json.morphTargets[ i ].name; - geometry.morphTargets[ i ].vertices = []; - - dstVertices = geometry.morphTargets[ i ].vertices; - srcVertices = json.morphTargets [ i ].vertices; - - for ( v = 0, vl = srcVertices.length; v < vl; v += 3 ) { - - var vertex = new THREE.Vector3(); - vertex.x = srcVertices[ v ] * scale; - vertex.y = srcVertices[ v + 1 ] * scale; - vertex.z = srcVertices[ v + 2 ] * scale; - - dstVertices.push( vertex ); - - } - - } - - } - - if ( json.morphColors !== undefined ) { - - var i, l, c, cl, dstColors, srcColors, color; - - for ( i = 0, l = json.morphColors.length; i < l; i ++ ) { - - geometry.morphColors[ i ] = {}; - geometry.morphColors[ i ].name = json.morphColors[ i ].name; - geometry.morphColors[ i ].colors = []; - - dstColors = geometry.morphColors[ i ].colors; - srcColors = json.morphColors [ i ].colors; - - for ( c = 0, cl = srcColors.length; c < cl; c += 3 ) { - - color = new THREE.Color( 0xffaa00 ); - color.setRGB( srcColors[ c ], srcColors[ c + 1 ], srcColors[ c + 2 ] ); - dstColors.push( color ); - - } - - } - - } - - }; - - if ( json.materials === undefined || json.materials.length === 0 ) { - - return { geometry: geometry }; - - } else { - - var materials = this.initMaterials( json.materials, texturePath ); - - if ( this.needsTangents( materials ) ) { - - geometry.computeTangents(); - - } - - return { geometry: geometry, materials: materials }; - - } - -}; - -// File:src/loaders/LoadingManager.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.LoadingManager = function ( onLoad, onProgress, onError ) { - - var scope = this; - - var loaded = 0, total = 0; - - this.onLoad = onLoad; - this.onProgress = onProgress; - this.onError = onError; - - this.itemStart = function ( url ) { - - total ++; - - }; - - this.itemEnd = function ( url ) { - - loaded ++; - - if ( scope.onProgress !== undefined ) { - - scope.onProgress( url, loaded, total ); - - } - - if ( loaded === total && scope.onLoad !== undefined ) { - - scope.onLoad(); - - } - - }; - -}; - -THREE.DefaultLoadingManager = new THREE.LoadingManager(); - -// File:src/loaders/BufferGeometryLoader.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.BufferGeometryLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.BufferGeometryLoader.prototype = { - - constructor: THREE.BufferGeometryLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.XHRLoader( scope.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - }, onProgress, onError ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json ) { - - var geometry = new THREE.BufferGeometry(); - - var attributes = json.data.attributes; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - var typedArray = new self[ attribute.type ]( attribute.array ); - - geometry.addAttribute( key, new THREE.BufferAttribute( typedArray, attribute.itemSize ) ); - - } - - var offsets = json.data.offsets; - - if ( offsets !== undefined ) { - - geometry.offsets = JSON.parse( JSON.stringify( offsets ) ); - - } - - var boundingSphere = json.data.boundingSphere; - - if ( boundingSphere !== undefined ) { - - var center = new THREE.Vector3(); - - if ( boundingSphere.center !== undefined ) { - - center.fromArray( boundingSphere.center ); - - } - - geometry.boundingSphere = new THREE.Sphere( center, boundingSphere.radius ); - - } - - return geometry; - - } - -}; - -// File:src/loaders/MaterialLoader.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.MaterialLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.MaterialLoader.prototype = { - - constructor: THREE.MaterialLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.XHRLoader( scope.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - }, onProgress, onError ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json ) { - - var material = new THREE[ json.type ]; - - if ( json.color !== undefined ) material.color.setHex( json.color ); - if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive ); - if ( json.specular !== undefined ) material.specular.setHex( json.specular ); - if ( json.shininess !== undefined ) material.shininess = json.shininess; - if ( json.uniforms !== undefined ) material.uniforms = json.uniforms; - if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader; - if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader; - if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors; - if ( json.shading !== undefined ) material.shading = json.shading; - if ( json.blending !== undefined ) material.blending = json.blending; - if ( json.side !== undefined ) material.side = json.side; - if ( json.opacity !== undefined ) material.opacity = json.opacity; - if ( json.transparent !== undefined ) material.transparent = json.transparent; - if ( json.wireframe !== undefined ) material.wireframe = json.wireframe; - - // for PointCloudMaterial - if ( json.size !== undefined ) material.size = json.size; - if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation; - - if ( json.materials !== undefined ) { - - for ( var i = 0, l = json.materials.length; i < l; i ++ ) { - - material.materials.push( this.parse( json.materials[ i ] ) ); - - } - - } - - return material; - - } - -}; - -// File:src/loaders/ObjectLoader.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.ObjectLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - this.texturePath = ''; - -}; - -THREE.ObjectLoader.prototype = { - - constructor: THREE.ObjectLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - if ( this.texturePath === '' ) { - - this.texturePath = url.substring( 0, url.lastIndexOf( '/' ) + 1 ); - - } - - var scope = this; - - var loader = new THREE.XHRLoader( scope.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - scope.parse( JSON.parse( text ), onLoad ); - - }, onProgress, onError ); - - }, - - setTexturePath: function ( value ) { - - this.texturePath = value; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json, onLoad ) { - - var geometries = this.parseGeometries( json.geometries ); - - var images = this.parseImages( json.images, function () { - - if ( onLoad !== undefined ) onLoad( object ); - - } ); - var textures = this.parseTextures( json.textures, images ); - var materials = this.parseMaterials( json.materials, textures ); - var object = this.parseObject( json.object, geometries, materials ); - - if ( json.images === undefined || json.images.length === 0 ) { - - if ( onLoad !== undefined ) onLoad( object ); - - } - - return object; - - }, - - parseGeometries: function ( json ) { - - var geometries = {}; - - if ( json !== undefined ) { - - var geometryLoader = new THREE.JSONLoader(); - var bufferGeometryLoader = new THREE.BufferGeometryLoader(); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var geometry; - var data = json[ i ]; - - switch ( data.type ) { - - case 'PlaneGeometry': - case 'PlaneBufferGeometry': - - geometry = new THREE[ data.type ]( - data.width, - data.height, - data.widthSegments, - data.heightSegments - ); - - break; - - case 'BoxGeometry': - case 'CubeGeometry': // backwards compatible - - geometry = new THREE.BoxGeometry( - data.width, - data.height, - data.depth, - data.widthSegments, - data.heightSegments, - data.depthSegments - ); - - break; - - case 'CircleGeometry': - - geometry = new THREE.CircleGeometry( - data.radius, - data.segments - ); - - break; - - case 'CylinderGeometry': - - geometry = new THREE.CylinderGeometry( - data.radiusTop, - data.radiusBottom, - data.height, - data.radialSegments, - data.heightSegments, - data.openEnded - ); - - break; - - case 'SphereGeometry': - - geometry = new THREE.SphereGeometry( - data.radius, - data.widthSegments, - data.heightSegments, - data.phiStart, - data.phiLength, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'IcosahedronGeometry': - - geometry = new THREE.IcosahedronGeometry( - data.radius, - data.detail - ); - - break; - - case 'TorusGeometry': - - geometry = new THREE.TorusGeometry( - data.radius, - data.tube, - data.radialSegments, - data.tubularSegments, - data.arc - ); - - break; - - case 'TorusKnotGeometry': - - geometry = new THREE.TorusKnotGeometry( - data.radius, - data.tube, - data.radialSegments, - data.tubularSegments, - data.p, - data.q, - data.heightScale - ); - - break; - - case 'BufferGeometry': - - geometry = bufferGeometryLoader.parse( data ); - - break; - - case 'Geometry': - - geometry = geometryLoader.parse( data.data ).geometry; - - break; - - } - - geometry.uuid = data.uuid; - - if ( data.name !== undefined ) geometry.name = data.name; - - geometries[ data.uuid ] = geometry; - - } - - } - - return geometries; - - }, - - parseMaterials: function ( json, textures ) { - - var materials = {}; - - if ( json !== undefined ) { - - var getTexture = function ( name ) { - - if ( textures[ name ] === undefined ) { - - THREE.warn( 'THREE.ObjectLoader: Undefined texture', name ); - - } - - return textures[ name ]; - - }; - - var loader = new THREE.MaterialLoader(); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var data = json[ i ]; - var material = loader.parse( data ); - - material.uuid = data.uuid; - - if ( data.name !== undefined ) material.name = data.name; - - if ( data.map !== undefined ) { - - material.map = getTexture( data.map ); - - } - - if ( data.bumpMap !== undefined ) { - - material.bumpMap = getTexture( data.bumpMap ); - if ( data.bumpScale ) { - material.bumpScale = new THREE.Vector2( data.bumpScale, data.bumpScale ); - } - - } - - if ( data.alphaMap !== undefined ) { - - material.alphaMap = getTexture( data.alphaMap ); - - } - - if ( data.envMap !== undefined ) { - - material.envMap = getTexture( data.envMap ); - - } - - if ( data.normalMap !== undefined ) { - - material.normalMap = getTexture( data.normalMap ); - if ( data.normalScale ) { - material.normalScale = new THREE.Vector2( data.normalScale, data.normalScale ); - } - - } - - if ( data.lightMap !== undefined ) { - - material.lightMap = getTexture( data.lightMap ); - - } - - if ( data.specularMap !== undefined ) { - - material.specularMap = getTexture( data.specularMap ); - - } - - materials[ data.uuid ] = material; - - } - - } - - return materials; - - }, - - parseImages: function ( json, onLoad ) { - - var scope = this; - var images = {}; - - if ( json !== undefined && json.length > 0 ) { - - var manager = new THREE.LoadingManager( onLoad ); - - var loader = new THREE.ImageLoader( manager ); - loader.setCrossOrigin( this.crossOrigin ); - - var loadImage = function ( url ) { - - scope.manager.itemStart( url ); - - return loader.load( url, function () { - - scope.manager.itemEnd( url ); - - } ); - - }; - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var image = json[ i ]; - var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url; - - images[ image.uuid ] = loadImage( path ); - - } - - } - - return images; - - }, - - parseTextures: function ( json, images ) { - - var textures = {}; - - if ( json !== undefined ) { - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var data = json[ i ]; - - if ( data.image === undefined ) { - - THREE.warn( 'THREE.ObjectLoader: No "image" speficied for', data.uuid ); - - } - - if ( images[ data.image ] === undefined ) { - - THREE.warn( 'THREE.ObjectLoader: Undefined image', data.image ); - - } - - var texture = new THREE.Texture( images[ data.image ] ); - texture.needsUpdate = true; - - texture.uuid = data.uuid; - - if ( data.name !== undefined ) texture.name = data.name; - if ( data.repeat !== undefined ) texture.repeat = new THREE.Vector2( data.repeat[ 0 ], data.repeat[ 1 ] ); - if ( data.minFilter !== undefined ) texture.minFilter = THREE[ data.minFilter ]; - if ( data.magFilter !== undefined ) texture.magFilter = THREE[ data.magFilter ]; - if ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy; - if ( data.wrap instanceof Array ) { - - texture.wrapS = THREE[ data.wrap[ 0 ] ]; - texture.wrapT = THREE[ data.wrap[ 1 ] ]; - - } - - textures[ data.uuid ] = texture; - - } - - } - - return textures; - - }, - - parseObject: function () { - - var matrix = new THREE.Matrix4(); - - return function ( data, geometries, materials ) { - - var object; - - var getGeometry = function ( name ) { - - if ( geometries[ name ] === undefined ) { - - THREE.warn( 'THREE.ObjectLoader: Undefined geometry', name ); - - } - - return geometries[ name ]; - - }; - - var getMaterial = function ( name ) { - - if ( materials[ name ] === undefined ) { - - THREE.warn( 'THREE.ObjectLoader: Undefined material', name ); - - } - - return materials[ name ]; - - }; - - switch ( data.type ) { - - case 'Scene': - - object = new THREE.Scene(); - - break; - - case 'PerspectiveCamera': - - object = new THREE.PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); - - break; - - case 'OrthographicCamera': - - object = new THREE.OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); - - break; - - case 'AmbientLight': - - object = new THREE.AmbientLight( data.color ); - - break; - - case 'DirectionalLight': - - object = new THREE.DirectionalLight( data.color, data.intensity ); - - break; - - case 'PointLight': - - object = new THREE.PointLight( data.color, data.intensity, data.distance, data.decay ); - - break; - - case 'SpotLight': - - object = new THREE.SpotLight( data.color, data.intensity, data.distance, data.angle, data.exponent, data.decay ); - - break; - - case 'HemisphereLight': - - object = new THREE.HemisphereLight( data.color, data.groundColor, data.intensity ); - - break; - - case 'Mesh': - - object = new THREE.Mesh( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'Line': - - object = new THREE.Line( getGeometry( data.geometry ), getMaterial( data.material ), data.mode ); - - break; - - case 'PointCloud': - - object = new THREE.PointCloud( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'Sprite': - - object = new THREE.Sprite( getMaterial( data.material ) ); - - break; - - case 'Group': - - object = new THREE.Group(); - - break; - - default: - - object = new THREE.Object3D(); - - } - - object.uuid = data.uuid; - - if ( data.name !== undefined ) object.name = data.name; - if ( data.matrix !== undefined ) { - - matrix.fromArray( data.matrix ); - matrix.decompose( object.position, object.quaternion, object.scale ); - - } else { - - if ( data.position !== undefined ) object.position.fromArray( data.position ); - if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); - if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); - - } - - if ( data.visible !== undefined ) object.visible = data.visible; - if ( data.userData !== undefined ) object.userData = data.userData; - - if ( data.children !== undefined ) { - - for ( var child in data.children ) { - - object.add( this.parseObject( data.children[ child ], geometries, materials ) ); - - } - - } - - return object; - - } - - }() - -}; - -// File:src/loaders/TextureLoader.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.TextureLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.TextureLoader.prototype = { - - constructor: THREE.TextureLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.ImageLoader( scope.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( image ) { - - var texture = new THREE.Texture( image ); - texture.needsUpdate = true; - - if ( onLoad !== undefined ) { - - onLoad( texture ); - - } - - }, onProgress, onError ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - } - -}; - -// File:src/loaders/BinaryTextureLoader.js - -/** - * @author Nikos M. / https://github.com/foo123/ - * - * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...) - */ - -THREE.DataTextureLoader = THREE.BinaryTextureLoader = function () { - - // override in sub classes - this._parser = null; - -}; - -THREE.BinaryTextureLoader.prototype = { - - constructor: THREE.BinaryTextureLoader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var texture = new THREE.DataTexture( ); - - var loader = new THREE.XHRLoader(); - loader.setResponseType( 'arraybuffer' ); - - loader.load( url, function ( buffer ) { - - var texData = scope._parser( buffer ); - - if ( !texData ) return; - - if ( undefined !== texData.image ) { - - texture.image = texData.image; - - } else if ( undefined !== texData.data ) { - - texture.image.width = texData.width; - texture.image.height = texData.height; - texture.image.data = texData.data; - - } - - texture.wrapS = undefined !== texData.wrapS ? texData.wrapS : THREE.ClampToEdgeWrapping; - texture.wrapT = undefined !== texData.wrapT ? texData.wrapT : THREE.ClampToEdgeWrapping; - - texture.magFilter = undefined !== texData.magFilter ? texData.magFilter : THREE.LinearFilter; - texture.minFilter = undefined !== texData.minFilter ? texData.minFilter : THREE.LinearMipMapLinearFilter; - - texture.anisotropy = undefined !== texData.anisotropy ? texData.anisotropy : 1; - - if ( undefined !== texData.format ) { - - texture.format = texData.format; - - } - if ( undefined !== texData.type ) { - - texture.type = texData.type; - - } - - if ( undefined !== texData.mipmaps ) { - - texture.mipmaps = texData.mipmaps; - - } - - if ( 1 === texData.mipmapCount ) { - - texture.minFilter = THREE.LinearFilter; - - } - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture, texData ); - - }, onProgress, onError ); - - - return texture; - - } - -}; - -// File:src/loaders/CompressedTextureLoader.js - -/** - * @author mrdoob / http://mrdoob.com/ - * - * Abstract Base class to block based textures loader (dds, pvr, ...) - */ - -THREE.CompressedTextureLoader = function () { - - // override in sub classes - this._parser = null; - -}; - - -THREE.CompressedTextureLoader.prototype = { - - constructor: THREE.CompressedTextureLoader, - - load: function ( url, onLoad, onError ) { - - var scope = this; - - var images = []; - - var texture = new THREE.CompressedTexture(); - texture.image = images; - - var loader = new THREE.XHRLoader(); - loader.setResponseType( 'arraybuffer' ); - - if ( url instanceof Array ) { - - var loaded = 0; - - var loadTexture = function ( i ) { - - loader.load( url[ i ], function ( buffer ) { - - var texDatas = scope._parser( buffer, true ); - - images[ i ] = { - width: texDatas.width, - height: texDatas.height, - format: texDatas.format, - mipmaps: texDatas.mipmaps - }; - - loaded += 1; - - if ( loaded === 6 ) { - - if (texDatas.mipmapCount == 1) - texture.minFilter = THREE.LinearFilter; - - texture.format = texDatas.format; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - } ); - - }; - - for ( var i = 0, il = url.length; i < il; ++ i ) { - - loadTexture( i ); - - } - - } else { - - // compressed cubemap texture stored in a single DDS file - - loader.load( url, function ( buffer ) { - - var texDatas = scope._parser( buffer, true ); - - if ( texDatas.isCubemap ) { - - var faces = texDatas.mipmaps.length / texDatas.mipmapCount; - - for ( var f = 0; f < faces; f ++ ) { - - images[ f ] = { mipmaps : [] }; - - for ( var i = 0; i < texDatas.mipmapCount; i ++ ) { - - images[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] ); - images[ f ].format = texDatas.format; - images[ f ].width = texDatas.width; - images[ f ].height = texDatas.height; - - } - - } - - } else { - - texture.image.width = texDatas.width; - texture.image.height = texDatas.height; - texture.mipmaps = texDatas.mipmaps; - - } - - if ( texDatas.mipmapCount === 1 ) { - - texture.minFilter = THREE.LinearFilter; - - } - - texture.format = texDatas.format; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } ); - - } - - return texture; - - } - -}; - -// File:src/materials/Material.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Material = function () { - - Object.defineProperty( this, 'id', { value: THREE.MaterialIdCount ++ } ); - - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - this.type = 'Material'; - - this.side = THREE.FrontSide; - - this.opacity = 1; - this.transparent = false; - - this.blending = THREE.NormalBlending; - - this.blendSrc = THREE.SrcAlphaFactor; - this.blendDst = THREE.OneMinusSrcAlphaFactor; - this.blendEquation = THREE.AddEquation; - this.blendSrcAlpha = null; - this.blendDstAlpha = null; - this.blendEquationAlpha = null; - - this.depthTest = true; - this.depthWrite = true; - - this.colorWrite = true; - - this.polygonOffset = false; - this.polygonOffsetFactor = 0; - this.polygonOffsetUnits = 0; - - this.alphaTest = 0; - - this.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer - - this.visible = true; - - this._needsUpdate = true; - -}; - -THREE.Material.prototype = { - - constructor: THREE.Material, - - get needsUpdate () { - - return this._needsUpdate; - - }, - - set needsUpdate ( value ) { - - if ( value === true ) this.update(); - - this._needsUpdate = value; - - }, - - setValues: function ( values ) { - - if ( values === undefined ) return; - - for ( var key in values ) { - - var newValue = values[ key ]; - - if ( newValue === undefined ) { - - THREE.warn( "THREE.Material: '" + key + "' parameter is undefined." ); - continue; - - } - - if ( key in this ) { - - var currentValue = this[ key ]; - - if ( currentValue instanceof THREE.Color ) { - - currentValue.set( newValue ); - - } else if ( currentValue instanceof THREE.Vector3 && newValue instanceof THREE.Vector3 ) { - - currentValue.copy( newValue ); - - } else if ( key == 'overdraw' ) { - - // ensure overdraw is backwards-compatable with legacy boolean type - this[ key ] = Number( newValue ); - - } else { - - this[ key ] = newValue; - - } - - } - - } - - }, - - toJSON: function () { - - var output = { - metadata: { - version: 4.2, - type: 'material', - generator: 'MaterialExporter' - }, - uuid: this.uuid, - type: this.type - }; - - if ( this.name !== "" ) output.name = this.name; - - if ( this instanceof THREE.MeshBasicMaterial ) { - - output.color = this.color.getHex(); - if ( this.vertexColors !== THREE.NoColors ) output.vertexColors = this.vertexColors; - if ( this.blending !== THREE.NormalBlending ) output.blending = this.blending; - if ( this.side !== THREE.FrontSide ) output.side = this.side; - - } else if ( this instanceof THREE.MeshLambertMaterial ) { - - output.color = this.color.getHex(); - output.emissive = this.emissive.getHex(); - if ( this.vertexColors !== THREE.NoColors ) output.vertexColors = this.vertexColors; - if ( this.shading !== THREE.SmoothShading ) output.shading = this.shading; - if ( this.blending !== THREE.NormalBlending ) output.blending = this.blending; - if ( this.side !== THREE.FrontSide ) output.side = this.side; - - } else if ( this instanceof THREE.MeshPhongMaterial ) { - - output.color = this.color.getHex(); - output.emissive = this.emissive.getHex(); - output.specular = this.specular.getHex(); - output.shininess = this.shininess; - if ( this.vertexColors !== THREE.NoColors ) output.vertexColors = this.vertexColors; - if ( this.shading !== THREE.SmoothShading ) output.shading = this.shading; - if ( this.blending !== THREE.NormalBlending ) output.blending = this.blending; - if ( this.side !== THREE.FrontSide ) output.side = this.side; - - } else if ( this instanceof THREE.MeshNormalMaterial ) { - - if ( this.blending !== THREE.NormalBlending ) output.blending = this.blending; - if ( this.side !== THREE.FrontSide ) output.side = this.side; - - } else if ( this instanceof THREE.MeshDepthMaterial ) { - - if ( this.blending !== THREE.NormalBlending ) output.blending = this.blending; - if ( this.side !== THREE.FrontSide ) output.side = this.side; - - } else if ( this instanceof THREE.PointCloudMaterial ) { - - output.size = this.size; - output.sizeAttenuation = this.sizeAttenuation; - output.color = this.color.getHex(); - - if ( this.vertexColors !== THREE.NoColors ) output.vertexColors = this.vertexColors; - if ( this.blending !== THREE.NormalBlending ) output.blending = this.blending; - - } else if ( this instanceof THREE.ShaderMaterial ) { - - output.uniforms = this.uniforms; - output.vertexShader = this.vertexShader; - output.fragmentShader = this.fragmentShader; - - } else if ( this instanceof THREE.SpriteMaterial ) { - - output.color = this.color.getHex(); - - } - - if ( this.opacity < 1 ) output.opacity = this.opacity; - if ( this.transparent !== false ) output.transparent = this.transparent; - if ( this.wireframe !== false ) output.wireframe = this.wireframe; - - return output; - - }, - - clone: function ( material ) { - - if ( material === undefined ) material = new THREE.Material(); - - material.name = this.name; - - material.side = this.side; - - material.opacity = this.opacity; - material.transparent = this.transparent; - - material.blending = this.blending; - - material.blendSrc = this.blendSrc; - material.blendDst = this.blendDst; - material.blendEquation = this.blendEquation; - material.blendSrcAlpha = this.blendSrcAlpha; - material.blendDstAlpha = this.blendDstAlpha; - material.blendEquationAlpha = this.blendEquationAlpha; - - material.depthTest = this.depthTest; - material.depthWrite = this.depthWrite; - - material.polygonOffset = this.polygonOffset; - material.polygonOffsetFactor = this.polygonOffsetFactor; - material.polygonOffsetUnits = this.polygonOffsetUnits; - - material.alphaTest = this.alphaTest; - - material.overdraw = this.overdraw; - - material.visible = this.visible; - - return material; - - }, - - update: function () { - - this.dispatchEvent( { type: 'update' } ); - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.Material.prototype ); - -THREE.MaterialIdCount = 0; - -// File:src/materials/LineBasicMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * linewidth: <float>, - * linecap: "round", - * linejoin: "round", - * - * vertexColors: <bool> - * - * fog: <bool> - * } - */ - -THREE.LineBasicMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'LineBasicMaterial'; - - this.color = new THREE.Color( 0xffffff ); - - this.linewidth = 1; - this.linecap = 'round'; - this.linejoin = 'round'; - - this.vertexColors = THREE.NoColors; - - this.fog = true; - - this.setValues( parameters ); - -}; - -THREE.LineBasicMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.LineBasicMaterial.prototype.constructor = THREE.LineBasicMaterial; - -THREE.LineBasicMaterial.prototype.clone = function () { - - var material = new THREE.LineBasicMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - - material.linewidth = this.linewidth; - material.linecap = this.linecap; - material.linejoin = this.linejoin; - - material.vertexColors = this.vertexColors; - - material.fog = this.fog; - - return material; - -}; - -// File:src/materials/LineDashedMaterial.js - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * linewidth: <float>, - * - * scale: <float>, - * dashSize: <float>, - * gapSize: <float>, - * - * vertexColors: <bool> - * - * fog: <bool> - * } - */ - -THREE.LineDashedMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'LineDashedMaterial'; - - this.color = new THREE.Color( 0xffffff ); - - this.linewidth = 1; - - this.scale = 1; - this.dashSize = 3; - this.gapSize = 1; - - this.vertexColors = false; - - this.fog = true; - - this.setValues( parameters ); - -}; - -THREE.LineDashedMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.LineDashedMaterial.prototype.constructor = THREE.LineDashedMaterial; - -THREE.LineDashedMaterial.prototype.clone = function () { - - var material = new THREE.LineDashedMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - - material.linewidth = this.linewidth; - - material.scale = this.scale; - material.dashSize = this.dashSize; - material.gapSize = this.gapSize; - - material.vertexColors = this.vertexColors; - - material.fog = this.fog; - - return material; - -}; - -// File:src/materials/MeshBasicMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: <bool>, - * morphTargets: <bool>, - * - * fog: <bool> - * } - */ - -THREE.MeshBasicMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'MeshBasicMaterial'; - - this.color = new THREE.Color( 0xffffff ); // emissive - - this.map = null; - - this.lightMap = null; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = THREE.MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.fog = true; - - this.shading = THREE.SmoothShading; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.vertexColors = THREE.NoColors; - - this.skinning = false; - this.morphTargets = false; - - this.setValues( parameters ); - -}; - -THREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.MeshBasicMaterial.prototype.constructor = THREE.MeshBasicMaterial; - -THREE.MeshBasicMaterial.prototype.clone = function () { - - var material = new THREE.MeshBasicMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - - material.map = this.map; - - material.lightMap = this.lightMap; - - material.specularMap = this.specularMap; - - material.alphaMap = this.alphaMap; - - material.envMap = this.envMap; - material.combine = this.combine; - material.reflectivity = this.reflectivity; - material.refractionRatio = this.refractionRatio; - - material.fog = this.fog; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - material.wireframeLinecap = this.wireframeLinecap; - material.wireframeLinejoin = this.wireframeLinejoin; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - material.morphTargets = this.morphTargets; - - return material; - -}; - -// File:src/materials/MeshLambertMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * emissive: <hex>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool>, - * - * fog: <bool> - * } - */ - -THREE.MeshLambertMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'MeshLambertMaterial'; - - this.color = new THREE.Color( 0xffffff ); // diffuse - this.emissive = new THREE.Color( 0x000000 ); - - this.wrapAround = false; - this.wrapRGB = new THREE.Vector3( 1, 1, 1 ); - - this.map = null; - - this.lightMap = null; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = THREE.MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.fog = true; - - this.shading = THREE.SmoothShading; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.vertexColors = THREE.NoColors; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - -}; - -THREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial; - -THREE.MeshLambertMaterial.prototype.clone = function () { - - var material = new THREE.MeshLambertMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - material.emissive.copy( this.emissive ); - - material.wrapAround = this.wrapAround; - material.wrapRGB.copy( this.wrapRGB ); - - material.map = this.map; - - material.lightMap = this.lightMap; - - material.specularMap = this.specularMap; - - material.alphaMap = this.alphaMap; - - material.envMap = this.envMap; - material.combine = this.combine; - material.reflectivity = this.reflectivity; - material.refractionRatio = this.refractionRatio; - - material.fog = this.fog; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - material.wireframeLinecap = this.wireframeLinecap; - material.wireframeLinejoin = this.wireframeLinejoin; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - material.morphTargets = this.morphTargets; - material.morphNormals = this.morphNormals; - - return material; - -}; - -// File:src/materials/MeshPhongMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * emissive: <hex>, - * specular: <hex>, - * shininess: <float>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * - * bumpMap: new THREE.Texture( <Image> ), - * bumpScale: <float>, - * - * normalMap: new THREE.Texture( <Image> ), - * normalScale: <Vector2>, - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool>, - * - * fog: <bool> - * } - */ - -THREE.MeshPhongMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'MeshPhongMaterial'; - - this.color = new THREE.Color( 0xffffff ); // diffuse - this.emissive = new THREE.Color( 0x000000 ); - this.specular = new THREE.Color( 0x111111 ); - this.shininess = 30; - - this.metal = false; - - this.wrapAround = false; - this.wrapRGB = new THREE.Vector3( 1, 1, 1 ); - - this.map = null; - - this.lightMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalScale = new THREE.Vector2( 1, 1 ); - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = THREE.MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.fog = true; - - this.shading = THREE.SmoothShading; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.vertexColors = THREE.NoColors; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - -}; - -THREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.MeshPhongMaterial.prototype.constructor = THREE.MeshPhongMaterial; - -THREE.MeshPhongMaterial.prototype.clone = function () { - - var material = new THREE.MeshPhongMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - material.emissive.copy( this.emissive ); - material.specular.copy( this.specular ); - material.shininess = this.shininess; - - material.metal = this.metal; - - material.wrapAround = this.wrapAround; - material.wrapRGB.copy( this.wrapRGB ); - - material.map = this.map; - - material.lightMap = this.lightMap; - - material.bumpMap = this.bumpMap; - material.bumpScale = this.bumpScale; - - material.normalMap = this.normalMap; - material.normalScale.copy( this.normalScale ); - - material.specularMap = this.specularMap; - - material.alphaMap = this.alphaMap; - - material.envMap = this.envMap; - material.combine = this.combine; - material.reflectivity = this.reflectivity; - material.refractionRatio = this.refractionRatio; - - material.fog = this.fog; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - material.wireframeLinecap = this.wireframeLinecap; - material.wireframeLinejoin = this.wireframeLinejoin; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - material.morphTargets = this.morphTargets; - material.morphNormals = this.morphNormals; - - return material; - -}; - -// File:src/materials/MeshDepthMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * opacity: <float>, - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float> - * } - */ - -THREE.MeshDepthMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'MeshDepthMaterial'; - - this.morphTargets = false; - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.setValues( parameters ); - -}; - -THREE.MeshDepthMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.MeshDepthMaterial.prototype.constructor = THREE.MeshDepthMaterial; - -THREE.MeshDepthMaterial.prototype.clone = function () { - - var material = new THREE.MeshDepthMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - - return material; - -}; - -// File:src/materials/MeshNormalMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - * - * parameters = { - * opacity: <float>, - * - * shading: THREE.FlatShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float> - * } - */ - -THREE.MeshNormalMaterial = function ( parameters ) { - - THREE.Material.call( this, parameters ); - - this.type = 'MeshNormalMaterial'; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.morphTargets = false; - - this.setValues( parameters ); - -}; - -THREE.MeshNormalMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.MeshNormalMaterial.prototype.constructor = THREE.MeshNormalMaterial; - -THREE.MeshNormalMaterial.prototype.clone = function () { - - var material = new THREE.MeshNormalMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - - return material; - -}; - -// File:src/materials/MeshFaceMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.MeshFaceMaterial = function ( materials ) { - - this.uuid = THREE.Math.generateUUID(); - - this.type = 'MeshFaceMaterial'; - - this.materials = materials instanceof Array ? materials : []; - -}; - -THREE.MeshFaceMaterial.prototype = { - - constructor: THREE.MeshFaceMaterial, - - toJSON: function () { - - var output = { - metadata: { - version: 4.2, - type: 'material', - generator: 'MaterialExporter' - }, - uuid: this.uuid, - type: this.type, - materials: [] - }; - - for ( var i = 0, l = this.materials.length; i < l; i ++ ) { - - output.materials.push( this.materials[ i ].toJSON() ); - - } - - return output; - - }, - - clone: function () { - - var material = new THREE.MeshFaceMaterial(); - - for ( var i = 0; i < this.materials.length; i ++ ) { - - material.materials.push( this.materials[ i ].clone() ); - - } - - return material; - - } - -}; - -// File:src/materials/PointCloudMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * size: <float>, - * sizeAttenuation: <bool>, - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * vertexColors: <bool>, - * - * fog: <bool> - * } - */ - -THREE.PointCloudMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'PointCloudMaterial'; - - this.color = new THREE.Color( 0xffffff ); - - this.map = null; - - this.size = 1; - this.sizeAttenuation = true; - - this.vertexColors = THREE.NoColors; - - this.fog = true; - - this.setValues( parameters ); - -}; - -THREE.PointCloudMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.PointCloudMaterial.prototype.constructor = THREE.PointCloudMaterial; - -THREE.PointCloudMaterial.prototype.clone = function () { - - var material = new THREE.PointCloudMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - - material.map = this.map; - - material.size = this.size; - material.sizeAttenuation = this.sizeAttenuation; - - material.vertexColors = this.vertexColors; - - material.fog = this.fog; - - return material; - -}; - -// backwards compatibility - -THREE.ParticleBasicMaterial = function ( parameters ) { - - THREE.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.' ); - return new THREE.PointCloudMaterial( parameters ); - -}; - -THREE.ParticleSystemMaterial = function ( parameters ) { - - THREE.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.' ); - return new THREE.PointCloudMaterial( parameters ); - -}; - -// File:src/materials/ShaderMaterial.js - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * defines: { "label" : "value" }, - * uniforms: { "parameter1": { type: "f", value: 1.0 }, "parameter2": { type: "i" value2: 2 } }, - * - * fragmentShader: <string>, - * vertexShader: <string>, - * - * shading: THREE.SmoothShading, - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * lights: <bool>, - * - * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool>, - * - * fog: <bool> - * } - */ - -THREE.ShaderMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'ShaderMaterial'; - - this.defines = {}; - this.uniforms = {}; - this.attributes = null; - - this.vertexShader = 'void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}'; - this.fragmentShader = 'void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}'; - - this.shading = THREE.SmoothShading; - - this.linewidth = 1; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; // set to use scene fog - - this.lights = false; // set to use scene lights - - this.vertexColors = THREE.NoColors; // set to use "color" attribute stream - - this.skinning = false; // set to use skinning attribute streams - - this.morphTargets = false; // set to use morph targets - this.morphNormals = false; // set to use morph normals - - // When rendered geometry doesn't include these attributes but the material does, - // use these default values in WebGL. This avoids errors when buffer data is missing. - this.defaultAttributeValues = { - 'color': [ 1, 1, 1 ], - 'uv': [ 0, 0 ], - 'uv2': [ 0, 0 ] - }; - - this.index0AttributeName = undefined; - - this.setValues( parameters ); - -}; - -THREE.ShaderMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.ShaderMaterial.prototype.constructor = THREE.ShaderMaterial; - -THREE.ShaderMaterial.prototype.clone = function () { - - var material = new THREE.ShaderMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.fragmentShader = this.fragmentShader; - material.vertexShader = this.vertexShader; - - material.uniforms = THREE.UniformsUtils.clone( this.uniforms ); - - material.attributes = this.attributes; - material.defines = this.defines; - - material.shading = this.shading; - - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - - material.fog = this.fog; - - material.lights = this.lights; - - material.vertexColors = this.vertexColors; - - material.skinning = this.skinning; - - material.morphTargets = this.morphTargets; - material.morphNormals = this.morphNormals; - - return material; - -}; - -// File:src/materials/RawShaderMaterial.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.RawShaderMaterial = function ( parameters ) { - - THREE.ShaderMaterial.call( this, parameters ); - - this.type = 'RawShaderMaterial'; - -}; - -THREE.RawShaderMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype ); -THREE.RawShaderMaterial.prototype.constructor = THREE.RawShaderMaterial; - -THREE.RawShaderMaterial.prototype.clone = function () { - - var material = new THREE.RawShaderMaterial(); - - THREE.ShaderMaterial.prototype.clone.call( this, material ); - - return material; - -}; - -// File:src/materials/SpriteMaterial.js - -/** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * blending: THREE.NormalBlending, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * uvOffset: new THREE.Vector2(), - * uvScale: new THREE.Vector2(), - * - * fog: <bool> - * } - */ - -THREE.SpriteMaterial = function ( parameters ) { - - THREE.Material.call( this ); - - this.type = 'SpriteMaterial'; - - this.color = new THREE.Color( 0xffffff ); - this.map = null; - - this.rotation = 0; - - this.fog = false; - - // set parameters - - this.setValues( parameters ); - -}; - -THREE.SpriteMaterial.prototype = Object.create( THREE.Material.prototype ); -THREE.SpriteMaterial.prototype.constructor = THREE.SpriteMaterial; - -THREE.SpriteMaterial.prototype.clone = function () { - - var material = new THREE.SpriteMaterial(); - - THREE.Material.prototype.clone.call( this, material ); - - material.color.copy( this.color ); - material.map = this.map; - - material.rotation = this.rotation; - - material.fog = this.fog; - - return material; - -}; - -// File:src/textures/Texture.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author szimek / https://github.com/szimek/ - */ - -THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - Object.defineProperty( this, 'id', { value: THREE.TextureIdCount ++ } ); - - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - this.sourceFile = ''; - - this.image = image !== undefined ? image : THREE.Texture.DEFAULT_IMAGE; - this.mipmaps = []; - - this.mapping = mapping !== undefined ? mapping : THREE.Texture.DEFAULT_MAPPING; - - this.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping; - this.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping; - - this.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter; - this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter; - - this.anisotropy = anisotropy !== undefined ? anisotropy : 1; - - this.format = format !== undefined ? format : THREE.RGBAFormat; - this.type = type !== undefined ? type : THREE.UnsignedByteType; - - this.offset = new THREE.Vector2( 0, 0 ); - this.repeat = new THREE.Vector2( 1, 1 ); - - this.generateMipmaps = true; - this.premultiplyAlpha = false; - this.flipY = true; - this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml) - - this._needsUpdate = false; - this.onUpdate = null; - -}; - -THREE.Texture.DEFAULT_IMAGE = undefined; -THREE.Texture.DEFAULT_MAPPING = THREE.UVMapping; - -THREE.Texture.prototype = { - - constructor: THREE.Texture, - - get needsUpdate () { - - return this._needsUpdate; - - }, - - set needsUpdate ( value ) { - - if ( value === true ) this.update(); - - this._needsUpdate = value; - - }, - - clone: function ( texture ) { - - if ( texture === undefined ) texture = new THREE.Texture(); - - texture.image = this.image; - texture.mipmaps = this.mipmaps.slice( 0 ); - - texture.mapping = this.mapping; - - texture.wrapS = this.wrapS; - texture.wrapT = this.wrapT; - - texture.magFilter = this.magFilter; - texture.minFilter = this.minFilter; - - texture.anisotropy = this.anisotropy; - - texture.format = this.format; - texture.type = this.type; - - texture.offset.copy( this.offset ); - texture.repeat.copy( this.repeat ); - - texture.generateMipmaps = this.generateMipmaps; - texture.premultiplyAlpha = this.premultiplyAlpha; - texture.flipY = this.flipY; - texture.unpackAlignment = this.unpackAlignment; - - return texture; - - }, - - update: function () { - - this.dispatchEvent( { type: 'update' } ); - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.Texture.prototype ); - -THREE.TextureIdCount = 0; - -// File:src/textures/CubeTexture.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.CubeTexture = function ( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - mapping = mapping !== undefined ? mapping : THREE.CubeReflectionMapping; - - THREE.Texture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.images = images; - -}; - -THREE.CubeTexture.prototype = Object.create( THREE.Texture.prototype ); -THREE.CubeTexture.prototype.constructor = THREE.CubeTexture; - -THREE.CubeTexture.clone = function ( texture ) { - - if ( texture === undefined ) texture = new THREE.CubeTexture(); - - THREE.Texture.prototype.clone.call( this, texture ); - - texture.images = this.images; - - return texture; - -}; - -// File:src/textures/CompressedTexture.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.CompressedTexture = function ( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) { - - THREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.image = { width: width, height: height }; - this.mipmaps = mipmaps; - - // no flipping for cube textures - // (also flipping doesn't work for compressed textures ) - - this.flipY = false; - - // can't generate mipmaps for compressed textures - // mips must be embedded in DDS files - - this.generateMipmaps = false; - -}; - -THREE.CompressedTexture.prototype = Object.create( THREE.Texture.prototype ); -THREE.CompressedTexture.prototype.constructor = THREE.CompressedTexture; - -THREE.CompressedTexture.prototype.clone = function () { - - var texture = new THREE.CompressedTexture(); - - THREE.Texture.prototype.clone.call( this, texture ); - - return texture; - -}; - -// File:src/textures/DataTexture.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.DataTexture = function ( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) { - - THREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.image = { data: data, width: width, height: height }; - -}; - -THREE.DataTexture.prototype = Object.create( THREE.Texture.prototype ); -THREE.DataTexture.prototype.constructor = THREE.DataTexture; - -THREE.DataTexture.prototype.clone = function () { - - var texture = new THREE.DataTexture(); - - THREE.Texture.prototype.clone.call( this, texture ); - - return texture; - -}; - -// File:src/textures/VideoTexture.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.VideoTexture = function ( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - THREE.Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.generateMipmaps = false; - - var scope = this; - - var update = function () { - - requestAnimationFrame( update ); - - if ( video.readyState === video.HAVE_ENOUGH_DATA ) { - - scope.needsUpdate = true; - - } - - }; - - update(); - -}; - -THREE.VideoTexture.prototype = Object.create( THREE.Texture.prototype ); -THREE.VideoTexture.prototype.constructor = THREE.VideoTexture; - -// File:src/objects/Group.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Group = function () { - - THREE.Object3D.call( this ); - - this.type = 'Group'; - -}; - -THREE.Group.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Group.prototype.constructor = THREE.Group; - -// File:src/objects/PointCloud.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.PointCloud = function ( geometry, material ) { - - THREE.Object3D.call( this ); - - this.type = 'PointCloud'; - - this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); - this.material = material !== undefined ? material : new THREE.PointCloudMaterial( { color: Math.random() * 0xffffff } ); - -}; - -THREE.PointCloud.prototype = Object.create( THREE.Object3D.prototype ); -THREE.PointCloud.prototype.constructor = THREE.PointCloud; - -THREE.PointCloud.prototype.raycast = ( function () { - - var inverseMatrix = new THREE.Matrix4(); - var ray = new THREE.Ray(); - - return function ( raycaster, intersects ) { - - var object = this; - var geometry = object.geometry; - var threshold = raycaster.params.PointCloud.threshold; - - inverseMatrix.getInverse( this.matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - if ( geometry.boundingBox !== null ) { - - if ( ray.isIntersectionBox( geometry.boundingBox ) === false ) { - - return; - - } - - } - - var localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 ); - var position = new THREE.Vector3(); - - var testPoint = function ( point, index ) { - - var rayPointDistance = ray.distanceToPoint( point ); - - if ( rayPointDistance < localThreshold ) { - - var intersectPoint = ray.closestPointToPoint( point ); - intersectPoint.applyMatrix4( object.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectPoint ); - - intersects.push( { - - distance: distance, - distanceToRay: rayPointDistance, - point: intersectPoint.clone(), - index: index, - face: null, - object: object - - } ); - - } - - }; - - if ( geometry instanceof THREE.BufferGeometry ) { - - var attributes = geometry.attributes; - var positions = attributes.position.array; - - if ( attributes.index !== undefined ) { - - var indices = attributes.index.array; - var offsets = geometry.offsets; - - if ( offsets.length === 0 ) { - - var offset = { - start: 0, - count: indices.length, - index: 0 - }; - - offsets = [ offset ]; - - } - - for ( var oi = 0, ol = offsets.length; oi < ol; ++ oi ) { - - var start = offsets[ oi ].start; - var count = offsets[ oi ].count; - var index = offsets[ oi ].index; - - for ( var i = start, il = start + count; i < il; i ++ ) { - - var a = index + indices[ i ]; - - position.fromArray( positions, a * 3 ); - - testPoint( position, a ); - - } - - } - - } else { - - var pointCount = positions.length / 3; - - for ( var i = 0; i < pointCount; i ++ ) { - - position.set( - positions[ 3 * i ], - positions[ 3 * i + 1 ], - positions[ 3 * i + 2 ] - ); - - testPoint( position, i ); - - } - - } - - } else { - - var vertices = this.geometry.vertices; - - for ( var i = 0; i < vertices.length; i ++ ) { - - testPoint( vertices[ i ], i ); - - } - - } - - }; - -}() ); - -THREE.PointCloud.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.PointCloud( this.geometry, this.material ); - - THREE.Object3D.prototype.clone.call( this, object ); - - return object; - -}; - -// Backwards compatibility - -THREE.ParticleSystem = function ( geometry, material ) { - - THREE.warn( 'THREE.ParticleSystem has been renamed to THREE.PointCloud.' ); - return new THREE.PointCloud( geometry, material ); - -}; - -// File:src/objects/Line.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Line = function ( geometry, material, mode ) { - - THREE.Object3D.call( this ); - - this.type = 'Line'; - - this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); - this.material = material !== undefined ? material : new THREE.LineBasicMaterial( { color: Math.random() * 0xffffff } ); - - this.mode = mode !== undefined ? mode : THREE.LineStrip; - -}; - -THREE.LineStrip = 0; -THREE.LinePieces = 1; - -THREE.Line.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Line.prototype.constructor = THREE.Line; - -THREE.Line.prototype.raycast = ( function () { - - var inverseMatrix = new THREE.Matrix4(); - var ray = new THREE.Ray(); - var sphere = new THREE.Sphere(); - - return function ( raycaster, intersects ) { - - var precision = raycaster.linePrecision; - var precisionSq = precision * precision; - - var geometry = this.geometry; - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - // Checking boundingSphere distance to ray - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( this.matrixWorld ); - - if ( raycaster.ray.isIntersectionSphere( sphere ) === false ) { - - return; - - } - - inverseMatrix.getInverse( this.matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - var vStart = new THREE.Vector3(); - var vEnd = new THREE.Vector3(); - var interSegment = new THREE.Vector3(); - var interRay = new THREE.Vector3(); - var step = this.mode === THREE.LineStrip ? 1 : 2; - - if ( geometry instanceof THREE.BufferGeometry ) { - - var attributes = geometry.attributes; - - if ( attributes.index !== undefined ) { - - var indices = attributes.index.array; - var positions = attributes.position.array; - var offsets = geometry.offsets; - - if ( offsets.length === 0 ) { - - offsets = [ { start: 0, count: indices.length, index: 0 } ]; - - } - - for ( var oi = 0; oi < offsets.length; oi ++) { - - var start = offsets[ oi ].start; - var count = offsets[ oi ].count; - var index = offsets[ oi ].index; - - for ( var i = start; i < start + count - 1; i += step ) { - - var a = index + indices[ i ]; - var b = index + indices[ i + 1 ]; - - vStart.fromArray( positions, a * 3 ); - vEnd.fromArray( positions, b * 3 ); - - var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - var distance = ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - offsetIndex: oi, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } - - } else { - - var positions = attributes.position.array; - - for ( var i = 0; i < positions.length / 3 - 1; i += step ) { - - vStart.fromArray( positions, 3 * i ); - vEnd.fromArray( positions, 3 * i + 3 ); - - var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - var distance = ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } - - } else if ( geometry instanceof THREE.Geometry ) { - - var vertices = geometry.vertices; - var nbVertices = vertices.length; - - for ( var i = 0; i < nbVertices - 1; i += step ) { - - var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - var distance = ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } - - }; - -}() ); - -THREE.Line.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.Line( this.geometry, this.material, this.mode ); - - THREE.Object3D.prototype.clone.call( this, object ); - - return object; - -}; - -// File:src/objects/Mesh.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author jonobr1 / http://jonobr1.com/ - */ - -THREE.Mesh = function ( geometry, material ) { - - THREE.Object3D.call( this ); - - this.type = 'Mesh'; - - this.geometry = geometry !== undefined ? geometry : new THREE.Geometry(); - this.material = material !== undefined ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ); - - this.updateMorphTargets(); - -}; - -THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Mesh.prototype.constructor = THREE.Mesh; - -THREE.Mesh.prototype.updateMorphTargets = function () { - - if ( this.geometry.morphTargets !== undefined && this.geometry.morphTargets.length > 0 ) { - - this.morphTargetBase = - 1; - this.morphTargetForcedOrder = []; - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - - for ( var m = 0, ml = this.geometry.morphTargets.length; m < ml; m ++ ) { - - this.morphTargetInfluences.push( 0 ); - this.morphTargetDictionary[ this.geometry.morphTargets[ m ].name ] = m; - - } - - } - -}; - -THREE.Mesh.prototype.getMorphTargetIndexByName = function ( name ) { - - if ( this.morphTargetDictionary[ name ] !== undefined ) { - - return this.morphTargetDictionary[ name ]; - - } - - THREE.warn( 'THREE.Mesh.getMorphTargetIndexByName: morph target ' + name + ' does not exist. Returning 0.' ); - - return 0; - -}; - - -THREE.Mesh.prototype.raycast = ( function () { - - var inverseMatrix = new THREE.Matrix4(); - var ray = new THREE.Ray(); - var sphere = new THREE.Sphere(); - - var vA = new THREE.Vector3(); - var vB = new THREE.Vector3(); - var vC = new THREE.Vector3(); - - return function ( raycaster, intersects ) { - - var geometry = this.geometry; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( this.matrixWorld ); - - if ( raycaster.ray.isIntersectionSphere( sphere ) === false ) { - - return; - - } - - // Check boundingBox before continuing - - inverseMatrix.getInverse( this.matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - if ( geometry.boundingBox !== null ) { - - if ( ray.isIntersectionBox( geometry.boundingBox ) === false ) { - - return; - - } - - } - - if ( geometry instanceof THREE.BufferGeometry ) { - - var material = this.material; - - if ( material === undefined ) return; - - var attributes = geometry.attributes; - - var a, b, c; - var precision = raycaster.precision; - - if ( attributes.index !== undefined ) { - - var indices = attributes.index.array; - var positions = attributes.position.array; - var offsets = geometry.offsets; - - if ( offsets.length === 0 ) { - - offsets = [ { start: 0, count: indices.length, index: 0 } ]; - - } - - for ( var oi = 0, ol = offsets.length; oi < ol; ++ oi ) { - - var start = offsets[ oi ].start; - var count = offsets[ oi ].count; - var index = offsets[ oi ].index; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - a = index + indices[ i ]; - b = index + indices[ i + 1 ]; - c = index + indices[ i + 2 ]; - - vA.fromArray( positions, a * 3 ); - vB.fromArray( positions, b * 3 ); - vC.fromArray( positions, c * 3 ); - - if ( material.side === THREE.BackSide ) { - - var intersectionPoint = ray.intersectTriangle( vC, vB, vA, true ); - - } else { - - var intersectionPoint = ray.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide ); - - } - - if ( intersectionPoint === null ) continue; - - intersectionPoint.applyMatrix4( this.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectionPoint ); - - if ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - point: intersectionPoint, - face: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ), - faceIndex: null, - object: this - - } ); - - } - - } - - } else { - - var positions = attributes.position.array; - - for ( var i = 0, j = 0, il = positions.length; i < il; i += 3, j += 9 ) { - - a = i; - b = i + 1; - c = i + 2; - - vA.fromArray( positions, j ); - vB.fromArray( positions, j + 3 ); - vC.fromArray( positions, j + 6 ); - - if ( material.side === THREE.BackSide ) { - - var intersectionPoint = ray.intersectTriangle( vC, vB, vA, true ); - - } else { - - var intersectionPoint = ray.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide ); - - } - - if ( intersectionPoint === null ) continue; - - intersectionPoint.applyMatrix4( this.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectionPoint ); - - if ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - point: intersectionPoint, - face: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ), - faceIndex: null, - object: this - - } ); - - } - - } - - } else if ( geometry instanceof THREE.Geometry ) { - - var isFaceMaterial = this.material instanceof THREE.MeshFaceMaterial; - var objectMaterials = isFaceMaterial === true ? this.material.materials : null; - - var a, b, c; - var precision = raycaster.precision; - - var vertices = geometry.vertices; - - for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) { - - var face = geometry.faces[ f ]; - - var material = isFaceMaterial === true ? objectMaterials[ face.materialIndex ] : this.material; - - if ( material === undefined ) continue; - - a = vertices[ face.a ]; - b = vertices[ face.b ]; - c = vertices[ face.c ]; - - if ( material.morphTargets === true ) { - - var morphTargets = geometry.morphTargets; - var morphInfluences = this.morphTargetInfluences; - - vA.set( 0, 0, 0 ); - vB.set( 0, 0, 0 ); - vC.set( 0, 0, 0 ); - - for ( var t = 0, tl = morphTargets.length; t < tl; t ++ ) { - - var influence = morphInfluences[ t ]; - - if ( influence === 0 ) continue; - - var targets = morphTargets[ t ].vertices; - - vA.x += ( targets[ face.a ].x - a.x ) * influence; - vA.y += ( targets[ face.a ].y - a.y ) * influence; - vA.z += ( targets[ face.a ].z - a.z ) * influence; - - vB.x += ( targets[ face.b ].x - b.x ) * influence; - vB.y += ( targets[ face.b ].y - b.y ) * influence; - vB.z += ( targets[ face.b ].z - b.z ) * influence; - - vC.x += ( targets[ face.c ].x - c.x ) * influence; - vC.y += ( targets[ face.c ].y - c.y ) * influence; - vC.z += ( targets[ face.c ].z - c.z ) * influence; - - } - - vA.add( a ); - vB.add( b ); - vC.add( c ); - - a = vA; - b = vB; - c = vC; - - } - - if ( material.side === THREE.BackSide ) { - - var intersectionPoint = ray.intersectTriangle( c, b, a, true ); - - } else { - - var intersectionPoint = ray.intersectTriangle( a, b, c, material.side !== THREE.DoubleSide ); - - } - - if ( intersectionPoint === null ) continue; - - intersectionPoint.applyMatrix4( this.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectionPoint ); - - if ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - point: intersectionPoint, - face: face, - faceIndex: f, - object: this - - } ); - - } - - } - - }; - -}() ); - -THREE.Mesh.prototype.clone = function ( object, recursive ) { - - if ( object === undefined ) object = new THREE.Mesh( this.geometry, this.material ); - - THREE.Object3D.prototype.clone.call( this, object, recursive ); - - return object; - -}; - -// File:src/objects/Bone.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author ikerr / http://verold.com - */ - -THREE.Bone = function ( skin ) { - - THREE.Object3D.call( this ); - - this.type = 'Bone'; - - this.skin = skin; - -}; - -THREE.Bone.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Bone.prototype.constructor = THREE.Bone; - -// File:src/objects/Skeleton.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author michael guerrero / http://realitymeltdown.com - * @author ikerr / http://verold.com - */ - -THREE.Skeleton = function ( bones, boneInverses, useVertexTexture ) { - - this.useVertexTexture = useVertexTexture !== undefined ? useVertexTexture : true; - - this.identityMatrix = new THREE.Matrix4(); - - // copy the bone array - - bones = bones || []; - - this.bones = bones.slice( 0 ); - - // create a bone texture or an array of floats - - if ( this.useVertexTexture ) { - - // layout (1 matrix = 4 pixels) - // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) - // with 8x8 pixel texture max 16 bones (8 * 8 / 4) - // 16x16 pixel texture max 64 bones (16 * 16 / 4) - // 32x32 pixel texture max 256 bones (32 * 32 / 4) - // 64x64 pixel texture max 1024 bones (64 * 64 / 4) - - var size; - - if ( this.bones.length > 256 ) - size = 64; - else if ( this.bones.length > 64 ) - size = 32; - else if ( this.bones.length > 16 ) - size = 16; - else - size = 8; - - this.boneTextureWidth = size; - this.boneTextureHeight = size; - - this.boneMatrices = new Float32Array( this.boneTextureWidth * this.boneTextureHeight * 4 ); // 4 floats per RGBA pixel - this.boneTexture = new THREE.DataTexture( this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, THREE.RGBAFormat, THREE.FloatType ); - this.boneTexture.minFilter = THREE.NearestFilter; - this.boneTexture.magFilter = THREE.NearestFilter; - this.boneTexture.generateMipmaps = false; - this.boneTexture.flipY = false; - - } else { - - this.boneMatrices = new Float32Array( 16 * this.bones.length ); - - } - - // use the supplied bone inverses or calculate the inverses - - if ( boneInverses === undefined ) { - - this.calculateInverses(); - - } else { - - if ( this.bones.length === boneInverses.length ) { - - this.boneInverses = boneInverses.slice( 0 ); - - } else { - - THREE.warn( 'THREE.Skeleton bonInverses is the wrong length.' ); - - this.boneInverses = []; - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - this.boneInverses.push( new THREE.Matrix4() ); - - } - - } - - } - -}; - -THREE.Skeleton.prototype.calculateInverses = function () { - - this.boneInverses = []; - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - var inverse = new THREE.Matrix4(); - - if ( this.bones[ b ] ) { - - inverse.getInverse( this.bones[ b ].matrixWorld ); - - } - - this.boneInverses.push( inverse ); - - } - -}; - -THREE.Skeleton.prototype.pose = function () { - - var bone; - - // recover the bind-time world matrices - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - bone = this.bones[ b ]; - - if ( bone ) { - - bone.matrixWorld.getInverse( this.boneInverses[ b ] ); - - } - - } - - // compute the local matrices, positions, rotations and scales - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - bone = this.bones[ b ]; - - if ( bone ) { - - if ( bone.parent ) { - - bone.matrix.getInverse( bone.parent.matrixWorld ); - bone.matrix.multiply( bone.matrixWorld ); - - } else { - - bone.matrix.copy( bone.matrixWorld ); - - } - - bone.matrix.decompose( bone.position, bone.quaternion, bone.scale ); - - } - - } - -}; - -THREE.Skeleton.prototype.update = ( function () { - - var offsetMatrix = new THREE.Matrix4(); - - return function () { - - // flatten bone matrices to array - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - // compute the offset between the current and the original transform - - var matrix = this.bones[ b ] ? this.bones[ b ].matrixWorld : this.identityMatrix; - - offsetMatrix.multiplyMatrices( matrix, this.boneInverses[ b ] ); - offsetMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 ); - - } - - if ( this.useVertexTexture ) { - - this.boneTexture.needsUpdate = true; - - } - - }; - -} )(); - - -// File:src/objects/SkinnedMesh.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author ikerr / http://verold.com - */ - -THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { - - THREE.Mesh.call( this, geometry, material ); - - this.type = 'SkinnedMesh'; - - this.bindMode = "attached"; - this.bindMatrix = new THREE.Matrix4(); - this.bindMatrixInverse = new THREE.Matrix4(); - - // init bones - - // TODO: remove bone creation as there is no reason (other than - // convenience) for THREE.SkinnedMesh to do this. - - var bones = []; - - if ( this.geometry && this.geometry.bones !== undefined ) { - - var bone, gbone, p, q, s; - - for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) { - - gbone = this.geometry.bones[ b ]; - - p = gbone.pos; - q = gbone.rotq; - s = gbone.scl; - - bone = new THREE.Bone( this ); - bones.push( bone ); - - bone.name = gbone.name; - bone.position.set( p[ 0 ], p[ 1 ], p[ 2 ] ); - bone.quaternion.set( q[ 0 ], q[ 1 ], q[ 2 ], q[ 3 ] ); - - if ( s !== undefined ) { - - bone.scale.set( s[ 0 ], s[ 1 ], s[ 2 ] ); - - } else { - - bone.scale.set( 1, 1, 1 ); - - } - - } - - for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) { - - gbone = this.geometry.bones[ b ]; - - if ( gbone.parent !== - 1 ) { - - bones[ gbone.parent ].add( bones[ b ] ); - - } else { - - this.add( bones[ b ] ); - - } - - } - - } - - this.normalizeSkinWeights(); - - this.updateMatrixWorld( true ); - this.bind( new THREE.Skeleton( bones, undefined, useVertexTexture ) ); - -}; - - -THREE.SkinnedMesh.prototype = Object.create( THREE.Mesh.prototype ); -THREE.SkinnedMesh.prototype.constructor = THREE.SkinnedMesh; - -THREE.SkinnedMesh.prototype.bind = function( skeleton, bindMatrix ) { - - this.skeleton = skeleton; - - if ( bindMatrix === undefined ) { - - this.updateMatrixWorld( true ); - - bindMatrix = this.matrixWorld; - - } - - this.bindMatrix.copy( bindMatrix ); - this.bindMatrixInverse.getInverse( bindMatrix ); - -}; - -THREE.SkinnedMesh.prototype.pose = function () { - - this.skeleton.pose(); - -}; - -THREE.SkinnedMesh.prototype.normalizeSkinWeights = function () { - - if ( this.geometry instanceof THREE.Geometry ) { - - for ( var i = 0; i < this.geometry.skinIndices.length; i ++ ) { - - var sw = this.geometry.skinWeights[ i ]; - - var scale = 1.0 / sw.lengthManhattan(); - - if ( scale !== Infinity ) { - - sw.multiplyScalar( scale ); - - } else { - - sw.set( 1 ); // this will be normalized by the shader anyway - - } - - } - - } else { - - // skinning weights assumed to be normalized for THREE.BufferGeometry - - } - -}; - -THREE.SkinnedMesh.prototype.updateMatrixWorld = function( force ) { - - THREE.Mesh.prototype.updateMatrixWorld.call( this, true ); - - if ( this.bindMode === "attached" ) { - - this.bindMatrixInverse.getInverse( this.matrixWorld ); - - } else if ( this.bindMode === "detached" ) { - - this.bindMatrixInverse.getInverse( this.bindMatrix ); - - } else { - - THREE.warn( 'THREE.SkinnedMesh unreckognized bindMode: ' + this.bindMode ); - - } - -}; - -THREE.SkinnedMesh.prototype.clone = function( object ) { - - if ( object === undefined ) { - - object = new THREE.SkinnedMesh( this.geometry, this.material, this.useVertexTexture ); - - } - - THREE.Mesh.prototype.clone.call( this, object ); - - return object; - -}; - - -// File:src/objects/MorphAnimMesh.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.MorphAnimMesh = function ( geometry, material ) { - - THREE.Mesh.call( this, geometry, material ); - - this.type = 'MorphAnimMesh'; - - // API - - this.duration = 1000; // milliseconds - this.mirroredLoop = false; - this.time = 0; - - // internals - - this.lastKeyframe = 0; - this.currentKeyframe = 0; - - this.direction = 1; - this.directionBackwards = false; - - this.setFrameRange( 0, this.geometry.morphTargets.length - 1 ); - -}; - -THREE.MorphAnimMesh.prototype = Object.create( THREE.Mesh.prototype ); -THREE.MorphAnimMesh.prototype.constructor = THREE.MorphAnimMesh; - -THREE.MorphAnimMesh.prototype.setFrameRange = function ( start, end ) { - - this.startKeyframe = start; - this.endKeyframe = end; - - this.length = this.endKeyframe - this.startKeyframe + 1; - -}; - -THREE.MorphAnimMesh.prototype.setDirectionForward = function () { - - this.direction = 1; - this.directionBackwards = false; - -}; - -THREE.MorphAnimMesh.prototype.setDirectionBackward = function () { - - this.direction = - 1; - this.directionBackwards = true; - -}; - -THREE.MorphAnimMesh.prototype.parseAnimations = function () { - - var geometry = this.geometry; - - if ( ! geometry.animations ) geometry.animations = {}; - - var firstAnimation, animations = geometry.animations; - - var pattern = /([a-z]+)_?(\d+)/; - - for ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) { - - var morph = geometry.morphTargets[ i ]; - var parts = morph.name.match( pattern ); - - if ( parts && parts.length > 1 ) { - - var label = parts[ 1 ]; - - if ( ! animations[ label ] ) animations[ label ] = { start: Infinity, end: - Infinity }; - - var animation = animations[ label ]; - - if ( i < animation.start ) animation.start = i; - if ( i > animation.end ) animation.end = i; - - if ( ! firstAnimation ) firstAnimation = label; - - } - - } - - geometry.firstAnimation = firstAnimation; - -}; - -THREE.MorphAnimMesh.prototype.setAnimationLabel = function ( label, start, end ) { - - if ( ! this.geometry.animations ) this.geometry.animations = {}; - - this.geometry.animations[ label ] = { start: start, end: end }; - -}; - -THREE.MorphAnimMesh.prototype.playAnimation = function ( label, fps ) { - - var animation = this.geometry.animations[ label ]; - - if ( animation ) { - - this.setFrameRange( animation.start, animation.end ); - this.duration = 1000 * ( ( animation.end - animation.start ) / fps ); - this.time = 0; - - } else { - - THREE.warn( 'THREE.MorphAnimMesh: animation[' + label + '] undefined in .playAnimation()' ); - - } - -}; - -THREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) { - - var frameTime = this.duration / this.length; - - this.time += this.direction * delta; - - if ( this.mirroredLoop ) { - - if ( this.time > this.duration || this.time < 0 ) { - - this.direction *= - 1; - - if ( this.time > this.duration ) { - - this.time = this.duration; - this.directionBackwards = true; - - } - - if ( this.time < 0 ) { - - this.time = 0; - this.directionBackwards = false; - - } - - } - - } else { - - this.time = this.time % this.duration; - - if ( this.time < 0 ) this.time += this.duration; - - } - - var keyframe = this.startKeyframe + THREE.Math.clamp( Math.floor( this.time / frameTime ), 0, this.length - 1 ); - - if ( keyframe !== this.currentKeyframe ) { - - this.morphTargetInfluences[ this.lastKeyframe ] = 0; - this.morphTargetInfluences[ this.currentKeyframe ] = 1; - - this.morphTargetInfluences[ keyframe ] = 0; - - this.lastKeyframe = this.currentKeyframe; - this.currentKeyframe = keyframe; - - } - - var mix = ( this.time % frameTime ) / frameTime; - - if ( this.directionBackwards ) { - - mix = 1 - mix; - - } - - this.morphTargetInfluences[ this.currentKeyframe ] = mix; - this.morphTargetInfluences[ this.lastKeyframe ] = 1 - mix; - -}; - -THREE.MorphAnimMesh.prototype.interpolateTargets = function ( a, b, t ) { - - var influences = this.morphTargetInfluences; - - for ( var i = 0, l = influences.length; i < l; i ++ ) { - - influences[ i ] = 0; - - } - - if ( a > -1 ) influences[ a ] = 1 - t; - if ( b > -1 ) influences[ b ] = t; - -}; - -THREE.MorphAnimMesh.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.MorphAnimMesh( this.geometry, this.material ); - - object.duration = this.duration; - object.mirroredLoop = this.mirroredLoop; - object.time = this.time; - - object.lastKeyframe = this.lastKeyframe; - object.currentKeyframe = this.currentKeyframe; - - object.direction = this.direction; - object.directionBackwards = this.directionBackwards; - - THREE.Mesh.prototype.clone.call( this, object ); - - return object; - -}; - -// File:src/objects/LOD.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.LOD = function () { - - THREE.Object3D.call( this ); - - this.objects = []; - -}; - - -THREE.LOD.prototype = Object.create( THREE.Object3D.prototype ); -THREE.LOD.prototype.constructor = THREE.LOD; - -THREE.LOD.prototype.addLevel = function ( object, distance ) { - - if ( distance === undefined ) distance = 0; - - distance = Math.abs( distance ); - - for ( var l = 0; l < this.objects.length; l ++ ) { - - if ( distance < this.objects[ l ].distance ) { - - break; - - } - - } - - this.objects.splice( l, 0, { distance: distance, object: object } ); - this.add( object ); - -}; - -THREE.LOD.prototype.getObjectForDistance = function ( distance ) { - - for ( var i = 1, l = this.objects.length; i < l; i ++ ) { - - if ( distance < this.objects[ i ].distance ) { - - break; - - } - - } - - return this.objects[ i - 1 ].object; - -}; - -THREE.LOD.prototype.raycast = ( function () { - - var matrixPosition = new THREE.Vector3(); - - return function ( raycaster, intersects ) { - - matrixPosition.setFromMatrixPosition( this.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( matrixPosition ); - - this.getObjectForDistance( distance ).raycast( raycaster, intersects ); - - }; - -}() ); - -THREE.LOD.prototype.update = function () { - - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - - return function ( camera ) { - - if ( this.objects.length > 1 ) { - - v1.setFromMatrixPosition( camera.matrixWorld ); - v2.setFromMatrixPosition( this.matrixWorld ); - - var distance = v1.distanceTo( v2 ); - - this.objects[ 0 ].object.visible = true; - - for ( var i = 1, l = this.objects.length; i < l; i ++ ) { - - if ( distance >= this.objects[ i ].distance ) { - - this.objects[ i - 1 ].object.visible = false; - this.objects[ i ].object.visible = true; - - } else { - - break; - - } - - } - - for ( ; i < l; i ++ ) { - - this.objects[ i ].object.visible = false; - - } - - } - - }; - -}(); - -THREE.LOD.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.LOD(); - - THREE.Object3D.prototype.clone.call( this, object ); - - for ( var i = 0, l = this.objects.length; i < l; i ++ ) { - var x = this.objects[ i ].object.clone(); - x.visible = i === 0; - object.addLevel( x, this.objects[ i ].distance ); - } - - return object; - -}; - -// File:src/objects/Sprite.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Sprite = ( function () { - - var indices = new Uint16Array( [ 0, 1, 2, 0, 2, 3 ] ); - var vertices = new Float32Array( [ - 0.5, - 0.5, 0, 0.5, - 0.5, 0, 0.5, 0.5, 0, - 0.5, 0.5, 0 ] ); - var uvs = new Float32Array( [ 0, 0, 1, 0, 1, 1, 0, 1 ] ); - - var geometry = new THREE.BufferGeometry(); - geometry.addAttribute( 'index', new THREE.BufferAttribute( indices, 1 ) ); - geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); - geometry.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) ); - - return function ( material ) { - - THREE.Object3D.call( this ); - - this.type = 'Sprite'; - - this.geometry = geometry; - this.material = ( material !== undefined ) ? material : new THREE.SpriteMaterial(); - - }; - -} )(); - -THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Sprite.prototype.constructor = THREE.Sprite; - -THREE.Sprite.prototype.raycast = ( function () { - - var matrixPosition = new THREE.Vector3(); - - return function ( raycaster, intersects ) { - - matrixPosition.setFromMatrixPosition( this.matrixWorld ); - - var distance = raycaster.ray.distanceToPoint( matrixPosition ); - - if ( distance > this.scale.x ) { - - return; - - } - - intersects.push( { - - distance: distance, - point: this.position, - face: null, - object: this - - } ); - - }; - -}() ); - -THREE.Sprite.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.Sprite( this.material ); - - THREE.Object3D.prototype.clone.call( this, object ); - - return object; - -}; - -// Backwards compatibility - -THREE.Particle = THREE.Sprite; - -// File:src/objects/LensFlare.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.LensFlare = function ( texture, size, distance, blending, color ) { - - THREE.Object3D.call( this ); - - this.lensFlares = []; - - this.positionScreen = new THREE.Vector3(); - this.customUpdateCallback = undefined; - - if ( texture !== undefined ) { - - this.add( texture, size, distance, blending, color ); - - } - -}; - -THREE.LensFlare.prototype = Object.create( THREE.Object3D.prototype ); -THREE.LensFlare.prototype.constructor = THREE.LensFlare; - - -/* - * Add: adds another flare - */ - -THREE.LensFlare.prototype.add = function ( texture, size, distance, blending, color, opacity ) { - - if ( size === undefined ) size = - 1; - if ( distance === undefined ) distance = 0; - if ( opacity === undefined ) opacity = 1; - if ( color === undefined ) color = new THREE.Color( 0xffffff ); - if ( blending === undefined ) blending = THREE.NormalBlending; - - distance = Math.min( distance, Math.max( 0, distance ) ); - - this.lensFlares.push( { - texture: texture, // THREE.Texture - size: size, // size in pixels (-1 = use texture.width) - distance: distance, // distance (0-1) from light source (0=at light source) - x: 0, y: 0, z: 0, // screen position (-1 => 1) z = 0 is ontop z = 1 is back - scale: 1, // scale - rotation: 1, // rotation - opacity: opacity, // opacity - color: color, // color - blending: blending // blending - } ); - -}; - -/* - * Update lens flares update positions on all flares based on the screen position - * Set myLensFlare.customUpdateCallback to alter the flares in your project specific way. - */ - -THREE.LensFlare.prototype.updateLensFlares = function () { - - var f, fl = this.lensFlares.length; - var flare; - var vecX = - this.positionScreen.x * 2; - var vecY = - this.positionScreen.y * 2; - - for ( f = 0; f < fl; f ++ ) { - - flare = this.lensFlares[ f ]; - - flare.x = this.positionScreen.x + vecX * flare.distance; - flare.y = this.positionScreen.y + vecY * flare.distance; - - flare.wantedRotation = flare.x * Math.PI * 0.25; - flare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25; - - } - -}; - - -// File:src/scenes/Scene.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Scene = function () { - - THREE.Object3D.call( this ); - - this.type = 'Scene'; - - this.fog = null; - this.overrideMaterial = null; - - this.autoUpdate = true; // checked by the renderer - -}; - -THREE.Scene.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Scene.prototype.constructor = THREE.Scene; - -THREE.Scene.prototype.clone = function ( object ) { - - if ( object === undefined ) object = new THREE.Scene(); - - THREE.Object3D.prototype.clone.call( this, object ); - - if ( this.fog !== null ) object.fog = this.fog.clone(); - if ( this.overrideMaterial !== null ) object.overrideMaterial = this.overrideMaterial.clone(); - - object.autoUpdate = this.autoUpdate; - object.matrixAutoUpdate = this.matrixAutoUpdate; - - return object; - -}; - -// File:src/scenes/Fog.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Fog = function ( color, near, far ) { - - this.name = ''; - - this.color = new THREE.Color( color ); - - this.near = ( near !== undefined ) ? near : 1; - this.far = ( far !== undefined ) ? far : 1000; - -}; - -THREE.Fog.prototype.clone = function () { - - return new THREE.Fog( this.color.getHex(), this.near, this.far ); - -}; - -// File:src/scenes/FogExp2.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.FogExp2 = function ( color, density ) { - - this.name = ''; - - this.color = new THREE.Color( color ); - this.density = ( density !== undefined ) ? density : 0.00025; - -}; - -THREE.FogExp2.prototype.clone = function () { - - return new THREE.FogExp2( this.color.getHex(), this.density ); - -}; - -// File:src/renderers/shaders/ShaderChunk.js - -THREE.ShaderChunk = {}; - -// File:src/renderers/shaders/ShaderChunk/common.glsl - -THREE.ShaderChunk[ 'common'] = "#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n float distance = dot( planeNormal, point-pointOnPlane );\n return point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n if ( decayExponent > 0.0 ) {\n return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n }\n return 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n return a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n return a;\n#endif\n}\n"; - -// File:src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl - -THREE.ShaderChunk[ 'alphatest_fragment'] = "#ifdef ALPHATEST\n\n if ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl - -THREE.ShaderChunk[ 'lights_lambert_vertex'] = "vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n vLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n float dotProduct = dot( transformedNormal, dirVector );\n vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n #endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n float dotProduct = dot( transformedNormal, lVector );\n\n vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n #endif\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float dotProduct = dot( transformedNormal, lVector );\n vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n #endif\n\n }\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n float dotProduct = dot( transformedNormal, lVector );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n #endif\n\n }\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n vLightBack += ambientLightColor;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl - -THREE.ShaderChunk[ 'map_particle_pars_fragment'] = "#ifdef USE_MAP\n\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/default_vertex.glsl - -THREE.ShaderChunk[ 'default_vertex'] = "#ifdef USE_SKINNING\n\n vec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n"; - -// File:src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl - -THREE.ShaderChunk[ 'map_pars_fragment'] = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n varying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n uniform sampler2D map;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl - -THREE.ShaderChunk[ 'skinnormal_vertex'] = "#ifdef USE_SKINNING\n\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n #ifdef USE_MORPHNORMALS\n\n vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n #else\n\n vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n #endif\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl - -THREE.ShaderChunk[ 'logdepthbuf_pars_vertex'] = "#ifdef USE_LOGDEPTHBUF\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n uniform float logDepthBufFC;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/lightmap_pars_vertex.glsl - -THREE.ShaderChunk[ 'lightmap_pars_vertex'] = "#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl - -THREE.ShaderChunk[ 'lights_phong_fragment'] = "#ifndef FLAT_SHADED\n\n vec3 normal = normalize( vNormal );\n\n #ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n #endif\n\n#else\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float pointDiffuseWeightFull = max( dotProduct, 0.0 );\n float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float pointDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n // specular\n\n vec3 pointHalfVector = normalize( lVector + viewPosition );\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float spotDiffuseWeightFull = max( dotProduct, 0.0 );\n float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float spotDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n // specular\n\n vec3 spotHalfVector = normalize( lVector + viewPosition );\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, dirVector );\n\n #ifdef WRAP_AROUND\n\n float dirDiffuseWeightFull = max( dotProduct, 0.0 );\n float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n // specular\n\n vec3 dirHalfVector = normalize( dirVector + viewPosition );\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n /*\n // fresnel term from skin shader\n const float F0 = 0.128;\n\n float base = 1.0 - dot( viewPosition, dirHalfVector );\n float exponential = pow( base, 5.0 );\n\n float fresnel = exponential + F0 * ( 1.0 - exponential );\n */\n\n /*\n // fresnel term from fresnel shader\n const float mFresnelBias = 0.08;\n const float mFresnelScale = 0.3;\n const float mFresnelPower = 5.0;\n\n float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n */\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n // dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n totalDiffuseLight += hemiColor;\n\n // specular (sky light)\n\n vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n // specular (ground light)\n\n vec3 lVectorGround = -lVector;\n\n vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n float dotProductGround = dot( normal, lVectorGround );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n totalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n }\n\n#endif\n\n#ifdef METAL\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl - -THREE.ShaderChunk[ 'fog_pars_fragment'] = "#ifdef USE_FOG\n\n uniform vec3 fogColor;\n\n #ifdef FOG_EXP2\n\n uniform float fogDensity;\n\n #else\n\n uniform float fogNear;\n uniform float fogFar;\n #endif\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl - -THREE.ShaderChunk[ 'morphnormal_vertex'] = "#ifdef USE_MORPHNORMALS\n\n vec3 morphedNormal = vec3( 0.0 );\n\n morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n morphedNormal += normal;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl - -THREE.ShaderChunk[ 'envmap_pars_fragment'] = "#ifdef USE_ENVMAP\n\n uniform float reflectivity;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n uniform float refractionRatio;\n\n #else\n\n varying vec3 vReflect;\n\n #endif\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl - -THREE.ShaderChunk[ 'logdepthbuf_fragment'] = "#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl - -THREE.ShaderChunk[ 'normalmap_pars_fragment'] = "#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/lights_phong_pars_vertex.glsl - -THREE.ShaderChunk[ 'lights_phong_pars_vertex'] = "#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl - -THREE.ShaderChunk[ 'lightmap_pars_fragment'] = "#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n uniform sampler2D lightMap;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl - -THREE.ShaderChunk[ 'shadowmap_vertex'] = "#ifdef USE_SHADOWMAP\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n }\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/lights_phong_vertex.glsl - -THREE.ShaderChunk[ 'lights_phong_vertex'] = "#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n vWorldPosition = worldPosition.xyz;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/map_fragment.glsl - -THREE.ShaderChunk[ 'map_fragment'] = "#ifdef USE_MAP\n\n vec4 texelColor = texture2D( map, vUv );\n\n texelColor.xyz = inputToLinear( texelColor.xyz );\n\n diffuseColor *= texelColor;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/lightmap_vertex.glsl - -THREE.ShaderChunk[ 'lightmap_vertex'] = "#ifdef USE_LIGHTMAP\n\n vUv2 = uv2;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl - -THREE.ShaderChunk[ 'map_particle_fragment'] = "#ifdef USE_MAP\n\n diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl - -THREE.ShaderChunk[ 'color_pars_fragment'] = "#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/color_vertex.glsl - -THREE.ShaderChunk[ 'color_vertex'] = "#ifdef USE_COLOR\n\n vColor.xyz = inputToLinear( color.xyz );\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/skinning_vertex.glsl - -THREE.ShaderChunk[ 'skinning_vertex'] = "#ifdef USE_SKINNING\n\n #ifdef USE_MORPHTARGETS\n\n vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n #endif\n\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl - -THREE.ShaderChunk[ 'envmap_pars_vertex'] = "#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n varying vec3 vReflect;\n\n uniform float refractionRatio;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/linear_to_gamma_fragment.glsl - -THREE.ShaderChunk[ 'linear_to_gamma_fragment'] = "\n outgoingLight = linearToOutput( outgoingLight );\n"; - -// File:src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl - -THREE.ShaderChunk[ 'color_pars_vertex'] = "#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/lights_lambert_pars_vertex.glsl - -THREE.ShaderChunk[ 'lights_lambert_pars_vertex'] = "uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/map_pars_vertex.glsl - -THREE.ShaderChunk[ 'map_pars_vertex'] = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/envmap_fragment.glsl - -THREE.ShaderChunk[ 'envmap_fragment'] = "#ifdef USE_ENVMAP\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n // Transforming Normal Vectors with the Inverse Transformation\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n #else\n\n vec3 reflectVec = vReflect;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #else\n float flipNormal = 1.0;\n #endif\n\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n\n envColor.xyz = inputToLinear( envColor.xyz );\n\n #ifdef ENVMAP_BLENDING_MULTIPLY\n\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_MIX )\n\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_ADD )\n\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n #endif\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl - -THREE.ShaderChunk[ 'specularmap_pars_fragment'] = "#ifdef USE_SPECULARMAP\n\n uniform sampler2D specularMap;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl - -THREE.ShaderChunk[ 'logdepthbuf_vertex'] = "#ifdef USE_LOGDEPTHBUF\n\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n vFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n #endif\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl - -THREE.ShaderChunk[ 'morphtarget_pars_vertex'] = "#ifdef USE_MORPHTARGETS\n\n #ifndef USE_MORPHNORMALS\n\n uniform float morphTargetInfluences[ 8 ];\n\n #else\n\n uniform float morphTargetInfluences[ 4 ];\n\n #endif\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl - -THREE.ShaderChunk[ 'specularmap_fragment'] = "float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n\n#else\n\n specularStrength = 1.0;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/fog_fragment.glsl - -THREE.ShaderChunk[ 'fog_fragment'] = "#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n #else\n\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n #endif\n\n #ifdef FOG_EXP2\n\n float fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n fogFactor = whiteCompliment( fogFactor );\n\n #else\n\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n #endif\n \n outgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl - -THREE.ShaderChunk[ 'bumpmap_pars_fragment'] = "#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n // Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm; // normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl - -THREE.ShaderChunk[ 'defaultnormal_vertex'] = "#ifdef USE_SKINNING\n\n vec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n vec3 objectNormal = morphedNormal;\n\n#else\n\n vec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n objectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n"; - -// File:src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl - -THREE.ShaderChunk[ 'lights_phong_pars_fragment'] = "uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n varying vec3 vNormal;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl - -THREE.ShaderChunk[ 'skinbase_vertex'] = "#ifdef USE_SKINNING\n\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/map_vertex.glsl - -THREE.ShaderChunk[ 'map_vertex'] = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl - -THREE.ShaderChunk[ 'lightmap_fragment'] = "#ifdef USE_LIGHTMAP\n\n outgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl - -THREE.ShaderChunk[ 'shadowmap_pars_vertex'] = "#ifdef USE_SHADOWMAP\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n uniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/color_fragment.glsl - -THREE.ShaderChunk[ 'color_fragment'] = "#ifdef USE_COLOR\n\n diffuseColor.rgb *= vColor;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl - -THREE.ShaderChunk[ 'morphtarget_vertex'] = "#ifdef USE_MORPHTARGETS\n\n vec3 morphed = vec3( 0.0 );\n morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n #ifndef USE_MORPHNORMALS\n\n morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n #endif\n\n morphed += position;\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/envmap_vertex.glsl - -THREE.ShaderChunk[ 'envmap_vertex'] = "#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n vec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vReflect = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/shadowmap_fragment.glsl - -THREE.ShaderChunk[ 'shadowmap_fragment'] = "#ifdef USE_SHADOWMAP\n\n #ifdef SHADOWMAP_DEBUG\n\n vec3 frustumColors[3];\n frustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n frustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n frustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n #endif\n\n #ifdef SHADOWMAP_CASCADE\n\n int inFrustumCount = 0;\n\n #endif\n\n float fDepth;\n vec3 shadowColor = vec3( 1.0 );\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n // if ( something && something ) breaks ATI OpenGL shader compiler\n // if ( all( something, something ) ) using this instead\n\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n\n // don't shadow pixels outside of light frustum\n // use just first frustum (for cascades)\n // don't shadow pixels behind far plane of light frustum\n\n #ifdef SHADOWMAP_CASCADE\n\n inFrustumCount += int( inFrustum );\n bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n #else\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n #endif\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n shadowCoord.z += shadowBias[ i ];\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n /*\n // nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n // must enroll loop manually\n\n for ( float y = -1.25; y <= 1.25; y += 1.25 )\n for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n // doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n //vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n shadow += 1.0;\n\n }\n\n shadow /= 9.0;\n\n */\n\n const float shadowDelta = 1.0 / 9.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.25 * xPixelOffset;\n float dy0 = -1.25 * yPixelOffset;\n float dx1 = 1.25 * xPixelOffset;\n float dy1 = 1.25 * yPixelOffset;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.0 * xPixelOffset;\n float dy0 = -1.0 * yPixelOffset;\n float dx1 = 1.0 * xPixelOffset;\n float dy1 = 1.0 * yPixelOffset;\n\n mat3 shadowKernel;\n mat3 depthKernel;\n\n depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n vec3 shadowZ = vec3( shadowCoord.z );\n shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n shadowKernel[0] *= vec3(0.25);\n\n shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n shadowKernel[1] *= vec3(0.25);\n\n shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n shadowKernel[2] *= vec3(0.25);\n\n vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n vec4 shadowValues;\n shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n shadow = dot( shadowValues, vec4( 1.0 ) );\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #else\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n\n // spot with multiple shadows is darker\n\n shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n // spot with multiple shadows has the same color as single shadow spot\n\n // shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n #endif\n\n }\n\n\n #ifdef SHADOWMAP_DEBUG\n\n #ifdef SHADOWMAP_CASCADE\n\n if ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n #else\n\n if ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n #endif\n\n #endif\n\n }\n\n // NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n shadowColor = inputToLinear( shadowColor );\n\n outgoingLight = outgoingLight * shadowColor;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl - -THREE.ShaderChunk[ 'worldpos_vertex'] = "#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n #ifdef USE_SKINNING\n\n vec4 worldPosition = modelMatrix * skinned;\n\n #elif defined( USE_MORPHTARGETS )\n\n vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n #endif\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl - -THREE.ShaderChunk[ 'shadowmap_pars_fragment'] = "#ifdef USE_SHADOWMAP\n\n uniform sampler2D shadowMap[ MAX_SHADOWS ];\n uniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n uniform float shadowDarkness[ MAX_SHADOWS ];\n uniform float shadowBias[ MAX_SHADOWS ];\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n float unpackDepth( const in vec4 rgba_depth ) {\n\n const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n float depth = dot( rgba_depth, bit_shift );\n return depth;\n\n }\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl - -THREE.ShaderChunk[ 'skinning_pars_vertex'] = "#ifdef USE_SKINNING\n\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n\n #ifdef BONE_TEXTURE\n\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n\n mat4 getBoneMatrix( const in float i ) {\n\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n\n y = dy * ( y + 0.5 );\n\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n mat4 bone = mat4( v1, v2, v3, v4 );\n\n return bone;\n\n }\n\n #else\n\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n mat4 getBoneMatrix( const in float i ) {\n\n mat4 bone = boneGlobalMatrices[ int(i) ];\n return bone;\n\n }\n\n #endif\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl - -THREE.ShaderChunk[ 'logdepthbuf_pars_fragment'] = "#ifdef USE_LOGDEPTHBUF\n\n uniform float logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n #extension GL_EXT_frag_depth : enable\n varying float vFragDepth;\n\n #endif\n\n#endif"; - -// File:src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl - -THREE.ShaderChunk[ 'alphamap_fragment'] = "#ifdef USE_ALPHAMAP\n\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n"; - -// File:src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl - -THREE.ShaderChunk[ 'alphamap_pars_fragment'] = "#ifdef USE_ALPHAMAP\n\n uniform sampler2D alphaMap;\n\n#endif\n"; - -// File:src/renderers/shaders/UniformsUtils.js - -/** - * Uniform Utilities - */ - -THREE.UniformsUtils = { - - merge: function ( uniforms ) { - - var merged = {}; - - for ( var u = 0; u < uniforms.length; u ++ ) { - - var tmp = this.clone( uniforms[ u ] ); - - for ( var p in tmp ) { - - merged[ p ] = tmp[ p ]; - - } - - } - - return merged; - - }, - - clone: function ( uniforms_src ) { - - var uniforms_dst = {}; - - for ( var u in uniforms_src ) { - - uniforms_dst[ u ] = {}; - - for ( var p in uniforms_src[ u ] ) { - - var parameter_src = uniforms_src[ u ][ p ]; - - if ( parameter_src instanceof THREE.Color || - parameter_src instanceof THREE.Vector2 || - parameter_src instanceof THREE.Vector3 || - parameter_src instanceof THREE.Vector4 || - parameter_src instanceof THREE.Matrix4 || - parameter_src instanceof THREE.Texture ) { - - uniforms_dst[ u ][ p ] = parameter_src.clone(); - - } else if ( parameter_src instanceof Array ) { - - uniforms_dst[ u ][ p ] = parameter_src.slice(); - - } else { - - uniforms_dst[ u ][ p ] = parameter_src; - - } - - } - - } - - return uniforms_dst; - - } - -}; - -// File:src/renderers/shaders/UniformsLib.js - -/** - * Uniforms library for shared webgl shaders - */ - -THREE.UniformsLib = { - - common: { - - "diffuse" : { type: "c", value: new THREE.Color( 0xeeeeee ) }, - "opacity" : { type: "f", value: 1.0 }, - - "map" : { type: "t", value: null }, - "offsetRepeat" : { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) }, - - "lightMap" : { type: "t", value: null }, - "specularMap" : { type: "t", value: null }, - "alphaMap" : { type: "t", value: null }, - - "envMap" : { type: "t", value: null }, - "flipEnvMap" : { type: "f", value: - 1 }, - "reflectivity" : { type: "f", value: 1.0 }, - "refractionRatio" : { type: "f", value: 0.98 }, - - "morphTargetInfluences" : { type: "f", value: 0 } - - }, - - bump: { - - "bumpMap" : { type: "t", value: null }, - "bumpScale" : { type: "f", value: 1 } - - }, - - normalmap: { - - "normalMap" : { type: "t", value: null }, - "normalScale" : { type: "v2", value: new THREE.Vector2( 1, 1 ) } - }, - - fog : { - - "fogDensity" : { type: "f", value: 0.00025 }, - "fogNear" : { type: "f", value: 1 }, - "fogFar" : { type: "f", value: 2000 }, - "fogColor" : { type: "c", value: new THREE.Color( 0xffffff ) } - - }, - - lights: { - - "ambientLightColor" : { type: "fv", value: [] }, - - "directionalLightDirection" : { type: "fv", value: [] }, - "directionalLightColor" : { type: "fv", value: [] }, - - "hemisphereLightDirection" : { type: "fv", value: [] }, - "hemisphereLightSkyColor" : { type: "fv", value: [] }, - "hemisphereLightGroundColor" : { type: "fv", value: [] }, - - "pointLightColor" : { type: "fv", value: [] }, - "pointLightPosition" : { type: "fv", value: [] }, - "pointLightDistance" : { type: "fv1", value: [] }, - "pointLightDecay" : { type: "fv1", value: [] }, - - "spotLightColor" : { type: "fv", value: [] }, - "spotLightPosition" : { type: "fv", value: [] }, - "spotLightDirection" : { type: "fv", value: [] }, - "spotLightDistance" : { type: "fv1", value: [] }, - "spotLightAngleCos" : { type: "fv1", value: [] }, - "spotLightExponent" : { type: "fv1", value: [] }, - "spotLightDecay" : { type: "fv1", value: [] } - - }, - - particle: { - - "psColor" : { type: "c", value: new THREE.Color( 0xeeeeee ) }, - "opacity" : { type: "f", value: 1.0 }, - "size" : { type: "f", value: 1.0 }, - "scale" : { type: "f", value: 1.0 }, - "map" : { type: "t", value: null }, - "offsetRepeat" : { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) }, - - "fogDensity" : { type: "f", value: 0.00025 }, - "fogNear" : { type: "f", value: 1 }, - "fogFar" : { type: "f", value: 2000 }, - "fogColor" : { type: "c", value: new THREE.Color( 0xffffff ) } - - }, - - shadowmap: { - - "shadowMap": { type: "tv", value: [] }, - "shadowMapSize": { type: "v2v", value: [] }, - - "shadowBias" : { type: "fv1", value: [] }, - "shadowDarkness": { type: "fv1", value: [] }, - - "shadowMatrix" : { type: "m4v", value: [] } - - } - -}; - -// File:src/renderers/shaders/ShaderLib.js - -/** - * Webgl Shader Library for three.js - * - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - */ - - -THREE.ShaderLib = { - - 'basic': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "common" ], - THREE.UniformsLib[ "fog" ], - THREE.UniformsLib[ "shadowmap" ] - - ] ), - - vertexShader: [ - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "map_pars_vertex" ], - THREE.ShaderChunk[ "lightmap_pars_vertex" ], - THREE.ShaderChunk[ "envmap_pars_vertex" ], - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "skinning_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "map_vertex" ], - THREE.ShaderChunk[ "lightmap_vertex" ], - THREE.ShaderChunk[ "color_vertex" ], - THREE.ShaderChunk[ "skinbase_vertex" ], - - " #ifdef USE_ENVMAP", - - THREE.ShaderChunk[ "morphnormal_vertex" ], - THREE.ShaderChunk[ "skinnormal_vertex" ], - THREE.ShaderChunk[ "defaultnormal_vertex" ], - - " #endif", - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "skinning_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - THREE.ShaderChunk[ "worldpos_vertex" ], - THREE.ShaderChunk[ "envmap_vertex" ], - THREE.ShaderChunk[ "shadowmap_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform vec3 diffuse;", - "uniform float opacity;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "map_pars_fragment" ], - THREE.ShaderChunk[ "alphamap_pars_fragment" ], - THREE.ShaderChunk[ "lightmap_pars_fragment" ], - THREE.ShaderChunk[ "envmap_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - THREE.ShaderChunk[ "specularmap_pars_fragment" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - " vec3 outgoingLight = vec3( 0.0 );", // outgoing light does not have an alpha, the surface does - " vec4 diffuseColor = vec4( diffuse, opacity );", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - THREE.ShaderChunk[ "map_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "alphamap_fragment" ], - THREE.ShaderChunk[ "alphatest_fragment" ], - THREE.ShaderChunk[ "specularmap_fragment" ], - - " outgoingLight = diffuseColor.rgb;", // simple shader - - THREE.ShaderChunk[ "lightmap_fragment" ], // TODO: Light map on an otherwise unlit surface doesn't make sense. - THREE.ShaderChunk[ "envmap_fragment" ], - THREE.ShaderChunk[ "shadowmap_fragment" ], // TODO: Shadows on an otherwise unlit surface doesn't make sense. - - THREE.ShaderChunk[ "linear_to_gamma_fragment" ], - - THREE.ShaderChunk[ "fog_fragment" ], - - " gl_FragColor = vec4( outgoingLight, diffuseColor.a );", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects - - "}" - - ].join("\n") - - }, - - 'lambert': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "common" ], - THREE.UniformsLib[ "fog" ], - THREE.UniformsLib[ "lights" ], - THREE.UniformsLib[ "shadowmap" ], - - { - "emissive" : { type: "c", value: new THREE.Color( 0x000000 ) }, - "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) } - } - - ] ), - - vertexShader: [ - - "#define LAMBERT", - - "varying vec3 vLightFront;", - - "#ifdef DOUBLE_SIDED", - - " varying vec3 vLightBack;", - - "#endif", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "map_pars_vertex" ], - THREE.ShaderChunk[ "lightmap_pars_vertex" ], - THREE.ShaderChunk[ "envmap_pars_vertex" ], - THREE.ShaderChunk[ "lights_lambert_pars_vertex" ], - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "skinning_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "map_vertex" ], - THREE.ShaderChunk[ "lightmap_vertex" ], - THREE.ShaderChunk[ "color_vertex" ], - - THREE.ShaderChunk[ "morphnormal_vertex" ], - THREE.ShaderChunk[ "skinbase_vertex" ], - THREE.ShaderChunk[ "skinnormal_vertex" ], - THREE.ShaderChunk[ "defaultnormal_vertex" ], - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "skinning_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - THREE.ShaderChunk[ "worldpos_vertex" ], - THREE.ShaderChunk[ "envmap_vertex" ], - THREE.ShaderChunk[ "lights_lambert_vertex" ], - THREE.ShaderChunk[ "shadowmap_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform vec3 diffuse;", - "uniform vec3 emissive;", - "uniform float opacity;", - - "varying vec3 vLightFront;", - - "#ifdef DOUBLE_SIDED", - - " varying vec3 vLightBack;", - - "#endif", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "map_pars_fragment" ], - THREE.ShaderChunk[ "alphamap_pars_fragment" ], - THREE.ShaderChunk[ "lightmap_pars_fragment" ], - THREE.ShaderChunk[ "envmap_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - THREE.ShaderChunk[ "specularmap_pars_fragment" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - " vec3 outgoingLight = vec3( 0.0 );", // outgoing light does not have an alpha, the surface does - " vec4 diffuseColor = vec4( diffuse, opacity );", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - THREE.ShaderChunk[ "map_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "alphamap_fragment" ], - THREE.ShaderChunk[ "alphatest_fragment" ], - THREE.ShaderChunk[ "specularmap_fragment" ], - - " #ifdef DOUBLE_SIDED", - - //"float isFront = float( gl_FrontFacing );", - //"gl_FragColor.xyz *= isFront * vLightFront + ( 1.0 - isFront ) * vLightBack;", - - " if ( gl_FrontFacing )", - " outgoingLight += diffuseColor.rgb * vLightFront + emissive;", - " else", - " outgoingLight += diffuseColor.rgb * vLightBack + emissive;", - - " #else", - - " outgoingLight += diffuseColor.rgb * vLightFront + emissive;", - - " #endif", - - THREE.ShaderChunk[ "lightmap_fragment" ], - THREE.ShaderChunk[ "envmap_fragment" ], - THREE.ShaderChunk[ "shadowmap_fragment" ], - - THREE.ShaderChunk[ "linear_to_gamma_fragment" ], - - THREE.ShaderChunk[ "fog_fragment" ], - - " gl_FragColor = vec4( outgoingLight, diffuseColor.a );", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects - - "}" - - ].join("\n") - - }, - - 'phong': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "common" ], - THREE.UniformsLib[ "bump" ], - THREE.UniformsLib[ "normalmap" ], - THREE.UniformsLib[ "fog" ], - THREE.UniformsLib[ "lights" ], - THREE.UniformsLib[ "shadowmap" ], - - { - "emissive" : { type: "c", value: new THREE.Color( 0x000000 ) }, - "specular" : { type: "c", value: new THREE.Color( 0x111111 ) }, - "shininess": { type: "f", value: 30 }, - "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) } - } - - ] ), - - vertexShader: [ - - "#define PHONG", - - "varying vec3 vViewPosition;", - - "#ifndef FLAT_SHADED", - - " varying vec3 vNormal;", - - "#endif", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "map_pars_vertex" ], - THREE.ShaderChunk[ "lightmap_pars_vertex" ], - THREE.ShaderChunk[ "envmap_pars_vertex" ], - THREE.ShaderChunk[ "lights_phong_pars_vertex" ], - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "skinning_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "map_vertex" ], - THREE.ShaderChunk[ "lightmap_vertex" ], - THREE.ShaderChunk[ "color_vertex" ], - - THREE.ShaderChunk[ "morphnormal_vertex" ], - THREE.ShaderChunk[ "skinbase_vertex" ], - THREE.ShaderChunk[ "skinnormal_vertex" ], - THREE.ShaderChunk[ "defaultnormal_vertex" ], - - "#ifndef FLAT_SHADED", // Normal computed with derivatives when FLAT_SHADED - - " vNormal = normalize( transformedNormal );", - - "#endif", - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "skinning_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - " vViewPosition = -mvPosition.xyz;", - - THREE.ShaderChunk[ "worldpos_vertex" ], - THREE.ShaderChunk[ "envmap_vertex" ], - THREE.ShaderChunk[ "lights_phong_vertex" ], - THREE.ShaderChunk[ "shadowmap_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "#define PHONG", - - "uniform vec3 diffuse;", - "uniform vec3 emissive;", - "uniform vec3 specular;", - "uniform float shininess;", - "uniform float opacity;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "map_pars_fragment" ], - THREE.ShaderChunk[ "alphamap_pars_fragment" ], - THREE.ShaderChunk[ "lightmap_pars_fragment" ], - THREE.ShaderChunk[ "envmap_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "lights_phong_pars_fragment" ], - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - THREE.ShaderChunk[ "bumpmap_pars_fragment" ], - THREE.ShaderChunk[ "normalmap_pars_fragment" ], - THREE.ShaderChunk[ "specularmap_pars_fragment" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - " vec3 outgoingLight = vec3( 0.0 );", // outgoing light does not have an alpha, the surface does - " vec4 diffuseColor = vec4( diffuse, opacity );", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - THREE.ShaderChunk[ "map_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "alphamap_fragment" ], - THREE.ShaderChunk[ "alphatest_fragment" ], - THREE.ShaderChunk[ "specularmap_fragment" ], - - THREE.ShaderChunk[ "lights_phong_fragment" ], - - THREE.ShaderChunk[ "lightmap_fragment" ], - THREE.ShaderChunk[ "envmap_fragment" ], - THREE.ShaderChunk[ "shadowmap_fragment" ], - - THREE.ShaderChunk[ "linear_to_gamma_fragment" ], - - THREE.ShaderChunk[ "fog_fragment" ], - - " gl_FragColor = vec4( outgoingLight, diffuseColor.a );", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects - - "}" - - ].join("\n") - - }, - - 'particle_basic': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "particle" ], - THREE.UniformsLib[ "shadowmap" ] - - ] ), - - vertexShader: [ - - "uniform float size;", - "uniform float scale;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "shadowmap_pars_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "color_vertex" ], - - " vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", - - " #ifdef USE_SIZEATTENUATION", - " gl_PointSize = size * ( scale / length( mvPosition.xyz ) );", - " #else", - " gl_PointSize = size;", - " #endif", - - " gl_Position = projectionMatrix * mvPosition;", - - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - THREE.ShaderChunk[ "worldpos_vertex" ], - THREE.ShaderChunk[ "shadowmap_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform vec3 psColor;", - "uniform float opacity;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "map_particle_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "shadowmap_pars_fragment" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - " vec3 outgoingLight = vec3( 0.0 );", // outgoing light does not have an alpha, the surface does - " vec4 diffuseColor = vec4( psColor, opacity );", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - THREE.ShaderChunk[ "map_particle_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - THREE.ShaderChunk[ "alphatest_fragment" ], - - " outgoingLight = diffuseColor.rgb;", // simple shader - - THREE.ShaderChunk[ "shadowmap_fragment" ], - THREE.ShaderChunk[ "fog_fragment" ], - - " gl_FragColor = vec4( outgoingLight, diffuseColor.a );", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects - - "}" - - ].join("\n") - - }, - - 'dashed': { - - uniforms: THREE.UniformsUtils.merge( [ - - THREE.UniformsLib[ "common" ], - THREE.UniformsLib[ "fog" ], - - { - "scale" : { type: "f", value: 1 }, - "dashSize" : { type: "f", value: 1 }, - "totalSize": { type: "f", value: 2 } - } - - ] ), - - vertexShader: [ - - "uniform float scale;", - "attribute float lineDistance;", - - "varying float vLineDistance;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "color_pars_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "color_vertex" ], - - " vLineDistance = scale * lineDistance;", - - " vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", - " gl_Position = projectionMatrix * mvPosition;", - - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform vec3 diffuse;", - "uniform float opacity;", - - "uniform float dashSize;", - "uniform float totalSize;", - - "varying float vLineDistance;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "color_pars_fragment" ], - THREE.ShaderChunk[ "fog_pars_fragment" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - " if ( mod( vLineDistance, totalSize ) > dashSize ) {", - - " discard;", - - " }", - - " vec3 outgoingLight = vec3( 0.0 );", // outgoing light does not have an alpha, the surface does - " vec4 diffuseColor = vec4( diffuse, opacity );", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - THREE.ShaderChunk[ "color_fragment" ], - - " outgoingLight = diffuseColor.rgb;", // simple shader - - THREE.ShaderChunk[ "fog_fragment" ], - - " gl_FragColor = vec4( outgoingLight, diffuseColor.a );", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects - - "}" - - ].join("\n") - - }, - - 'depth': { - - uniforms: { - - "mNear": { type: "f", value: 1.0 }, - "mFar" : { type: "f", value: 2000.0 }, - "opacity" : { type: "f", value: 1.0 } - - }, - - vertexShader: [ - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform float mNear;", - "uniform float mFar;", - "uniform float opacity;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - - " #ifdef USE_LOGDEPTHBUF_EXT", - - " float depth = gl_FragDepthEXT / gl_FragCoord.w;", - - " #else", - - " float depth = gl_FragCoord.z / gl_FragCoord.w;", - - " #endif", - - " float color = 1.0 - smoothstep( mNear, mFar, depth );", - " gl_FragColor = vec4( vec3( color ), opacity );", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects - - "}" - - ].join("\n") - - }, - - 'normal': { - - uniforms: { - - "opacity" : { type: "f", value: 1.0 } - - }, - - vertexShader: [ - - "varying vec3 vNormal;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - " vNormal = normalize( normalMatrix * normal );", - - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform float opacity;", - "varying vec3 vNormal;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - " gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - - "}" - - ].join("\n") - - }, - - /* ------------------------------------------------------------------------- - // Cube map shader - ------------------------------------------------------------------------- */ - - 'cube': { - - uniforms: { "tCube": { type: "t", value: null }, - "tFlip": { type: "f", value: - 1 } }, - - vertexShader: [ - - "varying vec3 vWorldPosition;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - " vWorldPosition = transformDirection( position, modelMatrix );", - - " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", - - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform samplerCube tCube;", - "uniform float tFlip;", - - "varying vec3 vWorldPosition;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - " gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - - "}" - - ].join("\n") - - }, - - /* ------------------------------------------------------------------------- - // Cube map shader - ------------------------------------------------------------------------- */ - - 'equirect': { - - uniforms: { "tEquirect": { type: "t", value: null }, - "tFlip": { type: "f", value: - 1 } }, - - vertexShader: [ - - "varying vec3 vWorldPosition;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - " vWorldPosition = transformDirection( position, modelMatrix );", - - " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", - - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - "uniform sampler2D tEquirect;", - "uniform float tFlip;", - - "varying vec3 vWorldPosition;", - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "void main() {", - - // " gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );", - "vec3 direction = normalize( vWorldPosition );", - "vec2 sampleUV;", - "sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );", - "sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;", - "gl_FragColor = texture2D( tEquirect, sampleUV );", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - - "}" - - ].join("\n") - - }, - - /* Depth encoding into RGBA texture - * - * based on SpiderGL shadow map example - * http://spidergl.org/example.php?id=6 - * - * originally from - * http://www.gamedev.net/topic/442138-packing-a-float-into-a-a8r8g8b8-texture-shader/page__whichpage__1%25EF%25BF%25BD - * - * see also - * http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ - */ - - 'depthRGBA': { - - uniforms: {}, - - vertexShader: [ - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "morphtarget_pars_vertex" ], - THREE.ShaderChunk[ "skinning_pars_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ], - - "void main() {", - - THREE.ShaderChunk[ "skinbase_vertex" ], - THREE.ShaderChunk[ "morphtarget_vertex" ], - THREE.ShaderChunk[ "skinning_vertex" ], - THREE.ShaderChunk[ "default_vertex" ], - THREE.ShaderChunk[ "logdepthbuf_vertex" ], - - "}" - - ].join("\n"), - - fragmentShader: [ - - THREE.ShaderChunk[ "common" ], - THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ], - - "vec4 pack_depth( const in float depth ) {", - - " const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );", - " const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );", - " vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );", // " vec4 res = fract( depth * bit_shift );", - " res -= res.xxyz * bit_mask;", - " return res;", - - "}", - - "void main() {", - - THREE.ShaderChunk[ "logdepthbuf_fragment" ], - - " #ifdef USE_LOGDEPTHBUF_EXT", - - " gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );", - - " #else", - - " gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );", - - " #endif", - - //"gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z / gl_FragCoord.w );", - //"float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 );", - //"gl_FragData[ 0 ] = pack_depth( z );", - //"gl_FragData[ 0 ] = vec4( z, z, z, 1.0 );", - - "}" - - ].join("\n") - - } - -}; - -// File:src/renderers/WebGLRenderer.js - -/** - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author szimek / https://github.com/szimek/ - */ - -THREE.WebGLRenderer = function ( parameters ) { - - console.log( 'THREE.WebGLRenderer', THREE.REVISION ); - - parameters = parameters || {}; - - var _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElement( 'canvas' ), - _context = parameters.context !== undefined ? parameters.context : null, - - pixelRatio = 1, - - _precision = parameters.precision !== undefined ? parameters.precision : 'highp', - - _alpha = parameters.alpha !== undefined ? parameters.alpha : false, - _depth = parameters.depth !== undefined ? parameters.depth : true, - _stencil = parameters.stencil !== undefined ? parameters.stencil : true, - _antialias = parameters.antialias !== undefined ? parameters.antialias : false, - _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, - _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, - _logarithmicDepthBuffer = parameters.logarithmicDepthBuffer !== undefined ? parameters.logarithmicDepthBuffer : false, - - _clearColor = new THREE.Color( 0x000000 ), - _clearAlpha = 0; - - var lights = []; - - var _webglObjects = {}; - var _webglObjectsImmediate = []; - - var opaqueObjects = []; - var transparentObjects = []; - - var sprites = []; - var lensFlares = []; - - // public properties - - this.domElement = _canvas; - this.context = null; - - // clearing - - this.autoClear = true; - this.autoClearColor = true; - this.autoClearDepth = true; - this.autoClearStencil = true; - - // scene graph - - this.sortObjects = true; - - // physically based shading - - this.gammaFactor = 2.0; // for backwards compatibility - this.gammaInput = false; - this.gammaOutput = false; - - // shadow map - - this.shadowMapEnabled = false; - this.shadowMapType = THREE.PCFShadowMap; - this.shadowMapCullFace = THREE.CullFaceFront; - this.shadowMapDebug = false; - this.shadowMapCascade = false; - - // morphs - - this.maxMorphTargets = 8; - this.maxMorphNormals = 4; - - // flags - - this.autoScaleCubemaps = true; - - // info - - this.info = { - - memory: { - - programs: 0, - geometries: 0, - textures: 0 - - }, - - render: { - - calls: 0, - vertices: 0, - faces: 0, - points: 0 - - } - - }; - - // internal properties - - var _this = this, - - _programs = [], - - // internal state cache - - _currentProgram = null, - _currentFramebuffer = null, - _currentMaterialId = - 1, - _currentGeometryProgram = '', - _currentCamera = null, - - _usedTextureUnits = 0, - - _viewportX = 0, - _viewportY = 0, - _viewportWidth = _canvas.width, - _viewportHeight = _canvas.height, - _currentWidth = 0, - _currentHeight = 0, - - // frustum - - _frustum = new THREE.Frustum(), - - // camera matrices cache - - _projScreenMatrix = new THREE.Matrix4(), - - _vector3 = new THREE.Vector3(), - - // light arrays cache - - _direction = new THREE.Vector3(), - - _lightsNeedUpdate = true, - - _lights = { - - ambient: [ 0, 0, 0 ], - directional: { length: 0, colors:[], positions: [] }, - point: { length: 0, colors: [], positions: [], distances: [], decays: [] }, - spot: { length: 0, colors: [], positions: [], distances: [], directions: [], anglesCos: [], exponents: [], decays: [] }, - hemi: { length: 0, skyColors: [], groundColors: [], positions: [] } - - }; - - // initialize - - var _gl; - - try { - - var attributes = { - alpha: _alpha, - depth: _depth, - stencil: _stencil, - antialias: _antialias, - premultipliedAlpha: _premultipliedAlpha, - preserveDrawingBuffer: _preserveDrawingBuffer - }; - - _gl = _context || _canvas.getContext( 'webgl', attributes ) || _canvas.getContext( 'experimental-webgl', attributes ); - - if ( _gl === null ) { - - if ( _canvas.getContext( 'webgl') !== null ) { - - throw 'Error creating WebGL context with your selected attributes.'; - - } else { - - throw 'Error creating WebGL context.'; - - } - - } - - _canvas.addEventListener( 'webglcontextlost', function ( event ) { - - event.preventDefault(); - - resetGLState(); - setDefaultGLState(); - - _webglObjects = {}; - - }, false); - - } catch ( error ) { - - THREE.error( 'THREE.WebGLRenderer: ' + error ); - - } - - var state = new THREE.WebGLState( _gl, paramThreeToGL ); - - if ( _gl.getShaderPrecisionFormat === undefined ) { - - _gl.getShaderPrecisionFormat = function () { - - return { - 'rangeMin': 1, - 'rangeMax': 1, - 'precision': 1 - }; - - } - - } - - var extensions = new THREE.WebGLExtensions( _gl ); - - extensions.get( 'OES_texture_float' ); - extensions.get( 'OES_texture_float_linear' ); - extensions.get( 'OES_texture_half_float' ); - extensions.get( 'OES_texture_half_float_linear' ); - extensions.get( 'OES_standard_derivatives' ); - - if ( _logarithmicDepthBuffer ) { - - extensions.get( 'EXT_frag_depth' ); - - } - - // - - var glClearColor = function ( r, g, b, a ) { - - if ( _premultipliedAlpha === true ) { - - r *= a; g *= a; b *= a; - - } - - _gl.clearColor( r, g, b, a ); - - }; - - var setDefaultGLState = function () { - - _gl.clearColor( 0, 0, 0, 1 ); - _gl.clearDepth( 1 ); - _gl.clearStencil( 0 ); - - _gl.enable( _gl.DEPTH_TEST ); - _gl.depthFunc( _gl.LEQUAL ); - - _gl.frontFace( _gl.CCW ); - _gl.cullFace( _gl.BACK ); - _gl.enable( _gl.CULL_FACE ); - - _gl.enable( _gl.BLEND ); - _gl.blendEquation( _gl.FUNC_ADD ); - _gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA ); - - _gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight ); - - glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - }; - - var resetGLState = function () { - - _currentProgram = null; - _currentCamera = null; - - _currentGeometryProgram = ''; - _currentMaterialId = - 1; - - _lightsNeedUpdate = true; - - state.reset(); - - }; - - setDefaultGLState(); - - this.context = _gl; - this.state = state; - - // GPU capabilities - - var _maxTextures = _gl.getParameter( _gl.MAX_TEXTURE_IMAGE_UNITS ); - var _maxVertexTextures = _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ); - var _maxTextureSize = _gl.getParameter( _gl.MAX_TEXTURE_SIZE ); - var _maxCubemapSize = _gl.getParameter( _gl.MAX_CUBE_MAP_TEXTURE_SIZE ); - - var _supportsVertexTextures = _maxVertexTextures > 0; - var _supportsBoneTextures = _supportsVertexTextures && extensions.get( 'OES_texture_float' ); - - // - - var _vertexShaderPrecisionHighpFloat = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.HIGH_FLOAT ); - var _vertexShaderPrecisionMediumpFloat = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.MEDIUM_FLOAT ); - - var _fragmentShaderPrecisionHighpFloat = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.HIGH_FLOAT ); - var _fragmentShaderPrecisionMediumpFloat = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.MEDIUM_FLOAT ); - - var getCompressedTextureFormats = ( function () { - - var array; - - return function () { - - if ( array !== undefined ) { - - return array; - - } - - array = []; - - if ( extensions.get( 'WEBGL_compressed_texture_pvrtc' ) || extensions.get( 'WEBGL_compressed_texture_s3tc' ) ) { - - var formats = _gl.getParameter( _gl.COMPRESSED_TEXTURE_FORMATS ); - - for ( var i = 0; i < formats.length; i ++ ) { - - array.push( formats[ i ] ); - - } - - } - - return array; - - }; - - } )(); - - // clamp precision to maximum available - - var highpAvailable = _vertexShaderPrecisionHighpFloat.precision > 0 && _fragmentShaderPrecisionHighpFloat.precision > 0; - var mediumpAvailable = _vertexShaderPrecisionMediumpFloat.precision > 0 && _fragmentShaderPrecisionMediumpFloat.precision > 0; - - if ( _precision === 'highp' && ! highpAvailable ) { - - if ( mediumpAvailable ) { - - _precision = 'mediump'; - THREE.warn( 'THREE.WebGLRenderer: highp not supported, using mediump.' ); - - } else { - - _precision = 'lowp'; - THREE.warn( 'THREE.WebGLRenderer: highp and mediump not supported, using lowp.' ); - - } - - } - - if ( _precision === 'mediump' && ! mediumpAvailable ) { - - _precision = 'lowp'; - THREE.warn( 'THREE.WebGLRenderer: mediump not supported, using lowp.' ); - - } - - // Plugins - - var shadowMapPlugin = new THREE.ShadowMapPlugin( this, lights, _webglObjects, _webglObjectsImmediate ); - - var spritePlugin = new THREE.SpritePlugin( this, sprites ); - var lensFlarePlugin = new THREE.LensFlarePlugin( this, lensFlares ); - - // API - - this.getContext = function () { - - return _gl; - - }; - - this.forceContextLoss = function () { - - extensions.get( 'WEBGL_lose_context' ).loseContext(); - - }; - - this.supportsVertexTextures = function () { - - return _supportsVertexTextures; - - }; - - this.supportsFloatTextures = function () { - - return extensions.get( 'OES_texture_float' ); - - }; - - this.supportsHalfFloatTextures = function () { - - return extensions.get( 'OES_texture_half_float' ); - - }; - - this.supportsStandardDerivatives = function () { - - return extensions.get( 'OES_standard_derivatives' ); - - }; - - this.supportsCompressedTextureS3TC = function () { - - return extensions.get( 'WEBGL_compressed_texture_s3tc' ); - - }; - - this.supportsCompressedTexturePVRTC = function () { - - return extensions.get( 'WEBGL_compressed_texture_pvrtc' ); - - }; - - this.supportsBlendMinMax = function () { - - return extensions.get( 'EXT_blend_minmax' ); - - }; - - this.getMaxAnisotropy = ( function () { - - var value; - - return function () { - - if ( value !== undefined ) { - - return value; - - } - - var extension = extensions.get( 'EXT_texture_filter_anisotropic' ); - - value = extension !== null ? _gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT ) : 0; - - return value; - - } - - } )(); - - this.getPrecision = function () { - - return _precision; - - }; - - this.getPixelRatio = function () { - - return pixelRatio; - - }; - - this.setPixelRatio = function ( value ) { - - pixelRatio = value; - - }; - - this.setSize = function ( width, height, updateStyle ) { - - _canvas.width = width * pixelRatio; - _canvas.height = height * pixelRatio; - - if ( updateStyle !== false ) { - - _canvas.style.width = width + 'px'; - _canvas.style.height = height + 'px'; - - } - - this.setViewport( 0, 0, width, height ); - - }; - - this.setViewport = function ( x, y, width, height ) { - - _viewportX = x * pixelRatio; - _viewportY = y * pixelRatio; - - _viewportWidth = width * pixelRatio; - _viewportHeight = height * pixelRatio; - - _gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight ); - - }; - - this.setScissor = function ( x, y, width, height ) { - - _gl.scissor( - x * pixelRatio, - y * pixelRatio, - width * pixelRatio, - height * pixelRatio - ); - - }; - - this.enableScissorTest = function ( enable ) { - - enable ? _gl.enable( _gl.SCISSOR_TEST ) : _gl.disable( _gl.SCISSOR_TEST ); - - }; - - // Clearing - - this.getClearColor = function () { - - return _clearColor; - - }; - - this.setClearColor = function ( color, alpha ) { - - _clearColor.set( color ); - - _clearAlpha = alpha !== undefined ? alpha : 1; - - glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - }; - - this.getClearAlpha = function () { - - return _clearAlpha; - - }; - - this.setClearAlpha = function ( alpha ) { - - _clearAlpha = alpha; - - glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - }; - - this.clear = function ( color, depth, stencil ) { - - var bits = 0; - - if ( color === undefined || color ) bits |= _gl.COLOR_BUFFER_BIT; - if ( depth === undefined || depth ) bits |= _gl.DEPTH_BUFFER_BIT; - if ( stencil === undefined || stencil ) bits |= _gl.STENCIL_BUFFER_BIT; - - _gl.clear( bits ); - - }; - - this.clearColor = function () { - - _gl.clear( _gl.COLOR_BUFFER_BIT ); - - }; - - this.clearDepth = function () { - - _gl.clear( _gl.DEPTH_BUFFER_BIT ); - - }; - - this.clearStencil = function () { - - _gl.clear( _gl.STENCIL_BUFFER_BIT ); - - }; - - this.clearTarget = function ( renderTarget, color, depth, stencil ) { - - this.setRenderTarget( renderTarget ); - this.clear( color, depth, stencil ); - - }; - - // Reset - - this.resetGLState = resetGLState; - - // Buffer allocation - - function createParticleBuffers ( geometry ) { - - geometry.__webglVertexBuffer = _gl.createBuffer(); - geometry.__webglColorBuffer = _gl.createBuffer(); - - _this.info.memory.geometries ++; - - }; - - function createLineBuffers ( geometry ) { - - geometry.__webglVertexBuffer = _gl.createBuffer(); - geometry.__webglColorBuffer = _gl.createBuffer(); - geometry.__webglLineDistanceBuffer = _gl.createBuffer(); - - _this.info.memory.geometries ++; - - }; - - function createMeshBuffers ( geometryGroup ) { - - geometryGroup.__webglVertexBuffer = _gl.createBuffer(); - geometryGroup.__webglNormalBuffer = _gl.createBuffer(); - geometryGroup.__webglTangentBuffer = _gl.createBuffer(); - geometryGroup.__webglColorBuffer = _gl.createBuffer(); - geometryGroup.__webglUVBuffer = _gl.createBuffer(); - geometryGroup.__webglUV2Buffer = _gl.createBuffer(); - - geometryGroup.__webglSkinIndicesBuffer = _gl.createBuffer(); - geometryGroup.__webglSkinWeightsBuffer = _gl.createBuffer(); - - geometryGroup.__webglFaceBuffer = _gl.createBuffer(); - geometryGroup.__webglLineBuffer = _gl.createBuffer(); - - var numMorphTargets = geometryGroup.numMorphTargets; - - if ( numMorphTargets ) { - - geometryGroup.__webglMorphTargetsBuffers = []; - - for ( var m = 0, ml = numMorphTargets; m < ml; m ++ ) { - - geometryGroup.__webglMorphTargetsBuffers.push( _gl.createBuffer() ); - - } - - } - - var numMorphNormals = geometryGroup.numMorphNormals; - - if ( numMorphNormals ) { - - geometryGroup.__webglMorphNormalsBuffers = []; - - for ( var m = 0, ml = numMorphNormals; m < ml; m ++ ) { - - geometryGroup.__webglMorphNormalsBuffers.push( _gl.createBuffer() ); - - } - - } - - _this.info.memory.geometries ++; - - }; - - // Events - - var onObjectRemoved = function ( event ) { - - var object = event.target; - - object.traverse( function ( child ) { - - child.removeEventListener( 'remove', onObjectRemoved ); - - removeObject( child ); - - } ); - - }; - - var onGeometryDispose = function ( event ) { - - var geometry = event.target; - - geometry.removeEventListener( 'dispose', onGeometryDispose ); - - deallocateGeometry( geometry ); - - }; - - var onTextureDispose = function ( event ) { - - var texture = event.target; - - texture.removeEventListener( 'dispose', onTextureDispose ); - - deallocateTexture( texture ); - - _this.info.memory.textures --; - - - }; - - var onRenderTargetDispose = function ( event ) { - - var renderTarget = event.target; - - renderTarget.removeEventListener( 'dispose', onRenderTargetDispose ); - - deallocateRenderTarget( renderTarget ); - - _this.info.memory.textures --; - - }; - - var onMaterialDispose = function ( event ) { - - var material = event.target; - - material.removeEventListener( 'dispose', onMaterialDispose ); - - deallocateMaterial( material ); - - }; - - // Buffer deallocation - - var deleteBuffers = function ( geometry ) { - - var buffers = [ - '__webglVertexBuffer', - '__webglNormalBuffer', - '__webglTangentBuffer', - '__webglColorBuffer', - '__webglUVBuffer', - '__webglUV2Buffer', - - '__webglSkinIndicesBuffer', - '__webglSkinWeightsBuffer', - - '__webglFaceBuffer', - '__webglLineBuffer', - - '__webglLineDistanceBuffer' - ]; - - for ( var i = 0, l = buffers.length; i < l; i ++ ) { - - var name = buffers[ i ]; - - if ( geometry[ name ] !== undefined ) { - - _gl.deleteBuffer( geometry[ name ] ); - - delete geometry[ name ]; - - } - - } - - // custom attributes - - if ( geometry.__webglCustomAttributesList !== undefined ) { - - for ( var name in geometry.__webglCustomAttributesList ) { - - _gl.deleteBuffer( geometry.__webglCustomAttributesList[ name ].buffer ); - - } - - delete geometry.__webglCustomAttributesList; - - } - - _this.info.memory.geometries --; - - }; - - var deallocateGeometry = function ( geometry ) { - - delete geometry.__webglInit; - - if ( geometry instanceof THREE.BufferGeometry ) { - - for ( var name in geometry.attributes ) { - - var attribute = geometry.attributes[ name ]; - - if ( attribute.buffer !== undefined ) { - - _gl.deleteBuffer( attribute.buffer ); - - delete attribute.buffer; - - } - - } - - _this.info.memory.geometries --; - - } else { - - var geometryGroupsList = geometryGroups[ geometry.id ]; - - if ( geometryGroupsList !== undefined ) { - - for ( var i = 0, l = geometryGroupsList.length; i < l; i ++ ) { - - var geometryGroup = geometryGroupsList[ i ]; - - if ( geometryGroup.numMorphTargets !== undefined ) { - - for ( var m = 0, ml = geometryGroup.numMorphTargets; m < ml; m ++ ) { - - _gl.deleteBuffer( geometryGroup.__webglMorphTargetsBuffers[ m ] ); - - } - - delete geometryGroup.__webglMorphTargetsBuffers; - - } - - if ( geometryGroup.numMorphNormals !== undefined ) { - - for ( var m = 0, ml = geometryGroup.numMorphNormals; m < ml; m ++ ) { - - _gl.deleteBuffer( geometryGroup.__webglMorphNormalsBuffers[ m ] ); - - } - - delete geometryGroup.__webglMorphNormalsBuffers; - - } - - deleteBuffers( geometryGroup ); - - } - - delete geometryGroups[ geometry.id ]; - - } else { - - deleteBuffers( geometry ); - - } - - } - - // TOFIX: Workaround for deleted geometry being currently bound - - _currentGeometryProgram = ''; - - }; - - var deallocateTexture = function ( texture ) { - - if ( texture.image && texture.image.__webglTextureCube ) { - - // cube texture - - _gl.deleteTexture( texture.image.__webglTextureCube ); - - delete texture.image.__webglTextureCube; - - } else { - - // 2D texture - - if ( texture.__webglInit === undefined ) return; - - _gl.deleteTexture( texture.__webglTexture ); - - delete texture.__webglTexture; - delete texture.__webglInit; - - } - - }; - - var deallocateRenderTarget = function ( renderTarget ) { - - if ( ! renderTarget || renderTarget.__webglTexture === undefined ) return; - - _gl.deleteTexture( renderTarget.__webglTexture ); - - delete renderTarget.__webglTexture; - - if ( renderTarget instanceof THREE.WebGLRenderTargetCube ) { - - for ( var i = 0; i < 6; i ++ ) { - - _gl.deleteFramebuffer( renderTarget.__webglFramebuffer[ i ] ); - _gl.deleteRenderbuffer( renderTarget.__webglRenderbuffer[ i ] ); - - } - - } else { - - _gl.deleteFramebuffer( renderTarget.__webglFramebuffer ); - _gl.deleteRenderbuffer( renderTarget.__webglRenderbuffer ); - - } - - delete renderTarget.__webglFramebuffer; - delete renderTarget.__webglRenderbuffer; - - }; - - var deallocateMaterial = function ( material ) { - - var program = material.program.program; - - if ( program === undefined ) return; - - material.program = undefined; - - // only deallocate GL program if this was the last use of shared program - // assumed there is only single copy of any program in the _programs list - // (that's how it's constructed) - - var i, il, programInfo; - var deleteProgram = false; - - for ( i = 0, il = _programs.length; i < il; i ++ ) { - - programInfo = _programs[ i ]; - - if ( programInfo.program === program ) { - - programInfo.usedTimes --; - - if ( programInfo.usedTimes === 0 ) { - - deleteProgram = true; - - } - - break; - - } - - } - - if ( deleteProgram === true ) { - - // avoid using array.splice, this is costlier than creating new array from scratch - - var newPrograms = []; - - for ( i = 0, il = _programs.length; i < il; i ++ ) { - - programInfo = _programs[ i ]; - - if ( programInfo.program !== program ) { - - newPrograms.push( programInfo ); - - } - - } - - _programs = newPrograms; - - _gl.deleteProgram( program ); - - _this.info.memory.programs --; - - } - - }; - - // Buffer initialization - - function initCustomAttributes ( object ) { - - var geometry = object.geometry; - var material = object.material; - - var nvertices = geometry.vertices.length; - - if ( material.attributes ) { - - if ( geometry.__webglCustomAttributesList === undefined ) { - - geometry.__webglCustomAttributesList = []; - - } - - for ( var name in material.attributes ) { - - var attribute = material.attributes[ name ]; - - if ( ! attribute.__webglInitialized || attribute.createUniqueBuffers ) { - - attribute.__webglInitialized = true; - - var size = 1; // "f" and "i" - - if ( attribute.type === 'v2' ) size = 2; - else if ( attribute.type === 'v3' ) size = 3; - else if ( attribute.type === 'v4' ) size = 4; - else if ( attribute.type === 'c' ) size = 3; - - attribute.size = size; - - attribute.array = new Float32Array( nvertices * size ); - - attribute.buffer = _gl.createBuffer(); - attribute.buffer.belongsToAttribute = name; - - attribute.needsUpdate = true; - - } - - geometry.__webglCustomAttributesList.push( attribute ); - - } - - } - - }; - - function initParticleBuffers ( geometry, object ) { - - var nvertices = geometry.vertices.length; - - geometry.__vertexArray = new Float32Array( nvertices * 3 ); - geometry.__colorArray = new Float32Array( nvertices * 3 ); - - geometry.__webglParticleCount = nvertices; - - initCustomAttributes( object ); - - }; - - function initLineBuffers ( geometry, object ) { - - var nvertices = geometry.vertices.length; - - geometry.__vertexArray = new Float32Array( nvertices * 3 ); - geometry.__colorArray = new Float32Array( nvertices * 3 ); - geometry.__lineDistanceArray = new Float32Array( nvertices * 1 ); - - geometry.__webglLineCount = nvertices; - - initCustomAttributes( object ); - - }; - - function initMeshBuffers ( geometryGroup, object ) { - - var geometry = object.geometry, - faces3 = geometryGroup.faces3, - - nvertices = faces3.length * 3, - ntris = faces3.length * 1, - nlines = faces3.length * 3, - - material = getBufferMaterial( object, geometryGroup ); - - geometryGroup.__vertexArray = new Float32Array( nvertices * 3 ); - geometryGroup.__normalArray = new Float32Array( nvertices * 3 ); - geometryGroup.__colorArray = new Float32Array( nvertices * 3 ); - geometryGroup.__uvArray = new Float32Array( nvertices * 2 ); - - if ( geometry.faceVertexUvs.length > 1 ) { - - geometryGroup.__uv2Array = new Float32Array( nvertices * 2 ); - - } - - if ( geometry.hasTangents ) { - - geometryGroup.__tangentArray = new Float32Array( nvertices * 4 ); - - } - - if ( object.geometry.skinWeights.length && object.geometry.skinIndices.length ) { - - geometryGroup.__skinIndexArray = new Float32Array( nvertices * 4 ); - geometryGroup.__skinWeightArray = new Float32Array( nvertices * 4 ); - - } - - var UintArray = extensions.get( 'OES_element_index_uint' ) !== null && ntris > 21845 ? Uint32Array : Uint16Array; // 65535 / 3 - - geometryGroup.__typeArray = UintArray; - geometryGroup.__faceArray = new UintArray( ntris * 3 ); - geometryGroup.__lineArray = new UintArray( nlines * 2 ); - - var numMorphTargets = geometryGroup.numMorphTargets; - - if ( numMorphTargets ) { - - geometryGroup.__morphTargetsArrays = []; - - for ( var m = 0, ml = numMorphTargets; m < ml; m ++ ) { - - geometryGroup.__morphTargetsArrays.push( new Float32Array( nvertices * 3 ) ); - - } - - } - - var numMorphNormals = geometryGroup.numMorphNormals; - - if ( numMorphNormals ) { - - geometryGroup.__morphNormalsArrays = []; - - for ( var m = 0, ml = numMorphNormals; m < ml; m ++ ) { - - geometryGroup.__morphNormalsArrays.push( new Float32Array( nvertices * 3 ) ); - - } - - } - - geometryGroup.__webglFaceCount = ntris * 3; - geometryGroup.__webglLineCount = nlines * 2; - - - // custom attributes - - if ( material.attributes ) { - - if ( geometryGroup.__webglCustomAttributesList === undefined ) { - - geometryGroup.__webglCustomAttributesList = []; - - } - - for ( var name in material.attributes ) { - - // Do a shallow copy of the attribute object so different geometryGroup chunks use different - // attribute buffers which are correctly indexed in the setMeshBuffers function - - var originalAttribute = material.attributes[ name ]; - - var attribute = {}; - - for ( var property in originalAttribute ) { - - attribute[ property ] = originalAttribute[ property ]; - - } - - if ( ! attribute.__webglInitialized || attribute.createUniqueBuffers ) { - - attribute.__webglInitialized = true; - - var size = 1; // "f" and "i" - - if ( attribute.type === 'v2' ) size = 2; - else if ( attribute.type === 'v3' ) size = 3; - else if ( attribute.type === 'v4' ) size = 4; - else if ( attribute.type === 'c' ) size = 3; - - attribute.size = size; - - attribute.array = new Float32Array( nvertices * size ); - - attribute.buffer = _gl.createBuffer(); - attribute.buffer.belongsToAttribute = name; - - originalAttribute.needsUpdate = true; - attribute.__original = originalAttribute; - - } - - geometryGroup.__webglCustomAttributesList.push( attribute ); - - } - - } - - geometryGroup.__inittedArrays = true; - - }; - - function getBufferMaterial( object, geometryGroup ) { - - return object.material instanceof THREE.MeshFaceMaterial - ? object.material.materials[ geometryGroup.materialIndex ] - : object.material; - - } - - function materialNeedsFaceNormals ( material ) { - - return material instanceof THREE.MeshPhongMaterial === false && material.shading === THREE.FlatShading; - - } - - // Buffer setting - - function setParticleBuffers ( geometry, hint, object ) { - - var v, c, vertex, offset, color, - - vertices = geometry.vertices, - vl = vertices.length, - - colors = geometry.colors, - cl = colors.length, - - vertexArray = geometry.__vertexArray, - colorArray = geometry.__colorArray, - - dirtyVertices = geometry.verticesNeedUpdate, - dirtyColors = geometry.colorsNeedUpdate, - - customAttributes = geometry.__webglCustomAttributesList, - i, il, - ca, cal, value, - customAttribute; - - if ( dirtyVertices ) { - - for ( v = 0; v < vl; v ++ ) { - - vertex = vertices[ v ]; - - offset = v * 3; - - vertexArray[ offset ] = vertex.x; - vertexArray[ offset + 1 ] = vertex.y; - vertexArray[ offset + 2 ] = vertex.z; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); - - } - - if ( dirtyColors ) { - - for ( c = 0; c < cl; c ++ ) { - - color = colors[ c ]; - - offset = c * 3; - - colorArray[ offset ] = color.r; - colorArray[ offset + 1 ] = color.g; - colorArray[ offset + 2 ] = color.b; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint ); - - } - - if ( customAttributes ) { - - for ( i = 0, il = customAttributes.length; i < il; i ++ ) { - - customAttribute = customAttributes[ i ]; - - if ( customAttribute.needsUpdate && ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) ) { - - cal = customAttribute.value.length; - - offset = 0; - - if ( customAttribute.size === 1 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - customAttribute.array[ ca ] = customAttribute.value[ ca ]; - - } - - } else if ( customAttribute.size === 2 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - - offset += 2; - - } - - } else if ( customAttribute.size === 3 ) { - - if ( customAttribute.type === 'c' ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.r; - customAttribute.array[ offset + 1 ] = value.g; - customAttribute.array[ offset + 2 ] = value.b; - - offset += 3; - - } - - } else { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - - offset += 3; - - } - - } - - } else if ( customAttribute.size === 4 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - customAttribute.array[ offset + 3 ] = value.w; - - offset += 4; - - } - - } - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint ); - - customAttribute.needsUpdate = false; - - } - - } - - } - - function setLineBuffers ( geometry, hint ) { - - var v, c, d, vertex, offset, color, - - vertices = geometry.vertices, - colors = geometry.colors, - lineDistances = geometry.lineDistances, - - vl = vertices.length, - cl = colors.length, - dl = lineDistances.length, - - vertexArray = geometry.__vertexArray, - colorArray = geometry.__colorArray, - lineDistanceArray = geometry.__lineDistanceArray, - - dirtyVertices = geometry.verticesNeedUpdate, - dirtyColors = geometry.colorsNeedUpdate, - dirtyLineDistances = geometry.lineDistancesNeedUpdate, - - customAttributes = geometry.__webglCustomAttributesList, - - i, il, - ca, cal, value, - customAttribute; - - if ( dirtyVertices ) { - - for ( v = 0; v < vl; v ++ ) { - - vertex = vertices[ v ]; - - offset = v * 3; - - vertexArray[ offset ] = vertex.x; - vertexArray[ offset + 1 ] = vertex.y; - vertexArray[ offset + 2 ] = vertex.z; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); - - } - - if ( dirtyColors ) { - - for ( c = 0; c < cl; c ++ ) { - - color = colors[ c ]; - - offset = c * 3; - - colorArray[ offset ] = color.r; - colorArray[ offset + 1 ] = color.g; - colorArray[ offset + 2 ] = color.b; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint ); - - } - - if ( dirtyLineDistances ) { - - for ( d = 0; d < dl; d ++ ) { - - lineDistanceArray[ d ] = lineDistances[ d ]; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglLineDistanceBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, lineDistanceArray, hint ); - - } - - if ( customAttributes ) { - - for ( i = 0, il = customAttributes.length; i < il; i ++ ) { - - customAttribute = customAttributes[ i ]; - - if ( customAttribute.needsUpdate && ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) ) { - - offset = 0; - - cal = customAttribute.value.length; - - if ( customAttribute.size === 1 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - customAttribute.array[ ca ] = customAttribute.value[ ca ]; - - } - - } else if ( customAttribute.size === 2 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - - offset += 2; - - } - - } else if ( customAttribute.size === 3 ) { - - if ( customAttribute.type === 'c' ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.r; - customAttribute.array[ offset + 1 ] = value.g; - customAttribute.array[ offset + 2 ] = value.b; - - offset += 3; - - } - - } else { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - - offset += 3; - - } - - } - - } else if ( customAttribute.size === 4 ) { - - for ( ca = 0; ca < cal; ca ++ ) { - - value = customAttribute.value[ ca ]; - - customAttribute.array[ offset ] = value.x; - customAttribute.array[ offset + 1 ] = value.y; - customAttribute.array[ offset + 2 ] = value.z; - customAttribute.array[ offset + 3 ] = value.w; - - offset += 4; - - } - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint ); - - customAttribute.needsUpdate = false; - - } - - } - - } - - } - - function setMeshBuffers( geometryGroup, object, hint, dispose, material ) { - - if ( ! geometryGroup.__inittedArrays ) { - - return; - - } - - var needsFaceNormals = materialNeedsFaceNormals( material ); - - var f, fl, fi, face, - vertexNormals, faceNormal, - vertexColors, faceColor, - vertexTangents, - uv, uv2, v1, v2, v3, t1, t2, t3, n1, n2, n3, - c1, c2, c3, - sw1, sw2, sw3, - si1, si2, si3, - i, il, - vn, uvi, uv2i, - vk, vkl, vka, - nka, chf, faceVertexNormals, - - vertexIndex = 0, - - offset = 0, - offset_uv = 0, - offset_uv2 = 0, - offset_face = 0, - offset_normal = 0, - offset_tangent = 0, - offset_line = 0, - offset_color = 0, - offset_skin = 0, - offset_morphTarget = 0, - offset_custom = 0, - - value, - - vertexArray = geometryGroup.__vertexArray, - uvArray = geometryGroup.__uvArray, - uv2Array = geometryGroup.__uv2Array, - normalArray = geometryGroup.__normalArray, - tangentArray = geometryGroup.__tangentArray, - colorArray = geometryGroup.__colorArray, - - skinIndexArray = geometryGroup.__skinIndexArray, - skinWeightArray = geometryGroup.__skinWeightArray, - - morphTargetsArrays = geometryGroup.__morphTargetsArrays, - morphNormalsArrays = geometryGroup.__morphNormalsArrays, - - customAttributes = geometryGroup.__webglCustomAttributesList, - customAttribute, - - faceArray = geometryGroup.__faceArray, - lineArray = geometryGroup.__lineArray, - - geometry = object.geometry, // this is shared for all chunks - - dirtyVertices = geometry.verticesNeedUpdate, - dirtyElements = geometry.elementsNeedUpdate, - dirtyUvs = geometry.uvsNeedUpdate, - dirtyNormals = geometry.normalsNeedUpdate, - dirtyTangents = geometry.tangentsNeedUpdate, - dirtyColors = geometry.colorsNeedUpdate, - dirtyMorphTargets = geometry.morphTargetsNeedUpdate, - - vertices = geometry.vertices, - chunk_faces3 = geometryGroup.faces3, - obj_faces = geometry.faces, - - obj_uvs = geometry.faceVertexUvs[ 0 ], - obj_uvs2 = geometry.faceVertexUvs[ 1 ], - - obj_skinIndices = geometry.skinIndices, - obj_skinWeights = geometry.skinWeights, - - morphTargets = geometry.morphTargets, - morphNormals = geometry.morphNormals; - - if ( dirtyVertices ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - v1 = vertices[ face.a ]; - v2 = vertices[ face.b ]; - v3 = vertices[ face.c ]; - - vertexArray[ offset ] = v1.x; - vertexArray[ offset + 1 ] = v1.y; - vertexArray[ offset + 2 ] = v1.z; - - vertexArray[ offset + 3 ] = v2.x; - vertexArray[ offset + 4 ] = v2.y; - vertexArray[ offset + 5 ] = v2.z; - - vertexArray[ offset + 6 ] = v3.x; - vertexArray[ offset + 7 ] = v3.y; - vertexArray[ offset + 8 ] = v3.z; - - offset += 9; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); - - } - - if ( dirtyMorphTargets ) { - - for ( vk = 0, vkl = morphTargets.length; vk < vkl; vk ++ ) { - - offset_morphTarget = 0; - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - chf = chunk_faces3[ f ]; - face = obj_faces[ chf ]; - - // morph positions - - v1 = morphTargets[ vk ].vertices[ face.a ]; - v2 = morphTargets[ vk ].vertices[ face.b ]; - v3 = morphTargets[ vk ].vertices[ face.c ]; - - vka = morphTargetsArrays[ vk ]; - - vka[ offset_morphTarget ] = v1.x; - vka[ offset_morphTarget + 1 ] = v1.y; - vka[ offset_morphTarget + 2 ] = v1.z; - - vka[ offset_morphTarget + 3 ] = v2.x; - vka[ offset_morphTarget + 4 ] = v2.y; - vka[ offset_morphTarget + 5 ] = v2.z; - - vka[ offset_morphTarget + 6 ] = v3.x; - vka[ offset_morphTarget + 7 ] = v3.y; - vka[ offset_morphTarget + 8 ] = v3.z; - - // morph normals - - if ( material.morphNormals ) { - - if ( needsFaceNormals ) { - - n1 = morphNormals[ vk ].faceNormals[ chf ]; - n2 = n1; - n3 = n1; - - } else { - - faceVertexNormals = morphNormals[ vk ].vertexNormals[ chf ]; - - n1 = faceVertexNormals.a; - n2 = faceVertexNormals.b; - n3 = faceVertexNormals.c; - - } - - nka = morphNormalsArrays[ vk ]; - - nka[ offset_morphTarget ] = n1.x; - nka[ offset_morphTarget + 1 ] = n1.y; - nka[ offset_morphTarget + 2 ] = n1.z; - - nka[ offset_morphTarget + 3 ] = n2.x; - nka[ offset_morphTarget + 4 ] = n2.y; - nka[ offset_morphTarget + 5 ] = n2.z; - - nka[ offset_morphTarget + 6 ] = n3.x; - nka[ offset_morphTarget + 7 ] = n3.y; - nka[ offset_morphTarget + 8 ] = n3.z; - - } - - // - - offset_morphTarget += 9; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ vk ] ); - _gl.bufferData( _gl.ARRAY_BUFFER, morphTargetsArrays[ vk ], hint ); - - if ( material.morphNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ vk ] ); - _gl.bufferData( _gl.ARRAY_BUFFER, morphNormalsArrays[ vk ], hint ); - - } - - } - - } - - if ( obj_skinWeights.length ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - // weights - - sw1 = obj_skinWeights[ face.a ]; - sw2 = obj_skinWeights[ face.b ]; - sw3 = obj_skinWeights[ face.c ]; - - skinWeightArray[ offset_skin ] = sw1.x; - skinWeightArray[ offset_skin + 1 ] = sw1.y; - skinWeightArray[ offset_skin + 2 ] = sw1.z; - skinWeightArray[ offset_skin + 3 ] = sw1.w; - - skinWeightArray[ offset_skin + 4 ] = sw2.x; - skinWeightArray[ offset_skin + 5 ] = sw2.y; - skinWeightArray[ offset_skin + 6 ] = sw2.z; - skinWeightArray[ offset_skin + 7 ] = sw2.w; - - skinWeightArray[ offset_skin + 8 ] = sw3.x; - skinWeightArray[ offset_skin + 9 ] = sw3.y; - skinWeightArray[ offset_skin + 10 ] = sw3.z; - skinWeightArray[ offset_skin + 11 ] = sw3.w; - - // indices - - si1 = obj_skinIndices[ face.a ]; - si2 = obj_skinIndices[ face.b ]; - si3 = obj_skinIndices[ face.c ]; - - skinIndexArray[ offset_skin ] = si1.x; - skinIndexArray[ offset_skin + 1 ] = si1.y; - skinIndexArray[ offset_skin + 2 ] = si1.z; - skinIndexArray[ offset_skin + 3 ] = si1.w; - - skinIndexArray[ offset_skin + 4 ] = si2.x; - skinIndexArray[ offset_skin + 5 ] = si2.y; - skinIndexArray[ offset_skin + 6 ] = si2.z; - skinIndexArray[ offset_skin + 7 ] = si2.w; - - skinIndexArray[ offset_skin + 8 ] = si3.x; - skinIndexArray[ offset_skin + 9 ] = si3.y; - skinIndexArray[ offset_skin + 10 ] = si3.z; - skinIndexArray[ offset_skin + 11 ] = si3.w; - - offset_skin += 12; - - } - - if ( offset_skin > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinIndicesBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, skinIndexArray, hint ); - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinWeightsBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, skinWeightArray, hint ); - - } - - } - - if ( dirtyColors ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - vertexColors = face.vertexColors; - faceColor = face.color; - - if ( vertexColors.length === 3 && material.vertexColors === THREE.VertexColors ) { - - c1 = vertexColors[ 0 ]; - c2 = vertexColors[ 1 ]; - c3 = vertexColors[ 2 ]; - - } else { - - c1 = faceColor; - c2 = faceColor; - c3 = faceColor; - - } - - colorArray[ offset_color ] = c1.r; - colorArray[ offset_color + 1 ] = c1.g; - colorArray[ offset_color + 2 ] = c1.b; - - colorArray[ offset_color + 3 ] = c2.r; - colorArray[ offset_color + 4 ] = c2.g; - colorArray[ offset_color + 5 ] = c2.b; - - colorArray[ offset_color + 6 ] = c3.r; - colorArray[ offset_color + 7 ] = c3.g; - colorArray[ offset_color + 8 ] = c3.b; - - offset_color += 9; - - } - - if ( offset_color > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint ); - - } - - } - - if ( dirtyTangents && geometry.hasTangents ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - vertexTangents = face.vertexTangents; - - t1 = vertexTangents[ 0 ]; - t2 = vertexTangents[ 1 ]; - t3 = vertexTangents[ 2 ]; - - tangentArray[ offset_tangent ] = t1.x; - tangentArray[ offset_tangent + 1 ] = t1.y; - tangentArray[ offset_tangent + 2 ] = t1.z; - tangentArray[ offset_tangent + 3 ] = t1.w; - - tangentArray[ offset_tangent + 4 ] = t2.x; - tangentArray[ offset_tangent + 5 ] = t2.y; - tangentArray[ offset_tangent + 6 ] = t2.z; - tangentArray[ offset_tangent + 7 ] = t2.w; - - tangentArray[ offset_tangent + 8 ] = t3.x; - tangentArray[ offset_tangent + 9 ] = t3.y; - tangentArray[ offset_tangent + 10 ] = t3.z; - tangentArray[ offset_tangent + 11 ] = t3.w; - - offset_tangent += 12; - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglTangentBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, tangentArray, hint ); - - } - - if ( dirtyNormals ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - vertexNormals = face.vertexNormals; - faceNormal = face.normal; - - if ( vertexNormals.length === 3 && needsFaceNormals === false ) { - - for ( i = 0; i < 3; i ++ ) { - - vn = vertexNormals[ i ]; - - normalArray[ offset_normal ] = vn.x; - normalArray[ offset_normal + 1 ] = vn.y; - normalArray[ offset_normal + 2 ] = vn.z; - - offset_normal += 3; - - } - - } else { - - for ( i = 0; i < 3; i ++ ) { - - normalArray[ offset_normal ] = faceNormal.x; - normalArray[ offset_normal + 1 ] = faceNormal.y; - normalArray[ offset_normal + 2 ] = faceNormal.z; - - offset_normal += 3; - - } - - } - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglNormalBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, normalArray, hint ); - - } - - if ( dirtyUvs && obj_uvs ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - fi = chunk_faces3[ f ]; - - uv = obj_uvs[ fi ]; - - if ( uv === undefined ) continue; - - for ( i = 0; i < 3; i ++ ) { - - uvi = uv[ i ]; - - uvArray[ offset_uv ] = uvi.x; - uvArray[ offset_uv + 1 ] = uvi.y; - - offset_uv += 2; - - } - - } - - if ( offset_uv > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUVBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, uvArray, hint ); - - } - - } - - if ( dirtyUvs && obj_uvs2 ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - fi = chunk_faces3[ f ]; - - uv2 = obj_uvs2[ fi ]; - - if ( uv2 === undefined ) continue; - - for ( i = 0; i < 3; i ++ ) { - - uv2i = uv2[ i ]; - - uv2Array[ offset_uv2 ] = uv2i.x; - uv2Array[ offset_uv2 + 1 ] = uv2i.y; - - offset_uv2 += 2; - - } - - } - - if ( offset_uv2 > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUV2Buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, uv2Array, hint ); - - } - - } - - if ( dirtyElements ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - faceArray[ offset_face ] = vertexIndex; - faceArray[ offset_face + 1 ] = vertexIndex + 1; - faceArray[ offset_face + 2 ] = vertexIndex + 2; - - offset_face += 3; - - lineArray[ offset_line ] = vertexIndex; - lineArray[ offset_line + 1 ] = vertexIndex + 1; - - lineArray[ offset_line + 2 ] = vertexIndex; - lineArray[ offset_line + 3 ] = vertexIndex + 2; - - lineArray[ offset_line + 4 ] = vertexIndex + 1; - lineArray[ offset_line + 5 ] = vertexIndex + 2; - - offset_line += 6; - - vertexIndex += 3; - - } - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglFaceBuffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, faceArray, hint ); - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglLineBuffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, lineArray, hint ); - - } - - if ( customAttributes ) { - - for ( i = 0, il = customAttributes.length; i < il; i ++ ) { - - customAttribute = customAttributes[ i ]; - - if ( ! customAttribute.__original.needsUpdate ) continue; - - offset_custom = 0; - - if ( customAttribute.size === 1 ) { - - if ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - customAttribute.array[ offset_custom ] = customAttribute.value[ face.a ]; - customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ]; - customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ]; - - offset_custom += 3; - - } - - } else if ( customAttribute.boundTo === 'faces' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - customAttribute.array[ offset_custom ] = value; - customAttribute.array[ offset_custom + 1 ] = value; - customAttribute.array[ offset_custom + 2 ] = value; - - offset_custom += 3; - - } - - } - - } else if ( customAttribute.size === 2 ) { - - if ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - v1 = customAttribute.value[ face.a ]; - v2 = customAttribute.value[ face.b ]; - v3 = customAttribute.value[ face.c ]; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - - customAttribute.array[ offset_custom + 2 ] = v2.x; - customAttribute.array[ offset_custom + 3 ] = v2.y; - - customAttribute.array[ offset_custom + 4 ] = v3.x; - customAttribute.array[ offset_custom + 5 ] = v3.y; - - offset_custom += 6; - - } - - } else if ( customAttribute.boundTo === 'faces' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value; - v2 = value; - v3 = value; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - - customAttribute.array[ offset_custom + 2 ] = v2.x; - customAttribute.array[ offset_custom + 3 ] = v2.y; - - customAttribute.array[ offset_custom + 4 ] = v3.x; - customAttribute.array[ offset_custom + 5 ] = v3.y; - - offset_custom += 6; - - } - - } - - } else if ( customAttribute.size === 3 ) { - - var pp; - - if ( customAttribute.type === 'c' ) { - - pp = [ 'r', 'g', 'b' ]; - - } else { - - pp = [ 'x', 'y', 'z' ]; - - } - - if ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - v1 = customAttribute.value[ face.a ]; - v2 = customAttribute.value[ face.b ]; - v3 = customAttribute.value[ face.c ]; - - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ]; - - offset_custom += 9; - - } - - } else if ( customAttribute.boundTo === 'faces' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value; - v2 = value; - v3 = value; - - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ]; - - offset_custom += 9; - - } - - } else if ( customAttribute.boundTo === 'faceVertices' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value[ 0 ]; - v2 = value[ 1 ]; - v3 = value[ 2 ]; - - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ]; - - customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ]; - customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ]; - customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ]; - - offset_custom += 9; - - } - - } - - } else if ( customAttribute.size === 4 ) { - - if ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - face = obj_faces[ chunk_faces3[ f ] ]; - - v1 = customAttribute.value[ face.a ]; - v2 = customAttribute.value[ face.b ]; - v3 = customAttribute.value[ face.c ]; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - customAttribute.array[ offset_custom + 2 ] = v1.z; - customAttribute.array[ offset_custom + 3 ] = v1.w; - - customAttribute.array[ offset_custom + 4 ] = v2.x; - customAttribute.array[ offset_custom + 5 ] = v2.y; - customAttribute.array[ offset_custom + 6 ] = v2.z; - customAttribute.array[ offset_custom + 7 ] = v2.w; - - customAttribute.array[ offset_custom + 8 ] = v3.x; - customAttribute.array[ offset_custom + 9 ] = v3.y; - customAttribute.array[ offset_custom + 10 ] = v3.z; - customAttribute.array[ offset_custom + 11 ] = v3.w; - - offset_custom += 12; - - } - - } else if ( customAttribute.boundTo === 'faces' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value; - v2 = value; - v3 = value; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - customAttribute.array[ offset_custom + 2 ] = v1.z; - customAttribute.array[ offset_custom + 3 ] = v1.w; - - customAttribute.array[ offset_custom + 4 ] = v2.x; - customAttribute.array[ offset_custom + 5 ] = v2.y; - customAttribute.array[ offset_custom + 6 ] = v2.z; - customAttribute.array[ offset_custom + 7 ] = v2.w; - - customAttribute.array[ offset_custom + 8 ] = v3.x; - customAttribute.array[ offset_custom + 9 ] = v3.y; - customAttribute.array[ offset_custom + 10 ] = v3.z; - customAttribute.array[ offset_custom + 11 ] = v3.w; - - offset_custom += 12; - - } - - } else if ( customAttribute.boundTo === 'faceVertices' ) { - - for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - - value = customAttribute.value[ chunk_faces3[ f ] ]; - - v1 = value[ 0 ]; - v2 = value[ 1 ]; - v3 = value[ 2 ]; - - customAttribute.array[ offset_custom ] = v1.x; - customAttribute.array[ offset_custom + 1 ] = v1.y; - customAttribute.array[ offset_custom + 2 ] = v1.z; - customAttribute.array[ offset_custom + 3 ] = v1.w; - - customAttribute.array[ offset_custom + 4 ] = v2.x; - customAttribute.array[ offset_custom + 5 ] = v2.y; - customAttribute.array[ offset_custom + 6 ] = v2.z; - customAttribute.array[ offset_custom + 7 ] = v2.w; - - customAttribute.array[ offset_custom + 8 ] = v3.x; - customAttribute.array[ offset_custom + 9 ] = v3.y; - customAttribute.array[ offset_custom + 10 ] = v3.z; - customAttribute.array[ offset_custom + 11 ] = v3.w; - - offset_custom += 12; - - } - - } - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint ); - - } - - } - - if ( dispose ) { - - delete geometryGroup.__inittedArrays; - delete geometryGroup.__colorArray; - delete geometryGroup.__normalArray; - delete geometryGroup.__tangentArray; - delete geometryGroup.__uvArray; - delete geometryGroup.__uv2Array; - delete geometryGroup.__faceArray; - delete geometryGroup.__vertexArray; - delete geometryGroup.__lineArray; - delete geometryGroup.__skinIndexArray; - delete geometryGroup.__skinWeightArray; - - } - - }; - - // Buffer rendering - - this.renderBufferImmediate = function ( object, program, material ) { - - state.initAttributes(); - - if ( object.hasPositions && ! object.__webglVertexBuffer ) object.__webglVertexBuffer = _gl.createBuffer(); - if ( object.hasNormals && ! object.__webglNormalBuffer ) object.__webglNormalBuffer = _gl.createBuffer(); - if ( object.hasUvs && ! object.__webglUvBuffer ) object.__webglUvBuffer = _gl.createBuffer(); - if ( object.hasColors && ! object.__webglColorBuffer ) object.__webglColorBuffer = _gl.createBuffer(); - - if ( object.hasPositions ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( program.attributes.position ); - - _gl.vertexAttribPointer( program.attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglNormalBuffer ); - - if ( material instanceof THREE.MeshPhongMaterial === false && - material.shading === THREE.FlatShading ) { - - var nx, ny, nz, - nax, nbx, ncx, nay, nby, ncy, naz, nbz, ncz, - normalArray, - i, il = object.count * 3; - - for ( i = 0; i < il; i += 9 ) { - - normalArray = object.normalArray; - - nax = normalArray[ i ]; - nay = normalArray[ i + 1 ]; - naz = normalArray[ i + 2 ]; - - nbx = normalArray[ i + 3 ]; - nby = normalArray[ i + 4 ]; - nbz = normalArray[ i + 5 ]; - - ncx = normalArray[ i + 6 ]; - ncy = normalArray[ i + 7 ]; - ncz = normalArray[ i + 8 ]; - - nx = ( nax + nbx + ncx ) / 3; - ny = ( nay + nby + ncy ) / 3; - nz = ( naz + nbz + ncz ) / 3; - - normalArray[ i ] = nx; - normalArray[ i + 1 ] = ny; - normalArray[ i + 2 ] = nz; - - normalArray[ i + 3 ] = nx; - normalArray[ i + 4 ] = ny; - normalArray[ i + 5 ] = nz; - - normalArray[ i + 6 ] = nx; - normalArray[ i + 7 ] = ny; - normalArray[ i + 8 ] = nz; - - } - - } - - _gl.bufferData( _gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( program.attributes.normal ); - - _gl.vertexAttribPointer( program.attributes.normal, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasUvs && material.map ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglUvBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( program.attributes.uv ); - - _gl.vertexAttribPointer( program.attributes.uv, 2, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasColors && material.vertexColors !== THREE.NoColors ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( program.attributes.color ); - - _gl.vertexAttribPointer( program.attributes.color, 3, _gl.FLOAT, false, 0, 0 ); - - } - - state.disableUnusedAttributes(); - - _gl.drawArrays( _gl.TRIANGLES, 0, object.count ); - - object.count = 0; - - }; - - function setupVertexAttributes( material, program, geometry, startIndex ) { - - var geometryAttributes = geometry.attributes; - - var programAttributes = program.attributes; - var programAttributesKeys = program.attributesKeys; - - for ( var i = 0, l = programAttributesKeys.length; i < l; i ++ ) { - - var key = programAttributesKeys[ i ]; - var programAttribute = programAttributes[ key ]; - - if ( programAttribute >= 0 ) { - - var geometryAttribute = geometryAttributes[ key ]; - - if ( geometryAttribute !== undefined ) { - - var size = geometryAttribute.itemSize; - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryAttribute.buffer ); - - state.enableAttribute( programAttribute ); - - _gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, 0, startIndex * size * 4 ); // 4 bytes per Float32 - - } else if ( material.defaultAttributeValues !== undefined ) { - - if ( material.defaultAttributeValues[ key ].length === 2 ) { - - _gl.vertexAttrib2fv( programAttribute, material.defaultAttributeValues[ key ] ); - - } else if ( material.defaultAttributeValues[ key ].length === 3 ) { - - _gl.vertexAttrib3fv( programAttribute, material.defaultAttributeValues[ key ] ); - - } - - } - - } - - } - - state.disableUnusedAttributes(); - - } - - this.renderBufferDirect = function ( camera, lights, fog, material, geometry, object ) { - - if ( material.visible === false ) return; - - updateObject( object ); - - var program = setProgram( camera, lights, fog, material, object ); - - var updateBuffers = false, - wireframeBit = material.wireframe ? 1 : 0, - geometryProgram = 'direct_' + geometry.id + '_' + program.id + '_' + wireframeBit; - - if ( geometryProgram !== _currentGeometryProgram ) { - - _currentGeometryProgram = geometryProgram; - updateBuffers = true; - - } - - if ( updateBuffers ) { - - state.initAttributes(); - - } - - // render mesh - - if ( object instanceof THREE.Mesh ) { - - var mode = material.wireframe === true ? _gl.LINES : _gl.TRIANGLES; - - var index = geometry.attributes.index; - - if ( index ) { - - // indexed triangles - - var type, size; - - if ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) { - - type = _gl.UNSIGNED_INT; - size = 4; - - } else { - - type = _gl.UNSIGNED_SHORT; - size = 2; - - } - - var offsets = geometry.offsets; - - if ( offsets.length === 0 ) { - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, 0 ); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); - - } - - _gl.drawElements( mode, index.array.length, type, 0 ); - - _this.info.render.calls ++; - _this.info.render.vertices += index.array.length; // not really true, here vertices can be shared - _this.info.render.faces += index.array.length / 3; - - } else { - - // if there is more than 1 chunk - // must set attribute pointers to use new offsets for each chunk - // even if geometry and materials didn't change - - updateBuffers = true; - - for ( var i = 0, il = offsets.length; i < il; i ++ ) { - - var startIndex = offsets[ i ].index; - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, startIndex ); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); - - } - - // render indexed triangles - - _gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size ); - - _this.info.render.calls ++; - _this.info.render.vertices += offsets[ i ].count; // not really true, here vertices can be shared - _this.info.render.faces += offsets[ i ].count / 3; - - } - - } - - } else { - - // non-indexed triangles - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, 0 ); - - } - - var position = geometry.attributes[ 'position' ]; - - // render non-indexed triangles - - _gl.drawArrays( mode, 0, position.array.length / position.itemSize ); - - _this.info.render.calls ++; - _this.info.render.vertices += position.array.length / position.itemSize; - _this.info.render.faces += position.array.length / ( 3 * position.itemSize ); - - } - - } else if ( object instanceof THREE.PointCloud ) { - - // render particles - - var mode = _gl.POINTS; - - var index = geometry.attributes.index; - - if ( index ) { - - // indexed points - - var type, size; - - if ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) { - - type = _gl.UNSIGNED_INT; - size = 4; - - } else { - - type = _gl.UNSIGNED_SHORT; - size = 2; - - } - - var offsets = geometry.offsets; - - if ( offsets.length === 0 ) { - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, 0 ); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); - - } - - _gl.drawElements( mode, index.array.length, type, 0); - - _this.info.render.calls ++; - _this.info.render.points += index.array.length; - - } else { - - // if there is more than 1 chunk - // must set attribute pointers to use new offsets for each chunk - // even if geometry and materials didn't change - - if ( offsets.length > 1 ) updateBuffers = true; - - for ( var i = 0, il = offsets.length; i < il; i ++ ) { - - var startIndex = offsets[ i ].index; - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, startIndex ); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); - - } - - // render indexed points - - _gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size ); - - _this.info.render.calls ++; - _this.info.render.points += offsets[ i ].count; - - } - - } - - } else { - - // non-indexed points - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, 0 ); - - } - - var position = geometry.attributes.position; - var offsets = geometry.offsets; - - if ( offsets.length === 0 ) { - - _gl.drawArrays( mode, 0, position.array.length / 3 ); - - _this.info.render.calls ++; - _this.info.render.points += position.array.length / 3; - - } else { - - for ( var i = 0, il = offsets.length; i < il; i ++ ) { - - _gl.drawArrays( mode, offsets[ i ].index, offsets[ i ].count ); - - _this.info.render.calls ++; - _this.info.render.points += offsets[ i ].count; - - } - - } - - } - - } else if ( object instanceof THREE.Line ) { - - var mode = ( object.mode === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES; - - state.setLineWidth( material.linewidth * pixelRatio ); - - var index = geometry.attributes.index; - - if ( index ) { - - // indexed lines - - var type, size; - - if ( index.array instanceof Uint32Array ) { - - type = _gl.UNSIGNED_INT; - size = 4; - - } else { - - type = _gl.UNSIGNED_SHORT; - size = 2; - - } - - var offsets = geometry.offsets; - - if ( offsets.length === 0 ) { - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, 0 ); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); - - } - - _gl.drawElements( mode, index.array.length, type, 0 ); // 2 bytes per Uint16Array - - _this.info.render.calls ++; - _this.info.render.vertices += index.array.length; // not really true, here vertices can be shared - - } else { - - // if there is more than 1 chunk - // must set attribute pointers to use new offsets for each chunk - // even if geometry and materials didn't change - - if ( offsets.length > 1 ) updateBuffers = true; - - for ( var i = 0, il = offsets.length; i < il; i ++ ) { - - var startIndex = offsets[ i ].index; - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, startIndex ); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); - - } - - // render indexed lines - - _gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size ); // 2 bytes per Uint16Array - - _this.info.render.calls ++; - _this.info.render.vertices += offsets[ i ].count; // not really true, here vertices can be shared - - } - - } - - } else { - - // non-indexed lines - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry, 0 ); - - } - - var position = geometry.attributes.position; - var offsets = geometry.offsets; - - if ( offsets.length === 0 ) { - - _gl.drawArrays( mode, 0, position.array.length / 3 ); - - _this.info.render.calls ++; - _this.info.render.vertices += position.array.length / 3; - - } else { - - for ( var i = 0, il = offsets.length; i < il; i ++ ) { - - _gl.drawArrays( mode, offsets[ i ].index, offsets[ i ].count ); - - _this.info.render.calls ++; - _this.info.render.vertices += offsets[ i ].count; - - } - - } - - } - - } - - }; - - this.renderBuffer = function ( camera, lights, fog, material, geometryGroup, object ) { - - if ( material.visible === false ) return; - - updateObject( object ); - - var program = setProgram( camera, lights, fog, material, object ); - - var attributes = program.attributes; - - var updateBuffers = false, - wireframeBit = material.wireframe ? 1 : 0, - geometryProgram = geometryGroup.id + '_' + program.id + '_' + wireframeBit; - - if ( geometryProgram !== _currentGeometryProgram ) { - - _currentGeometryProgram = geometryProgram; - updateBuffers = true; - - } - - if ( updateBuffers ) { - - state.initAttributes(); - - } - - // vertices - - if ( ! material.morphTargets && attributes.position >= 0 ) { - - if ( updateBuffers ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer ); - - state.enableAttribute( attributes.position ); - - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - } else { - - if ( object.morphTargetBase ) { - - setupMorphTargets( material, geometryGroup, object ); - - } - - } - - - if ( updateBuffers ) { - - // custom attributes - - // Use the per-geometryGroup custom attribute arrays which are setup in initMeshBuffers - - if ( geometryGroup.__webglCustomAttributesList ) { - - for ( var i = 0, il = geometryGroup.__webglCustomAttributesList.length; i < il; i ++ ) { - - var attribute = geometryGroup.__webglCustomAttributesList[ i ]; - - if ( attributes[ attribute.buffer.belongsToAttribute ] >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, attribute.buffer ); - - state.enableAttribute( attributes[ attribute.buffer.belongsToAttribute ] ); - - _gl.vertexAttribPointer( attributes[ attribute.buffer.belongsToAttribute ], attribute.size, _gl.FLOAT, false, 0, 0 ); - - } - - } - - } - - - // colors - - if ( attributes.color >= 0 ) { - - if ( object.geometry.colors.length > 0 || object.geometry.faces.length > 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglColorBuffer ); - - state.enableAttribute( attributes.color ); - - _gl.vertexAttribPointer( attributes.color, 3, _gl.FLOAT, false, 0, 0 ); - - } else if ( material.defaultAttributeValues !== undefined ) { - - - _gl.vertexAttrib3fv( attributes.color, material.defaultAttributeValues.color ); - - } - - } - - // normals - - if ( attributes.normal >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglNormalBuffer ); - - state.enableAttribute( attributes.normal ); - - _gl.vertexAttribPointer( attributes.normal, 3, _gl.FLOAT, false, 0, 0 ); - - } - - // tangents - - if ( attributes.tangent >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglTangentBuffer ); - - state.enableAttribute( attributes.tangent ); - - _gl.vertexAttribPointer( attributes.tangent, 4, _gl.FLOAT, false, 0, 0 ); - - } - - // uvs - - if ( attributes.uv >= 0 ) { - - if ( object.geometry.faceVertexUvs[ 0 ] ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUVBuffer ); - - state.enableAttribute( attributes.uv ); - - _gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 0, 0 ); - - } else if ( material.defaultAttributeValues !== undefined ) { - - - _gl.vertexAttrib2fv( attributes.uv, material.defaultAttributeValues.uv ); - - } - - } - - if ( attributes.uv2 >= 0 ) { - - if ( object.geometry.faceVertexUvs[ 1 ] ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUV2Buffer ); - - state.enableAttribute( attributes.uv2 ); - - _gl.vertexAttribPointer( attributes.uv2, 2, _gl.FLOAT, false, 0, 0 ); - - } else if ( material.defaultAttributeValues !== undefined ) { - - - _gl.vertexAttrib2fv( attributes.uv2, material.defaultAttributeValues.uv2 ); - - } - - } - - if ( material.skinning && - attributes.skinIndex >= 0 && attributes.skinWeight >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinIndicesBuffer ); - - state.enableAttribute( attributes.skinIndex ); - - _gl.vertexAttribPointer( attributes.skinIndex, 4, _gl.FLOAT, false, 0, 0 ); - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinWeightsBuffer ); - - state.enableAttribute( attributes.skinWeight ); - - _gl.vertexAttribPointer( attributes.skinWeight, 4, _gl.FLOAT, false, 0, 0 ); - - } - - // line distances - - if ( attributes.lineDistance >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglLineDistanceBuffer ); - - state.enableAttribute( attributes.lineDistance ); - - _gl.vertexAttribPointer( attributes.lineDistance, 1, _gl.FLOAT, false, 0, 0 ); - - } - - } - - state.disableUnusedAttributes(); - - // render mesh - - if ( object instanceof THREE.Mesh ) { - - var type = geometryGroup.__typeArray === Uint32Array ? _gl.UNSIGNED_INT : _gl.UNSIGNED_SHORT; - - // wireframe - - if ( material.wireframe ) { - - state.setLineWidth( material.wireframeLinewidth * pixelRatio ); - - if ( updateBuffers ) _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglLineBuffer ); - _gl.drawElements( _gl.LINES, geometryGroup.__webglLineCount, type, 0 ); - - // triangles - - } else { - - if ( updateBuffers ) _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglFaceBuffer ); - _gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, type, 0 ); - - } - - _this.info.render.calls ++; - _this.info.render.vertices += geometryGroup.__webglFaceCount; - _this.info.render.faces += geometryGroup.__webglFaceCount / 3; - - // render lines - - } else if ( object instanceof THREE.Line ) { - - var mode = ( object.mode === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES; - - state.setLineWidth( material.linewidth * pixelRatio ); - - _gl.drawArrays( mode, 0, geometryGroup.__webglLineCount ); - - _this.info.render.calls ++; - - // render particles - - } else if ( object instanceof THREE.PointCloud ) { - - _gl.drawArrays( _gl.POINTS, 0, geometryGroup.__webglParticleCount ); - - _this.info.render.calls ++; - _this.info.render.points += geometryGroup.__webglParticleCount; - - } - - }; - - function setupMorphTargets ( material, geometryGroup, object ) { - - // set base - - var attributes = material.program.attributes; - - if ( object.morphTargetBase !== - 1 && attributes.position >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ object.morphTargetBase ] ); - - state.enableAttribute( attributes.position ); - - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } else if ( attributes.position >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer ); - - state.enableAttribute( attributes.position ); - - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.morphTargetForcedOrder.length ) { - - // set forced order - - var m = 0; - var order = object.morphTargetForcedOrder; - var influences = object.morphTargetInfluences; - - var attribute; - - while ( m < material.numSupportedMorphTargets && m < order.length ) { - - attribute = attributes[ 'morphTarget' + m ]; - - if ( attribute >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ order[ m ] ] ); - - state.enableAttribute( attribute ); - - _gl.vertexAttribPointer( attribute, 3, _gl.FLOAT, false, 0, 0 ); - - } - - attribute = attributes[ 'morphNormal' + m ]; - - if ( attribute >= 0 && material.morphNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ order[ m ] ] ); - - state.enableAttribute( attribute ); - - _gl.vertexAttribPointer( attribute, 3, _gl.FLOAT, false, 0, 0 ); - - } - - object.__webglMorphTargetInfluences[ m ] = influences[ order[ m ] ]; - - m ++; - - } - - } else { - - // find the most influencing - - var activeInfluenceIndices = []; - var influences = object.morphTargetInfluences; - var morphTargets = object.geometry.morphTargets; - - if ( influences.length > morphTargets.length ) { - - console.warn( 'THREE.WebGLRenderer: Influences array is bigger than morphTargets array.' ); - influences.length = morphTargets.length; - - } - - for ( var i = 0, il = influences.length; i < il; i ++ ) { - - var influence = influences[ i ]; - - activeInfluenceIndices.push( [ influence, i ] ); - - } - - if ( activeInfluenceIndices.length > material.numSupportedMorphTargets ) { - - activeInfluenceIndices.sort( numericalSort ); - activeInfluenceIndices.length = material.numSupportedMorphTargets; - - } else if ( activeInfluenceIndices.length > material.numSupportedMorphNormals ) { - - activeInfluenceIndices.sort( numericalSort ); - - } else if ( activeInfluenceIndices.length === 0 ) { - - activeInfluenceIndices.push( [ 0, 0 ] ); - - } - - var attribute; - - for ( var m = 0, ml = material.numSupportedMorphTargets; m < ml; m ++ ) { - - if ( activeInfluenceIndices[ m ] ) { - - var influenceIndex = activeInfluenceIndices[ m ][ 1 ]; - - attribute = attributes[ 'morphTarget' + m ]; - - if ( attribute >= 0 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ influenceIndex ] ); - - state.enableAttribute( attribute ); - - _gl.vertexAttribPointer( attribute, 3, _gl.FLOAT, false, 0, 0 ); - - } - - attribute = attributes[ 'morphNormal' + m ]; - - if ( attribute >= 0 && material.morphNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ influenceIndex ] ); - - state.enableAttribute( attribute ); - - _gl.vertexAttribPointer( attribute, 3, _gl.FLOAT, false, 0, 0 ); - - } - - object.__webglMorphTargetInfluences[ m ] = influences[ influenceIndex ]; - - } else { - - /* - _gl.vertexAttribPointer( attributes[ "morphTarget" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - if ( material.morphNormals ) { - - _gl.vertexAttribPointer( attributes[ "morphNormal" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - } - */ - - object.__webglMorphTargetInfluences[ m ] = 0; - - } - - } - - } - - // load updated influences uniform - - if ( material.program.uniforms.morphTargetInfluences !== null ) { - - _gl.uniform1fv( material.program.uniforms.morphTargetInfluences, object.__webglMorphTargetInfluences ); - - } - - } - - // Sorting - - function painterSortStable ( a, b ) { - - if ( a.object.renderOrder !== b.object.renderOrder ) { - - return a.object.renderOrder - b.object.renderOrder; - - } else if ( a.material.id !== b.material.id ) { - - return a.material.id - b.material.id; - - } else if ( a.z !== b.z ) { - - return a.z - b.z; - - } else { - - return a.id - b.id; - - } - - } - - function reversePainterSortStable ( a, b ) { - - if ( a.object.renderOrder !== b.object.renderOrder ) { - - return a.object.renderOrder - b.object.renderOrder; - - } if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return a.id - b.id; - - } - - } - - function numericalSort ( a, b ) { - - return b[ 0 ] - a[ 0 ]; - - } - - // Rendering - - this.render = function ( scene, camera, renderTarget, forceClear ) { - - if ( camera instanceof THREE.Camera === false ) { - - THREE.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' ); - return; - - } - - var fog = scene.fog; - - // reset caching for this frame - - _currentGeometryProgram = ''; - _currentMaterialId = - 1; - _currentCamera = null; - _lightsNeedUpdate = true; - - // update scene graph - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - - // update camera matrices and frustum - - if ( camera.parent === undefined ) camera.updateMatrixWorld(); - - // update Skeleton objects - - scene.traverse( function ( object ) { - - if ( object instanceof THREE.SkinnedMesh ) { - - object.skeleton.update(); - - } - - } ); - - camera.matrixWorldInverse.getInverse( camera.matrixWorld ); - - _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - lights.length = 0; - opaqueObjects.length = 0; - transparentObjects.length = 0; - - sprites.length = 0; - lensFlares.length = 0; - - projectObject( scene ); - - if ( _this.sortObjects === true ) { - - opaqueObjects.sort( painterSortStable ); - transparentObjects.sort( reversePainterSortStable ); - - } - - // custom render plugins (pre pass) - - shadowMapPlugin.render( scene, camera ); - - // - - _this.info.render.calls = 0; - _this.info.render.vertices = 0; - _this.info.render.faces = 0; - _this.info.render.points = 0; - - this.setRenderTarget( renderTarget ); - - if ( this.autoClear || forceClear ) { - - this.clear( this.autoClearColor, this.autoClearDepth, this.autoClearStencil ); - - } - - // set matrices for immediate objects - - for ( var i = 0, il = _webglObjectsImmediate.length; i < il; i ++ ) { - - var webglObject = _webglObjectsImmediate[ i ]; - var object = webglObject.object; - - if ( object.visible ) { - - setupMatrices( object, camera ); - - unrollImmediateBufferMaterial( webglObject ); - - } - - } - - if ( scene.overrideMaterial ) { - - var overrideMaterial = scene.overrideMaterial; - - setMaterial( overrideMaterial ); - - renderObjects( opaqueObjects, camera, lights, fog, overrideMaterial ); - renderObjects( transparentObjects, camera, lights, fog, overrideMaterial ); - renderObjectsImmediate( _webglObjectsImmediate, '', camera, lights, fog, overrideMaterial ); - - } else { - - // opaque pass (front-to-back order) - - state.setBlending( THREE.NoBlending ); - - renderObjects( opaqueObjects, camera, lights, fog, null ); - renderObjectsImmediate( _webglObjectsImmediate, 'opaque', camera, lights, fog, null ); - - // transparent pass (back-to-front order) - - renderObjects( transparentObjects, camera, lights, fog, null ); - renderObjectsImmediate( _webglObjectsImmediate, 'transparent', camera, lights, fog, null ); - - } - - // custom render plugins (post pass) - - spritePlugin.render( scene, camera ); - lensFlarePlugin.render( scene, camera, _currentWidth, _currentHeight ); - - // Generate mipmap if we're using any kind of mipmap filtering - - if ( renderTarget && renderTarget.generateMipmaps && renderTarget.minFilter !== THREE.NearestFilter && renderTarget.minFilter !== THREE.LinearFilter ) { - - updateRenderTargetMipmap( renderTarget ); - - } - - // Ensure depth buffer writing is enabled so it can be cleared on next render - - state.setDepthTest( true ); - state.setDepthWrite( true ); - state.setColorWrite( true ); - - // _gl.finish(); - - }; - - function projectObject( object ) { - - if ( object.visible === false ) return; - - if ( object instanceof THREE.Scene || object instanceof THREE.Group ) { - - // skip - - } else { - - initObject( object ); - - if ( object instanceof THREE.Light ) { - - lights.push( object ); - - } else if ( object instanceof THREE.Sprite ) { - - sprites.push( object ); - - } else if ( object instanceof THREE.LensFlare ) { - - lensFlares.push( object ); - - } else { - - var webglObjects = _webglObjects[ object.id ]; - - if ( webglObjects && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) { - - for ( var i = 0, l = webglObjects.length; i < l; i ++ ) { - - var webglObject = webglObjects[ i ]; - - unrollBufferMaterial( webglObject ); - - webglObject.render = true; - - if ( _this.sortObjects === true ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyProjection( _projScreenMatrix ); - - webglObject.z = _vector3.z; - - } - - } - - } - - } - - } - - for ( var i = 0, l = object.children.length; i < l; i ++ ) { - - projectObject( object.children[ i ] ); - - } - - } - - function renderObjects( renderList, camera, lights, fog, overrideMaterial ) { - - var material; - - for ( var i = 0, l = renderList.length; i < l; i ++ ) { - - var webglObject = renderList[ i ]; - - var object = webglObject.object; - var buffer = webglObject.buffer; - - setupMatrices( object, camera ); - - if ( overrideMaterial ) { - - material = overrideMaterial; - - } else { - - material = webglObject.material; - - if ( ! material ) continue; - - setMaterial( material ); - - } - - _this.setMaterialFaces( material ); - - if ( buffer instanceof THREE.BufferGeometry ) { - - _this.renderBufferDirect( camera, lights, fog, material, buffer, object ); - - } else { - - _this.renderBuffer( camera, lights, fog, material, buffer, object ); - - } - - } - - } - - function renderObjectsImmediate ( renderList, materialType, camera, lights, fog, overrideMaterial ) { - - var material; - - for ( var i = 0, l = renderList.length; i < l; i ++ ) { - - var webglObject = renderList[ i ]; - var object = webglObject.object; - - if ( object.visible ) { - - if ( overrideMaterial ) { - - material = overrideMaterial; - - } else { - - material = webglObject[ materialType ]; - - if ( ! material ) continue; - - setMaterial( material ); - - } - - _this.renderImmediateObject( camera, lights, fog, material, object ); - - } - - } - - } - - this.renderImmediateObject = function ( camera, lights, fog, material, object ) { - - var program = setProgram( camera, lights, fog, material, object ); - - _currentGeometryProgram = ''; - - _this.setMaterialFaces( material ); - - if ( object.immediateRenderCallback ) { - - object.immediateRenderCallback( program, _gl, _frustum ); - - } else { - - object.render( function ( object ) { _this.renderBufferImmediate( object, program, material ); } ); - - } - - }; - - function unrollImmediateBufferMaterial ( globject ) { - - var object = globject.object, - material = object.material; - - if ( material.transparent ) { - - globject.transparent = material; - globject.opaque = null; - - } else { - - globject.opaque = material; - globject.transparent = null; - - } - - } - - function unrollBufferMaterial ( globject ) { - - var object = globject.object; - var buffer = globject.buffer; - - var geometry = object.geometry; - var material = object.material; - - if ( material instanceof THREE.MeshFaceMaterial ) { - - var materialIndex = geometry instanceof THREE.BufferGeometry ? 0 : buffer.materialIndex; - - material = material.materials[ materialIndex ]; - - globject.material = material; - - if ( material.transparent ) { - - transparentObjects.push( globject ); - - } else { - - opaqueObjects.push( globject ); - - } - - } else if ( material ) { - - globject.material = material; - - if ( material.transparent ) { - - transparentObjects.push( globject ); - - } else { - - opaqueObjects.push( globject ); - - } - - } - - } - - function initObject( object ) { - - if ( object.__webglInit === undefined ) { - - object.__webglInit = true; - object._modelViewMatrix = new THREE.Matrix4(); - object._normalMatrix = new THREE.Matrix3(); - - object.addEventListener( 'removed', onObjectRemoved ); - - } - - var geometry = object.geometry; - - if ( geometry === undefined ) { - - // ImmediateRenderObject - - } else if ( geometry.__webglInit === undefined ) { - - geometry.__webglInit = true; - geometry.addEventListener( 'dispose', onGeometryDispose ); - - if ( geometry instanceof THREE.BufferGeometry ) { - - _this.info.memory.geometries ++; - - } else if ( object instanceof THREE.Mesh ) { - - initGeometryGroups( object, geometry ); - - } else if ( object instanceof THREE.Line ) { - - if ( geometry.__webglVertexBuffer === undefined ) { - - createLineBuffers( geometry ); - initLineBuffers( geometry, object ); - - geometry.verticesNeedUpdate = true; - geometry.colorsNeedUpdate = true; - geometry.lineDistancesNeedUpdate = true; - - } - - } else if ( object instanceof THREE.PointCloud ) { - - if ( geometry.__webglVertexBuffer === undefined ) { - - createParticleBuffers( geometry ); - initParticleBuffers( geometry, object ); - - geometry.verticesNeedUpdate = true; - geometry.colorsNeedUpdate = true; - - } - - } - - } - - if ( object.__webglActive === undefined) { - - object.__webglActive = true; - - if ( object instanceof THREE.Mesh ) { - - if ( geometry instanceof THREE.BufferGeometry ) { - - addBuffer( _webglObjects, geometry, object ); - - } else if ( geometry instanceof THREE.Geometry ) { - - var geometryGroupsList = geometryGroups[ geometry.id ]; - - for ( var i = 0,l = geometryGroupsList.length; i < l; i ++ ) { - - addBuffer( _webglObjects, geometryGroupsList[ i ], object ); - - } - - } - - } else if ( object instanceof THREE.Line || object instanceof THREE.PointCloud ) { - - addBuffer( _webglObjects, geometry, object ); - - } else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) { - - addBufferImmediate( _webglObjectsImmediate, object ); - - } - - } - - } - - // Geometry splitting - - var geometryGroups = {}; - var geometryGroupCounter = 0; - - function makeGroups( geometry, usesFaceMaterial ) { - - var maxVerticesInGroup = extensions.get( 'OES_element_index_uint' ) ? 4294967296 : 65535; - - var groupHash, hash_map = {}; - - var numMorphTargets = geometry.morphTargets.length; - var numMorphNormals = geometry.morphNormals.length; - - var group; - var groups = {}; - var groupsList = []; - - for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) { - - var face = geometry.faces[ f ]; - var materialIndex = usesFaceMaterial ? face.materialIndex : 0; - - if ( ! ( materialIndex in hash_map ) ) { - - hash_map[ materialIndex ] = { hash: materialIndex, counter: 0 }; - - } - - groupHash = hash_map[ materialIndex ].hash + '_' + hash_map[ materialIndex ].counter; - - if ( ! ( groupHash in groups ) ) { - - group = { - id: geometryGroupCounter ++, - faces3: [], - materialIndex: materialIndex, - vertices: 0, - numMorphTargets: numMorphTargets, - numMorphNormals: numMorphNormals - }; - - groups[ groupHash ] = group; - groupsList.push( group ); - - } - - if ( groups[ groupHash ].vertices + 3 > maxVerticesInGroup ) { - - hash_map[ materialIndex ].counter += 1; - groupHash = hash_map[ materialIndex ].hash + '_' + hash_map[ materialIndex ].counter; - - if ( ! ( groupHash in groups ) ) { - - group = { - id: geometryGroupCounter ++, - faces3: [], - materialIndex: materialIndex, - vertices: 0, - numMorphTargets: numMorphTargets, - numMorphNormals: numMorphNormals - }; - - groups[ groupHash ] = group; - groupsList.push( group ); - - } - - } - - groups[ groupHash ].faces3.push( f ); - groups[ groupHash ].vertices += 3; - - } - - return groupsList; - - } - - function initGeometryGroups( object, geometry ) { - - var material = object.material, addBuffers = false; - - if ( geometryGroups[ geometry.id ] === undefined || geometry.groupsNeedUpdate === true ) { - - delete _webglObjects[ object.id ]; - - geometryGroups[ geometry.id ] = makeGroups( geometry, material instanceof THREE.MeshFaceMaterial ); - - geometry.groupsNeedUpdate = false; - - } - - var geometryGroupsList = geometryGroups[ geometry.id ]; - - // create separate VBOs per geometry chunk - - for ( var i = 0, il = geometryGroupsList.length; i < il; i ++ ) { - - var geometryGroup = geometryGroupsList[ i ]; - - // initialise VBO on the first access - - if ( geometryGroup.__webglVertexBuffer === undefined ) { - - createMeshBuffers( geometryGroup ); - initMeshBuffers( geometryGroup, object ); - - geometry.verticesNeedUpdate = true; - geometry.morphTargetsNeedUpdate = true; - geometry.elementsNeedUpdate = true; - geometry.uvsNeedUpdate = true; - geometry.normalsNeedUpdate = true; - geometry.tangentsNeedUpdate = true; - geometry.colorsNeedUpdate = true; - - addBuffers = true; - - } else { - - addBuffers = false; - - } - - if ( addBuffers || object.__webglActive === undefined ) { - - addBuffer( _webglObjects, geometryGroup, object ); - - } - - } - - object.__webglActive = true; - - } - - function addBuffer( objlist, buffer, object ) { - - var id = object.id; - objlist[id] = objlist[id] || []; - objlist[id].push( - { - id: id, - buffer: buffer, - object: object, - material: null, - z: 0 - } - ); - - }; - - function addBufferImmediate( objlist, object ) { - - objlist.push( - { - id: null, - object: object, - opaque: null, - transparent: null, - z: 0 - } - ); - - }; - - // Objects updates - - function updateObject( object ) { - - var geometry = object.geometry; - - if ( geometry instanceof THREE.BufferGeometry ) { - - var attributes = geometry.attributes; - var attributesKeys = geometry.attributesKeys; - - for ( var i = 0, l = attributesKeys.length; i < l; i ++ ) { - - var key = attributesKeys[ i ]; - var attribute = attributes[ key ]; - var bufferType = ( key === 'index' ) ? _gl.ELEMENT_ARRAY_BUFFER : _gl.ARRAY_BUFFER; - - if ( attribute.buffer === undefined ) { - - attribute.buffer = _gl.createBuffer(); - _gl.bindBuffer( bufferType, attribute.buffer ); - _gl.bufferData( bufferType, attribute.array, ( attribute instanceof THREE.DynamicBufferAttribute ) ? _gl.DYNAMIC_DRAW : _gl.STATIC_DRAW ); - - attribute.needsUpdate = false; - - } else if ( attribute.needsUpdate === true ) { - - _gl.bindBuffer( bufferType, attribute.buffer ); - - if ( attribute.updateRange === undefined || attribute.updateRange.count === -1 ) { // Not using update ranges - - _gl.bufferSubData( bufferType, 0, attribute.array ); - - } else if ( attribute.updateRange.count === 0 ) { - - console.error( 'THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually.' ); - - } else { - - _gl.bufferSubData( bufferType, attribute.updateRange.offset * attribute.array.BYTES_PER_ELEMENT, - attribute.array.subarray( attribute.updateRange.offset, attribute.updateRange.offset + attribute.updateRange.count ) ); - - attribute.updateRange.count = 0; // reset range - - } - - attribute.needsUpdate = false; - - } - - } - - } else if ( object instanceof THREE.Mesh ) { - - // check all geometry groups - - if ( geometry.groupsNeedUpdate === true ) { - - initGeometryGroups( object, geometry ); - - } - - var geometryGroupsList = geometryGroups[ geometry.id ]; - - for ( var i = 0, il = geometryGroupsList.length; i < il; i ++ ) { - - var geometryGroup = geometryGroupsList[ i ]; - var material = getBufferMaterial( object, geometryGroup ); - - var customAttributesDirty = material.attributes && areCustomAttributesDirty( material ); - - if ( geometry.verticesNeedUpdate || geometry.morphTargetsNeedUpdate || geometry.elementsNeedUpdate || - geometry.uvsNeedUpdate || geometry.normalsNeedUpdate || - geometry.colorsNeedUpdate || geometry.tangentsNeedUpdate || customAttributesDirty ) { - - setMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW, ! geometry.dynamic, material ); - - } - - } - - geometry.verticesNeedUpdate = false; - geometry.morphTargetsNeedUpdate = false; - geometry.elementsNeedUpdate = false; - geometry.uvsNeedUpdate = false; - geometry.normalsNeedUpdate = false; - geometry.colorsNeedUpdate = false; - geometry.tangentsNeedUpdate = false; - - material.attributes && clearCustomAttributes( material ); - - } else if ( object instanceof THREE.Line ) { - - var material = getBufferMaterial( object, geometry ); - var customAttributesDirty = material.attributes && areCustomAttributesDirty( material ); - - if ( geometry.verticesNeedUpdate || geometry.colorsNeedUpdate || geometry.lineDistancesNeedUpdate || customAttributesDirty ) { - - setLineBuffers( geometry, _gl.DYNAMIC_DRAW ); - - } - - geometry.verticesNeedUpdate = false; - geometry.colorsNeedUpdate = false; - geometry.lineDistancesNeedUpdate = false; - - material.attributes && clearCustomAttributes( material ); - - } else if ( object instanceof THREE.PointCloud ) { - - var material = getBufferMaterial( object, geometry ); - var customAttributesDirty = material.attributes && areCustomAttributesDirty( material ); - - if ( geometry.verticesNeedUpdate || geometry.colorsNeedUpdate || customAttributesDirty ) { - - setParticleBuffers( geometry, _gl.DYNAMIC_DRAW, object ); - - } - - geometry.verticesNeedUpdate = false; - geometry.colorsNeedUpdate = false; - - material.attributes && clearCustomAttributes( material ); - - } - - } - - // Objects updates - custom attributes check - - function areCustomAttributesDirty( material ) { - - for ( var name in material.attributes ) { - - if ( material.attributes[ name ].needsUpdate ) return true; - - } - - return false; - - } - - function clearCustomAttributes( material ) { - - for ( var name in material.attributes ) { - - material.attributes[ name ].needsUpdate = false; - - } - - } - - // Objects removal - - function removeObject( object ) { - - if ( object instanceof THREE.Mesh || - object instanceof THREE.PointCloud || - object instanceof THREE.Line ) { - - delete _webglObjects[ object.id ]; - - } else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) { - - removeInstances( _webglObjectsImmediate, object ); - - } - - delete object.__webglInit; - delete object._modelViewMatrix; - delete object._normalMatrix; - - delete object.__webglActive; - - } - - function removeInstances( objlist, object ) { - - for ( var o = objlist.length - 1; o >= 0; o -- ) { - - if ( objlist[ o ].object === object ) { - - objlist.splice( o, 1 ); - - } - - } - - } - - // Materials - - var shaderIDs = { - MeshDepthMaterial: 'depth', - MeshNormalMaterial: 'normal', - MeshBasicMaterial: 'basic', - MeshLambertMaterial: 'lambert', - MeshPhongMaterial: 'phong', - LineBasicMaterial: 'basic', - LineDashedMaterial: 'dashed', - PointCloudMaterial: 'particle_basic' - }; - - function initMaterial( material, lights, fog, object ) { - - material.addEventListener( 'dispose', onMaterialDispose ); - - var shaderID = shaderIDs[ material.type ]; - - if ( shaderID ) { - - var shader = THREE.ShaderLib[ shaderID ]; - - material.__webglShader = { - uniforms: THREE.UniformsUtils.clone( shader.uniforms ), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader - } - - } else { - - material.__webglShader = { - uniforms: material.uniforms, - vertexShader: material.vertexShader, - fragmentShader: material.fragmentShader - } - - } - - // heuristics to create shader parameters according to lights in the scene - // (not to blow over maxLights budget) - - var maxLightCount = allocateLights( lights ); - var maxShadows = allocateShadows( lights ); - var maxBones = allocateBones( object ); - - var parameters = { - - precision: _precision, - supportsVertexTextures: _supportsVertexTextures, - - map: !! material.map, - envMap: !! material.envMap, - envMapMode: material.envMap && material.envMap.mapping, - lightMap: !! material.lightMap, - bumpMap: !! material.bumpMap, - normalMap: !! material.normalMap, - specularMap: !! material.specularMap, - alphaMap: !! material.alphaMap, - - combine: material.combine, - - vertexColors: material.vertexColors, - - fog: fog, - useFog: material.fog, - fogExp: fog instanceof THREE.FogExp2, - - flatShading: material.shading === THREE.FlatShading, - - sizeAttenuation: material.sizeAttenuation, - logarithmicDepthBuffer: _logarithmicDepthBuffer, - - skinning: material.skinning, - maxBones: maxBones, - useVertexTexture: _supportsBoneTextures && object && object.skeleton && object.skeleton.useVertexTexture, - - morphTargets: material.morphTargets, - morphNormals: material.morphNormals, - maxMorphTargets: _this.maxMorphTargets, - maxMorphNormals: _this.maxMorphNormals, - - maxDirLights: maxLightCount.directional, - maxPointLights: maxLightCount.point, - maxSpotLights: maxLightCount.spot, - maxHemiLights: maxLightCount.hemi, - - maxShadows: maxShadows, - shadowMapEnabled: _this.shadowMapEnabled && object.receiveShadow && maxShadows > 0, - shadowMapType: _this.shadowMapType, - shadowMapDebug: _this.shadowMapDebug, - shadowMapCascade: _this.shadowMapCascade, - - alphaTest: material.alphaTest, - metal: material.metal, - wrapAround: material.wrapAround, - doubleSided: material.side === THREE.DoubleSide, - flipSided: material.side === THREE.BackSide - - }; - - // Generate code - - var chunks = []; - - if ( shaderID ) { - - chunks.push( shaderID ); - - } else { - - chunks.push( material.fragmentShader ); - chunks.push( material.vertexShader ); - - } - - if ( material.defines !== undefined ) { - - for ( var name in material.defines ) { - - chunks.push( name ); - chunks.push( material.defines[ name ] ); - - } - - } - - for ( var name in parameters ) { - - chunks.push( name ); - chunks.push( parameters[ name ] ); - - } - - var code = chunks.join(); - - var program; - - // Check if code has been already compiled - - for ( var p = 0, pl = _programs.length; p < pl; p ++ ) { - - var programInfo = _programs[ p ]; - - if ( programInfo.code === code ) { - - program = programInfo; - program.usedTimes ++; - - break; - - } - - } - - if ( program === undefined ) { - - program = new THREE.WebGLProgram( _this, code, material, parameters ); - _programs.push( program ); - - _this.info.memory.programs = _programs.length; - - } - - material.program = program; - - var attributes = program.attributes; - - if ( material.morphTargets ) { - - material.numSupportedMorphTargets = 0; - - var id, base = 'morphTarget'; - - for ( var i = 0; i < _this.maxMorphTargets; i ++ ) { - - id = base + i; - - if ( attributes[ id ] >= 0 ) { - - material.numSupportedMorphTargets ++; - - } - - } - - } - - if ( material.morphNormals ) { - - material.numSupportedMorphNormals = 0; - - var id, base = 'morphNormal'; - - for ( i = 0; i < _this.maxMorphNormals; i ++ ) { - - id = base + i; - - if ( attributes[ id ] >= 0 ) { - - material.numSupportedMorphNormals ++; - - } - - } - - } - - material.uniformsList = []; - - for ( var u in material.__webglShader.uniforms ) { - - var location = material.program.uniforms[ u ]; - - if ( location ) { - material.uniformsList.push( [ material.__webglShader.uniforms[ u ], location ] ); - } - - } - - } - - function setMaterial( material ) { - - if ( material.transparent === true ) { - - state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha ); - - } else { - - state.setBlending( THREE.NoBlending ); - - } - - state.setDepthTest( material.depthTest ); - state.setDepthWrite( material.depthWrite ); - state.setColorWrite( material.colorWrite ); - state.setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - - } - - function setProgram( camera, lights, fog, material, object ) { - - _usedTextureUnits = 0; - - if ( material.needsUpdate ) { - - if ( material.program ) deallocateMaterial( material ); - - initMaterial( material, lights, fog, object ); - material.needsUpdate = false; - - } - - if ( material.morphTargets ) { - - if ( ! object.__webglMorphTargetInfluences ) { - - object.__webglMorphTargetInfluences = new Float32Array( _this.maxMorphTargets ); - - } - - } - - var refreshProgram = false; - var refreshMaterial = false; - var refreshLights = false; - - var program = material.program, - p_uniforms = program.uniforms, - m_uniforms = material.__webglShader.uniforms; - - if ( program.id !== _currentProgram ) { - - _gl.useProgram( program.program ); - _currentProgram = program.id; - - refreshProgram = true; - refreshMaterial = true; - refreshLights = true; - - } - - if ( material.id !== _currentMaterialId ) { - - if ( _currentMaterialId === -1 ) refreshLights = true; - _currentMaterialId = material.id; - - refreshMaterial = true; - - } - - if ( refreshProgram || camera !== _currentCamera ) { - - _gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, camera.projectionMatrix.elements ); - - if ( _logarithmicDepthBuffer ) { - - _gl.uniform1f( p_uniforms.logDepthBufFC, 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) ); - - } - - - if ( camera !== _currentCamera ) _currentCamera = camera; - - // load material specific uniforms - // (shader material also gets them for the sake of genericity) - - if ( material instanceof THREE.ShaderMaterial || - material instanceof THREE.MeshPhongMaterial || - material.envMap ) { - - if ( p_uniforms.cameraPosition !== null ) { - - _vector3.setFromMatrixPosition( camera.matrixWorld ); - _gl.uniform3f( p_uniforms.cameraPosition, _vector3.x, _vector3.y, _vector3.z ); - - } - - } - - if ( material instanceof THREE.MeshPhongMaterial || - material instanceof THREE.MeshLambertMaterial || - material instanceof THREE.MeshBasicMaterial || - material instanceof THREE.ShaderMaterial || - material.skinning ) { - - if ( p_uniforms.viewMatrix !== null ) { - - _gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, camera.matrixWorldInverse.elements ); - - } - - } - - } - - // skinning uniforms must be set even if material didn't change - // auto-setting of texture unit for bone texture must go before other textures - // not sure why, but otherwise weird things happen - - if ( material.skinning ) { - - if ( object.bindMatrix && p_uniforms.bindMatrix !== null ) { - - _gl.uniformMatrix4fv( p_uniforms.bindMatrix, false, object.bindMatrix.elements ); - - } - - if ( object.bindMatrixInverse && p_uniforms.bindMatrixInverse !== null ) { - - _gl.uniformMatrix4fv( p_uniforms.bindMatrixInverse, false, object.bindMatrixInverse.elements ); - - } - - if ( _supportsBoneTextures && object.skeleton && object.skeleton.useVertexTexture ) { - - if ( p_uniforms.boneTexture !== null ) { - - var textureUnit = getTextureUnit(); - - _gl.uniform1i( p_uniforms.boneTexture, textureUnit ); - _this.setTexture( object.skeleton.boneTexture, textureUnit ); - - } - - if ( p_uniforms.boneTextureWidth !== null ) { - - _gl.uniform1i( p_uniforms.boneTextureWidth, object.skeleton.boneTextureWidth ); - - } - - if ( p_uniforms.boneTextureHeight !== null ) { - - _gl.uniform1i( p_uniforms.boneTextureHeight, object.skeleton.boneTextureHeight ); - - } - - } else if ( object.skeleton && object.skeleton.boneMatrices ) { - - if ( p_uniforms.boneGlobalMatrices !== null ) { - - _gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.skeleton.boneMatrices ); - - } - - } - - } - - if ( refreshMaterial ) { - - // refresh uniforms common to several materials - - if ( fog && material.fog ) { - - refreshUniformsFog( m_uniforms, fog ); - - } - - if ( material instanceof THREE.MeshPhongMaterial || - material instanceof THREE.MeshLambertMaterial || - material.lights ) { - - if ( _lightsNeedUpdate ) { - - refreshLights = true; - setupLights( lights ); - _lightsNeedUpdate = false; - } - - if ( refreshLights ) { - refreshUniformsLights( m_uniforms, _lights ); - markUniformsLightsNeedsUpdate( m_uniforms, true ); - } else { - markUniformsLightsNeedsUpdate( m_uniforms, false ); - } - - } - - if ( material instanceof THREE.MeshBasicMaterial || - material instanceof THREE.MeshLambertMaterial || - material instanceof THREE.MeshPhongMaterial ) { - - refreshUniformsCommon( m_uniforms, material ); - - } - - // refresh single material specific uniforms - - if ( material instanceof THREE.LineBasicMaterial ) { - - refreshUniformsLine( m_uniforms, material ); - - } else if ( material instanceof THREE.LineDashedMaterial ) { - - refreshUniformsLine( m_uniforms, material ); - refreshUniformsDash( m_uniforms, material ); - - } else if ( material instanceof THREE.PointCloudMaterial ) { - - refreshUniformsParticle( m_uniforms, material ); - - } else if ( material instanceof THREE.MeshPhongMaterial ) { - - refreshUniformsPhong( m_uniforms, material ); - - } else if ( material instanceof THREE.MeshLambertMaterial ) { - - refreshUniformsLambert( m_uniforms, material ); - - } else if ( material instanceof THREE.MeshDepthMaterial ) { - - m_uniforms.mNear.value = camera.near; - m_uniforms.mFar.value = camera.far; - m_uniforms.opacity.value = material.opacity; - - } else if ( material instanceof THREE.MeshNormalMaterial ) { - - m_uniforms.opacity.value = material.opacity; - - } - - if ( object.receiveShadow && ! material._shadowPass ) { - - refreshUniformsShadow( m_uniforms, lights ); - - } - - // load common uniforms - - loadUniformsGeneric( material.uniformsList ); - - } - - loadUniformsMatrices( p_uniforms, object ); - - if ( p_uniforms.modelMatrix !== null ) { - - _gl.uniformMatrix4fv( p_uniforms.modelMatrix, false, object.matrixWorld.elements ); - - } - - return program; - - } - - // Uniforms (refresh uniforms objects) - - function refreshUniformsCommon ( uniforms, material ) { - - uniforms.opacity.value = material.opacity; - - uniforms.diffuse.value = material.color; - - uniforms.map.value = material.map; - uniforms.lightMap.value = material.lightMap; - uniforms.specularMap.value = material.specularMap; - uniforms.alphaMap.value = material.alphaMap; - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - - } - - // uv repeat and offset setting priorities - // 1. color map - // 2. specular map - // 3. normal map - // 4. bump map - // 5. alpha map - - var uvScaleMap; - - if ( material.map ) { - - uvScaleMap = material.map; - - } else if ( material.specularMap ) { - - uvScaleMap = material.specularMap; - - } else if ( material.normalMap ) { - - uvScaleMap = material.normalMap; - - } else if ( material.bumpMap ) { - - uvScaleMap = material.bumpMap; - - } else if ( material.alphaMap ) { - - uvScaleMap = material.alphaMap; - - } - - if ( uvScaleMap !== undefined ) { - - var offset = uvScaleMap.offset; - var repeat = uvScaleMap.repeat; - - uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y ); - - } - - uniforms.envMap.value = material.envMap; - uniforms.flipEnvMap.value = ( material.envMap instanceof THREE.WebGLRenderTargetCube ) ? 1 : - 1; - - uniforms.reflectivity.value = material.reflectivity; - uniforms.refractionRatio.value = material.refractionRatio; - - } - - function refreshUniformsLine ( uniforms, material ) { - - uniforms.diffuse.value = material.color; - uniforms.opacity.value = material.opacity; - - } - - function refreshUniformsDash ( uniforms, material ) { - - uniforms.dashSize.value = material.dashSize; - uniforms.totalSize.value = material.dashSize + material.gapSize; - uniforms.scale.value = material.scale; - - } - - function refreshUniformsParticle ( uniforms, material ) { - - uniforms.psColor.value = material.color; - uniforms.opacity.value = material.opacity; - uniforms.size.value = material.size; - uniforms.scale.value = _canvas.height / 2.0; // TODO: Cache this. - - uniforms.map.value = material.map; - - if ( material.map !== null ) { - - var offset = material.map.offset; - var repeat = material.map.repeat; - - uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y ); - - } - - } - - function refreshUniformsFog ( uniforms, fog ) { - - uniforms.fogColor.value = fog.color; - - if ( fog instanceof THREE.Fog ) { - - uniforms.fogNear.value = fog.near; - uniforms.fogFar.value = fog.far; - - } else if ( fog instanceof THREE.FogExp2 ) { - - uniforms.fogDensity.value = fog.density; - - } - - } - - function refreshUniformsPhong ( uniforms, material ) { - - uniforms.shininess.value = material.shininess; - - uniforms.emissive.value = material.emissive; - uniforms.specular.value = material.specular; - - if ( material.wrapAround ) { - - uniforms.wrapRGB.value.copy( material.wrapRGB ); - - } - - } - - function refreshUniformsLambert ( uniforms, material ) { - - uniforms.emissive.value = material.emissive; - - if ( material.wrapAround ) { - - uniforms.wrapRGB.value.copy( material.wrapRGB ); - - } - - } - - function refreshUniformsLights ( uniforms, lights ) { - - uniforms.ambientLightColor.value = lights.ambient; - - uniforms.directionalLightColor.value = lights.directional.colors; - uniforms.directionalLightDirection.value = lights.directional.positions; - - uniforms.pointLightColor.value = lights.point.colors; - uniforms.pointLightPosition.value = lights.point.positions; - uniforms.pointLightDistance.value = lights.point.distances; - uniforms.pointLightDecay.value = lights.point.decays; - - uniforms.spotLightColor.value = lights.spot.colors; - uniforms.spotLightPosition.value = lights.spot.positions; - uniforms.spotLightDistance.value = lights.spot.distances; - uniforms.spotLightDirection.value = lights.spot.directions; - uniforms.spotLightAngleCos.value = lights.spot.anglesCos; - uniforms.spotLightExponent.value = lights.spot.exponents; - uniforms.spotLightDecay.value = lights.spot.decays; - - uniforms.hemisphereLightSkyColor.value = lights.hemi.skyColors; - uniforms.hemisphereLightGroundColor.value = lights.hemi.groundColors; - uniforms.hemisphereLightDirection.value = lights.hemi.positions; - - } - - // If uniforms are marked as clean, they don't need to be loaded to the GPU. - - function markUniformsLightsNeedsUpdate ( uniforms, value ) { - - uniforms.ambientLightColor.needsUpdate = value; - - uniforms.directionalLightColor.needsUpdate = value; - uniforms.directionalLightDirection.needsUpdate = value; - - uniforms.pointLightColor.needsUpdate = value; - uniforms.pointLightPosition.needsUpdate = value; - uniforms.pointLightDistance.needsUpdate = value; - uniforms.pointLightDecay.needsUpdate = value; - - uniforms.spotLightColor.needsUpdate = value; - uniforms.spotLightPosition.needsUpdate = value; - uniforms.spotLightDistance.needsUpdate = value; - uniforms.spotLightDirection.needsUpdate = value; - uniforms.spotLightAngleCos.needsUpdate = value; - uniforms.spotLightExponent.needsUpdate = value; - uniforms.spotLightDecay.needsUpdate = value; - - uniforms.hemisphereLightSkyColor.needsUpdate = value; - uniforms.hemisphereLightGroundColor.needsUpdate = value; - uniforms.hemisphereLightDirection.needsUpdate = value; - - } - - function refreshUniformsShadow ( uniforms, lights ) { - - if ( uniforms.shadowMatrix ) { - - var j = 0; - - for ( var i = 0, il = lights.length; i < il; i ++ ) { - - var light = lights[ i ]; - - if ( ! light.castShadow ) continue; - - if ( light instanceof THREE.SpotLight || ( light instanceof THREE.DirectionalLight && ! light.shadowCascade ) ) { - - uniforms.shadowMap.value[ j ] = light.shadowMap; - uniforms.shadowMapSize.value[ j ] = light.shadowMapSize; - - uniforms.shadowMatrix.value[ j ] = light.shadowMatrix; - - uniforms.shadowDarkness.value[ j ] = light.shadowDarkness; - uniforms.shadowBias.value[ j ] = light.shadowBias; - - j ++; - - } - - } - - } - - } - - // Uniforms (load to GPU) - - function loadUniformsMatrices ( uniforms, object ) { - - _gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrix.elements ); - - if ( uniforms.normalMatrix ) { - - _gl.uniformMatrix3fv( uniforms.normalMatrix, false, object._normalMatrix.elements ); - - } - - } - - function getTextureUnit() { - - var textureUnit = _usedTextureUnits; - - if ( textureUnit >= _maxTextures ) { - - THREE.warn( 'WebGLRenderer: trying to use ' + textureUnit + ' texture units while this GPU supports only ' + _maxTextures ); - - } - - _usedTextureUnits += 1; - - return textureUnit; - - } - - function loadUniformsGeneric ( uniforms ) { - - var texture, textureUnit, offset; - - for ( var j = 0, jl = uniforms.length; j < jl; j ++ ) { - - var uniform = uniforms[ j ][ 0 ]; - - // needsUpdate property is not added to all uniforms. - if ( uniform.needsUpdate === false ) continue; - - var type = uniform.type; - var value = uniform.value; - var location = uniforms[ j ][ 1 ]; - - switch ( type ) { - - case '1i': - _gl.uniform1i( location, value ); - break; - - case '1f': - _gl.uniform1f( location, value ); - break; - - case '2f': - _gl.uniform2f( location, value[ 0 ], value[ 1 ] ); - break; - - case '3f': - _gl.uniform3f( location, value[ 0 ], value[ 1 ], value[ 2 ] ); - break; - - case '4f': - _gl.uniform4f( location, value[ 0 ], value[ 1 ], value[ 2 ], value[ 3 ] ); - break; - - case '1iv': - _gl.uniform1iv( location, value ); - break; - - case '3iv': - _gl.uniform3iv( location, value ); - break; - - case '1fv': - _gl.uniform1fv( location, value ); - break; - - case '2fv': - _gl.uniform2fv( location, value ); - break; - - case '3fv': - _gl.uniform3fv( location, value ); - break; - - case '4fv': - _gl.uniform4fv( location, value ); - break; - - case 'Matrix3fv': - _gl.uniformMatrix3fv( location, false, value ); - break; - - case 'Matrix4fv': - _gl.uniformMatrix4fv( location, false, value ); - break; - - // - - case 'i': - - // single integer - _gl.uniform1i( location, value ); - - break; - - case 'f': - - // single float - _gl.uniform1f( location, value ); - - break; - - case 'v2': - - // single THREE.Vector2 - _gl.uniform2f( location, value.x, value.y ); - - break; - - case 'v3': - - // single THREE.Vector3 - _gl.uniform3f( location, value.x, value.y, value.z ); - - break; - - case 'v4': - - // single THREE.Vector4 - _gl.uniform4f( location, value.x, value.y, value.z, value.w ); - - break; - - case 'c': - - // single THREE.Color - _gl.uniform3f( location, value.r, value.g, value.b ); - - break; - - case 'iv1': - - // flat array of integers (JS or typed array) - _gl.uniform1iv( location, value ); - - break; - - case 'iv': - - // flat array of integers with 3 x N size (JS or typed array) - _gl.uniform3iv( location, value ); - - break; - - case 'fv1': - - // flat array of floats (JS or typed array) - _gl.uniform1fv( location, value ); - - break; - - case 'fv': - - // flat array of floats with 3 x N size (JS or typed array) - _gl.uniform3fv( location, value ); - - break; - - case 'v2v': - - // array of THREE.Vector2 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 2 * value.length ); - - } - - for ( var i = 0, il = value.length; i < il; i ++ ) { - - offset = i * 2; - - uniform._array[ offset ] = value[ i ].x; - uniform._array[ offset + 1 ] = value[ i ].y; - - } - - _gl.uniform2fv( location, uniform._array ); - - break; - - case 'v3v': - - // array of THREE.Vector3 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 3 * value.length ); - - } - - for ( var i = 0, il = value.length; i < il; i ++ ) { - - offset = i * 3; - - uniform._array[ offset ] = value[ i ].x; - uniform._array[ offset + 1 ] = value[ i ].y; - uniform._array[ offset + 2 ] = value[ i ].z; - - } - - _gl.uniform3fv( location, uniform._array ); - - break; - - case 'v4v': - - // array of THREE.Vector4 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 4 * value.length ); - - } - - for ( var i = 0, il = value.length; i < il; i ++ ) { - - offset = i * 4; - - uniform._array[ offset ] = value[ i ].x; - uniform._array[ offset + 1 ] = value[ i ].y; - uniform._array[ offset + 2 ] = value[ i ].z; - uniform._array[ offset + 3 ] = value[ i ].w; - - } - - _gl.uniform4fv( location, uniform._array ); - - break; - - case 'm3': - - // single THREE.Matrix3 - _gl.uniformMatrix3fv( location, false, value.elements ); - - break; - - case 'm3v': - - // array of THREE.Matrix3 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 9 * value.length ); - - } - - for ( var i = 0, il = value.length; i < il; i ++ ) { - - value[ i ].flattenToArrayOffset( uniform._array, i * 9 ); - - } - - _gl.uniformMatrix3fv( location, false, uniform._array ); - - break; - - case 'm4': - - // single THREE.Matrix4 - _gl.uniformMatrix4fv( location, false, value.elements ); - - break; - - case 'm4v': - - // array of THREE.Matrix4 - - if ( uniform._array === undefined ) { - - uniform._array = new Float32Array( 16 * value.length ); - - } - - for ( var i = 0, il = value.length; i < il; i ++ ) { - - value[ i ].flattenToArrayOffset( uniform._array, i * 16 ); - - } - - _gl.uniformMatrix4fv( location, false, uniform._array ); - - break; - - case 't': - - // single THREE.Texture (2d or cube) - - texture = value; - textureUnit = getTextureUnit(); - - _gl.uniform1i( location, textureUnit ); - - if ( ! texture ) continue; - - if ( texture instanceof THREE.CubeTexture || - ( texture.image instanceof Array && texture.image.length === 6 ) ) { // CompressedTexture can have Array in image :/ - - setCubeTexture( texture, textureUnit ); - - } else if ( texture instanceof THREE.WebGLRenderTargetCube ) { - - setCubeTextureDynamic( texture, textureUnit ); - - } else { - - _this.setTexture( texture, textureUnit ); - - } - - break; - - case 'tv': - - // array of THREE.Texture (2d) - - if ( uniform._array === undefined ) { - - uniform._array = []; - - } - - for ( var i = 0, il = uniform.value.length; i < il; i ++ ) { - - uniform._array[ i ] = getTextureUnit(); - - } - - _gl.uniform1iv( location, uniform._array ); - - for ( var i = 0, il = uniform.value.length; i < il; i ++ ) { - - texture = uniform.value[ i ]; - textureUnit = uniform._array[ i ]; - - if ( ! texture ) continue; - - _this.setTexture( texture, textureUnit ); - - } - - break; - - default: - - THREE.warn( 'THREE.WebGLRenderer: Unknown uniform type: ' + type ); - - } - - } - - } - - function setupMatrices ( object, camera ) { - - object._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); - object._normalMatrix.getNormalMatrix( object._modelViewMatrix ); - - } - - function setColorLinear( array, offset, color, intensity ) { - - array[ offset ] = color.r * intensity; - array[ offset + 1 ] = color.g * intensity; - array[ offset + 2 ] = color.b * intensity; - - } - - function setupLights ( lights ) { - - var l, ll, light, - r = 0, g = 0, b = 0, - color, skyColor, groundColor, - intensity, - distance, - - zlights = _lights, - - dirColors = zlights.directional.colors, - dirPositions = zlights.directional.positions, - - pointColors = zlights.point.colors, - pointPositions = zlights.point.positions, - pointDistances = zlights.point.distances, - pointDecays = zlights.point.decays, - - spotColors = zlights.spot.colors, - spotPositions = zlights.spot.positions, - spotDistances = zlights.spot.distances, - spotDirections = zlights.spot.directions, - spotAnglesCos = zlights.spot.anglesCos, - spotExponents = zlights.spot.exponents, - spotDecays = zlights.spot.decays, - - hemiSkyColors = zlights.hemi.skyColors, - hemiGroundColors = zlights.hemi.groundColors, - hemiPositions = zlights.hemi.positions, - - dirLength = 0, - pointLength = 0, - spotLength = 0, - hemiLength = 0, - - dirCount = 0, - pointCount = 0, - spotCount = 0, - hemiCount = 0, - - dirOffset = 0, - pointOffset = 0, - spotOffset = 0, - hemiOffset = 0; - - for ( l = 0, ll = lights.length; l < ll; l ++ ) { - - light = lights[ l ]; - - if ( light.onlyShadow ) continue; - - color = light.color; - intensity = light.intensity; - distance = light.distance; - - if ( light instanceof THREE.AmbientLight ) { - - if ( ! light.visible ) continue; - - r += color.r; - g += color.g; - b += color.b; - - } else if ( light instanceof THREE.DirectionalLight ) { - - dirCount += 1; - - if ( ! light.visible ) continue; - - _direction.setFromMatrixPosition( light.matrixWorld ); - _vector3.setFromMatrixPosition( light.target.matrixWorld ); - _direction.sub( _vector3 ); - _direction.normalize(); - - dirOffset = dirLength * 3; - - dirPositions[ dirOffset ] = _direction.x; - dirPositions[ dirOffset + 1 ] = _direction.y; - dirPositions[ dirOffset + 2 ] = _direction.z; - - setColorLinear( dirColors, dirOffset, color, intensity ); - - dirLength += 1; - - } else if ( light instanceof THREE.PointLight ) { - - pointCount += 1; - - if ( ! light.visible ) continue; - - pointOffset = pointLength * 3; - - setColorLinear( pointColors, pointOffset, color, intensity ); - - _vector3.setFromMatrixPosition( light.matrixWorld ); - - pointPositions[ pointOffset ] = _vector3.x; - pointPositions[ pointOffset + 1 ] = _vector3.y; - pointPositions[ pointOffset + 2 ] = _vector3.z; - - // distance is 0 if decay is 0, because there is no attenuation at all. - pointDistances[ pointLength ] = distance; - pointDecays[ pointLength ] = ( light.distance === 0 ) ? 0.0 : light.decay; - - pointLength += 1; - - } else if ( light instanceof THREE.SpotLight ) { - - spotCount += 1; - - if ( ! light.visible ) continue; - - spotOffset = spotLength * 3; - - setColorLinear( spotColors, spotOffset, color, intensity ); - - _direction.setFromMatrixPosition( light.matrixWorld ); - - spotPositions[ spotOffset ] = _direction.x; - spotPositions[ spotOffset + 1 ] = _direction.y; - spotPositions[ spotOffset + 2 ] = _direction.z; - - spotDistances[ spotLength ] = distance; - - _vector3.setFromMatrixPosition( light.target.matrixWorld ); - _direction.sub( _vector3 ); - _direction.normalize(); - - spotDirections[ spotOffset ] = _direction.x; - spotDirections[ spotOffset + 1 ] = _direction.y; - spotDirections[ spotOffset + 2 ] = _direction.z; - - spotAnglesCos[ spotLength ] = Math.cos( light.angle ); - spotExponents[ spotLength ] = light.exponent; - spotDecays[ spotLength ] = ( light.distance === 0 ) ? 0.0 : light.decay; - - spotLength += 1; - - } else if ( light instanceof THREE.HemisphereLight ) { - - hemiCount += 1; - - if ( ! light.visible ) continue; - - _direction.setFromMatrixPosition( light.matrixWorld ); - _direction.normalize(); - - hemiOffset = hemiLength * 3; - - hemiPositions[ hemiOffset ] = _direction.x; - hemiPositions[ hemiOffset + 1 ] = _direction.y; - hemiPositions[ hemiOffset + 2 ] = _direction.z; - - skyColor = light.color; - groundColor = light.groundColor; - - setColorLinear( hemiSkyColors, hemiOffset, skyColor, intensity ); - setColorLinear( hemiGroundColors, hemiOffset, groundColor, intensity ); - - hemiLength += 1; - - } - - } - - // null eventual remains from removed lights - // (this is to avoid if in shader) - - for ( l = dirLength * 3, ll = Math.max( dirColors.length, dirCount * 3 ); l < ll; l ++ ) dirColors[ l ] = 0.0; - for ( l = pointLength * 3, ll = Math.max( pointColors.length, pointCount * 3 ); l < ll; l ++ ) pointColors[ l ] = 0.0; - for ( l = spotLength * 3, ll = Math.max( spotColors.length, spotCount * 3 ); l < ll; l ++ ) spotColors[ l ] = 0.0; - for ( l = hemiLength * 3, ll = Math.max( hemiSkyColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiSkyColors[ l ] = 0.0; - for ( l = hemiLength * 3, ll = Math.max( hemiGroundColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiGroundColors[ l ] = 0.0; - - zlights.directional.length = dirLength; - zlights.point.length = pointLength; - zlights.spot.length = spotLength; - zlights.hemi.length = hemiLength; - - zlights.ambient[ 0 ] = r; - zlights.ambient[ 1 ] = g; - zlights.ambient[ 2 ] = b; - - } - - // GL state setting - - this.setFaceCulling = function ( cullFace, frontFaceDirection ) { - - if ( cullFace === THREE.CullFaceNone ) { - - _gl.disable( _gl.CULL_FACE ); - - } else { - - if ( frontFaceDirection === THREE.FrontFaceDirectionCW ) { - - _gl.frontFace( _gl.CW ); - - } else { - - _gl.frontFace( _gl.CCW ); - - } - - if ( cullFace === THREE.CullFaceBack ) { - - _gl.cullFace( _gl.BACK ); - - } else if ( cullFace === THREE.CullFaceFront ) { - - _gl.cullFace( _gl.FRONT ); - - } else { - - _gl.cullFace( _gl.FRONT_AND_BACK ); - - } - - _gl.enable( _gl.CULL_FACE ); - - } - - }; - - this.setMaterialFaces = function ( material ) { - - state.setDoubleSided( material.side === THREE.DoubleSide ); - state.setFlipSided( material.side === THREE.BackSide ); - - }; - - // Textures - - function setTextureParameters ( textureType, texture, isImagePowerOfTwo ) { - - var extension; - - if ( isImagePowerOfTwo ) { - - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) ); - - _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) ); - - } else { - - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); - - if ( texture.wrapS !== THREE.ClampToEdgeWrapping || texture.wrapT !== THREE.ClampToEdgeWrapping ) { - - THREE.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( ' + texture.sourceFile + ' )' ); - - } - - _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) ); - - if ( texture.minFilter !== THREE.NearestFilter && texture.minFilter !== THREE.LinearFilter ) { - - THREE.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( ' + texture.sourceFile + ' )' ); - - } - - } - - extension = extensions.get( 'EXT_texture_filter_anisotropic' ); - - if ( extension && texture.type !== THREE.FloatType && texture.type !== THREE.HalfFloatType ) { - - if ( texture.anisotropy > 1 || texture.__currentAnisotropy ) { - - _gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, _this.getMaxAnisotropy() ) ); - texture.__currentAnisotropy = texture.anisotropy; - - } - - } - - } - - this.uploadTexture = function ( texture ) { - - if ( texture.__webglInit === undefined ) { - - texture.__webglInit = true; - - texture.addEventListener( 'dispose', onTextureDispose ); - - texture.__webglTexture = _gl.createTexture(); - - _this.info.memory.textures ++; - - } - - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); - - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); - _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment ); - - texture.image = clampToMaxSize( texture.image, _maxTextureSize ); - - var image = texture.image, - isImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); - - setTextureParameters( _gl.TEXTURE_2D, texture, isImagePowerOfTwo ); - - var mipmap, mipmaps = texture.mipmaps; - - if ( texture instanceof THREE.DataTexture ) { - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isImagePowerOfTwo ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - texture.generateMipmaps = false; - - } else { - - _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, image.width, image.height, 0, glFormat, glType, image.data ); - - } - - } else if ( texture instanceof THREE.CompressedTexture ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - - if ( texture.format !== THREE.RGBAFormat && texture.format !== THREE.RGBFormat ) { - - if ( getCompressedTextureFormats().indexOf( glFormat ) > -1 ) { - - _gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - - THREE.warn( "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()" ); - - } - - } else { - - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - } - - } else { // regular Texture (image, video, canvas) - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isImagePowerOfTwo ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, glFormat, glType, mipmap ); - - } - - texture.generateMipmaps = false; - - } else { - - _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, glFormat, glType, texture.image ); - - } - - } - - if ( texture.generateMipmaps && isImagePowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D ); - - texture.needsUpdate = false; - - if ( texture.onUpdate ) texture.onUpdate(); - - }; - - this.setTexture = function ( texture, slot ) { - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - - if ( texture.needsUpdate ) { - - _this.uploadTexture( texture ); - - } else { - - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); - - } - - }; - - function clampToMaxSize ( image, maxSize ) { - - if ( image.width > maxSize || image.height > maxSize ) { - - // Warning: Scaling through the canvas will only work with images that use - // premultiplied alpha. - - var scale = maxSize / Math.max( image.width, image.height ); - - var canvas = document.createElement( 'canvas' ); - canvas.width = Math.floor( image.width * scale ); - canvas.height = Math.floor( image.height * scale ); - - var context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height ); - - THREE.warn( 'THREE.WebGLRenderer: image is too big (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image ); - - return canvas; - - } - - return image; - - } - - function setCubeTexture ( texture, slot ) { - - if ( texture.image.length === 6 ) { - - if ( texture.needsUpdate ) { - - if ( ! texture.image.__webglTextureCube ) { - - texture.addEventListener( 'dispose', onTextureDispose ); - - texture.image.__webglTextureCube = _gl.createTexture(); - - _this.info.memory.textures ++; - - } - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube ); - - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - - var isCompressed = texture instanceof THREE.CompressedTexture; - var isDataTexture = texture.image[ 0 ] instanceof THREE.DataTexture; - - var cubeImage = []; - - for ( var i = 0; i < 6; i ++ ) { - - if ( _this.autoScaleCubemaps && ! isCompressed && ! isDataTexture ) { - - cubeImage[ i ] = clampToMaxSize( texture.image[ i ], _maxCubemapSize ); - - } else { - - cubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ]; - - } - - } - - var image = cubeImage[ 0 ], - isImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); - - setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, isImagePowerOfTwo ); - - for ( var i = 0; i < 6; i ++ ) { - - if ( ! isCompressed ) { - - if ( isDataTexture ) { - - _gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data ); - - } else { - - _gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] ); - - } - - } else { - - var mipmap, mipmaps = cubeImage[ i ].mipmaps; - - for ( var j = 0, jl = mipmaps.length; j < jl; j ++ ) { - - mipmap = mipmaps[ j ]; - - if ( texture.format !== THREE.RGBAFormat && texture.format !== THREE.RGBFormat ) { - - if ( getCompressedTextureFormats().indexOf( glFormat ) > -1 ) { - - _gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - - THREE.warn( "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()" ); - - } - - } else { - - _gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - } - - } - - } - - if ( texture.generateMipmaps && isImagePowerOfTwo ) { - - _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - - } - - texture.needsUpdate = false; - - if ( texture.onUpdate ) texture.onUpdate(); - - } else { - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube ); - - } - - } - - } - - function setCubeTextureDynamic ( texture, slot ) { - - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.__webglTexture ); - - } - - // Render targets - - function setupFrameBuffer ( framebuffer, renderTarget, textureTarget ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureTarget, renderTarget.__webglTexture, 0 ); - - } - - function setupRenderBuffer ( renderbuffer, renderTarget ) { - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer ); - - if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_COMPONENT16, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - - /* For some reason this is not working. Defaulting to RGBA4. - } else if ( ! renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.STENCIL_INDEX8, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - */ - } else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - - } else { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.RGBA4, renderTarget.width, renderTarget.height ); - - } - - } - - this.setRenderTarget = function ( renderTarget ) { - - var isCube = ( renderTarget instanceof THREE.WebGLRenderTargetCube ); - - if ( renderTarget && renderTarget.__webglFramebuffer === undefined ) { - - if ( renderTarget.depthBuffer === undefined ) renderTarget.depthBuffer = true; - if ( renderTarget.stencilBuffer === undefined ) renderTarget.stencilBuffer = true; - - renderTarget.addEventListener( 'dispose', onRenderTargetDispose ); - - renderTarget.__webglTexture = _gl.createTexture(); - - _this.info.memory.textures ++; - - // Setup texture, create render and frame buffers - - var isTargetPowerOfTwo = THREE.Math.isPowerOfTwo( renderTarget.width ) && THREE.Math.isPowerOfTwo( renderTarget.height ), - glFormat = paramThreeToGL( renderTarget.format ), - glType = paramThreeToGL( renderTarget.type ); - - if ( isCube ) { - - renderTarget.__webglFramebuffer = []; - renderTarget.__webglRenderbuffer = []; - - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture ); - setTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget, isTargetPowerOfTwo ); - - for ( var i = 0; i < 6; i ++ ) { - - renderTarget.__webglFramebuffer[ i ] = _gl.createFramebuffer(); - renderTarget.__webglRenderbuffer[ i ] = _gl.createRenderbuffer(); - - _gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null ); - - setupFrameBuffer( renderTarget.__webglFramebuffer[ i ], renderTarget, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i ); - setupRenderBuffer( renderTarget.__webglRenderbuffer[ i ], renderTarget ); - - } - - if ( isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - - } else { - - renderTarget.__webglFramebuffer = _gl.createFramebuffer(); - - if ( renderTarget.shareDepthFrom ) { - - renderTarget.__webglRenderbuffer = renderTarget.shareDepthFrom.__webglRenderbuffer; - - } else { - - renderTarget.__webglRenderbuffer = _gl.createRenderbuffer(); - - } - - _gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture ); - setTextureParameters( _gl.TEXTURE_2D, renderTarget, isTargetPowerOfTwo ); - - _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null ); - - setupFrameBuffer( renderTarget.__webglFramebuffer, renderTarget, _gl.TEXTURE_2D ); - - if ( renderTarget.shareDepthFrom ) { - - if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) { - - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderTarget.__webglRenderbuffer ); - - } else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderTarget.__webglRenderbuffer ); - - } - - } else { - - setupRenderBuffer( renderTarget.__webglRenderbuffer, renderTarget ); - - } - - if ( isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D ); - - } - - // Release everything - - if ( isCube ) { - - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); - - } else { - - _gl.bindTexture( _gl.TEXTURE_2D, null ); - - } - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, null ); - _gl.bindFramebuffer( _gl.FRAMEBUFFER, null ); - - } - - var framebuffer, width, height, vx, vy; - - if ( renderTarget ) { - - if ( isCube ) { - - framebuffer = renderTarget.__webglFramebuffer[ renderTarget.activeCubeFace ]; - - } else { - - framebuffer = renderTarget.__webglFramebuffer; - - } - - width = renderTarget.width; - height = renderTarget.height; - - vx = 0; - vy = 0; - - } else { - - framebuffer = null; - - width = _viewportWidth; - height = _viewportHeight; - - vx = _viewportX; - vy = _viewportY; - - } - - if ( framebuffer !== _currentFramebuffer ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - _gl.viewport( vx, vy, width, height ); - - _currentFramebuffer = framebuffer; - - } - - _currentWidth = width; - _currentHeight = height; - - }; - - this.readRenderTargetPixels = function( renderTarget, x, y, width, height, buffer ) { - - if ( ! ( renderTarget instanceof THREE.WebGLRenderTarget ) ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' ); - return; - - } - - if ( renderTarget.__webglFramebuffer ) { - - if ( renderTarget.format !== THREE.RGBAFormat ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.' ); - return; - - } - - var restore = false; - - if ( renderTarget.__webglFramebuffer !== _currentFramebuffer ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTarget.__webglFramebuffer ); - - restore = true; - - } - - if ( _gl.checkFramebufferStatus( _gl.FRAMEBUFFER ) === _gl.FRAMEBUFFER_COMPLETE ) { - - _gl.readPixels( x, y, width, height, _gl.RGBA, _gl.UNSIGNED_BYTE, buffer ); - - } else { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' ); - - } - - if ( restore ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, _currentFramebuffer ); - - } - - } - - }; - - function updateRenderTargetMipmap ( renderTarget ) { - - if ( renderTarget instanceof THREE.WebGLRenderTargetCube ) { - - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture ); - _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); - - } else { - - _gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture ); - _gl.generateMipmap( _gl.TEXTURE_2D ); - _gl.bindTexture( _gl.TEXTURE_2D, null ); - - } - - } - - // Fallback filters for non-power-of-2 textures - - function filterFallback ( f ) { - - if ( f === THREE.NearestFilter || f === THREE.NearestMipMapNearestFilter || f === THREE.NearestMipMapLinearFilter ) { - - return _gl.NEAREST; - - } - - return _gl.LINEAR; - - } - - // Map three.js constants to WebGL constants - - function paramThreeToGL ( p ) { - - var extension; - - if ( p === THREE.RepeatWrapping ) return _gl.REPEAT; - if ( p === THREE.ClampToEdgeWrapping ) return _gl.CLAMP_TO_EDGE; - if ( p === THREE.MirroredRepeatWrapping ) return _gl.MIRRORED_REPEAT; - - if ( p === THREE.NearestFilter ) return _gl.NEAREST; - if ( p === THREE.NearestMipMapNearestFilter ) return _gl.NEAREST_MIPMAP_NEAREST; - if ( p === THREE.NearestMipMapLinearFilter ) return _gl.NEAREST_MIPMAP_LINEAR; - - if ( p === THREE.LinearFilter ) return _gl.LINEAR; - if ( p === THREE.LinearMipMapNearestFilter ) return _gl.LINEAR_MIPMAP_NEAREST; - if ( p === THREE.LinearMipMapLinearFilter ) return _gl.LINEAR_MIPMAP_LINEAR; - - if ( p === THREE.UnsignedByteType ) return _gl.UNSIGNED_BYTE; - if ( p === THREE.UnsignedShort4444Type ) return _gl.UNSIGNED_SHORT_4_4_4_4; - if ( p === THREE.UnsignedShort5551Type ) return _gl.UNSIGNED_SHORT_5_5_5_1; - if ( p === THREE.UnsignedShort565Type ) return _gl.UNSIGNED_SHORT_5_6_5; - - if ( p === THREE.ByteType ) return _gl.BYTE; - if ( p === THREE.ShortType ) return _gl.SHORT; - if ( p === THREE.UnsignedShortType ) return _gl.UNSIGNED_SHORT; - if ( p === THREE.IntType ) return _gl.INT; - if ( p === THREE.UnsignedIntType ) return _gl.UNSIGNED_INT; - if ( p === THREE.FloatType ) return _gl.FLOAT; - - extension = extensions.get( 'OES_texture_half_float' ); - - if ( extension !== null ) { - - if ( p === THREE.HalfFloatType ) return extension.HALF_FLOAT_OES; - - } - - if ( p === THREE.AlphaFormat ) return _gl.ALPHA; - if ( p === THREE.RGBFormat ) return _gl.RGB; - if ( p === THREE.RGBAFormat ) return _gl.RGBA; - if ( p === THREE.LuminanceFormat ) return _gl.LUMINANCE; - if ( p === THREE.LuminanceAlphaFormat ) return _gl.LUMINANCE_ALPHA; - - if ( p === THREE.AddEquation ) return _gl.FUNC_ADD; - if ( p === THREE.SubtractEquation ) return _gl.FUNC_SUBTRACT; - if ( p === THREE.ReverseSubtractEquation ) return _gl.FUNC_REVERSE_SUBTRACT; - - if ( p === THREE.ZeroFactor ) return _gl.ZERO; - if ( p === THREE.OneFactor ) return _gl.ONE; - if ( p === THREE.SrcColorFactor ) return _gl.SRC_COLOR; - if ( p === THREE.OneMinusSrcColorFactor ) return _gl.ONE_MINUS_SRC_COLOR; - if ( p === THREE.SrcAlphaFactor ) return _gl.SRC_ALPHA; - if ( p === THREE.OneMinusSrcAlphaFactor ) return _gl.ONE_MINUS_SRC_ALPHA; - if ( p === THREE.DstAlphaFactor ) return _gl.DST_ALPHA; - if ( p === THREE.OneMinusDstAlphaFactor ) return _gl.ONE_MINUS_DST_ALPHA; - - if ( p === THREE.DstColorFactor ) return _gl.DST_COLOR; - if ( p === THREE.OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR; - if ( p === THREE.SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE; - - extension = extensions.get( 'WEBGL_compressed_texture_s3tc' ); - - if ( extension !== null ) { - - if ( p === THREE.RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; - if ( p === THREE.RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if ( p === THREE.RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if ( p === THREE.RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT; - - } - - extension = extensions.get( 'WEBGL_compressed_texture_pvrtc' ); - - if ( extension !== null ) { - - if ( p === THREE.RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if ( p === THREE.RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if ( p === THREE.RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if ( p === THREE.RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - - } - - extension = extensions.get( 'EXT_blend_minmax' ); - - if ( extension !== null ) { - - if ( p === THREE.MinEquation ) return extension.MIN_EXT; - if ( p === THREE.MaxEquation ) return extension.MAX_EXT; - - } - - return 0; - - } - - // Allocations - - function allocateBones ( object ) { - - if ( _supportsBoneTextures && object && object.skeleton && object.skeleton.useVertexTexture ) { - - return 1024; - - } else { - - // default for when object is not specified - // ( for example when prebuilding shader - // to be used with multiple objects ) - // - // - leave some extra space for other uniforms - // - limit here is ANGLE's 254 max uniform vectors - // (up to 54 should be safe) - - var nVertexUniforms = _gl.getParameter( _gl.MAX_VERTEX_UNIFORM_VECTORS ); - var nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 ); - - var maxBones = nVertexMatrices; - - if ( object !== undefined && object instanceof THREE.SkinnedMesh ) { - - maxBones = Math.min( object.skeleton.bones.length, maxBones ); - - if ( maxBones < object.skeleton.bones.length ) { - - THREE.warn( 'WebGLRenderer: too many bones - ' + object.skeleton.bones.length + ', this GPU supports just ' + maxBones + ' (try OpenGL instead of ANGLE)' ); - - } - - } - - return maxBones; - - } - - } - - function allocateLights( lights ) { - - var dirLights = 0; - var pointLights = 0; - var spotLights = 0; - var hemiLights = 0; - - for ( var l = 0, ll = lights.length; l < ll; l ++ ) { - - var light = lights[ l ]; - - if ( light.onlyShadow || light.visible === false ) continue; - - if ( light instanceof THREE.DirectionalLight ) dirLights ++; - if ( light instanceof THREE.PointLight ) pointLights ++; - if ( light instanceof THREE.SpotLight ) spotLights ++; - if ( light instanceof THREE.HemisphereLight ) hemiLights ++; - - } - - return { 'directional': dirLights, 'point': pointLights, 'spot': spotLights, 'hemi': hemiLights }; - - } - - function allocateShadows( lights ) { - - var maxShadows = 0; - - for ( var l = 0, ll = lights.length; l < ll; l ++ ) { - - var light = lights[ l ]; - - if ( ! light.castShadow ) continue; - - if ( light instanceof THREE.SpotLight ) maxShadows ++; - if ( light instanceof THREE.DirectionalLight && ! light.shadowCascade ) maxShadows ++; - - } - - return maxShadows; - - } - - // DEPRECATED - - this.initMaterial = function () { - - THREE.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' ); - - }; - - this.addPrePlugin = function () { - - THREE.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' ); - - }; - - this.addPostPlugin = function () { - - THREE.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' ); - - }; - - this.updateShadowMap = function () { - - THREE.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' ); - - }; - -}; - -// File:src/renderers/WebGLRenderTarget.js - -/** - * @author szimek / https://github.com/szimek/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.WebGLRenderTarget = function ( width, height, options ) { - - this.width = width; - this.height = height; - - options = options || {}; - - this.wrapS = options.wrapS !== undefined ? options.wrapS : THREE.ClampToEdgeWrapping; - this.wrapT = options.wrapT !== undefined ? options.wrapT : THREE.ClampToEdgeWrapping; - - this.magFilter = options.magFilter !== undefined ? options.magFilter : THREE.LinearFilter; - this.minFilter = options.minFilter !== undefined ? options.minFilter : THREE.LinearMipMapLinearFilter; - - this.anisotropy = options.anisotropy !== undefined ? options.anisotropy : 1; - - this.offset = new THREE.Vector2( 0, 0 ); - this.repeat = new THREE.Vector2( 1, 1 ); - - this.format = options.format !== undefined ? options.format : THREE.RGBAFormat; - this.type = options.type !== undefined ? options.type : THREE.UnsignedByteType; - - this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; - this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true; - - this.generateMipmaps = true; - - this.shareDepthFrom = options.shareDepthFrom !== undefined ? options.shareDepthFrom : null; - -}; - -THREE.WebGLRenderTarget.prototype = { - - constructor: THREE.WebGLRenderTarget, - - setSize: function ( width, height ) { - - this.width = width; - this.height = height; - - }, - - clone: function () { - - var tmp = new THREE.WebGLRenderTarget( this.width, this.height ); - - tmp.wrapS = this.wrapS; - tmp.wrapT = this.wrapT; - - tmp.magFilter = this.magFilter; - tmp.minFilter = this.minFilter; - - tmp.anisotropy = this.anisotropy; - - tmp.offset.copy( this.offset ); - tmp.repeat.copy( this.repeat ); - - tmp.format = this.format; - tmp.type = this.type; - - tmp.depthBuffer = this.depthBuffer; - tmp.stencilBuffer = this.stencilBuffer; - - tmp.generateMipmaps = this.generateMipmaps; - - tmp.shareDepthFrom = this.shareDepthFrom; - - return tmp; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.WebGLRenderTarget.prototype ); - -// File:src/renderers/WebGLRenderTargetCube.js - -/** - * @author alteredq / http://alteredqualia.com - */ - -THREE.WebGLRenderTargetCube = function ( width, height, options ) { - - THREE.WebGLRenderTarget.call( this, width, height, options ); - - this.activeCubeFace = 0; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5 - -}; - -THREE.WebGLRenderTargetCube.prototype = Object.create( THREE.WebGLRenderTarget.prototype ); -THREE.WebGLRenderTargetCube.prototype.constructor = THREE.WebGLRenderTargetCube; - -// File:src/renderers/webgl/WebGLExtensions.js - -/** -* @author mrdoob / http://mrdoob.com/ -*/ - -THREE.WebGLExtensions = function ( gl ) { - - var extensions = {}; - - this.get = function ( name ) { - - if ( extensions[ name ] !== undefined ) { - - return extensions[ name ]; - - } - - var extension; - - switch ( name ) { - - case 'EXT_texture_filter_anisotropic': - extension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' ); - break; - - case 'WEBGL_compressed_texture_s3tc': - extension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' ); - break; - - case 'WEBGL_compressed_texture_pvrtc': - extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' ); - break; - - default: - extension = gl.getExtension( name ); - - } - - if ( extension === null ) { - - THREE.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' ); - - } - - extensions[ name ] = extension; - - return extension; - - }; - -}; - -// File:src/renderers/webgl/WebGLProgram.js - -THREE.WebGLProgram = ( function () { - - var programIdCount = 0; - - var generateDefines = function ( defines ) { - - var value, chunk, chunks = []; - - for ( var d in defines ) { - - value = defines[ d ]; - if ( value === false ) continue; - - chunk = '#define ' + d + ' ' + value; - chunks.push( chunk ); - - } - - return chunks.join( '\n' ); - - }; - - var cacheUniformLocations = function ( gl, program, identifiers ) { - - var uniforms = {}; - - for ( var i = 0, l = identifiers.length; i < l; i ++ ) { - - var id = identifiers[ i ]; - uniforms[ id ] = gl.getUniformLocation( program, id ); - - } - - return uniforms; - - }; - - var cacheAttributeLocations = function ( gl, program, identifiers ) { - - var attributes = {}; - - for ( var i = 0, l = identifiers.length; i < l; i ++ ) { - - var id = identifiers[ i ]; - attributes[ id ] = gl.getAttribLocation( program, id ); - - } - - return attributes; - - }; - - return function ( renderer, code, material, parameters ) { - - var _this = renderer; - var _gl = _this.context; - - var defines = material.defines; - var uniforms = material.__webglShader.uniforms; - var attributes = material.attributes; - - var vertexShader = material.__webglShader.vertexShader; - var fragmentShader = material.__webglShader.fragmentShader; - - var index0AttributeName = material.index0AttributeName; - - if ( index0AttributeName === undefined && parameters.morphTargets === true ) { - - // programs with morphTargets displace position out of attribute 0 - - index0AttributeName = 'position'; - - } - - var shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; - - if ( parameters.shadowMapType === THREE.PCFShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF'; - - } else if ( parameters.shadowMapType === THREE.PCFSoftShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT'; - - } - - var envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - var envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; - var envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; - - if ( parameters.envMap ) { - - switch ( material.envMap.mapping ) { - - case THREE.CubeReflectionMapping: - case THREE.CubeRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - break; - - case THREE.EquirectangularReflectionMapping: - case THREE.EquirectangularRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_EQUIREC'; - break; - - case THREE.SphericalReflectionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_SPHERE'; - break; - - } - - switch ( material.envMap.mapping ) { - - case THREE.CubeRefractionMapping: - case THREE.EquirectangularRefractionMapping: - envMapModeDefine = 'ENVMAP_MODE_REFRACTION'; - break; - - } - - switch ( material.combine ) { - - case THREE.MultiplyOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; - break; - - case THREE.MixOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_MIX'; - break; - - case THREE.AddOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_ADD'; - break; - - } - - } - - var gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0; - - // console.log( 'building new program ' ); - - // - - var customDefines = generateDefines( defines ); - - // - - var program = _gl.createProgram(); - - var prefix_vertex, prefix_fragment; - - if ( material instanceof THREE.RawShaderMaterial ) { - - prefix_vertex = ''; - prefix_fragment = ''; - - } else { - - prefix_vertex = [ - - 'precision ' + parameters.precision + ' float;', - 'precision ' + parameters.precision + ' int;', - - customDefines, - - parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '', - - _this.gammaInput ? '#define GAMMA_INPUT' : '', - _this.gammaOutput ? '#define GAMMA_OUTPUT' : '', - '#define GAMMA_FACTOR ' + gammaFactorDefine, - - '#define MAX_DIR_LIGHTS ' + parameters.maxDirLights, - '#define MAX_POINT_LIGHTS ' + parameters.maxPointLights, - '#define MAX_SPOT_LIGHTS ' + parameters.maxSpotLights, - '#define MAX_HEMI_LIGHTS ' + parameters.maxHemiLights, - - '#define MAX_SHADOWS ' + parameters.maxShadows, - - '#define MAX_BONES ' + parameters.maxBones, - - parameters.map ? '#define USE_MAP' : '', - parameters.envMap ? '#define USE_ENVMAP' : '', - parameters.envMap ? '#define ' + envMapModeDefine : '', - parameters.lightMap ? '#define USE_LIGHTMAP' : '', - parameters.bumpMap ? '#define USE_BUMPMAP' : '', - parameters.normalMap ? '#define USE_NORMALMAP' : '', - parameters.specularMap ? '#define USE_SPECULARMAP' : '', - parameters.alphaMap ? '#define USE_ALPHAMAP' : '', - parameters.vertexColors ? '#define USE_COLOR' : '', - - parameters.flatShading ? '#define FLAT_SHADED': '', - - parameters.skinning ? '#define USE_SKINNING' : '', - parameters.useVertexTexture ? '#define BONE_TEXTURE' : '', - - parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', - parameters.morphNormals ? '#define USE_MORPHNORMALS' : '', - parameters.wrapAround ? '#define WRAP_AROUND' : '', - parameters.doubleSided ? '#define DOUBLE_SIDED' : '', - parameters.flipSided ? '#define FLIP_SIDED' : '', - - parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', - parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', - parameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '', - parameters.shadowMapCascade ? '#define SHADOWMAP_CASCADE' : '', - - parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', - - parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', - //_this._glExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', - - - 'uniform mat4 modelMatrix;', - 'uniform mat4 modelViewMatrix;', - 'uniform mat4 projectionMatrix;', - 'uniform mat4 viewMatrix;', - 'uniform mat3 normalMatrix;', - 'uniform vec3 cameraPosition;', - - 'attribute vec3 position;', - 'attribute vec3 normal;', - 'attribute vec2 uv;', - 'attribute vec2 uv2;', - - '#ifdef USE_COLOR', - - ' attribute vec3 color;', - - '#endif', - - '#ifdef USE_MORPHTARGETS', - - ' attribute vec3 morphTarget0;', - ' attribute vec3 morphTarget1;', - ' attribute vec3 morphTarget2;', - ' attribute vec3 morphTarget3;', - - ' #ifdef USE_MORPHNORMALS', - - ' attribute vec3 morphNormal0;', - ' attribute vec3 morphNormal1;', - ' attribute vec3 morphNormal2;', - ' attribute vec3 morphNormal3;', - - ' #else', - - ' attribute vec3 morphTarget4;', - ' attribute vec3 morphTarget5;', - ' attribute vec3 morphTarget6;', - ' attribute vec3 morphTarget7;', - - ' #endif', - - '#endif', - - '#ifdef USE_SKINNING', - - ' attribute vec4 skinIndex;', - ' attribute vec4 skinWeight;', - - '#endif', - - '' - - ].join( '\n' ); - - prefix_fragment = [ - - 'precision ' + parameters.precision + ' float;', - 'precision ' + parameters.precision + ' int;', - - ( parameters.bumpMap || parameters.normalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '', - - customDefines, - - '#define MAX_DIR_LIGHTS ' + parameters.maxDirLights, - '#define MAX_POINT_LIGHTS ' + parameters.maxPointLights, - '#define MAX_SPOT_LIGHTS ' + parameters.maxSpotLights, - '#define MAX_HEMI_LIGHTS ' + parameters.maxHemiLights, - - '#define MAX_SHADOWS ' + parameters.maxShadows, - - parameters.alphaTest ? '#define ALPHATEST ' + parameters.alphaTest : '', - - _this.gammaInput ? '#define GAMMA_INPUT' : '', - _this.gammaOutput ? '#define GAMMA_OUTPUT' : '', - '#define GAMMA_FACTOR ' + gammaFactorDefine, - - ( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '', - ( parameters.useFog && parameters.fogExp ) ? '#define FOG_EXP2' : '', - - parameters.map ? '#define USE_MAP' : '', - parameters.envMap ? '#define USE_ENVMAP' : '', - parameters.envMap ? '#define ' + envMapTypeDefine : '', - parameters.envMap ? '#define ' + envMapModeDefine : '', - parameters.envMap ? '#define ' + envMapBlendingDefine : '', - parameters.lightMap ? '#define USE_LIGHTMAP' : '', - parameters.bumpMap ? '#define USE_BUMPMAP' : '', - parameters.normalMap ? '#define USE_NORMALMAP' : '', - parameters.specularMap ? '#define USE_SPECULARMAP' : '', - parameters.alphaMap ? '#define USE_ALPHAMAP' : '', - parameters.vertexColors ? '#define USE_COLOR' : '', - - parameters.flatShading ? '#define FLAT_SHADED': '', - - parameters.metal ? '#define METAL' : '', - parameters.wrapAround ? '#define WRAP_AROUND' : '', - parameters.doubleSided ? '#define DOUBLE_SIDED' : '', - parameters.flipSided ? '#define FLIP_SIDED' : '', - - parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', - parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', - parameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '', - parameters.shadowMapCascade ? '#define SHADOWMAP_CASCADE' : '', - - parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', - //_this._glExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', - - 'uniform mat4 viewMatrix;', - 'uniform vec3 cameraPosition;', - '' - - ].join( '\n' ); - - } - - var glVertexShader = new THREE.WebGLShader( _gl, _gl.VERTEX_SHADER, prefix_vertex + vertexShader ); - var glFragmentShader = new THREE.WebGLShader( _gl, _gl.FRAGMENT_SHADER, prefix_fragment + fragmentShader ); - - _gl.attachShader( program, glVertexShader ); - _gl.attachShader( program, glFragmentShader ); - - if ( index0AttributeName !== undefined ) { - - // Force a particular attribute to index 0. - // because potentially expensive emulation is done by browser if attribute 0 is disabled. - // And, color, for example is often automatically bound to index 0 so disabling it - - _gl.bindAttribLocation( program, 0, index0AttributeName ); - - } - - _gl.linkProgram( program ); - - var programLogInfo = _gl.getProgramInfoLog( program ); - - if ( _gl.getProgramParameter( program, _gl.LINK_STATUS ) === false ) { - - THREE.error( 'THREE.WebGLProgram: shader error: ' + _gl.getError(), 'gl.VALIDATE_STATUS', _gl.getProgramParameter( program, _gl.VALIDATE_STATUS ), 'gl.getPRogramInfoLog', programLogInfo ); - - } - - if ( programLogInfo !== '' ) { - - THREE.warn( 'THREE.WebGLProgram: gl.getProgramInfoLog()' + programLogInfo ); - // THREE.warn( _gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glVertexShader ) ); - // THREE.warn( _gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glFragmentShader ) ); - - } - - // clean up - - _gl.deleteShader( glVertexShader ); - _gl.deleteShader( glFragmentShader ); - - // cache uniform locations - - var identifiers = [ - - 'viewMatrix', - 'modelViewMatrix', - 'projectionMatrix', - 'normalMatrix', - 'modelMatrix', - 'cameraPosition', - 'morphTargetInfluences', - 'bindMatrix', - 'bindMatrixInverse' - - ]; - - if ( parameters.useVertexTexture ) { - - identifiers.push( 'boneTexture' ); - identifiers.push( 'boneTextureWidth' ); - identifiers.push( 'boneTextureHeight' ); - - } else { - - identifiers.push( 'boneGlobalMatrices' ); - - } - - if ( parameters.logarithmicDepthBuffer ) { - - identifiers.push('logDepthBufFC'); - - } - - - for ( var u in uniforms ) { - - identifiers.push( u ); - - } - - this.uniforms = cacheUniformLocations( _gl, program, identifiers ); - - // cache attributes locations - - identifiers = [ - - 'position', - 'normal', - 'uv', - 'uv2', - 'tangent', - 'color', - 'skinIndex', - 'skinWeight', - 'lineDistance' - - ]; - - for ( var i = 0; i < parameters.maxMorphTargets; i ++ ) { - - identifiers.push( 'morphTarget' + i ); - - } - - for ( var i = 0; i < parameters.maxMorphNormals; i ++ ) { - - identifiers.push( 'morphNormal' + i ); - - } - - for ( var a in attributes ) { - - identifiers.push( a ); - - } - - this.attributes = cacheAttributeLocations( _gl, program, identifiers ); - this.attributesKeys = Object.keys( this.attributes ); - - // - - this.id = programIdCount ++; - this.code = code; - this.usedTimes = 1; - this.program = program; - this.vertexShader = glVertexShader; - this.fragmentShader = glFragmentShader; - - return this; - - }; - -} )(); - -// File:src/renderers/webgl/WebGLShader.js - -THREE.WebGLShader = ( function () { - - var addLineNumbers = function ( string ) { - - var lines = string.split( '\n' ); - - for ( var i = 0; i < lines.length; i ++ ) { - - lines[ i ] = ( i + 1 ) + ': ' + lines[ i ]; - - } - - return lines.join( '\n' ); - - }; - - return function ( gl, type, string ) { - - var shader = gl.createShader( type ); - - gl.shaderSource( shader, string ); - gl.compileShader( shader ); - - if ( gl.getShaderParameter( shader, gl.COMPILE_STATUS ) === false ) { - - THREE.error( 'THREE.WebGLShader: Shader couldn\'t compile.' ); - - } - - if ( gl.getShaderInfoLog( shader ) !== '' ) { - - THREE.warn( 'THREE.WebGLShader: gl.getShaderInfoLog()', gl.getShaderInfoLog( shader ), addLineNumbers( string ) ); - - } - - // --enable-privileged-webgl-extension - // console.log( type, gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); - - return shader; - - }; - -} )(); - -// File:src/renderers/webgl/WebGLState.js - -/** -* @author mrdoob / http://mrdoob.com/ -*/ - -THREE.WebGLState = function ( gl, paramThreeToGL ) { - - var newAttributes = new Uint8Array( 16 ); - var enabledAttributes = new Uint8Array( 16 ); - - var currentBlending = null; - var currentBlendEquation = null; - var currentBlendSrc = null; - var currentBlendDst = null; - var currentBlendEquationAlpha = null; - var currentBlendSrcAlpha = null; - var currentBlendDstAlpha = null; - - var currentDepthTest = null; - var currentDepthWrite = null; - - var currentColorWrite = null; - - var currentDoubleSided = null; - var currentFlipSided = null; - - var currentLineWidth = null; - - var currentPolygonOffset = null; - var currentPolygonOffsetFactor = null; - var currentPolygonOffsetUnits = null; - - this.initAttributes = function () { - - for ( var i = 0, l = newAttributes.length; i < l; i ++ ) { - - newAttributes[ i ] = 0; - - } - - }; - - this.enableAttribute = function ( attribute ) { - - newAttributes[ attribute ] = 1; - - if ( enabledAttributes[ attribute ] === 0 ) { - - gl.enableVertexAttribArray( attribute ); - enabledAttributes[ attribute ] = 1; - - } - - }; - - this.disableUnusedAttributes = function () { - - for ( var i = 0, l = enabledAttributes.length; i < l; i ++ ) { - - if ( enabledAttributes[ i ] !== newAttributes[ i ] ) { - - gl.disableVertexAttribArray( i ); - enabledAttributes[ i ] = 0; - - } - - } - - }; - - this.setBlending = function ( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha ) { - - if ( blending !== currentBlending ) { - - if ( blending === THREE.NoBlending ) { - - gl.disable( gl.BLEND ); - - } else if ( blending === THREE.AdditiveBlending ) { - - gl.enable( gl.BLEND ); - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.SRC_ALPHA, gl.ONE ); - - } else if ( blending === THREE.SubtractiveBlending ) { - - // TODO: Find blendFuncSeparate() combination - gl.enable( gl.BLEND ); - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.ZERO, gl.ONE_MINUS_SRC_COLOR ); - - } else if ( blending === THREE.MultiplyBlending ) { - - // TODO: Find blendFuncSeparate() combination - gl.enable( gl.BLEND ); - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.ZERO, gl.SRC_COLOR ); - - } else if ( blending === THREE.CustomBlending ) { - - gl.enable( gl.BLEND ); - - } else { - - gl.enable( gl.BLEND ); - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA ); - - } - - currentBlending = blending; - - } - - if ( blending === THREE.CustomBlending ) { - - blendEquationAlpha = blendEquationAlpha || blendEquation; - blendSrcAlpha = blendSrcAlpha || blendSrc; - blendDstAlpha = blendDstAlpha || blendDst; - - if ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) { - - gl.blendEquationSeparate( paramThreeToGL( blendEquation ), paramThreeToGL( blendEquationAlpha ) ); - - currentBlendEquation = blendEquation; - currentBlendEquationAlpha = blendEquationAlpha; - - } - - if ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) { - - gl.blendFuncSeparate( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ), paramThreeToGL( blendSrcAlpha ), paramThreeToGL( blendDstAlpha ) ); - - currentBlendSrc = blendSrc; - currentBlendDst = blendDst; - currentBlendSrcAlpha = blendSrcAlpha; - currentBlendDstAlpha = blendDstAlpha; - - } - - } else { - - currentBlendEquation = null; - currentBlendSrc = null; - currentBlendDst = null; - currentBlendEquationAlpha = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - - } - - }; - - this.setDepthTest = function ( depthTest ) { - - if ( currentDepthTest !== depthTest ) { - - if ( depthTest ) { - - gl.enable( gl.DEPTH_TEST ); - - } else { - - gl.disable( gl.DEPTH_TEST ); - - } - - currentDepthTest = depthTest; - - } - - }; - - this.setDepthWrite = function ( depthWrite ) { - - if ( currentDepthWrite !== depthWrite ) { - - gl.depthMask( depthWrite ); - currentDepthWrite = depthWrite; - - } - - }; - - this.setColorWrite = function ( colorWrite ) { - - if ( currentColorWrite !== colorWrite ) { - - gl.colorMask( colorWrite, colorWrite, colorWrite, colorWrite ); - currentColorWrite = colorWrite; - - } - - }; - - this.setDoubleSided = function ( doubleSided ) { - - if ( currentDoubleSided !== doubleSided ) { - - if ( doubleSided ) { - - gl.disable( gl.CULL_FACE ); - - } else { - - gl.enable( gl.CULL_FACE ); - - } - - currentDoubleSided = doubleSided; - - } - - }; - - this.setFlipSided = function ( flipSided ) { - - if ( currentFlipSided !== flipSided ) { - - if ( flipSided ) { - - gl.frontFace( gl.CW ); - - } else { - - gl.frontFace( gl.CCW ); - - } - - currentFlipSided = flipSided; - - } - - }; - - this.setLineWidth = function ( width ) { - - if ( width !== currentLineWidth ) { - - gl.lineWidth( width ); - - currentLineWidth = width; - - } - - }; - - this.setPolygonOffset = function ( polygonoffset, factor, units ) { - - if ( currentPolygonOffset !== polygonoffset ) { - - if ( polygonoffset ) { - - gl.enable( gl.POLYGON_OFFSET_FILL ); - - } else { - - gl.disable( gl.POLYGON_OFFSET_FILL ); - - } - - currentPolygonOffset = polygonoffset; - - } - - if ( polygonoffset && ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) ) { - - gl.polygonOffset( factor, units ); - - currentPolygonOffsetFactor = factor; - currentPolygonOffsetUnits = units; - - } - - }; - - this.reset = function () { - - for ( var i = 0; i < enabledAttributes.length; i ++ ) { - - enabledAttributes[ i ] = 0; - - } - - currentBlending = null; - currentDepthTest = null; - currentDepthWrite = null; - currentColorWrite = null; - currentDoubleSided = null; - currentFlipSided = null; - - }; - -}; - -// File:src/renderers/webgl/plugins/LensFlarePlugin.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.LensFlarePlugin = function ( renderer, flares ) { - - var gl = renderer.context; - - var vertexBuffer, elementBuffer; - var program, attributes, uniforms; - var hasVertexTexture; - - var tempTexture, occlusionTexture; - - var init = function () { - - var vertices = new Float32Array( [ - -1, -1, 0, 0, - 1, -1, 1, 0, - 1, 1, 1, 1, - -1, 1, 0, 1 - ] ); - - var faces = new Uint16Array( [ - 0, 1, 2, - 0, 2, 3 - ] ); - - // buffers - - vertexBuffer = gl.createBuffer(); - elementBuffer = gl.createBuffer(); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW ); - - // textures - - tempTexture = gl.createTexture(); - occlusionTexture = gl.createTexture(); - - gl.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - - gl.bindTexture( gl.TEXTURE_2D, occlusionTexture ); - gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - - hasVertexTexture = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ) > 0; - - var shader; - - if ( hasVertexTexture ) { - - shader = { - - vertexShader: [ - - "uniform lowp int renderType;", - - "uniform vec3 screenPosition;", - "uniform vec2 scale;", - "uniform float rotation;", - - "uniform sampler2D occlusionMap;", - - "attribute vec2 position;", - "attribute vec2 uv;", - - "varying vec2 vUV;", - "varying float vVisibility;", - - "void main() {", - - "vUV = uv;", - - "vec2 pos = position;", - - "if( renderType == 2 ) {", - - "vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );", - - "vVisibility = visibility.r / 9.0;", - "vVisibility *= 1.0 - visibility.g / 9.0;", - "vVisibility *= visibility.b / 9.0;", - "vVisibility *= 1.0 - visibility.a / 9.0;", - - "pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;", - "pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;", - - "}", - - "gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );", - - "}" - - ].join( "\n" ), - - fragmentShader: [ - - "uniform lowp int renderType;", - - "uniform sampler2D map;", - "uniform float opacity;", - "uniform vec3 color;", - - "varying vec2 vUV;", - "varying float vVisibility;", - - "void main() {", - - // pink square - - "if( renderType == 0 ) {", - - "gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );", - - // restore - - "} else if( renderType == 1 ) {", - - "gl_FragColor = texture2D( map, vUV );", - - // flare - - "} else {", - - "vec4 texture = texture2D( map, vUV );", - "texture.a *= opacity * vVisibility;", - "gl_FragColor = texture;", - "gl_FragColor.rgb *= color;", - - "}", - - "}" - - ].join( "\n" ) - - }; - - } else { - - shader = { - - vertexShader: [ - - "uniform lowp int renderType;", - - "uniform vec3 screenPosition;", - "uniform vec2 scale;", - "uniform float rotation;", - - "attribute vec2 position;", - "attribute vec2 uv;", - - "varying vec2 vUV;", - - "void main() {", - - "vUV = uv;", - - "vec2 pos = position;", - - "if( renderType == 2 ) {", - - "pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;", - "pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;", - - "}", - - "gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );", - - "}" - - ].join( "\n" ), - - fragmentShader: [ - - "precision mediump float;", - - "uniform lowp int renderType;", - - "uniform sampler2D map;", - "uniform sampler2D occlusionMap;", - "uniform float opacity;", - "uniform vec3 color;", - - "varying vec2 vUV;", - - "void main() {", - - // pink square - - "if( renderType == 0 ) {", - - "gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );", - - // restore - - "} else if( renderType == 1 ) {", - - "gl_FragColor = texture2D( map, vUV );", - - // flare - - "} else {", - - "float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;", - "visibility = ( 1.0 - visibility / 4.0 );", - - "vec4 texture = texture2D( map, vUV );", - "texture.a *= opacity * visibility;", - "gl_FragColor = texture;", - "gl_FragColor.rgb *= color;", - - "}", - - "}" - - ].join( "\n" ) - - }; - - } - - program = createProgram( shader ); - - attributes = { - vertex: gl.getAttribLocation ( program, "position" ), - uv: gl.getAttribLocation ( program, "uv" ) - } - - uniforms = { - renderType: gl.getUniformLocation( program, "renderType" ), - map: gl.getUniformLocation( program, "map" ), - occlusionMap: gl.getUniformLocation( program, "occlusionMap" ), - opacity: gl.getUniformLocation( program, "opacity" ), - color: gl.getUniformLocation( program, "color" ), - scale: gl.getUniformLocation( program, "scale" ), - rotation: gl.getUniformLocation( program, "rotation" ), - screenPosition: gl.getUniformLocation( program, "screenPosition" ) - }; - - }; - - /* - * Render lens flares - * Method: renders 16x16 0xff00ff-colored points scattered over the light source area, - * reads these back and calculates occlusion. - */ - - this.render = function ( scene, camera, viewportWidth, viewportHeight ) { - - if ( flares.length === 0 ) return; - - var tempPosition = new THREE.Vector3(); - - var invAspect = viewportHeight / viewportWidth, - halfViewportWidth = viewportWidth * 0.5, - halfViewportHeight = viewportHeight * 0.5; - - var size = 16 / viewportHeight, - scale = new THREE.Vector2( size * invAspect, size ); - - var screenPosition = new THREE.Vector3( 1, 1, 0 ), - screenPositionPixels = new THREE.Vector2( 1, 1 ); - - if ( program === undefined ) { - - init(); - - } - - gl.useProgram( program ); - - gl.enableVertexAttribArray( attributes.vertex ); - gl.enableVertexAttribArray( attributes.uv ); - - // loop through all lens flares to update their occlusion and positions - // setup gl and common used attribs/unforms - - gl.uniform1i( uniforms.occlusionMap, 0 ); - gl.uniform1i( uniforms.map, 1 ); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.vertexAttribPointer( attributes.vertex, 2, gl.FLOAT, false, 2 * 8, 0 ); - gl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - - gl.disable( gl.CULL_FACE ); - gl.depthMask( false ); - - for ( var i = 0, l = flares.length; i < l; i ++ ) { - - size = 16 / viewportHeight; - scale.set( size * invAspect, size ); - - // calc object screen position - - var flare = flares[ i ]; - - tempPosition.set( flare.matrixWorld.elements[12], flare.matrixWorld.elements[13], flare.matrixWorld.elements[14] ); - - tempPosition.applyMatrix4( camera.matrixWorldInverse ); - tempPosition.applyProjection( camera.projectionMatrix ); - - // setup arrays for gl programs - - screenPosition.copy( tempPosition ) - - screenPositionPixels.x = screenPosition.x * halfViewportWidth + halfViewportWidth; - screenPositionPixels.y = screenPosition.y * halfViewportHeight + halfViewportHeight; - - // screen cull - - if ( hasVertexTexture || ( - screenPositionPixels.x > 0 && - screenPositionPixels.x < viewportWidth && - screenPositionPixels.y > 0 && - screenPositionPixels.y < viewportHeight ) ) { - - // save current RGB to temp texture - - gl.activeTexture( gl.TEXTURE1 ); - gl.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 ); - - - // render pink quad - - gl.uniform1i( uniforms.renderType, 0 ); - gl.uniform2f( uniforms.scale, scale.x, scale.y ); - gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z ); - - gl.disable( gl.BLEND ); - gl.enable( gl.DEPTH_TEST ); - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - - // copy result to occlusionMap - - gl.activeTexture( gl.TEXTURE0 ); - gl.bindTexture( gl.TEXTURE_2D, occlusionTexture ); - gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 ); - - - // restore graphics - - gl.uniform1i( uniforms.renderType, 1 ); - gl.disable( gl.DEPTH_TEST ); - - gl.activeTexture( gl.TEXTURE1 ); - gl.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - - // update object positions - - flare.positionScreen.copy( screenPosition ) - - if ( flare.customUpdateCallback ) { - - flare.customUpdateCallback( flare ); - - } else { - - flare.updateLensFlares(); - - } - - // render flares - - gl.uniform1i( uniforms.renderType, 2 ); - gl.enable( gl.BLEND ); - - for ( var j = 0, jl = flare.lensFlares.length; j < jl; j ++ ) { - - var sprite = flare.lensFlares[ j ]; - - if ( sprite.opacity > 0.001 && sprite.scale > 0.001 ) { - - screenPosition.x = sprite.x; - screenPosition.y = sprite.y; - screenPosition.z = sprite.z; - - size = sprite.size * sprite.scale / viewportHeight; - - scale.x = size * invAspect; - scale.y = size; - - gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z ); - gl.uniform2f( uniforms.scale, scale.x, scale.y ); - gl.uniform1f( uniforms.rotation, sprite.rotation ); - - gl.uniform1f( uniforms.opacity, sprite.opacity ); - gl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b ); - - renderer.state.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst ); - renderer.setTexture( sprite.texture, 1 ); - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - } - - } - - } - - } - - // restore gl - - gl.enable( gl.CULL_FACE ); - gl.enable( gl.DEPTH_TEST ); - gl.depthMask( true ); - - renderer.resetGLState(); - - }; - - function createProgram ( shader ) { - - var program = gl.createProgram(); - - var fragmentShader = gl.createShader( gl.FRAGMENT_SHADER ); - var vertexShader = gl.createShader( gl.VERTEX_SHADER ); - - var prefix = "precision " + renderer.getPrecision() + " float;\n"; - - gl.shaderSource( fragmentShader, prefix + shader.fragmentShader ); - gl.shaderSource( vertexShader, prefix + shader.vertexShader ); - - gl.compileShader( fragmentShader ); - gl.compileShader( vertexShader ); - - gl.attachShader( program, fragmentShader ); - gl.attachShader( program, vertexShader ); - - gl.linkProgram( program ); - - return program; - - } - -}; - -// File:src/renderers/webgl/plugins/ShadowMapPlugin.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.ShadowMapPlugin = function ( _renderer, _lights, _webglObjects, _webglObjectsImmediate ) { - - var _gl = _renderer.context; - - var _depthMaterial, _depthMaterialMorph, _depthMaterialSkin, _depthMaterialMorphSkin, - - _frustum = new THREE.Frustum(), - _projScreenMatrix = new THREE.Matrix4(), - - _min = new THREE.Vector3(), - _max = new THREE.Vector3(), - - _matrixPosition = new THREE.Vector3(), - - _renderList = []; - - // init - - var depthShader = THREE.ShaderLib[ "depthRGBA" ]; - var depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms ); - - _depthMaterial = new THREE.ShaderMaterial( { - uniforms: depthUniforms, - vertexShader: depthShader.vertexShader, - fragmentShader: depthShader.fragmentShader - } ); - - _depthMaterialMorph = new THREE.ShaderMaterial( { - uniforms: depthUniforms, - vertexShader: depthShader.vertexShader, - fragmentShader: depthShader.fragmentShader, - morphTargets: true - } ); - - _depthMaterialSkin = new THREE.ShaderMaterial( { - uniforms: depthUniforms, - vertexShader: depthShader.vertexShader, - fragmentShader: depthShader.fragmentShader, - skinning: true - } ); - - _depthMaterialMorphSkin = new THREE.ShaderMaterial( { - uniforms: depthUniforms, - vertexShader: depthShader.vertexShader, - fragmentShader: depthShader.fragmentShader, - morphTargets: true, - skinning: true - } ); - - _depthMaterial._shadowPass = true; - _depthMaterialMorph._shadowPass = true; - _depthMaterialSkin._shadowPass = true; - _depthMaterialMorphSkin._shadowPass = true; - - this.render = function ( scene, camera ) { - - if ( _renderer.shadowMapEnabled === false ) return; - - var i, il, j, jl, n, - - shadowMap, shadowMatrix, shadowCamera, - buffer, material, - webglObject, object, light, - - lights = [], - k = 0, - - fog = null; - - // set GL state for depth map - - _gl.clearColor( 1, 1, 1, 1 ); - _gl.disable( _gl.BLEND ); - - _gl.enable( _gl.CULL_FACE ); - _gl.frontFace( _gl.CCW ); - - if ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) { - - _gl.cullFace( _gl.FRONT ); - - } else { - - _gl.cullFace( _gl.BACK ); - - } - - _renderer.state.setDepthTest( true ); - - // preprocess lights - // - skip lights that are not casting shadows - // - create virtual lights for cascaded shadow maps - - for ( i = 0, il = _lights.length; i < il; i ++ ) { - - light = _lights[ i ]; - - if ( ! light.castShadow ) continue; - - if ( ( light instanceof THREE.DirectionalLight ) && light.shadowCascade ) { - - for ( n = 0; n < light.shadowCascadeCount; n ++ ) { - - var virtualLight; - - if ( ! light.shadowCascadeArray[ n ] ) { - - virtualLight = createVirtualLight( light, n ); - virtualLight.originalCamera = camera; - - var gyro = new THREE.Gyroscope(); - gyro.position.copy( light.shadowCascadeOffset ); - - gyro.add( virtualLight ); - gyro.add( virtualLight.target ); - - camera.add( gyro ); - - light.shadowCascadeArray[ n ] = virtualLight; - - //console.log( "Created virtualLight", virtualLight ); - - } else { - - virtualLight = light.shadowCascadeArray[ n ]; - - } - - updateVirtualLight( light, n ); - - lights[ k ] = virtualLight; - k ++; - - } - - } else { - - lights[ k ] = light; - k ++; - - } - - } - - // render depth map - - for ( i = 0, il = lights.length; i < il; i ++ ) { - - light = lights[ i ]; - - if ( ! light.shadowMap ) { - - var shadowFilter = THREE.LinearFilter; - - if ( _renderer.shadowMapType === THREE.PCFSoftShadowMap ) { - - shadowFilter = THREE.NearestFilter; - - } - - var pars = { minFilter: shadowFilter, magFilter: shadowFilter, format: THREE.RGBAFormat }; - - light.shadowMap = new THREE.WebGLRenderTarget( light.shadowMapWidth, light.shadowMapHeight, pars ); - light.shadowMapSize = new THREE.Vector2( light.shadowMapWidth, light.shadowMapHeight ); - - light.shadowMatrix = new THREE.Matrix4(); - - } - - if ( ! light.shadowCamera ) { - - if ( light instanceof THREE.SpotLight ) { - - light.shadowCamera = new THREE.PerspectiveCamera( light.shadowCameraFov, light.shadowMapWidth / light.shadowMapHeight, light.shadowCameraNear, light.shadowCameraFar ); - - } else if ( light instanceof THREE.DirectionalLight ) { - - light.shadowCamera = new THREE.OrthographicCamera( light.shadowCameraLeft, light.shadowCameraRight, light.shadowCameraTop, light.shadowCameraBottom, light.shadowCameraNear, light.shadowCameraFar ); - - } else { - - THREE.error( "THREE.ShadowMapPlugin: Unsupported light type for shadow", light ); - continue; - - } - - scene.add( light.shadowCamera ); - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - - } - - if ( light.shadowCameraVisible && ! light.cameraHelper ) { - - light.cameraHelper = new THREE.CameraHelper( light.shadowCamera ); - scene.add( light.cameraHelper ); - - } - - if ( light.isVirtual && virtualLight.originalCamera == camera ) { - - updateShadowCamera( camera, light ); - - } - - shadowMap = light.shadowMap; - shadowMatrix = light.shadowMatrix; - shadowCamera = light.shadowCamera; - - // - - shadowCamera.position.setFromMatrixPosition( light.matrixWorld ); - _matrixPosition.setFromMatrixPosition( light.target.matrixWorld ); - shadowCamera.lookAt( _matrixPosition ); - shadowCamera.updateMatrixWorld(); - - shadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld ); - - // - - if ( light.cameraHelper ) light.cameraHelper.visible = light.shadowCameraVisible; - if ( light.shadowCameraVisible ) light.cameraHelper.update(); - - // compute shadow matrix - - shadowMatrix.set( - 0.5, 0.0, 0.0, 0.5, - 0.0, 0.5, 0.0, 0.5, - 0.0, 0.0, 0.5, 0.5, - 0.0, 0.0, 0.0, 1.0 - ); - - shadowMatrix.multiply( shadowCamera.projectionMatrix ); - shadowMatrix.multiply( shadowCamera.matrixWorldInverse ); - - // update camera matrices and frustum - - _projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - // render shadow map - - _renderer.setRenderTarget( shadowMap ); - _renderer.clear(); - - // set object matrices & frustum culling - - _renderList.length = 0; - - projectObject( scene, scene, shadowCamera ); - - - // render regular objects - - var objectMaterial, useMorphing, useSkinning; - - for ( j = 0, jl = _renderList.length; j < jl; j ++ ) { - - webglObject = _renderList[ j ]; - - object = webglObject.object; - buffer = webglObject.buffer; - - // culling is overriden globally for all objects - // while rendering depth map - - // need to deal with MeshFaceMaterial somehow - // in that case just use the first of material.materials for now - // (proper solution would require to break objects by materials - // similarly to regular rendering and then set corresponding - // depth materials per each chunk instead of just once per object) - - objectMaterial = getObjectMaterial( object ); - - useMorphing = object.geometry.morphTargets !== undefined && object.geometry.morphTargets.length > 0 && objectMaterial.morphTargets; - useSkinning = object instanceof THREE.SkinnedMesh && objectMaterial.skinning; - - if ( object.customDepthMaterial ) { - - material = object.customDepthMaterial; - - } else if ( useSkinning ) { - - material = useMorphing ? _depthMaterialMorphSkin : _depthMaterialSkin; - - } else if ( useMorphing ) { - - material = _depthMaterialMorph; - - } else { - - material = _depthMaterial; - - } - - _renderer.setMaterialFaces( objectMaterial ); - - if ( buffer instanceof THREE.BufferGeometry ) { - - _renderer.renderBufferDirect( shadowCamera, _lights, fog, material, buffer, object ); - - } else { - - _renderer.renderBuffer( shadowCamera, _lights, fog, material, buffer, object ); - - } - - } - - // set matrices and render immediate objects - - for ( j = 0, jl = _webglObjectsImmediate.length; j < jl; j ++ ) { - - webglObject = _webglObjectsImmediate[ j ]; - object = webglObject.object; - - if ( object.visible && object.castShadow ) { - - object._modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); - - _renderer.renderImmediateObject( shadowCamera, _lights, fog, _depthMaterial, object ); - - } - - } - - } - - // restore GL state - - var clearColor = _renderer.getClearColor(), - clearAlpha = _renderer.getClearAlpha(); - - _gl.clearColor( clearColor.r, clearColor.g, clearColor.b, clearAlpha ); - _gl.enable( _gl.BLEND ); - - if ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) { - - _gl.cullFace( _gl.BACK ); - - } - - _renderer.resetGLState(); - - }; - - function projectObject( scene, object, shadowCamera ) { - - if ( object.visible ) { - - var webglObjects = _webglObjects[ object.id ]; - - if ( webglObjects && object.castShadow && (object.frustumCulled === false || _frustum.intersectsObject( object ) === true) ) { - - for ( var i = 0, l = webglObjects.length; i < l; i ++ ) { - - var webglObject = webglObjects[ i ]; - - object._modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); - _renderList.push( webglObject ); - - } - - } - - for ( var i = 0, l = object.children.length; i < l; i ++ ) { - - projectObject( scene, object.children[ i ], shadowCamera ); - - } - - } - - } - - function createVirtualLight( light, cascade ) { - - var virtualLight = new THREE.DirectionalLight(); - - virtualLight.isVirtual = true; - - virtualLight.onlyShadow = true; - virtualLight.castShadow = true; - - virtualLight.shadowCameraNear = light.shadowCameraNear; - virtualLight.shadowCameraFar = light.shadowCameraFar; - - virtualLight.shadowCameraLeft = light.shadowCameraLeft; - virtualLight.shadowCameraRight = light.shadowCameraRight; - virtualLight.shadowCameraBottom = light.shadowCameraBottom; - virtualLight.shadowCameraTop = light.shadowCameraTop; - - virtualLight.shadowCameraVisible = light.shadowCameraVisible; - - virtualLight.shadowDarkness = light.shadowDarkness; - - virtualLight.shadowBias = light.shadowCascadeBias[ cascade ]; - virtualLight.shadowMapWidth = light.shadowCascadeWidth[ cascade ]; - virtualLight.shadowMapHeight = light.shadowCascadeHeight[ cascade ]; - - virtualLight.pointsWorld = []; - virtualLight.pointsFrustum = []; - - var pointsWorld = virtualLight.pointsWorld, - pointsFrustum = virtualLight.pointsFrustum; - - for ( var i = 0; i < 8; i ++ ) { - - pointsWorld[ i ] = new THREE.Vector3(); - pointsFrustum[ i ] = new THREE.Vector3(); - - } - - var nearZ = light.shadowCascadeNearZ[ cascade ]; - var farZ = light.shadowCascadeFarZ[ cascade ]; - - pointsFrustum[ 0 ].set( - 1, - 1, nearZ ); - pointsFrustum[ 1 ].set( 1, - 1, nearZ ); - pointsFrustum[ 2 ].set( - 1, 1, nearZ ); - pointsFrustum[ 3 ].set( 1, 1, nearZ ); - - pointsFrustum[ 4 ].set( - 1, - 1, farZ ); - pointsFrustum[ 5 ].set( 1, - 1, farZ ); - pointsFrustum[ 6 ].set( - 1, 1, farZ ); - pointsFrustum[ 7 ].set( 1, 1, farZ ); - - return virtualLight; - - } - - // Synchronize virtual light with the original light - - function updateVirtualLight( light, cascade ) { - - var virtualLight = light.shadowCascadeArray[ cascade ]; - - virtualLight.position.copy( light.position ); - virtualLight.target.position.copy( light.target.position ); - virtualLight.lookAt( virtualLight.target ); - - virtualLight.shadowCameraVisible = light.shadowCameraVisible; - virtualLight.shadowDarkness = light.shadowDarkness; - - virtualLight.shadowBias = light.shadowCascadeBias[ cascade ]; - - var nearZ = light.shadowCascadeNearZ[ cascade ]; - var farZ = light.shadowCascadeFarZ[ cascade ]; - - var pointsFrustum = virtualLight.pointsFrustum; - - pointsFrustum[ 0 ].z = nearZ; - pointsFrustum[ 1 ].z = nearZ; - pointsFrustum[ 2 ].z = nearZ; - pointsFrustum[ 3 ].z = nearZ; - - pointsFrustum[ 4 ].z = farZ; - pointsFrustum[ 5 ].z = farZ; - pointsFrustum[ 6 ].z = farZ; - pointsFrustum[ 7 ].z = farZ; - - } - - // Fit shadow camera's ortho frustum to camera frustum - - function updateShadowCamera( camera, light ) { - - var shadowCamera = light.shadowCamera, - pointsFrustum = light.pointsFrustum, - pointsWorld = light.pointsWorld; - - _min.set( Infinity, Infinity, Infinity ); - _max.set( - Infinity, - Infinity, - Infinity ); - - for ( var i = 0; i < 8; i ++ ) { - - var p = pointsWorld[ i ]; - - p.copy( pointsFrustum[ i ] ); - p.unproject( camera ); - - p.applyMatrix4( shadowCamera.matrixWorldInverse ); - - if ( p.x < _min.x ) _min.x = p.x; - if ( p.x > _max.x ) _max.x = p.x; - - if ( p.y < _min.y ) _min.y = p.y; - if ( p.y > _max.y ) _max.y = p.y; - - if ( p.z < _min.z ) _min.z = p.z; - if ( p.z > _max.z ) _max.z = p.z; - - } - - shadowCamera.left = _min.x; - shadowCamera.right = _max.x; - shadowCamera.top = _max.y; - shadowCamera.bottom = _min.y; - - // can't really fit near/far - //shadowCamera.near = _min.z; - //shadowCamera.far = _max.z; - - shadowCamera.updateProjectionMatrix(); - - } - - // For the moment just ignore objects that have multiple materials with different animation methods - // Only the first material will be taken into account for deciding which depth material to use for shadow maps - - function getObjectMaterial( object ) { - - return object.material instanceof THREE.MeshFaceMaterial - ? object.material.materials[ 0 ] - : object.material; - - }; - -}; - -// File:src/renderers/webgl/plugins/SpritePlugin.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.SpritePlugin = function ( renderer, sprites ) { - - var gl = renderer.context; - - var vertexBuffer, elementBuffer; - var program, attributes, uniforms; - - var texture; - - // decompose matrixWorld - - var spritePosition = new THREE.Vector3(); - var spriteRotation = new THREE.Quaternion(); - var spriteScale = new THREE.Vector3(); - - var init = function () { - - var vertices = new Float32Array( [ - - 0.5, - 0.5, 0, 0, - 0.5, - 0.5, 1, 0, - 0.5, 0.5, 1, 1, - - 0.5, 0.5, 0, 1 - ] ); - - var faces = new Uint16Array( [ - 0, 1, 2, - 0, 2, 3 - ] ); - - vertexBuffer = gl.createBuffer(); - elementBuffer = gl.createBuffer(); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW ); - - program = createProgram(); - - attributes = { - position: gl.getAttribLocation ( program, 'position' ), - uv: gl.getAttribLocation ( program, 'uv' ) - }; - - uniforms = { - uvOffset: gl.getUniformLocation( program, 'uvOffset' ), - uvScale: gl.getUniformLocation( program, 'uvScale' ), - - rotation: gl.getUniformLocation( program, 'rotation' ), - scale: gl.getUniformLocation( program, 'scale' ), - - color: gl.getUniformLocation( program, 'color' ), - map: gl.getUniformLocation( program, 'map' ), - opacity: gl.getUniformLocation( program, 'opacity' ), - - modelViewMatrix: gl.getUniformLocation( program, 'modelViewMatrix' ), - projectionMatrix: gl.getUniformLocation( program, 'projectionMatrix' ), - - fogType: gl.getUniformLocation( program, 'fogType' ), - fogDensity: gl.getUniformLocation( program, 'fogDensity' ), - fogNear: gl.getUniformLocation( program, 'fogNear' ), - fogFar: gl.getUniformLocation( program, 'fogFar' ), - fogColor: gl.getUniformLocation( program, 'fogColor' ), - - alphaTest: gl.getUniformLocation( program, 'alphaTest' ) - }; - - var canvas = document.createElement( 'canvas' ); - canvas.width = 8; - canvas.height = 8; - - var context = canvas.getContext( '2d' ); - context.fillStyle = 'white'; - context.fillRect( 0, 0, 8, 8 ); - - texture = new THREE.Texture( canvas ); - texture.needsUpdate = true; - - }; - - this.render = function ( scene, camera ) { - - if ( sprites.length === 0 ) return; - - // setup gl - - if ( program === undefined ) { - - init(); - - } - - gl.useProgram( program ); - - gl.enableVertexAttribArray( attributes.position ); - gl.enableVertexAttribArray( attributes.uv ); - - gl.disable( gl.CULL_FACE ); - gl.enable( gl.BLEND ); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.vertexAttribPointer( attributes.position, 2, gl.FLOAT, false, 2 * 8, 0 ); - gl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - - gl.uniformMatrix4fv( uniforms.projectionMatrix, false, camera.projectionMatrix.elements ); - - gl.activeTexture( gl.TEXTURE0 ); - gl.uniform1i( uniforms.map, 0 ); - - var oldFogType = 0; - var sceneFogType = 0; - var fog = scene.fog; - - if ( fog ) { - - gl.uniform3f( uniforms.fogColor, fog.color.r, fog.color.g, fog.color.b ); - - if ( fog instanceof THREE.Fog ) { - - gl.uniform1f( uniforms.fogNear, fog.near ); - gl.uniform1f( uniforms.fogFar, fog.far ); - - gl.uniform1i( uniforms.fogType, 1 ); - oldFogType = 1; - sceneFogType = 1; - - } else if ( fog instanceof THREE.FogExp2 ) { - - gl.uniform1f( uniforms.fogDensity, fog.density ); - - gl.uniform1i( uniforms.fogType, 2 ); - oldFogType = 2; - sceneFogType = 2; - - } - - } else { - - gl.uniform1i( uniforms.fogType, 0 ); - oldFogType = 0; - sceneFogType = 0; - - } - - - // update positions and sort - - for ( var i = 0, l = sprites.length; i < l; i ++ ) { - - var sprite = sprites[ i ]; - - sprite._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, sprite.matrixWorld ); - sprite.z = - sprite._modelViewMatrix.elements[ 14 ]; - - } - - sprites.sort( painterSortStable ); - - // render all sprites - - var scale = []; - - for ( var i = 0, l = sprites.length; i < l; i ++ ) { - - var sprite = sprites[ i ]; - var material = sprite.material; - - gl.uniform1f( uniforms.alphaTest, material.alphaTest ); - gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, sprite._modelViewMatrix.elements ); - - sprite.matrixWorld.decompose( spritePosition, spriteRotation, spriteScale ); - - scale[ 0 ] = spriteScale.x; - scale[ 1 ] = spriteScale.y; - - var fogType = 0; - - if ( scene.fog && material.fog ) { - - fogType = sceneFogType; - - } - - if ( oldFogType !== fogType ) { - - gl.uniform1i( uniforms.fogType, fogType ); - oldFogType = fogType; - - } - - if ( material.map !== null ) { - - gl.uniform2f( uniforms.uvOffset, material.map.offset.x, material.map.offset.y ); - gl.uniform2f( uniforms.uvScale, material.map.repeat.x, material.map.repeat.y ); - - } else { - - gl.uniform2f( uniforms.uvOffset, 0, 0 ); - gl.uniform2f( uniforms.uvScale, 1, 1 ); - - } - - gl.uniform1f( uniforms.opacity, material.opacity ); - gl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b ); - - gl.uniform1f( uniforms.rotation, material.rotation ); - gl.uniform2fv( uniforms.scale, scale ); - - renderer.state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst ); - renderer.state.setDepthTest( material.depthTest ); - renderer.state.setDepthWrite( material.depthWrite ); - - if ( material.map && material.map.image && material.map.image.width ) { - - renderer.setTexture( material.map, 0 ); - - } else { - - renderer.setTexture( texture, 0 ); - - } - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - } - - // restore gl - - gl.enable( gl.CULL_FACE ); - - renderer.resetGLState(); - - }; - - function createProgram () { - - var program = gl.createProgram(); - - var vertexShader = gl.createShader( gl.VERTEX_SHADER ); - var fragmentShader = gl.createShader( gl.FRAGMENT_SHADER ); - - gl.shaderSource( vertexShader, [ - - 'precision ' + renderer.getPrecision() + ' float;', - - 'uniform mat4 modelViewMatrix;', - 'uniform mat4 projectionMatrix;', - 'uniform float rotation;', - 'uniform vec2 scale;', - 'uniform vec2 uvOffset;', - 'uniform vec2 uvScale;', - - 'attribute vec2 position;', - 'attribute vec2 uv;', - - 'varying vec2 vUV;', - - 'void main() {', - - 'vUV = uvOffset + uv * uvScale;', - - 'vec2 alignedPosition = position * scale;', - - 'vec2 rotatedPosition;', - 'rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;', - 'rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;', - - 'vec4 finalPosition;', - - 'finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );', - 'finalPosition.xy += rotatedPosition;', - 'finalPosition = projectionMatrix * finalPosition;', - - 'gl_Position = finalPosition;', - - '}' - - ].join( '\n' ) ); - - gl.shaderSource( fragmentShader, [ - - 'precision ' + renderer.getPrecision() + ' float;', - - 'uniform vec3 color;', - 'uniform sampler2D map;', - 'uniform float opacity;', - - 'uniform int fogType;', - 'uniform vec3 fogColor;', - 'uniform float fogDensity;', - 'uniform float fogNear;', - 'uniform float fogFar;', - 'uniform float alphaTest;', - - 'varying vec2 vUV;', - - 'void main() {', - - 'vec4 texture = texture2D( map, vUV );', - - 'if ( texture.a < alphaTest ) discard;', - - 'gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );', - - 'if ( fogType > 0 ) {', - - 'float depth = gl_FragCoord.z / gl_FragCoord.w;', - 'float fogFactor = 0.0;', - - 'if ( fogType == 1 ) {', - - 'fogFactor = smoothstep( fogNear, fogFar, depth );', - - '} else {', - - 'const float LOG2 = 1.442695;', - 'float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );', - 'fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );', - - '}', - - 'gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );', - - '}', - - '}' - - ].join( '\n' ) ); - - gl.compileShader( vertexShader ); - gl.compileShader( fragmentShader ); - - gl.attachShader( program, vertexShader ); - gl.attachShader( program, fragmentShader ); - - gl.linkProgram( program ); - - return program; - - }; - - function painterSortStable ( a, b ) { - - if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return b.id - a.id; - - } - - }; - -}; - -// File:src/extras/GeometryUtils.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.GeometryUtils = { - - merge: function ( geometry1, geometry2, materialIndexOffset ) { - - THREE.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' ); - - var matrix; - - if ( geometry2 instanceof THREE.Mesh ) { - - geometry2.matrixAutoUpdate && geometry2.updateMatrix(); - - matrix = geometry2.matrix; - geometry2 = geometry2.geometry; - - } - - geometry1.merge( geometry2, matrix, materialIndexOffset ); - - }, - - center: function ( geometry ) { - - THREE.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' ); - return geometry.center(); - - } - -}; - -// File:src/extras/ImageUtils.js - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author Daosheng Mu / https://github.com/DaoshengMu/ - */ - -THREE.ImageUtils = { - - crossOrigin: undefined, - - loadTexture: function ( url, mapping, onLoad, onError ) { - - var loader = new THREE.ImageLoader(); - loader.crossOrigin = this.crossOrigin; - - var texture = new THREE.Texture( undefined, mapping ); - - loader.load( url, function ( image ) { - - texture.image = image; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - }, undefined, function ( event ) { - - if ( onError ) onError( event ); - - } ); - - texture.sourceFile = url; - - return texture; - - }, - - loadTextureCube: function ( array, mapping, onLoad, onError ) { - - var images = []; - - var loader = new THREE.ImageLoader(); - loader.crossOrigin = this.crossOrigin; - - var texture = new THREE.CubeTexture( images, mapping ); - - // no flipping needed for cube textures - - texture.flipY = false; - - var loaded = 0; - - var loadTexture = function ( i ) { - - loader.load( array[ i ], function ( image ) { - - texture.images[ i ] = image; - - loaded += 1; - - if ( loaded === 6 ) { - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - }, undefined, onError ); - - } - - for ( var i = 0, il = array.length; i < il; ++ i ) { - - loadTexture( i ); - - } - - return texture; - - }, - - loadCompressedTexture: function () { - - THREE.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' ) - - }, - - loadCompressedTextureCube: function () { - - THREE.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' ) - - }, - - getNormalMap: function ( image, depth ) { - - // Adapted from http://www.paulbrunt.co.uk/lab/heightnormal/ - - var cross = function ( a, b ) { - - return [ a[ 1 ] * b[ 2 ] - a[ 2 ] * b[ 1 ], a[ 2 ] * b[ 0 ] - a[ 0 ] * b[ 2 ], a[ 0 ] * b[ 1 ] - a[ 1 ] * b[ 0 ] ]; - - } - - var subtract = function ( a, b ) { - - return [ a[ 0 ] - b[ 0 ], a[ 1 ] - b[ 1 ], a[ 2 ] - b[ 2 ] ]; - - } - - var normalize = function ( a ) { - - var l = Math.sqrt( a[ 0 ] * a[ 0 ] + a[ 1 ] * a[ 1 ] + a[ 2 ] * a[ 2 ] ); - return [ a[ 0 ] / l, a[ 1 ] / l, a[ 2 ] / l ]; - - } - - depth = depth | 1; - - var width = image.width; - var height = image.height; - - var canvas = document.createElement( 'canvas' ); - canvas.width = width; - canvas.height = height; - - var context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0 ); - - var data = context.getImageData( 0, 0, width, height ).data; - var imageData = context.createImageData( width, height ); - var output = imageData.data; - - for ( var x = 0; x < width; x ++ ) { - - for ( var y = 0; y < height; y ++ ) { - - var ly = y - 1 < 0 ? 0 : y - 1; - var uy = y + 1 > height - 1 ? height - 1 : y + 1; - var lx = x - 1 < 0 ? 0 : x - 1; - var ux = x + 1 > width - 1 ? width - 1 : x + 1; - - var points = []; - var origin = [ 0, 0, data[ ( y * width + x ) * 4 ] / 255 * depth ]; - points.push( [ - 1, 0, data[ ( y * width + lx ) * 4 ] / 255 * depth ] ); - points.push( [ - 1, - 1, data[ ( ly * width + lx ) * 4 ] / 255 * depth ] ); - points.push( [ 0, - 1, data[ ( ly * width + x ) * 4 ] / 255 * depth ] ); - points.push( [ 1, - 1, data[ ( ly * width + ux ) * 4 ] / 255 * depth ] ); - points.push( [ 1, 0, data[ ( y * width + ux ) * 4 ] / 255 * depth ] ); - points.push( [ 1, 1, data[ ( uy * width + ux ) * 4 ] / 255 * depth ] ); - points.push( [ 0, 1, data[ ( uy * width + x ) * 4 ] / 255 * depth ] ); - points.push( [ - 1, 1, data[ ( uy * width + lx ) * 4 ] / 255 * depth ] ); - - var normals = []; - var num_points = points.length; - - for ( var i = 0; i < num_points; i ++ ) { - - var v1 = points[ i ]; - var v2 = points[ ( i + 1 ) % num_points ]; - v1 = subtract( v1, origin ); - v2 = subtract( v2, origin ); - normals.push( normalize( cross( v1, v2 ) ) ); - - } - - var normal = [ 0, 0, 0 ]; - - for ( var i = 0; i < normals.length; i ++ ) { - - normal[ 0 ] += normals[ i ][ 0 ]; - normal[ 1 ] += normals[ i ][ 1 ]; - normal[ 2 ] += normals[ i ][ 2 ]; - - } - - normal[ 0 ] /= normals.length; - normal[ 1 ] /= normals.length; - normal[ 2 ] /= normals.length; - - var idx = ( y * width + x ) * 4; - - output[ idx ] = ( ( normal[ 0 ] + 1.0 ) / 2.0 * 255 ) | 0; - output[ idx + 1 ] = ( ( normal[ 1 ] + 1.0 ) / 2.0 * 255 ) | 0; - output[ idx + 2 ] = ( normal[ 2 ] * 255 ) | 0; - output[ idx + 3 ] = 255; - - } - - } - - context.putImageData( imageData, 0, 0 ); - - return canvas; - - }, - - generateDataTexture: function ( width, height, color ) { - - var size = width * height; - var data = new Uint8Array( 3 * size ); - - var r = Math.floor( color.r * 255 ); - var g = Math.floor( color.g * 255 ); - var b = Math.floor( color.b * 255 ); - - for ( var i = 0; i < size; i ++ ) { - - data[ i * 3 ] = r; - data[ i * 3 + 1 ] = g; - data[ i * 3 + 2 ] = b; - - } - - var texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat ); - texture.needsUpdate = true; - - return texture; - - } - -}; - -// File:src/extras/SceneUtils.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.SceneUtils = { - - createMultiMaterialObject: function ( geometry, materials ) { - - var group = new THREE.Object3D(); - - for ( var i = 0, l = materials.length; i < l; i ++ ) { - - group.add( new THREE.Mesh( geometry, materials[ i ] ) ); - - } - - return group; - - }, - - detach: function ( child, parent, scene ) { - - child.applyMatrix( parent.matrixWorld ); - parent.remove( child ); - scene.add( child ); - - }, - - attach: function ( child, scene, parent ) { - - var matrixWorldInverse = new THREE.Matrix4(); - matrixWorldInverse.getInverse( parent.matrixWorld ); - child.applyMatrix( matrixWorldInverse ); - - scene.remove( child ); - parent.add( child ); - - } - -}; - -// File:src/extras/FontUtils.js - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author alteredq / http://alteredqualia.com/ - * - * For Text operations in three.js (See TextGeometry) - * - * It uses techniques used in: - * - * typeface.js and canvastext - * For converting fonts and rendering with javascript - * http://typeface.neocracy.org - * - * Triangulation ported from AS3 - * Simple Polygon Triangulation - * http://actionsnippet.com/?p=1462 - * - * A Method to triangulate shapes with holes - * http://www.sakri.net/blog/2009/06/12/an-approach-to-triangulating-polygons-with-holes/ - * - */ - -THREE.FontUtils = { - - faces: {}, - - // Just for now. face[weight][style] - - face: 'helvetiker', - weight: 'normal', - style: 'normal', - size: 150, - divisions: 10, - - getFace: function () { - - try { - - return this.faces[ this.face ][ this.weight ][ this.style ]; - - } catch (e) { - - throw "The font " + this.face + " with " + this.weight + " weight and " + this.style + " style is missing." - - }; - - }, - - loadFace: function ( data ) { - - var family = data.familyName.toLowerCase(); - - var ThreeFont = this; - - ThreeFont.faces[ family ] = ThreeFont.faces[ family ] || {}; - - ThreeFont.faces[ family ][ data.cssFontWeight ] = ThreeFont.faces[ family ][ data.cssFontWeight ] || {}; - ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data; - - ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data; - - return data; - - }, - - drawText: function ( text ) { - - // RenderText - - var i, - face = this.getFace(), - scale = this.size / face.resolution, - offset = 0, - chars = String( text ).split( '' ), - length = chars.length; - - var fontPaths = []; - - for ( i = 0; i < length; i ++ ) { - - var path = new THREE.Path(); - - var ret = this.extractGlyphPoints( chars[ i ], face, scale, offset, path ); - offset += ret.offset; - - fontPaths.push( ret.path ); - - } - - // get the width - - var width = offset / 2; - // - // for ( p = 0; p < allPts.length; p++ ) { - // - // allPts[ p ].x -= width; - // - // } - - //var extract = this.extractPoints( allPts, characterPts ); - //extract.contour = allPts; - - //extract.paths = fontPaths; - //extract.offset = width; - - return { paths: fontPaths, offset: width }; - - }, - - - - - extractGlyphPoints: function ( c, face, scale, offset, path ) { - - var pts = []; - - var i, i2, divisions, - outline, action, length, - scaleX, scaleY, - x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2, - laste, - glyph = face.glyphs[ c ] || face.glyphs[ '?' ]; - - if ( ! glyph ) return; - - if ( glyph.o ) { - - outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) ); - length = outline.length; - - scaleX = scale; - scaleY = scale; - - for ( i = 0; i < length; ) { - - action = outline[ i ++ ]; - - //console.log( action ); - - switch ( action ) { - - case 'm': - - // Move To - - x = outline[ i ++ ] * scaleX + offset; - y = outline[ i ++ ] * scaleY; - - path.moveTo( x, y ); - break; - - case 'l': - - // Line To - - x = outline[ i ++ ] * scaleX + offset; - y = outline[ i ++ ] * scaleY; - path.lineTo( x, y ); - break; - - case 'q': - - // QuadraticCurveTo - - cpx = outline[ i ++ ] * scaleX + offset; - cpy = outline[ i ++ ] * scaleY; - cpx1 = outline[ i ++ ] * scaleX + offset; - cpy1 = outline[ i ++ ] * scaleY; - - path.quadraticCurveTo( cpx1, cpy1, cpx, cpy ); - - laste = pts[ pts.length - 1 ]; - - if ( laste ) { - - cpx0 = laste.x; - cpy0 = laste.y; - - for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) { - - var t = i2 / divisions; - THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx ); - THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy ); - } - - } - - break; - - case 'b': - - // Cubic Bezier Curve - - cpx = outline[ i ++ ] * scaleX + offset; - cpy = outline[ i ++ ] * scaleY; - cpx1 = outline[ i ++ ] * scaleX + offset; - cpy1 = outline[ i ++ ] * scaleY; - cpx2 = outline[ i ++ ] * scaleX + offset; - cpy2 = outline[ i ++ ] * scaleY; - - path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy ); - - laste = pts[ pts.length - 1 ]; - - if ( laste ) { - - cpx0 = laste.x; - cpy0 = laste.y; - - for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) { - - var t = i2 / divisions; - THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx ); - THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy ); - - } - - } - - break; - - } - - } - } - - - - return { offset: glyph.ha * scale, path:path }; - } - -}; - - -THREE.FontUtils.generateShapes = function ( text, parameters ) { - - // Parameters - - parameters = parameters || {}; - - var size = parameters.size !== undefined ? parameters.size : 100; - var curveSegments = parameters.curveSegments !== undefined ? parameters.curveSegments : 4; - - var font = parameters.font !== undefined ? parameters.font : 'helvetiker'; - var weight = parameters.weight !== undefined ? parameters.weight : 'normal'; - var style = parameters.style !== undefined ? parameters.style : 'normal'; - - THREE.FontUtils.size = size; - THREE.FontUtils.divisions = curveSegments; - - THREE.FontUtils.face = font; - THREE.FontUtils.weight = weight; - THREE.FontUtils.style = style; - - // Get a Font data json object - - var data = THREE.FontUtils.drawText( text ); - - var paths = data.paths; - var shapes = []; - - for ( var p = 0, pl = paths.length; p < pl; p ++ ) { - - Array.prototype.push.apply( shapes, paths[ p ].toShapes() ); - - } - - return shapes; - -}; - - -/** - * This code is a quick port of code written in C++ which was submitted to - * flipcode.com by John W. Ratcliff // July 22, 2000 - * See original code and more information here: - * http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml - * - * ported to actionscript by Zevan Rosser - * www.actionsnippet.com - * - * ported to javascript by Joshua Koo - * http://www.lab4games.net/zz85/blog - * - */ - - -( function ( namespace ) { - - var EPSILON = 0.0000000001; - - // takes in an contour array and returns - - var process = function ( contour, indices ) { - - var n = contour.length; - - if ( n < 3 ) return null; - - var result = [], - verts = [], - vertIndices = []; - - /* we want a counter-clockwise polygon in verts */ - - var u, v, w; - - if ( area( contour ) > 0.0 ) { - - for ( v = 0; v < n; v ++ ) verts[ v ] = v; - - } else { - - for ( v = 0; v < n; v ++ ) verts[ v ] = ( n - 1 ) - v; - - } - - var nv = n; - - /* remove nv - 2 vertices, creating 1 triangle every time */ - - var count = 2 * nv; /* error detection */ - - for ( v = nv - 1; nv > 2; ) { - - /* if we loop, it is probably a non-simple polygon */ - - if ( ( count -- ) <= 0 ) { - - //** Triangulate: ERROR - probable bad polygon! - - //throw ( "Warning, unable to triangulate polygon!" ); - //return null; - // Sometimes warning is fine, especially polygons are triangulated in reverse. - THREE.warn( 'THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()' ); - - if ( indices ) return vertIndices; - return result; - - } - - /* three consecutive vertices in current polygon, <u,v,w> */ - - u = v; if ( nv <= u ) u = 0; /* previous */ - v = u + 1; if ( nv <= v ) v = 0; /* new v */ - w = v + 1; if ( nv <= w ) w = 0; /* next */ - - if ( snip( contour, u, v, w, nv, verts ) ) { - - var a, b, c, s, t; - - /* true names of the vertices */ - - a = verts[ u ]; - b = verts[ v ]; - c = verts[ w ]; - - /* output Triangle */ - - result.push( [ contour[ a ], - contour[ b ], - contour[ c ] ] ); - - - vertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] ); - - /* remove v from the remaining polygon */ - - for ( s = v, t = v + 1; t < nv; s ++, t ++ ) { - - verts[ s ] = verts[ t ]; - - } - - nv --; - - /* reset error detection counter */ - - count = 2 * nv; - - } - - } - - if ( indices ) return vertIndices; - return result; - - }; - - // calculate area of the contour polygon - - var area = function ( contour ) { - - var n = contour.length; - var a = 0.0; - - for ( var p = n - 1, q = 0; q < n; p = q ++ ) { - - a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y; - - } - - return a * 0.5; - - }; - - var snip = function ( contour, u, v, w, n, verts ) { - - var p; - var ax, ay, bx, by; - var cx, cy, px, py; - - ax = contour[ verts[ u ] ].x; - ay = contour[ verts[ u ] ].y; - - bx = contour[ verts[ v ] ].x; - by = contour[ verts[ v ] ].y; - - cx = contour[ verts[ w ] ].x; - cy = contour[ verts[ w ] ].y; - - if ( EPSILON > ( ( ( bx - ax ) * ( cy - ay ) ) - ( ( by - ay ) * ( cx - ax ) ) ) ) return false; - - var aX, aY, bX, bY, cX, cY; - var apx, apy, bpx, bpy, cpx, cpy; - var cCROSSap, bCROSScp, aCROSSbp; - - aX = cx - bx; aY = cy - by; - bX = ax - cx; bY = ay - cy; - cX = bx - ax; cY = by - ay; - - for ( p = 0; p < n; p ++ ) { - - px = contour[ verts[ p ] ].x - py = contour[ verts[ p ] ].y - - if ( ( ( px === ax ) && ( py === ay ) ) || - ( ( px === bx ) && ( py === by ) ) || - ( ( px === cx ) && ( py === cy ) ) ) continue; - - apx = px - ax; apy = py - ay; - bpx = px - bx; bpy = py - by; - cpx = px - cx; cpy = py - cy; - - // see if p is inside triangle abc - - aCROSSbp = aX * bpy - aY * bpx; - cCROSSap = cX * apy - cY * apx; - bCROSScp = bX * cpy - bY * cpx; - - if ( ( aCROSSbp >= - EPSILON ) && ( bCROSScp >= - EPSILON ) && ( cCROSSap >= - EPSILON ) ) return false; - - } - - return true; - - }; - - - namespace.Triangulate = process; - namespace.Triangulate.area = area; - - return namespace; - -} )( THREE.FontUtils ); - -// To use the typeface.js face files, hook up the API -self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace }; -THREE.typeface_js = self._typeface_js; - -// File:src/extras/audio/Audio.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Audio = function ( listener ) { - - THREE.Object3D.call( this ); - - this.type = 'Audio'; - - this.context = listener.context; - this.source = this.context.createBufferSource(); - this.source.onended = this.onEnded.bind(this); - - this.gain = this.context.createGain(); - this.gain.connect( this.context.destination ); - - this.panner = this.context.createPanner(); - this.panner.connect( this.gain ); - - this.autoplay = false; - - this.startTime = 0; - this.isPlaying = false; - -}; - -THREE.Audio.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Audio.prototype.constructor = THREE.Audio; - -THREE.Audio.prototype.load = function ( file ) { - - var scope = this; - - var request = new XMLHttpRequest(); - request.open( 'GET', file, true ); - request.responseType = 'arraybuffer'; - request.onload = function ( e ) { - - scope.context.decodeAudioData( this.response, function ( buffer ) { - - scope.source.buffer = buffer; - - if( scope.autoplay ) scope.play(); - - } ); - - }; - request.send(); - - return this; - -}; - -THREE.Audio.prototype.play = function () { - - if ( this.isPlaying === true ) { - - THREE.warn( 'THREE.Audio: Audio is already playing.' ); - return; - - } - - var source = this.context.createBufferSource(); - - source.buffer = this.source.buffer; - source.loop = this.source.loop; - source.onended = this.source.onended; - source.connect( this.panner ); - source.start( 0, this.startTime ); - - this.isPlaying = true; - - this.source = source; - -}; - -THREE.Audio.prototype.pause = function () { - - this.source.stop(); - this.startTime = this.context.currentTime; - -}; - -THREE.Audio.prototype.stop = function () { - - this.source.stop(); - this.startTime = 0; - -}; - -THREE.Audio.prototype.onEnded = function() { - - this.isPlaying = false; - -}; - -THREE.Audio.prototype.setLoop = function ( value ) { - - this.source.loop = value; - -}; - -THREE.Audio.prototype.setRefDistance = function ( value ) { - - this.panner.refDistance = value; - -}; - -THREE.Audio.prototype.setRolloffFactor = function ( value ) { - - this.panner.rolloffFactor = value; - -}; - -THREE.Audio.prototype.setVolume = function ( value ) { - - this.gain.gain.value = value; - -}; - -THREE.Audio.prototype.updateMatrixWorld = ( function () { - - var position = new THREE.Vector3(); - - return function ( force ) { - - THREE.Object3D.prototype.updateMatrixWorld.call( this, force ); - - position.setFromMatrixPosition( this.matrixWorld ); - - this.panner.setPosition( position.x, position.y, position.z ); - - }; - -} )(); - -// File:src/extras/audio/AudioListener.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.AudioListener = function () { - - THREE.Object3D.call( this ); - - this.type = 'AudioListener'; - - this.context = new ( window.AudioContext || window.webkitAudioContext )(); - -}; - -THREE.AudioListener.prototype = Object.create( THREE.Object3D.prototype ); -THREE.AudioListener.prototype.constructor = THREE.AudioListener; - -THREE.AudioListener.prototype.updateMatrixWorld = ( function () { - - var position = new THREE.Vector3(); - var quaternion = new THREE.Quaternion(); - var scale = new THREE.Vector3(); - - var orientation = new THREE.Vector3(); - var velocity = new THREE.Vector3(); - - var positionPrev = new THREE.Vector3(); - - return function ( force ) { - - THREE.Object3D.prototype.updateMatrixWorld.call( this, force ); - - var listener = this.context.listener; - var up = this.up; - - this.matrixWorld.decompose( position, quaternion, scale ); - - orientation.set( 0, 0, -1 ).applyQuaternion( quaternion ); - velocity.subVectors( position, positionPrev ); - - listener.setPosition( position.x, position.y, position.z ); - listener.setOrientation( orientation.x, orientation.y, orientation.z, up.x, up.y, up.z ); - listener.setVelocity( velocity.x, velocity.y, velocity.z ); - - positionPrev.copy( position ); - - }; - -} )(); - -// File:src/extras/core/Curve.js - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Extensible curve object - * - * Some common of Curve methods - * .getPoint(t), getTangent(t) - * .getPointAt(u), getTagentAt(u) - * .getPoints(), .getSpacedPoints() - * .getLength() - * .updateArcLengths() - * - * This following classes subclasses THREE.Curve: - * - * -- 2d classes -- - * THREE.LineCurve - * THREE.QuadraticBezierCurve - * THREE.CubicBezierCurve - * THREE.SplineCurve - * THREE.ArcCurve - * THREE.EllipseCurve - * - * -- 3d classes -- - * THREE.LineCurve3 - * THREE.QuadraticBezierCurve3 - * THREE.CubicBezierCurve3 - * THREE.SplineCurve3 - * THREE.ClosedSplineCurve3 - * - * A series of curves can be represented as a THREE.CurvePath - * - **/ - -/************************************************************** - * Abstract Curve base class - **************************************************************/ - -THREE.Curve = function () { - -}; - -// Virtual base class method to overwrite and implement in subclasses -// - t [0 .. 1] - -THREE.Curve.prototype.getPoint = function ( t ) { - - THREE.warn( "THREE.Curve: Warning, getPoint() not implemented!" ); - return null; - -}; - -// Get point at relative position in curve according to arc length -// - u [0 .. 1] - -THREE.Curve.prototype.getPointAt = function ( u ) { - - var t = this.getUtoTmapping( u ); - return this.getPoint( t ); - -}; - -// Get sequence of points using getPoint( t ) - -THREE.Curve.prototype.getPoints = function ( divisions ) { - - if ( ! divisions ) divisions = 5; - - var d, pts = []; - - for ( d = 0; d <= divisions; d ++ ) { - - pts.push( this.getPoint( d / divisions ) ); - - } - - return pts; - -}; - -// Get sequence of points using getPointAt( u ) - -THREE.Curve.prototype.getSpacedPoints = function ( divisions ) { - - if ( ! divisions ) divisions = 5; - - var d, pts = []; - - for ( d = 0; d <= divisions; d ++ ) { - - pts.push( this.getPointAt( d / divisions ) ); - - } - - return pts; - -}; - -// Get total curve arc length - -THREE.Curve.prototype.getLength = function () { - - var lengths = this.getLengths(); - return lengths[ lengths.length - 1 ]; - -}; - -// Get list of cumulative segment lengths - -THREE.Curve.prototype.getLengths = function ( divisions ) { - - if ( ! divisions ) divisions = (this.__arcLengthDivisions) ? (this.__arcLengthDivisions) : 200; - - if ( this.cacheArcLengths - && ( this.cacheArcLengths.length == divisions + 1 ) - && ! this.needsUpdate) { - - //console.log( "cached", this.cacheArcLengths ); - return this.cacheArcLengths; - - } - - this.needsUpdate = false; - - var cache = []; - var current, last = this.getPoint( 0 ); - var p, sum = 0; - - cache.push( 0 ); - - for ( p = 1; p <= divisions; p ++ ) { - - current = this.getPoint ( p / divisions ); - sum += current.distanceTo( last ); - cache.push( sum ); - last = current; - - } - - this.cacheArcLengths = cache; - - return cache; // { sums: cache, sum:sum }; Sum is in the last element. - -}; - - -THREE.Curve.prototype.updateArcLengths = function() { - this.needsUpdate = true; - this.getLengths(); -}; - -// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance - -THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) { - - var arcLengths = this.getLengths(); - - var i = 0, il = arcLengths.length; - - var targetArcLength; // The targeted u distance value to get - - if ( distance ) { - - targetArcLength = distance; - - } else { - - targetArcLength = u * arcLengths[ il - 1 ]; - - } - - //var time = Date.now(); - - // binary search for the index with largest value smaller than target u distance - - var low = 0, high = il - 1, comparison; - - while ( low <= high ) { - - i = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - - comparison = arcLengths[ i ] - targetArcLength; - - if ( comparison < 0 ) { - - low = i + 1; - - } else if ( comparison > 0 ) { - - high = i - 1; - - } else { - - high = i; - break; - - // DONE - - } - - } - - i = high; - - //console.log('b' , i, low, high, Date.now()- time); - - if ( arcLengths[ i ] == targetArcLength ) { - - var t = i / ( il - 1 ); - return t; - - } - - // we could get finer grain at lengths, or use simple interpolatation between two points - - var lengthBefore = arcLengths[ i ]; - var lengthAfter = arcLengths[ i + 1 ]; - - var segmentLength = lengthAfter - lengthBefore; - - // determine where we are between the 'before' and 'after' points - - var segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength; - - // add that fractional amount to t - - var t = ( i + segmentFraction ) / ( il - 1 ); - - return t; - -}; - -// Returns a unit vector tangent at t -// In case any sub curve does not implement its tangent derivation, -// 2 points a small delta apart will be used to find its gradient -// which seems to give a reasonable approximation - -THREE.Curve.prototype.getTangent = function( t ) { - - var delta = 0.0001; - var t1 = t - delta; - var t2 = t + delta; - - // Capping in case of danger - - if ( t1 < 0 ) t1 = 0; - if ( t2 > 1 ) t2 = 1; - - var pt1 = this.getPoint( t1 ); - var pt2 = this.getPoint( t2 ); - - var vec = pt2.clone().sub(pt1); - return vec.normalize(); - -}; - - -THREE.Curve.prototype.getTangentAt = function ( u ) { - - var t = this.getUtoTmapping( u ); - return this.getTangent( t ); - -}; - - - - - -/************************************************************** - * Utils - **************************************************************/ - -THREE.Curve.Utils = { - - tangentQuadraticBezier: function ( t, p0, p1, p2 ) { - - return 2 * ( 1 - t ) * ( p1 - p0 ) + 2 * t * ( p2 - p1 ); - - }, - - // Puay Bing, thanks for helping with this derivative! - - tangentCubicBezier: function (t, p0, p1, p2, p3 ) { - - return - 3 * p0 * (1 - t) * (1 - t) + - 3 * p1 * (1 - t) * (1 - t) - 6 * t * p1 * (1 - t) + - 6 * t * p2 * (1 - t) - 3 * t * t * p2 + - 3 * t * t * p3; - - }, - - tangentSpline: function ( t, p0, p1, p2, p3 ) { - - // To check if my formulas are correct - - var h00 = 6 * t * t - 6 * t; // derived from 2t^3 − 3t^2 + 1 - var h10 = 3 * t * t - 4 * t + 1; // t^3 − 2t^2 + t - var h01 = - 6 * t * t + 6 * t; // − 2t3 + 3t2 - var h11 = 3 * t * t - 2 * t; // t3 − t2 - - return h00 + h10 + h01 + h11; - - }, - - // Catmull-Rom - - interpolate: function( p0, p1, p2, p3, t ) { - - var v0 = ( p2 - p0 ) * 0.5; - var v1 = ( p3 - p1 ) * 0.5; - var t2 = t * t; - var t3 = t * t2; - return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - } - -}; - - -// TODO: Transformation for Curves? - -/************************************************************** - * 3D Curves - **************************************************************/ - -// A Factory method for creating new curve subclasses - -THREE.Curve.create = function ( constructor, getPointFunc ) { - - constructor.prototype = Object.create( THREE.Curve.prototype ); - constructor.prototype.constructor = constructor; - constructor.prototype.getPoint = getPointFunc; - - return constructor; - -}; - -// File:src/extras/core/CurvePath.js - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * - **/ - -/************************************************************** - * Curved Path - a curve path is simply a array of connected - * curves, but retains the api of a curve - **************************************************************/ - -THREE.CurvePath = function () { - - this.curves = []; - this.bends = []; - - this.autoClose = false; // Automatically closes the path -}; - -THREE.CurvePath.prototype = Object.create( THREE.Curve.prototype ); -THREE.CurvePath.prototype.constructor = THREE.CurvePath; - -THREE.CurvePath.prototype.add = function ( curve ) { - - this.curves.push( curve ); - -}; - -THREE.CurvePath.prototype.checkConnection = function() { - // TODO - // If the ending of curve is not connected to the starting - // or the next curve, then, this is not a real path -}; - -THREE.CurvePath.prototype.closePath = function() { - // TODO Test - // and verify for vector3 (needs to implement equals) - // Add a line curve if start and end of lines are not connected - var startPoint = this.curves[0].getPoint(0); - var endPoint = this.curves[this.curves.length - 1].getPoint(1); - - if (! startPoint.equals(endPoint)) { - this.curves.push( new THREE.LineCurve(endPoint, startPoint) ); - } - -}; - -// To get accurate point with reference to -// entire path distance at time t, -// following has to be done: - -// 1. Length of each sub path have to be known -// 2. Locate and identify type of curve -// 3. Get t for the curve -// 4. Return curve.getPointAt(t') - -THREE.CurvePath.prototype.getPoint = function( t ) { - - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0, diff, curve; - - // To think about boundaries points. - - while ( i < curveLengths.length ) { - - if ( curveLengths[ i ] >= d ) { - - diff = curveLengths[ i ] - d; - curve = this.curves[ i ]; - - var u = 1 - diff / curve.getLength(); - - return curve.getPointAt( u ); - - } - - i ++; - - } - - return null; - - // loop where sum != 0, sum > d , sum+1 <d - -}; - -/* -THREE.CurvePath.prototype.getTangent = function( t ) { -};*/ - - -// We cannot use the default THREE.Curve getPoint() with getLength() because in -// THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath -// getPoint() depends on getLength - -THREE.CurvePath.prototype.getLength = function() { - - var lens = this.getCurveLengths(); - return lens[ lens.length - 1 ]; - -}; - -// Compute lengths and cache them -// We cannot overwrite getLengths() because UtoT mapping uses it. - -THREE.CurvePath.prototype.getCurveLengths = function() { - - // We use cache values if curves and cache array are same length - - if ( this.cacheLengths && this.cacheLengths.length == this.curves.length ) { - - return this.cacheLengths; - - }; - - // Get length of subsurve - // Push sums into cached array - - var lengths = [], sums = 0; - var i, il = this.curves.length; - - for ( i = 0; i < il; i ++ ) { - - sums += this.curves[ i ].getLength(); - lengths.push( sums ); - - } - - this.cacheLengths = lengths; - - return lengths; - -}; - - - -// Returns min and max coordinates - -THREE.CurvePath.prototype.getBoundingBox = function () { - - var points = this.getPoints(); - - var maxX, maxY, maxZ; - var minX, minY, minZ; - - maxX = maxY = Number.NEGATIVE_INFINITY; - minX = minY = Number.POSITIVE_INFINITY; - - var p, i, il, sum; - - var v3 = points[0] instanceof THREE.Vector3; - - sum = v3 ? new THREE.Vector3() : new THREE.Vector2(); - - for ( i = 0, il = points.length; i < il; i ++ ) { - - p = points[ i ]; - - if ( p.x > maxX ) maxX = p.x; - else if ( p.x < minX ) minX = p.x; - - if ( p.y > maxY ) maxY = p.y; - else if ( p.y < minY ) minY = p.y; - - if ( v3 ) { - - if ( p.z > maxZ ) maxZ = p.z; - else if ( p.z < minZ ) minZ = p.z; - - } - - sum.add( p ); - - } - - var ret = { - - minX: minX, - minY: minY, - maxX: maxX, - maxY: maxY - - }; - - if ( v3 ) { - - ret.maxZ = maxZ; - ret.minZ = minZ; - - } - - return ret; - -}; - -/************************************************************** - * Create Geometries Helpers - **************************************************************/ - -/// Generate geometry from path points (for Line or Points objects) - -THREE.CurvePath.prototype.createPointsGeometry = function( divisions ) { - - var pts = this.getPoints( divisions, true ); - return this.createGeometry( pts ); - -}; - -// Generate geometry from equidistance sampling along the path - -THREE.CurvePath.prototype.createSpacedPointsGeometry = function( divisions ) { - - var pts = this.getSpacedPoints( divisions, true ); - return this.createGeometry( pts ); - -}; - -THREE.CurvePath.prototype.createGeometry = function( points ) { - - var geometry = new THREE.Geometry(); - - for ( var i = 0; i < points.length; i ++ ) { - - geometry.vertices.push( new THREE.Vector3( points[ i ].x, points[ i ].y, points[ i ].z || 0) ); - - } - - return geometry; - -}; - - -/************************************************************** - * Bend / Wrap Helper Methods - **************************************************************/ - -// Wrap path / Bend modifiers? - -THREE.CurvePath.prototype.addWrapPath = function ( bendpath ) { - - this.bends.push( bendpath ); - -}; - -THREE.CurvePath.prototype.getTransformedPoints = function( segments, bends ) { - - var oldPts = this.getPoints( segments ); // getPoints getSpacedPoints - var i, il; - - if ( ! bends ) { - - bends = this.bends; - - } - - for ( i = 0, il = bends.length; i < il; i ++ ) { - - oldPts = this.getWrapPoints( oldPts, bends[ i ] ); - - } - - return oldPts; - -}; - -THREE.CurvePath.prototype.getTransformedSpacedPoints = function( segments, bends ) { - - var oldPts = this.getSpacedPoints( segments ); - - var i, il; - - if ( ! bends ) { - - bends = this.bends; - - } - - for ( i = 0, il = bends.length; i < il; i ++ ) { - - oldPts = this.getWrapPoints( oldPts, bends[ i ] ); - - } - - return oldPts; - -}; - -// This returns getPoints() bend/wrapped around the contour of a path. -// Read http://www.planetclegg.com/projects/WarpingTextToSplines.html - -THREE.CurvePath.prototype.getWrapPoints = function ( oldPts, path ) { - - var bounds = this.getBoundingBox(); - - var i, il, p, oldX, oldY, xNorm; - - for ( i = 0, il = oldPts.length; i < il; i ++ ) { - - p = oldPts[ i ]; - - oldX = p.x; - oldY = p.y; - - xNorm = oldX / bounds.maxX; - - // If using actual distance, for length > path, requires line extrusions - //xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance - - xNorm = path.getUtoTmapping( xNorm, oldX ); - - // check for out of bounds? - - var pathPt = path.getPoint( xNorm ); - var normal = path.getTangent( xNorm ); - normal.set( - normal.y, normal.x ).multiplyScalar( oldY ); - - p.x = pathPt.x + normal.x; - p.y = pathPt.y + normal.y; - - } - - return oldPts; - -}; - - -// File:src/extras/core/Gyroscope.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Gyroscope = function () { - - THREE.Object3D.call( this ); - -}; - -THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype ); -THREE.Gyroscope.prototype.constructor = THREE.Gyroscope; - -THREE.Gyroscope.prototype.updateMatrixWorld = ( function () { - - var translationObject = new THREE.Vector3(); - var quaternionObject = new THREE.Quaternion(); - var scaleObject = new THREE.Vector3(); - - var translationWorld = new THREE.Vector3(); - var quaternionWorld = new THREE.Quaternion(); - var scaleWorld = new THREE.Vector3(); - - return function ( force ) { - - this.matrixAutoUpdate && this.updateMatrix(); - - // update matrixWorld - - if ( this.matrixWorldNeedsUpdate || force ) { - - if ( this.parent ) { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - this.matrixWorld.decompose( translationWorld, quaternionWorld, scaleWorld ); - this.matrix.decompose( translationObject, quaternionObject, scaleObject ); - - this.matrixWorld.compose( translationWorld, quaternionObject, scaleWorld ); - - - } else { - - this.matrixWorld.copy( this.matrix ); - - } - - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].updateMatrixWorld( force ); - - } - - }; - -}() ); - -// File:src/extras/core/Path.js - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Creates free form 2d path using series of points, lines or curves. - * - **/ - -THREE.Path = function ( points ) { - - THREE.CurvePath.call(this); - - this.actions = []; - - if ( points ) { - - this.fromPoints( points ); - - } - -}; - -THREE.Path.prototype = Object.create( THREE.CurvePath.prototype ); -THREE.Path.prototype.constructor = THREE.Path; - -THREE.PathActions = { - - MOVE_TO: 'moveTo', - LINE_TO: 'lineTo', - QUADRATIC_CURVE_TO: 'quadraticCurveTo', // Bezier quadratic curve - BEZIER_CURVE_TO: 'bezierCurveTo', // Bezier cubic curve - CSPLINE_THRU: 'splineThru', // Catmull-rom spline - ARC: 'arc', // Circle - ELLIPSE: 'ellipse' -}; - -// TODO Clean up PATH API - -// Create path using straight lines to connect all points -// - vectors: array of Vector2 - -THREE.Path.prototype.fromPoints = function ( vectors ) { - - this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y ); - - for ( var v = 1, vlen = vectors.length; v < vlen; v ++ ) { - - this.lineTo( vectors[ v ].x, vectors[ v ].y ); - - }; - -}; - -// startPath() endPath()? - -THREE.Path.prototype.moveTo = function ( x, y ) { - - var args = Array.prototype.slice.call( arguments ); - this.actions.push( { action: THREE.PathActions.MOVE_TO, args: args } ); - -}; - -THREE.Path.prototype.lineTo = function ( x, y ) { - - var args = Array.prototype.slice.call( arguments ); - - var lastargs = this.actions[ this.actions.length - 1 ].args; - - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - var curve = new THREE.LineCurve( new THREE.Vector2( x0, y0 ), new THREE.Vector2( x, y ) ); - this.curves.push( curve ); - - this.actions.push( { action: THREE.PathActions.LINE_TO, args: args } ); - -}; - -THREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) { - - var args = Array.prototype.slice.call( arguments ); - - var lastargs = this.actions[ this.actions.length - 1 ].args; - - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - var curve = new THREE.QuadraticBezierCurve( new THREE.Vector2( x0, y0 ), - new THREE.Vector2( aCPx, aCPy ), - new THREE.Vector2( aX, aY ) ); - this.curves.push( curve ); - - this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args } ); - -}; - -THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y, - aCP2x, aCP2y, - aX, aY ) { - - var args = Array.prototype.slice.call( arguments ); - - var lastargs = this.actions[ this.actions.length - 1 ].args; - - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - var curve = new THREE.CubicBezierCurve( new THREE.Vector2( x0, y0 ), - new THREE.Vector2( aCP1x, aCP1y ), - new THREE.Vector2( aCP2x, aCP2y ), - new THREE.Vector2( aX, aY ) ); - this.curves.push( curve ); - - this.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args } ); - -}; - -THREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) { - - var args = Array.prototype.slice.call( arguments ); - var lastargs = this.actions[ this.actions.length - 1 ].args; - - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; -//--- - var npts = [ new THREE.Vector2( x0, y0 ) ]; - Array.prototype.push.apply( npts, pts ); - - var curve = new THREE.SplineCurve( npts ); - this.curves.push( curve ); - - this.actions.push( { action: THREE.PathActions.CSPLINE_THRU, args: args } ); - -}; - -// FUTURE: Change the API or follow canvas API? - -THREE.Path.prototype.arc = function ( aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise ) { - - var lastargs = this.actions[ this.actions.length - 1].args; - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - this.absarc(aX + x0, aY + y0, aRadius, - aStartAngle, aEndAngle, aClockwise ); - - }; - - THREE.Path.prototype.absarc = function ( aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise ) { - this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); - }; - -THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius, - aStartAngle, aEndAngle, aClockwise ) { - - var lastargs = this.actions[ this.actions.length - 1].args; - var x0 = lastargs[ lastargs.length - 2 ]; - var y0 = lastargs[ lastargs.length - 1 ]; - - this.absellipse(aX + x0, aY + y0, xRadius, yRadius, - aStartAngle, aEndAngle, aClockwise ); - - }; - - -THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius, - aStartAngle, aEndAngle, aClockwise ) { - - var args = Array.prototype.slice.call( arguments ); - var curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius, - aStartAngle, aEndAngle, aClockwise ); - this.curves.push( curve ); - - var lastPoint = curve.getPoint(1); - args.push(lastPoint.x); - args.push(lastPoint.y); - - this.actions.push( { action: THREE.PathActions.ELLIPSE, args: args } ); - - }; - -THREE.Path.prototype.getSpacedPoints = function ( divisions, closedPath ) { - - if ( ! divisions ) divisions = 40; - - var points = []; - - for ( var i = 0; i < divisions; i ++ ) { - - points.push( this.getPoint( i / divisions ) ); - - //if( !this.getPoint( i / divisions ) ) throw "DIE"; - - } - - // if ( closedPath ) { - // - // points.push( points[ 0 ] ); - // - // } - - return points; - -}; - -/* Return an array of vectors based on contour of the path */ - -THREE.Path.prototype.getPoints = function( divisions, closedPath ) { - - if (this.useSpacedPoints) { - console.log('tata'); - return this.getSpacedPoints( divisions, closedPath ); - } - - divisions = divisions || 12; - - var points = []; - - var i, il, item, action, args; - var cpx, cpy, cpx2, cpy2, cpx1, cpy1, cpx0, cpy0, - laste, j, - t, tx, ty; - - for ( i = 0, il = this.actions.length; i < il; i ++ ) { - - item = this.actions[ i ]; - - action = item.action; - args = item.args; - - switch ( action ) { - - case THREE.PathActions.MOVE_TO: - - points.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) ); - - break; - - case THREE.PathActions.LINE_TO: - - points.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) ); - - break; - - case THREE.PathActions.QUADRATIC_CURVE_TO: - - cpx = args[ 2 ]; - cpy = args[ 3 ]; - - cpx1 = args[ 0 ]; - cpy1 = args[ 1 ]; - - if ( points.length > 0 ) { - - laste = points[ points.length - 1 ]; - - cpx0 = laste.x; - cpy0 = laste.y; - - } else { - - laste = this.actions[ i - 1 ].args; - - cpx0 = laste[ laste.length - 2 ]; - cpy0 = laste[ laste.length - 1 ]; - - } - - for ( j = 1; j <= divisions; j ++ ) { - - t = j / divisions; - - tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx ); - ty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy ); - - points.push( new THREE.Vector2( tx, ty ) ); - - } - - break; - - case THREE.PathActions.BEZIER_CURVE_TO: - - cpx = args[ 4 ]; - cpy = args[ 5 ]; - - cpx1 = args[ 0 ]; - cpy1 = args[ 1 ]; - - cpx2 = args[ 2 ]; - cpy2 = args[ 3 ]; - - if ( points.length > 0 ) { - - laste = points[ points.length - 1 ]; - - cpx0 = laste.x; - cpy0 = laste.y; - - } else { - - laste = this.actions[ i - 1 ].args; - - cpx0 = laste[ laste.length - 2 ]; - cpy0 = laste[ laste.length - 1 ]; - - } - - - for ( j = 1; j <= divisions; j ++ ) { - - t = j / divisions; - - tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx ); - ty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy ); - - points.push( new THREE.Vector2( tx, ty ) ); - - } - - break; - - case THREE.PathActions.CSPLINE_THRU: - - laste = this.actions[ i - 1 ].args; - - var last = new THREE.Vector2( laste[ laste.length - 2 ], laste[ laste.length - 1 ] ); - var spts = [ last ]; - - var n = divisions * args[ 0 ].length; - - spts = spts.concat( args[ 0 ] ); - - var spline = new THREE.SplineCurve( spts ); - - for ( j = 1; j <= n; j ++ ) { - - points.push( spline.getPointAt( j / n ) ) ; - - } - - break; - - case THREE.PathActions.ARC: - - var aX = args[ 0 ], aY = args[ 1 ], - aRadius = args[ 2 ], - aStartAngle = args[ 3 ], aEndAngle = args[ 4 ], - aClockwise = !! args[ 5 ]; - - var deltaAngle = aEndAngle - aStartAngle; - var angle; - var tdivisions = divisions * 2; - - for ( j = 1; j <= tdivisions; j ++ ) { - - t = j / tdivisions; - - if ( ! aClockwise ) { - - t = 1 - t; - - } - - angle = aStartAngle + t * deltaAngle; - - tx = aX + aRadius * Math.cos( angle ); - ty = aY + aRadius * Math.sin( angle ); - - //console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty); - - points.push( new THREE.Vector2( tx, ty ) ); - - } - - //console.log(points); - - break; - - case THREE.PathActions.ELLIPSE: - - var aX = args[ 0 ], aY = args[ 1 ], - xRadius = args[ 2 ], - yRadius = args[ 3 ], - aStartAngle = args[ 4 ], aEndAngle = args[ 5 ], - aClockwise = !! args[ 6 ]; - - - var deltaAngle = aEndAngle - aStartAngle; - var angle; - var tdivisions = divisions * 2; - - for ( j = 1; j <= tdivisions; j ++ ) { - - t = j / tdivisions; - - if ( ! aClockwise ) { - - t = 1 - t; - - } - - angle = aStartAngle + t * deltaAngle; - - tx = aX + xRadius * Math.cos( angle ); - ty = aY + yRadius * Math.sin( angle ); - - //console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty); - - points.push( new THREE.Vector2( tx, ty ) ); - - } - - //console.log(points); - - break; - - } // end switch - - } - - - - // Normalize to remove the closing point by default. - var lastPoint = points[ points.length - 1]; - var EPSILON = 0.0000000001; - if ( Math.abs(lastPoint.x - points[ 0 ].x) < EPSILON && - Math.abs(lastPoint.y - points[ 0 ].y) < EPSILON) - points.splice( points.length - 1, 1); - if ( closedPath ) { - - points.push( points[ 0 ] ); - - } - - return points; - -}; - -// -// Breaks path into shapes -// -// Assumptions (if parameter isCCW==true the opposite holds): -// - solid shapes are defined clockwise (CW) -// - holes are defined counterclockwise (CCW) -// -// If parameter noHoles==true: -// - all subPaths are regarded as solid shapes -// - definition order CW/CCW has no relevance -// - -THREE.Path.prototype.toShapes = function( isCCW, noHoles ) { - - function extractSubpaths( inActions ) { - - var i, il, item, action, args; - - var subPaths = [], lastPath = new THREE.Path(); - - for ( i = 0, il = inActions.length; i < il; i ++ ) { - - item = inActions[ i ]; - - args = item.args; - action = item.action; - - if ( action == THREE.PathActions.MOVE_TO ) { - - if ( lastPath.actions.length != 0 ) { - - subPaths.push( lastPath ); - lastPath = new THREE.Path(); - - } - - } - - lastPath[ action ].apply( lastPath, args ); - - } - - if ( lastPath.actions.length != 0 ) { - - subPaths.push( lastPath ); - - } - - // console.log(subPaths); - - return subPaths; - } - - function toShapesNoHoles( inSubpaths ) { - - var shapes = []; - - for ( var i = 0, il = inSubpaths.length; i < il; i ++ ) { - - var tmpPath = inSubpaths[ i ]; - - var tmpShape = new THREE.Shape(); - tmpShape.actions = tmpPath.actions; - tmpShape.curves = tmpPath.curves; - - shapes.push( tmpShape ); - } - - //console.log("shape", shapes); - - return shapes; - }; - - function isPointInsidePolygon( inPt, inPolygon ) { - var EPSILON = 0.0000000001; - - var polyLen = inPolygon.length; - - // inPt on polygon contour => immediate success or - // toggling of inside/outside at every single! intersection point of an edge - // with the horizontal line through inPt, left of inPt - // not counting lowerY endpoints of edges and whole edges on that line - var inside = false; - for ( var p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) { - var edgeLowPt = inPolygon[ p ]; - var edgeHighPt = inPolygon[ q ]; - - var edgeDx = edgeHighPt.x - edgeLowPt.x; - var edgeDy = edgeHighPt.y - edgeLowPt.y; - - if ( Math.abs(edgeDy) > EPSILON ) { // not parallel - if ( edgeDy < 0 ) { - edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx; - edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy; - } - if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue; - - if ( inPt.y == edgeLowPt.y ) { - if ( inPt.x == edgeLowPt.x ) return true; // inPt is on contour ? - // continue; // no intersection or edgeLowPt => doesn't count !!! - } else { - var perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); - if ( perpEdge == 0 ) return true; // inPt is on contour ? - if ( perpEdge < 0 ) continue; - inside = ! inside; // true intersection left of inPt - } - } else { // parallel or colinear - if ( inPt.y != edgeLowPt.y ) continue; // parallel - // egde lies on the same horizontal line as inPt - if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) || - ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour ! - // continue; - } - } - - return inside; - } - - - var subPaths = extractSubpaths( this.actions ); - if ( subPaths.length == 0 ) return []; - - if ( noHoles === true ) return toShapesNoHoles( subPaths ); - - - var solid, tmpPath, tmpShape, shapes = []; - - if ( subPaths.length == 1) { - - tmpPath = subPaths[0]; - tmpShape = new THREE.Shape(); - tmpShape.actions = tmpPath.actions; - tmpShape.curves = tmpPath.curves; - shapes.push( tmpShape ); - return shapes; - - } - - var holesFirst = ! THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() ); - holesFirst = isCCW ? ! holesFirst : holesFirst; - - // console.log("Holes first", holesFirst); - - var betterShapeHoles = []; - var newShapes = []; - var newShapeHoles = []; - var mainIdx = 0; - var tmpPoints; - - newShapes[mainIdx] = undefined; - newShapeHoles[mainIdx] = []; - - var i, il; - - for ( i = 0, il = subPaths.length; i < il; i ++ ) { - - tmpPath = subPaths[ i ]; - tmpPoints = tmpPath.getPoints(); - solid = THREE.Shape.Utils.isClockWise( tmpPoints ); - solid = isCCW ? ! solid : solid; - - if ( solid ) { - - if ( (! holesFirst ) && ( newShapes[mainIdx] ) ) mainIdx ++; - - newShapes[mainIdx] = { s: new THREE.Shape(), p: tmpPoints }; - newShapes[mainIdx].s.actions = tmpPath.actions; - newShapes[mainIdx].s.curves = tmpPath.curves; - - if ( holesFirst ) mainIdx ++; - newShapeHoles[mainIdx] = []; - - //console.log('cw', i); - - } else { - - newShapeHoles[mainIdx].push( { h: tmpPath, p: tmpPoints[0] } ); - - //console.log('ccw', i); - - } - - } - - // only Holes? -> probably all Shapes with wrong orientation - if ( ! newShapes[0] ) return toShapesNoHoles( subPaths ); - - - if ( newShapes.length > 1 ) { - var ambigious = false; - var toChange = []; - - for (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) { - betterShapeHoles[sIdx] = []; - } - for (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) { - var sho = newShapeHoles[sIdx]; - for (var hIdx = 0; hIdx < sho.length; hIdx ++ ) { - var ho = sho[hIdx]; - var hole_unassigned = true; - for (var s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) { - if ( isPointInsidePolygon( ho.p, newShapes[s2Idx].p ) ) { - if ( sIdx != s2Idx ) toChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } ); - if ( hole_unassigned ) { - hole_unassigned = false; - betterShapeHoles[s2Idx].push( ho ); - } else { - ambigious = true; - } - } - } - if ( hole_unassigned ) { betterShapeHoles[sIdx].push( ho ); } - } - } - // console.log("ambigious: ", ambigious); - if ( toChange.length > 0 ) { - // console.log("to change: ", toChange); - if (! ambigious) newShapeHoles = betterShapeHoles; - } - } - - var tmpHoles, j, jl; - for ( i = 0, il = newShapes.length; i < il; i ++ ) { - tmpShape = newShapes[i].s; - shapes.push( tmpShape ); - tmpHoles = newShapeHoles[i]; - for ( j = 0, jl = tmpHoles.length; j < jl; j ++ ) { - tmpShape.holes.push( tmpHoles[j].h ); - } - } - - //console.log("shape", shapes); - - return shapes; - -}; - -// File:src/extras/core/Shape.js - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Defines a 2d shape plane using paths. - **/ - -// STEP 1 Create a path. -// STEP 2 Turn path into shape. -// STEP 3 ExtrudeGeometry takes in Shape/Shapes -// STEP 3a - Extract points from each shape, turn to vertices -// STEP 3b - Triangulate each shape, add faces. - -THREE.Shape = function () { - - THREE.Path.apply( this, arguments ); - this.holes = []; - -}; - -THREE.Shape.prototype = Object.create( THREE.Path.prototype ); -THREE.Shape.prototype.constructor = THREE.Shape; - -// Convenience method to return ExtrudeGeometry - -THREE.Shape.prototype.extrude = function ( options ) { - - var extruded = new THREE.ExtrudeGeometry( this, options ); - return extruded; - -}; - -// Convenience method to return ShapeGeometry - -THREE.Shape.prototype.makeGeometry = function ( options ) { - - var geometry = new THREE.ShapeGeometry( this, options ); - return geometry; - -}; - -// Get points of holes - -THREE.Shape.prototype.getPointsHoles = function ( divisions ) { - - var i, il = this.holes.length, holesPts = []; - - for ( i = 0; i < il; i ++ ) { - - holesPts[ i ] = this.holes[ i ].getTransformedPoints( divisions, this.bends ); - - } - - return holesPts; - -}; - -// Get points of holes (spaced by regular distance) - -THREE.Shape.prototype.getSpacedPointsHoles = function ( divisions ) { - - var i, il = this.holes.length, holesPts = []; - - for ( i = 0; i < il; i ++ ) { - - holesPts[ i ] = this.holes[ i ].getTransformedSpacedPoints( divisions, this.bends ); - - } - - return holesPts; - -}; - - -// Get points of shape and holes (keypoints based on segments parameter) - -THREE.Shape.prototype.extractAllPoints = function ( divisions ) { - - return { - - shape: this.getTransformedPoints( divisions ), - holes: this.getPointsHoles( divisions ) - - }; - -}; - -THREE.Shape.prototype.extractPoints = function ( divisions ) { - - if (this.useSpacedPoints) { - return this.extractAllSpacedPoints(divisions); - } - - return this.extractAllPoints(divisions); - -}; - -// -// THREE.Shape.prototype.extractAllPointsWithBend = function ( divisions, bend ) { -// -// return { -// -// shape: this.transform( bend, divisions ), -// holes: this.getPointsHoles( divisions, bend ) -// -// }; -// -// }; - -// Get points of shape and holes (spaced by regular distance) - -THREE.Shape.prototype.extractAllSpacedPoints = function ( divisions ) { - - return { - - shape: this.getTransformedSpacedPoints( divisions ), - holes: this.getSpacedPointsHoles( divisions ) - - }; - -}; - -/************************************************************** - * Utils - **************************************************************/ - -THREE.Shape.Utils = { - - triangulateShape: function ( contour, holes ) { - - function point_in_segment_2D_colin( inSegPt1, inSegPt2, inOtherPt ) { - // inOtherPt needs to be colinear to the inSegment - if ( inSegPt1.x != inSegPt2.x ) { - if ( inSegPt1.x < inSegPt2.x ) { - return ( ( inSegPt1.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt2.x ) ); - } else { - return ( ( inSegPt2.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt1.x ) ); - } - } else { - if ( inSegPt1.y < inSegPt2.y ) { - return ( ( inSegPt1.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt2.y ) ); - } else { - return ( ( inSegPt2.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt1.y ) ); - } - } - } - - function intersect_segments_2D( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1, inSeg2Pt2, inExcludeAdjacentSegs ) { - var EPSILON = 0.0000000001; - - var seg1dx = inSeg1Pt2.x - inSeg1Pt1.x, seg1dy = inSeg1Pt2.y - inSeg1Pt1.y; - var seg2dx = inSeg2Pt2.x - inSeg2Pt1.x, seg2dy = inSeg2Pt2.y - inSeg2Pt1.y; - - var seg1seg2dx = inSeg1Pt1.x - inSeg2Pt1.x; - var seg1seg2dy = inSeg1Pt1.y - inSeg2Pt1.y; - - var limit = seg1dy * seg2dx - seg1dx * seg2dy; - var perpSeg1 = seg1dy * seg1seg2dx - seg1dx * seg1seg2dy; - - if ( Math.abs(limit) > EPSILON ) { // not parallel - - var perpSeg2; - if ( limit > 0 ) { - if ( ( perpSeg1 < 0 ) || ( perpSeg1 > limit ) ) return []; - perpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy; - if ( ( perpSeg2 < 0 ) || ( perpSeg2 > limit ) ) return []; - } else { - if ( ( perpSeg1 > 0 ) || ( perpSeg1 < limit ) ) return []; - perpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy; - if ( ( perpSeg2 > 0 ) || ( perpSeg2 < limit ) ) return []; - } - - // i.e. to reduce rounding errors - // intersection at endpoint of segment#1? - if ( perpSeg2 == 0 ) { - if ( ( inExcludeAdjacentSegs ) && - ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) ) return []; - return [ inSeg1Pt1 ]; - } - if ( perpSeg2 == limit ) { - if ( ( inExcludeAdjacentSegs ) && - ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) ) return []; - return [ inSeg1Pt2 ]; - } - // intersection at endpoint of segment#2? - if ( perpSeg1 == 0 ) return [ inSeg2Pt1 ]; - if ( perpSeg1 == limit ) return [ inSeg2Pt2 ]; - - // return real intersection point - var factorSeg1 = perpSeg2 / limit; - return [ { x: inSeg1Pt1.x + factorSeg1 * seg1dx, - y: inSeg1Pt1.y + factorSeg1 * seg1dy } ]; - - } else { // parallel or colinear - if ( ( perpSeg1 != 0 ) || - ( seg2dy * seg1seg2dx != seg2dx * seg1seg2dy ) ) return []; - - // they are collinear or degenerate - var seg1Pt = ( (seg1dx == 0) && (seg1dy == 0) ); // segment1 ist just a point? - var seg2Pt = ( (seg2dx == 0) && (seg2dy == 0) ); // segment2 ist just a point? - // both segments are points - if ( seg1Pt && seg2Pt ) { - if ( (inSeg1Pt1.x != inSeg2Pt1.x) || - (inSeg1Pt1.y != inSeg2Pt1.y) ) return []; // they are distinct points - return [ inSeg1Pt1 ]; // they are the same point - } - // segment#1 is a single point - if ( seg1Pt ) { - if (! point_in_segment_2D_colin( inSeg2Pt1, inSeg2Pt2, inSeg1Pt1 ) ) return []; // but not in segment#2 - return [ inSeg1Pt1 ]; - } - // segment#2 is a single point - if ( seg2Pt ) { - if (! point_in_segment_2D_colin( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1 ) ) return []; // but not in segment#1 - return [ inSeg2Pt1 ]; - } - - // they are collinear segments, which might overlap - var seg1min, seg1max, seg1minVal, seg1maxVal; - var seg2min, seg2max, seg2minVal, seg2maxVal; - if (seg1dx != 0) { // the segments are NOT on a vertical line - if ( inSeg1Pt1.x < inSeg1Pt2.x ) { - seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.x; - seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.x; - } else { - seg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.x; - seg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.x; - } - if ( inSeg2Pt1.x < inSeg2Pt2.x ) { - seg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.x; - seg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.x; - } else { - seg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.x; - seg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.x; - } - } else { // the segments are on a vertical line - if ( inSeg1Pt1.y < inSeg1Pt2.y ) { - seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.y; - seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.y; - } else { - seg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.y; - seg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.y; - } - if ( inSeg2Pt1.y < inSeg2Pt2.y ) { - seg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.y; - seg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.y; - } else { - seg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.y; - seg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.y; - } - } - if ( seg1minVal <= seg2minVal ) { - if ( seg1maxVal < seg2minVal ) return []; - if ( seg1maxVal == seg2minVal ) { - if ( inExcludeAdjacentSegs ) return []; - return [ seg2min ]; - } - if ( seg1maxVal <= seg2maxVal ) return [ seg2min, seg1max ]; - return [ seg2min, seg2max ]; - } else { - if ( seg1minVal > seg2maxVal ) return []; - if ( seg1minVal == seg2maxVal ) { - if ( inExcludeAdjacentSegs ) return []; - return [ seg1min ]; - } - if ( seg1maxVal <= seg2maxVal ) return [ seg1min, seg1max ]; - return [ seg1min, seg2max ]; - } - } - } - - function isPointInsideAngle( inVertex, inLegFromPt, inLegToPt, inOtherPt ) { - // The order of legs is important - - var EPSILON = 0.0000000001; - - // translation of all points, so that Vertex is at (0,0) - var legFromPtX = inLegFromPt.x - inVertex.x, legFromPtY = inLegFromPt.y - inVertex.y; - var legToPtX = inLegToPt.x - inVertex.x, legToPtY = inLegToPt.y - inVertex.y; - var otherPtX = inOtherPt.x - inVertex.x, otherPtY = inOtherPt.y - inVertex.y; - - // main angle >0: < 180 deg.; 0: 180 deg.; <0: > 180 deg. - var from2toAngle = legFromPtX * legToPtY - legFromPtY * legToPtX; - var from2otherAngle = legFromPtX * otherPtY - legFromPtY * otherPtX; - - if ( Math.abs(from2toAngle) > EPSILON ) { // angle != 180 deg. - - var other2toAngle = otherPtX * legToPtY - otherPtY * legToPtX; - // console.log( "from2to: " + from2toAngle + ", from2other: " + from2otherAngle + ", other2to: " + other2toAngle ); - - if ( from2toAngle > 0 ) { // main angle < 180 deg. - return ( ( from2otherAngle >= 0 ) && ( other2toAngle >= 0 ) ); - } else { // main angle > 180 deg. - return ( ( from2otherAngle >= 0 ) || ( other2toAngle >= 0 ) ); - } - } else { // angle == 180 deg. - // console.log( "from2to: 180 deg., from2other: " + from2otherAngle ); - return ( from2otherAngle > 0 ); - } - } - - - function removeHoles( contour, holes ) { - - var shape = contour.concat(); // work on this shape - var hole; - - function isCutLineInsideAngles( inShapeIdx, inHoleIdx ) { - // Check if hole point lies within angle around shape point - var lastShapeIdx = shape.length - 1; - - var prevShapeIdx = inShapeIdx - 1; - if ( prevShapeIdx < 0 ) prevShapeIdx = lastShapeIdx; - - var nextShapeIdx = inShapeIdx + 1; - if ( nextShapeIdx > lastShapeIdx ) nextShapeIdx = 0; - - var insideAngle = isPointInsideAngle( shape[inShapeIdx], shape[ prevShapeIdx ], shape[ nextShapeIdx ], hole[inHoleIdx] ); - if (! insideAngle ) { - // console.log( "Vertex (Shape): " + inShapeIdx + ", Point: " + hole[inHoleIdx].x + "/" + hole[inHoleIdx].y ); - return false; - } - - // Check if shape point lies within angle around hole point - var lastHoleIdx = hole.length - 1; - - var prevHoleIdx = inHoleIdx - 1; - if ( prevHoleIdx < 0 ) prevHoleIdx = lastHoleIdx; - - var nextHoleIdx = inHoleIdx + 1; - if ( nextHoleIdx > lastHoleIdx ) nextHoleIdx = 0; - - insideAngle = isPointInsideAngle( hole[inHoleIdx], hole[ prevHoleIdx ], hole[ nextHoleIdx ], shape[inShapeIdx] ); - if (! insideAngle ) { - // console.log( "Vertex (Hole): " + inHoleIdx + ", Point: " + shape[inShapeIdx].x + "/" + shape[inShapeIdx].y ); - return false; - } - - return true; - } - - function intersectsShapeEdge( inShapePt, inHolePt ) { - // checks for intersections with shape edges - var sIdx, nextIdx, intersection; - for ( sIdx = 0; sIdx < shape.length; sIdx ++ ) { - nextIdx = sIdx + 1; nextIdx %= shape.length; - intersection = intersect_segments_2D( inShapePt, inHolePt, shape[sIdx], shape[nextIdx], true ); - if ( intersection.length > 0 ) return true; - } - - return false; - } - - var indepHoles = []; - - function intersectsHoleEdge( inShapePt, inHolePt ) { - // checks for intersections with hole edges - var ihIdx, chkHole, - hIdx, nextIdx, intersection; - for ( ihIdx = 0; ihIdx < indepHoles.length; ihIdx ++ ) { - chkHole = holes[indepHoles[ihIdx]]; - for ( hIdx = 0; hIdx < chkHole.length; hIdx ++ ) { - nextIdx = hIdx + 1; nextIdx %= chkHole.length; - intersection = intersect_segments_2D( inShapePt, inHolePt, chkHole[hIdx], chkHole[nextIdx], true ); - if ( intersection.length > 0 ) return true; - } - } - return false; - } - - var holeIndex, shapeIndex, - shapePt, holePt, - holeIdx, cutKey, failedCuts = [], - tmpShape1, tmpShape2, - tmpHole1, tmpHole2; - - for ( var h = 0, hl = holes.length; h < hl; h ++ ) { - - indepHoles.push( h ); - - } - - var minShapeIndex = 0; - var counter = indepHoles.length * 2; - while ( indepHoles.length > 0 ) { - counter --; - if ( counter < 0 ) { - console.log( "Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!" ); - break; - } - - // search for shape-vertex and hole-vertex, - // which can be connected without intersections - for ( shapeIndex = minShapeIndex; shapeIndex < shape.length; shapeIndex ++ ) { - - shapePt = shape[ shapeIndex ]; - holeIndex = - 1; - - // search for hole which can be reached without intersections - for ( var h = 0; h < indepHoles.length; h ++ ) { - holeIdx = indepHoles[h]; - - // prevent multiple checks - cutKey = shapePt.x + ":" + shapePt.y + ":" + holeIdx; - if ( failedCuts[cutKey] !== undefined ) continue; - - hole = holes[holeIdx]; - for ( var h2 = 0; h2 < hole.length; h2 ++ ) { - holePt = hole[ h2 ]; - if (! isCutLineInsideAngles( shapeIndex, h2 ) ) continue; - if ( intersectsShapeEdge( shapePt, holePt ) ) continue; - if ( intersectsHoleEdge( shapePt, holePt ) ) continue; - - holeIndex = h2; - indepHoles.splice(h, 1); - - tmpShape1 = shape.slice( 0, shapeIndex + 1 ); - tmpShape2 = shape.slice( shapeIndex ); - tmpHole1 = hole.slice( holeIndex ); - tmpHole2 = hole.slice( 0, holeIndex + 1 ); - - shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 ); - - minShapeIndex = shapeIndex; - - // Debug only, to show the selected cuts - // glob_CutLines.push( [ shapePt, holePt ] ); - - break; - } - if ( holeIndex >= 0 ) break; // hole-vertex found - - failedCuts[cutKey] = true; // remember failure - } - if ( holeIndex >= 0 ) break; // hole-vertex found - } - } - - return shape; /* shape with no holes */ - } - - - var i, il, f, face, - key, index, - allPointsMap = {}; - - // To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first. - - var allpoints = contour.concat(); - - for ( var h = 0, hl = holes.length; h < hl; h ++ ) { - - Array.prototype.push.apply( allpoints, holes[h] ); - - } - - //console.log( "allpoints",allpoints, allpoints.length ); - - // prepare all points map - - for ( i = 0, il = allpoints.length; i < il; i ++ ) { - - key = allpoints[ i ].x + ":" + allpoints[ i ].y; - - if ( allPointsMap[ key ] !== undefined ) { - - THREE.warn( "THREE.Shape: Duplicate point", key ); - - } - - allPointsMap[ key ] = i; - - } - - // remove holes by cutting paths to holes and adding them to the shape - var shapeWithoutHoles = removeHoles( contour, holes ); - - var triangles = THREE.FontUtils.Triangulate( shapeWithoutHoles, false ); // True returns indices for points of spooled shape - //console.log( "triangles",triangles, triangles.length ); - - // check all face vertices against all points map - - for ( i = 0, il = triangles.length; i < il; i ++ ) { - - face = triangles[ i ]; - - for ( f = 0; f < 3; f ++ ) { - - key = face[ f ].x + ":" + face[ f ].y; - - index = allPointsMap[ key ]; - - if ( index !== undefined ) { - - face[ f ] = index; - - } - - } - - } - - return triangles.concat(); - - }, - - isClockWise: function ( pts ) { - - return THREE.FontUtils.Triangulate.area( pts ) < 0; - - }, - - // Bezier Curves formulas obtained from - // http://en.wikipedia.org/wiki/B%C3%A9zier_curve - - // Quad Bezier Functions - - b2p0: function ( t, p ) { - - var k = 1 - t; - return k * k * p; - - }, - - b2p1: function ( t, p ) { - - return 2 * ( 1 - t ) * t * p; - - }, - - b2p2: function ( t, p ) { - - return t * t * p; - - }, - - b2: function ( t, p0, p1, p2 ) { - - return this.b2p0( t, p0 ) + this.b2p1( t, p1 ) + this.b2p2( t, p2 ); - - }, - - // Cubic Bezier Functions - - b3p0: function ( t, p ) { - - var k = 1 - t; - return k * k * k * p; - - }, - - b3p1: function ( t, p ) { - - var k = 1 - t; - return 3 * k * k * t * p; - - }, - - b3p2: function ( t, p ) { - - var k = 1 - t; - return 3 * k * t * t * p; - - }, - - b3p3: function ( t, p ) { - - return t * t * t * p; - - }, - - b3: function ( t, p0, p1, p2, p3 ) { - - return this.b3p0( t, p0 ) + this.b3p1( t, p1 ) + this.b3p2( t, p2 ) + this.b3p3( t, p3 ); - - } - -}; - - -// File:src/extras/curves/LineCurve.js - -/************************************************************** - * Line - **************************************************************/ - -THREE.LineCurve = function ( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - -}; - -THREE.LineCurve.prototype = Object.create( THREE.Curve.prototype ); -THREE.LineCurve.prototype.constructor = THREE.LineCurve; - -THREE.LineCurve.prototype.getPoint = function ( t ) { - - var point = this.v2.clone().sub(this.v1); - point.multiplyScalar( t ).add( this.v1 ); - - return point; - -}; - -// Line curve is linear, so we can overwrite default getPointAt - -THREE.LineCurve.prototype.getPointAt = function ( u ) { - - return this.getPoint( u ); - -}; - -THREE.LineCurve.prototype.getTangent = function( t ) { - - var tangent = this.v2.clone().sub(this.v1); - - return tangent.normalize(); - -}; - -// File:src/extras/curves/QuadraticBezierCurve.js - -/************************************************************** - * Quadratic Bezier curve - **************************************************************/ - - -THREE.QuadraticBezierCurve = function ( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - -}; - -THREE.QuadraticBezierCurve.prototype = Object.create( THREE.Curve.prototype ); -THREE.QuadraticBezierCurve.prototype.constructor = THREE.QuadraticBezierCurve; - - -THREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) { - - var vector = new THREE.Vector2(); - - vector.x = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x ); - vector.y = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y ); - - return vector; - -}; - - -THREE.QuadraticBezierCurve.prototype.getTangent = function( t ) { - - var vector = new THREE.Vector2(); - - vector.x = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ); - vector.y = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y ); - - // returns unit vector - - return vector.normalize(); - -}; - -// File:src/extras/curves/CubicBezierCurve.js - -/************************************************************** - * Cubic Bezier curve - **************************************************************/ - -THREE.CubicBezierCurve = function ( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - -}; - -THREE.CubicBezierCurve.prototype = Object.create( THREE.Curve.prototype ); -THREE.CubicBezierCurve.prototype.constructor = THREE.CubicBezierCurve; - -THREE.CubicBezierCurve.prototype.getPoint = function ( t ) { - - var tx, ty; - - tx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - ty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - - return new THREE.Vector2( tx, ty ); - -}; - -THREE.CubicBezierCurve.prototype.getTangent = function( t ) { - - var tx, ty; - - tx = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - ty = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - - var tangent = new THREE.Vector2( tx, ty ); - tangent.normalize(); - - return tangent; - -}; - -// File:src/extras/curves/SplineCurve.js - -/************************************************************** - * Spline curve - **************************************************************/ - -THREE.SplineCurve = function ( points /* array of Vector2 */ ) { - - this.points = ( points == undefined ) ? [] : points; - -}; - -THREE.SplineCurve.prototype = Object.create( THREE.Curve.prototype ); -THREE.SplineCurve.prototype.constructor = THREE.SplineCurve; - -THREE.SplineCurve.prototype.getPoint = function ( t ) { - - var points = this.points; - var point = ( points.length - 1 ) * t; - - var intPoint = Math.floor( point ); - var weight = point - intPoint; - - var point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ] - var point1 = points[ intPoint ] - var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ] - var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ] - - var vector = new THREE.Vector2(); - - vector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight ); - vector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight ); - - return vector; - -}; - -// File:src/extras/curves/EllipseCurve.js - -/************************************************************** - * Ellipse curve - **************************************************************/ - -THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) { - - this.aX = aX; - this.aY = aY; - - this.xRadius = xRadius; - this.yRadius = yRadius; - - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - - this.aClockwise = aClockwise; - -}; - -THREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype ); -THREE.EllipseCurve.prototype.constructor = THREE.EllipseCurve; - -THREE.EllipseCurve.prototype.getPoint = function ( t ) { - - var deltaAngle = this.aEndAngle - this.aStartAngle; - - if ( deltaAngle < 0 ) deltaAngle += Math.PI * 2; - if ( deltaAngle > Math.PI * 2 ) deltaAngle -= Math.PI * 2; - - var angle; - - if ( this.aClockwise === true ) { - - angle = this.aEndAngle + ( 1 - t ) * ( Math.PI * 2 - deltaAngle ); - - } else { - - angle = this.aStartAngle + t * deltaAngle; - - } - - var vector = new THREE.Vector2(); - - vector.x = this.aX + this.xRadius * Math.cos( angle ); - vector.y = this.aY + this.yRadius * Math.sin( angle ); - - return vector; - -}; - -// File:src/extras/curves/ArcCurve.js - -/************************************************************** - * Arc curve - **************************************************************/ - -THREE.ArcCurve = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - THREE.EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); -}; - -THREE.ArcCurve.prototype = Object.create( THREE.EllipseCurve.prototype ); -THREE.ArcCurve.prototype.constructor = THREE.ArcCurve; - -// File:src/extras/curves/LineCurve3.js - -/************************************************************** - * Line3D - **************************************************************/ - -THREE.LineCurve3 = THREE.Curve.create( - - function ( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - var vector = new THREE.Vector3(); - - vector.subVectors( this.v2, this.v1 ); // diff - vector.multiplyScalar( t ); - vector.add( this.v1 ); - - return vector; - - } - -); - -// File:src/extras/curves/QuadraticBezierCurve3.js - -/************************************************************** - * Quadratic Bezier 3D curve - **************************************************************/ - -THREE.QuadraticBezierCurve3 = THREE.Curve.create( - - function ( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - var vector = new THREE.Vector3(); - - vector.x = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x ); - vector.y = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y ); - vector.z = THREE.Shape.Utils.b2( t, this.v0.z, this.v1.z, this.v2.z ); - - return vector; - - } - -); - -// File:src/extras/curves/CubicBezierCurve3.js - -/************************************************************** - * Cubic Bezier 3D curve - **************************************************************/ - -THREE.CubicBezierCurve3 = THREE.Curve.create( - - function ( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - }, - - function ( t ) { - - var vector = new THREE.Vector3(); - - vector.x = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ); - vector.y = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ); - vector.z = THREE.Shape.Utils.b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z ); - - return vector; - - } - -); - -// File:src/extras/curves/SplineCurve3.js - -/************************************************************** - * Spline 3D curve - **************************************************************/ - - -THREE.SplineCurve3 = THREE.Curve.create( - - function ( points /* array of Vector3 */) { - - this.points = ( points == undefined ) ? [] : points; - - }, - - function ( t ) { - - var points = this.points; - var point = ( points.length - 1 ) * t; - - var intPoint = Math.floor( point ); - var weight = point - intPoint; - - var point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ]; - var point1 = points[ intPoint ]; - var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ]; - var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ]; - - var vector = new THREE.Vector3(); - - vector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight ); - vector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight ); - vector.z = THREE.Curve.Utils.interpolate( point0.z, point1.z, point2.z, point3.z, weight ); - - return vector; - - } - -); - -// File:src/extras/curves/ClosedSplineCurve3.js - -/************************************************************** - * Closed Spline 3D curve - **************************************************************/ - - -THREE.ClosedSplineCurve3 = THREE.Curve.create( - - function ( points /* array of Vector3 */) { - - this.points = ( points == undefined ) ? [] : points; - - }, - - function ( t ) { - - var points = this.points; - var point = ( points.length - 0 ) * t; // This needs to be from 0-length +1 - - var intPoint = Math.floor( point ); - var weight = point - intPoint; - - intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length; - - var point0 = points[ ( intPoint - 1 ) % points.length ]; - var point1 = points[ ( intPoint ) % points.length ]; - var point2 = points[ ( intPoint + 1 ) % points.length ]; - var point3 = points[ ( intPoint + 2 ) % points.length ]; - - var vector = new THREE.Vector3(); - - vector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight ); - vector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight ); - vector.z = THREE.Curve.Utils.interpolate( point0.z, point1.z, point2.z, point3.z, weight ); - - return vector; - - } - -); - -// File:src/extras/animation/AnimationHandler.js - -/** - * @author mikael emtinger / http://gomo.se/ - */ - -THREE.AnimationHandler = { - - LINEAR: 0, - CATMULLROM: 1, - CATMULLROM_FORWARD: 2, - - // - - add: function () { THREE.warn( 'THREE.AnimationHandler.add() has been deprecated.' ); }, - get: function () { THREE.warn( 'THREE.AnimationHandler.get() has been deprecated.' ); }, - remove: function () { THREE.warn( 'THREE.AnimationHandler.remove() has been deprecated.' ); }, - - // - - animations: [], - - init: function ( data ) { - - if ( data.initialized === true ) return data; - - // loop through all keys - - for ( var h = 0; h < data.hierarchy.length; h ++ ) { - - for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) { - - // remove minus times - - if ( data.hierarchy[ h ].keys[ k ].time < 0 ) { - - data.hierarchy[ h ].keys[ k ].time = 0; - - } - - // create quaternions - - if ( data.hierarchy[ h ].keys[ k ].rot !== undefined && - ! ( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) { - - var quat = data.hierarchy[ h ].keys[ k ].rot; - data.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion().fromArray( quat ); - - } - - } - - // prepare morph target keys - - if ( data.hierarchy[ h ].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) { - - // get all used - - var usedMorphTargets = {}; - - for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) { - - for ( var m = 0; m < data.hierarchy[ h ].keys[ k ].morphTargets.length; m ++ ) { - - var morphTargetName = data.hierarchy[ h ].keys[ k ].morphTargets[ m ]; - usedMorphTargets[ morphTargetName ] = - 1; - - } - - } - - data.hierarchy[ h ].usedMorphTargets = usedMorphTargets; - - - // set all used on all frames - - for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) { - - var influences = {}; - - for ( var morphTargetName in usedMorphTargets ) { - - for ( var m = 0; m < data.hierarchy[ h ].keys[ k ].morphTargets.length; m ++ ) { - - if ( data.hierarchy[ h ].keys[ k ].morphTargets[ m ] === morphTargetName ) { - - influences[ morphTargetName ] = data.hierarchy[ h ].keys[ k ].morphTargetsInfluences[ m ]; - break; - - } - - } - - if ( m === data.hierarchy[ h ].keys[ k ].morphTargets.length ) { - - influences[ morphTargetName ] = 0; - - } - - } - - data.hierarchy[ h ].keys[ k ].morphTargetsInfluences = influences; - - } - - } - - - // remove all keys that are on the same time - - for ( var k = 1; k < data.hierarchy[ h ].keys.length; k ++ ) { - - if ( data.hierarchy[ h ].keys[ k ].time === data.hierarchy[ h ].keys[ k - 1 ].time ) { - - data.hierarchy[ h ].keys.splice( k, 1 ); - k --; - - } - - } - - - // set index - - for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) { - - data.hierarchy[ h ].keys[ k ].index = k; - - } - - } - - data.initialized = true; - - return data; - - }, - - parse: function ( root ) { - - var parseRecurseHierarchy = function ( root, hierarchy ) { - - hierarchy.push( root ); - - for ( var c = 0; c < root.children.length; c ++ ) - parseRecurseHierarchy( root.children[ c ], hierarchy ); - - }; - - // setup hierarchy - - var hierarchy = []; - - if ( root instanceof THREE.SkinnedMesh ) { - - for ( var b = 0; b < root.skeleton.bones.length; b ++ ) { - - hierarchy.push( root.skeleton.bones[ b ] ); - - } - - } else { - - parseRecurseHierarchy( root, hierarchy ); - - } - - return hierarchy; - - }, - - play: function ( animation ) { - - if ( this.animations.indexOf( animation ) === - 1 ) { - - this.animations.push( animation ); - - } - - }, - - stop: function ( animation ) { - - var index = this.animations.indexOf( animation ); - - if ( index !== - 1 ) { - - this.animations.splice( index, 1 ); - - } - - }, - - update: function ( deltaTimeMS ) { - - for ( var i = 0; i < this.animations.length; i ++ ) { - - this.animations[ i ].resetBlendWeights( ); - - } - - for ( var i = 0; i < this.animations.length; i ++ ) { - - this.animations[ i ].update( deltaTimeMS ); - - } - - } - -}; - -// File:src/extras/animation/Animation.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.Animation = function ( root, data ) { - - this.root = root; - this.data = THREE.AnimationHandler.init( data ); - this.hierarchy = THREE.AnimationHandler.parse( root ); - - this.currentTime = 0; - this.timeScale = 1; - - this.isPlaying = false; - this.loop = true; - this.weight = 0; - - this.interpolationType = THREE.AnimationHandler.LINEAR; - -}; - -THREE.Animation.prototype = { - - constructor: THREE.Animation, - - keyTypes: [ "pos", "rot", "scl" ], - - play: function ( startTime, weight ) { - - this.currentTime = startTime !== undefined ? startTime : 0; - this.weight = weight !== undefined ? weight : 1; - - this.isPlaying = true; - - this.reset(); - - THREE.AnimationHandler.play( this ); - - }, - - stop: function() { - - this.isPlaying = false; - - THREE.AnimationHandler.stop( this ); - - }, - - reset: function () { - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - - var object = this.hierarchy[ h ]; - - if ( object.animationCache === undefined ) { - - object.animationCache = { - animations: {}, - blending: { - positionWeight: 0.0, - quaternionWeight: 0.0, - scaleWeight: 0.0 - } - }; - } - - var name = this.data.name; - var animations = object.animationCache.animations; - var animationCache = animations[ name ]; - - if ( animationCache === undefined ) { - - animationCache = { - prevKey: { pos: 0, rot: 0, scl: 0 }, - nextKey: { pos: 0, rot: 0, scl: 0 }, - originalMatrix: object.matrix - }; - - animations[ name ] = animationCache; - - } - - // Get keys to match our current time - - for ( var t = 0; t < 3; t ++ ) { - - var type = this.keyTypes[ t ]; - - var prevKey = this.data.hierarchy[ h ].keys[ 0 ]; - var nextKey = this.getNextKeyWith( type, h, 1 ); - - while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { - - prevKey = nextKey; - nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 ); - - } - - animationCache.prevKey[ type ] = prevKey; - animationCache.nextKey[ type ] = nextKey; - - } - - } - - }, - - resetBlendWeights: function () { - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - - var object = this.hierarchy[ h ]; - var animationCache = object.animationCache; - - if ( animationCache !== undefined ) { - - var blending = animationCache.blending; - - blending.positionWeight = 0.0; - blending.quaternionWeight = 0.0; - blending.scaleWeight = 0.0; - - } - - } - - }, - - update: ( function() { - - var points = []; - var target = new THREE.Vector3(); - var newVector = new THREE.Vector3(); - var newQuat = new THREE.Quaternion(); - - // Catmull-Rom spline - - var interpolateCatmullRom = function ( points, scale ) { - - var c = [], v3 = [], - point, intPoint, weight, w2, w3, - pa, pb, pc, pd; - - point = ( points.length - 1 ) * scale; - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1; - c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2; - - pa = points[ c[ 0 ] ]; - pb = points[ c[ 1 ] ]; - pc = points[ c[ 2 ] ]; - pd = points[ c[ 3 ] ]; - - w2 = weight * weight; - w3 = weight * w2; - - v3[ 0 ] = interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 ); - v3[ 1 ] = interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 ); - v3[ 2 ] = interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 ); - - return v3; - - }; - - var interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) { - - var v0 = ( p2 - p0 ) * 0.5, - v1 = ( p3 - p1 ) * 0.5; - - return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - }; - - return function ( delta ) { - - if ( this.isPlaying === false ) return; - - this.currentTime += delta * this.timeScale; - - if ( this.weight === 0 ) - return; - - // - - var duration = this.data.length; - - if ( this.currentTime > duration || this.currentTime < 0 ) { - - if ( this.loop ) { - - this.currentTime %= duration; - - if ( this.currentTime < 0 ) - this.currentTime += duration; - - this.reset(); - - } else { - - this.stop(); - - } - - } - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - - var object = this.hierarchy[ h ]; - var animationCache = object.animationCache.animations[this.data.name]; - var blending = object.animationCache.blending; - - // loop through pos/rot/scl - - for ( var t = 0; t < 3; t ++ ) { - - // get keys - - var type = this.keyTypes[ t ]; - var prevKey = animationCache.prevKey[ type ]; - var nextKey = animationCache.nextKey[ type ]; - - if ( ( this.timeScale > 0 && nextKey.time <= this.currentTime ) || - ( this.timeScale < 0 && prevKey.time >= this.currentTime ) ) { - - prevKey = this.data.hierarchy[ h ].keys[ 0 ]; - nextKey = this.getNextKeyWith( type, h, 1 ); - - while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { - - prevKey = nextKey; - nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 ); - - } - - animationCache.prevKey[ type ] = prevKey; - animationCache.nextKey[ type ] = nextKey; - - } - - var scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time ); - - var prevXYZ = prevKey[ type ]; - var nextXYZ = nextKey[ type ]; - - if ( scale < 0 ) scale = 0; - if ( scale > 1 ) scale = 1; - - // interpolate - - if ( type === "pos" ) { - - if ( this.interpolationType === THREE.AnimationHandler.LINEAR ) { - - newVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; - newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; - newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; - - // blend - var proportionalWeight = this.weight / ( this.weight + blending.positionWeight ); - object.position.lerp( newVector, proportionalWeight ); - blending.positionWeight += this.weight; - - } else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || - this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ]; - points[ 1 ] = prevXYZ; - points[ 2 ] = nextXYZ; - points[ 3 ] = this.getNextKeyWith( "pos", h, nextKey.index + 1 )[ "pos" ]; - - scale = scale * 0.33 + 0.33; - - var currentPoint = interpolateCatmullRom( points, scale ); - var proportionalWeight = this.weight / ( this.weight + blending.positionWeight ); - blending.positionWeight += this.weight; - - // blend - - var vector = object.position; - - vector.x = vector.x + ( currentPoint[ 0 ] - vector.x ) * proportionalWeight; - vector.y = vector.y + ( currentPoint[ 1 ] - vector.y ) * proportionalWeight; - vector.z = vector.z + ( currentPoint[ 2 ] - vector.z ) * proportionalWeight; - - if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - var forwardPoint = interpolateCatmullRom( points, scale * 1.01 ); - - target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] ); - target.sub( vector ); - target.y = 0; - target.normalize(); - - var angle = Math.atan2( target.x, target.z ); - object.rotation.set( 0, angle, 0 ); - - } - - } - - } else if ( type === "rot" ) { - - THREE.Quaternion.slerp( prevXYZ, nextXYZ, newQuat, scale ); - - // Avoid paying the cost of an additional slerp if we don't have to - if ( blending.quaternionWeight === 0 ) { - - object.quaternion.copy(newQuat); - blending.quaternionWeight = this.weight; - - } else { - - var proportionalWeight = this.weight / ( this.weight + blending.quaternionWeight ); - THREE.Quaternion.slerp( object.quaternion, newQuat, object.quaternion, proportionalWeight ); - blending.quaternionWeight += this.weight; - - } - - } else if ( type === "scl" ) { - - newVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; - newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; - newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; - - var proportionalWeight = this.weight / ( this.weight + blending.scaleWeight ); - object.scale.lerp( newVector, proportionalWeight ); - blending.scaleWeight += this.weight; - - } - - } - - } - - return true; - - }; - - } )(), - - getNextKeyWith: function ( type, h, key ) { - - var keys = this.data.hierarchy[ h ].keys; - - if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || - this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - key = key < keys.length - 1 ? key : keys.length - 1; - - } else { - - key = key % keys.length; - - } - - for ( ; key < keys.length; key ++ ) { - - if ( keys[ key ][ type ] !== undefined ) { - - return keys[ key ]; - - } - - } - - return this.data.hierarchy[ h ].keys[ 0 ]; - - }, - - getPrevKeyWith: function ( type, h, key ) { - - var keys = this.data.hierarchy[ h ].keys; - - if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || - this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - - key = key > 0 ? key : 0; - - } else { - - key = key >= 0 ? key : key + keys.length; - - } - - - for ( ; key >= 0; key -- ) { - - if ( keys[ key ][ type ] !== undefined ) { - - return keys[ key ]; - - } - - } - - return this.data.hierarchy[ h ].keys[ keys.length - 1 ]; - - } - -}; - -// File:src/extras/animation/KeyFrameAnimation.js - -/** - * @author mikael emtinger / http://gomo.se/ - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author khang duong - * @author erik kitson - */ - -THREE.KeyFrameAnimation = function ( data ) { - - this.root = data.node; - this.data = THREE.AnimationHandler.init( data ); - this.hierarchy = THREE.AnimationHandler.parse( this.root ); - this.currentTime = 0; - this.timeScale = 0.001; - this.isPlaying = false; - this.isPaused = true; - this.loop = true; - - // initialize to first keyframes - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - - var keys = this.data.hierarchy[h].keys, - sids = this.data.hierarchy[h].sids, - obj = this.hierarchy[h]; - - if ( keys.length && sids ) { - - for ( var s = 0; s < sids.length; s ++ ) { - - var sid = sids[ s ], - next = this.getNextKeyWith( sid, h, 0 ); - - if ( next ) { - - next.apply( sid ); - - } - - } - - obj.matrixAutoUpdate = false; - this.data.hierarchy[h].node.updateMatrix(); - obj.matrixWorldNeedsUpdate = true; - - } - - } - -}; - -THREE.KeyFrameAnimation.prototype = { - - constructor: THREE.KeyFrameAnimation, - - play: function ( startTime ) { - - this.currentTime = startTime !== undefined ? startTime : 0; - - if ( this.isPlaying === false ) { - - this.isPlaying = true; - - // reset key cache - - var h, hl = this.hierarchy.length, - object, - node; - - for ( h = 0; h < hl; h ++ ) { - - object = this.hierarchy[ h ]; - node = this.data.hierarchy[ h ]; - - if ( node.animationCache === undefined ) { - - node.animationCache = {}; - node.animationCache.prevKey = null; - node.animationCache.nextKey = null; - node.animationCache.originalMatrix = object.matrix; - - } - - var keys = this.data.hierarchy[h].keys; - - if (keys.length) { - - node.animationCache.prevKey = keys[ 0 ]; - node.animationCache.nextKey = keys[ 1 ]; - - this.startTime = Math.min( keys[0].time, this.startTime ); - this.endTime = Math.max( keys[keys.length - 1].time, this.endTime ); - - } - - } - - this.update( 0 ); - - } - - this.isPaused = false; - - THREE.AnimationHandler.play( this ); - - }, - - stop: function () { - - this.isPlaying = false; - this.isPaused = false; - - THREE.AnimationHandler.stop( this ); - - // reset JIT matrix and remove cache - - for ( var h = 0; h < this.data.hierarchy.length; h ++ ) { - - var obj = this.hierarchy[ h ]; - var node = this.data.hierarchy[ h ]; - - if ( node.animationCache !== undefined ) { - - var original = node.animationCache.originalMatrix; - - original.copy( obj.matrix ); - obj.matrix = original; - - delete node.animationCache; - - } - - } - - }, - - update: function ( delta ) { - - if ( this.isPlaying === false ) return; - - this.currentTime += delta * this.timeScale; - - // - - var duration = this.data.length; - - if ( this.loop === true && this.currentTime > duration ) { - - this.currentTime %= duration; - - } - - this.currentTime = Math.min( this.currentTime, duration ); - - for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - - var object = this.hierarchy[ h ]; - var node = this.data.hierarchy[ h ]; - - var keys = node.keys, - animationCache = node.animationCache; - - - if ( keys.length ) { - - var prevKey = animationCache.prevKey; - var nextKey = animationCache.nextKey; - - if ( nextKey.time <= this.currentTime ) { - - while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { - - prevKey = nextKey; - nextKey = keys[ prevKey.index + 1 ]; - - } - - animationCache.prevKey = prevKey; - animationCache.nextKey = nextKey; - - } - - if ( nextKey.time >= this.currentTime ) { - - prevKey.interpolate( nextKey, this.currentTime ); - - } else { - - prevKey.interpolate( nextKey, nextKey.time ); - - } - - this.data.hierarchy[ h ].node.updateMatrix(); - object.matrixWorldNeedsUpdate = true; - - } - - } - - }, - - getNextKeyWith: function ( sid, h, key ) { - - var keys = this.data.hierarchy[ h ].keys; - key = key % keys.length; - - for ( ; key < keys.length; key ++ ) { - - if ( keys[ key ].hasTarget( sid ) ) { - - return keys[ key ]; - - } - - } - - return keys[ 0 ]; - - }, - - getPrevKeyWith: function ( sid, h, key ) { - - var keys = this.data.hierarchy[ h ].keys; - key = key >= 0 ? key : key + keys.length; - - for ( ; key >= 0; key -- ) { - - if ( keys[ key ].hasTarget( sid ) ) { - - return keys[ key ]; - - } - - } - - return keys[ keys.length - 1 ]; - - } - -}; - -// File:src/extras/animation/MorphAnimation.js - -/** - * @author mrdoob / http://mrdoob.com - * @author willy-vvu / http://willy-vvu.github.io - */ - -THREE.MorphAnimation = function ( mesh ) { - - this.mesh = mesh; - this.frames = mesh.morphTargetInfluences.length; - this.currentTime = 0; - this.duration = 1000; - this.loop = true; - this.lastFrame = 0; - this.currentFrame = 0; - - this.isPlaying = false; - -}; - -THREE.MorphAnimation.prototype = { - - constructor: THREE.MorphAnimation, - - play: function () { - - this.isPlaying = true; - - }, - - pause: function () { - - this.isPlaying = false; - - }, - - update: function ( delta ) { - - if ( this.isPlaying === false ) return; - - this.currentTime += delta; - - if ( this.loop === true && this.currentTime > this.duration ) { - - this.currentTime %= this.duration; - - } - - this.currentTime = Math.min( this.currentTime, this.duration ); - - var interpolation = this.duration / this.frames; - var frame = Math.floor( this.currentTime / interpolation ); - - var influences = this.mesh.morphTargetInfluences; - - if ( frame != this.currentFrame ) { - - influences[ this.lastFrame ] = 0; - influences[ this.currentFrame ] = 1; - influences[ frame ] = 0; - - this.lastFrame = this.currentFrame; - this.currentFrame = frame; - - } - - influences[ frame ] = ( this.currentTime % interpolation ) / interpolation; - influences[ this.lastFrame ] = 1 - influences[ frame ]; - - } - -}; - -// File:src/extras/geometries/BoxGeometry.js - -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as - */ - -THREE.BoxGeometry = function ( width, height, depth, widthSegments, heightSegments, depthSegments ) { - - THREE.Geometry.call( this ); - - this.type = 'BoxGeometry'; - - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - this.depthSegments = depthSegments || 1; - - var scope = this; - - var width_half = width / 2; - var height_half = height / 2; - var depth_half = depth / 2; - - buildPlane( 'z', 'y', - 1, - 1, depth, height, width_half, 0 ); // px - buildPlane( 'z', 'y', 1, - 1, depth, height, - width_half, 1 ); // nx - buildPlane( 'x', 'z', 1, 1, width, depth, height_half, 2 ); // py - buildPlane( 'x', 'z', 1, - 1, width, depth, - height_half, 3 ); // ny - buildPlane( 'x', 'y', 1, - 1, width, height, depth_half, 4 ); // pz - buildPlane( 'x', 'y', - 1, - 1, width, height, - depth_half, 5 ); // nz - - function buildPlane( u, v, udir, vdir, width, height, depth, materialIndex ) { - - var w, ix, iy, - gridX = scope.widthSegments, - gridY = scope.heightSegments, - width_half = width / 2, - height_half = height / 2, - offset = scope.vertices.length; - - if ( ( u === 'x' && v === 'y' ) || ( u === 'y' && v === 'x' ) ) { - - w = 'z'; - - } else if ( ( u === 'x' && v === 'z' ) || ( u === 'z' && v === 'x' ) ) { - - w = 'y'; - gridY = scope.depthSegments; - - } else if ( ( u === 'z' && v === 'y' ) || ( u === 'y' && v === 'z' ) ) { - - w = 'x'; - gridX = scope.depthSegments; - - } - - var gridX1 = gridX + 1, - gridY1 = gridY + 1, - segment_width = width / gridX, - segment_height = height / gridY, - normal = new THREE.Vector3(); - - normal[ w ] = depth > 0 ? 1 : - 1; - - for ( iy = 0; iy < gridY1; iy ++ ) { - - for ( ix = 0; ix < gridX1; ix ++ ) { - - var vector = new THREE.Vector3(); - vector[ u ] = ( ix * segment_width - width_half ) * udir; - vector[ v ] = ( iy * segment_height - height_half ) * vdir; - vector[ w ] = depth; - - scope.vertices.push( vector ); - - } - - } - - for ( iy = 0; iy < gridY; iy ++ ) { - - for ( ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - var uva = new THREE.Vector2( ix / gridX, 1 - iy / gridY ); - var uvb = new THREE.Vector2( ix / gridX, 1 - ( iy + 1 ) / gridY ); - var uvc = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - ( iy + 1 ) / gridY ); - var uvd = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - iy / gridY ); - - var face = new THREE.Face3( a + offset, b + offset, d + offset ); - face.normal.copy( normal ); - face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() ); - face.materialIndex = materialIndex; - - scope.faces.push( face ); - scope.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - face = new THREE.Face3( b + offset, c + offset, d + offset ); - face.normal.copy( normal ); - face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() ); - face.materialIndex = materialIndex; - - scope.faces.push( face ); - scope.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - - } - - } - - this.mergeVertices(); - -}; - -THREE.BoxGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.BoxGeometry.prototype.constructor = THREE.BoxGeometry; - -// File:src/extras/geometries/CircleGeometry.js - -/** - * @author hughes - */ - -THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) { - - THREE.Geometry.call( this ); - - this.type = 'CircleGeometry'; - - this.parameters = { - radius: radius, - segments: segments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - radius = radius || 50; - segments = segments !== undefined ? Math.max( 3, segments ) : 8; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - var i, uvs = [], - center = new THREE.Vector3(), centerUV = new THREE.Vector2( 0.5, 0.5 ); - - this.vertices.push(center); - uvs.push( centerUV ); - - for ( i = 0; i <= segments; i ++ ) { - - var vertex = new THREE.Vector3(); - var segment = thetaStart + i / segments * thetaLength; - - vertex.x = radius * Math.cos( segment ); - vertex.y = radius * Math.sin( segment ); - - this.vertices.push( vertex ); - uvs.push( new THREE.Vector2( ( vertex.x / radius + 1 ) / 2, ( vertex.y / radius + 1 ) / 2 ) ); - - } - - var n = new THREE.Vector3( 0, 0, 1 ); - - for ( i = 1; i <= segments; i ++ ) { - - this.faces.push( new THREE.Face3( i, i + 1, 0, [ n.clone(), n.clone(), n.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uvs[ i ].clone(), uvs[ i + 1 ].clone(), centerUV.clone() ] ); - - } - - this.computeFaceNormals(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - -}; - -THREE.CircleGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.CircleGeometry.prototype.constructor = THREE.CircleGeometry; - -// File:src/extras/geometries/CubeGeometry.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - - -THREE.CubeGeometry = function ( width, height, depth, widthSegments, heightSegments, depthSegments ) { - - THREE.warn( 'THREE.CubeGeometry has been renamed to THREE.BoxGeometry.' ); - return new THREE.BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ); - - }; - -// File:src/extras/geometries/CylinderGeometry.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) { - - THREE.Geometry.call( this ); - - this.type = 'CylinderGeometry'; - - this.parameters = { - radiusTop: radiusTop, - radiusBottom: radiusBottom, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - radiusTop = radiusTop !== undefined ? radiusTop : 20; - radiusBottom = radiusBottom !== undefined ? radiusBottom : 20; - height = height !== undefined ? height : 100; - - radialSegments = radialSegments || 8; - heightSegments = heightSegments || 1; - - openEnded = openEnded !== undefined ? openEnded : false; - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : 2 * Math.PI; - - var heightHalf = height / 2; - - var x, y, vertices = [], uvs = []; - - for ( y = 0; y <= heightSegments; y ++ ) { - - var verticesRow = []; - var uvsRow = []; - - var v = y / heightSegments; - var radius = v * ( radiusBottom - radiusTop ) + radiusTop; - - for ( x = 0; x <= radialSegments; x ++ ) { - - var u = x / radialSegments; - - var vertex = new THREE.Vector3(); - vertex.x = radius * Math.sin( u * thetaLength + thetaStart ); - vertex.y = - v * height + heightHalf; - vertex.z = radius * Math.cos( u * thetaLength + thetaStart ); - - this.vertices.push( vertex ); - - verticesRow.push( this.vertices.length - 1 ); - uvsRow.push( new THREE.Vector2( u, 1 - v ) ); - - } - - vertices.push( verticesRow ); - uvs.push( uvsRow ); - - } - - var tanTheta = ( radiusBottom - radiusTop ) / height; - var na, nb; - - for ( x = 0; x < radialSegments; x ++ ) { - - if ( radiusTop !== 0 ) { - - na = this.vertices[ vertices[ 0 ][ x ] ].clone(); - nb = this.vertices[ vertices[ 0 ][ x + 1 ] ].clone(); - - } else { - - na = this.vertices[ vertices[ 1 ][ x ] ].clone(); - nb = this.vertices[ vertices[ 1 ][ x + 1 ] ].clone(); - - } - - na.setY( Math.sqrt( na.x * na.x + na.z * na.z ) * tanTheta ).normalize(); - nb.setY( Math.sqrt( nb.x * nb.x + nb.z * nb.z ) * tanTheta ).normalize(); - - for ( y = 0; y < heightSegments; y ++ ) { - - var v1 = vertices[ y ][ x ]; - var v2 = vertices[ y + 1 ][ x ]; - var v3 = vertices[ y + 1 ][ x + 1 ]; - var v4 = vertices[ y ][ x + 1 ]; - - var n1 = na.clone(); - var n2 = na.clone(); - var n3 = nb.clone(); - var n4 = nb.clone(); - - var uv1 = uvs[ y ][ x ].clone(); - var uv2 = uvs[ y + 1 ][ x ].clone(); - var uv3 = uvs[ y + 1 ][ x + 1 ].clone(); - var uv4 = uvs[ y ][ x + 1 ].clone(); - - this.faces.push( new THREE.Face3( v1, v2, v4, [ n1, n2, n4 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv4 ] ); - - this.faces.push( new THREE.Face3( v2, v3, v4, [ n2.clone(), n3, n4.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv2.clone(), uv3, uv4.clone() ] ); - - } - - } - - // top cap - - if ( openEnded === false && radiusTop > 0 ) { - - this.vertices.push( new THREE.Vector3( 0, heightHalf, 0 ) ); - - for ( x = 0; x < radialSegments; x ++ ) { - - var v1 = vertices[ 0 ][ x ]; - var v2 = vertices[ 0 ][ x + 1 ]; - var v3 = this.vertices.length - 1; - - var n1 = new THREE.Vector3( 0, 1, 0 ); - var n2 = new THREE.Vector3( 0, 1, 0 ); - var n3 = new THREE.Vector3( 0, 1, 0 ); - - var uv1 = uvs[ 0 ][ x ].clone(); - var uv2 = uvs[ 0 ][ x + 1 ].clone(); - var uv3 = new THREE.Vector2( uv2.x, 0 ); - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); - - } - - } - - // bottom cap - - if ( openEnded === false && radiusBottom > 0 ) { - - this.vertices.push( new THREE.Vector3( 0, - heightHalf, 0 ) ); - - for ( x = 0; x < radialSegments; x ++ ) { - - var v1 = vertices[ heightSegments ][ x + 1 ]; - var v2 = vertices[ heightSegments ][ x ]; - var v3 = this.vertices.length - 1; - - var n1 = new THREE.Vector3( 0, - 1, 0 ); - var n2 = new THREE.Vector3( 0, - 1, 0 ); - var n3 = new THREE.Vector3( 0, - 1, 0 ); - - var uv1 = uvs[ heightSegments ][ x + 1 ].clone(); - var uv2 = uvs[ heightSegments ][ x ].clone(); - var uv3 = new THREE.Vector2( uv2.x, 1 ); - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); - - } - - } - - this.computeFaceNormals(); - -}; - -THREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.CylinderGeometry.prototype.constructor = THREE.CylinderGeometry; - -// File:src/extras/geometries/ExtrudeGeometry.js - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * - * Creates extruded geometry from a path shape. - * - * parameters = { - * - * curveSegments: <int>, // number of points on the curves - * steps: <int>, // number of points for z-side extrusions / used for subdividing segements of extrude spline too - * amount: <int>, // Depth to extrude the shape - * - * bevelEnabled: <bool>, // turn on bevel - * bevelThickness: <float>, // how deep into the original shape bevel goes - * bevelSize: <float>, // how far from shape outline is bevel - * bevelSegments: <int>, // number of bevel layers - * - * extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined) - * frames: <THREE.TubeGeometry.FrenetFrames> // containing arrays of tangents, normals, binormals - * - * material: <int> // material index for front and back faces - * extrudeMaterial: <int> // material index for extrusion and beveled faces - * uvGenerator: <Object> // object that provides UV generator functions - * - * } - **/ - -THREE.ExtrudeGeometry = function ( shapes, options ) { - - if ( typeof( shapes ) === "undefined" ) { - shapes = []; - return; - } - - THREE.Geometry.call( this ); - - this.type = 'ExtrudeGeometry'; - - shapes = shapes instanceof Array ? shapes : [ shapes ]; - - this.addShapeList( shapes, options ); - - this.computeFaceNormals(); - - // can't really use automatic vertex normals - // as then front and back sides get smoothed too - // should do separate smoothing just for sides - - //this.computeVertexNormals(); - - //console.log( "took", ( Date.now() - startTime ) ); - -}; - -THREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry; - -THREE.ExtrudeGeometry.prototype.addShapeList = function ( shapes, options ) { - var sl = shapes.length; - - for ( var s = 0; s < sl; s ++ ) { - var shape = shapes[ s ]; - this.addShape( shape, options ); - } -}; - -THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) { - - var amount = options.amount !== undefined ? options.amount : 100; - - var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; // 10 - var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; // 8 - var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3; - - var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false - - var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - - var steps = options.steps !== undefined ? options.steps : 1; - - var extrudePath = options.extrudePath; - var extrudePts, extrudeByPath = false; - - var material = options.material; - var extrudeMaterial = options.extrudeMaterial; - - // Use default WorldUVGenerator if no UV generators are specified. - var uvgen = options.UVGenerator !== undefined ? options.UVGenerator : THREE.ExtrudeGeometry.WorldUVGenerator; - - var splineTube, binormal, normal, position2; - if ( extrudePath ) { - - extrudePts = extrudePath.getSpacedPoints( steps ); - - extrudeByPath = true; - bevelEnabled = false; // bevels not supported for path extrusion - - // SETUP TNB variables - - // Reuse TNB from TubeGeomtry for now. - // TODO1 - have a .isClosed in spline? - - splineTube = options.frames !== undefined ? options.frames : new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false); - - // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); - - binormal = new THREE.Vector3(); - normal = new THREE.Vector3(); - position2 = new THREE.Vector3(); - - } - - // Safeguards if bevels are not enabled - - if ( ! bevelEnabled ) { - - bevelSegments = 0; - bevelThickness = 0; - bevelSize = 0; - - } - - // Variables initalization - - var ahole, h, hl; // looping of holes - var scope = this; - - var shapesOffset = this.vertices.length; - - var shapePoints = shape.extractPoints( curveSegments ); - - var vertices = shapePoints.shape; - var holes = shapePoints.holes; - - var reverse = ! THREE.Shape.Utils.isClockWise( vertices ) ; - - if ( reverse ) { - - vertices = vertices.reverse(); - - // Maybe we should also check if holes are in the opposite direction, just to be safe ... - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - if ( THREE.Shape.Utils.isClockWise( ahole ) ) { - - holes[ h ] = ahole.reverse(); - - } - - } - - reverse = false; // If vertices are in order now, we shouldn't need to worry about them again (hopefully)! - - } - - - var faces = THREE.Shape.Utils.triangulateShape ( vertices, holes ); - - /* Vertices */ - - var contour = vertices; // vertices has all points but contour has only points of circumference - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - vertices = vertices.concat( ahole ); - - } - - - function scalePt2 ( pt, vec, size ) { - - if ( ! vec ) THREE.error( "THREE.ExtrudeGeometry: vec does not exist" ); - - return vec.clone().multiplyScalar( size ).add( pt ); - - } - - var b, bs, t, z, - vert, vlen = vertices.length, - face, flen = faces.length; - - - // Find directions for point movement - - - function getBevelVec( inPt, inPrev, inNext ) { - - var EPSILON = 0.0000000001; - - // computes for inPt the corresponding point inPt' on a new contour - // shiftet by 1 unit (length of normalized vector) to the left - // if we walk along contour clockwise, this new contour is outside the old one - // - // inPt' is the intersection of the two lines parallel to the two - // adjacent edges of inPt at a distance of 1 unit on the left side. - - var v_trans_x, v_trans_y, shrink_by = 1; // resulting translation vector for inPt - - // good reading for geometry algorithms (here: line-line intersection) - // http://geomalgorithms.com/a05-_intersect-1.html - - var v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y; - var v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y; - - var v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y ); - - // check for colinear edges - var colinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - if ( Math.abs( colinear0 ) > EPSILON ) { // not colinear - - // length of vectors for normalizing - - var v_prev_len = Math.sqrt( v_prev_lensq ); - var v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y ); - - // shift adjacent points by unit vectors to the left - - var ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len ); - var ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len ); - - var ptNextShift_x = ( inNext.x - v_next_y / v_next_len ); - var ptNextShift_y = ( inNext.y + v_next_x / v_next_len ); - - // scaling factor for v_prev to intersection point - - var sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y - - ( ptNextShift_y - ptPrevShift_y ) * v_next_x ) / - ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - // vector from inPt to intersection point - - v_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x ); - v_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y ); - - // Don't normalize!, otherwise sharp corners become ugly - // but prevent crazy spikes - var v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y ) - if ( v_trans_lensq <= 2 ) { - return new THREE.Vector2( v_trans_x, v_trans_y ); - } else { - shrink_by = Math.sqrt( v_trans_lensq / 2 ); - } - - } else { // handle special case of colinear edges - - var direction_eq = false; // assumes: opposite - if ( v_prev_x > EPSILON ) { - if ( v_next_x > EPSILON ) { direction_eq = true; } - } else { - if ( v_prev_x < - EPSILON ) { - if ( v_next_x < - EPSILON ) { direction_eq = true; } - } else { - if ( Math.sign(v_prev_y) == Math.sign(v_next_y) ) { direction_eq = true; } - } - } - - if ( direction_eq ) { - // console.log("Warning: lines are a straight sequence"); - v_trans_x = - v_prev_y; - v_trans_y = v_prev_x; - shrink_by = Math.sqrt( v_prev_lensq ); - } else { - // console.log("Warning: lines are a straight spike"); - v_trans_x = v_prev_x; - v_trans_y = v_prev_y; - shrink_by = Math.sqrt( v_prev_lensq / 2 ); - } - - } - - return new THREE.Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by ); - - } - - - var contourMovements = []; - - for ( var i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - // console.log('i,j,k', i, j , k) - - contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] ); - - } - - var holesMovements = [], oneHoleMovements, verticesMovements = contourMovements.concat(); - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - oneHoleMovements = []; - - for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - oneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] ); - - } - - holesMovements.push( oneHoleMovements ); - verticesMovements = verticesMovements.concat( oneHoleMovements ); - - } - - - // Loop bevelSegments, 1 for the front, 1 for the back - - for ( b = 0; b < bevelSegments; b ++ ) { - //for ( b = bevelSegments; b > 0; b -- ) { - - t = b / bevelSegments; - z = bevelThickness * ( 1 - t ); - - //z = bevelThickness * t; - bs = bevelSize * ( Math.sin ( t * Math.PI / 2 ) ) ; // curved - //bs = bevelSize * t ; // linear - - // contract shape - - for ( i = 0, il = contour.length; i < il; i ++ ) { - - vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - - v( vert.x, vert.y, - z ); - - } - - // expand holes - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( i = 0, il = ahole.length; i < il; i ++ ) { - - vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - v( vert.x, vert.y, - z ); - - } - - } - - } - - bs = bevelSize; - - // Back facing vertices - - for ( i = 0; i < vlen; i ++ ) { - - vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, 0 ); - - } else { - - // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x ); - - normal.copy( splineTube.normals[0] ).multiplyScalar(vert.x); - binormal.copy( splineTube.binormals[0] ).multiplyScalar(vert.y); - - position2.copy( extrudePts[0] ).add(normal).add(binormal); - - v( position2.x, position2.y, position2.z ); - - } - - } - - // Add stepped vertices... - // Including front facing vertices - - var s; - - for ( s = 1; s <= steps; s ++ ) { - - for ( i = 0; i < vlen; i ++ ) { - - vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, amount / steps * s ); - - } else { - - // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x ); - - normal.copy( splineTube.normals[s] ).multiplyScalar( vert.x ); - binormal.copy( splineTube.binormals[s] ).multiplyScalar( vert.y ); - - position2.copy( extrudePts[s] ).add( normal ).add( binormal ); - - v( position2.x, position2.y, position2.z ); - - } - - } - - } - - - // Add bevel segments planes - - //for ( b = 1; b <= bevelSegments; b ++ ) { - for ( b = bevelSegments - 1; b >= 0; b -- ) { - - t = b / bevelSegments; - z = bevelThickness * ( 1 - t ); - //bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) ); - bs = bevelSize * Math.sin ( t * Math.PI / 2 ) ; - - // contract shape - - for ( i = 0, il = contour.length; i < il; i ++ ) { - - vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - v( vert.x, vert.y, amount + z ); - - } - - // expand holes - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( i = 0, il = ahole.length; i < il; i ++ ) { - - vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, amount + z ); - - } else { - - v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z ); - - } - - } - - } - - } - - /* Faces */ - - // Top and bottom faces - - buildLidFaces(); - - // Sides faces - - buildSideFaces(); - - - ///// Internal functions - - function buildLidFaces() { - - if ( bevelEnabled ) { - - var layer = 0 ; // steps + 1 - var offset = vlen * layer; - - // Bottom faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset ); - - } - - layer = steps + bevelSegments * 2; - offset = vlen * layer; - - // Top faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset ); - - } - - } else { - - // Bottom faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 2 ], face[ 1 ], face[ 0 ] ); - - } - - // Top faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps ); - - } - } - - } - - // Create faces for the z-sides of the shape - - function buildSideFaces() { - - var layeroffset = 0; - sidewalls( contour, layeroffset ); - layeroffset += contour.length; - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - sidewalls( ahole, layeroffset ); - - //, true - layeroffset += ahole.length; - - } - - } - - function sidewalls( contour, layeroffset ) { - - var j, k; - i = contour.length; - - while ( -- i >= 0 ) { - - j = i; - k = i - 1; - if ( k < 0 ) k = contour.length - 1; - - //console.log('b', i,j, i-1, k,vertices.length); - - var s = 0, sl = steps + bevelSegments * 2; - - for ( s = 0; s < sl; s ++ ) { - - var slen1 = vlen * s; - var slen2 = vlen * ( s + 1 ); - - var a = layeroffset + j + slen1, - b = layeroffset + k + slen1, - c = layeroffset + k + slen2, - d = layeroffset + j + slen2; - - f4( a, b, c, d, contour, s, sl, j, k ); - - } - } - - } - - - function v( x, y, z ) { - - scope.vertices.push( new THREE.Vector3( x, y, z ) ); - - } - - function f3( a, b, c ) { - - a += shapesOffset; - b += shapesOffset; - c += shapesOffset; - - // normal, color, material - scope.faces.push( new THREE.Face3( a, b, c, null, null, material ) ); - - var uvs = uvgen.generateTopUV( scope, a, b, c ); - - scope.faceVertexUvs[ 0 ].push( uvs ); - - } - - function f4( a, b, c, d, wallContour, stepIndex, stepsLength, contourIndex1, contourIndex2 ) { - - a += shapesOffset; - b += shapesOffset; - c += shapesOffset; - d += shapesOffset; - - scope.faces.push( new THREE.Face3( a, b, d, null, null, extrudeMaterial ) ); - scope.faces.push( new THREE.Face3( b, c, d, null, null, extrudeMaterial ) ); - - var uvs = uvgen.generateSideWallUV( scope, a, b, c, d ); - - scope.faceVertexUvs[ 0 ].push( [ uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] ] ); - scope.faceVertexUvs[ 0 ].push( [ uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] ] ); - - } - -}; - -THREE.ExtrudeGeometry.WorldUVGenerator = { - - generateTopUV: function ( geometry, indexA, indexB, indexC ) { - - var vertices = geometry.vertices; - - var a = vertices[ indexA ]; - var b = vertices[ indexB ]; - var c = vertices[ indexC ]; - - return [ - new THREE.Vector2( a.x, a.y ), - new THREE.Vector2( b.x, b.y ), - new THREE.Vector2( c.x, c.y ) - ]; - - }, - - generateSideWallUV: function ( geometry, indexA, indexB, indexC, indexD ) { - - var vertices = geometry.vertices; - - var a = vertices[ indexA ]; - var b = vertices[ indexB ]; - var c = vertices[ indexC ]; - var d = vertices[ indexD ]; - - if ( Math.abs( a.y - b.y ) < 0.01 ) { - return [ - new THREE.Vector2( a.x, 1 - a.z ), - new THREE.Vector2( b.x, 1 - b.z ), - new THREE.Vector2( c.x, 1 - c.z ), - new THREE.Vector2( d.x, 1 - d.z ) - ]; - } else { - return [ - new THREE.Vector2( a.y, 1 - a.z ), - new THREE.Vector2( b.y, 1 - b.z ), - new THREE.Vector2( c.y, 1 - c.z ), - new THREE.Vector2( d.y, 1 - d.z ) - ]; - } - } -}; - -// File:src/extras/geometries/ShapeGeometry.js - -/** - * @author jonobr1 / http://jonobr1.com - * - * Creates a one-sided polygonal geometry from a path shape. Similar to - * ExtrudeGeometry. - * - * parameters = { - * - * curveSegments: <int>, // number of points on the curves. NOT USED AT THE MOMENT. - * - * material: <int> // material index for front and back faces - * uvGenerator: <Object> // object that provides UV generator functions - * - * } - **/ - -THREE.ShapeGeometry = function ( shapes, options ) { - - THREE.Geometry.call( this ); - - this.type = 'ShapeGeometry'; - - if ( shapes instanceof Array === false ) shapes = [ shapes ]; - - this.addShapeList( shapes, options ); - - this.computeFaceNormals(); - -}; - -THREE.ShapeGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.ShapeGeometry.prototype.constructor = THREE.ShapeGeometry; - -/** - * Add an array of shapes to THREE.ShapeGeometry. - */ -THREE.ShapeGeometry.prototype.addShapeList = function ( shapes, options ) { - - for ( var i = 0, l = shapes.length; i < l; i ++ ) { - - this.addShape( shapes[ i ], options ); - - } - - return this; - -}; - -/** - * Adds a shape to THREE.ShapeGeometry, based on THREE.ExtrudeGeometry. - */ -THREE.ShapeGeometry.prototype.addShape = function ( shape, options ) { - - if ( options === undefined ) options = {}; - var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - - var material = options.material; - var uvgen = options.UVGenerator === undefined ? THREE.ExtrudeGeometry.WorldUVGenerator : options.UVGenerator; - - // - - var i, l, hole; - - var shapesOffset = this.vertices.length; - var shapePoints = shape.extractPoints( curveSegments ); - - var vertices = shapePoints.shape; - var holes = shapePoints.holes; - - var reverse = ! THREE.Shape.Utils.isClockWise( vertices ); - - if ( reverse ) { - - vertices = vertices.reverse(); - - // Maybe we should also check if holes are in the opposite direction, just to be safe... - - for ( i = 0, l = holes.length; i < l; i ++ ) { - - hole = holes[ i ]; - - if ( THREE.Shape.Utils.isClockWise( hole ) ) { - - holes[ i ] = hole.reverse(); - - } - - } - - reverse = false; - - } - - var faces = THREE.Shape.Utils.triangulateShape( vertices, holes ); - - // Vertices - - var contour = vertices; - - for ( i = 0, l = holes.length; i < l; i ++ ) { - - hole = holes[ i ]; - vertices = vertices.concat( hole ); - - } - - // - - var vert, vlen = vertices.length; - var face, flen = faces.length; - - for ( i = 0; i < vlen; i ++ ) { - - vert = vertices[ i ]; - - this.vertices.push( new THREE.Vector3( vert.x, vert.y, 0 ) ); - - } - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - - var a = face[ 0 ] + shapesOffset; - var b = face[ 1 ] + shapesOffset; - var c = face[ 2 ] + shapesOffset; - - this.faces.push( new THREE.Face3( a, b, c, null, null, material ) ); - this.faceVertexUvs[ 0 ].push( uvgen.generateTopUV( this, a, b, c ) ); - - } - -}; - -// File:src/extras/geometries/LatheGeometry.js - -/** - * @author astrodud / http://astrodud.isgreat.org/ - * @author zz85 / https://github.com/zz85 - * @author bhouston / http://exocortex.com - */ - -// points - to create a closed torus, one must use a set of points -// like so: [ a, b, c, d, a ], see first is the same as last. -// segments - the number of circumference segments to create -// phiStart - the starting radian -// phiLength - the radian (0 to 2*PI) range of the lathed section -// 2*pi is a closed lathe, less than 2PI is a portion. - -THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { - - THREE.Geometry.call( this ); - - this.type = 'LatheGeometry'; - - this.parameters = { - points: points, - segments: segments, - phiStart: phiStart, - phiLength: phiLength - }; - - segments = segments || 12; - phiStart = phiStart || 0; - phiLength = phiLength || 2 * Math.PI; - - var inversePointLength = 1.0 / ( points.length - 1 ); - var inverseSegments = 1.0 / segments; - - for ( var i = 0, il = segments; i <= il; i ++ ) { - - var phi = phiStart + i * inverseSegments * phiLength; - - var c = Math.cos( phi ), - s = Math.sin( phi ); - - for ( var j = 0, jl = points.length; j < jl; j ++ ) { - - var pt = points[ j ]; - - var vertex = new THREE.Vector3(); - - vertex.x = c * pt.x - s * pt.y; - vertex.y = s * pt.x + c * pt.y; - vertex.z = pt.z; - - this.vertices.push( vertex ); - - } - - } - - var np = points.length; - - for ( var i = 0, il = segments; i < il; i ++ ) { - - for ( var j = 0, jl = points.length - 1; j < jl; j ++ ) { - - var base = j + np * i; - var a = base; - var b = base + np; - var c = base + 1 + np; - var d = base + 1; - - var u0 = i * inverseSegments; - var v0 = j * inversePointLength; - var u1 = u0 + inverseSegments; - var v1 = v0 + inversePointLength; - - this.faces.push( new THREE.Face3( a, b, d ) ); - - this.faceVertexUvs[ 0 ].push( [ - - new THREE.Vector2( u0, v0 ), - new THREE.Vector2( u1, v0 ), - new THREE.Vector2( u0, v1 ) - - ] ); - - this.faces.push( new THREE.Face3( b, c, d ) ); - - this.faceVertexUvs[ 0 ].push( [ - - new THREE.Vector2( u1, v0 ), - new THREE.Vector2( u1, v1 ), - new THREE.Vector2( u0, v1 ) - - ] ); - - - } - - } - - this.mergeVertices(); - this.computeFaceNormals(); - this.computeVertexNormals(); - -}; - -THREE.LatheGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.LatheGeometry.prototype.constructor = THREE.LatheGeometry; - -// File:src/extras/geometries/PlaneGeometry.js - -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) { - - console.info( 'THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint.' ); - - THREE.Geometry.call( this ); - - this.type = 'PlaneGeometry'; - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments - }; - - this.fromBufferGeometry( new THREE.PlaneBufferGeometry( width, height, widthSegments, heightSegments ) ); - -}; - -THREE.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.PlaneGeometry.prototype.constructor = THREE.PlaneGeometry; - -// File:src/extras/geometries/PlaneBufferGeometry.js - -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneBufferGeometry = function ( width, height, widthSegments, heightSegments ) { - - THREE.BufferGeometry.call( this ); - - this.type = 'PlaneBufferGeometry'; - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments - }; - - var width_half = width / 2; - var height_half = height / 2; - - var gridX = widthSegments || 1; - var gridY = heightSegments || 1; - - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; - - var segment_width = width / gridX; - var segment_height = height / gridY; - - var vertices = new Float32Array( gridX1 * gridY1 * 3 ); - var normals = new Float32Array( gridX1 * gridY1 * 3 ); - var uvs = new Float32Array( gridX1 * gridY1 * 2 ); - - var offset = 0; - var offset2 = 0; - - for ( var iy = 0; iy < gridY1; iy ++ ) { - - var y = iy * segment_height - height_half; - - for ( var ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segment_width - width_half; - - vertices[ offset ] = x; - vertices[ offset + 1 ] = - y; - - normals[ offset + 2 ] = 1; - - uvs[ offset2 ] = ix / gridX; - uvs[ offset2 + 1 ] = 1 - ( iy / gridY ); - - offset += 3; - offset2 += 2; - - } - - } - - offset = 0; - - var indices = new ( ( vertices.length / 3 ) > 65535 ? Uint32Array : Uint16Array )( gridX * gridY * 6 ); - - for ( var iy = 0; iy < gridY; iy ++ ) { - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - indices[ offset ] = a; - indices[ offset + 1 ] = b; - indices[ offset + 2 ] = d; - - indices[ offset + 3 ] = b; - indices[ offset + 4 ] = c; - indices[ offset + 5 ] = d; - - offset += 6; - - } - - } - - this.addAttribute( 'index', new THREE.BufferAttribute( indices, 1 ) ); - this.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) ); - -}; - -THREE.PlaneBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.PlaneBufferGeometry.prototype.constructor = THREE.PlaneBufferGeometry; - -// File:src/extras/geometries/RingGeometry.js - -/** - * @author Kaleb Murphy - */ - -THREE.RingGeometry = function ( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) { - - THREE.Geometry.call( this ); - - this.type = 'RingGeometry'; - - this.parameters = { - innerRadius: innerRadius, - outerRadius: outerRadius, - thetaSegments: thetaSegments, - phiSegments: phiSegments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - innerRadius = innerRadius || 0; - outerRadius = outerRadius || 50; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - thetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8; - phiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 8; - - var i, o, uvs = [], radius = innerRadius, radiusStep = ( ( outerRadius - innerRadius ) / phiSegments ); - - for ( i = 0; i < phiSegments + 1; i ++ ) { // concentric circles inside ring - - for ( o = 0; o < thetaSegments + 1; o ++ ) { // number of segments per circle - - var vertex = new THREE.Vector3(); - var segment = thetaStart + o / thetaSegments * thetaLength; - vertex.x = radius * Math.cos( segment ); - vertex.y = radius * Math.sin( segment ); - - this.vertices.push( vertex ); - uvs.push( new THREE.Vector2( ( vertex.x / outerRadius + 1 ) / 2, ( vertex.y / outerRadius + 1 ) / 2 ) ); - } - - radius += radiusStep; - - } - - var n = new THREE.Vector3( 0, 0, 1 ); - - for ( i = 0; i < phiSegments; i ++ ) { // concentric circles inside ring - - var thetaSegment = i * (thetaSegments + 1); - - for ( o = 0; o < thetaSegments ; o ++ ) { // number of segments per circle - - var segment = o + thetaSegment; - - var v1 = segment; - var v2 = segment + thetaSegments + 1; - var v3 = segment + thetaSegments + 2; - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uvs[ v1 ].clone(), uvs[ v2 ].clone(), uvs[ v3 ].clone() ]); - - v1 = segment; - v2 = segment + thetaSegments + 2; - v3 = segment + 1; - - this.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uvs[ v1 ].clone(), uvs[ v2 ].clone(), uvs[ v3 ].clone() ]); - - } - } - - this.computeFaceNormals(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - -}; - -THREE.RingGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.RingGeometry.prototype.constructor = THREE.RingGeometry; - - -// File:src/extras/geometries/SphereGeometry.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) { - - THREE.Geometry.call( this ); - - this.type = 'SphereGeometry'; - - this.parameters = { - radius: radius, - widthSegments: widthSegments, - heightSegments: heightSegments, - phiStart: phiStart, - phiLength: phiLength, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - radius = radius || 50; - - widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 ); - heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 ); - - phiStart = phiStart !== undefined ? phiStart : 0; - phiLength = phiLength !== undefined ? phiLength : Math.PI * 2; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI; - - var x, y, vertices = [], uvs = []; - - for ( y = 0; y <= heightSegments; y ++ ) { - - var verticesRow = []; - var uvsRow = []; - - for ( x = 0; x <= widthSegments; x ++ ) { - - var u = x / widthSegments; - var v = y / heightSegments; - - var vertex = new THREE.Vector3(); - vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - vertex.y = radius * Math.cos( thetaStart + v * thetaLength ); - vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - - this.vertices.push( vertex ); - - verticesRow.push( this.vertices.length - 1 ); - uvsRow.push( new THREE.Vector2( u, 1 - v ) ); - - } - - vertices.push( verticesRow ); - uvs.push( uvsRow ); - - } - - for ( y = 0; y < heightSegments; y ++ ) { - - for ( x = 0; x < widthSegments; x ++ ) { - - var v1 = vertices[ y ][ x + 1 ]; - var v2 = vertices[ y ][ x ]; - var v3 = vertices[ y + 1 ][ x ]; - var v4 = vertices[ y + 1 ][ x + 1 ]; - - var n1 = this.vertices[ v1 ].clone().normalize(); - var n2 = this.vertices[ v2 ].clone().normalize(); - var n3 = this.vertices[ v3 ].clone().normalize(); - var n4 = this.vertices[ v4 ].clone().normalize(); - - var uv1 = uvs[ y ][ x + 1 ].clone(); - var uv2 = uvs[ y ][ x ].clone(); - var uv3 = uvs[ y + 1 ][ x ].clone(); - var uv4 = uvs[ y + 1 ][ x + 1 ].clone(); - - if ( Math.abs( this.vertices[ v1 ].y ) === radius ) { - - uv1.x = ( uv1.x + uv2.x ) / 2; - this.faces.push( new THREE.Face3( v1, v3, v4, [ n1, n3, n4 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv3, uv4 ] ); - - } else if ( Math.abs( this.vertices[ v3 ].y ) === radius ) { - - uv3.x = ( uv3.x + uv4.x ) / 2; - this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); - - } else { - - this.faces.push( new THREE.Face3( v1, v2, v4, [ n1, n2, n4 ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv4 ] ); - - this.faces.push( new THREE.Face3( v2, v3, v4, [ n2.clone(), n3, n4.clone() ] ) ); - this.faceVertexUvs[ 0 ].push( [ uv2.clone(), uv3, uv4.clone() ] ); - - } - - } - - } - - this.computeFaceNormals(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - -}; - -THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.SphereGeometry.prototype.constructor = THREE.SphereGeometry; - -// File:src/extras/geometries/TextGeometry.js - -/** - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author alteredq / http://alteredqualia.com/ - * - * For creating 3D text geometry in three.js - * - * Text = 3D Text - * - * parameters = { - * size: <float>, // size of the text - * height: <float>, // thickness to extrude text - * curveSegments: <int>, // number of points on the curves - * - * font: <string>, // font name - * weight: <string>, // font weight (normal, bold) - * style: <string>, // font style (normal, italics) - * - * bevelEnabled: <bool>, // turn on bevel - * bevelThickness: <float>, // how deep into text bevel goes - * bevelSize: <float>, // how far from text outline is bevel - * } - * - */ - -/* Usage Examples - - // TextGeometry wrapper - - var text3d = new TextGeometry( text, options ); - - // Complete manner - - var textShapes = THREE.FontUtils.generateShapes( text, options ); - var text3d = new ExtrudeGeometry( textShapes, options ); - -*/ - - -THREE.TextGeometry = function ( text, parameters ) { - - parameters = parameters || {}; - - var textShapes = THREE.FontUtils.generateShapes( text, parameters ); - - // translate parameters to ExtrudeGeometry API - - parameters.amount = parameters.height !== undefined ? parameters.height : 50; - - // defaults - - if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10; - if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; - if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; - - THREE.ExtrudeGeometry.call( this, textShapes, parameters ); - - this.type = 'TextGeometry'; - -}; - -THREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype ); -THREE.TextGeometry.prototype.constructor = THREE.TextGeometry; - -// File:src/extras/geometries/TorusGeometry.js - -/** - * @author oosmoxiecode - * @author mrdoob / http://mrdoob.com/ - * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888 - */ - -THREE.TorusGeometry = function ( radius, tube, radialSegments, tubularSegments, arc ) { - - THREE.Geometry.call( this ); - - this.type = 'TorusGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - radialSegments: radialSegments, - tubularSegments: tubularSegments, - arc: arc - }; - - radius = radius || 100; - tube = tube || 40; - radialSegments = radialSegments || 8; - tubularSegments = tubularSegments || 6; - arc = arc || Math.PI * 2; - - var center = new THREE.Vector3(), uvs = [], normals = []; - - for ( var j = 0; j <= radialSegments; j ++ ) { - - for ( var i = 0; i <= tubularSegments; i ++ ) { - - var u = i / tubularSegments * arc; - var v = j / radialSegments * Math.PI * 2; - - center.x = radius * Math.cos( u ); - center.y = radius * Math.sin( u ); - - var vertex = new THREE.Vector3(); - vertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u ); - vertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u ); - vertex.z = tube * Math.sin( v ); - - this.vertices.push( vertex ); - - uvs.push( new THREE.Vector2( i / tubularSegments, j / radialSegments ) ); - normals.push( vertex.clone().sub( center ).normalize() ); - - } - - } - - for ( var j = 1; j <= radialSegments; j ++ ) { - - for ( var i = 1; i <= tubularSegments; i ++ ) { - - var a = ( tubularSegments + 1 ) * j + i - 1; - var b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1; - var c = ( tubularSegments + 1 ) * ( j - 1 ) + i; - var d = ( tubularSegments + 1 ) * j + i; - - var face = new THREE.Face3( a, b, d, [ normals[ a ].clone(), normals[ b ].clone(), normals[ d ].clone() ] ); - this.faces.push( face ); - this.faceVertexUvs[ 0 ].push( [ uvs[ a ].clone(), uvs[ b ].clone(), uvs[ d ].clone() ] ); - - face = new THREE.Face3( b, c, d, [ normals[ b ].clone(), normals[ c ].clone(), normals[ d ].clone() ] ); - this.faces.push( face ); - this.faceVertexUvs[ 0 ].push( [ uvs[ b ].clone(), uvs[ c ].clone(), uvs[ d ].clone() ] ); - - } - - } - - this.computeFaceNormals(); - -}; - -THREE.TorusGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.TorusGeometry.prototype.constructor = THREE.TorusGeometry; - -// File:src/extras/geometries/TorusKnotGeometry.js - -/** - * @author oosmoxiecode - * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473 - */ - -THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegments, p, q, heightScale ) { - - THREE.Geometry.call( this ); - - this.type = 'TorusKnotGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - radialSegments: radialSegments, - tubularSegments: tubularSegments, - p: p, - q: q, - heightScale: heightScale - }; - - radius = radius || 100; - tube = tube || 40; - radialSegments = radialSegments || 64; - tubularSegments = tubularSegments || 8; - p = p || 2; - q = q || 3; - heightScale = heightScale || 1; - - var grid = new Array( radialSegments ); - var tang = new THREE.Vector3(); - var n = new THREE.Vector3(); - var bitan = new THREE.Vector3(); - - for ( var i = 0; i < radialSegments; ++ i ) { - - grid[ i ] = new Array( tubularSegments ); - var u = i / radialSegments * 2 * p * Math.PI; - var p1 = getPos( u, q, p, radius, heightScale ); - var p2 = getPos( u + 0.01, q, p, radius, heightScale ); - tang.subVectors( p2, p1 ); - n.addVectors( p2, p1 ); - - bitan.crossVectors( tang, n ); - n.crossVectors( bitan, tang ); - bitan.normalize(); - n.normalize(); - - for ( var j = 0; j < tubularSegments; ++ j ) { - - var v = j / tubularSegments * 2 * Math.PI; - var cx = - tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. - var cy = tube * Math.sin( v ); - - var pos = new THREE.Vector3(); - pos.x = p1.x + cx * n.x + cy * bitan.x; - pos.y = p1.y + cx * n.y + cy * bitan.y; - pos.z = p1.z + cx * n.z + cy * bitan.z; - - grid[ i ][ j ] = this.vertices.push( pos ) - 1; - - } - - } - - for ( var i = 0; i < radialSegments; ++ i ) { - - for ( var j = 0; j < tubularSegments; ++ j ) { - - var ip = ( i + 1 ) % radialSegments; - var jp = ( j + 1 ) % tubularSegments; - - var a = grid[ i ][ j ]; - var b = grid[ ip ][ j ]; - var c = grid[ ip ][ jp ]; - var d = grid[ i ][ jp ]; - - var uva = new THREE.Vector2( i / radialSegments, j / tubularSegments ); - var uvb = new THREE.Vector2( ( i + 1 ) / radialSegments, j / tubularSegments ); - var uvc = new THREE.Vector2( ( i + 1 ) / radialSegments, ( j + 1 ) / tubularSegments ); - var uvd = new THREE.Vector2( i / radialSegments, ( j + 1 ) / tubularSegments ); - - this.faces.push( new THREE.Face3( a, b, d ) ); - this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - this.faces.push( new THREE.Face3( b, c, d ) ); - this.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - } - - this.computeFaceNormals(); - this.computeVertexNormals(); - - function getPos( u, in_q, in_p, radius, heightScale ) { - - var cu = Math.cos( u ); - var su = Math.sin( u ); - var quOverP = in_q / in_p * u; - var cs = Math.cos( quOverP ); - - var tx = radius * ( 2 + cs ) * 0.5 * cu; - var ty = radius * ( 2 + cs ) * su * 0.5; - var tz = heightScale * radius * Math.sin( quOverP ) * 0.5; - - return new THREE.Vector3( tx, ty, tz ); - - } - -}; - -THREE.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.TorusKnotGeometry.prototype.constructor = THREE.TorusKnotGeometry; - -// File:src/extras/geometries/TubeGeometry.js - -/** - * @author WestLangley / https://github.com/WestLangley - * @author zz85 / https://github.com/zz85 - * @author miningold / https://github.com/miningold - * @author jonobr1 / https://github.com/jonobr1 - * - * Modified from the TorusKnotGeometry by @oosmoxiecode - * - * Creates a tube which extrudes along a 3d spline - * - * Uses parallel transport frames as described in - * http://www.cs.indiana.edu/pub/techreports/TR425.pdf - */ - -THREE.TubeGeometry = function ( path, segments, radius, radialSegments, closed, taper ) { - - THREE.Geometry.call( this ); - - this.type = 'TubeGeometry'; - - this.parameters = { - path: path, - segments: segments, - radius: radius, - radialSegments: radialSegments, - closed: closed - }; - - segments = segments || 64; - radius = radius || 1; - radialSegments = radialSegments || 8; - closed = closed || false; - taper = taper || THREE.TubeGeometry.NoTaper; - - var grid = []; - - var scope = this, - - tangent, - normal, - binormal, - - numpoints = segments + 1, - - u, v, r, - - cx, cy, - pos, pos2 = new THREE.Vector3(), - i, j, - ip, jp, - a, b, c, d, - uva, uvb, uvc, uvd; - - var frames = new THREE.TubeGeometry.FrenetFrames( path, segments, closed ), - tangents = frames.tangents, - normals = frames.normals, - binormals = frames.binormals; - - // proxy internals - this.tangents = tangents; - this.normals = normals; - this.binormals = binormals; - - function vert( x, y, z ) { - - return scope.vertices.push( new THREE.Vector3( x, y, z ) ) - 1; - - } - - // consruct the grid - - for ( i = 0; i < numpoints; i ++ ) { - - grid[ i ] = []; - - u = i / ( numpoints - 1 ); - - pos = path.getPointAt( u ); - - tangent = tangents[ i ]; - normal = normals[ i ]; - binormal = binormals[ i ]; - - r = radius * taper( u ); - - for ( j = 0; j < radialSegments; j ++ ) { - - v = j / radialSegments * 2 * Math.PI; - - cx = - r * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. - cy = r * Math.sin( v ); - - pos2.copy( pos ); - pos2.x += cx * normal.x + cy * binormal.x; - pos2.y += cx * normal.y + cy * binormal.y; - pos2.z += cx * normal.z + cy * binormal.z; - - grid[ i ][ j ] = vert( pos2.x, pos2.y, pos2.z ); - - } - } - - - // construct the mesh - - for ( i = 0; i < segments; i ++ ) { - - for ( j = 0; j < radialSegments; j ++ ) { - - ip = ( closed ) ? (i + 1) % segments : i + 1; - jp = (j + 1) % radialSegments; - - a = grid[ i ][ j ]; // *** NOT NECESSARILY PLANAR ! *** - b = grid[ ip ][ j ]; - c = grid[ ip ][ jp ]; - d = grid[ i ][ jp ]; - - uva = new THREE.Vector2( i / segments, j / radialSegments ); - uvb = new THREE.Vector2( ( i + 1 ) / segments, j / radialSegments ); - uvc = new THREE.Vector2( ( i + 1 ) / segments, ( j + 1 ) / radialSegments ); - uvd = new THREE.Vector2( i / segments, ( j + 1 ) / radialSegments ); - - this.faces.push( new THREE.Face3( a, b, d ) ); - this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - this.faces.push( new THREE.Face3( b, c, d ) ); - this.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - } - - this.computeFaceNormals(); - this.computeVertexNormals(); - -}; - -THREE.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.TubeGeometry.prototype.constructor = THREE.TubeGeometry; - -THREE.TubeGeometry.NoTaper = function ( u ) { - - return 1; - -}; - -THREE.TubeGeometry.SinusoidalTaper = function ( u ) { - - return Math.sin( Math.PI * u ); - -}; - -// For computing of Frenet frames, exposing the tangents, normals and binormals the spline -THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) { - - var normal = new THREE.Vector3(), - - tangents = [], - normals = [], - binormals = [], - - vec = new THREE.Vector3(), - mat = new THREE.Matrix4(), - - numpoints = segments + 1, - theta, - epsilon = 0.0001, - smallest, - - tx, ty, tz, - i, u; - - - // expose internals - this.tangents = tangents; - this.normals = normals; - this.binormals = binormals; - - // compute the tangent vectors for each segment on the path - - for ( i = 0; i < numpoints; i ++ ) { - - u = i / ( numpoints - 1 ); - - tangents[ i ] = path.getTangentAt( u ); - tangents[ i ].normalize(); - - } - - initialNormal3(); - - /* - function initialNormal1(lastBinormal) { - // fixed start binormal. Has dangers of 0 vectors - normals[ 0 ] = new THREE.Vector3(); - binormals[ 0 ] = new THREE.Vector3(); - if (lastBinormal===undefined) lastBinormal = new THREE.Vector3( 0, 0, 1 ); - normals[ 0 ].crossVectors( lastBinormal, tangents[ 0 ] ).normalize(); - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize(); - } - - function initialNormal2() { - - // This uses the Frenet-Serret formula for deriving binormal - var t2 = path.getTangentAt( epsilon ); - - normals[ 0 ] = new THREE.Vector3().subVectors( t2, tangents[ 0 ] ).normalize(); - binormals[ 0 ] = new THREE.Vector3().crossVectors( tangents[ 0 ], normals[ 0 ] ); - - normals[ 0 ].crossVectors( binormals[ 0 ], tangents[ 0 ] ).normalize(); // last binormal x tangent - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize(); - - } - */ - - function initialNormal3() { - // select an initial normal vector perpenicular to the first tangent vector, - // and in the direction of the smallest tangent xyz component - - normals[ 0 ] = new THREE.Vector3(); - binormals[ 0 ] = new THREE.Vector3(); - smallest = Number.MAX_VALUE; - tx = Math.abs( tangents[ 0 ].x ); - ty = Math.abs( tangents[ 0 ].y ); - tz = Math.abs( tangents[ 0 ].z ); - - if ( tx <= smallest ) { - smallest = tx; - normal.set( 1, 0, 0 ); - } - - if ( ty <= smallest ) { - smallest = ty; - normal.set( 0, 1, 0 ); - } - - if ( tz <= smallest ) { - normal.set( 0, 0, 1 ); - } - - vec.crossVectors( tangents[ 0 ], normal ).normalize(); - - normals[ 0 ].crossVectors( tangents[ 0 ], vec ); - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ); - } - - - // compute the slowly-varying normal and binormal vectors for each segment on the path - - for ( i = 1; i < numpoints; i ++ ) { - - normals[ i ] = normals[ i - 1 ].clone(); - - binormals[ i ] = binormals[ i - 1 ].clone(); - - vec.crossVectors( tangents[ i - 1 ], tangents[ i ] ); - - if ( vec.length() > epsilon ) { - - vec.normalize(); - - theta = Math.acos( THREE.Math.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors - - normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) ); - - } - - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - - // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same - - if ( closed ) { - - theta = Math.acos( THREE.Math.clamp( normals[ 0 ].dot( normals[ numpoints - 1 ] ), - 1, 1 ) ); - theta /= ( numpoints - 1 ); - - if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints - 1 ] ) ) > 0 ) { - - theta = - theta; - - } - - for ( i = 1; i < numpoints; i ++ ) { - - // twist a little... - normals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) ); - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - } -}; - -// File:src/extras/geometries/PolyhedronGeometry.js - -/** - * @author clockworkgeek / https://github.com/clockworkgeek - * @author timothypratley / https://github.com/timothypratley - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) { - - THREE.Geometry.call( this ); - - this.type = 'PolyhedronGeometry'; - - this.parameters = { - vertices: vertices, - indices: indices, - radius: radius, - detail: detail - }; - - radius = radius || 1; - detail = detail || 0; - - var that = this; - - for ( var i = 0, l = vertices.length; i < l; i += 3 ) { - - prepare( new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) ); - - } - - var p = this.vertices; - - var faces = []; - - for ( var i = 0, j = 0, l = indices.length; i < l; i += 3, j ++ ) { - - var v1 = p[ indices[ i ] ]; - var v2 = p[ indices[ i + 1 ] ]; - var v3 = p[ indices[ i + 2 ] ]; - - faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); - - } - - var centroid = new THREE.Vector3(); - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - subdivide( faces[ i ], detail ); - - } - - - // Handle case when face straddles the seam - - for ( var i = 0, l = this.faceVertexUvs[ 0 ].length; i < l; i ++ ) { - - var uvs = this.faceVertexUvs[ 0 ][ i ]; - - var x0 = uvs[ 0 ].x; - var x1 = uvs[ 1 ].x; - var x2 = uvs[ 2 ].x; - - var max = Math.max( x0, Math.max( x1, x2 ) ); - var min = Math.min( x0, Math.min( x1, x2 ) ); - - if ( max > 0.9 && min < 0.1 ) { // 0.9 is somewhat arbitrary - - if ( x0 < 0.2 ) uvs[ 0 ].x += 1; - if ( x1 < 0.2 ) uvs[ 1 ].x += 1; - if ( x2 < 0.2 ) uvs[ 2 ].x += 1; - - } - - } - - - // Apply radius - - for ( var i = 0, l = this.vertices.length; i < l; i ++ ) { - - this.vertices[ i ].multiplyScalar( radius ); - - } - - - // Merge vertices - - this.mergeVertices(); - - this.computeFaceNormals(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - - - // Project vector onto sphere's surface - - function prepare( vector ) { - - var vertex = vector.normalize().clone(); - vertex.index = that.vertices.push( vertex ) - 1; - - // Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle. - - var u = azimuth( vector ) / 2 / Math.PI + 0.5; - var v = inclination( vector ) / Math.PI + 0.5; - vertex.uv = new THREE.Vector2( u, 1 - v ); - - return vertex; - - } - - - // Approximate a curved face with recursively sub-divided triangles. - - function make( v1, v2, v3 ) { - - var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); - that.faces.push( face ); - - centroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 ); - - var azi = azimuth( centroid ); - - that.faceVertexUvs[ 0 ].push( [ - correctUV( v1.uv, v1, azi ), - correctUV( v2.uv, v2, azi ), - correctUV( v3.uv, v3, azi ) - ] ); - - } - - - // Analytically subdivide a face to the required detail level. - - function subdivide( face, detail ) { - - var cols = Math.pow(2, detail); - var a = prepare( that.vertices[ face.a ] ); - var b = prepare( that.vertices[ face.b ] ); - var c = prepare( that.vertices[ face.c ] ); - var v = []; - - // Construct all of the vertices for this subdivision. - - for ( var i = 0 ; i <= cols; i ++ ) { - - v[ i ] = []; - - var aj = prepare( a.clone().lerp( c, i / cols ) ); - var bj = prepare( b.clone().lerp( c, i / cols ) ); - var rows = cols - i; - - for ( var j = 0; j <= rows; j ++) { - - if ( j == 0 && i == cols ) { - - v[ i ][ j ] = aj; - - } else { - - v[ i ][ j ] = prepare( aj.clone().lerp( bj, j / rows ) ); - - } - - } - - } - - // Construct all of the faces. - - for ( var i = 0; i < cols ; i ++ ) { - - for ( var j = 0; j < 2 * (cols - i) - 1; j ++ ) { - - var k = Math.floor( j / 2 ); - - if ( j % 2 == 0 ) { - - make( - v[ i ][ k + 1], - v[ i + 1 ][ k ], - v[ i ][ k ] - ); - - } else { - - make( - v[ i ][ k + 1 ], - v[ i + 1][ k + 1], - v[ i + 1 ][ k ] - ); - - } - - } - - } - - } - - - // Angle around the Y axis, counter-clockwise when looking from above. - - function azimuth( vector ) { - - return Math.atan2( vector.z, - vector.x ); - - } - - - // Angle above the XZ plane. - - function inclination( vector ) { - - return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); - - } - - - // Texture fixing helper. Spheres have some odd behaviours. - - function correctUV( uv, vector, azimuth ) { - - if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) uv = new THREE.Vector2( uv.x - 1, uv.y ); - if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) uv = new THREE.Vector2( azimuth / 2 / Math.PI + 0.5, uv.y ); - return uv.clone(); - - } - - -}; - -THREE.PolyhedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.PolyhedronGeometry.prototype.constructor = THREE.PolyhedronGeometry; - -// File:src/extras/geometries/DodecahedronGeometry.js - -/** - * @author Abe Pazos / https://hamoid.com - */ - -THREE.DodecahedronGeometry = function ( radius, detail ) { - - this.parameters = { - radius: radius, - detail: detail - }; - - var t = ( 1 + Math.sqrt( 5 ) ) / 2; - var r = 1 / t; - - var vertices = [ - - // (±1, ±1, ±1) - -1, -1, -1, -1, -1, 1, - -1, 1, -1, -1, 1, 1, - 1, -1, -1, 1, -1, 1, - 1, 1, -1, 1, 1, 1, - - // (0, ±1/φ, ±φ) - 0, -r, -t, 0, -r, t, - 0, r, -t, 0, r, t, - - // (±1/φ, ±φ, 0) - -r, -t, 0, -r, t, 0, - r, -t, 0, r, t, 0, - - // (±φ, 0, ±1/φ) - -t, 0, -r, t, 0, -r, - -t, 0, r, t, 0, r - ]; - - var indices = [ - 3, 11, 7, 3, 7, 15, 3, 15, 13, - 7, 19, 17, 7, 17, 6, 7, 6, 15, - 17, 4, 8, 17, 8, 10, 17, 10, 6, - 8, 0, 16, 8, 16, 2, 8, 2, 10, - 0, 12, 1, 0, 1, 18, 0, 18, 16, - 6, 10, 2, 6, 2, 13, 6, 13, 15, - 2, 16, 18, 2, 18, 3, 2, 3, 13, - 18, 1, 9, 18, 9, 11, 18, 11, 3, - 4, 14, 12, 4, 12, 0, 4, 0, 8, - 11, 9, 5, 11, 5, 19, 11, 19, 7, - 19, 5, 14, 19, 14, 4, 19, 4, 17, - 1, 12, 14, 1, 14, 5, 1, 5, 9 - ]; - - THREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail ); - -}; - -THREE.DodecahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.DodecahedronGeometry.prototype.constructor = THREE.DodecahedronGeometry; - -// File:src/extras/geometries/IcosahedronGeometry.js - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -THREE.IcosahedronGeometry = function ( radius, detail ) { - - var t = ( 1 + Math.sqrt( 5 ) ) / 2; - - var vertices = [ - - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, 0, - 0, - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, - t, 0, - 1, t, 0, 1, - t, 0, - 1, - t, 0, 1 - ]; - - var indices = [ - 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, - 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, - 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, - 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1 - ]; - - THREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'IcosahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; -}; - -THREE.IcosahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.IcosahedronGeometry.prototype.constructor = THREE.IcosahedronGeometry; - -// File:src/extras/geometries/OctahedronGeometry.js - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -THREE.OctahedronGeometry = function ( radius, detail ) { - - this.parameters = { - radius: radius, - detail: detail - }; - - var vertices = [ - 1, 0, 0, - 1, 0, 0, 0, 1, 0, 0,- 1, 0, 0, 0, 1, 0, 0,- 1 - ]; - - var indices = [ - 0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2 - ]; - - THREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'OctahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; -}; - -THREE.OctahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.OctahedronGeometry.prototype.constructor = THREE.OctahedronGeometry; - -// File:src/extras/geometries/TetrahedronGeometry.js - -/** - * @author timothypratley / https://github.com/timothypratley - */ - -THREE.TetrahedronGeometry = function ( radius, detail ) { - - var vertices = [ - 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1 - ]; - - var indices = [ - 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1 - ]; - - THREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'TetrahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - -}; - -THREE.TetrahedronGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.TetrahedronGeometry.prototype.constructor = THREE.TetrahedronGeometry; - -// File:src/extras/geometries/ParametricGeometry.js - -/** - * @author zz85 / https://github.com/zz85 - * Parametric Surfaces Geometry - * based on the brilliant article by @prideout http://prideout.net/blog/?p=44 - * - * new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements ); - * - */ - -THREE.ParametricGeometry = function ( func, slices, stacks ) { - - THREE.Geometry.call( this ); - - this.type = 'ParametricGeometry'; - - this.parameters = { - func: func, - slices: slices, - stacks: stacks - }; - - var verts = this.vertices; - var faces = this.faces; - var uvs = this.faceVertexUvs[ 0 ]; - - var i, j, p; - var u, v; - - var sliceCount = slices + 1; - - for ( i = 0; i <= stacks; i ++ ) { - - v = i / stacks; - - for ( j = 0; j <= slices; j ++ ) { - - u = j / slices; - - p = func( u, v ); - verts.push( p ); - - } - } - - var a, b, c, d; - var uva, uvb, uvc, uvd; - - for ( i = 0; i < stacks; i ++ ) { - - for ( j = 0; j < slices; j ++ ) { - - a = i * sliceCount + j; - b = i * sliceCount + j + 1; - c = (i + 1) * sliceCount + j + 1; - d = (i + 1) * sliceCount + j; - - uva = new THREE.Vector2( j / slices, i / stacks ); - uvb = new THREE.Vector2( ( j + 1 ) / slices, i / stacks ); - uvc = new THREE.Vector2( ( j + 1 ) / slices, ( i + 1 ) / stacks ); - uvd = new THREE.Vector2( j / slices, ( i + 1 ) / stacks ); - - faces.push( new THREE.Face3( a, b, d ) ); - uvs.push( [ uva, uvb, uvd ] ); - - faces.push( new THREE.Face3( b, c, d ) ); - uvs.push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - - } - - // console.log(this); - - // magic bullet - // var diff = this.mergeVertices(); - // console.log('removed ', diff, ' vertices by merging'); - - this.computeFaceNormals(); - this.computeVertexNormals(); - -}; - -THREE.ParametricGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.ParametricGeometry.prototype.constructor = THREE.ParametricGeometry; - -// File:src/extras/helpers/AxisHelper.js - -/** - * @author sroucheray / http://sroucheray.org/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.AxisHelper = function ( size ) { - - size = size || 1; - - var vertices = new Float32Array( [ - 0, 0, 0, size, 0, 0, - 0, 0, 0, 0, size, 0, - 0, 0, 0, 0, 0, size - ] ); - - var colors = new Float32Array( [ - 1, 0, 0, 1, 0.6, 0, - 0, 1, 0, 0.6, 1, 0, - 0, 0, 1, 0, 0.6, 1 - ] ); - - var geometry = new THREE.BufferGeometry(); - geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); - geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) ); - - var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } ); - - THREE.Line.call( this, geometry, material, THREE.LinePieces ); - -}; - -THREE.AxisHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.AxisHelper.prototype.constructor = THREE.AxisHelper; - -// File:src/extras/helpers/ArrowHelper.js - -/** - * @author WestLangley / http://github.com/WestLangley - * @author zz85 / http://github.com/zz85 - * @author bhouston / http://exocortex.com - * - * Creates an arrow for visualizing directions - * - * Parameters: - * dir - Vector3 - * origin - Vector3 - * length - Number - * color - color in hex value - * headLength - Number - * headWidth - Number - */ - -THREE.ArrowHelper = ( function () { - - var lineGeometry = new THREE.Geometry(); - lineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) ); - - var coneGeometry = new THREE.CylinderGeometry( 0, 0.5, 1, 5, 1 ); - coneGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 0.5, 0 ) ); - - return function ( dir, origin, length, color, headLength, headWidth ) { - - // dir is assumed to be normalized - - THREE.Object3D.call( this ); - - if ( color === undefined ) color = 0xffff00; - if ( length === undefined ) length = 1; - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; - - this.position.copy( origin ); - - this.line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color: color } ) ); - this.line.matrixAutoUpdate = false; - this.add( this.line ); - - this.cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color: color } ) ); - this.cone.matrixAutoUpdate = false; - this.add( this.cone ); - - this.setDirection( dir ); - this.setLength( length, headLength, headWidth ); - - } - -}() ); - -THREE.ArrowHelper.prototype = Object.create( THREE.Object3D.prototype ); -THREE.ArrowHelper.prototype.constructor = THREE.ArrowHelper; - -THREE.ArrowHelper.prototype.setDirection = ( function () { - - var axis = new THREE.Vector3(); - var radians; - - return function ( dir ) { - - // dir is assumed to be normalized - - if ( dir.y > 0.99999 ) { - - this.quaternion.set( 0, 0, 0, 1 ); - - } else if ( dir.y < - 0.99999 ) { - - this.quaternion.set( 1, 0, 0, 0 ); - - } else { - - axis.set( dir.z, 0, - dir.x ).normalize(); - - radians = Math.acos( dir.y ); - - this.quaternion.setFromAxisAngle( axis, radians ); - - } - - }; - -}() ); - -THREE.ArrowHelper.prototype.setLength = function ( length, headLength, headWidth ) { - - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; - - this.line.scale.set( 1, length - headLength, 1 ); - this.line.updateMatrix(); - - this.cone.scale.set( headWidth, headLength, headWidth ); - this.cone.position.y = length; - this.cone.updateMatrix(); - -}; - -THREE.ArrowHelper.prototype.setColor = function ( color ) { - - this.line.material.color.set( color ); - this.cone.material.color.set( color ); - -}; - -// File:src/extras/helpers/BoxHelper.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.BoxHelper = function ( object ) { - - var geometry = new THREE.BufferGeometry(); - geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( 72 ), 3 ) ); - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ), THREE.LinePieces ); - - if ( object !== undefined ) { - - this.update( object ); - - } - -}; - -THREE.BoxHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.BoxHelper.prototype.constructor = THREE.BoxHelper; - -THREE.BoxHelper.prototype.update = function ( object ) { - - var geometry = object.geometry; - - if ( geometry.boundingBox === null ) { - - geometry.computeBoundingBox(); - - } - - var min = geometry.boundingBox.min; - var max = geometry.boundingBox.max; - - /* - 5____4 - 1/___0/| - | 6__|_7 - 2/___3/ - - 0: max.x, max.y, max.z - 1: min.x, max.y, max.z - 2: min.x, min.y, max.z - 3: max.x, min.y, max.z - 4: max.x, max.y, min.z - 5: min.x, max.y, min.z - 6: min.x, min.y, min.z - 7: max.x, min.y, min.z - */ - - var vertices = this.geometry.attributes.position.array; - - vertices[ 0 ] = max.x; vertices[ 1 ] = max.y; vertices[ 2 ] = max.z; - vertices[ 3 ] = min.x; vertices[ 4 ] = max.y; vertices[ 5 ] = max.z; - - vertices[ 6 ] = min.x; vertices[ 7 ] = max.y; vertices[ 8 ] = max.z; - vertices[ 9 ] = min.x; vertices[ 10 ] = min.y; vertices[ 11 ] = max.z; - - vertices[ 12 ] = min.x; vertices[ 13 ] = min.y; vertices[ 14 ] = max.z; - vertices[ 15 ] = max.x; vertices[ 16 ] = min.y; vertices[ 17 ] = max.z; - - vertices[ 18 ] = max.x; vertices[ 19 ] = min.y; vertices[ 20 ] = max.z; - vertices[ 21 ] = max.x; vertices[ 22 ] = max.y; vertices[ 23 ] = max.z; - - // - - vertices[ 24 ] = max.x; vertices[ 25 ] = max.y; vertices[ 26 ] = min.z; - vertices[ 27 ] = min.x; vertices[ 28 ] = max.y; vertices[ 29 ] = min.z; - - vertices[ 30 ] = min.x; vertices[ 31 ] = max.y; vertices[ 32 ] = min.z; - vertices[ 33 ] = min.x; vertices[ 34 ] = min.y; vertices[ 35 ] = min.z; - - vertices[ 36 ] = min.x; vertices[ 37 ] = min.y; vertices[ 38 ] = min.z; - vertices[ 39 ] = max.x; vertices[ 40 ] = min.y; vertices[ 41 ] = min.z; - - vertices[ 42 ] = max.x; vertices[ 43 ] = min.y; vertices[ 44 ] = min.z; - vertices[ 45 ] = max.x; vertices[ 46 ] = max.y; vertices[ 47 ] = min.z; - - // - - vertices[ 48 ] = max.x; vertices[ 49 ] = max.y; vertices[ 50 ] = max.z; - vertices[ 51 ] = max.x; vertices[ 52 ] = max.y; vertices[ 53 ] = min.z; - - vertices[ 54 ] = min.x; vertices[ 55 ] = max.y; vertices[ 56 ] = max.z; - vertices[ 57 ] = min.x; vertices[ 58 ] = max.y; vertices[ 59 ] = min.z; - - vertices[ 60 ] = min.x; vertices[ 61 ] = min.y; vertices[ 62 ] = max.z; - vertices[ 63 ] = min.x; vertices[ 64 ] = min.y; vertices[ 65 ] = min.z; - - vertices[ 66 ] = max.x; vertices[ 67 ] = min.y; vertices[ 68 ] = max.z; - vertices[ 69 ] = max.x; vertices[ 70 ] = min.y; vertices[ 71 ] = min.z; - - this.geometry.attributes.position.needsUpdate = true; - - this.geometry.computeBoundingSphere(); - - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - -}; - -// File:src/extras/helpers/BoundingBoxHelper.js - -/** - * @author WestLangley / http://github.com/WestLangley - */ - -// a helper to show the world-axis-aligned bounding box for an object - -THREE.BoundingBoxHelper = function ( object, hex ) { - - var color = ( hex !== undefined ) ? hex : 0x888888; - - this.object = object; - - this.box = new THREE.Box3(); - - THREE.Mesh.call( this, new THREE.BoxGeometry( 1, 1, 1 ), new THREE.MeshBasicMaterial( { color: color, wireframe: true } ) ); - -}; - -THREE.BoundingBoxHelper.prototype = Object.create( THREE.Mesh.prototype ); -THREE.BoundingBoxHelper.prototype.constructor = THREE.BoundingBoxHelper; - -THREE.BoundingBoxHelper.prototype.update = function () { - - this.box.setFromObject( this.object ); - - this.box.size( this.scale ); - - this.box.center( this.position ); - -}; - -// File:src/extras/helpers/CameraHelper.js - -/** - * @author alteredq / http://alteredqualia.com/ - * - * - shows frustum, line of sight and up of the camera - * - suitable for fast updates - * - based on frustum visualization in lightgl.js shadowmap example - * http://evanw.github.com/lightgl.js/tests/shadowmap.html - */ - -THREE.CameraHelper = function ( camera ) { - - var geometry = new THREE.Geometry(); - var material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } ); - - var pointMap = {}; - - // colors - - var hexFrustum = 0xffaa00; - var hexCone = 0xff0000; - var hexUp = 0x00aaff; - var hexTarget = 0xffffff; - var hexCross = 0x333333; - - // near - - addLine( "n1", "n2", hexFrustum ); - addLine( "n2", "n4", hexFrustum ); - addLine( "n4", "n3", hexFrustum ); - addLine( "n3", "n1", hexFrustum ); - - // far - - addLine( "f1", "f2", hexFrustum ); - addLine( "f2", "f4", hexFrustum ); - addLine( "f4", "f3", hexFrustum ); - addLine( "f3", "f1", hexFrustum ); - - // sides - - addLine( "n1", "f1", hexFrustum ); - addLine( "n2", "f2", hexFrustum ); - addLine( "n3", "f3", hexFrustum ); - addLine( "n4", "f4", hexFrustum ); - - // cone - - addLine( "p", "n1", hexCone ); - addLine( "p", "n2", hexCone ); - addLine( "p", "n3", hexCone ); - addLine( "p", "n4", hexCone ); - - // up - - addLine( "u1", "u2", hexUp ); - addLine( "u2", "u3", hexUp ); - addLine( "u3", "u1", hexUp ); - - // target - - addLine( "c", "t", hexTarget ); - addLine( "p", "c", hexCross ); - - // cross - - addLine( "cn1", "cn2", hexCross ); - addLine( "cn3", "cn4", hexCross ); - - addLine( "cf1", "cf2", hexCross ); - addLine( "cf3", "cf4", hexCross ); - - function addLine( a, b, hex ) { - - addPoint( a, hex ); - addPoint( b, hex ); - - } - - function addPoint( id, hex ) { - - geometry.vertices.push( new THREE.Vector3() ); - geometry.colors.push( new THREE.Color( hex ) ); - - if ( pointMap[ id ] === undefined ) { - - pointMap[ id ] = []; - - } - - pointMap[ id ].push( geometry.vertices.length - 1 ); - - } - - THREE.Line.call( this, geometry, material, THREE.LinePieces ); - - this.camera = camera; - this.matrix = camera.matrixWorld; - this.matrixAutoUpdate = false; - - this.pointMap = pointMap; - - this.update(); - -}; - -THREE.CameraHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.CameraHelper.prototype.constructor = THREE.CameraHelper; - -THREE.CameraHelper.prototype.update = function () { - - var geometry, pointMap; - - var vector = new THREE.Vector3(); - var camera = new THREE.Camera(); - - var setPoint = function ( point, x, y, z ) { - - vector.set( x, y, z ).unproject( camera ); - - var points = pointMap[ point ]; - - if ( points !== undefined ) { - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - geometry.vertices[ points[ i ] ].copy( vector ); - - } - - } - - }; - - return function () { - - geometry = this.geometry; - pointMap = this.pointMap; - - var w = 1, h = 1; - - // we need just camera projection matrix - // world matrix must be identity - - camera.projectionMatrix.copy( this.camera.projectionMatrix ); - - // center / target - - setPoint( "c", 0, 0, - 1 ); - setPoint( "t", 0, 0, 1 ); - - // near - - setPoint( "n1", - w, - h, - 1 ); - setPoint( "n2", w, - h, - 1 ); - setPoint( "n3", - w, h, - 1 ); - setPoint( "n4", w, h, - 1 ); - - // far - - setPoint( "f1", - w, - h, 1 ); - setPoint( "f2", w, - h, 1 ); - setPoint( "f3", - w, h, 1 ); - setPoint( "f4", w, h, 1 ); - - // up - - setPoint( "u1", w * 0.7, h * 1.1, - 1 ); - setPoint( "u2", - w * 0.7, h * 1.1, - 1 ); - setPoint( "u3", 0, h * 2, - 1 ); - - // cross - - setPoint( "cf1", - w, 0, 1 ); - setPoint( "cf2", w, 0, 1 ); - setPoint( "cf3", 0, - h, 1 ); - setPoint( "cf4", 0, h, 1 ); - - setPoint( "cn1", - w, 0, - 1 ); - setPoint( "cn2", w, 0, - 1 ); - setPoint( "cn3", 0, - h, - 1 ); - setPoint( "cn4", 0, h, - 1 ); - - geometry.verticesNeedUpdate = true; - - }; - -}(); - -// File:src/extras/helpers/DirectionalLightHelper.js - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.DirectionalLightHelper = function ( light, size ) { - - THREE.Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - size = size || 1; - - var geometry = new THREE.Geometry(); - geometry.vertices.push( - new THREE.Vector3( - size, size, 0 ), - new THREE.Vector3( size, size, 0 ), - new THREE.Vector3( size, - size, 0 ), - new THREE.Vector3( - size, - size, 0 ), - new THREE.Vector3( - size, size, 0 ) - ); - - var material = new THREE.LineBasicMaterial( { fog: false } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - this.lightPlane = new THREE.Line( geometry, material ); - this.add( this.lightPlane ); - - geometry = new THREE.Geometry(); - geometry.vertices.push( - new THREE.Vector3(), - new THREE.Vector3() - ); - - material = new THREE.LineBasicMaterial( { fog: false } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - this.targetLine = new THREE.Line( geometry, material ); - this.add( this.targetLine ); - - this.update(); - -}; - -THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype ); -THREE.DirectionalLightHelper.prototype.constructor = THREE.DirectionalLightHelper; - -THREE.DirectionalLightHelper.prototype.dispose = function () { - - this.lightPlane.geometry.dispose(); - this.lightPlane.material.dispose(); - this.targetLine.geometry.dispose(); - this.targetLine.material.dispose(); -}; - -THREE.DirectionalLightHelper.prototype.update = function () { - - var v1 = new THREE.Vector3(); - var v2 = new THREE.Vector3(); - var v3 = new THREE.Vector3(); - - return function () { - - v1.setFromMatrixPosition( this.light.matrixWorld ); - v2.setFromMatrixPosition( this.light.target.matrixWorld ); - v3.subVectors( v2, v1 ); - - this.lightPlane.lookAt( v3 ); - this.lightPlane.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - this.targetLine.geometry.vertices[ 1 ].copy( v3 ); - this.targetLine.geometry.verticesNeedUpdate = true; - this.targetLine.material.color.copy( this.lightPlane.material.color ); - - }; - -}(); - -// File:src/extras/helpers/EdgesHelper.js - -/** - * @author WestLangley / http://github.com/WestLangley - * @param object THREE.Mesh whose geometry will be used - * @param hex line color - * @param thresholdAngle the minimim angle (in degrees), - * between the face normals of adjacent faces, - * that is required to render an edge. A value of 10 means - * an edge is only rendered if the angle is at least 10 degrees. - */ - -THREE.EdgesHelper = function ( object, hex, thresholdAngle ) { - - var color = ( hex !== undefined ) ? hex : 0xffffff; - thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1; - - var thresholdDot = Math.cos( THREE.Math.degToRad( thresholdAngle ) ); - - var edge = [ 0, 0 ], hash = {}; - var sortFunction = function ( a, b ) { return a - b }; - - var keys = [ 'a', 'b', 'c' ]; - var geometry = new THREE.BufferGeometry(); - - var geometry2; - - if ( object.geometry instanceof THREE.BufferGeometry ) { - - geometry2 = new THREE.Geometry(); - geometry2.fromBufferGeometry( object.geometry ); - - } else { - - geometry2 = object.geometry.clone(); - - } - - geometry2.mergeVertices(); - geometry2.computeFaceNormals(); - - var vertices = geometry2.vertices; - var faces = geometry2.faces; - var numEdges = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = face[ keys[ j ] ]; - edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - hash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined }; - numEdges ++; - - } else { - - hash[ key ].face2 = i; - - } - - } - - } - - var coords = new Float32Array( numEdges * 2 * 3 ); - - var index = 0; - - for ( var key in hash ) { - - var h = hash[ key ]; - - if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) { - - var vertex = vertices[ h.vert1 ]; - coords[ index ++ ] = vertex.x; - coords[ index ++ ] = vertex.y; - coords[ index ++ ] = vertex.z; - - vertex = vertices[ h.vert2 ]; - coords[ index ++ ] = vertex.x; - coords[ index ++ ] = vertex.y; - coords[ index ++ ] = vertex.z; - - } - - } - - geometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) ); - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color } ), THREE.LinePieces ); - - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - -}; - -THREE.EdgesHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.EdgesHelper.prototype.constructor = THREE.EdgesHelper; - -// File:src/extras/helpers/FaceNormalsHelper.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.FaceNormalsHelper = function ( object, size, hex, linewidth ) { - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0xffff00; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - var geometry = new THREE.Geometry(); - - var faces = this.object.geometry.faces; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - geometry.vertices.push( new THREE.Vector3(), new THREE.Vector3() ); - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); - - this.matrixAutoUpdate = false; - - this.normalMatrix = new THREE.Matrix3(); - - this.update(); - -}; - -THREE.FaceNormalsHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.FaceNormalsHelper.prototype.constructor = THREE.FaceNormalsHelper; - -THREE.FaceNormalsHelper.prototype.update = function () { - - var vertices = this.geometry.vertices; - - var object = this.object; - var objectVertices = object.geometry.vertices; - var objectFaces = object.geometry.faces; - var objectWorldMatrix = object.matrixWorld; - - object.updateMatrixWorld( true ); - - this.normalMatrix.getNormalMatrix( objectWorldMatrix ); - - for ( var i = 0, i2 = 0, l = objectFaces.length; i < l; i ++, i2 += 2 ) { - - var face = objectFaces[ i ]; - - vertices[ i2 ].copy( objectVertices[ face.a ] ) - .add( objectVertices[ face.b ] ) - .add( objectVertices[ face.c ] ) - .divideScalar( 3 ) - .applyMatrix4( objectWorldMatrix ); - - vertices[ i2 + 1 ].copy( face.normal ) - .applyMatrix3( this.normalMatrix ) - .normalize() - .multiplyScalar( this.size ) - .add( vertices[ i2 ] ); - - } - - this.geometry.verticesNeedUpdate = true; - - return this; - -}; - - -// File:src/extras/helpers/GridHelper.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.GridHelper = function ( size, step ) { - - var geometry = new THREE.Geometry(); - var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } ); - - this.color1 = new THREE.Color( 0x444444 ); - this.color2 = new THREE.Color( 0x888888 ); - - for ( var i = - size; i <= size; i += step ) { - - geometry.vertices.push( - new THREE.Vector3( - size, 0, i ), new THREE.Vector3( size, 0, i ), - new THREE.Vector3( i, 0, - size ), new THREE.Vector3( i, 0, size ) - ); - - var color = i === 0 ? this.color1 : this.color2; - - geometry.colors.push( color, color, color, color ); - - } - - THREE.Line.call( this, geometry, material, THREE.LinePieces ); - -}; - -THREE.GridHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.GridHelper.prototype.constructor = THREE.GridHelper; - -THREE.GridHelper.prototype.setColors = function( colorCenterLine, colorGrid ) { - - this.color1.set( colorCenterLine ); - this.color2.set( colorGrid ); - - this.geometry.colorsNeedUpdate = true; - -} - -// File:src/extras/helpers/HemisphereLightHelper.js - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.HemisphereLightHelper = function ( light, sphereSize ) { - - THREE.Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - this.colors = [ new THREE.Color(), new THREE.Color() ]; - - var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 ); - geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) ); - - for ( var i = 0, il = 8; i < il; i ++ ) { - - geometry.faces[ i ].color = this.colors[ i < 4 ? 0 : 1 ]; - - } - - var material = new THREE.MeshBasicMaterial( { vertexColors: THREE.FaceColors, wireframe: true } ); - - this.lightSphere = new THREE.Mesh( geometry, material ); - this.add( this.lightSphere ); - - this.update(); - -}; - -THREE.HemisphereLightHelper.prototype = Object.create( THREE.Object3D.prototype ); -THREE.HemisphereLightHelper.prototype.constructor = THREE.HemisphereLightHelper; - -THREE.HemisphereLightHelper.prototype.dispose = function () { - this.lightSphere.geometry.dispose(); - this.lightSphere.material.dispose(); -}; - -THREE.HemisphereLightHelper.prototype.update = function () { - - var vector = new THREE.Vector3(); - - return function () { - - this.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity ); - this.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity ); - - this.lightSphere.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() ); - this.lightSphere.geometry.colorsNeedUpdate = true; - - } - -}(); - -// File:src/extras/helpers/PointLightHelper.js - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.PointLightHelper = function ( light, sphereSize ) { - - this.light = light; - this.light.updateMatrixWorld(); - - var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 ); - var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - THREE.Mesh.call( this, geometry, material ); - - this.matrix = this.light.matrixWorld; - this.matrixAutoUpdate = false; - - /* - var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 ); - var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } ); - - this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); - this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial ); - - var d = light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.scale.set( d, d, d ); - - } - - this.add( this.lightDistance ); - */ - -}; - -THREE.PointLightHelper.prototype = Object.create( THREE.Mesh.prototype ); -THREE.PointLightHelper.prototype.constructor = THREE.PointLightHelper; - -THREE.PointLightHelper.prototype.dispose = function () { - - this.geometry.dispose(); - this.material.dispose(); -}; - -THREE.PointLightHelper.prototype.update = function () { - - this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - /* - var d = this.light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.visible = true; - this.lightDistance.scale.set( d, d, d ); - - } - */ - -}; - -// File:src/extras/helpers/SkeletonHelper.js - -/** - * @author Sean Griffin / http://twitter.com/sgrif - * @author Michael Guerrero / http://realitymeltdown.com - * @author mrdoob / http://mrdoob.com/ - * @author ikerr / http://verold.com - */ - -THREE.SkeletonHelper = function ( object ) { - - this.bones = this.getBoneList( object ); - - var geometry = new THREE.Geometry(); - - for ( var i = 0; i < this.bones.length; i ++ ) { - - var bone = this.bones[ i ]; - - if ( bone.parent instanceof THREE.Bone ) { - - geometry.vertices.push( new THREE.Vector3() ); - geometry.vertices.push( new THREE.Vector3() ); - geometry.colors.push( new THREE.Color( 0, 0, 1 ) ); - geometry.colors.push( new THREE.Color( 0, 1, 0 ) ); - - } - - } - - var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors, depthTest: false, depthWrite: false, transparent: true } ); - - THREE.Line.call( this, geometry, material, THREE.LinePieces ); - - this.root = object; - - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - - this.update(); - -}; - - -THREE.SkeletonHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.SkeletonHelper.prototype.constructor = THREE.SkeletonHelper; - -THREE.SkeletonHelper.prototype.getBoneList = function( object ) { - - var boneList = []; - - if ( object instanceof THREE.Bone ) { - - boneList.push( object ); - - } - - for ( var i = 0; i < object.children.length; i ++ ) { - - boneList.push.apply( boneList, this.getBoneList( object.children[ i ] ) ); - - } - - return boneList; - -}; - -THREE.SkeletonHelper.prototype.update = function () { - - var geometry = this.geometry; - - var matrixWorldInv = new THREE.Matrix4().getInverse( this.root.matrixWorld ); - - var boneMatrix = new THREE.Matrix4(); - - var j = 0; - - for ( var i = 0; i < this.bones.length; i ++ ) { - - var bone = this.bones[ i ]; - - if ( bone.parent instanceof THREE.Bone ) { - - boneMatrix.multiplyMatrices( matrixWorldInv, bone.matrixWorld ); - geometry.vertices[ j ].setFromMatrixPosition( boneMatrix ); - - boneMatrix.multiplyMatrices( matrixWorldInv, bone.parent.matrixWorld ); - geometry.vertices[ j + 1 ].setFromMatrixPosition( boneMatrix ); - - j += 2; - - } - - } - - geometry.verticesNeedUpdate = true; - - geometry.computeBoundingSphere(); - -}; - -// File:src/extras/helpers/SpotLightHelper.js - -/** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.SpotLightHelper = function ( light ) { - - THREE.Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - var geometry = new THREE.CylinderGeometry( 0, 1, 1, 8, 1, true ); - - geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 0.5, 0 ) ); - geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) ); - - var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } ); - - this.cone = new THREE.Mesh( geometry, material ); - this.add( this.cone ); - - this.update(); - -}; - -THREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype ); -THREE.SpotLightHelper.prototype.constructor = THREE.SpotLightHelper; - -THREE.SpotLightHelper.prototype.dispose = function () { - this.cone.geometry.dispose(); - this.cone.material.dispose(); -}; - -THREE.SpotLightHelper.prototype.update = function () { - - var vector = new THREE.Vector3(); - var vector2 = new THREE.Vector3(); - - return function () { - - var coneLength = this.light.distance ? this.light.distance : 10000; - var coneWidth = coneLength * Math.tan( this.light.angle ); - - this.cone.scale.set( coneWidth, coneWidth, coneLength ); - - vector.setFromMatrixPosition( this.light.matrixWorld ); - vector2.setFromMatrixPosition( this.light.target.matrixWorld ); - - this.cone.lookAt( vector2.sub( vector ) ); - - this.cone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - }; - -}(); - -// File:src/extras/helpers/VertexNormalsHelper.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) { - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0xff0000; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - var geometry = new THREE.Geometry(); - - var faces = object.geometry.faces; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - geometry.vertices.push( new THREE.Vector3(), new THREE.Vector3() ); - - } - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); - - this.matrixAutoUpdate = false; - - this.normalMatrix = new THREE.Matrix3(); - - this.update(); - -}; - -THREE.VertexNormalsHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.VertexNormalsHelper.prototype.constructor = THREE.VertexNormalsHelper; - -THREE.VertexNormalsHelper.prototype.update = ( function ( object ) { - - var v1 = new THREE.Vector3(); - - return function( object ) { - - var keys = [ 'a', 'b', 'c', 'd' ]; - - this.object.updateMatrixWorld( true ); - - this.normalMatrix.getNormalMatrix( this.object.matrixWorld ); - - var vertices = this.geometry.vertices; - - var verts = this.object.geometry.vertices; - - var faces = this.object.geometry.faces; - - var worldMatrix = this.object.matrixWorld; - - var idx = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - var vertexId = face[ keys[ j ] ]; - var vertex = verts[ vertexId ]; - - var normal = face.vertexNormals[ j ]; - - vertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix ); - - v1.copy( normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size ); - - v1.add( vertices[ idx ] ); - idx = idx + 1; - - vertices[ idx ].copy( v1 ); - idx = idx + 1; - - } - - } - - this.geometry.verticesNeedUpdate = true; - - return this; - - } - -}()); - -// File:src/extras/helpers/VertexTangentsHelper.js - -/** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley -*/ - -THREE.VertexTangentsHelper = function ( object, size, hex, linewidth ) { - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0x0000ff; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - var geometry = new THREE.Geometry(); - - var faces = object.geometry.faces; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) { - - geometry.vertices.push( new THREE.Vector3() ); - geometry.vertices.push( new THREE.Vector3() ); - - } - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces ); - - this.matrixAutoUpdate = false; - - this.update(); - -}; - -THREE.VertexTangentsHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.VertexTangentsHelper.prototype.constructor = THREE.VertexTangentsHelper; - -THREE.VertexTangentsHelper.prototype.update = ( function ( object ) { - - var v1 = new THREE.Vector3(); - - return function( object ) { - - var keys = [ 'a', 'b', 'c', 'd' ]; - - this.object.updateMatrixWorld( true ); - - var vertices = this.geometry.vertices; - - var verts = this.object.geometry.vertices; - - var faces = this.object.geometry.faces; - - var worldMatrix = this.object.matrixWorld; - - var idx = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) { - - var vertexId = face[ keys[ j ] ]; - var vertex = verts[ vertexId ]; - - var tangent = face.vertexTangents[ j ]; - - vertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix ); - - v1.copy( tangent ).transformDirection( worldMatrix ).multiplyScalar( this.size ); - - v1.add( vertices[ idx ] ); - idx = idx + 1; - - vertices[ idx ].copy( v1 ); - idx = idx + 1; - - } - - } - - this.geometry.verticesNeedUpdate = true; - - return this; - - } - -}()); - -// File:src/extras/helpers/WireframeHelper.js - -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.WireframeHelper = function ( object, hex ) { - - var color = ( hex !== undefined ) ? hex : 0xffffff; - - var edge = [ 0, 0 ], hash = {}; - var sortFunction = function ( a, b ) { return a - b }; - - var keys = [ 'a', 'b', 'c' ]; - var geometry = new THREE.BufferGeometry(); - - if ( object.geometry instanceof THREE.Geometry ) { - - var vertices = object.geometry.vertices; - var faces = object.geometry.faces; - var numEdges = 0; - - // allocate maximal size - var edges = new Uint32Array( 6 * faces.length ); - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = face[ keys[ j ] ]; - edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - edges[ 2 * numEdges ] = edge[ 0 ]; - edges[ 2 * numEdges + 1 ] = edge[ 1 ]; - hash[ key ] = true; - numEdges ++; - - } - - } - - } - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numEdges; i < l; i ++ ) { - - for ( var j = 0; j < 2; j ++ ) { - - var vertex = vertices[ edges [ 2 * i + j] ]; - - var index = 6 * i + 3 * j; - coords[ index + 0 ] = vertex.x; - coords[ index + 1 ] = vertex.y; - coords[ index + 2 ] = vertex.z; - - } - - } - - geometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) ); - - } else if ( object.geometry instanceof THREE.BufferGeometry ) { - - if ( object.geometry.attributes.index !== undefined ) { // Indexed BufferGeometry - - var vertices = object.geometry.attributes.position.array; - var indices = object.geometry.attributes.index.array; - var drawcalls = object.geometry.drawcalls; - var numEdges = 0; - - if ( drawcalls.length === 0 ) { - - drawcalls = [ { count : indices.length, index : 0, start : 0 } ]; - - } - - // allocate maximal size - var edges = new Uint32Array( 2 * indices.length ); - - for ( var o = 0, ol = drawcalls.length; o < ol; ++ o ) { - - var start = drawcalls[ o ].start; - var count = drawcalls[ o ].count; - var index = drawcalls[ o ].index; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = index + indices[ i + j ]; - edge[ 1 ] = index + indices[ i + ( j + 1 ) % 3 ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - edges[ 2 * numEdges ] = edge[ 0 ]; - edges[ 2 * numEdges + 1 ] = edge[ 1 ]; - hash[ key ] = true; - numEdges ++; - - } - - } - - } - - } - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numEdges; i < l; i ++ ) { - - for ( var j = 0; j < 2; j ++ ) { - - var index = 6 * i + 3 * j; - var index2 = 3 * edges[ 2 * i + j]; - coords[ index + 0 ] = vertices[ index2 ]; - coords[ index + 1 ] = vertices[ index2 + 1 ]; - coords[ index + 2 ] = vertices[ index2 + 2 ]; - - } - - } - - geometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) ); - - } else { // non-indexed BufferGeometry - - var vertices = object.geometry.attributes.position.array; - var numEdges = vertices.length / 3; - var numTris = numEdges / 3; - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numTris; i < l; i ++ ) { - - for ( var j = 0; j < 3; j ++ ) { - - var index = 18 * i + 6 * j; - - var index1 = 9 * i + 3 * j; - coords[ index + 0 ] = vertices[ index1 ]; - coords[ index + 1 ] = vertices[ index1 + 1 ]; - coords[ index + 2 ] = vertices[ index1 + 2 ]; - - var index2 = 9 * i + 3 * ( ( j + 1 ) % 3 ); - coords[ index + 3 ] = vertices[ index2 ]; - coords[ index + 4 ] = vertices[ index2 + 1 ]; - coords[ index + 5 ] = vertices[ index2 + 2 ]; - - } - - } - - geometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) ); - - } - - } - - THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color } ), THREE.LinePieces ); - - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - -}; - -THREE.WireframeHelper.prototype = Object.create( THREE.Line.prototype ); -THREE.WireframeHelper.prototype.constructor = THREE.WireframeHelper; - -// File:src/extras/objects/ImmediateRenderObject.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.ImmediateRenderObject = function () { - - THREE.Object3D.call( this ); - - this.render = function ( renderCallback ) {}; - -}; - -THREE.ImmediateRenderObject.prototype = Object.create( THREE.Object3D.prototype ); -THREE.ImmediateRenderObject.prototype.constructor = THREE.ImmediateRenderObject; - -// File:src/extras/objects/MorphBlendMesh.js - -/** - * @author alteredq / http://alteredqualia.com/ - */ - -THREE.MorphBlendMesh = function( geometry, material ) { - - THREE.Mesh.call( this, geometry, material ); - - this.animationsMap = {}; - this.animationsList = []; - - // prepare default animation - // (all frames played together in 1 second) - - var numFrames = this.geometry.morphTargets.length; - - var name = "__default"; - - var startFrame = 0; - var endFrame = numFrames - 1; - - var fps = numFrames / 1; - - this.createAnimation( name, startFrame, endFrame, fps ); - this.setAnimationWeight( name, 1 ); - -}; - -THREE.MorphBlendMesh.prototype = Object.create( THREE.Mesh.prototype ); -THREE.MorphBlendMesh.prototype.constructor = THREE.MorphBlendMesh; - -THREE.MorphBlendMesh.prototype.createAnimation = function ( name, start, end, fps ) { - - var animation = { - - startFrame: start, - endFrame: end, - - length: end - start + 1, - - fps: fps, - duration: ( end - start ) / fps, - - lastFrame: 0, - currentFrame: 0, - - active: false, - - time: 0, - direction: 1, - weight: 1, - - directionBackwards: false, - mirroredLoop: false - - }; - - this.animationsMap[ name ] = animation; - this.animationsList.push( animation ); - -}; - -THREE.MorphBlendMesh.prototype.autoCreateAnimations = function ( fps ) { - - var pattern = /([a-z]+)_?(\d+)/; - - var firstAnimation, frameRanges = {}; - - var geometry = this.geometry; - - for ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) { - - var morph = geometry.morphTargets[ i ]; - var chunks = morph.name.match( pattern ); - - if ( chunks && chunks.length > 1 ) { - - var name = chunks[ 1 ]; - - if ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity }; - - var range = frameRanges[ name ]; - - if ( i < range.start ) range.start = i; - if ( i > range.end ) range.end = i; - - if ( ! firstAnimation ) firstAnimation = name; - - } - - } - - for ( var name in frameRanges ) { - - var range = frameRanges[ name ]; - this.createAnimation( name, range.start, range.end, fps ); - - } - - this.firstAnimation = firstAnimation; - -}; - -THREE.MorphBlendMesh.prototype.setAnimationDirectionForward = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = 1; - animation.directionBackwards = false; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = - 1; - animation.directionBackwards = true; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationFPS = function ( name, fps ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.fps = fps; - animation.duration = ( animation.end - animation.start ) / animation.fps; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationDuration = function ( name, duration ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.duration = duration; - animation.fps = ( animation.end - animation.start ) / animation.duration; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationWeight = function ( name, weight ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.weight = weight; - - } - -}; - -THREE.MorphBlendMesh.prototype.setAnimationTime = function ( name, time ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = time; - - } - -}; - -THREE.MorphBlendMesh.prototype.getAnimationTime = function ( name ) { - - var time = 0; - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - time = animation.time; - - } - - return time; - -}; - -THREE.MorphBlendMesh.prototype.getAnimationDuration = function ( name ) { - - var duration = - 1; - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - duration = animation.duration; - - } - - return duration; - -}; - -THREE.MorphBlendMesh.prototype.playAnimation = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = 0; - animation.active = true; - - } else { - - THREE.warn( "THREE.MorphBlendMesh: animation[" + name + "] undefined in .playAnimation()" ); - - } - -}; - -THREE.MorphBlendMesh.prototype.stopAnimation = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.active = false; - - } - -}; - -THREE.MorphBlendMesh.prototype.update = function ( delta ) { - - for ( var i = 0, il = this.animationsList.length; i < il; i ++ ) { - - var animation = this.animationsList[ i ]; - - if ( ! animation.active ) continue; - - var frameTime = animation.duration / animation.length; - - animation.time += animation.direction * delta; - - if ( animation.mirroredLoop ) { - - if ( animation.time > animation.duration || animation.time < 0 ) { - - animation.direction *= - 1; - - if ( animation.time > animation.duration ) { - - animation.time = animation.duration; - animation.directionBackwards = true; - - } - - if ( animation.time < 0 ) { - - animation.time = 0; - animation.directionBackwards = false; - - } - - } - - } else { - - animation.time = animation.time % animation.duration; - - if ( animation.time < 0 ) animation.time += animation.duration; - - } - - var keyframe = animation.startFrame + THREE.Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 ); - var weight = animation.weight; - - if ( keyframe !== animation.currentFrame ) { - - this.morphTargetInfluences[ animation.lastFrame ] = 0; - this.morphTargetInfluences[ animation.currentFrame ] = 1 * weight; - - this.morphTargetInfluences[ keyframe ] = 0; - - animation.lastFrame = animation.currentFrame; - animation.currentFrame = keyframe; - - } - - var mix = ( animation.time % frameTime ) / frameTime; - - if ( animation.directionBackwards ) mix = 1 - mix; - - this.morphTargetInfluences[ animation.currentFrame ] = mix * weight; - this.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight; - - } - -}; - diff --git a/libs/three.js/r71/three.min.js b/libs/three.js/r71/three.min.js deleted file mode 100644 index 85e55962..00000000 --- a/libs/three.js/r71/three.min.js +++ /dev/null @@ -1,835 +0,0 @@ -// threejs.org/license -'use strict';var THREE={REVISION:"71"};"object"===typeof module&&(module.exports=THREE);void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0<a?1:+a});THREE.log=function(){console.log.apply(console,arguments)};THREE.warn=function(){console.warn.apply(console,arguments)};THREE.error=function(){console.error.apply(console,arguments)};THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0; -THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102; -THREE.MinEquation=103;THREE.MaxEquation=104;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302; -THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011; -THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.HalfFloatType=1025;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGBEFormat=THREE.RGBAFormat;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;THREE.RGBA_S3TC_DXT3_Format=2003; -THREE.RGBA_S3TC_DXT5_Format=2004;THREE.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103; -THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(a,b){THREE.warn("THREE.Projector: .projectVector() is now vector.project().");a.project(b)};this.unprojectVector=function(a,b){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");a.unproject(b)};this.pickingRay=function(a,b){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}; -THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}};THREE.Color=function(a){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(a)}; -THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){a instanceof THREE.Color?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)* -c:.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a};b=.5>=c?c*(1+b):c+b-c*b;c=2*c-b;this.r=d(c,b,a+1/3);this.g=d(c,b,a);this.b=d(c,b,a-1/3)}return this},setStyle:function(a){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(a))return a=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(a))return a=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(a),this.r= -Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},copy:function(a){this.r=a.r;this.g= -a.g;this.b=a.b;return this},copyGammaToLinear:function(a,b){void 0===b&&(b=2);this.r=Math.pow(a.r,b);this.g=Math.pow(a.g,b);this.b=Math.pow(a.b,b);return this},copyLinearToGamma:function(a,b){void 0===b&&(b=2);var c=0<b?1/b:1;this.r=Math.pow(a.r,c);this.g=Math.pow(a.g,c);this.b=Math.pow(a.b,c);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b= -Math.sqrt(this.b);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(a){a=a||{h:0,s:0,l:0};var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var k=e-f,f=.5>=h?k/(e+f):k/(2-e-f);switch(e){case b:g=(c-d)/k+(c<d?6:0);break;case c:g=(d-b)/k+2;break;case d:g=(b-c)/k+4}g/=6}a.h=g;a.s=f;a.l=h;return a},getStyle:function(){return"rgb("+ -(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,b,c){var d=this.getHSL();d.h+=a;d.s+=b;d.l+=c;this.setHSL(d.h,d.s,d.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a; -return this},lerp:function(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a){this.r=a[0];this.g=a[1];this.b=a[2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.r;a[b+1]=this.g;a[b+2]=this.b;return a},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; -THREE.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643, -darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055, -grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184, -lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130, -palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888, -tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Quaternion=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}; -THREE.Quaternion.prototype={constructor:THREE.Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get w(){return this._w},set w(a){this._w=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z; -this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!1===a instanceof THREE.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var c=Math.cos(a._x/2),d=Math.cos(a._y/2),e=Math.cos(a._z/2),f=Math.sin(a._x/2),g=Math.sin(a._y/2),h=Math.sin(a._z/2);"XYZ"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"YXZ"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z= -c*d*h-f*g*e,this._w=c*d*e+f*g*h):"ZXY"===a.order?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"ZYX"===a.order?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"YZX"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e-f*g*h):"XZY"===a.order&&(this._x=f*d*e-c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e+f*g*h);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a, -b){var c=b/2,d=Math.sin(c);this._x=a.x*d;this._y=a.y*d;this._z=a.z*d;this._w=Math.cos(c);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],k=b[6],b=b[10],l=c+f+b;0<l?(c=.5/Math.sqrt(l+1),this._w=.25/c,this._x=(k-g)*c,this._y=(d-h)*c,this._z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(k-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y= -.25*c,this._z=(g+k)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector3);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*= --1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this}, -multiply:function(a,b){return void 0!==b?(THREE.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,k=b._z,l=b._w;this._x=c*l+f*g+d*k-e*h;this._y=d*l+f*h+e*g-c*k;this._z=e*l+f*k+c*h-d*g;this._w=f*l-c*g-d*h-e*k;this.onChangeCallback();return this},multiplyVector3:function(a){THREE.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."); -return a.applyQuaternion(this)},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=Math.acos(g),k=Math.sqrt(1-g*g);if(.001>Math.abs(k))return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;g=Math.sin((1-b)*h)/k;h= -Math.sin(b*h)/k;this._w=f*g+this._w*h;this._x=c*g+this._x*h;this._y=d*g+this._y*h;this._z=e*g+this._z*h;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback= -a;return this},onChangeCallback:function(){},clone:function(){return new THREE.Quaternion(this._x,this._y,this._z,this._w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; -THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a, -b){if(void 0!==b)return THREE.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},sub:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this}, -subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.x<a.x&&(this.x=a.x); -this.y<a.y&&(this.y=a.y);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector2,b=new THREE.Vector2);a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x= -Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))}, -distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){this.subVectors(b,a).multiplyScalar(c).add(a);return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0=== -a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];return this},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; -THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+ -a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), -this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*= -a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a;return function(b){!1===b instanceof THREE.Euler&&THREE.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new THREE.Quaternion);this.applyQuaternion(a.setFromEuler(b));return this}}(),applyAxisAngle:function(){var a;return function(b,c){void 0===a&&(a=new THREE.Quaternion);this.applyQuaternion(a.setFromAxisAngle(b, -c));return this}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]* -c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,k=a*c+g*b-e*d,l=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-l*-f;this.y=k*a+b*-f+l*-e-h*-g;this.z=l*a+b*-g+h*-f-k*-e;return this},project:function(){var a;return function(b){void 0===a&&(a=new THREE.Matrix4);a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld));return this.applyProjection(a)}}(), -unproject:function(){var a;return function(b){void 0===a&&(a=new THREE.Matrix4);a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyProjection(a)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*= -a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector3, -b=new THREE.Vector3);a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y): -Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())}, -setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){this.subVectors(b,a).multiplyScalar(c).add(a);return this},cross:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y= -e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g;this.y=e*f-c*h;this.z=c*g-d*f;return this},projectOnVector:function(){var a,b;return function(c){void 0===a&&(a=new THREE.Vector3);a.copy(c).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a;return function(b){void 0===a&&(a=new THREE.Vector3);a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0=== -a&&(a=new THREE.Vector3);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){THREE.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}, -setEulerFromQuaternion:function(a,b){THREE.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){THREE.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){THREE.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a, -b){THREE.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(a,b)},setFromMatrixPosition:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setFromMatrixScale:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length();a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a; -return this},setFromMatrixColumn:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z= -a.array[b+2];return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}; -THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x; -case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a, -b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*= -a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4> -b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],k=a[9];c=a[2];b=a[6];var l=a[10];if(.01>Math.abs(d-g)&&.01>Math.abs(f-c)&&.01>Math.abs(k-b)){if(.1>Math.abs(d+g)&&.1>Math.abs(f+c)&&.1>Math.abs(k+b)&&.1>Math.abs(e+h+l-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;l=(l+1)/2;d=(d+g)/4;f=(f+c)/4;k=(k+b)/4;e>h&&e>l?.01>e?(b=0,d=c=.707106781):(b= -Math.sqrt(e),c=d/b,d=f/b):h>l?.01>h?(b=.707106781,c=0,d=.707106781):(c=Math.sqrt(h),b=d/c,d=k/c):.01>l?(c=b=.707106781,d=0):(d=Math.sqrt(l),b=f/d,c=k/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-k)*(b-k)+(f-c)*(f-c)+(g-d)*(g-d));.001>Math.abs(a)&&(a=1);this.x=(b-k)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+l-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&& -(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=a.w);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector4,b=new THREE.Vector4);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x= -Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y); -this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+ -Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){this.subVectors(b,a).multiplyScalar(c).add(a);return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w}, -fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];this.w=a.array[b+3];return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}}; -THREE.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ"; -THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback();return this},copy:function(a){this._x= -a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=THREE.Math.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],k=e[5],l=e[9],p=e[2],q=e[6],e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-l,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(q,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h, -k)):(this._y=Math.atan2(-p,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(q,-1,1)),.99999>Math.abs(q)?(this._y=Math.atan2(-p,e),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(p,-1,1)),.99999>Math.abs(p)?(this._x=Math.atan2(q,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-l,k),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z= -Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(q,k),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-l,e),this._y=0)):THREE.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Matrix4);a.makeRotationFromQuaternion(b);this.setFromRotationMatrix(a,c,d);return this}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z, -b||this._order)},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this);this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a? -a.set(this._x,this._y,this._z):new THREE.Vector3(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3}; -THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a, -b){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=THREE.Math.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); -this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}};THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)}; -THREE.Box2.prototype={constructor:THREE.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new THREE.Vector2;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x= -this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(a){return(a||new THREE.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(a){return(a||new THREE.Vector2).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a); -this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector2).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y> -this.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& -a.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)}; -THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new THREE.Vector3;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),setFromObject:function(){var a=new THREE.Vector3;return function(b){var c=this;b.updateMatrixWorld(!0); -this.makeEmpty();b.traverse(function(b){var e=b.geometry;if(void 0!==e)if(e instanceof THREE.Geometry)for(var f=e.vertices,e=0,g=f.length;e<g;e++)a.copy(f[e]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a);else if(e instanceof THREE.BufferGeometry&&void 0!==e.attributes.position)for(f=e.attributes.position.array,e=0,g=f.length;e<g;e+=3)a.set(f[e],f[e+1],f[e+2]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a)});return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this}, -makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(a){return(a||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a); -this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector3).set((a.x-this.min.x)/(this.max.x- -this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a= -new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y, -this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a); -this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);0<arguments.length&&THREE.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,k){var l=this.elements;l[0]=a;l[3]=b;l[6]=c;l[1]=d;l[4]=e;l[7]=f;l[2]=g;l[5]=h;l[8]=k;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){THREE.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}, -multiplyVector3Array:function(a){THREE.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*= -a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],k=a[7],a=a[8];return b*f*a-b*g*k-c*e*a+c*g*h+d*e*k-d*f*h},getInverse:function(a,b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4]; -c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");THREE.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4]; -a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]]},clone:function(){return(new THREE.Matrix3).fromArray(this.elements)}}; -THREE.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);0<arguments.length&&THREE.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,l,p,q,n,t,r,s){var u=this.elements;u[0]=a;u[4]=b;u[8]=c;u[12]=d;u[1]=e;u[5]=f;u[9]=g;u[13]=h;u[2]=k;u[6]=l;u[10]=p;u[14]=q;u[3]=n;u[7]=t;u[11]=r;u[15]=s;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){THREE.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().");return this.copyPosition(a)}, -copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){var d=this.elements;a.set(d[0],d[1],d[2]);b.set(d[4],d[5],d[6]);c.set(d[8],d[9],d[10]);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements;b=b.elements;var d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(), -f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),makeRotationFromEuler:function(a){!1===a instanceof THREE.Euler&&THREE.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e, -l=c*h,p=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+l*d;b[5]=a-p*d;b[9]=-c*g;b[2]=p-a*d;b[6]=l+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,l=d*h,p=d*e,b[0]=a+p*c,b[4]=l*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-l,b[6]=p+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,l=d*h,p=d*e,b[0]=a-p*c,b[4]=-f*e,b[8]=l+k*c,b[1]=k+l*c,b[5]=f*h,b[9]=p-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,l=c*h,p=c*e,b[0]=g*h,b[4]=l*d-k,b[8]=a*d+p,b[1]=g*e,b[5]=p*d+a,b[9]=k*d-l,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"=== -a.order?(a=f*g,k=f*d,l=c*g,p=c*d,b[0]=g*h,b[4]=p-a*e,b[8]=l*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+l,b[10]=a-p*e):"XZY"===a.order&&(a=f*g,k=f*d,l=c*g,p=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+p,b[5]=f*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=p*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){THREE.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(a)}, -makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,k=e+e;a=c*g;var l=c*h,c=c*k,p=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(p+e);b[4]=l-f;b[8]=c+h;b[1]=l+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+p);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f, -c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(THREE.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8], -k=c[12],l=c[1],p=c[5],q=c[9],n=c[13],t=c[2],r=c[6],s=c[10],u=c[14],v=c[3],x=c[7],D=c[11],c=c[15],w=d[0],y=d[4],A=d[8],E=d[12],G=d[1],F=d[5],z=d[9],I=d[13],U=d[2],M=d[6],H=d[10],L=d[14],P=d[3],N=d[7],R=d[11],d=d[15];e[0]=f*w+g*G+h*U+k*P;e[4]=f*y+g*F+h*M+k*N;e[8]=f*A+g*z+h*H+k*R;e[12]=f*E+g*I+h*L+k*d;e[1]=l*w+p*G+q*U+n*P;e[5]=l*y+p*F+q*M+n*N;e[9]=l*A+p*z+q*H+n*R;e[13]=l*E+p*I+q*L+n*d;e[2]=t*w+r*G+s*U+u*P;e[6]=t*y+r*F+s*M+u*N;e[10]=t*A+r*z+s*H+u*R;e[14]=t*E+r*I+s*L+u*d;e[3]=v*w+x*G+D*U+c*P;e[7]=v*y+ -x*F+D*M+c*N;e[11]=v*A+x*z+D*H+c*R;e[15]=v*E+x*I+D*L+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*= -a;b[15]*=a;return this},multiplyVector3:function(a){THREE.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return a.applyProjection(this)},multiplyVector4:function(a){THREE.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){THREE.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."); -return this.applyToVector3Array(a)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix4(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){THREE.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){THREE.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."); -return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],k=a[13],l=a[2],p=a[6],q=a[10],n=a[14];return a[3]*(+e*h*p-d*k*p-e*g*q+c*k*q+d*g*n-c*h*n)+a[7]*(+b*h*n-b*k*q+e*f*q-d*f*n+d*k*l-e*h*l)+a[11]*(+b*k*p-b*g*n-e*f*p+c*f*n+e*g*l-c*k*l)+a[15]*(-d*g*l-b*h*p+b*g*q+d*f*p-c*f*q+c*h*l)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13]; -a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){THREE.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var b= -this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],k=d[1],l=d[5],p=d[9],q=d[13],n=d[2],t=d[6],r=d[10],s=d[14],u=d[3],v=d[7],x=d[11],d=d[15];c[0]=p*s*v-q*r*v+q*t*x-l*s*x-p*t*d+l*r*d;c[4]=h*r*v-g*s*v-h*t*x+f*s*x+g*t*d-f*r*d;c[8]=g*q*v-h*p*v+h*l*x-f*q*x-g*l*d+f*p*d;c[12]=h*p*t-g*q*t-h*l*r+f*q*r+g*l*s-f*p*s;c[1]=q*r*u-p*s*u-q*n*x+ -k*s*x+p*n*d-k*r*d;c[5]=g*s*u-h*r*u+h*n*x-e*s*x-g*n*d+e*r*d;c[9]=h*p*u-g*q*u-h*k*x+e*q*x+g*k*d-e*p*d;c[13]=g*q*n-h*p*n+h*k*r-e*q*r-g*k*s+e*p*s;c[2]=l*s*u-q*t*u+q*n*v-k*s*v-l*n*d+k*t*d;c[6]=h*t*u-f*s*u-h*n*v+e*s*v+f*n*d-e*t*d;c[10]=f*q*u-h*l*u+h*k*v-e*q*v-f*k*d+e*l*d;c[14]=h*l*n-f*q*n-h*k*t+e*q*t+f*k*s-e*l*s;c[3]=p*t*u-l*r*u-p*n*v+k*r*v+l*n*x-k*t*x;c[7]=f*r*u-g*t*u+g*n*v-e*r*v-f*n*x+e*t*x;c[11]=g*l*u-f*p*u-g*k*v+e*p*v+f*k*x-e*l*x;c[15]=f*p*n-g*l*n+g*k*t-e*p*t-f*k*r+e*l*r;c=e*c[0]+k*c[4]+n*c[8]+u*c[12]; -if(0==c){if(b)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");THREE.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(a){THREE.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(a){THREE.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(a){THREE.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(a){THREE.error("THREE.Matrix4: .rotateZ() has been removed.")}, -rotateByAxis:function(a,b){THREE.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(a){var b=this.elements,c=a.x,d=a.y;a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1, -c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,l=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+ -d*h,l*g+c,l*h-d*f,0,k*h-d*g,l*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},decompose:function(){var a=new THREE.Vector3,b=new THREE.Matrix4;return function(c,d,e){var f=this.elements,g=a.set(f[0],f[1],f[2]).length(),h=a.set(f[4],f[5],f[6]).length(),k=a.set(f[8],f[9],f[10]).length();0>this.determinant()&&(g=-g);c.x=f[12]; -c.y=f[13];c.z=f[14];b.elements.set(this.elements);c=1/g;var f=1/h,l=1/k;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=l;b.elements[9]*=l;b.elements[10]*=l;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=k;return this}}(),makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0; -g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){a=c*Math.tan(THREE.Math.degToRad(.5*a));var e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,k=c-d,l=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((f+e)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0], -a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)}};THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3}; -THREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin); -var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceSqToSegment:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5); -b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),k=-this.direction.dot(b),l=c.dot(this.direction),p=-c.dot(b),q=c.lengthSq(),n=Math.abs(1-k*k),t;0<n?(d=k*p-l,e=k*l-p,t=h*n,0<=d?e>=-t?e<=t?(h=1/n,d*=h,e*=h,k=d*(d+k*e+2*l)+e*(k*d+e+2*p)+q):(e=h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*p)+q):(e=-h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*p)+q):e<=-t?(d=Math.max(0,-(-k*h+l)),e=0<d?-h:Math.min(Math.max(-h,-p),h),k=-d*d+e*(e+2*p)+q):e<=t?(d=0,e=Math.min(Math.max(-h,-p),h),k=e*(e+ -2*p)+q):(d=Math.max(0,-(k*h+l)),e=0<d?h:Math.min(Math.max(-h,-p),h),k=-d*d+e*(e+2*p)+q)):(e=0<k?-h:h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*p)+q);f&&f.copy(this.direction).multiplyScalar(d).add(this.origin);g&&g.copy(b).multiplyScalar(e).add(a);return k}}(),isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},intersectSphere:function(){var a=new THREE.Vector3;return function(b,c){a.subVectors(b.center,this.origin);var d=a.dot(this.direction),e=a.dot(a)-d*d,f=b.radius*b.radius; -if(e>f)return null;f=Math.sqrt(f-e);e=d-f;d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)}, -isIntersectionBox:function(){var a=new THREE.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e;if(f<d||d!==d)d=f;0<=g?(e=(a.min.z-h.z)*g,g*=a.max.z-h.z):(e=(a.max.z-h.z)* -g,g*=a.min.z-h.z);if(c>g||e>d)return null;if(e>c||c!==c)c=e;if(g<d||d!==d)d=g;return 0>d?null:this.at(0<=c?c:d,b)},intersectTriangle:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Vector3;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0<f){if(h)return null;h=1}else if(0>f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a)); -if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0}; -THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new THREE.Box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).center(d);for(var e=0,f=0,g=b.length;f<g;f++)e=Math.max(e,d.distanceToSquared(b[f]));this.radius=Math.sqrt(e);return this}}(),copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<= -this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius); -return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}}; -THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]}; -THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],p=c[8],q=c[9],n=c[10],t=c[11],r=c[12],s=c[13],u=c[14],c=c[15];b[0].setComponents(f-a,l-g,t-p,c-r).normalize();b[1].setComponents(f+ -a,l+g,t+p,c+r).normalize();b[2].setComponents(f+d,l+h,t+q,c+s).normalize();b[3].setComponents(f-d,l-h,t-q,c-s).normalize();b[4].setComponents(f-e,l-k,t-n,c-u).normalize();b[5].setComponents(f+e,l+k,t+n,c+u).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes, -c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var g=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>g&&0>f)return!1}return!0}}(), -containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0}; -THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d, -c);return this}}(),copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a, -b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectLine:function(){var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),f=this.normal.dot(e);if(0==f){if(0==this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)}}(), -coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Matrix3;return function(d,e){var f=e||c.getNormalMatrix(d),f=a.copy(this.normal).applyMatrix3(f),g=this.coplanarPoint(b);g.applyMatrix4(d);this.setFromNormalAndCoplanarPoint(f,g);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&& -a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}}; -THREE.Math={generateUUID:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,d;return function(){for(var e=0;36>e;e++)8==e||13==e||18==e||23==e?b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19==e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){if(a<= -b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return Math.floor(this.randFloat(a,b))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a= -180/Math.PI;return function(b){return b*a}}(),isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nextPowerOfTwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return a}}; -THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,k,l,p,q,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:f+ -2;l=this.points[c[0]];p=this.points[c[1]];q=this.points[c[2]];n=this.points[c[3]];h=g*g;k=g*h;d.x=b(l.x,p.x,q.x,n.x,g,h,k);d.y=b(l.y,p.y,q.y,n.y,g,h,k);d.z=b(l.z,p.z,q.z,n.z,g,h,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],k=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b= -a/c,d=this.getPoint(b),g.copy(d),k+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=k,e=b);h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],k=new THREE.Vector3,n=this.getLength();h.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=n.chunks[b]-n.chunks[b-1];g=Math.ceil(a*c/n.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+1/g*c*(f-e),d=this.getPoint(d),h.push(k.copy(d).clone()); -h.push(k.copy(this.points[b]).clone())}this.points=h}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}(); -THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,h){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);d=a.dot(a);e=a.dot(b);f=a.dot(c);var k=b.dot(b);g=b.dot(c);var l=d*k-e*e;h=h||new THREE.Vector3;if(0==l)return h.set(-2,-1,-1);l=1/l;k=(k*f-e*g)*l;d=(d*g-e*f)*l;return h.set(1-k-d,d,k)}}(); -THREE.Triangle.containsPoint=function(){var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}(); -THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a|| -new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}, -clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}; -THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(), -a=.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){}; -THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&& -c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=[],d=b.length,e=0;e<d;e++)c[e]=b[e];for(e=0;e<d;e++)c[e].call(this,a)}}}}; -(function(a){a.Raycaster=function(b,c,f,g){this.ray=new a.Ray(b,c);this.near=f||0;this.far=g||Infinity;this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var b=function(a,b){return a.distance-b.distance},c=function(a,b,f,g){a.raycast(b,f);if(!0===g){a=a.children;g=0;for(var h=a.length;g<h;g++)c(a[g],b,f,!0)}};a.Raycaster.prototype={constructor:a.Raycaster,precision:1E-4,linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(b,c){c instanceof a.PerspectiveCamera? -(this.ray.origin.copy(c.position),this.ray.direction.set(b.x,b.y,.5).unproject(c).sub(c.position).normalize()):c instanceof a.OrthographicCamera?(this.ray.origin.set(b.x,b.y,-1).unproject(c),this.ray.direction.set(0,0,-1).transformDirection(c.matrixWorld)):a.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,e){var f=[];c(a,this,f,e);f.sort(b);return f},intersectObjects:function(d,e){var f=[];if(!1===d instanceof Array)return a.warn("THREE.Raycaster.intersectObjects: objects is not an Array."), -f;for(var g=0,h=d.length;g<h;g++)c(d[g],this,f,e);f.sort(b);return f}}})(THREE); -THREE.Object3D=function(){Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="Object3D";this.parent=void 0;this.children=[];this.up=THREE.Object3D.DefaultUp.clone();var a=new THREE.Vector3,b=new THREE.Euler,c=new THREE.Quaternion,d=new THREE.Vector3(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)});c.onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,value:a},rotation:{enumerable:!0, -value:b},quaternion:{enumerable:!0,value:c},scale:{enumerable:!0,value:d}});this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={}};THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0); -THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){THREE.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(a){THREE.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=a},get useQuaternion(){THREE.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){THREE.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}, -applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function(){var a=new THREE.Quaternion;return function(b,c){a.setFromAxisAngle(b, -c);this.quaternion.multiply(a);return this}}(),rotateX:function(){var a=new THREE.Vector3(1,0,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateY:function(){var a=new THREE.Vector3(0,1,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateZ:function(){var a=new THREE.Vector3(0,0,1);return function(b){return this.rotateOnAxis(a,b)}}(),translateOnAxis:function(){var a=new THREE.Vector3;return function(b,c){a.copy(b).applyQuaternion(this.quaternion);this.position.add(a.multiplyScalar(c)); -return this}}(),translate:function(a,b){THREE.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(b,a)},translateX:function(){var a=new THREE.Vector3(1,0,0);return function(b){return this.translateOnAxis(a,b)}}(),translateY:function(){var a=new THREE.Vector3(0,1,0);return function(b){return this.translateOnAxis(a,b)}}(),translateZ:function(){var a=new THREE.Vector3(0,0,1);return function(b){return this.translateOnAxis(a, -b)}}(),localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var a=new THREE.Matrix4;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}}(),lookAt:function(){var a=new THREE.Matrix4;return function(b){a.lookAt(b,this.position,this.up);this.quaternion.setFromRotationMatrix(a)}}(),add:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.add(arguments[b]);return this}if(a===this)return THREE.error("THREE.Object3D.add: object can't be added as a child of itself.", -a),this;a instanceof THREE.Object3D?(void 0!==a.parent&&a.parent.remove(a),a.parent=this,a.dispatchEvent({type:"added"}),this.children.push(a)):THREE.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",a);return this},remove:function(a){if(1<arguments.length)for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);b=this.children.indexOf(a);-1!==b&&(a.parent=void 0,a.dispatchEvent({type:"removed"}),this.children.splice(b,1))},getChildByName:function(a){THREE.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."); -return this.getObjectByName(a)},getObjectById:function(a){return this.getObjectByProperty("id",a)},getObjectByName:function(a){return this.getObjectByProperty("name",a)},getObjectByProperty:function(a,b){if(this[a]===b)return this;for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c].getObjectByProperty(a,b);if(void 0!==e)return e}},getWorldPosition:function(a){a=a||new THREE.Vector3;this.updateMatrixWorld(!0);return a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var a= -new THREE.Vector3,b=new THREE.Vector3;return function(c){c=c||new THREE.Quaternion;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a,c,b);return c}}(),getWorldRotation:function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Euler;this.getWorldQuaternion(a);return b.setFromQuaternion(a,this.rotation.order,!1)}}(),getWorldScale:function(){var a=new THREE.Vector3,b=new THREE.Quaternion;return function(c){c=c||new THREE.Vector3;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a, -b,c);return c}}(),getWorldDirection:function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,1).applyQuaternion(a)}}(),raycast:function(){},traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverseVisible(a)}},traverseAncestors:function(a){this.parent&&(a(this.parent), -this.parent.traverseAncestors(a))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}, -toJSON:function(){var a={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},b={},c={},d=function(b){void 0===a.materials&&(a.materials=[]);if(void 0===c[b.uuid]){var d=b.toJSON();delete d.metadata;c[b.uuid]=d;a.materials.push(d)}return b.uuid},e=function(c){var g={};g.uuid=c.uuid;g.type=c.type;""!==c.name&&(g.name=c.name);"{}"!==JSON.stringify(c.userData)&&(g.userData=c.userData);!0!==c.visible&&(g.visible=c.visible);if(c instanceof THREE.PerspectiveCamera)g.fov=c.fov,g.aspect=c.aspect, -g.near=c.near,g.far=c.far;else if(c instanceof THREE.OrthographicCamera)g.left=c.left,g.right=c.right,g.top=c.top,g.bottom=c.bottom,g.near=c.near,g.far=c.far;else if(c instanceof THREE.AmbientLight)g.color=c.color.getHex();else if(c instanceof THREE.DirectionalLight)g.color=c.color.getHex(),g.intensity=c.intensity;else if(c instanceof THREE.PointLight)g.color=c.color.getHex(),g.intensity=c.intensity,g.distance=c.distance,g.decay=c.decay;else if(c instanceof THREE.SpotLight)g.color=c.color.getHex(), -g.intensity=c.intensity,g.distance=c.distance,g.angle=c.angle,g.exponent=c.exponent,g.decay=c.decay;else if(c instanceof THREE.HemisphereLight)g.color=c.color.getHex(),g.groundColor=c.groundColor.getHex();else if(c instanceof THREE.Mesh||c instanceof THREE.Line||c instanceof THREE.PointCloud){var h=c.geometry;void 0===a.geometries&&(a.geometries=[]);if(void 0===b[h.uuid]){var k=h.toJSON();delete k.metadata;b[h.uuid]=k;a.geometries.push(k)}g.geometry=h.uuid;g.material=d(c.material);c instanceof THREE.Line&& -(g.mode=c.mode)}else c instanceof THREE.Sprite&&(g.material=d(c.material));g.matrix=c.matrix.toArray();if(0<c.children.length)for(g.children=[],h=0;h<c.children.length;h++)g.children.push(e(c.children[h]));return g};a.object=e(this);return a},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix); -a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0; -THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0}; -THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.materialIndex=this.materialIndex;for(var b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();return a}}; -THREE.Face4=function(a,b,c,d,e,f,g){THREE.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,g)};THREE.BufferAttribute=function(a,b){this.array=a;this.itemSize=b;this.needsUpdate=!1}; -THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length(){return this.array.length},copyAt:function(a,b,c){a*=this.itemSize;c*=b.itemSize;for(var d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d];return this},set:function(a,b){void 0===b&&(b=0);this.array.set(a,b);return this},setX:function(a,b){this.array[a*this.itemSize]=b;return this},setY:function(a,b){this.array[a*this.itemSize+1]=b;return this},setZ:function(a,b){this.array[a*this.itemSize+2]=b;return this},setXY:function(a, -b,c){a*=this.itemSize;this.array[a]=b;this.array[a+1]=c;return this},setXYZ:function(a,b,c,d){a*=this.itemSize;this.array[a]=b;this.array[a+1]=c;this.array[a+2]=d;return this},setXYZW:function(a,b,c,d,e){a*=this.itemSize;this.array[a]=b;this.array[a+1]=c;this.array[a+2]=d;this.array[a+3]=e;return this},clone:function(){return new THREE.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}}; -THREE.Int8Attribute=function(a,b){THREE.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Uint8Attribute=function(a,b){THREE.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)}; -THREE.Uint8ClampedAttribute=function(a,b){THREE.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Int16Attribute=function(a,b){THREE.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)}; -THREE.Uint16Attribute=function(a,b){THREE.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Int32Attribute=function(a,b){THREE.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)}; -THREE.Uint32Attribute=function(a,b){THREE.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Float32Attribute=function(a,b){THREE.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)}; -THREE.Float64Attribute=function(a,b){THREE.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.DynamicBufferAttribute=function(a,b){THREE.BufferAttribute.call(this,a,b);this.updateRange={offset:0,count:-1}};THREE.DynamicBufferAttribute.prototype=Object.create(THREE.BufferAttribute.prototype);THREE.DynamicBufferAttribute.prototype.constructor=THREE.DynamicBufferAttribute; -THREE.DynamicBufferAttribute.prototype.clone=function(){return new THREE.DynamicBufferAttribute(new this.array.constructor(this.array),this.itemSize)};THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="BufferGeometry";this.attributes={};this.attributesKeys=[];this.offsets=this.drawcalls=[];this.boundingSphere=this.boundingBox=null}; -THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute?(THREE.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.attributes[a]={array:b,itemSize:c}):(this.attributes[a]=b,this.attributesKeys=Object.keys(this.attributes))},getAttribute:function(a){return this.attributes[a]},addDrawCall:function(a,b,c){this.drawcalls.push({start:a,count:b,index:void 0!==c?c:0})},applyMatrix:function(a){var b= -this.attributes.position;void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0);b=this.attributes.normal;void 0!==b&&((new THREE.Matrix3).getNormalMatrix(a).applyToVector3Array(b.array),b.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere()},center:function(){this.computeBoundingBox();var a=this.boundingBox.center().negate();this.applyMatrix((new THREE.Matrix4).setPosition(a));return a},fromGeometry:function(a,b){b=b||{vertexColors:THREE.NoColors}; -var c=a.vertices,d=a.faces,e=a.faceVertexUvs,f=b.vertexColors,g=0<e[0].length,h=3==d[0].vertexNormals.length,k=new Float32Array(9*d.length);this.addAttribute("position",new THREE.BufferAttribute(k,3));var l=new Float32Array(9*d.length);this.addAttribute("normal",new THREE.BufferAttribute(l,3));if(f!==THREE.NoColors){var p=new Float32Array(9*d.length);this.addAttribute("color",new THREE.BufferAttribute(p,3))}if(!0===g){var q=new Float32Array(6*d.length);this.addAttribute("uv",new THREE.BufferAttribute(q, -2))}for(var n=0,t=0,r=0;n<d.length;n++,t+=6,r+=9){var s=d[n],u=c[s.a],v=c[s.b],x=c[s.c];k[r]=u.x;k[r+1]=u.y;k[r+2]=u.z;k[r+3]=v.x;k[r+4]=v.y;k[r+5]=v.z;k[r+6]=x.x;k[r+7]=x.y;k[r+8]=x.z;!0===h?(u=s.vertexNormals[0],v=s.vertexNormals[1],x=s.vertexNormals[2],l[r]=u.x,l[r+1]=u.y,l[r+2]=u.z,l[r+3]=v.x,l[r+4]=v.y,l[r+5]=v.z,l[r+6]=x.x,l[r+7]=x.y,l[r+8]=x.z):(u=s.normal,l[r]=u.x,l[r+1]=u.y,l[r+2]=u.z,l[r+3]=u.x,l[r+4]=u.y,l[r+5]=u.z,l[r+6]=u.x,l[r+7]=u.y,l[r+8]=u.z);f===THREE.FaceColors?(s=s.color,p[r]= -s.r,p[r+1]=s.g,p[r+2]=s.b,p[r+3]=s.r,p[r+4]=s.g,p[r+5]=s.b,p[r+6]=s.r,p[r+7]=s.g,p[r+8]=s.b):f===THREE.VertexColors&&(u=s.vertexColors[0],v=s.vertexColors[1],s=s.vertexColors[2],p[r]=u.r,p[r+1]=u.g,p[r+2]=u.b,p[r+3]=v.r,p[r+4]=v.g,p[r+5]=v.b,p[r+6]=s.r,p[r+7]=s.g,p[r+8]=s.b);!0===g&&(s=e[0][n][0],u=e[0][n][1],v=e[0][n][2],q[t]=s.x,q[t+1]=s.y,q[t+2]=u.x,q[t+3]=u.y,q[t+4]=v.x,q[t+5]=v.y)}this.computeBoundingSphere();return this},computeBoundingBox:function(){var a=new THREE.Vector3;return function(){null=== -this.boundingBox&&(this.boundingBox=new THREE.Box3);var b=this.attributes.position.array;if(b){var c=this.boundingBox;c.makeEmpty();for(var d=0,e=b.length;d<e;d+=3)a.set(b[d],b[d+1],b[d+2]),c.expandByPoint(a)}if(void 0===b||0===b.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0);(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&THREE.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}(), -computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g);isNaN(this.boundingSphere.radius)&& -THREE.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;d<e;d++)c[d]=0;var c=a.normal.array,f,g,h,k=new THREE.Vector3,l=new THREE.Vector3, -p=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3;if(a.index)for(var t=a.index.array,r=0<this.offsets.length?this.offsets:[{start:0,count:t.length,index:0}],s=0,u=r.length;s<u;++s){e=r[s].start;f=r[s].count;for(var v=r[s].index,d=e,e=e+f;d<e;d+=3)f=3*(v+t[d]),g=3*(v+t[d+1]),h=3*(v+t[d+2]),k.fromArray(b,f),l.fromArray(b,g),p.fromArray(b,h),q.subVectors(p,l),n.subVectors(k,l),q.cross(n),c[f]+=q.x,c[f+1]+=q.y,c[f+2]+=q.z,c[g]+=q.x,c[g+1]+=q.y,c[g+2]+=q.z,c[h]+=q.x,c[h+1]+=q.y,c[h+2]+=q.z}else for(d= -0,e=b.length;d<e;d+=9)k.fromArray(b,d),l.fromArray(b,d+3),p.fromArray(b,d+6),q.subVectors(p,l),n.subVectors(k,l),q.cross(n),c[d]=q.x,c[d+1]=q.y,c[d+2]=q.z,c[d+3]=q.x,c[d+4]=q.y,c[d+5]=q.z,c[d+6]=q.x,c[d+7]=q.y,c[d+8]=q.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){q.fromArray(d,3*a);n.fromArray(d,3*b);t.fromArray(d,3*c);r.fromArray(f,2*a);s.fromArray(f,2*b);u.fromArray(f,2*c);v=n.x-q.x;x=t.x-q.x;D=n.y-q.y;w=t.y-q.y;y=n.z-q.z;A=t.z-q.z;E=s.x-r.x;G= -u.x-r.x;F=s.y-r.y;z=u.y-r.y;I=1/(E*z-G*F);U.set((z*v-F*x)*I,(z*D-F*w)*I,(z*y-F*A)*I);M.set((E*x-G*v)*I,(E*w-G*D)*I,(E*A-G*y)*I);k[a].add(U);k[b].add(U);k[c].add(U);l[a].add(M);l[b].add(M);l[c].add(M)}function b(a){ha.fromArray(e,3*a);O.copy(ha);ba=k[a];oa.copy(ba);oa.sub(ha.multiplyScalar(ha.dot(ba))).normalize();ja.crossVectors(O,ba);qa=ja.dot(l[a]);ca=0>qa?-1:1;h[4*a]=oa.x;h[4*a+1]=oa.y;h[4*a+2]=oa.z;h[4*a+3]=ca}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal|| -void 0===this.attributes.uv)THREE.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],l=[],p=0;p<g;p++)k[p]=new THREE.Vector3, -l[p]=new THREE.Vector3;var q=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector2,s=new THREE.Vector2,u=new THREE.Vector2,v,x,D,w,y,A,E,G,F,z,I,U=new THREE.Vector3,M=new THREE.Vector3,H,L,P,N,R;0===this.drawcalls.length&&this.addDrawCall(0,c.length,0);var V=this.drawcalls,p=0;for(L=V.length;p<L;++p){H=V[p].start;P=V[p].count;var J=V[p].index,g=H;for(H+=P;g<H;g+=3)P=J+c[g],N=J+c[g+1],R=J+c[g+2],a(P,N,R)}var oa=new THREE.Vector3,ja=new THREE.Vector3,ha=new THREE.Vector3,O=new THREE.Vector3, -ca,ba,qa,p=0;for(L=V.length;p<L;++p)for(H=V[p].start,P=V[p].count,J=V[p].index,g=H,H+=P;g<H;g+=3)P=J+c[g],N=J+c[g+1],R=J+c[g+2],b(P),b(N),b(R)}},computeOffsets:function(a){void 0===a&&(a=65535);for(var b=this.attributes.index.array,c=this.attributes.position.array,d=b.length/3,e=new Uint16Array(b.length),f=0,g=0,h=[{start:0,count:0,index:0}],k=h[0],l=0,p=0,q=new Int32Array(6),n=new Int32Array(c.length),t=new Int32Array(c.length),r=0;r<c.length;r++)n[r]=-1,t[r]=-1;for(c=0;c<d;c++){for(var s=p=0;3> -s;s++)r=b[3*c+s],-1==n[r]?(q[2*s]=r,q[2*s+1]=-1,p++):n[r]<k.index?(q[2*s]=r,q[2*s+1]=-1,l++):(q[2*s]=r,q[2*s+1]=n[r]);if(g+p>k.index+a)for(k={start:f,count:0,index:g},h.push(k),p=0;6>p;p+=2)s=q[p+1],-1<s&&s<k.index&&(q[p+1]=-1);for(p=0;6>p;p+=2)r=q[p],s=q[p+1],-1===s&&(s=g++),n[r]=s,t[s]=r,e[f++]=s-k.index,k.count++}this.reorderBuffers(e,t,g);return this.drawcalls=this.offsets=h},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)THREE.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", -a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,f=a.attributes[d],g=f.array,h=0,f=f.itemSize*b;h<g.length;h++,f++)e[f]=g[h];return this}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!=e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize* -c));for(var f=0;f<c;f++){var g=b[f];for(e in this.attributes)if("index"!=e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,l=d[e],p=0;p<k;p++)l[f*k+p]=h[g*k+p]}this.attributes.index.array=a;for(e in this.attributes)"index"!=e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=this.attributes[e].itemSize*c)},toJSON:function(){var a={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},b=this.attributes, -c=this.offsets,d=this.boundingSphere,e;for(e in b){var f=b[e],g=Array.prototype.slice.call(f.array);a.data.attributes[e]={itemSize:f.itemSize,type:f.array.constructor.name,array:g}}0<c.length&&(a.data.offsets=JSON.parse(JSON.stringify(c)));null!==d&&(a.data.boundingSphere={center:d.center.toArray(),radius:d.radius});return a},clone:function(){var a=new THREE.BufferGeometry,b;for(b in this.attributes)a.addAttribute(b,this.attributes[b].clone());b=0;for(var c=this.offsets.length;b<c;b++){var d=this.offsets[b]; -a.offsets.push({start:d.start,index:d.index,count:d.count})}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype); -THREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate= -this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1}; -THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){a=this.faces[c];a.normal.applyMatrix3(b).normalize();for(var e=0,f=a.vertexNormals.length;e<f;e++)a.vertexNormals[e].applyMatrix3(b).normalize()}null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();this.normalsNeedUpdate= -this.verticesNeedUpdate=!0},fromBufferGeometry:function(a){for(var b=this,c=a.attributes,d=c.position.array,e=void 0!==c.index?c.index.array:void 0,f=void 0!==c.normal?c.normal.array:void 0,g=void 0!==c.color?c.color.array:void 0,h=void 0!==c.uv?c.uv.array:void 0,k=[],l=[],p=c=0;c<d.length;c+=3,p+=2)b.vertices.push(new THREE.Vector3(d[c],d[c+1],d[c+2])),void 0!==f&&k.push(new THREE.Vector3(f[c],f[c+1],f[c+2])),void 0!==g&&b.colors.push(new THREE.Color(g[c],g[c+1],g[c+2])),void 0!==h&&l.push(new THREE.Vector2(h[p], -h[p+1]));var q=function(a,c,d){var e=void 0!==f?[k[a].clone(),k[c].clone(),k[d].clone()]:[],n=void 0!==g?[b.colors[a].clone(),b.colors[c].clone(),b.colors[d].clone()]:[];b.faces.push(new THREE.Face3(a,c,d,e,n));void 0!==h&&b.faceVertexUvs[0].push([l[a].clone(),l[c].clone(),l[d].clone()])};if(void 0!==e)if(d=a.drawcalls,0<d.length)for(c=0;c<d.length;c++)for(var p=d[c],n=p.start,t=p.count,r=p.index,p=n,n=n+t;p<n;p+=3)q(r+e[p],r+e[p+1],r+e[p+2]);else for(c=0;c<e.length;c+=3)q(e[c],e[c+1],e[c+2]);else for(c= -0;c<d.length/3;c+=3)q(c,c+1,c+2);this.computeFaceNormals();null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();var a=this.boundingBox.center().negate();this.applyMatrix((new THREE.Matrix4).setPosition(a));return a},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a], -g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d;d=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)d[b]=new THREE.Vector3;if(a){var e,f,g,h=new THREE.Vector3,k=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.subVectors(g,f),k.subVectors(e,f),h.cross(k),d[c.a].add(h),d[c.b].add(h),d[c.c].add(h)}else for(a= -0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.vertexNormals[0]=d[c.a].clone(),c.vertexNormals[1]=d[c.b].clone(),c.vertexNormals[2]=d[c.c].clone()},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal= -e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var g= -this.morphNormals[a].vertexNormals,h,k;c=0;for(d=this.faces.length;c<d;c++)h=new THREE.Vector3,k={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(h),g.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],k=g.vertexNormals[c],h.copy(e.normal),k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c< -d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,k,l,p,q,n,t,r,s,u,v=[],x=[];c=new THREE.Vector3;var D=new THREE.Vector3,w=new THREE.Vector3,y=new THREE.Vector3,A=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)v[a]=new THREE.Vector3,x[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,g=this.vertices[d],h=this.vertices[u],k=this.vertices[e], -l=f[0],p=f[1],q=f[2],f=h.x-g.x,n=k.x-g.x,t=h.y-g.y,r=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=p.x-l.x,s=q.x-l.x,p=p.y-l.y,l=q.y-l.y,q=1/(k*l-s*p),c.set((l*f-p*n)*q,(l*t-p*r)*q,(l*h-p*g)*q),D.set((k*n-s*f)*q,(k*r-s*t)*q,(k*g-s*h)*q),v[d].add(c),v[u].add(c),v[e].add(c),x[d].add(D),x[u].add(D),x[e].add(D);D=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)A.copy(e.vertexNormals[c]),d=e[D[c]],u=v[d],w.copy(u),w.sub(A.multiplyScalar(A.dot(u))).normalize(), -y.crossVectors(e.vertexNormals[c],u),d=y.dot(x[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(w.x,w.y,w.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere); -this.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(!1===a instanceof THREE.Geometry)THREE.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",a);else{var d,e=this.vertices.length,f=this.vertices,g=a.vertices,h=this.faces,k=a.faces,l=this.faceVertexUvs[0];a=a.faceVertexUvs[0];void 0===c&&(c=0);void 0!==b&&(d=(new THREE.Matrix3).getNormalMatrix(b));for(var p=0,q=g.length;p<q;p++){var n=g[p].clone();void 0!==b&&n.applyMatrix4(b);f.push(n)}p=0;for(q=k.length;p< -q;p++){var g=k[p],t,r=g.vertexNormals,s=g.vertexColors,n=new THREE.Face3(g.a+e,g.b+e,g.c+e);n.normal.copy(g.normal);void 0!==d&&n.normal.applyMatrix3(d).normalize();b=0;for(f=r.length;b<f;b++)t=r[b].clone(),void 0!==d&&t.applyMatrix3(d).normalize(),n.vertexNormals.push(t);n.color.copy(g.color);b=0;for(f=s.length;b<f;b++)t=s[b],n.vertexColors.push(t.clone());n.materialIndex=g.materialIndex+c;h.push(n)}p=0;for(q=a.length;p<q;p++)if(c=a[p],d=[],void 0!==c){b=0;for(f=c.length;b<f;b++)d.push(c[b].clone()); -l.push(d)}}},mergeMesh:function(a){!1===a instanceof THREE.Mesh?THREE.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a):(a.matrixAutoUpdate&&a.updateMatrix(),this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f< -g;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();if(void 0!==l[b])return l[b];l[b]=k.length/3;k.push(a.x,a.y, -a.z);return l[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();if(void 0!==q[b])return q[b];q[b]=p.length;p.push(a.getHex());return q[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==t[b])return t[b];t[b]=n.length/2;n.push(a.x,a.y);return t[b]}var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var f=this.parameters,g;for(g in f)void 0!== -f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],k=[],l={},p=[],q={},n=[],t={};for(g=0;g<this.faces.length;g++){var r=this.faces[g],s=void 0!==this.faceVertexUvs[0][g],u=0<r.normal.length(),v=0<r.vertexNormals.length,x=1!==r.color.r||1!==r.color.g||1!==r.color.b,D=0<r.vertexColors.length,w=0,w=a(w,0,0),w=a(w,1,!1),w=a(w,2,!1),w=a(w,3,s),w=a(w,4,u),w=a(w,5,v),w=a(w,6,x),w=a(w,7,D);h.push(w);h.push(r.a,r.b,r.c);s&&(s=this.faceVertexUvs[0][g], -h.push(d(s[0]),d(s[1]),d(s[2])));u&&h.push(b(r.normal));v&&(u=r.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));x&&h.push(c(r.color));D&&(r=r.vertexColors,h.push(c(r[0]),c(r[1]),c(r[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<p.length&&(e.data.colors=p);0<n.length&&(e.data.uvs=[n]);e.data.faces=h;return e},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());c=0; -for(d=this.faceVertexUvs.length;c<d;c++){b=this.faceVertexUvs[c];void 0===a.faceVertexUvs[c]&&(a.faceVertexUvs[c]=[]);for(var e=0,f=b.length;e<f;e++){for(var g=b[e],h=[],k=0,l=g.length;k<l;k++)h.push(g[k].clone());a.faceVertexUvs[c].push(h)}}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0; -THREE.Camera=function(){THREE.Object3D.call(this);this.type="Camera";this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.getWorldDirection=function(){var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,-1).applyQuaternion(a)}}(); -THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a}; -THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);this.type="CubeCamera";var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0)); -this.add(g);var h=new THREE.PerspectiveCamera(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var k=new THREE.PerspectiveCamera(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new THREE.Vector3(0,0,-1));this.add(k);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,n=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace= -1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=n;c.activeCubeFace=5;a.render(b,k,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CubeCamera.prototype.constructor=THREE.CubeCamera; -THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.type="OrthographicCamera";this.zoom=1;this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera; -THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){var a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,d=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(c-a,c+a,d+b,d-b,this.near,this.far)}; -THREE.OrthographicCamera.prototype.clone=function(){var a=new THREE.OrthographicCamera;THREE.Camera.prototype.clone.call(this,a);a.zoom=this.zoom;a.left=this.left;a.right=this.right;a.top=this.top;a.bottom=this.bottom;a.near=this.near;a.far=this.far;a.projectionMatrix.copy(this.projectionMatrix);return a}; -THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.type="PerspectiveCamera";this.zoom=1;this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera; -THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()}; -THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var a=THREE.Math.radToDeg(2*Math.atan(Math.tan(.5*THREE.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var b=this.fullWidth/this.fullHeight,a=Math.tan(THREE.Math.degToRad(.5*a))*this.near,c=-a,d=b*c,b=Math.abs(b*a-d),c=Math.abs(a-c);this.projectionMatrix.makeFrustum(d+this.x*b/this.fullWidth,d+(this.x+this.width)*b/this.fullWidth,a-(this.y+this.height)*c/this.fullHeight,a-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(a, -this.aspect,this.near,this.far)};THREE.PerspectiveCamera.prototype.clone=function(){var a=new THREE.PerspectiveCamera;THREE.Camera.prototype.clone.call(this,a);a.zoom=this.zoom;a.fov=this.fov;a.aspect=this.aspect;a.near=this.near;a.far=this.far;a.projectionMatrix.copy(this.projectionMatrix);return a};THREE.Light=function(a){THREE.Object3D.call(this);this.type="Light";this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.Light.prototype.constructor=THREE.Light; -THREE.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a);this.type="AmbientLight"};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.AmbientLight.prototype.clone=function(){var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a}; -THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.type="AreaLight";this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=.5;this.quadraticAttenuation=.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight.prototype.constructor=THREE.AreaLight; -THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.type="DirectionalLight";this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1; -this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,.99,.998];this.shadowCascadeFarZ=[.99,.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight; -THREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;a.shadowCameraNear=this.shadowCameraNear;a.shadowCameraFar=this.shadowCameraFar;a.shadowCameraLeft=this.shadowCameraLeft;a.shadowCameraRight=this.shadowCameraRight;a.shadowCameraTop=this.shadowCameraTop;a.shadowCameraBottom=this.shadowCameraBottom;a.shadowCameraVisible= -this.shadowCameraVisible;a.shadowBias=this.shadowBias;a.shadowDarkness=this.shadowDarkness;a.shadowMapWidth=this.shadowMapWidth;a.shadowMapHeight=this.shadowMapHeight;a.shadowCascade=this.shadowCascade;a.shadowCascadeOffset.copy(this.shadowCascadeOffset);a.shadowCascadeCount=this.shadowCascadeCount;a.shadowCascadeBias=this.shadowCascadeBias.slice(0);a.shadowCascadeWidth=this.shadowCascadeWidth.slice(0);a.shadowCascadeHeight=this.shadowCascadeHeight.slice(0);a.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0); -a.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0);return a};THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.type="HemisphereLight";this.position.set(0,100,0);this.groundColor=new THREE.Color(b);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight.prototype.constructor=THREE.HemisphereLight; -THREE.HemisphereLight.prototype.clone=function(){var a=new THREE.HemisphereLight;THREE.Light.prototype.clone.call(this,a);a.groundColor.copy(this.groundColor);a.intensity=this.intensity;return a};THREE.PointLight=function(a,b,c,d){THREE.Light.call(this,a);this.type="PointLight";this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight.prototype.constructor=THREE.PointLight; -THREE.PointLight.prototype.clone=function(){var a=new THREE.PointLight;THREE.Light.prototype.clone.call(this,a);a.intensity=this.intensity;a.distance=this.distance;a.decay=this.decay;return a}; -THREE.SpotLight=function(a,b,c,d,e,f){THREE.Light.call(this,a);this.type="SpotLight";this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.exponent=void 0!==e?e:10;this.decay=void 0!==f?f:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapHeight=this.shadowMapWidth= -512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.constructor=THREE.SpotLight; -THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.decay=this.decay;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;a.shadowCameraNear=this.shadowCameraNear;a.shadowCameraFar=this.shadowCameraFar;a.shadowCameraFov=this.shadowCameraFov;a.shadowCameraVisible=this.shadowCameraVisible;a.shadowBias=this.shadowBias; -a.shadowDarkness=this.shadowDarkness;a.shadowMapWidth=this.shadowMapWidth;a.shadowMapHeight=this.shadowMapHeight;return a};THREE.Cache={files:{},add:function(a,b){this.files[a]=b},get:function(a){return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}}; -THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.imageLoader=new THREE.ImageLoader;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}; -THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/a.total).toFixed(0)+ -"%"):b+((a.loaded/1024).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=this.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function d(a, -d,e,g,h,k,s){var u=b+e,v,x=THREE.Loader.Handlers.get(u);null!==x?v=x.load(u):(v=new THREE.Texture,x=f.imageLoader,x.crossOrigin=f.crossOrigin,x.load(u,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=c(a.width),d=c(a.height),e=document.createElement("canvas");e.width=b;e.height=d;e.getContext("2d").drawImage(a,0,0,b,d);v.image=e}else v.image=a;v.needsUpdate=!0}));v.sourceFile=e;g&&(v.repeat.set(g[0],g[1]),1!==g[0]&&(v.wrapS=THREE.RepeatWrapping), -1!==g[1]&&(v.wrapT=THREE.RepeatWrapping));h&&v.offset.set(h[0],h[1]);k&&(e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==e[k[0]]&&(v.wrapS=e[k[0]]),void 0!==e[k[1]]&&(v.wrapT=e[k[1]]));s&&(v.anisotropy=s);a[d]=v}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var f=this,g="MeshLambertMaterial",h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial": -"basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(h.blending=THREE[a.blending]);void 0!==a.transparent&&(h.transparent=a.transparent);void 0!==a.opacity&&1>a.opacity&&(h.transparent=!0);void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&&(h.wireframe=a.wireframe); -void 0!==a.vertexColors&&("face"===a.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=e(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=e(a.colorSpecular));a.colorEmissive&&(h.emissive=e(a.colorEmissive));void 0!==a.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),a.opacity=a.transparency);void 0!==a.opacity&&(h.opacity=a.opacity);a.specularCoef&&(h.shininess= -a.specularCoef);a.mapDiffuse&&b&&d(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&d(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&d(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&d(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&d(h,"specularMap", -a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapAlpha&&b&&d(h,"alphaMap",a.mapAlpha,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);a.mapBumpScale&&(h.bumpScale=a.mapBumpScale);a.mapNormalFactor&&(h.normalScale=new THREE.Vector2(a.mapNormalFactor,a.mapNormalFactor));g=new THREE[g](h);void 0!==a.DbgName&&(g.name=a.DbgName);return g}}; -THREE.Loader.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=0,c=this.handlers.length;b<c;b+=2){var d=this.handlers[b+1];if(this.handlers[b].test(a))return d}return null}};THREE.XHRLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}; -THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){var e=this,f=THREE.Cache.get(a);void 0!==f?b&&b(f):(f=new XMLHttpRequest,f.open("GET",a,!0),f.addEventListener("load",function(c){THREE.Cache.add(a,this.response);b&&b(this.response);e.manager.itemEnd(a)},!1),void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1),void 0!==d&&f.addEventListener("error",function(a){d(a)},!1),void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(f.responseType= -this.responseType),f.send(null),e.manager.itemStart(a))},setResponseType:function(a){this.responseType=a},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.ImageLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}; -THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=THREE.Cache.get(a);if(void 0!==f)b(f);else return f=document.createElement("img"),f.addEventListener("load",function(c){THREE.Cache.add(a,this);b&&b(this);e.manager.itemEnd(a)},!1),void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1),void 0!==d&&f.addEventListener("error",function(a){d(a)},!1),void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin),f.src=a,e.manager.itemStart(a),f},setCrossOrigin:function(a){this.crossOrigin= -a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)}; -THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText),k=h.metadata;if(void 0!==k){if("object"===k.type){THREE.error("THREE.JSONLoader: "+b+" should be loaded with THREE.ObjectLoader instead.");return}if("scene"===k.type){THREE.error("THREE.JSONLoader: "+b+" seems to be a Scene. Use THREE.SceneLoader instead.");return}}h=a.parse(h, -d);c(h.geometry,h.materials)}else THREE.error("THREE.JSONLoader: "+b+" seems to be unreachable or the file is empty.");a.onLoadComplete()}else THREE.error("THREE.JSONLoader: Couldn't load "+b+" ("+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)}; -THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,l,p,q,n,t,r,s,u,v,x=a.faces;p=a.vertices;var D=a.normals,w=a.colors,y=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&y++;for(d=0;d<y;d++)c.faceVertexUvs[d]=[]}k=0;for(l=p.length;k<l;)d=new THREE.Vector3,d.x=p[k++]*b,d.y=p[k++]*b,d.z=p[k++]*b,c.vertices.push(d);k=0;for(l=x.length;k<l;)if(b=x[k++],t=b&1,h=b&2,d=b&8,q=b&16,r=b&32,p=b&64,b&=128,t){t=new THREE.Face3; -t.a=x[k];t.b=x[k+1];t.c=x[k+3];s=new THREE.Face3;s.a=x[k+1];s.b=x[k+2];s.c=x[k+3];k+=4;h&&(h=x[k++],t.materialIndex=h,s.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<y;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)n=x[k++],v=u[2*n],n=u[2*n+1],v=new THREE.Vector2(v,n),2!==g&&c.faceVertexUvs[d][h].push(v),0!==g&&c.faceVertexUvs[d][h+1].push(v);q&&(q=3*x[k++],t.normal.set(D[q++],D[q++],D[q]),s.normal.copy(t.normal));if(r)for(d=0;4>d;d++)q=3*x[k++],r=new THREE.Vector3(D[q++], -D[q++],D[q]),2!==d&&t.vertexNormals.push(r),0!==d&&s.vertexNormals.push(r);p&&(p=x[k++],p=w[p],t.color.setHex(p),s.color.setHex(p));if(b)for(d=0;4>d;d++)p=x[k++],p=w[p],2!==d&&t.vertexColors.push(new THREE.Color(p)),0!==d&&s.vertexColors.push(new THREE.Color(p));c.faces.push(t);c.faces.push(s)}else{t=new THREE.Face3;t.a=x[k++];t.b=x[k++];t.c=x[k++];h&&(h=x[k++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<y;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)n=x[k++],v=u[2*n],n=u[2*n+1], -v=new THREE.Vector2(v,n),c.faceVertexUvs[d][h].push(v);q&&(q=3*x[k++],t.normal.set(D[q++],D[q++],D[q]));if(r)for(d=0;3>d;d++)q=3*x[k++],r=new THREE.Vector3(D[q++],D[q++],D[q]),t.vertexNormals.push(r);p&&(p=x[k++],t.color.setHex(w[p]));if(b)for(d=0;3>d;d++)p=x[k++],t.vertexColors.push(new THREE.Color(w[p]));c.faces.push(t)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d], -1<b?a.skinWeights[d+1]:0,2<b?a.skinWeights[d+2]:0,3<b?a.skinWeights[d+3]:0));if(a.skinIndices)for(d=0,g=a.skinIndices.length;d<g;d+=b)c.skinIndices.push(new THREE.Vector4(a.skinIndices[d],1<b?a.skinIndices[d+1]:0,2<b?a.skinIndices[d+2]:0,3<b?a.skinIndices[d+3]:0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&THREE.warn("THREE.JSONLoader: When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+ -c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.");c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,g,h,k,l,p;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],l=c.morphTargets[d].vertices,p=a.morphTargets[d].vertices,h=0,k=p.length;h<k;h+=3){var q=new THREE.Vector3;q.x=p[h]*b;q.y=p[h+1]*b;q.z=p[h+2]*b;l.push(q)}}if(void 0!== -a.morphColors)for(d=0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,l=a.morphColors[d].colors,b=0,h=l.length;b<h;b+=3)p=new THREE.Color(16755200),p.setRGB(l[b],l[b+1],l[b+2]),k.push(p)})(d);c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials||0===a.materials.length)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c, -materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}; -THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b,c,d){var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.data.attributes,d;for(d in c){var e=c[d],f=new self[e.type](e.array);b.addAttribute(d,new THREE.BufferAttribute(f,e.itemSize))}c=a.data.offsets;void 0!==c&&(b.offsets=JSON.parse(JSON.stringify(c))); -a=a.data.boundingSphere;void 0!==a&&(c=new THREE.Vector3,void 0!==a.center&&c.fromArray(a.center),b.boundingSphere=new THREE.Sphere(c,a.radius));return b}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}; -THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b,c,d){var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&(b.shininess=a.shininess); -void 0!==a.uniforms&&(b.uniforms=a.uniforms);void 0!==a.vertexShader&&(b.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(b.fragmentShader=a.fragmentShader);void 0!==a.vertexColors&&(b.vertexColors=a.vertexColors);void 0!==a.shading&&(b.shading=a.shading);void 0!==a.blending&&(b.blending=a.blending);void 0!==a.side&&(b.side=a.side);void 0!==a.opacity&&(b.opacity=a.opacity);void 0!==a.transparent&&(b.transparent=a.transparent);void 0!==a.wireframe&&(b.wireframe=a.wireframe);void 0!==a.size&& -(b.size=a.size);void 0!==a.sizeAttenuation&&(b.sizeAttenuation=a.sizeAttenuation);if(void 0!==a.materials)for(var c=0,d=a.materials.length;c<d;c++)b.materials.push(this.parse(a.materials[c]));return b}};THREE.ObjectLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.texturePath=""}; -THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b,c,d){""===this.texturePath&&(this.texturePath=a.substring(0,a.lastIndexOf("/")+1));var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){e.parse(JSON.parse(a),b)},c,d)},setTexturePath:function(a){this.texturePath=a},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a,b){var c=this.parseGeometries(a.geometries),d=this.parseImages(a.images,function(){void 0!==b&&b(e)}), -d=this.parseTextures(a.textures,d),d=this.parseMaterials(a.materials,d),e=this.parseObject(a.object,c,d);void 0!==a.images&&0!==a.images.length||void 0===b||b(e);return e},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new THREE.JSONLoader,d=new THREE.BufferGeometryLoader,e=0,f=a.length;e<f;e++){var g,h=a[e];switch(h.type){case "PlaneGeometry":case "PlaneBufferGeometry":g=new THREE[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case "BoxGeometry":case "CubeGeometry":g= -new THREE.BoxGeometry(h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case "CircleGeometry":g=new THREE.CircleGeometry(h.radius,h.segments);break;case "CylinderGeometry":g=new THREE.CylinderGeometry(h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded);break;case "SphereGeometry":g=new THREE.SphereGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case "IcosahedronGeometry":g=new THREE.IcosahedronGeometry(h.radius, -h.detail);break;case "TorusGeometry":g=new THREE.TorusGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case "TorusKnotGeometry":g=new THREE.TorusKnotGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.p,h.q,h.heightScale);break;case "BufferGeometry":g=d.parse(h);break;case "Geometry":g=c.parse(h.data).geometry}g.uuid=h.uuid;void 0!==h.name&&(g.name=h.name);b[h.uuid]=g}return b},parseMaterials:function(a,b){var c={};if(void 0!==a)for(var d=function(a){void 0===b[a]&& -THREE.warn("THREE.ObjectLoader: Undefined texture",a);return b[a]},e=new THREE.MaterialLoader,f=0,g=a.length;f<g;f++){var h=a[f],k=e.parse(h);k.uuid=h.uuid;void 0!==h.name&&(k.name=h.name);void 0!==h.map&&(k.map=d(h.map));void 0!==h.bumpMap&&(k.bumpMap=d(h.bumpMap),h.bumpScale&&(k.bumpScale=new THREE.Vector2(h.bumpScale,h.bumpScale)));void 0!==h.alphaMap&&(k.alphaMap=d(h.alphaMap));void 0!==h.envMap&&(k.envMap=d(h.envMap));void 0!==h.normalMap&&(k.normalMap=d(h.normalMap),h.normalScale&&(k.normalScale= -new THREE.Vector2(h.normalScale,h.normalScale)));void 0!==h.lightMap&&(k.lightMap=d(h.lightMap));void 0!==h.specularMap&&(k.specularMap=d(h.specularMap));c[h.uuid]=k}return c},parseImages:function(a,b){var c=this,d={};if(void 0!==a&&0<a.length){var e=new THREE.LoadingManager(b),f=new THREE.ImageLoader(e);f.setCrossOrigin(this.crossOrigin);for(var e=function(a){c.manager.itemStart(a);return f.load(a,function(){c.manager.itemEnd(a)})},g=0,h=a.length;g<h;g++){var k=a[g],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(k.url)? -k.url:c.texturePath+k.url;d[k.uuid]=e(l)}}return d},parseTextures:function(a,b){var c={};if(void 0!==a)for(var d=0,e=a.length;d<e;d++){var f=a[d];void 0===f.image&&THREE.warn('THREE.ObjectLoader: No "image" speficied for',f.uuid);void 0===b[f.image]&&THREE.warn("THREE.ObjectLoader: Undefined image",f.image);var g=new THREE.Texture(b[f.image]);g.needsUpdate=!0;g.uuid=f.uuid;void 0!==f.name&&(g.name=f.name);void 0!==f.repeat&&(g.repeat=new THREE.Vector2(f.repeat[0],f.repeat[1]));void 0!==f.minFilter&& -(g.minFilter=THREE[f.minFilter]);void 0!==f.magFilter&&(g.magFilter=THREE[f.magFilter]);void 0!==f.anisotropy&&(g.anisotropy=f.anisotropy);f.wrap instanceof Array&&(g.wrapS=THREE[f.wrap[0]],g.wrapT=THREE[f.wrap[1]]);c[f.uuid]=g}return c},parseObject:function(){var a=new THREE.Matrix4;return function(b,c,d){var e;e=function(a){void 0===c[a]&&THREE.warn("THREE.ObjectLoader: Undefined geometry",a);return c[a]};var f=function(a){void 0===d[a]&&THREE.warn("THREE.ObjectLoader: Undefined material",a);return d[a]}; -switch(b.type){case "Scene":e=new THREE.Scene;break;case "PerspectiveCamera":e=new THREE.PerspectiveCamera(b.fov,b.aspect,b.near,b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance,b.decay);break;case "SpotLight":e=new THREE.SpotLight(b.color, -b.intensity,b.distance,b.angle,b.exponent,b.decay);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,b.groundColor,b.intensity);break;case "Mesh":e=new THREE.Mesh(e(b.geometry),f(b.material));break;case "Line":e=new THREE.Line(e(b.geometry),f(b.material),b.mode);break;case "PointCloud":e=new THREE.PointCloud(e(b.geometry),f(b.material));break;case "Sprite":e=new THREE.Sprite(f(b.material));break;case "Group":e=new THREE.Group;break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!== -b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var g in b.children)e.add(this.parseObject(b.children[g],c,d));return e}}()}; -THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b,c,d){var e=new THREE.ImageLoader(this.manager);e.setCrossOrigin(this.crossOrigin);e.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)},c,d)},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.DataTextureLoader=THREE.BinaryTextureLoader=function(){this._parser=null}; -THREE.BinaryTextureLoader.prototype={constructor:THREE.BinaryTextureLoader,load:function(a,b,c,d){var e=this,f=new THREE.DataTexture,g=new THREE.XHRLoader;g.setResponseType("arraybuffer");g.load(a,function(a){if(a=e._parser(a))void 0!==a.image?f.image=a.image:void 0!==a.data&&(f.image.width=a.width,f.image.height=a.height,f.image.data=a.data),f.wrapS=void 0!==a.wrapS?a.wrapS:THREE.ClampToEdgeWrapping,f.wrapT=void 0!==a.wrapT?a.wrapT:THREE.ClampToEdgeWrapping,f.magFilter=void 0!==a.magFilter?a.magFilter: -THREE.LinearFilter,f.minFilter=void 0!==a.minFilter?a.minFilter:THREE.LinearMipMapLinearFilter,f.anisotropy=void 0!==a.anisotropy?a.anisotropy:1,void 0!==a.format&&(f.format=a.format),void 0!==a.type&&(f.type=a.type),void 0!==a.mipmaps&&(f.mipmaps=a.mipmaps),1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter),f.needsUpdate=!0,b&&b(f,a)},c,d);return f}};THREE.CompressedTextureLoader=function(){this._parser=null}; -THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(a,b,c){var d=this,e=[],f=new THREE.CompressedTexture;f.image=e;var g=new THREE.XHRLoader;g.setResponseType("arraybuffer");if(a instanceof Array){var h=0;c=function(c){g.load(a[c],function(a){a=d._parser(a,!0);e[c]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps};h+=1;6===h&&(1==a.mipmapCount&&(f.minFilter=THREE.LinearFilter),f.format=a.format,f.needsUpdate=!0,b&&b(f))})};for(var k=0,l= -a.length;k<l;++k)c(k)}else g.load(a,function(a){a=d._parser(a,!0);if(a.isCubemap)for(var c=a.mipmaps.length/a.mipmapCount,g=0;g<c;g++){e[g]={mipmaps:[]};for(var h=0;h<a.mipmapCount;h++)e[g].mipmaps.push(a.mipmaps[g*a.mipmapCount+h]),e[g].format=a.format,e[g].width=a.width,e[g].height=a.height}else f.image.width=a.width,f.image.height=a.height,f.mipmaps=a.mipmaps;1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter);f.format=a.format;f.needsUpdate=!0;b&&b(f)});return f}}; -THREE.Material=function(){Object.defineProperty(this,"id",{value:THREE.MaterialIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="Material";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.colorWrite=this.depthWrite=this.depthTest=!0;this.polygonOffset= -!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this._needsUpdate=this.visible=!0}; -THREE.Material.prototype={constructor:THREE.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(a){!0===a&&this.update();this._needsUpdate=a},setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)THREE.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},toJSON:function(){var a={metadata:{version:4.2, -type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};""!==this.name&&(a.name=this.name);this instanceof THREE.MeshBasicMaterial?(a.color=this.color.getHex(),this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshLambertMaterial?(a.color=this.color.getHex(),a.emissive=this.emissive.getHex(),this.vertexColors!==THREE.NoColors&& -(a.vertexColors=this.vertexColors),this.shading!==THREE.SmoothShading&&(a.shading=this.shading),this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshPhongMaterial?(a.color=this.color.getHex(),a.emissive=this.emissive.getHex(),a.specular=this.specular.getHex(),a.shininess=this.shininess,this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.shading!==THREE.SmoothShading&&(a.shading=this.shading), -this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshNormalMaterial?(this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshDepthMaterial?(this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.PointCloudMaterial?(a.size=this.size,a.sizeAttenuation= -this.sizeAttenuation,a.color=this.color.getHex(),this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(a.blending=this.blending)):this instanceof THREE.ShaderMaterial?(a.uniforms=this.uniforms,a.vertexShader=this.vertexShader,a.fragmentShader=this.fragmentShader):this instanceof THREE.SpriteMaterial&&(a.color=this.color.getHex());1>this.opacity&&(a.opacity=this.opacity);!1!==this.transparent&&(a.transparent=this.transparent);!1!==this.wireframe&& -(a.wireframe=this.wireframe);return a},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.blendSrcAlpha=this.blendSrcAlpha;a.blendDstAlpha=this.blendDstAlpha;a.blendEquationAlpha=this.blendEquationAlpha;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor= -this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);THREE.MaterialIdCount=0; -THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.type="LineBasicMaterial";this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=THREE.NoColors;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial; -THREE.LineBasicMaterial.prototype.clone=function(){var a=new THREE.LineBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.linecap=this.linecap;a.linejoin=this.linejoin;a.vertexColors=this.vertexColors;a.fog=this.fog;return a}; -THREE.LineDashedMaterial=function(a){THREE.Material.call(this);this.type="LineDashedMaterial";this.color=new THREE.Color(16777215);this.scale=this.linewidth=1;this.dashSize=3;this.gapSize=1;this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype);THREE.LineDashedMaterial.prototype.constructor=THREE.LineDashedMaterial; -THREE.LineDashedMaterial.prototype.clone=function(){var a=new THREE.LineDashedMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.scale=this.scale;a.dashSize=this.dashSize;a.gapSize=this.gapSize;a.vertexColors=this.vertexColors;a.fog=this.fog;return a}; -THREE.MeshBasicMaterial=function(a){THREE.Material.call(this);this.type="MeshBasicMaterial";this.color=new THREE.Color(16777215);this.envMap=this.alphaMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphTargets=this.skinning=!1;this.setValues(a)}; -THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial; -THREE.MeshBasicMaterial.prototype.clone=function(){var a=new THREE.MeshBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap; -a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;return a}; -THREE.MeshLambertMaterial=function(a){THREE.Material.call(this);this.type="MeshLambertMaterial";this.color=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.wrapAround=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.envMap=this.alphaMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap= -"round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial; -THREE.MeshLambertMaterial.prototype.clone=function(){var a=new THREE.MeshLambertMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.emissive.copy(this.emissive);a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe= -this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a}; -THREE.MeshPhongMaterial=function(a){THREE.Material.call(this);this.type="MeshPhongMaterial";this.color=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.specular=new THREE.Color(1118481);this.shininess=30;this.wrapAround=this.metal=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.bumpMap=this.lightMap=this.map=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new THREE.Vector2(1,1);this.envMap=this.alphaMap=this.specularMap=null;this.combine=THREE.MultiplyOperation;this.reflectivity= -1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial; -THREE.MeshPhongMaterial.prototype.clone=function(){var a=new THREE.MeshPhongMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.emissive.copy(this.emissive);a.specular.copy(this.specular);a.shininess=this.shininess;a.metal=this.metal;a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.bumpMap=this.bumpMap;a.bumpScale=this.bumpScale;a.normalMap=this.normalMap;a.normalScale.copy(this.normalScale);a.specularMap=this.specularMap; -a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a}; -THREE.MeshDepthMaterial=function(a){THREE.Material.call(this);this.type="MeshDepthMaterial";this.wireframe=this.morphTargets=!1;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial; -THREE.MeshDepthMaterial.prototype.clone=function(){var a=new THREE.MeshDepthMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);this.type="MeshNormalMaterial";this.wireframe=!1;this.wireframeLinewidth=1;this.morphTargets=!1;this.setValues(a)};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype); -THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshNormalMaterial.prototype.clone=function(){var a=new THREE.MeshNormalMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshFaceMaterial=function(a){this.uuid=THREE.Math.generateUUID();this.type="MeshFaceMaterial";this.materials=a instanceof Array?a:[]}; -THREE.MeshFaceMaterial.prototype={constructor:THREE.MeshFaceMaterial,toJSON:function(){for(var a={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},b=0,c=this.materials.length;b<c;b++)a.materials.push(this.materials[b].toJSON());return a},clone:function(){for(var a=new THREE.MeshFaceMaterial,b=0;b<this.materials.length;b++)a.materials.push(this.materials[b].clone());return a}}; -THREE.PointCloudMaterial=function(a){THREE.Material.call(this);this.type="PointCloudMaterial";this.color=new THREE.Color(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.vertexColors=THREE.NoColors;this.fog=!0;this.setValues(a)};THREE.PointCloudMaterial.prototype=Object.create(THREE.Material.prototype);THREE.PointCloudMaterial.prototype.constructor=THREE.PointCloudMaterial; -THREE.PointCloudMaterial.prototype.clone=function(){var a=new THREE.PointCloudMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleBasicMaterial=function(a){THREE.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.");return new THREE.PointCloudMaterial(a)}; -THREE.ParticleSystemMaterial=function(a){THREE.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.");return new THREE.PointCloudMaterial(a)}; -THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.attributes=null;this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.shading=THREE.SmoothShading;this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals= -this.morphTargets=this.skinning=!1;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial; -THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets= -this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.RawShaderMaterial=function(a){THREE.ShaderMaterial.call(this,a);this.type="RawShaderMaterial"};THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype);THREE.RawShaderMaterial.prototype.constructor=THREE.RawShaderMaterial;THREE.RawShaderMaterial.prototype.clone=function(){var a=new THREE.RawShaderMaterial;THREE.ShaderMaterial.prototype.clone.call(this,a);return a}; -THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.type="SpriteMaterial";this.color=new THREE.Color(16777215);this.map=null;this.rotation=0;this.fog=!1;this.setValues(a)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteMaterial.prototype.constructor=THREE.SpriteMaterial; -THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.rotation=this.rotation;a.fog=this.fog;return a}; -THREE.Texture=function(a,b,c,d,e,f,g,h,k){Object.defineProperty(this,"id",{value:THREE.TextureIdCount++});this.uuid=THREE.Math.generateUUID();this.sourceFile=this.name="";this.image=void 0!==a?a:THREE.Texture.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:THREE.Texture.DEFAULT_MAPPING;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter; -this.anisotropy=void 0!==k?k:1;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this._needsUpdate=!1;this.onUpdate=null};THREE.Texture.DEFAULT_IMAGE=void 0;THREE.Texture.DEFAULT_MAPPING=THREE.UVMapping; -THREE.Texture.prototype={constructor:THREE.Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(a){!0===a&&this.update();this._needsUpdate=a},clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps= -this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=this.unpackAlignment;return a},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype);THREE.TextureIdCount=0;THREE.CubeTexture=function(a,b,c,d,e,f,g,h,k){b=void 0!==b?b:THREE.CubeReflectionMapping;THREE.Texture.call(this,a,b,c,d,e,f,g,h,k);this.images=a}; -THREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CubeTexture.prototype.constructor=THREE.CubeTexture;THREE.CubeTexture.clone=function(a){void 0===a&&(a=new THREE.CubeTexture);THREE.Texture.prototype.clone.call(this,a);a.images=this.images;return a};THREE.CompressedTexture=function(a,b,c,d,e,f,g,h,k,l,p){THREE.Texture.call(this,null,f,g,h,k,l,d,e,p);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype); -THREE.CompressedTexture.prototype.constructor=THREE.CompressedTexture;THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,h,k,l,p){THREE.Texture.call(this,null,f,g,h,k,l,d,e,p);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.constructor=THREE.DataTexture; -THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.VideoTexture=function(a,b,c,d,e,f,g,h,k){THREE.Texture.call(this,a,b,c,d,e,f,g,h,k);this.generateMipmaps=!1;var l=this,p=function(){requestAnimationFrame(p);a.readyState===a.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)};p()};THREE.VideoTexture.prototype=Object.create(THREE.Texture.prototype);THREE.VideoTexture.prototype.constructor=THREE.VideoTexture; -THREE.Group=function(){THREE.Object3D.call(this);this.type="Group"};THREE.Group.prototype=Object.create(THREE.Object3D.prototype);THREE.Group.prototype.constructor=THREE.Group;THREE.PointCloud=function(a,b){THREE.Object3D.call(this);this.type="PointCloud";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.PointCloudMaterial({color:16777215*Math.random()})};THREE.PointCloud.prototype=Object.create(THREE.Object3D.prototype);THREE.PointCloud.prototype.constructor=THREE.PointCloud; -THREE.PointCloud.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray;return function(c,d){var e=this,f=e.geometry,g=c.params.PointCloud.threshold;a.getInverse(this.matrixWorld);b.copy(c.ray).applyMatrix4(a);if(null===f.boundingBox||!1!==b.isIntersectionBox(f.boundingBox)){var h=g/((this.scale.x+this.scale.y+this.scale.z)/3),k=new THREE.Vector3,g=function(a,f){var g=b.distanceToPoint(a);if(g<h){var k=b.closestPointToPoint(a);k.applyMatrix4(e.matrixWorld);var n=c.ray.origin.distanceTo(k); -d.push({distance:n,distanceToRay:g,point:k.clone(),index:f,face:null,object:e})}};if(f instanceof THREE.BufferGeometry){var l=f.attributes,p=l.position.array;if(void 0!==l.index){var l=l.index.array,q=f.offsets;0===q.length&&(q=[{start:0,count:l.length,index:0}]);for(var n=0,t=q.length;n<t;++n)for(var r=q[n].start,s=q[n].index,f=r,r=r+q[n].count;f<r;f++){var u=s+l[f];k.fromArray(p,3*u);g(k,u)}}else for(l=p.length/3,f=0;f<l;f++)k.set(p[3*f],p[3*f+1],p[3*f+2]),g(k,f)}else for(k=this.geometry.vertices, -f=0;f<k.length;f++)g(k[f],f)}}}();THREE.PointCloud.prototype.clone=function(a){void 0===a&&(a=new THREE.PointCloud(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud.");return new THREE.PointCloud(a,b)}; -THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.type="Line";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.mode=void 0!==c?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);THREE.Line.prototype.constructor=THREE.Line; -THREE.Line.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere;return function(d,e){var f=d.linePrecision,f=f*f,g=this.geometry;null===g.boundingSphere&&g.computeBoundingSphere();c.copy(g.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==d.ray.isIntersectionSphere(c)){a.getInverse(this.matrixWorld);b.copy(d.ray).applyMatrix4(a);var h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,q=this.mode===THREE.LineStrip?1:2;if(g instanceof -THREE.BufferGeometry){var n=g.attributes;if(void 0!==n.index){var t=n.index.array,n=n.position.array,r=g.offsets;0===r.length&&(r=[{start:0,count:t.length,index:0}]);for(var s=0;s<r.length;s++)for(var u=r[s].start,v=r[s].count,x=r[s].index,g=u;g<u+v-1;g+=q){var D=x+t[g+1];h.fromArray(n,3*(x+t[g]));k.fromArray(n,3*D);D=b.distanceSqToSegment(h,k,p,l);D>f||(D=b.origin.distanceTo(p),D<d.near||D>d.far||e.push({distance:D,point:l.clone().applyMatrix4(this.matrixWorld),index:g,offsetIndex:s,face:null,faceIndex:null, -object:this}))}}else for(n=n.position.array,g=0;g<n.length/3-1;g+=q)h.fromArray(n,3*g),k.fromArray(n,3*g+3),D=b.distanceSqToSegment(h,k,p,l),D>f||(D=b.origin.distanceTo(p),D<d.near||D>d.far||e.push({distance:D,point:l.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g instanceof THREE.Geometry)for(h=g.vertices,k=h.length,g=0;g<k-1;g+=q)D=b.distanceSqToSegment(h[g],h[g+1],p,l),D>f||(D=b.origin.distanceTo(p),D<d.near||D>d.far||e.push({distance:D,point:l.clone().applyMatrix4(this.matrixWorld), -index:g,face:null,faceIndex:null,object:this}))}}}();THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.mode));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype); -THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}}; -THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];THREE.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0}; -THREE.Mesh.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g,h){var k=this.geometry;null===k.boundingSphere&&k.computeBoundingSphere();c.copy(k.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==g.ray.isIntersectionSphere(c)&&(a.getInverse(this.matrixWorld),b.copy(g.ray).applyMatrix4(a),null===k.boundingBox||!1!==b.isIntersectionBox(k.boundingBox)))if(k instanceof THREE.BufferGeometry){var l= -this.material;if(void 0!==l){var p=k.attributes,q,n,t=g.precision;if(void 0!==p.index){var r=p.index.array,s=p.position.array,u=k.offsets;0===u.length&&(u=[{start:0,count:r.length,index:0}]);for(var v=0,x=u.length;v<x;++v)for(var p=u[v].start,D=u[v].index,k=p,w=p+u[v].count;k<w;k+=3){p=D+r[k];q=D+r[k+1];n=D+r[k+2];d.fromArray(s,3*p);e.fromArray(s,3*q);f.fromArray(s,3*n);var y=l.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,l.side!==THREE.DoubleSide);if(null!==y){y.applyMatrix4(this.matrixWorld); -var A=g.ray.origin.distanceTo(y);A<t||A<g.near||A>g.far||h.push({distance:A,point:y,face:new THREE.Face3(p,q,n,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this})}}}else for(s=p.position.array,r=k=0,w=s.length;k<w;k+=3,r+=9)p=k,q=k+1,n=k+2,d.fromArray(s,r),e.fromArray(s,r+3),f.fromArray(s,r+6),y=l.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,l.side!==THREE.DoubleSide),null!==y&&(y.applyMatrix4(this.matrixWorld),A=g.ray.origin.distanceTo(y),A<t||A<g.near||A> -g.far||h.push({distance:A,point:y,face:new THREE.Face3(p,q,n,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(r=this.material instanceof THREE.MeshFaceMaterial,s=!0===r?this.material.materials:null,t=g.precision,u=k.vertices,v=0,x=k.faces.length;v<x;v++)if(D=k.faces[v],l=!0===r?s[D.materialIndex]:this.material,void 0!==l){p=u[D.a];q=u[D.b];n=u[D.c];if(!0===l.morphTargets){y=k.morphTargets;A=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);f.set(0, -0,0);for(var w=0,E=y.length;w<E;w++){var G=A[w];if(0!==G){var F=y[w].vertices;d.x+=(F[D.a].x-p.x)*G;d.y+=(F[D.a].y-p.y)*G;d.z+=(F[D.a].z-p.z)*G;e.x+=(F[D.b].x-q.x)*G;e.y+=(F[D.b].y-q.y)*G;e.z+=(F[D.b].z-q.z)*G;f.x+=(F[D.c].x-n.x)*G;f.y+=(F[D.c].y-n.y)*G;f.z+=(F[D.c].z-n.z)*G}}d.add(p);e.add(q);f.add(n);p=d;q=e;n=f}y=l.side===THREE.BackSide?b.intersectTriangle(n,q,p,!0):b.intersectTriangle(p,q,n,l.side!==THREE.DoubleSide);null!==y&&(y.applyMatrix4(this.matrixWorld),A=g.ray.origin.distanceTo(y),A<t|| -A<g.near||A>g.far||h.push({distance:A,point:y,face:D,faceIndex:v,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.type="Bone";this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone; -THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType), -this.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(THREE.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new THREE.Matrix4)}; -THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new THREE.Matrix4;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}}; -THREE.Skeleton.prototype.pose=function(){for(var a,b=0,c=this.bones.length;b<c;b++)(a=this.bones[b])&&a.matrixWorld.getInverse(this.boneInverses[b]);b=0;for(c=this.bones.length;b<c;b++)if(a=this.bones[b])a.parent?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale)}; -THREE.Skeleton.prototype.update=function(){var a=new THREE.Matrix4;return function(){for(var b=0,c=this.bones.length;b<c;b++)a.multiplyMatrices(this.bones[b]?this.bones[b].matrixWorld:this.identityMatrix,this.boneInverses[b]),a.flattenToArrayOffset(this.boneMatrices,16*b);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(); -THREE.SkinnedMesh=function(a,b,c){THREE.Mesh.call(this,a,b);this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new THREE.Matrix4;this.bindMatrixInverse=new THREE.Matrix4;a=[];if(this.geometry&&void 0!==this.geometry.bones){for(var d,e,f,g,h=0,k=this.geometry.bones.length;h<k;++h)d=this.geometry.bones[h],e=d.pos,f=d.rotq,g=d.scl,b=new THREE.Bone(this),a.push(b),b.name=d.name,b.position.set(e[0],e[1],e[2]),b.quaternion.set(f[0],f[1],f[2],f[3]),void 0!==g?b.scale.set(g[0],g[1],g[2]):b.scale.set(1, -1,1);h=0;for(k=this.geometry.bones.length;h<k;++h)d=this.geometry.bones[h],-1!==d.parent?a[d.parent].add(a[h]):this.add(a[h])}this.normalizeSkinWeights();this.updateMatrixWorld(!0);this.bind(new THREE.Skeleton(a,void 0,c))};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.bind=function(a,b){this.skeleton=a;void 0===b&&(this.updateMatrixWorld(!0),b=this.matrixWorld);this.bindMatrix.copy(b);this.bindMatrixInverse.getInverse(b)}; -THREE.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()};THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var a=0;a<this.geometry.skinIndices.length;a++){var b=this.geometry.skinWeights[a],c=1/b.lengthManhattan();Infinity!==c?b.multiplyScalar(c):b.set(1)}}; -THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){THREE.Mesh.prototype.updateMatrixWorld.call(this,!0);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):THREE.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)}; -THREE.SkinnedMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture));THREE.Mesh.prototype.clone.call(this,a);return a};THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.type="MorphAnimMesh";this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype); -THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=!0}; -THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)_?(\d+)/,e=0,f=a.morphTargets.length;e<f;e++){var g=a.morphTargets[e].name.match(d);if(g&&1<g.length){g=g[1];c[g]||(c[g]={start:Infinity,end:-Infinity});var h=c[g];e<h.start&&(h.start=e);e>h.end&&(h.end=e);b||(b=g)}}a.firstAnimation=b}; -THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={});this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=(c.end-c.start)/b*1E3,this.time=0):THREE.warn("THREE.MorphAnimMesh: animation["+a+"] undefined in .playAnimation()")}; -THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||0>this.time)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)}else this.time%=this.duration,0>this.time&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);a!==this.currentKeyframe&& -(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b}; -THREE.MorphAnimMesh.prototype.interpolateTargets=function(a,b,c){for(var d=this.morphTargetInfluences,e=0,f=d.length;e<f;e++)d[e]=0;-1<a&&(d[a]=1-c);-1<b&&(d[b]=c)}; -THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.objects=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype); -THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);b=Math.abs(b);for(var c=0;c<this.objects.length&&!(b<this.objects[c].distance);c++);this.objects.splice(c,0,{distance:b,object:a});this.add(a)};THREE.LOD.prototype.getObjectForDistance=function(a){for(var b=1,c=this.objects.length;b<c&&!(a<this.objects[b].distance);b++);return this.objects[b-1].object}; -THREE.LOD.prototype.raycast=function(){var a=new THREE.Vector3;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.origin.distanceTo(a);this.getObjectForDistance(d).raycast(b,c)}}(); -THREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){if(1<this.objects.length){a.setFromMatrixPosition(c.matrixWorld);b.setFromMatrixPosition(this.matrixWorld);c=a.distanceTo(b);this.objects[0].object.visible=!0;for(var d=1,e=this.objects.length;d<e;d++)if(c>=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;d<e;d++)this.objects[d].object.visible=!1}}}(); -THREE.LOD.prototype.clone=function(a){void 0===a&&(a=new THREE.LOD);THREE.Object3D.prototype.clone.call(this,a);for(var b=0,c=this.objects.length;b<c;b++){var d=this.objects[b].object.clone();d.visible=0===b;a.addLevel(d,this.objects[b].distance)}return a}; -THREE.Sprite=function(){var a=new Uint16Array([0,1,2,0,2,3]),b=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),c=new Float32Array([0,0,1,0,1,1,0,1]),d=new THREE.BufferGeometry;d.addAttribute("index",new THREE.BufferAttribute(a,1));d.addAttribute("position",new THREE.BufferAttribute(b,3));d.addAttribute("uv",new THREE.BufferAttribute(c,2));return function(a){THREE.Object3D.call(this);this.type="Sprite";this.geometry=d;this.material=void 0!==a?a:new THREE.SpriteMaterial}}(); -THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.raycast=function(){var a=new THREE.Vector3;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.distanceToPoint(a);d>this.scale.x||c.push({distance:d,point:this.position,face:null,object:this})}}();THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a}; -THREE.Particle=THREE.Sprite;THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare.prototype.constructor=THREE.LensFlare; -THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})}; -THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=c.x*Math.PI*.25,c.rotation+=.25*(c.wantedRotation-c.rotation)};THREE.Scene=function(){THREE.Object3D.call(this);this.type="Scene";this.overrideMaterial=this.fog=null;this.autoUpdate=!0};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype); -THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}; -THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.ShaderChunk={};THREE.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n\tfloat distance = dot( planeNormal, point-pointOnPlane );\n\treturn point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n\t}\n\treturn 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\n"; -THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n";THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack += ambientLightColor;\n\n#endif\n"; -THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n\n#endif\n";THREE.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n\tvec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n"; -THREE.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif";THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n\t#endif\n\n#endif\n"; -THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif";THREE.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif";THREE.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n\t#endif\n\n#else\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\ttotalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\ttotalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\ttotalDiffuseLight += hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\n#ifdef METAL\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n"; -THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif";THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif"; -THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n";THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif"; -THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n"; -THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n";THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif";THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif"; -THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif";THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\n\tdiffuseColor *= texelColor;\n\n#endif";THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\n\n#endif";THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n"; -THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n";THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\tvColor.xyz = inputToLinear( color.xyz );\n\n#endif";THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n"; -THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n";THREE.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n";THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif";THREE.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n"; -THREE.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n";THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n"; -THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif";THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif";THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif"; -THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif";THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n\t\tfogFactor = whiteCompliment( fogFactor );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif"; -THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n"; -THREE.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n\tvec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n\tvec3 objectNormal = morphedNormal;\n\n#else\n\n\tvec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n";THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n"; -THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif";THREE.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif"; -THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\toutgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif";THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif";THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif";THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif"; -THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n"; -THREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n\tshadowColor = inputToLinear( shadowColor );\n\n\toutgoingLight = outgoingLight * shadowColor;\n\n#endif\n"; -THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#elif defined( USE_MORPHTARGETS )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n#endif\n";THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n#endif"; -THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n"; -THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif";THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n";THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n"; -THREE.UniformsUtils={merge:function(a){for(var b={},c=0;c<a.length;c++){var d=this.clone(a[c]),e;for(e in d)b[e]=d[e]}return b},clone:function(a){var b={},c;for(c in a){b[c]={};for(var d in a[c]){var e=a[c][d];b[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e}}return b}}; -THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f", -value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new THREE.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv", -value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},pointLightDecay:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]},spotLightDecay:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f", -value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}}; -THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {", -THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\t#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex, -"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );", -THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")}, -lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex, -THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex, -THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment, -THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment, -THREE.ShaderChunk.specularmap_fragment,"\t#ifdef DOUBLE_SIDED\n\t\tif ( gl_FrontFacing )\n\t\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\n\t\telse\n\t\t\toutgoingLight += diffuseColor.rgb * vLightBack + emissive;\n\t#else\n\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\n\t#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")}, -phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.bump,THREE.UniformsLib.normalmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",THREE.ShaderChunk.common, -THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex, -THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;", -THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment, -"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment, -THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\tgl_Position = projectionMatrix * mvPosition;", -THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( psColor, opacity );", -THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]), -vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;", -THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")}, -depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment, -"void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex, -"void main() {\n\tvNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null}, -tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment, -"void main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", -THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",THREE.ShaderChunk.logdepthbuf_fragment, -"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {", -THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")}}; -THREE.WebGLRenderer=function(a){function b(a){var b=a.geometry;a=a.material;var c=b.vertices.length;if(a.attributes){void 0===b.__webglCustomAttributesList&&(b.__webglCustomAttributesList=[]);for(var d in a.attributes){var e=a.attributes[d];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=!0;var f=1;"v2"===e.type?f=2:"v3"===e.type?f=3:"v4"===e.type?f=4:"c"===e.type&&(f=3);e.size=f;e.array=new Float32Array(c*f);e.buffer=m.createBuffer();e.buffer.belongsToAttribute=d;e.needsUpdate= -!0}b.__webglCustomAttributesList.push(e)}}}function c(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function d(a,b,c,d){c=c.attributes;var e=b.attributes;b=b.attributesKeys;for(var f=0,g=b.length;f<g;f++){var h=b[f],k=e[h];if(0<=k){var n=c[h];void 0!==n?(h=n.itemSize,m.bindBuffer(m.ARRAY_BUFFER,n.buffer),W.enableAttribute(k),m.vertexAttribPointer(k,h,m.FLOAT,!1,0,d*h*4)):void 0!==a.defaultAttributeValues&&(2===a.defaultAttributeValues[h].length? -m.vertexAttrib2fv(k,a.defaultAttributeValues[h]):3===a.defaultAttributeValues[h].length&&m.vertexAttrib3fv(k,a.defaultAttributeValues[h]))}}W.disableUnusedAttributes()}function e(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function f(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function g(a, -b){return b[0]-a[0]}function h(a){if(!1!==a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group)){void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",wb));var c=a.geometry;if(void 0!==c&&void 0===c.__webglInit)if(c.__webglInit=!0,c.addEventListener("dispose",jb),c instanceof THREE.BufferGeometry)B.info.memory.geometries++;else if(a instanceof THREE.Mesh)q(a,c);else if(a instanceof THREE.Line){if(void 0=== -c.__webglVertexBuffer){c.__webglVertexBuffer=m.createBuffer();c.__webglColorBuffer=m.createBuffer();c.__webglLineDistanceBuffer=m.createBuffer();B.info.memory.geometries++;var d=c.vertices.length;c.__vertexArray=new Float32Array(3*d);c.__colorArray=new Float32Array(3*d);c.__lineDistanceArray=new Float32Array(1*d);c.__webglLineCount=d;b(a);c.verticesNeedUpdate=!0;c.colorsNeedUpdate=!0;c.lineDistancesNeedUpdate=!0}}else a instanceof THREE.PointCloud&&void 0===c.__webglVertexBuffer&&(c.__webglVertexBuffer= -m.createBuffer(),c.__webglColorBuffer=m.createBuffer(),B.info.memory.geometries++,d=c.vertices.length,c.__vertexArray=new Float32Array(3*d),c.__colorArray=new Float32Array(3*d),c.__webglParticleCount=d,b(a),c.verticesNeedUpdate=!0,c.colorsNeedUpdate=!0);if(void 0===a.__webglActive)if(a.__webglActive=!0,a instanceof THREE.Mesh)if(c instanceof THREE.BufferGeometry)n(ba,c,a);else{if(c instanceof THREE.Geometry)for(var c=Ua[c.id],d=0,e=c.length;d<e;d++)n(ba,c[d],a)}else a instanceof THREE.Line||a instanceof -THREE.PointCloud?n(ba,c,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&qa.push({id:null,object:a,opaque:null,transparent:null,z:0});if(a instanceof THREE.Light)ca.push(a);else if(a instanceof THREE.Sprite)Xa.push(a);else if(a instanceof THREE.LensFlare)Ya.push(a);else if((c=ba[a.id])&&(!1===a.frustumCulled||!0===cb.intersectsObject(a)))for(d=0,e=c.length;d<e;d++){var f=c[d],g=f,k=g.object,l=g.buffer,p=k.geometry,k=k.material;k instanceof THREE.MeshFaceMaterial?(k=k.materials[p instanceof -THREE.BufferGeometry?0:l.materialIndex],g.material=k,k.transparent?Qa.push(g):Ka.push(g)):k&&(g.material=k,k.transparent?Qa.push(g):Ka.push(g));f.render=!0;!0===B.sortObjects&&(wa.setFromMatrixPosition(a.matrixWorld),wa.applyProjection(db),f.z=wa.z)}}d=0;for(e=a.children.length;d<e;d++)h(a.children[d])}}function k(a,b,c,d,e){for(var f,g=0,h=a.length;g<h;g++){f=a[g];var k=f.object,m=f.buffer;w(k,b);if(e)f=e;else{f=f.material;if(!f)continue;u(f)}B.setMaterialFaces(f);m instanceof THREE.BufferGeometry? -B.renderBufferDirect(b,c,d,f,m,k):B.renderBuffer(b,c,d,f,m,k)}}function l(a,b,c,d,e,f){for(var g,h=0,k=a.length;h<k;h++){g=a[h];var m=g.object;if(m.visible){if(f)g=f;else{g=g[b];if(!g)continue;u(g)}B.renderImmediateObject(c,d,e,g,m)}}}function p(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function q(a,b){var d=a.material,e=!1;if(void 0===Ua[b.id]||!0===b.groupsNeedUpdate){delete ba[a.id];for(var f=Ua,g=b.id,d=d instanceof THREE.MeshFaceMaterial, -h=da.get("OES_element_index_uint")?4294967296:65535,k,e={},l=b.morphTargets.length,p=b.morphNormals.length,q,s={},t=[],r=0,w=b.faces.length;r<w;r++){k=b.faces[r];var u=d?k.materialIndex:0;u in e||(e[u]={hash:u,counter:0});k=e[u].hash+"_"+e[u].counter;k in s||(q={id:Qb++,faces3:[],materialIndex:u,vertices:0,numMorphTargets:l,numMorphNormals:p},s[k]=q,t.push(q));s[k].vertices+3>h&&(e[u].counter+=1,k=e[u].hash+"_"+e[u].counter,k in s||(q={id:Qb++,faces3:[],materialIndex:u,vertices:0,numMorphTargets:l, -numMorphNormals:p},s[k]=q,t.push(q)));s[k].faces3.push(r);s[k].vertices+=3}f[g]=t;b.groupsNeedUpdate=!1}f=Ua[b.id];g=0;for(d=f.length;g<d;g++){h=f[g];if(void 0===h.__webglVertexBuffer){e=h;e.__webglVertexBuffer=m.createBuffer();e.__webglNormalBuffer=m.createBuffer();e.__webglTangentBuffer=m.createBuffer();e.__webglColorBuffer=m.createBuffer();e.__webglUVBuffer=m.createBuffer();e.__webglUV2Buffer=m.createBuffer();e.__webglSkinIndicesBuffer=m.createBuffer();e.__webglSkinWeightsBuffer=m.createBuffer(); -e.__webglFaceBuffer=m.createBuffer();e.__webglLineBuffer=m.createBuffer();if(p=e.numMorphTargets)for(e.__webglMorphTargetsBuffers=[],l=0;l<p;l++)e.__webglMorphTargetsBuffers.push(m.createBuffer());if(p=e.numMorphNormals)for(e.__webglMorphNormalsBuffers=[],l=0;l<p;l++)e.__webglMorphNormalsBuffers.push(m.createBuffer());B.info.memory.geometries++;e=h;r=a;w=r.geometry;p=e.faces3;l=3*p.length;s=1*p.length;t=3*p.length;p=c(r,e);e.__vertexArray=new Float32Array(3*l);e.__normalArray=new Float32Array(3*l); -e.__colorArray=new Float32Array(3*l);e.__uvArray=new Float32Array(2*l);1<w.faceVertexUvs.length&&(e.__uv2Array=new Float32Array(2*l));w.hasTangents&&(e.__tangentArray=new Float32Array(4*l));r.geometry.skinWeights.length&&r.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*l),e.__skinWeightArray=new Float32Array(4*l));r=null!==da.get("OES_element_index_uint")&&21845<s?Uint32Array:Uint16Array;e.__typeArray=r;e.__faceArray=new r(3*s);e.__lineArray=new r(2*t);if(w=e.numMorphTargets)for(e.__morphTargetsArrays= -[],r=0;r<w;r++)e.__morphTargetsArrays.push(new Float32Array(3*l));if(w=e.numMorphNormals)for(e.__morphNormalsArrays=[],r=0;r<w;r++)e.__morphNormalsArrays.push(new Float32Array(3*l));e.__webglFaceCount=3*s;e.__webglLineCount=2*t;if(p.attributes)for(s in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),s=void 0,p.attributes){var t=p.attributes[s],r={},v;for(v in t)r[v]=t[v];if(!r.__webglInitialized||r.createUniqueBuffers)r.__webglInitialized=!0,w=1,"v2"===r.type?w=2:"v3"=== -r.type?w=3:"v4"===r.type?w=4:"c"===r.type&&(w=3),r.size=w,r.array=new Float32Array(l*w),r.buffer=m.createBuffer(),r.buffer.belongsToAttribute=s,t.needsUpdate=!0,r.__original=t;e.__webglCustomAttributesList.push(r)}e.__inittedArrays=!0;b.verticesNeedUpdate=!0;b.morphTargetsNeedUpdate=!0;b.elementsNeedUpdate=!0;b.uvsNeedUpdate=!0;b.normalsNeedUpdate=!0;b.tangentsNeedUpdate=!0;e=b.colorsNeedUpdate=!0}else e=!1;(e||void 0===a.__webglActive)&&n(ba,h,a)}a.__webglActive=!0}function n(a,b,c){var d=c.id;a[d]= -a[d]||[];a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function t(a){var b=a.geometry;if(b instanceof THREE.BufferGeometry)for(var d=b.attributes,e=b.attributesKeys,f=0,g=e.length;f<g;f++){var h=e[f],k=d[h],n="index"===h?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER;void 0===k.buffer?(k.buffer=m.createBuffer(),m.bindBuffer(n,k.buffer),m.bufferData(n,k.array,k instanceof THREE.DynamicBufferAttribute?m.DYNAMIC_DRAW:m.STATIC_DRAW),k.needsUpdate=!1):!0===k.needsUpdate&&(m.bindBuffer(n,k.buffer),void 0=== -k.updateRange||-1===k.updateRange.count?m.bufferSubData(n,0,k.array):0===k.updateRange.count?console.error("THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):(m.bufferSubData(n,k.updateRange.offset*k.array.BYTES_PER_ELEMENT,k.array.subarray(k.updateRange.offset,k.updateRange.offset+k.updateRange.count)),k.updateRange.count=0),k.needsUpdate=!1)}else if(a instanceof THREE.Mesh){!0=== -b.groupsNeedUpdate&&q(a,b);for(var l=Ua[b.id],f=0,p=l.length;f<p;f++){var t=l[f],w=c(a,t),u=w.attributes&&r(w);if(b.verticesNeedUpdate||b.morphTargetsNeedUpdate||b.elementsNeedUpdate||b.uvsNeedUpdate||b.normalsNeedUpdate||b.colorsNeedUpdate||b.tangentsNeedUpdate||u){var v=t,x=a,D=m.DYNAMIC_DRAW,A=!b.dynamic,E=w;if(v.__inittedArrays){var G=!1===E instanceof THREE.MeshPhongMaterial&&E.shading===THREE.FlatShading,y=void 0,z=void 0,F=void 0,B=void 0,I=void 0,H=void 0,M=void 0,R=void 0,P=void 0,U=void 0, -O=void 0,J=void 0,L=void 0,N=void 0,Ka=void 0,V=void 0,W=void 0,Qa=void 0,Ya=void 0,Xa=void 0,da=void 0,ba=void 0,ja=void 0,Pa=void 0,ka=void 0,Q=void 0,ha=void 0,ia=void 0,ob=void 0,Y=void 0,ub=void 0,pa=void 0,ab=void 0,oa=void 0,ca=void 0,qa=void 0,Ca=void 0,ta=void 0,na=void 0,wa=void 0,La=0,Ma=0,kb=0,yb=0,zb=0,Ra=0,Aa=0,eb=0,Ha=0,la=0,ra=0,K=0,za=void 0,Sa=v.__vertexArray,Ab=v.__uvArray,lb=v.__uv2Array,Na=v.__normalArray,sa=v.__tangentArray,Da=v.__colorArray,Ea=v.__skinIndexArray,Fa=v.__skinWeightArray, -Gb=v.__morphTargetsArrays,Bb=v.__morphNormalsArrays,mb=v.__webglCustomAttributesList,C=void 0,Va=v.__faceArray,Ta=v.__lineArray,ea=x.geometry,fb=ea.elementsNeedUpdate,vb=ea.uvsNeedUpdate,Mb=ea.normalsNeedUpdate,Ob=ea.tangentsNeedUpdate,ib=ea.colorsNeedUpdate,sb=ea.morphTargetsNeedUpdate,Cb=ea.vertices,$=v.faces3,xa=ea.faces,Hb=ea.faceVertexUvs[0],Oa=ea.faceVertexUvs[1],$a=ea.skinIndices,Ga=ea.skinWeights,nb=ea.morphTargets,bb=ea.morphNormals;if(ea.verticesNeedUpdate){y=0;for(z=$.length;y<z;y++)B= -xa[$[y]],J=Cb[B.a],L=Cb[B.b],N=Cb[B.c],Sa[Ma]=J.x,Sa[Ma+1]=J.y,Sa[Ma+2]=J.z,Sa[Ma+3]=L.x,Sa[Ma+4]=L.y,Sa[Ma+5]=L.z,Sa[Ma+6]=N.x,Sa[Ma+7]=N.y,Sa[Ma+8]=N.z,Ma+=9;m.bindBuffer(m.ARRAY_BUFFER,v.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Sa,D)}if(sb)for(ca=0,qa=nb.length;ca<qa;ca++){y=ra=0;for(z=$.length;y<z;y++)na=$[y],B=xa[na],J=nb[ca].vertices[B.a],L=nb[ca].vertices[B.b],N=nb[ca].vertices[B.c],Ca=Gb[ca],Ca[ra]=J.x,Ca[ra+1]=J.y,Ca[ra+2]=J.z,Ca[ra+3]=L.x,Ca[ra+4]=L.y,Ca[ra+5]=L.z,Ca[ra+6]=N.x,Ca[ra+ -7]=N.y,Ca[ra+8]=N.z,E.morphNormals&&(G?Xa=Ya=Qa=bb[ca].faceNormals[na]:(wa=bb[ca].vertexNormals[na],Qa=wa.a,Ya=wa.b,Xa=wa.c),ta=Bb[ca],ta[ra]=Qa.x,ta[ra+1]=Qa.y,ta[ra+2]=Qa.z,ta[ra+3]=Ya.x,ta[ra+4]=Ya.y,ta[ra+5]=Ya.z,ta[ra+6]=Xa.x,ta[ra+7]=Xa.y,ta[ra+8]=Xa.z),ra+=9;m.bindBuffer(m.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[ca]);m.bufferData(m.ARRAY_BUFFER,Gb[ca],D);E.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglMorphNormalsBuffers[ca]),m.bufferData(m.ARRAY_BUFFER,Bb[ca],D))}if(Ga.length){y=0; -for(z=$.length;y<z;y++)B=xa[$[y]],Pa=Ga[B.a],ka=Ga[B.b],Q=Ga[B.c],Fa[la]=Pa.x,Fa[la+1]=Pa.y,Fa[la+2]=Pa.z,Fa[la+3]=Pa.w,Fa[la+4]=ka.x,Fa[la+5]=ka.y,Fa[la+6]=ka.z,Fa[la+7]=ka.w,Fa[la+8]=Q.x,Fa[la+9]=Q.y,Fa[la+10]=Q.z,Fa[la+11]=Q.w,ha=$a[B.a],ia=$a[B.b],ob=$a[B.c],Ea[la]=ha.x,Ea[la+1]=ha.y,Ea[la+2]=ha.z,Ea[la+3]=ha.w,Ea[la+4]=ia.x,Ea[la+5]=ia.y,Ea[la+6]=ia.z,Ea[la+7]=ia.w,Ea[la+8]=ob.x,Ea[la+9]=ob.y,Ea[la+10]=ob.z,Ea[la+11]=ob.w,la+=12;0<la&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglSkinIndicesBuffer), -m.bufferData(m.ARRAY_BUFFER,Ea,D),m.bindBuffer(m.ARRAY_BUFFER,v.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,Fa,D))}if(ib){y=0;for(z=$.length;y<z;y++)B=xa[$[y]],M=B.vertexColors,R=B.color,3===M.length&&E.vertexColors===THREE.VertexColors?(da=M[0],ba=M[1],ja=M[2]):ja=ba=da=R,Da[Ha]=da.r,Da[Ha+1]=da.g,Da[Ha+2]=da.b,Da[Ha+3]=ba.r,Da[Ha+4]=ba.g,Da[Ha+5]=ba.b,Da[Ha+6]=ja.r,Da[Ha+7]=ja.g,Da[Ha+8]=ja.b,Ha+=9;0<Ha&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,Da, -D))}if(Ob&&ea.hasTangents){y=0;for(z=$.length;y<z;y++)B=xa[$[y]],P=B.vertexTangents,Ka=P[0],V=P[1],W=P[2],sa[Aa]=Ka.x,sa[Aa+1]=Ka.y,sa[Aa+2]=Ka.z,sa[Aa+3]=Ka.w,sa[Aa+4]=V.x,sa[Aa+5]=V.y,sa[Aa+6]=V.z,sa[Aa+7]=V.w,sa[Aa+8]=W.x,sa[Aa+9]=W.y,sa[Aa+10]=W.z,sa[Aa+11]=W.w,Aa+=12;m.bindBuffer(m.ARRAY_BUFFER,v.__webglTangentBuffer);m.bufferData(m.ARRAY_BUFFER,sa,D)}if(Mb){y=0;for(z=$.length;y<z;y++)if(B=xa[$[y]],I=B.vertexNormals,H=B.normal,3===I.length&&!1===G)for(Y=0;3>Y;Y++)pa=I[Y],Na[Ra]=pa.x,Na[Ra+1]= -pa.y,Na[Ra+2]=pa.z,Ra+=3;else for(Y=0;3>Y;Y++)Na[Ra]=H.x,Na[Ra+1]=H.y,Na[Ra+2]=H.z,Ra+=3;m.bindBuffer(m.ARRAY_BUFFER,v.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,Na,D)}if(vb&&Hb){y=0;for(z=$.length;y<z;y++)if(F=$[y],U=Hb[F],void 0!==U)for(Y=0;3>Y;Y++)ab=U[Y],Ab[kb]=ab.x,Ab[kb+1]=ab.y,kb+=2;0<kb&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,Ab,D))}if(vb&&Oa){y=0;for(z=$.length;y<z;y++)if(F=$[y],O=Oa[F],void 0!==O)for(Y=0;3>Y;Y++)oa=O[Y],lb[yb]=oa.x,lb[yb+1]=oa.y, -yb+=2;0<yb&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,lb,D))}if(fb){y=0;for(z=$.length;y<z;y++)Va[zb]=La,Va[zb+1]=La+1,Va[zb+2]=La+2,zb+=3,Ta[eb]=La,Ta[eb+1]=La+1,Ta[eb+2]=La,Ta[eb+3]=La+2,Ta[eb+4]=La+1,Ta[eb+5]=La+2,eb+=6,La+=3;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Va,D);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ta,D)}if(mb)for(Y=0,ub=mb.length;Y<ub;Y++)if(C= -mb[Y],C.__original.needsUpdate){K=0;if(1===C.size)if(void 0===C.boundTo||"vertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)B=xa[$[y]],C.array[K]=C.value[B.a],C.array[K+1]=C.value[B.b],C.array[K+2]=C.value[B.c],K+=3;else{if("faces"===C.boundTo)for(y=0,z=$.length;y<z;y++)za=C.value[$[y]],C.array[K]=za,C.array[K+1]=za,C.array[K+2]=za,K+=3}else if(2===C.size)if(void 0===C.boundTo||"vertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)B=xa[$[y]],J=C.value[B.a],L=C.value[B.b],N=C.value[B.c],C.array[K]=J.x, -C.array[K+1]=J.y,C.array[K+2]=L.x,C.array[K+3]=L.y,C.array[K+4]=N.x,C.array[K+5]=N.y,K+=6;else{if("faces"===C.boundTo)for(y=0,z=$.length;y<z;y++)N=L=J=za=C.value[$[y]],C.array[K]=J.x,C.array[K+1]=J.y,C.array[K+2]=L.x,C.array[K+3]=L.y,C.array[K+4]=N.x,C.array[K+5]=N.y,K+=6}else if(3===C.size){var T;T="c"===C.type?["r","g","b"]:["x","y","z"];if(void 0===C.boundTo||"vertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)B=xa[$[y]],J=C.value[B.a],L=C.value[B.b],N=C.value[B.c],C.array[K]=J[T[0]],C.array[K+1]= -J[T[1]],C.array[K+2]=J[T[2]],C.array[K+3]=L[T[0]],C.array[K+4]=L[T[1]],C.array[K+5]=L[T[2]],C.array[K+6]=N[T[0]],C.array[K+7]=N[T[1]],C.array[K+8]=N[T[2]],K+=9;else if("faces"===C.boundTo)for(y=0,z=$.length;y<z;y++)N=L=J=za=C.value[$[y]],C.array[K]=J[T[0]],C.array[K+1]=J[T[1]],C.array[K+2]=J[T[2]],C.array[K+3]=L[T[0]],C.array[K+4]=L[T[1]],C.array[K+5]=L[T[2]],C.array[K+6]=N[T[0]],C.array[K+7]=N[T[1]],C.array[K+8]=N[T[2]],K+=9;else if("faceVertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)za=C.value[$[y]], -J=za[0],L=za[1],N=za[2],C.array[K]=J[T[0]],C.array[K+1]=J[T[1]],C.array[K+2]=J[T[2]],C.array[K+3]=L[T[0]],C.array[K+4]=L[T[1]],C.array[K+5]=L[T[2]],C.array[K+6]=N[T[0]],C.array[K+7]=N[T[1]],C.array[K+8]=N[T[2]],K+=9}else if(4===C.size)if(void 0===C.boundTo||"vertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)B=xa[$[y]],J=C.value[B.a],L=C.value[B.b],N=C.value[B.c],C.array[K]=J.x,C.array[K+1]=J.y,C.array[K+2]=J.z,C.array[K+3]=J.w,C.array[K+4]=L.x,C.array[K+5]=L.y,C.array[K+6]=L.z,C.array[K+7]=L.w,C.array[K+ -8]=N.x,C.array[K+9]=N.y,C.array[K+10]=N.z,C.array[K+11]=N.w,K+=12;else if("faces"===C.boundTo)for(y=0,z=$.length;y<z;y++)N=L=J=za=C.value[$[y]],C.array[K]=J.x,C.array[K+1]=J.y,C.array[K+2]=J.z,C.array[K+3]=J.w,C.array[K+4]=L.x,C.array[K+5]=L.y,C.array[K+6]=L.z,C.array[K+7]=L.w,C.array[K+8]=N.x,C.array[K+9]=N.y,C.array[K+10]=N.z,C.array[K+11]=N.w,K+=12;else if("faceVertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)za=C.value[$[y]],J=za[0],L=za[1],N=za[2],C.array[K]=J.x,C.array[K+1]=J.y,C.array[K+2]= -J.z,C.array[K+3]=J.w,C.array[K+4]=L.x,C.array[K+5]=L.y,C.array[K+6]=L.z,C.array[K+7]=L.w,C.array[K+8]=N.x,C.array[K+9]=N.y,C.array[K+10]=N.z,C.array[K+11]=N.w,K+=12;m.bindBuffer(m.ARRAY_BUFFER,C.buffer);m.bufferData(m.ARRAY_BUFFER,C.array,D)}A&&(delete v.__inittedArrays,delete v.__colorArray,delete v.__normalArray,delete v.__tangentArray,delete v.__uvArray,delete v.__uv2Array,delete v.__faceArray,delete v.__vertexArray,delete v.__lineArray,delete v.__skinIndexArray,delete v.__skinWeightArray)}}}b.verticesNeedUpdate= -!1;b.morphTargetsNeedUpdate=!1;b.elementsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.tangentsNeedUpdate=!1;w.attributes&&s(w)}else if(a instanceof THREE.Line){w=c(a,b);u=w.attributes&&r(w);if(b.verticesNeedUpdate||b.colorsNeedUpdate||b.lineDistancesNeedUpdate||u){var Db=m.DYNAMIC_DRAW,S,aa,Z,Ba,X,Eb,Rb=b.vertices,Ib=b.colors,gb=b.lineDistances,ya=Rb.length,pb=Ib.length,qb=gb.length,Wa=b.__vertexArray,tb=b.__colorArray,hb=b.__lineDistanceArray,$b=b.colorsNeedUpdate, -Fb=b.lineDistancesNeedUpdate,Sb=b.__webglCustomAttributesList,Jb,cb,ua,Kb,Ia,fa;if(b.verticesNeedUpdate){for(S=0;S<ya;S++)Ba=Rb[S],X=3*S,Wa[X]=Ba.x,Wa[X+1]=Ba.y,Wa[X+2]=Ba.z;m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Wa,Db)}if($b){for(aa=0;aa<pb;aa++)Eb=Ib[aa],X=3*aa,tb[X]=Eb.r,tb[X+1]=Eb.g,tb[X+2]=Eb.b;m.bindBuffer(m.ARRAY_BUFFER,b.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,tb,Db)}if(Fb){for(Z=0;Z<qb;Z++)hb[Z]=gb[Z];m.bindBuffer(m.ARRAY_BUFFER,b.__webglLineDistanceBuffer); -m.bufferData(m.ARRAY_BUFFER,hb,Db)}if(Sb)for(Jb=0,cb=Sb.length;Jb<cb;Jb++)if(fa=Sb[Jb],fa.needsUpdate&&(void 0===fa.boundTo||"vertices"===fa.boundTo)){X=0;Kb=fa.value.length;if(1===fa.size)for(ua=0;ua<Kb;ua++)fa.array[ua]=fa.value[ua];else if(2===fa.size)for(ua=0;ua<Kb;ua++)Ia=fa.value[ua],fa.array[X]=Ia.x,fa.array[X+1]=Ia.y,X+=2;else if(3===fa.size)if("c"===fa.type)for(ua=0;ua<Kb;ua++)Ia=fa.value[ua],fa.array[X]=Ia.r,fa.array[X+1]=Ia.g,fa.array[X+2]=Ia.b,X+=3;else for(ua=0;ua<Kb;ua++)Ia=fa.value[ua], -fa.array[X]=Ia.x,fa.array[X+1]=Ia.y,fa.array[X+2]=Ia.z,X+=3;else if(4===fa.size)for(ua=0;ua<Kb;ua++)Ia=fa.value[ua],fa.array[X]=Ia.x,fa.array[X+1]=Ia.y,fa.array[X+2]=Ia.z,fa.array[X+3]=Ia.w,X+=4;m.bindBuffer(m.ARRAY_BUFFER,fa.buffer);m.bufferData(m.ARRAY_BUFFER,fa.array,Db);fa.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;b.lineDistancesNeedUpdate=!1;w.attributes&&s(w)}else if(a instanceof THREE.PointCloud){w=c(a,b);u=w.attributes&&r(w);if(b.verticesNeedUpdate||b.colorsNeedUpdate|| -u){var db=m.DYNAMIC_DRAW,Tb,Ub,ac,ma,bc,Nb=b.vertices,Vb=Nb.length,Pb=b.colors,rb=Pb.length,cc=b.__vertexArray,dc=b.__colorArray,wb=b.colorsNeedUpdate,gc=b.__webglCustomAttributesList,ec,jb,va,Lb,Ja,ga;if(b.verticesNeedUpdate){for(Tb=0;Tb<Vb;Tb++)ac=Nb[Tb],ma=3*Tb,cc[ma]=ac.x,cc[ma+1]=ac.y,cc[ma+2]=ac.z;m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,cc,db)}if(wb){for(Ub=0;Ub<rb;Ub++)bc=Pb[Ub],ma=3*Ub,dc[ma]=bc.r,dc[ma+1]=bc.g,dc[ma+2]=bc.b;m.bindBuffer(m.ARRAY_BUFFER, -b.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,dc,db)}if(gc)for(ec=0,jb=gc.length;ec<jb;ec++){ga=gc[ec];if(ga.needsUpdate&&(void 0===ga.boundTo||"vertices"===ga.boundTo))if(Lb=ga.value.length,ma=0,1===ga.size)for(va=0;va<Lb;va++)ga.array[va]=ga.value[va];else if(2===ga.size)for(va=0;va<Lb;va++)Ja=ga.value[va],ga.array[ma]=Ja.x,ga.array[ma+1]=Ja.y,ma+=2;else if(3===ga.size)if("c"===ga.type)for(va=0;va<Lb;va++)Ja=ga.value[va],ga.array[ma]=Ja.r,ga.array[ma+1]=Ja.g,ga.array[ma+2]=Ja.b,ma+=3;else for(va= -0;va<Lb;va++)Ja=ga.value[va],ga.array[ma]=Ja.x,ga.array[ma+1]=Ja.y,ga.array[ma+2]=Ja.z,ma+=3;else if(4===ga.size)for(va=0;va<Lb;va++)Ja=ga.value[va],ga.array[ma]=Ja.x,ga.array[ma+1]=Ja.y,ga.array[ma+2]=Ja.z,ga.array[ma+3]=Ja.w,ma+=4;m.bindBuffer(m.ARRAY_BUFFER,ga.buffer);m.bufferData(m.ARRAY_BUFFER,ga.array,db);ga.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;w.attributes&&s(w)}}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate= -!1}function u(a){!0===a.transparent?W.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha):W.setBlending(THREE.NoBlending);W.setDepthTest(a.depthTest);W.setDepthWrite(a.depthWrite);W.setColorWrite(a.colorWrite);W.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function v(a,b,c,d,e){var f,g,h,k;Mb=0;if(d.needsUpdate){d.program&&hc(d);d.addEventListener("dispose",ic);var n=pc[d.type];if(n){var l=THREE.ShaderLib[n]; -d.__webglShader={uniforms:THREE.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var p=0,q=0,r=0,s=0,t=0,w=b.length;t<w;t++){var v=b[t];v.onlyShadow||!1===v.visible||(v instanceof THREE.DirectionalLight&&p++,v instanceof THREE.PointLight&&q++,v instanceof THREE.SpotLight&&r++,v instanceof THREE.HemisphereLight&&s++)}f=p;g=q;h=r;k=s;for(var u,z=0,G= -0,F=b.length;G<F;G++){var J=b[G];J.castShadow&&(J instanceof THREE.SpotLight&&z++,J instanceof THREE.DirectionalLight&&!J.shadowCascade&&z++)}u=z;var H;if(Nb&&e&&e.skeleton&&e.skeleton.useVertexTexture)H=1024;else{var N=m.getParameter(m.MAX_VERTEX_UNIFORM_VECTORS),M=Math.floor((N-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(M=Math.min(e.skeleton.bones.length,M),M<e.skeleton.bones.length&&THREE.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+M+" (try OpenGL instead of ANGLE)")); -H=M}var P={precision:L,supportsVertexTextures:Vb,map:!!d.map,envMap:!!d.envMap,envMapMode:d.envMap&&d.envMap.mapping,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,combine:d.combine,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,flatShading:d.shading===THREE.FlatShading,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:ja,skinning:d.skinning,maxBones:H,useVertexTexture:Nb&&e&&e.skeleton&& -e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:B.maxMorphTargets,maxMorphNormals:B.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:u,shadowMapEnabled:B.shadowMapEnabled&&e.receiveShadow&&0<u,shadowMapType:B.shadowMapType,shadowMapDebug:B.shadowMapDebug,shadowMapCascade:B.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side=== -THREE.BackSide},R=[];n?R.push(n):(R.push(d.fragmentShader),R.push(d.vertexShader));if(void 0!==d.defines)for(var O in d.defines)R.push(O),R.push(d.defines[O]);for(O in P)R.push(O),R.push(P[O]);for(var Ka=R.join(),V,W=0,Qa=Pa.length;W<Qa;W++){var Ya=Pa[W];if(Ya.code===Ka){V=Ya;V.usedTimes++;break}}void 0===V&&(V=new THREE.WebGLProgram(B,Ka,d,P),Pa.push(V),B.info.memory.programs=Pa.length);d.program=V;var Xa=V.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var ca,da="morphTarget",ba= -0;ba<B.maxMorphTargets;ba++)ca=da+ba,0<=Xa[ca]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,da="morphNormal",ba=0;ba<B.maxMorphNormals;ba++)ca=da+ba,0<=Xa[ca]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var ha in d.__webglShader.uniforms){var ta=d.program.uniforms[ha];ta&&d.uniformsList.push([d.__webglShader.uniforms[ha],ta])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets)); -var ab=!1,oa=!1,qa=!1,Ua=d.program,ka=Ua.uniforms,Q=d.__webglShader.uniforms;Ua.id!==ob&&(m.useProgram(Ua.program),ob=Ua.id,qa=oa=ab=!0);d.id!==ub&&(-1===ub&&(qa=!0),ub=d.id,oa=!0);if(ab||a!==vb)m.uniformMatrix4fv(ka.projectionMatrix,!1,a.projectionMatrix.elements),ja&&m.uniform1f(ka.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==vb&&(vb=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==ka.cameraPosition&&(wa.setFromMatrixPosition(a.matrixWorld),m.uniform3f(ka.cameraPosition, -wa.x,wa.y,wa.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==ka.viewMatrix&&m.uniformMatrix4fv(ka.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==ka.bindMatrix&&m.uniformMatrix4fv(ka.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&null!==ka.bindMatrixInverse&&m.uniformMatrix4fv(ka.bindMatrixInverse,!1,e.bindMatrixInverse.elements), -Nb&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==ka.boneTexture){var db=D();m.uniform1i(ka.boneTexture,db);B.setTexture(e.skeleton.boneTexture,db)}null!==ka.boneTextureWidth&&m.uniform1i(ka.boneTextureWidth,e.skeleton.boneTextureWidth);null!==ka.boneTextureHeight&&m.uniform1i(ka.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==ka.boneGlobalMatrices&&m.uniformMatrix4fv(ka.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(oa){c&&d.fog&&(Q.fogColor.value= -c.color,c instanceof THREE.Fog?(Q.fogNear.value=c.near,Q.fogFar.value=c.far):c instanceof THREE.FogExp2&&(Q.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ob){var qa=!0,ia,Za,Y,bb=0,cb=0,ib=0,xb,pb,qb,Ca,jb,na=jc,rb=na.directional.colors,La=na.directional.positions,Ma=na.point.colors,kb=na.point.positions,yb=na.point.distances,zb=na.point.decays,Ra=na.spot.colors,Aa=na.spot.positions,eb=na.spot.distances,Ha=na.spot.directions, -la=na.spot.anglesCos,ra=na.spot.exponents,K=na.spot.decays,za=na.hemi.skyColors,Sa=na.hemi.groundColors,Ab=na.hemi.positions,lb=0,Na=0,sa=0,Da=0,Ea=0,Fa=0,Gb=0,Bb=0,mb=0,C=0,Va=0,Ta=0;ia=0;for(Za=b.length;ia<Za;ia++)Y=b[ia],Y.onlyShadow||(xb=Y.color,Ca=Y.intensity,jb=Y.distance,Y instanceof THREE.AmbientLight?Y.visible&&(bb+=xb.r,cb+=xb.g,ib+=xb.b):Y instanceof THREE.DirectionalLight?(Ea+=1,Y.visible&&(pa.setFromMatrixPosition(Y.matrixWorld),wa.setFromMatrixPosition(Y.target.matrixWorld),pa.sub(wa), -pa.normalize(),mb=3*lb,La[mb]=pa.x,La[mb+1]=pa.y,La[mb+2]=pa.z,y(rb,mb,xb,Ca),lb+=1)):Y instanceof THREE.PointLight?(Fa+=1,Y.visible&&(C=3*Na,y(Ma,C,xb,Ca),wa.setFromMatrixPosition(Y.matrixWorld),kb[C]=wa.x,kb[C+1]=wa.y,kb[C+2]=wa.z,yb[Na]=jb,zb[Na]=0===Y.distance?0:Y.decay,Na+=1)):Y instanceof THREE.SpotLight?(Gb+=1,Y.visible&&(Va=3*sa,y(Ra,Va,xb,Ca),pa.setFromMatrixPosition(Y.matrixWorld),Aa[Va]=pa.x,Aa[Va+1]=pa.y,Aa[Va+2]=pa.z,eb[sa]=jb,wa.setFromMatrixPosition(Y.target.matrixWorld),pa.sub(wa), -pa.normalize(),Ha[Va]=pa.x,Ha[Va+1]=pa.y,Ha[Va+2]=pa.z,la[sa]=Math.cos(Y.angle),ra[sa]=Y.exponent,K[sa]=0===Y.distance?0:Y.decay,sa+=1)):Y instanceof THREE.HemisphereLight&&(Bb+=1,Y.visible&&(pa.setFromMatrixPosition(Y.matrixWorld),pa.normalize(),Ta=3*Da,Ab[Ta]=pa.x,Ab[Ta+1]=pa.y,Ab[Ta+2]=pa.z,pb=Y.color,qb=Y.groundColor,y(za,Ta,pb,Ca),y(Sa,Ta,qb,Ca),Da+=1)));ia=3*lb;for(Za=Math.max(rb.length,3*Ea);ia<Za;ia++)rb[ia]=0;ia=3*Na;for(Za=Math.max(Ma.length,3*Fa);ia<Za;ia++)Ma[ia]=0;ia=3*sa;for(Za=Math.max(Ra.length, -3*Gb);ia<Za;ia++)Ra[ia]=0;ia=3*Da;for(Za=Math.max(za.length,3*Bb);ia<Za;ia++)za[ia]=0;ia=3*Da;for(Za=Math.max(Sa.length,3*Bb);ia<Za;ia++)Sa[ia]=0;na.directional.length=lb;na.point.length=Na;na.spot.length=sa;na.hemi.length=Da;na.ambient[0]=bb;na.ambient[1]=cb;na.ambient[2]=ib;Ob=!1}if(qa){var ea=jc;Q.ambientLightColor.value=ea.ambient;Q.directionalLightColor.value=ea.directional.colors;Q.directionalLightDirection.value=ea.directional.positions;Q.pointLightColor.value=ea.point.colors;Q.pointLightPosition.value= -ea.point.positions;Q.pointLightDistance.value=ea.point.distances;Q.pointLightDecay.value=ea.point.decays;Q.spotLightColor.value=ea.spot.colors;Q.spotLightPosition.value=ea.spot.positions;Q.spotLightDistance.value=ea.spot.distances;Q.spotLightDirection.value=ea.spot.directions;Q.spotLightAngleCos.value=ea.spot.anglesCos;Q.spotLightExponent.value=ea.spot.exponents;Q.spotLightDecay.value=ea.spot.decays;Q.hemisphereLightSkyColor.value=ea.hemi.skyColors;Q.hemisphereLightGroundColor.value=ea.hemi.groundColors; -Q.hemisphereLightDirection.value=ea.hemi.positions;x(Q,!0)}else x(Q,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){Q.opacity.value=d.opacity;Q.diffuse.value=d.color;Q.map.value=d.map;Q.lightMap.value=d.lightMap;Q.specularMap.value=d.specularMap;Q.alphaMap.value=d.alphaMap;d.bumpMap&&(Q.bumpMap.value=d.bumpMap,Q.bumpScale.value=d.bumpScale);d.normalMap&&(Q.normalMap.value=d.normalMap,Q.normalScale.value.copy(d.normalScale)); -var fb;d.map?fb=d.map:d.specularMap?fb=d.specularMap:d.normalMap?fb=d.normalMap:d.bumpMap?fb=d.bumpMap:d.alphaMap&&(fb=d.alphaMap);if(void 0!==fb){var wb=fb.offset,Qb=fb.repeat;Q.offsetRepeat.value.set(wb.x,wb.y,Qb.x,Qb.y)}Q.envMap.value=d.envMap;Q.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;Q.reflectivity.value=d.reflectivity;Q.refractionRatio.value=d.refractionRatio}if(d instanceof THREE.LineBasicMaterial)Q.diffuse.value=d.color,Q.opacity.value=d.opacity;else if(d instanceof -THREE.LineDashedMaterial)Q.diffuse.value=d.color,Q.opacity.value=d.opacity,Q.dashSize.value=d.dashSize,Q.totalSize.value=d.dashSize+d.gapSize,Q.scale.value=d.scale;else if(d instanceof THREE.PointCloudMaterial){if(Q.psColor.value=d.color,Q.opacity.value=d.opacity,Q.size.value=d.size,Q.scale.value=U.height/2,Q.map.value=d.map,null!==d.map){var Wb=d.map.offset,Xb=d.map.repeat;Q.offsetRepeat.value.set(Wb.x,Wb.y,Xb.x,Xb.y)}}else d instanceof THREE.MeshPhongMaterial?(Q.shininess.value=d.shininess,Q.emissive.value= -d.emissive,Q.specular.value=d.specular,d.wrapAround&&Q.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(Q.emissive.value=d.emissive,d.wrapAround&&Q.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(Q.mNear.value=a.near,Q.mFar.value=a.far,Q.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(Q.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&Q.shadowMatrix)for(var sb=0,Cb=0,$=b.length;Cb<$;Cb++){var xa=b[Cb];xa.castShadow&&(xa instanceof -THREE.SpotLight||xa instanceof THREE.DirectionalLight&&!xa.shadowCascade)&&(Q.shadowMap.value[sb]=xa.shadowMap,Q.shadowMapSize.value[sb]=xa.shadowMapSize,Q.shadowMatrix.value[sb]=xa.shadowMatrix,Q.shadowDarkness.value[sb]=xa.shadowDarkness,Q.shadowBias.value[sb]=xa.shadowBias,sb++)}for(var Hb=d.uniformsList,Oa,$a,Ga,nb=0,fc=Hb.length;nb<fc;nb++){var T=Hb[nb][0];if(!1!==T.needsUpdate){var Db=T.type,S=T.value,aa=Hb[nb][1];switch(Db){case "1i":m.uniform1i(aa,S);break;case "1f":m.uniform1f(aa,S);break; -case "2f":m.uniform2f(aa,S[0],S[1]);break;case "3f":m.uniform3f(aa,S[0],S[1],S[2]);break;case "4f":m.uniform4f(aa,S[0],S[1],S[2],S[3]);break;case "1iv":m.uniform1iv(aa,S);break;case "3iv":m.uniform3iv(aa,S);break;case "1fv":m.uniform1fv(aa,S);break;case "2fv":m.uniform2fv(aa,S);break;case "3fv":m.uniform3fv(aa,S);break;case "4fv":m.uniform4fv(aa,S);break;case "Matrix3fv":m.uniformMatrix3fv(aa,!1,S);break;case "Matrix4fv":m.uniformMatrix4fv(aa,!1,S);break;case "i":m.uniform1i(aa,S);break;case "f":m.uniform1f(aa, -S);break;case "v2":m.uniform2f(aa,S.x,S.y);break;case "v3":m.uniform3f(aa,S.x,S.y,S.z);break;case "v4":m.uniform4f(aa,S.x,S.y,S.z,S.w);break;case "c":m.uniform3f(aa,S.r,S.g,S.b);break;case "iv1":m.uniform1iv(aa,S);break;case "iv":m.uniform3iv(aa,S);break;case "fv1":m.uniform1fv(aa,S);break;case "fv":m.uniform3fv(aa,S);break;case "v2v":void 0===T._array&&(T._array=new Float32Array(2*S.length));for(var Z=0,Ba=S.length;Z<Ba;Z++)Ga=2*Z,T._array[Ga]=S[Z].x,T._array[Ga+1]=S[Z].y;m.uniform2fv(aa,T._array); -break;case "v3v":void 0===T._array&&(T._array=new Float32Array(3*S.length));Z=0;for(Ba=S.length;Z<Ba;Z++)Ga=3*Z,T._array[Ga]=S[Z].x,T._array[Ga+1]=S[Z].y,T._array[Ga+2]=S[Z].z;m.uniform3fv(aa,T._array);break;case "v4v":void 0===T._array&&(T._array=new Float32Array(4*S.length));Z=0;for(Ba=S.length;Z<Ba;Z++)Ga=4*Z,T._array[Ga]=S[Z].x,T._array[Ga+1]=S[Z].y,T._array[Ga+2]=S[Z].z,T._array[Ga+3]=S[Z].w;m.uniform4fv(aa,T._array);break;case "m3":m.uniformMatrix3fv(aa,!1,S.elements);break;case "m3v":void 0=== -T._array&&(T._array=new Float32Array(9*S.length));Z=0;for(Ba=S.length;Z<Ba;Z++)S[Z].flattenToArrayOffset(T._array,9*Z);m.uniformMatrix3fv(aa,!1,T._array);break;case "m4":m.uniformMatrix4fv(aa,!1,S.elements);break;case "m4v":void 0===T._array&&(T._array=new Float32Array(16*S.length));Z=0;for(Ba=S.length;Z<Ba;Z++)S[Z].flattenToArrayOffset(T._array,16*Z);m.uniformMatrix4fv(aa,!1,T._array);break;case "t":Oa=S;$a=D();m.uniform1i(aa,$a);if(!Oa)continue;if(Oa instanceof THREE.CubeTexture||Oa.image instanceof -Array&&6===Oa.image.length){var X=Oa,Eb=$a;if(6===X.image.length)if(X.needsUpdate){X.image.__webglTextureCube||(X.addEventListener("dispose",Pb),X.image.__webglTextureCube=m.createTexture(),B.info.memory.textures++);m.activeTexture(m.TEXTURE0+Eb);m.bindTexture(m.TEXTURE_CUBE_MAP,X.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,X.flipY);for(var Rb=X instanceof THREE.CompressedTexture,Ib=X.image[0]instanceof THREE.DataTexture,gb=[],ya=0;6>ya;ya++)gb[ya]=!B.autoScaleCubemaps||Rb||Ib?Ib? -X.image[ya].image:X.image[ya]:E(X.image[ya],qc);var Yb=gb[0],Zb=THREE.Math.isPowerOfTwo(Yb.width)&&THREE.Math.isPowerOfTwo(Yb.height),Wa=I(X.format),tb=I(X.type);A(m.TEXTURE_CUBE_MAP,X,Zb);for(ya=0;6>ya;ya++)if(Rb)for(var hb,$b=gb[ya].mipmaps,Fb=0,Sb=$b.length;Fb<Sb;Fb++)hb=$b[Fb],X.format!==THREE.RGBAFormat&&X.format!==THREE.RGBFormat?-1<kc().indexOf(Wa)?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+ya,Fb,Wa,hb.width,hb.height,0,hb.data):THREE.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"): -m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+ya,Fb,Wa,hb.width,hb.height,0,Wa,tb,hb.data);else Ib?m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+ya,0,Wa,gb[ya].width,gb[ya].height,0,Wa,tb,gb[ya].data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+ya,0,Wa,Wa,tb,gb[ya]);X.generateMipmaps&&Zb&&m.generateMipmap(m.TEXTURE_CUBE_MAP);X.needsUpdate=!1;if(X.onUpdate)X.onUpdate()}else m.activeTexture(m.TEXTURE0+Eb),m.bindTexture(m.TEXTURE_CUBE_MAP,X.image.__webglTextureCube)}else if(Oa instanceof THREE.WebGLRenderTargetCube){var Jb= -Oa;m.activeTexture(m.TEXTURE0+$a);m.bindTexture(m.TEXTURE_CUBE_MAP,Jb.__webglTexture)}else B.setTexture(Oa,$a);break;case "tv":void 0===T._array&&(T._array=[]);Z=0;for(Ba=T.value.length;Z<Ba;Z++)T._array[Z]=D();m.uniform1iv(aa,T._array);Z=0;for(Ba=T.value.length;Z<Ba;Z++)Oa=T.value[Z],$a=T._array[Z],Oa&&B.setTexture(Oa,$a);break;default:THREE.warn("THREE.WebGLRenderer: Unknown uniform type: "+Db)}}}}m.uniformMatrix4fv(ka.modelViewMatrix,!1,e._modelViewMatrix.elements);ka.normalMatrix&&m.uniformMatrix3fv(ka.normalMatrix, -!1,e._normalMatrix.elements);null!==ka.modelMatrix&&m.uniformMatrix4fv(ka.modelMatrix,!1,e.matrixWorld.elements);return Ua}function x(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.pointLightDecay.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate= -b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.spotLightDecay.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=b}function D(){var a=Mb;a>=Wb&&THREE.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Wb);Mb+=1;return a}function w(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)} -function y(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,I(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,I(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,I(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,I(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||THREE.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+ -b.sourceFile+" )"),m.texParameteri(a,m.TEXTURE_MAG_FILTER,z(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,z(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&THREE.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+b.sourceFile+" )"));(c=da.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&b.type!==THREE.HalfFloatType&&(1<b.anisotropy||b.__currentAnisotropy)&& -(m.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,B.getMaxAnisotropy())),b.__currentAnisotropy=b.anisotropy)}function E(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);THREE.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a} -function G(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height)}function F(a){a instanceof -THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function z(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function I(a){var b;if(a===THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE; -if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4; -if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;b=da.get("OES_texture_half_float");if(null!==b&&a===THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return m.ALPHA; -if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR; -if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return m.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;b=da.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT; -if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=da.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; -if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=da.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var U=void 0!==a.canvas?a.canvas:document.createElement("canvas"),M=void 0!==a.context?a.context:null,H=1,L=void 0!==a.precision?a.precision:"highp",P=void 0!==a.alpha?a.alpha:!1,N=void 0!==a.depth?a.depth:!0,R=void 0!==a.stencil? -a.stencil:!0,V=void 0!==a.antialias?a.antialias:!1,J=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,oa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ja=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,ha=new THREE.Color(0),O=0,ca=[],ba={},qa=[],Ka=[],Qa=[],Xa=[],Ya=[];this.domElement=U;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.shadowMapEnabled=this.gammaOutput=this.gammaInput= -!1;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var B=this,Pa=[],ob=null,ab=null,ub=-1,ta="",vb=null,Mb=0,ib=0,bb=0,pb=U.width,qb=U.height,Xb=0,fc=0,cb=new THREE.Frustum,db=new THREE.Matrix4,wa=new THREE.Vector3,pa=new THREE.Vector3,Ob=!0,jc={ambient:[0, -0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},m;try{var Yb={alpha:P,depth:N,stencil:R,antialias:V,premultipliedAlpha:J,preserveDrawingBuffer:oa};m=M||U.getContext("webgl",Yb)||U.getContext("experimental-webgl",Yb);if(null===m){if(null!==U.getContext("webgl"))throw"Error creating WebGL context with your selected attributes."; -throw"Error creating WebGL context.";}U.addEventListener("webglcontextlost",function(a){a.preventDefault();Zb();lc();ba={}},!1)}catch(rc){THREE.error("THREE.WebGLRenderer: "+rc)}var W=new THREE.WebGLState(m,I);void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var da=new THREE.WebGLExtensions(m);da.get("OES_texture_float");da.get("OES_texture_float_linear");da.get("OES_texture_half_float");da.get("OES_texture_half_float_linear"); -da.get("OES_standard_derivatives");ja&&da.get("EXT_frag_depth");var rb=function(a,b,c,d){!0===J&&(a*=d,b*=d,c*=d);m.clearColor(a,b,c,d)},lc=function(){m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.viewport(ib,bb,pb,qb);rb(ha.r,ha.g,ha.b,O)},Zb=function(){vb=ob=null;ta="";ub=-1;Ob=!0;W.reset()}; -lc();this.context=m;this.state=W;var Wb=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),sc=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS),tc=m.getParameter(m.MAX_TEXTURE_SIZE),qc=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),Vb=0<sc,Nb=Vb&&da.get("OES_texture_float"),uc=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),vc=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_FLOAT),wc=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_FLOAT),xc=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_FLOAT), -kc=function(){var a;return function(){if(void 0!==a)return a;a=[];if(da.get("WEBGL_compressed_texture_pvrtc")||da.get("WEBGL_compressed_texture_s3tc"))for(var b=m.getParameter(m.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);return a}}(),yc=0<uc.precision&&0<wc.precision,mc=0<vc.precision&&0<xc.precision;"highp"!==L||yc||(mc?(L="mediump",THREE.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(L="lowp",THREE.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))); -"mediump"!==L||mc||(L="lowp",THREE.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var zc=new THREE.ShadowMapPlugin(this,ca,ba,qa),Ac=new THREE.SpritePlugin(this,Xa),Bc=new THREE.LensFlarePlugin(this,Ya);this.getContext=function(){return m};this.forceContextLoss=function(){da.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return Vb};this.supportsFloatTextures=function(){return da.get("OES_texture_float")};this.supportsHalfFloatTextures=function(){return da.get("OES_texture_half_float")}; -this.supportsStandardDerivatives=function(){return da.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return da.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){return da.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){return da.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=da.get("EXT_texture_filter_anisotropic");return a=null!==b?m.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT): -0}}();this.getPrecision=function(){return L};this.getPixelRatio=function(){return H};this.setPixelRatio=function(a){H=a};this.setSize=function(a,b,c){U.width=a*H;U.height=b*H;!1!==c&&(U.style.width=a+"px",U.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){ib=a*H;bb=b*H;pb=c*H;qb=d*H;m.viewport(ib,bb,pb,qb)};this.setScissor=function(a,b,c,d){m.scissor(a*H,b*H,c*H,d*H)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.getClearColor= -function(){return ha};this.setClearColor=function(a,b){ha.set(a);O=void 0!==b?b:1;rb(ha.r,ha.g,ha.b,O)};this.getClearAlpha=function(){return O};this.setClearAlpha=function(a){O=a;rb(ha.r,ha.g,ha.b,O)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;m.clear(d)};this.clearColor=function(){m.clear(m.COLOR_BUFFER_BIT)};this.clearDepth=function(){m.clear(m.DEPTH_BUFFER_BIT)};this.clearStencil=function(){m.clear(m.STENCIL_BUFFER_BIT)}; -this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=Zb;var wb=function(a){a.target.traverse(function(a){a.removeEventListener("remove",wb);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete ba[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=qa,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;delete a._normalMatrix;delete a.__webglActive})}, -jb=function(a){a=a.target;a.removeEventListener("dispose",jb);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(m.deleteBuffer(c.buffer),delete c.buffer)}B.info.memory.geometries--}else if(b=Ua[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)m.deleteBuffer(e.__webglMorphTargetsBuffers[f]);delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f= -0;for(g=e.numMorphNormals;f<g;f++)m.deleteBuffer(e.__webglMorphNormalsBuffers[f]);delete e.__webglMorphNormalsBuffers}nc(e)}delete Ua[a.id]}else nc(a);ta=""},Pb=function(a){a=a.target;a.removeEventListener("dispose",Pb);a.image&&a.image.__webglTextureCube?(m.deleteTexture(a.image.__webglTextureCube),delete a.image.__webglTextureCube):void 0!==a.__webglInit&&(m.deleteTexture(a.__webglTexture),delete a.__webglTexture,delete a.__webglInit);B.info.memory.textures--},oc=function(a){a=a.target;a.removeEventListener("dispose", -oc);if(a&&void 0!==a.__webglTexture){m.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}B.info.memory.textures--},ic=function(a){a=a.target;a.removeEventListener("dispose",ic);hc(a)},nc=function(a){for(var b= -"__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),c=0,d=b.length;c<d;c++){var e=b[c];void 0!==a[e]&&(m.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(e in a.__webglCustomAttributesList)m.deleteBuffer(a.__webglCustomAttributesList[e].buffer);delete a.__webglCustomAttributesList}B.info.memory.geometries--}, -hc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Pa.length;a<c;a++)if(d=Pa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Pa.length;a<c;a++)d=Pa[a],d.program!==b&&e.push(d);Pa=e;m.deleteProgram(b);B.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){W.initAttributes();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=m.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer= -m.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=m.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=m.createBuffer());a.hasPositions&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),W.enableAttribute(b.attributes.position),m.vertexAttribPointer(b.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormals){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(!1===c instanceof THREE.MeshPhongMaterial&& -c.shading===THREE.FlatShading){var d,e,f,g,h,k,n,l,p,q,r,s=3*a.count;for(r=0;r<s;r+=9)q=a.normalArray,d=q[r],e=q[r+1],f=q[r+2],g=q[r+3],k=q[r+4],l=q[r+5],h=q[r+6],n=q[r+7],p=q[r+8],d=(d+g+h)/3,e=(e+k+n)/3,f=(f+l+p)/3,q[r]=d,q[r+1]=e,q[r+2]=f,q[r+3]=d,q[r+4]=e,q[r+5]=f,q[r+6]=d,q[r+7]=e,q[r+8]=f}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);W.enableAttribute(b.attributes.normal);m.vertexAttribPointer(b.attributes.normal,3,m.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglUvBuffer), -m.bufferData(m.ARRAY_BUFFER,a.uvArray,m.DYNAMIC_DRAW),W.enableAttribute(b.attributes.uv),m.vertexAttribPointer(b.attributes.uv,2,m.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,a.colorArray,m.DYNAMIC_DRAW),W.enableAttribute(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));W.disableUnusedAttributes();m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a, -b,c,e,f,g){if(!1!==e.visible)if(t(g),a=v(a,b,c,e,g),b=!1,c="direct_"+f.id+"_"+a.id+"_"+(e.wireframe?1:0),c!==ta&&(ta=c,b=!0),b&&W.initAttributes(),g instanceof THREE.Mesh){g=!0===e.wireframe?m.LINES:m.TRIANGLES;var h=f.attributes.index;if(h){var k,n;h.array instanceof Uint32Array&&da.get("OES_element_index_uint")?(k=m.UNSIGNED_INT,n=4):(k=m.UNSIGNED_SHORT,n=2);c=f.offsets;if(0===c.length)b&&(d(e,a,f,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer)),m.drawElements(g,h.array.length,k,0),B.info.render.calls++, -B.info.render.vertices+=h.array.length,B.info.render.faces+=h.array.length/3;else{b=!0;for(var l=0,p=c.length;l<p;l++){var q=c[l].index;b&&(d(e,a,f,q),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer));m.drawElements(g,c[l].count,k,c[l].start*n);B.info.render.calls++;B.info.render.vertices+=c[l].count;B.info.render.faces+=c[l].count/3}}}else b&&d(e,a,f,0),e=f.attributes.position,m.drawArrays(g,0,e.array.length/e.itemSize),B.info.render.calls++,B.info.render.vertices+=e.array.length/e.itemSize,B.info.render.faces+= -e.array.length/(3*e.itemSize)}else if(g instanceof THREE.PointCloud)if(g=m.POINTS,h=f.attributes.index)if(h.array instanceof Uint32Array&&da.get("OES_element_index_uint")?(k=m.UNSIGNED_INT,n=4):(k=m.UNSIGNED_SHORT,n=2),c=f.offsets,0===c.length)b&&(d(e,a,f,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer)),m.drawElements(g,h.array.length,k,0),B.info.render.calls++,B.info.render.points+=h.array.length;else for(1<c.length&&(b=!0),l=0,p=c.length;l<p;l++)q=c[l].index,b&&(d(e,a,f,q),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER, -h.buffer)),m.drawElements(g,c[l].count,k,c[l].start*n),B.info.render.calls++,B.info.render.points+=c[l].count;else if(b&&d(e,a,f,0),e=f.attributes.position,c=f.offsets,0===c.length)m.drawArrays(g,0,e.array.length/3),B.info.render.calls++,B.info.render.points+=e.array.length/3;else for(l=0,p=c.length;l<p;l++)m.drawArrays(g,c[l].index,c[l].count),B.info.render.calls++,B.info.render.points+=c[l].count;else if(g instanceof THREE.Line)if(g=g.mode===THREE.LineStrip?m.LINE_STRIP:m.LINES,W.setLineWidth(e.linewidth* -H),h=f.attributes.index)if(h.array instanceof Uint32Array?(k=m.UNSIGNED_INT,n=4):(k=m.UNSIGNED_SHORT,n=2),c=f.offsets,0===c.length)b&&(d(e,a,f,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer)),m.drawElements(g,h.array.length,k,0),B.info.render.calls++,B.info.render.vertices+=h.array.length;else for(1<c.length&&(b=!0),l=0,p=c.length;l<p;l++)q=c[l].index,b&&(d(e,a,f,q),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer)),m.drawElements(g,c[l].count,k,c[l].start*n),B.info.render.calls++,B.info.render.vertices+= -c[l].count;else if(b&&d(e,a,f,0),e=f.attributes.position,c=f.offsets,0===c.length)m.drawArrays(g,0,e.array.length/3),B.info.render.calls++,B.info.render.vertices+=e.array.length/3;else for(l=0,p=c.length;l<p;l++)m.drawArrays(g,c[l].index,c[l].count),B.info.render.calls++,B.info.render.vertices+=c[l].count};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){t(f);c=v(a,b,c,d,f);b=c.attributes;a=!1;c=e.id+"_"+c.id+"_"+(d.wireframe?1:0);c!==ta&&(ta=c,a=!0);a&&W.initAttributes();if(!d.morphTargets&& -0<=b.position)a&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),W.enableAttribute(b.position),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),W.enableAttribute(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),W.enableAttribute(c.position),m.vertexAttribPointer(c.position, -3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length)for(var h=0,k=f.morphTargetForcedOrder,n=f.morphTargetInfluences,l;h<d.numSupportedMorphTargets&&h<k.length;)l=c["morphTarget"+h],0<=l&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[h]]),W.enableAttribute(l),m.vertexAttribPointer(l,3,m.FLOAT,!1,0,0)),l=c["morphNormal"+h],0<=l&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[h]]),W.enableAttribute(l),m.vertexAttribPointer(l,3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[h]= -n[k[h]],h++;else{k=[];n=f.morphTargetInfluences;h=f.geometry.morphTargets;n.length>h.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),n.length=h.length);h=0;for(l=n.length;h<l;h++)k.push([n[h],h]);k.length>d.numSupportedMorphTargets?(k.sort(g),k.length=d.numSupportedMorphTargets):k.length>d.numSupportedMorphNormals?k.sort(g):0===k.length&&k.push([0,0]);for(var h=0,p=d.numSupportedMorphTargets;h<p;h++)if(k[h]){var q=k[h][1];l=c["morphTarget"+h];0<=l&& -(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[q]),W.enableAttribute(l),m.vertexAttribPointer(l,3,m.FLOAT,!1,0,0));l=c["morphNormal"+h];0<=l&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[q]),W.enableAttribute(l),m.vertexAttribPointer(l,3,m.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[h]=n[q]}else f.__webglMorphTargetInfluences[h]=0}null!==d.program.uniforms.morphTargetInfluences&&m.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(c= -0,n=e.__webglCustomAttributesList.length;c<n;c++)k=e.__webglCustomAttributesList[c],0<=b[k.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,k.buffer),W.enableAttribute(b[k.buffer.belongsToAttribute]),m.vertexAttribPointer(b[k.buffer.belongsToAttribute],k.size,m.FLOAT,!1,0,0));0<=b.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglColorBuffer),W.enableAttribute(b.color),m.vertexAttribPointer(b.color,3,m.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&& -m.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglNormalBuffer),W.enableAttribute(b.normal),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));0<=b.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglTangentBuffer),W.enableAttribute(b.tangent),m.vertexAttribPointer(b.tangent,4,m.FLOAT,!1,0,0));0<=b.uv&&(f.geometry.faceVertexUvs[0]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUVBuffer),W.enableAttribute(b.uv),m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,0, -0)):void 0!==d.defaultAttributeValues&&m.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(f.geometry.faceVertexUvs[1]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUV2Buffer),W.enableAttribute(b.uv2),m.vertexAttribPointer(b.uv2,2,m.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&m.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),W.enableAttribute(b.skinIndex),m.vertexAttribPointer(b.skinIndex, -4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),W.enableAttribute(b.skinWeight),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));0<=b.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglLineDistanceBuffer),W.enableAttribute(b.lineDistance),m.vertexAttribPointer(b.lineDistance,1,m.FLOAT,!1,0,0))}W.disableUnusedAttributes();f instanceof THREE.Mesh?(f=e.__typeArray===Uint32Array?m.UNSIGNED_INT:m.UNSIGNED_SHORT,d.wireframe?(W.setLineWidth(d.wireframeLinewidth*H),a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER, -e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,f,0)):(a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,f,0)),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.mode===THREE.LineStrip?m.LINE_STRIP:m.LINES,W.setLineWidth(d.linewidth*H),m.drawArrays(f,0,e.__webglLineCount),B.info.render.calls++):f instanceof THREE.PointCloud&&(m.drawArrays(m.POINTS, -0,e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)THREE.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var g=a.fog;ta="";ub=-1;vb=null;Ob=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);db.multiplyMatrices(b.projectionMatrix, -b.matrixWorldInverse);cb.setFromMatrix(db);ca.length=0;Ka.length=0;Qa.length=0;Xa.length=0;Ya.length=0;h(a);!0===B.sortObjects&&(Ka.sort(e),Qa.sort(f));zc.render(a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var n=qa.length;d<n;d++){var m=qa[d],q=m.object;q.visible&&(w(q,b),p(m))}a.overrideMaterial?(d=a.overrideMaterial,u(d), -k(Ka,b,ca,g,d),k(Qa,b,ca,g,d),l(qa,"",b,ca,g,d)):(W.setBlending(THREE.NoBlending),k(Ka,b,ca,g,null),l(qa,"opaque",b,ca,g,null),k(Qa,b,ca,g,null),l(qa,"transparent",b,ca,g,null));Ac.render(a,b);Bc.render(a,b,Xb,fc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&F(c);W.setDepthTest(!0);W.setDepthWrite(!0);W.setColorWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=v(a,b,c,d,e);ta="";B.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f, -m,cb):e.render(function(a){B.renderBufferImmediate(a,f,d)})};var Ua={},Qb=0,pc={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?m.disable(m.CULL_FACE):(b===THREE.FrontFaceDirectionCW?m.frontFace(m.CW):m.frontFace(m.CCW),a===THREE.CullFaceBack?m.cullFace(m.BACK):a=== -THREE.CullFaceFront?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE))};this.setMaterialFaces=function(a){W.setDoubleSided(a.side===THREE.DoubleSide);W.setFlipSided(a.side===THREE.BackSide)};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",Pb),a.__webglTexture=m.createTexture(),B.info.memory.textures++);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,a.flipY);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL, -a.premultiplyAlpha);m.pixelStorei(m.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=E(a.image,tc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=I(a.format),e=I(a.type);A(m.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=0,h=f.length;g<h;g++)b=f[g],m.texImage2D(m.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g= -0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<kc().indexOf(d)?m.compressedTexImage2D(m.TEXTURE_2D,g,d,b.width,b.height,0,b.data):THREE.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):m.texImage2D(m.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],m.texImage2D(m.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,d,d,e,a.image); -a.generateMipmaps&&c&&m.generateMipmap(m.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};this.setTexture=function(a,b){m.activeTexture(m.TEXTURE0+b);a.needsUpdate?B.uploadTexture(a):m.bindTexture(m.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",oc);a.__webglTexture=m.createTexture(); -B.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=I(a.format),e=I(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);A(m.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER, -a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);G(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),A(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer), -m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):G(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER, -null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=pb,a=qb,d=ib,e=bb);b!==ab&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),ab=b);Xb=c;fc=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(a.__webglFramebuffer)if(a.format!==THREE.RGBAFormat)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format."); -else{var g=!1;a.__webglFramebuffer!==ab&&(m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),g=!0);m.checkFramebufferStatus(m.FRAMEBUFFER)===m.FRAMEBUFFER_COMPLETE?m.readPixels(b,c,d,e,m.RGBA,m.UNSIGNED_BYTE,f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");g&&m.bindFramebuffer(m.FRAMEBUFFER,ab)}};this.initMaterial=function(){THREE.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){THREE.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}; -this.addPostPlugin=function(){THREE.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){THREE.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}; -THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format: -THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=void 0!==c.shareDepthFrom?c.shareDepthFrom:null}; -THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){this.width=a;this.height=b},clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps; -a.shareDepthFrom=this.shareDepthFrom;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube; -THREE.WebGLExtensions=function(a){var b={};this.get=function(c){if(void 0!==b[c])return b[c];var d;switch(c){case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); -break;case "WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:d=a.getExtension(c)}null===d&&THREE.warn("THREE.WebGLRenderer: "+c+" extension not supported.");return b[c]=d}}; -THREE.WebGLProgram=function(){var a=0;return function(b,c,d,e){var f=b.context,g=d.defines,h=d.__webglShader.uniforms,k=d.attributes,l=d.__webglShader.vertexShader,p=d.__webglShader.fragmentShader,q=d.index0AttributeName;void 0===q&&!0===e.morphTargets&&(q="position");var n="SHADOWMAP_TYPE_BASIC";e.shadowMapType===THREE.PCFShadowMap?n="SHADOWMAP_TYPE_PCF":e.shadowMapType===THREE.PCFSoftShadowMap&&(n="SHADOWMAP_TYPE_PCF_SOFT");var t="ENVMAP_TYPE_CUBE",r="ENVMAP_MODE_REFLECTION",s="ENVMAP_BLENDING_MULTIPLY"; -if(e.envMap){switch(d.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:t="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:t="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:t="ENVMAP_TYPE_SPHERE"}switch(d.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:r="ENVMAP_MODE_REFRACTION"}switch(d.combine){case THREE.MultiplyOperation:s="ENVMAP_BLENDING_MULTIPLY"; -break;case THREE.MixOperation:s="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:s="ENVMAP_BLENDING_ADD"}}var u=0<b.gammaFactor?b.gammaFactor:1,v,x;v=[];for(var D in g)x=g[D],!1!==x&&(x="#define "+D+" "+x,v.push(x));v=v.join("\n");g=f.createProgram();d instanceof THREE.RawShaderMaterial?b=d="":(d=["precision "+e.precision+" float;","precision "+e.precision+" int;",v,e.supportsVertexTextures?"#define VERTEX_TEXTURES":"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT": -"","#define GAMMA_FACTOR "+u,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+r:"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP": -"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.useVertexTexture?"#define BONE_TEXTURE":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals?"#define USE_MORPHNORMALS":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+n:"",e.shadowMapDebug? -"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\n\tattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\n\tattribute vec3 morphTarget0;\n\tattribute vec3 morphTarget1;\n\tattribute vec3 morphTarget2;\n\tattribute vec3 morphTarget3;\n\t#ifdef USE_MORPHNORMALS\n\t\tattribute vec3 morphNormal0;\n\t\tattribute vec3 morphNormal1;\n\t\tattribute vec3 morphNormal2;\n\t\tattribute vec3 morphNormal3;\n\t#else\n\t\tattribute vec3 morphTarget4;\n\t\tattribute vec3 morphTarget5;\n\t\tattribute vec3 morphTarget6;\n\t\tattribute vec3 morphTarget7;\n\t#endif\n#endif\n#ifdef USE_SKINNING\n\tattribute vec4 skinIndex;\n\tattribute vec4 skinWeight;\n#endif\n"].join("\n"), -b=["precision "+e.precision+" float;","precision "+e.precision+" int;",e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",v,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+ -u,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+t:"",e.envMap?"#define "+r:"",e.envMap?"#define "+s:"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.flatShading?"#define FLAT_SHADED":"",e.metal?"#define METAL": -"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+n:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"));l=new THREE.WebGLShader(f,f.VERTEX_SHADER,d+l);p=new THREE.WebGLShader(f,f.FRAGMENT_SHADER, -b+p);f.attachShader(g,l);f.attachShader(g,p);void 0!==q&&f.bindAttribLocation(g,0,q);f.linkProgram(g);q=f.getProgramInfoLog(g);!1===f.getProgramParameter(g,f.LINK_STATUS)&&THREE.error("THREE.WebGLProgram: shader error: "+f.getError(),"gl.VALIDATE_STATUS",f.getProgramParameter(g,f.VALIDATE_STATUS),"gl.getPRogramInfoLog",q);""!==q&&THREE.warn("THREE.WebGLProgram: gl.getProgramInfoLog()"+q);f.deleteShader(l);f.deleteShader(p);q="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences bindMatrix bindMatrixInverse".split(" "); -e.useVertexTexture?(q.push("boneTexture"),q.push("boneTextureWidth"),q.push("boneTextureHeight")):q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&q.push("logDepthBufFC");for(var w in h)q.push(w);h=q;w={};q=0;for(b=h.length;q<b;q++)n=h[q],w[n]=f.getUniformLocation(g,n);this.uniforms=w;q="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(h=0;h<e.maxMorphTargets;h++)q.push("morphTarget"+h);for(h=0;h<e.maxMorphNormals;h++)q.push("morphNormal"+h);for(var y in k)q.push(y); -e=q;k={};y=0;for(h=e.length;y<h;y++)w=e[y],k[w]=f.getAttribLocation(g,w);this.attributes=k;this.attributesKeys=Object.keys(this.attributes);this.id=a++;this.code=c;this.usedTimes=1;this.program=g;this.vertexShader=l;this.fragmentShader=p;return this}}(); -THREE.WebGLShader=function(){var a=function(a){a=a.split("\n");for(var c=0;c<a.length;c++)a[c]=c+1+": "+a[c];return a.join("\n")};return function(b,c,d){c=b.createShader(c);b.shaderSource(c,d);b.compileShader(c);!1===b.getShaderParameter(c,b.COMPILE_STATUS)&&THREE.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(c)&&THREE.warn("THREE.WebGLShader: gl.getShaderInfoLog()",b.getShaderInfoLog(c),a(d));return c}}(); -THREE.WebGLState=function(a,b){var c=new Uint8Array(16),d=new Uint8Array(16),e=null,f=null,g=null,h=null,k=null,l=null,p=null,q=null,n=null,t=null,r=null,s=null,u=null,v=null,x=null,D=null;this.initAttributes=function(){for(var a=0,b=c.length;a<b;a++)c[a]=0};this.enableAttribute=function(b){c[b]=1;0===d[b]&&(a.enableVertexAttribArray(b),d[b]=1)};this.disableUnusedAttributes=function(){for(var b=0,e=d.length;b<e;b++)d[b]!==c[b]&&(a.disableVertexAttribArray(b),d[b]=0)};this.setBlending=function(c,d, -n,q,r,s,t){c!==e&&(c===THREE.NoBlending?a.disable(a.BLEND):c===THREE.AdditiveBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):c===THREE.SubtractiveBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):c===THREE.MultiplyBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):c===THREE.CustomBlending?a.enable(a.BLEND):(a.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD), -a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),e=c);if(c===THREE.CustomBlending){r=r||d;s=s||n;t=t||q;if(d!==f||r!==k)a.blendEquationSeparate(b(d),b(r)),f=d,k=r;if(n!==g||q!==h||s!==l||t!==p)a.blendFuncSeparate(b(n),b(q),b(s),b(t)),g=n,h=q,l=s,p=t}else p=l=k=h=g=f=null};this.setDepthTest=function(b){q!==b&&(b?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),q=b)};this.setDepthWrite=function(b){n!==b&&(a.depthMask(b),n=b)};this.setColorWrite=function(b){t!==b&&(a.colorMask(b, -b,b,b),t=b)};this.setDoubleSided=function(b){r!==b&&(b?a.disable(a.CULL_FACE):a.enable(a.CULL_FACE),r=b)};this.setFlipSided=function(b){s!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),s=b)};this.setLineWidth=function(b){b!==u&&(a.lineWidth(b),u=b)};this.setPolygonOffset=function(b,c,d){v!==b&&(b?a.enable(a.POLYGON_OFFSET_FILL):a.disable(a.POLYGON_OFFSET_FILL),v=b);!b||x===c&&D===d||(a.polygonOffset(c,d),x=c,D=d)};this.reset=function(){for(var a=0;a<d.length;a++)d[a]=0;s=r=t=n=q=e=null}}; -THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,l,p,q,n=a.context,t,r,s,u,v,x;this.render=function(D,w,y,A){if(0!==b.length){D=new THREE.Vector3;var E=A/y,G=.5*y,F=.5*A,z=16/A,I=new THREE.Vector2(z*E,z),U=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1);if(void 0===s){var z=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),H=new Uint16Array([0,1,2,0,2,3]);t=n.createBuffer();r=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,t);n.bufferData(n.ARRAY_BUFFER,z,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, -r);n.bufferData(n.ELEMENT_ARRAY_BUFFER,H,n.STATIC_DRAW);v=n.createTexture();x=n.createTexture();n.bindTexture(n.TEXTURE_2D,v);n.texImage2D(n.TEXTURE_2D,0,n.RGB,16,16,0,n.RGB,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);n.bindTexture(n.TEXTURE_2D,x);n.texImage2D(n.TEXTURE_2D,0, -n.RGBA,16,16,0,n.RGBA,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);var z=(u=0<n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}", -fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}", -fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}, -H=n.createProgram(),L=n.createShader(n.FRAGMENT_SHADER),P=n.createShader(n.VERTEX_SHADER),N="precision "+a.getPrecision()+" float;\n";n.shaderSource(L,N+z.fragmentShader);n.shaderSource(P,N+z.vertexShader);n.compileShader(L);n.compileShader(P);n.attachShader(H,L);n.attachShader(H,P);n.linkProgram(H);s=H;p=n.getAttribLocation(s,"position");q=n.getAttribLocation(s,"uv");c=n.getUniformLocation(s,"renderType");d=n.getUniformLocation(s,"map");e=n.getUniformLocation(s,"occlusionMap");f=n.getUniformLocation(s, -"opacity");g=n.getUniformLocation(s,"color");h=n.getUniformLocation(s,"scale");k=n.getUniformLocation(s,"rotation");l=n.getUniformLocation(s,"screenPosition")}n.useProgram(s);n.enableVertexAttribArray(p);n.enableVertexAttribArray(q);n.uniform1i(e,0);n.uniform1i(d,1);n.bindBuffer(n.ARRAY_BUFFER,t);n.vertexAttribPointer(p,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(q,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,r);n.disable(n.CULL_FACE);n.depthMask(!1);H=0;for(L=b.length;H<L;H++)if(z=16/A,I.set(z* -E,z),P=b[H],D.set(P.matrixWorld.elements[12],P.matrixWorld.elements[13],P.matrixWorld.elements[14]),D.applyMatrix4(w.matrixWorldInverse),D.applyProjection(w.projectionMatrix),U.copy(D),M.x=U.x*G+G,M.y=U.y*F+F,u||0<M.x&&M.x<y&&0<M.y&&M.y<A){n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,v);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGB,M.x-8,M.y-8,16,16,0);n.uniform1i(c,0);n.uniform2f(h,I.x,I.y);n.uniform3f(l,U.x,U.y,U.z);n.disable(n.BLEND);n.enable(n.DEPTH_TEST);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT, -0);n.activeTexture(n.TEXTURE0);n.bindTexture(n.TEXTURE_2D,x);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGBA,M.x-8,M.y-8,16,16,0);n.uniform1i(c,1);n.disable(n.DEPTH_TEST);n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,v);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);P.positionScreen.copy(U);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares();n.uniform1i(c,2);n.enable(n.BLEND);for(var N=0,R=P.lensFlares.length;N<R;N++){var V=P.lensFlares[N];.001<V.opacity&&.001<V.scale&&(U.x=V.x, -U.y=V.y,U.z=V.z,z=V.size*V.scale/A,I.x=z*E,I.y=z,n.uniform3f(l,U.x,U.y,U.z),n.uniform2f(h,I.x,I.y),n.uniform1f(k,V.rotation),n.uniform1f(f,V.opacity),n.uniform3f(g,V.color.r,V.color.g,V.color.b),a.state.setBlending(V.blending,V.blendEquation,V.blendSrc,V.blendDst),a.setTexture(V.texture,1),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0))}}n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(!0);a.resetGLState()}}}; -THREE.ShadowMapPlugin=function(a,b,c,d){function e(a,b,d){if(b.visible){var f=c[b.id];if(f&&b.castShadow&&(!1===b.frustumCulled||!0===p.intersectsObject(b)))for(var g=0,h=f.length;g<h;g++){var k=f[g];b._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,b.matrixWorld);s.push(k)}g=0;for(h=b.children.length;g<h;g++)e(a,b.children[g],d)}}var f=a.context,g,h,k,l,p=new THREE.Frustum,q=new THREE.Matrix4,n=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,s=[],u=THREE.ShaderLib.depthRGBA,v=THREE.UniformsUtils.clone(u.uniforms); -g=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader});h=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0});k=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,skinning:!0});l=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0,skinning:!0});g._shadowPass=!0;h._shadowPass=!0;k._shadowPass= -!0;l._shadowPass=!0;this.render=function(c,v){if(!1!==a.shadowMapEnabled){var u,y,A,E,G,F,z,I,U=[];E=0;f.clearColor(1,1,1,1);f.disable(f.BLEND);f.enable(f.CULL_FACE);f.frontFace(f.CCW);a.shadowMapCullFace===THREE.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK);a.state.setDepthTest(!0);u=0;for(y=b.length;u<y;u++)if(A=b[u],A.castShadow)if(A instanceof THREE.DirectionalLight&&A.shadowCascade)for(G=0;G<A.shadowCascadeCount;G++){var M;if(A.shadowCascadeArray[G])M=A.shadowCascadeArray[G];else{z=A; -var H=G;M=new THREE.DirectionalLight;M.isVirtual=!0;M.onlyShadow=!0;M.castShadow=!0;M.shadowCameraNear=z.shadowCameraNear;M.shadowCameraFar=z.shadowCameraFar;M.shadowCameraLeft=z.shadowCameraLeft;M.shadowCameraRight=z.shadowCameraRight;M.shadowCameraBottom=z.shadowCameraBottom;M.shadowCameraTop=z.shadowCameraTop;M.shadowCameraVisible=z.shadowCameraVisible;M.shadowDarkness=z.shadowDarkness;M.shadowBias=z.shadowCascadeBias[H];M.shadowMapWidth=z.shadowCascadeWidth[H];M.shadowMapHeight=z.shadowCascadeHeight[H]; -M.pointsWorld=[];M.pointsFrustum=[];I=M.pointsWorld;F=M.pointsFrustum;for(var L=0;8>L;L++)I[L]=new THREE.Vector3,F[L]=new THREE.Vector3;I=z.shadowCascadeNearZ[H];z=z.shadowCascadeFarZ[H];F[0].set(-1,-1,I);F[1].set(1,-1,I);F[2].set(-1,1,I);F[3].set(1,1,I);F[4].set(-1,-1,z);F[5].set(1,-1,z);F[6].set(-1,1,z);F[7].set(1,1,z);M.originalCamera=v;F=new THREE.Gyroscope;F.position.copy(A.shadowCascadeOffset);F.add(M);F.add(M.target);v.add(F);A.shadowCascadeArray[G]=M}H=A;I=G;z=H.shadowCascadeArray[I];z.position.copy(H.position); -z.target.position.copy(H.target.position);z.lookAt(z.target);z.shadowCameraVisible=H.shadowCameraVisible;z.shadowDarkness=H.shadowDarkness;z.shadowBias=H.shadowCascadeBias[I];F=H.shadowCascadeNearZ[I];H=H.shadowCascadeFarZ[I];z=z.pointsFrustum;z[0].z=F;z[1].z=F;z[2].z=F;z[3].z=F;z[4].z=H;z[5].z=H;z[6].z=H;z[7].z=H;U[E]=M;E++}else U[E]=A,E++;u=0;for(y=U.length;u<y;u++){A=U[u];A.shadowMap||(G=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&(G=THREE.NearestFilter),A.shadowMap=new THREE.WebGLRenderTarget(A.shadowMapWidth, -A.shadowMapHeight,{minFilter:G,magFilter:G,format:THREE.RGBAFormat}),A.shadowMapSize=new THREE.Vector2(A.shadowMapWidth,A.shadowMapHeight),A.shadowMatrix=new THREE.Matrix4);if(!A.shadowCamera){if(A instanceof THREE.SpotLight)A.shadowCamera=new THREE.PerspectiveCamera(A.shadowCameraFov,A.shadowMapWidth/A.shadowMapHeight,A.shadowCameraNear,A.shadowCameraFar);else if(A instanceof THREE.DirectionalLight)A.shadowCamera=new THREE.OrthographicCamera(A.shadowCameraLeft,A.shadowCameraRight,A.shadowCameraTop, -A.shadowCameraBottom,A.shadowCameraNear,A.shadowCameraFar);else{THREE.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",A);continue}c.add(A.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld()}A.shadowCameraVisible&&!A.cameraHelper&&(A.cameraHelper=new THREE.CameraHelper(A.shadowCamera),c.add(A.cameraHelper));if(A.isVirtual&&M.originalCamera==v){G=v;E=A.shadowCamera;F=A.pointsFrustum;z=A.pointsWorld;n.set(Infinity,Infinity,Infinity);t.set(-Infinity,-Infinity,-Infinity);for(H=0;8> -H;H++)I=z[H],I.copy(F[H]),I.unproject(G),I.applyMatrix4(E.matrixWorldInverse),I.x<n.x&&(n.x=I.x),I.x>t.x&&(t.x=I.x),I.y<n.y&&(n.y=I.y),I.y>t.y&&(t.y=I.y),I.z<n.z&&(n.z=I.z),I.z>t.z&&(t.z=I.z);E.left=n.x;E.right=t.x;E.top=t.y;E.bottom=n.y;E.updateProjectionMatrix()}E=A.shadowMap;F=A.shadowMatrix;G=A.shadowCamera;G.position.setFromMatrixPosition(A.matrixWorld);r.setFromMatrixPosition(A.target.matrixWorld);G.lookAt(r);G.updateMatrixWorld();G.matrixWorldInverse.getInverse(G.matrixWorld);A.cameraHelper&& -(A.cameraHelper.visible=A.shadowCameraVisible);A.shadowCameraVisible&&A.cameraHelper.update();F.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);F.multiply(G.projectionMatrix);F.multiply(G.matrixWorldInverse);q.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(E);a.clear();s.length=0;e(c,c,G);A=0;for(E=s.length;A<E;A++)z=s[A],F=z.object,z=z.buffer,H=F.material instanceof THREE.MeshFaceMaterial?F.material.materials[0]:F.material,I=void 0!==F.geometry.morphTargets&& -0<F.geometry.morphTargets.length&&H.morphTargets,L=F instanceof THREE.SkinnedMesh&&H.skinning,I=F.customDepthMaterial?F.customDepthMaterial:L?I?l:k:I?h:g,a.setMaterialFaces(H),z instanceof THREE.BufferGeometry?a.renderBufferDirect(G,b,null,I,z,F):a.renderBuffer(G,b,null,I,z,F);A=0;for(E=d.length;A<E;A++)z=d[A],F=z.object,F.visible&&F.castShadow&&(F._modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,F.matrixWorld),a.renderImmediateObject(G,b,null,g,F))}u=a.getClearColor();y=a.getClearAlpha();f.clearColor(u.r, -u.g,u.b,y);f.enable(f.BLEND);a.shadowMapCullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState()}}}; -THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,l,p,q,n,t,r,s,u,v,x;function D(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var w=a.context,y,A,E,G,F=new THREE.Vector3,z=new THREE.Quaternion,I=new THREE.Vector3;this.render=function(U,M){if(0!==b.length){if(void 0===E){var H=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),L=new Uint16Array([0,1,2,0,2,3]);y=w.createBuffer();A=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,y);w.bufferData(w.ARRAY_BUFFER,H,w.STATIC_DRAW);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER, -A);w.bufferData(w.ELEMENT_ARRAY_BUFFER,L,w.STATIC_DRAW);var H=w.createProgram(),L=w.createShader(w.VERTEX_SHADER),P=w.createShader(w.FRAGMENT_SHADER);w.shaderSource(L,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")); -w.shaderSource(P,["precision "+a.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); -w.compileShader(L);w.compileShader(P);w.attachShader(H,L);w.attachShader(H,P);w.linkProgram(H);E=H;v=w.getAttribLocation(E,"position");x=w.getAttribLocation(E,"uv");c=w.getUniformLocation(E,"uvOffset");d=w.getUniformLocation(E,"uvScale");e=w.getUniformLocation(E,"rotation");f=w.getUniformLocation(E,"scale");g=w.getUniformLocation(E,"color");h=w.getUniformLocation(E,"map");k=w.getUniformLocation(E,"opacity");l=w.getUniformLocation(E,"modelViewMatrix");p=w.getUniformLocation(E,"projectionMatrix");q= -w.getUniformLocation(E,"fogType");n=w.getUniformLocation(E,"fogDensity");t=w.getUniformLocation(E,"fogNear");r=w.getUniformLocation(E,"fogFar");s=w.getUniformLocation(E,"fogColor");u=w.getUniformLocation(E,"alphaTest");H=document.createElement("canvas");H.width=8;H.height=8;L=H.getContext("2d");L.fillStyle="white";L.fillRect(0,0,8,8);G=new THREE.Texture(H);G.needsUpdate=!0}w.useProgram(E);w.enableVertexAttribArray(v);w.enableVertexAttribArray(x);w.disable(w.CULL_FACE);w.enable(w.BLEND);w.bindBuffer(w.ARRAY_BUFFER, -y);w.vertexAttribPointer(v,2,w.FLOAT,!1,16,0);w.vertexAttribPointer(x,2,w.FLOAT,!1,16,8);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,A);w.uniformMatrix4fv(p,!1,M.projectionMatrix.elements);w.activeTexture(w.TEXTURE0);w.uniform1i(h,0);L=H=0;(P=U.fog)?(w.uniform3f(s,P.color.r,P.color.g,P.color.b),P instanceof THREE.Fog?(w.uniform1f(t,P.near),w.uniform1f(r,P.far),w.uniform1i(q,1),L=H=1):P instanceof THREE.FogExp2&&(w.uniform1f(n,P.density),w.uniform1i(q,2),L=H=2)):(w.uniform1i(q,0),L=H=0);for(var P=0,N=b.length;P< -N;P++){var R=b[P];R._modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,R.matrixWorld);R.z=-R._modelViewMatrix.elements[14]}b.sort(D);for(var V=[],P=0,N=b.length;P<N;P++){var R=b[P],J=R.material;w.uniform1f(u,J.alphaTest);w.uniformMatrix4fv(l,!1,R._modelViewMatrix.elements);R.matrixWorld.decompose(F,z,I);V[0]=I.x;V[1]=I.y;R=0;U.fog&&J.fog&&(R=L);H!==R&&(w.uniform1i(q,R),H=R);null!==J.map?(w.uniform2f(c,J.map.offset.x,J.map.offset.y),w.uniform2f(d,J.map.repeat.x,J.map.repeat.y)):(w.uniform2f(c, -0,0),w.uniform2f(d,1,1));w.uniform1f(k,J.opacity);w.uniform3f(g,J.color.r,J.color.g,J.color.b);w.uniform1f(e,J.rotation);w.uniform2fv(f,V);a.state.setBlending(J.blending,J.blendEquation,J.blendSrc,J.blendDst);a.state.setDepthTest(J.depthTest);a.state.setDepthWrite(J.depthWrite);J.map&&J.map.image&&J.map.image.width?a.setTexture(J.map,0):a.setTexture(G,0);w.drawElements(w.TRIANGLES,6,w.UNSIGNED_SHORT,0)}w.enable(w.CULL_FACE);a.resetGLState()}}}; -THREE.GeometryUtils={merge:function(a,b,c){THREE.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry);a.merge(b,d,c)},center:function(a){THREE.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return a.center()}}; -THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var f=new THREE.Texture(void 0,b);e.load(a,function(a){f.image=a;f.needsUpdate=!0;c&&c(f)},void 0,function(a){d&&d(a)});f.sourceFile=a;return f},loadTextureCube:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var f=new THREE.CubeTexture([],b);f.flipY=!1;var g=0;b=function(b){e.load(a[b],function(a){f.images[b]=a;g+=1;6===g&&(f.needsUpdate=!0,c&& -c(f))},void 0,d)};for(var h=0,k=a.length;h<k;++h)b(h);return f},loadCompressedTexture:function(){THREE.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){THREE.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,f=document.createElement("canvas"); -f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,e),l=k.data,p=0;p<d;p++)for(var q=0;q<e;q++){var n=0>q-1?0:q-1,t=q+1>e-1?e-1:q+1,r=0>p-1?0:p-1,s=p+1>d-1?d-1:p+1,u=[],v=[0,0,h[4*(q*d+p)]/255*b];u.push([-1,0,h[4*(q*d+r)]/255*b]);u.push([-1,-1,h[4*(n*d+r)]/255*b]);u.push([0,-1,h[4*(n*d+p)]/255*b]);u.push([1,-1,h[4*(n*d+s)]/255*b]);u.push([1,0,h[4*(q*d+s)]/255*b]);u.push([1,1,h[4*(t*d+s)]/255*b]);u.push([0,1,h[4*(t*d+p)]/255* -b]);u.push([-1,1,h[4*(t*d+r)]/255*b]);n=[];r=u.length;for(t=0;t<r;t++){var s=u[t],x=u[(t+1)%r],s=[s[0]-v[0],s[1]-v[1],s[2]-v[2]],x=[x[0]-v[0],x[1]-v[1],x[2]-v[2]];n.push(c([s[1]*x[2]-s[2]*x[1],s[2]*x[0]-s[0]*x[2],s[0]*x[1]-s[1]*x[0]]))}u=[0,0,0];for(t=0;t<n.length;t++)u[0]+=n[t][0],u[1]+=n[t][1],u[2]+=n[t][2];u[0]/=n.length;u[1]/=n.length;u[2]/=n.length;v=4*(q*d+p);l[v]=(u[0]+1)/2*255|0;l[v+1]=(u[1]+1)/2*255|0;l[v+2]=255*u[2]|0;l[v+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a, -b,c){var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}}; -THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}}; -THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][this.weight][this.style]}catch(a){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing.";}},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]= -a},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,k,l,p,q,n,t,r,s,u,v=b.glyphs[a]||b.glyphs["?"];if(v){if(v.o)for(b=v._cachedOutline||(v._cachedOutline=v.o.split(" ")),l=b.length,a=0;a<l;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;p=b[a++]*c;e.moveTo(k,p); -break;case "l":k=b[a++]*c+d;p=b[a++]*c;e.lineTo(k,p);break;case "q":k=b[a++]*c+d;p=b[a++]*c;t=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(t,r,k,p);if(g=f[f.length-1])for(q=g.x,n=g.y,g=1,h=this.divisions;g<=h;g++){var x=g/h;THREE.Shape.Utils.b2(x,q,t,k);THREE.Shape.Utils.b2(x,n,r,p)}break;case "b":if(k=b[a++]*c+d,p=b[a++]*c,t=b[a++]*c+d,r=b[a++]*c,s=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(t,r,s,u,k,p),g=f[f.length-1])for(q=g.x,n=g.y,g=1,h=this.divisions;g<=h;g++)x=g/h,THREE.Shape.Utils.b3(x,q,t,s,k),THREE.Shape.Utils.b3(x, -n,r,u,p)}return{offset:v.ha*c,path:e}}}}; -THREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d}; -(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,l,p;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var q=2*e;for(l=e-1;2<e;){if(0>=q--){THREE.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);p=l+1;e<=p&&(p=0);var n;a:{var t=n=void 0,r=void 0,s=void 0, -u=void 0,v=void 0,x=void 0,D=void 0,w=void 0,t=a[g[k]].x,r=a[g[k]].y,s=a[g[l]].x,u=a[g[l]].y,v=a[g[p]].x,x=a[g[p]].y;if(1E-10>(s-t)*(x-r)-(u-r)*(v-t))n=!1;else{var y=void 0,A=void 0,E=void 0,G=void 0,F=void 0,z=void 0,I=void 0,U=void 0,M=void 0,H=void 0,M=U=I=w=D=void 0,y=v-s,A=x-u,E=t-v,G=r-x,F=s-t,z=u-r;for(n=0;n<e;n++)if(D=a[g[n]].x,w=a[g[n]].y,!(D===t&&w===r||D===s&&w===u||D===v&&w===x)&&(I=D-t,U=w-r,M=D-s,H=w-u,D-=v,w-=x,M=y*H-A*M,I=F*U-z*I,U=E*w-G*D,-1E-10<=M&&-1E-10<=U&&-1E-10<=I)){n=!1;break a}n= -!0}}if(n){f.push([a[g[k]],a[g[l]],a[g[p]]]);h.push([g[k],g[l],g[p]]);k=l;for(p=l+1;p<e;k++,p++)g[k]=g[p];e--;q=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js; -THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.source.onended=this.onEnded.bind(this);this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain);this.autoplay=!1;this.startTime=0;this.isPlaying=!1};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);THREE.Audio.prototype.constructor=THREE.Audio; -THREE.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a;b.autoplay&&b.play()})};c.send();return this}; -THREE.Audio.prototype.play=function(){if(!0===this.isPlaying)THREE.warn("THREE.Audio: Audio is already playing.");else{var a=this.context.createBufferSource();a.buffer=this.source.buffer;a.loop=this.source.loop;a.onended=this.source.onended;a.connect(this.panner);a.start(0,this.startTime);this.isPlaying=!0;this.source=a}};THREE.Audio.prototype.pause=function(){this.source.stop();this.startTime=this.context.currentTime};THREE.Audio.prototype.stop=function(){this.source.stop();this.startTime=0}; -THREE.Audio.prototype.onEnded=function(){this.isPlaying=!1};THREE.Audio.prototype.setLoop=function(a){this.source.loop=a};THREE.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};THREE.Audio.prototype.setVolume=function(a){this.gain.gain.value=a}; -THREE.Audio.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3;return function(b){THREE.Object3D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}}();THREE.AudioListener=function(){THREE.Object3D.call(this);this.type="AudioListener";this.context=new (window.AudioContext||window.webkitAudioContext)};THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype);THREE.AudioListener.prototype.constructor=THREE.AudioListener; -THREE.AudioListener.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g){THREE.Object3D.prototype.updateMatrixWorld.call(this,g);g=this.context.listener;var h=this.up;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.subVectors(a,f);g.setPosition(a.x,a.y,a.z);g.setOrientation(d.x,d.y,d.z,h.x,h.y,h.z);g.setVelocity(e.x,e.y,e.z);f.copy(a)}}(); -THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(a){THREE.warn("THREE.Curve: Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c}; -THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b}; -THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,k;g<=h;)if(d=Math.floor(g+(h-g)/2),k=c[d]-f,0>k)g=d+1;else if(0<k)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()}; -THREE.Curve.prototype.getTangentAt=function(a){a=this.getUtoTmapping(a);return this.getTangent(a)}; -THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a,b,c,d,e){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){a=.5*(c-a);d=.5*(d-b);var f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}}; -THREE.Curve.create=function(a,b){a.prototype=Object.create(THREE.Curve.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){}; -THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){var b=a*this.getLength(),c=this.getCurveLengths();for(a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]}; -THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a}; -THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,k,l,p,q=a[0]instanceof THREE.Vector3;p=q?new THREE.Vector3:new THREE.Vector2;k=0;for(l=a.length;k<l;k++)h=a[k],h.x>b?b=h.x:h.x<e&&(e=h.x),h.y>c?c=h.y:h.y<f&&(f=h.y),q&&(h.z>d?d=h.z:h.z<g&&(g=h.z)),p.add(h);a={minX:e,minY:f,maxX:b,maxY:c};q&&(a.maxZ=d,a.minZ=g);return a}; -THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)}; -THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c}; -THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,k;d=0;for(e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,k=g/c.maxX,k=b.getUtoTmapping(k,g),g=b.getPoint(k),k=b.getTangent(k),k.set(-k.y,k.x).multiplyScalar(h),f.x=g.x+k.x,f.y=g.y+k.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);THREE.Gyroscope.prototype.constructor=THREE.Gyroscope; -THREE.Gyroscope.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Quaternion,f=new THREE.Vector3;return function(g){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||g)this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(d,e,f),this.matrix.decompose(a,b,c),this.matrixWorld.compose(d,b,f)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate= -!1,g=!0;for(var h=0,k=this.children.length;h<k;h++)this.children[h].updateMatrixWorld(g)}}();THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.Path.prototype.constructor=THREE.Path;THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"}; -THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})}; -THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args,d=new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,b));this.curves.push(d);this.actions.push({action:THREE.PathActions.LINE_TO,args:c})}; -THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d));this.curves.push(f);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})}; -THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f));this.curves.push(h);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})}; -THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)}; -THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),k=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(k);k=k.getPoint(1);h.push(k.x);h.push(k.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})}; -THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<a;d++)c.push(this.getPoint(d/a));return c}; -THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,f,g,h,k,l,p,q,n,t,r,s;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];k=f[3];q=f[0];n=f[1];0<c.length?(g=c[c.length-1],t=g.x, -r=g.y):(g=this.actions[d-1].args,t=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)s=f/a,g=THREE.Shape.Utils.b2(s,t,q,h),s=THREE.Shape.Utils.b2(s,r,n,k),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];k=f[5];q=f[0];n=f[1];l=f[2];p=f[3];0<c.length?(g=c[c.length-1],t=g.x,r=g.y):(g=this.actions[d-1].args,t=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)s=f/a,g=THREE.Shape.Utils.b3(s,t,q,l,h),s=THREE.Shape.Utils.b3(s,r,n,p,k),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.CSPLINE_THRU:g= -this.actions[d-1].args;s=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;s=s.concat(f[0]);s=new THREE.SplineCurve(s);for(f=1;f<=g;f++)c.push(s.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];k=f[1];n=f[2];l=f[3];g=f[4];q=!!f[5];t=g-l;r=2*a;for(f=1;f<=r;f++)s=f/r,q||(s=1-s),s=l+s*t,g=h+n*Math.cos(s),s=k+n*Math.sin(s),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.ELLIPSE:for(h=f[0],k=f[1],n=f[2],p=f[3],l=f[4],g=f[5],q=!!f[6],t=g-l,r=2*a,f=1;f<=r;f++)s=f/r,q|| -(s=1-s),s=l+s*t,g=h+n*Math.cos(s),s=k+p*Math.sin(s),c.push(new THREE.Vector2(g,s))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; -THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new THREE.Shape;f.actions=e.actions;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,n=h.y-g.y;if(1E-10<Math.abs(n)){if(0>n&&(g=b[f],k=-k,h=b[e],n=-n),!(a.y<g.y||a.y>h.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=n*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<= -h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;b<c;b++)d=a[b],e=d.args,d=d.action,d==THREE.PathActions.MOVE_TO&&0!=g.actions.length&&(f.push(g),g=new THREE.Path),g[d].apply(g,e);0!=g.actions.length&&f.push(g);return f}(this.actions);if(0==e.length)return[];if(!0===b)return c(e);var f,g,h,k=[];if(1==e.length)return g=e[0],h=new THREE.Shape,h.actions=g.actions,h.curves=g.curves,k.push(h),k;var l=!THREE.Shape.Utils.isClockWise(e[0].getPoints()),l=a?!l:l; -h=[];var p=[],q=[],n=0,t;p[n]=void 0;q[n]=[];var r,s;r=0;for(s=e.length;r<s;r++)g=e[r],t=g.getPoints(),f=THREE.Shape.Utils.isClockWise(t),(f=a?!f:f)?(!l&&p[n]&&n++,p[n]={s:new THREE.Shape,p:t},p[n].s.actions=g.actions,p[n].s.curves=g.curves,l&&n++,q[n]=[]):q[n].push({h:g,p:t[0]});if(!p[0])return c(e);if(1<p.length){r=!1;s=[];g=0;for(e=p.length;g<e;g++)h[g]=[];g=0;for(e=p.length;g<e;g++)for(f=q[g],l=0;l<f.length;l++){n=f[l];t=!0;for(var u=0;u<p.length;u++)d(n.p,p[u].p)&&(g!=u&&s.push({froms:g,tos:u, -hole:l}),t?(t=!1,h[u].push(n)):r=!0);t&&h[g].push(n)}0<s.length&&(r||(q=h))}r=0;for(s=p.length;r<s;r++)for(h=p[r].s,k.push(h),g=q[r],e=0,f=g.length;e<f;e++)h.holes.push(g[e].h);return k};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.constructor=THREE.Shape;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)}; -THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d}; -THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}}; -THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,p=a.x-d.x,q=a.y-d.y,E=h*k-g*l,G=h*p-g*q;if(1E-10<Math.abs(E)){if(0<E){if(0>G||G>E)return[];k=l*p-k*q;if(0>k||k>E)return[]}else{if(0<G||G<E)return[];k=l*p-k*q;if(0<k||k<E)return[]}if(0==k)return!f||0!=G&&G!=E?[a]:[];if(k==E)return!f||0!=G&&G!=E?[b]:[];if(0==G)return[d]; -if(G==E)return[e];f=k/E;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=G||l*p!=k*q)return[];h=0==g&&0==h;k=0==k&&0==l;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,E=d.x,l=e,d=e.x):(b=e,E=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,E=d.y,l=e,d=e.y):(b=e,E=e.y,l=d,d=d.y));return k<=E?a<E?[]:a==E?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]: -[g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10<Math.abs(a)?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var f,g,h,k,l,p={};h=a.concat();f=0;for(g=b.length;f<g;f++)Array.prototype.push.apply(h,b[f]);f=0;for(g=h.length;f<g;f++)l=h[f].x+":"+h[f].y,void 0!==p[l]&&THREE.warn("THREE.Shape: Duplicate point",l),p[l]=f;f=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]); -if(!d)return!1;d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],p,q,A,E,G,F=[],z,I,U,M=0;for(p=b.length;M<p;M++)l.push(M);z=0;for(var H=2*l.length;0<l.length;){H--;if(0> -H){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(q=z;q<h.length;q++){A=h[q];p=-1;for(M=0;M<l.length;M++)if(E=l[M],G=A.x+":"+A.y+":"+E,void 0===F[G]){k=b[E];for(I=0;I<k.length;I++)if(E=k[I],c(q,I)&&!f(A,E)&&!g(A,E)){p=I;l.splice(M,1);z=h.slice(0,q+1);E=h.slice(q);I=k.slice(p);U=k.slice(0,p+1);h=z.concat(I).concat(U).concat(E);z=q;break}if(0<=p)break;F[G]=!0}if(0<=p)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(k= -q[f],h=0;3>h;h++)l=k[h].x+":"+k[h].y,l=p[l],void 0!==l&&(k[h]=l);return q.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a* -a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)}; -THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; -THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return b};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b=new THREE.Vector2;b.x=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);return b.normalize()}; -THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)}; -THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.SplineCurve=function(a){this.points=void 0==a?[]:a};THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; -THREE.SplineCurve.prototype.getPoint=function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=new THREE.Vector2;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);return c};THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g}; -THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.constructor=THREE.EllipseCurve;THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;0>b&&(b+=2*Math.PI);b>2*Math.PI&&(b-=2*Math.PI);a=!0===this.aClockwise?this.aEndAngle+(1-a)*(2*Math.PI-b):this.aStartAngle+a*b;b=new THREE.Vector2;b.x=this.aX+this.xRadius*Math.cos(a);b.y=this.aY+this.yRadius*Math.sin(a);return b}; -THREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype);THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b}); -THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b=new THREE.Vector3;b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);b.z=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return b}); -THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b=new THREE.Vector3;b.x=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b.y=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b.z=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return b}); -THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=new THREE.Vector3;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);c.z=THREE.Curve.Utils.interpolate(d.z,e.z,f.z,b.z,a);return c}); -THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-0;var c=Math.floor(a);a-=c;var c=c+(0<c?0:(Math.floor(Math.abs(c)/b.length)+1)*b.length),d=b[(c-1)%b.length],e=b[c%b.length],f=b[(c+1)%b.length],b=b[(c+2)%b.length],c=new THREE.Vector3;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);c.z=THREE.Curve.Utils.interpolate(d.z,e.z,f.z,b.z,a);return c}); -THREE.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){THREE.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){THREE.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){THREE.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(a){if(!0===a.initialized)return a;for(var b=0;b<a.hierarchy.length;b++){for(var c=0;c<a.hierarchy[b].keys.length;c++)if(0>a.hierarchy[b].keys[c].time&&(a.hierarchy[b].keys[c].time= -0),void 0!==a.hierarchy[b].keys[c].rot&&!(a.hierarchy[b].keys[c].rot instanceof THREE.Quaternion)){var d=a.hierarchy[b].keys[c].rot;a.hierarchy[b].keys[c].rot=(new THREE.Quaternion).fromArray(d)}if(a.hierarchy[b].keys.length&&void 0!==a.hierarchy[b].keys[0].morphTargets){d={};for(c=0;c<a.hierarchy[b].keys.length;c++)for(var e=0;e<a.hierarchy[b].keys[c].morphTargets.length;e++){var f=a.hierarchy[b].keys[c].morphTargets[e];d[f]=-1}a.hierarchy[b].usedMorphTargets=d;for(c=0;c<a.hierarchy[b].keys.length;c++){var g= -{};for(f in d){for(e=0;e<a.hierarchy[b].keys[c].morphTargets.length;e++)if(a.hierarchy[b].keys[c].morphTargets[e]===f){g[f]=a.hierarchy[b].keys[c].morphTargetsInfluences[e];break}e===a.hierarchy[b].keys[c].morphTargets.length&&(g[f]=0)}a.hierarchy[b].keys[c].morphTargetsInfluences=g}}for(c=1;c<a.hierarchy[b].keys.length;c++)a.hierarchy[b].keys[c].time===a.hierarchy[b].keys[c-1].time&&(a.hierarchy[b].keys.splice(c,1),c--);for(c=0;c<a.hierarchy[b].keys.length;c++)a.hierarchy[b].keys[c].index=c}a.initialized= -!0;return a},parse:function(a){var b=function(a,c){c.push(a);for(var d=0;d<a.children.length;d++)b(a.children[d],c)},c=[];if(a instanceof THREE.SkinnedMesh)for(var d=0;d<a.skeleton.bones.length;d++)c.push(a.skeleton.bones[d]);else b(a,c);return c},play:function(a){-1===this.animations.indexOf(a)&&this.animations.push(a)},stop:function(a){a=this.animations.indexOf(a);-1!==a&&this.animations.splice(a,1)},update:function(a){for(var b=0;b<this.animations.length;b++)this.animations[b].resetBlendWeights(); -for(b=0;b<this.animations.length;b++)this.animations[b].update(a)}};THREE.Animation=function(a,b){this.root=a;this.data=THREE.AnimationHandler.init(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=!0;this.weight=0;this.interpolationType=THREE.AnimationHandler.LINEAR}; -THREE.Animation.prototype={constructor:THREE.Animation,keyTypes:["pos","rot","scl"],play:function(a,b){this.currentTime=void 0!==a?a:0;this.weight=void 0!==b?b:1;this.isPlaying=!0;this.reset();THREE.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1;THREE.AnimationHandler.stop(this)},reset:function(){for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a];void 0===c.animationCache&&(c.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}}); -var d=this.data.name,e=c.animationCache.animations,f=e[d];void 0===f&&(f={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:c.matrix},e[d]=f);for(c=0;3>c;c++){for(var d=this.keyTypes[c],e=this.data.hierarchy[a].keys[0],g=this.getNextKeyWith(d,a,1);g.time<this.currentTime&&g.index>e.index;)e=g,g=this.getNextKeyWith(d,a,g.index+1);f.prevKey[d]=e;f.nextKey[d]=g}}},resetBlendWeights:function(){for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a].animationCache;void 0!== -c&&(c=c.blending,c.positionWeight=0,c.quaternionWeight=0,c.scaleWeight=0)}},update:function(){var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,q,n,t,r,s;e=(a.length-1)*b;q=Math.floor(e);e-=q;c[0]=0===q?q:q-1;c[1]=q;c[2]=q>a.length-2?q:q+1;c[3]=q>a.length-3?q:q+2;q=a[c[0]];t=a[c[1]];r=a[c[2]];s=a[c[3]];c=e*e;n=e*c;d[0]=f(q[0],t[0],r[0],s[0],e,c,n);d[1]=f(q[1],t[1],r[1],s[1],e,c,n);d[2]=f(q[2],t[2],r[2],s[2],e,c,n);return d},f=function(a,b,c,d, -e,f,n){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*n+(-3*(b-c)-2*a-d)*f+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){f=this.data.length;if(this.currentTime>f||0>this.currentTime)this.loop?(this.currentTime%=f,0>this.currentTime&&(this.currentTime+=f),this.reset()):this.stop();f=0;for(var h=this.hierarchy.length;f<h;f++)for(var k=this.hierarchy[f],l=k.animationCache.animations[this.data.name],p=k.animationCache.blending,q=0;3>q;q++){var n=this.keyTypes[q], -t=l.prevKey[n],r=l.nextKey[n];if(0<this.timeScale&&r.time<=this.currentTime||0>this.timeScale&&t.time>=this.currentTime){t=this.data.hierarchy[f].keys[0];for(r=this.getNextKeyWith(n,f,1);r.time<this.currentTime&&r.index>t.index;)t=r,r=this.getNextKeyWith(n,f,r.index+1);l.prevKey[n]=t;l.nextKey[n]=r}var s=(this.currentTime-t.time)/(r.time-t.time),u=t[n],v=r[n];0>s&&(s=0);1<s&&(s=1);if("pos"===n)if(this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=u[0]+(v[0]-u[0])*s,c.y=u[1]+(v[1]-u[1])*s, -c.z=u[2]+(v[2]-u[2])*s,t=this.weight/(this.weight+p.positionWeight),k.position.lerp(c,t),p.positionWeight+=this.weight;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)a[0]=this.getPrevKeyWith("pos",f,t.index-1).pos,a[1]=u,a[2]=v,a[3]=this.getNextKeyWith("pos",f,r.index+1).pos,s=.33*s+.33,r=e(a,s),t=this.weight/(this.weight+p.positionWeight),p.positionWeight+=this.weight,n=k.position,n.x+=(r[0]-n.x)*t,n.y+=(r[1]- -n.y)*t,n.z+=(r[2]-n.z)*t,this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(s=e(a,1.01*s),b.set(s[0],s[1],s[2]),b.sub(n),b.y=0,b.normalize(),s=Math.atan2(b.x,b.z),k.rotation.set(0,s,0))}else"rot"===n?(THREE.Quaternion.slerp(u,v,d,s),0===p.quaternionWeight?(k.quaternion.copy(d),p.quaternionWeight=this.weight):(t=this.weight/(this.weight+p.quaternionWeight),THREE.Quaternion.slerp(k.quaternion,d,k.quaternion,t),p.quaternionWeight+=this.weight)):"scl"===n&&(c.x=u[0]+(v[0]-u[0])*s,c.y= -u[1]+(v[1]-u[1])*s,c.z=u[2]+(v[2]-u[2])*s,t=this.weight/(this.weight+p.scaleWeight),k.scale.lerp(c,t),p.scaleWeight+=this.weight)}return!0}}}(),getNextKeyWith:function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]},getPrevKeyWith:function(a,b,c){var d= -this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]}}; -THREE.KeyFrameAnimation=function(a){this.root=a.node;this.data=THREE.AnimationHandler.init(a);this.hierarchy=THREE.AnimationHandler.parse(this.root);this.currentTime=0;this.timeScale=.001;this.isPlaying=!1;this.loop=this.isPaused=!0;a=0;for(var b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix(); -d.matrixWorldNeedsUpdate=!0}}}; -THREE.KeyFrameAnimation.prototype={constructor:THREE.KeyFrameAnimation,play:function(a){this.currentTime=void 0!==a?a:0;if(!1===this.isPlaying){this.isPlaying=!0;var b=this.hierarchy.length,c,d;for(a=0;a<b;a++)c=this.hierarchy[a],d=this.data.hierarchy[a],void 0===d.animationCache&&(d.animationCache={},d.animationCache.prevKey=null,d.animationCache.nextKey=null,d.animationCache.originalMatrix=c.matrix),c=this.data.hierarchy[a].keys,c.length&&(d.animationCache.prevKey=c[0],d.animationCache.nextKey= -c[1],this.startTime=Math.min(c[0].time,this.startTime),this.endTime=Math.max(c[c.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.play(this)},stop:function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.stop(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;d.copy(b.matrix);b.matrix=d;delete c.animationCache}}},update:function(a){if(!1!== -this.isPlaying){this.currentTime+=a*this.timeScale;a=this.data.length;!0===this.loop&&this.currentTime>a&&(this.currentTime%=a);this.currentTime=Math.min(this.currentTime,a);a=0;for(var b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a],d=this.data.hierarchy[a],e=d.keys,d=d.animationCache;if(e.length){var f=d.prevKey,g=d.nextKey;if(g.time<=this.currentTime){for(;g.time<this.currentTime&&g.index>f.index;)f=g,g=e[f.index+1];d.prevKey=f;d.nextKey=g}g.time>=this.currentTime?f.interpolate(g,this.currentTime): -f.interpolate(g,g.time);this.data.hierarchy[a].node.updateMatrix();c.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]},getPrevKeyWith:function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]}}; -THREE.MorphAnimation=function(a){this.mesh=a;this.frames=a.morphTargetInfluences.length;this.currentTime=0;this.duration=1E3;this.loop=!0;this.currentFrame=this.lastFrame=0;this.isPlaying=!1}; -THREE.MorphAnimation.prototype={constructor:THREE.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(a){if(!1!==this.isPlaying){this.currentTime+=a;!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);a=this.duration/this.frames;var b=Math.floor(this.currentTime/a),c=this.mesh.morphTargetInfluences;b!=this.currentFrame&&(c[this.lastFrame]=0,c[this.currentFrame]= -1,c[b]=0,this.lastFrame=this.currentFrame,this.currentFrame=b);c[b]=this.currentTime%a/a;c[this.lastFrame]=1-c[b]}}}; -THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,s){var u,v=h.widthSegments,x=h.heightSegments,D=e/2,w=f/2,y=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)u="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)u="y",x=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",v=h.depthSegments;var A=v+1,E=x+1,G=e/v,F=f/x,z=new THREE.Vector3;z[u]=0<g?1:-1;for(e=0;e<E;e++)for(f=0;f<A;f++){var I=new THREE.Vector3;I[a]=(f*G-D)*c;I[b]=(e*F-w)*d;I[u]=g;h.vertices.push(I)}for(e= -0;e<x;e++)for(f=0;f<v;f++)w=f+A*e,a=f+A*(e+1),b=f+1+A*(e+1),c=f+1+A*e,d=new THREE.Vector2(f/v,1-e/x),g=new THREE.Vector2(f/v,1-(e+1)/x),u=new THREE.Vector2((f+1)/v,1-(e+1)/x),D=new THREE.Vector2((f+1)/v,1-e/x),w=new THREE.Face3(w+y,a+y,c+y),w.normal.copy(z),w.vertexNormals.push(z.clone(),z.clone(),z.clone()),w.materialIndex=s,h.faces.push(w),h.faceVertexUvs[0].push([d,g,D]),w=new THREE.Face3(a+y,b+y,c+y),w.normal.copy(z),w.vertexNormals.push(z.clone(),z.clone(),z.clone()),w.materialIndex=s,h.faces.push(w), -h.faceVertexUvs[0].push([g.clone(),u,D.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var h=this;d=a/2;e=b/2;f=c/2;g("z","y",-1,-1,c,b,d,0);g("z","y",1,-1,c,b,-d,1);g("x","z",1,1,a,c,e,2);g("x","z",1,-1,a,c,-e,3);g("x","y",1,-1,a,b,f,4);g("x","y",-1,-1,a,b,-f,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype); -THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry; -THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(.5,.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0, -0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),g.clone()]);this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry; -THREE.CubeGeometry=function(a,b,c,d,e,f){THREE.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry.");return new THREE.BoxGeometry(a,b,c,d,e,f)}; -THREE.CylinderGeometry=function(a,b,c,d,e,f,g,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;h=void 0!==h?h:2*Math.PI;var k=c/2,l,p,q=[],n=[];for(p=0;p<=e;p++){var t=[],r=[],s=p/e,u=s*(b-a)+a;for(l=0;l<=d;l++){var v=l/d,x=new THREE.Vector3;x.x=u*Math.sin(v*h+ -g);x.y=-s*c+k;x.z=u*Math.cos(v*h+g);this.vertices.push(x);t.push(this.vertices.length-1);r.push(new THREE.Vector2(v,1-s))}q.push(t);n.push(r)}c=(b-a)/c;for(l=0;l<d;l++)for(0!==a?(g=this.vertices[q[0][l]].clone(),h=this.vertices[q[0][l+1]].clone()):(g=this.vertices[q[1][l]].clone(),h=this.vertices[q[1][l+1]].clone()),g.setY(Math.sqrt(g.x*g.x+g.z*g.z)*c).normalize(),h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize(),p=0;p<e;p++){var t=q[p][l],r=q[p+1][l],s=q[p+1][l+1],u=q[p][l+1],v=g.clone(),x=g.clone(), -D=h.clone(),w=h.clone(),y=n[p][l].clone(),A=n[p+1][l].clone(),E=n[p+1][l+1].clone(),G=n[p][l+1].clone();this.faces.push(new THREE.Face3(t,r,u,[v,x,w]));this.faceVertexUvs[0].push([y,A,G]);this.faces.push(new THREE.Face3(r,s,u,[x.clone(),D,w.clone()]));this.faceVertexUvs[0].push([A.clone(),E,G.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,k,0)),l=0;l<d;l++)t=q[0][l],r=q[0][l+1],s=this.vertices.length-1,v=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),D=new THREE.Vector3(0, -1,0),y=n[0][l].clone(),A=n[0][l+1].clone(),E=new THREE.Vector2(A.x,0),this.faces.push(new THREE.Face3(t,r,s,[v,x,D])),this.faceVertexUvs[0].push([y,A,E]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-k,0)),l=0;l<d;l++)t=q[e][l+1],r=q[e][l],s=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),D=new THREE.Vector3(0,-1,0),y=n[e][l+1].clone(),A=n[e][l].clone(),E=new THREE.Vector2(A.x,1),this.faces.push(new THREE.Face3(t,r,s,[v,x,D])),this.faceVertexUvs[0].push([y, -A,E]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=a instanceof Array?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry; -THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)}; -THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||THREE.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(1E-10<Math.abs(d*g-e*f)){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10<d?1E-10<f&&(a=!0): --1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)==Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(O=a.length;0<=--O;){c=O;d=O-1;0>d&&(d=a.length-1);for(var e=0,f=t+2*p,e=0;e<f;e++){var g=oa*e,h=oa*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+U,g=g+U,l=l+U,h=h+U;I.faces.push(new THREE.Face3(k,g,h,null,null,x));I.faces.push(new THREE.Face3(g,l,h,null,null,x));k=D.generateSideWallUV(I,k,g,l,h);I.faceVertexUvs[0].push([k[0], -k[1],k[3]]);I.faceVertexUvs[0].push([k[1],k[2],k[3]])}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=U;b+=U;c+=U;I.faces.push(new THREE.Face3(a,b,c,null,null,v));a=D.generateTopUV(I,a,b,c);I.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,p=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments: -12,t=void 0!==b.steps?b.steps:1,r=b.extrudePath,s,u=!1,v=b.material,x=b.extrudeMaterial,D=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,y,A,E;r&&(s=r.getSpacedPoints(t),u=!0,q=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,t,!1),y=new THREE.Vector3,A=new THREE.Vector3,E=new THREE.Vector3);q||(l=k=p=0);var G,F,z,I=this,U=this.vertices.length,r=a.extractPoints(n),n=r.shape,M=r.holes;if(r=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();F=0;for(z= -M.length;F<z;F++)G=M[F],THREE.Shape.Utils.isClockWise(G)&&(M[F]=G.reverse());r=!1}var H=THREE.Shape.Utils.triangulateShape(n,M),L=n;F=0;for(z=M.length;F<z;F++)G=M[F],n=n.concat(G);var P,N,R,V,J,oa=n.length,ja,ha=H.length,r=[],O=0;R=L.length;P=R-1;for(N=O+1;O<R;O++,P++,N++)P===R&&(P=0),N===R&&(N=0),r[O]=d(L[O],L[P],L[N]);var ca=[],ba,qa=r.concat();F=0;for(z=M.length;F<z;F++){G=M[F];ba=[];O=0;R=G.length;P=R-1;for(N=O+1;O<R;O++,P++,N++)P===R&&(P=0),N===R&&(N=0),ba[O]=d(G[O],G[P],G[N]);ca.push(ba);qa= -qa.concat(ba)}for(P=0;P<p;P++){R=P/p;V=k*(1-R);N=l*Math.sin(R*Math.PI/2);O=0;for(R=L.length;O<R;O++)J=c(L[O],r[O],N),f(J.x,J.y,-V);F=0;for(z=M.length;F<z;F++)for(G=M[F],ba=ca[F],O=0,R=G.length;O<R;O++)J=c(G[O],ba[O],N),f(J.x,J.y,-V)}N=l;for(O=0;O<oa;O++)J=q?c(n[O],qa[O],N):n[O],u?(A.copy(w.normals[0]).multiplyScalar(J.x),y.copy(w.binormals[0]).multiplyScalar(J.y),E.copy(s[0]).add(A).add(y),f(E.x,E.y,E.z)):f(J.x,J.y,0);for(R=1;R<=t;R++)for(O=0;O<oa;O++)J=q?c(n[O],qa[O],N):n[O],u?(A.copy(w.normals[R]).multiplyScalar(J.x), -y.copy(w.binormals[R]).multiplyScalar(J.y),E.copy(s[R]).add(A).add(y),f(E.x,E.y,E.z)):f(J.x,J.y,h/t*R);for(P=p-1;0<=P;P--){R=P/p;V=k*(1-R);N=l*Math.sin(R*Math.PI/2);O=0;for(R=L.length;O<R;O++)J=c(L[O],r[O],N),f(J.x,J.y,h+V);F=0;for(z=M.length;F<z;F++)for(G=M[F],ba=ca[F],O=0,R=G.length;O<R;O++)J=c(G[O],ba[O],N),u?f(J.x,J.y+s[t-1].y,s[t-1].x+V):f(J.x,J.y,h+V)}(function(){if(q){var a;a=0*oa;for(O=0;O<ha;O++)ja=H[O],g(ja[2]+a,ja[1]+a,ja[0]+a);a=t+2*p;a*=oa;for(O=0;O<ha;O++)ja=H[O],g(ja[0]+a,ja[1]+a,ja[2]+ -a)}else{for(O=0;O<ha;O++)ja=H[O],g(ja[2],ja[1],ja[0]);for(O=0;O<ha;O++)ja=H[O],g(ja[0]+oa*t,ja[1]+oa*t,ja[2]+oa*t)}})();(function(){var a=0;e(L,a);a+=L.length;F=0;for(z=M.length;F<z;F++)G=M[F],e(G,a),a+=G.length})()}; -THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d){a=a.vertices;b=a[b];c=a[c];d=a[d];return[new THREE.Vector2(b.x,b.y),new THREE.Vector2(c.x,c.y),new THREE.Vector2(d.x,d.y)]},generateSideWallUV:function(a,b,c,d,e){a=a.vertices;b=a[b];c=a[c];d=a[d];e=a[e];return.01>Math.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y, -1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===a instanceof Array&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this}; -THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,l=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse(),e=0,f=l.length;e<f;e++)g=l[e],THREE.Shape.Utils.isClockWise(g)&&(l[e]=g.reverse());var p=THREE.Shape.Utils.triangulateShape(k,l);e=0;for(f=l.length;e<f;e++)g=l[e], -k=k.concat(g);l=k.length;f=p.length;for(e=0;e<l;e++)g=k[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)l=p[e],k=l[0]+h,g=l[1]+h,l=l[2]+h,this.faces.push(new THREE.Face3(k,g,l,null,null,c)),this.faceVertexUvs[0].push(d.generateTopUV(this,k,g,l))}; -THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="LatheGeometry";this.parameters={points:a,segments:b,phiStart:c,phiLength:d};b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var k=c+g*f*d,l=Math.cos(k),p=Math.sin(k),k=0,q=a.length;k<q;k++){var n=a[k],t=new THREE.Vector3;t.x=l*n.x-p*n.y;t.y=p*n.x+l*n.y;t.z=n.z;this.vertices.push(t)}c=a.length;g=0;for(h=b;g<h;g++)for(k=0,q=a.length-1;k<q;k++){b=p=k+c*g;d=p+c;var l=p+1+c,p=p+1,n=g*f,t=k*e,r= -n+f,s=t+e;this.faces.push(new THREE.Face3(b,d,p));this.faceVertexUvs[0].push([new THREE.Vector2(n,t),new THREE.Vector2(r,t),new THREE.Vector2(n,s)]);this.faces.push(new THREE.Face3(d,l,p));this.faceVertexUvs[0].push([new THREE.Vector2(r,t),new THREE.Vector2(r,s),new THREE.Vector2(n,s)])}this.mergeVertices();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry; -THREE.PlaneGeometry=function(a,b,c,d){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint.");THREE.Geometry.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};this.fromBufferGeometry(new THREE.PlaneBufferGeometry(a,b,c,d))};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry; -THREE.PlaneBufferGeometry=function(a,b,c,d){THREE.BufferGeometry.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=c||1;d=d||1;var g=c+1,h=d+1,k=a/c,l=b/d;b=new Float32Array(g*h*3);a=new Float32Array(g*h*3);for(var p=new Float32Array(g*h*2),q=0,n=0,t=0;t<h;t++)for(var r=t*l-f,s=0;s<g;s++)b[q]=s*k-e,b[q+1]=-r,a[q+2]=1,p[n]=s/c,p[n+1]=1-t/d,q+=3,n+=2;q=0;e=new (65535<b.length/3?Uint32Array:Uint16Array)(c*d*6);for(t=0;t<d;t++)for(s= -0;s<c;s++)f=s+g*(t+1),h=s+1+g*(t+1),k=s+1+g*t,e[q]=s+g*t,e[q+1]=f,e[q+2]=k,e[q+3]=f,e[q+4]=h,e[q+5]=k,q+=6;this.addAttribute("index",new THREE.BufferAttribute(e,1));this.addAttribute("position",new THREE.BufferAttribute(b,3));this.addAttribute("normal",new THREE.BufferAttribute(a,3));this.addAttribute("uv",new THREE.BufferAttribute(p,2))};THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry; -THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="RingGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f};a=a||0;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(1,d):8;var g,h=[],k=a,l=(b-a)/d;for(a=0;a<d+1;a++){for(g=0;g<c+1;g++){var p=new THREE.Vector3,q=e+g/c*f;p.x=k*Math.cos(q);p.y=k*Math.sin(q);this.vertices.push(p);h.push(new THREE.Vector2((p.x/b+1)/2, -(p.y/b+1)/2))}k+=l}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*(c+1),g=0;g<c;g++)f=q=g+e,l=q+c+1,p=q+c+2,this.faces.push(new THREE.Face3(f,l,p,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[p].clone()]),f=q,l=q+c+2,p=q+1,this.faces.push(new THREE.Face3(f,l,p,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[p].clone()]);this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,k)}; -THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry.prototype.constructor=THREE.RingGeometry; -THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;f=void 0!==f?f:0;g=void 0!==g?g:Math.PI;var h,k,l=[],p=[];for(k=0;k<=c;k++){var q=[],n=[];for(h=0;h<=b;h++){var t=h/b,r=k/c,s=new THREE.Vector3;s.x=-a*Math.cos(d+t*e)*Math.sin(f+r*g); -s.y=a*Math.cos(f+r*g);s.z=a*Math.sin(d+t*e)*Math.sin(f+r*g);this.vertices.push(s);q.push(this.vertices.length-1);n.push(new THREE.Vector2(t,1-r))}l.push(q);p.push(n)}for(k=0;k<c;k++)for(h=0;h<b;h++){d=l[k][h+1];e=l[k][h];f=l[k+1][h];g=l[k+1][h+1];var q=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),t=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),s=p[k][h+1].clone(),u=p[k][h].clone(),v=p[k+1][h].clone(),x=p[k+1][h+1].clone();Math.abs(this.vertices[d].y)=== -a?(s.x=(s.x+u.x)/2,this.faces.push(new THREE.Face3(d,f,g,[q,t,r])),this.faceVertexUvs[0].push([s,v,x])):Math.abs(this.vertices[f].y)===a?(v.x=(v.x+x.x)/2,this.faces.push(new THREE.Face3(d,e,f,[q,n,t])),this.faceVertexUvs[0].push([s,u,v])):(this.faces.push(new THREE.Face3(d,e,g,[q,n,r])),this.faceVertexUvs[0].push([s,u,x]),this.faces.push(new THREE.Face3(e,f,g,[n.clone(),t,r.clone()])),this.faceVertexUvs[0].push([u.clone(),v,x.clone()]))}this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3, -a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,b){b=b||{};var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b);this.type="TextGeometry"};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype); -THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; -THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=c||8;d=d||6;e=e||2*Math.PI;for(var f=new THREE.Vector3,g=[],h=[],k=0;k<=c;k++)for(var l=0;l<=d;l++){var p=l/d*e,q=k/c*Math.PI*2;f.x=a*Math.cos(p);f.y=a*Math.sin(p);var n=new THREE.Vector3;n.x=(a+b*Math.cos(q))*Math.cos(p);n.y=(a+b*Math.cos(q))*Math.sin(p);n.z=b*Math.sin(q);this.vertices.push(n);g.push(new THREE.Vector2(l/ -d,k/c));h.push(n.clone().sub(f).normalize())}for(k=1;k<=c;k++)for(l=1;l<=d;l++)a=(d+1)*k+l-1,b=(d+1)*(k-1)+l-1,e=(d+1)*(k-1)+l,f=(d+1)*k+l,p=new THREE.Face3(a,b,f,[h[a].clone(),h[b].clone(),h[f].clone()]),this.faces.push(p),this.faceVertexUvs[0].push([g[a].clone(),g[b].clone(),g[f].clone()]),p=new THREE.Face3(b,e,f,[h[b].clone(),h[e].clone(),h[f].clone()]),this.faces.push(p),this.faceVertexUvs[0].push([g[b].clone(),g[e].clone(),g[f].clone()]);this.computeFaceNormals()}; -THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry; -THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a);a*=b/c;b=Math.cos(a);f*=d*(2+b)*.5;g=d*(2+b)*g*.5;d=e*d*Math.sin(a)*.5;return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.type="TorusKnotGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,p:e,q:f,heightScale:g};a=a||100;b=b||40;c=c||64;d=d||8;e=e||2;f=f||3;g=g||1;for(var k=Array(c),l=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,n=0;n<c;++n){k[n]= -Array(d);var t=n/c*2*e*Math.PI,r=h(t,f,e,a,g),t=h(t+.01,f,e,a,g);l.subVectors(t,r);p.addVectors(t,r);q.crossVectors(l,p);p.crossVectors(q,l);q.normalize();p.normalize();for(t=0;t<d;++t){var s=t/d*2*Math.PI,u=-b*Math.cos(s),s=b*Math.sin(s),v=new THREE.Vector3;v.x=r.x+u*p.x+s*q.x;v.y=r.y+u*p.y+s*q.y;v.z=r.z+u*p.z+s*q.z;k[n][t]=this.vertices.push(v)-1}}for(n=0;n<c;++n)for(t=0;t<d;++t)e=(n+1)%c,f=(t+1)%d,a=k[n][t],b=k[e][t],e=k[e][f],f=k[n][f],g=new THREE.Vector2(n/c,t/d),l=new THREE.Vector2((n+1)/c, -t/d),p=new THREE.Vector2((n+1)/c,(t+1)/d),q=new THREE.Vector2(n/c,(t+1)/d),this.faces.push(new THREE.Face3(a,b,f)),this.faceVertexUvs[0].push([g,l,q]),this.faces.push(new THREE.Face3(b,e,f)),this.faceVertexUvs[0].push([l.clone(),p,q.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry; -THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;f=f||THREE.TubeGeometry.NoTaper;var g=[],h,k,l=b+1,p,q,n,t,r,s=new THREE.Vector3,u,v,x;u=new THREE.TubeGeometry.FrenetFrames(a,b,e);v=u.normals;x=u.binormals;this.tangents=u.tangents;this.normals=v;this.binormals=x;for(u=0;u<l;u++)for(g[u]=[],p=u/(l-1),r=a.getPointAt(p),h=v[u],k=x[u],n=c*f(p),p=0;p<d;p++)q= -p/d*2*Math.PI,t=-n*Math.cos(q),q=n*Math.sin(q),s.copy(r),s.x+=t*h.x+q*k.x,s.y+=t*h.y+q*k.y,s.z+=t*h.z+q*k.z,g[u][p]=this.vertices.push(new THREE.Vector3(s.x,s.y,s.z))-1;for(u=0;u<b;u++)for(p=0;p<d;p++)f=e?(u+1)%b:u+1,l=(p+1)%d,a=g[u][p],c=g[f][p],f=g[f][l],l=g[u][l],s=new THREE.Vector2(u/b,p/d),v=new THREE.Vector2((u+1)/b,p/d),x=new THREE.Vector2((u+1)/b,(p+1)/d),h=new THREE.Vector2(u/b,(p+1)/d),this.faces.push(new THREE.Face3(a,c,l)),this.faceVertexUvs[0].push([s,v,h]),this.faces.push(new THREE.Face3(c, -f,l)),this.faceVertexUvs[0].push([v.clone(),x,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.NoTaper=function(a){return 1};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)}; -THREE.TubeGeometry.FrenetFrames=function(a,b,c){var d=new THREE.Vector3,e=[],f=[],g=[],h=new THREE.Vector3,k=new THREE.Matrix4;b+=1;var l,p,q;this.tangents=e;this.normals=f;this.binormals=g;for(l=0;l<b;l++)p=l/(b-1),e[l]=a.getTangentAt(p),e[l].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(e[0].x);p=Math.abs(e[0].y);q=Math.abs(e[0].z);l<=a&&(a=l,d.set(1,0,0));p<=a&&(a=p,d.set(0,1,0));q<=a&&d.set(0,0,1);h.crossVectors(e[0],d).normalize();f[0].crossVectors(e[0], -h);g[0].crossVectors(e[0],f[0]);for(l=1;l<b;l++)f[l]=f[l-1].clone(),g[l]=g[l-1].clone(),h.crossVectors(e[l-1],e[l]),1E-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[l-1].dot(e[l]),-1,1)),f[l].applyMatrix4(k.makeRotationAxis(h,d))),g[l].crossVectors(e[l],f[l]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),l=1;l<b;l++)f[l].applyMatrix4(k.makeRotationAxis(e[l],d*l)),g[l].crossVectors(e[l],f[l])}; -THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=k.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);k.faces.push(d);u.copy(a).add(b).add(c).divideScalar(3);d=Math.atan2(u.z,-u.x);k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}function g(a, -b){for(var c=Math.pow(2,b),d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),l=[],n=0;n<=c;n++){l[n]=[];for(var p=e(d.clone().lerp(h,n/c)),q=e(g.clone().lerp(h,n/c)),s=c-n,r=0;r<=s;r++)l[n][r]=0==r&&n==c?p:e(p.clone().lerp(q,r/s))}for(n=0;n<c;n++)for(r=0;r<2*(c-n)-1;r++)d=Math.floor(r/2),0==r%2?f(l[n][d+1],l[n+1][d],l[n][d]):f(l[n][d+1],l[n+1][d+1],l[n+1][d])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+.5,a.y));return a.clone()} -THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,l=0,p=a.length;l<p;l+=3)e(new THREE.Vector3(a[l],a[l+1],a[l+2]));a=this.vertices;for(var q=[],n=l=0,p=b.length;l<p;l+=3,n++){var t=a[b[l]],r=a[b[l+1]],s=a[b[l+2]];q[n]=new THREE.Face3(t.index,r.index,s.index,[t.clone(),r.clone(),s.clone()])}for(var u=new THREE.Vector3,l=0,p=q.length;l<p;l++)g(q[l],d);l=0;for(p=this.faceVertexUvs[0].length;l<p;l++)b=this.faceVertexUvs[0][l], -d=b[0].x,a=b[1].x,q=b[2].x,n=Math.max(d,Math.max(a,q)),t=Math.min(d,Math.min(a,q)),.9<n&&.1>t&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>q&&(b[2].x+=1));l=0;for(p=this.vertices.length;l<p;l++)this.vertices[l].multiplyScalar(c);this.mergeVertices();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry; -THREE.DodecahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};var c=(1+Math.sqrt(5))/2,d=1/c;THREE.PolyhedronGeometry.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19, -11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b)};THREE.DodecahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry; -THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b}};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype); -THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;THREE.OctahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};THREE.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b}};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry; -THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b}};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry; -THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],g,h,k,l,p=b+1;for(g=0;g<=c;g++)for(l=g/c,h=0;h<=b;h++)k=h/b,k=a(k,l),d.push(k);var q,n,t,r;for(g=0;g<c;g++)for(h=0;h<b;h++)a=g*p+h,d=g*p+h+1,l=(g+1)*p+h+1,k=(g+1)*p+h,q=new THREE.Vector2(h/b,g/c),n=new THREE.Vector2((h+1)/b,g/c),t=new THREE.Vector2((h+1)/b,(g+1)/c),r=new THREE.Vector2(h/b,(g+1)/c),e.push(new THREE.Face3(a, -d,k)),f.push([q,n,r]),e.push(new THREE.Face3(d,l,k)),f.push([n.clone(),t,r.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry; -THREE.AxisHelper=function(a){a=a||1;var b=new Float32Array([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a]),c=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);a=new THREE.BufferGeometry;a.addAttribute("position",new THREE.BufferAttribute(b,3));a.addAttribute("color",new THREE.BufferAttribute(c,3));b=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,a,b,THREE.LinePieces)};THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype); -THREE.AxisHelper.prototype.constructor=THREE.AxisHelper; -THREE.ArrowHelper=function(){var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0));var b=new THREE.CylinderGeometry(0,.5,1,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,-.5,0));return function(c,d,e,f,g,h){THREE.Object3D.call(this);void 0===f&&(f=16776960);void 0===e&&(e=1);void 0===g&&(g=.2*e);void 0===h&&(h=.2*g);this.position.copy(d);this.line=new THREE.Line(a,new THREE.LineBasicMaterial({color:f}));this.line.matrixAutoUpdate=!1;this.add(this.line); -this.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:f}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(c);this.setLength(e,g,h)}}();THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper; -THREE.ArrowHelper.prototype.setDirection=function(){var a=new THREE.Vector3,b;return function(c){.99999<c.y?this.quaternion.set(0,0,0,1):-.99999>c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();THREE.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,a-b,1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()}; -THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};THREE.BoxHelper=function(a){var b=new THREE.BufferGeometry;b.addAttribute("position",new THREE.BufferAttribute(new Float32Array(72),3));THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);void 0!==a&&this.update(a)};THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype);THREE.BoxHelper.prototype.constructor=THREE.BoxHelper; -THREE.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox();var c=b.boundingBox.min,b=b.boundingBox.max,d=this.geometry.attributes.position.array;d[0]=b.x;d[1]=b.y;d[2]=b.z;d[3]=c.x;d[4]=b.y;d[5]=b.z;d[6]=c.x;d[7]=b.y;d[8]=b.z;d[9]=c.x;d[10]=c.y;d[11]=b.z;d[12]=c.x;d[13]=c.y;d[14]=b.z;d[15]=b.x;d[16]=c.y;d[17]=b.z;d[18]=b.x;d[19]=c.y;d[20]=b.z;d[21]=b.x;d[22]=b.y;d[23]=b.z;d[24]=b.x;d[25]=b.y;d[26]=c.z;d[27]=c.x;d[28]=b.y;d[29]=c.z;d[30]=c.x;d[31]=b.y; -d[32]=c.z;d[33]=c.x;d[34]=c.y;d[35]=c.z;d[36]=c.x;d[37]=c.y;d[38]=c.z;d[39]=b.x;d[40]=c.y;d[41]=c.z;d[42]=b.x;d[43]=c.y;d[44]=c.z;d[45]=b.x;d[46]=b.y;d[47]=c.z;d[48]=b.x;d[49]=b.y;d[50]=b.z;d[51]=b.x;d[52]=b.y;d[53]=c.z;d[54]=c.x;d[55]=b.y;d[56]=b.z;d[57]=c.x;d[58]=b.y;d[59]=c.z;d[60]=c.x;d[61]=c.y;d[62]=b.z;d[63]=c.x;d[64]=c.y;d[65]=c.z;d[66]=b.x;d[67]=c.y;d[68]=b.z;d[69]=b.x;d[70]=c.y;d[71]=c.z;this.geometry.attributes.position.needsUpdate=!0;this.geometry.computeBoundingSphere();this.matrix=a.matrixWorld; -this.matrixAutoUpdate=!1};THREE.BoundingBoxHelper=function(a,b){var c=void 0!==b?b:8947848;this.object=a;this.box=new THREE.Box3;THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:c,wireframe:!0}))};THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.BoundingBoxHelper.prototype.constructor=THREE.BoundingBoxHelper;THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object);this.box.size(this.scale);this.box.center(this.position)}; -THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new THREE.Vector3);d.colors.push(new THREE.Color(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}var d=new THREE.Geometry,e=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200); -b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);THREE.Line.call(this,d,e,THREE.LinePieces);this.camera=a;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()}; -THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);THREE.CameraHelper.prototype.constructor=THREE.CameraHelper; -THREE.CameraHelper.prototype.update=function(){var a,b,c=new THREE.Vector3,d=new THREE.Camera,e=function(e,g,h,k){c.set(g,h,k).unproject(d);e=b[e];if(void 0!==e)for(g=0,h=e.length;g<h;g++)a.vertices[e[g]].copy(c)};return function(){a=this.geometry;b=this.pointMap;d.projectionMatrix.copy(this.camera.projectionMatrix);e("c",0,0,-1);e("t",0,0,1);e("n1",-1,-1,-1);e("n2",1,-1,-1);e("n3",-1,1,-1);e("n4",1,1,-1);e("f1",-1,-1,1);e("f2",1,-1,1);e("f3",-1,1,1);e("f4",1,1,1);e("u1",.7,1.1,-1);e("u2",-.7,1.1, --1);e("u3",0,2,-1);e("cf1",-1,0,1);e("cf2",1,0,1);e("cf3",0,-1,1);e("cf4",0,1,1);e("cn1",-1,0,-1);e("cn2",1,0,-1);e("cn3",0,-1,-1);e("cn4",0,1,-1);a.verticesNeedUpdate=!0}}(); -THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;b=b||1;var c=new THREE.Geometry;c.vertices.push(new THREE.Vector3(-b,b,0),new THREE.Vector3(b,b,0),new THREE.Vector3(b,-b,0),new THREE.Vector3(-b,-b,0),new THREE.Vector3(-b,b,0));var d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightPlane=new THREE.Line(c,d);this.add(this.lightPlane); -c=new THREE.Geometry;c.vertices.push(new THREE.Vector3,new THREE.Vector3);d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine);this.update()};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.DirectionalLightHelper.prototype.constructor=THREE.DirectionalLightHelper; -THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()}; -THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}(); -THREE.EdgesHelper=function(a,b,c){b=void 0!==b?b:16777215;c=Math.cos(THREE.Math.degToRad(void 0!==c?c:1));var d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,k;a.geometry instanceof THREE.BufferGeometry?(k=new THREE.Geometry,k.fromBufferGeometry(a.geometry)):k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();var l=k.vertices;k=k.faces;for(var p=0,q=0,n=k.length;q<n;q++)for(var t=k[q],r=0;3>r;r++){d[0]=t[g[r]];d[1]=t[g[(r+1)%3]];d.sort(f);var s=d.toString(); -void 0===e[s]?(e[s]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},p++):e[s].face2=q}d=new Float32Array(6*p);f=0;for(s in e)if(g=e[s],void 0===g.face2||k[g.face1].normal.dot(k[g.face2].normal)<=c)p=l[g.vert1],d[f++]=p.x,d[f++]=p.y,d[f++]=p.z,p=l[g.vert2],d[f++]=p.x,d[f++]=p.y,d[f++]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3));THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:b}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1}; -THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper; -THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;c<e;c++)b.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:a,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype); -THREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper; -THREE.FaceNormalsHelper.prototype.update=function(){var a=this.geometry.vertices,b=this.object,c=b.geometry.vertices,d=b.geometry.faces,e=b.matrixWorld;b.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(e);for(var f=b=0,g=d.length;b<g;b++,f+=2){var h=d[b];a[f].copy(c[h.a]).add(c[h.b]).add(c[h.c]).divideScalar(3).applyMatrix4(e);a[f+1].copy(h.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(a[f])}this.geometry.verticesNeedUpdate=!0;return this}; -THREE.GridHelper=function(a,b){var c=new THREE.Geometry,d=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});this.color1=new THREE.Color(4473924);this.color2=new THREE.Color(8947848);for(var e=-a;e<=a;e+=b){c.vertices.push(new THREE.Vector3(-a,0,e),new THREE.Vector3(a,0,e),new THREE.Vector3(e,0,-a),new THREE.Vector3(e,0,a));var f=0===e?this.color1:this.color2;c.colors.push(f,f,f,f)}THREE.Line.call(this,c,d,THREE.LinePieces)};THREE.GridHelper.prototype=Object.create(THREE.Line.prototype); -THREE.GridHelper.prototype.constructor=THREE.GridHelper;THREE.GridHelper.prototype.setColors=function(a,b){this.color1.set(a);this.color2.set(b);this.geometry.colorsNeedUpdate=!0}; -THREE.HemisphereLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.colors=[new THREE.Color,new THREE.Color];var c=new THREE.SphereGeometry(b,4,2);c.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));for(var d=0;8>d;d++)c.faces[d].color=this.colors[4>d?0:1];d=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(c,d);this.add(this.lightSphere); -this.update()};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.HemisphereLightHelper.prototype.constructor=THREE.HemisphereLightHelper;THREE.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose();this.lightSphere.material.dispose()}; -THREE.HemisphereLightHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity);this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity);this.lightSphere.lookAt(a.setFromMatrixPosition(this.light.matrixWorld).negate());this.lightSphere.geometry.colorsNeedUpdate=!0}}(); -THREE.PointLightHelper=function(a,b){this.light=a;this.light.updateMatrixWorld();var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);THREE.Mesh.call(this,c,d);this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1};THREE.PointLightHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.PointLightHelper.prototype.constructor=THREE.PointLightHelper; -THREE.PointLightHelper.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}; -THREE.SkeletonHelper=function(a){this.bones=this.getBoneList(a);for(var b=new THREE.Geometry,c=0;c<this.bones.length;c++)this.bones[c].parent instanceof THREE.Bone&&(b.vertices.push(new THREE.Vector3),b.vertices.push(new THREE.Vector3),b.colors.push(new THREE.Color(0,0,1)),b.colors.push(new THREE.Color(0,1,0)));c=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});THREE.Line.call(this,b,c,THREE.LinePieces);this.root=a;this.matrix=a.matrixWorld; -this.matrixAutoUpdate=!1;this.update()};THREE.SkeletonHelper.prototype=Object.create(THREE.Line.prototype);THREE.SkeletonHelper.prototype.constructor=THREE.SkeletonHelper;THREE.SkeletonHelper.prototype.getBoneList=function(a){var b=[];a instanceof THREE.Bone&&b.push(a);for(var c=0;c<a.children.length;c++)b.push.apply(b,this.getBoneList(a.children[c]));return b}; -THREE.SkeletonHelper.prototype.update=function(){for(var a=this.geometry,b=(new THREE.Matrix4).getInverse(this.root.matrixWorld),c=new THREE.Matrix4,d=0,e=0;e<this.bones.length;e++){var f=this.bones[e];f.parent instanceof THREE.Bone&&(c.multiplyMatrices(b,f.matrixWorld),a.vertices[d].setFromMatrixPosition(c),c.multiplyMatrices(b,f.parent.matrixWorld),a.vertices[d+1].setFromMatrixPosition(c),d+=2)}a.verticesNeedUpdate=!0;a.computeBoundingSphere()}; -THREE.SpotLightHelper=function(a){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;a=new THREE.CylinderGeometry(0,1,1,8,1,!0);a.applyMatrix((new THREE.Matrix4).makeTranslation(0,-.5,0));a.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));var b=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new THREE.Mesh(a,b);this.add(this.cone);this.update()};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype); -THREE.SpotLightHelper.prototype.constructor=THREE.SpotLightHelper;THREE.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()}; -THREE.SpotLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){var c=this.light.distance?this.light.distance:1E4,d=c*Math.tan(this.light.angle);this.cone.scale.set(d,d,c);a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(b.sub(a));this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(); -THREE.VertexNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:16711680;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexNormals.length;g<h;g++)c.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};THREE.VertexNormalsHelper.prototype=Object.create(THREE.Line.prototype); -THREE.VertexNormalsHelper.prototype.constructor=THREE.VertexNormalsHelper; -THREE.VertexNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;k<l;k++)for(var p=f[k],q=0,n=p.vertexNormals.length;q<n;q++){var t=p.vertexNormals[q];d[h].copy(e[p[a[q]]]).applyMatrix4(g);b.copy(t).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size); -b.add(d[h]);h+=1;d[h].copy(b);h+=1}this.geometry.verticesNeedUpdate=!0;return this}}(); -THREE.VertexTangentsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:255;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexTangents.length;g<h;g++)c.vertices.push(new THREE.Vector3),c.vertices.push(new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.update()};THREE.VertexTangentsHelper.prototype=Object.create(THREE.Line.prototype); -THREE.VertexTangentsHelper.prototype.constructor=THREE.VertexTangentsHelper; -THREE.VertexTangentsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;k<l;k++)for(var p=f[k],q=0,n=p.vertexTangents.length;q<n;q++){var t=p.vertexTangents[q];d[h].copy(e[p[a[q]]]).applyMatrix4(g);b.copy(t).transformDirection(g).multiplyScalar(this.size);b.add(d[h]);h+=1;d[h].copy(b); -h+=1}this.geometry.verticesNeedUpdate=!0;return this}}(); -THREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var k=a.geometry.vertices,l=a.geometry.faces,p=0,q=new Uint32Array(6*l.length),n=0,t=l.length;n<t;n++)for(var r=l[n],s=0;3>s;s++){d[0]=r[g[s]];d[1]=r[g[(s+1)%3]];d.sort(f);var u=d.toString();void 0===e[u]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[u]=!0,p++)}d=new Float32Array(6*p);n=0;for(t=p;n<t;n++)for(s=0;2>s;s++)p= -k[q[2*n+s]],g=6*n+3*s,d[g+0]=p.x,d[g+1]=p.y,d[g+2]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(a.geometry instanceof THREE.BufferGeometry){if(void 0!==a.geometry.attributes.index){k=a.geometry.attributes.position.array;t=a.geometry.attributes.index.array;l=a.geometry.drawcalls;p=0;0===l.length&&(l=[{count:t.length,index:0,start:0}]);for(var q=new Uint32Array(2*t.length),r=0,v=l.length;r<v;++r)for(var s=l[r].start,u=l[r].count,g=l[r].index,n=s,x=s+u;n<x;n+=3)for(s=0;3>s;s++)d[0]= -g+t[n+s],d[1]=g+t[n+(s+1)%3],d.sort(f),u=d.toString(),void 0===e[u]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[u]=!0,p++);d=new Float32Array(6*p);n=0;for(t=p;n<t;n++)for(s=0;2>s;s++)g=6*n+3*s,p=3*q[2*n+s],d[g+0]=k[p],d[g+1]=k[p+1],d[g+2]=k[p+2]}else for(k=a.geometry.attributes.position.array,p=k.length/3,q=p/3,d=new Float32Array(6*p),n=0,t=q;n<t;n++)for(s=0;3>s;s++)g=18*n+6*s,q=9*n+3*s,d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],p=9*n+(s+1)%3*3,d[g+3]=k[p],d[g+4]=k[p+1],d[g+5]=k[p+2];h.addAttribute("position",new THREE.BufferAttribute(d, -3))}THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper;THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject; -THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh; -THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)}; -THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)_?(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&1<h.length){var k=h[1];d[k]||(d[k]={start:Infinity,end:-Infinity});h=d[k];f<h.start&&(h.start=f);f>h.end&&(h.end=f);c||(c=k)}}for(k in d)h=d[k],this.createAnimation(k,h.start,h.end,a);this.firstAnimation=c}; -THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)}; -THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b}; -THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):THREE.warn("THREE.MorphBlendMesh: animation["+a+"] undefined in .playAnimation()")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1}; -THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight; -f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}}; diff --git a/libs/three.js/r81/three.js b/libs/three.js/r81/three.js deleted file mode 100644 index f5c013d9..00000000 --- a/libs/three.js/r81/three.js +++ /dev/null @@ -1,41792 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.THREE = global.THREE || {}))); -}(this, (function (exports) { 'use strict'; - - // Polyfills - - if ( Number.EPSILON === undefined ) { - - Number.EPSILON = Math.pow( 2, - 52 ); - - } - - // - - if ( Math.sign === undefined ) { - - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign - - Math.sign = function ( x ) { - - return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : + x; - - }; - - } - - if ( Function.prototype.name === undefined ) { - - // Missing in IE9-11. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name - - Object.defineProperty( Function.prototype, 'name', { - - get: function () { - - return this.toString().match( /^\s*function\s*(\S*)\s*\(/ )[ 1 ]; - - } - - } ); - - } - - if ( Object.assign === undefined ) { - - // Missing in IE. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign - - ( function () { - - Object.assign = function ( target ) { - - 'use strict'; - - if ( target === undefined || target === null ) { - - throw new TypeError( 'Cannot convert undefined or null to object' ); - - } - - var output = Object( target ); - - for ( var index = 1; index < arguments.length; index ++ ) { - - var source = arguments[ index ]; - - if ( source !== undefined && source !== null ) { - - for ( var nextKey in source ) { - - if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) { - - output[ nextKey ] = source[ nextKey ]; - - } - - } - - } - - } - - return output; - - }; - - } )(); - - } - - /** - * https://github.com/mrdoob/eventdispatcher.js/ - */ - - function EventDispatcher() {} - - Object.assign( EventDispatcher.prototype, { - - addEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) this._listeners = {}; - - var listeners = this._listeners; - - if ( listeners[ type ] === undefined ) { - - listeners[ type ] = []; - - } - - if ( listeners[ type ].indexOf( listener ) === - 1 ) { - - listeners[ type ].push( listener ); - - } - - }, - - hasEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return false; - - var listeners = this._listeners; - - if ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) { - - return true; - - } - - return false; - - }, - - removeEventListener: function ( type, listener ) { - - if ( this._listeners === undefined ) return; - - var listeners = this._listeners; - var listenerArray = listeners[ type ]; - - if ( listenerArray !== undefined ) { - - var index = listenerArray.indexOf( listener ); - - if ( index !== - 1 ) { - - listenerArray.splice( index, 1 ); - - } - - } - - }, - - dispatchEvent: function ( event ) { - - if ( this._listeners === undefined ) return; - - var listeners = this._listeners; - var listenerArray = listeners[ event.type ]; - - if ( listenerArray !== undefined ) { - - event.target = this; - - var array = [], i = 0; - var length = listenerArray.length; - - for ( i = 0; i < length; i ++ ) { - - array[ i ] = listenerArray[ i ]; - - } - - for ( i = 0; i < length; i ++ ) { - - array[ i ].call( this, event ); - - } - - } - - } - - } ); - - var REVISION = '81'; - var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 }; - var CullFaceNone = 0; - var CullFaceBack = 1; - var CullFaceFront = 2; - var CullFaceFrontBack = 3; - var FrontFaceDirectionCW = 0; - var FrontFaceDirectionCCW = 1; - var BasicShadowMap = 0; - var PCFShadowMap = 1; - var PCFSoftShadowMap = 2; - var FrontSide = 0; - var BackSide = 1; - var DoubleSide = 2; - var FlatShading = 1; - var SmoothShading = 2; - var NoColors = 0; - var FaceColors = 1; - var VertexColors = 2; - var NoBlending = 0; - var NormalBlending = 1; - var AdditiveBlending = 2; - var SubtractiveBlending = 3; - var MultiplyBlending = 4; - var CustomBlending = 5; - var BlendingMode = { - NoBlending: NoBlending, - NormalBlending: NormalBlending, - AdditiveBlending: AdditiveBlending, - SubtractiveBlending: SubtractiveBlending, - MultiplyBlending: MultiplyBlending, - CustomBlending: CustomBlending - }; - var AddEquation = 100; - var SubtractEquation = 101; - var ReverseSubtractEquation = 102; - var MinEquation = 103; - var MaxEquation = 104; - var ZeroFactor = 200; - var OneFactor = 201; - var SrcColorFactor = 202; - var OneMinusSrcColorFactor = 203; - var SrcAlphaFactor = 204; - var OneMinusSrcAlphaFactor = 205; - var DstAlphaFactor = 206; - var OneMinusDstAlphaFactor = 207; - var DstColorFactor = 208; - var OneMinusDstColorFactor = 209; - var SrcAlphaSaturateFactor = 210; - var NeverDepth = 0; - var AlwaysDepth = 1; - var LessDepth = 2; - var LessEqualDepth = 3; - var EqualDepth = 4; - var GreaterEqualDepth = 5; - var GreaterDepth = 6; - var NotEqualDepth = 7; - var MultiplyOperation = 0; - var MixOperation = 1; - var AddOperation = 2; - var NoToneMapping = 0; - var LinearToneMapping = 1; - var ReinhardToneMapping = 2; - var Uncharted2ToneMapping = 3; - var CineonToneMapping = 4; - var UVMapping = 300; - var CubeReflectionMapping = 301; - var CubeRefractionMapping = 302; - var EquirectangularReflectionMapping = 303; - var EquirectangularRefractionMapping = 304; - var SphericalReflectionMapping = 305; - var CubeUVReflectionMapping = 306; - var CubeUVRefractionMapping = 307; - var TextureMapping = { - UVMapping: UVMapping, - CubeReflectionMapping: CubeReflectionMapping, - CubeRefractionMapping: CubeRefractionMapping, - EquirectangularReflectionMapping: EquirectangularReflectionMapping, - EquirectangularRefractionMapping: EquirectangularRefractionMapping, - SphericalReflectionMapping: SphericalReflectionMapping, - CubeUVReflectionMapping: CubeUVReflectionMapping, - CubeUVRefractionMapping: CubeUVRefractionMapping - }; - var RepeatWrapping = 1000; - var ClampToEdgeWrapping = 1001; - var MirroredRepeatWrapping = 1002; - var TextureWrapping = { - RepeatWrapping: RepeatWrapping, - ClampToEdgeWrapping: ClampToEdgeWrapping, - MirroredRepeatWrapping: MirroredRepeatWrapping - }; - var NearestFilter = 1003; - var NearestMipMapNearestFilter = 1004; - var NearestMipMapLinearFilter = 1005; - var LinearFilter = 1006; - var LinearMipMapNearestFilter = 1007; - var LinearMipMapLinearFilter = 1008; - var TextureFilter = { - NearestFilter: NearestFilter, - NearestMipMapNearestFilter: NearestMipMapNearestFilter, - NearestMipMapLinearFilter: NearestMipMapLinearFilter, - LinearFilter: LinearFilter, - LinearMipMapNearestFilter: LinearMipMapNearestFilter, - LinearMipMapLinearFilter: LinearMipMapLinearFilter - }; - var UnsignedByteType = 1009; - var ByteType = 1010; - var ShortType = 1011; - var UnsignedShortType = 1012; - var IntType = 1013; - var UnsignedIntType = 1014; - var FloatType = 1015; - var HalfFloatType = 1016; - var UnsignedShort4444Type = 1017; - var UnsignedShort5551Type = 1018; - var UnsignedShort565Type = 1019; - var UnsignedInt248Type = 1020; - var AlphaFormat = 1021; - var RGBFormat = 1022; - var RGBAFormat = 1023; - var LuminanceFormat = 1024; - var LuminanceAlphaFormat = 1025; - var RGBEFormat = RGBAFormat; - var DepthFormat = 1026; - var DepthStencilFormat = 1027; - var RGB_S3TC_DXT1_Format = 2001; - var RGBA_S3TC_DXT1_Format = 2002; - var RGBA_S3TC_DXT3_Format = 2003; - var RGBA_S3TC_DXT5_Format = 2004; - var RGB_PVRTC_4BPPV1_Format = 2100; - var RGB_PVRTC_2BPPV1_Format = 2101; - var RGBA_PVRTC_4BPPV1_Format = 2102; - var RGBA_PVRTC_2BPPV1_Format = 2103; - var RGB_ETC1_Format = 2151; - var LoopOnce = 2200; - var LoopRepeat = 2201; - var LoopPingPong = 2202; - var InterpolateDiscrete = 2300; - var InterpolateLinear = 2301; - var InterpolateSmooth = 2302; - var ZeroCurvatureEnding = 2400; - var ZeroSlopeEnding = 2401; - var WrapAroundEnding = 2402; - var TrianglesDrawMode = 0; - var TriangleStripDrawMode = 1; - var TriangleFanDrawMode = 2; - var LinearEncoding = 3000; - var sRGBEncoding = 3001; - var GammaEncoding = 3007; - var RGBEEncoding = 3002; - var LogLuvEncoding = 3003; - var RGBM7Encoding = 3004; - var RGBM16Encoding = 3005; - var RGBDEncoding = 3006; - var BasicDepthPacking = 3200; - var RGBADepthPacking = 3201; - - /** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - - exports.Math = { - - DEG2RAD: Math.PI / 180, - RAD2DEG: 180 / Math.PI, - - generateUUID: function () { - - // http://www.broofa.com/Tools/Math.uuid.htm - - var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split( '' ); - var uuid = new Array( 36 ); - var rnd = 0, r; - - return function generateUUID() { - - for ( var i = 0; i < 36; i ++ ) { - - if ( i === 8 || i === 13 || i === 18 || i === 23 ) { - - uuid[ i ] = '-'; - - } else if ( i === 14 ) { - - uuid[ i ] = '4'; - - } else { - - if ( rnd <= 0x02 ) rnd = 0x2000000 + ( Math.random() * 0x1000000 ) | 0; - r = rnd & 0xf; - rnd = rnd >> 4; - uuid[ i ] = chars[ ( i === 19 ) ? ( r & 0x3 ) | 0x8 : r ]; - - } - - } - - return uuid.join( '' ); - - }; - - }(), - - clamp: function ( value, min, max ) { - - return Math.max( min, Math.min( max, value ) ); - - }, - - // compute euclidian modulo of m % n - // https://en.wikipedia.org/wiki/Modulo_operation - - euclideanModulo: function ( n, m ) { - - return ( ( n % m ) + m ) % m; - - }, - - // Linear mapping from range <a1, a2> to range <b1, b2> - - mapLinear: function ( x, a1, a2, b1, b2 ) { - - return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 ); - - }, - - // http://en.wikipedia.org/wiki/Smoothstep - - smoothstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min ) / ( max - min ); - - return x * x * ( 3 - 2 * x ); - - }, - - smootherstep: function ( x, min, max ) { - - if ( x <= min ) return 0; - if ( x >= max ) return 1; - - x = ( x - min ) / ( max - min ); - - return x * x * x * ( x * ( x * 6 - 15 ) + 10 ); - - }, - - random16: function () { - - console.warn( 'THREE.Math.random16() has been deprecated. Use Math.random() instead.' ); - return Math.random(); - - }, - - // Random integer from <low, high> interval - - randInt: function ( low, high ) { - - return low + Math.floor( Math.random() * ( high - low + 1 ) ); - - }, - - // Random float from <low, high> interval - - randFloat: function ( low, high ) { - - return low + Math.random() * ( high - low ); - - }, - - // Random float from <-range/2, range/2> interval - - randFloatSpread: function ( range ) { - - return range * ( 0.5 - Math.random() ); - - }, - - degToRad: function ( degrees ) { - - return degrees * exports.Math.DEG2RAD; - - }, - - radToDeg: function ( radians ) { - - return radians * exports.Math.RAD2DEG; - - }, - - isPowerOfTwo: function ( value ) { - - return ( value & ( value - 1 ) ) === 0 && value !== 0; - - }, - - nearestPowerOfTwo: function ( value ) { - - return Math.pow( 2, Math.round( Math.log( value ) / Math.LN2 ) ); - - }, - - nextPowerOfTwo: function ( value ) { - - value --; - value |= value >> 1; - value |= value >> 2; - value |= value >> 4; - value |= value >> 8; - value |= value >> 16; - value ++; - - return value; - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author philogb / http://blog.thejit.org/ - * @author egraether / http://egraether.com/ - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - - function Vector2( x, y ) { - - this.x = x || 0; - this.y = y || 0; - - } - - Vector2.prototype = { - - constructor: Vector2, - - isVector2: true, - - get width() { - - return this.x; - - }, - - set width( value ) { - - this.x = value; - - }, - - get height() { - - return this.y; - - }, - - set height( value ) { - - this.y = value; - - }, - - // - - set: function ( x, y ) { - - this.x = x; - this.y = y; - - return this; - - }, - - setScalar: function ( scalar ) { - - this.x = scalar; - this.y = scalar; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - clone: function () { - - return new this.constructor( this.x, this.y ); - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - - return this; - - }, - - addScaledVector: function ( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - - return this; - - }, - - multiply: function ( v ) { - - this.x *= v.x; - this.y *= v.y; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - if ( isFinite( scalar ) ) { - - this.x *= scalar; - this.y *= scalar; - - } else { - - this.x = 0; - this.y = 0; - - } - - return this; - - }, - - divide: function ( v ) { - - this.x /= v.x; - this.y /= v.y; - - return this; - - }, - - divideScalar: function ( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - }, - - min: function ( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - - return this; - - }, - - max: function ( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - - return this; - - }, - - clampScalar: function () { - - var min, max; - - return function clampScalar( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new Vector2(); - max = new Vector2(); - - } - - min.set( minVal, minVal ); - max.set( maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - }(), - - clampLength: function ( min, max ) { - - var length = this.length(); - - return this.multiplyScalar( Math.max( min, Math.min( max, length ) ) / length ); - - }, - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y ); - - }, - - lengthManhattan: function() { - - return Math.abs( this.x ) + Math.abs( this.y ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - angle: function () { - - // computes the angle in radians with respect to the positive x-axis - - var angle = Math.atan2( this.y, this.x ); - - if ( angle < 0 ) angle += 2 * Math.PI; - - return angle; - - }, - - distanceTo: function ( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - }, - - distanceToSquared: function ( v ) { - - var dx = this.x - v.x, dy = this.y - v.y; - return dx * dx + dy * dy; - - }, - - distanceToManhattan: function ( v ) { - - return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ); - - }, - - setLength: function ( length ) { - - return this.multiplyScalar( length / this.length() ); - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - - return this; - - }, - - rotateAround: function ( center, angle ) { - - var c = Math.cos( angle ), s = Math.sin( angle ); - - var x = this.x - center.x; - var y = this.y - center.y; - - this.x = x * c - y * s + center.x; - this.y = x * s + y * c + center.y; - - return this; - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author szimek / https://github.com/szimek/ - */ - - function Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) { - - Object.defineProperty( this, 'id', { value: TextureIdCount() } ); - - this.uuid = exports.Math.generateUUID(); - - this.name = ''; - this.sourceFile = ''; - - this.image = image !== undefined ? image : Texture.DEFAULT_IMAGE; - this.mipmaps = []; - - this.mapping = mapping !== undefined ? mapping : Texture.DEFAULT_MAPPING; - - this.wrapS = wrapS !== undefined ? wrapS : ClampToEdgeWrapping; - this.wrapT = wrapT !== undefined ? wrapT : ClampToEdgeWrapping; - - this.magFilter = magFilter !== undefined ? magFilter : LinearFilter; - this.minFilter = minFilter !== undefined ? minFilter : LinearMipMapLinearFilter; - - this.anisotropy = anisotropy !== undefined ? anisotropy : 1; - - this.format = format !== undefined ? format : RGBAFormat; - this.type = type !== undefined ? type : UnsignedByteType; - - this.offset = new Vector2( 0, 0 ); - this.repeat = new Vector2( 1, 1 ); - - this.generateMipmaps = true; - this.premultiplyAlpha = false; - this.flipY = true; - this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml) - - - // Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap. - // - // Also changing the encoding after already used by a Material will not automatically make the Material - // update. You need to explicitly call Material.needsUpdate to trigger it to recompile. - this.encoding = encoding !== undefined ? encoding : LinearEncoding; - - this.version = 0; - this.onUpdate = null; - - } - - Texture.DEFAULT_IMAGE = undefined; - Texture.DEFAULT_MAPPING = UVMapping; - - Texture.prototype = { - - constructor: Texture, - - isTexture: true, - - set needsUpdate( value ) { - - if ( value === true ) this.version ++; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.image = source.image; - this.mipmaps = source.mipmaps.slice( 0 ); - - this.mapping = source.mapping; - - this.wrapS = source.wrapS; - this.wrapT = source.wrapT; - - this.magFilter = source.magFilter; - this.minFilter = source.minFilter; - - this.anisotropy = source.anisotropy; - - this.format = source.format; - this.type = source.type; - - this.offset.copy( source.offset ); - this.repeat.copy( source.repeat ); - - this.generateMipmaps = source.generateMipmaps; - this.premultiplyAlpha = source.premultiplyAlpha; - this.flipY = source.flipY; - this.unpackAlignment = source.unpackAlignment; - this.encoding = source.encoding; - - return this; - - }, - - toJSON: function ( meta ) { - - if ( meta.textures[ this.uuid ] !== undefined ) { - - return meta.textures[ this.uuid ]; - - } - - function getDataURL( image ) { - - var canvas; - - if ( image.toDataURL !== undefined ) { - - canvas = image; - - } else { - - canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.width = image.width; - canvas.height = image.height; - - canvas.getContext( '2d' ).drawImage( image, 0, 0, image.width, image.height ); - - } - - if ( canvas.width > 2048 || canvas.height > 2048 ) { - - return canvas.toDataURL( 'image/jpeg', 0.6 ); - - } else { - - return canvas.toDataURL( 'image/png' ); - - } - - } - - var output = { - metadata: { - version: 4.4, - type: 'Texture', - generator: 'Texture.toJSON' - }, - - uuid: this.uuid, - name: this.name, - - mapping: this.mapping, - - repeat: [ this.repeat.x, this.repeat.y ], - offset: [ this.offset.x, this.offset.y ], - wrap: [ this.wrapS, this.wrapT ], - - minFilter: this.minFilter, - magFilter: this.magFilter, - anisotropy: this.anisotropy, - - flipY: this.flipY - }; - - if ( this.image !== undefined ) { - - // TODO: Move to THREE.Image - - var image = this.image; - - if ( image.uuid === undefined ) { - - image.uuid = exports.Math.generateUUID(); // UGH - - } - - if ( meta.images[ image.uuid ] === undefined ) { - - meta.images[ image.uuid ] = { - uuid: image.uuid, - url: getDataURL( image ) - }; - - } - - output.image = image.uuid; - - } - - meta.textures[ this.uuid ] = output; - - return output; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - }, - - transformUv: function ( uv ) { - - if ( this.mapping !== UVMapping ) return; - - uv.multiply( this.repeat ); - uv.add( this.offset ); - - if ( uv.x < 0 || uv.x > 1 ) { - - switch ( this.wrapS ) { - - case RepeatWrapping: - - uv.x = uv.x - Math.floor( uv.x ); - break; - - case ClampToEdgeWrapping: - - uv.x = uv.x < 0 ? 0 : 1; - break; - - case MirroredRepeatWrapping: - - if ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) { - - uv.x = Math.ceil( uv.x ) - uv.x; - - } else { - - uv.x = uv.x - Math.floor( uv.x ); - - } - break; - - } - - } - - if ( uv.y < 0 || uv.y > 1 ) { - - switch ( this.wrapT ) { - - case RepeatWrapping: - - uv.y = uv.y - Math.floor( uv.y ); - break; - - case ClampToEdgeWrapping: - - uv.y = uv.y < 0 ? 0 : 1; - break; - - case MirroredRepeatWrapping: - - if ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) { - - uv.y = Math.ceil( uv.y ) - uv.y; - - } else { - - uv.y = uv.y - Math.floor( uv.y ); - - } - break; - - } - - } - - if ( this.flipY ) { - - uv.y = 1 - uv.y; - - } - - } - - }; - - Object.assign( Texture.prototype, EventDispatcher.prototype ); - - var count = 0; - function TextureIdCount() { return count++; }; - - /** - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author philogb / http://blog.thejit.org/ - * @author mikael emtinger / http://gomo.se/ - * @author egraether / http://egraether.com/ - * @author WestLangley / http://github.com/WestLangley - */ - - function Vector4( x, y, z, w ) { - - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = ( w !== undefined ) ? w : 1; - - } - - Vector4.prototype = { - - constructor: Vector4, - - isVector4: true, - - set: function ( x, y, z, w ) { - - this.x = x; - this.y = y; - this.z = z; - this.w = w; - - return this; - - }, - - setScalar: function ( scalar ) { - - this.x = scalar; - this.y = scalar; - this.z = scalar; - this.w = scalar; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setZ: function ( z ) { - - this.z = z; - - return this; - - }, - - setW: function ( w ) { - - this.w = w; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - case 3: this.w = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - case 3: return this.w; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - clone: function () { - - return new this.constructor( this.x, this.y, this.z, this.w ); - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - this.w = ( v.w !== undefined ) ? v.w : 1; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - this.z += s; - this.w += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - this.w = a.w + b.w; - - return this; - - }, - - addScaledVector: function ( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - this.w += v.w * s; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - this.z -= s; - this.w -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - this.w = a.w - b.w; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - if ( isFinite( scalar ) ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - this.w *= scalar; - - } else { - - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 0; - - } - - return this; - - }, - - applyMatrix4: function ( m ) { - - var x = this.x, y = this.y, z = this.z, w = this.w; - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w; - this.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w; - - return this; - - }, - - divideScalar: function ( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - }, - - setAxisAngleFromQuaternion: function ( q ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm - - // q is assumed to be normalized - - this.w = 2 * Math.acos( q.w ); - - var s = Math.sqrt( 1 - q.w * q.w ); - - if ( s < 0.0001 ) { - - this.x = 1; - this.y = 0; - this.z = 0; - - } else { - - this.x = q.x / s; - this.y = q.y / s; - this.z = q.z / s; - - } - - return this; - - }, - - setAxisAngleFromRotationMatrix: function ( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var angle, x, y, z, // variables for result - epsilon = 0.01, // margin to allow for rounding errors - epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees - - te = m.elements, - - m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ], - m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ], - m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; - - if ( ( Math.abs( m12 - m21 ) < epsilon ) && - ( Math.abs( m13 - m31 ) < epsilon ) && - ( Math.abs( m23 - m32 ) < epsilon ) ) { - - // singularity found - // first check for identity matrix which must have +1 for all terms - // in leading diagonal and zero in other terms - - if ( ( Math.abs( m12 + m21 ) < epsilon2 ) && - ( Math.abs( m13 + m31 ) < epsilon2 ) && - ( Math.abs( m23 + m32 ) < epsilon2 ) && - ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) { - - // this singularity is identity matrix so angle = 0 - - this.set( 1, 0, 0, 0 ); - - return this; // zero angle, arbitrary axis - - } - - // otherwise this singularity is angle = 180 - - angle = Math.PI; - - var xx = ( m11 + 1 ) / 2; - var yy = ( m22 + 1 ) / 2; - var zz = ( m33 + 1 ) / 2; - var xy = ( m12 + m21 ) / 4; - var xz = ( m13 + m31 ) / 4; - var yz = ( m23 + m32 ) / 4; - - if ( ( xx > yy ) && ( xx > zz ) ) { - - // m11 is the largest diagonal term - - if ( xx < epsilon ) { - - x = 0; - y = 0.707106781; - z = 0.707106781; - - } else { - - x = Math.sqrt( xx ); - y = xy / x; - z = xz / x; - - } - - } else if ( yy > zz ) { - - // m22 is the largest diagonal term - - if ( yy < epsilon ) { - - x = 0.707106781; - y = 0; - z = 0.707106781; - - } else { - - y = Math.sqrt( yy ); - x = xy / y; - z = yz / y; - - } - - } else { - - // m33 is the largest diagonal term so base result on this - - if ( zz < epsilon ) { - - x = 0.707106781; - y = 0.707106781; - z = 0; - - } else { - - z = Math.sqrt( zz ); - x = xz / z; - y = yz / z; - - } - - } - - this.set( x, y, z, angle ); - - return this; // return 180 deg rotation - - } - - // as we have reached here there are no singularities so we can handle normally - - var s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) + - ( m13 - m31 ) * ( m13 - m31 ) + - ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize - - if ( Math.abs( s ) < 0.001 ) s = 1; - - // prevent divide by zero, should not happen if matrix is orthogonal and should be - // caught by singularity test above, but I've left it in just in case - - this.x = ( m32 - m23 ) / s; - this.y = ( m13 - m31 ) / s; - this.z = ( m21 - m12 ) / s; - this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 ); - - return this; - - }, - - min: function ( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - this.z = Math.min( this.z, v.z ); - this.w = Math.min( this.w, v.w ); - - return this; - - }, - - max: function ( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - this.z = Math.max( this.z, v.z ); - this.w = Math.max( this.w, v.w ); - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - this.z = Math.max( min.z, Math.min( max.z, this.z ) ); - this.w = Math.max( min.w, Math.min( max.w, this.w ) ); - - return this; - - }, - - clampScalar: function () { - - var min, max; - - return function clampScalar( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new Vector4(); - max = new Vector4(); - - } - - min.set( minVal, minVal, minVal, minVal ); - max.set( maxVal, maxVal, maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - }(), - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - this.w = Math.floor( this.w ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - this.w = Math.ceil( this.w ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - this.w = Math.round( this.w ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - this.z = - this.z; - this.w = - this.w; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); - - }, - - lengthManhattan: function () { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - setLength: function ( length ) { - - return this.multiplyScalar( length / this.length() ); - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - this.w += ( v.w - this.w ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - this.z = array[ offset + 2 ]; - this.w = array[ offset + 3 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - array[ offset + 2 ] = this.z; - array[ offset + 3 ] = this.w; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - this.z = attribute.array[ index + 2 ]; - this.w = attribute.array[ index + 3 ]; - - return this; - - } - - }; - - /** - * @author szimek / https://github.com/szimek/ - * @author alteredq / http://alteredqualia.com/ - * @author Marius Kintel / https://github.com/kintel - */ - - /* - In options, we can specify: - * Texture parameters for an auto-generated target texture - * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers - */ - function WebGLRenderTarget( width, height, options ) { - - this.uuid = exports.Math.generateUUID(); - - this.width = width; - this.height = height; - - this.scissor = new Vector4( 0, 0, width, height ); - this.scissorTest = false; - - this.viewport = new Vector4( 0, 0, width, height ); - - options = options || {}; - - if ( options.minFilter === undefined ) options.minFilter = LinearFilter; - - this.texture = new Texture( undefined, undefined, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding ); - - this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; - this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true; - this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null; - - } - - Object.assign( WebGLRenderTarget.prototype, EventDispatcher.prototype, { - - isWebGLRenderTarget: true, - - setSize: function ( width, height ) { - - if ( this.width !== width || this.height !== height ) { - - this.width = width; - this.height = height; - - this.dispose(); - - } - - this.viewport.set( 0, 0, width, height ); - this.scissor.set( 0, 0, width, height ); - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.width = source.width; - this.height = source.height; - - this.viewport.copy( source.viewport ); - - this.texture = source.texture.clone(); - - this.depthBuffer = source.depthBuffer; - this.stencilBuffer = source.stencilBuffer; - this.depthTexture = source.depthTexture; - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com - */ - - function WebGLRenderTargetCube( width, height, options ) { - - WebGLRenderTarget.call( this, width, height, options ); - - this.activeCubeFace = 0; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5 - this.activeMipMapLevel = 0; - - } - - WebGLRenderTargetCube.prototype = Object.create( WebGLRenderTarget.prototype ); - WebGLRenderTargetCube.prototype.constructor = WebGLRenderTargetCube; - - WebGLRenderTargetCube.prototype.isWebGLRenderTargetCube = true; - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://clara.io - */ - - function Quaternion( x, y, z, w ) { - - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._w = ( w !== undefined ) ? w : 1; - - } - - Quaternion.prototype = { - - constructor: Quaternion, - - get x () { - - return this._x; - - }, - - set x ( value ) { - - this._x = value; - this.onChangeCallback(); - - }, - - get y () { - - return this._y; - - }, - - set y ( value ) { - - this._y = value; - this.onChangeCallback(); - - }, - - get z () { - - return this._z; - - }, - - set z ( value ) { - - this._z = value; - this.onChangeCallback(); - - }, - - get w () { - - return this._w; - - }, - - set w ( value ) { - - this._w = value; - this.onChangeCallback(); - - }, - - set: function ( x, y, z, w ) { - - this._x = x; - this._y = y; - this._z = z; - this._w = w; - - this.onChangeCallback(); - - return this; - - }, - - clone: function () { - - return new this.constructor( this._x, this._y, this._z, this._w ); - - }, - - copy: function ( quaternion ) { - - this._x = quaternion.x; - this._y = quaternion.y; - this._z = quaternion.z; - this._w = quaternion.w; - - this.onChangeCallback(); - - return this; - - }, - - setFromEuler: function ( euler, update ) { - - if ( (euler && euler.isEuler) === false ) { - - throw new Error( 'THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.' ); - - } - - // http://www.mathworks.com/matlabcentral/fileexchange/ - // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ - // content/SpinCalc.m - - var c1 = Math.cos( euler._x / 2 ); - var c2 = Math.cos( euler._y / 2 ); - var c3 = Math.cos( euler._z / 2 ); - var s1 = Math.sin( euler._x / 2 ); - var s2 = Math.sin( euler._y / 2 ); - var s3 = Math.sin( euler._z / 2 ); - - var order = euler.order; - - if ( order === 'XYZ' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( order === 'YXZ' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } else if ( order === 'ZXY' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( order === 'ZYX' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } else if ( order === 'YZX' ) { - - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - - } else if ( order === 'XZY' ) { - - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - - } - - if ( update !== false ) this.onChangeCallback(); - - return this; - - }, - - setFromAxisAngle: function ( axis, angle ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm - - // assumes axis is normalized - - var halfAngle = angle / 2, s = Math.sin( halfAngle ); - - this._x = axis.x * s; - this._y = axis.y * s; - this._z = axis.z * s; - this._w = Math.cos( halfAngle ); - - this.onChangeCallback(); - - return this; - - }, - - setFromRotationMatrix: function ( m ) { - - // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var te = m.elements, - - m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ], - m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ], - m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ], - - trace = m11 + m22 + m33, - s; - - if ( trace > 0 ) { - - s = 0.5 / Math.sqrt( trace + 1.0 ); - - this._w = 0.25 / s; - this._x = ( m32 - m23 ) * s; - this._y = ( m13 - m31 ) * s; - this._z = ( m21 - m12 ) * s; - - } else if ( m11 > m22 && m11 > m33 ) { - - s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 ); - - this._w = ( m32 - m23 ) / s; - this._x = 0.25 * s; - this._y = ( m12 + m21 ) / s; - this._z = ( m13 + m31 ) / s; - - } else if ( m22 > m33 ) { - - s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 ); - - this._w = ( m13 - m31 ) / s; - this._x = ( m12 + m21 ) / s; - this._y = 0.25 * s; - this._z = ( m23 + m32 ) / s; - - } else { - - s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 ); - - this._w = ( m21 - m12 ) / s; - this._x = ( m13 + m31 ) / s; - this._y = ( m23 + m32 ) / s; - this._z = 0.25 * s; - - } - - this.onChangeCallback(); - - return this; - - }, - - setFromUnitVectors: function () { - - // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final - - // assumes direction vectors vFrom and vTo are normalized - - var v1, r; - - var EPS = 0.000001; - - return function setFromUnitVectors( vFrom, vTo ) { - - if ( v1 === undefined ) v1 = new Vector3(); - - r = vFrom.dot( vTo ) + 1; - - if ( r < EPS ) { - - r = 0; - - if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { - - v1.set( - vFrom.y, vFrom.x, 0 ); - - } else { - - v1.set( 0, - vFrom.z, vFrom.y ); - - } - - } else { - - v1.crossVectors( vFrom, vTo ); - - } - - this._x = v1.x; - this._y = v1.y; - this._z = v1.z; - this._w = r; - - return this.normalize(); - - }; - - }(), - - inverse: function () { - - return this.conjugate().normalize(); - - }, - - conjugate: function () { - - this._x *= - 1; - this._y *= - 1; - this._z *= - 1; - - this.onChangeCallback(); - - return this; - - }, - - dot: function ( v ) { - - return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w; - - }, - - lengthSq: function () { - - return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - - }, - - length: function () { - - return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w ); - - }, - - normalize: function () { - - var l = this.length(); - - if ( l === 0 ) { - - this._x = 0; - this._y = 0; - this._z = 0; - this._w = 1; - - } else { - - l = 1 / l; - - this._x = this._x * l; - this._y = this._y * l; - this._z = this._z * l; - this._w = this._w * l; - - } - - this.onChangeCallback(); - - return this; - - }, - - multiply: function ( q, p ) { - - if ( p !== undefined ) { - - console.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' ); - return this.multiplyQuaternions( q, p ); - - } - - return this.multiplyQuaternions( this, q ); - - }, - - premultiply: function ( q ) { - - return this.multiplyQuaternions( q, this ); - - }, - - multiplyQuaternions: function ( a, b ) { - - // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm - - var qax = a._x, qay = a._y, qaz = a._z, qaw = a._w; - var qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w; - - this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; - this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; - this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; - this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - - this.onChangeCallback(); - - return this; - - }, - - slerp: function ( qb, t ) { - - if ( t === 0 ) return this; - if ( t === 1 ) return this.copy( qb ); - - var x = this._x, y = this._y, z = this._z, w = this._w; - - // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ - - var cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; - - if ( cosHalfTheta < 0 ) { - - this._w = - qb._w; - this._x = - qb._x; - this._y = - qb._y; - this._z = - qb._z; - - cosHalfTheta = - cosHalfTheta; - - } else { - - this.copy( qb ); - - } - - if ( cosHalfTheta >= 1.0 ) { - - this._w = w; - this._x = x; - this._y = y; - this._z = z; - - return this; - - } - - var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); - - if ( Math.abs( sinHalfTheta ) < 0.001 ) { - - this._w = 0.5 * ( w + this._w ); - this._x = 0.5 * ( x + this._x ); - this._y = 0.5 * ( y + this._y ); - this._z = 0.5 * ( z + this._z ); - - return this; - - } - - var halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta ); - var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, - ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; - - this._w = ( w * ratioA + this._w * ratioB ); - this._x = ( x * ratioA + this._x * ratioB ); - this._y = ( y * ratioA + this._y * ratioB ); - this._z = ( z * ratioA + this._z * ratioB ); - - this.onChangeCallback(); - - return this; - - }, - - equals: function ( quaternion ) { - - return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this._x = array[ offset ]; - this._y = array[ offset + 1 ]; - this._z = array[ offset + 2 ]; - this._w = array[ offset + 3 ]; - - this.onChangeCallback(); - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this._x; - array[ offset + 1 ] = this._y; - array[ offset + 2 ] = this._z; - array[ offset + 3 ] = this._w; - - return array; - - }, - - onChange: function ( callback ) { - - this.onChangeCallback = callback; - - return this; - - }, - - onChangeCallback: function () {} - - }; - - Object.assign( Quaternion, { - - slerp: function( qa, qb, qm, t ) { - - return qm.copy( qa ).slerp( qb, t ); - - }, - - slerpFlat: function( - dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) { - - // fuzz-free, array-based Quaternion SLERP operation - - var x0 = src0[ srcOffset0 + 0 ], - y0 = src0[ srcOffset0 + 1 ], - z0 = src0[ srcOffset0 + 2 ], - w0 = src0[ srcOffset0 + 3 ], - - x1 = src1[ srcOffset1 + 0 ], - y1 = src1[ srcOffset1 + 1 ], - z1 = src1[ srcOffset1 + 2 ], - w1 = src1[ srcOffset1 + 3 ]; - - if ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) { - - var s = 1 - t, - - cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, - - dir = ( cos >= 0 ? 1 : - 1 ), - sqrSin = 1 - cos * cos; - - // Skip the Slerp for tiny steps to avoid numeric problems: - if ( sqrSin > Number.EPSILON ) { - - var sin = Math.sqrt( sqrSin ), - len = Math.atan2( sin, cos * dir ); - - s = Math.sin( s * len ) / sin; - t = Math.sin( t * len ) / sin; - - } - - var tDir = t * dir; - - x0 = x0 * s + x1 * tDir; - y0 = y0 * s + y1 * tDir; - z0 = z0 * s + z1 * tDir; - w0 = w0 * s + w1 * tDir; - - // Normalize in case we just did a lerp: - if ( s === 1 - t ) { - - var f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 ); - - x0 *= f; - y0 *= f; - z0 *= f; - w0 *= f; - - } - - } - - dst[ dstOffset ] = x0; - dst[ dstOffset + 1 ] = y0; - dst[ dstOffset + 2 ] = z0; - dst[ dstOffset + 3 ] = w0; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - * @author *kile / http://kile.stravaganza.org/ - * @author philogb / http://blog.thejit.org/ - * @author mikael emtinger / http://gomo.se/ - * @author egraether / http://egraether.com/ - * @author WestLangley / http://github.com/WestLangley - */ - - function Vector3( x, y, z ) { - - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - - } - - Vector3.prototype = { - - constructor: Vector3, - - isVector3: true, - - set: function ( x, y, z ) { - - this.x = x; - this.y = y; - this.z = z; - - return this; - - }, - - setScalar: function ( scalar ) { - - this.x = scalar; - this.y = scalar; - this.z = scalar; - - return this; - - }, - - setX: function ( x ) { - - this.x = x; - - return this; - - }, - - setY: function ( y ) { - - this.y = y; - - return this; - - }, - - setZ: function ( z ) { - - this.z = z; - - return this; - - }, - - setComponent: function ( index, value ) { - - switch ( index ) { - - case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - getComponent: function ( index ) { - - switch ( index ) { - - case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - default: throw new Error( 'index is out of range: ' + index ); - - } - - }, - - clone: function () { - - return new this.constructor( this.x, this.y, this.z ); - - }, - - copy: function ( v ) { - - this.x = v.x; - this.y = v.y; - this.z = v.z; - - return this; - - }, - - add: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' ); - return this.addVectors( v, w ); - - } - - this.x += v.x; - this.y += v.y; - this.z += v.z; - - return this; - - }, - - addScalar: function ( s ) { - - this.x += s; - this.y += s; - this.z += s; - - return this; - - }, - - addVectors: function ( a, b ) { - - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - - return this; - - }, - - addScaledVector: function ( v, s ) { - - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - - return this; - - }, - - sub: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' ); - return this.subVectors( v, w ); - - } - - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - - return this; - - }, - - subScalar: function ( s ) { - - this.x -= s; - this.y -= s; - this.z -= s; - - return this; - - }, - - subVectors: function ( a, b ) { - - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - - return this; - - }, - - multiply: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' ); - return this.multiplyVectors( v, w ); - - } - - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - - return this; - - }, - - multiplyScalar: function ( scalar ) { - - if ( isFinite( scalar ) ) { - - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - - } else { - - this.x = 0; - this.y = 0; - this.z = 0; - - } - - return this; - - }, - - multiplyVectors: function ( a, b ) { - - this.x = a.x * b.x; - this.y = a.y * b.y; - this.z = a.z * b.z; - - return this; - - }, - - applyEuler: function () { - - var quaternion; - - return function applyEuler( euler ) { - - if ( (euler && euler.isEuler) === false ) { - - console.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' ); - - } - - if ( quaternion === undefined ) quaternion = new Quaternion(); - - return this.applyQuaternion( quaternion.setFromEuler( euler ) ); - - }; - - }(), - - applyAxisAngle: function () { - - var quaternion; - - return function applyAxisAngle( axis, angle ) { - - if ( quaternion === undefined ) quaternion = new Quaternion(); - - return this.applyQuaternion( quaternion.setFromAxisAngle( axis, angle ) ); - - }; - - }(), - - applyMatrix3: function ( m ) { - - var x = this.x, y = this.y, z = this.z; - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z; - this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z; - this.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z; - - return this; - - }, - - applyMatrix4: function ( m ) { - - // input: THREE.Matrix4 affine matrix - - var x = this.x, y = this.y, z = this.z; - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ]; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ]; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ]; - - return this; - - }, - - applyProjection: function ( m ) { - - // input: THREE.Matrix4 projection matrix - - var x = this.x, y = this.y, z = this.z; - var e = m.elements; - var d = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] ); // perspective divide - - this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * d; - this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * d; - this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * d; - - return this; - - }, - - applyQuaternion: function ( q ) { - - var x = this.x, y = this.y, z = this.z; - var qx = q.x, qy = q.y, qz = q.z, qw = q.w; - - // calculate quat * vector - - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = - qx * x - qy * y - qz * z; - - // calculate result * inverse quat - - this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; - this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; - this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; - - return this; - - }, - - project: function () { - - var matrix; - - return function project( camera ) { - - if ( matrix === undefined ) matrix = new Matrix4(); - - matrix.multiplyMatrices( camera.projectionMatrix, matrix.getInverse( camera.matrixWorld ) ); - return this.applyProjection( matrix ); - - }; - - }(), - - unproject: function () { - - var matrix; - - return function unproject( camera ) { - - if ( matrix === undefined ) matrix = new Matrix4(); - - matrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) ); - return this.applyProjection( matrix ); - - }; - - }(), - - transformDirection: function ( m ) { - - // input: THREE.Matrix4 affine matrix - // vector interpreted as a direction - - var x = this.x, y = this.y, z = this.z; - var e = m.elements; - - this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z; - this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z; - this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z; - - return this.normalize(); - - }, - - divide: function ( v ) { - - this.x /= v.x; - this.y /= v.y; - this.z /= v.z; - - return this; - - }, - - divideScalar: function ( scalar ) { - - return this.multiplyScalar( 1 / scalar ); - - }, - - min: function ( v ) { - - this.x = Math.min( this.x, v.x ); - this.y = Math.min( this.y, v.y ); - this.z = Math.min( this.z, v.z ); - - return this; - - }, - - max: function ( v ) { - - this.x = Math.max( this.x, v.x ); - this.y = Math.max( this.y, v.y ); - this.z = Math.max( this.z, v.z ); - - return this; - - }, - - clamp: function ( min, max ) { - - // This function assumes min < max, if this assumption isn't true it will not operate correctly - - this.x = Math.max( min.x, Math.min( max.x, this.x ) ); - this.y = Math.max( min.y, Math.min( max.y, this.y ) ); - this.z = Math.max( min.z, Math.min( max.z, this.z ) ); - - return this; - - }, - - clampScalar: function () { - - var min, max; - - return function clampScalar( minVal, maxVal ) { - - if ( min === undefined ) { - - min = new Vector3(); - max = new Vector3(); - - } - - min.set( minVal, minVal, minVal ); - max.set( maxVal, maxVal, maxVal ); - - return this.clamp( min, max ); - - }; - - }(), - - clampLength: function ( min, max ) { - - var length = this.length(); - - return this.multiplyScalar( Math.max( min, Math.min( max, length ) ) / length ); - - }, - - floor: function () { - - this.x = Math.floor( this.x ); - this.y = Math.floor( this.y ); - this.z = Math.floor( this.z ); - - return this; - - }, - - ceil: function () { - - this.x = Math.ceil( this.x ); - this.y = Math.ceil( this.y ); - this.z = Math.ceil( this.z ); - - return this; - - }, - - round: function () { - - this.x = Math.round( this.x ); - this.y = Math.round( this.y ); - this.z = Math.round( this.z ); - - return this; - - }, - - roundToZero: function () { - - this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x ); - this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y ); - this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z ); - - return this; - - }, - - negate: function () { - - this.x = - this.x; - this.y = - this.y; - this.z = - this.z; - - return this; - - }, - - dot: function ( v ) { - - return this.x * v.x + this.y * v.y + this.z * v.z; - - }, - - lengthSq: function () { - - return this.x * this.x + this.y * this.y + this.z * this.z; - - }, - - length: function () { - - return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); - - }, - - lengthManhattan: function () { - - return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ); - - }, - - normalize: function () { - - return this.divideScalar( this.length() ); - - }, - - setLength: function ( length ) { - - return this.multiplyScalar( length / this.length() ); - - }, - - lerp: function ( v, alpha ) { - - this.x += ( v.x - this.x ) * alpha; - this.y += ( v.y - this.y ) * alpha; - this.z += ( v.z - this.z ) * alpha; - - return this; - - }, - - lerpVectors: function ( v1, v2, alpha ) { - - return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 ); - - }, - - cross: function ( v, w ) { - - if ( w !== undefined ) { - - console.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' ); - return this.crossVectors( v, w ); - - } - - var x = this.x, y = this.y, z = this.z; - - this.x = y * v.z - z * v.y; - this.y = z * v.x - x * v.z; - this.z = x * v.y - y * v.x; - - return this; - - }, - - crossVectors: function ( a, b ) { - - var ax = a.x, ay = a.y, az = a.z; - var bx = b.x, by = b.y, bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - - }, - - projectOnVector: function ( vector ) { - - var scalar = vector.dot( this ) / vector.lengthSq(); - - return this.copy( vector ).multiplyScalar( scalar ); - - }, - - projectOnPlane: function () { - - var v1; - - return function projectOnPlane( planeNormal ) { - - if ( v1 === undefined ) v1 = new Vector3(); - - v1.copy( this ).projectOnVector( planeNormal ); - - return this.sub( v1 ); - - }; - - }(), - - reflect: function () { - - // reflect incident vector off plane orthogonal to normal - // normal is assumed to have unit length - - var v1; - - return function reflect( normal ) { - - if ( v1 === undefined ) v1 = new Vector3(); - - return this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) ); - - }; - - }(), - - angleTo: function ( v ) { - - var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) ); - - // clamp, to handle numerical problems - - return Math.acos( exports.Math.clamp( theta, - 1, 1 ) ); - - }, - - distanceTo: function ( v ) { - - return Math.sqrt( this.distanceToSquared( v ) ); - - }, - - distanceToSquared: function ( v ) { - - var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; - - return dx * dx + dy * dy + dz * dz; - - }, - - distanceToManhattan: function ( v ) { - - return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z ); - - }, - - setFromSpherical: function( s ) { - - var sinPhiRadius = Math.sin( s.phi ) * s.radius; - - this.x = sinPhiRadius * Math.sin( s.theta ); - this.y = Math.cos( s.phi ) * s.radius; - this.z = sinPhiRadius * Math.cos( s.theta ); - - return this; - - }, - - setFromMatrixPosition: function ( m ) { - - return this.setFromMatrixColumn( m, 3 ); - - }, - - setFromMatrixScale: function ( m ) { - - var sx = this.setFromMatrixColumn( m, 0 ).length(); - var sy = this.setFromMatrixColumn( m, 1 ).length(); - var sz = this.setFromMatrixColumn( m, 2 ).length(); - - this.x = sx; - this.y = sy; - this.z = sz; - - return this; - - }, - - setFromMatrixColumn: function ( m, index ) { - - if ( typeof m === 'number' ) { - - console.warn( 'THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).' ); - var temp = m - m = index; - index = temp; - - } - - return this.fromArray( m.elements, index * 4 ); - - }, - - equals: function ( v ) { - - return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.x = array[ offset ]; - this.y = array[ offset + 1 ]; - this.z = array[ offset + 2 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.x; - array[ offset + 1 ] = this.y; - array[ offset + 2 ] = this.z; - - return array; - - }, - - fromAttribute: function ( attribute, index, offset ) { - - if ( offset === undefined ) offset = 0; - - index = index * attribute.itemSize + offset; - - this.x = attribute.array[ index ]; - this.y = attribute.array[ index + 1 ]; - this.z = attribute.array[ index + 2 ]; - - return this; - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author philogb / http://blog.thejit.org/ - * @author jordi_ros / http://plattsoft.com - * @author D1plo1d / http://github.com/D1plo1d - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author timknip / http://www.floorplanner.com/ - * @author bhouston / http://clara.io - * @author WestLangley / http://github.com/WestLangley - */ - - function Matrix4() { - - this.elements = new Float32Array( [ - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ] ); - - if ( arguments.length > 0 ) { - - console.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' ); - - } - - } - - Matrix4.prototype = { - - constructor: Matrix4, - - isMatrix4: true, - - set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) { - - var te = this.elements; - - te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14; - te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24; - te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34; - te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44; - - return this; - - }, - - identity: function () { - - this.set( - - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - clone: function () { - - return new Matrix4().fromArray( this.elements ); - - }, - - copy: function ( m ) { - - this.elements.set( m.elements ); - - return this; - - }, - - copyPosition: function ( m ) { - - var te = this.elements; - var me = m.elements; - - te[ 12 ] = me[ 12 ]; - te[ 13 ] = me[ 13 ]; - te[ 14 ] = me[ 14 ]; - - return this; - - }, - - extractBasis: function ( xAxis, yAxis, zAxis ) { - - xAxis.setFromMatrixColumn( this, 0 ); - yAxis.setFromMatrixColumn( this, 1 ); - zAxis.setFromMatrixColumn( this, 2 ); - - return this; - - }, - - makeBasis: function ( xAxis, yAxis, zAxis ) { - - this.set( - xAxis.x, yAxis.x, zAxis.x, 0, - xAxis.y, yAxis.y, zAxis.y, 0, - xAxis.z, yAxis.z, zAxis.z, 0, - 0, 0, 0, 1 - ); - - return this; - - }, - - extractRotation: function () { - - var v1; - - return function extractRotation( m ) { - - if ( v1 === undefined ) v1 = new Vector3(); - - var te = this.elements; - var me = m.elements; - - var scaleX = 1 / v1.setFromMatrixColumn( m, 0 ).length(); - var scaleY = 1 / v1.setFromMatrixColumn( m, 1 ).length(); - var scaleZ = 1 / v1.setFromMatrixColumn( m, 2 ).length(); - - te[ 0 ] = me[ 0 ] * scaleX; - te[ 1 ] = me[ 1 ] * scaleX; - te[ 2 ] = me[ 2 ] * scaleX; - - te[ 4 ] = me[ 4 ] * scaleY; - te[ 5 ] = me[ 5 ] * scaleY; - te[ 6 ] = me[ 6 ] * scaleY; - - te[ 8 ] = me[ 8 ] * scaleZ; - te[ 9 ] = me[ 9 ] * scaleZ; - te[ 10 ] = me[ 10 ] * scaleZ; - - return this; - - }; - - }(), - - makeRotationFromEuler: function ( euler ) { - - if ( (euler && euler.isEuler) === false ) { - - console.error( 'THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' ); - - } - - var te = this.elements; - - var x = euler.x, y = euler.y, z = euler.z; - var a = Math.cos( x ), b = Math.sin( x ); - var c = Math.cos( y ), d = Math.sin( y ); - var e = Math.cos( z ), f = Math.sin( z ); - - if ( euler.order === 'XYZ' ) { - - var ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[ 0 ] = c * e; - te[ 4 ] = - c * f; - te[ 8 ] = d; - - te[ 1 ] = af + be * d; - te[ 5 ] = ae - bf * d; - te[ 9 ] = - b * c; - - te[ 2 ] = bf - ae * d; - te[ 6 ] = be + af * d; - te[ 10 ] = a * c; - - } else if ( euler.order === 'YXZ' ) { - - var ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[ 0 ] = ce + df * b; - te[ 4 ] = de * b - cf; - te[ 8 ] = a * d; - - te[ 1 ] = a * f; - te[ 5 ] = a * e; - te[ 9 ] = - b; - - te[ 2 ] = cf * b - de; - te[ 6 ] = df + ce * b; - te[ 10 ] = a * c; - - } else if ( euler.order === 'ZXY' ) { - - var ce = c * e, cf = c * f, de = d * e, df = d * f; - - te[ 0 ] = ce - df * b; - te[ 4 ] = - a * f; - te[ 8 ] = de + cf * b; - - te[ 1 ] = cf + de * b; - te[ 5 ] = a * e; - te[ 9 ] = df - ce * b; - - te[ 2 ] = - a * d; - te[ 6 ] = b; - te[ 10 ] = a * c; - - } else if ( euler.order === 'ZYX' ) { - - var ae = a * e, af = a * f, be = b * e, bf = b * f; - - te[ 0 ] = c * e; - te[ 4 ] = be * d - af; - te[ 8 ] = ae * d + bf; - - te[ 1 ] = c * f; - te[ 5 ] = bf * d + ae; - te[ 9 ] = af * d - be; - - te[ 2 ] = - d; - te[ 6 ] = b * c; - te[ 10 ] = a * c; - - } else if ( euler.order === 'YZX' ) { - - var ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[ 0 ] = c * e; - te[ 4 ] = bd - ac * f; - te[ 8 ] = bc * f + ad; - - te[ 1 ] = f; - te[ 5 ] = a * e; - te[ 9 ] = - b * e; - - te[ 2 ] = - d * e; - te[ 6 ] = ad * f + bc; - te[ 10 ] = ac - bd * f; - - } else if ( euler.order === 'XZY' ) { - - var ac = a * c, ad = a * d, bc = b * c, bd = b * d; - - te[ 0 ] = c * e; - te[ 4 ] = - f; - te[ 8 ] = d * e; - - te[ 1 ] = ac * f + bd; - te[ 5 ] = a * e; - te[ 9 ] = ad * f - bc; - - te[ 2 ] = bc * f - ad; - te[ 6 ] = b * e; - te[ 10 ] = bd * f + ac; - - } - - // last column - te[ 3 ] = 0; - te[ 7 ] = 0; - te[ 11 ] = 0; - - // bottom row - te[ 12 ] = 0; - te[ 13 ] = 0; - te[ 14 ] = 0; - te[ 15 ] = 1; - - return this; - - }, - - makeRotationFromQuaternion: function ( q ) { - - var te = this.elements; - - var x = q.x, y = q.y, z = q.z, w = q.w; - var x2 = x + x, y2 = y + y, z2 = z + z; - var xx = x * x2, xy = x * y2, xz = x * z2; - var yy = y * y2, yz = y * z2, zz = z * z2; - var wx = w * x2, wy = w * y2, wz = w * z2; - - te[ 0 ] = 1 - ( yy + zz ); - te[ 4 ] = xy - wz; - te[ 8 ] = xz + wy; - - te[ 1 ] = xy + wz; - te[ 5 ] = 1 - ( xx + zz ); - te[ 9 ] = yz - wx; - - te[ 2 ] = xz - wy; - te[ 6 ] = yz + wx; - te[ 10 ] = 1 - ( xx + yy ); - - // last column - te[ 3 ] = 0; - te[ 7 ] = 0; - te[ 11 ] = 0; - - // bottom row - te[ 12 ] = 0; - te[ 13 ] = 0; - te[ 14 ] = 0; - te[ 15 ] = 1; - - return this; - - }, - - lookAt: function () { - - var x, y, z; - - return function lookAt( eye, target, up ) { - - if ( x === undefined ) { - - x = new Vector3(); - y = new Vector3(); - z = new Vector3(); - - } - - var te = this.elements; - - z.subVectors( eye, target ).normalize(); - - if ( z.lengthSq() === 0 ) { - - z.z = 1; - - } - - x.crossVectors( up, z ).normalize(); - - if ( x.lengthSq() === 0 ) { - - z.z += 0.0001; - x.crossVectors( up, z ).normalize(); - - } - - y.crossVectors( z, x ); - - - te[ 0 ] = x.x; te[ 4 ] = y.x; te[ 8 ] = z.x; - te[ 1 ] = x.y; te[ 5 ] = y.y; te[ 9 ] = z.y; - te[ 2 ] = x.z; te[ 6 ] = y.z; te[ 10 ] = z.z; - - return this; - - }; - - }(), - - multiply: function ( m, n ) { - - if ( n !== undefined ) { - - console.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' ); - return this.multiplyMatrices( m, n ); - - } - - return this.multiplyMatrices( this, m ); - - }, - - premultiply: function ( m ) { - - return this.multiplyMatrices( m, this ); - - }, - - multiplyMatrices: function ( a, b ) { - - var ae = a.elements; - var be = b.elements; - var te = this.elements; - - var a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ]; - var a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ]; - var a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ]; - var a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ]; - - var b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ]; - var b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ]; - var b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ]; - var b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ]; - - te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; - te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; - te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; - te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44; - - te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41; - te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42; - te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43; - te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44; - - te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41; - te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42; - te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43; - te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44; - - te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41; - te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42; - te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; - te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; - - return this; - - }, - - multiplyToArray: function ( a, b, r ) { - - var te = this.elements; - - this.multiplyMatrices( a, b ); - - r[ 0 ] = te[ 0 ]; r[ 1 ] = te[ 1 ]; r[ 2 ] = te[ 2 ]; r[ 3 ] = te[ 3 ]; - r[ 4 ] = te[ 4 ]; r[ 5 ] = te[ 5 ]; r[ 6 ] = te[ 6 ]; r[ 7 ] = te[ 7 ]; - r[ 8 ] = te[ 8 ]; r[ 9 ] = te[ 9 ]; r[ 10 ] = te[ 10 ]; r[ 11 ] = te[ 11 ]; - r[ 12 ] = te[ 12 ]; r[ 13 ] = te[ 13 ]; r[ 14 ] = te[ 14 ]; r[ 15 ] = te[ 15 ]; - - return this; - - }, - - multiplyScalar: function ( s ) { - - var te = this.elements; - - te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s; - te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s; - te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s; - te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s; - - return this; - - }, - - applyToVector3Array: function () { - - var v1; - - return function applyToVector3Array( array, offset, length ) { - - if ( v1 === undefined ) v1 = new Vector3(); - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = array.length; - - for ( var i = 0, j = offset; i < length; i += 3, j += 3 ) { - - v1.fromArray( array, j ); - v1.applyMatrix4( this ); - v1.toArray( array, j ); - - } - - return array; - - }; - - }(), - - applyToBuffer: function () { - - var v1; - - return function applyToBuffer( buffer, offset, length ) { - - if ( v1 === undefined ) v1 = new Vector3(); - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = buffer.length / buffer.itemSize; - - for ( var i = 0, j = offset; i < length; i ++, j ++ ) { - - v1.x = buffer.getX( j ); - v1.y = buffer.getY( j ); - v1.z = buffer.getZ( j ); - - v1.applyMatrix4( this ); - - buffer.setXYZ( v1.x, v1.y, v1.z ); - - } - - return buffer; - - }; - - }(), - - determinant: function () { - - var te = this.elements; - - var n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ]; - var n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ]; - var n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ]; - var n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ]; - - //TODO: make this more efficient - //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm ) - - return ( - n41 * ( - + n14 * n23 * n32 - - n13 * n24 * n32 - - n14 * n22 * n33 - + n12 * n24 * n33 - + n13 * n22 * n34 - - n12 * n23 * n34 - ) + - n42 * ( - + n11 * n23 * n34 - - n11 * n24 * n33 - + n14 * n21 * n33 - - n13 * n21 * n34 - + n13 * n24 * n31 - - n14 * n23 * n31 - ) + - n43 * ( - + n11 * n24 * n32 - - n11 * n22 * n34 - - n14 * n21 * n32 - + n12 * n21 * n34 - + n14 * n22 * n31 - - n12 * n24 * n31 - ) + - n44 * ( - - n13 * n22 * n31 - - n11 * n23 * n32 - + n11 * n22 * n33 - + n13 * n21 * n32 - - n12 * n21 * n33 - + n12 * n23 * n31 - ) - - ); - - }, - - transpose: function () { - - var te = this.elements; - var tmp; - - tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp; - tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp; - tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp; - - tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp; - tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp; - tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp; - - return this; - - }, - - flattenToArrayOffset: function ( array, offset ) { - - console.warn( "THREE.Matrix3: .flattenToArrayOffset is deprecated " + - "- just use .toArray instead." ); - - return this.toArray( array, offset ); - - }, - - getPosition: function () { - - var v1; - - return function getPosition() { - - if ( v1 === undefined ) v1 = new Vector3(); - console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' ); - - return v1.setFromMatrixColumn( this, 3 ); - - }; - - }(), - - setPosition: function ( v ) { - - var te = this.elements; - - te[ 12 ] = v.x; - te[ 13 ] = v.y; - te[ 14 ] = v.z; - - return this; - - }, - - getInverse: function ( m, throwOnDegenerate ) { - - // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm - var te = this.elements, - me = m.elements, - - n11 = me[ 0 ], n21 = me[ 1 ], n31 = me[ 2 ], n41 = me[ 3 ], - n12 = me[ 4 ], n22 = me[ 5 ], n32 = me[ 6 ], n42 = me[ 7 ], - n13 = me[ 8 ], n23 = me[ 9 ], n33 = me[ 10 ], n43 = me[ 11 ], - n14 = me[ 12 ], n24 = me[ 13 ], n34 = me[ 14 ], n44 = me[ 15 ], - - t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, - t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, - t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, - t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; - - var det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14; - - if ( det === 0 ) { - - var msg = "THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"; - - if ( throwOnDegenerate === true ) { - - throw new Error( msg ); - - } else { - - console.warn( msg ); - - } - - return this.identity(); - - } - - var detInv = 1 / det; - - te[ 0 ] = t11 * detInv; - te[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv; - te[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv; - te[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv; - - te[ 4 ] = t12 * detInv; - te[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv; - te[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv; - te[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv; - - te[ 8 ] = t13 * detInv; - te[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv; - te[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv; - te[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv; - - te[ 12 ] = t14 * detInv; - te[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv; - te[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv; - te[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv; - - return this; - - }, - - scale: function ( v ) { - - var te = this.elements; - var x = v.x, y = v.y, z = v.z; - - te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z; - te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z; - te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z; - te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z; - - return this; - - }, - - getMaxScaleOnAxis: function () { - - var te = this.elements; - - var scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ]; - var scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ]; - var scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ]; - - return Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) ); - - }, - - makeTranslation: function ( x, y, z ) { - - this.set( - - 1, 0, 0, x, - 0, 1, 0, y, - 0, 0, 1, z, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationX: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - 1, 0, 0, 0, - 0, c, - s, 0, - 0, s, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationY: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, 0, s, 0, - 0, 1, 0, 0, - - s, 0, c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationZ: function ( theta ) { - - var c = Math.cos( theta ), s = Math.sin( theta ); - - this.set( - - c, - s, 0, 0, - s, c, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeRotationAxis: function ( axis, angle ) { - - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - var c = Math.cos( angle ); - var s = Math.sin( angle ); - var t = 1 - c; - var x = axis.x, y = axis.y, z = axis.z; - var tx = t * x, ty = t * y; - - this.set( - - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - makeScale: function ( x, y, z ) { - - this.set( - - x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - 0, 0, 0, 1 - - ); - - return this; - - }, - - compose: function ( position, quaternion, scale ) { - - this.makeRotationFromQuaternion( quaternion ); - this.scale( scale ); - this.setPosition( position ); - - return this; - - }, - - decompose: function () { - - var vector, matrix; - - return function decompose( position, quaternion, scale ) { - - if ( vector === undefined ) { - - vector = new Vector3(); - matrix = new Matrix4(); - - } - - var te = this.elements; - - var sx = vector.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length(); - var sy = vector.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length(); - var sz = vector.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length(); - - // if determine is negative, we need to invert one scale - var det = this.determinant(); - if ( det < 0 ) { - - sx = - sx; - - } - - position.x = te[ 12 ]; - position.y = te[ 13 ]; - position.z = te[ 14 ]; - - // scale the rotation part - - matrix.elements.set( this.elements ); // at this point matrix is incomplete so we can't use .copy() - - var invSX = 1 / sx; - var invSY = 1 / sy; - var invSZ = 1 / sz; - - matrix.elements[ 0 ] *= invSX; - matrix.elements[ 1 ] *= invSX; - matrix.elements[ 2 ] *= invSX; - - matrix.elements[ 4 ] *= invSY; - matrix.elements[ 5 ] *= invSY; - matrix.elements[ 6 ] *= invSY; - - matrix.elements[ 8 ] *= invSZ; - matrix.elements[ 9 ] *= invSZ; - matrix.elements[ 10 ] *= invSZ; - - quaternion.setFromRotationMatrix( matrix ); - - scale.x = sx; - scale.y = sy; - scale.z = sz; - - return this; - - }; - - }(), - - makeFrustum: function ( left, right, bottom, top, near, far ) { - - var te = this.elements; - var x = 2 * near / ( right - left ); - var y = 2 * near / ( top - bottom ); - - var a = ( right + left ) / ( right - left ); - var b = ( top + bottom ) / ( top - bottom ); - var c = - ( far + near ) / ( far - near ); - var d = - 2 * far * near / ( far - near ); - - te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0; - te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0; - te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d; - te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0; - - return this; - - }, - - makePerspective: function ( fov, aspect, near, far ) { - - var ymax = near * Math.tan( exports.Math.DEG2RAD * fov * 0.5 ); - var ymin = - ymax; - var xmin = ymin * aspect; - var xmax = ymax * aspect; - - return this.makeFrustum( xmin, xmax, ymin, ymax, near, far ); - - }, - - makeOrthographic: function ( left, right, top, bottom, near, far ) { - - var te = this.elements; - var w = 1.0 / ( right - left ); - var h = 1.0 / ( top - bottom ); - var p = 1.0 / ( far - near ); - - var x = ( right + left ) * w; - var y = ( top + bottom ) * h; - var z = ( far + near ) * p; - - te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x; - te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y; - te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z; - te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1; - - return this; - - }, - - equals: function ( matrix ) { - - var te = this.elements; - var me = matrix.elements; - - for ( var i = 0; i < 16; i ++ ) { - - if ( te[ i ] !== me[ i ] ) return false; - - } - - return true; - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - for( var i = 0; i < 16; i ++ ) { - - this.elements[ i ] = array[ i + offset ]; - - } - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - var te = this.elements; - - array[ offset ] = te[ 0 ]; - array[ offset + 1 ] = te[ 1 ]; - array[ offset + 2 ] = te[ 2 ]; - array[ offset + 3 ] = te[ 3 ]; - - array[ offset + 4 ] = te[ 4 ]; - array[ offset + 5 ] = te[ 5 ]; - array[ offset + 6 ] = te[ 6 ]; - array[ offset + 7 ] = te[ 7 ]; - - array[ offset + 8 ] = te[ 8 ]; - array[ offset + 9 ] = te[ 9 ]; - array[ offset + 10 ] = te[ 10 ]; - array[ offset + 11 ] = te[ 11 ]; - - array[ offset + 12 ] = te[ 12 ]; - array[ offset + 13 ] = te[ 13 ]; - array[ offset + 14 ] = te[ 14 ]; - array[ offset + 15 ] = te[ 15 ]; - - return array; - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function CubeTexture( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) { - - images = images !== undefined ? images : []; - mapping = mapping !== undefined ? mapping : CubeReflectionMapping; - - Texture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - this.flipY = false; - - } - - CubeTexture.prototype = Object.create( Texture.prototype ); - CubeTexture.prototype.constructor = CubeTexture; - - CubeTexture.prototype.isCubeTexture = true; - - Object.defineProperty( CubeTexture.prototype, 'images', { - - get: function () { - - return this.image; - - }, - - set: function ( value ) { - - this.image = value; - - } - - } ); - - var emptyTexture = new Texture(); - var emptyCubeTexture = new CubeTexture(); - - // --- Base for inner nodes (including the root) --- - - function UniformContainer() { - - this.seq = []; - this.map = {}; - - } - - // --- Utilities --- - - // Array Caches (provide typed arrays for temporary by size) - - var arrayCacheF32 = []; - var arrayCacheI32 = []; - - // Flattening for arrays of vectors and matrices - - function flatten( array, nBlocks, blockSize ) { - - var firstElem = array[ 0 ]; - - if ( firstElem <= 0 || firstElem > 0 ) return array; - // unoptimized: ! isNaN( firstElem ) - // see http://jacksondunstan.com/articles/983 - - var n = nBlocks * blockSize, - r = arrayCacheF32[ n ]; - - if ( r === undefined ) { - - r = new Float32Array( n ); - arrayCacheF32[ n ] = r; - - } - - if ( nBlocks !== 0 ) { - - firstElem.toArray( r, 0 ); - - for ( var i = 1, offset = 0; i !== nBlocks; ++ i ) { - - offset += blockSize; - array[ i ].toArray( r, offset ); - - } - - } - - return r; - - } - - // Texture unit allocation - - function allocTexUnits( renderer, n ) { - - var r = arrayCacheI32[ n ]; - - if ( r === undefined ) { - - r = new Int32Array( n ); - arrayCacheI32[ n ] = r; - - } - - for ( var i = 0; i !== n; ++ i ) - r[ i ] = renderer.allocTextureUnit(); - - return r; - - } - - // --- Setters --- - - // Note: Defining these methods externally, because they come in a bunch - // and this way their names minify. - - // Single scalar - - function setValue1f( gl, v ) { gl.uniform1f( this.addr, v ); } - function setValue1i( gl, v ) { gl.uniform1i( this.addr, v ); } - - // Single float vector (from flat array or THREE.VectorN) - - function setValue2fv( gl, v ) { - - if ( v.x === undefined ) gl.uniform2fv( this.addr, v ); - else gl.uniform2f( this.addr, v.x, v.y ); - - } - - function setValue3fv( gl, v ) { - - if ( v.x !== undefined ) - gl.uniform3f( this.addr, v.x, v.y, v.z ); - else if ( v.r !== undefined ) - gl.uniform3f( this.addr, v.r, v.g, v.b ); - else - gl.uniform3fv( this.addr, v ); - - } - - function setValue4fv( gl, v ) { - - if ( v.x === undefined ) gl.uniform4fv( this.addr, v ); - else gl.uniform4f( this.addr, v.x, v.y, v.z, v.w ); - - } - - // Single matrix (from flat array or MatrixN) - - function setValue2fm( gl, v ) { - - gl.uniformMatrix2fv( this.addr, false, v.elements || v ); - - } - - function setValue3fm( gl, v ) { - - gl.uniformMatrix3fv( this.addr, false, v.elements || v ); - - } - - function setValue4fm( gl, v ) { - - gl.uniformMatrix4fv( this.addr, false, v.elements || v ); - - } - - // Single texture (2D / Cube) - - function setValueT1( gl, v, renderer ) { - - var unit = renderer.allocTextureUnit(); - gl.uniform1i( this.addr, unit ); - renderer.setTexture2D( v || emptyTexture, unit ); - - } - - function setValueT6( gl, v, renderer ) { - - var unit = renderer.allocTextureUnit(); - gl.uniform1i( this.addr, unit ); - renderer.setTextureCube( v || emptyCubeTexture, unit ); - - } - - // Integer / Boolean vectors or arrays thereof (always flat arrays) - - function setValue2iv( gl, v ) { gl.uniform2iv( this.addr, v ); } - function setValue3iv( gl, v ) { gl.uniform3iv( this.addr, v ); } - function setValue4iv( gl, v ) { gl.uniform4iv( this.addr, v ); } - - // Helper to pick the right setter for the singular case - - function getSingularSetter( type ) { - - switch ( type ) { - - case 0x1406: return setValue1f; // FLOAT - case 0x8b50: return setValue2fv; // _VEC2 - case 0x8b51: return setValue3fv; // _VEC3 - case 0x8b52: return setValue4fv; // _VEC4 - - case 0x8b5a: return setValue2fm; // _MAT2 - case 0x8b5b: return setValue3fm; // _MAT3 - case 0x8b5c: return setValue4fm; // _MAT4 - - case 0x8b5e: return setValueT1; // SAMPLER_2D - case 0x8b60: return setValueT6; // SAMPLER_CUBE - - case 0x1404: case 0x8b56: return setValue1i; // INT, BOOL - case 0x8b53: case 0x8b57: return setValue2iv; // _VEC2 - case 0x8b54: case 0x8b58: return setValue3iv; // _VEC3 - case 0x8b55: case 0x8b59: return setValue4iv; // _VEC4 - - } - - } - - // Array of scalars - - function setValue1fv( gl, v ) { gl.uniform1fv( this.addr, v ); } - function setValue1iv( gl, v ) { gl.uniform1iv( this.addr, v ); } - - // Array of vectors (flat or from THREE classes) - - function setValueV2a( gl, v ) { - - gl.uniform2fv( this.addr, flatten( v, this.size, 2 ) ); - - } - - function setValueV3a( gl, v ) { - - gl.uniform3fv( this.addr, flatten( v, this.size, 3 ) ); - - } - - function setValueV4a( gl, v ) { - - gl.uniform4fv( this.addr, flatten( v, this.size, 4 ) ); - - } - - // Array of matrices (flat or from THREE clases) - - function setValueM2a( gl, v ) { - - gl.uniformMatrix2fv( this.addr, false, flatten( v, this.size, 4 ) ); - - } - - function setValueM3a( gl, v ) { - - gl.uniformMatrix3fv( this.addr, false, flatten( v, this.size, 9 ) ); - - } - - function setValueM4a( gl, v ) { - - gl.uniformMatrix4fv( this.addr, false, flatten( v, this.size, 16 ) ); - - } - - // Array of textures (2D / Cube) - - function setValueT1a( gl, v, renderer ) { - - var n = v.length, - units = allocTexUnits( renderer, n ); - - gl.uniform1iv( this.addr, units ); - - for ( var i = 0; i !== n; ++ i ) { - - renderer.setTexture2D( v[ i ] || emptyTexture, units[ i ] ); - - } - - } - - function setValueT6a( gl, v, renderer ) { - - var n = v.length, - units = allocTexUnits( renderer, n ); - - gl.uniform1iv( this.addr, units ); - - for ( var i = 0; i !== n; ++ i ) { - - renderer.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] ); - - } - - } - - // Helper to pick the right setter for a pure (bottom-level) array - - function getPureArraySetter( type ) { - - switch ( type ) { - - case 0x1406: return setValue1fv; // FLOAT - case 0x8b50: return setValueV2a; // _VEC2 - case 0x8b51: return setValueV3a; // _VEC3 - case 0x8b52: return setValueV4a; // _VEC4 - - case 0x8b5a: return setValueM2a; // _MAT2 - case 0x8b5b: return setValueM3a; // _MAT3 - case 0x8b5c: return setValueM4a; // _MAT4 - - case 0x8b5e: return setValueT1a; // SAMPLER_2D - case 0x8b60: return setValueT6a; // SAMPLER_CUBE - - case 0x1404: case 0x8b56: return setValue1iv; // INT, BOOL - case 0x8b53: case 0x8b57: return setValue2iv; // _VEC2 - case 0x8b54: case 0x8b58: return setValue3iv; // _VEC3 - case 0x8b55: case 0x8b59: return setValue4iv; // _VEC4 - - } - - } - - // --- Uniform Classes --- - - function SingleUniform( id, activeInfo, addr ) { - - this.id = id; - this.addr = addr; - this.setValue = getSingularSetter( activeInfo.type ); - - // this.path = activeInfo.name; // DEBUG - - } - - function PureArrayUniform( id, activeInfo, addr ) { - - this.id = id; - this.addr = addr; - this.size = activeInfo.size; - this.setValue = getPureArraySetter( activeInfo.type ); - - // this.path = activeInfo.name; // DEBUG - - } - - function StructuredUniform( id ) { - - this.id = id; - - UniformContainer.call( this ); // mix-in - - } - - StructuredUniform.prototype.setValue = function( gl, value ) { - - // Note: Don't need an extra 'renderer' parameter, since samplers - // are not allowed in structured uniforms. - - var seq = this.seq; - - for ( var i = 0, n = seq.length; i !== n; ++ i ) { - - var u = seq[ i ]; - u.setValue( gl, value[ u.id ] ); - - } - - }; - - // --- Top-level --- - - // Parser - builds up the property tree from the path strings - - var RePathPart = /([\w\d_]+)(\])?(\[|\.)?/g; - - // extracts - // - the identifier (member name or array index) - // - followed by an optional right bracket (found when array index) - // - followed by an optional left bracket or dot (type of subscript) - // - // Note: These portions can be read in a non-overlapping fashion and - // allow straightforward parsing of the hierarchy that WebGL encodes - // in the uniform names. - - function addUniform( container, uniformObject ) { - - container.seq.push( uniformObject ); - container.map[ uniformObject.id ] = uniformObject; - - } - - function parseUniform( activeInfo, addr, container ) { - - var path = activeInfo.name, - pathLength = path.length; - - // reset RegExp object, because of the early exit of a previous run - RePathPart.lastIndex = 0; - - for (; ;) { - - var match = RePathPart.exec( path ), - matchEnd = RePathPart.lastIndex, - - id = match[ 1 ], - idIsIndex = match[ 2 ] === ']', - subscript = match[ 3 ]; - - if ( idIsIndex ) id = id | 0; // convert to integer - - if ( subscript === undefined || - subscript === '[' && matchEnd + 2 === pathLength ) { - // bare name or "pure" bottom-level array "[0]" suffix - - addUniform( container, subscript === undefined ? - new SingleUniform( id, activeInfo, addr ) : - new PureArrayUniform( id, activeInfo, addr ) ); - - break; - - } else { - // step into inner node / create it in case it doesn't exist - - var map = container.map, - next = map[ id ]; - - if ( next === undefined ) { - - next = new StructuredUniform( id ); - addUniform( container, next ); - - } - - container = next; - - } - - } - - } - - // Root Container - - function WebGLUniforms( gl, program, renderer ) { - - UniformContainer.call( this ); - - this.renderer = renderer; - - var n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS ); - - for ( var i = 0; i !== n; ++ i ) { - - var info = gl.getActiveUniform( program, i ), - path = info.name, - addr = gl.getUniformLocation( program, path ); - - parseUniform( info, addr, this ); - - } - - } - - WebGLUniforms.prototype.setValue = function( gl, name, value ) { - - var u = this.map[ name ]; - - if ( u !== undefined ) u.setValue( gl, value, this.renderer ); - - }; - - WebGLUniforms.prototype.set = function( gl, object, name ) { - - var u = this.map[ name ]; - - if ( u !== undefined ) u.setValue( gl, object[ name ], this.renderer ); - - }; - - WebGLUniforms.prototype.setOptional = function( gl, object, name ) { - - var v = object[ name ]; - - if ( v !== undefined ) this.setValue( gl, name, v ); - - }; - - - // Static interface - - WebGLUniforms.upload = function( gl, seq, values, renderer ) { - - for ( var i = 0, n = seq.length; i !== n; ++ i ) { - - var u = seq[ i ], - v = values[ u.id ]; - - if ( v.needsUpdate !== false ) { - // note: always updating when .needsUpdate is undefined - - u.setValue( gl, v.value, renderer ); - - } - - } - - }; - - WebGLUniforms.seqWithValue = function( seq, values ) { - - var r = []; - - for ( var i = 0, n = seq.length; i !== n; ++ i ) { - - var u = seq[ i ]; - if ( u.id in values ) r.push( u ); - - } - - return r; - - }; - - WebGLUniforms.splitDynamic = function( seq, values ) { - - var r = null, - n = seq.length, - w = 0; - - for ( var i = 0; i !== n; ++ i ) { - - var u = seq[ i ], - v = values[ u.id ]; - - if ( v && v.dynamic === true ) { - - if ( r === null ) r = []; - r.push( u ); - - } else { - - // in-place compact 'seq', removing the matches - if ( w < i ) seq[ w ] = u; - ++ w; - - } - - } - - if ( w < n ) seq.length = w; - - return r; - - }; - - WebGLUniforms.evalDynamic = function( seq, values, object, material, camera ) { - - for ( var i = 0, n = seq.length; i !== n; ++ i ) { - - var v = values[ seq[ i ].id ], - f = v.onUpdateCallback; - - if ( f !== undefined ) f.call( v, object, material, camera ); - - } - - }; - - /** - * Uniform Utilities - */ - - exports.UniformsUtils = { - - merge: function ( uniforms ) { - - var merged = {}; - - for ( var u = 0; u < uniforms.length; u ++ ) { - - var tmp = this.clone( uniforms[ u ] ); - - for ( var p in tmp ) { - - merged[ p ] = tmp[ p ]; - - } - - } - - return merged; - - }, - - clone: function ( uniforms_src ) { - - var uniforms_dst = {}; - - for ( var u in uniforms_src ) { - - uniforms_dst[ u ] = {}; - - for ( var p in uniforms_src[ u ] ) { - - var parameter_src = uniforms_src[ u ][ p ]; - - if ( (parameter_src && parameter_src.isColor) || - (parameter_src && parameter_src.isVector2) || - (parameter_src && parameter_src.isVector3) || - (parameter_src && parameter_src.isVector4) || - (parameter_src && parameter_src.isMatrix3) || - (parameter_src && parameter_src.isMatrix4) || - (parameter_src && parameter_src.isTexture) ) { - - uniforms_dst[ u ][ p ] = parameter_src.clone(); - - } else if ( Array.isArray( parameter_src ) ) { - - uniforms_dst[ u ][ p ] = parameter_src.slice(); - - } else { - - uniforms_dst[ u ][ p ] = parameter_src; - - } - - } - - } - - return uniforms_dst; - - } - - }; - - var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n"; - - var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n"; - - var alphatest_fragment = "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n"; - - var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n"; - - var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif"; - - var begin_vertex = "\nvec3 transformed = vec3( position );\n"; - - var beginnormal_vertex = "\nvec3 objectNormal = vec3( normal );\n"; - - var bsdfs = "bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n\treturn any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n"; - - var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n"; - - var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n#endif\n"; - - var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n"; - - var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n"; - - var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n"; - - var color_fragment = "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif"; - - var color_pars_fragment = "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n"; - - var color_pars_vertex = "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif"; - - var color_vertex = "#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif"; - - var common = "#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n"; - - var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n"; - - var defaultnormal_vertex = "#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n"; - - var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n"; - - var displacementmap_vertex = "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n"; - - var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n"; - - var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n"; - - var encodings_fragment = " gl_FragColor = linearToOutputTexel( gl_FragColor );\n"; - - var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n"; - - var envmap_fragment = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n"; - - var envmap_pars_fragment = "#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n"; - - var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n"; - - var envmap_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n"; - - var fog_fragment = "#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n"; - - var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif"; - - var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n"; - - var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif"; - - var lights_lambert_vertex = "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n"; - - var lights_pars = "uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#include <normal_flip>\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#include <normal_flip>\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n"; - - var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n"; - - var lights_phong_pars_fragment = "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n"; - - var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n"; - - var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n"; - - var lights_template = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n"; - - var logdepthbuf_fragment = "#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif"; - - var logdepthbuf_pars_fragment = "#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n"; - - var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif"; - - var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n"; - - var map_fragment = "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n"; - - var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n"; - - var map_particle_fragment = "#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n"; - - var map_particle_pars_fragment = "#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n"; - - var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n"; - - var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif"; - - var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n"; - - var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif"; - - var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n"; - - var normal_flip = "#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n"; - - var normal_fragment = "#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n"; - - var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n"; - - var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n"; - - var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n"; - - var project_vertex = "#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n"; - - var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n"; - - var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif"; - - var shadowmap_pars_fragment = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n"; - - var shadowmap_pars_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n"; - - var shadowmap_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n"; - - var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n"; - - var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif"; - - var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n"; - - var skinning_vertex = "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n"; - - var skinnormal_vertex = "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n"; - - var specularmap_fragment = "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif"; - - var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif"; - - var tonemapping_fragment = "#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n"; - - var tonemapping_pars_fragment = "#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n"; - - var uv_pars_fragment = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif"; - - var uv_pars_vertex = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n"; - - var uv_vertex = "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif"; - - var uv2_pars_fragment = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif"; - - var uv2_pars_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif"; - - var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif"; - - var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n"; - - var cube_frag = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n"; - - var cube_vert = "varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n"; - - var depth_frag = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n"; - - var depth_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n"; - - var distanceRGBA_frag = "uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n"; - - var distanceRGBA_vert = "varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n"; - - var equirect_frag = "uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n"; - - var equirect_vert = "varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n"; - - var linedashed_frag = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - - var linedashed_vert = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n"; - - var meshbasic_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - - var meshbasic_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n}\n"; - - var meshlambert_frag = "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - - var meshlambert_vert = "#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - - var meshphong_frag = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - - var meshphong_vert = "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - - var meshphysical_frag = "#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - - var meshphysical_vert = "#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - - var normal_frag = "uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include <logdepthbuf_fragment>\n}\n"; - - var normal_vert = "varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n"; - - var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n"; - - var points_vert = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - - var shadow_frag = "uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n"; - - var shadow_vert = "#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"; - - var ShaderChunk = { - alphamap_fragment: alphamap_fragment, - alphamap_pars_fragment: alphamap_pars_fragment, - alphatest_fragment: alphatest_fragment, - aomap_fragment: aomap_fragment, - aomap_pars_fragment: aomap_pars_fragment, - begin_vertex: begin_vertex, - beginnormal_vertex: beginnormal_vertex, - bsdfs: bsdfs, - bumpmap_pars_fragment: bumpmap_pars_fragment, - clipping_planes_fragment: clipping_planes_fragment, - clipping_planes_pars_fragment: clipping_planes_pars_fragment, - clipping_planes_pars_vertex: clipping_planes_pars_vertex, - clipping_planes_vertex: clipping_planes_vertex, - color_fragment: color_fragment, - color_pars_fragment: color_pars_fragment, - color_pars_vertex: color_pars_vertex, - color_vertex: color_vertex, - common: common, - cube_uv_reflection_fragment: cube_uv_reflection_fragment, - defaultnormal_vertex: defaultnormal_vertex, - displacementmap_pars_vertex: displacementmap_pars_vertex, - displacementmap_vertex: displacementmap_vertex, - emissivemap_fragment: emissivemap_fragment, - emissivemap_pars_fragment: emissivemap_pars_fragment, - encodings_fragment: encodings_fragment, - encodings_pars_fragment: encodings_pars_fragment, - envmap_fragment: envmap_fragment, - envmap_pars_fragment: envmap_pars_fragment, - envmap_pars_vertex: envmap_pars_vertex, - envmap_vertex: envmap_vertex, - fog_fragment: fog_fragment, - fog_pars_fragment: fog_pars_fragment, - lightmap_fragment: lightmap_fragment, - lightmap_pars_fragment: lightmap_pars_fragment, - lights_lambert_vertex: lights_lambert_vertex, - lights_pars: lights_pars, - lights_phong_fragment: lights_phong_fragment, - lights_phong_pars_fragment: lights_phong_pars_fragment, - lights_physical_fragment: lights_physical_fragment, - lights_physical_pars_fragment: lights_physical_pars_fragment, - lights_template: lights_template, - logdepthbuf_fragment: logdepthbuf_fragment, - logdepthbuf_pars_fragment: logdepthbuf_pars_fragment, - logdepthbuf_pars_vertex: logdepthbuf_pars_vertex, - logdepthbuf_vertex: logdepthbuf_vertex, - map_fragment: map_fragment, - map_pars_fragment: map_pars_fragment, - map_particle_fragment: map_particle_fragment, - map_particle_pars_fragment: map_particle_pars_fragment, - metalnessmap_fragment: metalnessmap_fragment, - metalnessmap_pars_fragment: metalnessmap_pars_fragment, - morphnormal_vertex: morphnormal_vertex, - morphtarget_pars_vertex: morphtarget_pars_vertex, - morphtarget_vertex: morphtarget_vertex, - normal_flip: normal_flip, - normal_fragment: normal_fragment, - normalmap_pars_fragment: normalmap_pars_fragment, - packing: packing, - premultiplied_alpha_fragment: premultiplied_alpha_fragment, - project_vertex: project_vertex, - roughnessmap_fragment: roughnessmap_fragment, - roughnessmap_pars_fragment: roughnessmap_pars_fragment, - shadowmap_pars_fragment: shadowmap_pars_fragment, - shadowmap_pars_vertex: shadowmap_pars_vertex, - shadowmap_vertex: shadowmap_vertex, - shadowmask_pars_fragment: shadowmask_pars_fragment, - skinbase_vertex: skinbase_vertex, - skinning_pars_vertex: skinning_pars_vertex, - skinning_vertex: skinning_vertex, - skinnormal_vertex: skinnormal_vertex, - specularmap_fragment: specularmap_fragment, - specularmap_pars_fragment: specularmap_pars_fragment, - tonemapping_fragment: tonemapping_fragment, - tonemapping_pars_fragment: tonemapping_pars_fragment, - uv_pars_fragment: uv_pars_fragment, - uv_pars_vertex: uv_pars_vertex, - uv_vertex: uv_vertex, - uv2_pars_fragment: uv2_pars_fragment, - uv2_pars_vertex: uv2_pars_vertex, - uv2_vertex: uv2_vertex, - worldpos_vertex: worldpos_vertex, - - cube_frag: cube_frag, - cube_vert: cube_vert, - depth_frag: depth_frag, - depth_vert: depth_vert, - distanceRGBA_frag: distanceRGBA_frag, - distanceRGBA_vert: distanceRGBA_vert, - equirect_frag: equirect_frag, - equirect_vert: equirect_vert, - linedashed_frag: linedashed_frag, - linedashed_vert: linedashed_vert, - meshbasic_frag: meshbasic_frag, - meshbasic_vert: meshbasic_vert, - meshlambert_frag: meshlambert_frag, - meshlambert_vert: meshlambert_vert, - meshphong_frag: meshphong_frag, - meshphong_vert: meshphong_vert, - meshphysical_frag: meshphysical_frag, - meshphysical_vert: meshphysical_vert, - normal_frag: normal_frag, - normal_vert: normal_vert, - points_frag: points_frag, - points_vert: points_vert, - shadow_frag: shadow_frag, - shadow_vert: shadow_vert - }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function Color( r, g, b ) { - - if ( g === undefined && b === undefined ) { - - // r is THREE.Color, hex or string - return this.set( r ); - - } - - return this.setRGB( r, g, b ); - - } - - Color.prototype = { - - constructor: Color, - - isColor: true, - - r: 1, g: 1, b: 1, - - set: function ( value ) { - - if ( (value && value.isColor) ) { - - this.copy( value ); - - } else if ( typeof value === 'number' ) { - - this.setHex( value ); - - } else if ( typeof value === 'string' ) { - - this.setStyle( value ); - - } - - return this; - - }, - - setScalar: function ( scalar ) { - - this.r = scalar; - this.g = scalar; - this.b = scalar; - - }, - - setHex: function ( hex ) { - - hex = Math.floor( hex ); - - this.r = ( hex >> 16 & 255 ) / 255; - this.g = ( hex >> 8 & 255 ) / 255; - this.b = ( hex & 255 ) / 255; - - return this; - - }, - - setRGB: function ( r, g, b ) { - - this.r = r; - this.g = g; - this.b = b; - - return this; - - }, - - setHSL: function () { - - function hue2rgb( p, q, t ) { - - if ( t < 0 ) t += 1; - if ( t > 1 ) t -= 1; - if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t; - if ( t < 1 / 2 ) return q; - if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t ); - return p; - - } - - return function setHSL( h, s, l ) { - - // h,s,l ranges are in 0.0 - 1.0 - h = exports.Math.euclideanModulo( h, 1 ); - s = exports.Math.clamp( s, 0, 1 ); - l = exports.Math.clamp( l, 0, 1 ); - - if ( s === 0 ) { - - this.r = this.g = this.b = l; - - } else { - - var p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s ); - var q = ( 2 * l ) - p; - - this.r = hue2rgb( q, p, h + 1 / 3 ); - this.g = hue2rgb( q, p, h ); - this.b = hue2rgb( q, p, h - 1 / 3 ); - - } - - return this; - - }; - - }(), - - setStyle: function ( style ) { - - function handleAlpha( string ) { - - if ( string === undefined ) return; - - if ( parseFloat( string ) < 1 ) { - - console.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' ); - - } - - } - - - var m; - - if ( m = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec( style ) ) { - - // rgb / hsl - - var color; - var name = m[ 1 ]; - var components = m[ 2 ]; - - switch ( name ) { - - case 'rgb': - case 'rgba': - - if ( color = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec( components ) ) { - - // rgb(255,0,0) rgba(255,0,0,0.5) - this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255; - this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255; - this.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255; - - handleAlpha( color[ 5 ] ); - - return this; - - } - - if ( color = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec( components ) ) { - - // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5) - this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100; - this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100; - this.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100; - - handleAlpha( color[ 5 ] ); - - return this; - - } - - break; - - case 'hsl': - case 'hsla': - - if ( color = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec( components ) ) { - - // hsl(120,50%,50%) hsla(120,50%,50%,0.5) - var h = parseFloat( color[ 1 ] ) / 360; - var s = parseInt( color[ 2 ], 10 ) / 100; - var l = parseInt( color[ 3 ], 10 ) / 100; - - handleAlpha( color[ 5 ] ); - - return this.setHSL( h, s, l ); - - } - - break; - - } - - } else if ( m = /^\#([A-Fa-f0-9]+)$/.exec( style ) ) { - - // hex color - - var hex = m[ 1 ]; - var size = hex.length; - - if ( size === 3 ) { - - // #ff0 - this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 0 ), 16 ) / 255; - this.g = parseInt( hex.charAt( 1 ) + hex.charAt( 1 ), 16 ) / 255; - this.b = parseInt( hex.charAt( 2 ) + hex.charAt( 2 ), 16 ) / 255; - - return this; - - } else if ( size === 6 ) { - - // #ff0000 - this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 1 ), 16 ) / 255; - this.g = parseInt( hex.charAt( 2 ) + hex.charAt( 3 ), 16 ) / 255; - this.b = parseInt( hex.charAt( 4 ) + hex.charAt( 5 ), 16 ) / 255; - - return this; - - } - - } - - if ( style && style.length > 0 ) { - - // color keywords - var hex = exports.ColorKeywords[ style ]; - - if ( hex !== undefined ) { - - // red - this.setHex( hex ); - - } else { - - // unknown color - console.warn( 'THREE.Color: Unknown color ' + style ); - - } - - } - - return this; - - }, - - clone: function () { - - return new this.constructor( this.r, this.g, this.b ); - - }, - - copy: function ( color ) { - - this.r = color.r; - this.g = color.g; - this.b = color.b; - - return this; - - }, - - copyGammaToLinear: function ( color, gammaFactor ) { - - if ( gammaFactor === undefined ) gammaFactor = 2.0; - - this.r = Math.pow( color.r, gammaFactor ); - this.g = Math.pow( color.g, gammaFactor ); - this.b = Math.pow( color.b, gammaFactor ); - - return this; - - }, - - copyLinearToGamma: function ( color, gammaFactor ) { - - if ( gammaFactor === undefined ) gammaFactor = 2.0; - - var safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0; - - this.r = Math.pow( color.r, safeInverse ); - this.g = Math.pow( color.g, safeInverse ); - this.b = Math.pow( color.b, safeInverse ); - - return this; - - }, - - convertGammaToLinear: function () { - - var r = this.r, g = this.g, b = this.b; - - this.r = r * r; - this.g = g * g; - this.b = b * b; - - return this; - - }, - - convertLinearToGamma: function () { - - this.r = Math.sqrt( this.r ); - this.g = Math.sqrt( this.g ); - this.b = Math.sqrt( this.b ); - - return this; - - }, - - getHex: function () { - - return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0; - - }, - - getHexString: function () { - - return ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 ); - - }, - - getHSL: function ( optionalTarget ) { - - // h,s,l ranges are in 0.0 - 1.0 - - var hsl = optionalTarget || { h: 0, s: 0, l: 0 }; - - var r = this.r, g = this.g, b = this.b; - - var max = Math.max( r, g, b ); - var min = Math.min( r, g, b ); - - var hue, saturation; - var lightness = ( min + max ) / 2.0; - - if ( min === max ) { - - hue = 0; - saturation = 0; - - } else { - - var delta = max - min; - - saturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min ); - - switch ( max ) { - - case r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break; - case g: hue = ( b - r ) / delta + 2; break; - case b: hue = ( r - g ) / delta + 4; break; - - } - - hue /= 6; - - } - - hsl.h = hue; - hsl.s = saturation; - hsl.l = lightness; - - return hsl; - - }, - - getStyle: function () { - - return 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')'; - - }, - - offsetHSL: function ( h, s, l ) { - - var hsl = this.getHSL(); - - hsl.h += h; hsl.s += s; hsl.l += l; - - this.setHSL( hsl.h, hsl.s, hsl.l ); - - return this; - - }, - - add: function ( color ) { - - this.r += color.r; - this.g += color.g; - this.b += color.b; - - return this; - - }, - - addColors: function ( color1, color2 ) { - - this.r = color1.r + color2.r; - this.g = color1.g + color2.g; - this.b = color1.b + color2.b; - - return this; - - }, - - addScalar: function ( s ) { - - this.r += s; - this.g += s; - this.b += s; - - return this; - - }, - - sub: function( color ) { - - this.r = Math.max( 0, this.r - color.r ); - this.g = Math.max( 0, this.g - color.g ); - this.b = Math.max( 0, this.b - color.b ); - - return this; - - }, - - multiply: function ( color ) { - - this.r *= color.r; - this.g *= color.g; - this.b *= color.b; - - return this; - - }, - - multiplyScalar: function ( s ) { - - this.r *= s; - this.g *= s; - this.b *= s; - - return this; - - }, - - lerp: function ( color, alpha ) { - - this.r += ( color.r - this.r ) * alpha; - this.g += ( color.g - this.g ) * alpha; - this.b += ( color.b - this.b ) * alpha; - - return this; - - }, - - equals: function ( c ) { - - return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b ); - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - this.r = array[ offset ]; - this.g = array[ offset + 1 ]; - this.b = array[ offset + 2 ]; - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this.r; - array[ offset + 1 ] = this.g; - array[ offset + 2 ] = this.b; - - return array; - - }, - - toJSON: function () { - - return this.getHex(); - - } - - }; - - exports.ColorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF, - 'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2, - 'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50, - 'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B, - 'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B, - 'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F, - 'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3, - 'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222, - 'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700, - 'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4, - 'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00, - 'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3, - 'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA, - 'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32, - 'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3, - 'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC, - 'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD, - 'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6, - 'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9, - 'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F, - 'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE, - 'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA, - 'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0, - 'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 }; - - /** - * Uniforms library for shared webgl shaders - */ - - var UniformsLib = { - - common: { - - diffuse: { value: new Color( 0xeeeeee ) }, - opacity: { value: 1.0 }, - - map: { value: null }, - offsetRepeat: { value: new Vector4( 0, 0, 1, 1 ) }, - - specularMap: { value: null }, - alphaMap: { value: null }, - - envMap: { value: null }, - flipEnvMap: { value: - 1 }, - reflectivity: { value: 1.0 }, - refractionRatio: { value: 0.98 } - - }, - - aomap: { - - aoMap: { value: null }, - aoMapIntensity: { value: 1 } - - }, - - lightmap: { - - lightMap: { value: null }, - lightMapIntensity: { value: 1 } - - }, - - emissivemap: { - - emissiveMap: { value: null } - - }, - - bumpmap: { - - bumpMap: { value: null }, - bumpScale: { value: 1 } - - }, - - normalmap: { - - normalMap: { value: null }, - normalScale: { value: new Vector2( 1, 1 ) } - - }, - - displacementmap: { - - displacementMap: { value: null }, - displacementScale: { value: 1 }, - displacementBias: { value: 0 } - - }, - - roughnessmap: { - - roughnessMap: { value: null } - - }, - - metalnessmap: { - - metalnessMap: { value: null } - - }, - - fog: { - - fogDensity: { value: 0.00025 }, - fogNear: { value: 1 }, - fogFar: { value: 2000 }, - fogColor: { value: new Color( 0xffffff ) } - - }, - - lights: { - - ambientLightColor: { value: [] }, - - directionalLights: { value: [], properties: { - direction: {}, - color: {}, - - shadow: {}, - shadowBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - - directionalShadowMap: { value: [] }, - directionalShadowMatrix: { value: [] }, - - spotLights: { value: [], properties: { - color: {}, - position: {}, - direction: {}, - distance: {}, - coneCos: {}, - penumbraCos: {}, - decay: {}, - - shadow: {}, - shadowBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - - spotShadowMap: { value: [] }, - spotShadowMatrix: { value: [] }, - - pointLights: { value: [], properties: { - color: {}, - position: {}, - decay: {}, - distance: {}, - - shadow: {}, - shadowBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - - pointShadowMap: { value: [] }, - pointShadowMatrix: { value: [] }, - - hemisphereLights: { value: [], properties: { - direction: {}, - skyColor: {}, - groundColor: {} - } } - - }, - - points: { - - diffuse: { value: new Color( 0xeeeeee ) }, - opacity: { value: 1.0 }, - size: { value: 1.0 }, - scale: { value: 1.0 }, - map: { value: null }, - offsetRepeat: { value: new Vector4( 0, 0, 1, 1 ) } - - } - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - */ - - var ShaderLib = { - - basic: { - - uniforms: exports.UniformsUtils.merge( [ - - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.fog - - ] ), - - vertexShader: ShaderChunk.meshbasic_vert, - fragmentShader: ShaderChunk.meshbasic_frag - - }, - - lambert: { - - uniforms: exports.UniformsUtils.merge( [ - - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.fog, - UniformsLib.lights, - - { - emissive : { value: new Color( 0x000000 ) } - } - - ] ), - - vertexShader: ShaderChunk.meshlambert_vert, - fragmentShader: ShaderChunk.meshlambert_frag - - }, - - phong: { - - uniforms: exports.UniformsUtils.merge( [ - - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - UniformsLib.lights, - - { - emissive : { value: new Color( 0x000000 ) }, - specular : { value: new Color( 0x111111 ) }, - shininess: { value: 30 } - } - - ] ), - - vertexShader: ShaderChunk.meshphong_vert, - fragmentShader: ShaderChunk.meshphong_frag - - }, - - standard: { - - uniforms: exports.UniformsUtils.merge( [ - - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.roughnessmap, - UniformsLib.metalnessmap, - UniformsLib.fog, - UniformsLib.lights, - - { - emissive : { value: new Color( 0x000000 ) }, - roughness: { value: 0.5 }, - metalness: { value: 0 }, - envMapIntensity : { value: 1 }, // temporary - } - - ] ), - - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag - - }, - - points: { - - uniforms: exports.UniformsUtils.merge( [ - - UniformsLib.points, - UniformsLib.fog - - ] ), - - vertexShader: ShaderChunk.points_vert, - fragmentShader: ShaderChunk.points_frag - - }, - - dashed: { - - uniforms: exports.UniformsUtils.merge( [ - - UniformsLib.common, - UniformsLib.fog, - - { - scale : { value: 1 }, - dashSize : { value: 1 }, - totalSize: { value: 2 } - } - - ] ), - - vertexShader: ShaderChunk.linedashed_vert, - fragmentShader: ShaderChunk.linedashed_frag - - }, - - depth: { - - uniforms: exports.UniformsUtils.merge( [ - - UniformsLib.common, - UniformsLib.displacementmap - - ] ), - - vertexShader: ShaderChunk.depth_vert, - fragmentShader: ShaderChunk.depth_frag - - }, - - normal: { - - uniforms: { - - opacity : { value: 1.0 } - - }, - - vertexShader: ShaderChunk.normal_vert, - fragmentShader: ShaderChunk.normal_frag - - }, - - /* ------------------------------------------------------------------------- - // Cube map shader - ------------------------------------------------------------------------- */ - - cube: { - - uniforms: { - tCube: { value: null }, - tFlip: { value: - 1 }, - opacity: { value: 1.0 } - }, - - vertexShader: ShaderChunk.cube_vert, - fragmentShader: ShaderChunk.cube_frag - - }, - - /* ------------------------------------------------------------------------- - // Cube map shader - ------------------------------------------------------------------------- */ - - equirect: { - - uniforms: { - tEquirect: { value: null }, - tFlip: { value: - 1 } - }, - - vertexShader: ShaderChunk.equirect_vert, - fragmentShader: ShaderChunk.equirect_frag - - }, - - distanceRGBA: { - - uniforms: { - - lightPos: { value: new Vector3() } - - }, - - vertexShader: ShaderChunk.distanceRGBA_vert, - fragmentShader: ShaderChunk.distanceRGBA_frag - - } - - }; - - ShaderLib.physical = { - - uniforms: exports.UniformsUtils.merge( [ - - ShaderLib.standard.uniforms, - - { - clearCoat: { value: 0 }, - clearCoatRoughness: { value: 0 } - } - - ] ), - - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag - - }; - - /** - * @author bhouston / http://clara.io - */ - - function Box2( min, max ) { - - this.min = ( min !== undefined ) ? min : new Vector2( + Infinity, + Infinity ); - this.max = ( max !== undefined ) ? max : new Vector2( - Infinity, - Infinity ); - - } - - Box2.prototype = { - - constructor: Box2, - - set: function ( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - }, - - setFromPoints: function ( points ) { - - this.makeEmpty(); - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - this.expandByPoint( points[ i ] ); - - } - - return this; - - }, - - setFromCenterAndSize: function () { - - var v1 = new Vector2(); - - return function setFromCenterAndSize( center, size ) { - - var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - }; - - }(), - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - }, - - makeEmpty: function () { - - this.min.x = this.min.y = + Infinity; - this.max.x = this.max.y = - Infinity; - - return this; - - }, - - isEmpty: function () { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ); - - }, - - getCenter: function ( optionalTarget ) { - - var result = optionalTarget || new Vector2(); - return this.isEmpty() ? result.set( 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - }, - - getSize: function ( optionalTarget ) { - - var result = optionalTarget || new Vector2(); - return this.isEmpty() ? result.set( 0, 0 ) : result.subVectors( this.max, this.min ); - - }, - - expandByPoint: function ( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - - }, - - expandByVector: function ( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - - }, - - expandByScalar: function ( scalar ) { - - this.min.addScalar( - scalar ); - this.max.addScalar( scalar ); - - return this; - - }, - - containsPoint: function ( point ) { - - if ( point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y ) { - - return false; - - } - - return true; - - }, - - containsBox: function ( box ) { - - if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && - ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) { - - return true; - - } - - return false; - - }, - - getParameter: function ( point, optionalTarget ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - var result = optionalTarget || new Vector2(); - - return result.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ) - ); - - }, - - intersectsBox: function ( box ) { - - // using 6 splitting planes to rule out intersections. - - if ( box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y ) { - - return false; - - } - - return true; - - }, - - clampPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new Vector2(); - return result.copy( point ).clamp( this.min, this.max ); - - }, - - distanceToPoint: function () { - - var v1 = new Vector2(); - - return function distanceToPoint( point ) { - - var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - }; - - }(), - - intersect: function ( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - return this; - - }, - - union: function ( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - }, - - translate: function ( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - }, - - equals: function ( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - } - - }; - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - - function LensFlarePlugin( renderer, flares ) { - - var gl = renderer.context; - var state = renderer.state; - - var vertexBuffer, elementBuffer; - var shader, program, attributes, uniforms; - - var tempTexture, occlusionTexture; - - function init() { - - var vertices = new Float32Array( [ - - 1, - 1, 0, 0, - 1, - 1, 1, 0, - 1, 1, 1, 1, - - 1, 1, 0, 1 - ] ); - - var faces = new Uint16Array( [ - 0, 1, 2, - 0, 2, 3 - ] ); - - // buffers - - vertexBuffer = gl.createBuffer(); - elementBuffer = gl.createBuffer(); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW ); - - // textures - - tempTexture = gl.createTexture(); - occlusionTexture = gl.createTexture(); - - state.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - - state.bindTexture( gl.TEXTURE_2D, occlusionTexture ); - gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); - gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - - shader = { - - vertexShader: [ - - "uniform lowp int renderType;", - - "uniform vec3 screenPosition;", - "uniform vec2 scale;", - "uniform float rotation;", - - "uniform sampler2D occlusionMap;", - - "attribute vec2 position;", - "attribute vec2 uv;", - - "varying vec2 vUV;", - "varying float vVisibility;", - - "void main() {", - - "vUV = uv;", - - "vec2 pos = position;", - - "if ( renderType == 2 ) {", - - "vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );", - "visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );", - - "vVisibility = visibility.r / 9.0;", - "vVisibility *= 1.0 - visibility.g / 9.0;", - "vVisibility *= visibility.b / 9.0;", - "vVisibility *= 1.0 - visibility.a / 9.0;", - - "pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;", - "pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;", - - "}", - - "gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );", - - "}" - - ].join( "\n" ), - - fragmentShader: [ - - "uniform lowp int renderType;", - - "uniform sampler2D map;", - "uniform float opacity;", - "uniform vec3 color;", - - "varying vec2 vUV;", - "varying float vVisibility;", - - "void main() {", - - // pink square - - "if ( renderType == 0 ) {", - - "gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );", - - // restore - - "} else if ( renderType == 1 ) {", - - "gl_FragColor = texture2D( map, vUV );", - - // flare - - "} else {", - - "vec4 texture = texture2D( map, vUV );", - "texture.a *= opacity * vVisibility;", - "gl_FragColor = texture;", - "gl_FragColor.rgb *= color;", - - "}", - - "}" - - ].join( "\n" ) - - }; - - program = createProgram( shader ); - - attributes = { - vertex: gl.getAttribLocation ( program, "position" ), - uv: gl.getAttribLocation ( program, "uv" ) - }; - - uniforms = { - renderType: gl.getUniformLocation( program, "renderType" ), - map: gl.getUniformLocation( program, "map" ), - occlusionMap: gl.getUniformLocation( program, "occlusionMap" ), - opacity: gl.getUniformLocation( program, "opacity" ), - color: gl.getUniformLocation( program, "color" ), - scale: gl.getUniformLocation( program, "scale" ), - rotation: gl.getUniformLocation( program, "rotation" ), - screenPosition: gl.getUniformLocation( program, "screenPosition" ) - }; - - } - - /* - * Render lens flares - * Method: renders 16x16 0xff00ff-colored points scattered over the light source area, - * reads these back and calculates occlusion. - */ - - this.render = function ( scene, camera, viewport ) { - - if ( flares.length === 0 ) return; - - var tempPosition = new Vector3(); - - var invAspect = viewport.w / viewport.z, - halfViewportWidth = viewport.z * 0.5, - halfViewportHeight = viewport.w * 0.5; - - var size = 16 / viewport.w, - scale = new Vector2( size * invAspect, size ); - - var screenPosition = new Vector3( 1, 1, 0 ), - screenPositionPixels = new Vector2( 1, 1 ); - - var validArea = new Box2(); - - validArea.min.set( 0, 0 ); - validArea.max.set( viewport.z - 16, viewport.w - 16 ); - - if ( program === undefined ) { - - init(); - - } - - gl.useProgram( program ); - - state.initAttributes(); - state.enableAttribute( attributes.vertex ); - state.enableAttribute( attributes.uv ); - state.disableUnusedAttributes(); - - // loop through all lens flares to update their occlusion and positions - // setup gl and common used attribs/uniforms - - gl.uniform1i( uniforms.occlusionMap, 0 ); - gl.uniform1i( uniforms.map, 1 ); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.vertexAttribPointer( attributes.vertex, 2, gl.FLOAT, false, 2 * 8, 0 ); - gl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - - state.disable( gl.CULL_FACE ); - state.setDepthWrite( false ); - - for ( var i = 0, l = flares.length; i < l; i ++ ) { - - size = 16 / viewport.w; - scale.set( size * invAspect, size ); - - // calc object screen position - - var flare = flares[ i ]; - - tempPosition.set( flare.matrixWorld.elements[ 12 ], flare.matrixWorld.elements[ 13 ], flare.matrixWorld.elements[ 14 ] ); - - tempPosition.applyMatrix4( camera.matrixWorldInverse ); - tempPosition.applyProjection( camera.projectionMatrix ); - - // setup arrays for gl programs - - screenPosition.copy( tempPosition ); - - // horizontal and vertical coordinate of the lower left corner of the pixels to copy - - screenPositionPixels.x = viewport.x + ( screenPosition.x * halfViewportWidth ) + halfViewportWidth - 8; - screenPositionPixels.y = viewport.y + ( screenPosition.y * halfViewportHeight ) + halfViewportHeight - 8; - - // screen cull - - if ( validArea.containsPoint( screenPositionPixels ) === true ) { - - // save current RGB to temp texture - - state.activeTexture( gl.TEXTURE0 ); - state.bindTexture( gl.TEXTURE_2D, null ); - state.activeTexture( gl.TEXTURE1 ); - state.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x, screenPositionPixels.y, 16, 16, 0 ); - - - // render pink quad - - gl.uniform1i( uniforms.renderType, 0 ); - gl.uniform2f( uniforms.scale, scale.x, scale.y ); - gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z ); - - state.disable( gl.BLEND ); - state.enable( gl.DEPTH_TEST ); - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - - // copy result to occlusionMap - - state.activeTexture( gl.TEXTURE0 ); - state.bindTexture( gl.TEXTURE_2D, occlusionTexture ); - gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, screenPositionPixels.x, screenPositionPixels.y, 16, 16, 0 ); - - - // restore graphics - - gl.uniform1i( uniforms.renderType, 1 ); - state.disable( gl.DEPTH_TEST ); - - state.activeTexture( gl.TEXTURE1 ); - state.bindTexture( gl.TEXTURE_2D, tempTexture ); - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - - // update object positions - - flare.positionScreen.copy( screenPosition ); - - if ( flare.customUpdateCallback ) { - - flare.customUpdateCallback( flare ); - - } else { - - flare.updateLensFlares(); - - } - - // render flares - - gl.uniform1i( uniforms.renderType, 2 ); - state.enable( gl.BLEND ); - - for ( var j = 0, jl = flare.lensFlares.length; j < jl; j ++ ) { - - var sprite = flare.lensFlares[ j ]; - - if ( sprite.opacity > 0.001 && sprite.scale > 0.001 ) { - - screenPosition.x = sprite.x; - screenPosition.y = sprite.y; - screenPosition.z = sprite.z; - - size = sprite.size * sprite.scale / viewport.w; - - scale.x = size * invAspect; - scale.y = size; - - gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z ); - gl.uniform2f( uniforms.scale, scale.x, scale.y ); - gl.uniform1f( uniforms.rotation, sprite.rotation ); - - gl.uniform1f( uniforms.opacity, sprite.opacity ); - gl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b ); - - state.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst ); - renderer.setTexture2D( sprite.texture, 1 ); - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - } - - } - - } - - } - - // restore gl - - state.enable( gl.CULL_FACE ); - state.enable( gl.DEPTH_TEST ); - state.setDepthWrite( true ); - - renderer.resetGLState(); - - }; - - function createProgram( shader ) { - - var program = gl.createProgram(); - - var fragmentShader = gl.createShader( gl.FRAGMENT_SHADER ); - var vertexShader = gl.createShader( gl.VERTEX_SHADER ); - - var prefix = "precision " + renderer.getPrecision() + " float;\n"; - - gl.shaderSource( fragmentShader, prefix + shader.fragmentShader ); - gl.shaderSource( vertexShader, prefix + shader.vertexShader ); - - gl.compileShader( fragmentShader ); - gl.compileShader( vertexShader ); - - gl.attachShader( program, fragmentShader ); - gl.attachShader( program, vertexShader ); - - gl.linkProgram( program ); - - return program; - - } - - } - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - - function SpritePlugin( renderer, sprites ) { - - var gl = renderer.context; - var state = renderer.state; - - var vertexBuffer, elementBuffer; - var program, attributes, uniforms; - - var texture; - - // decompose matrixWorld - - var spritePosition = new Vector3(); - var spriteRotation = new Quaternion(); - var spriteScale = new Vector3(); - - function init() { - - var vertices = new Float32Array( [ - - 0.5, - 0.5, 0, 0, - 0.5, - 0.5, 1, 0, - 0.5, 0.5, 1, 1, - - 0.5, 0.5, 0, 1 - ] ); - - var faces = new Uint16Array( [ - 0, 1, 2, - 0, 2, 3 - ] ); - - vertexBuffer = gl.createBuffer(); - elementBuffer = gl.createBuffer(); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW ); - - program = createProgram(); - - attributes = { - position: gl.getAttribLocation ( program, 'position' ), - uv: gl.getAttribLocation ( program, 'uv' ) - }; - - uniforms = { - uvOffset: gl.getUniformLocation( program, 'uvOffset' ), - uvScale: gl.getUniformLocation( program, 'uvScale' ), - - rotation: gl.getUniformLocation( program, 'rotation' ), - scale: gl.getUniformLocation( program, 'scale' ), - - color: gl.getUniformLocation( program, 'color' ), - map: gl.getUniformLocation( program, 'map' ), - opacity: gl.getUniformLocation( program, 'opacity' ), - - modelViewMatrix: gl.getUniformLocation( program, 'modelViewMatrix' ), - projectionMatrix: gl.getUniformLocation( program, 'projectionMatrix' ), - - fogType: gl.getUniformLocation( program, 'fogType' ), - fogDensity: gl.getUniformLocation( program, 'fogDensity' ), - fogNear: gl.getUniformLocation( program, 'fogNear' ), - fogFar: gl.getUniformLocation( program, 'fogFar' ), - fogColor: gl.getUniformLocation( program, 'fogColor' ), - - alphaTest: gl.getUniformLocation( program, 'alphaTest' ) - }; - - var canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.width = 8; - canvas.height = 8; - - var context = canvas.getContext( '2d' ); - context.fillStyle = 'white'; - context.fillRect( 0, 0, 8, 8 ); - - texture = new Texture( canvas ); - texture.needsUpdate = true; - - } - - this.render = function ( scene, camera ) { - - if ( sprites.length === 0 ) return; - - // setup gl - - if ( program === undefined ) { - - init(); - - } - - gl.useProgram( program ); - - state.initAttributes(); - state.enableAttribute( attributes.position ); - state.enableAttribute( attributes.uv ); - state.disableUnusedAttributes(); - - state.disable( gl.CULL_FACE ); - state.enable( gl.BLEND ); - - gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer ); - gl.vertexAttribPointer( attributes.position, 2, gl.FLOAT, false, 2 * 8, 0 ); - gl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 ); - - gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer ); - - gl.uniformMatrix4fv( uniforms.projectionMatrix, false, camera.projectionMatrix.elements ); - - state.activeTexture( gl.TEXTURE0 ); - gl.uniform1i( uniforms.map, 0 ); - - var oldFogType = 0; - var sceneFogType = 0; - var fog = scene.fog; - - if ( fog ) { - - gl.uniform3f( uniforms.fogColor, fog.color.r, fog.color.g, fog.color.b ); - - if ( (fog && fog.isFog) ) { - - gl.uniform1f( uniforms.fogNear, fog.near ); - gl.uniform1f( uniforms.fogFar, fog.far ); - - gl.uniform1i( uniforms.fogType, 1 ); - oldFogType = 1; - sceneFogType = 1; - - } else if ( (fog && fog.isFogExp2) ) { - - gl.uniform1f( uniforms.fogDensity, fog.density ); - - gl.uniform1i( uniforms.fogType, 2 ); - oldFogType = 2; - sceneFogType = 2; - - } - - } else { - - gl.uniform1i( uniforms.fogType, 0 ); - oldFogType = 0; - sceneFogType = 0; - - } - - - // update positions and sort - - for ( var i = 0, l = sprites.length; i < l; i ++ ) { - - var sprite = sprites[ i ]; - - sprite.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, sprite.matrixWorld ); - sprite.z = - sprite.modelViewMatrix.elements[ 14 ]; - - } - - sprites.sort( painterSortStable ); - - // render all sprites - - var scale = []; - - for ( var i = 0, l = sprites.length; i < l; i ++ ) { - - var sprite = sprites[ i ]; - var material = sprite.material; - - if ( material.visible === false ) continue; - - gl.uniform1f( uniforms.alphaTest, material.alphaTest ); - gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, sprite.modelViewMatrix.elements ); - - sprite.matrixWorld.decompose( spritePosition, spriteRotation, spriteScale ); - - scale[ 0 ] = spriteScale.x; - scale[ 1 ] = spriteScale.y; - - var fogType = 0; - - if ( scene.fog && material.fog ) { - - fogType = sceneFogType; - - } - - if ( oldFogType !== fogType ) { - - gl.uniform1i( uniforms.fogType, fogType ); - oldFogType = fogType; - - } - - if ( material.map !== null ) { - - gl.uniform2f( uniforms.uvOffset, material.map.offset.x, material.map.offset.y ); - gl.uniform2f( uniforms.uvScale, material.map.repeat.x, material.map.repeat.y ); - - } else { - - gl.uniform2f( uniforms.uvOffset, 0, 0 ); - gl.uniform2f( uniforms.uvScale, 1, 1 ); - - } - - gl.uniform1f( uniforms.opacity, material.opacity ); - gl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b ); - - gl.uniform1f( uniforms.rotation, material.rotation ); - gl.uniform2fv( uniforms.scale, scale ); - - state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst ); - state.setDepthTest( material.depthTest ); - state.setDepthWrite( material.depthWrite ); - - if ( material.map ) { - - renderer.setTexture2D( material.map, 0 ); - - } else { - - renderer.setTexture2D( texture, 0 ); - - } - - gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 ); - - } - - // restore gl - - state.enable( gl.CULL_FACE ); - - renderer.resetGLState(); - - }; - - function createProgram() { - - var program = gl.createProgram(); - - var vertexShader = gl.createShader( gl.VERTEX_SHADER ); - var fragmentShader = gl.createShader( gl.FRAGMENT_SHADER ); - - gl.shaderSource( vertexShader, [ - - 'precision ' + renderer.getPrecision() + ' float;', - - 'uniform mat4 modelViewMatrix;', - 'uniform mat4 projectionMatrix;', - 'uniform float rotation;', - 'uniform vec2 scale;', - 'uniform vec2 uvOffset;', - 'uniform vec2 uvScale;', - - 'attribute vec2 position;', - 'attribute vec2 uv;', - - 'varying vec2 vUV;', - - 'void main() {', - - 'vUV = uvOffset + uv * uvScale;', - - 'vec2 alignedPosition = position * scale;', - - 'vec2 rotatedPosition;', - 'rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;', - 'rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;', - - 'vec4 finalPosition;', - - 'finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );', - 'finalPosition.xy += rotatedPosition;', - 'finalPosition = projectionMatrix * finalPosition;', - - 'gl_Position = finalPosition;', - - '}' - - ].join( '\n' ) ); - - gl.shaderSource( fragmentShader, [ - - 'precision ' + renderer.getPrecision() + ' float;', - - 'uniform vec3 color;', - 'uniform sampler2D map;', - 'uniform float opacity;', - - 'uniform int fogType;', - 'uniform vec3 fogColor;', - 'uniform float fogDensity;', - 'uniform float fogNear;', - 'uniform float fogFar;', - 'uniform float alphaTest;', - - 'varying vec2 vUV;', - - 'void main() {', - - 'vec4 texture = texture2D( map, vUV );', - - 'if ( texture.a < alphaTest ) discard;', - - 'gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );', - - 'if ( fogType > 0 ) {', - - 'float depth = gl_FragCoord.z / gl_FragCoord.w;', - 'float fogFactor = 0.0;', - - 'if ( fogType == 1 ) {', - - 'fogFactor = smoothstep( fogNear, fogFar, depth );', - - '} else {', - - 'const float LOG2 = 1.442695;', - 'fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );', - 'fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );', - - '}', - - 'gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );', - - '}', - - '}' - - ].join( '\n' ) ); - - gl.compileShader( vertexShader ); - gl.compileShader( fragmentShader ); - - gl.attachShader( program, vertexShader ); - gl.attachShader( program, fragmentShader ); - - gl.linkProgram( program ); - - return program; - - } - - function painterSortStable( a, b ) { - - if ( a.renderOrder !== b.renderOrder ) { - - return a.renderOrder - b.renderOrder; - - } else if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return b.id - a.id; - - } - - } - - } - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function Material() { - - Object.defineProperty( this, 'id', { value: MaterialIdCount() } ); - - this.uuid = exports.Math.generateUUID(); - - this.name = ''; - this.type = 'Material'; - - this.fog = true; - this.lights = true; - - this.blending = NormalBlending; - this.side = FrontSide; - this.shading = SmoothShading; // THREE.FlatShading, THREE.SmoothShading - this.vertexColors = NoColors; // THREE.NoColors, THREE.VertexColors, THREE.FaceColors - - this.opacity = 1; - this.transparent = false; - - this.blendSrc = SrcAlphaFactor; - this.blendDst = OneMinusSrcAlphaFactor; - this.blendEquation = AddEquation; - this.blendSrcAlpha = null; - this.blendDstAlpha = null; - this.blendEquationAlpha = null; - - this.depthFunc = LessEqualDepth; - this.depthTest = true; - this.depthWrite = true; - - this.clippingPlanes = null; - this.clipShadows = false; - - this.colorWrite = true; - - this.precision = null; // override the renderer's default precision for this material - - this.polygonOffset = false; - this.polygonOffsetFactor = 0; - this.polygonOffsetUnits = 0; - - this.alphaTest = 0; - this.premultipliedAlpha = false; - - this.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer - - this.visible = true; - - this._needsUpdate = true; - - } - - Material.prototype = { - - constructor: Material, - - isMaterial: true, - - get needsUpdate() { - - return this._needsUpdate; - - }, - - set needsUpdate( value ) { - - if ( value === true ) this.update(); - this._needsUpdate = value; - - }, - - setValues: function ( values ) { - - if ( values === undefined ) return; - - for ( var key in values ) { - - var newValue = values[ key ]; - - if ( newValue === undefined ) { - - console.warn( "THREE.Material: '" + key + "' parameter is undefined." ); - continue; - - } - - var currentValue = this[ key ]; - - if ( currentValue === undefined ) { - - console.warn( "THREE." + this.type + ": '" + key + "' is not a property of this material." ); - continue; - - } - - if ( (currentValue && currentValue.isColor) ) { - - currentValue.set( newValue ); - - } else if ( (currentValue && currentValue.isVector3) && (newValue && newValue.isVector3) ) { - - currentValue.copy( newValue ); - - } else if ( key === 'overdraw' ) { - - // ensure overdraw is backwards-compatible with legacy boolean type - this[ key ] = Number( newValue ); - - } else { - - this[ key ] = newValue; - - } - - } - - }, - - toJSON: function ( meta ) { - - var isRoot = meta === undefined; - - if ( isRoot ) { - - meta = { - textures: {}, - images: {} - }; - - } - - var data = { - metadata: { - version: 4.4, - type: 'Material', - generator: 'Material.toJSON' - } - }; - - // standard Material serialization - data.uuid = this.uuid; - data.type = this.type; - - if ( this.name !== '' ) data.name = this.name; - - if ( (this.color && this.color.isColor) ) data.color = this.color.getHex(); - - if ( this.roughness !== undefined ) data.roughness = this.roughness; - if ( this.metalness !== undefined ) data.metalness = this.metalness; - - if ( (this.emissive && this.emissive.isColor) ) data.emissive = this.emissive.getHex(); - if ( (this.specular && this.specular.isColor) ) data.specular = this.specular.getHex(); - if ( this.shininess !== undefined ) data.shininess = this.shininess; - - if ( (this.map && this.map.isTexture) ) data.map = this.map.toJSON( meta ).uuid; - if ( (this.alphaMap && this.alphaMap.isTexture) ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid; - if ( (this.lightMap && this.lightMap.isTexture) ) data.lightMap = this.lightMap.toJSON( meta ).uuid; - if ( (this.bumpMap && this.bumpMap.isTexture) ) { - - data.bumpMap = this.bumpMap.toJSON( meta ).uuid; - data.bumpScale = this.bumpScale; - - } - if ( (this.normalMap && this.normalMap.isTexture) ) { - - data.normalMap = this.normalMap.toJSON( meta ).uuid; - data.normalScale = this.normalScale.toArray(); - - } - if ( (this.displacementMap && this.displacementMap.isTexture) ) { - - data.displacementMap = this.displacementMap.toJSON( meta ).uuid; - data.displacementScale = this.displacementScale; - data.displacementBias = this.displacementBias; - - } - if ( (this.roughnessMap && this.roughnessMap.isTexture) ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid; - if ( (this.metalnessMap && this.metalnessMap.isTexture) ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid; - - if ( (this.emissiveMap && this.emissiveMap.isTexture) ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid; - if ( (this.specularMap && this.specularMap.isTexture) ) data.specularMap = this.specularMap.toJSON( meta ).uuid; - - if ( (this.envMap && this.envMap.isTexture) ) { - - data.envMap = this.envMap.toJSON( meta ).uuid; - data.reflectivity = this.reflectivity; // Scale behind envMap - - } - - if ( this.size !== undefined ) data.size = this.size; - if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation; - - if ( this.blending !== NormalBlending ) data.blending = this.blending; - if ( this.shading !== SmoothShading ) data.shading = this.shading; - if ( this.side !== FrontSide ) data.side = this.side; - if ( this.vertexColors !== NoColors ) data.vertexColors = this.vertexColors; - - if ( this.opacity < 1 ) data.opacity = this.opacity; - if ( this.transparent === true ) data.transparent = this.transparent; - - data.depthFunc = this.depthFunc; - data.depthTest = this.depthTest; - data.depthWrite = this.depthWrite; - - if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest; - if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha; - if ( this.wireframe === true ) data.wireframe = this.wireframe; - if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth; - if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap; - if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin; - - data.skinning = this.skinning; - data.morphTargets = this.morphTargets; - - // TODO: Copied from Object3D.toJSON - - function extractFromCache( cache ) { - - var values = []; - - for ( var key in cache ) { - - var data = cache[ key ]; - delete data.metadata; - values.push( data ); - - } - - return values; - - } - - if ( isRoot ) { - - var textures = extractFromCache( meta.textures ); - var images = extractFromCache( meta.images ); - - if ( textures.length > 0 ) data.textures = textures; - if ( images.length > 0 ) data.images = images; - - } - - return data; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.name = source.name; - - this.fog = source.fog; - this.lights = source.lights; - - this.blending = source.blending; - this.side = source.side; - this.shading = source.shading; - this.vertexColors = source.vertexColors; - - this.opacity = source.opacity; - this.transparent = source.transparent; - - this.blendSrc = source.blendSrc; - this.blendDst = source.blendDst; - this.blendEquation = source.blendEquation; - this.blendSrcAlpha = source.blendSrcAlpha; - this.blendDstAlpha = source.blendDstAlpha; - this.blendEquationAlpha = source.blendEquationAlpha; - - this.depthFunc = source.depthFunc; - this.depthTest = source.depthTest; - this.depthWrite = source.depthWrite; - - this.colorWrite = source.colorWrite; - - this.precision = source.precision; - - this.polygonOffset = source.polygonOffset; - this.polygonOffsetFactor = source.polygonOffsetFactor; - this.polygonOffsetUnits = source.polygonOffsetUnits; - - this.alphaTest = source.alphaTest; - - this.premultipliedAlpha = source.premultipliedAlpha; - - this.overdraw = source.overdraw; - - this.visible = source.visible; - this.clipShadows = source.clipShadows; - - var srcPlanes = source.clippingPlanes, - dstPlanes = null; - - if ( srcPlanes !== null ) { - - var n = srcPlanes.length; - dstPlanes = new Array( n ); - - for ( var i = 0; i !== n; ++ i ) - dstPlanes[ i ] = srcPlanes[ i ].clone(); - - } - - this.clippingPlanes = dstPlanes; - - return this; - - }, - - update: function () { - - this.dispatchEvent( { type: 'update' } ); - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - - }; - - Object.assign( Material.prototype, EventDispatcher.prototype ); - - var count$1 = 0; - function MaterialIdCount() { return count$1++; }; - - /** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * defines: { "label" : "value" }, - * uniforms: { "parameter1": { value: 1.0 }, "parameter2": { value2: 2 } }, - * - * fragmentShader: <string>, - * vertexShader: <string>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * lights: <bool>, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool> - * } - */ - - function ShaderMaterial( parameters ) { - - Material.call( this ); - - this.type = 'ShaderMaterial'; - - this.defines = {}; - this.uniforms = {}; - - this.vertexShader = 'void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}'; - this.fragmentShader = 'void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}'; - - this.linewidth = 1; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; // set to use scene fog - this.lights = false; // set to use scene lights - this.clipping = false; // set to use user-defined clipping planes - - this.skinning = false; // set to use skinning attribute streams - this.morphTargets = false; // set to use morph targets - this.morphNormals = false; // set to use morph normals - - this.extensions = { - derivatives: false, // set to use derivatives - fragDepth: false, // set to use fragment depth values - drawBuffers: false, // set to use draw buffers - shaderTextureLOD: false // set to use shader texture LOD - }; - - // When rendered geometry doesn't include these attributes but the material does, - // use these default values in WebGL. This avoids errors when buffer data is missing. - this.defaultAttributeValues = { - 'color': [ 1, 1, 1 ], - 'uv': [ 0, 0 ], - 'uv2': [ 0, 0 ] - }; - - this.index0AttributeName = undefined; - - if ( parameters !== undefined ) { - - if ( parameters.attributes !== undefined ) { - - console.error( 'THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.' ); - - } - - this.setValues( parameters ); - - } - - } - - ShaderMaterial.prototype = Object.create( Material.prototype ); - ShaderMaterial.prototype.constructor = ShaderMaterial; - - ShaderMaterial.prototype.isShaderMaterial = true; - - ShaderMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.fragmentShader = source.fragmentShader; - this.vertexShader = source.vertexShader; - - this.uniforms = exports.UniformsUtils.clone( source.uniforms ); - - this.defines = source.defines; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - this.lights = source.lights; - this.clipping = source.clipping; - - this.skinning = source.skinning; - - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - this.extensions = source.extensions; - - return this; - - }; - - ShaderMaterial.prototype.toJSON = function ( meta ) { - - var data = Material.prototype.toJSON.call( this, meta ); - - data.uniforms = this.uniforms; - data.vertexShader = this.vertexShader; - data.fragmentShader = this.fragmentShader; - - return data; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author bhouston / https://clara.io - * @author WestLangley / http://github.com/WestLangley - * - * parameters = { - * - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * displacementMap: new THREE.Texture( <Image> ), - * displacementScale: <float>, - * displacementBias: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float> - * } - */ - - function MeshDepthMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshDepthMaterial'; - - this.depthPacking = BasicDepthPacking; - - this.skinning = false; - this.morphTargets = false; - - this.map = null; - - this.alphaMap = null; - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; - this.lights = false; - - this.setValues( parameters ); - - } - - MeshDepthMaterial.prototype = Object.create( Material.prototype ); - MeshDepthMaterial.prototype.constructor = MeshDepthMaterial; - - MeshDepthMaterial.prototype.isMeshDepthMaterial = true; - - MeshDepthMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.depthPacking = source.depthPacking; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - this.map = source.map; - - this.alphaMap = source.alphaMap; - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - return this; - - }; - - /** - * @author bhouston / http://clara.io - * @author WestLangley / http://github.com/WestLangley - */ - - function Box3( min, max ) { - - this.min = ( min !== undefined ) ? min : new Vector3( + Infinity, + Infinity, + Infinity ); - this.max = ( max !== undefined ) ? max : new Vector3( - Infinity, - Infinity, - Infinity ); - - } - - Box3.prototype = { - - constructor: Box3, - - isBox3: true, - - set: function ( min, max ) { - - this.min.copy( min ); - this.max.copy( max ); - - return this; - - }, - - setFromArray: function ( array ) { - - var minX = + Infinity; - var minY = + Infinity; - var minZ = + Infinity; - - var maxX = - Infinity; - var maxY = - Infinity; - var maxZ = - Infinity; - - for ( var i = 0, l = array.length; i < l; i += 3 ) { - - var x = array[ i ]; - var y = array[ i + 1 ]; - var z = array[ i + 2 ]; - - if ( x < minX ) minX = x; - if ( y < minY ) minY = y; - if ( z < minZ ) minZ = z; - - if ( x > maxX ) maxX = x; - if ( y > maxY ) maxY = y; - if ( z > maxZ ) maxZ = z; - - } - - this.min.set( minX, minY, minZ ); - this.max.set( maxX, maxY, maxZ ); - - }, - - setFromPoints: function ( points ) { - - this.makeEmpty(); - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - this.expandByPoint( points[ i ] ); - - } - - return this; - - }, - - setFromCenterAndSize: function () { - - var v1 = new Vector3(); - - return function setFromCenterAndSize( center, size ) { - - var halfSize = v1.copy( size ).multiplyScalar( 0.5 ); - - this.min.copy( center ).sub( halfSize ); - this.max.copy( center ).add( halfSize ); - - return this; - - }; - - }(), - - setFromObject: function () { - - // Computes the world-axis-aligned bounding box of an object (including its children), - // accounting for both the object's, and children's, world transforms - - var v1 = new Vector3(); - - return function setFromObject( object ) { - - var scope = this; - - object.updateMatrixWorld( true ); - - this.makeEmpty(); - - object.traverse( function ( node ) { - - var geometry = node.geometry; - - if ( geometry !== undefined ) { - - if ( (geometry && geometry.isGeometry) ) { - - var vertices = geometry.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - v1.copy( vertices[ i ] ); - v1.applyMatrix4( node.matrixWorld ); - - scope.expandByPoint( v1 ); - - } - - } else if ( (geometry && geometry.isBufferGeometry) ) { - - var attribute = geometry.attributes.position; - - if ( attribute !== undefined ) { - - var array, offset, stride; - - if ( (attribute && attribute.isInterleavedBufferAttribute) ) { - - array = attribute.data.array; - offset = attribute.offset; - stride = attribute.data.stride; - - } else { - - array = attribute.array; - offset = 0; - stride = 3; - - } - - for ( var i = offset, il = array.length; i < il; i += stride ) { - - v1.fromArray( array, i ); - v1.applyMatrix4( node.matrixWorld ); - - scope.expandByPoint( v1 ); - - } - - } - - } - - } - - } ); - - return this; - - }; - - }(), - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( box ) { - - this.min.copy( box.min ); - this.max.copy( box.max ); - - return this; - - }, - - makeEmpty: function () { - - this.min.x = this.min.y = this.min.z = + Infinity; - this.max.x = this.max.y = this.max.z = - Infinity; - - return this; - - }, - - isEmpty: function () { - - // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes - - return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z ); - - }, - - getCenter: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return this.isEmpty() ? result.set( 0, 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); - - }, - - getSize: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return this.isEmpty() ? result.set( 0, 0, 0 ) : result.subVectors( this.max, this.min ); - - }, - - expandByPoint: function ( point ) { - - this.min.min( point ); - this.max.max( point ); - - return this; - - }, - - expandByVector: function ( vector ) { - - this.min.sub( vector ); - this.max.add( vector ); - - return this; - - }, - - expandByScalar: function ( scalar ) { - - this.min.addScalar( - scalar ); - this.max.addScalar( scalar ); - - return this; - - }, - - containsPoint: function ( point ) { - - if ( point.x < this.min.x || point.x > this.max.x || - point.y < this.min.y || point.y > this.max.y || - point.z < this.min.z || point.z > this.max.z ) { - - return false; - - } - - return true; - - }, - - containsBox: function ( box ) { - - if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && - ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) && - ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) { - - return true; - - } - - return false; - - }, - - getParameter: function ( point, optionalTarget ) { - - // This can potentially have a divide by zero if the box - // has a size dimension of 0. - - var result = optionalTarget || new Vector3(); - - return result.set( - ( point.x - this.min.x ) / ( this.max.x - this.min.x ), - ( point.y - this.min.y ) / ( this.max.y - this.min.y ), - ( point.z - this.min.z ) / ( this.max.z - this.min.z ) - ); - - }, - - intersectsBox: function ( box ) { - - // using 6 splitting planes to rule out intersections. - - if ( box.max.x < this.min.x || box.min.x > this.max.x || - box.max.y < this.min.y || box.min.y > this.max.y || - box.max.z < this.min.z || box.min.z > this.max.z ) { - - return false; - - } - - return true; - - }, - - intersectsSphere: ( function () { - - var closestPoint; - - return function intersectsSphere( sphere ) { - - if ( closestPoint === undefined ) closestPoint = new Vector3(); - - // Find the point on the AABB closest to the sphere center. - this.clampPoint( sphere.center, closestPoint ); - - // If that point is inside the sphere, the AABB and sphere intersect. - return closestPoint.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius ); - - }; - - } )(), - - intersectsPlane: function ( plane ) { - - // We compute the minimum and maximum dot product values. If those values - // are on the same side (back or front) of the plane, then there is no intersection. - - var min, max; - - if ( plane.normal.x > 0 ) { - - min = plane.normal.x * this.min.x; - max = plane.normal.x * this.max.x; - - } else { - - min = plane.normal.x * this.max.x; - max = plane.normal.x * this.min.x; - - } - - if ( plane.normal.y > 0 ) { - - min += plane.normal.y * this.min.y; - max += plane.normal.y * this.max.y; - - } else { - - min += plane.normal.y * this.max.y; - max += plane.normal.y * this.min.y; - - } - - if ( plane.normal.z > 0 ) { - - min += plane.normal.z * this.min.z; - max += plane.normal.z * this.max.z; - - } else { - - min += plane.normal.z * this.max.z; - max += plane.normal.z * this.min.z; - - } - - return ( min <= plane.constant && max >= plane.constant ); - - }, - - clampPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.copy( point ).clamp( this.min, this.max ); - - }, - - distanceToPoint: function () { - - var v1 = new Vector3(); - - return function distanceToPoint( point ) { - - var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); - return clampedPoint.sub( point ).length(); - - }; - - }(), - - getBoundingSphere: function () { - - var v1 = new Vector3(); - - return function getBoundingSphere( optionalTarget ) { - - var result = optionalTarget || new Sphere(); - - this.getCenter( result.center ); - - result.radius = this.getSize( v1 ).length() * 0.5; - - return result; - - }; - - }(), - - intersect: function ( box ) { - - this.min.max( box.min ); - this.max.min( box.max ); - - // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values. - if( this.isEmpty() ) this.makeEmpty(); - - return this; - - }, - - union: function ( box ) { - - this.min.min( box.min ); - this.max.max( box.max ); - - return this; - - }, - - applyMatrix4: function () { - - var points = [ - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3() - ]; - - return function applyMatrix4( matrix ) { - - // transform of empty box is an empty box. - if( this.isEmpty() ) return this; - - // NOTE: I am using a binary pattern to specify all 2^3 combinations below - points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000 - points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001 - points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010 - points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011 - points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100 - points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101 - points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110 - points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111 - - this.setFromPoints( points ); - - return this; - - }; - - }(), - - translate: function ( offset ) { - - this.min.add( offset ); - this.max.add( offset ); - - return this; - - }, - - equals: function ( box ) { - - return box.min.equals( this.min ) && box.max.equals( this.max ); - - } - - }; - - /** - * @author bhouston / http://clara.io - * @author mrdoob / http://mrdoob.com/ - */ - - function Sphere( center, radius ) { - - this.center = ( center !== undefined ) ? center : new Vector3(); - this.radius = ( radius !== undefined ) ? radius : 0; - - } - - Sphere.prototype = { - - constructor: Sphere, - - set: function ( center, radius ) { - - this.center.copy( center ); - this.radius = radius; - - return this; - - }, - - setFromPoints: function () { - - var box = new Box3(); - - return function setFromPoints( points, optionalCenter ) { - - var center = this.center; - - if ( optionalCenter !== undefined ) { - - center.copy( optionalCenter ); - - } else { - - box.setFromPoints( points ).getCenter( center ); - - } - - var maxRadiusSq = 0; - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) ); - - } - - this.radius = Math.sqrt( maxRadiusSq ); - - return this; - - }; - - }(), - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( sphere ) { - - this.center.copy( sphere.center ); - this.radius = sphere.radius; - - return this; - - }, - - empty: function () { - - return ( this.radius <= 0 ); - - }, - - containsPoint: function ( point ) { - - return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) ); - - }, - - distanceToPoint: function ( point ) { - - return ( point.distanceTo( this.center ) - this.radius ); - - }, - - intersectsSphere: function ( sphere ) { - - var radiusSum = this.radius + sphere.radius; - - return sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum ); - - }, - - intersectsBox: function ( box ) { - - return box.intersectsSphere( this ); - - }, - - intersectsPlane: function ( plane ) { - - // We use the following equation to compute the signed distance from - // the center of the sphere to the plane. - // - // distance = q * n - d - // - // If this distance is greater than the radius of the sphere, - // then there is no intersection. - - return Math.abs( this.center.dot( plane.normal ) - plane.constant ) <= this.radius; - - }, - - clampPoint: function ( point, optionalTarget ) { - - var deltaLengthSq = this.center.distanceToSquared( point ); - - var result = optionalTarget || new Vector3(); - - result.copy( point ); - - if ( deltaLengthSq > ( this.radius * this.radius ) ) { - - result.sub( this.center ).normalize(); - result.multiplyScalar( this.radius ).add( this.center ); - - } - - return result; - - }, - - getBoundingBox: function ( optionalTarget ) { - - var box = optionalTarget || new Box3(); - - box.set( this.center, this.center ); - box.expandByScalar( this.radius ); - - return box; - - }, - - applyMatrix4: function ( matrix ) { - - this.center.applyMatrix4( matrix ); - this.radius = this.radius * matrix.getMaxScaleOnAxis(); - - return this; - - }, - - translate: function ( offset ) { - - this.center.add( offset ); - - return this; - - }, - - equals: function ( sphere ) { - - return sphere.center.equals( this.center ) && ( sphere.radius === this.radius ); - - } - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://clara.io - * @author tschw - */ - - function Matrix3() { - - this.elements = new Float32Array( [ - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ] ); - - if ( arguments.length > 0 ) { - - console.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' ); - - } - - } - - Matrix3.prototype = { - - constructor: Matrix3, - - isMatrix3: true, - - set: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) { - - var te = this.elements; - - te[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31; - te[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32; - te[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33; - - return this; - - }, - - identity: function () { - - this.set( - - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - - ); - - return this; - - }, - - clone: function () { - - return new this.constructor().fromArray( this.elements ); - - }, - - copy: function ( m ) { - - var me = m.elements; - - this.set( - - me[ 0 ], me[ 3 ], me[ 6 ], - me[ 1 ], me[ 4 ], me[ 7 ], - me[ 2 ], me[ 5 ], me[ 8 ] - - ); - - return this; - - }, - - setFromMatrix4: function( m ) { - - var me = m.elements; - - this.set( - - me[ 0 ], me[ 4 ], me[ 8 ], - me[ 1 ], me[ 5 ], me[ 9 ], - me[ 2 ], me[ 6 ], me[ 10 ] - - ); - - return this; - - }, - - applyToVector3Array: function () { - - var v1; - - return function applyToVector3Array( array, offset, length ) { - - if ( v1 === undefined ) v1 = new Vector3(); - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = array.length; - - for ( var i = 0, j = offset; i < length; i += 3, j += 3 ) { - - v1.fromArray( array, j ); - v1.applyMatrix3( this ); - v1.toArray( array, j ); - - } - - return array; - - }; - - }(), - - applyToBuffer: function () { - - var v1; - - return function applyToBuffer( buffer, offset, length ) { - - if ( v1 === undefined ) v1 = new Vector3(); - if ( offset === undefined ) offset = 0; - if ( length === undefined ) length = buffer.length / buffer.itemSize; - - for ( var i = 0, j = offset; i < length; i ++, j ++ ) { - - v1.x = buffer.getX( j ); - v1.y = buffer.getY( j ); - v1.z = buffer.getZ( j ); - - v1.applyMatrix3( this ); - - buffer.setXYZ( v1.x, v1.y, v1.z ); - - } - - return buffer; - - }; - - }(), - - multiplyScalar: function ( s ) { - - var te = this.elements; - - te[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s; - te[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s; - te[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s; - - return this; - - }, - - determinant: function () { - - var te = this.elements; - - var a = te[ 0 ], b = te[ 1 ], c = te[ 2 ], - d = te[ 3 ], e = te[ 4 ], f = te[ 5 ], - g = te[ 6 ], h = te[ 7 ], i = te[ 8 ]; - - return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; - - }, - - getInverse: function ( matrix, throwOnDegenerate ) { - - if ( (matrix && matrix.isMatrix4) ) { - - console.error( "THREE.Matrix3.getInverse no longer takes a Matrix4 argument." ); - - } - - var me = matrix.elements, - te = this.elements, - - n11 = me[ 0 ], n21 = me[ 1 ], n31 = me[ 2 ], - n12 = me[ 3 ], n22 = me[ 4 ], n32 = me[ 5 ], - n13 = me[ 6 ], n23 = me[ 7 ], n33 = me[ 8 ], - - t11 = n33 * n22 - n32 * n23, - t12 = n32 * n13 - n33 * n12, - t13 = n23 * n12 - n22 * n13, - - det = n11 * t11 + n21 * t12 + n31 * t13; - - if ( det === 0 ) { - - var msg = "THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"; - - if ( throwOnDegenerate === true ) { - - throw new Error( msg ); - - } else { - - console.warn( msg ); - - } - - return this.identity(); - } - - var detInv = 1 / det; - - te[ 0 ] = t11 * detInv; - te[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv; - te[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv; - - te[ 3 ] = t12 * detInv; - te[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv; - te[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv; - - te[ 6 ] = t13 * detInv; - te[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv; - te[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv; - - return this; - - }, - - transpose: function () { - - var tmp, m = this.elements; - - tmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp; - tmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp; - tmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp; - - return this; - - }, - - flattenToArrayOffset: function ( array, offset ) { - - console.warn( "THREE.Matrix3: .flattenToArrayOffset is deprecated " + - "- just use .toArray instead." ); - - return this.toArray( array, offset ); - - }, - - getNormalMatrix: function ( matrix4 ) { - - return this.setFromMatrix4( matrix4 ).getInverse( this ).transpose(); - - }, - - transposeIntoArray: function ( r ) { - - var m = this.elements; - - r[ 0 ] = m[ 0 ]; - r[ 1 ] = m[ 3 ]; - r[ 2 ] = m[ 6 ]; - r[ 3 ] = m[ 1 ]; - r[ 4 ] = m[ 4 ]; - r[ 5 ] = m[ 7 ]; - r[ 6 ] = m[ 2 ]; - r[ 7 ] = m[ 5 ]; - r[ 8 ] = m[ 8 ]; - - return this; - - }, - - fromArray: function ( array, offset ) { - - if ( offset === undefined ) offset = 0; - - for( var i = 0; i < 9; i ++ ) { - - this.elements[ i ] = array[ i + offset ]; - - } - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - var te = this.elements; - - array[ offset ] = te[ 0 ]; - array[ offset + 1 ] = te[ 1 ]; - array[ offset + 2 ] = te[ 2 ]; - - array[ offset + 3 ] = te[ 3 ]; - array[ offset + 4 ] = te[ 4 ]; - array[ offset + 5 ] = te[ 5 ]; - - array[ offset + 6 ] = te[ 6 ]; - array[ offset + 7 ] = te[ 7 ]; - array[ offset + 8 ] = te[ 8 ]; - - return array; - - } - - }; - - /** - * @author bhouston / http://clara.io - */ - - function Plane( normal, constant ) { - - this.normal = ( normal !== undefined ) ? normal : new Vector3( 1, 0, 0 ); - this.constant = ( constant !== undefined ) ? constant : 0; - - } - - Plane.prototype = { - - constructor: Plane, - - set: function ( normal, constant ) { - - this.normal.copy( normal ); - this.constant = constant; - - return this; - - }, - - setComponents: function ( x, y, z, w ) { - - this.normal.set( x, y, z ); - this.constant = w; - - return this; - - }, - - setFromNormalAndCoplanarPoint: function ( normal, point ) { - - this.normal.copy( normal ); - this.constant = - point.dot( this.normal ); // must be this.normal, not normal, as this.normal is normalized - - return this; - - }, - - setFromCoplanarPoints: function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - - return function setFromCoplanarPoints( a, b, c ) { - - var normal = v1.subVectors( c, b ).cross( v2.subVectors( a, b ) ).normalize(); - - // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? - - this.setFromNormalAndCoplanarPoint( normal, a ); - - return this; - - }; - - }(), - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( plane ) { - - this.normal.copy( plane.normal ); - this.constant = plane.constant; - - return this; - - }, - - normalize: function () { - - // Note: will lead to a divide by zero if the plane is invalid. - - var inverseNormalLength = 1.0 / this.normal.length(); - this.normal.multiplyScalar( inverseNormalLength ); - this.constant *= inverseNormalLength; - - return this; - - }, - - negate: function () { - - this.constant *= - 1; - this.normal.negate(); - - return this; - - }, - - distanceToPoint: function ( point ) { - - return this.normal.dot( point ) + this.constant; - - }, - - distanceToSphere: function ( sphere ) { - - return this.distanceToPoint( sphere.center ) - sphere.radius; - - }, - - projectPoint: function ( point, optionalTarget ) { - - return this.orthoPoint( point, optionalTarget ).sub( point ).negate(); - - }, - - orthoPoint: function ( point, optionalTarget ) { - - var perpendicularMagnitude = this.distanceToPoint( point ); - - var result = optionalTarget || new Vector3(); - return result.copy( this.normal ).multiplyScalar( perpendicularMagnitude ); - - }, - - intersectLine: function () { - - var v1 = new Vector3(); - - return function intersectLine( line, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - var direction = line.delta( v1 ); - - var denominator = this.normal.dot( direction ); - - if ( denominator === 0 ) { - - // line is coplanar, return origin - if ( this.distanceToPoint( line.start ) === 0 ) { - - return result.copy( line.start ); - - } - - // Unsure if this is the correct method to handle this case. - return undefined; - - } - - var t = - ( line.start.dot( this.normal ) + this.constant ) / denominator; - - if ( t < 0 || t > 1 ) { - - return undefined; - - } - - return result.copy( direction ).multiplyScalar( t ).add( line.start ); - - }; - - }(), - - intersectsLine: function ( line ) { - - // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it. - - var startSign = this.distanceToPoint( line.start ); - var endSign = this.distanceToPoint( line.end ); - - return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 ); - - }, - - intersectsBox: function ( box ) { - - return box.intersectsPlane( this ); - - }, - - intersectsSphere: function ( sphere ) { - - return sphere.intersectsPlane( this ); - - }, - - coplanarPoint: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.copy( this.normal ).multiplyScalar( - this.constant ); - - }, - - applyMatrix4: function () { - - var v1 = new Vector3(); - var m1 = new Matrix3(); - - return function applyMatrix4( matrix, optionalNormalMatrix ) { - - var referencePoint = this.coplanarPoint( v1 ).applyMatrix4( matrix ); - - // transform normal based on theory here: - // http://www.songho.ca/opengl/gl_normaltransform.html - var normalMatrix = optionalNormalMatrix || m1.getNormalMatrix( matrix ); - var normal = this.normal.applyMatrix3( normalMatrix ).normalize(); - - // recalculate constant (like in setFromNormalAndCoplanarPoint) - this.constant = - referencePoint.dot( normal ); - - return this; - - }; - - }(), - - translate: function ( offset ) { - - this.constant = this.constant - offset.dot( this.normal ); - - return this; - - }, - - equals: function ( plane ) { - - return plane.normal.equals( this.normal ) && ( plane.constant === this.constant ); - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author bhouston / http://clara.io - */ - - function Frustum( p0, p1, p2, p3, p4, p5 ) { - - this.planes = [ - - ( p0 !== undefined ) ? p0 : new Plane(), - ( p1 !== undefined ) ? p1 : new Plane(), - ( p2 !== undefined ) ? p2 : new Plane(), - ( p3 !== undefined ) ? p3 : new Plane(), - ( p4 !== undefined ) ? p4 : new Plane(), - ( p5 !== undefined ) ? p5 : new Plane() - - ]; - - } - - Frustum.prototype = { - - constructor: Frustum, - - set: function ( p0, p1, p2, p3, p4, p5 ) { - - var planes = this.planes; - - planes[ 0 ].copy( p0 ); - planes[ 1 ].copy( p1 ); - planes[ 2 ].copy( p2 ); - planes[ 3 ].copy( p3 ); - planes[ 4 ].copy( p4 ); - planes[ 5 ].copy( p5 ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( frustum ) { - - var planes = this.planes; - - for ( var i = 0; i < 6; i ++ ) { - - planes[ i ].copy( frustum.planes[ i ] ); - - } - - return this; - - }, - - setFromMatrix: function ( m ) { - - var planes = this.planes; - var me = m.elements; - var me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ]; - var me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ]; - var me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ]; - var me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ]; - - planes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize(); - planes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize(); - planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize(); - planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize(); - planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); - planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize(); - - return this; - - }, - - intersectsObject: function () { - - var sphere = new Sphere(); - - return function intersectsObject( object ) { - - var geometry = object.geometry; - - if ( geometry.boundingSphere === null ) - geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ) - .applyMatrix4( object.matrixWorld ); - - return this.intersectsSphere( sphere ); - - }; - - }(), - - intersectsSprite: function () { - - var sphere = new Sphere(); - - return function intersectsSprite( sprite ) { - - sphere.center.set( 0, 0, 0 ); - sphere.radius = 0.7071067811865476; - sphere.applyMatrix4( sprite.matrixWorld ); - - return this.intersectsSphere( sphere ); - - }; - - }(), - - intersectsSphere: function ( sphere ) { - - var planes = this.planes; - var center = sphere.center; - var negRadius = - sphere.radius; - - for ( var i = 0; i < 6; i ++ ) { - - var distance = planes[ i ].distanceToPoint( center ); - - if ( distance < negRadius ) { - - return false; - - } - - } - - return true; - - }, - - intersectsBox: function () { - - var p1 = new Vector3(), - p2 = new Vector3(); - - return function intersectsBox( box ) { - - var planes = this.planes; - - for ( var i = 0; i < 6 ; i ++ ) { - - var plane = planes[ i ]; - - p1.x = plane.normal.x > 0 ? box.min.x : box.max.x; - p2.x = plane.normal.x > 0 ? box.max.x : box.min.x; - p1.y = plane.normal.y > 0 ? box.min.y : box.max.y; - p2.y = plane.normal.y > 0 ? box.max.y : box.min.y; - p1.z = plane.normal.z > 0 ? box.min.z : box.max.z; - p2.z = plane.normal.z > 0 ? box.max.z : box.min.z; - - var d1 = plane.distanceToPoint( p1 ); - var d2 = plane.distanceToPoint( p2 ); - - // if both outside plane, no intersection - - if ( d1 < 0 && d2 < 0 ) { - - return false; - - } - - } - - return true; - - }; - - }(), - - - containsPoint: function ( point ) { - - var planes = this.planes; - - for ( var i = 0; i < 6; i ++ ) { - - if ( planes[ i ].distanceToPoint( point ) < 0 ) { - - return false; - - } - - } - - return true; - - } - - }; - - function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) { - - var _gl = _renderer.context, - _state = _renderer.state, - _frustum = new Frustum(), - _projScreenMatrix = new Matrix4(), - - _lightShadows = _lights.shadows, - - _shadowMapSize = new Vector2(), - _maxShadowMapSize = new Vector2( capabilities.maxTextureSize, capabilities.maxTextureSize ), - - _lookTarget = new Vector3(), - _lightPositionWorld = new Vector3(), - - _renderList = [], - - _MorphingFlag = 1, - _SkinningFlag = 2, - - _NumberOfMaterialVariants = ( _MorphingFlag | _SkinningFlag ) + 1, - - _depthMaterials = new Array( _NumberOfMaterialVariants ), - _distanceMaterials = new Array( _NumberOfMaterialVariants ), - - _materialCache = {}; - - var cubeDirections = [ - new Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ), - new Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 ) - ]; - - var cubeUps = [ - new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), - new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ), new Vector3( 0, 0, - 1 ) - ]; - - var cube2DViewPorts = [ - new Vector4(), new Vector4(), new Vector4(), - new Vector4(), new Vector4(), new Vector4() - ]; - - // init - - var depthMaterialTemplate = new MeshDepthMaterial(); - depthMaterialTemplate.depthPacking = RGBADepthPacking; - depthMaterialTemplate.clipping = true; - - var distanceShader = ShaderLib[ "distanceRGBA" ]; - var distanceUniforms = exports.UniformsUtils.clone( distanceShader.uniforms ); - - for ( var i = 0; i !== _NumberOfMaterialVariants; ++ i ) { - - var useMorphing = ( i & _MorphingFlag ) !== 0; - var useSkinning = ( i & _SkinningFlag ) !== 0; - - var depthMaterial = depthMaterialTemplate.clone(); - depthMaterial.morphTargets = useMorphing; - depthMaterial.skinning = useSkinning; - - _depthMaterials[ i ] = depthMaterial; - - var distanceMaterial = new ShaderMaterial( { - defines: { - 'USE_SHADOWMAP': '' - }, - uniforms: distanceUniforms, - vertexShader: distanceShader.vertexShader, - fragmentShader: distanceShader.fragmentShader, - morphTargets: useMorphing, - skinning: useSkinning, - clipping: true - } ); - - _distanceMaterials[ i ] = distanceMaterial; - - } - - // - - var scope = this; - - this.enabled = false; - - this.autoUpdate = true; - this.needsUpdate = false; - - this.type = PCFShadowMap; - - this.renderReverseSided = true; - this.renderSingleSided = true; - - this.render = function ( scene, camera ) { - - if ( scope.enabled === false ) return; - if ( scope.autoUpdate === false && scope.needsUpdate === false ) return; - - if ( _lightShadows.length === 0 ) return; - - // Set GL state for depth map. - _state.clearColor( 1, 1, 1, 1 ); - _state.disable( _gl.BLEND ); - _state.setDepthTest( true ); - _state.setScissorTest( false ); - - // render depth map - - var faceCount, isPointLight; - - for ( var i = 0, il = _lightShadows.length; i < il; i ++ ) { - - var light = _lightShadows[ i ]; - var shadow = light.shadow; - - if ( shadow === undefined ) { - - console.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' ); - continue; - - } - - var shadowCamera = shadow.camera; - - _shadowMapSize.copy( shadow.mapSize ); - _shadowMapSize.min( _maxShadowMapSize ); - - if ( (light && light.isPointLight) ) { - - faceCount = 6; - isPointLight = true; - - var vpWidth = _shadowMapSize.x; - var vpHeight = _shadowMapSize.y; - - // These viewports map a cube-map onto a 2D texture with the - // following orientation: - // - // xzXZ - // y Y - // - // X - Positive x direction - // x - Negative x direction - // Y - Positive y direction - // y - Negative y direction - // Z - Positive z direction - // z - Negative z direction - - // positive X - cube2DViewPorts[ 0 ].set( vpWidth * 2, vpHeight, vpWidth, vpHeight ); - // negative X - cube2DViewPorts[ 1 ].set( 0, vpHeight, vpWidth, vpHeight ); - // positive Z - cube2DViewPorts[ 2 ].set( vpWidth * 3, vpHeight, vpWidth, vpHeight ); - // negative Z - cube2DViewPorts[ 3 ].set( vpWidth, vpHeight, vpWidth, vpHeight ); - // positive Y - cube2DViewPorts[ 4 ].set( vpWidth * 3, 0, vpWidth, vpHeight ); - // negative Y - cube2DViewPorts[ 5 ].set( vpWidth, 0, vpWidth, vpHeight ); - - _shadowMapSize.x *= 4.0; - _shadowMapSize.y *= 2.0; - - } else { - - faceCount = 1; - isPointLight = false; - - } - - if ( shadow.map === null ) { - - var pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat }; - - shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars ); - - shadowCamera.updateProjectionMatrix(); - - } - - if ( (shadow && shadow.isSpotLightShadow) ) { - - shadow.update( light ); - - } - - var shadowMap = shadow.map; - var shadowMatrix = shadow.matrix; - - _lightPositionWorld.setFromMatrixPosition( light.matrixWorld ); - shadowCamera.position.copy( _lightPositionWorld ); - - _renderer.setRenderTarget( shadowMap ); - _renderer.clear(); - - // render shadow map for each cube face (if omni-directional) or - // run a single pass if not - - for ( var face = 0; face < faceCount; face ++ ) { - - if ( isPointLight ) { - - _lookTarget.copy( shadowCamera.position ); - _lookTarget.add( cubeDirections[ face ] ); - shadowCamera.up.copy( cubeUps[ face ] ); - shadowCamera.lookAt( _lookTarget ); - - var vpDimensions = cube2DViewPorts[ face ]; - _state.viewport( vpDimensions ); - - } else { - - _lookTarget.setFromMatrixPosition( light.target.matrixWorld ); - shadowCamera.lookAt( _lookTarget ); - - } - - shadowCamera.updateMatrixWorld(); - shadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld ); - - // compute shadow matrix - - shadowMatrix.set( - 0.5, 0.0, 0.0, 0.5, - 0.0, 0.5, 0.0, 0.5, - 0.0, 0.0, 0.5, 0.5, - 0.0, 0.0, 0.0, 1.0 - ); - - shadowMatrix.multiply( shadowCamera.projectionMatrix ); - shadowMatrix.multiply( shadowCamera.matrixWorldInverse ); - - // update camera matrices and frustum - - _projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - // set object matrices & frustum culling - - _renderList.length = 0; - - projectObject( scene, camera, shadowCamera ); - - // render shadow map - // render regular objects - - for ( var j = 0, jl = _renderList.length; j < jl; j ++ ) { - - var object = _renderList[ j ]; - var geometry = _objects.update( object ); - var material = object.material; - - if ( (material && material.isMultiMaterial) ) { - - var groups = geometry.groups; - var materials = material.materials; - - for ( var k = 0, kl = groups.length; k < kl; k ++ ) { - - var group = groups[ k ]; - var groupMaterial = materials[ group.materialIndex ]; - - if ( groupMaterial.visible === true ) { - - var depthMaterial = getDepthMaterial( object, groupMaterial, isPointLight, _lightPositionWorld ); - _renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group ); - - } - - } - - } else { - - var depthMaterial = getDepthMaterial( object, material, isPointLight, _lightPositionWorld ); - _renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null ); - - } - - } - - } - - } - - // Restore GL state. - var clearColor = _renderer.getClearColor(), - clearAlpha = _renderer.getClearAlpha(); - _renderer.setClearColor( clearColor, clearAlpha ); - - scope.needsUpdate = false; - - }; - - function getDepthMaterial( object, material, isPointLight, lightPositionWorld ) { - - var geometry = object.geometry; - - var result = null; - - var materialVariants = _depthMaterials; - var customMaterial = object.customDepthMaterial; - - if ( isPointLight ) { - - materialVariants = _distanceMaterials; - customMaterial = object.customDistanceMaterial; - - } - - if ( ! customMaterial ) { - - var useMorphing = false; - - if ( material.morphTargets ) { - - if ( (geometry && geometry.isBufferGeometry) ) { - - useMorphing = geometry.morphAttributes && geometry.morphAttributes.position && geometry.morphAttributes.position.length > 0; - - } else if ( (geometry && geometry.isGeometry) ) { - - useMorphing = geometry.morphTargets && geometry.morphTargets.length > 0; - - } - - } - - var useSkinning = object.isSkinnedMesh && material.skinning; - - var variantIndex = 0; - - if ( useMorphing ) variantIndex |= _MorphingFlag; - if ( useSkinning ) variantIndex |= _SkinningFlag; - - result = materialVariants[ variantIndex ]; - - } else { - - result = customMaterial; - - } - - if ( _renderer.localClippingEnabled && - material.clipShadows === true && - material.clippingPlanes.length !== 0 ) { - - // in this case we need a unique material instance reflecting the - // appropriate state - - var keyA = result.uuid, keyB = material.uuid; - - var materialsForVariant = _materialCache[ keyA ]; - - if ( materialsForVariant === undefined ) { - - materialsForVariant = {}; - _materialCache[ keyA ] = materialsForVariant; - - } - - var cachedMaterial = materialsForVariant[ keyB ]; - - if ( cachedMaterial === undefined ) { - - cachedMaterial = result.clone(); - materialsForVariant[ keyB ] = cachedMaterial; - - } - - result = cachedMaterial; - - } - - result.visible = material.visible; - result.wireframe = material.wireframe; - - var side = material.side; - - if ( scope.renderSingleSided && side == DoubleSide ) { - - side = FrontSide; - - } - - if ( scope.renderReverseSided ) { - - if ( side === FrontSide ) side = BackSide; - else if ( side === BackSide ) side = FrontSide; - - } - - result.side = side; - - result.clipShadows = material.clipShadows; - result.clippingPlanes = material.clippingPlanes; - - result.wireframeLinewidth = material.wireframeLinewidth; - result.linewidth = material.linewidth; - - if ( isPointLight && result.uniforms.lightPos !== undefined ) { - - result.uniforms.lightPos.value.copy( lightPositionWorld ); - - } - - return result; - - } - - function projectObject( object, camera, shadowCamera ) { - - if ( object.visible === false ) return; - - var visible = ( object.layers.mask & camera.layers.mask ) !== 0; - - if ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) { - - if ( object.castShadow && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) { - - var material = object.material; - - if ( material.visible === true ) { - - object.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); - _renderList.push( object ); - - } - - } - - } - - var children = object.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - projectObject( children[ i ], camera, shadowCamera ); - - } - - } - - } - - /** - * @author bhouston / http://clara.io - */ - - function Ray( origin, direction ) { - - this.origin = ( origin !== undefined ) ? origin : new Vector3(); - this.direction = ( direction !== undefined ) ? direction : new Vector3(); - - } - - Ray.prototype = { - - constructor: Ray, - - set: function ( origin, direction ) { - - this.origin.copy( origin ); - this.direction.copy( direction ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( ray ) { - - this.origin.copy( ray.origin ); - this.direction.copy( ray.direction ); - - return this; - - }, - - at: function ( t, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - return result.copy( this.direction ).multiplyScalar( t ).add( this.origin ); - - }, - - lookAt: function ( v ) { - - this.direction.copy( v ).sub( this.origin ).normalize(); - - return this; - - }, - - recast: function () { - - var v1 = new Vector3(); - - return function recast( t ) { - - this.origin.copy( this.at( t, v1 ) ); - - return this; - - }; - - }(), - - closestPointToPoint: function ( point, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - result.subVectors( point, this.origin ); - var directionDistance = result.dot( this.direction ); - - if ( directionDistance < 0 ) { - - return result.copy( this.origin ); - - } - - return result.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - }, - - distanceToPoint: function ( point ) { - - return Math.sqrt( this.distanceSqToPoint( point ) ); - - }, - - distanceSqToPoint: function () { - - var v1 = new Vector3(); - - return function distanceSqToPoint( point ) { - - var directionDistance = v1.subVectors( point, this.origin ).dot( this.direction ); - - // point behind the ray - - if ( directionDistance < 0 ) { - - return this.origin.distanceToSquared( point ); - - } - - v1.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - - return v1.distanceToSquared( point ); - - }; - - }(), - - distanceSqToSegment: function () { - - var segCenter = new Vector3(); - var segDir = new Vector3(); - var diff = new Vector3(); - - return function distanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) { - - // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h - // It returns the min distance between the ray and the segment - // defined by v0 and v1 - // It can also set two optional targets : - // - The closest point on the ray - // - The closest point on the segment - - segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 ); - segDir.copy( v1 ).sub( v0 ).normalize(); - diff.copy( this.origin ).sub( segCenter ); - - var segExtent = v0.distanceTo( v1 ) * 0.5; - var a01 = - this.direction.dot( segDir ); - var b0 = diff.dot( this.direction ); - var b1 = - diff.dot( segDir ); - var c = diff.lengthSq(); - var det = Math.abs( 1 - a01 * a01 ); - var s0, s1, sqrDist, extDet; - - if ( det > 0 ) { - - // The ray and segment are not parallel. - - s0 = a01 * b1 - b0; - s1 = a01 * b0 - b1; - extDet = segExtent * det; - - if ( s0 >= 0 ) { - - if ( s1 >= - extDet ) { - - if ( s1 <= extDet ) { - - // region 0 - // Minimum at interior points of ray and segment. - - var invDet = 1 / det; - s0 *= invDet; - s1 *= invDet; - sqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c; - - } else { - - // region 1 - - s1 = segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - // region 5 - - s1 = - segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } else { - - if ( s1 <= - extDet ) { - - // region 4 - - s0 = Math.max( 0, - ( - a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } else if ( s1 <= extDet ) { - - // region 3 - - s0 = 0; - s1 = Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = s1 * ( s1 + 2 * b1 ) + c; - - } else { - - // region 2 - - s0 = Math.max( 0, - ( a01 * segExtent + b0 ) ); - s1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - } - - } else { - - // Ray and segment are parallel. - - s1 = ( a01 > 0 ) ? - segExtent : segExtent; - s0 = Math.max( 0, - ( a01 * s1 + b0 ) ); - sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c; - - } - - if ( optionalPointOnRay ) { - - optionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin ); - - } - - if ( optionalPointOnSegment ) { - - optionalPointOnSegment.copy( segDir ).multiplyScalar( s1 ).add( segCenter ); - - } - - return sqrDist; - - }; - - }(), - - intersectSphere: function () { - - var v1 = new Vector3(); - - return function intersectSphere( sphere, optionalTarget ) { - - v1.subVectors( sphere.center, this.origin ); - var tca = v1.dot( this.direction ); - var d2 = v1.dot( v1 ) - tca * tca; - var radius2 = sphere.radius * sphere.radius; - - if ( d2 > radius2 ) return null; - - var thc = Math.sqrt( radius2 - d2 ); - - // t0 = first intersect point - entrance on front of sphere - var t0 = tca - thc; - - // t1 = second intersect point - exit point on back of sphere - var t1 = tca + thc; - - // test to see if both t0 and t1 are behind the ray - if so, return null - if ( t0 < 0 && t1 < 0 ) return null; - - // test to see if t0 is behind the ray: - // if it is, the ray is inside the sphere, so return the second exit point scaled by t1, - // in order to always return an intersect point that is in front of the ray. - if ( t0 < 0 ) return this.at( t1, optionalTarget ); - - // else t0 is in front of the ray, so return the first collision point scaled by t0 - return this.at( t0, optionalTarget ); - - }; - - }(), - - intersectsSphere: function ( sphere ) { - - return this.distanceToPoint( sphere.center ) <= sphere.radius; - - }, - - distanceToPlane: function ( plane ) { - - var denominator = plane.normal.dot( this.direction ); - - if ( denominator === 0 ) { - - // line is coplanar, return origin - if ( plane.distanceToPoint( this.origin ) === 0 ) { - - return 0; - - } - - // Null is preferable to undefined since undefined means.... it is undefined - - return null; - - } - - var t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator; - - // Return if the ray never intersects the plane - - return t >= 0 ? t : null; - - }, - - intersectPlane: function ( plane, optionalTarget ) { - - var t = this.distanceToPlane( plane ); - - if ( t === null ) { - - return null; - - } - - return this.at( t, optionalTarget ); - - }, - - - - intersectsPlane: function ( plane ) { - - // check if the ray lies on the plane first - - var distToPoint = plane.distanceToPoint( this.origin ); - - if ( distToPoint === 0 ) { - - return true; - - } - - var denominator = plane.normal.dot( this.direction ); - - if ( denominator * distToPoint < 0 ) { - - return true; - - } - - // ray origin is behind the plane (and is pointing behind it) - - return false; - - }, - - intersectBox: function ( box, optionalTarget ) { - - var tmin, tmax, tymin, tymax, tzmin, tzmax; - - var invdirx = 1 / this.direction.x, - invdiry = 1 / this.direction.y, - invdirz = 1 / this.direction.z; - - var origin = this.origin; - - if ( invdirx >= 0 ) { - - tmin = ( box.min.x - origin.x ) * invdirx; - tmax = ( box.max.x - origin.x ) * invdirx; - - } else { - - tmin = ( box.max.x - origin.x ) * invdirx; - tmax = ( box.min.x - origin.x ) * invdirx; - - } - - if ( invdiry >= 0 ) { - - tymin = ( box.min.y - origin.y ) * invdiry; - tymax = ( box.max.y - origin.y ) * invdiry; - - } else { - - tymin = ( box.max.y - origin.y ) * invdiry; - tymax = ( box.min.y - origin.y ) * invdiry; - - } - - if ( ( tmin > tymax ) || ( tymin > tmax ) ) return null; - - // These lines also handle the case where tmin or tmax is NaN - // (result of 0 * Infinity). x !== x returns true if x is NaN - - if ( tymin > tmin || tmin !== tmin ) tmin = tymin; - - if ( tymax < tmax || tmax !== tmax ) tmax = tymax; - - if ( invdirz >= 0 ) { - - tzmin = ( box.min.z - origin.z ) * invdirz; - tzmax = ( box.max.z - origin.z ) * invdirz; - - } else { - - tzmin = ( box.max.z - origin.z ) * invdirz; - tzmax = ( box.min.z - origin.z ) * invdirz; - - } - - if ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null; - - if ( tzmin > tmin || tmin !== tmin ) tmin = tzmin; - - if ( tzmax < tmax || tmax !== tmax ) tmax = tzmax; - - //return point closest to the ray (positive side) - - if ( tmax < 0 ) return null; - - return this.at( tmin >= 0 ? tmin : tmax, optionalTarget ); - - }, - - intersectsBox: ( function () { - - var v = new Vector3(); - - return function intersectsBox( box ) { - - return this.intersectBox( box, v ) !== null; - - }; - - } )(), - - intersectTriangle: function () { - - // Compute the offset origin, edges, and normal. - var diff = new Vector3(); - var edge1 = new Vector3(); - var edge2 = new Vector3(); - var normal = new Vector3(); - - return function intersectTriangle( a, b, c, backfaceCulling, optionalTarget ) { - - // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h - - edge1.subVectors( b, a ); - edge2.subVectors( c, a ); - normal.crossVectors( edge1, edge2 ); - - // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, - // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by - // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2)) - // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q)) - // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N) - var DdN = this.direction.dot( normal ); - var sign; - - if ( DdN > 0 ) { - - if ( backfaceCulling ) return null; - sign = 1; - - } else if ( DdN < 0 ) { - - sign = - 1; - DdN = - DdN; - - } else { - - return null; - - } - - diff.subVectors( this.origin, a ); - var DdQxE2 = sign * this.direction.dot( edge2.crossVectors( diff, edge2 ) ); - - // b1 < 0, no intersection - if ( DdQxE2 < 0 ) { - - return null; - - } - - var DdE1xQ = sign * this.direction.dot( edge1.cross( diff ) ); - - // b2 < 0, no intersection - if ( DdE1xQ < 0 ) { - - return null; - - } - - // b1+b2 > 1, no intersection - if ( DdQxE2 + DdE1xQ > DdN ) { - - return null; - - } - - // Line intersects triangle, check if ray does. - var QdN = - sign * diff.dot( normal ); - - // t < 0, no intersection - if ( QdN < 0 ) { - - return null; - - } - - // Ray intersects triangle. - return this.at( QdN / DdN, optionalTarget ); - - }; - - }(), - - applyMatrix4: function ( matrix4 ) { - - this.direction.add( this.origin ).applyMatrix4( matrix4 ); - this.origin.applyMatrix4( matrix4 ); - this.direction.sub( this.origin ); - this.direction.normalize(); - - return this; - - }, - - equals: function ( ray ) { - - return ray.origin.equals( this.origin ) && ray.direction.equals( this.direction ); - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - * @author bhouston / http://clara.io - */ - - function Euler( x, y, z, order ) { - - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._order = order || Euler.DefaultOrder; - - } - - Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; - - Euler.DefaultOrder = 'XYZ'; - - Euler.prototype = { - - constructor: Euler, - - isEuler: true, - - get x () { - - return this._x; - - }, - - set x ( value ) { - - this._x = value; - this.onChangeCallback(); - - }, - - get y () { - - return this._y; - - }, - - set y ( value ) { - - this._y = value; - this.onChangeCallback(); - - }, - - get z () { - - return this._z; - - }, - - set z ( value ) { - - this._z = value; - this.onChangeCallback(); - - }, - - get order () { - - return this._order; - - }, - - set order ( value ) { - - this._order = value; - this.onChangeCallback(); - - }, - - set: function ( x, y, z, order ) { - - this._x = x; - this._y = y; - this._z = z; - this._order = order || this._order; - - this.onChangeCallback(); - - return this; - - }, - - clone: function () { - - return new this.constructor( this._x, this._y, this._z, this._order ); - - }, - - copy: function ( euler ) { - - this._x = euler._x; - this._y = euler._y; - this._z = euler._z; - this._order = euler._order; - - this.onChangeCallback(); - - return this; - - }, - - setFromRotationMatrix: function ( m, order, update ) { - - var clamp = exports.Math.clamp; - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - var te = m.elements; - var m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ]; - var m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ]; - var m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; - - order = order || this._order; - - if ( order === 'XYZ' ) { - - this._y = Math.asin( clamp( m13, - 1, 1 ) ); - - if ( Math.abs( m13 ) < 0.99999 ) { - - this._x = Math.atan2( - m23, m33 ); - this._z = Math.atan2( - m12, m11 ); - - } else { - - this._x = Math.atan2( m32, m22 ); - this._z = 0; - - } - - } else if ( order === 'YXZ' ) { - - this._x = Math.asin( - clamp( m23, - 1, 1 ) ); - - if ( Math.abs( m23 ) < 0.99999 ) { - - this._y = Math.atan2( m13, m33 ); - this._z = Math.atan2( m21, m22 ); - - } else { - - this._y = Math.atan2( - m31, m11 ); - this._z = 0; - - } - - } else if ( order === 'ZXY' ) { - - this._x = Math.asin( clamp( m32, - 1, 1 ) ); - - if ( Math.abs( m32 ) < 0.99999 ) { - - this._y = Math.atan2( - m31, m33 ); - this._z = Math.atan2( - m12, m22 ); - - } else { - - this._y = 0; - this._z = Math.atan2( m21, m11 ); - - } - - } else if ( order === 'ZYX' ) { - - this._y = Math.asin( - clamp( m31, - 1, 1 ) ); - - if ( Math.abs( m31 ) < 0.99999 ) { - - this._x = Math.atan2( m32, m33 ); - this._z = Math.atan2( m21, m11 ); - - } else { - - this._x = 0; - this._z = Math.atan2( - m12, m22 ); - - } - - } else if ( order === 'YZX' ) { - - this._z = Math.asin( clamp( m21, - 1, 1 ) ); - - if ( Math.abs( m21 ) < 0.99999 ) { - - this._x = Math.atan2( - m23, m22 ); - this._y = Math.atan2( - m31, m11 ); - - } else { - - this._x = 0; - this._y = Math.atan2( m13, m33 ); - - } - - } else if ( order === 'XZY' ) { - - this._z = Math.asin( - clamp( m12, - 1, 1 ) ); - - if ( Math.abs( m12 ) < 0.99999 ) { - - this._x = Math.atan2( m32, m22 ); - this._y = Math.atan2( m13, m11 ); - - } else { - - this._x = Math.atan2( - m23, m33 ); - this._y = 0; - - } - - } else { - - console.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order ); - - } - - this._order = order; - - if ( update !== false ) this.onChangeCallback(); - - return this; - - }, - - setFromQuaternion: function () { - - var matrix; - - return function setFromQuaternion( q, order, update ) { - - if ( matrix === undefined ) matrix = new Matrix4(); - - matrix.makeRotationFromQuaternion( q ); - - return this.setFromRotationMatrix( matrix, order, update ); - - }; - - }(), - - setFromVector3: function ( v, order ) { - - return this.set( v.x, v.y, v.z, order || this._order ); - - }, - - reorder: function () { - - // WARNING: this discards revolution information -bhouston - - var q = new Quaternion(); - - return function reorder( newOrder ) { - - q.setFromEuler( this ); - - return this.setFromQuaternion( q, newOrder ); - - }; - - }(), - - equals: function ( euler ) { - - return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order ); - - }, - - fromArray: function ( array ) { - - this._x = array[ 0 ]; - this._y = array[ 1 ]; - this._z = array[ 2 ]; - if ( array[ 3 ] !== undefined ) this._order = array[ 3 ]; - - this.onChangeCallback(); - - return this; - - }, - - toArray: function ( array, offset ) { - - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; - - array[ offset ] = this._x; - array[ offset + 1 ] = this._y; - array[ offset + 2 ] = this._z; - array[ offset + 3 ] = this._order; - - return array; - - }, - - toVector3: function ( optionalResult ) { - - if ( optionalResult ) { - - return optionalResult.set( this._x, this._y, this._z ); - - } else { - - return new Vector3( this._x, this._y, this._z ); - - } - - }, - - onChange: function ( callback ) { - - this.onChangeCallback = callback; - - return this; - - }, - - onChangeCallback: function () {} - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function Layers() { - - this.mask = 1; - - } - - Layers.prototype = { - - constructor: Layers, - - set: function ( channel ) { - - this.mask = 1 << channel; - - }, - - enable: function ( channel ) { - - this.mask |= 1 << channel; - - }, - - toggle: function ( channel ) { - - this.mask ^= 1 << channel; - - }, - - disable: function ( channel ) { - - this.mask &= ~ ( 1 << channel ); - - }, - - test: function ( layers ) { - - return ( this.mask & layers.mask ) !== 0; - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - * @author elephantatwork / www.elephantatwork.ch - */ - - function Object3D() { - - Object.defineProperty( this, 'id', { value: Object3DIdCount() } ); - - this.uuid = exports.Math.generateUUID(); - - this.name = ''; - this.type = 'Object3D'; - - this.parent = null; - this.children = []; - - this.up = Object3D.DefaultUp.clone(); - - var position = new Vector3(); - var rotation = new Euler(); - var quaternion = new Quaternion(); - var scale = new Vector3( 1, 1, 1 ); - - function onRotationChange() { - - quaternion.setFromEuler( rotation, false ); - - } - - function onQuaternionChange() { - - rotation.setFromQuaternion( quaternion, undefined, false ); - - } - - rotation.onChange( onRotationChange ); - quaternion.onChange( onQuaternionChange ); - - Object.defineProperties( this, { - position: { - enumerable: true, - value: position - }, - rotation: { - enumerable: true, - value: rotation - }, - quaternion: { - enumerable: true, - value: quaternion - }, - scale: { - enumerable: true, - value: scale - }, - modelViewMatrix: { - value: new Matrix4() - }, - normalMatrix: { - value: new Matrix3() - } - } ); - - this.matrix = new Matrix4(); - this.matrixWorld = new Matrix4(); - - this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate; - this.matrixWorldNeedsUpdate = false; - - this.layers = new Layers(); - this.visible = true; - - this.castShadow = false; - this.receiveShadow = false; - - this.frustumCulled = true; - this.renderOrder = 0; - - this.userData = {}; - - this.onBeforeRender = null; - - } - - Object3D.DefaultUp = new Vector3( 0, 1, 0 ); - Object3D.DefaultMatrixAutoUpdate = true; - - Object.assign( Object3D.prototype, EventDispatcher.prototype, { - - isObject3D: true, - - applyMatrix: function ( matrix ) { - - this.matrix.multiplyMatrices( matrix, this.matrix ); - - this.matrix.decompose( this.position, this.quaternion, this.scale ); - - }, - - setRotationFromAxisAngle: function ( axis, angle ) { - - // assumes axis is normalized - - this.quaternion.setFromAxisAngle( axis, angle ); - - }, - - setRotationFromEuler: function ( euler ) { - - this.quaternion.setFromEuler( euler, true ); - - }, - - setRotationFromMatrix: function ( m ) { - - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - - this.quaternion.setFromRotationMatrix( m ); - - }, - - setRotationFromQuaternion: function ( q ) { - - // assumes q is normalized - - this.quaternion.copy( q ); - - }, - - rotateOnAxis: function () { - - // rotate object on axis in object space - // axis is assumed to be normalized - - var q1 = new Quaternion(); - - return function rotateOnAxis( axis, angle ) { - - q1.setFromAxisAngle( axis, angle ); - - this.quaternion.multiply( q1 ); - - return this; - - }; - - }(), - - rotateX: function () { - - var v1 = new Vector3( 1, 0, 0 ); - - return function rotateX( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - rotateY: function () { - - var v1 = new Vector3( 0, 1, 0 ); - - return function rotateY( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - rotateZ: function () { - - var v1 = new Vector3( 0, 0, 1 ); - - return function rotateZ( angle ) { - - return this.rotateOnAxis( v1, angle ); - - }; - - }(), - - translateOnAxis: function () { - - // translate object by distance along axis in object space - // axis is assumed to be normalized - - var v1 = new Vector3(); - - return function translateOnAxis( axis, distance ) { - - v1.copy( axis ).applyQuaternion( this.quaternion ); - - this.position.add( v1.multiplyScalar( distance ) ); - - return this; - - }; - - }(), - - translateX: function () { - - var v1 = new Vector3( 1, 0, 0 ); - - return function translateX( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - translateY: function () { - - var v1 = new Vector3( 0, 1, 0 ); - - return function translateY( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - translateZ: function () { - - var v1 = new Vector3( 0, 0, 1 ); - - return function translateZ( distance ) { - - return this.translateOnAxis( v1, distance ); - - }; - - }(), - - localToWorld: function ( vector ) { - - return vector.applyMatrix4( this.matrixWorld ); - - }, - - worldToLocal: function () { - - var m1 = new Matrix4(); - - return function worldToLocal( vector ) { - - return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) ); - - }; - - }(), - - lookAt: function () { - - // This routine does not support objects with rotated and/or translated parent(s) - - var m1 = new Matrix4(); - - return function lookAt( vector ) { - - m1.lookAt( vector, this.position, this.up ); - - this.quaternion.setFromRotationMatrix( m1 ); - - }; - - }(), - - add: function ( object ) { - - if ( arguments.length > 1 ) { - - for ( var i = 0; i < arguments.length; i ++ ) { - - this.add( arguments[ i ] ); - - } - - return this; - - } - - if ( object === this ) { - - console.error( "THREE.Object3D.add: object can't be added as a child of itself.", object ); - return this; - - } - - if ( (object && object.isObject3D) ) { - - if ( object.parent !== null ) { - - object.parent.remove( object ); - - } - - object.parent = this; - object.dispatchEvent( { type: 'added' } ); - - this.children.push( object ); - - } else { - - console.error( "THREE.Object3D.add: object not an instance of THREE.Object3D.", object ); - - } - - return this; - - }, - - remove: function ( object ) { - - if ( arguments.length > 1 ) { - - for ( var i = 0; i < arguments.length; i ++ ) { - - this.remove( arguments[ i ] ); - - } - - } - - var index = this.children.indexOf( object ); - - if ( index !== - 1 ) { - - object.parent = null; - - object.dispatchEvent( { type: 'removed' } ); - - this.children.splice( index, 1 ); - - } - - }, - - getObjectById: function ( id ) { - - return this.getObjectByProperty( 'id', id ); - - }, - - getObjectByName: function ( name ) { - - return this.getObjectByProperty( 'name', name ); - - }, - - getObjectByProperty: function ( name, value ) { - - if ( this[ name ] === value ) return this; - - for ( var i = 0, l = this.children.length; i < l; i ++ ) { - - var child = this.children[ i ]; - var object = child.getObjectByProperty( name, value ); - - if ( object !== undefined ) { - - return object; - - } - - } - - return undefined; - - }, - - getWorldPosition: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - this.updateMatrixWorld( true ); - - return result.setFromMatrixPosition( this.matrixWorld ); - - }, - - getWorldQuaternion: function () { - - var position = new Vector3(); - var scale = new Vector3(); - - return function getWorldQuaternion( optionalTarget ) { - - var result = optionalTarget || new Quaternion(); - - this.updateMatrixWorld( true ); - - this.matrixWorld.decompose( position, result, scale ); - - return result; - - }; - - }(), - - getWorldRotation: function () { - - var quaternion = new Quaternion(); - - return function getWorldRotation( optionalTarget ) { - - var result = optionalTarget || new Euler(); - - this.getWorldQuaternion( quaternion ); - - return result.setFromQuaternion( quaternion, this.rotation.order, false ); - - }; - - }(), - - getWorldScale: function () { - - var position = new Vector3(); - var quaternion = new Quaternion(); - - return function getWorldScale( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - this.updateMatrixWorld( true ); - - this.matrixWorld.decompose( position, quaternion, result ); - - return result; - - }; - - }(), - - getWorldDirection: function () { - - var quaternion = new Quaternion(); - - return function getWorldDirection( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - this.getWorldQuaternion( quaternion ); - - return result.set( 0, 0, 1 ).applyQuaternion( quaternion ); - - }; - - }(), - - raycast: function () {}, - - traverse: function ( callback ) { - - callback( this ); - - var children = this.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].traverse( callback ); - - } - - }, - - traverseVisible: function ( callback ) { - - if ( this.visible === false ) return; - - callback( this ); - - var children = this.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].traverseVisible( callback ); - - } - - }, - - traverseAncestors: function ( callback ) { - - var parent = this.parent; - - if ( parent !== null ) { - - callback( parent ); - - parent.traverseAncestors( callback ); - - } - - }, - - updateMatrix: function () { - - this.matrix.compose( this.position, this.quaternion, this.scale ); - - this.matrixWorldNeedsUpdate = true; - - }, - - updateMatrixWorld: function ( force ) { - - if ( this.matrixAutoUpdate === true ) this.updateMatrix(); - - if ( this.matrixWorldNeedsUpdate === true || force === true ) { - - if ( this.parent === null ) { - - this.matrixWorld.copy( this.matrix ); - - } else { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - } - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - var children = this.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - children[ i ].updateMatrixWorld( force ); - - } - - }, - - toJSON: function ( meta ) { - - // meta is '' when called from JSON.stringify - var isRootObject = ( meta === undefined || meta === '' ); - - var output = {}; - - // meta is a hash used to collect geometries, materials. - // not providing it implies that this is the root object - // being serialized. - if ( isRootObject ) { - - // initialize meta obj - meta = { - geometries: {}, - materials: {}, - textures: {}, - images: {} - }; - - output.metadata = { - version: 4.4, - type: 'Object', - generator: 'Object3D.toJSON' - }; - - } - - // standard Object3D serialization - - var object = {}; - - object.uuid = this.uuid; - object.type = this.type; - - if ( this.name !== '' ) object.name = this.name; - if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData; - if ( this.castShadow === true ) object.castShadow = true; - if ( this.receiveShadow === true ) object.receiveShadow = true; - if ( this.visible === false ) object.visible = false; - - object.matrix = this.matrix.toArray(); - - // - - if ( this.geometry !== undefined ) { - - if ( meta.geometries[ this.geometry.uuid ] === undefined ) { - - meta.geometries[ this.geometry.uuid ] = this.geometry.toJSON( meta ); - - } - - object.geometry = this.geometry.uuid; - - } - - if ( this.material !== undefined ) { - - if ( meta.materials[ this.material.uuid ] === undefined ) { - - meta.materials[ this.material.uuid ] = this.material.toJSON( meta ); - - } - - object.material = this.material.uuid; - - } - - // - - if ( this.children.length > 0 ) { - - object.children = []; - - for ( var i = 0; i < this.children.length; i ++ ) { - - object.children.push( this.children[ i ].toJSON( meta ).object ); - - } - - } - - if ( isRootObject ) { - - var geometries = extractFromCache( meta.geometries ); - var materials = extractFromCache( meta.materials ); - var textures = extractFromCache( meta.textures ); - var images = extractFromCache( meta.images ); - - if ( geometries.length > 0 ) output.geometries = geometries; - if ( materials.length > 0 ) output.materials = materials; - if ( textures.length > 0 ) output.textures = textures; - if ( images.length > 0 ) output.images = images; - - } - - output.object = object; - - return output; - - // extract data from the cache hash - // remove metadata on each item - // and return as array - function extractFromCache( cache ) { - - var values = []; - for ( var key in cache ) { - - var data = cache[ key ]; - delete data.metadata; - values.push( data ); - - } - return values; - - } - - }, - - clone: function ( recursive ) { - - return new this.constructor().copy( this, recursive ); - - }, - - copy: function ( source, recursive ) { - - if ( recursive === undefined ) recursive = true; - - this.name = source.name; - - this.up.copy( source.up ); - - this.position.copy( source.position ); - this.quaternion.copy( source.quaternion ); - this.scale.copy( source.scale ); - - this.matrix.copy( source.matrix ); - this.matrixWorld.copy( source.matrixWorld ); - - this.matrixAutoUpdate = source.matrixAutoUpdate; - this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate; - - this.visible = source.visible; - - this.castShadow = source.castShadow; - this.receiveShadow = source.receiveShadow; - - this.frustumCulled = source.frustumCulled; - this.renderOrder = source.renderOrder; - - this.userData = JSON.parse( JSON.stringify( source.userData ) ); - - if ( recursive === true ) { - - for ( var i = 0; i < source.children.length; i ++ ) { - - var child = source.children[ i ]; - this.add( child.clone() ); - - } - - } - - return this; - - } - - } ); - - var count$2 = 0; - function Object3DIdCount() { return count$2++; }; - - /** - * @author bhouston / http://clara.io - */ - - function Line3( start, end ) { - - this.start = ( start !== undefined ) ? start : new Vector3(); - this.end = ( end !== undefined ) ? end : new Vector3(); - - } - - Line3.prototype = { - - constructor: Line3, - - set: function ( start, end ) { - - this.start.copy( start ); - this.end.copy( end ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( line ) { - - this.start.copy( line.start ); - this.end.copy( line.end ); - - return this; - - }, - - getCenter: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.addVectors( this.start, this.end ).multiplyScalar( 0.5 ); - - }, - - delta: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.subVectors( this.end, this.start ); - - }, - - distanceSq: function () { - - return this.start.distanceToSquared( this.end ); - - }, - - distance: function () { - - return this.start.distanceTo( this.end ); - - }, - - at: function ( t, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - return this.delta( result ).multiplyScalar( t ).add( this.start ); - - }, - - closestPointToPointParameter: function () { - - var startP = new Vector3(); - var startEnd = new Vector3(); - - return function closestPointToPointParameter( point, clampToLine ) { - - startP.subVectors( point, this.start ); - startEnd.subVectors( this.end, this.start ); - - var startEnd2 = startEnd.dot( startEnd ); - var startEnd_startP = startEnd.dot( startP ); - - var t = startEnd_startP / startEnd2; - - if ( clampToLine ) { - - t = exports.Math.clamp( t, 0, 1 ); - - } - - return t; - - }; - - }(), - - closestPointToPoint: function ( point, clampToLine, optionalTarget ) { - - var t = this.closestPointToPointParameter( point, clampToLine ); - - var result = optionalTarget || new Vector3(); - - return this.delta( result ).multiplyScalar( t ).add( this.start ); - - }, - - applyMatrix4: function ( matrix ) { - - this.start.applyMatrix4( matrix ); - this.end.applyMatrix4( matrix ); - - return this; - - }, - - equals: function ( line ) { - - return line.start.equals( this.start ) && line.end.equals( this.end ); - - } - - }; - - /** - * @author bhouston / http://clara.io - * @author mrdoob / http://mrdoob.com/ - */ - - function Triangle( a, b, c ) { - - this.a = ( a !== undefined ) ? a : new Vector3(); - this.b = ( b !== undefined ) ? b : new Vector3(); - this.c = ( c !== undefined ) ? c : new Vector3(); - - } - - Triangle.normal = function () { - - var v0 = new Vector3(); - - return function normal( a, b, c, optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - result.subVectors( c, b ); - v0.subVectors( a, b ); - result.cross( v0 ); - - var resultLengthSq = result.lengthSq(); - if ( resultLengthSq > 0 ) { - - return result.multiplyScalar( 1 / Math.sqrt( resultLengthSq ) ); - - } - - return result.set( 0, 0, 0 ); - - }; - - }(); - - // static/instance method to calculate barycentric coordinates - // based on: http://www.blackpawn.com/texts/pointinpoly/default.html - Triangle.barycoordFromPoint = function () { - - var v0 = new Vector3(); - var v1 = new Vector3(); - var v2 = new Vector3(); - - return function barycoordFromPoint( point, a, b, c, optionalTarget ) { - - v0.subVectors( c, a ); - v1.subVectors( b, a ); - v2.subVectors( point, a ); - - var dot00 = v0.dot( v0 ); - var dot01 = v0.dot( v1 ); - var dot02 = v0.dot( v2 ); - var dot11 = v1.dot( v1 ); - var dot12 = v1.dot( v2 ); - - var denom = ( dot00 * dot11 - dot01 * dot01 ); - - var result = optionalTarget || new Vector3(); - - // collinear or singular triangle - if ( denom === 0 ) { - - // arbitrary location outside of triangle? - // not sure if this is the best idea, maybe should be returning undefined - return result.set( - 2, - 1, - 1 ); - - } - - var invDenom = 1 / denom; - var u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom; - var v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom; - - // barycentric coordinates must always sum to 1 - return result.set( 1 - u - v, v, u ); - - }; - - }(); - - Triangle.containsPoint = function () { - - var v1 = new Vector3(); - - return function containsPoint( point, a, b, c ) { - - var result = Triangle.barycoordFromPoint( point, a, b, c, v1 ); - - return ( result.x >= 0 ) && ( result.y >= 0 ) && ( ( result.x + result.y ) <= 1 ); - - }; - - }(); - - Triangle.prototype = { - - constructor: Triangle, - - set: function ( a, b, c ) { - - this.a.copy( a ); - this.b.copy( b ); - this.c.copy( c ); - - return this; - - }, - - setFromPointsAndIndices: function ( points, i0, i1, i2 ) { - - this.a.copy( points[ i0 ] ); - this.b.copy( points[ i1 ] ); - this.c.copy( points[ i2 ] ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( triangle ) { - - this.a.copy( triangle.a ); - this.b.copy( triangle.b ); - this.c.copy( triangle.c ); - - return this; - - }, - - area: function () { - - var v0 = new Vector3(); - var v1 = new Vector3(); - - return function area() { - - v0.subVectors( this.c, this.b ); - v1.subVectors( this.a, this.b ); - - return v0.cross( v1 ).length() * 0.5; - - }; - - }(), - - midpoint: function ( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - return result.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 ); - - }, - - normal: function ( optionalTarget ) { - - return Triangle.normal( this.a, this.b, this.c, optionalTarget ); - - }, - - plane: function ( optionalTarget ) { - - var result = optionalTarget || new Plane(); - - return result.setFromCoplanarPoints( this.a, this.b, this.c ); - - }, - - barycoordFromPoint: function ( point, optionalTarget ) { - - return Triangle.barycoordFromPoint( point, this.a, this.b, this.c, optionalTarget ); - - }, - - containsPoint: function ( point ) { - - return Triangle.containsPoint( point, this.a, this.b, this.c ); - - }, - - closestPointToPoint: function () { - - var plane, edgeList, projectedPoint, closestPoint; - - return function closestPointToPoint( point, optionalTarget ) { - - if ( plane === undefined ) { - - plane = new Plane(); - edgeList = [ new Line3(), new Line3(), new Line3() ]; - projectedPoint = new Vector3(); - closestPoint = new Vector3(); - - } - - var result = optionalTarget || new Vector3(); - var minDistance = Infinity; - - // project the point onto the plane of the triangle - - plane.setFromCoplanarPoints( this.a, this.b, this.c ); - plane.projectPoint( point, projectedPoint ); - - // check if the projection lies within the triangle - - if( this.containsPoint( projectedPoint ) === true ) { - - // if so, this is the closest point - - result.copy( projectedPoint ); - - } else { - - // if not, the point falls outside the triangle. the result is the closest point to the triangle's edges or vertices - - edgeList[ 0 ].set( this.a, this.b ); - edgeList[ 1 ].set( this.b, this.c ); - edgeList[ 2 ].set( this.c, this.a ); - - for( var i = 0; i < edgeList.length; i ++ ) { - - edgeList[ i ].closestPointToPoint( projectedPoint, true, closestPoint ); - - var distance = projectedPoint.distanceToSquared( closestPoint ); - - if( distance < minDistance ) { - - minDistance = distance; - - result.copy( closestPoint ); - - } - - } - - } - - return result; - - }; - - }(), - - equals: function ( triangle ) { - - return triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c ); - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function Face3( a, b, c, normal, color, materialIndex ) { - - this.a = a; - this.b = b; - this.c = c; - - this.normal = (normal && normal.isVector3) ? normal : new Vector3(); - this.vertexNormals = Array.isArray( normal ) ? normal : []; - - this.color = (color && color.isColor) ? color : new Color(); - this.vertexColors = Array.isArray( color ) ? color : []; - - this.materialIndex = materialIndex !== undefined ? materialIndex : 0; - - } - - Face3.prototype = { - - constructor: Face3, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.a = source.a; - this.b = source.b; - this.c = source.c; - - this.normal.copy( source.normal ); - this.color.copy( source.color ); - - this.materialIndex = source.materialIndex; - - for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) { - - this.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); - - } - - for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) { - - this.vertexColors[ i ] = source.vertexColors[ i ].clone(); - - } - - return this; - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * aoMap: new THREE.Texture( <Image> ), - * aoMapIntensity: <float> - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * shading: THREE.SmoothShading, - * depthTest: <bool>, - * depthWrite: <bool>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * skinning: <bool>, - * morphTargets: <bool> - * } - */ - - function MeshBasicMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshBasicMaterial'; - - this.color = new Color( 0xffffff ); // emissive - - this.map = null; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - - this.lights = false; - - this.setValues( parameters ); - - } - - MeshBasicMaterial.prototype = Object.create( Material.prototype ); - MeshBasicMaterial.prototype.constructor = MeshBasicMaterial; - - MeshBasicMaterial.prototype.isMeshBasicMaterial = true; - - MeshBasicMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - return this; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function BufferAttribute( array, itemSize, normalized ) { - - if ( Array.isArray( array ) ) { - - throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' ); - - } - - this.uuid = exports.Math.generateUUID(); - - this.array = array; - this.itemSize = itemSize; - this.count = array !== undefined ? array.length / itemSize : 0; - this.normalized = normalized === true; - - this.dynamic = false; - this.updateRange = { offset: 0, count: - 1 }; - - this.version = 0; - - } - - BufferAttribute.prototype = { - - constructor: BufferAttribute, - - isBufferAttribute: true, - - set needsUpdate( value ) { - - if ( value === true ) this.version ++; - - }, - - setDynamic: function ( value ) { - - this.dynamic = value; - - return this; - - }, - - copy: function ( source ) { - - this.array = new source.array.constructor( source.array ); - this.itemSize = source.itemSize; - this.count = source.count; - this.normalized = source.normalized; - - this.dynamic = source.dynamic; - - return this; - - }, - - copyAt: function ( index1, attribute, index2 ) { - - index1 *= this.itemSize; - index2 *= attribute.itemSize; - - for ( var i = 0, l = this.itemSize; i < l; i ++ ) { - - this.array[ index1 + i ] = attribute.array[ index2 + i ]; - - } - - return this; - - }, - - copyArray: function ( array ) { - - this.array.set( array ); - - return this; - - }, - - copyColorsArray: function ( colors ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = colors.length; i < l; i ++ ) { - - var color = colors[ i ]; - - if ( color === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyColorsArray(): color is undefined', i ); - color = new Color(); - - } - - array[ offset ++ ] = color.r; - array[ offset ++ ] = color.g; - array[ offset ++ ] = color.b; - - } - - return this; - - }, - - copyIndicesArray: function ( indices ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = indices.length; i < l; i ++ ) { - - var index = indices[ i ]; - - array[ offset ++ ] = index.a; - array[ offset ++ ] = index.b; - array[ offset ++ ] = index.c; - - } - - return this; - - }, - - copyVector2sArray: function ( vectors ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = vectors.length; i < l; i ++ ) { - - var vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i ); - vector = new Vector2(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - - } - - return this; - - }, - - copyVector3sArray: function ( vectors ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = vectors.length; i < l; i ++ ) { - - var vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i ); - vector = new Vector3(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - array[ offset ++ ] = vector.z; - - } - - return this; - - }, - - copyVector4sArray: function ( vectors ) { - - var array = this.array, offset = 0; - - for ( var i = 0, l = vectors.length; i < l; i ++ ) { - - var vector = vectors[ i ]; - - if ( vector === undefined ) { - - console.warn( 'THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i ); - vector = new Vector4(); - - } - - array[ offset ++ ] = vector.x; - array[ offset ++ ] = vector.y; - array[ offset ++ ] = vector.z; - array[ offset ++ ] = vector.w; - - } - - return this; - - }, - - set: function ( value, offset ) { - - if ( offset === undefined ) offset = 0; - - this.array.set( value, offset ); - - return this; - - }, - - getX: function ( index ) { - - return this.array[ index * this.itemSize ]; - - }, - - setX: function ( index, x ) { - - this.array[ index * this.itemSize ] = x; - - return this; - - }, - - getY: function ( index ) { - - return this.array[ index * this.itemSize + 1 ]; - - }, - - setY: function ( index, y ) { - - this.array[ index * this.itemSize + 1 ] = y; - - return this; - - }, - - getZ: function ( index ) { - - return this.array[ index * this.itemSize + 2 ]; - - }, - - setZ: function ( index, z ) { - - this.array[ index * this.itemSize + 2 ] = z; - - return this; - - }, - - getW: function ( index ) { - - return this.array[ index * this.itemSize + 3 ]; - - }, - - setW: function ( index, w ) { - - this.array[ index * this.itemSize + 3 ] = w; - - return this; - - }, - - setXY: function ( index, x, y ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - - return this; - - }, - - setXYZ: function ( index, x, y, z ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - this.array[ index + 2 ] = z; - - return this; - - }, - - setXYZW: function ( index, x, y, z, w ) { - - index *= this.itemSize; - - this.array[ index + 0 ] = x; - this.array[ index + 1 ] = y; - this.array[ index + 2 ] = z; - this.array[ index + 3 ] = w; - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - } - - }; - - // - - function Int8Attribute( array, itemSize ) { - - return new BufferAttribute( new Int8Array( array ), itemSize ); - - } - - function Uint8Attribute( array, itemSize ) { - - return new BufferAttribute( new Uint8Array( array ), itemSize ); - - } - - function Uint8ClampedAttribute( array, itemSize ) { - - return new BufferAttribute( new Uint8ClampedArray( array ), itemSize ); - - } - - function Int16Attribute( array, itemSize ) { - - return new BufferAttribute( new Int16Array( array ), itemSize ); - - } - - function Uint16Attribute( array, itemSize ) { - - return new BufferAttribute( new Uint16Array( array ), itemSize ); - - } - - function Int32Attribute( array, itemSize ) { - - return new BufferAttribute( new Int32Array( array ), itemSize ); - - } - - function Uint32Attribute( array, itemSize ) { - - return new BufferAttribute( new Uint32Array( array ), itemSize ); - - } - - function Float32Attribute( array, itemSize ) { - - return new BufferAttribute( new Float32Array( array ), itemSize ); - - } - - function Float64Attribute( array, itemSize ) { - - return new BufferAttribute( new Float64Array( array ), itemSize ); - - } - - // Deprecated - - function DynamicBufferAttribute( array, itemSize ) { - - console.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.' ); - return new BufferAttribute( array, itemSize ).setDynamic( true ); - - } - - /** - * @author mrdoob / http://mrdoob.com/ - * @author kile / http://kile.stravaganza.org/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author bhouston / http://clara.io - */ - - function Geometry() { - - Object.defineProperty( this, 'id', { value: GeometryIdCount() } ); - - this.uuid = exports.Math.generateUUID(); - - this.name = ''; - this.type = 'Geometry'; - - this.vertices = []; - this.colors = []; - this.faces = []; - this.faceVertexUvs = [ [] ]; - - this.morphTargets = []; - this.morphNormals = []; - - this.skinWeights = []; - this.skinIndices = []; - - this.lineDistances = []; - - this.boundingBox = null; - this.boundingSphere = null; - - // update flags - - this.elementsNeedUpdate = false; - this.verticesNeedUpdate = false; - this.uvsNeedUpdate = false; - this.normalsNeedUpdate = false; - this.colorsNeedUpdate = false; - this.lineDistancesNeedUpdate = false; - this.groupsNeedUpdate = false; - - } - - Object.assign( Geometry.prototype, EventDispatcher.prototype, { - - isGeometry: true, - - applyMatrix: function ( matrix ) { - - var normalMatrix = new Matrix3().getNormalMatrix( matrix ); - - for ( var i = 0, il = this.vertices.length; i < il; i ++ ) { - - var vertex = this.vertices[ i ]; - vertex.applyMatrix4( matrix ); - - } - - for ( var i = 0, il = this.faces.length; i < il; i ++ ) { - - var face = this.faces[ i ]; - face.normal.applyMatrix3( normalMatrix ).normalize(); - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - face.vertexNormals[ j ].applyMatrix3( normalMatrix ).normalize(); - - } - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - this.verticesNeedUpdate = true; - this.normalsNeedUpdate = true; - - return this; - - }, - - rotateX: function () { - - // rotate geometry around world x-axis - - var m1; - - return function rotateX( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationX( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - rotateY: function () { - - // rotate geometry around world y-axis - - var m1; - - return function rotateY( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationY( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - rotateZ: function () { - - // rotate geometry around world z-axis - - var m1; - - return function rotateZ( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationZ( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - translate: function () { - - // translate geometry - - var m1; - - return function translate( x, y, z ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeTranslation( x, y, z ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - scale: function () { - - // scale geometry - - var m1; - - return function scale( x, y, z ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeScale( x, y, z ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - lookAt: function () { - - var obj; - - return function lookAt( vector ) { - - if ( obj === undefined ) obj = new Object3D(); - - obj.lookAt( vector ); - - obj.updateMatrix(); - - this.applyMatrix( obj.matrix ); - - }; - - }(), - - fromBufferGeometry: function ( geometry ) { - - var scope = this; - - var indices = geometry.index !== null ? geometry.index.array : undefined; - var attributes = geometry.attributes; - - var positions = attributes.position.array; - var normals = attributes.normal !== undefined ? attributes.normal.array : undefined; - var colors = attributes.color !== undefined ? attributes.color.array : undefined; - var uvs = attributes.uv !== undefined ? attributes.uv.array : undefined; - var uvs2 = attributes.uv2 !== undefined ? attributes.uv2.array : undefined; - - if ( uvs2 !== undefined ) this.faceVertexUvs[ 1 ] = []; - - var tempNormals = []; - var tempUVs = []; - var tempUVs2 = []; - - for ( var i = 0, j = 0; i < positions.length; i += 3, j += 2 ) { - - scope.vertices.push( new Vector3( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ) ); - - if ( normals !== undefined ) { - - tempNormals.push( new Vector3( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] ) ); - - } - - if ( colors !== undefined ) { - - scope.colors.push( new Color( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] ) ); - - } - - if ( uvs !== undefined ) { - - tempUVs.push( new Vector2( uvs[ j ], uvs[ j + 1 ] ) ); - - } - - if ( uvs2 !== undefined ) { - - tempUVs2.push( new Vector2( uvs2[ j ], uvs2[ j + 1 ] ) ); - - } - - } - - function addFace( a, b, c, materialIndex ) { - - var vertexNormals = normals !== undefined ? [ tempNormals[ a ].clone(), tempNormals[ b ].clone(), tempNormals[ c ].clone() ] : []; - var vertexColors = colors !== undefined ? [ scope.colors[ a ].clone(), scope.colors[ b ].clone(), scope.colors[ c ].clone() ] : []; - - var face = new Face3( a, b, c, vertexNormals, vertexColors, materialIndex ); - - scope.faces.push( face ); - - if ( uvs !== undefined ) { - - scope.faceVertexUvs[ 0 ].push( [ tempUVs[ a ].clone(), tempUVs[ b ].clone(), tempUVs[ c ].clone() ] ); - - } - - if ( uvs2 !== undefined ) { - - scope.faceVertexUvs[ 1 ].push( [ tempUVs2[ a ].clone(), tempUVs2[ b ].clone(), tempUVs2[ c ].clone() ] ); - - } - - } - - if ( indices !== undefined ) { - - var groups = geometry.groups; - - if ( groups.length > 0 ) { - - for ( var i = 0; i < groups.length; i ++ ) { - - var group = groups[ i ]; - - var start = group.start; - var count = group.count; - - for ( var j = start, jl = start + count; j < jl; j += 3 ) { - - addFace( indices[ j ], indices[ j + 1 ], indices[ j + 2 ], group.materialIndex ); - - } - - } - - } else { - - for ( var i = 0; i < indices.length; i += 3 ) { - - addFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] ); - - } - - } - - } else { - - for ( var i = 0; i < positions.length / 3; i += 3 ) { - - addFace( i, i + 1, i + 2 ); - - } - - } - - this.computeFaceNormals(); - - if ( geometry.boundingBox !== null ) { - - this.boundingBox = geometry.boundingBox.clone(); - - } - - if ( geometry.boundingSphere !== null ) { - - this.boundingSphere = geometry.boundingSphere.clone(); - - } - - return this; - - }, - - center: function () { - - this.computeBoundingBox(); - - var offset = this.boundingBox.getCenter().negate(); - - this.translate( offset.x, offset.y, offset.z ); - - return offset; - - }, - - normalize: function () { - - this.computeBoundingSphere(); - - var center = this.boundingSphere.center; - var radius = this.boundingSphere.radius; - - var s = radius === 0 ? 1 : 1.0 / radius; - - var matrix = new Matrix4(); - matrix.set( - s, 0, 0, - s * center.x, - 0, s, 0, - s * center.y, - 0, 0, s, - s * center.z, - 0, 0, 0, 1 - ); - - this.applyMatrix( matrix ); - - return this; - - }, - - computeFaceNormals: function () { - - var cb = new Vector3(), ab = new Vector3(); - - for ( var f = 0, fl = this.faces.length; f < fl; f ++ ) { - - var face = this.faces[ f ]; - - var vA = this.vertices[ face.a ]; - var vB = this.vertices[ face.b ]; - var vC = this.vertices[ face.c ]; - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ); - - cb.normalize(); - - face.normal.copy( cb ); - - } - - }, - - computeVertexNormals: function ( areaWeighted ) { - - if ( areaWeighted === undefined ) areaWeighted = true; - - var v, vl, f, fl, face, vertices; - - vertices = new Array( this.vertices.length ); - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - vertices[ v ] = new Vector3(); - - } - - if ( areaWeighted ) { - - // vertex normals weighted by triangle areas - // http://www.iquilezles.org/www/articles/normals/normals.htm - - var vA, vB, vC; - var cb = new Vector3(), ab = new Vector3(); - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - vA = this.vertices[ face.a ]; - vB = this.vertices[ face.b ]; - vC = this.vertices[ face.c ]; - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ); - - vertices[ face.a ].add( cb ); - vertices[ face.b ].add( cb ); - vertices[ face.c ].add( cb ); - - } - - } else { - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - vertices[ face.a ].add( face.normal ); - vertices[ face.b ].add( face.normal ); - vertices[ face.c ].add( face.normal ); - - } - - } - - for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) { - - vertices[ v ].normalize(); - - } - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - var vertexNormals = face.vertexNormals; - - if ( vertexNormals.length === 3 ) { - - vertexNormals[ 0 ].copy( vertices[ face.a ] ); - vertexNormals[ 1 ].copy( vertices[ face.b ] ); - vertexNormals[ 2 ].copy( vertices[ face.c ] ); - - } else { - - vertexNormals[ 0 ] = vertices[ face.a ].clone(); - vertexNormals[ 1 ] = vertices[ face.b ].clone(); - vertexNormals[ 2 ] = vertices[ face.c ].clone(); - - } - - } - - if ( this.faces.length > 0 ) { - - this.normalsNeedUpdate = true; - - } - - }, - - computeMorphNormals: function () { - - var i, il, f, fl, face; - - // save original normals - // - create temp variables on first access - // otherwise just copy (for faster repeated calls) - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - if ( ! face.__originalFaceNormal ) { - - face.__originalFaceNormal = face.normal.clone(); - - } else { - - face.__originalFaceNormal.copy( face.normal ); - - } - - if ( ! face.__originalVertexNormals ) face.__originalVertexNormals = []; - - for ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) { - - if ( ! face.__originalVertexNormals[ i ] ) { - - face.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone(); - - } else { - - face.__originalVertexNormals[ i ].copy( face.vertexNormals[ i ] ); - - } - - } - - } - - // use temp geometry to compute face and vertex normals for each morph - - var tmpGeo = new Geometry(); - tmpGeo.faces = this.faces; - - for ( i = 0, il = this.morphTargets.length; i < il; i ++ ) { - - // create on first access - - if ( ! this.morphNormals[ i ] ) { - - this.morphNormals[ i ] = {}; - this.morphNormals[ i ].faceNormals = []; - this.morphNormals[ i ].vertexNormals = []; - - var dstNormalsFace = this.morphNormals[ i ].faceNormals; - var dstNormalsVertex = this.morphNormals[ i ].vertexNormals; - - var faceNormal, vertexNormals; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - faceNormal = new Vector3(); - vertexNormals = { a: new Vector3(), b: new Vector3(), c: new Vector3() }; - - dstNormalsFace.push( faceNormal ); - dstNormalsVertex.push( vertexNormals ); - - } - - } - - var morphNormals = this.morphNormals[ i ]; - - // set vertices to morph target - - tmpGeo.vertices = this.morphTargets[ i ].vertices; - - // compute morph normals - - tmpGeo.computeFaceNormals(); - tmpGeo.computeVertexNormals(); - - // store morph normals - - var faceNormal, vertexNormals; - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - faceNormal = morphNormals.faceNormals[ f ]; - vertexNormals = morphNormals.vertexNormals[ f ]; - - faceNormal.copy( face.normal ); - - vertexNormals.a.copy( face.vertexNormals[ 0 ] ); - vertexNormals.b.copy( face.vertexNormals[ 1 ] ); - vertexNormals.c.copy( face.vertexNormals[ 2 ] ); - - } - - } - - // restore original normals - - for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - - face = this.faces[ f ]; - - face.normal = face.__originalFaceNormal; - face.vertexNormals = face.__originalVertexNormals; - - } - - }, - - computeTangents: function () { - - console.warn( 'THREE.Geometry: .computeTangents() has been removed.' ); - - }, - - computeLineDistances: function () { - - var d = 0; - var vertices = this.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - if ( i > 0 ) { - - d += vertices[ i ].distanceTo( vertices[ i - 1 ] ); - - } - - this.lineDistances[ i ] = d; - - } - - }, - - computeBoundingBox: function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new Box3(); - - } - - this.boundingBox.setFromPoints( this.vertices ); - - }, - - computeBoundingSphere: function () { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new Sphere(); - - } - - this.boundingSphere.setFromPoints( this.vertices ); - - }, - - merge: function ( geometry, matrix, materialIndexOffset ) { - - if ( (geometry && geometry.isGeometry) === false ) { - - console.error( 'THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry ); - return; - - } - - var normalMatrix, - vertexOffset = this.vertices.length, - vertices1 = this.vertices, - vertices2 = geometry.vertices, - faces1 = this.faces, - faces2 = geometry.faces, - uvs1 = this.faceVertexUvs[ 0 ], - uvs2 = geometry.faceVertexUvs[ 0 ], - colors1 = this.colors, - colors2 = geometry.colors; - - if ( materialIndexOffset === undefined ) materialIndexOffset = 0; - - if ( matrix !== undefined ) { - - normalMatrix = new Matrix3().getNormalMatrix( matrix ); - - } - - // vertices - - for ( var i = 0, il = vertices2.length; i < il; i ++ ) { - - var vertex = vertices2[ i ]; - - var vertexCopy = vertex.clone(); - - if ( matrix !== undefined ) vertexCopy.applyMatrix4( matrix ); - - vertices1.push( vertexCopy ); - - } - - // colors - - for ( var i = 0, il = colors2.length; i < il; i ++ ) { - - colors1.push( colors2[ i ].clone() ); - - } - - // faces - - for ( i = 0, il = faces2.length; i < il; i ++ ) { - - var face = faces2[ i ], faceCopy, normal, color, - faceVertexNormals = face.vertexNormals, - faceVertexColors = face.vertexColors; - - faceCopy = new Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset ); - faceCopy.normal.copy( face.normal ); - - if ( normalMatrix !== undefined ) { - - faceCopy.normal.applyMatrix3( normalMatrix ).normalize(); - - } - - for ( var j = 0, jl = faceVertexNormals.length; j < jl; j ++ ) { - - normal = faceVertexNormals[ j ].clone(); - - if ( normalMatrix !== undefined ) { - - normal.applyMatrix3( normalMatrix ).normalize(); - - } - - faceCopy.vertexNormals.push( normal ); - - } - - faceCopy.color.copy( face.color ); - - for ( var j = 0, jl = faceVertexColors.length; j < jl; j ++ ) { - - color = faceVertexColors[ j ]; - faceCopy.vertexColors.push( color.clone() ); - - } - - faceCopy.materialIndex = face.materialIndex + materialIndexOffset; - - faces1.push( faceCopy ); - - } - - // uvs - - for ( i = 0, il = uvs2.length; i < il; i ++ ) { - - var uv = uvs2[ i ], uvCopy = []; - - if ( uv === undefined ) { - - continue; - - } - - for ( var j = 0, jl = uv.length; j < jl; j ++ ) { - - uvCopy.push( uv[ j ].clone() ); - - } - - uvs1.push( uvCopy ); - - } - - }, - - mergeMesh: function ( mesh ) { - - if ( (mesh && mesh.isMesh) === false ) { - - console.error( 'THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh ); - return; - - } - - mesh.matrixAutoUpdate && mesh.updateMatrix(); - - this.merge( mesh.geometry, mesh.matrix ); - - }, - - /* - * Checks for duplicate vertices with hashmap. - * Duplicated vertices are removed - * and faces' vertices are updated. - */ - - mergeVertices: function () { - - var verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique) - var unique = [], changes = []; - - var v, key; - var precisionPoints = 4; // number of decimal points, e.g. 4 for epsilon of 0.0001 - var precision = Math.pow( 10, precisionPoints ); - var i, il, face; - var indices, j, jl; - - for ( i = 0, il = this.vertices.length; i < il; i ++ ) { - - v = this.vertices[ i ]; - key = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision ); - - if ( verticesMap[ key ] === undefined ) { - - verticesMap[ key ] = i; - unique.push( this.vertices[ i ] ); - changes[ i ] = unique.length - 1; - - } else { - - //console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]); - changes[ i ] = changes[ verticesMap[ key ] ]; - - } - - } - - - // if faces are completely degenerate after merging vertices, we - // have to remove them from the geometry. - var faceIndicesToRemove = []; - - for ( i = 0, il = this.faces.length; i < il; i ++ ) { - - face = this.faces[ i ]; - - face.a = changes[ face.a ]; - face.b = changes[ face.b ]; - face.c = changes[ face.c ]; - - indices = [ face.a, face.b, face.c ]; - - var dupIndex = - 1; - - // if any duplicate vertices are found in a Face3 - // we have to remove the face as nothing can be saved - for ( var n = 0; n < 3; n ++ ) { - - if ( indices[ n ] === indices[ ( n + 1 ) % 3 ] ) { - - dupIndex = n; - faceIndicesToRemove.push( i ); - break; - - } - - } - - } - - for ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) { - - var idx = faceIndicesToRemove[ i ]; - - this.faces.splice( idx, 1 ); - - for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) { - - this.faceVertexUvs[ j ].splice( idx, 1 ); - - } - - } - - // Use unique set of vertices - - var diff = this.vertices.length - unique.length; - this.vertices = unique; - return diff; - - }, - - sortFacesByMaterialIndex: function () { - - var faces = this.faces; - var length = faces.length; - - // tag faces - - for ( var i = 0; i < length; i ++ ) { - - faces[ i ]._id = i; - - } - - // sort faces - - function materialIndexSort( a, b ) { - - return a.materialIndex - b.materialIndex; - - } - - faces.sort( materialIndexSort ); - - // sort uvs - - var uvs1 = this.faceVertexUvs[ 0 ]; - var uvs2 = this.faceVertexUvs[ 1 ]; - - var newUvs1, newUvs2; - - if ( uvs1 && uvs1.length === length ) newUvs1 = []; - if ( uvs2 && uvs2.length === length ) newUvs2 = []; - - for ( var i = 0; i < length; i ++ ) { - - var id = faces[ i ]._id; - - if ( newUvs1 ) newUvs1.push( uvs1[ id ] ); - if ( newUvs2 ) newUvs2.push( uvs2[ id ] ); - - } - - if ( newUvs1 ) this.faceVertexUvs[ 0 ] = newUvs1; - if ( newUvs2 ) this.faceVertexUvs[ 1 ] = newUvs2; - - }, - - toJSON: function () { - - var data = { - metadata: { - version: 4.4, - type: 'Geometry', - generator: 'Geometry.toJSON' - } - }; - - // standard Geometry serialization - - data.uuid = this.uuid; - data.type = this.type; - if ( this.name !== '' ) data.name = this.name; - - if ( this.parameters !== undefined ) { - - var parameters = this.parameters; - - for ( var key in parameters ) { - - if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ]; - - } - - return data; - - } - - var vertices = []; - - for ( var i = 0; i < this.vertices.length; i ++ ) { - - var vertex = this.vertices[ i ]; - vertices.push( vertex.x, vertex.y, vertex.z ); - - } - - var faces = []; - var normals = []; - var normalsHash = {}; - var colors = []; - var colorsHash = {}; - var uvs = []; - var uvsHash = {}; - - for ( var i = 0; i < this.faces.length; i ++ ) { - - var face = this.faces[ i ]; - - var hasMaterial = true; - var hasFaceUv = false; // deprecated - var hasFaceVertexUv = this.faceVertexUvs[ 0 ][ i ] !== undefined; - var hasFaceNormal = face.normal.length() > 0; - var hasFaceVertexNormal = face.vertexNormals.length > 0; - var hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1; - var hasFaceVertexColor = face.vertexColors.length > 0; - - var faceType = 0; - - faceType = setBit( faceType, 0, 0 ); // isQuad - faceType = setBit( faceType, 1, hasMaterial ); - faceType = setBit( faceType, 2, hasFaceUv ); - faceType = setBit( faceType, 3, hasFaceVertexUv ); - faceType = setBit( faceType, 4, hasFaceNormal ); - faceType = setBit( faceType, 5, hasFaceVertexNormal ); - faceType = setBit( faceType, 6, hasFaceColor ); - faceType = setBit( faceType, 7, hasFaceVertexColor ); - - faces.push( faceType ); - faces.push( face.a, face.b, face.c ); - faces.push( face.materialIndex ); - - if ( hasFaceVertexUv ) { - - var faceVertexUvs = this.faceVertexUvs[ 0 ][ i ]; - - faces.push( - getUvIndex( faceVertexUvs[ 0 ] ), - getUvIndex( faceVertexUvs[ 1 ] ), - getUvIndex( faceVertexUvs[ 2 ] ) - ); - - } - - if ( hasFaceNormal ) { - - faces.push( getNormalIndex( face.normal ) ); - - } - - if ( hasFaceVertexNormal ) { - - var vertexNormals = face.vertexNormals; - - faces.push( - getNormalIndex( vertexNormals[ 0 ] ), - getNormalIndex( vertexNormals[ 1 ] ), - getNormalIndex( vertexNormals[ 2 ] ) - ); - - } - - if ( hasFaceColor ) { - - faces.push( getColorIndex( face.color ) ); - - } - - if ( hasFaceVertexColor ) { - - var vertexColors = face.vertexColors; - - faces.push( - getColorIndex( vertexColors[ 0 ] ), - getColorIndex( vertexColors[ 1 ] ), - getColorIndex( vertexColors[ 2 ] ) - ); - - } - - } - - function setBit( value, position, enabled ) { - - return enabled ? value | ( 1 << position ) : value & ( ~ ( 1 << position ) ); - - } - - function getNormalIndex( normal ) { - - var hash = normal.x.toString() + normal.y.toString() + normal.z.toString(); - - if ( normalsHash[ hash ] !== undefined ) { - - return normalsHash[ hash ]; - - } - - normalsHash[ hash ] = normals.length / 3; - normals.push( normal.x, normal.y, normal.z ); - - return normalsHash[ hash ]; - - } - - function getColorIndex( color ) { - - var hash = color.r.toString() + color.g.toString() + color.b.toString(); - - if ( colorsHash[ hash ] !== undefined ) { - - return colorsHash[ hash ]; - - } - - colorsHash[ hash ] = colors.length; - colors.push( color.getHex() ); - - return colorsHash[ hash ]; - - } - - function getUvIndex( uv ) { - - var hash = uv.x.toString() + uv.y.toString(); - - if ( uvsHash[ hash ] !== undefined ) { - - return uvsHash[ hash ]; - - } - - uvsHash[ hash ] = uvs.length / 2; - uvs.push( uv.x, uv.y ); - - return uvsHash[ hash ]; - - } - - data.data = {}; - - data.data.vertices = vertices; - data.data.normals = normals; - if ( colors.length > 0 ) data.data.colors = colors; - if ( uvs.length > 0 ) data.data.uvs = [ uvs ]; // temporal backward compatibility - data.data.faces = faces; - - return data; - - }, - - clone: function () { - - /* - // Handle primitives - - var parameters = this.parameters; - - if ( parameters !== undefined ) { - - var values = []; - - for ( var key in parameters ) { - - values.push( parameters[ key ] ); - - } - - var geometry = Object.create( this.constructor.prototype ); - this.constructor.apply( geometry, values ); - return geometry; - - } - - return new this.constructor().copy( this ); - */ - - return new Geometry().copy( this ); - - }, - - copy: function ( source ) { - - this.vertices = []; - this.faces = []; - this.faceVertexUvs = [ [] ]; - this.colors = []; - - var vertices = source.vertices; - - for ( var i = 0, il = vertices.length; i < il; i ++ ) { - - this.vertices.push( vertices[ i ].clone() ); - - } - - var colors = source.colors; - - for ( var i = 0, il = colors.length; i < il; i ++ ) { - - this.colors.push( colors[ i ].clone() ); - - } - - var faces = source.faces; - - for ( var i = 0, il = faces.length; i < il; i ++ ) { - - this.faces.push( faces[ i ].clone() ); - - } - - for ( var i = 0, il = source.faceVertexUvs.length; i < il; i ++ ) { - - var faceVertexUvs = source.faceVertexUvs[ i ]; - - if ( this.faceVertexUvs[ i ] === undefined ) { - - this.faceVertexUvs[ i ] = []; - - } - - for ( var j = 0, jl = faceVertexUvs.length; j < jl; j ++ ) { - - var uvs = faceVertexUvs[ j ], uvsCopy = []; - - for ( var k = 0, kl = uvs.length; k < kl; k ++ ) { - - var uv = uvs[ k ]; - - uvsCopy.push( uv.clone() ); - - } - - this.faceVertexUvs[ i ].push( uvsCopy ); - - } - - } - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - - } ); - - var count$3 = 0; - function GeometryIdCount() { return count$3++; }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function DirectGeometry() { - - Object.defineProperty( this, 'id', { value: GeometryIdCount() } ); - - this.uuid = exports.Math.generateUUID(); - - this.name = ''; - this.type = 'DirectGeometry'; - - this.indices = []; - this.vertices = []; - this.normals = []; - this.colors = []; - this.uvs = []; - this.uvs2 = []; - - this.groups = []; - - this.morphTargets = {}; - - this.skinWeights = []; - this.skinIndices = []; - - // this.lineDistances = []; - - this.boundingBox = null; - this.boundingSphere = null; - - // update flags - - this.verticesNeedUpdate = false; - this.normalsNeedUpdate = false; - this.colorsNeedUpdate = false; - this.uvsNeedUpdate = false; - this.groupsNeedUpdate = false; - - } - - Object.assign( DirectGeometry.prototype, EventDispatcher.prototype, { - - computeBoundingBox: Geometry.prototype.computeBoundingBox, - computeBoundingSphere: Geometry.prototype.computeBoundingSphere, - - computeFaceNormals: function () { - - console.warn( 'THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.' ); - - }, - - computeVertexNormals: function () { - - console.warn( 'THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.' ); - - }, - - computeGroups: function ( geometry ) { - - var group; - var groups = []; - var materialIndex; - - var faces = geometry.faces; - - for ( var i = 0; i < faces.length; i ++ ) { - - var face = faces[ i ]; - - // materials - - if ( face.materialIndex !== materialIndex ) { - - materialIndex = face.materialIndex; - - if ( group !== undefined ) { - - group.count = ( i * 3 ) - group.start; - groups.push( group ); - - } - - group = { - start: i * 3, - materialIndex: materialIndex - }; - - } - - } - - if ( group !== undefined ) { - - group.count = ( i * 3 ) - group.start; - groups.push( group ); - - } - - this.groups = groups; - - }, - - fromGeometry: function ( geometry ) { - - var faces = geometry.faces; - var vertices = geometry.vertices; - var faceVertexUvs = geometry.faceVertexUvs; - - var hasFaceVertexUv = faceVertexUvs[ 0 ] && faceVertexUvs[ 0 ].length > 0; - var hasFaceVertexUv2 = faceVertexUvs[ 1 ] && faceVertexUvs[ 1 ].length > 0; - - // morphs - - var morphTargets = geometry.morphTargets; - var morphTargetsLength = morphTargets.length; - - var morphTargetsPosition; - - if ( morphTargetsLength > 0 ) { - - morphTargetsPosition = []; - - for ( var i = 0; i < morphTargetsLength; i ++ ) { - - morphTargetsPosition[ i ] = []; - - } - - this.morphTargets.position = morphTargetsPosition; - - } - - var morphNormals = geometry.morphNormals; - var morphNormalsLength = morphNormals.length; - - var morphTargetsNormal; - - if ( morphNormalsLength > 0 ) { - - morphTargetsNormal = []; - - for ( var i = 0; i < morphNormalsLength; i ++ ) { - - morphTargetsNormal[ i ] = []; - - } - - this.morphTargets.normal = morphTargetsNormal; - - } - - // skins - - var skinIndices = geometry.skinIndices; - var skinWeights = geometry.skinWeights; - - var hasSkinIndices = skinIndices.length === vertices.length; - var hasSkinWeights = skinWeights.length === vertices.length; - - // - - for ( var i = 0; i < faces.length; i ++ ) { - - var face = faces[ i ]; - - this.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] ); - - var vertexNormals = face.vertexNormals; - - if ( vertexNormals.length === 3 ) { - - this.normals.push( vertexNormals[ 0 ], vertexNormals[ 1 ], vertexNormals[ 2 ] ); - - } else { - - var normal = face.normal; - - this.normals.push( normal, normal, normal ); - - } - - var vertexColors = face.vertexColors; - - if ( vertexColors.length === 3 ) { - - this.colors.push( vertexColors[ 0 ], vertexColors[ 1 ], vertexColors[ 2 ] ); - - } else { - - var color = face.color; - - this.colors.push( color, color, color ); - - } - - if ( hasFaceVertexUv === true ) { - - var vertexUvs = faceVertexUvs[ 0 ][ i ]; - - if ( vertexUvs !== undefined ) { - - this.uvs.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); - - } else { - - console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', i ); - - this.uvs.push( new Vector2(), new Vector2(), new Vector2() ); - - } - - } - - if ( hasFaceVertexUv2 === true ) { - - var vertexUvs = faceVertexUvs[ 1 ][ i ]; - - if ( vertexUvs !== undefined ) { - - this.uvs2.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); - - } else { - - console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', i ); - - this.uvs2.push( new Vector2(), new Vector2(), new Vector2() ); - - } - - } - - // morphs - - for ( var j = 0; j < morphTargetsLength; j ++ ) { - - var morphTarget = morphTargets[ j ].vertices; - - morphTargetsPosition[ j ].push( morphTarget[ face.a ], morphTarget[ face.b ], morphTarget[ face.c ] ); - - } - - for ( var j = 0; j < morphNormalsLength; j ++ ) { - - var morphNormal = morphNormals[ j ].vertexNormals[ i ]; - - morphTargetsNormal[ j ].push( morphNormal.a, morphNormal.b, morphNormal.c ); - - } - - // skins - - if ( hasSkinIndices ) { - - this.skinIndices.push( skinIndices[ face.a ], skinIndices[ face.b ], skinIndices[ face.c ] ); - - } - - if ( hasSkinWeights ) { - - this.skinWeights.push( skinWeights[ face.a ], skinWeights[ face.b ], skinWeights[ face.c ] ); - - } - - } - - this.computeGroups( geometry ); - - this.verticesNeedUpdate = geometry.verticesNeedUpdate; - this.normalsNeedUpdate = geometry.normalsNeedUpdate; - this.colorsNeedUpdate = geometry.colorsNeedUpdate; - this.uvsNeedUpdate = geometry.uvsNeedUpdate; - this.groupsNeedUpdate = geometry.groupsNeedUpdate; - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - - function BufferGeometry() { - - Object.defineProperty( this, 'id', { value: GeometryIdCount() } ); - - this.uuid = exports.Math.generateUUID(); - - this.name = ''; - this.type = 'BufferGeometry'; - - this.index = null; - this.attributes = {}; - - this.morphAttributes = {}; - - this.groups = []; - - this.boundingBox = null; - this.boundingSphere = null; - - this.drawRange = { start: 0, count: Infinity }; - - } - - Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, { - - isBufferGeometry: true, - - getIndex: function () { - - return this.index; - - }, - - setIndex: function ( index ) { - - this.index = index; - - }, - - addAttribute: function ( name, attribute ) { - - if ( (attribute && attribute.isBufferAttribute) === false && (attribute && attribute.isInterleavedBufferAttribute) === false ) { - - console.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' ); - - this.addAttribute( name, new BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) ); - - return; - - } - - if ( name === 'index' ) { - - console.warn( 'THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.' ); - this.setIndex( attribute ); - - return; - - } - - this.attributes[ name ] = attribute; - - return this; - - }, - - getAttribute: function ( name ) { - - return this.attributes[ name ]; - - }, - - removeAttribute: function ( name ) { - - delete this.attributes[ name ]; - - return this; - - }, - - addGroup: function ( start, count, materialIndex ) { - - this.groups.push( { - - start: start, - count: count, - materialIndex: materialIndex !== undefined ? materialIndex : 0 - - } ); - - }, - - clearGroups: function () { - - this.groups = []; - - }, - - setDrawRange: function ( start, count ) { - - this.drawRange.start = start; - this.drawRange.count = count; - - }, - - applyMatrix: function ( matrix ) { - - var position = this.attributes.position; - - if ( position !== undefined ) { - - matrix.applyToVector3Array( position.array ); - position.needsUpdate = true; - - } - - var normal = this.attributes.normal; - - if ( normal !== undefined ) { - - var normalMatrix = new Matrix3().getNormalMatrix( matrix ); - - normalMatrix.applyToVector3Array( normal.array ); - normal.needsUpdate = true; - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - return this; - - }, - - rotateX: function () { - - // rotate geometry around world x-axis - - var m1; - - return function rotateX( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationX( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - rotateY: function () { - - // rotate geometry around world y-axis - - var m1; - - return function rotateY( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationY( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - rotateZ: function () { - - // rotate geometry around world z-axis - - var m1; - - return function rotateZ( angle ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeRotationZ( angle ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - translate: function () { - - // translate geometry - - var m1; - - return function translate( x, y, z ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeTranslation( x, y, z ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - scale: function () { - - // scale geometry - - var m1; - - return function scale( x, y, z ) { - - if ( m1 === undefined ) m1 = new Matrix4(); - - m1.makeScale( x, y, z ); - - this.applyMatrix( m1 ); - - return this; - - }; - - }(), - - lookAt: function () { - - var obj; - - return function lookAt( vector ) { - - if ( obj === undefined ) obj = new Object3D(); - - obj.lookAt( vector ); - - obj.updateMatrix(); - - this.applyMatrix( obj.matrix ); - - }; - - }(), - - center: function () { - - this.computeBoundingBox(); - - var offset = this.boundingBox.getCenter().negate(); - - this.translate( offset.x, offset.y, offset.z ); - - return offset; - - }, - - setFromObject: function ( object ) { - - // console.log( 'THREE.BufferGeometry.setFromObject(). Converting', object, this ); - - var geometry = object.geometry; - - if ( (object && object.isPoints) || (object && object.isLine) ) { - - var positions = new Float32Attribute( geometry.vertices.length * 3, 3 ); - var colors = new Float32Attribute( geometry.colors.length * 3, 3 ); - - this.addAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) ); - this.addAttribute( 'color', colors.copyColorsArray( geometry.colors ) ); - - if ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) { - - var lineDistances = new Float32Attribute( geometry.lineDistances.length, 1 ); - - this.addAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) ); - - } - - if ( geometry.boundingSphere !== null ) { - - this.boundingSphere = geometry.boundingSphere.clone(); - - } - - if ( geometry.boundingBox !== null ) { - - this.boundingBox = geometry.boundingBox.clone(); - - } - - } else if ( (object && object.isMesh) ) { - - if ( (geometry && geometry.isGeometry) ) { - - this.fromGeometry( geometry ); - - } - - } - - return this; - - }, - - updateFromObject: function ( object ) { - - var geometry = object.geometry; - - if ( (object && object.isMesh) ) { - - var direct = geometry.__directGeometry; - - if ( geometry.elementsNeedUpdate === true ) { - - direct = undefined; - geometry.elementsNeedUpdate = false; - - } - - if ( direct === undefined ) { - - return this.fromGeometry( geometry ); - - } - - direct.verticesNeedUpdate = geometry.verticesNeedUpdate; - direct.normalsNeedUpdate = geometry.normalsNeedUpdate; - direct.colorsNeedUpdate = geometry.colorsNeedUpdate; - direct.uvsNeedUpdate = geometry.uvsNeedUpdate; - direct.groupsNeedUpdate = geometry.groupsNeedUpdate; - - geometry.verticesNeedUpdate = false; - geometry.normalsNeedUpdate = false; - geometry.colorsNeedUpdate = false; - geometry.uvsNeedUpdate = false; - geometry.groupsNeedUpdate = false; - - geometry = direct; - - } - - var attribute; - - if ( geometry.verticesNeedUpdate === true ) { - - attribute = this.attributes.position; - - if ( attribute !== undefined ) { - - attribute.copyVector3sArray( geometry.vertices ); - attribute.needsUpdate = true; - - } - - geometry.verticesNeedUpdate = false; - - } - - if ( geometry.normalsNeedUpdate === true ) { - - attribute = this.attributes.normal; - - if ( attribute !== undefined ) { - - attribute.copyVector3sArray( geometry.normals ); - attribute.needsUpdate = true; - - } - - geometry.normalsNeedUpdate = false; - - } - - if ( geometry.colorsNeedUpdate === true ) { - - attribute = this.attributes.color; - - if ( attribute !== undefined ) { - - attribute.copyColorsArray( geometry.colors ); - attribute.needsUpdate = true; - - } - - geometry.colorsNeedUpdate = false; - - } - - if ( geometry.uvsNeedUpdate ) { - - attribute = this.attributes.uv; - - if ( attribute !== undefined ) { - - attribute.copyVector2sArray( geometry.uvs ); - attribute.needsUpdate = true; - - } - - geometry.uvsNeedUpdate = false; - - } - - if ( geometry.lineDistancesNeedUpdate ) { - - attribute = this.attributes.lineDistance; - - if ( attribute !== undefined ) { - - attribute.copyArray( geometry.lineDistances ); - attribute.needsUpdate = true; - - } - - geometry.lineDistancesNeedUpdate = false; - - } - - if ( geometry.groupsNeedUpdate ) { - - geometry.computeGroups( object.geometry ); - this.groups = geometry.groups; - - geometry.groupsNeedUpdate = false; - - } - - return this; - - }, - - fromGeometry: function ( geometry ) { - - geometry.__directGeometry = new DirectGeometry().fromGeometry( geometry ); - - return this.fromDirectGeometry( geometry.__directGeometry ); - - }, - - fromDirectGeometry: function ( geometry ) { - - var positions = new Float32Array( geometry.vertices.length * 3 ); - this.addAttribute( 'position', new BufferAttribute( positions, 3 ).copyVector3sArray( geometry.vertices ) ); - - if ( geometry.normals.length > 0 ) { - - var normals = new Float32Array( geometry.normals.length * 3 ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ).copyVector3sArray( geometry.normals ) ); - - } - - if ( geometry.colors.length > 0 ) { - - var colors = new Float32Array( geometry.colors.length * 3 ); - this.addAttribute( 'color', new BufferAttribute( colors, 3 ).copyColorsArray( geometry.colors ) ); - - } - - if ( geometry.uvs.length > 0 ) { - - var uvs = new Float32Array( geometry.uvs.length * 2 ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ).copyVector2sArray( geometry.uvs ) ); - - } - - if ( geometry.uvs2.length > 0 ) { - - var uvs2 = new Float32Array( geometry.uvs2.length * 2 ); - this.addAttribute( 'uv2', new BufferAttribute( uvs2, 2 ).copyVector2sArray( geometry.uvs2 ) ); - - } - - if ( geometry.indices.length > 0 ) { - - var TypeArray = geometry.vertices.length > 65535 ? Uint32Array : Uint16Array; - var indices = new TypeArray( geometry.indices.length * 3 ); - this.setIndex( new BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) ); - - } - - // groups - - this.groups = geometry.groups; - - // morphs - - for ( var name in geometry.morphTargets ) { - - var array = []; - var morphTargets = geometry.morphTargets[ name ]; - - for ( var i = 0, l = morphTargets.length; i < l; i ++ ) { - - var morphTarget = morphTargets[ i ]; - - var attribute = new Float32Attribute( morphTarget.length * 3, 3 ); - - array.push( attribute.copyVector3sArray( morphTarget ) ); - - } - - this.morphAttributes[ name ] = array; - - } - - // skinning - - if ( geometry.skinIndices.length > 0 ) { - - var skinIndices = new Float32Attribute( geometry.skinIndices.length * 4, 4 ); - this.addAttribute( 'skinIndex', skinIndices.copyVector4sArray( geometry.skinIndices ) ); - - } - - if ( geometry.skinWeights.length > 0 ) { - - var skinWeights = new Float32Attribute( geometry.skinWeights.length * 4, 4 ); - this.addAttribute( 'skinWeight', skinWeights.copyVector4sArray( geometry.skinWeights ) ); - - } - - // - - if ( geometry.boundingSphere !== null ) { - - this.boundingSphere = geometry.boundingSphere.clone(); - - } - - if ( geometry.boundingBox !== null ) { - - this.boundingBox = geometry.boundingBox.clone(); - - } - - return this; - - }, - - computeBoundingBox: function () { - - if ( this.boundingBox === null ) { - - this.boundingBox = new Box3(); - - } - - var positions = this.attributes.position.array; - - if ( positions !== undefined ) { - - this.boundingBox.setFromArray( positions ); - - } else { - - this.boundingBox.makeEmpty(); - - } - - if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) { - - console.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this ); - - } - - }, - - computeBoundingSphere: function () { - - var box = new Box3(); - var vector = new Vector3(); - - return function computeBoundingSphere() { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new Sphere(); - - } - - var positions = this.attributes.position; - - if ( positions ) { - - var array = positions.array; - var center = this.boundingSphere.center; - - box.setFromArray( array ); - box.getCenter( center ); - - // hoping to find a boundingSphere with a radius smaller than the - // boundingSphere of the boundingBox: sqrt(3) smaller in the best case - - var maxRadiusSq = 0; - - for ( var i = 0, il = array.length; i < il; i += 3 ) { - - vector.fromArray( array, i ); - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); - - } - - this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); - - if ( isNaN( this.boundingSphere.radius ) ) { - - console.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this ); - - } - - } - - }; - - }(), - - computeFaceNormals: function () { - - // backwards compatibility - - }, - - computeVertexNormals: function () { - - var index = this.index; - var attributes = this.attributes; - var groups = this.groups; - - if ( attributes.position ) { - - var positions = attributes.position.array; - - if ( attributes.normal === undefined ) { - - this.addAttribute( 'normal', new BufferAttribute( new Float32Array( positions.length ), 3 ) ); - - } else { - - // reset existing normals to zero - - var array = attributes.normal.array; - - for ( var i = 0, il = array.length; i < il; i ++ ) { - - array[ i ] = 0; - - } - - } - - var normals = attributes.normal.array; - - var vA, vB, vC, - - pA = new Vector3(), - pB = new Vector3(), - pC = new Vector3(), - - cb = new Vector3(), - ab = new Vector3(); - - // indexed elements - - if ( index ) { - - var indices = index.array; - - if ( groups.length === 0 ) { - - this.addGroup( 0, indices.length ); - - } - - for ( var j = 0, jl = groups.length; j < jl; ++ j ) { - - var group = groups[ j ]; - - var start = group.start; - var count = group.count; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - vA = indices[ i + 0 ] * 3; - vB = indices[ i + 1 ] * 3; - vC = indices[ i + 2 ] * 3; - - pA.fromArray( positions, vA ); - pB.fromArray( positions, vB ); - pC.fromArray( positions, vC ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normals[ vA ] += cb.x; - normals[ vA + 1 ] += cb.y; - normals[ vA + 2 ] += cb.z; - - normals[ vB ] += cb.x; - normals[ vB + 1 ] += cb.y; - normals[ vB + 2 ] += cb.z; - - normals[ vC ] += cb.x; - normals[ vC + 1 ] += cb.y; - normals[ vC + 2 ] += cb.z; - - } - - } - - } else { - - // non-indexed elements (unconnected triangle soup) - - for ( var i = 0, il = positions.length; i < il; i += 9 ) { - - pA.fromArray( positions, i ); - pB.fromArray( positions, i + 3 ); - pC.fromArray( positions, i + 6 ); - - cb.subVectors( pC, pB ); - ab.subVectors( pA, pB ); - cb.cross( ab ); - - normals[ i ] = cb.x; - normals[ i + 1 ] = cb.y; - normals[ i + 2 ] = cb.z; - - normals[ i + 3 ] = cb.x; - normals[ i + 4 ] = cb.y; - normals[ i + 5 ] = cb.z; - - normals[ i + 6 ] = cb.x; - normals[ i + 7 ] = cb.y; - normals[ i + 8 ] = cb.z; - - } - - } - - this.normalizeNormals(); - - attributes.normal.needsUpdate = true; - - } - - }, - - merge: function ( geometry, offset ) { - - if ( (geometry && geometry.isBufferGeometry) === false ) { - - console.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry ); - return; - - } - - if ( offset === undefined ) offset = 0; - - var attributes = this.attributes; - - for ( var key in attributes ) { - - if ( geometry.attributes[ key ] === undefined ) continue; - - var attribute1 = attributes[ key ]; - var attributeArray1 = attribute1.array; - - var attribute2 = geometry.attributes[ key ]; - var attributeArray2 = attribute2.array; - - var attributeSize = attribute2.itemSize; - - for ( var i = 0, j = attributeSize * offset; i < attributeArray2.length; i ++, j ++ ) { - - attributeArray1[ j ] = attributeArray2[ i ]; - - } - - } - - return this; - - }, - - normalizeNormals: function () { - - var normals = this.attributes.normal.array; - - var x, y, z, n; - - for ( var i = 0, il = normals.length; i < il; i += 3 ) { - - x = normals[ i ]; - y = normals[ i + 1 ]; - z = normals[ i + 2 ]; - - n = 1.0 / Math.sqrt( x * x + y * y + z * z ); - - normals[ i ] *= n; - normals[ i + 1 ] *= n; - normals[ i + 2 ] *= n; - - } - - }, - - toNonIndexed: function () { - - if ( this.index === null ) { - - console.warn( 'THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.' ); - return this; - - } - - var geometry2 = new BufferGeometry(); - - var indices = this.index.array; - var attributes = this.attributes; - - for ( var name in attributes ) { - - var attribute = attributes[ name ]; - - var array = attribute.array; - var itemSize = attribute.itemSize; - - var array2 = new array.constructor( indices.length * itemSize ); - - var index = 0, index2 = 0; - - for ( var i = 0, l = indices.length; i < l; i ++ ) { - - index = indices[ i ] * itemSize; - - for ( var j = 0; j < itemSize; j ++ ) { - - array2[ index2 ++ ] = array[ index ++ ]; - - } - - } - - geometry2.addAttribute( name, new BufferAttribute( array2, itemSize ) ); - - } - - return geometry2; - - }, - - toJSON: function () { - - var data = { - metadata: { - version: 4.4, - type: 'BufferGeometry', - generator: 'BufferGeometry.toJSON' - } - }; - - // standard BufferGeometry serialization - - data.uuid = this.uuid; - data.type = this.type; - if ( this.name !== '' ) data.name = this.name; - - if ( this.parameters !== undefined ) { - - var parameters = this.parameters; - - for ( var key in parameters ) { - - if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ]; - - } - - return data; - - } - - data.data = { attributes: {} }; - - var index = this.index; - - if ( index !== null ) { - - var array = Array.prototype.slice.call( index.array ); - - data.data.index = { - type: index.array.constructor.name, - array: array - }; - - } - - var attributes = this.attributes; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - - var array = Array.prototype.slice.call( attribute.array ); - - data.data.attributes[ key ] = { - itemSize: attribute.itemSize, - type: attribute.array.constructor.name, - array: array, - normalized: attribute.normalized - }; - - } - - var groups = this.groups; - - if ( groups.length > 0 ) { - - data.data.groups = JSON.parse( JSON.stringify( groups ) ); - - } - - var boundingSphere = this.boundingSphere; - - if ( boundingSphere !== null ) { - - data.data.boundingSphere = { - center: boundingSphere.center.toArray(), - radius: boundingSphere.radius - }; - - } - - return data; - - }, - - clone: function () { - - /* - // Handle primitives - - var parameters = this.parameters; - - if ( parameters !== undefined ) { - - var values = []; - - for ( var key in parameters ) { - - values.push( parameters[ key ] ); - - } - - var geometry = Object.create( this.constructor.prototype ); - this.constructor.apply( geometry, values ); - return geometry; - - } - - return new this.constructor().copy( this ); - */ - - return new BufferGeometry().copy( this ); - - }, - - copy: function ( source ) { - - var index = source.index; - - if ( index !== null ) { - - this.setIndex( index.clone() ); - - } - - var attributes = source.attributes; - - for ( var name in attributes ) { - - var attribute = attributes[ name ]; - this.addAttribute( name, attribute.clone() ); - - } - - var groups = source.groups; - - for ( var i = 0, l = groups.length; i < l; i ++ ) { - - var group = groups[ i ]; - this.addGroup( group.start, group.count, group.materialIndex ); - - } - - return this; - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - - } ); - - BufferGeometry.MaxIndex = 65535; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author jonobr1 / http://jonobr1.com/ - */ - - function Mesh( geometry, material ) { - - Object3D.call( this ); - - this.type = 'Mesh'; - - this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); - this.material = material !== undefined ? material : new MeshBasicMaterial( { color: Math.random() * 0xffffff } ); - - this.drawMode = TrianglesDrawMode; - - this.updateMorphTargets(); - - } - - Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Mesh, - - isMesh: true, - - setDrawMode: function ( value ) { - - this.drawMode = value; - - }, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.drawMode = source.drawMode; - - return this; - - }, - - updateMorphTargets: function () { - - var morphTargets = this.geometry.morphTargets; - - if ( morphTargets !== undefined && morphTargets.length > 0 ) { - - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - - for ( var m = 0, ml = morphTargets.length; m < ml; m ++ ) { - - this.morphTargetInfluences.push( 0 ); - this.morphTargetDictionary[ morphTargets[ m ].name ] = m; - - } - - } - - }, - - raycast: ( function () { - - var inverseMatrix = new Matrix4(); - var ray = new Ray(); - var sphere = new Sphere(); - - var vA = new Vector3(); - var vB = new Vector3(); - var vC = new Vector3(); - - var tempA = new Vector3(); - var tempB = new Vector3(); - var tempC = new Vector3(); - - var uvA = new Vector2(); - var uvB = new Vector2(); - var uvC = new Vector2(); - - var barycoord = new Vector3(); - - var intersectionPoint = new Vector3(); - var intersectionPointWorld = new Vector3(); - - function uvIntersection( point, p1, p2, p3, uv1, uv2, uv3 ) { - - Triangle.barycoordFromPoint( point, p1, p2, p3, barycoord ); - - uv1.multiplyScalar( barycoord.x ); - uv2.multiplyScalar( barycoord.y ); - uv3.multiplyScalar( barycoord.z ); - - uv1.add( uv2 ).add( uv3 ); - - return uv1.clone(); - - } - - function checkIntersection( object, raycaster, ray, pA, pB, pC, point ) { - - var intersect; - var material = object.material; - - if ( material.side === BackSide ) { - - intersect = ray.intersectTriangle( pC, pB, pA, true, point ); - - } else { - - intersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point ); - - } - - if ( intersect === null ) return null; - - intersectionPointWorld.copy( point ); - intersectionPointWorld.applyMatrix4( object.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectionPointWorld ); - - if ( distance < raycaster.near || distance > raycaster.far ) return null; - - return { - distance: distance, - point: intersectionPointWorld.clone(), - object: object - }; - - } - - function checkBufferGeometryIntersection( object, raycaster, ray, positions, uvs, a, b, c ) { - - vA.fromArray( positions, a * 3 ); - vB.fromArray( positions, b * 3 ); - vC.fromArray( positions, c * 3 ); - - var intersection = checkIntersection( object, raycaster, ray, vA, vB, vC, intersectionPoint ); - - if ( intersection ) { - - if ( uvs ) { - - uvA.fromArray( uvs, a * 2 ); - uvB.fromArray( uvs, b * 2 ); - uvC.fromArray( uvs, c * 2 ); - - intersection.uv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC ); - - } - - intersection.face = new Face3( a, b, c, Triangle.normal( vA, vB, vC ) ); - intersection.faceIndex = a; - - } - - return intersection; - - } - - return function raycast( raycaster, intersects ) { - - var geometry = this.geometry; - var material = this.material; - var matrixWorld = this.matrixWorld; - - if ( material === undefined ) return; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( matrixWorld ); - - if ( raycaster.ray.intersectsSphere( sphere ) === false ) return; - - // - - inverseMatrix.getInverse( matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - // Check boundingBox before continuing - - if ( geometry.boundingBox !== null ) { - - if ( ray.intersectsBox( geometry.boundingBox ) === false ) return; - - } - - var uvs, intersection; - - if ( (geometry && geometry.isBufferGeometry) ) { - - var a, b, c; - var index = geometry.index; - var attributes = geometry.attributes; - var positions = attributes.position.array; - - if ( attributes.uv !== undefined ) { - - uvs = attributes.uv.array; - - } - - if ( index !== null ) { - - var indices = index.array; - - for ( var i = 0, l = indices.length; i < l; i += 3 ) { - - a = indices[ i ]; - b = indices[ i + 1 ]; - c = indices[ i + 2 ]; - - intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c ); - - if ( intersection ) { - - intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indices buffer semantics - intersects.push( intersection ); - - } - - } - - } else { - - - for ( var i = 0, l = positions.length; i < l; i += 9 ) { - - a = i / 3; - b = a + 1; - c = a + 2; - - intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c ); - - if ( intersection ) { - - intersection.index = a; // triangle number in positions buffer semantics - intersects.push( intersection ); - - } - - } - - } - - } else if ( (geometry && geometry.isGeometry) ) { - - var fvA, fvB, fvC; - var isFaceMaterial = (material && material.isMultiMaterial); - var materials = isFaceMaterial === true ? material.materials : null; - - var vertices = geometry.vertices; - var faces = geometry.faces; - var faceVertexUvs = geometry.faceVertexUvs[ 0 ]; - if ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs; - - for ( var f = 0, fl = faces.length; f < fl; f ++ ) { - - var face = faces[ f ]; - var faceMaterial = isFaceMaterial === true ? materials[ face.materialIndex ] : material; - - if ( faceMaterial === undefined ) continue; - - fvA = vertices[ face.a ]; - fvB = vertices[ face.b ]; - fvC = vertices[ face.c ]; - - if ( faceMaterial.morphTargets === true ) { - - var morphTargets = geometry.morphTargets; - var morphInfluences = this.morphTargetInfluences; - - vA.set( 0, 0, 0 ); - vB.set( 0, 0, 0 ); - vC.set( 0, 0, 0 ); - - for ( var t = 0, tl = morphTargets.length; t < tl; t ++ ) { - - var influence = morphInfluences[ t ]; - - if ( influence === 0 ) continue; - - var targets = morphTargets[ t ].vertices; - - vA.addScaledVector( tempA.subVectors( targets[ face.a ], fvA ), influence ); - vB.addScaledVector( tempB.subVectors( targets[ face.b ], fvB ), influence ); - vC.addScaledVector( tempC.subVectors( targets[ face.c ], fvC ), influence ); - - } - - vA.add( fvA ); - vB.add( fvB ); - vC.add( fvC ); - - fvA = vA; - fvB = vB; - fvC = vC; - - } - - intersection = checkIntersection( this, raycaster, ray, fvA, fvB, fvC, intersectionPoint ); - - if ( intersection ) { - - if ( uvs ) { - - var uvs_f = uvs[ f ]; - uvA.copy( uvs_f[ 0 ] ); - uvB.copy( uvs_f[ 1 ] ); - uvC.copy( uvs_f[ 2 ] ); - - intersection.uv = uvIntersection( intersectionPoint, fvA, fvB, fvC, uvA, uvB, uvC ); - - } - - intersection.face = face; - intersection.faceIndex = f; - intersects.push( intersection ); - - } - - } - - } - - }; - - }() ), - - clone: function () { - - return new this.constructor( this.geometry, this.material ).copy( this ); - - } - - } ); - - /** - * @author Mugen87 / https://github.com/Mugen87 - */ - - function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { - - BufferGeometry.call( this ); - - this.type = 'BoxBufferGeometry'; - - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; - - var scope = this; - - // segments - widthSegments = Math.floor( widthSegments ) || 1; - heightSegments = Math.floor( heightSegments ) || 1; - depthSegments = Math.floor( depthSegments ) || 1; - - // these are used to calculate buffer length - var vertexCount = calculateVertexCount( widthSegments, heightSegments, depthSegments ); - var indexCount = calculateIndexCount( widthSegments, heightSegments, depthSegments ); - - // buffers - var indices = new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ); - var vertices = new Float32Array( vertexCount * 3 ); - var normals = new Float32Array( vertexCount * 3 ); - var uvs = new Float32Array( vertexCount * 2 ); - - // offset variables - var vertexBufferOffset = 0; - var uvBufferOffset = 0; - var indexBufferOffset = 0; - var numberOfVertices = 0; - - // group variables - var groupStart = 0; - - // build each side of the box geometry - buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px - buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx - buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py - buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny - buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz - buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz - - // build geometry - this.setIndex( new BufferAttribute( indices, 1 ) ); - this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - - // helper functions - - function calculateVertexCount( w, h, d ) { - - var vertices = 0; - - // calculate the amount of vertices for each side (plane) - vertices += (w + 1) * (h + 1) * 2; // xy - vertices += (w + 1) * (d + 1) * 2; // xz - vertices += (d + 1) * (h + 1) * 2; // zy - - return vertices; - - } - - function calculateIndexCount( w, h, d ) { - - var index = 0; - - // calculate the amount of squares for each side - index += w * h * 2; // xy - index += w * d * 2; // xz - index += d * h * 2; // zy - - return index * 6; // two triangles per square => six vertices per square - - } - - function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) { - - var segmentWidth = width / gridX; - var segmentHeight = height / gridY; - - var widthHalf = width / 2; - var heightHalf = height / 2; - var depthHalf = depth / 2; - - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; - - var vertexCounter = 0; - var groupCount = 0; - - var vector = new Vector3(); - - // generate vertices, normals and uvs - - for ( var iy = 0; iy < gridY1; iy ++ ) { - - var y = iy * segmentHeight - heightHalf; - - for ( var ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segmentWidth - widthHalf; - - // set values to correct vector component - vector[ u ] = x * udir; - vector[ v ] = y * vdir; - vector[ w ] = depthHalf; - - // now apply vector to vertex buffer - vertices[ vertexBufferOffset ] = vector.x; - vertices[ vertexBufferOffset + 1 ] = vector.y; - vertices[ vertexBufferOffset + 2 ] = vector.z; - - // set values to correct vector component - vector[ u ] = 0; - vector[ v ] = 0; - vector[ w ] = depth > 0 ? 1 : - 1; - - // now apply vector to normal buffer - normals[ vertexBufferOffset ] = vector.x; - normals[ vertexBufferOffset + 1 ] = vector.y; - normals[ vertexBufferOffset + 2 ] = vector.z; - - // uvs - uvs[ uvBufferOffset ] = ix / gridX; - uvs[ uvBufferOffset + 1 ] = 1 - ( iy / gridY ); - - // update offsets and counters - vertexBufferOffset += 3; - uvBufferOffset += 2; - vertexCounter += 1; - - } - - } - - // 1. you need three indices to draw a single face - // 2. a single segment consists of two faces - // 3. so we need to generate six (2*3) indices per segment - - for ( iy = 0; iy < gridY; iy ++ ) { - - for ( ix = 0; ix < gridX; ix ++ ) { - - // indices - var a = numberOfVertices + ix + gridX1 * iy; - var b = numberOfVertices + ix + gridX1 * ( iy + 1 ); - var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; - - // face one - indices[ indexBufferOffset ] = a; - indices[ indexBufferOffset + 1 ] = b; - indices[ indexBufferOffset + 2 ] = d; - - // face two - indices[ indexBufferOffset + 3 ] = b; - indices[ indexBufferOffset + 4 ] = c; - indices[ indexBufferOffset + 5 ] = d; - - // update offsets and counters - indexBufferOffset += 6; - groupCount += 6; - - } - - } - - // add a group to the geometry. this will ensure multi material support - scope.addGroup( groupStart, groupCount, materialIndex ); - - // calculate new start value for groups - groupStart += groupCount; - - // update total number of vertices - numberOfVertices += vertexCounter; - - } - - } - - BoxBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - BoxBufferGeometry.prototype.constructor = BoxBufferGeometry; - - /** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - - function PlaneBufferGeometry( width, height, widthSegments, heightSegments ) { - - BufferGeometry.call( this ); - - this.type = 'PlaneBufferGeometry'; - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments - }; - - var width_half = width / 2; - var height_half = height / 2; - - var gridX = Math.floor( widthSegments ) || 1; - var gridY = Math.floor( heightSegments ) || 1; - - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; - - var segment_width = width / gridX; - var segment_height = height / gridY; - - var vertices = new Float32Array( gridX1 * gridY1 * 3 ); - var normals = new Float32Array( gridX1 * gridY1 * 3 ); - var uvs = new Float32Array( gridX1 * gridY1 * 2 ); - - var offset = 0; - var offset2 = 0; - - for ( var iy = 0; iy < gridY1; iy ++ ) { - - var y = iy * segment_height - height_half; - - for ( var ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segment_width - width_half; - - vertices[ offset ] = x; - vertices[ offset + 1 ] = - y; - - normals[ offset + 2 ] = 1; - - uvs[ offset2 ] = ix / gridX; - uvs[ offset2 + 1 ] = 1 - ( iy / gridY ); - - offset += 3; - offset2 += 2; - - } - - } - - offset = 0; - - var indices = new ( ( vertices.length / 3 ) > 65535 ? Uint32Array : Uint16Array )( gridX * gridY * 6 ); - - for ( var iy = 0; iy < gridY; iy ++ ) { - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - indices[ offset ] = a; - indices[ offset + 1 ] = b; - indices[ offset + 2 ] = d; - - indices[ offset + 3 ] = b; - indices[ offset + 4 ] = c; - indices[ offset + 5 ] = d; - - offset += 6; - - } - - } - - this.setIndex( new BufferAttribute( indices, 1 ) ); - this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - - } - - PlaneBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - PlaneBufferGeometry.prototype.constructor = PlaneBufferGeometry; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author WestLangley / http://github.com/WestLangley - */ - - function Camera() { - - Object3D.call( this ); - - this.type = 'Camera'; - - this.matrixWorldInverse = new Matrix4(); - this.projectionMatrix = new Matrix4(); - - } - - Camera.prototype = Object.create( Object3D.prototype ); - Camera.prototype.constructor = Camera; - - Camera.prototype.isCamera = true; - - Camera.prototype.getWorldDirection = function () { - - var quaternion = new Quaternion(); - - return function getWorldDirection( optionalTarget ) { - - var result = optionalTarget || new Vector3(); - - this.getWorldQuaternion( quaternion ); - - return result.set( 0, 0, - 1 ).applyQuaternion( quaternion ); - - }; - - }(); - - Camera.prototype.lookAt = function () { - - // This routine does not support cameras with rotated and/or translated parent(s) - - var m1 = new Matrix4(); - - return function lookAt( vector ) { - - m1.lookAt( this.position, vector, this.up ); - - this.quaternion.setFromRotationMatrix( m1 ); - - }; - - }(); - - Camera.prototype.clone = function () { - - return new this.constructor().copy( this ); - - }; - - Camera.prototype.copy = function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.matrixWorldInverse.copy( source.matrixWorldInverse ); - this.projectionMatrix.copy( source.projectionMatrix ); - - return this; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author greggman / http://games.greggman.com/ - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author tschw - */ - - function PerspectiveCamera( fov, aspect, near, far ) { - - Camera.call( this ); - - this.type = 'PerspectiveCamera'; - - this.fov = fov !== undefined ? fov : 50; - this.zoom = 1; - - this.near = near !== undefined ? near : 0.1; - this.far = far !== undefined ? far : 2000; - this.focus = 10; - - this.aspect = aspect !== undefined ? aspect : 1; - this.view = null; - - this.filmGauge = 35; // width of the film (default in millimeters) - this.filmOffset = 0; // horizontal film offset (same unit as gauge) - - this.updateProjectionMatrix(); - - } - - PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ), { - - constructor: PerspectiveCamera, - - isPerspectiveCamera: true, - - copy: function ( source ) { - - Camera.prototype.copy.call( this, source ); - - this.fov = source.fov; - this.zoom = source.zoom; - - this.near = source.near; - this.far = source.far; - this.focus = source.focus; - - this.aspect = source.aspect; - this.view = source.view === null ? null : Object.assign( {}, source.view ); - - this.filmGauge = source.filmGauge; - this.filmOffset = source.filmOffset; - - return this; - - }, - - /** - * Sets the FOV by focal length in respect to the current .filmGauge. - * - * The default film gauge is 35, so that the focal length can be specified for - * a 35mm (full frame) camera. - * - * Values for focal length and film gauge must have the same unit. - */ - setFocalLength: function ( focalLength ) { - - // see http://www.bobatkins.com/photography/technical/field_of_view.html - var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; - - this.fov = exports.Math.RAD2DEG * 2 * Math.atan( vExtentSlope ); - this.updateProjectionMatrix(); - - }, - - /** - * Calculates the focal length from the current .fov and .filmGauge. - */ - getFocalLength: function () { - - var vExtentSlope = Math.tan( exports.Math.DEG2RAD * 0.5 * this.fov ); - - return 0.5 * this.getFilmHeight() / vExtentSlope; - - }, - - getEffectiveFOV: function () { - - return exports.Math.RAD2DEG * 2 * Math.atan( - Math.tan( exports.Math.DEG2RAD * 0.5 * this.fov ) / this.zoom ); - - }, - - getFilmWidth: function () { - - // film not completely covered in portrait format (aspect < 1) - return this.filmGauge * Math.min( this.aspect, 1 ); - - }, - - getFilmHeight: function () { - - // film not completely covered in landscape format (aspect > 1) - return this.filmGauge / Math.max( this.aspect, 1 ); - - }, - - /** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and - * the monitors are in grid like this - * - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - * - * then for each monitor you would call it like this - * - * var w = 1920; - * var h = 1080; - * var fullWidth = w * 3; - * var fullHeight = h * 2; - * - * --A-- - * camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * --B-- - * camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * --C-- - * camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * --D-- - * camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * --E-- - * camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * --F-- - * camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); - * - * Note there is no reason monitors have to be the same size or in a grid. - */ - setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) { - - this.aspect = fullWidth / fullHeight; - - this.view = { - fullWidth: fullWidth, - fullHeight: fullHeight, - offsetX: x, - offsetY: y, - width: width, - height: height - }; - - this.updateProjectionMatrix(); - - }, - - clearViewOffset: function() { - - this.view = null; - this.updateProjectionMatrix(); - - }, - - updateProjectionMatrix: function () { - - var near = this.near, - top = near * Math.tan( - exports.Math.DEG2RAD * 0.5 * this.fov ) / this.zoom, - height = 2 * top, - width = this.aspect * height, - left = - 0.5 * width, - view = this.view; - - if ( view !== null ) { - - var fullWidth = view.fullWidth, - fullHeight = view.fullHeight; - - left += view.offsetX * width / fullWidth; - top -= view.offsetY * height / fullHeight; - width *= view.width / fullWidth; - height *= view.height / fullHeight; - - } - - var skew = this.filmOffset; - if ( skew !== 0 ) left += near * skew / this.getFilmWidth(); - - this.projectionMatrix.makeFrustum( - left, left + width, top - height, top, near, this.far ); - - }, - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.fov = this.fov; - data.object.zoom = this.zoom; - - data.object.near = this.near; - data.object.far = this.far; - data.object.focus = this.focus; - - data.object.aspect = this.aspect; - - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); - - data.object.filmGauge = this.filmGauge; - data.object.filmOffset = this.filmOffset; - - return data; - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com/ - * @author arose / http://github.com/arose - */ - - function OrthographicCamera( left, right, top, bottom, near, far ) { - - Camera.call( this ); - - this.type = 'OrthographicCamera'; - - this.zoom = 1; - this.view = null; - - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - - this.near = ( near !== undefined ) ? near : 0.1; - this.far = ( far !== undefined ) ? far : 2000; - - this.updateProjectionMatrix(); - - } - - OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), { - - constructor: OrthographicCamera, - - isOrthographicCamera: true, - - copy: function ( source ) { - - Camera.prototype.copy.call( this, source ); - - this.left = source.left; - this.right = source.right; - this.top = source.top; - this.bottom = source.bottom; - this.near = source.near; - this.far = source.far; - - this.zoom = source.zoom; - this.view = source.view === null ? null : Object.assign( {}, source.view ); - - return this; - - }, - - setViewOffset: function( fullWidth, fullHeight, x, y, width, height ) { - - this.view = { - fullWidth: fullWidth, - fullHeight: fullHeight, - offsetX: x, - offsetY: y, - width: width, - height: height - }; - - this.updateProjectionMatrix(); - - }, - - clearViewOffset: function() { - - this.view = null; - this.updateProjectionMatrix(); - - }, - - updateProjectionMatrix: function () { - - var dx = ( this.right - this.left ) / ( 2 * this.zoom ); - var dy = ( this.top - this.bottom ) / ( 2 * this.zoom ); - var cx = ( this.right + this.left ) / 2; - var cy = ( this.top + this.bottom ) / 2; - - var left = cx - dx; - var right = cx + dx; - var top = cy + dy; - var bottom = cy - dy; - - if ( this.view !== null ) { - - var zoomW = this.zoom / ( this.view.width / this.view.fullWidth ); - var zoomH = this.zoom / ( this.view.height / this.view.fullHeight ); - var scaleW = ( this.right - this.left ) / this.view.width; - var scaleH = ( this.top - this.bottom ) / this.view.height; - - left += scaleW * ( this.view.offsetX / zoomW ); - right = left + scaleW * ( this.view.width / zoomW ); - top -= scaleH * ( this.view.offsetY / zoomH ); - bottom = top - scaleH * ( this.view.height / zoomH ); - - } - - this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far ); - - }, - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.zoom = this.zoom; - data.object.left = this.left; - data.object.right = this.right; - data.object.top = this.top; - data.object.bottom = this.bottom; - data.object.near = this.near; - data.object.far = this.far; - - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); - - return data; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function WebGLIndexedBufferRenderer( gl, extensions, infoRender ) { - - var mode; - - function setMode( value ) { - - mode = value; - - } - - var type, size; - - function setIndex( index ) { - - if ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) { - - type = gl.UNSIGNED_INT; - size = 4; - - } else { - - type = gl.UNSIGNED_SHORT; - size = 2; - - } - - } - - function render( start, count ) { - - gl.drawElements( mode, count, type, start * size ); - - infoRender.calls ++; - infoRender.vertices += count; - - if ( mode === gl.TRIANGLES ) infoRender.faces += count / 3; - - } - - function renderInstances( geometry, start, count ) { - - var extension = extensions.get( 'ANGLE_instanced_arrays' ); - - if ( extension === null ) { - - console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' ); - return; - - } - - extension.drawElementsInstancedANGLE( mode, count, type, start * size, geometry.maxInstancedCount ); - - infoRender.calls ++; - infoRender.vertices += count * geometry.maxInstancedCount; - - if ( mode === gl.TRIANGLES ) infoRender.faces += geometry.maxInstancedCount * count / 3; - - } - - return { - - setMode: setMode, - setIndex: setIndex, - render: render, - renderInstances: renderInstances - - }; - - } - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function WebGLBufferRenderer( gl, extensions, infoRender ) { - - var mode; - - function setMode( value ) { - - mode = value; - - } - - function render( start, count ) { - - gl.drawArrays( mode, start, count ); - - infoRender.calls ++; - infoRender.vertices += count; - - if ( mode === gl.TRIANGLES ) infoRender.faces += count / 3; - - } - - function renderInstances( geometry ) { - - var extension = extensions.get( 'ANGLE_instanced_arrays' ); - - if ( extension === null ) { - - console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' ); - return; - - } - - var position = geometry.attributes.position; - - var count = 0; - - if ( (position && position.isInterleavedBufferAttribute) ) { - - count = position.data.count; - - extension.drawArraysInstancedANGLE( mode, 0, count, geometry.maxInstancedCount ); - - } else { - - count = position.count; - - extension.drawArraysInstancedANGLE( mode, 0, count, geometry.maxInstancedCount ); - - } - - infoRender.calls ++; - infoRender.vertices += count * geometry.maxInstancedCount; - - if ( mode === gl.TRIANGLES ) infoRender.faces += geometry.maxInstancedCount * count / 3; - - } - - return { - setMode: setMode, - render: render, - renderInstances: renderInstances - }; - - } - - function WebGLLights() { - - var lights = {}; - - return { - - get: function ( light ) { - - if ( lights[ light.id ] !== undefined ) { - - return lights[ light.id ]; - - } - - var uniforms; - - switch ( light.type ) { - - case 'DirectionalLight': - uniforms = { - direction: new Vector3(), - color: new Color(), - - shadow: false, - shadowBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - - case 'SpotLight': - uniforms = { - position: new Vector3(), - direction: new Vector3(), - color: new Color(), - distance: 0, - coneCos: 0, - penumbraCos: 0, - decay: 0, - - shadow: false, - shadowBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - - case 'PointLight': - uniforms = { - position: new Vector3(), - color: new Color(), - distance: 0, - decay: 0, - - shadow: false, - shadowBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - - case 'HemisphereLight': - uniforms = { - direction: new Vector3(), - skyColor: new Color(), - groundColor: new Color() - }; - break; - - } - - lights[ light.id ] = uniforms; - - return uniforms; - - } - - }; - - } - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function addLineNumbers( string ) { - - var lines = string.split( '\n' ); - - for ( var i = 0; i < lines.length; i ++ ) { - - lines[ i ] = ( i + 1 ) + ': ' + lines[ i ]; - - } - - return lines.join( '\n' ); - - } - - function WebGLShader( gl, type, string ) { - - var shader = gl.createShader( type ); - - gl.shaderSource( shader, string ); - gl.compileShader( shader ); - - if ( gl.getShaderParameter( shader, gl.COMPILE_STATUS ) === false ) { - - console.error( 'THREE.WebGLShader: Shader couldn\'t compile.' ); - - } - - if ( gl.getShaderInfoLog( shader ) !== '' ) { - - console.warn( 'THREE.WebGLShader: gl.getShaderInfoLog()', type === gl.VERTEX_SHADER ? 'vertex' : 'fragment', gl.getShaderInfoLog( shader ), addLineNumbers( string ) ); - - } - - // --enable-privileged-webgl-extension - // console.log( type, gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); - - return shader; - - } - - var programIdCount = 0; - - function getEncodingComponents( encoding ) { - - switch ( encoding ) { - - case LinearEncoding: - return [ 'Linear','( value )' ]; - case sRGBEncoding: - return [ 'sRGB','( value )' ]; - case RGBEEncoding: - return [ 'RGBE','( value )' ]; - case RGBM7Encoding: - return [ 'RGBM','( value, 7.0 )' ]; - case RGBM16Encoding: - return [ 'RGBM','( value, 16.0 )' ]; - case RGBDEncoding: - return [ 'RGBD','( value, 256.0 )' ]; - case GammaEncoding: - return [ 'Gamma','( value, float( GAMMA_FACTOR ) )' ]; - default: - throw new Error( 'unsupported encoding: ' + encoding ); - - } - - } - - function getTexelDecodingFunction( functionName, encoding ) { - - var components = getEncodingComponents( encoding ); - return "vec4 " + functionName + "( vec4 value ) { return " + components[ 0 ] + "ToLinear" + components[ 1 ] + "; }"; - - } - - function getTexelEncodingFunction( functionName, encoding ) { - - var components = getEncodingComponents( encoding ); - return "vec4 " + functionName + "( vec4 value ) { return LinearTo" + components[ 0 ] + components[ 1 ] + "; }"; - - } - - function getToneMappingFunction( functionName, toneMapping ) { - - var toneMappingName; - - switch ( toneMapping ) { - - case LinearToneMapping: - toneMappingName = "Linear"; - break; - - case ReinhardToneMapping: - toneMappingName = "Reinhard"; - break; - - case Uncharted2ToneMapping: - toneMappingName = "Uncharted2"; - break; - - case CineonToneMapping: - toneMappingName = "OptimizedCineon"; - break; - - default: - throw new Error( 'unsupported toneMapping: ' + toneMapping ); - - } - - return "vec3 " + functionName + "( vec3 color ) { return " + toneMappingName + "ToneMapping( color ); }"; - - } - - function generateExtensions( extensions, parameters, rendererExtensions ) { - - extensions = extensions || {}; - - var chunks = [ - ( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.normalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '', - ( extensions.fragDepth || parameters.logarithmicDepthBuffer ) && rendererExtensions.get( 'EXT_frag_depth' ) ? '#extension GL_EXT_frag_depth : enable' : '', - ( extensions.drawBuffers ) && rendererExtensions.get( 'WEBGL_draw_buffers' ) ? '#extension GL_EXT_draw_buffers : require' : '', - ( extensions.shaderTextureLOD || parameters.envMap ) && rendererExtensions.get( 'EXT_shader_texture_lod' ) ? '#extension GL_EXT_shader_texture_lod : enable' : '', - ]; - - return chunks.filter( filterEmptyLine ).join( '\n' ); - - } - - function generateDefines( defines ) { - - var chunks = []; - - for ( var name in defines ) { - - var value = defines[ name ]; - - if ( value === false ) continue; - - chunks.push( '#define ' + name + ' ' + value ); - - } - - return chunks.join( '\n' ); - - } - - function fetchAttributeLocations( gl, program, identifiers ) { - - var attributes = {}; - - var n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES ); - - for ( var i = 0; i < n; i ++ ) { - - var info = gl.getActiveAttrib( program, i ); - var name = info.name; - - // console.log("THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:", name, i ); - - attributes[ name ] = gl.getAttribLocation( program, name ); - - } - - return attributes; - - } - - function filterEmptyLine( string ) { - - return string !== ''; - - } - - function replaceLightNums( string, parameters ) { - - return string - .replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights ) - .replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights ) - .replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights ) - .replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights ); - - } - - function parseIncludes( string ) { - - var pattern = /#include +<([\w\d.]+)>/g; - - function replace( match, include ) { - - var replace = ShaderChunk[ include ]; - - if ( replace === undefined ) { - - throw new Error( 'Can not resolve #include <' + include + '>' ); - - } - - return parseIncludes( replace ); - - } - - return string.replace( pattern, replace ); - - } - - function unrollLoops( string ) { - - var pattern = /for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; - - function replace( match, start, end, snippet ) { - - var unroll = ''; - - for ( var i = parseInt( start ); i < parseInt( end ); i ++ ) { - - unroll += snippet.replace( /\[ i \]/g, '[ ' + i + ' ]' ); - - } - - return unroll; - - } - - return string.replace( pattern, replace ); - - } - - function WebGLProgram( renderer, code, material, parameters ) { - - var gl = renderer.context; - - var extensions = material.extensions; - var defines = material.defines; - - var vertexShader = material.__webglShader.vertexShader; - var fragmentShader = material.__webglShader.fragmentShader; - - var shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; - - if ( parameters.shadowMapType === PCFShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF'; - - } else if ( parameters.shadowMapType === PCFSoftShadowMap ) { - - shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT'; - - } - - var envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - var envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; - var envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; - - if ( parameters.envMap ) { - - switch ( material.envMap.mapping ) { - - case CubeReflectionMapping: - case CubeRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - break; - - case CubeUVReflectionMapping: - case CubeUVRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV'; - break; - - case EquirectangularReflectionMapping: - case EquirectangularRefractionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_EQUIREC'; - break; - - case SphericalReflectionMapping: - envMapTypeDefine = 'ENVMAP_TYPE_SPHERE'; - break; - - } - - switch ( material.envMap.mapping ) { - - case CubeRefractionMapping: - case EquirectangularRefractionMapping: - envMapModeDefine = 'ENVMAP_MODE_REFRACTION'; - break; - - } - - switch ( material.combine ) { - - case MultiplyOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; - break; - - case MixOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_MIX'; - break; - - case AddOperation: - envMapBlendingDefine = 'ENVMAP_BLENDING_ADD'; - break; - - } - - } - - var gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0; - - // console.log( 'building new program ' ); - - // - - var customExtensions = generateExtensions( extensions, parameters, renderer.extensions ); - - var customDefines = generateDefines( defines ); - - // - - var program = gl.createProgram(); - - var prefixVertex, prefixFragment; - - if ( material.isRawShaderMaterial ) { - - prefixVertex = [ - - customDefines, - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - prefixFragment = [ - - customExtensions, - customDefines, - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - } else { - - prefixVertex = [ - - 'precision ' + parameters.precision + ' float;', - 'precision ' + parameters.precision + ' int;', - - '#define SHADER_NAME ' + material.__webglShader.name, - - customDefines, - - parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '', - - '#define GAMMA_FACTOR ' + gammaFactorDefine, - - '#define MAX_BONES ' + parameters.maxBones, - - parameters.map ? '#define USE_MAP' : '', - parameters.envMap ? '#define USE_ENVMAP' : '', - parameters.envMap ? '#define ' + envMapModeDefine : '', - parameters.lightMap ? '#define USE_LIGHTMAP' : '', - parameters.aoMap ? '#define USE_AOMAP' : '', - parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', - parameters.bumpMap ? '#define USE_BUMPMAP' : '', - parameters.normalMap ? '#define USE_NORMALMAP' : '', - parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '', - parameters.specularMap ? '#define USE_SPECULARMAP' : '', - parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', - parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', - parameters.alphaMap ? '#define USE_ALPHAMAP' : '', - parameters.vertexColors ? '#define USE_COLOR' : '', - - parameters.flatShading ? '#define FLAT_SHADED' : '', - - parameters.skinning ? '#define USE_SKINNING' : '', - parameters.useVertexTexture ? '#define BONE_TEXTURE' : '', - - parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', - parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '', - parameters.doubleSided ? '#define DOUBLE_SIDED' : '', - parameters.flipSided ? '#define FLIP_SIDED' : '', - - '#define NUM_CLIPPING_PLANES ' + parameters.numClippingPlanes, - - parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', - parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', - - parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', - - parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', - parameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '', - - 'uniform mat4 modelMatrix;', - 'uniform mat4 modelViewMatrix;', - 'uniform mat4 projectionMatrix;', - 'uniform mat4 viewMatrix;', - 'uniform mat3 normalMatrix;', - 'uniform vec3 cameraPosition;', - - 'attribute vec3 position;', - 'attribute vec3 normal;', - 'attribute vec2 uv;', - - '#ifdef USE_COLOR', - - ' attribute vec3 color;', - - '#endif', - - '#ifdef USE_MORPHTARGETS', - - ' attribute vec3 morphTarget0;', - ' attribute vec3 morphTarget1;', - ' attribute vec3 morphTarget2;', - ' attribute vec3 morphTarget3;', - - ' #ifdef USE_MORPHNORMALS', - - ' attribute vec3 morphNormal0;', - ' attribute vec3 morphNormal1;', - ' attribute vec3 morphNormal2;', - ' attribute vec3 morphNormal3;', - - ' #else', - - ' attribute vec3 morphTarget4;', - ' attribute vec3 morphTarget5;', - ' attribute vec3 morphTarget6;', - ' attribute vec3 morphTarget7;', - - ' #endif', - - '#endif', - - '#ifdef USE_SKINNING', - - ' attribute vec4 skinIndex;', - ' attribute vec4 skinWeight;', - - '#endif', - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - prefixFragment = [ - - customExtensions, - - 'precision ' + parameters.precision + ' float;', - 'precision ' + parameters.precision + ' int;', - - '#define SHADER_NAME ' + material.__webglShader.name, - - customDefines, - - parameters.alphaTest ? '#define ALPHATEST ' + parameters.alphaTest : '', - - '#define GAMMA_FACTOR ' + gammaFactorDefine, - - ( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '', - ( parameters.useFog && parameters.fogExp ) ? '#define FOG_EXP2' : '', - - parameters.map ? '#define USE_MAP' : '', - parameters.envMap ? '#define USE_ENVMAP' : '', - parameters.envMap ? '#define ' + envMapTypeDefine : '', - parameters.envMap ? '#define ' + envMapModeDefine : '', - parameters.envMap ? '#define ' + envMapBlendingDefine : '', - parameters.lightMap ? '#define USE_LIGHTMAP' : '', - parameters.aoMap ? '#define USE_AOMAP' : '', - parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', - parameters.bumpMap ? '#define USE_BUMPMAP' : '', - parameters.normalMap ? '#define USE_NORMALMAP' : '', - parameters.specularMap ? '#define USE_SPECULARMAP' : '', - parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', - parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', - parameters.alphaMap ? '#define USE_ALPHAMAP' : '', - parameters.vertexColors ? '#define USE_COLOR' : '', - - parameters.flatShading ? '#define FLAT_SHADED' : '', - - parameters.doubleSided ? '#define DOUBLE_SIDED' : '', - parameters.flipSided ? '#define FLIP_SIDED' : '', - - '#define NUM_CLIPPING_PLANES ' + parameters.numClippingPlanes, - - parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', - parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', - - parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : '', - - parameters.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : '', - - parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', - parameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '', - - parameters.envMap && renderer.extensions.get( 'EXT_shader_texture_lod' ) ? '#define TEXTURE_LOD_EXT' : '', - - 'uniform mat4 viewMatrix;', - 'uniform vec3 cameraPosition;', - - ( parameters.toneMapping !== NoToneMapping ) ? "#define TONE_MAPPING" : '', - ( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below - ( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( "toneMapping", parameters.toneMapping ) : '', - - ( parameters.outputEncoding || parameters.mapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding ) ? ShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below - parameters.mapEncoding ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '', - parameters.envMapEncoding ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '', - parameters.emissiveMapEncoding ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '', - parameters.outputEncoding ? getTexelEncodingFunction( "linearToOutputTexel", parameters.outputEncoding ) : '', - - parameters.depthPacking ? "#define DEPTH_PACKING " + material.depthPacking : '', - - '\n' - - ].filter( filterEmptyLine ).join( '\n' ); - - } - - vertexShader = parseIncludes( vertexShader, parameters ); - vertexShader = replaceLightNums( vertexShader, parameters ); - - fragmentShader = parseIncludes( fragmentShader, parameters ); - fragmentShader = replaceLightNums( fragmentShader, parameters ); - - if ( ! material.isShaderMaterial ) { - - vertexShader = unrollLoops( vertexShader ); - fragmentShader = unrollLoops( fragmentShader ); - - } - - var vertexGlsl = prefixVertex + vertexShader; - var fragmentGlsl = prefixFragment + fragmentShader; - - // console.log( '*VERTEX*', vertexGlsl ); - // console.log( '*FRAGMENT*', fragmentGlsl ); - - var glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl ); - var glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl ); - - gl.attachShader( program, glVertexShader ); - gl.attachShader( program, glFragmentShader ); - - // Force a particular attribute to index 0. - - if ( material.index0AttributeName !== undefined ) { - - gl.bindAttribLocation( program, 0, material.index0AttributeName ); - - } else if ( parameters.morphTargets === true ) { - - // programs with morphTargets displace position out of attribute 0 - gl.bindAttribLocation( program, 0, 'position' ); - - } - - gl.linkProgram( program ); - - var programLog = gl.getProgramInfoLog( program ); - var vertexLog = gl.getShaderInfoLog( glVertexShader ); - var fragmentLog = gl.getShaderInfoLog( glFragmentShader ); - - var runnable = true; - var haveDiagnostics = true; - - // console.log( '**VERTEX**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glVertexShader ) ); - // console.log( '**FRAGMENT**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glFragmentShader ) ); - - if ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) { - - runnable = false; - - console.error( 'THREE.WebGLProgram: shader error: ', gl.getError(), 'gl.VALIDATE_STATUS', gl.getProgramParameter( program, gl.VALIDATE_STATUS ), 'gl.getProgramInfoLog', programLog, vertexLog, fragmentLog ); - - } else if ( programLog !== '' ) { - - console.warn( 'THREE.WebGLProgram: gl.getProgramInfoLog()', programLog ); - - } else if ( vertexLog === '' || fragmentLog === '' ) { - - haveDiagnostics = false; - - } - - if ( haveDiagnostics ) { - - this.diagnostics = { - - runnable: runnable, - material: material, - - programLog: programLog, - - vertexShader: { - - log: vertexLog, - prefix: prefixVertex - - }, - - fragmentShader: { - - log: fragmentLog, - prefix: prefixFragment - - } - - }; - - } - - // clean up - - gl.deleteShader( glVertexShader ); - gl.deleteShader( glFragmentShader ); - - // set up caching for uniform locations - - var cachedUniforms; - - this.getUniforms = function() { - - if ( cachedUniforms === undefined ) { - - cachedUniforms = - new WebGLUniforms( gl, program, renderer ); - - } - - return cachedUniforms; - - }; - - // set up caching for attribute locations - - var cachedAttributes; - - this.getAttributes = function() { - - if ( cachedAttributes === undefined ) { - - cachedAttributes = fetchAttributeLocations( gl, program ); - - } - - return cachedAttributes; - - }; - - // free resource - - this.destroy = function() { - - gl.deleteProgram( program ); - this.program = undefined; - - }; - - // DEPRECATED - - Object.defineProperties( this, { - - uniforms: { - get: function() { - - console.warn( 'THREE.WebGLProgram: .uniforms is now .getUniforms().' ); - return this.getUniforms(); - - } - }, - - attributes: { - get: function() { - - console.warn( 'THREE.WebGLProgram: .attributes is now .getAttributes().' ); - return this.getAttributes(); - - } - } - - } ); - - - // - - this.id = programIdCount ++; - this.code = code; - this.usedTimes = 1; - this.program = program; - this.vertexShader = glVertexShader; - this.fragmentShader = glFragmentShader; - - return this; - - } - - function WebGLPrograms( renderer, capabilities ) { - - var programs = []; - - var shaderIDs = { - MeshDepthMaterial: 'depth', - MeshNormalMaterial: 'normal', - MeshBasicMaterial: 'basic', - MeshLambertMaterial: 'lambert', - MeshPhongMaterial: 'phong', - MeshStandardMaterial: 'physical', - MeshPhysicalMaterial: 'physical', - LineBasicMaterial: 'basic', - LineDashedMaterial: 'dashed', - PointsMaterial: 'points' - }; - - var parameterNames = [ - "precision", "supportsVertexTextures", "map", "mapEncoding", "envMap", "envMapMode", "envMapEncoding", - "lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "displacementMap", "specularMap", - "roughnessMap", "metalnessMap", - "alphaMap", "combine", "vertexColors", "fog", "useFog", "fogExp", - "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", - "maxBones", "useVertexTexture", "morphTargets", "morphNormals", - "maxMorphTargets", "maxMorphNormals", "premultipliedAlpha", - "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", - "shadowMapEnabled", "shadowMapType", "toneMapping", 'physicallyCorrectLights', - "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "depthPacking" - ]; - - - function allocateBones( object ) { - - if ( capabilities.floatVertexTextures && object && object.skeleton && object.skeleton.useVertexTexture ) { - - return 1024; - - } else { - - // default for when object is not specified - // ( for example when prebuilding shader to be used with multiple objects ) - // - // - leave some extra space for other uniforms - // - limit here is ANGLE's 254 max uniform vectors - // (up to 54 should be safe) - - var nVertexUniforms = capabilities.maxVertexUniforms; - var nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 ); - - var maxBones = nVertexMatrices; - - if ( object !== undefined && (object && object.isSkinnedMesh) ) { - - maxBones = Math.min( object.skeleton.bones.length, maxBones ); - - if ( maxBones < object.skeleton.bones.length ) { - - console.warn( 'WebGLRenderer: too many bones - ' + object.skeleton.bones.length + ', this GPU supports just ' + maxBones + ' (try OpenGL instead of ANGLE)' ); - - } - - } - - return maxBones; - - } - - } - - function getTextureEncodingFromMap( map, gammaOverrideLinear ) { - - var encoding; - - if ( ! map ) { - - encoding = LinearEncoding; - - } else if ( (map && map.isTexture) ) { - - encoding = map.encoding; - - } else if ( (map && map.isWebGLRenderTarget) ) { - - console.warn( "THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead." ); - encoding = map.texture.encoding; - - } - - // add backwards compatibility for WebGLRenderer.gammaInput/gammaOutput parameter, should probably be removed at some point. - if ( encoding === LinearEncoding && gammaOverrideLinear ) { - - encoding = GammaEncoding; - - } - - return encoding; - - } - - this.getParameters = function ( material, lights, fog, nClipPlanes, object ) { - - var shaderID = shaderIDs[ material.type ]; - - // heuristics to create shader parameters according to lights in the scene - // (not to blow over maxLights budget) - - var maxBones = allocateBones( object ); - var precision = renderer.getPrecision(); - - if ( material.precision !== null ) { - - precision = capabilities.getMaxPrecision( material.precision ); - - if ( precision !== material.precision ) { - - console.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' ); - - } - - } - - var currentRenderTarget = renderer.getCurrentRenderTarget(); - - var parameters = { - - shaderID: shaderID, - - precision: precision, - supportsVertexTextures: capabilities.vertexTextures, - outputEncoding: getTextureEncodingFromMap( ( ! currentRenderTarget ) ? null : currentRenderTarget.texture, renderer.gammaOutput ), - map: !! material.map, - mapEncoding: getTextureEncodingFromMap( material.map, renderer.gammaInput ), - envMap: !! material.envMap, - envMapMode: material.envMap && material.envMap.mapping, - envMapEncoding: getTextureEncodingFromMap( material.envMap, renderer.gammaInput ), - envMapCubeUV: ( !! material.envMap ) && ( ( material.envMap.mapping === CubeUVReflectionMapping ) || ( material.envMap.mapping === CubeUVRefractionMapping ) ), - lightMap: !! material.lightMap, - aoMap: !! material.aoMap, - emissiveMap: !! material.emissiveMap, - emissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap, renderer.gammaInput ), - bumpMap: !! material.bumpMap, - normalMap: !! material.normalMap, - displacementMap: !! material.displacementMap, - roughnessMap: !! material.roughnessMap, - metalnessMap: !! material.metalnessMap, - specularMap: !! material.specularMap, - alphaMap: !! material.alphaMap, - - combine: material.combine, - - vertexColors: material.vertexColors, - - fog: !! fog, - useFog: material.fog, - fogExp: (fog && fog.isFogExp2), - - flatShading: material.shading === FlatShading, - - sizeAttenuation: material.sizeAttenuation, - logarithmicDepthBuffer: capabilities.logarithmicDepthBuffer, - - skinning: material.skinning, - maxBones: maxBones, - useVertexTexture: capabilities.floatVertexTextures && object && object.skeleton && object.skeleton.useVertexTexture, - - morphTargets: material.morphTargets, - morphNormals: material.morphNormals, - maxMorphTargets: renderer.maxMorphTargets, - maxMorphNormals: renderer.maxMorphNormals, - - numDirLights: lights.directional.length, - numPointLights: lights.point.length, - numSpotLights: lights.spot.length, - numHemiLights: lights.hemi.length, - - numClippingPlanes: nClipPlanes, - - shadowMapEnabled: renderer.shadowMap.enabled && object.receiveShadow && lights.shadows.length > 0, - shadowMapType: renderer.shadowMap.type, - - toneMapping: renderer.toneMapping, - physicallyCorrectLights: renderer.physicallyCorrectLights, - - premultipliedAlpha: material.premultipliedAlpha, - - alphaTest: material.alphaTest, - doubleSided: material.side === DoubleSide, - flipSided: material.side === BackSide, - - depthPacking: ( material.depthPacking !== undefined ) ? material.depthPacking : false - - }; - - return parameters; - - }; - - this.getProgramCode = function ( material, parameters ) { - - var array = []; - - if ( parameters.shaderID ) { - - array.push( parameters.shaderID ); - - } else { - - array.push( material.fragmentShader ); - array.push( material.vertexShader ); - - } - - if ( material.defines !== undefined ) { - - for ( var name in material.defines ) { - - array.push( name ); - array.push( material.defines[ name ] ); - - } - - } - - for ( var i = 0; i < parameterNames.length; i ++ ) { - - array.push( parameters[ parameterNames[ i ] ] ); - - } - - return array.join(); - - }; - - this.acquireProgram = function ( material, parameters, code ) { - - var program; - - // Check if code has been already compiled - for ( var p = 0, pl = programs.length; p < pl; p ++ ) { - - var programInfo = programs[ p ]; - - if ( programInfo.code === code ) { - - program = programInfo; - ++ program.usedTimes; - - break; - - } - - } - - if ( program === undefined ) { - - program = new WebGLProgram( renderer, code, material, parameters ); - programs.push( program ); - - } - - return program; - - }; - - this.releaseProgram = function( program ) { - - if ( -- program.usedTimes === 0 ) { - - // Remove from unordered set - var i = programs.indexOf( program ); - programs[ i ] = programs[ programs.length - 1 ]; - programs.pop(); - - // Free WebGL resources - program.destroy(); - - } - - }; - - // Exposed for resource monitoring & error feedback via renderer.info: - this.programs = programs; - - } - - function WebGLGeometries( gl, properties, info ) { - - var geometries = {}; - - function onGeometryDispose( event ) { - - var geometry = event.target; - var buffergeometry = geometries[ geometry.id ]; - - if ( buffergeometry.index !== null ) { - - deleteAttribute( buffergeometry.index ); - - } - - deleteAttributes( buffergeometry.attributes ); - - geometry.removeEventListener( 'dispose', onGeometryDispose ); - - delete geometries[ geometry.id ]; - - // TODO - - var property = properties.get( geometry ); - - if ( property.wireframe ) { - - deleteAttribute( property.wireframe ); - - } - - properties.delete( geometry ); - - var bufferproperty = properties.get( buffergeometry ); - - if ( bufferproperty.wireframe ) { - - deleteAttribute( bufferproperty.wireframe ); - - } - - properties.delete( buffergeometry ); - - // - - info.memory.geometries --; - - } - - function getAttributeBuffer( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) { - - return properties.get( attribute.data ).__webglBuffer; - - } - - return properties.get( attribute ).__webglBuffer; - - } - - function deleteAttribute( attribute ) { - - var buffer = getAttributeBuffer( attribute ); - - if ( buffer !== undefined ) { - - gl.deleteBuffer( buffer ); - removeAttributeBuffer( attribute ); - - } - - } - - function deleteAttributes( attributes ) { - - for ( var name in attributes ) { - - deleteAttribute( attributes[ name ] ); - - } - - } - - function removeAttributeBuffer( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) { - - properties.delete( attribute.data ); - - } else { - - properties.delete( attribute ); - - } - - } - - return { - - get: function ( object ) { - - var geometry = object.geometry; - - if ( geometries[ geometry.id ] !== undefined ) { - - return geometries[ geometry.id ]; - - } - - geometry.addEventListener( 'dispose', onGeometryDispose ); - - var buffergeometry; - - if ( geometry.isBufferGeometry ) { - - buffergeometry = geometry; - - } else if ( geometry.isGeometry ) { - - if ( geometry._bufferGeometry === undefined ) { - - geometry._bufferGeometry = new BufferGeometry().setFromObject( object ); - - } - - buffergeometry = geometry._bufferGeometry; - - } - - geometries[ geometry.id ] = buffergeometry; - - info.memory.geometries ++; - - return buffergeometry; - - } - - }; - - } - - function WebGLObjects( gl, properties, info ) { - - var geometries = new WebGLGeometries( gl, properties, info ); - - // - - function update( object ) { - - // TODO: Avoid updating twice (when using shadowMap). Maybe add frame counter. - - var geometry = geometries.get( object ); - - if ( object.geometry.isGeometry ) { - - geometry.updateFromObject( object ); - - } - - var index = geometry.index; - var attributes = geometry.attributes; - - if ( index !== null ) { - - updateAttribute( index, gl.ELEMENT_ARRAY_BUFFER ); - - } - - for ( var name in attributes ) { - - updateAttribute( attributes[ name ], gl.ARRAY_BUFFER ); - - } - - // morph targets - - var morphAttributes = geometry.morphAttributes; - - for ( var name in morphAttributes ) { - - var array = morphAttributes[ name ]; - - for ( var i = 0, l = array.length; i < l; i ++ ) { - - updateAttribute( array[ i ], gl.ARRAY_BUFFER ); - - } - - } - - return geometry; - - } - - function updateAttribute( attribute, bufferType ) { - - var data = ( attribute.isInterleavedBufferAttribute ) ? attribute.data : attribute; - - var attributeProperties = properties.get( data ); - - if ( attributeProperties.__webglBuffer === undefined ) { - - createBuffer( attributeProperties, data, bufferType ); - - } else if ( attributeProperties.version !== data.version ) { - - updateBuffer( attributeProperties, data, bufferType ); - - } - - } - - function createBuffer( attributeProperties, data, bufferType ) { - - attributeProperties.__webglBuffer = gl.createBuffer(); - gl.bindBuffer( bufferType, attributeProperties.__webglBuffer ); - - var usage = data.dynamic ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW; - - gl.bufferData( bufferType, data.array, usage ); - - attributeProperties.version = data.version; - - } - - function updateBuffer( attributeProperties, data, bufferType ) { - - gl.bindBuffer( bufferType, attributeProperties.__webglBuffer ); - - if ( data.dynamic === false || data.updateRange.count === - 1 ) { - - // Not using update ranges - - gl.bufferSubData( bufferType, 0, data.array ); - - } else if ( data.updateRange.count === 0 ) { - - console.error( 'THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually.' ); - - } else { - - gl.bufferSubData( bufferType, data.updateRange.offset * data.array.BYTES_PER_ELEMENT, - data.array.subarray( data.updateRange.offset, data.updateRange.offset + data.updateRange.count ) ); - - data.updateRange.count = 0; // reset range - - } - - attributeProperties.version = data.version; - - } - - function getAttributeBuffer( attribute ) { - - if ( attribute.isInterleavedBufferAttribute ) { - - return properties.get( attribute.data ).__webglBuffer; - - } - - return properties.get( attribute ).__webglBuffer; - - } - - function getWireframeAttribute( geometry ) { - - var property = properties.get( geometry ); - - if ( property.wireframe !== undefined ) { - - return property.wireframe; - - } - - var indices = []; - - var index = geometry.index; - var attributes = geometry.attributes; - var position = attributes.position; - - // console.time( 'wireframe' ); - - if ( index !== null ) { - - var edges = {}; - var array = index.array; - - for ( var i = 0, l = array.length; i < l; i += 3 ) { - - var a = array[ i + 0 ]; - var b = array[ i + 1 ]; - var c = array[ i + 2 ]; - - indices.push( a, b, b, c, c, a ); - - } - - } else { - - var array = attributes.position.array; - - for ( var i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) { - - var a = i + 0; - var b = i + 1; - var c = i + 2; - - indices.push( a, b, b, c, c, a ); - - } - - } - - // console.timeEnd( 'wireframe' ); - - var TypeArray = position.count > 65535 ? Uint32Array : Uint16Array; - var attribute = new BufferAttribute( new TypeArray( indices ), 1 ); - - updateAttribute( attribute, gl.ELEMENT_ARRAY_BUFFER ); - - property.wireframe = attribute; - - return attribute; - - } - - return { - - getAttributeBuffer: getAttributeBuffer, - getWireframeAttribute: getWireframeAttribute, - - update: update - - }; - - } - - function WebGLTextures( _gl, extensions, state, properties, capabilities, paramThreeToGL, info ) { - - var _infoMemory = info.memory; - var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof WebGL2RenderingContext ); - - // - - function clampToMaxSize( image, maxSize ) { - - if ( image.width > maxSize || image.height > maxSize ) { - - // Warning: Scaling through the canvas will only work with images that use - // premultiplied alpha. - - var scale = maxSize / Math.max( image.width, image.height ); - - var canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.width = Math.floor( image.width * scale ); - canvas.height = Math.floor( image.height * scale ); - - var context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height ); - - console.warn( 'THREE.WebGLRenderer: image is too big (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image ); - - return canvas; - - } - - return image; - - } - - function isPowerOfTwo( image ) { - - return exports.Math.isPowerOfTwo( image.width ) && exports.Math.isPowerOfTwo( image.height ); - - } - - function makePowerOfTwo( image ) { - - if ( image instanceof HTMLImageElement || image instanceof HTMLCanvasElement ) { - - var canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - canvas.width = exports.Math.nearestPowerOfTwo( image.width ); - canvas.height = exports.Math.nearestPowerOfTwo( image.height ); - - var context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0, canvas.width, canvas.height ); - - console.warn( 'THREE.WebGLRenderer: image is not power of two (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image ); - - return canvas; - - } - - return image; - - } - - function textureNeedsPowerOfTwo( texture ) { - - if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) return true; - if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) return true; - - return false; - - } - - // Fallback filters for non-power-of-2 textures - - function filterFallback( f ) { - - if ( f === NearestFilter || f === NearestMipMapNearestFilter || f === NearestMipMapLinearFilter ) { - - return _gl.NEAREST; - - } - - return _gl.LINEAR; - - } - - // - - function onTextureDispose( event ) { - - var texture = event.target; - - texture.removeEventListener( 'dispose', onTextureDispose ); - - deallocateTexture( texture ); - - _infoMemory.textures --; - - - } - - function onRenderTargetDispose( event ) { - - var renderTarget = event.target; - - renderTarget.removeEventListener( 'dispose', onRenderTargetDispose ); - - deallocateRenderTarget( renderTarget ); - - _infoMemory.textures --; - - } - - // - - function deallocateTexture( texture ) { - - var textureProperties = properties.get( texture ); - - if ( texture.image && textureProperties.__image__webglTextureCube ) { - - // cube texture - - _gl.deleteTexture( textureProperties.__image__webglTextureCube ); - - } else { - - // 2D texture - - if ( textureProperties.__webglInit === undefined ) return; - - _gl.deleteTexture( textureProperties.__webglTexture ); - - } - - // remove all webgl properties - properties.delete( texture ); - - } - - function deallocateRenderTarget( renderTarget ) { - - var renderTargetProperties = properties.get( renderTarget ); - var textureProperties = properties.get( renderTarget.texture ); - - if ( ! renderTarget ) return; - - if ( textureProperties.__webglTexture !== undefined ) { - - _gl.deleteTexture( textureProperties.__webglTexture ); - - } - - if ( renderTarget.depthTexture ) { - - renderTarget.depthTexture.dispose(); - - } - - if ( (renderTarget && renderTarget.isWebGLRenderTargetCube) ) { - - for ( var i = 0; i < 6; i ++ ) { - - _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] ); - if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] ); - - } - - } else { - - _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer ); - if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer ); - - } - - properties.delete( renderTarget.texture ); - properties.delete( renderTarget ); - - } - - // - - - - function setTexture2D( texture, slot ) { - - var textureProperties = properties.get( texture ); - - if ( texture.version > 0 && textureProperties.__version !== texture.version ) { - - var image = texture.image; - - if ( image === undefined ) { - - console.warn( 'THREE.WebGLRenderer: Texture marked for update but image is undefined', texture ); - - } else if ( image.complete === false ) { - - console.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete', texture ); - - } else { - - uploadTexture( textureProperties, texture, slot ); - return; - - } - - } - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); - - } - - function setTextureCube( texture, slot ) { - - var textureProperties = properties.get( texture ); - - if ( texture.image.length === 6 ) { - - if ( texture.version > 0 && textureProperties.__version !== texture.version ) { - - if ( ! textureProperties.__image__webglTextureCube ) { - - texture.addEventListener( 'dispose', onTextureDispose ); - - textureProperties.__image__webglTextureCube = _gl.createTexture(); - - _infoMemory.textures ++; - - } - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__image__webglTextureCube ); - - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - - var isCompressed = (texture && texture.isCompressedTexture); - var isDataTexture = (texture.image[ 0 ] && texture.image[ 0 ].isDataTexture); - - var cubeImage = []; - - for ( var i = 0; i < 6; i ++ ) { - - if ( ! isCompressed && ! isDataTexture ) { - - cubeImage[ i ] = clampToMaxSize( texture.image[ i ], capabilities.maxCubemapSize ); - - } else { - - cubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ]; - - } - - } - - var image = cubeImage[ 0 ], - isPowerOfTwoImage = isPowerOfTwo( image ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); - - setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, isPowerOfTwoImage ); - - for ( var i = 0; i < 6; i ++ ) { - - if ( ! isCompressed ) { - - if ( isDataTexture ) { - - state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data ); - - } else { - - state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] ); - - } - - } else { - - var mipmap, mipmaps = cubeImage[ i ].mipmaps; - - for ( var j = 0, jl = mipmaps.length; j < jl; j ++ ) { - - mipmap = mipmaps[ j ]; - - if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) { - - if ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) { - - state.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - - console.warn( "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()" ); - - } - - } else { - - state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - } - - } - - } - - if ( texture.generateMipmaps && isPowerOfTwoImage ) { - - _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - - } - - textureProperties.__version = texture.version; - - if ( texture.onUpdate ) texture.onUpdate( texture ); - - } else { - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__image__webglTextureCube ); - - } - - } - - } - - function setTextureCubeDynamic( texture, slot ) { - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_CUBE_MAP, properties.get( texture ).__webglTexture ); - - } - - function setTextureParameters( textureType, texture, isPowerOfTwoImage ) { - - var extension; - - if ( isPowerOfTwoImage ) { - - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) ); - - _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) ); - - } else { - - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE ); - _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE ); - - if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) { - - console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.', texture ); - - } - - _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) ); - _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) ); - - if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) { - - console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.', texture ); - - } - - } - - extension = extensions.get( 'EXT_texture_filter_anisotropic' ); - - if ( extension ) { - - if ( texture.type === FloatType && extensions.get( 'OES_texture_float_linear' ) === null ) return; - if ( texture.type === HalfFloatType && extensions.get( 'OES_texture_half_float_linear' ) === null ) return; - - if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) { - - _gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) ); - properties.get( texture ).__currentAnisotropy = texture.anisotropy; - - } - - } - - } - - function uploadTexture( textureProperties, texture, slot ) { - - if ( textureProperties.__webglInit === undefined ) { - - textureProperties.__webglInit = true; - - texture.addEventListener( 'dispose', onTextureDispose ); - - textureProperties.__webglTexture = _gl.createTexture(); - - _infoMemory.textures ++; - - } - - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); - - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); - _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment ); - - var image = clampToMaxSize( texture.image, capabilities.maxTextureSize ); - - if ( textureNeedsPowerOfTwo( texture ) && isPowerOfTwo( image ) === false ) { - - image = makePowerOfTwo( image ); - - } - - var isPowerOfTwoImage = isPowerOfTwo( image ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); - - setTextureParameters( _gl.TEXTURE_2D, texture, isPowerOfTwoImage ); - - var mipmap, mipmaps = texture.mipmaps; - - if ( (texture && texture.isDepthTexture) ) { - - // populate depth texture with dummy data - - var internalFormat = _gl.DEPTH_COMPONENT; - - if ( texture.type === FloatType ) { - - if ( !_isWebGL2 ) throw new Error('Float Depth Texture only supported in WebGL2.0'); - internalFormat = _gl.DEPTH_COMPONENT32F; - - } else if ( _isWebGL2 ) { - - // WebGL 2.0 requires signed internalformat for glTexImage2D - internalFormat = _gl.DEPTH_COMPONENT16; - - } - - // Depth stencil textures need the DEPTH_STENCIL internal format - // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - if ( texture.format === DepthStencilFormat ) { - - internalFormat = _gl.DEPTH_STENCIL; - - } - - state.texImage2D( _gl.TEXTURE_2D, 0, internalFormat, image.width, image.height, 0, glFormat, glType, null ); - - } else if ( (texture && texture.isDataTexture) ) { - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isPowerOfTwoImage ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - state.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - texture.generateMipmaps = false; - - } else { - - state.texImage2D( _gl.TEXTURE_2D, 0, glFormat, image.width, image.height, 0, glFormat, glType, image.data ); - - } - - } else if ( (texture && texture.isCompressedTexture) ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - - if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) { - - if ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) { - - state.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - - } else { - - console.warn( "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()" ); - - } - - } else { - - state.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - - } - - } - - } else { - - // regular Texture (image, video, canvas) - - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isPowerOfTwoImage ) { - - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - - mipmap = mipmaps[ i ]; - state.texImage2D( _gl.TEXTURE_2D, i, glFormat, glFormat, glType, mipmap ); - - } - - texture.generateMipmaps = false; - - } else { - - state.texImage2D( _gl.TEXTURE_2D, 0, glFormat, glFormat, glType, image ); - - } - - } - - if ( texture.generateMipmaps && isPowerOfTwoImage ) _gl.generateMipmap( _gl.TEXTURE_2D ); - - textureProperties.__version = texture.version; - - if ( texture.onUpdate ) texture.onUpdate( texture ); - - } - - // Render targets - - // Setup storage for target texture and bind it to correct framebuffer - function setupFrameBufferTexture( framebuffer, renderTarget, attachment, textureTarget ) { - - var glFormat = paramThreeToGL( renderTarget.texture.format ); - var glType = paramThreeToGL( renderTarget.texture.type ); - state.texImage2D( textureTarget, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null ); - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( renderTarget.texture ).__webglTexture, 0 ); - _gl.bindFramebuffer( _gl.FRAMEBUFFER, null ); - - } - - // Setup storage for internal depth/stencil buffers and bind to correct framebuffer - function setupRenderBufferStorage( renderbuffer, renderTarget ) { - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer ); - - if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_COMPONENT16, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - - } else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) { - - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer ); - - } else { - - // FIXME: We don't support !depth !stencil - _gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.RGBA4, renderTarget.width, renderTarget.height ); - - } - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, null ); - - } - - // Setup resources for a Depth Texture for a FBO (needs an extension) - function setupDepthTexture( framebuffer, renderTarget ) { - - var isCube = ( (renderTarget && renderTarget.isWebGLRenderTargetCube) ); - if ( isCube ) throw new Error('Depth Texture with cube render targets is not supported!'); - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - - if ( !( (renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture) ) ) { - - throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture'); - - } - - // upload an empty depth texture with framebuffer size - if ( !properties.get( renderTarget.depthTexture ).__webglTexture || - renderTarget.depthTexture.image.width !== renderTarget.width || - renderTarget.depthTexture.image.height !== renderTarget.height ) { - renderTarget.depthTexture.image.width = renderTarget.width; - renderTarget.depthTexture.image.height = renderTarget.height; - renderTarget.depthTexture.needsUpdate = true; - } - - setTexture2D( renderTarget.depthTexture, 0 ); - - var webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture; - - if ( renderTarget.depthTexture.format === DepthFormat ) { - - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 ); - - } else if ( renderTarget.depthTexture.format === DepthStencilFormat ) { - - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 ); - - } else { - - throw new Error('Unknown depthTexture format') - - } - - } - - // Setup GL resources for a non-texture depth buffer - function setupDepthRenderbuffer( renderTarget ) { - - var renderTargetProperties = properties.get( renderTarget ); - - var isCube = ( (renderTarget && renderTarget.isWebGLRenderTargetCube) ); - - if ( renderTarget.depthTexture ) { - - if ( isCube ) throw new Error('target.depthTexture not supported in Cube render targets'); - - setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget ); - - } else { - - if ( isCube ) { - - renderTargetProperties.__webglDepthbuffer = []; - - for ( var i = 0; i < 6; i ++ ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] ); - renderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer(); - setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget ); - - } - - } else { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer ); - renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget ); - - } - - } - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, null ); - - } - - // Set up GL resources for the render target - function setupRenderTarget( renderTarget ) { - - var renderTargetProperties = properties.get( renderTarget ); - var textureProperties = properties.get( renderTarget.texture ); - - renderTarget.addEventListener( 'dispose', onRenderTargetDispose ); - - textureProperties.__webglTexture = _gl.createTexture(); - - _infoMemory.textures ++; - - var isCube = ( (renderTarget && renderTarget.isWebGLRenderTargetCube) ); - var isTargetPowerOfTwo = isPowerOfTwo( renderTarget ); - - // Setup framebuffer - - if ( isCube ) { - - renderTargetProperties.__webglFramebuffer = []; - - for ( var i = 0; i < 6; i ++ ) { - - renderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer(); - - } - - } else { - - renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer(); - - } - - // Setup color buffer - - if ( isCube ) { - - state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture ); - setTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget.texture, isTargetPowerOfTwo ); - - for ( var i = 0; i < 6; i ++ ) { - - setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i ); - - } - - if ( renderTarget.texture.generateMipmaps && isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - state.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); - - } else { - - state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); - setTextureParameters( _gl.TEXTURE_2D, renderTarget.texture, isTargetPowerOfTwo ); - setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D ); - - if ( renderTarget.texture.generateMipmaps && isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D ); - state.bindTexture( _gl.TEXTURE_2D, null ); - - } - - // Setup depth and stencil buffers - - if ( renderTarget.depthBuffer ) { - - setupDepthRenderbuffer( renderTarget ); - - } - - } - - function updateRenderTargetMipmap( renderTarget ) { - - var texture = renderTarget.texture; - - if ( texture.generateMipmaps && isPowerOfTwo( renderTarget ) && - texture.minFilter !== NearestFilter && - texture.minFilter !== LinearFilter ) { - - var target = (renderTarget && renderTarget.isWebGLRenderTargetCube) ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D; - var webglTexture = properties.get( texture ).__webglTexture; - - state.bindTexture( target, webglTexture ); - _gl.generateMipmap( target ); - state.bindTexture( target, null ); - - } - - } - - this.setTexture2D = setTexture2D; - this.setTextureCube = setTextureCube; - this.setTextureCubeDynamic = setTextureCubeDynamic; - this.setupRenderTarget = setupRenderTarget; - this.updateRenderTargetMipmap = updateRenderTargetMipmap; - - } - - /** - * @author fordacious / fordacious.github.io - */ - - function WebGLProperties() { - - var properties = {}; - - return { - - get: function ( object ) { - - var uuid = object.uuid; - var map = properties[ uuid ]; - - if ( map === undefined ) { - - map = {}; - properties[ uuid ] = map; - - } - - return map; - - }, - - delete: function ( object ) { - - delete properties[ object.uuid ]; - - }, - - clear: function () { - - properties = {}; - - } - - }; - - } - - function WebGLState( gl, extensions, paramThreeToGL ) { - - function ColorBuffer() { - - var locked = false; - - var color = new Vector4(); - var currentColorMask = null; - var currentColorClear = new Vector4(); - - return { - - setMask: function ( colorMask ) { - - if ( currentColorMask !== colorMask && ! locked ) { - - gl.colorMask( colorMask, colorMask, colorMask, colorMask ); - currentColorMask = colorMask; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( r, g, b, a ) { - - color.set( r, g, b, a ); - - if ( currentColorClear.equals( color ) === false ) { - - gl.clearColor( r, g, b, a ); - currentColorClear.copy( color ); - - } - - }, - - reset: function () { - - locked = false; - - currentColorMask = null; - currentColorClear.set( 0, 0, 0, 1 ); - - } - - }; - - } - - function DepthBuffer() { - - var locked = false; - - var currentDepthMask = null; - var currentDepthFunc = null; - var currentDepthClear = null; - - return { - - setTest: function ( depthTest ) { - - if ( depthTest ) { - - enable( gl.DEPTH_TEST ); - - } else { - - disable( gl.DEPTH_TEST ); - - } - - }, - - setMask: function ( depthMask ) { - - if ( currentDepthMask !== depthMask && ! locked ) { - - gl.depthMask( depthMask ); - currentDepthMask = depthMask; - - } - - }, - - setFunc: function ( depthFunc ) { - - if ( currentDepthFunc !== depthFunc ) { - - if ( depthFunc ) { - - switch ( depthFunc ) { - - case NeverDepth: - - gl.depthFunc( gl.NEVER ); - break; - - case AlwaysDepth: - - gl.depthFunc( gl.ALWAYS ); - break; - - case LessDepth: - - gl.depthFunc( gl.LESS ); - break; - - case LessEqualDepth: - - gl.depthFunc( gl.LEQUAL ); - break; - - case EqualDepth: - - gl.depthFunc( gl.EQUAL ); - break; - - case GreaterEqualDepth: - - gl.depthFunc( gl.GEQUAL ); - break; - - case GreaterDepth: - - gl.depthFunc( gl.GREATER ); - break; - - case NotEqualDepth: - - gl.depthFunc( gl.NOTEQUAL ); - break; - - default: - - gl.depthFunc( gl.LEQUAL ); - - } - - } else { - - gl.depthFunc( gl.LEQUAL ); - - } - - currentDepthFunc = depthFunc; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( depth ) { - - if ( currentDepthClear !== depth ) { - - gl.clearDepth( depth ); - currentDepthClear = depth; - - } - - }, - - reset: function () { - - locked = false; - - currentDepthMask = null; - currentDepthFunc = null; - currentDepthClear = null; - - } - - }; - - } - - function StencilBuffer() { - - var locked = false; - - var currentStencilMask = null; - var currentStencilFunc = null; - var currentStencilRef = null; - var currentStencilFuncMask = null; - var currentStencilFail = null; - var currentStencilZFail = null; - var currentStencilZPass = null; - var currentStencilClear = null; - - return { - - setTest: function ( stencilTest ) { - - if ( stencilTest ) { - - enable( gl.STENCIL_TEST ); - - } else { - - disable( gl.STENCIL_TEST ); - - } - - }, - - setMask: function ( stencilMask ) { - - if ( currentStencilMask !== stencilMask && ! locked ) { - - gl.stencilMask( stencilMask ); - currentStencilMask = stencilMask; - - } - - }, - - setFunc: function ( stencilFunc, stencilRef, stencilMask ) { - - if ( currentStencilFunc !== stencilFunc || - currentStencilRef !== stencilRef || - currentStencilFuncMask !== stencilMask ) { - - gl.stencilFunc( stencilFunc, stencilRef, stencilMask ); - - currentStencilFunc = stencilFunc; - currentStencilRef = stencilRef; - currentStencilFuncMask = stencilMask; - - } - - }, - - setOp: function ( stencilFail, stencilZFail, stencilZPass ) { - - if ( currentStencilFail !== stencilFail || - currentStencilZFail !== stencilZFail || - currentStencilZPass !== stencilZPass ) { - - gl.stencilOp( stencilFail, stencilZFail, stencilZPass ); - - currentStencilFail = stencilFail; - currentStencilZFail = stencilZFail; - currentStencilZPass = stencilZPass; - - } - - }, - - setLocked: function ( lock ) { - - locked = lock; - - }, - - setClear: function ( stencil ) { - - if ( currentStencilClear !== stencil ) { - - gl.clearStencil( stencil ); - currentStencilClear = stencil; - - } - - }, - - reset: function () { - - locked = false; - - currentStencilMask = null; - currentStencilFunc = null; - currentStencilRef = null; - currentStencilFuncMask = null; - currentStencilFail = null; - currentStencilZFail = null; - currentStencilZPass = null; - currentStencilClear = null; - - } - - }; - - } - - // - - var colorBuffer = new ColorBuffer(); - var depthBuffer = new DepthBuffer(); - var stencilBuffer = new StencilBuffer(); - - var maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS ); - var newAttributes = new Uint8Array( maxVertexAttributes ); - var enabledAttributes = new Uint8Array( maxVertexAttributes ); - var attributeDivisors = new Uint8Array( maxVertexAttributes ); - - var capabilities = {}; - - var compressedTextureFormats = null; - - var currentBlending = null; - var currentBlendEquation = null; - var currentBlendSrc = null; - var currentBlendDst = null; - var currentBlendEquationAlpha = null; - var currentBlendSrcAlpha = null; - var currentBlendDstAlpha = null; - var currentPremultipledAlpha = false; - - var currentFlipSided = null; - var currentCullFace = null; - - var currentLineWidth = null; - - var currentPolygonOffsetFactor = null; - var currentPolygonOffsetUnits = null; - - var currentScissorTest = null; - - var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS ); - - var currentTextureSlot = null; - var currentBoundTextures = {}; - - var currentScissor = new Vector4(); - var currentViewport = new Vector4(); - - function createTexture( type, target, count ) { - - var data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4. - var texture = gl.createTexture(); - - gl.bindTexture( type, texture ); - gl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - gl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); - - for ( var i = 0; i < count; i ++ ) { - - gl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data ); - - } - - return texture; - - } - - var emptyTextures = {}; - emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 ); - emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 ); - - // - - function init() { - - clearColor( 0, 0, 0, 1 ); - clearDepth( 1 ); - clearStencil( 0 ); - - enable( gl.DEPTH_TEST ); - setDepthFunc( LessEqualDepth ); - - setFlipSided( false ); - setCullFace( CullFaceBack ); - enable( gl.CULL_FACE ); - - enable( gl.BLEND ); - setBlending( NormalBlending ); - - } - - function initAttributes() { - - for ( var i = 0, l = newAttributes.length; i < l; i ++ ) { - - newAttributes[ i ] = 0; - - } - - } - - function enableAttribute( attribute ) { - - newAttributes[ attribute ] = 1; - - if ( enabledAttributes[ attribute ] === 0 ) { - - gl.enableVertexAttribArray( attribute ); - enabledAttributes[ attribute ] = 1; - - } - - if ( attributeDivisors[ attribute ] !== 0 ) { - - var extension = extensions.get( 'ANGLE_instanced_arrays' ); - - extension.vertexAttribDivisorANGLE( attribute, 0 ); - attributeDivisors[ attribute ] = 0; - - } - - } - - function enableAttributeAndDivisor( attribute, meshPerAttribute, extension ) { - - newAttributes[ attribute ] = 1; - - if ( enabledAttributes[ attribute ] === 0 ) { - - gl.enableVertexAttribArray( attribute ); - enabledAttributes[ attribute ] = 1; - - } - - if ( attributeDivisors[ attribute ] !== meshPerAttribute ) { - - extension.vertexAttribDivisorANGLE( attribute, meshPerAttribute ); - attributeDivisors[ attribute ] = meshPerAttribute; - - } - - } - - function disableUnusedAttributes() { - - for ( var i = 0, l = enabledAttributes.length; i !== l; ++ i ) { - - if ( enabledAttributes[ i ] !== newAttributes[ i ] ) { - - gl.disableVertexAttribArray( i ); - enabledAttributes[ i ] = 0; - - } - - } - - } - - function enable( id ) { - - if ( capabilities[ id ] !== true ) { - - gl.enable( id ); - capabilities[ id ] = true; - - } - - } - - function disable( id ) { - - if ( capabilities[ id ] !== false ) { - - gl.disable( id ); - capabilities[ id ] = false; - - } - - } - - function getCompressedTextureFormats() { - - if ( compressedTextureFormats === null ) { - - compressedTextureFormats = []; - - if ( extensions.get( 'WEBGL_compressed_texture_pvrtc' ) || - extensions.get( 'WEBGL_compressed_texture_s3tc' ) || - extensions.get( 'WEBGL_compressed_texture_etc1' ) ) { - - var formats = gl.getParameter( gl.COMPRESSED_TEXTURE_FORMATS ); - - for ( var i = 0; i < formats.length; i ++ ) { - - compressedTextureFormats.push( formats[ i ] ); - - } - - } - - } - - return compressedTextureFormats; - - } - - function setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) { - - if ( blending !== NoBlending ) { - - enable( gl.BLEND ); - - } else { - - disable( gl.BLEND ); - currentBlending = blending; // no blending, that is - return; - - } - - if ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) { - - if ( blending === AdditiveBlending ) { - - if ( premultipliedAlpha ) { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.ONE, gl.ONE, gl.ONE, gl.ONE ); - - } else { - - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.SRC_ALPHA, gl.ONE ); - - } - - } else if ( blending === SubtractiveBlending ) { - - if ( premultipliedAlpha ) { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.ZERO, gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_SRC_ALPHA ); - - } else { - - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.ZERO, gl.ONE_MINUS_SRC_COLOR ); - - } - - } else if ( blending === MultiplyBlending ) { - - if ( premultipliedAlpha ) { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA ); - - } else { - - gl.blendEquation( gl.FUNC_ADD ); - gl.blendFunc( gl.ZERO, gl.SRC_COLOR ); - - } - - } else { - - if ( premultipliedAlpha ) { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA ); - - } else { - - gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD ); - gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA ); - - } - - } - - currentBlending = blending; - currentPremultipledAlpha = premultipliedAlpha; - - } - - if ( blending === CustomBlending ) { - - blendEquationAlpha = blendEquationAlpha || blendEquation; - blendSrcAlpha = blendSrcAlpha || blendSrc; - blendDstAlpha = blendDstAlpha || blendDst; - - if ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) { - - gl.blendEquationSeparate( paramThreeToGL( blendEquation ), paramThreeToGL( blendEquationAlpha ) ); - - currentBlendEquation = blendEquation; - currentBlendEquationAlpha = blendEquationAlpha; - - } - - if ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) { - - gl.blendFuncSeparate( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ), paramThreeToGL( blendSrcAlpha ), paramThreeToGL( blendDstAlpha ) ); - - currentBlendSrc = blendSrc; - currentBlendDst = blendDst; - currentBlendSrcAlpha = blendSrcAlpha; - currentBlendDstAlpha = blendDstAlpha; - - } - - } else { - - currentBlendEquation = null; - currentBlendSrc = null; - currentBlendDst = null; - currentBlendEquationAlpha = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - - } - - } - - // TODO Deprecate - - function setColorWrite( colorWrite ) { - - colorBuffer.setMask( colorWrite ); - - } - - function setDepthTest( depthTest ) { - - depthBuffer.setTest( depthTest ); - - } - - function setDepthWrite( depthWrite ) { - - depthBuffer.setMask( depthWrite ); - - } - - function setDepthFunc( depthFunc ) { - - depthBuffer.setFunc( depthFunc ); - - } - - function setStencilTest( stencilTest ) { - - stencilBuffer.setTest( stencilTest ); - - } - - function setStencilWrite( stencilWrite ) { - - stencilBuffer.setMask( stencilWrite ); - - } - - function setStencilFunc( stencilFunc, stencilRef, stencilMask ) { - - stencilBuffer.setFunc( stencilFunc, stencilRef, stencilMask ); - - } - - function setStencilOp( stencilFail, stencilZFail, stencilZPass ) { - - stencilBuffer.setOp( stencilFail, stencilZFail, stencilZPass ); - - } - - // - - function setFlipSided( flipSided ) { - - if ( currentFlipSided !== flipSided ) { - - if ( flipSided ) { - - gl.frontFace( gl.CW ); - - } else { - - gl.frontFace( gl.CCW ); - - } - - currentFlipSided = flipSided; - - } - - } - - function setCullFace( cullFace ) { - - if ( cullFace !== CullFaceNone ) { - - enable( gl.CULL_FACE ); - - if ( cullFace !== currentCullFace ) { - - if ( cullFace === CullFaceBack ) { - - gl.cullFace( gl.BACK ); - - } else if ( cullFace === CullFaceFront ) { - - gl.cullFace( gl.FRONT ); - - } else { - - gl.cullFace( gl.FRONT_AND_BACK ); - - } - - } - - } else { - - disable( gl.CULL_FACE ); - - } - - currentCullFace = cullFace; - - } - - function setLineWidth( width ) { - - if ( width !== currentLineWidth ) { - - gl.lineWidth( width ); - - currentLineWidth = width; - - } - - } - - function setPolygonOffset( polygonOffset, factor, units ) { - - if ( polygonOffset ) { - - enable( gl.POLYGON_OFFSET_FILL ); - - if ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) { - - gl.polygonOffset( factor, units ); - - currentPolygonOffsetFactor = factor; - currentPolygonOffsetUnits = units; - - } - - } else { - - disable( gl.POLYGON_OFFSET_FILL ); - - } - - } - - function getScissorTest() { - - return currentScissorTest; - - } - - function setScissorTest( scissorTest ) { - - currentScissorTest = scissorTest; - - if ( scissorTest ) { - - enable( gl.SCISSOR_TEST ); - - } else { - - disable( gl.SCISSOR_TEST ); - - } - - } - - // texture - - function activeTexture( webglSlot ) { - - if ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1; - - if ( currentTextureSlot !== webglSlot ) { - - gl.activeTexture( webglSlot ); - currentTextureSlot = webglSlot; - - } - - } - - function bindTexture( webglType, webglTexture ) { - - if ( currentTextureSlot === null ) { - - activeTexture(); - - } - - var boundTexture = currentBoundTextures[ currentTextureSlot ]; - - if ( boundTexture === undefined ) { - - boundTexture = { type: undefined, texture: undefined }; - currentBoundTextures[ currentTextureSlot ] = boundTexture; - - } - - if ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) { - - gl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] ); - - boundTexture.type = webglType; - boundTexture.texture = webglTexture; - - } - - } - - function compressedTexImage2D() { - - try { - - gl.compressedTexImage2D.apply( gl, arguments ); - - } catch ( error ) { - - console.error( error ); - - } - - } - - function texImage2D() { - - try { - - gl.texImage2D.apply( gl, arguments ); - - } catch ( error ) { - - console.error( error ); - - } - - } - - // TODO Deprecate - - function clearColor( r, g, b, a ) { - - colorBuffer.setClear( r, g, b, a ); - - } - - function clearDepth( depth ) { - - depthBuffer.setClear( depth ); - - } - - function clearStencil( stencil ) { - - stencilBuffer.setClear( stencil ); - - } - - // - - function scissor( scissor ) { - - if ( currentScissor.equals( scissor ) === false ) { - - gl.scissor( scissor.x, scissor.y, scissor.z, scissor.w ); - currentScissor.copy( scissor ); - - } - - } - - function viewport( viewport ) { - - if ( currentViewport.equals( viewport ) === false ) { - - gl.viewport( viewport.x, viewport.y, viewport.z, viewport.w ); - currentViewport.copy( viewport ); - - } - - } - - // - - function reset() { - - for ( var i = 0; i < enabledAttributes.length; i ++ ) { - - if ( enabledAttributes[ i ] === 1 ) { - - gl.disableVertexAttribArray( i ); - enabledAttributes[ i ] = 0; - - } - - } - - capabilities = {}; - - compressedTextureFormats = null; - - currentTextureSlot = null; - currentBoundTextures = {}; - - currentBlending = null; - - currentFlipSided = null; - currentCullFace = null; - - colorBuffer.reset(); - depthBuffer.reset(); - stencilBuffer.reset(); - - } - - return { - - buffers: { - color: colorBuffer, - depth: depthBuffer, - stencil: stencilBuffer - }, - - init: init, - initAttributes: initAttributes, - enableAttribute: enableAttribute, - enableAttributeAndDivisor: enableAttributeAndDivisor, - disableUnusedAttributes: disableUnusedAttributes, - enable: enable, - disable: disable, - getCompressedTextureFormats: getCompressedTextureFormats, - - setBlending: setBlending, - - setColorWrite: setColorWrite, - setDepthTest: setDepthTest, - setDepthWrite: setDepthWrite, - setDepthFunc: setDepthFunc, - setStencilTest: setStencilTest, - setStencilWrite: setStencilWrite, - setStencilFunc: setStencilFunc, - setStencilOp: setStencilOp, - - setFlipSided: setFlipSided, - setCullFace: setCullFace, - - setLineWidth: setLineWidth, - setPolygonOffset: setPolygonOffset, - - getScissorTest: getScissorTest, - setScissorTest: setScissorTest, - - activeTexture: activeTexture, - bindTexture: bindTexture, - compressedTexImage2D: compressedTexImage2D, - texImage2D: texImage2D, - - clearColor: clearColor, - clearDepth: clearDepth, - clearStencil: clearStencil, - - scissor: scissor, - viewport: viewport, - - reset: reset - - }; - - } - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function WebGLCapabilities( gl, extensions, parameters ) { - - var maxAnisotropy; - - function getMaxAnisotropy() { - - if ( maxAnisotropy !== undefined ) return maxAnisotropy; - - var extension = extensions.get( 'EXT_texture_filter_anisotropic' ); - - if ( extension !== null ) { - - maxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT ); - - } else { - - maxAnisotropy = 0; - - } - - return maxAnisotropy; - - } - - function getMaxPrecision( precision ) { - - if ( precision === 'highp' ) { - - if ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 && - gl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) { - - return 'highp'; - - } - - precision = 'mediump'; - - } - - if ( precision === 'mediump' ) { - - if ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 && - gl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) { - - return 'mediump'; - - } - - } - - return 'lowp'; - - } - - var precision = parameters.precision !== undefined ? parameters.precision : 'highp'; - var maxPrecision = getMaxPrecision( precision ); - - if ( maxPrecision !== precision ) { - - console.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' ); - precision = maxPrecision; - - } - - var logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true && !! extensions.get( 'EXT_frag_depth' ); - - var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS ); - var maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ); - var maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE ); - var maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE ); - - var maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS ); - var maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS ); - var maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS ); - var maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS ); - - var vertexTextures = maxVertexTextures > 0; - var floatFragmentTextures = !! extensions.get( 'OES_texture_float' ); - var floatVertexTextures = vertexTextures && floatFragmentTextures; - - return { - - getMaxAnisotropy: getMaxAnisotropy, - getMaxPrecision: getMaxPrecision, - - precision: precision, - logarithmicDepthBuffer: logarithmicDepthBuffer, - - maxTextures: maxTextures, - maxVertexTextures: maxVertexTextures, - maxTextureSize: maxTextureSize, - maxCubemapSize: maxCubemapSize, - - maxAttributes: maxAttributes, - maxVertexUniforms: maxVertexUniforms, - maxVaryings: maxVaryings, - maxFragmentUniforms: maxFragmentUniforms, - - vertexTextures: vertexTextures, - floatFragmentTextures: floatFragmentTextures, - floatVertexTextures: floatVertexTextures - - }; - - } - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function WebGLExtensions( gl ) { - - var extensions = {}; - - return { - - get: function ( name ) { - - if ( extensions[ name ] !== undefined ) { - - return extensions[ name ]; - - } - - var extension; - - switch ( name ) { - - case 'WEBGL_depth_texture': - extension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' ); - break; - - case 'EXT_texture_filter_anisotropic': - extension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' ); - break; - - case 'WEBGL_compressed_texture_s3tc': - extension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' ); - break; - - case 'WEBGL_compressed_texture_pvrtc': - extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' ); - break; - - case 'WEBGL_compressed_texture_etc1': - extension = gl.getExtension( 'WEBGL_compressed_texture_etc1' ); - break; - - default: - extension = gl.getExtension( name ); - - } - - if ( extension === null ) { - - console.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' ); - - } - - extensions[ name ] = extension; - - return extension; - - } - - }; - - } - - function WebGLClipping() { - - var scope = this, - - globalState = null, - numGlobalPlanes = 0, - localClippingEnabled = false, - renderingShadows = false, - - plane = new Plane(), - viewNormalMatrix = new Matrix3(), - - uniform = { value: null, needsUpdate: false }; - - this.uniform = uniform; - this.numPlanes = 0; - - this.init = function( planes, enableLocalClipping, camera ) { - - var enabled = - planes.length !== 0 || - enableLocalClipping || - // enable state of previous frame - the clipping code has to - // run another frame in order to reset the state: - numGlobalPlanes !== 0 || - localClippingEnabled; - - localClippingEnabled = enableLocalClipping; - - globalState = projectPlanes( planes, camera, 0 ); - numGlobalPlanes = planes.length; - - return enabled; - - }; - - this.beginShadows = function() { - - renderingShadows = true; - projectPlanes( null ); - - }; - - this.endShadows = function() { - - renderingShadows = false; - resetGlobalState(); - - }; - - this.setState = function( planes, clipShadows, camera, cache, fromCache ) { - - if ( ! localClippingEnabled || - planes === null || planes.length === 0 || - renderingShadows && ! clipShadows ) { - // there's no local clipping - - if ( renderingShadows ) { - // there's no global clipping - - projectPlanes( null ); - - } else { - - resetGlobalState(); - } - - } else { - - var nGlobal = renderingShadows ? 0 : numGlobalPlanes, - lGlobal = nGlobal * 4, - - dstArray = cache.clippingState || null; - - uniform.value = dstArray; // ensure unique state - - dstArray = projectPlanes( planes, camera, lGlobal, fromCache ); - - for ( var i = 0; i !== lGlobal; ++ i ) { - - dstArray[ i ] = globalState[ i ]; - - } - - cache.clippingState = dstArray; - this.numPlanes += nGlobal; - - } - - - }; - - function resetGlobalState() { - - if ( uniform.value !== globalState ) { - - uniform.value = globalState; - uniform.needsUpdate = numGlobalPlanes > 0; - - } - - scope.numPlanes = numGlobalPlanes; - - } - - function projectPlanes( planes, camera, dstOffset, skipTransform ) { - - var nPlanes = planes !== null ? planes.length : 0, - dstArray = null; - - if ( nPlanes !== 0 ) { - - dstArray = uniform.value; - - if ( skipTransform !== true || dstArray === null ) { - - var flatSize = dstOffset + nPlanes * 4, - viewMatrix = camera.matrixWorldInverse; - - viewNormalMatrix.getNormalMatrix( viewMatrix ); - - if ( dstArray === null || dstArray.length < flatSize ) { - - dstArray = new Float32Array( flatSize ); - - } - - for ( var i = 0, i4 = dstOffset; - i !== nPlanes; ++ i, i4 += 4 ) { - - plane.copy( planes[ i ] ). - applyMatrix4( viewMatrix, viewNormalMatrix ); - - plane.normal.toArray( dstArray, i4 ); - dstArray[ i4 + 3 ] = plane.constant; - - } - - } - - uniform.value = dstArray; - uniform.needsUpdate = true; - - } - - scope.numPlanes = nPlanes; - return dstArray; - - } - - } - - /** - * @author supereggbert / http://www.paulbrunt.co.uk/ - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * @author szimek / https://github.com/szimek/ - * @author tschw - */ - - function WebGLRenderer( parameters ) { - - console.log( 'THREE.WebGLRenderer', REVISION ); - - parameters = parameters || {}; - - var _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ), - _context = parameters.context !== undefined ? parameters.context : null, - - _alpha = parameters.alpha !== undefined ? parameters.alpha : false, - _depth = parameters.depth !== undefined ? parameters.depth : true, - _stencil = parameters.stencil !== undefined ? parameters.stencil : true, - _antialias = parameters.antialias !== undefined ? parameters.antialias : false, - _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, - _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false; - - var lights = []; - - var opaqueObjects = []; - var opaqueObjectsLastIndex = - 1; - var transparentObjects = []; - var transparentObjectsLastIndex = - 1; - - var morphInfluences = new Float32Array( 8 ); - - var sprites = []; - var lensFlares = []; - - // public properties - - this.domElement = _canvas; - this.context = null; - - // clearing - - this.autoClear = true; - this.autoClearColor = true; - this.autoClearDepth = true; - this.autoClearStencil = true; - - // scene graph - - this.sortObjects = true; - - // user-defined clipping - - this.clippingPlanes = []; - this.localClippingEnabled = false; - - // physically based shading - - this.gammaFactor = 2.0; // for backwards compatibility - this.gammaInput = false; - this.gammaOutput = false; - - // physical lights - - this.physicallyCorrectLights = false; - - // tone mapping - - this.toneMapping = LinearToneMapping; - this.toneMappingExposure = 1.0; - this.toneMappingWhitePoint = 1.0; - - // morphs - - this.maxMorphTargets = 8; - this.maxMorphNormals = 4; - - // internal properties - - var _this = this, - - // internal state cache - - _currentProgram = null, - _currentRenderTarget = null, - _currentFramebuffer = null, - _currentMaterialId = - 1, - _currentGeometryProgram = '', - _currentCamera = null, - - _currentScissor = new Vector4(), - _currentScissorTest = null, - - _currentViewport = new Vector4(), - - // - - _usedTextureUnits = 0, - - // - - _clearColor = new Color( 0x000000 ), - _clearAlpha = 0, - - _width = _canvas.width, - _height = _canvas.height, - - _pixelRatio = 1, - - _scissor = new Vector4( 0, 0, _width, _height ), - _scissorTest = false, - - _viewport = new Vector4( 0, 0, _width, _height ), - - // frustum - - _frustum = new Frustum(), - - // clipping - - _clipping = new WebGLClipping(), - _clippingEnabled = false, - _localClippingEnabled = false, - - _sphere = new Sphere(), - - // camera matrices cache - - _projScreenMatrix = new Matrix4(), - - _vector3 = new Vector3(), - - // light arrays cache - - _lights = { - - hash: '', - - ambient: [ 0, 0, 0 ], - directional: [], - directionalShadowMap: [], - directionalShadowMatrix: [], - spot: [], - spotShadowMap: [], - spotShadowMatrix: [], - point: [], - pointShadowMap: [], - pointShadowMatrix: [], - hemi: [], - - shadows: [] - - }, - - // info - - _infoRender = { - - calls: 0, - vertices: 0, - faces: 0, - points: 0 - - }; - - this.info = { - - render: _infoRender, - memory: { - - geometries: 0, - textures: 0 - - }, - programs: null - - }; - - - // initialize - - var _gl; - - try { - - var attributes = { - alpha: _alpha, - depth: _depth, - stencil: _stencil, - antialias: _antialias, - premultipliedAlpha: _premultipliedAlpha, - preserveDrawingBuffer: _preserveDrawingBuffer - }; - //WebGLDebugUtils.makeDebugContext(_canvas.getContext("webgl")) - _gl = _context || _canvas.getContext( 'webgl', attributes ) || _canvas.getContext( 'experimental-webgl', attributes ); - - if ( _gl === null ) { - - if ( _canvas.getContext( 'webgl' ) !== null ) { - - throw 'Error creating WebGL context with your selected attributes.'; - - } else { - - throw 'Error creating WebGL context.'; - - } - - } - - // Some experimental-webgl implementations do not have getShaderPrecisionFormat - - if ( _gl.getShaderPrecisionFormat === undefined ) { - - _gl.getShaderPrecisionFormat = function () { - - return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 }; - - }; - - } - - _canvas.addEventListener( 'webglcontextlost', onContextLost, false ); - - } catch ( error ) { - - console.error( 'THREE.WebGLRenderer: ' + error ); - - } - - var extensions = new WebGLExtensions( _gl ); - - extensions.get( 'WEBGL_depth_texture' ); - extensions.get( 'OES_texture_float' ); - extensions.get( 'OES_texture_float_linear' ); - extensions.get( 'OES_texture_half_float' ); - extensions.get( 'OES_texture_half_float_linear' ); - extensions.get( 'OES_standard_derivatives' ); - extensions.get( 'ANGLE_instanced_arrays' ); - - if ( extensions.get( 'OES_element_index_uint' ) ) { - - BufferGeometry.MaxIndex = 4294967296; - - } - - var capabilities = new WebGLCapabilities( _gl, extensions, parameters ); - - var state = new WebGLState( _gl, extensions, paramThreeToGL ); - var properties = new WebGLProperties(); - var textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, paramThreeToGL, this.info ); - var objects = new WebGLObjects( _gl, properties, this.info ); - var programCache = new WebGLPrograms( this, capabilities ); - var lightCache = new WebGLLights(); - - this.info.programs = programCache.programs; - - var bufferRenderer = new WebGLBufferRenderer( _gl, extensions, _infoRender ); - var indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, _infoRender ); - - // - - var backgroundCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); - var backgroundCamera2 = new PerspectiveCamera(); - var backgroundPlaneMesh = new Mesh( - new PlaneBufferGeometry( 2, 2 ), - new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } ) - ); - var backgroundBoxShader = ShaderLib[ 'cube' ]; - var backgroundBoxMesh = new Mesh( - new BoxBufferGeometry( 5, 5, 5 ), - new ShaderMaterial( { - uniforms: backgroundBoxShader.uniforms, - vertexShader: backgroundBoxShader.vertexShader, - fragmentShader: backgroundBoxShader.fragmentShader, - side: BackSide, - depthTest: false, - depthWrite: false, - fog: false - } ) - ); - - // - - function getTargetPixelRatio() { - - return _currentRenderTarget === null ? _pixelRatio : 1; - - } - - function glClearColor( r, g, b, a ) { - - if ( _premultipliedAlpha === true ) { - - r *= a; g *= a; b *= a; - - } - - state.clearColor( r, g, b, a ); - - } - - function setDefaultGLState() { - - state.init(); - - state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ) ); - state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ) ); - - glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - } - - function resetGLState() { - - _currentProgram = null; - _currentCamera = null; - - _currentGeometryProgram = ''; - _currentMaterialId = - 1; - - state.reset(); - - } - - setDefaultGLState(); - - this.context = _gl; - this.capabilities = capabilities; - this.extensions = extensions; - this.properties = properties; - this.state = state; - - // shadow map - - var shadowMap = new WebGLShadowMap( this, _lights, objects, capabilities ); - - this.shadowMap = shadowMap; - - - // Plugins - - var spritePlugin = new SpritePlugin( this, sprites ); - var lensFlarePlugin = new LensFlarePlugin( this, lensFlares ); - - // API - - this.getContext = function () { - - return _gl; - - }; - - this.getContextAttributes = function () { - - return _gl.getContextAttributes(); - - }; - - this.forceContextLoss = function () { - - extensions.get( 'WEBGL_lose_context' ).loseContext(); - - }; - - this.getMaxAnisotropy = function () { - - return capabilities.getMaxAnisotropy(); - - }; - - this.getPrecision = function () { - - return capabilities.precision; - - }; - - this.getPixelRatio = function () { - - return _pixelRatio; - - }; - - this.setPixelRatio = function ( value ) { - - if ( value === undefined ) return; - - _pixelRatio = value; - - this.setSize( _viewport.z, _viewport.w, false ); - - }; - - this.getSize = function () { - - return { - width: _width, - height: _height - }; - - }; - - this.setSize = function ( width, height, updateStyle ) { - - _width = width; - _height = height; - - _canvas.width = width * _pixelRatio; - _canvas.height = height * _pixelRatio; - - if ( updateStyle !== false ) { - - _canvas.style.width = width + 'px'; - _canvas.style.height = height + 'px'; - - } - - this.setViewport( 0, 0, width, height ); - - }; - - this.setViewport = function ( x, y, width, height ) { - - state.viewport( _viewport.set( x, y, width, height ) ); - - }; - - this.setScissor = function ( x, y, width, height ) { - - state.scissor( _scissor.set( x, y, width, height ) ); - - }; - - this.setScissorTest = function ( boolean ) { - - state.setScissorTest( _scissorTest = boolean ); - - }; - - // Clearing - - this.getClearColor = function () { - - return _clearColor; - - }; - - this.setClearColor = function ( color, alpha ) { - - _clearColor.set( color ); - - _clearAlpha = alpha !== undefined ? alpha : 1; - - glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - }; - - this.getClearAlpha = function () { - - return _clearAlpha; - - }; - - this.setClearAlpha = function ( alpha ) { - - _clearAlpha = alpha; - - glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - }; - - this.clear = function ( color, depth, stencil ) { - - var bits = 0; - - if ( color === undefined || color ) bits |= _gl.COLOR_BUFFER_BIT; - if ( depth === undefined || depth ) bits |= _gl.DEPTH_BUFFER_BIT; - if ( stencil === undefined || stencil ) bits |= _gl.STENCIL_BUFFER_BIT; - - _gl.clear( bits ); - - }; - - this.clearColor = function () { - - this.clear( true, false, false ); - - }; - - this.clearDepth = function () { - - this.clear( false, true, false ); - - }; - - this.clearStencil = function () { - - this.clear( false, false, true ); - - }; - - this.clearTarget = function ( renderTarget, color, depth, stencil ) { - - this.setRenderTarget( renderTarget ); - this.clear( color, depth, stencil ); - - }; - - // Reset - - this.resetGLState = resetGLState; - - this.dispose = function() { - - transparentObjects = []; - transparentObjectsLastIndex = -1; - opaqueObjects = []; - opaqueObjectsLastIndex = -1; - - _canvas.removeEventListener( 'webglcontextlost', onContextLost, false ); - - }; - - // Events - - function onContextLost( event ) { - - event.preventDefault(); - - resetGLState(); - setDefaultGLState(); - - properties.clear(); - - } - - function onMaterialDispose( event ) { - - var material = event.target; - - material.removeEventListener( 'dispose', onMaterialDispose ); - - deallocateMaterial( material ); - - } - - // Buffer deallocation - - function deallocateMaterial( material ) { - - releaseMaterialProgramReference( material ); - - properties.delete( material ); - - } - - - function releaseMaterialProgramReference( material ) { - - var programInfo = properties.get( material ).program; - - material.program = undefined; - - if ( programInfo !== undefined ) { - - programCache.releaseProgram( programInfo ); - - } - - } - - // Buffer rendering - - this.renderBufferImmediate = function ( object, program, material ) { - - state.initAttributes(); - - var buffers = properties.get( object ); - - if ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer(); - if ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer(); - if ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer(); - if ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer(); - - var attributes = program.getAttributes(); - - if ( object.hasPositions ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.position ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( attributes.position ); - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasNormals ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.normal ); - - if ( ! material.isMeshPhongMaterial && - ! material.isMeshStandardMaterial && - material.shading === FlatShading ) { - - for ( var i = 0, l = object.count * 3; i < l; i += 9 ) { - - var array = object.normalArray; - - var nx = ( array[ i + 0 ] + array[ i + 3 ] + array[ i + 6 ] ) / 3; - var ny = ( array[ i + 1 ] + array[ i + 4 ] + array[ i + 7 ] ) / 3; - var nz = ( array[ i + 2 ] + array[ i + 5 ] + array[ i + 8 ] ) / 3; - - array[ i + 0 ] = nx; - array[ i + 1 ] = ny; - array[ i + 2 ] = nz; - - array[ i + 3 ] = nx; - array[ i + 4 ] = ny; - array[ i + 5 ] = nz; - - array[ i + 6 ] = nx; - array[ i + 7 ] = ny; - array[ i + 8 ] = nz; - - } - - } - - _gl.bufferData( _gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( attributes.normal ); - - _gl.vertexAttribPointer( attributes.normal, 3, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasUvs && material.map ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.uv ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( attributes.uv ); - - _gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 0, 0 ); - - } - - if ( object.hasColors && material.vertexColors !== NoColors ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.color ); - _gl.bufferData( _gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW ); - - state.enableAttribute( attributes.color ); - - _gl.vertexAttribPointer( attributes.color, 3, _gl.FLOAT, false, 0, 0 ); - - } - - state.disableUnusedAttributes(); - - _gl.drawArrays( _gl.TRIANGLES, 0, object.count ); - - object.count = 0; - - }; - - this.renderBufferDirect = function ( camera, fog, geometry, material, object, group ) { - - setMaterial( material ); - - var program = setProgram( camera, fog, material, object ); - - var updateBuffers = false; - var geometryProgram = geometry.id + '_' + program.id + '_' + material.wireframe; - - if ( geometryProgram !== _currentGeometryProgram ) { - - _currentGeometryProgram = geometryProgram; - updateBuffers = true; - - } - - // morph targets - - var morphTargetInfluences = object.morphTargetInfluences; - - if ( morphTargetInfluences !== undefined ) { - - var activeInfluences = []; - - for ( var i = 0, l = morphTargetInfluences.length; i < l; i ++ ) { - - var influence = morphTargetInfluences[ i ]; - activeInfluences.push( [ influence, i ] ); - - } - - activeInfluences.sort( absNumericalSort ); - - if ( activeInfluences.length > 8 ) { - - activeInfluences.length = 8; - - } - - var morphAttributes = geometry.morphAttributes; - - for ( var i = 0, l = activeInfluences.length; i < l; i ++ ) { - - var influence = activeInfluences[ i ]; - morphInfluences[ i ] = influence[ 0 ]; - - if ( influence[ 0 ] !== 0 ) { - - var index = influence[ 1 ]; - - if ( material.morphTargets === true && morphAttributes.position ) geometry.addAttribute( 'morphTarget' + i, morphAttributes.position[ index ] ); - if ( material.morphNormals === true && morphAttributes.normal ) geometry.addAttribute( 'morphNormal' + i, morphAttributes.normal[ index ] ); - - } else { - - if ( material.morphTargets === true ) geometry.removeAttribute( 'morphTarget' + i ); - if ( material.morphNormals === true ) geometry.removeAttribute( 'morphNormal' + i ); - - } - - } - - for ( var i = activeInfluences.length, il = morphInfluences.length; i < il; i ++ ) { - - morphInfluences[ i ] = 0.0; - - } - - program.getUniforms().setValue( - _gl, 'morphTargetInfluences', morphInfluences ); - - updateBuffers = true; - - } - - // - - var index = geometry.index; - var position = geometry.attributes.position; - var rangeFactor = 1; - - if ( material.wireframe === true ) { - - index = objects.getWireframeAttribute( geometry ); - rangeFactor = 2; - - } - - var renderer; - - if ( index !== null ) { - - renderer = indexedBufferRenderer; - renderer.setIndex( index ); - - } else { - - renderer = bufferRenderer; - - } - - if ( updateBuffers ) { - - setupVertexAttributes( material, program, geometry ); - - if ( index !== null ) { - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, objects.getAttributeBuffer( index ) ); - - } - - } - - // - - var dataCount = 0; - - if ( index !== null ) { - - dataCount = index.count; - - } else if ( position !== undefined ) { - - dataCount = position.count; - - } - - var rangeStart = geometry.drawRange.start * rangeFactor; - var rangeCount = geometry.drawRange.count * rangeFactor; - - var groupStart = group !== null ? group.start * rangeFactor : 0; - var groupCount = group !== null ? group.count * rangeFactor : Infinity; - - var drawStart = Math.max( rangeStart, groupStart ); - var drawEnd = Math.min( dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1; - - var drawCount = Math.max( 0, drawEnd - drawStart + 1 ); - - if ( drawCount === 0 ) return; - - // - - if ( object.isMesh ) { - - if ( material.wireframe === true ) { - - state.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() ); - renderer.setMode( _gl.LINES ); - - } else { - - switch ( object.drawMode ) { - - case TrianglesDrawMode: - renderer.setMode( _gl.TRIANGLES ); - break; - - case TriangleStripDrawMode: - renderer.setMode( _gl.TRIANGLE_STRIP ); - break; - - case TriangleFanDrawMode: - renderer.setMode( _gl.TRIANGLE_FAN ); - break; - - } - - } - - - } else if ( object.isLine ) { - - var lineWidth = material.linewidth; - - if ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material - - state.setLineWidth( lineWidth * getTargetPixelRatio() ); - - if ( object.isLineSegments ) { - - renderer.setMode( _gl.LINES ); - - } else { - - renderer.setMode( _gl.LINE_STRIP ); - - } - - } else if ( object.isPoints ) { - - renderer.setMode( _gl.POINTS ); - - } - - if ( geometry && geometry.isInstancedBufferGeometry ) { - - if ( geometry.maxInstancedCount > 0 ) { - - renderer.renderInstances( geometry, drawStart, drawCount ); - - } - - } else { - - renderer.render( drawStart, drawCount ); - - } - - }; - - function setupVertexAttributes( material, program, geometry, startIndex ) { - - var extension; - - if ( geometry && geometry.isInstancedBufferGeometry ) { - - extension = extensions.get( 'ANGLE_instanced_arrays' ); - - if ( extension === null ) { - - console.error( 'THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' ); - return; - - } - - } - - if ( startIndex === undefined ) startIndex = 0; - - state.initAttributes(); - - var geometryAttributes = geometry.attributes; - - var programAttributes = program.getAttributes(); - - var materialDefaultAttributeValues = material.defaultAttributeValues; - - for ( var name in programAttributes ) { - - var programAttribute = programAttributes[ name ]; - - if ( programAttribute >= 0 ) { - - var geometryAttribute = geometryAttributes[ name ]; - - if ( geometryAttribute !== undefined ) { - - var type = _gl.FLOAT; - var array = geometryAttribute.array; - var normalized = geometryAttribute.normalized; - - if ( array instanceof Float32Array ) { - - type = _gl.FLOAT; - - } else if ( array instanceof Float64Array ) { - - console.warn( "Unsupported data buffer format: Float64Array" ); - - } else if ( array instanceof Uint16Array ) { - - type = _gl.UNSIGNED_SHORT; - - } else if ( array instanceof Int16Array ) { - - type = _gl.SHORT; - - } else if ( array instanceof Uint32Array ) { - - type = _gl.UNSIGNED_INT; - - } else if ( array instanceof Int32Array ) { - - type = _gl.INT; - - } else if ( array instanceof Int8Array ) { - - type = _gl.BYTE; - - } else if ( array instanceof Uint8Array ) { - - type = _gl.UNSIGNED_BYTE; - - } - - var size = geometryAttribute.itemSize; - var buffer = objects.getAttributeBuffer( geometryAttribute ); - - if ( geometryAttribute && geometryAttribute.isInterleavedBufferAttribute ) { - - var data = geometryAttribute.data; - var stride = data.stride; - var offset = geometryAttribute.offset; - - if ( data && data.isInstancedInterleavedBuffer ) { - - state.enableAttributeAndDivisor( programAttribute, data.meshPerAttribute, extension ); - - if ( geometry.maxInstancedCount === undefined ) { - - geometry.maxInstancedCount = data.meshPerAttribute * data.count; - - } - - } else { - - state.enableAttribute( programAttribute ); - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffer ); - _gl.vertexAttribPointer( programAttribute, size, type, normalized, stride * data.array.BYTES_PER_ELEMENT, ( startIndex * stride + offset ) * data.array.BYTES_PER_ELEMENT ); - - } else { - - if ( geometryAttribute && geometryAttribute.isInstancedBufferAttribute ) { - - state.enableAttributeAndDivisor( programAttribute, geometryAttribute.meshPerAttribute, extension ); - - if ( geometry.maxInstancedCount === undefined ) { - - geometry.maxInstancedCount = geometryAttribute.meshPerAttribute * geometryAttribute.count; - - } - - } else { - - state.enableAttribute( programAttribute ); - - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, buffer ); - _gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * geometryAttribute.array.BYTES_PER_ELEMENT ); - - } - - } else if ( materialDefaultAttributeValues !== undefined ) { - - var value = materialDefaultAttributeValues[ name ]; - - if ( value !== undefined ) { - - switch ( value.length ) { - - case 2: - _gl.vertexAttrib2fv( programAttribute, value ); - break; - - case 3: - _gl.vertexAttrib3fv( programAttribute, value ); - break; - - case 4: - _gl.vertexAttrib4fv( programAttribute, value ); - break; - - default: - _gl.vertexAttrib1fv( programAttribute, value ); - - } - - } - - } - - } - - } - - state.disableUnusedAttributes(); - - } - - // Sorting - - function absNumericalSort( a, b ) { - - return Math.abs( b[ 0 ] ) - Math.abs( a[ 0 ] ); - - } - - function painterSortStable( a, b ) { - - if ( a.object.renderOrder !== b.object.renderOrder ) { - - return a.object.renderOrder - b.object.renderOrder; - - } else if ( a.material.program && b.material.program && a.material.program !== b.material.program ) { - - return a.material.program.id - b.material.program.id; - - } else if ( a.material.id !== b.material.id ) { - - return a.material.id - b.material.id; - - } else if ( a.z !== b.z ) { - - return a.z - b.z; - - } else { - - return a.id - b.id; - - } - - } - - function reversePainterSortStable( a, b ) { - - if ( a.object.renderOrder !== b.object.renderOrder ) { - - return a.object.renderOrder - b.object.renderOrder; - - } if ( a.z !== b.z ) { - - return b.z - a.z; - - } else { - - return a.id - b.id; - - } - - } - - // Rendering - - this.render = function ( scene, camera, renderTarget, forceClear ) { - - if ( camera !== undefined && camera.isCamera !== true ) { - - console.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' ); - return; - - } - - var fog = scene.fog; - - // reset caching for this frame - - _currentGeometryProgram = ''; - _currentMaterialId = - 1; - _currentCamera = null; - - // update scene graph - - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); - - // update camera matrices and frustum - - if ( camera.parent === null ) camera.updateMatrixWorld(); - - camera.matrixWorldInverse.getInverse( camera.matrixWorld ); - - _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - _frustum.setFromMatrix( _projScreenMatrix ); - - lights.length = 0; - - opaqueObjectsLastIndex = - 1; - transparentObjectsLastIndex = - 1; - - sprites.length = 0; - lensFlares.length = 0; - - _localClippingEnabled = this.localClippingEnabled; - _clippingEnabled = _clipping.init( this.clippingPlanes, _localClippingEnabled, camera ); - - projectObject( scene, camera ); - - opaqueObjects.length = opaqueObjectsLastIndex + 1; - transparentObjects.length = transparentObjectsLastIndex + 1; - - if ( _this.sortObjects === true ) { - - opaqueObjects.sort( painterSortStable ); - transparentObjects.sort( reversePainterSortStable ); - - } - - // - - if ( _clippingEnabled ) _clipping.beginShadows(); - - setupShadows( lights ); - - shadowMap.render( scene, camera ); - - setupLights( lights, camera ); - - if ( _clippingEnabled ) _clipping.endShadows(); - - // - - _infoRender.calls = 0; - _infoRender.vertices = 0; - _infoRender.faces = 0; - _infoRender.points = 0; - - if ( renderTarget === undefined ) { - - renderTarget = null; - - } - - this.setRenderTarget( renderTarget ); - - // - - var background = scene.background; - - if ( background === null ) { - - glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); - - } else if ( background && background.isColor ) { - - glClearColor( background.r, background.g, background.b, 1 ); - forceClear = true; - - } - - if ( this.autoClear || forceClear ) { - - this.clear( this.autoClearColor, this.autoClearDepth, this.autoClearStencil ); - - } - - if ( background && background.isCubeTexture ) { - - backgroundCamera2.projectionMatrix.copy( camera.projectionMatrix ); - - backgroundCamera2.matrixWorld.extractRotation( camera.matrixWorld ); - backgroundCamera2.matrixWorldInverse.getInverse( backgroundCamera2.matrixWorld ); - - backgroundBoxMesh.material.uniforms[ "tCube" ].value = background; - backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundCamera2.matrixWorldInverse, backgroundBoxMesh.matrixWorld ); - - objects.update( backgroundBoxMesh ); - - _this.renderBufferDirect( backgroundCamera2, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null ); - - } else if ( background && background.isTexture ) { - - backgroundPlaneMesh.material.map = background; - - objects.update( backgroundPlaneMesh ); - - _this.renderBufferDirect( backgroundCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null ); - - } - - // - - if ( scene.overrideMaterial ) { - - var overrideMaterial = scene.overrideMaterial; - - renderObjects( opaqueObjects, camera, fog, overrideMaterial ); - renderObjects( transparentObjects, camera, fog, overrideMaterial ); - - } else { - - // opaque pass (front-to-back order) - - state.setBlending( NoBlending ); - renderObjects( opaqueObjects, camera, fog ); - - // transparent pass (back-to-front order) - - renderObjects( transparentObjects, camera, fog ); - - } - - // custom render plugins (post pass) - - spritePlugin.render( scene, camera ); - lensFlarePlugin.render( scene, camera, _currentViewport ); - - // Generate mipmap if we're using any kind of mipmap filtering - - if ( renderTarget ) { - - textures.updateRenderTargetMipmap( renderTarget ); - - } - - // Ensure depth buffer writing is enabled so it can be cleared on next render - - state.setDepthTest( true ); - state.setDepthWrite( true ); - state.setColorWrite( true ); - - // _gl.finish(); - - }; - - function pushRenderItem( object, geometry, material, z, group ) { - - var array, index; - - // allocate the next position in the appropriate array - - if ( material.transparent ) { - - array = transparentObjects; - index = ++ transparentObjectsLastIndex; - - } else { - - array = opaqueObjects; - index = ++ opaqueObjectsLastIndex; - - } - - // recycle existing render item or grow the array - - var renderItem = array[ index ]; - - if ( renderItem !== undefined ) { - - renderItem.id = object.id; - renderItem.object = object; - renderItem.geometry = geometry; - renderItem.material = material; - renderItem.z = _vector3.z; - renderItem.group = group; - - } else { - - renderItem = { - id: object.id, - object: object, - geometry: geometry, - material: material, - z: _vector3.z, - group: group - }; - - // assert( index === array.length ); - array.push( renderItem ); - - } - - } - - // TODO Duplicated code (Frustum) - - function isObjectViewable( object ) { - - var geometry = object.geometry; - - if ( geometry.boundingSphere === null ) - geometry.computeBoundingSphere(); - - _sphere.copy( geometry.boundingSphere ). - applyMatrix4( object.matrixWorld ); - - return isSphereViewable( _sphere ); - - } - - function isSpriteViewable( sprite ) { - - _sphere.center.set( 0, 0, 0 ); - _sphere.radius = 0.7071067811865476; - _sphere.applyMatrix4( sprite.matrixWorld ); - - return isSphereViewable( _sphere ); - - } - - function isSphereViewable( sphere ) { - - if ( ! _frustum.intersectsSphere( sphere ) ) return false; - - var numPlanes = _clipping.numPlanes; - - if ( numPlanes === 0 ) return true; - - var planes = _this.clippingPlanes, - - center = sphere.center, - negRad = - sphere.radius, - i = 0; - - do { - - // out when deeper than radius in the negative halfspace - if ( planes[ i ].distanceToPoint( center ) < negRad ) return false; - - } while ( ++ i !== numPlanes ); - - return true; - - } - - function projectObject( object, camera ) { - - if ( object.visible === false ) return; - - var visible = ( object.layers.mask & camera.layers.mask ) !== 0; - - if ( visible ) { - - if ( object.isLight ) { - - lights.push( object ); - - } else if ( object.isSprite ) { - - if ( object.frustumCulled === false || isSpriteViewable( object ) === true ) { - - sprites.push( object ); - - } - - } else if ( object.isLensFlare ) { - - lensFlares.push( object ); - - } else if ( object.isImmediateRenderObject ) { - - if ( _this.sortObjects === true ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyProjection( _projScreenMatrix ); - - } - - pushRenderItem( object, null, object.material, _vector3.z, null ); - - } else if ( object.isMesh || object.isLine || object.isPoints ) { - - if ( object.isSkinnedMesh ) { - - object.skeleton.update(); - - } - - if ( object.frustumCulled === false || isObjectViewable( object ) === true ) { - - var material = object.material; - - if ( material.visible === true ) { - - if ( _this.sortObjects === true ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyProjection( _projScreenMatrix ); - - } - - var geometry = objects.update( object ); - - if ( material.isMultiMaterial ) { - - var groups = geometry.groups; - var materials = material.materials; - - for ( var i = 0, l = groups.length; i < l; i ++ ) { - - var group = groups[ i ]; - var groupMaterial = materials[ group.materialIndex ]; - - if ( groupMaterial.visible === true ) { - - pushRenderItem( object, geometry, groupMaterial, _vector3.z, group ); - - } - - } - - } else { - - pushRenderItem( object, geometry, material, _vector3.z, null ); - - } - - } - - } - - } - - } - - var children = object.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - projectObject( children[ i ], camera ); - - } - - } - - function renderObjects( renderList, camera, fog, overrideMaterial ) { - - for ( var i = 0, l = renderList.length; i < l; i ++ ) { - - var renderItem = renderList[ i ]; - - var object = renderItem.object; - var geometry = renderItem.geometry; - var material = overrideMaterial === undefined ? renderItem.material : overrideMaterial; - var group = renderItem.group; - - object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); - object.normalMatrix.getNormalMatrix( object.modelViewMatrix ); - - if ( object.isImmediateRenderObject ) { - - setMaterial( material ); - - var program = setProgram( camera, fog, material, object ); - - _currentGeometryProgram = ''; - - object.render( function ( object ) { - - _this.renderBufferImmediate( object, program, material ); - - } ); - - } else { - - if ( object.onBeforeRender !== null ) object.onBeforeRender(); - - _this.renderBufferDirect( camera, fog, geometry, material, object, group ); - - } - - } - - } - - function initMaterial( material, fog, object ) { - - var materialProperties = properties.get( material ); - - var parameters = programCache.getParameters( - material, _lights, fog, _clipping.numPlanes, object ); - - var code = programCache.getProgramCode( material, parameters ); - - var program = materialProperties.program; - var programChange = true; - - if ( program === undefined ) { - - // new material - material.addEventListener( 'dispose', onMaterialDispose ); - - } else if ( program.code !== code ) { - - // changed glsl or parameters - releaseMaterialProgramReference( material ); - - } else if ( parameters.shaderID !== undefined ) { - - // same glsl and uniform list - return; - - } else { - - // only rebuild uniform list - programChange = false; - - } - - if ( programChange ) { - - if ( parameters.shaderID ) { - - var shader = ShaderLib[ parameters.shaderID ]; - - materialProperties.__webglShader = { - name: material.type, - uniforms: exports.UniformsUtils.clone( shader.uniforms ), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader - }; - - } else { - - materialProperties.__webglShader = { - name: material.type, - uniforms: material.uniforms, - vertexShader: material.vertexShader, - fragmentShader: material.fragmentShader - }; - - } - - material.__webglShader = materialProperties.__webglShader; - - program = programCache.acquireProgram( material, parameters, code ); - - materialProperties.program = program; - material.program = program; - - } - - var attributes = program.getAttributes(); - - if ( material.morphTargets ) { - - material.numSupportedMorphTargets = 0; - - for ( var i = 0; i < _this.maxMorphTargets; i ++ ) { - - if ( attributes[ 'morphTarget' + i ] >= 0 ) { - - material.numSupportedMorphTargets ++; - - } - - } - - } - - if ( material.morphNormals ) { - - material.numSupportedMorphNormals = 0; - - for ( var i = 0; i < _this.maxMorphNormals; i ++ ) { - - if ( attributes[ 'morphNormal' + i ] >= 0 ) { - - material.numSupportedMorphNormals ++; - - } - - } - - } - - var uniforms = materialProperties.__webglShader.uniforms; - - if ( ! material.isShaderMaterial && - ! material.isRawShaderMaterial || - material.clipping === true ) { - - materialProperties.numClippingPlanes = _clipping.numPlanes; - uniforms.clippingPlanes = _clipping.uniform; - - } - - materialProperties.fog = fog; - - // store the light setup it was created for - - materialProperties.lightsHash = _lights.hash; - - if ( material.lights ) { - - // wire up the material to this renderer's lighting state - - uniforms.ambientLightColor.value = _lights.ambient; - uniforms.directionalLights.value = _lights.directional; - uniforms.spotLights.value = _lights.spot; - uniforms.pointLights.value = _lights.point; - uniforms.hemisphereLights.value = _lights.hemi; - - uniforms.directionalShadowMap.value = _lights.directionalShadowMap; - uniforms.directionalShadowMatrix.value = _lights.directionalShadowMatrix; - uniforms.spotShadowMap.value = _lights.spotShadowMap; - uniforms.spotShadowMatrix.value = _lights.spotShadowMatrix; - uniforms.pointShadowMap.value = _lights.pointShadowMap; - uniforms.pointShadowMatrix.value = _lights.pointShadowMatrix; - - } - - var progUniforms = materialProperties.program.getUniforms(), - uniformsList = - WebGLUniforms.seqWithValue( progUniforms.seq, uniforms ); - - materialProperties.uniformsList = uniformsList; - materialProperties.dynamicUniforms = - WebGLUniforms.splitDynamic( uniformsList, uniforms ); - - } - - function setMaterial( material ) { - - material.side === DoubleSide - ? state.disable( _gl.CULL_FACE ) - : state.enable( _gl.CULL_FACE ); - - state.setFlipSided( material.side === BackSide ); - - material.transparent === true - ? state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha ) - : state.setBlending( NoBlending ); - - state.setDepthFunc( material.depthFunc ); - state.setDepthTest( material.depthTest ); - state.setDepthWrite( material.depthWrite ); - state.setColorWrite( material.colorWrite ); - state.setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - - } - - function setProgram( camera, fog, material, object ) { - - _usedTextureUnits = 0; - - var materialProperties = properties.get( material ); - - if ( _clippingEnabled ) { - - if ( _localClippingEnabled || camera !== _currentCamera ) { - - var useCache = - camera === _currentCamera && - material.id === _currentMaterialId; - - // we might want to call this function with some ClippingGroup - // object instead of the material, once it becomes feasible - // (#8465, #8379) - _clipping.setState( - material.clippingPlanes, material.clipShadows, - camera, materialProperties, useCache ); - - } - - } - - if ( material.needsUpdate === false ) { - - if ( materialProperties.program === undefined ) { - - material.needsUpdate = true; - - } else if ( material.fog && materialProperties.fog !== fog ) { - - material.needsUpdate = true; - - } else if ( material.lights && materialProperties.lightsHash !== _lights.hash ) { - - material.needsUpdate = true; - - } else if ( materialProperties.numClippingPlanes !== undefined && - materialProperties.numClippingPlanes !== _clipping.numPlanes ) { - - material.needsUpdate = true; - - } - - } - - if ( material.needsUpdate ) { - - initMaterial( material, fog, object ); - material.needsUpdate = false; - - } - - var refreshProgram = false; - var refreshMaterial = false; - var refreshLights = false; - - var program = materialProperties.program, - p_uniforms = program.getUniforms(), - m_uniforms = materialProperties.__webglShader.uniforms; - - if ( program.id !== _currentProgram ) { - - _gl.useProgram( program.program ); - _currentProgram = program.id; - - refreshProgram = true; - refreshMaterial = true; - refreshLights = true; - - } - - if ( material.id !== _currentMaterialId ) { - - _currentMaterialId = material.id; - - refreshMaterial = true; - - } - - if ( refreshProgram || camera !== _currentCamera ) { - - p_uniforms.set( _gl, camera, 'projectionMatrix' ); - - if ( capabilities.logarithmicDepthBuffer ) { - - p_uniforms.setValue( _gl, 'logDepthBufFC', - 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) ); - - } - - - if ( camera !== _currentCamera ) { - - _currentCamera = camera; - - // lighting uniforms depend on the camera so enforce an update - // now, in case this material supports lights - or later, when - // the next material that does gets activated: - - refreshMaterial = true; // set to true on material change - refreshLights = true; // remains set until update done - - } - - // load material specific uniforms - // (shader material also gets them for the sake of genericity) - - if ( material.isShaderMaterial || - material.isMeshPhongMaterial || - material.isMeshStandardMaterial || - material.envMap ) { - - var uCamPos = p_uniforms.map.cameraPosition; - - if ( uCamPos !== undefined ) { - - uCamPos.setValue( _gl, - _vector3.setFromMatrixPosition( camera.matrixWorld ) ); - - } - - } - - if ( material.isMeshPhongMaterial || - material.isMeshLambertMaterial || - material.isMeshBasicMaterial || - material.isMeshStandardMaterial || - material.isShaderMaterial || - material.skinning ) { - - p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse ); - - } - - p_uniforms.set( _gl, _this, 'toneMappingExposure' ); - p_uniforms.set( _gl, _this, 'toneMappingWhitePoint' ); - - } - - // skinning uniforms must be set even if material didn't change - // auto-setting of texture unit for bone texture must go before other textures - // not sure why, but otherwise weird things happen - - if ( material.skinning ) { - - p_uniforms.setOptional( _gl, object, 'bindMatrix' ); - p_uniforms.setOptional( _gl, object, 'bindMatrixInverse' ); - - var skeleton = object.skeleton; - - if ( skeleton ) { - - if ( capabilities.floatVertexTextures && skeleton.useVertexTexture ) { - - p_uniforms.set( _gl, skeleton, 'boneTexture' ); - p_uniforms.set( _gl, skeleton, 'boneTextureWidth' ); - p_uniforms.set( _gl, skeleton, 'boneTextureHeight' ); - - } else { - - p_uniforms.setOptional( _gl, skeleton, 'boneMatrices' ); - - } - - } - - } - - if ( refreshMaterial ) { - - if ( material.lights ) { - - // the current material requires lighting info - - // note: all lighting uniforms are always set correctly - // they simply reference the renderer's state for their - // values - // - // use the current material's .needsUpdate flags to set - // the GL state when required - - markUniformsLightsNeedsUpdate( m_uniforms, refreshLights ); - - } - - // refresh uniforms common to several materials - - if ( fog && material.fog ) { - - refreshUniformsFog( m_uniforms, fog ); - - } - - if ( material.isMeshBasicMaterial || - material.isMeshLambertMaterial || - material.isMeshPhongMaterial || - material.isMeshStandardMaterial || - material.isMeshDepthMaterial ) { - - refreshUniformsCommon( m_uniforms, material ); - - } - - // refresh single material specific uniforms - - if ( material.isLineBasicMaterial ) { - - refreshUniformsLine( m_uniforms, material ); - - } else if ( material.isLineDashedMaterial ) { - - refreshUniformsLine( m_uniforms, material ); - refreshUniformsDash( m_uniforms, material ); - - } else if ( material.isPointsMaterial ) { - - refreshUniformsPoints( m_uniforms, material ); - - } else if ( material.isMeshLambertMaterial ) { - - refreshUniformsLambert( m_uniforms, material ); - - } else if ( material.isMeshPhongMaterial ) { - - refreshUniformsPhong( m_uniforms, material ); - - } else if ( material.isMeshPhysicalMaterial ) { - - refreshUniformsPhysical( m_uniforms, material ); - - } else if ( material.isMeshStandardMaterial ) { - - refreshUniformsStandard( m_uniforms, material ); - - } else if ( material.isMeshDepthMaterial ) { - - if ( material.displacementMap ) { - - m_uniforms.displacementMap.value = material.displacementMap; - m_uniforms.displacementScale.value = material.displacementScale; - m_uniforms.displacementBias.value = material.displacementBias; - - } - - } else if ( material.isMeshNormalMaterial ) { - - m_uniforms.opacity.value = material.opacity; - - } - - WebGLUniforms.upload( - _gl, materialProperties.uniformsList, m_uniforms, _this ); - - } - - - // common matrices - - p_uniforms.set( _gl, object, 'modelViewMatrix' ); - p_uniforms.set( _gl, object, 'normalMatrix' ); - p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld ); - - - // dynamic uniforms - - var dynUniforms = materialProperties.dynamicUniforms; - - if ( dynUniforms !== null ) { - - WebGLUniforms.evalDynamic( dynUniforms, m_uniforms, object, material, camera ); - WebGLUniforms.upload( _gl, dynUniforms, m_uniforms, _this ); - - } - - return program; - - } - - // Uniforms (refresh uniforms objects) - - function refreshUniformsCommon( uniforms, material ) { - - uniforms.opacity.value = material.opacity; - - uniforms.diffuse.value = material.color; - - if ( material.emissive ) { - - uniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity ); - - } - - uniforms.map.value = material.map; - uniforms.specularMap.value = material.specularMap; - uniforms.alphaMap.value = material.alphaMap; - - if ( material.aoMap ) { - - uniforms.aoMap.value = material.aoMap; - uniforms.aoMapIntensity.value = material.aoMapIntensity; - - } - - // uv repeat and offset setting priorities - // 1. color map - // 2. specular map - // 3. normal map - // 4. bump map - // 5. alpha map - // 6. emissive map - - var uvScaleMap; - - if ( material.map ) { - - uvScaleMap = material.map; - - } else if ( material.specularMap ) { - - uvScaleMap = material.specularMap; - - } else if ( material.displacementMap ) { - - uvScaleMap = material.displacementMap; - - } else if ( material.normalMap ) { - - uvScaleMap = material.normalMap; - - } else if ( material.bumpMap ) { - - uvScaleMap = material.bumpMap; - - } else if ( material.roughnessMap ) { - - uvScaleMap = material.roughnessMap; - - } else if ( material.metalnessMap ) { - - uvScaleMap = material.metalnessMap; - - } else if ( material.alphaMap ) { - - uvScaleMap = material.alphaMap; - - } else if ( material.emissiveMap ) { - - uvScaleMap = material.emissiveMap; - - } - - if ( uvScaleMap !== undefined ) { - - // backwards compatibility - if ( uvScaleMap.isWebGLRenderTarget ) { - - uvScaleMap = uvScaleMap.texture; - - } - - var offset = uvScaleMap.offset; - var repeat = uvScaleMap.repeat; - - uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y ); - - } - - uniforms.envMap.value = material.envMap; - - // don't flip CubeTexture envMaps, flip everything else: - // WebGLRenderTargetCube will be flipped for backwards compatibility - // WebGLRenderTargetCube.texture will be flipped because it's a Texture and NOT a CubeTexture - // this check must be handled differently, or removed entirely, if WebGLRenderTargetCube uses a CubeTexture in the future - uniforms.flipEnvMap.value = ( ! ( material.envMap && material.envMap.isCubeTexture ) ) ? 1 : - 1; - - uniforms.reflectivity.value = material.reflectivity; - uniforms.refractionRatio.value = material.refractionRatio; - - } - - function refreshUniformsLine( uniforms, material ) { - - uniforms.diffuse.value = material.color; - uniforms.opacity.value = material.opacity; - - } - - function refreshUniformsDash( uniforms, material ) { - - uniforms.dashSize.value = material.dashSize; - uniforms.totalSize.value = material.dashSize + material.gapSize; - uniforms.scale.value = material.scale; - - } - - function refreshUniformsPoints( uniforms, material ) { - - uniforms.diffuse.value = material.color; - uniforms.opacity.value = material.opacity; - uniforms.size.value = material.size * _pixelRatio; - uniforms.scale.value = _canvas.clientHeight * 0.5; - - uniforms.map.value = material.map; - - if ( material.map !== null ) { - - var offset = material.map.offset; - var repeat = material.map.repeat; - - uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y ); - - } - - } - - function refreshUniformsFog( uniforms, fog ) { - - uniforms.fogColor.value = fog.color; - - if ( fog.isFog ) { - - uniforms.fogNear.value = fog.near; - uniforms.fogFar.value = fog.far; - - } else if ( fog.isFogExp2 ) { - - uniforms.fogDensity.value = fog.density; - - } - - } - - function refreshUniformsLambert( uniforms, material ) { - - if ( material.lightMap ) { - - uniforms.lightMap.value = material.lightMap; - uniforms.lightMapIntensity.value = material.lightMapIntensity; - - } - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - } - - function refreshUniformsPhong( uniforms, material ) { - - uniforms.specular.value = material.specular; - uniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 ) - - if ( material.lightMap ) { - - uniforms.lightMap.value = material.lightMap; - uniforms.lightMapIntensity.value = material.lightMapIntensity; - - } - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - } - - function refreshUniformsStandard( uniforms, material ) { - - uniforms.roughness.value = material.roughness; - uniforms.metalness.value = material.metalness; - - if ( material.roughnessMap ) { - - uniforms.roughnessMap.value = material.roughnessMap; - - } - - if ( material.metalnessMap ) { - - uniforms.metalnessMap.value = material.metalnessMap; - - } - - if ( material.lightMap ) { - - uniforms.lightMap.value = material.lightMap; - uniforms.lightMapIntensity.value = material.lightMapIntensity; - - } - - if ( material.emissiveMap ) { - - uniforms.emissiveMap.value = material.emissiveMap; - - } - - if ( material.bumpMap ) { - - uniforms.bumpMap.value = material.bumpMap; - uniforms.bumpScale.value = material.bumpScale; - - } - - if ( material.normalMap ) { - - uniforms.normalMap.value = material.normalMap; - uniforms.normalScale.value.copy( material.normalScale ); - - } - - if ( material.displacementMap ) { - - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - - } - - if ( material.envMap ) { - - //uniforms.envMap.value = material.envMap; // part of uniforms common - uniforms.envMapIntensity.value = material.envMapIntensity; - - } - - } - - function refreshUniformsPhysical( uniforms, material ) { - - uniforms.clearCoat.value = material.clearCoat; - uniforms.clearCoatRoughness.value = material.clearCoatRoughness; - - refreshUniformsStandard( uniforms, material ); - - } - - // If uniforms are marked as clean, they don't need to be loaded to the GPU. - - function markUniformsLightsNeedsUpdate( uniforms, value ) { - - uniforms.ambientLightColor.needsUpdate = value; - - uniforms.directionalLights.needsUpdate = value; - uniforms.pointLights.needsUpdate = value; - uniforms.spotLights.needsUpdate = value; - uniforms.hemisphereLights.needsUpdate = value; - - } - - // Lighting - - function setupShadows( lights ) { - - var lightShadowsLength = 0; - - for ( var i = 0, l = lights.length; i < l; i ++ ) { - - var light = lights[ i ]; - - if ( light.castShadow ) { - - _lights.shadows[ lightShadowsLength ++ ] = light; - - } - - } - - _lights.shadows.length = lightShadowsLength; - - } - - function setupLights( lights, camera ) { - - var l, ll, light, - r = 0, g = 0, b = 0, - color, - intensity, - distance, - shadowMap, - - viewMatrix = camera.matrixWorldInverse, - - directionalLength = 0, - pointLength = 0, - spotLength = 0, - hemiLength = 0; - - for ( l = 0, ll = lights.length; l < ll; l ++ ) { - - light = lights[ l ]; - - color = light.color; - intensity = light.intensity; - distance = light.distance; - - shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null; - - if ( light.isAmbientLight ) { - - r += color.r * intensity; - g += color.g * intensity; - b += color.b * intensity; - - } else if ( light.isDirectionalLight ) { - - var uniforms = lightCache.get( light ); - - uniforms.color.copy( light.color ).multiplyScalar( light.intensity ); - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - _vector3.setFromMatrixPosition( light.target.matrixWorld ); - uniforms.direction.sub( _vector3 ); - uniforms.direction.transformDirection( viewMatrix ); - - uniforms.shadow = light.castShadow; - - if ( light.castShadow ) { - - uniforms.shadowBias = light.shadow.bias; - uniforms.shadowRadius = light.shadow.radius; - uniforms.shadowMapSize = light.shadow.mapSize; - - } - - _lights.directionalShadowMap[ directionalLength ] = shadowMap; - _lights.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix; - _lights.directional[ directionalLength ++ ] = uniforms; - - } else if ( light.isSpotLight ) { - - var uniforms = lightCache.get( light ); - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - uniforms.position.applyMatrix4( viewMatrix ); - - uniforms.color.copy( color ).multiplyScalar( intensity ); - uniforms.distance = distance; - - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - _vector3.setFromMatrixPosition( light.target.matrixWorld ); - uniforms.direction.sub( _vector3 ); - uniforms.direction.transformDirection( viewMatrix ); - - uniforms.coneCos = Math.cos( light.angle ); - uniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) ); - uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay; - - uniforms.shadow = light.castShadow; - - if ( light.castShadow ) { - - uniforms.shadowBias = light.shadow.bias; - uniforms.shadowRadius = light.shadow.radius; - uniforms.shadowMapSize = light.shadow.mapSize; - - } - - _lights.spotShadowMap[ spotLength ] = shadowMap; - _lights.spotShadowMatrix[ spotLength ] = light.shadow.matrix; - _lights.spot[ spotLength ++ ] = uniforms; - - } else if ( light.isPointLight ) { - - var uniforms = lightCache.get( light ); - - uniforms.position.setFromMatrixPosition( light.matrixWorld ); - uniforms.position.applyMatrix4( viewMatrix ); - - uniforms.color.copy( light.color ).multiplyScalar( light.intensity ); - uniforms.distance = light.distance; - uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay; - - uniforms.shadow = light.castShadow; - - if ( light.castShadow ) { - - uniforms.shadowBias = light.shadow.bias; - uniforms.shadowRadius = light.shadow.radius; - uniforms.shadowMapSize = light.shadow.mapSize; - - } - - _lights.pointShadowMap[ pointLength ] = shadowMap; - - if ( _lights.pointShadowMatrix[ pointLength ] === undefined ) { - - _lights.pointShadowMatrix[ pointLength ] = new Matrix4(); - - } - - // for point lights we set the shadow matrix to be a translation-only matrix - // equal to inverse of the light's position - _vector3.setFromMatrixPosition( light.matrixWorld ).negate(); - _lights.pointShadowMatrix[ pointLength ].identity().setPosition( _vector3 ); - - _lights.point[ pointLength ++ ] = uniforms; - - } else if ( light.isHemisphereLight ) { - - var uniforms = lightCache.get( light ); - - uniforms.direction.setFromMatrixPosition( light.matrixWorld ); - uniforms.direction.transformDirection( viewMatrix ); - uniforms.direction.normalize(); - - uniforms.skyColor.copy( light.color ).multiplyScalar( intensity ); - uniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity ); - - _lights.hemi[ hemiLength ++ ] = uniforms; - - } - - } - - _lights.ambient[ 0 ] = r; - _lights.ambient[ 1 ] = g; - _lights.ambient[ 2 ] = b; - - _lights.directional.length = directionalLength; - _lights.spot.length = spotLength; - _lights.point.length = pointLength; - _lights.hemi.length = hemiLength; - - _lights.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + hemiLength + ',' + _lights.shadows.length; - - } - - // GL state setting - - this.setFaceCulling = function ( cullFace, frontFaceDirection ) { - - state.setCullFace( cullFace ); - state.setFlipSided( frontFaceDirection === FrontFaceDirectionCW ); - - }; - - // Textures - - function allocTextureUnit() { - - var textureUnit = _usedTextureUnits; - - if ( textureUnit >= capabilities.maxTextures ) { - - console.warn( 'WebGLRenderer: trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures ); - - } - - _usedTextureUnits += 1; - - return textureUnit; - - } - - this.allocTextureUnit = allocTextureUnit; - - // this.setTexture2D = setTexture2D; - this.setTexture2D = ( function() { - - var warned = false; - - // backwards compatibility: peel texture.texture - return function setTexture2D( texture, slot ) { - - if ( texture && texture.isWebGLRenderTarget ) { - - if ( ! warned ) { - - console.warn( "THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead." ); - warned = true; - - } - - texture = texture.texture; - - } - - textures.setTexture2D( texture, slot ); - - }; - - }() ); - - this.setTexture = ( function() { - - var warned = false; - - return function setTexture( texture, slot ) { - - if ( ! warned ) { - - console.warn( "THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead." ); - warned = true; - - } - - textures.setTexture2D( texture, slot ); - - }; - - }() ); - - this.setTextureCube = ( function() { - - var warned = false; - - return function setTextureCube( texture, slot ) { - - // backwards compatibility: peel texture.texture - if ( texture && texture.isWebGLRenderTargetCube ) { - - if ( ! warned ) { - - console.warn( "THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead." ); - warned = true; - - } - - texture = texture.texture; - - } - - // currently relying on the fact that WebGLRenderTargetCube.texture is a Texture and NOT a CubeTexture - // TODO: unify these code paths - if ( ( texture && texture.isCubeTexture ) || - ( Array.isArray( texture.image ) && texture.image.length === 6 ) ) { - - // CompressedTexture can have Array in image :/ - - // this function alone should take care of cube textures - textures.setTextureCube( texture, slot ); - - } else { - - // assumed: texture property of THREE.WebGLRenderTargetCube - - textures.setTextureCubeDynamic( texture, slot ); - - } - - }; - - }() ); - - this.getCurrentRenderTarget = function() { - - return _currentRenderTarget; - - }; - - this.setRenderTarget = function ( renderTarget ) { - - _currentRenderTarget = renderTarget; - - if ( renderTarget && properties.get( renderTarget ).__webglFramebuffer === undefined ) { - - textures.setupRenderTarget( renderTarget ); - - } - - var isCube = ( renderTarget && renderTarget.isWebGLRenderTargetCube ); - var framebuffer; - - if ( renderTarget ) { - - var renderTargetProperties = properties.get( renderTarget ); - - if ( isCube ) { - - framebuffer = renderTargetProperties.__webglFramebuffer[ renderTarget.activeCubeFace ]; - - } else { - - framebuffer = renderTargetProperties.__webglFramebuffer; - - } - - _currentScissor.copy( renderTarget.scissor ); - _currentScissorTest = renderTarget.scissorTest; - - _currentViewport.copy( renderTarget.viewport ); - - } else { - - framebuffer = null; - - _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ); - _currentScissorTest = _scissorTest; - - _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ); - - } - - if ( _currentFramebuffer !== framebuffer ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - _currentFramebuffer = framebuffer; - - } - - state.scissor( _currentScissor ); - state.setScissorTest( _currentScissorTest ); - - state.viewport( _currentViewport ); - - if ( isCube ) { - - var textureProperties = properties.get( renderTarget.texture ); - _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + renderTarget.activeCubeFace, textureProperties.__webglTexture, renderTarget.activeMipMapLevel ); - - } - - }; - - this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer ) { - - if ( ( renderTarget && renderTarget.isWebGLRenderTarget ) === false ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' ); - return; - - } - - var framebuffer = properties.get( renderTarget ).__webglFramebuffer; - - if ( framebuffer ) { - - var restore = false; - - if ( framebuffer !== _currentFramebuffer ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - - restore = true; - - } - - try { - - var texture = renderTarget.texture; - var textureFormat = texture.format; - var textureType = texture.type; - - if ( textureFormat !== RGBAFormat && paramThreeToGL( textureFormat ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' ); - return; - - } - - if ( textureType !== UnsignedByteType && paramThreeToGL( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // IE11, Edge and Chrome Mac < 52 (#9513) - ! ( textureType === FloatType && ( extensions.get( 'OES_texture_float' ) || extensions.get( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox - ! ( textureType === HalfFloatType && extensions.get( 'EXT_color_buffer_half_float' ) ) ) { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' ); - return; - - } - - if ( _gl.checkFramebufferStatus( _gl.FRAMEBUFFER ) === _gl.FRAMEBUFFER_COMPLETE ) { - - // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604) - - if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) { - - _gl.readPixels( x, y, width, height, paramThreeToGL( textureFormat ), paramThreeToGL( textureType ), buffer ); - - } - - } else { - - console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' ); - - } - - } finally { - - if ( restore ) { - - _gl.bindFramebuffer( _gl.FRAMEBUFFER, _currentFramebuffer ); - - } - - } - - } - - }; - - // Map three.js constants to WebGL constants - - function paramThreeToGL( p ) { - - var extension; - - if ( p === RepeatWrapping ) return _gl.REPEAT; - if ( p === ClampToEdgeWrapping ) return _gl.CLAMP_TO_EDGE; - if ( p === MirroredRepeatWrapping ) return _gl.MIRRORED_REPEAT; - - if ( p === NearestFilter ) return _gl.NEAREST; - if ( p === NearestMipMapNearestFilter ) return _gl.NEAREST_MIPMAP_NEAREST; - if ( p === NearestMipMapLinearFilter ) return _gl.NEAREST_MIPMAP_LINEAR; - - if ( p === LinearFilter ) return _gl.LINEAR; - if ( p === LinearMipMapNearestFilter ) return _gl.LINEAR_MIPMAP_NEAREST; - if ( p === LinearMipMapLinearFilter ) return _gl.LINEAR_MIPMAP_LINEAR; - - if ( p === UnsignedByteType ) return _gl.UNSIGNED_BYTE; - if ( p === UnsignedShort4444Type ) return _gl.UNSIGNED_SHORT_4_4_4_4; - if ( p === UnsignedShort5551Type ) return _gl.UNSIGNED_SHORT_5_5_5_1; - if ( p === UnsignedShort565Type ) return _gl.UNSIGNED_SHORT_5_6_5; - - if ( p === ByteType ) return _gl.BYTE; - if ( p === ShortType ) return _gl.SHORT; - if ( p === UnsignedShortType ) return _gl.UNSIGNED_SHORT; - if ( p === IntType ) return _gl.INT; - if ( p === UnsignedIntType ) return _gl.UNSIGNED_INT; - if ( p === FloatType ) return _gl.FLOAT; - - extension = extensions.get( 'OES_texture_half_float' ); - - if ( extension !== null ) { - - if ( p === HalfFloatType ) return extension.HALF_FLOAT_OES; - - } - - if ( p === AlphaFormat ) return _gl.ALPHA; - if ( p === RGBFormat ) return _gl.RGB; - if ( p === RGBAFormat ) return _gl.RGBA; - if ( p === LuminanceFormat ) return _gl.LUMINANCE; - if ( p === LuminanceAlphaFormat ) return _gl.LUMINANCE_ALPHA; - if ( p === DepthFormat ) return _gl.DEPTH_COMPONENT; - if ( p === DepthStencilFormat ) return _gl.DEPTH_STENCIL; - - if ( p === AddEquation ) return _gl.FUNC_ADD; - if ( p === SubtractEquation ) return _gl.FUNC_SUBTRACT; - if ( p === ReverseSubtractEquation ) return _gl.FUNC_REVERSE_SUBTRACT; - - if ( p === ZeroFactor ) return _gl.ZERO; - if ( p === OneFactor ) return _gl.ONE; - if ( p === SrcColorFactor ) return _gl.SRC_COLOR; - if ( p === OneMinusSrcColorFactor ) return _gl.ONE_MINUS_SRC_COLOR; - if ( p === SrcAlphaFactor ) return _gl.SRC_ALPHA; - if ( p === OneMinusSrcAlphaFactor ) return _gl.ONE_MINUS_SRC_ALPHA; - if ( p === DstAlphaFactor ) return _gl.DST_ALPHA; - if ( p === OneMinusDstAlphaFactor ) return _gl.ONE_MINUS_DST_ALPHA; - - if ( p === DstColorFactor ) return _gl.DST_COLOR; - if ( p === OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR; - if ( p === SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE; - - extension = extensions.get( 'WEBGL_compressed_texture_s3tc' ); - - if ( extension !== null ) { - - if ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; - if ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT; - - } - - extension = extensions.get( 'WEBGL_compressed_texture_pvrtc' ); - - if ( extension !== null ) { - - if ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - - } - - extension = extensions.get( 'WEBGL_compressed_texture_etc1' ); - - if ( extension !== null ) { - - if ( p === RGB_ETC1_Format ) return extension.COMPRESSED_RGB_ETC1_WEBGL; - - } - - extension = extensions.get( 'EXT_blend_minmax' ); - - if ( extension !== null ) { - - if ( p === MinEquation ) return extension.MIN_EXT; - if ( p === MaxEquation ) return extension.MAX_EXT; - - } - - extension = extensions.get( 'WEBGL_depth_texture' ); - - if ( extension !== null ){ - - if ( p === UnsignedInt248Type ) return extension.UNSIGNED_INT_24_8_WEBGL; - - } - - return 0; - - } - - } - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function FogExp2 ( color, density ) { - - this.name = ''; - - this.color = new Color( color ); - this.density = ( density !== undefined ) ? density : 0.00025; - - } - - FogExp2.prototype.isFogExp2 = true; - - FogExp2.prototype.clone = function () { - - return new FogExp2( this.color.getHex(), this.density ); - - }; - - FogExp2.prototype.toJSON = function ( meta ) { - - return { - type: 'FogExp2', - color: this.color.getHex(), - density: this.density - }; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function Fog ( color, near, far ) { - - this.name = ''; - - this.color = new Color( color ); - - this.near = ( near !== undefined ) ? near : 1; - this.far = ( far !== undefined ) ? far : 1000; - - } - - Fog.prototype.isFog = true; - - Fog.prototype.clone = function () { - - return new Fog( this.color.getHex(), this.near, this.far ); - - }; - - Fog.prototype.toJSON = function ( meta ) { - - return { - type: 'Fog', - color: this.color.getHex(), - near: this.near, - far: this.far - }; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function Scene () { - - Object3D.call( this ); - - this.type = 'Scene'; - - this.background = null; - this.fog = null; - this.overrideMaterial = null; - - this.autoUpdate = true; // checked by the renderer - - } - - Scene.prototype = Object.create( Object3D.prototype ); - - Scene.prototype.constructor = Scene; - - Scene.prototype.copy = function ( source, recursive ) { - - Object3D.prototype.copy.call( this, source, recursive ); - - if ( source.background !== null ) this.background = source.background.clone(); - if ( source.fog !== null ) this.fog = source.fog.clone(); - if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone(); - - this.autoUpdate = source.autoUpdate; - this.matrixAutoUpdate = source.matrixAutoUpdate; - - return this; - - }; - - Scene.prototype.toJSON = function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - if ( this.background !== null ) data.object.background = this.background.toJSON( meta ); - if ( this.fog !== null ) data.object.fog = this.fog.toJSON(); - - return data; - - }; - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - - function LensFlare( texture, size, distance, blending, color ) { - - Object3D.call( this ); - - this.lensFlares = []; - - this.positionScreen = new Vector3(); - this.customUpdateCallback = undefined; - - if ( texture !== undefined ) { - - this.add( texture, size, distance, blending, color ); - - } - - } - - LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: LensFlare, - - isLensFlare: true, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.positionScreen.copy( source.positionScreen ); - this.customUpdateCallback = source.customUpdateCallback; - - for ( var i = 0, l = source.lensFlares.length; i < l; i ++ ) { - - this.lensFlares.push( source.lensFlares[ i ] ); - - } - - return this; - - }, - - add: function ( texture, size, distance, blending, color, opacity ) { - - if ( size === undefined ) size = - 1; - if ( distance === undefined ) distance = 0; - if ( opacity === undefined ) opacity = 1; - if ( color === undefined ) color = new Color( 0xffffff ); - if ( blending === undefined ) blending = NormalBlending; - - distance = Math.min( distance, Math.max( 0, distance ) ); - - this.lensFlares.push( { - texture: texture, // THREE.Texture - size: size, // size in pixels (-1 = use texture.width) - distance: distance, // distance (0-1) from light source (0=at light source) - x: 0, y: 0, z: 0, // screen position (-1 => 1) z = 0 is in front z = 1 is back - scale: 1, // scale - rotation: 0, // rotation - opacity: opacity, // opacity - color: color, // color - blending: blending // blending - } ); - - }, - - /* - * Update lens flares update positions on all flares based on the screen position - * Set myLensFlare.customUpdateCallback to alter the flares in your project specific way. - */ - - updateLensFlares: function () { - - var f, fl = this.lensFlares.length; - var flare; - var vecX = - this.positionScreen.x * 2; - var vecY = - this.positionScreen.y * 2; - - for ( f = 0; f < fl; f ++ ) { - - flare = this.lensFlares[ f ]; - - flare.x = this.positionScreen.x + vecX * flare.distance; - flare.y = this.positionScreen.y + vecY * flare.distance; - - flare.wantedRotation = flare.x * Math.PI * 0.25; - flare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25; - - } - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * uvOffset: new THREE.Vector2(), - * uvScale: new THREE.Vector2() - * } - */ - - function SpriteMaterial( parameters ) { - - Material.call( this ); - - this.type = 'SpriteMaterial'; - - this.color = new Color( 0xffffff ); - this.map = null; - - this.rotation = 0; - - this.fog = false; - this.lights = false; - - this.setValues( parameters ); - - } - - SpriteMaterial.prototype = Object.create( Material.prototype ); - SpriteMaterial.prototype.constructor = SpriteMaterial; - - SpriteMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - this.map = source.map; - - this.rotation = source.rotation; - - return this; - - }; - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - */ - - function Sprite( material ) { - - Object3D.call( this ); - - this.type = 'Sprite'; - - this.material = ( material !== undefined ) ? material : new SpriteMaterial(); - - } - - Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Sprite, - - isSprite: true, - - raycast: ( function () { - - var matrixPosition = new Vector3(); - - return function raycast( raycaster, intersects ) { - - matrixPosition.setFromMatrixPosition( this.matrixWorld ); - - var distanceSq = raycaster.ray.distanceSqToPoint( matrixPosition ); - var guessSizeSq = this.scale.x * this.scale.y / 4; - - if ( distanceSq > guessSizeSq ) { - - return; - - } - - intersects.push( { - - distance: Math.sqrt( distanceSq ), - point: this.position, - face: null, - object: this - - } ); - - }; - - }() ), - - clone: function () { - - return new this.constructor( this.material ).copy( this ); - - } - - } ); - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - - function LOD() { - - Object3D.call( this ); - - this.type = 'LOD'; - - Object.defineProperties( this, { - levels: { - enumerable: true, - value: [] - } - } ); - - } - - - LOD.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: LOD, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source, false ); - - var levels = source.levels; - - for ( var i = 0, l = levels.length; i < l; i ++ ) { - - var level = levels[ i ]; - - this.addLevel( level.object.clone(), level.distance ); - - } - - return this; - - }, - - addLevel: function ( object, distance ) { - - if ( distance === undefined ) distance = 0; - - distance = Math.abs( distance ); - - var levels = this.levels; - - for ( var l = 0; l < levels.length; l ++ ) { - - if ( distance < levels[ l ].distance ) { - - break; - - } - - } - - levels.splice( l, 0, { distance: distance, object: object } ); - - this.add( object ); - - }, - - getObjectForDistance: function ( distance ) { - - var levels = this.levels; - - for ( var i = 1, l = levels.length; i < l; i ++ ) { - - if ( distance < levels[ i ].distance ) { - - break; - - } - - } - - return levels[ i - 1 ].object; - - }, - - raycast: ( function () { - - var matrixPosition = new Vector3(); - - return function raycast( raycaster, intersects ) { - - matrixPosition.setFromMatrixPosition( this.matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( matrixPosition ); - - this.getObjectForDistance( distance ).raycast( raycaster, intersects ); - - }; - - }() ), - - update: function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - - return function update( camera ) { - - var levels = this.levels; - - if ( levels.length > 1 ) { - - v1.setFromMatrixPosition( camera.matrixWorld ); - v2.setFromMatrixPosition( this.matrixWorld ); - - var distance = v1.distanceTo( v2 ); - - levels[ 0 ].object.visible = true; - - for ( var i = 1, l = levels.length; i < l; i ++ ) { - - if ( distance >= levels[ i ].distance ) { - - levels[ i - 1 ].object.visible = false; - levels[ i ].object.visible = true; - - } else { - - break; - - } - - } - - for ( ; i < l; i ++ ) { - - levels[ i ].object.visible = false; - - } - - } - - }; - - }(), - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.levels = []; - - var levels = this.levels; - - for ( var i = 0, l = levels.length; i < l; i ++ ) { - - var level = levels[ i ]; - - data.object.levels.push( { - object: level.object.uuid, - distance: level.distance - } ); - - } - - return data; - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function DataTexture( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) { - - Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - this.image = { data: data, width: width, height: height }; - - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - - this.flipY = false; - this.generateMipmaps = false; - - } - - DataTexture.prototype = Object.create( Texture.prototype ); - DataTexture.prototype.constructor = DataTexture; - - DataTexture.prototype.isDataTexture = true; - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author michael guerrero / http://realitymeltdown.com - * @author ikerr / http://verold.com - */ - - function Skeleton( bones, boneInverses, useVertexTexture ) { - - this.useVertexTexture = useVertexTexture !== undefined ? useVertexTexture : true; - - this.identityMatrix = new Matrix4(); - - // copy the bone array - - bones = bones || []; - - this.bones = bones.slice( 0 ); - - // create a bone texture or an array of floats - - if ( this.useVertexTexture ) { - - // layout (1 matrix = 4 pixels) - // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) - // with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8) - // 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16) - // 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32) - // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64) - - - var size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix - size = exports.Math.nextPowerOfTwo( Math.ceil( size ) ); - size = Math.max( size, 4 ); - - this.boneTextureWidth = size; - this.boneTextureHeight = size; - - this.boneMatrices = new Float32Array( this.boneTextureWidth * this.boneTextureHeight * 4 ); // 4 floats per RGBA pixel - this.boneTexture = new DataTexture( this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, RGBAFormat, FloatType ); - - } else { - - this.boneMatrices = new Float32Array( 16 * this.bones.length ); - - } - - // use the supplied bone inverses or calculate the inverses - - if ( boneInverses === undefined ) { - - this.calculateInverses(); - - } else { - - if ( this.bones.length === boneInverses.length ) { - - this.boneInverses = boneInverses.slice( 0 ); - - } else { - - console.warn( 'THREE.Skeleton bonInverses is the wrong length.' ); - - this.boneInverses = []; - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - this.boneInverses.push( new Matrix4() ); - - } - - } - - } - - } - - Object.assign( Skeleton.prototype, { - - calculateInverses: function () { - - this.boneInverses = []; - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - var inverse = new Matrix4(); - - if ( this.bones[ b ] ) { - - inverse.getInverse( this.bones[ b ].matrixWorld ); - - } - - this.boneInverses.push( inverse ); - - } - - }, - - pose: function () { - - var bone; - - // recover the bind-time world matrices - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - bone = this.bones[ b ]; - - if ( bone ) { - - bone.matrixWorld.getInverse( this.boneInverses[ b ] ); - - } - - } - - // compute the local matrices, positions, rotations and scales - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - bone = this.bones[ b ]; - - if ( bone ) { - - if ( (bone.parent && bone.parent.isBone) ) { - - bone.matrix.getInverse( bone.parent.matrixWorld ); - bone.matrix.multiply( bone.matrixWorld ); - - } else { - - bone.matrix.copy( bone.matrixWorld ); - - } - - bone.matrix.decompose( bone.position, bone.quaternion, bone.scale ); - - } - - } - - }, - - update: ( function () { - - var offsetMatrix = new Matrix4(); - - return function update() { - - // flatten bone matrices to array - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - // compute the offset between the current and the original transform - - var matrix = this.bones[ b ] ? this.bones[ b ].matrixWorld : this.identityMatrix; - - offsetMatrix.multiplyMatrices( matrix, this.boneInverses[ b ] ); - offsetMatrix.toArray( this.boneMatrices, b * 16 ); - - } - - if ( this.useVertexTexture ) { - - this.boneTexture.needsUpdate = true; - - } - - }; - - } )(), - - clone: function () { - - return new Skeleton( this.bones, this.boneInverses, this.useVertexTexture ); - - } - - } ); - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author ikerr / http://verold.com - */ - - function Bone( skin ) { - - Object3D.call( this ); - - this.type = 'Bone'; - - this.skin = skin; - - } - - Bone.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Bone, - - isBone: true, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.skin = source.skin; - - return this; - - } - - } ); - - /** - * @author mikael emtinger / http://gomo.se/ - * @author alteredq / http://alteredqualia.com/ - * @author ikerr / http://verold.com - */ - - function SkinnedMesh( geometry, material, useVertexTexture ) { - - Mesh.call( this, geometry, material ); - - this.type = 'SkinnedMesh'; - - this.bindMode = "attached"; - this.bindMatrix = new Matrix4(); - this.bindMatrixInverse = new Matrix4(); - - // init bones - - // TODO: remove bone creation as there is no reason (other than - // convenience) for THREE.SkinnedMesh to do this. - - var bones = []; - - if ( this.geometry && this.geometry.bones !== undefined ) { - - var bone, gbone; - - for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) { - - gbone = this.geometry.bones[ b ]; - - bone = new Bone( this ); - bones.push( bone ); - - bone.name = gbone.name; - bone.position.fromArray( gbone.pos ); - bone.quaternion.fromArray( gbone.rotq ); - if ( gbone.scl !== undefined ) bone.scale.fromArray( gbone.scl ); - - } - - for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) { - - gbone = this.geometry.bones[ b ]; - - if ( gbone.parent !== - 1 && gbone.parent !== null && - bones[ gbone.parent ] !== undefined ) { - - bones[ gbone.parent ].add( bones[ b ] ); - - } else { - - this.add( bones[ b ] ); - - } - - } - - } - - this.normalizeSkinWeights(); - - this.updateMatrixWorld( true ); - this.bind( new Skeleton( bones, undefined, useVertexTexture ), this.matrixWorld ); - - } - - - SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { - - constructor: SkinnedMesh, - - isSkinnedMesh: true, - - bind: function( skeleton, bindMatrix ) { - - this.skeleton = skeleton; - - if ( bindMatrix === undefined ) { - - this.updateMatrixWorld( true ); - - this.skeleton.calculateInverses(); - - bindMatrix = this.matrixWorld; - - } - - this.bindMatrix.copy( bindMatrix ); - this.bindMatrixInverse.getInverse( bindMatrix ); - - }, - - pose: function () { - - this.skeleton.pose(); - - }, - - normalizeSkinWeights: function () { - - if ( (this.geometry && this.geometry.isGeometry) ) { - - for ( var i = 0; i < this.geometry.skinWeights.length; i ++ ) { - - var sw = this.geometry.skinWeights[ i ]; - - var scale = 1.0 / sw.lengthManhattan(); - - if ( scale !== Infinity ) { - - sw.multiplyScalar( scale ); - - } else { - - sw.set( 1, 0, 0, 0 ); // do something reasonable - - } - - } - - } else if ( (this.geometry && this.geometry.isBufferGeometry) ) { - - var vec = new Vector4(); - - var skinWeight = this.geometry.attributes.skinWeight; - - for ( var i = 0; i < skinWeight.count; i ++ ) { - - vec.x = skinWeight.getX( i ); - vec.y = skinWeight.getY( i ); - vec.z = skinWeight.getZ( i ); - vec.w = skinWeight.getW( i ); - - var scale = 1.0 / vec.lengthManhattan(); - - if ( scale !== Infinity ) { - - vec.multiplyScalar( scale ); - - } else { - - vec.set( 1, 0, 0, 0 ); // do something reasonable - - } - - skinWeight.setXYZW( i, vec.x, vec.y, vec.z, vec.w ); - - } - - } - - }, - - updateMatrixWorld: function( force ) { - - Mesh.prototype.updateMatrixWorld.call( this, true ); - - if ( this.bindMode === "attached" ) { - - this.bindMatrixInverse.getInverse( this.matrixWorld ); - - } else if ( this.bindMode === "detached" ) { - - this.bindMatrixInverse.getInverse( this.bindMatrix ); - - } else { - - console.warn( 'THREE.SkinnedMesh unrecognized bindMode: ' + this.bindMode ); - - } - - }, - - clone: function() { - - return new this.constructor( this.geometry, this.material, this.skeleton.useVertexTexture ).copy( this ); - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * linewidth: <float>, - * linecap: "round", - * linejoin: "round" - * } - */ - - function LineBasicMaterial( parameters ) { - - Material.call( this ); - - this.type = 'LineBasicMaterial'; - - this.color = new Color( 0xffffff ); - - this.linewidth = 1; - this.linecap = 'round'; - this.linejoin = 'round'; - - this.lights = false; - - this.setValues( parameters ); - - } - - LineBasicMaterial.prototype = Object.create( Material.prototype ); - LineBasicMaterial.prototype.constructor = LineBasicMaterial; - - LineBasicMaterial.prototype.isLineBasicMaterial = true; - - LineBasicMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.linewidth = source.linewidth; - this.linecap = source.linecap; - this.linejoin = source.linejoin; - - return this; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function Line( geometry, material, mode ) { - - if ( mode === 1 ) { - - console.warn( 'THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead.' ); - return new LineSegments( geometry, material ); - - } - - Object3D.call( this ); - - this.type = 'Line'; - - this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); - this.material = material !== undefined ? material : new LineBasicMaterial( { color: Math.random() * 0xffffff } ); - - } - - Line.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Line, - - isLine: true, - - raycast: ( function () { - - var inverseMatrix = new Matrix4(); - var ray = new Ray(); - var sphere = new Sphere(); - - return function raycast( raycaster, intersects ) { - - var precision = raycaster.linePrecision; - var precisionSq = precision * precision; - - var geometry = this.geometry; - var matrixWorld = this.matrixWorld; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( matrixWorld ); - - if ( raycaster.ray.intersectsSphere( sphere ) === false ) return; - - // - - inverseMatrix.getInverse( matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - var vStart = new Vector3(); - var vEnd = new Vector3(); - var interSegment = new Vector3(); - var interRay = new Vector3(); - var step = (this && this.isLineSegments) ? 2 : 1; - - if ( (geometry && geometry.isBufferGeometry) ) { - - var index = geometry.index; - var attributes = geometry.attributes; - var positions = attributes.position.array; - - if ( index !== null ) { - - var indices = index.array; - - for ( var i = 0, l = indices.length - 1; i < l; i += step ) { - - var a = indices[ i ]; - var b = indices[ i + 1 ]; - - vStart.fromArray( positions, a * 3 ); - vEnd.fromArray( positions, b * 3 ); - - var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation - - var distance = raycaster.ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } else { - - for ( var i = 0, l = positions.length / 3 - 1; i < l; i += step ) { - - vStart.fromArray( positions, 3 * i ); - vEnd.fromArray( positions, 3 * i + 3 ); - - var distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation - - var distance = raycaster.ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } - - } else if ( (geometry && geometry.isGeometry) ) { - - var vertices = geometry.vertices; - var nbVertices = vertices.length; - - for ( var i = 0; i < nbVertices - 1; i += step ) { - - var distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment ); - - if ( distSq > precisionSq ) continue; - - interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation - - var distance = raycaster.ray.origin.distanceTo( interRay ); - - if ( distance < raycaster.near || distance > raycaster.far ) continue; - - intersects.push( { - - distance: distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4( this.matrixWorld ), - index: i, - face: null, - faceIndex: null, - object: this - - } ); - - } - - } - - }; - - }() ), - - clone: function () { - - return new this.constructor( this.geometry, this.material ).copy( this ); - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function LineSegments( geometry, material ) { - - Line.call( this, geometry, material ); - - this.type = 'LineSegments'; - - } - - LineSegments.prototype = Object.assign( Object.create( Line.prototype ), { - - constructor: LineSegments, - - isLineSegments: true - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * map: new THREE.Texture( <Image> ), - * - * size: <float>, - * sizeAttenuation: <bool> - * } - */ - - function PointsMaterial( parameters ) { - - Material.call( this ); - - this.type = 'PointsMaterial'; - - this.color = new Color( 0xffffff ); - - this.map = null; - - this.size = 1; - this.sizeAttenuation = true; - - this.lights = false; - - this.setValues( parameters ); - - } - - PointsMaterial.prototype = Object.create( Material.prototype ); - PointsMaterial.prototype.constructor = PointsMaterial; - - PointsMaterial.prototype.isPointsMaterial = true; - - PointsMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.size = source.size; - this.sizeAttenuation = source.sizeAttenuation; - - return this; - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function Points( geometry, material ) { - - Object3D.call( this ); - - this.type = 'Points'; - - this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); - this.material = material !== undefined ? material : new PointsMaterial( { color: Math.random() * 0xffffff } ); - - } - - Points.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Points, - - isPoints: true, - - raycast: ( function () { - - var inverseMatrix = new Matrix4(); - var ray = new Ray(); - var sphere = new Sphere(); - - return function raycast( raycaster, intersects ) { - - var object = this; - var geometry = this.geometry; - var matrixWorld = this.matrixWorld; - var threshold = raycaster.params.Points.threshold; - - // Checking boundingSphere distance to ray - - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - - sphere.copy( geometry.boundingSphere ); - sphere.applyMatrix4( matrixWorld ); - - if ( raycaster.ray.intersectsSphere( sphere ) === false ) return; - - // - - inverseMatrix.getInverse( matrixWorld ); - ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix ); - - var localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 ); - var localThresholdSq = localThreshold * localThreshold; - var position = new Vector3(); - - function testPoint( point, index ) { - - var rayPointDistanceSq = ray.distanceSqToPoint( point ); - - if ( rayPointDistanceSq < localThresholdSq ) { - - var intersectPoint = ray.closestPointToPoint( point ); - intersectPoint.applyMatrix4( matrixWorld ); - - var distance = raycaster.ray.origin.distanceTo( intersectPoint ); - - if ( distance < raycaster.near || distance > raycaster.far ) return; - - intersects.push( { - - distance: distance, - distanceToRay: Math.sqrt( rayPointDistanceSq ), - point: intersectPoint.clone(), - index: index, - face: null, - object: object - - } ); - - } - - } - - if ( (geometry && geometry.isBufferGeometry) ) { - - var index = geometry.index; - var attributes = geometry.attributes; - var positions = attributes.position.array; - - if ( index !== null ) { - - var indices = index.array; - - for ( var i = 0, il = indices.length; i < il; i ++ ) { - - var a = indices[ i ]; - - position.fromArray( positions, a * 3 ); - - testPoint( position, a ); - - } - - } else { - - for ( var i = 0, l = positions.length / 3; i < l; i ++ ) { - - position.fromArray( positions, i * 3 ); - - testPoint( position, i ); - - } - - } - - } else { - - var vertices = geometry.vertices; - - for ( var i = 0, l = vertices.length; i < l; i ++ ) { - - testPoint( vertices[ i ], i ); - - } - - } - - }; - - }() ), - - clone: function () { - - return new this.constructor( this.geometry, this.material ).copy( this ); - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function Group() { - - Object3D.call( this ); - - this.type = 'Group'; - - } - - Group.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Group - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.generateMipmaps = false; - - var scope = this; - - function update() { - - requestAnimationFrame( update ); - - if ( video.readyState >= video.HAVE_CURRENT_DATA ) { - - scope.needsUpdate = true; - - } - - } - - update(); - - } - - VideoTexture.prototype = Object.create( Texture.prototype ); - VideoTexture.prototype.constructor = VideoTexture; - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function CompressedTexture( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) { - - Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - - this.image = { width: width, height: height }; - this.mipmaps = mipmaps; - - // no flipping for cube textures - // (also flipping doesn't work for compressed textures ) - - this.flipY = false; - - // can't generate mipmaps for compressed textures - // mips must be embedded in DDS files - - this.generateMipmaps = false; - - } - - CompressedTexture.prototype = Object.create( Texture.prototype ); - CompressedTexture.prototype.constructor = CompressedTexture; - - CompressedTexture.prototype.isCompressedTexture = true; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function CanvasTexture( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) { - - Texture.call( this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.needsUpdate = true; - - } - - CanvasTexture.prototype = Object.create( Texture.prototype ); - CanvasTexture.prototype.constructor = CanvasTexture; - - /** - * @author Matt DesLauriers / @mattdesl - * @author atix / arthursilber.de - */ - - function DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) { - - format = format !== undefined ? format : DepthFormat; - - if ( format !== DepthFormat && format !== DepthStencilFormat ) { - - throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' ) - - } - - Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); - - this.image = { width: width, height: height }; - - this.type = type !== undefined ? type : UnsignedShortType; - - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - - this.flipY = false; - this.generateMipmaps = false; - - } - - DepthTexture.prototype = Object.create( Texture.prototype ); - DepthTexture.prototype.constructor = DepthTexture; - DepthTexture.prototype.isDepthTexture = true; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function WireframeGeometry( geometry ) { - - BufferGeometry.call( this ); - - var edge = [ 0, 0 ], hash = {}; - - function sortFunction( a, b ) { - - return a - b; - - } - - var keys = [ 'a', 'b', 'c' ]; - - if ( (geometry && geometry.isGeometry) ) { - - var vertices = geometry.vertices; - var faces = geometry.faces; - var numEdges = 0; - - // allocate maximal size - var edges = new Uint32Array( 6 * faces.length ); - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = face[ keys[ j ] ]; - edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - edges[ 2 * numEdges ] = edge[ 0 ]; - edges[ 2 * numEdges + 1 ] = edge[ 1 ]; - hash[ key ] = true; - numEdges ++; - - } - - } - - } - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numEdges; i < l; i ++ ) { - - for ( var j = 0; j < 2; j ++ ) { - - var vertex = vertices[ edges [ 2 * i + j ] ]; - - var index = 6 * i + 3 * j; - coords[ index + 0 ] = vertex.x; - coords[ index + 1 ] = vertex.y; - coords[ index + 2 ] = vertex.z; - - } - - } - - this.addAttribute( 'position', new BufferAttribute( coords, 3 ) ); - - } else if ( (geometry && geometry.isBufferGeometry) ) { - - if ( geometry.index !== null ) { - - // Indexed BufferGeometry - - var indices = geometry.index.array; - var vertices = geometry.attributes.position; - var groups = geometry.groups; - var numEdges = 0; - - if ( groups.length === 0 ) { - - geometry.addGroup( 0, indices.length ); - - } - - // allocate maximal size - var edges = new Uint32Array( 2 * indices.length ); - - for ( var o = 0, ol = groups.length; o < ol; ++ o ) { - - var group = groups[ o ]; - - var start = group.start; - var count = group.count; - - for ( var i = start, il = start + count; i < il; i += 3 ) { - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = indices[ i + j ]; - edge[ 1 ] = indices[ i + ( j + 1 ) % 3 ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - edges[ 2 * numEdges ] = edge[ 0 ]; - edges[ 2 * numEdges + 1 ] = edge[ 1 ]; - hash[ key ] = true; - numEdges ++; - - } - - } - - } - - } - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numEdges; i < l; i ++ ) { - - for ( var j = 0; j < 2; j ++ ) { - - var index = 6 * i + 3 * j; - var index2 = edges[ 2 * i + j ]; - - coords[ index + 0 ] = vertices.getX( index2 ); - coords[ index + 1 ] = vertices.getY( index2 ); - coords[ index + 2 ] = vertices.getZ( index2 ); - - } - - } - - this.addAttribute( 'position', new BufferAttribute( coords, 3 ) ); - - } else { - - // non-indexed BufferGeometry - - var vertices = geometry.attributes.position.array; - var numEdges = vertices.length / 3; - var numTris = numEdges / 3; - - var coords = new Float32Array( numEdges * 2 * 3 ); - - for ( var i = 0, l = numTris; i < l; i ++ ) { - - for ( var j = 0; j < 3; j ++ ) { - - var index = 18 * i + 6 * j; - - var index1 = 9 * i + 3 * j; - coords[ index + 0 ] = vertices[ index1 ]; - coords[ index + 1 ] = vertices[ index1 + 1 ]; - coords[ index + 2 ] = vertices[ index1 + 2 ]; - - var index2 = 9 * i + 3 * ( ( j + 1 ) % 3 ); - coords[ index + 3 ] = vertices[ index2 ]; - coords[ index + 4 ] = vertices[ index2 + 1 ]; - coords[ index + 5 ] = vertices[ index2 + 2 ]; - - } - - } - - this.addAttribute( 'position', new BufferAttribute( coords, 3 ) ); - - } - - } - - } - - WireframeGeometry.prototype = Object.create( BufferGeometry.prototype ); - WireframeGeometry.prototype.constructor = WireframeGeometry; - - /** - * @author zz85 / https://github.com/zz85 - * Parametric Surfaces Geometry - * based on the brilliant article by @prideout http://prideout.net/blog/?p=44 - * - * new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements ); - * - */ - - function ParametricGeometry( func, slices, stacks ) { - - Geometry.call( this ); - - this.type = 'ParametricGeometry'; - - this.parameters = { - func: func, - slices: slices, - stacks: stacks - }; - - var verts = this.vertices; - var faces = this.faces; - var uvs = this.faceVertexUvs[ 0 ]; - - var i, j, p; - var u, v; - - var sliceCount = slices + 1; - - for ( i = 0; i <= stacks; i ++ ) { - - v = i / stacks; - - for ( j = 0; j <= slices; j ++ ) { - - u = j / slices; - - p = func( u, v ); - verts.push( p ); - - } - - } - - var a, b, c, d; - var uva, uvb, uvc, uvd; - - for ( i = 0; i < stacks; i ++ ) { - - for ( j = 0; j < slices; j ++ ) { - - a = i * sliceCount + j; - b = i * sliceCount + j + 1; - c = ( i + 1 ) * sliceCount + j + 1; - d = ( i + 1 ) * sliceCount + j; - - uva = new Vector2( j / slices, i / stacks ); - uvb = new Vector2( ( j + 1 ) / slices, i / stacks ); - uvc = new Vector2( ( j + 1 ) / slices, ( i + 1 ) / stacks ); - uvd = new Vector2( j / slices, ( i + 1 ) / stacks ); - - faces.push( new Face3( a, b, d ) ); - uvs.push( [ uva, uvb, uvd ] ); - - faces.push( new Face3( b, c, d ) ); - uvs.push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - - } - - // console.log(this); - - // magic bullet - // var diff = this.mergeVertices(); - // console.log('removed ', diff, ' vertices by merging'); - - this.computeFaceNormals(); - this.computeVertexNormals(); - - } - - ParametricGeometry.prototype = Object.create( Geometry.prototype ); - ParametricGeometry.prototype.constructor = ParametricGeometry; - - /** - * @author clockworkgeek / https://github.com/clockworkgeek - * @author timothypratley / https://github.com/timothypratley - * @author WestLangley / http://github.com/WestLangley - */ - - function PolyhedronGeometry( vertices, indices, radius, detail ) { - - Geometry.call( this ); - - this.type = 'PolyhedronGeometry'; - - this.parameters = { - vertices: vertices, - indices: indices, - radius: radius, - detail: detail - }; - - radius = radius || 1; - detail = detail || 0; - - var that = this; - - for ( var i = 0, l = vertices.length; i < l; i += 3 ) { - - prepare( new Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) ); - - } - - var p = this.vertices; - - var faces = []; - - for ( var i = 0, j = 0, l = indices.length; i < l; i += 3, j ++ ) { - - var v1 = p[ indices[ i ] ]; - var v2 = p[ indices[ i + 1 ] ]; - var v3 = p[ indices[ i + 2 ] ]; - - faces[ j ] = new Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); - - } - - var centroid = new Vector3(); - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - subdivide( faces[ i ], detail ); - - } - - - // Handle case when face straddles the seam - - for ( var i = 0, l = this.faceVertexUvs[ 0 ].length; i < l; i ++ ) { - - var uvs = this.faceVertexUvs[ 0 ][ i ]; - - var x0 = uvs[ 0 ].x; - var x1 = uvs[ 1 ].x; - var x2 = uvs[ 2 ].x; - - var max = Math.max( x0, x1, x2 ); - var min = Math.min( x0, x1, x2 ); - - if ( max > 0.9 && min < 0.1 ) { - - // 0.9 is somewhat arbitrary - - if ( x0 < 0.2 ) uvs[ 0 ].x += 1; - if ( x1 < 0.2 ) uvs[ 1 ].x += 1; - if ( x2 < 0.2 ) uvs[ 2 ].x += 1; - - } - - } - - - // Apply radius - - for ( var i = 0, l = this.vertices.length; i < l; i ++ ) { - - this.vertices[ i ].multiplyScalar( radius ); - - } - - - // Merge vertices - - this.mergeVertices(); - - this.computeFaceNormals(); - - this.boundingSphere = new Sphere( new Vector3(), radius ); - - - // Project vector onto sphere's surface - - function prepare( vector ) { - - var vertex = vector.normalize().clone(); - vertex.index = that.vertices.push( vertex ) - 1; - - // Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle. - - var u = azimuth( vector ) / 2 / Math.PI + 0.5; - var v = inclination( vector ) / Math.PI + 0.5; - vertex.uv = new Vector2( u, 1 - v ); - - return vertex; - - } - - - // Approximate a curved face with recursively sub-divided triangles. - - function make( v1, v2, v3 ) { - - var face = new Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); - that.faces.push( face ); - - centroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 ); - - var azi = azimuth( centroid ); - - that.faceVertexUvs[ 0 ].push( [ - correctUV( v1.uv, v1, azi ), - correctUV( v2.uv, v2, azi ), - correctUV( v3.uv, v3, azi ) - ] ); - - } - - - // Analytically subdivide a face to the required detail level. - - function subdivide( face, detail ) { - - var cols = Math.pow( 2, detail ); - var a = prepare( that.vertices[ face.a ] ); - var b = prepare( that.vertices[ face.b ] ); - var c = prepare( that.vertices[ face.c ] ); - var v = []; - - // Construct all of the vertices for this subdivision. - - for ( var i = 0 ; i <= cols; i ++ ) { - - v[ i ] = []; - - var aj = prepare( a.clone().lerp( c, i / cols ) ); - var bj = prepare( b.clone().lerp( c, i / cols ) ); - var rows = cols - i; - - for ( var j = 0; j <= rows; j ++ ) { - - if ( j === 0 && i === cols ) { - - v[ i ][ j ] = aj; - - } else { - - v[ i ][ j ] = prepare( aj.clone().lerp( bj, j / rows ) ); - - } - - } - - } - - // Construct all of the faces. - - for ( var i = 0; i < cols ; i ++ ) { - - for ( var j = 0; j < 2 * ( cols - i ) - 1; j ++ ) { - - var k = Math.floor( j / 2 ); - - if ( j % 2 === 0 ) { - - make( - v[ i ][ k + 1 ], - v[ i + 1 ][ k ], - v[ i ][ k ] - ); - - } else { - - make( - v[ i ][ k + 1 ], - v[ i + 1 ][ k + 1 ], - v[ i + 1 ][ k ] - ); - - } - - } - - } - - } - - - // Angle around the Y axis, counter-clockwise when looking from above. - - function azimuth( vector ) { - - return Math.atan2( vector.z, - vector.x ); - - } - - - // Angle above the XZ plane. - - function inclination( vector ) { - - return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); - - } - - - // Texture fixing helper. Spheres have some odd behaviours. - - function correctUV( uv, vector, azimuth ) { - - if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) uv = new Vector2( uv.x - 1, uv.y ); - if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) uv = new Vector2( azimuth / 2 / Math.PI + 0.5, uv.y ); - return uv.clone(); - - } - - } - - PolyhedronGeometry.prototype = Object.create( Geometry.prototype ); - PolyhedronGeometry.prototype.constructor = PolyhedronGeometry; - - /** - * @author timothypratley / https://github.com/timothypratley - */ - - function TetrahedronGeometry( radius, detail ) { - - var vertices = [ - 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1 - ]; - - var indices = [ - 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1 - ]; - - PolyhedronGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'TetrahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - } - - TetrahedronGeometry.prototype = Object.create( PolyhedronGeometry.prototype ); - TetrahedronGeometry.prototype.constructor = TetrahedronGeometry; - - /** - * @author timothypratley / https://github.com/timothypratley - */ - - function OctahedronGeometry( radius, detail ) { - - var vertices = [ - 1, 0, 0, - 1, 0, 0, 0, 1, 0, 0, - 1, 0, 0, 0, 1, 0, 0, - 1 - ]; - - var indices = [ - 0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2 - ]; - - PolyhedronGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'OctahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - } - - OctahedronGeometry.prototype = Object.create( PolyhedronGeometry.prototype ); - OctahedronGeometry.prototype.constructor = OctahedronGeometry; - - /** - * @author timothypratley / https://github.com/timothypratley - */ - - function IcosahedronGeometry( radius, detail ) { - - var t = ( 1 + Math.sqrt( 5 ) ) / 2; - - var vertices = [ - - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, 0, - 0, - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, - t, 0, - 1, t, 0, 1, - t, 0, - 1, - t, 0, 1 - ]; - - var indices = [ - 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, - 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, - 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, - 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1 - ]; - - PolyhedronGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'IcosahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - } - - IcosahedronGeometry.prototype = Object.create( PolyhedronGeometry.prototype ); - IcosahedronGeometry.prototype.constructor = IcosahedronGeometry; - - /** - * @author Abe Pazos / https://hamoid.com - */ - - function DodecahedronGeometry( radius, detail ) { - - var t = ( 1 + Math.sqrt( 5 ) ) / 2; - var r = 1 / t; - - var vertices = [ - - // (±1, ±1, ±1) - - 1, - 1, - 1, - 1, - 1, 1, - - 1, 1, - 1, - 1, 1, 1, - 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, 1, 1, 1, - - // (0, ±1/φ, ±φ) - 0, - r, - t, 0, - r, t, - 0, r, - t, 0, r, t, - - // (±1/φ, ±φ, 0) - - r, - t, 0, - r, t, 0, - r, - t, 0, r, t, 0, - - // (±φ, 0, ±1/φ) - - t, 0, - r, t, 0, - r, - - t, 0, r, t, 0, r - ]; - - var indices = [ - 3, 11, 7, 3, 7, 15, 3, 15, 13, - 7, 19, 17, 7, 17, 6, 7, 6, 15, - 17, 4, 8, 17, 8, 10, 17, 10, 6, - 8, 0, 16, 8, 16, 2, 8, 2, 10, - 0, 12, 1, 0, 1, 18, 0, 18, 16, - 6, 10, 2, 6, 2, 13, 6, 13, 15, - 2, 16, 18, 2, 18, 3, 2, 3, 13, - 18, 1, 9, 18, 9, 11, 18, 11, 3, - 4, 14, 12, 4, 12, 0, 4, 0, 8, - 11, 9, 5, 11, 5, 19, 11, 19, 7, - 19, 5, 14, 19, 14, 4, 19, 4, 17, - 1, 12, 14, 1, 14, 5, 1, 5, 9 - ]; - - PolyhedronGeometry.call( this, vertices, indices, radius, detail ); - - this.type = 'DodecahedronGeometry'; - - this.parameters = { - radius: radius, - detail: detail - }; - - } - - DodecahedronGeometry.prototype = Object.create( PolyhedronGeometry.prototype ); - DodecahedronGeometry.prototype.constructor = DodecahedronGeometry; - - /** - * @author WestLangley / https://github.com/WestLangley - * @author zz85 / https://github.com/zz85 - * @author miningold / https://github.com/miningold - * @author jonobr1 / https://github.com/jonobr1 - * - * Modified from the TorusKnotGeometry by @oosmoxiecode - * - * Creates a tube which extrudes along a 3d spline - * - * Uses parallel transport frames as described in - * http://www.cs.indiana.edu/pub/techreports/TR425.pdf - */ - - function TubeGeometry( path, segments, radius, radialSegments, closed, taper ) { - - Geometry.call( this ); - - this.type = 'TubeGeometry'; - - this.parameters = { - path: path, - segments: segments, - radius: radius, - radialSegments: radialSegments, - closed: closed, - taper: taper - }; - - segments = segments || 64; - radius = radius || 1; - radialSegments = radialSegments || 8; - closed = closed || false; - taper = taper || TubeGeometry.NoTaper; - - var grid = []; - - var scope = this, - - tangent, - normal, - binormal, - - numpoints = segments + 1, - - u, v, r, - - cx, cy, - pos, pos2 = new Vector3(), - i, j, - ip, jp, - a, b, c, d, - uva, uvb, uvc, uvd; - - var frames = new TubeGeometry.FrenetFrames( path, segments, closed ), - tangents = frames.tangents, - normals = frames.normals, - binormals = frames.binormals; - - // proxy internals - this.tangents = tangents; - this.normals = normals; - this.binormals = binormals; - - function vert( x, y, z ) { - - return scope.vertices.push( new Vector3( x, y, z ) ) - 1; - - } - - // construct the grid - - for ( i = 0; i < numpoints; i ++ ) { - - grid[ i ] = []; - - u = i / ( numpoints - 1 ); - - pos = path.getPointAt( u ); - - tangent = tangents[ i ]; - normal = normals[ i ]; - binormal = binormals[ i ]; - - r = radius * taper( u ); - - for ( j = 0; j < radialSegments; j ++ ) { - - v = j / radialSegments * 2 * Math.PI; - - cx = - r * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. - cy = r * Math.sin( v ); - - pos2.copy( pos ); - pos2.x += cx * normal.x + cy * binormal.x; - pos2.y += cx * normal.y + cy * binormal.y; - pos2.z += cx * normal.z + cy * binormal.z; - - grid[ i ][ j ] = vert( pos2.x, pos2.y, pos2.z ); - - } - - } - - - // construct the mesh - - for ( i = 0; i < segments; i ++ ) { - - for ( j = 0; j < radialSegments; j ++ ) { - - ip = ( closed ) ? ( i + 1 ) % segments : i + 1; - jp = ( j + 1 ) % radialSegments; - - a = grid[ i ][ j ]; // *** NOT NECESSARILY PLANAR ! *** - b = grid[ ip ][ j ]; - c = grid[ ip ][ jp ]; - d = grid[ i ][ jp ]; - - uva = new Vector2( i / segments, j / radialSegments ); - uvb = new Vector2( ( i + 1 ) / segments, j / radialSegments ); - uvc = new Vector2( ( i + 1 ) / segments, ( j + 1 ) / radialSegments ); - uvd = new Vector2( i / segments, ( j + 1 ) / radialSegments ); - - this.faces.push( new Face3( a, b, d ) ); - this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - this.faces.push( new Face3( b, c, d ) ); - this.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - - } - - this.computeFaceNormals(); - this.computeVertexNormals(); - - } - - TubeGeometry.prototype = Object.create( Geometry.prototype ); - TubeGeometry.prototype.constructor = TubeGeometry; - - TubeGeometry.NoTaper = function ( u ) { - - return 1; - - }; - - TubeGeometry.SinusoidalTaper = function ( u ) { - - return Math.sin( Math.PI * u ); - - }; - - // For computing of Frenet frames, exposing the tangents, normals and binormals the spline - TubeGeometry.FrenetFrames = function ( path, segments, closed ) { - - var normal = new Vector3(), - - tangents = [], - normals = [], - binormals = [], - - vec = new Vector3(), - mat = new Matrix4(), - - numpoints = segments + 1, - theta, - smallest, - - tx, ty, tz, - i, u; - - - // expose internals - this.tangents = tangents; - this.normals = normals; - this.binormals = binormals; - - // compute the tangent vectors for each segment on the path - - for ( i = 0; i < numpoints; i ++ ) { - - u = i / ( numpoints - 1 ); - - tangents[ i ] = path.getTangentAt( u ); - tangents[ i ].normalize(); - - } - - initialNormal3(); - - /* - function initialNormal1(lastBinormal) { - // fixed start binormal. Has dangers of 0 vectors - normals[ 0 ] = new THREE.Vector3(); - binormals[ 0 ] = new THREE.Vector3(); - if (lastBinormal===undefined) lastBinormal = new THREE.Vector3( 0, 0, 1 ); - normals[ 0 ].crossVectors( lastBinormal, tangents[ 0 ] ).normalize(); - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize(); - } - - function initialNormal2() { - - // This uses the Frenet-Serret formula for deriving binormal - var t2 = path.getTangentAt( epsilon ); - - normals[ 0 ] = new THREE.Vector3().subVectors( t2, tangents[ 0 ] ).normalize(); - binormals[ 0 ] = new THREE.Vector3().crossVectors( tangents[ 0 ], normals[ 0 ] ); - - normals[ 0 ].crossVectors( binormals[ 0 ], tangents[ 0 ] ).normalize(); // last binormal x tangent - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize(); - - } - */ - - function initialNormal3() { - - // select an initial normal vector perpendicular to the first tangent vector, - // and in the direction of the smallest tangent xyz component - - normals[ 0 ] = new Vector3(); - binormals[ 0 ] = new Vector3(); - smallest = Number.MAX_VALUE; - tx = Math.abs( tangents[ 0 ].x ); - ty = Math.abs( tangents[ 0 ].y ); - tz = Math.abs( tangents[ 0 ].z ); - - if ( tx <= smallest ) { - - smallest = tx; - normal.set( 1, 0, 0 ); - - } - - if ( ty <= smallest ) { - - smallest = ty; - normal.set( 0, 1, 0 ); - - } - - if ( tz <= smallest ) { - - normal.set( 0, 0, 1 ); - - } - - vec.crossVectors( tangents[ 0 ], normal ).normalize(); - - normals[ 0 ].crossVectors( tangents[ 0 ], vec ); - binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ); - - } - - - // compute the slowly-varying normal and binormal vectors for each segment on the path - - for ( i = 1; i < numpoints; i ++ ) { - - normals[ i ] = normals[ i - 1 ].clone(); - - binormals[ i ] = binormals[ i - 1 ].clone(); - - vec.crossVectors( tangents[ i - 1 ], tangents[ i ] ); - - if ( vec.length() > Number.EPSILON ) { - - vec.normalize(); - - theta = Math.acos( exports.Math.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors - - normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) ); - - } - - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - - // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same - - if ( closed ) { - - theta = Math.acos( exports.Math.clamp( normals[ 0 ].dot( normals[ numpoints - 1 ] ), - 1, 1 ) ); - theta /= ( numpoints - 1 ); - - if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints - 1 ] ) ) > 0 ) { - - theta = - theta; - - } - - for ( i = 1; i < numpoints; i ++ ) { - - // twist a little... - normals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) ); - binormals[ i ].crossVectors( tangents[ i ], normals[ i ] ); - - } - - } - - }; - - /** - * @author Mugen87 / https://github.com/Mugen87 - * - * see: http://www.blackpawn.com/texts/pqtorus/ - */ - function TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q ) { - - BufferGeometry.call( this ); - - this.type = 'TorusKnotBufferGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - tubularSegments: tubularSegments, - radialSegments: radialSegments, - p: p, - q: q - }; - - radius = radius || 100; - tube = tube || 40; - tubularSegments = Math.floor( tubularSegments ) || 64; - radialSegments = Math.floor( radialSegments ) || 8; - p = p || 2; - q = q || 3; - - // used to calculate buffer length - var vertexCount = ( ( radialSegments + 1 ) * ( tubularSegments + 1 ) ); - var indexCount = radialSegments * tubularSegments * 2 * 3; - - // buffers - var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ) , 1 ); - var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - // helper variables - var i, j, index = 0, indexOffset = 0; - - var vertex = new Vector3(); - var normal = new Vector3(); - var uv = new Vector2(); - - var P1 = new Vector3(); - var P2 = new Vector3(); - - var B = new Vector3(); - var T = new Vector3(); - var N = new Vector3(); - - // generate vertices, normals and uvs - - for ( i = 0; i <= tubularSegments; ++ i ) { - - // the radian "u" is used to calculate the position on the torus curve of the current tubular segement - - var u = i / tubularSegments * p * Math.PI * 2; - - // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead. - // these points are used to create a special "coordinate space", which is necessary to calculate the correct vertex positions - - calculatePositionOnCurve( u, p, q, radius, P1 ); - calculatePositionOnCurve( u + 0.01, p, q, radius, P2 ); - - // calculate orthonormal basis - - T.subVectors( P2, P1 ); - N.addVectors( P2, P1 ); - B.crossVectors( T, N ); - N.crossVectors( B, T ); - - // normalize B, N. T can be ignored, we don't use it - - B.normalize(); - N.normalize(); - - for ( j = 0; j <= radialSegments; ++ j ) { - - // now calculate the vertices. they are nothing more than an extrusion of the torus curve. - // because we extrude a shape in the xy-plane, there is no need to calculate a z-value. - - var v = j / radialSegments * Math.PI * 2; - var cx = - tube * Math.cos( v ); - var cy = tube * Math.sin( v ); - - // now calculate the final vertex position. - // first we orient the extrusion with our basis vectos, then we add it to the current position on the curve - - vertex.x = P1.x + ( cx * N.x + cy * B.x ); - vertex.y = P1.y + ( cx * N.y + cy * B.y ); - vertex.z = P1.z + ( cx * N.z + cy * B.z ); - - // vertex - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal) - normal.subVectors( vertex, P1 ).normalize(); - normals.setXYZ( index, normal.x, normal.y, normal.z ); - - // uv - uv.x = i / tubularSegments; - uv.y = j / radialSegments; - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index ++; - - } - - } - - // generate indices - - for ( j = 1; j <= tubularSegments; j ++ ) { - - for ( i = 1; i <= radialSegments; i ++ ) { - - // indices - var a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 ); - var b = ( radialSegments + 1 ) * j + ( i - 1 ); - var c = ( radialSegments + 1 ) * j + i; - var d = ( radialSegments + 1 ) * ( j - 1 ) + i; - - // face one - indices.setX( indexOffset, a ); indexOffset++; - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - // face two - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, c ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - } - - } - - // build geometry - - this.setIndex( indices ); - this.addAttribute( 'position', vertices ); - this.addAttribute( 'normal', normals ); - this.addAttribute( 'uv', uvs ); - - // this function calculates the current position on the torus curve - - function calculatePositionOnCurve( u, p, q, radius, position ) { - - var cu = Math.cos( u ); - var su = Math.sin( u ); - var quOverP = q / p * u; - var cs = Math.cos( quOverP ); - - position.x = radius * ( 2 + cs ) * 0.5 * cu; - position.y = radius * ( 2 + cs ) * su * 0.5; - position.z = radius * Math.sin( quOverP ) * 0.5; - - } - - } - - TorusKnotBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - TorusKnotBufferGeometry.prototype.constructor = TorusKnotBufferGeometry; - - /** - * @author oosmoxiecode - */ - - function TorusKnotGeometry( radius, tube, tubularSegments, radialSegments, p, q, heightScale ) { - - Geometry.call( this ); - - this.type = 'TorusKnotGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - tubularSegments: tubularSegments, - radialSegments: radialSegments, - p: p, - q: q - }; - - if( heightScale !== undefined ) console.warn( 'THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.' ); - - this.fromBufferGeometry( new TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q ) ); - this.mergeVertices(); - - } - - TorusKnotGeometry.prototype = Object.create( Geometry.prototype ); - TorusKnotGeometry.prototype.constructor = TorusKnotGeometry; - - /** - * @author Mugen87 / https://github.com/Mugen87 - */ - - function TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc ) { - - BufferGeometry.call( this ); - - this.type = 'TorusBufferGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - radialSegments: radialSegments, - tubularSegments: tubularSegments, - arc: arc - }; - - radius = radius || 100; - tube = tube || 40; - radialSegments = Math.floor( radialSegments ) || 8; - tubularSegments = Math.floor( tubularSegments ) || 6; - arc = arc || Math.PI * 2; - - // used to calculate buffer length - var vertexCount = ( ( radialSegments + 1 ) * ( tubularSegments + 1 ) ); - var indexCount = radialSegments * tubularSegments * 2 * 3; - - // buffers - var indices = new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ); - var vertices = new Float32Array( vertexCount * 3 ); - var normals = new Float32Array( vertexCount * 3 ); - var uvs = new Float32Array( vertexCount * 2 ); - - // offset variables - var vertexBufferOffset = 0; - var uvBufferOffset = 0; - var indexBufferOffset = 0; - - // helper variables - var center = new Vector3(); - var vertex = new Vector3(); - var normal = new Vector3(); - - var j, i; - - // generate vertices, normals and uvs - - for ( j = 0; j <= radialSegments; j ++ ) { - - for ( i = 0; i <= tubularSegments; i ++ ) { - - var u = i / tubularSegments * arc; - var v = j / radialSegments * Math.PI * 2; - - // vertex - vertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u ); - vertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u ); - vertex.z = tube * Math.sin( v ); - - vertices[ vertexBufferOffset ] = vertex.x; - vertices[ vertexBufferOffset + 1 ] = vertex.y; - vertices[ vertexBufferOffset + 2 ] = vertex.z; - - // this vector is used to calculate the normal - center.x = radius * Math.cos( u ); - center.y = radius * Math.sin( u ); - - // normal - normal.subVectors( vertex, center ).normalize(); - - normals[ vertexBufferOffset ] = normal.x; - normals[ vertexBufferOffset + 1 ] = normal.y; - normals[ vertexBufferOffset + 2 ] = normal.z; - - // uv - uvs[ uvBufferOffset ] = i / tubularSegments; - uvs[ uvBufferOffset + 1 ] = j / radialSegments; - - // update offsets - vertexBufferOffset += 3; - uvBufferOffset += 2; - - } - - } - - // generate indices - - for ( j = 1; j <= radialSegments; j ++ ) { - - for ( i = 1; i <= tubularSegments; i ++ ) { - - // indices - var a = ( tubularSegments + 1 ) * j + i - 1; - var b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1; - var c = ( tubularSegments + 1 ) * ( j - 1 ) + i; - var d = ( tubularSegments + 1 ) * j + i; - - // face one - indices[ indexBufferOffset ] = a; - indices[ indexBufferOffset + 1 ] = b; - indices[ indexBufferOffset + 2 ] = d; - - // face two - indices[ indexBufferOffset + 3 ] = b; - indices[ indexBufferOffset + 4 ] = c; - indices[ indexBufferOffset + 5 ] = d; - - // update offset - indexBufferOffset += 6; - - } - - } - - // build geometry - this.setIndex( new BufferAttribute( indices, 1 ) ); - this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - - } - - TorusBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - TorusBufferGeometry.prototype.constructor = TorusBufferGeometry; - - /** - * @author oosmoxiecode - * @author mrdoob / http://mrdoob.com/ - * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888 - */ - - function TorusGeometry( radius, tube, radialSegments, tubularSegments, arc ) { - - Geometry.call( this ); - - this.type = 'TorusGeometry'; - - this.parameters = { - radius: radius, - tube: tube, - radialSegments: radialSegments, - tubularSegments: tubularSegments, - arc: arc - }; - - this.fromBufferGeometry( new TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc ) ); - - } - - TorusGeometry.prototype = Object.create( Geometry.prototype ); - TorusGeometry.prototype.constructor = TorusGeometry; - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - - exports.ShapeUtils = { - - // calculate area of the contour polygon - - area: function ( contour ) { - - var n = contour.length; - var a = 0.0; - - for ( var p = n - 1, q = 0; q < n; p = q ++ ) { - - a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y; - - } - - return a * 0.5; - - }, - - triangulate: ( function () { - - /** - * This code is a quick port of code written in C++ which was submitted to - * flipcode.com by John W. Ratcliff // July 22, 2000 - * See original code and more information here: - * http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml - * - * ported to actionscript by Zevan Rosser - * www.actionsnippet.com - * - * ported to javascript by Joshua Koo - * http://www.lab4games.net/zz85/blog - * - */ - - function snip( contour, u, v, w, n, verts ) { - - var p; - var ax, ay, bx, by; - var cx, cy, px, py; - - ax = contour[ verts[ u ] ].x; - ay = contour[ verts[ u ] ].y; - - bx = contour[ verts[ v ] ].x; - by = contour[ verts[ v ] ].y; - - cx = contour[ verts[ w ] ].x; - cy = contour[ verts[ w ] ].y; - - if ( Number.EPSILON > ( ( ( bx - ax ) * ( cy - ay ) ) - ( ( by - ay ) * ( cx - ax ) ) ) ) return false; - - var aX, aY, bX, bY, cX, cY; - var apx, apy, bpx, bpy, cpx, cpy; - var cCROSSap, bCROSScp, aCROSSbp; - - aX = cx - bx; aY = cy - by; - bX = ax - cx; bY = ay - cy; - cX = bx - ax; cY = by - ay; - - for ( p = 0; p < n; p ++ ) { - - px = contour[ verts[ p ] ].x; - py = contour[ verts[ p ] ].y; - - if ( ( ( px === ax ) && ( py === ay ) ) || - ( ( px === bx ) && ( py === by ) ) || - ( ( px === cx ) && ( py === cy ) ) ) continue; - - apx = px - ax; apy = py - ay; - bpx = px - bx; bpy = py - by; - cpx = px - cx; cpy = py - cy; - - // see if p is inside triangle abc - - aCROSSbp = aX * bpy - aY * bpx; - cCROSSap = cX * apy - cY * apx; - bCROSScp = bX * cpy - bY * cpx; - - if ( ( aCROSSbp >= - Number.EPSILON ) && ( bCROSScp >= - Number.EPSILON ) && ( cCROSSap >= - Number.EPSILON ) ) return false; - - } - - return true; - - } - - // takes in an contour array and returns - - return function triangulate( contour, indices ) { - - var n = contour.length; - - if ( n < 3 ) return null; - - var result = [], - verts = [], - vertIndices = []; - - /* we want a counter-clockwise polygon in verts */ - - var u, v, w; - - if ( exports.ShapeUtils.area( contour ) > 0.0 ) { - - for ( v = 0; v < n; v ++ ) verts[ v ] = v; - - } else { - - for ( v = 0; v < n; v ++ ) verts[ v ] = ( n - 1 ) - v; - - } - - var nv = n; - - /* remove nv - 2 vertices, creating 1 triangle every time */ - - var count = 2 * nv; /* error detection */ - - for ( v = nv - 1; nv > 2; ) { - - /* if we loop, it is probably a non-simple polygon */ - - if ( ( count -- ) <= 0 ) { - - //** Triangulate: ERROR - probable bad polygon! - - //throw ( "Warning, unable to triangulate polygon!" ); - //return null; - // Sometimes warning is fine, especially polygons are triangulated in reverse. - console.warn( 'THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()' ); - - if ( indices ) return vertIndices; - return result; - - } - - /* three consecutive vertices in current polygon, <u,v,w> */ - - u = v; if ( nv <= u ) u = 0; /* previous */ - v = u + 1; if ( nv <= v ) v = 0; /* new v */ - w = v + 1; if ( nv <= w ) w = 0; /* next */ - - if ( snip( contour, u, v, w, nv, verts ) ) { - - var a, b, c, s, t; - - /* true names of the vertices */ - - a = verts[ u ]; - b = verts[ v ]; - c = verts[ w ]; - - /* output Triangle */ - - result.push( [ contour[ a ], - contour[ b ], - contour[ c ] ] ); - - - vertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] ); - - /* remove v from the remaining polygon */ - - for ( s = v, t = v + 1; t < nv; s ++, t ++ ) { - - verts[ s ] = verts[ t ]; - - } - - nv --; - - /* reset error detection counter */ - - count = 2 * nv; - - } - - } - - if ( indices ) return vertIndices; - return result; - - } - - } )(), - - triangulateShape: function ( contour, holes ) { - - function removeDupEndPts(points) { - - var l = points.length; - - if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) { - - points.pop(); - - } - - } - - removeDupEndPts( contour ); - holes.forEach( removeDupEndPts ); - - function point_in_segment_2D_colin( inSegPt1, inSegPt2, inOtherPt ) { - - // inOtherPt needs to be collinear to the inSegment - if ( inSegPt1.x !== inSegPt2.x ) { - - if ( inSegPt1.x < inSegPt2.x ) { - - return ( ( inSegPt1.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt2.x ) ); - - } else { - - return ( ( inSegPt2.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt1.x ) ); - - } - - } else { - - if ( inSegPt1.y < inSegPt2.y ) { - - return ( ( inSegPt1.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt2.y ) ); - - } else { - - return ( ( inSegPt2.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt1.y ) ); - - } - - } - - } - - function intersect_segments_2D( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1, inSeg2Pt2, inExcludeAdjacentSegs ) { - - var seg1dx = inSeg1Pt2.x - inSeg1Pt1.x, seg1dy = inSeg1Pt2.y - inSeg1Pt1.y; - var seg2dx = inSeg2Pt2.x - inSeg2Pt1.x, seg2dy = inSeg2Pt2.y - inSeg2Pt1.y; - - var seg1seg2dx = inSeg1Pt1.x - inSeg2Pt1.x; - var seg1seg2dy = inSeg1Pt1.y - inSeg2Pt1.y; - - var limit = seg1dy * seg2dx - seg1dx * seg2dy; - var perpSeg1 = seg1dy * seg1seg2dx - seg1dx * seg1seg2dy; - - if ( Math.abs( limit ) > Number.EPSILON ) { - - // not parallel - - var perpSeg2; - if ( limit > 0 ) { - - if ( ( perpSeg1 < 0 ) || ( perpSeg1 > limit ) ) return []; - perpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy; - if ( ( perpSeg2 < 0 ) || ( perpSeg2 > limit ) ) return []; - - } else { - - if ( ( perpSeg1 > 0 ) || ( perpSeg1 < limit ) ) return []; - perpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy; - if ( ( perpSeg2 > 0 ) || ( perpSeg2 < limit ) ) return []; - - } - - // i.e. to reduce rounding errors - // intersection at endpoint of segment#1? - if ( perpSeg2 === 0 ) { - - if ( ( inExcludeAdjacentSegs ) && - ( ( perpSeg1 === 0 ) || ( perpSeg1 === limit ) ) ) return []; - return [ inSeg1Pt1 ]; - - } - if ( perpSeg2 === limit ) { - - if ( ( inExcludeAdjacentSegs ) && - ( ( perpSeg1 === 0 ) || ( perpSeg1 === limit ) ) ) return []; - return [ inSeg1Pt2 ]; - - } - // intersection at endpoint of segment#2? - if ( perpSeg1 === 0 ) return [ inSeg2Pt1 ]; - if ( perpSeg1 === limit ) return [ inSeg2Pt2 ]; - - // return real intersection point - var factorSeg1 = perpSeg2 / limit; - return [ { x: inSeg1Pt1.x + factorSeg1 * seg1dx, - y: inSeg1Pt1.y + factorSeg1 * seg1dy } ]; - - } else { - - // parallel or collinear - if ( ( perpSeg1 !== 0 ) || - ( seg2dy * seg1seg2dx !== seg2dx * seg1seg2dy ) ) return []; - - // they are collinear or degenerate - var seg1Pt = ( ( seg1dx === 0 ) && ( seg1dy === 0 ) ); // segment1 is just a point? - var seg2Pt = ( ( seg2dx === 0 ) && ( seg2dy === 0 ) ); // segment2 is just a point? - // both segments are points - if ( seg1Pt && seg2Pt ) { - - if ( ( inSeg1Pt1.x !== inSeg2Pt1.x ) || - ( inSeg1Pt1.y !== inSeg2Pt1.y ) ) return []; // they are distinct points - return [ inSeg1Pt1 ]; // they are the same point - - } - // segment#1 is a single point - if ( seg1Pt ) { - - if ( ! point_in_segment_2D_colin( inSeg2Pt1, inSeg2Pt2, inSeg1Pt1 ) ) return []; // but not in segment#2 - return [ inSeg1Pt1 ]; - - } - // segment#2 is a single point - if ( seg2Pt ) { - - if ( ! point_in_segment_2D_colin( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1 ) ) return []; // but not in segment#1 - return [ inSeg2Pt1 ]; - - } - - // they are collinear segments, which might overlap - var seg1min, seg1max, seg1minVal, seg1maxVal; - var seg2min, seg2max, seg2minVal, seg2maxVal; - if ( seg1dx !== 0 ) { - - // the segments are NOT on a vertical line - if ( inSeg1Pt1.x < inSeg1Pt2.x ) { - - seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.x; - seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.x; - - } else { - - seg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.x; - seg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.x; - - } - if ( inSeg2Pt1.x < inSeg2Pt2.x ) { - - seg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.x; - seg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.x; - - } else { - - seg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.x; - seg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.x; - - } - - } else { - - // the segments are on a vertical line - if ( inSeg1Pt1.y < inSeg1Pt2.y ) { - - seg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.y; - seg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.y; - - } else { - - seg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.y; - seg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.y; - - } - if ( inSeg2Pt1.y < inSeg2Pt2.y ) { - - seg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.y; - seg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.y; - - } else { - - seg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.y; - seg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.y; - - } - - } - if ( seg1minVal <= seg2minVal ) { - - if ( seg1maxVal < seg2minVal ) return []; - if ( seg1maxVal === seg2minVal ) { - - if ( inExcludeAdjacentSegs ) return []; - return [ seg2min ]; - - } - if ( seg1maxVal <= seg2maxVal ) return [ seg2min, seg1max ]; - return [ seg2min, seg2max ]; - - } else { - - if ( seg1minVal > seg2maxVal ) return []; - if ( seg1minVal === seg2maxVal ) { - - if ( inExcludeAdjacentSegs ) return []; - return [ seg1min ]; - - } - if ( seg1maxVal <= seg2maxVal ) return [ seg1min, seg1max ]; - return [ seg1min, seg2max ]; - - } - - } - - } - - function isPointInsideAngle( inVertex, inLegFromPt, inLegToPt, inOtherPt ) { - - // The order of legs is important - - // translation of all points, so that Vertex is at (0,0) - var legFromPtX = inLegFromPt.x - inVertex.x, legFromPtY = inLegFromPt.y - inVertex.y; - var legToPtX = inLegToPt.x - inVertex.x, legToPtY = inLegToPt.y - inVertex.y; - var otherPtX = inOtherPt.x - inVertex.x, otherPtY = inOtherPt.y - inVertex.y; - - // main angle >0: < 180 deg.; 0: 180 deg.; <0: > 180 deg. - var from2toAngle = legFromPtX * legToPtY - legFromPtY * legToPtX; - var from2otherAngle = legFromPtX * otherPtY - legFromPtY * otherPtX; - - if ( Math.abs( from2toAngle ) > Number.EPSILON ) { - - // angle != 180 deg. - - var other2toAngle = otherPtX * legToPtY - otherPtY * legToPtX; - // console.log( "from2to: " + from2toAngle + ", from2other: " + from2otherAngle + ", other2to: " + other2toAngle ); - - if ( from2toAngle > 0 ) { - - // main angle < 180 deg. - return ( ( from2otherAngle >= 0 ) && ( other2toAngle >= 0 ) ); - - } else { - - // main angle > 180 deg. - return ( ( from2otherAngle >= 0 ) || ( other2toAngle >= 0 ) ); - - } - - } else { - - // angle == 180 deg. - // console.log( "from2to: 180 deg., from2other: " + from2otherAngle ); - return ( from2otherAngle > 0 ); - - } - - } - - - function removeHoles( contour, holes ) { - - var shape = contour.concat(); // work on this shape - var hole; - - function isCutLineInsideAngles( inShapeIdx, inHoleIdx ) { - - // Check if hole point lies within angle around shape point - var lastShapeIdx = shape.length - 1; - - var prevShapeIdx = inShapeIdx - 1; - if ( prevShapeIdx < 0 ) prevShapeIdx = lastShapeIdx; - - var nextShapeIdx = inShapeIdx + 1; - if ( nextShapeIdx > lastShapeIdx ) nextShapeIdx = 0; - - var insideAngle = isPointInsideAngle( shape[ inShapeIdx ], shape[ prevShapeIdx ], shape[ nextShapeIdx ], hole[ inHoleIdx ] ); - if ( ! insideAngle ) { - - // console.log( "Vertex (Shape): " + inShapeIdx + ", Point: " + hole[inHoleIdx].x + "/" + hole[inHoleIdx].y ); - return false; - - } - - // Check if shape point lies within angle around hole point - var lastHoleIdx = hole.length - 1; - - var prevHoleIdx = inHoleIdx - 1; - if ( prevHoleIdx < 0 ) prevHoleIdx = lastHoleIdx; - - var nextHoleIdx = inHoleIdx + 1; - if ( nextHoleIdx > lastHoleIdx ) nextHoleIdx = 0; - - insideAngle = isPointInsideAngle( hole[ inHoleIdx ], hole[ prevHoleIdx ], hole[ nextHoleIdx ], shape[ inShapeIdx ] ); - if ( ! insideAngle ) { - - // console.log( "Vertex (Hole): " + inHoleIdx + ", Point: " + shape[inShapeIdx].x + "/" + shape[inShapeIdx].y ); - return false; - - } - - return true; - - } - - function intersectsShapeEdge( inShapePt, inHolePt ) { - - // checks for intersections with shape edges - var sIdx, nextIdx, intersection; - for ( sIdx = 0; sIdx < shape.length; sIdx ++ ) { - - nextIdx = sIdx + 1; nextIdx %= shape.length; - intersection = intersect_segments_2D( inShapePt, inHolePt, shape[ sIdx ], shape[ nextIdx ], true ); - if ( intersection.length > 0 ) return true; - - } - - return false; - - } - - var indepHoles = []; - - function intersectsHoleEdge( inShapePt, inHolePt ) { - - // checks for intersections with hole edges - var ihIdx, chkHole, - hIdx, nextIdx, intersection; - for ( ihIdx = 0; ihIdx < indepHoles.length; ihIdx ++ ) { - - chkHole = holes[ indepHoles[ ihIdx ]]; - for ( hIdx = 0; hIdx < chkHole.length; hIdx ++ ) { - - nextIdx = hIdx + 1; nextIdx %= chkHole.length; - intersection = intersect_segments_2D( inShapePt, inHolePt, chkHole[ hIdx ], chkHole[ nextIdx ], true ); - if ( intersection.length > 0 ) return true; - - } - - } - return false; - - } - - var holeIndex, shapeIndex, - shapePt, holePt, - holeIdx, cutKey, failedCuts = [], - tmpShape1, tmpShape2, - tmpHole1, tmpHole2; - - for ( var h = 0, hl = holes.length; h < hl; h ++ ) { - - indepHoles.push( h ); - - } - - var minShapeIndex = 0; - var counter = indepHoles.length * 2; - while ( indepHoles.length > 0 ) { - - counter --; - if ( counter < 0 ) { - - console.log( "Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!" ); - break; - - } - - // search for shape-vertex and hole-vertex, - // which can be connected without intersections - for ( shapeIndex = minShapeIndex; shapeIndex < shape.length; shapeIndex ++ ) { - - shapePt = shape[ shapeIndex ]; - holeIndex = - 1; - - // search for hole which can be reached without intersections - for ( var h = 0; h < indepHoles.length; h ++ ) { - - holeIdx = indepHoles[ h ]; - - // prevent multiple checks - cutKey = shapePt.x + ":" + shapePt.y + ":" + holeIdx; - if ( failedCuts[ cutKey ] !== undefined ) continue; - - hole = holes[ holeIdx ]; - for ( var h2 = 0; h2 < hole.length; h2 ++ ) { - - holePt = hole[ h2 ]; - if ( ! isCutLineInsideAngles( shapeIndex, h2 ) ) continue; - if ( intersectsShapeEdge( shapePt, holePt ) ) continue; - if ( intersectsHoleEdge( shapePt, holePt ) ) continue; - - holeIndex = h2; - indepHoles.splice( h, 1 ); - - tmpShape1 = shape.slice( 0, shapeIndex + 1 ); - tmpShape2 = shape.slice( shapeIndex ); - tmpHole1 = hole.slice( holeIndex ); - tmpHole2 = hole.slice( 0, holeIndex + 1 ); - - shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 ); - - minShapeIndex = shapeIndex; - - // Debug only, to show the selected cuts - // glob_CutLines.push( [ shapePt, holePt ] ); - - break; - - } - if ( holeIndex >= 0 ) break; // hole-vertex found - - failedCuts[ cutKey ] = true; // remember failure - - } - if ( holeIndex >= 0 ) break; // hole-vertex found - - } - - } - - return shape; /* shape with no holes */ - - } - - - var i, il, f, face, - key, index, - allPointsMap = {}; - - // To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first. - - var allpoints = contour.concat(); - - for ( var h = 0, hl = holes.length; h < hl; h ++ ) { - - Array.prototype.push.apply( allpoints, holes[ h ] ); - - } - - //console.log( "allpoints",allpoints, allpoints.length ); - - // prepare all points map - - for ( i = 0, il = allpoints.length; i < il; i ++ ) { - - key = allpoints[ i ].x + ":" + allpoints[ i ].y; - - if ( allPointsMap[ key ] !== undefined ) { - - console.warn( "THREE.ShapeUtils: Duplicate point", key, i ); - - } - - allPointsMap[ key ] = i; - - } - - // remove holes by cutting paths to holes and adding them to the shape - var shapeWithoutHoles = removeHoles( contour, holes ); - - var triangles = exports.ShapeUtils.triangulate( shapeWithoutHoles, false ); // True returns indices for points of spooled shape - //console.log( "triangles",triangles, triangles.length ); - - // check all face vertices against all points map - - for ( i = 0, il = triangles.length; i < il; i ++ ) { - - face = triangles[ i ]; - - for ( f = 0; f < 3; f ++ ) { - - key = face[ f ].x + ":" + face[ f ].y; - - index = allPointsMap[ key ]; - - if ( index !== undefined ) { - - face[ f ] = index; - - } - - } - - } - - return triangles.concat(); - - }, - - isClockWise: function ( pts ) { - - return exports.ShapeUtils.area( pts ) < 0; - - }, - - // Bezier Curves formulas obtained from - // http://en.wikipedia.org/wiki/B%C3%A9zier_curve - - // Quad Bezier Functions - - b2: ( function () { - - function b2p0( t, p ) { - - var k = 1 - t; - return k * k * p; - - } - - function b2p1( t, p ) { - - return 2 * ( 1 - t ) * t * p; - - } - - function b2p2( t, p ) { - - return t * t * p; - - } - - return function b2( t, p0, p1, p2 ) { - - return b2p0( t, p0 ) + b2p1( t, p1 ) + b2p2( t, p2 ); - - }; - - } )(), - - // Cubic Bezier Functions - - b3: ( function () { - - function b3p0( t, p ) { - - var k = 1 - t; - return k * k * k * p; - - } - - function b3p1( t, p ) { - - var k = 1 - t; - return 3 * k * k * t * p; - - } - - function b3p2( t, p ) { - - var k = 1 - t; - return 3 * k * t * t * p; - - } - - function b3p3( t, p ) { - - return t * t * t * p; - - } - - return function b3( t, p0, p1, p2, p3 ) { - - return b3p0( t, p0 ) + b3p1( t, p1 ) + b3p2( t, p2 ) + b3p3( t, p3 ); - - }; - - } )() - - }; - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - * - * Creates extruded geometry from a path shape. - * - * parameters = { - * - * curveSegments: <int>, // number of points on the curves - * steps: <int>, // number of points for z-side extrusions / used for subdividing segments of extrude spline too - * amount: <int>, // Depth to extrude the shape - * - * bevelEnabled: <bool>, // turn on bevel - * bevelThickness: <float>, // how deep into the original shape bevel goes - * bevelSize: <float>, // how far from shape outline is bevel - * bevelSegments: <int>, // number of bevel layers - * - * extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined) - * frames: <THREE.TubeGeometry.FrenetFrames> // containing arrays of tangents, normals, binormals - * - * uvGenerator: <Object> // object that provides UV generator functions - * - * } - **/ - - function ExtrudeGeometry( shapes, options ) { - - if ( typeof( shapes ) === "undefined" ) { - - shapes = []; - return; - - } - - Geometry.call( this ); - - this.type = 'ExtrudeGeometry'; - - shapes = Array.isArray( shapes ) ? shapes : [ shapes ]; - - this.addShapeList( shapes, options ); - - this.computeFaceNormals(); - - // can't really use automatic vertex normals - // as then front and back sides get smoothed too - // should do separate smoothing just for sides - - //this.computeVertexNormals(); - - //console.log( "took", ( Date.now() - startTime ) ); - - } - - ExtrudeGeometry.prototype = Object.create( Geometry.prototype ); - ExtrudeGeometry.prototype.constructor = ExtrudeGeometry; - - ExtrudeGeometry.prototype.addShapeList = function ( shapes, options ) { - - var sl = shapes.length; - - for ( var s = 0; s < sl; s ++ ) { - - var shape = shapes[ s ]; - this.addShape( shape, options ); - - } - - }; - - ExtrudeGeometry.prototype.addShape = function ( shape, options ) { - - var amount = options.amount !== undefined ? options.amount : 100; - - var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; // 10 - var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; // 8 - var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3; - - var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false - - var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - - var steps = options.steps !== undefined ? options.steps : 1; - - var extrudePath = options.extrudePath; - var extrudePts, extrudeByPath = false; - - // Use default WorldUVGenerator if no UV generators are specified. - var uvgen = options.UVGenerator !== undefined ? options.UVGenerator : ExtrudeGeometry.WorldUVGenerator; - - var splineTube, binormal, normal, position2; - if ( extrudePath ) { - - extrudePts = extrudePath.getSpacedPoints( steps ); - - extrudeByPath = true; - bevelEnabled = false; // bevels not supported for path extrusion - - // SETUP TNB variables - - // Reuse TNB from TubeGeomtry for now. - // TODO1 - have a .isClosed in spline? - - splineTube = options.frames !== undefined ? options.frames : new TubeGeometry.FrenetFrames( extrudePath, steps, false ); - - // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); - - binormal = new Vector3(); - normal = new Vector3(); - position2 = new Vector3(); - - } - - // Safeguards if bevels are not enabled - - if ( ! bevelEnabled ) { - - bevelSegments = 0; - bevelThickness = 0; - bevelSize = 0; - - } - - // Variables initialization - - var ahole, h, hl; // looping of holes - var scope = this; - - var shapesOffset = this.vertices.length; - - var shapePoints = shape.extractPoints( curveSegments ); - - var vertices = shapePoints.shape; - var holes = shapePoints.holes; - - var reverse = ! exports.ShapeUtils.isClockWise( vertices ); - - if ( reverse ) { - - vertices = vertices.reverse(); - - // Maybe we should also check if holes are in the opposite direction, just to be safe ... - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - if ( exports.ShapeUtils.isClockWise( ahole ) ) { - - holes[ h ] = ahole.reverse(); - - } - - } - - reverse = false; // If vertices are in order now, we shouldn't need to worry about them again (hopefully)! - - } - - - var faces = exports.ShapeUtils.triangulateShape( vertices, holes ); - - /* Vertices */ - - var contour = vertices; // vertices has all points but contour has only points of circumference - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - vertices = vertices.concat( ahole ); - - } - - - function scalePt2( pt, vec, size ) { - - if ( ! vec ) console.error( "THREE.ExtrudeGeometry: vec does not exist" ); - - return vec.clone().multiplyScalar( size ).add( pt ); - - } - - var b, bs, t, z, - vert, vlen = vertices.length, - face, flen = faces.length; - - - // Find directions for point movement - - - function getBevelVec( inPt, inPrev, inNext ) { - - // computes for inPt the corresponding point inPt' on a new contour - // shifted by 1 unit (length of normalized vector) to the left - // if we walk along contour clockwise, this new contour is outside the old one - // - // inPt' is the intersection of the two lines parallel to the two - // adjacent edges of inPt at a distance of 1 unit on the left side. - - var v_trans_x, v_trans_y, shrink_by = 1; // resulting translation vector for inPt - - // good reading for geometry algorithms (here: line-line intersection) - // http://geomalgorithms.com/a05-_intersect-1.html - - var v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y; - var v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y; - - var v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y ); - - // check for collinear edges - var collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - if ( Math.abs( collinear0 ) > Number.EPSILON ) { - - // not collinear - - // length of vectors for normalizing - - var v_prev_len = Math.sqrt( v_prev_lensq ); - var v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y ); - - // shift adjacent points by unit vectors to the left - - var ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len ); - var ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len ); - - var ptNextShift_x = ( inNext.x - v_next_y / v_next_len ); - var ptNextShift_y = ( inNext.y + v_next_x / v_next_len ); - - // scaling factor for v_prev to intersection point - - var sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y - - ( ptNextShift_y - ptPrevShift_y ) * v_next_x ) / - ( v_prev_x * v_next_y - v_prev_y * v_next_x ); - - // vector from inPt to intersection point - - v_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x ); - v_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y ); - - // Don't normalize!, otherwise sharp corners become ugly - // but prevent crazy spikes - var v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y ); - if ( v_trans_lensq <= 2 ) { - - return new Vector2( v_trans_x, v_trans_y ); - - } else { - - shrink_by = Math.sqrt( v_trans_lensq / 2 ); - - } - - } else { - - // handle special case of collinear edges - - var direction_eq = false; // assumes: opposite - if ( v_prev_x > Number.EPSILON ) { - - if ( v_next_x > Number.EPSILON ) { - - direction_eq = true; - - } - - } else { - - if ( v_prev_x < - Number.EPSILON ) { - - if ( v_next_x < - Number.EPSILON ) { - - direction_eq = true; - - } - - } else { - - if ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) { - - direction_eq = true; - - } - - } - - } - - if ( direction_eq ) { - - // console.log("Warning: lines are a straight sequence"); - v_trans_x = - v_prev_y; - v_trans_y = v_prev_x; - shrink_by = Math.sqrt( v_prev_lensq ); - - } else { - - // console.log("Warning: lines are a straight spike"); - v_trans_x = v_prev_x; - v_trans_y = v_prev_y; - shrink_by = Math.sqrt( v_prev_lensq / 2 ); - - } - - } - - return new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by ); - - } - - - var contourMovements = []; - - for ( var i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - // console.log('i,j,k', i, j , k) - - contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] ); - - } - - var holesMovements = [], oneHoleMovements, verticesMovements = contourMovements.concat(); - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - - oneHoleMovements = []; - - for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - - if ( j === il ) j = 0; - if ( k === il ) k = 0; - - // (j)---(i)---(k) - oneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] ); - - } - - holesMovements.push( oneHoleMovements ); - verticesMovements = verticesMovements.concat( oneHoleMovements ); - - } - - - // Loop bevelSegments, 1 for the front, 1 for the back - - for ( b = 0; b < bevelSegments; b ++ ) { - - //for ( b = bevelSegments; b > 0; b -- ) { - - t = b / bevelSegments; - z = bevelThickness * Math.cos( t * Math.PI / 2 ); - bs = bevelSize * Math.sin( t * Math.PI / 2 ); - - // contract shape - - for ( i = 0, il = contour.length; i < il; i ++ ) { - - vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - - v( vert.x, vert.y, - z ); - - } - - // expand holes - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( i = 0, il = ahole.length; i < il; i ++ ) { - - vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - v( vert.x, vert.y, - z ); - - } - - } - - } - - bs = bevelSize; - - // Back facing vertices - - for ( i = 0; i < vlen; i ++ ) { - - vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, 0 ); - - } else { - - // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x ); - - normal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x ); - binormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y ); - - position2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal ); - - v( position2.x, position2.y, position2.z ); - - } - - } - - // Add stepped vertices... - // Including front facing vertices - - var s; - - for ( s = 1; s <= steps; s ++ ) { - - for ( i = 0; i < vlen; i ++ ) { - - vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ]; - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, amount / steps * s ); - - } else { - - // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x ); - - normal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x ); - binormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y ); - - position2.copy( extrudePts[ s ] ).add( normal ).add( binormal ); - - v( position2.x, position2.y, position2.z ); - - } - - } - - } - - - // Add bevel segments planes - - //for ( b = 1; b <= bevelSegments; b ++ ) { - for ( b = bevelSegments - 1; b >= 0; b -- ) { - - t = b / bevelSegments; - z = bevelThickness * Math.cos ( t * Math.PI / 2 ); - bs = bevelSize * Math.sin( t * Math.PI / 2 ); - - // contract shape - - for ( i = 0, il = contour.length; i < il; i ++ ) { - - vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); - v( vert.x, vert.y, amount + z ); - - } - - // expand holes - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - oneHoleMovements = holesMovements[ h ]; - - for ( i = 0, il = ahole.length; i < il; i ++ ) { - - vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); - - if ( ! extrudeByPath ) { - - v( vert.x, vert.y, amount + z ); - - } else { - - v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z ); - - } - - } - - } - - } - - /* Faces */ - - // Top and bottom faces - - buildLidFaces(); - - // Sides faces - - buildSideFaces(); - - - ///// Internal functions - - function buildLidFaces() { - - if ( bevelEnabled ) { - - var layer = 0; // steps + 1 - var offset = vlen * layer; - - // Bottom faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset ); - - } - - layer = steps + bevelSegments * 2; - offset = vlen * layer; - - // Top faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset ); - - } - - } else { - - // Bottom faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 2 ], face[ 1 ], face[ 0 ] ); - - } - - // Top faces - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps ); - - } - - } - - } - - // Create faces for the z-sides of the shape - - function buildSideFaces() { - - var layeroffset = 0; - sidewalls( contour, layeroffset ); - layeroffset += contour.length; - - for ( h = 0, hl = holes.length; h < hl; h ++ ) { - - ahole = holes[ h ]; - sidewalls( ahole, layeroffset ); - - //, true - layeroffset += ahole.length; - - } - - } - - function sidewalls( contour, layeroffset ) { - - var j, k; - i = contour.length; - - while ( -- i >= 0 ) { - - j = i; - k = i - 1; - if ( k < 0 ) k = contour.length - 1; - - //console.log('b', i,j, i-1, k,vertices.length); - - var s = 0, sl = steps + bevelSegments * 2; - - for ( s = 0; s < sl; s ++ ) { - - var slen1 = vlen * s; - var slen2 = vlen * ( s + 1 ); - - var a = layeroffset + j + slen1, - b = layeroffset + k + slen1, - c = layeroffset + k + slen2, - d = layeroffset + j + slen2; - - f4( a, b, c, d, contour, s, sl, j, k ); - - } - - } - - } - - - function v( x, y, z ) { - - scope.vertices.push( new Vector3( x, y, z ) ); - - } - - function f3( a, b, c ) { - - a += shapesOffset; - b += shapesOffset; - c += shapesOffset; - - scope.faces.push( new Face3( a, b, c, null, null, 0 ) ); - - var uvs = uvgen.generateTopUV( scope, a, b, c ); - - scope.faceVertexUvs[ 0 ].push( uvs ); - - } - - function f4( a, b, c, d, wallContour, stepIndex, stepsLength, contourIndex1, contourIndex2 ) { - - a += shapesOffset; - b += shapesOffset; - c += shapesOffset; - d += shapesOffset; - - scope.faces.push( new Face3( a, b, d, null, null, 1 ) ); - scope.faces.push( new Face3( b, c, d, null, null, 1 ) ); - - var uvs = uvgen.generateSideWallUV( scope, a, b, c, d ); - - scope.faceVertexUvs[ 0 ].push( [ uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] ] ); - scope.faceVertexUvs[ 0 ].push( [ uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] ] ); - - } - - }; - - ExtrudeGeometry.WorldUVGenerator = { - - generateTopUV: function ( geometry, indexA, indexB, indexC ) { - - var vertices = geometry.vertices; - - var a = vertices[ indexA ]; - var b = vertices[ indexB ]; - var c = vertices[ indexC ]; - - return [ - new Vector2( a.x, a.y ), - new Vector2( b.x, b.y ), - new Vector2( c.x, c.y ) - ]; - - }, - - generateSideWallUV: function ( geometry, indexA, indexB, indexC, indexD ) { - - var vertices = geometry.vertices; - - var a = vertices[ indexA ]; - var b = vertices[ indexB ]; - var c = vertices[ indexC ]; - var d = vertices[ indexD ]; - - if ( Math.abs( a.y - b.y ) < 0.01 ) { - - return [ - new Vector2( a.x, 1 - a.z ), - new Vector2( b.x, 1 - b.z ), - new Vector2( c.x, 1 - c.z ), - new Vector2( d.x, 1 - d.z ) - ]; - - } else { - - return [ - new Vector2( a.y, 1 - a.z ), - new Vector2( b.y, 1 - b.z ), - new Vector2( c.y, 1 - c.z ), - new Vector2( d.y, 1 - d.z ) - ]; - - } - - } - }; - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author alteredq / http://alteredqualia.com/ - * - * Text = 3D Text - * - * parameters = { - * font: <THREE.Font>, // font - * - * size: <float>, // size of the text - * height: <float>, // thickness to extrude text - * curveSegments: <int>, // number of points on the curves - * - * bevelEnabled: <bool>, // turn on bevel - * bevelThickness: <float>, // how deep into text bevel goes - * bevelSize: <float> // how far from text outline is bevel - * } - */ - - function TextGeometry( text, parameters ) { - - parameters = parameters || {}; - - var font = parameters.font; - - if ( (font && font.isFont) === false ) { - - console.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' ); - return new Geometry(); - - } - - var shapes = font.generateShapes( text, parameters.size, parameters.curveSegments ); - - // translate parameters to ExtrudeGeometry API - - parameters.amount = parameters.height !== undefined ? parameters.height : 50; - - // defaults - - if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10; - if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; - if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; - - ExtrudeGeometry.call( this, shapes, parameters ); - - this.type = 'TextGeometry'; - - } - - TextGeometry.prototype = Object.create( ExtrudeGeometry.prototype ); - TextGeometry.prototype.constructor = TextGeometry; - - /** - * @author benaadams / https://twitter.com/ben_a_adams - * based on THREE.SphereGeometry - */ - - function SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) { - - BufferGeometry.call( this ); - - this.type = 'SphereBufferGeometry'; - - this.parameters = { - radius: radius, - widthSegments: widthSegments, - heightSegments: heightSegments, - phiStart: phiStart, - phiLength: phiLength, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - radius = radius || 50; - - widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 ); - heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 ); - - phiStart = phiStart !== undefined ? phiStart : 0; - phiLength = phiLength !== undefined ? phiLength : Math.PI * 2; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI; - - var thetaEnd = thetaStart + thetaLength; - - var vertexCount = ( ( widthSegments + 1 ) * ( heightSegments + 1 ) ); - - var positions = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - var index = 0, vertices = [], normal = new Vector3(); - - for ( var y = 0; y <= heightSegments; y ++ ) { - - var verticesRow = []; - - var v = y / heightSegments; - - for ( var x = 0; x <= widthSegments; x ++ ) { - - var u = x / widthSegments; - - var px = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - var py = radius * Math.cos( thetaStart + v * thetaLength ); - var pz = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - - normal.set( px, py, pz ).normalize(); - - positions.setXYZ( index, px, py, pz ); - normals.setXYZ( index, normal.x, normal.y, normal.z ); - uvs.setXY( index, u, 1 - v ); - - verticesRow.push( index ); - - index ++; - - } - - vertices.push( verticesRow ); - - } - - var indices = []; - - for ( var y = 0; y < heightSegments; y ++ ) { - - for ( var x = 0; x < widthSegments; x ++ ) { - - var v1 = vertices[ y ][ x + 1 ]; - var v2 = vertices[ y ][ x ]; - var v3 = vertices[ y + 1 ][ x ]; - var v4 = vertices[ y + 1 ][ x + 1 ]; - - if ( y !== 0 || thetaStart > 0 ) indices.push( v1, v2, v4 ); - if ( y !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( v2, v3, v4 ); - - } - - } - - this.setIndex( new ( positions.count > 65535 ? Uint32Attribute : Uint16Attribute )( indices, 1 ) ); - this.addAttribute( 'position', positions ); - this.addAttribute( 'normal', normals ); - this.addAttribute( 'uv', uvs ); - - this.boundingSphere = new Sphere( new Vector3(), radius ); - - } - - SphereBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - SphereBufferGeometry.prototype.constructor = SphereBufferGeometry; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function SphereGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) { - - Geometry.call( this ); - - this.type = 'SphereGeometry'; - - this.parameters = { - radius: radius, - widthSegments: widthSegments, - heightSegments: heightSegments, - phiStart: phiStart, - phiLength: phiLength, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - this.fromBufferGeometry( new SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) ); - - } - - SphereGeometry.prototype = Object.create( Geometry.prototype ); - SphereGeometry.prototype.constructor = SphereGeometry; - - /** - * @author Mugen87 / https://github.com/Mugen87 - */ - - function RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) { - - BufferGeometry.call( this ); - - this.type = 'RingBufferGeometry'; - - this.parameters = { - innerRadius: innerRadius, - outerRadius: outerRadius, - thetaSegments: thetaSegments, - phiSegments: phiSegments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - innerRadius = innerRadius || 20; - outerRadius = outerRadius || 50; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - thetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8; - phiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 1; - - // these are used to calculate buffer length - var vertexCount = ( thetaSegments + 1 ) * ( phiSegments + 1 ); - var indexCount = thetaSegments * phiSegments * 2 * 3; - - // buffers - var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ) , 1 ); - var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - // some helper variables - var index = 0, indexOffset = 0, segment; - var radius = innerRadius; - var radiusStep = ( ( outerRadius - innerRadius ) / phiSegments ); - var vertex = new Vector3(); - var uv = new Vector2(); - var j, i; - - // generate vertices, normals and uvs - - // values are generate from the inside of the ring to the outside - - for ( j = 0; j <= phiSegments; j ++ ) { - - for ( i = 0; i <= thetaSegments; i ++ ) { - - segment = thetaStart + i / thetaSegments * thetaLength; - - // vertex - vertex.x = radius * Math.cos( segment ); - vertex.y = radius * Math.sin( segment ); - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // normal - normals.setXYZ( index, 0, 0, 1 ); - - // uv - uv.x = ( vertex.x / outerRadius + 1 ) / 2; - uv.y = ( vertex.y / outerRadius + 1 ) / 2; - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index++; - - } - - // increase the radius for next row of vertices - radius += radiusStep; - - } - - // generate indices - - for ( j = 0; j < phiSegments; j ++ ) { - - var thetaSegmentLevel = j * ( thetaSegments + 1 ); - - for ( i = 0; i < thetaSegments; i ++ ) { - - segment = i + thetaSegmentLevel; - - // indices - var a = segment; - var b = segment + thetaSegments + 1; - var c = segment + thetaSegments + 2; - var d = segment + 1; - - // face one - indices.setX( indexOffset, a ); indexOffset++; - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, c ); indexOffset++; - - // face two - indices.setX( indexOffset, a ); indexOffset++; - indices.setX( indexOffset, c ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - } - - } - - // build geometry - - this.setIndex( indices ); - this.addAttribute( 'position', vertices ); - this.addAttribute( 'normal', normals ); - this.addAttribute( 'uv', uvs ); - - } - - RingBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - RingBufferGeometry.prototype.constructor = RingBufferGeometry; - - /** - * @author Kaleb Murphy - */ - - function RingGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) { - - Geometry.call( this ); - - this.type = 'RingGeometry'; - - this.parameters = { - innerRadius: innerRadius, - outerRadius: outerRadius, - thetaSegments: thetaSegments, - phiSegments: phiSegments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - this.fromBufferGeometry( new RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) ); - - } - - RingGeometry.prototype = Object.create( Geometry.prototype ); - RingGeometry.prototype.constructor = RingGeometry; - - /** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - - function PlaneGeometry( width, height, widthSegments, heightSegments ) { - - Geometry.call( this ); - - this.type = 'PlaneGeometry'; - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments - }; - - this.fromBufferGeometry( new PlaneBufferGeometry( width, height, widthSegments, heightSegments ) ); - - } - - PlaneGeometry.prototype = Object.create( Geometry.prototype ); - PlaneGeometry.prototype.constructor = PlaneGeometry; - - /** - * @author Mugen87 / https://github.com/Mugen87 - */ - - // points - to create a closed torus, one must use a set of points - // like so: [ a, b, c, d, a ], see first is the same as last. - // segments - the number of circumference segments to create - // phiStart - the starting radian - // phiLength - the radian (0 to 2PI) range of the lathed section - // 2PI is a closed lathe, less than 2PI is a portion. - - function LatheBufferGeometry( points, segments, phiStart, phiLength ) { - - BufferGeometry.call( this ); - - this.type = 'LatheBufferGeometry'; - - this.parameters = { - points: points, - segments: segments, - phiStart: phiStart, - phiLength: phiLength - }; - - segments = Math.floor( segments ) || 12; - phiStart = phiStart || 0; - phiLength = phiLength || Math.PI * 2; - - // clamp phiLength so it's in range of [ 0, 2PI ] - phiLength = exports.Math.clamp( phiLength, 0, Math.PI * 2 ); - - // these are used to calculate buffer length - var vertexCount = ( segments + 1 ) * points.length; - var indexCount = segments * points.length * 2 * 3; - - // buffers - var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ) , 1 ); - var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - // helper variables - var index = 0, indexOffset = 0, base; - var inverseSegments = 1.0 / segments; - var vertex = new Vector3(); - var uv = new Vector2(); - var i, j; - - // generate vertices and uvs - - for ( i = 0; i <= segments; i ++ ) { - - var phi = phiStart + i * inverseSegments * phiLength; - - var sin = Math.sin( phi ); - var cos = Math.cos( phi ); - - for ( j = 0; j <= ( points.length - 1 ); j ++ ) { - - // vertex - vertex.x = points[ j ].x * sin; - vertex.y = points[ j ].y; - vertex.z = points[ j ].x * cos; - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // uv - uv.x = i / segments; - uv.y = j / ( points.length - 1 ); - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index ++; - - } - - } - - // generate indices - - for ( i = 0; i < segments; i ++ ) { - - for ( j = 0; j < ( points.length - 1 ); j ++ ) { - - base = j + i * points.length; - - // indices - var a = base; - var b = base + points.length; - var c = base + points.length + 1; - var d = base + 1; - - // face one - indices.setX( indexOffset, a ); indexOffset++; - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - // face two - indices.setX( indexOffset, b ); indexOffset++; - indices.setX( indexOffset, c ); indexOffset++; - indices.setX( indexOffset, d ); indexOffset++; - - } - - } - - // build geometry - - this.setIndex( indices ); - this.addAttribute( 'position', vertices ); - this.addAttribute( 'uv', uvs ); - - // generate normals - - this.computeVertexNormals(); - - // if the geometry is closed, we need to average the normals along the seam. - // because the corresponding vertices are identical (but still have different UVs). - - if( phiLength === Math.PI * 2 ) { - - var normals = this.attributes.normal.array; - var n1 = new Vector3(); - var n2 = new Vector3(); - var n = new Vector3(); - - // this is the buffer offset for the last line of vertices - base = segments * points.length * 3; - - for( i = 0, j = 0; i < points.length; i ++, j += 3 ) { - - // select the normal of the vertex in the first line - n1.x = normals[ j + 0 ]; - n1.y = normals[ j + 1 ]; - n1.z = normals[ j + 2 ]; - - // select the normal of the vertex in the last line - n2.x = normals[ base + j + 0 ]; - n2.y = normals[ base + j + 1 ]; - n2.z = normals[ base + j + 2 ]; - - // average normals - n.addVectors( n1, n2 ).normalize(); - - // assign the new values to both normals - normals[ j + 0 ] = normals[ base + j + 0 ] = n.x; - normals[ j + 1 ] = normals[ base + j + 1 ] = n.y; - normals[ j + 2 ] = normals[ base + j + 2 ] = n.z; - - } // next row - - } - - } - - LatheBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - LatheBufferGeometry.prototype.constructor = LatheBufferGeometry; - - /** - * @author astrodud / http://astrodud.isgreat.org/ - * @author zz85 / https://github.com/zz85 - * @author bhouston / http://clara.io - */ - - // points - to create a closed torus, one must use a set of points - // like so: [ a, b, c, d, a ], see first is the same as last. - // segments - the number of circumference segments to create - // phiStart - the starting radian - // phiLength - the radian (0 to 2PI) range of the lathed section - // 2PI is a closed lathe, less than 2PI is a portion. - - function LatheGeometry( points, segments, phiStart, phiLength ) { - - Geometry.call( this ); - - this.type = 'LatheGeometry'; - - this.parameters = { - points: points, - segments: segments, - phiStart: phiStart, - phiLength: phiLength - }; - - this.fromBufferGeometry( new LatheBufferGeometry( points, segments, phiStart, phiLength ) ); - this.mergeVertices(); - - } - - LatheGeometry.prototype = Object.create( Geometry.prototype ); - LatheGeometry.prototype.constructor = LatheGeometry; - - /** - * @author jonobr1 / http://jonobr1.com - * - * Creates a one-sided polygonal geometry from a path shape. Similar to - * ExtrudeGeometry. - * - * parameters = { - * - * curveSegments: <int>, // number of points on the curves. NOT USED AT THE MOMENT. - * - * material: <int> // material index for front and back faces - * uvGenerator: <Object> // object that provides UV generator functions - * - * } - **/ - - function ShapeGeometry( shapes, options ) { - - Geometry.call( this ); - - this.type = 'ShapeGeometry'; - - if ( Array.isArray( shapes ) === false ) shapes = [ shapes ]; - - this.addShapeList( shapes, options ); - - this.computeFaceNormals(); - - } - - ShapeGeometry.prototype = Object.create( Geometry.prototype ); - ShapeGeometry.prototype.constructor = ShapeGeometry; - - /** - * Add an array of shapes to THREE.ShapeGeometry. - */ - ShapeGeometry.prototype.addShapeList = function ( shapes, options ) { - - for ( var i = 0, l = shapes.length; i < l; i ++ ) { - - this.addShape( shapes[ i ], options ); - - } - - return this; - - }; - - /** - * Adds a shape to THREE.ShapeGeometry, based on THREE.ExtrudeGeometry. - */ - ShapeGeometry.prototype.addShape = function ( shape, options ) { - - if ( options === undefined ) options = {}; - var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - - var material = options.material; - var uvgen = options.UVGenerator === undefined ? ExtrudeGeometry.WorldUVGenerator : options.UVGenerator; - - // - - var i, l, hole; - - var shapesOffset = this.vertices.length; - var shapePoints = shape.extractPoints( curveSegments ); - - var vertices = shapePoints.shape; - var holes = shapePoints.holes; - - var reverse = ! exports.ShapeUtils.isClockWise( vertices ); - - if ( reverse ) { - - vertices = vertices.reverse(); - - // Maybe we should also check if holes are in the opposite direction, just to be safe... - - for ( i = 0, l = holes.length; i < l; i ++ ) { - - hole = holes[ i ]; - - if ( exports.ShapeUtils.isClockWise( hole ) ) { - - holes[ i ] = hole.reverse(); - - } - - } - - reverse = false; - - } - - var faces = exports.ShapeUtils.triangulateShape( vertices, holes ); - - // Vertices - - for ( i = 0, l = holes.length; i < l; i ++ ) { - - hole = holes[ i ]; - vertices = vertices.concat( hole ); - - } - - // - - var vert, vlen = vertices.length; - var face, flen = faces.length; - - for ( i = 0; i < vlen; i ++ ) { - - vert = vertices[ i ]; - - this.vertices.push( new Vector3( vert.x, vert.y, 0 ) ); - - } - - for ( i = 0; i < flen; i ++ ) { - - face = faces[ i ]; - - var a = face[ 0 ] + shapesOffset; - var b = face[ 1 ] + shapesOffset; - var c = face[ 2 ] + shapesOffset; - - this.faces.push( new Face3( a, b, c, null, null, material ) ); - this.faceVertexUvs[ 0 ].push( uvgen.generateTopUV( this, a, b, c ) ); - - } - - }; - - /** - * @author WestLangley / http://github.com/WestLangley - */ - - function EdgesGeometry( geometry, thresholdAngle ) { - - BufferGeometry.call( this ); - - thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1; - - var thresholdDot = Math.cos( exports.Math.DEG2RAD * thresholdAngle ); - - var edge = [ 0, 0 ], hash = {}; - - function sortFunction( a, b ) { - - return a - b; - - } - - var keys = [ 'a', 'b', 'c' ]; - - var geometry2; - - if ( (geometry && geometry.isBufferGeometry) ) { - - geometry2 = new Geometry(); - geometry2.fromBufferGeometry( geometry ); - - } else { - - geometry2 = geometry.clone(); - - } - - geometry2.mergeVertices(); - geometry2.computeFaceNormals(); - - var vertices = geometry2.vertices; - var faces = geometry2.faces; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0; j < 3; j ++ ) { - - edge[ 0 ] = face[ keys[ j ] ]; - edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ]; - edge.sort( sortFunction ); - - var key = edge.toString(); - - if ( hash[ key ] === undefined ) { - - hash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined }; - - } else { - - hash[ key ].face2 = i; - - } - - } - - } - - var coords = []; - - for ( var key in hash ) { - - var h = hash[ key ]; - - if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) { - - var vertex = vertices[ h.vert1 ]; - coords.push( vertex.x ); - coords.push( vertex.y ); - coords.push( vertex.z ); - - vertex = vertices[ h.vert2 ]; - coords.push( vertex.x ); - coords.push( vertex.y ); - coords.push( vertex.z ); - - } - - } - - this.addAttribute( 'position', new BufferAttribute( new Float32Array( coords ), 3 ) ); - - } - - EdgesGeometry.prototype = Object.create( BufferGeometry.prototype ); - EdgesGeometry.prototype.constructor = EdgesGeometry; - - /** - * @author Mugen87 / https://github.com/Mugen87 - */ - - function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) { - - BufferGeometry.call( this ); - - this.type = 'CylinderBufferGeometry'; - - this.parameters = { - radiusTop: radiusTop, - radiusBottom: radiusBottom, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - var scope = this; - - radiusTop = radiusTop !== undefined ? radiusTop : 20; - radiusBottom = radiusBottom !== undefined ? radiusBottom : 20; - height = height !== undefined ? height : 100; - - radialSegments = Math.floor( radialSegments ) || 8; - heightSegments = Math.floor( heightSegments ) || 1; - - openEnded = openEnded !== undefined ? openEnded : false; - thetaStart = thetaStart !== undefined ? thetaStart : 0.0; - thetaLength = thetaLength !== undefined ? thetaLength : 2.0 * Math.PI; - - // used to calculate buffer length - - var nbCap = 0; - - if ( openEnded === false ) { - - if ( radiusTop > 0 ) nbCap ++; - if ( radiusBottom > 0 ) nbCap ++; - - } - - var vertexCount = calculateVertexCount(); - var indexCount = calculateIndexCount(); - - // buffers - - var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ), 1 ); - var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 ); - var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 ); - - // helper variables - - var index = 0, - indexOffset = 0, - indexArray = [], - halfHeight = height / 2; - - // group variables - var groupStart = 0; - - // generate geometry - - generateTorso(); - - if ( openEnded === false ) { - - if ( radiusTop > 0 ) generateCap( true ); - if ( radiusBottom > 0 ) generateCap( false ); - - } - - // build geometry - - this.setIndex( indices ); - this.addAttribute( 'position', vertices ); - this.addAttribute( 'normal', normals ); - this.addAttribute( 'uv', uvs ); - - // helper functions - - function calculateVertexCount() { - - var count = ( radialSegments + 1 ) * ( heightSegments + 1 ); - - if ( openEnded === false ) { - - count += ( ( radialSegments + 1 ) * nbCap ) + ( radialSegments * nbCap ); - - } - - return count; - - } - - function calculateIndexCount() { - - var count = radialSegments * heightSegments * 2 * 3; - - if ( openEnded === false ) { - - count += radialSegments * nbCap * 3; - - } - - return count; - - } - - function generateTorso() { - - var x, y; - var normal = new Vector3(); - var vertex = new Vector3(); - - var groupCount = 0; - - // this will be used to calculate the normal - var slope = ( radiusBottom - radiusTop ) / height; - - // generate vertices, normals and uvs - - for ( y = 0; y <= heightSegments; y ++ ) { - - var indexRow = []; - - var v = y / heightSegments; - - // calculate the radius of the current row - var radius = v * ( radiusBottom - radiusTop ) + radiusTop; - - for ( x = 0; x <= radialSegments; x ++ ) { - - var u = x / radialSegments; - - var theta = u * thetaLength + thetaStart; - - var sinTheta = Math.sin( theta ); - var cosTheta = Math.cos( theta ); - - // vertex - vertex.x = radius * sinTheta; - vertex.y = - v * height + halfHeight; - vertex.z = radius * cosTheta; - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // normal - normal.set( sinTheta, slope, cosTheta ).normalize(); - normals.setXYZ( index, normal.x, normal.y, normal.z ); - - // uv - uvs.setXY( index, u, 1 - v ); - - // save index of vertex in respective row - indexRow.push( index ); - - // increase index - index ++; - - } - - // now save vertices of the row in our index array - indexArray.push( indexRow ); - - } - - // generate indices - - for ( x = 0; x < radialSegments; x ++ ) { - - for ( y = 0; y < heightSegments; y ++ ) { - - // we use the index array to access the correct indices - var i1 = indexArray[ y ][ x ]; - var i2 = indexArray[ y + 1 ][ x ]; - var i3 = indexArray[ y + 1 ][ x + 1 ]; - var i4 = indexArray[ y ][ x + 1 ]; - - // face one - indices.setX( indexOffset, i1 ); indexOffset ++; - indices.setX( indexOffset, i2 ); indexOffset ++; - indices.setX( indexOffset, i4 ); indexOffset ++; - - // face two - indices.setX( indexOffset, i2 ); indexOffset ++; - indices.setX( indexOffset, i3 ); indexOffset ++; - indices.setX( indexOffset, i4 ); indexOffset ++; - - // update counters - groupCount += 6; - - } - - } - - // add a group to the geometry. this will ensure multi material support - scope.addGroup( groupStart, groupCount, 0 ); - - // calculate new start value for groups - groupStart += groupCount; - - } - - function generateCap( top ) { - - var x, centerIndexStart, centerIndexEnd; - - var uv = new Vector2(); - var vertex = new Vector3(); - - var groupCount = 0; - - var radius = ( top === true ) ? radiusTop : radiusBottom; - var sign = ( top === true ) ? 1 : - 1; - - // save the index of the first center vertex - centerIndexStart = index; - - // first we generate the center vertex data of the cap. - // because the geometry needs one set of uvs per face, - // we must generate a center vertex per face/segment - - for ( x = 1; x <= radialSegments; x ++ ) { - - // vertex - vertices.setXYZ( index, 0, halfHeight * sign, 0 ); - - // normal - normals.setXYZ( index, 0, sign, 0 ); - - // uv - uv.x = 0.5; - uv.y = 0.5; - - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index ++; - - } - - // save the index of the last center vertex - centerIndexEnd = index; - - // now we generate the surrounding vertices, normals and uvs - - for ( x = 0; x <= radialSegments; x ++ ) { - - var u = x / radialSegments; - var theta = u * thetaLength + thetaStart; - - var cosTheta = Math.cos( theta ); - var sinTheta = Math.sin( theta ); - - // vertex - vertex.x = radius * sinTheta; - vertex.y = halfHeight * sign; - vertex.z = radius * cosTheta; - vertices.setXYZ( index, vertex.x, vertex.y, vertex.z ); - - // normal - normals.setXYZ( index, 0, sign, 0 ); - - // uv - uv.x = ( cosTheta * 0.5 ) + 0.5; - uv.y = ( sinTheta * 0.5 * sign ) + 0.5; - uvs.setXY( index, uv.x, uv.y ); - - // increase index - index ++; - - } - - // generate indices - - for ( x = 0; x < radialSegments; x ++ ) { - - var c = centerIndexStart + x; - var i = centerIndexEnd + x; - - if ( top === true ) { - - // face top - indices.setX( indexOffset, i ); indexOffset ++; - indices.setX( indexOffset, i + 1 ); indexOffset ++; - indices.setX( indexOffset, c ); indexOffset ++; - - } else { - - // face bottom - indices.setX( indexOffset, i + 1 ); indexOffset ++; - indices.setX( indexOffset, i ); indexOffset ++; - indices.setX( indexOffset, c ); indexOffset ++; - - } - - // update counters - groupCount += 3; - - } - - // add a group to the geometry. this will ensure multi material support - scope.addGroup( groupStart, groupCount, top === true ? 1 : 2 ); - - // calculate new start value for groups - groupStart += groupCount; - - } - - } - - CylinderBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - CylinderBufferGeometry.prototype.constructor = CylinderBufferGeometry; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function CylinderGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) { - - Geometry.call( this ); - - this.type = 'CylinderGeometry'; - - this.parameters = { - radiusTop: radiusTop, - radiusBottom: radiusBottom, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - this.fromBufferGeometry( new CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) ); - this.mergeVertices(); - - } - - CylinderGeometry.prototype = Object.create( Geometry.prototype ); - CylinderGeometry.prototype.constructor = CylinderGeometry; - - /** - * @author abelnation / http://github.com/abelnation - */ - - function ConeGeometry( - radius, height, - radialSegments, heightSegments, - openEnded, thetaStart, thetaLength ) { - - CylinderGeometry.call( this, - 0, radius, height, - radialSegments, heightSegments, - openEnded, thetaStart, thetaLength ); - - this.type = 'ConeGeometry'; - - this.parameters = { - radius: radius, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - openEnded: openEnded, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - } - - ConeGeometry.prototype = Object.create( CylinderGeometry.prototype ); - ConeGeometry.prototype.constructor = ConeGeometry; - - /* - * @author: abelnation / http://github.com/abelnation - */ - - function ConeBufferGeometry( - radius, height, - radialSegments, heightSegments, - openEnded, thetaStart, thetaLength ) { - - CylinderBufferGeometry.call( this, - 0, radius, height, - radialSegments, heightSegments, - openEnded, thetaStart, thetaLength ); - - this.type = 'ConeBufferGeometry'; - - this.parameters = { - radius: radius, - height: height, - radialSegments: radialSegments, - heightSegments: heightSegments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - } - - ConeBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - ConeBufferGeometry.prototype.constructor = ConeBufferGeometry; - - /** - * @author benaadams / https://twitter.com/ben_a_adams - */ - - function CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) { - - BufferGeometry.call( this ); - - this.type = 'CircleBufferGeometry'; - - this.parameters = { - radius: radius, - segments: segments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - radius = radius || 50; - segments = segments !== undefined ? Math.max( 3, segments ) : 8; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - var vertices = segments + 2; - - var positions = new Float32Array( vertices * 3 ); - var normals = new Float32Array( vertices * 3 ); - var uvs = new Float32Array( vertices * 2 ); - - // center data is already zero, but need to set a few extras - normals[ 2 ] = 1.0; - uvs[ 0 ] = 0.5; - uvs[ 1 ] = 0.5; - - for ( var s = 0, i = 3, ii = 2 ; s <= segments; s ++, i += 3, ii += 2 ) { - - var segment = thetaStart + s / segments * thetaLength; - - positions[ i ] = radius * Math.cos( segment ); - positions[ i + 1 ] = radius * Math.sin( segment ); - - normals[ i + 2 ] = 1; // normal z - - uvs[ ii ] = ( positions[ i ] / radius + 1 ) / 2; - uvs[ ii + 1 ] = ( positions[ i + 1 ] / radius + 1 ) / 2; - - } - - var indices = []; - - for ( var i = 1; i <= segments; i ++ ) { - - indices.push( i, i + 1, 0 ); - - } - - this.setIndex( new BufferAttribute( new Uint16Array( indices ), 1 ) ); - this.addAttribute( 'position', new BufferAttribute( positions, 3 ) ); - this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - - this.boundingSphere = new Sphere( new Vector3(), radius ); - - } - - CircleBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - CircleBufferGeometry.prototype.constructor = CircleBufferGeometry; - - /** - * @author hughes - */ - - function CircleGeometry( radius, segments, thetaStart, thetaLength ) { - - Geometry.call( this ); - - this.type = 'CircleGeometry'; - - this.parameters = { - radius: radius, - segments: segments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - this.fromBufferGeometry( new CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) ); - - } - - CircleGeometry.prototype = Object.create( Geometry.prototype ); - CircleGeometry.prototype.constructor = CircleGeometry; - - /** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as - */ - - function BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { - - Geometry.call( this ); - - this.type = 'BoxGeometry'; - - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; - - this.fromBufferGeometry( new BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) ); - this.mergeVertices(); - - } - - BoxGeometry.prototype = Object.create( Geometry.prototype ); - BoxGeometry.prototype.constructor = BoxGeometry; - - - - var Geometries = Object.freeze({ - WireframeGeometry: WireframeGeometry, - ParametricGeometry: ParametricGeometry, - TetrahedronGeometry: TetrahedronGeometry, - OctahedronGeometry: OctahedronGeometry, - IcosahedronGeometry: IcosahedronGeometry, - DodecahedronGeometry: DodecahedronGeometry, - PolyhedronGeometry: PolyhedronGeometry, - TubeGeometry: TubeGeometry, - TorusKnotGeometry: TorusKnotGeometry, - TorusKnotBufferGeometry: TorusKnotBufferGeometry, - TorusGeometry: TorusGeometry, - TorusBufferGeometry: TorusBufferGeometry, - TextGeometry: TextGeometry, - SphereBufferGeometry: SphereBufferGeometry, - SphereGeometry: SphereGeometry, - RingGeometry: RingGeometry, - RingBufferGeometry: RingBufferGeometry, - PlaneBufferGeometry: PlaneBufferGeometry, - PlaneGeometry: PlaneGeometry, - LatheGeometry: LatheGeometry, - LatheBufferGeometry: LatheBufferGeometry, - ShapeGeometry: ShapeGeometry, - ExtrudeGeometry: ExtrudeGeometry, - EdgesGeometry: EdgesGeometry, - ConeGeometry: ConeGeometry, - ConeBufferGeometry: ConeBufferGeometry, - CylinderGeometry: CylinderGeometry, - CylinderBufferGeometry: CylinderBufferGeometry, - CircleBufferGeometry: CircleBufferGeometry, - CircleGeometry: CircleGeometry, - BoxBufferGeometry: BoxBufferGeometry, - BoxGeometry: BoxGeometry - }); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function ShadowMaterial() { - - ShaderMaterial.call( this, { - uniforms: exports.UniformsUtils.merge( [ - UniformsLib[ "lights" ], - { - opacity: { value: 1.0 } - } - ] ), - vertexShader: ShaderChunk[ 'shadow_vert' ], - fragmentShader: ShaderChunk[ 'shadow_frag' ] - } ); - - this.lights = true; - this.transparent = true; - - Object.defineProperties( this, { - opacity: { - enumerable: true, - get: function () { - return this.uniforms.opacity.value; - }, - set: function ( value ) { - this.uniforms.opacity.value = value; - } - } - } ); - - } - - ShadowMaterial.prototype = Object.create( ShaderMaterial.prototype ); - ShadowMaterial.prototype.constructor = ShadowMaterial; - - ShadowMaterial.prototype.isShadowMaterial = true; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function RawShaderMaterial( parameters ) { - - ShaderMaterial.call( this, parameters ); - - this.type = 'RawShaderMaterial'; - - } - - RawShaderMaterial.prototype = Object.create( ShaderMaterial.prototype ); - RawShaderMaterial.prototype.constructor = RawShaderMaterial; - - RawShaderMaterial.prototype.isRawShaderMaterial = true; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function MultiMaterial( materials ) { - - this.uuid = exports.Math.generateUUID(); - - this.type = 'MultiMaterial'; - - this.materials = materials instanceof Array ? materials : []; - - this.visible = true; - - } - - MultiMaterial.prototype = { - - constructor: MultiMaterial, - - isMultiMaterial: true, - - toJSON: function ( meta ) { - - var output = { - metadata: { - version: 4.2, - type: 'material', - generator: 'MaterialExporter' - }, - uuid: this.uuid, - type: this.type, - materials: [] - }; - - var materials = this.materials; - - for ( var i = 0, l = materials.length; i < l; i ++ ) { - - var material = materials[ i ].toJSON( meta ); - delete material.metadata; - - output.materials.push( material ); - - } - - output.visible = this.visible; - - return output; - - }, - - clone: function () { - - var material = new this.constructor(); - - for ( var i = 0; i < this.materials.length; i ++ ) { - - material.materials.push( this.materials[ i ].clone() ); - - } - - material.visible = this.visible; - - return material; - - } - - }; - - /** - * @author WestLangley / http://github.com/WestLangley - * - * parameters = { - * color: <hex>, - * roughness: <float>, - * metalness: <float>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * lightMapIntensity: <float> - * - * aoMap: new THREE.Texture( <Image> ), - * aoMapIntensity: <float> - * - * emissive: <hex>, - * emissiveIntensity: <float> - * emissiveMap: new THREE.Texture( <Image> ), - * - * bumpMap: new THREE.Texture( <Image> ), - * bumpScale: <float>, - * - * normalMap: new THREE.Texture( <Image> ), - * normalScale: <Vector2>, - * - * displacementMap: new THREE.Texture( <Image> ), - * displacementScale: <float>, - * displacementBias: <float>, - * - * roughnessMap: new THREE.Texture( <Image> ), - * - * metalnessMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), - * envMapIntensity: <float> - * - * refractionRatio: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool> - * } - */ - - function MeshStandardMaterial( parameters ) { - - Material.call( this ); - - this.defines = { 'STANDARD': '' }; - - this.type = 'MeshStandardMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - this.roughness = 0.5; - this.metalness = 0.5; - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.roughnessMap = null; - - this.metalnessMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.envMapIntensity = 1.0; - - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - - } - - MeshStandardMaterial.prototype = Object.create( Material.prototype ); - MeshStandardMaterial.prototype.constructor = MeshStandardMaterial; - - MeshStandardMaterial.prototype.isMeshStandardMaterial = true; - - MeshStandardMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.defines = { 'STANDARD': '' }; - - this.color.copy( source.color ); - this.roughness = source.roughness; - this.metalness = source.metalness; - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.roughnessMap = source.roughnessMap; - - this.metalnessMap = source.metalnessMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.envMapIntensity = source.envMapIntensity; - - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - return this; - - }; - - /** - * @author WestLangley / http://github.com/WestLangley - * - * parameters = { - * reflectivity: <float> - * } - */ - - function MeshPhysicalMaterial( parameters ) { - - MeshStandardMaterial.call( this ); - - this.defines = { 'PHYSICAL': '' }; - - this.type = 'MeshPhysicalMaterial'; - - this.reflectivity = 0.5; // maps to F0 = 0.04 - - this.clearCoat = 0.0; - this.clearCoatRoughness = 0.0; - - this.setValues( parameters ); - - } - - MeshPhysicalMaterial.prototype = Object.create( MeshStandardMaterial.prototype ); - MeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial; - - MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true; - - MeshPhysicalMaterial.prototype.copy = function ( source ) { - - MeshStandardMaterial.prototype.copy.call( this, source ); - - this.defines = { 'PHYSICAL': '' }; - - this.reflectivity = source.reflectivity; - - this.clearCoat = source.clearCoat; - this.clearCoatRoughness = source.clearCoatRoughness; - - return this; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * specular: <hex>, - * shininess: <float>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * lightMapIntensity: <float> - * - * aoMap: new THREE.Texture( <Image> ), - * aoMapIntensity: <float> - * - * emissive: <hex>, - * emissiveIntensity: <float> - * emissiveMap: new THREE.Texture( <Image> ), - * - * bumpMap: new THREE.Texture( <Image> ), - * bumpScale: <float>, - * - * normalMap: new THREE.Texture( <Image> ), - * normalScale: <Vector2>, - * - * displacementMap: new THREE.Texture( <Image> ), - * displacementScale: <float>, - * displacementBias: <float>, - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool> - * } - */ - - function MeshPhongMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshPhongMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - this.specular = new Color( 0x111111 ); - this.shininess = 30; - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.bumpMap = null; - this.bumpScale = 1; - - this.normalMap = null; - this.normalScale = new Vector2( 1, 1 ); - - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - - } - - MeshPhongMaterial.prototype = Object.create( Material.prototype ); - MeshPhongMaterial.prototype.constructor = MeshPhongMaterial; - - MeshPhongMaterial.prototype.isMeshPhongMaterial = true; - - MeshPhongMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - this.specular.copy( source.specular ); - this.shininess = source.shininess; - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - - this.normalMap = source.normalMap; - this.normalScale.copy( source.normalScale ); - - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - return this; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * - * parameters = { - * opacity: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float> - * } - */ - - function MeshNormalMaterial( parameters ) { - - Material.call( this, parameters ); - - this.type = 'MeshNormalMaterial'; - - this.wireframe = false; - this.wireframeLinewidth = 1; - - this.fog = false; - this.lights = false; - this.morphTargets = false; - - this.setValues( parameters ); - - } - - MeshNormalMaterial.prototype = Object.create( Material.prototype ); - MeshNormalMaterial.prototype.constructor = MeshNormalMaterial; - - MeshNormalMaterial.prototype.isMeshNormalMaterial = true; - - MeshNormalMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - - return this; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * map: new THREE.Texture( <Image> ), - * - * lightMap: new THREE.Texture( <Image> ), - * lightMapIntensity: <float> - * - * aoMap: new THREE.Texture( <Image> ), - * aoMapIntensity: <float> - * - * emissive: <hex>, - * emissiveIntensity: <float> - * emissiveMap: new THREE.Texture( <Image> ), - * - * specularMap: new THREE.Texture( <Image> ), - * - * alphaMap: new THREE.Texture( <Image> ), - * - * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: <float>, - * refractionRatio: <float>, - * - * wireframe: <boolean>, - * wireframeLinewidth: <float>, - * - * skinning: <bool>, - * morphTargets: <bool>, - * morphNormals: <bool> - * } - */ - - function MeshLambertMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshLambertMaterial'; - - this.color = new Color( 0xffffff ); // diffuse - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.emissive = new Color( 0x000000 ); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - - this.setValues( parameters ); - - } - - MeshLambertMaterial.prototype = Object.create( Material.prototype ); - MeshLambertMaterial.prototype.constructor = MeshLambertMaterial; - - MeshLambertMaterial.prototype.isMeshLambertMaterial = true; - - MeshLambertMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.emissive.copy( source.emissive ); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - this.morphNormals = source.morphNormals; - - return this; - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: <hex>, - * opacity: <float>, - * - * linewidth: <float>, - * - * scale: <float>, - * dashSize: <float>, - * gapSize: <float> - * } - */ - - function LineDashedMaterial( parameters ) { - - Material.call( this ); - - this.type = 'LineDashedMaterial'; - - this.color = new Color( 0xffffff ); - - this.linewidth = 1; - - this.scale = 1; - this.dashSize = 3; - this.gapSize = 1; - - this.lights = false; - - this.setValues( parameters ); - - } - - LineDashedMaterial.prototype = Object.create( Material.prototype ); - LineDashedMaterial.prototype.constructor = LineDashedMaterial; - - LineDashedMaterial.prototype.isLineDashedMaterial = true; - - LineDashedMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.linewidth = source.linewidth; - - this.scale = source.scale; - this.dashSize = source.dashSize; - this.gapSize = source.gapSize; - - return this; - - }; - - - - var Materials = Object.freeze({ - ShadowMaterial: ShadowMaterial, - SpriteMaterial: SpriteMaterial, - RawShaderMaterial: RawShaderMaterial, - ShaderMaterial: ShaderMaterial, - PointsMaterial: PointsMaterial, - MultiMaterial: MultiMaterial, - MeshPhysicalMaterial: MeshPhysicalMaterial, - MeshStandardMaterial: MeshStandardMaterial, - MeshPhongMaterial: MeshPhongMaterial, - MeshNormalMaterial: MeshNormalMaterial, - MeshLambertMaterial: MeshLambertMaterial, - MeshDepthMaterial: MeshDepthMaterial, - MeshBasicMaterial: MeshBasicMaterial, - LineDashedMaterial: LineDashedMaterial, - LineBasicMaterial: LineBasicMaterial, - Material: Material - }); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - exports.Cache = { - - enabled: false, - - files: {}, - - add: function ( key, file ) { - - if ( this.enabled === false ) return; - - // console.log( 'THREE.Cache', 'Adding key:', key ); - - this.files[ key ] = file; - - }, - - get: function ( key ) { - - if ( this.enabled === false ) return; - - // console.log( 'THREE.Cache', 'Checking key:', key ); - - return this.files[ key ]; - - }, - - remove: function ( key ) { - - delete this.files[ key ]; - - }, - - clear: function () { - - this.files = {}; - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function LoadingManager( onLoad, onProgress, onError ) { - - var scope = this; - - var isLoading = false, itemsLoaded = 0, itemsTotal = 0; - - this.onStart = undefined; - this.onLoad = onLoad; - this.onProgress = onProgress; - this.onError = onError; - - this.itemStart = function ( url ) { - - itemsTotal ++; - - if ( isLoading === false ) { - - if ( scope.onStart !== undefined ) { - - scope.onStart( url, itemsLoaded, itemsTotal ); - - } - - } - - isLoading = true; - - }; - - this.itemEnd = function ( url ) { - - itemsLoaded ++; - - if ( scope.onProgress !== undefined ) { - - scope.onProgress( url, itemsLoaded, itemsTotal ); - - } - - if ( itemsLoaded === itemsTotal ) { - - isLoading = false; - - if ( scope.onLoad !== undefined ) { - - scope.onLoad(); - - } - - } - - }; - - this.itemError = function ( url ) { - - if ( scope.onError !== undefined ) { - - scope.onError( url ); - - } - - }; - - } - - exports.DefaultLoadingManager = new LoadingManager(); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function XHRLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - } - - Object.assign( XHRLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - if ( this.path !== undefined ) url = this.path + url; - - var scope = this; - - var cached = exports.Cache.get( url ); - - if ( cached !== undefined ) { - - scope.manager.itemStart( url ); - - setTimeout( function () { - - if ( onLoad ) onLoad( cached ); - - scope.manager.itemEnd( url ); - - }, 0 ); - - return cached; - - } - - var request = new XMLHttpRequest(); - request.open( 'GET', url, true ); - - request.addEventListener( 'load', function ( event ) { - - var response = event.target.response; - - exports.Cache.add( url, response ); - - if ( this.status === 200 ) { - - if ( onLoad ) onLoad( response ); - - scope.manager.itemEnd( url ); - - } else if ( this.status === 0 ) { - - // Some browsers return HTTP Status 0 when using non-http protocol - // e.g. 'file://' or 'data://'. Handle as success. - - console.warn( 'THREE.XHRLoader: HTTP Status 0 received.' ); - - if ( onLoad ) onLoad( response ); - - scope.manager.itemEnd( url ); - - } else { - - if ( onError ) onError( event ); - - scope.manager.itemError( url ); - - } - - }, false ); - - if ( onProgress !== undefined ) { - - request.addEventListener( 'progress', function ( event ) { - - onProgress( event ); - - }, false ); - - } - - request.addEventListener( 'error', function ( event ) { - - if ( onError ) onError( event ); - - scope.manager.itemError( url ); - - }, false ); - - if ( this.responseType !== undefined ) request.responseType = this.responseType; - if ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials; - - if ( request.overrideMimeType ) request.overrideMimeType( 'text/plain' ); - - request.send( null ); - - scope.manager.itemStart( url ); - - return request; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - }, - - setResponseType: function ( value ) { - - this.responseType = value; - return this; - - }, - - setWithCredentials: function ( value ) { - - this.withCredentials = value; - return this; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - * - * Abstract Base class to block based textures loader (dds, pvr, ...) - */ - - function CompressedTextureLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - // override in sub classes - this._parser = null; - - } - - Object.assign( CompressedTextureLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var images = []; - - var texture = new CompressedTexture(); - texture.image = images; - - var loader = new XHRLoader( this.manager ); - loader.setPath( this.path ); - loader.setResponseType( 'arraybuffer' ); - - function loadTexture( i ) { - - loader.load( url[ i ], function ( buffer ) { - - var texDatas = scope._parser( buffer, true ); - - images[ i ] = { - width: texDatas.width, - height: texDatas.height, - format: texDatas.format, - mipmaps: texDatas.mipmaps - }; - - loaded += 1; - - if ( loaded === 6 ) { - - if ( texDatas.mipmapCount === 1 ) - texture.minFilter = LinearFilter; - - texture.format = texDatas.format; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - }, onProgress, onError ); - - } - - if ( Array.isArray( url ) ) { - - var loaded = 0; - - for ( var i = 0, il = url.length; i < il; ++ i ) { - - loadTexture( i ); - - } - - } else { - - // compressed cubemap texture stored in a single DDS file - - loader.load( url, function ( buffer ) { - - var texDatas = scope._parser( buffer, true ); - - if ( texDatas.isCubemap ) { - - var faces = texDatas.mipmaps.length / texDatas.mipmapCount; - - for ( var f = 0; f < faces; f ++ ) { - - images[ f ] = { mipmaps : [] }; - - for ( var i = 0; i < texDatas.mipmapCount; i ++ ) { - - images[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] ); - images[ f ].format = texDatas.format; - images[ f ].width = texDatas.width; - images[ f ].height = texDatas.height; - - } - - } - - } else { - - texture.image.width = texDatas.width; - texture.image.height = texDatas.height; - texture.mipmaps = texDatas.mipmaps; - - } - - if ( texDatas.mipmapCount === 1 ) { - - texture.minFilter = LinearFilter; - - } - - texture.format = texDatas.format; - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - }, onProgress, onError ); - - } - - return texture; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - } - - } ); - - /** - * @author Nikos M. / https://github.com/foo123/ - * - * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...) - */ - - var DataTextureLoader = BinaryTextureLoader; - function BinaryTextureLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - // override in sub classes - this._parser = null; - - } - - Object.assign( BinaryTextureLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var texture = new DataTexture(); - - var loader = new XHRLoader( this.manager ); - loader.setResponseType( 'arraybuffer' ); - - loader.load( url, function ( buffer ) { - - var texData = scope._parser( buffer ); - - if ( ! texData ) return; - - if ( undefined !== texData.image ) { - - texture.image = texData.image; - - } else if ( undefined !== texData.data ) { - - texture.image.width = texData.width; - texture.image.height = texData.height; - texture.image.data = texData.data; - - } - - texture.wrapS = undefined !== texData.wrapS ? texData.wrapS : ClampToEdgeWrapping; - texture.wrapT = undefined !== texData.wrapT ? texData.wrapT : ClampToEdgeWrapping; - - texture.magFilter = undefined !== texData.magFilter ? texData.magFilter : LinearFilter; - texture.minFilter = undefined !== texData.minFilter ? texData.minFilter : LinearMipMapLinearFilter; - - texture.anisotropy = undefined !== texData.anisotropy ? texData.anisotropy : 1; - - if ( undefined !== texData.format ) { - - texture.format = texData.format; - - } - if ( undefined !== texData.type ) { - - texture.type = texData.type; - - } - - if ( undefined !== texData.mipmaps ) { - - texture.mipmaps = texData.mipmaps; - - } - - if ( 1 === texData.mipmapCount ) { - - texture.minFilter = LinearFilter; - - } - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture, texData ); - - }, onProgress, onError ); - - - return texture; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function ImageLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - } - - Object.assign( ImageLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' ); - image.onload = function () { - - image.onload = null; - - URL.revokeObjectURL( image.src ); - - if ( onLoad ) onLoad( image ); - - scope.manager.itemEnd( url ); - - }; - - if ( url.indexOf( 'data:' ) === 0 ) { - - image.src = url; - - } else { - - var loader = new XHRLoader(); - loader.setPath( this.path ); - loader.setResponseType( 'blob' ); - loader.setWithCredentials( this.withCredentials ); - loader.load( url, function ( blob ) { - - image.src = URL.createObjectURL( blob ); - - }, onProgress, onError ); - - } - - scope.manager.itemStart( url ); - - return image; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setWithCredentials: function ( value ) { - - this.withCredentials = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function CubeTextureLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - } - - Object.assign( CubeTextureLoader.prototype, { - - load: function ( urls, onLoad, onProgress, onError ) { - - var texture = new CubeTexture(); - - var loader = new ImageLoader( this.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.setPath( this.path ); - - var loaded = 0; - - function loadTexture( i ) { - - loader.load( urls[ i ], function ( image ) { - - texture.images[ i ] = image; - - loaded ++; - - if ( loaded === 6 ) { - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - }, undefined, onError ); - - } - - for ( var i = 0; i < urls.length; ++ i ) { - - loadTexture( i ); - - } - - return texture; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function TextureLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - } - - Object.assign( TextureLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var texture = new Texture(); - - var loader = new ImageLoader( this.manager ); - loader.setCrossOrigin( this.crossOrigin ); - loader.setWithCredentials( this.withCredentials ); - loader.setPath( this.path ); - loader.load( url, function ( image ) { - - // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB. - var isJPEG = url.search( /\.(jpg|jpeg)$/ ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; - - texture.format = isJPEG ? RGBFormat : RGBAFormat; - texture.image = image; - texture.needsUpdate = true; - - if ( onLoad !== undefined ) { - - onLoad( texture ); - - } - - }, onProgress, onError ); - - return texture; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setWithCredentials: function ( value ) { - - this.withCredentials = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - } - - - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function Light( color, intensity ) { - - Object3D.call( this ); - - this.type = 'Light'; - - this.color = new Color( color ); - this.intensity = intensity !== undefined ? intensity : 1; - - this.receiveShadow = undefined; - - } - - Light.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Light, - - isLight: true, - - copy: function ( source ) { - - Object3D.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - this.intensity = source.intensity; - - return this; - - }, - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.color = this.color.getHex(); - data.object.intensity = this.intensity; - - if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex(); - - if ( this.distance !== undefined ) data.object.distance = this.distance; - if ( this.angle !== undefined ) data.object.angle = this.angle; - if ( this.decay !== undefined ) data.object.decay = this.decay; - if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra; - - if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON(); - - return data; - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function HemisphereLight( skyColor, groundColor, intensity ) { - - Light.call( this, skyColor, intensity ); - - this.type = 'HemisphereLight'; - - this.castShadow = undefined; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.groundColor = new Color( groundColor ); - - } - - HemisphereLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: HemisphereLight, - - isHemisphereLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.groundColor.copy( source.groundColor ); - - return this; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function LightShadow( camera ) { - - this.camera = camera; - - this.bias = 0; - this.radius = 1; - - this.mapSize = new Vector2( 512, 512 ); - - this.map = null; - this.matrix = new Matrix4(); - - } - - Object.assign( LightShadow.prototype, { - - copy: function ( source ) { - - this.camera = source.camera.clone(); - - this.bias = source.bias; - this.radius = source.radius; - - this.mapSize.copy( source.mapSize ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - toJSON: function () { - - var object = {}; - - if ( this.bias !== 0 ) object.bias = this.bias; - if ( this.radius !== 1 ) object.radius = this.radius; - if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray(); - - object.camera = this.camera.toJSON( false ).object; - delete object.camera.matrix; - - return object; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function SpotLightShadow() { - - LightShadow.call( this, new PerspectiveCamera( 50, 1, 0.5, 500 ) ); - - } - - SpotLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), { - - constructor: SpotLightShadow, - - isSpotLightShadow: true, - - update: function ( light ) { - - var fov = exports.Math.RAD2DEG * 2 * light.angle; - var aspect = this.mapSize.width / this.mapSize.height; - var far = light.distance || 500; - - var camera = this.camera; - - if ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) { - - camera.fov = fov; - camera.aspect = aspect; - camera.far = far; - camera.updateProjectionMatrix(); - - } - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function SpotLight( color, intensity, distance, angle, penumbra, decay ) { - - Light.call( this, color, intensity ); - - this.type = 'SpotLight'; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.target = new Object3D(); - - Object.defineProperty( this, 'power', { - get: function () { - // intensity = power per solid angle. - // ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf - return this.intensity * Math.PI; - }, - set: function ( power ) { - // intensity = power per solid angle. - // ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf - this.intensity = power / Math.PI; - } - } ); - - this.distance = ( distance !== undefined ) ? distance : 0; - this.angle = ( angle !== undefined ) ? angle : Math.PI / 3; - this.penumbra = ( penumbra !== undefined ) ? penumbra : 0; - this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2. - - this.shadow = new SpotLightShadow(); - - } - - SpotLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: SpotLight, - - isSpotLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.distance = source.distance; - this.angle = source.angle; - this.penumbra = source.penumbra; - this.decay = source.decay; - - this.target = source.target.clone(); - - this.shadow = source.shadow.clone(); - - return this; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - - function PointLight( color, intensity, distance, decay ) { - - Light.call( this, color, intensity ); - - this.type = 'PointLight'; - - Object.defineProperty( this, 'power', { - get: function () { - // intensity = power per solid angle. - // ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf - return this.intensity * 4 * Math.PI; - - }, - set: function ( power ) { - // intensity = power per solid angle. - // ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf - this.intensity = power / ( 4 * Math.PI ); - } - } ); - - this.distance = ( distance !== undefined ) ? distance : 0; - this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2. - - this.shadow = new LightShadow( new PerspectiveCamera( 90, 1, 0.5, 500 ) ); - - } - - PointLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: PointLight, - - isPointLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.distance = source.distance; - this.decay = source.decay; - - this.shadow = source.shadow.clone(); - - return this; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function DirectionalLightShadow( light ) { - - LightShadow.call( this, new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) ); - - } - - DirectionalLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), { - - constructor: DirectionalLightShadow - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function DirectionalLight( color, intensity ) { - - Light.call( this, color, intensity ); - - this.type = 'DirectionalLight'; - - this.position.copy( Object3D.DefaultUp ); - this.updateMatrix(); - - this.target = new Object3D(); - - this.shadow = new DirectionalLightShadow(); - - } - - DirectionalLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: DirectionalLight, - - isDirectionalLight: true, - - copy: function ( source ) { - - Light.prototype.copy.call( this, source ); - - this.target = source.target.clone(); - - this.shadow = source.shadow.clone(); - - return this; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function AmbientLight( color, intensity ) { - - Light.call( this, color, intensity ); - - this.type = 'AmbientLight'; - - this.castShadow = undefined; - - } - - AmbientLight.prototype = Object.assign( Object.create( Light.prototype ), { - - constructor: AmbientLight, - - isAmbientLight: true, - - } ); - - /** - * @author tschw - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - */ - - exports.AnimationUtils = { - - // same as Array.prototype.slice, but also works on typed arrays - arraySlice: function( array, from, to ) { - - if ( exports.AnimationUtils.isTypedArray( array ) ) { - - return new array.constructor( array.subarray( from, to ) ); - - } - - return array.slice( from, to ); - - }, - - // converts an array to a specific type - convertArray: function( array, type, forceClone ) { - - if ( ! array || // let 'undefined' and 'null' pass - ! forceClone && array.constructor === type ) return array; - - if ( typeof type.BYTES_PER_ELEMENT === 'number' ) { - - return new type( array ); // create typed array - - } - - return Array.prototype.slice.call( array ); // create Array - - }, - - isTypedArray: function( object ) { - - return ArrayBuffer.isView( object ) && - ! ( object instanceof DataView ); - - }, - - // returns an array by which times and values can be sorted - getKeyframeOrder: function( times ) { - - function compareTime( i, j ) { - - return times[ i ] - times[ j ]; - - } - - var n = times.length; - var result = new Array( n ); - for ( var i = 0; i !== n; ++ i ) result[ i ] = i; - - result.sort( compareTime ); - - return result; - - }, - - // uses the array previously returned by 'getKeyframeOrder' to sort data - sortedArray: function( values, stride, order ) { - - var nValues = values.length; - var result = new values.constructor( nValues ); - - for ( var i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) { - - var srcOffset = order[ i ] * stride; - - for ( var j = 0; j !== stride; ++ j ) { - - result[ dstOffset ++ ] = values[ srcOffset + j ]; - - } - - } - - return result; - - }, - - // function for parsing AOS keyframe formats - flattenJSON: function( jsonKeys, times, values, valuePropertyName ) { - - var i = 1, key = jsonKeys[ 0 ]; - - while ( key !== undefined && key[ valuePropertyName ] === undefined ) { - - key = jsonKeys[ i ++ ]; - - } - - if ( key === undefined ) return; // no data - - var value = key[ valuePropertyName ]; - if ( value === undefined ) return; // no data - - if ( Array.isArray( value ) ) { - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - values.push.apply( values, value ); // push all elements - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } else if ( value.toArray !== undefined ) { - // ...assume THREE.Math-ish - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - value.toArray( values, values.length ); - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } else { - // otherwise push as-is - - do { - - value = key[ valuePropertyName ]; - - if ( value !== undefined ) { - - times.push( key.time ); - values.push( value ); - - } - - key = jsonKeys[ i ++ ]; - - } while ( key !== undefined ); - - } - - } - - }; - - /** - * Abstract base class of interpolants over parametric samples. - * - * The parameter domain is one dimensional, typically the time or a path - * along a curve defined by the data. - * - * The sample values can have any dimensionality and derived classes may - * apply special interpretations to the data. - * - * This class provides the interval seek in a Template Method, deferring - * the actual interpolation to derived classes. - * - * Time complexity is O(1) for linear access crossing at most two points - * and O(log N) for random access, where N is the number of positions. - * - * References: - * - * http://www.oodesign.com/template-method-pattern.html - * - * @author tschw - */ - - function Interpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - this.parameterPositions = parameterPositions; - this._cachedIndex = 0; - - this.resultBuffer = resultBuffer !== undefined ? - resultBuffer : new sampleValues.constructor( sampleSize ); - this.sampleValues = sampleValues; - this.valueSize = sampleSize; - - } - - Interpolant.prototype = { - - constructor: Interpolant, - - evaluate: function( t ) { - - var pp = this.parameterPositions, - i1 = this._cachedIndex, - - t1 = pp[ i1 ], - t0 = pp[ i1 - 1 ]; - - validate_interval: { - - seek: { - - var right; - - linear_scan: { - //- See http://jsperf.com/comparison-to-undefined/3 - //- slower code: - //- - //- if ( t >= t1 || t1 === undefined ) { - forward_scan: if ( ! ( t < t1 ) ) { - - for ( var giveUpAt = i1 + 2; ;) { - - if ( t1 === undefined ) { - - if ( t < t0 ) break forward_scan; - - // after end - - i1 = pp.length; - this._cachedIndex = i1; - return this.afterEnd_( i1 - 1, t, t0 ); - - } - - if ( i1 === giveUpAt ) break; // this loop - - t0 = t1; - t1 = pp[ ++ i1 ]; - - if ( t < t1 ) { - - // we have arrived at the sought interval - break seek; - - } - - } - - // prepare binary search on the right side of the index - right = pp.length; - break linear_scan; - - } - - //- slower code: - //- if ( t < t0 || t0 === undefined ) { - if ( ! ( t >= t0 ) ) { - - // looping? - - var t1global = pp[ 1 ]; - - if ( t < t1global ) { - - i1 = 2; // + 1, using the scan for the details - t0 = t1global; - - } - - // linear reverse scan - - for ( var giveUpAt = i1 - 2; ;) { - - if ( t0 === undefined ) { - - // before start - - this._cachedIndex = 0; - return this.beforeStart_( 0, t, t1 ); - - } - - if ( i1 === giveUpAt ) break; // this loop - - t1 = t0; - t0 = pp[ -- i1 - 1 ]; - - if ( t >= t0 ) { - - // we have arrived at the sought interval - break seek; - - } - - } - - // prepare binary search on the left side of the index - right = i1; - i1 = 0; - break linear_scan; - - } - - // the interval is valid - - break validate_interval; - - } // linear scan - - // binary search - - while ( i1 < right ) { - - var mid = ( i1 + right ) >>> 1; - - if ( t < pp[ mid ] ) { - - right = mid; - - } else { - - i1 = mid + 1; - - } - - } - - t1 = pp[ i1 ]; - t0 = pp[ i1 - 1 ]; - - // check boundary cases, again - - if ( t0 === undefined ) { - - this._cachedIndex = 0; - return this.beforeStart_( 0, t, t1 ); - - } - - if ( t1 === undefined ) { - - i1 = pp.length; - this._cachedIndex = i1; - return this.afterEnd_( i1 - 1, t0, t ); - - } - - } // seek - - this._cachedIndex = i1; - - this.intervalChanged_( i1, t0, t1 ); - - } // validate_interval - - return this.interpolate_( i1, t0, t, t1 ); - - }, - - settings: null, // optional, subclass-specific settings structure - // Note: The indirection allows central control of many interpolants. - - // --- Protected interface - - DefaultSettings_: {}, - - getSettings_: function() { - - return this.settings || this.DefaultSettings_; - - }, - - copySampleValue_: function( index ) { - - // copies a sample value to the result buffer - - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset = index * stride; - - for ( var i = 0; i !== stride; ++ i ) { - - result[ i ] = values[ offset + i ]; - - } - - return result; - - }, - - // Template methods for derived classes: - - interpolate_: function( i1, t0, t, t1 ) { - - throw new Error( "call to abstract method" ); - // implementations shall return this.resultBuffer - - }, - - intervalChanged_: function( i1, t0, t1 ) { - - // empty - - } - - }; - - Object.assign( Interpolant.prototype, { - - beforeStart_: //( 0, t, t0 ), returns this.resultBuffer - Interpolant.prototype.copySampleValue_, - - afterEnd_: //( N-1, tN-1, t ), returns this.resultBuffer - Interpolant.prototype.copySampleValue_ - - } ); - - /** - * Fast and simple cubic spline interpolant. - * - * It was derived from a Hermitian construction setting the first derivative - * at each sample position to the linear slope between neighboring positions - * over their parameter interval. - * - * @author tschw - */ - - function CubicInterpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( - this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - - this._weightPrev = -0; - this._offsetPrev = -0; - this._weightNext = -0; - this._offsetNext = -0; - - } - - CubicInterpolant.prototype = - Object.assign( Object.create( Interpolant.prototype ), { - - constructor: CubicInterpolant, - - DefaultSettings_: { - - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - - }, - - intervalChanged_: function( i1, t0, t1 ) { - - var pp = this.parameterPositions, - iPrev = i1 - 2, - iNext = i1 + 1, - - tPrev = pp[ iPrev ], - tNext = pp[ iNext ]; - - if ( tPrev === undefined ) { - - switch ( this.getSettings_().endingStart ) { - - case ZeroSlopeEnding: - - // f'(t0) = 0 - iPrev = i1; - tPrev = 2 * t0 - t1; - - break; - - case WrapAroundEnding: - - // use the other end of the curve - iPrev = pp.length - 2; - tPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ]; - - break; - - default: // ZeroCurvatureEnding - - // f''(t0) = 0 a.k.a. Natural Spline - iPrev = i1; - tPrev = t1; - - } - - } - - if ( tNext === undefined ) { - - switch ( this.getSettings_().endingEnd ) { - - case ZeroSlopeEnding: - - // f'(tN) = 0 - iNext = i1; - tNext = 2 * t1 - t0; - - break; - - case WrapAroundEnding: - - // use the other end of the curve - iNext = 1; - tNext = t1 + pp[ 1 ] - pp[ 0 ]; - - break; - - default: // ZeroCurvatureEnding - - // f''(tN) = 0, a.k.a. Natural Spline - iNext = i1 - 1; - tNext = t0; - - } - - } - - var halfDt = ( t1 - t0 ) * 0.5, - stride = this.valueSize; - - this._weightPrev = halfDt / ( t0 - tPrev ); - this._weightNext = halfDt / ( tNext - t1 ); - this._offsetPrev = iPrev * stride; - this._offsetNext = iNext * stride; - - }, - - interpolate_: function( i1, t0, t, t1 ) { - - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - o1 = i1 * stride, o0 = o1 - stride, - oP = this._offsetPrev, oN = this._offsetNext, - wP = this._weightPrev, wN = this._weightNext, - - p = ( t - t0 ) / ( t1 - t0 ), - pp = p * p, - ppp = pp * p; - - // evaluate polynomials - - var sP = - wP * ppp + 2 * wP * pp - wP * p; - var s0 = ( 1 + wP ) * ppp + (-1.5 - 2 * wP ) * pp + ( -0.5 + wP ) * p + 1; - var s1 = (-1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p; - var sN = wN * ppp - wN * pp; - - // combine data linearly - - for ( var i = 0; i !== stride; ++ i ) { - - result[ i ] = - sP * values[ oP + i ] + - s0 * values[ o0 + i ] + - s1 * values[ o1 + i ] + - sN * values[ oN + i ]; - - } - - return result; - - } - - } ); - - /** - * @author tschw - */ - - function LinearInterpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( - this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - - } - - LinearInterpolant.prototype = - Object.assign( Object.create( Interpolant.prototype ), { - - constructor: LinearInterpolant, - - interpolate_: function( i1, t0, t, t1 ) { - - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - offset1 = i1 * stride, - offset0 = offset1 - stride, - - weight1 = ( t - t0 ) / ( t1 - t0 ), - weight0 = 1 - weight1; - - for ( var i = 0; i !== stride; ++ i ) { - - result[ i ] = - values[ offset0 + i ] * weight0 + - values[ offset1 + i ] * weight1; - - } - - return result; - - } - - } ); - - /** - * - * Interpolant that evaluates to the sample value at the position preceeding - * the parameter. - * - * @author tschw - */ - - function DiscreteInterpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( - this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - - } - - DiscreteInterpolant.prototype = - Object.assign( Object.create( Interpolant.prototype ), { - - constructor: DiscreteInterpolant, - - interpolate_: function( i1, t0, t, t1 ) { - - return this.copySampleValue_( i1 - 1 ); - - } - - } ); - - var KeyframeTrackPrototype; - - KeyframeTrackPrototype = { - - TimeBufferType: Float32Array, - ValueBufferType: Float32Array, - - DefaultInterpolation: InterpolateLinear, - - InterpolantFactoryMethodDiscrete: function( result ) { - - return new DiscreteInterpolant( - this.times, this.values, this.getValueSize(), result ); - - }, - - InterpolantFactoryMethodLinear: function( result ) { - - return new LinearInterpolant( - this.times, this.values, this.getValueSize(), result ); - - }, - - InterpolantFactoryMethodSmooth: function( result ) { - - return new CubicInterpolant( - this.times, this.values, this.getValueSize(), result ); - - }, - - setInterpolation: function( interpolation ) { - - var factoryMethod; - - switch ( interpolation ) { - - case InterpolateDiscrete: - - factoryMethod = this.InterpolantFactoryMethodDiscrete; - - break; - - case InterpolateLinear: - - factoryMethod = this.InterpolantFactoryMethodLinear; - - break; - - case InterpolateSmooth: - - factoryMethod = this.InterpolantFactoryMethodSmooth; - - break; - - } - - if ( factoryMethod === undefined ) { - - var message = "unsupported interpolation for " + - this.ValueTypeName + " keyframe track named " + this.name; - - if ( this.createInterpolant === undefined ) { - - // fall back to default, unless the default itself is messed up - if ( interpolation !== this.DefaultInterpolation ) { - - this.setInterpolation( this.DefaultInterpolation ); - - } else { - - throw new Error( message ); // fatal, in this case - - } - - } - - console.warn( message ); - return; - - } - - this.createInterpolant = factoryMethod; - - }, - - getInterpolation: function() { - - switch ( this.createInterpolant ) { - - case this.InterpolantFactoryMethodDiscrete: - - return InterpolateDiscrete; - - case this.InterpolantFactoryMethodLinear: - - return InterpolateLinear; - - case this.InterpolantFactoryMethodSmooth: - - return InterpolateSmooth; - - } - - }, - - getValueSize: function() { - - return this.values.length / this.times.length; - - }, - - // move all keyframes either forwards or backwards in time - shift: function( timeOffset ) { - - if( timeOffset !== 0.0 ) { - - var times = this.times; - - for( var i = 0, n = times.length; i !== n; ++ i ) { - - times[ i ] += timeOffset; - - } - - } - - return this; - - }, - - // scale all keyframe times by a factor (useful for frame <-> seconds conversions) - scale: function( timeScale ) { - - if( timeScale !== 1.0 ) { - - var times = this.times; - - for( var i = 0, n = times.length; i !== n; ++ i ) { - - times[ i ] *= timeScale; - - } - - } - - return this; - - }, - - // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. - // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values - trim: function( startTime, endTime ) { - - var times = this.times, - nKeys = times.length, - from = 0, - to = nKeys - 1; - - while ( from !== nKeys && times[ from ] < startTime ) ++ from; - while ( to !== -1 && times[ to ] > endTime ) -- to; - - ++ to; // inclusive -> exclusive bound - - if( from !== 0 || to !== nKeys ) { - - // empty tracks are forbidden, so keep at least one keyframe - if ( from >= to ) to = Math.max( to , 1 ), from = to - 1; - - var stride = this.getValueSize(); - this.times = exports.AnimationUtils.arraySlice( times, from, to ); - this.values = exports.AnimationUtils. - arraySlice( this.values, from * stride, to * stride ); - - } - - return this; - - }, - - // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable - validate: function() { - - var valid = true; - - var valueSize = this.getValueSize(); - if ( valueSize - Math.floor( valueSize ) !== 0 ) { - - console.error( "invalid value size in track", this ); - valid = false; - - } - - var times = this.times, - values = this.values, - - nKeys = times.length; - - if( nKeys === 0 ) { - - console.error( "track is empty", this ); - valid = false; - - } - - var prevTime = null; - - for( var i = 0; i !== nKeys; i ++ ) { - - var currTime = times[ i ]; - - if ( typeof currTime === 'number' && isNaN( currTime ) ) { - - console.error( "time is not a valid number", this, i, currTime ); - valid = false; - break; - - } - - if( prevTime !== null && prevTime > currTime ) { - - console.error( "out of order keys", this, i, currTime, prevTime ); - valid = false; - break; - - } - - prevTime = currTime; - - } - - if ( values !== undefined ) { - - if ( exports.AnimationUtils.isTypedArray( values ) ) { - - for ( var i = 0, n = values.length; i !== n; ++ i ) { - - var value = values[ i ]; - - if ( isNaN( value ) ) { - - console.error( "value is not a valid number", this, i, value ); - valid = false; - break; - - } - - } - - } - - } - - return valid; - - }, - - // removes equivalent sequential keys as common in morph target sequences - // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) - optimize: function() { - - var times = this.times, - values = this.values, - stride = this.getValueSize(), - - smoothInterpolation = this.getInterpolation() === InterpolateSmooth, - - writeIndex = 1, - lastIndex = times.length - 1; - - for( var i = 1; i < lastIndex; ++ i ) { - - var keep = false; - - var time = times[ i ]; - var timeNext = times[ i + 1 ]; - - // remove adjacent keyframes scheduled at the same time - - if ( time !== timeNext && ( i !== 1 || time !== time[ 0 ] ) ) { - - if ( ! smoothInterpolation ) { - - // remove unnecessary keyframes same as their neighbors - - var offset = i * stride, - offsetP = offset - stride, - offsetN = offset + stride; - - for ( var j = 0; j !== stride; ++ j ) { - - var value = values[ offset + j ]; - - if ( value !== values[ offsetP + j ] || - value !== values[ offsetN + j ] ) { - - keep = true; - break; - - } - - } - - } else keep = true; - - } - - // in-place compaction - - if ( keep ) { - - if ( i !== writeIndex ) { - - times[ writeIndex ] = times[ i ]; - - var readOffset = i * stride, - writeOffset = writeIndex * stride; - - for ( var j = 0; j !== stride; ++ j ) - - values[ writeOffset + j ] = values[ readOffset + j ]; - - } - - ++ writeIndex; - - } - - } - - // flush last keyframe (compaction looks ahead) - - if ( lastIndex > 0 ) { - - times[ writeIndex ] = times[ lastIndex ]; - - for ( var readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) - - values[ writeOffset + j ] = values[ readOffset + j ]; - - ++ writeIndex; - - } - - if ( writeIndex !== times.length ) { - - this.times = exports.AnimationUtils.arraySlice( times, 0, writeIndex ); - this.values = exports.AnimationUtils.arraySlice( values, 0, writeIndex * stride ); - - } - - return this; - - } - - } - - function KeyframeTrackConstructor( name, times, values, interpolation ) { - - if( name === undefined ) throw new Error( "track name is undefined" ); - - if( times === undefined || times.length === 0 ) { - - throw new Error( "no keyframes in track named " + name ); - - } - - this.name = name; - - this.times = exports.AnimationUtils.convertArray( times, this.TimeBufferType ); - this.values = exports.AnimationUtils.convertArray( values, this.ValueBufferType ); - - this.setInterpolation( interpolation || this.DefaultInterpolation ); - - this.validate(); - this.optimize(); - - } - - /** - * - * A Track of vectored keyframe values. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function VectorKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - - } - - VectorKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: VectorKeyframeTrack, - - ValueTypeName: 'vector' - - // ValueBufferType is inherited - - // DefaultInterpolation is inherited - - } ); - - /** - * Spherical linear unit quaternion interpolant. - * - * @author tschw - */ - - function QuaternionLinearInterpolant( - parameterPositions, sampleValues, sampleSize, resultBuffer ) { - - Interpolant.call( - this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - - } - - QuaternionLinearInterpolant.prototype = - Object.assign( Object.create( Interpolant.prototype ), { - - constructor: QuaternionLinearInterpolant, - - interpolate_: function( i1, t0, t, t1 ) { - - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - - offset = i1 * stride, - - alpha = ( t - t0 ) / ( t1 - t0 ); - - for ( var end = offset + stride; offset !== end; offset += 4 ) { - - Quaternion.slerpFlat( result, 0, - values, offset - stride, values, offset, alpha ); - - } - - return result; - - } - - } ); - - /** - * - * A Track of quaternion keyframe values. - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function QuaternionKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - - } - - QuaternionKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: QuaternionKeyframeTrack, - - ValueTypeName: 'quaternion', - - // ValueBufferType is inherited - - DefaultInterpolation: InterpolateLinear, - - InterpolantFactoryMethodLinear: function( result ) { - - return new QuaternionLinearInterpolant( - this.times, this.values, this.getValueSize(), result ); - - }, - - InterpolantFactoryMethodSmooth: undefined // not yet implemented - - } ); - - /** - * - * A Track of numeric keyframe values. - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function NumberKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - - } - - NumberKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: NumberKeyframeTrack, - - ValueTypeName: 'number', - - // ValueBufferType is inherited - - // DefaultInterpolation is inherited - - } ); - - /** - * - * A Track that interpolates Strings - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function StringKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - - } - - StringKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: StringKeyframeTrack, - - ValueTypeName: 'string', - ValueBufferType: Array, - - DefaultInterpolation: InterpolateDiscrete, - - InterpolantFactoryMethodLinear: undefined, - - InterpolantFactoryMethodSmooth: undefined - - } ); - - /** - * - * A Track of Boolean keyframe values. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function BooleanKeyframeTrack( name, times, values ) { - - KeyframeTrackConstructor.call( this, name, times, values ); - - } - - BooleanKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: BooleanKeyframeTrack, - - ValueTypeName: 'bool', - ValueBufferType: Array, - - DefaultInterpolation: InterpolateDiscrete, - - InterpolantFactoryMethodLinear: undefined, - InterpolantFactoryMethodSmooth: undefined - - // Note: Actually this track could have a optimized / compressed - // representation of a single value and a custom interpolant that - // computes "firstValue ^ isOdd( index )". - - } ); - - /** - * - * A Track of keyframe values that represent color. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function ColorKeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.call( this, name, times, values, interpolation ); - - } - - ColorKeyframeTrack.prototype = - Object.assign( Object.create( KeyframeTrackPrototype ), { - - constructor: ColorKeyframeTrack, - - ValueTypeName: 'color' - - // ValueBufferType is inherited - - // DefaultInterpolation is inherited - - - // Note: Very basic implementation and nothing special yet. - // However, this is the place for color space parameterization. - - } ); - - /** - * - * A timed sequence of keyframes for a specific property. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function KeyframeTrack( name, times, values, interpolation ) { - - KeyframeTrackConstructor.apply( this, arguments ); - - } - - KeyframeTrack.prototype = KeyframeTrackPrototype; - KeyframeTrackPrototype.constructor = KeyframeTrack; - - // Static methods: - - Object.assign( KeyframeTrack, { - - // Serialization (in static context, because of constructor invocation - // and automatic invocation of .toJSON): - - parse: function( json ) { - - if( json.type === undefined ) { - - throw new Error( "track type undefined, can not parse" ); - - } - - var trackType = KeyframeTrack._getTrackTypeForValueTypeName( json.type ); - - if ( json.times === undefined ) { - - var times = [], values = []; - - exports.AnimationUtils.flattenJSON( json.keys, times, values, 'value' ); - - json.times = times; - json.values = values; - - } - - // derived classes can define a static parse method - if ( trackType.parse !== undefined ) { - - return trackType.parse( json ); - - } else { - - // by default, we asssume a constructor compatible with the base - return new trackType( - json.name, json.times, json.values, json.interpolation ); - - } - - }, - - toJSON: function( track ) { - - var trackType = track.constructor; - - var json; - - // derived classes can define a static toJSON method - if ( trackType.toJSON !== undefined ) { - - json = trackType.toJSON( track ); - - } else { - - // by default, we assume the data can be serialized as-is - json = { - - 'name': track.name, - 'times': exports.AnimationUtils.convertArray( track.times, Array ), - 'values': exports.AnimationUtils.convertArray( track.values, Array ) - - }; - - var interpolation = track.getInterpolation(); - - if ( interpolation !== track.DefaultInterpolation ) { - - json.interpolation = interpolation; - - } - - } - - json.type = track.ValueTypeName; // mandatory - - return json; - - }, - - _getTrackTypeForValueTypeName: function( typeName ) { - - switch( typeName.toLowerCase() ) { - - case "scalar": - case "double": - case "float": - case "number": - case "integer": - - return NumberKeyframeTrack; - - case "vector": - case "vector2": - case "vector3": - case "vector4": - - return VectorKeyframeTrack; - - case "color": - - return ColorKeyframeTrack; - - case "quaternion": - - return QuaternionKeyframeTrack; - - case "bool": - case "boolean": - - return BooleanKeyframeTrack; - - case "string": - - return StringKeyframeTrack; - - } - - throw new Error( "Unsupported typeName: " + typeName ); - - } - - } ); - - /** - * - * Reusable set of Tracks that represent an animation. - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - */ - - function AnimationClip( name, duration, tracks ) { - - this.name = name; - this.tracks = tracks; - this.duration = ( duration !== undefined ) ? duration : -1; - - this.uuid = exports.Math.generateUUID(); - - // this means it should figure out its duration by scanning the tracks - if ( this.duration < 0 ) { - - this.resetDuration(); - - } - - this.optimize(); - - } - - AnimationClip.prototype = { - - constructor: AnimationClip, - - resetDuration: function() { - - var tracks = this.tracks, - duration = 0; - - for ( var i = 0, n = tracks.length; i !== n; ++ i ) { - - var track = this.tracks[ i ]; - - duration = Math.max( - duration, track.times[ track.times.length - 1 ] ); - - } - - this.duration = duration; - - }, - - trim: function() { - - for ( var i = 0; i < this.tracks.length; i ++ ) { - - this.tracks[ i ].trim( 0, this.duration ); - - } - - return this; - - }, - - optimize: function() { - - for ( var i = 0; i < this.tracks.length; i ++ ) { - - this.tracks[ i ].optimize(); - - } - - return this; - - } - - }; - - // Static methods: - - Object.assign( AnimationClip, { - - parse: function( json ) { - - var tracks = [], - jsonTracks = json.tracks, - frameTime = 1.0 / ( json.fps || 1.0 ); - - for ( var i = 0, n = jsonTracks.length; i !== n; ++ i ) { - - tracks.push( KeyframeTrack.parse( jsonTracks[ i ] ).scale( frameTime ) ); - - } - - return new AnimationClip( json.name, json.duration, tracks ); - - }, - - - toJSON: function( clip ) { - - var tracks = [], - clipTracks = clip.tracks; - - var json = { - - 'name': clip.name, - 'duration': clip.duration, - 'tracks': tracks - - }; - - for ( var i = 0, n = clipTracks.length; i !== n; ++ i ) { - - tracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) ); - - } - - return json; - - }, - - - CreateFromMorphTargetSequence: function( name, morphTargetSequence, fps, noLoop ) { - - var numMorphTargets = morphTargetSequence.length; - var tracks = []; - - for ( var i = 0; i < numMorphTargets; i ++ ) { - - var times = []; - var values = []; - - times.push( - ( i + numMorphTargets - 1 ) % numMorphTargets, - i, - ( i + 1 ) % numMorphTargets ); - - values.push( 0, 1, 0 ); - - var order = exports.AnimationUtils.getKeyframeOrder( times ); - times = exports.AnimationUtils.sortedArray( times, 1, order ); - values = exports.AnimationUtils.sortedArray( values, 1, order ); - - // if there is a key at the first frame, duplicate it as the - // last frame as well for perfect loop. - if ( ! noLoop && times[ 0 ] === 0 ) { - - times.push( numMorphTargets ); - values.push( values[ 0 ] ); - - } - - tracks.push( - new NumberKeyframeTrack( - '.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']', - times, values - ).scale( 1.0 / fps ) ); - } - - return new AnimationClip( name, -1, tracks ); - - }, - - findByName: function( objectOrClipArray, name ) { - - var clipArray = objectOrClipArray; - - if ( ! Array.isArray( objectOrClipArray ) ) { - - var o = objectOrClipArray; - clipArray = o.geometry && o.geometry.animations || o.animations; - - } - - for ( var i = 0; i < clipArray.length; i ++ ) { - - if ( clipArray[ i ].name === name ) { - - return clipArray[ i ]; - - } - } - - return null; - - }, - - CreateClipsFromMorphTargetSequences: function( morphTargets, fps, noLoop ) { - - var animationToMorphTargets = {}; - - // tested with https://regex101.com/ on trick sequences - // such flamingo_flyA_003, flamingo_run1_003, crdeath0059 - var pattern = /^([\w-]*?)([\d]+)$/; - - // sort morph target names into animation groups based - // patterns like Walk_001, Walk_002, Run_001, Run_002 - for ( var i = 0, il = morphTargets.length; i < il; i ++ ) { - - var morphTarget = morphTargets[ i ]; - var parts = morphTarget.name.match( pattern ); - - if ( parts && parts.length > 1 ) { - - var name = parts[ 1 ]; - - var animationMorphTargets = animationToMorphTargets[ name ]; - if ( ! animationMorphTargets ) { - - animationToMorphTargets[ name ] = animationMorphTargets = []; - - } - - animationMorphTargets.push( morphTarget ); - - } - - } - - var clips = []; - - for ( var name in animationToMorphTargets ) { - - clips.push( AnimationClip.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) ); - - } - - return clips; - - }, - - // parse the animation.hierarchy format - parseAnimation: function( animation, bones ) { - - if ( ! animation ) { - - console.error( " no animation in JSONLoader data" ); - return null; - - } - - var addNonemptyTrack = function( - trackType, trackName, animationKeys, propertyName, destTracks ) { - - // only return track if there are actually keys. - if ( animationKeys.length !== 0 ) { - - var times = []; - var values = []; - - exports.AnimationUtils.flattenJSON( - animationKeys, times, values, propertyName ); - - // empty keys are filtered out, so check again - if ( times.length !== 0 ) { - - destTracks.push( new trackType( trackName, times, values ) ); - - } - - } - - }; - - var tracks = []; - - var clipName = animation.name || 'default'; - // automatic length determination in AnimationClip. - var duration = animation.length || -1; - var fps = animation.fps || 30; - - var hierarchyTracks = animation.hierarchy || []; - - for ( var h = 0; h < hierarchyTracks.length; h ++ ) { - - var animationKeys = hierarchyTracks[ h ].keys; - - // skip empty tracks - if ( ! animationKeys || animationKeys.length === 0 ) continue; - - // process morph targets in a way exactly compatible - // with AnimationHandler.init( animation ) - if ( animationKeys[0].morphTargets ) { - - // figure out all morph targets used in this track - var morphTargetNames = {}; - for ( var k = 0; k < animationKeys.length; k ++ ) { - - if ( animationKeys[k].morphTargets ) { - - for ( var m = 0; m < animationKeys[k].morphTargets.length; m ++ ) { - - morphTargetNames[ animationKeys[k].morphTargets[m] ] = -1; - } - - } - - } - - // create a track for each morph target with all zero - // morphTargetInfluences except for the keys in which - // the morphTarget is named. - for ( var morphTargetName in morphTargetNames ) { - - var times = []; - var values = []; - - for ( var m = 0; - m !== animationKeys[k].morphTargets.length; ++ m ) { - - var animationKey = animationKeys[k]; - - times.push( animationKey.time ); - values.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 ); - - } - - tracks.push( new NumberKeyframeTrack( - '.morphTargetInfluence[' + morphTargetName + ']', times, values ) ); - - } - - duration = morphTargetNames.length * ( fps || 1.0 ); - - } else { - // ...assume skeletal animation - - var boneName = '.bones[' + bones[ h ].name + ']'; - - addNonemptyTrack( - VectorKeyframeTrack, boneName + '.position', - animationKeys, 'pos', tracks ); - - addNonemptyTrack( - QuaternionKeyframeTrack, boneName + '.quaternion', - animationKeys, 'rot', tracks ); - - addNonemptyTrack( - VectorKeyframeTrack, boneName + '.scale', - animationKeys, 'scl', tracks ); - - } - - } - - if ( tracks.length === 0 ) { - - return null; - - } - - var clip = new AnimationClip( clipName, duration, tracks ); - - return clip; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function MaterialLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - this.textures = {}; - - } - - Object.assign( MaterialLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new XHRLoader( scope.manager ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - }, onProgress, onError ); - - }, - - setTextures: function ( value ) { - - this.textures = value; - - }, - - parse: function ( json ) { - - var textures = this.textures; - - function getTexture( name ) { - - if ( textures[ name ] === undefined ) { - - console.warn( 'THREE.MaterialLoader: Undefined texture', name ); - - } - - return textures[ name ]; - - } - - var material = new Materials[ json.type ](); - - if ( json.uuid !== undefined ) material.uuid = json.uuid; - if ( json.name !== undefined ) material.name = json.name; - if ( json.color !== undefined ) material.color.setHex( json.color ); - if ( json.roughness !== undefined ) material.roughness = json.roughness; - if ( json.metalness !== undefined ) material.metalness = json.metalness; - if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive ); - if ( json.specular !== undefined ) material.specular.setHex( json.specular ); - if ( json.shininess !== undefined ) material.shininess = json.shininess; - if ( json.uniforms !== undefined ) material.uniforms = json.uniforms; - if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader; - if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader; - if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors; - if ( json.fog !== undefined ) material.fog = json.fog; - if ( json.shading !== undefined ) material.shading = json.shading; - if ( json.blending !== undefined ) material.blending = json.blending; - if ( json.side !== undefined ) material.side = json.side; - if ( json.opacity !== undefined ) material.opacity = json.opacity; - if ( json.transparent !== undefined ) material.transparent = json.transparent; - if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest; - if ( json.depthTest !== undefined ) material.depthTest = json.depthTest; - if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite; - if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite; - if ( json.wireframe !== undefined ) material.wireframe = json.wireframe; - if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth; - if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap; - if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin; - if ( json.skinning !== undefined ) material.skinning = json.skinning; - if ( json.morphTargets !== undefined ) material.morphTargets = json.morphTargets; - - // for PointsMaterial - - if ( json.size !== undefined ) material.size = json.size; - if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation; - - // maps - - if ( json.map !== undefined ) material.map = getTexture( json.map ); - - if ( json.alphaMap !== undefined ) { - - material.alphaMap = getTexture( json.alphaMap ); - material.transparent = true; - - } - - if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap ); - if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale; - - if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap ); - if ( json.normalScale !== undefined ) { - - var normalScale = json.normalScale; - - if ( Array.isArray( normalScale ) === false ) { - - // Blender exporter used to export a scalar. See #7459 - - normalScale = [ normalScale, normalScale ]; - - } - - material.normalScale = new Vector2().fromArray( normalScale ); - - } - - if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap ); - if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale; - if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias; - - if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap ); - if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap ); - - if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap ); - if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity; - - if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap ); - - if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap ); - - if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity; - - if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap ); - if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity; - - if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap ); - if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity; - - // MultiMaterial - - if ( json.materials !== undefined ) { - - for ( var i = 0, l = json.materials.length; i < l; i ++ ) { - - material.materials.push( this.parse( json.materials[ i ] ) ); - - } - - } - - return material; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function BufferGeometryLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - } - - Object.assign( BufferGeometryLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new XHRLoader( scope.manager ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - }, onProgress, onError ); - - }, - - parse: function ( json ) { - - var geometry = new BufferGeometry(); - - var index = json.data.index; - - var TYPED_ARRAYS = { - 'Int8Array': Int8Array, - 'Uint8Array': Uint8Array, - 'Uint8ClampedArray': Uint8ClampedArray, - 'Int16Array': Int16Array, - 'Uint16Array': Uint16Array, - 'Int32Array': Int32Array, - 'Uint32Array': Uint32Array, - 'Float32Array': Float32Array, - 'Float64Array': Float64Array - }; - - if ( index !== undefined ) { - - var typedArray = new TYPED_ARRAYS[ index.type ]( index.array ); - geometry.setIndex( new BufferAttribute( typedArray, 1 ) ); - - } - - var attributes = json.data.attributes; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - var typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array ); - - geometry.addAttribute( key, new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized ) ); - - } - - var groups = json.data.groups || json.data.drawcalls || json.data.offsets; - - if ( groups !== undefined ) { - - for ( var i = 0, n = groups.length; i !== n; ++ i ) { - - var group = groups[ i ]; - - geometry.addGroup( group.start, group.count, group.materialIndex ); - - } - - } - - var boundingSphere = json.data.boundingSphere; - - if ( boundingSphere !== undefined ) { - - var center = new Vector3(); - - if ( boundingSphere.center !== undefined ) { - - center.fromArray( boundingSphere.center ); - - } - - geometry.boundingSphere = new Sphere( center, boundingSphere.radius ); - - } - - return geometry; - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function Loader() { - - this.onLoadStart = function () {}; - this.onLoadProgress = function () {}; - this.onLoadComplete = function () {}; - - } - - Loader.prototype = { - - constructor: Loader, - - crossOrigin: undefined, - - extractUrlBase: function ( url ) { - - var parts = url.split( '/' ); - - if ( parts.length === 1 ) return './'; - - parts.pop(); - - return parts.join( '/' ) + '/'; - - }, - - initMaterials: function ( materials, texturePath, crossOrigin ) { - - var array = []; - - for ( var i = 0; i < materials.length; ++ i ) { - - array[ i ] = this.createMaterial( materials[ i ], texturePath, crossOrigin ); - - } - - return array; - - }, - - createMaterial: ( function () { - - var color, textureLoader, materialLoader; - - return function createMaterial( m, texturePath, crossOrigin ) { - - if ( color === undefined ) color = new Color(); - if ( textureLoader === undefined ) textureLoader = new TextureLoader(); - if ( materialLoader === undefined ) materialLoader = new MaterialLoader(); - - // convert from old material format - - var textures = {}; - - function loadTexture( path, repeat, offset, wrap, anisotropy ) { - - var fullPath = texturePath + path; - var loader = Loader.Handlers.get( fullPath ); - - var texture; - - if ( loader !== null ) { - - texture = loader.load( fullPath ); - - } else { - - textureLoader.setCrossOrigin( crossOrigin ); - texture = textureLoader.load( fullPath ); - - } - - if ( repeat !== undefined ) { - - texture.repeat.fromArray( repeat ); - - if ( repeat[ 0 ] !== 1 ) texture.wrapS = RepeatWrapping; - if ( repeat[ 1 ] !== 1 ) texture.wrapT = RepeatWrapping; - - } - - if ( offset !== undefined ) { - - texture.offset.fromArray( offset ); - - } - - if ( wrap !== undefined ) { - - if ( wrap[ 0 ] === 'repeat' ) texture.wrapS = RepeatWrapping; - if ( wrap[ 0 ] === 'mirror' ) texture.wrapS = MirroredRepeatWrapping; - - if ( wrap[ 1 ] === 'repeat' ) texture.wrapT = RepeatWrapping; - if ( wrap[ 1 ] === 'mirror' ) texture.wrapT = MirroredRepeatWrapping; - - } - - if ( anisotropy !== undefined ) { - - texture.anisotropy = anisotropy; - - } - - var uuid = exports.Math.generateUUID(); - - textures[ uuid ] = texture; - - return uuid; - - } - - // - - var json = { - uuid: exports.Math.generateUUID(), - type: 'MeshLambertMaterial' - }; - - for ( var name in m ) { - - var value = m[ name ]; - - switch ( name ) { - case 'DbgColor': - case 'DbgIndex': - case 'opticalDensity': - case 'illumination': - break; - case 'DbgName': - json.name = value; - break; - case 'blending': - json.blending = BlendingMode[ value ]; - break; - case 'colorAmbient': - case 'mapAmbient': - console.warn( 'THREE.Loader.createMaterial:', name, 'is no longer supported.' ); - break; - case 'colorDiffuse': - json.color = color.fromArray( value ).getHex(); - break; - case 'colorSpecular': - json.specular = color.fromArray( value ).getHex(); - break; - case 'colorEmissive': - json.emissive = color.fromArray( value ).getHex(); - break; - case 'specularCoef': - json.shininess = value; - break; - case 'shading': - if ( value.toLowerCase() === 'basic' ) json.type = 'MeshBasicMaterial'; - if ( value.toLowerCase() === 'phong' ) json.type = 'MeshPhongMaterial'; - if ( value.toLowerCase() === 'standard' ) json.type = 'MeshStandardMaterial'; - break; - case 'mapDiffuse': - json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy ); - break; - case 'mapDiffuseRepeat': - case 'mapDiffuseOffset': - case 'mapDiffuseWrap': - case 'mapDiffuseAnisotropy': - break; - case 'mapEmissive': - json.emissiveMap = loadTexture( value, m.mapEmissiveRepeat, m.mapEmissiveOffset, m.mapEmissiveWrap, m.mapEmissiveAnisotropy ); - break; - case 'mapEmissiveRepeat': - case 'mapEmissiveOffset': - case 'mapEmissiveWrap': - case 'mapEmissiveAnisotropy': - break; - case 'mapLight': - json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy ); - break; - case 'mapLightRepeat': - case 'mapLightOffset': - case 'mapLightWrap': - case 'mapLightAnisotropy': - break; - case 'mapAO': - json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy ); - break; - case 'mapAORepeat': - case 'mapAOOffset': - case 'mapAOWrap': - case 'mapAOAnisotropy': - break; - case 'mapBump': - json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy ); - break; - case 'mapBumpScale': - json.bumpScale = value; - break; - case 'mapBumpRepeat': - case 'mapBumpOffset': - case 'mapBumpWrap': - case 'mapBumpAnisotropy': - break; - case 'mapNormal': - json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy ); - break; - case 'mapNormalFactor': - json.normalScale = [ value, value ]; - break; - case 'mapNormalRepeat': - case 'mapNormalOffset': - case 'mapNormalWrap': - case 'mapNormalAnisotropy': - break; - case 'mapSpecular': - json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy ); - break; - case 'mapSpecularRepeat': - case 'mapSpecularOffset': - case 'mapSpecularWrap': - case 'mapSpecularAnisotropy': - break; - case 'mapMetalness': - json.metalnessMap = loadTexture( value, m.mapMetalnessRepeat, m.mapMetalnessOffset, m.mapMetalnessWrap, m.mapMetalnessAnisotropy ); - break; - case 'mapMetalnessRepeat': - case 'mapMetalnessOffset': - case 'mapMetalnessWrap': - case 'mapMetalnessAnisotropy': - break; - case 'mapRoughness': - json.roughnessMap = loadTexture( value, m.mapRoughnessRepeat, m.mapRoughnessOffset, m.mapRoughnessWrap, m.mapRoughnessAnisotropy ); - break; - case 'mapRoughnessRepeat': - case 'mapRoughnessOffset': - case 'mapRoughnessWrap': - case 'mapRoughnessAnisotropy': - break; - case 'mapAlpha': - json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy ); - break; - case 'mapAlphaRepeat': - case 'mapAlphaOffset': - case 'mapAlphaWrap': - case 'mapAlphaAnisotropy': - break; - case 'flipSided': - json.side = BackSide; - break; - case 'doubleSided': - json.side = DoubleSide; - break; - case 'transparency': - console.warn( 'THREE.Loader.createMaterial: transparency has been renamed to opacity' ); - json.opacity = value; - break; - case 'depthTest': - case 'depthWrite': - case 'colorWrite': - case 'opacity': - case 'reflectivity': - case 'transparent': - case 'visible': - case 'wireframe': - json[ name ] = value; - break; - case 'vertexColors': - if ( value === true ) json.vertexColors = VertexColors; - if ( value === 'face' ) json.vertexColors = FaceColors; - break; - default: - console.error( 'THREE.Loader.createMaterial: Unsupported', name, value ); - break; - } - - } - - if ( json.type === 'MeshBasicMaterial' ) delete json.emissive; - if ( json.type !== 'MeshPhongMaterial' ) delete json.specular; - - if ( json.opacity < 1 ) json.transparent = true; - - materialLoader.setTextures( textures ); - - return materialLoader.parse( json ); - - }; - - } )() - - }; - - Loader.Handlers = { - - handlers: [], - - add: function ( regex, loader ) { - - this.handlers.push( regex, loader ); - - }, - - get: function ( file ) { - - var handlers = this.handlers; - - for ( var i = 0, l = handlers.length; i < l; i += 2 ) { - - var regex = handlers[ i ]; - var loader = handlers[ i + 1 ]; - - if ( regex.test( file ) ) { - - return loader; - - } - - } - - return null; - - } - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function JSONLoader( manager ) { - - if ( typeof manager === 'boolean' ) { - - console.warn( 'THREE.JSONLoader: showStatus parameter has been removed from constructor.' ); - manager = undefined; - - } - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - this.withCredentials = false; - - } - - Object.assign( JSONLoader.prototype, { - - load: function( url, onLoad, onProgress, onError ) { - - var scope = this; - - var texturePath = this.texturePath && ( typeof this.texturePath === "string" ) ? this.texturePath : Loader.prototype.extractUrlBase( url ); - - var loader = new XHRLoader( this.manager ); - loader.setWithCredentials( this.withCredentials ); - loader.load( url, function ( text ) { - - var json = JSON.parse( text ); - var metadata = json.metadata; - - if ( metadata !== undefined ) { - - var type = metadata.type; - - if ( type !== undefined ) { - - if ( type.toLowerCase() === 'object' ) { - - console.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.ObjectLoader instead.' ); - return; - - } - - if ( type.toLowerCase() === 'scene' ) { - - console.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.SceneLoader instead.' ); - return; - - } - - } - - } - - var object = scope.parse( json, texturePath ); - onLoad( object.geometry, object.materials ); - - }, onProgress, onError ); - - }, - - setTexturePath: function ( value ) { - - this.texturePath = value; - - }, - - parse: function ( json, texturePath ) { - - var geometry = new Geometry(), - scale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0; - - parseModel( scale ); - - parseSkin(); - parseMorphing( scale ); - parseAnimations(); - - geometry.computeFaceNormals(); - geometry.computeBoundingSphere(); - - function parseModel( scale ) { - - function isBitSet( value, position ) { - - return value & ( 1 << position ); - - } - - var i, j, fi, - - offset, zLength, - - colorIndex, normalIndex, uvIndex, materialIndex, - - type, - isQuad, - hasMaterial, - hasFaceVertexUv, - hasFaceNormal, hasFaceVertexNormal, - hasFaceColor, hasFaceVertexColor, - - vertex, face, faceA, faceB, hex, normal, - - uvLayer, uv, u, v, - - faces = json.faces, - vertices = json.vertices, - normals = json.normals, - colors = json.colors, - - nUvLayers = 0; - - if ( json.uvs !== undefined ) { - - // disregard empty arrays - - for ( i = 0; i < json.uvs.length; i ++ ) { - - if ( json.uvs[ i ].length ) nUvLayers ++; - - } - - for ( i = 0; i < nUvLayers; i ++ ) { - - geometry.faceVertexUvs[ i ] = []; - - } - - } - - offset = 0; - zLength = vertices.length; - - while ( offset < zLength ) { - - vertex = new Vector3(); - - vertex.x = vertices[ offset ++ ] * scale; - vertex.y = vertices[ offset ++ ] * scale; - vertex.z = vertices[ offset ++ ] * scale; - - geometry.vertices.push( vertex ); - - } - - offset = 0; - zLength = faces.length; - - while ( offset < zLength ) { - - type = faces[ offset ++ ]; - - - isQuad = isBitSet( type, 0 ); - hasMaterial = isBitSet( type, 1 ); - hasFaceVertexUv = isBitSet( type, 3 ); - hasFaceNormal = isBitSet( type, 4 ); - hasFaceVertexNormal = isBitSet( type, 5 ); - hasFaceColor = isBitSet( type, 6 ); - hasFaceVertexColor = isBitSet( type, 7 ); - - // console.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor); - - if ( isQuad ) { - - faceA = new Face3(); - faceA.a = faces[ offset ]; - faceA.b = faces[ offset + 1 ]; - faceA.c = faces[ offset + 3 ]; - - faceB = new Face3(); - faceB.a = faces[ offset + 1 ]; - faceB.b = faces[ offset + 2 ]; - faceB.c = faces[ offset + 3 ]; - - offset += 4; - - if ( hasMaterial ) { - - materialIndex = faces[ offset ++ ]; - faceA.materialIndex = materialIndex; - faceB.materialIndex = materialIndex; - - } - - // to get face <=> uv index correspondence - - fi = geometry.faces.length; - - if ( hasFaceVertexUv ) { - - for ( i = 0; i < nUvLayers; i ++ ) { - - uvLayer = json.uvs[ i ]; - - geometry.faceVertexUvs[ i ][ fi ] = []; - geometry.faceVertexUvs[ i ][ fi + 1 ] = []; - - for ( j = 0; j < 4; j ++ ) { - - uvIndex = faces[ offset ++ ]; - - u = uvLayer[ uvIndex * 2 ]; - v = uvLayer[ uvIndex * 2 + 1 ]; - - uv = new Vector2( u, v ); - - if ( j !== 2 ) geometry.faceVertexUvs[ i ][ fi ].push( uv ); - if ( j !== 0 ) geometry.faceVertexUvs[ i ][ fi + 1 ].push( uv ); - - } - - } - - } - - if ( hasFaceNormal ) { - - normalIndex = faces[ offset ++ ] * 3; - - faceA.normal.set( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - faceB.normal.copy( faceA.normal ); - - } - - if ( hasFaceVertexNormal ) { - - for ( i = 0; i < 4; i ++ ) { - - normalIndex = faces[ offset ++ ] * 3; - - normal = new Vector3( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - - if ( i !== 2 ) faceA.vertexNormals.push( normal ); - if ( i !== 0 ) faceB.vertexNormals.push( normal ); - - } - - } - - - if ( hasFaceColor ) { - - colorIndex = faces[ offset ++ ]; - hex = colors[ colorIndex ]; - - faceA.color.setHex( hex ); - faceB.color.setHex( hex ); - - } - - - if ( hasFaceVertexColor ) { - - for ( i = 0; i < 4; i ++ ) { - - colorIndex = faces[ offset ++ ]; - hex = colors[ colorIndex ]; - - if ( i !== 2 ) faceA.vertexColors.push( new Color( hex ) ); - if ( i !== 0 ) faceB.vertexColors.push( new Color( hex ) ); - - } - - } - - geometry.faces.push( faceA ); - geometry.faces.push( faceB ); - - } else { - - face = new Face3(); - face.a = faces[ offset ++ ]; - face.b = faces[ offset ++ ]; - face.c = faces[ offset ++ ]; - - if ( hasMaterial ) { - - materialIndex = faces[ offset ++ ]; - face.materialIndex = materialIndex; - - } - - // to get face <=> uv index correspondence - - fi = geometry.faces.length; - - if ( hasFaceVertexUv ) { - - for ( i = 0; i < nUvLayers; i ++ ) { - - uvLayer = json.uvs[ i ]; - - geometry.faceVertexUvs[ i ][ fi ] = []; - - for ( j = 0; j < 3; j ++ ) { - - uvIndex = faces[ offset ++ ]; - - u = uvLayer[ uvIndex * 2 ]; - v = uvLayer[ uvIndex * 2 + 1 ]; - - uv = new Vector2( u, v ); - - geometry.faceVertexUvs[ i ][ fi ].push( uv ); - - } - - } - - } - - if ( hasFaceNormal ) { - - normalIndex = faces[ offset ++ ] * 3; - - face.normal.set( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - } - - if ( hasFaceVertexNormal ) { - - for ( i = 0; i < 3; i ++ ) { - - normalIndex = faces[ offset ++ ] * 3; - - normal = new Vector3( - normals[ normalIndex ++ ], - normals[ normalIndex ++ ], - normals[ normalIndex ] - ); - - face.vertexNormals.push( normal ); - - } - - } - - - if ( hasFaceColor ) { - - colorIndex = faces[ offset ++ ]; - face.color.setHex( colors[ colorIndex ] ); - - } - - - if ( hasFaceVertexColor ) { - - for ( i = 0; i < 3; i ++ ) { - - colorIndex = faces[ offset ++ ]; - face.vertexColors.push( new Color( colors[ colorIndex ] ) ); - - } - - } - - geometry.faces.push( face ); - - } - - } - - } - - function parseSkin() { - - var influencesPerVertex = ( json.influencesPerVertex !== undefined ) ? json.influencesPerVertex : 2; - - if ( json.skinWeights ) { - - for ( var i = 0, l = json.skinWeights.length; i < l; i += influencesPerVertex ) { - - var x = json.skinWeights[ i ]; - var y = ( influencesPerVertex > 1 ) ? json.skinWeights[ i + 1 ] : 0; - var z = ( influencesPerVertex > 2 ) ? json.skinWeights[ i + 2 ] : 0; - var w = ( influencesPerVertex > 3 ) ? json.skinWeights[ i + 3 ] : 0; - - geometry.skinWeights.push( new Vector4( x, y, z, w ) ); - - } - - } - - if ( json.skinIndices ) { - - for ( var i = 0, l = json.skinIndices.length; i < l; i += influencesPerVertex ) { - - var a = json.skinIndices[ i ]; - var b = ( influencesPerVertex > 1 ) ? json.skinIndices[ i + 1 ] : 0; - var c = ( influencesPerVertex > 2 ) ? json.skinIndices[ i + 2 ] : 0; - var d = ( influencesPerVertex > 3 ) ? json.skinIndices[ i + 3 ] : 0; - - geometry.skinIndices.push( new Vector4( a, b, c, d ) ); - - } - - } - - geometry.bones = json.bones; - - if ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) { - - console.warn( 'When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' + - geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' ); - - } - - } - - function parseMorphing( scale ) { - - if ( json.morphTargets !== undefined ) { - - for ( var i = 0, l = json.morphTargets.length; i < l; i ++ ) { - - geometry.morphTargets[ i ] = {}; - geometry.morphTargets[ i ].name = json.morphTargets[ i ].name; - geometry.morphTargets[ i ].vertices = []; - - var dstVertices = geometry.morphTargets[ i ].vertices; - var srcVertices = json.morphTargets[ i ].vertices; - - for ( var v = 0, vl = srcVertices.length; v < vl; v += 3 ) { - - var vertex = new Vector3(); - vertex.x = srcVertices[ v ] * scale; - vertex.y = srcVertices[ v + 1 ] * scale; - vertex.z = srcVertices[ v + 2 ] * scale; - - dstVertices.push( vertex ); - - } - - } - - } - - if ( json.morphColors !== undefined && json.morphColors.length > 0 ) { - - console.warn( 'THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.' ); - - var faces = geometry.faces; - var morphColors = json.morphColors[ 0 ].colors; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - faces[ i ].color.fromArray( morphColors, i * 3 ); - - } - - } - - } - - function parseAnimations() { - - var outputAnimations = []; - - // parse old style Bone/Hierarchy animations - var animations = []; - - if ( json.animation !== undefined ) { - - animations.push( json.animation ); - - } - - if ( json.animations !== undefined ) { - - if ( json.animations.length ) { - - animations = animations.concat( json.animations ); - - } else { - - animations.push( json.animations ); - - } - - } - - for ( var i = 0; i < animations.length; i ++ ) { - - var clip = AnimationClip.parseAnimation( animations[ i ], geometry.bones ); - if ( clip ) outputAnimations.push( clip ); - - } - - // parse implicit morph animations - if ( geometry.morphTargets ) { - - // TODO: Figure out what an appropraite FPS is for morph target animations -- defaulting to 10, but really it is completely arbitrary. - var morphAnimationClips = AnimationClip.CreateClipsFromMorphTargetSequences( geometry.morphTargets, 10 ); - outputAnimations = outputAnimations.concat( morphAnimationClips ); - - } - - if ( outputAnimations.length > 0 ) geometry.animations = outputAnimations; - - } - - if ( json.materials === undefined || json.materials.length === 0 ) { - - return { geometry: geometry }; - - } else { - - var materials = Loader.prototype.initMaterials( json.materials, texturePath, this.crossOrigin ); - - return { geometry: geometry, materials: materials }; - - } - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function ObjectLoader ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - this.texturePath = ''; - - } - - Object.assign( ObjectLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - if ( this.texturePath === '' ) { - - this.texturePath = url.substring( 0, url.lastIndexOf( '/' ) + 1 ); - - } - - var scope = this; - - var loader = new XHRLoader( scope.manager ); - loader.load( url, function ( text ) { - - scope.parse( JSON.parse( text ), onLoad ); - - }, onProgress, onError ); - - }, - - setTexturePath: function ( value ) { - - this.texturePath = value; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json, onLoad ) { - - var geometries = this.parseGeometries( json.geometries ); - - var images = this.parseImages( json.images, function () { - - if ( onLoad !== undefined ) onLoad( object ); - - } ); - - var textures = this.parseTextures( json.textures, images ); - var materials = this.parseMaterials( json.materials, textures ); - - var object = this.parseObject( json.object, geometries, materials ); - - if ( json.animations ) { - - object.animations = this.parseAnimations( json.animations ); - - } - - if ( json.images === undefined || json.images.length === 0 ) { - - if ( onLoad !== undefined ) onLoad( object ); - - } - - return object; - - }, - - parseGeometries: function ( json ) { - - var geometries = {}; - - if ( json !== undefined ) { - - var geometryLoader = new JSONLoader(); - var bufferGeometryLoader = new BufferGeometryLoader(); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var geometry; - var data = json[ i ]; - - switch ( data.type ) { - - case 'PlaneGeometry': - case 'PlaneBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.width, - data.height, - data.widthSegments, - data.heightSegments - ); - - break; - - case 'BoxGeometry': - case 'BoxBufferGeometry': - case 'CubeGeometry': // backwards compatible - - geometry = new Geometries[ data.type ]( - data.width, - data.height, - data.depth, - data.widthSegments, - data.heightSegments, - data.depthSegments - ); - - break; - - case 'CircleGeometry': - case 'CircleBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.segments, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'CylinderGeometry': - case 'CylinderBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radiusTop, - data.radiusBottom, - data.height, - data.radialSegments, - data.heightSegments, - data.openEnded, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'ConeGeometry': - case 'ConeBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.height, - data.radialSegments, - data.heightSegments, - data.openEnded, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'SphereGeometry': - case 'SphereBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.widthSegments, - data.heightSegments, - data.phiStart, - data.phiLength, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'DodecahedronGeometry': - case 'IcosahedronGeometry': - case 'OctahedronGeometry': - case 'TetrahedronGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.detail - ); - - break; - - case 'RingGeometry': - case 'RingBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.innerRadius, - data.outerRadius, - data.thetaSegments, - data.phiSegments, - data.thetaStart, - data.thetaLength - ); - - break; - - case 'TorusGeometry': - case 'TorusBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.tube, - data.radialSegments, - data.tubularSegments, - data.arc - ); - - break; - - case 'TorusKnotGeometry': - case 'TorusKnotBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.radius, - data.tube, - data.tubularSegments, - data.radialSegments, - data.p, - data.q - ); - - break; - - case 'LatheGeometry': - case 'LatheBufferGeometry': - - geometry = new Geometries[ data.type ]( - data.points, - data.segments, - data.phiStart, - data.phiLength - ); - - break; - - case 'BufferGeometry': - - geometry = bufferGeometryLoader.parse( data ); - - break; - - case 'Geometry': - - geometry = geometryLoader.parse( data.data, this.texturePath ).geometry; - - break; - - default: - - console.warn( 'THREE.ObjectLoader: Unsupported geometry type "' + data.type + '"' ); - - continue; - - } - - geometry.uuid = data.uuid; - - if ( data.name !== undefined ) geometry.name = data.name; - - geometries[ data.uuid ] = geometry; - - } - - } - - return geometries; - - }, - - parseMaterials: function ( json, textures ) { - - var materials = {}; - - if ( json !== undefined ) { - - var loader = new MaterialLoader(); - loader.setTextures( textures ); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var material = loader.parse( json[ i ] ); - materials[ material.uuid ] = material; - - } - - } - - return materials; - - }, - - parseAnimations: function ( json ) { - - var animations = []; - - for ( var i = 0; i < json.length; i ++ ) { - - var clip = AnimationClip.parse( json[ i ] ); - - animations.push( clip ); - - } - - return animations; - - }, - - parseImages: function ( json, onLoad ) { - - var scope = this; - var images = {}; - - function loadImage( url ) { - - scope.manager.itemStart( url ); - - return loader.load( url, function () { - - scope.manager.itemEnd( url ); - - }, undefined, function () { - - scope.manager.itemError( url ); - - } ); - - } - - if ( json !== undefined && json.length > 0 ) { - - var manager = new LoadingManager( onLoad ); - - var loader = new ImageLoader( manager ); - loader.setCrossOrigin( this.crossOrigin ); - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var image = json[ i ]; - var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url; - - images[ image.uuid ] = loadImage( path ); - - } - - } - - return images; - - }, - - parseTextures: function ( json, images ) { - - function parseConstant( value, type ) { - - if ( typeof( value ) === 'number' ) return value; - - console.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value ); - - return type[ value ]; - - } - - var textures = {}; - - if ( json !== undefined ) { - - for ( var i = 0, l = json.length; i < l; i ++ ) { - - var data = json[ i ]; - - if ( data.image === undefined ) { - - console.warn( 'THREE.ObjectLoader: No "image" specified for', data.uuid ); - - } - - if ( images[ data.image ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined image', data.image ); - - } - - var texture = new Texture( images[ data.image ] ); - texture.needsUpdate = true; - - texture.uuid = data.uuid; - - if ( data.name !== undefined ) texture.name = data.name; - - if ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TextureMapping ); - - if ( data.offset !== undefined ) texture.offset.fromArray( data.offset ); - if ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat ); - if ( data.wrap !== undefined ) { - - texture.wrapS = parseConstant( data.wrap[ 0 ], TextureWrapping ); - texture.wrapT = parseConstant( data.wrap[ 1 ], TextureWrapping ); - - } - - if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TextureFilter ); - if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TextureFilter ); - if ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy; - - if ( data.flipY !== undefined ) texture.flipY = data.flipY; - - textures[ data.uuid ] = texture; - - } - - } - - return textures; - - }, - - parseObject: function () { - - var matrix = new Matrix4(); - - return function parseObject( data, geometries, materials ) { - - var object; - - function getGeometry( name ) { - - if ( geometries[ name ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined geometry', name ); - - } - - return geometries[ name ]; - - } - - function getMaterial( name ) { - - if ( name === undefined ) return undefined; - - if ( materials[ name ] === undefined ) { - - console.warn( 'THREE.ObjectLoader: Undefined material', name ); - - } - - return materials[ name ]; - - } - - switch ( data.type ) { - - case 'Scene': - - object = new Scene(); - - if ( data.background !== undefined ) { - - if ( Number.isInteger( data.background ) ) { - - object.background = new Color( data.background ); - - } - - } - - if ( data.fog !== undefined ) { - - if ( data.fog.type === 'Fog' ) { - - object.fog = new Fog( data.fog.color, data.fog.near, data.fog.far ); - - } else if ( data.fog.type === 'FogExp2' ) { - - object.fog = new FogExp2( data.fog.color, data.fog.density ); - - } - - } - - break; - - case 'PerspectiveCamera': - - object = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); - - if ( data.focus !== undefined ) object.focus = data.focus; - if ( data.zoom !== undefined ) object.zoom = data.zoom; - if ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge; - if ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset; - if ( data.view !== undefined ) object.view = Object.assign( {}, data.view ); - - break; - - case 'OrthographicCamera': - - object = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); - - break; - - case 'AmbientLight': - - object = new AmbientLight( data.color, data.intensity ); - - break; - - case 'DirectionalLight': - - object = new DirectionalLight( data.color, data.intensity ); - - break; - - case 'PointLight': - - object = new PointLight( data.color, data.intensity, data.distance, data.decay ); - - break; - - case 'SpotLight': - - object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay ); - - break; - - case 'HemisphereLight': - - object = new HemisphereLight( data.color, data.groundColor, data.intensity ); - - break; - - case 'Mesh': - - var geometry = getGeometry( data.geometry ); - var material = getMaterial( data.material ); - - if ( geometry.bones && geometry.bones.length > 0 ) { - - object = new SkinnedMesh( geometry, material ); - - } else { - - object = new Mesh( geometry, material ); - - } - - break; - - case 'LOD': - - object = new LOD(); - - break; - - case 'Line': - - object = new Line( getGeometry( data.geometry ), getMaterial( data.material ), data.mode ); - - break; - - case 'LineSegments': - - object = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'PointCloud': - case 'Points': - - object = new Points( getGeometry( data.geometry ), getMaterial( data.material ) ); - - break; - - case 'Sprite': - - object = new Sprite( getMaterial( data.material ) ); - - break; - - case 'Group': - - object = new Group(); - - break; - - default: - - object = new Object3D(); - - } - - object.uuid = data.uuid; - - if ( data.name !== undefined ) object.name = data.name; - if ( data.matrix !== undefined ) { - - matrix.fromArray( data.matrix ); - matrix.decompose( object.position, object.quaternion, object.scale ); - - } else { - - if ( data.position !== undefined ) object.position.fromArray( data.position ); - if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); - if ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion ); - if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); - - } - - if ( data.castShadow !== undefined ) object.castShadow = data.castShadow; - if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow; - - if ( data.shadow ) { - - if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias; - if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius; - if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize ); - if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera ); - - } - - if ( data.visible !== undefined ) object.visible = data.visible; - if ( data.userData !== undefined ) object.userData = data.userData; - - if ( data.children !== undefined ) { - - for ( var child in data.children ) { - - object.add( this.parseObject( data.children[ child ], geometries, materials ) ); - - } - - } - - if ( data.type === 'LOD' ) { - - var levels = data.levels; - - for ( var l = 0; l < levels.length; l ++ ) { - - var level = levels[ l ]; - var child = object.getObjectByProperty( 'uuid', level.object ); - - if ( child !== undefined ) { - - object.addLevel( child, level.distance ); - - } - - } - - } - - return object; - - }; - - }() - - } ); - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Extensible curve object - * - * Some common of Curve methods - * .getPoint(t), getTangent(t) - * .getPointAt(u), getTangentAt(u) - * .getPoints(), .getSpacedPoints() - * .getLength() - * .updateArcLengths() - * - * This following classes subclasses THREE.Curve: - * - * -- 2d classes -- - * THREE.LineCurve - * THREE.QuadraticBezierCurve - * THREE.CubicBezierCurve - * THREE.SplineCurve - * THREE.ArcCurve - * THREE.EllipseCurve - * - * -- 3d classes -- - * THREE.LineCurve3 - * THREE.QuadraticBezierCurve3 - * THREE.CubicBezierCurve3 - * THREE.SplineCurve3 - * - * A series of curves can be represented as a THREE.CurvePath - * - **/ - - /************************************************************** - * Abstract Curve base class - **************************************************************/ - - function Curve() {} - - Curve.prototype = { - - constructor: Curve, - - // Virtual base class method to overwrite and implement in subclasses - // - t [0 .. 1] - - getPoint: function ( t ) { - - console.warn( "THREE.Curve: Warning, getPoint() not implemented!" ); - return null; - - }, - - // Get point at relative position in curve according to arc length - // - u [0 .. 1] - - getPointAt: function ( u ) { - - var t = this.getUtoTmapping( u ); - return this.getPoint( t ); - - }, - - // Get sequence of points using getPoint( t ) - - getPoints: function ( divisions ) { - - if ( ! divisions ) divisions = 5; - - var points = []; - - for ( var d = 0; d <= divisions; d ++ ) { - - points.push( this.getPoint( d / divisions ) ); - - } - - return points; - - }, - - // Get sequence of points using getPointAt( u ) - - getSpacedPoints: function ( divisions ) { - - if ( ! divisions ) divisions = 5; - - var points = []; - - for ( var d = 0; d <= divisions; d ++ ) { - - points.push( this.getPointAt( d / divisions ) ); - - } - - return points; - - }, - - // Get total curve arc length - - getLength: function () { - - var lengths = this.getLengths(); - return lengths[ lengths.length - 1 ]; - - }, - - // Get list of cumulative segment lengths - - getLengths: function ( divisions ) { - - if ( ! divisions ) divisions = ( this.__arcLengthDivisions ) ? ( this.__arcLengthDivisions ) : 200; - - if ( this.cacheArcLengths - && ( this.cacheArcLengths.length === divisions + 1 ) - && ! this.needsUpdate ) { - - //console.log( "cached", this.cacheArcLengths ); - return this.cacheArcLengths; - - } - - this.needsUpdate = false; - - var cache = []; - var current, last = this.getPoint( 0 ); - var p, sum = 0; - - cache.push( 0 ); - - for ( p = 1; p <= divisions; p ++ ) { - - current = this.getPoint ( p / divisions ); - sum += current.distanceTo( last ); - cache.push( sum ); - last = current; - - } - - this.cacheArcLengths = cache; - - return cache; // { sums: cache, sum:sum }; Sum is in the last element. - - }, - - updateArcLengths: function() { - - this.needsUpdate = true; - this.getLengths(); - - }, - - // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - - getUtoTmapping: function ( u, distance ) { - - var arcLengths = this.getLengths(); - - var i = 0, il = arcLengths.length; - - var targetArcLength; // The targeted u distance value to get - - if ( distance ) { - - targetArcLength = distance; - - } else { - - targetArcLength = u * arcLengths[ il - 1 ]; - - } - - //var time = Date.now(); - - // binary search for the index with largest value smaller than target u distance - - var low = 0, high = il - 1, comparison; - - while ( low <= high ) { - - i = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - - comparison = arcLengths[ i ] - targetArcLength; - - if ( comparison < 0 ) { - - low = i + 1; - - } else if ( comparison > 0 ) { - - high = i - 1; - - } else { - - high = i; - break; - - // DONE - - } - - } - - i = high; - - //console.log('b' , i, low, high, Date.now()- time); - - if ( arcLengths[ i ] === targetArcLength ) { - - var t = i / ( il - 1 ); - return t; - - } - - // we could get finer grain at lengths, or use simple interpolation between two points - - var lengthBefore = arcLengths[ i ]; - var lengthAfter = arcLengths[ i + 1 ]; - - var segmentLength = lengthAfter - lengthBefore; - - // determine where we are between the 'before' and 'after' points - - var segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength; - - // add that fractional amount to t - - var t = ( i + segmentFraction ) / ( il - 1 ); - - return t; - - }, - - // Returns a unit vector tangent at t - // In case any sub curve does not implement its tangent derivation, - // 2 points a small delta apart will be used to find its gradient - // which seems to give a reasonable approximation - - getTangent: function( t ) { - - var delta = 0.0001; - var t1 = t - delta; - var t2 = t + delta; - - // Capping in case of danger - - if ( t1 < 0 ) t1 = 0; - if ( t2 > 1 ) t2 = 1; - - var pt1 = this.getPoint( t1 ); - var pt2 = this.getPoint( t2 ); - - var vec = pt2.clone().sub( pt1 ); - return vec.normalize(); - - }, - - getTangentAt: function ( u ) { - - var t = this.getUtoTmapping( u ); - return this.getTangent( t ); - - } - - }; - - // TODO: Transformation for Curves? - - /************************************************************** - * 3D Curves - **************************************************************/ - - // A Factory method for creating new curve subclasses - - Curve.create = function ( constructor, getPointFunc ) { - - constructor.prototype = Object.create( Curve.prototype ); - constructor.prototype.constructor = constructor; - constructor.prototype.getPoint = getPointFunc; - - return constructor; - - }; - - /************************************************************** - * Line - **************************************************************/ - - function LineCurve( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - - } - - LineCurve.prototype = Object.create( Curve.prototype ); - LineCurve.prototype.constructor = LineCurve; - - LineCurve.prototype.isLineCurve = true; - - LineCurve.prototype.getPoint = function ( t ) { - - if ( t === 1 ) { - - return this.v2.clone(); - - } - - var point = this.v2.clone().sub( this.v1 ); - point.multiplyScalar( t ).add( this.v1 ); - - return point; - - }; - - // Line curve is linear, so we can overwrite default getPointAt - - LineCurve.prototype.getPointAt = function ( u ) { - - return this.getPoint( u ); - - }; - - LineCurve.prototype.getTangent = function( t ) { - - var tangent = this.v2.clone().sub( this.v1 ); - - return tangent.normalize(); - - }; - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - * - **/ - - /************************************************************** - * Curved Path - a curve path is simply a array of connected - * curves, but retains the api of a curve - **************************************************************/ - - function CurvePath() { - - this.curves = []; - - this.autoClose = false; // Automatically closes the path - - } - - CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { - - constructor: CurvePath, - - add: function ( curve ) { - - this.curves.push( curve ); - - }, - - closePath: function () { - - // Add a line curve if start and end of lines are not connected - var startPoint = this.curves[ 0 ].getPoint( 0 ); - var endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 ); - - if ( ! startPoint.equals( endPoint ) ) { - - this.curves.push( new LineCurve( endPoint, startPoint ) ); - - } - - }, - - // To get accurate point with reference to - // entire path distance at time t, - // following has to be done: - - // 1. Length of each sub path have to be known - // 2. Locate and identify type of curve - // 3. Get t for the curve - // 4. Return curve.getPointAt(t') - - getPoint: function ( t ) { - - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; - - // To think about boundaries points. - - while ( i < curveLengths.length ) { - - if ( curveLengths[ i ] >= d ) { - - var diff = curveLengths[ i ] - d; - var curve = this.curves[ i ]; - - var segmentLength = curve.getLength(); - var u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; - - return curve.getPointAt( u ); - - } - - i ++; - - } - - return null; - - // loop where sum != 0, sum > d , sum+1 <d - - }, - - // We cannot use the default THREE.Curve getPoint() with getLength() because in - // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath - // getPoint() depends on getLength - - getLength: function () { - - var lens = this.getCurveLengths(); - return lens[ lens.length - 1 ]; - - }, - - // cacheLengths must be recalculated. - updateArcLengths: function () { - - this.needsUpdate = true; - this.cacheLengths = null; - this.getLengths(); - - }, - - // Compute lengths and cache them - // We cannot overwrite getLengths() because UtoT mapping uses it. - - getCurveLengths: function () { - - // We use cache values if curves and cache array are same length - - if ( this.cacheLengths && this.cacheLengths.length === this.curves.length ) { - - return this.cacheLengths; - - } - - // Get length of sub-curve - // Push sums into cached array - - var lengths = [], sums = 0; - - for ( var i = 0, l = this.curves.length; i < l; i ++ ) { - - sums += this.curves[ i ].getLength(); - lengths.push( sums ); - - } - - this.cacheLengths = lengths; - - return lengths; - - }, - - getSpacedPoints: function ( divisions ) { - - if ( ! divisions ) divisions = 40; - - var points = []; - - for ( var i = 0; i <= divisions; i ++ ) { - - points.push( this.getPoint( i / divisions ) ); - - } - - if ( this.autoClose ) { - - points.push( points[ 0 ] ); - - } - - return points; - - }, - - getPoints: function ( divisions ) { - - divisions = divisions || 12; - - var points = [], last; - - for ( var i = 0, curves = this.curves; i < curves.length; i ++ ) { - - var curve = curves[ i ]; - var resolution = (curve && curve.isEllipseCurve) ? divisions * 2 - : (curve && curve.isLineCurve) ? 1 - : (curve && curve.isSplineCurve) ? divisions * curve.points.length - : divisions; - - var pts = curve.getPoints( resolution ); - - for ( var j = 0; j < pts.length; j++ ) { - - var point = pts[ j ]; - - if ( last && last.equals( point ) ) continue; // ensures no consecutive points are duplicates - - points.push( point ); - last = point; - - } - - } - - if ( this.autoClose && points.length > 1 && !points[ points.length - 1 ].equals( points[ 0 ] ) ) { - - points.push( points[ 0 ] ); - - } - - return points; - - }, - - /************************************************************** - * Create Geometries Helpers - **************************************************************/ - - /// Generate geometry from path points (for Line or Points objects) - - createPointsGeometry: function ( divisions ) { - - var pts = this.getPoints( divisions ); - return this.createGeometry( pts ); - - }, - - // Generate geometry from equidistant sampling along the path - - createSpacedPointsGeometry: function ( divisions ) { - - var pts = this.getSpacedPoints( divisions ); - return this.createGeometry( pts ); - - }, - - createGeometry: function ( points ) { - - var geometry = new Geometry(); - - for ( var i = 0, l = points.length; i < l; i ++ ) { - - var point = points[ i ]; - geometry.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) ); - - } - - return geometry; - - } - - } ); - - /************************************************************** - * Ellipse curve - **************************************************************/ - - function EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - - this.aX = aX; - this.aY = aY; - - this.xRadius = xRadius; - this.yRadius = yRadius; - - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - - this.aClockwise = aClockwise; - - this.aRotation = aRotation || 0; - - } - - EllipseCurve.prototype = Object.create( Curve.prototype ); - EllipseCurve.prototype.constructor = EllipseCurve; - - EllipseCurve.prototype.isEllipseCurve = true; - - EllipseCurve.prototype.getPoint = function( t ) { - - var twoPi = Math.PI * 2; - var deltaAngle = this.aEndAngle - this.aStartAngle; - var samePoints = Math.abs( deltaAngle ) < Number.EPSILON; - - // ensures that deltaAngle is 0 .. 2 PI - while ( deltaAngle < 0 ) deltaAngle += twoPi; - while ( deltaAngle > twoPi ) deltaAngle -= twoPi; - - if ( deltaAngle < Number.EPSILON ) { - - if ( samePoints ) { - - deltaAngle = 0; - - } else { - - deltaAngle = twoPi; - - } - - } - - if ( this.aClockwise === true && ! samePoints ) { - - if ( deltaAngle === twoPi ) { - - deltaAngle = - twoPi; - - } else { - - deltaAngle = deltaAngle - twoPi; - - } - - } - - var angle = this.aStartAngle + t * deltaAngle; - var x = this.aX + this.xRadius * Math.cos( angle ); - var y = this.aY + this.yRadius * Math.sin( angle ); - - if ( this.aRotation !== 0 ) { - - var cos = Math.cos( this.aRotation ); - var sin = Math.sin( this.aRotation ); - - var tx = x - this.aX; - var ty = y - this.aY; - - // Rotate the point about the center of the ellipse. - x = tx * cos - ty * sin + this.aX; - y = tx * sin + ty * cos + this.aY; - - } - - return new Vector2( x, y ); - - }; - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - */ - - exports.CurveUtils = { - - tangentQuadraticBezier: function ( t, p0, p1, p2 ) { - - return 2 * ( 1 - t ) * ( p1 - p0 ) + 2 * t * ( p2 - p1 ); - - }, - - // Puay Bing, thanks for helping with this derivative! - - tangentCubicBezier: function ( t, p0, p1, p2, p3 ) { - - return - 3 * p0 * ( 1 - t ) * ( 1 - t ) + - 3 * p1 * ( 1 - t ) * ( 1 - t ) - 6 * t * p1 * ( 1 - t ) + - 6 * t * p2 * ( 1 - t ) - 3 * t * t * p2 + - 3 * t * t * p3; - - }, - - tangentSpline: function ( t, p0, p1, p2, p3 ) { - - // To check if my formulas are correct - - var h00 = 6 * t * t - 6 * t; // derived from 2t^3 − 3t^2 + 1 - var h10 = 3 * t * t - 4 * t + 1; // t^3 − 2t^2 + t - var h01 = - 6 * t * t + 6 * t; // − 2t3 + 3t2 - var h11 = 3 * t * t - 2 * t; // t3 − t2 - - return h00 + h10 + h01 + h11; - - }, - - // Catmull-Rom - - interpolate: function( p0, p1, p2, p3, t ) { - - var v0 = ( p2 - p0 ) * 0.5; - var v1 = ( p3 - p1 ) * 0.5; - var t2 = t * t; - var t3 = t * t2; - return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - } - - }; - - /************************************************************** - * Spline curve - **************************************************************/ - - function SplineCurve( points /* array of Vector2 */ ) { - - this.points = ( points === undefined ) ? [] : points; - - } - - SplineCurve.prototype = Object.create( Curve.prototype ); - SplineCurve.prototype.constructor = SplineCurve; - - SplineCurve.prototype.isSplineCurve = true; - - SplineCurve.prototype.getPoint = function ( t ) { - - var points = this.points; - var point = ( points.length - 1 ) * t; - - var intPoint = Math.floor( point ); - var weight = point - intPoint; - - var point0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ]; - var point1 = points[ intPoint ]; - var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ]; - var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ]; - - var interpolate = exports.CurveUtils.interpolate; - - return new Vector2( - interpolate( point0.x, point1.x, point2.x, point3.x, weight ), - interpolate( point0.y, point1.y, point2.y, point3.y, weight ) - ); - - }; - - /************************************************************** - * Cubic Bezier curve - **************************************************************/ - - function CubicBezierCurve( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - } - - CubicBezierCurve.prototype = Object.create( Curve.prototype ); - CubicBezierCurve.prototype.constructor = CubicBezierCurve; - - CubicBezierCurve.prototype.getPoint = function ( t ) { - - var b3 = exports.ShapeUtils.b3; - - return new Vector2( - b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ), - b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ) - ); - - }; - - CubicBezierCurve.prototype.getTangent = function( t ) { - - var tangentCubicBezier = exports.CurveUtils.tangentCubicBezier; - - return new Vector2( - tangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ), - tangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ) - ).normalize(); - - }; - - /************************************************************** - * Quadratic Bezier curve - **************************************************************/ - - - function QuadraticBezierCurve( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - - } - - QuadraticBezierCurve.prototype = Object.create( Curve.prototype ); - QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve; - - - QuadraticBezierCurve.prototype.getPoint = function ( t ) { - - var b2 = exports.ShapeUtils.b2; - - return new Vector2( - b2( t, this.v0.x, this.v1.x, this.v2.x ), - b2( t, this.v0.y, this.v1.y, this.v2.y ) - ); - - }; - - - QuadraticBezierCurve.prototype.getTangent = function( t ) { - - var tangentQuadraticBezier = exports.CurveUtils.tangentQuadraticBezier; - - return new Vector2( - tangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ), - tangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y ) - ).normalize(); - - }; - - var PathPrototype = Object.assign( Object.create( CurvePath.prototype ), { - - fromPoints: function ( vectors ) { - - this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y ); - - for ( var i = 1, l = vectors.length; i < l; i ++ ) { - - this.lineTo( vectors[ i ].x, vectors[ i ].y ); - - } - - }, - - moveTo: function ( x, y ) { - - this.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying? - - }, - - lineTo: function ( x, y ) { - - var curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) ); - this.curves.push( curve ); - - this.currentPoint.set( x, y ); - - }, - - quadraticCurveTo: function ( aCPx, aCPy, aX, aY ) { - - var curve = new QuadraticBezierCurve( - this.currentPoint.clone(), - new Vector2( aCPx, aCPy ), - new Vector2( aX, aY ) - ); - - this.curves.push( curve ); - - this.currentPoint.set( aX, aY ); - - }, - - bezierCurveTo: function ( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) { - - var curve = new CubicBezierCurve( - this.currentPoint.clone(), - new Vector2( aCP1x, aCP1y ), - new Vector2( aCP2x, aCP2y ), - new Vector2( aX, aY ) - ); - - this.curves.push( curve ); - - this.currentPoint.set( aX, aY ); - - }, - - splineThru: function ( pts /*Array of Vector*/ ) { - - var npts = [ this.currentPoint.clone() ].concat( pts ); - - var curve = new SplineCurve( npts ); - this.curves.push( curve ); - - this.currentPoint.copy( pts[ pts.length - 1 ] ); - - }, - - arc: function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - var x0 = this.currentPoint.x; - var y0 = this.currentPoint.y; - - this.absarc( aX + x0, aY + y0, aRadius, - aStartAngle, aEndAngle, aClockwise ); - - }, - - absarc: function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - this.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); - - }, - - ellipse: function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - - var x0 = this.currentPoint.x; - var y0 = this.currentPoint.y; - - this.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ); - - }, - - absellipse: function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - - var curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ); - - if ( this.curves.length > 0 ) { - - // if a previous curve is present, attempt to join - var firstPoint = curve.getPoint( 0 ); - - if ( ! firstPoint.equals( this.currentPoint ) ) { - - this.lineTo( firstPoint.x, firstPoint.y ); - - } - - } - - this.curves.push( curve ); - - var lastPoint = curve.getPoint( 1 ); - this.currentPoint.copy( lastPoint ); - - } - - } ); - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Defines a 2d shape plane using paths. - **/ - - // STEP 1 Create a path. - // STEP 2 Turn path into shape. - // STEP 3 ExtrudeGeometry takes in Shape/Shapes - // STEP 3a - Extract points from each shape, turn to vertices - // STEP 3b - Triangulate each shape, add faces. - - function Shape() { - - Path.apply( this, arguments ); - - this.holes = []; - - } - - Shape.prototype = Object.assign( Object.create( PathPrototype ), { - - constructor: Shape, - - getPointsHoles: function ( divisions ) { - - var holesPts = []; - - for ( var i = 0, l = this.holes.length; i < l; i ++ ) { - - holesPts[ i ] = this.holes[ i ].getPoints( divisions ); - - } - - return holesPts; - - }, - - // Get points of shape and holes (keypoints based on segments parameter) - - extractAllPoints: function ( divisions ) { - - return { - - shape: this.getPoints( divisions ), - holes: this.getPointsHoles( divisions ) - - }; - - }, - - extractPoints: function ( divisions ) { - - return this.extractAllPoints( divisions ); - - } - - } ); - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - * Creates free form 2d path using series of points, lines or curves. - * - **/ - - function Path( points ) { - - CurvePath.call( this ); - this.currentPoint = new Vector2(); - - if ( points ) { - - this.fromPoints( points ); - - } - - } - - Path.prototype = PathPrototype; - PathPrototype.constructor = Path; - - - // minimal class for proxing functions to Path. Replaces old "extractSubpaths()" - function ShapePath() { - this.subPaths = []; - this.currentPath = null; - } - - ShapePath.prototype = { - moveTo: function ( x, y ) { - this.currentPath = new Path(); - this.subPaths.push(this.currentPath); - this.currentPath.moveTo( x, y ); - }, - lineTo: function ( x, y ) { - this.currentPath.lineTo( x, y ); - }, - quadraticCurveTo: function ( aCPx, aCPy, aX, aY ) { - this.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY ); - }, - bezierCurveTo: function ( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) { - this.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ); - }, - splineThru: function ( pts ) { - this.currentPath.splineThru( pts ); - }, - - toShapes: function ( isCCW, noHoles ) { - - function toShapesNoHoles( inSubpaths ) { - - var shapes = []; - - for ( var i = 0, l = inSubpaths.length; i < l; i ++ ) { - - var tmpPath = inSubpaths[ i ]; - - var tmpShape = new Shape(); - tmpShape.curves = tmpPath.curves; - - shapes.push( tmpShape ); - - } - - return shapes; - - } - - function isPointInsidePolygon( inPt, inPolygon ) { - - var polyLen = inPolygon.length; - - // inPt on polygon contour => immediate success or - // toggling of inside/outside at every single! intersection point of an edge - // with the horizontal line through inPt, left of inPt - // not counting lowerY endpoints of edges and whole edges on that line - var inside = false; - for ( var p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) { - - var edgeLowPt = inPolygon[ p ]; - var edgeHighPt = inPolygon[ q ]; - - var edgeDx = edgeHighPt.x - edgeLowPt.x; - var edgeDy = edgeHighPt.y - edgeLowPt.y; - - if ( Math.abs( edgeDy ) > Number.EPSILON ) { - - // not parallel - if ( edgeDy < 0 ) { - - edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx; - edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy; - - } - if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue; - - if ( inPt.y === edgeLowPt.y ) { - - if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ? - // continue; // no intersection or edgeLowPt => doesn't count !!! - - } else { - - var perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y ); - if ( perpEdge === 0 ) return true; // inPt is on contour ? - if ( perpEdge < 0 ) continue; - inside = ! inside; // true intersection left of inPt - - } - - } else { - - // parallel or collinear - if ( inPt.y !== edgeLowPt.y ) continue; // parallel - // edge lies on the same horizontal line as inPt - if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) || - ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour ! - // continue; - - } - - } - - return inside; - - } - - var isClockWise = exports.ShapeUtils.isClockWise; - - var subPaths = this.subPaths; - if ( subPaths.length === 0 ) return []; - - if ( noHoles === true ) return toShapesNoHoles( subPaths ); - - - var solid, tmpPath, tmpShape, shapes = []; - - if ( subPaths.length === 1 ) { - - tmpPath = subPaths[ 0 ]; - tmpShape = new Shape(); - tmpShape.curves = tmpPath.curves; - shapes.push( tmpShape ); - return shapes; - - } - - var holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() ); - holesFirst = isCCW ? ! holesFirst : holesFirst; - - // console.log("Holes first", holesFirst); - - var betterShapeHoles = []; - var newShapes = []; - var newShapeHoles = []; - var mainIdx = 0; - var tmpPoints; - - newShapes[ mainIdx ] = undefined; - newShapeHoles[ mainIdx ] = []; - - for ( var i = 0, l = subPaths.length; i < l; i ++ ) { - - tmpPath = subPaths[ i ]; - tmpPoints = tmpPath.getPoints(); - solid = isClockWise( tmpPoints ); - solid = isCCW ? ! solid : solid; - - if ( solid ) { - - if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) mainIdx ++; - - newShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints }; - newShapes[ mainIdx ].s.curves = tmpPath.curves; - - if ( holesFirst ) mainIdx ++; - newShapeHoles[ mainIdx ] = []; - - //console.log('cw', i); - - } else { - - newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } ); - - //console.log('ccw', i); - - } - - } - - // only Holes? -> probably all Shapes with wrong orientation - if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths ); - - - if ( newShapes.length > 1 ) { - - var ambiguous = false; - var toChange = []; - - for ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) { - - betterShapeHoles[ sIdx ] = []; - - } - - for ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) { - - var sho = newShapeHoles[ sIdx ]; - - for ( var hIdx = 0; hIdx < sho.length; hIdx ++ ) { - - var ho = sho[ hIdx ]; - var hole_unassigned = true; - - for ( var s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) { - - if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) { - - if ( sIdx !== s2Idx ) toChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } ); - if ( hole_unassigned ) { - - hole_unassigned = false; - betterShapeHoles[ s2Idx ].push( ho ); - - } else { - - ambiguous = true; - - } - - } - - } - if ( hole_unassigned ) { - - betterShapeHoles[ sIdx ].push( ho ); - - } - - } - - } - // console.log("ambiguous: ", ambiguous); - if ( toChange.length > 0 ) { - - // console.log("to change: ", toChange); - if ( ! ambiguous ) newShapeHoles = betterShapeHoles; - - } - - } - - var tmpHoles; - - for ( var i = 0, il = newShapes.length; i < il; i ++ ) { - - tmpShape = newShapes[ i ].s; - shapes.push( tmpShape ); - tmpHoles = newShapeHoles[ i ]; - - for ( var j = 0, jl = tmpHoles.length; j < jl; j ++ ) { - - tmpShape.holes.push( tmpHoles[ j ].h ); - - } - - } - - //console.log("shape", shapes); - - return shapes; - - } - } - - /** - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author mrdoob / http://mrdoob.com/ - */ - - function Font( data ) { - - this.data = data; - - } - - Object.assign( Font.prototype, { - - isFont: true, - - generateShapes: function ( text, size, divisions ) { - - function createPaths( text ) { - - var chars = String( text ).split( '' ); - var scale = size / data.resolution; - var offset = 0; - - var paths = []; - - for ( var i = 0; i < chars.length; i ++ ) { - - var ret = createPath( chars[ i ], scale, offset ); - offset += ret.offset; - - paths.push( ret.path ); - - } - - return paths; - - } - - function createPath( c, scale, offset ) { - - var glyph = data.glyphs[ c ] || data.glyphs[ '?' ]; - - if ( ! glyph ) return; - - var path = new ShapePath(); - - var pts = [], b2 = exports.ShapeUtils.b2, b3 = exports.ShapeUtils.b3; - var x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2, laste; - - if ( glyph.o ) { - - var outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) ); - - for ( var i = 0, l = outline.length; i < l; ) { - - var action = outline[ i ++ ]; - - switch ( action ) { - - case 'm': // moveTo - - x = outline[ i ++ ] * scale + offset; - y = outline[ i ++ ] * scale; - - path.moveTo( x, y ); - - break; - - case 'l': // lineTo - - x = outline[ i ++ ] * scale + offset; - y = outline[ i ++ ] * scale; - - path.lineTo( x, y ); - - break; - - case 'q': // quadraticCurveTo - - cpx = outline[ i ++ ] * scale + offset; - cpy = outline[ i ++ ] * scale; - cpx1 = outline[ i ++ ] * scale + offset; - cpy1 = outline[ i ++ ] * scale; - - path.quadraticCurveTo( cpx1, cpy1, cpx, cpy ); - - laste = pts[ pts.length - 1 ]; - - if ( laste ) { - - cpx0 = laste.x; - cpy0 = laste.y; - - for ( var i2 = 1; i2 <= divisions; i2 ++ ) { - - var t = i2 / divisions; - b2( t, cpx0, cpx1, cpx ); - b2( t, cpy0, cpy1, cpy ); - - } - - } - - break; - - case 'b': // bezierCurveTo - - cpx = outline[ i ++ ] * scale + offset; - cpy = outline[ i ++ ] * scale; - cpx1 = outline[ i ++ ] * scale + offset; - cpy1 = outline[ i ++ ] * scale; - cpx2 = outline[ i ++ ] * scale + offset; - cpy2 = outline[ i ++ ] * scale; - - path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy ); - - laste = pts[ pts.length - 1 ]; - - if ( laste ) { - - cpx0 = laste.x; - cpy0 = laste.y; - - for ( var i2 = 1; i2 <= divisions; i2 ++ ) { - - var t = i2 / divisions; - b3( t, cpx0, cpx1, cpx2, cpx ); - b3( t, cpy0, cpy1, cpy2, cpy ); - - } - - } - - break; - - } - - } - - } - - return { offset: glyph.ha * scale, path: path }; - - } - - // - - if ( size === undefined ) size = 100; - if ( divisions === undefined ) divisions = 4; - - var data = this.data; - - var paths = createPaths( text ); - var shapes = []; - - for ( var p = 0, pl = paths.length; p < pl; p ++ ) { - - Array.prototype.push.apply( shapes, paths[ p ].toShapes() ); - - } - - return shapes; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function FontLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - } - - Object.assign( FontLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new XHRLoader( this.manager ); - loader.load( url, function ( text ) { - - var json; - - try { - - json = JSON.parse( text ); - - } catch ( e ) { - - console.warn( 'THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.' ); - json = JSON.parse( text.substring( 65, text.length - 2 ) ); - - } - - var font = scope.parse( json ); - - if ( onLoad ) onLoad( font ); - - }, onProgress, onError ); - - }, - - parse: function ( json ) { - - return new Font( json ); - - } - - } ); - - var context; - - function getAudioContext() { - - if ( context === undefined ) { - - context = new ( window.AudioContext || window.webkitAudioContext )(); - - } - - return context; - - } - - /** - * @author Reece Aaron Lecrivain / http://reecenotes.com/ - */ - - function AudioLoader( manager ) { - - this.manager = ( manager !== undefined ) ? manager : exports.DefaultLoadingManager; - - } - - Object.assign( AudioLoader.prototype, { - - load: function ( url, onLoad, onProgress, onError ) { - - var loader = new XHRLoader( this.manager ); - loader.setResponseType( 'arraybuffer' ); - loader.load( url, function ( buffer ) { - - var context = getAudioContext(); - - context.decodeAudioData( buffer, function ( audioBuffer ) { - - onLoad( audioBuffer ); - - } ); - - }, onProgress, onError ); - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function StereoCamera() { - - this.type = 'StereoCamera'; - - this.aspect = 1; - - this.eyeSep = 0.064; - - this.cameraL = new PerspectiveCamera(); - this.cameraL.layers.enable( 1 ); - this.cameraL.matrixAutoUpdate = false; - - this.cameraR = new PerspectiveCamera(); - this.cameraR.layers.enable( 2 ); - this.cameraR.matrixAutoUpdate = false; - - } - - Object.assign( StereoCamera.prototype, { - - update: ( function () { - - var instance, focus, fov, aspect, near, far, zoom; - - var eyeRight = new Matrix4(); - var eyeLeft = new Matrix4(); - - return function update( camera ) { - - var needsUpdate = instance !== this || focus !== camera.focus || fov !== camera.fov || - aspect !== camera.aspect * this.aspect || near !== camera.near || - far !== camera.far || zoom !== camera.zoom; - - if ( needsUpdate ) { - - instance = this; - focus = camera.focus; - fov = camera.fov; - aspect = camera.aspect * this.aspect; - near = camera.near; - far = camera.far; - zoom = camera.zoom; - - // Off-axis stereoscopic effect based on - // http://paulbourke.net/stereographics/stereorender/ - - var projectionMatrix = camera.projectionMatrix.clone(); - var eyeSep = this.eyeSep / 2; - var eyeSepOnProjection = eyeSep * near / focus; - var ymax = ( near * Math.tan( exports.Math.DEG2RAD * fov * 0.5 ) ) / zoom; - var xmin, xmax; - - // translate xOffset - - eyeLeft.elements[ 12 ] = - eyeSep; - eyeRight.elements[ 12 ] = eyeSep; - - // for left eye - - xmin = - ymax * aspect + eyeSepOnProjection; - xmax = ymax * aspect + eyeSepOnProjection; - - projectionMatrix.elements[ 0 ] = 2 * near / ( xmax - xmin ); - projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin ); - - this.cameraL.projectionMatrix.copy( projectionMatrix ); - - // for right eye - - xmin = - ymax * aspect - eyeSepOnProjection; - xmax = ymax * aspect - eyeSepOnProjection; - - projectionMatrix.elements[ 0 ] = 2 * near / ( xmax - xmin ); - projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin ); - - this.cameraR.projectionMatrix.copy( projectionMatrix ); - - } - - this.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( eyeLeft ); - this.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( eyeRight ); - - }; - - } )() - - } ); - - /** - * Camera for rendering cube maps - * - renders scene into axis-aligned cube - * - * @author alteredq / http://alteredqualia.com/ - */ - - function CubeCamera( near, far, cubeResolution ) { - - Object3D.call( this ); - - this.type = 'CubeCamera'; - - var fov = 90, aspect = 1; - - var cameraPX = new PerspectiveCamera( fov, aspect, near, far ); - cameraPX.up.set( 0, - 1, 0 ); - cameraPX.lookAt( new Vector3( 1, 0, 0 ) ); - this.add( cameraPX ); - - var cameraNX = new PerspectiveCamera( fov, aspect, near, far ); - cameraNX.up.set( 0, - 1, 0 ); - cameraNX.lookAt( new Vector3( - 1, 0, 0 ) ); - this.add( cameraNX ); - - var cameraPY = new PerspectiveCamera( fov, aspect, near, far ); - cameraPY.up.set( 0, 0, 1 ); - cameraPY.lookAt( new Vector3( 0, 1, 0 ) ); - this.add( cameraPY ); - - var cameraNY = new PerspectiveCamera( fov, aspect, near, far ); - cameraNY.up.set( 0, 0, - 1 ); - cameraNY.lookAt( new Vector3( 0, - 1, 0 ) ); - this.add( cameraNY ); - - var cameraPZ = new PerspectiveCamera( fov, aspect, near, far ); - cameraPZ.up.set( 0, - 1, 0 ); - cameraPZ.lookAt( new Vector3( 0, 0, 1 ) ); - this.add( cameraPZ ); - - var cameraNZ = new PerspectiveCamera( fov, aspect, near, far ); - cameraNZ.up.set( 0, - 1, 0 ); - cameraNZ.lookAt( new Vector3( 0, 0, - 1 ) ); - this.add( cameraNZ ); - - var options = { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter }; - - this.renderTarget = new WebGLRenderTargetCube( cubeResolution, cubeResolution, options ); - - this.updateCubeMap = function ( renderer, scene ) { - - if ( this.parent === null ) this.updateMatrixWorld(); - - var renderTarget = this.renderTarget; - var generateMipmaps = renderTarget.texture.generateMipmaps; - - renderTarget.texture.generateMipmaps = false; - - renderTarget.activeCubeFace = 0; - renderer.render( scene, cameraPX, renderTarget ); - - renderTarget.activeCubeFace = 1; - renderer.render( scene, cameraNX, renderTarget ); - - renderTarget.activeCubeFace = 2; - renderer.render( scene, cameraPY, renderTarget ); - - renderTarget.activeCubeFace = 3; - renderer.render( scene, cameraNY, renderTarget ); - - renderTarget.activeCubeFace = 4; - renderer.render( scene, cameraPZ, renderTarget ); - - renderTarget.texture.generateMipmaps = generateMipmaps; - - renderTarget.activeCubeFace = 5; - renderer.render( scene, cameraNZ, renderTarget ); - - renderer.setRenderTarget( null ); - - }; - - } - - CubeCamera.prototype = Object.create( Object3D.prototype ); - CubeCamera.prototype.constructor = CubeCamera; - - function AudioListener() { - - Object3D.call( this ); - - this.type = 'AudioListener'; - - this.context = getAudioContext(); - - this.gain = this.context.createGain(); - this.gain.connect( this.context.destination ); - - this.filter = null; - - } - - AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: AudioListener, - - getInput: function () { - - return this.gain; - - }, - - removeFilter: function ( ) { - - if ( this.filter !== null ) { - - this.gain.disconnect( this.filter ); - this.filter.disconnect( this.context.destination ); - this.gain.connect( this.context.destination ); - this.filter = null; - - } - - }, - - getFilter: function () { - - return this.filter; - - }, - - setFilter: function ( value ) { - - if ( this.filter !== null ) { - - this.gain.disconnect( this.filter ); - this.filter.disconnect( this.context.destination ); - - } else { - - this.gain.disconnect( this.context.destination ); - - } - - this.filter = value; - this.gain.connect( this.filter ); - this.filter.connect( this.context.destination ); - - }, - - getMasterVolume: function () { - - return this.gain.gain.value; - - }, - - setMasterVolume: function ( value ) { - - this.gain.gain.value = value; - - }, - - updateMatrixWorld: ( function () { - - var position = new Vector3(); - var quaternion = new Quaternion(); - var scale = new Vector3(); - - var orientation = new Vector3(); - - return function updateMatrixWorld( force ) { - - Object3D.prototype.updateMatrixWorld.call( this, force ); - - var listener = this.context.listener; - var up = this.up; - - this.matrixWorld.decompose( position, quaternion, scale ); - - orientation.set( 0, 0, - 1 ).applyQuaternion( quaternion ); - - listener.setPosition( position.x, position.y, position.z ); - listener.setOrientation( orientation.x, orientation.y, orientation.z, up.x, up.y, up.z ); - - }; - - } )() - - } ); - - function Audio( listener ) { - - Object3D.call( this ); - - this.type = 'Audio'; - - this.context = listener.context; - this.source = this.context.createBufferSource(); - this.source.onended = this.onEnded.bind( this ); - - this.gain = this.context.createGain(); - this.gain.connect( listener.getInput() ); - - this.autoplay = false; - - this.startTime = 0; - this.playbackRate = 1; - this.isPlaying = false; - this.hasPlaybackControl = true; - this.sourceType = 'empty'; - - this.filters = []; - - } - - Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Audio, - - getOutput: function () { - - return this.gain; - - }, - - setNodeSource: function ( audioNode ) { - - this.hasPlaybackControl = false; - this.sourceType = 'audioNode'; - this.source = audioNode; - this.connect(); - - return this; - - }, - - setBuffer: function ( audioBuffer ) { - - this.source.buffer = audioBuffer; - this.sourceType = 'buffer'; - - if ( this.autoplay ) this.play(); - - return this; - - }, - - play: function () { - - if ( this.isPlaying === true ) { - - console.warn( 'THREE.Audio: Audio is already playing.' ); - return; - - } - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - var source = this.context.createBufferSource(); - - source.buffer = this.source.buffer; - source.loop = this.source.loop; - source.onended = this.source.onended; - source.start( 0, this.startTime ); - source.playbackRate.value = this.playbackRate; - - this.isPlaying = true; - - this.source = source; - - return this.connect(); - - }, - - pause: function () { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.source.stop(); - this.startTime = this.context.currentTime; - this.isPlaying = false; - - return this; - - }, - - stop: function () { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.source.stop(); - this.startTime = 0; - this.isPlaying = false; - - return this; - - }, - - connect: function () { - - if ( this.filters.length > 0 ) { - - this.source.connect( this.filters[ 0 ] ); - - for ( var i = 1, l = this.filters.length; i < l; i ++ ) { - - this.filters[ i - 1 ].connect( this.filters[ i ] ); - - } - - this.filters[ this.filters.length - 1 ].connect( this.getOutput() ); - - } else { - - this.source.connect( this.getOutput() ); - - } - - return this; - - }, - - disconnect: function () { - - if ( this.filters.length > 0 ) { - - this.source.disconnect( this.filters[ 0 ] ); - - for ( var i = 1, l = this.filters.length; i < l; i ++ ) { - - this.filters[ i - 1 ].disconnect( this.filters[ i ] ); - - } - - this.filters[ this.filters.length - 1 ].disconnect( this.getOutput() ); - - } else { - - this.source.disconnect( this.getOutput() ); - - } - - return this; - - }, - - getFilters: function () { - - return this.filters; - - }, - - setFilters: function ( value ) { - - if ( ! value ) value = []; - - if ( this.isPlaying === true ) { - - this.disconnect(); - this.filters = value; - this.connect(); - - } else { - - this.filters = value; - - } - - return this; - - }, - - getFilter: function () { - - return this.getFilters()[ 0 ]; - - }, - - setFilter: function ( filter ) { - - return this.setFilters( filter ? [ filter ] : [] ); - - }, - - setPlaybackRate: function ( value ) { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.playbackRate = value; - - if ( this.isPlaying === true ) { - - this.source.playbackRate.value = this.playbackRate; - - } - - return this; - - }, - - getPlaybackRate: function () { - - return this.playbackRate; - - }, - - onEnded: function () { - - this.isPlaying = false; - - }, - - getLoop: function () { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return false; - - } - - return this.source.loop; - - }, - - setLoop: function ( value ) { - - if ( this.hasPlaybackControl === false ) { - - console.warn( 'THREE.Audio: this Audio has no playback control.' ); - return; - - } - - this.source.loop = value; - - }, - - getVolume: function () { - - return this.gain.gain.value; - - }, - - - setVolume: function ( value ) { - - this.gain.gain.value = value; - - return this; - - } - - } ); - - function PositionalAudio( listener ) { - - Audio.call( this, listener ); - - this.panner = this.context.createPanner(); - this.panner.connect( this.gain ); - - } - - PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), { - - constructor: PositionalAudio, - - getOutput: function () { - - return this.panner; - - }, - - getRefDistance: function () { - - return this.panner.refDistance; - - }, - - setRefDistance: function ( value ) { - - this.panner.refDistance = value; - - }, - - getRolloffFactor: function () { - - return this.panner.rolloffFactor; - - }, - - setRolloffFactor: function ( value ) { - - this.panner.rolloffFactor = value; - - }, - - getDistanceModel: function () { - - return this.panner.distanceModel; - - }, - - setDistanceModel: function ( value ) { - - this.panner.distanceModel = value; - - }, - - getMaxDistance: function () { - - return this.panner.maxDistance; - - }, - - setMaxDistance: function ( value ) { - - this.panner.maxDistance = value; - - }, - - updateMatrixWorld: ( function () { - - var position = new Vector3(); - - return function updateMatrixWorld( force ) { - - Object3D.prototype.updateMatrixWorld.call( this, force ); - - position.setFromMatrixPosition( this.matrixWorld ); - - this.panner.setPosition( position.x, position.y, position.z ); - - }; - - } )() - - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function AudioAnalyser( audio, fftSize ) { - - this.analyser = audio.context.createAnalyser(); - this.analyser.fftSize = fftSize !== undefined ? fftSize : 2048; - - this.data = new Uint8Array( this.analyser.frequencyBinCount ); - - audio.getOutput().connect( this.analyser ); - - } - - Object.assign( AudioAnalyser.prototype, { - - getFrequencyData: function () { - - this.analyser.getByteFrequencyData( this.data ); - - return this.data; - - }, - - getAverageFrequency: function () { - - var value = 0, data = this.getFrequencyData(); - - for ( var i = 0; i < data.length; i ++ ) { - - value += data[ i ]; - - } - - return value / data.length; - - } - - } ); - - /** - * - * Buffered scene graph property that allows weighted accumulation. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function PropertyMixer( binding, typeName, valueSize ) { - - this.binding = binding; - this.valueSize = valueSize; - - var bufferType = Float64Array, - mixFunction; - - switch ( typeName ) { - - case 'quaternion': mixFunction = this._slerp; break; - - case 'string': - case 'bool': - - bufferType = Array, mixFunction = this._select; break; - - default: mixFunction = this._lerp; - - } - - this.buffer = new bufferType( valueSize * 4 ); - // layout: [ incoming | accu0 | accu1 | orig ] - // - // interpolators can use .buffer as their .result - // the data then goes to 'incoming' - // - // 'accu0' and 'accu1' are used frame-interleaved for - // the cumulative result and are compared to detect - // changes - // - // 'orig' stores the original state of the property - - this._mixBufferRegion = mixFunction; - - this.cumulativeWeight = 0; - - this.useCount = 0; - this.referenceCount = 0; - - } - - PropertyMixer.prototype = { - - constructor: PropertyMixer, - - // accumulate data in the 'incoming' region into 'accu<i>' - accumulate: function( accuIndex, weight ) { - - // note: happily accumulating nothing when weight = 0, the caller knows - // the weight and shouldn't have made the call in the first place - - var buffer = this.buffer, - stride = this.valueSize, - offset = accuIndex * stride + stride, - - currentWeight = this.cumulativeWeight; - - if ( currentWeight === 0 ) { - - // accuN := incoming * weight - - for ( var i = 0; i !== stride; ++ i ) { - - buffer[ offset + i ] = buffer[ i ]; - - } - - currentWeight = weight; - - } else { - - // accuN := accuN + incoming * weight - - currentWeight += weight; - var mix = weight / currentWeight; - this._mixBufferRegion( buffer, offset, 0, mix, stride ); - - } - - this.cumulativeWeight = currentWeight; - - }, - - // apply the state of 'accu<i>' to the binding when accus differ - apply: function( accuIndex ) { - - var stride = this.valueSize, - buffer = this.buffer, - offset = accuIndex * stride + stride, - - weight = this.cumulativeWeight, - - binding = this.binding; - - this.cumulativeWeight = 0; - - if ( weight < 1 ) { - - // accuN := accuN + original * ( 1 - cumulativeWeight ) - - var originalValueOffset = stride * 3; - - this._mixBufferRegion( - buffer, offset, originalValueOffset, 1 - weight, stride ); - - } - - for ( var i = stride, e = stride + stride; i !== e; ++ i ) { - - if ( buffer[ i ] !== buffer[ i + stride ] ) { - - // value has changed -> update scene graph - - binding.setValue( buffer, offset ); - break; - - } - - } - - }, - - // remember the state of the bound property and copy it to both accus - saveOriginalState: function() { - - var binding = this.binding; - - var buffer = this.buffer, - stride = this.valueSize, - - originalValueOffset = stride * 3; - - binding.getValue( buffer, originalValueOffset ); - - // accu[0..1] := orig -- initially detect changes against the original - for ( var i = stride, e = originalValueOffset; i !== e; ++ i ) { - - buffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ]; - - } - - this.cumulativeWeight = 0; - - }, - - // apply the state previously taken via 'saveOriginalState' to the binding - restoreOriginalState: function() { - - var originalValueOffset = this.valueSize * 3; - this.binding.setValue( this.buffer, originalValueOffset ); - - }, - - - // mix functions - - _select: function( buffer, dstOffset, srcOffset, t, stride ) { - - if ( t >= 0.5 ) { - - for ( var i = 0; i !== stride; ++ i ) { - - buffer[ dstOffset + i ] = buffer[ srcOffset + i ]; - - } - - } - - }, - - _slerp: function( buffer, dstOffset, srcOffset, t, stride ) { - - Quaternion.slerpFlat( buffer, dstOffset, - buffer, dstOffset, buffer, srcOffset, t ); - - }, - - _lerp: function( buffer, dstOffset, srcOffset, t, stride ) { - - var s = 1 - t; - - for ( var i = 0; i !== stride; ++ i ) { - - var j = dstOffset + i; - - buffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t; - - } - - } - - }; - - /** - * - * A reference to a real property in the scene graph. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function PropertyBinding( rootNode, path, parsedPath ) { - - this.path = path; - this.parsedPath = parsedPath || - PropertyBinding.parseTrackName( path ); - - this.node = PropertyBinding.findNode( - rootNode, this.parsedPath.nodeName ) || rootNode; - - this.rootNode = rootNode; - - } - - PropertyBinding.prototype = { - - constructor: PropertyBinding, - - getValue: function getValue_unbound( targetArray, offset ) { - - this.bind(); - this.getValue( targetArray, offset ); - - // Note: This class uses a State pattern on a per-method basis: - // 'bind' sets 'this.getValue' / 'setValue' and shadows the - // prototype version of these methods with one that represents - // the bound state. When the property is not found, the methods - // become no-ops. - - }, - - setValue: function getValue_unbound( sourceArray, offset ) { - - this.bind(); - this.setValue( sourceArray, offset ); - - }, - - // create getter / setter pair for a property in the scene graph - bind: function() { - - var targetObject = this.node, - parsedPath = this.parsedPath, - - objectName = parsedPath.objectName, - propertyName = parsedPath.propertyName, - propertyIndex = parsedPath.propertyIndex; - - if ( ! targetObject ) { - - targetObject = PropertyBinding.findNode( - this.rootNode, parsedPath.nodeName ) || this.rootNode; - - this.node = targetObject; - - } - - // set fail state so we can just 'return' on error - this.getValue = this._getValue_unavailable; - this.setValue = this._setValue_unavailable; - - // ensure there is a value node - if ( ! targetObject ) { - - console.error( " trying to update node for track: " + this.path + " but it wasn't found." ); - return; - - } - - if ( objectName ) { - - var objectIndex = parsedPath.objectIndex; - - // special cases were we need to reach deeper into the hierarchy to get the face materials.... - switch ( objectName ) { - - case 'materials': - - if ( ! targetObject.material ) { - - console.error( ' can not bind to material as node does not have a material', this ); - return; - - } - - if ( ! targetObject.material.materials ) { - - console.error( ' can not bind to material.materials as node.material does not have a materials array', this ); - return; - - } - - targetObject = targetObject.material.materials; - - break; - - case 'bones': - - if ( ! targetObject.skeleton ) { - - console.error( ' can not bind to bones as node does not have a skeleton', this ); - return; - - } - - // potential future optimization: skip this if propertyIndex is already an integer - // and convert the integer string to a true integer. - - targetObject = targetObject.skeleton.bones; - - // support resolving morphTarget names into indices. - for ( var i = 0; i < targetObject.length; i ++ ) { - - if ( targetObject[ i ].name === objectIndex ) { - - objectIndex = i; - break; - - } - - } - - break; - - default: - - if ( targetObject[ objectName ] === undefined ) { - - console.error( ' can not bind to objectName of node, undefined', this ); - return; - - } - - targetObject = targetObject[ objectName ]; - - } - - - if ( objectIndex !== undefined ) { - - if ( targetObject[ objectIndex ] === undefined ) { - - console.error( " trying to bind to objectIndex of objectName, but is undefined:", this, targetObject ); - return; - - } - - targetObject = targetObject[ objectIndex ]; - - } - - } - - // resolve property - var nodeProperty = targetObject[ propertyName ]; - - if ( nodeProperty === undefined ) { - - var nodeName = parsedPath.nodeName; - - console.error( " trying to update property for track: " + nodeName + - '.' + propertyName + " but it wasn't found.", targetObject ); - return; - - } - - // determine versioning scheme - var versioning = this.Versioning.None; - - if ( targetObject.needsUpdate !== undefined ) { // material - - versioning = this.Versioning.NeedsUpdate; - this.targetObject = targetObject; - - } else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform - - versioning = this.Versioning.MatrixWorldNeedsUpdate; - this.targetObject = targetObject; - - } - - // determine how the property gets bound - var bindingType = this.BindingType.Direct; - - if ( propertyIndex !== undefined ) { - // access a sub element of the property array (only primitives are supported right now) - - if ( propertyName === "morphTargetInfluences" ) { - // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer. - - // support resolving morphTarget names into indices. - if ( ! targetObject.geometry ) { - - console.error( ' can not bind to morphTargetInfluences becasuse node does not have a geometry', this ); - return; - - } - - if ( ! targetObject.geometry.morphTargets ) { - - console.error( ' can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets', this ); - return; - - } - - for ( var i = 0; i < this.node.geometry.morphTargets.length; i ++ ) { - - if ( targetObject.geometry.morphTargets[ i ].name === propertyIndex ) { - - propertyIndex = i; - break; - - } - - } - - } - - bindingType = this.BindingType.ArrayElement; - - this.resolvedProperty = nodeProperty; - this.propertyIndex = propertyIndex; - - } else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) { - // must use copy for Object3D.Euler/Quaternion - - bindingType = this.BindingType.HasFromToArray; - - this.resolvedProperty = nodeProperty; - - } else if ( nodeProperty.length !== undefined ) { - - bindingType = this.BindingType.EntireArray; - - this.resolvedProperty = nodeProperty; - - } else { - - this.propertyName = propertyName; - - } - - // select getter / setter - this.getValue = this.GetterByBindingType[ bindingType ]; - this.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ]; - - }, - - unbind: function() { - - this.node = null; - - // back to the prototype version of getValue / setValue - // note: avoiding to mutate the shape of 'this' via 'delete' - this.getValue = this._getValue_unbound; - this.setValue = this._setValue_unbound; - - } - - }; - - Object.assign( PropertyBinding.prototype, { // prototype, continued - - // these are used to "bind" a nonexistent property - _getValue_unavailable: function() {}, - _setValue_unavailable: function() {}, - - // initial state of these methods that calls 'bind' - _getValue_unbound: PropertyBinding.prototype.getValue, - _setValue_unbound: PropertyBinding.prototype.setValue, - - BindingType: { - Direct: 0, - EntireArray: 1, - ArrayElement: 2, - HasFromToArray: 3 - }, - - Versioning: { - None: 0, - NeedsUpdate: 1, - MatrixWorldNeedsUpdate: 2 - }, - - GetterByBindingType: [ - - function getValue_direct( buffer, offset ) { - - buffer[ offset ] = this.node[ this.propertyName ]; - - }, - - function getValue_array( buffer, offset ) { - - var source = this.resolvedProperty; - - for ( var i = 0, n = source.length; i !== n; ++ i ) { - - buffer[ offset ++ ] = source[ i ]; - - } - - }, - - function getValue_arrayElement( buffer, offset ) { - - buffer[ offset ] = this.resolvedProperty[ this.propertyIndex ]; - - }, - - function getValue_toArray( buffer, offset ) { - - this.resolvedProperty.toArray( buffer, offset ); - - } - - ], - - SetterByBindingTypeAndVersioning: [ - - [ - // Direct - - function setValue_direct( buffer, offset ) { - - this.node[ this.propertyName ] = buffer[ offset ]; - - }, - - function setValue_direct_setNeedsUpdate( buffer, offset ) { - - this.node[ this.propertyName ] = buffer[ offset ]; - this.targetObject.needsUpdate = true; - - }, - - function setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.node[ this.propertyName ] = buffer[ offset ]; - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // EntireArray - - function setValue_array( buffer, offset ) { - - var dest = this.resolvedProperty; - - for ( var i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - }, - - function setValue_array_setNeedsUpdate( buffer, offset ) { - - var dest = this.resolvedProperty; - - for ( var i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - this.targetObject.needsUpdate = true; - - }, - - function setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) { - - var dest = this.resolvedProperty; - - for ( var i = 0, n = dest.length; i !== n; ++ i ) { - - dest[ i ] = buffer[ offset ++ ]; - - } - - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // ArrayElement - - function setValue_arrayElement( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - - }, - - function setValue_arrayElement_setNeedsUpdate( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - this.targetObject.needsUpdate = true; - - }, - - function setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ]; - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ], [ - - // HasToFromArray - - function setValue_fromArray( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - - }, - - function setValue_fromArray_setNeedsUpdate( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - this.targetObject.needsUpdate = true; - - }, - - function setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) { - - this.resolvedProperty.fromArray( buffer, offset ); - this.targetObject.matrixWorldNeedsUpdate = true; - - } - - ] - - ] - - } ); - - PropertyBinding.Composite = - function( targetGroup, path, optionalParsedPath ) { - - var parsedPath = optionalParsedPath || - PropertyBinding.parseTrackName( path ); - - this._targetGroup = targetGroup; - this._bindings = targetGroup.subscribe_( path, parsedPath ); - - }; - - PropertyBinding.Composite.prototype = { - - constructor: PropertyBinding.Composite, - - getValue: function( array, offset ) { - - this.bind(); // bind all binding - - var firstValidIndex = this._targetGroup.nCachedObjects_, - binding = this._bindings[ firstValidIndex ]; - - // and only call .getValue on the first - if ( binding !== undefined ) binding.getValue( array, offset ); - - }, - - setValue: function( array, offset ) { - - var bindings = this._bindings; - - for ( var i = this._targetGroup.nCachedObjects_, - n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].setValue( array, offset ); - - } - - }, - - bind: function() { - - var bindings = this._bindings; - - for ( var i = this._targetGroup.nCachedObjects_, - n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].bind(); - - } - - }, - - unbind: function() { - - var bindings = this._bindings; - - for ( var i = this._targetGroup.nCachedObjects_, - n = bindings.length; i !== n; ++ i ) { - - bindings[ i ].unbind(); - - } - - } - - }; - - PropertyBinding.create = function( root, path, parsedPath ) { - - if ( ! ( (root && root.isAnimationObjectGroup) ) ) { - - return new PropertyBinding( root, path, parsedPath ); - - } else { - - return new PropertyBinding.Composite( root, path, parsedPath ); - - } - - }; - - PropertyBinding.parseTrackName = function( trackName ) { - - // matches strings in the form of: - // nodeName.property - // nodeName.property[accessor] - // nodeName.material.property[accessor] - // uuid.property[accessor] - // uuid.objectName[objectIndex].propertyName[propertyIndex] - // parentName/nodeName.property - // parentName/parentName/nodeName.property[index] - // .bone[Armature.DEF_cog].position - // scene:helium_balloon_model:helium_balloon_model.position - // created and tested via https://regex101.com/#javascript - - var re = /^((?:\w+[\/:])*)(\w+)?(?:\.(\w+)(?:\[(.+)\])?)?\.(\w+)(?:\[(.+)\])?$/; - var matches = re.exec( trackName ); - - if ( ! matches ) { - - throw new Error( "cannot parse trackName at all: " + trackName ); - - } - - var results = { - // directoryName: matches[ 1 ], // (tschw) currently unused - nodeName: matches[ 2 ], // allowed to be null, specified root node. - objectName: matches[ 3 ], - objectIndex: matches[ 4 ], - propertyName: matches[ 5 ], - propertyIndex: matches[ 6 ] // allowed to be null, specifies that the whole property is set. - }; - - if ( results.propertyName === null || results.propertyName.length === 0 ) { - - throw new Error( "can not parse propertyName from trackName: " + trackName ); - - } - - return results; - - }; - - PropertyBinding.findNode = function( root, nodeName ) { - - if ( ! nodeName || nodeName === "" || nodeName === "root" || nodeName === "." || nodeName === -1 || nodeName === root.name || nodeName === root.uuid ) { - - return root; - - } - - // search into skeleton bones. - if ( root.skeleton ) { - - var searchSkeleton = function( skeleton ) { - - for( var i = 0; i < skeleton.bones.length; i ++ ) { - - var bone = skeleton.bones[ i ]; - - if ( bone.name === nodeName ) { - - return bone; - - } - } - - return null; - - }; - - var bone = searchSkeleton( root.skeleton ); - - if ( bone ) { - - return bone; - - } - } - - // search into node subtree. - if ( root.children ) { - - var searchNodeSubtree = function( children ) { - - for( var i = 0; i < children.length; i ++ ) { - - var childNode = children[ i ]; - - if ( childNode.name === nodeName || childNode.uuid === nodeName ) { - - return childNode; - - } - - var result = searchNodeSubtree( childNode.children ); - - if ( result ) return result; - - } - - return null; - - }; - - var subTreeNode = searchNodeSubtree( root.children ); - - if ( subTreeNode ) { - - return subTreeNode; - - } - - } - - return null; - - }; - - /** - * - * A group of objects that receives a shared animation state. - * - * Usage: - * - * - Add objects you would otherwise pass as 'root' to the - * constructor or the .clipAction method of AnimationMixer. - * - * - Instead pass this object as 'root'. - * - * - You can also add and remove objects later when the mixer - * is running. - * - * Note: - * - * Objects of this class appear as one object to the mixer, - * so cache control of the individual objects must be done - * on the group. - * - * Limitation: - * - * - The animated properties must be compatible among the - * all objects in the group. - * - * - A single property can either be controlled through a - * target group or directly, but not both. - * - * @author tschw - */ - - function AnimationObjectGroup( var_args ) { - - this.uuid = exports.Math.generateUUID(); - - // cached objects followed by the active ones - this._objects = Array.prototype.slice.call( arguments ); - - this.nCachedObjects_ = 0; // threshold - // note: read by PropertyBinding.Composite - - var indices = {}; - this._indicesByUUID = indices; // for bookkeeping - - for ( var i = 0, n = arguments.length; i !== n; ++ i ) { - - indices[ arguments[ i ].uuid ] = i; - - } - - this._paths = []; // inside: string - this._parsedPaths = []; // inside: { we don't care, here } - this._bindings = []; // inside: Array< PropertyBinding > - this._bindingsIndicesByPath = {}; // inside: indices in these arrays - - var scope = this; - - this.stats = { - - objects: { - get total() { return scope._objects.length; }, - get inUse() { return this.total - scope.nCachedObjects_; } - }, - - get bindingsPerObject() { return scope._bindings.length; } - - }; - - } - - AnimationObjectGroup.prototype = { - - constructor: AnimationObjectGroup, - - isAnimationObjectGroup: true, - - add: function( var_args ) { - - var objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - indicesByUUID = this._indicesByUUID, - paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - nBindings = bindings.length; - - for ( var i = 0, n = arguments.length; i !== n; ++ i ) { - - var object = arguments[ i ], - uuid = object.uuid, - index = indicesByUUID[ uuid ]; - - if ( index === undefined ) { - - // unknown object -> add it to the ACTIVE region - - index = nObjects ++; - indicesByUUID[ uuid ] = index; - objects.push( object ); - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - bindings[ j ].push( - new PropertyBinding( - object, paths[ j ], parsedPaths[ j ] ) ); - - } - - } else if ( index < nCachedObjects ) { - - var knownObject = objects[ index ]; - - // move existing object to the ACTIVE region - - var firstActiveIndex = -- nCachedObjects, - lastCachedObject = objects[ firstActiveIndex ]; - - indicesByUUID[ lastCachedObject.uuid ] = index; - objects[ index ] = lastCachedObject; - - indicesByUUID[ uuid ] = firstActiveIndex; - objects[ firstActiveIndex ] = object; - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - var bindingsForPath = bindings[ j ], - lastCached = bindingsForPath[ firstActiveIndex ], - binding = bindingsForPath[ index ]; - - bindingsForPath[ index ] = lastCached; - - if ( binding === undefined ) { - - // since we do not bother to create new bindings - // for objects that are cached, the binding may - // or may not exist - - binding = new PropertyBinding( - object, paths[ j ], parsedPaths[ j ] ); - - } - - bindingsForPath[ firstActiveIndex ] = binding; - - } - - } else if ( objects[ index ] !== knownObject) { - - console.error( "Different objects with the same UUID " + - "detected. Clean the caches or recreate your " + - "infrastructure when reloading scenes..." ); - - } // else the object is already where we want it to be - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - }, - - remove: function( var_args ) { - - var objects = this._objects, - nCachedObjects = this.nCachedObjects_, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - - for ( var i = 0, n = arguments.length; i !== n; ++ i ) { - - var object = arguments[ i ], - uuid = object.uuid, - index = indicesByUUID[ uuid ]; - - if ( index !== undefined && index >= nCachedObjects ) { - - // move existing object into the CACHED region - - var lastCachedIndex = nCachedObjects ++, - firstActiveObject = objects[ lastCachedIndex ]; - - indicesByUUID[ firstActiveObject.uuid ] = index; - objects[ index ] = firstActiveObject; - - indicesByUUID[ uuid ] = lastCachedIndex; - objects[ lastCachedIndex ] = object; - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - var bindingsForPath = bindings[ j ], - firstActive = bindingsForPath[ lastCachedIndex ], - binding = bindingsForPath[ index ]; - - bindingsForPath[ index ] = firstActive; - bindingsForPath[ lastCachedIndex ] = binding; - - } - - } - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - }, - - // remove & forget - uncache: function( var_args ) { - - var objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - - for ( var i = 0, n = arguments.length; i !== n; ++ i ) { - - var object = arguments[ i ], - uuid = object.uuid, - index = indicesByUUID[ uuid ]; - - if ( index !== undefined ) { - - delete indicesByUUID[ uuid ]; - - if ( index < nCachedObjects ) { - - // object is cached, shrink the CACHED region - - var firstActiveIndex = -- nCachedObjects, - lastCachedObject = objects[ firstActiveIndex ], - lastIndex = -- nObjects, - lastObject = objects[ lastIndex ]; - - // last cached object takes this object's place - indicesByUUID[ lastCachedObject.uuid ] = index; - objects[ index ] = lastCachedObject; - - // last object goes to the activated slot and pop - indicesByUUID[ lastObject.uuid ] = firstActiveIndex; - objects[ firstActiveIndex ] = lastObject; - objects.pop(); - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - var bindingsForPath = bindings[ j ], - lastCached = bindingsForPath[ firstActiveIndex ], - last = bindingsForPath[ lastIndex ]; - - bindingsForPath[ index ] = lastCached; - bindingsForPath[ firstActiveIndex ] = last; - bindingsForPath.pop(); - - } - - } else { - - // object is active, just swap with the last and pop - - var lastIndex = -- nObjects, - lastObject = objects[ lastIndex ]; - - indicesByUUID[ lastObject.uuid ] = index; - objects[ index ] = lastObject; - objects.pop(); - - // accounting is done, now do the same for all bindings - - for ( var j = 0, m = nBindings; j !== m; ++ j ) { - - var bindingsForPath = bindings[ j ]; - - bindingsForPath[ index ] = bindingsForPath[ lastIndex ]; - bindingsForPath.pop(); - - } - - } // cached or active - - } // if object is known - - } // for arguments - - this.nCachedObjects_ = nCachedObjects; - - }, - - // Internal interface used by befriended PropertyBinding.Composite: - - subscribe_: function( path, parsedPath ) { - // returns an array of bindings for the given path that is changed - // according to the contained objects in the group - - var indicesByPath = this._bindingsIndicesByPath, - index = indicesByPath[ path ], - bindings = this._bindings; - - if ( index !== undefined ) return bindings[ index ]; - - var paths = this._paths, - parsedPaths = this._parsedPaths, - objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - bindingsForPath = new Array( nObjects ); - - index = bindings.length; - - indicesByPath[ path ] = index; - - paths.push( path ); - parsedPaths.push( parsedPath ); - bindings.push( bindingsForPath ); - - for ( var i = nCachedObjects, - n = objects.length; i !== n; ++ i ) { - - var object = objects[ i ]; - - bindingsForPath[ i ] = - new PropertyBinding( object, path, parsedPath ); - - } - - return bindingsForPath; - - }, - - unsubscribe_: function( path ) { - // tells the group to forget about a property path and no longer - // update the array previously obtained with 'subscribe_' - - var indicesByPath = this._bindingsIndicesByPath, - index = indicesByPath[ path ]; - - if ( index !== undefined ) { - - var paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - lastBindingsIndex = bindings.length - 1, - lastBindings = bindings[ lastBindingsIndex ], - lastBindingsPath = path[ lastBindingsIndex ]; - - indicesByPath[ lastBindingsPath ] = index; - - bindings[ index ] = lastBindings; - bindings.pop(); - - parsedPaths[ index ] = parsedPaths[ lastBindingsIndex ]; - parsedPaths.pop(); - - paths[ index ] = paths[ lastBindingsIndex ]; - paths.pop(); - - } - - } - - }; - - /** - * - * Action provided by AnimationMixer for scheduling clip playback on specific - * objects. - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - * - */ - - function AnimationAction( mixer, clip, localRoot ) { - - this._mixer = mixer; - this._clip = clip; - this._localRoot = localRoot || null; - - var tracks = clip.tracks, - nTracks = tracks.length, - interpolants = new Array( nTracks ); - - var interpolantSettings = { - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - }; - - for ( var i = 0; i !== nTracks; ++ i ) { - - var interpolant = tracks[ i ].createInterpolant( null ); - interpolants[ i ] = interpolant; - interpolant.settings = interpolantSettings; - - } - - this._interpolantSettings = interpolantSettings; - - this._interpolants = interpolants; // bound by the mixer - - // inside: PropertyMixer (managed by the mixer) - this._propertyBindings = new Array( nTracks ); - - this._cacheIndex = null; // for the memory manager - this._byClipCacheIndex = null; // for the memory manager - - this._timeScaleInterpolant = null; - this._weightInterpolant = null; - - this.loop = LoopRepeat; - this._loopCount = -1; - - // global mixer time when the action is to be started - // it's set back to 'null' upon start of the action - this._startTime = null; - - // scaled local time of the action - // gets clamped or wrapped to 0..clip.duration according to loop - this.time = 0; - - this.timeScale = 1; - this._effectiveTimeScale = 1; - - this.weight = 1; - this._effectiveWeight = 1; - - this.repetitions = Infinity; // no. of repetitions when looping - - this.paused = false; // false -> zero effective time scale - this.enabled = true; // true -> zero effective weight - - this.clampWhenFinished = false; // keep feeding the last frame? - - this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate - this.zeroSlopeAtEnd = true; // clips for start, loop and end - - }; - - AnimationAction.prototype = { - - constructor: AnimationAction, - - // State & Scheduling - - play: function() { - - this._mixer._activateAction( this ); - - return this; - - }, - - stop: function() { - - this._mixer._deactivateAction( this ); - - return this.reset(); - - }, - - reset: function() { - - this.paused = false; - this.enabled = true; - - this.time = 0; // restart clip - this._loopCount = -1; // forget previous loops - this._startTime = null; // forget scheduling - - return this.stopFading().stopWarping(); - - }, - - isRunning: function() { - - return this.enabled && ! this.paused && this.timeScale !== 0 && - this._startTime === null && this._mixer._isActiveAction( this ); - - }, - - // return true when play has been called - isScheduled: function() { - - return this._mixer._isActiveAction( this ); - - }, - - startAt: function( time ) { - - this._startTime = time; - - return this; - - }, - - setLoop: function( mode, repetitions ) { - - this.loop = mode; - this.repetitions = repetitions; - - return this; - - }, - - // Weight - - // set the weight stopping any scheduled fading - // although .enabled = false yields an effective weight of zero, this - // method does *not* change .enabled, because it would be confusing - setEffectiveWeight: function( weight ) { - - this.weight = weight; - - // note: same logic as when updated at runtime - this._effectiveWeight = this.enabled ? weight : 0; - - return this.stopFading(); - - }, - - // return the weight considering fading and .enabled - getEffectiveWeight: function() { - - return this._effectiveWeight; - - }, - - fadeIn: function( duration ) { - - return this._scheduleFading( duration, 0, 1 ); - - }, - - fadeOut: function( duration ) { - - return this._scheduleFading( duration, 1, 0 ); - - }, - - crossFadeFrom: function( fadeOutAction, duration, warp ) { - - fadeOutAction.fadeOut( duration ); - this.fadeIn( duration ); - - if( warp ) { - - var fadeInDuration = this._clip.duration, - fadeOutDuration = fadeOutAction._clip.duration, - - startEndRatio = fadeOutDuration / fadeInDuration, - endStartRatio = fadeInDuration / fadeOutDuration; - - fadeOutAction.warp( 1.0, startEndRatio, duration ); - this.warp( endStartRatio, 1.0, duration ); - - } - - return this; - - }, - - crossFadeTo: function( fadeInAction, duration, warp ) { - - return fadeInAction.crossFadeFrom( this, duration, warp ); - - }, - - stopFading: function() { - - var weightInterpolant = this._weightInterpolant; - - if ( weightInterpolant !== null ) { - - this._weightInterpolant = null; - this._mixer._takeBackControlInterpolant( weightInterpolant ); - - } - - return this; - - }, - - // Time Scale Control - - // set the weight stopping any scheduled warping - // although .paused = true yields an effective time scale of zero, this - // method does *not* change .paused, because it would be confusing - setEffectiveTimeScale: function( timeScale ) { - - this.timeScale = timeScale; - this._effectiveTimeScale = this.paused ? 0 :timeScale; - - return this.stopWarping(); - - }, - - // return the time scale considering warping and .paused - getEffectiveTimeScale: function() { - - return this._effectiveTimeScale; - - }, - - setDuration: function( duration ) { - - this.timeScale = this._clip.duration / duration; - - return this.stopWarping(); - - }, - - syncWith: function( action ) { - - this.time = action.time; - this.timeScale = action.timeScale; - - return this.stopWarping(); - - }, - - halt: function( duration ) { - - return this.warp( this._effectiveTimeScale, 0, duration ); - - }, - - warp: function( startTimeScale, endTimeScale, duration ) { - - var mixer = this._mixer, now = mixer.time, - interpolant = this._timeScaleInterpolant, - - timeScale = this.timeScale; - - if ( interpolant === null ) { - - interpolant = mixer._lendControlInterpolant(), - this._timeScaleInterpolant = interpolant; - - } - - var times = interpolant.parameterPositions, - values = interpolant.sampleValues; - - times[ 0 ] = now; - times[ 1 ] = now + duration; - - values[ 0 ] = startTimeScale / timeScale; - values[ 1 ] = endTimeScale / timeScale; - - return this; - - }, - - stopWarping: function() { - - var timeScaleInterpolant = this._timeScaleInterpolant; - - if ( timeScaleInterpolant !== null ) { - - this._timeScaleInterpolant = null; - this._mixer._takeBackControlInterpolant( timeScaleInterpolant ); - - } - - return this; - - }, - - // Object Accessors - - getMixer: function() { - - return this._mixer; - - }, - - getClip: function() { - - return this._clip; - - }, - - getRoot: function() { - - return this._localRoot || this._mixer._root; - - }, - - // Interna - - _update: function( time, deltaTime, timeDirection, accuIndex ) { - // called by the mixer - - var startTime = this._startTime; - - if ( startTime !== null ) { - - // check for scheduled start of action - - var timeRunning = ( time - startTime ) * timeDirection; - if ( timeRunning < 0 || timeDirection === 0 ) { - - return; // yet to come / don't decide when delta = 0 - - } - - // start - - this._startTime = null; // unschedule - deltaTime = timeDirection * timeRunning; - - } - - // apply time scale and advance time - - deltaTime *= this._updateTimeScale( time ); - var clipTime = this._updateTime( deltaTime ); - - // note: _updateTime may disable the action resulting in - // an effective weight of 0 - - var weight = this._updateWeight( time ); - - if ( weight > 0 ) { - - var interpolants = this._interpolants; - var propertyMixers = this._propertyBindings; - - for ( var j = 0, m = interpolants.length; j !== m; ++ j ) { - - interpolants[ j ].evaluate( clipTime ); - propertyMixers[ j ].accumulate( accuIndex, weight ); - - } - - } - - }, - - _updateWeight: function( time ) { - - var weight = 0; - - if ( this.enabled ) { - - weight = this.weight; - var interpolant = this._weightInterpolant; - - if ( interpolant !== null ) { - - var interpolantValue = interpolant.evaluate( time )[ 0 ]; - - weight *= interpolantValue; - - if ( time > interpolant.parameterPositions[ 1 ] ) { - - this.stopFading(); - - if ( interpolantValue === 0 ) { - - // faded out, disable - this.enabled = false; - - } - - } - - } - - } - - this._effectiveWeight = weight; - return weight; - - }, - - _updateTimeScale: function( time ) { - - var timeScale = 0; - - if ( ! this.paused ) { - - timeScale = this.timeScale; - - var interpolant = this._timeScaleInterpolant; - - if ( interpolant !== null ) { - - var interpolantValue = interpolant.evaluate( time )[ 0 ]; - - timeScale *= interpolantValue; - - if ( time > interpolant.parameterPositions[ 1 ] ) { - - this.stopWarping(); - - if ( timeScale === 0 ) { - - // motion has halted, pause - this.paused = true; - - } else { - - // warp done - apply final time scale - this.timeScale = timeScale; - - } - - } - - } - - } - - this._effectiveTimeScale = timeScale; - return timeScale; - - }, - - _updateTime: function( deltaTime ) { - - var time = this.time + deltaTime; - - if ( deltaTime === 0 ) return time; - - var duration = this._clip.duration, - - loop = this.loop, - loopCount = this._loopCount; - - if ( loop === LoopOnce ) { - - if ( loopCount === -1 ) { - // just started - - this.loopCount = 0; - this._setEndings( true, true, false ); - - } - - handle_stop: { - - if ( time >= duration ) { - - time = duration; - - } else if ( time < 0 ) { - - time = 0; - - } else break handle_stop; - - if ( this.clampWhenFinished ) this.paused = true; - else this.enabled = false; - - this._mixer.dispatchEvent( { - type: 'finished', action: this, - direction: deltaTime < 0 ? -1 : 1 - } ); - - } - - } else { // repetitive Repeat or PingPong - - var pingPong = ( loop === LoopPingPong ); - - if ( loopCount === -1 ) { - // just started - - if ( deltaTime >= 0 ) { - - loopCount = 0; - - this._setEndings( - true, this.repetitions === 0, pingPong ); - - } else { - - // when looping in reverse direction, the initial - // transition through zero counts as a repetition, - // so leave loopCount at -1 - - this._setEndings( - this.repetitions === 0, true, pingPong ); - - } - - } - - if ( time >= duration || time < 0 ) { - // wrap around - - var loopDelta = Math.floor( time / duration ); // signed - time -= duration * loopDelta; - - loopCount += Math.abs( loopDelta ); - - var pending = this.repetitions - loopCount; - - if ( pending < 0 ) { - // have to stop (switch state, clamp time, fire event) - - if ( this.clampWhenFinished ) this.paused = true; - else this.enabled = false; - - time = deltaTime > 0 ? duration : 0; - - this._mixer.dispatchEvent( { - type: 'finished', action: this, - direction: deltaTime > 0 ? 1 : -1 - } ); - - } else { - // keep running - - if ( pending === 0 ) { - // entering the last round - - var atStart = deltaTime < 0; - this._setEndings( atStart, ! atStart, pingPong ); - - } else { - - this._setEndings( false, false, pingPong ); - - } - - this._loopCount = loopCount; - - this._mixer.dispatchEvent( { - type: 'loop', action: this, loopDelta: loopDelta - } ); - - } - - } - - if ( pingPong && ( loopCount & 1 ) === 1 ) { - // invert time for the "pong round" - - this.time = time; - return duration - time; - - } - - } - - this.time = time; - return time; - - }, - - _setEndings: function( atStart, atEnd, pingPong ) { - - var settings = this._interpolantSettings; - - if ( pingPong ) { - - settings.endingStart = ZeroSlopeEnding; - settings.endingEnd = ZeroSlopeEnding; - - } else { - - // assuming for LoopOnce atStart == atEnd == true - - if ( atStart ) { - - settings.endingStart = this.zeroSlopeAtStart ? - ZeroSlopeEnding : ZeroCurvatureEnding; - - } else { - - settings.endingStart = WrapAroundEnding; - - } - - if ( atEnd ) { - - settings.endingEnd = this.zeroSlopeAtEnd ? - ZeroSlopeEnding : ZeroCurvatureEnding; - - } else { - - settings.endingEnd = WrapAroundEnding; - - } - - } - - }, - - _scheduleFading: function( duration, weightNow, weightThen ) { - - var mixer = this._mixer, now = mixer.time, - interpolant = this._weightInterpolant; - - if ( interpolant === null ) { - - interpolant = mixer._lendControlInterpolant(), - this._weightInterpolant = interpolant; - - } - - var times = interpolant.parameterPositions, - values = interpolant.sampleValues; - - times[ 0 ] = now; values[ 0 ] = weightNow; - times[ 1 ] = now + duration; values[ 1 ] = weightThen; - - return this; - - } - - }; - - /** - * - * Player for AnimationClips. - * - * - * @author Ben Houston / http://clara.io/ - * @author David Sarno / http://lighthaus.us/ - * @author tschw - */ - - function AnimationMixer( root ) { - - this._root = root; - this._initMemoryManager(); - this._accuIndex = 0; - - this.time = 0; - - this.timeScale = 1.0; - - } - - Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, { - - // return an action for a clip optionally using a custom root target - // object (this method allocates a lot of dynamic memory in case a - // previously unknown clip/root combination is specified) - clipAction: function( clip, optionalRoot ) { - - var root = optionalRoot || this._root, - rootUuid = root.uuid, - - clipObject = typeof clip === 'string' ? - AnimationClip.findByName( root, clip ) : clip, - - clipUuid = clipObject !== null ? clipObject.uuid : clip, - - actionsForClip = this._actionsByClip[ clipUuid ], - prototypeAction = null; - - if ( actionsForClip !== undefined ) { - - var existingAction = - actionsForClip.actionByRoot[ rootUuid ]; - - if ( existingAction !== undefined ) { - - return existingAction; - - } - - // we know the clip, so we don't have to parse all - // the bindings again but can just copy - prototypeAction = actionsForClip.knownActions[ 0 ]; - - // also, take the clip from the prototype action - if ( clipObject === null ) - clipObject = prototypeAction._clip; - - } - - // clip must be known when specified via string - if ( clipObject === null ) return null; - - // allocate all resources required to run it - var newAction = new AnimationAction( this, clipObject, optionalRoot ); - - this._bindAction( newAction, prototypeAction ); - - // and make the action known to the memory manager - this._addInactiveAction( newAction, clipUuid, rootUuid ); - - return newAction; - - }, - - // get an existing action - existingAction: function( clip, optionalRoot ) { - - var root = optionalRoot || this._root, - rootUuid = root.uuid, - - clipObject = typeof clip === 'string' ? - AnimationClip.findByName( root, clip ) : clip, - - clipUuid = clipObject ? clipObject.uuid : clip, - - actionsForClip = this._actionsByClip[ clipUuid ]; - - if ( actionsForClip !== undefined ) { - - return actionsForClip.actionByRoot[ rootUuid ] || null; - - } - - return null; - - }, - - // deactivates all previously scheduled actions - stopAllAction: function() { - - var actions = this._actions, - nActions = this._nActiveActions, - bindings = this._bindings, - nBindings = this._nActiveBindings; - - this._nActiveActions = 0; - this._nActiveBindings = 0; - - for ( var i = 0; i !== nActions; ++ i ) { - - actions[ i ].reset(); - - } - - for ( var i = 0; i !== nBindings; ++ i ) { - - bindings[ i ].useCount = 0; - - } - - return this; - - }, - - // advance the time and update apply the animation - update: function( deltaTime ) { - - deltaTime *= this.timeScale; - - var actions = this._actions, - nActions = this._nActiveActions, - - time = this.time += deltaTime, - timeDirection = Math.sign( deltaTime ), - - accuIndex = this._accuIndex ^= 1; - - // run active actions - - for ( var i = 0; i !== nActions; ++ i ) { - - var action = actions[ i ]; - - if ( action.enabled ) { - - action._update( time, deltaTime, timeDirection, accuIndex ); - - } - - } - - // update scene graph - - var bindings = this._bindings, - nBindings = this._nActiveBindings; - - for ( var i = 0; i !== nBindings; ++ i ) { - - bindings[ i ].apply( accuIndex ); - - } - - return this; - - }, - - // return this mixer's root target object - getRoot: function() { - - return this._root; - - }, - - // free all resources specific to a particular clip - uncacheClip: function( clip ) { - - var actions = this._actions, - clipUuid = clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[ clipUuid ]; - - if ( actionsForClip !== undefined ) { - - // note: just calling _removeInactiveAction would mess up the - // iteration state and also require updating the state we can - // just throw away - - var actionsToRemove = actionsForClip.knownActions; - - for ( var i = 0, n = actionsToRemove.length; i !== n; ++ i ) { - - var action = actionsToRemove[ i ]; - - this._deactivateAction( action ); - - var cacheIndex = action._cacheIndex, - lastInactiveAction = actions[ actions.length - 1 ]; - - action._cacheIndex = null; - action._byClipCacheIndex = null; - - lastInactiveAction._cacheIndex = cacheIndex; - actions[ cacheIndex ] = lastInactiveAction; - actions.pop(); - - this._removeInactiveBindingsForAction( action ); - - } - - delete actionsByClip[ clipUuid ]; - - } - - }, - - // free all resources specific to a particular root target object - uncacheRoot: function( root ) { - - var rootUuid = root.uuid, - actionsByClip = this._actionsByClip; - - for ( var clipUuid in actionsByClip ) { - - var actionByRoot = actionsByClip[ clipUuid ].actionByRoot, - action = actionByRoot[ rootUuid ]; - - if ( action !== undefined ) { - - this._deactivateAction( action ); - this._removeInactiveAction( action ); - - } - - } - - var bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[ rootUuid ]; - - if ( bindingByName !== undefined ) { - - for ( var trackName in bindingByName ) { - - var binding = bindingByName[ trackName ]; - binding.restoreOriginalState(); - this._removeInactiveBinding( binding ); - - } - - } - - }, - - // remove a targeted clip from the cache - uncacheAction: function( clip, optionalRoot ) { - - var action = this.existingAction( clip, optionalRoot ); - - if ( action !== null ) { - - this._deactivateAction( action ); - this._removeInactiveAction( action ); - - } - - } - - } ); - - // Implementation details: - - Object.assign( AnimationMixer.prototype, { - - _bindAction: function( action, prototypeAction ) { - - var root = action._localRoot || this._root, - tracks = action._clip.tracks, - nTracks = tracks.length, - bindings = action._propertyBindings, - interpolants = action._interpolants, - rootUuid = root.uuid, - bindingsByRoot = this._bindingsByRootAndName, - bindingsByName = bindingsByRoot[ rootUuid ]; - - if ( bindingsByName === undefined ) { - - bindingsByName = {}; - bindingsByRoot[ rootUuid ] = bindingsByName; - - } - - for ( var i = 0; i !== nTracks; ++ i ) { - - var track = tracks[ i ], - trackName = track.name, - binding = bindingsByName[ trackName ]; - - if ( binding !== undefined ) { - - bindings[ i ] = binding; - - } else { - - binding = bindings[ i ]; - - if ( binding !== undefined ) { - - // existing binding, make sure the cache knows - - if ( binding._cacheIndex === null ) { - - ++ binding.referenceCount; - this._addInactiveBinding( binding, rootUuid, trackName ); - - } - - continue; - - } - - var path = prototypeAction && prototypeAction. - _propertyBindings[ i ].binding.parsedPath; - - binding = new PropertyMixer( - PropertyBinding.create( root, trackName, path ), - track.ValueTypeName, track.getValueSize() ); - - ++ binding.referenceCount; - this._addInactiveBinding( binding, rootUuid, trackName ); - - bindings[ i ] = binding; - - } - - interpolants[ i ].resultBuffer = binding.buffer; - - } - - }, - - _activateAction: function( action ) { - - if ( ! this._isActiveAction( action ) ) { - - if ( action._cacheIndex === null ) { - - // this action has been forgotten by the cache, but the user - // appears to be still using it -> rebind - - var rootUuid = ( action._localRoot || this._root ).uuid, - clipUuid = action._clip.uuid, - actionsForClip = this._actionsByClip[ clipUuid ]; - - this._bindAction( action, - actionsForClip && actionsForClip.knownActions[ 0 ] ); - - this._addInactiveAction( action, clipUuid, rootUuid ); - - } - - var bindings = action._propertyBindings; - - // increment reference counts / sort out state - for ( var i = 0, n = bindings.length; i !== n; ++ i ) { - - var binding = bindings[ i ]; - - if ( binding.useCount ++ === 0 ) { - - this._lendBinding( binding ); - binding.saveOriginalState(); - - } - - } - - this._lendAction( action ); - - } - - }, - - _deactivateAction: function( action ) { - - if ( this._isActiveAction( action ) ) { - - var bindings = action._propertyBindings; - - // decrement reference counts / sort out state - for ( var i = 0, n = bindings.length; i !== n; ++ i ) { - - var binding = bindings[ i ]; - - if ( -- binding.useCount === 0 ) { - - binding.restoreOriginalState(); - this._takeBackBinding( binding ); - - } - - } - - this._takeBackAction( action ); - - } - - }, - - // Memory manager - - _initMemoryManager: function() { - - this._actions = []; // 'nActiveActions' followed by inactive ones - this._nActiveActions = 0; - - this._actionsByClip = {}; - // inside: - // { - // knownActions: Array< AnimationAction > - used as prototypes - // actionByRoot: AnimationAction - lookup - // } - - - this._bindings = []; // 'nActiveBindings' followed by inactive ones - this._nActiveBindings = 0; - - this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer > - - - this._controlInterpolants = []; // same game as above - this._nActiveControlInterpolants = 0; - - var scope = this; - - this.stats = { - - actions: { - get total() { return scope._actions.length; }, - get inUse() { return scope._nActiveActions; } - }, - bindings: { - get total() { return scope._bindings.length; }, - get inUse() { return scope._nActiveBindings; } - }, - controlInterpolants: { - get total() { return scope._controlInterpolants.length; }, - get inUse() { return scope._nActiveControlInterpolants; } - } - - }; - - }, - - // Memory management for AnimationAction objects - - _isActiveAction: function( action ) { - - var index = action._cacheIndex; - return index !== null && index < this._nActiveActions; - - }, - - _addInactiveAction: function( action, clipUuid, rootUuid ) { - - var actions = this._actions, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[ clipUuid ]; - - if ( actionsForClip === undefined ) { - - actionsForClip = { - - knownActions: [ action ], - actionByRoot: {} - - }; - - action._byClipCacheIndex = 0; - - actionsByClip[ clipUuid ] = actionsForClip; - - } else { - - var knownActions = actionsForClip.knownActions; - - action._byClipCacheIndex = knownActions.length; - knownActions.push( action ); - - } - - action._cacheIndex = actions.length; - actions.push( action ); - - actionsForClip.actionByRoot[ rootUuid ] = action; - - }, - - _removeInactiveAction: function( action ) { - - var actions = this._actions, - lastInactiveAction = actions[ actions.length - 1 ], - cacheIndex = action._cacheIndex; - - lastInactiveAction._cacheIndex = cacheIndex; - actions[ cacheIndex ] = lastInactiveAction; - actions.pop(); - - action._cacheIndex = null; - - - var clipUuid = action._clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[ clipUuid ], - knownActionsForClip = actionsForClip.knownActions, - - lastKnownAction = - knownActionsForClip[ knownActionsForClip.length - 1 ], - - byClipCacheIndex = action._byClipCacheIndex; - - lastKnownAction._byClipCacheIndex = byClipCacheIndex; - knownActionsForClip[ byClipCacheIndex ] = lastKnownAction; - knownActionsForClip.pop(); - - action._byClipCacheIndex = null; - - - var actionByRoot = actionsForClip.actionByRoot, - rootUuid = ( actions._localRoot || this._root ).uuid; - - delete actionByRoot[ rootUuid ]; - - if ( knownActionsForClip.length === 0 ) { - - delete actionsByClip[ clipUuid ]; - - } - - this._removeInactiveBindingsForAction( action ); - - }, - - _removeInactiveBindingsForAction: function( action ) { - - var bindings = action._propertyBindings; - for ( var i = 0, n = bindings.length; i !== n; ++ i ) { - - var binding = bindings[ i ]; - - if ( -- binding.referenceCount === 0 ) { - - this._removeInactiveBinding( binding ); - - } - - } - - }, - - _lendAction: function( action ) { - - // [ active actions | inactive actions ] - // [ active actions >| inactive actions ] - // s a - // <-swap-> - // a s - - var actions = this._actions, - prevIndex = action._cacheIndex, - - lastActiveIndex = this._nActiveActions ++, - - firstInactiveAction = actions[ lastActiveIndex ]; - - action._cacheIndex = lastActiveIndex; - actions[ lastActiveIndex ] = action; - - firstInactiveAction._cacheIndex = prevIndex; - actions[ prevIndex ] = firstInactiveAction; - - }, - - _takeBackAction: function( action ) { - - // [ active actions | inactive actions ] - // [ active actions |< inactive actions ] - // a s - // <-swap-> - // s a - - var actions = this._actions, - prevIndex = action._cacheIndex, - - firstInactiveIndex = -- this._nActiveActions, - - lastActiveAction = actions[ firstInactiveIndex ]; - - action._cacheIndex = firstInactiveIndex; - actions[ firstInactiveIndex ] = action; - - lastActiveAction._cacheIndex = prevIndex; - actions[ prevIndex ] = lastActiveAction; - - }, - - // Memory management for PropertyMixer objects - - _addInactiveBinding: function( binding, rootUuid, trackName ) { - - var bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[ rootUuid ], - - bindings = this._bindings; - - if ( bindingByName === undefined ) { - - bindingByName = {}; - bindingsByRoot[ rootUuid ] = bindingByName; - - } - - bindingByName[ trackName ] = binding; - - binding._cacheIndex = bindings.length; - bindings.push( binding ); - - }, - - _removeInactiveBinding: function( binding ) { - - var bindings = this._bindings, - propBinding = binding.binding, - rootUuid = propBinding.rootNode.uuid, - trackName = propBinding.path, - bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[ rootUuid ], - - lastInactiveBinding = bindings[ bindings.length - 1 ], - cacheIndex = binding._cacheIndex; - - lastInactiveBinding._cacheIndex = cacheIndex; - bindings[ cacheIndex ] = lastInactiveBinding; - bindings.pop(); - - delete bindingByName[ trackName ]; - - remove_empty_map: { - - for ( var _ in bindingByName ) break remove_empty_map; - - delete bindingsByRoot[ rootUuid ]; - - } - - }, - - _lendBinding: function( binding ) { - - var bindings = this._bindings, - prevIndex = binding._cacheIndex, - - lastActiveIndex = this._nActiveBindings ++, - - firstInactiveBinding = bindings[ lastActiveIndex ]; - - binding._cacheIndex = lastActiveIndex; - bindings[ lastActiveIndex ] = binding; - - firstInactiveBinding._cacheIndex = prevIndex; - bindings[ prevIndex ] = firstInactiveBinding; - - }, - - _takeBackBinding: function( binding ) { - - var bindings = this._bindings, - prevIndex = binding._cacheIndex, - - firstInactiveIndex = -- this._nActiveBindings, - - lastActiveBinding = bindings[ firstInactiveIndex ]; - - binding._cacheIndex = firstInactiveIndex; - bindings[ firstInactiveIndex ] = binding; - - lastActiveBinding._cacheIndex = prevIndex; - bindings[ prevIndex ] = lastActiveBinding; - - }, - - - // Memory management of Interpolants for weight and time scale - - _lendControlInterpolant: function() { - - var interpolants = this._controlInterpolants, - lastActiveIndex = this._nActiveControlInterpolants ++, - interpolant = interpolants[ lastActiveIndex ]; - - if ( interpolant === undefined ) { - - interpolant = new LinearInterpolant( - new Float32Array( 2 ), new Float32Array( 2 ), - 1, this._controlInterpolantsResultBuffer ); - - interpolant.__cacheIndex = lastActiveIndex; - interpolants[ lastActiveIndex ] = interpolant; - - } - - return interpolant; - - }, - - _takeBackControlInterpolant: function( interpolant ) { - - var interpolants = this._controlInterpolants, - prevIndex = interpolant.__cacheIndex, - - firstInactiveIndex = -- this._nActiveControlInterpolants, - - lastActiveInterpolant = interpolants[ firstInactiveIndex ]; - - interpolant.__cacheIndex = firstInactiveIndex; - interpolants[ firstInactiveIndex ] = interpolant; - - lastActiveInterpolant.__cacheIndex = prevIndex; - interpolants[ prevIndex ] = lastActiveInterpolant; - - }, - - _controlInterpolantsResultBuffer: new Float32Array( 1 ) - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function Uniform( value ) { - - if ( typeof value === 'string' ) { - - console.warn( 'THREE.Uniform: Type parameter is no longer needed.' ); - value = arguments[ 1 ]; - - } - - this.value = value; - - this.dynamic = false; - - } - - Uniform.prototype = { - - constructor: Uniform, - - onUpdate: function ( callback ) { - - this.dynamic = true; - this.onUpdateCallback = callback; - - return this; - - } - - }; - - /** - * @author benaadams / https://twitter.com/ben_a_adams - */ - - function InstancedBufferGeometry() { - - BufferGeometry.call( this ); - - this.type = 'InstancedBufferGeometry'; - this.maxInstancedCount = undefined; - - } - - InstancedBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - InstancedBufferGeometry.prototype.constructor = InstancedBufferGeometry; - - InstancedBufferGeometry.prototype.isInstancedBufferGeometry = true; - - InstancedBufferGeometry.prototype.addGroup = function ( start, count, instances ) { - - this.groups.push( { - - start: start, - count: count, - instances: instances - - } ); - - }; - - InstancedBufferGeometry.prototype.copy = function ( source ) { - - var index = source.index; - - if ( index !== null ) { - - this.setIndex( index.clone() ); - - } - - var attributes = source.attributes; - - for ( var name in attributes ) { - - var attribute = attributes[ name ]; - this.addAttribute( name, attribute.clone() ); - - } - - var groups = source.groups; - - for ( var i = 0, l = groups.length; i < l; i ++ ) { - - var group = groups[ i ]; - this.addGroup( group.start, group.count, group.instances ); - - } - - return this; - - }; - - /** - * @author benaadams / https://twitter.com/ben_a_adams - */ - - function InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, normalized ) { - - this.uuid = exports.Math.generateUUID(); - - this.data = interleavedBuffer; - this.itemSize = itemSize; - this.offset = offset; - - this.normalized = normalized === true; - - } - - - InterleavedBufferAttribute.prototype = { - - constructor: InterleavedBufferAttribute, - - isInterleavedBufferAttribute: true, - - get count() { - - return this.data.count; - - }, - - get array() { - - return this.data.array; - - }, - - setX: function ( index, x ) { - - this.data.array[ index * this.data.stride + this.offset ] = x; - - return this; - - }, - - setY: function ( index, y ) { - - this.data.array[ index * this.data.stride + this.offset + 1 ] = y; - - return this; - - }, - - setZ: function ( index, z ) { - - this.data.array[ index * this.data.stride + this.offset + 2 ] = z; - - return this; - - }, - - setW: function ( index, w ) { - - this.data.array[ index * this.data.stride + this.offset + 3 ] = w; - - return this; - - }, - - getX: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset ]; - - }, - - getY: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 1 ]; - - }, - - getZ: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 2 ]; - - }, - - getW: function ( index ) { - - return this.data.array[ index * this.data.stride + this.offset + 3 ]; - - }, - - setXY: function ( index, x, y ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - - return this; - - }, - - setXYZ: function ( index, x, y, z ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - this.data.array[ index + 2 ] = z; - - return this; - - }, - - setXYZW: function ( index, x, y, z, w ) { - - index = index * this.data.stride + this.offset; - - this.data.array[ index + 0 ] = x; - this.data.array[ index + 1 ] = y; - this.data.array[ index + 2 ] = z; - this.data.array[ index + 3 ] = w; - - return this; - - } - - }; - - /** - * @author benaadams / https://twitter.com/ben_a_adams - */ - - function InterleavedBuffer( array, stride ) { - - this.uuid = exports.Math.generateUUID(); - - this.array = array; - this.stride = stride; - this.count = array !== undefined ? array.length / stride : 0; - - this.dynamic = false; - this.updateRange = { offset: 0, count: - 1 }; - - this.version = 0; - - } - - InterleavedBuffer.prototype = { - - constructor: InterleavedBuffer, - - isInterleavedBuffer: true, - - set needsUpdate( value ) { - - if ( value === true ) this.version ++; - - }, - - setDynamic: function ( value ) { - - this.dynamic = value; - - return this; - - }, - - copy: function ( source ) { - - this.array = new source.array.constructor( source.array ); - this.count = source.count; - this.stride = source.stride; - this.dynamic = source.dynamic; - - return this; - - }, - - copyAt: function ( index1, attribute, index2 ) { - - index1 *= this.stride; - index2 *= attribute.stride; - - for ( var i = 0, l = this.stride; i < l; i ++ ) { - - this.array[ index1 + i ] = attribute.array[ index2 + i ]; - - } - - return this; - - }, - - set: function ( value, offset ) { - - if ( offset === undefined ) offset = 0; - - this.array.set( value, offset ); - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - } - - }; - - /** - * @author benaadams / https://twitter.com/ben_a_adams - */ - - function InstancedInterleavedBuffer( array, stride, meshPerAttribute ) { - - InterleavedBuffer.call( this, array, stride ); - - this.meshPerAttribute = meshPerAttribute || 1; - - } - - InstancedInterleavedBuffer.prototype = Object.create( InterleavedBuffer.prototype ); - InstancedInterleavedBuffer.prototype.constructor = InstancedInterleavedBuffer; - - InstancedInterleavedBuffer.prototype.isInstancedInterleavedBuffer = true; - - InstancedInterleavedBuffer.prototype.copy = function ( source ) { - - InterleavedBuffer.prototype.copy.call( this, source ); - - this.meshPerAttribute = source.meshPerAttribute; - - return this; - - }; - - /** - * @author benaadams / https://twitter.com/ben_a_adams - */ - - function InstancedBufferAttribute( array, itemSize, meshPerAttribute ) { - - BufferAttribute.call( this, array, itemSize ); - - this.meshPerAttribute = meshPerAttribute || 1; - - } - - InstancedBufferAttribute.prototype = Object.create( BufferAttribute.prototype ); - InstancedBufferAttribute.prototype.constructor = InstancedBufferAttribute; - - InstancedBufferAttribute.prototype.isInstancedBufferAttribute = true; - - InstancedBufferAttribute.prototype.copy = function ( source ) { - - BufferAttribute.prototype.copy.call( this, source ); - - this.meshPerAttribute = source.meshPerAttribute; - - return this; - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author bhouston / http://clara.io/ - * @author stephomi / http://stephaneginier.com/ - */ - - function Raycaster( origin, direction, near, far ) { - - this.ray = new Ray( origin, direction ); - // direction is assumed to be normalized (for accurate distance calculations) - - this.near = near || 0; - this.far = far || Infinity; - - this.params = { - Mesh: {}, - Line: {}, - LOD: {}, - Points: { threshold: 1 }, - Sprite: {} - }; - - Object.defineProperties( this.params, { - PointCloud: { - get: function () { - console.warn( 'THREE.Raycaster: params.PointCloud has been renamed to params.Points.' ); - return this.Points; - } - } - } ); - - } - - function ascSort( a, b ) { - - return a.distance - b.distance; - - } - - function intersectObject( object, raycaster, intersects, recursive ) { - - if ( object.visible === false ) return; - - object.raycast( raycaster, intersects ); - - if ( recursive === true ) { - - var children = object.children; - - for ( var i = 0, l = children.length; i < l; i ++ ) { - - intersectObject( children[ i ], raycaster, intersects, true ); - - } - - } - - } - - // - - Raycaster.prototype = { - - constructor: Raycaster, - - linePrecision: 1, - - set: function ( origin, direction ) { - - // direction is assumed to be normalized (for accurate distance calculations) - - this.ray.set( origin, direction ); - - }, - - setFromCamera: function ( coords, camera ) { - - if ( (camera && camera.isPerspectiveCamera) ) { - - this.ray.origin.setFromMatrixPosition( camera.matrixWorld ); - this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize(); - - } else if ( (camera && camera.isOrthographicCamera) ) { - - this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera - this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ); - - } else { - - console.error( 'THREE.Raycaster: Unsupported camera type.' ); - - } - - }, - - intersectObject: function ( object, recursive ) { - - var intersects = []; - - intersectObject( object, this, intersects, recursive ); - - intersects.sort( ascSort ); - - return intersects; - - }, - - intersectObjects: function ( objects, recursive ) { - - var intersects = []; - - if ( Array.isArray( objects ) === false ) { - - console.warn( 'THREE.Raycaster.intersectObjects: objects is not an Array.' ); - return intersects; - - } - - for ( var i = 0, l = objects.length; i < l; i ++ ) { - - intersectObject( objects[ i ], this, intersects, recursive ); - - } - - intersects.sort( ascSort ); - - return intersects; - - } - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function Clock( autoStart ) { - - this.autoStart = ( autoStart !== undefined ) ? autoStart : true; - - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - - this.running = false; - - } - - Clock.prototype = { - - constructor: Clock, - - start: function () { - - this.startTime = ( performance || Date ).now(); - - this.oldTime = this.startTime; - this.running = true; - - }, - - stop: function () { - - this.getElapsedTime(); - this.running = false; - - }, - - getElapsedTime: function () { - - this.getDelta(); - return this.elapsedTime; - - }, - - getDelta: function () { - - var diff = 0; - - if ( this.autoStart && ! this.running ) { - - this.start(); - - } - - if ( this.running ) { - - var newTime = ( performance || Date ).now(); - - diff = ( newTime - this.oldTime ) / 1000; - this.oldTime = newTime; - - this.elapsedTime += diff; - - } - - return diff; - - } - - }; - - /** - * Spline from Tween.js, slightly optimized (and trashed) - * http://sole.github.com/tween.js/examples/05_spline.html - * - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function Spline( points ) { - - this.points = points; - - var c = [], v3 = { x: 0, y: 0, z: 0 }, - point, intPoint, weight, w2, w3, - pa, pb, pc, pd; - - this.initFromArray = function ( a ) { - - this.points = []; - - for ( var i = 0; i < a.length; i ++ ) { - - this.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] }; - - } - - }; - - this.getPoint = function ( k ) { - - point = ( this.points.length - 1 ) * k; - intPoint = Math.floor( point ); - weight = point - intPoint; - - c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; - c[ 1 ] = intPoint; - c[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1; - c[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2; - - pa = this.points[ c[ 0 ] ]; - pb = this.points[ c[ 1 ] ]; - pc = this.points[ c[ 2 ] ]; - pd = this.points[ c[ 3 ] ]; - - w2 = weight * weight; - w3 = weight * w2; - - v3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 ); - v3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 ); - v3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 ); - - return v3; - - }; - - this.getControlPointsArray = function () { - - var i, p, l = this.points.length, - coords = []; - - for ( i = 0; i < l; i ++ ) { - - p = this.points[ i ]; - coords[ i ] = [ p.x, p.y, p.z ]; - - } - - return coords; - - }; - - // approximate length by summing linear segments - - this.getLength = function ( nSubDivisions ) { - - var i, index, nSamples, position, - point = 0, intPoint = 0, oldIntPoint = 0, - oldPosition = new Vector3(), - tmpVec = new Vector3(), - chunkLengths = [], - totalLength = 0; - - // first point has 0 length - - chunkLengths[ 0 ] = 0; - - if ( ! nSubDivisions ) nSubDivisions = 100; - - nSamples = this.points.length * nSubDivisions; - - oldPosition.copy( this.points[ 0 ] ); - - for ( i = 1; i < nSamples; i ++ ) { - - index = i / nSamples; - - position = this.getPoint( index ); - tmpVec.copy( position ); - - totalLength += tmpVec.distanceTo( oldPosition ); - - oldPosition.copy( position ); - - point = ( this.points.length - 1 ) * index; - intPoint = Math.floor( point ); - - if ( intPoint !== oldIntPoint ) { - - chunkLengths[ intPoint ] = totalLength; - oldIntPoint = intPoint; - - } - - } - - // last point ends with total length - - chunkLengths[ chunkLengths.length ] = totalLength; - - return { chunks: chunkLengths, total: totalLength }; - - }; - - this.reparametrizeByArcLength = function ( samplingCoef ) { - - var i, j, - index, indexCurrent, indexNext, - realDistance, - sampling, position, - newpoints = [], - tmpVec = new Vector3(), - sl = this.getLength(); - - newpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() ); - - for ( i = 1; i < this.points.length; i ++ ) { - - //tmpVec.copy( this.points[ i - 1 ] ); - //linearDistance = tmpVec.distanceTo( this.points[ i ] ); - - realDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ]; - - sampling = Math.ceil( samplingCoef * realDistance / sl.total ); - - indexCurrent = ( i - 1 ) / ( this.points.length - 1 ); - indexNext = i / ( this.points.length - 1 ); - - for ( j = 1; j < sampling - 1; j ++ ) { - - index = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent ); - - position = this.getPoint( index ); - newpoints.push( tmpVec.copy( position ).clone() ); - - } - - newpoints.push( tmpVec.copy( this.points[ i ] ).clone() ); - - } - - this.points = newpoints; - - }; - - // Catmull-Rom - - function interpolate( p0, p1, p2, p3, t, t2, t3 ) { - - var v0 = ( p2 - p0 ) * 0.5, - v1 = ( p3 - p1 ) * 0.5; - - return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - } - - } - - /** - * @author bhouston / http://clara.io - * @author WestLangley / http://github.com/WestLangley - * - * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system - * - * The poles (phi) are at the positive and negative y axis. - * The equator starts at positive z. - */ - - function Spherical( radius, phi, theta ) { - - this.radius = ( radius !== undefined ) ? radius : 1.0; - this.phi = ( phi !== undefined ) ? phi : 0; // up / down towards top and bottom pole - this.theta = ( theta !== undefined ) ? theta : 0; // around the equator of the sphere - - return this; - - } - - Spherical.prototype = { - - constructor: Spherical, - - set: function ( radius, phi, theta ) { - - this.radius = radius; - this.phi = phi; - this.theta = theta; - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( other ) { - - this.radius.copy( other.radius ); - this.phi.copy( other.phi ); - this.theta.copy( other.theta ); - - return this; - - }, - - // restrict phi to be betwee EPS and PI-EPS - makeSafe: function() { - - var EPS = 0.000001; - this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) ); - - return this; - - }, - - setFromVector3: function( vec3 ) { - - this.radius = vec3.length(); - - if ( this.radius === 0 ) { - - this.theta = 0; - this.phi = 0; - - } else { - - this.theta = Math.atan2( vec3.x, vec3.z ); // equator angle around y-up axis - this.phi = Math.acos( exports.Math.clamp( vec3.y / this.radius, - 1, 1 ) ); // polar angle - - } - - return this; - - }, - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function MorphBlendMesh( geometry, material ) { - - Mesh.call( this, geometry, material ); - - this.animationsMap = {}; - this.animationsList = []; - - // prepare default animation - // (all frames played together in 1 second) - - var numFrames = this.geometry.morphTargets.length; - - var name = "__default"; - - var startFrame = 0; - var endFrame = numFrames - 1; - - var fps = numFrames / 1; - - this.createAnimation( name, startFrame, endFrame, fps ); - this.setAnimationWeight( name, 1 ); - - } - - MorphBlendMesh.prototype = Object.create( Mesh.prototype ); - MorphBlendMesh.prototype.constructor = MorphBlendMesh; - - MorphBlendMesh.prototype.createAnimation = function ( name, start, end, fps ) { - - var animation = { - - start: start, - end: end, - - length: end - start + 1, - - fps: fps, - duration: ( end - start ) / fps, - - lastFrame: 0, - currentFrame: 0, - - active: false, - - time: 0, - direction: 1, - weight: 1, - - directionBackwards: false, - mirroredLoop: false - - }; - - this.animationsMap[ name ] = animation; - this.animationsList.push( animation ); - - }; - - MorphBlendMesh.prototype.autoCreateAnimations = function ( fps ) { - - var pattern = /([a-z]+)_?(\d+)/i; - - var firstAnimation, frameRanges = {}; - - var geometry = this.geometry; - - for ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) { - - var morph = geometry.morphTargets[ i ]; - var chunks = morph.name.match( pattern ); - - if ( chunks && chunks.length > 1 ) { - - var name = chunks[ 1 ]; - - if ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity }; - - var range = frameRanges[ name ]; - - if ( i < range.start ) range.start = i; - if ( i > range.end ) range.end = i; - - if ( ! firstAnimation ) firstAnimation = name; - - } - - } - - for ( var name in frameRanges ) { - - var range = frameRanges[ name ]; - this.createAnimation( name, range.start, range.end, fps ); - - } - - this.firstAnimation = firstAnimation; - - }; - - MorphBlendMesh.prototype.setAnimationDirectionForward = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = 1; - animation.directionBackwards = false; - - } - - }; - - MorphBlendMesh.prototype.setAnimationDirectionBackward = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = - 1; - animation.directionBackwards = true; - - } - - }; - - MorphBlendMesh.prototype.setAnimationFPS = function ( name, fps ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.fps = fps; - animation.duration = ( animation.end - animation.start ) / animation.fps; - - } - - }; - - MorphBlendMesh.prototype.setAnimationDuration = function ( name, duration ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.duration = duration; - animation.fps = ( animation.end - animation.start ) / animation.duration; - - } - - }; - - MorphBlendMesh.prototype.setAnimationWeight = function ( name, weight ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.weight = weight; - - } - - }; - - MorphBlendMesh.prototype.setAnimationTime = function ( name, time ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = time; - - } - - }; - - MorphBlendMesh.prototype.getAnimationTime = function ( name ) { - - var time = 0; - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - time = animation.time; - - } - - return time; - - }; - - MorphBlendMesh.prototype.getAnimationDuration = function ( name ) { - - var duration = - 1; - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - duration = animation.duration; - - } - - return duration; - - }; - - MorphBlendMesh.prototype.playAnimation = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = 0; - animation.active = true; - - } else { - - console.warn( "THREE.MorphBlendMesh: animation[" + name + "] undefined in .playAnimation()" ); - - } - - }; - - MorphBlendMesh.prototype.stopAnimation = function ( name ) { - - var animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.active = false; - - } - - }; - - MorphBlendMesh.prototype.update = function ( delta ) { - - for ( var i = 0, il = this.animationsList.length; i < il; i ++ ) { - - var animation = this.animationsList[ i ]; - - if ( ! animation.active ) continue; - - var frameTime = animation.duration / animation.length; - - animation.time += animation.direction * delta; - - if ( animation.mirroredLoop ) { - - if ( animation.time > animation.duration || animation.time < 0 ) { - - animation.direction *= - 1; - - if ( animation.time > animation.duration ) { - - animation.time = animation.duration; - animation.directionBackwards = true; - - } - - if ( animation.time < 0 ) { - - animation.time = 0; - animation.directionBackwards = false; - - } - - } - - } else { - - animation.time = animation.time % animation.duration; - - if ( animation.time < 0 ) animation.time += animation.duration; - - } - - var keyframe = animation.start + exports.Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 ); - var weight = animation.weight; - - if ( keyframe !== animation.currentFrame ) { - - this.morphTargetInfluences[ animation.lastFrame ] = 0; - this.morphTargetInfluences[ animation.currentFrame ] = 1 * weight; - - this.morphTargetInfluences[ keyframe ] = 0; - - animation.lastFrame = animation.currentFrame; - animation.currentFrame = keyframe; - - } - - var mix = ( animation.time % frameTime ) / frameTime; - - if ( animation.directionBackwards ) mix = 1 - mix; - - if ( animation.currentFrame !== animation.lastFrame ) { - - this.morphTargetInfluences[ animation.currentFrame ] = mix * weight; - this.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight; - - } else { - - this.morphTargetInfluences[ animation.currentFrame ] = weight; - - } - - } - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - function ImmediateRenderObject( material ) { - - Object3D.call( this ); - - this.material = material; - this.render = function ( renderCallback ) {}; - - } - - ImmediateRenderObject.prototype = Object.create( Object3D.prototype ); - ImmediateRenderObject.prototype.constructor = ImmediateRenderObject; - - ImmediateRenderObject.prototype.isImmediateRenderObject = true; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - */ - - function VertexNormalsHelper( object, size, hex, linewidth ) { - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0xff0000; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - // - - var nNormals = 0; - - var objGeometry = this.object.geometry; - - if ( (objGeometry && objGeometry.isGeometry) ) { - - nNormals = objGeometry.faces.length * 3; - - } else if ( (objGeometry && objGeometry.isBufferGeometry) ) { - - nNormals = objGeometry.attributes.normal.count; - - } - - // - - var geometry = new BufferGeometry(); - - var positions = new Float32Attribute( nNormals * 2 * 3, 3 ); - - geometry.addAttribute( 'position', positions ); - - LineSegments.call( this, geometry, new LineBasicMaterial( { color: color, linewidth: width } ) ); - - // - - this.matrixAutoUpdate = false; - - this.update(); - - } - - VertexNormalsHelper.prototype = Object.create( LineSegments.prototype ); - VertexNormalsHelper.prototype.constructor = VertexNormalsHelper; - - VertexNormalsHelper.prototype.update = ( function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - var normalMatrix = new Matrix3(); - - return function update() { - - var keys = [ 'a', 'b', 'c' ]; - - this.object.updateMatrixWorld( true ); - - normalMatrix.getNormalMatrix( this.object.matrixWorld ); - - var matrixWorld = this.object.matrixWorld; - - var position = this.geometry.attributes.position; - - // - - var objGeometry = this.object.geometry; - - if ( (objGeometry && objGeometry.isGeometry) ) { - - var vertices = objGeometry.vertices; - - var faces = objGeometry.faces; - - var idx = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { - - var vertex = vertices[ face[ keys[ j ] ] ]; - - var normal = face.vertexNormals[ j ]; - - v1.copy( vertex ).applyMatrix4( matrixWorld ); - - v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); - - position.setXYZ( idx, v1.x, v1.y, v1.z ); - - idx = idx + 1; - - position.setXYZ( idx, v2.x, v2.y, v2.z ); - - idx = idx + 1; - - } - - } - - } else if ( (objGeometry && objGeometry.isBufferGeometry) ) { - - var objPos = objGeometry.attributes.position; - - var objNorm = objGeometry.attributes.normal; - - var idx = 0; - - // for simplicity, ignore index and drawcalls, and render every normal - - for ( var j = 0, jl = objPos.count; j < jl; j ++ ) { - - v1.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld ); - - v2.set( objNorm.getX( j ), objNorm.getY( j ), objNorm.getZ( j ) ); - - v2.applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); - - position.setXYZ( idx, v1.x, v1.y, v1.z ); - - idx = idx + 1; - - position.setXYZ( idx, v2.x, v2.y, v2.z ); - - idx = idx + 1; - - } - - } - - position.needsUpdate = true; - - return this; - - }; - - }() ); - - /** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - */ - - function SpotLightHelper( light ) { - - Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - var geometry = new BufferGeometry(); - - var positions = [ - 0, 0, 0, 0, 0, 1, - 0, 0, 0, 1, 0, 1, - 0, 0, 0, - 1, 0, 1, - 0, 0, 0, 0, 1, 1, - 0, 0, 0, 0, - 1, 1 - ]; - - for ( var i = 0, j = 1, l = 32; i < l; i ++, j ++ ) { - - var p1 = ( i / l ) * Math.PI * 2; - var p2 = ( j / l ) * Math.PI * 2; - - positions.push( - Math.cos( p1 ), Math.sin( p1 ), 1, - Math.cos( p2 ), Math.sin( p2 ), 1 - ); - - } - - geometry.addAttribute( 'position', new Float32Attribute( positions, 3 ) ); - - var material = new LineBasicMaterial( { fog: false } ); - - this.cone = new LineSegments( geometry, material ); - this.add( this.cone ); - - this.update(); - - } - - SpotLightHelper.prototype = Object.create( Object3D.prototype ); - SpotLightHelper.prototype.constructor = SpotLightHelper; - - SpotLightHelper.prototype.dispose = function () { - - this.cone.geometry.dispose(); - this.cone.material.dispose(); - - }; - - SpotLightHelper.prototype.update = function () { - - var vector = new Vector3(); - var vector2 = new Vector3(); - - return function update() { - - var coneLength = this.light.distance ? this.light.distance : 1000; - var coneWidth = coneLength * Math.tan( this.light.angle ); - - this.cone.scale.set( coneWidth, coneWidth, coneLength ); - - vector.setFromMatrixPosition( this.light.matrixWorld ); - vector2.setFromMatrixPosition( this.light.target.matrixWorld ); - - this.cone.lookAt( vector2.sub( vector ) ); - - this.cone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - }; - - }(); - - /** - * @author Sean Griffin / http://twitter.com/sgrif - * @author Michael Guerrero / http://realitymeltdown.com - * @author mrdoob / http://mrdoob.com/ - * @author ikerr / http://verold.com - */ - - function SkeletonHelper( object ) { - - this.bones = this.getBoneList( object ); - - var geometry = new Geometry(); - - for ( var i = 0; i < this.bones.length; i ++ ) { - - var bone = this.bones[ i ]; - - if ( (bone.parent && bone.parent.isBone) ) { - - geometry.vertices.push( new Vector3() ); - geometry.vertices.push( new Vector3() ); - geometry.colors.push( new Color( 0, 0, 1 ) ); - geometry.colors.push( new Color( 0, 1, 0 ) ); - - } - - } - - geometry.dynamic = true; - - var material = new LineBasicMaterial( { vertexColors: VertexColors, depthTest: false, depthWrite: false, transparent: true } ); - - LineSegments.call( this, geometry, material ); - - this.root = object; - - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - - this.update(); - - } - - - SkeletonHelper.prototype = Object.create( LineSegments.prototype ); - SkeletonHelper.prototype.constructor = SkeletonHelper; - - SkeletonHelper.prototype.getBoneList = function( object ) { - - var boneList = []; - - if ( (object && object.isBone) ) { - - boneList.push( object ); - - } - - for ( var i = 0; i < object.children.length; i ++ ) { - - boneList.push.apply( boneList, this.getBoneList( object.children[ i ] ) ); - - } - - return boneList; - - }; - - SkeletonHelper.prototype.update = function () { - - var geometry = this.geometry; - - var matrixWorldInv = new Matrix4().getInverse( this.root.matrixWorld ); - - var boneMatrix = new Matrix4(); - - var j = 0; - - for ( var i = 0; i < this.bones.length; i ++ ) { - - var bone = this.bones[ i ]; - - if ( (bone.parent && bone.parent.isBone) ) { - - boneMatrix.multiplyMatrices( matrixWorldInv, bone.matrixWorld ); - geometry.vertices[ j ].setFromMatrixPosition( boneMatrix ); - - boneMatrix.multiplyMatrices( matrixWorldInv, bone.parent.matrixWorld ); - geometry.vertices[ j + 1 ].setFromMatrixPosition( boneMatrix ); - - j += 2; - - } - - } - - geometry.verticesNeedUpdate = true; - - geometry.computeBoundingSphere(); - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - - function PointLightHelper( light, sphereSize ) { - - this.light = light; - this.light.updateMatrixWorld(); - - var geometry = new SphereBufferGeometry( sphereSize, 4, 2 ); - var material = new MeshBasicMaterial( { wireframe: true, fog: false } ); - material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - Mesh.call( this, geometry, material ); - - this.matrix = this.light.matrixWorld; - this.matrixAutoUpdate = false; - - /* - var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 ); - var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } ); - - this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); - this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial ); - - var d = light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.scale.set( d, d, d ); - - } - - this.add( this.lightDistance ); - */ - - } - - PointLightHelper.prototype = Object.create( Mesh.prototype ); - PointLightHelper.prototype.constructor = PointLightHelper; - - PointLightHelper.prototype.dispose = function () { - - this.geometry.dispose(); - this.material.dispose(); - - }; - - PointLightHelper.prototype.update = function () { - - this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - /* - var d = this.light.distance; - - if ( d === 0.0 ) { - - this.lightDistance.visible = false; - - } else { - - this.lightDistance.visible = true; - this.lightDistance.scale.set( d, d, d ); - - } - */ - - }; - - /** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - */ - - function HemisphereLightHelper( light, sphereSize ) { - - Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - this.colors = [ new Color(), new Color() ]; - - var geometry = new SphereGeometry( sphereSize, 4, 2 ); - geometry.rotateX( - Math.PI / 2 ); - - for ( var i = 0, il = 8; i < il; i ++ ) { - - geometry.faces[ i ].color = this.colors[ i < 4 ? 0 : 1 ]; - - } - - var material = new MeshBasicMaterial( { vertexColors: FaceColors, wireframe: true } ); - - this.lightSphere = new Mesh( geometry, material ); - this.add( this.lightSphere ); - - this.update(); - - } - - HemisphereLightHelper.prototype = Object.create( Object3D.prototype ); - HemisphereLightHelper.prototype.constructor = HemisphereLightHelper; - - HemisphereLightHelper.prototype.dispose = function () { - - this.lightSphere.geometry.dispose(); - this.lightSphere.material.dispose(); - - }; - - HemisphereLightHelper.prototype.update = function () { - - var vector = new Vector3(); - - return function update() { - - this.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity ); - this.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity ); - - this.lightSphere.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() ); - this.lightSphere.geometry.colorsNeedUpdate = true; - - }; - - }(); - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function GridHelper( size, divisions, color1, color2 ) { - - divisions = divisions || 1; - color1 = new Color( color1 !== undefined ? color1 : 0x444444 ); - color2 = new Color( color2 !== undefined ? color2 : 0x888888 ); - - var center = divisions / 2; - var step = ( size * 2 ) / divisions; - var vertices = [], colors = []; - - for ( var i = 0, j = 0, k = - size; i <= divisions; i ++, k += step ) { - - vertices.push( - size, 0, k, size, 0, k ); - vertices.push( k, 0, - size, k, 0, size ); - - var color = i === center ? color1 : color2; - - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - color.toArray( colors, j ); j += 3; - - } - - var geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new Float32Attribute( vertices, 3 ) ); - geometry.addAttribute( 'color', new Float32Attribute( colors, 3 ) ); - - var material = new LineBasicMaterial( { vertexColors: VertexColors } ); - - LineSegments.call( this, geometry, material ); - - } - - GridHelper.prototype = Object.create( LineSegments.prototype ); - GridHelper.prototype.constructor = GridHelper; - - GridHelper.prototype.setColors = function () { - - console.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' ); - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - */ - - function FaceNormalsHelper( object, size, hex, linewidth ) { - - // FaceNormalsHelper only supports THREE.Geometry - - this.object = object; - - this.size = ( size !== undefined ) ? size : 1; - - var color = ( hex !== undefined ) ? hex : 0xffff00; - - var width = ( linewidth !== undefined ) ? linewidth : 1; - - // - - var nNormals = 0; - - var objGeometry = this.object.geometry; - - if ( (objGeometry && objGeometry.isGeometry) ) { - - nNormals = objGeometry.faces.length; - - } else { - - console.warn( 'THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.' ); - - } - - // - - var geometry = new BufferGeometry(); - - var positions = new Float32Attribute( nNormals * 2 * 3, 3 ); - - geometry.addAttribute( 'position', positions ); - - LineSegments.call( this, geometry, new LineBasicMaterial( { color: color, linewidth: width } ) ); - - // - - this.matrixAutoUpdate = false; - this.update(); - - } - - FaceNormalsHelper.prototype = Object.create( LineSegments.prototype ); - FaceNormalsHelper.prototype.constructor = FaceNormalsHelper; - - FaceNormalsHelper.prototype.update = ( function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - var normalMatrix = new Matrix3(); - - return function update() { - - this.object.updateMatrixWorld( true ); - - normalMatrix.getNormalMatrix( this.object.matrixWorld ); - - var matrixWorld = this.object.matrixWorld; - - var position = this.geometry.attributes.position; - - // - - var objGeometry = this.object.geometry; - - var vertices = objGeometry.vertices; - - var faces = objGeometry.faces; - - var idx = 0; - - for ( var i = 0, l = faces.length; i < l; i ++ ) { - - var face = faces[ i ]; - - var normal = face.normal; - - v1.copy( vertices[ face.a ] ) - .add( vertices[ face.b ] ) - .add( vertices[ face.c ] ) - .divideScalar( 3 ) - .applyMatrix4( matrixWorld ); - - v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); - - position.setXYZ( idx, v1.x, v1.y, v1.z ); - - idx = idx + 1; - - position.setXYZ( idx, v2.x, v2.y, v2.z ); - - idx = idx + 1; - - } - - position.needsUpdate = true; - - return this; - - }; - - }() ); - - /** - * @author alteredq / http://alteredqualia.com/ - * @author mrdoob / http://mrdoob.com/ - * @author WestLangley / http://github.com/WestLangley - */ - - function DirectionalLightHelper( light, size ) { - - Object3D.call( this ); - - this.light = light; - this.light.updateMatrixWorld(); - - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - - if ( size === undefined ) size = 1; - - var geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new Float32Attribute( [ - - size, size, 0, - size, size, 0, - size, - size, 0, - - size, - size, 0, - - size, size, 0 - ], 3 ) ); - - var material = new LineBasicMaterial( { fog: false } ); - - this.add( new Line( geometry, material ) ); - - geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new Float32Attribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) ); - - this.add( new Line( geometry, material )); - - this.update(); - - } - - DirectionalLightHelper.prototype = Object.create( Object3D.prototype ); - DirectionalLightHelper.prototype.constructor = DirectionalLightHelper; - - DirectionalLightHelper.prototype.dispose = function () { - - var lightPlane = this.children[ 0 ]; - var targetLine = this.children[ 1 ]; - - lightPlane.geometry.dispose(); - lightPlane.material.dispose(); - targetLine.geometry.dispose(); - targetLine.material.dispose(); - - }; - - DirectionalLightHelper.prototype.update = function () { - - var v1 = new Vector3(); - var v2 = new Vector3(); - var v3 = new Vector3(); - - return function update() { - - v1.setFromMatrixPosition( this.light.matrixWorld ); - v2.setFromMatrixPosition( this.light.target.matrixWorld ); - v3.subVectors( v2, v1 ); - - var lightPlane = this.children[ 0 ]; - var targetLine = this.children[ 1 ]; - - lightPlane.lookAt( v3 ); - lightPlane.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - targetLine.lookAt( v3 ); - targetLine.scale.z = v3.length(); - - }; - - }(); - - /** - * @author alteredq / http://alteredqualia.com/ - * - * - shows frustum, line of sight and up of the camera - * - suitable for fast updates - * - based on frustum visualization in lightgl.js shadowmap example - * http://evanw.github.com/lightgl.js/tests/shadowmap.html - */ - - function CameraHelper( camera ) { - - var geometry = new Geometry(); - var material = new LineBasicMaterial( { color: 0xffffff, vertexColors: FaceColors } ); - - var pointMap = {}; - - // colors - - var hexFrustum = 0xffaa00; - var hexCone = 0xff0000; - var hexUp = 0x00aaff; - var hexTarget = 0xffffff; - var hexCross = 0x333333; - - // near - - addLine( "n1", "n2", hexFrustum ); - addLine( "n2", "n4", hexFrustum ); - addLine( "n4", "n3", hexFrustum ); - addLine( "n3", "n1", hexFrustum ); - - // far - - addLine( "f1", "f2", hexFrustum ); - addLine( "f2", "f4", hexFrustum ); - addLine( "f4", "f3", hexFrustum ); - addLine( "f3", "f1", hexFrustum ); - - // sides - - addLine( "n1", "f1", hexFrustum ); - addLine( "n2", "f2", hexFrustum ); - addLine( "n3", "f3", hexFrustum ); - addLine( "n4", "f4", hexFrustum ); - - // cone - - addLine( "p", "n1", hexCone ); - addLine( "p", "n2", hexCone ); - addLine( "p", "n3", hexCone ); - addLine( "p", "n4", hexCone ); - - // up - - addLine( "u1", "u2", hexUp ); - addLine( "u2", "u3", hexUp ); - addLine( "u3", "u1", hexUp ); - - // target - - addLine( "c", "t", hexTarget ); - addLine( "p", "c", hexCross ); - - // cross - - addLine( "cn1", "cn2", hexCross ); - addLine( "cn3", "cn4", hexCross ); - - addLine( "cf1", "cf2", hexCross ); - addLine( "cf3", "cf4", hexCross ); - - function addLine( a, b, hex ) { - - addPoint( a, hex ); - addPoint( b, hex ); - - } - - function addPoint( id, hex ) { - - geometry.vertices.push( new Vector3() ); - geometry.colors.push( new Color( hex ) ); - - if ( pointMap[ id ] === undefined ) { - - pointMap[ id ] = []; - - } - - pointMap[ id ].push( geometry.vertices.length - 1 ); - - } - - LineSegments.call( this, geometry, material ); - - this.camera = camera; - if( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix(); - - this.matrix = camera.matrixWorld; - this.matrixAutoUpdate = false; - - this.pointMap = pointMap; - - this.update(); - - } - - CameraHelper.prototype = Object.create( LineSegments.prototype ); - CameraHelper.prototype.constructor = CameraHelper; - - CameraHelper.prototype.update = function () { - - var geometry, pointMap; - - var vector = new Vector3(); - var camera = new Camera(); - - function setPoint( point, x, y, z ) { - - vector.set( x, y, z ).unproject( camera ); - - var points = pointMap[ point ]; - - if ( points !== undefined ) { - - for ( var i = 0, il = points.length; i < il; i ++ ) { - - geometry.vertices[ points[ i ] ].copy( vector ); - - } - - } - - } - - return function update() { - - geometry = this.geometry; - pointMap = this.pointMap; - - var w = 1, h = 1; - - // we need just camera projection matrix - // world matrix must be identity - - camera.projectionMatrix.copy( this.camera.projectionMatrix ); - - // center / target - - setPoint( "c", 0, 0, - 1 ); - setPoint( "t", 0, 0, 1 ); - - // near - - setPoint( "n1", - w, - h, - 1 ); - setPoint( "n2", w, - h, - 1 ); - setPoint( "n3", - w, h, - 1 ); - setPoint( "n4", w, h, - 1 ); - - // far - - setPoint( "f1", - w, - h, 1 ); - setPoint( "f2", w, - h, 1 ); - setPoint( "f3", - w, h, 1 ); - setPoint( "f4", w, h, 1 ); - - // up - - setPoint( "u1", w * 0.7, h * 1.1, - 1 ); - setPoint( "u2", - w * 0.7, h * 1.1, - 1 ); - setPoint( "u3", 0, h * 2, - 1 ); - - // cross - - setPoint( "cf1", - w, 0, 1 ); - setPoint( "cf2", w, 0, 1 ); - setPoint( "cf3", 0, - h, 1 ); - setPoint( "cf4", 0, h, 1 ); - - setPoint( "cn1", - w, 0, - 1 ); - setPoint( "cn2", w, 0, - 1 ); - setPoint( "cn3", 0, - h, - 1 ); - setPoint( "cn4", 0, h, - 1 ); - - geometry.verticesNeedUpdate = true; - - }; - - }(); - - /** - * @author WestLangley / http://github.com/WestLangley - */ - - // a helper to show the world-axis-aligned bounding box for an object - - function BoundingBoxHelper( object, hex ) { - - var color = ( hex !== undefined ) ? hex : 0x888888; - - this.object = object; - - this.box = new Box3(); - - Mesh.call( this, new BoxGeometry( 1, 1, 1 ), new MeshBasicMaterial( { color: color, wireframe: true } ) ); - - } - - BoundingBoxHelper.prototype = Object.create( Mesh.prototype ); - BoundingBoxHelper.prototype.constructor = BoundingBoxHelper; - - BoundingBoxHelper.prototype.update = function () { - - this.box.setFromObject( this.object ); - - this.box.size( this.scale ); - - this.box.getCenter( this.position ); - - }; - - /** - * @author mrdoob / http://mrdoob.com/ - */ - - function BoxHelper( object, color ) { - - if ( color === undefined ) color = 0xffff00; - - var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] ); - var positions = new Float32Array( 8 * 3 ); - - var geometry = new BufferGeometry(); - geometry.setIndex( new BufferAttribute( indices, 1 ) ); - geometry.addAttribute( 'position', new BufferAttribute( positions, 3 ) ); - - LineSegments.call( this, geometry, new LineBasicMaterial( { color: color } ) ); - - if ( object !== undefined ) { - - this.update( object ); - - } - - } - - BoxHelper.prototype = Object.create( LineSegments.prototype ); - BoxHelper.prototype.constructor = BoxHelper; - - BoxHelper.prototype.update = ( function () { - - var box = new Box3(); - - return function update( object ) { - - if ( (object && object.isBox3) ) { - - box.copy( object ); - - } else { - - box.setFromObject( object ); - - } - - if ( box.isEmpty() ) return; - - var min = box.min; - var max = box.max; - - /* - 5____4 - 1/___0/| - | 6__|_7 - 2/___3/ - - 0: max.x, max.y, max.z - 1: min.x, max.y, max.z - 2: min.x, min.y, max.z - 3: max.x, min.y, max.z - 4: max.x, max.y, min.z - 5: min.x, max.y, min.z - 6: min.x, min.y, min.z - 7: max.x, min.y, min.z - */ - - var position = this.geometry.attributes.position; - var array = position.array; - - array[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z; - array[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z; - array[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z; - array[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z; - array[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z; - array[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z; - array[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z; - array[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z; - - position.needsUpdate = true; - - this.geometry.computeBoundingSphere(); - - }; - - } )(); - - var lineGeometry = new BufferGeometry(); - lineGeometry.addAttribute( 'position', new Float32Attribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) ); - - var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 ); - coneGeometry.translate( 0, - 0.5, 0 ); - - function ArrowHelper( dir, origin, length, color, headLength, headWidth ) { - - // dir is assumed to be normalized - - Object3D.call( this ); - - if ( color === undefined ) color = 0xffff00; - if ( length === undefined ) length = 1; - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; - - this.position.copy( origin ); - - this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) ); - this.line.matrixAutoUpdate = false; - this.add( this.line ); - - this.cone = new Mesh( coneGeometry, new MeshBasicMaterial( { color: color } ) ); - this.cone.matrixAutoUpdate = false; - this.add( this.cone ); - - this.setDirection( dir ); - this.setLength( length, headLength, headWidth ); - - } - - ArrowHelper.prototype = Object.create( Object3D.prototype ); - ArrowHelper.prototype.constructor = ArrowHelper; - - ArrowHelper.prototype.setDirection = ( function () { - - var axis = new Vector3(); - var radians; - - return function setDirection( dir ) { - - // dir is assumed to be normalized - - if ( dir.y > 0.99999 ) { - - this.quaternion.set( 0, 0, 0, 1 ); - - } else if ( dir.y < - 0.99999 ) { - - this.quaternion.set( 1, 0, 0, 0 ); - - } else { - - axis.set( dir.z, 0, - dir.x ).normalize(); - - radians = Math.acos( dir.y ); - - this.quaternion.setFromAxisAngle( axis, radians ); - - } - - }; - - }() ); - - ArrowHelper.prototype.setLength = function ( length, headLength, headWidth ) { - - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; - - this.line.scale.set( 1, Math.max( 0, length - headLength ), 1 ); - this.line.updateMatrix(); - - this.cone.scale.set( headWidth, headLength, headWidth ); - this.cone.position.y = length; - this.cone.updateMatrix(); - - }; - - ArrowHelper.prototype.setColor = function ( color ) { - - this.line.material.color.copy( color ); - this.cone.material.color.copy( color ); - - }; - - /** - * @author sroucheray / http://sroucheray.org/ - * @author mrdoob / http://mrdoob.com/ - */ - - function AxisHelper( size ) { - - size = size || 1; - - var vertices = new Float32Array( [ - 0, 0, 0, size, 0, 0, - 0, 0, 0, 0, size, 0, - 0, 0, 0, 0, 0, size - ] ); - - var colors = new Float32Array( [ - 1, 0, 0, 1, 0.6, 0, - 0, 1, 0, 0.6, 1, 0, - 0, 0, 1, 0, 0.6, 1 - ] ); - - var geometry = new BufferGeometry(); - geometry.addAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - geometry.addAttribute( 'color', new BufferAttribute( colors, 3 ) ); - - var material = new LineBasicMaterial( { vertexColors: VertexColors } ); - - LineSegments.call( this, geometry, material ); - - } - - AxisHelper.prototype = Object.create( LineSegments.prototype ); - AxisHelper.prototype.constructor = AxisHelper; - - /** - * @author zz85 https://github.com/zz85 - * - * Centripetal CatmullRom Curve - which is useful for avoiding - * cusps and self-intersections in non-uniform catmull rom curves. - * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf - * - * curve.type accepts centripetal(default), chordal and catmullrom - * curve.tension is used for catmullrom which defaults to 0.5 - */ - - exports.CatmullRomCurve3 = ( function() { - - var - tmp = new Vector3(), - px = new CubicPoly(), - py = new CubicPoly(), - pz = new CubicPoly(); - - /* - Based on an optimized c++ solution in - - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/ - - http://ideone.com/NoEbVM - - This CubicPoly class could be used for reusing some variables and calculations, - but for three.js curve use, it could be possible inlined and flatten into a single function call - which can be placed in CurveUtils. - */ - - function CubicPoly() { - - } - - /* - * Compute coefficients for a cubic polynomial - * p(s) = c0 + c1*s + c2*s^2 + c3*s^3 - * such that - * p(0) = x0, p(1) = x1 - * and - * p'(0) = t0, p'(1) = t1. - */ - CubicPoly.prototype.init = function( x0, x1, t0, t1 ) { - - this.c0 = x0; - this.c1 = t0; - this.c2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1; - this.c3 = 2 * x0 - 2 * x1 + t0 + t1; - - }; - - CubicPoly.prototype.initNonuniformCatmullRom = function( x0, x1, x2, x3, dt0, dt1, dt2 ) { - - // compute tangents when parameterized in [t1,t2] - var t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1; - var t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2; - - // rescale tangents for parametrization in [0,1] - t1 *= dt1; - t2 *= dt1; - - // initCubicPoly - this.init( x1, x2, t1, t2 ); - - }; - - // standard Catmull-Rom spline: interpolate between x1 and x2 with previous/following points x1/x4 - CubicPoly.prototype.initCatmullRom = function( x0, x1, x2, x3, tension ) { - - this.init( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) ); - - }; - - CubicPoly.prototype.calc = function( t ) { - - var t2 = t * t; - var t3 = t2 * t; - return this.c0 + this.c1 * t + this.c2 * t2 + this.c3 * t3; - - }; - - // Subclass Three.js curve - return Curve.create( - - function ( p /* array of Vector3 */ ) { - - this.points = p || []; - this.closed = false; - - }, - - function ( t ) { - - var points = this.points, - point, intPoint, weight, l; - - l = points.length; - - if ( l < 2 ) console.log( 'duh, you need at least 2 points' ); - - point = ( l - ( this.closed ? 0 : 1 ) ) * t; - intPoint = Math.floor( point ); - weight = point - intPoint; - - if ( this.closed ) { - - intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length; - - } else if ( weight === 0 && intPoint === l - 1 ) { - - intPoint = l - 2; - weight = 1; - - } - - var p0, p1, p2, p3; // 4 points - - if ( this.closed || intPoint > 0 ) { - - p0 = points[ ( intPoint - 1 ) % l ]; - - } else { - - // extrapolate first point - tmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] ); - p0 = tmp; - - } - - p1 = points[ intPoint % l ]; - p2 = points[ ( intPoint + 1 ) % l ]; - - if ( this.closed || intPoint + 2 < l ) { - - p3 = points[ ( intPoint + 2 ) % l ]; - - } else { - - // extrapolate last point - tmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] ); - p3 = tmp; - - } - - if ( this.type === undefined || this.type === 'centripetal' || this.type === 'chordal' ) { - - // init Centripetal / Chordal Catmull-Rom - var pow = this.type === 'chordal' ? 0.5 : 0.25; - var dt0 = Math.pow( p0.distanceToSquared( p1 ), pow ); - var dt1 = Math.pow( p1.distanceToSquared( p2 ), pow ); - var dt2 = Math.pow( p2.distanceToSquared( p3 ), pow ); - - // safety check for repeated points - if ( dt1 < 1e-4 ) dt1 = 1.0; - if ( dt0 < 1e-4 ) dt0 = dt1; - if ( dt2 < 1e-4 ) dt2 = dt1; - - px.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 ); - py.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 ); - pz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 ); - - } else if ( this.type === 'catmullrom' ) { - - var tension = this.tension !== undefined ? this.tension : 0.5; - px.initCatmullRom( p0.x, p1.x, p2.x, p3.x, tension ); - py.initCatmullRom( p0.y, p1.y, p2.y, p3.y, tension ); - pz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, tension ); - - } - - var v = new Vector3( - px.calc( weight ), - py.calc( weight ), - pz.calc( weight ) - ); - - return v; - - } - - ); - - } )(); - - /************************************************************** - * Closed Spline 3D curve - **************************************************************/ - - - function ClosedSplineCurve3( points ) { - - console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3.' ); - - exports.CatmullRomCurve3.call( this, points ); - this.type = 'catmullrom'; - this.closed = true; - - } - - ClosedSplineCurve3.prototype = Object.create( exports.CatmullRomCurve3.prototype ); - - /************************************************************** - * Spline 3D curve - **************************************************************/ - - - var SplineCurve3 = Curve.create( - - function ( points /* array of Vector3 */ ) { - - console.warn( 'THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3' ); - this.points = ( points === undefined ) ? [] : points; - - }, - - function ( t ) { - - var points = this.points; - var point = ( points.length - 1 ) * t; - - var intPoint = Math.floor( point ); - var weight = point - intPoint; - - var point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ]; - var point1 = points[ intPoint ]; - var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ]; - var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ]; - - var interpolate = exports.CurveUtils.interpolate; - - return new Vector3( - interpolate( point0.x, point1.x, point2.x, point3.x, weight ), - interpolate( point0.y, point1.y, point2.y, point3.y, weight ), - interpolate( point0.z, point1.z, point2.z, point3.z, weight ) - ); - - } - - ); - - /************************************************************** - * Cubic Bezier 3D curve - **************************************************************/ - - exports.CubicBezierCurve3 = Curve.create( - - function ( v0, v1, v2, v3 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - }, - - function ( t ) { - - var b3 = exports.ShapeUtils.b3; - - return new Vector3( - b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ), - b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ), - b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z ) - ); - - } - - ); - - /************************************************************** - * Quadratic Bezier 3D curve - **************************************************************/ - - exports.QuadraticBezierCurve3 = Curve.create( - - function ( v0, v1, v2 ) { - - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - var b2 = exports.ShapeUtils.b2; - - return new Vector3( - b2( t, this.v0.x, this.v1.x, this.v2.x ), - b2( t, this.v0.y, this.v1.y, this.v2.y ), - b2( t, this.v0.z, this.v1.z, this.v2.z ) - ); - - } - - ); - - /************************************************************** - * Line3D - **************************************************************/ - - exports.LineCurve3 = Curve.create( - - function ( v1, v2 ) { - - this.v1 = v1; - this.v2 = v2; - - }, - - function ( t ) { - - if ( t === 1 ) { - - return this.v2.clone(); - - } - - var vector = new Vector3(); - - vector.subVectors( this.v2, this.v1 ); // diff - vector.multiplyScalar( t ); - vector.add( this.v1 ); - - return vector; - - } - - ); - - /************************************************************** - * Arc curve - **************************************************************/ - - function ArcCurve( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { - - EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); - - } - - ArcCurve.prototype = Object.create( EllipseCurve.prototype ); - ArcCurve.prototype.constructor = ArcCurve; - - /** - * @author alteredq / http://alteredqualia.com/ - */ - - exports.SceneUtils = { - - createMultiMaterialObject: function ( geometry, materials ) { - - var group = new Group(); - - for ( var i = 0, l = materials.length; i < l; i ++ ) { - - group.add( new Mesh( geometry, materials[ i ] ) ); - - } - - return group; - - }, - - detach: function ( child, parent, scene ) { - - child.applyMatrix( parent.matrixWorld ); - parent.remove( child ); - scene.add( child ); - - }, - - attach: function ( child, scene, parent ) { - - var matrixWorldInverse = new Matrix4(); - matrixWorldInverse.getInverse( parent.matrixWorld ); - child.applyMatrix( matrixWorldInverse ); - - scene.remove( child ); - parent.add( child ); - - } - - }; - - function Face4 ( a, b, c, d, normal, color, materialIndex ) { - console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' ); - return new Face3( a, b, c, normal, color, materialIndex ); - } - - var LineStrip = 0; - - var LinePieces = 1; - - function PointCloud ( geometry, material ) { - console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' ); - return new Points( geometry, material ); - } - - function ParticleSystem ( geometry, material ) { - console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' ); - return new Points( geometry, material ); - } - - function PointCloudMaterial ( parameters ) { - console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - } - - function ParticleBasicMaterial ( parameters ) { - console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - } - - function ParticleSystemMaterial ( parameters ) { - console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' ); - return new PointsMaterial( parameters ); - } - - function Vertex ( x, y, z ) { - console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' ); - return new Vector3( x, y, z ); - } - - // - - function EdgesHelper( object, hex ) { - console.warn( 'THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.' ); - return new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) ); - } - - function WireframeHelper( object, hex ) { - console.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' ); - return new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) ); - } - - // - - Object.assign( Box2.prototype, { - center: function ( optionalTarget ) { - console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - }, - empty: function () { - console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' ); - return this.isEmpty(); - }, - isIntersectionBox: function ( box ) { - console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - }, - size: function ( optionalTarget ) { - console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' ); - return this.getSize( optionalTarget ); - } - } ); - - Object.assign( Box3.prototype, { - center: function ( optionalTarget ) { - console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - }, - empty: function () { - console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' ); - return this.isEmpty(); - }, - isIntersectionBox: function ( box ) { - console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - }, - isIntersectionSphere: function ( sphere ) { - console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' ); - return this.intersectsSphere( sphere ); - }, - size: function ( optionalTarget ) { - console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' ); - return this.getSize( optionalTarget ); - } - } ); - - Object.assign( Line3.prototype, { - center: function ( optionalTarget ) { - console.warn( 'THREE.Line3: .center() has been renamed to .getCenter().' ); - return this.getCenter( optionalTarget ); - } - } ); - - Object.assign( Matrix3.prototype, { - multiplyVector3: function ( vector ) { - console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' ); - return vector.applyMatrix3( this ); - }, - multiplyVector3Array: function ( a ) { - console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' ); - return this.applyToVector3Array( a ); - } - } ); - - Object.assign( Matrix4.prototype, { - extractPosition: function ( m ) { - console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' ); - return this.copyPosition( m ); - }, - setRotationFromQuaternion: function ( q ) { - console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' ); - return this.makeRotationFromQuaternion( q ); - }, - multiplyVector3: function ( vector ) { - console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' ); - return vector.applyProjection( this ); - }, - multiplyVector4: function ( vector ) { - console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - }, - multiplyVector3Array: function ( a ) { - console.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' ); - return this.applyToVector3Array( a ); - }, - rotateAxis: function ( v ) { - console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' ); - v.transformDirection( this ); - }, - crossVector: function ( vector ) { - console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' ); - return vector.applyMatrix4( this ); - }, - translate: function ( v ) { - console.error( 'THREE.Matrix4: .translate() has been removed.' ); - }, - rotateX: function ( angle ) { - console.error( 'THREE.Matrix4: .rotateX() has been removed.' ); - }, - rotateY: function ( angle ) { - console.error( 'THREE.Matrix4: .rotateY() has been removed.' ); - }, - rotateZ: function ( angle ) { - console.error( 'THREE.Matrix4: .rotateZ() has been removed.' ); - }, - rotateByAxis: function ( axis, angle ) { - console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' ); - } - } ); - - Object.assign( Plane.prototype, { - isIntersectionLine: function ( line ) { - console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' ); - return this.intersectsLine( line ); - } - } ); - - Object.assign( Quaternion.prototype, { - multiplyVector3: function ( vector ) { - console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' ); - return vector.applyQuaternion( this ); - } - } ); - - Object.assign( Ray.prototype, { - isIntersectionBox: function ( box ) { - console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' ); - return this.intersectsBox( box ); - }, - isIntersectionPlane: function ( plane ) { - console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' ); - return this.intersectsPlane( plane ); - }, - isIntersectionSphere: function ( sphere ) { - console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' ); - return this.intersectsSphere( sphere ); - } - } ); - - Object.assign( Shape.prototype, { - extrude: function ( options ) { - console.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' ); - return new ExtrudeGeometry( this, options ); - }, - makeGeometry: function ( options ) { - console.warn( 'THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.' ); - return new ShapeGeometry( this, options ); - } - } ); - - Object.assign( Vector3.prototype, { - setEulerFromRotationMatrix: function () { - console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' ); - }, - setEulerFromQuaternion: function () { - console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' ); - }, - getPositionFromMatrix: function ( m ) { - console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' ); - return this.setFromMatrixPosition( m ); - }, - getScaleFromMatrix: function ( m ) { - console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' ); - return this.setFromMatrixScale( m ); - }, - getColumnFromMatrix: function ( index, matrix ) { - console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' ); - return this.setFromMatrixColumn( matrix, index ); - } - } ); - - // - - Object.assign( Object3D.prototype, { - getChildByName: function ( name ) { - console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' ); - return this.getObjectByName( name ); - }, - renderDepth: function ( value ) { - console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' ); - }, - translate: function ( distance, axis ) { - console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' ); - return this.translateOnAxis( axis, distance ); - } - } ); - - Object.defineProperties( Object3D.prototype, { - eulerOrder: { - get: function () { - console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' ); - return this.rotation.order; - }, - set: function ( value ) { - console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' ); - this.rotation.order = value; - } - }, - useQuaternion: { - get: function () { - console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' ); - }, - set: function ( value ) { - console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' ); - } - } - } ); - - Object.defineProperties( LOD.prototype, { - objects: { - get: function () { - console.warn( 'THREE.LOD: .objects has been renamed to .levels.' ); - return this.levels; - } - } - } ); - - // - - PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) { - - console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " + - "Use .setFocalLength and .filmGauge for a photographic setup." ); - - if ( filmGauge !== undefined ) this.filmGauge = filmGauge; - this.setFocalLength( focalLength ); - - }; - - // - - Object.defineProperties( Light.prototype, { - onlyShadow: { - set: function ( value ) { - console.warn( 'THREE.Light: .onlyShadow has been removed.' ); - } - }, - shadowCameraFov: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' ); - this.shadow.camera.fov = value; - } - }, - shadowCameraLeft: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' ); - this.shadow.camera.left = value; - } - }, - shadowCameraRight: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' ); - this.shadow.camera.right = value; - } - }, - shadowCameraTop: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' ); - this.shadow.camera.top = value; - } - }, - shadowCameraBottom: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' ); - this.shadow.camera.bottom = value; - } - }, - shadowCameraNear: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' ); - this.shadow.camera.near = value; - } - }, - shadowCameraFar: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' ); - this.shadow.camera.far = value; - } - }, - shadowCameraVisible: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' ); - } - }, - shadowBias: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' ); - this.shadow.bias = value; - } - }, - shadowDarkness: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowDarkness has been removed.' ); - } - }, - shadowMapWidth: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' ); - this.shadow.mapSize.width = value; - } - }, - shadowMapHeight: { - set: function ( value ) { - console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' ); - this.shadow.mapSize.height = value; - } - } - } ); - - // - - Object.defineProperties( BufferAttribute.prototype, { - length: { - get: function () { - console.warn( 'THREE.BufferAttribute: .length has been deprecated. Please use .count.' ); - return this.array.length; - } - } - } ); - - Object.assign( BufferGeometry.prototype, { - addIndex: function ( index ) { - console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' ); - this.setIndex( index ); - }, - addDrawCall: function ( start, count, indexOffset ) { - if ( indexOffset !== undefined ) { - console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' ); - } - console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' ); - this.addGroup( start, count ); - }, - clearDrawCalls: function () { - console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' ); - this.clearGroups(); - }, - computeTangents: function () { - console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' ); - }, - computeOffsets: function () { - console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' ); - } - } ); - - Object.defineProperties( BufferGeometry.prototype, { - drawcalls: { - get: function () { - console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' ); - return this.groups; - } - }, - offsets: { - get: function () { - console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' ); - return this.groups; - } - } - } ); - - // - - Object.defineProperties( Material.prototype, { - wrapAround: { - get: function () { - console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' ); - }, - set: function ( value ) { - console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' ); - } - }, - wrapRGB: { - get: function () { - console.warn( 'THREE.' + this.type + ': .wrapRGB has been removed.' ); - return new Color(); - } - } - } ); - - Object.defineProperties( MeshPhongMaterial.prototype, { - metal: { - get: function () { - console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' ); - return false; - }, - set: function ( value ) { - console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' ); - } - } - } ); - - Object.defineProperties( ShaderMaterial.prototype, { - derivatives: { - get: function () { - console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' ); - return this.extensions.derivatives; - }, - set: function ( value ) { - console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' ); - this.extensions.derivatives = value; - } - } - } ); - - // - - EventDispatcher.prototype = Object.assign( Object.create( { - - // Note: Extra base ensures these properties are not 'assign'ed. - - constructor: EventDispatcher, - - apply: function ( target ) { - - console.warn( "THREE.EventDispatcher: .apply is deprecated, " + - "just inherit or Object.assign the prototype to mix-in." ); - - Object.assign( target, this ); - - } - - } ), EventDispatcher.prototype ); - - // - - Object.assign( WebGLRenderer.prototype, { - supportsFloatTextures: function () { - console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' ); - return this.extensions.get( 'OES_texture_float' ); - }, - supportsHalfFloatTextures: function () { - console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' ); - return this.extensions.get( 'OES_texture_half_float' ); - }, - supportsStandardDerivatives: function () { - console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' ); - return this.extensions.get( 'OES_standard_derivatives' ); - }, - supportsCompressedTextureS3TC: function () { - console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' ); - return this.extensions.get( 'WEBGL_compressed_texture_s3tc' ); - }, - supportsCompressedTexturePVRTC: function () { - console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' ); - return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' ); - }, - supportsBlendMinMax: function () { - console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' ); - return this.extensions.get( 'EXT_blend_minmax' ); - }, - supportsVertexTextures: function () { - return this.capabilities.vertexTextures; - }, - supportsInstancedArrays: function () { - console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' ); - return this.extensions.get( 'ANGLE_instanced_arrays' ); - }, - enableScissorTest: function ( boolean ) { - console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' ); - this.setScissorTest( boolean ); - }, - initMaterial: function () { - console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' ); - }, - addPrePlugin: function () { - console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' ); - }, - addPostPlugin: function () { - console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' ); - }, - updateShadowMap: function () { - console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' ); - } - } ); - - Object.defineProperties( WebGLRenderer.prototype, { - shadowMapEnabled: { - get: function () { - return this.shadowMap.enabled; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' ); - this.shadowMap.enabled = value; - } - }, - shadowMapType: { - get: function () { - return this.shadowMap.type; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' ); - this.shadowMap.type = value; - } - }, - shadowMapCullFace: { - get: function () { - return this.shadowMap.cullFace; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.' ); - this.shadowMap.cullFace = value; - } - } - } ); - - Object.defineProperties( WebGLShadowMap.prototype, { - cullFace: { - get: function () { - return this.renderReverseSided ? CullFaceFront : CullFaceBack; - }, - set: function ( cullFace ) { - var value = ( cullFace !== CullFaceBack ); - console.warn( "WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to " + value + "." ); - this.renderReverseSided = value; - } - } - } ); - - // - - Object.defineProperties( WebGLRenderTarget.prototype, { - wrapS: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' ); - return this.texture.wrapS; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' ); - this.texture.wrapS = value; - } - }, - wrapT: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' ); - return this.texture.wrapT; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' ); - this.texture.wrapT = value; - } - }, - magFilter: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' ); - return this.texture.magFilter; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' ); - this.texture.magFilter = value; - } - }, - minFilter: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' ); - return this.texture.minFilter; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' ); - this.texture.minFilter = value; - } - }, - anisotropy: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' ); - return this.texture.anisotropy; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' ); - this.texture.anisotropy = value; - } - }, - offset: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' ); - return this.texture.offset; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' ); - this.texture.offset = value; - } - }, - repeat: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' ); - return this.texture.repeat; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' ); - this.texture.repeat = value; - } - }, - format: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' ); - return this.texture.format; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' ); - this.texture.format = value; - } - }, - type: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' ); - return this.texture.type; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' ); - this.texture.type = value; - } - }, - generateMipmaps: { - get: function () { - console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' ); - return this.texture.generateMipmaps; - }, - set: function ( value ) { - console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' ); - this.texture.generateMipmaps = value; - } - } - } ); - - // - - Object.assign( Audio.prototype, { - load: function ( file ) { - console.warn( 'THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.' ); - var scope = this; - var audioLoader = new AudioLoader(); - audioLoader.load( file, function ( buffer ) { - scope.setBuffer( buffer ); - } ); - return this; - } - } ); - - Object.assign( AudioAnalyser.prototype, { - getData: function ( file ) { - console.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' ); - return this.getFrequencyData(); - } - } ); - - // - - var GeometryUtils = { - - merge: function ( geometry1, geometry2, materialIndexOffset ) { - - console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' ); - - var matrix; - - if ( geometry2.isMesh ) { - - geometry2.matrixAutoUpdate && geometry2.updateMatrix(); - - matrix = geometry2.matrix; - geometry2 = geometry2.geometry; - - } - - geometry1.merge( geometry2, matrix, materialIndexOffset ); - - }, - - center: function ( geometry ) { - - console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' ); - return geometry.center(); - - } - - }; - - var ImageUtils = { - - crossOrigin: undefined, - - loadTexture: function ( url, mapping, onLoad, onError ) { - - console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' ); - - var loader = new TextureLoader(); - loader.setCrossOrigin( this.crossOrigin ); - - var texture = loader.load( url, onLoad, undefined, onError ); - - if ( mapping ) texture.mapping = mapping; - - return texture; - - }, - - loadTextureCube: function ( urls, mapping, onLoad, onError ) { - - console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' ); - - var loader = new CubeTextureLoader(); - loader.setCrossOrigin( this.crossOrigin ); - - var texture = loader.load( urls, onLoad, undefined, onError ); - - if ( mapping ) texture.mapping = mapping; - - return texture; - - }, - - loadCompressedTexture: function () { - - console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' ); - - }, - - loadCompressedTextureCube: function () { - - console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' ); - - } - - }; - - // - - function Projector () { - - console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' ); - - this.projectVector = function ( vector, camera ) { - - console.warn( 'THREE.Projector: .projectVector() is now vector.project().' ); - vector.project( camera ); - - }; - - this.unprojectVector = function ( vector, camera ) { - - console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' ); - vector.unproject( camera ); - - }; - - this.pickingRay = function ( vector, camera ) { - - console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' ); - - }; - - } - - // - - function CanvasRenderer () { - - console.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' ); - - this.domElement = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); - this.clear = function () {}; - this.render = function () {}; - this.setClearColor = function () {}; - this.setSize = function () {}; - - } - - Object.defineProperty( exports, 'AudioContext', { - get: function () { - return exports.getAudioContext(); - } - }); - - exports.WebGLRenderTargetCube = WebGLRenderTargetCube; - exports.WebGLRenderTarget = WebGLRenderTarget; - exports.WebGLRenderer = WebGLRenderer; - exports.ShaderLib = ShaderLib; - exports.UniformsLib = UniformsLib; - exports.ShaderChunk = ShaderChunk; - exports.FogExp2 = FogExp2; - exports.Fog = Fog; - exports.Scene = Scene; - exports.LensFlare = LensFlare; - exports.Sprite = Sprite; - exports.LOD = LOD; - exports.SkinnedMesh = SkinnedMesh; - exports.Skeleton = Skeleton; - exports.Bone = Bone; - exports.Mesh = Mesh; - exports.LineSegments = LineSegments; - exports.Line = Line; - exports.Points = Points; - exports.Group = Group; - exports.VideoTexture = VideoTexture; - exports.DataTexture = DataTexture; - exports.CompressedTexture = CompressedTexture; - exports.CubeTexture = CubeTexture; - exports.CanvasTexture = CanvasTexture; - exports.DepthTexture = DepthTexture; - exports.TextureIdCount = TextureIdCount; - exports.Texture = Texture; - exports.MaterialIdCount = MaterialIdCount; - exports.CompressedTextureLoader = CompressedTextureLoader; - exports.BinaryTextureLoader = BinaryTextureLoader; - exports.DataTextureLoader = DataTextureLoader; - exports.CubeTextureLoader = CubeTextureLoader; - exports.TextureLoader = TextureLoader; - exports.ObjectLoader = ObjectLoader; - exports.MaterialLoader = MaterialLoader; - exports.BufferGeometryLoader = BufferGeometryLoader; - exports.LoadingManager = LoadingManager; - exports.JSONLoader = JSONLoader; - exports.ImageLoader = ImageLoader; - exports.FontLoader = FontLoader; - exports.XHRLoader = XHRLoader; - exports.Loader = Loader; - exports.AudioLoader = AudioLoader; - exports.SpotLightShadow = SpotLightShadow; - exports.SpotLight = SpotLight; - exports.PointLight = PointLight; - exports.HemisphereLight = HemisphereLight; - exports.DirectionalLightShadow = DirectionalLightShadow; - exports.DirectionalLight = DirectionalLight; - exports.AmbientLight = AmbientLight; - exports.LightShadow = LightShadow; - exports.Light = Light; - exports.StereoCamera = StereoCamera; - exports.PerspectiveCamera = PerspectiveCamera; - exports.OrthographicCamera = OrthographicCamera; - exports.CubeCamera = CubeCamera; - exports.Camera = Camera; - exports.AudioListener = AudioListener; - exports.PositionalAudio = PositionalAudio; - exports.getAudioContext = getAudioContext; - exports.AudioAnalyser = AudioAnalyser; - exports.Audio = Audio; - exports.VectorKeyframeTrack = VectorKeyframeTrack; - exports.StringKeyframeTrack = StringKeyframeTrack; - exports.QuaternionKeyframeTrack = QuaternionKeyframeTrack; - exports.NumberKeyframeTrack = NumberKeyframeTrack; - exports.ColorKeyframeTrack = ColorKeyframeTrack; - exports.BooleanKeyframeTrack = BooleanKeyframeTrack; - exports.PropertyMixer = PropertyMixer; - exports.PropertyBinding = PropertyBinding; - exports.KeyframeTrack = KeyframeTrack; - exports.AnimationObjectGroup = AnimationObjectGroup; - exports.AnimationMixer = AnimationMixer; - exports.AnimationClip = AnimationClip; - exports.Uniform = Uniform; - exports.InstancedBufferGeometry = InstancedBufferGeometry; - exports.BufferGeometry = BufferGeometry; - exports.GeometryIdCount = GeometryIdCount; - exports.Geometry = Geometry; - exports.InterleavedBufferAttribute = InterleavedBufferAttribute; - exports.InstancedInterleavedBuffer = InstancedInterleavedBuffer; - exports.InterleavedBuffer = InterleavedBuffer; - exports.InstancedBufferAttribute = InstancedBufferAttribute; - exports.DynamicBufferAttribute = DynamicBufferAttribute; - exports.Float64Attribute = Float64Attribute; - exports.Float32Attribute = Float32Attribute; - exports.Uint32Attribute = Uint32Attribute; - exports.Int32Attribute = Int32Attribute; - exports.Uint16Attribute = Uint16Attribute; - exports.Int16Attribute = Int16Attribute; - exports.Uint8ClampedAttribute = Uint8ClampedAttribute; - exports.Uint8Attribute = Uint8Attribute; - exports.Int8Attribute = Int8Attribute; - exports.BufferAttribute = BufferAttribute; - exports.Face3 = Face3; - exports.Object3DIdCount = Object3DIdCount; - exports.Object3D = Object3D; - exports.Raycaster = Raycaster; - exports.Layers = Layers; - exports.EventDispatcher = EventDispatcher; - exports.Clock = Clock; - exports.QuaternionLinearInterpolant = QuaternionLinearInterpolant; - exports.LinearInterpolant = LinearInterpolant; - exports.DiscreteInterpolant = DiscreteInterpolant; - exports.CubicInterpolant = CubicInterpolant; - exports.Interpolant = Interpolant; - exports.Triangle = Triangle; - exports.Spline = Spline; - exports.Spherical = Spherical; - exports.Plane = Plane; - exports.Frustum = Frustum; - exports.Sphere = Sphere; - exports.Ray = Ray; - exports.Matrix4 = Matrix4; - exports.Matrix3 = Matrix3; - exports.Box3 = Box3; - exports.Box2 = Box2; - exports.Line3 = Line3; - exports.Euler = Euler; - exports.Vector4 = Vector4; - exports.Vector3 = Vector3; - exports.Vector2 = Vector2; - exports.Quaternion = Quaternion; - exports.Color = Color; - exports.MorphBlendMesh = MorphBlendMesh; - exports.ImmediateRenderObject = ImmediateRenderObject; - exports.VertexNormalsHelper = VertexNormalsHelper; - exports.SpotLightHelper = SpotLightHelper; - exports.SkeletonHelper = SkeletonHelper; - exports.PointLightHelper = PointLightHelper; - exports.HemisphereLightHelper = HemisphereLightHelper; - exports.GridHelper = GridHelper; - exports.FaceNormalsHelper = FaceNormalsHelper; - exports.DirectionalLightHelper = DirectionalLightHelper; - exports.CameraHelper = CameraHelper; - exports.BoundingBoxHelper = BoundingBoxHelper; - exports.BoxHelper = BoxHelper; - exports.ArrowHelper = ArrowHelper; - exports.AxisHelper = AxisHelper; - exports.ClosedSplineCurve3 = ClosedSplineCurve3; - exports.SplineCurve3 = SplineCurve3; - exports.ArcCurve = ArcCurve; - exports.EllipseCurve = EllipseCurve; - exports.SplineCurve = SplineCurve; - exports.CubicBezierCurve = CubicBezierCurve; - exports.QuadraticBezierCurve = QuadraticBezierCurve; - exports.LineCurve = LineCurve; - exports.Shape = Shape; - exports.ShapePath = ShapePath; - exports.Path = Path; - exports.Font = Font; - exports.CurvePath = CurvePath; - exports.Curve = Curve; - exports.WireframeGeometry = WireframeGeometry; - exports.ParametricGeometry = ParametricGeometry; - exports.TetrahedronGeometry = TetrahedronGeometry; - exports.OctahedronGeometry = OctahedronGeometry; - exports.IcosahedronGeometry = IcosahedronGeometry; - exports.DodecahedronGeometry = DodecahedronGeometry; - exports.PolyhedronGeometry = PolyhedronGeometry; - exports.TubeGeometry = TubeGeometry; - exports.TorusKnotGeometry = TorusKnotGeometry; - exports.TorusKnotBufferGeometry = TorusKnotBufferGeometry; - exports.TorusGeometry = TorusGeometry; - exports.TorusBufferGeometry = TorusBufferGeometry; - exports.TextGeometry = TextGeometry; - exports.SphereBufferGeometry = SphereBufferGeometry; - exports.SphereGeometry = SphereGeometry; - exports.RingGeometry = RingGeometry; - exports.RingBufferGeometry = RingBufferGeometry; - exports.PlaneBufferGeometry = PlaneBufferGeometry; - exports.PlaneGeometry = PlaneGeometry; - exports.LatheGeometry = LatheGeometry; - exports.LatheBufferGeometry = LatheBufferGeometry; - exports.ShapeGeometry = ShapeGeometry; - exports.ExtrudeGeometry = ExtrudeGeometry; - exports.EdgesGeometry = EdgesGeometry; - exports.ConeGeometry = ConeGeometry; - exports.ConeBufferGeometry = ConeBufferGeometry; - exports.CylinderGeometry = CylinderGeometry; - exports.CylinderBufferGeometry = CylinderBufferGeometry; - exports.CircleBufferGeometry = CircleBufferGeometry; - exports.CircleGeometry = CircleGeometry; - exports.BoxBufferGeometry = BoxBufferGeometry; - exports.BoxGeometry = BoxGeometry; - exports.ShadowMaterial = ShadowMaterial; - exports.SpriteMaterial = SpriteMaterial; - exports.RawShaderMaterial = RawShaderMaterial; - exports.ShaderMaterial = ShaderMaterial; - exports.PointsMaterial = PointsMaterial; - exports.MultiMaterial = MultiMaterial; - exports.MeshPhysicalMaterial = MeshPhysicalMaterial; - exports.MeshStandardMaterial = MeshStandardMaterial; - exports.MeshPhongMaterial = MeshPhongMaterial; - exports.MeshNormalMaterial = MeshNormalMaterial; - exports.MeshLambertMaterial = MeshLambertMaterial; - exports.MeshDepthMaterial = MeshDepthMaterial; - exports.MeshBasicMaterial = MeshBasicMaterial; - exports.LineDashedMaterial = LineDashedMaterial; - exports.LineBasicMaterial = LineBasicMaterial; - exports.Material = Material; - exports.REVISION = REVISION; - exports.MOUSE = MOUSE; - exports.CullFaceNone = CullFaceNone; - exports.CullFaceBack = CullFaceBack; - exports.CullFaceFront = CullFaceFront; - exports.CullFaceFrontBack = CullFaceFrontBack; - exports.FrontFaceDirectionCW = FrontFaceDirectionCW; - exports.FrontFaceDirectionCCW = FrontFaceDirectionCCW; - exports.BasicShadowMap = BasicShadowMap; - exports.PCFShadowMap = PCFShadowMap; - exports.PCFSoftShadowMap = PCFSoftShadowMap; - exports.FrontSide = FrontSide; - exports.BackSide = BackSide; - exports.DoubleSide = DoubleSide; - exports.FlatShading = FlatShading; - exports.SmoothShading = SmoothShading; - exports.NoColors = NoColors; - exports.FaceColors = FaceColors; - exports.VertexColors = VertexColors; - exports.NoBlending = NoBlending; - exports.NormalBlending = NormalBlending; - exports.AdditiveBlending = AdditiveBlending; - exports.SubtractiveBlending = SubtractiveBlending; - exports.MultiplyBlending = MultiplyBlending; - exports.CustomBlending = CustomBlending; - exports.BlendingMode = BlendingMode; - exports.AddEquation = AddEquation; - exports.SubtractEquation = SubtractEquation; - exports.ReverseSubtractEquation = ReverseSubtractEquation; - exports.MinEquation = MinEquation; - exports.MaxEquation = MaxEquation; - exports.ZeroFactor = ZeroFactor; - exports.OneFactor = OneFactor; - exports.SrcColorFactor = SrcColorFactor; - exports.OneMinusSrcColorFactor = OneMinusSrcColorFactor; - exports.SrcAlphaFactor = SrcAlphaFactor; - exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor; - exports.DstAlphaFactor = DstAlphaFactor; - exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor; - exports.DstColorFactor = DstColorFactor; - exports.OneMinusDstColorFactor = OneMinusDstColorFactor; - exports.SrcAlphaSaturateFactor = SrcAlphaSaturateFactor; - exports.NeverDepth = NeverDepth; - exports.AlwaysDepth = AlwaysDepth; - exports.LessDepth = LessDepth; - exports.LessEqualDepth = LessEqualDepth; - exports.EqualDepth = EqualDepth; - exports.GreaterEqualDepth = GreaterEqualDepth; - exports.GreaterDepth = GreaterDepth; - exports.NotEqualDepth = NotEqualDepth; - exports.MultiplyOperation = MultiplyOperation; - exports.MixOperation = MixOperation; - exports.AddOperation = AddOperation; - exports.NoToneMapping = NoToneMapping; - exports.LinearToneMapping = LinearToneMapping; - exports.ReinhardToneMapping = ReinhardToneMapping; - exports.Uncharted2ToneMapping = Uncharted2ToneMapping; - exports.CineonToneMapping = CineonToneMapping; - exports.UVMapping = UVMapping; - exports.CubeReflectionMapping = CubeReflectionMapping; - exports.CubeRefractionMapping = CubeRefractionMapping; - exports.EquirectangularReflectionMapping = EquirectangularReflectionMapping; - exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping; - exports.SphericalReflectionMapping = SphericalReflectionMapping; - exports.CubeUVReflectionMapping = CubeUVReflectionMapping; - exports.CubeUVRefractionMapping = CubeUVRefractionMapping; - exports.TextureMapping = TextureMapping; - exports.RepeatWrapping = RepeatWrapping; - exports.ClampToEdgeWrapping = ClampToEdgeWrapping; - exports.MirroredRepeatWrapping = MirroredRepeatWrapping; - exports.TextureWrapping = TextureWrapping; - exports.NearestFilter = NearestFilter; - exports.NearestMipMapNearestFilter = NearestMipMapNearestFilter; - exports.NearestMipMapLinearFilter = NearestMipMapLinearFilter; - exports.LinearFilter = LinearFilter; - exports.LinearMipMapNearestFilter = LinearMipMapNearestFilter; - exports.LinearMipMapLinearFilter = LinearMipMapLinearFilter; - exports.TextureFilter = TextureFilter; - exports.UnsignedByteType = UnsignedByteType; - exports.ByteType = ByteType; - exports.ShortType = ShortType; - exports.UnsignedShortType = UnsignedShortType; - exports.IntType = IntType; - exports.UnsignedIntType = UnsignedIntType; - exports.FloatType = FloatType; - exports.HalfFloatType = HalfFloatType; - exports.UnsignedShort4444Type = UnsignedShort4444Type; - exports.UnsignedShort5551Type = UnsignedShort5551Type; - exports.UnsignedShort565Type = UnsignedShort565Type; - exports.UnsignedInt248Type = UnsignedInt248Type; - exports.AlphaFormat = AlphaFormat; - exports.RGBFormat = RGBFormat; - exports.RGBAFormat = RGBAFormat; - exports.LuminanceFormat = LuminanceFormat; - exports.LuminanceAlphaFormat = LuminanceAlphaFormat; - exports.RGBEFormat = RGBEFormat; - exports.DepthFormat = DepthFormat; - exports.DepthStencilFormat = DepthStencilFormat; - exports.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format; - exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format; - exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format; - exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format; - exports.RGB_PVRTC_4BPPV1_Format = RGB_PVRTC_4BPPV1_Format; - exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format; - exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format; - exports.RGBA_PVRTC_2BPPV1_Format = RGBA_PVRTC_2BPPV1_Format; - exports.RGB_ETC1_Format = RGB_ETC1_Format; - exports.LoopOnce = LoopOnce; - exports.LoopRepeat = LoopRepeat; - exports.LoopPingPong = LoopPingPong; - exports.InterpolateDiscrete = InterpolateDiscrete; - exports.InterpolateLinear = InterpolateLinear; - exports.InterpolateSmooth = InterpolateSmooth; - exports.ZeroCurvatureEnding = ZeroCurvatureEnding; - exports.ZeroSlopeEnding = ZeroSlopeEnding; - exports.WrapAroundEnding = WrapAroundEnding; - exports.TrianglesDrawMode = TrianglesDrawMode; - exports.TriangleStripDrawMode = TriangleStripDrawMode; - exports.TriangleFanDrawMode = TriangleFanDrawMode; - exports.LinearEncoding = LinearEncoding; - exports.sRGBEncoding = sRGBEncoding; - exports.GammaEncoding = GammaEncoding; - exports.RGBEEncoding = RGBEEncoding; - exports.LogLuvEncoding = LogLuvEncoding; - exports.RGBM7Encoding = RGBM7Encoding; - exports.RGBM16Encoding = RGBM16Encoding; - exports.RGBDEncoding = RGBDEncoding; - exports.BasicDepthPacking = BasicDepthPacking; - exports.RGBADepthPacking = RGBADepthPacking; - exports.CubeGeometry = BoxGeometry; - exports.Face4 = Face4; - exports.LineStrip = LineStrip; - exports.LinePieces = LinePieces; - exports.MeshFaceMaterial = MultiMaterial; - exports.PointCloud = PointCloud; - exports.Particle = Sprite; - exports.ParticleSystem = ParticleSystem; - exports.PointCloudMaterial = PointCloudMaterial; - exports.ParticleBasicMaterial = ParticleBasicMaterial; - exports.ParticleSystemMaterial = ParticleSystemMaterial; - exports.Vertex = Vertex; - exports.EdgesHelper = EdgesHelper; - exports.WireframeHelper = WireframeHelper; - exports.GeometryUtils = GeometryUtils; - exports.ImageUtils = ImageUtils; - exports.Projector = Projector; - exports.CanvasRenderer = CanvasRenderer; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); \ No newline at end of file diff --git a/libs/three.js/r81/three.min.js b/libs/three.js/r81/three.min.js deleted file mode 100644 index c9e76908..00000000 --- a/libs/three.js/r81/three.min.js +++ /dev/null @@ -1,831 +0,0 @@ -// threejs.org/license -(function(h,pa){"object"===typeof exports&&"undefined"!==typeof module?pa(exports):"function"===typeof define&&define.amd?define(["exports"],pa):pa(h.THREE=h.THREE||{})})(this,function(h){function pa(){}function C(a,b){this.x=a||0;this.y=b||0}function ba(a,b,c,d,e,f,g,k,l,m){Object.defineProperty(this,"id",{value:Pd++});this.uuid=h.Math.generateUUID();this.sourceFile=this.name="";this.image=void 0!==a?a:ba.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:ba.DEFAULT_MAPPING;this.wrapS=void 0!== -c?c:1001;this.wrapT=void 0!==d?d:1001;this.magFilter=void 0!==e?e:1006;this.minFilter=void 0!==f?f:1008;this.anisotropy=void 0!==l?l:1;this.format=void 0!==g?g:1023;this.type=void 0!==k?k:1009;this.offset=new C(0,0);this.repeat=new C(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.encoding=void 0!==m?m:3E3;this.version=0;this.onUpdate=null}function da(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}function zb(a,b,c){this.uuid=h.Math.generateUUID(); -this.width=a;this.height=b;this.scissor=new da(0,0,a,b);this.scissorTest=!1;this.viewport=new da(0,0,a,b);c=c||{};void 0===c.minFilter&&(c.minFilter=1006);this.texture=new ba(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy,c.encoding);this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.depthTexture=void 0!==c.depthTexture?c.depthTexture:null}function Ab(a,b,c){zb.call(this,a,b,c);this.activeMipMapLevel= -this.activeCubeFace=0}function ca(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function q(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function P(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function Ta(a,b,c,d,e,f,g,k,l,m){a=void 0!==a?a:[];ba.call(this,a,void 0!==b?b:301,c,d,e,f,g,k,l,m);this.flipY=!1}function Bb(a,b,c){var d=a[0];if(0>= -d||0<d)return a;var e=b*c,f=Qd[e];void 0===f&&(f=new Float32Array(e),Qd[e]=f);if(0!==b)for(d.toArray(f,0),d=1,e=0;d!==b;++d)e+=c,a[d].toArray(f,e);return f}function Rd(a,b){var c=Sd[b];void 0===c&&(c=new Int32Array(b),Sd[b]=c);for(var d=0;d!==b;++d)c[d]=a.allocTextureUnit();return c}function se(a,b){a.uniform1f(this.addr,b)}function te(a,b){a.uniform1i(this.addr,b)}function ue(a,b){void 0===b.x?a.uniform2fv(this.addr,b):a.uniform2f(this.addr,b.x,b.y)}function ve(a,b){void 0!==b.x?a.uniform3f(this.addr, -b.x,b.y,b.z):void 0!==b.r?a.uniform3f(this.addr,b.r,b.g,b.b):a.uniform3fv(this.addr,b)}function we(a,b){void 0===b.x?a.uniform4fv(this.addr,b):a.uniform4f(this.addr,b.x,b.y,b.z,b.w)}function xe(a,b){a.uniformMatrix2fv(this.addr,!1,b.elements||b)}function ye(a,b){a.uniformMatrix3fv(this.addr,!1,b.elements||b)}function ze(a,b){a.uniformMatrix4fv(this.addr,!1,b.elements||b)}function Ae(a,b,c){var d=c.allocTextureUnit();a.uniform1i(this.addr,d);c.setTexture2D(b||Td,d)}function Be(a,b,c){var d=c.allocTextureUnit(); -a.uniform1i(this.addr,d);c.setTextureCube(b||Ud,d)}function Vd(a,b){a.uniform2iv(this.addr,b)}function Wd(a,b){a.uniform3iv(this.addr,b)}function Xd(a,b){a.uniform4iv(this.addr,b)}function Ce(a){switch(a){case 5126:return se;case 35664:return ue;case 35665:return ve;case 35666:return we;case 35674:return xe;case 35675:return ye;case 35676:return ze;case 35678:return Ae;case 35680:return Be;case 5124:case 35670:return te;case 35667:case 35671:return Vd;case 35668:case 35672:return Wd;case 35669:case 35673:return Xd}} -function De(a,b){a.uniform1fv(this.addr,b)}function Ee(a,b){a.uniform1iv(this.addr,b)}function Fe(a,b){a.uniform2fv(this.addr,Bb(b,this.size,2))}function Ge(a,b){a.uniform3fv(this.addr,Bb(b,this.size,3))}function He(a,b){a.uniform4fv(this.addr,Bb(b,this.size,4))}function Ie(a,b){a.uniformMatrix2fv(this.addr,!1,Bb(b,this.size,4))}function Je(a,b){a.uniformMatrix3fv(this.addr,!1,Bb(b,this.size,9))}function Ke(a,b){a.uniformMatrix4fv(this.addr,!1,Bb(b,this.size,16))}function Le(a,b,c){var d=b.length, -e=Rd(c,d);a.uniform1iv(this.addr,e);for(a=0;a!==d;++a)c.setTexture2D(b[a]||Td,e[a])}function Me(a,b,c){var d=b.length,e=Rd(c,d);a.uniform1iv(this.addr,e);for(a=0;a!==d;++a)c.setTextureCube(b[a]||Ud,e[a])}function Ne(a){switch(a){case 5126:return De;case 35664:return Fe;case 35665:return Ge;case 35666:return He;case 35674:return Ie;case 35675:return Je;case 35676:return Ke;case 35678:return Le;case 35680:return Me;case 5124:case 35670:return Ee;case 35667:case 35671:return Vd;case 35668:case 35672:return Wd; -case 35669:case 35673:return Xd}}function Oe(a,b,c){this.id=a;this.addr=c;this.setValue=Ce(b.type)}function Pe(a,b,c){this.id=a;this.addr=c;this.size=b.size;this.setValue=Ne(b.type)}function Yd(a){this.id=a;this.seq=[];this.map={}}function Ga(a,b,c){this.seq=[];this.map={};this.renderer=c;c=a.getProgramParameter(b,a.ACTIVE_UNIFORMS);for(var d=0;d!==c;++d){var e=a.getActiveUniform(b,d),f=a.getUniformLocation(b,e.name),g=this,k=e.name,l=k.length;for(kd.lastIndex=0;;){var m=kd.exec(k),u=kd.lastIndex, -p=m[1],n=m[3];"]"===m[2]&&(p|=0);if(void 0===n||"["===n&&u+2===l){k=g;e=void 0===n?new Oe(p,e,f):new Pe(p,e,f);k.seq.push(e);k.map[e.id]=e;break}else n=g.map[p],void 0===n&&(n=new Yd(p),p=g,g=n,p.seq.push(g),p.map[g.id]=g),g=n}}}function H(a,b,c){return void 0===b&&void 0===c?this.set(a):this.setRGB(a,b,c)}function cc(a,b){this.min=void 0!==a?a:new C(Infinity,Infinity);this.max=void 0!==b?b:new C(-Infinity,-Infinity)}function Qe(a,b){var c,d,e,f,g,k,l,m,u,p,n=a.context,h=a.state,t,v,A,w,x,T;this.render= -function(y,F,G){if(0!==b.length){y=new q;var E=G.w/G.z,J=.5*G.z,Ma=.5*G.w,N=16/G.w,ea=new C(N*E,N),xa=new q(1,1,0),ab=new C(1,1),Ea=new cc;Ea.min.set(0,0);Ea.max.set(G.z-16,G.w-16);if(void 0===w){var N=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),L=new Uint16Array([0,1,2,0,2,3]);t=n.createBuffer();v=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,t);n.bufferData(n.ARRAY_BUFFER,N,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,v);n.bufferData(n.ELEMENT_ARRAY_BUFFER,L,n.STATIC_DRAW);x=n.createTexture(); -T=n.createTexture();h.bindTexture(n.TEXTURE_2D,x);n.texImage2D(n.TEXTURE_2D,0,n.RGB,16,16,0,n.RGB,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);h.bindTexture(n.TEXTURE_2D,T);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,16,16,0,n.RGBA,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S, -n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);var N=A={vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}", -fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},L=n.createProgram(),M=n.createShader(n.FRAGMENT_SHADER), -O=n.createShader(n.VERTEX_SHADER),Q="precision "+a.getPrecision()+" float;\n";n.shaderSource(M,Q+N.fragmentShader);n.shaderSource(O,Q+N.vertexShader);n.compileShader(M);n.compileShader(O);n.attachShader(L,M);n.attachShader(L,O);n.linkProgram(L);w=L;u=n.getAttribLocation(w,"position");p=n.getAttribLocation(w,"uv");c=n.getUniformLocation(w,"renderType");d=n.getUniformLocation(w,"map");e=n.getUniformLocation(w,"occlusionMap");f=n.getUniformLocation(w,"opacity");g=n.getUniformLocation(w,"color");k=n.getUniformLocation(w, -"scale");l=n.getUniformLocation(w,"rotation");m=n.getUniformLocation(w,"screenPosition")}n.useProgram(w);h.initAttributes();h.enableAttribute(u);h.enableAttribute(p);h.disableUnusedAttributes();n.uniform1i(e,0);n.uniform1i(d,1);n.bindBuffer(n.ARRAY_BUFFER,t);n.vertexAttribPointer(u,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(p,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,v);h.disable(n.CULL_FACE);h.setDepthWrite(!1);L=0;for(M=b.length;L<M;L++)if(N=16/G.w,ea.set(N*E,N),O=b[L],y.set(O.matrixWorld.elements[12], -O.matrixWorld.elements[13],O.matrixWorld.elements[14]),y.applyMatrix4(F.matrixWorldInverse),y.applyProjection(F.projectionMatrix),xa.copy(y),ab.x=G.x+xa.x*J+J-8,ab.y=G.y+xa.y*Ma+Ma-8,!0===Ea.containsPoint(ab)){h.activeTexture(n.TEXTURE0);h.bindTexture(n.TEXTURE_2D,null);h.activeTexture(n.TEXTURE1);h.bindTexture(n.TEXTURE_2D,x);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGB,ab.x,ab.y,16,16,0);n.uniform1i(c,0);n.uniform2f(k,ea.x,ea.y);n.uniform3f(m,xa.x,xa.y,xa.z);h.disable(n.BLEND);h.enable(n.DEPTH_TEST);n.drawElements(n.TRIANGLES, -6,n.UNSIGNED_SHORT,0);h.activeTexture(n.TEXTURE0);h.bindTexture(n.TEXTURE_2D,T);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGBA,ab.x,ab.y,16,16,0);n.uniform1i(c,1);h.disable(n.DEPTH_TEST);h.activeTexture(n.TEXTURE1);h.bindTexture(n.TEXTURE_2D,x);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);O.positionScreen.copy(xa);O.customUpdateCallback?O.customUpdateCallback(O):O.updateLensFlares();n.uniform1i(c,2);h.enable(n.BLEND);for(var Q=0,Re=O.lensFlares.length;Q<Re;Q++){var V=O.lensFlares[Q];.001<V.opacity&&.001< -V.scale&&(xa.x=V.x,xa.y=V.y,xa.z=V.z,N=V.size*V.scale/G.w,ea.x=N*E,ea.y=N,n.uniform3f(m,xa.x,xa.y,xa.z),n.uniform2f(k,ea.x,ea.y),n.uniform1f(l,V.rotation),n.uniform1f(f,V.opacity),n.uniform3f(g,V.color.r,V.color.g,V.color.b),h.setBlending(V.blending,V.blendEquation,V.blendSrc,V.blendDst),a.setTexture2D(V.texture,1),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0))}}h.enable(n.CULL_FACE);h.enable(n.DEPTH_TEST);h.setDepthWrite(!0);a.resetGLState()}}}function Se(a,b){var c,d,e,f,g,k,l,m,u,h,n,r,t,v, -A,w,x;function T(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:b.id-a.id}var y=a.context,F=a.state,G,E,J,Ma,N=new q,ea=new ca,xa=new q;this.render=function(q,Ea){if(0!==b.length){if(void 0===J){var L=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),M=new Uint16Array([0,1,2,0,2,3]);G=y.createBuffer();E=y.createBuffer();y.bindBuffer(y.ARRAY_BUFFER,G);y.bufferData(y.ARRAY_BUFFER,L,y.STATIC_DRAW);y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,E);y.bufferData(y.ELEMENT_ARRAY_BUFFER, -M,y.STATIC_DRAW);var L=y.createProgram(),M=y.createShader(y.VERTEX_SHADER),O=y.createShader(y.FRAGMENT_SHADER);y.shaderSource(M,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")); -y.shaderSource(O,["precision "+a.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); -y.compileShader(M);y.compileShader(O);y.attachShader(L,M);y.attachShader(L,O);y.linkProgram(L);J=L;w=y.getAttribLocation(J,"position");x=y.getAttribLocation(J,"uv");c=y.getUniformLocation(J,"uvOffset");d=y.getUniformLocation(J,"uvScale");e=y.getUniformLocation(J,"rotation");f=y.getUniformLocation(J,"scale");g=y.getUniformLocation(J,"color");k=y.getUniformLocation(J,"map");l=y.getUniformLocation(J,"opacity");m=y.getUniformLocation(J,"modelViewMatrix");u=y.getUniformLocation(J,"projectionMatrix");h= -y.getUniformLocation(J,"fogType");n=y.getUniformLocation(J,"fogDensity");r=y.getUniformLocation(J,"fogNear");t=y.getUniformLocation(J,"fogFar");v=y.getUniformLocation(J,"fogColor");A=y.getUniformLocation(J,"alphaTest");L=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");L.width=8;L.height=8;M=L.getContext("2d");M.fillStyle="white";M.fillRect(0,0,8,8);Ma=new ba(L);Ma.needsUpdate=!0}y.useProgram(J);F.initAttributes();F.enableAttribute(w);F.enableAttribute(x);F.disableUnusedAttributes(); -F.disable(y.CULL_FACE);F.enable(y.BLEND);y.bindBuffer(y.ARRAY_BUFFER,G);y.vertexAttribPointer(w,2,y.FLOAT,!1,16,0);y.vertexAttribPointer(x,2,y.FLOAT,!1,16,8);y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,E);y.uniformMatrix4fv(u,!1,Ea.projectionMatrix.elements);F.activeTexture(y.TEXTURE0);y.uniform1i(k,0);M=L=0;(O=q.fog)?(y.uniform3f(v,O.color.r,O.color.g,O.color.b),O&&O.isFog?(y.uniform1f(r,O.near),y.uniform1f(t,O.far),y.uniform1i(h,1),M=L=1):O&&O.isFogExp2&&(y.uniform1f(n,O.density),y.uniform1i(h,2),M=L=2)): -(y.uniform1i(h,0),M=L=0);for(var O=0,Q=b.length;O<Q;O++){var C=b[O];C.modelViewMatrix.multiplyMatrices(Ea.matrixWorldInverse,C.matrixWorld);C.z=-C.modelViewMatrix.elements[14]}b.sort(T);for(var V=[],O=0,Q=b.length;O<Q;O++){var C=b[O],W=C.material;!1!==W.visible&&(y.uniform1f(A,W.alphaTest),y.uniformMatrix4fv(m,!1,C.modelViewMatrix.elements),C.matrixWorld.decompose(N,ea,xa),V[0]=xa.x,V[1]=xa.y,C=0,q.fog&&W.fog&&(C=M),L!==C&&(y.uniform1i(h,C),L=C),null!==W.map?(y.uniform2f(c,W.map.offset.x,W.map.offset.y), -y.uniform2f(d,W.map.repeat.x,W.map.repeat.y)):(y.uniform2f(c,0,0),y.uniform2f(d,1,1)),y.uniform1f(l,W.opacity),y.uniform3f(g,W.color.r,W.color.g,W.color.b),y.uniform1f(e,W.rotation),y.uniform2fv(f,V),F.setBlending(W.blending,W.blendEquation,W.blendSrc,W.blendDst),F.setDepthTest(W.depthTest),F.setDepthWrite(W.depthWrite),W.map?a.setTexture2D(W.map,0):a.setTexture2D(Ma,0),y.drawElements(y.TRIANGLES,6,y.UNSIGNED_SHORT,0))}F.enable(y.CULL_FACE);a.resetGLState()}}}function S(){Object.defineProperty(this, -"id",{value:Zd++});this.uuid=h.Math.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=1;this.side=0;this.shading=2;this.vertexColors=0;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.clippingPlanes=null;this.clipShadows=!1;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.alphaTest= -this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.premultipliedAlpha=!1;this.overdraw=0;this._needsUpdate=this.visible=!0}function Da(a){S.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets= -this.skinning=this.clipping=this.lights=this.fog=!1;this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1};this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;void 0!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(a))}function Ua(a){S.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning= -!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Ha(a,b){this.min=void 0!==a?a:new q(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new q(-Infinity,-Infinity,-Infinity)}function Aa(a,b){this.center=void 0!==a?a:new q;this.radius=void 0!==b?b:0}function ya(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")} -function fa(a,b){this.normal=void 0!==a?a:new q(1,0,0);this.constant=void 0!==b?b:0}function dc(a,b,c,d,e,f){this.planes=[void 0!==a?a:new fa,void 0!==b?b:new fa,void 0!==c?c:new fa,void 0!==d?d:new fa,void 0!==e?e:new fa,void 0!==f?f:new fa]}function $d(a,b,c,d){function e(b,c,d,e){var f=b.geometry,g;g=A;var k=b.customDepthMaterial;d&&(g=w,k=b.customDistanceMaterial);k?g=k:(k=!1,c.morphTargets&&(f&&f.isBufferGeometry?k=f.morphAttributes&&f.morphAttributes.position&&0<f.morphAttributes.position.length: -f&&f.isGeometry&&(k=f.morphTargets&&0<f.morphTargets.length)),b=b.isSkinnedMesh&&c.skinning,f=0,k&&(f|=1),b&&(f|=2),g=g[f]);a.localClippingEnabled&&!0===c.clipShadows&&0!==c.clippingPlanes.length&&(f=g.uuid,k=c.uuid,b=x[f],void 0===b&&(b={},x[f]=b),f=b[k],void 0===f&&(f=g.clone(),b[k]=f),g=f);g.visible=c.visible;g.wireframe=c.wireframe;k=c.side;ea.renderSingleSided&&2==k&&(k=0);ea.renderReverseSided&&(0===k?k=1:1===k&&(k=0));g.side=k;g.clipShadows=c.clipShadows;g.clippingPlanes=c.clippingPlanes;g.wireframeLinewidth= -c.wireframeLinewidth;g.linewidth=c.linewidth;d&&void 0!==g.uniforms.lightPos&&g.uniforms.lightPos.value.copy(e);return g}function f(a,b,c){if(!1!==a.visible){0!==(a.layers.mask&b.layers.mask)&&(a.isMesh||a.isLine||a.isPoints)&&a.castShadow&&(!1===a.frustumCulled||!0===l.intersectsObject(a))&&!0===a.material.visible&&(a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld),v.push(a));a=a.children;for(var d=0,e=a.length;d<e;d++)f(a[d],b,c)}}var g=a.context,k=a.state,l=new dc,m=new P, -u=b.shadows,p=new C,n=new C(d.maxTextureSize,d.maxTextureSize),r=new q,t=new q,v=[],A=Array(4),w=Array(4),x={},T=[new q(1,0,0),new q(-1,0,0),new q(0,0,1),new q(0,0,-1),new q(0,1,0),new q(0,-1,0)],y=[new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,0,1),new q(0,0,-1)],F=[new da,new da,new da,new da,new da,new da];b=new Ua;b.depthPacking=3201;b.clipping=!0;d=Cb.distanceRGBA;for(var G=h.UniformsUtils.clone(d.uniforms),E=0;4!==E;++E){var J=0!==(E&1),Ma=0!==(E&2),N=b.clone();N.morphTargets= -J;N.skinning=Ma;A[E]=N;J=new Da({defines:{USE_SHADOWMAP:""},uniforms:G,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,morphTargets:J,skinning:Ma,clipping:!0});w[E]=J}var ea=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.renderSingleSided=this.renderReverseSided=!0;this.render=function(b,d){if(!1!==ea.enabled&&(!1!==ea.autoUpdate||!1!==ea.needsUpdate)&&0!==u.length){k.clearColor(1,1,1,1);k.disable(g.BLEND);k.setDepthTest(!0);k.setScissorTest(!1);for(var h, -x,w=0,A=u.length;w<A;w++){var q=u[w],G=q.shadow;if(void 0===G)console.warn("THREE.WebGLShadowMap:",q,"has no shadow.");else{var E=G.camera;p.copy(G.mapSize);p.min(n);if(q&&q.isPointLight){h=6;x=!0;var J=p.x,N=p.y;F[0].set(2*J,N,J,N);F[1].set(0,N,J,N);F[2].set(3*J,N,J,N);F[3].set(J,N,J,N);F[4].set(3*J,0,J,N);F[5].set(J,0,J,N);p.x*=4;p.y*=2}else h=1,x=!1;null===G.map&&(G.map=new zb(p.x,p.y,{minFilter:1003,magFilter:1003,format:1023}),E.updateProjectionMatrix());G&&G.isSpotLightShadow&&G.update(q);J= -G.map;G=G.matrix;t.setFromMatrixPosition(q.matrixWorld);E.position.copy(t);a.setRenderTarget(J);a.clear();for(J=0;J<h;J++){x?(r.copy(E.position),r.add(T[J]),E.up.copy(y[J]),E.lookAt(r),k.viewport(F[J])):(r.setFromMatrixPosition(q.target.matrixWorld),E.lookAt(r));E.updateMatrixWorld();E.matrixWorldInverse.getInverse(E.matrixWorld);G.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);G.multiply(E.projectionMatrix);G.multiply(E.matrixWorldInverse);m.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse); -l.setFromMatrix(m);v.length=0;f(b,d,E);for(var N=0,Ma=v.length;N<Ma;N++){var C=v[N],z=c.update(C),D=C.material;if(D&&D.isMultiMaterial)for(var Va=z.groups,D=D.materials,ld=0,Ba=Va.length;ld<Ba;ld++){var Qa=Va[ld],Na=D[Qa.materialIndex];!0===Na.visible&&(Na=e(C,Na,x,t),a.renderBufferDirect(E,null,z,Na,C,Qa))}else Na=e(C,D,x,t),a.renderBufferDirect(E,null,z,Na,C,null)}}}}h=a.getClearColor();x=a.getClearAlpha();a.setClearColor(h,x);ea.needsUpdate=!1}}}function Wa(a,b){this.origin=void 0!==a?a:new q; -this.direction=void 0!==b?b:new q}function Xa(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||Xa.DefaultOrder}function Kc(){this.mask=1}function D(){Object.defineProperty(this,"id",{value:ae++});this.uuid=h.Math.generateUUID();this.name="";this.type="Object3D";this.parent=null;this.children=[];this.up=D.DefaultUp.clone();var a=new q,b=new Xa,c=new ca,d=new q(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)});c.onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this, -{position:{enumerable:!0,value:a},rotation:{enumerable:!0,value:b},quaternion:{enumerable:!0,value:c},scale:{enumerable:!0,value:d},modelViewMatrix:{value:new P},normalMatrix:{value:new ya}});this.matrix=new P;this.matrixWorld=new P;this.matrixAutoUpdate=D.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=!1;this.layers=new Kc;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={};this.onBeforeRender=null}function cb(a,b){this.start=void 0!== -a?a:new q;this.end=void 0!==b?b:new q}function Fa(a,b,c){this.a=void 0!==a?a:new q;this.b=void 0!==b?b:new q;this.c=void 0!==c?c:new q}function ga(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d&&d.isVector3?d:new q;this.vertexNormals=Array.isArray(d)?d:[];this.color=e&&e.isColor?e:new H;this.vertexColors=Array.isArray(e)?e:[];this.materialIndex=void 0!==f?f:0}function Ia(a){S.call(this);this.type="MeshBasicMaterial";this.color=new H(16777215);this.aoMap=this.map=null;this.aoMapIntensity=1; -this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(a)}function z(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=h.Math.generateUUID();this.array=a;this.itemSize=b;this.count=void 0!==a?a.length/b:0;this.normalized=!0=== -c;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function be(a,b){return new z(new Uint16Array(a),b)}function ce(a,b){return new z(new Uint32Array(a),b)}function ma(a,b){return new z(new Float32Array(a),b)}function R(){Object.defineProperty(this,"id",{value:Lc++});this.uuid=h.Math.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices= -[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function de(){Object.defineProperty(this,"id",{value:Lc++});this.uuid=h.Math.generateUUID();this.name="";this.type="DirectGeometry";this.indices=[];this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights= -[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function I(){Object.defineProperty(this,"id",{value:Lc++});this.uuid=h.Math.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function va(a,b){D.call(this);this.type= -"Mesh";this.geometry=void 0!==a?a:new I;this.material=void 0!==b?b:new Ia({color:16777215*Math.random()});this.drawMode=0;this.updateMorphTargets()}function db(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,m,C,D){var z=f/m,L=g/C,M=f/2,O=g/2,Q=l/2;g=m+1;for(var H=C+1,V=f=0,W=new q,K=0;K<H;K++)for(var P=K*L-O,I=0;I<g;I++)W[a]=(I*z-M)*d,W[b]=P*e,W[c]=Q,h[t]=W.x,h[t+1]=W.y,h[t+2]=W.z,W[a]=0,W[b]=0,W[c]=0<l?1:-1,n[t]=W.x,n[t+1]=W.y,n[t+2]=W.z,r[v]=I/m,r[v+1]=1-K/C,t+=3,v+=2,f+=1;for(K=0;K<C;K++)for(I=0;I<m;I++)a= -w+I+g*(K+1),b=w+(I+1)+g*(K+1),c=w+(I+1)+g*K,u[A]=w+I+g*K,u[A+1]=a,u[A+2]=c,u[A+3]=a,u[A+4]=b,u[A+5]=c,A+=6,V+=6;k.addGroup(x,V,D);x+=V;w+=f}I.call(this);this.type="BoxBufferGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};var k=this;d=Math.floor(d)||1;e=Math.floor(e)||1;f=Math.floor(f)||1;var l=function(a,b,c){return a=0+(a+1)*(b+1)*2+(a+1)*(c+1)*2+(c+1)*(b+1)*2}(d,e,f),m=function(a,b,c){a=0+a*b*2+a*c*2+c*b*2;return 6*a}(d,e,f),u=new (65535<m?Uint32Array: -Uint16Array)(m),h=new Float32Array(3*l),n=new Float32Array(3*l),r=new Float32Array(2*l),t=0,v=0,A=0,w=0,x=0;g("z","y","x",-1,-1,c,b,a,f,e,0);g("z","y","x",1,-1,c,b,-a,f,e,1);g("x","z","y",1,1,a,c,b,d,f,2);g("x","z","y",1,-1,a,c,-b,d,f,3);g("x","y","z",1,-1,a,b,c,d,e,4);g("x","y","z",-1,-1,a,b,-c,d,e,5);this.setIndex(new z(u,1));this.addAttribute("position",new z(h,3));this.addAttribute("normal",new z(n,3));this.addAttribute("uv",new z(r,2))}function eb(a,b,c,d){I.call(this);this.type="PlaneBufferGeometry"; -this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=Math.floor(c)||1;d=Math.floor(d)||1;var g=c+1,k=d+1,l=a/c,m=b/d;b=new Float32Array(g*k*3);a=new Float32Array(g*k*3);for(var u=new Float32Array(g*k*2),h=0,n=0,r=0;r<k;r++)for(var t=r*m-f,v=0;v<g;v++)b[h]=v*l-e,b[h+1]=-t,a[h+2]=1,u[n]=v/c,u[n+1]=1-r/d,h+=3,n+=2;h=0;e=new (65535<b.length/3?Uint32Array:Uint16Array)(c*d*6);for(r=0;r<d;r++)for(v=0;v<c;v++)f=v+g*(r+1),k=v+1+g*(r+1),l=v+1+g*r,e[h]=v+g*r,e[h+1]=f,e[h+2]= -l,e[h+3]=f,e[h+4]=k,e[h+5]=l,h+=6;this.setIndex(new z(e,1));this.addAttribute("position",new z(b,3));this.addAttribute("normal",new z(a,3));this.addAttribute("uv",new z(u,2))}function qa(){D.call(this);this.type="Camera";this.matrixWorldInverse=new P;this.projectionMatrix=new P}function Ca(a,b,c,d){qa.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge= -35;this.filmOffset=0;this.updateProjectionMatrix()}function Db(a,b,c,d,e,f){qa.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function Te(a,b,c){var d,e,f;return{setMode:function(a){d=a},setIndex:function(c){c.array instanceof Uint32Array&&b.get("OES_element_index_uint")?(e=a.UNSIGNED_INT,f=4):(e=a.UNSIGNED_SHORT,f=2)},render:function(b,k){a.drawElements(d, -k,e,b*f);c.calls++;c.vertices+=k;d===a.TRIANGLES&&(c.faces+=k/3)},renderInstances:function(g,k,l){var m=b.get("ANGLE_instanced_arrays");null===m?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(m.drawElementsInstancedANGLE(d,l,e,k*f,g.maxInstancedCount),c.calls++,c.vertices+=l*g.maxInstancedCount,d===a.TRIANGLES&&(c.faces+=g.maxInstancedCount*l/3))}}}function Ue(a,b,c){var d;return{setMode:function(a){d= -a},render:function(b,f){a.drawArrays(d,b,f);c.calls++;c.vertices+=f;d===a.TRIANGLES&&(c.faces+=f/3)},renderInstances:function(e){var f=b.get("ANGLE_instanced_arrays");if(null===f)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var g=e.attributes.position,g=g&&g.isInterleavedBufferAttribute?g.data.count:g.count;f.drawArraysInstancedANGLE(d,0,g,e.maxInstancedCount);c.calls++;c.vertices+=g*e.maxInstancedCount; -d===a.TRIANGLES&&(c.faces+=e.maxInstancedCount*g/3)}}}}function Ve(){var a={};return{get:function(b){if(void 0!==a[b.id])return a[b.id];var c;switch(b.type){case "DirectionalLight":c={direction:new q,color:new H,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new C};break;case "SpotLight":c={position:new q,direction:new q,color:new H,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new C};break;case "PointLight":c={position:new q,color:new H,distance:0, -decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new C};break;case "HemisphereLight":c={direction:new q,skyColor:new H,groundColor:new H}}return a[b.id]=c}}}function We(a){a=a.split("\n");for(var b=0;b<a.length;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function ee(a,b,c){var d=a.createShader(b);a.shaderSource(d,c);a.compileShader(d);!1===a.getShaderParameter(d,a.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile.");""!==a.getShaderInfoLog(d)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()", -b===a.VERTEX_SHADER?"vertex":"fragment",a.getShaderInfoLog(d),We(c));return d}function fe(a){switch(a){case 3E3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw Error("unsupported encoding: "+a);}}function md(a,b){var c=fe(b);return"vec4 "+a+"( vec4 value ) { return "+ -c[0]+"ToLinear"+c[1]+"; }"}function Xe(a,b){var c=fe(b);return"vec4 "+a+"( vec4 value ) { return LinearTo"+c[0]+c[1]+"; }"}function Ye(a,b){var c;switch(b){case 1:c="Linear";break;case 2:c="Reinhard";break;case 3:c="Uncharted2";break;case 4:c="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+b);}return"vec3 "+a+"( vec3 color ) { return "+c+"ToneMapping( color ); }"}function Ze(a,b,c){a=a||{};return[a.derivatives||b.envMapCubeUV||b.bumpMap||b.normalMap||b.flatShading?"#extension GL_OES_standard_derivatives : enable": -"",(a.fragDepth||b.logarithmicDepthBuffer)&&c.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&c.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||b.envMap)&&c.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ec).join("\n")}function $e(a){var b=[],c;for(c in a){var d=a[c];!1!==d&&b.push("#define "+c+" "+d)}return b.join("\n")}function ec(a){return""!==a}function ge(a,b){return a.replace(/NUM_DIR_LIGHTS/g, -b.numDirLights).replace(/NUM_SPOT_LIGHTS/g,b.numSpotLights).replace(/NUM_POINT_LIGHTS/g,b.numPointLights).replace(/NUM_HEMI_LIGHTS/g,b.numHemiLights)}function nd(a){return a.replace(/#include +<([\w\d.]+)>/g,function(a,c){var d=Z[c];if(void 0===d)throw Error("Can not resolve #include <"+c+">");return nd(d)})}function he(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);c<parseInt(d);c++)a+=e.replace(/\[ i \]/g,"[ "+c+ -" ]");return a})}function af(a,b,c,d){var e=a.context,f=c.extensions,g=c.defines,k=c.__webglShader.vertexShader,l=c.__webglShader.fragmentShader,m="SHADOWMAP_TYPE_BASIC";1===d.shadowMapType?m="SHADOWMAP_TYPE_PCF":2===d.shadowMapType&&(m="SHADOWMAP_TYPE_PCF_SOFT");var h="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",n="ENVMAP_BLENDING_MULTIPLY";if(d.envMap){switch(c.envMap.mapping){case 301:case 302:h="ENVMAP_TYPE_CUBE";break;case 306:case 307:h="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:h="ENVMAP_TYPE_EQUIREC"; -break;case 305:h="ENVMAP_TYPE_SPHERE"}switch(c.envMap.mapping){case 302:case 304:p="ENVMAP_MODE_REFRACTION"}switch(c.combine){case 0:n="ENVMAP_BLENDING_MULTIPLY";break;case 1:n="ENVMAP_BLENDING_MIX";break;case 2:n="ENVMAP_BLENDING_ADD"}}var r=0<a.gammaFactor?a.gammaFactor:1,f=Ze(f,d,a.extensions),t=$e(g),v=e.createProgram();c.isRawShaderMaterial?(g=[t,"\n"].filter(ec).join("\n"),m=[f,t,"\n"].filter(ec).join("\n")):(g=["precision "+d.precision+" float;","precision "+d.precision+" int;","#define SHADER_NAME "+ -c.__webglShader.name,t,d.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+r,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.envMap?"#define "+p:"",d.lightMap?"#define USE_LIGHTMAP":"",d.aoMap?"#define USE_AOMAP":"",d.emissiveMap?"#define USE_EMISSIVEMAP":"",d.bumpMap?"#define USE_BUMPMAP":"",d.normalMap?"#define USE_NORMALMAP":"",d.displacementMap&&d.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",d.specularMap?"#define USE_SPECULARMAP": -"",d.roughnessMap?"#define USE_ROUGHNESSMAP":"",d.metalnessMap?"#define USE_METALNESSMAP":"",d.alphaMap?"#define USE_ALPHAMAP":"",d.vertexColors?"#define USE_COLOR":"",d.flatShading?"#define FLAT_SHADED":"",d.skinning?"#define USE_SKINNING":"",d.useVertexTexture?"#define BONE_TEXTURE":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.morphNormals&&!1===d.flatShading?"#define USE_MORPHNORMALS":"",d.doubleSided?"#define DOUBLE_SIDED":"",d.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+ -d.numClippingPlanes,d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapEnabled?"#define "+m:"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"",d.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",d.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;", -"attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;", -"\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ec).join("\n"),m=[f,"precision "+d.precision+" float;","precision "+d.precision+" int;","#define SHADER_NAME "+c.__webglShader.name,t,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"","#define GAMMA_FACTOR "+r,d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fogExp?"#define FOG_EXP2":"",d.map?"#define USE_MAP": -"",d.envMap?"#define USE_ENVMAP":"",d.envMap?"#define "+h:"",d.envMap?"#define "+p:"",d.envMap?"#define "+n:"",d.lightMap?"#define USE_LIGHTMAP":"",d.aoMap?"#define USE_AOMAP":"",d.emissiveMap?"#define USE_EMISSIVEMAP":"",d.bumpMap?"#define USE_BUMPMAP":"",d.normalMap?"#define USE_NORMALMAP":"",d.specularMap?"#define USE_SPECULARMAP":"",d.roughnessMap?"#define USE_ROUGHNESSMAP":"",d.metalnessMap?"#define USE_METALNESSMAP":"",d.alphaMap?"#define USE_ALPHAMAP":"",d.vertexColors?"#define USE_COLOR": -"",d.flatShading?"#define FLAT_SHADED":"",d.doubleSided?"#define DOUBLE_SIDED":"",d.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+d.numClippingPlanes,d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapEnabled?"#define "+m:"",d.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",d.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",d.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",d.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT": -"",d.envMap&&a.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==d.toneMapping?"#define TONE_MAPPING":"",0!==d.toneMapping?Z.tonemapping_pars_fragment:"",0!==d.toneMapping?Ye("toneMapping",d.toneMapping):"",d.outputEncoding||d.mapEncoding||d.envMapEncoding||d.emissiveMapEncoding?Z.encodings_pars_fragment:"",d.mapEncoding?md("mapTexelToLinear",d.mapEncoding):"",d.envMapEncoding?md("envMapTexelToLinear",d.envMapEncoding): -"",d.emissiveMapEncoding?md("emissiveMapTexelToLinear",d.emissiveMapEncoding):"",d.outputEncoding?Xe("linearToOutputTexel",d.outputEncoding):"",d.depthPacking?"#define DEPTH_PACKING "+c.depthPacking:"","\n"].filter(ec).join("\n"));k=nd(k,d);k=ge(k,d);l=nd(l,d);l=ge(l,d);c.isShaderMaterial||(k=he(k),l=he(l));l=m+l;k=ee(e,e.VERTEX_SHADER,g+k);l=ee(e,e.FRAGMENT_SHADER,l);e.attachShader(v,k);e.attachShader(v,l);void 0!==c.index0AttributeName?e.bindAttribLocation(v,0,c.index0AttributeName):!0===d.morphTargets&& -e.bindAttribLocation(v,0,"position");e.linkProgram(v);d=e.getProgramInfoLog(v);h=e.getShaderInfoLog(k);p=e.getShaderInfoLog(l);r=n=!0;if(!1===e.getProgramParameter(v,e.LINK_STATUS))n=!1,console.error("THREE.WebGLProgram: shader error: ",e.getError(),"gl.VALIDATE_STATUS",e.getProgramParameter(v,e.VALIDATE_STATUS),"gl.getProgramInfoLog",d,h,p);else if(""!==d)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",d);else if(""===h||""===p)r=!1;r&&(this.diagnostics={runnable:n,material:c,programLog:d, -vertexShader:{log:h,prefix:g},fragmentShader:{log:p,prefix:m}});e.deleteShader(k);e.deleteShader(l);var A;this.getUniforms=function(){void 0===A&&(A=new Ga(e,v,a));return A};var w;this.getAttributes=function(){if(void 0===w){for(var a={},b=e.getProgramParameter(v,e.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=e.getActiveAttrib(v,c).name;a[d]=e.getAttribLocation(v,d)}w=a}return w};this.destroy=function(){e.deleteProgram(v);this.program=void 0};Object.defineProperties(this,{uniforms:{get:function(){console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."); -return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");return this.getAttributes()}}});this.id=bf++;this.code=b;this.usedTimes=1;this.program=v;this.vertexShader=k;this.fragmentShader=l;return this}function cf(a,b){function c(a,b){var c;a?a&&a.isTexture?c=a.encoding:a&&a.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), -c=a.texture.encoding):c=3E3;3E3===c&&b&&(c=3007);return c}var d=[],e={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},f="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes depthPacking".split(" "); -this.getParameters=function(d,f,l,m,h){var p=e[d.type],n;b.floatVertexTextures&&h&&h.skeleton&&h.skeleton.useVertexTexture?n=1024:(n=Math.floor((b.maxVertexUniforms-20)/4),void 0!==h&&h&&h.isSkinnedMesh&&(n=Math.min(h.skeleton.bones.length,n),n<h.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+h.skeleton.bones.length+", this GPU supports just "+n+" (try OpenGL instead of ANGLE)")));var r=a.getPrecision();null!==d.precision&&(r=b.getMaxPrecision(d.precision),r!==d.precision&& -console.warn("THREE.WebGLProgram.getParameters:",d.precision,"not supported, using",r,"instead."));var t=a.getCurrentRenderTarget();return{shaderID:p,precision:r,supportsVertexTextures:b.vertexTextures,outputEncoding:c(t?t.texture:null,a.gammaOutput),map:!!d.map,mapEncoding:c(d.map,a.gammaInput),envMap:!!d.envMap,envMapMode:d.envMap&&d.envMap.mapping,envMapEncoding:c(d.envMap,a.gammaInput),envMapCubeUV:!!d.envMap&&(306===d.envMap.mapping||307===d.envMap.mapping),lightMap:!!d.lightMap,aoMap:!!d.aoMap, -emissiveMap:!!d.emissiveMap,emissiveMapEncoding:c(d.emissiveMap,a.gammaInput),bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,displacementMap:!!d.displacementMap,roughnessMap:!!d.roughnessMap,metalnessMap:!!d.metalnessMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,combine:d.combine,vertexColors:d.vertexColors,fog:!!l,useFog:d.fog,fogExp:l&&l.isFogExp2,flatShading:1===d.shading,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:b.logarithmicDepthBuffer,skinning:d.skinning,maxBones:n,useVertexTexture:b.floatVertexTextures&& -h&&h.skeleton&&h.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:a.maxMorphTargets,maxMorphNormals:a.maxMorphNormals,numDirLights:f.directional.length,numPointLights:f.point.length,numSpotLights:f.spot.length,numHemiLights:f.hemi.length,numClippingPlanes:m,shadowMapEnabled:a.shadowMap.enabled&&h.receiveShadow&&0<f.shadows.length,shadowMapType:a.shadowMap.type,toneMapping:a.toneMapping,physicallyCorrectLights:a.physicallyCorrectLights,premultipliedAlpha:d.premultipliedAlpha, -alphaTest:d.alphaTest,doubleSided:2===d.side,flipSided:1===d.side,depthPacking:void 0!==d.depthPacking?d.depthPacking:!1}};this.getProgramCode=function(a,b){var c=[];b.shaderID?c.push(b.shaderID):(c.push(a.fragmentShader),c.push(a.vertexShader));if(void 0!==a.defines)for(var d in a.defines)c.push(d),c.push(a.defines[d]);for(d=0;d<f.length;d++)c.push(b[f[d]]);return c.join()};this.acquireProgram=function(b,c,e){for(var f,h=0,p=d.length;h<p;h++){var n=d[h];if(n.code===e){f=n;++f.usedTimes;break}}void 0=== -f&&(f=new af(a,e,b,c),d.push(f));return f};this.releaseProgram=function(a){if(0===--a.usedTimes){var b=d.indexOf(a);d[b]=d[d.length-1];d.pop();a.destroy()}};this.programs=d}function df(a,b,c){function d(a){var k=a.target;a=f[k.id];null!==a.index&&e(a.index);var l=a.attributes,m;for(m in l)e(l[m]);k.removeEventListener("dispose",d);delete f[k.id];m=b.get(k);m.wireframe&&e(m.wireframe);b["delete"](k);k=b.get(a);k.wireframe&&e(k.wireframe);b["delete"](a);c.memory.geometries--}function e(c){var d;d=c.isInterleavedBufferAttribute? -b.get(c.data).__webglBuffer:b.get(c).__webglBuffer;void 0!==d&&(a.deleteBuffer(d),c.isInterleavedBufferAttribute?b["delete"](c.data):b["delete"](c))}var f={};return{get:function(a){var b=a.geometry;if(void 0!==f[b.id])return f[b.id];b.addEventListener("dispose",d);var e;b.isBufferGeometry?e=b:b.isGeometry&&(void 0===b._bufferGeometry&&(b._bufferGeometry=(new I).setFromObject(a)),e=b._bufferGeometry);f[b.id]=e;c.memory.geometries++;return e}}}function ef(a,b,c){function d(c,d){var e=c.isInterleavedBufferAttribute? -c.data:c,l=b.get(e);void 0===l.__webglBuffer?(l.__webglBuffer=a.createBuffer(),a.bindBuffer(d,l.__webglBuffer),a.bufferData(d,e.array,e.dynamic?a.DYNAMIC_DRAW:a.STATIC_DRAW),l.version=e.version):l.version!==e.version&&(a.bindBuffer(d,l.__webglBuffer),!1===e.dynamic||-1===e.updateRange.count?a.bufferSubData(d,0,e.array):0===e.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."): -(a.bufferSubData(d,e.updateRange.offset*e.array.BYTES_PER_ELEMENT,e.array.subarray(e.updateRange.offset,e.updateRange.offset+e.updateRange.count)),e.updateRange.count=0),l.version=e.version)}var e=new df(a,b,c);return{getAttributeBuffer:function(a){return a.isInterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer},getWireframeAttribute:function(c){var e=b.get(c);if(void 0!==e.wireframe)return e.wireframe;var k=[],l=c.index,m=c.attributes;c=m.position;if(null!==l)for(var l=l.array, -m=0,h=l.length;m<h;m+=3){var p=l[m+0],n=l[m+1],r=l[m+2];k.push(p,n,n,r,r,p)}else for(l=m.position.array,m=0,h=l.length/3-1;m<h;m+=3)p=m+0,n=m+1,r=m+2,k.push(p,n,n,r,r,p);k=new z(new (65535<c.count?Uint32Array:Uint16Array)(k),1);d(k,a.ELEMENT_ARRAY_BUFFER);return e.wireframe=k},update:function(b){var c=e.get(b);b.geometry.isGeometry&&c.updateFromObject(b);b=c.index;var k=c.attributes;null!==b&&d(b,a.ELEMENT_ARRAY_BUFFER);for(var l in k)d(k[l],a.ARRAY_BUFFER);b=c.morphAttributes;for(l in b)for(var k= -b[l],m=0,h=k.length;m<h;m++)d(k[m],a.ARRAY_BUFFER);return c}}}function ff(a,b,c,d,e,f,g){function k(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a} -function l(a){return h.Math.isPowerOfTwo(a.width)&&h.Math.isPowerOfTwo(a.height)}function m(b){return 1003===b||1004===b||1005===b?a.NEAREST:a.LINEAR}function u(b){b=b.target;b.removeEventListener("dispose",u);a:{var c=d.get(b);if(b.image&&c.__image__webglTextureCube)a.deleteTexture(c.__image__webglTextureCube);else{if(void 0===c.__webglInit)break a;a.deleteTexture(c.__webglTexture)}d["delete"](b)}A.textures--}function p(b){b=b.target;b.removeEventListener("dispose",p);var c=d.get(b),e=d.get(b.texture); -if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b&&b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d["delete"](b.texture);d["delete"](b)}A.textures--}function n(b,g){var m=d.get(b);if(0<b.version&&m.__version!==b.version){var n= -b.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",b);else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",b);else{void 0===m.__webglInit&&(m.__webglInit=!0,b.addEventListener("dispose",u),m.__webglTexture=a.createTexture(),A.textures++);c.activeTexture(a.TEXTURE0+g);c.bindTexture(a.TEXTURE_2D,m.__webglTexture);a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b.flipY);a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL, -b.premultiplyAlpha);a.pixelStorei(a.UNPACK_ALIGNMENT,b.unpackAlignment);var p=k(b.image,e.maxTextureSize);if((1001!==b.wrapS||1001!==b.wrapT||1003!==b.minFilter&&1006!==b.minFilter)&&!1===l(p))if(n=p,n instanceof HTMLImageElement||n instanceof HTMLCanvasElement){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");t.width=h.Math.nearestPowerOfTwo(n.width);t.height=h.Math.nearestPowerOfTwo(n.height);t.getContext("2d").drawImage(n,0,0,t.width,t.height);console.warn("THREE.WebGLRenderer: image is not power of two ("+ -n.width+"x"+n.height+"). Resized to "+t.width+"x"+t.height,n);p=t}else p=n;var n=l(p),t=f(b.format),v=f(b.type);r(a.TEXTURE_2D,b,n);var q=b.mipmaps;if(b&&b.isDepthTexture){q=a.DEPTH_COMPONENT;if(1015===b.type){if(!w)throw Error("Float Depth Texture only supported in WebGL2.0");q=a.DEPTH_COMPONENT32F}else w&&(q=a.DEPTH_COMPONENT16);1027===b.format&&(q=a.DEPTH_STENCIL);c.texImage2D(a.TEXTURE_2D,0,q,p.width,p.height,0,t,v,null)}else if(b&&b.isDataTexture)if(0<q.length&&n){for(var N=0,C=q.length;N<C;N++)p= -q[N],c.texImage2D(a.TEXTURE_2D,N,t,p.width,p.height,0,t,v,p.data);b.generateMipmaps=!1}else c.texImage2D(a.TEXTURE_2D,0,t,p.width,p.height,0,t,v,p.data);else if(b&&b.isCompressedTexture)for(N=0,C=q.length;N<C;N++)p=q[N],1023!==b.format&&1022!==b.format?-1<c.getCompressedTextureFormats().indexOf(t)?c.compressedTexImage2D(a.TEXTURE_2D,N,t,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):c.texImage2D(a.TEXTURE_2D, -N,t,p.width,p.height,0,t,v,p.data);else if(0<q.length&&n){N=0;for(C=q.length;N<C;N++)p=q[N],c.texImage2D(a.TEXTURE_2D,N,t,t,v,p);b.generateMipmaps=!1}else c.texImage2D(a.TEXTURE_2D,0,t,t,v,p);b.generateMipmaps&&n&&a.generateMipmap(a.TEXTURE_2D);m.__version=b.version;if(b.onUpdate)b.onUpdate(b);return}}c.activeTexture(a.TEXTURE0+g);c.bindTexture(a.TEXTURE_2D,m.__webglTexture)}function r(c,g,k){k?(a.texParameteri(c,a.TEXTURE_WRAP_S,f(g.wrapS)),a.texParameteri(c,a.TEXTURE_WRAP_T,f(g.wrapT)),a.texParameteri(c, -a.TEXTURE_MAG_FILTER,f(g.magFilter)),a.texParameteri(c,a.TEXTURE_MIN_FILTER,f(g.minFilter))):(a.texParameteri(c,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(c,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),1001===g.wrapS&&1001===g.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",g),a.texParameteri(c,a.TEXTURE_MAG_FILTER,m(g.magFilter)),a.texParameteri(c,a.TEXTURE_MIN_FILTER,m(g.minFilter)),1003!==g.minFilter&& -1006!==g.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",g));!(k=b.get("EXT_texture_filter_anisotropic"))||1015===g.type&&null===b.get("OES_texture_float_linear")||1016===g.type&&null===b.get("OES_texture_half_float_linear")||!(1<g.anisotropy||d.get(g).__currentAnisotropy)||(a.texParameterf(c,k.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,e.getMaxAnisotropy())),d.get(g).__currentAnisotropy= -g.anisotropy)}function t(b,e,g,k){var l=f(e.texture.format),m=f(e.texture.type);c.texImage2D(k,0,l,e.width,e.height,0,l,m,null);a.bindFramebuffer(a.FRAMEBUFFER,b);a.framebufferTexture2D(a.FRAMEBUFFER,g,k,d.get(e.texture).__webglTexture,0);a.bindFramebuffer(a.FRAMEBUFFER,null)}function v(b,c){a.bindRenderbuffer(a.RENDERBUFFER,b);c.depthBuffer&&!c.stencilBuffer?(a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_COMPONENT16,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER, -b)):c.depthBuffer&&c.stencilBuffer?(a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,b)):a.renderbufferStorage(a.RENDERBUFFER,a.RGBA4,c.width,c.height);a.bindRenderbuffer(a.RENDERBUFFER,null)}var A=g.memory,w="undefined"!==typeof WebGL2RenderingContext&&a instanceof WebGL2RenderingContext;this.setTexture2D=n;this.setTextureCube=function(b,g){var m=d.get(b);if(6===b.image.length)if(0<b.version&& -m.__version!==b.version){m.__image__webglTextureCube||(b.addEventListener("dispose",u),m.__image__webglTextureCube=a.createTexture(),A.textures++);c.activeTexture(a.TEXTURE0+g);c.bindTexture(a.TEXTURE_CUBE_MAP,m.__image__webglTextureCube);a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b.flipY);for(var h=b&&b.isCompressedTexture,n=b.image[0]&&b.image[0].isDataTexture,p=[],t=0;6>t;t++)p[t]=h||n?n?b.image[t].image:b.image[t]:k(b.image[t],e.maxCubemapSize);var v=l(p[0]),q=f(b.format),w=f(b.type);r(a.TEXTURE_CUBE_MAP, -b,v);for(t=0;6>t;t++)if(h)for(var C,D=p[t].mipmaps,z=0,L=D.length;z<L;z++)C=D[z],1023!==b.format&&1022!==b.format?-1<c.getCompressedTextureFormats().indexOf(q)?c.compressedTexImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+t,z,q,C.width,C.height,0,C.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+t,z,q,C.width,C.height,0,q,w,C.data);else n?c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,q,p[t].width, -p[t].height,0,q,w,p[t].data):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,q,q,w,p[t]);b.generateMipmaps&&v&&a.generateMipmap(a.TEXTURE_CUBE_MAP);m.__version=b.version;if(b.onUpdate)b.onUpdate(b)}else c.activeTexture(a.TEXTURE0+g),c.bindTexture(a.TEXTURE_CUBE_MAP,m.__image__webglTextureCube)};this.setTextureCubeDynamic=function(b,e){c.activeTexture(a.TEXTURE0+e);c.bindTexture(a.TEXTURE_CUBE_MAP,d.get(b).__webglTexture)};this.setupRenderTarget=function(b){var e=d.get(b),f=d.get(b.texture);b.addEventListener("dispose", -p);f.__webglTexture=a.createTexture();A.textures++;var g=b&&b.isWebGLRenderTargetCube,k=l(b);if(g){e.__webglFramebuffer=[];for(var m=0;6>m;m++)e.__webglFramebuffer[m]=a.createFramebuffer()}else e.__webglFramebuffer=a.createFramebuffer();if(g){c.bindTexture(a.TEXTURE_CUBE_MAP,f.__webglTexture);r(a.TEXTURE_CUBE_MAP,b.texture,k);for(m=0;6>m;m++)t(e.__webglFramebuffer[m],b,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+m);b.texture.generateMipmaps&&k&&a.generateMipmap(a.TEXTURE_CUBE_MAP);c.bindTexture(a.TEXTURE_CUBE_MAP, -null)}else c.bindTexture(a.TEXTURE_2D,f.__webglTexture),r(a.TEXTURE_2D,b.texture,k),t(e.__webglFramebuffer,b,a.COLOR_ATTACHMENT0,a.TEXTURE_2D),b.texture.generateMipmaps&&k&&a.generateMipmap(a.TEXTURE_2D),c.bindTexture(a.TEXTURE_2D,null);if(b.depthBuffer){e=d.get(b);f=b&&b.isWebGLRenderTargetCube;if(b.depthTexture){if(f)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");a.bindFramebuffer(a.FRAMEBUFFER, -e.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);n(b.depthTexture,0);e=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER, -a.DEPTH_ATTACHMENT,a.TEXTURE_2D,e,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,e,0);else throw Error("Unknown depthTexture format");}else if(f)for(e.__webglDepthbuffer=[],f=0;6>f;f++)a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[f]),e.__webglDepthbuffer[f]=a.createRenderbuffer(),v(e.__webglDepthbuffer[f],b);else a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=a.createRenderbuffer(),v(e.__webglDepthbuffer, -b);a.bindFramebuffer(a.FRAMEBUFFER,null)}};this.updateRenderTargetMipmap=function(b){var e=b.texture;e.generateMipmaps&&l(b)&&1003!==e.minFilter&&1006!==e.minFilter&&(b=b&&b.isWebGLRenderTargetCube?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D,e=d.get(e).__webglTexture,c.bindTexture(b,e),a.generateMipmap(b),c.bindTexture(b,null))}}function gf(){var a={};return{get:function(b){b=b.uuid;var c=a[b];void 0===c&&(c={},a[b]=c);return c},"delete":function(b){delete a[b.uuid]},clear:function(){a={}}}}function hf(a,b,c){function d(b, -c,d){var e=new Uint8Array(4),f=a.createTexture();a.bindTexture(b,f);a.texParameteri(b,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(b,a.TEXTURE_MAG_FILTER,a.NEAREST);for(b=0;b<d;b++)a.texImage2D(c+b,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,e);return f}function e(b){!0!==F[b]&&(a.enable(b),F[b]=!0)}function f(b){!1!==F[b]&&(a.disable(b),F[b]=!1)}function g(b,d,g,k,l,m,h,n){if(0!==b){e(a.BLEND);if(b!==E||n!==Ea)2===b?n?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE,a.ONE, -a.ONE)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):3===b?n?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.ZERO,a.ONE_MINUS_SRC_COLOR,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):4===b?n?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.SRC_COLOR,a.ZERO,a.SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):n?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD), -a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),E=b,Ea=n;if(5===b){l=l||d;m=m||g;h=h||k;if(d!==J||l!==ea)a.blendEquationSeparate(c(d),c(l)),J=d,ea=l;if(g!==C||k!==N||m!==z||h!==D)a.blendFuncSeparate(c(g),c(k),c(m),c(h)),C=g,N=k,z=m,D=h}else D=z=ea=N=C=J=null}else f(a.BLEND),E=b}function k(a){v.setFunc(a)}function l(b){L!==b&&(b?a.frontFace(a.CW): -a.frontFace(a.CCW),L=b)}function m(b){0!==b?(e(a.CULL_FACE),b!==M&&(1===b?a.cullFace(a.BACK):2===b?a.cullFace(a.FRONT):a.cullFace(a.FRONT_AND_BACK))):f(a.CULL_FACE);M=b}function h(b){void 0===b&&(b=a.TEXTURE0+W-1);K!==b&&(a.activeTexture(b),K=b)}function p(a,b,c,d){t.setClear(a,b,c,d)}function n(a){v.setClear(a)}function r(a){q.setClear(a)}var t=new function(){var b=!1,c=new da,d=null,e=new da;return{setMask:function(c){d===c||b||(a.colorMask(c,c,c,c),d=c)},setLocked:function(a){b=a},setClear:function(b, -d,f,g){c.set(b,d,f,g);!1===e.equals(c)&&(a.clearColor(b,d,f,g),e.copy(c))},reset:function(){b=!1;d=null;e.set(0,0,0,1)}}},v=new function(){var b=!1,c=null,d=null,g=null;return{setTest:function(b){b?e(a.DEPTH_TEST):f(a.DEPTH_TEST)},setMask:function(d){c===d||b||(a.depthMask(d),c=d)},setFunc:function(b){if(d!==b){if(b)switch(b){case 0:a.depthFunc(a.NEVER);break;case 1:a.depthFunc(a.ALWAYS);break;case 2:a.depthFunc(a.LESS);break;case 3:a.depthFunc(a.LEQUAL);break;case 4:a.depthFunc(a.EQUAL);break;case 5:a.depthFunc(a.GEQUAL); -break;case 6:a.depthFunc(a.GREATER);break;case 7:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);d=b}},setLocked:function(a){b=a},setClear:function(b){g!==b&&(a.clearDepth(b),g=b)},reset:function(){b=!1;g=d=c=null}}},q=new function(){var b=!1,c=null,d=null,g=null,k=null,l=null,m=null,h=null,n=null;return{setTest:function(b){b?e(a.STENCIL_TEST):f(a.STENCIL_TEST)},setMask:function(d){c===d||b||(a.stencilMask(d),c=d)},setFunc:function(b,c,e){if(d!==b||g!==c||k!== -e)a.stencilFunc(b,c,e),d=b,g=c,k=e},setOp:function(b,c,d){if(l!==b||m!==c||h!==d)a.stencilOp(b,c,d),l=b,m=c,h=d},setLocked:function(a){b=a},setClear:function(b){n!==b&&(a.clearStencil(b),n=b)},reset:function(){b=!1;n=h=m=l=k=g=d=c=null}}},w=a.getParameter(a.MAX_VERTEX_ATTRIBS),x=new Uint8Array(w),T=new Uint8Array(w),y=new Uint8Array(w),F={},G=null,E=null,J=null,C=null,N=null,ea=null,z=null,D=null,Ea=!1,L=null,M=null,O=null,Q=null,I=null,V=null,W=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),K=null,H= -{},P=new da,S=new da,bb={};bb[a.TEXTURE_2D]=d(a.TEXTURE_2D,a.TEXTURE_2D,1);bb[a.TEXTURE_CUBE_MAP]=d(a.TEXTURE_CUBE_MAP,a.TEXTURE_CUBE_MAP_POSITIVE_X,6);return{buffers:{color:t,depth:v,stencil:q},init:function(){p(0,0,0,1);n(1);r(0);e(a.DEPTH_TEST);k(3);l(!1);m(1);e(a.CULL_FACE);e(a.BLEND);g(1)},initAttributes:function(){for(var a=0,b=x.length;a<b;a++)x[a]=0},enableAttribute:function(c){x[c]=1;0===T[c]&&(a.enableVertexAttribArray(c),T[c]=1);0!==y[c]&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c, -0),y[c]=0)},enableAttributeAndDivisor:function(b,c,d){x[b]=1;0===T[b]&&(a.enableVertexAttribArray(b),T[b]=1);y[b]!==c&&(d.vertexAttribDivisorANGLE(b,c),y[b]=c)},disableUnusedAttributes:function(){for(var b=0,c=T.length;b!==c;++b)T[b]!==x[b]&&(a.disableVertexAttribArray(b),T[b]=0)},enable:e,disable:f,getCompressedTextureFormats:function(){if(null===G&&(G=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")||b.get("WEBGL_compressed_texture_etc1")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS), -d=0;d<c.length;d++)G.push(c[d]);return G},setBlending:g,setColorWrite:function(a){t.setMask(a)},setDepthTest:function(a){v.setTest(a)},setDepthWrite:function(a){v.setMask(a)},setDepthFunc:k,setStencilTest:function(a){q.setTest(a)},setStencilWrite:function(a){q.setMask(a)},setStencilFunc:function(a,b,c){q.setFunc(a,b,c)},setStencilOp:function(a,b,c){q.setOp(a,b,c)},setFlipSided:l,setCullFace:m,setLineWidth:function(b){b!==O&&(a.lineWidth(b),O=b)},setPolygonOffset:function(b,c,d){if(b){if(e(a.POLYGON_OFFSET_FILL), -Q!==c||I!==d)a.polygonOffset(c,d),Q=c,I=d}else f(a.POLYGON_OFFSET_FILL)},getScissorTest:function(){return V},setScissorTest:function(b){(V=b)?e(a.SCISSOR_TEST):f(a.SCISSOR_TEST)},activeTexture:h,bindTexture:function(b,c){null===K&&h();var d=H[K];void 0===d&&(d={type:void 0,texture:void 0},H[K]=d);if(d.type!==b||d.texture!==c)a.bindTexture(b,c||bb[b]),d.type=b,d.texture=c},compressedTexImage2D:function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(b){console.error(b)}},texImage2D:function(){try{a.texImage2D.apply(a, -arguments)}catch(b){console.error(b)}},clearColor:p,clearDepth:n,clearStencil:r,scissor:function(b){!1===P.equals(b)&&(a.scissor(b.x,b.y,b.z,b.w),P.copy(b))},viewport:function(b){!1===S.equals(b)&&(a.viewport(b.x,b.y,b.z,b.w),S.copy(b))},reset:function(){for(var b=0;b<T.length;b++)1===T[b]&&(a.disableVertexAttribArray(b),T[b]=0);F={};K=G=null;H={};M=L=E=null;t.reset();v.reset();q.reset()}}}function jf(a,b,c){function d(b){if("highp"===b){if(0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.HIGH_FLOAT).precision&& -0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT).precision)return"highp";b="mediump"}return"mediump"===b&&0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.MEDIUM_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.MEDIUM_FLOAT).precision?"mediump":"lowp"}var e,f=void 0!==c.precision?c.precision:"highp",g=d(f);g!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",g,"instead."),f=g);c=!0===c.logarithmicDepthBuffer&&!!b.get("EXT_frag_depth");var g=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS), -k=a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=a.getParameter(a.MAX_TEXTURE_SIZE),m=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE),h=a.getParameter(a.MAX_VERTEX_ATTRIBS),p=a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS),n=a.getParameter(a.MAX_VARYING_VECTORS),r=a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS),t=0<k,v=!!b.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==e)return e;var c=b.get("EXT_texture_filter_anisotropic");return e=null!==c?a.getParameter(c.MAX_TEXTURE_MAX_ANISOTROPY_EXT): -0},getMaxPrecision:d,precision:f,logarithmicDepthBuffer:c,maxTextures:g,maxVertexTextures:k,maxTextureSize:l,maxCubemapSize:m,maxAttributes:h,maxVertexUniforms:p,maxVaryings:n,maxFragmentUniforms:r,vertexTextures:t,floatFragmentTextures:v,floatVertexTextures:t&&v}}function kf(a){var b={};return{get:function(c){if(void 0!==b[c])return b[c];var d;switch(c){case "WEBGL_depth_texture":d=a.getExtension("WEBGL_depth_texture")||a.getExtension("MOZ_WEBGL_depth_texture")||a.getExtension("WEBKIT_WEBGL_depth_texture"); -break;case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case "WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")|| -a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case "WEBGL_compressed_texture_etc1":d=a.getExtension("WEBGL_compressed_texture_etc1");break;default:d=a.getExtension(c)}null===d&&console.warn("THREE.WebGLRenderer: "+c+" extension not supported.");return b[c]=d}}}function lf(){function a(){m.value!==d&&(m.value=d,m.needsUpdate=0<e);c.numPlanes=e}function b(a,b,d,e){var f=null!==a?a.length:0,g=null;if(0!==f){g=m.value;if(!0!==e||null===g){e=d+4*f;b=b.matrixWorldInverse;l.getNormalMatrix(b); -if(null===g||g.length<e)g=new Float32Array(e);for(e=0;e!==f;++e,d+=4)k.copy(a[e]).applyMatrix4(b,l),k.normal.toArray(g,d),g[d+3]=k.constant}m.value=g;m.needsUpdate=!0}c.numPlanes=f;return g}var c=this,d=null,e=0,f=!1,g=!1,k=new fa,l=new ya,m={value:null,needsUpdate:!1};this.uniform=m;this.numPlanes=0;this.init=function(a,c,g){var k=0!==a.length||c||0!==e||f;f=c;d=b(a,g,0);e=a.length;return k};this.beginShadows=function(){g=!0;b(null)};this.endShadows=function(){g=!1;a()};this.setState=function(c, -k,l,h,t){if(!f||null===c||0===c.length||g&&!k)g?b(null):a();else{k=g?0:e;var v=4*k,q=h.clippingState||null;m.value=q;q=b(c,l,v,t);for(c=0;c!==v;++c)q[c]=d[c];h.clippingState=q;this.numPlanes+=k}}}function od(a){function b(a,b,c,d){!0===J&&(a*=d,b*=d,c*=d);X.clearColor(a,b,c,d)}function c(){X.init();X.scissor(Z.copy(ha).multiplyScalar(Oa));X.viewport(Va.copy(ga).multiplyScalar(Oa));b(Ba.r,Ba.g,Ba.b,Qa)}function d(){U=S=null;R="";K=-1;X.reset()}function e(a){a.preventDefault();d();c();fa.clear()}function f(a){a= -a.target;a.removeEventListener("dispose",f);g(a);fa["delete"](a)}function g(a){var b=fa.get(a).program;a.program=void 0;void 0!==b&&ta.releaseProgram(b)}function k(a,b){return Math.abs(b[0])-Math.abs(a[0])}function l(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.program&&b.material.program&&a.material.program!==b.material.program?a.material.program.id-b.material.program.id:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!== -b.z?a.z-b.z:a.id-b.id}function m(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function u(a,b,c,d,e){var f;c.transparent?(d=D,f=++Ea):(d=ea,f=++z);f=d[f];void 0!==f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=Y.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:Y.z,group:e},d.push(f))}function p(a){if(!na.intersectsSphere(a))return!1;var b=ca.numPlanes;if(0===b)return!0;var c=Q.clippingPlanes,d=a.center; -a=-a.radius;var e=0;do if(c[e].distanceToPoint(d)<a)return!1;while(++e!==b);return!0}function n(a,b){if(!1!==a.visible){if(0!==(a.layers.mask&b.layers.mask))if(a.isLight)N.push(a);else if(a.isSprite){var c;(c=!1===a.frustumCulled)||(la.center.set(0,0,0),la.radius=.7071067811865476,la.applyMatrix4(a.matrixWorld),c=!0===p(la));c&&M.push(a)}else if(a.isLensFlare)O.push(a);else if(a.isImmediateRenderObject)!0===Q.sortObjects&&(Y.setFromMatrixPosition(a.matrixWorld),Y.applyProjection(qa)),u(a,null,a.material, -Y.z,null);else if(a.isMesh||a.isLine||a.isPoints)if(a.isSkinnedMesh&&a.skeleton.update(),(c=!1===a.frustumCulled)||(c=a.geometry,null===c.boundingSphere&&c.computeBoundingSphere(),la.copy(c.boundingSphere).applyMatrix4(a.matrixWorld),c=!0===p(la)),c){var d=a.material;if(!0===d.visible)if(!0===Q.sortObjects&&(Y.setFromMatrixPosition(a.matrixWorld),Y.applyProjection(qa)),c=ra.update(a),d.isMultiMaterial)for(var e=c.groups,f=d.materials,d=0,g=e.length;d<g;d++){var k=e[d],l=f[k.materialIndex];!0===l.visible&& -u(a,c,l,Y.z,k)}else u(a,c,d,Y.z,null)}c=a.children;d=0;for(g=c.length;d<g;d++)n(c[d],b)}}function r(a,b,c,d){for(var e=0,f=a.length;e<f;e++){var g=a[e],k=g.object,l=g.geometry,m=void 0===d?g.material:d,g=g.group;k.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,k.matrixWorld);k.normalMatrix.getNormalMatrix(k.modelViewMatrix);if(k.isImmediateRenderObject){t(m);var h=v(b,c,m,k);R="";k.render(function(a){Q.renderBufferImmediate(a,h,m)})}else{if(null!==k.onBeforeRender)k.onBeforeRender();Q.renderBufferDirect(b, -c,l,m,k,g)}}}function t(a){2===a.side?X.disable(B.CULL_FACE):X.enable(B.CULL_FACE);X.setFlipSided(1===a.side);!0===a.transparent?X.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha,a.premultipliedAlpha):X.setBlending(0);X.setDepthFunc(a.depthFunc);X.setDepthTest(a.depthTest);X.setDepthWrite(a.depthWrite);X.setColorWrite(a.colorWrite);X.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function v(a,b,c,d){ba= -0;var e=fa.get(c);oa&&(pa||a!==U)&&ca.setState(c.clippingPlanes,c.clipShadows,a,e,a===U&&c.id===K);!1===c.needsUpdate&&(void 0===e.program?c.needsUpdate=!0:c.fog&&e.fog!==b?c.needsUpdate=!0:c.lights&&e.lightsHash!==aa.hash?c.needsUpdate=!0:void 0!==e.numClippingPlanes&&e.numClippingPlanes!==ca.numPlanes&&(c.needsUpdate=!0));if(c.needsUpdate){a:{var k=fa.get(c),l=ta.getParameters(c,aa,b,ca.numPlanes,d),m=ta.getProgramCode(c,l),n=k.program,p=!0;if(void 0===n)c.addEventListener("dispose",f);else if(n.code!== -m)g(c);else if(void 0!==l.shaderID)break a;else p=!1;p&&(l.shaderID?(n=Cb[l.shaderID],k.__webglShader={name:c.type,uniforms:h.UniformsUtils.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}):k.__webglShader={name:c.type,uniforms:c.uniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader},c.__webglShader=k.__webglShader,n=ta.acquireProgram(c,l,m),k.program=n,c.program=n);l=n.getAttributes();if(c.morphTargets)for(m=c.numSupportedMorphTargets=0;m<Q.maxMorphTargets;m++)0<= -l["morphTarget"+m]&&c.numSupportedMorphTargets++;if(c.morphNormals)for(m=c.numSupportedMorphNormals=0;m<Q.maxMorphNormals;m++)0<=l["morphNormal"+m]&&c.numSupportedMorphNormals++;l=k.__webglShader.uniforms;if(!c.isShaderMaterial&&!c.isRawShaderMaterial||!0===c.clipping)k.numClippingPlanes=ca.numPlanes,l.clippingPlanes=ca.uniform;k.fog=b;k.lightsHash=aa.hash;c.lights&&(l.ambientLightColor.value=aa.ambient,l.directionalLights.value=aa.directional,l.spotLights.value=aa.spot,l.pointLights.value=aa.point, -l.hemisphereLights.value=aa.hemi,l.directionalShadowMap.value=aa.directionalShadowMap,l.directionalShadowMatrix.value=aa.directionalShadowMatrix,l.spotShadowMap.value=aa.spotShadowMap,l.spotShadowMatrix.value=aa.spotShadowMatrix,l.pointShadowMap.value=aa.pointShadowMap,l.pointShadowMatrix.value=aa.pointShadowMatrix);m=k.program.getUniforms();m=Ga.seqWithValue(m.seq,l);k.uniformsList=m;k.dynamicUniforms=Ga.splitDynamic(m,l)}c.needsUpdate=!1}var u=!1,p=n=!1,k=e.program,m=k.getUniforms(),l=e.__webglShader.uniforms; -k.id!==S&&(B.useProgram(k.program),S=k.id,p=n=u=!0);c.id!==K&&(K=c.id,n=!0);if(u||a!==U){m.set(B,a,"projectionMatrix");ja.logarithmicDepthBuffer&&m.setValue(B,"logDepthBufFC",2/(Math.log(a.far+1)/Math.LN2));a!==U&&(U=a,p=n=!0);if(c.isShaderMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.envMap)u=m.map.cameraPosition,void 0!==u&&u.setValue(B,Y.setFromMatrixPosition(a.matrixWorld));(c.isMeshPhongMaterial||c.isMeshLambertMaterial||c.isMeshBasicMaterial||c.isMeshStandardMaterial||c.isShaderMaterial|| -c.skinning)&&m.setValue(B,"viewMatrix",a.matrixWorldInverse);m.set(B,Q,"toneMappingExposure");m.set(B,Q,"toneMappingWhitePoint")}c.skinning&&(m.setOptional(B,d,"bindMatrix"),m.setOptional(B,d,"bindMatrixInverse"),u=d.skeleton)&&(ja.floatVertexTextures&&u.useVertexTexture?(m.set(B,u,"boneTexture"),m.set(B,u,"boneTextureWidth"),m.set(B,u,"boneTextureHeight")):m.setOptional(B,u,"boneMatrices"));if(n){c.lights&&(n=p,l.ambientLightColor.needsUpdate=n,l.directionalLights.needsUpdate=n,l.pointLights.needsUpdate= -n,l.spotLights.needsUpdate=n,l.hemisphereLights.needsUpdate=n);b&&c.fog&&(l.fogColor.value=b.color,b.isFog?(l.fogNear.value=b.near,l.fogFar.value=b.far):b.isFogExp2&&(l.fogDensity.value=b.density));if(c.isMeshBasicMaterial||c.isMeshLambertMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.isMeshDepthMaterial){l.opacity.value=c.opacity;l.diffuse.value=c.color;c.emissive&&l.emissive.value.copy(c.emissive).multiplyScalar(c.emissiveIntensity);l.map.value=c.map;l.specularMap.value=c.specularMap; -l.alphaMap.value=c.alphaMap;c.aoMap&&(l.aoMap.value=c.aoMap,l.aoMapIntensity.value=c.aoMapIntensity);var r;c.map?r=c.map:c.specularMap?r=c.specularMap:c.displacementMap?r=c.displacementMap:c.normalMap?r=c.normalMap:c.bumpMap?r=c.bumpMap:c.roughnessMap?r=c.roughnessMap:c.metalnessMap?r=c.metalnessMap:c.alphaMap?r=c.alphaMap:c.emissiveMap&&(r=c.emissiveMap);void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),b=r.offset,r=r.repeat,l.offsetRepeat.value.set(b.x,b.y,r.x,r.y));l.envMap.value=c.envMap;l.flipEnvMap.value= -c.envMap&&c.envMap.isCubeTexture?-1:1;l.reflectivity.value=c.reflectivity;l.refractionRatio.value=c.refractionRatio}c.isLineBasicMaterial?(l.diffuse.value=c.color,l.opacity.value=c.opacity):c.isLineDashedMaterial?(l.diffuse.value=c.color,l.opacity.value=c.opacity,l.dashSize.value=c.dashSize,l.totalSize.value=c.dashSize+c.gapSize,l.scale.value=c.scale):c.isPointsMaterial?(l.diffuse.value=c.color,l.opacity.value=c.opacity,l.size.value=c.size*Oa,l.scale.value=.5*x.clientHeight,l.map.value=c.map,null!== -c.map&&(r=c.map.offset,b=c.map.repeat,l.offsetRepeat.value.set(r.x,r.y,b.x,b.y))):c.isMeshLambertMaterial?(c.lightMap&&(l.lightMap.value=c.lightMap,l.lightMapIntensity.value=c.lightMapIntensity),c.emissiveMap&&(l.emissiveMap.value=c.emissiveMap)):c.isMeshPhongMaterial?(l.specular.value=c.specular,l.shininess.value=Math.max(c.shininess,1E-4),c.lightMap&&(l.lightMap.value=c.lightMap,l.lightMapIntensity.value=c.lightMapIntensity),c.emissiveMap&&(l.emissiveMap.value=c.emissiveMap),c.bumpMap&&(l.bumpMap.value= -c.bumpMap,l.bumpScale.value=c.bumpScale),c.normalMap&&(l.normalMap.value=c.normalMap,l.normalScale.value.copy(c.normalScale)),c.displacementMap&&(l.displacementMap.value=c.displacementMap,l.displacementScale.value=c.displacementScale,l.displacementBias.value=c.displacementBias)):c.isMeshPhysicalMaterial?(l.clearCoat.value=c.clearCoat,l.clearCoatRoughness.value=c.clearCoatRoughness,A(l,c)):c.isMeshStandardMaterial?A(l,c):c.isMeshDepthMaterial?c.displacementMap&&(l.displacementMap.value=c.displacementMap, -l.displacementScale.value=c.displacementScale,l.displacementBias.value=c.displacementBias):c.isMeshNormalMaterial&&(l.opacity.value=c.opacity);Ga.upload(B,e.uniformsList,l,Q)}m.set(B,d,"modelViewMatrix");m.set(B,d,"normalMatrix");m.setValue(B,"modelMatrix",d.matrixWorld);e=e.dynamicUniforms;null!==e&&(Ga.evalDynamic(e,l,d,c,a),Ga.upload(B,e,l,Q));return k}function A(a,b){a.roughness.value=b.roughness;a.metalness.value=b.metalness;b.roughnessMap&&(a.roughnessMap.value=b.roughnessMap);b.metalnessMap&& -(a.metalnessMap.value=b.metalnessMap);b.lightMap&&(a.lightMap.value=b.lightMap,a.lightMapIntensity.value=b.lightMapIntensity);b.emissiveMap&&(a.emissiveMap.value=b.emissiveMap);b.bumpMap&&(a.bumpMap.value=b.bumpMap,a.bumpScale.value=b.bumpScale);b.normalMap&&(a.normalMap.value=b.normalMap,a.normalScale.value.copy(b.normalScale));b.displacementMap&&(a.displacementMap.value=b.displacementMap,a.displacementScale.value=b.displacementScale,a.displacementBias.value=b.displacementBias);b.envMap&&(a.envMapIntensity.value= -b.envMapIntensity)}function w(a){var b;if(1E3===a)return B.REPEAT;if(1001===a)return B.CLAMP_TO_EDGE;if(1002===a)return B.MIRRORED_REPEAT;if(1003===a)return B.NEAREST;if(1004===a)return B.NEAREST_MIPMAP_NEAREST;if(1005===a)return B.NEAREST_MIPMAP_LINEAR;if(1006===a)return B.LINEAR;if(1007===a)return B.LINEAR_MIPMAP_NEAREST;if(1008===a)return B.LINEAR_MIPMAP_LINEAR;if(1009===a)return B.UNSIGNED_BYTE;if(1017===a)return B.UNSIGNED_SHORT_4_4_4_4;if(1018===a)return B.UNSIGNED_SHORT_5_5_5_1;if(1019===a)return B.UNSIGNED_SHORT_5_6_5; -if(1010===a)return B.BYTE;if(1011===a)return B.SHORT;if(1012===a)return B.UNSIGNED_SHORT;if(1013===a)return B.INT;if(1014===a)return B.UNSIGNED_INT;if(1015===a)return B.FLOAT;b=ia.get("OES_texture_half_float");if(null!==b&&1016===a)return b.HALF_FLOAT_OES;if(1021===a)return B.ALPHA;if(1022===a)return B.RGB;if(1023===a)return B.RGBA;if(1024===a)return B.LUMINANCE;if(1025===a)return B.LUMINANCE_ALPHA;if(1026===a)return B.DEPTH_COMPONENT;if(1027===a)return B.DEPTH_STENCIL;if(100===a)return B.FUNC_ADD; -if(101===a)return B.FUNC_SUBTRACT;if(102===a)return B.FUNC_REVERSE_SUBTRACT;if(200===a)return B.ZERO;if(201===a)return B.ONE;if(202===a)return B.SRC_COLOR;if(203===a)return B.ONE_MINUS_SRC_COLOR;if(204===a)return B.SRC_ALPHA;if(205===a)return B.ONE_MINUS_SRC_ALPHA;if(206===a)return B.DST_ALPHA;if(207===a)return B.ONE_MINUS_DST_ALPHA;if(208===a)return B.DST_COLOR;if(209===a)return B.ONE_MINUS_DST_COLOR;if(210===a)return B.SRC_ALPHA_SATURATE;b=ia.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(2001=== -a)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(2002===a)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(2003===a)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(2004===a)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=ia.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(2100===a)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(2101===a)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(2102===a)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(2103===a)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=ia.get("WEBGL_compressed_texture_etc1"); -if(null!==b&&2151===a)return b.COMPRESSED_RGB_ETC1_WEBGL;b=ia.get("EXT_blend_minmax");if(null!==b){if(103===a)return b.MIN_EXT;if(104===a)return b.MAX_EXT}b=ia.get("WEBGL_depth_texture");return null!==b&&1020===a?b.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer","81");a=a||{};var x=void 0!==a.canvas?a.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),T=void 0!==a.context?a.context:null,y=void 0!==a.alpha?a.alpha:!1,F=void 0!==a.depth?a.depth:!0,G=void 0!==a.stencil? -a.stencil:!0,E=void 0!==a.antialias?a.antialias:!1,J=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,C=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,N=[],ea=[],z=-1,D=[],Ea=-1,L=new Float32Array(8),M=[],O=[];this.domElement=x;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor=2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMappingWhitePoint= -this.toneMappingExposure=this.toneMapping=1;this.maxMorphTargets=8;this.maxMorphNormals=4;var Q=this,S=null,V=null,W=null,K=-1,R="",U=null,Z=new da,bb=null,Va=new da,ba=0,Ba=new H(0),Qa=0,Na=x.width,Mc=x.height,Oa=1,ha=new da(0,0,Na,Mc),ka=!1,ga=new da(0,0,Na,Mc),na=new dc,ca=new lf,oa=!1,pa=!1,la=new Aa,qa=new P,Y=new q,aa={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[], -hemi:[],shadows:[]},ma={calls:0,vertices:0,faces:0,points:0};this.info={render:ma,memory:{geometries:0,textures:0},programs:null};var B;try{y={alpha:y,depth:F,stencil:G,antialias:E,premultipliedAlpha:J,preserveDrawingBuffer:C};B=T||x.getContext("webgl",y)||x.getContext("experimental-webgl",y);if(null===B){if(null!==x.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}void 0===B.getShaderPrecisionFormat&&(B.getShaderPrecisionFormat= -function(){return{rangeMin:1,rangeMax:1,precision:1}});x.addEventListener("webglcontextlost",e,!1)}catch(mf){console.error("THREE.WebGLRenderer: "+mf)}var ia=new kf(B);ia.get("WEBGL_depth_texture");ia.get("OES_texture_float");ia.get("OES_texture_float_linear");ia.get("OES_texture_half_float");ia.get("OES_texture_half_float_linear");ia.get("OES_standard_derivatives");ia.get("ANGLE_instanced_arrays");ia.get("OES_element_index_uint")&&(I.MaxIndex=4294967296);var ja=new jf(B,ia,a),X=new hf(B,ia,w),fa= -new gf,sa=new ff(B,ia,X,fa,ja,w,this.info),ra=new ef(B,fa,this.info),ta=new cf(this,ja),ya=new Ve;this.info.programs=ta.programs;var Fa=new Ue(B,ia,ma),Ha=new Te(B,ia,ma),Ja=new Db(-1,1,1,-1,0,1),wa=new Ca,za=new va(new eb(2,2),new Ia({depthTest:!1,depthWrite:!1,fog:!1}));a=Cb.cube;var ua=new va(new db(5,5,5),new Da({uniforms:a.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}));c();this.context=B;this.capabilities=ja;this.extensions=ia; -this.properties=fa;this.state=X;var Ka=new $d(this,aa,ra,ja);this.shadowMap=Ka;var La=new Se(this,M),Pa=new Qe(this,O);this.getContext=function(){return B};this.getContextAttributes=function(){return B.getContextAttributes()};this.forceContextLoss=function(){ia.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){return ja.getMaxAnisotropy()};this.getPrecision=function(){return ja.precision};this.getPixelRatio=function(){return Oa};this.setPixelRatio=function(a){void 0!==a&&(Oa= -a,this.setSize(ga.z,ga.w,!1))};this.getSize=function(){return{width:Na,height:Mc}};this.setSize=function(a,b,c){Na=a;Mc=b;x.width=a*Oa;x.height=b*Oa;!1!==c&&(x.style.width=a+"px",x.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){X.viewport(ga.set(a,b,c,d))};this.setScissor=function(a,b,c,d){X.scissor(ha.set(a,b,c,d))};this.setScissorTest=function(a){X.setScissorTest(ka=a)};this.getClearColor=function(){return Ba};this.setClearColor=function(a,c){Ba.set(a);Qa=void 0!== -c?c:1;b(Ba.r,Ba.g,Ba.b,Qa)};this.getClearAlpha=function(){return Qa};this.setClearAlpha=function(a){Qa=a;b(Ba.r,Ba.g,Ba.b,Qa)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=B.COLOR_BUFFER_BIT;if(void 0===b||b)d|=B.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=B.STENCIL_BUFFER_BIT;B.clear(d)};this.clearColor=function(){this.clear(!0,!1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a); -this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){D=[];Ea=-1;ea=[];z=-1;x.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){X.initAttributes();var d=fa.get(a);a.hasPositions&&!d.position&&(d.position=B.createBuffer());a.hasNormals&&!d.normal&&(d.normal=B.createBuffer());a.hasUvs&&!d.uv&&(d.uv=B.createBuffer());a.hasColors&&!d.color&&(d.color=B.createBuffer());b=b.getAttributes();a.hasPositions&&(B.bindBuffer(B.ARRAY_BUFFER,d.position),B.bufferData(B.ARRAY_BUFFER, -a.positionArray,B.DYNAMIC_DRAW),X.enableAttribute(b.position),B.vertexAttribPointer(b.position,3,B.FLOAT,!1,0,0));if(a.hasNormals){B.bindBuffer(B.ARRAY_BUFFER,d.normal);if(!c.isMeshPhongMaterial&&!c.isMeshStandardMaterial&&1===c.shading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,k=(g[e+0]+g[e+3]+g[e+6])/3,l=(g[e+1]+g[e+4]+g[e+7])/3,m=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=k;g[e+1]=l;g[e+2]=m;g[e+3]=k;g[e+4]=l;g[e+5]=m;g[e+6]=k;g[e+7]=l;g[e+8]=m}B.bufferData(B.ARRAY_BUFFER,a.normalArray,B.DYNAMIC_DRAW); -X.enableAttribute(b.normal);B.vertexAttribPointer(b.normal,3,B.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(B.bindBuffer(B.ARRAY_BUFFER,d.uv),B.bufferData(B.ARRAY_BUFFER,a.uvArray,B.DYNAMIC_DRAW),X.enableAttribute(b.uv),B.vertexAttribPointer(b.uv,2,B.FLOAT,!1,0,0));a.hasColors&&0!==c.vertexColors&&(B.bindBuffer(B.ARRAY_BUFFER,d.color),B.bufferData(B.ARRAY_BUFFER,a.colorArray,B.DYNAMIC_DRAW),X.enableAttribute(b.color),B.vertexAttribPointer(b.color,3,B.FLOAT,!1,0,0));X.disableUnusedAttributes();B.drawArrays(B.TRIANGLES, -0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){t(d);var g=v(a,b,d,e),l=!1;a=c.id+"_"+g.id+"_"+d.wireframe;a!==R&&(R=a,l=!0);b=e.morphTargetInfluences;if(void 0!==b){var m=[];a=0;for(var h=b.length;a<h;a++)l=b[a],m.push([l,a]);m.sort(k);8<m.length&&(m.length=8);var n=c.morphAttributes;a=0;for(h=m.length;a<h;a++)l=m[a],L[a]=l[0],0!==l[0]?(b=l[1],!0===d.morphTargets&&n.position&&c.addAttribute("morphTarget"+a,n.position[b]),!0===d.morphNormals&&n.normal&&c.addAttribute("morphNormal"+ -a,n.normal[b])):(!0===d.morphTargets&&c.removeAttribute("morphTarget"+a),!0===d.morphNormals&&c.removeAttribute("morphNormal"+a));a=m.length;for(b=L.length;a<b;a++)L[a]=0;g.getUniforms().setValue(B,"morphTargetInfluences",L);l=!0}b=c.index;h=c.attributes.position;m=1;!0===d.wireframe&&(b=ra.getWireframeAttribute(c),m=2);null!==b?(a=Ha,a.setIndex(b)):a=Fa;if(l){a:{var l=void 0,p;if(c&&c.isInstancedBufferGeometry&&(p=ia.get("ANGLE_instanced_arrays"),null===p)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); -break a}void 0===l&&(l=0);X.initAttributes();var n=c.attributes,g=g.getAttributes(),u=d.defaultAttributeValues,r;for(r in g){var x=g[r];if(0<=x){var q=n[r];if(void 0!==q){var w=B.FLOAT,y=q.array,A=q.normalized;y instanceof Float32Array?w=B.FLOAT:y instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):y instanceof Uint16Array?w=B.UNSIGNED_SHORT:y instanceof Int16Array?w=B.SHORT:y instanceof Uint32Array?w=B.UNSIGNED_INT:y instanceof Int32Array?w=B.INT:y instanceof Int8Array? -w=B.BYTE:y instanceof Uint8Array&&(w=B.UNSIGNED_BYTE);var y=q.itemSize,G=ra.getAttributeBuffer(q);if(q&&q.isInterleavedBufferAttribute){var E=q.data,J=E.stride,q=q.offset;E&&E.isInstancedInterleavedBuffer?(X.enableAttributeAndDivisor(x,E.meshPerAttribute,p),void 0===c.maxInstancedCount&&(c.maxInstancedCount=E.meshPerAttribute*E.count)):X.enableAttribute(x);B.bindBuffer(B.ARRAY_BUFFER,G);B.vertexAttribPointer(x,y,w,A,J*E.array.BYTES_PER_ELEMENT,(l*J+q)*E.array.BYTES_PER_ELEMENT)}else q&&q.isInstancedBufferAttribute? -(X.enableAttributeAndDivisor(x,q.meshPerAttribute,p),void 0===c.maxInstancedCount&&(c.maxInstancedCount=q.meshPerAttribute*q.count)):X.enableAttribute(x),B.bindBuffer(B.ARRAY_BUFFER,G),B.vertexAttribPointer(x,y,w,A,0,l*y*q.array.BYTES_PER_ELEMENT)}else if(void 0!==u&&(w=u[r],void 0!==w))switch(w.length){case 2:B.vertexAttrib2fv(x,w);break;case 3:B.vertexAttrib3fv(x,w);break;case 4:B.vertexAttrib4fv(x,w);break;default:B.vertexAttrib1fv(x,w)}}}X.disableUnusedAttributes()}null!==b&&B.bindBuffer(B.ELEMENT_ARRAY_BUFFER, -ra.getAttributeBuffer(b))}p=0;null!==b?p=b.count:void 0!==h&&(p=h.count);b=c.drawRange.start*m;h=null!==f?f.start*m:0;r=Math.max(b,h);f=Math.max(0,Math.min(p,b+c.drawRange.count*m,h+(null!==f?f.count*m:Infinity))-1-r+1);if(0!==f){if(e.isMesh)if(!0===d.wireframe)X.setLineWidth(d.wireframeLinewidth*(null===V?Oa:1)),a.setMode(B.LINES);else switch(e.drawMode){case 0:a.setMode(B.TRIANGLES);break;case 1:a.setMode(B.TRIANGLE_STRIP);break;case 2:a.setMode(B.TRIANGLE_FAN)}else e.isLine?(d=d.linewidth,void 0=== -d&&(d=1),X.setLineWidth(d*(null===V?Oa:1)),e.isLineSegments?a.setMode(B.LINES):a.setMode(B.LINE_STRIP)):e.isPoints&&a.setMode(B.POINTS);c&&c.isInstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,r,f):a.render(r,f)}};this.render=function(a,c,d,e){if(void 0!==c&&!0!==c.isCamera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var f=a.fog;R="";K=-1;U=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===c.parent&&c.updateMatrixWorld();c.matrixWorldInverse.getInverse(c.matrixWorld); -qa.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse);na.setFromMatrix(qa);N.length=0;Ea=z=-1;M.length=0;O.length=0;pa=this.localClippingEnabled;oa=ca.init(this.clippingPlanes,pa,c);n(a,c);ea.length=z+1;D.length=Ea+1;!0===Q.sortObjects&&(ea.sort(l),D.sort(m));oa&&ca.beginShadows();for(var g=N,k=0,h=0,p=g.length;h<p;h++){var u=g[h];u.castShadow&&(aa.shadows[k++]=u)}aa.shadows.length=k;Ka.render(a,c);for(var g=N,t=u=0,v=0,q,x,w,y,A=c.matrixWorldInverse,E=0,G=0,J=0,T=0,k=0,h=g.length;k<h;k++)if(p= -g[k],q=p.color,x=p.intensity,w=p.distance,y=p.shadow&&p.shadow.map?p.shadow.map.texture:null,p.isAmbientLight)u+=q.r*x,t+=q.g*x,v+=q.b*x;else if(p.isDirectionalLight){var F=ya.get(p);F.color.copy(p.color).multiplyScalar(p.intensity);F.direction.setFromMatrixPosition(p.matrixWorld);Y.setFromMatrixPosition(p.target.matrixWorld);F.direction.sub(Y);F.direction.transformDirection(A);if(F.shadow=p.castShadow)F.shadowBias=p.shadow.bias,F.shadowRadius=p.shadow.radius,F.shadowMapSize=p.shadow.mapSize;aa.directionalShadowMap[E]= -y;aa.directionalShadowMatrix[E]=p.shadow.matrix;aa.directional[E++]=F}else if(p.isSpotLight){F=ya.get(p);F.position.setFromMatrixPosition(p.matrixWorld);F.position.applyMatrix4(A);F.color.copy(q).multiplyScalar(x);F.distance=w;F.direction.setFromMatrixPosition(p.matrixWorld);Y.setFromMatrixPosition(p.target.matrixWorld);F.direction.sub(Y);F.direction.transformDirection(A);F.coneCos=Math.cos(p.angle);F.penumbraCos=Math.cos(p.angle*(1-p.penumbra));F.decay=0===p.distance?0:p.decay;if(F.shadow=p.castShadow)F.shadowBias= -p.shadow.bias,F.shadowRadius=p.shadow.radius,F.shadowMapSize=p.shadow.mapSize;aa.spotShadowMap[J]=y;aa.spotShadowMatrix[J]=p.shadow.matrix;aa.spot[J++]=F}else if(p.isPointLight){F=ya.get(p);F.position.setFromMatrixPosition(p.matrixWorld);F.position.applyMatrix4(A);F.color.copy(p.color).multiplyScalar(p.intensity);F.distance=p.distance;F.decay=0===p.distance?0:p.decay;if(F.shadow=p.castShadow)F.shadowBias=p.shadow.bias,F.shadowRadius=p.shadow.radius,F.shadowMapSize=p.shadow.mapSize;aa.pointShadowMap[G]= -y;void 0===aa.pointShadowMatrix[G]&&(aa.pointShadowMatrix[G]=new P);Y.setFromMatrixPosition(p.matrixWorld).negate();aa.pointShadowMatrix[G].identity().setPosition(Y);aa.point[G++]=F}else p.isHemisphereLight&&(F=ya.get(p),F.direction.setFromMatrixPosition(p.matrixWorld),F.direction.transformDirection(A),F.direction.normalize(),F.skyColor.copy(p.color).multiplyScalar(x),F.groundColor.copy(p.groundColor).multiplyScalar(x),aa.hemi[T++]=F);aa.ambient[0]=u;aa.ambient[1]=t;aa.ambient[2]=v;aa.directional.length= -E;aa.spot.length=J;aa.point.length=G;aa.hemi.length=T;aa.hash=E+","+G+","+J+","+T+","+aa.shadows.length;oa&&ca.endShadows();ma.calls=0;ma.vertices=0;ma.faces=0;ma.points=0;void 0===d&&(d=null);this.setRenderTarget(d);g=a.background;null===g?b(Ba.r,Ba.g,Ba.b,Qa):g&&g.isColor&&(b(g.r,g.g,g.b,1),e=!0);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);g&&g.isCubeTexture?(wa.projectionMatrix.copy(c.projectionMatrix),wa.matrixWorld.extractRotation(c.matrixWorld), -wa.matrixWorldInverse.getInverse(wa.matrixWorld),ua.material.uniforms.tCube.value=g,ua.modelViewMatrix.multiplyMatrices(wa.matrixWorldInverse,ua.matrixWorld),ra.update(ua),Q.renderBufferDirect(wa,null,ua.geometry,ua.material,ua,null)):g&&g.isTexture&&(za.material.map=g,ra.update(za),Q.renderBufferDirect(Ja,null,za.geometry,za.material,za,null));a.overrideMaterial?(e=a.overrideMaterial,r(ea,c,f,e),r(D,c,f,e)):(X.setBlending(0),r(ea,c,f),r(D,c,f));La.render(a,c);Pa.render(a,c,Va);d&&sa.updateRenderTargetMipmap(d); -X.setDepthTest(!0);X.setDepthWrite(!0);X.setColorWrite(!0)}};this.setFaceCulling=function(a,b){X.setCullFace(a);X.setFlipSided(0===b)};this.allocTextureUnit=function(){var a=ba;a>=ja.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ja.maxTextures);ba+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), -a=!0),b=b.texture);sa.setTexture2D(b,c)}}();this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0);sa.setTexture2D(b,c)}}();this.setTextureCube=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);b&&b.isCubeTexture||Array.isArray(b.image)&& -6===b.image.length?sa.setTextureCube(b,c):sa.setTextureCubeDynamic(b,c)}}();this.getCurrentRenderTarget=function(){return V};this.setRenderTarget=function(a){(V=a)&&void 0===fa.get(a).__webglFramebuffer&&sa.setupRenderTarget(a);var b=a&&a.isWebGLRenderTargetCube,c;a?(c=fa.get(a),c=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,Z.copy(a.scissor),bb=a.scissorTest,Va.copy(a.viewport)):(c=null,Z.copy(ha).multiplyScalar(Oa),bb=ka,Va.copy(ga).multiplyScalar(Oa));W!==c&&(B.bindFramebuffer(B.FRAMEBUFFER, -c),W=c);X.scissor(Z);X.setScissorTest(bb);X.viewport(Va);b&&(b=fa.get(a.texture),B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,b.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===(a&&a.isWebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=fa.get(a).__webglFramebuffer;if(g){var k=!1;g!==W&&(B.bindFramebuffer(B.FRAMEBUFFER, -g),k=!0);try{var l=a.texture,m=l.format,h=l.type;1023!==m&&w(m)!==B.getParameter(B.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||w(h)===B.getParameter(B.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(ia.get("OES_texture_float")||ia.get("WEBGL_color_buffer_float"))||1016===h&&ia.get("EXT_color_buffer_half_float")?B.checkFramebufferStatus(B.FRAMEBUFFER)===B.FRAMEBUFFER_COMPLETE?0<=b&& -b<=a.width-d&&0<=c&&c<=a.height-e&&B.readPixels(b,c,d,e,w(m),w(h),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{k&&B.bindFramebuffer(B.FRAMEBUFFER,W)}}}}}function Eb(a,b){this.name="";this.color=new H(a);this.density=void 0!==b?b:2.5E-4}function Fb(a,b,c){this.name="";this.color= -new H(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}function fb(){D.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function pd(a,b,c,d,e){D.call(this);this.lensFlares=[];this.positionScreen=new q;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)}function gb(a){S.call(this);this.type="SpriteMaterial";this.color=new H(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setValues(a)}function fc(a){D.call(this); -this.type="Sprite";this.material=void 0!==a?a:new gb}function gc(){D.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function hb(a,b,c,d,e,f,g,k,l,m,h,p){ba.call(this,null,f,g,k,l,m,d,e,h,p);this.image={data:a,width:b,height:c};this.magFilter=void 0!==l?l:1003;this.minFilter=void 0!==m?m:1003;this.generateMipmaps=this.flipY=!1}function Nc(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new P;a=a||[];this.bones=a.slice(0);this.useVertexTexture? -(a=Math.sqrt(4*this.bones.length),a=h.Math.nextPowerOfTwo(Math.ceil(a)),this.boneTextureHeight=this.boneTextureWidth=a=Math.max(a,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new hb(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,1023,1015)):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."), -this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new P)}function Oc(a){D.call(this);this.type="Bone";this.skin=a}function Pc(a,b,c){va.call(this,a,b);this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new P;this.bindMatrixInverse=new P;a=[];if(this.geometry&&void 0!==this.geometry.bones){for(var d,e=0,f=this.geometry.bones.length;e<f;++e)d=this.geometry.bones[e],b=new Oc(this),a.push(b),b.name=d.name,b.position.fromArray(d.pos),b.quaternion.fromArray(d.rotq), -void 0!==d.scl&&b.scale.fromArray(d.scl);e=0;for(f=this.geometry.bones.length;e<f;++e)d=this.geometry.bones[e],-1!==d.parent&&null!==d.parent&&void 0!==a[d.parent]?a[d.parent].add(a[e]):this.add(a[e])}this.normalizeSkinWeights();this.updateMatrixWorld(!0);this.bind(new Nc(a,void 0,c),this.matrixWorld)}function na(a){S.call(this);this.type="LineBasicMaterial";this.color=new H(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.lights=!1;this.setValues(a)}function Pa(a,b,c){if(1===c)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."), -new ha(a,b);D.call(this);this.type="Line";this.geometry=void 0!==a?a:new I;this.material=void 0!==b?b:new na({color:16777215*Math.random()})}function ha(a,b){Pa.call(this,a,b);this.type="LineSegments"}function Ja(a){S.call(this);this.type="PointsMaterial";this.color=new H(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.lights=!1;this.setValues(a)}function Gb(a,b){D.call(this);this.type="Points";this.geometry=void 0!==a?a:new I;this.material=void 0!==b?b:new Ja({color:16777215*Math.random()})} -function hc(){D.call(this);this.type="Group"}function Qc(a,b,c,d,e,f,g,k,l){function m(){requestAnimationFrame(m);a.readyState>=a.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}ba.call(this,a,b,c,d,e,f,g,k,l);this.generateMipmaps=!1;var h=this;m()}function Hb(a,b,c,d,e,f,g,k,l,m,h,p){ba.call(this,null,f,g,k,l,m,d,e,h,p);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Rc(a,b,c,d,e,f,g,k,l){ba.call(this,a,b,c,d,e,f,g,k,l);this.needsUpdate=!0}function ic(a,b,c,d,e,f,g, -k,l,m){m=void 0!==m?m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");ba.call(this,null,d,e,f,g,k,m,c,l);this.image={width:a,height:b};this.type=void 0!==c?c:1012;this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==k?k:1003;this.generateMipmaps=this.flipY=!1}function Ib(a){function b(a,b){return a-b}I.call(this);var c=[0,0],d={},e=["a","b","c"];if(a&&a.isGeometry){var f=a.vertices,g=a.faces,k=0,l=new Uint32Array(6*g.length); -a=0;for(var m=g.length;a<m;a++)for(var h=g[a],p=0;3>p;p++){c[0]=h[e[p]];c[1]=h[e[(p+1)%3]];c.sort(b);var n=c.toString();void 0===d[n]&&(l[2*k]=c[0],l[2*k+1]=c[1],d[n]=!0,k++)}c=new Float32Array(6*k);a=0;for(m=k;a<m;a++)for(p=0;2>p;p++)d=f[l[2*a+p]],k=6*a+3*p,c[k+0]=d.x,c[k+1]=d.y,c[k+2]=d.z;this.addAttribute("position",new z(c,3))}else if(a&&a.isBufferGeometry){if(null!==a.index){m=a.index.array;f=a.attributes.position;e=a.groups;k=0;0===e.length&&a.addGroup(0,m.length);l=new Uint32Array(2*m.length); -g=0;for(h=e.length;g<h;++g){a=e[g];p=a.start;n=a.count;a=p;for(var r=p+n;a<r;a+=3)for(p=0;3>p;p++)c[0]=m[a+p],c[1]=m[a+(p+1)%3],c.sort(b),n=c.toString(),void 0===d[n]&&(l[2*k]=c[0],l[2*k+1]=c[1],d[n]=!0,k++)}c=new Float32Array(6*k);a=0;for(m=k;a<m;a++)for(p=0;2>p;p++)k=6*a+3*p,d=l[2*a+p],c[k+0]=f.getX(d),c[k+1]=f.getY(d),c[k+2]=f.getZ(d)}else for(f=a.attributes.position.array,k=f.length/3,l=k/3,c=new Float32Array(6*k),a=0,m=l;a<m;a++)for(p=0;3>p;p++)k=18*a+6*p,l=9*a+3*p,c[k+0]=f[l],c[k+1]=f[l+1], -c[k+2]=f[l+2],d=9*a+(p+1)%3*3,c[k+3]=f[d],c[k+4]=f[d+1],c[k+5]=f[d+2];this.addAttribute("position",new z(c,3))}}function jc(a,b,c){R.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],g,k,l,m,h=b+1;for(g=0;g<=c;g++)for(m=g/c,k=0;k<=b;k++)l=k/b,l=a(l,m),d.push(l);var p,n,r,t;for(g=0;g<c;g++)for(k=0;k<b;k++)a=g*h+k,d=g*h+k+1,m=(g+1)*h+k+1,l=(g+1)*h+k,p=new C(k/b,g/c),n=new C((k+1)/b,g/c),r=new C((k+1)/b,(g+1)/ -c),t=new C(k/b,(g+1)/c),e.push(new ga(a,d,l)),f.push([p,n,t]),e.push(new ga(d,m,l)),f.push([n.clone(),r,t.clone()]);this.computeFaceNormals();this.computeVertexNormals()}function sa(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=l.vertices.push(b)-1;b.uv=new C(Math.atan2(a.z,-a.x)/2/Math.PI+.5,1-(Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5));return b}function f(a,b,c){var d=new ga(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);l.faces.push(d);A.copy(a).add(b).add(c).divideScalar(3); -d=Math.atan2(A.z,-A.x);l.faceVertexUvs[0].push([k(a.uv,a,d),k(b.uv,b,d),k(c.uv,c,d)])}function g(a,b){for(var c=Math.pow(2,b),d=e(l.vertices[a.a]),g=e(l.vertices[a.b]),k=e(l.vertices[a.c]),m=[],h=0;h<=c;h++){m[h]=[];for(var n=e(d.clone().lerp(k,h/c)),p=e(g.clone().lerp(k,h/c)),u=c-h,r=0;r<=u;r++)m[h][r]=0===r&&h===c?n:e(n.clone().lerp(p,r/u))}for(h=0;h<c;h++)for(r=0;r<2*(c-h)-1;r++)d=Math.floor(r/2),0===r%2?f(m[h][d+1],m[h+1][d],m[h][d]):f(m[h][d+1],m[h+1][d+1],m[h+1][d])}function k(a,b,c){0>c&&1=== -a.x&&(a=new C(a.x-1,a.y));0===b.x&&0===b.z&&(a=new C(c/2/Math.PI+.5,a.y));return a.clone()}R.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var l=this,m=0,h=a.length;m<h;m+=3)e(new q(a[m],a[m+1],a[m+2]));a=this.vertices;for(var p=[],n=m=0,h=b.length;m<h;m+=3,n++){var r=a[b[m]],t=a[b[m+1]],v=a[b[m+2]];p[n]=new ga(r.index,t.index,v.index,[r.clone(),t.clone(),v.clone()])}for(var A=new q,m=0,h=p.length;m<h;m++)g(p[m],d);m=0;for(h=this.faceVertexUvs[0].length;m< -h;m++)b=this.faceVertexUvs[0][m],d=b[0].x,a=b[1].x,p=b[2].x,n=Math.min(d,a,p),.9<Math.max(d,a,p)&&.1>n&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>p&&(b[2].x+=1));m=0;for(h=this.vertices.length;m<h;m++)this.vertices[m].multiplyScalar(c);this.mergeVertices();this.computeFaceNormals();this.boundingSphere=new Aa(new q,c)}function kc(a,b){sa.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b}}function lc(a,b){sa.call(this, -[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b}}function mc(a,b){var c=(1+Math.sqrt(5))/2;sa.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b}} -function nc(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;sa.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronGeometry"; -this.parameters={radius:a,detail:b}}function wa(a,b,c,d,e,f){R.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e,taper:f};b=b||64;c=c||1;d=d||8;e=e||!1;f=f||wa.NoTaper;var g=[],k,l,m=b+1,h,p,n,r,t,v=new q,A,w,x;A=new wa.FrenetFrames(a,b,e);w=A.normals;x=A.binormals;this.tangents=A.tangents;this.normals=w;this.binormals=x;for(A=0;A<m;A++)for(g[A]=[],h=A/(m-1),t=a.getPointAt(h),k=w[A],l=x[A],n=c*f(h),h=0;h<d;h++)p=h/d*2*Math.PI,r=-n*Math.cos(p), -p=n*Math.sin(p),v.copy(t),v.x+=r*k.x+p*l.x,v.y+=r*k.y+p*l.y,v.z+=r*k.z+p*l.z,g[A][h]=this.vertices.push(new q(v.x,v.y,v.z))-1;for(A=0;A<b;A++)for(h=0;h<d;h++)f=e?(A+1)%b:A+1,m=(h+1)%d,a=g[A][h],c=g[f][h],f=g[f][m],m=g[A][m],v=new C(A/b,h/d),w=new C((A+1)/b,h/d),x=new C((A+1)/b,(h+1)/d),k=new C(A/b,(h+1)/d),this.faces.push(new ga(a,c,m)),this.faceVertexUvs[0].push([v,w,k]),this.faces.push(new ga(c,f,m)),this.faceVertexUvs[0].push([w.clone(),x,k.clone()]);this.computeFaceNormals();this.computeVertexNormals()} -function Jb(a,b,c,d,e,f){function g(a,b,c,d,e){var f=Math.sin(a);b=c/b*a;c=Math.cos(b);e.x=d*(2+c)*.5*Math.cos(a);e.y=d*(2+c)*f*.5;e.z=d*Math.sin(b)*.5}I.call(this);this.type="TorusKnotBufferGeometry";this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:e,q:f};a=a||100;b=b||40;c=Math.floor(c)||64;d=Math.floor(d)||8;e=e||2;f=f||3;var k=(d+1)*(c+1),l=d*c*6,l=new z(new (65535<l?Uint32Array:Uint16Array)(l),1),m=new z(new Float32Array(3*k),3),h=new z(new Float32Array(3*k),3),k=new z(new Float32Array(2* -k),2),p,n,r=0,t=0,v=new q,A=new q,w=new C,x=new q,T=new q,y=new q,F=new q,G=new q;for(p=0;p<=c;++p)for(n=p/c*e*Math.PI*2,g(n,e,f,a,x),g(n+.01,e,f,a,T),F.subVectors(T,x),G.addVectors(T,x),y.crossVectors(F,G),G.crossVectors(y,F),y.normalize(),G.normalize(),n=0;n<=d;++n){var E=n/d*Math.PI*2,J=-b*Math.cos(E),E=b*Math.sin(E);v.x=x.x+(J*G.x+E*y.x);v.y=x.y+(J*G.y+E*y.y);v.z=x.z+(J*G.z+E*y.z);m.setXYZ(r,v.x,v.y,v.z);A.subVectors(v,x).normalize();h.setXYZ(r,A.x,A.y,A.z);w.x=p/c;w.y=n/d;k.setXY(r,w.x,w.y); -r++}for(n=1;n<=c;n++)for(p=1;p<=d;p++)a=(d+1)*n+(p-1),b=(d+1)*n+p,e=(d+1)*(n-1)+p,l.setX(t,(d+1)*(n-1)+(p-1)),t++,l.setX(t,a),t++,l.setX(t,e),t++,l.setX(t,a),t++,l.setX(t,b),t++,l.setX(t,e),t++;this.setIndex(l);this.addAttribute("position",m);this.addAttribute("normal",h);this.addAttribute("uv",k)}function oc(a,b,c,d,e,f,g){R.call(this);this.type="TorusKnotGeometry";this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:e,q:f};void 0!==g&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."); -this.fromBufferGeometry(new Jb(a,b,c,d,e,f));this.mergeVertices()}function Kb(a,b,c,d,e){I.call(this);this.type="TorusBufferGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=Math.floor(c)||8;d=Math.floor(d)||6;e=e||2*Math.PI;var f=(c+1)*(d+1),g=c*d*6,g=new (65535<g?Uint32Array:Uint16Array)(g),k=new Float32Array(3*f),l=new Float32Array(3*f),f=new Float32Array(2*f),m=0,h=0,p=0,n=new q,r=new q,t=new q,v,A;for(v=0;v<=c;v++)for(A=0;A<=d;A++){var w= -A/d*e,x=v/c*Math.PI*2;r.x=(a+b*Math.cos(x))*Math.cos(w);r.y=(a+b*Math.cos(x))*Math.sin(w);r.z=b*Math.sin(x);k[m]=r.x;k[m+1]=r.y;k[m+2]=r.z;n.x=a*Math.cos(w);n.y=a*Math.sin(w);t.subVectors(r,n).normalize();l[m]=t.x;l[m+1]=t.y;l[m+2]=t.z;f[h]=A/d;f[h+1]=v/c;m+=3;h+=2}for(v=1;v<=c;v++)for(A=1;A<=d;A++)a=(d+1)*(v-1)+A-1,b=(d+1)*(v-1)+A,e=(d+1)*v+A,g[p]=(d+1)*v+A-1,g[p+1]=a,g[p+2]=e,g[p+3]=a,g[p+4]=b,g[p+5]=e,p+=6;this.setIndex(new z(g,1));this.addAttribute("position",new z(k,3));this.addAttribute("normal", -new z(l,3));this.addAttribute("uv",new z(f,2))}function pc(a,b,c,d,e){R.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};this.fromBufferGeometry(new Kb(a,b,c,d,e))}function ra(a,b){"undefined"!==typeof a&&(R.call(this),this.type="ExtrudeGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeFaceNormals())}function qc(a,b){b=b||{};var c=b.font;if(!1===(c&&c.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."), -new R;c=c.generateShapes(a,b.size,b.curveSegments);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);ra.call(this,c,b);this.type="TextGeometry"}function ib(a,b,c,d,e,f,g){I.call(this);this.type="SphereBufferGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)|| -6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;f=void 0!==f?f:0;g=void 0!==g?g:Math.PI;for(var k=f+g,l=(b+1)*(c+1),m=new z(new Float32Array(3*l),3),h=new z(new Float32Array(3*l),3),l=new z(new Float32Array(2*l),2),p=0,n=[],r=new q,t=0;t<=c;t++){for(var v=[],A=t/c,w=0;w<=b;w++){var x=w/b,T=-a*Math.cos(d+x*e)*Math.sin(f+A*g),y=a*Math.cos(f+A*g),F=a*Math.sin(d+x*e)*Math.sin(f+A*g);r.set(T,y,F).normalize();m.setXYZ(p,T,y,F);h.setXYZ(p,r.x,r.y,r.z);l.setXY(p,x,1-A);v.push(p);p++}n.push(v)}d=[];for(t=0;t< -c;t++)for(w=0;w<b;w++)e=n[t][w+1],g=n[t][w],p=n[t+1][w],r=n[t+1][w+1],(0!==t||0<f)&&d.push(e,g,r),(t!==c-1||k<Math.PI)&&d.push(g,p,r);this.setIndex(new (65535<m.count?ce:be)(d,1));this.addAttribute("position",m);this.addAttribute("normal",h);this.addAttribute("uv",l);this.boundingSphere=new Aa(new q,a)}function Lb(a,b,c,d,e,f,g){R.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};this.fromBufferGeometry(new ib(a, -b,c,d,e,f,g))}function Mb(a,b,c,d,e,f){I.call(this);this.type="RingBufferGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f};a=a||20;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(1,d):1;var g=(c+1)*(d+1),k=c*d*6,k=new z(new (65535<k?Uint32Array:Uint16Array)(k),1),l=new z(new Float32Array(3*g),3),m=new z(new Float32Array(3*g),3),g=new z(new Float32Array(2*g),2),h=0,p=0,n,r=a,t=(b-a)/ -d,v=new q,A=new C,w;for(a=0;a<=d;a++){for(w=0;w<=c;w++)n=e+w/c*f,v.x=r*Math.cos(n),v.y=r*Math.sin(n),l.setXYZ(h,v.x,v.y,v.z),m.setXYZ(h,0,0,1),A.x=(v.x/b+1)/2,A.y=(v.y/b+1)/2,g.setXY(h,A.x,A.y),h++;r+=t}for(a=0;a<d;a++)for(b=a*(c+1),w=0;w<c;w++)e=n=w+b,f=n+c+1,h=n+c+2,n+=1,k.setX(p,e),p++,k.setX(p,f),p++,k.setX(p,h),p++,k.setX(p,e),p++,k.setX(p,h),p++,k.setX(p,n),p++;this.setIndex(k);this.addAttribute("position",l);this.addAttribute("normal",m);this.addAttribute("uv",g)}function rc(a,b,c,d,e,f){R.call(this); -this.type="RingGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f};this.fromBufferGeometry(new Mb(a,b,c,d,e,f))}function sc(a,b,c,d){R.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};this.fromBufferGeometry(new eb(a,b,c,d))}function Nb(a,b,c,d){I.call(this);this.type="LatheBufferGeometry";this.parameters={points:a,segments:b,phiStart:c,phiLength:d};b=Math.floor(b)||12;c=c||0;d=d|| -2*Math.PI;d=h.Math.clamp(d,0,2*Math.PI);for(var e=(b+1)*a.length,f=b*a.length*6,g=new z(new (65535<f?Uint32Array:Uint16Array)(f),1),k=new z(new Float32Array(3*e),3),l=new z(new Float32Array(2*e),2),m=0,u=0,p=1/b,n=new q,r=new C,e=0;e<=b;e++)for(var f=c+e*p*d,t=Math.sin(f),v=Math.cos(f),f=0;f<=a.length-1;f++)n.x=a[f].x*t,n.y=a[f].y,n.z=a[f].x*v,k.setXYZ(m,n.x,n.y,n.z),r.x=e/b,r.y=f/(a.length-1),l.setXY(m,r.x,r.y),m++;for(e=0;e<b;e++)for(f=0;f<a.length-1;f++)c=f+e*a.length,m=c+a.length,p=c+a.length+ -1,n=c+1,g.setX(u,c),u++,g.setX(u,m),u++,g.setX(u,n),u++,g.setX(u,m),u++,g.setX(u,p),u++,g.setX(u,n),u++;this.setIndex(g);this.addAttribute("position",k);this.addAttribute("uv",l);this.computeVertexNormals();if(d===2*Math.PI)for(d=this.attributes.normal.array,g=new q,k=new q,l=new q,c=b*a.length*3,f=e=0;e<a.length;e++,f+=3)g.x=d[f+0],g.y=d[f+1],g.z=d[f+2],k.x=d[c+f+0],k.y=d[c+f+1],k.z=d[c+f+2],l.addVectors(g,k).normalize(),d[f+0]=d[c+f+0]=l.x,d[f+1]=d[c+f+1]=l.y,d[f+2]=d[c+f+2]=l.z}function tc(a,b, -c,d){R.call(this);this.type="LatheGeometry";this.parameters={points:a,segments:b,phiStart:c,phiLength:d};this.fromBufferGeometry(new Nb(a,b,c,d));this.mergeVertices()}function Ya(a,b){R.call(this);this.type="ShapeGeometry";!1===Array.isArray(a)&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()}function Ob(a,b){function c(a,b){return a-b}I.call(this);var d=Math.cos(h.Math.DEG2RAD*(void 0!==b?b:1)),e=[0,0],f={},g=["a","b","c"],k;a&&a.isBufferGeometry?(k=new R,k.fromBufferGeometry(a)):k=a.clone(); -k.mergeVertices();k.computeFaceNormals();var l=k.vertices;k=k.faces;for(var m=0,u=k.length;m<u;m++)for(var p=k[m],n=0;3>n;n++){e[0]=p[g[n]];e[1]=p[g[(n+1)%3]];e.sort(c);var r=e.toString();void 0===f[r]?f[r]={vert1:e[0],vert2:e[1],face1:m,face2:void 0}:f[r].face2=m}e=[];for(r in f)if(g=f[r],void 0===g.face2||k[g.face1].normal.dot(k[g.face2].normal)<=d)m=l[g.vert1],e.push(m.x),e.push(m.y),e.push(m.z),m=l[g.vert2],e.push(m.x),e.push(m.y),e.push(m.z);this.addAttribute("position",new z(new Float32Array(e), -3))}function Za(a,b,c,d,e,f,g,k){function l(c){var e,f,l,h=new C,n=new q,p=0,u=!0===c?a:b,T=!0===c?1:-1;f=w;for(e=1;e<=d;e++)t.setXYZ(w,0,y*T,0),v.setXYZ(w,0,T,0),h.x=.5,h.y=.5,A.setXY(w,h.x,h.y),w++;l=w;for(e=0;e<=d;e++){var D=e/d*k+g,z=Math.cos(D),D=Math.sin(D);n.x=u*D;n.y=y*T;n.z=u*z;t.setXYZ(w,n.x,n.y,n.z);v.setXYZ(w,0,T,0);h.x=.5*z+.5;h.y=.5*D*T+.5;A.setXY(w,h.x,h.y);w++}for(e=0;e<d;e++)h=f+e,n=l+e,!0===c?(r.setX(x,n),x++,r.setX(x,n+1)):(r.setX(x,n+1),x++,r.setX(x,n)),x++,r.setX(x,h),x++,p+= -3;m.addGroup(F,p,!0===c?1:2);F+=p}I.call(this);this.type="CylinderBufferGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:k};var m=this;a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=Math.floor(d)||8;e=Math.floor(e)||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;k=void 0!==k?k:2*Math.PI;var h=0;!1===f&&(0<a&&h++,0<b&&h++);var p=function(){var a=(d+1)*(e+1);!1===f&&(a+=(d+1)*h+d*h);return a}(),n=function(){var a=d* -e*6;!1===f&&(a+=d*h*3);return a}(),r=new z(new (65535<n?Uint32Array:Uint16Array)(n),1),t=new z(new Float32Array(3*p),3),v=new z(new Float32Array(3*p),3),A=new z(new Float32Array(2*p),2),w=0,x=0,T=[],y=c/2,F=0;(function(){var f,l,h=new q,n=new q,p=0,u=(b-a)/c;for(l=0;l<=e;l++){var C=[],D=l/e,z=D*(b-a)+a;for(f=0;f<=d;f++){var L=f/d,M=L*k+g,O=Math.sin(M),M=Math.cos(M);n.x=z*O;n.y=-D*c+y;n.z=z*M;t.setXYZ(w,n.x,n.y,n.z);h.set(O,u,M).normalize();v.setXYZ(w,h.x,h.y,h.z);A.setXY(w,L,1-D);C.push(w);w++}T.push(C)}for(f= -0;f<d;f++)for(l=0;l<e;l++)h=T[l+1][f],n=T[l+1][f+1],u=T[l][f+1],r.setX(x,T[l][f]),x++,r.setX(x,h),x++,r.setX(x,u),x++,r.setX(x,h),x++,r.setX(x,n),x++,r.setX(x,u),x++,p+=6;m.addGroup(F,p,0);F+=p})();!1===f&&(0<a&&l(!0),0<b&&l(!1));this.setIndex(r);this.addAttribute("position",t);this.addAttribute("normal",v);this.addAttribute("uv",A)}function jb(a,b,c,d,e,f,g,k){R.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f, -thetaStart:g,thetaLength:k};this.fromBufferGeometry(new Za(a,b,c,d,e,f,g,k));this.mergeVertices()}function uc(a,b,c,d,e,f,g){jb.call(this,0,a,b,c,d,e,f,g);this.type="ConeGeometry";this.parameters={radius:a,height:b,radialSegments:c,heightSegments:d,openEnded:e,thetaStart:f,thetaLength:g}}function vc(a,b,c,d,e,f,g){Za.call(this,0,a,b,c,d,e,f,g);this.type="ConeBufferGeometry";this.parameters={radius:a,height:b,radialSegments:c,heightSegments:d,thetaStart:f,thetaLength:g}}function Pb(a,b,c,d){I.call(this); -this.type="CircleBufferGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e=b+2,f=new Float32Array(3*e),g=new Float32Array(3*e),e=new Float32Array(2*e);g[2]=1;e[0]=.5;e[1]=.5;for(var k=0,l=3,m=2;k<=b;k++,l+=3,m+=2){var h=c+k/b*d;f[l]=a*Math.cos(h);f[l+1]=a*Math.sin(h);g[l+2]=1;e[m]=(f[l]/a+1)/2;e[m+1]=(f[l+1]/a+1)/2}c=[];for(l=1;l<=b;l++)c.push(l,l+1,0);this.setIndex(new z(new Uint16Array(c), -1));this.addAttribute("position",new z(f,3));this.addAttribute("normal",new z(g,3));this.addAttribute("uv",new z(e,2));this.boundingSphere=new Aa(new q,a)}function wc(a,b,c,d){R.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};this.fromBufferGeometry(new Pb(a,b,c,d))}function kb(a,b,c,d,e,f){R.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new db(a, -b,c,d,e,f));this.mergeVertices()}function Qb(){Da.call(this,{uniforms:h.UniformsUtils.merge([U.lights,{opacity:{value:1}}]),vertexShader:Z.shadow_vert,fragmentShader:Z.shadow_frag});this.transparent=this.lights=!0;Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(a){this.uniforms.opacity.value=a}}})}function Rb(a){Da.call(this,a);this.type="RawShaderMaterial"}function xc(a){this.uuid=h.Math.generateUUID();this.type="MultiMaterial"; -this.materials=a instanceof Array?a:[];this.visible=!0}function Ka(a){S.call(this);this.defines={STANDARD:""};this.type="MeshStandardMaterial";this.color=new H(16777215);this.metalness=this.roughness=.5;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new H(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new C(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias= -0;this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null;this.envMapIntensity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function lb(a){Ka.call(this);this.defines={PHYSICAL:""};this.type="MeshPhysicalMaterial";this.reflectivity=.5;this.clearCoatRoughness=this.clearCoat=0;this.setValues(a)}function $a(a){S.call(this);this.type="MeshPhongMaterial"; -this.color=new H(16777215);this.specular=new H(1118481);this.shininess=30;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new H(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new C(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe= -!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function mb(a){S.call(this,a);this.type="MeshNormalMaterial";this.wireframe=!1;this.wireframeLinewidth=1;this.morphTargets=this.lights=this.fog=!1;this.setValues(a)}function nb(a){S.call(this);this.type="MeshLambertMaterial";this.color=new H(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive= -new H(0);this.emissiveIntensity=1;this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function ob(a){S.call(this);this.type="LineDashedMaterial";this.color=new H(16777215);this.scale=this.linewidth=1;this.dashSize=3;this.gapSize=1;this.lights=!1;this.setValues(a)} -function qd(a,b,c){var d=this,e=!1,f=0,g=0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)}}function za(a){this.manager=void 0!==a?a:h.DefaultLoadingManager}function ie(a){this.manager=void 0!==a?a:h.DefaultLoadingManager; -this._parser=null}function rd(a){this.manager=void 0!==a?a:h.DefaultLoadingManager;this._parser=null}function yc(a){this.manager=void 0!==a?a:h.DefaultLoadingManager}function sd(a){this.manager=void 0!==a?a:h.DefaultLoadingManager}function Sc(a){this.manager=void 0!==a?a:h.DefaultLoadingManager}function oa(a,b){D.call(this);this.type="Light";this.color=new H(a);this.intensity=void 0!==b?b:1;this.receiveShadow=void 0}function Tc(a,b,c){oa.call(this,a,c);this.type="HemisphereLight";this.castShadow= -void 0;this.position.copy(D.DefaultUp);this.updateMatrix();this.groundColor=new H(b)}function pb(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new C(512,512);this.map=null;this.matrix=new P}function Uc(){pb.call(this,new Ca(50,1,.5,500))}function Vc(a,b,c,d,e,f){oa.call(this,a,b);this.type="SpotLight";this.position.copy(D.DefaultUp);this.updateMatrix();this.target=new D;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}}); -this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new Uc}function Wc(a,b,c,d){oa.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1;this.shadow=new pb(new Ca(90,1,.5,500))}function Xc(a){pb.call(this,new Db(-5,5,5,-5,.5,500))}function Yc(a,b){oa.call(this, -a,b);this.type="DirectionalLight";this.position.copy(D.DefaultUp);this.updateMatrix();this.target=new D;this.shadow=new Xc}function Zc(a,b){oa.call(this,a,b);this.type="AmbientLight";this.castShadow=void 0}function ja(a,b,c,d){this.parameterPositions=a;this._cachedIndex=0;this.resultBuffer=void 0!==d?d:new b.constructor(c);this.sampleValues=b;this.valueSize=c}function $c(a,b,c,d){ja.call(this,a,b,c,d);this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function zc(a,b,c,d){ja.call(this, -a,b,c,d)}function ad(a,b,c,d){ja.call(this,a,b,c,d)}function qb(a,b,c,d){if(void 0===a)throw Error("track name is undefined");if(void 0===b||0===b.length)throw Error("no keyframes in track named "+a);this.name=a;this.times=h.AnimationUtils.convertArray(b,this.TimeBufferType);this.values=h.AnimationUtils.convertArray(c,this.ValueBufferType);this.setInterpolation(d||this.DefaultInterpolation);this.validate();this.optimize()}function Sb(a,b,c,d){qb.call(this,a,b,c,d)}function bd(a,b,c,d){ja.call(this, -a,b,c,d)}function Ac(a,b,c,d){qb.call(this,a,b,c,d)}function Tb(a,b,c,d){qb.call(this,a,b,c,d)}function cd(a,b,c,d){qb.call(this,a,b,c,d)}function dd(a,b,c){qb.call(this,a,b,c)}function ed(a,b,c,d){qb.call(this,a,b,c,d)}function rb(a,b,c,d){qb.apply(this,arguments)}function ta(a,b,c){this.name=a;this.tracks=c;this.duration=void 0!==b?b:-1;this.uuid=h.Math.generateUUID();0>this.duration&&this.resetDuration();this.optimize()}function fd(a){this.manager=void 0!==a?a:h.DefaultLoadingManager;this.textures= -{}}function td(a){this.manager=void 0!==a?a:h.DefaultLoadingManager}function sb(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}function ud(a){"boolean"===typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:h.DefaultLoadingManager;this.withCredentials=!1}function je(a){this.manager=void 0!==a?a:h.DefaultLoadingManager;this.texturePath=""}function Y(){}function La(a, -b){this.v1=a;this.v2=b}function Bc(){this.curves=[];this.autoClose=!1}function Ra(a,b,c,d,e,f,g,k){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g;this.aRotation=k||0}function tb(a){this.points=void 0===a?[]:a}function ub(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d}function vb(a,b,c){this.v0=a;this.v1=b;this.v2=c}function wb(){Cc.apply(this,arguments);this.holes=[]}function Cc(a){Bc.call(this);this.currentPoint=new C;a&&this.fromPoints(a)} -function vd(){this.subPaths=[];this.currentPath=null}function wd(a){this.data=a}function ke(a){this.manager=void 0!==a?a:h.DefaultLoadingManager}function xd(){void 0===yd&&(yd=new (window.AudioContext||window.webkitAudioContext));return yd}function zd(a){this.manager=void 0!==a?a:h.DefaultLoadingManager}function le(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new Ca;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new Ca;this.cameraR.layers.enable(2); -this.cameraR.matrixAutoUpdate=!1}function gd(a,b,c){D.call(this);this.type="CubeCamera";var d=new Ca(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new q(1,0,0));this.add(d);var e=new Ca(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new q(-1,0,0));this.add(e);var f=new Ca(90,1,a,b);f.up.set(0,0,1);f.lookAt(new q(0,1,0));this.add(f);var g=new Ca(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new q(0,-1,0));this.add(g);var k=new Ca(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new q(0,0,1));this.add(k);var l=new Ca(90,1,a,b);l.up.set(0,-1, -0);l.lookAt(new q(0,0,-1));this.add(l);this.renderTarget=new Ab(c,c,{format:1022,magFilter:1006,minFilter:1006});this.updateCubeMap=function(a,b){null===this.parent&&this.updateMatrixWorld();var c=this.renderTarget,h=c.texture.generateMipmaps;c.texture.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,k,c);c.texture.generateMipmaps=h;c.activeCubeFace=5;a.render(b, -l,c);a.setRenderTarget(null)}}function Ad(){D.call(this);this.type="AudioListener";this.context=xd();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function Ub(a){D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.source.onended=this.onEnded.bind(this);this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl= -!0;this.sourceType="empty";this.filters=[]}function Bd(a){Ub.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function Cd(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function hd(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select; -break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function ka(a,b,c){this.path=b;this.parsedPath=c||ka.parseTrackName(b);this.node=ka.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Dd(a){this.uuid=h.Math.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var b={};this._indicesByUUID=b;for(var c=0,d=arguments.length;c!==d;++c)b[arguments[c].uuid]=c;this._paths= -[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}function Ed(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants= -c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Fd(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Gd(a, -b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a;this.dynamic=!1}function xb(){I.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function Hd(a,b,c,d){this.uuid=h.Math.generateUUID();this.data=a;this.itemSize=b;this.offset=c;this.normalized=!0===d}function Vb(a,b){this.uuid=h.Math.generateUUID();this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.dynamic=!1;this.updateRange={offset:0,count:-1}; -this.version=0}function Wb(a,b,c){Vb.call(this,a,b);this.meshPerAttribute=c||1}function Xb(a,b,c){z.call(this,a,b);this.meshPerAttribute=c||1}function Id(a,b,c,d){this.ray=new Wa(a,b);this.near=c||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function me(a,b){return a.distance-b.distance} -function Jd(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;d<e;d++)Jd(a[d],b,c,!0)}}function Kd(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function Ld(a,b,c){this.radius=void 0!==a?a:1;this.phi=void 0!==b?b:0;this.theta=void 0!==c?c:0;return this}function la(a,b){va.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1, -c/1);this.setAnimationWeight("__default",1)}function Dc(a){D.call(this);this.material=a;this.render=function(a){}}function Ec(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16711680;d=void 0!==d?d:1;b=0;(c=this.object.geometry)&&c.isGeometry?b=3*c.faces.length:c&&c.isBufferGeometry&&(b=c.attributes.normal.count);c=new I;b=new ma(6*b,3);c.addAttribute("position",b);ha.call(this,c,new na({color:a,linewidth:d}));this.matrixAutoUpdate=!1;this.update()}function Yb(a){D.call(this);this.light= -a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;a=new I;for(var b=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],c=0,d=1;32>c;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new ma(b,3));b=new na({fog:!1});this.cone=new ha(a,b);this.add(this.cone);this.update()}function Zb(a){this.bones=this.getBoneList(a);for(var b=new R,c=0;c<this.bones.length;c++){var d=this.bones[c]; -d.parent&&d.parent.isBone&&(b.vertices.push(new q),b.vertices.push(new q),b.colors.push(new H(0,0,1)),b.colors.push(new H(0,1,0)))}b.dynamic=!0;c=new na({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0});ha.call(this,b,c);this.root=a;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.update()}function $b(a,b){this.light=a;this.light.updateMatrixWorld();var c=new ib(b,4,2),d=new Ia({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);va.call(this, -c,d);this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1}function ac(a,b){D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.colors=[new H,new H];var c=new Lb(b,4,2);c.rotateX(-Math.PI/2);for(var d=0;8>d;d++)c.faces[d].color=this.colors[4>d?0:1];d=new Ia({vertexColors:1,wireframe:!0});this.lightSphere=new va(c,d);this.add(this.lightSphere);this.update()}function Fc(a,b,c,d){b=b||1;c=new H(void 0!==c?c:4473924);d=new H(void 0!== -d?d:8947848);for(var e=b/2,f=2*a/b,g=[],k=[],l=0,m=0,h=-a;l<=b;l++,h+=f){g.push(-a,0,h,a,0,h);g.push(h,0,-a,h,0,a);var p=l===e?c:d;p.toArray(k,m);m+=3;p.toArray(k,m);m+=3;p.toArray(k,m);m+=3;p.toArray(k,m);m+=3}a=new I;a.addAttribute("position",new ma(g,3));a.addAttribute("color",new ma(k,3));g=new na({vertexColors:2});ha.call(this,a,g)}function Gc(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=0;(c=this.object.geometry)&&c.isGeometry?b=c.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."); -c=new I;b=new ma(6*b,3);c.addAttribute("position",b);ha.call(this,c,new na({color:a,linewidth:d}));this.matrixAutoUpdate=!1;this.update()}function bc(a,b){D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;void 0===b&&(b=1);var c=new I;c.addAttribute("position",new ma([-b,b,0,b,b,0,b,-b,0,-b,-b,0,-b,b,0],3));var d=new na({fog:!1});this.add(new Pa(c,d));c=new I;c.addAttribute("position",new ma([0,0,0,0,0,1],3));this.add(new Pa(c,d));this.update()} -function Hc(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new q);d.colors.push(new H(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}var d=new R,e=new na({color:16777215,vertexColors:1}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680); -b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);ha.call(this,d,e);this.camera=a;this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()}function Ic(a,b){var c=void 0!==b?b:8947848;this.object=a;this.box= -new Ha;va.call(this,new kb(1,1,1),new Ia({color:c,wireframe:!0}))}function Jc(a,b){void 0===b&&(b=16776960);var c=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),d=new Float32Array(24),e=new I;e.setIndex(new z(c,1));e.addAttribute("position",new z(d,3));ha.call(this,e,new na({color:b}));void 0!==a&&this.update(a)}function yb(a,b,c,d,e,f){D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);void 0===e&&(e=.2*c);void 0===f&&(f=.2*e);this.position.copy(b);this.line=new Pa(ne,new na({color:d})); -this.line.matrixAutoUpdate=!1;this.add(this.line);this.cone=new va(oe,new Ia({color:d}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(c,e,f)}function id(a){a=a||1;var b=new Float32Array([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a]),c=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);a=new I;a.addAttribute("position",new z(b,3));a.addAttribute("color",new z(c,3));b=new na({vertexColors:2});ha.call(this,a,b)}function pe(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."); -h.CatmullRomCurve3.call(this,a);this.type="catmullrom";this.closed=!0}function jd(a,b,c,d,e,f){Ra.call(this,a,b,c,c,d,e,f)}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0<a?1:+a});void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}});void 0===Object.assign&&function(){Object.assign=function(a){if(void 0===a||null===a)throw new TypeError("Cannot convert undefined or null to object"); -for(var b=Object(a),c=1;c<arguments.length;c++){var d=arguments[c];if(void 0!==d&&null!==d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(b[e]=d[e])}return b}}();Object.assign(pa.prototype,{addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1}, -removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;var c=[],d,e=b.length;for(d=0;d<e;d++)c[d]=b[d];for(d=0;d<e;d++)c[d].call(this,a)}}}});var qe={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},re={UVMapping:300,CubeReflectionMapping:301, -CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Md={RepeatWrapping:1E3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Nd={NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008};h.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a= -"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,d;return function(){for(var e=0;36>e;e++)8===e||13===e||18===e||23===e?b[e]="-":14===e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19===e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>= -c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead.");return Math.random()},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*h.Math.DEG2RAD}, -radToDeg:function(a){return a*h.Math.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nearestPowerOfTwo:function(a){return Math.pow(2,Math.round(Math.log(a)/Math.LN2))},nextPowerOfTwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return a}};C.prototype={constructor:C,isVector2:!0,get width(){return this.x},set width(a){this.x=a},get height(){return this.y},set height(a){this.y=a},set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y=this.x=a;return this}, -setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), -this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this}, -subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a):this.y=this.x=0;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a, -b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new C,b=new C);a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.multiplyScalar(Math.max(a,Math.min(b,c))/c)},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x= -Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())}, -angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b, -a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];return this},rotateAround:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=this.x-a.x,f=this.y-a.y;this.x=e*c-f*d+a.x;this.y=e*d+f*c+a.y;return this}}; -ba.DEFAULT_IMAGE=void 0;ba.DEFAULT_MAPPING=300;ba.prototype={constructor:ba,isTexture:!0,set needsUpdate(a){!0===a&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.image=a.image;this.mipmaps=a.mipmaps.slice(0);this.mapping=a.mapping;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.format=a.format;this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.generateMipmaps= -a.generateMipmaps;this.premultiplyAlpha=a.premultiplyAlpha;this.flipY=a.flipY;this.unpackAlignment=a.unpackAlignment;this.encoding=a.encoding;return this},toJSON:function(a){if(void 0!==a.textures[this.uuid])return a.textures[this.uuid];var b={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter, -anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var c=this.image;void 0===c.uuid&&(c.uuid=h.Math.generateUUID());if(void 0===a.images[c.uuid]){var d=a.images,e=c.uuid,f=c.uuid,g;void 0!==c.toDataURL?g=c:(g=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),g.width=c.width,g.height=c.height,g.getContext("2d").drawImage(c,0,0,c.width,c.height));g=2048<g.width||2048<g.height?g.toDataURL("image/jpeg",.6):g.toDataURL("image/png");d[e]={uuid:f,url:g}}b.image=c.uuid}return a.textures[this.uuid]= -b},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(a){if(300===this.mapping){a.multiply(this.repeat);a.add(this.offset);if(0>a.x||1<a.x)switch(this.wrapS){case 1E3:a.x-=Math.floor(a.x);break;case 1001:a.x=0>a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1<a.y)switch(this.wrapT){case 1E3:a.y-=Math.floor(a.y);break;case 1001:a.y=0>a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y: -a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y)}}};Object.assign(ba.prototype,pa.prototype);var Pd=0;da.prototype={constructor:da,isVector4:!0,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y= -b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), -this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a, -b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a,this.z*=a,this.w*=a):this.w=this.z=this.y=this.x=0;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]* -d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var f=a[8],g=a[1],k=a[5],l=a[9];c=a[2];b=a[6];var m=a[10];if(.01>Math.abs(d-g)&&.01> -Math.abs(f-c)&&.01>Math.abs(l-b)){if(.1>Math.abs(d+g)&&.1>Math.abs(f+c)&&.1>Math.abs(l+b)&&.1>Math.abs(e+k+m-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;k=(k+1)/2;m=(m+1)/2;d=(d+g)/4;f=(f+c)/4;l=(l+b)/4;e>k&&e>m?.01>e?(b=0,d=c=.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):k>m?.01>k?(b=.707106781,c=0,d=.707106781):(c=Math.sqrt(k),b=d/c,d=l/c):.01>m?(c=b=.707106781,d=0):(d=Math.sqrt(m),b=f/d,c=l/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-l)*(b-l)+(f-c)*(f-c)+(g-d)*(g-d));.001>Math.abs(a)&& -(a=1);this.x=(b-l)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+k+m-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z, -this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new da,b=new da);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x); -this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x* -this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a, -b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];this.w= -a.array[b+3];return this}};Object.assign(zb.prototype,pa.prototype,{isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture= -a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Ab.prototype=Object.create(zb.prototype);Ab.prototype.constructor=Ab;Ab.prototype.isWebGLRenderTargetCube=!0;ca.prototype={constructor:ca,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get w(){return this._w},set w(a){this._w=a;this.onChangeCallback()},set:function(a, -b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!1===(a&&a.isEuler))throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var c=Math.cos(a._x/2),d=Math.cos(a._y/2),e=Math.cos(a._z/2),f=Math.sin(a._x/ -2),g=Math.sin(a._y/2),k=Math.sin(a._z/2),l=a.order;"XYZ"===l?(this._x=f*d*e+c*g*k,this._y=c*g*e-f*d*k,this._z=c*d*k+f*g*e,this._w=c*d*e-f*g*k):"YXZ"===l?(this._x=f*d*e+c*g*k,this._y=c*g*e-f*d*k,this._z=c*d*k-f*g*e,this._w=c*d*e+f*g*k):"ZXY"===l?(this._x=f*d*e-c*g*k,this._y=c*g*e+f*d*k,this._z=c*d*k+f*g*e,this._w=c*d*e-f*g*k):"ZYX"===l?(this._x=f*d*e-c*g*k,this._y=c*g*e+f*d*k,this._z=c*d*k-f*g*e,this._w=c*d*e+f*g*k):"YZX"===l?(this._x=f*d*e+c*g*k,this._y=c*g*e+f*d*k,this._z=c*d*k-f*g*e,this._w=c*d* -e-f*g*k):"XZY"===l&&(this._x=f*d*e-c*g*k,this._y=c*g*e-f*d*k,this._z=c*d*k+f*g*e,this._w=c*d*e+f*g*k);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this._x=a.x*d;this._y=a.y*d;this._z=a.z*d;this._w=Math.cos(c);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],k=b[2],l=b[6],b=b[10],m=c+f+b;0<m?(c=.5/Math.sqrt(m+1),this._w=.25/c,this._x=(l-g)*c,this._y=(d-k)*c, -this._z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(l-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+k)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-k)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+l)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+k)/c,this._y=(g+l)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,b;return function(c,d){void 0===a&&(a=new q);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c, -d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;return this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a= -this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w, -g=b._x,k=b._y,l=b._z,m=b._w;this._x=c*m+f*g+d*l-e*k;this._y=d*m+f*k+e*g-c*l;this._z=e*m+f*l+c*k-d*g;this._w=f*m-c*g-d*k-e*l;this.onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var k=Math.sqrt(1-g*g);if(.001>Math.abs(k))return this._w= -.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;var l=Math.atan2(k,g),g=Math.sin((1-b)*l)/k,k=Math.sin(b*l)/k;this._w=f*g+this._w*k;this._x=c*g+this._x*k;this._y=d*g+this._y*k;this._z=e*g+this._z*k;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this}, -toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};Object.assign(ca,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var k=c[d+0],l=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var h=e[f+1],p=e[f+2];e=e[f+3];if(c!==e||k!==d||l!==h||m!==p){f=1-g;var n=k*d+l*h+m*p+c*e,r=0<=n?1:-1,t=1-n*n;t>Number.EPSILON&&(t= -Math.sqrt(t),n=Math.atan2(t,n*r),f=Math.sin(f*n)/t,g=Math.sin(g*n)/t);r*=g;k=k*f+d*r;l=l*f+h*r;m=m*f+p*r;c=c*f+e*r;f===1-g&&(g=1/Math.sqrt(k*k+l*l+m*m+c*c),k*=g,l*=g,m*=g,c*=g)}a[b]=k;a[b+1]=l;a[b+2]=m;a[b+3]=c}});q.prototype={constructor:q,isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a, -b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), -this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z; -return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},multiplyVectors:function(a, -b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a;return function(b){!1===(b&&b.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new ca);return this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a;return function(b,c){void 0===a&&(a=new ca);return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z; -a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]* -c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var k=a*b+f*d-g*c,l=a*c+g*b-e*d,m=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=k*a+b*-e+l*-g-m*-f;this.y=l*a+b*-f+m*-e-k*-g;this.z=m*a+b*-g+k*-f-l*-e;return this},project:function(){var a;return function(b){void 0===a&&(a=new P);a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld));return this.applyProjection(a)}}(),unproject:function(){var a;return function(b){void 0===a&&(a=new P); -a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyProjection(a)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z, -a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new q,b=new q);a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.multiplyScalar(Math.max(a, -Math.min(b,c))/c)},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z): -Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.multiplyScalar(a/ -this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){var c= -a.x,d=a.y,e=a.z,f=b.x,g=b.y,k=b.z;this.x=d*k-e*g;this.y=e*f-c*k;this.z=c*g-d*f;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a;return function(b){void 0===a&&(a=new q);a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0===a&&(a=new q);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()* -a.lengthSq());return Math.acos(h.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){var b=Math.sin(a.phi)*a.radius;this.x=b*Math.sin(a.theta);this.y=Math.cos(a.phi)*a.radius;this.z=b*Math.cos(a.theta);return this},setFromMatrixPosition:function(a){return this.setFromMatrixColumn(a, -3)},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){if("number"===typeof a){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var c=a;a=b;b=c}return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&& -(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];return this}};P.prototype={constructor:P,isMatrix4:!0,set:function(a,b,c,d,e,f,g,k,l,m,h,p,n,r,t,v){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=k;q[2]=l;q[6]=m;q[10]=h;q[14]=p;q[3]= -n;q[7]=r;q[11]=t;q[15]=v;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new P).fromArray(this.elements)},copy:function(a){this.elements.set(a.elements);return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x, -b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a;return function(b){void 0===a&&(a=new q);var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b,2).length();c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;return this}}(),makeRotationFromEuler:function(a){!1===(a&&a.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order."); -var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),k=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*k;var l=f*e,m=c*k,h=c*e;b[0]=g*k;b[4]=-g*e;b[8]=d;b[1]=l+m*d;b[5]=a-h*d;b[9]=-c*g;b[2]=h-a*d;b[6]=m+l*d;b[10]=f*g}else"YXZ"===a.order?(a=g*k,l=g*e,m=d*k,h=d*e,b[0]=a+h*c,b[4]=m*c-l,b[8]=f*d,b[1]=f*e,b[5]=f*k,b[9]=-c,b[2]=l*c-m,b[6]=h+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*k,l=g*e,m=d*k,h=d*e,b[0]=a-h*c,b[4]=-f*e,b[8]=m+l*c,b[1]=l+m*c,b[5]=f*k,b[9]=h-a*c,b[2]= --f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*k,l=f*e,m=c*k,h=c*e,b[0]=g*k,b[4]=m*d-l,b[8]=a*d+h,b[1]=g*e,b[5]=h*d+a,b[9]=l*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,m=c*g,h=c*d,b[0]=g*k,b[4]=h-a*e,b[8]=m*e+l,b[1]=e,b[5]=f*k,b[9]=-c*k,b[2]=-d*k,b[6]=l*e+m,b[10]=a-h*e):"XZY"===a.order&&(a=f*g,l=f*d,m=c*g,h=c*d,b[0]=g*k,b[4]=-e,b[8]=d*k,b[1]=a*e+h,b[5]=f*k,b[9]=l*e-m,b[2]=m*e-l,b[6]=c*k,b[10]=h*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){var b= -this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,k=d+d,l=e+e;a=c*g;var h=c*k,c=c*l,u=d*k,d=d*l,e=e*l,g=f*g,k=f*k,f=f*l;b[0]=1-(u+e);b[4]=h-f;b[8]=c+k;b[1]=h+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-k;b[6]=d+g;b[10]=1-(a+u);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a,b,c;return function(d,e,f){void 0===a&&(a=new q,b=new q,c=new q);var g=this.elements;c.subVectors(d,e).normalize();0===c.lengthSq()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.lengthSq()&&(c.z+=1E-4, -a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements, -f=c[0],g=c[4],k=c[8],l=c[12],h=c[1],u=c[5],p=c[9],n=c[13],r=c[2],t=c[6],v=c[10],q=c[14],w=c[3],x=c[7],T=c[11],c=c[15],y=d[0],F=d[4],G=d[8],E=d[12],J=d[1],C=d[5],N=d[9],D=d[13],z=d[2],I=d[6],H=d[10],L=d[14],M=d[3],O=d[7],Q=d[11],d=d[15];e[0]=f*y+g*J+k*z+l*M;e[4]=f*F+g*C+k*I+l*O;e[8]=f*G+g*N+k*H+l*Q;e[12]=f*E+g*D+k*L+l*d;e[1]=h*y+u*J+p*z+n*M;e[5]=h*F+u*C+p*I+n*O;e[9]=h*G+u*N+p*H+n*Q;e[13]=h*E+u*D+p*L+n*d;e[2]=r*y+t*J+v*z+q*M;e[6]=r*F+t*C+v*I+q*O;e[10]=r*G+t*N+v*H+q*Q;e[14]=r*E+t*D+v*L+q*d;e[3]=w*y+ -x*J+T*z+c*M;e[7]=w*F+x*C+T*I+c*O;e[11]=w*G+x*N+T*H+c*Q;e[15]=w*E+x*D+T*L+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a; -b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new q);void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.fromArray(b,c),a.applyMatrix4(this),a.toArray(b,c);return b}}(),applyToBuffer:function(){var a;return function(b,c,d){void 0===a&&(a=new q);void 0===c&&(c=0);void 0===d&&(d=b.length/b.itemSize);for(var e=0;e<d;e++,c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix4(this),b.setXYZ(a.x,a.y,a.z); -return b}}(),determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],k=a[9],l=a[13],h=a[2],u=a[6],p=a[10],n=a[14];return a[3]*(+e*k*u-d*l*u-e*g*p+c*l*p+d*g*n-c*k*n)+a[7]*(+b*k*n-b*l*p+e*f*p-d*f*n+d*l*h-e*k*h)+a[11]*(+b*l*u-b*g*n-e*f*u+c*f*n+e*g*h-c*l*h)+a[15]*(-d*g*h-b*k*u+b*g*p+d*f*u-c*f*p+c*k*h)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11]; -a[11]=a[14];a[14]=b;return this},flattenToArrayOffset:function(a,b){console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead.");return this.toArray(a,b)},getPosition:function(){var a;return function(){void 0===a&&(a=new q);console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");return a.setFromMatrixColumn(this,3)}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this}, -getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[1],g=d[2],k=d[3],l=d[4],h=d[5],u=d[6],p=d[7],n=d[8],r=d[9],t=d[10],v=d[11],q=d[12],w=d[13],x=d[14],d=d[15],T=r*x*p-w*t*p+w*u*v-h*x*v-r*u*d+h*t*d,y=q*t*p-n*x*p-q*u*v+l*x*v+n*u*d-l*t*d,F=n*w*p-q*r*p+q*h*v-l*w*v-n*h*d+l*r*d,G=q*r*u-n*w*u-q*h*t+l*w*t+n*h*x-l*r*x,E=e*T+f*y+g*F+k*G;if(0===E){if(!0===b)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"); -return this.identity()}E=1/E;c[0]=T*E;c[1]=(w*t*k-r*x*k-w*g*v+f*x*v+r*g*d-f*t*d)*E;c[2]=(h*x*k-w*u*k+w*g*p-f*x*p-h*g*d+f*u*d)*E;c[3]=(r*u*k-h*t*k-r*g*p+f*t*p+h*g*v-f*u*v)*E;c[4]=y*E;c[5]=(n*x*k-q*t*k+q*g*v-e*x*v-n*g*d+e*t*d)*E;c[6]=(q*u*k-l*x*k-q*g*p+e*x*p+l*g*d-e*u*d)*E;c[7]=(l*t*k-n*u*k+n*g*p-e*t*p-l*g*v+e*u*v)*E;c[8]=F*E;c[9]=(q*r*k-n*w*k-q*f*v+e*w*v+n*f*d-e*r*d)*E;c[10]=(l*w*k-q*h*k+q*f*p-e*w*p-l*f*d+e*h*d)*E;c[11]=(n*h*k-l*r*k-n*f*p+e*r*p+l*f*v-e*h*v)*E;c[12]=G*E;c[13]=(n*w*g-q*r*g+q*f*t-e*w* -t-n*f*x+e*r*x)*E;c[14]=(q*h*g-l*w*g-q*f*u+e*w*u+l*f*x-e*h*x)*E;c[15]=(l*r*g-n*h*g+n*f*u-e*r*u-l*f*t+e*h*t)*E;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y;a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))},makeTranslation:function(a,b,c){this.set(1, -0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,k=a.z,l=e*f,h=e*g;this.set(l*f+c,l* -g-d*k,l*k+d*g,0,l*g+d*k,h*g+c,h*k-d*f,0,l*k-d*g,h*k+d*f,e*k*k+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},decompose:function(){var a,b;return function(c,d,e){void 0===a&&(a=new q,b=new P);var f=this.elements,g=a.set(f[0],f[1],f[2]).length(),k=a.set(f[4],f[5],f[6]).length(),l=a.set(f[8],f[9],f[10]).length();0>this.determinant()&&(g= --g);c.x=f[12];c.y=f[13];c.z=f[14];b.elements.set(this.elements);c=1/g;var f=1/k,h=1/l;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=h;b.elements[9]*=h;b.elements[10]*=h;d.setFromRotationMatrix(b);e.x=g;e.y=k;e.z=l;return this}}(),makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e); -g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){a=c*Math.tan(h.Math.DEG2RAD*a*.5);var e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,k=1/(b-a),l=1/(c-d),h=1/(f-e);g[0]=2*k;g[4]=0;g[8]=0;g[12]=-((b+a)*k);g[1]=0;g[5]=2*l;g[9]=0;g[13]=-((c+d)*l);g[2]=0;g[6]=0;g[10]=-2*h;g[14]=-((f+e)*h);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1; -return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}};Ta.prototype=Object.create(ba.prototype);Ta.prototype.constructor=Ta;Ta.prototype.isCubeTexture=!0; -Object.defineProperty(Ta.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});var Td=new ba,Ud=new Ta,Qd=[],Sd=[];Yd.prototype.setValue=function(a,b){for(var c=this.seq,d=0,e=c.length;d!==e;++d){var f=c[d];f.setValue(a,b[f.id])}};var kd=/([\w\d_]+)(\])?(\[|\.)?/g;Ga.prototype.setValue=function(a,b,c){b=this.map[b];void 0!==b&&b.setValue(a,c,this.renderer)};Ga.prototype.set=function(a,b,c){var d=this.map[c];void 0!==d&&d.setValue(a,b[c],this.renderer)};Ga.prototype.setOptional= -function(a,b,c){b=b[c];void 0!==b&&this.setValue(a,c,b)};Ga.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],k=c[g.id];!1!==k.needsUpdate&&g.setValue(a,k.value,d)}};Ga.seqWithValue=function(a,b){for(var c=[],d=0,e=a.length;d!==e;++d){var f=a[d];f.id in b&&c.push(f)}return c};Ga.splitDynamic=function(a,b){for(var c=null,d=a.length,e=0,f=0;f!==d;++f){var g=a[f],k=b[g.id];k&&!0===k.dynamic?(null===c&&(c=[]),c.push(g)):(e<f&&(a[e]=g),++e)}e<d&&(a.length=e);return c};Ga.evalDynamic= -function(a,b,c,d,e){for(var f=0,g=a.length;f!==g;++f){var k=b[a[f].id],l=k.onUpdateCallback;void 0!==l&&l.call(k,c,d,e)}};h.UniformsUtils={merge:function(a){for(var b={},c=0;c<a.length;c++){var d=this.clone(a[c]),e;for(e in d)b[e]=d[e]}return b},clone:function(a){var b={},c;for(c in a){b[c]={};for(var d in a[c]){var e=a[c][d];e&&e.isColor||e&&e.isVector2||e&&e.isVector3||e&&e.isVector4||e&&e.isMatrix3||e&&e.isMatrix4||e&&e.isTexture?b[c][d]=e.clone():Array.isArray(e)?b[c][d]=e.slice():b[c][d]=e}}return b}}; -var Z={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n", -aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n\treturn any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n", -bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n", -clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n", -clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n", -cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n", -defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n", -emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n", -envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n", -envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n", -envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n", -fog_fragment:"#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif", -lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n", -lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#include <normal_flip>\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#include <normal_flip>\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n", -lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n", -lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n", -lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n", -lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n", -logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n", -map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n", -metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n", -morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n", -normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n", -normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n", -packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n", -premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n", -roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n", -shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n", -shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n", -shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n", -skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n", -skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n", -specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n", -uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n", -uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif", -uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n", -cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n", -depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n", -distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n", -equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n", -linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", -linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", -meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n}\n", -meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", -meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n}\n", -meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", -meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n}\n", -meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", -meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n", -normal_frag:"uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include <logdepthbuf_fragment>\n}\n",normal_vert:"varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n", -points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", -points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n", -shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"};H.prototype={constructor:H, -isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(){function a(a,c,d){0>d&&(d+=1);1<d&&--d;return d<1/6?a+6*(c-a)*d:.5>d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b, -c,d){b=h.Math.euclideanModulo(b,1);c=h.Math.clamp(c,0,1);d=h.Math.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r= -Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(c[1])/ -360,e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^\#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0<a.length&&(c=h.ColorKeywords[a], -void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+a));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a,b){void 0===b&&(b=2);this.r=Math.pow(a.r,b);this.g=Math.pow(a.g,b);this.b=Math.pow(a.b,b);return this},copyLinearToGamma:function(a,b){void 0===b&&(b=2);var c=0<b?1/b:1;this.r=Math.pow(a.r,c);this.g=Math.pow(a.g,c);this.b=Math.pow(a.b,c);return this},convertGammaToLinear:function(){var a= -this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(a){a=a||{h:0,s:0,l:0};var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,k=(f+e)/2;if(f===e)f=g=0;else{var l=e-f,f=.5>=k?l/(e+f): -l/(2-e-f);switch(e){case b:g=(c-d)/l+(c<d?6:0);break;case c:g=(d-b)/l+2;break;case d:g=(b-c)/l+4}g/=6}a.h=g;a.s=f;a.l=k;return a},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,b,c){var d=this.getHSL();d.h+=a;d.s+=b;d.l+=c;this.setHSL(d.h,d.s,d.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+= -a;this.g+=a;this.b+=a;return this},sub:function(a){this.r=Math.max(0,this.r-a.r);this.g=Math.max(0,this.g-a.g);this.b=Math.max(0,this.b-a.b);return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerp:function(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a,b){void 0===b&&(b= -0);this.r=a[b];this.g=a[b+1];this.b=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.r;a[b+1]=this.g;a[b+2]=this.b;return a},toJSON:function(){return this.getHex()}};h.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272, -cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265, -dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323, -lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912, -mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327, -seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};var U={common:{diffuse:{value:new H(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new da(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null}, -envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new C(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}}, -metalnessmap:{metalnessMap:{value:null}},fog:{fogDensity:{value:2.5E-4},fogNear:{value:1},fogFar:{value:2E3},fogColor:{value:new H(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{}, -shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}}},points:{diffuse:{value:new H(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new da(0,0,1,1)}}}, -Cb={basic:{uniforms:h.UniformsUtils.merge([U.common,U.aomap,U.fog]),vertexShader:Z.meshbasic_vert,fragmentShader:Z.meshbasic_frag},lambert:{uniforms:h.UniformsUtils.merge([U.common,U.aomap,U.lightmap,U.emissivemap,U.fog,U.lights,{emissive:{value:new H(0)}}]),vertexShader:Z.meshlambert_vert,fragmentShader:Z.meshlambert_frag},phong:{uniforms:h.UniformsUtils.merge([U.common,U.aomap,U.lightmap,U.emissivemap,U.bumpmap,U.normalmap,U.displacementmap,U.fog,U.lights,{emissive:{value:new H(0)},specular:{value:new H(1118481)}, -shininess:{value:30}}]),vertexShader:Z.meshphong_vert,fragmentShader:Z.meshphong_frag},standard:{uniforms:h.UniformsUtils.merge([U.common,U.aomap,U.lightmap,U.emissivemap,U.bumpmap,U.normalmap,U.displacementmap,U.roughnessmap,U.metalnessmap,U.fog,U.lights,{emissive:{value:new H(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Z.meshphysical_vert,fragmentShader:Z.meshphysical_frag},points:{uniforms:h.UniformsUtils.merge([U.points,U.fog]),vertexShader:Z.points_vert, -fragmentShader:Z.points_frag},dashed:{uniforms:h.UniformsUtils.merge([U.common,U.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Z.linedashed_vert,fragmentShader:Z.linedashed_frag},depth:{uniforms:h.UniformsUtils.merge([U.common,U.displacementmap]),vertexShader:Z.depth_vert,fragmentShader:Z.depth_frag},normal:{uniforms:{opacity:{value:1}},vertexShader:Z.normal_vert,fragmentShader:Z.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Z.cube_vert, -fragmentShader:Z.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Z.equirect_vert,fragmentShader:Z.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new q}},vertexShader:Z.distanceRGBA_vert,fragmentShader:Z.distanceRGBA_frag}};Cb.physical={uniforms:h.UniformsUtils.merge([Cb.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Z.meshphysical_vert,fragmentShader:Z.meshphysical_frag};cc.prototype={constructor:cc,set:function(a,b){this.min.copy(a); -this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new C;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y= --Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(a){a=a||new C;return this.isEmpty()?a.set(0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){a=a||new C;return this.isEmpty()?a.set(0,0):a.subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a); -this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new C).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y? -!1:!0},clampPoint:function(a,b){return(b||new C).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new C;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};S.prototype= -{constructor:S,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(a){!0===a&&this.update();this._needsUpdate=a},setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else{var d=this[b];void 0===d?console.warn("THREE."+this.type+": '"+b+"' is not a property of this material."):d&&d.isColor?d.set(c):d&&d.isVector3&&c&&c.isVector3?d.copy(c):this[b]="overdraw"===b?Number(c):c}}},toJSON:function(a){function b(a){var b= -[],c;for(c in a){var d=a[c];delete d.metadata;b.push(d)}return b}var c=void 0===a;c&&(a={textures:{},images:{}});var d={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};d.uuid=this.uuid;d.type=this.type;""!==this.name&&(d.name=this.name);this.color&&this.color.isColor&&(d.color=this.color.getHex());void 0!==this.roughness&&(d.roughness=this.roughness);void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex()); -this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex());void 0!==this.shininess&&(d.shininess=this.shininess);this.map&&this.map.isTexture&&(d.map=this.map.toJSON(a).uuid);this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap=this.alphaMap.toJSON(a).uuid);this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(a).uuid);this.bumpMap&&this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(a).uuid,d.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&& -(d.normalMap=this.normalMap.toJSON(a).uuid,d.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(a).uuid,d.displacementScale=this.displacementScale,d.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(a).uuid);this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(a).uuid);this.emissiveMap&&this.emissiveMap.isTexture&& -(d.emissiveMap=this.emissiveMap.toJSON(a).uuid);this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(a).uuid);this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(a).uuid,d.reflectivity=this.reflectivity);void 0!==this.size&&(d.size=this.size);void 0!==this.sizeAttenuation&&(d.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(d.blending=this.blending);2!==this.shading&&(d.shading=this.shading);0!==this.side&&(d.side=this.side);0!==this.vertexColors&& -(d.vertexColors=this.vertexColors);1>this.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0<this.alphaTest&&(d.alphaTest=this.alphaTest);!0===this.premultipliedAlpha&&(d.premultipliedAlpha=this.premultipliedAlpha);!0===this.wireframe&&(d.wireframe=this.wireframe);1<this.wireframeLinewidth&&(d.wireframeLinewidth=this.wireframeLinewidth);"round"!==this.wireframeLinecap&&(d.wireframeLinecap= -this.wireframeLinecap);"round"!==this.wireframeLinejoin&&(d.wireframeLinejoin=this.wireframeLinejoin);d.skinning=this.skinning;d.morphTargets=this.morphTargets;c&&(c=b(a.textures),a=b(a.images),0<c.length&&(d.textures=c),0<a.length&&(d.images=a));return d},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=a.name;this.fog=a.fog;this.lights=a.lights;this.blending=a.blending;this.side=a.side;this.shading=a.shading;this.vertexColors=a.vertexColors;this.opacity=a.opacity; -this.transparent=a.transparent;this.blendSrc=a.blendSrc;this.blendDst=a.blendDst;this.blendEquation=a.blendEquation;this.blendSrcAlpha=a.blendSrcAlpha;this.blendDstAlpha=a.blendDstAlpha;this.blendEquationAlpha=a.blendEquationAlpha;this.depthFunc=a.depthFunc;this.depthTest=a.depthTest;this.depthWrite=a.depthWrite;this.colorWrite=a.colorWrite;this.precision=a.precision;this.polygonOffset=a.polygonOffset;this.polygonOffsetFactor=a.polygonOffsetFactor;this.polygonOffsetUnits=a.polygonOffsetUnits;this.alphaTest= -a.alphaTest;this.premultipliedAlpha=a.premultipliedAlpha;this.overdraw=a.overdraw;this.visible=a.visible;this.clipShadows=a.clipShadows;a=a.clippingPlanes;var b=null;if(null!==a)for(var c=a.length,b=Array(c),d=0;d!==c;++d)b[d]=a[d].clone();this.clippingPlanes=b;return this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};Object.assign(S.prototype,pa.prototype);var Zd=0;Da.prototype=Object.create(S.prototype);Da.prototype.constructor= -Da;Da.prototype.isShaderMaterial=!0;Da.prototype.copy=function(a){S.prototype.copy.call(this,a);this.fragmentShader=a.fragmentShader;this.vertexShader=a.vertexShader;this.uniforms=h.UniformsUtils.clone(a.uniforms);this.defines=a.defines;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.lights=a.lights;this.clipping=a.clipping;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;this.extensions=a.extensions;return this};Da.prototype.toJSON= -function(a){a=S.prototype.toJSON.call(this,a);a.uniforms=this.uniforms;a.vertexShader=this.vertexShader;a.fragmentShader=this.fragmentShader;return a};Ua.prototype=Object.create(S.prototype);Ua.prototype.constructor=Ua;Ua.prototype.isMeshDepthMaterial=!0;Ua.prototype.copy=function(a){S.prototype.copy.call(this,a);this.depthPacking=a.depthPacking;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale= -a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;return this};Ha.prototype={constructor:Ha,isBox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,k=0,l=a.length;k<l;k+=3){var h=a[k],u=a[k+1],p=a[k+2];h<b&&(b=h);u<c&&(c=u);p<d&&(d=p);h>e&&(e=h);u>f&&(f=u);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e, -f,g)},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new q;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),setFromObject:function(){var a=new q;return function(b){var c=this;b.updateMatrixWorld(!0);this.makeEmpty();b.traverse(function(b){var e=b.geometry;if(void 0!==e)if(e&&e.isGeometry)for(var e=e.vertices,f=0,g=e.length;f< -g;f++)a.copy(e[f]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a);else if(e&&e.isBufferGeometry&&(g=e.attributes.position,void 0!==g)){var k;g&&g.isInterleavedBufferAttribute?(e=g.data.array,f=g.offset,k=g.data.stride):(e=g.array,f=0,k=3);for(g=e.length;f<g;f+=k)a.fromArray(e,f),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a)}});return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x= -this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(a){a=a||new q;return this.isEmpty()?a.set(0,0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){a=a||new q;return this.isEmpty()?a.set(0,0,0):a.subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a); -this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new q).set((a.x-this.min.x)/(this.max.x-this.min.x), -(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},intersectsSphere:function(){var a;return function(b){void 0===a&&(a=new q);this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){var b,c;0<a.normal.x?(b=a.normal.x*this.min.x,c=a.normal.x*this.max.x): -(b=a.normal.x*this.max.x,c=a.normal.x*this.min.x);0<a.normal.y?(b+=a.normal.y*this.min.y,c+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,c+=a.normal.y*this.min.y);0<a.normal.z?(b+=a.normal.z*this.min.z,c+=a.normal.z*this.max.z):(b+=a.normal.z*this.max.z,c+=a.normal.z*this.min.z);return b<=a.constant&&c>=a.constant},clampPoint:function(a,b){return(b||new q).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new q;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(), -getBoundingSphere:function(){var a=new q;return function(b){b=b||new Aa;this.getCenter(b.center);b.radius=.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new q,new q,new q,new q,new q,new q,new q,new q];return function(b){if(this.isEmpty())return this;a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b); -a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a); -return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};Aa.prototype={constructor:Aa,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new Ha;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d);for(var e=0,f=0,g=b.length;f<g;f++)e=Math.max(e,d.distanceToSquared(b[f]));this.radius=Math.sqrt(e);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.center.copy(a.center); -this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(this.center.dot(a.normal)-a.constant)<=this.radius}, -clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new q;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new Ha;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&& -a.radius===this.radius}};ya.prototype={constructor:ya,isMatrix3:!0,set:function(a,b,c,d,e,f,g,k,l){var h=this.elements;h[0]=a;h[1]=d;h[2]=g;h[3]=b;h[4]=e;h[5]=k;h[6]=c;h[7]=f;h[8]=l;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9], -a[2],a[6],a[10]);return this},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new q);void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.fromArray(b,c),a.applyMatrix3(this),a.toArray(b,c);return b}}(),applyToBuffer:function(){var a;return function(b,c,d){void 0===a&&(a=new q);void 0===c&&(c=0);void 0===d&&(d=b.length/b.itemSize);for(var e=0;e<d;e++,c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix3(this),b.setXYZ(a.x,a.y,a.z);return b}}(),multiplyScalar:function(a){var b= -this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],k=a[6],l=a[7],a=a[8];return b*f*a-b*g*l-c*e*a+c*g*k+d*e*l-d*f*k},getInverse:function(a,b){a&&a.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var c=a.elements,d=this.elements,e=c[0],f=c[1],g=c[2],k=c[3],l=c[4],h=c[5],u=c[6],p=c[7],c=c[8],n=c*l-h*p,r=h*u-c*k,t=p*k-l*u,q=e*n+f* -r+g*t;if(0===q){if(!0===b)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return this.identity()}q=1/q;d[0]=n*q;d[1]=(g*p-c*f)*q;d[2]=(h*f-g*l)*q;d[3]=r*q;d[4]=(c*e-g*u)*q;d[5]=(g*k-h*e)*q;d[6]=t*q;d[7]=(f*u-p*e)*q;d[8]=(l*e-f*k)*q;return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},flattenToArrayOffset:function(a, -b){console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead.");return this.toArray(a,b)},getNormalMatrix:function(a){return this.setFromMatrix4(a).getInverse(this).transpose()},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a= -[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}};fa.prototype={constructor:fa,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new q,b=new q; -return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+ -this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,b){var c=this.distanceToPoint(a);return(b||new q).copy(this.normal).multiplyScalar(c)},intersectLine:function(){var a=new q;return function(b,c){var d=c||new q,e=b.delta(a),f=this.normal.dot(e);if(0===f){if(0===this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/ -f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)}}(),intersectsLine:function(a){var b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectsBox:function(a){return a.intersectsPlane(this)},intersectsSphere:function(a){return a.intersectsPlane(this)},coplanarPoint:function(a){return(a||new q).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new q,b=new ya;return function(c,d){var e=this.coplanarPoint(a).applyMatrix4(c), -f=d||b.getNormalMatrix(c),f=this.normal.applyMatrix3(f).normalize();this.constant=-e.dot(f);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&a.constant===this.constant}};dc.prototype={constructor:dc,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b= -this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],k=c[5],l=c[6],h=c[7],u=c[8],p=c[9],n=c[10],r=c[11],t=c[12],q=c[13],A=c[14],c=c[15];b[0].setComponents(f-a,h-g,r-u,c-t).normalize();b[1].setComponents(f+a,h+g,r+u,c+t).normalize();b[2].setComponents(f+d,h+k,r+p,c+q).normalize();b[3].setComponents(f-d,h-k,r-p,c-q).normalize();b[4].setComponents(f-e,h-l,r-n,c-A).normalize();b[5].setComponents(f+e, -h+l,r+n,c+A).normalize();return this},intersectsObject:function(){var a=new Aa;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Aa;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d= -0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new q,b=new q;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var g=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>g&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6> -c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}};Wa.prototype={constructor:Wa,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new q).copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(){var a= -new q;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new q;c.subVectors(a,this.origin);var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new q;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b); -a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new q,b=new q,c=new q;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var k=.5*d.distanceTo(e),l=-this.direction.dot(b),h=c.dot(this.direction),u=-c.dot(b),p=c.lengthSq(),n=Math.abs(1-l*l),r;0<n?(d=l*u-h,e=l*h-u,r=k*n,0<=d?e>=-r?e<=r?(k=1/n,d*=k,e*=k,l=d*(d+l*e+2*h)+e*(l*d+e+2*u)+p):(e=k,d=Math.max(0,-(l* -e+h)),l=-d*d+e*(e+2*u)+p):(e=-k,d=Math.max(0,-(l*e+h)),l=-d*d+e*(e+2*u)+p):e<=-r?(d=Math.max(0,-(-l*k+h)),e=0<d?-k:Math.min(Math.max(-k,-u),k),l=-d*d+e*(e+2*u)+p):e<=r?(d=0,e=Math.min(Math.max(-k,-u),k),l=e*(e+2*u)+p):(d=Math.max(0,-(l*k+h)),e=0<d?k:Math.min(Math.max(-k,-u),k),l=-d*d+e*(e+2*u)+p)):(e=0<l?-k:k,d=Math.max(0,-(l*e+h)),l=-d*d+e*(e+2*u)+p);f&&f.copy(this.direction).multiplyScalar(d).add(this.origin);g&&g.copy(b).multiplyScalar(e).add(a);return l}}(),intersectSphere:function(){var a=new q; -return function(b,c){a.subVectors(b.center,this.origin);var d=a.dot(this.direction),e=a.dot(a)-d*d,f=b.radius*b.radius;if(e>f)return null;f=Math.sqrt(f-e);e=d-f;d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a, -b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var k=this.origin;0<=d?(c=(a.min.x-k.x)*d,d*=a.max.x-k.x):(c=(a.max.x-k.x)*d,d*=a.min.x-k.x);0<=f?(e=(a.min.y-k.y)*f,f*=a.max.y-k.y):(e=(a.max.y-k.y)*f,f*=a.min.y-k.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e; -if(f<d||d!==d)d=f;0<=g?(e=(a.min.z-k.z)*g,g*=a.max.z-k.z):(e=(a.max.z-k.z)*g,g*=a.min.z-k.z);if(c>g||e>d)return null;if(e>c||c!==c)c=e;if(g<d||d!==d)d=g;return 0>d?null:this.at(0<=c?c:d,b)},intersectsBox:function(){var a=new q;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new q,b=new q,c=new q,d=new q;return function(e,f,g,k,l){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0<f){if(k)return null;k=1}else if(0>f)k= --1,f=-f;else return null;a.subVectors(this.origin,e);e=k*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=k*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-k*a.dot(d);return 0>e?null:this.at(e/f,l)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}};Xa.RotationOrders= -"XYZ YZX ZXY XZY YXZ ZYX".split(" ");Xa.DefaultOrder="XYZ";Xa.prototype={constructor:Xa,isEuler:!0,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback();return this}, -clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=h.Math.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],k=e[1],l=e[5],m=e[9],u=e[2],p=e[6],e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"=== -b?(this._x=Math.asin(-d(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(k,l)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(p,-1,1)),.99999>Math.abs(p)?(this._y=Math.atan2(-u,e),this._z=Math.atan2(-f,l)):(this._y=0,this._z=Math.atan2(k,a))):"ZYX"===b?(this._y=Math.asin(-d(u,-1,1)),.99999>Math.abs(u)?(this._x=Math.atan2(p,e),this._z=Math.atan2(k,a)):(this._x=0,this._z=Math.atan2(-f,l))):"YZX"===b?(this._z=Math.asin(d(k,-1,1)),.99999>Math.abs(k)?(this._x= -Math.atan2(-m,l),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(p,l),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a;return function(b,c,d){void 0===a&&(a=new P);a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a, -c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ca;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]= -this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new q(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};Kc.prototype={constructor:Kc,set:function(a){this.mask=1<<a},enable:function(a){this.mask|=1<<a},toggle:function(a){this.mask^=1<<a},disable:function(a){this.mask&=~(1<<a)},test:function(a){return 0!==(this.mask&a.mask)}};D.DefaultUp=new q(0,1,0);D.DefaultMatrixAutoUpdate= -!0;Object.assign(D.prototype,pa.prototype,{isObject3D:!0,applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function(){var a= -new ca;return function(b,c){a.setFromAxisAngle(b,c);this.quaternion.multiply(a);return this}}(),rotateX:function(){var a=new q(1,0,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateY:function(){var a=new q(0,1,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateZ:function(){var a=new q(0,0,1);return function(b){return this.rotateOnAxis(a,b)}}(),translateOnAxis:function(){var a=new q;return function(b,c){a.copy(b).applyQuaternion(this.quaternion);this.position.add(a.multiplyScalar(c)); -return this}}(),translateX:function(){var a=new q(1,0,0);return function(b){return this.translateOnAxis(a,b)}}(),translateY:function(){var a=new q(0,1,0);return function(b){return this.translateOnAxis(a,b)}}(),translateZ:function(){var a=new q(0,0,1);return function(b){return this.translateOnAxis(a,b)}}(),localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var a=new P;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}}(),lookAt:function(){var a= -new P;return function(b){a.lookAt(b,this.position,this.up);this.quaternion.setFromRotationMatrix(a)}}(),add:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.add(arguments[b]);return this}if(a===this)return console.error("THREE.Object3D.add: object can't be added as a child of itself.",a),this;a&&a.isObject3D?(null!==a.parent&&a.parent.remove(a),a.parent=this,a.dispatchEvent({type:"added"}),this.children.push(a)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", -a);return this},remove:function(a){if(1<arguments.length)for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);b=this.children.indexOf(a);-1!==b&&(a.parent=null,a.dispatchEvent({type:"removed"}),this.children.splice(b,1))},getObjectById:function(a){return this.getObjectByProperty("id",a)},getObjectByName:function(a){return this.getObjectByProperty("name",a)},getObjectByProperty:function(a,b){if(this[a]===b)return this;for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c].getObjectByProperty(a, -b);if(void 0!==e)return e}},getWorldPosition:function(a){a=a||new q;this.updateMatrixWorld(!0);return a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var a=new q,b=new q;return function(c){c=c||new ca;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a,c,b);return c}}(),getWorldRotation:function(){var a=new ca;return function(b){b=b||new Xa;this.getWorldQuaternion(a);return b.setFromQuaternion(a,this.rotation.order,!1)}}(),getWorldScale:function(){var a=new q,b=new ca; -return function(c){c=c||new q;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a,b,c);return c}}(),getWorldDirection:function(){var a=new ca;return function(b){b=b||new q;this.getWorldQuaternion(a);return b.set(0,0,1).applyQuaternion(a)}}(),raycast:function(){},traverse:function(a){a(this);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].traverseVisible(a)}},traverseAncestors:function(a){var b= -this.parent;null!==b&&(a(b),b.traverseAncestors(a))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].updateMatrixWorld(a)}, -toJSON:function(a){function b(a){var b=[],c;for(c in a){var d=a[c];delete d.metadata;b.push(d)}return b}var c=void 0===a||""===a,d={};c&&(a={geometries:{},materials:{},textures:{},images:{}},d.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var e={};e.uuid=this.uuid;e.type=this.type;""!==this.name&&(e.name=this.name);"{}"!==JSON.stringify(this.userData)&&(e.userData=this.userData);!0===this.castShadow&&(e.castShadow=!0);!0===this.receiveShadow&&(e.receiveShadow=!0);!1===this.visible&& -(e.visible=!1);e.matrix=this.matrix.toArray();void 0!==this.geometry&&(void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON(a)),e.geometry=this.geometry.uuid);void 0!==this.material&&(void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON(a)),e.material=this.material.uuid);if(0<this.children.length){e.children=[];for(var f=0;f<this.children.length;f++)e.children.push(this.children[f].toJSON(a).object)}if(c){var c= -b(a.geometries),f=b(a.materials),g=b(a.textures);a=b(a.images);0<c.length&&(d.geometries=c);0<f.length&&(d.materials=f);0<g.length&&(d.textures=g);0<a.length&&(d.images=a)}d.object=e;return d},clone:function(a){return(new this.constructor).copy(this,a)},copy:function(a,b){void 0===b&&(b=!0);this.name=a.name;this.up.copy(a.up);this.position.copy(a.position);this.quaternion.copy(a.quaternion);this.scale.copy(a.scale);this.matrix.copy(a.matrix);this.matrixWorld.copy(a.matrixWorld);this.matrixAutoUpdate= -a.matrixAutoUpdate;this.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;this.visible=a.visible;this.castShadow=a.castShadow;this.receiveShadow=a.receiveShadow;this.frustumCulled=a.frustumCulled;this.renderOrder=a.renderOrder;this.userData=JSON.parse(JSON.stringify(a.userData));if(!0===b)for(var c=0;c<a.children.length;c++)this.add(a.children[c].clone());return this}});var ae=0;cb.prototype={constructor:cb,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)}, -copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){return(a||new q).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new q).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){var c=b||new q;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new q, -b=new q;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=h.Math.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new q;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}};Fa.normal=function(){var a=new q; -return function(b,c,d,e){e=e||new q;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();Fa.barycoordFromPoint=function(){var a=new q,b=new q,c=new q;return function(d,e,f,g,k){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);d=a.dot(a);e=a.dot(b);f=a.dot(c);var l=b.dot(b);g=b.dot(c);var h=d*l-e*e;k=k||new q;if(0===h)return k.set(-2,-1,-1);h=1/h;l=(l*f-e*g)*h;d=(d*g-e*f)*h;return k.set(1-l-d,d,l)}}();Fa.containsPoint=function(){var a= -new q;return function(b,c,d,e){b=Fa.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}();Fa.prototype={constructor:Fa,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new q,b=new q;return function(){a.subVectors(this.c, -this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new q).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return Fa.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new fa).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return Fa.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return Fa.containsPoint(a,this.a,this.b,this.c)},closestPointToPoint:function(){var a, -b,c,d;return function(e,f){void 0===a&&(a=new fa,b=[new cb,new cb,new cb],c=new q,d=new q);var g=f||new q,k=Infinity;a.setFromCoplanarPoints(this.a,this.b,this.c);a.projectPoint(e,c);if(!0===this.containsPoint(c))g.copy(c);else{b[0].set(this.a,this.b);b[1].set(this.b,this.c);b[2].set(this.c,this.a);for(var l=0;l<b.length;l++){b[l].closestPointToPoint(c,!0,d);var h=c.distanceToSquared(d);h<k&&(k=h,g.copy(d))}}return g}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}}; -ga.prototype={constructor:ga,clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a=a.a;this.b=a.b;this.c=a.c;this.normal.copy(a.normal);this.color.copy(a.color);this.materialIndex=a.materialIndex;for(var b=0,c=a.vertexNormals.length;b<c;b++)this.vertexNormals[b]=a.vertexNormals[b].clone();b=0;for(c=a.vertexColors.length;b<c;b++)this.vertexColors[b]=a.vertexColors[b].clone();return this}};Ia.prototype=Object.create(S.prototype);Ia.prototype.constructor=Ia;Ia.prototype.isMeshBasicMaterial= -!0;Ia.prototype.copy=function(a){S.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning= -a.skinning;this.morphTargets=a.morphTargets;return this};z.prototype={constructor:z,isBufferAttribute:!0,set needsUpdate(a){!0===a&&this.version++},setDynamic:function(a){this.dynamic=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.itemSize=a.itemSize;this.count=a.count;this.normalized=a.normalized;this.dynamic=a.dynamic;return this},copyAt:function(a,b,c){a*=this.itemSize;c*=b.itemSize;for(var d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d];return this}, -copyArray:function(a){this.array.set(a);return this},copyColorsArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",d),f=new H);b[c++]=f.r;b[c++]=f.g;b[c++]=f.b}return this},copyIndicesArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];b[c++]=f.a;b[c++]=f.b;b[c++]=f.c}return this},copyVector2sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f= -a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",d),f=new C);b[c++]=f.x;b[c++]=f.y}return this},copyVector3sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",d),f=new q);b[c++]=f.x;b[c++]=f.y;b[c++]=f.z}return this},copyVector4sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", -d),f=new da);b[c++]=f.x;b[c++]=f.y;b[c++]=f.z;b[c++]=f.w}return this},set:function(a,b){void 0===b&&(b=0);this.array.set(a,b);return this},getX:function(a){return this.array[a*this.itemSize]},setX:function(a,b){this.array[a*this.itemSize]=b;return this},getY:function(a){return this.array[a*this.itemSize+1]},setY:function(a,b){this.array[a*this.itemSize+1]=b;return this},getZ:function(a){return this.array[a*this.itemSize+2]},setZ:function(a,b){this.array[a*this.itemSize+2]=b;return this},getW:function(a){return this.array[a* -this.itemSize+3]},setW:function(a,b){this.array[a*this.itemSize+3]=b;return this},setXY:function(a,b,c){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;return this},setXYZ:function(a,b,c,d){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=d;return this},setXYZW:function(a,b,c,d,e){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=d;this.array[a+3]=e;return this},clone:function(){return(new this.constructor).copy(this)}};Object.assign(R.prototype,pa.prototype, -{isGeometry:!0,applyMatrix:function(a){for(var b=(new ya).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){a=this.faces[c];a.normal.applyMatrix3(b).normalize();for(var e=0,f=a.vertexNormals.length;e<f;e++)a.vertexNormals[e].applyMatrix3(b).normalize()}null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();this.normalsNeedUpdate=this.verticesNeedUpdate=!0;return this},rotateX:function(){var a; -return function(b){void 0===a&&(a=new P);a.makeRotationX(b);this.applyMatrix(a);return this}}(),rotateY:function(){var a;return function(b){void 0===a&&(a=new P);a.makeRotationY(b);this.applyMatrix(a);return this}}(),rotateZ:function(){var a;return function(b){void 0===a&&(a=new P);a.makeRotationZ(b);this.applyMatrix(a);return this}}(),translate:function(){var a;return function(b,c,d){void 0===a&&(a=new P);a.makeTranslation(b,c,d);this.applyMatrix(a);return this}}(),scale:function(){var a;return function(b, -c,d){void 0===a&&(a=new P);a.makeScale(b,c,d);this.applyMatrix(a);return this}}(),lookAt:function(){var a;return function(b){void 0===a&&(a=new D);a.lookAt(b);a.updateMatrix();this.applyMatrix(a.matrix)}}(),fromBufferGeometry:function(a){function b(a,b,d,e){var f=void 0!==g?[u[a].clone(),u[b].clone(),u[d].clone()]:[],r=void 0!==k?[c.colors[a].clone(),c.colors[b].clone(),c.colors[d].clone()]:[];e=new ga(a,b,d,f,r,e);c.faces.push(e);void 0!==l&&c.faceVertexUvs[0].push([p[a].clone(),p[b].clone(),p[d].clone()]); -void 0!==h&&c.faceVertexUvs[1].push([n[a].clone(),n[b].clone(),n[d].clone()])}var c=this,d=null!==a.index?a.index.array:void 0,e=a.attributes,f=e.position.array,g=void 0!==e.normal?e.normal.array:void 0,k=void 0!==e.color?e.color.array:void 0,l=void 0!==e.uv?e.uv.array:void 0,h=void 0!==e.uv2?e.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var u=[],p=[],n=[],r=e=0;e<f.length;e+=3,r+=2)c.vertices.push(new q(f[e],f[e+1],f[e+2])),void 0!==g&&u.push(new q(g[e],g[e+1],g[e+2])),void 0!==k&& -c.colors.push(new H(k[e],k[e+1],k[e+2])),void 0!==l&&p.push(new C(l[r],l[r+1])),void 0!==h&&n.push(new C(h[r],h[r+1]));if(void 0!==d)if(f=a.groups,0<f.length)for(e=0;e<f.length;e++)for(var t=f[e],v=t.start,A=t.count,r=v,v=v+A;r<v;r+=3)b(d[r],d[r+1],d[r+2],t.materialIndex);else for(e=0;e<d.length;e+=3)b(d[e],d[e+1],d[e+2]);else for(e=0;e<f.length/3;e+=3)b(e,e+1,e+2);this.computeFaceNormals();null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere= -a.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();var a=this.boundingBox.getCenter().negate();this.translate(a.x,a.y,a.z);return a},normalize:function(){this.computeBoundingSphere();var a=this.boundingSphere.center,b=this.boundingSphere.radius,b=0===b?1:1/b,c=new P;c.set(b,0,0,-b*a.x,0,b,0,-b*a.y,0,0,b,-b*a.z,0,0,0,1);this.applyMatrix(c);return this},computeFaceNormals:function(){for(var a=new q,b=new q,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a], -g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){void 0===a&&(a=!0);var b,c,d;d=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)d[b]=new q;if(a){var e,f,g,k=new q,l=new q;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],k.subVectors(g,f),l.subVectors(e,f),k.cross(l),d[c.a].add(k),d[c.b].add(k),d[c.c].add(k)}else for(a= -0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=c.vertexNormals,3===e.length?(e[0].copy(d[c.a]),e[1].copy(d[c.b]),e[2].copy(d[c.c])):(e[0]=d[c.a].clone(),e[1]=d[c.b].clone(),e[2]=d[c.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++)for(e= -this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var f=new R;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals= -[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var g=this.morphNormals[a].vertexNormals,k,l;c=0;for(d=this.faces.length;c<d;c++)k=new q,l={a:new q,b:new q,c:new q},e.push(k),g.push(l)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],k=g.faceNormals[c],l=g.vertexNormals[c],k.copy(e.normal),l.a.copy(e.vertexNormals[0]),l.b.copy(e.vertexNormals[1]),l.c.copy(e.vertexNormals[2])}c= -0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ha);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null=== -this.boundingSphere&&(this.boundingSphere=new Aa);this.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(!1===(a&&a.isGeometry))console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",a);else{var d,e=this.vertices.length,f=this.vertices,g=a.vertices,k=this.faces,l=a.faces,h=this.faceVertexUvs[0],u=a.faceVertexUvs[0],p=this.colors,n=a.colors;void 0===c&&(c=0);void 0!==b&&(d=(new ya).getNormalMatrix(b));a=0;for(var r=g.length;a<r;a++){var t=g[a].clone(); -void 0!==b&&t.applyMatrix4(b);f.push(t)}a=0;for(r=n.length;a<r;a++)p.push(n[a].clone());a=0;for(r=l.length;a<r;a++){var g=l[a],q=g.vertexNormals,n=g.vertexColors,p=new ga(g.a+e,g.b+e,g.c+e);p.normal.copy(g.normal);void 0!==d&&p.normal.applyMatrix3(d).normalize();b=0;for(f=q.length;b<f;b++)t=q[b].clone(),void 0!==d&&t.applyMatrix3(d).normalize(),p.vertexNormals.push(t);p.color.copy(g.color);b=0;for(f=n.length;b<f;b++)t=n[b],p.vertexColors.push(t.clone());p.materialIndex=g.materialIndex+c;k.push(p)}a= -0;for(r=u.length;a<r;a++)if(c=u[a],d=[],void 0!==c){b=0;for(f=c.length;b<f;b++)d.push(c[b].clone());h.push(d)}}},mergeMesh:function(a){!1===(a&&a.isMesh)?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a):(a.matrixAutoUpdate&&a.updateMatrix(),this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0=== -a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<g;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]===e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},sortFacesByMaterialIndex:function(){for(var a=this.faces,b=a.length,c=0;c<b;c++)a[c]._id= -c;a.sort(function(a,b){return a.materialIndex-b.materialIndex});var d=this.faceVertexUvs[0],e=this.faceVertexUvs[1],f,g;d&&d.length===b&&(f=[]);e&&e.length===b&&(g=[]);for(c=0;c<b;c++){var k=a[c]._id;f&&f.push(d[k]);g&&g.push(e[k])}f&&(this.faceVertexUvs[0]=f);g&&(this.faceVertexUvs[1]=g)},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();if(void 0!==h[b])return h[b];h[b]=l.length/3;l.push(a.x,a.y,a.z);return h[b]}function c(a){var b= -a.r.toString()+a.g.toString()+a.b.toString();if(void 0!==p[b])return p[b];p[b]=u.length;u.push(a.getHex());return p[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==r[b])return r[b];r[b]=n.length/2;n.push(a.x,a.y);return r[b]}var e={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};e.uuid=this.uuid;e.type=this.type;""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var f=this.parameters,g;for(g in f)void 0!==f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g< -this.vertices.length;g++){var k=this.vertices[g];f.push(k.x,k.y,k.z)}var k=[],l=[],h={},u=[],p={},n=[],r={};for(g=0;g<this.faces.length;g++){var t=this.faces[g],q=void 0!==this.faceVertexUvs[0][g],A=0<t.normal.length(),w=0<t.vertexNormals.length,x=1!==t.color.r||1!==t.color.g||1!==t.color.b,T=0<t.vertexColors.length,y=0,y=a(y,0,0),y=a(y,1,!0),y=a(y,2,!1),y=a(y,3,q),y=a(y,4,A),y=a(y,5,w),y=a(y,6,x),y=a(y,7,T);k.push(y);k.push(t.a,t.b,t.c);k.push(t.materialIndex);q&&(q=this.faceVertexUvs[0][g],k.push(d(q[0]), -d(q[1]),d(q[2])));A&&k.push(b(t.normal));w&&(A=t.vertexNormals,k.push(b(A[0]),b(A[1]),b(A[2])));x&&k.push(c(t.color));T&&(t=t.vertexColors,k.push(c(t[0]),c(t[1]),c(t[2])))}e.data={};e.data.vertices=f;e.data.normals=l;0<u.length&&(e.data.colors=u);0<n.length&&(e.data.uvs=[n]);e.data.faces=k;return e},clone:function(){return(new R).copy(this)},copy:function(a){this.vertices=[];this.faces=[];this.faceVertexUvs=[[]];this.colors=[];for(var b=a.vertices,c=0,d=b.length;c<d;c++)this.vertices.push(b[c].clone()); -b=a.colors;c=0;for(d=b.length;c<d;c++)this.colors.push(b[c].clone());b=a.faces;c=0;for(d=b.length;c<d;c++)this.faces.push(b[c].clone());c=0;for(d=a.faceVertexUvs.length;c<d;c++){b=a.faceVertexUvs[c];void 0===this.faceVertexUvs[c]&&(this.faceVertexUvs[c]=[]);for(var e=0,f=b.length;e<f;e++){for(var g=b[e],k=[],l=0,h=g.length;l<h;l++)k.push(g[l].clone());this.faceVertexUvs[c].push(k)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Lc=0;Object.assign(de.prototype,pa.prototype, -{computeBoundingBox:R.prototype.computeBoundingBox,computeBoundingSphere:R.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(a){var b,c=[],d;a=a.faces;for(var e=0;e<a.length;e++){var f=a[e];f.materialIndex!==d&&(d=f.materialIndex, -void 0!==b&&(b.count=3*e-b.start,c.push(b)),b={start:3*e,materialIndex:d})}void 0!==b&&(b.count=3*e-b.start,c.push(b));this.groups=c},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,f=d[1]&&0<d[1].length,g=a.morphTargets,k=g.length,l;if(0<k){l=[];for(var h=0;h<k;h++)l[h]=[];this.morphTargets.position=l}var u=a.morphNormals,p=u.length,n;if(0<p){n=[];for(h=0;h<p;h++)n[h]=[];this.morphTargets.normal=n}for(var r=a.skinIndices,t=a.skinWeights,q=r.length===c.length, -A=t.length===c.length,h=0;h<b.length;h++){var w=b[h];this.vertices.push(c[w.a],c[w.b],c[w.c]);var x=w.vertexNormals;3===x.length?this.normals.push(x[0],x[1],x[2]):(x=w.normal,this.normals.push(x,x,x));x=w.vertexColors;3===x.length?this.colors.push(x[0],x[1],x[2]):(x=w.color,this.colors.push(x,x,x));!0===e&&(x=d[0][h],void 0!==x?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new C,new C,new C)));!0===f&&(x=d[1][h],void 0!==x? -this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new C,new C,new C)));for(x=0;x<k;x++){var T=g[x].vertices;l[x].push(T[w.a],T[w.b],T[w.c])}for(x=0;x<p;x++)T=u[x].vertexNormals[h],n[x].push(T.a,T.b,T.c);q&&this.skinIndices.push(r[w.a],r[w.b],r[w.c]);A&&this.skinWeights.push(t[w.a],t[w.b],t[w.c])}this.computeGroups(a);this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate= -a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Object.assign(I.prototype,pa.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(a){this.index=a},addAttribute:function(a,b,c){if(!1===(b&&b.isBufferAttribute)&&!1===(b&&b.isInterleavedBufferAttribute))console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(a, -new z(b,c));else if("index"===a)console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(b);else return this.attributes[a]=b,this},getAttribute:function(a){return this.attributes[a]},removeAttribute:function(a){delete this.attributes[a];return this},addGroup:function(a,b,c){this.groups.push({start:a,count:b,materialIndex:void 0!==c?c:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(a,b){this.drawRange.start=a;this.drawRange.count=b},applyMatrix:function(a){var b= -this.attributes.position;void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0);b=this.attributes.normal;void 0!==b&&((new ya).getNormalMatrix(a).applyToVector3Array(b.array),b.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();return this},rotateX:function(){var a;return function(b){void 0===a&&(a=new P);a.makeRotationX(b);this.applyMatrix(a);return this}}(),rotateY:function(){var a;return function(b){void 0===a&&(a= -new P);a.makeRotationY(b);this.applyMatrix(a);return this}}(),rotateZ:function(){var a;return function(b){void 0===a&&(a=new P);a.makeRotationZ(b);this.applyMatrix(a);return this}}(),translate:function(){var a;return function(b,c,d){void 0===a&&(a=new P);a.makeTranslation(b,c,d);this.applyMatrix(a);return this}}(),scale:function(){var a;return function(b,c,d){void 0===a&&(a=new P);a.makeScale(b,c,d);this.applyMatrix(a);return this}}(),lookAt:function(){var a;return function(b){void 0===a&&(a=new D); -a.lookAt(b);a.updateMatrix();this.applyMatrix(a.matrix)}}(),center:function(){this.computeBoundingBox();var a=this.boundingBox.getCenter().negate();this.translate(a.x,a.y,a.z);return a},setFromObject:function(a){var b=a.geometry;if(a&&a.isPoints||a&&a.isLine){a=new ma(3*b.vertices.length,3);var c=new ma(3*b.colors.length,3);this.addAttribute("position",a.copyVector3sArray(b.vertices));this.addAttribute("color",c.copyColorsArray(b.colors));b.lineDistances&&b.lineDistances.length===b.vertices.length&& -(a=new ma(b.lineDistances.length,1),this.addAttribute("lineDistance",a.copyArray(b.lineDistances)));null!==b.boundingSphere&&(this.boundingSphere=b.boundingSphere.clone());null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone())}else a&&a.isMesh&&b&&b.isGeometry&&this.fromGeometry(b);return this},updateFromObject:function(a){var b=a.geometry;if(a&&a.isMesh){var c=b.__directGeometry;!0===b.elementsNeedUpdate&&(c=void 0,b.elementsNeedUpdate=!1);if(void 0===c)return this.fromGeometry(b);c.verticesNeedUpdate= -b.verticesNeedUpdate;c.normalsNeedUpdate=b.normalsNeedUpdate;c.colorsNeedUpdate=b.colorsNeedUpdate;c.uvsNeedUpdate=b.uvsNeedUpdate;c.groupsNeedUpdate=b.groupsNeedUpdate;b.verticesNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.groupsNeedUpdate=!1;b=c}!0===b.verticesNeedUpdate&&(c=this.attributes.position,void 0!==c&&(c.copyVector3sArray(b.vertices),c.needsUpdate=!0),b.verticesNeedUpdate=!1);!0===b.normalsNeedUpdate&&(c=this.attributes.normal,void 0!==c&&(c.copyVector3sArray(b.normals), -c.needsUpdate=!0),b.normalsNeedUpdate=!1);!0===b.colorsNeedUpdate&&(c=this.attributes.color,void 0!==c&&(c.copyColorsArray(b.colors),c.needsUpdate=!0),b.colorsNeedUpdate=!1);b.uvsNeedUpdate&&(c=this.attributes.uv,void 0!==c&&(c.copyVector2sArray(b.uvs),c.needsUpdate=!0),b.uvsNeedUpdate=!1);b.lineDistancesNeedUpdate&&(c=this.attributes.lineDistance,void 0!==c&&(c.copyArray(b.lineDistances),c.needsUpdate=!0),b.lineDistancesNeedUpdate=!1);b.groupsNeedUpdate&&(b.computeGroups(a.geometry),this.groups= -b.groups,b.groupsNeedUpdate=!1);return this},fromGeometry:function(a){a.__directGeometry=(new de).fromGeometry(a);return this.fromDirectGeometry(a.__directGeometry)},fromDirectGeometry:function(a){var b=new Float32Array(3*a.vertices.length);this.addAttribute("position",(new z(b,3)).copyVector3sArray(a.vertices));0<a.normals.length&&(b=new Float32Array(3*a.normals.length),this.addAttribute("normal",(new z(b,3)).copyVector3sArray(a.normals)));0<a.colors.length&&(b=new Float32Array(3*a.colors.length), -this.addAttribute("color",(new z(b,3)).copyColorsArray(a.colors)));0<a.uvs.length&&(b=new Float32Array(2*a.uvs.length),this.addAttribute("uv",(new z(b,2)).copyVector2sArray(a.uvs)));0<a.uvs2.length&&(b=new Float32Array(2*a.uvs2.length),this.addAttribute("uv2",(new z(b,2)).copyVector2sArray(a.uvs2)));0<a.indices.length&&(b=new (65535<a.vertices.length?Uint32Array:Uint16Array)(3*a.indices.length),this.setIndex((new z(b,1)).copyIndicesArray(a.indices)));this.groups=a.groups;for(var c in a.morphTargets){for(var b= -[],d=a.morphTargets[c],e=0,f=d.length;e<f;e++){var g=d[e],k=new ma(3*g.length,3);b.push(k.copyVector3sArray(g))}this.morphAttributes[c]=b}0<a.skinIndices.length&&(c=new ma(4*a.skinIndices.length,4),this.addAttribute("skinIndex",c.copyVector4sArray(a.skinIndices)));0<a.skinWeights.length&&(c=new ma(4*a.skinWeights.length,4),this.addAttribute("skinWeight",c.copyVector4sArray(a.skinWeights)));null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());null!==a.boundingBox&&(this.boundingBox= -a.boundingBox.clone());return this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ha);var a=this.attributes.position.array;void 0!==a?this.boundingBox.setFromArray(a):this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var a= -new Ha,b=new q;return function(){null===this.boundingSphere&&(this.boundingSphere=new Aa);var c=this.attributes.position;if(c){var c=c.array,d=this.boundingSphere.center;a.setFromArray(c);a.getCenter(d);for(var e=0,f=0,g=c.length;f<g;f+=3)b.fromArray(c,f),e=Math.max(e,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(e);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', -this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.index,b=this.attributes,c=this.groups;if(b.position){var d=b.position.array;if(void 0===b.normal)this.addAttribute("normal",new z(new Float32Array(d.length),3));else for(var e=b.normal.array,f=0,g=e.length;f<g;f++)e[f]=0;var e=b.normal.array,k,l,h,u=new q,p=new q,n=new q,r=new q,t=new q;if(a){a=a.array;0===c.length&&this.addGroup(0,a.length);for(var v=0,A=c.length;v<A;++v)for(f=c[v],g=f.start,k=f.count,f=g,g+=k;f< -g;f+=3)k=3*a[f+0],l=3*a[f+1],h=3*a[f+2],u.fromArray(d,k),p.fromArray(d,l),n.fromArray(d,h),r.subVectors(n,p),t.subVectors(u,p),r.cross(t),e[k]+=r.x,e[k+1]+=r.y,e[k+2]+=r.z,e[l]+=r.x,e[l+1]+=r.y,e[l+2]+=r.z,e[h]+=r.x,e[h+1]+=r.y,e[h+2]+=r.z}else for(f=0,g=d.length;f<g;f+=9)u.fromArray(d,f),p.fromArray(d,f+3),n.fromArray(d,f+6),r.subVectors(n,p),t.subVectors(u,p),r.cross(t),e[f]=r.x,e[f+1]=r.y,e[f+2]=r.z,e[f+3]=r.x,e[f+4]=r.y,e[f+5]=r.z,e[f+6]=r.x,e[f+7]=r.y,e[f+8]=r.z;this.normalizeNormals();b.normal.needsUpdate= -!0}},merge:function(a,b){if(!1===(a&&a.isBufferGeometry))console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,f=a.attributes[d],g=f.array,k=0,f=f.itemSize*b;k<g.length;k++,f++)e[f]=g[k];return this}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d), -a[e]*=b,a[e+1]*=b,a[e+2]*=b},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var a=new I,b=this.index.array,c=this.attributes,d;for(d in c){for(var e=c[d],f=e.array,e=e.itemSize,g=new f.constructor(b.length*e),k,l=0,h=0,u=b.length;h<u;h++){k=b[h]*e;for(var p=0;p<e;p++)g[l++]=f[k++]}a.addAttribute(d,new z(g,e))}return a},toJSON:function(){var a={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}}; -a.uuid=this.uuid;a.type=this.type;""!==this.name&&(a.name=this.name);if(void 0!==this.parameters){var b=this.parameters,c;for(c in b)void 0!==b[c]&&(a[c]=b[c]);return a}a.data={attributes:{}};var d=this.index;null!==d&&(b=Array.prototype.slice.call(d.array),a.data.index={type:d.array.constructor.name,array:b});d=this.attributes;for(c in d){var e=d[c],b=Array.prototype.slice.call(e.array);a.data.attributes[c]={itemSize:e.itemSize,type:e.array.constructor.name,array:b,normalized:e.normalized}}c=this.groups; -0<c.length&&(a.data.groups=JSON.parse(JSON.stringify(c)));c=this.boundingSphere;null!==c&&(a.data.boundingSphere={center:c.center.toArray(),radius:c.radius});return a},clone:function(){return(new I).copy(this)},copy:function(a){var b=a.index;null!==b&&this.setIndex(b.clone());var b=a.attributes,c;for(c in b)this.addAttribute(c,b[c].clone());a=a.groups;c=0;for(b=a.length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}); -I.MaxIndex=65535;va.prototype=Object.assign(Object.create(D.prototype),{constructor:va,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){D.prototype.copy.call(this,a);this.drawMode=a.drawMode;return this},updateMorphTargets:function(){var a=this.geometry.morphTargets;if(void 0!==a&&0<a.length){this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var b=0,c=a.length;b<c;b++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[a[b].name]=b}},raycast:function(){function a(a, -b,c,d,e,f,g){Fa.barycoordFromPoint(a,b,c,d,v);e.multiplyScalar(v.x);f.multiplyScalar(v.y);g.multiplyScalar(v.z);e.add(f).add(g);return e.clone()}function b(a,b,c,d,e,f,g){var k=a.material;if(null===(1===k.side?c.intersectTriangle(f,e,d,!0,g):c.intersectTriangle(d,e,f,2!==k.side,g)))return null;w.copy(g);w.applyMatrix4(a.matrixWorld);c=b.ray.origin.distanceTo(w);return c<b.near||c>b.far?null:{distance:c,point:w.clone(),object:a}}function c(c,d,e,f,m,p,u,q){g.fromArray(f,3*p);k.fromArray(f,3*u);h.fromArray(f, -3*q);if(c=b(c,d,e,g,k,h,A))m&&(n.fromArray(m,2*p),r.fromArray(m,2*u),t.fromArray(m,2*q),c.uv=a(A,g,k,h,n,r,t)),c.face=new ga(p,u,q,Fa.normal(g,k,h)),c.faceIndex=p;return c}var d=new P,e=new Wa,f=new Aa,g=new q,k=new q,h=new q,m=new q,u=new q,p=new q,n=new C,r=new C,t=new C,v=new q,A=new q,w=new q;return function(q,v){var w=this.geometry,F=this.material,G=this.matrixWorld;if(void 0!==F&&(null===w.boundingSphere&&w.computeBoundingSphere(),f.copy(w.boundingSphere),f.applyMatrix4(G),!1!==q.ray.intersectsSphere(f)&& -(d.getInverse(G),e.copy(q.ray).applyMatrix4(d),null===w.boundingBox||!1!==e.intersectsBox(w.boundingBox)))){var E,J;if(w&&w.isBufferGeometry){var C,D,F=w.index,G=w.attributes,w=G.position.array;void 0!==G.uv&&(E=G.uv.array);if(null!==F)for(var G=F.array,z=0,I=G.length;z<I;z+=3){if(F=G[z],C=G[z+1],D=G[z+2],J=c(this,q,e,w,E,F,C,D))J.faceIndex=Math.floor(z/3),v.push(J)}else for(z=0,I=w.length;z<I;z+=9)if(F=z/3,C=F+1,D=F+2,J=c(this,q,e,w,E,F,C,D))J.index=F,v.push(J)}else if(w&&w.isGeometry){var H,P,G= -F&&F.isMultiMaterial,z=!0===G?F.materials:null,I=w.vertices;C=w.faces;D=w.faceVertexUvs[0];0<D.length&&(E=D);for(var L=0,M=C.length;L<M;L++){var O=C[L];J=!0===G?z[O.materialIndex]:F;if(void 0!==J){D=I[O.a];H=I[O.b];P=I[O.c];if(!0===J.morphTargets){J=w.morphTargets;var Q=this.morphTargetInfluences;g.set(0,0,0);k.set(0,0,0);h.set(0,0,0);for(var S=0,V=J.length;S<V;S++){var W=Q[S];if(0!==W){var K=J[S].vertices;g.addScaledVector(m.subVectors(K[O.a],D),W);k.addScaledVector(u.subVectors(K[O.b],H),W);h.addScaledVector(p.subVectors(K[O.c], -P),W)}}g.add(D);k.add(H);h.add(P);D=g;H=k;P=h}if(J=b(this,q,e,D,H,P,A))E&&(Q=E[L],n.copy(Q[0]),r.copy(Q[1]),t.copy(Q[2]),J.uv=a(A,D,H,P,n,r,t)),J.face=O,J.faceIndex=L,v.push(J)}}}}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});db.prototype=Object.create(I.prototype);db.prototype.constructor=db;eb.prototype=Object.create(I.prototype);eb.prototype.constructor=eb;qa.prototype=Object.create(D.prototype);qa.prototype.constructor=qa;qa.prototype.isCamera=!0; -qa.prototype.getWorldDirection=function(){var a=new ca;return function(b){b=b||new q;this.getWorldQuaternion(a);return b.set(0,0,-1).applyQuaternion(a)}}();qa.prototype.lookAt=function(){var a=new P;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();qa.prototype.clone=function(){return(new this.constructor).copy(this)};qa.prototype.copy=function(a){D.prototype.copy.call(this,a);this.matrixWorldInverse.copy(a.matrixWorldInverse);this.projectionMatrix.copy(a.projectionMatrix); -return this};Ca.prototype=Object.assign(Object.create(qa.prototype),{constructor:Ca,isPerspectiveCamera:!0,copy:function(a){qa.prototype.copy.call(this,a);this.fov=a.fov;this.zoom=a.zoom;this.near=a.near;this.far=a.far;this.focus=a.focus;this.aspect=a.aspect;this.view=null===a.view?null:Object.assign({},a.view);this.filmGauge=a.filmGauge;this.filmOffset=a.filmOffset;return this},setFocalLength:function(a){a=.5*this.getFilmHeight()/a;this.fov=2*h.Math.RAD2DEG*Math.atan(a);this.updateProjectionMatrix()}, -getFocalLength:function(){var a=Math.tan(.5*h.Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/a},getEffectiveFOV:function(){return 2*h.Math.RAD2DEG*Math.atan(Math.tan(.5*h.Math.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(a,b,c,d,e,f){this.aspect=a/b;this.view={fullWidth:a,fullHeight:b,offsetX:c,offsetY:d,width:e,height:f};this.updateProjectionMatrix()}, -clearViewOffset:function(){this.view=null;this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=this.near,b=a*Math.tan(.5*h.Math.DEG2RAD*this.fov)/this.zoom,c=2*b,d=this.aspect*c,e=-.5*d,f=this.view;if(null!==f)var g=f.fullWidth,k=f.fullHeight,e=e+f.offsetX*d/g,b=b-f.offsetY*c/k,d=f.width/g*d,c=f.height/k*c;f=this.filmOffset;0!==f&&(e+=a*f/this.getFilmWidth());this.projectionMatrix.makeFrustum(e,e+d,b-c,b,a,this.far)},toJSON:function(a){a=D.prototype.toJSON.call(this,a);a.object.fov= -this.fov;a.object.zoom=this.zoom;a.object.near=this.near;a.object.far=this.far;a.object.focus=this.focus;a.object.aspect=this.aspect;null!==this.view&&(a.object.view=Object.assign({},this.view));a.object.filmGauge=this.filmGauge;a.object.filmOffset=this.filmOffset;return a}});Db.prototype=Object.assign(Object.create(qa.prototype),{constructor:Db,isOrthographicCamera:!0,copy:function(a){qa.prototype.copy.call(this,a);this.left=a.left;this.right=a.right;this.top=a.top;this.bottom=a.bottom;this.near= -a.near;this.far=a.far;this.zoom=a.zoom;this.view=null===a.view?null:Object.assign({},a.view);return this},setViewOffset:function(a,b,c,d,e,f){this.view={fullWidth:a,fullHeight:b,offsetX:c,offsetY:d,width:e,height:f};this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null;this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,d=(this.top+this.bottom)/2,e=c-a,c=c+a, -a=d+b,b=d-b;if(null!==this.view)var c=this.zoom/(this.view.width/this.view.fullWidth),b=this.zoom/(this.view.height/this.view.fullHeight),f=(this.right-this.left)/this.view.width,d=(this.top-this.bottom)/this.view.height,e=e+this.view.offsetX/c*f,c=e+this.view.width/c*f,a=a-this.view.offsetY/b*d,b=a-this.view.height/b*d;this.projectionMatrix.makeOrthographic(e,c,a,b,this.near,this.far)},toJSON:function(a){a=D.prototype.toJSON.call(this,a);a.object.zoom=this.zoom;a.object.left=this.left;a.object.right= -this.right;a.object.top=this.top;a.object.bottom=this.bottom;a.object.near=this.near;a.object.far=this.far;null!==this.view&&(a.object.view=Object.assign({},this.view));return a}});var bf=0;Eb.prototype.isFogExp2=!0;Eb.prototype.clone=function(){return new Eb(this.color.getHex(),this.density)};Eb.prototype.toJSON=function(a){return{type:"FogExp2",color:this.color.getHex(),density:this.density}};Fb.prototype.isFog=!0;Fb.prototype.clone=function(){return new Fb(this.color.getHex(),this.near,this.far)}; -Fb.prototype.toJSON=function(a){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}};fb.prototype=Object.create(D.prototype);fb.prototype.constructor=fb;fb.prototype.copy=function(a,b){D.prototype.copy.call(this,a,b);null!==a.background&&(this.background=a.background.clone());null!==a.fog&&(this.fog=a.fog.clone());null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone());this.autoUpdate=a.autoUpdate;this.matrixAutoUpdate=a.matrixAutoUpdate;return this};fb.prototype.toJSON= -function(a){var b=D.prototype.toJSON.call(this,a);null!==this.background&&(b.object.background=this.background.toJSON(a));null!==this.fog&&(b.object.fog=this.fog.toJSON());return b};pd.prototype=Object.assign(Object.create(D.prototype),{constructor:pd,isLensFlare:!0,copy:function(a){D.prototype.copy.call(this,a);this.positionScreen.copy(a.positionScreen);this.customUpdateCallback=a.customUpdateCallback;for(var b=0,c=a.lensFlares.length;b<c;b++)this.lensFlares.push(a.lensFlares[b]);return this},add:function(a, -b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new H(16777215));void 0===d&&(d=1);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:0,opacity:f,color:e,blending:d})},updateLensFlares:function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation= -c.x*Math.PI*.25,c.rotation+=.25*(c.wantedRotation-c.rotation)}});gb.prototype=Object.create(S.prototype);gb.prototype.constructor=gb;gb.prototype.copy=function(a){S.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.rotation=a.rotation;return this};fc.prototype=Object.assign(Object.create(D.prototype),{constructor:fc,isSprite:!0,raycast:function(){var a=new q;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.distanceSqToPoint(a);d>this.scale.x*this.scale.y/ -4||c.push({distance:Math.sqrt(d),point:this.position,face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}});gc.prototype=Object.assign(Object.create(D.prototype),{constructor:gc,copy:function(a){D.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b<c;b++){var d=a[b];this.addLevel(d.object.clone(),d.distance)}return this},addLevel:function(a,b){void 0===b&&(b=0);b=Math.abs(b);for(var c=this.levels,d=0;d<c.length&&!(b<c[d].distance);d++); -c.splice(d,0,{distance:b,object:a});this.add(a)},getObjectForDistance:function(a){for(var b=this.levels,c=1,d=b.length;c<d&&!(a<b[c].distance);c++);return b[c-1].object},raycast:function(){var a=new q;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.origin.distanceTo(a);this.getObjectForDistance(d).raycast(b,c)}}(),update:function(){var a=new q,b=new q;return function(c){var d=this.levels;if(1<d.length){a.setFromMatrixPosition(c.matrixWorld);b.setFromMatrixPosition(this.matrixWorld); -c=a.distanceTo(b);d[0].object.visible=!0;for(var e=1,f=d.length;e<f;e++)if(c>=d[e].distance)d[e-1].object.visible=!1,d[e].object.visible=!0;else break;for(;e<f;e++)d[e].object.visible=!1}}}(),toJSON:function(a){a=D.prototype.toJSON.call(this,a);a.object.levels=[];for(var b=this.levels,c=0,d=b.length;c<d;c++){var e=b[c];a.object.levels.push({object:e.object.uuid,distance:e.distance})}return a}});hb.prototype=Object.create(ba.prototype);hb.prototype.constructor=hb;hb.prototype.isDataTexture=!0;Object.assign(Nc.prototype, -{calculateInverses:function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new P;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}},pose:function(){for(var a,b=0,c=this.bones.length;b<c;b++)(a=this.bones[b])&&a.matrixWorld.getInverse(this.boneInverses[b]);b=0;for(c=this.bones.length;b<c;b++)if(a=this.bones[b])a.parent&&a.parent.isBone?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position, -a.quaternion,a.scale)},update:function(){var a=new P;return function(){for(var b=0,c=this.bones.length;b<c;b++)a.multiplyMatrices(this.bones[b]?this.bones[b].matrixWorld:this.identityMatrix,this.boneInverses[b]),a.toArray(this.boneMatrices,16*b);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new Nc(this.bones,this.boneInverses,this.useVertexTexture)}});Oc.prototype=Object.assign(Object.create(D.prototype),{constructor:Oc,isBone:!0,copy:function(a){D.prototype.copy.call(this, -a);this.skin=a.skin;return this}});Pc.prototype=Object.assign(Object.create(va.prototype),{constructor:Pc,isSkinnedMesh:!0,bind:function(a,b){this.skeleton=a;void 0===b&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),b=this.matrixWorld);this.bindMatrix.copy(b);this.bindMatrixInverse.getInverse(b)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var a=0;a<this.geometry.skinWeights.length;a++){var b=this.geometry.skinWeights[a], -c=1/b.lengthManhattan();Infinity!==c?b.multiplyScalar(c):b.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var b=new da,d=this.geometry.attributes.skinWeight,a=0;a<d.count;a++)b.x=d.getX(a),b.y=d.getY(a),b.z=d.getZ(a),b.w=d.getW(a),c=1/b.lengthManhattan(),Infinity!==c?b.multiplyScalar(c):b.set(1,0,0,0),d.setXYZW(a,b.x,b.y,b.z,b.w)},updateMatrixWorld:function(a){va.prototype.updateMatrixWorld.call(this,!0);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld): -"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},clone:function(){return(new this.constructor(this.geometry,this.material,this.skeleton.useVertexTexture)).copy(this)}});na.prototype=Object.create(S.prototype);na.prototype.constructor=na;na.prototype.isLineBasicMaterial=!0;na.prototype.copy=function(a){S.prototype.copy.call(this,a);this.color.copy(a.color);this.linewidth=a.linewidth;this.linecap=a.linecap; -this.linejoin=a.linejoin;return this};Pa.prototype=Object.assign(Object.create(D.prototype),{constructor:Pa,isLine:!0,raycast:function(){var a=new P,b=new Wa,c=new Aa;return function(d,e){var f=d.linePrecision,f=f*f,g=this.geometry,k=this.matrixWorld;null===g.boundingSphere&&g.computeBoundingSphere();c.copy(g.boundingSphere);c.applyMatrix4(k);if(!1!==d.ray.intersectsSphere(c)){a.getInverse(k);b.copy(d.ray).applyMatrix4(a);var h=new q,m=new q,k=new q,u=new q,p=this&&this.isLineSegments?2:1;if(g&&g.isBufferGeometry){var n= -g.index,r=g.attributes.position.array;if(null!==n)for(var n=n.array,g=0,t=n.length-1;g<t;g+=p){var v=n[g+1];h.fromArray(r,3*n[g]);m.fromArray(r,3*v);v=b.distanceSqToSegment(h,m,u,k);v>f||(u.applyMatrix4(this.matrixWorld),v=d.ray.origin.distanceTo(u),v<d.near||v>d.far||e.push({distance:v,point:k.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else for(g=0,t=r.length/3-1;g<t;g+=p)h.fromArray(r,3*g),m.fromArray(r,3*g+3),v=b.distanceSqToSegment(h,m,u,k),v>f||(u.applyMatrix4(this.matrixWorld), -v=d.ray.origin.distanceTo(u),v<d.near||v>d.far||e.push({distance:v,point:k.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g&&g.isGeometry)for(h=g.vertices,m=h.length,g=0;g<m-1;g+=p)v=b.distanceSqToSegment(h[g],h[g+1],u,k),v>f||(u.applyMatrix4(this.matrixWorld),v=d.ray.origin.distanceTo(u),v<d.near||v>d.far||e.push({distance:v,point:k.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry, -this.material)).copy(this)}});ha.prototype=Object.assign(Object.create(Pa.prototype),{constructor:ha,isLineSegments:!0});Ja.prototype=Object.create(S.prototype);Ja.prototype.constructor=Ja;Ja.prototype.isPointsMaterial=!0;Ja.prototype.copy=function(a){S.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;return this};Gb.prototype=Object.assign(Object.create(D.prototype),{constructor:Gb,isPoints:!0,raycast:function(){var a=new P, -b=new Wa,c=new Aa;return function(d,e){function f(a,c){var f=b.distanceSqToPoint(a);if(f<u){var k=b.closestPointToPoint(a);k.applyMatrix4(h);var n=d.ray.origin.distanceTo(k);n<d.near||n>d.far||e.push({distance:n,distanceToRay:Math.sqrt(f),point:k.clone(),index:c,face:null,object:g})}}var g=this,k=this.geometry,h=this.matrixWorld,m=d.params.Points.threshold;null===k.boundingSphere&&k.computeBoundingSphere();c.copy(k.boundingSphere);c.applyMatrix4(h);if(!1!==d.ray.intersectsSphere(c)){a.getInverse(h); -b.copy(d.ray).applyMatrix4(a);var m=m/((this.scale.x+this.scale.y+this.scale.z)/3),u=m*m,m=new q;if(k&&k.isBufferGeometry){var p=k.index,k=k.attributes.position.array;if(null!==p)for(var n=p.array,p=0,r=n.length;p<r;p++){var t=n[p];m.fromArray(k,3*t);f(m,t)}else for(p=0,n=k.length/3;p<n;p++)m.fromArray(k,3*p),f(m,p)}else for(m=k.vertices,p=0,n=m.length;p<n;p++)f(m[p],p)}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});hc.prototype=Object.assign(Object.create(D.prototype), -{constructor:hc});Qc.prototype=Object.create(ba.prototype);Qc.prototype.constructor=Qc;Hb.prototype=Object.create(ba.prototype);Hb.prototype.constructor=Hb;Hb.prototype.isCompressedTexture=!0;Rc.prototype=Object.create(ba.prototype);Rc.prototype.constructor=Rc;ic.prototype=Object.create(ba.prototype);ic.prototype.constructor=ic;ic.prototype.isDepthTexture=!0;Ib.prototype=Object.create(I.prototype);Ib.prototype.constructor=Ib;jc.prototype=Object.create(R.prototype);jc.prototype.constructor=jc;sa.prototype= -Object.create(R.prototype);sa.prototype.constructor=sa;kc.prototype=Object.create(sa.prototype);kc.prototype.constructor=kc;lc.prototype=Object.create(sa.prototype);lc.prototype.constructor=lc;mc.prototype=Object.create(sa.prototype);mc.prototype.constructor=mc;nc.prototype=Object.create(sa.prototype);nc.prototype.constructor=nc;wa.prototype=Object.create(R.prototype);wa.prototype.constructor=wa;wa.NoTaper=function(a){return 1};wa.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};wa.FrenetFrames= -function(a,b,c){var d=new q,e=[],f=[],g=[],k=new q,l=new P;b+=1;var m,u,p;this.tangents=e;this.normals=f;this.binormals=g;for(m=0;m<b;m++)u=m/(b-1),e[m]=a.getTangentAt(u),e[m].normalize();f[0]=new q;g[0]=new q;a=Number.MAX_VALUE;m=Math.abs(e[0].x);u=Math.abs(e[0].y);p=Math.abs(e[0].z);m<=a&&(a=m,d.set(1,0,0));u<=a&&(a=u,d.set(0,1,0));p<=a&&d.set(0,0,1);k.crossVectors(e[0],d).normalize();f[0].crossVectors(e[0],k);g[0].crossVectors(e[0],f[0]);for(m=1;m<b;m++)f[m]=f[m-1].clone(),g[m]=g[m-1].clone(), -k.crossVectors(e[m-1],e[m]),k.length()>Number.EPSILON&&(k.normalize(),d=Math.acos(h.Math.clamp(e[m-1].dot(e[m]),-1,1)),f[m].applyMatrix4(l.makeRotationAxis(k,d))),g[m].crossVectors(e[m],f[m]);if(c)for(d=Math.acos(h.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(k.crossVectors(f[0],f[b-1]))&&(d=-d),m=1;m<b;m++)f[m].applyMatrix4(l.makeRotationAxis(e[m],d*m)),g[m].crossVectors(e[m],f[m])};Jb.prototype=Object.create(I.prototype);Jb.prototype.constructor=Jb;oc.prototype=Object.create(R.prototype); -oc.prototype.constructor=oc;Kb.prototype=Object.create(I.prototype);Kb.prototype.constructor=Kb;pc.prototype=Object.create(R.prototype);pc.prototype.constructor=pc;h.ShapeUtils={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e<b;d=e++)c+=a[d].x*a[e].y-a[e].x*a[d].y;return.5*c},triangulate:function(){return function(a,b){var c=a.length;if(3>c)return null;var d=[],e=[],f=[],g,k,l;if(0<h.ShapeUtils.area(a))for(k=0;k<c;k++)e[k]=k;else for(k=0;k<c;k++)e[k]=c-1-k;var m=2*c;for(k=c-1;2<c;){if(0>=m--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"); -break}g=k;c<=g&&(g=0);k=g+1;c<=k&&(k=0);l=k+1;c<=l&&(l=0);var q;a:{var p,n,r,t,v,A,w,x;p=a[e[g]].x;n=a[e[g]].y;r=a[e[k]].x;t=a[e[k]].y;v=a[e[l]].x;A=a[e[l]].y;if(Number.EPSILON>(r-p)*(A-n)-(t-n)*(v-p))q=!1;else{var C,y,F,G,E,J,D,z,I,H;C=v-r;y=A-t;F=p-v;G=n-A;E=r-p;J=t-n;for(q=0;q<c;q++)if(w=a[e[q]].x,x=a[e[q]].y,!(w===p&&x===n||w===r&&x===t||w===v&&x===A)&&(D=w-p,z=x-n,I=w-r,H=x-t,w-=v,x-=A,I=C*H-y*I,D=E*z-J*D,z=F*x-G*w,I>=-Number.EPSILON&&z>=-Number.EPSILON&&D>=-Number.EPSILON)){q=!1;break a}q=!0}}if(q){d.push([a[e[g]], -a[e[k]],a[e[l]]]);f.push([e[g],e[k],e[l]]);g=k;for(l=k+1;l<c;g++,l++)e[g]=e[l];c--;m=2*c}}return b?f:d}}(),triangulateShape:function(a,b){function c(a){var b=a.length;2<b&&a[b-1].equals(a[0])&&a.pop()}function d(a,b,c){return a.x!==b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function e(a,b,c,e,f){var g=b.x-a.x,k=b.y-a.y,h=e.x-c.x,l=e.y-c.y,n=a.x-c.x,m=a.y-c.y,p=k*h-g*l,q=k*n-g*m;if(Math.abs(p)>Number.EPSILON){if(0<p){if(0>q||q>p)return[];h=l*n-h* -m;if(0>h||h>p)return[]}else{if(0<q||q<p)return[];h=l*n-h*m;if(0<h||h<p)return[]}if(0===h)return!f||0!==q&&q!==p?[a]:[];if(h===p)return!f||0!==q&&q!==p?[b]:[];if(0===q)return[c];if(q===p)return[e];f=h/p;return[{x:a.x+f*g,y:a.y+f*k}]}if(0!==q||l*n!==h*m)return[];k=0===g&&0===k;h=0===h&&0===l;if(k&&h)return a.x!==c.x||a.y!==c.y?[]:[a];if(k)return d(c,e,a)?[a]:[];if(h)return d(a,b,c)?[c]:[];0!==g?(a.x<b.x?(g=a,h=a.x,k=b,a=b.x):(g=b,h=b.x,k=a,a=a.x),c.x<e.x?(b=c,p=c.x,l=e,c=e.x):(b=e,p=e.x,l=c,c=c.x)): -(a.y<b.y?(g=a,h=a.y,k=b,a=b.y):(g=b,h=b.y,k=a,a=a.y),c.y<e.y?(b=c,p=c.y,l=e,c=e.y):(b=e,p=e.y,l=c,c=c.y));return h<=p?a<p?[]:a===p?f?[]:[b]:a<=c?[b,k]:[b,l]:h>c?[]:h===c?f?[]:[g]:a<=c?[g,k]:[g,l]}function f(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return Math.abs(a)>Number.EPSILON?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}c(a);b.forEach(c);var g,k,l,m,q,p={};l=a.concat();g=0;for(k=b.length;g<k;g++)Array.prototype.push.apply(l,b[g]);g=0;for(k= -l.length;g<k;g++)q=l[g].x+":"+l[g].y,void 0!==p[q]&&console.warn("THREE.ShapeUtils: Duplicate point",q,g),p[q]=g;g=function(a,b){function c(a,b){var d=k.length-1,e=a-1;0>e&&(e=d);var g=a+1;g>d&&(g=0);d=f(k[a],k[e],k[g],h[b]);if(!d)return!1;d=h.length-1;e=b-1;0>e&&(e=d);g=b+1;g>d&&(g=0);return(d=f(h[b],h[e],h[g],k[a]))?!0:!1}function d(a,b){var c,f;for(c=0;c<k.length;c++)if(f=c+1,f%=k.length,f=e(a,b,k[c],k[f],!0),0<f.length)return!0;return!1}function g(a,c){var d,f,k,h;for(d=0;d<l.length;d++)for(f= -b[l[d]],k=0;k<f.length;k++)if(h=k+1,h%=f.length,h=e(a,c,f[k],f[h],!0),0<h.length)return!0;return!1}var k=a.concat(),h,l=[],n,m,p,q,u,C=[],D,z,I,H=0;for(n=b.length;H<n;H++)l.push(H);D=0;for(var L=2*l.length;0<l.length;){L--;if(0>L){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(m=D;m<k.length;m++){p=k[m];n=-1;for(H=0;H<l.length;H++)if(q=l[H],u=p.x+":"+p.y+":"+q,void 0===C[u]){h=b[q];for(z=0;z<h.length;z++)if(q=h[z],c(m,z)&&!d(p,q)&&!g(p,q)){n=z;l.splice(H, -1);D=k.slice(0,m+1);q=k.slice(m);z=h.slice(n);I=h.slice(0,n+1);k=D.concat(z).concat(I).concat(q);D=m;break}if(0<=n)break;C[u]=!0}if(0<=n)break}}return k}(a,b);var n=h.ShapeUtils.triangulate(g,!1);g=0;for(k=n.length;g<k;g++)for(m=n[g],l=0;3>l;l++)q=m[l].x+":"+m[l].y,q=p[q],void 0!==q&&(m[l]=q);return n.concat()},isClockWise:function(a){return 0>h.ShapeUtils.area(a)},b2:function(){return function(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}}(),b3:function(){return function(a,b,c,d,e){var f=1- -a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}}()};ra.prototype=Object.create(R.prototype);ra.prototype.constructor=ra;ra.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};ra.prototype.addShape=function(a,b){function c(a,b,c){b||console.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d,e,f;e=a.x-b.x;f=a.y-b.y;d=c.x-a.x;var g=c.y-a.y,k=e*e+f*f;if(Math.abs(e*g-f*d)>Number.EPSILON){var h= -Math.sqrt(k),l=Math.sqrt(d*d+g*g),k=b.x-f/h;b=b.y+e/h;g=((c.x-g/l-k)*g-(c.y+d/l-b)*d)/(e*g-f*d);d=k+e*g-a.x;e=b+f*g-a.y;f=d*d+e*e;if(2>=f)return new C(d,e);f=Math.sqrt(f/2)}else a=!1,e>Number.EPSILON?d>Number.EPSILON&&(a=!0):e<-Number.EPSILON?d<-Number.EPSILON&&(a=!0):Math.sign(f)===Math.sign(g)&&(a=!0),a?(d=-f,f=Math.sqrt(k)):(d=e,e=f,f=Math.sqrt(k/2));return new C(d/f,e/f)}function e(a,b){var c,d;for(K=a.length;0<=--K;){c=K;d=K-1;0>d&&(d=a.length-1);var e,f=r+2*u;for(e=0;e<f;e++){var g=U*e,k=U* -(e+1),h=b+c+g,g=b+d+g,l=b+d+k,k=b+c+k,h=h+N,g=g+N,l=l+N,k=k+N;I.faces.push(new ga(h,g,k,null,null,1));I.faces.push(new ga(g,l,k,null,null,1));h=w.generateSideWallUV(I,h,g,l,k);I.faceVertexUvs[0].push([h[0],h[1],h[3]]);I.faceVertexUvs[0].push([h[1],h[2],h[3]])}}}function f(a,b,c){I.vertices.push(new q(a,b,c))}function g(a,b,c){a+=N;b+=N;c+=N;I.faces.push(new ga(a,b,c,null,null,0));a=w.generateTopUV(I,a,b,c);I.faceVertexUvs[0].push(a)}var k=void 0!==b.amount?b.amount:100,l=void 0!==b.bevelThickness? -b.bevelThickness:6,m=void 0!==b.bevelSize?b.bevelSize:l-2,u=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,r=void 0!==b.steps?b.steps:1,t=b.extrudePath,v,A=!1,w=void 0!==b.UVGenerator?b.UVGenerator:ra.WorldUVGenerator,x,D,y,F;t&&(v=t.getSpacedPoints(r),A=!0,p=!1,x=void 0!==b.frames?b.frames:new wa.FrenetFrames(t,r,!1),D=new q,y=new q,F=new q);p||(m=l=u=0);var G,E,z,I=this,N=this.vertices.length,t=a.extractPoints(n), -n=t.shape,H=t.holes;if(t=!h.ShapeUtils.isClockWise(n)){n=n.reverse();E=0;for(z=H.length;E<z;E++)G=H[E],h.ShapeUtils.isClockWise(G)&&(H[E]=G.reverse());t=!1}var P=h.ShapeUtils.triangulateShape(n,H),S=n;E=0;for(z=H.length;E<z;E++)G=H[E],n=n.concat(G);var R,L,M,O,Q,U=n.length,V,W=P.length,t=[],K=0;M=S.length;R=M-1;for(L=K+1;K<M;K++,R++,L++)R===M&&(R=0),L===M&&(L=0),t[K]=d(S[K],S[R],S[L]);var Z=[],Y,ba=t.concat();E=0;for(z=H.length;E<z;E++){G=H[E];Y=[];K=0;M=G.length;R=M-1;for(L=K+1;K<M;K++,R++,L++)R=== -M&&(R=0),L===M&&(L=0),Y[K]=d(G[K],G[R],G[L]);Z.push(Y);ba=ba.concat(Y)}for(R=0;R<u;R++){M=R/u;O=l*Math.cos(M*Math.PI/2);L=m*Math.sin(M*Math.PI/2);K=0;for(M=S.length;K<M;K++)Q=c(S[K],t[K],L),f(Q.x,Q.y,-O);E=0;for(z=H.length;E<z;E++)for(G=H[E],Y=Z[E],K=0,M=G.length;K<M;K++)Q=c(G[K],Y[K],L),f(Q.x,Q.y,-O)}L=m;for(K=0;K<U;K++)Q=p?c(n[K],ba[K],L):n[K],A?(y.copy(x.normals[0]).multiplyScalar(Q.x),D.copy(x.binormals[0]).multiplyScalar(Q.y),F.copy(v[0]).add(y).add(D),f(F.x,F.y,F.z)):f(Q.x,Q.y,0);for(M=1;M<= -r;M++)for(K=0;K<U;K++)Q=p?c(n[K],ba[K],L):n[K],A?(y.copy(x.normals[M]).multiplyScalar(Q.x),D.copy(x.binormals[M]).multiplyScalar(Q.y),F.copy(v[M]).add(y).add(D),f(F.x,F.y,F.z)):f(Q.x,Q.y,k/r*M);for(R=u-1;0<=R;R--){M=R/u;O=l*Math.cos(M*Math.PI/2);L=m*Math.sin(M*Math.PI/2);K=0;for(M=S.length;K<M;K++)Q=c(S[K],t[K],L),f(Q.x,Q.y,k+O);E=0;for(z=H.length;E<z;E++)for(G=H[E],Y=Z[E],K=0,M=G.length;K<M;K++)Q=c(G[K],Y[K],L),A?f(Q.x,Q.y+v[r-1].y,v[r-1].x+O):f(Q.x,Q.y,k+O)}(function(){if(p){var a=0*U;for(K=0;K< -W;K++)V=P[K],g(V[2]+a,V[1]+a,V[0]+a);a=U*(r+2*u);for(K=0;K<W;K++)V=P[K],g(V[0]+a,V[1]+a,V[2]+a)}else{for(K=0;K<W;K++)V=P[K],g(V[2],V[1],V[0]);for(K=0;K<W;K++)V=P[K],g(V[0]+U*r,V[1]+U*r,V[2]+U*r)}})();(function(){var a=0;e(S,a);a+=S.length;E=0;for(z=H.length;E<z;E++)G=H[E],e(G,a),a+=G.length})()};ra.WorldUVGenerator={generateTopUV:function(a,b,c,d){a=a.vertices;b=a[b];c=a[c];d=a[d];return[new C(b.x,b.y),new C(c.x,c.y),new C(d.x,d.y)]},generateSideWallUV:function(a,b,c,d,e){a=a.vertices;b=a[b];c=a[c]; -d=a[d];e=a[e];return.01>Math.abs(b.y-c.y)?[new C(b.x,1-b.z),new C(c.x,1-c.z),new C(d.x,1-d.z),new C(e.x,1-e.z)]:[new C(b.y,1-b.z),new C(c.y,1-c.z),new C(d.y,1-d.z),new C(e.y,1-e.z)]}};qc.prototype=Object.create(ra.prototype);qc.prototype.constructor=qc;ib.prototype=Object.create(I.prototype);ib.prototype.constructor=ib;Lb.prototype=Object.create(R.prototype);Lb.prototype.constructor=Lb;Mb.prototype=Object.create(I.prototype);Mb.prototype.constructor=Mb;rc.prototype=Object.create(R.prototype);rc.prototype.constructor= -rc;sc.prototype=Object.create(R.prototype);sc.prototype.constructor=sc;Nb.prototype=Object.create(I.prototype);Nb.prototype.constructor=Nb;tc.prototype=Object.create(R.prototype);tc.prototype.constructor=tc;Ya.prototype=Object.create(R.prototype);Ya.prototype.constructor=Ya;Ya.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};Ya.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?ra.WorldUVGenerator:b.UVGenerator, -e,f,g,k=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var l=e.shape,m=e.holes;if(!h.ShapeUtils.isClockWise(l))for(l=l.reverse(),e=0,f=m.length;e<f;e++)g=m[e],h.ShapeUtils.isClockWise(g)&&(m[e]=g.reverse());var u=h.ShapeUtils.triangulateShape(l,m);e=0;for(f=m.length;e<f;e++)g=m[e],l=l.concat(g);m=l.length;f=u.length;for(e=0;e<m;e++)g=l[e],this.vertices.push(new q(g.x,g.y,0));for(e=0;e<f;e++)m=u[e],l=m[0]+k,g=m[1]+k,m=m[2]+k,this.faces.push(new ga(l,g,m,null,null, -c)),this.faceVertexUvs[0].push(d.generateTopUV(this,l,g,m))};Ob.prototype=Object.create(I.prototype);Ob.prototype.constructor=Ob;Za.prototype=Object.create(I.prototype);Za.prototype.constructor=Za;jb.prototype=Object.create(R.prototype);jb.prototype.constructor=jb;uc.prototype=Object.create(jb.prototype);uc.prototype.constructor=uc;vc.prototype=Object.create(I.prototype);vc.prototype.constructor=vc;Pb.prototype=Object.create(I.prototype);Pb.prototype.constructor=Pb;wc.prototype=Object.create(R.prototype); -wc.prototype.constructor=wc;kb.prototype=Object.create(R.prototype);kb.prototype.constructor=kb;var ua=Object.freeze({WireframeGeometry:Ib,ParametricGeometry:jc,TetrahedronGeometry:kc,OctahedronGeometry:lc,IcosahedronGeometry:mc,DodecahedronGeometry:nc,PolyhedronGeometry:sa,TubeGeometry:wa,TorusKnotGeometry:oc,TorusKnotBufferGeometry:Jb,TorusGeometry:pc,TorusBufferGeometry:Kb,TextGeometry:qc,SphereBufferGeometry:ib,SphereGeometry:Lb,RingGeometry:rc,RingBufferGeometry:Mb,PlaneBufferGeometry:eb,PlaneGeometry:sc, -LatheGeometry:tc,LatheBufferGeometry:Nb,ShapeGeometry:Ya,ExtrudeGeometry:ra,EdgesGeometry:Ob,ConeGeometry:uc,ConeBufferGeometry:vc,CylinderGeometry:jb,CylinderBufferGeometry:Za,CircleBufferGeometry:Pb,CircleGeometry:wc,BoxBufferGeometry:db,BoxGeometry:kb});Qb.prototype=Object.create(Da.prototype);Qb.prototype.constructor=Qb;Qb.prototype.isShadowMaterial=!0;Rb.prototype=Object.create(Da.prototype);Rb.prototype.constructor=Rb;Rb.prototype.isRawShaderMaterial=!0;xc.prototype={constructor:xc,isMultiMaterial:!0, -toJSON:function(a){for(var b={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},c=this.materials,d=0,e=c.length;d<e;d++){var f=c[d].toJSON(a);delete f.metadata;b.materials.push(f)}b.visible=this.visible;return b},clone:function(){for(var a=new this.constructor,b=0;b<this.materials.length;b++)a.materials.push(this.materials[b].clone());a.visible=this.visible;return a}};Ka.prototype=Object.create(S.prototype);Ka.prototype.constructor=Ka; -Ka.prototype.isMeshStandardMaterial=!0;Ka.prototype.copy=function(a){S.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap= -a.normalMap;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin; -this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};lb.prototype=Object.create(Ka.prototype);lb.prototype.constructor=lb;lb.prototype.isMeshPhysicalMaterial=!0;lb.prototype.copy=function(a){Ka.prototype.copy.call(this,a);this.defines={PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearCoat=a.clearCoat;this.clearCoatRoughness=a.clearCoatRoughness;return this};$a.prototype=Object.create(S.prototype);$a.prototype.constructor=$a;$a.prototype.isMeshPhongMaterial= -!0;$a.prototype.copy=function(a){S.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalScale.copy(a.normalScale); -this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets; -this.morphNormals=a.morphNormals;return this};mb.prototype=Object.create(S.prototype);mb.prototype.constructor=mb;mb.prototype.isMeshNormalMaterial=!0;mb.prototype.copy=function(a){S.prototype.copy.call(this,a);this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;return this};nb.prototype=Object.create(S.prototype);nb.prototype.constructor=nb;nb.prototype.isMeshLambertMaterial=!0;nb.prototype.copy=function(a){S.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map; -this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap; -this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};ob.prototype=Object.create(S.prototype);ob.prototype.constructor=ob;ob.prototype.isLineDashedMaterial=!0;ob.prototype.copy=function(a){S.prototype.copy.call(this,a);this.color.copy(a.color);this.linewidth=a.linewidth;this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var nf=Object.freeze({ShadowMaterial:Qb,SpriteMaterial:gb, -RawShaderMaterial:Rb,ShaderMaterial:Da,PointsMaterial:Ja,MultiMaterial:xc,MeshPhysicalMaterial:lb,MeshStandardMaterial:Ka,MeshPhongMaterial:$a,MeshNormalMaterial:mb,MeshLambertMaterial:nb,MeshDepthMaterial:Ua,MeshBasicMaterial:Ia,LineDashedMaterial:ob,LineBasicMaterial:na,Material:S});h.Cache={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}}; -h.DefaultLoadingManager=new qd;Object.assign(za.prototype,{load:function(a,b,c,d){void 0!==this.path&&(a=this.path+a);var e=this,f=h.Cache.get(a);if(void 0!==f)return e.manager.itemStart(a),setTimeout(function(){b&&b(f);e.manager.itemEnd(a)},0),f;var g=new XMLHttpRequest;g.open("GET",a,!0);g.addEventListener("load",function(c){var f=c.target.response;h.Cache.add(a,f);200===this.status?(b&&b(f),e.manager.itemEnd(a)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),b&&b(f), -e.manager.itemEnd(a)):(d&&d(c),e.manager.itemError(a))},!1);void 0!==c&&g.addEventListener("progress",function(a){c(a)},!1);g.addEventListener("error",function(b){d&&d(b);e.manager.itemError(a)},!1);void 0!==this.responseType&&(g.responseType=this.responseType);void 0!==this.withCredentials&&(g.withCredentials=this.withCredentials);g.overrideMimeType&&g.overrideMimeType("text/plain");g.send(null);e.manager.itemStart(a);return g},setPath:function(a){this.path=a;return this},setResponseType:function(a){this.responseType= -a;return this},setWithCredentials:function(a){this.withCredentials=a;return this}});Object.assign(ie.prototype,{load:function(a,b,c,d){function e(e){h.load(a[e],function(a){a=f._parser(a,!0);g[e]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps};m+=1;6===m&&(1===a.mipmapCount&&(k.minFilter=1006),k.format=a.format,k.needsUpdate=!0,b&&b(k))},c,d)}var f=this,g=[],k=new Hb;k.image=g;var h=new za(this.manager);h.setPath(this.path);h.setResponseType("arraybuffer");if(Array.isArray(a))for(var m= -0,q=0,p=a.length;q<p;++q)e(q);else h.load(a,function(a){a=f._parser(a,!0);if(a.isCubemap)for(var c=a.mipmaps.length/a.mipmapCount,d=0;d<c;d++){g[d]={mipmaps:[]};for(var e=0;e<a.mipmapCount;e++)g[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+e]),g[d].format=a.format,g[d].width=a.width,g[d].height=a.height}else k.image.width=a.width,k.image.height=a.height,k.mipmaps=a.mipmaps;1===a.mipmapCount&&(k.minFilter=1006);k.format=a.format;k.needsUpdate=!0;b&&b(k)},c,d);return k},setPath:function(a){this.path=a; -return this}});Object.assign(rd.prototype,{load:function(a,b,c,d){var e=this,f=new hb,g=new za(this.manager);g.setResponseType("arraybuffer");g.load(a,function(a){if(a=e._parser(a))void 0!==a.image?f.image=a.image:void 0!==a.data&&(f.image.width=a.width,f.image.height=a.height,f.image.data=a.data),f.wrapS=void 0!==a.wrapS?a.wrapS:1001,f.wrapT=void 0!==a.wrapT?a.wrapT:1001,f.magFilter=void 0!==a.magFilter?a.magFilter:1006,f.minFilter=void 0!==a.minFilter?a.minFilter:1008,f.anisotropy=void 0!==a.anisotropy? -a.anisotropy:1,void 0!==a.format&&(f.format=a.format),void 0!==a.type&&(f.type=a.type),void 0!==a.mipmaps&&(f.mipmaps=a.mipmaps),1===a.mipmapCount&&(f.minFilter=1006),f.needsUpdate=!0,b&&b(f,a)},c,d);return f}});Object.assign(yc.prototype,{load:function(a,b,c,d){var e=this,f=document.createElementNS("http://www.w3.org/1999/xhtml","img");f.onload=function(){f.onload=null;URL.revokeObjectURL(f.src);b&&b(f);e.manager.itemEnd(a)};if(0===a.indexOf("data:"))f.src=a;else{var g=new za;g.setPath(this.path); -g.setResponseType("blob");g.setWithCredentials(this.withCredentials);g.load(a,function(a){f.src=URL.createObjectURL(a)},c,d)}e.manager.itemStart(a);return f},setCrossOrigin:function(a){this.crossOrigin=a;return this},setWithCredentials:function(a){this.withCredentials=a;return this},setPath:function(a){this.path=a;return this}});Object.assign(sd.prototype,{load:function(a,b,c,d){function e(c){g.load(a[c],function(a){f.images[c]=a;k++;6===k&&(f.needsUpdate=!0,b&&b(f))},void 0,d)}var f=new Ta,g=new yc(this.manager); -g.setCrossOrigin(this.crossOrigin);g.setPath(this.path);var k=0;for(c=0;c<a.length;++c)e(c);return f},setCrossOrigin:function(a){this.crossOrigin=a;return this},setPath:function(a){this.path=a;return this}});Object.assign(Sc.prototype,{load:function(a,b,c,d){var e=new ba,f=new yc(this.manager);f.setCrossOrigin(this.crossOrigin);f.setWithCredentials(this.withCredentials);f.setPath(this.path);f.load(a,function(c){var d=0<a.search(/\.(jpg|jpeg)$/)||0===a.search(/^data\:image\/jpeg/);e.format=d?1022: -1023;e.image=c;e.needsUpdate=!0;void 0!==b&&b(e)},c,d);return e},setCrossOrigin:function(a){this.crossOrigin=a;return this},setWithCredentials:function(a){this.withCredentials=a;return this},setPath:function(a){this.path=a;return this}});oa.prototype=Object.assign(Object.create(D.prototype),{constructor:oa,isLight:!0,copy:function(a){D.prototype.copy.call(this,a);this.color.copy(a.color);this.intensity=a.intensity;return this},toJSON:function(a){a=D.prototype.toJSON.call(this,a);a.object.color=this.color.getHex(); -a.object.intensity=this.intensity;void 0!==this.groundColor&&(a.object.groundColor=this.groundColor.getHex());void 0!==this.distance&&(a.object.distance=this.distance);void 0!==this.angle&&(a.object.angle=this.angle);void 0!==this.decay&&(a.object.decay=this.decay);void 0!==this.penumbra&&(a.object.penumbra=this.penumbra);void 0!==this.shadow&&(a.object.shadow=this.shadow.toJSON());return a}});Tc.prototype=Object.assign(Object.create(oa.prototype),{constructor:Tc,isHemisphereLight:!0,copy:function(a){oa.prototype.copy.call(this, -a);this.groundColor.copy(a.groundColor);return this}});Object.assign(pb.prototype,{copy:function(a){this.camera=a.camera.clone();this.bias=a.bias;this.radius=a.radius;this.mapSize.copy(a.mapSize);return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a={};0!==this.bias&&(a.bias=this.bias);1!==this.radius&&(a.radius=this.radius);if(512!==this.mapSize.x||512!==this.mapSize.y)a.mapSize=this.mapSize.toArray();a.camera=this.camera.toJSON(!1).object;delete a.camera.matrix; -return a}});Uc.prototype=Object.assign(Object.create(pb.prototype),{constructor:Uc,isSpotLightShadow:!0,update:function(a){var b=2*h.Math.RAD2DEG*a.angle,c=this.mapSize.width/this.mapSize.height;a=a.distance||500;var d=this.camera;if(b!==d.fov||c!==d.aspect||a!==d.far)d.fov=b,d.aspect=c,d.far=a,d.updateProjectionMatrix()}});Vc.prototype=Object.assign(Object.create(oa.prototype),{constructor:Vc,isSpotLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.distance=a.distance;this.angle=a.angle; -this.penumbra=a.penumbra;this.decay=a.decay;this.target=a.target.clone();this.shadow=a.shadow.clone();return this}});Wc.prototype=Object.assign(Object.create(oa.prototype),{constructor:Wc,isPointLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.distance=a.distance;this.decay=a.decay;this.shadow=a.shadow.clone();return this}});Xc.prototype=Object.assign(Object.create(pb.prototype),{constructor:Xc});Yc.prototype=Object.assign(Object.create(oa.prototype),{constructor:Yc,isDirectionalLight:!0, -copy:function(a){oa.prototype.copy.call(this,a);this.target=a.target.clone();this.shadow=a.shadow.clone();return this}});Zc.prototype=Object.assign(Object.create(oa.prototype),{constructor:Zc,isAmbientLight:!0});h.AnimationUtils={arraySlice:function(a,b,c){return h.AnimationUtils.isTypedArray(a)?new a.constructor(a.subarray(b,c)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&& -!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var k=c[f]*b,h=0;h!==b;++h)e[g++]=a[k+h];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g)){do g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)), -f=a[e++];while(void 0!==f)}else if(void 0!==g.toArray){do g=f[d],void 0!==g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};ja.prototype={constructor:ja,evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a<d)){for(var f=c+2;;){if(void 0===d){if(a<e)break d;this._cachedIndex=c=b.length;return this.afterEnd_(c-1,a,e)}if(c===f)break;e=d;d=b[++c]; -if(a<d)break b}d=b.length;break c}if(a>=e)break a;else{f=b[1];a<f&&(c=2,e=f);for(f=c-2;;){if(void 0===e)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(c===f)break;d=e;e=b[--c-1];if(a>=e)break b}d=c;c=0}}for(;c<d;)e=c+d>>>1,a<b[e]?d=e:c=e+1;d=b[c];e=b[c-1];if(void 0===e)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(void 0===d)return this._cachedIndex=c=b.length,this.afterEnd_(c-1,e,a)}this._cachedIndex=c;this.intervalChanged_(c,e,d)}return this.interpolate_(c,e,a,d)},settings:null, -DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(a){var b=this.resultBuffer,c=this.sampleValues,d=this.valueSize;a*=d;for(var e=0;e!==d;++e)b[e]=c[a+e];return b},interpolate_:function(a,b,c,d){throw Error("call to abstract method");},intervalChanged_:function(a,b,c){}};Object.assign(ja.prototype,{beforeStart_:ja.prototype.copySampleValue_,afterEnd_:ja.prototype.copySampleValue_});$c.prototype=Object.assign(Object.create(ja.prototype), -{constructor:$c,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(a,b,c){var d=this.parameterPositions,e=a-2,f=a+1,g=d[e],k=d[f];if(void 0===g)switch(this.getSettings_().endingStart){case 2401:e=a;g=2*b-c;break;case 2402:e=d.length-2;g=b+d[e]-d[e+1];break;default:e=a,g=c}if(void 0===k)switch(this.getSettings_().endingEnd){case 2401:f=a;k=2*c-b;break;case 2402:f=1;k=c+d[1]-d[0];break;default:f=a-1,k=b}a=.5*(c-b);d=this.valueSize;this._weightPrev=a/(b-g);this._weightNext= -a/(k-c);this._offsetPrev=e*d;this._offsetNext=f*d},interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;a*=g;var k=a-g,h=this._offsetPrev,m=this._offsetNext,q=this._weightPrev,p=this._weightNext,n=(c-b)/(d-b);c=n*n;d=c*n;b=-q*d+2*q*c-q*n;q=(1+q)*d+(-1.5-2*q)*c+(-.5+q)*n+1;n=(-1-p)*d+(1.5+p)*c+.5*n;p=p*d-p*c;for(c=0;c!==g;++c)e[c]=b*f[h+c]+q*f[k+c]+n*f[a+c]+p*f[m+c];return e}});zc.prototype=Object.assign(Object.create(ja.prototype),{constructor:zc,interpolate_:function(a, -b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;a*=g;var k=a-g;b=(c-b)/(d-b);c=1-b;for(d=0;d!==g;++d)e[d]=f[k+d]*c+f[a+d]*b;return e}});ad.prototype=Object.assign(Object.create(ja.prototype),{constructor:ad,interpolate_:function(a,b,c,d){return this.copySampleValue_(a-1)}});var Sa;Sa={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(a){return new ad(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodLinear:function(a){return new zc(this.times, -this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:function(a){return new $c(this.times,this.values,this.getValueSize(),a)},setInterpolation:function(a){var b;switch(a){case 2300:b=this.InterpolantFactoryMethodDiscrete;break;case 2301:b=this.InterpolantFactoryMethodLinear;break;case 2302:b=this.InterpolantFactoryMethodSmooth}if(void 0===b){b="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(a!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation); -else throw Error(b);console.warn(b)}else this.createInterpolant=b},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(a){if(0!==a)for(var b=this.times,c=0,d=b.length;c!==d;++c)b[c]+=a;return this},scale:function(a){if(1!==a)for(var b=this.times,c= -0,d=b.length;c!==d;++c)b[c]*=a;return this},trim:function(a,b){for(var c=this.times,d=c.length,e=0,f=d-1;e!==d&&c[e]<a;)++e;for(;-1!==f&&c[f]>b;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),d=this.getValueSize(),this.times=h.AnimationUtils.arraySlice(c,e,f),this.values=h.AnimationUtils.arraySlice(this.values,e*d,f*d);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("invalid value size in track",this),a=!1);var c=this.times,b=this.values, -d=c.length;0===d&&(console.error("track is empty",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("time is not a valid number",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("out of order keys",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&h.AnimationUtils.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("value is not a valid number",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values, -c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;g<f;++g){var k=!1,l=a[g];if(l!==a[g+1]&&(1!==g||l!==l[0]))if(d)k=!0;else for(var m=g*c,q=m-c,p=m+c,l=0;l!==c;++l){var n=b[m+l];if(n!==b[q+l]||n!==b[p+l]){k=!0;break}}if(k){if(g!==e)for(a[e]=a[g],k=g*c,m=e*c,l=0;l!==c;++l)b[m+l]=b[k+l];++e}}if(0<f){a[e]=a[f];k=f*c;m=e*c;for(l=0;l!==c;++l)b[m+l]=b[k+l];++e}e!==a.length&&(this.times=h.AnimationUtils.arraySlice(a,0,e),this.values=h.AnimationUtils.arraySlice(b,0,e*c));return this}}; -Sb.prototype=Object.assign(Object.create(Sa),{constructor:Sb,ValueTypeName:"vector"});bd.prototype=Object.assign(Object.create(ja.prototype),{constructor:bd,interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;a*=g;b=(c-b)/(d-b);for(c=a+g;a!==c;a+=4)ca.slerpFlat(e,0,f,a-g,f,a,b);return e}});Ac.prototype=Object.assign(Object.create(Sa),{constructor:Ac,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(a){return new bd(this.times, -this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:void 0});Tb.prototype=Object.assign(Object.create(Sa),{constructor:Tb,ValueTypeName:"number"});cd.prototype=Object.assign(Object.create(Sa),{constructor:cd,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});dd.prototype=Object.assign(Object.create(Sa),{constructor:dd,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300, -InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});ed.prototype=Object.assign(Object.create(Sa),{constructor:ed,ValueTypeName:"color"});rb.prototype=Sa;Sa.constructor=rb;Object.assign(rb,{parse:function(a){if(void 0===a.type)throw Error("track type undefined, can not parse");var b=rb._getTrackTypeForValueTypeName(a.type);if(void 0===a.times){var c=[],d=[];h.AnimationUtils.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name, -a.times,a.values,a.interpolation)},toJSON:function(a){var b=a.constructor;if(void 0!==b.toJSON)b=b.toJSON(a);else{var b={name:a.name,times:h.AnimationUtils.convertArray(a.times,Array),values:h.AnimationUtils.convertArray(a.values,Array)},c=a.getInterpolation();c!==a.DefaultInterpolation&&(b.interpolation=c)}b.type=a.ValueTypeName;return b},_getTrackTypeForValueTypeName:function(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return Tb;case "vector":case "vector2":case "vector3":case "vector4":return Sb; -case "color":return ed;case "quaternion":return Ac;case "bool":case "boolean":return dd;case "string":return cd}throw Error("Unsupported typeName: "+a);}});ta.prototype={constructor:ta,resetDuration:function(){for(var a=0,b=0,c=this.tracks.length;b!==c;++b)var d=this.tracks[b],a=Math.max(a,d.times[d.times.length-1]);this.duration=a},trim:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,this.duration);return this},optimize:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].optimize(); -return this}};Object.assign(ta,{parse:function(a){for(var b=[],c=a.tracks,d=1/(a.fps||1),e=0,f=c.length;e!==f;++e)b.push(rb.parse(c[e]).scale(d));return new ta(a.name,a.duration,b)},toJSON:function(a){var b=[],c=a.tracks;a={name:a.name,duration:a.duration,tracks:b};for(var d=0,e=c.length;d!==e;++d)b.push(rb.toJSON(c[d]));return a},CreateFromMorphTargetSequence:function(a,b,c,d){for(var e=b.length,f=[],g=0;g<e;g++){var k=[],l=[];k.push((g+e-1)%e,g,(g+1)%e);l.push(0,1,0);var m=h.AnimationUtils.getKeyframeOrder(k), -k=h.AnimationUtils.sortedArray(k,1,m),l=h.AnimationUtils.sortedArray(l,1,m);d||0!==k[0]||(k.push(e),l.push(l[0]));f.push((new Tb(".morphTargetInfluences["+b[g].name+"]",k,l)).scale(1/c))}return new ta(a,-1,f)},findByName:function(a,b){var c=a;Array.isArray(a)||(c=a.geometry&&a.geometry.animations||a.animations);for(var d=0;d<c.length;d++)if(c[d].name===b)return c[d];return null},CreateClipsFromMorphTargetSequences:function(a,b,c){for(var d={},e=/^([\w-]*?)([\d]+)$/,f=0,g=a.length;f<g;f++){var k=a[f], -h=k.name.match(e);if(h&&1<h.length){var m=h[1];(h=d[m])||(d[m]=h=[]);h.push(k)}}a=[];for(m in d)a.push(ta.CreateFromMorphTargetSequence(m,d[m],b,c));return a},parseAnimation:function(a,b){if(!a)return console.error(" no animation in JSONLoader data"),null;for(var c=function(a,b,c,d,e){if(0!==c.length){var f=[],g=[];h.AnimationUtils.flattenJSON(c,f,g,d);0!==f.length&&e.push(new a(b,f,g))}},d=[],e=a.name||"default",f=a.length||-1,g=a.fps||30,k=a.hierarchy||[],l=0;l<k.length;l++){var m=k[l].keys;if(m&& -0!==m.length)if(m[0].morphTargets){for(var f={},q=0;q<m.length;q++)if(m[q].morphTargets)for(var p=0;p<m[q].morphTargets.length;p++)f[m[q].morphTargets[p]]=-1;for(var n in f){for(var r=[],t=[],p=0;p!==m[q].morphTargets.length;++p){var v=m[q];r.push(v.time);t.push(v.morphTarget===n?1:0)}d.push(new Tb(".morphTargetInfluence["+n+"]",r,t))}f=f.length*(g||1)}else q=".bones["+b[l].name+"]",c(Sb,q+".position",m,"pos",d),c(Ac,q+".quaternion",m,"rot",d),c(Sb,q+".scale",m,"scl",d)}return 0===d.length?null:new ta(e, -f,d)}});Object.assign(fd.prototype,{load:function(a,b,c,d){var e=this;(new za(e.manager)).load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setTextures:function(a){this.textures=a},parse:function(a){function b(a){void 0===c[a]&&console.warn("THREE.MaterialLoader: Undefined texture",a);return c[a]}var c=this.textures,d=new nf[a.type];void 0!==a.uuid&&(d.uuid=a.uuid);void 0!==a.name&&(d.name=a.name);void 0!==a.color&&d.color.setHex(a.color);void 0!==a.roughness&&(d.roughness=a.roughness);void 0!== -a.metalness&&(d.metalness=a.metalness);void 0!==a.emissive&&d.emissive.setHex(a.emissive);void 0!==a.specular&&d.specular.setHex(a.specular);void 0!==a.shininess&&(d.shininess=a.shininess);void 0!==a.uniforms&&(d.uniforms=a.uniforms);void 0!==a.vertexShader&&(d.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(d.fragmentShader=a.fragmentShader);void 0!==a.vertexColors&&(d.vertexColors=a.vertexColors);void 0!==a.fog&&(d.fog=a.fog);void 0!==a.shading&&(d.shading=a.shading);void 0!==a.blending&& -(d.blending=a.blending);void 0!==a.side&&(d.side=a.side);void 0!==a.opacity&&(d.opacity=a.opacity);void 0!==a.transparent&&(d.transparent=a.transparent);void 0!==a.alphaTest&&(d.alphaTest=a.alphaTest);void 0!==a.depthTest&&(d.depthTest=a.depthTest);void 0!==a.depthWrite&&(d.depthWrite=a.depthWrite);void 0!==a.colorWrite&&(d.colorWrite=a.colorWrite);void 0!==a.wireframe&&(d.wireframe=a.wireframe);void 0!==a.wireframeLinewidth&&(d.wireframeLinewidth=a.wireframeLinewidth);void 0!==a.wireframeLinecap&& -(d.wireframeLinecap=a.wireframeLinecap);void 0!==a.wireframeLinejoin&&(d.wireframeLinejoin=a.wireframeLinejoin);void 0!==a.skinning&&(d.skinning=a.skinning);void 0!==a.morphTargets&&(d.morphTargets=a.morphTargets);void 0!==a.size&&(d.size=a.size);void 0!==a.sizeAttenuation&&(d.sizeAttenuation=a.sizeAttenuation);void 0!==a.map&&(d.map=b(a.map));void 0!==a.alphaMap&&(d.alphaMap=b(a.alphaMap),d.transparent=!0);void 0!==a.bumpMap&&(d.bumpMap=b(a.bumpMap));void 0!==a.bumpScale&&(d.bumpScale=a.bumpScale); -void 0!==a.normalMap&&(d.normalMap=b(a.normalMap));if(void 0!==a.normalScale){var e=a.normalScale;!1===Array.isArray(e)&&(e=[e,e]);d.normalScale=(new C).fromArray(e)}void 0!==a.displacementMap&&(d.displacementMap=b(a.displacementMap));void 0!==a.displacementScale&&(d.displacementScale=a.displacementScale);void 0!==a.displacementBias&&(d.displacementBias=a.displacementBias);void 0!==a.roughnessMap&&(d.roughnessMap=b(a.roughnessMap));void 0!==a.metalnessMap&&(d.metalnessMap=b(a.metalnessMap));void 0!== -a.emissiveMap&&(d.emissiveMap=b(a.emissiveMap));void 0!==a.emissiveIntensity&&(d.emissiveIntensity=a.emissiveIntensity);void 0!==a.specularMap&&(d.specularMap=b(a.specularMap));void 0!==a.envMap&&(d.envMap=b(a.envMap));void 0!==a.reflectivity&&(d.reflectivity=a.reflectivity);void 0!==a.lightMap&&(d.lightMap=b(a.lightMap));void 0!==a.lightMapIntensity&&(d.lightMapIntensity=a.lightMapIntensity);void 0!==a.aoMap&&(d.aoMap=b(a.aoMap));void 0!==a.aoMapIntensity&&(d.aoMapIntensity=a.aoMapIntensity);if(void 0!== -a.materials)for(var e=0,f=a.materials.length;e<f;e++)d.materials.push(this.parse(a.materials[e]));return d}});Object.assign(td.prototype,{load:function(a,b,c,d){var e=this;(new za(e.manager)).load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},parse:function(a){var b=new I,c=a.data.index,d={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array}; -void 0!==c&&(c=new d[c.type](c.array),b.setIndex(new z(c,1)));var e=a.data.attributes,f;for(f in e){var g=e[f],c=new d[g.type](g.array);b.addAttribute(f,new z(c,g.itemSize,g.normalized))}d=a.data.groups||a.data.drawcalls||a.data.offsets;if(void 0!==d)for(f=0,c=d.length;f!==c;++f)e=d[f],b.addGroup(e.start,e.count,e.materialIndex);a=a.data.boundingSphere;void 0!==a&&(d=new q,void 0!==a.center&&d.fromArray(a.center),b.boundingSphere=new Aa(d,a.radius));return b}});sb.prototype={constructor:sb,crossOrigin:void 0, -extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b,c){for(var d=[],e=0;e<a.length;++e)d[e]=this.createMaterial(a[e],b,c);return d},createMaterial:function(){var a,b,c;return function(d,e,f){function g(a,c,d,g,l){a=e+a;var m=sb.Handlers.get(a);null!==m?a=m.load(a):(b.setCrossOrigin(f),a=b.load(a));void 0!==c&&(a.repeat.fromArray(c),1!==c[0]&&(a.wrapS=1E3),1!==c[1]&&(a.wrapT=1E3));void 0!==d&&a.offset.fromArray(d);void 0!== -g&&("repeat"===g[0]&&(a.wrapS=1E3),"mirror"===g[0]&&(a.wrapS=1002),"repeat"===g[1]&&(a.wrapT=1E3),"mirror"===g[1]&&(a.wrapT=1002));void 0!==l&&(a.anisotropy=l);c=h.Math.generateUUID();k[c]=a;return c}void 0===a&&(a=new H);void 0===b&&(b=new Sc);void 0===c&&(c=new fd);var k={},l={uuid:h.Math.generateUUID(),type:"MeshLambertMaterial"},m;for(m in d){var q=d[m];switch(m){case "DbgColor":case "DbgIndex":case "opticalDensity":case "illumination":break;case "DbgName":l.name=q;break;case "blending":l.blending= -qe[q];break;case "colorAmbient":case "mapAmbient":console.warn("THREE.Loader.createMaterial:",m,"is no longer supported.");break;case "colorDiffuse":l.color=a.fromArray(q).getHex();break;case "colorSpecular":l.specular=a.fromArray(q).getHex();break;case "colorEmissive":l.emissive=a.fromArray(q).getHex();break;case "specularCoef":l.shininess=q;break;case "shading":"basic"===q.toLowerCase()&&(l.type="MeshBasicMaterial");"phong"===q.toLowerCase()&&(l.type="MeshPhongMaterial");"standard"===q.toLowerCase()&& -(l.type="MeshStandardMaterial");break;case "mapDiffuse":l.map=g(q,d.mapDiffuseRepeat,d.mapDiffuseOffset,d.mapDiffuseWrap,d.mapDiffuseAnisotropy);break;case "mapDiffuseRepeat":case "mapDiffuseOffset":case "mapDiffuseWrap":case "mapDiffuseAnisotropy":break;case "mapEmissive":l.emissiveMap=g(q,d.mapEmissiveRepeat,d.mapEmissiveOffset,d.mapEmissiveWrap,d.mapEmissiveAnisotropy);break;case "mapEmissiveRepeat":case "mapEmissiveOffset":case "mapEmissiveWrap":case "mapEmissiveAnisotropy":break;case "mapLight":l.lightMap= -g(q,d.mapLightRepeat,d.mapLightOffset,d.mapLightWrap,d.mapLightAnisotropy);break;case "mapLightRepeat":case "mapLightOffset":case "mapLightWrap":case "mapLightAnisotropy":break;case "mapAO":l.aoMap=g(q,d.mapAORepeat,d.mapAOOffset,d.mapAOWrap,d.mapAOAnisotropy);break;case "mapAORepeat":case "mapAOOffset":case "mapAOWrap":case "mapAOAnisotropy":break;case "mapBump":l.bumpMap=g(q,d.mapBumpRepeat,d.mapBumpOffset,d.mapBumpWrap,d.mapBumpAnisotropy);break;case "mapBumpScale":l.bumpScale=q;break;case "mapBumpRepeat":case "mapBumpOffset":case "mapBumpWrap":case "mapBumpAnisotropy":break; -case "mapNormal":l.normalMap=g(q,d.mapNormalRepeat,d.mapNormalOffset,d.mapNormalWrap,d.mapNormalAnisotropy);break;case "mapNormalFactor":l.normalScale=[q,q];break;case "mapNormalRepeat":case "mapNormalOffset":case "mapNormalWrap":case "mapNormalAnisotropy":break;case "mapSpecular":l.specularMap=g(q,d.mapSpecularRepeat,d.mapSpecularOffset,d.mapSpecularWrap,d.mapSpecularAnisotropy);break;case "mapSpecularRepeat":case "mapSpecularOffset":case "mapSpecularWrap":case "mapSpecularAnisotropy":break;case "mapMetalness":l.metalnessMap= -g(q,d.mapMetalnessRepeat,d.mapMetalnessOffset,d.mapMetalnessWrap,d.mapMetalnessAnisotropy);break;case "mapMetalnessRepeat":case "mapMetalnessOffset":case "mapMetalnessWrap":case "mapMetalnessAnisotropy":break;case "mapRoughness":l.roughnessMap=g(q,d.mapRoughnessRepeat,d.mapRoughnessOffset,d.mapRoughnessWrap,d.mapRoughnessAnisotropy);break;case "mapRoughnessRepeat":case "mapRoughnessOffset":case "mapRoughnessWrap":case "mapRoughnessAnisotropy":break;case "mapAlpha":l.alphaMap=g(q,d.mapAlphaRepeat, -d.mapAlphaOffset,d.mapAlphaWrap,d.mapAlphaAnisotropy);break;case "mapAlphaRepeat":case "mapAlphaOffset":case "mapAlphaWrap":case "mapAlphaAnisotropy":break;case "flipSided":l.side=1;break;case "doubleSided":l.side=2;break;case "transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity");l.opacity=q;break;case "depthTest":case "depthWrite":case "colorWrite":case "opacity":case "reflectivity":case "transparent":case "visible":case "wireframe":l[m]=q;break;case "vertexColors":!0=== -q&&(l.vertexColors=2);"face"===q&&(l.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",m,q)}}"MeshBasicMaterial"===l.type&&delete l.emissive;"MeshPhongMaterial"!==l.type&&delete l.specular;1>l.opacity&&(l.transparent=!0);c.setTextures(k);return c.parse(l)}}()};sb.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;c<d;c+=2){var e=b[c+1];if(b[c].test(a))return e}return null}};Object.assign(ud.prototype, -{load:function(a,b,c,d){var e=this,f=this.texturePath&&"string"===typeof this.texturePath?this.texturePath:sb.prototype.extractUrlBase(a),g=new za(this.manager);g.setWithCredentials(this.withCredentials);g.load(a,function(c){c=JSON.parse(c);var d=c.metadata;if(void 0!==d&&(d=d.type,void 0!==d)){if("object"===d.toLowerCase()){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");return}if("scene"===d.toLowerCase()){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead."); -return}}c=e.parse(c,f);b(c.geometry,c.materials)},c,d)},setTexturePath:function(a){this.texturePath=a},parse:function(a,b){var c=new R,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,k,h,m,u,p,n,r,t,v,A,w,x=a.faces;u=a.vertices;var z=a.normals,y=a.colors,F=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&F++;for(d=0;d<F;d++)c.faceVertexUvs[d]=[]}h=0;for(m=u.length;h<m;)d=new q,d.x=u[h++]*b,d.y=u[h++]*b,d.z=u[h++]*b,c.vertices.push(d);h=0;for(m=x.length;h<m;)if(b=x[h++],r=b&1,k= -b&2,d=b&8,p=b&16,t=b&32,u=b&64,b&=128,r){r=new ga;r.a=x[h];r.b=x[h+1];r.c=x[h+3];v=new ga;v.a=x[h+1];v.b=x[h+2];v.c=x[h+3];h+=4;k&&(k=x[h++],r.materialIndex=k,v.materialIndex=k);k=c.faces.length;if(d)for(d=0;d<F;d++)for(A=a.uvs[d],c.faceVertexUvs[d][k]=[],c.faceVertexUvs[d][k+1]=[],g=0;4>g;g++)n=x[h++],w=A[2*n],n=A[2*n+1],w=new C(w,n),2!==g&&c.faceVertexUvs[d][k].push(w),0!==g&&c.faceVertexUvs[d][k+1].push(w);p&&(p=3*x[h++],r.normal.set(z[p++],z[p++],z[p]),v.normal.copy(r.normal));if(t)for(d=0;4> -d;d++)p=3*x[h++],t=new q(z[p++],z[p++],z[p]),2!==d&&r.vertexNormals.push(t),0!==d&&v.vertexNormals.push(t);u&&(u=x[h++],u=y[u],r.color.setHex(u),v.color.setHex(u));if(b)for(d=0;4>d;d++)u=x[h++],u=y[u],2!==d&&r.vertexColors.push(new H(u)),0!==d&&v.vertexColors.push(new H(u));c.faces.push(r);c.faces.push(v)}else{r=new ga;r.a=x[h++];r.b=x[h++];r.c=x[h++];k&&(k=x[h++],r.materialIndex=k);k=c.faces.length;if(d)for(d=0;d<F;d++)for(A=a.uvs[d],c.faceVertexUvs[d][k]=[],g=0;3>g;g++)n=x[h++],w=A[2*n],n=A[2*n+ -1],w=new C(w,n),c.faceVertexUvs[d][k].push(w);p&&(p=3*x[h++],r.normal.set(z[p++],z[p++],z[p]));if(t)for(d=0;3>d;d++)p=3*x[h++],t=new q(z[p++],z[p++],z[p]),r.vertexNormals.push(t);u&&(u=x[h++],r.color.setHex(y[u]));if(b)for(d=0;3>d;d++)u=x[h++],r.vertexColors.push(new H(y[u]));c.faces.push(r)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;d+=b)c.skinWeights.push(new da(a.skinWeights[d],1<b?a.skinWeights[d+1]:0, -2<b?a.skinWeights[d+2]:0,3<b?a.skinWeights[d+3]:0));if(a.skinIndices)for(d=0,g=a.skinIndices.length;d<g;d+=b)c.skinIndices.push(new da(a.skinIndices[d],1<b?a.skinIndices[d+1]:0,2<b?a.skinIndices[d+2]:0,3<b?a.skinIndices[d+3]:0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+ -") should match.")})();(function(b){if(void 0!==a.morphTargets)for(var d=0,g=a.morphTargets.length;d<g;d++){c.morphTargets[d]={};c.morphTargets[d].name=a.morphTargets[d].name;c.morphTargets[d].vertices=[];for(var k=c.morphTargets[d].vertices,h=a.morphTargets[d].vertices,m=0,u=h.length;m<u;m+=3){var p=new q;p.x=h[m]*b;p.y=h[m+1]*b;p.z=h[m+2]*b;k.push(p)}}if(void 0!==a.morphColors&&0<a.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'), -b=c.faces,k=a.morphColors[0].colors,d=0,g=b.length;d<g;d++)b[d].color.fromArray(k,3*d)})(d);(function(){var b=[],d=[];void 0!==a.animation&&d.push(a.animation);void 0!==a.animations&&(a.animations.length?d=d.concat(a.animations):d.push(a.animations));for(var g=0;g<d.length;g++){var k=ta.parseAnimation(d[g],c.bones);k&&b.push(k)}c.morphTargets&&(d=ta.CreateClipsFromMorphTargetSequences(c.morphTargets,10),b=b.concat(d));0<b.length&&(c.animations=b)})();c.computeFaceNormals();c.computeBoundingSphere(); -if(void 0===a.materials||0===a.materials.length)return{geometry:c};d=sb.prototype.initMaterials(a.materials,b,this.crossOrigin);return{geometry:c,materials:d}}});Object.assign(je.prototype,{load:function(a,b,c,d){""===this.texturePath&&(this.texturePath=a.substring(0,a.lastIndexOf("/")+1));var e=this;(new za(e.manager)).load(a,function(a){e.parse(JSON.parse(a),b)},c,d)},setTexturePath:function(a){this.texturePath=a},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a,b){var c=this.parseGeometries(a.geometries), -d=this.parseImages(a.images,function(){void 0!==b&&b(e)}),d=this.parseTextures(a.textures,d),d=this.parseMaterials(a.materials,d),e=this.parseObject(a.object,c,d);a.animations&&(e.animations=this.parseAnimations(a.animations));void 0!==a.images&&0!==a.images.length||void 0===b||b(e);return e},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new ud,d=new td,e=0,f=a.length;e<f;e++){var g,k=a[e];switch(k.type){case "PlaneGeometry":case "PlaneBufferGeometry":g=new ua[k.type](k.width,k.height, -k.widthSegments,k.heightSegments);break;case "BoxGeometry":case "BoxBufferGeometry":case "CubeGeometry":g=new ua[k.type](k.width,k.height,k.depth,k.widthSegments,k.heightSegments,k.depthSegments);break;case "CircleGeometry":case "CircleBufferGeometry":g=new ua[k.type](k.radius,k.segments,k.thetaStart,k.thetaLength);break;case "CylinderGeometry":case "CylinderBufferGeometry":g=new ua[k.type](k.radiusTop,k.radiusBottom,k.height,k.radialSegments,k.heightSegments,k.openEnded,k.thetaStart,k.thetaLength); -break;case "ConeGeometry":case "ConeBufferGeometry":g=new ua[k.type](k.radius,k.height,k.radialSegments,k.heightSegments,k.openEnded,k.thetaStart,k.thetaLength);break;case "SphereGeometry":case "SphereBufferGeometry":g=new ua[k.type](k.radius,k.widthSegments,k.heightSegments,k.phiStart,k.phiLength,k.thetaStart,k.thetaLength);break;case "DodecahedronGeometry":case "IcosahedronGeometry":case "OctahedronGeometry":case "TetrahedronGeometry":g=new ua[k.type](k.radius,k.detail);break;case "RingGeometry":case "RingBufferGeometry":g= -new ua[k.type](k.innerRadius,k.outerRadius,k.thetaSegments,k.phiSegments,k.thetaStart,k.thetaLength);break;case "TorusGeometry":case "TorusBufferGeometry":g=new ua[k.type](k.radius,k.tube,k.radialSegments,k.tubularSegments,k.arc);break;case "TorusKnotGeometry":case "TorusKnotBufferGeometry":g=new ua[k.type](k.radius,k.tube,k.tubularSegments,k.radialSegments,k.p,k.q);break;case "LatheGeometry":case "LatheBufferGeometry":g=new ua[k.type](k.points,k.segments,k.phiStart,k.phiLength);break;case "BufferGeometry":g= -d.parse(k);break;case "Geometry":g=c.parse(k.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+k.type+'"');continue}g.uuid=k.uuid;void 0!==k.name&&(g.name=k.name);b[k.uuid]=g}return b},parseMaterials:function(a,b){var c={};if(void 0!==a){var d=new fd;d.setTextures(b);for(var e=0,f=a.length;e<f;e++){var g=d.parse(a[e]);c[g.uuid]=g}}return c},parseAnimations:function(a){for(var b=[],c=0;c<a.length;c++){var d=ta.parse(a[c]);b.push(d)}return b}, -parseImages:function(a,b){function c(a){d.manager.itemStart(a);return g.load(a,function(){d.manager.itemEnd(a)},void 0,function(){d.manager.itemError(a)})}var d=this,e={};if(void 0!==a&&0<a.length){var f=new qd(b),g=new yc(f);g.setCrossOrigin(this.crossOrigin);for(var f=0,k=a.length;f<k;f++){var h=a[f],m=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h.url)?h.url:d.texturePath+h.url;e[h.uuid]=c(m)}}return e},parseTextures:function(a,b){function c(a,b){if("number"===typeof a)return a;console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", -a);return b[a]}var d={};if(void 0!==a)for(var e=0,f=a.length;e<f;e++){var g=a[e];void 0===g.image&&console.warn('THREE.ObjectLoader: No "image" specified for',g.uuid);void 0===b[g.image]&&console.warn("THREE.ObjectLoader: Undefined image",g.image);var k=new ba(b[g.image]);k.needsUpdate=!0;k.uuid=g.uuid;void 0!==g.name&&(k.name=g.name);void 0!==g.mapping&&(k.mapping=c(g.mapping,re));void 0!==g.offset&&k.offset.fromArray(g.offset);void 0!==g.repeat&&k.repeat.fromArray(g.repeat);void 0!==g.wrap&&(k.wrapS= -c(g.wrap[0],Md),k.wrapT=c(g.wrap[1],Md));void 0!==g.minFilter&&(k.minFilter=c(g.minFilter,Nd));void 0!==g.magFilter&&(k.magFilter=c(g.magFilter,Nd));void 0!==g.anisotropy&&(k.anisotropy=g.anisotropy);void 0!==g.flipY&&(k.flipY=g.flipY);d[g.uuid]=k}return d},parseObject:function(){var a=new P;return function(b,c,d){function e(a){void 0===c[a]&&console.warn("THREE.ObjectLoader: Undefined geometry",a);return c[a]}function f(a){if(void 0!==a)return void 0===d[a]&&console.warn("THREE.ObjectLoader: Undefined material", -a),d[a]}var g;switch(b.type){case "Scene":g=new fb;void 0!==b.background&&Number.isInteger(b.background)&&(g.background=new H(b.background));void 0!==b.fog&&("Fog"===b.fog.type?g.fog=new Fb(b.fog.color,b.fog.near,b.fog.far):"FogExp2"===b.fog.type&&(g.fog=new Eb(b.fog.color,b.fog.density)));break;case "PerspectiveCamera":g=new Ca(b.fov,b.aspect,b.near,b.far);void 0!==b.focus&&(g.focus=b.focus);void 0!==b.zoom&&(g.zoom=b.zoom);void 0!==b.filmGauge&&(g.filmGauge=b.filmGauge);void 0!==b.filmOffset&&(g.filmOffset= -b.filmOffset);void 0!==b.view&&(g.view=Object.assign({},b.view));break;case "OrthographicCamera":g=new Db(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":g=new Zc(b.color,b.intensity);break;case "DirectionalLight":g=new Yc(b.color,b.intensity);break;case "PointLight":g=new Wc(b.color,b.intensity,b.distance,b.decay);break;case "SpotLight":g=new Vc(b.color,b.intensity,b.distance,b.angle,b.penumbra,b.decay);break;case "HemisphereLight":g=new Tc(b.color,b.groundColor,b.intensity); -break;case "Mesh":g=e(b.geometry);var k=f(b.material);g=g.bones&&0<g.bones.length?new Pc(g,k):new va(g,k);break;case "LOD":g=new gc;break;case "Line":g=new Pa(e(b.geometry),f(b.material),b.mode);break;case "LineSegments":g=new ha(e(b.geometry),f(b.material));break;case "PointCloud":case "Points":g=new Gb(e(b.geometry),f(b.material));break;case "Sprite":g=new fc(f(b.material));break;case "Group":g=new hc;break;default:g=new D}g.uuid=b.uuid;void 0!==b.name&&(g.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix), -a.decompose(g.position,g.quaternion,g.scale)):(void 0!==b.position&&g.position.fromArray(b.position),void 0!==b.rotation&&g.rotation.fromArray(b.rotation),void 0!==b.quaternion&&g.quaternion.fromArray(b.quaternion),void 0!==b.scale&&g.scale.fromArray(b.scale));void 0!==b.castShadow&&(g.castShadow=b.castShadow);void 0!==b.receiveShadow&&(g.receiveShadow=b.receiveShadow);b.shadow&&(void 0!==b.shadow.bias&&(g.shadow.bias=b.shadow.bias),void 0!==b.shadow.radius&&(g.shadow.radius=b.shadow.radius),void 0!== -b.shadow.mapSize&&g.shadow.mapSize.fromArray(b.shadow.mapSize),void 0!==b.shadow.camera&&(g.shadow.camera=this.parseObject(b.shadow.camera)));void 0!==b.visible&&(g.visible=b.visible);void 0!==b.userData&&(g.userData=b.userData);if(void 0!==b.children)for(var h in b.children)g.add(this.parseObject(b.children[h],c,d));if("LOD"===b.type)for(b=b.levels,k=0;k<b.length;k++){var m=b[k];h=g.getObjectByProperty("uuid",m.object);void 0!==h&&g.addLevel(h,m.distance)}return g}}()});Y.prototype={constructor:Y, -getPoint:function(a){console.warn("THREE.Curve: Warning, getPoint() not implemented!");return null},getPointAt:function(a){a=this.getUtoTmapping(a);return this.getPoint(a)},getPoints:function(a){a||(a=5);for(var b=[],c=0;c<=a;c++)b.push(this.getPoint(c/a));return b},getSpacedPoints:function(a){a||(a=5);for(var b=[],c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b},getLength:function(){var a=this.getLengths();return a[a.length-1]},getLengths:function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions: -200);if(this.cacheArcLengths&&this.cacheArcLengths.length===a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b},updateArcLengths:function(){this.needsUpdate=!0;this.getLengths()},getUtoTmapping:function(a,b){var c=this.getLengths(),d,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,k=e-1,h;g<=k;)if(d=Math.floor(g+(k-g)/2),h=c[d]-f,0>h)g=d+1; -else if(0<h)k=d-1;else{k=d;break}d=k;if(c[d]===f)return d/(e-1);g=c[d];return(d+(f-g)/(c[d+1]-g))/(e-1)},getTangent:function(a){var b=a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()},getTangentAt:function(a){a=this.getUtoTmapping(a);return this.getTangent(a)}};Y.create=function(a,b){a.prototype=Object.create(Y.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};La.prototype=Object.create(Y.prototype);La.prototype.constructor= -La;La.prototype.isLineCurve=!0;La.prototype.getPoint=function(a){if(1===a)return this.v2.clone();var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};La.prototype.getPointAt=function(a){return this.getPoint(a)};La.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};Bc.prototype=Object.assign(Object.create(Y.prototype),{constructor:Bc,add:function(a){this.curves.push(a)},closePath:function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length- -1].getPoint(1);a.equals(b)||this.curves.push(new La(b,a))},getPoint:function(a){var b=a*this.getLength(),c=this.getCurveLengths();for(a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths; -for(var a=[],b=0,c=0,d=this.curves.length;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a},getSpacedPoints:function(a){a||(a=40);for(var b=[],c=0;c<=a;c++)b.push(this.getPoint(c/a));this.autoClose&&b.push(b[0]);return b},getPoints:function(a){a=a||12;for(var b=[],c,d=0,e=this.curves;d<e.length;d++)for(var f=e[d],f=f.getPoints(f&&f.isEllipseCurve?2*a:f&&f.isLineCurve?1:f&&f.isSplineCurve?a*f.points.length:a),g=0;g<f.length;g++){var k=f[g];c&&c.equals(k)||(b.push(k),c=k)}this.autoClose&& -1<b.length&&!b[b.length-1].equals(b[0])&&b.push(b[0]);return b},createPointsGeometry:function(a){a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){for(var b=new R,c=0,d=a.length;c<d;c++){var e=a[c];b.vertices.push(new q(e.x,e.y,e.z||0))}return b}});Ra.prototype=Object.create(Y.prototype);Ra.prototype.constructor=Ra;Ra.prototype.isEllipseCurve=!0;Ra.prototype.getPoint=function(a){for(var b= -2*Math.PI,c=this.aEndAngle-this.aStartAngle,d=Math.abs(c)<Number.EPSILON;0>c;)c+=b;for(;c>b;)c-=b;c<Number.EPSILON&&(c=d?0:b);!0!==this.aClockwise||d||(c=c===b?-b:c-b);b=this.aStartAngle+a*c;a=this.aX+this.xRadius*Math.cos(b);var e=this.aY+this.yRadius*Math.sin(b);0!==this.aRotation&&(b=Math.cos(this.aRotation),c=Math.sin(this.aRotation),d=a-this.aX,e-=this.aY,a=d*b-e*c+this.aX,e=d*c+e*b+this.aY);return new C(a,e)};h.CurveUtils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d- -c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a,b,c,d,e){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){a=.5*(c-a);d=.5*(d-b);var f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}};tb.prototype=Object.create(Y.prototype);tb.prototype.constructor=tb;tb.prototype.isSplineCurve=!0;tb.prototype.getPoint=function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a); -a-=c;var d=b[0===c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=h.CurveUtils.interpolate;return new C(c(d.x,e.x,f.x,b.x,a),c(d.y,e.y,f.y,b.y,a))};ub.prototype=Object.create(Y.prototype);ub.prototype.constructor=ub;ub.prototype.getPoint=function(a){var b=h.ShapeUtils.b3;return new C(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y))};ub.prototype.getTangent=function(a){var b=h.CurveUtils.tangentCubicBezier;return(new C(b(a, -this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y))).normalize()};vb.prototype=Object.create(Y.prototype);vb.prototype.constructor=vb;vb.prototype.getPoint=function(a){var b=h.ShapeUtils.b2;return new C(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y))};vb.prototype.getTangent=function(a){var b=h.CurveUtils.tangentQuadraticBezier;return(new C(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y))).normalize()};var Od=Object.assign(Object.create(Bc.prototype), -{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)},moveTo:function(a,b){this.currentPoint.set(a,b)},lineTo:function(a,b){var c=new La(this.currentPoint.clone(),new C(a,b));this.curves.push(c);this.currentPoint.set(a,b)},quadraticCurveTo:function(a,b,c,d){a=new vb(this.currentPoint.clone(),new C(a,b),new C(c,d));this.curves.push(a);this.currentPoint.set(c,d)},bezierCurveTo:function(a,b,c,d,e,f){a=new ub(this.currentPoint.clone(),new C(a,b), -new C(c,d),new C(e,f));this.curves.push(a);this.currentPoint.set(e,f)},splineThru:function(a){var b=[this.currentPoint.clone()].concat(a),b=new tb(b);this.curves.push(b);this.currentPoint.copy(a[a.length-1])},arc:function(a,b,c,d,e,f){this.absarc(a+this.currentPoint.x,b+this.currentPoint.y,c,d,e,f)},absarc:function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)},ellipse:function(a,b,c,d,e,f,g,k){this.absellipse(a+this.currentPoint.x,b+this.currentPoint.y,c,d,e,f,g,k)},absellipse:function(a,b,c,d,e,f, -g,k){a=new Ra(a,b,c,d,e,f,g,k);0<this.curves.length&&(b=a.getPoint(0),b.equals(this.currentPoint)||this.lineTo(b.x,b.y));this.curves.push(a);a=a.getPoint(1);this.currentPoint.copy(a)}});wb.prototype=Object.assign(Object.create(Od),{constructor:wb,getPointsHoles:function(a){for(var b=[],c=0,d=this.holes.length;c<d;c++)b[c]=this.holes[c].getPoints(a);return b},extractAllPoints:function(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}},extractPoints:function(a){return this.extractAllPoints(a)}}); -Cc.prototype=Od;Od.constructor=Cc;vd.prototype={moveTo:function(a,b){this.currentPath=new Cc;this.subPaths.push(this.currentPath);this.currentPath.moveTo(a,b)},lineTo:function(a,b){this.currentPath.lineTo(a,b)},quadraticCurveTo:function(a,b,c,d){this.currentPath.quadraticCurveTo(a,b,c,d)},bezierCurveTo:function(a,b,c,d,e,f){this.currentPath.bezierCurveTo(a,b,c,d,e,f)},splineThru:function(a){this.currentPath.splineThru(a)},toShapes:function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e= -a[c],f=new wb;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],k=b[f],h=k.x-g.x,l=k.y-g.y;if(Math.abs(l)>Number.EPSILON){if(0>l&&(g=b[f],h=-h,k=b[e],l=-l),!(a.y<g.y||a.y>k.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=l*(a.x-g.x)-h*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(k.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=k.x))return!0}return d}var e=h.ShapeUtils.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f); -var g,k,l,m=[];if(1===f.length)return k=f[0],l=new wb,l.curves=k.curves,m.push(l),m;var q=!e(f[0].getPoints()),q=a?!q:q;l=[];var p=[],n=[],r=0,t;p[r]=void 0;n[r]=[];for(var v=0,A=f.length;v<A;v++)k=f[v],t=k.getPoints(),g=e(t),(g=a?!g:g)?(!q&&p[r]&&r++,p[r]={s:new wb,p:t},p[r].s.curves=k.curves,q&&r++,n[r]=[]):n[r].push({h:k,p:t[0]});if(!p[0])return c(f);if(1<p.length){v=!1;k=[];e=0;for(f=p.length;e<f;e++)l[e]=[];e=0;for(f=p.length;e<f;e++)for(g=n[e],q=0;q<g.length;q++){r=g[q];t=!0;for(A=0;A<p.length;A++)d(r.p, -p[A].p)&&(e!==A&&k.push({froms:e,tos:A,hole:q}),t?(t=!1,l[A].push(r)):v=!0);t&&l[e].push(r)}0<k.length&&(v||(n=l))}v=0;for(e=p.length;v<e;v++)for(l=p[v].s,m.push(l),k=n[v],f=0,g=k.length;f<g;f++)l.holes.push(k[f].h);return m}};Object.assign(wd.prototype,{isFont:!0,generateShapes:function(a,b,c){void 0===b&&(b=100);void 0===c&&(c=4);var d=this.data;a=String(a).split("");var e=b/d.resolution,f=0;b=[];for(var g=0;g<a.length;g++){var k;k=e;var l=f,m=d.glyphs[a[g]]||d.glyphs["?"];if(m){var q=new vd,p= -[],n=h.ShapeUtils.b2,r=h.ShapeUtils.b3,t,v,A,w,x,z,y,C;if(m.o)for(var D=m._cachedOutline||(m._cachedOutline=m.o.split(" ")),E=0,J=D.length;E<J;)switch(D[E++]){case "m":t=D[E++]*k+l;v=D[E++]*k;q.moveTo(t,v);break;case "l":t=D[E++]*k+l;v=D[E++]*k;q.lineTo(t,v);break;case "q":t=D[E++]*k+l;v=D[E++]*k;x=D[E++]*k+l;z=D[E++]*k;q.quadraticCurveTo(x,z,t,v);if(w=p[p.length-1]){A=w.x;w=w.y;for(var H=1;H<=c;H++){var I=H/c;n(I,A,x,t);n(I,w,z,v)}}break;case "b":if(t=D[E++]*k+l,v=D[E++]*k,x=D[E++]*k+l,z=D[E++]* -k,y=D[E++]*k+l,C=D[E++]*k,q.bezierCurveTo(x,z,y,C,t,v),w=p[p.length-1])for(A=w.x,w=w.y,H=1;H<=c;H++)I=H/c,r(I,A,x,y,t),r(I,w,z,C,v)}k={offset:m.ha*k,path:q}}else k=void 0;f+=k.offset;b.push(k.path)}c=[];d=0;for(a=b.length;d<a;d++)Array.prototype.push.apply(c,b[d].toShapes());return c}});Object.assign(ke.prototype,{load:function(a,b,c,d){var e=this;(new za(this.manager)).load(a,function(a){var c;try{c=JSON.parse(a)}catch(d){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."), -c=JSON.parse(a.substring(65,a.length-2))}a=e.parse(c);b&&b(a)},c,d)},parse:function(a){return new wd(a)}});var yd;Object.assign(zd.prototype,{load:function(a,b,c,d){var e=new za(this.manager);e.setResponseType("arraybuffer");e.load(a,function(a){xd().decodeAudioData(a,function(a){b(a)})},c,d)}});Object.assign(le.prototype,{update:function(){var a,b,c,d,e,f,g,k=new P,l=new P;return function(m){if(a!==this||b!==m.focus||c!==m.fov||d!==m.aspect*this.aspect||e!==m.near||f!==m.far||g!==m.zoom){a=this; -b=m.focus;c=m.fov;d=m.aspect*this.aspect;e=m.near;f=m.far;g=m.zoom;var q=m.projectionMatrix.clone(),p=this.eyeSep/2,n=p*e/b,r=e*Math.tan(h.Math.DEG2RAD*c*.5)/g,t;l.elements[12]=-p;k.elements[12]=p;p=-r*d+n;t=r*d+n;q.elements[0]=2*e/(t-p);q.elements[8]=(t+p)/(t-p);this.cameraL.projectionMatrix.copy(q);p=-r*d-n;t=r*d-n;q.elements[0]=2*e/(t-p);q.elements[8]=(t+p)/(t-p);this.cameraR.projectionMatrix.copy(q)}this.cameraL.matrixWorld.copy(m.matrixWorld).multiply(l);this.cameraR.matrixWorld.copy(m.matrixWorld).multiply(k)}}()}); -gd.prototype=Object.create(D.prototype);gd.prototype.constructor=gd;Ad.prototype=Object.assign(Object.create(D.prototype),{constructor:Ad,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)): -this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.value=a},updateMatrixWorld:function(){var a=new q,b=new ca,c=new q,d=new q;return function(e){D.prototype.updateMatrixWorld.call(this,e);e=this.context.listener;var f=this.up;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.setPosition(a.x,a.y, -a.z);e.setOrientation(d.x,d.y,d.z,f.x,f.y,f.z)}}()});Ub.prototype=Object.assign(Object.create(D.prototype),{constructor:Ub,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this},setBuffer:function(a){this.source.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); -else{var a=this.context.createBufferSource();a.buffer=this.source.buffer;a.loop=this.source.loop;a.onended=this.source.onended;a.start(0,this.startTime);a.playbackRate.value=this.playbackRate;this.isPlaying=!0;this.source=a;return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); -else return this.source.stop(),this.startTime=0,this.isPlaying=!1,this},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var a=1,b=this.filters.length;a<b;a++)this.filters[a-1].connect(this.filters[a]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var a=1,b=this.filters.length;a<b;a++)this.filters[a- -1].disconnect(this.filters[a]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(a){a||(a=[]);!0===this.isPlaying?(this.disconnect(),this.filters=a,this.connect()):this.filters=a;return this},getFilter:function(){return this.getFilters()[0]},setFilter:function(a){return this.setFilters(a?[a]:[])},setPlaybackRate:function(a){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); -else return this.playbackRate=a,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},setLoop:function(a){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=a},getVolume:function(){return this.gain.gain.value}, -setVolume:function(a){this.gain.gain.value=a;return this}});Bd.prototype=Object.assign(Object.create(Ub.prototype),{constructor:Bd,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(a){this.panner.refDistance=a},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(a){this.panner.rolloffFactor=a},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(a){this.panner.distanceModel= -a},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(a){this.panner.maxDistance=a},updateMatrixWorld:function(){var a=new q;return function(b){D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}}()});Object.assign(Cd.prototype,{getFrequencyData:function(){this.analyser.getByteFrequencyData(this.data);return this.data},getAverageFrequency:function(){for(var a=0,b=this.getFrequencyData(),c=0;c<b.length;c++)a+= -b[c];return a/b.length}});hd.prototype={constructor:hd,accumulate:function(a,b){var c=this.buffer,d=this.valueSize,e=a*d+d,f=this.cumulativeWeight;if(0===f){for(f=0;f!==d;++f)c[e+f]=c[f];f=b}else f+=b,this._mixBufferRegion(c,e,0,b/f,d);this.cumulativeWeight=f},apply:function(a){var b=this.valueSize,c=this.buffer;a=a*b+b;var d=this.cumulativeWeight,e=this.binding;this.cumulativeWeight=0;1>d&&this._mixBufferRegion(c,a,3*b,1-d,b);for(var d=b,f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}}, -saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d,e){ca.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var k=b+g;a[k]=a[k]*f+a[c+g]*d}}};ka.prototype={constructor:ka,getValue:function(a, -b){this.bind();this.getValue(a,b)},setValue:function(a,b){this.bind();this.setValue(a,b)},bind:function(){var a=this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,e=b.propertyIndex;a||(this.node=a=ka.findNode(this.rootNode,b.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;if(a){if(c){var f=b.objectIndex;switch(c){case "materials":if(!a.material){console.error(" can not bind to material as node does not have a material",this);return}if(!a.material.materials){console.error(" can not bind to material.materials as node.material does not have a materials array", -this);return}a=a.material.materials;break;case "bones":if(!a.skeleton){console.error(" can not bind to bones as node does not have a skeleton",this);return}a=a.skeleton.bones;for(c=0;c<a.length;c++)if(a[c].name===f){f=c;break}break;default:if(void 0===a[c]){console.error(" can not bind to objectName of node, undefined",this);return}a=a[c]}if(void 0!==f){if(void 0===a[f]){console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,a);return}a=a[f]}}f=a[d];if(void 0===f)console.error(" trying to update property for track: "+ -b.nodeName+"."+d+" but it wasn't found.",a);else{b=this.Versioning.None;void 0!==a.needsUpdate?(b=this.Versioning.NeedsUpdate,this.targetObject=a):void 0!==a.matrixWorldNeedsUpdate&&(b=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=a);c=this.BindingType.Direct;if(void 0!==e){if("morphTargetInfluences"===d){if(!a.geometry){console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);return}if(!a.geometry.morphTargets){console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets", -this);return}for(c=0;c<this.node.geometry.morphTargets.length;c++)if(a.geometry.morphTargets[c].name===e){e=c;break}}c=this.BindingType.ArrayElement;this.resolvedProperty=f;this.propertyIndex=e}else void 0!==f.fromArray&&void 0!==f.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=f):void 0!==f.length?(c=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=d;this.getValue=this.GetterByBindingType[c];this.setValue=this.SetterByBindingTypeAndVersioning[c][b]}}else console.error(" trying to update node for track: "+ -this.path+" but it wasn't found.")},unbind:function(){this.node=null;this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound}};Object.assign(ka.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:ka.prototype.getValue,_setValue_unbound:ka.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(a,b){a[b]=this.node[this.propertyName]}, -function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)a[b++]=c[d]},function(a,b){a[b]=this.resolvedProperty[this.propertyIndex]},function(a,b){this.resolvedProperty.toArray(a,b)}],SetterByBindingTypeAndVersioning:[[function(a,b){this.node[this.propertyName]=a[b]},function(a,b){this.node[this.propertyName]=a[b];this.targetObject.needsUpdate=!0},function(a,b){this.node[this.propertyName]=a[b];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){for(var c=this.resolvedProperty, -d=0,e=c.length;d!==e;++d)c[d]=a[b++]},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.needsUpdate=!0},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty[this.propertyIndex]=a[b]},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b]; -this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty.fromArray(a,b)},function(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.matrixWorldNeedsUpdate=!0}]]});ka.Composite=function(a,b,c){c=c||ka.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)};ka.Composite.prototype={constructor:ka.Composite,getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_]; -void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}};ka.create=function(a,b,c){return a&&a.isAnimationObjectGroup?new ka.Composite(a,b,c):new ka(a,b,c)};ka.parseTrackName=function(a){var b= -/^((?:\w+[\/:])*)(\w+)?(?:\.(\w+)(?:\[(.+)\])?)?\.(\w+)(?:\[(.+)\])?$/.exec(a);if(!b)throw Error("cannot parse trackName at all: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};if(null===b.propertyName||0===b.propertyName.length)throw Error("can not parse propertyName from trackName: "+a);return b};ka.findNode=function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=function(a){for(var c=0;c<a.bones.length;c++){var d= -a.bones[c];if(d.name===b)return d}return null}(a.skeleton);if(c)return c}if(a.children){var d=function(a){for(var c=0;c<a.length;c++){var g=a[c];if(g.name===b||g.uuid===b||(g=d(g.children)))return g}return null};if(c=d(a.children))return c}return null};Dd.prototype={constructor:Dd,isAnimationObjectGroup:!0,add:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._paths,g=this._parsedPaths,k=this._bindings,h=k.length,m=0,q=arguments.length;m!==q;++m){var p= -arguments[m],n=p.uuid,r=e[n];if(void 0===r){r=c++;e[n]=r;b.push(p);for(var n=0,t=h;n!==t;++n)k[n].push(new ka(p,f[n],g[n]))}else if(r<d){var v=b[r],A=--d,t=b[A];e[t.uuid]=r;b[r]=t;e[n]=A;b[A]=p;n=0;for(t=h;n!==t;++n){var w=k[n],x=w[r];w[r]=w[A];void 0===x&&(x=new ka(p,f[n],g[n]));w[A]=x}}else b[r]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=d},remove:function(a){for(var b=this._objects, -c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,k=arguments.length;g!==k;++g){var h=arguments[g],m=h.uuid,q=d[m];if(void 0!==q&&q>=c){var p=c++,n=b[p];d[n.uuid]=q;b[q]=n;d[m]=p;b[p]=h;h=0;for(m=f;h!==m;++h){var n=e[h],r=n[q];n[q]=n[p];n[p]=r}}}this.nCachedObjects_=c},uncache:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._bindings,g=f.length,k=0,h=arguments.length;k!==h;++k){var m=arguments[k].uuid,q=e[m];if(void 0!== -q)if(delete e[m],q<d){var m=--d,p=b[m],n=--c,r=b[n];e[p.uuid]=q;b[q]=p;e[r.uuid]=m;b[m]=r;b.pop();p=0;for(r=g;p!==r;++p){var t=f[p],v=t[n];t[q]=t[m];t[m]=v;t.pop()}}else for(n=--c,r=b[n],e[r.uuid]=q,b[q]=r,b.pop(),p=0,r=g;p!==r;++p)t=f[p],t[q]=t[n],t.pop()}this.nCachedObjects_=d},subscribe_:function(a,b){var c=this._bindingsIndicesByPath,d=c[a],e=this._bindings;if(void 0!==d)return e[d];var f=this._paths,g=this._parsedPaths,k=this._objects,h=this.nCachedObjects_,m=Array(k.length),d=e.length;c[a]= -d;f.push(a);g.push(b);e.push(m);c=h;for(d=k.length;c!==d;++c)m[c]=new ka(k[c],a,b);return m},unsubscribe_:function(a){var b=this._bindingsIndicesByPath,c=b[a];if(void 0!==c){var d=this._paths,e=this._parsedPaths,f=this._bindings,g=f.length-1,k=f[g];b[a[g]]=c;f[c]=k;f.pop();e[c]=e[g];e.pop();d[c]=d[g];d.pop()}}};Ed.prototype={constructor:Ed,play:function(){this._mixer._activateAction(this);return this},stop:function(){this._mixer._deactivateAction(this);return this.reset()},reset:function(){this.paused= -!1;this.enabled=!0;this.time=0;this._loopCount=-1;this._startTime=null;return this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(a){this._startTime=a;return this},setLoop:function(a,b){this.loop=a;this.repetitions=b;return this},setEffectiveWeight:function(a){this.weight=a;this._effectiveWeight=this.enabled? -a:0;return this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(a){return this._scheduleFading(a,0,1)},fadeOut:function(a){return this._scheduleFading(a,1,0)},crossFadeFrom:function(a,b,c){a.fadeOut(b);this.fadeIn(b);if(c){c=this._clip.duration;var d=a._clip.duration,e=c/d;a.warp(1,d/c,b);this.warp(e,1,b)}return this},crossFadeTo:function(a,b,c){return a.crossFadeFrom(this,b,c)},stopFading:function(){var a=this._weightInterpolant;null!==a&&(this._weightInterpolant= -null,this._mixer._takeBackControlInterpolant(a));return this},setEffectiveTimeScale:function(a){this.timeScale=a;this._effectiveTimeScale=this.paused?0:a;return this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(a){this.timeScale=this._clip.duration/a;return this.stopWarping()},syncWith:function(a){this.time=a.time;this.timeScale=a.timeScale;return this.stopWarping()},halt:function(a){return this.warp(this._effectiveTimeScale,0,a)},warp:function(a, -b,c){var d=this._mixer,e=d.time,f=this._timeScaleInterpolant,g=this.timeScale;null===f&&(this._timeScaleInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;d[1]=e+c;f[0]=a/g;f[1]=b/g;return this},stopWarping:function(){var a=this._timeScaleInterpolant;null!==a&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(a));return this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot|| -this._mixer._root},_update:function(a,b,c,d){var e=this._startTime;if(null!==e){b=(a-e)*c;if(0>b||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0<a){b=this._interpolants;for(var e=this._propertyBindings,f=0,g=b.length;f!==g;++f)b[f].evaluate(c),e[f].accumulate(d,a)}},_updateWeight:function(a){var b=0;if(this.enabled){var b=this.weight,c=this._weightInterpolant;if(null!==c){var d=c.evaluate(a)[0],b=b*d;a>c.parameterPositions[1]&& -(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){var b=this.timeScale,c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0],b=b*d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a;if(0===a)return b;var c=this._clip.duration,d=this.loop,e=this._loopCount;if(2200===d)a:{if(-1===e&&(this.loopCount= -0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{d=2202===d;-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d));if(b>=c||0>b){var f=Math.floor(b/c),b=b-c*f,e=e+Math.abs(f),g=this.repetitions-e;0>g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,b=0<a?c:0,this._mixer.dispatchEvent({type:"finished", -action:this,direction:0<a?1:-1})):(0===g?(a=0>a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:f}))}if(d&&1===(e&1))return this.time=b,c-b}return this.time=b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time, -f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}};Object.assign(Fd.prototype,pa.prototype,{clipAction:function(a,b){var c=b||this._root,d=c.uuid,e="string"===typeof a?ta.findByName(c,a):a,c=null!==e?e.uuid:a,f=this._actionsByClip[c],g=null;if(void 0!==f){g=f.actionByRoot[d];if(void 0!==g)return g;g=f.knownActions[0];null===e&&(e=g._clip)}if(null===e)return null;e=new Ed(this, -e,b);this._bindAction(e,g);this._addInactiveAction(e,c,d);return e},existingAction:function(a,b){var c=b||this._root,d=c.uuid,c="string"===typeof a?ta.findByName(c,a):a,c=this._actionsByClip[c?c.uuid:a];return void 0!==c?c.actionByRoot[d]||null:null},stopAllAction:function(){for(var a=this._actions,b=this._nActiveActions,c=this._bindings,d=this._nActiveBindings,e=this._nActiveBindings=this._nActiveActions=0;e!==b;++e)a[e].reset();for(e=0;e!==d;++e)c[e].useCount=0;return this},update:function(a){a*= -this.timeScale;for(var b=this._actions,c=this._nActiveActions,d=this.time+=a,e=Math.sign(a),f=this._accuIndex^=1,g=0;g!==c;++g){var k=b[g];k.enabled&&k._update(d,a,e,f)}a=this._bindings;b=this._nActiveBindings;for(g=0;g!==b;++g)a[g].apply(f);return this},getRoot:function(){return this._root},uncacheClip:function(a){var b=this._actions;a=a.uuid;var c=this._actionsByClip,d=c[a];if(void 0!==d){for(var d=d.knownActions,e=0,f=d.length;e!==f;++e){var g=d[e];this._deactivateAction(g);var k=g._cacheIndex, -h=b[b.length-1];g._cacheIndex=null;g._byClipCacheIndex=null;h._cacheIndex=k;b[k]=h;b.pop();this._removeInactiveBindingsForAction(g)}delete c[a]}},uncacheRoot:function(a){a=a.uuid;var b=this._actionsByClip,c;for(c in b){var d=b[c].actionByRoot[a];void 0!==d&&(this._deactivateAction(d),this._removeInactiveAction(d))}c=this._bindingsByRootAndName[a];if(void 0!==c)for(var e in c)a=c[e],a.restoreOriginalState(),this._removeInactiveBinding(a)},uncacheAction:function(a,b){var c=this.existingAction(a,b); -null!==c&&(this._deactivateAction(c),this._removeInactiveAction(c))}});Object.assign(Fd.prototype,{_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings,g=a._interpolants,k=c.uuid,h=this._bindingsByRootAndName,m=h[k];void 0===m&&(m={},h[k]=m);for(h=0;h!==e;++h){var q=d[h],p=q.name,n=m[p];if(void 0===n){n=f[h];if(void 0!==n){null===n._cacheIndex&&(++n.referenceCount,this._addInactiveBinding(n,k,p));continue}n=new hd(ka.create(c,p,b&&b._propertyBindings[h].binding.parsedPath), -q.ValueTypeName,q.getValueSize());++n.referenceCount;this._addInactiveBinding(n,k,p)}f[h]=n;g[h].resultBuffer=n.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}}, -_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length}, -get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&a<this._nActiveActions},_addInactiveAction:function(a,b,c){var d=this._actions,e=this._actionsByClip,f=e[b];void 0===f?(f={knownActions:[a],actionByRoot:{}},a._byClipCacheIndex=0,e[b]=f):(b= -f.knownActions,a._byClipCacheIndex=b.length,b.push(a));a._cacheIndex=d.length;d.push(a);f.actionByRoot[c]=a},_removeInactiveAction:function(a){var b=this._actions,c=b[b.length-1],d=a._cacheIndex;c._cacheIndex=d;b[d]=c;b.pop();a._cacheIndex=null;var c=a._clip.uuid,d=this._actionsByClip,e=d[c],f=e.knownActions,g=f[f.length-1],k=a._byClipCacheIndex;g._byClipCacheIndex=k;f[k]=g;f.pop();a._byClipCacheIndex=null;delete e.actionByRoot[(b._localRoot||this._root).uuid];0===f.length&&delete d[c];this._removeInactiveBindingsForAction(a)}, -_removeInactiveBindingsForAction:function(a){a=a._propertyBindings;for(var b=0,c=a.length;b!==c;++b){var d=a[b];0===--d.referenceCount&&this._removeInactiveBinding(d)}},_lendAction:function(a){var b=this._actions,c=a._cacheIndex,d=this._nActiveActions++,e=b[d];a._cacheIndex=d;b[d]=a;e._cacheIndex=c;b[c]=e},_takeBackAction:function(a){var b=this._actions,c=a._cacheIndex,d=--this._nActiveActions,e=b[d];a._cacheIndex=d;b[d]=a;e._cacheIndex=c;b[c]=e},_addInactiveBinding:function(a,b,c){var d=this._bindingsByRootAndName, -e=d[b],f=this._bindings;void 0===e&&(e={},d[b]=e);e[c]=a;a._cacheIndex=f.length;f.push(a)},_removeInactiveBinding:function(a){var b=this._bindings,c=a.binding,d=c.rootNode.uuid,c=c.path,e=this._bindingsByRootAndName,f=e[d],g=b[b.length-1];a=a._cacheIndex;g._cacheIndex=a;b[a]=g;b.pop();delete f[c];a:{for(var k in f)break a;delete e[d]}},_lendBinding:function(a){var b=this._bindings,c=a._cacheIndex,d=this._nActiveBindings++,e=b[d];a._cacheIndex=d;b[d]=a;e._cacheIndex=c;b[c]=e},_takeBackBinding:function(a){var b= -this._bindings,c=a._cacheIndex,d=--this._nActiveBindings,e=b[d];a._cacheIndex=d;b[d]=a;e._cacheIndex=c;b[c]=e},_lendControlInterpolant:function(){var a=this._controlInterpolants,b=this._nActiveControlInterpolants++,c=a[b];void 0===c&&(c=new zc(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),c.__cacheIndex=b,a[b]=c);return c},_takeBackControlInterpolant:function(a){var b=this._controlInterpolants,c=a.__cacheIndex,d=--this._nActiveControlInterpolants,e=b[d];a.__cacheIndex= -d;b[d]=a;e.__cacheIndex=c;b[c]=e},_controlInterpolantsResultBuffer:new Float32Array(1)});Gd.prototype={constructor:Gd,onUpdate:function(a){this.dynamic=!0;this.onUpdateCallback=a;return this}};xb.prototype=Object.create(I.prototype);xb.prototype.constructor=xb;xb.prototype.isInstancedBufferGeometry=!0;xb.prototype.addGroup=function(a,b,c){this.groups.push({start:a,count:b,instances:c})};xb.prototype.copy=function(a){var b=a.index;null!==b&&this.setIndex(b.clone());var b=a.attributes,c;for(c in b)this.addAttribute(c, -b[c].clone());a=a.groups;c=0;for(b=a.length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count,d.instances)}return this};Hd.prototype={constructor:Hd,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(a,b){this.data.array[a*this.data.stride+this.offset]=b;return this},setY:function(a,b){this.data.array[a*this.data.stride+this.offset+1]=b;return this},setZ:function(a,b){this.data.array[a*this.data.stride+this.offset+2]=b;return this}, -setW:function(a,b){this.data.array[a*this.data.stride+this.offset+3]=b;return this},getX:function(a){return this.data.array[a*this.data.stride+this.offset]},getY:function(a){return this.data.array[a*this.data.stride+this.offset+1]},getZ:function(a){return this.data.array[a*this.data.stride+this.offset+2]},getW:function(a){return this.data.array[a*this.data.stride+this.offset+3]},setXY:function(a,b,c){a=a*this.data.stride+this.offset;this.data.array[a+0]=b;this.data.array[a+1]=c;return this},setXYZ:function(a, -b,c,d){a=a*this.data.stride+this.offset;this.data.array[a+0]=b;this.data.array[a+1]=c;this.data.array[a+2]=d;return this},setXYZW:function(a,b,c,d,e){a=a*this.data.stride+this.offset;this.data.array[a+0]=b;this.data.array[a+1]=c;this.data.array[a+2]=d;this.data.array[a+3]=e;return this}};Vb.prototype={constructor:Vb,isInterleavedBuffer:!0,set needsUpdate(a){!0===a&&this.version++},setDynamic:function(a){this.dynamic=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.count= -a.count;this.stride=a.stride;this.dynamic=a.dynamic;return this},copyAt:function(a,b,c){a*=this.stride;c*=b.stride;for(var d=0,e=this.stride;d<e;d++)this.array[a+d]=b.array[c+d];return this},set:function(a,b){void 0===b&&(b=0);this.array.set(a,b);return this},clone:function(){return(new this.constructor).copy(this)}};Wb.prototype=Object.create(Vb.prototype);Wb.prototype.constructor=Wb;Wb.prototype.isInstancedInterleavedBuffer=!0;Wb.prototype.copy=function(a){Vb.prototype.copy.call(this,a);this.meshPerAttribute= -a.meshPerAttribute;return this};Xb.prototype=Object.create(z.prototype);Xb.prototype.constructor=Xb;Xb.prototype.isInstancedBufferAttribute=!0;Xb.prototype.copy=function(a){z.prototype.copy.call(this,a);this.meshPerAttribute=a.meshPerAttribute;return this};Id.prototype={constructor:Id,linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(a,b){b&&b.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(b.matrixWorld),this.ray.direction.set(a.x,a.y,.5).unproject(b).sub(this.ray.origin).normalize()): -b&&b.isOrthographicCamera?(this.ray.origin.set(a.x,a.y,(b.near+b.far)/(b.near-b.far)).unproject(b),this.ray.direction.set(0,0,-1).transformDirection(b.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,b){var c=[];Jd(a,this,c,b);c.sort(me);return c},intersectObjects:function(a,b){var c=[];if(!1===Array.isArray(a))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),c;for(var d=0,e=a.length;d<e;d++)Jd(a[d],this,c,b);c.sort(me); -return c}};Kd.prototype={constructor:Kd,start:function(){this.oldTime=this.startTime=(performance||Date).now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=(performance||Date).now(),a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}};Ld.prototype={constructor:Ld,set:function(a,b,c){this.radius= -a;this.phi=b;this.theta=c;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.radius.copy(a.radius);this.phi.copy(a.phi);this.theta.copy(a.theta);return this},makeSafe:function(){this.phi=Math.max(1E-6,Math.min(Math.PI-1E-6,this.phi));return this},setFromVector3:function(a){this.radius=a.length();0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(a.x,a.z),this.phi=Math.acos(h.Math.clamp(a.y/this.radius,-1,1)));return this}};la.prototype=Object.create(va.prototype); -la.prototype.constructor=la;la.prototype.createAnimation=function(a,b,c,d){b={start:b,end:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};la.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)_?(\d+)/i,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var k=e.morphTargets[f].name.match(b);if(k&&1<k.length){var h=k[1];d[h]||(d[h]={start:Infinity, -end:-Infinity});k=d[h];f<k.start&&(k.start=f);f>k.end&&(k.end=f);c||(c=h)}}for(h in d)k=d[h],this.createAnimation(h,k.start,k.end,a);this.firstAnimation=c};la.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};la.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};la.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/ -c.fps)};la.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};la.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};la.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};la.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};la.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration; -return b};la.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("THREE.MorphBlendMesh: animation["+a+"] undefined in .playAnimation()")};la.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};la.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*= --1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.start+h.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);d.currentFrame!==d.lastFrame?(this.morphTargetInfluences[d.currentFrame]= -e*g,this.morphTargetInfluences[d.lastFrame]=(1-e)*g):this.morphTargetInfluences[d.currentFrame]=g}}};Dc.prototype=Object.create(D.prototype);Dc.prototype.constructor=Dc;Dc.prototype.isImmediateRenderObject=!0;Ec.prototype=Object.create(ha.prototype);Ec.prototype.constructor=Ec;Ec.prototype.update=function(){var a=new q,b=new q,c=new ya;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,f=this.geometry.attributes.position, -g=this.object.geometry;if(g&&g.isGeometry)for(var k=g.vertices,h=g.faces,m=g=0,q=h.length;m<q;m++)for(var p=h[m],n=0,r=p.vertexNormals.length;n<r;n++){var t=p.vertexNormals[n];a.copy(k[p[d[n]]]).applyMatrix4(e);b.copy(t).applyMatrix3(c).normalize().multiplyScalar(this.size).add(a);f.setXYZ(g,a.x,a.y,a.z);g+=1;f.setXYZ(g,b.x,b.y,b.z);g+=1}else if(g&&g.isBufferGeometry)for(d=g.attributes.position,k=g.attributes.normal,n=g=0,r=d.count;n<r;n++)a.set(d.getX(n),d.getY(n),d.getZ(n)).applyMatrix4(e),b.set(k.getX(n), -k.getY(n),k.getZ(n)),b.applyMatrix3(c).normalize().multiplyScalar(this.size).add(a),f.setXYZ(g,a.x,a.y,a.z),g+=1,f.setXYZ(g,b.x,b.y,b.z),g+=1;f.needsUpdate=!0;return this}}();Yb.prototype=Object.create(D.prototype);Yb.prototype.constructor=Yb;Yb.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};Yb.prototype.update=function(){var a=new q,b=new q;return function(){var c=this.light.distance?this.light.distance:1E3,d=c*Math.tan(this.light.angle);this.cone.scale.set(d, -d,c);a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(b.sub(a));this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}();Zb.prototype=Object.create(ha.prototype);Zb.prototype.constructor=Zb;Zb.prototype.getBoneList=function(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;c<a.children.length;c++)b.push.apply(b,this.getBoneList(a.children[c]));return b};Zb.prototype.update=function(){for(var a=this.geometry, -b=(new P).getInverse(this.root.matrixWorld),c=new P,d=0,e=0;e<this.bones.length;e++){var f=this.bones[e];f.parent&&f.parent.isBone&&(c.multiplyMatrices(b,f.matrixWorld),a.vertices[d].setFromMatrixPosition(c),c.multiplyMatrices(b,f.parent.matrixWorld),a.vertices[d+1].setFromMatrixPosition(c),d+=2)}a.verticesNeedUpdate=!0;a.computeBoundingSphere()};$b.prototype=Object.create(va.prototype);$b.prototype.constructor=$b;$b.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};$b.prototype.update= -function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};ac.prototype=Object.create(D.prototype);ac.prototype.constructor=ac;ac.prototype.dispose=function(){this.lightSphere.geometry.dispose();this.lightSphere.material.dispose()};ac.prototype.update=function(){var a=new q;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity);this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity);this.lightSphere.lookAt(a.setFromMatrixPosition(this.light.matrixWorld).negate()); -this.lightSphere.geometry.colorsNeedUpdate=!0}}();Fc.prototype=Object.create(ha.prototype);Fc.prototype.constructor=Fc;Fc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Gc.prototype=Object.create(ha.prototype);Gc.prototype.constructor=Gc;Gc.prototype.update=function(){var a=new q,b=new q,c=new ya;return function(){this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);for(var d=this.object.matrixWorld, -e=this.geometry.attributes.position,f=this.object.geometry,g=f.vertices,f=f.faces,k=0,h=0,m=f.length;h<m;h++){var q=f[h],p=q.normal;a.copy(g[q.a]).add(g[q.b]).add(g[q.c]).divideScalar(3).applyMatrix4(d);b.copy(p).applyMatrix3(c).normalize().multiplyScalar(this.size).add(a);e.setXYZ(k,a.x,a.y,a.z);k+=1;e.setXYZ(k,b.x,b.y,b.z);k+=1}e.needsUpdate=!0;return this}}();bc.prototype=Object.create(D.prototype);bc.prototype.constructor=bc;bc.prototype.dispose=function(){var a=this.children[0],b=this.children[1]; -a.geometry.dispose();a.material.dispose();b.geometry.dispose();b.material.dispose()};bc.prototype.update=function(){var a=new q,b=new q,c=new q;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);var d=this.children[0],e=this.children[1];d.lookAt(c);d.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);e.lookAt(c);e.scale.z=c.length()}}();Hc.prototype=Object.create(ha.prototype);Hc.prototype.constructor= -Hc;Hc.prototype.update=function(){function a(a,g,k,h){d.set(g,k,h).unproject(e);a=c[a];if(void 0!==a)for(g=0,k=a.length;g<k;g++)b.vertices[a[g]].copy(d)}var b,c,d=new q,e=new qa;return function(){b=this.geometry;c=this.pointMap;e.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",.7,1.1,-1);a("u2",-.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1); -a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);b.verticesNeedUpdate=!0}}();Ic.prototype=Object.create(va.prototype);Ic.prototype.constructor=Ic;Ic.prototype.update=function(){this.box.setFromObject(this.object);this.box.size(this.scale);this.box.getCenter(this.position)};Jc.prototype=Object.create(ha.prototype);Jc.prototype.constructor=Jc;Jc.prototype.update=function(){var a=new Ha;return function(b){b&&b.isBox3?a.copy(b):a.setFromObject(b); -if(!a.isEmpty()){b=a.min;var c=a.max,d=this.geometry.attributes.position,e=d.array;e[0]=c.x;e[1]=c.y;e[2]=c.z;e[3]=b.x;e[4]=c.y;e[5]=c.z;e[6]=b.x;e[7]=b.y;e[8]=c.z;e[9]=c.x;e[10]=b.y;e[11]=c.z;e[12]=c.x;e[13]=c.y;e[14]=b.z;e[15]=b.x;e[16]=c.y;e[17]=b.z;e[18]=b.x;e[19]=b.y;e[20]=b.z;e[21]=c.x;e[22]=b.y;e[23]=b.z;d.needsUpdate=!0;this.geometry.computeBoundingSphere()}}}();var ne=new I;ne.addAttribute("position",new ma([0,0,0,0,1,0],3));var oe=new Za(0,.5,1,5,1);oe.translate(0,-.5,0);yb.prototype=Object.create(D.prototype); -yb.prototype.constructor=yb;yb.prototype.setDirection=function(){var a=new q,b;return function(c){.99999<c.y?this.quaternion.set(0,0,0,1):-.99999>c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();yb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};yb.prototype.setColor= -function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};id.prototype=Object.create(ha.prototype);id.prototype.constructor=id;h.CatmullRomCurve3=function(){function a(){}var b=new q,c=new a,d=new a,e=new a;a.prototype.init=function(a,b,c,d){this.c0=a;this.c1=c;this.c2=-3*a+3*b-2*c-d;this.c3=2*a-2*b+c+d};a.prototype.initNonuniformCatmullRom=function(a,b,c,d,e,h,p){this.init(b,c,((b-a)/e-(c-a)/(e+h)+(c-b)/h)*h,((c-b)/h-(d-b)/(h+p)+(d-c)/p)*h)};a.prototype.initCatmullRom=function(a, -b,c,d,e){this.init(b,c,e*(c-a),e*(d-b))};a.prototype.calc=function(a){var b=a*a;return this.c0+this.c1*a+this.c2*b+this.c3*b*a};return Y.create(function(a){this.points=a||[];this.closed=!1},function(a){var g=this.points,k,h;h=g.length;2>h&&console.log("duh, you need at least 2 points");a*=h-(this.closed?0:1);k=Math.floor(a);a-=k;this.closed?k+=0<k?0:(Math.floor(Math.abs(k)/g.length)+1)*g.length:0===a&&k===h-1&&(k=h-2,a=1);var m,u,p;this.closed||0<k?m=g[(k-1)%h]:(b.subVectors(g[0],g[1]).add(g[0]), -m=b);u=g[k%h];p=g[(k+1)%h];this.closed||k+2<h?g=g[(k+2)%h]:(b.subVectors(g[h-1],g[h-2]).add(g[h-1]),g=b);if(void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var n="chordal"===this.type?.5:.25;h=Math.pow(m.distanceToSquared(u),n);k=Math.pow(u.distanceToSquared(p),n);n=Math.pow(p.distanceToSquared(g),n);1E-4>k&&(k=1);1E-4>h&&(h=k);1E-4>n&&(n=k);c.initNonuniformCatmullRom(m.x,u.x,p.x,g.x,h,k,n);d.initNonuniformCatmullRom(m.y,u.y,p.y,g.y,h,k,n);e.initNonuniformCatmullRom(m.z,u.z, -p.z,g.z,h,k,n)}else"catmullrom"===this.type&&(h=void 0!==this.tension?this.tension:.5,c.initCatmullRom(m.x,u.x,p.x,g.x,h),d.initCatmullRom(m.y,u.y,p.y,g.y,h),e.initCatmullRom(m.z,u.z,p.z,g.z,h));return new q(c.calc(a),d.calc(a),e.calc(a))})}();pe.prototype=Object.create(h.CatmullRomCurve3.prototype);var of=Y.create(function(a){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3");this.points=void 0===a?[]:a},function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a); -a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=h.CurveUtils.interpolate;return new q(c(d.x,e.x,f.x,b.x,a),c(d.y,e.y,f.y,b.y,a),c(d.z,e.z,f.z,b.z,a))});h.CubicBezierCurve3=Y.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b=h.ShapeUtils.b3;return new q(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y),b(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z))});h.QuadraticBezierCurve3= -Y.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b=h.ShapeUtils.b2;return new q(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y),b(a,this.v0.z,this.v1.z,this.v2.z))});h.LineCurve3=Y.create(function(a,b){this.v1=a;this.v2=b},function(a){if(1===a)return this.v2.clone();var b=new q;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b});jd.prototype=Object.create(Ra.prototype);jd.prototype.constructor=jd;h.SceneUtils={createMultiMaterialObject:function(a, -b){for(var c=new hc,d=0,e=b.length;d<e;d++)c.add(new va(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new P;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};Object.assign(cc.prototype,{center:function(a){console.warn("THREE.Box2: .center() has been renamed to .getCenter().");return this.getCenter(a)},empty:function(){console.warn("THREE.Box2: .empty() has been renamed to .isEmpty().");return this.isEmpty()}, -isIntersectionBox:function(a){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},size:function(a){console.warn("THREE.Box2: .size() has been renamed to .getSize().");return this.getSize(a)}});Object.assign(Ha.prototype,{center:function(a){console.warn("THREE.Box3: .center() has been renamed to .getCenter().");return this.getCenter(a)},empty:function(){console.warn("THREE.Box3: .empty() has been renamed to .isEmpty().");return this.isEmpty()}, -isIntersectionBox:function(a){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},isIntersectionSphere:function(a){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)},size:function(a){console.warn("THREE.Box3: .size() has been renamed to .getSize().");return this.getSize(a)}});Object.assign(cb.prototype,{center:function(a){console.warn("THREE.Line3: .center() has been renamed to .getCenter()."); -return this.getCenter(a)}});Object.assign(ya.prototype,{multiplyVector3:function(a){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)}});Object.assign(P.prototype,{extractPosition:function(a){console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."); -return this.copyPosition(a)},setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(a)},multiplyVector3:function(a){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return a.applyProjection(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."); -return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."); -return a.applyMatrix4(this)},translate:function(a){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(a){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(a){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(a){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(a,b){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}});Object.assign(fa.prototype,{isIntersectionLine:function(a){console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."); -return this.intersectsLine(a)}});Object.assign(ca.prototype,{multiplyVector3:function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)}});Object.assign(Wa.prototype,{isIntersectionBox:function(a){console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},isIntersectionPlane:function(a){console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."); -return this.intersectsPlane(a)},isIntersectionSphere:function(a){console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)}});Object.assign(wb.prototype,{extrude:function(a){console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.");return new ra(this,a)},makeGeometry:function(a){console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.");return new Ya(this,a)}});Object.assign(q.prototype, -{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."); -return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(b,a)}});Object.assign(D.prototype,{getChildByName:function(a){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a)},renderDepth:function(a){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(a, -b){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(b,a)}});Object.defineProperties(D.prototype,{eulerOrder:{get:function(){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");return this.rotation.order},set:function(a){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");this.rotation.order=a}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}, -set:function(a){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.defineProperties(gc.prototype,{objects:{get:function(){console.warn("THREE.LOD: .objects has been renamed to .levels.");return this.levels}}});Ca.prototype.setLens=function(a,b){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.");void 0!==b&&(this.filmGauge=b);this.setFocalLength(a)};Object.defineProperties(oa.prototype, -{onlyShadow:{set:function(a){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(a){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov.");this.shadow.camera.fov=a}},shadowCameraLeft:{set:function(a){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left.");this.shadow.camera.left=a}},shadowCameraRight:{set:function(a){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right.");this.shadow.camera.right=a}}, -shadowCameraTop:{set:function(a){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top.");this.shadow.camera.top=a}},shadowCameraBottom:{set:function(a){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.");this.shadow.camera.bottom=a}},shadowCameraNear:{set:function(a){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near.");this.shadow.camera.near=a}},shadowCameraFar:{set:function(a){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."); -this.shadow.camera.far=a}},shadowCameraVisible:{set:function(a){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(a){console.warn("THREE.Light: .shadowBias is now .shadow.bias.");this.shadow.bias=a}},shadowDarkness:{set:function(a){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(a){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."); -this.shadow.mapSize.width=a}},shadowMapHeight:{set:function(a){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.");this.shadow.mapSize.height=a}}});Object.defineProperties(z.prototype,{length:{get:function(){console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count.");return this.array.length}}});Object.assign(I.prototype,{addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(a)},addDrawCall:function(a, -b,c){void 0!==c&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.");console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup().");this.addGroup(a,b)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().");this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}); -Object.defineProperties(I.prototype,{drawcalls:{get:function(){console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups.");return this.groups}},offsets:{get:function(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups.");return this.groups}}});Object.defineProperties(S.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(a){console.warn("THREE."+this.type+": .wrapAround has been removed.")}}, -wrapRGB:{get:function(){console.warn("THREE."+this.type+": .wrapRGB has been removed.");return new H}}});Object.defineProperties($a.prototype,{metal:{get:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.");return!1},set:function(a){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(Da.prototype,{derivatives:{get:function(){console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."); -return this.extensions.derivatives},set:function(a){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");this.extensions.derivatives=a}}});pa.prototype=Object.assign(Object.create({constructor:pa,apply:function(a){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in.");Object.assign(a,this)}}),pa.prototype);Object.assign(od.prototype,{supportsFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."); -return this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."); -return this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return this.capabilities.vertexTextures}, -supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(a){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().");this.setScissorTest(a)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}, -addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}});Object.defineProperties(od.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."); -this.shadowMap.type=a}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");this.shadowMap.cullFace=a}}});Object.defineProperties($d.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+a+".");this.renderReverseSided=a}}});Object.defineProperties(zb.prototype, -{wrapS:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");return this.texture.wrapS},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");this.texture.wrapS=a}},wrapT:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");return this.texture.wrapT},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");this.texture.wrapT=a}},magFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."); -return this.texture.magFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");this.texture.magFilter=a}},minFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");return this.texture.minFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");this.texture.minFilter=a}},anisotropy:{get:function(){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."); -return this.texture.anisotropy},set:function(a){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=a}},offset:{get:function(){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");return this.texture.offset},set:function(a){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");this.texture.offset=a}},repeat:{get:function(){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");return this.texture.repeat}, -set:function(a){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");this.texture.repeat=a}},format:{get:function(){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");return this.texture.format},set:function(a){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");this.texture.format=a}},type:{get:function(){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");return this.texture.type},set:function(a){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."); -this.texture.type=a}},generateMipmaps:{get:function(){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");return this.texture.generateMipmaps},set:function(a){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");this.texture.generateMipmaps=a}}});Object.assign(Ub.prototype,{load:function(a){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var b=this;(new zd).load(a,function(a){b.setBuffer(a)}); -return this}});Object.assign(Cd.prototype,{getData:function(a){console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData().");return this.getFrequencyData()}});Object.defineProperty(h,"AudioContext",{get:function(){return h.getAudioContext()}});h.WebGLRenderTargetCube=Ab;h.WebGLRenderTarget=zb;h.WebGLRenderer=od;h.ShaderLib=Cb;h.UniformsLib=U;h.ShaderChunk=Z;h.FogExp2=Eb;h.Fog=Fb;h.Scene=fb;h.LensFlare=pd;h.Sprite=fc;h.LOD=gc;h.SkinnedMesh=Pc;h.Skeleton=Nc;h.Bone=Oc;h.Mesh=va;h.LineSegments= -ha;h.Line=Pa;h.Points=Gb;h.Group=hc;h.VideoTexture=Qc;h.DataTexture=hb;h.CompressedTexture=Hb;h.CubeTexture=Ta;h.CanvasTexture=Rc;h.DepthTexture=ic;h.TextureIdCount=function(){return Pd++};h.Texture=ba;h.MaterialIdCount=function(){return Zd++};h.CompressedTextureLoader=ie;h.BinaryTextureLoader=rd;h.DataTextureLoader=rd;h.CubeTextureLoader=sd;h.TextureLoader=Sc;h.ObjectLoader=je;h.MaterialLoader=fd;h.BufferGeometryLoader=td;h.LoadingManager=qd;h.JSONLoader=ud;h.ImageLoader=yc;h.FontLoader=ke;h.XHRLoader= -za;h.Loader=sb;h.AudioLoader=zd;h.SpotLightShadow=Uc;h.SpotLight=Vc;h.PointLight=Wc;h.HemisphereLight=Tc;h.DirectionalLightShadow=Xc;h.DirectionalLight=Yc;h.AmbientLight=Zc;h.LightShadow=pb;h.Light=oa;h.StereoCamera=le;h.PerspectiveCamera=Ca;h.OrthographicCamera=Db;h.CubeCamera=gd;h.Camera=qa;h.AudioListener=Ad;h.PositionalAudio=Bd;h.getAudioContext=xd;h.AudioAnalyser=Cd;h.Audio=Ub;h.VectorKeyframeTrack=Sb;h.StringKeyframeTrack=cd;h.QuaternionKeyframeTrack=Ac;h.NumberKeyframeTrack=Tb;h.ColorKeyframeTrack= -ed;h.BooleanKeyframeTrack=dd;h.PropertyMixer=hd;h.PropertyBinding=ka;h.KeyframeTrack=rb;h.AnimationObjectGroup=Dd;h.AnimationMixer=Fd;h.AnimationClip=ta;h.Uniform=Gd;h.InstancedBufferGeometry=xb;h.BufferGeometry=I;h.GeometryIdCount=function(){return Lc++};h.Geometry=R;h.InterleavedBufferAttribute=Hd;h.InstancedInterleavedBuffer=Wb;h.InterleavedBuffer=Vb;h.InstancedBufferAttribute=Xb;h.DynamicBufferAttribute=function(a,b){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."); -return(new z(a,b)).setDynamic(!0)};h.Float64Attribute=function(a,b){return new z(new Float64Array(a),b)};h.Float32Attribute=ma;h.Uint32Attribute=ce;h.Int32Attribute=function(a,b){return new z(new Int32Array(a),b)};h.Uint16Attribute=be;h.Int16Attribute=function(a,b){return new z(new Int16Array(a),b)};h.Uint8ClampedAttribute=function(a,b){return new z(new Uint8ClampedArray(a),b)};h.Uint8Attribute=function(a,b){return new z(new Uint8Array(a),b)};h.Int8Attribute=function(a,b){return new z(new Int8Array(a), -b)};h.BufferAttribute=z;h.Face3=ga;h.Object3DIdCount=function(){return ae++};h.Object3D=D;h.Raycaster=Id;h.Layers=Kc;h.EventDispatcher=pa;h.Clock=Kd;h.QuaternionLinearInterpolant=bd;h.LinearInterpolant=zc;h.DiscreteInterpolant=ad;h.CubicInterpolant=$c;h.Interpolant=ja;h.Triangle=Fa;h.Spline=function(a){function b(a,b,c,d,e,f,g){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,l,m,u,p,n;this.initFromArray=function(a){this.points=[]; -for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:f+2;m=this.points[c[0]];u=this.points[c[1]];p=this.points[c[2]];n=this.points[c[3]];h=g*g;l=g*h;d.x=b(m.x,u.x,p.x,n.x,g,h,l);d.y=b(m.y,u.y,p.y,n.y,g,h,l);d.z=b(m.z,u.z,p.z,n.z,g,h,l);return d};this.getControlPointsArray=function(){var a, -b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=0,f=new q,g=new q,h=[],k=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),k+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!==e&&(h[b]=k,e=b);h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],k=new q,l=this.getLength();h.push(k.copy(this.points[0]).clone()); -for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];g=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+1/g*c*(f-e),d=this.getPoint(d),h.push(k.copy(d).clone());h.push(k.copy(this.points[b]).clone())}this.points=h}};h.Spherical=Ld;h.Plane=fa;h.Frustum=dc;h.Sphere=Aa;h.Ray=Wa;h.Matrix4=P;h.Matrix3=ya;h.Box3=Ha;h.Box2=cc;h.Line3=cb;h.Euler=Xa;h.Vector4=da;h.Vector3=q;h.Vector2=C;h.Quaternion=ca;h.Color=H;h.MorphBlendMesh=la;h.ImmediateRenderObject= -Dc;h.VertexNormalsHelper=Ec;h.SpotLightHelper=Yb;h.SkeletonHelper=Zb;h.PointLightHelper=$b;h.HemisphereLightHelper=ac;h.GridHelper=Fc;h.FaceNormalsHelper=Gc;h.DirectionalLightHelper=bc;h.CameraHelper=Hc;h.BoundingBoxHelper=Ic;h.BoxHelper=Jc;h.ArrowHelper=yb;h.AxisHelper=id;h.ClosedSplineCurve3=pe;h.SplineCurve3=of;h.ArcCurve=jd;h.EllipseCurve=Ra;h.SplineCurve=tb;h.CubicBezierCurve=ub;h.QuadraticBezierCurve=vb;h.LineCurve=La;h.Shape=wb;h.ShapePath=vd;h.Path=Cc;h.Font=wd;h.CurvePath=Bc;h.Curve=Y;h.WireframeGeometry= -Ib;h.ParametricGeometry=jc;h.TetrahedronGeometry=kc;h.OctahedronGeometry=lc;h.IcosahedronGeometry=mc;h.DodecahedronGeometry=nc;h.PolyhedronGeometry=sa;h.TubeGeometry=wa;h.TorusKnotGeometry=oc;h.TorusKnotBufferGeometry=Jb;h.TorusGeometry=pc;h.TorusBufferGeometry=Kb;h.TextGeometry=qc;h.SphereBufferGeometry=ib;h.SphereGeometry=Lb;h.RingGeometry=rc;h.RingBufferGeometry=Mb;h.PlaneBufferGeometry=eb;h.PlaneGeometry=sc;h.LatheGeometry=tc;h.LatheBufferGeometry=Nb;h.ShapeGeometry=Ya;h.ExtrudeGeometry=ra;h.EdgesGeometry= -Ob;h.ConeGeometry=uc;h.ConeBufferGeometry=vc;h.CylinderGeometry=jb;h.CylinderBufferGeometry=Za;h.CircleBufferGeometry=Pb;h.CircleGeometry=wc;h.BoxBufferGeometry=db;h.BoxGeometry=kb;h.ShadowMaterial=Qb;h.SpriteMaterial=gb;h.RawShaderMaterial=Rb;h.ShaderMaterial=Da;h.PointsMaterial=Ja;h.MultiMaterial=xc;h.MeshPhysicalMaterial=lb;h.MeshStandardMaterial=Ka;h.MeshPhongMaterial=$a;h.MeshNormalMaterial=mb;h.MeshLambertMaterial=nb;h.MeshDepthMaterial=Ua;h.MeshBasicMaterial=Ia;h.LineDashedMaterial=ob;h.LineBasicMaterial= -na;h.Material=S;h.REVISION="81";h.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};h.CullFaceNone=0;h.CullFaceBack=1;h.CullFaceFront=2;h.CullFaceFrontBack=3;h.FrontFaceDirectionCW=0;h.FrontFaceDirectionCCW=1;h.BasicShadowMap=0;h.PCFShadowMap=1;h.PCFSoftShadowMap=2;h.FrontSide=0;h.BackSide=1;h.DoubleSide=2;h.FlatShading=1;h.SmoothShading=2;h.NoColors=0;h.FaceColors=1;h.VertexColors=2;h.NoBlending=0;h.NormalBlending=1;h.AdditiveBlending=2;h.SubtractiveBlending=3;h.MultiplyBlending=4;h.CustomBlending=5;h.BlendingMode= -qe;h.AddEquation=100;h.SubtractEquation=101;h.ReverseSubtractEquation=102;h.MinEquation=103;h.MaxEquation=104;h.ZeroFactor=200;h.OneFactor=201;h.SrcColorFactor=202;h.OneMinusSrcColorFactor=203;h.SrcAlphaFactor=204;h.OneMinusSrcAlphaFactor=205;h.DstAlphaFactor=206;h.OneMinusDstAlphaFactor=207;h.DstColorFactor=208;h.OneMinusDstColorFactor=209;h.SrcAlphaSaturateFactor=210;h.NeverDepth=0;h.AlwaysDepth=1;h.LessDepth=2;h.LessEqualDepth=3;h.EqualDepth=4;h.GreaterEqualDepth=5;h.GreaterDepth=6;h.NotEqualDepth= -7;h.MultiplyOperation=0;h.MixOperation=1;h.AddOperation=2;h.NoToneMapping=0;h.LinearToneMapping=1;h.ReinhardToneMapping=2;h.Uncharted2ToneMapping=3;h.CineonToneMapping=4;h.UVMapping=300;h.CubeReflectionMapping=301;h.CubeRefractionMapping=302;h.EquirectangularReflectionMapping=303;h.EquirectangularRefractionMapping=304;h.SphericalReflectionMapping=305;h.CubeUVReflectionMapping=306;h.CubeUVRefractionMapping=307;h.TextureMapping=re;h.RepeatWrapping=1E3;h.ClampToEdgeWrapping=1001;h.MirroredRepeatWrapping= -1002;h.TextureWrapping=Md;h.NearestFilter=1003;h.NearestMipMapNearestFilter=1004;h.NearestMipMapLinearFilter=1005;h.LinearFilter=1006;h.LinearMipMapNearestFilter=1007;h.LinearMipMapLinearFilter=1008;h.TextureFilter=Nd;h.UnsignedByteType=1009;h.ByteType=1010;h.ShortType=1011;h.UnsignedShortType=1012;h.IntType=1013;h.UnsignedIntType=1014;h.FloatType=1015;h.HalfFloatType=1016;h.UnsignedShort4444Type=1017;h.UnsignedShort5551Type=1018;h.UnsignedShort565Type=1019;h.UnsignedInt248Type=1020;h.AlphaFormat= -1021;h.RGBFormat=1022;h.RGBAFormat=1023;h.LuminanceFormat=1024;h.LuminanceAlphaFormat=1025;h.RGBEFormat=1023;h.DepthFormat=1026;h.DepthStencilFormat=1027;h.RGB_S3TC_DXT1_Format=2001;h.RGBA_S3TC_DXT1_Format=2002;h.RGBA_S3TC_DXT3_Format=2003;h.RGBA_S3TC_DXT5_Format=2004;h.RGB_PVRTC_4BPPV1_Format=2100;h.RGB_PVRTC_2BPPV1_Format=2101;h.RGBA_PVRTC_4BPPV1_Format=2102;h.RGBA_PVRTC_2BPPV1_Format=2103;h.RGB_ETC1_Format=2151;h.LoopOnce=2200;h.LoopRepeat=2201;h.LoopPingPong=2202;h.InterpolateDiscrete=2300;h.InterpolateLinear= -2301;h.InterpolateSmooth=2302;h.ZeroCurvatureEnding=2400;h.ZeroSlopeEnding=2401;h.WrapAroundEnding=2402;h.TrianglesDrawMode=0;h.TriangleStripDrawMode=1;h.TriangleFanDrawMode=2;h.LinearEncoding=3E3;h.sRGBEncoding=3001;h.GammaEncoding=3007;h.RGBEEncoding=3002;h.LogLuvEncoding=3003;h.RGBM7Encoding=3004;h.RGBM16Encoding=3005;h.RGBDEncoding=3006;h.BasicDepthPacking=3200;h.RGBADepthPacking=3201;h.CubeGeometry=kb;h.Face4=function(a,b,c,d,e,f,g){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."); -return new ga(a,b,c,e,f,g)};h.LineStrip=0;h.LinePieces=1;h.MeshFaceMaterial=xc;h.PointCloud=function(a,b){console.warn("THREE.PointCloud has been renamed to THREE.Points.");return new Gb(a,b)};h.Particle=fc;h.ParticleSystem=function(a,b){console.warn("THREE.ParticleSystem has been renamed to THREE.Points.");return new Gb(a,b)};h.PointCloudMaterial=function(a){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.");return new Ja(a)};h.ParticleBasicMaterial=function(a){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."); -return new Ja(a)};h.ParticleSystemMaterial=function(a){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.");return new Ja(a)};h.Vertex=function(a,b,c){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead.");return new q(a,b,c)};h.EdgesHelper=function(a,b){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.");return new ha(new Ob(a.geometry),new na({color:void 0!==b?b:16777215}))};h.WireframeHelper=function(a,b){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."); -return new ha(new Ib(a.geometry),new na({color:void 0!==b?b:16777215}))};h.GeometryUtils={merge:function(a,b,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b.isMesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry);a.merge(b,d,c)},center:function(a){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return a.center()}};h.ImageUtils= -{crossOrigin:void 0,loadTexture:function(a,b,c,d){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var e=new Sc;e.setCrossOrigin(this.crossOrigin);a=e.load(a,c,void 0,d);b&&(a.mapping=b);return a},loadTextureCube:function(a,b,c,d){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var e=new sd;e.setCrossOrigin(this.crossOrigin);a=e.load(a,c,void 0,d);b&&(a.mapping=b);return a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")}, -loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}};h.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(a,b){console.warn("THREE.Projector: .projectVector() is now vector.project().");a.project(b)};this.unprojectVector=function(a,b){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");a.unproject(b)}; -this.pickingRay=function(a,b){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};h.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}};Object.defineProperty(h,"__esModule",{value:!0})});